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.
Files changed (64) hide show
  1. package/dist/assets/icons/IconSpinner.js +1 -1
  2. package/dist/components/DatePicker/WDatePicker.vue.d.ts.map +1 -1
  3. package/dist/components/DatePicker/WDatePicker.vue_vue_type_script_setup_true_lang.js +1 -1
  4. package/dist/components/DatePicker/components/CalendarValue.vue.d.ts +0 -1
  5. package/dist/components/DatePicker/components/CalendarValue.vue.d.ts.map +1 -1
  6. package/dist/components/DatePicker/components/CalendarValue.vue_vue_type_script_setup_true_lang.js +2 -6
  7. package/dist/components/Dismissable/WDismissable.vue.d.ts.map +1 -1
  8. package/dist/components/Dismissable/WDismissable.vue_vue_type_script_setup_true_lang.js +3 -2
  9. package/dist/components/FilePicker/components/FilePickerSvg.vue.d.ts.map +1 -1
  10. package/dist/components/FilePicker/components/FilePickerSvg.vue_vue_type_script_setup_true_lang.js +4 -14
  11. package/dist/components/Input/WInputAsync.vue.d.ts.map +1 -1
  12. package/dist/components/Input/WInputAsync.vue_vue_type_script_setup_true_lang.js +2 -1
  13. package/dist/components/Nav/WNavItem.vue_vue_type_script_setup_true_lang.js +1 -1
  14. package/dist/components/Select/WSelect.vue.d.ts +3 -3
  15. package/dist/components/Select/WSelect.vue.d.ts.map +1 -1
  16. package/dist/components/Select/WSelect.vue_vue_type_script_setup_true_lang.js +84 -362
  17. package/dist/components/Select/WSelectAsync.vue.d.ts +3 -3
  18. package/dist/components/Select/WSelectAsync.vue.d.ts.map +1 -1
  19. package/dist/components/Select/WSelectAsync.vue_vue_type_script_setup_true_lang.js +96 -237
  20. package/dist/components/Select/WSelectAsyncSingle.vue.d.ts.map +1 -1
  21. package/dist/components/Select/WSelectAsyncSingle.vue_vue_type_script_setup_true_lang.js +106 -10
  22. package/dist/components/Select/WSelectSingle.vue.d.ts.map +1 -1
  23. package/dist/components/Select/WSelectSingle.vue_vue_type_script_setup_true_lang.js +61 -8
  24. package/dist/components/Select/WSelectStringified.vue_vue_type_script_setup_true_lang.js +2 -0
  25. package/dist/components/Select/components/SelectAsyncBase.vue.d.ts +54 -0
  26. package/dist/components/Select/components/SelectAsyncBase.vue.d.ts.map +1 -0
  27. package/dist/components/Select/components/SelectAsyncBase.vue.js +5 -0
  28. package/dist/components/Select/components/SelectAsyncBase.vue_vue_type_script_setup_true_lang.js +406 -0
  29. package/dist/components/Select/components/SelectBase.vue.d.ts +52 -0
  30. package/dist/components/Select/components/SelectBase.vue.d.ts.map +1 -0
  31. package/dist/components/Select/components/SelectBase.vue.js +5 -0
  32. package/dist/components/Select/components/SelectBase.vue_vue_type_script_setup_true_lang.js +495 -0
  33. package/dist/components/Select/components/SelectDeferred.vue.d.ts +29 -0
  34. package/dist/components/Select/components/SelectDeferred.vue.d.ts.map +1 -0
  35. package/dist/components/Select/components/SelectDeferred.vue.js +5 -0
  36. package/dist/components/Select/components/SelectDeferred.vue_vue_type_script_setup_true_lang.js +166 -0
  37. package/dist/components/Select/models/useDeferred.d.ts +22 -0
  38. package/dist/components/Select/models/useDeferred.d.ts.map +1 -0
  39. package/dist/components/Select/models/useDeferred.js +69 -0
  40. package/dist/components/Select/types.d.ts +21 -3
  41. package/dist/components/Select/types.d.ts.map +1 -1
  42. package/dist/components/Shine/WShine.vue.d.ts.map +1 -1
  43. package/dist/components/Shine/WShine.vue_vue_type_script_setup_true_lang.js +1 -1
  44. package/dist/components/Shine/WShineEffect.vue.d.ts.map +1 -1
  45. package/dist/components/Shine/WShineEffect.vue_vue_type_script_setup_true_lang.js +1 -1
  46. package/dist/components/Spinner/WSpinner.vue.d.ts.map +1 -1
  47. package/dist/components/Spinner/WSpinner.vue.js +1 -1
  48. package/dist/components/Tabs/WTabs.vue_vue_type_script_setup_true_lang.js +4 -4
  49. package/dist/components/Uniform/use/useUniformModel.d.ts.map +1 -1
  50. package/dist/components/Uniform/use/useUniformModel.js +3 -2
  51. package/dist/components/Uniform/utils/utils.js +2 -2
  52. package/dist/main.js +2 -2
  53. package/dist/utils/useRouteTitle.d.ts +2 -2
  54. package/dist/utils/useRouteTitle.d.ts.map +1 -1
  55. package/dist/utils/useRouteTitle.js +3 -3
  56. package/dist/utils/utils.d.ts +3 -0
  57. package/dist/utils/utils.d.ts.map +1 -1
  58. package/dist/utils/utils.js +5 -2
  59. package/docs/components/select.md +67 -5
  60. package/docs/llms.txt +1 -1
  61. package/package.json +1 -1
  62. package/tailwind-base/base.css +1 -0
  63. package/tailwind-base/css/animations.css +10 -0
  64. package/tailwind-base/css/reduced-motion.css +15 -0
@@ -1,7 +1,9 @@
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 WSelect_default from "./WSelect.vue.js";
4
- import { computed, createBlock, createSlots, defineComponent, guardReactiveProps, mergeProps, normalizeProps, openBlock, renderSlot, toRef, unref, useTemplateRef, watch, withCtx } from "vue";
4
+ import SelectBase_default from "./components/SelectBase.vue.js";
5
+ import SelectDeferred_default from "./components/SelectDeferred.vue.js";
6
+ import { computed, createBlock, createSlots, defineComponent, guardReactiveProps, mergeProps, normalizeClass, normalizeProps, openBlock, renderSlot, toRef, unref, useTemplateRef, watch, withCtx } from "vue";
5
7
  //#region src/components/Select/WSelectSingle.vue?vue&type=script&setup=true&lang.ts
6
8
  var WSelectSingle_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
7
9
  inheritAttrs: false,
@@ -11,6 +13,7 @@ var WSelectSingle_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ de
11
13
  allowClear: { type: Boolean },
12
14
  clearValue: {},
13
15
  createdData: {},
16
+ previewData: {},
14
17
  valueGetter: {},
15
18
  searchFn: {},
16
19
  useQueryFnDefault: {},
@@ -23,6 +26,7 @@ var WSelectSingle_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ de
23
26
  searchModel: { type: Boolean },
24
27
  lazy: { type: Boolean },
25
28
  placeholderEmpty: {},
29
+ deferred: { type: Boolean },
26
30
  mobileTitle: {},
27
31
  persist: { type: Boolean },
28
32
  closeOnClear: { type: Boolean },
@@ -109,6 +113,14 @@ var WSelectSingle_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ de
109
113
  const selectComponentRef = useTemplateRef("selectComponent");
110
114
  const getClearValue = useClearValue(props);
111
115
  const arrayValue = computed(() => props.modelValue !== null && props.modelValue !== void 0 && props.modelValue !== "" ? [props.modelValue] : []);
116
+ const { isDeferred, deferredField, activate, focus } = useDeferred(props, () => selectComponentRef.value?.focus());
117
+ const getOption = (value) => {
118
+ return [
119
+ ...props.options ?? [],
120
+ props.createdData,
121
+ props.previewData
122
+ ].find((option) => option !== void 0 && props.valueGetter(option) === value);
123
+ };
112
124
  const closeOnPick = useCloseOnPick(() => props.embedded ?? false, () => selectComponentRef.value?.close());
113
125
  const updateModelValue = (value, data) => {
114
126
  emit("update:model-value", value, data);
@@ -118,20 +130,61 @@ var WSelectSingle_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ de
118
130
  const blur = () => {
119
131
  selectComponentRef.value?.blur();
120
132
  };
121
- const focus = () => {
122
- selectComponentRef.value?.focus();
123
- };
124
133
  watch(toRef(props, "modelValue"), blur);
125
134
  __expose({
126
135
  blur,
127
136
  focus
128
137
  });
129
138
  return (_ctx, _cache) => {
130
- return openBlock(), createBlock(WSelect_default, mergeProps({ ref: "selectComponent" }, {
139
+ return unref(isDeferred) ? (openBlock(), createBlock(SelectDeferred_default, {
140
+ key: 0,
141
+ "model-value": arrayValue.value,
142
+ "get-option": getOption,
143
+ field: unref(deferredField),
144
+ "option-component": __props.optionComponent,
145
+ "option-component-props": __props.optionComponentProps,
146
+ placeholder: __props.placeholder,
147
+ "placeholder-empty": __props.placeholderEmpty,
148
+ name: __props.name,
149
+ size: __props.size,
150
+ "no-wrap": __props.noWrap,
151
+ "border-class": __props.borderClass,
152
+ "hide-input": __props.hideInput,
153
+ loading: __props.loading,
154
+ class: normalizeClass(_ctx.$attrs.class),
155
+ onActivate: unref(activate)
156
+ }, createSlots({ _: 2 }, [_ctx.$slots.option ? {
157
+ name: "option",
158
+ fn: withCtx((scope) => [renderSlot(_ctx.$slots, "option", normalizeProps(guardReactiveProps(scope)))]),
159
+ key: "0"
160
+ } : void 0, _ctx.$slots.prefix ? {
161
+ name: "chips",
162
+ fn: withCtx(() => [renderSlot(_ctx.$slots, "prefix")]),
163
+ key: "1"
164
+ } : void 0]), 1032, [
165
+ "model-value",
166
+ "field",
167
+ "option-component",
168
+ "option-component-props",
169
+ "placeholder",
170
+ "placeholder-empty",
171
+ "name",
172
+ "size",
173
+ "no-wrap",
174
+ "border-class",
175
+ "hide-input",
176
+ "loading",
177
+ "class",
178
+ "onActivate"
179
+ ])) : (openBlock(), createBlock(SelectBase_default, mergeProps({
180
+ key: 1,
181
+ ref: "selectComponent"
182
+ }, {
131
183
  ...props,
132
184
  modelValue: arrayValue.value,
133
185
  disableClear: !__props.allowClear,
134
- createdData: __props.createdData ? [__props.createdData] : void 0,
186
+ createdData: __props.createdData === void 0 ? void 0 : [__props.createdData],
187
+ previewData: __props.previewData === void 0 ? void 0 : [__props.previewData],
135
188
  hidePrefix: true,
136
189
  cursorSelected: true,
137
190
  filterValue: __props.filterValue === void 0 ? __props.modelValue : __props.filterValue
@@ -177,7 +230,7 @@ var WSelectSingle_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ de
177
230
  fn: withCtx(() => [renderSlot(_ctx.$slots, "content")]),
178
231
  key: "5"
179
232
  } : void 0
180
- ]), 1040, ["class"]);
233
+ ]), 1040, ["class"]));
181
234
  };
182
235
  }
183
236
  });
@@ -22,6 +22,8 @@ var WSelectStringified_vue_vue_type_script_setup_true_lang_default = /*@__PURE__
22
22
  lazy: { type: Boolean },
23
23
  placeholderEmpty: {},
24
24
  cursorSelected: { type: Boolean },
25
+ previewData: {},
26
+ deferred: { type: Boolean },
25
27
  mobileTitle: {},
26
28
  persist: { type: Boolean },
27
29
  closeOnClear: { type: Boolean },
@@ -0,0 +1,54 @@
1
+ import { SelectAsyncProps, SelectOptionComponent, SelectOptionProps } from '../types';
2
+ declare const __VLS_export: <Model extends number | string, Data extends DefaultData, QueryParams, OptionComponent extends SelectOptionComponent<Data>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
3
+ props: import('vue').PublicProps & __VLS_PrettifyLocal<SelectAsyncProps<Model, Data, QueryParams, OptionComponent> & {
4
+ onSelect?: ((item: Model, data: Data) => any) | undefined;
5
+ onBlur?: ((value: FocusEvent) => any) | undefined;
6
+ onFocus?: ((value: FocusEvent | undefined) => any) | undefined;
7
+ "onUpdate:model-value"?: ((value: Model[]) => any) | undefined;
8
+ onUnselect?: ((item: Model, data: Data | undefined) => any) | undefined;
9
+ "onInit-model"?: (() => any) | undefined;
10
+ }> & (typeof globalThis extends {
11
+ __VLS_PROPS_FALLBACK: infer P;
12
+ } ? P : {});
13
+ expose: (exposed: import('vue').ShallowUnwrapRef<{
14
+ focus: () => void;
15
+ blur: () => void;
16
+ close: () => void;
17
+ setSearch: (value: string) => void;
18
+ }>) => void;
19
+ attrs: any;
20
+ slots: {
21
+ /** Replaces the `title` text. */
22
+ title?: () => void;
23
+ /** Content between the title and the field. */
24
+ subtitle?: () => void;
25
+ /** Content to the right of the field. */
26
+ right?: (props: Record<string, never>) => void;
27
+ /** Renders an option, in the menu and in the selected chips — `model` is `true` in a chip. Replaces `optionComponent`. */
28
+ option?: (props: PartialNot<SelectOptionProps<Data>>) => void;
29
+ /** Content at the top of the menu, above the options. */
30
+ content?: () => void;
31
+ /** Replaces the selected chips. */
32
+ prefix?: (props: {
33
+ modelValue: Model[];
34
+ }) => void;
35
+ };
36
+ emit: {
37
+ (e: "select", item: Model, data: Data): void;
38
+ (e: "unselect", item: Model, data: Data | undefined): void;
39
+ (e: "update:model-value", value: Model[]): void;
40
+ (e: "init-model"): void;
41
+ (e: "focus", value: FocusEvent | undefined): void;
42
+ (e: "blur", value: FocusEvent): void;
43
+ };
44
+ }>) => import('vue').VNode & {
45
+ __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
46
+ };
47
+ declare const _default: typeof __VLS_export;
48
+ export default _default;
49
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
50
+ [K in keyof T]: T[K];
51
+ } : {
52
+ [K in keyof T as K]: T[K];
53
+ }) & {};
54
+ //# sourceMappingURL=SelectAsyncBase.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectAsyncBase.vue.d.ts","sourceRoot":"","sources":["../../../../../src/components/Select/components/SelectAsyncBase.vue"],"names":[],"mappings":"AAiJA;AA2XA,OAAO,KAAK,EAAC,gBAAgB,EAAE,qBAAqB,EAA8B,iBAAiB,EAAC,MAAM,UAAU,CAAA;AAcpH,QAAA,MAAM,YAAY,GAAK,KAAK,SAAS,MAAM,GAAG,MAAM,EAAE,IAAI,SAAS,WAAW,EAAE,WAAW,EAAE,eAAe,SAAS,qBAAqB,CAAC,IAAI,CAAC,EAC/I,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;WAonBO,OAAO,KAAK,EAAE,WAAW,GAAG,mBAAmB,CAAC;;;;;;;KAAmC,CAAC,GAAG,CAAC,OAAO,UAAU,SAAS;QAAE,oBAAoB,EA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GAAG,EAAE,CAAC"}
@@ -0,0 +1,5 @@
1
+ import SelectAsyncBase_vue_vue_type_script_setup_true_lang_default from "./SelectAsyncBase.vue_vue_type_script_setup_true_lang.js";
2
+ //#region src/components/Select/components/SelectAsyncBase.vue
3
+ var SelectAsyncBase_default = SelectAsyncBase_vue_vue_type_script_setup_true_lang_default;
4
+ //#endregion
5
+ export { SelectAsyncBase_default as default };
@@ -0,0 +1,406 @@
1
+ import { useIsMobile } from "../../../utils/mobile.js";
2
+ import { useComponentStates } from "../../../utils/useComponentStates.js";
3
+ import WInputSuggest_default from "../../Input/WInputSuggest.vue.js";
4
+ import SelectAsyncList_default from "./SelectAsyncList.vue.js";
5
+ import "../../../utils/useDefaultQuery.js";
6
+ import SelectAsyncPrefix_default from "./SelectAsyncPrefix.vue.js";
7
+ import { computed, createBlock, createCommentVNode, createSlots, defineComponent, effectScope, guardReactiveProps, mergeProps, nextTick, normalizeProps, openBlock, ref, renderSlot, resolveDynamicComponent, shallowRef, unref, useTemplateRef, watch, withCtx, withModifiers } from "vue";
8
+ import { keepPreviousData, useQueryClient } from "@tanstack/vue-query";
9
+ //#region src/components/Select/components/SelectAsyncBase.vue?vue&type=script&setup=true&lang.ts
10
+ var SelectAsyncBase_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
11
+ inheritAttrs: false,
12
+ __name: "SelectAsyncBase",
13
+ props: {
14
+ useQueryFnOptions: {},
15
+ useQueryFnPrefix: {},
16
+ queryParamsOptions: {},
17
+ searchField: {},
18
+ valueGetter: {
19
+ type: Function,
20
+ default: (data) => data.id
21
+ },
22
+ previewData: {},
23
+ valueQueryKey: { default: "id__in" },
24
+ prefixText: {},
25
+ prefixMax: { default: 8 },
26
+ reverse: { type: Boolean },
27
+ modelValue: {},
28
+ useQueryFnDefault: {},
29
+ emptyStub: { default: "No match" },
30
+ disableClear: { type: Boolean },
31
+ hidePrefix: { type: Boolean },
32
+ createOption: {},
33
+ hideOptionIcon: { type: Boolean },
34
+ createdData: {},
35
+ searchModel: { type: Boolean },
36
+ lazy: { type: Boolean },
37
+ placeholderEmpty: {},
38
+ cursorSelected: { type: Boolean },
39
+ deferred: { type: Boolean },
40
+ mobileTitle: {},
41
+ persist: { type: Boolean },
42
+ closeOnClear: { type: Boolean },
43
+ static: { type: Boolean },
44
+ hideToggle: { type: Boolean },
45
+ type: {},
46
+ textarea: { type: Boolean },
47
+ resize: { type: Boolean },
48
+ placeholder: {},
49
+ icon: {},
50
+ size: {},
51
+ maxLength: {},
52
+ maxSizeKb: {},
53
+ step: {},
54
+ min: {},
55
+ max: {},
56
+ name: {},
57
+ autocomplete: {},
58
+ autofocus: { type: [Boolean, Number] },
59
+ readonly: {
60
+ type: Boolean,
61
+ default: void 0
62
+ },
63
+ disabledActions: { type: Boolean },
64
+ loading: { type: Boolean },
65
+ spellcheck: { type: Boolean },
66
+ customBackspaceHandle: { type: Boolean },
67
+ textSecure: { type: Boolean },
68
+ placeholderSecure: { type: Boolean },
69
+ allowPaste: { type: Boolean },
70
+ hideInput: { type: Boolean },
71
+ noWrap: { type: Boolean },
72
+ textTransparent: { type: Boolean },
73
+ textParts: {},
74
+ rich: { type: Boolean },
75
+ toolbarActions: {},
76
+ borderClass: {},
77
+ explicit: { type: Boolean },
78
+ title: {},
79
+ titleIcon: {},
80
+ description: {},
81
+ errorMessage: {},
82
+ tooltipText: {},
83
+ mono: { type: Boolean },
84
+ hasChanges: { type: Boolean },
85
+ skeleton: {
86
+ type: Boolean,
87
+ default: void 0
88
+ },
89
+ disabled: {
90
+ type: Boolean,
91
+ default: void 0
92
+ },
93
+ required: { type: Boolean },
94
+ noMargin: { type: Boolean },
95
+ allowCopy: { type: Boolean },
96
+ leftError: { type: Boolean },
97
+ filterField: {},
98
+ filterValue: {},
99
+ subgrid: { type: Boolean },
100
+ seamless: { type: Boolean },
101
+ topText: { type: Boolean },
102
+ allowDropFile: { type: Boolean },
103
+ hideTitle: { type: Boolean },
104
+ embedded: { type: Boolean },
105
+ horizontalAlign: {},
106
+ dropdownClass: {},
107
+ optionComponent: {},
108
+ optionComponentProps: {}
109
+ },
110
+ emits: [
111
+ "select",
112
+ "unselect",
113
+ "update:model-value",
114
+ "init-model",
115
+ "focus",
116
+ "blur"
117
+ ],
118
+ setup(__props, { expose: __expose, emit: __emit }) {
119
+ const props = __props;
120
+ const emit = __emit;
121
+ const { isReadonly, isDisabled } = useComponentStates(props);
122
+ const { isMobile } = useIsMobile();
123
+ const isOpen = ref(false);
124
+ const inputRef = useTemplateRef("input");
125
+ const listRef = useTemplateRef("list");
126
+ const focused = ref(false);
127
+ const isFetchingPrefix = ref(false);
128
+ const search = ref("");
129
+ const loadingCreate = ref(false);
130
+ const knownData = /* @__PURE__ */ new Map();
131
+ const queryFnKeys = /* @__PURE__ */ new WeakMap();
132
+ let queryFnKeyLast = 0;
133
+ const getQueryFnKey = (useQueryFn) => {
134
+ if (!queryFnKeys.has(useQueryFn)) queryFnKeys.set(useQueryFn, ++queryFnKeyLast);
135
+ return queryFnKeys.get(useQueryFn);
136
+ };
137
+ const isDisabledComputed = computed(() => props.loading || isReadonly.value || isDisabled.value);
138
+ const isModelValueSearch = computed(() => !!search.value && props.modelValue?.includes(search.value));
139
+ const queryParams = computed(() => ({
140
+ ...props.queryParamsOptions,
141
+ [props.searchField ?? "search"]: search.value
142
+ }));
143
+ const queryParamsFirstPage = computed(() => ({
144
+ ...queryParams.value,
145
+ size: 24,
146
+ page: 1
147
+ }));
148
+ const queryEnabled = computed(() => props.lazy ? isOpen.value : true);
149
+ const queryClient = useQueryClient();
150
+ const firstPageData = shallowRef();
151
+ watch(() => props.useQueryFnOptions, (useQueryFn, _, onCleanup) => {
152
+ const scope = effectScope();
153
+ scope.run(() => {
154
+ const { data } = useQueryFn(queryParamsFirstPage, { enabled: queryEnabled }, queryClient);
155
+ watch(data, (value) => firstPageData.value = value, { immediate: true });
156
+ });
157
+ onCleanup(() => scope.stop());
158
+ }, { immediate: true });
159
+ const hasSearchOption = computed(() => {
160
+ if (props.createdData?.some((option) => props.valueGetter(option) === search.value)) return true;
161
+ return firstPageData.value?.results.some((option) => props.valueGetter(option) === search.value);
162
+ });
163
+ const close = () => {
164
+ isOpen.value = false;
165
+ focused.value = false;
166
+ if (props.searchModel && search.value && !isModelValueSearch.value) {
167
+ const optionExact = firstPageData.value?.results.find((option) => props.valueGetter(option) === search.value);
168
+ if (optionExact) select(props.valueGetter(optionExact), optionExact);
169
+ else if (search.value) create(search.value);
170
+ else if (props.modelValue?.length) {
171
+ const last = props.modelValue[props.modelValue.length - 1];
172
+ unselect(last, firstPageData.value?.results.find((option) => props.valueGetter(option) === last));
173
+ }
174
+ }
175
+ search.value = "";
176
+ };
177
+ let deletePressTimeout = null;
178
+ const captureDoubleDelete = () => {
179
+ if (!props.modelValue?.length || search.value.length) return;
180
+ if (deletePressTimeout) {
181
+ const last = props.modelValue[props.modelValue.length - 1];
182
+ unselect(last, firstPageData.value?.results.find((option) => props.valueGetter(option) === last));
183
+ clearTimeout(deletePressTimeout);
184
+ deletePressTimeout = null;
185
+ } else deletePressTimeout = setTimeout(() => {
186
+ deletePressTimeout = null;
187
+ }, 500);
188
+ };
189
+ const select = (item, data) => {
190
+ if (isDisabledComputed.value) return;
191
+ knownData.set(String(item), data);
192
+ emit("select", item, data);
193
+ search.value = "";
194
+ };
195
+ const unselect = (item, data) => {
196
+ if (isDisabledComputed.value) return;
197
+ emit("unselect", item, data);
198
+ search.value = "";
199
+ };
200
+ const create = async (value) => {
201
+ if (isDisabledComputed.value) return;
202
+ if (!props.createOption) return;
203
+ loadingCreate.value = true;
204
+ const option = await props.createOption(value);
205
+ if (option) {
206
+ select(props.valueGetter(option), option);
207
+ search.value = "";
208
+ }
209
+ loadingCreate.value = false;
210
+ };
211
+ const updateSelected = (value) => {
212
+ if (isDisabledComputed.value) return;
213
+ emit("update:model-value", value);
214
+ search.value = "";
215
+ };
216
+ const focus = () => {
217
+ inputRef.value?.focus();
218
+ };
219
+ const blur = () => {
220
+ inputRef.value?.blur();
221
+ };
222
+ const closeMenu = () => {
223
+ inputRef.value?.close();
224
+ };
225
+ const setSearch = (value) => {
226
+ search.value = value;
227
+ };
228
+ if (props.useQueryFnDefault) {
229
+ const { data: defaultData } = props.useQueryFnDefault(void 0, { enabled: computed(() => !props.disabled) });
230
+ watch(defaultData, (value) => {
231
+ if (value && props.modelValue?.length === 0) {
232
+ select(props.valueGetter(value), value);
233
+ emit("init-model");
234
+ }
235
+ }, { immediate: true });
236
+ }
237
+ watch(() => props.modelValue, async () => {
238
+ await nextTick();
239
+ if (props.seamless) inputRef.value?.scrollToInput();
240
+ });
241
+ __expose({
242
+ focus,
243
+ blur,
244
+ close: closeMenu,
245
+ setSearch
246
+ });
247
+ return (_ctx, _cache) => {
248
+ return openBlock(), createBlock(WInputSuggest_default, mergeProps({ ref: "input" }, {
249
+ ...props,
250
+ modelValue: search.value,
251
+ placeholder: !focused.value && !__props.modelValue?.length ? __props.placeholderEmpty ?? __props.placeholder : __props.placeholder,
252
+ loading: __props.loading || isFetchingPrefix.value || loadingCreate.value,
253
+ hideInput: !__props.modelValue?.length ? __props.hideInput && !isOpen.value : unref(isMobile) ? !focused.value : !isOpen.value,
254
+ filterValue: __props.filterValue === void 0 ? __props.modelValue : __props.filterValue
255
+ }, {
256
+ class: _ctx.$attrs.class,
257
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => !__props.loading && !isFetchingPrefix.value && (search.value = $event ?? "")),
258
+ "onKeypress:enter": _cache[3] || (_cache[3] = withModifiers(($event) => listRef.value?.selectCursor(), ["stop", "prevent"])),
259
+ "onKeypress:up": _cache[4] || (_cache[4] = withModifiers(($event) => listRef.value?.cursorUp(), ["prevent"])),
260
+ "onKeypress:down": _cache[5] || (_cache[5] = withModifiers(($event) => listRef.value?.cursorDown(), ["prevent"])),
261
+ "onKeypress:delete": captureDoubleDelete,
262
+ onOpen: _cache[6] || (_cache[6] = ($event) => isOpen.value = true),
263
+ onClose: close,
264
+ onFocus: _cache[7] || (_cache[7] = ($event) => {
265
+ focused.value = true;
266
+ _ctx.$emit("focus", $event);
267
+ }),
268
+ onBlur: _cache[8] || (_cache[8] = ($event) => {
269
+ focused.value = false;
270
+ _ctx.$emit("blur", $event);
271
+ })
272
+ }), createSlots({
273
+ 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, {
274
+ key: getQueryFnKey(__props.useQueryFnPrefix ?? __props.useQueryFnOptions),
275
+ "use-query-fn": __props.useQueryFnPrefix ?? __props.useQueryFnOptions,
276
+ "model-value": __props.modelValue ?? [],
277
+ disabled: unref(isDisabled),
278
+ loading: __props.loading || isFetchingPrefix.value,
279
+ "option-component": __props.optionComponent,
280
+ "option-component-props": __props.optionComponentProps,
281
+ "disable-clear": __props.disableClear || unref(isReadonly) || __props.seamless && !focused.value || __props.modelValue?.length === 0,
282
+ "preview-data": __props.previewData,
283
+ "created-data": __props.createdData,
284
+ "value-getter": __props.valueGetter,
285
+ "value-query-key": __props.valueQueryKey,
286
+ readonly: unref(isReadonly),
287
+ "prefix-text": __props.prefixText,
288
+ "prefix-max": __props.prefixMax,
289
+ "known-data": unref(knownData),
290
+ onUnselect: unselect,
291
+ "onUpdate:fetching": _cache[0] || (_cache[0] = ($event) => isFetchingPrefix.value = $event),
292
+ "onUpdate:modelValue": updateSelected
293
+ }, createSlots({ _: 2 }, [_ctx.$slots.option ? {
294
+ name: "option",
295
+ fn: withCtx(({ option, index, skeleton: skeletonOption }) => [renderSlot(_ctx.$slots, "option", {
296
+ option,
297
+ index,
298
+ selected: true,
299
+ model: true,
300
+ skeleton: skeletonOption,
301
+ search: void 0
302
+ })]),
303
+ key: "0"
304
+ } : void 0]), 1032, [
305
+ "use-query-fn",
306
+ "model-value",
307
+ "disabled",
308
+ "loading",
309
+ "option-component",
310
+ "option-component-props",
311
+ "disable-clear",
312
+ "preview-data",
313
+ "created-data",
314
+ "value-getter",
315
+ "value-query-key",
316
+ "readonly",
317
+ "prefix-text",
318
+ "prefix-max",
319
+ "known-data"
320
+ ]))], void 0, 0) : createCommentVNode("", true)]),
321
+ content: withCtx(() => [(openBlock(), createBlock(SelectAsyncList_default, {
322
+ key: getQueryFnKey(__props.useQueryFnOptions),
323
+ ref: "list",
324
+ "model-value": __props.modelValue ?? [],
325
+ "use-query-fn": __props.useQueryFnOptions,
326
+ "query-params": queryParams.value,
327
+ loading: __props.loading || isFetchingPrefix.value,
328
+ disabled: isDisabledComputed.value,
329
+ "empty-stub": !search.value && __props.emptyStub ? __props.emptyStub : void 0,
330
+ "allow-create": __props.createOption && (!hasSearchOption.value || isModelValueSearch.value),
331
+ "hide-option-icon": __props.hideOptionIcon,
332
+ "value-getter": __props.valueGetter,
333
+ "loading-create": loadingCreate.value,
334
+ "query-options": { placeholderData: unref(keepPreviousData) },
335
+ search: search.value,
336
+ reverse: __props.reverse,
337
+ "scroll-selected": isOpen.value,
338
+ "cursor-selected": __props.cursorSelected,
339
+ onSelect: select,
340
+ onUnselect: unselect,
341
+ "onCreate:option": _cache[1] || (_cache[1] = ($event) => create(search.value))
342
+ }, createSlots({
343
+ default: withCtx(({ option, selected, skeleton: skeletonList, index }) => [renderSlot(_ctx.$slots, "option", {
344
+ option,
345
+ selected,
346
+ skeleton: skeletonList,
347
+ model: false,
348
+ search: search.value,
349
+ index
350
+ }, () => [(openBlock(), createBlock(resolveDynamicComponent(__props.optionComponent), mergeProps(__props.optionComponentProps, {
351
+ option,
352
+ selected,
353
+ skeleton: skeletonList,
354
+ model: false,
355
+ search: search.value
356
+ }), null, 16, [
357
+ "option",
358
+ "selected",
359
+ "skeleton",
360
+ "search"
361
+ ]))])]),
362
+ _: 2
363
+ }, [_ctx.$slots.content ? {
364
+ name: "content",
365
+ fn: withCtx(() => [renderSlot(_ctx.$slots, "content")]),
366
+ key: "0"
367
+ } : void 0]), 1032, [
368
+ "model-value",
369
+ "use-query-fn",
370
+ "query-params",
371
+ "loading",
372
+ "disabled",
373
+ "empty-stub",
374
+ "allow-create",
375
+ "hide-option-icon",
376
+ "value-getter",
377
+ "loading-create",
378
+ "query-options",
379
+ "search",
380
+ "reverse",
381
+ "scroll-selected",
382
+ "cursor-selected"
383
+ ]))]),
384
+ _: 2
385
+ }, [
386
+ _ctx.$slots.title ? {
387
+ name: "title",
388
+ fn: withCtx(() => [renderSlot(_ctx.$slots, "title")]),
389
+ key: "0"
390
+ } : void 0,
391
+ _ctx.$slots.subtitle ? {
392
+ name: "subtitle",
393
+ fn: withCtx(() => [renderSlot(_ctx.$slots, "subtitle")]),
394
+ key: "1"
395
+ } : void 0,
396
+ _ctx.$slots.right ? {
397
+ name: "right",
398
+ fn: withCtx(() => [renderSlot(_ctx.$slots, "right")]),
399
+ key: "2"
400
+ } : void 0
401
+ ]), 1040, ["class"]);
402
+ };
403
+ }
404
+ });
405
+ //#endregion
406
+ export { SelectAsyncBase_vue_vue_type_script_setup_true_lang_default as default };
@@ -0,0 +1,52 @@
1
+ import { SelectOptionComponent, SelectOptionProps, SelectProps } from '../types';
2
+ declare const __VLS_export: <Model extends number | string, Data extends DefaultData, QueryParamsOptions, OptionComponent extends SelectOptionComponent<Data>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
3
+ props: import('vue').PublicProps & __VLS_PrettifyLocal<SelectProps<Model, Data, QueryParamsOptions, OptionComponent> & {
4
+ onSelect?: ((item: Model, data: Data) => any) | undefined;
5
+ onBlur?: ((value: FocusEvent) => any) | undefined;
6
+ onFocus?: ((value: FocusEvent | undefined) => any) | undefined;
7
+ onUnselect?: ((item: Model, data: Data | undefined) => any) | undefined;
8
+ "onInit-model"?: (() => any) | undefined;
9
+ "onUpdate:query-options-error"?: ((value: string | undefined) => any) | undefined;
10
+ }> & (typeof globalThis extends {
11
+ __VLS_PROPS_FALLBACK: infer P;
12
+ } ? P : {});
13
+ expose: (exposed: import('vue').ShallowUnwrapRef<{
14
+ focus: () => void;
15
+ blur: () => void;
16
+ close: () => void;
17
+ setSearch: (value: string) => void;
18
+ }>) => void;
19
+ attrs: any;
20
+ slots: {
21
+ /** Replaces the `title` text. */
22
+ title?: () => void;
23
+ /** Content between the title and the field. */
24
+ subtitle?: () => void;
25
+ /** Renders an option, in the menu and in the selected chips — `model` is `true` in a chip. Replaces `optionComponent`. */
26
+ option?: (props: PartialNot<SelectOptionProps<Data>>) => void;
27
+ /** Content to the right of the field. */
28
+ right?: () => void;
29
+ /** Replaces the selected chips. */
30
+ prefix?: () => void;
31
+ /** Content at the top of the menu, above the options. */
32
+ content?: () => void;
33
+ };
34
+ emit: {
35
+ (e: "select", item: Model, data: Data): void;
36
+ (e: "unselect", item: Model, data: Data | undefined): void;
37
+ (e: "focus", value: FocusEvent | undefined): void;
38
+ (e: "blur", value: FocusEvent): void;
39
+ (e: "update:query-options-error", value: string | undefined): void;
40
+ (e: "init-model"): void;
41
+ };
42
+ }>) => import('vue').VNode & {
43
+ __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
44
+ };
45
+ declare const _default: typeof __VLS_export;
46
+ export default _default;
47
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
48
+ [K in keyof T]: T[K];
49
+ } : {
50
+ [K in keyof T as K]: T[K];
51
+ }) & {};
52
+ //# sourceMappingURL=SelectBase.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectBase.vue.d.ts","sourceRoot":"","sources":["../../../../../src/components/Select/components/SelectBase.vue"],"names":[],"mappings":"AA4LA;AAshBA,OAAO,KAAK,EAAC,qBAAqB,EAA8B,iBAAiB,EAAE,WAAW,EAAC,MAAM,UAAU,CAAA;A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4B,SAAS,MAAM,GAAG,SAAS,GAAG,IAAI;YAE9D,YAAY,GAAG,IAAI;;EAqzBrB,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"}
@@ -0,0 +1,5 @@
1
+ import SelectBase_vue_vue_type_script_setup_true_lang_default from "./SelectBase.vue_vue_type_script_setup_true_lang.js";
2
+ //#region src/components/Select/components/SelectBase.vue
3
+ var SelectBase_default = SelectBase_vue_vue_type_script_setup_true_lang_default;
4
+ //#endregion
5
+ export { SelectBase_default as default };