@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.
Files changed (193) hide show
  1. package/css/presets/antdv.css +16 -0
  2. package/css/presets/element-plus.css +16 -0
  3. package/css/style.css +200 -0
  4. package/css/tailwind3-utilities.css +168 -0
  5. package/css/tailwind3.css +32 -0
  6. package/css/tailwind4.css +32 -0
  7. package/dist/core/src/components/Button.d.ts +9 -0
  8. package/dist/core/src/components/Button.d.ts.map +1 -1
  9. package/dist/core/src/components/Button.mjs +11 -6
  10. package/dist/core/src/utils/types.d.ts +5 -0
  11. package/dist/core/src/utils/types.d.ts.map +1 -1
  12. package/dist/css/presets/antdv.css +16 -0
  13. package/dist/css/presets/element-plus.css +16 -0
  14. package/dist/css/style.css +200 -0
  15. package/dist/css/tailwind3-utilities.css +168 -0
  16. package/dist/css/tailwind3.css +32 -0
  17. package/dist/css/tailwind4.css +32 -0
  18. package/dist/icons/src/CheckCircleFilledIcon.d.ts +3 -0
  19. package/dist/icons/src/CheckCircleFilledIcon.d.ts.map +1 -0
  20. package/dist/icons/src/CheckCircleFilledIcon.mjs +9 -0
  21. package/dist/icons/src/CloseCircleFilledIcon.d.ts +3 -0
  22. package/dist/icons/src/CloseCircleFilledIcon.d.ts.map +1 -0
  23. package/dist/icons/src/CloseCircleFilledIcon.mjs +9 -0
  24. package/dist/icons/src/index.d.ts +2 -0
  25. package/dist/icons/src/index.d.ts.map +1 -1
  26. package/dist/index.full.mjs +6240 -4423
  27. package/dist/index.mjs +125 -99
  28. package/dist/table/src/components/ExpandIcon.d.ts +18 -0
  29. package/dist/table/src/components/ExpandIcon.d.ts.map +1 -1
  30. package/dist/table/src/components/ExpandIcon.mjs +47 -17
  31. package/dist/table/src/components/FilterDropdown.d.ts +1 -1
  32. package/dist/table/src/components/Table.d.ts +41 -3
  33. package/dist/table/src/components/Table.d.ts.map +1 -1
  34. package/dist/table/src/components/Table.mjs +744 -649
  35. package/dist/table/src/components/TableBody.d.ts.map +1 -1
  36. package/dist/table/src/components/TableBody.mjs +8 -5
  37. package/dist/table/src/components/TableCell.d.ts.map +1 -1
  38. package/dist/table/src/components/TableCell.mjs +125 -94
  39. package/dist/table/src/components/TableEditableCell.d.ts +29 -0
  40. package/dist/table/src/components/TableEditableCell.d.ts.map +1 -0
  41. package/dist/table/src/components/TableEditableCell.mjs +39 -0
  42. package/dist/table/src/components/TableEditableCell.test.d.ts +2 -0
  43. package/dist/table/src/components/TableEditableCell.test.d.ts.map +1 -0
  44. package/dist/table/src/components/TableInstance.test.d.ts +2 -0
  45. package/dist/table/src/components/TableInstance.test.d.ts.map +1 -0
  46. package/dist/table/src/components/TableLazyTree.test.d.ts +2 -0
  47. package/dist/table/src/components/TableLazyTree.test.d.ts.map +1 -0
  48. package/dist/table/src/components/TableQuery.d.ts +108 -0
  49. package/dist/table/src/components/TableQuery.d.ts.map +1 -0
  50. package/dist/table/src/components/TableQuery.mjs +244 -0
  51. package/dist/table/src/components/TableQuery.test.d.ts +2 -0
  52. package/dist/table/src/components/TableQuery.test.d.ts.map +1 -0
  53. package/dist/table/src/components/VTable.vue.d.ts +5 -1
  54. package/dist/table/src/components/VTable.vue.d.ts.map +1 -1
  55. package/dist/table/src/components/VTable.vue.mjs +45 -33
  56. package/dist/table/src/components/VTableEditCell.vue.d.ts +19 -0
  57. package/dist/table/src/components/VTableEditCell.vue.d.ts.map +1 -0
  58. package/dist/table/src/components/VTableEditCell.vue.mjs +21 -0
  59. package/dist/table/src/components/VTableEditCell.vue2.mjs +4 -0
  60. package/dist/table/src/components/VTableQuery.vue.d.ts +18 -0
  61. package/dist/table/src/components/VTableQuery.vue.d.ts.map +1 -0
  62. package/dist/table/src/components/VTableQuery.vue.mjs +64 -0
  63. package/dist/table/src/components/VTableQuery.vue2.mjs +4 -0
  64. package/dist/table/src/components/VirtualTableBody.d.ts.map +1 -1
  65. package/dist/table/src/components/VirtualTableBody.mjs +128 -115
  66. package/dist/table/src/composables/useLazyTreeData.d.ts +19 -0
  67. package/dist/table/src/composables/useLazyTreeData.d.ts.map +1 -0
  68. package/dist/table/src/composables/useLazyTreeData.mjs +123 -0
  69. package/dist/table/src/composables/useLazyTreeData.test.d.ts +2 -0
  70. package/dist/table/src/composables/useLazyTreeData.test.d.ts.map +1 -0
  71. package/dist/table/src/composables/useTableDictionary.d.ts +5 -0
  72. package/dist/table/src/composables/useTableDictionary.d.ts.map +1 -0
  73. package/dist/table/src/composables/useTableDictionary.mjs +168 -0
  74. package/dist/table/src/composables/useTableDictionary.test.d.ts +2 -0
  75. package/dist/table/src/composables/useTableDictionary.test.d.ts.map +1 -0
  76. package/dist/table/src/composables/useTableEdit.d.ts +4 -0
  77. package/dist/table/src/composables/useTableEdit.d.ts.map +1 -0
  78. package/dist/table/src/composables/useTableEdit.mjs +400 -0
  79. package/dist/table/src/composables/useTableEdit.test.d.ts +2 -0
  80. package/dist/table/src/composables/useTableEdit.test.d.ts.map +1 -0
  81. package/dist/table/src/composables/useTableEditable.d.ts +4 -0
  82. package/dist/table/src/composables/useTableEditable.d.ts.map +1 -0
  83. package/dist/table/src/composables/useTableEditable.mjs +125 -0
  84. package/dist/table/src/composables/useTableEditable.test.d.ts +2 -0
  85. package/dist/table/src/composables/useTableEditable.test.d.ts.map +1 -0
  86. package/dist/table/src/composables/useTableQuery.d.ts +4 -0
  87. package/dist/table/src/composables/useTableQuery.d.ts.map +1 -0
  88. package/dist/table/src/composables/useTableQuery.mjs +54 -0
  89. package/dist/table/src/composables/useTableQuery.test.d.ts +2 -0
  90. package/dist/table/src/composables/useTableQuery.test.d.ts.map +1 -0
  91. package/dist/table/src/composables/useTableRequest.d.ts.map +1 -1
  92. package/dist/table/src/composables/useTableRequest.mjs +138 -98
  93. package/dist/table/src/composables/useTableRequest.polling.test.d.ts +2 -0
  94. package/dist/table/src/composables/useTableRequest.polling.test.d.ts.map +1 -0
  95. package/dist/table/src/composables/useTreeData.d.ts +2 -0
  96. package/dist/table/src/composables/useTreeData.d.ts.map +1 -1
  97. package/dist/table/src/composables/useTreeData.mjs +46 -51
  98. package/dist/table/src/context.d.ts +11 -0
  99. package/dist/table/src/context.d.ts.map +1 -1
  100. package/dist/table/src/controls.d.ts +4 -0
  101. package/dist/table/src/controls.d.ts.map +1 -0
  102. package/dist/table/src/controls.mjs +97 -0
  103. package/dist/table/src/controls.test.d.ts +2 -0
  104. package/dist/table/src/controls.test.d.ts.map +1 -0
  105. package/dist/table/src/index.d.ts +27 -1
  106. package/dist/table/src/index.d.ts.map +1 -1
  107. package/dist/table/src/renderers.d.ts +5 -0
  108. package/dist/table/src/renderers.d.ts.map +1 -0
  109. package/dist/table/src/renderers.mjs +117 -0
  110. package/dist/table/src/renderers.test.d.ts +2 -0
  111. package/dist/table/src/renderers.test.d.ts.map +1 -0
  112. package/dist/table/src/review-current.repro.test.d.ts +2 -0
  113. package/dist/table/src/review-current.repro.test.d.ts.map +1 -0
  114. package/dist/table/src/types/column.d.ts +8 -1
  115. package/dist/table/src/types/column.d.ts.map +1 -1
  116. package/dist/table/src/types/controls.d.ts +31 -0
  117. package/dist/table/src/types/controls.d.ts.map +1 -0
  118. package/dist/table/src/types/dictionary.d.ts +71 -0
  119. package/dist/table/src/types/dictionary.d.ts.map +1 -0
  120. package/dist/table/src/types/dictionary.typecheck.d.ts +6 -0
  121. package/dist/table/src/types/dictionary.typecheck.d.ts.map +1 -0
  122. package/dist/table/src/types/editable.d.ts +49 -0
  123. package/dist/table/src/types/editable.d.ts.map +1 -0
  124. package/dist/table/src/types/editable.typecheck.d.ts +15 -0
  125. package/dist/table/src/types/editable.typecheck.d.ts.map +1 -0
  126. package/dist/table/src/types/editing.d.ts +90 -0
  127. package/dist/table/src/types/editing.d.ts.map +1 -0
  128. package/dist/table/src/types/editing.typecheck.d.ts +11 -0
  129. package/dist/table/src/types/editing.typecheck.d.ts.map +1 -0
  130. package/dist/table/src/types/index.d.ts +9 -0
  131. package/dist/table/src/types/index.d.ts.map +1 -1
  132. package/dist/table/src/types/instance.d.ts +18 -0
  133. package/dist/table/src/types/instance.d.ts.map +1 -0
  134. package/dist/table/src/types/instance.typecheck.d.ts +3 -0
  135. package/dist/table/src/types/instance.typecheck.d.ts.map +1 -0
  136. package/dist/table/src/types/query-form.d.ts +90 -0
  137. package/dist/table/src/types/query-form.d.ts.map +1 -0
  138. package/dist/table/src/types/query-form.typecheck.d.ts +10 -0
  139. package/dist/table/src/types/query-form.typecheck.d.ts.map +1 -0
  140. package/dist/table/src/types/query.d.ts +40 -0
  141. package/dist/table/src/types/query.d.ts.map +1 -0
  142. package/dist/table/src/types/query.typecheck.d.ts +14 -0
  143. package/dist/table/src/types/query.typecheck.d.ts.map +1 -0
  144. package/dist/table/src/types/renderers.d.ts +49 -0
  145. package/dist/table/src/types/renderers.d.ts.map +1 -0
  146. package/dist/table/src/types/renderers.typecheck.d.ts +13 -0
  147. package/dist/table/src/types/renderers.typecheck.d.ts.map +1 -0
  148. package/dist/table/src/types/request.d.ts +23 -5
  149. package/dist/table/src/types/request.d.ts.map +1 -1
  150. package/dist/table/src/types/request.typecheck.d.ts.map +1 -1
  151. package/dist/table/src/types/table.d.ts +8 -0
  152. package/dist/table/src/types/table.d.ts.map +1 -1
  153. package/dist/table/src/types/tree.d.ts +5 -0
  154. package/dist/table/src/types/tree.d.ts.map +1 -0
  155. package/dist/table/src/utils/cell.d.ts +5 -0
  156. package/dist/table/src/utils/cell.d.ts.map +1 -1
  157. package/dist/table/src/utils/cell.mjs +76 -46
  158. package/dist/table/src/utils/fieldPath.d.ts +6 -0
  159. package/dist/table/src/utils/fieldPath.d.ts.map +1 -0
  160. package/dist/table/src/utils/fieldPath.mjs +29 -0
  161. package/dist/table/src/utils/queryFields.d.ts +4 -0
  162. package/dist/table/src/utils/queryFields.d.ts.map +1 -0
  163. package/dist/table/src/utils/queryFields.mjs +31 -0
  164. package/dist/table/src/utils/queryFields.test.d.ts +2 -0
  165. package/dist/table/src/utils/queryFields.test.d.ts.map +1 -0
  166. package/dist/table/src/utils/snapshot.d.ts +3 -0
  167. package/dist/table/src/utils/snapshot.d.ts.map +1 -0
  168. package/dist/table/src/utils/snapshot.mjs +30 -0
  169. package/dist/table/src/utils/snapshot.test.d.ts +2 -0
  170. package/dist/table/src/utils/snapshot.test.d.ts.map +1 -0
  171. package/dist/table/src/utils/stateEqual.d.ts +3 -0
  172. package/dist/table/src/utils/stateEqual.d.ts.map +1 -0
  173. package/dist/table/src/utils/stateEqual.mjs +15 -0
  174. package/dist/theme/src/index.d.ts +4 -0
  175. package/dist/theme/src/index.d.ts.map +1 -1
  176. package/dist/theme/src/presets/antdv/table-locale.d.ts +10 -0
  177. package/dist/theme/src/presets/antdv/table-locale.d.ts.map +1 -1
  178. package/dist/theme/src/presets/antdv/table-locale.mjs +2 -0
  179. package/dist/theme/src/presets/antdv/table.d.ts +10 -0
  180. package/dist/theme/src/presets/antdv/table.d.ts.map +1 -1
  181. package/dist/theme/src/presets/antdv/table.mjs +10 -0
  182. package/dist/theme/src/presets/element-plus/table-locale.d.ts +10 -0
  183. package/dist/theme/src/presets/element-plus/table-locale.d.ts.map +1 -1
  184. package/dist/theme/src/presets/element-plus/table-locale.mjs +2 -0
  185. package/dist/theme/src/presets/element-plus/table.d.ts +10 -0
  186. package/dist/theme/src/presets/element-plus/table.d.ts.map +1 -1
  187. package/dist/theme/src/presets/element-plus/table.mjs +10 -0
  188. package/dist/theme/src/query.d.ts +128 -0
  189. package/dist/theme/src/query.d.ts.map +1 -0
  190. package/dist/theme/src/query.mjs +56 -0
  191. package/dist/vtable-guild/src/augment.d.ts +2 -1
  192. package/dist/vtable-guild/src/augment.d.ts.map +1 -1
  193. package/package.json +1 -1
@@ -1,23 +1,23 @@
1
- import { defineComponent as U, inject as Y, ref as C, computed as w, onBeforeUnmount as J, watch as Q, createVNode as r, isVNode as Z } from "vue";
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 ee from "./TableRow.mjs";
4
- import te from "./TableCell.mjs";
5
- import le from "./TableEmpty.mjs";
6
- import oe from "./ExpandedRowTr.mjs";
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 ae from "./ColumnWidthRow.mjs";
9
- import { TABLE_CONTEXT_KEY as re } from "../context.mjs";
10
- import { resolveFixedColumnRanges as ie, useColumnWindow as se } from "../composables/useColumnWindow.mjs";
11
- import { resolveRowDragClass as de } from "../composables/useRowDragSort.mjs";
12
- import { getRowCompatClass as ue } from "../utils/compat.mjs";
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 ce, parseStylePxWidth as fe } from "../utils/columnWidth.mjs";
15
- import me from "../../../core/src/components/VirtualList/VirtualList.mjs";
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 we(e) {
18
- return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !Z(e);
17
+ function ve(t) {
18
+ return typeof t == "function" || Object.prototype.toString.call(t) === "[object Object]" && !ee(t);
19
19
  }
20
- const qe = /* @__PURE__ */ U({
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(e, {
100
- expose: F
99
+ setup(t, {
100
+ expose: k
101
101
  }) {
102
- const n = Y(re, {}), c = C();
103
- F({
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 x = C(0), f = C(0);
109
- function b(t) {
110
- x.value = t.x, e.onVirtualScroll?.({
111
- ...t,
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 V(t, l) {
116
- return N(t, l, e.rowKey);
127
+ function F(e, l) {
128
+ return N(e, l, t.rowKey);
117
129
  }
118
- function k(t, l) {
119
- return N(t, l ?? e.dataSource.indexOf(t), e.rowKey);
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 t = e.columnMetrics?.total;
123
- if (t && t > 0) return t;
124
- const l = ce(e.columns, n.columnWidths), u = fe(e.tableStyle?.width);
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(() => ie(e.columns)), O = w(() => {
127
- if (!e.virtualColumn || f.value <= 0) return null;
128
- const t = e.columnMetrics;
129
- return !t || t.widths.length !== e.columns.length ? null : t.widths;
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: I,
144
+ start: I,
145
+ end: _,
134
146
  leftSpacer: S,
135
- rightSpacer: p
136
- } = se({
147
+ rightSpacer: R
148
+ } = de({
137
149
  widths: () => O.value,
138
150
  leftFixedCount: () => y.value.leftFixedCount,
139
151
  rightFixedStart: () => y.value.rightFixedStart,
140
- offsetX: () => x.value,
152
+ offsetX: () => b.value,
141
153
  viewportWidth: () => f.value
142
154
  }), K = w(() => {
143
- const t = e.columns.length;
155
+ const e = t.columns.length;
144
156
  if (!H.value)
145
157
  return Array.from({
146
- length: t
147
- }, (o, i) => ({
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, a = [];
154
- for (let o = 0; o < l; o += 1) a.push({
155
- index: o
165
+ } = y.value, o = [];
166
+ for (let a = 0; a < l; a += 1) o.push({
167
+ index: a
156
168
  });
157
- S.value > 0 && a.push({
169
+ S.value > 0 && o.push({
158
170
  spacer: S.value
159
171
  });
160
- for (let o = _.value; o <= I.value; o += 1) a.push({
161
- index: o
172
+ for (let a = I.value; a <= _.value; a += 1) o.push({
173
+ index: a
162
174
  });
163
- p.value > 0 && a.push({
164
- spacer: p.value
175
+ R.value > 0 && o.push({
176
+ spacer: R.value
165
177
  });
166
- for (let o = u; o < t; o += 1) a.push({
167
- index: o
178
+ for (let a = u; a < e; a += 1) o.push({
179
+ index: a
168
180
  });
169
- return a;
181
+ return o;
170
182
  });
171
- function ye(t) {
183
+ function ye(e) {
172
184
  }
173
185
  let s = null, d = null;
174
- function R(t) {
175
- const l = t ?? null;
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 J(() => {
192
+ return Q(() => {
181
193
  s?.disconnect(), s = null, d = null;
182
- }), Q(() => c.value, (t) => {
183
- if (t) {
184
- const l = t.getScrollInfo();
185
- b(l), t.nativeElement, R(t.nativeElement);
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
- R(null);
188
- }), () => e.dataSource.length === 0 ? r("table", {
199
+ p(null);
200
+ }), () => t.dataSource.length === 0 ? r("table", {
189
201
  "data-vtg-table": "",
190
- class: W(e.tableClass, n.compatClass?.("body")),
191
- style: e.tableStyle
202
+ class: W(t.tableClass, n.compatClass?.("body")),
203
+ style: t.tableStyle
192
204
  }, [r(ne, {
193
- columns: e.columns
194
- }, null), r(ae, null, null), r("tbody", {
195
- class: e.tbodyClass
196
- }, [r(le, {
197
- colSpan: e.columns.length || 1,
198
- emptyClass: e.emptyClass,
199
- tdClass: e.tdClass
200
- }, null)])]) : r(me, {
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: e.dataSource,
204
- height: e.height,
205
- itemHeight: e.itemHeight,
206
- itemKey: k,
215
+ data: t.dataSource,
216
+ height: t.height,
217
+ itemHeight: t.itemHeight,
218
+ itemKey: V,
207
219
  scrollWidth: q.value || void 0,
208
- disableHeightMeasure: e.fixedHeight,
220
+ disableHeightMeasure: t.fixedHeight,
209
221
  fullHeight: !1,
210
- onVirtualScroll: b,
211
- showScrollBar: e.showScrollBar,
222
+ onVirtualScroll: v,
223
+ showScrollBar: t.showScrollBar,
212
224
  style: {
213
225
  overflow: "hidden"
214
226
  }
215
227
  }, {
216
228
  default: ({
217
- item: t,
229
+ item: e,
218
230
  index: l
219
231
  }) => {
220
232
  let u;
221
- const a = l, o = V(t, a), i = n.expandable?.(), D = n.isExpanded?.(o) ?? !1, P = i?.expandRowByClick ?? !1, j = n.isRowExpandable?.(t) ?? !1, E = n.getRowClassName?.(t, a), B = n.getRowProps?.(t, a), M = n.rowDrag?.enabled.value ? n.rowDrag.getBindings(t, a, B) : void 0, A = {
222
- ...B,
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 = de(n.rowDrag, o, n.subThemeSlots), v = (n.isTreeData?.value ? n.getFlattenRow?.(t) : void 0)?.level ?? 0, X = typeof i?.expandedRowClassName == "function" ? i.expandedRowClassName(t, a, v) : i?.expandedRowClassName, z = P ? () => {
225
- j && n.toggleExpand?.(t, a);
226
- } : void 0, T = K.value, $ = e.columnMetrics?.widths;
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: e.tableClass,
241
+ class: t.tableClass,
230
242
  style: {
231
- ...e.tableStyle,
243
+ ...t.tableStyle,
232
244
  tableLayout: "fixed"
233
245
  }
234
246
  }, [r("tbody", {
235
- class: e.tbodyClass,
236
- "data-vtg-preserve-last-border": l < e.dataSource.length - 1 ? "" : void 0
237
- }, [r(ee, {
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
- key: o,
240
- rowClass: W(e.rowClass, E, L, ue(n, t, a, v)) ?? "",
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
- }, we(u = T.map((g, G) => {
244
- if (g.spacer !== void 0)
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: `${g.spacer}px`,
261
+ width: `${h.spacer}px`,
249
262
  padding: "0"
250
263
  },
251
264
  "aria-hidden": "true"
252
265
  }, null);
253
- const m = g.index, h = e.columns[m];
254
- return r(te, {
255
- key: h.key ?? String(h.dataIndex ?? m),
256
- record: t,
257
- rowIndex: a,
258
- column: h,
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: e.tdClass,
262
- bodyCellEllipsisClass: e.bodyCellEllipsisClass
274
+ tdClass: t.tdClass,
275
+ bodyCellEllipsisClass: t.bodyCellEllipsisClass
263
276
  }, null);
264
277
  })) ? u : {
265
278
  default: () => [u]
266
- }), D && i?.expandedRowRender ? r(oe, {
267
- key: `${o}-expanded`,
268
- record: t,
269
- rowIndex: a,
270
- colspan: T.length,
271
- rowIndent: v,
272
- rowClass: e.rowClass,
273
- rowClassName: E,
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: e.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
- qe as default
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,2 @@
1
+ export {};
2
+ //# sourceMappingURL=useLazyTreeData.test.d.ts.map
@@ -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"}