x-next 1.4.0 → 1.5.0

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 (34) hide show
  1. package/AI_USAGE.md +2 -2
  2. package/CHANGELOG.md +35 -0
  3. package/dist/components/dropdown/DropdownButton.vue.d.ts +2 -1
  4. package/dist/components/dropdown/index.d.ts +3 -0
  5. package/dist/components/steps/context.d.ts +9 -0
  6. package/dist/components/tabs/TabPane.vue.d.ts +2 -0
  7. package/dist/components/tabs/index.d.ts +6 -0
  8. package/dist/components/tabs/interface.d.ts +4 -0
  9. package/dist/es/components/dropdown/Dropdown.vue2.js +11 -4
  10. package/dist/es/components/dropdown/DropdownButton.vue.js +8 -7
  11. package/dist/es/components/dropdown/DropdownButton.vue2.js +19 -17
  12. package/dist/es/components/dropdown/DropdownSubmenu.vue.js +18 -17
  13. package/dist/es/components/menu/MenuSubMenu.js +50 -36
  14. package/dist/es/components/menu/sub-menu-pop.vue2.js +30 -30
  15. package/dist/es/components/pagination/Pagination.js +73 -70
  16. package/dist/es/components/steps/Step.vue2.js +51 -47
  17. package/dist/es/components/steps/Steps.vue2.js +22 -19
  18. package/dist/es/components/tabs/TabPane.vue.js +11 -9
  19. package/dist/es/components/tabs/TabPane.vue2.js +28 -24
  20. package/dist/es/components/tabs/tabs-nav.js +20 -18
  21. package/dist/es/components/tabs/tabs-tab.vue.js +10 -8
  22. package/dist/es/locale/en-US.js +2 -1
  23. package/dist/es/locale/zh-CN.js +2 -1
  24. package/dist/es/style.css +1 -1
  25. package/dist/index.cjs +4 -4
  26. package/dist/index.umd.js +4 -4
  27. package/dist/locale/interface.d.ts +2 -0
  28. package/dist/style/dropdown.css +1 -1
  29. package/dist/style/menu.css +1 -1
  30. package/dist/style/pagination.css +1 -1
  31. package/dist/style/steps.css +1 -1
  32. package/dist/style/tabs.css +1 -1
  33. package/dist/style.css +1 -1
  34. package/package.json +3 -2
@@ -1,4 +1,4 @@
1
- import { defineComponent as ae, toRefs as le, ref as y, computed as h, watch as I, nextTick as N, onMounted as ie, createVNode as r } from "vue";
1
+ import { defineComponent as ae, toRefs as le, ref as b, computed as h, watch as H, nextTick as I, onMounted as ie, createVNode as r } from "vue";
2
2
  import { getTabListStyle as ne, updateScrollOffset as oe } from "./utils.js";
3
3
  import re from "./tabs-tab.vue.js";
4
4
  import W from "./tabs-button.js";
@@ -56,7 +56,9 @@ const Re = /* @__PURE__ */ ae({
56
56
  default: !0
57
57
  },
58
58
  scrollPosition: {
59
- type: String,
59
+ /* ScrollPosition 含 number(滚动到指定像素),只声明 String 会让
60
+ `:scroll-position="200"` 触发 prop 类型校验告警 */
61
+ type: [String, Number],
60
62
  default: "auto"
61
63
  }
62
64
  },
@@ -73,10 +75,10 @@ const Re = /* @__PURE__ */ ae({
73
75
  scrollPosition: s
74
76
  } = le(a), u = ce("tabs--nav"), {
75
77
  t: q
76
- } = ve(), n = y(), m = y(), g = y({}), b = h(() => {
78
+ } = ve(), n = b(), m = b(), g = b({}), y = h(() => {
77
79
  if (!P(S.value))
78
80
  return g.value[S.value];
79
- }), C = y(), L = h(() => a.editable && ["line", "card", "card-gutter"].includes(a.type)), d = y(!1), B = y(0), k = y(0), o = y(0), M = () => {
81
+ }), C = b(), L = h(() => a.editable && ["line", "card", "card-gutter"].includes(a.type)), d = b(!1), B = b(0), k = b(0), o = b(0), M = () => {
80
82
  var e, t;
81
83
  return (T.value === "vertical" ? (e = n.value) == null ? void 0 : e.offsetHeight : (t = n.value) == null ? void 0 : t.offsetWidth) ?? 0;
82
84
  }, D = () => !m.value || !n.value ? 0 : T.value === "vertical" ? m.value.offsetHeight - n.value.offsetHeight : m.value.offsetWidth - n.value.offsetWidth, w = () => {
@@ -84,9 +86,9 @@ const Re = /* @__PURE__ */ ae({
84
86
  }, K = () => n.value && m.value ? a.direction === "vertical" ? m.value.offsetHeight > n.value.offsetHeight : m.value.offsetWidth > n.value.offsetWidth : !1, f = (e) => {
85
87
  (!n.value || !m.value || e < 0) && (e = 0), o.value = Math.min(e, k.value);
86
88
  }, E = () => {
87
- if (!b.value || !n.value || !d.value) return;
89
+ if (!y.value || !n.value || !d.value) return;
88
90
  oe(n.value, T.value);
89
- const e = T.value === "horizontal", t = e ? "offsetLeft" : "offsetTop", c = e ? "offsetWidth" : "offsetHeight", l = b.value[t], i = b.value[c], v = n.value[c], ee = window.getComputedStyle(b.value), te = e ? s.value === "end" ? "marginRight" : "marginLeft" : s.value === "end" ? "marginBottom" : "marginTop", x = parseFloat(ee[te]) || 0;
91
+ const e = T.value === "horizontal", t = e ? "offsetLeft" : "offsetTop", c = e ? "offsetWidth" : "offsetHeight", l = y.value[t], i = y.value[c], v = n.value[c], ee = window.getComputedStyle(y.value), te = e ? s.value === "end" ? "marginRight" : "marginLeft" : s.value === "end" ? "marginBottom" : "marginTop", x = parseFloat(ee[te]) || 0;
90
92
  s.value === "auto" ? l < o.value ? f(l - x) : l + i > o.value + v && f(l + i - v + x) : s.value === "center" ? f(l + (i - v + x) / 2) : s.value === "start" ? f(l - x) : s.value === "end" ? f(l + i - v + x) : fe(s.value) && f(l - s.value);
91
93
  }, U = (e) => {
92
94
  if (!d.value) return;
@@ -99,7 +101,7 @@ const Re = /* @__PURE__ */ ae({
99
101
  }, j = (e, t) => {
100
102
  z("click", e, t);
101
103
  }, F = () => a.tabs.filter((e) => !e.disabled), V = (e) => {
102
- N(() => {
104
+ I(() => {
103
105
  var t;
104
106
  (t = g.value[e]) == null || t.focus();
105
107
  });
@@ -115,27 +117,27 @@ const Re = /* @__PURE__ */ ae({
115
117
  }
116
118
  }, Y = (e, t) => {
117
119
  z("delete", e, t);
118
- }, A = (e) => {
120
+ }, N = (e) => {
119
121
  const t = e === "previous" ? o.value - B.value : o.value + B.value;
120
122
  f(t);
121
123
  }, G = () => {
122
124
  w(), C.value && C.value.$forceUpdate();
123
125
  };
124
- I($, () => {
125
- N(() => {
126
+ H($, () => {
127
+ I(() => {
126
128
  const e = new Set(a.tabs.map((t) => String(t.key)));
127
129
  Object.keys(g.value).forEach((t) => {
128
130
  e.has(t) || delete g.value[t];
129
131
  }), w();
130
132
  });
131
- }), I([p, s], () => {
133
+ }), H([p, s], () => {
132
134
  setTimeout(() => {
133
135
  E();
134
136
  }, 0);
135
137
  }), ie(() => {
136
138
  w();
137
139
  });
138
- const H = () => !L.value || !a.showAddButton ? null : r(se, {
140
+ const A = () => !L.value || !a.showAddButton ? null : r(se, {
139
141
  as: "button",
140
142
  "aria-label": q("tabs.add"),
141
143
  class: u.element("add-btn"),
@@ -162,7 +164,7 @@ const Re = /* @__PURE__ */ ae({
162
164
  type: "previous",
163
165
  direction: a.direction,
164
166
  disabled: o.value <= 0,
165
- onClick: A
167
+ onClick: N
166
168
  }, null), r(O, {
167
169
  onResize: () => w()
168
170
  }, {
@@ -192,22 +194,22 @@ const Re = /* @__PURE__ */ ae({
192
194
  var l, i;
193
195
  return [((i = (l = t.slots).title) == null ? void 0 : i.call(l)) ?? t.title];
194
196
  }
195
- })), a.type === "line" && b.value && r(ue, {
197
+ })), a.type === "line" && y.value && r(ue, {
196
198
  ref: C,
197
- activeTabRef: b.value,
199
+ activeTabRef: y.value,
198
200
  direction: a.direction,
199
201
  disabled: !1,
200
202
  animation: a.animation
201
203
  }, null)])]
202
- }), !d.value && H()])]
204
+ }), !d.value && A()])]
203
205
  }), d.value && r(W, {
204
206
  type: "next",
205
207
  direction: a.direction,
206
208
  disabled: o.value >= k.value,
207
- onClick: A
209
+ onClick: N
208
210
  }, null), r("div", {
209
211
  class: u.element("extra")
210
- }, [d.value && H(), (e = R.extra) == null ? void 0 : e.call(R)])]);
212
+ }, [d.value && A(), (e = R.extra) == null ? void 0 : e.call(R)])]);
211
213
  };
212
214
  }
213
215
  });
@@ -1,14 +1,16 @@
1
- import n from "./tabs-tab.vue2.js";
2
- import { resolveComponent as a, openBlock as o, createElementBlock as i, mergeProps as r, createElementVNode as d, normalizeClass as t, renderSlot as c, createBlock as b, withModifiers as m, withCtx as p, createVNode as f, createCommentVNode as u } from "vue";
1
+ import i from "./tabs-tab.vue2.js";
2
+ import { resolveComponent as a, openBlock as o, createElementBlock as n, mergeProps as r, createElementVNode as d, normalizeClass as t, renderSlot as c, createBlock as b, withModifiers as m, withCtx as p, createVNode as f, createCommentVNode as u } from "vue";
3
3
  import v from "../../_virtual/_plugin-vue_export-helper.js";
4
- const h = ["tabindex", "aria-selected", "aria-disabled"];
4
+ const h = ["id", "tabindex", "aria-selected", "aria-disabled", "aria-controls"];
5
5
  function k(e, C, N, $, B, V) {
6
- const s = a("icon-close"), l = a("icon-hover");
7
- return o(), i("div", r({
6
+ const l = a("icon-close"), s = a("icon-hover");
7
+ return o(), n("div", r({
8
8
  role: "tab",
9
+ id: e.tab.tabId,
9
10
  tabindex: e.active && !e.tab.disabled ? 0 : -1,
10
11
  "aria-selected": e.active,
11
12
  "aria-disabled": e.tab.disabled || void 0,
13
+ "aria-controls": e.tab.panelId,
12
14
  class: e.cls
13
15
  }, e.eventHandlers), [
14
16
  d("span", {
@@ -16,7 +18,7 @@ function k(e, C, N, $, B, V) {
16
18
  }, [
17
19
  c(e.$slots, "default")
18
20
  ], 2),
19
- e.editable && e.tab.closable ? (o(), b(l, {
21
+ e.editable && e.tab.closable ? (o(), b(s, {
20
22
  key: 0,
21
23
  as: "button",
22
24
  "aria-label": e.t("tabs.close", { title: String(e.tab.title ?? e.tab.key) }),
@@ -24,13 +26,13 @@ function k(e, C, N, $, B, V) {
24
26
  onClick: m(e.handleDelete, ["stop"])
25
27
  }, {
26
28
  default: p(() => [
27
- f(s)
29
+ f(l)
28
30
  ]),
29
31
  _: 1
30
32
  }, 8, ["aria-label", "class", "onClick"])) : u("", !0)
31
33
  ], 16, h);
32
34
  }
33
- const E = /* @__PURE__ */ v(n, [["render", k]]);
35
+ const E = /* @__PURE__ */ v(i, [["render", k]]);
34
36
  export {
35
37
  E as default
36
38
  };
@@ -53,7 +53,8 @@ const e = {
53
53
  dateRange: "date range",
54
54
  timeRange: "time range",
55
55
  tag: "tag",
56
- notification: "notification"
56
+ notification: "notification",
57
+ more: "More actions"
57
58
  },
58
59
  imagePreview: {
59
60
  fullscreen: "Fullscreen",
@@ -53,7 +53,8 @@ const e = {
53
53
  dateRange: "日期范围",
54
54
  timeRange: "时间范围",
55
55
  tag: "标签",
56
- notification: "通知"
56
+ notification: "通知",
57
+ more: "更多操作"
57
58
  },
58
59
  imagePreview: {
59
60
  fullscreen: "满屏",