x-next 1.11.1 → 1.13.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 (116) hide show
  1. package/AI_USAGE/catalog.md +1 -1
  2. package/AI_USAGE/components/alert.md +1 -1
  3. package/AI_USAGE/components/bar-chart.md +1 -1
  4. package/AI_USAGE/components/button.md +1 -1
  5. package/AI_USAGE/components/checkbox.md +1 -1
  6. package/AI_USAGE/components/color-picker.md +1 -1
  7. package/AI_USAGE/components/config-provider.md +1 -1
  8. package/AI_USAGE/components/date-picker.md +1 -1
  9. package/AI_USAGE/components/dialog.md +1 -1
  10. package/AI_USAGE/components/dropdown.md +1 -1
  11. package/AI_USAGE/components/empty.md +1 -1
  12. package/AI_USAGE/components/input.md +1 -1
  13. package/AI_USAGE/components/line-chart.md +1 -1
  14. package/AI_USAGE/components/message-box.md +1 -1
  15. package/AI_USAGE/components/message.md +1 -1
  16. package/AI_USAGE/components/notification.md +1 -1
  17. package/AI_USAGE/components/pagination.md +7 -3
  18. package/AI_USAGE/components/pie-chart.md +1 -1
  19. package/AI_USAGE/components/popconfirm.md +1 -1
  20. package/AI_USAGE/components/popover.md +1 -1
  21. package/AI_USAGE/components/progress.md +1 -1
  22. package/AI_USAGE/components/radio.md +1 -1
  23. package/AI_USAGE/components/rate.md +1 -1
  24. package/AI_USAGE/components/select.md +1 -1
  25. package/AI_USAGE/components/slider.md +1 -1
  26. package/AI_USAGE/components/steps.md +1 -1
  27. package/AI_USAGE/components/switch.md +1 -1
  28. package/AI_USAGE/components/tabs.md +1 -1
  29. package/AI_USAGE/components/textarea.md +1 -1
  30. package/AI_USAGE/components/time-picker.md +1 -1
  31. package/AI_USAGE/components/upload.md +1 -1
  32. package/AI_USAGE/core.md +1 -1
  33. package/AI_USAGE/index.md +1 -1
  34. package/AI_USAGE/recipes/form-on-demand.md +1 -1
  35. package/AI_USAGE.md +8 -4
  36. package/CHANGELOG.md +40 -0
  37. package/dist/components/network/Network.vue.d.ts +8 -4
  38. package/dist/components/network/index.d.ts +13 -5
  39. package/dist/components/network/props.d.ts +5 -0
  40. package/dist/components/network/utils.d.ts +3 -3
  41. package/dist/components/pagination/page-item-ellipsis.vue.d.ts +4 -1
  42. package/dist/components/pagination/page-item-step.vue.d.ts +101 -130
  43. package/dist/components/pagination/page-item.vue.d.ts +1 -0
  44. package/dist/components/pagination/page-jumper.vue.d.ts +1 -1
  45. package/dist/components/pagination/page-options.vue.d.ts +6 -4
  46. package/dist/components/pagination/utils.d.ts +3 -0
  47. package/dist/components/table/Table.d.ts +11 -0
  48. package/dist/components/table/context.d.ts +5 -0
  49. package/dist/components/table/dom-listeners.d.ts +23 -0
  50. package/dist/components/table/hooks/use-column-resize.d.ts +2 -1
  51. package/dist/components/table/hooks/use-drag.d.ts +6 -3
  52. package/dist/components/table/hooks/use-keyboard-navigation.d.ts +27 -0
  53. package/dist/components/table/hooks/use-sorter.d.ts +3 -1
  54. package/dist/components/table/index.d.ts +15 -0
  55. package/dist/components/table/interface.d.ts +9 -2
  56. package/dist/components/table/locale.d.ts +8 -7
  57. package/dist/components/table/table-operation-td.d.ts +34 -0
  58. package/dist/components/table/table-td.d.ts +36 -2
  59. package/dist/components/table/table-th.d.ts +34 -0
  60. package/dist/components/table/table-tr.d.ts +34 -0
  61. package/dist/components/time-range-selector/index.d.ts +6 -6
  62. package/dist/components/trend-chart/components/TrendChart.d.ts +1 -1
  63. package/dist/components/trend-chart/index.d.ts +3 -3
  64. package/dist/components/upload/Upload.d.ts +1 -1
  65. package/dist/components/upload/index.d.ts +3 -3
  66. package/dist/es/_styles/palette-aliases.js +4 -4
  67. package/dist/es/components/button/Button.js +53 -42
  68. package/dist/es/components/network/Network.vue.js +17 -12
  69. package/dist/es/components/network/Network.vue2.js +78 -70
  70. package/dist/es/components/network/utils.js +112 -71
  71. package/dist/es/components/pagination/Pagination.js +132 -123
  72. package/dist/es/components/pagination/page-item-ellipsis.vue.js +10 -10
  73. package/dist/es/components/pagination/page-item-ellipsis.vue2.js +24 -19
  74. package/dist/es/components/pagination/page-item-step.vue.js +14 -11
  75. package/dist/es/components/pagination/page-item-step.vue2.js +20 -22
  76. package/dist/es/components/pagination/page-item.vue.js +10 -9
  77. package/dist/es/components/pagination/page-item.vue2.js +24 -19
  78. package/dist/es/components/pagination/page-jumper.vue2.js +23 -23
  79. package/dist/es/components/pagination/page-options.vue.js +15 -10
  80. package/dist/es/components/pagination/page-options.vue2.js +21 -17
  81. package/dist/es/components/pagination/utils.js +4 -2
  82. package/dist/es/components/table/Table.js +947 -713
  83. package/dist/es/components/table/dom-listeners.js +23 -0
  84. package/dist/es/components/table/hooks/use-column-resize.js +27 -18
  85. package/dist/es/components/table/hooks/use-column-sorter.js +22 -29
  86. package/dist/es/components/table/hooks/use-drag.js +23 -20
  87. package/dist/es/components/table/hooks/use-filter.js +43 -43
  88. package/dist/es/components/table/hooks/use-keyboard-navigation.js +69 -0
  89. package/dist/es/components/table/hooks/use-row-selection.js +33 -29
  90. package/dist/es/components/table/hooks/use-sorter.js +86 -38
  91. package/dist/es/components/table/hooks/use-span.js +28 -35
  92. package/dist/es/components/table/locale.js +27 -10
  93. package/dist/es/components/table/table-col-group.vue2.js +9 -9
  94. package/dist/es/components/table/table-operation-td.js +72 -51
  95. package/dist/es/components/table/table-operation-th.js +41 -34
  96. package/dist/es/components/table/table-td.js +100 -77
  97. package/dist/es/components/table/table-th.js +221 -188
  98. package/dist/es/components/table/table-tr.js +11 -8
  99. package/dist/es/components/table/utils.js +104 -94
  100. package/dist/es/components/virtual-list-v2/hooks/use-size.js +47 -41
  101. package/dist/es/components/virtual-list-v2/virtual-list-item.js +29 -16
  102. package/dist/es/locale/en-US.js +9 -1
  103. package/dist/es/locale/index.js +3 -3
  104. package/dist/es/locale/zh-CN.js +9 -1
  105. package/dist/es/style.css +1 -1
  106. package/dist/index.cjs +3 -3
  107. package/dist/index.umd.js +3 -3
  108. package/dist/locale/interface.d.ts +12 -0
  109. package/dist/style/base.css +1 -1
  110. package/dist/style/button.css +1 -1
  111. package/dist/style/form-select.css +1 -1
  112. package/dist/style/network.css +1 -1
  113. package/dist/style/pagination.css +1 -1
  114. package/dist/style/table.css +1 -1
  115. package/dist/style.css +1 -1
  116. package/package.json +1 -1
@@ -1,17 +1,19 @@
1
- import { defineComponent as E, computed as r, inject as z, ref as F, createVNode as i, mergeProps as L, isVNode as P } from "vue";
2
- import { getFixedCls as O, getStyle as A } from "./utils.js";
3
- import { getValueByPath as k } from "../../_utils/get-value-by-path.js";
4
- import M from "../../icons/animation/animation-loading.js";
5
- import { isObject as T, isFunction as f } from "../../_utils/is.js";
6
- import { tableInjectionKey as V } from "./context.js";
7
- import W from "../_components/auto-tooltip/auto-tooltip.js";
8
- import { getClassNameMixin as $ } from "../../_utils/config.js";
9
- function _(e) {
10
- return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !P(e);
1
+ import { defineComponent as L, computed as i, inject as O, ref as k, onBeforeUnmount as A, watch as b, createVNode as r, mergeProps as T, isVNode as q } from "vue";
2
+ import { getFixedCls as M, getStyle as R } from "./utils.js";
3
+ import { getValueByPath as V } from "../../_utils/get-value-by-path.js";
4
+ import { isObject as W, isFunction as s } from "../../_utils/is.js";
5
+ import { tableInjectionKey as $ } from "./context.js";
6
+ import D from "../_components/auto-tooltip/auto-tooltip.js";
7
+ import { getClassNameMixin as K } from "../../_utils/config.js";
8
+ import { tableDomListeners as _, getTableDomListeners as U } from "./dom-listeners.js";
9
+ function G(e) {
10
+ return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !q(e);
11
11
  }
12
- const U = /* @__PURE__ */ E({
12
+ const le = /* @__PURE__ */ L({
13
13
  name: "Td",
14
+ inheritAttrs: !1,
14
15
  props: {
16
+ ..._,
15
17
  rowIndex: Number,
16
18
  record: {
17
19
  type: Object,
@@ -65,110 +67,131 @@ const U = /* @__PURE__ */ E({
65
67
  }
66
68
  },
67
69
  setup(e, {
68
- attrs: x,
70
+ attrs: g,
69
71
  slots: m
70
72
  }) {
71
- const o = $("table"), S = r(() => {
73
+ const d = K("table"), h = i(() => {
72
74
  var l;
73
- if (T((l = e.column) == null ? void 0 : l.tooltip))
75
+ if (W((l = e.column) == null ? void 0 : l.tooltip))
74
76
  return e.column.tooltip;
75
- }), w = r(() => {
76
- var l, n;
77
- return ((l = e.column) == null ? void 0 : l.dataIndex) && ((n = u.sorter) == null ? void 0 : n.field) === e.column.dataIndex;
78
- }), g = r(() => {
77
+ }), v = i(() => {
78
+ var l, t, n;
79
+ return ((l = e.column) == null ? void 0 : l.dataIndex) && (((t = o.sorters) == null ? void 0 : t.some((a) => a.field === e.column.dataIndex)) || ((n = o.sorter) == null ? void 0 : n.field) === e.column.dataIndex);
80
+ }), I = i(() => {
79
81
  var l;
80
- return ((l = e.column) == null ? void 0 : l.dataIndex) && u.resizingColumn === e.column.dataIndex;
81
- }), b = () => {
82
- var l, n, t, c, a, d;
83
- return e.summary ? f((l = e.column) == null ? void 0 : l.summaryCellClass) ? e.column.summaryCellClass((n = e.record) == null ? void 0 : n.raw) : (t = e.column) == null ? void 0 : t.summaryCellClass : f((c = e.column) == null ? void 0 : c.bodyCellClass) ? e.column.bodyCellClass((a = e.record) == null ? void 0 : a.raw) : (d = e.column) == null ? void 0 : d.bodyCellClass;
84
- }, N = r(() => {
82
+ return ((l = e.column) == null ? void 0 : l.dataIndex) && o.resizingColumn === e.column.dataIndex;
83
+ }), N = () => {
84
+ var l, t, n, a, c, u;
85
+ return e.summary ? s((l = e.column) == null ? void 0 : l.summaryCellClass) ? e.column.summaryCellClass((t = e.record) == null ? void 0 : t.raw) : (n = e.column) == null ? void 0 : n.summaryCellClass : s((a = e.column) == null ? void 0 : a.bodyCellClass) ? e.column.bodyCellClass((c = e.record) == null ? void 0 : c.raw) : (u = e.column) == null ? void 0 : u.bodyCellClass;
86
+ }, B = i(() => {
85
87
  var l;
86
- return [o.element("td"), {
87
- [o.element("col-sorted")]: w.value,
88
- [o.element("td-resizing")]: g.value
89
- }, ...O(o.block, e.column), (l = e.column) == null ? void 0 : l.cellClass, b()];
90
- }), h = () => {
91
- var l, n, t, c, a, d;
92
- return e.summary ? f((l = e.column) == null ? void 0 : l.summaryCellStyle) ? e.column.summaryCellStyle((n = e.record) == null ? void 0 : n.raw) : (t = e.column) == null ? void 0 : t.summaryCellStyle : f((c = e.column) == null ? void 0 : c.bodyCellStyle) ? e.column.bodyCellStyle((a = e.record) == null ? void 0 : a.raw) : (d = e.column) == null ? void 0 : d.bodyCellStyle;
93
- }, I = r(() => {
94
- var t;
95
- const l = A(e.column, {
88
+ return [d.element("td"), {
89
+ [d.element("col-sorted")]: v.value,
90
+ [d.element("td-resizing")]: I.value
91
+ }, ...M(d.block, e.column), (l = e.column) == null ? void 0 : l.cellClass, N()];
92
+ }), E = () => {
93
+ var l, t, n, a, c, u;
94
+ return e.summary ? s((l = e.column) == null ? void 0 : l.summaryCellStyle) ? e.column.summaryCellStyle((t = e.record) == null ? void 0 : t.raw) : (n = e.column) == null ? void 0 : n.summaryCellStyle : s((a = e.column) == null ? void 0 : a.bodyCellStyle) ? e.column.bodyCellStyle((c = e.record) == null ? void 0 : c.raw) : (u = e.column) == null ? void 0 : u.bodyCellStyle;
95
+ }, j = i(() => {
96
+ var n;
97
+ const l = R(e.column, {
96
98
  dataColumns: e.dataColumns,
97
99
  operations: e.operations
98
- }), n = h();
100
+ }), t = E();
99
101
  return {
100
102
  ...l,
101
- ...(t = e.column) == null ? void 0 : t.cellStyle,
102
- ...n
103
+ ...(n = e.column) == null ? void 0 : n.cellStyle,
104
+ ...t
103
105
  };
104
- }), v = r(() => {
106
+ }), z = i(() => {
105
107
  if (e.isFixedExpand && e.containerWidth)
106
108
  return {
107
109
  width: `${e.containerWidth}px`
108
110
  };
109
- }), u = z(V, {}), s = () => {
110
- var n, t, c, a, d, C;
111
+ }), o = O($, {}), x = () => {
112
+ var t, n, a, c, u, S;
111
113
  if (m.default)
112
114
  return m.default();
113
115
  const l = {
114
- record: (n = e.record) == null ? void 0 : n.raw,
116
+ record: (t = e.record) == null ? void 0 : t.raw,
115
117
  column: e.column,
116
118
  rowIndex: e.rowIndex ?? -1
117
119
  };
118
- return m.cell ? m.cell(l) : (t = e.column.slots) != null && t.cell ? e.column.slots.cell(l) : e.column.render ? e.column.render(l) : e.column.slotName && ((c = u.slots) != null && c[e.column.slotName]) ? (d = (a = u.slots)[e.column.slotName]) == null ? void 0 : d.call(a, l) : String(k((C = e.record) == null ? void 0 : C.raw, e.column.dataIndex) ?? "");
119
- }, y = F(!1), B = (l) => {
120
- var n, t;
121
- f(u.loadMore) && !((n = e.record) != null && n.isLeaf) && !((t = e.record) != null && t.children) && (y.value = !0, new Promise((c) => {
122
- var a;
123
- (a = u.loadMore) == null || a.call(u, e.record.raw, c);
124
- }).then((c) => {
125
- var a;
126
- (a = u.addLazyLoadData) == null || a.call(u, c, e.record), y.value = !1;
127
- })), l.stopPropagation();
128
- }, j = () => {
129
- var n, t, c, a, d;
120
+ return m.cell ? m.cell(l) : (n = e.column.slots) != null && n.cell ? e.column.slots.cell(l) : e.column.render ? e.column.render(l) : e.column.slotName && ((a = o.slots) != null && a[e.column.slotName]) ? (u = (c = o.slots)[e.column.slotName]) == null ? void 0 : u.call(c, l) : String(V((S = e.record) == null ? void 0 : S.raw, e.column.dataIndex) ?? "");
121
+ }, f = k(!1);
122
+ let C = !1, y = 0;
123
+ A(() => {
124
+ C = !0;
125
+ }), b(() => e.record.raw, () => {
126
+ y++, f.value = !1;
127
+ }, {
128
+ flush: "sync"
129
+ });
130
+ const w = () => {
131
+ var l, t, n;
132
+ if (!(f.value || !e.showExpandBtn) && s(o.loadMore) && !((l = e.record) != null && l.isLeaf) && !((t = e.record) != null && t.children)) {
133
+ const a = e.record, c = ++y;
134
+ f.value = !0, Promise.resolve((n = o.loadChildren) == null ? void 0 : n.call(o, a)).catch(() => {
135
+ }).finally(() => {
136
+ !C && c === y && (f.value = !1);
137
+ });
138
+ }
139
+ }, F = (l) => {
140
+ l.stopPropagation(), w();
141
+ };
142
+ b([() => {
143
+ var l;
144
+ return (l = o.expandedRowKeys) == null ? void 0 : l.includes(e.record.key);
145
+ }, () => e.record.raw, () => e.record.children, () => o.loadMore], ([l]) => {
146
+ l && w();
147
+ }, {
148
+ immediate: !0
149
+ });
150
+ const P = () => {
151
+ var t, n, a, c, u;
130
152
  let l;
131
- return i("span", {
132
- class: [o.element("cell"), o.element(`cell-align-${((n = e.column) == null ? void 0 : n.align) ?? "left"}`), {
133
- [o.element("cell-fixed-expand")]: e.isFixedExpand,
134
- [o.element("cell-expand-icon")]: e.showExpandBtn
153
+ return r("span", {
154
+ class: [d.element("cell"), d.element(`cell-align-${((t = e.column) == null ? void 0 : t.align) ?? "left"}`), {
155
+ [d.element("cell-fixed-expand")]: e.isFixedExpand,
156
+ [d.element("cell-expand-icon")]: e.showExpandBtn
135
157
  }],
136
- style: v.value
137
- }, [e.indentSize > 0 && i("span", {
158
+ style: z.value
159
+ }, [e.indentSize > 0 && r("span", {
138
160
  style: {
139
161
  paddingLeft: `${e.indentSize}px`
140
162
  }
141
- }, null), e.showExpandBtn && i("span", {
142
- class: o.element("cell-inline-icon"),
143
- onClick: B
144
- }, [y.value ? i(M, null, null) : (t = e.renderExpandBtn) == null ? void 0 : t.call(e, e.record, !1)]), (c = e.column) != null && c.ellipsis && ((a = e.column) != null && a.tooltip) ? i(W, {
145
- class: o.element("td--content"),
146
- tooltipProps: S.value
147
- }, _(l = s()) ? l : {
163
+ }, null), e.showExpandBtn && r("span", {
164
+ class: d.element("cell-inline-icon"),
165
+ onClick: F
166
+ }, [(n = e.renderExpandBtn) == null ? void 0 : n.call(e, e.record, !1, f.value)]), (a = e.column) != null && a.ellipsis && ((c = e.column) != null && c.tooltip) ? r(D, {
167
+ class: d.element("td--content"),
168
+ tooltipProps: h.value
169
+ }, G(l = x()) ? l : {
148
170
  default: () => [l]
149
- }) : i("span", {
150
- class: [o.element("td--content"), {
151
- [o.modifier("text-ellipsis")]: (d = e.column) == null ? void 0 : d.ellipsis
171
+ }) : r("span", {
172
+ class: [d.element("td--content"), {
173
+ [d.modifier("text-ellipsis")]: (u = e.column) == null ? void 0 : u.ellipsis
152
174
  }]
153
- }, [s()])]);
175
+ }, [x()])]);
154
176
  };
155
177
  return () => {
156
- var l, n;
157
- return i(((n = m.td) == null ? void 0 : n.call(m, {
178
+ var l, t;
179
+ return r(((t = m.td) == null ? void 0 : t.call(m, {
158
180
  record: (l = e.record) == null ? void 0 : l.raw,
159
181
  column: e.column,
160
182
  rowIndex: e.rowIndex ?? -1
161
- })[0]) ?? "td", L(x, {
162
- class: N.value,
163
- style: I.value,
183
+ })[0]) ?? "td", T(g, U(e), {
184
+ class: B.value,
185
+ style: j.value,
164
186
  rowspan: e.rowSpan > 1 ? e.rowSpan : void 0,
165
- colspan: e.colSpan > 1 ? e.colSpan : void 0
187
+ colspan: e.colSpan > 1 ? e.colSpan : void 0,
188
+ "data-x-table-column": e.column.dataIndex
166
189
  }), {
167
- default: () => [j()]
190
+ default: () => [P()]
168
191
  });
169
192
  };
170
193
  }
171
194
  });
172
195
  export {
173
- U as default
196
+ le as default
174
197
  };