@sellmate/design-system 1.0.77 → 1.0.78
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 +2 -2
- package/dist/cjs/{index-CaGGRpd8.js → index--F2wGuAi.js} +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/sd-action-modal.cjs.entry.js +1 -1
- package/dist/cjs/sd-badge.cjs.entry.js +1 -1
- package/dist/cjs/sd-barcode-input.cjs.entry.js +1 -1
- package/dist/cjs/sd-button-v2_2.cjs.entry.js +1 -1
- package/dist/cjs/sd-button_4.cjs.entry.js +2 -2
- package/dist/cjs/sd-calendar.cjs.entry.js +1 -1
- package/dist/cjs/sd-card.cjs.entry.js +1 -1
- package/dist/cjs/sd-checkbox.cjs.entry.js +1 -1
- package/dist/cjs/sd-chip.cjs.entry.js +1 -1
- package/dist/cjs/sd-circle-progress.cjs.entry.js +3 -3
- package/dist/cjs/sd-confirm-modal_2.cjs.entry.js +1 -1
- package/dist/cjs/sd-date-box.cjs.entry.js +1 -1
- package/dist/cjs/sd-date-picker-calendar.cjs.entry.js +2 -2
- package/dist/cjs/sd-date-picker-trigger.cjs.entry.js +2 -2
- package/dist/cjs/sd-date-picker.cjs.entry.js +2 -2
- package/dist/cjs/{sd-date-picker.config-B705zdZd.js → sd-date-picker.config-CRgCT5dn.js} +4 -2
- package/dist/cjs/sd-date-range-picker-calendar.cjs.entry.js +2 -2
- package/dist/cjs/sd-date-range-picker.cjs.entry.js +2 -2
- package/dist/cjs/sd-dropdown-button.cjs.entry.js +4 -4
- package/dist/cjs/sd-file-picker.cjs.entry.js +1 -1
- package/dist/cjs/sd-form.cjs.entry.js +1 -1
- package/dist/cjs/sd-ghost-button.cjs.entry.js +1 -1
- package/dist/cjs/sd-guide.cjs.entry.js +3 -3
- package/dist/cjs/sd-input.cjs.entry.js +1 -1
- package/dist/cjs/sd-linear-progress.cjs.entry.js +3 -3
- package/dist/cjs/sd-loading-container.cjs.entry.js +1 -1
- package/dist/cjs/sd-modal-container.cjs.entry.js +1 -1
- package/dist/cjs/sd-number-input.cjs.entry.js +1 -1
- package/dist/cjs/sd-pagination_5.cjs.entry.js +17 -5
- package/dist/cjs/sd-popover.cjs.entry.js +2 -2
- package/dist/cjs/sd-portal.cjs.entry.js +1 -1
- package/dist/cjs/sd-radio-button.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-list-item_4.cjs.entry.js +1 -1
- package/dist/cjs/sd-switch.cjs.entry.js +1 -1
- package/dist/cjs/sd-table.cjs.entry.js +78 -13
- package/dist/cjs/{sd-table.config-hnNodd18.js → sd-table.config-Cb0Ot3C6.js} +1 -1
- package/dist/cjs/sd-tabs.cjs.entry.js +1 -1
- package/dist/cjs/sd-tag.cjs.entry.js +1 -1
- package/dist/cjs/sd-td.cjs.entry.js +37 -6
- package/dist/cjs/sd-text-link.cjs.entry.js +1 -1
- package/dist/cjs/sd-textarea.cjs.entry.js +1 -1
- package/dist/cjs/sd-toast-container.cjs.entry.js +1 -1
- package/dist/cjs/sd-toast.cjs.entry.js +2 -3
- package/dist/cjs/sd-toggle.cjs.entry.js +1 -1
- package/dist/cjs/{system-DRemSdU1.js → system-DpTN1vBC.js} +1 -1
- package/dist/cjs/{tooltipArrow-BEff0q3z.js → tooltipArrow-D1-wcNm1.js} +1 -1
- package/dist/collection/components/sd-circle-progress/sd-circle-progress.config.js +1 -1
- package/dist/collection/components/sd-dropdown-button/sd-dropdown-button.config.js +2 -2
- package/dist/collection/components/sd-guide/sd-guide.config.js +1 -1
- package/dist/collection/components/sd-linear-progress/sd-linear-progress.config.js +1 -1
- package/dist/collection/components/sd-table/sd-table.config.js +1 -2
- package/dist/collection/components/sd-table/sd-table.js +75 -10
- package/dist/collection/components/sd-table/sd-td/sd-td.js +55 -5
- package/dist/collection/components/sd-table/sd-tr/sd-tr.js +14 -2
- package/dist/components/index.js +1 -1
- package/dist/components/{p-C52iEAqd.js → p-B8jXOXtJ.js} +1 -1
- package/dist/components/{p-mqa9-iql.js → p-BE6TxbtX.js} +1 -1
- package/dist/components/{p-BeNJfxnb.js → p-BJsHakU2.js} +1 -1
- package/dist/components/{p-CJAQuJik.js → p-BStczlLa.js} +1 -1
- package/dist/components/{p-ZH78tQXS.js → p-BcMNA89i.js} +1 -1
- package/dist/components/{p-BEOrkEV1.js → p-BheX6lAy.js} +1 -1
- package/dist/components/{p-NlCzTjK4.js → p-BmYM7-4v.js} +1 -1
- package/dist/components/{p-CkgQbCMR.js → p-BppjYHF6.js} +1 -1
- package/dist/components/{p-BfoLbEZx.js → p-Bvq0Vpln.js} +1 -1
- package/dist/components/{p-D66nhMt3.js → p-BwWDMpJc.js} +1 -1
- package/dist/components/{p-DDDZWrWj.js → p-C5qZtNLl.js} +1 -1
- package/dist/components/{p-BM_PRj8W.js → p-C7DajKYn.js} +1 -1
- package/dist/components/p-CZ4ltUOw.js +1 -0
- package/dist/components/{p-CNm5Qbf-.js → p-CeVMl_M9.js} +1 -1
- package/dist/components/{p-B6KZfiQ5.js → p-D1DpOp6M.js} +1 -1
- package/dist/components/p-D3gjBBCU.js +1 -0
- package/dist/components/{p-ZLsQA11g.js → p-DC-6inj0.js} +1 -1
- package/dist/components/p-DRF0He-x.js +1 -0
- package/dist/components/{p-CQy5JErK.js → p-Dcc2Vm6z.js} +1 -1
- package/dist/components/{p-BJJvCBQs.js → p-DegvQLTF.js} +1 -1
- package/dist/components/{p-DK3vj3bG.js → p-Dey-lS6x.js} +1 -1
- package/dist/components/{p-hTUSl23P.js → p-DfH_fO01.js} +1 -1
- package/dist/components/{p-eGToaKCt.js → p-DkJqVXpD.js} +1 -1
- package/dist/components/{p-DcuLMUdl.js → p-DngV3MT1.js} +1 -1
- package/dist/components/{p-BynnUMVZ.js → p-EbjZr2OA.js} +1 -1
- package/dist/components/{p-CvnC61M9.js → p-LwWOleLJ.js} +1 -1
- package/dist/components/{p-DxXwz3cY.js → p-Nvx13YlG.js} +1 -1
- package/dist/components/{p-D2FOkhao.js → p-TwGlKfsC.js} +1 -1
- package/dist/components/{p-D1SJ2TMu.js → p-ZMpCZhXP.js} +1 -1
- package/dist/components/{p-RpjjrX78.js → p-dNJIFthT.js} +1 -1
- package/dist/components/{p-CJqZcEqD.js → p-q0VWISKA.js} +1 -1
- package/dist/components/{p-C8Dy_x5h.js → p-xnLvZ-xn.js} +1 -1
- package/dist/components/sd-action-modal.js +1 -1
- package/dist/components/sd-badge.js +1 -1
- package/dist/components/sd-barcode-input.js +1 -1
- 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-chip.js +1 -1
- package/dist/components/sd-circle-progress.js +1 -1
- package/dist/components/sd-confirm-modal.js +1 -1
- package/dist/components/sd-date-box.js +1 -1
- package/dist/components/sd-date-picker-calendar.js +1 -1
- package/dist/components/sd-date-picker-trigger.js +1 -1
- package/dist/components/sd-date-picker.js +1 -1
- package/dist/components/sd-date-range-picker-calendar.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-form.js +1 -1
- package/dist/components/sd-ghost-button.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-linear-progress.js +1 -1
- package/dist/components/sd-loading-container.js +1 -1
- package/dist/components/sd-loading-modal.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-radio-button.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-list-item-search.js +1 -1
- package/dist/components/sd-select-list-item.js +1 -1
- package/dist/components/sd-select-listbox.js +1 -1
- package/dist/components/sd-select-trigger.js +1 -1
- package/dist/components/sd-select.js +1 -1
- package/dist/components/sd-switch.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-tbody.js +1 -1
- package/dist/components/sd-td.js +1 -1
- package/dist/components/sd-text-link.js +1 -1
- package/dist/components/sd-textarea.js +1 -1
- package/dist/components/sd-thead.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.js +1 -1
- package/dist/components/sd-tooltip.js +1 -1
- package/dist/components/sd-tr.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/{p-68d0fa15.entry.js → p-0356c195.entry.js} +1 -1
- package/dist/design-system/{p-504033e8.entry.js → p-045bc426.entry.js} +1 -1
- package/dist/design-system/{p-42906763.entry.js → p-12dfd239.entry.js} +1 -1
- package/dist/design-system/{p-3f9d60a0.entry.js → p-16d3a485.entry.js} +1 -1
- package/dist/design-system/{p-80c51996.entry.js → p-1706ed6f.entry.js} +1 -1
- package/dist/design-system/{p-43ffe7b0.entry.js → p-182548f7.entry.js} +1 -1
- package/dist/design-system/{p-c863a31d.entry.js → p-1a79edce.entry.js} +1 -1
- package/dist/design-system/{p-732ee178.entry.js → p-1cf87e87.entry.js} +1 -1
- package/dist/design-system/{p-120df622.entry.js → p-25a08e98.entry.js} +1 -1
- package/dist/design-system/{p-8abc2413.entry.js → p-2812b9ce.entry.js} +1 -1
- package/dist/design-system/{p-ab5a94c8.entry.js → p-33bc3176.entry.js} +1 -1
- package/dist/design-system/p-38f661ea.entry.js +1 -0
- package/dist/design-system/{p-a69d6a99.entry.js → p-3f7bc660.entry.js} +1 -1
- package/dist/design-system/{p-c21f30de.entry.js → p-429dab5c.entry.js} +1 -1
- package/dist/design-system/p-455dccf5.entry.js +1 -0
- package/dist/design-system/{p-bab814c5.entry.js → p-59313838.entry.js} +1 -1
- package/dist/design-system/{p-e84d1bac.entry.js → p-6af01ab0.entry.js} +1 -1
- package/dist/design-system/{p-7d892b68.entry.js → p-6bfe3612.entry.js} +1 -1
- package/dist/design-system/{p-42a8f8a2.entry.js → p-70d4903f.entry.js} +1 -1
- package/dist/design-system/{p-fbb7e090.entry.js → p-767e99f9.entry.js} +1 -1
- package/dist/design-system/{p-d8bb2cb4.entry.js → p-797517b5.entry.js} +1 -1
- package/dist/design-system/p-7c370335.entry.js +1 -0
- package/dist/design-system/{p-cab35b9a.entry.js → p-7fe8be6a.entry.js} +1 -1
- package/dist/design-system/{p-28b727df.entry.js → p-83b262dc.entry.js} +1 -1
- package/dist/design-system/{p-ebbffddb.entry.js → p-881adaa5.entry.js} +1 -1
- package/dist/design-system/{p-704dc1f1.entry.js → p-88d7303c.entry.js} +1 -1
- package/dist/design-system/{p-f06038fd.entry.js → p-8a601e0f.entry.js} +1 -1
- package/dist/design-system/{p-DDDZWrWj.js → p-C5qZtNLl.js} +1 -1
- package/dist/design-system/p-CZ4ltUOw.js +1 -0
- package/dist/design-system/p-Cnwbjz1F.js +2 -0
- package/dist/design-system/{p-DG7d45mX.js → p-DnCBBIoq.js} +1 -1
- package/dist/design-system/{p-889971bc.entry.js → p-a82be987.entry.js} +1 -1
- package/dist/design-system/{p-b9a870bf.entry.js → p-b917c82a.entry.js} +1 -1
- package/dist/design-system/{p-809e616c.entry.js → p-b9f00eef.entry.js} +1 -1
- package/dist/design-system/{p-e04302a2.entry.js → p-bcb53788.entry.js} +1 -1
- package/dist/design-system/{p-dd63e10f.entry.js → p-c24344ac.entry.js} +1 -1
- package/dist/design-system/{p-f80d10ad.entry.js → p-d76192bd.entry.js} +1 -1
- package/dist/design-system/{p-4ad9a5b8.entry.js → p-d9d8c51b.entry.js} +1 -1
- package/dist/design-system/p-de67937d.entry.js +1 -0
- package/dist/design-system/{p-ec02b3e8.entry.js → p-e5cebccd.entry.js} +1 -1
- package/dist/design-system/{p-feb84f87.entry.js → p-ea5e6c2c.entry.js} +1 -1
- package/dist/design-system/p-ead3e688.entry.js +1 -0
- package/dist/design-system/{p-ae626d30.entry.js → p-eeb1cac2.entry.js} +1 -1
- package/dist/design-system/{p-6f9b0b32.entry.js → p-f1a74359.entry.js} +1 -1
- package/dist/design-system/{p-2cd2fb76.entry.js → p-f44786a9.entry.js} +1 -1
- package/dist/design-system/p-f522c91d.entry.js +1 -0
- package/dist/design-system/{p-970f9ea5.entry.js → p-f69c7539.entry.js} +1 -1
- package/dist/design-system/{p-67f88b1a.entry.js → p-fe9cef6a.entry.js} +1 -1
- package/dist/esm/design-system.js +3 -3
- package/dist/esm/{index-BHmXH7dZ.js → index-Cnwbjz1F.js} +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/sd-action-modal.entry.js +1 -1
- package/dist/esm/sd-badge.entry.js +1 -1
- package/dist/esm/sd-barcode-input.entry.js +1 -1
- package/dist/esm/sd-button-v2_2.entry.js +1 -1
- package/dist/esm/sd-button_4.entry.js +2 -2
- package/dist/esm/sd-calendar.entry.js +1 -1
- package/dist/esm/sd-card.entry.js +1 -1
- package/dist/esm/sd-checkbox.entry.js +1 -1
- package/dist/esm/sd-chip.entry.js +1 -1
- package/dist/esm/sd-circle-progress.entry.js +3 -3
- package/dist/esm/sd-confirm-modal_2.entry.js +1 -1
- package/dist/esm/sd-date-box.entry.js +1 -1
- package/dist/esm/sd-date-picker-calendar.entry.js +2 -2
- package/dist/esm/sd-date-picker-trigger.entry.js +2 -2
- package/dist/esm/{sd-date-picker.config-DMbVR8K4.js → sd-date-picker.config-C2fDbE9d.js} +4 -2
- package/dist/esm/sd-date-picker.entry.js +2 -2
- package/dist/esm/sd-date-range-picker-calendar.entry.js +2 -2
- package/dist/esm/sd-date-range-picker.entry.js +2 -2
- package/dist/esm/sd-dropdown-button.entry.js +4 -4
- package/dist/esm/sd-file-picker.entry.js +1 -1
- package/dist/esm/sd-form.entry.js +1 -1
- package/dist/esm/sd-ghost-button.entry.js +1 -1
- package/dist/esm/sd-guide.entry.js +3 -3
- package/dist/esm/sd-input.entry.js +1 -1
- package/dist/esm/sd-linear-progress.entry.js +3 -3
- package/dist/esm/sd-loading-container.entry.js +1 -1
- package/dist/esm/sd-modal-container.entry.js +1 -1
- package/dist/esm/sd-number-input.entry.js +1 -1
- package/dist/esm/sd-pagination_5.entry.js +17 -5
- package/dist/esm/sd-popover.entry.js +2 -2
- package/dist/esm/sd-portal.entry.js +1 -1
- package/dist/esm/sd-radio-button.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-list-item_4.entry.js +1 -1
- package/dist/esm/sd-switch.entry.js +1 -1
- package/dist/esm/{sd-table.config-DKkzCQwJ.js → sd-table.config-Bj-EEo7N.js} +1 -1
- package/dist/esm/sd-table.entry.js +78 -13
- package/dist/esm/sd-tabs.entry.js +1 -1
- package/dist/esm/sd-tag.entry.js +1 -1
- package/dist/esm/sd-td.entry.js +37 -6
- package/dist/esm/sd-text-link.entry.js +1 -1
- package/dist/esm/sd-textarea.entry.js +1 -1
- package/dist/esm/sd-toast-container.entry.js +1 -1
- package/dist/esm/sd-toast.entry.js +2 -3
- package/dist/esm/sd-toggle.entry.js +1 -1
- package/dist/esm/{system-CZxeqYuw.js → system-CZ4ltUOw.js} +1 -1
- package/dist/esm/{tooltipArrow-DZ-N5HBq.js → tooltipArrow-D8sr81Xw.js} +1 -1
- package/dist/types/components/sd-table/sd-table.d.ts +8 -0
- package/dist/types/components/sd-table/sd-td/sd-td.d.ts +5 -2
- package/dist/types/components/sd-table/sd-tr/sd-tr.d.ts +1 -0
- package/dist/types/components.d.ts +3 -0
- package/hydrate/index.js +139 -29
- package/hydrate/index.mjs +139 -29
- package/package.json +1 -1
- package/dist/components/p-BR_ZAr48.js +0 -1
- package/dist/components/p-Bm8Fue-a.js +0 -1
- package/dist/components/p-CZxeqYuw.js +0 -1
- package/dist/design-system/p-400b3676.entry.js +0 -1
- package/dist/design-system/p-41ea33fb.entry.js +0 -1
- package/dist/design-system/p-64d3c984.entry.js +0 -1
- package/dist/design-system/p-6dc47f4c.entry.js +0 -1
- package/dist/design-system/p-BHmXH7dZ.js +0 -2
- package/dist/design-system/p-CZxeqYuw.js +0 -1
- package/dist/design-system/p-cea424f6.entry.js +0 -1
- package/dist/design-system/p-ed1c4625.entry.js +0 -1
- /package/dist/components/{p-DMbVR8K4.js → p-C2fDbE9d.js} +0 -0
- /package/dist/design-system/{p-DMbVR8K4.js → p-C2fDbE9d.js} +0 -0
|
@@ -59,6 +59,36 @@ export class SdTable {
|
|
|
59
59
|
onScroll;
|
|
60
60
|
// 키: `${rowKey}::${field}` → { rowspan, colspan }
|
|
61
61
|
spanRegistry = new Map();
|
|
62
|
+
// 키: `${rowKey}::${field}` → sd-td의 sdClass 문자열
|
|
63
|
+
// sd-tr가 td를 그릴 때 머지해서 셀-단위 커스텀 클래스를 적용한다.
|
|
64
|
+
cellClassRegistry = new Map();
|
|
65
|
+
// rowKey 문자열 → rows 배열에서의 visual index.
|
|
66
|
+
// rowspan 위쪽 행 스캔에서 "내 위에 있느냐"를 판정하기 위한 시각적 순서 소스.
|
|
67
|
+
// rows prop이 있으면 채워지고, 없으면 비어 있어 Number(rowKey) fallback이 사용된다.
|
|
68
|
+
rowIndexMap = new Map();
|
|
69
|
+
rebuildRowIndexMap() {
|
|
70
|
+
this.rowIndexMap.clear();
|
|
71
|
+
if (!Array.isArray(this.rows))
|
|
72
|
+
return;
|
|
73
|
+
const field = this.rowKey;
|
|
74
|
+
this.rows.forEach((r, i) => {
|
|
75
|
+
const k = r?.[field];
|
|
76
|
+
if (k == null)
|
|
77
|
+
return;
|
|
78
|
+
this.rowIndexMap.set(String(k), i);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
// rowKey의 시각적 행 인덱스를 돌려준다.
|
|
82
|
+
// 1) rows 기반 맵에 있으면 그 값 (임의 문자열 rowKey 지원)
|
|
83
|
+
// 2) 없으면 Number(rowKey) fallback (rows prop 없이 슬롯-온리 + 숫자 rowKey 사용 패턴)
|
|
84
|
+
// 3) 둘 다 안 되면 null — rowspan 평가 스킵
|
|
85
|
+
resolveRowIndex(rowKey) {
|
|
86
|
+
const fromMap = this.rowIndexMap.get(rowKey);
|
|
87
|
+
if (fromMap !== undefined)
|
|
88
|
+
return fromMap;
|
|
89
|
+
const n = Number(rowKey);
|
|
90
|
+
return Number.isFinite(n) ? n : null;
|
|
91
|
+
}
|
|
62
92
|
toFiniteNumber(value, fallback) {
|
|
63
93
|
const n = typeof value === 'number' ? value : Number(value);
|
|
64
94
|
return Number.isFinite(n) ? n : fallback;
|
|
@@ -105,10 +135,14 @@ export class SdTable {
|
|
|
105
135
|
if (!Array.isArray(newRows))
|
|
106
136
|
return;
|
|
107
137
|
this.rowCount = newRows.length;
|
|
138
|
+
this.rebuildRowIndexMap();
|
|
108
139
|
if (this.useVirtualScroll)
|
|
109
140
|
this.propagateVirtualUpdate(true);
|
|
110
141
|
this.pushRowsToChildren(newRows);
|
|
111
142
|
}
|
|
143
|
+
handleRowKeyChange() {
|
|
144
|
+
this.rebuildRowIndexMap();
|
|
145
|
+
}
|
|
112
146
|
handleTableIdChange() {
|
|
113
147
|
this.syncTableIdAttribute();
|
|
114
148
|
}
|
|
@@ -149,6 +183,7 @@ export class SdTable {
|
|
|
149
183
|
this.detectChildren();
|
|
150
184
|
this.innerSelected = new Set(this.selected || []);
|
|
151
185
|
this.columnWidths = (this.columns || []).map(c => parseInt(c.width || '120', 10));
|
|
186
|
+
this.rebuildRowIndexMap();
|
|
152
187
|
if (this.pagination?.page) {
|
|
153
188
|
this.currentPage = this.pagination.page;
|
|
154
189
|
}
|
|
@@ -174,6 +209,9 @@ export class SdTable {
|
|
|
174
209
|
el.getSpanSync = this.getSpanSync.bind(this);
|
|
175
210
|
el.isCoveredSync = this.isCoveredSync.bind(this);
|
|
176
211
|
el.hasRowspanSync = this.hasRowspanSync.bind(this);
|
|
212
|
+
el.registerCellClassSync = this.registerCellClassSync.bind(this);
|
|
213
|
+
el.unregisterCellClassSync = this.unregisterCellClassSync.bind(this);
|
|
214
|
+
el.getCellClassSync = this.getCellClassSync.bind(this);
|
|
177
215
|
if (Array.isArray(this.rows)) {
|
|
178
216
|
this.rowCount = this.rows.length;
|
|
179
217
|
this.pushRowsToChildren(this.rows);
|
|
@@ -509,6 +547,28 @@ export class SdTable {
|
|
|
509
547
|
getSpanSync(rowKey, field) {
|
|
510
548
|
return this.spanRegistry.get(this.spanKey(rowKey, field));
|
|
511
549
|
}
|
|
550
|
+
// sd-td의 sdClass 등록. 빈/공백만 있는 값은 해제로 취급.
|
|
551
|
+
// span과 달리 다른 셀에 영향이 없으므로 형제 sd-tr 전체를 재렌더하지 않고,
|
|
552
|
+
// sd-td 쪽에서 자기 부모 tr만 bumpSpansVersion으로 새로 그린다.
|
|
553
|
+
registerCellClassSync(rowKey, field, cls) {
|
|
554
|
+
if (rowKey == null || !field)
|
|
555
|
+
return;
|
|
556
|
+
const key = this.spanKey(rowKey, field);
|
|
557
|
+
const safe = (cls ?? '').trim();
|
|
558
|
+
if (!safe) {
|
|
559
|
+
this.cellClassRegistry.delete(key);
|
|
560
|
+
return;
|
|
561
|
+
}
|
|
562
|
+
this.cellClassRegistry.set(key, safe);
|
|
563
|
+
}
|
|
564
|
+
unregisterCellClassSync(rowKey, field) {
|
|
565
|
+
if (rowKey == null || !field)
|
|
566
|
+
return;
|
|
567
|
+
this.cellClassRegistry.delete(this.spanKey(rowKey, field));
|
|
568
|
+
}
|
|
569
|
+
getCellClassSync(rowKey, field) {
|
|
570
|
+
return this.cellClassRegistry.get(this.spanKey(rowKey, field));
|
|
571
|
+
}
|
|
512
572
|
// 레지스트리에 rowspan>1 항목이 하나라도 있으면 true.
|
|
513
573
|
// hover 동작을 끌지 결정하는 데 사용 — colspan만 있는 경우는 그대로 hover 유지.
|
|
514
574
|
hasRowspanSync() {
|
|
@@ -534,9 +594,11 @@ export class SdTable {
|
|
|
534
594
|
if (i + span.colspan > colIdx)
|
|
535
595
|
return true;
|
|
536
596
|
}
|
|
537
|
-
// 2. 위쪽 행 스캔 —
|
|
538
|
-
|
|
539
|
-
|
|
597
|
+
// 2. 위쪽 행 스캔 — rows 기반 visual index로 "내 위에 있느냐" 판정
|
|
598
|
+
// rows prop이 있으면 rowIndexMap로 임의 문자열 rowKey 지원,
|
|
599
|
+
// 없으면 Number(rowKey) fallback (resolveRowIndex가 처리)
|
|
600
|
+
const myRowIdx = this.resolveRowIndex(rowKey);
|
|
601
|
+
if (myRowIdx == null)
|
|
540
602
|
return false;
|
|
541
603
|
for (const [key, span] of this.spanRegistry) {
|
|
542
604
|
if (span.rowspan <= 1)
|
|
@@ -546,8 +608,8 @@ export class SdTable {
|
|
|
546
608
|
continue;
|
|
547
609
|
const otherRowKey = key.slice(0, sepIdx);
|
|
548
610
|
const otherField = key.slice(sepIdx + 2);
|
|
549
|
-
const otherRowIdx =
|
|
550
|
-
if (
|
|
611
|
+
const otherRowIdx = this.resolveRowIndex(otherRowKey);
|
|
612
|
+
if (otherRowIdx == null)
|
|
551
613
|
continue;
|
|
552
614
|
if (otherRowIdx >= myRowIdx)
|
|
553
615
|
continue;
|
|
@@ -651,24 +713,24 @@ export class SdTable {
|
|
|
651
713
|
'--table-body-line-height': `${TABLE_BODY_TYPOGRAPHY.lineHeight}px`,
|
|
652
714
|
'--table-body-text-decoration': TABLE_BODY_TYPOGRAPHY.textDecoration,
|
|
653
715
|
};
|
|
654
|
-
return (h(Host, { key: '
|
|
716
|
+
return (h(Host, { key: 'c20a7cc6d5917c9d09c699f2c40ac2b6d07747e1', style: hostStyle }, h("div", { key: '94f76e75da5c6ff9d0ef93b6c2aa3def4ec1766e', class: "sd-table__container", style: {
|
|
655
717
|
'--table-width': this.width,
|
|
656
718
|
'--table-height': this.height,
|
|
657
719
|
'--table-container-height': `calc(${this.height || '100%'} - ${this.pagination && this.rowCount > 0 && !this.useVirtualScroll ? 48 : 0}px)`,
|
|
658
|
-
} }, h("div", { key: '
|
|
720
|
+
} }, h("div", { key: '3b98c828c7dc42de3d4f9bb645279b20d9079ac4', class: {
|
|
659
721
|
'sd-table__clip': true,
|
|
660
722
|
'sd-table__clip--has-pagination': !!(this.pagination &&
|
|
661
723
|
this.pagination.rowsPerPage > 0 &&
|
|
662
724
|
this.rowCount > 0 &&
|
|
663
725
|
!this.useVirtualScroll),
|
|
664
|
-
} }, h("div", { key: '
|
|
726
|
+
} }, h("div", { key: 'b6d04ec953d7b75fb8ad8bc32e2662550d38c5c7', class: {
|
|
665
727
|
'sd-table__wrapper': true,
|
|
666
728
|
'sd-table__wrapper--loading': this.isLoading,
|
|
667
729
|
'sd-table__wrapper--no-data': this.rowCount === 0 && !this.isLoading,
|
|
668
|
-
} }, this.isLoading && (h("div", { key: '
|
|
730
|
+
} }, this.isLoading && (h("div", { key: '3050275c7ecde0aeda3ec881257be4334ebd06fc', class: "sd-table__loading", style: { top: `${this.loadingScrollTop}px` } }, h("sd-circle-progress", { key: '7a26c4365e4e28a5ebce1c35bb52a302440542f7', indeterminate: true }))), this.rowCount === 0 && !this.isLoading && (h("div", { key: '31442f92321eb4aaf5c36c5995a1c25d8069b6ea', class: "sd-table__no-data" }, h("slot", { key: '42f3208fb1c86d118f50e8b1974bff3ede253032', name: "no-data" }, h("span", { key: 'ce7368c64b3502eee2fae7a28e0508d4d1622c25' }, this.resolvedNoDataLabel)))), h("table", { key: '170203f34b4bb11fce0a064622265d093ccbab2a', class: this.tableClasses }, this.autoThead ? (h("slot", { name: `${resolvedTableId}-head`, onSlotchange: this.handleStructureSlotChange }, h("sd-thead", { rows: this.rows ?? [] }))) : (h("slot", { name: `${resolvedTableId}-head`, onSlotchange: this.handleStructureSlotChange })), this.autoTbody ? (h("slot", { name: `${resolvedTableId}-body`, onSlotchange: this.handleStructureSlotChange }, h("sd-tbody", { rows: this.rows ?? [] }, this.renderAutoRows()))) : (h("slot", { name: `${resolvedTableId}-body`, onSlotchange: this.handleStructureSlotChange }))))), this.pagination &&
|
|
669
731
|
this.pagination.rowsPerPage > 0 &&
|
|
670
732
|
this.rowCount > 0 &&
|
|
671
|
-
!this.useVirtualScroll && (h("div", { key: '
|
|
733
|
+
!this.useVirtualScroll && (h("div", { key: 'cfbd5ee8e706c9ef7a2b6a4be8901b7aae47249e', class: "sd-table__pagination" }, h("sd-pagination", { key: '57dad16199d9145fcec0c5ed46beeeac1f08af02', 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: '1314e296ba913600436045b4af54eb0bc1d95d0d', value: this.useInternalPagination
|
|
672
734
|
? this.innerRowsPerPage
|
|
673
735
|
: this.pagination.rowsPerPage, options: this.rowsPerPageOption, width: "128px", emitValue: true, onSdUpdate: e => {
|
|
674
736
|
if (!this.isRowsPerPageValue(e.detail))
|
|
@@ -1427,6 +1489,9 @@ export class SdTable {
|
|
|
1427
1489
|
}, {
|
|
1428
1490
|
"propName": "rows",
|
|
1429
1491
|
"methodName": "handleRowsChange"
|
|
1492
|
+
}, {
|
|
1493
|
+
"propName": "rowKey",
|
|
1494
|
+
"methodName": "handleRowKeyChange"
|
|
1430
1495
|
}, {
|
|
1431
1496
|
"propName": "tableId",
|
|
1432
1497
|
"methodName": "handleTableIdChange"
|
|
@@ -7,20 +7,30 @@ export class SdTd {
|
|
|
7
7
|
align;
|
|
8
8
|
rowspan;
|
|
9
9
|
colspan;
|
|
10
|
-
|
|
10
|
+
// sd-tr가 그리는 실제 <td>에 머지될 사용자 클래스.
|
|
11
|
+
// <sd-td> 호스트는 display:contents라 호스트의 class는 시각 효과가 없기 때문에,
|
|
12
|
+
// 이 prop을 통해 sd-table 레지스트리에 등록 → sd-tr가 td 렌더 시 합쳐 사용한다.
|
|
13
|
+
sdClass;
|
|
14
|
+
handleFieldChange(_newField, oldField) {
|
|
11
15
|
this.syncSlotName();
|
|
12
16
|
this.syncSpanRegistration();
|
|
17
|
+
this.syncCellClassRegistration(oldField);
|
|
13
18
|
}
|
|
14
|
-
handleRowKeyChange() {
|
|
19
|
+
handleRowKeyChange(_newKey, oldKey) {
|
|
15
20
|
this.syncSlotName();
|
|
16
21
|
this.syncSpanRegistration();
|
|
22
|
+
this.syncCellClassRegistration(undefined, oldKey);
|
|
17
23
|
}
|
|
18
24
|
handleSpanChange() {
|
|
19
25
|
this.syncSpanRegistration();
|
|
20
26
|
}
|
|
27
|
+
handleSdClassChange() {
|
|
28
|
+
this.syncCellClassRegistration();
|
|
29
|
+
}
|
|
21
30
|
componentWillLoad() {
|
|
22
31
|
this.syncSlotName();
|
|
23
32
|
this.syncSpanRegistration();
|
|
33
|
+
this.syncCellClassRegistration();
|
|
24
34
|
// slot 타이밍 엇갈림 대응: 부모 sd-tr forceUpdate로 슬롯 재매칭
|
|
25
35
|
const parentTr = this.el.parentElement;
|
|
26
36
|
if (parentTr?.tagName?.toLowerCase() === 'sd-tr') {
|
|
@@ -30,17 +40,20 @@ export class SdTd {
|
|
|
30
40
|
componentDidLoad() {
|
|
31
41
|
this.syncSlotName();
|
|
32
42
|
this.syncSpanRegistration();
|
|
43
|
+
this.syncCellClassRegistration();
|
|
33
44
|
}
|
|
34
45
|
// React StrictMode에서는 disconnect/reconnect 사이클이 일어나면서
|
|
35
46
|
// 동일 인스턴스의 componentWillLoad는 더 이상 호출되지 않는다.
|
|
36
47
|
// 재연결 시점에도 등록 상태를 복구해야 rowspan/colspan이 유지된다.
|
|
37
48
|
connectedCallback() {
|
|
38
49
|
this.syncSpanRegistration();
|
|
50
|
+
this.syncCellClassRegistration();
|
|
39
51
|
}
|
|
40
52
|
disconnectedCallback() {
|
|
41
53
|
const table = this.findTable();
|
|
42
|
-
if (table
|
|
43
|
-
table.unregisterSpanSync(String(this.rowKey), this.field);
|
|
54
|
+
if (table && this.field && this.rowKey != null) {
|
|
55
|
+
table.unregisterSpanSync?.(String(this.rowKey), this.field);
|
|
56
|
+
table.unregisterCellClassSync?.(String(this.rowKey), this.field);
|
|
44
57
|
this.requestParentTrUpdate();
|
|
45
58
|
}
|
|
46
59
|
}
|
|
@@ -68,6 +81,21 @@ export class SdTd {
|
|
|
68
81
|
table.registerSpanSync(String(this.rowKey), this.field, rs, cs);
|
|
69
82
|
this.requestParentTrUpdate();
|
|
70
83
|
}
|
|
84
|
+
// field/rowKey가 바뀌면 이전 키에 등록된 클래스가 남으므로 먼저 해제하고 새 키로 등록한다.
|
|
85
|
+
syncCellClassRegistration(prevField, prevRowKey) {
|
|
86
|
+
const table = this.findTable();
|
|
87
|
+
if (!table)
|
|
88
|
+
return;
|
|
89
|
+
const oldField = prevField ?? this.field;
|
|
90
|
+
const oldRowKey = prevRowKey ?? (this.rowKey != null ? String(this.rowKey) : undefined);
|
|
91
|
+
if (oldField && oldRowKey != null) {
|
|
92
|
+
table.unregisterCellClassSync?.(oldRowKey, oldField);
|
|
93
|
+
}
|
|
94
|
+
if (!table.registerCellClassSync || !this.field || this.rowKey == null)
|
|
95
|
+
return;
|
|
96
|
+
table.registerCellClassSync(String(this.rowKey), this.field, this.sdClass);
|
|
97
|
+
this.requestParentTrUpdate();
|
|
98
|
+
}
|
|
71
99
|
syncSlotName() {
|
|
72
100
|
const table = this.el.closest('sd-table');
|
|
73
101
|
const fromMethod = table?.getTableIdSync?.();
|
|
@@ -80,7 +108,7 @@ export class SdTd {
|
|
|
80
108
|
}
|
|
81
109
|
}
|
|
82
110
|
render() {
|
|
83
|
-
return (h(Host, { key: '
|
|
111
|
+
return (h(Host, { key: '84ce2fe2ea8ccb3eaf09e4d2559fc917bdb1077a', class: { [`align-${this.align}`]: Boolean(this.align) } }, h("slot", { key: '9b8164a2eac53b927bf59638cb53c35998a75cfe' })));
|
|
84
112
|
}
|
|
85
113
|
static get is() { return "sd-td"; }
|
|
86
114
|
static get originalStyleUrls() {
|
|
@@ -189,6 +217,25 @@ export class SdTd {
|
|
|
189
217
|
"setter": false,
|
|
190
218
|
"reflect": false,
|
|
191
219
|
"attribute": "colspan"
|
|
220
|
+
},
|
|
221
|
+
"sdClass": {
|
|
222
|
+
"type": "string",
|
|
223
|
+
"mutable": false,
|
|
224
|
+
"complexType": {
|
|
225
|
+
"original": "string",
|
|
226
|
+
"resolved": "string | undefined",
|
|
227
|
+
"references": {}
|
|
228
|
+
},
|
|
229
|
+
"required": false,
|
|
230
|
+
"optional": true,
|
|
231
|
+
"docs": {
|
|
232
|
+
"tags": [],
|
|
233
|
+
"text": ""
|
|
234
|
+
},
|
|
235
|
+
"getter": false,
|
|
236
|
+
"setter": false,
|
|
237
|
+
"reflect": false,
|
|
238
|
+
"attribute": "sd-class"
|
|
192
239
|
}
|
|
193
240
|
};
|
|
194
241
|
}
|
|
@@ -206,6 +253,9 @@ export class SdTd {
|
|
|
206
253
|
}, {
|
|
207
254
|
"propName": "colspan",
|
|
208
255
|
"methodName": "handleSpanChange"
|
|
256
|
+
}, {
|
|
257
|
+
"propName": "sdClass",
|
|
258
|
+
"methodName": "handleSdClassChange"
|
|
209
259
|
}];
|
|
210
260
|
}
|
|
211
261
|
}
|
|
@@ -138,6 +138,12 @@ export class SdTr {
|
|
|
138
138
|
return false;
|
|
139
139
|
return this.tableEl.isCoveredSync(this.rowKey, colIdx, this._columns);
|
|
140
140
|
}
|
|
141
|
+
getCellClassFor(col) {
|
|
142
|
+
if (!this.tableEl?.getCellClassSync)
|
|
143
|
+
return undefined;
|
|
144
|
+
const fieldName = typeof col.field === 'string' ? col.field : col.name;
|
|
145
|
+
return this.tableEl.getCellClassSync(this.rowKey, fieldName);
|
|
146
|
+
}
|
|
141
147
|
render() {
|
|
142
148
|
const stickyLeftCount = this._stickyColumn.left || 0;
|
|
143
149
|
const stickyRightCount = this._stickyColumn.right || 0;
|
|
@@ -157,16 +163,17 @@ export class SdTr {
|
|
|
157
163
|
'--table-border-color': TABLE_BORDER.color,
|
|
158
164
|
'--table-border-width': `${TABLE_BORDER.width}px`,
|
|
159
165
|
};
|
|
160
|
-
return (h(Host, { key: '
|
|
166
|
+
return (h(Host, { key: '5ed784dad3eb187430efe30ed0bc0f153bf57f23', style: rowStyle }, h("tr", { key: 'bcdc07139fce88788a598ced264f3aad503882fe', class: { 'tr': true, 'tr--no-hover': hasRowspan } }, this._selectable && (h("td", { key: '0b2b516a0d2b57beb7bb37ea3ab2c34836cc772c', class: {
|
|
161
167
|
'td': true,
|
|
162
168
|
'td--selected': true,
|
|
163
169
|
'sticky-left': true,
|
|
164
170
|
'sticky-left-edge': stickyLeftCount === 0,
|
|
165
171
|
'is-scrolled-left': stickyLeftCount === 0 && this._scrolledLeft,
|
|
166
|
-
}, style: { '--sticky-left-offset': '0px' } }, h("sd-checkbox", { key: '
|
|
172
|
+
}, style: { '--sticky-left-offset': '0px' } }, h("sd-checkbox", { key: '3fb6dc05e2b0e75bd70ff5b9631330ce2348bd22', value: this.isSelected(), onSdUpdate: () => this.handleSelect() }))), stickyLeftCols.map((col, idx) => {
|
|
167
173
|
if (this.isCovered(idx))
|
|
168
174
|
return null;
|
|
169
175
|
const span = this.getSpanFor(col);
|
|
176
|
+
const sdCellClass = this.getCellClassFor(col);
|
|
170
177
|
return (h("td", { key: col.name, rowSpan: span?.rowspan, colSpan: span?.colspan, class: {
|
|
171
178
|
'td': true,
|
|
172
179
|
[`td--${col.align || 'left'}`]: true,
|
|
@@ -174,6 +181,7 @@ export class SdTr {
|
|
|
174
181
|
'sticky-left-edge': idx === stickyLeftCount - 1,
|
|
175
182
|
'is-scrolled-left': idx === stickyLeftCount - 1 && this._scrolledLeft,
|
|
176
183
|
[`${col.tdClass}`]: Boolean(col.tdClass),
|
|
184
|
+
[`${sdCellClass}`]: Boolean(sdCellClass),
|
|
177
185
|
}, style: this.getStickyStyle(idx) }, h("slot", { name: `${this.tableId}-${typeof col.field === 'string' ? col.field : col.name}-${this.rowKey}` }, h("span", null, this.getCellValue(col)))));
|
|
178
186
|
}), middleCols.map((col, relativeIdx) => {
|
|
179
187
|
const actualColIdx = stickyLeftCount + relativeIdx;
|
|
@@ -181,10 +189,12 @@ export class SdTr {
|
|
|
181
189
|
return null;
|
|
182
190
|
const fieldName = typeof col.field === 'string' ? col.field : col.name;
|
|
183
191
|
const span = this.getSpanFor(col);
|
|
192
|
+
const sdCellClass = this.getCellClassFor(col);
|
|
184
193
|
return (h("td", { key: col.name, rowSpan: span?.rowspan, colSpan: span?.colspan, class: {
|
|
185
194
|
td: true,
|
|
186
195
|
[`td--${col.align || 'left'}`]: true,
|
|
187
196
|
[`${col.tdClass}`]: Boolean(col.tdClass),
|
|
197
|
+
[`${sdCellClass}`]: Boolean(sdCellClass),
|
|
188
198
|
}, style: this.getStickyStyle(actualColIdx) }, h("slot", { name: `${this.tableId}-${fieldName}-${this.rowKey}` }, h("span", null, this.getCellValue(col)))));
|
|
189
199
|
}), stickyRightCols.map((col, relativeIdx) => {
|
|
190
200
|
const actualColIdx = this.visibleColumns.length - stickyRightCount + relativeIdx;
|
|
@@ -192,6 +202,7 @@ export class SdTr {
|
|
|
192
202
|
return null;
|
|
193
203
|
const fieldName = typeof col.field === 'string' ? col.field : col.name;
|
|
194
204
|
const span = this.getSpanFor(col);
|
|
205
|
+
const sdCellClass = this.getCellClassFor(col);
|
|
195
206
|
return (h("td", { key: col.name, rowSpan: span?.rowspan, colSpan: span?.colspan, class: {
|
|
196
207
|
'td': true,
|
|
197
208
|
[`td--${col.align || 'left'}`]: true,
|
|
@@ -199,6 +210,7 @@ export class SdTr {
|
|
|
199
210
|
'sticky-right-edge': relativeIdx === 0,
|
|
200
211
|
'is-scrolled-right': relativeIdx === 0 && this._scrolledRight,
|
|
201
212
|
[`${col.tdClass}`]: Boolean(col.tdClass),
|
|
213
|
+
[`${sdCellClass}`]: Boolean(sdCellClass),
|
|
202
214
|
}, style: this.getStickyStyle(actualColIdx) }, h("slot", { name: `${this.tableId}-${fieldName}-${this.rowKey}` }, h("span", null, this.getCellValue(col)))));
|
|
203
215
|
}))));
|
|
204
216
|
}
|
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-
|
|
1
|
+
export{g as getAssetPath,r as render,s as setAssetPath,a as setNonce,b as setPlatformOptions}from"./p-D3gjBBCU.js";import{c as t}from"./p-DRVnqiWc.js";let n=null;function e(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 o(t){return n&&document.body.contains(n)?(e(n,t),n):(n=document.createElement("sd-toast-container"),e(n,t),document.body.appendChild(n),n)}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 c={async create(t,n,e){const{globalOptions:s,...r}=e??{},c=o(s);return await i(c),c.create({message:t,type:n,...r})},async dismiss(t){if(n)return await i(n),n.dismiss(t)},async dismissAll(){if(n)return await i(n),n.dismissAll()},configure(t){o(t)}},u="sd-modal-container";let d=null;const l={ok:"confirm",cancel:"cancel",close:"close"};class m{modalId;okFn;cancelFn;closeFn;clickFn;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}onClick(t){return this.clickFn=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=l[t];return this.runOrQueue((()=>{this.containerRef.dismissById?.(this.modalId,n)})),this}_triggerOk(){this.okFn?.()}_triggerCancel(){this.cancelFn?.()}_triggerClose(){this.closeFn?.()}_triggerClick(){this.clickFn?.()}_triggerDismissed(){this.dismissedFn?.()}_setId(t){this.modalId=t;const n=[...this.pendingActions];this.pendingActions=[],n.forEach((t=>t()))}_setContainer(t){this.containerRef=t}runOrQueue(t){this.modalId&&this.containerRef?t():this.pendingActions.push(t)}}function f(){if("undefined"==typeof window||"undefined"==typeof document||"undefined"==typeof customElements)throw Error("[sdModal] Browser APIs are unavailable. Use `sdModal` only on the client.")}function h(){if(f(),function(){if(!customElements.get(u))throw Error("[sdModal] `sd-modal-container` is not registered. Call `defineCustomElements(window)` before using `sdModal`.")}(),d&&d.isConnected)return d;const t=document.createElement(u);return t.setAttribute("auto-remove",""),document.body.appendChild(t),d=t,t}async function w(t){if(await customElements.whenDefined(u),"function"==typeof t.open)return Promise.resolve();throw Error("[sdModal] `sd-modal-container` is registered but not ready to open dialogs.")}function p(){return new m("")}function y(t,n){const{component:e,persistent:s}=n,o=h(),i={persistent:s};t._setContainer(o),w(o).then((async()=>{const n=await o.createCustom(e,i,t);t._setId(n)}))}const E={confirm(t){const n=h(),e=new m("",n);return w(n).then((async()=>{const s=await n.open(t,e);e._setId(s)})),e},loading(t={}){const n=h(),e=new m("",n);return w(n).then((async()=>{const s=await n.openLoading(t,e);e._setId(s)})),e},create(t){const n=p();return y(n,t),n},configure(n){f(),t(n)}},C="sd-loading-container";let k=null;async function A(t){const n=(function(){if("undefined"==typeof window||"undefined"==typeof document||"undefined"==typeof customElements)throw Error("[sdLoading] Browser APIs are unavailable. Use `sdLoading` only on the client.")}(),function(){if(!customElements.get(C))throw Error("[sdLoading] `sd-loading-container` is not registered. Call `defineCustomElements(window)` before using `sdLoading`.")}(),k&&document.body.contains(k)||(k=document.createElement(C),document.body.appendChild(k)),k);await customElements.whenDefined(C),t(n)}const P={show(t={}){A((n=>{n.show?.(t)}))},hide(){k&&A((t=>{t.hide?.()}))}};export{y as _attachSdModalWithRef,p as _createSdModalRef,P as sdLoading,E as sdModal,c as sdToast}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as t,H as n,c as o,h as s,t as d}from"./p-
|
|
1
|
+
import{p as t,H as n,c as o,h as s,t as d}from"./p-D3gjBBCU.js";import{i,g as b,B as e,d as a,c as u,a as r,P as v,b as h}from"./p-C-kw2p2a.js";import{d as l}from"./p-EbjZr2OA.js";const c=t(class extends n{constructor(t){super(),!1!==t&&this.__registerHost(),this.click=o(this,"sdClick",7)}name="primary_sm";label="";icon;rightIcon;ariaLabel="";disabled=!1;type="button";click;hasWarnedMissingAriaLabel=!1;handleClick=t=>{this.disabled?t.preventDefault():this.click.emit(t)};get resolvedConfig(){if(!i(this.name))throw new Error(`Invalid sd-button-v2 name: ${this.name}`);return{config:e[this.name],preset:b(this.name)}}getButtonClasses(t,n,o,s){const d=["sd-button-v2",`sd-button-v2--${t}`,`sd-button-v2--${n}`];return this.disabled&&d.push("sd-button-v2--disabled"),s&&d.push("sd-button-v2--icon-only"),o&&d.push("sd-button-v2--has-label"),d.join(" ")}componentWillRender(){this.warnIfMissingAriaLabel()}warnIfMissingAriaLabel(){this.label||!Boolean(this.icon)&&!Boolean(this.rightIcon)||this.ariaLabel.trim()?this.hasWarnedMissingAriaLabel=!1:this.hasWarnedMissingAriaLabel||(console.warn(`[sd-button-v2] icon-only buttons require \`ariaLabel\`. Received name="${this.name}" icon="${this.icon??this.rightIcon}".`),this.hasWarnedMissingAriaLabel=!0)}render(){const{config:t,preset:n}=this.resolvedConfig,o=Boolean(this.label),d=!this.label&&Boolean(this.icon)!==Boolean(this.rightIcon),i=d&&this.ariaLabel.trim()?this.ariaLabel:void 0;return s("button",{key:"e3e2074fbe2b48117d5834efac7ff3036757aab3",class:this.getButtonClasses(n,t.size,o,d),type:this.type,disabled:this.disabled,"aria-label":i,style:{"--sd-button-v2-bg":t.color,"--sd-button-v2-bg-hover":h[n],"--sd-button-v2-border":v[n],"--sd-button-v2-content":r[n],"--sd-button-v2-accent":u},onClick:this.handleClick},s("span",{key:"90ea3bf42c9e16c836c6fdfdf26a74c8a848c31b",class:"sd-button-v2__content"},this.icon&&s("sd-icon",{key:"b9f4a1c42ae866aac1f65f4bbedb282ae0c10c72",class:"sd-button-v2__icon",name:this.icon,size:a[t.size],color:"var(--sd-button-v2-current-icon)"}),this.label&&s("span",{key:"5e5dfbabdbec86c2da625c6a70fcda10303d0e50",class:"sd-button-v2__label"},this.label),this.rightIcon&&s("sd-icon",{key:"f1c3a74b6d7e83fa755c97f83c6d97dea8411537",class:"sd-button-v2__icon sd-button-v2__icon--right",name:this.rightIcon,size:a[t.size],color:"var(--sd-button-v2-current-icon)"})))}static get style(){return"sd-button-v2{display:inline-flex;width:fit-content;height:fit-content}.sd-button-v2{--sd-button-v2-height:36px;--sd-button-v2-padding-x:20px;--sd-button-v2-gap:8px;--sd-button-v2-font-family:inherit;--sd-button-v2-font-size:16px;--sd-button-v2-font-weight:500;--sd-button-v2-text-decoration:none;--sd-button-v2-label-min-width:auto;--sd-button-v2-icon-only-size:var(--sd-button-v2-height);--sd-button-v2-bg:#025497;--sd-button-v2-bg-hover:#004177;--sd-button-v2-border:transparent;--sd-button-v2-content:#FFFFFF;--sd-button-v2-current-content:var(--sd-button-v2-content);--sd-button-v2-current-icon:var(--sd-button-v2-content);display:inline-flex;align-items:center;justify-content:center;min-height:var(--sd-button-v2-height);min-width:var(--sd-button-v2-min-width, auto);padding:0 var(--sd-button-v2-padding-x);border:var(--sd-button-button-border-width-default, 1px) solid var(--sd-button-v2-border);border-radius:var(--sd-button-button-radius-sm, 4px);background:var(--sd-button-v2-bg);color:var(--sd-button-v2-current-content);cursor:pointer;box-sizing:border-box;font-family:var(--sd-button-v2-font-family);font-size:var(--sd-button-v2-font-size);font-weight:var(--sd-button-v2-font-weight);line-height:1;text-decoration:var(--sd-button-v2-text-decoration);transition:background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;white-space:nowrap;-webkit-user-select:none;user-select:none}.sd-button-v2:hover:not(.sd-button-v2--disabled){background:var(--sd-button-v2-bg-hover)}.sd-button-v2:focus-visible{outline:0;box-shadow:0 0 0 2px var(--sd-button-v2-accent)}.sd-button-v2--xs{--sd-button-v2-height:var(--sd-button-button-xs-height, 24px);--sd-button-v2-padding-x:var(--sd-button-button-xs-padding-x, 8px);--sd-button-v2-gap:var(--sd-button-button-xs-gap, 4px);--sd-button-v2-font-family:var(--sd-button-button-xs-typography-font-family, inherit);--sd-button-v2-font-size:var(--sd-button-button-xs-typography-font-size, 12px);--sd-button-v2-font-weight:var(--sd-button-button-xs-typography-font-weight, 500);--sd-button-v2-text-decoration:var(--sd-button-button-xs-typography-text-decoration, none);--sd-button-v2-label-min-width:var(--sd-button-label-xs-min-width, 36px);--sd-button-v2-icon-only-size:var(--sd-button-button-icon-only-xs-width, var(--sd-button-v2-height))}.sd-button-v2--sm{--sd-button-v2-height:var(--sd-button-button-sm-height, 28px);--sd-button-v2-padding-x:var(--sd-button-button-sm-padding-x, 12px);--sd-button-v2-gap:var(--sd-button-button-sm-gap, 6px);--sd-button-v2-font-family:var(--sd-button-button-sm-typography-font-family, inherit);--sd-button-v2-font-size:var(--sd-button-button-sm-typography-font-size, 12px);--sd-button-v2-font-weight:var(--sd-button-button-sm-typography-font-weight, 500);--sd-button-v2-text-decoration:var(--sd-button-button-sm-typography-text-decoration, none);--sd-button-v2-label-min-width:var(--sd-button-label-sm-min-width, 70px);--sd-button-v2-icon-only-size:var(--sd-button-button-icon-only-sm-width, var(--sd-button-v2-height))}.sd-button-v2--md{--sd-button-v2-height:var(--sd-button-button-md-height, 36px);--sd-button-v2-padding-x:var(--sd-button-button-md-padding-x, 20px);--sd-button-v2-gap:var(--sd-button-button-md-gap, 8px);--sd-button-v2-font-family:var(--sd-button-button-md-typography-font-family, inherit);--sd-button-v2-font-size:var(--sd-button-button-md-typography-font-size, 16px);--sd-button-v2-font-weight:var(--sd-button-button-md-typography-font-weight, 500);--sd-button-v2-text-decoration:var(--sd-button-button-md-typography-text-decoration, none);--sd-button-v2-label-min-width:var(--sd-button-label-md-min-width, 100px);--sd-button-v2-icon-only-size:var(--sd-button-button-icon-only-md-width, var(--sd-button-v2-height));border-radius:var(--sd-button-button-radius-md, 6px)}.sd-button-v2--lg{--sd-button-v2-height:var(--sd-button-button-lg-height, 62px);--sd-button-v2-padding-x:var(--sd-button-button-lg-padding-x, 28px);--sd-button-v2-gap:var(--sd-button-button-lg-gap, 12px);--sd-button-v2-font-family:var(--sd-button-button-lg-typography-font-family, inherit);--sd-button-v2-font-size:var(--sd-button-button-lg-typography-font-size, 18px);--sd-button-v2-font-weight:var(--sd-button-button-lg-typography-font-weight, 500);--sd-button-v2-text-decoration:var(--sd-button-button-lg-typography-text-decoration, none);--sd-button-v2-label-min-width:var(--sd-button-label-lg-min-width, 120px);--sd-button-v2-icon-only-size:var(--sd-button-button-icon-only-lg-width, var(--sd-button-v2-height));border-radius:var(--sd-button-button-radius-md, 6px)}.sd-button-v2--has-label{--sd-button-v2-min-width:var(--sd-button-v2-label-min-width, auto)}.sd-button-v2--icon-only{width:var(--sd-button-v2-icon-only-size, var(--sd-button-v2-height));min-width:var(--sd-button-v2-icon-only-size, var(--sd-button-v2-height));height:var(--sd-button-v2-icon-only-size, var(--sd-button-v2-height));padding:0}.sd-button-v2--icon-only .sd-button-v2__content{gap:0}.sd-button-v2--disabled{border-color:var(--sd-button-button-border-disabled, #CCCCCC);background:var(--sd-button-button-bg-disabled, #E1E1E1);--sd-button-v2-current-content:var(--sd-button-button-text-disabled, #888888);--sd-button-v2-current-icon:var(--sd-button-button-icon-disabled, #BBBBBB);cursor:not-allowed}.sd-button-v2 .sd-button-v2__content{display:inline-flex;align-items:center;justify-content:center;gap:var(--sd-button-v2-gap)}.sd-button-v2 .sd-button-v2__label{font:inherit}"}},[512,"sd-button-v2",{name:[1],label:[1],icon:[1],rightIcon:[1,"right-icon"],ariaLabel:[1,"aria-label"],disabled:[4],type:[1]}]);function p(){"undefined"!=typeof customElements&&["sd-button-v2","sd-icon"].forEach((t=>{switch(t){case"sd-button-v2":customElements.get(d(t))||customElements.define(d(t),c);break;case"sd-icon":customElements.get(d(t))||l()}}))}export{c as S,p as d}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as t,H as o,c as s,h as a,t as e}from"./p-
|
|
1
|
+
import{p as t,H as o,c as s,h as a,t as e}from"./p-D3gjBBCU.js";import{m as i}from"./p-DOXMJi-V.js";import{d}from"./p-B8jXOXtJ.js";import{d as n}from"./p-Dey-lS6x.js";import{d as l}from"./p-EbjZr2OA.js";import{d as m}from"./p-BppjYHF6.js";const c={positive:"primary_md",negative:"danger_md",default:"neutral_outline_md"},r={positive:"notificationOutline",negative:"warningOutline",default:null},f={positive:i.modal.confirm.positive.icon,negative:i.modal.confirm.negative.icon,default:""},b=Number(i.modal.confirm.title.icon),h=t(class extends o{constructor(t){super(),!1!==t&&this.__registerHost(),this.close=s(this,"sdClose",7),this.cancel=s(this,"sdCancel",7),this.ok=s(this,"sdOk",7)}get el(){return this}hasSlottedContent=!1;customContentRef;slotObserver;type="positive";modalTitle="";titleClass="";topMessage=[];bottomMessage=[];mainButtonName;mainButtonLabel="확인";subButtonLabel="";tagPreset="square_sm_grey";tagLabel="";slotLabel="";tagContents;close;cancel;ok;componentWillLoad(){this.syncHasSlottedContent()}componentDidLoad(){"undefined"!=typeof MutationObserver&&(this.slotObserver=new MutationObserver((()=>this.syncHasSlottedContent())),this.slotObserver.observe(this.el,{childList:!0,characterData:!0}))}componentDidRender(){this.customContentRef&&this.tagContents instanceof o&&("function"==typeof this.customContentRef.replaceChildren?this.customContentRef.replaceChildren(this.tagContents):(this.customContentRef.innerHTML="",this.customContentRef.appendChild(this.tagContents)))}disconnectedCallback(){this.slotObserver?.disconnect()}get resolvedMainButton(){return this.mainButtonName??c[this.type]}get hasTagContent(){return!(!this.tagLabel&&!this.slotLabel)}get showContentBox(){return!!this.tagContents||this.hasTagContent||this.hasSlottedContent}syncHasSlottedContent(){const t=Array.from(this.el.childNodes).some((t=>!(t.nodeType===Node.ELEMENT_NODE&&t.classList.contains("sd-confirm-modal"))&&(t.nodeType===Node.ELEMENT_NODE||t.nodeType===Node.TEXT_NODE&&t.textContent?.trim())));t!==this.hasSlottedContent&&(this.hasSlottedContent=t)}render(){const t=r[this.type],o=f[this.type];return a("div",{key:"4ef44b1b2a86914eae3fc59e3c383b12646d1d0c",class:"sd-confirm-modal"},a("sd-ghost-button",{key:"aa62624aaf76a23eb4f1d30b846e6054f3cf001c",class:"sd-confirm-modal__close-button",icon:"close",ariaLabel:"close",onClick:()=>this.close.emit()}),t&&a("sd-icon",{key:"d1329b8e71d455357790a4aa5f73547142830532",class:"sd-confirm-modal__icon",name:t,size:b,color:o}),a("h2",{key:"2c5e0f902327c5eb663e6ccc5057e22e2be11c03",class:`sd-confirm-modal__title ${this.titleClass}`},this.modalTitle),a("div",{key:"1917ef85f9f06de3dd321d664d4022dd4a1524ff",class:"sd-confirm-modal__body"},(this.topMessage??[]).length>0&&a("div",{key:"afa7e6671f4849b7a90317664d07d3c04178c554",class:"sd-confirm-modal__message"},(this.topMessage??[]).map((t=>a("p",{class:"sd-confirm-modal__message-text",innerHTML:t})))),this.showContentBox&&a("div",{key:"d4c06bfdd2222212b1cf8e3ec86ccaca4c394394",class:"sd-confirm-modal__content-box"},this.tagContents?a("div",{class:"sd-confirm-modal__custom-content",ref:t=>{this.customContentRef=t}}):a("slot",{onSlotchange:()=>this.syncHasSlottedContent()},this.tagLabel&&a("sd-tag",{name:this.tagPreset,label:this.tagLabel}),this.slotLabel&&a("span",{class:"sd-confirm-modal__slot-label"},this.slotLabel))),(this.bottomMessage??[]).length>0&&a("div",{key:"8af201f6b6b08991ba31db2f2e59ee44a7b10d50",class:"sd-confirm-modal__message"},(this.bottomMessage??[]).map((t=>a("p",{class:"sd-confirm-modal__message-text",innerHTML:t}))))),a("div",{key:"733f478a57a68bd9d4cc6563558bc0fafbfa5b9a",class:"sd-confirm-modal__button"},this.subButtonLabel&&a("sd-button-v2",{key:"a7be74a833fbd012d14e79b570a4d97e3a495a52",name:"neutral_outline_md",label:this.subButtonLabel,onSdClick:()=>this.cancel.emit()}),a("sd-button-v2",{key:"e09be98a918aafd291a7b12c221b70e72ba14ab9",name:this.resolvedMainButton,label:this.mainButtonLabel,onSdClick:()=>this.ok.emit()})))}static get style(){return"sd-confirm-modal{display:block;width:fit-content;min-width:520px}sd-confirm-modal .sd-confirm-modal{position:relative;padding:var(--sd-modal-modal-confirm-padding-y) var(--sd-modal-modal-confirm-padding-x);border-radius:var(--sd-modal-modal-radius);box-shadow:4px 4px 24px 4px rgba(0, 0, 0, 0.2);background:var(--sd-modal-modal-bg)}sd-confirm-modal .sd-confirm-modal__close-button{position:absolute;top:12px;right:12px}sd-confirm-modal .sd-confirm-modal__icon{display:block;width:var(--sd-modal-modal-confirm-title-icon);height:var(--sd-modal-modal-confirm-title-icon);margin:0 auto var(--sd-modal-modal-confirm-title-gap) auto}sd-confirm-modal .sd-confirm-modal__title{color:var(--sd-modal-modal-confirm-title-color);font-size:var(--sd-modal-modal-confirm-title-typography-font-size);font-weight:var(--sd-modal-modal-confirm-title-typography-font-weight);line-height:var(--sd-modal-modal-confirm-title-typography-line-height);text-align:center;margin:0 0 var(--sd-modal-modal-confirm-body-gap) 0}sd-confirm-modal .sd-confirm-modal__body{display:flex;flex-direction:column;gap:var(--sd-modal-modal-confirm-body-gap)}sd-confirm-modal .sd-confirm-modal__message-text{color:var(--sd-modal-modal-confirm-message-color);font-size:12px;font-weight:400;line-height:20px;text-align:center;margin:0}sd-confirm-modal .sd-confirm-modal__content-box{display:flex;align-items:center;justify-content:center;gap:8px;padding:12px 16px;border:1px solid #e1e1e1;border-radius:8px;background:white}sd-confirm-modal .sd-confirm-modal__slot-label{font-size:14px;font-weight:700;line-height:22px;color:var(--sd-modal-modal-confirm-message-color)}sd-confirm-modal .sd-confirm-modal__button{display:flex;justify-content:center;gap:var(--sd-modal-modal-confirm-button-gap);margin-top:40px}"}},[772,"sd-confirm-modal",{type:[1],modalTitle:[1,"modal-title"],titleClass:[1,"title-class"],topMessage:[16],bottomMessage:[16],mainButtonName:[1,"main-button-name"],mainButtonLabel:[1,"main-button-label"],subButtonLabel:[1,"sub-button-label"],tagPreset:[1,"tag-preset"],tagLabel:[1,"tag-label"],slotLabel:[1,"slot-label"],tagContents:[16],hasSlottedContent:[32]}]);function p(){"undefined"!=typeof customElements&&["sd-confirm-modal","sd-button-v2","sd-ghost-button","sd-icon","sd-tag"].forEach((t=>{switch(t){case"sd-confirm-modal":customElements.get(e(t))||customElements.define(e(t),h);break;case"sd-button-v2":customElements.get(e(t))||d();break;case"sd-ghost-button":customElements.get(e(t))||n();break;case"sd-icon":customElements.get(e(t))||l();break;case"sd-tag":customElements.get(e(t))||m()}}))}export{h as S,p as d}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as t,H as e,c as s,h as i,t as o}from"./p-
|
|
1
|
+
import{p as t,H as e,c as s,h as i,t as o}from"./p-D3gjBBCU.js";import{n as r}from"./p-CCwNgVmC.js";import{d as l}from"./p-dNJIFthT.js";import{d as h}from"./p-DfH_fO01.js";import{d as a}from"./p-C7DajKYn.js";import{d}from"./p-BcMNA89i.js";import{d as n}from"./p-EbjZr2OA.js";import{d as c}from"./p-q0VWISKA.js";import{d as p}from"./p-Nvx13YlG.js";import{d as u}from"./p-DegvQLTF.js";import{d as m}from"./p-xnLvZ-xn.js";import{d as b}from"./p-BmYM7-4v.js";import{d as f}from"./p-BheX6lAy.js";const g=t(class t extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.update=s(this,"sdUpdate",7),this.dropDownShow=s(this,"sdDropDownShow",7)}static VIEWPORT_PADDING=20;static PORTAL_OFFSET_Y=4;static CLOSE_ANIMATION_DURATION=150;get el(){return this}type="default";value=null;options=[];placeholder="선택";maxDropdownWidth="640px";dropdownHeight="260px";disabled=!1;label="";labelWidth="";addonLabel="";addonAlign="start";error=!1;hint="";errorMessage="";rules=[];icon=void 0;labelTooltip="";labelTooltipProps=null;emitValue=!1;width="";useSearch=!1;allSelectedLabel="전체";useSelectAll=!1;isOpen=!1;isAnimatingOut=!1;triggerWidth="200px";resolvedDropdownHeight="260px";resolvedMaxDropdownWidth="640px";focused=!1;hovered=!1;update;dropDownShow;async sdFocus(){this.disabled||await(this.triggerComponentRef?.sdFocus())}async sdOpen(){await new Promise((t=>setTimeout(t,0))),this.disabled||this.isOpen||(this.prepareDropdownGeometry(),this.closeAnimationTimer&&clearTimeout(this.closeAnimationTimer),this.isAnimatingOut=!1,this.isOpen=!0)}triggerRef;triggerComponentRef;closeAnimationTimer;name=r();triggerHasFocus=!1;watchIsOpen(t){this.syncFocusedState(t),this.dropDownShow.emit({isOpen:t})}get isMulti(){return"multi"===this.type||"multi_depth"===this.type}get displayText(){if(this.isMulti){if(!Array.isArray(this.value)||0===this.value.length)return"";const t=this.getNonDisabledLeaves(this.options),e=this.getSelectedOptions();if(t.length>0&&t.every((t=>e.some((e=>e.value===t.value)))))return this.allSelectedLabel??"전체";const s=this.flattenOptions(this.options);return this.value.map((t=>{if(null!=t&&"object"==typeof t){const e=t;return e.label??s.find((t=>t.value===e.value))?.label??""}return s.find((e=>e.value===t))?.label??""})).filter(Boolean).join(", ")}if(null==this.value)return"";if(!this.emitValue&&"object"==typeof this.value&&!Array.isArray(this.value))return this.value.label??"";const t=this.flattenOptions(this.options).find((t=>t.value===this.value));return t?.label??""}flattenOptions(t){return t.flatMap((t=>t.children?this.flattenOptions(t.children):[t]))}getNonDisabledLeaves(t){return t.flatMap((t=>t.disabled?[]:t.children?this.getNonDisabledLeaves(t.children):[t]))}getSelectedOptions(){const t=this.value;return t&&Array.isArray(t)?this.emitValue?t.map((t=>this.findOriginalOption(t,this.options))).filter((t=>!!t)):t:[]}toMultiValue(t){return this.emitValue?t.map((t=>t.value)):t}parsePixelValue(t,e){const s=Number.parseFloat(t);return Number.isFinite(s)?s:e}updateDropdownViewportConstraints(){if(!this.triggerRef)return;const e=this.triggerRef.getBoundingClientRect(),s=t.VIEWPORT_PADDING,i=t.PORTAL_OFFSET_Y,o=this.parsePixelValue(this.dropdownHeight,260),r=this.parsePixelValue(this.maxDropdownWidth,640),l=Math.max(window.innerHeight-e.bottom-s-i,0),h=Math.max(e.top-s-i,0),a=Math.max(l,h),d=Math.max(window.innerWidth-2*s,0);this.resolvedDropdownHeight=`${Math.min(o,a)}px`,this.resolvedMaxDropdownWidth=`${Math.min(r,d)}px`}handleViewportResize=()=>{this.isOpen&&this.updateDropdownViewportConstraints()};findOriginalOption(t,e){for(const s of e){if(s.value===t)return s;if(s.children){const e=this.findOriginalOption(t,s.children);if(e)return e}}}closeDropdown(){this.isOpen&&(this.isOpen=!1,this.isAnimatingOut=!0,this.closeAnimationTimer&&clearTimeout(this.closeAnimationTimer),this.closeAnimationTimer=setTimeout((()=>{this.isAnimatingOut=!1}),t.CLOSE_ANIMATION_DURATION))}prepareDropdownGeometry(){this.triggerRef&&(this.triggerWidth=`${this.triggerRef.offsetWidth}px`),this.updateDropdownViewportConstraints()}syncFocusedState(t=this.isOpen){this.focused=t||this.triggerHasFocus}handleTriggerFocus=()=>{this.triggerHasFocus=!0,this.syncFocusedState()};handleTriggerBlur=()=>{this.triggerHasFocus=!1,this.syncFocusedState()};handleTriggerClick=()=>{this.isOpen?this.closeDropdown():(this.prepareDropdownGeometry(),this.closeAnimationTimer&&clearTimeout(this.closeAnimationTimer),this.isAnimatingOut=!1,this.isOpen=!0)};emitUpdate(t){this.update.emit(t)}handleOptionSelect=t=>{const{option:e,leaves:s}=t;if(this.isMulti)this.handleMultiSelect(e,s);else{this.closeDropdown(),this.value=this.emitValue?e.value:e;const t=this.value;requestAnimationFrame((()=>{this.emitUpdate(t)}))}};handleMultiSelect(t,e){const s=this.getSelectedOptions();let i;if(t.children)if(e.every((t=>s.some((e=>e.value===t.value))))){const t=new Set(e.map((t=>t.value)));i=s.filter((e=>!t.has(e.value)))}else{const t=new Set(s.map((t=>t.value))),o=e.filter((e=>!t.has(e.value)));i=[...s,...o]}else i=s.some((e=>e.value===t.value))?s.filter((e=>e.value!==t.value)):[...s,t];this.value=this.toMultiValue(i),this.emitUpdate(this.value)}connectedCallback(){window.addEventListener("resize",this.handleViewportResize)}disconnectedCallback(){window.removeEventListener("resize",this.handleViewportResize),this.closeAnimationTimer&&clearTimeout(this.closeAnimationTimer)}render(){const e={open:this.isOpen,parentRef:this.triggerRef,viewportPadding:t.VIEWPORT_PADDING,onSdClose:()=>{this.closeDropdown()}};return i("sd-field",{key:"76625e332090d20e2f66159bba5ee1b9a11320a6",name:this.name,label:this.label,labelWidth:this.labelWidth,addonLabel:this.addonLabel,addonAlign:this.addonAlign,hint:this.hint,errorMessage:this.errorMessage,width:this.width,rules:this.rules,error:this.error,disabled:this.disabled,focused:this.focused,hovered:this.hovered,icon:this.icon,labelTooltip:this.labelTooltip,labelTooltipProps:this.labelTooltipProps,onMouseEnter:()=>{this.hovered=!0},onMouseLeave:()=>{this.hovered=!1}},i("div",{key:"8a0ae8a5e05459128409dbe21779f5e3d91b3a04",class:"sd-select",ref:t=>{this.triggerRef=t}},i("sd-select-trigger",{key:"6b47231914655a8e197e3b38cd8e37c5214efc17",ref:t=>{this.triggerComponentRef=t},displayText:this.displayText,placeholder:this.placeholder,disabled:this.disabled,isOpen:this.isOpen,onSdTriggerClick:this.handleTriggerClick,onSdTriggerFocus:this.handleTriggerFocus,onSdTriggerBlur:this.handleTriggerBlur})),(this.isOpen||this.isAnimatingOut)&&i("sd-portal",{key:"eaed402d276cc94a1324ede9cbf09bc436f8a1db",...e},i("sd-select-listbox",{key:"a96f75e06d974c8fd88ac72f083fe4b0ef424a0b",type:this.type,options:this.options,value:this.value,emitValue:this.emitValue,useSearch:this.useSearch,useSelectAll:this.useSelectAll,triggerWidth:this.triggerWidth,maxWidth:this.resolvedMaxDropdownWidth,maxHeight:this.resolvedDropdownHeight,onSdOptionSelect:t=>this.handleOptionSelect(t.detail)})))}static get watchers(){return{isOpen:[{watchIsOpen:0}]}}static get style(){return"sd-select{display:inline-flex}sd-select sd-portal{display:none}sd-select .sd-select{position:relative;width:100%;height:100%}"}},[512,"sd-select",{type:[1],value:[1032],options:[16],placeholder:[1],maxDropdownWidth:[1,"max-dropdown-width"],dropdownHeight:[1,"dropdown-height"],disabled:[4],label:[1],labelWidth:[8,"label-width"],addonLabel:[1,"addon-label"],addonAlign:[1,"addon-align"],error:[1028],hint:[1],errorMessage:[1,"error-message"],rules:[16],icon:[16],labelTooltip:[1,"label-tooltip"],labelTooltipProps:[16],emitValue:[4,"emit-value"],width:[8],useSearch:[4,"use-search"],allSelectedLabel:[1,"all-selected-label"],useSelectAll:[4,"use-select-all"],name:[1],isOpen:[32],isAnimatingOut:[32],triggerWidth:[32],resolvedDropdownHeight:[32],resolvedMaxDropdownWidth:[32],focused:[32],hovered:[32],sdFocus:[64],sdOpen:[64]},void 0,{isOpen:[{watchIsOpen:0}]}]);function w(){"undefined"!=typeof customElements&&["sd-select","sd-button","sd-checkbox","sd-field","sd-floating-portal","sd-icon","sd-portal","sd-select-list-item","sd-select-list-item-search","sd-select-listbox","sd-select-trigger","sd-tooltip"].forEach((t=>{switch(t){case"sd-select":customElements.get(o(t))||customElements.define(o(t),g);break;case"sd-button":customElements.get(o(t))||l();break;case"sd-checkbox":customElements.get(o(t))||h();break;case"sd-field":customElements.get(o(t))||a();break;case"sd-floating-portal":customElements.get(o(t))||d();break;case"sd-icon":customElements.get(o(t))||n();break;case"sd-portal":customElements.get(o(t))||c();break;case"sd-select-list-item":customElements.get(o(t))||p();break;case"sd-select-list-item-search":customElements.get(o(t))||u();break;case"sd-select-listbox":customElements.get(o(t))||m();break;case"sd-select-trigger":customElements.get(o(t))||b();break;case"sd-tooltip":customElements.get(o(t))||f()}}))}export{g as S,w as d}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,H as a,c as r,h as n,F as d,t}from"./p-Bm8Fue-a.js";import{u as i,t as c}from"./p-DTrMR0rx.js";import{d as s,W as l,C as g}from"./p-DMbVR8K4.js";import{d as o}from"./p-DK3vj3bG.js";import{d as h}from"./p-BynnUMVZ.js";const p=(e,a)=>{const[r,n,d]=e.split("-").map(Number),t=new Date(r,n-1,d);return t.setDate(t.getDate()+a),`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`},k={bg:s.datepicker.calendar.range.bg,height:s.datepicker.calendar.range.height,panelGap:s.datepicker.calendar.range.panelGap,divider:s.datepicker.calendar.range.divider},_=e(class extends a{constructor(e){super(),!1!==e&&this.__registerHost(),this.select=r(this,"sdSelect",7),this.viewChange=r(this,"sdViewChange",7)}value=null;selectable;maxRange;currentYear;currentMonth;pendingStart="";hoverDate="";displayValue=null;select;viewChange;dateUtil=i();componentWillLoad(){this.syncFromValue()}handleValueChange(){this.syncFromValue()}syncFromValue(){const e=this.value?.[0]||c,[a,r]=e.split("-").map(Number);this.currentYear=a,this.currentMonth=r,this.pendingStart="",this.hoverDate="",this.displayValue=this.value?[this.value[0],this.value[1]]:null}get rightYear(){return 12===this.currentMonth?this.currentYear+1:this.currentYear}get rightMonth(){return 12===this.currentMonth?1:this.currentMonth+1}formatDate(e,a,r){return`${e}-${String(a).padStart(2,"0")}-${String(r).padStart(2,"0")}`}buildCells(e,a){const r=new Date(e,a-1,1).getDay(),n=new Date(e,a,0).getDate(),d=1===a?12:a-1,t=1===a?e-1:e,i=new Date(t,d,0).getDate(),c=12===a?1:a+1,s=12===a?e+1:e,l=[];for(let e=r-1;e>=0;e--){const a=i-e;l.push({date:this.formatDate(t,d,a),day:a,inCurrentMonth:!1})}for(let r=1;r<=n;r++)l.push({date:this.formatDate(e,a,r),day:r,inCurrentMonth:!0});const g=(7-l.length%7)%7;for(let e=1;e<=g;e++)l.push({date:this.formatDate(s,c,e),day:e,inCurrentMonth:!1});return l}emitViewChange(){this.viewChange.emit({year:this.currentYear,month:this.currentMonth})}goPrevYear=e=>{e.stopPropagation(),this.currentYear-=1,this.emitViewChange()};goNextYear=e=>{e.stopPropagation(),this.currentYear+=1,this.emitViewChange()};goPrevMonth=e=>{e.stopPropagation();const{newYear:a,newMonth:r}=this.dateUtil.calculateYearMonth(this.currentYear,this.currentMonth,"prev");this.currentYear=a,this.currentMonth=r,this.emitViewChange()};goNextMonth=e=>{e.stopPropagation();const{newYear:a,newMonth:r}=this.dateUtil.calculateYearMonth(this.currentYear,this.currentMonth,"next");this.currentYear=a,this.currentMonth=r,this.emitViewChange()};goToday=e=>{e.stopPropagation();const[a,r]=c.split("-").map(Number);this.currentYear===a&&this.currentMonth===r||(this.currentYear=a,this.currentMonth=r,this.emitViewChange())};isDisabled(e){if(this.selectable){const[a,r]=this.selectable;if(a&&e<a)return!0;if(r&&e>r)return!0}if(this.maxRange&&this.pendingStart){const a=p(this.pendingStart,-this.maxRange),r=p(this.pendingStart,this.maxRange);if(e<a||e>r)return!0}return!1}handleDayClick(e){if(!e.inCurrentMonth)return;if(this.isDisabled(e.date))return;if(!this.pendingStart||this.displayValue&&this.displayValue[0]&&this.displayValue[1]||e.date<this.pendingStart)return this.pendingStart=e.date,this.displayValue=null,void(this.hoverDate="");const a=[this.pendingStart,e.date];this.pendingStart="",this.hoverDate="",this.displayValue=a,this.select.emit(a)}handleDayHover(e){e.inCurrentMonth&&this.pendingStart&&(this.hoverDate=e.date)}getRangeState(e,a){if(!a)return{inRange:!1,isRangeStart:!1,isRangeEnd:!1,isSelectedEdge:!1};if(this.pendingStart){const a=e===this.pendingStart,r=this.hoverDate&&this.hoverDate>=this.pendingStart?this.hoverDate:"";return{inRange:!!r&&e>this.pendingStart&&e<=r,isRangeStart:a,isRangeEnd:!!r&&e===r,isSelectedEdge:a}}if(this.displayValue&&this.displayValue[0]&&this.displayValue[1]){const[a,r]=this.displayValue,n=e===a,d=e===r;return{inRange:e>a&&e<r,isRangeStart:n,isRangeEnd:d,isSelectedEdge:n||d}}return{inRange:!1,isRangeStart:!1,isRangeEnd:!1,isSelectedEdge:!1}}renderHeader(e,a,r){const d=`${e}.${String(a).padStart(2,"0")}`;return n("div",{class:"sd-date-range-picker-calendar__header"},n("div",{class:"sd-date-range-picker-calendar__nav-group sd-date-range-picker-calendar__nav-group-month"},n("sd-ghost-button",{class:{"sd-date-range-picker-calendar__nav-placeholder":!r},ariaLabel:"prevMonth",size:"xxs",icon:"chevronLeft",onClick:this.goPrevMonth}),n("span",{class:"sd-date-range-picker-calendar__label sd-date-range-picker-calendar__label-month"},d),n("sd-ghost-button",{class:{"sd-date-range-picker-calendar__nav-placeholder":r},ariaLabel:"nextMonth",size:"xxs",icon:"chevronRight",onClick:this.goNextMonth})))}renderYearNav(){return n("div",{class:"sd-date-range-picker-calendar__top-bar"},n("div",{class:"sd-date-range-picker-calendar__year-nav"},n("sd-ghost-button",{ariaLabel:"prevYear",size:"xxs",icon:"chevronLeft",onClick:this.goPrevYear}),n("span",{class:"sd-date-range-picker-calendar__label"},this.currentYear),n("sd-ghost-button",{ariaLabel:"nextYear",size:"xxs",icon:"chevronRight",onClick:this.goNextYear})),n("button",{type:"button",class:"sd-date-range-picker-calendar__today-button",onClick:this.goToday},"오늘"))}renderPanel(e,a,r){const d=this.buildCells(e,a);return n("div",{class:"sd-date-range-picker-calendar__panel"},this.renderHeader(e,a,r),n("div",{class:"sd-date-range-picker-calendar__week"},l.map((e=>n("span",{key:e,class:"sd-date-range-picker-calendar__week-cell"},e)))),n("div",{class:"sd-date-range-picker-calendar__grid"},d.map((e=>{const{inRange:a,isRangeStart:r,isRangeEnd:d,isSelectedEdge:t}=this.getRangeState(e.date,e.inCurrentMonth),i=e.inCurrentMonth&&c===e.date,s=e.inCurrentMonth&&this.isDisabled(e.date);return n("button",{type:"button",key:e.date,class:{"sd-date-range-picker-calendar__day":!0,"sd-date-range-picker-calendar__day--empty":!e.inCurrentMonth,"sd-date-range-picker-calendar__day--today":i,"sd-date-range-picker-calendar__day--in-range":a,"sd-date-range-picker-calendar__day--range-start":r,"sd-date-range-picker-calendar__day--range-end":d,"sd-date-range-picker-calendar__day--selected":t,"sd-date-range-picker-calendar__day--disabled":s},disabled:!e.inCurrentMonth||s,tabindex:e.inCurrentMonth?void 0:-1,"aria-hidden":e.inCurrentMonth?void 0:"true",onClick:()=>this.handleDayClick(e),onMouseEnter:()=>this.handleDayHover(e)},n("span",{class:"sd-date-range-picker-calendar__day-circle"},e.inCurrentMonth?e.day:""))}))))}render(){return n(d,{key:"acc32d9c349c4cee32bb923ce66d17122527b524"},n("div",{key:"bd579429ae609c3ff21a542bf69c1dc9a907846a",class:"sd-date-range-picker-calendar",style:{"--calendar-bg":g.bg,"--calendar-padding":`${g.paddingXY}px`,"--calendar-gap":`${g.gap}px`,"--calendar-radius":`${g.radius}px`,"--calendar-header-gap":`${g.header.gap}px`,"--calendar-header-divider":g.header.divider,"--calendar-header-font-size":`${g.header.fontSize}px`,"--calendar-header-line-height":`${g.header.lineHeight}px`,"--calendar-header-font-weight":g.header.fontWeight,"--calendar-week-font-size":`${g.week.fontSize}px`,"--calendar-week-line-height":`${g.week.lineHeight}px`,"--calendar-week-font-weight":g.week.fontWeight,"--calendar-week-color":g.week.color,"--calendar-grid-row-gap":`${g.grid.rowGap}px`,"--calendar-day-size":`${g.day.size}px`,"--calendar-day-circle-size":`${g.day.circleSize}px`,"--calendar-day-circle-radius":`${g.day.circleRadius}px`,"--calendar-day-text":g.day.defaultText,"--calendar-day-hover-text":g.day.hoverText,"--calendar-day-hover-border":g.day.hoverBorder,"--calendar-day-select-bg":g.day.selectBg,"--calendar-day-select-text":g.day.selectText,"--calendar-day-disabled-text":g.day.disabledText,"--calendar-day-font-size":`${g.day.fontSize}px`,"--calendar-day-line-height":`${g.day.lineHeight}px`,"--calendar-day-font-weight":g.day.fontWeight,"--range-bg":k.bg,"--range-height":`${k.height}px`,"--range-panel-gap":`${k.panelGap}px`,"--range-divider":k.divider}},this.renderYearNav(),n("div",{key:"8a46d922fcaa09bd7f778d00e77324d1710b92c7",class:"sd-date-range-picker-calendar__panels"},this.renderPanel(this.currentYear,this.currentMonth,!0),n("span",{key:"8234838995f1e5d945f85169e702cb0b32018f36",class:"sd-date-range-picker-calendar__divider","aria-hidden":"true"}),this.renderPanel(this.rightYear,this.rightMonth,!1))))}static get watchers(){return{value:[{handleValueChange:0}]}}static get style(){return"sd-date-range-picker-calendar{display:block}sd-date-range-picker-calendar .sd-date-range-picker-calendar{display:flex;flex-direction:column;gap:var(--calendar-gap);height:364px;padding:var(--calendar-padding);background:var(--calendar-bg);border-radius:var(--calendar-radius);box-shadow:2px 2px 12px 2px rgba(0, 0, 0, 0.2);user-select:none}sd-date-range-picker-calendar .sd-date-range-picker-calendar__top-bar{position:relative;display:flex;align-items:center;justify-content:center}sd-date-range-picker-calendar .sd-date-range-picker-calendar__year-nav{display:flex;align-items:center;justify-content:center;gap:var(--calendar-gap);font-size:var(--calendar-header-font-size);line-height:var(--calendar-header-line-height);font-weight:var(--calendar-header-font-weight);color:var(--calendar-day-text)}sd-date-range-picker-calendar .sd-date-range-picker-calendar__today-button{position:absolute;right:0;background:transparent;cursor:pointer;font-size:var(--calendar-week-font-size);font-weight:var(--calendar-header-font-weight);color:var(--calendar-day-text);min-width:37px;height:24px;line-height:24px;text-align:center}sd-date-range-picker-calendar .sd-date-range-picker-calendar__today-button:hover{text-decoration:underline}sd-date-range-picker-calendar .sd-date-range-picker-calendar__panels{display:flex;flex-direction:row;gap:var(--range-panel-gap)}sd-date-range-picker-calendar .sd-date-range-picker-calendar__divider{flex-shrink:0;width:1px;background:var(--range-divider)}sd-date-range-picker-calendar .sd-date-range-picker-calendar__panel{display:flex;flex-direction:column;gap:var(--calendar-gap)}sd-date-range-picker-calendar .sd-date-range-picker-calendar__header{display:flex;flex-flow:column nowrap;align-items:center;justify-content:center;gap:var(--calendar-header-gap);font-size:var(--calendar-header-font-size);line-height:var(--calendar-header-line-height);font-weight:var(--calendar-header-font-weight);color:var(--calendar-day-text)}sd-date-range-picker-calendar .sd-date-range-picker-calendar__nav-group{display:inline-flex;align-items:center;gap:var(--calendar-gap)}sd-date-range-picker-calendar .sd-date-range-picker-calendar__nav-group-month{display:flex;width:100%;align-items:center;gap:var(--calendar-gap)}sd-date-range-picker-calendar .sd-date-range-picker-calendar__label{display:inline-flex;align-items:center;justify-content:center;min-width:40px;text-align:center}sd-date-range-picker-calendar .sd-date-range-picker-calendar__label-month{flex:1}sd-date-range-picker-calendar .sd-date-range-picker-calendar__nav-placeholder{visibility:hidden;pointer-events:none}sd-date-range-picker-calendar .sd-date-range-picker-calendar__week{display:grid;grid-template-columns:repeat(7, var(--calendar-day-size))}sd-date-range-picker-calendar .sd-date-range-picker-calendar__week-cell{display:inline-flex;align-items:center;justify-content:center;height:20px;font-size:var(--calendar-week-font-size);line-height:var(--calendar-week-line-height);font-weight:var(--calendar-week-font-weight);color:var(--calendar-week-color)}sd-date-range-picker-calendar .sd-date-range-picker-calendar__grid{display:grid;grid-template-columns:repeat(7, var(--calendar-day-size));row-gap:var(--calendar-grid-row-gap)}sd-date-range-picker-calendar .sd-date-range-picker-calendar__day{position:relative;display:inline-flex;align-items:center;justify-content:center;width:var(--calendar-day-size);height:var(--range-height);padding:0;border:none;background:transparent;cursor:pointer;font-size:var(--calendar-day-font-size);line-height:var(--calendar-day-line-height);font-weight:var(--calendar-day-font-weight);color:var(--calendar-day-text)}sd-date-range-picker-calendar .sd-date-range-picker-calendar__day-circle{position:relative;z-index:1;display:inline-flex;align-items:center;justify-content:center;width:var(--calendar-day-circle-size);height:var(--calendar-day-circle-size);border-radius:calc(var(--calendar-day-circle-radius) * 1px);border:1px solid transparent;box-sizing:border-box}sd-date-range-picker-calendar .sd-date-range-picker-calendar__day:not(:disabled):hover .sd-date-range-picker-calendar__day-circle{border-radius:16px;border:1px solid var(--calendar-day-hover-border)}sd-date-range-picker-calendar .sd-date-range-picker-calendar__day--today .sd-date-range-picker-calendar__day-circle{font-weight:700}sd-date-range-picker-calendar .sd-date-range-picker-calendar__day--in-range{background:var(--range-bg)}sd-date-range-picker-calendar .sd-date-range-picker-calendar__day--range-start{background:linear-gradient(to right, transparent 50%, var(--range-bg) 50%)}sd-date-range-picker-calendar .sd-date-range-picker-calendar__day--range-end{background:var(--range-bg)}sd-date-range-picker-calendar .sd-date-range-picker-calendar__day--range-startsd-date-range-picker-calendar .sd-date-range-picker-calendar__day--range-end{background:transparent}sd-date-range-picker-calendar .sd-date-range-picker-calendar__day--selected .sd-date-range-picker-calendar__day-circle{border-radius:16px;background:var(--calendar-day-select-bg);color:var(--calendar-day-select-text)}sd-date-range-picker-calendar .sd-date-range-picker-calendar__day--selected:not(:disabled):hover .sd-date-range-picker-calendar__day-circle{background:var(--calendar-day-select-bg);color:var(--calendar-day-select-text)}sd-date-range-picker-calendar .sd-date-range-picker-calendar__day--disabled{color:var(--calendar-day-disabled-text);cursor:not-allowed}sd-date-range-picker-calendar .sd-date-range-picker-calendar__day--disabled:not(.sd-date-range-picker-calendar__day--in-range):not(.sd-date-range-picker-calendar__day--range-start):not(.sd-date-range-picker-calendar__day--range-end){background:none}sd-date-range-picker-calendar .sd-date-range-picker-calendar__day--empty{visibility:hidden;pointer-events:none;background:transparent}"}},[512,"sd-date-range-picker-calendar",{value:[16],selectable:[16],maxRange:[2,"max-range"],currentYear:[32],currentMonth:[32],pendingStart:[32],hoverDate:[32],displayValue:[32]},void 0,{value:[{handleValueChange:0}]}]);function u(){"undefined"!=typeof customElements&&["sd-date-range-picker-calendar","sd-ghost-button","sd-icon"].forEach((e=>{switch(e){case"sd-date-range-picker-calendar":customElements.get(t(e))||customElements.define(t(e),_);break;case"sd-ghost-button":customElements.get(t(e))||o();break;case"sd-icon":customElements.get(t(e))||h()}}))}export{_ as S,u as d}
|
|
1
|
+
import{p as e,H as a,c as r,h as n,F as d,t}from"./p-D3gjBBCU.js";import{u as i,t as c}from"./p-DTrMR0rx.js";import{d as s,W as l,C as g}from"./p-C2fDbE9d.js";import{d as o}from"./p-Dey-lS6x.js";import{d as h}from"./p-EbjZr2OA.js";const p=(e,a)=>{const[r,n,d]=e.split("-").map(Number),t=new Date(r,n-1,d);return t.setDate(t.getDate()+a),`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`},k={bg:s.datepicker.calendar.range.bg,height:s.datepicker.calendar.range.height,panelGap:s.datepicker.calendar.range.panelGap,divider:s.datepicker.calendar.range.divider},_=e(class extends a{constructor(e){super(),!1!==e&&this.__registerHost(),this.select=r(this,"sdSelect",7),this.viewChange=r(this,"sdViewChange",7)}value=null;selectable;maxRange;currentYear;currentMonth;pendingStart="";hoverDate="";displayValue=null;select;viewChange;dateUtil=i();componentWillLoad(){this.syncFromValue()}handleValueChange(){this.syncFromValue()}syncFromValue(){const e=this.value?.[0]||c,[a,r]=e.split("-").map(Number);this.currentYear=a,this.currentMonth=r,this.pendingStart="",this.hoverDate="",this.displayValue=this.value?[this.value[0],this.value[1]]:null}get rightYear(){return 12===this.currentMonth?this.currentYear+1:this.currentYear}get rightMonth(){return 12===this.currentMonth?1:this.currentMonth+1}formatDate(e,a,r){return`${e}-${String(a).padStart(2,"0")}-${String(r).padStart(2,"0")}`}buildCells(e,a){const r=new Date(e,a-1,1).getDay(),n=new Date(e,a,0).getDate(),d=1===a?12:a-1,t=1===a?e-1:e,i=new Date(t,d,0).getDate(),c=12===a?1:a+1,s=12===a?e+1:e,l=[];for(let e=r-1;e>=0;e--){const a=i-e;l.push({date:this.formatDate(t,d,a),day:a,inCurrentMonth:!1})}for(let r=1;r<=n;r++)l.push({date:this.formatDate(e,a,r),day:r,inCurrentMonth:!0});const g=(7-l.length%7)%7;for(let e=1;e<=g;e++)l.push({date:this.formatDate(s,c,e),day:e,inCurrentMonth:!1});return l}emitViewChange(){this.viewChange.emit({year:this.currentYear,month:this.currentMonth})}goPrevYear=e=>{e.stopPropagation(),this.currentYear-=1,this.emitViewChange()};goNextYear=e=>{e.stopPropagation(),this.currentYear+=1,this.emitViewChange()};goPrevMonth=e=>{e.stopPropagation();const{newYear:a,newMonth:r}=this.dateUtil.calculateYearMonth(this.currentYear,this.currentMonth,"prev");this.currentYear=a,this.currentMonth=r,this.emitViewChange()};goNextMonth=e=>{e.stopPropagation();const{newYear:a,newMonth:r}=this.dateUtil.calculateYearMonth(this.currentYear,this.currentMonth,"next");this.currentYear=a,this.currentMonth=r,this.emitViewChange()};goToday=e=>{e.stopPropagation();const[a,r]=c.split("-").map(Number);this.currentYear===a&&this.currentMonth===r||(this.currentYear=a,this.currentMonth=r,this.emitViewChange())};isDisabled(e){if(this.selectable){const[a,r]=this.selectable;if(a&&e<a)return!0;if(r&&e>r)return!0}if(this.maxRange&&this.pendingStart){const a=p(this.pendingStart,-this.maxRange),r=p(this.pendingStart,this.maxRange);if(e<a||e>r)return!0}return!1}handleDayClick(e){if(!e.inCurrentMonth)return;if(this.isDisabled(e.date))return;if(!this.pendingStart||this.displayValue&&this.displayValue[0]&&this.displayValue[1]||e.date<this.pendingStart)return this.pendingStart=e.date,this.displayValue=null,void(this.hoverDate="");const a=[this.pendingStart,e.date];this.pendingStart="",this.hoverDate="",this.displayValue=a,this.select.emit(a)}handleDayHover(e){e.inCurrentMonth&&this.pendingStart&&(this.hoverDate=e.date)}getRangeState(e,a){if(!a)return{inRange:!1,isRangeStart:!1,isRangeEnd:!1,isSelectedEdge:!1};if(this.pendingStart){const a=e===this.pendingStart,r=this.hoverDate&&this.hoverDate>=this.pendingStart?this.hoverDate:"";return{inRange:!!r&&e>this.pendingStart&&e<=r,isRangeStart:a,isRangeEnd:!!r&&e===r,isSelectedEdge:a}}if(this.displayValue&&this.displayValue[0]&&this.displayValue[1]){const[a,r]=this.displayValue,n=e===a,d=e===r;return{inRange:e>a&&e<r,isRangeStart:n,isRangeEnd:d,isSelectedEdge:n||d}}return{inRange:!1,isRangeStart:!1,isRangeEnd:!1,isSelectedEdge:!1}}renderHeader(e,a,r){const d=`${e}.${String(a).padStart(2,"0")}`;return n("div",{class:"sd-date-range-picker-calendar__header"},n("div",{class:"sd-date-range-picker-calendar__nav-group sd-date-range-picker-calendar__nav-group-month"},n("sd-ghost-button",{class:{"sd-date-range-picker-calendar__nav-placeholder":!r},ariaLabel:"prevMonth",size:"xxs",icon:"chevronLeft",onClick:this.goPrevMonth}),n("span",{class:"sd-date-range-picker-calendar__label sd-date-range-picker-calendar__label-month"},d),n("sd-ghost-button",{class:{"sd-date-range-picker-calendar__nav-placeholder":r},ariaLabel:"nextMonth",size:"xxs",icon:"chevronRight",onClick:this.goNextMonth})))}renderYearNav(){return n("div",{class:"sd-date-range-picker-calendar__top-bar"},n("div",{class:"sd-date-range-picker-calendar__year-nav"},n("sd-ghost-button",{ariaLabel:"prevYear",size:"xxs",icon:"chevronLeft",onClick:this.goPrevYear}),n("span",{class:"sd-date-range-picker-calendar__label"},this.currentYear),n("sd-ghost-button",{ariaLabel:"nextYear",size:"xxs",icon:"chevronRight",onClick:this.goNextYear})),n("button",{type:"button",class:"sd-date-range-picker-calendar__today-button",onClick:this.goToday},"오늘"))}renderPanel(e,a,r){const d=this.buildCells(e,a);return n("div",{class:"sd-date-range-picker-calendar__panel"},this.renderHeader(e,a,r),n("div",{class:"sd-date-range-picker-calendar__week"},l.map((e=>n("span",{key:e,class:"sd-date-range-picker-calendar__week-cell"},e)))),n("div",{class:"sd-date-range-picker-calendar__grid"},d.map((e=>{const{inRange:a,isRangeStart:r,isRangeEnd:d,isSelectedEdge:t}=this.getRangeState(e.date,e.inCurrentMonth),i=e.inCurrentMonth&&c===e.date,s=e.inCurrentMonth&&this.isDisabled(e.date);return n("button",{type:"button",key:e.date,class:{"sd-date-range-picker-calendar__day":!0,"sd-date-range-picker-calendar__day--empty":!e.inCurrentMonth,"sd-date-range-picker-calendar__day--today":i,"sd-date-range-picker-calendar__day--in-range":a,"sd-date-range-picker-calendar__day--range-start":r,"sd-date-range-picker-calendar__day--range-end":d,"sd-date-range-picker-calendar__day--selected":t,"sd-date-range-picker-calendar__day--disabled":s},disabled:!e.inCurrentMonth||s,tabindex:e.inCurrentMonth?void 0:-1,"aria-hidden":e.inCurrentMonth?void 0:"true",onClick:()=>this.handleDayClick(e),onMouseEnter:()=>this.handleDayHover(e)},n("span",{class:"sd-date-range-picker-calendar__day-circle"},e.inCurrentMonth?e.day:""))}))))}render(){return n(d,{key:"acc32d9c349c4cee32bb923ce66d17122527b524"},n("div",{key:"bd579429ae609c3ff21a542bf69c1dc9a907846a",class:"sd-date-range-picker-calendar",style:{"--calendar-bg":g.bg,"--calendar-padding":`${g.paddingXY}px`,"--calendar-gap":`${g.gap}px`,"--calendar-radius":`${g.radius}px`,"--calendar-header-gap":`${g.header.gap}px`,"--calendar-header-divider":g.header.divider,"--calendar-header-font-size":`${g.header.fontSize}px`,"--calendar-header-line-height":`${g.header.lineHeight}px`,"--calendar-header-font-weight":g.header.fontWeight,"--calendar-week-font-size":`${g.week.fontSize}px`,"--calendar-week-line-height":`${g.week.lineHeight}px`,"--calendar-week-font-weight":g.week.fontWeight,"--calendar-week-color":g.week.color,"--calendar-grid-row-gap":`${g.grid.rowGap}px`,"--calendar-day-size":`${g.day.size}px`,"--calendar-day-circle-size":`${g.day.circleSize}px`,"--calendar-day-circle-radius":`${g.day.circleRadius}px`,"--calendar-day-text":g.day.defaultText,"--calendar-day-hover-text":g.day.hoverText,"--calendar-day-hover-border":g.day.hoverBorder,"--calendar-day-select-bg":g.day.selectBg,"--calendar-day-select-text":g.day.selectText,"--calendar-day-disabled-text":g.day.disabledText,"--calendar-day-font-size":`${g.day.fontSize}px`,"--calendar-day-line-height":`${g.day.lineHeight}px`,"--calendar-day-font-weight":g.day.fontWeight,"--range-bg":k.bg,"--range-height":`${k.height}px`,"--range-panel-gap":`${k.panelGap}px`,"--range-divider":k.divider}},this.renderYearNav(),n("div",{key:"8a46d922fcaa09bd7f778d00e77324d1710b92c7",class:"sd-date-range-picker-calendar__panels"},this.renderPanel(this.currentYear,this.currentMonth,!0),n("span",{key:"8234838995f1e5d945f85169e702cb0b32018f36",class:"sd-date-range-picker-calendar__divider","aria-hidden":"true"}),this.renderPanel(this.rightYear,this.rightMonth,!1))))}static get watchers(){return{value:[{handleValueChange:0}]}}static get style(){return"sd-date-range-picker-calendar{display:block}sd-date-range-picker-calendar .sd-date-range-picker-calendar{display:flex;flex-direction:column;gap:var(--calendar-gap);height:364px;padding:var(--calendar-padding);background:var(--calendar-bg);border-radius:var(--calendar-radius);box-shadow:2px 2px 12px 2px rgba(0, 0, 0, 0.2);user-select:none}sd-date-range-picker-calendar .sd-date-range-picker-calendar__top-bar{position:relative;display:flex;align-items:center;justify-content:center}sd-date-range-picker-calendar .sd-date-range-picker-calendar__year-nav{display:flex;align-items:center;justify-content:center;gap:var(--calendar-gap);font-size:var(--calendar-header-font-size);line-height:var(--calendar-header-line-height);font-weight:var(--calendar-header-font-weight);color:var(--calendar-day-text)}sd-date-range-picker-calendar .sd-date-range-picker-calendar__today-button{position:absolute;right:0;background:transparent;cursor:pointer;font-size:var(--calendar-week-font-size);font-weight:var(--calendar-header-font-weight);color:var(--calendar-day-text);min-width:37px;height:24px;line-height:24px;text-align:center}sd-date-range-picker-calendar .sd-date-range-picker-calendar__today-button:hover{text-decoration:underline}sd-date-range-picker-calendar .sd-date-range-picker-calendar__panels{display:flex;flex-direction:row;gap:var(--range-panel-gap)}sd-date-range-picker-calendar .sd-date-range-picker-calendar__divider{flex-shrink:0;width:1px;background:var(--range-divider)}sd-date-range-picker-calendar .sd-date-range-picker-calendar__panel{display:flex;flex-direction:column;gap:var(--calendar-gap)}sd-date-range-picker-calendar .sd-date-range-picker-calendar__header{display:flex;flex-flow:column nowrap;align-items:center;justify-content:center;gap:var(--calendar-header-gap);font-size:var(--calendar-header-font-size);line-height:var(--calendar-header-line-height);font-weight:var(--calendar-header-font-weight);color:var(--calendar-day-text)}sd-date-range-picker-calendar .sd-date-range-picker-calendar__nav-group{display:inline-flex;align-items:center;gap:var(--calendar-gap)}sd-date-range-picker-calendar .sd-date-range-picker-calendar__nav-group-month{display:flex;width:100%;align-items:center;gap:var(--calendar-gap)}sd-date-range-picker-calendar .sd-date-range-picker-calendar__label{display:inline-flex;align-items:center;justify-content:center;min-width:40px;text-align:center}sd-date-range-picker-calendar .sd-date-range-picker-calendar__label-month{flex:1}sd-date-range-picker-calendar .sd-date-range-picker-calendar__nav-placeholder{visibility:hidden;pointer-events:none}sd-date-range-picker-calendar .sd-date-range-picker-calendar__week{display:grid;grid-template-columns:repeat(7, var(--calendar-day-size))}sd-date-range-picker-calendar .sd-date-range-picker-calendar__week-cell{display:inline-flex;align-items:center;justify-content:center;height:20px;font-size:var(--calendar-week-font-size);line-height:var(--calendar-week-line-height);font-weight:var(--calendar-week-font-weight);color:var(--calendar-week-color)}sd-date-range-picker-calendar .sd-date-range-picker-calendar__grid{display:grid;grid-template-columns:repeat(7, var(--calendar-day-size));row-gap:var(--calendar-grid-row-gap)}sd-date-range-picker-calendar .sd-date-range-picker-calendar__day{position:relative;display:inline-flex;align-items:center;justify-content:center;width:var(--calendar-day-size);height:var(--range-height);padding:0;border:none;background:transparent;cursor:pointer;font-size:var(--calendar-day-font-size);line-height:var(--calendar-day-line-height);font-weight:var(--calendar-day-font-weight);color:var(--calendar-day-text)}sd-date-range-picker-calendar .sd-date-range-picker-calendar__day-circle{position:relative;z-index:1;display:inline-flex;align-items:center;justify-content:center;width:var(--calendar-day-circle-size);height:var(--calendar-day-circle-size);border-radius:calc(var(--calendar-day-circle-radius) * 1px);border:1px solid transparent;box-sizing:border-box}sd-date-range-picker-calendar .sd-date-range-picker-calendar__day:not(:disabled):hover .sd-date-range-picker-calendar__day-circle{border-radius:16px;border:1px solid var(--calendar-day-hover-border)}sd-date-range-picker-calendar .sd-date-range-picker-calendar__day--today .sd-date-range-picker-calendar__day-circle{font-weight:700}sd-date-range-picker-calendar .sd-date-range-picker-calendar__day--in-range{background:var(--range-bg)}sd-date-range-picker-calendar .sd-date-range-picker-calendar__day--range-start{background:linear-gradient(to right, transparent 50%, var(--range-bg) 50%)}sd-date-range-picker-calendar .sd-date-range-picker-calendar__day--range-end{background:var(--range-bg)}sd-date-range-picker-calendar .sd-date-range-picker-calendar__day--range-startsd-date-range-picker-calendar .sd-date-range-picker-calendar__day--range-end{background:transparent}sd-date-range-picker-calendar .sd-date-range-picker-calendar__day--selected .sd-date-range-picker-calendar__day-circle{border-radius:16px;background:var(--calendar-day-select-bg);color:var(--calendar-day-select-text)}sd-date-range-picker-calendar .sd-date-range-picker-calendar__day--selected:not(:disabled):hover .sd-date-range-picker-calendar__day-circle{background:var(--calendar-day-select-bg);color:var(--calendar-day-select-text)}sd-date-range-picker-calendar .sd-date-range-picker-calendar__day--disabled{color:var(--calendar-day-disabled-text);cursor:not-allowed}sd-date-range-picker-calendar .sd-date-range-picker-calendar__day--disabled:not(.sd-date-range-picker-calendar__day--in-range):not(.sd-date-range-picker-calendar__day--range-start):not(.sd-date-range-picker-calendar__day--range-end){background:none}sd-date-range-picker-calendar .sd-date-range-picker-calendar__day--empty{visibility:hidden;pointer-events:none;background:transparent}"}},[512,"sd-date-range-picker-calendar",{value:[16],selectable:[16],maxRange:[2,"max-range"],currentYear:[32],currentMonth:[32],pendingStart:[32],hoverDate:[32],displayValue:[32]},void 0,{value:[{handleValueChange:0}]}]);function u(){"undefined"!=typeof customElements&&["sd-date-range-picker-calendar","sd-ghost-button","sd-icon"].forEach((e=>{switch(e){case"sd-date-range-picker-calendar":customElements.get(t(e))||customElements.define(t(e),_);break;case"sd-ghost-button":customElements.get(t(e))||o();break;case"sd-icon":customElements.get(t(e))||h()}}))}export{_ as S,u as d}
|