quasar-ui-sellmate-ui-kit 3.2.4 → 3.2.5
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/index.common.js +2 -2
- package/dist/index.css +1 -1
- package/dist/index.esm.js +2 -2
- package/dist/index.min.css +1 -1
- package/dist/index.rtl.css +1 -1
- package/dist/index.rtl.min.css +1 -1
- package/dist/index.umd.js +146 -146
- package/dist/index.umd.min.js +2 -2
- package/package.json +1 -1
- package/src/components/SSelectSearchCheckbox.vue +226 -238
package/package.json
CHANGED
|
@@ -11,9 +11,7 @@
|
|
|
11
11
|
map-options
|
|
12
12
|
autocomplete="country"
|
|
13
13
|
color="positive"
|
|
14
|
-
:popup-content-class="
|
|
15
|
-
['s-select-checkbox-opts', popupContentClass].join(' ')
|
|
16
|
-
"
|
|
14
|
+
:popup-content-class="['s-select-checkbox-opts', popupContentClass].join(' ')"
|
|
17
15
|
class="s-select-checkbox"
|
|
18
16
|
:option-label="optionLabel"
|
|
19
17
|
:option-value="optionValue"
|
|
@@ -28,7 +26,7 @@
|
|
|
28
26
|
ref="sSelectRef"
|
|
29
27
|
>
|
|
30
28
|
<!-- TODO: 아무것도 선택되지 않았을 때 props 값으로 표기 해줘야함 기본 값은 "전체" -->
|
|
31
|
-
<template
|
|
29
|
+
<template #before-options>
|
|
32
30
|
<div class="search-input-form-container">
|
|
33
31
|
<form class="select-search-input-form">
|
|
34
32
|
<q-icon :name="searchIcon" size="20px" />
|
|
@@ -38,7 +36,7 @@
|
|
|
38
36
|
class="select-search-input"
|
|
39
37
|
:placeholder="searchPlaceholder"
|
|
40
38
|
@input="
|
|
41
|
-
|
|
39
|
+
data => {
|
|
42
40
|
onSearch(data.target.value);
|
|
43
41
|
}
|
|
44
42
|
"
|
|
@@ -46,36 +44,28 @@
|
|
|
46
44
|
</form>
|
|
47
45
|
</div>
|
|
48
46
|
</template>
|
|
49
|
-
<template
|
|
47
|
+
<template #option="{ itemProps, opt, selected, toggleOption }">
|
|
50
48
|
<q-item v-bind="itemProps" class="custom-select-options">
|
|
51
49
|
<q-item-section side v-if="!opt.disable">
|
|
52
|
-
<s-checkbox
|
|
53
|
-
:modelValue="selected"
|
|
54
|
-
@update:modelValue="toggleOption(opt)"
|
|
55
|
-
/>
|
|
50
|
+
<s-checkbox :modelValue="selected" @update:modelValue="toggleOption(opt)" />
|
|
56
51
|
</q-item-section>
|
|
57
52
|
<q-item-section v-if="opt[optionGroup]" class="text-Grey_Darken-4">
|
|
58
53
|
{{ opt[optionGroup] }}
|
|
59
54
|
</q-item-section>
|
|
60
55
|
<q-item-section avatar v-if="opt.logo">
|
|
61
|
-
<q-img
|
|
62
|
-
class="q-pa-none bg-Grey_Lighten-5"
|
|
63
|
-
:src="opt.logo"
|
|
64
|
-
width="60px"
|
|
65
|
-
height="22px"
|
|
66
|
-
/>
|
|
56
|
+
<q-img class="q-pa-none bg-Grey_Lighten-5" :src="opt.logo" width="60px" height="22px" />
|
|
67
57
|
</q-item-section>
|
|
68
58
|
<q-item-section>
|
|
69
59
|
{{ opt[optionLabel] }}
|
|
70
60
|
</q-item-section>
|
|
71
61
|
</q-item>
|
|
72
62
|
</template>
|
|
73
|
-
<template v-if="useAll && model[0] === ''"
|
|
63
|
+
<template v-if="useAll && (model[0] === '' || model.includes(''))" #selected>
|
|
74
64
|
<div>
|
|
75
65
|
{{ placeholder }}
|
|
76
66
|
</div>
|
|
77
67
|
</template>
|
|
78
|
-
<template
|
|
68
|
+
<template #no-option>
|
|
79
69
|
<div class="search-input-form-container">
|
|
80
70
|
<form class="select-search-input-form">
|
|
81
71
|
<q-icon :name="searchIcon" size="20px" />
|
|
@@ -85,7 +75,7 @@
|
|
|
85
75
|
class="select-search-input"
|
|
86
76
|
:placeholder="searchPlaceholder"
|
|
87
77
|
@input="
|
|
88
|
-
|
|
78
|
+
data => {
|
|
89
79
|
onSearch(data.target.value);
|
|
90
80
|
}
|
|
91
81
|
"
|
|
@@ -100,257 +90,255 @@
|
|
|
100
90
|
</template>
|
|
101
91
|
|
|
102
92
|
<script>
|
|
103
|
-
import {
|
|
104
|
-
|
|
105
|
-
} from '
|
|
106
|
-
import {
|
|
107
|
-
defineComponent, nextTick, onBeforeMount, ref, watch,
|
|
108
|
-
} from 'vue';
|
|
109
|
-
import { searchIcon, selectDownArrowIcon } from '../assets/icons';
|
|
93
|
+
import { QIcon, QImg, QItem, QItemSection, QSelect, debounce } from 'quasar';
|
|
94
|
+
import { defineComponent, nextTick, onBeforeMount, ref, watch } from 'vue';
|
|
95
|
+
import { searchIcon, selectDownArrowIcon } from '../assets/icons';
|
|
110
96
|
|
|
111
|
-
export default defineComponent({
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
// QInput,
|
|
121
|
-
},
|
|
122
|
-
props: {
|
|
123
|
-
searchPlaceholder: { type: String, default: '검색' },
|
|
124
|
-
options: {
|
|
125
|
-
type: Array,
|
|
126
|
-
required: true,
|
|
127
|
-
},
|
|
128
|
-
modelValue: {
|
|
129
|
-
type: Array,
|
|
130
|
-
required: true,
|
|
131
|
-
},
|
|
132
|
-
optionLabel: {
|
|
133
|
-
type: [String, Function],
|
|
134
|
-
default: 'label',
|
|
135
|
-
},
|
|
136
|
-
optionValue: {
|
|
137
|
-
type: String,
|
|
138
|
-
default: 'value',
|
|
139
|
-
},
|
|
140
|
-
optionGroup: {
|
|
141
|
-
type: String,
|
|
142
|
-
default: 'group',
|
|
143
|
-
},
|
|
144
|
-
useAll: {
|
|
145
|
-
type: Boolean,
|
|
146
|
-
default: false,
|
|
147
|
-
},
|
|
148
|
-
placeholder: {
|
|
149
|
-
type: String,
|
|
150
|
-
default: '전체',
|
|
97
|
+
export default defineComponent({
|
|
98
|
+
name: 'SSelectSearchCheckbox',
|
|
99
|
+
emits: ['update:modelValue'],
|
|
100
|
+
components: {
|
|
101
|
+
QSelect,
|
|
102
|
+
QItem,
|
|
103
|
+
QItemSection,
|
|
104
|
+
QImg,
|
|
105
|
+
QIcon,
|
|
151
106
|
},
|
|
152
|
-
|
|
153
|
-
type: String,
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
107
|
+
props: {
|
|
108
|
+
searchPlaceholder: { type: String, default: '검색' },
|
|
109
|
+
options: {
|
|
110
|
+
type: Array,
|
|
111
|
+
required: true,
|
|
112
|
+
},
|
|
113
|
+
modelValue: {
|
|
114
|
+
type: Array,
|
|
115
|
+
required: true,
|
|
116
|
+
},
|
|
117
|
+
optionLabel: {
|
|
118
|
+
type: [String, Function],
|
|
119
|
+
default: 'label',
|
|
120
|
+
},
|
|
121
|
+
optionValue: {
|
|
122
|
+
type: String,
|
|
123
|
+
default: 'value',
|
|
124
|
+
},
|
|
125
|
+
optionGroup: {
|
|
126
|
+
type: String,
|
|
127
|
+
default: 'group',
|
|
128
|
+
},
|
|
129
|
+
useAll: {
|
|
130
|
+
type: Boolean,
|
|
131
|
+
default: false,
|
|
132
|
+
},
|
|
133
|
+
placeholder: {
|
|
134
|
+
type: String,
|
|
135
|
+
default: '전체',
|
|
136
|
+
},
|
|
137
|
+
checkboxSearch: {
|
|
138
|
+
type: String,
|
|
139
|
+
default: '',
|
|
140
|
+
},
|
|
141
|
+
noData: {
|
|
142
|
+
type: String,
|
|
143
|
+
default: '데이터 없음',
|
|
144
|
+
},
|
|
145
|
+
popupContentClass: {
|
|
146
|
+
type: String,
|
|
147
|
+
},
|
|
162
148
|
},
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
const isDisable = props.options.find((v) => Boolean(v.disable));
|
|
149
|
+
setup(props, { emit }) {
|
|
150
|
+
const model = ref(props.modelValue);
|
|
151
|
+
const filteredOptions = ref(props.options);
|
|
152
|
+
const searchInput = ref(null);
|
|
153
|
+
const search = ref('');
|
|
154
|
+
const isDisable = props.options.find(v => Boolean(v.disable));
|
|
170
155
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
}
|
|
183
|
-
function onAddChecked(detail) {
|
|
184
|
-
if (detail[props.optionValue] === '') {
|
|
185
|
-
nextTick(() => {
|
|
186
|
-
model.value = props.options
|
|
187
|
-
.filter((v) => !v.category)
|
|
188
|
-
.map((option) => option[props.optionValue]);
|
|
189
|
-
});
|
|
190
|
-
} else {
|
|
191
|
-
nextTick(() => {
|
|
192
|
-
if (model.value.length === props.options.length - 1) {
|
|
193
|
-
model.value = props.options
|
|
194
|
-
.filter((v) => !v.category)
|
|
195
|
-
.map((option) => option[props.optionValue]);
|
|
196
|
-
}
|
|
197
|
-
});
|
|
156
|
+
function onRemoveChecked(detail) {
|
|
157
|
+
const idx = model.value.findIndex(v => v === '');
|
|
158
|
+
if (detail[props.optionValue] === '') {
|
|
159
|
+
nextTick(() => {
|
|
160
|
+
model.value = [];
|
|
161
|
+
});
|
|
162
|
+
} else if (idx >= 0) {
|
|
163
|
+
nextTick(() => {
|
|
164
|
+
model.value.splice(idx, 1);
|
|
165
|
+
});
|
|
166
|
+
}
|
|
198
167
|
}
|
|
199
|
-
}
|
|
200
168
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
169
|
+
function onAddChecked(detail) {
|
|
170
|
+
if (detail[props.optionValue] === '') {
|
|
171
|
+
nextTick(() => {
|
|
172
|
+
model.value = props.options
|
|
173
|
+
.filter(v => !v.category)
|
|
174
|
+
.map(option => option[props.optionValue]);
|
|
175
|
+
});
|
|
176
|
+
} else {
|
|
177
|
+
nextTick(() => {
|
|
178
|
+
if (model.value.length === props.options.length - 1) {
|
|
179
|
+
model.value = props.options
|
|
180
|
+
.filter(v => !v.category)
|
|
181
|
+
.map(option => option[props.optionValue]);
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
}
|
|
208
185
|
}
|
|
209
|
-
}, 200);
|
|
210
186
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
.length === model.value.length
|
|
219
|
-
&& model.value.length
|
|
220
|
-
) {
|
|
221
|
-
model.value = props.options
|
|
222
|
-
.filter((v) => !v.category)
|
|
223
|
-
.map((option) => option[props.optionValue]);
|
|
187
|
+
const onSearch = debounce(val => {
|
|
188
|
+
if (val === '') {
|
|
189
|
+
filteredOptions.value = props.options;
|
|
190
|
+
} else {
|
|
191
|
+
filteredOptions.value = props.options.filter(
|
|
192
|
+
v => (v[props.optionLabel] || v).toLowerCase().indexOf(val.toLowerCase()) > -1,
|
|
193
|
+
);
|
|
224
194
|
}
|
|
225
|
-
},
|
|
226
|
-
);
|
|
195
|
+
}, 200);
|
|
227
196
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
197
|
+
watch(
|
|
198
|
+
() => props.modelValue,
|
|
199
|
+
val => {
|
|
200
|
+
model.value = val;
|
|
231
201
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
if (props.useAll && model.value.filter((v) => v).length < 1) {
|
|
202
|
+
if (
|
|
203
|
+
props.options.filter(opt => opt[props.optionValue] && !opt.category).length ===
|
|
204
|
+
model.value.length &&
|
|
205
|
+
model.value.length
|
|
206
|
+
) {
|
|
238
207
|
model.value = props.options
|
|
239
|
-
.filter(
|
|
240
|
-
.map(
|
|
208
|
+
.filter(v => !v.category)
|
|
209
|
+
.map(option => option[props.optionValue]);
|
|
241
210
|
}
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
);
|
|
211
|
+
},
|
|
212
|
+
);
|
|
245
213
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
214
|
+
watch(model, val => {
|
|
215
|
+
emit('update:modelValue', val);
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
const allSelectedModel = () => {
|
|
219
|
+
console.log('model.value', model.value, model.value.filter(v => v).length < 1);
|
|
220
|
+
if (props.useAll && model.value.filter(v => v).length < 1) {
|
|
221
|
+
model.value = props.options
|
|
222
|
+
.filter(v => !v.category)
|
|
223
|
+
.map(option => option[props.optionValue]);
|
|
224
|
+
}
|
|
225
|
+
};
|
|
253
226
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
227
|
+
watch(
|
|
228
|
+
() => props.options,
|
|
229
|
+
val => {
|
|
230
|
+
model.value = [];
|
|
231
|
+
filteredOptions.value = val;
|
|
232
|
+
nextTick(() => {
|
|
233
|
+
allSelectedModel();
|
|
234
|
+
});
|
|
235
|
+
},
|
|
236
|
+
);
|
|
237
|
+
|
|
238
|
+
onBeforeMount(() => {
|
|
239
|
+
allSelectedModel();
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
return {
|
|
243
|
+
model,
|
|
244
|
+
selectDownArrowIcon,
|
|
245
|
+
onRemoveChecked,
|
|
246
|
+
onAddChecked,
|
|
247
|
+
onSearch,
|
|
248
|
+
isDisable,
|
|
249
|
+
filteredOptions,
|
|
250
|
+
search,
|
|
251
|
+
searchInput,
|
|
252
|
+
searchIcon,
|
|
253
|
+
sSelectRef: ref(null),
|
|
254
|
+
};
|
|
255
|
+
},
|
|
256
|
+
});
|
|
269
257
|
</script>
|
|
270
258
|
|
|
271
259
|
<style lang="scss">
|
|
272
|
-
@import
|
|
273
|
-
@import
|
|
260
|
+
@import '../css/quasar.variables.scss';
|
|
261
|
+
@import '../css/extends.scss';
|
|
274
262
|
|
|
275
|
-
.s-select-checkbox {
|
|
276
|
-
|
|
263
|
+
.s-select-checkbox {
|
|
264
|
+
@extend %select;
|
|
277
265
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
266
|
+
.q-field__native {
|
|
267
|
+
display: block;
|
|
268
|
+
min-height: 0;
|
|
269
|
+
height: $default-height;
|
|
270
|
+
width: 100%;
|
|
271
|
+
padding: $select-padding !important;
|
|
272
|
+
color: $Grey_Darken-4;
|
|
273
|
+
white-space: nowrap;
|
|
274
|
+
overflow: hidden;
|
|
275
|
+
text-overflow: ellipsis;
|
|
288
276
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
277
|
+
> span {
|
|
278
|
+
max-height: $default-height;
|
|
279
|
+
}
|
|
292
280
|
|
|
293
|
-
|
|
294
|
-
|
|
281
|
+
> .s-checkbox {
|
|
282
|
+
margin-right: $default-icon-margin;
|
|
283
|
+
}
|
|
295
284
|
}
|
|
296
285
|
}
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
.s-select-checkbox-opts {
|
|
300
|
-
@extend %select-menu-list;
|
|
301
|
-
}
|
|
302
286
|
|
|
303
|
-
.
|
|
304
|
-
|
|
305
|
-
}
|
|
287
|
+
.s-select-checkbox-opts {
|
|
288
|
+
@extend %select-menu-list;
|
|
289
|
+
}
|
|
306
290
|
|
|
307
|
-
.
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
color: $Grey_Default !important;
|
|
311
|
-
}
|
|
291
|
+
.custom-select-options {
|
|
292
|
+
height: $default-height;
|
|
293
|
+
}
|
|
312
294
|
|
|
313
|
-
.select-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
position: relative;
|
|
319
|
-
border-radius: 2px;
|
|
320
|
-
border: 1px solid $Grey_Lighten-1;
|
|
321
|
-
background-color: white;
|
|
322
|
-
position: sticky;
|
|
323
|
-
top: 0;
|
|
324
|
-
z-index: 1;
|
|
325
|
-
margin: 4px;
|
|
295
|
+
.disabled.s-select-checkbox-option {
|
|
296
|
+
border: none;
|
|
297
|
+
background: none !important;
|
|
298
|
+
color: $Grey_Default !important;
|
|
299
|
+
}
|
|
326
300
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
301
|
+
.select-search-input-form {
|
|
302
|
+
height: 28px;
|
|
303
|
+
display: flex;
|
|
304
|
+
align-items: center;
|
|
305
|
+
padding-left: 8px;
|
|
306
|
+
position: relative;
|
|
307
|
+
border-radius: 2px;
|
|
308
|
+
border: 1px solid $Grey_Lighten-1;
|
|
309
|
+
background-color: white;
|
|
310
|
+
position: sticky;
|
|
330
311
|
top: 0;
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
left: 0;
|
|
334
|
-
pointer-events: none;
|
|
335
|
-
border: 1px solid transparent;
|
|
336
|
-
border-radius: inherit;
|
|
337
|
-
}
|
|
312
|
+
z-index: 1;
|
|
313
|
+
margin: 4px;
|
|
338
314
|
|
|
339
|
-
&:hover,
|
|
340
|
-
&:focus-within {
|
|
341
315
|
&::after {
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
316
|
+
content: '';
|
|
317
|
+
position: absolute;
|
|
318
|
+
top: 0;
|
|
319
|
+
right: 0;
|
|
320
|
+
bottom: 0;
|
|
321
|
+
left: 0;
|
|
322
|
+
pointer-events: none;
|
|
323
|
+
border: 1px solid transparent;
|
|
324
|
+
border-radius: inherit;
|
|
345
325
|
}
|
|
346
|
-
}
|
|
347
326
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
327
|
+
&:hover,
|
|
328
|
+
&:focus-within {
|
|
329
|
+
&::after {
|
|
330
|
+
border-color: #0075ff;
|
|
331
|
+
box-shadow: 0 0 4px #0075ff;
|
|
332
|
+
transition: border-color 0.36s cubic-bezier(0.4, 0, 0.2, 1);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
.select-search-input {
|
|
337
|
+
font-size: 12px;
|
|
338
|
+
margin-left: 8px;
|
|
339
|
+
flex-grow: 1;
|
|
340
|
+
border: none;
|
|
341
|
+
outline: none;
|
|
342
|
+
}
|
|
354
343
|
}
|
|
355
|
-
}
|
|
356
344
|
</style>
|