x-next 1.9.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 (51) hide show
  1. package/AI_USAGE.md +69 -7
  2. package/CHANGELOG.md +36 -0
  3. package/dist/_utils/chart/scale.d.ts +1 -1
  4. package/dist/components/_components/chart/axis-labels.d.ts +8 -0
  5. package/dist/components/_components/select-view/select-view.d.ts +9 -0
  6. package/dist/components/form-select/Select.d.ts +18 -5
  7. package/dist/components/form-select/SelectOptionGroup.vue.d.ts +1 -0
  8. package/dist/components/form-select/hooks/use-options.d.ts +1 -1
  9. package/dist/components/form-select/hooks/use-select.d.ts +1 -1
  10. package/dist/components/form-select/index.d.ts +42 -11
  11. package/dist/components/form-select/interface.d.ts +8 -0
  12. package/dist/components/link/Link.vue.d.ts +1 -1
  13. package/dist/components/link/index.d.ts +3 -3
  14. package/dist/components/pagination/page-options.vue.d.ts +60 -32
  15. package/dist/components/trigger/interface.d.ts +2 -0
  16. package/dist/components/virtual-list-v2/interface.d.ts +3 -0
  17. package/dist/components/virtual-list-v2/virtual-list.vue.d.ts +336 -1
  18. package/dist/es/_hooks/use-component-ref.js +9 -9
  19. package/dist/es/_utils/chart/scale.js +44 -39
  20. package/dist/es/components/_components/chart/ChartAxis.js +61 -36
  21. package/dist/es/components/_components/chart/axis-labels.js +26 -0
  22. package/dist/es/components/_components/select-view/select-view.js +89 -78
  23. package/dist/es/components/button/Button.js +23 -23
  24. package/dist/es/components/form-input-tag/InputTag.js +1 -1
  25. package/dist/es/components/form-select/Select.js +367 -318
  26. package/dist/es/components/form-select/SelectOption.vue.js +5 -3
  27. package/dist/es/components/form-select/SelectOption.vue2.js +54 -49
  28. package/dist/es/components/form-select/SelectOptionGroup.vue.js +17 -13
  29. package/dist/es/components/form-select/SelectOptionGroup.vue2.js +8 -5
  30. package/dist/es/components/form-select/hooks/use-options.js +40 -40
  31. package/dist/es/components/form-select/hooks/use-select.js +76 -71
  32. package/dist/es/components/trigger/Trigger.js +174 -183
  33. package/dist/es/components/virtual-list-v2/virtual-list.vue.js +22 -23
  34. package/dist/es/components/virtual-list-v2/virtual-list.vue2.js +67 -53
  35. package/dist/es/icons/icon.js +37 -36
  36. package/dist/es/icons/index.js +6 -8
  37. package/dist/es/icons/public/lucide-names.js +167 -0
  38. package/dist/es/icons/public/lucide.js +75 -188
  39. package/dist/es/index.js +152 -148
  40. package/dist/es/style.css +1 -1
  41. package/dist/icons/index.d.ts +3 -3
  42. package/dist/icons/names.d.ts +2 -2
  43. package/dist/icons/public/lucide-names.d.ts +32 -0
  44. package/dist/icons/public/lucide.d.ts +2 -2
  45. package/dist/index.cjs +3 -62
  46. package/dist/index.umd.js +3 -62
  47. package/dist/style/base.css +1 -1
  48. package/dist/style/button.css +1 -1
  49. package/dist/style/form-select.css +1 -1
  50. package/dist/style.css +1 -1
  51. package/package.json +3 -2
@@ -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
  },
@@ -1,5 +1,5 @@
1
- import { defineComponent as O, getCurrentInstance as P, inject as p, reactive as x, computed as c, withDirectives as T, createVNode as o, resolveDirective as F } from "vue";
2
- import { getClassNameMixin as L } from "../../_utils/config.js";
1
+ import { defineComponent as O, getCurrentInstance as P, inject as x, reactive as F, computed as t, withDirectives as T, createVNode as u, resolveDirective as L } from "vue";
2
+ import { getClassNameMixin as p } from "../../_utils/config.js";
3
3
  import { buttonProps as A } from "./props.js";
4
4
  import B from "../../icons/animation/animation-loading.js";
5
5
  import I from "../../directives/wave.js";
@@ -18,51 +18,51 @@ const H = /* @__PURE__ */ O({
18
18
  slots: l,
19
19
  emit: h
20
20
  }) {
21
- const f = P(), a = p(K, void 0), {
21
+ const s = P(), a = x(K, void 0), {
22
22
  mergedSize: k
23
23
  } = N(void 0, {
24
24
  defaultValue: "medium"
25
- }), r = x({
25
+ }), r = F({
26
26
  clicked: !1,
27
27
  isDebounce: !1
28
- }), i = L("button"), w = (n) => n.replace(/[A-Z]/g, (d) => `-${d.toLowerCase()}`), u = (n) => {
29
- const d = (f == null ? void 0 : f.vnode.props) ?? {};
28
+ }), i = p("button"), w = (n) => n.replace(/[A-Z]/g, (d) => `-${d.toLowerCase()}`), o = (n) => {
29
+ const d = (s == null ? void 0 : s.vnode.props) ?? {};
30
30
  return Object.prototype.hasOwnProperty.call(d, n) || Object.prototype.hasOwnProperty.call(d, w(n));
31
- }, s = c(() => u("type") ? e.type : (a == null ? void 0 : a.type) ?? e.type), v = c(() => u("size") ? e.size : (a == null ? void 0 : a.size) ?? k.value), b = c(() => u("status") ? e.status : (a == null ? void 0 : a.status) ?? e.status), g = c(() => u("shape") ? e.shape : (a == null ? void 0 : a.shape) ?? e.shape), m = c(() => u("disabled") ? e.disabled : (a == null ? void 0 : a.disabled) ?? e.disabled), D = c(() => [i.block, s.value && s.value !== "default" && i.modifier(s.value), v.value && i.modifier(v.value), b.value && i.modifier(b.value), m.value && i.is("disabled"), e.block && i.modifier("block"), e.plain && i.modifier("plain"), g.value && i.modifier(g.value), e.link && i.modifier("link"), !e.border && i.modifier("hide-border"), t.value && i.modifier("loading"), e.loadingFill && i.modifier("loading-fill"), e.narrow && i.modifier("narrow")]), z = () => {
31
+ }, m = t(() => o("type") ? e.type : (a == null ? void 0 : a.type) ?? e.type), v = t(() => o("size") ? e.size : (a == null ? void 0 : a.size) ?? k.value), b = t(() => o("status") ? e.status : (a == null ? void 0 : a.status) ?? e.status), g = t(() => o("shape") ? e.shape : (a == null ? void 0 : a.shape) ?? e.shape), f = t(() => o("disabled") ? e.disabled : (a == null ? void 0 : a.disabled) ?? e.disabled), D = t(() => [i.block, m.value && m.value !== "default" && i.modifier(m.value), v.value && i.modifier(v.value), b.value && i.modifier(b.value), f.value && i.is("disabled"), e.block && i.modifier("block"), e.plain && i.modifier("plain"), g.value && i.modifier(g.value), e.link && i.modifier("link"), !e.border && i.modifier("hide-border"), c.value && i.modifier("loading"), e.loadingFill && i.modifier("loading-fill"), e.narrow && i.modifier("narrow")]), z = () => {
32
32
  e.debounce > 0 && !r.isDebounce && (r.isDebounce = !0, setTimeout(() => {
33
33
  r.isDebounce = !1;
34
34
  }, e.debounce));
35
- }, t = c(() => e.loading || r.clicked || r.isDebounce), S = c(() => m.value || t.value || e.link || s.value === "text"), j = (n) => {
35
+ }, c = t(() => e.loading || r.clicked || r.isDebounce), S = t(() => f.value || c.value || e.link || m.value === "text"), j = (n) => {
36
36
  var d;
37
- n.detail > 0 && ((d = n.currentTarget) == null || d.blur()), !(m.value || t.value) && (z(), h("click", n));
37
+ n.detail > 0 && ((d = n.currentTarget) == null || d.blur()), !(f.value || c.value) && (z(), h("click", n));
38
38
  };
39
39
  return () => {
40
40
  var n, d, y;
41
- return T(o("button", {
41
+ return T(u("button", {
42
42
  class: D.value,
43
43
  type: e.htmlType,
44
- disabled: m.value || t.value,
45
- "aria-busy": t.value || void 0,
44
+ disabled: f.value || c.value,
45
+ "aria-busy": c.value || void 0,
46
46
  onClick: j
47
- }, [o("span", {
47
+ }, [u("span", {
48
48
  class: i.element("loading"),
49
+ "aria-hidden": "true",
49
50
  style: {
50
51
  display: "flex",
51
- opacity: t.value ? 1 : 0,
52
- width: t.value ? "auto" : 0,
53
- marginRight: t.value && !e.loadingFill ? "4px" : "0",
54
- overflow: "hidden",
55
- transition: "all 0.3s ease"
52
+ opacity: c.value ? 1 : 0,
53
+ width: e.loadingFill ? void 0 : c.value ? "1em" : 0,
54
+ marginRight: c.value && !e.loadingFill ? "4px" : "0",
55
+ overflow: "hidden"
56
56
  }
57
- }, [o(B, null, null)]), !!l.prefix && o("span", {
57
+ }, [c.value && u(B, null, null)]), !!l.prefix && u("span", {
58
58
  class: i.element("prefix")
59
- }, [(n = l.prefix) == null ? void 0 : n.call(l)]), l.icon && o("span", {
59
+ }, [(n = l.prefix) == null ? void 0 : n.call(l)]), l.icon && u("span", {
60
60
  class: i.element("prefix")
61
- }, [(d = l.icon) == null ? void 0 : d.call(l)]), o("span", {
61
+ }, [(d = l.icon) == null ? void 0 : d.call(l)]), u("span", {
62
62
  class: i.element("content")
63
- }, [(y = l.default) == null ? void 0 : y.call(l)]), l.suffix && o("span", {
63
+ }, [(y = l.default) == null ? void 0 : y.call(l)]), l.suffix && u("span", {
64
64
  class: i.element("suffix")
65
- }, [l.suffix()])]), [[F("wave"), {
65
+ }, [l.suffix()])]), [[L("wave"), {
66
66
  disabled: S.value
67
67
  }]]);
68
68
  };
@@ -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) {