@ui5/webcomponents-base 2.7.0-rc.0 → 2.7.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/dist/.tsbuildinfobuild +1 -1
- package/dist/FeaturesRegistry.d.ts +1 -16
- package/dist/FeaturesRegistry.js +1 -37
- package/dist/FeaturesRegistry.js.map +1 -1
- package/dist/UI5Element.js +0 -8
- package/dist/UI5Element.js.map +1 -1
- package/dist/UI5ElementMetadata.d.ts +0 -5
- package/dist/UI5ElementMetadata.js +0 -7
- package/dist/UI5ElementMetadata.js.map +1 -1
- package/dist/custom-elements-internal.json +15 -0
- package/dist/custom-elements.json +15 -0
- package/dist/decorators/customElement.d.ts +1 -0
- package/dist/decorators/customElement.js +1 -4
- package/dist/decorators/customElement.js.map +1 -1
- package/dist/features/F6Navigation.d.ts +1 -0
- package/dist/features/F6Navigation.js +14 -1
- package/dist/features/F6Navigation.js.map +1 -1
- package/dist/generated/VersionInfo.js +3 -3
- package/dist/generated/VersionInfo.js.map +1 -1
- package/dist/prod/FeaturesRegistry.js +1 -1
- package/dist/prod/FeaturesRegistry.js.map +3 -3
- package/dist/prod/UI5Element.js +1 -1
- package/dist/prod/UI5Element.js.map +3 -3
- package/dist/prod/UI5ElementMetadata.js +1 -1
- package/dist/prod/UI5ElementMetadata.js.map +2 -2
- package/dist/prod/decorators/customElement.js +1 -1
- package/dist/prod/decorators/customElement.js.map +3 -3
- package/dist/prod/features/F6Navigation.js +1 -1
- package/dist/prod/features/F6Navigation.js.map +3 -3
- package/dist/prod/generated/VersionInfo.js +1 -1
- package/dist/prod/generated/VersionInfo.js.map +1 -1
- package/dist/prod/ssr-dom-shim.js +1 -1
- package/dist/prod/ssr-dom-shim.js.map +3 -3
- package/dist/prod/thirdparty/preact/jsxRuntime.module.js +0 -1
- package/dist/prod/thirdparty/preact/preact.module.js +0 -1
- package/dist/prod/util/ColorConversion.js +1 -1
- package/dist/prod/util/ColorConversion.js.map +3 -3
- package/dist/prod/util/getFastNavigationGroups.js +1 -1
- package/dist/prod/util/getFastNavigationGroups.js.map +2 -2
- package/dist/prod/util/throttle.js +2 -0
- package/dist/prod/util/throttle.js.map +7 -0
- package/dist/ssr-dom-shim.js +46 -0
- package/dist/ssr-dom-shim.js.map +1 -1
- package/dist/thirdparty/preact/jsxRuntime.module.js +0 -1
- package/dist/thirdparty/preact/preact.module.js +0 -1
- package/dist/util/ColorConversion.js +24 -22
- package/dist/util/ColorConversion.js.map +1 -1
- package/dist/util/getFastNavigationGroups.js +6 -1
- package/dist/util/getFastNavigationGroups.js.map +1 -1
- package/dist/util/throttle.d.ts +2 -0
- package/dist/util/throttle.js +15 -0
- package/dist/util/throttle.js.map +1 -0
- package/package.json +3 -3
- package/src/thirdparty/preact/jsxRuntime.module.js +0 -1
- package/src/thirdparty/preact/preact.module.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customElement.js","sourceRoot":"","sources":["../../src/decorators/customElement.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,MAAM,aAAa,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"customElement.js","sourceRoot":"","sources":["../../src/decorators/customElement.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,MAAM,aAAa,GAAG,CAAC,6BAmDnB,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,CAAC;YAC/D,MAAM,CAAC,QAAQ,GAAG,EAAE,CAAC;QACtB,CAAC;QAED,IAAI,OAAO,0BAA0B,KAAK,QAAQ,EAAE,CAAC;YACpD,MAAM,CAAC,QAAQ,CAAC,GAAG,GAAG,0BAA0B,CAAC;YACjD,OAAO;QACR,CAAC;QAED,MAAM,EACL,GAAG,EACH,aAAa,EACb,UAAU,EACV,IAAI,EACJ,cAAc,EACd,cAAc,EACd,iBAAiB,GAChB,GAAG,0BAA0B,CAAC;QAEhC,MAAM,CAAC,QAAQ,CAAC,GAAG,GAAG,GAAG,CAAC;QAC1B,IAAI,aAAa,EAAE,CAAC;YACnB,MAAM,CAAC,QAAQ,CAAC,aAAa,GAAG,aAAa,CAAC;QAC/C,CAAC;QACD,IAAI,IAAI,EAAE,CAAC;YACV,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC;QAC7B,CAAC;QAED,IAAI,UAAU,EAAE,CAAC;YAChB,MAAM,CAAC,QAAQ,CAAC,UAAU,GAAG,UAAU,CAAC;QACzC,CAAC;QACD,IAAI,cAAc,EAAE,CAAC;YACpB,MAAM,CAAC,QAAQ,CAAC,cAAc,GAAG,cAAc,CAAC;QACjD,CAAC;QACD,IAAI,cAAc,EAAE,CAAC;YACpB,MAAM,CAAC,QAAQ,CAAC,cAAc,GAAG,cAAc,CAAC;QACjD,CAAC;QAED,IAAI,iBAAiB,EAAE,CAAC;YACvB,MAAM,CAAC,QAAQ,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;QACvD,CAAC;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\t/**\n\t * The tag name of the custom element (will be suffixed if the scoping feature is used).\n\t */\n\ttag?: string,\n\t/**\n\t * The renderer of the custom element - officially supported are: jsxRenderer and litRender (deprecated).\n\t */\n\trenderer?: Renderer,\n\t/**\n\t * The styles to be injected into the shadow root of the custom element.\n\t */\n\tstyles?: Styles,\n\t/**\n\t * The template function of the custom element - must match the renderer.\n\t */\n\ttemplate?: Template,\n\t/**\n\t * Other custom elements used in the shadow root of the custom element.\n\t * @deprecated no longer necessary for jsxRenderer-enabled components\n\t */\n\tdependencies?: Array<typeof UI5Element>,\n\t/**\n\t * Whether the custom element should be re-rendered when the language changes.\n\t */\n\tlanguageAware?: boolean,\n\t/**\n\t * Whether the custom element should be re-rendered when the theme changes.\n\t */\n\tthemeAware?: boolean,\n\t/**\n\t * Whether the custom element needs the CLDR assets.\n\t */\n\tcldr?: boolean,\n\t/**\n\t * Whether the custom element supports the F6 Fast navigation feature (is a fast-navigation group).\n\t */\n\tfastNavigation?: boolean,\n\t/**\n\t * Whether the custom element is form-associated and implements form-relevant features.\n\t */\n\tformAssociated?: boolean,\n\t/**\n\t * The shadow root options of the custom element.\n\t */\n\tshadowRootOptions?: Partial<ShadowRootInit>,\n\t/**\n\t * A list of all features, supported by the custom element.\n\t * @deprecated no longer necessary for jsxRenderer-enabled components\n\t */\n\tfeatures?: Array<string>,\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\tcldr,\n\t\t\tfastNavigation,\n\t\t\tformAssociated,\n\t\t\tshadowRootOptions,\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\t\tif (cldr) {\n\t\t\ttarget.metadata.cldr = cldr;\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"]}
|
|
@@ -10,6 +10,7 @@ declare class F6Navigation {
|
|
|
10
10
|
findPreviousFocusableGroupElement(currentIndex: number): Promise<HTMLElement | undefined>;
|
|
11
11
|
_keydownHandler(event: KeyboardEvent): Promise<void>;
|
|
12
12
|
updateGroups(): void;
|
|
13
|
+
findContainer(): HTMLElement;
|
|
13
14
|
setSelectedGroup(root?: DocumentOrShadowRoot): void;
|
|
14
15
|
deepActive(root: DocumentOrShadowRoot): Element | null;
|
|
15
16
|
destroy(): void;
|
|
@@ -131,8 +131,21 @@ class F6Navigation {
|
|
|
131
131
|
elementToFocus?.focus();
|
|
132
132
|
}
|
|
133
133
|
updateGroups() {
|
|
134
|
+
const container = this.findContainer();
|
|
134
135
|
this.setSelectedGroup();
|
|
135
|
-
this.groups = getFastNavigationGroups(
|
|
136
|
+
this.groups = getFastNavigationGroups(container);
|
|
137
|
+
}
|
|
138
|
+
findContainer() {
|
|
139
|
+
const htmlElement = window.document.querySelector("html");
|
|
140
|
+
let element = this.deepActive(window.document);
|
|
141
|
+
while (element && element !== htmlElement) {
|
|
142
|
+
const closestScopeEl = element.closest("[data-sap-ui-fastnavgroup-container='true']");
|
|
143
|
+
if (closestScopeEl) {
|
|
144
|
+
return closestScopeEl;
|
|
145
|
+
}
|
|
146
|
+
element = element.parentElement ? element.parentElement : element.parentNode.host;
|
|
147
|
+
}
|
|
148
|
+
return document.body;
|
|
136
149
|
}
|
|
137
150
|
setSelectedGroup(root = window.document) {
|
|
138
151
|
const htmlElement = window.document.querySelector("html");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"F6Navigation.js","sourceRoot":"","sources":["../../src/features/F6Navigation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,uBAAuB,MAAM,oCAAoC,CAAC;AACzE,OAAO,kBAAkB,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,iBAAiB,MAAM,yBAAyB,CAAC;AAMxD,MAAM,mBAAmB,GAAG,sBAAsB,EAAE,CAAC;AAErD,MAAM,YAAY,GAAG,CAAC,YAAgC,EAAE,EAAE;IACzD,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;QAChC,OAAO,IAAI,CAAC;IACb,CAAC;IACD,OAAO,eAAe,CAAC,mBAAmB,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC,CA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ACpD,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QACvD,CAAC;QAED,OAAO,IAAI,CAAC,aAAa,CAAC;IAC3B,CAAC;IAED,OAAO;QACN,IAAI,CAAC,oBAAoB,EAAE,CAAC;IAC7B,CAAC;IAED,IAAI,gBAAgB;QACnB,OAAO,mBAAmB,CAAC;IAC5B,CAAC;IAED,MAAM,CAAC,IAAI;QACV,MAAM,UAAU,GAAG,iBAAiB,CAAa,YAAY,EAAE,EAAE,CAAC,CAAC;QAEnE,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;YAC1B,UAAU,CAAC,QAAQ,GAAG,IAAI,YAAY,EAAE,CAAC;QAC1C,CAAC;aAAM,IAAI,YAAY,CAAC,UAAU,CAAC,QAAQ,EAAE,gBAAgB,CAAC,EAAE,CAAC;YAChE,UAAU,CAAC,QAAQ,EAAE,OAAO,EAAE,CAAC;YAC/B,UAAU,CAAC,QAAQ,GAAG,IAAI,YAAY,EAAE,CAAC;QAC1C,CAAC;IACF,CAAC;CACD;AAED,eAAe,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;AAE9C,eAAe,YAAY,CAAC","sourcesContent":["import { registerFeature } from \"../FeaturesRegistry.js\";\nimport { isF6Next, isF6Previous } from \"../Keys.js\";\nimport { instanceOfUI5Element } from \"../UI5Element.js\";\nimport { getFirstFocusableElement } from \"../util/FocusableElements.js\";\nimport getFastNavigationGroups from \"../util/getFastNavigationGroups.js\";\nimport isElementClickable from \"../util/isElementClickable.js\";\nimport { getCurrentRuntimeIndex, compareRuntimes } from \"../Runtimes.js\";\nimport getSharedResource from \"../getSharedResource.js\";\n\ntype F6Registry = {\n\tinstance?: F6Navigation,\n}\n\nconst currentRuntimeINdex = getCurrentRuntimeIndex();\n\nconst shouldUpdate = (runtimeIndex: number | undefined) => {\n\tif (runtimeIndex === undefined) {\n\t\treturn true;\n\t}\n\treturn compareRuntimes(currentRuntimeINdex, runtimeIndex) === 1; // 1 means the current is newer, 0 means the same, -1 means the resource's runtime is newer\n};\n\nclass F6Navigation {\n\tkeydownHandler: (event: KeyboardEvent) => void;\n\tselectedGroup: HTMLElement | null = null;\n\tgroups: Array<HTMLElement> = [];\n\n\tconstructor() {\n\t\tthis.keydownHandler = this._keydownHandler.bind(this) as (event: KeyboardEvent) => void;\n\t\tthis.attachEventListeners();\n\t}\n\n\tattachEventListeners() {\n\t\tdocument.addEventListener(\"keydown\", this.keydownHandler);\n\t}\n\n\tremoveEventListeners() {\n\t\tdocument.removeEventListener(\"keydown\", this.keydownHandler);\n\t}\n\n\tasync groupElementToFocus(nextElement: HTMLElement) {\n\t\tlet nextElementDomRef = nextElement;\n\n\t\tif (instanceOfUI5Element(nextElement)) {\n\t\t\tnextElementDomRef = nextElement.getDomRef() || nextElement.firstElementChild as HTMLElement;\n\t\t}\n\n\t\tif (nextElementDomRef) {\n\t\t\tif (isElementClickable(nextElementDomRef)) {\n\t\t\t\treturn nextElementDomRef;\n\t\t\t}\n\n\t\t\tconst elementToFocus = await getFirstFocusableElement(nextElementDomRef);\n\n\t\t\tif (elementToFocus) {\n\t\t\t\treturn elementToFocus;\n\t\t\t}\n\t\t}\n\t}\n\n\tasync findNextFocusableGroupElement(currentIndex: number) {\n\t\tlet elementToFocus;\n\n\t\t/* eslint-disable no-await-in-loop */\n\t\tfor (let index = 0; index < this.groups.length; index++) {\n\t\t\tlet nextElement;\n\n\t\t\tif (currentIndex > -1) {\n\t\t\t\tif (currentIndex + 1 >= this.groups.length) {\n\t\t\t\t\tcurrentIndex = 0;\n\t\t\t\t\tnextElement = this.groups[currentIndex];\n\t\t\t\t} else {\n\t\t\t\t\tcurrentIndex += 1;\n\t\t\t\t\tnextElement = this.groups[currentIndex];\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tcurrentIndex = 0;\n\t\t\t\tnextElement = this.groups[currentIndex];\n\t\t\t}\n\n\t\t\telementToFocus = await this.groupElementToFocus(nextElement);\n\n\t\t\tif (elementToFocus) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t/* eslint-enable no-await-in-loop */\n\n\t\treturn elementToFocus;\n\t}\n\n\tasync findPreviousFocusableGroupElement(currentIndex: number) {\n\t\tlet elementToFocus;\n\n\t\t/* eslint-disable no-await-in-loop */\n\t\tfor (let index = 0; index < this.groups.length; index++) {\n\t\t\tlet nextElement;\n\n\t\t\tif (currentIndex > 0) {\n\t\t\t\t// Handle the situation where the first focusable element of two neighbor groups is the same\n\t\t\t\t// For example:\n\t\t\t\t// <ui5-flexible-column-layout>\n\t\t\t\t// <ui5-list>\n\t\t\t\t// <ui5-li>List Item</ui5-li>\n\t\t\t\t// </ui5-list>\n\t\t\t\t// </ui5-flexible-column-layout>\n\t\t\t\t// Here for both FCL & List the firstFoccusableElement is the same (the ui5-li)\n\t\t\t\tconst firstFocusable = await this.groupElementToFocus(this.groups[currentIndex - 1]);\n\t\t\t\tconst shouldSkipParent = firstFocusable === await this.groupElementToFocus(this.groups[currentIndex]);\n\n\t\t\t\tcurrentIndex = shouldSkipParent ? currentIndex - 2 : currentIndex - 1;\n\n\t\t\t\tif (currentIndex < 0) {\n\t\t\t\t\tcurrentIndex = this.groups.length - 1;\n\t\t\t\t}\n\n\t\t\t\tnextElement = this.groups[currentIndex];\n\t\t\t} else {\n\t\t\t\tcurrentIndex = this.groups.length - 1;\n\t\t\t\tnextElement = this.groups[currentIndex];\n\t\t\t}\n\n\t\t\telementToFocus = await this.groupElementToFocus(nextElement);\n\n\t\t\tif (elementToFocus) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t/* eslint-enable no-await-in-loop */\n\n\t\treturn elementToFocus;\n\t}\n\n\tasync _keydownHandler(event: KeyboardEvent) {\n\t\tconst forward = isF6Next(event);\n\t\tconst backward = isF6Previous(event);\n\t\tif (!(forward || backward)) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.updateGroups();\n\n\t\tif (this.groups.length < 1) {\n\t\t\treturn;\n\t\t}\n\n\t\tevent.preventDefault();\n\n\t\tlet elementToFocus;\n\n\t\tif (this.groups.length === 0) {\n\t\t\telementToFocus = await this.groupElementToFocus(this.groups[0]);\n\n\t\t\treturn elementToFocus?.focus();\n\t\t}\n\n\t\tlet currentIndex = -1;\n\n\t\tif (this.selectedGroup) {\n\t\t\tcurrentIndex = this.groups.indexOf(this.selectedGroup);\n\t\t}\n\n\t\tif (forward) {\n\t\t\telementToFocus = await this.findNextFocusableGroupElement(currentIndex);\n\t\t}\n\n\t\tif (backward) {\n\t\t\telementToFocus = await this.findPreviousFocusableGroupElement(currentIndex);\n\t\t}\n\n\t\telementToFocus?.focus();\n\t}\n\n\tupdateGroups() {\n\t\tthis.setSelectedGroup();\n\t\tthis.groups = getFastNavigationGroups(document.body);\n\t}\n\n\tsetSelectedGroup(root: DocumentOrShadowRoot = window.document) {\n\t\tconst htmlElement = window.document.querySelector(\"html\");\n\t\tlet element: Element | null | ParentNode = this.deepActive(root);\n\n\t\twhile (element && (element as Element).getAttribute(\"data-sap-ui-fastnavgroup\") !== \"true\" && element !== htmlElement) {\n\t\t\telement = element.parentElement ? element.parentNode : (element.parentNode as ShadowRoot).host;\n\t\t}\n\n\t\tthis.selectedGroup = element as HTMLElement;\n\t}\n\n\tdeepActive(root: DocumentOrShadowRoot): Element | null {\n\t\tif (root?.activeElement?.shadowRoot?.activeElement) {\n\t\t\treturn this.deepActive(root.activeElement.shadowRoot);\n\t\t}\n\n\t\treturn root.activeElement;\n\t}\n\n\tdestroy() {\n\t\tthis.removeEventListeners();\n\t}\n\n\tget _ui5RuntimeIndex() {\n\t\treturn currentRuntimeINdex;\n\t}\n\n\tstatic init() {\n\t\tconst f6Registry = getSharedResource<F6Registry>(\"F6Registry\", {});\n\n\t\tif (!f6Registry.instance) {\n\t\t\tf6Registry.instance = new F6Navigation();\n\t\t} else if (shouldUpdate(f6Registry.instance?._ui5RuntimeIndex)) {\n\t\t\tf6Registry.instance?.destroy();\n\t\t\tf6Registry.instance = new F6Navigation();\n\t\t}\n\t}\n}\n\nregisterFeature(\"F6Navigation\", F6Navigation);\n\nexport default F6Navigation;\n"]}
|
|
1
|
+
{"version":3,"file":"F6Navigation.js","sourceRoot":"","sources":["../../src/features/F6Navigation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,uBAAuB,MAAM,oCAAoC,CAAC;AACzE,OAAO,kBAAkB,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,iBAAiB,MAAM,yBAAyB,CAAC;AAMxD,MAAM,mBAAmB,GAAG,sBAAsB,EAAE,CAAC;AAErD,MAAM,YAAY,GAAG,CAAC,YAAgC,EAAE,EAAE;IACzD,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;QAChC,OAAO,IAAI,CAAC;IACb,CAAC;IACD,OAAO,eAAe,CAAC,mBAAmB,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,2FAA2F;AAC7J,CAAC,CAAC;AAEF,MAAM,YAAY;IAKjB;QAHA,kBAAa,GAAuB,IAAI,CAAC;QACzC,WAAM,GAAuB,EAAE,CAAC;QAG/B,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAmC,CAAC;QACxF,IAAI,CAAC,oBAAoB,EAAE,CAAC;IAC7B,CAAC;IAED,oBAAoB;QACnB,QAAQ,CAAC,gBAAgB,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IAC3D,CAAC;IAED,oBAAoB;QACnB,QAAQ,CAAC,mBAAmB,C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CAAC,UAAyB,CAAC,IAAI,CAAC;QAChG,CAAC;QAED,IAAI,CAAC,aAAa,GAAG,OAAsB,CAAC;IAC7C,CAAC;IAED,UAAU,CAAC,IAA0B;QACpC,IAAI,IAAI,EAAE,aAAa,EAAE,UAAU,EAAE,aAAa,EAAE,CAAC;YACpD,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QACvD,CAAC;QAED,OAAO,IAAI,CAAC,aAAa,CAAC;IAC3B,CAAC;IAED,OAAO;QACN,IAAI,CAAC,oBAAoB,EAAE,CAAC;IAC7B,CAAC;IAED,IAAI,gBAAgB;QACnB,OAAO,mBAAmB,CAAC;IAC5B,CAAC;IAED,MAAM,CAAC,IAAI;QACV,MAAM,UAAU,GAAG,iBAAiB,CAAa,YAAY,EAAE,EAAE,CAAC,CAAC;QAEnE,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;YAC1B,UAAU,CAAC,QAAQ,GAAG,IAAI,YAAY,EAAE,CAAC;QAC1C,CAAC;aAAM,IAAI,YAAY,CAAC,UAAU,CAAC,QAAQ,EAAE,gBAAgB,CAAC,EAAE,CAAC;YAChE,UAAU,CAAC,QAAQ,EAAE,OAAO,EAAE,CAAC;YAC/B,UAAU,CAAC,QAAQ,GAAG,IAAI,YAAY,EAAE,CAAC;QAC1C,CAAC;IACF,CAAC;CACD;AAED,eAAe,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;AAE9C,eAAe,YAAY,CAAC","sourcesContent":["import { registerFeature } from \"../FeaturesRegistry.js\";\nimport { isF6Next, isF6Previous } from \"../Keys.js\";\nimport { instanceOfUI5Element } from \"../UI5Element.js\";\nimport { getFirstFocusableElement } from \"../util/FocusableElements.js\";\nimport getFastNavigationGroups from \"../util/getFastNavigationGroups.js\";\nimport isElementClickable from \"../util/isElementClickable.js\";\nimport { getCurrentRuntimeIndex, compareRuntimes } from \"../Runtimes.js\";\nimport getSharedResource from \"../getSharedResource.js\";\n\ntype F6Registry = {\n\tinstance?: F6Navigation,\n}\n\nconst currentRuntimeINdex = getCurrentRuntimeIndex();\n\nconst shouldUpdate = (runtimeIndex: number | undefined) => {\n\tif (runtimeIndex === undefined) {\n\t\treturn true;\n\t}\n\treturn compareRuntimes(currentRuntimeINdex, runtimeIndex) === 1; // 1 means the current is newer, 0 means the same, -1 means the resource's runtime is newer\n};\n\nclass F6Navigation {\n\tkeydownHandler: (event: KeyboardEvent) => void;\n\tselectedGroup: HTMLElement | null = null;\n\tgroups: Array<HTMLElement> = [];\n\n\tconstructor() {\n\t\tthis.keydownHandler = this._keydownHandler.bind(this) as (event: KeyboardEvent) => void;\n\t\tthis.attachEventListeners();\n\t}\n\n\tattachEventListeners() {\n\t\tdocument.addEventListener(\"keydown\", this.keydownHandler);\n\t}\n\n\tremoveEventListeners() {\n\t\tdocument.removeEventListener(\"keydown\", this.keydownHandler);\n\t}\n\n\tasync groupElementToFocus(nextElement: HTMLElement) {\n\t\tlet nextElementDomRef = nextElement;\n\n\t\tif (instanceOfUI5Element(nextElement)) {\n\t\t\tnextElementDomRef = nextElement.getDomRef() || nextElement.firstElementChild as HTMLElement;\n\t\t}\n\n\t\tif (nextElementDomRef) {\n\t\t\tif (isElementClickable(nextElementDomRef)) {\n\t\t\t\treturn nextElementDomRef;\n\t\t\t}\n\n\t\t\tconst elementToFocus = await getFirstFocusableElement(nextElementDomRef);\n\n\t\t\tif (elementToFocus) {\n\t\t\t\treturn elementToFocus;\n\t\t\t}\n\t\t}\n\t}\n\n\tasync findNextFocusableGroupElement(currentIndex: number) {\n\t\tlet elementToFocus;\n\n\t\t/* eslint-disable no-await-in-loop */\n\t\tfor (let index = 0; index < this.groups.length; index++) {\n\t\t\tlet nextElement;\n\n\t\t\tif (currentIndex > -1) {\n\t\t\t\tif (currentIndex + 1 >= this.groups.length) {\n\t\t\t\t\tcurrentIndex = 0;\n\t\t\t\t\tnextElement = this.groups[currentIndex];\n\t\t\t\t} else {\n\t\t\t\t\tcurrentIndex += 1;\n\t\t\t\t\tnextElement = this.groups[currentIndex];\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tcurrentIndex = 0;\n\t\t\t\tnextElement = this.groups[currentIndex];\n\t\t\t}\n\n\t\t\telementToFocus = await this.groupElementToFocus(nextElement);\n\n\t\t\tif (elementToFocus) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t/* eslint-enable no-await-in-loop */\n\n\t\treturn elementToFocus;\n\t}\n\n\tasync findPreviousFocusableGroupElement(currentIndex: number) {\n\t\tlet elementToFocus;\n\n\t\t/* eslint-disable no-await-in-loop */\n\t\tfor (let index = 0; index < this.groups.length; index++) {\n\t\t\tlet nextElement;\n\n\t\t\tif (currentIndex > 0) {\n\t\t\t\t// Handle the situation where the first focusable element of two neighbor groups is the same\n\t\t\t\t// For example:\n\t\t\t\t// <ui5-flexible-column-layout>\n\t\t\t\t// <ui5-list>\n\t\t\t\t// <ui5-li>List Item</ui5-li>\n\t\t\t\t// </ui5-list>\n\t\t\t\t// </ui5-flexible-column-layout>\n\t\t\t\t// Here for both FCL & List the firstFoccusableElement is the same (the ui5-li)\n\t\t\t\tconst firstFocusable = await this.groupElementToFocus(this.groups[currentIndex - 1]);\n\t\t\t\tconst shouldSkipParent = firstFocusable === await this.groupElementToFocus(this.groups[currentIndex]);\n\n\t\t\t\tcurrentIndex = shouldSkipParent ? currentIndex - 2 : currentIndex - 1;\n\n\t\t\t\tif (currentIndex < 0) {\n\t\t\t\t\tcurrentIndex = this.groups.length - 1;\n\t\t\t\t}\n\n\t\t\t\tnextElement = this.groups[currentIndex];\n\t\t\t} else {\n\t\t\t\tcurrentIndex = this.groups.length - 1;\n\t\t\t\tnextElement = this.groups[currentIndex];\n\t\t\t}\n\n\t\t\telementToFocus = await this.groupElementToFocus(nextElement);\n\n\t\t\tif (elementToFocus) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t/* eslint-enable no-await-in-loop */\n\n\t\treturn elementToFocus;\n\t}\n\n\tasync _keydownHandler(event: KeyboardEvent) {\n\t\tconst forward = isF6Next(event);\n\t\tconst backward = isF6Previous(event);\n\t\tif (!(forward || backward)) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.updateGroups();\n\n\t\tif (this.groups.length < 1) {\n\t\t\treturn;\n\t\t}\n\n\t\tevent.preventDefault();\n\n\t\tlet elementToFocus;\n\n\t\tif (this.groups.length === 0) {\n\t\t\telementToFocus = await this.groupElementToFocus(this.groups[0]);\n\n\t\t\treturn elementToFocus?.focus();\n\t\t}\n\n\t\tlet currentIndex = -1;\n\n\t\tif (this.selectedGroup) {\n\t\t\tcurrentIndex = this.groups.indexOf(this.selectedGroup);\n\t\t}\n\n\t\tif (forward) {\n\t\t\telementToFocus = await this.findNextFocusableGroupElement(currentIndex);\n\t\t}\n\n\t\tif (backward) {\n\t\t\telementToFocus = await this.findPreviousFocusableGroupElement(currentIndex);\n\t\t}\n\n\t\telementToFocus?.focus();\n\t}\n\n\tupdateGroups() {\n\t\tconst container = this.findContainer();\n\n\t\tthis.setSelectedGroup();\n\t\tthis.groups = getFastNavigationGroups(container);\n\t}\n\n\tfindContainer() {\n\t\tconst htmlElement = window.document.querySelector(\"html\");\n\t\tlet element = this.deepActive(window.document);\n\n\t\twhile (element && element !== htmlElement) {\n\t\t\tconst closestScopeEl = element.closest<HTMLElement>(\"[data-sap-ui-fastnavgroup-container='true']\");\n\n\t\t\tif (closestScopeEl) {\n\t\t\t\treturn closestScopeEl;\n\t\t\t}\n\n\t\t\telement = element.parentElement ? element.parentElement : (element.parentNode as ShadowRoot).host;\n\t\t}\n\n\t\treturn document.body;\n\t}\n\n\tsetSelectedGroup(root: DocumentOrShadowRoot = window.document) {\n\t\tconst htmlElement = window.document.querySelector(\"html\");\n\t\tlet element: Element | null | ParentNode = this.deepActive(root);\n\n\t\twhile (element && (element as Element).getAttribute(\"data-sap-ui-fastnavgroup\") !== \"true\" && element !== htmlElement) {\n\t\t\telement = element.parentElement ? element.parentNode : (element.parentNode as ShadowRoot).host;\n\t\t}\n\n\t\tthis.selectedGroup = element as HTMLElement;\n\t}\n\n\tdeepActive(root: DocumentOrShadowRoot): Element | null {\n\t\tif (root?.activeElement?.shadowRoot?.activeElement) {\n\t\t\treturn this.deepActive(root.activeElement.shadowRoot);\n\t\t}\n\n\t\treturn root.activeElement;\n\t}\n\n\tdestroy() {\n\t\tthis.removeEventListeners();\n\t}\n\n\tget _ui5RuntimeIndex() {\n\t\treturn currentRuntimeINdex;\n\t}\n\n\tstatic init() {\n\t\tconst f6Registry = getSharedResource<F6Registry>(\"F6Registry\", {});\n\n\t\tif (!f6Registry.instance) {\n\t\t\tf6Registry.instance = new F6Navigation();\n\t\t} else if (shouldUpdate(f6Registry.instance?._ui5RuntimeIndex)) {\n\t\t\tf6Registry.instance?.destroy();\n\t\t\tf6Registry.instance = new F6Navigation();\n\t\t}\n\t}\n}\n\nregisterFeature(\"F6Navigation\", F6Navigation);\n\nexport default F6Navigation;\n"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
const VersionInfo = {
|
|
2
|
-
version: "2.7.0-rc.
|
|
2
|
+
version: "2.7.0-rc.2",
|
|
3
3
|
major: 2,
|
|
4
4
|
minor: 7,
|
|
5
5
|
patch: 0,
|
|
6
|
-
suffix: "-rc.
|
|
6
|
+
suffix: "-rc.2",
|
|
7
7
|
isNext: false,
|
|
8
|
-
buildTime:
|
|
8
|
+
buildTime: 1738224493,
|
|
9
9
|
};
|
|
10
10
|
export default VersionInfo;
|
|
11
11
|
//# sourceMappingURL=VersionInfo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VersionInfo.js","sourceRoot":"","sources":["../../src/generated/VersionInfo.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,GAAG;IACnB,OAAO,EAAE,YAAY;IACrB,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,OAAO;IACf,MAAM,EAAE,KAAK;IACb,SAAS,EAAE,UAAU;CACrB,CAAC;AACF,eAAe,WAAW,CAAC","sourcesContent":["const VersionInfo = {\n\tversion: \"2.7.0-rc.
|
|
1
|
+
{"version":3,"file":"VersionInfo.js","sourceRoot":"","sources":["../../src/generated/VersionInfo.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,GAAG;IACnB,OAAO,EAAE,YAAY;IACrB,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,OAAO;IACf,MAAM,EAAE,KAAK;IACb,SAAS,EAAE,UAAU;CACrB,CAAC;AACF,eAAe,WAAW,CAAC","sourcesContent":["const VersionInfo = {\n\tversion: \"2.7.0-rc.2\",\n\tmajor: 2,\n\tminor: 7,\n\tpatch: 0,\n\tsuffix: \"-rc.2\",\n\tisNext: false,\n\tbuildTime: 1738224493,\n};\nexport default VersionInfo;"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";const e=new Map,s=(t,r)=>{e.set(t,r)},n=t=>e.get(t);export{s as registerFeature,n as getFeature};
|
|
2
2
|
//# sourceMappingURL=FeaturesRegistry.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/FeaturesRegistry.ts"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": "aAAA,
|
|
6
|
-
"names": ["
|
|
4
|
+
"sourcesContent": ["const features = new Map<string, any>();\n\nconst registerFeature = (name: string, feature: object) => {\n\tfeatures.set(name, feature);\n};\n\nconst getFeature = <T>(name: string): T => {\n\treturn features.get(name) as T;\n};\n\nexport {\n\tregisterFeature,\n\tgetFeature,\n};\n"],
|
|
5
|
+
"mappings": "aAAA,MAAMA,EAAW,IAAI,IAEfC,EAAkB,CAACC,EAAcC,IAAoB,CAC1DH,EAAS,IAAIE,EAAMC,CAAO,CAC3B,EAEMC,EAAiBF,GACfF,EAAS,IAAIE,CAAI,EAGzB,OACCD,KAAA,gBACAG,KAAA",
|
|
6
|
+
"names": ["features", "registerFeature", "name", "feature", "getFeature"]
|
|
7
7
|
}
|
package/dist/prod/UI5Element.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";import"@ui5/webcomponents-base/dist/ssr-dom.js";import F from"./thirdparty/merge.js";import{boot as N}from"./Boot.js";import k from"./UI5ElementMetadata.js";import S from"./EventProvider.js";import x from"./updateShadowRoot.js";import{shouldIgnoreCustomElement as V}from"./IgnoreCustomElements.js";import{renderDeferred as j,renderImmediately as H,cancelRender as $}from"./Render.js";import{registerTag as z,isTagRegistered as B,recordTagRegistrationFailure as q}from"./CustomElementsRegistry.js";import{observeDOMNode as K,unobserveDOMNode as W}from"./DOMObserver.js";import{skipOriginalEvent as X}from"./config/NoConflict.js";import Y from"./locale/getEffectiveDir.js";import{kebabToCamelCase as y,camelToKebabCase as J,kebabToPascalCase as P}from"./util/StringHelper.js";import w from"./util/isValidPropertyName.js";import{getSlotName as G,getSlottedNodesList as D}from"./util/SlotsHelper.js";import Q from"./util/arraysAreEqual.js";import{markAsRtlAware as Z}from"./locale/RTLAwareRegistry.js";import tt from"./renderer/executeTemplate.js";import{shouldScopeCustomElement as A}from"./CustomElementsScopeUtils.js";import{updateFormValue as et,setFormValue as R}from"./features/InputElementsFormSupport.js";import{getComponentFeature as nt,subscribeForFeatureLoad as st}from"./FeaturesRegistry.js";import{getI18nBundle as ot}from"./i18nBundle.js";import{fetchCldr as it}from"./asset-registries/LocaleData.js";import M from"./locale/getLocale.js";let at=0;const T=new Map,I=new Map,O={fromAttribute(d,f){return f===Boolean?d!==null:f===Number?d===null?void 0:parseFloat(d):d},toAttribute(d,f){return f===Boolean?d?"":null:f===Object||f===Array||d==null?null:String(d)}};function v(d){this._suppressInvalidation||(this.onInvalidation(d),this._changedState.push(d),j(this),this._invalidationEventProvider.fireEvent("invalidate",{...d,target:this}))}function rt(d,f){do{const t=Object.getOwnPropertyDescriptor(d,f);if(t)return t;d=Object.getPrototypeOf(d)}while(d&&d!==HTMLElement.prototype)}class b extends HTMLElement{constructor(){super();this._rendered=!1;const t=this.constructor;this._changedState=[],this._suppressInvalidation=!0,this._inDOM=!1,this._fullyConnected=!1,this._childChangeListeners=new Map,this._slotChangeListeners=new Map,this._invalidationEventProvider=new S,this._componentStateFinalizedEventProvider=new S;let e;this._domRefReadyPromise=new Promise(n=>{e=n}),this._domRefReadyPromise._deferredResolve=e,this._doNotSyncAttributes=new Set,this._slotsAssignedNodes=new WeakMap,this._state={...t.getMetadata().getInitialState()},this.initializedProperties=new Map,this.constructor.getMetadata().getPropertiesList().forEach(n=>{if(this.hasOwnProperty(n)){const o=this[n];this.initializedProperties.set(n,o)}}),this._internals=this.attachInternals(),this._initShadowRoot()}_initShadowRoot(){const t=this.constructor;if(t._needsShadowDOM()){const e={mode:"open"};this.attachShadow({...e,...t.getMetadata().getShadowRootOptions()}),t.getMetadata().slotsAreManaged()&&this.shadowRoot.addEventListener("slotchange",this._onShadowRootSlotChange.bind(this))}}_onShadowRootSlotChange(t){t.target?.getRootNode()===this.shadowRoot&&this._processChildren()}get _id(){return this.__id||(this.__id=`ui5wc_${++at}`),this.__id}render(){const t=this.constructor.template;return tt(t,this)}async connectedCallback(){const t=this.constructor;this.setAttribute(t.getMetadata().getPureTag(),""),t.getMetadata().supportsF6FastNavigation()&&this.setAttribute("data-sap-ui-fastnavgroup","true");const e=t.getMetadata().slotsAreManaged();this._inDOM=!0,e&&(this._startObservingDOMChildren(),await this._processChildren()),this._inDOM&&(t.asyncFinished||await t.definePromise,H(this),this._domRefReadyPromise._deferredResolve(),this._fullyConnected=!0,this.onEnterDOM())}disconnectedCallback(){const e=this.constructor.getMetadata().slotsAreManaged();this._inDOM=!1,e&&this._stopObservingDOMChildren(),this._fullyConnected&&(this.onExitDOM(),this._fullyConnected=!1),this._domRefReadyPromise._deferredResolve(),$(this)}onBeforeRendering(){}onAfterRendering(){}onEnterDOM(){}onExitDOM(){}_startObservingDOMChildren(){const e=this.constructor.getMetadata();if(!e.hasSlots())return;const n=e.canSlotText(),o={childList:!0,subtree:n,characterData:n};K(this,this._processChildren.bind(this),o)}_stopObservingDOMChildren(){W(this)}async _processChildren(){this.constructor.getMetadata().hasSlots()&&await this._updateSlots()}async _updateSlots(){const t=this.constructor,e=t.getMetadata().getSlots(),s=t.getMetadata().canSlotText(),n=Array.from(s?this.childNodes:this.children),o=new Map,i=new Map;for(const[l,u]of Object.entries(e)){const c=u.propertyName||l;i.set(c,l),o.set(c,[...this._state[c]]),this._clearSlot(l,u)}const r=new Map,a=new Map,h=n.map(async(l,u)=>{const c=G(l),m=e[c];if(m===void 0){if(c!=="default"){const p=Object.keys(e).join(", ");console.warn(`Unknown slotName: ${c}, ignoring`,l,`Valid values are: ${p}`)}return}if(m.individualSlots){const p=(r.get(c)||0)+1;r.set(c,p),l._individualSlot=`${c}-${p}`}if(l instanceof HTMLElement){const p=l.localName;if(p.includes("-")&&!V(p)){if(!customElements.get(p)){const L=customElements.whenDefined(p);let E=T.get(p);E||(E=new Promise(U=>setTimeout(U,1e3)),T.set(p,E)),await Promise.race([L,E])}customElements.upgrade(l)}}if(l=t.getMetadata().constructor.validateSlotValue(l,m),_(l)&&m.invalidateOnChildChange){const p=this._getChildChangeListener(c);l.attachInvalidate.call(l,p)}l instanceof HTMLSlotElement&&this._attachSlotChange(l,c,!!m.invalidateOnChildChange);const C=m.propertyName||c;a.has(C)?a.get(C).push({child:l,idx:u}):a.set(C,[{child:l,idx:u}])});await Promise.all(h),a.forEach((l,u)=>{this._state[u]=l.sort((c,m)=>c.idx-m.idx).map(c=>c.child),this._state[y(u)]=this._state[u]});let g=!1;for(const[l,u]of Object.entries(e)){const c=u.propertyName||l;Q(o.get(c),this._state[c])||(v.call(this,{type:"slot",name:i.get(c),reason:"children"}),g=!0,t.getMetadata().isFormAssociated()&&R(this))}g||v.call(this,{type:"slot",name:"default",reason:"textcontent"})}_clearSlot(t,e){const s=e.propertyName||t;this._state[s].forEach(o=>{if(_(o)){const i=this._getChildChangeListener(t);o.detachInvalidate.call(o,i)}o instanceof HTMLSlotElement&&this._detachSlotChange(o,t)}),this._state[s]=[],this._state[y(s)]=this._state[s]}attachInvalidate(t){this._invalidationEventProvider.attachEvent("invalidate",t)}detachInvalidate(t){this._invalidationEventProvider.detachEvent("invalidate",t)}_onChildChange(t,e){this.constructor.getMetadata().shouldInvalidateOnChildChange(t,e.type,e.name)&&v.call(this,{type:"slot",name:t,reason:"childchange",child:e.target})}attributeChangedCallback(t,e,s){let n;if(this._doNotSyncAttributes.has(t))return;const o=this.constructor.getMetadata().getProperties(),i=t.replace(/^ui5-/,""),r=y(i);if(o.hasOwnProperty(r)){const a=o[r];n=(a.converter??O).fromAttribute(s,a.type),this[r]=n}}formAssociatedCallback(){this.constructor.getMetadata().isFormAssociated()&&et(this)}static get formAssociated(){return this.getMetadata().isFormAssociated()}_updateAttribute(t,e){const s=this.constructor;if(!s.getMetadata().hasAttribute(t))return;const o=s.getMetadata().getProperties()[t],i=J(t),a=(o.converter||O).toAttribute(e,o.type);this._doNotSyncAttributes.add(i),a==null?this.removeAttribute(i):this.setAttribute(i,a),this._doNotSyncAttributes.delete(i)}_getChildChangeListener(t){return this._childChangeListeners.has(t)||this._childChangeListeners.set(t,this._onChildChange.bind(this,t)),this._childChangeListeners.get(t)}_getSlotChangeListener(t){return this._slotChangeListeners.has(t)||this._slotChangeListeners.set(t,this._onSlotChange.bind(this,t)),this._slotChangeListeners.get(t)}_attachSlotChange(t,e,s){const n=this._getSlotChangeListener(e);t.addEventListener("slotchange",o=>{if(n.call(t,o),s){const i=this._slotsAssignedNodes.get(t);i&&i.forEach(a=>{if(_(a)){const h=this._getChildChangeListener(e);a.detachInvalidate.call(a,h)}});const r=D([t]);this._slotsAssignedNodes.set(t,r),r.forEach(a=>{if(_(a)){const h=this._getChildChangeListener(e);a.attachInvalidate.call(a,h)}})}})}_detachSlotChange(t,e){t.removeEventListener("slotchange",this._getSlotChangeListener(e))}_onSlotChange(t){v.call(this,{type:"slot",name:t,reason:"slotchange"})}onInvalidation(t){}updateAttributes(){const e=this.constructor.getMetadata().getProperties();for(const[s,n]of Object.entries(e))this._updateAttribute(s,this[s])}_render(){const t=this.constructor,e=t.getMetadata().hasIndividualSlots();this.initializedProperties.size>0&&(Array.from(this.initializedProperties.entries()).forEach(([s,n])=>{delete this[s],this[s]=n}),this.initializedProperties.clear()),this._suppressInvalidation=!0;try{this.onBeforeRendering(),this._rendered||this.updateAttributes(),this._componentStateFinalizedEventProvider.fireEvent("componentStateFinalized")}finally{this._suppressInvalidation=!1}this._changedState=[],t._needsShadowDOM()&&x(this),this._rendered=!0,e&&this._assignIndividualSlotsToChildren(),this.onAfterRendering()}_assignIndividualSlotsToChildren(){Array.from(this.children).forEach(e=>{e._individualSlot&&e.setAttribute("slot",e._individualSlot)})}_waitForDomRef(){return this._domRefReadyPromise}getDomRef(){if(typeof this._getRealDomRef=="function")return this._getRealDomRef();if(!(!this.shadowRoot||this.shadowRoot.children.length===0))return this.shadowRoot.children[0]}getFocusDomRef(){const t=this.getDomRef();if(t)return t.querySelector("[data-sap-focus-ref]")||t}async getFocusDomRefAsync(){return await this._waitForDomRef(),this.getFocusDomRef()}async focus(t){await this._waitForDomRef();const e=this.getFocusDomRef();e===this?HTMLElement.prototype.focus.call(this,t):e&&typeof e.focus=="function"&&e.focus(t)}fireEvent(t,e,s=!1,n=!0){const o=this._fireEvent(t,e,s,n),i=P(t);return i!==t?o&&this._fireEvent(i,e,s,n):o}fireDecoratorEvent(t,e){const s=this.getEventData(t),n=s?s.cancelable:!1,o=s?s.bubbles:!1,i=this._fireEvent(t,e,n,o),r=P(t);return r!==t?i&&this._fireEvent(r,e,n,o):i}_fireEvent(t,e,s=!1,n=!0){const o=new CustomEvent(`ui5-${t}`,{detail:e,composed:!1,bubbles:n,cancelable:s}),i=this.dispatchEvent(o);if(X(t))return i;const r=new CustomEvent(t,{detail:e,composed:!1,bubbles:n,cancelable:s});return this.dispatchEvent(r)&&i}getEventData(t){return this.constructor.getMetadata().getEvents()[t]}getSlottedNodes(t){return D(this[t])}attachComponentStateFinalized(t){this._componentStateFinalizedEventProvider.attachEvent("componentStateFinalized",t)}detachComponentStateFinalized(t){this._componentStateFinalizedEventProvider.detachEvent("componentStateFinalized",t)}get effectiveDir(){return Z(this.constructor),Y(this)}get isUI5Element(){return!0}get isUI5AbstractElement(){return!this.constructor._needsShadowDOM()}get classes(){return{}}get accessibilityInfo(){return{}}static get observedAttributes(){return this.getMetadata().getAttributesList()}static get tagsToScope(){const t=this.getMetadata().getPureTag(),e=this.getUniqueDependencies().map(s=>s.getMetadata().getPureTag()).filter(A);return A(t)&&e.push(t),e}static _needsShadowDOM(){return!!this.template||Object.prototype.hasOwnProperty.call(this.prototype,"render")}static _generateAccessors(){const t=this.prototype,e=this.getMetadata().slotsAreManaged(),s=this.getMetadata().getProperties();for(const[n,o]of Object.entries(s)){w(n)||console.warn(`"${n}" is not a valid property name. Use a name that does not collide with DOM APIs`);const i=rt(t,n);let r;i?.set&&(r=i.set);let a;i?.get&&(a=i.get),Object.defineProperty(t,n,{get(){return a?a.call(this):this._state[n]},set(h){const g=this.constructor,l=a?a.call(this):this._state[n];l!==h&&(r?r.call(this,h):this._state[n]=h,v.call(this,{type:"property",name:n,newValue:h,oldValue:l}),this._rendered&&this._updateAttribute(n,h),g.getMetadata().isFormAssociated()&&R(this))}})}if(e){const n=this.getMetadata().getSlots();for(const[o,i]of Object.entries(n)){w(o)||console.warn(`"${o}" is not a valid property name. Use a name that does not collide with DOM APIs`);const r=i.propertyName||o,a={get(){return this._state[r]!==void 0?this._state[r]:[]},set(){throw new Error("Cannot set slot content directly, use the DOM APIs (appendChild, removeChild, etc...)")}};Object.defineProperty(t,r,a),r!==y(r)&&Object.defineProperty(t,y(r),a)}}}static{this.metadata={}}static{this.styles=""}static get dependencies(){return[]}static cacheUniqueDependencies(){const t=this.dependencies.filter((e,s,n)=>n.indexOf(e)===s);I.set(this,t)}static getUniqueDependencies(){return I.has(this)||this.cacheUniqueDependencies(),I.get(this)||[]}static async onDefine(){return Promise.resolve()}static fetchI18nBundles(){return Promise.all(Object.entries(this.getMetadata().getI18n()).map(t=>{const{bundleName:e}=t[1];return ot(e)}))}static fetchCLDR(){return this.getMetadata().needsCLDR()?it(M().getLanguage(),M().getRegion(),M().getScript()):Promise.resolve()}static{this.i18nBundleStorage={}}static get i18nBundles(){return this.i18nBundleStorage}static define(){const t=async()=>{await N();const i=await Promise.all([this.fetchI18nBundles(),this.fetchCLDR(),this.onDefine()]),[r]=i;Object.entries(this.getMetadata().getI18n()).forEach((a,h)=>{const g=a[0];this.i18nBundleStorage[g]=r[h]}),this.asyncFinished=!0};this.definePromise=t();const e=this.getMetadata().getTag();this.getMetadata().getFeatures().forEach(i=>{nt(i)&&this.cacheUniqueDependencies(),st(i,this,this.cacheUniqueDependencies.bind(this))});const n=B(e),o=customElements.get(e);return o&&!n?q(e):o||(this._generateAccessors(),z(e),customElements.define(e,this)),this}static getMetadata(){if(this.hasOwnProperty("_metadata"))return this._metadata;const t=[this.metadata];let e=this;for(;e!==b;)e=Object.getPrototypeOf(e),t.unshift(e.metadata);const s=F({},...t);return this._metadata=new k(s),this._metadata}get validity(){return this._internals.validity}get validationMessage(){return this._internals.validationMessage}checkValidity(){return this._internals.checkValidity()}reportValidity(){return this._internals.reportValidity()}}const _=d=>"isUI5Element"in d;export default b;export{_ as instanceOfUI5Element};
|
|
1
|
+
"use strict";import"@ui5/webcomponents-base/dist/ssr-dom.js";import F from"./thirdparty/merge.js";import{boot as N}from"./Boot.js";import k from"./UI5ElementMetadata.js";import b from"./EventProvider.js";import x from"./updateShadowRoot.js";import{shouldIgnoreCustomElement as V}from"./IgnoreCustomElements.js";import{renderDeferred as j,renderImmediately as H,cancelRender as $}from"./Render.js";import{registerTag as z,isTagRegistered as B,recordTagRegistrationFailure as K}from"./CustomElementsRegistry.js";import{observeDOMNode as q,unobserveDOMNode as W}from"./DOMObserver.js";import{skipOriginalEvent as X}from"./config/NoConflict.js";import Y from"./locale/getEffectiveDir.js";import{kebabToCamelCase as g,camelToKebabCase as J,kebabToPascalCase as P}from"./util/StringHelper.js";import w from"./util/isValidPropertyName.js";import{getSlotName as G,getSlottedNodesList as D}from"./util/SlotsHelper.js";import Q from"./util/arraysAreEqual.js";import{markAsRtlAware as Z}from"./locale/RTLAwareRegistry.js";import tt from"./renderer/executeTemplate.js";import{shouldScopeCustomElement as A}from"./CustomElementsScopeUtils.js";import{updateFormValue as et,setFormValue as R}from"./features/InputElementsFormSupport.js";import{getI18nBundle as nt}from"./i18nBundle.js";import{fetchCldr as st}from"./asset-registries/LocaleData.js";import M from"./locale/getLocale.js";let ot=0;const T=new Map,I=new Map,O={fromAttribute(d,f){return f===Boolean?d!==null:f===Number?d===null?void 0:parseFloat(d):d},toAttribute(d,f){return f===Boolean?d?"":null:f===Object||f===Array||d==null?null:String(d)}};function y(d){this._suppressInvalidation||(this.onInvalidation(d),this._changedState.push(d),j(this),this._invalidationEventProvider.fireEvent("invalidate",{...d,target:this}))}function it(d,f){do{const t=Object.getOwnPropertyDescriptor(d,f);if(t)return t;d=Object.getPrototypeOf(d)}while(d&&d!==HTMLElement.prototype)}class S extends HTMLElement{constructor(){super();this._rendered=!1;const t=this.constructor;this._changedState=[],this._suppressInvalidation=!0,this._inDOM=!1,this._fullyConnected=!1,this._childChangeListeners=new Map,this._slotChangeListeners=new Map,this._invalidationEventProvider=new b,this._componentStateFinalizedEventProvider=new b;let e;this._domRefReadyPromise=new Promise(n=>{e=n}),this._domRefReadyPromise._deferredResolve=e,this._doNotSyncAttributes=new Set,this._slotsAssignedNodes=new WeakMap,this._state={...t.getMetadata().getInitialState()},this.initializedProperties=new Map,this.constructor.getMetadata().getPropertiesList().forEach(n=>{if(this.hasOwnProperty(n)){const o=this[n];this.initializedProperties.set(n,o)}}),this._internals=this.attachInternals(),this._initShadowRoot()}_initShadowRoot(){const t=this.constructor;if(t._needsShadowDOM()){const e={mode:"open"};this.attachShadow({...e,...t.getMetadata().getShadowRootOptions()}),t.getMetadata().slotsAreManaged()&&this.shadowRoot.addEventListener("slotchange",this._onShadowRootSlotChange.bind(this))}}_onShadowRootSlotChange(t){t.target?.getRootNode()===this.shadowRoot&&this._processChildren()}get _id(){return this.__id||(this.__id=`ui5wc_${++ot}`),this.__id}render(){const t=this.constructor.template;return tt(t,this)}async connectedCallback(){const t=this.constructor;this.setAttribute(t.getMetadata().getPureTag(),""),t.getMetadata().supportsF6FastNavigation()&&this.setAttribute("data-sap-ui-fastnavgroup","true");const e=t.getMetadata().slotsAreManaged();this._inDOM=!0,e&&(this._startObservingDOMChildren(),await this._processChildren()),this._inDOM&&(t.asyncFinished||await t.definePromise,H(this),this._domRefReadyPromise._deferredResolve(),this._fullyConnected=!0,this.onEnterDOM())}disconnectedCallback(){const e=this.constructor.getMetadata().slotsAreManaged();this._inDOM=!1,e&&this._stopObservingDOMChildren(),this._fullyConnected&&(this.onExitDOM(),this._fullyConnected=!1),this._domRefReadyPromise._deferredResolve(),$(this)}onBeforeRendering(){}onAfterRendering(){}onEnterDOM(){}onExitDOM(){}_startObservingDOMChildren(){const e=this.constructor.getMetadata();if(!e.hasSlots())return;const n=e.canSlotText(),o={childList:!0,subtree:n,characterData:n};q(this,this._processChildren.bind(this),o)}_stopObservingDOMChildren(){W(this)}async _processChildren(){this.constructor.getMetadata().hasSlots()&&await this._updateSlots()}async _updateSlots(){const t=this.constructor,e=t.getMetadata().getSlots(),s=t.getMetadata().canSlotText(),n=Array.from(s?this.childNodes:this.children),o=new Map,i=new Map;for(const[l,u]of Object.entries(e)){const c=u.propertyName||l;i.set(c,l),o.set(c,[...this._state[c]]),this._clearSlot(l,u)}const r=new Map,a=new Map,h=n.map(async(l,u)=>{const c=G(l),m=e[c];if(m===void 0){if(c!=="default"){const p=Object.keys(e).join(", ");console.warn(`Unknown slotName: ${c}, ignoring`,l,`Valid values are: ${p}`)}return}if(m.individualSlots){const p=(r.get(c)||0)+1;r.set(c,p),l._individualSlot=`${c}-${p}`}if(l instanceof HTMLElement){const p=l.localName;if(p.includes("-")&&!V(p)){if(!customElements.get(p)){const L=customElements.whenDefined(p);let E=T.get(p);E||(E=new Promise(U=>setTimeout(U,1e3)),T.set(p,E)),await Promise.race([L,E])}customElements.upgrade(l)}}if(l=t.getMetadata().constructor.validateSlotValue(l,m),v(l)&&m.invalidateOnChildChange){const p=this._getChildChangeListener(c);l.attachInvalidate.call(l,p)}l instanceof HTMLSlotElement&&this._attachSlotChange(l,c,!!m.invalidateOnChildChange);const C=m.propertyName||c;a.has(C)?a.get(C).push({child:l,idx:u}):a.set(C,[{child:l,idx:u}])});await Promise.all(h),a.forEach((l,u)=>{this._state[u]=l.sort((c,m)=>c.idx-m.idx).map(c=>c.child),this._state[g(u)]=this._state[u]});let _=!1;for(const[l,u]of Object.entries(e)){const c=u.propertyName||l;Q(o.get(c),this._state[c])||(y.call(this,{type:"slot",name:i.get(c),reason:"children"}),_=!0,t.getMetadata().isFormAssociated()&&R(this))}_||y.call(this,{type:"slot",name:"default",reason:"textcontent"})}_clearSlot(t,e){const s=e.propertyName||t;this._state[s].forEach(o=>{if(v(o)){const i=this._getChildChangeListener(t);o.detachInvalidate.call(o,i)}o instanceof HTMLSlotElement&&this._detachSlotChange(o,t)}),this._state[s]=[],this._state[g(s)]=this._state[s]}attachInvalidate(t){this._invalidationEventProvider.attachEvent("invalidate",t)}detachInvalidate(t){this._invalidationEventProvider.detachEvent("invalidate",t)}_onChildChange(t,e){this.constructor.getMetadata().shouldInvalidateOnChildChange(t,e.type,e.name)&&y.call(this,{type:"slot",name:t,reason:"childchange",child:e.target})}attributeChangedCallback(t,e,s){let n;if(this._doNotSyncAttributes.has(t))return;const o=this.constructor.getMetadata().getProperties(),i=t.replace(/^ui5-/,""),r=g(i);if(o.hasOwnProperty(r)){const a=o[r];n=(a.converter??O).fromAttribute(s,a.type),this[r]=n}}formAssociatedCallback(){this.constructor.getMetadata().isFormAssociated()&&et(this)}static get formAssociated(){return this.getMetadata().isFormAssociated()}_updateAttribute(t,e){const s=this.constructor;if(!s.getMetadata().hasAttribute(t))return;const o=s.getMetadata().getProperties()[t],i=J(t),a=(o.converter||O).toAttribute(e,o.type);this._doNotSyncAttributes.add(i),a==null?this.removeAttribute(i):this.setAttribute(i,a),this._doNotSyncAttributes.delete(i)}_getChildChangeListener(t){return this._childChangeListeners.has(t)||this._childChangeListeners.set(t,this._onChildChange.bind(this,t)),this._childChangeListeners.get(t)}_getSlotChangeListener(t){return this._slotChangeListeners.has(t)||this._slotChangeListeners.set(t,this._onSlotChange.bind(this,t)),this._slotChangeListeners.get(t)}_attachSlotChange(t,e,s){const n=this._getSlotChangeListener(e);t.addEventListener("slotchange",o=>{if(n.call(t,o),s){const i=this._slotsAssignedNodes.get(t);i&&i.forEach(a=>{if(v(a)){const h=this._getChildChangeListener(e);a.detachInvalidate.call(a,h)}});const r=D([t]);this._slotsAssignedNodes.set(t,r),r.forEach(a=>{if(v(a)){const h=this._getChildChangeListener(e);a.attachInvalidate.call(a,h)}})}})}_detachSlotChange(t,e){t.removeEventListener("slotchange",this._getSlotChangeListener(e))}_onSlotChange(t){y.call(this,{type:"slot",name:t,reason:"slotchange"})}onInvalidation(t){}updateAttributes(){const e=this.constructor.getMetadata().getProperties();for(const[s,n]of Object.entries(e))this._updateAttribute(s,this[s])}_render(){const t=this.constructor,e=t.getMetadata().hasIndividualSlots();this.initializedProperties.size>0&&(Array.from(this.initializedProperties.entries()).forEach(([s,n])=>{delete this[s],this[s]=n}),this.initializedProperties.clear()),this._suppressInvalidation=!0;try{this.onBeforeRendering(),this._rendered||this.updateAttributes(),this._componentStateFinalizedEventProvider.fireEvent("componentStateFinalized")}finally{this._suppressInvalidation=!1}this._changedState=[],t._needsShadowDOM()&&x(this),this._rendered=!0,e&&this._assignIndividualSlotsToChildren(),this.onAfterRendering()}_assignIndividualSlotsToChildren(){Array.from(this.children).forEach(e=>{e._individualSlot&&e.setAttribute("slot",e._individualSlot)})}_waitForDomRef(){return this._domRefReadyPromise}getDomRef(){if(typeof this._getRealDomRef=="function")return this._getRealDomRef();if(!(!this.shadowRoot||this.shadowRoot.children.length===0))return this.shadowRoot.children[0]}getFocusDomRef(){const t=this.getDomRef();if(t)return t.querySelector("[data-sap-focus-ref]")||t}async getFocusDomRefAsync(){return await this._waitForDomRef(),this.getFocusDomRef()}async focus(t){await this._waitForDomRef();const e=this.getFocusDomRef();e===this?HTMLElement.prototype.focus.call(this,t):e&&typeof e.focus=="function"&&e.focus(t)}fireEvent(t,e,s=!1,n=!0){const o=this._fireEvent(t,e,s,n),i=P(t);return i!==t?o&&this._fireEvent(i,e,s,n):o}fireDecoratorEvent(t,e){const s=this.getEventData(t),n=s?s.cancelable:!1,o=s?s.bubbles:!1,i=this._fireEvent(t,e,n,o),r=P(t);return r!==t?i&&this._fireEvent(r,e,n,o):i}_fireEvent(t,e,s=!1,n=!0){const o=new CustomEvent(`ui5-${t}`,{detail:e,composed:!1,bubbles:n,cancelable:s}),i=this.dispatchEvent(o);if(X(t))return i;const r=new CustomEvent(t,{detail:e,composed:!1,bubbles:n,cancelable:s});return this.dispatchEvent(r)&&i}getEventData(t){return this.constructor.getMetadata().getEvents()[t]}getSlottedNodes(t){return D(this[t])}attachComponentStateFinalized(t){this._componentStateFinalizedEventProvider.attachEvent("componentStateFinalized",t)}detachComponentStateFinalized(t){this._componentStateFinalizedEventProvider.detachEvent("componentStateFinalized",t)}get effectiveDir(){return Z(this.constructor),Y(this)}get isUI5Element(){return!0}get isUI5AbstractElement(){return!this.constructor._needsShadowDOM()}get classes(){return{}}get accessibilityInfo(){return{}}static get observedAttributes(){return this.getMetadata().getAttributesList()}static get tagsToScope(){const t=this.getMetadata().getPureTag(),e=this.getUniqueDependencies().map(s=>s.getMetadata().getPureTag()).filter(A);return A(t)&&e.push(t),e}static _needsShadowDOM(){return!!this.template||Object.prototype.hasOwnProperty.call(this.prototype,"render")}static _generateAccessors(){const t=this.prototype,e=this.getMetadata().slotsAreManaged(),s=this.getMetadata().getProperties();for(const[n,o]of Object.entries(s)){w(n)||console.warn(`"${n}" is not a valid property name. Use a name that does not collide with DOM APIs`);const i=it(t,n);let r;i?.set&&(r=i.set);let a;i?.get&&(a=i.get),Object.defineProperty(t,n,{get(){return a?a.call(this):this._state[n]},set(h){const _=this.constructor,l=a?a.call(this):this._state[n];l!==h&&(r?r.call(this,h):this._state[n]=h,y.call(this,{type:"property",name:n,newValue:h,oldValue:l}),this._rendered&&this._updateAttribute(n,h),_.getMetadata().isFormAssociated()&&R(this))}})}if(e){const n=this.getMetadata().getSlots();for(const[o,i]of Object.entries(n)){w(o)||console.warn(`"${o}" is not a valid property name. Use a name that does not collide with DOM APIs`);const r=i.propertyName||o,a={get(){return this._state[r]!==void 0?this._state[r]:[]},set(){throw new Error("Cannot set slot content directly, use the DOM APIs (appendChild, removeChild, etc...)")}};Object.defineProperty(t,r,a),r!==g(r)&&Object.defineProperty(t,g(r),a)}}}static{this.metadata={}}static{this.styles=""}static get dependencies(){return[]}static cacheUniqueDependencies(){const t=this.dependencies.filter((e,s,n)=>n.indexOf(e)===s);I.set(this,t)}static getUniqueDependencies(){return I.has(this)||this.cacheUniqueDependencies(),I.get(this)||[]}static async onDefine(){return Promise.resolve()}static fetchI18nBundles(){return Promise.all(Object.entries(this.getMetadata().getI18n()).map(t=>{const{bundleName:e}=t[1];return nt(e)}))}static fetchCLDR(){return this.getMetadata().needsCLDR()?st(M().getLanguage(),M().getRegion(),M().getScript()):Promise.resolve()}static{this.i18nBundleStorage={}}static get i18nBundles(){return this.i18nBundleStorage}static define(){const t=async()=>{await N();const o=await Promise.all([this.fetchI18nBundles(),this.fetchCLDR(),this.onDefine()]),[i]=o;Object.entries(this.getMetadata().getI18n()).forEach((r,a)=>{const h=r[0];this.i18nBundleStorage[h]=i[a]}),this.asyncFinished=!0};this.definePromise=t();const e=this.getMetadata().getTag(),s=B(e),n=customElements.get(e);return n&&!s?K(e):n||(this._generateAccessors(),z(e),customElements.define(e,this)),this}static getMetadata(){if(this.hasOwnProperty("_metadata"))return this._metadata;const t=[this.metadata];let e=this;for(;e!==S;)e=Object.getPrototypeOf(e),t.unshift(e.metadata);const s=F({},...t);return this._metadata=new k(s),this._metadata}get validity(){return this._internals.validity}get validationMessage(){return this._internals.validationMessage}checkValidity(){return this._internals.checkValidity()}reportValidity(){return this._internals.reportValidity()}}const v=d=>"isUI5Element"in d;export default S;export{v as instanceOfUI5Element};
|
|
2
2
|
//# sourceMappingURL=UI5Element.js.map
|