@sellmate/design-system 0.0.30 → 0.0.32
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/cjs/sd-button.sd-checkbox.sd-guide.sd-icon.sd-input.sd-loading-spinner.sd-pagination.sd-portal.sd-select.sd-select-option.sd-table.sd-tooltip.sd-tooltip-portal.entry.cjs.js.map +1 -1
- package/dist/cjs/sd-button_13.cjs.entry.js +8 -8
- package/dist/cjs/sd-progress.cjs.entry.js +44 -0
- package/dist/cjs/sd-progress.entry.cjs.js.map +1 -0
- package/dist/cjs/sd-select-multiple-group.cjs.entry.js +30 -9
- package/dist/cjs/sd-select-multiple-group.entry.cjs.js.map +1 -1
- package/dist/cjs/sd-select-multiple.cjs.entry.js +2 -2
- package/dist/cjs/sd-select-option-group.cjs.entry.js +4 -4
- package/dist/cjs/sd-select-option-group.entry.cjs.js.map +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/sd-progress/sd-progress.css +61 -0
- package/dist/collection/components/sd-progress/sd-progress.js +194 -0
- package/dist/collection/components/sd-progress/sd-progress.js.map +1 -0
- package/dist/collection/components/sd-select/sd-select-option/sd-select-option.js +1 -1
- package/dist/collection/components/sd-select/sd-select.js +2 -2
- package/dist/collection/components/sd-select/sd-select.js.map +1 -1
- 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.js +51 -10
- package/dist/collection/components/sd-select-multiple-group/sd-select-multiple-group.js.map +1 -1
- package/dist/collection/components/sd-select-multiple-group/sd-select-option-group/sd-select-option-group.css +7 -4
- package/dist/collection/components/sd-select-multiple-group/sd-select-option-group/sd-select-option-group.js +3 -3
- 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-DOUuhGVo.js → p-B5RhRjFk.js} +5 -5
- package/dist/components/p-B5RhRjFk.js.map +1 -0
- package/dist/components/{p-c8NhJgfj.js → p-BLVHOrsi.js} +3 -3
- package/dist/components/{p-c8NhJgfj.js.map → p-BLVHOrsi.js.map} +1 -1
- package/dist/components/{p-B0JdV6r1.js → p-BNY55XpQ.js} +3 -3
- package/dist/components/{p-B0JdV6r1.js.map → p-BNY55XpQ.js.map} +1 -1
- package/dist/components/{p-CSxmWyJx.js → p-CDNsy2Lv.js} +6 -6
- package/dist/components/p-CDNsy2Lv.js.map +1 -0
- package/dist/components/{p-Mc5Mv8aH.js → p-Dvtwm2UI.js} +7 -7
- package/dist/components/{p-Mc5Mv8aH.js.map → p-Dvtwm2UI.js.map} +1 -1
- package/dist/components/sd-popover.js +1 -1
- package/dist/components/sd-progress.d.ts +11 -0
- package/dist/components/sd-progress.js +70 -0
- package/dist/components/sd-progress.js.map +1 -0
- package/dist/components/sd-select-multiple-group.js +33 -11
- package/dist/components/sd-select-multiple-group.js.map +1 -1
- package/dist/components/sd-select-multiple.js +3 -3
- 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 -1
- package/dist/components/sd-table.js +4 -4
- 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-56b88d9b.entry.js +2 -0
- package/dist/design-system/{p-ff4feeff.entry.js.map → p-56b88d9b.entry.js.map} +1 -1
- package/dist/design-system/{p-7a7cdc36.entry.js → p-7a9028ae.entry.js} +2 -2
- package/dist/design-system/p-93569289.entry.js +2 -0
- package/dist/design-system/p-93569289.entry.js.map +1 -0
- package/dist/design-system/p-ac7dbf3c.entry.js +2 -0
- package/dist/design-system/p-ac7dbf3c.entry.js.map +1 -0
- package/dist/design-system/{p-e2a11135.entry.js → p-e9800353.entry.js} +2 -2
- package/dist/design-system/sd-button.sd-checkbox.sd-guide.sd-icon.sd-input.sd-loading-spinner.sd-pagination.sd-portal.sd-select.sd-select-option.sd-table.sd-tooltip.sd-tooltip-portal.entry.esm.js.map +1 -1
- package/dist/design-system/sd-progress.entry.esm.js.map +1 -0
- package/dist/design-system/sd-select-multiple-group.entry.esm.js.map +1 -1
- package/dist/design-system/sd-select-option-group.entry.esm.js.map +1 -1
- package/dist/esm/design-system.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sd-button.sd-checkbox.sd-guide.sd-icon.sd-input.sd-loading-spinner.sd-pagination.sd-portal.sd-select.sd-select-option.sd-table.sd-tooltip.sd-tooltip-portal.entry.js.map +1 -1
- package/dist/esm/sd-button_13.entry.js +8 -8
- package/dist/esm/sd-progress.entry.js +42 -0
- package/dist/esm/sd-progress.entry.js.map +1 -0
- package/dist/esm/sd-select-multiple-group.entry.js +31 -10
- package/dist/esm/sd-select-multiple-group.entry.js.map +1 -1
- package/dist/esm/sd-select-multiple.entry.js +2 -2
- package/dist/esm/sd-select-option-group.entry.js +4 -4
- package/dist/esm/sd-select-option-group.entry.js.map +1 -1
- package/dist/types/components/sd-progress/sd-progress.d.ts +12 -0
- package/dist/types/components/sd-select/sd-select.d.ts +1 -1
- package/dist/types/components/sd-select-multiple-group/sd-select-multiple-group.d.ts +10 -1
- package/dist/types/components.d.ts +63 -0
- package/hydrate/index.js +99 -23
- package/hydrate/index.mjs +99 -23
- package/package.json +2 -2
- package/dist/components/p-CSxmWyJx.js.map +0 -1
- package/dist/components/p-DOUuhGVo.js.map +0 -1
- package/dist/design-system/p-5e0ac5e6.entry.js +0 -2
- package/dist/design-system/p-5e0ac5e6.entry.js.map +0 -1
- package/dist/design-system/p-ff4feeff.entry.js +0 -2
- /package/dist/design-system/{p-7a7cdc36.entry.js.map → p-7a9028ae.entry.js.map} +0 -0
- /package/dist/design-system/{p-e2a11135.entry.js.map → p-e9800353.entry.js.map} +0 -0
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { Host, h } from "@stencil/core";
|
|
2
|
+
export class SdProgress {
|
|
3
|
+
type = 'bar';
|
|
4
|
+
status = 'default';
|
|
5
|
+
percentage = 0;
|
|
6
|
+
size = 80;
|
|
7
|
+
strokeWidth = 12;
|
|
8
|
+
label;
|
|
9
|
+
statusColor = {
|
|
10
|
+
default: '#aaaaaa',
|
|
11
|
+
progress: '#0075ff',
|
|
12
|
+
complete: '#12B553',
|
|
13
|
+
error: '#FB4444',
|
|
14
|
+
};
|
|
15
|
+
render() {
|
|
16
|
+
return (h(Host, { key: '2e2f7cf77bbc63dfb15910a3bc50ac45601020cd', style: {
|
|
17
|
+
'--progress-color': this.statusColor[this.status],
|
|
18
|
+
'--progress-percentage': `${this.percentage}%`,
|
|
19
|
+
} }, this.type === 'bar' ? this.renderBarProgress() : this.renderSpinnerProgress(), this.label && h("div", { key: '3e72a490e148886c59345e5ac3161f760e0f4e85', class: "sd-progress__label" }, this.label)));
|
|
20
|
+
}
|
|
21
|
+
renderBarProgress() {
|
|
22
|
+
return (h("div", { class: `sd-progress__bar sd-progress__bar--${this.status}` }, h("div", { class: ['sd-progress__bar__percent', this.percentage < 100 ? 'proceed' : ''].join(' ') }), h("div", { class: "sd-progress__bar__indicator sd-progress__bar__indicator--left" }, this.percentage, "%"), h("div", { class: "sd-progress__bar__indicator sd-progress__bar__indicator--right" }, this.percentage, "%")));
|
|
23
|
+
}
|
|
24
|
+
renderSpinnerProgress() {
|
|
25
|
+
const radius = (this.size - this.strokeWidth) / 2; // 원의 반지름
|
|
26
|
+
const circumference = 2 * Math.PI * radius; // 원의 둘레
|
|
27
|
+
const offset = circumference - (this.percentage / 100) * circumference; // 진행률에 따른 offset
|
|
28
|
+
const progressBgSize = `${this.size}px`;
|
|
29
|
+
const progressSize = `${this.size / 2}px`;
|
|
30
|
+
return (h("div", { class: `sd-progress__spinner sd-progress__spinner--${this.status}` }, h("svg", { width: progressBgSize, height: progressBgSize }, h("circle", { cx: progressSize, cy: progressSize, r: radius, stroke: "#EEEEEE", "stroke-width": this.strokeWidth, fill: "transparent" }), h("circle", { cx: progressSize, cy: progressSize, r: radius, stroke: this.statusColor[this.status], "stroke-width": this.strokeWidth, fill: "transparent", "stroke-dasharray": circumference, "stroke-dashoffset": offset, "stroke-linecap": "round", class: "transition-all duration-500" })), h("strong", { class: "sd-progress__spinner__label" }, this.percentage, " %")));
|
|
31
|
+
}
|
|
32
|
+
static get is() { return "sd-progress"; }
|
|
33
|
+
static get originalStyleUrls() {
|
|
34
|
+
return {
|
|
35
|
+
"$": ["sd-progress.scss"]
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
static get styleUrls() {
|
|
39
|
+
return {
|
|
40
|
+
"$": ["sd-progress.css"]
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
static get properties() {
|
|
44
|
+
return {
|
|
45
|
+
"type": {
|
|
46
|
+
"type": "string",
|
|
47
|
+
"mutable": false,
|
|
48
|
+
"complexType": {
|
|
49
|
+
"original": "'bar' | 'spinner'",
|
|
50
|
+
"resolved": "\"bar\" | \"spinner\"",
|
|
51
|
+
"references": {}
|
|
52
|
+
},
|
|
53
|
+
"required": false,
|
|
54
|
+
"optional": false,
|
|
55
|
+
"docs": {
|
|
56
|
+
"tags": [],
|
|
57
|
+
"text": ""
|
|
58
|
+
},
|
|
59
|
+
"getter": false,
|
|
60
|
+
"setter": false,
|
|
61
|
+
"reflect": false,
|
|
62
|
+
"attribute": "type",
|
|
63
|
+
"defaultValue": "'bar'"
|
|
64
|
+
},
|
|
65
|
+
"status": {
|
|
66
|
+
"type": "string",
|
|
67
|
+
"mutable": false,
|
|
68
|
+
"complexType": {
|
|
69
|
+
"original": "'default' | 'progress' | 'complete' | 'error'",
|
|
70
|
+
"resolved": "\"complete\" | \"default\" | \"error\" | \"progress\"",
|
|
71
|
+
"references": {}
|
|
72
|
+
},
|
|
73
|
+
"required": false,
|
|
74
|
+
"optional": false,
|
|
75
|
+
"docs": {
|
|
76
|
+
"tags": [],
|
|
77
|
+
"text": ""
|
|
78
|
+
},
|
|
79
|
+
"getter": false,
|
|
80
|
+
"setter": false,
|
|
81
|
+
"reflect": false,
|
|
82
|
+
"attribute": "status",
|
|
83
|
+
"defaultValue": "'default'"
|
|
84
|
+
},
|
|
85
|
+
"percentage": {
|
|
86
|
+
"type": "number",
|
|
87
|
+
"mutable": false,
|
|
88
|
+
"complexType": {
|
|
89
|
+
"original": "number",
|
|
90
|
+
"resolved": "number",
|
|
91
|
+
"references": {}
|
|
92
|
+
},
|
|
93
|
+
"required": false,
|
|
94
|
+
"optional": false,
|
|
95
|
+
"docs": {
|
|
96
|
+
"tags": [],
|
|
97
|
+
"text": ""
|
|
98
|
+
},
|
|
99
|
+
"getter": false,
|
|
100
|
+
"setter": false,
|
|
101
|
+
"reflect": false,
|
|
102
|
+
"attribute": "percentage",
|
|
103
|
+
"defaultValue": "0"
|
|
104
|
+
},
|
|
105
|
+
"size": {
|
|
106
|
+
"type": "number",
|
|
107
|
+
"mutable": false,
|
|
108
|
+
"complexType": {
|
|
109
|
+
"original": "number",
|
|
110
|
+
"resolved": "number",
|
|
111
|
+
"references": {}
|
|
112
|
+
},
|
|
113
|
+
"required": false,
|
|
114
|
+
"optional": false,
|
|
115
|
+
"docs": {
|
|
116
|
+
"tags": [],
|
|
117
|
+
"text": ""
|
|
118
|
+
},
|
|
119
|
+
"getter": false,
|
|
120
|
+
"setter": false,
|
|
121
|
+
"reflect": false,
|
|
122
|
+
"attribute": "size",
|
|
123
|
+
"defaultValue": "80"
|
|
124
|
+
},
|
|
125
|
+
"strokeWidth": {
|
|
126
|
+
"type": "number",
|
|
127
|
+
"mutable": false,
|
|
128
|
+
"complexType": {
|
|
129
|
+
"original": "number",
|
|
130
|
+
"resolved": "number",
|
|
131
|
+
"references": {}
|
|
132
|
+
},
|
|
133
|
+
"required": false,
|
|
134
|
+
"optional": false,
|
|
135
|
+
"docs": {
|
|
136
|
+
"tags": [],
|
|
137
|
+
"text": ""
|
|
138
|
+
},
|
|
139
|
+
"getter": false,
|
|
140
|
+
"setter": false,
|
|
141
|
+
"reflect": false,
|
|
142
|
+
"attribute": "stroke-width",
|
|
143
|
+
"defaultValue": "12"
|
|
144
|
+
},
|
|
145
|
+
"label": {
|
|
146
|
+
"type": "string",
|
|
147
|
+
"mutable": false,
|
|
148
|
+
"complexType": {
|
|
149
|
+
"original": "string",
|
|
150
|
+
"resolved": "string | undefined",
|
|
151
|
+
"references": {}
|
|
152
|
+
},
|
|
153
|
+
"required": false,
|
|
154
|
+
"optional": true,
|
|
155
|
+
"docs": {
|
|
156
|
+
"tags": [],
|
|
157
|
+
"text": ""
|
|
158
|
+
},
|
|
159
|
+
"getter": false,
|
|
160
|
+
"setter": false,
|
|
161
|
+
"reflect": false,
|
|
162
|
+
"attribute": "label"
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
// <sd-progress id="sd-progress-1"></sd-progress>
|
|
168
|
+
// <sd-progress id="sd-progress-2" type="spinner"></sd-progress>
|
|
169
|
+
// <sd-progress id="sd-progress-3" type="spinner"></sd-progress>
|
|
170
|
+
// <script>
|
|
171
|
+
// document.addEventListener('DOMContentLoaded', event => {
|
|
172
|
+
// progress = document.getElementById('sd-progress-1');
|
|
173
|
+
// progress2 = document.getElementById('sd-progress-2');
|
|
174
|
+
// progress3 = document.getElementById('sd-progress-3');
|
|
175
|
+
// progress2.label = 'test label...';
|
|
176
|
+
// progress3.percentage = 50;
|
|
177
|
+
// progress3.status = 'error';
|
|
178
|
+
// let percentage = 0;
|
|
179
|
+
// const interval = setInterval(() => {
|
|
180
|
+
// if (percentage >= 100) {
|
|
181
|
+
// clearInterval(interval);
|
|
182
|
+
// progress.status = 'complete';
|
|
183
|
+
// progress2.status = 'complete';
|
|
184
|
+
// return;
|
|
185
|
+
// }
|
|
186
|
+
// percentage += 10;
|
|
187
|
+
// progress.status = 'progress';
|
|
188
|
+
// progress.percentage = percentage;
|
|
189
|
+
// progress2.status = 'progress';
|
|
190
|
+
// progress2.percentage = percentage;
|
|
191
|
+
// }, 500);
|
|
192
|
+
// });
|
|
193
|
+
// </script>
|
|
194
|
+
//# sourceMappingURL=sd-progress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sd-progress.js","sourceRoot":"","sources":["../../../src/components/sd-progress/sd-progress.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAMzD,MAAM,OAAO,UAAU;IACd,IAAI,GAAsB,KAAK,CAAC;IAChC,MAAM,GAAkD,SAAS,CAAC;IAClE,UAAU,GAAW,CAAC,CAAC;IACvB,IAAI,GAAW,EAAE,CAAC;IAClB,WAAW,GAAW,EAAE,CAAC;IACzB,KAAK,CAAU;IAEf,WAAW,GAAG;QACrB,OAAO,EAAE,SAAS;QAClB,QAAQ,EAAE,SAAS;QACnB,QAAQ,EAAE,SAAS;QACnB,KAAK,EAAE,SAAS;KAChB,CAAC;IAEF,MAAM;QACL,OAAO,CACN,EAAC,IAAI,qDACJ,KAAK,EAAE;gBACN,kBAAkB,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC;gBACjD,uBAAuB,EAAE,GAAG,IAAI,CAAC,UAAU,GAAG;aAC9C;YAEA,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,qBAAqB,EAAE;YAC7E,IAAI,CAAC,KAAK,IAAI,4DAAK,KAAK,EAAC,oBAAoB,IAAE,IAAI,CAAC,KAAK,CAAO,CAC3D,CACP,CAAC;IACH,CAAC;IAED,iBAAiB;QAChB,OAAO,CACN,WAAK,KAAK,EAAE,sCAAsC,IAAI,CAAC,MAAM,EAAE;YAC9D,WACC,KAAK,EAAE,CAAC,2BAA2B,EAAE,IAAI,CAAC,UAAU,GAAG,G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,GAClC,CACG;YACN,cAAQ,KAAK,EAAC,6BAA6B;gBAAE,IAAI,CAAC,UAAU;qBAAY,CACnE,CACN,CAAC;IACH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACD;AAED,kDAAkD;AAClD,iEAAiE;AACjE,iEAAiE;AACjE,WAAW;AACX,4DAA4D;AAC5D,yDAAyD;AACzD,0DAA0D;AAC1D,0DAA0D;AAC1D,uCAAuC;AACvC,+BAA+B;AAC/B,gCAAgC;AAChC,wBAAwB;AACxB,yCAAyC;AACzC,8BAA8B;AAC9B,+BAA+B;AAC/B,oCAAoC;AACpC,qCAAqC;AACrC,cAAc;AACd,OAAO;AACP,uBAAuB;AACvB,mCAAmC;AACnC,uCAAuC;AACvC,oCAAoC;AACpC,wCAAwC;AACxC,aAAa;AACb,OAAO;AACP,YAAY","sourcesContent":["import { Component, Host, Prop, h } from '@stencil/core';\n\n@Component({\n tag: 'sd-progress',\n styleUrl: 'sd-progress.scss',\n})\nexport class SdProgress {\n @Prop() type: 'bar' | 'spinner' = 'bar';\n @Prop() status: 'default' | 'progress' | 'complete' | 'error' = 'default';\n @Prop() percentage: number = 0;\n @Prop() size: number = 80;\n @Prop() strokeWidth: number = 12;\n @Prop() label?: string;\n\n private statusColor = {\n default: '#aaaaaa',\n progress: '#0075ff',\n complete: '#12B553',\n error: '#FB4444',\n };\n\n render() {\n return (\n <Host\n style={{\n '--progress-color': this.statusColor[this.status],\n '--progress-percentage': `${this.percentage}%`,\n }}\n >\n {this.type === 'bar' ? this.renderBarProgress() : this.renderSpinnerProgress()}\n {this.label && <div class=\"sd-progress__label\">{this.label}</div>}\n </Host>\n );\n }\n\n renderBarProgress() {\n return (\n <div class={`sd-progress__bar sd-progress__bar--${this.status}`}>\n <div\n class={['sd-progress__bar__percent', this.percentage < 100 ? 'proceed' : ''].join(' ')}\n ></div>\n <div class=\"sd-progress__bar__indicator sd-progress__bar__indicator--left\">\n {this.percentage}%\n </div>\n <div class=\"sd-progress__bar__indicator sd-progress__bar__indicator--right\">\n {this.percentage}%\n </div>\n </div>\n );\n }\n\n renderSpinnerProgress() {\n const radius = (this.size - this.strokeWidth) / 2; // 원의 반지름\n const circumference = 2 * Math.PI * radius; // 원의 둘레\n const offset = circumference - (this.percentage / 100) * circumference; // 진행률에 따른 offset\n const progressBgSize = `${this.size}px`;\n const progressSize = `${this.size / 2}px`;\n\n return (\n <div class={`sd-progress__spinner sd-progress__spinner--${this.status}`}>\n <svg width={progressBgSize} height={progressBgSize}>\n <circle\n cx={progressSize}\n cy={progressSize}\n r={radius}\n stroke=\"#EEEEEE\"\n stroke-width={this.strokeWidth}\n fill=\"transparent\"\n />\n <circle\n cx={progressSize}\n cy={progressSize}\n r={radius}\n stroke={this.statusColor[this.status]}\n stroke-width={this.strokeWidth}\n fill=\"transparent\"\n stroke-dasharray={circumference}\n stroke-dashoffset={offset}\n stroke-linecap=\"round\"\n class=\"transition-all duration-500\"\n />\n </svg>\n <strong class=\"sd-progress__spinner__label\">{this.percentage} %</strong>\n </div>\n );\n }\n}\n\n// <sd-progress id=\"sd-progress-1\"></sd-progress>\n// <sd-progress id=\"sd-progress-2\" type=\"spinner\"></sd-progress>\n// <sd-progress id=\"sd-progress-3\" type=\"spinner\"></sd-progress>\n// <script>\n// document.addEventListener('DOMContentLoaded', event => {\n// progress = document.getElementById('sd-progress-1');\n// progress2 = document.getElementById('sd-progress-2');\n// progress3 = document.getElementById('sd-progress-3');\n// progress2.label = 'test label...';\n// progress3.percentage = 50;\n// progress3.status = 'error';\n// let percentage = 0;\n// const interval = setInterval(() => {\n// if (percentage >= 100) {\n// clearInterval(interval);\n// progress.status = 'complete';\n// progress2.status = 'complete';\n// return;\n// }\n// percentage += 10;\n// progress.status = 'progress';\n// progress.percentage = percentage;\n// progress2.status = 'progress';\n// progress2.percentage = percentage;\n// }, 500);\n// });\n// </script>\n"]}
|
|
@@ -24,7 +24,7 @@ export class SdSelectOption {
|
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
26
|
render() {
|
|
27
|
-
return (h(Host, { key: '
|
|
27
|
+
return (h(Host, { key: '57acf795fbb642249d9716fc8fa4123f2d939d2b' }, h("div", { key: '6653deafa3142a3bf9b67290dae411c29fc38f41', class: {
|
|
28
28
|
'sd-select__option': true,
|
|
29
29
|
'sd-select__option--selected': this.isSelected,
|
|
30
30
|
'sd-select__option--disabled': !!this.option.disabled,
|
|
@@ -200,11 +200,11 @@ export class SdSelect extends BaseDropdownEvent {
|
|
|
200
200
|
'--select-width': this.width || '200px',
|
|
201
201
|
'--select-dropdown-height': this.dropdownHeight || '260px',
|
|
202
202
|
};
|
|
203
|
-
return (h(Host, { key: '
|
|
203
|
+
return (h(Host, { key: '51133eafc1c4b8cb79845c3b36abeb933d92bd9d', style: style }, h("div", { key: 'cdd8fb1798088a7ea4e44ce921dcc652a455cc39', class: {
|
|
204
204
|
'sd-select': true,
|
|
205
205
|
'sd-select--open': this.isOpen,
|
|
206
206
|
'sd-select--disabled': this.disabled,
|
|
207
|
-
}, ref: el => (this.selectRef = el) }, this.renderLabel(this.label), h("div", { key: '
|
|
207
|
+
}, ref: el => (this.selectRef = el) }, this.renderLabel(this.label), h("div", { key: '6e09cfbbb0807cbeff40a7dfe0a9d037a31e58bf', class: "sd-select__container" }, this.renderTrigger(), this.renderDropdown()))));
|
|
208
208
|
}
|
|
209
209
|
renderLabel(label) {
|
|
210
210
|
if (!label)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sd-select.js","sourceRoot":"","sources":["../../../src/components/sd-select/sd-select.tsx"],"names":[],"mappings":"AAAA,OAAO,EACN,SAAS,EACT,KAAK,EAEL,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,CAAC,EACD,OAAO,EACP,KAAK,GACL,MAAM,eAAe,CAAC;AACvB,OA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,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACD;AAED,CAAC;IACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAiDE;AACH,CAAC","sourcesContent":["import {\n Component,\n Event,\n EventEmitter,\n Host,\n Prop,\n State,\n h,\n Element,\n Watch,\n} from '@stencil/core';\nimport { BaseDropdownEvent } from '../../utils/base-dropdown-event';\nimport { SelectKeyboardNavigation } from '../../utils/select-keyboard-navigation';\n\nexport interface SelectOption {\n value: string | number;\n label: string;\n disabled?: boolean;\n}\n\nexport type SelectGroupOptionType = 'group' | 'subgroup' | 'item';\n\nexport interface SelectOptionGroup extends SelectOption {\n type: SelectGroupOptionType;\n parent?: string;\n}\n\nexport interface SelectStyleProps {\n containerStyle?: { [key: string]: string };\n triggerStyle?: { [key: string]: string };\n dropdownStyle?: { [key: string]: string };\n optionStyle?: { [key: string]: string };\n labelStyle?: { [key: string]: string };\n}\n\nexport interface SelectEvents {\n sdChange: {\n value: string | number | null;\n option: SelectOption | null;\n };\n dropDownShow: { isOpen: boolean };\n}\n\nexport interface SelectMultipleEvents extends Pick<SelectEvents, 'dropDownShow' | 'dropDownShow'> {\n sdChange: SelectOption[] | null;\n}\n\n@Component({\n tag: 'sd-select',\n styleUrl: 'sd-select.scss',\n})\nexport class SdSelect extends BaseDropdownEvent {\n @Element() el!: HTMLElement;\n\n // props\n @Prop({ mutable: true }) value: string | number | null = null;\n @Prop() label: string = '';\n @Prop({ mutable: true }) options: SelectOption[] = [];\n @Prop() placeholder: string = '선택';\n @Prop() optionPlaceholder: string = '옵션이 없습니다.';\n @Prop() width: string = '200px';\n @Prop() dropdownHeight: string = '260px';\n @Prop() disabled: boolean = false;\n @Prop() clearable: boolean = false;\n @Prop() searchable: boolean = false;\n\n // props - custom slots\n @Prop() optionRenderer?: (option: SelectOption, index: number, isSelected: boolean) => any;\n\n // states\n @State() filteredOptions = this.options;\n @State() isOpen: boolean = false;\n @State() searchText: string | null = null;\n @State() itemIndex: number = -1;\n @State() isScrolled: boolean = false;\n\n // events\n @Event() sdChange?: EventEmitter<SelectEvents['sdChange']>;\n @Event() dropDownShow?: EventEmitter<SelectEvents['dropDownShow']>;\n\n private selectRef?: HTMLElement;\n private searchRef?: HTMLSdInputElement;\n private optionRef?: HTMLSdSelectOptionElement;\n private dropdownRef?: HTMLElement;\n\n @Watch('value')\n valueChanged() {\n const selectedOption = this.getSelectedOption();\n this.sdChange?.emit({ value: selectedOption?.value || null, option: selectedOption || null });\n }\n\n @Watch('options')\n optionsChanged() {\n this.filteredOptions = this.options;\n this.filterOptions();\n }\n\n @Watch('searchText')\n searchTextChanged() {\n this.filterOptions();\n }\n\n @Watch('itemIndex')\n async itemIndexChanged(newIndex: number, oldIndex: number) {\n if (this.searchable) {\n const searchInput = await this.getNativeInputElement();\n if (this.itemIndex === -1) {\n searchInput?.focus();\n return;\n } else if (searchInput?.matches(':focus')) {\n searchInput?.blur();\n }\n }\n\n const optionElements =\n this.dropdownRef?.querySelectorAll('.sd-select__dropdown sd-select-option') || [];\n const currentItem = optionElements?.[this.itemIndex];\n\n if (!currentItem || !this.isOpen) return;\n\n this.optionRef = currentItem as HTMLSdSelectOptionElement;\n const isOptionDisabled = await this.optionRef.isDisabled();\n\n if (isOptionDisabled) {\n newIndex > oldIndex ? this.itemIndex++ : this.itemIndex--;\n return;\n }\n\n this.scrollToOption(currentItem as HTMLElement);\n }\n\n componentWillLoad() {\n // props가 모두 설정된 후에 실행되므로 올바른 options 값을 가져올 수 있음\n this.filteredOptions = this.options;\n this.initializeEvent(); // global dropdown Manager에 등록 + 이벤트 핸들러 초기화\n }\n\n disconnectedCallback() {\n this.cleanupEvent(); // global dropdown Manager에서 제거 + 이벤트 정리\n }\n\n @Watch('isOpen')\n async isOpenChanged() {\n // Base class의 이벤트 관리 호출 - 다른 select와의 이벤트 충돌 방지\n this.onDropdownToggle(this.isOpen);\n\n const selectedOption = this.getSelectedOption();\n if (!selectedOption) {\n this.itemIndex = /* this.searchable ? */ -1 /* : 0 */;\n } else {\n this.itemIndex = this.options.indexOf(selectedOption);\n }\n\n this.dropDownShow?.emit({ isOpen: this.isOpen });\n\n if (this.isOpen === false) return;\n\n await new Promise(resolve => setTimeout(resolve, 10));\n\n const optionElements =\n this.dropdownRef?.querySelectorAll('.sd-select__dropdown sd-select-option') || [];\n\n const currentItem = optionElements?.[this.itemIndex];\n\n if (this.searchable) {\n const searchInput = await this.getNativeInputElement();\n searchInput?.focus();\n }\n\n if (!currentItem) return;\n\n await new Promise(resolve => setTimeout(resolve, 10));\n this.scrollToOption(currentItem as HTMLElement);\n }\n\n protected handleDocumentClick(event: Event): void {\n if (!this.selectRef?.contains(event.target as Node)) {\n this.isOpen = false;\n }\n }\n\n protected handleDocumentKeydown(keyboardEvent: KeyboardEvent): void {\n keyboardEvent.stopPropagation();\n const targetKey = ['ArrowDown', 'ArrowUp', 'Enter', 'Escape'];\n if (!targetKey.includes(keyboardEvent.key)) return;\n\n keyboardEvent.preventDefault();\n switch (keyboardEvent.key) {\n case 'ArrowDown':\n case 'ArrowUp':\n const keyboardNavigation = new SelectKeyboardNavigation(this.searchable, this.filteredOptions);\n const nextIndex = keyboardNavigation.getNextIndex(this.itemIndex, keyboardEvent.key);\n this.itemIndex = nextIndex;\n break;\n case 'Enter':\n const selectedOption = this.filteredOptions[this.itemIndex];\n if (selectedOption && !selectedOption.disabled) {\n this.value = selectedOption.value;\n this.searchText = null;\n this.isOpen = false;\n }\n break;\n case 'Escape':\n this.isOpen = false;\n break;\n }\n }\n\n // closeDropdown 메서드 구현 (Manager에서 호출됨)\n closeDropdown() {\n this.isOpen = false;\n }\n\n // event handlers\n handleTriggerClick = (event: Event) => {\n event.stopPropagation();\n\n if (!this.disabled) {\n this.isOpen = !this.isOpen;\n this.dropDownShow?.emit({ isOpen: this.isOpen });\n }\n };\n\n handleOptionClick = (detail: { option: SelectOption; event: Event }) => {\n const { option, event } = detail;\n event.stopPropagation();\n\n if (!option.disabled) {\n this.value = option.value;\n this.isOpen = false;\n }\n };\n\n private filterOptions() {\n if (!this.searchText || this.searchText.trim() === '') {\n // 검색어가 없으면 전체 옵션 표시\n this.filteredOptions = this.options;\n } else {\n // 검색어가 있으면 필터링\n this.filteredOptions = this.options.filter(option =>\n option.label.toLowerCase().includes(this.searchText!.toLowerCase()),\n );\n }\n }\n\n private getSelectedOption(): SelectOption | undefined {\n return this.options.find(option => option.value === this.value);\n }\n\n private handleDropdownScroll = (event: Event) => {\n const target = event.target as HTMLElement;\n const scrollTop = target.scrollTop;\n\n // 스크롤이 조금이라도 되면 그림자 표시\n this.isScrolled = scrollTop > 0;\n };\n\n private async getNativeInputElement(): Promise<HTMLInputElement | null> {\n if (this.searchRef) {\n return this.searchRef.getNativeElement();\n }\n return null;\n }\n\n private scrollToOption(optionElement: HTMLElement) {\n if (!this.dropdownRef || !optionElement) return;\n\n const dropdown = this.dropdownRef;\n const optionTop = optionElement.offsetTop;\n const optionHeight = optionElement.offsetHeight;\n const dropdownScrollTop = dropdown.scrollTop;\n const dropdownHeight = dropdown.clientHeight;\n\n const searchContainer = dropdown.querySelector('.sd-select__search-container');\n const searchOffset = searchContainer ? (searchContainer as HTMLElement).offsetHeight : 0;\n\n const visibleTop = dropdownScrollTop + searchOffset;\n const visibleBottom = dropdownScrollTop + dropdownHeight;\n\n if (optionTop < visibleTop) {\n dropdown.scrollTop = optionTop - searchOffset;\n } else if (optionTop + optionHeight > visibleBottom) {\n dropdown.scrollTop = optionTop + optionHeight - dropdownHeight + searchOffset;\n }\n }\n\n // render method\n render() {\n const style = {\n '--select-width': this.width || '200px',\n '--select-dropdown-height': this.dropdownHeight || '260px',\n };\n\n return (\n <Host style={style}>\n <div\n class={{\n 'sd-select': true,\n 'sd-select--open': this.isOpen,\n 'sd-select--disabled': this.disabled,\n }}\n ref={el => (this.selectRef = el)}\n >\n {this.renderLabel(this.label)}\n <div class=\"sd-select__container\">\n {this.renderTrigger()}\n {this.renderDropdown()}\n </div>\n </div>\n </Host>\n );\n }\n\n private renderLabel(label?: string) {\n if (!label) return null;\n\n return <label class=\"sd-select__label\">{label}</label>;\n }\n\n private renderTrigger() {\n const selectedOption = this.getSelectedOption();\n return (\n <div\n class=\"sd-select__trigger\"\n tabindex={this.disabled ? -1 : 0}\n onClick={this.handleTriggerClick}\n >\n <span class=\"sd-select__value\">{selectedOption ? selectedOption.label : this.placeholder}</span>\n {this.clearable && selectedOption && !this.disabled && (\n <sd-icon\n key=\"clear-icon\"\n name=\"close\"\n size={10}\n color=\"#888\"\n class=\"sd-select__clear\"\n onClick={event => {\n event.stopPropagation();\n this.value = null;\n }}\n ></sd-icon>\n )}\n\n <sd-icon\n key=\"arrow-icon\"\n name=\"arrowDown\"\n color=\"#888\"\n class={{ 'sd-select__arrow': true, 'sd-select__arrow--open': this.isOpen }}\n ></sd-icon>\n </div>\n );\n }\n\n private renderDropdown() {\n const style = {\n '--select-dropdown-width': this.width || '200px',\n '--select-dropdown-height': this.dropdownHeight || '260px',\n };\n if (this.isOpen === false) return null;\n\n return (\n <sd-portal open={this.isOpen} parentRef={this.selectRef} onSdClose={this.closeDropdown}>\n <div\n class=\"sd-select__dropdown\"\n style={style}\n onScroll={this.handleDropdownScroll}\n ref={el => (this.dropdownRef = el)}\n >\n {this.searchable && (\n <div\n class={{\n 'sd-select__search-container': true,\n 'sd-select__search-container--scrolled': this.isScrolled,\n }}\n onClick={event => event.stopPropagation()}\n >\n <sd-input\n ref={el => (this.searchRef = el)}\n value={this.searchText}\n placeholder=\"검색\"\n clearable\n inputStyle={{ 'padding-left': '8px' }}\n autofocus\n onSdInput={event => {\n this.searchText = String(event?.detail);\n }}\n onSdFocus={() => {\n this.itemIndex = -1;\n }}\n >\n <sd-icon\n name=\"search\"\n size={16}\n color=\"#737373\"\n style={{ marginRight: '4px' }}\n slot=\"prefix\"\n ></sd-icon>\n </sd-input>\n </div>\n )}\n {this.filteredOptions.length > 0 ? (\n this.filteredOptions.map((option, index) => (\n <slot name={`option-${option.value}`}>\n <sd-select-option\n option={option}\n index={index}\n isSelected={option.value === this.value}\n isFocused={index === this.itemIndex}\n onOptionClick={({ detail }) => this.handleOptionClick(detail)}\n ></sd-select-option>\n </slot>\n ))\n ) : (\n <slot name=\"option-placeholder\">\n <div class={'sd-select__option-placeholder'}>{this.optionPlaceholder}</div>\n </slot>\n )}\n </div>\n </sd-portal>\n );\n }\n}\n\n{\n /*\n <sd-select id=\"select-1\">\n <!-- <div slot=\"option-placeholder\">옵션이 없습니다.</div> -->\n </sd-select>\n <sd-select id=\"select-2\"> </sd-select>\n <sd-select id=\"select-3\" searchable clearable>\n <div slot=\"option-3\">test</div>\n </sd-select>\n\n <script>\n document.addEventListener('DOMContentLoaded', () => {\n const select1 = document.getElementById('select-1');\n const select2 = document.getElementById('select-2');\n const select3 = document.getElementById('select-3');\n const select = document.querySelector('sd-select slot[name=\"option-3\"]');\n select1.optionPlaceholder = 'No options available';\n\n const options = [\n { label: 'Option 1', value: '1' },\n { label: 'Option 2', value: '2' },\n { label: 'Option 3', value: '3', disabled: true },\n { label: 'Option 4', value: '4' },\n { label: 'Option 5', value: '5' },\n { label: 'Option 6', value: '6' },\n { label: 'Option 7', value: '7', disabled: true },\n { label: 'Option 8', value: '8' },\n { label: 'Option 9', value: '9' },\n { label: 'Option 10', value: '10' },\n { label: 'Option 11', value: '11', disabled: true },\n { label: 'Option 12', value: '12' },\n { label: 'Option 13', value: '13' },\n { label: 'Option 14', value: '14' },\n { label: 'Option 15', value: '15', disabled: true },\n { label: 'Option 16', value: '16' },\n { label: 'Option 17', value: '17' },\n { label: 'Option 18', value: '18' },\n { label: 'Option 19', value: '19', disabled: true },\n { label: 'Option 20', value: '20' },\n { label: 'Option 21', value: '21' },\n { label: 'Option 22', value: '22' },\n { label: 'Option 23', value: '23', disabled: true },\n { label: 'Option 24', value: '24' },\n ];\n\n select2.options = options;\n select3.options = options;\n });\n </script>\n\n */\n}\n"]}
|
|
1
|
+
{"version":3,"file":"sd-select.js","sourceRoot":"","sources":["../../../src/components/sd-select/sd-select.tsx"],"names":[],"mappings":"AAAA,OAAO,EACN,SAAS,EACT,KAAK,EAEL,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,CAAC,EACD,OAAO,EACP,KAAK,GACL,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAuClF,MAAM,OAAO,QAAS,SAAQ,iBAAiB;;;;IACnC,EAAE,CAAe;IAE5B,QAAQ;IACiB,KAAK,GAA2B,IAAI,CAAC;IACtD,KAAK,GAAW,EAAE,CAAC;IACF,OAAO,GAAmB,EAAE,CAAC;IAC9C,WAAW,GAAW,IAAI,CAAC;IAC3B,iBAAiB,GAAW,WAAW,CAAC;IACxC,KAAK,GAAW,OAAO,CAAC;IACxB,cAAc,GAAW,OAAO,CAAC;IACjC,QAAQ,GAAY,KAAK,CAAC;IAC1B,SAAS,GAAY,KAAK,CAAC;IAC3B,UAAU,GAAY,KAAK,CAAC;IAEpC,uBAAuB;IACf,cAAc,CAAqE;IAE3F,SAAS;IACA,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC;IAC/B,MAAM,GAAY,KAAK,CAAC;IACxB,UAAU,GAAkB,IAAI,CAAC;IACjC,SAAS,GAAW,CAAC,CAAC,CAAC;IACvB,UAAU,GAAY,KAAK,CAAC;IAErC,SAAS;IACA,Q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AE,EAAE,CAAC,CAC3C,YAAM,IAAI,EAAE,UAAU,MAAM,CAAC,KAAK,EAAE;oBACnC,wBACC,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,EAAE,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,GAC1C,CACd,CACP,CAAC,CACF,CAAC,CAAC,CAAC,CACH,YAAM,IAAI,EAAC,oBAAoB;oBAC9B,WAAK,KAAK,EAAE,+BAA+B,IAAG,IAAI,CAAC,iBAAiB,CAAO,CACrE,CACP,CACI,CACK,CACZ,CAAC;IACH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACD;AAED,CAAC;IACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAiDE;AACH,CAAC","sourcesContent":["import {\n Component,\n Event,\n EventEmitter,\n Host,\n Prop,\n State,\n h,\n Element,\n Watch,\n} from '@stencil/core';\nimport { BaseDropdownEvent } from '../../utils/base-dropdown-event';\nimport { SelectKeyboardNavigation } from '../../utils/select-keyboard-navigation';\n\nexport interface SelectOption {\n value: string | number;\n label: string;\n disabled?: boolean;\n}\n\nexport type SelectGroupOptionType = 'group' | 'subgroup' | 'item' | 'all';\n\nexport interface SelectOptionGroup extends SelectOption {\n type: SelectGroupOptionType;\n parent?: string;\n}\n\nexport interface SelectStyleProps {\n containerStyle?: { [key: string]: string };\n triggerStyle?: { [key: string]: string };\n dropdownStyle?: { [key: string]: string };\n optionStyle?: { [key: string]: string };\n labelStyle?: { [key: string]: string };\n}\n\nexport interface SelectEvents {\n sdChange: {\n value: string | number | null;\n option: SelectOption | null;\n };\n dropDownShow: { isOpen: boolean };\n}\n\nexport interface SelectMultipleEvents extends Pick<SelectEvents, 'dropDownShow' | 'dropDownShow'> {\n sdChange: SelectOption[] | null;\n}\n\n@Component({\n tag: 'sd-select',\n styleUrl: 'sd-select.scss',\n})\nexport class SdSelect extends BaseDropdownEvent {\n @Element() el!: HTMLElement;\n\n // props\n @Prop({ mutable: true }) value: string | number | null = null;\n @Prop() label: string = '';\n @Prop({ mutable: true }) options: SelectOption[] = [];\n @Prop() placeholder: string = '선택';\n @Prop() optionPlaceholder: string = '옵션이 없습니다.';\n @Prop() width: string = '200px';\n @Prop() dropdownHeight: string = '260px';\n @Prop() disabled: boolean = false;\n @Prop() clearable: boolean = false;\n @Prop() searchable: boolean = false;\n\n // props - custom slots\n @Prop() optionRenderer?: (option: SelectOption, index: number, isSelected: boolean) => any;\n\n // states\n @State() filteredOptions = this.options;\n @State() isOpen: boolean = false;\n @State() searchText: string | null = null;\n @State() itemIndex: number = -1;\n @State() isScrolled: boolean = false;\n\n // events\n @Event() sdChange?: EventEmitter<SelectEvents['sdChange']>;\n @Event() dropDownShow?: EventEmitter<SelectEvents['dropDownShow']>;\n\n private selectRef?: HTMLElement;\n private searchRef?: HTMLSdInputElement;\n private optionRef?: HTMLSdSelectOptionElement;\n private dropdownRef?: HTMLElement;\n\n @Watch('value')\n valueChanged() {\n const selectedOption = this.getSelectedOption();\n this.sdChange?.emit({ value: selectedOption?.value || null, option: selectedOption || null });\n }\n\n @Watch('options')\n optionsChanged() {\n this.filteredOptions = this.options;\n this.filterOptions();\n }\n\n @Watch('searchText')\n searchTextChanged() {\n this.filterOptions();\n }\n\n @Watch('itemIndex')\n async itemIndexChanged(newIndex: number, oldIndex: number) {\n if (this.searchable) {\n const searchInput = await this.getNativeInputElement();\n if (this.itemIndex === -1) {\n searchInput?.focus();\n return;\n } else if (searchInput?.matches(':focus')) {\n searchInput?.blur();\n }\n }\n\n const optionElements =\n this.dropdownRef?.querySelectorAll('.sd-select__dropdown sd-select-option') || [];\n const currentItem = optionElements?.[this.itemIndex];\n\n if (!currentItem || !this.isOpen) return;\n\n this.optionRef = currentItem as HTMLSdSelectOptionElement;\n const isOptionDisabled = await this.optionRef.isDisabled();\n\n if (isOptionDisabled) {\n newIndex > oldIndex ? this.itemIndex++ : this.itemIndex--;\n return;\n }\n\n this.scrollToOption(currentItem as HTMLElement);\n }\n\n componentWillLoad() {\n // props가 모두 설정된 후에 실행되므로 올바른 options 값을 가져올 수 있음\n this.filteredOptions = this.options;\n this.initializeEvent(); // global dropdown Manager에 등록 + 이벤트 핸들러 초기화\n }\n\n disconnectedCallback() {\n this.cleanupEvent(); // global dropdown Manager에서 제거 + 이벤트 정리\n }\n\n @Watch('isOpen')\n async isOpenChanged() {\n // Base class의 이벤트 관리 호출 - 다른 select와의 이벤트 충돌 방지\n this.onDropdownToggle(this.isOpen);\n\n const selectedOption = this.getSelectedOption();\n if (!selectedOption) {\n this.itemIndex = /* this.searchable ? */ -1 /* : 0 */;\n } else {\n this.itemIndex = this.options.indexOf(selectedOption);\n }\n\n this.dropDownShow?.emit({ isOpen: this.isOpen });\n\n if (this.isOpen === false) return;\n\n await new Promise(resolve => setTimeout(resolve, 10));\n\n const optionElements =\n this.dropdownRef?.querySelectorAll('.sd-select__dropdown sd-select-option') || [];\n\n const currentItem = optionElements?.[this.itemIndex];\n\n if (this.searchable) {\n const searchInput = await this.getNativeInputElement();\n searchInput?.focus();\n }\n\n if (!currentItem) return;\n\n await new Promise(resolve => setTimeout(resolve, 10));\n this.scrollToOption(currentItem as HTMLElement);\n }\n\n protected handleDocumentClick(event: Event): void {\n if (!this.selectRef?.contains(event.target as Node)) {\n this.isOpen = false;\n }\n }\n\n protected handleDocumentKeydown(keyboardEvent: KeyboardEvent): void {\n keyboardEvent.stopPropagation();\n const targetKey = ['ArrowDown', 'ArrowUp', 'Enter', 'Escape'];\n if (!targetKey.includes(keyboardEvent.key)) return;\n\n keyboardEvent.preventDefault();\n switch (keyboardEvent.key) {\n case 'ArrowDown':\n case 'ArrowUp':\n const keyboardNavigation = new SelectKeyboardNavigation(this.searchable, this.filteredOptions);\n const nextIndex = keyboardNavigation.getNextIndex(this.itemIndex, keyboardEvent.key);\n this.itemIndex = nextIndex;\n break;\n case 'Enter':\n const selectedOption = this.filteredOptions[this.itemIndex];\n if (selectedOption && !selectedOption.disabled) {\n this.value = selectedOption.value;\n this.searchText = null;\n this.isOpen = false;\n }\n break;\n case 'Escape':\n this.isOpen = false;\n break;\n }\n }\n\n // closeDropdown 메서드 구현 (Manager에서 호출됨)\n closeDropdown() {\n this.isOpen = false;\n }\n\n // event handlers\n handleTriggerClick = (event: Event) => {\n event.stopPropagation();\n\n if (!this.disabled) {\n this.isOpen = !this.isOpen;\n this.dropDownShow?.emit({ isOpen: this.isOpen });\n }\n };\n\n handleOptionClick = (detail: { option: SelectOption; event: Event }) => {\n const { option, event } = detail;\n event.stopPropagation();\n\n if (!option.disabled) {\n this.value = option.value;\n this.isOpen = false;\n }\n };\n\n private filterOptions() {\n if (!this.searchText || this.searchText.trim() === '') {\n // 검색어가 없으면 전체 옵션 표시\n this.filteredOptions = this.options;\n } else {\n // 검색어가 있으면 필터링\n this.filteredOptions = this.options.filter(option =>\n option.label.toLowerCase().includes(this.searchText!.toLowerCase()),\n );\n }\n }\n\n private getSelectedOption(): SelectOption | undefined {\n return this.options.find(option => option.value === this.value);\n }\n\n private handleDropdownScroll = (event: Event) => {\n const target = event.target as HTMLElement;\n const scrollTop = target.scrollTop;\n\n // 스크롤이 조금이라도 되면 그림자 표시\n this.isScrolled = scrollTop > 0;\n };\n\n private async getNativeInputElement(): Promise<HTMLInputElement | null> {\n if (this.searchRef) {\n return this.searchRef.getNativeElement();\n }\n return null;\n }\n\n private scrollToOption(optionElement: HTMLElement) {\n if (!this.dropdownRef || !optionElement) return;\n\n const dropdown = this.dropdownRef;\n const optionTop = optionElement.offsetTop;\n const optionHeight = optionElement.offsetHeight;\n const dropdownScrollTop = dropdown.scrollTop;\n const dropdownHeight = dropdown.clientHeight;\n\n const searchContainer = dropdown.querySelector('.sd-select__search-container');\n const searchOffset = searchContainer ? (searchContainer as HTMLElement).offsetHeight : 0;\n\n const visibleTop = dropdownScrollTop + searchOffset;\n const visibleBottom = dropdownScrollTop + dropdownHeight;\n\n if (optionTop < visibleTop) {\n dropdown.scrollTop = optionTop - searchOffset;\n } else if (optionTop + optionHeight > visibleBottom) {\n dropdown.scrollTop = optionTop + optionHeight - dropdownHeight + searchOffset;\n }\n }\n\n // render method\n render() {\n const style = {\n '--select-width': this.width || '200px',\n '--select-dropdown-height': this.dropdownHeight || '260px',\n };\n\n return (\n <Host style={style}>\n <div\n class={{\n 'sd-select': true,\n 'sd-select--open': this.isOpen,\n 'sd-select--disabled': this.disabled,\n }}\n ref={el => (this.selectRef = el)}\n >\n {this.renderLabel(this.label)}\n <div class=\"sd-select__container\">\n {this.renderTrigger()}\n {this.renderDropdown()}\n </div>\n </div>\n </Host>\n );\n }\n\n private renderLabel(label?: string) {\n if (!label) return null;\n\n return <label class=\"sd-select__label\">{label}</label>;\n }\n\n private renderTrigger() {\n const selectedOption = this.getSelectedOption();\n return (\n <div\n class=\"sd-select__trigger\"\n tabindex={this.disabled ? -1 : 0}\n onClick={this.handleTriggerClick}\n >\n <span class=\"sd-select__value\">{selectedOption ? selectedOption.label : this.placeholder}</span>\n {this.clearable && selectedOption && !this.disabled && (\n <sd-icon\n key=\"clear-icon\"\n name=\"close\"\n size={10}\n color=\"#888\"\n class=\"sd-select__clear\"\n onClick={event => {\n event.stopPropagation();\n this.value = null;\n }}\n ></sd-icon>\n )}\n\n <sd-icon\n key=\"arrow-icon\"\n name=\"arrowDown\"\n color=\"#888\"\n class={{ 'sd-select__arrow': true, 'sd-select__arrow--open': this.isOpen }}\n ></sd-icon>\n </div>\n );\n }\n\n private renderDropdown() {\n const style = {\n '--select-dropdown-width': this.width || '200px',\n '--select-dropdown-height': this.dropdownHeight || '260px',\n };\n if (this.isOpen === false) return null;\n\n return (\n <sd-portal open={this.isOpen} parentRef={this.selectRef} onSdClose={this.closeDropdown}>\n <div\n class=\"sd-select__dropdown\"\n style={style}\n onScroll={this.handleDropdownScroll}\n ref={el => (this.dropdownRef = el)}\n >\n {this.searchable && (\n <div\n class={{\n 'sd-select__search-container': true,\n 'sd-select__search-container--scrolled': this.isScrolled,\n }}\n onClick={event => event.stopPropagation()}\n >\n <sd-input\n ref={el => (this.searchRef = el)}\n value={this.searchText}\n placeholder=\"검색\"\n clearable\n inputStyle={{ 'padding-left': '8px' }}\n autofocus\n onSdInput={event => {\n this.searchText = String(event?.detail);\n }}\n onSdFocus={() => {\n this.itemIndex = -1;\n }}\n >\n <sd-icon\n name=\"search\"\n size={16}\n color=\"#737373\"\n style={{ marginRight: '4px' }}\n slot=\"prefix\"\n ></sd-icon>\n </sd-input>\n </div>\n )}\n {this.filteredOptions.length > 0 ? (\n this.filteredOptions.map((option, index) => (\n <slot name={`option-${option.value}`}>\n <sd-select-option\n option={option}\n index={index}\n isSelected={option.value === this.value}\n isFocused={index === this.itemIndex}\n onOptionClick={({ detail }) => this.handleOptionClick(detail)}\n ></sd-select-option>\n </slot>\n ))\n ) : (\n <slot name=\"option-placeholder\">\n <div class={'sd-select__option-placeholder'}>{this.optionPlaceholder}</div>\n </slot>\n )}\n </div>\n </sd-portal>\n );\n }\n}\n\n{\n /*\n <sd-select id=\"select-1\">\n <!-- <div slot=\"option-placeholder\">옵션이 없습니다.</div> -->\n </sd-select>\n <sd-select id=\"select-2\"> </sd-select>\n <sd-select id=\"select-3\" searchable clearable>\n <div slot=\"option-3\">test</div>\n </sd-select>\n\n <script>\n document.addEventListener('DOMContentLoaded', () => {\n const select1 = document.getElementById('select-1');\n const select2 = document.getElementById('select-2');\n const select3 = document.getElementById('select-3');\n const select = document.querySelector('sd-select slot[name=\"option-3\"]');\n select1.optionPlaceholder = 'No options available';\n\n const options = [\n { label: 'Option 1', value: '1' },\n { label: 'Option 2', value: '2' },\n { label: 'Option 3', value: '3', disabled: true },\n { label: 'Option 4', value: '4' },\n { label: 'Option 5', value: '5' },\n { label: 'Option 6', value: '6' },\n { label: 'Option 7', value: '7', disabled: true },\n { label: 'Option 8', value: '8' },\n { label: 'Option 9', value: '9' },\n { label: 'Option 10', value: '10' },\n { label: 'Option 11', value: '11', disabled: true },\n { label: 'Option 12', value: '12' },\n { label: 'Option 13', value: '13' },\n { label: 'Option 14', value: '14' },\n { label: 'Option 15', value: '15', disabled: true },\n { label: 'Option 16', value: '16' },\n { label: 'Option 17', value: '17' },\n { label: 'Option 18', value: '18' },\n { label: 'Option 19', value: '19', disabled: true },\n { label: 'Option 20', value: '20' },\n { label: 'Option 21', value: '21' },\n { label: 'Option 22', value: '22' },\n { label: 'Option 23', value: '23', disabled: true },\n { label: 'Option 24', value: '24' },\n ];\n\n select2.options = options;\n select3.options = options;\n });\n </script>\n\n */\n}\n"]}
|
|
@@ -208,11 +208,11 @@ export class SdSelectMultiple extends BaseDropdownEvent {
|
|
|
208
208
|
'--select-width': this.width || '200px',
|
|
209
209
|
'--select-dropdown-height': this.dropdownHeight || '260px',
|
|
210
210
|
};
|
|
211
|
-
return (h(Host, { key: '
|
|
211
|
+
return (h(Host, { key: 'c569bb885003048b6ec22bfb0688c671a70a27d5', style: style }, h("div", { key: '94b43199502f44f7d663981c320696c6e8cf968f', class: {
|
|
212
212
|
'sd-select-multiple': true,
|
|
213
213
|
'sd-select-multiple--open': this.isOpen,
|
|
214
214
|
'sd-select-multiple--disabled': this.disabled,
|
|
215
|
-
}, ref: el => (this.selectRef = el) }, this.renderLabel(this.label), h("div", { key: '
|
|
215
|
+
}, ref: el => (this.selectRef = el) }, this.renderLabel(this.label), h("div", { key: 'd4fd6929b78add118c01d7b52c1c1e0be9867924', class: "sd-select-multiple__container" }, this.renderTrigger(), this.renderDropdown()))));
|
|
216
216
|
}
|
|
217
217
|
renderLabel(label) {
|
|
218
218
|
if (!label)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Host, h, } from "@stencil/core";
|
|
1
|
+
import { Fragment, Host, h, } from "@stencil/core";
|
|
2
2
|
import { BaseDropdownEvent } from "../../utils/base-dropdown-event";
|
|
3
3
|
import { SelectKeyboardNavigation } from "../../utils/select-keyboard-navigation";
|
|
4
4
|
export class SdSelectMultipleGroup extends BaseDropdownEvent {
|
|
@@ -18,6 +18,7 @@ export class SdSelectMultipleGroup extends BaseDropdownEvent {
|
|
|
18
18
|
clearable = false;
|
|
19
19
|
searchable = false;
|
|
20
20
|
useCheckbox = false;
|
|
21
|
+
useAll = false;
|
|
21
22
|
// props - custom styles
|
|
22
23
|
containerStyle = {};
|
|
23
24
|
triggerStyle = {};
|
|
@@ -143,6 +144,16 @@ export class SdSelectMultipleGroup extends BaseDropdownEvent {
|
|
|
143
144
|
this.dropDownShow?.emit({ isOpen: this.isOpen });
|
|
144
145
|
}
|
|
145
146
|
};
|
|
147
|
+
handleAllOptionClick = (detail) => {
|
|
148
|
+
if (detail.isSelected) {
|
|
149
|
+
// 이미 선택된 옵션인 경우, 선택 해제
|
|
150
|
+
this.value = [];
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
// 새로운 옵션 선택
|
|
154
|
+
this.value = [...this.filteredOptions.filter(opt => opt.type === 'item' && !opt.disabled)];
|
|
155
|
+
}
|
|
156
|
+
};
|
|
146
157
|
handleOptionClick = (detail) => {
|
|
147
158
|
const { option, event } = detail;
|
|
148
159
|
event.stopPropagation();
|
|
@@ -281,6 +292,19 @@ export class SdSelectMultipleGroup extends BaseDropdownEvent {
|
|
|
281
292
|
totalCount: children.length,
|
|
282
293
|
};
|
|
283
294
|
}
|
|
295
|
+
isAllOptionsSelected() {
|
|
296
|
+
const selectedOption = this.getSelectedOption();
|
|
297
|
+
return (selectedOption.length === this.options.filter(opt => !opt.disabled && opt.type === 'item').length);
|
|
298
|
+
}
|
|
299
|
+
getTriggerLabel() {
|
|
300
|
+
const selectedOption = this.getSelectedOption();
|
|
301
|
+
if (!selectedOption)
|
|
302
|
+
return '선택';
|
|
303
|
+
if (selectedOption.length === 0)
|
|
304
|
+
return this.placeholder;
|
|
305
|
+
const isAllChecked = this.isAllOptionsSelected();
|
|
306
|
+
return isAllChecked ? '전체' : selectedOption.map(option => option.label).join(', ');
|
|
307
|
+
}
|
|
284
308
|
closeDropdown() {
|
|
285
309
|
this.isOpen = false;
|
|
286
310
|
}
|
|
@@ -308,11 +332,11 @@ export class SdSelectMultipleGroup extends BaseDropdownEvent {
|
|
|
308
332
|
'--select-width': this.width || '200px',
|
|
309
333
|
'--select-dropdown-height': this.dropdownHeight || '260px',
|
|
310
334
|
};
|
|
311
|
-
return (h(Host, { key: '
|
|
335
|
+
return (h(Host, { key: '825a5e69af88a908c41c0c82bfb5fed4afeb9f5f', style: style }, h("div", { key: '81827e04db3de7194162594db4d918b37e7bd3a2', class: {
|
|
312
336
|
'sd-select-multiple-group': true,
|
|
313
337
|
'sd-select-multiple-group--open': this.isOpen,
|
|
314
338
|
'sd-select-multiple-group--disabled': this.disabled,
|
|
315
|
-
}, style: this.containerStyle, ref: el => (this.selectRef = el) }, this.renderLabel(this.label, this.labelStyle), h("div", { key: '
|
|
339
|
+
}, style: this.containerStyle, ref: el => (this.selectRef = el) }, this.renderLabel(this.label, this.labelStyle), h("div", { key: '23be24a0f971270b3e449cad4f56699f65716fb0', class: "sd-select-multiple-group__container" }, this.renderTrigger(), this.renderDropdown()))));
|
|
316
340
|
}
|
|
317
341
|
renderLabel(label, labelStyle) {
|
|
318
342
|
if (!label)
|
|
@@ -321,11 +345,7 @@ export class SdSelectMultipleGroup extends BaseDropdownEvent {
|
|
|
321
345
|
}
|
|
322
346
|
renderTrigger() {
|
|
323
347
|
const selectedOption = this.getSelectedOption();
|
|
324
|
-
return (h("div", { class: "sd-select-multiple-group__trigger", tabindex: this.disabled ? -1 : 0, onClick: this.handleTriggerClick, style: this.triggerStyle }, h("span", { class: "sd-select-multiple-group__value" }, !
|
|
325
|
-
? '선택'
|
|
326
|
-
: selectedOption.length
|
|
327
|
-
? selectedOption.map(option => option.label).join(', ')
|
|
328
|
-
: this.placeholder), this.clearable && selectedOption?.length > 0 && !this.disabled && (h("sd-icon", { key: "close-icon", name: "close", size: 10, color: "#888", class: "sd-select-multiple-group__clear", onClick: event => {
|
|
348
|
+
return (h("div", { class: "sd-select-multiple-group__trigger", tabindex: this.disabled ? -1 : 0, onClick: this.handleTriggerClick, style: this.triggerStyle }, h("span", { class: "sd-select-multiple-group__value" }, this.getTriggerLabel()), this.clearable && selectedOption?.length > 0 && !this.disabled && (h("sd-icon", { key: "close-icon", name: "close", size: 10, color: "#888", class: "sd-select-multiple-group__clear", onClick: event => {
|
|
329
349
|
event.stopPropagation();
|
|
330
350
|
this.value = null;
|
|
331
351
|
} })), h("sd-icon", { key: "arrow-icon", name: "arrowDown", color: "#888", class: {
|
|
@@ -350,14 +370,15 @@ export class SdSelectMultipleGroup extends BaseDropdownEvent {
|
|
|
350
370
|
}, onKeyDown: e => {
|
|
351
371
|
if (e.code === 'Enter')
|
|
352
372
|
e.stopPropagation();
|
|
353
|
-
} }, h("sd-icon", { name: "search", size: 16, color: "#737373", slot: "prefix" })))), this.filteredOptions.length > 0 ? (
|
|
373
|
+
} }, h("sd-icon", { name: "search", size: 16, color: "#737373", slot: "prefix" })))), this.filteredOptions.length > 0 ? (h(Fragment, null, this.useAll && (h("sd-select-option-group", { option: { label: '전체 선택', value: 'all', type: 'all' }, index: 0, isSelected: this.value?.length ===
|
|
374
|
+
this.options.filter(opt => !opt.disabled && opt.type === 'item').length, isFocused: this.itemIndex === 0, optionStyle: this.optionStyle, onOptionClick: ({ detail, }) => this.handleAllOptionClick(detail), useCheckbox: this.useCheckbox, useIndicator: false })), this.filteredOptions.map((option, index) => (h("slot", { name: `option-${option.value}` }, h("sd-select-option-group", { option: option, index: index, isSelected: option.type === 'item'
|
|
354
375
|
? this.value?.some(selected => selected.value === option.value)
|
|
355
376
|
: this.isAllChildrenSelected(option), isFocused: index === this.itemIndex, optionStyle: this.optionStyle, onOptionClick: ({ detail, }) => {
|
|
356
377
|
if (option.type !== 'item' && !this.useCheckbox) {
|
|
357
378
|
return;
|
|
358
379
|
}
|
|
359
380
|
this.handleOptionClick(detail);
|
|
360
|
-
}, useCheckbox: this.useCheckbox, ...(option.type !== 'item' && { countInfo: this.getChildrenOptions(option) }) }))))) : (h("slot", { name: "option-placeholder" }, h("div", { class: 'sd-select-multiple-group__option-placeholder', style: this.optionStyle }, this.optionPlaceholder))))));
|
|
381
|
+
}, useCheckbox: this.useCheckbox, ...(option.type !== 'item' && { countInfo: this.getChildrenOptions(option) }) })))))) : (h("slot", { name: "option-placeholder" }, h("div", { class: 'sd-select-multiple-group__option-placeholder', style: this.optionStyle }, this.optionPlaceholder))))));
|
|
361
382
|
}
|
|
362
383
|
static get is() { return "sd-select-multiple-group"; }
|
|
363
384
|
static get originalStyleUrls() {
|
|
@@ -600,6 +621,26 @@ export class SdSelectMultipleGroup extends BaseDropdownEvent {
|
|
|
600
621
|
"attribute": "use-checkbox",
|
|
601
622
|
"defaultValue": "false"
|
|
602
623
|
},
|
|
624
|
+
"useAll": {
|
|
625
|
+
"type": "boolean",
|
|
626
|
+
"mutable": false,
|
|
627
|
+
"complexType": {
|
|
628
|
+
"original": "boolean",
|
|
629
|
+
"resolved": "boolean",
|
|
630
|
+
"references": {}
|
|
631
|
+
},
|
|
632
|
+
"required": false,
|
|
633
|
+
"optional": false,
|
|
634
|
+
"docs": {
|
|
635
|
+
"tags": [],
|
|
636
|
+
"text": ""
|
|
637
|
+
},
|
|
638
|
+
"getter": false,
|
|
639
|
+
"setter": false,
|
|
640
|
+
"reflect": false,
|
|
641
|
+
"attribute": "use-all",
|
|
642
|
+
"defaultValue": "false"
|
|
643
|
+
},
|
|
603
644
|
"containerStyle": {
|
|
604
645
|
"type": "unknown",
|
|
605
646
|
"mutable": false,
|