angular.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. "use strict";
  2. /**
  3. * @license
  4. * Copyright Google LLC All Rights Reserved.
  5. *
  6. * Use of this source code is governed by an MIT-style license that can be
  7. * found in the LICENSE file at https://angular.io/license
  8. */
  9. Object.defineProperty(exports, "__esModule", { value: true });
  10. const elements_1 = require("./elements");
  11. /** Finds the specified Angular @Input in the given elements with tag name. */
  12. function findInputsOnElementWithTag(html, inputName, tagNames) {
  13. return [
  14. // Inputs can be also used without brackets (e.g. `<mat-toolbar color="primary">`)
  15. ...elements_1.findAttributeOnElementWithTag(html, inputName, tagNames),
  16. // Add one column to the mapped offset because the first bracket for the @Input
  17. // is part of the attribute and therefore also part of the offset. We only want to return
  18. // the offset for the inner name of the bracketed input.
  19. ...elements_1.findAttributeOnElementWithTag(html, `[${inputName}]`, tagNames).map(offset => offset + 1),
  20. ];
  21. }
  22. exports.findInputsOnElementWithTag = findInputsOnElementWithTag;
  23. /** Finds the specified Angular @Input in elements that have one of the specified attributes. */
  24. function findInputsOnElementWithAttr(html, inputName, attrs) {
  25. return [
  26. // Inputs can be also used without brackets (e.g. `<button mat-button color="primary">`)
  27. ...elements_1.findAttributeOnElementWithAttrs(html, inputName, attrs),
  28. // Add one column to the mapped offset because the first bracket for the @Input
  29. // is part of the attribute and therefore also part of the offset. We only want to return
  30. // the offset for the inner name of the bracketed input.
  31. ...elements_1.findAttributeOnElementWithAttrs(html, `[${inputName}]`, attrs).map(offset => offset + 1),
  32. ];
  33. }
  34. exports.findInputsOnElementWithAttr = findInputsOnElementWithAttr;
  35. /** Finds the specified Angular @Output in the given elements with tag name. */
  36. function findOutputsOnElementWithTag(html, outputName, tagNames) {
  37. // Add one column to the mapped offset because the first parenthesis for the @Output
  38. // is part of the attribute and therefore also part of the offset. We only want to return
  39. // the offset for the inner name of the output.
  40. return elements_1.findAttributeOnElementWithTag(html, `(${outputName})`, tagNames).map(offset => offset + 1);
  41. }
  42. exports.findOutputsOnElementWithTag = findOutputsOnElementWithTag;
  43. /** Finds the specified Angular @Output in elements that have one of the specified attributes. */
  44. function findOutputsOnElementWithAttr(html, outputName, attrs) {
  45. // Add one column to the mapped offset because the first bracket for the @Output
  46. // is part of the attribute and therefore also part of the offset. We only want to return
  47. // the offset for the inner name of the output.
  48. return elements_1.findAttributeOnElementWithAttrs(html, `(${outputName})`, attrs).map(offset => offset + 1);
  49. }
  50. exports.findOutputsOnElementWithAttr = findOutputsOnElementWithAttr;
  51. //# sourceMappingURL=angular.js.map