@sellmate/design-system 1.0.56 → 1.0.57
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/design-system.cjs.js +1 -1
- package/dist/cjs/index.cjs.js +54 -16
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/sd-action-modal.cjs.entry.js +1 -1
- package/dist/cjs/sd-button_4.cjs.entry.js +1 -1
- package/dist/cjs/sd-calendar.cjs.entry.js +4 -4
- package/dist/cjs/sd-checkbox.cjs.entry.js +1 -1
- package/dist/cjs/sd-date-box.cjs.entry.js +2 -2
- package/dist/cjs/sd-form.cjs.entry.js +1 -1
- package/dist/cjs/sd-loading-spinner_3.cjs.entry.js +1 -1
- package/dist/cjs/sd-modal-container.cjs.entry.js +13 -10
- package/dist/cjs/sd-radio-button-group.cjs.entry.js +1 -1
- package/dist/cjs/sd-radio-group.cjs.entry.js +1 -1
- package/dist/cjs/sd-radio.cjs.entry.js +1 -1
- package/dist/cjs/sd-select-multiple-group.cjs.entry.js +1 -1
- package/dist/cjs/sd-table.cjs.entry.js +4 -4
- package/dist/cjs/sd-tabs.cjs.entry.js +1 -1
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/sd-action-modal/sd-action-modal.js +1 -1
- package/dist/collection/components/sd-button/sd-button.js +1 -1
- package/dist/collection/components/sd-calendar/sd-calendar.js +4 -4
- package/dist/collection/components/sd-checkbox/sd-checkbox.js +1 -1
- package/dist/collection/components/sd-date-box/sd-date-box.js +2 -2
- package/dist/collection/components/sd-form/sd-form.js +1 -1
- package/dist/collection/components/sd-modal-container/sd-modal-container.js +50 -22
- package/dist/collection/components/sd-radio/sd-radio.js +1 -1
- package/dist/collection/components/sd-radio-button-group/sd-radio-button-group.js +1 -1
- package/dist/collection/components/sd-radio-group/sd-radio-group.js +1 -1
- package/dist/collection/components/sd-select/sd-select.js +1 -1
- package/dist/collection/components/sd-select-multiple-group/sd-select-multiple-group.js +1 -1
- package/dist/collection/components/sd-table/sd-table.js +4 -4
- package/dist/collection/components/sd-tabs/sd-tabs.js +1 -1
- package/dist/collection/index.js +1 -1
- package/dist/collection/utils/modal.js +52 -16
- package/dist/components/index.js +1 -1
- package/dist/components/{p-CqzgCVtM.js → p-B9t9pwo_.js} +1 -1
- package/dist/components/{p-Drngu_DV.js → p-BM4qDFZj.js} +1 -1
- package/dist/components/{p-5a-vaX0a.js → p-BR0LWoJL.js} +1 -1
- package/dist/components/{p-0zA9F8Lm.js → p-C2uZkOBj.js} +1 -1
- package/dist/components/{p-C6WuqUWC.js → p-CDR-4auv.js} +1 -1
- package/dist/components/{p-AvVgx8d3.js → p-Cbtpfl9F.js} +1 -1
- package/dist/components/{p-t4yN2fpo.js → p-CmXAKr-2.js} +1 -1
- package/dist/components/{p-DsqyxLeH.js → p-CqU3a1re.js} +1 -1
- package/dist/components/{p-gwccuwWe.js → p-DCJWAesd.js} +1 -1
- package/dist/components/{p-gOEtvhSH.js → p-DXAB0k9r.js} +1 -1
- package/dist/components/{p-CUDww9I2.js → p-DxzIjbQJ.js} +1 -1
- package/dist/components/{p-BNZuZ-DC.js → p-IRd25v7v.js} +1 -1
- package/dist/components/{p-CZWF0Ha8.js → p-iZSyoiHU.js} +1 -1
- package/dist/components/{p-DnZZMuzX.js → p-mnDAufNv.js} +1 -1
- package/dist/components/{p-uv1FQPWY.js → p-w3CsjVGg.js} +1 -1
- package/dist/components/sd-action-modal.js +1 -1
- package/dist/components/sd-barcode-input.js +1 -1
- package/dist/components/sd-button.js +1 -1
- package/dist/components/sd-calendar.js +1 -1
- package/dist/components/sd-checkbox.js +1 -1
- package/dist/components/sd-date-box.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-field.js +1 -1
- package/dist/components/sd-file-picker.js +1 -1
- package/dist/components/sd-form.js +1 -1
- package/dist/components/sd-guide.js +1 -1
- package/dist/components/sd-input.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-popover.js +1 -1
- package/dist/components/sd-radio-button-group.js +1 -1
- package/dist/components/sd-radio-group.js +1 -1
- package/dist/components/sd-radio.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.js +1 -1
- package/dist/components/sd-select-v2-listbox.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-textarea.js +1 -1
- package/dist/components/sd-tooltip.js +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-a873d717.entry.js → p-0c026571.entry.js} +1 -1
- package/dist/design-system/{p-d4f8e2f7.entry.js → p-10dd9343.entry.js} +1 -1
- package/dist/design-system/{p-4021d3f4.entry.js → p-2a25b3dc.entry.js} +1 -1
- package/dist/design-system/{p-cbe94549.entry.js → p-3686b44e.entry.js} +1 -1
- package/dist/design-system/{p-2909a0a3.entry.js → p-43512d46.entry.js} +1 -1
- package/dist/design-system/{p-fa68e96d.entry.js → p-74079256.entry.js} +1 -1
- package/dist/design-system/{p-7ce03e1c.entry.js → p-7a18a52b.entry.js} +1 -1
- package/dist/design-system/{p-7c48affc.entry.js → p-85e22acd.entry.js} +1 -1
- package/dist/design-system/{p-f2021df6.entry.js → p-a7e4994e.entry.js} +1 -1
- package/dist/design-system/p-aedd45f7.entry.js +1 -0
- package/dist/design-system/{p-a1b190f0.entry.js → p-cee768a2.entry.js} +1 -1
- package/dist/design-system/{p-f465c79d.entry.js → p-d5b5cfc7.entry.js} +1 -1
- package/dist/design-system/{p-5bd180a0.entry.js → p-eb11f6cc.entry.js} +1 -1
- package/dist/design-system/{p-1e14fb6b.entry.js → p-fdf7ed87.entry.js} +1 -1
- package/dist/esm/design-system.js +1 -1
- package/dist/esm/index.js +53 -17
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sd-action-modal.entry.js +1 -1
- package/dist/esm/sd-button_4.entry.js +1 -1
- package/dist/esm/sd-calendar.entry.js +4 -4
- package/dist/esm/sd-checkbox.entry.js +1 -1
- package/dist/esm/sd-date-box.entry.js +2 -2
- package/dist/esm/sd-form.entry.js +1 -1
- package/dist/esm/sd-loading-spinner_3.entry.js +1 -1
- package/dist/esm/sd-modal-container.entry.js +13 -10
- package/dist/esm/sd-radio-button-group.entry.js +1 -1
- package/dist/esm/sd-radio-group.entry.js +1 -1
- package/dist/esm/sd-radio.entry.js +1 -1
- package/dist/esm/sd-select-multiple-group.entry.js +1 -1
- package/dist/esm/sd-table.entry.js +4 -4
- package/dist/esm/sd-tabs.entry.js +1 -1
- package/dist/types/components/sd-modal-container/sd-modal-container.config.d.ts +2 -2
- package/dist/types/components/sd-modal-container/sd-modal-container.d.ts +4 -3
- package/dist/types/components.d.ts +5 -4
- package/dist/types/index.d.ts +2 -2
- package/dist/types/utils/modal.d.ts +26 -8
- package/hydrate/index.js +34 -30
- package/hydrate/index.mjs +34 -30
- package/package.json +1 -1
- package/dist/design-system/p-d8b4b24f.entry.js +0 -1
|
@@ -30,7 +30,7 @@ const SdRadio = class {
|
|
|
30
30
|
}
|
|
31
31
|
render() {
|
|
32
32
|
const isSelected = String(this.val) === String(this.value);
|
|
33
|
-
return (index.h("div", { key: '
|
|
33
|
+
return (index.h("div", { key: 'e9d7875b19c108505e7dfd455432102c8035097f', "aria-label": String(this.val) || 'radio option', "aria-checked": isSelected ? 'true' : 'false', "aria-disabled": this.disabled ? 'true' : 'false', class: this.getRadioClasses() }, index.h("label", { key: `radio-${this.val}` }, index.h("input", { key: 'cc0aa88287000b77c2329bba2371e9e4404f8203', type: "radio", name: String(this.val), value: String(this.val), checked: isSelected, disabled: this.disabled, onInput: () => this.handleRadioChange() }), this.val != null && (index.h("span", { key: 'b2a371ef8bc4ccc57ffbbc6acc22bf4b9c391fc1', class: "sd-radio-group__label" }, this.label || String(this.val))))));
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
36
|
SdRadio.style = sdRadioCss();
|
|
@@ -397,7 +397,7 @@ const SdSelectMultipleGroup = class extends baseDropdownEvent.BaseDropdownEvent
|
|
|
397
397
|
});
|
|
398
398
|
}
|
|
399
399
|
render() {
|
|
400
|
-
return (index.h("sd-field", { key: '
|
|
400
|
+
return (index.h("sd-field", { key: '350c7b2df807166a1439a2151f0f168385adac4a', 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), style: { '--field-width': this.width || '200px' } }, index.h("div", { key: 'cce989263e1c7dcb38216e734aabe6eea643676a', class: {
|
|
401
401
|
'sd-select-multiple-group': true,
|
|
402
402
|
'sd-select-multiple-group--open': this.isOpen,
|
|
403
403
|
'sd-select-multiple-group--disabled': this.disabled,
|
|
@@ -770,16 +770,16 @@ const SdTable = class {
|
|
|
770
770
|
return (index.h("td", { key: `virtual-${position}-spacer-${rowIdx}`, class: "sd-table__virtual-spacer", style: this.getSpacerCellStyle(spacerWidth), "aria-hidden": "true" }, index.h("div", { class: "sd-table__skeleton-cell" })));
|
|
771
771
|
}
|
|
772
772
|
render() {
|
|
773
|
-
return (index.h(index.Fragment, { key: '
|
|
773
|
+
return (index.h(index.Fragment, { key: 'f3e4930d36d080fd546dddc1e80190b831e93012' }, index.h("div", { key: 'ad2f798951631319190d93f83e25b87f871e58de', class: "sd-table__wrapper", style: {
|
|
774
774
|
'--table-width': this.width,
|
|
775
775
|
'--table-height': this.height,
|
|
776
|
-
} }, index.h("div", { key: '
|
|
776
|
+
} }, index.h("div", { key: 'c4b6d4080f1416d1c88ab1413c66848bdafe9019', class: "sd-table__container", style: {
|
|
777
777
|
'--table-container-height': `calc(${this.height} - ${this.pagination && this.innerRows.length > 0 ? 48 : 0}px)`,
|
|
778
|
-
} }, index.h("div", { key: '
|
|
778
|
+
} }, index.h("div", { key: '3aacc27970b0c6d8b700063c0af7c57175e2cb22', class: {
|
|
779
779
|
'sd-table__middle': true,
|
|
780
780
|
'sd-table__middle--scrollable': this.paginatedRows.length > 0,
|
|
781
781
|
'sd-table__middle--loading': this.isLoading,
|
|
782
|
-
} }, this.isLoading && (index.h("div", { key: '
|
|
782
|
+
} }, this.isLoading && (index.h("div", { key: '25fca304a4e8ebf43aeeff20de3e3446d25e1ffb', class: "sd-table__middle--loading__spinner" }, index.h("sd-loading-spinner", { key: '48b0adad60cf422b884557b53097c28a4f0b8879' }))), index.h("table", { key: 'ec4328a1f43c865de642cc5814fbdef6a374b7e3', part: "table", class: this.sdTableClasses }, this.renderHead(), this.renderBody())), !this.paginatedRows.length && (index.h("div", { key: 'ba362ecb9fb8134a15ff3d0a3b8e6a523e94166a', class: "sd-table__bottom" }, index.h("div", { key: 'ca5c2e0b19a1e301ac159588436ef24eecfb6365', class: "sd-table__no-data" }, index.h("slot", { key: '68564a60a05833ba87743212d7189eef6e179fb4', name: "no-data" }, this.noDataLabel))))), this.pagination && this.innerRows.length > 0 && (index.h("div", { key: '88c3c7362234c20a60f6437ecd79d4c75b2caa6e', class: "sd-table__pagination" }, index.h("sd-pagination", { key: 'c3c8c435fcb752f2b1139981bb764cf4dfb153ab', currentPage: !this.useInternalPagination ? this.pagination.page : this.currentPage, lastPage: !this.useInternalPagination ? this.pagination.lastPage : this.lastPageNumber, onSdPageChange: (e) => this.changePage(e.detail) }), this.useRowsPerPageSelect && (index.h("sd-select", { key: '03801039397a31321e5af96c2bd2d2900151240e', value: this.pagination.rowsPerPage, options: this.rowsPerPageOption, width: "128px", onSdUpdate: (e) => this.changeRowsPerPage(e.detail.value) })))))));
|
|
783
783
|
}
|
|
784
784
|
static get watchers() { return {
|
|
785
785
|
"columns": [{
|
|
@@ -48,7 +48,7 @@ const SdTabs = class {
|
|
|
48
48
|
return `square_${this.size}_${color}`;
|
|
49
49
|
}
|
|
50
50
|
render() {
|
|
51
|
-
return (index.h("div", { key: '
|
|
51
|
+
return (index.h("div", { key: '74a25ee4311c84e79f4918b884385f27d6af6313', class: this.getContainerClasses() }, this.tabs.map((tab, index$1) => {
|
|
52
52
|
const badgeName = this.getBadgeName(tab);
|
|
53
53
|
return (index.h("div", { key: `tab-${index$1}`, class: this.getTabClasses(tab), "aria-label": tab.label || 'tab', onClick: () => this.handleTabClick(tab.value) }, index.h("span", { "data-label": tab.label, class: "sd-tabs__label" }, tab.label), tab.badge && index.h("sd-tag", { name: badgeName, label: tab.badge.toString() })));
|
|
54
54
|
})));
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"entries": [
|
|
3
|
-
"components/sd-action-modal/sd-action-modal.js",
|
|
4
3
|
"components/sd-button/sd-button.js",
|
|
5
4
|
"components/sd-calendar/sd-calendar.js",
|
|
6
5
|
"components/sd-checkbox/sd-checkbox.js",
|
|
@@ -13,6 +12,7 @@
|
|
|
13
12
|
"components/sd-select-multiple-group/sd-select-multiple-group.js",
|
|
14
13
|
"components/sd-table/sd-table.js",
|
|
15
14
|
"components/sd-tabs/sd-tabs.js",
|
|
15
|
+
"components/sd-action-modal/sd-action-modal.js",
|
|
16
16
|
"components/sd-badge/sd-badge.js",
|
|
17
17
|
"components/sd-barcode-input/sd-barcode-input.js",
|
|
18
18
|
"components/sd-button-v2/sd-button-v2.js",
|
|
@@ -29,7 +29,7 @@ export class SdActionModal {
|
|
|
29
29
|
'--sd-action-modal-title-font-size': `${ACTION_MODAL_TITLE.fontSize}px`,
|
|
30
30
|
'--sd-action-modal-title-line-height': `${ACTION_MODAL_TITLE.lineHeight}px`,
|
|
31
31
|
};
|
|
32
|
-
return (h("div", { key: '
|
|
32
|
+
return (h("div", { key: 'b306dc102137e9b76faeeb19587dce32d670163c', class: "sd-action-modal", style: cssVars }, h("header", { key: 'e6b9699e9943d1f4001b4cd23f99975474c3e86e', class: "sd-action-modal__header" }, h("h2", { key: '4d30b98d01a191e4bdc3fb1ff772483dfd3a8397', class: "sd-action-modal__title" }, this.modalTitle), h("div", { key: 'f1083fe5c2643d09dc4bad4c50064ffda2db65ab', class: "sd-action-modal__header-sub" }, h("slot", { key: 'a11c9a13ae11569226ac11fb4be6b782667defeb', name: "header-sub-title" })), h("sd-ghost-button", { key: 'e8a76ecd5d1388a79ac19705d634f40c05e6c2fc', class: "sd-action-modal__close", icon: "close", ariaLabel: "close", onClick: () => this.close.emit() })), h("div", { key: 'eb615713a8fbfdd1c40c805e3146fc8341686c72', class: "sd-action-modal__body" }, h("slot", { key: 'd56a3331bc2e94748f150c11dba9e5bd1fad8043', name: "body" })), h("footer", { key: 'd80ad9de537846b01f79588e363bb40e76c64fba', class: "sd-action-modal__footer" }, h("div", { key: '49187df32a64d18b2492995a80ce49df02e9303e', class: "sd-action-modal__footer-sub" }, h("slot", { key: 'd73e66710152c0718d7cab6bbcbd1ab2cebf1f87', name: "bottom-sub-content" })), h("sd-button-v2", { key: '03d2f2a0fa6960983c46e47460f623dfd42811a3', ...DEFAULT_BUTTON_PROPS, ...this.buttonProps, onSdClick: () => this.ok.emit() }))));
|
|
33
33
|
}
|
|
34
34
|
static get is() { return "sd-action-modal"; }
|
|
35
35
|
static get originalStyleUrls() {
|
|
@@ -51,7 +51,7 @@ export class SdButton {
|
|
|
51
51
|
const buttonClasses = this.getButtonClasses();
|
|
52
52
|
// 유틸로 색상 키 -> HEX 매핑 (없으면 원본 그대로)
|
|
53
53
|
const resolvedColor = resolveColor(this.color);
|
|
54
|
-
return (h("button", { key: '
|
|
54
|
+
return (h("button", { key: '079f66bd47a67c5e7cf95ff6b0b6a10aa84697d5', class: `${buttonClasses} ${this.sdClass}`, type: this.type, disabled: this.disabled, style: { '--button-color': resolvedColor }, onClick: this.handleClick }, h("div", { key: '78c7b1b6b7828fe93c5a2752fbaf41b0b8c17cb2', class: "sd-button__content" }, this.icon && (h("sd-icon", { key: '3f0afbeec89e0064f404d4967870516c87f35ac2', class: "sd-button__icon sd-button__icon--left", name: this.icon, size: this.iconSize ?? ICON_SIZES[this.size], color: this.iconColor ?? (this.variant === 'primary' ? '#fff' : resolvedColor) })), this.label && h("div", { key: '319ac39031f4118489d88eec50eb590067422f87', class: "sd-button__label" }, this.label), this.iconRight && (h("sd-icon", { key: '3e25e709e39ffbaceec0863c4fc5c54b8d34d5e1', class: "sd-button__icon sd-button__icon--right", name: this.iconRight, size: ICON_SIZES[this.size], color: this.variant === 'primary' ? '#fff' : resolvedColor })))));
|
|
55
55
|
}
|
|
56
56
|
static get is() { return "sd-button"; }
|
|
57
57
|
static get originalStyleUrls() {
|
|
@@ -100,13 +100,13 @@ export class SdCalendar {
|
|
|
100
100
|
// eventsRevision 참조로 events/eventColors 변경 시 re-render 보장
|
|
101
101
|
void this.eventsRevision;
|
|
102
102
|
const allEventNames = this.getAllEventNames();
|
|
103
|
-
return (h("div", { key: '
|
|
103
|
+
return (h("div", { key: '149ca9ae588a7bd2d70ecf1bf13cc639c99f7da9', class: "sd-calendar" }, h("div", { key: '65f58d53fbaf35cee16007bad0b5e56dd208393e', class: "sd-calendar__header" }, h("div", { key: '76709fd094edaece5ede720a983d1103801ba76d', class: "year-nav" }, h("button", { key: '6d46cfa4cb1d12507ba7570cb6c0bb88bcba3402', type: "button", name: "prev-year", title: "Previous Year", onClick: () => {
|
|
104
104
|
this.currentYear = this.currentYear - 1;
|
|
105
105
|
this.viewChange.emit({ year: this.currentYear, month: this.currentMonth });
|
|
106
|
-
} }, h("sd-icon", { key: '
|
|
106
|
+
} }, h("sd-icon", { key: '1319ec1fa0f2533a5d02853cb7638b1f1c10e050', name: "arrowLeft", size: "12", color: "grey_45" })), h("span", { key: '678b705cd95dc499975e071f1607f26bdd50c36d', class: "year-nav__current" }, this.currentYear), h("button", { key: '1f5c3a0cd6108da5ed1beb10bd6af4ea5f22cf4c', type: "button", name: "next-year", title: "Next Year", onClick: () => {
|
|
107
107
|
this.currentYear = this.currentYear + 1;
|
|
108
108
|
this.viewChange.emit({ year: this.currentYear, month: this.currentMonth });
|
|
109
|
-
} }, h("sd-icon", { key: '
|
|
109
|
+
} }, h("sd-icon", { key: '9dff93aef0996c3679a6a8c93c0fce1ea390f4aa', name: "arrowRight", size: "12", color: "grey_45" }))), h("div", { key: '9a6840420da580096fbf24d2c4df656114e23e6e', class: "month-nav" }, h("button", { key: '94bf7598e5b80d6deb407f607034ed6e9f88151f', type: "button", name: "prev-month", title: "Previous Month", onClick: () => this.handleUpdateMonth('prev') }, h("sd-icon", { key: '4ab19da5f6a12bf37b3c4d9aac4e2283762799e8', name: "arrowLeft", size: "12", color: "grey_45" })), h("span", { key: 'c207959595c107cae05a7cbe1d169357b063a29d', class: "month-nav__current" }, this.currentMonth, "\uC6D4"), h("button", { key: 'fe319c8b26d9259bcba2b1f251bb827977e6afdc', type: "button", name: "next-month", title: "Next Month", onClick: () => this.handleUpdateMonth('next') }, h("sd-icon", { key: 'af5bb1c06058b6ce22c8d7ffacace2f558bdb013', name: "arrowRight", size: "12", color: "grey_45" })))), h("div", { key: 'ca66c0d7744970364f7d5e11e61014471df3325b', class: "sd-calendar__days" }, ['일', '월', '화', '수', '목', '금', '토'].map(day => (h("div", { key: day, class: "day" }, day)))), h("div", { key: '9d42c252b8b42754aedc64156ec1dbe45200cef0', class: { 'sd-calendar__body': true, 'sd-calendar__body--has-events': !!this.events } }, [
|
|
110
110
|
...this.calendar.prevMonthDays,
|
|
111
111
|
...this.calendar.days,
|
|
112
112
|
...this.calendar.afterMonthDays,
|
|
@@ -117,7 +117,7 @@ export class SdCalendar {
|
|
|
117
117
|
return (h("div", { class: "sd-calendar__cell", key: `${day}_${idx}` }, h("sd-date-box", { date: !day ? '' : Number(day), selected: this.value === formattedDate, isToday: today === formattedDate, disabled: !day ? true : this.isDisabledDate(formattedDate), onClick: !this.isDisabledDate(formattedDate) && day
|
|
118
118
|
? () => this.handleDateClick(Number(day))
|
|
119
119
|
: undefined }), this.events && (h("div", { class: "sd-calendar__dots" }, uniqueEvents.map(eventName => (h("span", { key: eventName, class: "sd-calendar__dot", style: { backgroundColor: this.getEventColor(eventName) } })))))));
|
|
120
|
-
})), allEventNames.length > 0 && (h("div", { key: '
|
|
120
|
+
})), allEventNames.length > 0 && (h("div", { key: 'dac97204484b1def1fd3d73939ef64ef6969bce2', class: "sd-calendar__legend" }, allEventNames.map(name => (h("div", { key: name, class: "sd-calendar__legend-item" }, h("span", { class: "sd-calendar__legend-dot", style: { backgroundColor: this.getEventColor(name) } }), h("span", { class: "sd-calendar__legend-label" }, name))))))));
|
|
121
121
|
}
|
|
122
122
|
static get is() { return "sd-calendar"; }
|
|
123
123
|
static get encapsulation() { return "scoped"; }
|
|
@@ -89,7 +89,7 @@ export class SdCheckbox {
|
|
|
89
89
|
'--sd-checkbox-disabled-bg': CHECKBOX_COLORS.disabled.bg,
|
|
90
90
|
'--sd-checkbox-disabled-border': CHECKBOX_COLORS.disabled.border,
|
|
91
91
|
};
|
|
92
|
-
return (h("label", { key: '
|
|
92
|
+
return (h("label", { key: 'b343ac293abfb6a7834cccc597cd30e56e3a161c', class: this.checkboxClasses, style: cssVars }, h("input", { key: '89d3c5ec214af16680f2111e5e85fcb228ff2223', type: "checkbox", ref: el => { this.inputEl = el; }, value: this.val, checked: !!this.isChecked, disabled: this.disabled, onChange: this.handleChange, name: this.val?.toString() || 'checkbox', "aria-label": this.label || 'checkbox', "aria-checked": this.isChecked === null ? 'mixed' : this.isChecked ? 'true' : 'false', "aria-disabled": this.disabled ? 'true' : 'false' }), h("div", { key: '8eef48a269cbbf8c479d60a53996b09cc4aa8f20', class: "sd-checkbox__bg" }, this.isChecked !== false ? (h("sd-icon", { name: this.isChecked === true ? 'check' : 'minus', size: Number(CHECKBOX_LAYOUT.iconSize), color: this.disabled ? CHECKBOX_COLORS.checked.iconDisabled : CHECKBOX_COLORS.checked.icon })) : null), this.label && h("span", { key: '43bf36ec3a3890f68ef699dbb73b48eb6a98451d', class: "sd-checkbox__label" }, this.label)));
|
|
93
93
|
}
|
|
94
94
|
static get is() { return "sd-checkbox"; }
|
|
95
95
|
static get originalStyleUrls() {
|
|
@@ -23,7 +23,7 @@ export class SdDateBox {
|
|
|
23
23
|
this.mouseOver?.emit(this.date);
|
|
24
24
|
}
|
|
25
25
|
render() {
|
|
26
|
-
return (h("div", { key: '
|
|
26
|
+
return (h("div", { key: 'b14dd7c9806828807cdfc232420a30c816ffbeb2', role: "button", tabindex: this.disabled ? -1 : 0, class: {
|
|
27
27
|
'sd-date-box': true,
|
|
28
28
|
'sd-hoverable': !this.disabled || !this.selected || this.type === '',
|
|
29
29
|
'sd-date-box--disabled': this.disabled,
|
|
@@ -34,7 +34,7 @@ export class SdDateBox {
|
|
|
34
34
|
'sd-date-box--in-range': this.inRange,
|
|
35
35
|
'sd-date-box--type-start': this.type === 'start',
|
|
36
36
|
'sd-date-box--type-end': this.type === 'end',
|
|
37
|
-
}, onClick: () => this.handleClickDate(), onMouseOver: () => this.handleHoverDate() }, h("div", { key: '
|
|
37
|
+
}, onClick: () => this.handleClickDate(), onMouseOver: () => this.handleHoverDate() }, h("div", { key: 'acb1a2d51d018913e39f8fd1fc54ab85c4ce6957', class: "sd-date-box__content" }, h("div", { key: '8c9445e4268cd254d76297ac1e775697d889f721', class: "sd-date-box__label" }, this.date))));
|
|
38
38
|
}
|
|
39
39
|
static get is() { return "sd-date-box"; }
|
|
40
40
|
static get encapsulation() { return "scoped"; }
|
|
@@ -59,7 +59,7 @@ export class SdForm {
|
|
|
59
59
|
this.submitSuccess.emit();
|
|
60
60
|
}
|
|
61
61
|
render() {
|
|
62
|
-
return (h("form", { key: '
|
|
62
|
+
return (h("form", { key: '2a72e0fb172294913a22560311e8dfcc4b151968', onSubmit: e => this.onSubmit(e), class: this.formClass }, h("slot", { key: 'd0bd0c7f915e10c7fd9aa36af68b2020035a43d4' })));
|
|
63
63
|
}
|
|
64
64
|
static get is() { return "sd-form"; }
|
|
65
65
|
static get properties() {
|
|
@@ -20,21 +20,21 @@ export class SdModalContainer {
|
|
|
20
20
|
this.dispatchClose(top.modalEl);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
async open(options,
|
|
23
|
+
async open(options, modalRef) {
|
|
24
24
|
const id = `modal-${++modalIdCounter}`;
|
|
25
25
|
const modalEl = this.createConfirmModal(id, options);
|
|
26
26
|
this.attachModalEventListeners(id, modalEl);
|
|
27
|
-
this.registerEntry(id, modalEl,
|
|
27
|
+
this.registerEntry(id, modalEl, modalRef, {
|
|
28
28
|
persistent: !!options.persistent,
|
|
29
29
|
});
|
|
30
30
|
return id;
|
|
31
31
|
}
|
|
32
|
-
async createCustom(element, options,
|
|
32
|
+
async createCustom(element, options, modalRef) {
|
|
33
33
|
const id = `modal-${++modalIdCounter}`;
|
|
34
34
|
element.setAttribute('data-modal-id', id);
|
|
35
35
|
element.classList.add('sd-modal-container__modal');
|
|
36
36
|
this.attachModalEventListeners(id, element);
|
|
37
|
-
this.registerEntry(id, element,
|
|
37
|
+
this.registerEntry(id, element, modalRef, {
|
|
38
38
|
persistent: !!options.persistent,
|
|
39
39
|
});
|
|
40
40
|
return id;
|
|
@@ -47,7 +47,7 @@ export class SdModalContainer {
|
|
|
47
47
|
dispatchClose(modalEl) {
|
|
48
48
|
modalEl.dispatchEvent(new CustomEvent('sdClose'));
|
|
49
49
|
}
|
|
50
|
-
registerEntry(id, modalEl,
|
|
50
|
+
registerEntry(id, modalEl, modalRef, meta) {
|
|
51
51
|
if (this.containerDismissTimerId) {
|
|
52
52
|
clearTimeout(this.containerDismissTimerId);
|
|
53
53
|
this.containerDismissTimerId = undefined;
|
|
@@ -57,7 +57,7 @@ export class SdModalContainer {
|
|
|
57
57
|
{
|
|
58
58
|
id,
|
|
59
59
|
modalEl,
|
|
60
|
-
|
|
60
|
+
modalRef,
|
|
61
61
|
persistent: meta.persistent,
|
|
62
62
|
closing: false,
|
|
63
63
|
},
|
|
@@ -78,6 +78,9 @@ export class SdModalContainer {
|
|
|
78
78
|
});
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
|
+
async dismissById(id, reason) {
|
|
82
|
+
this.requestDismiss(id, reason);
|
|
83
|
+
}
|
|
81
84
|
async update(id, props) {
|
|
82
85
|
const entry = (this.entries ?? []).find(e => e.id === id);
|
|
83
86
|
if (!entry || entry.closing)
|
|
@@ -163,11 +166,11 @@ export class SdModalContainer {
|
|
|
163
166
|
}, ANIMATION_DURATION);
|
|
164
167
|
this.entries = (this.entries ?? []).map(item => item.id === id ? { ...item, closing: true, dismissTimerId } : item);
|
|
165
168
|
if (reason === 'confirm')
|
|
166
|
-
entry.
|
|
169
|
+
entry.modalRef._triggerOk();
|
|
167
170
|
else if (reason === 'cancel')
|
|
168
|
-
entry.
|
|
171
|
+
entry.modalRef._triggerCancel();
|
|
169
172
|
else if (reason === 'close')
|
|
170
|
-
entry.
|
|
173
|
+
entry.modalRef._triggerClose();
|
|
171
174
|
}
|
|
172
175
|
finalizeDismiss(id) {
|
|
173
176
|
const entry = (this.entries ?? []).find(item => item.id === id);
|
|
@@ -186,7 +189,7 @@ export class SdModalContainer {
|
|
|
186
189
|
this.containerDismissTimerId = undefined;
|
|
187
190
|
}, ANIMATION_DURATION);
|
|
188
191
|
}
|
|
189
|
-
entry.
|
|
192
|
+
entry.modalRef._triggerDismissed();
|
|
190
193
|
}
|
|
191
194
|
waitForModalReady(modalEl) {
|
|
192
195
|
const componentOnReady = modalEl.componentOnReady;
|
|
@@ -237,14 +240,14 @@ export class SdModalContainer {
|
|
|
237
240
|
return {
|
|
238
241
|
"open": {
|
|
239
242
|
"complexType": {
|
|
240
|
-
"signature": "(options: ConfirmModalOptions,
|
|
243
|
+
"signature": "(options: ConfirmModalOptions, modalRef: ModalDialogRefLike) => Promise<string>",
|
|
241
244
|
"parameters": [{
|
|
242
245
|
"name": "options",
|
|
243
246
|
"type": "ConfirmModalOptions",
|
|
244
247
|
"docs": ""
|
|
245
248
|
}, {
|
|
246
|
-
"name": "
|
|
247
|
-
"type": "
|
|
249
|
+
"name": "modalRef",
|
|
250
|
+
"type": "ModalDialogRefLike",
|
|
248
251
|
"docs": ""
|
|
249
252
|
}],
|
|
250
253
|
"references": {
|
|
@@ -258,11 +261,11 @@ export class SdModalContainer {
|
|
|
258
261
|
"id": "src/components/sd-modal-container/sd-modal-container.config.ts::ConfirmModalOptions",
|
|
259
262
|
"referenceLocation": "ConfirmModalOptions"
|
|
260
263
|
},
|
|
261
|
-
"
|
|
264
|
+
"ModalDialogRefLike": {
|
|
262
265
|
"location": "import",
|
|
263
266
|
"path": "./sd-modal-container.config",
|
|
264
|
-
"id": "src/components/sd-modal-container/sd-modal-container.config.ts::
|
|
265
|
-
"referenceLocation": "
|
|
267
|
+
"id": "src/components/sd-modal-container/sd-modal-container.config.ts::ModalDialogRefLike",
|
|
268
|
+
"referenceLocation": "ModalDialogRefLike"
|
|
266
269
|
}
|
|
267
270
|
},
|
|
268
271
|
"return": "Promise<string>"
|
|
@@ -274,7 +277,7 @@ export class SdModalContainer {
|
|
|
274
277
|
},
|
|
275
278
|
"createCustom": {
|
|
276
279
|
"complexType": {
|
|
277
|
-
"signature": "(element: HTMLElement, options: SdModalCreateOptions,
|
|
280
|
+
"signature": "(element: HTMLElement, options: SdModalCreateOptions, modalRef: ModalDialogRefLike) => Promise<string>",
|
|
278
281
|
"parameters": [{
|
|
279
282
|
"name": "element",
|
|
280
283
|
"type": "HTMLElement",
|
|
@@ -284,8 +287,8 @@ export class SdModalContainer {
|
|
|
284
287
|
"type": "SdModalCreateOptions",
|
|
285
288
|
"docs": ""
|
|
286
289
|
}, {
|
|
287
|
-
"name": "
|
|
288
|
-
"type": "
|
|
290
|
+
"name": "modalRef",
|
|
291
|
+
"type": "ModalDialogRefLike",
|
|
289
292
|
"docs": ""
|
|
290
293
|
}],
|
|
291
294
|
"references": {
|
|
@@ -303,11 +306,11 @@ export class SdModalContainer {
|
|
|
303
306
|
"id": "src/components/sd-modal-container/sd-modal-container.config.ts::SdModalCreateOptions",
|
|
304
307
|
"referenceLocation": "SdModalCreateOptions"
|
|
305
308
|
},
|
|
306
|
-
"
|
|
309
|
+
"ModalDialogRefLike": {
|
|
307
310
|
"location": "import",
|
|
308
311
|
"path": "./sd-modal-container.config",
|
|
309
|
-
"id": "src/components/sd-modal-container/sd-modal-container.config.ts::
|
|
310
|
-
"referenceLocation": "
|
|
312
|
+
"id": "src/components/sd-modal-container/sd-modal-container.config.ts::ModalDialogRefLike",
|
|
313
|
+
"referenceLocation": "ModalDialogRefLike"
|
|
311
314
|
}
|
|
312
315
|
},
|
|
313
316
|
"return": "Promise<string>"
|
|
@@ -317,6 +320,31 @@ export class SdModalContainer {
|
|
|
317
320
|
"tags": []
|
|
318
321
|
}
|
|
319
322
|
},
|
|
323
|
+
"dismissById": {
|
|
324
|
+
"complexType": {
|
|
325
|
+
"signature": "(id: string, reason?: \"confirm\" | \"cancel\" | \"close\") => Promise<void>",
|
|
326
|
+
"parameters": [{
|
|
327
|
+
"name": "id",
|
|
328
|
+
"type": "string",
|
|
329
|
+
"docs": ""
|
|
330
|
+
}, {
|
|
331
|
+
"name": "reason",
|
|
332
|
+
"type": "\"close\" | \"cancel\" | \"confirm\" | undefined",
|
|
333
|
+
"docs": ""
|
|
334
|
+
}],
|
|
335
|
+
"references": {
|
|
336
|
+
"Promise": {
|
|
337
|
+
"location": "global",
|
|
338
|
+
"id": "global::Promise"
|
|
339
|
+
}
|
|
340
|
+
},
|
|
341
|
+
"return": "Promise<void>"
|
|
342
|
+
},
|
|
343
|
+
"docs": {
|
|
344
|
+
"text": "",
|
|
345
|
+
"tags": []
|
|
346
|
+
}
|
|
347
|
+
},
|
|
320
348
|
"update": {
|
|
321
349
|
"complexType": {
|
|
322
350
|
"signature": "(id: string, props: Partial<ConfirmModalOptions>) => Promise<void>",
|
|
@@ -21,7 +21,7 @@ export class SdRadio {
|
|
|
21
21
|
}
|
|
22
22
|
render() {
|
|
23
23
|
const isSelected = String(this.val) === String(this.value);
|
|
24
|
-
return (h("div", { key: '
|
|
24
|
+
return (h("div", { key: 'e9d7875b19c108505e7dfd455432102c8035097f', "aria-label": String(this.val) || 'radio option', "aria-checked": isSelected ? 'true' : 'false', "aria-disabled": this.disabled ? 'true' : 'false', class: this.getRadioClasses() }, h("label", { key: `radio-${this.val}` }, h("input", { key: 'cc0aa88287000b77c2329bba2371e9e4404f8203', type: "radio", name: String(this.val), value: String(this.val), checked: isSelected, disabled: this.disabled, onInput: () => this.handleRadioChange() }), this.val != null && (h("span", { key: 'b2a371ef8bc4ccc57ffbbc6acc22bf4b9c391fc1', class: "sd-radio-group__label" }, this.label || String(this.val))))));
|
|
25
25
|
}
|
|
26
26
|
static get is() { return "sd-radio"; }
|
|
27
27
|
static get originalStyleUrls() {
|
|
@@ -36,7 +36,7 @@ export class SdRadioButtonGroup {
|
|
|
36
36
|
}
|
|
37
37
|
groupName = this.name || `sd-radio-button-group-${crypto.randomUUID()}`;
|
|
38
38
|
render() {
|
|
39
|
-
return (h("div", { key: '
|
|
39
|
+
return (h("div", { key: '419d62e718ddcecb4a901f4c4bc98b560c8c4f01', class: this.getGroupClasses(), role: "radiogroup", "aria-disabled": this.disabled.toString() }, this.options.map(option => {
|
|
40
40
|
const isSelected = this.isOptionSelected(option);
|
|
41
41
|
const isDisabled = this.isOptionDisabled(option);
|
|
42
42
|
return (h("label", { key: `radio-${option.value}`, class: this.getButtonClasses(option), "aria-label": option.label || 'radio option', "data-label": option.label }, h("input", { type: "radio", name: this.groupName, value: option.value.toString(), checked: isSelected, disabled: isDisabled, onInput: () => this.handleRadioChange(option.value, option.disabled) }), option.label && h("span", { class: "sd-radio-button-group__label" }, option.label)));
|
|
@@ -22,7 +22,7 @@ export class SdRadioGroup {
|
|
|
22
22
|
return classes.join(' ');
|
|
23
23
|
}
|
|
24
24
|
render() {
|
|
25
|
-
return (h("div", { key: '
|
|
25
|
+
return (h("div", { key: '82979426bafc24b48858588ad186dfe069616883', class: this.getGroupClasses(), role: "radiogroup" }, this.options.map(option => {
|
|
26
26
|
return (h("sd-radio", { key: `radio-${option.value}`, val: String(option.value), value: String(this.value), label: option.label, disabled: this.disabled || !!option.disabled, onSdUpdate: ({ detail }) => this.handleRadioChange(detail) }));
|
|
27
27
|
})));
|
|
28
28
|
}
|
|
@@ -141,7 +141,7 @@ export class SdSelect extends BaseDropdownEvent {
|
|
|
141
141
|
}
|
|
142
142
|
};
|
|
143
143
|
render() {
|
|
144
|
-
return (h("sd-field", { key: '
|
|
144
|
+
return (h("sd-field", { key: 'f7cd0c34188712a30389d07bde7edc7875e9923b', 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) }, h("div", { key: '460a8a23247e24a02bd25470105598914029e205', class: {
|
|
145
145
|
'sd-select': true,
|
|
146
146
|
'sd-select--disabled': this.disabled,
|
|
147
147
|
'sd-select--error': !!this.error,
|
|
@@ -392,7 +392,7 @@ export class SdSelectMultipleGroup extends BaseDropdownEvent {
|
|
|
392
392
|
});
|
|
393
393
|
}
|
|
394
394
|
render() {
|
|
395
|
-
return (h("sd-field", { key: '
|
|
395
|
+
return (h("sd-field", { key: '350c7b2df807166a1439a2151f0f168385adac4a', 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), style: { '--field-width': this.width || '200px' } }, h("div", { key: 'cce989263e1c7dcb38216e734aabe6eea643676a', class: {
|
|
396
396
|
'sd-select-multiple-group': true,
|
|
397
397
|
'sd-select-multiple-group--open': this.isOpen,
|
|
398
398
|
'sd-select-multiple-group--disabled': this.disabled,
|
|
@@ -759,16 +759,16 @@ export class SdTable {
|
|
|
759
759
|
return (h("td", { key: `virtual-${position}-spacer-${rowIdx}`, class: "sd-table__virtual-spacer", style: this.getSpacerCellStyle(spacerWidth), "aria-hidden": "true" }, h("div", { class: "sd-table__skeleton-cell" })));
|
|
760
760
|
}
|
|
761
761
|
render() {
|
|
762
|
-
return (h(Fragment, { key: '
|
|
762
|
+
return (h(Fragment, { key: 'f3e4930d36d080fd546dddc1e80190b831e93012' }, h("div", { key: 'ad2f798951631319190d93f83e25b87f871e58de', class: "sd-table__wrapper", style: {
|
|
763
763
|
'--table-width': this.width,
|
|
764
764
|
'--table-height': this.height,
|
|
765
|
-
} }, h("div", { key: '
|
|
765
|
+
} }, h("div", { key: 'c4b6d4080f1416d1c88ab1413c66848bdafe9019', class: "sd-table__container", style: {
|
|
766
766
|
'--table-container-height': `calc(${this.height} - ${this.pagination && this.innerRows.length > 0 ? 48 : 0}px)`,
|
|
767
|
-
} }, h("div", { key: '
|
|
767
|
+
} }, h("div", { key: '3aacc27970b0c6d8b700063c0af7c57175e2cb22', class: {
|
|
768
768
|
'sd-table__middle': true,
|
|
769
769
|
'sd-table__middle--scrollable': this.paginatedRows.length > 0,
|
|
770
770
|
'sd-table__middle--loading': this.isLoading,
|
|
771
|
-
} }, this.isLoading && (h("div", { key: '
|
|
771
|
+
} }, this.isLoading && (h("div", { key: '25fca304a4e8ebf43aeeff20de3e3446d25e1ffb', class: "sd-table__middle--loading__spinner" }, h("sd-loading-spinner", { key: '48b0adad60cf422b884557b53097c28a4f0b8879' }))), h("table", { key: 'ec4328a1f43c865de642cc5814fbdef6a374b7e3', part: "table", class: this.sdTableClasses }, this.renderHead(), this.renderBody())), !this.paginatedRows.length && (h("div", { key: 'ba362ecb9fb8134a15ff3d0a3b8e6a523e94166a', class: "sd-table__bottom" }, h("div", { key: 'ca5c2e0b19a1e301ac159588436ef24eecfb6365', class: "sd-table__no-data" }, h("slot", { key: '68564a60a05833ba87743212d7189eef6e179fb4', name: "no-data" }, this.noDataLabel))))), this.pagination && this.innerRows.length > 0 && (h("div", { key: '88c3c7362234c20a60f6437ecd79d4c75b2caa6e', class: "sd-table__pagination" }, h("sd-pagination", { key: 'c3c8c435fcb752f2b1139981bb764cf4dfb153ab', currentPage: !this.useInternalPagination ? this.pagination.page : this.currentPage, lastPage: !this.useInternalPagination ? this.pagination.lastPage : this.lastPageNumber, onSdPageChange: (e) => this.changePage(e.detail) }), this.useRowsPerPageSelect && (h("sd-select", { key: '03801039397a31321e5af96c2bd2d2900151240e', value: this.pagination.rowsPerPage, options: this.rowsPerPageOption, width: "128px", onSdUpdate: (e) => this.changeRowsPerPage(e.detail.value) })))))));
|
|
772
772
|
}
|
|
773
773
|
static get is() { return "sd-table"; }
|
|
774
774
|
static get originalStyleUrls() {
|
|
@@ -39,7 +39,7 @@ export class SdTabs {
|
|
|
39
39
|
return `square_${this.size}_${color}`;
|
|
40
40
|
}
|
|
41
41
|
render() {
|
|
42
|
-
return (h("div", { key: '
|
|
42
|
+
return (h("div", { key: '74a25ee4311c84e79f4918b884385f27d6af6313', class: this.getContainerClasses() }, this.tabs.map((tab, index) => {
|
|
43
43
|
const badgeName = this.getBadgeName(tab);
|
|
44
44
|
return (h("div", { key: `tab-${index}`, class: this.getTabClasses(tab), "aria-label": tab.label || 'tab', onClick: () => this.handleTabClick(tab.value) }, h("span", { "data-label": tab.label, class: "sd-tabs__label" }, tab.label), tab.badge && h("sd-tag", { name: badgeName, label: tab.badge.toString() })));
|
|
45
45
|
})));
|
package/dist/collection/index.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
const MODAL_CONTAINER_TAG = 'sd-modal-container';
|
|
2
|
-
|
|
2
|
+
const REASON_TO_CONTAINER = {
|
|
3
|
+
ok: 'confirm',
|
|
4
|
+
cancel: 'cancel',
|
|
5
|
+
close: 'close',
|
|
6
|
+
};
|
|
7
|
+
class ModalDialogRefImpl {
|
|
3
8
|
modalId;
|
|
4
9
|
okFn;
|
|
5
10
|
cancelFn;
|
|
@@ -7,6 +12,7 @@ class ModalDialogChainImpl {
|
|
|
7
12
|
dismissedFn;
|
|
8
13
|
containerRef;
|
|
9
14
|
pendingActions = [];
|
|
15
|
+
dismissRequested = false;
|
|
10
16
|
constructor(id, containerRef) {
|
|
11
17
|
this.modalId = id;
|
|
12
18
|
this.containerRef = containerRef;
|
|
@@ -33,6 +39,25 @@ class ModalDialogChainImpl {
|
|
|
33
39
|
});
|
|
34
40
|
return this;
|
|
35
41
|
}
|
|
42
|
+
ok() {
|
|
43
|
+
return this.dismiss('ok');
|
|
44
|
+
}
|
|
45
|
+
cancel() {
|
|
46
|
+
return this.dismiss('cancel');
|
|
47
|
+
}
|
|
48
|
+
close() {
|
|
49
|
+
return this.dismiss('close');
|
|
50
|
+
}
|
|
51
|
+
dismiss(reason = 'close') {
|
|
52
|
+
if (this.dismissRequested)
|
|
53
|
+
return this;
|
|
54
|
+
this.dismissRequested = true;
|
|
55
|
+
const containerReason = REASON_TO_CONTAINER[reason];
|
|
56
|
+
this.runOrQueue(() => {
|
|
57
|
+
this.containerRef.dismissById?.(this.modalId, containerReason);
|
|
58
|
+
});
|
|
59
|
+
return this;
|
|
60
|
+
}
|
|
36
61
|
_triggerOk() {
|
|
37
62
|
this.okFn?.();
|
|
38
63
|
}
|
|
@@ -96,28 +121,39 @@ async function whenReady(el) {
|
|
|
96
121
|
return Promise.resolve();
|
|
97
122
|
throw new Error('[sdModal] `sd-modal-container` is registered but not ready to open dialogs.');
|
|
98
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* 프레임워크 래퍼 전용 헬퍼. Vue/React 어댑터가 modalRef 인스턴스를 먼저
|
|
126
|
+
* 생성해 컴포넌트 props 로 주입한 뒤, 실제 element 를 컨테이너에 attach
|
|
127
|
+
* 할 수 있도록 "modalRef 선공급" 경로를 제공합니다. 공개 API 가 아니며
|
|
128
|
+
* 시그니처가 바뀔 수 있습니다.
|
|
129
|
+
*/
|
|
130
|
+
export function _createSdModalRef() {
|
|
131
|
+
const container = getContainer();
|
|
132
|
+
return new ModalDialogRefImpl('', container);
|
|
133
|
+
}
|
|
134
|
+
export function _attachSdModalWithRef(modalRef, input) {
|
|
135
|
+
const { component, persist } = input;
|
|
136
|
+
const container = getContainer();
|
|
137
|
+
const options = { persistent: persist };
|
|
138
|
+
whenReady(container).then(async () => {
|
|
139
|
+
const id = await container.createCustom(component, options, modalRef);
|
|
140
|
+
modalRef._setId(id);
|
|
141
|
+
});
|
|
142
|
+
}
|
|
99
143
|
export const sdModal = {
|
|
100
144
|
confirm(options) {
|
|
101
145
|
const container = getContainer();
|
|
102
|
-
const
|
|
146
|
+
const modalRef = new ModalDialogRefImpl('', container);
|
|
103
147
|
whenReady(container).then(async () => {
|
|
104
|
-
const id = await container.open(options,
|
|
105
|
-
|
|
148
|
+
const id = await container.open(options, modalRef);
|
|
149
|
+
modalRef._setId(id);
|
|
106
150
|
});
|
|
107
|
-
return
|
|
151
|
+
return modalRef;
|
|
108
152
|
},
|
|
109
153
|
create(input) {
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
const options = {
|
|
114
|
-
persistent: persist,
|
|
115
|
-
};
|
|
116
|
-
whenReady(container).then(async () => {
|
|
117
|
-
const id = await container.createCustom(component, options, chain);
|
|
118
|
-
chain._setId(id);
|
|
119
|
-
});
|
|
120
|
-
return chain;
|
|
154
|
+
const modalRef = _createSdModalRef();
|
|
155
|
+
_attachSdModalWithRef(modalRef, input);
|
|
156
|
+
return modalRef;
|
|
121
157
|
},
|
|
122
158
|
configure(options) {
|
|
123
159
|
getContainer(options);
|
package/dist/components/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{g as getAssetPath,r as render,s as setAssetPath,a as setNonce,b as setPlatformOptions}from"./p-D-pFdq6g.js";let t=null;function n(t,n){n&&(n.position&&t.setAttribute("position",n.position),null!=n.maxVisible&&t.setAttribute("max-visible",n.maxVisible+""),null!=n.defaultDuration&&t.setAttribute("default-duration",n.defaultDuration+""),null!=n.zIndex&&t.setAttribute("z-index",n.zIndex+""))}function e(e){return t&&document.body.contains(t)?(n(t,e),t):(t=document.createElement("sd-toast-container"),n(t,e),document.body.appendChild(t),t)}function
|
|
1
|
+
export{g as getAssetPath,r as render,s as setAssetPath,a as setNonce,b as setPlatformOptions}from"./p-D-pFdq6g.js";let t=null;function n(t,n){n&&(n.position&&t.setAttribute("position",n.position),null!=n.maxVisible&&t.setAttribute("max-visible",n.maxVisible+""),null!=n.defaultDuration&&t.setAttribute("default-duration",n.defaultDuration+""),null!=n.zIndex&&t.setAttribute("z-index",n.zIndex+""))}function e(e){return t&&document.body.contains(t)?(n(t,e),t):(t=document.createElement("sd-toast-container"),n(t,e),document.body.appendChild(t),t)}function i(t){return"function"==typeof t.create?Promise.resolve():new Promise((n=>{const e=()=>{"function"==typeof t.create?n():requestAnimationFrame(e)};requestAnimationFrame(e)}))}const o={async create(t,n,s){const{globalOptions:o,...r}=s??{},c=e(o);return await i(c),c.create({message:t,type:n,...r})},async dismiss(n){if(t)return await i(t),t.dismiss(n)},async dismissAll(){if(t)return await i(t),t.dismissAll()},configure(t){e(t)}},c="sd-modal-container",u={ok:"confirm",cancel:"cancel",close:"close"};class d{modalId;okFn;cancelFn;closeFn;dismissedFn;containerRef;pendingActions=[];dismissRequested=!1;constructor(t,n){this.modalId=t,this.containerRef=n}onOk(t){return this.okFn=t,this}onCancel(t){return this.cancelFn=t,this}onClose(t){return this.closeFn=t,this}onDismissed(t){return this.dismissedFn=t,this}update(t){return this.runOrQueue((()=>{this.containerRef.update?.(this.modalId,t)})),this}ok(){return this.dismiss("ok")}cancel(){return this.dismiss("cancel")}close(){return this.dismiss("close")}dismiss(t="close"){if(this.dismissRequested)return this;this.dismissRequested=!0;const n=u[t];return this.runOrQueue((()=>{this.containerRef.dismissById?.(this.modalId,n)})),this}_triggerOk(){this.okFn?.()}_triggerCancel(){this.cancelFn?.()}_triggerClose(){this.closeFn?.()}_triggerDismissed(){this.dismissedFn?.()}_setId(t){this.modalId=t;const n=[...this.pendingActions];this.pendingActions=[],n.forEach((t=>t()))}runOrQueue(t){this.modalId?t():this.pendingActions.push(t)}}let l=null;function m(t,n){n&&null!=n.zIndex&&t.style.setProperty("--sd-modal-container-z-index",n.zIndex+"")}function h(t){return function(){if("undefined"==typeof window||"undefined"==typeof document||"undefined"==typeof customElements)throw Error("[sdModal] Browser APIs are unavailable. Use `sdModal` only on the client.")}(),function(){if(!customElements.get(c))throw Error("[sdModal] `sd-modal-container` is not registered. Call `defineCustomElements(window)` before using `sdModal`.")}(),l&&document.body.contains(l)?(m(l,t),l):(l=document.createElement(c),m(l,t),document.body.appendChild(l),l)}async function f(t){if(await customElements.whenDefined(c),"function"==typeof t.open)return Promise.resolve();throw Error("[sdModal] `sd-modal-container` is registered but not ready to open dialogs.")}function p(){const t=h();return new d("",t)}function w(t,n){const{component:e,persist:s}=n,i=h(),o={persistent:s};f(i).then((async()=>{const n=await i.createCustom(e,o,t);t._setId(n)}))}const y={confirm(t){const n=h(),e=new d("",n);return f(n).then((async()=>{const s=await n.open(t,e);e._setId(s)})),e},create(t){const n=p();return w(n,t),n},configure(t){h(t)}};export{w as _attachSdModalWithRef,p as _createSdModalRef,y as sdModal,o as sdToast}
|