@ui5/webcomponents-base 2.19.0-rc.2 → 2.19.0-rc.3
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/AGENTS.md +193 -0
- package/CHANGELOG.md +12 -0
- package/CLAUDE.md +1 -0
- package/dist/.tsbuildinfobuild +1 -1
- package/dist/UI5Element.d.ts +2 -1
- package/dist/UI5Element.js +34 -19
- package/dist/UI5Element.js.map +1 -1
- package/dist/asset-registries/Themes.d.ts +5 -2
- package/dist/asset-registries/Themes.js +3 -3
- package/dist/asset-registries/Themes.js.map +1 -1
- package/dist/css/SystemCSSVars.css +28 -3
- package/dist/custom-elements-internal.json +21 -0
- package/dist/custom-elements.json +21 -0
- package/dist/features/InputElementsFormSupport.d.ts +1 -1
- package/dist/features/InputElementsFormSupport.js +6 -2
- package/dist/features/InputElementsFormSupport.js.map +1 -1
- package/dist/generated/VersionInfo.js +3 -3
- package/dist/generated/VersionInfo.js.map +1 -1
- package/dist/generated/css/SystemCSSVars.css.d.ts +1 -1
- package/dist/generated/css/SystemCSSVars.css.js +1 -1
- package/dist/generated/css/SystemCSSVars.css.js.map +1 -1
- package/dist/prod/UI5Element.js +1 -1
- package/dist/prod/UI5Element.js.map +3 -3
- package/dist/prod/asset-registries/Themes.js +1 -1
- package/dist/prod/asset-registries/Themes.js.map +3 -3
- package/dist/prod/features/InputElementsFormSupport.js +1 -1
- package/dist/prod/features/InputElementsFormSupport.js.map +3 -3
- package/dist/prod/generated/VersionInfo.js +1 -1
- package/dist/prod/generated/VersionInfo.js.map +1 -1
- package/dist/prod/generated/css/SystemCSSVars.css.js +1 -1
- package/dist/prod/generated/css/SystemCSSVars.css.js.map +1 -1
- package/dist/prod/theming/applyTheme.js +1 -1
- package/dist/prod/theming/applyTheme.js.map +3 -3
- package/dist/prod/theming/componentStyles.js +3 -0
- package/dist/prod/theming/componentStyles.js.map +7 -0
- package/dist/prod/updateShadowRoot.js +1 -1
- package/dist/prod/updateShadowRoot.js.map +3 -3
- package/dist/prod/util/createInstanceChecker.js +2 -0
- package/dist/prod/util/createInstanceChecker.js.map +7 -0
- package/dist/theming/applyTheme.js +8 -2
- package/dist/theming/applyTheme.js.map +1 -1
- package/dist/theming/componentStyles.d.ts +3 -0
- package/dist/theming/componentStyles.js +15 -0
- package/dist/theming/componentStyles.js.map +1 -0
- package/dist/updateShadowRoot.js +2 -1
- package/dist/updateShadowRoot.js.map +1 -1
- package/dist/util/createInstanceChecker.d.ts +2 -0
- package/dist/util/createInstanceChecker.js +7 -0
- package/dist/util/createInstanceChecker.js.map +1 -0
- package/dist/util/getClassCopy.d.ts +2 -1
- package/package.json +3 -3
- package/src/css/SystemCSSVars.css +28 -3
|
@@ -1,9 +1,34 @@
|
|
|
1
1
|
:root {
|
|
2
|
-
|
|
2
|
+
/*
|
|
3
|
+
Use a non-existent variable to always trigger the fallback.
|
|
4
|
+
Because this variable is never defined, the fallback is used
|
|
5
|
+
in all cases.
|
|
6
|
+
|
|
7
|
+
Using `initial` as a fallback can work only for properties
|
|
8
|
+
that treat it as an invalid value. To avoid this inconsistency,
|
|
9
|
+
we intentionally reference an undefined variable, which is
|
|
10
|
+
always considered invalid and undefined.
|
|
11
|
+
*/
|
|
12
|
+
--_ui5-cozy-size: var(--_ui5-f2d95f8);
|
|
13
|
+
|
|
14
|
+
--_ui5-compact-size: ;
|
|
15
|
+
--_ui5_content_density: cozy;
|
|
3
16
|
}
|
|
4
17
|
|
|
5
18
|
[data-ui5-compact-size],
|
|
6
19
|
.ui5-content-density-compact,
|
|
7
20
|
.sapUiSizeCompact {
|
|
8
|
-
|
|
9
|
-
|
|
21
|
+
--_ui5-cozy-size: ;
|
|
22
|
+
/*
|
|
23
|
+
Use a non-existent variable to always trigger the fallback.
|
|
24
|
+
Because this variable is never defined, the fallback is used
|
|
25
|
+
in all cases.
|
|
26
|
+
|
|
27
|
+
Using `initial` as a fallback can work only for properties
|
|
28
|
+
that treat it as an invalid value. To avoid this inconsistency,
|
|
29
|
+
we intentionally reference an undefined variable, which is
|
|
30
|
+
always considered invalid and undefined.
|
|
31
|
+
*/
|
|
32
|
+
--_ui5-compact-size: var(--_ui5-f2d95f8);
|
|
33
|
+
--_ui5_content_density: compact;
|
|
34
|
+
}
|
|
@@ -1817,6 +1817,12 @@
|
|
|
1817
1817
|
}
|
|
1818
1818
|
]
|
|
1819
1819
|
},
|
|
1820
|
+
{
|
|
1821
|
+
"kind": "javascript-module",
|
|
1822
|
+
"path": "dist/theming/componentStyles.js",
|
|
1823
|
+
"declarations": [],
|
|
1824
|
+
"exports": []
|
|
1825
|
+
},
|
|
1820
1826
|
{
|
|
1821
1827
|
"kind": "javascript-module",
|
|
1822
1828
|
"path": "dist/theming/getConstructableStyle.js",
|
|
@@ -2454,6 +2460,21 @@
|
|
|
2454
2460
|
}
|
|
2455
2461
|
]
|
|
2456
2462
|
},
|
|
2463
|
+
{
|
|
2464
|
+
"kind": "javascript-module",
|
|
2465
|
+
"path": "dist/util/createInstanceChecker.js",
|
|
2466
|
+
"declarations": [],
|
|
2467
|
+
"exports": [
|
|
2468
|
+
{
|
|
2469
|
+
"kind": "js",
|
|
2470
|
+
"name": "default",
|
|
2471
|
+
"declaration": {
|
|
2472
|
+
"name": "createChecker",
|
|
2473
|
+
"module": "dist/util/createInstanceChecker.js"
|
|
2474
|
+
}
|
|
2475
|
+
}
|
|
2476
|
+
]
|
|
2477
|
+
},
|
|
2457
2478
|
{
|
|
2458
2479
|
"kind": "javascript-module",
|
|
2459
2480
|
"path": "dist/util/createLinkInHead.js",
|
|
@@ -1791,6 +1791,12 @@
|
|
|
1791
1791
|
}
|
|
1792
1792
|
]
|
|
1793
1793
|
},
|
|
1794
|
+
{
|
|
1795
|
+
"kind": "javascript-module",
|
|
1796
|
+
"path": "dist/theming/componentStyles.js",
|
|
1797
|
+
"declarations": [],
|
|
1798
|
+
"exports": []
|
|
1799
|
+
},
|
|
1794
1800
|
{
|
|
1795
1801
|
"kind": "javascript-module",
|
|
1796
1802
|
"path": "dist/theming/getConstructableStyle.js",
|
|
@@ -2151,6 +2157,21 @@
|
|
|
2151
2157
|
}
|
|
2152
2158
|
]
|
|
2153
2159
|
},
|
|
2160
|
+
{
|
|
2161
|
+
"kind": "javascript-module",
|
|
2162
|
+
"path": "dist/util/createInstanceChecker.js",
|
|
2163
|
+
"declarations": [],
|
|
2164
|
+
"exports": [
|
|
2165
|
+
{
|
|
2166
|
+
"kind": "js",
|
|
2167
|
+
"name": "default",
|
|
2168
|
+
"declaration": {
|
|
2169
|
+
"name": "createChecker",
|
|
2170
|
+
"module": "dist/util/createInstanceChecker.js"
|
|
2171
|
+
}
|
|
2172
|
+
}
|
|
2173
|
+
]
|
|
2174
|
+
},
|
|
2154
2175
|
{
|
|
2155
2176
|
"kind": "javascript-module",
|
|
2156
2177
|
"path": "dist/util/createLinkInHead.js",
|
|
@@ -9,7 +9,7 @@ interface IFormInputElement extends UI5Element {
|
|
|
9
9
|
declare const updateFormValue: (element: IFormInputElement | UI5Element) => void;
|
|
10
10
|
declare const setFormValue: (element: IFormInputElement) => void;
|
|
11
11
|
declare const setFormValidity: (element: IFormInputElement) => Promise<void>;
|
|
12
|
-
declare const submitForm: (element: UI5Element) => void
|
|
12
|
+
declare const submitForm: (element: UI5Element) => Promise<void>;
|
|
13
13
|
declare const resetForm: (element: UI5Element) => void;
|
|
14
14
|
export { updateFormValue, setFormValue, setFormValidity, submitForm, resetForm, };
|
|
15
15
|
export type { IFormInputElement, };
|
|
@@ -15,9 +15,11 @@ const setFormValue = (element) => {
|
|
|
15
15
|
element._internals.setFormValue(element.formFormattedValue);
|
|
16
16
|
};
|
|
17
17
|
const setFormValidity = async (element) => {
|
|
18
|
-
if (!element._internals?.form) {
|
|
18
|
+
if (!element.isUI5Element || !element._internals?.form) {
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
|
+
element._internals.setValidity({ customError: true }, " "); // treat the form as invalid until CLDR and message bundles are loaded
|
|
22
|
+
await element.definePromise;
|
|
21
23
|
if (element.formValidity && Object.keys(element.formValidity).some(key => key)) {
|
|
22
24
|
const focusRef = await element.formElementAnchor?.();
|
|
23
25
|
element._internals.setValidity(element.formValidity, element.formValidityMessage, focusRef);
|
|
@@ -26,7 +28,9 @@ const setFormValidity = async (element) => {
|
|
|
26
28
|
element._internals.setValidity({});
|
|
27
29
|
}
|
|
28
30
|
};
|
|
29
|
-
const submitForm = (element) => {
|
|
31
|
+
const submitForm = async (element) => {
|
|
32
|
+
const elements = [...(element._internals?.form?.elements ?? [])];
|
|
33
|
+
await Promise.all(elements.map(el => { return isInputElement(el) ? setFormValidity(el) : Promise.resolve(); }));
|
|
30
34
|
element._internals?.form?.requestSubmit();
|
|
31
35
|
};
|
|
32
36
|
const resetForm = (element) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputElementsFormSupport.js","sourceRoot":"","sources":["../../src/features/InputElementsFormSupport.ts"],"names":[],"mappings":"AAUA,MAAM,eAAe,GAAG,CAAC,OAAuC,EAAE,EAAE;IACnE,IAAI,cAAc,CAAC,OAAO,CAAC,EAAE,CAAC;QAC7B,YAAY,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC;AACF,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,OAA0B,EAAE,EAAE;IACnD,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC;QAC/B,OAAO;IACR,CAAC;IAED,eAAe,CAAC,OAAO,CAAC,CAAC;IAEzB,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QACnB,OAAO,CAAC,UAAU,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;QACvC,OAAO;IACR,CAAC;IAED,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAC7D,CAAC,CAAC;AAEF,MAAM,eAAe,GAAG,KAAK,EAAE,OAA0B,EAAE,EAAE;IAC5D,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"InputElementsFormSupport.js","sourceRoot":"","sources":["../../src/features/InputElementsFormSupport.ts"],"names":[],"mappings":"AAUA,MAAM,eAAe,GAAG,CAAC,OAAuC,EAAE,EAAE;IACnE,IAAI,cAAc,CAAC,OAAO,CAAC,EAAE,CAAC;QAC7B,YAAY,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC;AACF,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,OAA0B,EAAE,EAAE;IACnD,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC;QAC/B,OAAO;IACR,CAAC;IAED,eAAe,CAAC,OAAO,CAAC,CAAC;IAEzB,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QACnB,OAAO,CAAC,UAAU,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;QACvC,OAAO;IACR,CAAC;IAED,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAC7D,CAAC,CAAC;AAEF,MAAM,eAAe,GAAG,KAAK,EAAE,OAA0B,EAAE,EAAE;IAC5D,IAAI,CAAC,OAAO,CAAC,YAAY,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC;QACxD,OAAO;IACR,CAAC;IAED,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC,sEAAsE;IAClI,MAAM,OAAO,CAAC,aAAa,CAAC;IAE5B,IAAI,OAAO,CAAC,YAAY,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC;QAChF,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC;QACrD,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC,mBAAmB,EAAE,QAAQ,CAAC,CAAC;IAC7F,CAAC;SAAM,CAAC;QACP,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IACpC,CAAC;AACF,CAAC,CAAC;AAEF,MAAM,UAAU,GAAG,KAAK,EAAE,OAAmB,EAAE,EAAE;IAChD,MAAM,QAAQ,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,IAAI,EAAE,QAAQ,IAAI,EAAE,CAAC,CAA0C,CAAC;IAE1G,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,GAAG,OAAO,cAAc,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAEhH,OAAO,CAAC,UAAU,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;AAC3C,CAAC,CAAC;AAEF,MAAM,SAAS,GAAG,CAAC,OAAmB,EAAE,EAAE;IACzC,OAAO,CAAC,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;AACnC,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,CAAC,OAAuC,EAAgC,EAAE;IAChG,OAAO,oBAAoB,IAAI,OAAO,IAAI,MAAM,IAAI,OAAO,CAAC;AAC7D,CAAC,CAAC;AAEF,OAAO,EACN,eAAe,EACf,YAAY,EACZ,eAAe,EACf,UAAU,EACV,SAAS,GACT,CAAC","sourcesContent":["import type UI5Element from \"../UI5Element.js\";\n\ninterface IFormInputElement extends UI5Element {\n\tname?: string;\n\tformFormattedValue: FormData | string | null;\n\tformValidityMessage?: string;\n\tformValidity?: ValidityStateFlags;\n\tformElementAnchor?: () => HTMLElement | undefined | Promise<HTMLElement | undefined>;\n}\n\nconst updateFormValue = (element: IFormInputElement | UI5Element) => {\n\tif (isInputElement(element)) {\n\t\tsetFormValue(element);\n\t}\n};\n\nconst setFormValue = (element: IFormInputElement) => {\n\tif (!element._internals?.form) {\n\t\treturn;\n\t}\n\n\tsetFormValidity(element);\n\n\tif (!element.name) {\n\t\telement._internals?.setFormValue(null);\n\t\treturn;\n\t}\n\n\telement._internals.setFormValue(element.formFormattedValue);\n};\n\nconst setFormValidity = async (element: IFormInputElement) => {\n\tif (!element.isUI5Element || !element._internals?.form) {\n\t\treturn;\n\t}\n\n\telement._internals.setValidity({ customError: true }, \" \"); // treat the form as invalid until CLDR and message bundles are loaded\n\tawait element.definePromise;\n\n\tif (element.formValidity && Object.keys(element.formValidity).some(key => key)) {\n\t\tconst focusRef = await element.formElementAnchor?.();\n\t\telement._internals.setValidity(element.formValidity, element.formValidityMessage, focusRef);\n\t} else {\n\t\telement._internals.setValidity({});\n\t}\n};\n\nconst submitForm = async (element: UI5Element) => {\n\tconst elements = [...(element._internals?.form?.elements ?? [])] as Array<IFormInputElement | UI5Element>;\n\n\tawait Promise.all(elements.map(el => { return isInputElement(el) ? setFormValidity(el) : Promise.resolve(); }));\n\n\telement._internals?.form?.requestSubmit();\n};\n\nconst resetForm = (element: UI5Element) => {\n\telement._internals?.form?.reset();\n};\n\nconst isInputElement = (element: IFormInputElement | UI5Element): element is IFormInputElement => {\n\treturn \"formFormattedValue\" in element && \"name\" in element;\n};\n\nexport {\n\tupdateFormValue,\n\tsetFormValue,\n\tsetFormValidity,\n\tsubmitForm,\n\tresetForm,\n};\n\nexport type {\n\tIFormInputElement,\n};\n"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
const VersionInfo = {
|
|
2
|
-
version: "2.19.0-rc.
|
|
2
|
+
version: "2.19.0-rc.2",
|
|
3
3
|
major: 2,
|
|
4
4
|
minor: 19,
|
|
5
5
|
patch: 0,
|
|
6
|
-
suffix: "-rc.
|
|
6
|
+
suffix: "-rc.2",
|
|
7
7
|
isNext: false,
|
|
8
|
-
buildTime:
|
|
8
|
+
buildTime: 1770279165,
|
|
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,aAAa;IACtB,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,EAAE;IACT,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.19.0-rc.
|
|
1
|
+
{"version":3,"file":"VersionInfo.js","sourceRoot":"","sources":["../../src/generated/VersionInfo.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,GAAG;IACnB,OAAO,EAAE,aAAa;IACtB,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,EAAE;IACT,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.19.0-rc.2\",\n\tmajor: 2,\n\tminor: 19,\n\tpatch: 0,\n\tsuffix: \"-rc.2\",\n\tisNext: false,\n\tbuildTime: 1770279165,\n};\nexport default VersionInfo;"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: ":root{--_ui5_content_density:cozy}.sapUiSizeCompact,.ui5-content-density-compact,[data-ui5-compact-size]{--_ui5_content_density:compact}";
|
|
1
|
+
declare const _default: ":root{--_ui5-cozy-size:var(--_ui5-f2d95f8);--_ui5-compact-size: ;--_ui5_content_density:cozy}.sapUiSizeCompact,.ui5-content-density-compact,[data-ui5-compact-size]{--_ui5-cozy-size: ;--_ui5-compact-size:var(--_ui5-f2d95f8);--_ui5_content_density:compact}";
|
|
2
2
|
export default _default;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export default `:root{--_ui5_content_density:cozy}.sapUiSizeCompact,.ui5-content-density-compact,[data-ui5-compact-size]{--_ui5_content_density:compact}`;
|
|
1
|
+
export default `:root{--_ui5-cozy-size:var(--_ui5-f2d95f8);--_ui5-compact-size: ;--_ui5_content_density:cozy}.sapUiSizeCompact,.ui5-content-density-compact,[data-ui5-compact-size]{--_ui5-cozy-size: ;--_ui5-compact-size:var(--_ui5-f2d95f8);--_ui5_content_density:compact}`;
|
|
2
2
|
//# sourceMappingURL=SystemCSSVars.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SystemCSSVars.css.js","sourceRoot":"","sources":["../../../src/generated/css/SystemCSSVars.css.ts"],"names":[],"mappings":"AAAA,eAAe,
|
|
1
|
+
{"version":3,"file":"SystemCSSVars.css.js","sourceRoot":"","sources":["../../../src/generated/css/SystemCSSVars.css.ts"],"names":[],"mappings":"AAAA,eAAe,gQAAgQ,CAAC","sourcesContent":["export default `:root{--_ui5-cozy-size:var(--_ui5-f2d95f8);--_ui5-compact-size: ;--_ui5_content_density:cozy}.sapUiSizeCompact,.ui5-content-density-compact,[data-ui5-compact-size]{--_ui5-cozy-size: ;--_ui5-compact-size:var(--_ui5-f2d95f8);--_ui5_content_density:compact}`;"]}
|
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 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 m,camelToKebabCase as J,kebabToPascalCase as w}from"./util/StringHelper.js";import P 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 T}from"./CustomElementsScopeUtils.js";import{updateFormValue as et,setFormValue as A}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";import{getLanguageChangePending as ot}from"./config/Language.js";let it=0;const R=new Map,I=new Map,O={fromAttribute(c,f){return f===Boolean?c!==null:f===Number?c===null?void 0:parseFloat(c):c},toAttribute(c,f){return f===Boolean?c?"":null:f===Object||f===Array||c==null?null:String(c)}};function y(c){this._suppressInvalidation||this.constructor.getMetadata().isLanguageAware()&&ot()||(this.onInvalidation(c),this._changedState.push(c),j(this),this._invalidationEventProvider.fireEvent("invalidate",{...c,target:this}))}function at(c,f){do{const t=Object.getOwnPropertyDescriptor(c,f);if(t)return t;c=Object.getPrototypeOf(c)}while(c&&c!==HTMLElement.prototype)}class b extends HTMLElement{constructor(){super();this.__shouldHydrate=!1;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.shadowRoot?this.__shouldHydrate=!0: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_${++it}`),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.hasAttribute("data-sap-ui-fastnavgroup")&&this.setAttribute("data-sap-ui-fastnavgroup","true");const e=t.getMetadata().slotsAreManaged();this._inDOM=!0,e&&(this._startObservingDOMChildren(),await this._processChildren()),t.asyncFinished||await t.definePromise,this._inDOM&&(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,a=new Map;for(const[l,u]of Object.entries(e)){const d=u.propertyName||l;a.set(d,l),o.set(d,[...this._state[d]]),this._clearSlot(l,u)}const r=new Map,i=new Map,h=n.map(async(l,u)=>{const d=G(l),g=e[d];if(g===void 0){if(d!=="default"){const p=Object.keys(e).join(", ");console.warn(`Unknown slotName: ${d}, ignoring`,l,`Valid values are: ${p}`)}return}if(g.individualSlots){const p=(r.get(d)||0)+1;r.set(d,p),l._individualSlot=`${d}-${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=R.get(p);E||(E=new Promise(U=>setTimeout(U,1e3)),R.set(p,E)),await Promise.race([L,E])}customElements.upgrade(l)}}if(l=t.getMetadata().constructor.validateSlotValue(l,g),v(l)&&g.invalidateOnChildChange){const p=this._getChildChangeListener(d);l.attachInvalidate.call(l,p)}l instanceof HTMLSlotElement&&this._attachSlotChange(l,d,!!g.invalidateOnChildChange);const C=g.propertyName||d;i.has(C)?i.get(C).push({child:l,idx:u}):i.set(C,[{child:l,idx:u}])});await Promise.all(h),i.forEach((l,u)=>{this._state[u]=l.sort((d,g)=>d.idx-g.idx).map(d=>d.child),this._state[m(u)]=this._state[u]});let _=!1;for(const[l,u]of Object.entries(e)){const d=u.propertyName||l;Q(o.get(d),this._state[d])||(y.call(this,{type:"slot",name:a.get(d),reason:"children"}),_=!0,t.getMetadata().isFormAssociated()&&A(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 a=this._getChildChangeListener(t);o.detachInvalidate.call(o,a)}o instanceof HTMLSlotElement&&this._detachSlotChange(o,t)}),this._state[s]=[],this._state[m(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(),a=t.replace(/^ui5-/,""),r=m(a);if(o.hasOwnProperty(r)){const i=o[r];n=(i.converter??O).fromAttribute(s,i.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],a=J(t),i=(o.converter||O).toAttribute(e,o.type);this._doNotSyncAttributes.add(a),i==null?this.removeAttribute(a):this.setAttribute(a,i),this._doNotSyncAttributes.delete(a)}_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 a=this._slotsAssignedNodes.get(t);a&&a.forEach(i=>{if(v(i)){const h=this._getChildChangeListener(e);i.detachInvalidate.call(i,h)}});const r=D([t]);this._slotsAssignedNodes.set(t,r),r.forEach(i=>{if(v(i)){const h=this._getChildChangeListener(e);i.attachInvalidate.call(i,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||!this.isConnected?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),a=w(t);return a!==t?o&&this._fireEvent(a,e,s,n):o}fireDecoratorEvent(t,e){const s=this.getEventData(t),n=s?s.cancelable:!1,o=s?s.bubbles:!1,a=this._fireEvent(t,e,n,o),r=w(t);return r!==t?a&&this._fireEvent(r,e,n,o):a}_fireEvent(t,e,s=!1,n=!0){const o=new CustomEvent(`ui5-${t}`,{detail:e,composed:!1,bubbles:n,cancelable:s}),a=this.dispatchEvent(o);if(X(t))return a;const r=new CustomEvent(t,{detail:e,composed:!1,bubbles:n,cancelable:s});return this.dispatchEvent(r)&&a}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(){}static get observedAttributes(){return this.getMetadata().getAttributesList()}static get tagsToScope(){const t=this.getMetadata().getPureTag(),e=this.getUniqueDependencies().map(s=>s.getMetadata().getPureTag()).filter(T);return T(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)){P(n)||console.warn(`"${n}" is not a valid property name. Use a name that does not collide with DOM APIs`);const a=at(t,n);let r;a?.set&&(r=a.set);let i;a?.get&&(i=a.get),Object.defineProperty(t,n,{get(){return i?i.call(this):this._state[n]},set(h){const _=this.constructor,l=i?i.call(this):this._state[n];if(l!==h){if(r?r.call(this,h):this._state[n]=h,y.call(this,{type:"property",name:n,newValue:h,oldValue:l}),this._rendered){const d=i?i.call(this):this._state[n];this._updateAttribute(n,d)}_.getMetadata().isFormAssociated()&&A(this)}}})}if(e){const n=this.getMetadata().getSlots();for(const[o,a]of Object.entries(n)){P(o)||console.warn(`"${o}" is not a valid property name. Use a name that does not collide with DOM APIs`);const r=a.propertyName||o,i={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,i),r!==m(r)&&Object.defineProperty(t,m(r),i)}}}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()]),[a]=o;Object.entries(this.getMetadata().getI18n()).forEach((r,i)=>{const h=r[1].bundleName;this.i18nBundleStorage[h]=a[i]}),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!==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 v=c=>"isUI5Element"in c;export default b;export{v as instanceOfUI5Element};
|
|
1
|
+
"use strict";import"@ui5/webcomponents-base/dist/ssr-dom.js";import N from"./thirdparty/merge.js";import{boot as k}from"./Boot.js";import x from"./UI5ElementMetadata.js";import S from"./EventProvider.js";import V from"./updateShadowRoot.js";import{shouldIgnoreCustomElement as j}from"./IgnoreCustomElements.js";import{renderDeferred as H,renderImmediately as $,cancelRender as z}from"./Render.js";import{registerTag as B,isTagRegistered as K,recordTagRegistrationFailure as q}from"./CustomElementsRegistry.js";import{observeDOMNode as W,unobserveDOMNode as X}from"./DOMObserver.js";import{skipOriginalEvent as Y}from"./config/NoConflict.js";import J from"./locale/getEffectiveDir.js";import{kebabToCamelCase as m,camelToKebabCase as G,kebabToPascalCase as P}from"./util/StringHelper.js";import w from"./util/isValidPropertyName.js";import{getSlotName as D,getSlottedNodesList as T}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 C from"./locale/getLocale.js";import{getLanguageChangePending as ot}from"./config/Language.js";import it from"./util/createInstanceChecker.js";let at=0;const O=new Map,M=new Map,L={fromAttribute(c,f){return f===Boolean?c!==null:f===Number?c===null?void 0:parseFloat(c):c},toAttribute(c,f){return f===Boolean?c?"":null:f===Object||f===Array||c==null?null:String(c)}};function g(c){this._suppressInvalidation||this.constructor.getMetadata().isLanguageAware()&&ot()||(this.onInvalidation(c),this._changedState.push(c),H(this),this._invalidationEventProvider.fireEvent("invalidate",{...c,target:this}))}function rt(c,f){do{const t=Object.getOwnPropertyDescriptor(c,f);if(t)return t;c=Object.getPrototypeOf(c)}while(c&&c!==HTMLElement.prototype)}class I extends HTMLElement{constructor(){super();this.__shouldHydrate=!1;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.shadowRoot?this.__shouldHydrate=!0: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.hasAttribute("data-sap-ui-fastnavgroup")&&this.setAttribute("data-sap-ui-fastnavgroup","true");const e=t.getMetadata().slotsAreManaged();this._inDOM=!0,e&&(this._startObservingDOMChildren(),await this._processChildren()),t.asyncFinished||await t._definePromise,this._inDOM&&($(this),this._domRefReadyPromise._deferredResolve(),this._fullyConnected=!0,this.onEnterDOM())}get definePromise(){const t=this.constructor;return!t.asyncFinished&&t._definePromise?t._definePromise:Promise.resolve()}disconnectedCallback(){const e=this.constructor.getMetadata().slotsAreManaged();this._inDOM=!1,e&&this._stopObservingDOMChildren(),this._fullyConnected&&(this.onExitDOM(),this._fullyConnected=!1),this._domRefReadyPromise._deferredResolve(),z(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};W(this,this._processChildren.bind(this),o)}_stopObservingDOMChildren(){X(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,a=new Map;for(const[l,h]of Object.entries(e)){const d=h.propertyName||l;a.set(d,l),o.set(d,[...this._state[d]]),this._clearSlot(l,h)}const r=new Map,i=new Map;n.forEach((l,h)=>{const d=D(l),p=e[d];if(p===void 0){if(d!=="default"){const b=Object.keys(e).join(", ");console.warn(`Unknown slotName: ${d}, ignoring`,l,`Valid values are: ${b}`)}return}const _=p.propertyName||d;i.has(_)?i.get(_).push({child:l,idx:h}):i.set(_,[{child:l,idx:h}])}),i.forEach((l,h)=>{this._state[h]=l.sort((d,p)=>d.idx-p.idx).map(d=>d.child),this._state[m(h)]=this._state[h]});const u=n.map(async l=>{const h=D(l),d=e[h];if(d!==void 0){if(d.individualSlots){const p=(r.get(h)||0)+1;r.set(h,p),l._individualSlot=`${h}-${p}`}if(l instanceof HTMLElement){const p=l.localName;if(p.includes("-")&&!j(p)){if(!customElements.get(p)){const U=customElements.whenDefined(p);let E=O.get(p);E||(E=new Promise(F=>setTimeout(F,1e3)),O.set(p,E)),await Promise.race([U,E])}customElements.upgrade(l)}}if(l=t.getMetadata().constructor.validateSlotValue(l,d),y(l)&&d.invalidateOnChildChange){const p=this._getChildChangeListener(h);l.attachInvalidate.call(l,p)}l instanceof HTMLSlotElement&&this._attachSlotChange(l,h,!!d.invalidateOnChildChange)}});await Promise.all(u);let v=!1;for(const[l,h]of Object.entries(e)){const d=h.propertyName||l;Q(o.get(d),this._state[d])||(g.call(this,{type:"slot",name:a.get(d),reason:"children"}),v=!0,t.getMetadata().isFormAssociated()&&R(this))}v||g.call(this,{type:"slot",name:"default",reason:"textcontent"})}_clearSlot(t,e){const s=e.propertyName||t;this._state[s].forEach(o=>{if(y(o)){const a=this._getChildChangeListener(t);o.detachInvalidate.call(o,a)}o instanceof HTMLSlotElement&&this._detachSlotChange(o,t)}),this._state[s]=[],this._state[m(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)&&g.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(),a=t.replace(/^ui5-/,""),r=m(a);if(o.hasOwnProperty(r)){const i=o[r];n=(i.converter??L).fromAttribute(s,i.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],a=G(t),i=(o.converter||L).toAttribute(e,o.type);this._doNotSyncAttributes.add(a),i==null?this.removeAttribute(a):this.setAttribute(a,i),this._doNotSyncAttributes.delete(a)}_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 a=this._slotsAssignedNodes.get(t);a&&a.forEach(i=>{if(y(i)){const u=this._getChildChangeListener(e);i.detachInvalidate.call(i,u)}});const r=T([t]);this._slotsAssignedNodes.set(t,r),r.forEach(i=>{if(y(i)){const u=this._getChildChangeListener(e);i.attachInvalidate.call(i,u)}})}})}_detachSlotChange(t,e){t.removeEventListener("slotchange",this._getSlotChangeListener(e))}_onSlotChange(t){g.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()&&V(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||!this.isConnected?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),a=P(t);return a!==t?o&&this._fireEvent(a,e,s,n):o}fireDecoratorEvent(t,e){const s=this.getEventData(t),n=s?s.cancelable:!1,o=s?s.bubbles:!1,a=this._fireEvent(t,e,n,o),r=P(t);return r!==t?a&&this._fireEvent(r,e,n,o):a}_fireEvent(t,e,s=!1,n=!0){const o=new CustomEvent(`ui5-${t}`,{detail:e,composed:!1,bubbles:n,cancelable:s}),a=this.dispatchEvent(o);if(Y(t))return a;const r=new CustomEvent(t,{detail:e,composed:!1,bubbles:n,cancelable:s});return this.dispatchEvent(r)&&a}getEventData(t){return this.constructor.getMetadata().getEvents()[t]}getSlottedNodes(t){return T(this[t])}attachComponentStateFinalized(t){this._componentStateFinalizedEventProvider.attachEvent("componentStateFinalized",t)}detachComponentStateFinalized(t){this._componentStateFinalizedEventProvider.detachEvent("componentStateFinalized",t)}get effectiveDir(){return Z(this.constructor),J(this)}get isUI5Element(){return!0}get isUI5AbstractElement(){return!this.constructor._needsShadowDOM()}get classes(){return{}}get accessibilityInfo(){}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 a=rt(t,n);let r;a?.set&&(r=a.set);let i;a?.get&&(i=a.get),Object.defineProperty(t,n,{get(){return i?i.call(this):this._state[n]},set(u){const v=this.constructor,l=i?i.call(this):this._state[n];if(l!==u){if(r?r.call(this,u):this._state[n]=u,g.call(this,{type:"property",name:n,newValue:u,oldValue:l}),this._rendered){const d=i?i.call(this):this._state[n];this._updateAttribute(n,d)}v.getMetadata().isFormAssociated()&&R(this)}}})}if(e){const n=this.getMetadata().getSlots();for(const[o,a]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=a.propertyName||o,i={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,i),r!==m(r)&&Object.defineProperty(t,m(r),i)}}}static{this.metadata={}}static{this.styles=""}static get dependencies(){return[]}static cacheUniqueDependencies(){const t=this.dependencies.filter((e,s,n)=>n.indexOf(e)===s);M.set(this,t)}static getUniqueDependencies(){return M.has(this)||this.cacheUniqueDependencies(),M.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(C().getLanguage(),C().getRegion(),C().getScript()):Promise.resolve()}static{this.i18nBundleStorage={}}static get i18nBundles(){return this.i18nBundleStorage}static define(){const t=async()=>{await k();const o=await Promise.all([this.fetchI18nBundles(),this.fetchCLDR(),this.onDefine()]),[a]=o;Object.entries(this.getMetadata().getI18n()).forEach((r,i)=>{const u=r[1].bundleName;this.i18nBundleStorage[u]=a[i]}),this.asyncFinished=!0};this._definePromise=t();const e=this.getMetadata().getTag(),s=K(e),n=customElements.get(e);return n&&!s?q(e):n||(this._generateAccessors(),B(e),customElements.define(e,this)),this}static getMetadata(){if(this.hasOwnProperty("_metadata"))return this._metadata;const t=[this.metadata];let e=this;for(;e!==I;)e=Object.getPrototypeOf(e),t.unshift(e.metadata);const s=N({},...t);return this._metadata=new x(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 y=it("isUI5Element");export default I;export{y as instanceOfUI5Element};
|
|
2
2
|
//# sourceMappingURL=UI5Element.js.map
|