x-next 1.10.0 → 1.10.1

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 (29) hide show
  1. package/AI_USAGE.md +4 -2
  2. package/CHANGELOG.md +13 -1
  3. package/dist/components/_components/select-view/select-view.d.ts +9 -0
  4. package/dist/components/form-select/Select.d.ts +18 -5
  5. package/dist/components/form-select/SelectOptionGroup.vue.d.ts +1 -0
  6. package/dist/components/form-select/hooks/use-options.d.ts +1 -1
  7. package/dist/components/form-select/hooks/use-select.d.ts +1 -1
  8. package/dist/components/form-select/index.d.ts +42 -11
  9. package/dist/components/form-select/interface.d.ts +8 -0
  10. package/dist/components/pagination/page-options.vue.d.ts +60 -32
  11. package/dist/components/trigger/interface.d.ts +2 -0
  12. package/dist/es/components/_components/select-view/select-view.js +89 -78
  13. package/dist/es/components/button/Button.js +1 -1
  14. package/dist/es/components/form-input-tag/InputTag.js +1 -1
  15. package/dist/es/components/form-select/Select.js +348 -300
  16. package/dist/es/components/form-select/SelectOption.vue.js +5 -3
  17. package/dist/es/components/form-select/SelectOption.vue2.js +54 -49
  18. package/dist/es/components/form-select/SelectOptionGroup.vue.js +17 -13
  19. package/dist/es/components/form-select/SelectOptionGroup.vue2.js +8 -5
  20. package/dist/es/components/form-select/hooks/use-options.js +40 -40
  21. package/dist/es/components/form-select/hooks/use-select.js +76 -71
  22. package/dist/es/style.css +1 -1
  23. package/dist/index.cjs +3 -3
  24. package/dist/index.umd.js +3 -3
  25. package/dist/style/base.css +1 -1
  26. package/dist/style/button.css +1 -1
  27. package/dist/style/form-select.css +1 -1
  28. package/dist/style.css +1 -1
  29. package/package.json +1 -1
@@ -27,7 +27,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
27
27
  value: number;
28
28
  label: string;
29
29
  }[]>;
30
- handleChange: (value: string | number | boolean | Record<string, unknown> | (string | number | boolean | Record<string, unknown>)[]) => void;
30
+ handleChange: (value: string | undefined | number | boolean | Record<string, unknown> | (string | number | boolean | Record<string, unknown>)[]) => void;
31
31
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, "change"[], "change", import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
32
32
  sizeOptions: {
33
33
  type: ArrayConstructor;
@@ -128,11 +128,11 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
128
128
  default: boolean;
129
129
  };
130
130
  filterOption: {
131
- type: PropType<boolean | ((inputValue: string, option: import('../form-select/interface.ts').SelectOptionData) => boolean)>;
131
+ type: PropType<boolean | ((inputValue: string, option: import('../form-select').SelectOptionData) => boolean)>;
132
132
  default: boolean;
133
133
  };
134
134
  options: {
135
- type: PropType<(string | number | boolean | import('../form-select/interface.ts').SelectOptionData | import('../form-select/interface.ts').SelectOptionGroup)[]>;
135
+ type: PropType<(string | number | boolean | import('../form-select').SelectOptionData | import('../form-select').SelectOptionGroupData)[]>;
136
136
  default: () => never[];
137
137
  };
138
138
  virtualListProps: {
@@ -142,10 +142,10 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
142
142
  type: PropType<import('../index.ts').TriggerProps>;
143
143
  };
144
144
  formatLabel: {
145
- type: PropType<(data: import('../form-select/interface.ts').SelectOptionData) => string>;
145
+ type: PropType<(data: import('../form-select').SelectOptionData) => string>;
146
146
  };
147
147
  fallbackOption: {
148
- type: PropType<boolean | ((value: string | number | boolean | Record<string, unknown>) => import('../form-select/interface.ts').SelectOptionData)>;
148
+ type: PropType<boolean | ((value: string | number | boolean | Record<string, unknown>) => import('../form-select').SelectOptionData)>;
149
149
  default: boolean;
150
150
  };
151
151
  showExtraOptions: {
@@ -184,11 +184,13 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
184
184
  default: boolean;
185
185
  };
186
186
  }>> & Readonly<{
187
+ onFocus?: ((ev: FocusEvent) => any) | undefined;
187
188
  onSearch?: ((inputValue: string) => any) | undefined;
188
189
  onClear?: ((ev: Event) => any) | undefined;
189
190
  onRemove?: ((removed: string | number | boolean | Record<string, any> | undefined) => any) | undefined;
190
- onChange?: ((value: string | number | boolean | Record<string, any> | (string | number | boolean | Record<string, any>)[]) => any) | undefined;
191
- "onUpdate:modelValue"?: ((value: string | number | boolean | Record<string, any> | (string | number | boolean | Record<string, any>)[]) => any) | undefined;
191
+ onBlur?: ((ev: FocusEvent) => any) | undefined;
192
+ onChange?: ((value: string | number | boolean | Record<string, any> | (string | number | boolean | Record<string, any>)[] | undefined) => any) | undefined;
193
+ "onUpdate:modelValue"?: ((value: string | number | boolean | Record<string, any> | (string | number | boolean | Record<string, any>)[] | undefined) => any) | undefined;
192
194
  "onUpdate:popupVisible"?: ((visible: boolean) => any) | undefined;
193
195
  onPopupVisibleChange?: ((visible: boolean) => any) | undefined;
194
196
  "onUpdate:inputValue"?: ((inputValue: string) => any) | undefined;
@@ -197,10 +199,12 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
197
199
  onDropdownReachBottom?: ((ev: Event) => any) | undefined;
198
200
  onExceedLimit?: ((value: string | number | boolean | Record<string, any> | undefined, ev: Event) => any) | undefined;
199
201
  }>, () => VNode, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
200
- 'update:modelValue': (value: string | number | boolean | Record<string, any> | (string | number | boolean | Record<string, any>)[]) => true;
202
+ focus: (ev: FocusEvent) => true;
203
+ blur: (ev: FocusEvent) => true;
204
+ 'update:modelValue': (value: string | undefined | number | boolean | Record<string, any> | (string | number | boolean | Record<string, any>)[]) => true;
201
205
  'update:inputValue': (inputValue: string) => true;
202
206
  'update:popupVisible': (visible: boolean) => true;
203
- change: (value: string | number | boolean | Record<string, any> | (string | number | boolean | Record<string, any>)[]) => true;
207
+ change: (value: string | undefined | number | boolean | Record<string, any> | (string | number | boolean | Record<string, any>)[]) => true;
204
208
  inputValueChange: (inputValue: string) => true;
205
209
  popupVisibleChange: (visible: boolean) => true;
206
210
  clear: (ev: Event) => true;
@@ -221,13 +225,13 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
221
225
  defaultPopupVisible: boolean;
222
226
  unmountOnClose: boolean;
223
227
  allowClear: boolean;
224
- options: (string | number | boolean | import('../form-select/interface.ts').SelectOptionData | import('../form-select/interface.ts').SelectOptionGroup)[];
228
+ options: (string | number | boolean | import('../form-select').SelectOptionData | import('../form-select').SelectOptionGroupData)[];
225
229
  bordered: boolean;
226
230
  defaultInputValue: string;
227
231
  maxTagCount: number;
228
232
  tagNowrap: boolean;
229
233
  valueKey: string;
230
- filterOption: boolean | ((inputValue: string, option: import('../form-select/interface.ts').SelectOptionData) => boolean);
234
+ filterOption: boolean | ((inputValue: string, option: import('../form-select').SelectOptionData) => boolean);
231
235
  allowCreate: boolean;
232
236
  allowSearch: boolean | {
233
237
  retainInputValue?: boolean;
@@ -236,7 +240,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
236
240
  showFooterOnEmpty: boolean;
237
241
  showExtraOptions: boolean;
238
242
  defaultActiveFirstOption: boolean;
239
- fallbackOption: boolean | ((value: string | number | boolean | Record<string, unknown>) => import('../form-select/interface.ts').SelectOptionData);
243
+ fallbackOption: boolean | ((value: string | number | boolean | Record<string, unknown>) => import('../form-select').SelectOptionData);
240
244
  searchDelay: number;
241
245
  limit: number;
242
246
  }, true, {}, {}, {
@@ -845,6 +849,10 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
845
849
  type: BooleanConstructor;
846
850
  default: boolean;
847
851
  };
852
+ clearable: {
853
+ type: BooleanConstructor;
854
+ default: undefined;
855
+ };
848
856
  allowCreate: {
849
857
  type: BooleanConstructor;
850
858
  default: boolean;
@@ -919,6 +927,10 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
919
927
  type: BooleanConstructor;
920
928
  default: boolean;
921
929
  };
930
+ clearable: {
931
+ type: BooleanConstructor;
932
+ default: undefined;
933
+ };
922
934
  allowCreate: {
923
935
  type: BooleanConstructor;
924
936
  default: boolean;
@@ -958,6 +970,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
958
970
  maxTagCount: number;
959
971
  retainInputValue: boolean;
960
972
  tagNowrap: boolean;
973
+ clearable: boolean;
961
974
  allowCreate: boolean;
962
975
  allowSearch: boolean;
963
976
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
@@ -1046,11 +1059,11 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
1046
1059
  default: boolean;
1047
1060
  };
1048
1061
  filterOption: {
1049
- type: PropType<boolean | ((inputValue: string, option: import('../form-select/interface.ts').SelectOptionData) => boolean)>;
1062
+ type: PropType<boolean | ((inputValue: string, option: import('../form-select').SelectOptionData) => boolean)>;
1050
1063
  default: boolean;
1051
1064
  };
1052
1065
  options: {
1053
- type: PropType<(string | number | boolean | import('../form-select/interface.ts').SelectOptionData | import('../form-select/interface.ts').SelectOptionGroup)[]>;
1066
+ type: PropType<(string | number | boolean | import('../form-select').SelectOptionData | import('../form-select').SelectOptionGroupData)[]>;
1054
1067
  default: () => never[];
1055
1068
  };
1056
1069
  virtualListProps: {
@@ -1060,10 +1073,10 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
1060
1073
  type: PropType<import('../index.ts').TriggerProps>;
1061
1074
  };
1062
1075
  formatLabel: {
1063
- type: PropType<(data: import('../form-select/interface.ts').SelectOptionData) => string>;
1076
+ type: PropType<(data: import('../form-select').SelectOptionData) => string>;
1064
1077
  };
1065
1078
  fallbackOption: {
1066
- type: PropType<boolean | ((value: string | number | boolean | Record<string, unknown>) => import('../form-select/interface.ts').SelectOptionData)>;
1079
+ type: PropType<boolean | ((value: string | number | boolean | Record<string, unknown>) => import('../form-select').SelectOptionData)>;
1067
1080
  default: boolean;
1068
1081
  };
1069
1082
  showExtraOptions: {
@@ -1102,11 +1115,13 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
1102
1115
  default: boolean;
1103
1116
  };
1104
1117
  }>> & Readonly<{
1118
+ onFocus?: ((ev: FocusEvent) => any) | undefined;
1105
1119
  onSearch?: ((inputValue: string) => any) | undefined;
1106
1120
  onClear?: ((ev: Event) => any) | undefined;
1107
1121
  onRemove?: ((removed: string | number | boolean | Record<string, any> | undefined) => any) | undefined;
1108
- onChange?: ((value: string | number | boolean | Record<string, any> | (string | number | boolean | Record<string, any>)[]) => any) | undefined;
1109
- "onUpdate:modelValue"?: ((value: string | number | boolean | Record<string, any> | (string | number | boolean | Record<string, any>)[]) => any) | undefined;
1122
+ onBlur?: ((ev: FocusEvent) => any) | undefined;
1123
+ onChange?: ((value: string | number | boolean | Record<string, any> | (string | number | boolean | Record<string, any>)[] | undefined) => any) | undefined;
1124
+ "onUpdate:modelValue"?: ((value: string | number | boolean | Record<string, any> | (string | number | boolean | Record<string, any>)[] | undefined) => any) | undefined;
1110
1125
  "onUpdate:popupVisible"?: ((visible: boolean) => any) | undefined;
1111
1126
  onPopupVisibleChange?: ((visible: boolean) => any) | undefined;
1112
1127
  "onUpdate:inputValue"?: ((inputValue: string) => any) | undefined;
@@ -1126,13 +1141,13 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
1126
1141
  defaultPopupVisible: boolean;
1127
1142
  unmountOnClose: boolean;
1128
1143
  allowClear: boolean;
1129
- options: (string | number | boolean | import('../form-select/interface.ts').SelectOptionData | import('../form-select/interface.ts').SelectOptionGroup)[];
1144
+ options: (string | number | boolean | import('../form-select').SelectOptionData | import('../form-select').SelectOptionGroupData)[];
1130
1145
  bordered: boolean;
1131
1146
  defaultInputValue: string;
1132
1147
  maxTagCount: number;
1133
1148
  tagNowrap: boolean;
1134
1149
  valueKey: string;
1135
- filterOption: boolean | ((inputValue: string, option: import('../form-select/interface.ts').SelectOptionData) => boolean);
1150
+ filterOption: boolean | ((inputValue: string, option: import('../form-select').SelectOptionData) => boolean);
1136
1151
  allowCreate: boolean;
1137
1152
  allowSearch: boolean | {
1138
1153
  retainInputValue?: boolean;
@@ -1141,7 +1156,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
1141
1156
  showFooterOnEmpty: boolean;
1142
1157
  showExtraOptions: boolean;
1143
1158
  defaultActiveFirstOption: boolean;
1144
- fallbackOption: boolean | ((value: string | number | boolean | Record<string, unknown>) => import('../form-select/interface.ts').SelectOptionData);
1159
+ fallbackOption: boolean | ((value: string | number | boolean | Record<string, unknown>) => import('../form-select').SelectOptionData);
1145
1160
  searchDelay: number;
1146
1161
  limit: number;
1147
1162
  }>;
@@ -1226,11 +1241,11 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
1226
1241
  default: boolean;
1227
1242
  };
1228
1243
  filterOption: {
1229
- type: PropType<boolean | ((inputValue: string, option: import('../form-select/interface.ts').SelectOptionData) => boolean)>;
1244
+ type: PropType<boolean | ((inputValue: string, option: import('../form-select').SelectOptionData) => boolean)>;
1230
1245
  default: boolean;
1231
1246
  };
1232
1247
  options: {
1233
- type: PropType<(string | number | boolean | import('../form-select/interface.ts').SelectOptionData | import('../form-select/interface.ts').SelectOptionGroup)[]>;
1248
+ type: PropType<(string | number | boolean | import('../form-select').SelectOptionData | import('../form-select').SelectOptionGroupData)[]>;
1234
1249
  default: () => never[];
1235
1250
  };
1236
1251
  virtualListProps: {
@@ -1240,10 +1255,10 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
1240
1255
  type: PropType<import('../index.ts').TriggerProps>;
1241
1256
  };
1242
1257
  formatLabel: {
1243
- type: PropType<(data: import('../form-select/interface.ts').SelectOptionData) => string>;
1258
+ type: PropType<(data: import('../form-select').SelectOptionData) => string>;
1244
1259
  };
1245
1260
  fallbackOption: {
1246
- type: PropType<boolean | ((value: string | number | boolean | Record<string, unknown>) => import('../form-select/interface.ts').SelectOptionData)>;
1261
+ type: PropType<boolean | ((value: string | number | boolean | Record<string, unknown>) => import('../form-select').SelectOptionData)>;
1247
1262
  default: boolean;
1248
1263
  };
1249
1264
  showExtraOptions: {
@@ -1282,11 +1297,13 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
1282
1297
  default: boolean;
1283
1298
  };
1284
1299
  }>> & Readonly<{
1300
+ onFocus?: ((ev: FocusEvent) => any) | undefined;
1285
1301
  onSearch?: ((inputValue: string) => any) | undefined;
1286
1302
  onClear?: ((ev: Event) => any) | undefined;
1287
1303
  onRemove?: ((removed: string | number | boolean | Record<string, any> | undefined) => any) | undefined;
1288
- onChange?: ((value: string | number | boolean | Record<string, any> | (string | number | boolean | Record<string, any>)[]) => any) | undefined;
1289
- "onUpdate:modelValue"?: ((value: string | number | boolean | Record<string, any> | (string | number | boolean | Record<string, any>)[]) => any) | undefined;
1304
+ onBlur?: ((ev: FocusEvent) => any) | undefined;
1305
+ onChange?: ((value: string | number | boolean | Record<string, any> | (string | number | boolean | Record<string, any>)[] | undefined) => any) | undefined;
1306
+ "onUpdate:modelValue"?: ((value: string | number | boolean | Record<string, any> | (string | number | boolean | Record<string, any>)[] | undefined) => any) | undefined;
1290
1307
  "onUpdate:popupVisible"?: ((visible: boolean) => any) | undefined;
1291
1308
  onPopupVisibleChange?: ((visible: boolean) => any) | undefined;
1292
1309
  "onUpdate:inputValue"?: ((inputValue: string) => any) | undefined;
@@ -1295,10 +1312,12 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
1295
1312
  onDropdownReachBottom?: ((ev: Event) => any) | undefined;
1296
1313
  onExceedLimit?: ((value: string | number | boolean | Record<string, any> | undefined, ev: Event) => any) | undefined;
1297
1314
  }>, () => VNode, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
1298
- 'update:modelValue': (value: string | number | boolean | Record<string, any> | (string | number | boolean | Record<string, any>)[]) => true;
1315
+ focus: (ev: FocusEvent) => true;
1316
+ blur: (ev: FocusEvent) => true;
1317
+ 'update:modelValue': (value: string | undefined | number | boolean | Record<string, any> | (string | number | boolean | Record<string, any>)[]) => true;
1299
1318
  'update:inputValue': (inputValue: string) => true;
1300
1319
  'update:popupVisible': (visible: boolean) => true;
1301
- change: (value: string | number | boolean | Record<string, any> | (string | number | boolean | Record<string, any>)[]) => true;
1320
+ change: (value: string | undefined | number | boolean | Record<string, any> | (string | number | boolean | Record<string, any>)[]) => true;
1302
1321
  inputValueChange: (inputValue: string) => true;
1303
1322
  popupVisibleChange: (visible: boolean) => true;
1304
1323
  clear: (ev: Event) => true;
@@ -1319,13 +1338,13 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
1319
1338
  defaultPopupVisible: boolean;
1320
1339
  unmountOnClose: boolean;
1321
1340
  allowClear: boolean;
1322
- options: (string | number | boolean | import('../form-select/interface.ts').SelectOptionData | import('../form-select/interface.ts').SelectOptionGroup)[];
1341
+ options: (string | number | boolean | import('../form-select').SelectOptionData | import('../form-select').SelectOptionGroupData)[];
1323
1342
  bordered: boolean;
1324
1343
  defaultInputValue: string;
1325
1344
  maxTagCount: number;
1326
1345
  tagNowrap: boolean;
1327
1346
  valueKey: string;
1328
- filterOption: boolean | ((inputValue: string, option: import('../form-select/interface.ts').SelectOptionData) => boolean);
1347
+ filterOption: boolean | ((inputValue: string, option: import('../form-select').SelectOptionData) => boolean);
1329
1348
  allowCreate: boolean;
1330
1349
  allowSearch: boolean | {
1331
1350
  retainInputValue?: boolean;
@@ -1334,7 +1353,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
1334
1353
  showFooterOnEmpty: boolean;
1335
1354
  showExtraOptions: boolean;
1336
1355
  defaultActiveFirstOption: boolean;
1337
- fallbackOption: boolean | ((value: string | number | boolean | Record<string, unknown>) => import('../form-select/interface.ts').SelectOptionData);
1356
+ fallbackOption: boolean | ((value: string | number | boolean | Record<string, unknown>) => import('../form-select').SelectOptionData);
1338
1357
  searchDelay: number;
1339
1358
  limit: number;
1340
1359
  }, {}, string, {}, {
@@ -1943,6 +1962,10 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
1943
1962
  type: BooleanConstructor;
1944
1963
  default: boolean;
1945
1964
  };
1965
+ clearable: {
1966
+ type: BooleanConstructor;
1967
+ default: undefined;
1968
+ };
1946
1969
  allowCreate: {
1947
1970
  type: BooleanConstructor;
1948
1971
  default: boolean;
@@ -2017,6 +2040,10 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
2017
2040
  type: BooleanConstructor;
2018
2041
  default: boolean;
2019
2042
  };
2043
+ clearable: {
2044
+ type: BooleanConstructor;
2045
+ default: undefined;
2046
+ };
2020
2047
  allowCreate: {
2021
2048
  type: BooleanConstructor;
2022
2049
  default: boolean;
@@ -2056,6 +2083,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
2056
2083
  maxTagCount: number;
2057
2084
  retainInputValue: boolean;
2058
2085
  tagNowrap: boolean;
2086
+ clearable: boolean;
2059
2087
  allowCreate: boolean;
2060
2088
  allowSearch: boolean;
2061
2089
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
@@ -17,6 +17,8 @@ export interface TriggerProps {
17
17
  blurToClose?: boolean;
18
18
  clickToClose?: boolean;
19
19
  clickOutsideToClose?: boolean;
20
+ scrollToClose?: boolean;
21
+ scrollToCloseDistance?: number;
20
22
  unmountOnClose?: boolean;
21
23
  contentClass?: any;
22
24
  contentStyle?: CSSProperties;
@@ -1,17 +1,17 @@
1
- import { defineComponent as E, toRefs as H, ref as B, computed as i, createVNode as o, Fragment as M } from "vue";
2
- import { isArray as P } from "../../../_utils/is.js";
3
- import q from "../feedback-icon/index.vue.js";
4
- import O from "../input-label/input-label.js";
5
- import { InputTag as _ } from "../../form-input-tag/index.js";
6
- import $ from "../icon-hover/index.vue.js";
7
- import G from "../../../icons/default/down.js";
8
- import J from "../../../icons/animation/animation-loading.js";
9
- import Q from "../../../icons/default/close.js";
10
- import U from "../../../icons/default/search.js";
11
- import { useFormItem as W, useFormItemControl as X } from "../../../_hooks/use-form-item.js";
12
- import { useLocale as Y } from "../../../locale/index.js";
13
- import { useSize as Z } from "../../../_hooks/use-size.js";
14
- import { getClassNameMixin as ee } from "../../../_utils/config.js";
1
+ import { defineComponent as E, toRefs as H, ref as S, computed as i, createVNode as o, Fragment as M, nextTick as P } from "vue";
2
+ import { isArray as q } from "../../../_utils/is.js";
3
+ import O from "../feedback-icon/index.vue.js";
4
+ import _ from "../input-label/input-label.js";
5
+ import { InputTag as $ } from "../../form-input-tag/index.js";
6
+ import G from "../icon-hover/index.vue.js";
7
+ import J from "../../../icons/default/down.js";
8
+ import Q from "../../../icons/animation/animation-loading.js";
9
+ import U from "../../../icons/default/close.js";
10
+ import W from "../../../icons/default/search.js";
11
+ import { useFormItem as X, useFormItemControl as Y } from "../../../_hooks/use-form-item.js";
12
+ import { useLocale as Z } from "../../../locale/index.js";
13
+ import { useSize as ee } from "../../../_hooks/use-size.js";
14
+ import { getClassNameMixin as le } from "../../../_utils/config.js";
15
15
  const be = /* @__PURE__ */ E({
16
16
  name: "SelectView",
17
17
  props: {
@@ -52,13 +52,18 @@ const be = /* @__PURE__ */ E({
52
52
  type: Boolean,
53
53
  default: !1
54
54
  },
55
+ // private: 缺失选项可不回显标签,但原始选中值仍可清空。
56
+ clearable: {
57
+ type: Boolean,
58
+ default: void 0
59
+ },
55
60
  allowCreate: {
56
61
  type: Boolean,
57
62
  default: !1
58
63
  },
59
64
  allowSearch: {
60
65
  type: Boolean,
61
- default: (e) => P(e.modelValue)
66
+ default: (e) => q(e.modelValue)
62
67
  },
63
68
  maxTagCount: {
64
69
  type: Number,
@@ -87,120 +92,126 @@ const be = /* @__PURE__ */ E({
87
92
  slots: n
88
93
  }) {
89
94
  const {
90
- size: S,
91
- disabled: x,
92
- error: F
93
- } = H(e), u = ee("select--view"), {
94
- formItemCtx: R,
95
- feedback: p,
95
+ size: F,
96
+ disabled: R,
97
+ error: k
98
+ } = H(e), u = le("select--view"), {
99
+ formItemCtx: z,
100
+ feedback: g,
96
101
  eventHandlers: c,
97
- mergedDisabled: g,
98
- mergedSize: z,
99
- mergedError: b
100
- } = W({
101
- size: S,
102
- disabled: x,
103
- error: F
104
- }), v = X(R, () => e.inputAttrs ?? {}), {
105
- t: A
106
- } = Y(), {
102
+ mergedDisabled: f,
103
+ mergedSize: A,
104
+ mergedError: v
105
+ } = X({
106
+ size: F,
107
+ disabled: R,
108
+ error: k
109
+ }), b = Y(z, () => e.inputAttrs ?? {}), {
110
+ t: N
111
+ } = Z(), {
107
112
  mergedSize: h
108
- } = Z(z), d = B(!1), f = B(), k = i(
113
+ } = ee(A), d = S(!1), m = S(), w = i(
109
114
  // @ts-ignore
110
115
  () => {
111
116
  var l;
112
- return (l = f.value) == null ? void 0 : l.inputRef;
117
+ return (l = m.value) == null ? void 0 : l.inputRef;
113
118
  }
114
- ), N = i(() => e.modelValue.length === 0), T = i(() => e.allowSearch || e.allowCreate), j = i(() => e.allowClear && !e.disabled && !N.value && e.modelValue.some((l) => l.closable !== !1)), m = (l) => {
119
+ ), T = i(() => e.modelValue.length === 0), D = i(() => e.allowSearch || e.allowCreate), C = i(() => e.allowClear && !f.value && !e.loading && (e.clearable ?? (!T.value && e.modelValue.some((l) => l.closable !== !1)))), s = (l) => {
115
120
  var a, t;
116
121
  d.value = !0, r("focus", l), (t = (a = c.value) == null ? void 0 : a.onFocus) == null || t.call(a, l);
117
- }, s = (l) => {
122
+ }, p = (l) => {
118
123
  var a, t;
119
124
  d.value = !1, r("blur", l), (t = (a = c.value) == null ? void 0 : a.onBlur) == null || t.call(a, l);
120
- }, D = (l) => {
125
+ }, j = (l) => {
121
126
  r("remove", String(l));
122
127
  }, K = (l) => {
123
- l.stopPropagation(), r("clear", l);
124
- }, w = (l, a) => {
125
- var t, I;
126
- r("inputValueChange", l, a), (I = (t = c.value) == null ? void 0 : t.onInput) == null || I.call(t, a);
127
- }, C = (l) => {
128
+ l.stopPropagation(), C.value && (r("clear", l), P(() => {
129
+ var a;
130
+ return (a = w.value) == null ? void 0 : a.focus();
131
+ }));
132
+ }, V = (l, a) => {
133
+ var t, x;
134
+ r("inputValueChange", l, a), (x = (t = c.value) == null ? void 0 : t.onInput) == null || x.call(t, a);
135
+ }, y = (l) => {
128
136
  r("keydown", l);
129
137
  }, L = () => {
130
138
  var l, a;
131
- return e.loading ? ((l = n["loading-icon"]) == null ? void 0 : l.call(n)) ?? o(J, null, null) : e.allowSearch && e.opened ? ((a = n["search-icon"]) == null ? void 0 : a.call(n)) ?? o(U, null, null) : n["arrow-icon"] ? n["arrow-icon"]() : o(G, {
139
+ return e.loading ? ((l = n["loading-icon"]) == null ? void 0 : l.call(n)) ?? o(Q, null, null) : e.allowSearch && e.opened ? ((a = n["search-icon"]) == null ? void 0 : a.call(n)) ?? o(W, null, null) : n["arrow-icon"] ? n["arrow-icon"]() : o(J, {
132
140
  class: u.element("arrow-icon")
133
141
  }, null);
134
- }, V = () => o(M, null, [j.value && o($, {
142
+ }, I = () => o(M, null, [C.value ? o(G, {
135
143
  as: "button",
136
- "aria-label": A("common.clearTarget", {
144
+ "aria-label": N("common.clearTarget", {
137
145
  target: "选择"
138
146
  }),
139
147
  class: u.element("clear-btn"),
140
148
  onClick: K,
141
- onMousedown: (l) => l.stopPropagation()
149
+ onMousedown: (l) => {
150
+ l.preventDefault(), l.stopPropagation();
151
+ }
142
152
  }, {
143
- default: () => [o(Q, null, null)]
144
- }), o("span", {
145
- class: u.element("icon")
146
- }, [L()]), !!p.value && o(q, {
147
- type: p.value
148
- }, null)]), y = i(() => [u.modifier(`${e.multiple ? "multiple" : "single"}`), {
153
+ default: () => [o(U, null, null)]
154
+ }) : o("span", {
155
+ class: u.element("icon"),
156
+ "aria-hidden": "true"
157
+ }, [L()]), !!g.value && o(O, {
158
+ type: g.value
159
+ }, null)]), B = i(() => [u.modifier(`${e.multiple ? "multiple" : "single"}`), {
149
160
  [u.modifier("opened")]: e.opened,
150
161
  [u.modifier("borderless")]: !e.bordered
151
162
  }]);
152
163
  return {
153
- inputRef: k,
154
- handleFocus: m,
155
- handleBlur: s,
156
- render: () => e.multiple ? o(_, {
157
- ref: f,
164
+ inputRef: w,
165
+ handleFocus: s,
166
+ handleBlur: p,
167
+ render: () => e.multiple ? o($, {
168
+ ref: m,
158
169
  baseCls: u.block,
159
- class: y.value,
170
+ class: B.value,
160
171
  modelValue: e.modelValue,
161
172
  inputValue: e.inputValue,
162
173
  focused: e.opened || d.value,
163
174
  placeholder: e.placeholder,
164
- disabled: g.value,
175
+ disabled: f.value,
165
176
  size: h.value,
166
- error: b.value,
177
+ error: v.value,
167
178
  maxTagCount: e.maxTagCount,
168
179
  disabledInput: !e.allowSearch && !e.allowCreate,
169
180
  tagNowrap: e.tagNowrap,
170
181
  retainInputValue: !0,
171
- inputAttrs: v.value,
182
+ inputAttrs: b.value,
172
183
  uninjectFormItemContext: !0,
173
- onRemove: D,
174
- onInputValueChange: w,
175
- onKeydown: C,
176
- onFocus: m,
177
- onBlur: s
184
+ onRemove: j,
185
+ onInputValueChange: V,
186
+ onKeydown: y,
187
+ onFocus: s,
188
+ onBlur: p
178
189
  }, {
179
190
  prefix: n.prefix,
180
- suffix: V,
191
+ suffix: I,
181
192
  tag: n.label
182
- }) : o(O, {
183
- ref: f,
193
+ }) : o(_, {
194
+ ref: m,
184
195
  baseCls: u.block,
185
- class: y.value,
196
+ class: B.value,
186
197
  modelValue: e.modelValue[0],
187
198
  inputValue: e.inputValue,
188
199
  focused: e.opened || d.value,
189
200
  placeholder: e.placeholder,
190
- disabled: g.value,
201
+ disabled: f.value,
191
202
  size: h.value,
192
- error: b.value,
193
- enabledInput: T.value,
194
- inputAttrs: v.value,
203
+ error: v.value,
204
+ enabledInput: D.value,
205
+ inputAttrs: b.value,
195
206
  uninjectFormItemContext: !0,
196
- onInputValueChange: w,
197
- onKeydown: C,
198
- onFocus: m,
199
- onBlur: s
207
+ onInputValueChange: V,
208
+ onKeydown: y,
209
+ onFocus: s,
210
+ onBlur: p
200
211
  }, {
201
212
  default: n.label,
202
213
  prefix: n.prefix,
203
- suffix: V
214
+ suffix: I
204
215
  })
205
216
  };
206
217
  },
@@ -50,7 +50,7 @@ const H = /* @__PURE__ */ O({
50
50
  style: {
51
51
  display: "flex",
52
52
  opacity: c.value ? 1 : 0,
53
- width: c.value ? e.loadingFill ? "100%" : "1em" : 0,
53
+ width: e.loadingFill ? void 0 : c.value ? "1em" : 0,
54
54
  marginRight: c.value && !e.loadingFill ? "4px" : "0",
55
55
  overflow: "hidden"
56
56
  }
@@ -343,7 +343,7 @@ const Pe = {
343
343
  return e;
344
344
  return -1;
345
345
  }, se = (e) => {
346
- if (b.value || a.readonly)
346
+ if (b.value || a.readonly || e.isComposing || e.keyCode === 229)
347
347
  return;
348
348
  const t = e.key || e.code;
349
349
  if (!p.value && o.value && t === Ve.key && ne(e), !p.value && I.value.length > 0 && !o.value && t === Ie.key) {