eco-vue-js 0.26.19 → 0.26.21
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/assets/icons/IconSpinner.js +1 -1
- package/dist/components/DatePicker/WDatePicker.vue.d.ts.map +1 -1
- package/dist/components/DatePicker/WDatePicker.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/DatePicker/components/CalendarValue.vue.d.ts +0 -1
- package/dist/components/DatePicker/components/CalendarValue.vue.d.ts.map +1 -1
- package/dist/components/DatePicker/components/CalendarValue.vue_vue_type_script_setup_true_lang.js +2 -6
- package/dist/components/Dismissable/WDismissable.vue.d.ts.map +1 -1
- package/dist/components/Dismissable/WDismissable.vue_vue_type_script_setup_true_lang.js +3 -2
- package/dist/components/FilePicker/components/FilePickerSvg.vue.d.ts.map +1 -1
- package/dist/components/FilePicker/components/FilePickerSvg.vue_vue_type_script_setup_true_lang.js +4 -14
- package/dist/components/Input/WInputAsync.vue.d.ts.map +1 -1
- package/dist/components/Input/WInputAsync.vue_vue_type_script_setup_true_lang.js +2 -1
- package/dist/components/Nav/WNavItem.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/Select/WSelect.vue.d.ts +3 -3
- package/dist/components/Select/WSelect.vue.d.ts.map +1 -1
- package/dist/components/Select/WSelect.vue_vue_type_script_setup_true_lang.js +84 -362
- package/dist/components/Select/WSelectAsync.vue.d.ts +3 -3
- package/dist/components/Select/WSelectAsync.vue.d.ts.map +1 -1
- package/dist/components/Select/WSelectAsync.vue_vue_type_script_setup_true_lang.js +96 -237
- package/dist/components/Select/WSelectAsyncSingle.vue.d.ts.map +1 -1
- package/dist/components/Select/WSelectAsyncSingle.vue_vue_type_script_setup_true_lang.js +106 -10
- package/dist/components/Select/WSelectSingle.vue.d.ts.map +1 -1
- package/dist/components/Select/WSelectSingle.vue_vue_type_script_setup_true_lang.js +61 -8
- package/dist/components/Select/WSelectStringified.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/Select/components/SelectAsyncBase.vue.d.ts +54 -0
- package/dist/components/Select/components/SelectAsyncBase.vue.d.ts.map +1 -0
- package/dist/components/Select/components/SelectAsyncBase.vue.js +5 -0
- package/dist/components/Select/components/SelectAsyncBase.vue_vue_type_script_setup_true_lang.js +406 -0
- package/dist/components/Select/components/SelectBase.vue.d.ts +52 -0
- package/dist/components/Select/components/SelectBase.vue.d.ts.map +1 -0
- package/dist/components/Select/components/SelectBase.vue.js +5 -0
- package/dist/components/Select/components/SelectBase.vue_vue_type_script_setup_true_lang.js +495 -0
- package/dist/components/Select/components/SelectDeferred.vue.d.ts +29 -0
- package/dist/components/Select/components/SelectDeferred.vue.d.ts.map +1 -0
- package/dist/components/Select/components/SelectDeferred.vue.js +5 -0
- package/dist/components/Select/components/SelectDeferred.vue_vue_type_script_setup_true_lang.js +166 -0
- package/dist/components/Select/models/useDeferred.d.ts +22 -0
- package/dist/components/Select/models/useDeferred.d.ts.map +1 -0
- package/dist/components/Select/models/useDeferred.js +69 -0
- package/dist/components/Select/types.d.ts +21 -3
- package/dist/components/Select/types.d.ts.map +1 -1
- package/dist/components/Shine/WShine.vue.d.ts.map +1 -1
- package/dist/components/Shine/WShine.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/Shine/WShineEffect.vue.d.ts.map +1 -1
- package/dist/components/Shine/WShineEffect.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/Spinner/WSpinner.vue.d.ts.map +1 -1
- package/dist/components/Spinner/WSpinner.vue.js +1 -1
- package/dist/components/Tabs/WTabs.vue_vue_type_script_setup_true_lang.js +4 -4
- package/dist/components/Uniform/use/useUniformModel.d.ts.map +1 -1
- package/dist/components/Uniform/use/useUniformModel.js +3 -2
- package/dist/components/Uniform/utils/utils.js +2 -2
- package/dist/main.js +2 -2
- package/dist/utils/useRouteTitle.d.ts +2 -2
- package/dist/utils/useRouteTitle.d.ts.map +1 -1
- package/dist/utils/useRouteTitle.js +3 -3
- package/dist/utils/utils.d.ts +3 -0
- package/dist/utils/utils.d.ts.map +1 -1
- package/dist/utils/utils.js +5 -2
- package/docs/components/select.md +67 -5
- package/docs/llms.txt +1 -1
- package/package.json +1 -1
- package/tailwind-base/base.css +1 -0
- package/tailwind-base/css/animations.css +10 -0
- package/tailwind-base/css/reduced-motion.css +15 -0
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import WInputSuggest_default from "../Input/WInputSuggest.vue.js";
|
|
4
|
-
import SelectAsyncList_default from "./components/SelectAsyncList.vue.js";
|
|
5
|
-
import "../../utils/useDefaultQuery.js";
|
|
1
|
+
import { getDefinedProps, useDeferred } from "./models/useDeferred.js";
|
|
2
|
+
import SelectDeferred_default from "./components/SelectDeferred.vue.js";
|
|
6
3
|
import SelectAsyncPrefix_default from "./components/SelectAsyncPrefix.vue.js";
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
4
|
+
import SelectAsyncBase_default from "./components/SelectAsyncBase.vue.js";
|
|
5
|
+
import { computed, createBlock, createSlots, defineComponent, guardReactiveProps, mergeProps, normalizeClass, normalizeProps, openBlock, renderSlot, unref, useTemplateRef, withCtx } from "vue";
|
|
9
6
|
//#region src/components/Select/WSelectAsync.vue?vue&type=script&setup=true&lang.ts
|
|
10
7
|
var WSelectAsync_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
11
8
|
inheritAttrs: false,
|
|
@@ -15,16 +12,16 @@ var WSelectAsync_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
|
|
|
15
12
|
useQueryFnPrefix: {},
|
|
16
13
|
queryParamsOptions: {},
|
|
17
14
|
searchField: {},
|
|
15
|
+
valueGetter: {
|
|
16
|
+
type: Function,
|
|
17
|
+
default: (data) => data.id
|
|
18
|
+
},
|
|
18
19
|
previewData: {},
|
|
19
20
|
valueQueryKey: { default: "id__in" },
|
|
20
21
|
prefixText: {},
|
|
21
22
|
prefixMax: { default: 8 },
|
|
22
23
|
reverse: { type: Boolean },
|
|
23
24
|
modelValue: {},
|
|
24
|
-
valueGetter: {
|
|
25
|
-
type: Function,
|
|
26
|
-
default: (data) => data.id
|
|
27
|
-
},
|
|
28
25
|
useQueryFnDefault: {},
|
|
29
26
|
emptyStub: { default: "No match" },
|
|
30
27
|
disableClear: { type: Boolean },
|
|
@@ -36,6 +33,7 @@ var WSelectAsync_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
|
|
|
36
33
|
lazy: { type: Boolean },
|
|
37
34
|
placeholderEmpty: {},
|
|
38
35
|
cursorSelected: { type: Boolean },
|
|
36
|
+
deferred: { type: Boolean },
|
|
39
37
|
mobileTitle: {},
|
|
40
38
|
persist: { type: Boolean },
|
|
41
39
|
closeOnClear: { type: Boolean },
|
|
@@ -114,181 +112,65 @@ var WSelectAsync_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
|
|
|
114
112
|
"focus",
|
|
115
113
|
"blur"
|
|
116
114
|
],
|
|
117
|
-
setup(__props, { expose: __expose
|
|
115
|
+
setup(__props, { expose: __expose }) {
|
|
118
116
|
const props = __props;
|
|
119
|
-
const
|
|
120
|
-
const {
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
const inputRef = useTemplateRef("input");
|
|
124
|
-
const listRef = useTemplateRef("list");
|
|
125
|
-
const focused = ref(false);
|
|
126
|
-
const isFetchingPrefix = ref(false);
|
|
127
|
-
const search = ref("");
|
|
128
|
-
const loadingCreate = ref(false);
|
|
129
|
-
const knownData = /* @__PURE__ */ new Map();
|
|
130
|
-
const queryFnKeys = /* @__PURE__ */ new WeakMap();
|
|
131
|
-
let queryFnKeyLast = 0;
|
|
132
|
-
const getQueryFnKey = (useQueryFn) => {
|
|
133
|
-
if (!queryFnKeys.has(useQueryFn)) queryFnKeys.set(useQueryFn, ++queryFnKeyLast);
|
|
134
|
-
return queryFnKeys.get(useQueryFn);
|
|
135
|
-
};
|
|
136
|
-
const isDisabledComputed = computed(() => props.loading || isReadonly.value || isDisabled.value);
|
|
137
|
-
const isModelValueSearch = computed(() => !!search.value && props.modelValue?.includes(search.value));
|
|
138
|
-
const queryParams = computed(() => ({
|
|
139
|
-
...props.queryParamsOptions,
|
|
140
|
-
[props.searchField ?? "search"]: search.value
|
|
141
|
-
}));
|
|
142
|
-
const queryParamsFirstPage = computed(() => ({
|
|
143
|
-
...queryParams.value,
|
|
144
|
-
size: 24,
|
|
145
|
-
page: 1
|
|
146
|
-
}));
|
|
147
|
-
const queryEnabled = computed(() => props.lazy ? isOpen.value : true);
|
|
148
|
-
const queryClient = useQueryClient();
|
|
149
|
-
const firstPageData = shallowRef();
|
|
150
|
-
watch(() => props.useQueryFnOptions, (useQueryFn, _, onCleanup) => {
|
|
151
|
-
const scope = effectScope();
|
|
152
|
-
scope.run(() => {
|
|
153
|
-
const { data } = useQueryFn(queryParamsFirstPage, { enabled: queryEnabled }, queryClient);
|
|
154
|
-
watch(data, (value) => firstPageData.value = value, { immediate: true });
|
|
155
|
-
});
|
|
156
|
-
onCleanup(() => scope.stop());
|
|
157
|
-
}, { immediate: true });
|
|
158
|
-
const hasSearchOption = computed(() => {
|
|
159
|
-
if (props.createdData?.some((option) => props.valueGetter(option) === search.value)) return true;
|
|
160
|
-
return firstPageData.value?.results.some((option) => props.valueGetter(option) === search.value);
|
|
161
|
-
});
|
|
162
|
-
const close = () => {
|
|
163
|
-
isOpen.value = false;
|
|
164
|
-
focused.value = false;
|
|
165
|
-
if (props.searchModel && search.value && !isModelValueSearch.value) {
|
|
166
|
-
const optionExact = firstPageData.value?.results.find((option) => props.valueGetter(option) === search.value);
|
|
167
|
-
if (optionExact) select(props.valueGetter(optionExact), optionExact);
|
|
168
|
-
else if (search.value) create(search.value);
|
|
169
|
-
else if (props.modelValue?.length) {
|
|
170
|
-
const last = props.modelValue[props.modelValue.length - 1];
|
|
171
|
-
unselect(last, firstPageData.value?.results.find((option) => props.valueGetter(option) === last));
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
search.value = "";
|
|
117
|
+
const selectComponentRef = useTemplateRef("selectComponent");
|
|
118
|
+
const { isDeferred, deferredField, activate, focus } = useDeferred(props, () => selectComponentRef.value?.focus());
|
|
119
|
+
const getOption = (value) => {
|
|
120
|
+
return [...props.createdData ?? [], ...props.previewData ?? []].find((option) => props.valueGetter(option) === value);
|
|
175
121
|
};
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
if (deletePressTimeout) {
|
|
180
|
-
const last = props.modelValue[props.modelValue.length - 1];
|
|
181
|
-
unselect(last, firstPageData.value?.results.find((option) => props.valueGetter(option) === last));
|
|
182
|
-
clearTimeout(deletePressTimeout);
|
|
183
|
-
deletePressTimeout = null;
|
|
184
|
-
} else deletePressTimeout = setTimeout(() => {
|
|
185
|
-
deletePressTimeout = null;
|
|
186
|
-
}, 500);
|
|
187
|
-
};
|
|
188
|
-
const select = (item, data) => {
|
|
189
|
-
if (isDisabledComputed.value) return;
|
|
190
|
-
knownData.set(String(item), data);
|
|
191
|
-
emit("select", item, data);
|
|
192
|
-
search.value = "";
|
|
193
|
-
};
|
|
194
|
-
const unselect = (item, data) => {
|
|
195
|
-
if (isDisabledComputed.value) return;
|
|
196
|
-
emit("unselect", item, data);
|
|
197
|
-
search.value = "";
|
|
198
|
-
};
|
|
199
|
-
const create = async (value) => {
|
|
200
|
-
if (isDisabledComputed.value) return;
|
|
201
|
-
if (!props.createOption) return;
|
|
202
|
-
loadingCreate.value = true;
|
|
203
|
-
const option = await props.createOption(value);
|
|
204
|
-
if (option) {
|
|
205
|
-
select(props.valueGetter(option), option);
|
|
206
|
-
search.value = "";
|
|
207
|
-
}
|
|
208
|
-
loadingCreate.value = false;
|
|
209
|
-
};
|
|
210
|
-
const updateSelected = (value) => {
|
|
211
|
-
if (isDisabledComputed.value) return;
|
|
212
|
-
emit("update:model-value", value);
|
|
213
|
-
search.value = "";
|
|
214
|
-
};
|
|
215
|
-
const focus = () => {
|
|
216
|
-
inputRef.value?.focus();
|
|
217
|
-
};
|
|
218
|
-
const blur = () => {
|
|
219
|
-
inputRef.value?.blur();
|
|
220
|
-
};
|
|
221
|
-
const closeMenu = () => {
|
|
222
|
-
inputRef.value?.close();
|
|
223
|
-
};
|
|
224
|
-
const setSearch = (value) => {
|
|
225
|
-
search.value = value;
|
|
226
|
-
};
|
|
227
|
-
if (props.useQueryFnDefault) {
|
|
228
|
-
const { data: defaultData } = props.useQueryFnDefault(void 0, { enabled: computed(() => !props.disabled) });
|
|
229
|
-
watch(defaultData, (value) => {
|
|
230
|
-
if (value && props.modelValue?.length === 0) {
|
|
231
|
-
select(props.valueGetter(value), value);
|
|
232
|
-
emit("init-model");
|
|
233
|
-
}
|
|
234
|
-
}, { immediate: true });
|
|
235
|
-
}
|
|
236
|
-
watch(() => props.modelValue, async () => {
|
|
237
|
-
await nextTick();
|
|
238
|
-
if (props.seamless) inputRef.value?.scrollToInput();
|
|
122
|
+
const hasPreview = computed(() => {
|
|
123
|
+
if (!props.modelValue?.length) return true;
|
|
124
|
+
return props.modelValue.length <= props.prefixMax && props.modelValue.every((value) => getOption(value) !== void 0);
|
|
239
125
|
});
|
|
126
|
+
const knownData = /* @__PURE__ */ new Map();
|
|
240
127
|
__expose({
|
|
241
128
|
focus,
|
|
242
|
-
blur,
|
|
243
|
-
close:
|
|
244
|
-
setSearch
|
|
129
|
+
blur: () => selectComponentRef.value?.blur(),
|
|
130
|
+
close: () => selectComponentRef.value?.close(),
|
|
131
|
+
setSearch: (value) => selectComponentRef.value?.setSearch(value)
|
|
245
132
|
});
|
|
246
133
|
return (_ctx, _cache) => {
|
|
247
|
-
return openBlock(), createBlock(
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
"
|
|
259
|
-
"
|
|
260
|
-
"
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
})
|
|
271
|
-
|
|
272
|
-
prefix: withCtx(({ unclickable }) => [(__props.hidePrefix ? unref(isMobile) ? unclickable || !focused.value : !isOpen.value : true) ? renderSlot(_ctx.$slots, "prefix", normalizeProps(guardReactiveProps({ modelValue: __props.modelValue ?? [] })), () => [(openBlock(), createBlock(SelectAsyncPrefix_default, {
|
|
273
|
-
key: getQueryFnKey(__props.useQueryFnPrefix ?? __props.useQueryFnOptions),
|
|
134
|
+
return unref(isDeferred) ? (openBlock(), createBlock(SelectDeferred_default, {
|
|
135
|
+
key: 0,
|
|
136
|
+
"model-value": __props.modelValue ?? [],
|
|
137
|
+
"get-option": getOption,
|
|
138
|
+
field: unref(deferredField),
|
|
139
|
+
"option-component": __props.optionComponent,
|
|
140
|
+
"option-component-props": __props.optionComponentProps,
|
|
141
|
+
placeholder: __props.placeholder,
|
|
142
|
+
"placeholder-empty": __props.placeholderEmpty,
|
|
143
|
+
name: __props.name,
|
|
144
|
+
size: __props.size,
|
|
145
|
+
"no-wrap": __props.noWrap,
|
|
146
|
+
"border-class": __props.borderClass,
|
|
147
|
+
"hide-input": __props.hideInput,
|
|
148
|
+
loading: __props.loading,
|
|
149
|
+
class: normalizeClass(_ctx.$attrs.class),
|
|
150
|
+
onActivate: unref(activate)
|
|
151
|
+
}, createSlots({ _: 2 }, [_ctx.$slots.option ? {
|
|
152
|
+
name: "option",
|
|
153
|
+
fn: withCtx((scope) => [renderSlot(_ctx.$slots, "option", normalizeProps(guardReactiveProps(scope)))]),
|
|
154
|
+
key: "0"
|
|
155
|
+
} : void 0, _ctx.$slots.prefix || !hasPreview.value ? {
|
|
156
|
+
name: "chips",
|
|
157
|
+
fn: withCtx(({ readonly: readonlyChips, disabled: disabledChips }) => [_ctx.$slots.prefix ? renderSlot(_ctx.$slots, "prefix", { modelValue: __props.modelValue ?? [] }, void 0, void 0, 0) : (openBlock(), createBlock(SelectAsyncPrefix_default, {
|
|
158
|
+
key: 1,
|
|
274
159
|
"use-query-fn": __props.useQueryFnPrefix ?? __props.useQueryFnOptions,
|
|
275
160
|
"model-value": __props.modelValue ?? [],
|
|
276
|
-
disabled:
|
|
277
|
-
loading: __props.loading
|
|
161
|
+
disabled: disabledChips,
|
|
162
|
+
loading: __props.loading,
|
|
278
163
|
"option-component": __props.optionComponent,
|
|
279
164
|
"option-component-props": __props.optionComponentProps,
|
|
280
|
-
"disable-clear":
|
|
165
|
+
"disable-clear": true,
|
|
281
166
|
"preview-data": __props.previewData,
|
|
282
167
|
"created-data": __props.createdData,
|
|
283
168
|
"value-getter": __props.valueGetter,
|
|
284
169
|
"value-query-key": __props.valueQueryKey,
|
|
285
|
-
readonly:
|
|
170
|
+
readonly: readonlyChips,
|
|
286
171
|
"prefix-text": __props.prefixText,
|
|
287
172
|
"prefix-max": __props.prefixMax,
|
|
288
|
-
"known-data": unref(knownData)
|
|
289
|
-
onUnselect: unselect,
|
|
290
|
-
"onUpdate:fetching": _cache[0] || (_cache[0] = ($event) => isFetchingPrefix.value = $event),
|
|
291
|
-
"onUpdate:modelValue": updateSelected
|
|
173
|
+
"known-data": unref(knownData)
|
|
292
174
|
}, createSlots({ _: 2 }, [_ctx.$slots.option ? {
|
|
293
175
|
name: "option",
|
|
294
176
|
fn: withCtx(({ option, index, skeleton: skeletonOption }) => [renderSlot(_ctx.$slots, "option", {
|
|
@@ -307,7 +189,6 @@ var WSelectAsync_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
|
|
|
307
189
|
"loading",
|
|
308
190
|
"option-component",
|
|
309
191
|
"option-component-props",
|
|
310
|
-
"disable-clear",
|
|
311
192
|
"preview-data",
|
|
312
193
|
"created-data",
|
|
313
194
|
"value-getter",
|
|
@@ -316,72 +197,35 @@ var WSelectAsync_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
|
|
|
316
197
|
"prefix-text",
|
|
317
198
|
"prefix-max",
|
|
318
199
|
"known-data"
|
|
319
|
-
]))], void 0, 0) : createCommentVNode("", true)]),
|
|
320
|
-
content: withCtx(() => [(openBlock(), createBlock(SelectAsyncList_default, {
|
|
321
|
-
key: getQueryFnKey(__props.useQueryFnOptions),
|
|
322
|
-
ref: "list",
|
|
323
|
-
"model-value": __props.modelValue ?? [],
|
|
324
|
-
"use-query-fn": __props.useQueryFnOptions,
|
|
325
|
-
"query-params": queryParams.value,
|
|
326
|
-
loading: __props.loading || isFetchingPrefix.value,
|
|
327
|
-
disabled: isDisabledComputed.value,
|
|
328
|
-
"empty-stub": !search.value && __props.emptyStub ? __props.emptyStub : void 0,
|
|
329
|
-
"allow-create": __props.createOption && (!hasSearchOption.value || isModelValueSearch.value),
|
|
330
|
-
"hide-option-icon": __props.hideOptionIcon,
|
|
331
|
-
"value-getter": __props.valueGetter,
|
|
332
|
-
"loading-create": loadingCreate.value,
|
|
333
|
-
"query-options": { placeholderData: unref(keepPreviousData) },
|
|
334
|
-
search: search.value,
|
|
335
|
-
reverse: __props.reverse,
|
|
336
|
-
"scroll-selected": isOpen.value,
|
|
337
|
-
"cursor-selected": __props.cursorSelected,
|
|
338
|
-
onSelect: select,
|
|
339
|
-
onUnselect: unselect,
|
|
340
|
-
"onCreate:option": _cache[1] || (_cache[1] = ($event) => create(search.value))
|
|
341
|
-
}, createSlots({
|
|
342
|
-
default: withCtx(({ option, selected, skeleton: skeletonList, index }) => [renderSlot(_ctx.$slots, "option", {
|
|
343
|
-
option,
|
|
344
|
-
selected,
|
|
345
|
-
skeleton: skeletonList,
|
|
346
|
-
model: false,
|
|
347
|
-
search: search.value,
|
|
348
|
-
index
|
|
349
|
-
}, () => [(openBlock(), createBlock(resolveDynamicComponent(__props.optionComponent), mergeProps(__props.optionComponentProps, {
|
|
350
|
-
option,
|
|
351
|
-
selected,
|
|
352
|
-
skeleton: skeletonList,
|
|
353
|
-
model: false,
|
|
354
|
-
search: search.value
|
|
355
|
-
}), null, 16, [
|
|
356
|
-
"option",
|
|
357
|
-
"selected",
|
|
358
|
-
"skeleton",
|
|
359
|
-
"search"
|
|
360
|
-
]))])]),
|
|
361
|
-
_: 2
|
|
362
|
-
}, [_ctx.$slots.content ? {
|
|
363
|
-
name: "content",
|
|
364
|
-
fn: withCtx(() => [renderSlot(_ctx.$slots, "content")]),
|
|
365
|
-
key: "0"
|
|
366
|
-
} : void 0]), 1032, [
|
|
367
|
-
"model-value",
|
|
368
|
-
"use-query-fn",
|
|
369
|
-
"query-params",
|
|
370
|
-
"loading",
|
|
371
|
-
"disabled",
|
|
372
|
-
"empty-stub",
|
|
373
|
-
"allow-create",
|
|
374
|
-
"hide-option-icon",
|
|
375
|
-
"value-getter",
|
|
376
|
-
"loading-create",
|
|
377
|
-
"query-options",
|
|
378
|
-
"search",
|
|
379
|
-
"reverse",
|
|
380
|
-
"scroll-selected",
|
|
381
|
-
"cursor-selected"
|
|
382
200
|
]))]),
|
|
383
|
-
|
|
384
|
-
}, [
|
|
201
|
+
key: "1"
|
|
202
|
+
} : void 0]), 1032, [
|
|
203
|
+
"model-value",
|
|
204
|
+
"field",
|
|
205
|
+
"option-component",
|
|
206
|
+
"option-component-props",
|
|
207
|
+
"placeholder",
|
|
208
|
+
"placeholder-empty",
|
|
209
|
+
"name",
|
|
210
|
+
"size",
|
|
211
|
+
"no-wrap",
|
|
212
|
+
"border-class",
|
|
213
|
+
"hide-input",
|
|
214
|
+
"loading",
|
|
215
|
+
"class",
|
|
216
|
+
"onActivate"
|
|
217
|
+
])) : (openBlock(), createBlock(SelectAsyncBase_default, mergeProps({
|
|
218
|
+
key: 1,
|
|
219
|
+
ref: "selectComponent"
|
|
220
|
+
}, unref(getDefinedProps)(props), {
|
|
221
|
+
class: _ctx.$attrs.class,
|
|
222
|
+
onSelect: _cache[0] || (_cache[0] = (value, data) => _ctx.$emit("select", value, data)),
|
|
223
|
+
onUnselect: _cache[1] || (_cache[1] = (value, data) => _ctx.$emit("unselect", value, data)),
|
|
224
|
+
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => _ctx.$emit("update:model-value", $event)),
|
|
225
|
+
onFocus: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("focus", $event)),
|
|
226
|
+
onBlur: _cache[4] || (_cache[4] = ($event) => _ctx.$emit("blur", $event)),
|
|
227
|
+
onInitModel: _cache[5] || (_cache[5] = ($event) => _ctx.$emit("init-model"))
|
|
228
|
+
}), createSlots({ _: 2 }, [
|
|
385
229
|
_ctx.$slots.title ? {
|
|
386
230
|
name: "title",
|
|
387
231
|
fn: withCtx(() => [renderSlot(_ctx.$slots, "title")]),
|
|
@@ -392,12 +236,27 @@ var WSelectAsync_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
|
|
|
392
236
|
fn: withCtx(() => [renderSlot(_ctx.$slots, "subtitle")]),
|
|
393
237
|
key: "1"
|
|
394
238
|
} : void 0,
|
|
239
|
+
_ctx.$slots.option ? {
|
|
240
|
+
name: "option",
|
|
241
|
+
fn: withCtx((scope) => [renderSlot(_ctx.$slots, "option", normalizeProps(guardReactiveProps(scope)))]),
|
|
242
|
+
key: "2"
|
|
243
|
+
} : void 0,
|
|
395
244
|
_ctx.$slots.right ? {
|
|
396
245
|
name: "right",
|
|
397
246
|
fn: withCtx(() => [renderSlot(_ctx.$slots, "right")]),
|
|
398
|
-
key: "
|
|
247
|
+
key: "3"
|
|
248
|
+
} : void 0,
|
|
249
|
+
_ctx.$slots.content ? {
|
|
250
|
+
name: "content",
|
|
251
|
+
fn: withCtx(() => [renderSlot(_ctx.$slots, "content")]),
|
|
252
|
+
key: "4"
|
|
253
|
+
} : void 0,
|
|
254
|
+
_ctx.$slots.prefix ? {
|
|
255
|
+
name: "prefix",
|
|
256
|
+
fn: withCtx((scope) => [renderSlot(_ctx.$slots, "prefix", normalizeProps(guardReactiveProps(scope)))]),
|
|
257
|
+
key: "5"
|
|
399
258
|
} : void 0
|
|
400
|
-
]), 1040, ["class"]);
|
|
259
|
+
]), 1040, ["class"]));
|
|
401
260
|
};
|
|
402
261
|
}
|
|
403
262
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WSelectAsyncSingle.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/Select/WSelectAsyncSingle.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"WSelectAsyncSingle.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/Select/WSelectAsyncSingle.vue"],"names":[],"mappings":"AA4IA;AA2OA,OAAO,KAAK,EAAC,sBAAsB,EAAE,gBAAgB,EAAE,qBAAqB,EAA8B,iBAAiB,EAAC,MAAM,SAAS,CAAA;AAY3I,QAAA,MAAM,YAAY,GAAK,KAAK,SAAS,MAAM,GAAG,MAAM,EAAE,IAAI,SAAS,WAAW,EAAE,WAAW,EAAE,eAAe,SAAS,qBAAqB,CAAC,IAAI,CAAC,EAAE,UAAU,SAAS,OAAO,GAAG,KAAK,EAAE,UAAU,SAAS,gBAAgB,GAAG,IAAI,EAC/N,aAAa,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,EAC9D,YAAY,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,EAC3G,gBAAgB,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,EAClE;WA+YO,OAAO,KAAK,EAAE,WAAW,GAAG,mBAAmB,CAAC;;;;;KAAmC,CAAC,GAAG,CAAC,OAAO,UAAU,SAAS;QAAE,oBAAoB,EAAE,MAAM,CAAC,CAAA;KAAE,GAAG,CAAC,GAAG,EAAE,CAAC;YAC5J,CAAC,OAAO,EAAE,OAAO,KAAK,EAAE,gBAAgB;;;MAAsB,KAAK,IAAI;WACxE,GAAG;;QA5UT,iCAAiC;gBACzB,MAAM,IAAI;QAClB,+CAA+C;mBACpC,MAAM,IAAI;QACrB,yCAAyC;gBACjC,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,KAAK,IAAI;QAC9C,0HAA0H;iBACjH,CAAC,KAAK,EAAE,UAAU,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,KAAK,IAAI;QAC7D,yDAAyD;kBAC/C,MAAM,IAAI;QACpB,mCAAmC;iBAC1B,MAAM,IAAI;;;YA5Df,oBAAoB,qEAAyB,IAAI,GAAG,SAAS,GAAG,IAAI;YAEpE,YAAY,GAAG,IAAI;YAEnB,OAAO,SAAS,UAAU,GAAG,SAAS,GAAG,IAAI;YAE7C,MAAM,SAAS,UAAU,GAAG,IAAI;;EA2XlC,KACQ,OAAO,KAAK,EAAE,KAAK,GAAG;IAAE,KAAK,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAA;CAAI,CAAC;wBACpE,OAAO,YAAY;AAAxC,wBAAyC;AACzC,KAAK,mBAAmB,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,GAAG,GAAG;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG;KAAG,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,CAAC,GAAG,EAAE,CAAC"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { useClearValue } from "../../utils/useClearValue.js";
|
|
2
|
+
import { useDeferred } from "./models/useDeferred.js";
|
|
2
3
|
import { useCloseOnPick } from "./models/useCloseOnPick.js";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
4
|
+
import SelectDeferred_default from "./components/SelectDeferred.vue.js";
|
|
5
|
+
import SelectAsyncPrefix_default from "./components/SelectAsyncPrefix.vue.js";
|
|
6
|
+
import SelectAsyncBase_default from "./components/SelectAsyncBase.vue.js";
|
|
7
|
+
import { computed, createBlock, createSlots, defineComponent, guardReactiveProps, mergeProps, normalizeClass, normalizeProps, openBlock, renderSlot, toRef, unref, useTemplateRef, watch, withCtx } from "vue";
|
|
5
8
|
//#region src/components/Select/WSelectAsyncSingle.vue?vue&type=script&setup=true&lang.ts
|
|
6
9
|
var WSelectAsyncSingle_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
7
10
|
inheritAttrs: false,
|
|
@@ -16,11 +19,14 @@ var WSelectAsyncSingle_vue_vue_type_script_setup_true_lang_default = /*@__PURE__
|
|
|
16
19
|
useQueryFnPrefix: {},
|
|
17
20
|
queryParamsOptions: {},
|
|
18
21
|
searchField: {},
|
|
19
|
-
|
|
22
|
+
valueGetter: {
|
|
23
|
+
type: Function,
|
|
24
|
+
default: (data) => data.id
|
|
25
|
+
},
|
|
26
|
+
valueQueryKey: { default: "id__in" },
|
|
20
27
|
prefixText: {},
|
|
21
|
-
prefixMax: {},
|
|
28
|
+
prefixMax: { default: 8 },
|
|
22
29
|
reverse: { type: Boolean },
|
|
23
|
-
valueGetter: {},
|
|
24
30
|
useQueryFnDefault: {},
|
|
25
31
|
emptyStub: {},
|
|
26
32
|
hidePrefix: { type: Boolean },
|
|
@@ -29,6 +35,7 @@ var WSelectAsyncSingle_vue_vue_type_script_setup_true_lang_default = /*@__PURE__
|
|
|
29
35
|
searchModel: { type: Boolean },
|
|
30
36
|
lazy: { type: Boolean },
|
|
31
37
|
placeholderEmpty: {},
|
|
38
|
+
deferred: { type: Boolean },
|
|
32
39
|
mobileTitle: {},
|
|
33
40
|
persist: { type: Boolean },
|
|
34
41
|
closeOnClear: { type: Boolean },
|
|
@@ -111,6 +118,12 @@ var WSelectAsyncSingle_vue_vue_type_script_setup_true_lang_default = /*@__PURE__
|
|
|
111
118
|
const selectComponentRef = useTemplateRef("selectComponent");
|
|
112
119
|
const getClearValue = useClearValue(props);
|
|
113
120
|
const arrayValue = computed(() => props.modelValue ? [props.modelValue] : []);
|
|
121
|
+
const { isDeferred, deferredField, activate, focus } = useDeferred(props, () => selectComponentRef.value?.focus());
|
|
122
|
+
const getOption = (value) => {
|
|
123
|
+
return [props.createdData, props.previewData].find((option) => option !== void 0 && props.valueGetter(option) === value);
|
|
124
|
+
};
|
|
125
|
+
const hasPreview = computed(() => arrayValue.value.every((value) => getOption(value) !== void 0));
|
|
126
|
+
const knownData = /* @__PURE__ */ new Map();
|
|
114
127
|
const closeOnPick = useCloseOnPick(() => props.embedded ?? false, () => selectComponentRef.value?.close());
|
|
115
128
|
const updateModelValue = (value, data) => {
|
|
116
129
|
emit("update:model-value", value, data);
|
|
@@ -119,16 +132,99 @@ var WSelectAsyncSingle_vue_vue_type_script_setup_true_lang_default = /*@__PURE__
|
|
|
119
132
|
const blur = () => {
|
|
120
133
|
selectComponentRef.value?.blur();
|
|
121
134
|
};
|
|
122
|
-
const focus = () => {
|
|
123
|
-
selectComponentRef.value?.focus();
|
|
124
|
-
};
|
|
125
135
|
watch(toRef(props, "modelValue"), blur);
|
|
126
136
|
__expose({
|
|
127
137
|
blur,
|
|
128
138
|
focus
|
|
129
139
|
});
|
|
130
140
|
return (_ctx, _cache) => {
|
|
131
|
-
return openBlock(), createBlock(
|
|
141
|
+
return unref(isDeferred) ? (openBlock(), createBlock(SelectDeferred_default, {
|
|
142
|
+
key: 0,
|
|
143
|
+
"model-value": arrayValue.value,
|
|
144
|
+
"get-option": getOption,
|
|
145
|
+
field: unref(deferredField),
|
|
146
|
+
"option-component": __props.optionComponent,
|
|
147
|
+
"option-component-props": __props.optionComponentProps,
|
|
148
|
+
placeholder: __props.placeholder,
|
|
149
|
+
"placeholder-empty": __props.placeholderEmpty,
|
|
150
|
+
name: __props.name,
|
|
151
|
+
size: __props.size,
|
|
152
|
+
"no-wrap": __props.noWrap,
|
|
153
|
+
"border-class": __props.borderClass,
|
|
154
|
+
"hide-input": __props.hideInput,
|
|
155
|
+
loading: __props.loading,
|
|
156
|
+
class: normalizeClass(_ctx.$attrs.class),
|
|
157
|
+
onActivate: unref(activate)
|
|
158
|
+
}, createSlots({ _: 2 }, [_ctx.$slots.option ? {
|
|
159
|
+
name: "option",
|
|
160
|
+
fn: withCtx((scope) => [renderSlot(_ctx.$slots, "option", normalizeProps(guardReactiveProps(scope)))]),
|
|
161
|
+
key: "0"
|
|
162
|
+
} : void 0, _ctx.$slots.prefix || !hasPreview.value ? {
|
|
163
|
+
name: "chips",
|
|
164
|
+
fn: withCtx(({ readonly: readonlyChips, disabled: disabledChips }) => [_ctx.$slots.prefix ? renderSlot(_ctx.$slots, "prefix", {}, void 0, void 0, 0) : (openBlock(), createBlock(SelectAsyncPrefix_default, {
|
|
165
|
+
key: 1,
|
|
166
|
+
"use-query-fn": __props.useQueryFnPrefix ?? __props.useQueryFnOptions,
|
|
167
|
+
"model-value": arrayValue.value,
|
|
168
|
+
disabled: disabledChips,
|
|
169
|
+
loading: __props.loading,
|
|
170
|
+
"option-component": __props.optionComponent,
|
|
171
|
+
"option-component-props": __props.optionComponentProps,
|
|
172
|
+
"disable-clear": true,
|
|
173
|
+
"preview-data": __props.previewData === void 0 ? void 0 : [__props.previewData],
|
|
174
|
+
"created-data": __props.createdData === void 0 ? void 0 : [__props.createdData],
|
|
175
|
+
"value-getter": __props.valueGetter,
|
|
176
|
+
"value-query-key": __props.valueQueryKey,
|
|
177
|
+
readonly: readonlyChips,
|
|
178
|
+
"prefix-text": __props.prefixText,
|
|
179
|
+
"prefix-max": __props.prefixMax,
|
|
180
|
+
"known-data": unref(knownData)
|
|
181
|
+
}, createSlots({ _: 2 }, [_ctx.$slots.option ? {
|
|
182
|
+
name: "option",
|
|
183
|
+
fn: withCtx(({ option, index, skeleton: skeletonOption }) => [renderSlot(_ctx.$slots, "option", {
|
|
184
|
+
option,
|
|
185
|
+
index,
|
|
186
|
+
selected: true,
|
|
187
|
+
model: true,
|
|
188
|
+
skeleton: skeletonOption,
|
|
189
|
+
search: void 0
|
|
190
|
+
})]),
|
|
191
|
+
key: "0"
|
|
192
|
+
} : void 0]), 1032, [
|
|
193
|
+
"use-query-fn",
|
|
194
|
+
"model-value",
|
|
195
|
+
"disabled",
|
|
196
|
+
"loading",
|
|
197
|
+
"option-component",
|
|
198
|
+
"option-component-props",
|
|
199
|
+
"preview-data",
|
|
200
|
+
"created-data",
|
|
201
|
+
"value-getter",
|
|
202
|
+
"value-query-key",
|
|
203
|
+
"readonly",
|
|
204
|
+
"prefix-text",
|
|
205
|
+
"prefix-max",
|
|
206
|
+
"known-data"
|
|
207
|
+
]))]),
|
|
208
|
+
key: "1"
|
|
209
|
+
} : void 0]), 1032, [
|
|
210
|
+
"model-value",
|
|
211
|
+
"field",
|
|
212
|
+
"option-component",
|
|
213
|
+
"option-component-props",
|
|
214
|
+
"placeholder",
|
|
215
|
+
"placeholder-empty",
|
|
216
|
+
"name",
|
|
217
|
+
"size",
|
|
218
|
+
"no-wrap",
|
|
219
|
+
"border-class",
|
|
220
|
+
"hide-input",
|
|
221
|
+
"loading",
|
|
222
|
+
"class",
|
|
223
|
+
"onActivate"
|
|
224
|
+
])) : (openBlock(), createBlock(SelectAsyncBase_default, mergeProps({
|
|
225
|
+
key: 1,
|
|
226
|
+
ref: "selectComponent"
|
|
227
|
+
}, {
|
|
132
228
|
...props,
|
|
133
229
|
modelValue: arrayValue.value,
|
|
134
230
|
disableClear: !__props.allowClear,
|
|
@@ -178,7 +274,7 @@ var WSelectAsyncSingle_vue_vue_type_script_setup_true_lang_default = /*@__PURE__
|
|
|
178
274
|
fn: withCtx(() => [renderSlot(_ctx.$slots, "prefix")]),
|
|
179
275
|
key: "5"
|
|
180
276
|
} : void 0
|
|
181
|
-
]), 1040, ["class"]);
|
|
277
|
+
]), 1040, ["class"]));
|
|
182
278
|
};
|
|
183
279
|
}
|
|
184
280
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WSelectSingle.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/Select/WSelectSingle.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"WSelectSingle.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/Select/WSelectSingle.vue"],"names":[],"mappings":"AAuGA;AAgMA,OAAO,KAAK,EAAC,gBAAgB,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,iBAAiB,EAAC,MAAM,SAAS,CAAA;AAE1G,OAAO,EAAC,KAAK,KAAK,EAAyC,MAAM,KAAK,CAAA;AAStE,QAAA,MAAM,YAAY,GAAK,KAAK,SAAS,MAAM,GAAG,MAAM,EAAE,IAAI,SAAS,WAAW,EAAE,kBAAkB,EAAE,eAAe,SAAS,qBAAqB,CAAC,IAAI,CAAC,EAAE,UAAU,SAAS,OAAO,GAAG,KAAK,EAAE,UAAU,SAAS,gBAAgB,GAAG,IAAI,EACtO,aAAa,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,EAC9D,YAAY,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,EAC3G,gBAAgB,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,EAClE;WAmVO,OAAO,KAAK,EAAE,WAAW,GAAG,mBAAmB,CAAC;;;;;;KAAmC,CAAC,GAAG,CAAC,OAAO,UAAU,SAAS;QAAE,oBAAoB,EAAE,MAAM,CAAC,CAAA;KAAE,GAAG,CAAC,GAAG,EAAE,CAAC;YAC5J,CAAC,OAAO,EAAE,OAAO,KAAK,EAAE,gBAAgB;;;MAAsB,KAAK,IAAI;WACxE,GAAG;;QArRT,iCAAiC;gBACzB,MAAM,KAAK,EAAE;QACrB,+CAA+C;mBACpC,MAAM,KAAK,EAAE;QACxB,yCAAyC;gBACjC,MAAM,KAAK,EAAE;QACrB,mCAAmC;iBAC1B,MAAM,KAAK,EAAE;QACtB,0HAA0H;iBACjH,CAAC,KAAK,EAAE,UAAU,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,KAAK,KAAK,EAAE;QAChE,yDAAyD;kBAC/C,MAAM,KAAK,EAAE;;;YA1DnB,oBAAoB,qEAAyB,IAAI,GAAG,SAAS,GAAG,IAAI;YAEpE,4BAA4B,SAAS,MAAM,GAAG,SAAS,GAAG,IAAI;YAE9D,YAAY,GAAG,IAAI;YAEnB,OAAO,SAAS,UAAU,GAAG,SAAS,GAAG,IAAI;YAE7C,MAAM,SAAS,UAAU,GAAG,IAAI;;EAgUlC,KACQ,OAAO,KAAK,EAAE,KAAK,GAAG;IAAE,KAAK,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAA;CAAI,CAAC;wBACpE,OAAO,YAAY;AAAxC,wBAAyC;AACzC,KAAK,mBAAmB,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,GAAG,GAAG;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG;KAAG,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,CAAC,GAAG,EAAE,CAAC"}
|