x-next 1.11.1 → 1.12.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 (135) 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 +1 -1
  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 +2 -2
  36. package/CHANGELOG.md +18 -0
  37. package/dist/components/network/Network.vue.d.ts +1 -1
  38. package/dist/components/network/index.d.ts +3 -3
  39. package/dist/components/table/Table.d.ts +11 -0
  40. package/dist/components/table/context.d.ts +5 -0
  41. package/dist/components/table/dom-listeners.d.ts +23 -0
  42. package/dist/components/table/hooks/use-column-resize.d.ts +2 -1
  43. package/dist/components/table/hooks/use-drag.d.ts +6 -3
  44. package/dist/components/table/hooks/use-keyboard-navigation.d.ts +27 -0
  45. package/dist/components/table/hooks/use-sorter.d.ts +3 -1
  46. package/dist/components/table/index.d.ts +15 -0
  47. package/dist/components/table/interface.d.ts +9 -2
  48. package/dist/components/table/locale.d.ts +8 -7
  49. package/dist/components/table/table-operation-td.d.ts +34 -0
  50. package/dist/components/table/table-td.d.ts +36 -2
  51. package/dist/components/table/table-th.d.ts +34 -0
  52. package/dist/components/table/table-tr.d.ts +34 -0
  53. package/dist/components/trend-chart/components/TrendChart.d.ts +1 -1
  54. package/dist/components/trend-chart/index.d.ts +3 -3
  55. package/dist/components/upload/Upload.d.ts +1 -1
  56. package/dist/components/upload/index.d.ts +3 -3
  57. package/dist/es/{node_modules → Users/xuyu/Code/x-next/node_modules}/.pnpm/dayjs@1.11.21/node_modules/dayjs/dayjs.min.js +1 -1
  58. package/dist/es/{node_modules → Users/xuyu/Code/x-next/node_modules}/.pnpm/dayjs@1.11.21/node_modules/dayjs/locale/zh-cn.js +1 -1
  59. package/dist/es/{node_modules → Users/xuyu/Code/x-next/node_modules}/.pnpm/dayjs@1.11.21/node_modules/dayjs/plugin/advancedFormat.js +1 -1
  60. package/dist/es/{node_modules → Users/xuyu/Code/x-next/node_modules}/.pnpm/dayjs@1.11.21/node_modules/dayjs/plugin/customParseFormat.js +1 -1
  61. package/dist/es/{node_modules → Users/xuyu/Code/x-next/node_modules}/.pnpm/dayjs@1.11.21/node_modules/dayjs/plugin/isBetween.js +1 -1
  62. package/dist/es/{node_modules → Users/xuyu/Code/x-next/node_modules}/.pnpm/dayjs@1.11.21/node_modules/dayjs/plugin/quarterOfYear.js +1 -1
  63. package/dist/es/{node_modules → Users/xuyu/Code/x-next/node_modules}/.pnpm/dayjs@1.11.21/node_modules/dayjs/plugin/weekOfYear.js +1 -1
  64. package/dist/es/{node_modules → Users/xuyu/Code/x-next/node_modules}/.pnpm/dayjs@1.11.21/node_modules/dayjs/plugin/weekYear.js +1 -1
  65. package/dist/es/_container/resize-observer-v2.js +1 -1
  66. package/dist/es/_container/resize-observer.js +1 -1
  67. package/dist/es/_hooks/use-resize-observer.js +1 -1
  68. package/dist/es/_virtual/advancedFormat.js +1 -1
  69. package/dist/es/_virtual/customParseFormat.js +1 -1
  70. package/dist/es/_virtual/dayjs.min.js +1 -1
  71. package/dist/es/_virtual/isBetween.js +1 -1
  72. package/dist/es/_virtual/quarterOfYear.js +1 -1
  73. package/dist/es/_virtual/weekOfYear.js +1 -1
  74. package/dist/es/_virtual/weekYear.js +1 -1
  75. package/dist/es/_virtual/zh-cn.js +1 -1
  76. package/dist/es/components/draggable/useDraggable.js +1 -1
  77. package/dist/es/components/form/Form.vue2.js +1 -1
  78. package/dist/es/components/form/FormItem.vue2.js +1 -1
  79. package/dist/es/components/form-input-number/InputNumber.js +1 -1
  80. package/dist/es/components/form-slider/Slider.vue2.js +1 -1
  81. package/dist/es/components/form-slider/slider-ticks.vue2.js +1 -1
  82. package/dist/es/components/form-slider/utils.js +1 -1
  83. package/dist/es/components/menu/MenuItem.js +1 -1
  84. package/dist/es/components/menu/overflow-wrap.js +1 -1
  85. package/dist/es/components/progress/circle.vue2.js +1 -1
  86. package/dist/es/components/progress/line.vue2.js +1 -1
  87. package/dist/es/components/progress/steps.vue2.js +1 -1
  88. package/dist/es/components/rate/Rate.js +1 -1
  89. package/dist/es/components/table/Table.js +947 -713
  90. package/dist/es/components/table/dom-listeners.js +23 -0
  91. package/dist/es/components/table/hooks/use-column-resize.js +27 -18
  92. package/dist/es/components/table/hooks/use-column-sorter.js +22 -29
  93. package/dist/es/components/table/hooks/use-drag.js +23 -20
  94. package/dist/es/components/table/hooks/use-filter.js +43 -43
  95. package/dist/es/components/table/hooks/use-keyboard-navigation.js +69 -0
  96. package/dist/es/components/table/hooks/use-row-selection.js +33 -29
  97. package/dist/es/components/table/hooks/use-sorter.js +86 -38
  98. package/dist/es/components/table/hooks/use-span.js +28 -35
  99. package/dist/es/components/table/locale.js +27 -10
  100. package/dist/es/components/table/table-col-group.vue2.js +9 -9
  101. package/dist/es/components/table/table-operation-td.js +72 -51
  102. package/dist/es/components/table/table-operation-th.js +41 -34
  103. package/dist/es/components/table/table-td.js +100 -77
  104. package/dist/es/components/table/table-th.js +221 -188
  105. package/dist/es/components/table/table-tr.js +11 -8
  106. package/dist/es/components/table/utils.js +104 -94
  107. package/dist/es/components/virtual-list-v2/hooks/use-size.js +47 -41
  108. package/dist/es/components/virtual-list-v2/virtual-list-item.js +29 -16
  109. package/dist/es/locale/en-US.js +7 -1
  110. package/dist/es/locale/index.js +3 -3
  111. package/dist/es/locale/zh-CN.js +7 -1
  112. package/dist/es/style.css +1 -1
  113. package/dist/index.cjs +3 -3
  114. package/dist/index.umd.js +3 -3
  115. package/dist/locale/interface.d.ts +9 -0
  116. package/dist/style/table.css +1 -1
  117. package/dist/style.css +1 -1
  118. package/package.json +1 -1
  119. /package/dist/es/{node_modules → Users/xuyu/Code/x-next/node_modules}/.pnpm/b-validate@1.5.3/node_modules/b-validate/es/index.js +0 -0
  120. /package/dist/es/{node_modules → Users/xuyu/Code/x-next/node_modules}/.pnpm/b-validate@1.5.3/node_modules/b-validate/es/is.js +0 -0
  121. /package/dist/es/{node_modules → Users/xuyu/Code/x-next/node_modules}/.pnpm/b-validate@1.5.3/node_modules/b-validate/es/locale/en-US.js +0 -0
  122. /package/dist/es/{node_modules → Users/xuyu/Code/x-next/node_modules}/.pnpm/b-validate@1.5.3/node_modules/b-validate/es/rules/array.js +0 -0
  123. /package/dist/es/{node_modules → Users/xuyu/Code/x-next/node_modules}/.pnpm/b-validate@1.5.3/node_modules/b-validate/es/rules/base.js +0 -0
  124. /package/dist/es/{node_modules → Users/xuyu/Code/x-next/node_modules}/.pnpm/b-validate@1.5.3/node_modules/b-validate/es/rules/boolean.js +0 -0
  125. /package/dist/es/{node_modules → Users/xuyu/Code/x-next/node_modules}/.pnpm/b-validate@1.5.3/node_modules/b-validate/es/rules/custom.js +0 -0
  126. /package/dist/es/{node_modules → Users/xuyu/Code/x-next/node_modules}/.pnpm/b-validate@1.5.3/node_modules/b-validate/es/rules/number.js +0 -0
  127. /package/dist/es/{node_modules → Users/xuyu/Code/x-next/node_modules}/.pnpm/b-validate@1.5.3/node_modules/b-validate/es/rules/object.js +0 -0
  128. /package/dist/es/{node_modules → Users/xuyu/Code/x-next/node_modules}/.pnpm/b-validate@1.5.3/node_modules/b-validate/es/rules/string.js +0 -0
  129. /package/dist/es/{node_modules → Users/xuyu/Code/x-next/node_modules}/.pnpm/b-validate@1.5.3/node_modules/b-validate/es/rules/type.js +0 -0
  130. /package/dist/es/{node_modules → Users/xuyu/Code/x-next/node_modules}/.pnpm/b-validate@1.5.3/node_modules/b-validate/es/util.js +0 -0
  131. /package/dist/es/{node_modules → Users/xuyu/Code/x-next/node_modules}/.pnpm/compute-scroll-into-view@3.1.1/node_modules/compute-scroll-into-view/dist/index.js +0 -0
  132. /package/dist/es/{node_modules → Users/xuyu/Code/x-next/node_modules}/.pnpm/number-precision@1.6.0/node_modules/number-precision/build/index.es.js +0 -0
  133. /package/dist/es/{node_modules → Users/xuyu/Code/x-next/node_modules}/.pnpm/resize-observer-polyfill@1.5.1/node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js +0 -0
  134. /package/dist/es/{node_modules → Users/xuyu/Code/x-next/node_modules}/.pnpm/scroll-into-view-if-needed@3.1.0/node_modules/scroll-into-view-if-needed/dist/index.js +0 -0
  135. /package/dist/es/{node_modules → Users/xuyu/Code/x-next/node_modules}/.pnpm/sortablejs@1.15.7/node_modules/sortablejs/modular/sortable.esm.js +0 -0
@@ -0,0 +1,23 @@
1
+ const n = () => Function, t = {
2
+ tabindex: [String, Number],
3
+ onClick: n(),
4
+ onDblclick: n(),
5
+ onContextmenu: n(),
6
+ onMouseenter: n(),
7
+ onMouseleave: n(),
8
+ onDragstart: n(),
9
+ onDragend: n(),
10
+ onDragenter: n(),
11
+ onDragover: n(),
12
+ onDrop: n(),
13
+ onKeydown: n(),
14
+ onFocus: n(),
15
+ onPointerdown: n(),
16
+ onPointermove: n(),
17
+ onPointerup: n(),
18
+ onPointercancel: n()
19
+ }, r = (e) => Object.fromEntries(Object.keys(t).map((o) => [o, e[o]]));
20
+ export {
21
+ r as getTableDomListeners,
22
+ t as tableDomListeners
23
+ };
@@ -1,27 +1,36 @@
1
- import { ref as v, reactive as f, onBeforeUnmount as h } from "vue";
2
- import { off as i, on as s } from "../../../_utils/dom.js";
3
- const g = (c, w) => {
4
- const e = v(""), l = f({}), a = (u, n) => {
5
- n.preventDefault(), e.value = u, s(window, "mousemove", m), s(window, "mouseup", o), s(window, "contextmenu", o);
6
- }, o = () => {
7
- e.value = "", i(window, "mousemove", m), i(window, "mouseup", o), i(window, "contextmenu", o);
1
+ import { ref as d, reactive as g, onBeforeUnmount as v } from "vue";
2
+ import { off as c, on as l } from "../../../_utils/dom.js";
3
+ const y = (r, h, f = () => 40) => {
4
+ const u = d(""), s = g({}), a = (e, o) => {
5
+ o.preventDefault(), u.value = e, l(window, "mousemove", w), l(window, "mouseup", n), l(window, "contextmenu", n);
6
+ }, n = () => {
7
+ u.value = "", c(window, "mousemove", w), c(window, "mouseup", n), c(window, "contextmenu", n);
8
8
  };
9
- h(o);
10
- const m = (u) => {
11
- const n = c.value[e.value];
12
- if (n) {
13
- const { clientX: d } = u, { x: r } = n.getBoundingClientRect();
14
- let t = Math.ceil(d - r);
15
- t < 40 && (t = 40), l[e.value] = t, w("columnResize", e.value, t);
9
+ v(n);
10
+ const m = (e, o) => {
11
+ const t = Math.max(40, f(e), Math.ceil(o));
12
+ s[e] = t, h("columnResize", e, t);
13
+ }, p = (e, o) => {
14
+ var i;
15
+ if (o.key !== "ArrowLeft" && o.key !== "ArrowRight") return;
16
+ o.preventDefault(), o.stopPropagation();
17
+ const t = s[e] ?? ((i = r.value[e]) == null ? void 0 : i.getBoundingClientRect().width) ?? 40;
18
+ m(e, t + (o.key === "ArrowLeft" ? -10 : 10));
19
+ }, w = (e) => {
20
+ const o = r.value[u.value];
21
+ if (o) {
22
+ const { clientX: t } = e, { x: i } = o.getBoundingClientRect();
23
+ m(u.value, t - i);
16
24
  }
17
25
  };
18
26
  return {
19
- resizingColumn: e,
20
- columnWidth: l,
27
+ resizingColumn: u,
28
+ columnWidth: s,
21
29
  handleThMouseDown: a,
22
- handleThMouseUp: o
30
+ handleThMouseUp: n,
31
+ handleThKeyDown: p
23
32
  };
24
33
  };
25
34
  export {
26
- g as useColumnResize
35
+ y as useColumnResize
27
36
  };
@@ -1,37 +1,30 @@
1
- import { computed as n } from "vue";
2
- const h = ({
3
- column: t,
4
- tableCtx: o
1
+ import { computed as o } from "vue";
2
+ const S = ({
3
+ column: n,
4
+ tableCtx: t
5
5
  }) => {
6
- const a = n(() => {
7
- var e;
8
- if (t.value.dataIndex && t.value.dataIndex === ((e = o.sorter) == null ? void 0 : e.field))
9
- return o.sorter.direction;
10
- }), r = n(
11
- () => {
12
- var e, s;
13
- return ((s = (e = t.value) == null ? void 0 : e.sortable) == null ? void 0 : s.sortDirections) ?? [];
14
- }
15
- ), u = n(() => r.value.length > 0), i = n(() => r.value.includes("ascend")), c = n(
16
- () => r.value.includes("descend")
17
- ), d = n(() => a.value ? a.value === r.value[0] ? r.value[1] ?? "" : "" : r.value[0] ?? "");
6
+ const d = o(() => {
7
+ var e, i;
8
+ const r = (e = t.sorters) == null ? void 0 : e.find((l) => l.field === n.value.dataIndex);
9
+ if (r) return r.direction;
10
+ if (n.value.dataIndex && n.value.dataIndex === ((i = t.sorter) == null ? void 0 : i.field))
11
+ return t.sorter.direction;
12
+ }), s = o(() => {
13
+ var r, e;
14
+ return ((e = (r = n.value) == null ? void 0 : r.sortable) == null ? void 0 : e.sortDirections) ?? [];
15
+ }), u = o(() => s.value.length > 0), c = o(() => s.value.includes("ascend")), v = o(() => s.value.includes("descend")), a = o(() => d.value ? d.value === s.value[0] ? s.value[1] ?? "" : "" : s.value[0] ?? "");
18
16
  return {
19
- sortOrder: a,
17
+ sortOrder: d,
20
18
  hasSorter: u,
21
- hasAscendBtn: i,
22
- hasDescendBtn: c,
23
- nextSortOrder: d,
24
- handleClickSorter: (e) => {
25
- var s;
26
- t.value.dataIndex && ((s = o.onSorterChange) == null || s.call(
27
- o,
28
- t.value.dataIndex,
29
- d.value,
30
- e
31
- ));
19
+ hasAscendBtn: c,
20
+ hasDescendBtn: v,
21
+ nextSortOrder: a,
22
+ handleClickSorter: (r) => {
23
+ var e;
24
+ n.value.dataIndex && ((e = t.onSorterChange) == null || e.call(t, n.value.dataIndex, a.value, r));
32
25
  }
33
26
  };
34
27
  };
35
28
  export {
36
- h as useColumnSorter
29
+ S as useColumnSorter
37
30
  };
@@ -1,39 +1,42 @@
1
- import { computed as s, reactive as c } from "vue";
2
- const T = (n) => {
3
- const g = s(() => {
4
- if (n.value)
5
- return n.value.type === "handle" ? "handle" : "row";
6
- }), t = c({
1
+ import { computed as l, reactive as h } from "vue";
2
+ const T = (g) => {
3
+ const f = l(() => {
4
+ if (g.value)
5
+ return g.value.type === "handle" ? "handle" : "row";
6
+ }), t = h({
7
7
  dragging: !1,
8
8
  sourceKey: "",
9
9
  sourcePath: [],
10
10
  targetPath: [],
11
11
  data: {}
12
- }), d = () => {
12
+ }), r = () => {
13
13
  t.dragging = !1, t.sourceKey = "", t.sourcePath = [], t.targetPath = [], t.data = {};
14
+ }, s = (a, e, n, c) => {
15
+ if (a.dataTransfer && (a.dataTransfer.effectAllowed = "move", a.target && a.target.tagName === "TD")) {
16
+ const { parentElement: o } = a.target;
17
+ o && o.tagName === "TR" && a.dataTransfer.setDragImage(o, 0, 0);
18
+ }
19
+ d(e, n, c);
20
+ }, d = (a, e, n) => {
21
+ t.dragging = !0, t.sourceKey = a, t.sourcePath = e, t.targetPath = [...e], t.data = n;
14
22
  };
15
23
  return {
16
- dragType: g,
24
+ beginDrag: d,
25
+ clearDragState: r,
26
+ dragType: f,
17
27
  dragState: t,
18
- handleDragStart: (a, r, o, f) => {
19
- if (a.dataTransfer && (a.dataTransfer.effectAllowed = "move", a.target && a.target.tagName === "TD")) {
20
- const { parentElement: e } = a.target;
21
- e && e.tagName === "TR" && a.dataTransfer.setDragImage(e, 0, 0);
22
- }
23
- t.dragging = !0, t.sourceKey = r, t.sourcePath = o, t.targetPath = [...o], t.data = f;
24
- },
25
- handleDragEnter: (a, r) => {
26
- a.dataTransfer && (a.dataTransfer.dropEffect = "move"), t.targetPath.toString() !== r.toString() && (t.targetPath = r), a.preventDefault();
28
+ handleDragStart: s,
29
+ handleDragEnter: (a, e) => {
30
+ a.dataTransfer && (a.dataTransfer.dropEffect = "move"), t.targetPath.toString() !== e.toString() && (t.targetPath = e), a.preventDefault();
27
31
  },
28
32
  handleDragover: (a) => {
29
33
  a.dataTransfer && (a.dataTransfer.dropEffect = "move"), a.preventDefault();
30
34
  },
31
35
  handleDragEnd: (a) => {
32
- var r;
33
- ((r = a.dataTransfer) == null ? void 0 : r.dropEffect) === "none" && d();
36
+ r();
34
37
  },
35
38
  handleDrop: (a) => {
36
- d(), a.preventDefault();
39
+ r(), a.preventDefault();
37
40
  }
38
41
  };
39
42
  };
@@ -1,53 +1,53 @@
1
- import { ref as o, watch as c, computed as u } from "vue";
2
- import { isEqual as x } from "../../../_utils/is-equal.js";
3
- const m = ({
4
- columns: i,
5
- onFilterChange: f
1
+ import { ref as u, watch as c, computed as x } from "vue";
2
+ const F = ({
3
+ columns: r,
4
+ onFilterChange: n
6
5
  }) => {
7
- const r = o(s(i.value));
8
- c(i, (a) => {
9
- const t = s(a);
10
- x(t, r.value) || (r.value = t);
6
+ const l = u(I(r.value));
7
+ c(r, (a, i) => {
8
+ const t = new Set(
9
+ i.filter((e) => e.filterable).map((e) => e.dataIndex)
10
+ ), d = {};
11
+ for (const e of a)
12
+ if (e.dataIndex && e.filterable) {
13
+ const o = t.has(e.dataIndex) ? l.value[e.dataIndex] : e.filterable.defaultFilteredValue;
14
+ o !== void 0 && (d[e.dataIndex] = o);
15
+ }
16
+ l.value = d;
11
17
  });
12
- const d = u(() => {
13
- var t;
18
+ const f = x(() => {
19
+ var i;
14
20
  const a = {};
15
- for (const l of i.value)
16
- if (l.dataIndex) {
17
- const e = ((t = l.filterable) == null ? void 0 : t.filteredValue) ?? r.value[l.dataIndex];
18
- e && (a[l.dataIndex] = e);
21
+ for (const t of r.value)
22
+ if (t.dataIndex) {
23
+ const d = ((i = t.filterable) == null ? void 0 : i.filteredValue) ?? l.value[t.dataIndex];
24
+ d && (a[t.dataIndex] = d);
19
25
  }
20
26
  return a;
21
- });
27
+ }), s = (a, i) => {
28
+ const t = i ? [].concat(i) : [], d = { ...l.value };
29
+ for (const e of r.value)
30
+ if (e.dataIndex && e.filterable && (t.length === 0 || t.includes(e.dataIndex))) {
31
+ const o = a ? e.filterable.defaultFilteredValue ?? [] : [];
32
+ d[e.dataIndex] = o;
33
+ }
34
+ l.value = d;
35
+ for (const e of r.value)
36
+ e.dataIndex && e.filterable && (t.length === 0 || t.includes(e.dataIndex)) && n(e.dataIndex, d[e.dataIndex]);
37
+ };
22
38
  return {
23
- _filters: r,
24
- computedFilters: d,
25
- resetFilters: (a) => {
26
- const t = a ? [].concat(a) : [], l = {};
27
- for (const e of i.value)
28
- if (e.dataIndex && e.filterable && (t.length === 0 || t.includes(e.dataIndex))) {
29
- const n = e.filterable.defaultFilteredValue ?? [];
30
- l[e.dataIndex] = n, f(e.dataIndex, n);
31
- }
32
- r.value = l;
33
- },
34
- clearFilters: (a) => {
35
- const t = a ? [].concat(a) : [], l = {};
36
- for (const e of i.value)
37
- if (e.dataIndex && e.filterable && (t.length === 0 || t.includes(e.dataIndex))) {
38
- const n = [];
39
- l[e.dataIndex] = n, f(e.dataIndex, n);
40
- }
41
- r.value = l;
42
- }
39
+ _filters: l,
40
+ computedFilters: f,
41
+ resetFilters: (a) => s(!0, a),
42
+ clearFilters: (a) => s(!1, a)
43
43
  };
44
- }, s = (i) => {
45
- var r;
46
- const f = {};
47
- for (const d of i)
48
- d.dataIndex && ((r = d.filterable) != null && r.defaultFilteredValue) && (f[d.dataIndex] = d.filterable.defaultFilteredValue);
49
- return f;
44
+ }, I = (r) => {
45
+ var l;
46
+ const n = {};
47
+ for (const f of r)
48
+ f.dataIndex && ((l = f.filterable) != null && l.defaultFilteredValue) && (n[f.dataIndex] = f.filterable.defaultFilteredValue);
49
+ return n;
50
50
  };
51
51
  export {
52
- m as useFilter
52
+ F as useFilter
53
53
  };
@@ -0,0 +1,69 @@
1
+ import { ref as E, watch as N, nextTick as p } from "vue";
2
+ const D = ({
3
+ enabled: b,
4
+ rows: x,
5
+ root: C,
6
+ scrollToRow: I,
7
+ mountedKeys: o
8
+ }) => {
9
+ const i = E();
10
+ N(x, (a) => {
11
+ i.value && !a.some((r) => {
12
+ var e;
13
+ return r.record.key === ((e = i.value) == null ? void 0 : e.key) && !r.detail;
14
+ }) && (i.value = void 0);
15
+ });
16
+ const y = (a) => {
17
+ var e;
18
+ const r = Array.from(
19
+ ((e = C.value) == null ? void 0 : e.querySelectorAll("[data-x-table-row]")) ?? []
20
+ ).find((t) => t.dataset.xTableRow === String(a));
21
+ return Array.from((r == null ? void 0 : r.children) ?? []).filter(
22
+ (t) => t instanceof HTMLElement && t.hasAttribute("data-x-table-cell-index")
23
+ );
24
+ };
25
+ return { getCellProps: (a, r, e) => {
26
+ var n, u;
27
+ if (!b.value) return {};
28
+ const t = i.value && (!(o != null && o.value) || o.value.includes(i.value.key)) ? i.value : {
29
+ key: ((n = o == null ? void 0 : o.value) == null ? void 0 : n[0]) ?? ((u = x.value.find((c) => !c.detail)) == null ? void 0 : u.record.key),
30
+ column: e
31
+ };
32
+ return {
33
+ "data-x-table-cell-index": r,
34
+ tabindex: t.key === a && t.column === r ? 0 : -1,
35
+ onFocus: (c) => {
36
+ c.target === c.currentTarget && (i.value = { key: a, column: r });
37
+ }
38
+ };
39
+ }, handleCellKeydown: async (a, r, e) => {
40
+ var w, A;
41
+ if (!b.value || e.target !== e.currentTarget || e.altKey || e.metaKey || e.shiftKey || !["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "Home", "End"].includes(e.key))
42
+ return;
43
+ e.preventDefault();
44
+ const t = x.value.filter((l) => !l.detail);
45
+ let n = t.findIndex((l) => l.record.key === a);
46
+ if (n < 0) return;
47
+ const u = y(a), c = u.findIndex((l) => Number(l.dataset.xTableCellIndex) === r), s = e.key === "ArrowDown" || e.key === "ArrowRight" || e.key === "End";
48
+ let f = r;
49
+ for (e.key === "ArrowLeft" || e.key === "ArrowRight" ? f = Number(
50
+ ((w = u[c + (s ? 1 : -1)]) == null ? void 0 : w.dataset.xTableCellIndex) ?? r
51
+ ) : e.key === "Home" || e.key === "End" ? (f = s ? Number.MAX_SAFE_INTEGER : 0, e.ctrlKey && (n = s ? t.length - 1 : 0)) : n += s ? 1 : -1; t[n]; ) {
52
+ const l = t[n], T = x.value.indexOf(l);
53
+ y(l.record.key).length || (I(T), await p());
54
+ const k = y(l.record.key), d = f === Number.MAX_SAFE_INTEGER ? k.at(-1) : e.key === "Home" ? k[0] : k.find((g) => {
55
+ const h = Number(g.dataset.xTableCellIndex);
56
+ return h <= f && h + Number(g.getAttribute("colspan") ?? 1) > f;
57
+ });
58
+ if (d) {
59
+ i.value = { key: l.record.key, column: Number(d.dataset.xTableCellIndex) }, d.focus(), (A = d.scrollIntoView) == null || A.call(d, { block: "nearest", inline: "nearest" });
60
+ return;
61
+ }
62
+ if (e.key !== "ArrowUp" && e.key !== "ArrowDown") return;
63
+ n += s ? 1 : -1;
64
+ }
65
+ } };
66
+ };
67
+ export {
68
+ D as useKeyboardNavigation
69
+ };
@@ -1,54 +1,58 @@
1
- import { computed as v, ref as f } from "vue";
2
- import { getLeafKeys as R } from "../utils.js";
3
- import { union as n } from "../../../_utils/array.js";
1
+ import { computed as d, ref as S } from "vue";
2
+ import { getLeafKeys as h } from "../utils.js";
3
+ import { union as o } from "../../../_utils/array.js";
4
4
  const j = ({
5
- selectedKeys: p,
6
- defaultSelectedKeys: w,
7
- rowSelection: u,
8
- currentAllRowKeys: h,
5
+ selectedKeys: f,
6
+ defaultSelectedKeys: p,
7
+ rowSelection: v,
8
+ currentAllRowKeys: w,
9
9
  currentAllEnabledRowKeys: y,
10
10
  emit: s
11
11
  }) => {
12
12
  var K;
13
- const o = v(() => {
13
+ const u = d(() => {
14
14
  var e;
15
- return ((e = u.value) == null ? void 0 : e.type) === "radio";
16
- }), a = f(
17
- w.value ?? ((K = u.value) == null ? void 0 : K.defaultSelectedRowKeys) ?? []
18
- ), c = v(
15
+ return ((e = v.value) == null ? void 0 : e.type) === "radio";
16
+ }), n = S(
17
+ p.value ?? ((K = v.value) == null ? void 0 : K.defaultSelectedRowKeys) ?? []
18
+ ), a = d(
19
19
  () => {
20
20
  var e;
21
- return p.value ?? ((e = u.value) == null ? void 0 : e.selectedRowKeys) ?? a.value;
21
+ return f.value ?? ((e = v.value) == null ? void 0 : e.selectedRowKeys) ?? n.value;
22
22
  }
23
- ), S = v(
24
- () => c.value.filter((e) => h.value.includes(e))
23
+ ), r = d(
24
+ () => a.value.filter((e) => w.value.includes(e))
25
25
  );
26
26
  return {
27
- isRadio: o,
28
- selectedRowKeys: c,
29
- currentSelectedRowKeys: S,
27
+ isRadio: u,
28
+ selectedRowKeys: a,
29
+ currentSelectedRowKeys: r,
30
30
  handleSelectAll: (e) => {
31
- const l = n(c.value, y.value, !e);
32
- a.value = l, s("selectAll", e), s("selectionChange", l), s("update:selectedKeys", l);
31
+ if (u.value) return;
32
+ const l = o(a.value, y.value, !e);
33
+ n.value = l, s("selectAll", e), s("selectionChange", l), s("update:selectedKeys", l);
33
34
  },
34
35
  handleSelect: (e, l) => {
35
- const t = o.value ? [l.key] : n(c.value, [l.key], !e);
36
- a.value = t, s("select", t, l.key, l.raw), s("selectionChange", t), s("update:selectedKeys", t);
36
+ if (l.disabled) return;
37
+ const t = u.value ? e ? [l.key] : a.value.filter((c) => c !== l.key) : o(a.value, [l.key], !e);
38
+ n.value = t, s("select", t, l.key, l.raw), s("selectionChange", t), s("update:selectedKeys", t);
37
39
  },
38
40
  handleSelectAllLeafs: (e, l) => {
39
- const t = n(c.value, R(e), !l);
40
- a.value = t, s("select", t, e.key, e.raw), s("selectionChange", t), s("update:selectedKeys", t);
41
+ if (e.disabled) return;
42
+ const t = o(a.value, h(e), !l);
43
+ n.value = t, s("select", t, e.key, e.raw), s("selectionChange", t), s("update:selectedKeys", t);
41
44
  },
42
45
  select: (e, l = !0) => {
43
- const t = [].concat(e), d = o.value ? t : n(c.value, t, !l);
44
- a.value = d, s("selectionChange", d), s("update:selectedKeys", d);
46
+ const t = [].concat(e), c = u.value ? l ? t.slice(0, 1) : a.value.filter((i) => !t.includes(i)) : o(a.value, t, !l);
47
+ n.value = c, s("selectionChange", c), s("update:selectedKeys", c);
45
48
  },
46
49
  selectAll: (e = !0) => {
47
- const l = n(c.value, y.value, !e);
48
- a.value = l, s("selectionChange", l), s("update:selectedKeys", l);
50
+ if (u.value) return;
51
+ const l = o(a.value, y.value, !e);
52
+ n.value = l, s("selectionChange", l), s("update:selectedKeys", l);
49
53
  },
50
54
  clearSelected: () => {
51
- a.value = [], s("selectionChange", []), s("update:selectedKeys", []);
55
+ n.value = [], s("selectionChange", []), s("update:selectedKeys", []);
52
56
  }
53
57
  };
54
58
  };
@@ -1,53 +1,101 @@
1
- import { ref as f, watch as l, computed as n } from "vue";
2
- import { isString as u } from "../../../_utils/is.js";
3
- import { isEqual as c } from "../../../_utils/is-equal.js";
4
- const m = ({
5
- columns: o,
6
- onSorterChange: a
1
+ import { ref as S, watch as h, computed as p } from "vue";
2
+ import { isString as O } from "../../../_utils/is.js";
3
+ const F = ({
4
+ columns: d,
5
+ onSorterChange: f
7
6
  }) => {
8
- const t = f(i(o.value));
9
- l(o, (r) => {
10
- const e = i(r);
11
- c(e, t.value) || (t.value = e);
7
+ const r = S(x(d.value)), e = S(u(d.value));
8
+ e.value.length && (r.value = void 0), h(d, (a, l) => {
9
+ if (e.value = e.value.filter(
10
+ (i) => a.some((t) => {
11
+ var o;
12
+ return t.dataIndex === i.field && ((o = t.sortable) == null ? void 0 : o.sortPriority) !== void 0;
13
+ })
14
+ ), r.value && !a.some((i) => {
15
+ var t;
16
+ return i.dataIndex === ((t = r.value) == null ? void 0 : t.field) && i.sortable;
17
+ }) && (r.value = void 0), !r.value && !e.value.length) {
18
+ const i = new Set(
19
+ l.filter((o) => o.sortable).map((o) => o.dataIndex)
20
+ ), t = a.filter((o) => !i.has(o.dataIndex));
21
+ e.value = u(t), e.value.length || (r.value = x(t));
22
+ }
12
23
  });
13
- const s = n(() => {
14
- var r;
15
- for (const e of o.value)
16
- if (e.dataIndex && e.sortable) {
17
- const d = u(e.sortable.sortOrder) ? e.sortable.sortOrder : ((r = t.value) == null ? void 0 : r.field) === e.dataIndex ? t.value.direction : "";
18
- if (d)
19
- return {
20
- field: e.dataIndex,
21
- direction: d
24
+ const s = p(() => {
25
+ var l, i;
26
+ const a = [];
27
+ for (const t of d.value)
28
+ if (t.dataIndex && t.sortable) {
29
+ const o = O(t.sortable.sortOrder) ? t.sortable.sortOrder : ((l = r.value) == null ? void 0 : l.field) === t.dataIndex ? r.value.direction : ((i = e.value.find((v) => v.field === t.dataIndex)) == null ? void 0 : i.direction) ?? "";
30
+ if (o) {
31
+ const v = {
32
+ field: t.dataIndex,
33
+ direction: o
22
34
  };
35
+ if (t.sortable.sortPriority === void 0) return [v];
36
+ a.push(v);
37
+ }
23
38
  }
24
- });
39
+ return a.sort((t, o) => {
40
+ const v = (n) => {
41
+ var I, b;
42
+ return ((b = (I = d.value.find((y) => y.dataIndex === n)) == null ? void 0 : I.sortable) == null ? void 0 : b.sortPriority) ?? 0;
43
+ };
44
+ return v(o.field) - v(t.field);
45
+ });
46
+ }), c = p(() => s.value[0]);
25
47
  return {
26
- _sorter: t,
27
- computedSorter: s,
48
+ _sorter: r,
49
+ computedSorter: c,
50
+ computedSorters: s,
51
+ setSorter: (a, l) => {
52
+ var t;
53
+ const i = d.value.find((o) => o.dataIndex === a);
54
+ ((t = i == null ? void 0 : i.sortable) == null ? void 0 : t.sortPriority) !== void 0 ? (r.value = void 0, e.value = s.value.filter(
55
+ (o) => o.field !== a && d.value.some(
56
+ (v) => {
57
+ var n;
58
+ return v.dataIndex === o.field && ((n = v.sortable) == null ? void 0 : n.sortPriority) !== void 0;
59
+ }
60
+ )
61
+ ), l && e.value.push({ field: a, direction: l })) : (e.value = [], r.value = l ? { field: a, direction: l } : void 0);
62
+ },
28
63
  resetSorters: () => {
29
- let r;
30
- for (const e of o.value)
31
- e.dataIndex && e.sortable && (!r && e.sortable.defaultSortOrder && (r = {
32
- field: e.dataIndex,
33
- direction: e.sortable.defaultSortOrder
34
- }), a(e.dataIndex, e.sortable.defaultSortOrder ?? ""));
35
- t.value = r;
64
+ var a;
65
+ e.value = u(d.value), r.value = e.value.length ? void 0 : x(d.value);
66
+ for (const l of d.value)
67
+ l.dataIndex && l.sortable && f(
68
+ l.dataIndex,
69
+ ((a = s.value.find((i) => i.field === l.dataIndex)) == null ? void 0 : a.direction) ?? ""
70
+ );
36
71
  },
37
72
  clearSorters: () => {
38
- for (const r of o.value)
39
- r.dataIndex && r.sortable && a(r.dataIndex, "");
73
+ r.value = void 0, e.value = [];
74
+ for (const a of d.value)
75
+ a.dataIndex && a.sortable && f(a.dataIndex, "");
40
76
  }
41
77
  };
42
- }, i = (o) => {
43
- var a;
44
- for (const t of o)
45
- if (t.dataIndex && ((a = t.sortable) != null && a.defaultSortOrder))
78
+ }, u = (d) => {
79
+ var r;
80
+ const f = d.find((e) => {
81
+ var s;
82
+ return e.dataIndex && ((s = e.sortable) == null ? void 0 : s.defaultSortOrder);
83
+ });
84
+ return ((r = f == null ? void 0 : f.sortable) == null ? void 0 : r.sortPriority) === void 0 ? [] : d.flatMap(
85
+ (e) => {
86
+ var s;
87
+ return e.dataIndex && ((s = e.sortable) == null ? void 0 : s.sortPriority) !== void 0 && e.sortable.defaultSortOrder ? [{ field: e.dataIndex, direction: e.sortable.defaultSortOrder }] : [];
88
+ }
89
+ );
90
+ }, x = (d) => {
91
+ var f;
92
+ for (const r of d)
93
+ if (r.dataIndex && ((f = r.sortable) != null && f.defaultSortOrder))
46
94
  return {
47
- field: t.dataIndex,
48
- direction: t.sortable.defaultSortOrder
95
+ field: r.dataIndex,
96
+ direction: r.sortable.defaultSortOrder
49
97
  };
50
98
  };
51
99
  export {
52
- m as useSorter
100
+ F as useSorter
53
101
  };