@vtable-guild/vtable-guild 2.9.0-alpha.0 → 2.9.0-alpha.2
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 +16 -0
- package/css/presets/element-plus.css +16 -0
- package/css/style.css +200 -0
- package/css/tailwind3-utilities.css +168 -0
- package/css/tailwind3.css +32 -0
- package/css/tailwind4.css +32 -0
- package/dist/core/src/components/Button.d.ts +9 -0
- package/dist/core/src/components/Button.d.ts.map +1 -1
- package/dist/core/src/components/Button.mjs +11 -6
- 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 +16 -0
- package/dist/css/presets/element-plus.css +16 -0
- package/dist/css/style.css +200 -0
- package/dist/css/tailwind3-utilities.css +168 -0
- package/dist/css/tailwind3.css +32 -0
- package/dist/css/tailwind4.css +32 -0
- package/dist/icons/src/CheckCircleFilledIcon.d.ts +3 -0
- package/dist/icons/src/CheckCircleFilledIcon.d.ts.map +1 -0
- package/dist/icons/src/CheckCircleFilledIcon.mjs +9 -0
- package/dist/icons/src/CloseCircleFilledIcon.d.ts +3 -0
- package/dist/icons/src/CloseCircleFilledIcon.d.ts.map +1 -0
- package/dist/icons/src/CloseCircleFilledIcon.mjs +9 -0
- package/dist/icons/src/index.d.ts +2 -0
- package/dist/icons/src/index.d.ts.map +1 -1
- package/dist/index.full.mjs +6240 -4423
- package/dist/index.mjs +125 -99
- 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 +41 -3
- package/dist/table/src/components/Table.d.ts.map +1 -1
- package/dist/table/src/components/Table.mjs +744 -649
- 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 +125 -94
- package/dist/table/src/components/TableEditableCell.d.ts +29 -0
- package/dist/table/src/components/TableEditableCell.d.ts.map +1 -0
- package/dist/table/src/components/TableEditableCell.mjs +39 -0
- package/dist/table/src/components/TableEditableCell.test.d.ts +2 -0
- package/dist/table/src/components/TableEditableCell.test.d.ts.map +1 -0
- 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/TableQuery.d.ts +108 -0
- package/dist/table/src/components/TableQuery.d.ts.map +1 -0
- package/dist/table/src/components/TableQuery.mjs +244 -0
- package/dist/table/src/components/TableQuery.test.d.ts +2 -0
- package/dist/table/src/components/TableQuery.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/VTableEditCell.vue.d.ts +19 -0
- package/dist/table/src/components/VTableEditCell.vue.d.ts.map +1 -0
- package/dist/table/src/components/VTableEditCell.vue.mjs +21 -0
- package/dist/table/src/components/VTableEditCell.vue2.mjs +4 -0
- package/dist/table/src/components/VTableQuery.vue.d.ts +18 -0
- package/dist/table/src/components/VTableQuery.vue.d.ts.map +1 -0
- package/dist/table/src/components/VTableQuery.vue.mjs +64 -0
- package/dist/table/src/components/VTableQuery.vue2.mjs +4 -0
- 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/useTableDictionary.d.ts +5 -0
- package/dist/table/src/composables/useTableDictionary.d.ts.map +1 -0
- package/dist/table/src/composables/useTableDictionary.mjs +168 -0
- package/dist/table/src/composables/useTableDictionary.test.d.ts +2 -0
- package/dist/table/src/composables/useTableDictionary.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 +400 -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/useTableEditable.d.ts +4 -0
- package/dist/table/src/composables/useTableEditable.d.ts.map +1 -0
- package/dist/table/src/composables/useTableEditable.mjs +125 -0
- package/dist/table/src/composables/useTableEditable.test.d.ts +2 -0
- package/dist/table/src/composables/useTableEditable.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 +138 -98
- package/dist/table/src/composables/useTableRequest.polling.test.d.ts +2 -0
- package/dist/table/src/composables/useTableRequest.polling.test.d.ts.map +1 -0
- 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 +11 -0
- package/dist/table/src/context.d.ts.map +1 -1
- package/dist/table/src/controls.d.ts +4 -0
- package/dist/table/src/controls.d.ts.map +1 -0
- package/dist/table/src/controls.mjs +97 -0
- package/dist/table/src/controls.test.d.ts +2 -0
- package/dist/table/src/controls.test.d.ts.map +1 -0
- package/dist/table/src/index.d.ts +27 -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 +117 -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/review-current.repro.test.d.ts +2 -0
- package/dist/table/src/review-current.repro.test.d.ts.map +1 -0
- package/dist/table/src/types/column.d.ts +8 -1
- package/dist/table/src/types/column.d.ts.map +1 -1
- package/dist/table/src/types/controls.d.ts +31 -0
- package/dist/table/src/types/controls.d.ts.map +1 -0
- package/dist/table/src/types/dictionary.d.ts +71 -0
- package/dist/table/src/types/dictionary.d.ts.map +1 -0
- package/dist/table/src/types/dictionary.typecheck.d.ts +6 -0
- package/dist/table/src/types/dictionary.typecheck.d.ts.map +1 -0
- package/dist/table/src/types/editable.d.ts +49 -0
- package/dist/table/src/types/editable.d.ts.map +1 -0
- package/dist/table/src/types/editable.typecheck.d.ts +15 -0
- package/dist/table/src/types/editable.typecheck.d.ts.map +1 -0
- package/dist/table/src/types/editing.d.ts +90 -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 +9 -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-form.d.ts +90 -0
- package/dist/table/src/types/query-form.d.ts.map +1 -0
- package/dist/table/src/types/query-form.typecheck.d.ts +10 -0
- package/dist/table/src/types/query-form.typecheck.d.ts.map +1 -0
- package/dist/table/src/types/query.d.ts +40 -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 +49 -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 +23 -5
- package/dist/table/src/types/request.d.ts.map +1 -1
- package/dist/table/src/types/request.typecheck.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 +5 -0
- package/dist/table/src/utils/cell.d.ts.map +1 -1
- package/dist/table/src/utils/cell.mjs +76 -46
- package/dist/table/src/utils/fieldPath.d.ts +6 -0
- package/dist/table/src/utils/fieldPath.d.ts.map +1 -0
- package/dist/table/src/utils/fieldPath.mjs +29 -0
- package/dist/table/src/utils/queryFields.d.ts +4 -0
- package/dist/table/src/utils/queryFields.d.ts.map +1 -0
- package/dist/table/src/utils/queryFields.mjs +31 -0
- package/dist/table/src/utils/queryFields.test.d.ts +2 -0
- package/dist/table/src/utils/queryFields.test.d.ts.map +1 -0
- 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/table/src/utils/stateEqual.d.ts +3 -0
- package/dist/table/src/utils/stateEqual.d.ts.map +1 -0
- package/dist/table/src/utils/stateEqual.mjs +15 -0
- package/dist/theme/src/index.d.ts +4 -0
- package/dist/theme/src/index.d.ts.map +1 -1
- 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 +10 -0
- package/dist/theme/src/presets/antdv/table.d.ts.map +1 -1
- package/dist/theme/src/presets/antdv/table.mjs +10 -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 +10 -0
- package/dist/theme/src/presets/element-plus/table.d.ts.map +1 -1
- package/dist/theme/src/presets/element-plus/table.mjs +10 -0
- package/dist/theme/src/query.d.ts +128 -0
- package/dist/theme/src/query.d.ts.map +1 -0
- package/dist/theme/src/query.mjs +56 -0
- package/dist/vtable-guild/src/augment.d.ts +2 -1
- package/dist/vtable-guild/src/augment.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { defineComponent as U, inject as Y, ref as
|
|
1
|
+
import { defineComponent as U, inject as Y, ref as x, nextTick as J, computed as w, onBeforeUnmount as Q, watch as Z, createVNode as r, isVNode as ee } from "vue";
|
|
2
2
|
import "../../../core/src/utils/tv.mjs";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
3
|
+
import te from "./TableRow.mjs";
|
|
4
|
+
import le from "./TableCell.mjs";
|
|
5
|
+
import oe from "./TableEmpty.mjs";
|
|
6
|
+
import ae from "./ExpandedRowTr.mjs";
|
|
7
7
|
import ne from "./ColGroup.mjs";
|
|
8
|
-
import
|
|
9
|
-
import { TABLE_CONTEXT_KEY as
|
|
10
|
-
import { resolveFixedColumnRanges as
|
|
11
|
-
import { resolveRowDragClass as
|
|
12
|
-
import { getRowCompatClass as
|
|
8
|
+
import re from "./ColumnWidthRow.mjs";
|
|
9
|
+
import { TABLE_CONTEXT_KEY as ie } from "../context.mjs";
|
|
10
|
+
import { resolveFixedColumnRanges as se, useColumnWindow as de } from "../composables/useColumnWindow.mjs";
|
|
11
|
+
import { resolveRowDragClass as ue } from "../composables/useRowDragSort.mjs";
|
|
12
|
+
import { getRowCompatClass as ce } from "../utils/compat.mjs";
|
|
13
13
|
import { resolveRowKey as N } from "../utils/rowKey.mjs";
|
|
14
|
-
import { sumDeclaredColumnWidths as
|
|
15
|
-
import
|
|
14
|
+
import { sumDeclaredColumnWidths as fe, parseStylePxWidth as me } from "../utils/columnWidth.mjs";
|
|
15
|
+
import we from "../../../core/src/components/VirtualList/VirtualList.mjs";
|
|
16
16
|
import { cn as W } from "tailwind-variants";
|
|
17
|
-
function
|
|
18
|
-
return typeof
|
|
17
|
+
function ve(t) {
|
|
18
|
+
return typeof t == "function" || Object.prototype.toString.call(t) === "[object Object]" && !ee(t);
|
|
19
19
|
}
|
|
20
|
-
const
|
|
20
|
+
const Oe = /* @__PURE__ */ U({
|
|
21
21
|
name: "VirtualTableBody",
|
|
22
22
|
props: {
|
|
23
23
|
dataSource: {
|
|
@@ -96,183 +96,196 @@ const qe = /* @__PURE__ */ U({
|
|
|
96
96
|
default: "hover"
|
|
97
97
|
}
|
|
98
98
|
},
|
|
99
|
-
setup(
|
|
100
|
-
expose:
|
|
99
|
+
setup(t, {
|
|
100
|
+
expose: k
|
|
101
101
|
}) {
|
|
102
|
-
const n = Y(
|
|
103
|
-
|
|
102
|
+
const n = Y(ie, {}), c = x();
|
|
103
|
+
k({
|
|
104
104
|
scrollToTop: () => c.value?.scrollTo({
|
|
105
105
|
top: 0
|
|
106
|
-
})
|
|
106
|
+
}),
|
|
107
|
+
async scrollTo(e) {
|
|
108
|
+
const l = c.value;
|
|
109
|
+
return !l || (e.index !== void 0 ? l.scrollTo({
|
|
110
|
+
index: e.index,
|
|
111
|
+
align: e.align,
|
|
112
|
+
offset: e.offset
|
|
113
|
+
}) : e.top !== void 0 && l.scrollTo({
|
|
114
|
+
top: e.top
|
|
115
|
+
}), e.left !== void 0 && l.scrollTo({
|
|
116
|
+
left: e.left
|
|
117
|
+
}), await J(), c.value !== l) ? !1 : (v(l.getScrollInfo()), !0);
|
|
118
|
+
}
|
|
107
119
|
});
|
|
108
|
-
const
|
|
109
|
-
function
|
|
110
|
-
|
|
111
|
-
...
|
|
120
|
+
const b = x(0), f = x(0);
|
|
121
|
+
function v(e) {
|
|
122
|
+
b.value = e.x, t.onVirtualScroll?.({
|
|
123
|
+
...e,
|
|
112
124
|
maxX: c.value?.getHorizontalRange() ?? 0
|
|
113
125
|
});
|
|
114
126
|
}
|
|
115
|
-
function
|
|
116
|
-
return N(
|
|
127
|
+
function F(e, l) {
|
|
128
|
+
return N(e, l, t.rowKey);
|
|
117
129
|
}
|
|
118
|
-
function
|
|
119
|
-
return N(
|
|
130
|
+
function V(e, l) {
|
|
131
|
+
return N(e, l ?? t.dataSource.indexOf(e), t.rowKey);
|
|
120
132
|
}
|
|
121
133
|
const q = w(() => {
|
|
122
|
-
const
|
|
123
|
-
if (
|
|
124
|
-
const l =
|
|
134
|
+
const e = t.columnMetrics?.total;
|
|
135
|
+
if (e && e > 0) return e;
|
|
136
|
+
const l = fe(t.columns, n.columnWidths), u = me(t.tableStyle?.width);
|
|
125
137
|
return Math.max(l, u);
|
|
126
|
-
}), y = w(() =>
|
|
127
|
-
if (!
|
|
128
|
-
const
|
|
129
|
-
return !
|
|
138
|
+
}), y = w(() => se(t.columns)), O = w(() => {
|
|
139
|
+
if (!t.virtualColumn || f.value <= 0) return null;
|
|
140
|
+
const e = t.columnMetrics;
|
|
141
|
+
return !e || e.widths.length !== t.columns.length ? null : e.widths;
|
|
130
142
|
}), {
|
|
131
143
|
active: H,
|
|
132
|
-
start:
|
|
133
|
-
end:
|
|
144
|
+
start: I,
|
|
145
|
+
end: _,
|
|
134
146
|
leftSpacer: S,
|
|
135
|
-
rightSpacer:
|
|
136
|
-
} =
|
|
147
|
+
rightSpacer: R
|
|
148
|
+
} = de({
|
|
137
149
|
widths: () => O.value,
|
|
138
150
|
leftFixedCount: () => y.value.leftFixedCount,
|
|
139
151
|
rightFixedStart: () => y.value.rightFixedStart,
|
|
140
|
-
offsetX: () =>
|
|
152
|
+
offsetX: () => b.value,
|
|
141
153
|
viewportWidth: () => f.value
|
|
142
154
|
}), K = w(() => {
|
|
143
|
-
const
|
|
155
|
+
const e = t.columns.length;
|
|
144
156
|
if (!H.value)
|
|
145
157
|
return Array.from({
|
|
146
|
-
length:
|
|
147
|
-
}, (
|
|
158
|
+
length: e
|
|
159
|
+
}, (a, i) => ({
|
|
148
160
|
index: i
|
|
149
161
|
}));
|
|
150
162
|
const {
|
|
151
163
|
leftFixedCount: l,
|
|
152
164
|
rightFixedStart: u
|
|
153
|
-
} = y.value,
|
|
154
|
-
for (let
|
|
155
|
-
index:
|
|
165
|
+
} = y.value, o = [];
|
|
166
|
+
for (let a = 0; a < l; a += 1) o.push({
|
|
167
|
+
index: a
|
|
156
168
|
});
|
|
157
|
-
S.value > 0 &&
|
|
169
|
+
S.value > 0 && o.push({
|
|
158
170
|
spacer: S.value
|
|
159
171
|
});
|
|
160
|
-
for (let
|
|
161
|
-
index:
|
|
172
|
+
for (let a = I.value; a <= _.value; a += 1) o.push({
|
|
173
|
+
index: a
|
|
162
174
|
});
|
|
163
|
-
|
|
164
|
-
spacer:
|
|
175
|
+
R.value > 0 && o.push({
|
|
176
|
+
spacer: R.value
|
|
165
177
|
});
|
|
166
|
-
for (let
|
|
167
|
-
index:
|
|
178
|
+
for (let a = u; a < e; a += 1) o.push({
|
|
179
|
+
index: a
|
|
168
180
|
});
|
|
169
|
-
return
|
|
181
|
+
return o;
|
|
170
182
|
});
|
|
171
|
-
function ye(
|
|
183
|
+
function ye(e) {
|
|
172
184
|
}
|
|
173
185
|
let s = null, d = null;
|
|
174
|
-
function
|
|
175
|
-
const l =
|
|
186
|
+
function p(e) {
|
|
187
|
+
const l = e ?? null;
|
|
176
188
|
l !== d && (s && d && s.unobserve(d), d = l, l && (f.value = l.clientWidth, !s && typeof ResizeObserver < "u" && (s = new ResizeObserver(() => {
|
|
177
189
|
d && (f.value = d.clientWidth);
|
|
178
190
|
})), s?.observe(l)));
|
|
179
191
|
}
|
|
180
|
-
return
|
|
192
|
+
return Q(() => {
|
|
181
193
|
s?.disconnect(), s = null, d = null;
|
|
182
|
-
}),
|
|
183
|
-
if (
|
|
184
|
-
const l =
|
|
185
|
-
|
|
194
|
+
}), Z(() => c.value, (e) => {
|
|
195
|
+
if (e) {
|
|
196
|
+
const l = e.getScrollInfo();
|
|
197
|
+
v(l), e.nativeElement, p(e.nativeElement);
|
|
186
198
|
} else
|
|
187
|
-
|
|
188
|
-
}), () =>
|
|
199
|
+
p(null);
|
|
200
|
+
}), () => t.dataSource.length === 0 ? r("table", {
|
|
189
201
|
"data-vtg-table": "",
|
|
190
|
-
class: W(
|
|
191
|
-
style:
|
|
202
|
+
class: W(t.tableClass, n.compatClass?.("body")),
|
|
203
|
+
style: t.tableStyle
|
|
192
204
|
}, [r(ne, {
|
|
193
|
-
columns:
|
|
194
|
-
}, null), r(
|
|
195
|
-
class:
|
|
196
|
-
}, [r(
|
|
197
|
-
colSpan:
|
|
198
|
-
emptyClass:
|
|
199
|
-
tdClass:
|
|
200
|
-
}, null)])]) : r(
|
|
205
|
+
columns: t.columns
|
|
206
|
+
}, null), r(re, null, null), r("tbody", {
|
|
207
|
+
class: t.tbodyClass
|
|
208
|
+
}, [r(oe, {
|
|
209
|
+
colSpan: t.columns.length || 1,
|
|
210
|
+
emptyClass: t.emptyClass,
|
|
211
|
+
tdClass: t.tdClass
|
|
212
|
+
}, null)])]) : r(we, {
|
|
201
213
|
ref: c,
|
|
202
214
|
holderClass: n.compatClass?.("body"),
|
|
203
|
-
data:
|
|
204
|
-
height:
|
|
205
|
-
itemHeight:
|
|
206
|
-
itemKey:
|
|
215
|
+
data: t.dataSource,
|
|
216
|
+
height: t.height,
|
|
217
|
+
itemHeight: t.itemHeight,
|
|
218
|
+
itemKey: V,
|
|
207
219
|
scrollWidth: q.value || void 0,
|
|
208
|
-
disableHeightMeasure:
|
|
220
|
+
disableHeightMeasure: t.fixedHeight,
|
|
209
221
|
fullHeight: !1,
|
|
210
|
-
onVirtualScroll:
|
|
211
|
-
showScrollBar:
|
|
222
|
+
onVirtualScroll: v,
|
|
223
|
+
showScrollBar: t.showScrollBar,
|
|
212
224
|
style: {
|
|
213
225
|
overflow: "hidden"
|
|
214
226
|
}
|
|
215
227
|
}, {
|
|
216
228
|
default: ({
|
|
217
|
-
item:
|
|
229
|
+
item: e,
|
|
218
230
|
index: l
|
|
219
231
|
}) => {
|
|
220
232
|
let u;
|
|
221
|
-
const
|
|
222
|
-
...
|
|
233
|
+
const o = l, a = F(e, o), i = n.expandable?.(), D = n.isExpanded?.(a) ?? !1, P = i?.expandRowByClick ?? !1, j = n.isRowExpandable?.(e) ?? !1, T = n.getRowClassName?.(e, o), E = n.getRowProps?.(e, o), M = n.rowDrag?.enabled.value ? n.rowDrag.getBindings(e, o, E) : void 0, A = {
|
|
234
|
+
...E,
|
|
223
235
|
...M
|
|
224
|
-
}, L =
|
|
225
|
-
j && n.toggleExpand?.(
|
|
226
|
-
} : void 0,
|
|
236
|
+
}, L = ue(n.rowDrag, a, n.subThemeSlots), g = (n.isTreeData?.value ? n.getFlattenRow?.(e) : void 0)?.level ?? 0, X = typeof i?.expandedRowClassName == "function" ? i.expandedRowClassName(e, o, g) : i?.expandedRowClassName, z = P ? () => {
|
|
237
|
+
j && n.toggleExpand?.(e, o);
|
|
238
|
+
} : void 0, B = K.value, $ = t.columnMetrics?.widths;
|
|
227
239
|
return r("table", {
|
|
228
240
|
"data-vtg-table": "",
|
|
229
|
-
class:
|
|
241
|
+
class: t.tableClass,
|
|
230
242
|
style: {
|
|
231
|
-
...
|
|
243
|
+
...t.tableStyle,
|
|
232
244
|
tableLayout: "fixed"
|
|
233
245
|
}
|
|
234
246
|
}, [r("tbody", {
|
|
235
|
-
class:
|
|
236
|
-
"data-vtg-preserve-last-border": l <
|
|
237
|
-
}, [r(
|
|
247
|
+
class: t.tbodyClass,
|
|
248
|
+
"data-vtg-preserve-last-border": l < t.dataSource.length - 1 ? "" : void 0
|
|
249
|
+
}, [r(te, {
|
|
238
250
|
"data-vtg-virtual-row": "",
|
|
239
|
-
|
|
240
|
-
|
|
251
|
+
"data-vtg-row-index": o,
|
|
252
|
+
key: a,
|
|
253
|
+
rowClass: W(t.rowClass, T, L, ce(n, e, o, g)) ?? "",
|
|
241
254
|
rowProps: A,
|
|
242
255
|
onClick: z
|
|
243
|
-
},
|
|
244
|
-
if (
|
|
256
|
+
}, ve(u = B.map((h, G) => {
|
|
257
|
+
if (h.spacer !== void 0)
|
|
245
258
|
return r("td", {
|
|
246
259
|
key: `__vtg_spacer_${G}`,
|
|
247
260
|
style: {
|
|
248
|
-
width: `${
|
|
261
|
+
width: `${h.spacer}px`,
|
|
249
262
|
padding: "0"
|
|
250
263
|
},
|
|
251
264
|
"aria-hidden": "true"
|
|
252
265
|
}, null);
|
|
253
|
-
const m =
|
|
254
|
-
return r(
|
|
255
|
-
key:
|
|
256
|
-
record:
|
|
257
|
-
rowIndex:
|
|
258
|
-
column:
|
|
266
|
+
const m = h.index, C = t.columns[m];
|
|
267
|
+
return r(le, {
|
|
268
|
+
key: C.key ?? String(C.dataIndex ?? m),
|
|
269
|
+
record: e,
|
|
270
|
+
rowIndex: o,
|
|
271
|
+
column: C,
|
|
259
272
|
colIndex: m,
|
|
260
273
|
widthOverride: $?.[m],
|
|
261
|
-
tdClass:
|
|
262
|
-
bodyCellEllipsisClass:
|
|
274
|
+
tdClass: t.tdClass,
|
|
275
|
+
bodyCellEllipsisClass: t.bodyCellEllipsisClass
|
|
263
276
|
}, null);
|
|
264
277
|
})) ? u : {
|
|
265
278
|
default: () => [u]
|
|
266
|
-
}), D && i?.expandedRowRender ? r(
|
|
267
|
-
key: `${
|
|
268
|
-
record:
|
|
269
|
-
rowIndex:
|
|
270
|
-
colspan:
|
|
271
|
-
rowIndent:
|
|
272
|
-
rowClass:
|
|
273
|
-
rowClassName:
|
|
279
|
+
}), D && i?.expandedRowRender ? r(ae, {
|
|
280
|
+
key: `${a}-expanded`,
|
|
281
|
+
record: e,
|
|
282
|
+
rowIndex: o,
|
|
283
|
+
colspan: B.length,
|
|
284
|
+
rowIndent: g,
|
|
285
|
+
rowClass: t.rowClass,
|
|
286
|
+
rowClassName: T,
|
|
274
287
|
expandedRowClassName: X,
|
|
275
|
-
tdClass:
|
|
288
|
+
tdClass: t.tdClass,
|
|
276
289
|
expandedRowRender: i.expandedRowRender
|
|
277
290
|
}, null) : null])]);
|
|
278
291
|
}
|
|
@@ -280,5 +293,5 @@ const qe = /* @__PURE__ */ U({
|
|
|
280
293
|
}
|
|
281
294
|
});
|
|
282
295
|
export {
|
|
283
|
-
|
|
296
|
+
Oe as default
|
|
284
297
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Key } from '../types/column';
|
|
2
|
+
import { TableTreeLoadData } from '../types/tree';
|
|
3
|
+
/** Immutable lazy children shared by sorting, selection, pagination and tree flattening. */
|
|
4
|
+
export declare function useLazyTreeData<TRecord extends Record<string, unknown>>(options: {
|
|
5
|
+
data: () => TRecord[];
|
|
6
|
+
loadData: () => TableTreeLoadData<TRecord> | undefined;
|
|
7
|
+
isLeaf: () => ((record: TRecord) => boolean) | undefined;
|
|
8
|
+
childrenColumnName: () => string | undefined;
|
|
9
|
+
getRowKey: (record: TRecord, index: number) => Key;
|
|
10
|
+
onLoadError?: (error: Error, record: TRecord) => void;
|
|
11
|
+
}): {
|
|
12
|
+
data: import('vue').ComputedRef<TRecord[]>;
|
|
13
|
+
hasChildren: (record: TRecord) => boolean;
|
|
14
|
+
load: (record: TRecord, index: number) => Promise<boolean>;
|
|
15
|
+
isLoading: (key: Key) => boolean;
|
|
16
|
+
getError: (key: Key) => Error | undefined;
|
|
17
|
+
retry(key: Key): Promise<boolean>;
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=useLazyTreeData.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLazyTreeData.d.ts","sourceRoot":"","sources":["../../../../../table/src/composables/useLazyTreeData.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAA;AAC1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAOtD,4FAA4F;AAC5F,wBAAgB,eAAe,CAAC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE;IAChF,IAAI,EAAE,MAAM,OAAO,EAAE,CAAA;IACrB,QAAQ,EAAE,MAAM,iBAAiB,CAAC,OAAO,CAAC,GAAG,SAAS,CAAA;IACtD,MAAM,EAAE,MAAM,CAAC,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC,GAAG,SAAS,CAAA;IACxD,kBAAkB,EAAE,MAAM,MAAM,GAAG,SAAS,CAAA;IAC5C,SAAS,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK,GAAG,CAAA;IAClD,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,KAAK,IAAI,CAAA;CACtD;;0BAsF8B,OAAO;mBAMd,OAAO,SAAS,MAAM,KAAG,OAAO,CAAC,OAAO,CAAC;qBA6E5C,GAAG;oBACJ,GAAG;eACR,GAAG;EAOjB"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { shallowRef as p, computed as M, watch as S, getCurrentScope as L, onScopeDispose as C } from "vue";
|
|
2
|
+
function T(n) {
|
|
3
|
+
const s = p(/* @__PURE__ */ new Map()), i = p(/* @__PURE__ */ new Map()), y = p(/* @__PURE__ */ new Set()), c = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new WeakMap();
|
|
4
|
+
let g = !1;
|
|
5
|
+
const o = M(() => n.childrenColumnName() ?? "children"), h = M(() => {
|
|
6
|
+
const e = /* @__PURE__ */ new Map();
|
|
7
|
+
let r = 0;
|
|
8
|
+
function t(a) {
|
|
9
|
+
for (const u of a) {
|
|
10
|
+
const d = n.getRowKey(u, r++);
|
|
11
|
+
e.set(d, u);
|
|
12
|
+
const v = s.value.get(d), l = u[o.value] ?? (v?.record === u ? v.children : void 0);
|
|
13
|
+
Array.isArray(l) && t(l);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return n.loadData() && t(n.data()), e;
|
|
17
|
+
});
|
|
18
|
+
function w(e, r = !0) {
|
|
19
|
+
const t = c.get(e);
|
|
20
|
+
r && (t?.controller.abort(), t?.resolve(!1)), c.delete(e), y.value = new Set([...y.value].filter((a) => a !== e));
|
|
21
|
+
}
|
|
22
|
+
let D = h.value;
|
|
23
|
+
S(
|
|
24
|
+
h,
|
|
25
|
+
(e) => {
|
|
26
|
+
const r = new Map(s.value);
|
|
27
|
+
for (const [t, a] of r)
|
|
28
|
+
(e.get(t) !== a.record || Array.isArray(a.record[o.value])) && r.delete(t);
|
|
29
|
+
r.size !== s.value.size && (s.value = r);
|
|
30
|
+
for (const [t, a] of c)
|
|
31
|
+
(e.get(t) !== a.record || Array.isArray(a.record[o.value])) && w(t);
|
|
32
|
+
i.value = new Map(
|
|
33
|
+
[...i.value].filter(([t]) => {
|
|
34
|
+
const a = e.get(t);
|
|
35
|
+
return a !== void 0 && a === D.get(t) && !Array.isArray(a[o.value]);
|
|
36
|
+
})
|
|
37
|
+
), D = e;
|
|
38
|
+
},
|
|
39
|
+
{ flush: "sync" }
|
|
40
|
+
);
|
|
41
|
+
const b = M(() => {
|
|
42
|
+
if (!n.loadData()) return n.data();
|
|
43
|
+
let e = 0;
|
|
44
|
+
function r(t) {
|
|
45
|
+
return t.map((a) => {
|
|
46
|
+
const u = n.getRowKey(a, e++), d = s.value.get(u), v = a[o.value] ?? (d?.record === a ? d.children : void 0);
|
|
47
|
+
if (!Array.isArray(v)) return a;
|
|
48
|
+
const l = { ...a, [o.value]: r(v) };
|
|
49
|
+
return m.set(l, a), l;
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
return r(n.data());
|
|
53
|
+
});
|
|
54
|
+
function A(e) {
|
|
55
|
+
const r = e[o.value];
|
|
56
|
+
return Array.isArray(r) ? r.length > 0 : !!n.loadData() && n.isLeaf()?.(m.get(e) ?? e) !== !0;
|
|
57
|
+
}
|
|
58
|
+
function x(e, r) {
|
|
59
|
+
const t = m.get(e) ?? e, a = n.getRowKey(t, r);
|
|
60
|
+
return g || !n.loadData() || !A(e) ? Promise.resolve(!1) : P(t, a);
|
|
61
|
+
}
|
|
62
|
+
function P(e, r) {
|
|
63
|
+
if (Array.isArray(e[o.value]) || s.value.get(r)?.record === e)
|
|
64
|
+
return Promise.resolve(!0);
|
|
65
|
+
const t = c.get(r);
|
|
66
|
+
if (t) return t.promise;
|
|
67
|
+
const a = new AbortController(), u = n.loadData();
|
|
68
|
+
let d;
|
|
69
|
+
const v = new Promise((f) => {
|
|
70
|
+
d = f;
|
|
71
|
+
}), l = { record: e, controller: a, promise: Promise.resolve(!1), resolve: d };
|
|
72
|
+
c.set(r, l), y.value = /* @__PURE__ */ new Set([...y.value, r]);
|
|
73
|
+
const E = new Map(i.value);
|
|
74
|
+
E.delete(r), i.value = E;
|
|
75
|
+
const K = Promise.resolve().then(async () => {
|
|
76
|
+
if (g || a.signal.aborted || c.get(r) !== l) return !1;
|
|
77
|
+
try {
|
|
78
|
+
const f = await u(e, { signal: a.signal });
|
|
79
|
+
if (g || a.signal.aborted || h.value.get(r) !== e || Array.isArray(e[o.value]))
|
|
80
|
+
return !1;
|
|
81
|
+
if (!Array.isArray(f)) throw new Error("Tree loadData must return an array");
|
|
82
|
+
return s.value = new Map(s.value).set(r, { record: e, children: f }), !0;
|
|
83
|
+
} catch (f) {
|
|
84
|
+
if (g || a.signal.aborted || h.value.get(r) !== e) return !1;
|
|
85
|
+
const R = f instanceof Error ? f : new Error(String(f));
|
|
86
|
+
i.value = new Map(i.value).set(r, R);
|
|
87
|
+
try {
|
|
88
|
+
Promise.resolve(n.onLoadError?.(R, e)).catch(() => {
|
|
89
|
+
});
|
|
90
|
+
} catch {
|
|
91
|
+
}
|
|
92
|
+
return !1;
|
|
93
|
+
} finally {
|
|
94
|
+
c.get(r) === l && w(r, !1);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
return l.promise = Promise.race([K, v]), l.promise;
|
|
98
|
+
}
|
|
99
|
+
return S(
|
|
100
|
+
[n.loadData, o],
|
|
101
|
+
() => {
|
|
102
|
+
for (const e of c.keys()) w(e);
|
|
103
|
+
s.value = /* @__PURE__ */ new Map(), i.value = /* @__PURE__ */ new Map();
|
|
104
|
+
},
|
|
105
|
+
{ flush: "sync" }
|
|
106
|
+
), L() && C(() => {
|
|
107
|
+
g = !0;
|
|
108
|
+
for (const e of c.keys()) w(e);
|
|
109
|
+
}), {
|
|
110
|
+
data: b,
|
|
111
|
+
hasChildren: A,
|
|
112
|
+
load: x,
|
|
113
|
+
isLoading: (e) => y.value.has(e),
|
|
114
|
+
getError: (e) => i.value.get(e),
|
|
115
|
+
retry(e) {
|
|
116
|
+
const r = h.value.get(e);
|
|
117
|
+
return r && !g && n.loadData() && A(r) ? P(r, e) : Promise.resolve(!1);
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
export {
|
|
122
|
+
T as useLazyTreeData
|
|
123
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLazyTreeData.test.d.ts","sourceRoot":"","sources":["../../../../../table/src/composables/useLazyTreeData.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { CreateTableDictionaryOptions, TableDictionary, UseTableDictionaryOptions, UseTableDictionaryReturn } from '../types/dictionary';
|
|
2
|
+
/** A cache is owned by this instance, never by a process-wide registry or a cell renderer. */
|
|
3
|
+
export declare function createTableDictionary<TParams extends object = Record<string, unknown>>(options: CreateTableDictionaryOptions<TParams>): TableDictionary<TParams>;
|
|
4
|
+
export declare function useTableDictionary<TParams extends object = Record<string, unknown>>(options: UseTableDictionaryOptions<TParams>): UseTableDictionaryReturn;
|
|
5
|
+
//# sourceMappingURL=useTableDictionary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTableDictionary.d.ts","sourceRoot":"","sources":["../../../../../table/src/composables/useTableDictionary.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,4BAA4B,EAC5B,eAAe,EAGf,yBAAyB,EACzB,wBAAwB,EACzB,MAAM,qBAAqB,CAAA;AA+B5B,8FAA8F;AAC9F,wBAAgB,qBAAqB,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACpF,OAAO,EAAE,4BAA4B,CAAC,OAAO,CAAC,GAC7C,eAAe,CAAC,OAAO,CAAC,CAyG1B;AAED,wBAAgB,kBAAkB,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjF,OAAO,EAAE,yBAAyB,CAAC,OAAO,CAAC,GAC1C,wBAAwB,CAoI1B"}
|