quasar-ui-sellmate-ui-kit 3.14.4 → 3.14.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 +16 -11
- package/dist/index.umd.min.js +2 -2
- package/package.json +1 -1
- package/src/components/SSelectSearch.vue +17 -9
package/package.json
CHANGED
|
@@ -51,7 +51,10 @@
|
|
|
51
51
|
</q-item-section>
|
|
52
52
|
</q-item>
|
|
53
53
|
</template>
|
|
54
|
-
<template
|
|
54
|
+
<template
|
|
55
|
+
v-if="(options && options.length && !model) || (noSelected && options && !options.length)"
|
|
56
|
+
#selected
|
|
57
|
+
>
|
|
55
58
|
<div v-if="noSelected && !options.length">{{ noSelected }}</div>
|
|
56
59
|
<div v-else>
|
|
57
60
|
{{ placeholder }}
|
|
@@ -130,7 +133,7 @@
|
|
|
130
133
|
setup(props, { emit }) {
|
|
131
134
|
const id = useId();
|
|
132
135
|
const model = ref(props.modelValue);
|
|
133
|
-
const filteredOptions = ref(props.options);
|
|
136
|
+
const filteredOptions = ref(props.options || []);
|
|
134
137
|
const findLabel = () =>
|
|
135
138
|
props.options.find(opt => opt[props.optionValue] === props.modelValue)[props.optionLabel] ||
|
|
136
139
|
'';
|
|
@@ -145,29 +148,32 @@
|
|
|
145
148
|
}
|
|
146
149
|
|
|
147
150
|
function handleInput(val) {
|
|
151
|
+
if (!sSelectRef.value) return;
|
|
152
|
+
|
|
148
153
|
search.value = val;
|
|
149
154
|
sSelectRef.value.setOptionIndex(-1);
|
|
150
155
|
|
|
151
|
-
if (!val) {
|
|
156
|
+
if (!val && props.options) {
|
|
152
157
|
filteredOptions.value = props.options;
|
|
153
158
|
sSelectRef.value.setOptionIndex(-1);
|
|
154
159
|
}
|
|
155
160
|
}
|
|
156
161
|
|
|
157
162
|
function handleDelete() {
|
|
163
|
+
if (!sSelectRef.value) return;
|
|
158
164
|
sSelectRef.value.setOptionIndex(-1);
|
|
159
165
|
search.value = '';
|
|
160
166
|
emit('onSearch', '');
|
|
161
167
|
}
|
|
162
168
|
|
|
163
169
|
const onSearch = debounce(val => {
|
|
164
|
-
if (!val) {
|
|
170
|
+
if (!val && props.options) {
|
|
165
171
|
filteredOptions.value = props.options;
|
|
166
172
|
return;
|
|
167
173
|
}
|
|
168
174
|
|
|
169
175
|
// 옵션을 선택 했을 때
|
|
170
|
-
if (sSelectRef.value.getOptionIndex() !== -1) {
|
|
176
|
+
if (sSelectRef.value && sSelectRef.value.getOptionIndex() !== -1) {
|
|
171
177
|
model.value = filteredOptions.value[sSelectRef.value.getOptionIndex()][props.optionValue];
|
|
172
178
|
handleDelete();
|
|
173
179
|
sSelectRef.value.setOptionIndex(-1);
|
|
@@ -179,7 +185,7 @@
|
|
|
179
185
|
v => (v[props.optionLabel] || v).toLowerCase().indexOf(val.toLowerCase()) > -1,
|
|
180
186
|
);
|
|
181
187
|
|
|
182
|
-
if (!filtered.length) {
|
|
188
|
+
if (!filtered.length && sSelectRef.value) {
|
|
183
189
|
emit('onSearch', val);
|
|
184
190
|
sSelectRef.value.setOptionIndex(-1);
|
|
185
191
|
return;
|
|
@@ -192,7 +198,7 @@
|
|
|
192
198
|
() => props.modelValue,
|
|
193
199
|
val => {
|
|
194
200
|
model.value = val;
|
|
195
|
-
sSelectRef.value.setOptionIndex(-1);
|
|
201
|
+
if (sSelectRef.value) sSelectRef.value.setOptionIndex(-1);
|
|
196
202
|
},
|
|
197
203
|
);
|
|
198
204
|
|
|
@@ -206,8 +212,10 @@
|
|
|
206
212
|
// const existingValues = new Set(filteredOptions.value.map((option) => option.value));
|
|
207
213
|
// const nonDuplicateOptions = val.filter((option) => !existingValues.has(option.value));
|
|
208
214
|
// filteredOptions.value.push(...nonDuplicateOptions);
|
|
209
|
-
|
|
210
|
-
|
|
215
|
+
if (val) {
|
|
216
|
+
filteredOptions.value = val;
|
|
217
|
+
if (sSelectRef.value) sSelectRef.value.setOptionIndex(-1);
|
|
218
|
+
}
|
|
211
219
|
},
|
|
212
220
|
{ deep: true },
|
|
213
221
|
);
|