x-next 1.11.0 → 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.
- package/AI_CODING.md +18 -1
- package/AI_USAGE/catalog.md +2 -2
- package/AI_USAGE/components/alert.md +2 -2
- package/AI_USAGE/components/bar-chart.md +6 -4
- package/AI_USAGE/components/button.md +3 -3
- package/AI_USAGE/components/checkbox.md +2 -2
- package/AI_USAGE/components/color-picker.md +2 -2
- package/AI_USAGE/components/config-provider.md +2 -2
- package/AI_USAGE/components/date-picker.md +2 -2
- package/AI_USAGE/components/dialog.md +2 -2
- package/AI_USAGE/components/dropdown.md +2 -2
- package/AI_USAGE/components/empty.md +2 -2
- package/AI_USAGE/components/input.md +3 -3
- package/AI_USAGE/components/line-chart.md +6 -4
- package/AI_USAGE/components/message-box.md +2 -2
- package/AI_USAGE/components/message.md +3 -3
- package/AI_USAGE/components/notification.md +4 -2
- package/AI_USAGE/components/pagination.md +2 -2
- package/AI_USAGE/components/pie-chart.md +2 -2
- package/AI_USAGE/components/popconfirm.md +2 -2
- package/AI_USAGE/components/popover.md +3 -3
- package/AI_USAGE/components/progress.md +4 -3
- package/AI_USAGE/components/radio.md +2 -2
- package/AI_USAGE/components/rate.md +2 -2
- package/AI_USAGE/components/select.md +3 -3
- package/AI_USAGE/components/slider.md +2 -2
- package/AI_USAGE/components/steps.md +2 -2
- package/AI_USAGE/components/switch.md +3 -3
- package/AI_USAGE/components/tabs.md +2 -2
- package/AI_USAGE/components/textarea.md +2 -2
- package/AI_USAGE/components/time-picker.md +3 -3
- package/AI_USAGE/components/upload.md +4 -4
- package/AI_USAGE/core.md +3 -3
- package/AI_USAGE/index.md +2 -2
- package/AI_USAGE/recipes/form-on-demand.md +11 -8
- package/AI_USAGE.md +36 -43
- package/CHANGELOG.md +34 -0
- package/dist/components/network/Network.vue.d.ts +1 -1
- package/dist/components/network/index.d.ts +3 -3
- package/dist/components/table/Table.d.ts +11 -0
- package/dist/components/table/context.d.ts +5 -0
- package/dist/components/table/dom-listeners.d.ts +23 -0
- package/dist/components/table/hooks/use-column-resize.d.ts +2 -1
- package/dist/components/table/hooks/use-drag.d.ts +6 -3
- package/dist/components/table/hooks/use-keyboard-navigation.d.ts +27 -0
- package/dist/components/table/hooks/use-sorter.d.ts +3 -1
- package/dist/components/table/index.d.ts +15 -0
- package/dist/components/table/interface.d.ts +9 -2
- package/dist/components/table/locale.d.ts +8 -7
- package/dist/components/table/table-operation-td.d.ts +34 -0
- package/dist/components/table/table-td.d.ts +36 -2
- package/dist/components/table/table-th.d.ts +34 -0
- package/dist/components/table/table-tr.d.ts +34 -0
- package/dist/components/trend-chart/components/TrendChart.d.ts +1 -1
- package/dist/components/trend-chart/index.d.ts +3 -3
- package/dist/components/upload/Upload.d.ts +1 -1
- package/dist/components/upload/index.d.ts +3 -3
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- package/dist/es/_container/resize-observer-v2.js +1 -1
- package/dist/es/_container/resize-observer.js +1 -1
- package/dist/es/_hooks/use-resize-observer.js +1 -1
- package/dist/es/_virtual/advancedFormat.js +1 -1
- package/dist/es/_virtual/customParseFormat.js +1 -1
- package/dist/es/_virtual/dayjs.min.js +1 -1
- package/dist/es/_virtual/isBetween.js +1 -1
- package/dist/es/_virtual/quarterOfYear.js +1 -1
- package/dist/es/_virtual/weekOfYear.js +1 -1
- package/dist/es/_virtual/weekYear.js +1 -1
- package/dist/es/_virtual/zh-cn.js +1 -1
- package/dist/es/components/draggable/useDraggable.js +1 -1
- package/dist/es/components/form/Form.vue2.js +1 -1
- package/dist/es/components/form/FormItem.vue2.js +1 -1
- package/dist/es/components/form-input-number/InputNumber.js +1 -1
- package/dist/es/components/form-slider/Slider.vue2.js +1 -1
- package/dist/es/components/form-slider/slider-ticks.vue2.js +1 -1
- package/dist/es/components/form-slider/utils.js +1 -1
- package/dist/es/components/menu/MenuItem.js +1 -1
- package/dist/es/components/menu/overflow-wrap.js +1 -1
- package/dist/es/components/progress/circle.vue2.js +1 -1
- package/dist/es/components/progress/line.vue2.js +1 -1
- package/dist/es/components/progress/steps.vue2.js +1 -1
- package/dist/es/components/rate/Rate.js +1 -1
- package/dist/es/components/table/Table.js +947 -713
- package/dist/es/components/table/dom-listeners.js +23 -0
- package/dist/es/components/table/hooks/use-column-resize.js +27 -18
- package/dist/es/components/table/hooks/use-column-sorter.js +22 -29
- package/dist/es/components/table/hooks/use-drag.js +23 -20
- package/dist/es/components/table/hooks/use-filter.js +43 -43
- package/dist/es/components/table/hooks/use-keyboard-navigation.js +69 -0
- package/dist/es/components/table/hooks/use-row-selection.js +33 -29
- package/dist/es/components/table/hooks/use-sorter.js +86 -38
- package/dist/es/components/table/hooks/use-span.js +28 -35
- package/dist/es/components/table/locale.js +27 -10
- package/dist/es/components/table/table-col-group.vue2.js +9 -9
- package/dist/es/components/table/table-operation-td.js +72 -51
- package/dist/es/components/table/table-operation-th.js +41 -34
- package/dist/es/components/table/table-td.js +100 -77
- package/dist/es/components/table/table-th.js +221 -188
- package/dist/es/components/table/table-tr.js +11 -8
- package/dist/es/components/table/utils.js +104 -94
- package/dist/es/components/virtual-list-v2/hooks/use-size.js +47 -41
- package/dist/es/components/virtual-list-v2/virtual-list-item.js +29 -16
- package/dist/es/locale/en-US.js +7 -1
- package/dist/es/locale/index.js +3 -3
- package/dist/es/locale/zh-CN.js +7 -1
- package/dist/es/style.css +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.umd.js +3 -3
- package/dist/locale/interface.d.ts +9 -0
- package/dist/style/space.css +1 -1
- package/dist/style/table.css +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
|
|
2
|
-
import { off as
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
},
|
|
7
|
-
|
|
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
|
-
|
|
10
|
-
const m = (
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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:
|
|
20
|
-
columnWidth:
|
|
27
|
+
resizingColumn: u,
|
|
28
|
+
columnWidth: s,
|
|
21
29
|
handleThMouseDown: a,
|
|
22
|
-
handleThMouseUp:
|
|
30
|
+
handleThMouseUp: n,
|
|
31
|
+
handleThKeyDown: p
|
|
23
32
|
};
|
|
24
33
|
};
|
|
25
34
|
export {
|
|
26
|
-
|
|
35
|
+
y as useColumnResize
|
|
27
36
|
};
|
|
@@ -1,37 +1,30 @@
|
|
|
1
|
-
import { computed as
|
|
2
|
-
const
|
|
3
|
-
column:
|
|
4
|
-
tableCtx:
|
|
1
|
+
import { computed as o } from "vue";
|
|
2
|
+
const S = ({
|
|
3
|
+
column: n,
|
|
4
|
+
tableCtx: t
|
|
5
5
|
}) => {
|
|
6
|
-
const
|
|
7
|
-
var e;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
), u =
|
|
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:
|
|
17
|
+
sortOrder: d,
|
|
20
18
|
hasSorter: u,
|
|
21
|
-
hasAscendBtn:
|
|
22
|
-
hasDescendBtn:
|
|
23
|
-
nextSortOrder:
|
|
24
|
-
handleClickSorter: (
|
|
25
|
-
var
|
|
26
|
-
|
|
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
|
-
|
|
29
|
+
S as useColumnSorter
|
|
37
30
|
};
|
|
@@ -1,39 +1,42 @@
|
|
|
1
|
-
import { computed as
|
|
2
|
-
const T = (
|
|
3
|
-
const
|
|
4
|
-
if (
|
|
5
|
-
return
|
|
6
|
-
}), t =
|
|
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
|
-
}),
|
|
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
|
-
|
|
24
|
+
beginDrag: d,
|
|
25
|
+
clearDragState: r,
|
|
26
|
+
dragType: f,
|
|
17
27
|
dragState: t,
|
|
18
|
-
handleDragStart:
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
|
|
33
|
-
((r = a.dataTransfer) == null ? void 0 : r.dropEffect) === "none" && d();
|
|
36
|
+
r();
|
|
34
37
|
},
|
|
35
38
|
handleDrop: (a) => {
|
|
36
|
-
|
|
39
|
+
r(), a.preventDefault();
|
|
37
40
|
}
|
|
38
41
|
};
|
|
39
42
|
};
|
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
|
8
|
-
c(
|
|
9
|
-
const t =
|
|
10
|
-
|
|
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
|
|
13
|
-
var
|
|
18
|
+
const f = x(() => {
|
|
19
|
+
var i;
|
|
14
20
|
const a = {};
|
|
15
|
-
for (const
|
|
16
|
-
if (
|
|
17
|
-
const
|
|
18
|
-
|
|
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:
|
|
24
|
-
computedFilters:
|
|
25
|
-
resetFilters: (a) =>
|
|
26
|
-
|
|
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
|
-
},
|
|
45
|
-
var
|
|
46
|
-
const
|
|
47
|
-
for (const
|
|
48
|
-
|
|
49
|
-
return
|
|
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
|
-
|
|
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
|
|
2
|
-
import { getLeafKeys as
|
|
3
|
-
import { union as
|
|
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:
|
|
6
|
-
defaultSelectedKeys:
|
|
7
|
-
rowSelection:
|
|
8
|
-
currentAllRowKeys:
|
|
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
|
|
13
|
+
const u = d(() => {
|
|
14
14
|
var e;
|
|
15
|
-
return ((e =
|
|
16
|
-
}),
|
|
17
|
-
|
|
18
|
-
),
|
|
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
|
|
21
|
+
return f.value ?? ((e = v.value) == null ? void 0 : e.selectedRowKeys) ?? n.value;
|
|
22
22
|
}
|
|
23
|
-
),
|
|
24
|
-
() =>
|
|
23
|
+
), r = d(
|
|
24
|
+
() => a.value.filter((e) => w.value.includes(e))
|
|
25
25
|
);
|
|
26
26
|
return {
|
|
27
|
-
isRadio:
|
|
28
|
-
selectedRowKeys:
|
|
29
|
-
currentSelectedRowKeys:
|
|
27
|
+
isRadio: u,
|
|
28
|
+
selectedRowKeys: a,
|
|
29
|
+
currentSelectedRowKeys: r,
|
|
30
30
|
handleSelectAll: (e) => {
|
|
31
|
-
|
|
32
|
-
|
|
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
|
-
|
|
36
|
-
|
|
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
|
-
|
|
40
|
-
|
|
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),
|
|
44
|
-
|
|
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
|
-
|
|
48
|
-
|
|
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
|
-
|
|
55
|
+
n.value = [], s("selectionChange", []), s("update:selectedKeys", []);
|
|
52
56
|
}
|
|
53
57
|
};
|
|
54
58
|
};
|
|
@@ -1,53 +1,101 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { isString as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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 =
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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:
|
|
27
|
-
computedSorter:
|
|
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
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
|
|
39
|
-
|
|
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
|
-
},
|
|
43
|
-
var
|
|
44
|
-
|
|
45
|
-
|
|
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:
|
|
48
|
-
direction:
|
|
95
|
+
field: r.dataIndex,
|
|
96
|
+
direction: r.sortable.defaultSortOrder
|
|
49
97
|
};
|
|
50
98
|
};
|
|
51
99
|
export {
|
|
52
|
-
|
|
100
|
+
F as useSorter
|
|
53
101
|
};
|