@db-ux/wc-core-components 4.11.0 → 4.11.1
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 +12 -0
- package/bundle/db-accordion-item.js +1 -1
- package/bundle/db-accordion.js +1 -1
- package/bundle/db-badge.js +1 -1
- package/bundle/db-brand.js +1 -1
- package/bundle/db-button.js +1 -1
- package/bundle/db-card.js +1 -1
- package/bundle/db-checkbox.js +1 -1
- package/bundle/db-custom-button.js +1 -1
- package/bundle/db-custom-select-dropdown.js +1 -1
- package/bundle/db-custom-select-form-field.js +1 -1
- package/bundle/db-custom-select-list-item.js +1 -1
- package/bundle/db-custom-select-list.js +1 -1
- package/bundle/db-custom-select.js +1 -1
- package/bundle/db-divider.js +1 -1
- package/bundle/db-drawer.js +1 -1
- package/bundle/db-header.js +1 -1
- package/bundle/db-icon.js +1 -1
- package/bundle/db-infotext.js +1 -1
- package/bundle/db-input.js +1 -1
- package/bundle/db-link.js +1 -1
- package/bundle/db-navigation-item.js +1 -1
- package/bundle/db-navigation.js +1 -1
- package/bundle/db-notification.js +1 -1
- package/bundle/db-page.js +1 -1
- package/bundle/db-popover.js +1 -1
- package/bundle/db-radio.js +1 -1
- package/bundle/db-section.js +1 -1
- package/bundle/db-select.js +1 -1
- package/bundle/db-stack.js +1 -1
- package/bundle/db-switch.js +1 -1
- package/bundle/db-tab-item.js +1 -1
- package/bundle/db-tab-list.js +1 -1
- package/bundle/db-tab-panel.js +1 -1
- package/bundle/db-table-body.js +1 -1
- package/bundle/db-table-caption.js +1 -1
- package/bundle/db-table-data-cell.js +1 -1
- package/bundle/db-table-footer.js +1 -1
- package/bundle/db-table-head.js +1 -1
- package/bundle/db-table-header-cell.js +1 -1
- package/bundle/db-table-row.js +1 -1
- package/bundle/db-table.js +1 -1
- package/bundle/db-tabs.js +1 -1
- package/bundle/db-tag.js +1 -1
- package/bundle/db-textarea.js +1 -1
- package/bundle/db-tooltip.js +1 -1
- package/bundle/p-3Da4lo5j.js +1 -0
- package/bundle/p-BEcb3EOO.js +1 -0
- package/bundle/p-BEolc6Da.js +1 -0
- package/bundle/p-BekmqY3B.js +1 -0
- package/bundle/p-BmRO4X-P.js +1 -0
- package/bundle/p-BrQIYm5N.js +1 -0
- package/bundle/p-BxZ0zFXf.js +1 -0
- package/bundle/p-C2viXF7U.js +1 -0
- package/bundle/p-C4iD-won.js +1 -0
- package/bundle/p-CHg_VPD9.js +1 -0
- package/bundle/p-CZ9SsTOA.js +1 -0
- package/bundle/p-CewqZGHg.js +1 -0
- package/bundle/p-CotiEHZi.js +1 -0
- package/bundle/p-D1orcIJf.js +1 -0
- package/bundle/p-D9RSX1St.js +1 -0
- package/bundle/p-DbgzEek1.js +1 -0
- package/bundle/p-DqNXsduK.js +1 -0
- package/bundle/p-Duacd-NX.js +1 -0
- package/bundle/p-k5Hci0ok.js +1 -0
- package/bundle/p-mk64Fltq.js +1 -0
- package/dist/cjs/db-accordion-item.cjs.entry.js +46 -9
- package/dist/cjs/db-accordion.cjs.entry.js +43 -6
- package/dist/cjs/db-badge.cjs.entry.js +43 -6
- package/dist/cjs/db-brand.cjs.entry.js +36 -5
- package/dist/cjs/db-button.cjs.entry.js +36 -5
- package/dist/cjs/db-card.cjs.entry.js +36 -5
- package/dist/cjs/db-checkbox.cjs.entry.js +45 -11
- package/dist/cjs/db-custom-button.cjs.entry.js +36 -5
- package/dist/cjs/db-custom-select-dropdown_5.cjs.entry.js +190 -31
- package/dist/cjs/db-custom-select-form-field.cjs.entry.js +36 -5
- package/dist/cjs/db-custom-select.cjs.entry.js +60 -26
- package/dist/cjs/db-divider.cjs.entry.js +35 -4
- package/dist/cjs/db-drawer.cjs.entry.js +45 -8
- package/dist/cjs/db-header.cjs.entry.js +43 -6
- package/dist/cjs/db-icon.cjs.entry.js +36 -5
- package/dist/cjs/db-infotext.cjs.entry.js +36 -5
- package/dist/cjs/db-link_4.cjs.entry.js +65 -19
- package/dist/cjs/db-navigation-item.cjs.entry.js +46 -9
- package/dist/cjs/db-navigation.cjs.entry.js +36 -5
- package/dist/cjs/db-notification.cjs.entry.js +36 -5
- package/dist/cjs/db-page.cjs.entry.js +48 -13
- package/dist/cjs/db-popover.cjs.entry.js +43 -6
- package/dist/cjs/db-radio.cjs.entry.js +42 -8
- package/dist/cjs/db-section.cjs.entry.js +36 -5
- package/dist/cjs/db-select.cjs.entry.js +45 -11
- package/dist/cjs/db-stack.cjs.entry.js +36 -5
- package/dist/cjs/db-switch.cjs.entry.js +45 -11
- package/dist/cjs/db-tab-item_3.cjs.entry.js +118 -19
- package/dist/cjs/db-table-body_3.cjs.entry.js +53 -12
- package/dist/cjs/db-table-caption.cjs.entry.js +36 -5
- package/dist/cjs/db-table.cjs.entry.js +35 -4
- package/dist/cjs/db-tabs.cjs.entry.js +42 -8
- package/dist/cjs/db-textarea.cjs.entry.js +45 -10
- package/dist/cjs/db-tooltip.cjs.entry.js +144 -20
- package/dist/cjs/db-ux.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/accordion/accordion.js +45 -7
- package/dist/collection/components/accordion-item/accordion-item.js +48 -10
- package/dist/collection/components/badge/badge.js +45 -7
- package/dist/collection/components/brand/brand.js +43 -5
- package/dist/collection/components/button/button.js +43 -5
- package/dist/collection/components/card/card.js +43 -5
- package/dist/collection/components/checkbox/checkbox.js +47 -12
- package/dist/collection/components/custom-button/custom-button.js +43 -5
- package/dist/collection/components/custom-select/custom-select.js +62 -27
- package/dist/collection/components/custom-select-dropdown/custom-select-dropdown.js +41 -5
- package/dist/collection/components/custom-select-form-field/custom-select-form-field.js +43 -5
- package/dist/collection/components/custom-select-list/custom-select-list.js +43 -5
- package/dist/collection/components/custom-select-list-item/custom-select-list-item.js +37 -5
- package/dist/collection/components/divider/divider.js +42 -4
- package/dist/collection/components/drawer/drawer.js +47 -9
- package/dist/collection/components/header/header.js +45 -7
- package/dist/collection/components/icon/icon.js +43 -5
- package/dist/collection/components/infotext/infotext.js +43 -5
- package/dist/collection/components/input/input.js +49 -13
- package/dist/collection/components/link/link.js +43 -5
- package/dist/collection/components/navigation/navigation.js +43 -5
- package/dist/collection/components/navigation-item/navigation-item.js +48 -10
- package/dist/collection/components/notification/notification.js +43 -5
- package/dist/collection/components/page/page.js +50 -14
- package/dist/collection/components/popover/popover.js +45 -7
- package/dist/collection/components/radio/radio.js +44 -9
- package/dist/collection/components/section/section.js +43 -5
- package/dist/collection/components/select/select.js +47 -12
- package/dist/collection/components/stack/stack.js +43 -5
- package/dist/collection/components/switch/switch.js +47 -12
- package/dist/collection/components/tab-item/tab-item.js +45 -10
- package/dist/collection/components/tab-list/tab-list.js +43 -5
- package/dist/collection/components/tab-panel/tab-panel.js +48 -5
- package/dist/collection/components/table/table.js +37 -5
- package/dist/collection/components/table-body/table-body.js +9 -4
- package/dist/collection/components/table-caption/table-caption.js +43 -5
- package/dist/collection/components/table-data-cell/table-data-cell.js +10 -5
- package/dist/collection/components/table-footer/table-footer.js +9 -4
- package/dist/collection/components/table-head/table-head.js +42 -4
- package/dist/collection/components/table-header-cell/table-header-cell.js +10 -5
- package/dist/collection/components/table-row/table-row.js +9 -4
- package/dist/collection/components/tabs/tabs.js +44 -9
- package/dist/collection/components/tag/tag.js +43 -5
- package/dist/collection/components/textarea/textarea.js +47 -11
- package/dist/collection/components/tooltip/tooltip.js +150 -21
- package/dist/custom-elements.json +710 -0
- package/dist/db-ux/db-ux.esm.js +1 -1
- package/dist/db-ux/p-0123ee1b.entry.js +1 -0
- package/dist/db-ux/p-090b1797.entry.js +1 -0
- package/dist/db-ux/p-0e17c5a0.entry.js +1 -0
- package/dist/db-ux/p-194e851c.entry.js +1 -0
- package/dist/db-ux/p-281f5e3e.entry.js +1 -0
- package/dist/db-ux/p-2ae377e6.entry.js +1 -0
- package/dist/db-ux/p-2cf4345f.entry.js +1 -0
- package/dist/db-ux/p-2e6c8304.entry.js +1 -0
- package/dist/db-ux/p-335391d4.entry.js +1 -0
- package/dist/db-ux/p-34235204.entry.js +1 -0
- package/dist/db-ux/p-3569bb3c.entry.js +1 -0
- package/dist/db-ux/p-398f9165.entry.js +1 -0
- package/dist/db-ux/p-5070470f.entry.js +1 -0
- package/dist/db-ux/p-5e08712d.entry.js +1 -0
- package/dist/db-ux/p-63d98f9d.entry.js +1 -0
- package/dist/db-ux/p-6aa92091.entry.js +1 -0
- package/dist/db-ux/p-78b7e6f6.entry.js +1 -0
- package/dist/db-ux/p-7ca4bc82.entry.js +1 -0
- package/dist/db-ux/p-8f989150.entry.js +1 -0
- package/dist/db-ux/p-8fa7a578.entry.js +1 -0
- package/dist/db-ux/p-91052c75.entry.js +1 -0
- package/dist/db-ux/p-9ccd42b1.entry.js +1 -0
- package/dist/db-ux/p-a4d9f6e2.entry.js +1 -0
- package/dist/db-ux/p-af248e57.entry.js +1 -0
- package/dist/db-ux/p-ba82a0b0.entry.js +1 -0
- package/dist/db-ux/p-c2ce6ecd.entry.js +1 -0
- package/dist/db-ux/p-d7b5748d.entry.js +1 -0
- package/dist/db-ux/p-dfbbe502.entry.js +1 -0
- package/dist/db-ux/p-e7a400a2.entry.js +1 -0
- package/dist/db-ux/p-ef1aa878.entry.js +1 -0
- package/dist/db-ux/p-f1daaefa.entry.js +1 -0
- package/dist/db-ux/p-f6312d2c.entry.js +1 -0
- package/dist/db-ux/p-fbf09569.entry.js +1 -0
- package/dist/db-ux/p-ff11c071.entry.js +1 -0
- package/dist/esm/db-accordion-item.entry.js +46 -9
- package/dist/esm/db-accordion.entry.js +43 -6
- package/dist/esm/db-badge.entry.js +43 -6
- package/dist/esm/db-brand.entry.js +36 -5
- package/dist/esm/db-button.entry.js +36 -5
- package/dist/esm/db-card.entry.js +36 -5
- package/dist/esm/db-checkbox.entry.js +45 -11
- package/dist/esm/db-custom-button.entry.js +36 -5
- package/dist/esm/db-custom-select-dropdown_5.entry.js +190 -31
- package/dist/esm/db-custom-select-form-field.entry.js +36 -5
- package/dist/esm/db-custom-select.entry.js +60 -26
- package/dist/esm/db-divider.entry.js +35 -4
- package/dist/esm/db-drawer.entry.js +45 -8
- package/dist/esm/db-header.entry.js +43 -6
- package/dist/esm/db-icon.entry.js +36 -5
- package/dist/esm/db-infotext.entry.js +36 -5
- package/dist/esm/db-link_4.entry.js +65 -19
- package/dist/esm/db-navigation-item.entry.js +47 -10
- package/dist/esm/db-navigation.entry.js +36 -5
- package/dist/esm/db-notification.entry.js +36 -5
- package/dist/esm/db-page.entry.js +48 -13
- package/dist/esm/db-popover.entry.js +43 -6
- package/dist/esm/db-radio.entry.js +42 -8
- package/dist/esm/db-section.entry.js +36 -5
- package/dist/esm/db-select.entry.js +45 -11
- package/dist/esm/db-stack.entry.js +36 -5
- package/dist/esm/db-switch.entry.js +45 -11
- package/dist/esm/db-tab-item_3.entry.js +118 -19
- package/dist/esm/db-table-body_3.entry.js +53 -12
- package/dist/esm/db-table-caption.entry.js +36 -5
- package/dist/esm/db-table.entry.js +35 -4
- package/dist/esm/db-tabs.entry.js +43 -9
- package/dist/esm/db-textarea.entry.js +45 -10
- package/dist/esm/db-tooltip.entry.js +144 -20
- package/dist/esm/db-ux.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/accordion/accordion.d.ts +3 -0
- package/dist/types/components/accordion-item/accordion-item.d.ts +3 -0
- package/dist/types/components/badge/badge.d.ts +3 -0
- package/dist/types/components/brand/brand.d.ts +3 -0
- package/dist/types/components/button/button.d.ts +3 -0
- package/dist/types/components/card/card.d.ts +3 -0
- package/dist/types/components/checkbox/checkbox.d.ts +2 -0
- package/dist/types/components/custom-button/custom-button.d.ts +3 -0
- package/dist/types/components/custom-select/custom-select.d.ts +2 -0
- package/dist/types/components/custom-select-dropdown/custom-select-dropdown.d.ts +3 -0
- package/dist/types/components/custom-select-form-field/custom-select-form-field.d.ts +3 -0
- package/dist/types/components/custom-select-list/custom-select-list.d.ts +3 -0
- package/dist/types/components/custom-select-list-item/custom-select-list-item.d.ts +3 -0
- package/dist/types/components/divider/divider.d.ts +3 -0
- package/dist/types/components/drawer/drawer.d.ts +3 -0
- package/dist/types/components/header/header.d.ts +3 -0
- package/dist/types/components/icon/icon.d.ts +3 -0
- package/dist/types/components/infotext/infotext.d.ts +3 -0
- package/dist/types/components/input/input.d.ts +2 -0
- package/dist/types/components/link/link.d.ts +3 -0
- package/dist/types/components/navigation/navigation.d.ts +3 -0
- package/dist/types/components/navigation-item/navigation-item.d.ts +3 -0
- package/dist/types/components/notification/notification.d.ts +3 -0
- package/dist/types/components/page/page.d.ts +2 -0
- package/dist/types/components/popover/popover.d.ts +3 -0
- package/dist/types/components/radio/radio.d.ts +2 -0
- package/dist/types/components/section/section.d.ts +3 -0
- package/dist/types/components/select/select.d.ts +2 -0
- package/dist/types/components/stack/stack.d.ts +3 -0
- package/dist/types/components/switch/switch.d.ts +2 -0
- package/dist/types/components/tab-item/tab-item.d.ts +2 -0
- package/dist/types/components/tab-list/tab-list.d.ts +3 -0
- package/dist/types/components/tab-panel/tab-panel.d.ts +3 -0
- package/dist/types/components/table/table.d.ts +3 -0
- package/dist/types/components/table-caption/table-caption.d.ts +3 -0
- package/dist/types/components/table-head/table-head.d.ts +3 -0
- package/dist/types/components/tabs/tabs.d.ts +2 -0
- package/dist/types/components/tag/tag.d.ts +3 -0
- package/dist/types/components/textarea/textarea.d.ts +2 -0
- package/dist/types/components/tooltip/model.d.ts +9 -0
- package/dist/types/components/tooltip/tooltip.d.ts +8 -0
- package/dist/web-types.json +84 -40
- package/package.json +6 -6
- package/bundle/p-B5ANMEnQ.js +0 -1
- package/bundle/p-BJwvv-yT.js +0 -1
- package/bundle/p-BNiKxu3y.js +0 -1
- package/bundle/p-B_bPnncM.js +0 -1
- package/bundle/p-BnLhi6Lz.js +0 -1
- package/bundle/p-BrBlnLrn.js +0 -1
- package/bundle/p-CByFfoSH.js +0 -1
- package/bundle/p-CQo0C7QE.js +0 -1
- package/bundle/p-CR2ZbfYe.js +0 -1
- package/bundle/p-CeDu282h.js +0 -1
- package/bundle/p-CfLPOLHz.js +0 -1
- package/bundle/p-CoOxyQb2.js +0 -1
- package/bundle/p-CqED0CfD.js +0 -1
- package/bundle/p-Cr_z1Jfi.js +0 -1
- package/bundle/p-D-XzX0R7.js +0 -1
- package/bundle/p-DMSIvqcA.js +0 -1
- package/bundle/p-DUiroUyR.js +0 -1
- package/bundle/p-DdyMClpj.js +0 -1
- package/bundle/p-DjVjS2Tb.js +0 -1
- package/bundle/p-in4Kv88F.js +0 -1
- package/dist/db-ux/p-08271c80.entry.js +0 -1
- package/dist/db-ux/p-105ffa74.entry.js +0 -1
- package/dist/db-ux/p-15adca91.entry.js +0 -1
- package/dist/db-ux/p-1a322a0c.entry.js +0 -1
- package/dist/db-ux/p-1f7232c0.entry.js +0 -1
- package/dist/db-ux/p-27e2f6f2.entry.js +0 -1
- package/dist/db-ux/p-2907f214.entry.js +0 -1
- package/dist/db-ux/p-2ff958e4.entry.js +0 -1
- package/dist/db-ux/p-3423b7af.entry.js +0 -1
- package/dist/db-ux/p-365e6edf.entry.js +0 -1
- package/dist/db-ux/p-42516007.entry.js +0 -1
- package/dist/db-ux/p-5045182c.entry.js +0 -1
- package/dist/db-ux/p-5e1d42e5.entry.js +0 -1
- package/dist/db-ux/p-61b28212.entry.js +0 -1
- package/dist/db-ux/p-6850a53c.entry.js +0 -1
- package/dist/db-ux/p-6bff55b4.entry.js +0 -1
- package/dist/db-ux/p-6e7c5e42.entry.js +0 -1
- package/dist/db-ux/p-76adf385.entry.js +0 -1
- package/dist/db-ux/p-78f7b353.entry.js +0 -1
- package/dist/db-ux/p-7fa5d304.entry.js +0 -1
- package/dist/db-ux/p-95b69e71.entry.js +0 -1
- package/dist/db-ux/p-99ebe6ec.entry.js +0 -1
- package/dist/db-ux/p-a5dc355d.entry.js +0 -1
- package/dist/db-ux/p-a6113789.entry.js +0 -1
- package/dist/db-ux/p-b9c0feaf.entry.js +0 -1
- package/dist/db-ux/p-c14fa91a.entry.js +0 -1
- package/dist/db-ux/p-c65b807e.entry.js +0 -1
- package/dist/db-ux/p-dd9cedbe.entry.js +0 -1
- package/dist/db-ux/p-e3f705fd.entry.js +0 -1
- package/dist/db-ux/p-e4cddc9f.entry.js +0 -1
- package/dist/db-ux/p-e7a8612c.entry.js +0 -1
- package/dist/db-ux/p-ee8c3243.entry.js +0 -1
- package/dist/db-ux/p-f0d0acfc.entry.js +0 -1
- package/dist/db-ux/p-f15748ea.entry.js +0 -1
|
@@ -5,6 +5,29 @@ import { h } from "@stencil/core";
|
|
|
5
5
|
|
|
6
6
|
*/
|
|
7
7
|
export class DBTableCaption {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.observer = undefined;
|
|
10
|
+
}
|
|
11
|
+
setupObserver(element) {
|
|
12
|
+
if (!element)
|
|
13
|
+
return;
|
|
14
|
+
const parent = element.closest("db-table-caption");
|
|
15
|
+
if (!parent || this.observer)
|
|
16
|
+
return;
|
|
17
|
+
this.observer = new MutationObserver((mutations) => {
|
|
18
|
+
if (mutations.some((mutation) => {
|
|
19
|
+
var _a;
|
|
20
|
+
const attr = mutation.target.attributes.getNamedItem((_a = mutation.attributeName) !== null && _a !== void 0 ? _a : "");
|
|
21
|
+
return (attr === null || attr === void 0 ? void 0 : attr.value) !== mutation.oldValue;
|
|
22
|
+
})) {
|
|
23
|
+
this.enableAttributePassing(element, "db-table-caption");
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
this.observer.observe(parent, {
|
|
27
|
+
attributes: true,
|
|
28
|
+
attributeOldValue: true,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
8
31
|
/**
|
|
9
32
|
* Passes `aria-*`, `data-*` & `class` attributes to correct child. Used in angular and stencil.
|
|
10
33
|
* @param element the ref for the component
|
|
@@ -18,10 +41,15 @@ export class DBTableCaption {
|
|
|
18
41
|
const attr = attributes.item(i);
|
|
19
42
|
if (attr && attr.name !== 'data-density' &&
|
|
20
43
|
(attr.name.startsWith("data-") || attr.name.startsWith("aria-"))) {
|
|
21
|
-
|
|
44
|
+
if (attr.value) {
|
|
45
|
+
element.setAttribute(attr.name, attr.value);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
element.removeAttribute(attr.name);
|
|
49
|
+
}
|
|
22
50
|
parent.removeAttribute(attr.name);
|
|
23
51
|
}
|
|
24
|
-
else if (attr &&
|
|
52
|
+
else if (attr && ["style"].includes(attr.name)) {
|
|
25
53
|
element.setAttribute(attr.name, attr.value);
|
|
26
54
|
parent.removeAttribute(attr.name);
|
|
27
55
|
}
|
|
@@ -29,7 +57,7 @@ export class DBTableCaption {
|
|
|
29
57
|
const isWebComponent = attr.value.includes("hydrated");
|
|
30
58
|
const value = attr.value.replace("hydrated", "").trim();
|
|
31
59
|
const currentClass = element.getAttribute("class");
|
|
32
|
-
element.setAttribute(attr.name, `${currentClass ?
|
|
60
|
+
element.setAttribute(attr.name, `${currentClass ? currentClass : ""}${value ? ` ${value}` : ""}`);
|
|
33
61
|
if (isWebComponent) {
|
|
34
62
|
// Stencil is using this class for lazy loading component
|
|
35
63
|
parent.setAttribute("class", "hydrated");
|
|
@@ -49,11 +77,16 @@ export class DBTableCaption {
|
|
|
49
77
|
}
|
|
50
78
|
}
|
|
51
79
|
this.enableAttributePassing(this._ref, "db-table-caption");
|
|
80
|
+
this.setupObserver(this._ref);
|
|
81
|
+
}
|
|
82
|
+
disconnectedCallback() {
|
|
83
|
+
var _a;
|
|
84
|
+
(_a = this.observer) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
52
85
|
}
|
|
53
86
|
render() {
|
|
54
|
-
return (h("caption", { key: '
|
|
87
|
+
return (h("caption", { key: '5ef3476c6c9879f1fcf8548e11bea82516bd29d1', class: cls("db-table-caption", this.className), ref: (el) => {
|
|
55
88
|
this._ref = el;
|
|
56
|
-
}, id: this.id }, h("slot", { key: '
|
|
89
|
+
}, id: this.id }, h("slot", { key: 'e20d1d699e7ab50422c0d40bdf058c8863ae4991' })));
|
|
57
90
|
}
|
|
58
91
|
static get is() { return "db-table-caption"; }
|
|
59
92
|
static get properties() {
|
|
@@ -112,5 +145,10 @@ export class DBTableCaption {
|
|
|
112
145
|
}
|
|
113
146
|
};
|
|
114
147
|
}
|
|
148
|
+
static get states() {
|
|
149
|
+
return {
|
|
150
|
+
"observer": {}
|
|
151
|
+
};
|
|
152
|
+
}
|
|
115
153
|
static get elementRef() { return "rootElement"; }
|
|
116
154
|
}
|
|
@@ -18,10 +18,15 @@ export class DBTableDataCell {
|
|
|
18
18
|
const attr = attributes.item(i);
|
|
19
19
|
if (attr && attr.name !== 'data-density' &&
|
|
20
20
|
(attr.name.startsWith("data-") || attr.name.startsWith("aria-"))) {
|
|
21
|
-
|
|
21
|
+
if (attr.value) {
|
|
22
|
+
element.setAttribute(attr.name, attr.value);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
element.removeAttribute(attr.name);
|
|
26
|
+
}
|
|
22
27
|
parent.removeAttribute(attr.name);
|
|
23
28
|
}
|
|
24
|
-
else if (attr &&
|
|
29
|
+
else if (attr && ["style"].includes(attr.name)) {
|
|
25
30
|
element.setAttribute(attr.name, attr.value);
|
|
26
31
|
parent.removeAttribute(attr.name);
|
|
27
32
|
}
|
|
@@ -29,7 +34,7 @@ export class DBTableDataCell {
|
|
|
29
34
|
const isWebComponent = attr.value.includes("hydrated");
|
|
30
35
|
const value = attr.value.replace("hydrated", "").trim();
|
|
31
36
|
const currentClass = element.getAttribute("class");
|
|
32
|
-
element.setAttribute(attr.name, `${currentClass ?
|
|
37
|
+
element.setAttribute(attr.name, `${currentClass ? currentClass : ""}${value ? ` ${value}` : ""}`);
|
|
33
38
|
if (isWebComponent) {
|
|
34
39
|
// Stencil is using this class for lazy loading component
|
|
35
40
|
parent.setAttribute("class", "hydrated");
|
|
@@ -51,9 +56,9 @@ export class DBTableDataCell {
|
|
|
51
56
|
this.enableAttributePassing(this._ref, "db-table-data-cell");
|
|
52
57
|
}
|
|
53
58
|
render() {
|
|
54
|
-
return (h("td", { key: '
|
|
59
|
+
return (h("td", { key: 'e6614ac09ac484540ad119f807bea075521419cd', class: cls("db-table-data-cell", this.className), ref: (el) => {
|
|
55
60
|
this._ref = el;
|
|
56
|
-
}, id: this.id, "data-horizontal-alignment": this.horizontalAlignment, "data-vertical-alignment": this.verticalAlignment, colSpan: getNumber(this.colSpan, this.colspan), rowSpan: getNumber(this.rowSpan, this.rowspan), headers: this.headers }, h("slot", { key: '
|
|
61
|
+
}, id: this.id, "data-horizontal-alignment": this.horizontalAlignment, "data-vertical-alignment": this.verticalAlignment, colSpan: getNumber(this.colSpan, this.colspan), rowSpan: getNumber(this.rowSpan, this.rowspan), headers: this.headers }, h("slot", { key: 'bd353375cc862b5d5adea84545a5b5a63f1517e1' })));
|
|
57
62
|
}
|
|
58
63
|
static get is() { return "db-table-data-cell"; }
|
|
59
64
|
static get properties() {
|
|
@@ -18,10 +18,15 @@ export class DBTableFooter {
|
|
|
18
18
|
const attr = attributes.item(i);
|
|
19
19
|
if (attr && attr.name !== 'data-density' &&
|
|
20
20
|
(attr.name.startsWith("data-") || attr.name.startsWith("aria-"))) {
|
|
21
|
-
|
|
21
|
+
if (attr.value) {
|
|
22
|
+
element.setAttribute(attr.name, attr.value);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
element.removeAttribute(attr.name);
|
|
26
|
+
}
|
|
22
27
|
parent.removeAttribute(attr.name);
|
|
23
28
|
}
|
|
24
|
-
else if (attr &&
|
|
29
|
+
else if (attr && ["style"].includes(attr.name)) {
|
|
25
30
|
element.setAttribute(attr.name, attr.value);
|
|
26
31
|
parent.removeAttribute(attr.name);
|
|
27
32
|
}
|
|
@@ -29,7 +34,7 @@ export class DBTableFooter {
|
|
|
29
34
|
const isWebComponent = attr.value.includes("hydrated");
|
|
30
35
|
const value = attr.value.replace("hydrated", "").trim();
|
|
31
36
|
const currentClass = element.getAttribute("class");
|
|
32
|
-
element.setAttribute(attr.name, `${currentClass ?
|
|
37
|
+
element.setAttribute(attr.name, `${currentClass ? currentClass : ""}${value ? ` ${value}` : ""}`);
|
|
33
38
|
if (isWebComponent) {
|
|
34
39
|
// Stencil is using this class for lazy loading component
|
|
35
40
|
parent.setAttribute("class", "hydrated");
|
|
@@ -52,7 +57,7 @@ export class DBTableFooter {
|
|
|
52
57
|
}
|
|
53
58
|
render() {
|
|
54
59
|
var _a;
|
|
55
|
-
return (h("tfoot", { key: '
|
|
60
|
+
return (h("tfoot", { key: '735f3ce4c1d6a3305993a8de60c797e9ce2bcd20', class: cls("db-table-footer", this.className), ref: (el) => {
|
|
56
61
|
this._ref = el;
|
|
57
62
|
}, id: this.id }, this.rows ? ((_a = this.rows) === null || _a === void 0 ? void 0 : _a.map((row, index) => {
|
|
58
63
|
var _a, _b, _c;
|
|
@@ -5,9 +5,32 @@ import { h } from "@stencil/core";
|
|
|
5
5
|
|
|
6
6
|
*/
|
|
7
7
|
export class DBTableHead {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.observer = undefined;
|
|
10
|
+
}
|
|
8
11
|
getCells(cells) {
|
|
9
12
|
return cells === null || cells === void 0 ? void 0 : cells.map((cell) => (Object.assign(Object.assign({}, cell), { headerCell: true })));
|
|
10
13
|
}
|
|
14
|
+
setupObserver(element) {
|
|
15
|
+
if (!element)
|
|
16
|
+
return;
|
|
17
|
+
const parent = element.closest("db-table-head");
|
|
18
|
+
if (!parent || this.observer)
|
|
19
|
+
return;
|
|
20
|
+
this.observer = new MutationObserver((mutations) => {
|
|
21
|
+
if (mutations.some((mutation) => {
|
|
22
|
+
var _a;
|
|
23
|
+
const attr = mutation.target.attributes.getNamedItem((_a = mutation.attributeName) !== null && _a !== void 0 ? _a : "");
|
|
24
|
+
return (attr === null || attr === void 0 ? void 0 : attr.value) !== mutation.oldValue;
|
|
25
|
+
})) {
|
|
26
|
+
this.enableAttributePassing(element, "db-table-head");
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
this.observer.observe(parent, {
|
|
30
|
+
attributes: true,
|
|
31
|
+
attributeOldValue: true,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
11
34
|
/**
|
|
12
35
|
* Passes `aria-*`, `data-*` & `class` attributes to correct child. Used in angular and stencil.
|
|
13
36
|
* @param element the ref for the component
|
|
@@ -21,10 +44,15 @@ export class DBTableHead {
|
|
|
21
44
|
const attr = attributes.item(i);
|
|
22
45
|
if (attr && attr.name !== 'data-density' &&
|
|
23
46
|
(attr.name.startsWith("data-") || attr.name.startsWith("aria-"))) {
|
|
24
|
-
|
|
47
|
+
if (attr.value) {
|
|
48
|
+
element.setAttribute(attr.name, attr.value);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
element.removeAttribute(attr.name);
|
|
52
|
+
}
|
|
25
53
|
parent.removeAttribute(attr.name);
|
|
26
54
|
}
|
|
27
|
-
else if (attr &&
|
|
55
|
+
else if (attr && ["style"].includes(attr.name)) {
|
|
28
56
|
element.setAttribute(attr.name, attr.value);
|
|
29
57
|
parent.removeAttribute(attr.name);
|
|
30
58
|
}
|
|
@@ -32,7 +60,7 @@ export class DBTableHead {
|
|
|
32
60
|
const isWebComponent = attr.value.includes("hydrated");
|
|
33
61
|
const value = attr.value.replace("hydrated", "").trim();
|
|
34
62
|
const currentClass = element.getAttribute("class");
|
|
35
|
-
element.setAttribute(attr.name, `${currentClass ?
|
|
63
|
+
element.setAttribute(attr.name, `${currentClass ? currentClass : ""}${value ? ` ${value}` : ""}`);
|
|
36
64
|
if (isWebComponent) {
|
|
37
65
|
// Stencil is using this class for lazy loading component
|
|
38
66
|
parent.setAttribute("class", "hydrated");
|
|
@@ -52,10 +80,15 @@ export class DBTableHead {
|
|
|
52
80
|
}
|
|
53
81
|
}
|
|
54
82
|
this.enableAttributePassing(this._ref, "db-table-head");
|
|
83
|
+
this.setupObserver(this._ref);
|
|
84
|
+
}
|
|
85
|
+
disconnectedCallback() {
|
|
86
|
+
var _a;
|
|
87
|
+
(_a = this.observer) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
55
88
|
}
|
|
56
89
|
render() {
|
|
57
90
|
var _a;
|
|
58
|
-
return (h("thead", { key: '
|
|
91
|
+
return (h("thead", { key: '340673440fd36e5522f70683bef5a4356f73cb69', class: cls("db-table-head", this.className), ref: (el) => {
|
|
59
92
|
this._ref = el;
|
|
60
93
|
}, id: this.id }, this.rows ? ((_a = this.rows) === null || _a === void 0 ? void 0 : _a.map((row, index) => {
|
|
61
94
|
var _a, _b, _c;
|
|
@@ -143,5 +176,10 @@ export class DBTableHead {
|
|
|
143
176
|
}
|
|
144
177
|
};
|
|
145
178
|
}
|
|
179
|
+
static get states() {
|
|
180
|
+
return {
|
|
181
|
+
"observer": {}
|
|
182
|
+
};
|
|
183
|
+
}
|
|
146
184
|
static get elementRef() { return "rootElement"; }
|
|
147
185
|
}
|
|
@@ -18,10 +18,15 @@ export class DBTableHeaderCell {
|
|
|
18
18
|
const attr = attributes.item(i);
|
|
19
19
|
if (attr && attr.name !== 'data-density' &&
|
|
20
20
|
(attr.name.startsWith("data-") || attr.name.startsWith("aria-"))) {
|
|
21
|
-
|
|
21
|
+
if (attr.value) {
|
|
22
|
+
element.setAttribute(attr.name, attr.value);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
element.removeAttribute(attr.name);
|
|
26
|
+
}
|
|
22
27
|
parent.removeAttribute(attr.name);
|
|
23
28
|
}
|
|
24
|
-
else if (attr &&
|
|
29
|
+
else if (attr && ["style"].includes(attr.name)) {
|
|
25
30
|
element.setAttribute(attr.name, attr.value);
|
|
26
31
|
parent.removeAttribute(attr.name);
|
|
27
32
|
}
|
|
@@ -29,7 +34,7 @@ export class DBTableHeaderCell {
|
|
|
29
34
|
const isWebComponent = attr.value.includes("hydrated");
|
|
30
35
|
const value = attr.value.replace("hydrated", "").trim();
|
|
31
36
|
const currentClass = element.getAttribute("class");
|
|
32
|
-
element.setAttribute(attr.name, `${currentClass ?
|
|
37
|
+
element.setAttribute(attr.name, `${currentClass ? currentClass : ""}${value ? ` ${value}` : ""}`);
|
|
33
38
|
if (isWebComponent) {
|
|
34
39
|
// Stencil is using this class for lazy loading component
|
|
35
40
|
parent.setAttribute("class", "hydrated");
|
|
@@ -51,9 +56,9 @@ export class DBTableHeaderCell {
|
|
|
51
56
|
this.enableAttributePassing(this._ref, "db-table-header-cell");
|
|
52
57
|
}
|
|
53
58
|
render() {
|
|
54
|
-
return (h("th", { key: '
|
|
59
|
+
return (h("th", { key: 'b459f2e2ea9b4dda6909d1c8f02e1cd22b16a712', class: cls("db-table-header-cell", this.className), ref: (el) => {
|
|
55
60
|
this._ref = el;
|
|
56
|
-
}, id: this.id, "data-horizontal-alignment": this.horizontalAlignment, "data-vertical-alignment": this.verticalAlignment, "data-no-text": getBooleanAsString(this.noText), scope: this.scope, colSpan: getNumber(this.colSpan, this.colspan), rowSpan: getNumber(this.rowSpan, this.rowspan), headers: this.headers, abbr: this.abbr }, h("slot", { key: '
|
|
61
|
+
}, id: this.id, "data-horizontal-alignment": this.horizontalAlignment, "data-vertical-alignment": this.verticalAlignment, "data-no-text": getBooleanAsString(this.noText), scope: this.scope, colSpan: getNumber(this.colSpan, this.colspan), rowSpan: getNumber(this.rowSpan, this.rowspan), headers: this.headers, abbr: this.abbr }, h("slot", { key: 'ec650ba68a8623b9729985f27822d94087327d74' })));
|
|
57
62
|
}
|
|
58
63
|
static get is() { return "db-table-header-cell"; }
|
|
59
64
|
static get properties() {
|
|
@@ -24,10 +24,15 @@ export class DBTableRow {
|
|
|
24
24
|
const attr = attributes.item(i);
|
|
25
25
|
if (attr && attr.name !== 'data-density' &&
|
|
26
26
|
(attr.name.startsWith("data-") || attr.name.startsWith("aria-"))) {
|
|
27
|
-
|
|
27
|
+
if (attr.value) {
|
|
28
|
+
element.setAttribute(attr.name, attr.value);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
element.removeAttribute(attr.name);
|
|
32
|
+
}
|
|
28
33
|
parent.removeAttribute(attr.name);
|
|
29
34
|
}
|
|
30
|
-
else if (attr &&
|
|
35
|
+
else if (attr && ["style"].includes(attr.name)) {
|
|
31
36
|
element.setAttribute(attr.name, attr.value);
|
|
32
37
|
parent.removeAttribute(attr.name);
|
|
33
38
|
}
|
|
@@ -35,7 +40,7 @@ export class DBTableRow {
|
|
|
35
40
|
const isWebComponent = attr.value.includes("hydrated");
|
|
36
41
|
const value = attr.value.replace("hydrated", "").trim();
|
|
37
42
|
const currentClass = element.getAttribute("class");
|
|
38
|
-
element.setAttribute(attr.name, `${currentClass ?
|
|
43
|
+
element.setAttribute(attr.name, `${currentClass ? currentClass : ""}${value ? ` ${value}` : ""}`);
|
|
39
44
|
if (isWebComponent) {
|
|
40
45
|
// Stencil is using this class for lazy loading component
|
|
41
46
|
parent.setAttribute("class", "hydrated");
|
|
@@ -58,7 +63,7 @@ export class DBTableRow {
|
|
|
58
63
|
}
|
|
59
64
|
render() {
|
|
60
65
|
var _a;
|
|
61
|
-
return (h("tr", { key: '
|
|
66
|
+
return (h("tr", { key: 'd9ca9f14117c8cf3974110eb1a36cb7352c06c24', class: cls("db-table-row", this.className), ref: (el) => {
|
|
62
67
|
this._ref = el;
|
|
63
68
|
}, id: this.id, "data-interactive": getBooleanAsString(this.interactive), "data-sub-header-emphasis": this.subHeaderEmphasis }, this.cells ? ((_a = this.cells) === null || _a === void 0 ? void 0 : _a.map((cell, index) => {
|
|
64
69
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22;
|
|
@@ -12,6 +12,7 @@ export class DBTabs {
|
|
|
12
12
|
this.showScrollRight = false;
|
|
13
13
|
this.scrollContainer = null;
|
|
14
14
|
this._resizeObserver = undefined;
|
|
15
|
+
this.observer = undefined;
|
|
15
16
|
}
|
|
16
17
|
convertTabs() {
|
|
17
18
|
try {
|
|
@@ -132,6 +133,26 @@ export class DBTabs {
|
|
|
132
133
|
}
|
|
133
134
|
}
|
|
134
135
|
}
|
|
136
|
+
setupObserver(element) {
|
|
137
|
+
if (!element)
|
|
138
|
+
return;
|
|
139
|
+
const parent = element.closest("db-tabs");
|
|
140
|
+
if (!parent || this.observer)
|
|
141
|
+
return;
|
|
142
|
+
this.observer = new MutationObserver((mutations) => {
|
|
143
|
+
if (mutations.some((mutation) => {
|
|
144
|
+
var _a;
|
|
145
|
+
const attr = mutation.target.attributes.getNamedItem((_a = mutation.attributeName) !== null && _a !== void 0 ? _a : "");
|
|
146
|
+
return (attr === null || attr === void 0 ? void 0 : attr.value) !== mutation.oldValue;
|
|
147
|
+
})) {
|
|
148
|
+
this.enableAttributePassing(element, "db-tabs");
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
this.observer.observe(parent, {
|
|
152
|
+
attributes: true,
|
|
153
|
+
attributeOldValue: true,
|
|
154
|
+
});
|
|
155
|
+
}
|
|
135
156
|
/**
|
|
136
157
|
* Passes `aria-*`, `data-*` & `class` attributes to correct child. Used in angular and stencil.
|
|
137
158
|
* @param element the ref for the component
|
|
@@ -145,10 +166,15 @@ export class DBTabs {
|
|
|
145
166
|
const attr = attributes.item(i);
|
|
146
167
|
if (attr && attr.name !== 'data-density' &&
|
|
147
168
|
(attr.name.startsWith("data-") || attr.name.startsWith("aria-"))) {
|
|
148
|
-
|
|
169
|
+
if (attr.value) {
|
|
170
|
+
element.setAttribute(attr.name, attr.value);
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
element.removeAttribute(attr.name);
|
|
174
|
+
}
|
|
149
175
|
parent.removeAttribute(attr.name);
|
|
150
176
|
}
|
|
151
|
-
else if (attr &&
|
|
177
|
+
else if (attr && ["style"].includes(attr.name)) {
|
|
152
178
|
element.setAttribute(attr.name, attr.value);
|
|
153
179
|
parent.removeAttribute(attr.name);
|
|
154
180
|
}
|
|
@@ -156,7 +182,7 @@ export class DBTabs {
|
|
|
156
182
|
const isWebComponent = attr.value.includes("hydrated");
|
|
157
183
|
const value = attr.value.replace("hydrated", "").trim();
|
|
158
184
|
const currentClass = element.getAttribute("class");
|
|
159
|
-
element.setAttribute(attr.name, `${currentClass ?
|
|
185
|
+
element.setAttribute(attr.name, `${currentClass ? currentClass : ""}${value ? ` ${value}` : ""}`);
|
|
160
186
|
if (isWebComponent) {
|
|
161
187
|
// Stencil is using this class for lazy loading component
|
|
162
188
|
parent.setAttribute("class", "hydrated");
|
|
@@ -201,21 +227,29 @@ export class DBTabs {
|
|
|
201
227
|
}
|
|
202
228
|
}
|
|
203
229
|
this.enableAttributePassing(this._ref, "db-tabs");
|
|
204
|
-
|
|
205
|
-
|
|
230
|
+
const onMountHook_0 = () => {
|
|
231
|
+
this._name = `tabs-${this.name || uuid()}`;
|
|
232
|
+
this.initialized = true;
|
|
233
|
+
};
|
|
234
|
+
onMountHook_0();
|
|
235
|
+
const onMountHook_1 = () => {
|
|
236
|
+
this.setupObserver(this._ref);
|
|
237
|
+
};
|
|
238
|
+
onMountHook_1();
|
|
206
239
|
this.watch0Fn();
|
|
207
240
|
}
|
|
208
241
|
disconnectedCallback() {
|
|
209
|
-
var _a;
|
|
242
|
+
var _a, _b;
|
|
210
243
|
(_a = this._resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
211
244
|
this._resizeObserver = undefined;
|
|
245
|
+
(_b = this.observer) === null || _b === void 0 ? void 0 : _b.disconnect();
|
|
212
246
|
}
|
|
213
247
|
render() {
|
|
214
248
|
var _a, _b, _c, _d, _e, _f;
|
|
215
|
-
return (h("div", { key: '
|
|
249
|
+
return (h("div", { key: 'aca0d156b8d50c5951a982e5ab35d2644b4989e7', class: cls("db-tabs", this.className), ref: (el) => {
|
|
216
250
|
this._ref = el;
|
|
217
251
|
}, id: (_a = this.id) !== null && _a !== void 0 ? _a : (_b = this.propOverrides) === null || _b === void 0 ? void 0 : _b.id, "data-orientation": this.orientation, "data-scroll-behavior": this.behavior, "data-alignment": (_c = this.alignment) !== null && _c !== void 0 ? _c : "start", "data-width": (_d = this.width) !== null && _d !== void 0 ? _d : "auto", onInput: (event) => this.handleChange(event), onChange: (event) => this.handleChange(event) }, this.showScrollLeft ? (h("db-button", { class: "tabs-scroll-left", variant: "ghost", icon: "chevron_left", type: "button", noText: true, onClick: () => this.scroll(true) }, "Scroll left")) : null, this.tabs ? (h(Fragment, null, h("db-tab-list", null, (_e = this.convertTabs()) === null || _e === void 0 ? void 0 : _e.map((tab, index) => (h("db-tab-item", { key: this.name + "tab-item" + index, active: tab.active, label: tab.label, iconTrailing: tab.iconTrailing, icon: tab.icon, noText: tab.noText })))), (_f = this.convertTabs()) === null || _f === void 0 ? void 0 :
|
|
218
|
-
_f.map((tab, index) => (h("db-tab-panel", { key: this.name + "tab-panel" + index, content: tab.content }, tab.children))))) : null, this.showScrollRight ? (h("db-button", { class: "tabs-scroll-right", variant: "ghost", icon: "chevron_right", type: "button", noText: true, onClick: () => this.scroll() }, "Scroll right")) : null, h("slot", { key: '
|
|
252
|
+
_f.map((tab, index) => (h("db-tab-panel", { key: this.name + "tab-panel" + index, content: tab.content }, tab.children))))) : null, this.showScrollRight ? (h("db-button", { class: "tabs-scroll-right", variant: "ghost", icon: "chevron_right", type: "button", noText: true, onClick: () => this.scroll() }, "Scroll right")) : null, h("slot", { key: 'b05907467917bb82f9ef6b9ce3774e52411fb822' })));
|
|
219
253
|
}
|
|
220
254
|
static get is() { return "db-tabs"; }
|
|
221
255
|
static get properties() {
|
|
@@ -539,7 +573,8 @@ export class DBTabs {
|
|
|
539
573
|
"showScrollLeft": {},
|
|
540
574
|
"showScrollRight": {},
|
|
541
575
|
"scrollContainer": {},
|
|
542
|
-
"_resizeObserver": {}
|
|
576
|
+
"_resizeObserver": {},
|
|
577
|
+
"observer": {}
|
|
543
578
|
};
|
|
544
579
|
}
|
|
545
580
|
static get events() {
|
|
@@ -6,6 +6,9 @@ import { h } from "@stencil/core";
|
|
|
6
6
|
* @slot content - TODO: Add description for slotContent
|
|
7
7
|
*/
|
|
8
8
|
export class DBTag {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.observer = undefined;
|
|
11
|
+
}
|
|
9
12
|
handleRemove(event) {
|
|
10
13
|
if (!event)
|
|
11
14
|
return;
|
|
@@ -21,6 +24,26 @@ export class DBTag {
|
|
|
21
24
|
// TODO: We should think this through again, if we would really like to have default and especially english, instead of german labels in here
|
|
22
25
|
return DEFAULT_REMOVE;
|
|
23
26
|
}
|
|
27
|
+
setupObserver(element) {
|
|
28
|
+
if (!element)
|
|
29
|
+
return;
|
|
30
|
+
const parent = element.closest("db-tag");
|
|
31
|
+
if (!parent || this.observer)
|
|
32
|
+
return;
|
|
33
|
+
this.observer = new MutationObserver((mutations) => {
|
|
34
|
+
if (mutations.some((mutation) => {
|
|
35
|
+
var _a;
|
|
36
|
+
const attr = mutation.target.attributes.getNamedItem((_a = mutation.attributeName) !== null && _a !== void 0 ? _a : "");
|
|
37
|
+
return (attr === null || attr === void 0 ? void 0 : attr.value) !== mutation.oldValue;
|
|
38
|
+
})) {
|
|
39
|
+
this.enableAttributePassing(element, "db-tag");
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
this.observer.observe(parent, {
|
|
43
|
+
attributes: true,
|
|
44
|
+
attributeOldValue: true,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
24
47
|
/**
|
|
25
48
|
* Passes `aria-*`, `data-*` & `class` attributes to correct child. Used in angular and stencil.
|
|
26
49
|
* @param element the ref for the component
|
|
@@ -34,10 +57,15 @@ export class DBTag {
|
|
|
34
57
|
const attr = attributes.item(i);
|
|
35
58
|
if (attr && attr.name !== 'data-density' &&
|
|
36
59
|
(attr.name.startsWith("data-") || attr.name.startsWith("aria-"))) {
|
|
37
|
-
|
|
60
|
+
if (attr.value) {
|
|
61
|
+
element.setAttribute(attr.name, attr.value);
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
element.removeAttribute(attr.name);
|
|
65
|
+
}
|
|
38
66
|
parent.removeAttribute(attr.name);
|
|
39
67
|
}
|
|
40
|
-
else if (attr &&
|
|
68
|
+
else if (attr && ["style"].includes(attr.name)) {
|
|
41
69
|
element.setAttribute(attr.name, attr.value);
|
|
42
70
|
parent.removeAttribute(attr.name);
|
|
43
71
|
}
|
|
@@ -45,7 +73,7 @@ export class DBTag {
|
|
|
45
73
|
const isWebComponent = attr.value.includes("hydrated");
|
|
46
74
|
const value = attr.value.replace("hydrated", "").trim();
|
|
47
75
|
const currentClass = element.getAttribute("class");
|
|
48
|
-
element.setAttribute(attr.name, `${currentClass ?
|
|
76
|
+
element.setAttribute(attr.name, `${currentClass ? currentClass : ""}${value ? ` ${value}` : ""}`);
|
|
49
77
|
if (isWebComponent) {
|
|
50
78
|
// Stencil is using this class for lazy loading component
|
|
51
79
|
parent.setAttribute("class", "hydrated");
|
|
@@ -65,12 +93,17 @@ export class DBTag {
|
|
|
65
93
|
}
|
|
66
94
|
}
|
|
67
95
|
this.enableAttributePassing(this._ref, "db-tag");
|
|
96
|
+
this.setupObserver(this._ref);
|
|
97
|
+
}
|
|
98
|
+
disconnectedCallback() {
|
|
99
|
+
var _a;
|
|
100
|
+
(_a = this.observer) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
68
101
|
}
|
|
69
102
|
render() {
|
|
70
103
|
var _a, _b, _c;
|
|
71
|
-
return (h("div", { key: '
|
|
104
|
+
return (h("div", { key: '22654726ea465c2b07942705dfcf72162c11e314', class: cls("db-tag", this.className), ref: (el) => {
|
|
72
105
|
this._ref = el;
|
|
73
|
-
}, id: (_a = this.id) !== null && _a !== void 0 ? _a : (_b = this.propOverrides) === null || _b === void 0 ? void 0 : _b.id, "data-semantic": this.semantic, "data-emphasis": this.emphasis, "data-icon": this.icon, "data-show-check-state": getBooleanAsString((_c = this.showCheckState) !== null && _c !== void 0 ? _c : true, "showCheckState"), "data-show-icon": getBooleanAsString(this.showIcon, "showIcon"), "data-no-text": getBooleanAsString(this.noText, "noText"), "data-overflow": getBooleanAsString(this.overflow, "overflow") }, h("slot", { key: '
|
|
106
|
+
}, id: (_a = this.id) !== null && _a !== void 0 ? _a : (_b = this.propOverrides) === null || _b === void 0 ? void 0 : _b.id, "data-semantic": this.semantic, "data-emphasis": this.emphasis, "data-icon": this.icon, "data-show-check-state": getBooleanAsString((_c = this.showCheckState) !== null && _c !== void 0 ? _c : true, "showCheckState"), "data-show-icon": getBooleanAsString(this.showIcon, "showIcon"), "data-no-text": getBooleanAsString(this.noText, "noText"), "data-overflow": getBooleanAsString(this.overflow, "overflow") }, h("slot", { key: '284aa3b6bce1595939f667e8a511319879545e27', name: "content" }), this.text ? this.text : null, h("slot", { key: '7471ead10bf5f95654444020e6b76d0b2f64486b' }), this.behavior === "removable" ? (h("button", { class: "db-button db-tab-remove-button", "data-icon": "cross", "data-size": "small", "data-no-text": "true", "data-variant": "ghost", type: "button", onClick: (event) => this.handleRemove(event) }, h("db-tooltip", { variant: "label" }, this.getRemoveButtonText()))) : null));
|
|
74
107
|
}
|
|
75
108
|
static get is() { return "db-tag"; }
|
|
76
109
|
static get properties() {
|
|
@@ -413,6 +446,11 @@ export class DBTag {
|
|
|
413
446
|
}
|
|
414
447
|
};
|
|
415
448
|
}
|
|
449
|
+
static get states() {
|
|
450
|
+
return {
|
|
451
|
+
"observer": {}
|
|
452
|
+
};
|
|
453
|
+
}
|
|
416
454
|
static get events() {
|
|
417
455
|
return [{
|
|
418
456
|
"method": "remove",
|