All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.dist.decorators.customElement.js.map Maven / Gradle / Ivy

{"version":3,"file":"customElement.js","sourceRoot":"","sources":["../../src/decorators/customElement.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,MAAM,aAAa,GAAG,CAAC,6BAYnB,EAAE,EAAkB,EAAE;IACzB,OAAO,CAAC,MAAW,EAAE,EAAE;QACtB,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE;YAC9D,MAAM,CAAC,QAAQ,GAAG,EAAE,CAAC;SACrB;QAED,IAAI,OAAO,0BAA0B,KAAK,QAAQ,EAAE;YACnD,MAAM,CAAC,QAAQ,CAAC,GAAG,GAAG,0BAA0B,CAAC;YACjD,OAAO;SACP;QAED,MAAM,EACL,GAAG,EACH,aAAa,EACb,UAAU,EACV,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,QAAQ,GACP,GAAG,0BAA0B,CAAC;QAEhC,MAAM,CAAC,QAAQ,CAAC,GAAG,GAAG,GAAG,CAAC;QAC1B,IAAI,aAAa,EAAE;YAClB,MAAM,CAAC,QAAQ,CAAC,aAAa,GAAG,aAAa,CAAC;SAC9C;QAED,IAAI,QAAQ,EAAE;YACb,MAAM,CAAC,QAAQ,CAAC,QAAQ,GAAG,QAAQ,CAAC;SACpC;QAED,IAAI,UAAU,EAAE;YACf,MAAM,CAAC,QAAQ,CAAC,UAAU,GAAG,UAAU,CAAC;SACxC;QACD,IAAI,cAAc,EAAE;YACnB,MAAM,CAAC,QAAQ,CAAC,cAAc,GAAG,cAAc,CAAC;SAChD;QACD,IAAI,cAAc,EAAE;YACnB,MAAM,CAAC,QAAQ,CAAC,cAAc,GAAG,cAAc,CAAC;SAChD;QAED,IAAI,iBAAiB,EAAE;YACtB,MAAM,CAAC,QAAQ,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;SACtD;QAED,CAAC,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC,OAAO,CAAC,CAAC,mBAA2B,EAAE,EAAE;YAC1F,MAAM,wBAAwB,GAAG,0BAA0B,CAAC,mBAAuC,CAAC,CAAC;YAErG,wBAAwB,IAAI,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,mBAAmB,EAAE;gBAC9E,GAAG,EAAE,GAAG,EAAE,CAAC,0BAA0B,CAAC,mBAAuC,CAAC;aAC9E,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC;AACH,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import type UI5Element from \"../UI5Element.js\";\nimport type { Renderer } from \"../UI5Element.js\";\nimport type { TemplateFunction as Template } from \"../renderer/executeTemplate.js\";\nimport type { ComponentStylesData as Styles } from \"../types.js\";\n\n/**\n * Returns a custom element class decorator.\n *\n * @param { string | object } tagNameOrComponentSettings\n * @returns { ClassDecorator }\n */\nconst customElement = (tagNameOrComponentSettings: string | {\n\ttag?: string,\n\trenderer?: Renderer,\n\tstyles?: Styles,\n\ttemplate?: Template,\n\tdependencies?: Array,\n\tlanguageAware?: boolean,\n\tthemeAware?: boolean,\n\tfastNavigation?: boolean,\n\tformAssociated?: boolean,\n\tshadowRootOptions?: Partial,\n\tfeatures?: Array,\n} = {}): ClassDecorator => {\n\treturn (target: any) => {\n\t\tif (!Object.prototype.hasOwnProperty.call(target, \"metadata\")) {\n\t\t\ttarget.metadata = {};\n\t\t}\n\n\t\tif (typeof tagNameOrComponentSettings === \"string\") {\n\t\t\ttarget.metadata.tag = tagNameOrComponentSettings;\n\t\t\treturn;\n\t\t}\n\n\t\tconst {\n\t\t\ttag,\n\t\t\tlanguageAware,\n\t\t\tthemeAware,\n\t\t\tfastNavigation,\n\t\t\tformAssociated,\n\t\t\tshadowRootOptions,\n\t\t\tfeatures,\n\t\t } = tagNameOrComponentSettings;\n\n\t\ttarget.metadata.tag = tag;\n\t\tif (languageAware) {\n\t\t\ttarget.metadata.languageAware = languageAware;\n\t\t}\n\n\t\tif (features) {\n\t\t\ttarget.metadata.features = features;\n\t\t}\n\n\t\tif (themeAware) {\n\t\t\ttarget.metadata.themeAware = themeAware;\n\t\t}\n\t\tif (fastNavigation) {\n\t\t\ttarget.metadata.fastNavigation = fastNavigation;\n\t\t}\n\t\tif (formAssociated) {\n\t\t\ttarget.metadata.formAssociated = formAssociated;\n\t\t}\n\n\t\tif (shadowRootOptions) {\n\t\t\ttarget.metadata.shadowRootOptions = shadowRootOptions;\n\t\t}\n\n\t\t[\"renderer\", \"template\", \"styles\", \"dependencies\"].forEach((customElementEntity: string) => {\n\t\t\tconst customElementEntityValue = tagNameOrComponentSettings[customElementEntity as keyof typeof tag];\n\n\t\t\tcustomElementEntityValue && Object.defineProperty(target, customElementEntity, {\n\t\t\t\tget: () => tagNameOrComponentSettings[customElementEntity as keyof typeof tag],\n\t\t\t});\n\t\t});\n\t};\n};\n\nexport default customElement;\n"]}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy