@veltra/desktop 1.2.23 → 1.2.24

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 (31) hide show
  1. package/dist/components/action/action-group.vue.d.ts +2 -2
  2. package/dist/components/action/action.vue.d.ts +1 -1
  3. package/dist/components/auto-complete/auto-complete.vue.d.ts +2 -2
  4. package/dist/components/batch-edit/batch-edit.vue.d.ts +2 -2
  5. package/dist/components/cascade/cascade.vue.d.ts +5 -5
  6. package/dist/components/checkbox/checkbox-button.vue.d.ts +1 -1
  7. package/dist/components/checkbox-group/checkbox-group.vue.d.ts +2 -2
  8. package/dist/components/date-panel/date-panel.vue.d.ts +1 -1
  9. package/dist/components/date-picker/date-picker.vue.d.ts +2 -2
  10. package/dist/components/date-range-picker/date-range-picker.vue.d.ts +2 -2
  11. package/dist/components/file-picker/file-picker.vue.d.ts +1 -1
  12. package/dist/components/input/input.vue.d.ts +4 -4
  13. package/dist/components/multi-select/multi-select.vue.d.ts +2 -2
  14. package/dist/components/multi-tree-select/multi-tree-select.vue.d.ts +4 -4
  15. package/dist/components/number/number.vue.d.ts +1 -1
  16. package/dist/components/number-input/number-input.vue.d.ts +4 -4
  17. package/dist/components/number-range-input/number-range-input.vue.d.ts +1 -1
  18. package/dist/components/password-input/password-input.vue.d.ts +1 -1
  19. package/dist/components/pop-confirm/pop-confirm.vue.d.ts +1 -1
  20. package/dist/components/radio-group/radio-group.vue.d.ts +2 -2
  21. package/dist/components/rich-text-editor/rich-text-editor.vue.d.ts +1 -1
  22. package/dist/components/select/select.js +2 -0
  23. package/dist/components/select/select.js.map +1 -1
  24. package/dist/components/select/select.vue.d.ts +2 -2
  25. package/dist/components/steps/steps.vue.d.ts +2 -2
  26. package/dist/components/textarea/textarea.vue.d.ts +4 -4
  27. package/dist/components/tip/tip.vue.d.ts +1 -1
  28. package/dist/components/tree-select/tree-select.vue.d.ts +4 -4
  29. package/dist/components/watermark/watermark.vue.d.ts +1 -1
  30. package/package.json +6 -6
  31. package/src/components/select/select.vue +2 -0
@@ -6,10 +6,10 @@ type __VLS_Slots = {
6
6
  default?: () => VNode[];
7
7
  };
8
8
  declare const __VLS_base: import("vue").DefineComponent<ActionGroupProps, _ActionGroupExposed, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ActionGroupProps> & Readonly<{}>, {
9
- type: import("@veltra/utils").ColorType;
10
9
  size: "small" | "default" | "large";
11
- max: number;
10
+ type: import("@veltra/utils").ColorType;
12
11
  text: boolean;
12
+ max: number;
13
13
  circle: boolean;
14
14
  loading: boolean;
15
15
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -12,8 +12,8 @@ declare const __VLS_base: import("vue").DefineComponent<ActionProps, {}, {}, {},
12
12
  }, string, import("vue").PublicProps, Readonly<ActionProps> & Readonly<{
13
13
  onRun?: (() => any) | undefined;
14
14
  }>, {
15
- type: ButtonType;
16
15
  size: import("@veltra/utils").ComponentSize;
16
+ type: ButtonType;
17
17
  text: boolean;
18
18
  circle: boolean;
19
19
  loading: boolean;
@@ -22,10 +22,10 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, _Auto
22
22
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
23
23
  onSelect?: ((value: string) => any) | undefined;
24
24
  }>, {
25
- placeholder: string;
26
- clearable: boolean;
27
25
  disabled: boolean;
28
26
  readonly: boolean;
27
+ placeholder: string;
28
+ clearable: boolean;
29
29
  allowCustom: boolean;
30
30
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
31
31
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -6,20 +6,20 @@ declare const __VLS_base: import("vue").DefineComponent<BatchEditProps, {}, {},
6
6
  "update:selected": (value: Record<string, any> | undefined) => any;
7
7
  "update:checked": (value: Record<string, any>[]) => any;
8
8
  "update:current": (row?: TableRow | undefined) => any;
9
+ "update:data": (value: Record<string, any>[]) => any;
9
10
  "update:rows": (rows: TableRow[]) => any;
10
11
  "update:forest": (rows?: import("@cat-kit/core").Forest<Record<string, unknown>, any> | undefined) => any;
11
12
  "cell-click": (row: TableRow, column: TableColumn, ev: MouseEvent) => any;
12
13
  "row-click": (row: TableRow, ev: MouseEvent) => any;
13
- "update:data": (value: Record<string, any>[]) => any;
14
14
  }, string, import("vue").PublicProps, Readonly<BatchEditProps> & Readonly<{
15
15
  "onUpdate:selected"?: ((value: Record<string, any> | undefined) => any) | undefined;
16
16
  "onUpdate:checked"?: ((value: Record<string, any>[]) => any) | undefined;
17
17
  "onUpdate:current"?: ((row?: TableRow | undefined) => any) | undefined;
18
+ "onUpdate:data"?: ((value: Record<string, any>[]) => any) | undefined;
18
19
  "onUpdate:rows"?: ((rows: TableRow[]) => any) | undefined;
19
20
  "onUpdate:forest"?: ((rows?: import("@cat-kit/core").Forest<Record<string, unknown>, any> | undefined) => any) | undefined;
20
21
  "onCell-click"?: ((row: TableRow, column: TableColumn, ev: MouseEvent) => any) | undefined;
21
22
  "onRow-click"?: ((row: TableRow, ev: MouseEvent) => any) | undefined;
22
- "onUpdate:data"?: ((value: Record<string, any>[]) => any) | undefined;
23
23
  }>, {
24
24
  cols: string | [string, string];
25
25
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -2,26 +2,26 @@ import { CascadeProps } from "../../types/cascade.js";
2
2
  //#region src/components/cascade/cascade.vue.d.ts
3
3
  declare const __VLS_export: import("vue").DefineComponent<CascadeProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
4
4
  "update:modelValue": (value?: string | string[] | undefined) => any;
5
- change: (...args: [item?: Record<string, any> | undefined] | [items: Record<string, any>[]]) => any;
6
5
  clear: () => any;
6
+ change: (...args: [item?: Record<string, any> | undefined] | [items: Record<string, any>[]]) => any;
7
7
  "update:label": (label?: string | string[] | undefined) => any;
8
8
  }, string, import("vue").PublicProps, Readonly<CascadeProps> & Readonly<{
9
9
  "onUpdate:modelValue"?: ((value?: string | string[] | undefined) => any) | undefined;
10
- onChange?: ((...args: [item?: Record<string, any> | undefined] | [items: Record<string, any>[]]) => any) | undefined;
11
10
  onClear?: (() => any) | undefined;
11
+ onChange?: ((...args: [item?: Record<string, any> | undefined] | [items: Record<string, any>[]]) => any) | undefined;
12
12
  "onUpdate:label"?: ((label?: string | string[] | undefined) => any) | undefined;
13
13
  }>, {
14
+ disabled: boolean;
15
+ readonly: boolean;
14
16
  labelKey: string;
15
17
  valueKey: string;
16
18
  childrenKey: string;
17
19
  data: Record<string, any>[];
18
20
  placeholder: string;
19
21
  clearable: boolean;
20
- disabled: boolean;
21
- readonly: boolean;
22
22
  filterable: boolean;
23
- visibilityLimit: number;
24
23
  separator: string;
24
+ visibilityLimit: number;
25
25
  showFullPath: boolean;
26
26
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
27
27
  declare const _default: typeof __VLS_export;
@@ -17,9 +17,9 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
17
17
  "onUpdate:modelValue"?: ((checked: boolean) => any) | undefined;
18
18
  onChange?: ((checked: boolean) => any) | undefined;
19
19
  }>, {
20
- type: import("@veltra/utils").ColorType;
21
20
  disabled: boolean;
22
21
  readonly: boolean;
22
+ type: import("@veltra/utils").ColorType;
23
23
  round: boolean;
24
24
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
25
25
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -12,10 +12,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
12
12
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
13
13
  "onUpdate:modelValue"?: ((value: any[]) => any) | undefined;
14
14
  }>, {
15
- labelKey: string;
16
- valueKey: string;
17
15
  disabled: boolean;
18
16
  readonly: boolean;
17
+ labelKey: string;
18
+ valueKey: string;
19
19
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
20
20
  declare const _default: typeof __VLS_export;
21
21
  //#endregion
@@ -7,8 +7,8 @@ declare const __VLS_export: import("vue").DefineComponent<DatePanelProps, {}, {}
7
7
  "onSelect:range-date"?: ((rangeDate?: [import("@cat-kit/core").Dater, import("@cat-kit/core").Dater] | undefined) => any) | undefined;
8
8
  "onSelect:date"?: ((date: import("@cat-kit/core").Dater) => any) | undefined;
9
9
  }>, {
10
- type: "date" | "month" | "year";
11
10
  size: import("@veltra/utils").ComponentSize;
11
+ type: "date" | "month" | "year";
12
12
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
13
  declare const _default: typeof __VLS_export;
14
14
  //#endregion
@@ -5,11 +5,11 @@ declare const __VLS_export: import("vue").DefineComponent<DatePickerProps, {}, {
5
5
  }, string, import("vue").PublicProps, Readonly<DatePickerProps> & Readonly<{
6
6
  "onUpdate:modelValue"?: ((value?: string | number | Date | undefined) => any) | undefined;
7
7
  }>, {
8
+ disabled: boolean;
9
+ readonly: boolean;
8
10
  type: "date" | "month" | "year";
9
11
  placeholder: string;
10
12
  clearable: boolean;
11
- disabled: boolean;
12
- readonly: boolean;
13
13
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
14
14
  declare const _default: typeof __VLS_export;
15
15
  //#endregion
@@ -5,11 +5,11 @@ declare const __VLS_export: import("vue").DefineComponent<DateRangePickerProps,
5
5
  }, string, import("vue").PublicProps, Readonly<DateRangePickerProps> & Readonly<{
6
6
  "onUpdate:modelValue"?: ((value?: [string, string] | undefined) => any) | undefined;
7
7
  }>, {
8
+ disabled: boolean;
9
+ readonly: boolean;
8
10
  type: "date" | "month" | "year";
9
11
  placeholder: [string, string];
10
12
  clearable: boolean;
11
- disabled: boolean;
12
- readonly: boolean;
13
13
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
14
14
  declare const _default: typeof __VLS_export;
15
15
  //#endregion
@@ -11,8 +11,8 @@ declare const __VLS_base: import("vue").DefineComponent<UploaderProps, {}, {}, {
11
11
  }, string, import("vue").PublicProps, Readonly<UploaderProps> & Readonly<{
12
12
  onPick?: ((files: File[]) => any) | undefined;
13
13
  }>, {
14
- multiple: boolean;
15
14
  tag: string;
15
+ multiple: boolean;
16
16
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
17
17
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
18
18
  declare const _default: typeof __VLS_export;
@@ -15,8 +15,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, _Inpu
15
15
  "update:modelValue": (value: string | undefined) => any;
16
16
  } & {
17
17
  "update:modelValue": (value: string) => any;
18
- change: (value: string) => any;
19
18
  clear: () => any;
19
+ change: (value: string) => any;
20
20
  "suffix:click": (value?: string | undefined) => any;
21
21
  "prefix:click": (value?: string | undefined) => any;
22
22
  focus: (value?: string | undefined) => any;
@@ -24,18 +24,18 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, _Inpu
24
24
  "native:input": (ev: Event) => any;
25
25
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
26
26
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
27
- onChange?: ((value: string) => any) | undefined;
28
27
  onClear?: (() => any) | undefined;
28
+ onChange?: ((value: string) => any) | undefined;
29
29
  "onSuffix:click"?: ((value?: string | undefined) => any) | undefined;
30
30
  "onPrefix:click"?: ((value?: string | undefined) => any) | undefined;
31
31
  onFocus?: ((value?: string | undefined) => any) | undefined;
32
32
  onBlur?: ((value?: string | undefined) => any) | undefined;
33
33
  "onNative:input"?: ((ev: Event) => any) | undefined;
34
34
  }>, {
35
- placeholder: string;
36
- clearable: boolean;
37
35
  disabled: boolean;
38
36
  readonly: boolean;
37
+ placeholder: string;
38
+ clearable: boolean;
39
39
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
40
40
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
41
41
  declare const _default: typeof __VLS_export;
@@ -26,12 +26,12 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
26
26
  "onUpdate:modelValue"?: ((value: any[]) => any) | undefined;
27
27
  onChange?: ((options: Record<string, any>[]) => any) | undefined;
28
28
  }>, {
29
+ disabled: boolean;
30
+ readonly: boolean;
29
31
  labelKey: string;
30
32
  valueKey: string;
31
33
  placeholder: string;
32
34
  clearable: boolean;
33
- disabled: boolean;
34
- readonly: boolean;
35
35
  minWidth: string;
36
36
  visibilityLimit: number;
37
37
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -14,20 +14,20 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
14
14
  "update:modelValue": (value: (string | number)[]) => any;
15
15
  } & {
16
16
  "update:modelValue": (value: any[]) => any;
17
- change: (checked: Record<string, any>[]) => any;
18
17
  clear: () => any;
18
+ change: (checked: Record<string, any>[]) => any;
19
19
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
20
20
  "onUpdate:modelValue"?: ((value: any[]) => any) | undefined;
21
- onChange?: ((checked: Record<string, any>[]) => any) | undefined;
22
21
  onClear?: (() => any) | undefined;
22
+ onChange?: ((checked: Record<string, any>[]) => any) | undefined;
23
23
  }>, {
24
+ disabled: boolean;
25
+ readonly: boolean;
24
26
  expandAll: boolean;
25
27
  labelKey: string;
26
28
  valueKey: string;
27
29
  placeholder: string;
28
30
  clearable: boolean;
29
- disabled: boolean;
30
- readonly: boolean;
31
31
  filterable: boolean;
32
32
  minWidth: string;
33
33
  visibilityLimit: number;
@@ -1,8 +1,8 @@
1
1
  import { NumberProps } from "../../types/number.js";
2
2
  //#region src/components/number/number.vue.d.ts
3
3
  declare const __VLS_export: import("vue").DefineComponent<NumberProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<NumberProps> & Readonly<{}>, {
4
- duration: number;
5
4
  format: "currency" | "percent" | "decimal";
5
+ duration: number;
6
6
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
7
7
  declare const _default: typeof __VLS_export;
8
8
  //#endregion
@@ -13,17 +13,17 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
13
13
  "update:modelValue": (value: number | undefined) => any;
14
14
  } & {
15
15
  "update:modelValue": (value?: number | undefined) => any;
16
- change: (value?: number | undefined) => any;
17
16
  clear: () => any;
17
+ change: (value?: number | undefined) => any;
18
18
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
19
19
  "onUpdate:modelValue"?: ((value?: number | undefined) => any) | undefined;
20
- onChange?: ((value?: number | undefined) => any) | undefined;
21
20
  onClear?: (() => any) | undefined;
21
+ onChange?: ((value?: number | undefined) => any) | undefined;
22
22
  }>, {
23
- placeholder: string;
24
- clearable: boolean;
25
23
  disabled: boolean;
26
24
  readonly: boolean;
25
+ placeholder: string;
26
+ clearable: boolean;
27
27
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
28
28
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
29
29
  declare const _default: typeof __VLS_export;
@@ -22,9 +22,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
22
22
  "onUpdate:start"?: ((value: number | undefined) => any) | undefined;
23
23
  "onUpdate:end"?: ((value: number | undefined) => any) | undefined;
24
24
  }>, {
25
- clearable: boolean;
26
25
  disabled: boolean;
27
26
  readonly: boolean;
27
+ clearable: boolean;
28
28
  startPlaceholder: string;
29
29
  endPlaceholder: string;
30
30
  separator: string;
@@ -13,9 +13,9 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
13
13
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
14
14
  "onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
15
15
  }>, {
16
- clearable: boolean;
17
16
  disabled: boolean;
18
17
  readonly: boolean;
18
+ clearable: boolean;
19
19
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
20
20
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
21
21
  declare const _default: typeof __VLS_export;
@@ -12,8 +12,8 @@ declare const __VLS_base: import("vue").DefineComponent<PopConfirmProps, {}, {},
12
12
  onConfirm?: (() => any) | undefined;
13
13
  onCancel?: (() => any) | undefined;
14
14
  }>, {
15
- trigger: "hover" | "click";
16
15
  direction: TipDirection;
16
+ trigger: "hover" | "click";
17
17
  icon: import("vue").Component;
18
18
  iconColor: string;
19
19
  confirmText: string;
@@ -14,10 +14,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
14
14
  "onUpdate:modelValue"?: ((value: any) => any) | undefined;
15
15
  onChange?: ((item: Record<string, any>) => any) | undefined;
16
16
  }>, {
17
- labelKey: string;
18
- valueKey: string;
19
17
  disabled: boolean;
20
18
  readonly: boolean;
19
+ labelKey: string;
20
+ valueKey: string;
21
21
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
22
22
  declare const _default: typeof __VLS_export;
23
23
  //#endregion
@@ -10,9 +10,9 @@ declare const __VLS_export: import("vue").DefineComponent<RichTextEditorProps &
10
10
  }> & Readonly<{
11
11
  "onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
12
12
  }>, {
13
- placeholder: string;
14
13
  disabled: boolean;
15
14
  readonly: boolean;
15
+ placeholder: string;
16
16
  format: RichTextFormat;
17
17
  toolbar: ToolbarItem[];
18
18
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -171,6 +171,8 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
171
171
  const handleClear = () => {
172
172
  lock();
173
173
  selected.value = void 0;
174
+ currentIndex.value = -1;
175
+ label.value = void 0;
174
176
  clearCreatedOptions();
175
177
  emit("update:modelValue", void 0);
176
178
  emit("change", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"select.js","names":["$attrs","$slots"],"sources":["../../../src/components/select/select.vue"],"sourcesContent":["<template>\n <u-dropdown\n v-if=\"!readonly\"\n v-bind=\"$attrs\"\n trigger=\"click\"\n :class=\"[cls.b, bem.is('disabled', disabled)]\"\n ref=\"dropdownRef\"\n v-model:visible=\"dropdownVisible\"\n :content-class=\"[cls.e('panel'), cls.em('panel', size), contentClass]\"\n :content-style=\"contentStyle\"\n :disabled=\"disabled\"\n :min-width=\"minWidth\"\n :width=\"width\"\n @keydown=\"handleKeydown\"\n @update:visible=\"handleDropdownVisible\"\n >\n <!-- 触发 -->\n <template #trigger>\n <u-input\n :size=\"size\"\n :disabled=\"disabled\"\n :placeholder=\"placeholder\"\n :clearable=\"clearable\"\n :model-value=\"displayedValue\"\n @clear=\"handleClear\"\n @keydown=\"handleKeydown\"\n native-readonly\n >\n <template #prefix v-if=\"$slots.prefix\">\n <slot name=\"prefix\" />\n </template>\n\n <template #suffix>\n <u-icon :class=\"cls.e('arrow')\">\n <ArrowDown />\n </u-icon>\n </template>\n </u-input>\n </template>\n\n <!-- 下拉内容 -->\n <template #content>\n <!-- 过滤器 -->\n <div v-if=\"filterable\" :class=\"cls.e('content-filter')\">\n <u-input placeholder=\"输入关键字进行搜索\" tabindex=\"0\" v-focus v-model=\"queryString\">\n <template #suffix>\n <u-icon>\n <Search />\n </u-icon>\n </template>\n </u-input>\n </div>\n\n <!--\n 单选列表。虚拟化启用时,内容容器 height 由 useVirtualizer 命令式写入;\n 此处 content-style 仅承担 grid 相关样式,避免 height 变化触发模板重渲染。\n -->\n <u-scroll\n v-if=\"options.length\"\n tag=\"ul\"\n :class=\"cls.e('options')\"\n ref=\"scrollRef\"\n :content-class=\"[\n cls.e('options-wrap'),\n bem.is('virtual', virtualEnabled),\n bem.is('grid', !!grid)\n ]\"\n :content-style=\"{\n gridTemplateColumns: grid ? `repeat(${grid.cols}, minmax(0px, 1fr))` : undefined,\n gridGap: grid ? withUnit(grid.gap, 'px') : undefined\n }\"\n >\n <template v-if=\"virtualEnabled\">\n <!-- @vue-ignore -->\n <li\n v-for=\"{ option, index, val, label, key, offset } of virtualOptions\"\n :class=\"[optionClass, bem.is('selected', index === currentIndex)]\"\n @click=\"handleSelect(option, index)\"\n :key=\"key\"\n :style=\"{ transform: `translateY(${offset}px)` }\"\n :data-index=\"index\"\n :ref=\"(el) => measureElement(index, el as Element | null)\"\n >\n <slot v-bind=\"{ option, index }\">\n {{ label }}\n </slot>\n </li>\n </template>\n\n <template v-else>\n <li\n v-for=\"(option, index) of options\"\n :class=\"[optionClass, bem.is('selected', index === currentIndex)]\"\n @click=\"handleSelect(option, index)\"\n :data-index=\"index\"\n :title=\"o(option).get(labelKey)\"\n :key=\"o(option).get(valueKey)\"\n >\n <slot v-bind=\"{ option, index }\">\n {{ o(option).get(labelKey) }}\n </slot>\n </li>\n </template>\n </u-scroll>\n\n <div v-else :class=\"cls.e('empty')\">\n <UEmpty />\n </div>\n </template>\n </u-dropdown>\n\n <template v-else>\n {{ displayedValue || FORM_EMPTY_CONTENT }}\n </template>\n</template>\n\n<script lang=\"ts\" setup>\nimport { o } from '@cat-kit/core'\nimport { useFormFallbackProps, useVirtualizer } from '@veltra/compositions'\nimport { vFocus } from '@veltra/directives'\nimport { ArrowDown, Search } from '@veltra/icons/normal'\nimport { bem, FORM_EMPTY_CONTENT, scrollIntoContainerView, withUnit } from '@veltra/utils'\nimport { injectFormContext } from '@veltra/utils'\nimport { computed, nextTick, shallowRef, watch } from 'vue'\n\nimport type {\n SelectEmits,\n SelectProps,\n _SelectExposed,\n DropdownExposed,\n ScrollExposed\n} from '../../types'\nimport { UDropdown } from '../dropdown'\nimport { UEmpty } from '../empty'\nimport { UIcon } from '../icon'\nimport { UInput } from '../input'\nimport { UScroll } from '../scroll'\nimport { useKeyboard } from './use-keyboard'\nimport { useOptions } from './use-options'\n\ndefineOptions({ name: 'USelect', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<SelectProps>(), {\n labelKey: 'label',\n valueKey: 'value',\n placeholder: '请选择',\n clearable: true,\n disabled: undefined,\n readonly: undefined\n})\n\nconst emit = defineEmits<SelectEmits>()\n\ndefineSlots<{\n /** 前缀插槽 */\n prefix?: () => any\n /** 默认插槽 */\n default?: (scope: { option: Record<string, any>; index: number }) => any\n}>()\n\nconst cls = bem('select')\n\nconst optionClass = cls.e('option')\n\nconst { formProps } = injectFormContext()\nconst { size, disabled, readonly } = useFormFallbackProps([formProps ?? {}, props], {\n size: 'default',\n disabled: false,\n readonly: false\n})\n\nconst currentIndex = shallowRef(-1)\nconst label = defineModel('text')\nconst selected = shallowRef<Record<string, any>>()\n\nconst displayedValue = computed(() => {\n if (label.value) return label.value\n\n return selected.value ? o(selected.value).get(props.labelKey) : String(props.modelValue ?? '')\n})\n\nconst dropdownRef = shallowRef<DropdownExposed>()\nconst scrollRef = shallowRef<ScrollExposed>()\n\nconst filterable = computed(() => {\n return props.filterable || typeof props.options === 'function'\n})\n\nconst { queryString, options, temOptionsToCreatedOptions, clearCreatedOptions } = useOptions({\n props\n})\n\n// TODO: 优化\nlet userSelecting = false\nfunction lock() {\n userSelecting = true\n}\n\nfunction unlock() {\n nextTick(() => {\n userSelecting = false\n })\n}\n\n// 回显\nwatch(\n [() => props.modelValue, options],\n ([modelValue, options]) => {\n if (userSelecting) return\n\n if (!options?.length) return\n\n const { valueKey, labelKey } = props\n\n if (modelValue !== undefined && modelValue !== null && modelValue !== '') {\n currentIndex.value = options.findIndex((option) => o(option).get(valueKey) === modelValue)\n selected.value = currentIndex.value >= 0 ? options[currentIndex.value] : undefined\n label.value = selected.value ? o(selected.value).get(labelKey) : undefined\n } else {\n currentIndex.value = -1\n selected.value = undefined\n label.value = undefined\n }\n },\n { immediate: true }\n)\n\nconst baseVirtualEnabled = computed(() => options.value.length > 80)\nconst virtualEnabled = computed(() => baseVirtualEnabled.value && !props.grid)\n\nconst { virtualizer, items } = useVirtualizer({\n count: computed(() => options.value.length),\n scrollEl: () => scrollRef.value?.containerRef ?? null,\n contentEl: () => (virtualEnabled.value ? (scrollRef.value?.contentRef ?? null) : null),\n gap: 4,\n estimateSize: () => 40\n})\n\nconst virtualOptions = computed(() => {\n const _options = options.value\n const { labelKey, valueKey } = props\n return items.value.map((item) => {\n const option = _options[item.index]!\n return {\n option,\n index: item.index,\n label: o(option).get(labelKey),\n val: o(option).get(valueKey),\n key: item.index,\n offset: item.start\n }\n })\n})\n\nconst measureElement: (index: number, el: Element | null) => void = (index, el) =>\n virtualizer.measureElement(index, el)\n\nfunction scrollTo(index: number): void {\n virtualizer.scrollToIndex(index, { align: 'center' })\n}\n\nwatch([scrollRef, virtualEnabled], ([scroll, virtualEnabled]) => {\n if (!scroll || !props.modelValue) return\n\n if (virtualEnabled) {\n const index = options.value.findIndex((option) => option === selected.value)\n index !== -1 && dropdownVisible.value && nextTick(() => scrollTo(index))\n } else {\n const selectedEl = scroll?.contentRef?.getElementsByClassName('is-selected')[0]\n if (selectedEl) {\n scrollIntoContainerView(selectedEl as HTMLElement, scroll.containerRef ?? null)\n }\n }\n})\n\nconst dropdownVisible = shallowRef(false)\n\nwatch(dropdownVisible, (v) => {\n if (!v) {\n queryString.value = ''\n }\n})\n\nconst handleDropdownVisible = (visible: boolean) => {\n if (!visible) {\n queryString.value = ''\n }\n}\n\n/** 单选 */\nconst handleSelect = (option: Record<string, any>, index: number) => {\n lock()\n selected.value = option\n\n emit('update:modelValue', option?.[props.valueKey])\n label.value = option?.[props.labelKey]\n emit('change', option)\n if (option.__isTemp) {\n temOptionsToCreatedOptions()\n }\n currentIndex.value = index\n dropdownRef.value?.close()\n\n unlock()\n}\n\n/** 清除选项 */\nconst handleClear = () => {\n lock()\n selected.value = undefined\n clearCreatedOptions()\n emit('update:modelValue', undefined)\n emit('change', undefined)\n unlock()\n}\n\nfunction getCurrentEl() {\n return scrollRef.value?.contentRef?.querySelector('li.is-selected') as HTMLElement | undefined\n}\n\nconst { handleKeydown } = useKeyboard({\n options,\n currentIndex,\n selectOption: handleSelect,\n getCurrentEl\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8IA,MAAM,QAAQ;EASd,MAAM,OAAO;EASb,MAAM,MAAM,IAAI,QAAQ;EAExB,MAAM,cAAc,IAAI,EAAE,QAAQ;EAElC,MAAM,EAAE,cAAc,kBAAkB;EACxC,MAAM,EAAE,MAAM,UAAU,aAAa,qBAAqB,CAAC,aAAa,CAAC,GAAG,KAAK,GAAG;GAClF,MAAM;GACN,UAAU;GACV,UAAU;EACZ,CAAC;EAED,MAAM,eAAe,WAAW,EAAE;EAClC,MAAM,QAAQ,SAAW,SAAC,MAAM;EAChC,MAAM,WAAW,WAAgC;EAEjD,MAAM,iBAAiB,eAAe;GACpC,IAAI,MAAM,OAAO,OAAO,MAAM;GAE9B,OAAO,SAAS,QAAQ,EAAE,SAAS,KAAK,CAAC,CAAC,IAAI,MAAM,QAAQ,IAAI,OAAO,MAAM,cAAc,EAAE;EAC/F,CAAC;EAED,MAAM,cAAc,WAA4B;EAChD,MAAM,YAAY,WAA0B;EAE5C,MAAM,aAAa,eAAe;GAChC,OAAO,MAAM,cAAc,OAAO,MAAM,YAAY;EACtD,CAAC;EAED,MAAM,EAAE,aAAa,SAAS,4BAA4B,wBAAwB,WAAW,EAC3F,MACF,CAAC;EAGD,IAAI,gBAAgB;EACpB,SAAS,OAAO;GACd,gBAAgB;EAClB;EAEA,SAAS,SAAS;GAChB,eAAe;IACb,gBAAgB;GAClB,CAAC;EACH;EAGA,MACE,OAAO,MAAM,YAAY,OAAO,IAC/B,CAAC,YAAY,aAAa;GACzB,IAAI,eAAe;GAEnB,IAAI,CAAC,SAAS,QAAQ;GAEtB,MAAM,EAAE,UAAU,aAAa;GAE/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BAWK,MAAA;QATF,OAAK,eAAA,CAAG,MAAA,WAAA,GAAa,MAAA,GAAA,CAAG,CAAC,GAAE,YAAa,UAAU,aAAA,KAAY,CAAA,CAAA;QAC9D,UAAK,WAAE,aAAa,QAAQ,KAAK;QACjC,cAAY;QACZ,OAAO,MAAA,CAAA,CAAC,CAAC,MAAM,CAAA,CAAE,IAAI,QAAA,QAAQ;QAC7B,KAAK,MAAA,CAAA,CAAC,CAAC,MAAM,CAAA,CAAE,IAAI,QAAA,QAAQ;WAE5B,WAEO,KAAA,QAAA,WAFP,WAEO,EAAA,SAAA,KAAA,GAAA;QAFS;QAAQ;OAAK,CAAA,SAEtB,CAAA,gBAAA,gBADF,MAAA,CAAA,CAAC,CAAC,MAAM,CAAA,CAAE,IAAI,QAAA,QAAQ,CAAA,GAAA,CAAA,CAAA,CAAA,CAAA,GAAA,IAAA,UAAA;;;;;;;yBAMjC,mBAEM,OAAA;;MAFO,OAAK,eAAE,MAAA,GAAA,CAAG,CAAC,EAAC,OAAA,CAAA;SACvB,YAAU,MAAA,WAAA,CAAA,CAAA,GAAA,CAAA;;;;;;;;;;;;uBAKhB,mBAEW,UAAA,EAAA,KAAA,EAAA,GAAA,CAAA,gBAAA,gBADN,eAAA,SAAkB,MAAA,kBAAA,CAAkB,GAAA,CAAA,CAAA,GAAA,EAAA"}
1
+ {"version":3,"file":"select.js","names":["$attrs","$slots"],"sources":["../../../src/components/select/select.vue"],"sourcesContent":["<template>\n <u-dropdown\n v-if=\"!readonly\"\n v-bind=\"$attrs\"\n trigger=\"click\"\n :class=\"[cls.b, bem.is('disabled', disabled)]\"\n ref=\"dropdownRef\"\n v-model:visible=\"dropdownVisible\"\n :content-class=\"[cls.e('panel'), cls.em('panel', size), contentClass]\"\n :content-style=\"contentStyle\"\n :disabled=\"disabled\"\n :min-width=\"minWidth\"\n :width=\"width\"\n @keydown=\"handleKeydown\"\n @update:visible=\"handleDropdownVisible\"\n >\n <!-- 触发 -->\n <template #trigger>\n <u-input\n :size=\"size\"\n :disabled=\"disabled\"\n :placeholder=\"placeholder\"\n :clearable=\"clearable\"\n :model-value=\"displayedValue\"\n @clear=\"handleClear\"\n @keydown=\"handleKeydown\"\n native-readonly\n >\n <template #prefix v-if=\"$slots.prefix\">\n <slot name=\"prefix\" />\n </template>\n\n <template #suffix>\n <u-icon :class=\"cls.e('arrow')\">\n <ArrowDown />\n </u-icon>\n </template>\n </u-input>\n </template>\n\n <!-- 下拉内容 -->\n <template #content>\n <!-- 过滤器 -->\n <div v-if=\"filterable\" :class=\"cls.e('content-filter')\">\n <u-input placeholder=\"输入关键字进行搜索\" tabindex=\"0\" v-focus v-model=\"queryString\">\n <template #suffix>\n <u-icon>\n <Search />\n </u-icon>\n </template>\n </u-input>\n </div>\n\n <!--\n 单选列表。虚拟化启用时,内容容器 height 由 useVirtualizer 命令式写入;\n 此处 content-style 仅承担 grid 相关样式,避免 height 变化触发模板重渲染。\n -->\n <u-scroll\n v-if=\"options.length\"\n tag=\"ul\"\n :class=\"cls.e('options')\"\n ref=\"scrollRef\"\n :content-class=\"[\n cls.e('options-wrap'),\n bem.is('virtual', virtualEnabled),\n bem.is('grid', !!grid)\n ]\"\n :content-style=\"{\n gridTemplateColumns: grid ? `repeat(${grid.cols}, minmax(0px, 1fr))` : undefined,\n gridGap: grid ? withUnit(grid.gap, 'px') : undefined\n }\"\n >\n <template v-if=\"virtualEnabled\">\n <!-- @vue-ignore -->\n <li\n v-for=\"{ option, index, val, label, key, offset } of virtualOptions\"\n :class=\"[optionClass, bem.is('selected', index === currentIndex)]\"\n @click=\"handleSelect(option, index)\"\n :key=\"key\"\n :style=\"{ transform: `translateY(${offset}px)` }\"\n :data-index=\"index\"\n :ref=\"(el) => measureElement(index, el as Element | null)\"\n >\n <slot v-bind=\"{ option, index }\">\n {{ label }}\n </slot>\n </li>\n </template>\n\n <template v-else>\n <li\n v-for=\"(option, index) of options\"\n :class=\"[optionClass, bem.is('selected', index === currentIndex)]\"\n @click=\"handleSelect(option, index)\"\n :data-index=\"index\"\n :title=\"o(option).get(labelKey)\"\n :key=\"o(option).get(valueKey)\"\n >\n <slot v-bind=\"{ option, index }\">\n {{ o(option).get(labelKey) }}\n </slot>\n </li>\n </template>\n </u-scroll>\n\n <div v-else :class=\"cls.e('empty')\">\n <UEmpty />\n </div>\n </template>\n </u-dropdown>\n\n <template v-else>\n {{ displayedValue || FORM_EMPTY_CONTENT }}\n </template>\n</template>\n\n<script lang=\"ts\" setup>\nimport { o } from '@cat-kit/core'\nimport { useFormFallbackProps, useVirtualizer } from '@veltra/compositions'\nimport { vFocus } from '@veltra/directives'\nimport { ArrowDown, Search } from '@veltra/icons/normal'\nimport { bem, FORM_EMPTY_CONTENT, scrollIntoContainerView, withUnit } from '@veltra/utils'\nimport { injectFormContext } from '@veltra/utils'\nimport { computed, nextTick, shallowRef, watch } from 'vue'\n\nimport type {\n SelectEmits,\n SelectProps,\n _SelectExposed,\n DropdownExposed,\n ScrollExposed\n} from '../../types'\nimport { UDropdown } from '../dropdown'\nimport { UEmpty } from '../empty'\nimport { UIcon } from '../icon'\nimport { UInput } from '../input'\nimport { UScroll } from '../scroll'\nimport { useKeyboard } from './use-keyboard'\nimport { useOptions } from './use-options'\n\ndefineOptions({ name: 'USelect', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<SelectProps>(), {\n labelKey: 'label',\n valueKey: 'value',\n placeholder: '请选择',\n clearable: true,\n disabled: undefined,\n readonly: undefined\n})\n\nconst emit = defineEmits<SelectEmits>()\n\ndefineSlots<{\n /** 前缀插槽 */\n prefix?: () => any\n /** 默认插槽 */\n default?: (scope: { option: Record<string, any>; index: number }) => any\n}>()\n\nconst cls = bem('select')\n\nconst optionClass = cls.e('option')\n\nconst { formProps } = injectFormContext()\nconst { size, disabled, readonly } = useFormFallbackProps([formProps ?? {}, props], {\n size: 'default',\n disabled: false,\n readonly: false\n})\n\nconst currentIndex = shallowRef(-1)\nconst label = defineModel('text')\nconst selected = shallowRef<Record<string, any>>()\n\nconst displayedValue = computed(() => {\n if (label.value) return label.value\n\n return selected.value ? o(selected.value).get(props.labelKey) : String(props.modelValue ?? '')\n})\n\nconst dropdownRef = shallowRef<DropdownExposed>()\nconst scrollRef = shallowRef<ScrollExposed>()\n\nconst filterable = computed(() => {\n return props.filterable || typeof props.options === 'function'\n})\n\nconst { queryString, options, temOptionsToCreatedOptions, clearCreatedOptions } = useOptions({\n props\n})\n\n// TODO: 优化\nlet userSelecting = false\nfunction lock() {\n userSelecting = true\n}\n\nfunction unlock() {\n nextTick(() => {\n userSelecting = false\n })\n}\n\n// 回显\nwatch(\n [() => props.modelValue, options],\n ([modelValue, options]) => {\n if (userSelecting) return\n\n if (!options?.length) return\n\n const { valueKey, labelKey } = props\n\n if (modelValue !== undefined && modelValue !== null && modelValue !== '') {\n currentIndex.value = options.findIndex((option) => o(option).get(valueKey) === modelValue)\n selected.value = currentIndex.value >= 0 ? options[currentIndex.value] : undefined\n label.value = selected.value ? o(selected.value).get(labelKey) : undefined\n } else {\n currentIndex.value = -1\n selected.value = undefined\n label.value = undefined\n }\n },\n { immediate: true }\n)\n\nconst baseVirtualEnabled = computed(() => options.value.length > 80)\nconst virtualEnabled = computed(() => baseVirtualEnabled.value && !props.grid)\n\nconst { virtualizer, items } = useVirtualizer({\n count: computed(() => options.value.length),\n scrollEl: () => scrollRef.value?.containerRef ?? null,\n contentEl: () => (virtualEnabled.value ? (scrollRef.value?.contentRef ?? null) : null),\n gap: 4,\n estimateSize: () => 40\n})\n\nconst virtualOptions = computed(() => {\n const _options = options.value\n const { labelKey, valueKey } = props\n return items.value.map((item) => {\n const option = _options[item.index]!\n return {\n option,\n index: item.index,\n label: o(option).get(labelKey),\n val: o(option).get(valueKey),\n key: item.index,\n offset: item.start\n }\n })\n})\n\nconst measureElement: (index: number, el: Element | null) => void = (index, el) =>\n virtualizer.measureElement(index, el)\n\nfunction scrollTo(index: number): void {\n virtualizer.scrollToIndex(index, { align: 'center' })\n}\n\nwatch([scrollRef, virtualEnabled], ([scroll, virtualEnabled]) => {\n if (!scroll || !props.modelValue) return\n\n if (virtualEnabled) {\n const index = options.value.findIndex((option) => option === selected.value)\n index !== -1 && dropdownVisible.value && nextTick(() => scrollTo(index))\n } else {\n const selectedEl = scroll?.contentRef?.getElementsByClassName('is-selected')[0]\n if (selectedEl) {\n scrollIntoContainerView(selectedEl as HTMLElement, scroll.containerRef ?? null)\n }\n }\n})\n\nconst dropdownVisible = shallowRef(false)\n\nwatch(dropdownVisible, (v) => {\n if (!v) {\n queryString.value = ''\n }\n})\n\nconst handleDropdownVisible = (visible: boolean) => {\n if (!visible) {\n queryString.value = ''\n }\n}\n\n/** 单选 */\nconst handleSelect = (option: Record<string, any>, index: number) => {\n lock()\n selected.value = option\n\n emit('update:modelValue', option?.[props.valueKey])\n label.value = option?.[props.labelKey]\n emit('change', option)\n if (option.__isTemp) {\n temOptionsToCreatedOptions()\n }\n currentIndex.value = index\n dropdownRef.value?.close()\n\n unlock()\n}\n\n/** 清除选项 */\nconst handleClear = () => {\n lock()\n selected.value = undefined\n currentIndex.value = -1\n label.value = undefined\n clearCreatedOptions()\n emit('update:modelValue', undefined)\n emit('change', undefined)\n unlock()\n}\n\nfunction getCurrentEl() {\n return scrollRef.value?.contentRef?.querySelector('li.is-selected') as HTMLElement | undefined\n}\n\nconst { handleKeydown } = useKeyboard({\n options,\n currentIndex,\n selectOption: handleSelect,\n getCurrentEl\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8IA,MAAM,QAAQ;EASd,MAAM,OAAO;EASb,MAAM,MAAM,IAAI,QAAQ;EAExB,MAAM,cAAc,IAAI,EAAE,QAAQ;EAElC,MAAM,EAAE,cAAc,kBAAkB;EACxC,MAAM,EAAE,MAAM,UAAU,aAAa,qBAAqB,CAAC,aAAa,CAAC,GAAG,KAAK,GAAG;GAClF,MAAM;GACN,UAAU;GACV,UAAU;EACZ,CAA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AAC,MAAM,CAAA,CAAE,IAAI,QAAA,QAAQ,CAAA,GAAA,CAAA,CAAA,CAAA,CAAA,GAAA,IAAA,UAAA;;;;;;;yBAMjC,mBAEM,OAAA;;MAFO,OAAK,eAAE,MAAA,GAAA,CAAG,CAAC,EAAC,OAAA,CAAA;SACvB,YAAU,MAAA,WAAA,CAAA,CAAA,GAAA,CAAA;;;;;;;;;;;;uBAKhB,mBAEW,UAAA,EAAA,KAAA,EAAA,GAAA,CAAA,gBAAA,gBADN,eAAA,SAAkB,MAAA,kBAAA,CAAkB,GAAA,CAAA,CAAA,GAAA,EAAA"}
@@ -24,12 +24,12 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
24
24
  "onUpdate:text"?: ((value: any) => any) | undefined;
25
25
  "onUpdate:label"?: ((label?: string | undefined) => any) | undefined;
26
26
  }>, {
27
+ disabled: boolean;
28
+ readonly: boolean;
27
29
  labelKey: string;
28
30
  valueKey: string;
29
31
  placeholder: string;
30
32
  clearable: boolean;
31
- disabled: boolean;
32
- readonly: boolean;
33
33
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
34
34
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
35
35
  declare const _default: typeof __VLS_export;
@@ -6,11 +6,11 @@ type __VLS_Slots = {
6
6
  tip?: (scope: StepsSlotScope) => any;
7
7
  };
8
8
  declare const __VLS_base: import("vue").DefineComponent<StepsProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
9
- "update:current": (value?: string | number | undefined) => any;
10
9
  "item-click": (item: Record<string, any>, index: number) => any;
10
+ "update:current": (value?: string | number | undefined) => any;
11
11
  }, string, import("vue").PublicProps, Readonly<StepsProps> & Readonly<{
12
- "onUpdate:current"?: ((value?: string | number | undefined) => any) | undefined;
13
12
  "onItem-click"?: ((item: Record<string, any>, index: number) => any) | undefined;
13
+ "onUpdate:current"?: ((value?: string | number | undefined) => any) | undefined;
14
14
  }>, {
15
15
  labelKey: string;
16
16
  direction: "horizontal" | "vertical";
@@ -9,21 +9,21 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
9
9
  "update:modelValue": (value: string | undefined) => any;
10
10
  } & {
11
11
  "update:modelValue": (value: string) => any;
12
- change: (value: string) => any;
13
12
  clear: () => any;
13
+ change: (value: string) => any;
14
14
  focus: () => any;
15
15
  blur: () => any;
16
16
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
17
17
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
18
- onChange?: ((value: string) => any) | undefined;
19
18
  onClear?: (() => any) | undefined;
19
+ onChange?: ((value: string) => any) | undefined;
20
20
  onFocus?: (() => any) | undefined;
21
21
  onBlur?: (() => any) | undefined;
22
22
  }>, {
23
- placeholder: string;
24
- clearable: boolean;
25
23
  disabled: boolean;
26
24
  readonly: boolean;
25
+ placeholder: string;
26
+ clearable: boolean;
27
27
  resize: boolean;
28
28
  autosize: boolean;
29
29
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -9,10 +9,10 @@ declare const __VLS_base: import("vue").DefineComponent<TipProps, {}, {}, {}, {}
9
9
  }, string, import("vue").PublicProps, Readonly<TipProps> & Readonly<{
10
10
  "onUpdate:visible"?: ((value: boolean) => any) | undefined;
11
11
  }>, {
12
+ direction: TipDirection;
12
13
  trigger: "hover" | "click";
13
14
  contentTag: string;
14
15
  visible: boolean;
15
- direction: TipDirection;
16
16
  content: string;
17
17
  alignment: TipAlign;
18
18
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -15,22 +15,22 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
15
15
  "update:modelValue": (value: string | number | undefined) => any;
16
16
  } & {
17
17
  "update:modelValue": (value?: string | number | undefined) => any;
18
- change: (selectedData?: Record<string, any> | undefined) => any;
19
18
  clear: () => any;
19
+ change: (selectedData?: Record<string, any> | undefined) => any;
20
20
  "update:text": (text?: string | undefined) => any;
21
21
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
22
22
  "onUpdate:modelValue"?: ((value?: string | number | undefined) => any) | undefined;
23
- onChange?: ((selectedData?: Record<string, any> | undefined) => any) | undefined;
24
23
  onClear?: (() => any) | undefined;
24
+ onChange?: ((selectedData?: Record<string, any> | undefined) => any) | undefined;
25
25
  "onUpdate:text"?: ((text?: string | undefined) => any) | undefined;
26
26
  }>, {
27
+ disabled: boolean;
28
+ readonly: boolean;
27
29
  expandAll: boolean;
28
30
  labelKey: string;
29
31
  valueKey: string;
30
32
  placeholder: string;
31
33
  clearable: boolean;
32
- disabled: boolean;
33
- readonly: boolean;
34
34
  filterable: boolean;
35
35
  minWidth: string;
36
36
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -5,8 +5,8 @@ type __VLS_Slots = {} & {
5
5
  default?: (props: typeof __VLS_7) => any;
6
6
  };
7
7
  declare const __VLS_base: import("vue").DefineComponent<WatermarkProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<WatermarkProps> & Readonly<{}>, {
8
- route: number;
9
8
  fontSize: number;
9
+ route: number;
10
10
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
11
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
12
12
  declare const _default: typeof __VLS_export;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veltra/desktop",
3
- "version": "1.2.23",
3
+ "version": "1.2.24",
4
4
  "files": [
5
5
  "dist",
6
6
  "src"
@@ -57,11 +57,11 @@
57
57
  "@cat-kit/core": ">=1.1.8",
58
58
  "@cat-kit/excel": ">=1.0.0",
59
59
  "@cat-kit/fe": "^1.1.8",
60
- "@veltra/compositions": "1.2.23",
61
- "@veltra/directives": "1.2.23",
62
- "@veltra/icons": "1.2.23",
63
- "@veltra/styles": "1.2.23",
64
- "@veltra/utils": "1.2.23",
60
+ "@veltra/compositions": "1.2.24",
61
+ "@veltra/directives": "1.2.24",
62
+ "@veltra/icons": "1.2.24",
63
+ "@veltra/styles": "1.2.24",
64
+ "@veltra/utils": "1.2.24",
65
65
  "vue": ">=3.5.39"
66
66
  },
67
67
  "devDependencies": {
@@ -308,6 +308,8 @@ const handleSelect = (option: Record<string, any>, index: number) => {
308
308
  const handleClear = () => {
309
309
  lock()
310
310
  selected.value = undefined
311
+ currentIndex.value = -1
312
+ label.value = undefined
311
313
  clearCreatedOptions()
312
314
  emit('update:modelValue', undefined)
313
315
  emit('change', undefined)