@vtable-guild/vtable-guild 2.9.0-alpha.0 → 2.9.0-alpha.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.
- package/css/presets/antdv.css +6 -0
- package/css/presets/element-plus.css +6 -0
- package/css/style.css +62 -0
- package/css/tailwind3-utilities.css +50 -0
- package/css/tailwind3.css +12 -0
- package/css/tailwind4.css +12 -0
- package/dist/core/src/utils/types.d.ts +5 -0
- package/dist/core/src/utils/types.d.ts.map +1 -1
- package/dist/css/presets/antdv.css +6 -0
- package/dist/css/presets/element-plus.css +6 -0
- package/dist/css/style.css +62 -0
- package/dist/css/tailwind3-utilities.css +50 -0
- package/dist/css/tailwind3.css +12 -0
- package/dist/css/tailwind4.css +12 -0
- package/dist/index.full.mjs +5477 -4867
- package/dist/index.mjs +53 -47
- package/dist/table/src/components/ExpandIcon.d.ts +18 -0
- package/dist/table/src/components/ExpandIcon.d.ts.map +1 -1
- package/dist/table/src/components/ExpandIcon.mjs +47 -17
- package/dist/table/src/components/FilterDropdown.d.ts +1 -1
- package/dist/table/src/components/Table.d.ts +39 -1
- package/dist/table/src/components/Table.d.ts.map +1 -1
- package/dist/table/src/components/Table.mjs +729 -638
- package/dist/table/src/components/TableBody.d.ts.map +1 -1
- package/dist/table/src/components/TableBody.mjs +8 -5
- package/dist/table/src/components/TableCell.d.ts.map +1 -1
- package/dist/table/src/components/TableCell.mjs +74 -66
- package/dist/table/src/components/TableInstance.test.d.ts +2 -0
- package/dist/table/src/components/TableInstance.test.d.ts.map +1 -0
- package/dist/table/src/components/TableLazyTree.test.d.ts +2 -0
- package/dist/table/src/components/TableLazyTree.test.d.ts.map +1 -0
- package/dist/table/src/components/VTable.vue.d.ts +5 -1
- package/dist/table/src/components/VTable.vue.d.ts.map +1 -1
- package/dist/table/src/components/VTable.vue.mjs +45 -33
- package/dist/table/src/components/VirtualTableBody.d.ts.map +1 -1
- package/dist/table/src/components/VirtualTableBody.mjs +128 -115
- package/dist/table/src/composables/useLazyTreeData.d.ts +19 -0
- package/dist/table/src/composables/useLazyTreeData.d.ts.map +1 -0
- package/dist/table/src/composables/useLazyTreeData.mjs +123 -0
- package/dist/table/src/composables/useLazyTreeData.test.d.ts +2 -0
- package/dist/table/src/composables/useLazyTreeData.test.d.ts.map +1 -0
- package/dist/table/src/composables/useTableEdit.d.ts +4 -0
- package/dist/table/src/composables/useTableEdit.d.ts.map +1 -0
- package/dist/table/src/composables/useTableEdit.mjs +183 -0
- package/dist/table/src/composables/useTableEdit.test.d.ts +2 -0
- package/dist/table/src/composables/useTableEdit.test.d.ts.map +1 -0
- package/dist/table/src/composables/useTableQuery.d.ts +4 -0
- package/dist/table/src/composables/useTableQuery.d.ts.map +1 -0
- package/dist/table/src/composables/useTableQuery.mjs +54 -0
- package/dist/table/src/composables/useTableQuery.test.d.ts +2 -0
- package/dist/table/src/composables/useTableQuery.test.d.ts.map +1 -0
- package/dist/table/src/composables/useTableRequest.d.ts.map +1 -1
- package/dist/table/src/composables/useTableRequest.mjs +70 -71
- package/dist/table/src/composables/useTreeData.d.ts +2 -0
- package/dist/table/src/composables/useTreeData.d.ts.map +1 -1
- package/dist/table/src/composables/useTreeData.mjs +46 -51
- package/dist/table/src/context.d.ts +7 -0
- package/dist/table/src/context.d.ts.map +1 -1
- package/dist/table/src/index.d.ts +17 -1
- package/dist/table/src/index.d.ts.map +1 -1
- package/dist/table/src/renderers.d.ts +5 -0
- package/dist/table/src/renderers.d.ts.map +1 -0
- package/dist/table/src/renderers.mjs +52 -0
- package/dist/table/src/renderers.test.d.ts +2 -0
- package/dist/table/src/renderers.test.d.ts.map +1 -0
- package/dist/table/src/types/column.d.ts +5 -1
- package/dist/table/src/types/column.d.ts.map +1 -1
- package/dist/table/src/types/editing.d.ts +53 -0
- package/dist/table/src/types/editing.d.ts.map +1 -0
- package/dist/table/src/types/editing.typecheck.d.ts +11 -0
- package/dist/table/src/types/editing.typecheck.d.ts.map +1 -0
- package/dist/table/src/types/index.d.ts +5 -0
- package/dist/table/src/types/index.d.ts.map +1 -1
- package/dist/table/src/types/instance.d.ts +18 -0
- package/dist/table/src/types/instance.d.ts.map +1 -0
- package/dist/table/src/types/instance.typecheck.d.ts +3 -0
- package/dist/table/src/types/instance.typecheck.d.ts.map +1 -0
- package/dist/table/src/types/query.d.ts +36 -0
- package/dist/table/src/types/query.d.ts.map +1 -0
- package/dist/table/src/types/query.typecheck.d.ts +14 -0
- package/dist/table/src/types/query.typecheck.d.ts.map +1 -0
- package/dist/table/src/types/renderers.d.ts +37 -0
- package/dist/table/src/types/renderers.d.ts.map +1 -0
- package/dist/table/src/types/renderers.typecheck.d.ts +13 -0
- package/dist/table/src/types/renderers.typecheck.d.ts.map +1 -0
- package/dist/table/src/types/request.d.ts +3 -3
- package/dist/table/src/types/request.d.ts.map +1 -1
- package/dist/table/src/types/table.d.ts +8 -0
- package/dist/table/src/types/table.d.ts.map +1 -1
- package/dist/table/src/types/tree.d.ts +5 -0
- package/dist/table/src/types/tree.d.ts.map +1 -0
- package/dist/table/src/utils/cell.d.ts +4 -0
- package/dist/table/src/utils/cell.d.ts.map +1 -1
- package/dist/table/src/utils/cell.mjs +81 -52
- package/dist/table/src/utils/snapshot.d.ts +3 -0
- package/dist/table/src/utils/snapshot.d.ts.map +1 -0
- package/dist/table/src/utils/snapshot.mjs +30 -0
- package/dist/table/src/utils/snapshot.test.d.ts +2 -0
- package/dist/table/src/utils/snapshot.test.d.ts.map +1 -0
- package/dist/theme/src/presets/antdv/table-locale.d.ts +10 -0
- package/dist/theme/src/presets/antdv/table-locale.d.ts.map +1 -1
- package/dist/theme/src/presets/antdv/table-locale.mjs +2 -0
- package/dist/theme/src/presets/antdv/table.d.ts +3 -0
- package/dist/theme/src/presets/antdv/table.d.ts.map +1 -1
- package/dist/theme/src/presets/antdv/table.mjs +3 -0
- package/dist/theme/src/presets/element-plus/table-locale.d.ts +10 -0
- package/dist/theme/src/presets/element-plus/table-locale.d.ts.map +1 -1
- package/dist/theme/src/presets/element-plus/table-locale.mjs +2 -0
- package/dist/theme/src/presets/element-plus/table.d.ts +3 -0
- package/dist/theme/src/presets/element-plus/table.d.ts.map +1 -1
- package/dist/theme/src/presets/element-plus/table.mjs +3 -0
- package/package.json +1 -1
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { shallowRef as x, getCurrentScope as O, onScopeDispose as V, computed as M } from "vue";
|
|
2
|
+
import { snapshot as B } from "../utils/snapshot.mjs";
|
|
3
|
+
function H(u) {
|
|
4
|
+
const r = x(/* @__PURE__ */ new Map()), g = x(/* @__PURE__ */ new Map()), c = x(/* @__PURE__ */ new Map()), s = x(/* @__PURE__ */ new Map()), a = u.clone ?? ((e) => B(e));
|
|
5
|
+
let d = !1;
|
|
6
|
+
function E(e) {
|
|
7
|
+
const t = typeof u.rowKey == "function" ? u.rowKey(e) : e[u.rowKey];
|
|
8
|
+
if (typeof t != "string" && typeof t != "number")
|
|
9
|
+
throw new Error("useTableEdit requires a string or number row key");
|
|
10
|
+
return t;
|
|
11
|
+
}
|
|
12
|
+
function p(e) {
|
|
13
|
+
if (!g.value.has(e)) return;
|
|
14
|
+
const t = new Map(g.value);
|
|
15
|
+
t.delete(e), g.value = t;
|
|
16
|
+
}
|
|
17
|
+
function P(e, t) {
|
|
18
|
+
g.value = new Map(g.value).set(e, t);
|
|
19
|
+
try {
|
|
20
|
+
u.onError?.(t, e);
|
|
21
|
+
} catch {
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function S(e) {
|
|
25
|
+
const t = c.value.get(e);
|
|
26
|
+
if (!t) return;
|
|
27
|
+
t.controller.abort();
|
|
28
|
+
const n = new Map(c.value);
|
|
29
|
+
n.delete(e), c.value = n, t.resolve(void 0);
|
|
30
|
+
}
|
|
31
|
+
function N(e) {
|
|
32
|
+
const t = s.value.get(e);
|
|
33
|
+
if (!t) return;
|
|
34
|
+
t.controller.abort();
|
|
35
|
+
const n = new Map(s.value);
|
|
36
|
+
n.delete(e), s.value = n, t.resolve(!1);
|
|
37
|
+
}
|
|
38
|
+
function K(e) {
|
|
39
|
+
S(e), N(e);
|
|
40
|
+
const t = new Map(r.value);
|
|
41
|
+
t.delete(e), r.value = t, p(e);
|
|
42
|
+
}
|
|
43
|
+
function y(e) {
|
|
44
|
+
const t = s.value.get(e);
|
|
45
|
+
if (t) return t.promise;
|
|
46
|
+
const n = r.value.get(e);
|
|
47
|
+
if (d || !n) return Promise.resolve(!1);
|
|
48
|
+
if (S(e), p(e), !u.onCancel)
|
|
49
|
+
return K(e), Promise.resolve(!0);
|
|
50
|
+
let v;
|
|
51
|
+
const m = new Promise((o) => {
|
|
52
|
+
v = o;
|
|
53
|
+
}), i = { controller: new AbortController(), promise: m, resolve: v };
|
|
54
|
+
s.value = new Map(s.value).set(e, i);
|
|
55
|
+
const f = () => !d && s.value.get(e) === i;
|
|
56
|
+
return (async () => {
|
|
57
|
+
try {
|
|
58
|
+
const o = await u.onCancel(a(n.draft), {
|
|
59
|
+
key: e,
|
|
60
|
+
original: n.original === void 0 ? void 0 : a(n.original),
|
|
61
|
+
isNew: n.isNew,
|
|
62
|
+
signal: i.controller.signal
|
|
63
|
+
});
|
|
64
|
+
if (!f() || o === !1) return;
|
|
65
|
+
i.resolve(!0), K(e);
|
|
66
|
+
} catch (o) {
|
|
67
|
+
if (!f()) return;
|
|
68
|
+
const b = {
|
|
69
|
+
type: "cancel",
|
|
70
|
+
message: o instanceof Error ? o.message : String(o),
|
|
71
|
+
cause: o
|
|
72
|
+
};
|
|
73
|
+
P(e, b);
|
|
74
|
+
} finally {
|
|
75
|
+
if (f()) {
|
|
76
|
+
const o = new Map(s.value);
|
|
77
|
+
o.delete(e), s.value = o;
|
|
78
|
+
}
|
|
79
|
+
i.resolve(!1);
|
|
80
|
+
}
|
|
81
|
+
})(), m;
|
|
82
|
+
}
|
|
83
|
+
function T() {
|
|
84
|
+
return Promise.all([...r.value.keys()].map(y));
|
|
85
|
+
}
|
|
86
|
+
function A(e, t) {
|
|
87
|
+
if (d) return !1;
|
|
88
|
+
const n = E(e);
|
|
89
|
+
return r.value.has(n) || u.mode !== "multiple" && r.value.size > 0 ? !1 : (r.value = new Map(r.value).set(n, {
|
|
90
|
+
draft: a(e),
|
|
91
|
+
original: t ? void 0 : a(e),
|
|
92
|
+
isNew: t
|
|
93
|
+
}), !0);
|
|
94
|
+
}
|
|
95
|
+
function j(e, t) {
|
|
96
|
+
const n = r.value.get(e);
|
|
97
|
+
if (d || !n) return !1;
|
|
98
|
+
const v = typeof t == "function" ? t(a(n.draft)) : { ...a(n.draft), ...t };
|
|
99
|
+
if (E(v) !== e) throw new Error("Editing a row key is unsupported");
|
|
100
|
+
return S(e), N(e), p(e), r.value = new Map(r.value).set(e, { ...n, draft: a(v) }), !0;
|
|
101
|
+
}
|
|
102
|
+
function q(e) {
|
|
103
|
+
const t = c.value.get(e);
|
|
104
|
+
if (t) return t.promise;
|
|
105
|
+
const n = r.value.get(e);
|
|
106
|
+
if (d || !n || s.value.has(e)) return Promise.resolve(void 0);
|
|
107
|
+
p(e);
|
|
108
|
+
let v;
|
|
109
|
+
const m = new Promise((w) => {
|
|
110
|
+
v = w;
|
|
111
|
+
}), i = { controller: new AbortController(), promise: m, resolve: v };
|
|
112
|
+
c.value = new Map(c.value).set(e, i);
|
|
113
|
+
const f = () => !d && c.value.get(e) === i, o = {
|
|
114
|
+
key: e,
|
|
115
|
+
original: n.original === void 0 ? void 0 : a(n.original),
|
|
116
|
+
isNew: n.isNew,
|
|
117
|
+
signal: i.controller.signal
|
|
118
|
+
}, b = (w) => {
|
|
119
|
+
f() && P(e, w);
|
|
120
|
+
};
|
|
121
|
+
return (async () => {
|
|
122
|
+
let w = "validation";
|
|
123
|
+
try {
|
|
124
|
+
const l = a(n.draft), h = await u.validate?.(a(l), o);
|
|
125
|
+
if (!f()) return;
|
|
126
|
+
if (h?.message || Object.keys(h?.fields ?? {}).length > 0) {
|
|
127
|
+
b({
|
|
128
|
+
...h,
|
|
129
|
+
type: "validation",
|
|
130
|
+
message: h?.message ?? "Validation failed"
|
|
131
|
+
});
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
w = "save";
|
|
135
|
+
const C = await u.onSave?.(a(l), o);
|
|
136
|
+
if (!f() || C === !1) return;
|
|
137
|
+
const D = C === !0 ? l : C ?? l;
|
|
138
|
+
if (!n.isNew && E(D) !== e)
|
|
139
|
+
throw new Error("Saving an existing row cannot change its key");
|
|
140
|
+
const z = a(D), R = new Map(r.value);
|
|
141
|
+
R.delete(e), r.value = R, p(e), i.resolve(z);
|
|
142
|
+
} catch (l) {
|
|
143
|
+
b({
|
|
144
|
+
type: w,
|
|
145
|
+
message: l instanceof Error ? l.message : String(l),
|
|
146
|
+
cause: l
|
|
147
|
+
});
|
|
148
|
+
} finally {
|
|
149
|
+
if (f()) {
|
|
150
|
+
const l = new Map(c.value);
|
|
151
|
+
l.delete(e), c.value = l;
|
|
152
|
+
}
|
|
153
|
+
i.resolve(void 0);
|
|
154
|
+
}
|
|
155
|
+
})(), m;
|
|
156
|
+
}
|
|
157
|
+
return O() && V(() => {
|
|
158
|
+
d = !0;
|
|
159
|
+
for (const e of r.value.keys()) K(e);
|
|
160
|
+
}), {
|
|
161
|
+
editableKeys: M(() => [...r.value.keys()]),
|
|
162
|
+
savingKeys: M(() => new Set(c.value.keys())),
|
|
163
|
+
cancellingKeys: M(() => new Set(s.value.keys())),
|
|
164
|
+
errors: M(() => new Map(g.value)),
|
|
165
|
+
newRecords: M(
|
|
166
|
+
() => [...r.value.values()].filter((e) => e.isNew).map((e) => a(e.draft))
|
|
167
|
+
),
|
|
168
|
+
isEditing: (e) => r.value.has(e),
|
|
169
|
+
getDraft: (e) => {
|
|
170
|
+
const t = r.value.get(e);
|
|
171
|
+
return t ? a(t.draft) : void 0;
|
|
172
|
+
},
|
|
173
|
+
start: (e) => A(e, !1),
|
|
174
|
+
add: (e) => A(e, !0),
|
|
175
|
+
setDraft: j,
|
|
176
|
+
save: q,
|
|
177
|
+
cancel: y,
|
|
178
|
+
cancelAll: T
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
export {
|
|
182
|
+
H as useTableEdit
|
|
183
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTableEdit.test.d.ts","sourceRoot":"","sources":["../../../../../table/src/composables/useTableEdit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { UseTableQueryOptions, UseTableQueryReturn } from '../types/query';
|
|
2
|
+
/** Form state and submit protocol; controls and layout remain owned by the host UI library. */
|
|
3
|
+
export declare function useTableQuery<TValues extends object, TParams extends object = TValues>(options: UseTableQueryOptions<TValues, TParams>): UseTableQueryReturn<TValues, TParams>;
|
|
4
|
+
//# sourceMappingURL=useTableQuery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTableQuery.d.ts","sourceRoot":"","sources":["../../../../../table/src/composables/useTableQuery.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAG/E,+FAA+F;AAC/F,wBAAgB,aAAa,CAAC,OAAO,SAAS,MAAM,EAAE,OAAO,SAAS,MAAM,GAAG,OAAO,EACpF,OAAO,EAAE,oBAAoB,CAAC,OAAO,EAAE,OAAO,CAAC,GAC9C,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAsFvC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { ref as y, shallowRef as g, watch as O, getCurrentScope as S, onScopeDispose as j, computed as h } from "vue";
|
|
2
|
+
import { snapshot as e } from "../utils/snapshot.mjs";
|
|
3
|
+
function R(a) {
|
|
4
|
+
const d = e(a.defaultValues), c = y(e(d)), v = g(), p = g(), f = a.collapsed ?? y(a.defaultCollapsed ?? !0), i = y(!1), b = g(null);
|
|
5
|
+
let o = 0, l = !1;
|
|
6
|
+
const k = a.onCollapse ? O(f, (r) => a.onCollapse?.(r), { flush: "sync" }) : void 0;
|
|
7
|
+
function w(r) {
|
|
8
|
+
const s = a.fieldTransforms, t = {};
|
|
9
|
+
for (const [n, m] of Object.entries(r))
|
|
10
|
+
Object.prototype.hasOwnProperty.call(s ?? {}, n) && s?.[n] || (t[n] = m);
|
|
11
|
+
for (const n of Object.keys(s ?? {})) {
|
|
12
|
+
const m = s?.[n];
|
|
13
|
+
m && Object.assign(t, m(r[n], r));
|
|
14
|
+
}
|
|
15
|
+
const u = t;
|
|
16
|
+
return e(a.transform?.(u, r) ?? u);
|
|
17
|
+
}
|
|
18
|
+
async function C(r) {
|
|
19
|
+
if (l) return !1;
|
|
20
|
+
const s = ++o;
|
|
21
|
+
i.value = !0, b.value = null;
|
|
22
|
+
try {
|
|
23
|
+
const t = e(c.value), u = w(t);
|
|
24
|
+
return v.value = e(t), p.value = e(u), await (r ? a.onReset ?? a.onSubmit : a.onSubmit)?.(e(u), e(t)), !l && s === o;
|
|
25
|
+
} catch (t) {
|
|
26
|
+
return !l && s === o && (b.value = t instanceof Error ? t : new Error(String(t))), !1;
|
|
27
|
+
} finally {
|
|
28
|
+
!l && s === o && (i.value = !1);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return S() && j(() => {
|
|
32
|
+
l = !0, o++, i.value = !1, k?.();
|
|
33
|
+
}), {
|
|
34
|
+
draft: c,
|
|
35
|
+
submitted: h(() => v.value && e(v.value)),
|
|
36
|
+
params: h(() => p.value && e(p.value)),
|
|
37
|
+
collapsed: f,
|
|
38
|
+
submitting: h(() => i.value),
|
|
39
|
+
error: b,
|
|
40
|
+
submit: () => C(!1),
|
|
41
|
+
reset() {
|
|
42
|
+
return l ? Promise.resolve(!1) : (c.value = e(d), C(!0));
|
|
43
|
+
},
|
|
44
|
+
resetFields() {
|
|
45
|
+
l || (c.value = e(d));
|
|
46
|
+
},
|
|
47
|
+
toggleCollapsed() {
|
|
48
|
+
f.value = !f.value;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
export {
|
|
53
|
+
R as useTableQuery
|
|
54
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTableQuery.test.d.ts","sourceRoot":"","sources":["../../../../../table/src/composables/useTableQuery.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTableRequest.d.ts","sourceRoot":"","sources":["../../../../../table/src/composables/useTableRequest.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAGV,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"useTableRequest.d.ts","sourceRoot":"","sources":["../../../../../table/src/composables/useTableRequest.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAGV,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,kBAAkB,CAAA;AAsCzB,2FAA2F;AAC3F,wBAAgB,eAAe,CAC7B,OAAO,SAAS,MAAM,EACtB,OAAO,SAAS,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChD,OAAO,EAAE,sBAAsB,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,qBAAqB,CAAC,OAAO,EAAE,OAAO,CAAC,CAyL5F"}
|
|
@@ -1,127 +1,126 @@
|
|
|
1
|
-
import { shallowRef as
|
|
2
|
-
import { positiveInteger as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.entries(e).map(([t, r]) => [t, n(r)])
|
|
6
|
-
) : e;
|
|
7
|
-
}
|
|
8
|
-
function F(e, t) {
|
|
1
|
+
import { shallowRef as w, ref as D, toValue as I, watch as J, getCurrentScope as Q, onScopeDispose as U, computed as S } from "vue";
|
|
2
|
+
import { positiveInteger as M } from "./usePagination.mjs";
|
|
3
|
+
import { snapshot as l } from "../utils/snapshot.mjs";
|
|
4
|
+
function W(e, t, r = /* @__PURE__ */ new WeakMap()) {
|
|
9
5
|
if (Object.is(e, t)) return !0;
|
|
10
6
|
if (e instanceof Date && t instanceof Date) return e.getTime() === t.getTime();
|
|
11
7
|
if (!e || !t || typeof e != "object" || typeof t != "object" || Object.getPrototypeOf(e) !== Object.getPrototypeOf(t) || Object.getPrototypeOf(e) !== Object.prototype && !Array.isArray(e)) return !1;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
if (r.get(e)?.has(t)) return !0;
|
|
9
|
+
const n = r.get(e) ?? /* @__PURE__ */ new WeakSet();
|
|
10
|
+
r.set(e, n), n.add(t);
|
|
11
|
+
const f = Object.entries(e), o = Object.entries(t);
|
|
12
|
+
return f.length === o.length && f.every(
|
|
13
|
+
([c, P]) => Object.prototype.hasOwnProperty.call(t, c) && W(P, Reflect.get(t, c), r)
|
|
15
14
|
);
|
|
16
15
|
}
|
|
17
16
|
function X(e) {
|
|
18
17
|
const t = [];
|
|
19
18
|
for (const r of Array.isArray(e) ? e : [e]) {
|
|
20
19
|
if (!r.order) continue;
|
|
21
|
-
const
|
|
22
|
-
|
|
20
|
+
const n = r.field ?? r.columnKey;
|
|
21
|
+
n != null && t.push([Array.isArray(n) ? n.join(".") : String(n), r.order]);
|
|
23
22
|
}
|
|
24
23
|
return Object.fromEntries(t);
|
|
25
24
|
}
|
|
26
|
-
function
|
|
27
|
-
const t =
|
|
28
|
-
let j = !1, y = 0,
|
|
25
|
+
function $(e) {
|
|
26
|
+
const t = l(e.defaultParams ?? {}), r = w(l(t)), n = w({}), f = w({}), o = D(M(e.initialPagination?.current, 1)), c = D(M(e.initialPagination?.pageSize, 10)), P = D(Math.max(0, e.initialPagination?.total ?? 0)), F = w([]), O = D(!1), g = w(null), B = Object.freeze({ sort: !0, filter: !0, pagination: !0 });
|
|
27
|
+
let j = !1, y = 0, h, z, A, d, C = Promise.resolve();
|
|
29
28
|
function E() {
|
|
30
|
-
y++,
|
|
29
|
+
y++, h !== void 0 && clearTimeout(h), h = void 0, z?.abort(), z = void 0, A?.(), A = void 0, O.value = !1, d = void 0;
|
|
31
30
|
}
|
|
32
|
-
function m(
|
|
31
|
+
function m(i = !1, x = !1) {
|
|
33
32
|
if (j) return Promise.resolve();
|
|
34
33
|
let a;
|
|
35
34
|
try {
|
|
36
|
-
const s =
|
|
35
|
+
const s = l({ ...t, ...r.value, ...I(e.params) });
|
|
37
36
|
a = {
|
|
38
37
|
...e.beforeSearchSubmit?.(s) ?? s,
|
|
39
38
|
current: o.value,
|
|
40
|
-
pageSize:
|
|
39
|
+
pageSize: c.value
|
|
41
40
|
};
|
|
42
41
|
} catch (s) {
|
|
43
|
-
return E(),
|
|
42
|
+
return E(), g.value = s instanceof Error ? s : new Error(String(s)), e.onError?.(g.value), Promise.resolve();
|
|
44
43
|
}
|
|
45
|
-
const
|
|
46
|
-
if (!
|
|
47
|
-
E(),
|
|
48
|
-
const
|
|
49
|
-
return
|
|
44
|
+
const p = l(n.value), b = l(f.value), L = l({ params: a, sort: p, filters: b });
|
|
45
|
+
if (!i && d !== void 0 && W(d, L)) return C;
|
|
46
|
+
E(), d = L;
|
|
47
|
+
const R = y, T = new AbortController();
|
|
48
|
+
return z = T, O.value = !0, g.value = null, C = new Promise((s) => {
|
|
50
49
|
A = s;
|
|
51
|
-
const
|
|
52
|
-
|
|
50
|
+
const N = async () => {
|
|
51
|
+
h = void 0;
|
|
53
52
|
try {
|
|
54
|
-
for (let
|
|
55
|
-
const u = await e.request(a,
|
|
56
|
-
if (j ||
|
|
53
|
+
for (let v = 0; v < 2; v++) {
|
|
54
|
+
const u = await e.request(a, p, b, { signal: T.signal });
|
|
55
|
+
if (j || R !== y || T.signal.aborted) return;
|
|
57
56
|
if (u.success === !1) throw new Error("Table request was unsuccessful");
|
|
58
57
|
if (!Array.isArray(u.data))
|
|
59
58
|
throw new Error("Table request data must be an array");
|
|
60
59
|
if (!Number.isSafeInteger(u.total) || u.total < 0)
|
|
61
60
|
throw new Error("Table request total must be a non-negative safe integer");
|
|
62
|
-
const
|
|
63
|
-
if (
|
|
64
|
-
o.value =
|
|
61
|
+
const q = Math.max(1, Math.ceil(u.total / a.pageSize));
|
|
62
|
+
if (v === 0 && u.total > 0 && a.current > q) {
|
|
63
|
+
o.value = q, a = { ...a, current: q };
|
|
65
64
|
continue;
|
|
66
65
|
}
|
|
67
|
-
const
|
|
68
|
-
if (!Array.isArray(
|
|
69
|
-
o.value = Math.min(a.current,
|
|
66
|
+
const k = e.postData ? e.postData(u.data) : u.data;
|
|
67
|
+
if (!Array.isArray(k)) throw new Error("Table postData must return an array");
|
|
68
|
+
o.value = Math.min(a.current, q), P.value = u.total, F.value = k, d = l({ params: { ...a, current: o.value }, sort: p, filters: b }), e.onLoad?.(k, u);
|
|
70
69
|
break;
|
|
71
70
|
}
|
|
72
|
-
} catch (
|
|
73
|
-
!j &&
|
|
71
|
+
} catch (v) {
|
|
72
|
+
!j && R === y && !T.signal.aborted && (g.value = v instanceof Error ? v : new Error(String(v)), d = void 0, e.onError?.(g.value));
|
|
74
73
|
} finally {
|
|
75
|
-
|
|
74
|
+
R === y && (O.value = !1, z = void 0, A = void 0), s();
|
|
76
75
|
}
|
|
77
|
-
},
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
},
|
|
76
|
+
}, V = x ? 0 : Math.max(0, e.debounceTime ?? 0);
|
|
77
|
+
V > 0 ? h = setTimeout(() => {
|
|
78
|
+
N();
|
|
79
|
+
}, V) : N();
|
|
81
80
|
}), C;
|
|
82
81
|
}
|
|
83
|
-
const
|
|
82
|
+
const G = (i, x, a) => {
|
|
84
83
|
if (a.action === "select") return;
|
|
85
|
-
const
|
|
86
|
-
|
|
84
|
+
const p = M(a.pagination?.pageSize, c.value), b = p !== c.value;
|
|
85
|
+
n.value = X(x), f.value = l(i), o.value = a.action !== "paginate" || b && e.resetOnPageSizeChange !== !1 ? 1 : M(a.pagination?.current, o.value), c.value = p, m();
|
|
87
86
|
};
|
|
88
|
-
let
|
|
89
|
-
const
|
|
87
|
+
let K = l(I(e.params));
|
|
88
|
+
const H = J(
|
|
90
89
|
() => I(e.params),
|
|
91
|
-
(
|
|
92
|
-
|
|
90
|
+
(i) => {
|
|
91
|
+
W(K, i) || (K = l(i), o.value = 1, m());
|
|
93
92
|
},
|
|
94
93
|
{ deep: !0 }
|
|
95
94
|
);
|
|
96
|
-
return
|
|
97
|
-
j = !0,
|
|
95
|
+
return Q() && U(() => {
|
|
96
|
+
j = !0, H(), E();
|
|
98
97
|
}), e.manualRequest || m(), {
|
|
99
|
-
dataSource:
|
|
100
|
-
loading:
|
|
101
|
-
error:
|
|
102
|
-
pagination:
|
|
98
|
+
dataSource: F,
|
|
99
|
+
loading: S(() => O.value),
|
|
100
|
+
error: g,
|
|
101
|
+
pagination: S(() => ({
|
|
103
102
|
...e.pagination,
|
|
104
103
|
current: o.value,
|
|
105
|
-
pageSize:
|
|
106
|
-
total:
|
|
104
|
+
pageSize: c.value,
|
|
105
|
+
total: P.value
|
|
107
106
|
})),
|
|
108
|
-
query:
|
|
109
|
-
sort:
|
|
110
|
-
filters:
|
|
111
|
-
manual:
|
|
112
|
-
onChange:
|
|
113
|
-
reload(
|
|
114
|
-
return
|
|
107
|
+
query: S(() => r.value),
|
|
108
|
+
sort: S(() => n.value),
|
|
109
|
+
filters: S(() => f.value),
|
|
110
|
+
manual: B,
|
|
111
|
+
onChange: G,
|
|
112
|
+
reload(i = !1) {
|
|
113
|
+
return i && (o.value = 1), m(!0, !0);
|
|
115
114
|
},
|
|
116
|
-
submit(
|
|
117
|
-
return r.value =
|
|
115
|
+
submit(i = {}) {
|
|
116
|
+
return r.value = l(i), o.value = 1, m(!0);
|
|
118
117
|
},
|
|
119
|
-
reset() {
|
|
120
|
-
return r.value =
|
|
118
|
+
reset(i = t) {
|
|
119
|
+
return r.value = l(i), n.value = {}, f.value = {}, o.value = 1, m(!0);
|
|
121
120
|
},
|
|
122
121
|
cancel: E
|
|
123
122
|
};
|
|
124
123
|
}
|
|
125
124
|
export {
|
|
126
|
-
|
|
125
|
+
$ as useTableRequest
|
|
127
126
|
};
|
|
@@ -25,6 +25,8 @@ export interface UseTreeDataOptions<TRecord = Record<string, unknown>> {
|
|
|
25
25
|
indentSize?: () => number | undefined;
|
|
26
26
|
/** Row key resolver */
|
|
27
27
|
getRowKey: (record: TRecord, index: number) => Key;
|
|
28
|
+
/** Includes lazy parents whose children have not loaded yet. */
|
|
29
|
+
hasChildren?: (record: TRecord) => boolean;
|
|
28
30
|
/** Default expanded keys (uncontrolled) */
|
|
29
31
|
defaultExpandedRowKeys?: () => Key[] | undefined;
|
|
30
32
|
/** Controlled expanded keys */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTreeData.d.ts","sourceRoot":"","sources":["../../../../../table/src/composables/useTreeData.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAEnC,MAAM,WAAW,UAAU,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC3D,2BAA2B;IAC3B,MAAM,EAAE,OAAO,CAAA;IACf,+BAA+B;IAC/B,KAAK,EAAE,MAAM,CAAA;IACb,6CAA6C;IAC7C,QAAQ,EAAE,OAAO,CAAA;IACjB,sCAAsC;IACtC,WAAW,EAAE,OAAO,CAAA;IACpB,+CAA+C;IAC/C,SAAS,CAAC,EAAE,GAAG,CAAA;CAChB;AAED,MAAM,WAAW,kBAAkB,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACnE,2BAA2B;IAC3B,IAAI,EAAE,MAAM,OAAO,EAAE,CAAA;IACrB,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,MAAM,OAAO,EAAE,CAAA;IAC1B,sEAAsE;IACtE,yBAAyB,CAAC,EAAE,MAAM,OAAO,CAAA;IACzC,sDAAsD;IACtD,kBAAkB,CAAC,EAAE,MAAM,MAAM,GAAG,SAAS,CAAA;I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,WAAW,CAAC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC3F,OAAO,EAAE,kBAAkB,CAAC,OAAO,CAAC,GACnC,iBAAiB,CAAC,OAAO,CAAC,CAgK5B"}
|
|
@@ -1,97 +1,92 @@
|
|
|
1
|
-
import { computed as
|
|
2
|
-
function
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
);
|
|
8
|
-
}), r = k(/* @__PURE__ */ new Set()), E = /* @__PURE__ */ new Set();
|
|
9
|
-
let g = !1;
|
|
10
|
-
const x = s(() => e.expandedRowKeys?.() !== void 0);
|
|
11
|
-
z(
|
|
1
|
+
import { computed as r, ref as z, watch as T } from "vue";
|
|
2
|
+
function O(e) {
|
|
3
|
+
const f = r(() => e.childrenColumnName?.() ?? "children"), C = r(() => e.indentSize?.() ?? 15), x = (a) => e.hasChildren?.(a) ?? (Array.isArray(a[f.value]) && a[f.value].length > 0), o = r(() => e.data().some(x)), s = z(/* @__PURE__ */ new Set()), E = /* @__PURE__ */ new Set();
|
|
4
|
+
let K = !1;
|
|
5
|
+
const v = r(() => e.expandedRowKeys?.() !== void 0);
|
|
6
|
+
T(
|
|
12
7
|
[
|
|
13
8
|
() => e.data(),
|
|
14
9
|
() => e.defaultExpandAllRows?.(),
|
|
15
10
|
() => e.defaultExpandedRowKeys?.()
|
|
16
11
|
],
|
|
17
12
|
() => {
|
|
18
|
-
if (!
|
|
13
|
+
if (!v.value)
|
|
19
14
|
if (e.defaultExpandAllRows?.()) {
|
|
20
15
|
let a = function(n) {
|
|
21
16
|
n.forEach((u) => {
|
|
22
|
-
const
|
|
23
|
-
if (
|
|
24
|
-
const y = e.getRowKey(u,
|
|
25
|
-
(!
|
|
17
|
+
const h = u[w], c = l++;
|
|
18
|
+
if (x(u)) {
|
|
19
|
+
const y = e.getRowKey(u, c);
|
|
20
|
+
(!d || !E.has(y)) && t.add(y), E.add(y), Array.isArray(h) && a(h);
|
|
26
21
|
}
|
|
27
22
|
});
|
|
28
23
|
};
|
|
29
|
-
const
|
|
24
|
+
const d = e.preserveStateOnDataChange?.() === !0, t = d ? new Set(s.value) : /* @__PURE__ */ new Set(), w = f.value;
|
|
30
25
|
let l = 0;
|
|
31
|
-
a(e.data()),
|
|
32
|
-
} else e.defaultExpandedRowKeys?.() && (!e.preserveStateOnDataChange?.() || !
|
|
26
|
+
a(e.data()), s.value = t;
|
|
27
|
+
} else e.defaultExpandedRowKeys?.() && (!e.preserveStateOnDataChange?.() || !K) && (s.value = new Set(e.defaultExpandedRowKeys()), K = !0);
|
|
33
28
|
},
|
|
34
29
|
{ immediate: !0 }
|
|
35
30
|
);
|
|
36
|
-
const i =
|
|
37
|
-
get: () =>
|
|
31
|
+
const i = r({
|
|
32
|
+
get: () => v.value ? new Set(e.expandedRowKeys()) : s.value,
|
|
38
33
|
set: (a) => {
|
|
39
|
-
|
|
34
|
+
s.value = a;
|
|
40
35
|
}
|
|
41
36
|
});
|
|
42
37
|
function A(a) {
|
|
43
38
|
return i.value.has(a);
|
|
44
39
|
}
|
|
45
|
-
function
|
|
46
|
-
const
|
|
47
|
-
if (
|
|
40
|
+
function D(a, d) {
|
|
41
|
+
const t = e.getRowKey(a, d), l = !i.value.has(t);
|
|
42
|
+
if (v.value) {
|
|
48
43
|
e.onExpand?.(l, a);
|
|
49
44
|
const n = new Set(i.value);
|
|
50
|
-
l ? n.add(
|
|
45
|
+
l ? n.add(t) : n.delete(t), e.onExpandedRowsChange?.(Array.from(n));
|
|
51
46
|
} else {
|
|
52
|
-
const n = new Set(
|
|
53
|
-
l ? n.add(
|
|
47
|
+
const n = new Set(s.value);
|
|
48
|
+
l ? n.add(t) : n.delete(t), s.value = n, e.onExpand?.(l, a), e.onExpandedRowsChange?.(Array.from(n));
|
|
54
49
|
}
|
|
55
50
|
}
|
|
56
|
-
const
|
|
51
|
+
const g = r(() => {
|
|
57
52
|
const a = e.pageData?.() ?? e.data();
|
|
58
|
-
if (!
|
|
53
|
+
if (!o.value)
|
|
59
54
|
return a.map((n) => ({
|
|
60
55
|
record: n,
|
|
61
56
|
level: 0,
|
|
62
57
|
expanded: !1,
|
|
63
58
|
hasChildren: !1
|
|
64
59
|
}));
|
|
65
|
-
const
|
|
66
|
-
function l(n, u,
|
|
67
|
-
n.forEach((
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
record:
|
|
60
|
+
const d = f.value, t = [], w = i.value;
|
|
61
|
+
function l(n, u, h) {
|
|
62
|
+
n.forEach((c, y) => {
|
|
63
|
+
const S = c[d], m = x(c), p = e.getRowKey(c, t.length), R = m && w.has(p);
|
|
64
|
+
t.push({
|
|
65
|
+
record: c,
|
|
71
66
|
level: u,
|
|
72
|
-
expanded:
|
|
73
|
-
hasChildren:
|
|
74
|
-
parentKey:
|
|
75
|
-
}),
|
|
67
|
+
expanded: R,
|
|
68
|
+
hasChildren: m,
|
|
69
|
+
parentKey: h
|
|
70
|
+
}), R && S && l(S, u + 1, p);
|
|
76
71
|
});
|
|
77
72
|
}
|
|
78
|
-
return l(a, 0),
|
|
79
|
-
}),
|
|
73
|
+
return l(a, 0), t;
|
|
74
|
+
}), k = r(() => {
|
|
80
75
|
const a = /* @__PURE__ */ new Map();
|
|
81
|
-
for (const
|
|
82
|
-
a.set(
|
|
76
|
+
for (const d of g.value)
|
|
77
|
+
a.set(d.record, d);
|
|
83
78
|
return a;
|
|
84
79
|
});
|
|
85
80
|
return {
|
|
86
|
-
flattenData:
|
|
87
|
-
rowMetaMap:
|
|
88
|
-
isTreeData:
|
|
89
|
-
toggleTreeExpand:
|
|
81
|
+
flattenData: g,
|
|
82
|
+
rowMetaMap: k,
|
|
83
|
+
isTreeData: o,
|
|
84
|
+
toggleTreeExpand: D,
|
|
90
85
|
isTreeExpanded: A,
|
|
91
|
-
expandedKeys:
|
|
92
|
-
indentSize:
|
|
86
|
+
expandedKeys: s,
|
|
87
|
+
indentSize: C
|
|
93
88
|
};
|
|
94
89
|
}
|
|
95
90
|
export {
|
|
96
|
-
|
|
91
|
+
O as useTreeData
|
|
97
92
|
};
|