eco-vue-js 0.8.15 → 0.8.17
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/components/Button/WButtonGroup.vue.d.ts +3 -3
- package/dist/components/Button/WButtonGroup.vue.d.ts.map +1 -1
- package/dist/components/Button/WButtonGroup.vue.js +9 -4
- package/dist/components/Button/types.d.ts +1 -1
- package/dist/components/FormAsync/WFormAsyncButtonGroup.vue.js +1 -1
- package/dist/components/FormAsync/WFormAsyncSelect.vue.js +0 -1
- package/dist/components/FormAsync/WFormAsyncSelectInfiniteSingle.vue.js +0 -1
- package/dist/components/FormAsync/WFormAsyncSelectSingle.vue.js +0 -1
- package/dist/components/FormAsync/WFormAsyncSelectStringified.vue.js +0 -1
- package/dist/components/InfiniteList/components/InfiniteListPage.vue.js +1 -1
- package/dist/components/Input/WInput.vue.js +9 -9
- package/dist/components/Select/WSelect.vue.d.ts +3 -1
- package/dist/components/Select/WSelect.vue.d.ts.map +1 -1
- package/dist/components/Select/WSelect.vue.js +34 -19
- package/dist/components/Select/WSelectAsync.vue.d.ts +3 -1
- package/dist/components/Select/WSelectAsync.vue.d.ts.map +1 -1
- package/dist/components/Select/WSelectAsync.vue.js +12 -6
- package/dist/components/Select/WSelectAsyncList.vue.d.ts +1 -1
- package/dist/components/Select/WSelectAsyncSingle.vue.d.ts +6 -2
- package/dist/components/Select/WSelectAsyncSingle.vue.d.ts.map +1 -1
- package/dist/components/Select/WSelectAsyncSingle.vue.js +3 -3
- package/dist/components/Select/WSelectSingle.vue.d.ts +3 -1
- package/dist/components/Select/WSelectSingle.vue.d.ts.map +1 -1
- package/dist/components/Select/WSelectSingle.vue.js +3 -3
- package/dist/components/Select/WSelectStringified.vue.d.ts +3 -1
- package/dist/components/Select/WSelectStringified.vue.d.ts.map +1 -1
- package/dist/components/Select/WSelectStringified.vue.js +4 -5
- package/dist/components/Select/types.d.ts +0 -3
- package/dist/components/Select/types.d.ts.map +1 -1
- package/dist/types/global.d.ts +1 -1
- package/package.json +1 -1
- package/tailwind-base/theme/sizes.cjs +3 -0
@@ -3,8 +3,8 @@ declare const _default: <Model extends number | string | null | boolean, Entity
|
|
3
3
|
fn(value: Entity): Model;
|
4
4
|
}["fn"] | undefined = undefined>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
5
5
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
6
|
-
readonly "onUpdate:
|
7
|
-
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onUpdate:
|
6
|
+
readonly "onUpdate:model-value"?: ((value: Model) => any) | undefined;
|
7
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onUpdate:model-value"> & ButtonGroupProps<Model, Entity, ValueGetter>> & import('vue').PublicProps;
|
8
8
|
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
9
9
|
attrs: any;
|
10
10
|
slots: {
|
@@ -15,7 +15,7 @@ declare const _default: <Model extends number | string | null | boolean, Entity
|
|
15
15
|
}): any;
|
16
16
|
right?(_: {}): any;
|
17
17
|
};
|
18
|
-
emit: (e: "update:
|
18
|
+
emit: (e: "update:model-value", value: Model) => void;
|
19
19
|
}>) => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
20
20
|
[key: string]: any;
|
21
21
|
}> & {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"WButtonGroup.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Button/WButtonGroup.vue"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"WButtonGroup.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Button/WButtonGroup.vue"],"names":[],"mappings":"AA2FA,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,SAAS,CAAA;yBAG5B,KAAK,SAAS,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,OAAO,EAAE,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,SAAS;IAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,CAAA;CAAC,CAAC,IAAI,CAAC,GAAG,SAAS,2BAC3J,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,cAClD,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,iBAC5F,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC;WAqKxD,mBAAmB,CAAC;;2LAAyD,CAAC,4BAA2B;oBAChG,OAAO,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI;WAClD,GAAG;;uBAjCc,GAAG;;;;YACD,GAAG;uBACJ,GAAG;;cA/HzB,oBAAoB,SAAS,KAAK,KAAG,IAAI;;;;YAmKH,OAAO,CAAC,OAAO,WAAW,CAAC;;AA/KvE,wBA+K4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
|
@@ -17,7 +17,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
17
17
|
col: { type: Boolean },
|
18
18
|
semanticType: {},
|
19
19
|
stretch: { type: Boolean },
|
20
|
-
|
20
|
+
allowClear: { type: Boolean },
|
21
21
|
title: {},
|
22
22
|
description: {},
|
23
23
|
errorMessage: {},
|
@@ -31,9 +31,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
31
31
|
noMargin: { type: Boolean },
|
32
32
|
allowCopy: { type: Boolean }
|
33
33
|
},
|
34
|
-
emits: ["update:
|
35
|
-
setup(__props) {
|
34
|
+
emits: ["update:model-value"],
|
35
|
+
setup(__props, { emit: __emit }) {
|
36
36
|
const props = __props;
|
37
|
+
const emit = __emit;
|
37
38
|
const getValue = (item) => {
|
38
39
|
if (props.valueGetter && typeof item === "object") {
|
39
40
|
return props.valueGetter(item);
|
@@ -41,6 +42,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
41
42
|
return item;
|
42
43
|
}
|
43
44
|
};
|
45
|
+
const updateModelValue = (value) => {
|
46
|
+
if (value !== props.modelValue) emit("update:model-value", value);
|
47
|
+
else if (props.allowClear) emit("update:model-value", null);
|
48
|
+
};
|
44
49
|
return (_ctx, _cache) => {
|
45
50
|
return openBlock(), createBlock(_sfc_main$1, mergeProps(props, {
|
46
51
|
class: _ctx.$attrs.class
|
@@ -64,7 +69,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
64
69
|
class: normalizeClass({
|
65
70
|
"flex-1": _ctx.stretch
|
66
71
|
}),
|
67
|
-
onClick: ($event) => (
|
72
|
+
onClick: ($event) => updateModelValue(getValue(item))
|
68
73
|
}, {
|
69
74
|
default: withCtx(() => [
|
70
75
|
renderSlot(_ctx.$slots, "option", {
|
@@ -15,7 +15,7 @@ interface ButtonGroupPropsBase<Model extends number | string | null | boolean> e
|
|
15
15
|
col?: boolean;
|
16
16
|
semanticType?: SemanticType;
|
17
17
|
stretch?: boolean;
|
18
|
-
|
18
|
+
allowClear?: boolean;
|
19
19
|
}
|
20
20
|
interface ButtonGroupPropsForModel<Model extends number | string | null | boolean, Entity extends Record<string, unknown>, ValueGetter extends {
|
21
21
|
fn(value: Entity): Model;
|
@@ -15,7 +15,7 @@ import '../../Input/WInputDate.vue.js';
|
|
15
15
|
import '../../Link/WLink.vue.js';
|
16
16
|
import '@tanstack/vue-query';
|
17
17
|
|
18
|
-
const _hoisted_1 = { class: "select-none cursor-default
|
18
|
+
const _hoisted_1 = { class: "select-none cursor-default py-1.25 sm-not:px-3" };
|
19
19
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
20
20
|
__name: "InfiniteListPage",
|
21
21
|
props: {
|
@@ -8,7 +8,7 @@ const _hoisted_1 = {
|
|
8
8
|
key: 0,
|
9
9
|
class: "flex items-center w-11 h-full justify-center text-description select-none"
|
10
10
|
};
|
11
|
-
const _hoisted_2 = { class: "
|
11
|
+
const _hoisted_2 = { class: "flex flex-wrap gap-1" };
|
12
12
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
13
13
|
...{ inheritAttrs: false },
|
14
14
|
__name: "WInput",
|
@@ -189,12 +189,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
189
189
|
_ctx.icon ? (openBlock(), createElementBlock("div", _hoisted_1, [
|
190
190
|
(openBlock(), createBlock(resolveDynamicComponent(_ctx.icon), { class: "square-5" }))
|
191
191
|
])) : createCommentVNode("", true),
|
192
|
-
createElementVNode("div",
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
192
|
+
createElementVNode("div", {
|
193
|
+
class: normalizeClass(["col-start-2 grid grid-cols-1 group/input", {
|
194
|
+
"py-1 first:pl-1 last:pr-1": _ctx.$slots.prefix
|
195
|
+
}])
|
196
|
+
}, [
|
197
|
+
createElementVNode("div", _hoisted_2, [
|
198
198
|
renderSlot(_ctx.$slots, "prefix"),
|
199
199
|
(openBlock(), createBlock(resolveDynamicComponent(_ctx.textarea ? "textarea" : "input"), {
|
200
200
|
id,
|
@@ -245,8 +245,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
245
245
|
onMousedown: _cache[5] || (_cache[5] = withModifiers(($event) => _ctx.$emit("mousedown", $event), ["stop"])),
|
246
246
|
onSelect: _cache[6] || (_cache[6] = withModifiers(($event) => _ctx.$emit("select:input", $event), ["stop"]))
|
247
247
|
}, null, 40, ["id", "class", "value", "placeholder", "type", "name", "disabled", "readonly", "autocomplete", "size", "spellcheck", "onFocus", "onBlur"]))
|
248
|
-
]
|
249
|
-
]),
|
248
|
+
])
|
249
|
+
], 2),
|
250
250
|
createVNode(_sfc_main$2, {
|
251
251
|
"model-value": _ctx.modelValue,
|
252
252
|
loading: _ctx.loading,
|
@@ -5,8 +5,9 @@ declare const _default: <Model extends number | string, Data extends DefaultData
|
|
5
5
|
readonly onBlur?: ((value: FocusEvent) => any) | undefined;
|
6
6
|
readonly onFocus?: ((value: FocusEvent) => any) | undefined;
|
7
7
|
readonly onUnselect?: ((item: Model) => any) | undefined;
|
8
|
+
readonly "onInit-model"?: (() => any) | undefined;
|
8
9
|
readonly "onUpdate:query-options-error"?: ((value: string | undefined) => any) | undefined;
|
9
|
-
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onFocus" | "onBlur" | "onSelect" | "onUnselect" | "onUpdate:query-options-error"> & SelectProps<Model, Data, QueryParamsOptions, OptionComponent>> & import('vue').PublicProps;
|
10
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onFocus" | "onBlur" | "onSelect" | "onUnselect" | "onInit-model" | "onUpdate:query-options-error"> & SelectProps<Model, Data, QueryParamsOptions, OptionComponent>> & import('vue').PublicProps;
|
10
11
|
expose(exposed: import('vue').ShallowUnwrapRef<{
|
11
12
|
focus: () => void;
|
12
13
|
blur: () => void;
|
@@ -42,6 +43,7 @@ declare const _default: <Model extends number | string, Data extends DefaultData
|
|
42
43
|
(e: "focus", value: FocusEvent): void;
|
43
44
|
(e: "blur", value: FocusEvent): void;
|
44
45
|
(e: "update:query-options-error", value: string | undefined): void;
|
46
|
+
(e: "init-model"): void;
|
45
47
|
};
|
46
48
|
}>) => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
47
49
|
[key: string]: any;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"WSelect.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Select/WSelect.vue"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"WSelect.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Select/WSelect.vue"],"names":[],"mappings":"AAqZA,OAAO,KAAK,EAAC,WAAW,EAAE,qBAAqB,EAA6B,MAAM,SAAS,CAAA;yBAI1E,KAAK,SAAS,MAAM,GAAG,MAAM,EAAE,IAAI,SAAS,WAAW,EAAE,kBAAkB,EAAE,eAAe,SAAS,qBAAqB,CAAC,IAAI,CAAC,eACnI,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,cAClD,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,iBAC5F,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC;WAgqBxD,mBAAmB,CAAC;;;;;;;wRAAyD,CAAC,4BAA2B;oBAChG,OAAO,KAAK,EAAE,gBAAgB;;;2BApevB,MAAM,KAAG,IAAI;MAoegC,GAAG,IAAI;WACpE,GAAG;;gBAxbH,MAAM,IAAI;mBACP,MAAM,IAAI;iBACZ,CAAC,KAAK,EAAE;YACf,MAAM,EAAE,IAAI,GAAG,IAAI,CAAA;YACnB,KAAK,CAAC,EAAE,MAAM,CAAA;YACd,QAAQ,EAAE,OAAO,CAAA;YACjB,KAAK,EAAE,OAAO,CAAA;YACd,MAAM,CAAC,EAAE,MAAM,CAAA;SAChB,KAAK,IAAI;gBACF,MAAM,IAAI;;gBATV,MAAM,IAAI;mBACP,MAAM,IAAI;iBACZ,CAAC,KAAK,EAAE;YACf,MAAM,EAAE,IAAI,GAAG,IAAI,CAAA;YACnB,KAAK,CAAC,EAAE,MAAM,CAAA;YACd,QAAQ,EAAE,OAAO,CAAA;YACjB,KAAK,EAAE,OAAO,CAAA;YACd,MAAM,CAAC,EAAE,MAAM,CAAA;SAChB,KAAK,IAAI;gBACF,MAAM,IAAI;;;YA1Od,QAAQ,QAAQ,KAAK,GAAG,IAAI;YAC5B,UAAU,QAAQ,KAAK,GAAG,IAAI;YAC9B,OAAO,SAAS,UAAU,GAAG,IAAI;YACjC,MAAM,SAAS,UAAU,GAAG,IAAI;YAChC,4BAA4B,SAAS,MAAM,GAAG,SAAS,GAAG,IAAI;YAC9D,YAAY,GAAG,IAAI;;;;;YAypBmB,OAAO,CAAC,OAAO,WAAW,CAAC;;AA1qBvE,wBA0qB4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
|
@@ -65,34 +65,38 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
65
65
|
optionComponentProps: {},
|
66
66
|
useQueryFnOptions: {},
|
67
67
|
queryParamsOptions: {},
|
68
|
-
noParamsOptions: { type: Boolean },
|
69
68
|
options: {}
|
70
69
|
},
|
71
|
-
emits: ["select", "unselect", "focus", "blur", "update:query-options-error"],
|
70
|
+
emits: ["select", "unselect", "focus", "blur", "update:query-options-error", "init-model"],
|
72
71
|
setup(__props, { expose: __expose, emit: __emit }) {
|
73
72
|
const props = __props;
|
74
73
|
const emit = __emit;
|
75
74
|
const isOpen = ref(false);
|
76
75
|
const input = ref();
|
77
|
-
const cursor = ref(
|
76
|
+
const cursor = ref(0);
|
78
77
|
const isCursorLocked = ref(false);
|
79
78
|
const search = ref("");
|
80
79
|
const searchPrepared = computed(() => search.value.trim().toLocaleLowerCase());
|
81
80
|
const enabled = computed(() => !props.disabled);
|
82
|
-
const { data, isLoading, error: queryError } = props.useQueryFnOptions ? props.
|
81
|
+
const { data, isLoading, error: queryError } = props.useQueryFnOptions ? !props.queryParamsOptions ? props.useQueryFnOptions({ enabled }) : props.useQueryFnOptions(toRef(props, "queryParamsOptions"), { enabled }) : {
|
83
82
|
data: toRef(props, "options"),
|
84
83
|
isLoading: ref(false),
|
85
84
|
error: ref(void 0)
|
86
85
|
};
|
86
|
+
const createdOptions = ref([]);
|
87
87
|
const optionsPrepared = computed(() => !data.value ? [] : props.filterOptions ? data.value.filter((option) => props.filterOptions?.(option) ?? true) : data.value);
|
88
|
-
const
|
88
|
+
const optionsWithCreated = computed(() => [
|
89
|
+
...optionsPrepared.value,
|
90
|
+
...createdOptions.value.filter((option) => !optionsPrepared.value.some((item) => props.valueGetter(item) === props.valueGetter(option)))
|
91
|
+
]);
|
92
|
+
const optionsFiltered = computed(() => searchPrepared.value === "" ? optionsWithCreated.value : optionsWithCreated.value.filter((option) => props.searchFn(option, searchPrepared.value)));
|
89
93
|
const lastIndex = computed(() => props.createOption ? optionsFiltered.value.length : optionsFiltered.value.length - 1);
|
90
94
|
const isMobile = getIsMobile();
|
91
95
|
const focused = ref(false);
|
92
96
|
const loadingOptionIndex = ref(null);
|
93
97
|
const loadingCreate = ref(false);
|
94
98
|
const isDisabled = computed(() => props.loading || props.readonly || props.disabled);
|
95
|
-
const prefixList = computed(() => props.modelValue.map((value) =>
|
99
|
+
const prefixList = computed(() => props.modelValue.map((value) => optionsWithCreated.value?.find((item) => props.valueGetter(item) === value)).filter((item) => item !== void 0));
|
96
100
|
const close = () => {
|
97
101
|
isOpen.value = false;
|
98
102
|
focused.value = false;
|
@@ -124,14 +128,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
124
128
|
};
|
125
129
|
const selectCursor = () => {
|
126
130
|
if (isDisabled.value) return;
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
if (props.modelValue.includes(value)) unselect(value);
|
131
|
-
else select(value);
|
132
|
-
} else {
|
133
|
-
if (search.value) createOption(search.value);
|
131
|
+
if (cursor.value === optionsFiltered.value.length) {
|
132
|
+
if (search.value && props.createOption) create(search.value);
|
133
|
+
return;
|
134
134
|
}
|
135
|
+
const option = cursor.value !== -1 ? optionsFiltered.value[cursor.value] : void 0;
|
136
|
+
const value = option ? props.valueGetter(option) : void 0;
|
137
|
+
if (!value) return;
|
138
|
+
setLoadingOptionIndex(cursor.value);
|
139
|
+
if (props.modelValue.includes(value)) unselect(value);
|
140
|
+
else select(value);
|
135
141
|
};
|
136
142
|
let deletePressTimeout = null;
|
137
143
|
const captureDoubleDelete = () => {
|
@@ -155,13 +161,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
155
161
|
if (isDisabled.value) return;
|
156
162
|
emit("unselect", item);
|
157
163
|
search.value = "";
|
164
|
+
const index = createdOptions.value.findIndex((option) => props.valueGetter(option) === item);
|
165
|
+
if (index !== -1) createdOptions.value.splice(index, 1);
|
158
166
|
};
|
159
|
-
const
|
167
|
+
const create = async (value) => {
|
160
168
|
if (isDisabled.value) return;
|
161
169
|
if (!props.createOption) return;
|
162
170
|
loadingCreate.value = true;
|
163
171
|
const option = await props.createOption(value);
|
164
172
|
if (option) {
|
173
|
+
createdOptions.value.push(option);
|
165
174
|
setLoadingOptionIndex(optionsFiltered.value.length);
|
166
175
|
select(props.valueGetter(option));
|
167
176
|
search.value = "";
|
@@ -180,10 +189,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
180
189
|
if (props.useQueryFnDefault) {
|
181
190
|
const { data: defaultData } = props.useQueryFnDefault({ enabled });
|
182
191
|
watch(defaultData, (value) => {
|
183
|
-
if (value && props.modelValue.length === 0)
|
192
|
+
if (value && props.modelValue.length === 0) {
|
193
|
+
select(props.valueGetter(value));
|
194
|
+
emit("init-model");
|
195
|
+
}
|
184
196
|
}, { immediate: true });
|
185
197
|
}
|
186
|
-
watch(
|
198
|
+
watch(() => props.modelValue, async () => {
|
187
199
|
await nextTick();
|
188
200
|
input.value?.updateDropdown();
|
189
201
|
});
|
@@ -194,6 +206,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
194
206
|
emit("update:query-options-error", void 0);
|
195
207
|
}
|
196
208
|
}, { immediate: true });
|
209
|
+
watch(() => optionsFiltered.value.length, (length) => {
|
210
|
+
if (length < cursor.value) cursor.value = length;
|
211
|
+
});
|
197
212
|
__expose({
|
198
213
|
focus,
|
199
214
|
blur,
|
@@ -256,7 +271,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
256
271
|
]),
|
257
272
|
content: withCtx(() => [
|
258
273
|
!optionsFiltered.value.length ? (openBlock(), createElementBlock("div", _hoisted_1, [
|
259
|
-
createElementVNode("div", _hoisted_2, toDisplayString(_ctx.emptyStub
|
274
|
+
createElementVNode("div", _hoisted_2, toDisplayString(!search.value && _ctx.emptyStub ? _ctx.emptyStub : "No match"), 1)
|
260
275
|
])) : createCommentVNode("", true),
|
261
276
|
(openBlock(true), createElementBlock(Fragment, null, renderList(optionsFiltered.value, (option, index) => {
|
262
277
|
return openBlock(), createBlock(_sfc_main$3, {
|
@@ -293,7 +308,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
293
308
|
_: 2
|
294
309
|
}, 1032, ["is-selected", "is-cursor", "loading", "scroll", "hide-option-icon", "onSelect", "onUnselect", "onMouseenter"]);
|
295
310
|
}), 128)),
|
296
|
-
createOption && search.value !== "" ? (openBlock(), createBlock(_sfc_main$3, {
|
311
|
+
_ctx.createOption && search.value !== "" && !optionsFiltered.value.some((option) => _ctx.valueGetter(option) === search.value) ? (openBlock(), createBlock(_sfc_main$3, {
|
297
312
|
key: 1,
|
298
313
|
"is-selected": false,
|
299
314
|
"is-cursor": cursor.value === optionsFiltered.value.length,
|
@@ -301,7 +316,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
301
316
|
scroll: isCursorLocked.value,
|
302
317
|
"hide-option-icon": _ctx.hideOptionIcon,
|
303
318
|
class: "first:pt-4 last:pb-4",
|
304
|
-
onSelect: _cache[0] || (_cache[0] = ($event) =>
|
319
|
+
onSelect: _cache[0] || (_cache[0] = ($event) => create(search.value)),
|
305
320
|
onMouseenter: _cache[1] || (_cache[1] = ($event) => setCursor(optionsFiltered.value.length))
|
306
321
|
}, {
|
307
322
|
prefix: withCtx(() => _cache[7] || (_cache[7] = [
|
@@ -4,7 +4,8 @@ declare const _default: <Model extends number | string, Data extends DefaultData
|
|
4
4
|
readonly onSelect?: ((item: Model) => any) | undefined;
|
5
5
|
readonly "onUpdate:modelValue"?: ((value: Model[]) => any) | undefined;
|
6
6
|
readonly onUnselect?: ((item: Model) => any) | undefined;
|
7
|
-
|
7
|
+
readonly "onInit-model"?: (() => any) | undefined;
|
8
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onSelect" | "onUpdate:modelValue" | "onUnselect" | "onInit-model"> & SelectAsyncProps<Model, Data, QueryParams, OptionComponent>> & import('vue').PublicProps;
|
8
9
|
expose(exposed: import('vue').ShallowUnwrapRef<{
|
9
10
|
focus: () => void;
|
10
11
|
blur: () => void;
|
@@ -39,6 +40,7 @@ declare const _default: <Model extends number | string, Data extends DefaultData
|
|
39
40
|
(e: "select", item: Model): void;
|
40
41
|
(e: "unselect", item: Model): void;
|
41
42
|
(e: "update:modelValue", value: Model[]): void;
|
43
|
+
(e: "init-model"): void;
|
42
44
|
};
|
43
45
|
}>) => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
44
46
|
[key: string]: any;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"WSelectAsync.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Select/WSelectAsync.vue"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"WSelectAsync.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Select/WSelectAsync.vue"],"names":[],"mappings":"AA6QA,OAAO,KAAK,EAAC,gBAAgB,EAAE,qBAAqB,EAA6B,MAAM,SAAS,CAAA;yBAG/E,KAAK,SAAS,MAAM,GAAG,MAAM,EAAE,IAAI,SAAS,WAAW,EAAE,WAAW,EAAE,eAAe,SAAS,qBAAqB,CAAC,IAAI,CAAC,eAC5H,WAAW,CAAC,OAAO,CAAC,OAAO,WA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;;;;;YAihBmB,OAAO,CAAC,OAAO,WAAW,CAAC;;AAviBvE,wBAuiB4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
|
@@ -59,11 +59,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
59
59
|
maxHeight: {},
|
60
60
|
maxWidth: {},
|
61
61
|
horizontalAlign: {},
|
62
|
-
noParamsOptions: { type: Boolean },
|
63
62
|
optionComponent: {},
|
64
63
|
optionComponentProps: {}
|
65
64
|
},
|
66
|
-
emits: ["select", "unselect", "update:modelValue"],
|
65
|
+
emits: ["select", "unselect", "update:modelValue", "init-model"],
|
67
66
|
setup(__props, { expose: __expose, emit: __emit }) {
|
68
67
|
const props = __props;
|
69
68
|
const emit = __emit;
|
@@ -77,6 +76,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
77
76
|
const loadingCreate = ref(false);
|
78
77
|
const isDisabled = computed(() => props.loading || props.readonly || props.disabled);
|
79
78
|
const enabled = computed(() => !props.disabled);
|
79
|
+
const queryParams = computed(() => ({ ...props.queryParamsOptions, [props.searchField ?? "search"]: search.value }));
|
80
|
+
const queryParamsFirstPage = computed(() => ({ ...queryParams.value, page: 1 }));
|
81
|
+
const { data: firstPageData } = props.useQueryFnOptions(queryParamsFirstPage, { enabled: false });
|
82
|
+
const hasSearchOption = computed(() => firstPageData.value?.results.some((option) => props.valueGetter(option) === search.value));
|
80
83
|
const close = () => {
|
81
84
|
isOpen.value = false;
|
82
85
|
focused.value = false;
|
@@ -133,7 +136,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
133
136
|
if (props.useQueryFnDefault) {
|
134
137
|
const { data: defaultData } = props.useQueryFnDefault({ enabled });
|
135
138
|
watch(defaultData, (value) => {
|
136
|
-
if (value && props.modelValue.length === 0)
|
139
|
+
if (value && props.modelValue.length === 0) {
|
140
|
+
select(props.valueGetter(value));
|
141
|
+
emit("init-model");
|
142
|
+
}
|
137
143
|
}, { immediate: true });
|
138
144
|
}
|
139
145
|
__expose({
|
@@ -203,11 +209,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
203
209
|
ref: list,
|
204
210
|
"model-value": _ctx.modelValue,
|
205
211
|
"use-query-fn": _ctx.useQueryFnOptions,
|
206
|
-
"query-params":
|
212
|
+
"query-params": queryParams.value,
|
207
213
|
loading: _ctx.loading || isFetchingPrefix.value,
|
208
214
|
disabled: isDisabled.value,
|
209
|
-
"empty-stub": _ctx.emptyStub,
|
210
|
-
"allow-create": _ctx.createOption && search.value !== "",
|
215
|
+
"empty-stub": !search.value && _ctx.emptyStub ? _ctx.emptyStub : void 0,
|
216
|
+
"allow-create": _ctx.createOption && search.value !== "" && !hasSearchOption.value,
|
211
217
|
"hide-option-icon": _ctx.hideOptionIcon,
|
212
218
|
"value-getter": _ctx.valueGetter,
|
213
219
|
"loading-create": loadingCreate.value,
|
@@ -4,7 +4,7 @@ declare const _default: <Model extends number | string, Data extends DefaultData
|
|
4
4
|
readonly "onUpdate:count"?: ((value: number) => any) | undefined;
|
5
5
|
readonly "onUpdate:model-value"?: ((value: Model[]) => any) | undefined;
|
6
6
|
readonly onUnselect?: ((value: Model) => any) | undefined;
|
7
|
-
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onSelect" | "onUpdate:count" | "
|
7
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onSelect" | "onUpdate:count" | "onUpdate:model-value" | "onUnselect"> & {
|
8
8
|
title?: string;
|
9
9
|
emptyStub?: string;
|
10
10
|
modelValue: Model[];
|
@@ -2,7 +2,8 @@ import { SelectAsyncSingleProps, SelectOptionComponent } from './types';
|
|
2
2
|
declare const _default: <Model extends number | string, Data extends DefaultData, QueryParams, OptionComponent extends SelectOptionComponent<Data>, AllowClear extends boolean = false>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
3
3
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
4
4
|
readonly "onUpdate:modelValue"?: ((value: AllowClear extends true ? Model | null : Model) => any) | undefined;
|
5
|
-
|
5
|
+
readonly "onInit-model"?: (() => any) | undefined;
|
6
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onUpdate:modelValue" | "onInit-model"> & SelectAsyncSingleProps<Model, Data, QueryParams, OptionComponent, AllowClear>> & import('vue').PublicProps;
|
6
7
|
expose(exposed: import('vue').ShallowUnwrapRef<{
|
7
8
|
blur: () => void;
|
8
9
|
}>): void;
|
@@ -18,7 +19,10 @@ declare const _default: <Model extends number | string, Data extends DefaultData
|
|
18
19
|
}): any;
|
19
20
|
right?(_: {}): any;
|
20
21
|
};
|
21
|
-
emit:
|
22
|
+
emit: {
|
23
|
+
(e: "update:modelValue", value: AllowClear extends true ? Model | null : Model): void;
|
24
|
+
(e: "init-model"): void;
|
25
|
+
};
|
22
26
|
}>) => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
23
27
|
[key: string]: any;
|
24
28
|
}> & {
|
@@ -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":"AAwFA,OAAO,KAAK,EAAC,sBAAsB,EAAE,qBAAqB,EAAC,MAAM,SAAS,CAAA;yBAGzD,KAAK,SAAS,MAAM,GAAG,MAAM,EAAE,IAAI,SAAS,WAAW,EAAE,WAAW,EAAE,eAAe,SAAS,qBAAqB,CAAC,IAAI,CAAC,EAAE,UAAU,SAAS,OAAO,uBACxJ,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,cAClD,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,iBAC5F,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC;WA2MxD,mBAAmB,CAAC;;;4OAAyD,CAAC,4BAA2B;oBAChG,OAAO,KAAK,EAAE,gBAAgB;;MAAsB,GAAG,IAAI;WACpE,GAAG;;uBAnCe,GAAG;0BACA,GAAG;;;;;;YACL,GAAG;uBACJ,GAAG;;;YAlKzB,mBAAmB,0DAAoB,IAAI;YAC3C,YAAY,GAAG,IAAI;;;;;YAsMmB,OAAO,CAAC,OAAO,WAAW,CAAC;;AArNvE,wBAqN4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
|
@@ -57,11 +57,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
57
57
|
maxHeight: {},
|
58
58
|
maxWidth: {},
|
59
59
|
horizontalAlign: {},
|
60
|
-
noParamsOptions: { type: Boolean },
|
61
60
|
optionComponent: {},
|
62
61
|
optionComponentProps: {}
|
63
62
|
},
|
64
|
-
emits: ["update:modelValue"],
|
63
|
+
emits: ["update:modelValue", "init-model"],
|
65
64
|
setup(__props, { expose: __expose, emit: __emit }) {
|
66
65
|
const props = __props;
|
67
66
|
const emit = __emit;
|
@@ -91,7 +90,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
91
90
|
}, {
|
92
91
|
class: _ctx.$attrs.class,
|
93
92
|
onSelect: _cache[0] || (_cache[0] = ($event) => updateModelValue($event)),
|
94
|
-
onUnselect: _cache[1] || (_cache[1] = ($event) => _ctx.allowClear && updateModelValue(null))
|
93
|
+
onUnselect: _cache[1] || (_cache[1] = ($event) => _ctx.allowClear && updateModelValue(null)),
|
94
|
+
onInitModel: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("init-model"))
|
95
95
|
}), createSlots({
|
96
96
|
option: withCtx(({ option, selected, model, search }) => [
|
97
97
|
renderSlot(_ctx.$slots, "option", {
|
@@ -2,8 +2,9 @@ import { SelectSingleProps, SelectOptionComponent } from './types';
|
|
2
2
|
declare const _default: <Model extends number | string, Data extends DefaultData, QueryParamsOptions, OptionComponent extends SelectOptionComponent<Data>, AllowClear extends boolean = false>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
3
3
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
4
4
|
readonly "onUpdate:model-value"?: ((value: AllowClear extends true ? Model | null : Model) => any) | undefined;
|
5
|
+
readonly "onInit-model"?: (() => any) | undefined;
|
5
6
|
readonly "onUpdate:query-options-error"?: ((value: string | undefined) => any) | undefined;
|
6
|
-
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onUpdate:
|
7
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onUpdate:model-value" | "onInit-model" | "onUpdate:query-options-error"> & SelectSingleProps<Model, Data, QueryParamsOptions, OptionComponent, AllowClear>> & import('vue').PublicProps;
|
7
8
|
expose(exposed: import('vue').ShallowUnwrapRef<{
|
8
9
|
blur: () => void;
|
9
10
|
}>): void;
|
@@ -22,6 +23,7 @@ declare const _default: <Model extends number | string, Data extends DefaultData
|
|
22
23
|
emit: {
|
23
24
|
(e: "update:model-value", value: AllowClear extends true ? Model | null : Model): void;
|
24
25
|
(e: "update:query-options-error", value: string | undefined): void;
|
26
|
+
(e: "init-model"): void;
|
25
27
|
};
|
26
28
|
}>) => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
27
29
|
[key: string]: any;
|
@@ -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":"AA2FA,OAAO,KAAK,EAAC,iBAAiB,EAAE,qBAAqB,EAAC,MAAM,SAAS,CAAA;yBAGpD,KAAK,SAAS,MAAM,GAAG,MAAM,EAAE,IAAI,SAAS,WAAW,EAAE,kBAAkB,EAAE,eAAe,SAAS,qBAAqB,CAAC,IAAI,CAAC,EAAE,UAAU,SAAS,OAAO,uBAC/J,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,cAClD,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,iBAC5F,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC;WA2OxD,mBAAmB,CAAC;;;;gRAAyD,CAAC,4BAA2B;oBAChG,OAAO,KAAK,EAAE,gBAAgB;;MAAsB,GAAG,IAAI;WACpE,GAAG;;uBApCe,GAAG;0BACA,GAAG;;;;;;YACL,GAAG;uBACJ,GAAG;;;YAjMzB,oBAAoB,0DAAoB,IAAI;YAC5C,4BAA4B,SAAS,MAAM,GAAG,SAAS,GAAG,IAAI;YAC9D,YAAY,GAAG,IAAI;;;;;YAqOmB,OAAO,CAAC,OAAO,WAAW,CAAC;;AArPvE,wBAqP4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
|
@@ -56,10 +56,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
56
56
|
optionComponentProps: {},
|
57
57
|
useQueryFnOptions: {},
|
58
58
|
queryParamsOptions: {},
|
59
|
-
noParamsOptions: { type: Boolean },
|
60
59
|
options: {}
|
61
60
|
},
|
62
|
-
emits: ["update:model-value", "update:query-options-error"],
|
61
|
+
emits: ["update:model-value", "update:query-options-error", "init-model"],
|
63
62
|
setup(__props, { expose: __expose, emit: __emit }) {
|
64
63
|
const props = __props;
|
65
64
|
const emit = __emit;
|
@@ -90,7 +89,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
90
89
|
onSelect: _cache[0] || (_cache[0] = ($event) => updateModelValue($event)),
|
91
90
|
onUnselect: _cache[1] || (_cache[1] = ($event) => updateModelValue(_ctx.allowClear ? null : $event)),
|
92
91
|
onFocus: _cache[2] || (_cache[2] = ($event) => _ctx.searchModel && typeof _ctx.modelValue === "string" ? selectComponent.value?.setSearch(_ctx.modelValue) : void 0),
|
93
|
-
"onUpdate:queryOptionsError": _cache[3] || (_cache[3] = ($event) => _ctx.$emit("update:query-options-error", $event))
|
92
|
+
"onUpdate:queryOptionsError": _cache[3] || (_cache[3] = ($event) => _ctx.$emit("update:query-options-error", $event)),
|
93
|
+
onInitModel: _cache[4] || (_cache[4] = ($event) => _ctx.$emit("init-model"))
|
94
94
|
}), createSlots({
|
95
95
|
option: withCtx(({ option, selected, model, search }) => [
|
96
96
|
renderSlot(_ctx.$slots, "option", {
|
@@ -2,8 +2,9 @@ import { SelectStringifiedProps, SelectOptionComponent } from './types';
|
|
2
2
|
declare const _default: <Model extends 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_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
3
3
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
4
4
|
readonly "onUpdate:model-value"?: ((value: Model | null) => any) | undefined;
|
5
|
+
readonly "onInit-model"?: (() => any) | undefined;
|
5
6
|
readonly "onUpdate:query-options-error"?: ((value: string | undefined) => any) | undefined;
|
6
|
-
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onUpdate:
|
7
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onUpdate:model-value" | "onInit-model" | "onUpdate:query-options-error"> & SelectStringifiedProps<Model, Data, QueryParamsOptions, OptionComponent>> & import('vue').PublicProps;
|
7
8
|
expose(exposed: import('vue').ShallowUnwrapRef<{
|
8
9
|
blur: () => void;
|
9
10
|
}>): void;
|
@@ -22,6 +23,7 @@ declare const _default: <Model extends string, Data extends DefaultData, QueryPa
|
|
22
23
|
emit: {
|
23
24
|
(e: "update:model-value", value: Model | null): void;
|
24
25
|
(e: "update:query-options-error", value: string | undefined): void;
|
26
|
+
(e: "init-model"): void;
|
25
27
|
};
|
26
28
|
}>) => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
27
29
|
[key: string]: any;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"WSelectStringified.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Select/WSelectStringified.vue"],"names":[],"mappings":"AA8FA,OAAO,KAAK,EAAC,sBAAsB,EAAE,qBAAqB,EAAC,MAAM,SAAS,CAAA;yBAGzD,KAAK,SAAS,MAAM,EAAE,IAAI,SAAS,WAAW,EAAE,k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;;AA1OvE,wBA0O4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { defineComponent, ref, computed,
|
1
|
+
import { defineComponent, ref, computed, openBlock, createBlock, mergeProps, createSlots, withCtx, renderSlot } from 'vue';
|
2
2
|
import _sfc_main$1 from './WSelect.vue.js';
|
3
3
|
|
4
4
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
@@ -56,10 +56,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
56
56
|
optionComponentProps: {},
|
57
57
|
useQueryFnOptions: {},
|
58
58
|
queryParamsOptions: {},
|
59
|
-
noParamsOptions: { type: Boolean },
|
60
59
|
options: {}
|
61
60
|
},
|
62
|
-
emits: ["update:model-value", "update:query-options-error"],
|
61
|
+
emits: ["update:model-value", "update:query-options-error", "init-model"],
|
63
62
|
setup(__props, { expose: __expose, emit: __emit }) {
|
64
63
|
const props = __props;
|
65
64
|
const emit = __emit;
|
@@ -79,7 +78,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
79
78
|
const blur = () => {
|
80
79
|
selectComponent.value?.blur();
|
81
80
|
};
|
82
|
-
watch(toRef(props, "modelValue"), blur);
|
83
81
|
__expose({
|
84
82
|
blur
|
85
83
|
});
|
@@ -94,7 +92,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
94
92
|
class: _ctx.$attrs.class,
|
95
93
|
onSelect: _cache[0] || (_cache[0] = ($event) => updateModelValue($event, true)),
|
96
94
|
onUnselect: _cache[1] || (_cache[1] = ($event) => updateModelValue($event, false)),
|
97
|
-
"onUpdate:queryOptionsError": _cache[2] || (_cache[2] = ($event) => _ctx.$emit("update:query-options-error", $event))
|
95
|
+
"onUpdate:queryOptionsError": _cache[2] || (_cache[2] = ($event) => _ctx.$emit("update:query-options-error", $event)),
|
96
|
+
onInitModel: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("init-model"))
|
98
97
|
}), createSlots({
|
99
98
|
option: withCtx(({ option, selected, model, search }) => [
|
100
99
|
renderSlot(_ctx.$slots, "option", {
|
@@ -14,20 +14,17 @@ export interface SelectOptionComponentProps<Option, OptionComponent extends Sele
|
|
14
14
|
interface SelectPropsNoParams<Data extends DefaultData> {
|
15
15
|
useQueryFnOptions: UseQueryEmpty<Data[]>;
|
16
16
|
queryParamsOptions?: never;
|
17
|
-
noParamsOptions: true;
|
18
17
|
options?: never;
|
19
18
|
}
|
20
19
|
interface SelectPropsWithParams<Data extends DefaultData, QueryParams> {
|
21
20
|
useQueryFnOptions: UseQueryWithParams<Data[], QueryParams>;
|
22
21
|
queryParamsOptions: QueryParams;
|
23
|
-
noParamsOptions?: never;
|
24
22
|
options?: never;
|
25
23
|
}
|
26
24
|
interface SelectPropsWithOptions<Data extends DefaultData> {
|
27
25
|
options: Data[];
|
28
26
|
useQueryFnOptions?: never;
|
29
27
|
queryParamsOptions?: never;
|
30
|
-
noParamsOptions?: never;
|
31
28
|
}
|
32
29
|
type SelectPropsOptions<Data extends DefaultData, QueryParams> = SelectPropsNoParams<Data> | SelectPropsWithParams<Data, QueryParams> | SelectPropsWithOptions<Data>;
|
33
30
|
export interface SelectProps<Model extends number | string, Data extends DefaultData, QueryParams, OptionComponent extends SelectOptionComponent<Data>> extends Omit<InputSuggestProps<'text'>, 'modelValue' | 'allowClear' | 'hideInput'>, SelectOptionComponentProps<Data, OptionComponent>, Omit<SelectPropsOptions<Data, QueryParams>, 'modelValue'> {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Select/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,0BAA0B,CAAA;AAC/D,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,KAAK,CAAA;AAElC,MAAM,MAAM,i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EAAE,WAAW,EAAE,eAAe,SAAS,qBAAqB,CAAC,IAAI,CAAC,EAAE,UAAU,SAAS,OAAO,CAC3L,SAAQ,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,eAAe,CAAC,EAAE,YAAY,GAAG,cAAc,GAAG,aAAa,GAAG,aAAa,CAAC;IACxI,UAAU,EAAE,KAAK,GAAG,IAAI,CAAA;IACxB,UAAU,CAAC,EAAE,OAAO,GAAG,UAAU,CAAA;IACjC,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,WAAW,CAAC,EAAE,IAAI,CAAA;IAClB,WAAW,CAAC,EAAE,IAAI,CAAA;CACnB"}
|
package/dist/types/global.d.ts
CHANGED
@@ -96,7 +96,7 @@ declare type OmitReqursive<Model extends object, Field extends keyof Model | str
|
|
96
96
|
declare type PickByType<Model, FieldType, IncludeNull = false> = {
|
97
97
|
[
|
98
98
|
Key in keyof Model as IncludeNull extends true
|
99
|
-
? Exclude<Model[Key], null> extends FieldType ? Key : never
|
99
|
+
? Exclude<Model[Key], null | undefined> extends FieldType ? Key : never
|
100
100
|
: Model[Key] extends FieldType ? Key : never
|
101
101
|
]: Model[Key]
|
102
102
|
}
|
package/package.json
CHANGED