eco-vue-js 0.8.5 → 0.8.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -22,7 +22,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
22
22
  emptyStub: {},
23
23
  disableClear: { type: Boolean },
24
24
  hidePrefix: { type: Boolean },
25
- allowCreate: { type: Boolean },
25
+ createOption: { type: Function },
26
26
  hideOptionIcon: { type: Boolean },
27
27
  mobileTitle: {},
28
28
  persist: { type: Boolean },
@@ -23,7 +23,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
23
23
  useQueryFnDefault: {},
24
24
  emptyStub: {},
25
25
  hidePrefix: { type: Boolean },
26
- allowCreate: { type: Boolean },
26
+ createOption: { type: Function },
27
27
  hideOptionIcon: { type: Boolean },
28
28
  mobileTitle: {},
29
29
  persist: { type: Boolean },
@@ -5,14 +5,12 @@ 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 "onCreate:option"?: ((value: string) => any) | undefined;
9
8
  } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & Readonly<{}> & Readonly<{
10
9
  onSelect?: ((item: Model) => any) | undefined;
11
10
  onBlur?: ((value: FocusEvent) => any) | undefined;
12
11
  onFocus?: ((value: FocusEvent) => any) | undefined;
13
12
  onUnselect?: ((item: Model) => any) | undefined;
14
- "onCreate:option"?: ((value: string) => any) | undefined;
15
- }>, never>, "onFocus" | "onBlur" | "onSelect" | "onUnselect" | "onCreate:option"> & SelectProps<Model, Data, OptionComponent>> & import('vue').PublicProps;
13
+ }>, never>, "onFocus" | "onBlur" | "onSelect" | "onUnselect"> & SelectProps<Model, Data, OptionComponent>> & import('vue').PublicProps;
16
14
  expose(exposed: import('vue').ShallowUnwrapRef<{
17
15
  focus: () => void;
18
16
  blur: () => void;
@@ -43,7 +41,6 @@ declare const _default: <Model extends number | string, Data extends DefaultData
43
41
  emit: {
44
42
  (e: "select", item: Model): void;
45
43
  (e: "unselect", item: Model): void;
46
- (e: "create:option", value: string): void;
47
44
  (e: "focus", value: FocusEvent): void;
48
45
  (e: "blur", value: FocusEvent): void;
49
46
  };
@@ -1 +1 @@
1
- {"version":3,"file":"WSelect.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Select/WSelect.vue"],"names":[],"mappings":"AA+VA,OAAO,KAAK,EAAC,WAAW,EAAE,qBAAqB,EAA6B,MAAM,SAAS,CAAA;yBAG1E,KAAK,SAAS,MAAM,GAAG,MAAM,EAAE,IAAI,SAAS,WAAW,EAAE,eAAe,SAAS,qBAAqB,CAAC,IAAI,CAAC,eAC/G,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;WA0mBxD,mBAAmB,CAAC;;;;;;;;;;;;iIAAyD,CAAC,4BAA2B;oBAChG,OAAO,KAAK,EAAE,gBAAgB;;;2BAjdvB,MAAM,KAAG,IAAI;MAidgC,GAAG,IAAI;WACpE,GAAG;;gBApbH,MAAM,IAAI;mBACP,MAAM,IAAI;iBACZ,CAAC,KAAK,EAAE;YACf,MAAM,EAAE,IAAI,GAAG,MAAM,CAAA;YACrB,KAAK,CAAC,EAAE,MAAM,CAAA;YACd,QAAQ,EAAE,OAAO,CAAA;YACjB,KAAK,EAAE,OAAO,CAAA;SACf,KAAK,IAAI;gBACF,MAAM,IAAI;;gBARV,MAAM,IAAI;mBACP,MAAM,IAAI;iBACZ,CAAC,KAAK,EAAE;YACf,MAAM,EAAE,IAAI,GAAG,MAAM,CAAA;YACrB,KAAK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iBACZ,CAAC,KAAK,EAAE;YACf,MAAM,EAAE,IAAI,GAAG,MAAM,CAAA;YACrB,KAAK,CAAC,EAAE,MAAM,CAAA;YACd,QAAQ,EAAE,OAAO,CAAA;YACjB,KAAK,EAAE,OAAO,CAAA;SACf,KAAK,IAAI;gBACF,MAAM,IAAI;;gBARV,MAAM,IAAI;mBACP,MAAM,IAAI;iBACZ,CAAC,KAAK,EAAE;YACf,MAAM,EAAE,IAAI,GAAG,MAAM,CAAA;YACrB,KAAK,CAAC,EAAE,MAAM,CAAA;YACd,QAAQ,EAAE,OAAO,CAAA;YACjB,KAAK,EAAE,OAAO,CAAA;SACf,KAAK,IAAI;gBACF,MAAM,IAAI;;;YA9Ld,QAAQ,QAAQ,KAAK,GAAG,IAAI;YAC5B,UAAU,QAAQ,KAAK,GAAG,IAAI;YAC9B,OAAO,SAAS,UAAU,GAAG,IAAI;YACjC,MAAM,SAAS,UAAU,GAAG,IAAI;;;;;YA2mBM,OAAO,CAAC,OAAO,WAAW,CAAC;;AA1nBvE,wBA0nB4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
@@ -22,7 +22,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
22
22
  emptyStub: {},
23
23
  disableClear: { type: Boolean },
24
24
  hidePrefix: { type: Boolean },
25
- allowCreate: { type: Boolean },
25
+ createOption: { type: Function },
26
26
  hideOptionIcon: { type: Boolean },
27
27
  mobileTitle: {},
28
28
  persist: { type: Boolean },
@@ -63,7 +63,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
63
63
  optionComponent: {},
64
64
  optionComponentProps: {}
65
65
  },
66
- emits: ["select", "unselect", "create:option", "focus", "blur"],
66
+ emits: ["select", "unselect", "focus", "blur"],
67
67
  setup(__props, { expose: __expose, emit: __emit }) {
68
68
  const props = __props;
69
69
  const emit = __emit;
@@ -76,10 +76,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
76
76
  const enabled = computed(() => !props.disabled);
77
77
  const { data, isLoading } = props.useQueryFnOptions({ enabled });
78
78
  const filteredOptions = computed(() => !data.value ? [] : searchPrepared.value === "" ? data.value : data.value.filter((option) => props.searchFn(option, searchPrepared.value)));
79
- const lastIndex = computed(() => props.allowCreate ? filteredOptions.value.length : filteredOptions.value.length - 1);
79
+ const lastIndex = computed(() => props.createOption ? filteredOptions.value.length : filteredOptions.value.length - 1);
80
80
  const isMobile = getIsMobile();
81
81
  const focused = ref(false);
82
82
  const loadingOptionIndex = ref(null);
83
+ const loadingCreate = ref(false);
83
84
  const isDisabled = computed(() => props.loading || props.readonly || props.disabled);
84
85
  const prefixList = computed(() => props.modelValue.map((value) => data.value?.find((item) => props.valueGetter(item) === value)).filter((item) => item !== void 0));
85
86
  const close = () => {
@@ -145,12 +146,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
145
146
  emit("unselect", item);
146
147
  search.value = "";
147
148
  };
148
- const createOption = (item) => {
149
+ const createOption = async (value) => {
149
150
  if (isDisabled.value) return;
150
- if (!props.allowCreate) return;
151
- setLoadingOptionIndex(filteredOptions.value.length);
152
- emit("create:option", item);
153
- search.value = "";
151
+ if (!props.createOption) return;
152
+ loadingCreate.value = true;
153
+ const option = await props.createOption(value);
154
+ if (option) {
155
+ setLoadingOptionIndex(filteredOptions.value.length);
156
+ select(props.valueGetter(option));
157
+ search.value = "";
158
+ }
159
+ loadingCreate.value = false;
154
160
  };
155
161
  const focus = () => {
156
162
  input.value?.focus();
@@ -184,7 +190,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
184
190
  ...props,
185
191
  modelValue: search.value,
186
192
  hideInput: _ctx.modelValue.length === 0 ? false : unref(isMobile) ? !focused.value : !isOpen.value,
187
- loading: _ctx.loading || unref(isLoading)
193
+ loading: _ctx.loading || unref(isLoading) || loadingCreate.value
188
194
  }, {
189
195
  class: _ctx.$attrs.class,
190
196
  "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => !_ctx.loading && !unref(isLoading) && (search.value = $event ?? "")),
@@ -270,11 +276,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
270
276
  _: 2
271
277
  }, 1032, ["is-selected", "is-cursor", "loading", "scroll", "hide-option-icon", "onSelect", "onUnselect", "onMouseenter"]);
272
278
  }), 128)),
273
- _ctx.allowCreate && search.value !== "" ? (openBlock(), createBlock(_sfc_main$3, {
279
+ createOption && search.value !== "" ? (openBlock(), createBlock(_sfc_main$3, {
274
280
  key: 1,
275
281
  "is-selected": false,
276
282
  "is-cursor": cursor.value === filteredOptions.value.length,
277
- loading: loadingOptionIndex.value === filteredOptions.value.length && _ctx.loading,
283
+ loading: (loadingCreate.value || loadingOptionIndex.value === filteredOptions.value.length) && _ctx.loading,
278
284
  scroll: isCursorLocked.value,
279
285
  "hide-option-icon": _ctx.hideOptionIcon,
280
286
  class: "first:pt-4 last:pb-4",
@@ -4,13 +4,11 @@ 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
- readonly "onCreate:option"?: ((value: string) => any) | undefined;
8
7
  } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & Readonly<{}> & Readonly<{
9
8
  onSelect?: ((item: Model) => any) | undefined;
10
9
  "onUpdate:modelValue"?: ((value: Model[]) => any) | undefined;
11
10
  onUnselect?: ((item: Model) => any) | undefined;
12
- "onCreate:option"?: ((value: string) => any) | undefined;
13
- }>, never>, "onSelect" | "onUpdate:modelValue" | "onUnselect" | "onCreate:option"> & SelectAsyncProps<Model, Data, QueryParams, OptionComponent>> & import('vue').PublicProps;
11
+ }>, never>, "onSelect" | "onUpdate:modelValue" | "onUnselect"> & SelectAsyncProps<Model, Data, QueryParams, OptionComponent>> & import('vue').PublicProps;
14
12
  expose(exposed: import('vue').ShallowUnwrapRef<{
15
13
  focus: () => void;
16
14
  blur: () => void;
@@ -43,7 +41,6 @@ declare const _default: <Model extends number | string, Data extends DefaultData
43
41
  (e: "select", item: Model): void;
44
42
  (e: "unselect", item: Model): void;
45
43
  (e: "update:modelValue", value: Model[]): void;
46
- (e: "create:option", value: string): void;
47
44
  };
48
45
  }>) => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
49
46
  [key: string]: any;
@@ -1 +1 @@
1
- {"version":3,"file":"WSelectAsync.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Select/WSelectAsync.vue"],"names":[],"mappings":"AAyPA,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,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;WAugBxD,mBAAmB,CAAC;;;;;;;;;;oJAAyD,CAAC,4BAA2B;oBAChG,OAAO,KAAK,EAAE,gBAAgB;;;MAAsB,GAAG,IAAI;WACpE,GAAG;;gBAlZH,MAAM,IAAI;mBACP,MAAM,IAAI;gBACb,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,KAAK,IAAI;iBACrC,CAAC,KAAK,EAAE;YAAC,MAAM,EAAE,IAAI,GAAG,IAAI,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,CAAC;YAAC,QAAQ,E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__PURE__ */ defineComponent({
22
22
  emptyStub: { default: "No match" },
23
23
  disableClear: { type: Boolean },
24
24
  hidePrefix: { type: Boolean },
25
- allowCreate: { type: Boolean },
25
+ createOption: {},
26
26
  hideOptionIcon: { type: Boolean },
27
27
  mobileTitle: {},
28
28
  persist: { type: Boolean },
@@ -63,7 +63,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
63
63
  optionComponent: {},
64
64
  optionComponentProps: {}
65
65
  },
66
- emits: ["select", "unselect", "update:modelValue", "create:option"],
66
+ emits: ["select", "unselect", "update:modelValue"],
67
67
  setup(__props, { expose: __expose, emit: __emit }) {
68
68
  const props = __props;
69
69
  const emit = __emit;
@@ -74,6 +74,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
74
74
  const focused = ref(false);
75
75
  const isFetchingPrefix = ref(false);
76
76
  const search = ref("");
77
+ const loadingCreate = ref(false);
77
78
  const isDisabled = computed(() => props.loading || props.readonly || props.disabled);
78
79
  const enabled = computed(() => !props.disabled);
79
80
  const close = () => {
@@ -103,10 +104,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
103
104
  emit("unselect", item);
104
105
  search.value = "";
105
106
  };
106
- const create = () => {
107
+ const create = async () => {
107
108
  if (isDisabled.value) return;
108
- emit("create:option", search.value);
109
- search.value = "";
109
+ if (!props.createOption) return;
110
+ loadingCreate.value = true;
111
+ const option = await props.createOption(search.value);
112
+ if (option) {
113
+ select(props.valueGetter(option));
114
+ search.value = "";
115
+ }
116
+ loadingCreate.value = false;
110
117
  };
111
118
  const updateSelected = (value) => {
112
119
  if (isDisabled.value) return;
@@ -140,7 +147,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
140
147
  }, {
141
148
  ...props,
142
149
  modelValue: search.value,
143
- loading: _ctx.loading || isFetchingPrefix.value,
150
+ loading: _ctx.loading || isFetchingPrefix.value || loadingCreate.value,
144
151
  hideInput: unref(isMobile) ? !focused.value : !isOpen.value
145
152
  }, {
146
153
  class: _ctx.$attrs.class,
@@ -201,9 +208,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
201
208
  loading: _ctx.loading || isFetchingPrefix.value,
202
209
  disabled: isDisabled.value,
203
210
  "empty-stub": _ctx.emptyStub,
204
- "allow-create": _ctx.allowCreate && search.value !== "",
211
+ "allow-create": _ctx.createOption && search.value !== "",
205
212
  "hide-option-icon": _ctx.hideOptionIcon,
206
213
  "value-getter": _ctx.valueGetter,
214
+ "loading-create": loadingCreate.value,
207
215
  onSelect: select,
208
216
  onUnselect: unselect,
209
217
  "onCreate:option": create,
@@ -226,7 +234,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
226
234
  ])
227
235
  ]),
228
236
  _: 3
229
- }, 8, ["model-value", "use-query-fn", "query-params", "is-invalid-page", "loading", "disabled", "empty-stub", "allow-create", "hide-option-icon", "value-getter"])
237
+ }, 8, ["model-value", "use-query-fn", "query-params", "is-invalid-page", "loading", "disabled", "empty-stub", "allow-create", "hide-option-icon", "value-getter", "loading-create"])
230
238
  ]),
231
239
  _: 2
232
240
  }, [
@@ -2,11 +2,9 @@ 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
- readonly "onCreate:option"?: ((value: string) => any) | undefined;
6
5
  } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & Readonly<{}> & Readonly<{
7
6
  "onUpdate:modelValue"?: ((value: AllowClear extends true ? Model | null : Model) => any) | undefined;
8
- "onCreate:option"?: ((value: string) => any) | undefined;
9
- }>, never>, "onUpdate:modelValue" | "onCreate:option"> & SelectAsyncSingleProps<Model, Data, QueryParams, OptionComponent, AllowClear>> & import('vue').PublicProps;
7
+ }>, never>, "onUpdate:modelValue"> & SelectAsyncSingleProps<Model, Data, QueryParams, OptionComponent, AllowClear>> & import('vue').PublicProps;
10
8
  expose(exposed: import('vue').ShallowUnwrapRef<{
11
9
  blur: () => void;
12
10
  }>): void;
@@ -21,10 +19,7 @@ declare const _default: <Model extends number | string, Data extends DefaultData
21
19
  }): any;
22
20
  right?(_: {}): any;
23
21
  };
24
- emit: {
25
- (e: "update:modelValue", value: AllowClear extends true ? Model | null : Model): void;
26
- (e: "create:option", value: string): void;
27
- };
22
+ emit: (e: "update:modelValue", value: AllowClear extends true ? Model | null : Model) => void;
28
23
  }>) => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
29
24
  [key: string]: any;
30
25
  }> & {
@@ -1 +1 @@
1
- {"version":3,"file":"WSelectAsyncSingle.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Select/WSelectAsyncSingle.vue"],"names":[],"mappings":"AA2FA,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,C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AI;;;;YAkLL,OAAO,CAAC,OAAO,WAAW,CAAC;;AAhMvE,wBAgM4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
@@ -20,7 +20,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
20
20
  useQueryFnDefault: {},
21
21
  emptyStub: {},
22
22
  hidePrefix: { type: Boolean },
23
- allowCreate: { type: Boolean },
23
+ createOption: { type: Function },
24
24
  hideOptionIcon: { type: Boolean },
25
25
  mobileTitle: {},
26
26
  persist: { type: Boolean },
@@ -61,7 +61,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
61
61
  optionComponent: {},
62
62
  optionComponentProps: {}
63
63
  },
64
- emits: ["update:modelValue", "create:option"],
64
+ emits: ["update:modelValue"],
65
65
  setup(__props, { expose: __expose, emit: __emit }) {
66
66
  const props = __props;
67
67
  const emit = __emit;
@@ -70,9 +70,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
70
70
  const updateModelValue = (value) => {
71
71
  emit("update:modelValue", value);
72
72
  };
73
- const createOption = (value) => {
74
- emit("create:option", value);
75
- };
76
73
  const blur = () => {
77
74
  selectComponent.value?.blur();
78
75
  };
@@ -94,8 +91,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
94
91
  }, {
95
92
  class: _ctx.$attrs.class,
96
93
  onSelect: _cache[0] || (_cache[0] = ($event) => updateModelValue($event)),
97
- onUnselect: _cache[1] || (_cache[1] = ($event) => _ctx.allowClear && updateModelValue(null)),
98
- "onCreate:option": _cache[2] || (_cache[2] = ($event) => createOption($event))
94
+ onUnselect: _cache[1] || (_cache[1] = ($event) => _ctx.allowClear && updateModelValue(null))
99
95
  }), createSlots({
100
96
  option: withCtx(({ option, selected, model }) => [
101
97
  renderSlot(_ctx.$slots, "option", {
@@ -2,11 +2,9 @@ import { SelectSingleProps, SelectOptionComponent } from './types';
2
2
  declare const _default: <Model extends number | string, Data extends DefaultData, 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
- readonly "onCreate:option"?: ((value: string) => any) | undefined;
6
5
  } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & Readonly<{}> & Readonly<{
7
6
  "onUpdate:modelValue"?: ((value: AllowClear extends true ? Model | null : Model) => any) | undefined;
8
- "onCreate:option"?: ((value: string) => any) | undefined;
9
- }>, never>, "onUpdate:modelValue" | "onCreate:option"> & SelectSingleProps<Model, Data, OptionComponent, AllowClear>> & import('vue').PublicProps;
7
+ }>, never>, "onUpdate:modelValue"> & SelectSingleProps<Model, Data, OptionComponent, AllowClear>> & import('vue').PublicProps;
10
8
  expose(exposed: import('vue').ShallowUnwrapRef<{
11
9
  blur: () => void;
12
10
  }>): void;
@@ -21,10 +19,7 @@ declare const _default: <Model extends number | string, Data extends DefaultData
21
19
  }): any;
22
20
  right?(_: {}): any;
23
21
  };
24
- emit: {
25
- (e: "update:modelValue", value: AllowClear extends true ? Model | null : Model): void;
26
- (e: "create:option", value: string): void;
27
- };
22
+ emit: (e: "update:modelValue", value: AllowClear extends true ? Model | null : Model) => void;
28
23
  }>) => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
29
24
  [key: string]: any;
30
25
  }> & {
@@ -1 +1 @@
1
- {"version":3,"file":"WSelectSingle.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Select/WSelectSingle.vue"],"names":[],"mappings":"AA4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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;WAiMxD,mBAAmB,CAAC;;;;oGAAyD,CAAC,4BAA2B;oBAChG,OAAO,KAAK,EAAE,gBAAgB;;MAAsB,GAAG,IAAI;WACpE,GAAG;;uBAlCe,GAAG;0BACA,GAAG;;;;;YACL,GAAG;uBACJ,GAAG;;cAzJzB,mBAAmB,4DAAoB,IAAI;;;;YA6LL,OAAO,CAAC,OAAO,WAAW,CAAC;;AA3MvE,wBA2M4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
@@ -14,7 +14,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
14
14
  useQueryFnDefault: {},
15
15
  emptyStub: {},
16
16
  hidePrefix: { type: Boolean },
17
- allowCreate: { type: Boolean },
17
+ createOption: { type: Function },
18
18
  hideOptionIcon: { type: Boolean },
19
19
  mobileTitle: {},
20
20
  persist: { type: Boolean },
@@ -55,7 +55,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
55
55
  optionComponent: {},
56
56
  optionComponentProps: {}
57
57
  },
58
- emits: ["update:modelValue", "create:option"],
58
+ emits: ["update:modelValue"],
59
59
  setup(__props, { expose: __expose, emit: __emit }) {
60
60
  const props = __props;
61
61
  const emit = __emit;
@@ -65,9 +65,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
65
65
  emit("update:modelValue", value);
66
66
  blur();
67
67
  };
68
- const createOption = (value) => {
69
- emit("create:option", value);
70
- };
71
68
  const blur = () => {
72
69
  selectComponent.value?.blur();
73
70
  };
@@ -88,8 +85,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
88
85
  class: _ctx.$attrs.class,
89
86
  onSelect: _cache[0] || (_cache[0] = ($event) => updateModelValue($event)),
90
87
  onUnselect: _cache[1] || (_cache[1] = ($event) => updateModelValue(_ctx.allowClear ? null : $event)),
91
- "onCreate:option": _cache[2] || (_cache[2] = ($event) => createOption($event)),
92
- onFocus: _cache[3] || (_cache[3] = ($event) => _ctx.searchModel && typeof _ctx.modelValue === "string" ? selectComponent.value?.setSearch(_ctx.modelValue) : void 0)
88
+ onFocus: _cache[2] || (_cache[2] = ($event) => _ctx.searchModel && typeof _ctx.modelValue === "string" ? selectComponent.value?.setSearch(_ctx.modelValue) : void 0)
93
89
  }), createSlots({
94
90
  option: withCtx(({ option, selected, model }) => [
95
91
  renderSlot(_ctx.$slots, "option", {
@@ -29,6 +29,7 @@ declare const _default: <Model extends number | string, Data extends DefaultData
29
29
  hideOptionIcon?: boolean;
30
30
  valueGetter: (data: Data) => Model;
31
31
  queryOptions?: Partial<Parameters<UseQueryPaginated<Data, QueryParams>>[1]>;
32
+ loadingCreate?: boolean;
32
33
  }> & import('vue').PublicProps;
33
34
  expose(exposed: import('vue').ShallowUnwrapRef<{
34
35
  cursorUp: () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"SelectAsyncList.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/Select/components/SelectAsyncList.vue"],"names":[],"mappings":"yBAwNiB,KAAK,SAAS,MAAM,GAAG,MAAM,EAAE,IAAI,SAAS,WAAW,EAAE,WAAW,eACvE,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,CAA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AC,CAAC;CAAG,GAAG,EAAE,CAAC"}
1
+ {"version":3,"file":"SelectAsyncList.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/Select/components/SelectAsyncList.vue"],"names":[],"mappings":"yBAyNiB,KAAK,SAAS,MAAM,GAAG,MAAM,EAAE,IAAI,SAAS,WAAW,EAAE,WAAW,eACvE,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;WA8fxD,mBAAmB,CAAC;;;;;;;;;;;;;oBA1fhB,KAAK,EAAE;oBACP,iBAAiB,CAAC,IAAI,EAAE,WAAW,CAAC;qBACnC,WAAW;uBACT,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO;2BACvB,OAAO,GAAG,IAAI;kBACvB,OAAO;mBACN,OAAO;qBACL,OAAO;wBACJ,CAAC,MAAM,WAAW,CAAC,EAAE;oBACzB,OAAO;oBACP,MAAM;qBACL,OAAO;uBACL,OAAO;sBACR,OAAO;yBACJ,OAAO;qBACX,CAAC,IAAI,EAAE,IAAI,KAAK,KAAK;uBACnB,OAAO,CAAC,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;wBAC3D,OAAO;KAye8D,CAAC,4BAA2B;oBAChG,OAAO,KAAK,EAAE,gBAAgB;;;;MAAsB,GAAG,IAAI;WACpE,GAAG;;kBAjZD,CAAC,KAAK,EAAE;YAAC,MAAM,EAAE,IAAI,GAAG,IAAI,CAAC;YAAC,QAAQ,EAAE,OAAO,CAAC;YAAC,QAAQ,EAAE,OAAO,CAAA;SAAC,KAAK,IAAI;;kBAA5E,CAAC,KAAK,EAAE;YAAC,MAAM,EAAE,IAAI,GAAG,IAAI,CAAC;YAAC,QAAQ,EAAE,OAAO,CAAC;YAAC,QAAQ,EAAE,OAAO,CAAA;SAAC,KAAK,IAAI;;;YArFlF,QAAQ,SAAS,KAAK,GAAG,IAAI;YAC7B,UAAU,SAAS,KAAK,GAAG,IAAI;YAC/B,cAAc,SAAS,MAAM,GAAG,IAAI;YACpC,mBAAmB,SAAS,KAAK,EAAE,GAAG,IAAI;YAC1C,eAAe,GAAG,IAAI;;;;;YAuegB,OAAO,CAAC,OAAO,WAAW,CAAC;;AAxgBvE,wBAwgB4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
@@ -22,7 +22,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
22
22
  allowCreate: { type: Boolean },
23
23
  hideOptionIcon: { type: Boolean },
24
24
  valueGetter: { type: Function },
25
- queryOptions: {}
25
+ queryOptions: {},
26
+ loadingCreate: { type: Boolean }
26
27
  },
27
28
  emits: ["select", "unselect", "update:count", "update:modelValue", "create:option"],
28
29
  setup(__props, { expose: __expose, emit: __emit }) {
@@ -158,7 +159,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
158
159
  key: 0,
159
160
  "is-selected": false,
160
161
  "is-cursor": cursor.value === null,
161
- loading: _ctx.loading && loadingOption.value === null,
162
+ loading: _ctx.loading && (_ctx.loadingCreate || loadingOption.value === null),
162
163
  scroll: isCursorLocked.value,
163
164
  previous: lastItem.value,
164
165
  next: firstItem.value,
@@ -20,7 +20,7 @@ export interface SelectProps<Model extends number | string, Data extends Default
20
20
  emptyStub?: string;
21
21
  disableClear?: boolean;
22
22
  hidePrefix?: boolean;
23
- allowCreate?: boolean;
23
+ createOption?: (search: string) => (Data | undefined) | Promise<Data | undefined>;
24
24
  hideOptionIcon?: boolean;
25
25
  }
26
26
  export interface SelectPrefixProps<Data extends DefaultData, OptionComponent extends SelectOptionComponent<Data>> extends SelectOptionComponentProps<Data, OptionComponent> {
@@ -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,iBAAiB,CAAC,MAAM,IAAI;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAC,CAAA;AAE7G,MAAM,MAAM,qBAAqB,CAAC,MAAM,IAAI,SAAS,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAA;AAEhF,MAAM,WAAW,0BAA0B,CAAC,MAAM,EAAE,eAAe,SAAS,qBAAqB,CAAC,MAAM,CAAC;IACvG,eAAe,CAAC,EAAE,eAAe,CAAA;IACjC,oBAAoB,CAAC,EAAE,eAAe,SAAS,SAAS,CAAC,MAAM,KAAK,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,KAAK,CAAA;CACtI;AAED,MAAM,WAAW,WAAW,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,EAAE,IAAI,SAAS,WAAW,EAAE,eAAe,SAAS,qBAAqB,CAAC,IAAI,CAAC,CACvI,SAAQ,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,EAAE,YAAY,GAAG,YAAY,GAAG,WAAW,CAAC,EAClF,0BAA0B,CAAC,IAAI,EAAE,eAAe,CAAC;IACjD,UAAU,EAAE,KAAK,EAAE,CAAA;IACnB,iBAAiB,EAAE,aAAa,CAAC,IAAI,EAAE,CAAC,CAAA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,CAAC,CAAA;IAChD,WAAW,EAAE,WAAW,CAAA;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,WAAW,CAAC,EAAE,IAAI,EAAE,CAAA;IACpB,WAAW,CAAC,EAAE,IAAI,EAAE,CAAA;IACpB,WAAW,EAAE,CAAC,KAAK,EAAE,IAAI,KAAK,KAAK,CAAA;CACpC;AAED,MAAM,WAAW,sBAAsB,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,EAAE,IAAI,SAAS,WAAW,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/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "type": "git",
5
5
  "url": "https://github.com/rsmple/eco-vue-js.git"
6
6
  },
7
- "version": "0.8.5",
7
+ "version": "0.8.6",
8
8
  "scripts": {
9
9
  "dev": "vite",
10
10
  "build": "run-p type-check build-only",