@sellmate/design-system 1.0.40 → 1.0.42
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/dist/cjs/component.textinput-43trvZ5m.js +41 -0
- package/dist/cjs/design-system.cjs.js +1 -1
- package/dist/cjs/index.cjs.js +0 -9
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/sd-barcode-input.cjs.entry.js +162 -0
- package/dist/cjs/sd-button-v2_2.cjs.entry.js +4 -4
- package/dist/cjs/sd-button_20.cjs.entry.js +44 -69
- package/dist/cjs/sd-card.cjs.entry.js +1 -1
- package/dist/cjs/sd-confirm-modal.cjs.entry.js +124 -0
- package/dist/cjs/sd-date-picker.cjs.entry.js +1 -1
- package/dist/cjs/sd-dropdown-button.cjs.entry.js +3 -3
- package/dist/cjs/sd-file-picker.cjs.entry.js +3 -3
- package/dist/cjs/sd-guide.cjs.entry.js +2 -2
- package/dist/cjs/sd-modal-container.cjs.entry.js +17 -73
- package/dist/cjs/sd-popover.cjs.entry.js +10 -2
- package/dist/cjs/sd-progress.cjs.entry.js +2 -2
- package/dist/cjs/sd-select-group.cjs.entry.js +1 -1
- package/dist/cjs/sd-select-multiple.cjs.entry.js +1 -1
- package/dist/cjs/sd-select-option-group.cjs.entry.js +3 -3
- package/dist/cjs/sd-select-v2-list-item_2.cjs.entry.js +7 -16
- package/dist/cjs/sd-select-v2-listbox_2.cjs.entry.js +181 -14
- package/dist/cjs/sd-select-v2.cjs.entry.js +13 -21
- package/dist/cjs/{sd-select-v2.config-DZrPJ6OS.js → sd-select-v2.config-BJXi4hMP.js} +12 -7
- package/dist/cjs/sd-text-link.cjs.entry.js +3 -3
- package/dist/cjs/sd-toast-container.cjs.entry.js +1 -1
- package/dist/cjs/sd-toast.cjs.entry.js +2 -2
- package/dist/cjs/sd-toggle-button.cjs.entry.js +1 -1
- package/dist/cjs/sd-toggle.cjs.entry.js +1 -1
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/sd-barcode-input/sd-barcode-input.config.js +34 -0
- package/dist/collection/components/sd-barcode-input/sd-barcode-input.css +72 -0
- package/dist/collection/components/sd-barcode-input/sd-barcode-input.js +750 -0
- package/dist/collection/components/sd-button-v2/sd-button-v2.js +2 -2
- package/dist/collection/components/sd-card/sd-card.js +1 -1
- package/dist/collection/components/sd-confirm-modal/sd-confirm-modal.config.js +4 -1
- package/dist/collection/components/sd-confirm-modal/sd-confirm-modal.css +17 -17
- package/dist/collection/components/sd-confirm-modal/sd-confirm-modal.js +7 -7
- package/dist/collection/components/sd-date-picker/sd-date-picker.js +1 -1
- package/dist/collection/components/sd-date-range-picker/sd-date-range-picker.js +4 -4
- package/dist/collection/components/sd-dropdown-button/sd-dropdown-button.js +3 -3
- package/dist/collection/components/sd-field/sd-field.js +4 -3
- package/dist/collection/components/sd-file-picker/sd-file-picker.js +3 -3
- package/dist/collection/components/sd-floating-portal/sd-floating-portal.js +1 -1
- package/dist/collection/components/sd-guide/sd-guide.js +2 -2
- package/dist/collection/components/sd-icon/sd-icon.js +1 -1
- package/dist/collection/components/sd-input/sd-input.js +2 -2
- package/dist/collection/components/sd-loading-spinner/sd-loading-spinner.js +1 -1
- package/dist/collection/components/sd-modal-container/sd-modal-container.js +19 -118
- package/dist/collection/components/sd-number-input/sd-number-input.js +4 -4
- package/dist/collection/components/sd-pagination/sd-pagination.js +2 -2
- package/dist/collection/components/sd-popover/sd-popover.js +10 -2
- package/dist/collection/components/sd-portal/sd-portal.js +1 -1
- package/dist/collection/components/sd-progress/sd-progress.js +2 -2
- package/dist/collection/components/sd-select/sd-select-dropdown/sd-select-dropdown.js +2 -2
- package/dist/collection/components/sd-select/sd-select-option/sd-select-option.js +1 -1
- package/dist/collection/components/sd-select/sd-select-search-input/sd-select-search-input.js +3 -3
- package/dist/collection/components/sd-select-group/sd-select-group.js +1 -1
- package/dist/collection/components/sd-select-multiple/sd-select-multiple.js +1 -1
- package/dist/collection/components/sd-select-multiple-group/sd-select-option-group/sd-select-option-group.js +3 -3
- package/dist/collection/components/sd-select-v2/sd-select-v2-list-item/sd-select-v2-list-item.css +6 -6
- package/dist/collection/components/sd-select-v2/sd-select-v2-list-item/sd-select-v2-list-item.js +2 -2
- package/dist/collection/components/sd-select-v2/sd-select-v2-list-item-search/sd-select-v2-list-item-search.js +3 -12
- package/dist/collection/components/sd-select-v2/sd-select-v2-listbox/sd-select-v2-listbox.css +1 -0
- package/dist/collection/components/sd-select-v2/sd-select-v2-listbox/sd-select-v2-listbox.js +185 -16
- package/dist/collection/components/sd-select-v2/sd-select-v2-trigger/sd-select-v2-trigger.js +2 -2
- package/dist/collection/components/sd-select-v2/sd-select-v2.config.js +12 -7
- package/dist/collection/components/sd-select-v2/sd-select-v2.js +13 -21
- package/dist/collection/components/sd-tag/sd-tag.js +2 -2
- package/dist/collection/components/sd-text-link/sd-text-link.js +3 -3
- package/dist/collection/components/sd-textarea/sd-textarea.js +2 -2
- package/dist/collection/components/sd-toast/sd-toast.js +2 -2
- package/dist/collection/components/sd-toast-container/sd-toast-container.js +1 -1
- package/dist/collection/components/sd-toggle/sd-toggle.js +1 -1
- package/dist/collection/components/sd-toggle-button/sd-toggle-button.js +1 -1
- package/dist/collection/components/sd-tooltip/sd-tooltip.js +10 -2
- package/dist/collection/utils/modal.js +0 -9
- package/dist/components/index.js +1 -1
- package/dist/components/{p-8oyZJ0FK.js → p-6FZWkn3V.js} +1 -1
- package/dist/components/p-AfdVu7_V.js +1 -0
- package/dist/components/{p-PcxVERcm.js → p-B2IPxQNl.js} +1 -1
- package/dist/components/{p-DBCQtIY4.js → p-BBKrHUCP.js} +1 -1
- package/dist/components/{p-A5atk1St.js → p-BKtAiyh0.js} +1 -1
- package/dist/components/{p-5UN9Ry8A.js → p-BXuZFSsU.js} +1 -1
- package/dist/components/{p-CZN_I4v-.js → p-BZJDhQ6h.js} +1 -1
- package/dist/components/{p-CKi7RueC.js → p-BfqA9RSe.js} +1 -1
- package/dist/components/{p-2JXqy61T.js → p-Bo7U7jA2.js} +1 -1
- package/dist/components/{p-VztCEgcN.js → p-C7dgr7sG.js} +1 -1
- package/dist/components/p-CArAuWdh.js +1 -0
- package/dist/components/{p-vznqVg6E.js → p-CPr3lzac.js} +1 -1
- package/dist/components/{p-DEBuE-pW.js → p-CV1qJByG.js} +1 -1
- package/dist/components/p-CXjMXCNh.js +1 -0
- package/dist/components/p-CbjDAdZ_.js +1 -0
- package/dist/components/p-CnZPI5RL.js +1 -0
- package/dist/components/{p-du_AmhYu.js → p-CrJXDjO0.js} +1 -1
- package/dist/components/{p-DtCG-y6d.js → p-Cx2K_zB2.js} +1 -1
- package/dist/components/{p-CJZIwyH-.js → p-D3H3ILJG.js} +1 -1
- package/dist/components/{p-BNNjhCQc.js → p-DgDoP1wQ.js} +1 -1
- package/dist/components/{p-DPjPJkXv.js → p-DvQzT5XM.js} +1 -1
- package/dist/components/{p-CjZTu6hh.js → p-UaMNiu8y.js} +1 -1
- package/dist/components/p-gHb970iC.js +1 -0
- package/dist/components/p-jaHdAlr9.js +1 -0
- package/dist/components/{p-Ese2dRYD.js → p-jk3tAdJg.js} +1 -1
- package/dist/components/p-qbtTff3q.js +1 -0
- package/dist/components/{sd-notice-modal.d.ts → sd-barcode-input.d.ts} +4 -4
- package/dist/components/sd-barcode-input.js +1 -0
- package/dist/components/sd-button-v2.js +1 -1
- package/dist/components/sd-button.js +1 -1
- package/dist/components/sd-calendar.js +1 -1
- package/dist/components/sd-card.js +1 -1
- package/dist/components/sd-checkbox.js +1 -1
- package/dist/components/sd-confirm-modal.js +1 -1
- package/dist/components/sd-date-picker.js +1 -1
- package/dist/components/sd-date-range-picker.js +1 -1
- package/dist/components/sd-dropdown-button.js +1 -1
- package/dist/components/sd-field.js +1 -1
- package/dist/components/sd-file-picker.js +1 -1
- package/dist/components/sd-floating-portal.js +1 -1
- package/dist/components/sd-guide.js +1 -1
- package/dist/components/sd-icon.js +1 -1
- package/dist/components/sd-input.js +1 -1
- package/dist/components/sd-loading-spinner.js +1 -1
- package/dist/components/sd-modal-container.js +1 -1
- package/dist/components/sd-number-input.js +1 -1
- package/dist/components/sd-pagination.js +1 -1
- package/dist/components/sd-popover.js +1 -1
- package/dist/components/sd-portal.js +1 -1
- package/dist/components/sd-progress.js +1 -1
- package/dist/components/sd-select-dropdown.js +1 -1
- package/dist/components/sd-select-group.js +1 -1
- package/dist/components/sd-select-multiple-group.js +1 -1
- package/dist/components/sd-select-multiple.js +1 -1
- package/dist/components/sd-select-option-group.js +1 -1
- package/dist/components/sd-select-option.js +1 -1
- package/dist/components/sd-select-search-input.js +1 -1
- package/dist/components/sd-select-v2-list-item-search.js +1 -1
- package/dist/components/sd-select-v2-list-item.js +1 -1
- package/dist/components/sd-select-v2-listbox.js +1 -1
- package/dist/components/sd-select-v2-trigger.js +1 -1
- package/dist/components/sd-select-v2.js +1 -1
- package/dist/components/sd-select.js +1 -1
- package/dist/components/sd-table.js +1 -1
- package/dist/components/sd-tabs.js +1 -1
- package/dist/components/sd-tag.js +1 -1
- package/dist/components/sd-text-link.js +1 -1
- package/dist/components/sd-textarea.js +1 -1
- package/dist/components/sd-toast-container.js +1 -1
- package/dist/components/sd-toast.js +1 -1
- package/dist/components/sd-toggle-button.js +1 -1
- package/dist/components/sd-toggle.js +1 -1
- package/dist/components/sd-tooltip.js +1 -1
- package/dist/design-system/design-system.css +1 -1
- package/dist/design-system/design-system.esm.js +1 -1
- package/dist/design-system/index.esm.js +1 -1
- package/dist/design-system/p-0174f3c5.entry.js +1 -0
- package/dist/design-system/{p-8e0cc9be.entry.js → p-0dee408f.entry.js} +1 -1
- package/dist/design-system/{p-fb71301e.entry.js → p-4301b50d.entry.js} +1 -1
- package/dist/design-system/p-4921c569.entry.js +1 -0
- package/dist/design-system/{p-2408d1ab.entry.js → p-50b1196b.entry.js} +1 -1
- package/dist/design-system/p-535b0778.entry.js +1 -0
- package/dist/design-system/{p-7ce76a05.entry.js → p-57b1e335.entry.js} +1 -1
- package/dist/design-system/{p-6a34e6b8.entry.js → p-5ce3142c.entry.js} +1 -1
- package/dist/design-system/{p-d8b04e91.entry.js → p-634797a4.entry.js} +1 -1
- package/dist/design-system/{p-b71d0858.entry.js → p-63a43fc9.entry.js} +1 -1
- package/dist/design-system/{p-72b09ede.entry.js → p-6a371d98.entry.js} +1 -1
- package/dist/design-system/p-6db4e8c7.entry.js +1 -0
- package/dist/design-system/{p-36ba5f33.entry.js → p-7368eb09.entry.js} +1 -1
- package/dist/design-system/p-868ce552.entry.js +1 -0
- package/dist/design-system/p-9eea4660.entry.js +1 -0
- package/dist/design-system/p-CbjDAdZ_.js +1 -0
- package/dist/design-system/{p-9933475e.entry.js → p-aaf91535.entry.js} +1 -1
- package/dist/design-system/{p-e96c881f.entry.js → p-c1963b5e.entry.js} +1 -1
- package/dist/design-system/{p-63f997d7.entry.js → p-dc6246be.entry.js} +1 -1
- package/dist/design-system/p-e39687d0.entry.js +1 -0
- package/dist/design-system/p-f91f4fcc.entry.js +1 -0
- package/dist/design-system/{p-f9075737.entry.js → p-f9cf0d6f.entry.js} +1 -1
- package/dist/design-system/{p-b79756cc.entry.js → p-fdde3de0.entry.js} +1 -1
- package/dist/design-system/p-feb80c2f.entry.js +1 -0
- package/dist/design-system/{p-BOmBg3kj.js → p-o9Ugc4Ua.js} +1 -1
- package/dist/esm/component.textinput-CbjDAdZ_.js +39 -0
- package/dist/esm/design-system.js +1 -1
- package/dist/esm/index.js +0 -9
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sd-barcode-input.entry.js +160 -0
- package/dist/esm/sd-button-v2_2.entry.js +4 -4
- package/dist/esm/sd-button_20.entry.js +39 -64
- package/dist/esm/sd-card.entry.js +1 -1
- package/dist/esm/sd-confirm-modal.entry.js +122 -0
- package/dist/esm/sd-date-picker.entry.js +1 -1
- package/dist/esm/sd-dropdown-button.entry.js +3 -3
- package/dist/esm/sd-file-picker.entry.js +3 -3
- package/dist/esm/sd-guide.entry.js +2 -2
- package/dist/esm/sd-modal-container.entry.js +17 -73
- package/dist/esm/sd-popover.entry.js +10 -2
- package/dist/esm/sd-progress.entry.js +2 -2
- package/dist/esm/sd-select-group.entry.js +1 -1
- package/dist/esm/sd-select-multiple.entry.js +1 -1
- package/dist/esm/sd-select-option-group.entry.js +3 -3
- package/dist/esm/sd-select-v2-list-item_2.entry.js +7 -16
- package/dist/esm/sd-select-v2-listbox_2.entry.js +181 -14
- package/dist/esm/{sd-select-v2.config-BOmBg3kj.js → sd-select-v2.config-o9Ugc4Ua.js} +12 -7
- package/dist/esm/sd-select-v2.entry.js +13 -21
- package/dist/esm/sd-text-link.entry.js +3 -3
- package/dist/esm/sd-toast-container.entry.js +1 -1
- package/dist/esm/sd-toast.entry.js +2 -2
- package/dist/esm/sd-toggle-button.entry.js +1 -1
- package/dist/esm/sd-toggle.entry.js +1 -1
- package/dist/types/components/sd-barcode-input/sd-barcode-input.config.d.ts +38 -0
- package/dist/types/components/sd-barcode-input/sd-barcode-input.d.ts +50 -0
- package/dist/types/components/sd-confirm-modal/sd-confirm-modal.config.d.ts +4 -3
- package/dist/types/components/sd-confirm-modal/sd-confirm-modal.d.ts +1 -1
- package/dist/types/components/sd-modal-container/sd-modal-container.config.d.ts +3 -13
- package/dist/types/components/sd-modal-container/sd-modal-container.d.ts +2 -5
- package/dist/types/components/sd-popover/sd-popover.d.ts +1 -0
- package/dist/types/components/sd-select-v2/sd-select-v2-list-item-search/sd-select-v2-list-item-search.d.ts +0 -1
- package/dist/types/components/sd-select-v2/sd-select-v2-listbox/sd-select-v2-listbox.d.ts +44 -2
- package/dist/types/components/sd-select-v2/sd-select-v2.config.d.ts +4 -0
- package/dist/types/components/sd-select-v2/sd-select-v2.d.ts +0 -1
- package/dist/types/components/sd-tooltip/sd-tooltip.d.ts +1 -0
- package/dist/types/components.d.ts +249 -130
- package/dist/types/index.d.ts +1 -1
- package/dist/types/utils/modal.d.ts +3 -4
- package/hydrate/index.js +584 -368
- package/hydrate/index.mjs +584 -368
- package/package.json +1 -1
- package/dist/cjs/sd-confirm-modal_2.cjs.entry.js +0 -199
- package/dist/collection/components/sd-notice-modal/sd-notice-modal.config.js +0 -3
- package/dist/collection/components/sd-notice-modal/sd-notice-modal.css +0 -61
- package/dist/collection/components/sd-notice-modal/sd-notice-modal.js +0 -324
- package/dist/components/p-BDUKWznE.js +0 -1
- package/dist/components/p-BzfvfP0u.js +0 -1
- package/dist/components/p-C-AFCWLs.js +0 -1
- package/dist/components/p-CN-WKnUJ.js +0 -1
- package/dist/components/p-C_L-UaCP.js +0 -1
- package/dist/components/p-CrYrMUpQ.js +0 -1
- package/dist/components/p-D0PYeSW9.js +0 -1
- package/dist/components/p-DLe_Tu-I.js +0 -1
- package/dist/components/p-H9Vl4enQ.js +0 -1
- package/dist/components/sd-notice-modal.js +0 -1
- package/dist/design-system/p-10945e57.entry.js +0 -1
- package/dist/design-system/p-342f48ab.entry.js +0 -1
- package/dist/design-system/p-3ded14dc.entry.js +0 -1
- package/dist/design-system/p-951e5615.entry.js +0 -1
- package/dist/design-system/p-9c6fea35.entry.js +0 -1
- package/dist/design-system/p-9d431ea6.entry.js +0 -1
- package/dist/design-system/p-ba393cc8.entry.js +0 -1
- package/dist/design-system/p-df1f9832.entry.js +0 -1
- package/dist/esm/sd-confirm-modal_2.entry.js +0 -196
- package/dist/types/components/sd-notice-modal/sd-notice-modal.config.d.ts +0 -5
- package/dist/types/components/sd-notice-modal/sd-notice-modal.d.ts +0 -28
|
@@ -25,7 +25,7 @@ const SdModalContainer = class {
|
|
|
25
25
|
this.shakeModal(top.modalEl);
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
|
-
this.requestDismiss(top.id, '
|
|
28
|
+
this.requestDismiss(top.id, 'close');
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
async open(options, chain) {
|
|
@@ -35,33 +35,7 @@ const SdModalContainer = class {
|
|
|
35
35
|
clearTimeout(this.containerDismissTimerId);
|
|
36
36
|
this.containerDismissTimerId = undefined;
|
|
37
37
|
}
|
|
38
|
-
this.entries = [...(this.entries ?? []), { id, modalEl, chain, persistent: !!options.persistent, closing: false }];
|
|
39
|
-
this.isVisible = true;
|
|
40
|
-
// Append after the container renders, then wait until the modal can paint before starting transitions.
|
|
41
|
-
requestAnimationFrame(() => {
|
|
42
|
-
if (this.contentRef) {
|
|
43
|
-
this.contentRef.appendChild(modalEl);
|
|
44
|
-
this.waitForModalReady(modalEl).then(() => {
|
|
45
|
-
requestAnimationFrame(() => {
|
|
46
|
-
const currentEntry = (this.entries ?? []).find(item => item.id === id);
|
|
47
|
-
if (!currentEntry || currentEntry.closing || !modalEl.isConnected)
|
|
48
|
-
return;
|
|
49
|
-
this.isBackdropVisible = true;
|
|
50
|
-
modalEl.classList.add('sd-modal-container__modal--visible');
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
return id;
|
|
56
|
-
}
|
|
57
|
-
async openNotice(options, chain) {
|
|
58
|
-
const id = `modal-${++modalIdCounter}`;
|
|
59
|
-
const modalEl = this.createNoticeModal(id, options);
|
|
60
|
-
if (this.containerDismissTimerId) {
|
|
61
|
-
clearTimeout(this.containerDismissTimerId);
|
|
62
|
-
this.containerDismissTimerId = undefined;
|
|
63
|
-
}
|
|
64
|
-
this.entries = [...(this.entries ?? []), { id, modalEl, chain, persistent: !!options.persistent, closing: false }];
|
|
38
|
+
this.entries = [...(this.entries ?? []), { id, modalEl, chain, persistent: !!options.persistent, closeAction: options.closeAction ?? 'none', closing: false }];
|
|
65
39
|
this.isVisible = true;
|
|
66
40
|
requestAnimationFrame(() => {
|
|
67
41
|
if (this.contentRef) {
|
|
@@ -90,11 +64,11 @@ const SdModalContainer = class {
|
|
|
90
64
|
el.setAttribute('data-modal-id', id);
|
|
91
65
|
el.classList.add('sd-modal-container__modal');
|
|
92
66
|
this.applyProps(el, options);
|
|
93
|
-
el.addEventListener('
|
|
67
|
+
el.addEventListener('sdOk', () => {
|
|
94
68
|
this.requestDismiss(id, 'confirm');
|
|
95
69
|
});
|
|
96
70
|
el.addEventListener('sdClose', () => {
|
|
97
|
-
this.requestDismiss(id, '
|
|
71
|
+
this.requestDismiss(id, 'close');
|
|
98
72
|
});
|
|
99
73
|
return el;
|
|
100
74
|
}
|
|
@@ -127,43 +101,6 @@ const SdModalContainer = class {
|
|
|
127
101
|
if (this.hasOwnProp(options, 'tagContents'))
|
|
128
102
|
el.tagContents = options.tagContents;
|
|
129
103
|
}
|
|
130
|
-
createNoticeModal(id, options) {
|
|
131
|
-
const el = document.createElement('sd-notice-modal');
|
|
132
|
-
el.setAttribute('data-modal-id', id);
|
|
133
|
-
el.classList.add('sd-modal-container__modal');
|
|
134
|
-
this.applyNoticeProps(el, options);
|
|
135
|
-
el.addEventListener('sdConfirm', () => {
|
|
136
|
-
this.requestDismiss(id, 'confirm');
|
|
137
|
-
});
|
|
138
|
-
el.addEventListener('sdClose', () => {
|
|
139
|
-
this.requestDismiss(id, 'cancel');
|
|
140
|
-
});
|
|
141
|
-
return el;
|
|
142
|
-
}
|
|
143
|
-
applyNoticeProps(el, options) {
|
|
144
|
-
if (this.hasOwnProp(options, 'title'))
|
|
145
|
-
this.setAttr(el, 'modal-title', options.title);
|
|
146
|
-
if (this.hasOwnProp(options, 'titleClass'))
|
|
147
|
-
this.setAttr(el, 'title-class', options.titleClass);
|
|
148
|
-
if (this.hasOwnProp(options, 'mainButtonLabel')) {
|
|
149
|
-
this.setAttr(el, 'main-button-label', options.mainButtonLabel);
|
|
150
|
-
}
|
|
151
|
-
if (this.hasOwnProp(options, 'subButtonLabel')) {
|
|
152
|
-
this.setAttr(el, 'sub-button-label', options.subButtonLabel);
|
|
153
|
-
}
|
|
154
|
-
if (this.hasOwnProp(options, 'tagPreset'))
|
|
155
|
-
this.setAttr(el, 'tag-preset', options.tagPreset);
|
|
156
|
-
if (this.hasOwnProp(options, 'tagLabel'))
|
|
157
|
-
this.setAttr(el, 'tag-label', options.tagLabel);
|
|
158
|
-
if (this.hasOwnProp(options, 'slotLabel'))
|
|
159
|
-
this.setAttr(el, 'slot-label', options.slotLabel);
|
|
160
|
-
if (this.hasOwnProp(options, 'topMessage'))
|
|
161
|
-
el.topMessage = options.topMessage ?? [];
|
|
162
|
-
if (this.hasOwnProp(options, 'bottomMessage'))
|
|
163
|
-
el.bottomMessage = options.bottomMessage ?? [];
|
|
164
|
-
if (this.hasOwnProp(options, 'tagContents'))
|
|
165
|
-
el.tagContents = options.tagContents;
|
|
166
|
-
}
|
|
167
104
|
handleBackdropClick = () => {
|
|
168
105
|
const top = this.getTopEntry();
|
|
169
106
|
if (!top)
|
|
@@ -172,7 +109,7 @@ const SdModalContainer = class {
|
|
|
172
109
|
this.shakeModal(top.modalEl);
|
|
173
110
|
return;
|
|
174
111
|
}
|
|
175
|
-
this.requestDismiss(top.id, '
|
|
112
|
+
this.requestDismiss(top.id, 'close');
|
|
176
113
|
};
|
|
177
114
|
shakeModal(modalEl) {
|
|
178
115
|
const cls = 'sd-modal-container__modal--shake';
|
|
@@ -198,7 +135,6 @@ const SdModalContainer = class {
|
|
|
198
135
|
if (!entry || entry.closing)
|
|
199
136
|
return;
|
|
200
137
|
entry.modalEl.classList.remove('sd-modal-container__modal--visible');
|
|
201
|
-
// fade out backdrop simultaneously if this is the last active modal
|
|
202
138
|
const remainingActive = (this.entries ?? []).filter(item => item.id !== id && !item.closing);
|
|
203
139
|
if (remainingActive.length === 0) {
|
|
204
140
|
this.isBackdropVisible = false;
|
|
@@ -207,10 +143,18 @@ const SdModalContainer = class {
|
|
|
207
143
|
this.finalizeDismiss(id);
|
|
208
144
|
}, ANIMATION_DURATION);
|
|
209
145
|
this.entries = (this.entries ?? []).map(item => item.id === id ? { ...item, closing: true, dismissTimerId } : item);
|
|
210
|
-
if (reason === '
|
|
211
|
-
entry.
|
|
212
|
-
|
|
213
|
-
entry.
|
|
146
|
+
if (reason === 'close') {
|
|
147
|
+
if (entry.closeAction === 'ok')
|
|
148
|
+
entry.chain._triggerOk();
|
|
149
|
+
else if (entry.closeAction === 'cancel')
|
|
150
|
+
entry.chain._triggerCancel();
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
if (reason === 'confirm')
|
|
154
|
+
entry.chain._triggerOk();
|
|
155
|
+
if (reason === 'cancel')
|
|
156
|
+
entry.chain._triggerCancel();
|
|
157
|
+
}
|
|
214
158
|
}
|
|
215
159
|
finalizeDismiss(id) {
|
|
216
160
|
const entry = (this.entries ?? []).find(item => item.id === id);
|
|
@@ -44,18 +44,26 @@ const SdPopover = class {
|
|
|
44
44
|
this.slotContent = this.el.innerHTML;
|
|
45
45
|
}
|
|
46
46
|
buttonEl;
|
|
47
|
+
get popoverOffset() {
|
|
48
|
+
switch (this.placement) {
|
|
49
|
+
case 'top': return [0, -4];
|
|
50
|
+
case 'bottom': return [0, 4];
|
|
51
|
+
case 'left': return [4, 0];
|
|
52
|
+
case 'right': return [4, 0];
|
|
53
|
+
}
|
|
54
|
+
}
|
|
47
55
|
handleClose = () => {
|
|
48
56
|
this.showPopover = false;
|
|
49
57
|
};
|
|
50
58
|
render() {
|
|
51
|
-
return (index.h(index.Fragment, { key: '
|
|
59
|
+
return (index.h(index.Fragment, { key: 'f367ea2ada0fda7c28c943bd7bd48785b1810999' }, this.label ? (index.h("sd-button", { ref: el => (this.buttonEl = el), label: this.label, icon: this.icon, size: this.buttonSize, color: this.color, variant: this.buttonVariant, class: "sd-popover", onSdClick: () => (this.showPopover = !this.showPopover) })) : (index.h("sd-icon", { ref: el => (this.buttonEl = el), name: this.icon, size: this.iconSize, color: this.color, class: "sd-popover", onClick: () => (this.showPopover = !this.showPopover) })), this.showPopover && (index.h("sd-floating-portal", { key: 'afdb58bfdf25af2adc45a7b81221c1859b517a5a', parentRef: this.buttonEl, onSdClose: this.handleClose, placement: this.placement, offset: this.popoverOffset }, index.h("div", { key: '38757707dd8c055674edbc2381409f5fd8712c8d', class: {
|
|
52
60
|
'sd-floating-menu': true,
|
|
53
61
|
'sd-floating-menu--popover': true,
|
|
54
62
|
[`sd-floating-menu--${this.placement}`]: true,
|
|
55
63
|
[this.menuClass]: !!this.menuClass,
|
|
56
64
|
}, style: {
|
|
57
65
|
'--sd-floating-bg': popoverTokens.popover.bg,
|
|
58
|
-
} }, index.h("i", { key: '
|
|
66
|
+
} }, index.h("i", { key: '333bae4cb23470121d63d4d8b34a1d2b15837e7d', class: `sd-floating-menu__arrow sd-floating-menu__arrow--${this.placement}` }, index.h(tooltipArrow.TooltipArrow, { key: '617781bb6fc8957576eb149471fd8bf0f44ca552' })), index.h("div", { key: '8c57d49782edd344c8c2c0b9bf44fff8ec154159', class: "sd-floating-menu__content" }, this.menuTitle && index.h("div", { key: 'a06b93124684cb96910ffa2603cf7410a01d6381', class: "sd-floating-menu__title" }, this.menuTitle), this.messages.length > 0 && (index.h("div", { key: '24691930b8ae03a3c92ed8e74dae708b5e64f03b', class: "sd-floating-menu__messages" }, this.messages.map(message => (index.h("div", null, message))))), this.buttons.length > 0 && (index.h("div", { key: 'd73cd4cc978711857c4c946dd2a1c1b64bb5feb6', class: `sd-floating-menu__buttons sd-floating-menu__buttons--${this.buttons.length}` }, this.buttons.map(button => (index.h("sd-button", { ...button })))))), this.useClose && (index.h("button", { key: 'cda218024d04b03fc2931afa99f0127bc7a9c4c5', title: "close", class: "sd-floating-menu__close-button", onClick: () => this.handleClose() }, index.h("sd-icon", { key: '3f41ebce27fd4bab823370d6bbe25b5caed9d5e1', name: "close", size: popoverTokens.popover.close.icon, color: popoverTokens.popover.close.color }))))))));
|
|
59
67
|
}
|
|
60
68
|
static get watchers() { return {
|
|
61
69
|
"show": [{
|
|
@@ -41,10 +41,10 @@ const SdProgress = class {
|
|
|
41
41
|
return this.statusColor[this.progressStatus];
|
|
42
42
|
}
|
|
43
43
|
render() {
|
|
44
|
-
return (index.h("div", { key: '
|
|
44
|
+
return (index.h("div", { key: 'b97a1ba0ad800ada8a2e87aab6108a77053a3ed5', style: {
|
|
45
45
|
'--progress-color': this.progressColor,
|
|
46
46
|
'--progress-percentage': `${this.progressPercentage}%`,
|
|
47
|
-
} }, this.type === 'bar' ? this.renderBarProgress() : this.renderSpinnerProgress(), this.label && index.h("div", { key: '
|
|
47
|
+
} }, this.type === 'bar' ? this.renderBarProgress() : this.renderSpinnerProgress(), this.label && index.h("div", { key: '6a182e4ade2d9c361a85d3fda62f08f62f4722a3', class: "sd-progress__label" }, this.label)));
|
|
48
48
|
}
|
|
49
49
|
renderBarProgress() {
|
|
50
50
|
return (index.h("div", { class: `sd-progress__bar sd-progress__bar--${this.progressStatus}` }, index.h("div", { class: ['sd-progress__bar__percent', this.progressPercentage < 100 ? 'proceed' : ''].join(' ') }), index.h("div", { class: "sd-progress__bar__indicator sd-progress__bar__indicator--left" }, this.progressPercentage, "%"), index.h("div", { class: "sd-progress__bar__indicator sd-progress__bar__indicator--right" }, this.progressPercentage, "%")));
|
|
@@ -275,7 +275,7 @@ const SdSelectGroup = class extends baseDropdownEvent.BaseDropdownEvent {
|
|
|
275
275
|
});
|
|
276
276
|
}
|
|
277
277
|
render() {
|
|
278
|
-
return (index.h("sd-field", { key: '
|
|
278
|
+
return (index.h("sd-field", { key: '822acc0b4200ab415646218d0f059b45f348f5ea', label: this.label, name: this.name, rules: this.rules, error: this.error, disabled: this.disabled, icon: this.icon, addonLabel: this.addonLabel, labelTooltip: this.labelTooltip, labelTooltipProps: this.labelTooltipProps, ref: el => (this.formField = el), style: { '--field-width': this.width || '200px' } }, index.h("div", { key: 'f5a76e913d116469a9d3d9c777d5a3ad62ea42b7', class: {
|
|
279
279
|
'sd-select-group': true,
|
|
280
280
|
'sd-select-group--open': this.isOpen,
|
|
281
281
|
'sd-select-group--disabled': this.disabled,
|
|
@@ -155,7 +155,7 @@ const SdSelectMultiple = class extends baseDropdownEvent.BaseDropdownEvent {
|
|
|
155
155
|
this.handleOptionSelection(option);
|
|
156
156
|
};
|
|
157
157
|
render() {
|
|
158
|
-
return (index.h("sd-field", { key: '
|
|
158
|
+
return (index.h("sd-field", { key: '315be9fce15876ab835f0a6609657dfc04b4f9cf', label: this.label, name: this.name, rules: this.rules, error: this.error, disabled: this.disabled, icon: this.icon, labelTooltip: this.labelTooltip, labelTooltipProps: this.labelTooltipProps, ref: el => (this.formField = el) }, index.h("div", { key: 'db4754bd0710e217119e02827e9e9db3285a5c74', class: {
|
|
159
159
|
'sd-select-multiple': true,
|
|
160
160
|
'sd-select-multiple--open': this.isOpen,
|
|
161
161
|
'sd-select-multiple--disabled': this.disabled,
|
|
@@ -48,7 +48,7 @@ const SdSelectOptionGroup = class {
|
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
50
|
render() {
|
|
51
|
-
return (index.h("div", { key: '
|
|
51
|
+
return (index.h("div", { key: '809d58fbd23e57920785835b37f00b66b579a96c', class: {
|
|
52
52
|
'sd-select__option-group': true,
|
|
53
53
|
'sd-select__option-group--selected': !!this.isSelected,
|
|
54
54
|
'sd-select__option-group--disabled': !!this.option.disabled,
|
|
@@ -57,10 +57,10 @@ const SdSelectOptionGroup = class {
|
|
|
57
57
|
'sd-select__option-group--group': this.option.type === 'group',
|
|
58
58
|
'sd-select__option-group--subgroup': this.option.type === 'subgroup',
|
|
59
59
|
'sd-select__option-group--item': this.option.type === 'item',
|
|
60
|
-
}, onMouseEnter: () => (this.isHovered = true), onMouseLeave: () => (this.isHovered = false), style: this.optionStyle, "data-index": this.index, onClick: event => this.handleClick(this.option, this.isSelected, event) }, index.h("div", { key: '
|
|
60
|
+
}, onMouseEnter: () => (this.isHovered = true), onMouseLeave: () => (this.isHovered = false), style: this.optionStyle, "data-index": this.index, onClick: event => this.handleClick(this.option, this.isSelected, event) }, index.h("div", { key: 'f2ff05ee37333111548779d9fe78d0c4b91c9a1e', class: "sd-select__option-group__label-wrapper" }, this.useCheckbox && (index.h("sd-checkbox", { key: '4ca8aaffb38af21f27d429f6c937b1da3374c24a', value: this.isSelected, disabled: this.option.disabled, onClick: e => {
|
|
61
61
|
e.preventDefault();
|
|
62
62
|
this.handleClick(this.option, this.isSelected, e);
|
|
63
|
-
} })), index.h("span", { key: '
|
|
63
|
+
} })), index.h("span", { key: 'b4b2943e68b98ce82c32e78a9841aae3be4d8e5f', class: "sd-select__option-group-label" }, this.option.label), this.useIndicator && this.option.type !== 'item' && (index.h("span", { key: '6e1414b3738c43f8bd5d308b57440d34f9e1b7fa', class: "sd-select__option-group__count-indicator" }, `(${this.countInfo?.selectedCount}/${this.countInfo?.totalCount})`)))));
|
|
64
64
|
}
|
|
65
65
|
};
|
|
66
66
|
SdSelectOptionGroup.style = sdSelectOptionGroupCss();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./index-Qvv0fGgj.js');
|
|
4
|
-
var sdSelectV2_config = require('./sd-select-v2.config-
|
|
4
|
+
var sdSelectV2_config = require('./sd-select-v2.config-BJXi4hMP.js');
|
|
5
5
|
|
|
6
|
-
const sdSelectV2ListItemCss = () => `sd-select-v2-list-item{display:block}sd-select-v2-list-item .sd-select-v2-list-item{display:flex;align-items:center;gap:var(--list-item-gap);padding:var(--list-item-padding-y) var(--list-item-padding-right) var(--list-item-padding-y) var(--list-item-padding-left);font-size:var(--list-item-font-size);line-height:var(--list-item-line-height);font-weight:var(--list-item-font-weight);background:var(--list-item-bg);color:var(--list-item-color);cursor:default;user-select:none}sd-select-v2-list-item .sd-select-v2-list-item--selectable{cursor:pointer}sd-select-v2-list-item .sd-select-v2-list-item--depth1-group{border-top:var(--list-item-border-top);font-weight:700}sd-select-v2-list-item .sd-select-v2-list-item--depth2-group{font-weight:500}sd-select-v2-list-item .sd-select-v2-list-item--
|
|
6
|
+
const sdSelectV2ListItemCss = () => `sd-select-v2-list-item{display:block}sd-select-v2-list-item .sd-select-v2-list-item{display:flex;align-items:center;gap:var(--list-item-gap);padding:var(--list-item-padding-y) var(--list-item-padding-right) var(--list-item-padding-y) var(--list-item-padding-left);font-size:var(--list-item-font-size);line-height:var(--list-item-line-height);font-weight:var(--list-item-font-weight);background:var(--list-item-bg);color:var(--list-item-color);cursor:default;user-select:none}sd-select-v2-list-item .sd-select-v2-list-item--selectable{cursor:pointer}sd-select-v2-list-item .sd-select-v2-list-item--depth1-group{border-top:var(--list-item-border-top);font-weight:700}sd-select-v2-list-item .sd-select-v2-list-item--depth2-group{font-weight:500}sd-select-v2-list-item .sd-select-v2-list-item--focused.sd-select-v2-list-item--selectable:not(.sd-select-v2-list-item--disabled){background:var(--list-item-bg-hover);color:var(--list-item-color-hover)}sd-select-v2-list-item .sd-select-v2-list-item--selected:not(.sd-select-v2-list-item--group){font-weight:700;color:var(--list-item-bg-hover)}sd-select-v2-list-item .sd-select-v2-list-item--selected.sd-select-v2-list-item--focused{color:var(--list-item-color-hover)}sd-select-v2-list-item .sd-select-v2-list-item--disabled{color:var(--list-item-color-disabled);cursor:not-allowed}sd-select-v2-list-item .sd-select-v2-list-item__label{flex:0 1 auto;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}sd-select-v2-list-item .sd-select-v2-list-item__count{flex-shrink:0;font-weight:500;color:var(--list-item-color-disabled)}sd-select-v2-list-item .sd-select-v2-list-item--group.sd-select-v2-list-item--focused .sd-select-v2-list-item__count{color:#ffffff}sd-select-v2-list-item .sd-select-v2-list-item__checkbox{flex-shrink:0}`;
|
|
7
7
|
|
|
8
8
|
const SdSelectV2ListItem = class {
|
|
9
9
|
constructor(hostRef) {
|
|
@@ -73,7 +73,7 @@ const SdSelectV2ListItem = class {
|
|
|
73
73
|
if (isDepth1Group) {
|
|
74
74
|
cssVars['--list-item-border-top'] = `${sdSelectV2_config.LIST_ITEM_COLORS.depth1.borderWidth}px solid ${sdSelectV2_config.LIST_ITEM_COLORS.depth1.border}`;
|
|
75
75
|
}
|
|
76
|
-
return (index.h("div", { key: '
|
|
76
|
+
return (index.h("div", { key: 'af73e77fdeb673b1862b7bd0b153ee0726a3f5db', class: {
|
|
77
77
|
'sd-select-v2-list-item': true,
|
|
78
78
|
'sd-select-v2-list-item--group': isGroup,
|
|
79
79
|
'sd-select-v2-list-item--depth1-group': isDepth1Group,
|
|
@@ -83,7 +83,7 @@ const SdSelectV2ListItem = class {
|
|
|
83
83
|
'sd-select-v2-list-item--focused': this.isFocused,
|
|
84
84
|
'sd-select-v2-list-item--selectable': this.isSelectable && !this.option.disabled,
|
|
85
85
|
'sd-select-v2-list-item--disabled': !!this.option.disabled,
|
|
86
|
-
}, style: cssVars, onClick: this.handleClick }, this.useCheckbox && (index.h("sd-checkbox", { key: '
|
|
86
|
+
}, style: cssVars, onClick: this.handleClick }, this.useCheckbox && (index.h("sd-checkbox", { key: '8cfcf0375fc756562c4ac698c843bfde3ec3750c', value: this.isSelected === null ? null : !!this.isSelected, disabled: this.option.disabled, class: "sd-select-v2-list-item__checkbox", onClick: this.handleCheckboxClick, onSdUpdate: this.handleCheckboxUpdate })), index.h("span", { key: '1a993c125767559c9cd27f343983b26a24413a93', class: "sd-select-v2-list-item__label" }, this.option.label), this.countInfo && (index.h("span", { key: '377d0d6c6acab983aff2471fc0f4f78eaa637370', class: "sd-select-v2-list-item__count" }, "(", this.countInfo.selected, "/", this.countInfo.total, ")"))));
|
|
87
87
|
}
|
|
88
88
|
};
|
|
89
89
|
SdSelectV2ListItem.style = sdSelectV2ListItemCss();
|
|
@@ -121,15 +121,6 @@ const SdSelectV2ListItemSearch = class {
|
|
|
121
121
|
this.searchFilter.emit(this.searchText);
|
|
122
122
|
}, sdSelectV2_config.SEARCH_DEBOUNCE_MS);
|
|
123
123
|
};
|
|
124
|
-
handleKeyDown = (e) => {
|
|
125
|
-
if (e.key === 'Enter') {
|
|
126
|
-
e.preventDefault();
|
|
127
|
-
e.stopPropagation();
|
|
128
|
-
if (this.debounceTimer)
|
|
129
|
-
clearTimeout(this.debounceTimer);
|
|
130
|
-
this.searchFilter.emit(this.searchText);
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
124
|
handleClear = (e) => {
|
|
134
125
|
e.stopPropagation();
|
|
135
126
|
this.searchText = '';
|
|
@@ -145,12 +136,12 @@ const SdSelectV2ListItemSearch = class {
|
|
|
145
136
|
clearTimeout(this.debounceTimer);
|
|
146
137
|
}
|
|
147
138
|
render() {
|
|
148
|
-
return (index.h("div", { key: '
|
|
139
|
+
return (index.h("div", { key: '7e0f812a04f8f72e41916aad1c2bd8313dac44c7', class: {
|
|
149
140
|
'sd-select-v2-list-item-search': true,
|
|
150
141
|
'sd-select-v2-list-item-search--scrolled': this.isScrolled,
|
|
151
|
-
} }, index.h("div", { key: '
|
|
142
|
+
} }, index.h("div", { key: 'f9df679b4cab727ba2c29293194556dad00bf46b', class: "sd-select-v2-list-item-search__inner" }, index.h("sd-icon", { key: '5f9eb6de82437a6344cc3a0042a24196cb7392a5', name: "search", size: 16, color: "grey_70", class: "sd-select-v2-list-item-search__icon" }), index.h("input", { key: '382b15077dd49e3addceca6026953c6065a5f60c', ref: el => {
|
|
152
143
|
this.inputEl = el;
|
|
153
|
-
}, type: "text", class: "sd-select-v2-list-item-search__input", placeholder: "\uAC80\uC0C9\uC5B4 \uC785\uB825", value: this.searchText, onInput: this.handleInput,
|
|
144
|
+
}, type: "text", class: "sd-select-v2-list-item-search__input", placeholder: "\uAC80\uC0C9\uC5B4 \uC785\uB825", value: this.searchText, onInput: this.handleInput, onFocus: () => this.searchFocus.emit() }), this.searchText && (index.h("button", { key: '00830db3b8d303993acf0787e3818e36f7c2c19c', type: "button", class: "sd-select-v2-list-item-search__clear", onClick: this.handleClear }, index.h("sd-icon", { key: 'a40a022ec7a3ea9d4bda28e7b5fd41850966c716', name: "close", size: 12, color: "#888888" }))))));
|
|
154
145
|
}
|
|
155
146
|
};
|
|
156
147
|
SdSelectV2ListItemSearch.style = sdSelectV2ListItemSearchCss();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./index-Qvv0fGgj.js');
|
|
4
|
-
var sdSelectV2_config = require('./sd-select-v2.config-
|
|
4
|
+
var sdSelectV2_config = require('./sd-select-v2.config-BJXi4hMP.js');
|
|
5
5
|
|
|
6
|
-
const sdSelectV2ListboxCss = () => `sd-select-v2-listbox{display:block}sd-select-v2-listbox .sd-select-v2-listbox{display:flex;flex-direction:column;min-width:var(--listbox-trigger-width);max-width:var(--listbox-max-width);max-height:var(--listbox-max-height);width:fit-content;border-radius:var(--listbox-radius);background:white;box-shadow:2px 2px 12px 2px rgba(0, 0, 0, 0.1);overflow:hidden}sd-select-v2-listbox .sd-select-v2-listbox__list{flex:1;min-height:0;overflow-y:auto;padding-bottom:var(--listbox-padding-bottom)}sd-select-v2-listbox .sd-select-v2-listbox__empty{padding:12px;text-align:center;font-size:12px;line-height:20px;color:#888888}`;
|
|
6
|
+
const sdSelectV2ListboxCss = () => `sd-select-v2-listbox{display:block}sd-select-v2-listbox .sd-select-v2-listbox{display:flex;flex-direction:column;min-width:var(--listbox-trigger-width);max-width:var(--listbox-max-width);max-height:var(--listbox-max-height);width:fit-content;border-radius:var(--listbox-radius);background:white;box-shadow:2px 2px 12px 2px rgba(0, 0, 0, 0.1);overflow:hidden;outline:none}sd-select-v2-listbox .sd-select-v2-listbox__list{flex:1;min-height:0;overflow-y:auto;padding-bottom:var(--listbox-padding-bottom)}sd-select-v2-listbox .sd-select-v2-listbox__empty{padding:12px;text-align:center;font-size:12px;line-height:20px;color:#888888}`;
|
|
7
7
|
|
|
8
8
|
const SdSelectV2Listbox = class {
|
|
9
9
|
constructor(hostRef) {
|
|
@@ -19,7 +19,12 @@ const SdSelectV2Listbox = class {
|
|
|
19
19
|
maxHeight = '260px';
|
|
20
20
|
searchKeyword = '';
|
|
21
21
|
isScrolled = false;
|
|
22
|
+
focusedIndex = -1;
|
|
22
23
|
optionSelect;
|
|
24
|
+
listEl;
|
|
25
|
+
lastScrolledIndex = -1;
|
|
26
|
+
keydownAttached = false;
|
|
27
|
+
suppressHover = false;
|
|
23
28
|
get isDepth() {
|
|
24
29
|
return this.name === 'default_depth' || this.name === 'multi_depth';
|
|
25
30
|
}
|
|
@@ -69,9 +74,9 @@ const SdSelectV2Listbox = class {
|
|
|
69
74
|
const selectedValues = this.getSelectedValues();
|
|
70
75
|
if (selectedValues.size === 0)
|
|
71
76
|
return false;
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
77
|
+
const leaves = this.collectVisibleLeaves(option);
|
|
78
|
+
if (leaves.length === 0)
|
|
79
|
+
return false;
|
|
75
80
|
const selectedCount = leaves.filter(l => selectedValues.has(l.value)).length;
|
|
76
81
|
if (selectedCount === 0)
|
|
77
82
|
return false;
|
|
@@ -83,10 +88,9 @@ const SdSelectV2Listbox = class {
|
|
|
83
88
|
if (!this.isMulti || !option.children)
|
|
84
89
|
return undefined;
|
|
85
90
|
const selectedValues = this.getSelectedValues();
|
|
86
|
-
const
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
return { selected: selectedCount, total: totalLeaves.length };
|
|
91
|
+
const leaves = this.collectVisibleLeaves(option);
|
|
92
|
+
const selectedCount = leaves.filter(l => selectedValues.has(l.value)).length;
|
|
93
|
+
return { selected: selectedCount, total: leaves.length };
|
|
90
94
|
}
|
|
91
95
|
findOriginalOption(value, options) {
|
|
92
96
|
for (const opt of options) {
|
|
@@ -105,21 +109,177 @@ const SdSelectV2Listbox = class {
|
|
|
105
109
|
return [option];
|
|
106
110
|
return option.children.flatMap(child => this.collectLeaves(child));
|
|
107
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Returns the leaves currently visible to the user for the given (possibly
|
|
114
|
+
* filtered) option. When a group's own label matched the search keyword its
|
|
115
|
+
* `children` is emptied by `filterTree`; in that case we fall back to the
|
|
116
|
+
* full original subtree because the user has no way to deselect descendants
|
|
117
|
+
* individually.
|
|
118
|
+
*/
|
|
119
|
+
collectVisibleLeaves(option) {
|
|
120
|
+
if (!option.children)
|
|
121
|
+
return [option];
|
|
122
|
+
if (option.children.length === 0) {
|
|
123
|
+
const original = this.findOriginalOption(option.value, this.options);
|
|
124
|
+
return original ? this.collectLeaves(original) : [];
|
|
125
|
+
}
|
|
126
|
+
return option.children.flatMap(child => this.collectVisibleLeaves(child));
|
|
127
|
+
}
|
|
128
|
+
get navigableOptions() {
|
|
129
|
+
const items = [];
|
|
130
|
+
const walk = (opts) => {
|
|
131
|
+
for (const opt of opts) {
|
|
132
|
+
const isGroup = !!opt.children;
|
|
133
|
+
const isSelectable = !isGroup || this.isMulti;
|
|
134
|
+
if (isSelectable && !opt.disabled)
|
|
135
|
+
items.push(opt);
|
|
136
|
+
if (isGroup && opt.children && opt.children.length > 0)
|
|
137
|
+
walk(opt.children);
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
walk(this.filteredOptions);
|
|
141
|
+
return items;
|
|
142
|
+
}
|
|
143
|
+
isOptionFocused(option) {
|
|
144
|
+
if (this.focusedIndex < 0)
|
|
145
|
+
return false;
|
|
146
|
+
const focused = this.navigableOptions[this.focusedIndex];
|
|
147
|
+
// filterTree 가 매 호출마다 옵션 객체를 새로 복제하기 때문에 참조 비교
|
|
148
|
+
// (=== / indexOf) 는 검색이 적용된 동안 항상 실패한다. 고유 식별자인
|
|
149
|
+
// value 로 비교해야 한다.
|
|
150
|
+
return !!focused && focused.value === option.value;
|
|
151
|
+
}
|
|
152
|
+
resetFocusOnFilter() {
|
|
153
|
+
// 필터가 바뀌면 이전 인덱스가 가리키던 항목이 사라질 수 있으므로
|
|
154
|
+
// 새 결과의 첫 항목으로 옮긴다. 결과가 비면 -1.
|
|
155
|
+
const items = this.navigableOptions;
|
|
156
|
+
this.focusedIndex = items.length > 0 ? 0 : -1;
|
|
157
|
+
// 키보드 네비게이션 직후 마우스가 한 번도 안 움직인 채로 사용자가
|
|
158
|
+
// 검색을 시작했다면 hover suppression 이 켜진 상태로 남아있을 수 있다.
|
|
159
|
+
// 검색이라는 명백한 사용자 의도 전환 시점에 강제로 해제한다.
|
|
160
|
+
if (this.suppressHover) {
|
|
161
|
+
document.removeEventListener('mousemove', this.releaseHoverSuppress, true);
|
|
162
|
+
this.suppressHover = false;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
108
165
|
handleSearchFilter = (e) => {
|
|
109
166
|
this.searchKeyword = e.detail;
|
|
110
167
|
};
|
|
111
168
|
handleScroll = (e) => {
|
|
112
169
|
this.isScrolled = e.target.scrollTop > 0;
|
|
113
170
|
};
|
|
171
|
+
emitOptionSelect(option) {
|
|
172
|
+
this.optionSelect.emit({
|
|
173
|
+
option,
|
|
174
|
+
leaves: this.collectVisibleLeaves(option),
|
|
175
|
+
});
|
|
176
|
+
}
|
|
114
177
|
handleOptionClick = (e) => {
|
|
115
178
|
e.stopPropagation();
|
|
116
|
-
this.
|
|
179
|
+
this.emitOptionSelect(e.detail);
|
|
180
|
+
};
|
|
181
|
+
handleOptionHover = (option) => {
|
|
182
|
+
if (this.suppressHover)
|
|
183
|
+
return;
|
|
184
|
+
const idx = this.navigableOptions.findIndex(o => o.value === option.value);
|
|
185
|
+
if (idx >= 0)
|
|
186
|
+
this.focusedIndex = idx;
|
|
187
|
+
};
|
|
188
|
+
releaseHoverSuppress = () => {
|
|
189
|
+
this.suppressHover = false;
|
|
190
|
+
document.removeEventListener('mousemove', this.releaseHoverSuppress, true);
|
|
117
191
|
};
|
|
192
|
+
handleKeyDown = (e) => {
|
|
193
|
+
const items = this.navigableOptions;
|
|
194
|
+
if (e.key === 'ArrowDown') {
|
|
195
|
+
if (items.length === 0)
|
|
196
|
+
return;
|
|
197
|
+
e.preventDefault();
|
|
198
|
+
e.stopPropagation();
|
|
199
|
+
this.focusedIndex = this.focusedIndex < 0 ? 0 : (this.focusedIndex + 1) % items.length;
|
|
200
|
+
this.beginHoverSuppression();
|
|
201
|
+
}
|
|
202
|
+
else if (e.key === 'ArrowUp') {
|
|
203
|
+
if (items.length === 0)
|
|
204
|
+
return;
|
|
205
|
+
e.preventDefault();
|
|
206
|
+
e.stopPropagation();
|
|
207
|
+
this.focusedIndex = this.focusedIndex <= 0 ? items.length - 1 : this.focusedIndex - 1;
|
|
208
|
+
this.beginHoverSuppression();
|
|
209
|
+
}
|
|
210
|
+
else if (e.key === 'Enter') {
|
|
211
|
+
if (this.focusedIndex < 0 || this.focusedIndex >= items.length)
|
|
212
|
+
return;
|
|
213
|
+
e.preventDefault();
|
|
214
|
+
e.stopPropagation();
|
|
215
|
+
this.emitOptionSelect(items[this.focusedIndex]);
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
/**
|
|
219
|
+
* 키보드로 인덱스를 옮기면 자동 스크롤이 일어나는데, 정지한 마우스 커서
|
|
220
|
+
* 아래로 다른 항목이 미끄러져 들어오면서 mouseenter 가 발화해 인덱스를
|
|
221
|
+
* 다시 덮어쓰는 문제를 막는다. 실제로 마우스가 한 번이라도 움직이기 전까지
|
|
222
|
+
* hover 갱신을 무시한다.
|
|
223
|
+
*/
|
|
224
|
+
beginHoverSuppression() {
|
|
225
|
+
if (this.suppressHover)
|
|
226
|
+
return;
|
|
227
|
+
this.suppressHover = true;
|
|
228
|
+
document.addEventListener('mousemove', this.releaseHoverSuppress, true);
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* 리스트 컨테이너 내부에서만 스크롤한다. `scrollIntoView` 는 조상 스크롤
|
|
232
|
+
* 컨테이너(=문서 자체)까지 함께 스크롤시키므로 사용하지 않는다.
|
|
233
|
+
*/
|
|
234
|
+
scrollFocusedIntoView() {
|
|
235
|
+
const list = this.listEl;
|
|
236
|
+
const focusedEl = list?.querySelector('.sd-select-v2-list-item--focused');
|
|
237
|
+
if (!list || !focusedEl)
|
|
238
|
+
return;
|
|
239
|
+
const listRect = list.getBoundingClientRect();
|
|
240
|
+
const itemRect = focusedEl.getBoundingClientRect();
|
|
241
|
+
if (itemRect.top < listRect.top) {
|
|
242
|
+
list.scrollTop += itemRect.top - listRect.top;
|
|
243
|
+
}
|
|
244
|
+
else if (itemRect.bottom > listRect.bottom) {
|
|
245
|
+
list.scrollTop += itemRect.bottom - listRect.bottom;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* sd-portal 이 슬롯 노드를 body 로 이동시키면서 disconnect → connect 가
|
|
250
|
+
* 발생하므로, 키보드 리스너는 한 번만 실행되는 componentDidLoad 가 아니라
|
|
251
|
+
* connectedCallback / disconnectedCallback 에 묶어 매번 재부착한다.
|
|
252
|
+
* capture phase 로 잡아 포커스가 검색 input 에 있어도 ↑/↓/Enter 가
|
|
253
|
+
* input 의 기본 동작(커서 이동)·페이지 스크롤보다 먼저 처리되도록 한다.
|
|
254
|
+
*/
|
|
255
|
+
connectedCallback() {
|
|
256
|
+
if (!this.keydownAttached) {
|
|
257
|
+
document.addEventListener('keydown', this.handleKeyDown, true);
|
|
258
|
+
this.keydownAttached = true;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
disconnectedCallback() {
|
|
262
|
+
if (this.keydownAttached) {
|
|
263
|
+
document.removeEventListener('keydown', this.handleKeyDown, true);
|
|
264
|
+
this.keydownAttached = false;
|
|
265
|
+
}
|
|
266
|
+
if (this.suppressHover) {
|
|
267
|
+
document.removeEventListener('mousemove', this.releaseHoverSuppress, true);
|
|
268
|
+
this.suppressHover = false;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
componentDidRender() {
|
|
272
|
+
if (this.focusedIndex !== this.lastScrolledIndex) {
|
|
273
|
+
this.lastScrolledIndex = this.focusedIndex;
|
|
274
|
+
if (this.focusedIndex >= 0)
|
|
275
|
+
this.scrollFocusedIntoView();
|
|
276
|
+
}
|
|
277
|
+
}
|
|
118
278
|
renderOptions(options, depth = 1) {
|
|
119
279
|
return options.map(option => {
|
|
120
280
|
const isGroup = !!option.children;
|
|
121
281
|
return [
|
|
122
|
-
index.h("sd-select-v2-list-item", { option: option, depth: depth, isSelected: isGroup ? this.getGroupSelectionState(option) : this.isOptionSelected(option), useCheckbox: this.isMulti, countInfo: this.getCountInfo(option), onSdListItemClick: this.handleOptionClick }),
|
|
282
|
+
index.h("sd-select-v2-list-item", { option: option, depth: depth, isSelected: isGroup ? this.getGroupSelectionState(option) : this.isOptionSelected(option), isFocused: this.isOptionFocused(option), useCheckbox: this.isMulti, countInfo: this.getCountInfo(option), onSdListItemClick: this.handleOptionClick, onMouseEnter: () => this.handleOptionHover(option) }),
|
|
123
283
|
isGroup && option.children ? this.renderOptions(option.children, depth + 1) : null,
|
|
124
284
|
];
|
|
125
285
|
});
|
|
@@ -132,8 +292,15 @@ const SdSelectV2Listbox = class {
|
|
|
132
292
|
'--listbox-radius': `${sdSelectV2_config.LIST_BOX_LAYOUT.radius}px`,
|
|
133
293
|
'--listbox-padding-bottom': `${sdSelectV2_config.LIST_BOX_LAYOUT.paddingBottom}px`,
|
|
134
294
|
};
|
|
135
|
-
return (index.h("div", { key: '
|
|
295
|
+
return (index.h("div", { key: 'f47839574d0c149ab4aa2a3912b51318ec815b55', class: "sd-select-v2-listbox", style: cssVars }, this.showSearch && (index.h("sd-select-v2-list-item-search", { key: '3c3f9fd3e0c935da59bc7727af5c719b76b309d5', isScrolled: this.isScrolled, onSdSearchFilter: this.handleSearchFilter })), index.h("div", { key: '4d4ef6c7c543689abb9ed085e07e613deca6c8d8', class: "sd-select-v2-listbox__list", onScroll: this.handleScroll, ref: el => {
|
|
296
|
+
this.listEl = el;
|
|
297
|
+
} }, this.isEmpty ? (index.h("div", { class: "sd-select-v2-listbox__empty" }, sdSelectV2_config.EMPTY_MESSAGE)) : this.isDepth ? (this.renderOptions(this.filteredOptions)) : (this.filteredOptions.map(option => (index.h("sd-select-v2-list-item", { option: option, depth: 1, isSelected: this.isOptionSelected(option), isFocused: this.isOptionFocused(option), useCheckbox: this.isMulti, onSdListItemClick: this.handleOptionClick, onMouseEnter: () => this.handleOptionHover(option) })))))));
|
|
136
298
|
}
|
|
299
|
+
static get watchers() { return {
|
|
300
|
+
"searchKeyword": [{
|
|
301
|
+
"resetFocusOnFilter": 0
|
|
302
|
+
}]
|
|
303
|
+
}; }
|
|
137
304
|
};
|
|
138
305
|
SdSelectV2Listbox.style = sdSelectV2ListboxCss();
|
|
139
306
|
|
|
@@ -169,11 +336,11 @@ const SdSelectV2Trigger = class {
|
|
|
169
336
|
: sdSelectV2_config.SELECT_COLORS.icon.default,
|
|
170
337
|
'--trigger-icon-color': this.disabled ? sdSelectV2_config.SELECT_COLORS.icon.disabled : sdSelectV2_config.SELECT_COLORS.icon.default,
|
|
171
338
|
};
|
|
172
|
-
return (index.h("div", { key: '
|
|
339
|
+
return (index.h("div", { key: '2cf4cc98bbfc8808f84d1d6b9dbfbb4f1afee272', class: {
|
|
173
340
|
'sd-select-v2-trigger': true,
|
|
174
341
|
'sd-select-v2-trigger--open': this.isOpen,
|
|
175
342
|
'sd-select-v2-trigger--disabled': this.disabled,
|
|
176
|
-
}, style: cssVars, onClick: this.handleClick }, index.h("div", { key: '
|
|
343
|
+
}, style: cssVars, onClick: this.handleClick }, index.h("div", { key: '8835de30555a7ef7846afacad8ec6ee5482b36cf', class: "sd-select-v2-trigger__content" }, index.h("span", { key: '5afd6845dc9b412a3cd87e6a16de8bd506b38dbb', class: "sd-select-v2-trigger__text" }, hasValue ? this.displayText : this.placeholder), index.h("sd-icon", { key: '727d44f2814321bc80ca5a9d127ce5676f0bfdc6', name: "arrowDown", size: 12, color: "var(--trigger-icon-color)", class: {
|
|
177
344
|
'sd-select-v2-trigger__icon': true,
|
|
178
345
|
'sd-select-v2-trigger__icon--open': this.isOpen,
|
|
179
346
|
} }))));
|