@sellmate/design-system 0.0.23 → 0.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/design-system.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/{esm/color-CgyTlXBV.js → cjs/resolveColor-DxvExwgo.js} +17 -4
- package/dist/cjs/{resolveColor-CauSLF0s.js.map → resolveColor-DxvExwgo.js.map} +1 -1
- package/dist/cjs/sd-badge.cjs.entry.js +2 -3
- package/dist/cjs/sd-badge.entry.cjs.js.map +1 -1
- package/dist/cjs/sd-button.sd-checkbox.sd-guide.sd-icon.sd-input.sd-pagination.sd-portal.sd-select.sd-select-option.sd-table.sd-tooltip.sd-tooltip-portal.entry.cjs.js.map +1 -0
- package/dist/cjs/{sd-checkbox_9.cjs.entry.js → sd-button_12.cjs.entry.js} +738 -816
- package/dist/cjs/sd-card.cjs.entry.js +1 -1
- package/dist/cjs/sd-date-picker.cjs.entry.js +2 -2
- package/dist/cjs/sd-date-range-picker.cjs.entry.js +2 -2
- package/dist/cjs/sd-popover.cjs.entry.js +2 -2
- package/dist/cjs/sd-select-multiple-group.cjs.entry.js +380 -0
- package/dist/cjs/sd-select-multiple-group.entry.cjs.js.map +1 -0
- package/dist/cjs/sd-select-multiple.cjs.entry.js +263 -0
- package/dist/cjs/sd-select-multiple.entry.cjs.js.map +1 -0
- package/dist/cjs/sd-select-option-group.cjs.entry.js +69 -0
- package/dist/cjs/sd-select-option-group.entry.cjs.js.map +1 -0
- package/dist/cjs/sd-tag.cjs.entry.js +1 -1
- package/dist/cjs/select-keyboard-navigation-6fO_V4En.js +119 -0
- package/dist/cjs/select-keyboard-navigation-6fO_V4En.js.map +1 -0
- package/dist/collection/components/sd-badge/sd-badge.js +1 -1
- package/dist/collection/components/sd-card/sd-card.js +1 -1
- package/dist/collection/components/sd-date-picker/sd-date-picker.js +2 -2
- package/dist/collection/components/sd-date-range-picker/sd-date-range-picker.js +2 -2
- package/dist/collection/components/sd-guide/sd-guide.css +6 -1
- package/dist/collection/components/sd-guide/sd-guide.js +4 -4
- package/dist/collection/components/sd-guide/sd-guide.js.map +1 -1
- package/dist/collection/components/sd-icon/sd-icon.js +1 -1
- package/dist/collection/components/sd-input/sd-input.js +2 -2
- package/dist/collection/components/sd-pagination/sd-pagination.js +2 -3
- package/dist/collection/components/sd-pagination/sd-pagination.js.map +1 -1
- package/dist/collection/components/sd-popover/sd-popover.js +2 -2
- package/dist/collection/components/sd-portal/sd-portal.js +25 -4
- package/dist/collection/components/sd-portal/sd-portal.js.map +1 -1
- package/dist/collection/components/sd-select/sd-select-option/sd-select-option.js +1 -1
- package/dist/collection/components/sd-select/sd-select.css +0 -6
- package/dist/collection/components/sd-select-multiple/sd-select-multiple.css +0 -6
- package/dist/collection/components/sd-select-multiple/sd-select-multiple.js +2 -2
- package/dist/collection/components/sd-select-multiple-group/sd-select-multiple-group.css +0 -6
- package/dist/collection/components/sd-select-multiple-group/sd-select-option-group/sd-select-option-group.js +3 -3
- package/dist/collection/components/sd-table/sd-table.css +7 -1316
- package/dist/collection/components/sd-table/sd-table.js +99 -8
- package/dist/collection/components/sd-table/sd-table.js.map +1 -1
- package/dist/collection/components/sd-tag/sd-tag.js +1 -1
- package/dist/collection/components/sd-tooltip/sd-tooltip.js +4 -4
- package/dist/collection/components/sd-tooltip-portal/sd-tooltip-portal.js +1 -1
- package/dist/components/{p-QBJzxOWs.js → p-B0qn2Tb-.js} +3 -3
- package/dist/components/{p-QBJzxOWs.js.map → p-B0qn2Tb-.js.map} +1 -1
- package/dist/components/{p-DNUN6dGL.js → p-BHl-WJWF.js} +6 -7
- package/dist/components/p-BHl-WJWF.js.map +1 -0
- package/dist/components/{p-BqIcTSCQ.js → p-BRrY7yTi.js} +3 -3
- package/dist/components/{p-BqIcTSCQ.js.map → p-BRrY7yTi.js.map} +1 -1
- package/dist/components/{p-CbTvFUCY.js → p-B_lWW-k_.js} +27 -6
- package/dist/components/p-B_lWW-k_.js.map +1 -0
- package/dist/components/{p-CZG8wDBH.js → p-CpfDowFL.js} +3 -3
- package/dist/components/{p-CZG8wDBH.js.map → p-CpfDowFL.js.map} +1 -1
- package/dist/components/{p-aU8C4Pcb.js → p-D9gy3nk_.js} +7 -7
- package/dist/components/{p-aU8C4Pcb.js.map → p-D9gy3nk_.js.map} +1 -1
- package/dist/components/p-Dar88QJr.js +323 -0
- package/dist/components/p-Dar88QJr.js.map +1 -0
- package/dist/components/{p-Bl-wgv-z.js → p-Db_plCmk.js} +5 -5
- package/dist/components/{p-Bl-wgv-z.js.map → p-Db_plCmk.js.map} +1 -1
- package/dist/components/{p-nehvpX7w.js → p-DzIffEfK.js} +3 -3
- package/dist/components/{p-nehvpX7w.js.map → p-DzIffEfK.js.map} +1 -1
- package/dist/components/{p-DpiRZxT1.js → p-Ed1-kFCj.js} +5 -5
- package/dist/components/{p-DpiRZxT1.js.map → p-Ed1-kFCj.js.map} +1 -1
- package/dist/components/{p-Cxrr7vOk.js → p-_8cdZlN5.js} +9 -9
- package/dist/components/{p-Cxrr7vOk.js.map → p-_8cdZlN5.js.map} +1 -1
- package/dist/components/sd-badge.js +1 -1
- package/dist/components/sd-button.js +1 -1
- package/dist/components/sd-card.js +1 -1
- package/dist/components/sd-checkbox.js +1 -1
- package/dist/components/sd-date-picker.js +5 -5
- package/dist/components/sd-date-range-picker.js +5 -5
- package/dist/components/sd-guide.js +8 -8
- package/dist/components/sd-guide.js.map +1 -1
- package/dist/components/sd-icon.js +1 -1
- package/dist/components/sd-input.js +1 -1
- package/dist/components/sd-pagination.js +1 -1
- package/dist/components/sd-popover.js +5 -5
- package/dist/components/sd-portal.js +1 -1
- package/dist/components/sd-select-multiple-group.js +6 -6
- package/dist/components/sd-select-multiple-group.js.map +1 -1
- package/dist/components/sd-select-multiple.js +8 -8
- package/dist/components/sd-select-multiple.js.map +1 -1
- package/dist/components/sd-select-option-group.js +1 -1
- package/dist/components/sd-select-option.js +1 -1
- package/dist/components/sd-select.js +1 -318
- package/dist/components/sd-select.js.map +1 -1
- package/dist/components/sd-table.js +73 -19
- package/dist/components/sd-table.js.map +1 -1
- package/dist/components/sd-tag.js +1 -1
- package/dist/components/sd-tooltip-portal.js +1 -1
- package/dist/components/sd-tooltip.js +1 -1
- package/dist/design-system/design-system.esm.js +1 -1
- package/dist/design-system/p-33ce46fa.entry.js +2 -0
- package/dist/design-system/p-33ce46fa.entry.js.map +1 -0
- package/dist/design-system/p-52365554.entry.js +2 -0
- package/dist/design-system/{p-2aef624e.entry.js → p-58257c45.entry.js} +2 -2
- package/dist/design-system/p-7a71b770.entry.js +2 -0
- package/dist/design-system/p-7a71b770.entry.js.map +1 -0
- package/dist/design-system/{p-CgyTlXBV.js → p-BYf-ybt2.js} +2 -2
- package/dist/design-system/{p-BoLmB6pG.js.map → p-BYf-ybt2.js.map} +1 -1
- package/dist/design-system/p-C2JaR3A6.js +2 -0
- package/dist/design-system/p-C2JaR3A6.js.map +1 -0
- package/dist/design-system/p-b6bb891c.entry.js +2 -0
- package/dist/design-system/{p-c4f5ed94.entry.js → p-c96e287b.entry.js} +2 -2
- package/dist/design-system/p-dc35d827.entry.js +2 -0
- package/dist/design-system/p-dc35d827.entry.js.map +1 -0
- package/dist/design-system/p-f00fc7be.entry.js +2 -0
- package/dist/design-system/p-f00fc7be.entry.js.map +1 -0
- package/dist/design-system/{p-b537f724.entry.js → p-fcbeccb8.entry.js} +2 -2
- package/dist/design-system/p-ffe8c43b.entry.js +2 -0
- package/dist/design-system/p-ffe8c43b.entry.js.map +1 -0
- package/dist/design-system/sd-badge.entry.esm.js.map +1 -1
- package/dist/design-system/sd-button.sd-checkbox.sd-guide.sd-icon.sd-input.sd-pagination.sd-portal.sd-select.sd-select-option.sd-table.sd-tooltip.sd-tooltip-portal.entry.esm.js.map +1 -0
- package/dist/design-system/sd-select-multiple-group.entry.esm.js.map +1 -0
- package/dist/design-system/sd-select-multiple.entry.esm.js.map +1 -0
- package/dist/design-system/sd-select-option-group.entry.esm.js.map +1 -0
- package/dist/esm/design-system.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/{cjs/color-Oz29vj7L.js → esm/resolveColor-BYf-ybt2.js} +14 -6
- package/dist/esm/{resolveColor-CswQ9y2Q.js.map → resolveColor-BYf-ybt2.js.map} +1 -1
- package/dist/esm/sd-badge.entry.js +2 -3
- package/dist/esm/sd-badge.entry.js.map +1 -1
- package/dist/esm/sd-button.sd-checkbox.sd-guide.sd-icon.sd-input.sd-pagination.sd-portal.sd-select.sd-select-option.sd-table.sd-tooltip.sd-tooltip-portal.entry.js.map +1 -0
- package/dist/esm/{sd-checkbox_9.entry.js → sd-button_12.entry.js} +732 -813
- package/dist/esm/sd-card.entry.js +1 -1
- package/dist/esm/sd-date-picker.entry.js +2 -2
- package/dist/esm/sd-date-range-picker.entry.js +2 -2
- package/dist/esm/sd-popover.entry.js +2 -2
- package/dist/esm/sd-select-multiple-group.entry.js +378 -0
- package/dist/esm/sd-select-multiple-group.entry.js.map +1 -0
- package/dist/esm/sd-select-multiple.entry.js +261 -0
- package/dist/esm/sd-select-multiple.entry.js.map +1 -0
- package/dist/esm/sd-select-option-group.entry.js +67 -0
- package/dist/esm/sd-select-option-group.entry.js.map +1 -0
- package/dist/esm/sd-tag.entry.js +1 -1
- package/dist/esm/select-keyboard-navigation-C2JaR3A6.js +116 -0
- package/dist/esm/select-keyboard-navigation-C2JaR3A6.js.map +1 -0
- package/dist/types/components/sd-table/sd-table.d.ts +4 -0
- package/dist/types/components.d.ts +24 -0
- package/hydrate/index.js +98 -47
- package/hydrate/index.mjs +98 -47
- package/package.json +2 -2
- package/dist/cjs/color-Oz29vj7L.js.map +0 -1
- package/dist/cjs/resolveColor-CauSLF0s.js +0 -18
- package/dist/cjs/sd-button.sd-tooltip-portal.entry.cjs.js.map +0 -1
- package/dist/cjs/sd-button_2.cjs.entry.js +0 -221
- package/dist/cjs/sd-checkbox.sd-icon.sd-input.sd-portal.sd-select.sd-select-multiple.sd-select-multiple-group.sd-select-option.sd-select-option-group.entry.cjs.js.map +0 -1
- package/dist/cjs/sd-guide.cjs.entry.js +0 -84
- package/dist/cjs/sd-guide.entry.cjs.js.map +0 -1
- package/dist/cjs/sd-pagination.sd-tooltip.entry.cjs.js.map +0 -1
- package/dist/cjs/sd-pagination_2.cjs.entry.js +0 -168
- package/dist/cjs/sd-table.cjs.entry.js +0 -231
- package/dist/cjs/sd-table.entry.cjs.js.map +0 -1
- package/dist/components/p-CbTvFUCY.js.map +0 -1
- package/dist/components/p-DNUN6dGL.js.map +0 -1
- package/dist/design-system/p-158f9392.entry.js +0 -2
- package/dist/design-system/p-158f9392.entry.js.map +0 -1
- package/dist/design-system/p-37042d15.entry.js +0 -2
- package/dist/design-system/p-37042d15.entry.js.map +0 -1
- package/dist/design-system/p-949de8eb.entry.js +0 -2
- package/dist/design-system/p-949de8eb.entry.js.map +0 -1
- package/dist/design-system/p-9f5eed30.entry.js +0 -2
- package/dist/design-system/p-BoLmB6pG.js +0 -2
- package/dist/design-system/p-CgyTlXBV.js.map +0 -1
- package/dist/design-system/p-abfa217b.entry.js +0 -2
- package/dist/design-system/p-abfa217b.entry.js.map +0 -1
- package/dist/design-system/p-adee3154.entry.js +0 -2
- package/dist/design-system/p-adee3154.entry.js.map +0 -1
- package/dist/design-system/p-bda05b6f.entry.js +0 -2
- package/dist/design-system/p-bda05b6f.entry.js.map +0 -1
- package/dist/design-system/p-f015c024.entry.js +0 -2
- package/dist/design-system/sd-button.sd-tooltip-portal.entry.esm.js.map +0 -1
- package/dist/design-system/sd-checkbox.sd-icon.sd-input.sd-portal.sd-select.sd-select-multiple.sd-select-multiple-group.sd-select-option.sd-select-option-group.entry.esm.js.map +0 -1
- package/dist/design-system/sd-guide.entry.esm.js.map +0 -1
- package/dist/design-system/sd-pagination.sd-tooltip.entry.esm.js.map +0 -1
- package/dist/design-system/sd-table.entry.esm.js.map +0 -1
- package/dist/esm/color-CgyTlXBV.js.map +0 -1
- package/dist/esm/resolveColor-CswQ9y2Q.js +0 -16
- package/dist/esm/sd-button.sd-tooltip-portal.entry.js.map +0 -1
- package/dist/esm/sd-button_2.entry.js +0 -218
- package/dist/esm/sd-checkbox.sd-icon.sd-input.sd-portal.sd-select.sd-select-multiple.sd-select-multiple-group.sd-select-option.sd-select-option-group.entry.js.map +0 -1
- package/dist/esm/sd-guide.entry.js +0 -82
- package/dist/esm/sd-guide.entry.js.map +0 -1
- package/dist/esm/sd-pagination.sd-tooltip.entry.js.map +0 -1
- package/dist/esm/sd-pagination_2.entry.js +0 -165
- package/dist/esm/sd-table.entry.js +0 -229
- package/dist/esm/sd-table.entry.js.map +0 -1
- /package/dist/design-system/{p-9f5eed30.entry.js.map → p-52365554.entry.js.map} +0 -0
- /package/dist/design-system/{p-2aef624e.entry.js.map → p-58257c45.entry.js.map} +0 -0
- /package/dist/design-system/{p-f015c024.entry.js.map → p-b6bb891c.entry.js.map} +0 -0
- /package/dist/design-system/{p-c4f5ed94.entry.js.map → p-c96e287b.entry.js.map} +0 -0
- /package/dist/design-system/{p-b537f724.entry.js.map → p-fcbeccb8.entry.js.map} +0 -0
|
@@ -65,9 +65,30 @@ const SdPortal = /*@__PURE__*/ proxyCustomElement(class SdPortal extends H {
|
|
|
65
65
|
this.rafId = requestAnimationFrame(() => {
|
|
66
66
|
if (!this.parentRef || !this.wrapper)
|
|
67
67
|
return;
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
const parentRect = this.parentRef.getBoundingClientRect();
|
|
69
|
+
const wrapperRect = this.wrapper.getBoundingClientRect();
|
|
70
|
+
const viewport = {
|
|
71
|
+
width: window.innerWidth,
|
|
72
|
+
height: window.innerHeight,
|
|
73
|
+
};
|
|
74
|
+
let top = parentRect.bottom + window.scrollY + this.offset[1];
|
|
75
|
+
let left = parentRect.left + window.scrollX + this.offset[0];
|
|
76
|
+
// 화면 상하단 넘어갈 시 반전
|
|
77
|
+
if (parentRect.bottom + wrapperRect.height + this.offset[1] > viewport.height) {
|
|
78
|
+
top = parentRect.top + window.scrollY - wrapperRect.height - this.offset[1];
|
|
79
|
+
}
|
|
80
|
+
if (top < window.scrollY) {
|
|
81
|
+
top = parentRect.bottom + window.scrollY + this.offset[1];
|
|
82
|
+
}
|
|
83
|
+
// 화면 좌우측 넘어갈 시 반전
|
|
84
|
+
if (parentRect.left + wrapperRect.width + this.offset[0] > viewport.width) {
|
|
85
|
+
left = parentRect.right + window.scrollX - wrapperRect.width - this.offset[0];
|
|
86
|
+
}
|
|
87
|
+
if (left < 0) {
|
|
88
|
+
left = this.offset[0];
|
|
89
|
+
}
|
|
90
|
+
this.wrapper.style.top = `${top}px`;
|
|
91
|
+
this.wrapper.style.left = `${left}px`;
|
|
71
92
|
});
|
|
72
93
|
}
|
|
73
94
|
// parentRef의 이동 / 크기변경 감지
|
|
@@ -100,7 +121,7 @@ const SdPortal = /*@__PURE__*/ proxyCustomElement(class SdPortal extends H {
|
|
|
100
121
|
this.sdClose.emit();
|
|
101
122
|
}
|
|
102
123
|
render() {
|
|
103
|
-
return h("slot", { key: '
|
|
124
|
+
return h("slot", { key: '4f344b083ff3a2d32d1a23f99e90687aeeb676b1' });
|
|
104
125
|
}
|
|
105
126
|
}, [772, "sd-portal", {
|
|
106
127
|
"to": [1],
|
|
@@ -124,6 +145,6 @@ function defineCustomElement() {
|
|
|
124
145
|
}
|
|
125
146
|
|
|
126
147
|
export { SdPortal as S, defineCustomElement as d };
|
|
127
|
-
//# sourceMappingURL=p-
|
|
148
|
+
//# sourceMappingURL=p-B_lWW-k_.js.map
|
|
128
149
|
|
|
129
|
-
//# sourceMappingURL=p-
|
|
150
|
+
//# sourceMappingURL=p-B_lWW-k_.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"p-B_lWW-k_.js","mappings":";;MAMa,QAAQ,iBAAAA,kBAAA,CAAA,MAAA,QAAA,SAAAC,CAAA,CAAA;;;;;;;;;IAEZ,EAAE,GAAyB,MAAM;IACjC,SAAS,GAAu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MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;QACzE,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE;AAC5C,YAAA,SAAS,EAAE,IAAI;AACf,YAAA,OAAO,EAAE,IAAI;AACb,SAAA,CAAC;;IAGK,eAAe,GAAA;AACtB,QAAA,IAAI,CAAC,cAAc,EAAE,UAAU,EAAE;AACjC,QAAA,IAAI,CAAC,gBAAgB,EAAE,UAAU,EAAE;;;AAKpC,IAAA,eAAe,CAAC,CAAa,EAAA;QAC5B,IAAI,CAAC,aAAa,GAAG,CAAC,EAAE,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAc,CAAC,CAAC;;AAIjF,IAAA,iBAAiB,CAAC,CAAa,EAAA;AAC9B,QAAA,IAAI,IAAI,CAAC,aAAa,EAAE;AACvB,YAAA,IAAI,CAAC,aAAa,GAAG,KAAK;YAC1B;;QAED,IAAI,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,MAAc,CAAC;YAAE;AAC9C,QAAA,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE;;IAGpB,MAAM,GAAA;QACL,OAAO,8DAAa;;;;;;;;;;;;;;;;;;;;;;;;;","names":["__stencil_proxyCustomElement","HTMLElement"],"sources":["src/components/sd-portal/sd-portal.tsx"],"sourcesContent":["import { Component, Element, Event, EventEmitter, Listen, Prop, h } from '@stencil/core';\r\n\r\n@Component({\r\n tag: 'sd-portal',\r\n shadow: false,\r\n})\r\nexport class SdPortal {\r\n @Element() hostEl!: HTMLElement;\r\n @Prop() to: HTMLElement | string = 'body';\r\n @Prop() parentRef: HTMLElement | null = null;\r\n @Prop() offset: [number, number] = [0, 4];\r\n @Prop() zIndex: number = 9999;\r\n @Prop() open: boolean = false;\r\n\r\n @Event() sdClose!: EventEmitter<void>;\r\n\r\n private container?: HTMLElement;\r\n private wrapper?: HTMLElement;\r\n private rafId?: number;\r\n private isInsideClick = false;\r\n\r\n private resizeObserver?: ResizeObserver;\r\n private mutationObserver?: MutationObserver;\r\n\r\n componentDidLoad() {\r\n this.container = this.resolveContainer();\r\n this.createWrapper();\r\n this.moveSlotContent();\r\n this.updatePosition();\r\n this.observeParent();\r\n }\r\n\r\n componentDidRender() {\r\n if (!this.wrapper) return;\r\n this.wrapper.style.display = this.open ? 'block' : 'none';\r\n if (this.open) this.updatePosition();\r\n }\r\n\r\n disconnectedCallback() {\r\n this.unobserveParent();\r\n this.wrapper?.remove();\r\n }\r\n\r\n private resolveContainer(): HTMLElement {\r\n const el = typeof this.to === 'string' ? document.querySelector(this.to) : this.to;\r\n return el instanceof HTMLElement ? el : document.body;\r\n }\r\n\r\n private createWrapper() {\r\n this.wrapper = document.createElement('div');\r\n Object.assign(this.wrapper.style, {\r\n position: 'absolute',\r\n zIndex: this.zIndex.toString(),\r\n transition: 'opacity 0.4s',\r\n });\r\n this.container!.appendChild(this.wrapper);\r\n }\r\n\r\n private moveSlotContent() {\r\n if (!this.wrapper) return;\r\n const nodes = Array.from(this.hostEl.childNodes).filter(n => n.nodeType !== Node.COMMENT_NODE);\r\n nodes.forEach(n => this.wrapper!.appendChild(n));\r\n }\r\n\r\n // 위치 갱신 (scroll / resize)\r\n @Listen('scroll', { target: 'window' })\r\n @Listen('resize', { target: 'window' })\r\n updatePosition() {\r\n if (this.rafId) cancelAnimationFrame(this.rafId);\r\n this.rafId = requestAnimationFrame(() => {\r\n if (!this.parentRef || !this.wrapper) return;\r\n\r\n const parentRect = this.parentRef.getBoundingClientRect();\r\n const wrapperRect = this.wrapper.getBoundingClientRect();\r\n const viewport = {\r\n width: window.innerWidth,\r\n height: window.innerHeight,\r\n };\r\n\r\n let top = parentRect.bottom + window.scrollY + this.offset[1];\r\n let left = parentRect.left + window.scrollX + this.offset[0];\r\n\r\n // 화면 상하단 넘어갈 시 반전\r\n if (parentRect.bottom + wrapperRect.height + this.offset[1] > viewport.height) {\r\n top = parentRect.top + window.scrollY - wrapperRect.height - this.offset[1];\r\n }\r\n if (top < window.scrollY) {\r\n top = parentRect.bottom + window.scrollY + this.offset[1];\r\n }\r\n\r\n // 화면 좌우측 넘어갈 시 반전\r\n if (parentRect.left + wrapperRect.width + this.offset[0] > viewport.width) {\r\n left = parentRect.right + window.scrollX - wrapperRect.width - this.offset[0];\r\n }\r\n if (left < 0) {\r\n left = this.offset[0];\r\n }\r\n\r\n this.wrapper.style.top = `${top}px`;\r\n this.wrapper.style.left = `${left}px`;\r\n });\r\n }\r\n\r\n // parentRef의 이동 / 크기변경 감지\r\n private observeParent() {\r\n if (!this.parentRef) return;\r\n\r\n this.resizeObserver = new ResizeObserver(() => this.updatePosition());\r\n this.resizeObserver.observe(this.parentRef);\r\n\r\n this.mutationObserver = new MutationObserver(() => this.updatePosition());\r\n this.mutationObserver.observe(document.body, {\r\n childList: true,\r\n subtree: true,\r\n });\r\n }\r\n\r\n private unobserveParent() {\r\n this.resizeObserver?.disconnect();\r\n this.mutationObserver?.disconnect();\r\n }\r\n\r\n // 외부 클릭 감지\r\n @Listen('mousedown', { target: 'window' })\r\n handleMouseDown(e: MouseEvent) {\r\n this.isInsideClick = !!(this.wrapper && this.wrapper.contains(e.target as Node));\r\n }\r\n\r\n @Listen('click', { target: 'window' })\r\n handleWindowClick(e: MouseEvent) {\r\n if (this.isInsideClick) {\r\n this.isInsideClick = false;\r\n return;\r\n }\r\n if (this.wrapper?.contains(e.target as Node)) return;\r\n this.sdClose.emit();\r\n }\r\n\r\n render() {\r\n return <slot></slot>;\r\n }\r\n}\r\n"],"version":3}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, d as createEvent, h } from './p-DzRr3BEe.js';
|
|
2
|
-
import { d as defineCustomElement$1 } from './p-
|
|
2
|
+
import { d as defineCustomElement$1 } from './p-DzIffEfK.js';
|
|
3
3
|
|
|
4
4
|
const sdCheckboxCss = "sd-checkbox{display:inline-block;height:20px;line-height:0}sd-checkbox .sd-checkbox{cursor:pointer;display:inline-flex;align-items:center;gap:8px;height:20px;max-height:20px}sd-checkbox .sd-checkbox>input{display:none}sd-checkbox .sd-checkbox:hover.sd-checkbox--checked .sd-checkbox__bg,sd-checkbox .sd-checkbox:hover.sd-checkbox--indeterminate .sd-checkbox__bg{border-color:#005cc9;background:#005cc9}sd-checkbox .sd-checkbox:hover.sd-checkbox--unchecked .sd-checkbox__bg{border:1px solid #0075ff;background:#d9eaff}sd-checkbox .sd-checkbox:hover.sd-checkbox--disabled .sd-checkbox__bg{border:1px solid transparent;background:#eeeeee}sd-checkbox .sd-checkbox__bg{width:16px;height:16px;border-radius:2px;border:1px solid #888888;box-sizing:border-box;display:inline-flex;justify-content:center;align-items:center;overflow:hidden;line-height:0}sd-checkbox .sd-checkbox__label{font-size:12px;color:#333333;line-height:20px}sd-checkbox .sd-checkbox--checked.sd-checkbox--disabled .sd-checkbox__bg,sd-checkbox .sd-checkbox--indeterminate.sd-checkbox--disabled .sd-checkbox__bg{background:#eeeeee;border:1px solid #cccccc !important}sd-checkbox .sd-checkbox--checked .sd-checkbox__bg,sd-checkbox .sd-checkbox--indeterminate .sd-checkbox__bg{border:1px solid #0075ff;background:#0075ff}sd-checkbox .sd-checkbox--unchecked .sd-checkbox__bg{background:white}sd-checkbox .sd-checkbox--disabled{cursor:not-allowed}sd-checkbox .sd-checkbox--disabled .sd-checkbox__bg{background:#eeeeee;border:1px solid #cccccc !important}";
|
|
5
5
|
|
|
@@ -113,6 +113,6 @@ function defineCustomElement() {
|
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
export { SdCheckbox as S, defineCustomElement as d };
|
|
116
|
-
//# sourceMappingURL=p-
|
|
116
|
+
//# sourceMappingURL=p-CpfDowFL.js.map
|
|
117
117
|
|
|
118
|
-
//# sourceMappingURL=p-
|
|
118
|
+
//# sourceMappingURL=p-CpfDowFL.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"p-
|
|
1
|
+
{"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UAAU,EACpC,KAAK,EAAE,IAAI,CAAC,eAAe,EAAA,EAE3B,CAAA,CAAA,OAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EACC,IAAI,EAAC,UAAU,EACf,KAAK,EAAE,IAAI,CAAC,GAAG,EACf,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS,EACzB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,QAAQ,EAAE,IAAI,CAAC,YAAY,EAC3B,IAAI,EAAE,IAAI,CAAC,KAAK,IAAI,UAAU,EAC7B,CAAA,EACF,CAAK,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,KAAK,EAAC,iBAAiB,EAC1B,EAAA,IAAI,CAAC,SAAS,KAAK,KAAK,IACxB,CACC,CAAA,SAAA,EAAA,EAAA,IAAI,EAAE,IAAI,CAAC,SAAS,KAAK,IAAI,GAAG,OAAO,GAAG,OAAO,EACjD,IAAI,EAAE,EAAE,EACR,KAAK,EAAE,IAAI,CAAC,QAAQ,GAAG,SAAS,GAAG,OAAO,EACzC,CAAA,IACC,IAAI,CACH,EACL,IAAI,CAAC,KAAK,IAAI,CAAA,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAM,KAAK,EAAC,oBAAoB,EAAE,EAAA,IAAI,CAAC,KAAK,CAAQ,CAC5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["__stencil_proxyCustomElement","HTMLElement"],"sources":["src/components/sd-checkbox/sd-checkbox.scss?tag=sd-checkbox","src/components/sd-checkbox/sd-checkbox.tsx"],"sourcesContent":["@import 'variables';\r\n\r\nsd-checkbox {\r\n display: inline-block;\r\n height: 20px;\r\n line-height: 0;\r\n\r\n .sd-checkbox {\r\n cursor: pointer;\r\n display: inline-flex;\r\n align-items: center;\r\n gap: 8px;\r\n height: 20px;\r\n max-height: 20px;\r\n\r\n > input {\r\n display: none;\r\n }\r\n\r\n &:hover {\r\n &.sd-checkbox--checked,\r\n &.sd-checkbox--indeterminate {\r\n .sd-checkbox__bg {\r\n border-color: $brilliantblue_80;\r\n background: $brilliantblue_80;\r\n }\r\n }\r\n\r\n &.sd-checkbox--unchecked {\r\n .sd-checkbox__bg {\r\n border: 1px solid $brilliantblue_75;\r\n background: $brilliantblue_25;\r\n }\r\n }\r\n\r\n &.sd-checkbox--disabled {\r\n .sd-checkbox__bg {\r\n border: 1px solid transparent;\r\n background: $grey_20;\r\n }\r\n }\r\n }\r\n\r\n &__bg {\r\n width: 16px;\r\n height: 16px;\r\n border-radius: 2px;\r\n border: 1px solid $grey_65;\r\n box-sizing: border-box;\r\n display: inline-flex;\r\n justify-content: center;\r\n align-items: center;\r\n overflow: hidden;\r\n line-height: 0;\r\n }\r\n\r\n &__label {\r\n font-size: 12px;\r\n color: $grey_90;\r\n line-height: 20px;\r\n }\r\n\r\n &--checked,\r\n &--indeterminate {\r\n &.sd-checkbox--disabled {\r\n .sd-checkbox__bg {\r\n background: $grey_20;\r\n border: 1px solid $grey_45 !important;\r\n }\r\n }\r\n\r\n .sd-checkbox__bg {\r\n border: 1px solid $brilliantblue_75;\r\n background: $brilliantblue_75;\r\n }\r\n }\r\n\r\n &--unchecked {\r\n .sd-checkbox__bg {\r\n background: white;\r\n }\r\n }\r\n\r\n &--disabled {\r\n cursor: not-allowed;\r\n .sd-checkbox__bg {\r\n background: $grey_20;\r\n border: 1px solid $grey_45 !important;\r\n }\r\n }\r\n }\r\n}\r\n","import { Component, Prop, h, Element, Event, EventEmitter, State, Watch } from '@stencil/core';\r\n\r\nexport type CheckedType = boolean | any[] | null;\r\n\r\n@Component({\r\n tag: 'sd-checkbox',\r\n styleUrl: 'sd-checkbox.scss',\r\n})\r\nexport class SdCheckbox {\r\n @Element() el!: HTMLElement;\r\n\r\n /** 현재 선택 상태 또는 배열 형태의 값 */\r\n @Prop() checked!: CheckedType;\r\n\r\n /** 배열 모드에서의 개별 값 */\r\n @Prop() val?: any;\r\n\r\n /** 비활성화 여부 */\r\n @Prop() disabled: boolean = false;\r\n\r\n /** 표시할 라벨 텍스트 */\r\n @Prop() label: string = '';\r\n\r\n /** 내부 체크 상태 */\r\n @State() private isChecked: boolean | null = false;\r\n\r\n /** 값 변경 이벤트 */\r\n @Event() sdChange!: EventEmitter<CheckedType>;\r\n\r\n componentWillLoad() {\r\n this.updateCheckedState(this.checked);\r\n }\r\n\r\n componentWillRender() {\r\n this.updateCheckedState(this.checked);\r\n }\r\n\r\n @Watch('checked')\r\n watchValueHandler(newValue: CheckedType) {\r\n this.updateCheckedState(newValue);\r\n }\r\n\r\n private get checkboxClasses(): string {\r\n const classes = [\r\n 'sd-checkbox',\r\n `sd-checkbox--${this.isChecked ? 'checked' : this.isChecked === null ? 'indeterminate' : 'unchecked'}`,\r\n ];\r\n\r\n if (this.disabled) {\r\n classes.push('sd-checkbox--disabled');\r\n }\r\n\r\n return classes.join(' ');\r\n }\r\n\r\n private updateCheckedState(value: CheckedType) {\r\n if (value === null) {\r\n this.isChecked = null;\r\n } else if (typeof value === 'boolean') {\r\n this.isChecked = value;\r\n } else if (Array.isArray(value)) {\r\n this.isChecked = this.val !== undefined && value.includes(this.val);\r\n } else {\r\n this.isChecked = false;\r\n }\r\n }\r\n\r\n private handleChange = () => {\r\n if (this.disabled) return;\r\n\r\n let newValue: CheckedType;\r\n\r\n if (typeof this.checked === 'boolean') {\r\n newValue = !this.checked;\r\n } else if (Array.isArray(this.checked)) {\r\n if (this.val === undefined) {\r\n console.warn('A \"val\" property is required when using an array for the \"value\" property.');\r\n }\r\n\r\n const valueSet = new Set(this.checked);\r\n valueSet.has(this.val) ? valueSet.delete(this.val) : valueSet.add(this.val);\r\n newValue = Array.from(valueSet);\r\n } else {\r\n newValue = !this.isChecked;\r\n }\r\n\r\n this.sdChange.emit(newValue);\r\n };\r\n\r\n render() {\r\n return (\r\n <label\r\n aria-checked={this.isChecked === null ? 'mixed' : this.isChecked.toString()}\r\n aria-disabled={this.disabled.toString()}\r\n role=\"checkbox\"\r\n aria-label={this.label || 'checkbox'}\r\n class={this.checkboxClasses}\r\n >\r\n <input\r\n type=\"checkbox\"\r\n value={this.val}\r\n checked={!!this.isChecked}\r\n disabled={this.disabled}\r\n onChange={this.handleChange}\r\n name={this.label || 'checkbox'}\r\n />\r\n <div class=\"sd-checkbox__bg\">\r\n {this.isChecked !== false ? (\r\n <sd-icon\r\n name={this.isChecked === true ? 'check' : 'minus'}\r\n size={12}\r\n color={this.disabled ? '#888888' : 'white'}\r\n />\r\n ) : null}\r\n </div>\r\n {this.label && <span class=\"sd-checkbox__label\">{this.label}</span>}\r\n </label>\r\n );\r\n }\r\n}\r\n"],"version":3}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, d as createEvent, h } from './p-DzRr3BEe.js';
|
|
2
|
-
import { d as defineCustomElement$2 } from './p-
|
|
3
|
-
import { d as defineCustomElement$1 } from './p-
|
|
2
|
+
import { d as defineCustomElement$2 } from './p-CpfDowFL.js';
|
|
3
|
+
import { d as defineCustomElement$1 } from './p-DzIffEfK.js';
|
|
4
4
|
|
|
5
5
|
const sdSelectOptionGroupCss = "sd-select-option-group{display:block;height:fit-content}sd-select-option-group .sd-select__option-group{display:flex;padding:4px 12px;padding-left:28px;font-size:12px;line-height:20px}sd-select-option-group .sd-select__option-group.sd-select__option-group--group:not(.sd-select__option-group--use-checkbox),sd-select-option-group .sd-select__option-group.sd-select__option-group--subgroup:not(.sd-select__option-group--use-checkbox){cursor:default}sd-select-option-group .sd-select__option-group.sd-select__option-group--group{padding-left:12px;background-color:#f5faff !important;color:#333333 !important;font-weight:700}sd-select-option-group .sd-select__option-group.sd-select__option-group--subgroup{padding-left:20px;background-color:#f9f9f9 !important;color:#333333 !important;font-weight:500}sd-select-option-group .sd-select__option-group sd-checkbox__bg{border-color:#888888}sd-select-option-group .sd-select__option-group__label-wrapper{display:flex;width:100%;column-gap:8px;align-items:center;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}sd-select-option-group .sd-select__option-group__label-wrapper sd-checkbox{flex-shrink:0}sd-select-option-group .sd-select__option-group__label-wrapper .sd-select__option-group-label{flex:0 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}sd-select-option-group .sd-select__option-group__label-wrapper .sd-select__option-group__count-indicator{width:fit-content;flex-shrink:0;font-size:12px;font-weight:500;color:#888888}sd-select-option-group .sd-select__option-group--focused{background-color:#e6f1ff}sd-select-option-group .sd-select__option-group--selected.sd-select__option-group--item:not(:hover):not(.sd-select__option-group--use-checkbox),sd-select-option-group .sd-select__option-group--focused.sd-select__option-group--item:not(:hover):not(.sd-select__option-group--use-checkbox){color:#0075ff;font-weight:700}sd-select-option-group .sd-select__option-group--disabled{color:#aaaaaa;cursor:not-allowed}sd-select-option-group .sd-select__option-group:hover:not(.sd-select__option-group--disabled){background-color:#0075ff;color:white}sd-select-option-group .sd-select__option-group:hover.sd-select__option-group--selected.sd-select__option-group--item sd-checkbox .sd-checkbox__bg{border-color:white !important}";
|
|
6
6
|
|
|
@@ -51,7 +51,7 @@ const SdSelectOptionGroup = /*@__PURE__*/ proxyCustomElement(class SdSelectOptio
|
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
53
|
render() {
|
|
54
|
-
return (h("div", { key: '
|
|
54
|
+
return (h("div", { key: '0b921cd09e8115ed3af13fc2e9f1ecaff60f2b08', class: {
|
|
55
55
|
'sd-select__option-group': true,
|
|
56
56
|
'sd-select__option-group--selected': !!this.isSelected,
|
|
57
57
|
'sd-select__option-group--disabled': !!this.option.disabled,
|
|
@@ -60,10 +60,10 @@ const SdSelectOptionGroup = /*@__PURE__*/ proxyCustomElement(class SdSelectOptio
|
|
|
60
60
|
'sd-select__option-group--group': this.option.type === 'group',
|
|
61
61
|
'sd-select__option-group--subgroup': this.option.type === 'subgroup',
|
|
62
62
|
'sd-select__option-group--item': this.option.type === 'item',
|
|
63
|
-
}, onMouseEnter: () => (this.isHovered = true), onMouseLeave: () => (this.isHovered = false), style: this.optionStyle, "data-index": this.index, onClick: event => this.handleClick(this.option, this.isSelected, event) }, h("div", { key: '
|
|
63
|
+
}, onMouseEnter: () => (this.isHovered = true), onMouseLeave: () => (this.isHovered = false), style: this.optionStyle, "data-index": this.index, onClick: event => this.handleClick(this.option, this.isSelected, event) }, h("div", { key: '402a3e272f03930fe049d249c275a2acc1539bc3', class: "sd-select__option-group__label-wrapper" }, this.useCheckbox && (h("sd-checkbox", { key: '6f8c05df6de67268636495b3d15dd5f896c8b846', checked: this.isSelected, disabled: this.option.disabled, onClick: e => {
|
|
64
64
|
e.preventDefault();
|
|
65
65
|
this.handleClick(this.option, this.isSelected, e);
|
|
66
|
-
} })), h("span", { key: '
|
|
66
|
+
} })), h("span", { key: '4cbe65750bace072e680c251e904688c63eb6722', class: "sd-select__option-group-label" }, this.option.label), this.useIndicator && this.option.type !== 'item' && (h("span", { key: 'af63ce7b9e377da8453049c49c5af28e411b9eec', class: "sd-select__option-group__count-indicator" }, `(${this.countInfo?.selectedCount}/${this.countInfo?.totalCount})`)))));
|
|
67
67
|
}
|
|
68
68
|
static get style() { return sdSelectOptionGroupCss; }
|
|
69
69
|
}, [768, "sd-select-option-group", {
|
|
@@ -104,6 +104,6 @@ function defineCustomElement() {
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
export { SdSelectOptionGroup as S, defineCustomElement as d };
|
|
107
|
-
//# sourceMappingURL=p-
|
|
107
|
+
//# sourceMappingURL=p-D9gy3nk_.js.map
|
|
108
108
|
|
|
109
|
-
//# sourceMappingURL=p-
|
|
109
|
+
//# sourceMappingURL=p-D9gy3nk_.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"p-
|
|
1
|
+
{"file":"p-D9gy3nk_.js","mappings":";;;;AAAA,MAAM,sBAAsB,GAAG,4vEAA4vE;;MCO9wE,mBAAmB,iBAAAA,kBAAA,CAAA,MAAA,mBAAA,SAAAC,CAAA,CAAA;;;;;;;;;AAGvB,IAAA,MAAM;AACN,IAAA,KAAK;IACL,UAAU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EACrE,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,MAAM,KAChD,CAAM,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,KAAK,EAAC,0CAA0C,EAAA,EAAE,CAAA,CAAA,EAAI,IAAI,CAAC,SAAS,EAAE,aAAa,CAAA,CAAA,EAAI,IAAI,CAAC,SAAS,EAAE,UAAU,GAAG,CAAQ,CAClI,CACI,CACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["__stencil_proxyCustomElement","HTMLElement"],"sources":["src/components/sd-select-multiple-group/sd-select-option-group/sd-select-option-group.scss?tag=sd-select-option-group","src/components/sd-select-multiple-group/sd-select-option-group/sd-select-option-group.tsx"],"sourcesContent":["@import 'variables';\r\n\r\nsd-select-option-group {\r\n display: block;\r\n height: fit-content;\r\n .sd-select__option-group {\r\n display: flex;\r\n padding: 4px 12px;\r\n padding-left: 28px;\r\n font-size: 12px;\r\n line-height: 20px;\r\n\r\n &.sd-select__option-group--group,\r\n &.sd-select__option-group--subgroup {\r\n &:not(.sd-select__option-group--use-checkbox) {\r\n cursor: default;\r\n }\r\n }\r\n\r\n &.sd-select__option-group--group {\r\n padding-left: 12px;\r\n background-color: $brilliantblue_05 !important;\r\n color: $grey_90 !important;\r\n font-weight: 700;\r\n }\r\n\r\n &.sd-select__option-group--subgroup {\r\n padding-left: 20px;\r\n background-color: $grey_05 !important;\r\n color: $grey_90 !important;\r\n font-weight: 500;\r\n }\r\n\r\n sd-checkbox {\r\n &__bg {\r\n border-color: $grey_65;\r\n }\r\n }\r\n\r\n &__label-wrapper {\r\n display: flex;\r\n width: 100%;\r\n column-gap: 8px;\r\n align-items: center;\r\n overflow: hidden;\r\n white-space: nowrap;\r\n text-overflow: ellipsis;\r\n\r\n sd-checkbox {\r\n flex-shrink: 0;\r\n }\r\n\r\n .sd-select__option-group-label {\r\n flex: 0 1 auto;\r\n overflow: hidden;\r\n text-overflow: ellipsis;\r\n white-space: nowrap;\r\n }\r\n\r\n .sd-select__option-group__count-indicator {\r\n width: fit-content;\r\n flex-shrink: 0;\r\n font-size: 12px;\r\n font-weight: 500;\r\n color: $grey_65;\r\n }\r\n }\r\n\r\n &--focused {\r\n background-color: $brilliantblue_20;\r\n }\r\n\r\n &--selected,\r\n &--focused {\r\n &.sd-select__option-group--item:not(:hover):not(.sd-select__option-group--use-checkbox) {\r\n color: $brilliantblue_75;\r\n font-weight: 700;\r\n }\r\n }\r\n\r\n &--disabled {\r\n color: $grey_55;\r\n cursor: not-allowed;\r\n }\r\n\r\n &:hover {\r\n &:not(.sd-select__option-group--disabled) {\r\n background-color: $brilliantblue_75;\r\n color: white;\r\n }\r\n\r\n &.sd-select__option-group--selected.sd-select__option-group--item sd-checkbox {\r\n .sd-checkbox__bg {\r\n border-color: white !important;\r\n }\r\n }\r\n }\r\n }\r\n}\r\n","import { Component, Element, Event, EventEmitter, h, Method, Prop, State } from '@stencil/core';\r\nimport { SelectOptionGroup } from '../../sd-select/sd-select';\r\n\r\n@Component({\r\n tag: 'sd-select-option-group',\r\n styleUrl: 'sd-select-option-group.scss',\r\n})\r\nexport class SdSelectOptionGroup {\r\n @Element() el!: HTMLElement;\r\n\r\n @Prop() option!: SelectOptionGroup;\r\n @Prop() index!: number;\r\n @Prop() isSelected: boolean | null = false;\r\n @Prop() isFocused: boolean = false;\r\n @Prop() optionStyle?: { [key: string]: string };\r\n @Prop() disabled: boolean = false;\r\n @Prop() useCheckbox: boolean = false;\r\n @Prop() useIndicator?: boolean = true;\r\n @Prop() countInfo?: { selectedCount: number; totalCount: number } = {\r\n selectedCount: 0,\r\n totalCount: 0,\r\n };\r\n\r\n @State() isHovered: boolean = false;\r\n\r\n @Method()\r\n async isDisabled(): Promise<boolean> {\r\n return !!this.option.disabled || this.option.type === 'group' || this.option.type === 'subgroup';\r\n }\r\n\r\n @Event() optionClick!: EventEmitter<{\r\n option: SelectOptionGroup;\r\n isSelected: boolean | null;\r\n index: number;\r\n event: MouseEvent;\r\n }>;\r\n\r\n private handleClick = (\r\n option: SelectOptionGroup,\r\n isSelected: boolean | null,\r\n event: MouseEvent,\r\n ) => {\r\n event.stopPropagation();\r\n\r\n if (option.type === 'group' || option.type === 'subgroup') {\r\n this.optionClick.emit({\r\n option: this.option,\r\n isSelected,\r\n index: this.index,\r\n event,\r\n });\r\n return;\r\n }\r\n\r\n if (!this.option.disabled && !this.disabled) {\r\n this.optionClick.emit({\r\n option: this.option,\r\n isSelected,\r\n index: this.index,\r\n event,\r\n });\r\n }\r\n };\r\n\r\n render() {\r\n return (\r\n <div\r\n class={{\r\n 'sd-select__option-group': true,\r\n 'sd-select__option-group--selected': !!this.isSelected,\r\n 'sd-select__option-group--disabled': !!this.option.disabled,\r\n 'sd-select__option-group--focused': this.isFocused,\r\n 'sd-select__option-group--use-checkbox': this.useCheckbox,\r\n 'sd-select__option-group--group': this.option.type === 'group',\r\n 'sd-select__option-group--subgroup': this.option.type === 'subgroup',\r\n 'sd-select__option-group--item': this.option.type === 'item',\r\n }}\r\n onMouseEnter={() => (this.isHovered = true)}\r\n onMouseLeave={() => (this.isHovered = false)}\r\n style={this.optionStyle}\r\n data-index={this.index}\r\n onClick={event => this.handleClick(this.option, this.isSelected, event)}\r\n >\r\n <div class=\"sd-select__option-group__label-wrapper\">\r\n {this.useCheckbox && (\r\n <sd-checkbox\r\n checked={this.isSelected}\r\n disabled={this.option.disabled}\r\n onClick={e => {\r\n e.preventDefault();\r\n this.handleClick(this.option, this.isSelected, e);\r\n }}\r\n ></sd-checkbox>\r\n )}\r\n <span class=\"sd-select__option-group-label\">{this.option.label}</span>\r\n {this.useIndicator && this.option.type !== 'item' && (\r\n <span class=\"sd-select__option-group__count-indicator\">{`(${this.countInfo?.selectedCount}/${this.countInfo?.totalCount})`}</span>\r\n )}\r\n </div>\r\n </div>\r\n );\r\n }\r\n}\r\n"],"version":3}
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
import { p as proxyCustomElement, d as createEvent, h, c as Host } from './p-DzRr3BEe.js';
|
|
2
|
+
import { B as BaseDropdownEvent, S as SelectKeyboardNavigation } from './p-Bfro0I6y.js';
|
|
3
|
+
import { d as defineCustomElement$5 } from './p-CpfDowFL.js';
|
|
4
|
+
import { d as defineCustomElement$4 } from './p-DzIffEfK.js';
|
|
5
|
+
import { d as defineCustomElement$3 } from './p-Db_plCmk.js';
|
|
6
|
+
import { d as defineCustomElement$2 } from './p-B_lWW-k_.js';
|
|
7
|
+
import { d as defineCustomElement$1 } from './p-Ed1-kFCj.js';
|
|
8
|
+
|
|
9
|
+
const sdSelectCss = ".sd-select__dropdown{overflow-y:auto;overflow-x:hidden;scroll-behavior:smooth}.sd-select__dropdown::-webkit-scrollbar{opacity:0;background:#e5e5e5}.sd-select__dropdown::-webkit-scrollbar:horizontal{height:8px}.sd-select__dropdown::-webkit-scrollbar:vertical{width:8px}.sd-select__dropdown::-webkit-scrollbar-thumb{height:80px;background-color:#cccccc;border-radius:4px}.sd-select__dropdown::-webkit-scrollbar-track{background-color:transparent}.sd-select{display:flex;width:var(--select-width, 200px);height:28px;position:relative;color:#333333;cursor:pointer;user-select:none;border:1px solid #aaaaaa;border-radius:4px;background-color:white}.sd-select:hover:not(.sd-select--disabled){background:#f6f6f6}.sd-select.sd-select--disabled{cursor:not-allowed;background-color:#eeeeee;border-color:#cccccc}.sd-select.sd-select--disabled .sd-select__label{border-right:1px solid #cccccc}.sd-select.sd-select--disabled .sd-select__trigger{color:#888888}.sd-select.sd-select--disabled .sd-select__trigger:focus,.sd-select.sd-select--disabled .sd-select__trigger:focus-visible,.sd-select.sd-select--disabled .sd-select__trigger:focus-within{outline:none !important}.sd-select__label{font-size:12px;line-height:20px;font-weight:500;color:#333333;padding:4px 12px;border-right:1px solid #cccccc;border-radius:4px 0 0 4px;background-color:#f6f6f6;display:inline-block;white-space:nowrap}.sd-select__container{position:relative;width:100%;display:flex}.sd-select__container .sd-select__trigger{padding:4px 20px 4px 12px;display:flex;width:100%;align-items:center}.sd-select__container .sd-select__trigger .sd-select__value{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:20px;font-size:12px;font-weight:400;text-align:left}.sd-select__container .sd-select__trigger .sd-select__clear{margin:0 4px;width:8px;height:8px;background-color:transparent;outline:none;border:none}.sd-select__container .sd-select__arrow{position:absolute;top:8px;right:8px;width:12px;height:12px;color:#888888;transition:transform 0.3s ease}.sd-select__container .sd-select__arrow--open{transform:rotate(180deg)}.sd-select__dropdown{width:var(--select-dropdown-width, 200px);max-height:var(--select-dropdown-height, 260px);padding-bottom:2px;background-color:white;box-shadow:2px 2px 12px 2px rgba(0, 0, 0, 0.1);border-radius:4px;overflow-y:auto;color:#333333;display:flex;flex-direction:column}.sd-select__dropdown .sd-select__search-container{position:sticky;top:0;display:flex;width:100%;background-color:white;align-items:center;padding:4px 8px}.sd-select__dropdown .sd-select__search-container--scrolled{box-shadow:2px 2px 8px 2px rgba(0, 0, 0, 0.2)}.sd-select__dropdown .sd-select__option-placeholder{padding:4px 12px;font-size:12px;line-height:20px;text-align:left}";
|
|
10
|
+
|
|
11
|
+
const SdSelect = /*@__PURE__*/ proxyCustomElement(class SdSelect extends BaseDropdownEvent {
|
|
12
|
+
constructor(registerHost) {
|
|
13
|
+
super(false);
|
|
14
|
+
if (registerHost !== false) {
|
|
15
|
+
this.__registerHost();
|
|
16
|
+
}
|
|
17
|
+
this.sdChange = createEvent(this, "sdChange");
|
|
18
|
+
this.dropDownShow = createEvent(this, "dropDownShow");
|
|
19
|
+
}
|
|
20
|
+
get el() { return this; }
|
|
21
|
+
// props
|
|
22
|
+
value = null;
|
|
23
|
+
label = '';
|
|
24
|
+
options = [];
|
|
25
|
+
placeholder = '선택';
|
|
26
|
+
optionPlaceholder = '옵션이 없습니다.';
|
|
27
|
+
width = '200px';
|
|
28
|
+
dropdownHeight = '260px';
|
|
29
|
+
disabled = false;
|
|
30
|
+
clearable = false;
|
|
31
|
+
searchable = false;
|
|
32
|
+
// props - custom slots
|
|
33
|
+
optionRenderer;
|
|
34
|
+
// states
|
|
35
|
+
filteredOptions = this.options;
|
|
36
|
+
isOpen = false;
|
|
37
|
+
searchText = null;
|
|
38
|
+
itemIndex = -1;
|
|
39
|
+
isScrolled = false;
|
|
40
|
+
// events
|
|
41
|
+
sdChange;
|
|
42
|
+
dropDownShow;
|
|
43
|
+
selectRef;
|
|
44
|
+
searchRef;
|
|
45
|
+
optionRef;
|
|
46
|
+
dropdownRef;
|
|
47
|
+
valueChanged() {
|
|
48
|
+
const selectedOption = this.getSelectedOption();
|
|
49
|
+
this.sdChange?.emit({ value: selectedOption?.value || null, option: selectedOption || null });
|
|
50
|
+
}
|
|
51
|
+
optionsChanged() {
|
|
52
|
+
this.filteredOptions = this.options;
|
|
53
|
+
this.filterOptions();
|
|
54
|
+
}
|
|
55
|
+
searchTextChanged() {
|
|
56
|
+
this.filterOptions();
|
|
57
|
+
}
|
|
58
|
+
async itemIndexChanged(newIndex, oldIndex) {
|
|
59
|
+
if (this.searchable) {
|
|
60
|
+
const searchInput = await this.getNativeInputElement();
|
|
61
|
+
if (this.itemIndex === -1) {
|
|
62
|
+
searchInput?.focus();
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
else if (searchInput?.matches(':focus')) {
|
|
66
|
+
searchInput?.blur();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
const optionElements = this.dropdownRef?.querySelectorAll('.sd-select__dropdown sd-select-option') || [];
|
|
70
|
+
const currentItem = optionElements?.[this.itemIndex];
|
|
71
|
+
if (!currentItem || !this.isOpen)
|
|
72
|
+
return;
|
|
73
|
+
this.optionRef = currentItem;
|
|
74
|
+
const isOptionDisabled = await this.optionRef.isDisabled();
|
|
75
|
+
if (isOptionDisabled) {
|
|
76
|
+
newIndex > oldIndex ? this.itemIndex++ : this.itemIndex--;
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
this.scrollToOption(currentItem);
|
|
80
|
+
}
|
|
81
|
+
componentWillLoad() {
|
|
82
|
+
// props가 모두 설정된 후에 실행되므로 올바른 options 값을 가져올 수 있음
|
|
83
|
+
this.filteredOptions = this.options;
|
|
84
|
+
this.initializeEvent(); // global dropdown Manager에 등록 + 이벤트 핸들러 초기화
|
|
85
|
+
}
|
|
86
|
+
disconnectedCallback() {
|
|
87
|
+
this.cleanupEvent(); // global dropdown Manager에서 제거 + 이벤트 정리
|
|
88
|
+
}
|
|
89
|
+
async isOpenChanged() {
|
|
90
|
+
// Base class의 이벤트 관리 호출 - 다른 select와의 이벤트 충돌 방지
|
|
91
|
+
this.onDropdownToggle(this.isOpen);
|
|
92
|
+
const selectedOption = this.getSelectedOption();
|
|
93
|
+
if (!selectedOption) {
|
|
94
|
+
this.itemIndex = /* this.searchable ? */ -1 /* : 0 */;
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
this.itemIndex = this.options.indexOf(selectedOption);
|
|
98
|
+
}
|
|
99
|
+
this.dropDownShow?.emit({ isOpen: this.isOpen });
|
|
100
|
+
if (this.isOpen === false)
|
|
101
|
+
return;
|
|
102
|
+
await new Promise(resolve => setTimeout(resolve, 10));
|
|
103
|
+
const optionElements = this.dropdownRef?.querySelectorAll('.sd-select__dropdown sd-select-option') || [];
|
|
104
|
+
const currentItem = optionElements?.[this.itemIndex];
|
|
105
|
+
if (this.searchable) {
|
|
106
|
+
const searchInput = await this.getNativeInputElement();
|
|
107
|
+
searchInput?.focus();
|
|
108
|
+
}
|
|
109
|
+
if (!currentItem)
|
|
110
|
+
return;
|
|
111
|
+
await new Promise(resolve => setTimeout(resolve, 10));
|
|
112
|
+
this.scrollToOption(currentItem);
|
|
113
|
+
}
|
|
114
|
+
handleDocumentClick(event) {
|
|
115
|
+
if (!this.selectRef?.contains(event.target)) {
|
|
116
|
+
this.isOpen = false;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
handleDocumentKeydown(keyboardEvent) {
|
|
120
|
+
keyboardEvent.stopPropagation();
|
|
121
|
+
const targetKey = ['ArrowDown', 'ArrowUp', 'Enter', 'Escape'];
|
|
122
|
+
if (!targetKey.includes(keyboardEvent.key))
|
|
123
|
+
return;
|
|
124
|
+
keyboardEvent.preventDefault();
|
|
125
|
+
switch (keyboardEvent.key) {
|
|
126
|
+
case 'ArrowDown':
|
|
127
|
+
case 'ArrowUp':
|
|
128
|
+
const keyboardNavigation = new SelectKeyboardNavigation(this.searchable, this.filteredOptions);
|
|
129
|
+
const nextIndex = keyboardNavigation.getNextIndex(this.itemIndex, keyboardEvent.key);
|
|
130
|
+
this.itemIndex = nextIndex;
|
|
131
|
+
break;
|
|
132
|
+
case 'Enter':
|
|
133
|
+
const selectedOption = this.filteredOptions[this.itemIndex];
|
|
134
|
+
if (selectedOption && !selectedOption.disabled) {
|
|
135
|
+
this.value = selectedOption.value;
|
|
136
|
+
this.searchText = null;
|
|
137
|
+
this.isOpen = false;
|
|
138
|
+
}
|
|
139
|
+
break;
|
|
140
|
+
case 'Escape':
|
|
141
|
+
this.isOpen = false;
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
// closeDropdown 메서드 구현 (Manager에서 호출됨)
|
|
146
|
+
closeDropdown() {
|
|
147
|
+
this.isOpen = false;
|
|
148
|
+
}
|
|
149
|
+
// event handlers
|
|
150
|
+
handleTriggerClick = (event) => {
|
|
151
|
+
event.stopPropagation();
|
|
152
|
+
if (!this.disabled) {
|
|
153
|
+
this.isOpen = !this.isOpen;
|
|
154
|
+
this.dropDownShow?.emit({ isOpen: this.isOpen });
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
handleOptionClick = (detail) => {
|
|
158
|
+
const { option, event } = detail;
|
|
159
|
+
event.stopPropagation();
|
|
160
|
+
if (!option.disabled) {
|
|
161
|
+
this.value = option.value;
|
|
162
|
+
this.isOpen = false;
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
filterOptions() {
|
|
166
|
+
if (!this.searchText || this.searchText.trim() === '') {
|
|
167
|
+
// 검색어가 없으면 전체 옵션 표시
|
|
168
|
+
this.filteredOptions = this.options;
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
// 검색어가 있으면 필터링
|
|
172
|
+
this.filteredOptions = this.options.filter(option => option.label.toLowerCase().includes(this.searchText.toLowerCase()));
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
getSelectedOption() {
|
|
176
|
+
return this.options.find(option => option.value === this.value);
|
|
177
|
+
}
|
|
178
|
+
handleDropdownScroll = (event) => {
|
|
179
|
+
const target = event.target;
|
|
180
|
+
const scrollTop = target.scrollTop;
|
|
181
|
+
// 스크롤이 조금이라도 되면 그림자 표시
|
|
182
|
+
this.isScrolled = scrollTop > 0;
|
|
183
|
+
};
|
|
184
|
+
async getNativeInputElement() {
|
|
185
|
+
if (this.searchRef) {
|
|
186
|
+
return this.searchRef.getNativeElement();
|
|
187
|
+
}
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
190
|
+
scrollToOption(optionElement) {
|
|
191
|
+
if (!this.dropdownRef || !optionElement)
|
|
192
|
+
return;
|
|
193
|
+
const dropdown = this.dropdownRef;
|
|
194
|
+
const optionTop = optionElement.offsetTop;
|
|
195
|
+
const optionHeight = optionElement.offsetHeight;
|
|
196
|
+
const dropdownScrollTop = dropdown.scrollTop;
|
|
197
|
+
const dropdownHeight = dropdown.clientHeight;
|
|
198
|
+
const searchContainer = dropdown.querySelector('.sd-select__search-container');
|
|
199
|
+
const searchOffset = searchContainer ? searchContainer.offsetHeight : 0;
|
|
200
|
+
const visibleTop = dropdownScrollTop + searchOffset;
|
|
201
|
+
const visibleBottom = dropdownScrollTop + dropdownHeight;
|
|
202
|
+
if (optionTop < visibleTop) {
|
|
203
|
+
dropdown.scrollTop = optionTop - searchOffset;
|
|
204
|
+
}
|
|
205
|
+
else if (optionTop + optionHeight > visibleBottom) {
|
|
206
|
+
dropdown.scrollTop = optionTop + optionHeight - dropdownHeight + searchOffset;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
// render method
|
|
210
|
+
render() {
|
|
211
|
+
const style = {
|
|
212
|
+
'--select-width': this.width || '200px',
|
|
213
|
+
'--select-dropdown-height': this.dropdownHeight || '260px',
|
|
214
|
+
};
|
|
215
|
+
return (h(Host, { key: '9e528b2c6dd8b59343cb6603dfacfd63b3958e83', style: style }, h("div", { key: 'a6f139df6b21a452bb1e9f1467ca18cbf3c50101', class: {
|
|
216
|
+
'sd-select': true,
|
|
217
|
+
'sd-select--open': this.isOpen,
|
|
218
|
+
'sd-select--disabled': this.disabled,
|
|
219
|
+
}, ref: el => (this.selectRef = el) }, this.renderLabel(this.label), h("div", { key: 'cc86cf63a8d4f075d2bf5ba3a589f9a395372cc3', class: "sd-select__container" }, this.renderTrigger(), this.renderDropdown()))));
|
|
220
|
+
}
|
|
221
|
+
renderLabel(label) {
|
|
222
|
+
if (!label)
|
|
223
|
+
return null;
|
|
224
|
+
return h("label", { class: "sd-select__label" }, label);
|
|
225
|
+
}
|
|
226
|
+
renderTrigger() {
|
|
227
|
+
const selectedOption = this.getSelectedOption();
|
|
228
|
+
return (h("div", { class: "sd-select__trigger", tabindex: this.disabled ? -1 : 0, onClick: this.handleTriggerClick }, h("span", { class: "sd-select__value" }, selectedOption ? selectedOption.label : this.placeholder), this.clearable && selectedOption && !this.disabled && (h("sd-icon", { key: "clear-icon", name: "close", size: 10, color: "#888", class: "sd-select__clear", onClick: event => {
|
|
229
|
+
event.stopPropagation();
|
|
230
|
+
this.value = null;
|
|
231
|
+
} })), h("sd-icon", { key: "arrow-icon", name: "arrowDown", color: "#888", class: { 'sd-select__arrow': true, 'sd-select__arrow--open': this.isOpen } })));
|
|
232
|
+
}
|
|
233
|
+
renderDropdown() {
|
|
234
|
+
const style = {
|
|
235
|
+
'--select-dropdown-width': this.width || '200px',
|
|
236
|
+
'--select-dropdown-height': this.dropdownHeight || '260px',
|
|
237
|
+
};
|
|
238
|
+
if (this.isOpen === false)
|
|
239
|
+
return null;
|
|
240
|
+
return (h("sd-portal", { open: this.isOpen, parentRef: this.selectRef, onSdClose: this.closeDropdown }, h("div", { class: "sd-select__dropdown", style: style, onScroll: this.handleDropdownScroll, ref: el => (this.dropdownRef = el) }, this.searchable && (h("div", { class: {
|
|
241
|
+
'sd-select__search-container': true,
|
|
242
|
+
'sd-select__search-container--scrolled': this.isScrolled,
|
|
243
|
+
}, onClick: event => event.stopPropagation() }, h("sd-input", { ref: el => (this.searchRef = el), value: this.searchText, placeholder: "\uAC80\uC0C9", clearable: true, inputStyle: { 'padding-left': '8px' }, autofocus: true, onSdInput: event => {
|
|
244
|
+
this.searchText = String(event?.detail);
|
|
245
|
+
}, onSdFocus: () => {
|
|
246
|
+
this.itemIndex = -1;
|
|
247
|
+
} }, h("sd-icon", { name: "search", size: 16, color: "#737373", style: { marginRight: '4px' }, slot: "prefix" })))), this.filteredOptions.length > 0 ? (this.filteredOptions.map((option, index) => (h("slot", { name: `option-${option.value}` }, h("sd-select-option", { option: option, index: index, isSelected: option.value === this.value, isFocused: index === this.itemIndex, onOptionClick: ({ detail }) => this.handleOptionClick(detail) }))))) : (h("slot", { name: "option-placeholder" }, h("div", { class: 'sd-select__option-placeholder' }, this.optionPlaceholder))))));
|
|
248
|
+
}
|
|
249
|
+
static get watchers() { return {
|
|
250
|
+
"value": ["valueChanged"],
|
|
251
|
+
"options": ["optionsChanged"],
|
|
252
|
+
"searchText": ["searchTextChanged"],
|
|
253
|
+
"itemIndex": ["itemIndexChanged"],
|
|
254
|
+
"isOpen": ["isOpenChanged"]
|
|
255
|
+
}; }
|
|
256
|
+
static get style() { return sdSelectCss; }
|
|
257
|
+
}, [772, "sd-select", {
|
|
258
|
+
"value": [1032],
|
|
259
|
+
"label": [1],
|
|
260
|
+
"options": [1040],
|
|
261
|
+
"placeholder": [1],
|
|
262
|
+
"optionPlaceholder": [1, "option-placeholder"],
|
|
263
|
+
"width": [1],
|
|
264
|
+
"dropdownHeight": [1, "dropdown-height"],
|
|
265
|
+
"disabled": [4],
|
|
266
|
+
"clearable": [4],
|
|
267
|
+
"searchable": [4],
|
|
268
|
+
"optionRenderer": [16],
|
|
269
|
+
"filteredOptions": [32],
|
|
270
|
+
"isOpen": [32],
|
|
271
|
+
"searchText": [32],
|
|
272
|
+
"itemIndex": [32],
|
|
273
|
+
"isScrolled": [32]
|
|
274
|
+
}, undefined, {
|
|
275
|
+
"value": ["valueChanged"],
|
|
276
|
+
"options": ["optionsChanged"],
|
|
277
|
+
"searchText": ["searchTextChanged"],
|
|
278
|
+
"itemIndex": ["itemIndexChanged"],
|
|
279
|
+
"isOpen": ["isOpenChanged"]
|
|
280
|
+
}]);
|
|
281
|
+
function defineCustomElement() {
|
|
282
|
+
if (typeof customElements === "undefined") {
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
const components = ["sd-select", "sd-checkbox", "sd-icon", "sd-input", "sd-portal", "sd-select-option"];
|
|
286
|
+
components.forEach(tagName => { switch (tagName) {
|
|
287
|
+
case "sd-select":
|
|
288
|
+
if (!customElements.get(tagName)) {
|
|
289
|
+
customElements.define(tagName, SdSelect);
|
|
290
|
+
}
|
|
291
|
+
break;
|
|
292
|
+
case "sd-checkbox":
|
|
293
|
+
if (!customElements.get(tagName)) {
|
|
294
|
+
defineCustomElement$5();
|
|
295
|
+
}
|
|
296
|
+
break;
|
|
297
|
+
case "sd-icon":
|
|
298
|
+
if (!customElements.get(tagName)) {
|
|
299
|
+
defineCustomElement$4();
|
|
300
|
+
}
|
|
301
|
+
break;
|
|
302
|
+
case "sd-input":
|
|
303
|
+
if (!customElements.get(tagName)) {
|
|
304
|
+
defineCustomElement$3();
|
|
305
|
+
}
|
|
306
|
+
break;
|
|
307
|
+
case "sd-portal":
|
|
308
|
+
if (!customElements.get(tagName)) {
|
|
309
|
+
defineCustomElement$2();
|
|
310
|
+
}
|
|
311
|
+
break;
|
|
312
|
+
case "sd-select-option":
|
|
313
|
+
if (!customElements.get(tagName)) {
|
|
314
|
+
defineCustomElement$1();
|
|
315
|
+
}
|
|
316
|
+
break;
|
|
317
|
+
} });
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
export { SdSelect as S, defineCustomElement as d };
|
|
321
|
+
//# sourceMappingURL=p-Dar88QJr.js.map
|
|
322
|
+
|
|
323
|
+
//# sourceMappingURL=p-Dar88QJr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"p-Dar88QJr.js","mappings":";;;;;;;;AAAA,MAAM,WAAW,GAAG,4sFAA4sF;;MCmDntF,QAAS,iBAAAA,kBAAA,CAAA,MAAA,QAAA,SAAQ,iBAAiB,CAAA;;;;;;;;;;;IAIrB,KAAK,GAA2B,IAAI;IACrD,KAAK,GAAW,EAAE;IACD,OAAO,GAAmB,EAAE;IAC7C,WAAW,GAAW,IAAI;IAC1B,iBAAiB,GAAW,WAAW;IACvC,KAAK,GAAW,OAAO;IACvB,cAAc,GAAW,OAAO;IAChC,QAAQ,GAAY,KAAK;IACzB,SAAS,GAAY,KAAK;IAC1B,UAAU,GAAY,KAAK;;AAG3B,IAAA,cAAc;;AAGb,IAAA,eAAe,GAAG,IAAI,CAAC,OAAO;IAC9B,MAAM,GAAY,KAAK;IACvB,UAAU,GAAkB,IAAI;IAChC,SAAS,GAAW,EAAE;IACtB,UAAU,GAAY,KAAK;;AAG3B,IAAA,QAAQ;AACR,IAAA,YAAY;AAEb,IAAA,SAAS;AACT,IAAA,SAAS;AACT,IAAA,SAAS;AACT,IAAA,WAAW;IAGnB,YAAY,GAAA;AACX,QAAA,MAAM,cAAc,GAAG,IAAI,CAAC,iBAAiB,EAAE;QAC/C,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,IAAI,IAAI,EAAE,MAAM,EAAE,cAAc,IAAI,IAAI,EAAE,CAAC;;IAI9F,cAAc,GAAA;AACb,QAAA,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,OAAO;QACnC,IAAI,CAAC,aAAa,EAAE;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AM,CAAC;AACxC,aAAC,EACD,SAAS,EAAE,MAAK;AACf,gBAAA,IAAI,CAAC,SAAS,GAAG,EAAE;AACpB,aAAC,EAAA,EAED,CACC,CAAA,SAAA,EAAA,EAAA,IAAI,EAAC,QAAQ,EACb,IAAI,EAAE,EAAE,EACR,KAAK,EAAC,SAAS,EACf,KAAK,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,EAC7B,IAAI,EAAC,QAAQ,EAAA,CACH,CACD,CACN,CACN,EACA,IAAI,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,IAC/B,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,MACtC,CAAM,CAAA,MAAA,EAAA,EAAA,IAAI,EAAE,CAAA,OAAA,EAAU,MAAM,CAAC,KAAK,CAAE,CAAA,EAAA,EACnC,CACC,CAAA,kBAAA,EAAA,EAAA,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,MAAM,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,EACvC,SAAS,EAAE,KAAK,KAAK,IAAI,CAAC,SAAS,EACnC,aAAa,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,EAC1C,CAAA,CACd,CACP,CAAC,KAEF,CAAA,CAAA,MAAA,EAAA,EAAM,IAAI,EAAC,oBAAoB,EAAA,EAC9B,CAAA,CAAA,KAAA,EAAA,EAAK,KAAK,EAAE,+BAA+B,EAAA,EAAG,IAAI,CAAC,iBAAiB,CAAO,CACrE,CACP,CACI,CACK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["__stencil_proxyCustomElement"],"sources":["src/components/sd-select/sd-select.scss?tag=sd-select","src/components/sd-select/sd-select.tsx"],"sourcesContent":["@import 'variables';\r\n@import 'extend';\r\n\r\n.sd-select {\r\n display: flex;\r\n width: var(--select-width, 200px);\r\n height: 28px;\r\n position: relative;\r\n color: $grey_90;\r\n cursor: pointer;\r\n user-select: none;\r\n border: 1px solid $grey_55;\r\n border-radius: 4px;\r\n background-color: white;\r\n\r\n &:hover:not(.sd-select--disabled) {\r\n background: $grey_10;\r\n }\r\n\r\n &.sd-select--disabled {\r\n cursor: not-allowed;\r\n background-color: $grey_20;\r\n border-color: $grey_45;\r\n\r\n .sd-select__label {\r\n border-right: 1px solid $grey_45;\r\n }\r\n\r\n .sd-select__trigger {\r\n color: $grey_65;\r\n &:focus,\r\n &:focus-visible,\r\n &:focus-within {\r\n outline: none !important;\r\n }\r\n }\r\n }\r\n\r\n &__label {\r\n font-size: 12px;\r\n line-height: 20px;\r\n font-weight: 500;\r\n color: $grey_90;\r\n padding: 4px 12px;\r\n border-right: 1px solid $grey_45;\r\n border-radius: 4px 0 0 4px;\r\n background-color: $grey_10;\r\n display: inline-block;\r\n white-space: nowrap;\r\n }\r\n\r\n &__container {\r\n position: relative;\r\n width: 100%;\r\n display: flex;\r\n\r\n .sd-select__trigger {\r\n padding: 4px 20px 4px 12px;\r\n display: flex;\r\n width: 100%;\r\n align-items: center;\r\n\r\n .sd-select__value {\r\n flex: 1;\r\n overflow: hidden;\r\n text-overflow: ellipsis;\r\n white-space: nowrap;\r\n line-height: 20px;\r\n font-size: 12px;\r\n font-weight: 400;\r\n text-align: left;\r\n }\r\n\r\n .sd-select__clear {\r\n margin: 0 4px;\r\n width: 8px;\r\n height: 8px;\r\n background-color: transparent;\r\n outline: none;\r\n border: none;\r\n }\r\n }\r\n\r\n .sd-select__arrow {\r\n position: absolute;\r\n top: 8px;\r\n right: 8px;\r\n width: 12px;\r\n height: 12px;\r\n color: $grey_65;\r\n transition: transform 0.3s ease;\r\n\r\n &--open {\r\n transform: rotate(180deg);\r\n }\r\n }\r\n }\r\n}\r\n\r\n.sd-select__dropdown {\r\n @extend %scrollBar;\r\n width: var(--select-dropdown-width, 200px);\r\n max-height: var(--select-dropdown-height, 260px);\r\n padding-bottom: 2px;\r\n background-color: white;\r\n box-shadow: 2px 2px 12px 2px rgba(0, 0, 0, 0.1);\r\n border-radius: 4px;\r\n overflow-y: auto;\r\n color: $grey_90;\r\n display: flex;\r\n flex-direction: column;\r\n\r\n .sd-select__search-container {\r\n position: sticky;\r\n top: 0;\r\n display: flex;\r\n width: 100%;\r\n background-color: white;\r\n align-items: center;\r\n padding: 4px 8px;\r\n\r\n &--scrolled {\r\n box-shadow: 2px 2px 8px 2px rgba(0, 0, 0, 0.2);\r\n }\r\n }\r\n\r\n .sd-select__option-placeholder {\r\n padding: 4px 12px;\r\n font-size: 12px;\r\n line-height: 20px;\r\n text-align: left;\r\n }\r\n}\r\n","import {\r\n Component,\r\n Event,\r\n EventEmitter,\r\n Host,\r\n Prop,\r\n State,\r\n h,\r\n Element,\r\n Watch,\r\n} from '@stencil/core';\r\nimport { BaseDropdownEvent } from '../../utils/base-dropdown-event';\r\nimport { SelectKeyboardNavigation } from '../../utils/select-keyboard-navigation';\r\n\r\nexport interface SelectOption {\r\n value: string | number;\r\n label: string;\r\n disabled?: boolean;\r\n}\r\n\r\nexport type SelectGroupOptionType = 'group' | 'subgroup' | 'item';\r\n\r\nexport interface SelectOptionGroup extends SelectOption {\r\n type: SelectGroupOptionType;\r\n parent?: string;\r\n}\r\n\r\nexport interface SelectStyleProps {\r\n containerStyle?: { [key: string]: string };\r\n triggerStyle?: { [key: string]: string };\r\n dropdownStyle?: { [key: string]: string };\r\n optionStyle?: { [key: string]: string };\r\n labelStyle?: { [key: string]: string };\r\n}\r\n\r\nexport interface SelectEvents {\r\n sdChange: {\r\n value: string | number | null;\r\n option: SelectOption | null;\r\n };\r\n dropDownShow: { isOpen: boolean };\r\n}\r\n\r\nexport interface SelectMultipleEvents extends Pick<SelectEvents, 'dropDownShow' | 'dropDownShow'> {\r\n sdChange: SelectOption[] | null;\r\n}\r\n\r\n@Component({\r\n tag: 'sd-select',\r\n styleUrl: 'sd-select.scss',\r\n})\r\nexport class SdSelect extends BaseDropdownEvent {\r\n @Element() el!: HTMLElement;\r\n\r\n // props\r\n @Prop({ mutable: true }) value: string | number | null = null;\r\n @Prop() label: string = '';\r\n @Prop({ mutable: true }) options: SelectOption[] = [];\r\n @Prop() placeholder: string = '선택';\r\n @Prop() optionPlaceholder: string = '옵션이 없습니다.';\r\n @Prop() width: string = '200px';\r\n @Prop() dropdownHeight: string = '260px';\r\n @Prop() disabled: boolean = false;\r\n @Prop() clearable: boolean = false;\r\n @Prop() searchable: boolean = false;\r\n\r\n // props - custom slots\r\n @Prop() optionRenderer?: (option: SelectOption, index: number, isSelected: boolean) => any;\r\n\r\n // states\r\n @State() filteredOptions = this.options;\r\n @State() isOpen: boolean = false;\r\n @State() searchText: string | null = null;\r\n @State() itemIndex: number = -1;\r\n @State() isScrolled: boolean = false;\r\n\r\n // events\r\n @Event() sdChange?: EventEmitter<SelectEvents['sdChange']>;\r\n @Event() dropDownShow?: EventEmitter<SelectEvents['dropDownShow']>;\r\n\r\n private selectRef?: HTMLElement;\r\n private searchRef?: HTMLSdInputElement;\r\n private optionRef?: HTMLSdSelectOptionElement;\r\n private dropdownRef?: HTMLElement;\r\n\r\n @Watch('value')\r\n valueChanged() {\r\n const selectedOption = this.getSelectedOption();\r\n this.sdChange?.emit({ value: selectedOption?.value || null, option: selectedOption || null });\r\n }\r\n\r\n @Watch('options')\r\n optionsChanged() {\r\n this.filteredOptions = this.options;\r\n this.filterOptions();\r\n }\r\n\r\n @Watch('searchText')\r\n searchTextChanged() {\r\n this.filterOptions();\r\n }\r\n\r\n @Watch('itemIndex')\r\n async itemIndexChanged(newIndex: number, oldIndex: number) {\r\n if (this.searchable) {\r\n const searchInput = await this.getNativeInputElement();\r\n if (this.itemIndex === -1) {\r\n searchInput?.focus();\r\n return;\r\n } else if (searchInput?.matches(':focus')) {\r\n searchInput?.blur();\r\n }\r\n }\r\n\r\n const optionElements =\r\n this.dropdownRef?.querySelectorAll('.sd-select__dropdown sd-select-option') || [];\r\n const currentItem = optionElements?.[this.itemIndex];\r\n\r\n if (!currentItem || !this.isOpen) return;\r\n\r\n this.optionRef = currentItem as HTMLSdSelectOptionElement;\r\n const isOptionDisabled = await this.optionRef.isDisabled();\r\n\r\n if (isOptionDisabled) {\r\n newIndex > oldIndex ? this.itemIndex++ : this.itemIndex--;\r\n return;\r\n }\r\n\r\n this.scrollToOption(currentItem as HTMLElement);\r\n }\r\n\r\n componentWillLoad() {\r\n // props가 모두 설정된 후에 실행되므로 올바른 options 값을 가져올 수 있음\r\n this.filteredOptions = this.options;\r\n this.initializeEvent(); // global dropdown Manager에 등록 + 이벤트 핸들러 초기화\r\n }\r\n\r\n disconnectedCallback() {\r\n this.cleanupEvent(); // global dropdown Manager에서 제거 + 이벤트 정리\r\n }\r\n\r\n @Watch('isOpen')\r\n async isOpenChanged() {\r\n // Base class의 이벤트 관리 호출 - 다른 select와의 이벤트 충돌 방지\r\n this.onDropdownToggle(this.isOpen);\r\n\r\n const selectedOption = this.getSelectedOption();\r\n if (!selectedOption) {\r\n this.itemIndex = /* this.searchable ? */ -1 /* : 0 */;\r\n } else {\r\n this.itemIndex = this.options.indexOf(selectedOption);\r\n }\r\n\r\n this.dropDownShow?.emit({ isOpen: this.isOpen });\r\n\r\n if (this.isOpen === false) return;\r\n\r\n await new Promise(resolve => setTimeout(resolve, 10));\r\n\r\n const optionElements =\r\n this.dropdownRef?.querySelectorAll('.sd-select__dropdown sd-select-option') || [];\r\n\r\n const currentItem = optionElements?.[this.itemIndex];\r\n\r\n if (this.searchable) {\r\n const searchInput = await this.getNativeInputElement();\r\n searchInput?.focus();\r\n }\r\n\r\n if (!currentItem) return;\r\n\r\n await new Promise(resolve => setTimeout(resolve, 10));\r\n this.scrollToOption(currentItem as HTMLElement);\r\n }\r\n\r\n protected handleDocumentClick(event: Event): void {\r\n if (!this.selectRef?.contains(event.target as Node)) {\r\n this.isOpen = false;\r\n }\r\n }\r\n\r\n protected handleDocumentKeydown(keyboardEvent: KeyboardEvent): void {\r\n keyboardEvent.stopPropagation();\r\n const targetKey = ['ArrowDown', 'ArrowUp', 'Enter', 'Escape'];\r\n if (!targetKey.includes(keyboardEvent.key)) return;\r\n\r\n keyboardEvent.preventDefault();\r\n switch (keyboardEvent.key) {\r\n case 'ArrowDown':\r\n case 'ArrowUp':\r\n const keyboardNavigation = new SelectKeyboardNavigation(this.searchable, this.filteredOptions);\r\n const nextIndex = keyboardNavigation.getNextIndex(this.itemIndex, keyboardEvent.key);\r\n this.itemIndex = nextIndex;\r\n break;\r\n case 'Enter':\r\n const selectedOption = this.filteredOptions[this.itemIndex];\r\n if (selectedOption && !selectedOption.disabled) {\r\n this.value = selectedOption.value;\r\n this.searchText = null;\r\n this.isOpen = false;\r\n }\r\n break;\r\n case 'Escape':\r\n this.isOpen = false;\r\n break;\r\n }\r\n }\r\n\r\n // closeDropdown 메서드 구현 (Manager에서 호출됨)\r\n closeDropdown() {\r\n this.isOpen = false;\r\n }\r\n\r\n // event handlers\r\n handleTriggerClick = (event: Event) => {\r\n event.stopPropagation();\r\n\r\n if (!this.disabled) {\r\n this.isOpen = !this.isOpen;\r\n this.dropDownShow?.emit({ isOpen: this.isOpen });\r\n }\r\n };\r\n\r\n handleOptionClick = (detail: { option: SelectOption; event: Event }) => {\r\n const { option, event } = detail;\r\n event.stopPropagation();\r\n\r\n if (!option.disabled) {\r\n this.value = option.value;\r\n this.isOpen = false;\r\n }\r\n };\r\n\r\n private filterOptions() {\r\n if (!this.searchText || this.searchText.trim() === '') {\r\n // 검색어가 없으면 전체 옵션 표시\r\n this.filteredOptions = this.options;\r\n } else {\r\n // 검색어가 있으면 필터링\r\n this.filteredOptions = this.options.filter(option =>\r\n option.label.toLowerCase().includes(this.searchText!.toLowerCase()),\r\n );\r\n }\r\n }\r\n\r\n private getSelectedOption(): SelectOption | undefined {\r\n return this.options.find(option => option.value === this.value);\r\n }\r\n\r\n private handleDropdownScroll = (event: Event) => {\r\n const target = event.target as HTMLElement;\r\n const scrollTop = target.scrollTop;\r\n\r\n // 스크롤이 조금이라도 되면 그림자 표시\r\n this.isScrolled = scrollTop > 0;\r\n };\r\n\r\n private async getNativeInputElement(): Promise<HTMLInputElement | null> {\r\n if (this.searchRef) {\r\n return this.searchRef.getNativeElement();\r\n }\r\n return null;\r\n }\r\n\r\n private scrollToOption(optionElement: HTMLElement) {\r\n if (!this.dropdownRef || !optionElement) return;\r\n\r\n const dropdown = this.dropdownRef;\r\n const optionTop = optionElement.offsetTop;\r\n const optionHeight = optionElement.offsetHeight;\r\n const dropdownScrollTop = dropdown.scrollTop;\r\n const dropdownHeight = dropdown.clientHeight;\r\n\r\n const searchContainer = dropdown.querySelector('.sd-select__search-container');\r\n const searchOffset = searchContainer ? (searchContainer as HTMLElement).offsetHeight : 0;\r\n\r\n const visibleTop = dropdownScrollTop + searchOffset;\r\n const visibleBottom = dropdownScrollTop + dropdownHeight;\r\n\r\n if (optionTop < visibleTop) {\r\n dropdown.scrollTop = optionTop - searchOffset;\r\n } else if (optionTop + optionHeight > visibleBottom) {\r\n dropdown.scrollTop = optionTop + optionHeight - dropdownHeight + searchOffset;\r\n }\r\n }\r\n\r\n // render method\r\n render() {\r\n const style = {\r\n '--select-width': this.width || '200px',\r\n '--select-dropdown-height': this.dropdownHeight || '260px',\r\n };\r\n\r\n return (\r\n <Host style={style}>\r\n <div\r\n class={{\r\n 'sd-select': true,\r\n 'sd-select--open': this.isOpen,\r\n 'sd-select--disabled': this.disabled,\r\n }}\r\n ref={el => (this.selectRef = el)}\r\n >\r\n {this.renderLabel(this.label)}\r\n <div class=\"sd-select__container\">\r\n {this.renderTrigger()}\r\n {this.renderDropdown()}\r\n </div>\r\n </div>\r\n </Host>\r\n );\r\n }\r\n\r\n private renderLabel(label?: string) {\r\n if (!label) return null;\r\n\r\n return <label class=\"sd-select__label\">{label}</label>;\r\n }\r\n\r\n private renderTrigger() {\r\n const selectedOption = this.getSelectedOption();\r\n return (\r\n <div\r\n class=\"sd-select__trigger\"\r\n tabindex={this.disabled ? -1 : 0}\r\n onClick={this.handleTriggerClick}\r\n >\r\n <span class=\"sd-select__value\">{selectedOption ? selectedOption.label : this.placeholder}</span>\r\n {this.clearable && selectedOption && !this.disabled && (\r\n <sd-icon\r\n key=\"clear-icon\"\r\n name=\"close\"\r\n size={10}\r\n color=\"#888\"\r\n class=\"sd-select__clear\"\r\n onClick={event => {\r\n event.stopPropagation();\r\n this.value = null;\r\n }}\r\n ></sd-icon>\r\n )}\r\n\r\n <sd-icon\r\n key=\"arrow-icon\"\r\n name=\"arrowDown\"\r\n color=\"#888\"\r\n class={{ 'sd-select__arrow': true, 'sd-select__arrow--open': this.isOpen }}\r\n ></sd-icon>\r\n </div>\r\n );\r\n }\r\n\r\n private renderDropdown() {\r\n const style = {\r\n '--select-dropdown-width': this.width || '200px',\r\n '--select-dropdown-height': this.dropdownHeight || '260px',\r\n };\r\n if (this.isOpen === false) return null;\r\n\r\n return (\r\n <sd-portal open={this.isOpen} parentRef={this.selectRef} onSdClose={this.closeDropdown}>\r\n <div\r\n class=\"sd-select__dropdown\"\r\n style={style}\r\n onScroll={this.handleDropdownScroll}\r\n ref={el => (this.dropdownRef = el)}\r\n >\r\n {this.searchable && (\r\n <div\r\n class={{\r\n 'sd-select__search-container': true,\r\n 'sd-select__search-container--scrolled': this.isScrolled,\r\n }}\r\n onClick={event => event.stopPropagation()}\r\n >\r\n <sd-input\r\n ref={el => (this.searchRef = el)}\r\n value={this.searchText}\r\n placeholder=\"검색\"\r\n clearable\r\n inputStyle={{ 'padding-left': '8px' }}\r\n autofocus\r\n onSdInput={event => {\r\n this.searchText = String(event?.detail);\r\n }}\r\n onSdFocus={() => {\r\n this.itemIndex = -1;\r\n }}\r\n >\r\n <sd-icon\r\n name=\"search\"\r\n size={16}\r\n color=\"#737373\"\r\n style={{ marginRight: '4px' }}\r\n slot=\"prefix\"\r\n ></sd-icon>\r\n </sd-input>\r\n </div>\r\n )}\r\n {this.filteredOptions.length > 0 ? (\r\n this.filteredOptions.map((option, index) => (\r\n <slot name={`option-${option.value}`}>\r\n <sd-select-option\r\n option={option}\r\n index={index}\r\n isSelected={option.value === this.value}\r\n isFocused={index === this.itemIndex}\r\n onOptionClick={({ detail }) => this.handleOptionClick(detail)}\r\n ></sd-select-option>\r\n </slot>\r\n ))\r\n ) : (\r\n <slot name=\"option-placeholder\">\r\n <div class={'sd-select__option-placeholder'}>{this.optionPlaceholder}</div>\r\n </slot>\r\n )}\r\n </div>\r\n </sd-portal>\r\n );\r\n }\r\n}\r\n\r\n{\r\n /*\r\n <sd-select id=\"select-1\">\r\n <!-- <div slot=\"option-placeholder\">옵션이 없습니다.</div> -->\r\n </sd-select>\r\n <sd-select id=\"select-2\"> </sd-select>\r\n <sd-select id=\"select-3\" searchable clearable>\r\n <div slot=\"option-3\">test</div>\r\n </sd-select>\r\n\r\n <script>\r\n document.addEventListener('DOMContentLoaded', () => {\r\n const select1 = document.getElementById('select-1');\r\n const select2 = document.getElementById('select-2');\r\n const select3 = document.getElementById('select-3');\r\n const select = document.querySelector('sd-select slot[name=\"option-3\"]');\r\n select1.optionPlaceholder = 'No options available';\r\n\r\n const options = [\r\n { label: 'Option 1', value: '1' },\r\n { label: 'Option 2', value: '2' },\r\n { label: 'Option 3', value: '3', disabled: true },\r\n { label: 'Option 4', value: '4' },\r\n { label: 'Option 5', value: '5' },\r\n { label: 'Option 6', value: '6' },\r\n { label: 'Option 7', value: '7', disabled: true },\r\n { label: 'Option 8', value: '8' },\r\n { label: 'Option 9', value: '9' },\r\n { label: 'Option 10', value: '10' },\r\n { label: 'Option 11', value: '11', disabled: true },\r\n { label: 'Option 12', value: '12' },\r\n { label: 'Option 13', value: '13' },\r\n { label: 'Option 14', value: '14' },\r\n { label: 'Option 15', value: '15', disabled: true },\r\n { label: 'Option 16', value: '16' },\r\n { label: 'Option 17', value: '17' },\r\n { label: 'Option 18', value: '18' },\r\n { label: 'Option 19', value: '19', disabled: true },\r\n { label: 'Option 20', value: '20' },\r\n { label: 'Option 21', value: '21' },\r\n { label: 'Option 22', value: '22' },\r\n { label: 'Option 23', value: '23', disabled: true },\r\n { label: 'Option 24', value: '24' },\r\n ];\r\n\r\n select2.options = options;\r\n select3.options = options;\r\n });\r\n </script>\r\n\r\n */\r\n}\r\n"],"version":3}
|