@dazhicheng/ui 1.6.10 → 1.6.12

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 (86) hide show
  1. package/dist/components/tt-form/src/useFormContext.js +1 -1
  2. package/dist/components/tt-table/index.js +4 -5
  3. package/dist/components/tt-table/src/TableForm.vue.js +2 -3
  4. package/dist/hooks/useBasicDataOptions.js +111 -96
  5. package/dist/hooks/useDataPermissionOptions.js +83 -85
  6. package/dist/hooks/useOwnerRoutePath.d.ts +5 -0
  7. package/dist/hooks/useOwnerRoutePath.js +7 -0
  8. package/dist/index.d.ts +0 -1
  9. package/dist/index.js +115 -129
  10. package/dist/packages/utils/src/is.js +37 -46
  11. package/dist/style.css +1 -1
  12. package/package.json +1 -1
  13. package/dist/components/tt-vtable/index.js +0 -54
  14. package/dist/components/tt-vtable/src/components/TtVTable.vue.d.ts +0 -188
  15. package/dist/components/tt-vtable/src/components/TtVTable.vue.js +0 -227
  16. package/dist/components/tt-vtable/src/components/TtVTable.vue2.js +0 -4
  17. package/dist/components/tt-vtable/src/components/TtVTableForm.vue.d.ts +0 -32
  18. package/dist/components/tt-vtable/src/components/TtVTableForm.vue.js +0 -121
  19. package/dist/components/tt-vtable/src/components/TtVTableForm.vue2.js +0 -4
  20. package/dist/components/tt-vtable/src/components/VTableEmpty.vue.d.ts +0 -64
  21. package/dist/components/tt-vtable/src/components/VTableEmpty.vue.js +0 -97
  22. package/dist/components/tt-vtable/src/components/VTableEmpty.vue2.js +0 -4
  23. package/dist/components/tt-vtable/src/components/VTablePagination.vue.d.ts +0 -53
  24. package/dist/components/tt-vtable/src/components/VTablePagination.vue.js +0 -52
  25. package/dist/components/tt-vtable/src/components/VTablePagination.vue2.js +0 -4
  26. package/dist/components/tt-vtable/src/components/VTableSelectionAlert.vue.d.ts +0 -35
  27. package/dist/components/tt-vtable/src/components/VTableSelectionAlert.vue.js +0 -50
  28. package/dist/components/tt-vtable/src/components/VTableSelectionAlert.vue2.js +0 -4
  29. package/dist/components/tt-vtable/src/components/VTableToolbar.vue.d.ts +0 -63
  30. package/dist/components/tt-vtable/src/components/VTableToolbar.vue.js +0 -126
  31. package/dist/components/tt-vtable/src/components/VTableToolbar.vue2.js +0 -4
  32. package/dist/components/tt-vtable/src/components/VTableViewport.vue.js +0 -133
  33. package/dist/components/tt-vtable/src/components/VTableViewport.vue2.js +0 -4
  34. package/dist/components/tt-vtable/src/composables/useVTable.d.ts +0 -41
  35. package/dist/components/tt-vtable/src/composables/useVTable.js +0 -25
  36. package/dist/components/tt-vtable/src/composables/useVTableFormRender.d.ts +0 -13
  37. package/dist/components/tt-vtable/src/composables/useVTableFormRender.js +0 -92
  38. package/dist/components/tt-vtable/src/composables/useVTableRender.d.ts +0 -13
  39. package/dist/components/tt-vtable/src/composables/useVTableRender.js +0 -13
  40. package/dist/components/tt-vtable/src/engine/visactor/createListTable.d.ts +0 -10
  41. package/dist/components/tt-vtable/src/engine/visactor/createListTable.js +0 -63
  42. package/dist/components/tt-vtable/src/engine/visactor/createVueCellLayout.d.ts +0 -37
  43. package/dist/components/tt-vtable/src/engine/visactor/createVueCellLayout.js +0 -133
  44. package/dist/components/tt-vtable/src/engine/visactor/index.d.ts +0 -8
  45. package/dist/components/tt-vtable/src/engine/visactor/native-boundaries.d.ts +0 -23
  46. package/dist/components/tt-vtable/src/engine/visactor/native-boundaries.js +0 -70
  47. package/dist/components/tt-vtable/src/engine/visactor/record-adapter.d.ts +0 -38
  48. package/dist/components/tt-vtable/src/engine/visactor/record-adapter.js +0 -41
  49. package/dist/components/tt-vtable/src/engine/visactor/toColumnDefinitions.d.ts +0 -45
  50. package/dist/components/tt-vtable/src/engine/visactor/toColumnDefinitions.js +0 -73
  51. package/dist/components/tt-vtable/src/engine/visactor/toListTableOptions.d.ts +0 -25
  52. package/dist/components/tt-vtable/src/engine/visactor/toListTableOptions.js +0 -25
  53. package/dist/components/tt-vtable/src/engine/visactor/types.d.ts +0 -29
  54. package/dist/components/tt-vtable/src/features/column-preferences/column-preference-storage.d.ts +0 -5
  55. package/dist/components/tt-vtable/src/features/column-preferences/column-preference-storage.js +0 -52
  56. package/dist/components/tt-vtable/src/features/column-preferences/useColumnPreferences.d.ts +0 -74
  57. package/dist/components/tt-vtable/src/features/column-preferences/useColumnPreferences.js +0 -232
  58. package/dist/components/tt-vtable/src/features/editing/useCellEditing.d.ts +0 -48
  59. package/dist/components/tt-vtable/src/features/editing/useCellEditing.js +0 -102
  60. package/dist/components/tt-vtable/src/features/form-integration/useVTableForm.d.ts +0 -51
  61. package/dist/components/tt-vtable/src/features/pagination/useTablePagination.d.ts +0 -40
  62. package/dist/components/tt-vtable/src/features/pagination/useTablePagination.js +0 -51
  63. package/dist/components/tt-vtable/src/features/querying/useRecordQuery.d.ts +0 -38
  64. package/dist/components/tt-vtable/src/features/querying/useRecordQuery.js +0 -57
  65. package/dist/components/tt-vtable/src/features/records/index.d.ts +0 -3
  66. package/dist/components/tt-vtable/src/features/records/record-index.d.ts +0 -122
  67. package/dist/components/tt-vtable/src/features/records/record-index.js +0 -209
  68. package/dist/components/tt-vtable/src/features/records/useRecordSource.d.ts +0 -41
  69. package/dist/components/tt-vtable/src/features/records/useRecordSource.js +0 -249
  70. package/dist/components/tt-vtable/src/features/selection/useRowSelection.d.ts +0 -65
  71. package/dist/components/tt-vtable/src/features/selection/useRowSelection.js +0 -129
  72. package/dist/components/tt-vtable/src/features/tree/useTreeRecords.d.ts +0 -60
  73. package/dist/components/tt-vtable/src/features/tree/useTreeRecords.js +0 -125
  74. package/dist/components/tt-vtable/src/public/column-preferences.d.ts +0 -32
  75. package/dist/components/tt-vtable/src/public/index.d.ts +0 -8
  76. package/dist/components/tt-vtable/src/public/table-api.d.ts +0 -215
  77. package/dist/components/tt-vtable/src/public/table-column.d.ts +0 -123
  78. package/dist/components/tt-vtable/src/public/table-errors.d.ts +0 -26
  79. package/dist/components/tt-vtable/src/public/table-errors.js +0 -26
  80. package/dist/components/tt-vtable/src/public/table-events.d.ts +0 -69
  81. package/dist/components/tt-vtable/src/public/table-props.d.ts +0 -216
  82. package/dist/components/tt-vtable/src/public/table-slots.d.ts +0 -37
  83. package/dist/components/tt-vtable/src/runtime/createVTableController.d.ts +0 -12
  84. package/dist/components/tt-vtable/src/runtime/createVTableController.js +0 -238
  85. package/dist/components/tt-vtable/src/runtime/createVTableRuntime.d.ts +0 -79
  86. package/dist/components/tt-vtable/src/runtime/createVTableRuntime.js +0 -380
@@ -1,380 +0,0 @@
1
- import "axios";
2
- import "element-plus";
3
- import { isFunction as ye, isString as ve, isObject as Ce, isArray as Te } from "../../../../packages/utils/src/is.js";
4
- import { shallowRef as v, computed as Q, watch as Se, nextTick as pe } from "vue";
5
- import "dayjs";
6
- import "numeral";
7
- import "xe-utils";
8
- import "dayjs/plugin/utc";
9
- import "dayjs/plugin/timezone";
10
- import "../../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
11
- import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js";
12
- import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js";
13
- import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
14
- import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
15
- import "lodash-es";
16
- import { createVisactorTableEngine as we } from "../engine/visactor/createListTable.js";
17
- import "../engine/visactor/createVueCellLayout.js";
18
- import { bindNativeEvents as Ee } from "../engine/visactor/native-boundaries.js";
19
- import { createTtVTableError as x } from "../public/table-errors.js";
20
- import { useColumnPreferences as _e } from "../features/column-preferences/useColumnPreferences.js";
21
- import { useCellEditing as Ie } from "../features/editing/useCellEditing.js";
22
- import { useTablePagination as xe } from "../features/pagination/useTablePagination.js";
23
- import { useRecordQuery as Ae } from "../features/querying/useRecordQuery.js";
24
- import { getRecordFieldValue as q } from "../features/records/record-index.js";
25
- import { useRecordSource as Fe } from "../features/records/useRecordSource.js";
26
- import { useRowSelection as Ke } from "../features/selection/useRowSelection.js";
27
- import { useTreeRecords as Ne } from "../features/tree/useTreeRecords.js";
28
- const A = "__tt_vtable_selection__";
29
- function M(n) {
30
- return n === "expand";
31
- }
32
- function B(n) {
33
- return Ce(n);
34
- }
35
- function ot(n) {
36
- var z, H;
37
- const s = we(), p = v(!1), V = v(0), b = v(0), F = v([]), D = v({});
38
- let K = !1, l, i, u, f, m, N = !1;
39
- const R = ye(n.fetchRecords), C = Q(
40
- () => {
41
- var e, t;
42
- return ((t = (e = n.getFeatures()) == null ? void 0 : e.selection) == null ? void 0 : t.mode) ?? "none";
43
- }
44
- );
45
- function U() {
46
- var t;
47
- const e = (t = n.getFeatures()) == null ? void 0 : t.pagination;
48
- return e === !1 ? void 0 : e;
49
- }
50
- function w() {
51
- var t;
52
- const e = (t = n.getFeatures()) == null ? void 0 : t.tree;
53
- return e === !1 ? void 0 : e;
54
- }
55
- function W() {
56
- var t;
57
- const e = (t = n.getFeatures()) == null ? void 0 : t.editing;
58
- return e === !1 ? void 0 : e;
59
- }
60
- function P() {
61
- var t;
62
- const e = (t = n.getFeatures()) == null ? void 0 : t.columnPreferences;
63
- return e === !1 ? void 0 : e;
64
- }
65
- const T = U(), S = w(), h = P();
66
- function E() {
67
- !R || N || (N = !0, pe(() => {
68
- N = !1, m == null || m.fetch();
69
- }));
70
- }
71
- function $() {
72
- i == null || i.reconcilePage(), u == null || u.reconcileRecords(), f == null || f.onRecordsReplaced(), L();
73
- }
74
- const o = Fe({
75
- records: R ? [] : n.records,
76
- rowKey: n.rowKey,
77
- childrenField: S == null ? void 0 : S.childrenField,
78
- mutationMode: n.mutationMode,
79
- engine: s,
80
- onRecordChange: n.onRecordChange,
81
- onRecordsReplaced: $
82
- });
83
- i = xe({
84
- initialPage: T == null ? void 0 : T.page,
85
- initialPageSize: T == null ? void 0 : T.pageSize,
86
- isRemote: R,
87
- getRecords: o.getAll,
88
- onChange: (e) => {
89
- var t;
90
- (t = n.onPageChange) == null || t.call(n, e), L(), E();
91
- }
92
- });
93
- function j(e) {
94
- var c;
95
- const t = ((c = w()) == null ? void 0 : c.childrenField) || "children", r = q(e, t);
96
- return Te(r) ? r : void 0;
97
- }
98
- f = Ne({
99
- defaultExpandedKeys: S == null ? void 0 : S.defaultExpandedKeys,
100
- getRecordByKey: o.getByKey,
101
- getRowKey: o.getRowKey,
102
- getChildren: j,
103
- setChildren: o.setChildren,
104
- fetchTreeChildren: (e) => {
105
- const t = w();
106
- return t != null && t.fetchTreeChildren ? t.fetchTreeChildren(e) : Promise.resolve([]);
107
- },
108
- cacheChildren: () => {
109
- const e = w();
110
- return (e == null ? void 0 : e.cacheChildren) ?? !0;
111
- },
112
- setNativeExpanded: ce,
113
- setNativeLoading: oe,
114
- onLoadSuccess: n.onTreeLoadSuccess,
115
- onLoadError: n.onTreeLoadError
116
- }), u = Ke({
117
- mode: C,
118
- selectedRowKeys: n.selectedRowKeys,
119
- getLoadedRecords: o.getAll,
120
- getCurrentPageRecords: () => i.pageRecords.value,
121
- getRecordByKey: o.getByKey,
122
- getRowKey: o.getRowKey,
123
- isRowSelectable: (e) => {
124
- var t, r, c;
125
- return ((c = (r = (t = n.getFeatures()) == null ? void 0 : t.selection) == null ? void 0 : r.isRowSelectable) == null ? void 0 : c.call(r, e)) ?? !0;
126
- },
127
- reserveAcrossPages: () => {
128
- var e, t;
129
- return ((t = (e = n.getFeatures()) == null ? void 0 : e.selection) == null ? void 0 : t.reserveAcrossPages) ?? !1;
130
- },
131
- getCascadeRecords: (e) => {
132
- var t, r;
133
- return (r = (t = n.getFeatures()) == null ? void 0 : t.selection) != null && r.cascade ? f.getCascadeRecords(e) : [e];
134
- },
135
- syncNativeSelection: O
136
- });
137
- const k = Ie({
138
- getRecordByKey: o.getByKey,
139
- getFieldValue: q,
140
- setCellValue: o.setCellValue,
141
- getValidator: (e) => {
142
- var r;
143
- const t = W();
144
- if (t)
145
- return (r = t.validators) == null ? void 0 : r[String(e)];
146
- },
147
- startNativeEditing: ae,
148
- cancelNativeEditing: () => {
149
- var e;
150
- return (e = s.getInstance()) == null ? void 0 : e.cancelEditCell();
151
- },
152
- onCommit: n.onEditCommit,
153
- onError: n.onEditError
154
- }), g = _e({
155
- columns: n.getColumns,
156
- columnsKey: () => {
157
- var e;
158
- return (e = P()) == null ? void 0 : e.columnsKey;
159
- },
160
- persistent: () => {
161
- var e;
162
- return !!((e = P()) != null && e.persistent);
163
- },
164
- schemaVersion: h == null ? void 0 : h.schemaVersion,
165
- writeDelay: h == null ? void 0 : h.writeDelay,
166
- storage: h == null ? void 0 : h.storage,
167
- onPreferencesChange: n.onColumnPreferencesChange
168
- }), Y = Q(() => C.value === "none" ? g.columns.value : [{
169
- key: A,
170
- field: A,
171
- title: "",
172
- width: 44,
173
- minWidth: 44,
174
- maxWidth: 44,
175
- frozen: "left",
176
- native: C.value === "multiple" ? { cellType: "checkbox", headerType: "checkbox" } : { cellType: "radio", radioCheckType: "column" }
177
- }, ...g.columns.value]);
178
- function G() {
179
- return {
180
- page: i.page.value,
181
- pageSize: i.pageSize.value,
182
- queryParams: n.getQueryParams(),
183
- sort: F.value,
184
- filters: D.value
185
- };
186
- }
187
- R && (m = Ae({
188
- fetchRecords: (e) => n.fetchRecords(e),
189
- getRequestSnapshot: G,
190
- replaceRecords: o.replaceAll,
191
- setTotal: i.setRemoteTotal,
192
- immediate: !1,
193
- onSuccess: n.onFetchSuccess,
194
- onError: n.onFetchError
195
- }), Se(n.getQueryParams, E, {
196
- immediate: ((H = (z = n.getFeatures()) == null ? void 0 : z.query) == null ? void 0 : H.immediate) ?? !0
197
- }));
198
- const J = v(!1), X = v(), Z = m ?? {
199
- isFetching: J,
200
- error: X,
201
- fetch: async () => !1,
202
- refresh: async () => !1,
203
- cancel: () => {
204
- }
205
- };
206
- function _() {
207
- const e = s.getInstance();
208
- if (!e || !p.value)
209
- throw x("TT_VTABLE_NOT_READY", "原生 VTable 实例尚未就绪。", {});
210
- return e;
211
- }
212
- function I(e, t) {
213
- var a;
214
- const r = o.getRecordIndex(e);
215
- if (r === void 0) return;
216
- const c = (a = s.getInstance()) == null ? void 0 : a.getCellAddrByFieldRecord(t, r);
217
- if (!(!c || c.col < 0 || c.row < 0))
218
- return c;
219
- }
220
- function ee() {
221
- _(), s.recalculate();
222
- }
223
- function te(e) {
224
- const t = _(), r = o.getRecordIndex(e);
225
- if (r === void 0)
226
- throw x("TT_VTABLE_RECORD_NOT_FOUND", `未找到 rowKey ${String(e)}。`, { rowKey: e });
227
- t.scrollToRow(t.getBodyRowIndexByRecordIndex(r), !1);
228
- }
229
- function re(e, t) {
230
- const r = _(), c = I(e, t);
231
- if (!c)
232
- throw x("TT_VTABLE_RECORD_NOT_FOUND", `未找到 rowKey ${String(e)} 对应单元格。`, {
233
- rowKey: e,
234
- field: t
235
- });
236
- r.scrollToCell(c);
237
- }
238
- const ne = {
239
- records: o,
240
- query: Z,
241
- pagination: i,
242
- selection: u,
243
- columns: {
244
- columns: g.columns,
245
- replaceAll: g.replaceAll,
246
- show: g.show,
247
- hide: g.hide,
248
- move: g.move,
249
- resetPreferences: g.resetPreferences
250
- },
251
- editing: k,
252
- tree: f,
253
- layout: {
254
- isReady: p,
255
- width: V,
256
- height: b,
257
- recalculate: ee,
258
- scrollToRecord: te,
259
- scrollToCell: re
260
- },
261
- native: {
262
- getInstance: s.getInstance
263
- }
264
- };
265
- function O(e) {
266
- const t = s.getInstance();
267
- if (!t || C.value === "none") return;
268
- const r = new Set(e);
269
- o.getAll().forEach((c) => {
270
- const a = o.getRowKey(c), d = o.getRecordIndex(a);
271
- if (d === void 0) return;
272
- if (C.value === "multiple") {
273
- t.setCellCheckboxStateByRecordIndex(d, A, r.has(a));
274
- return;
275
- }
276
- if (!r.has(a)) return;
277
- const y = t.getCellAddrByFieldRecord(A, d);
278
- y && t.setCellRadioState(y.col, y.row);
279
- });
280
- }
281
- function L() {
282
- var e, t;
283
- !s.getInstance() || R || ((e = n.getFeatures()) == null ? void 0 : e.pagination) === !1 || !((t = n.getFeatures()) != null && t.pagination) || s.updatePagination({
284
- currentPage: i.page.value - 1,
285
- perPageCount: i.pageSize.value
286
- });
287
- }
288
- function ce(e, t) {
289
- const r = g.columns.value.find((y) => y.tree && y.field !== void 0);
290
- if (!(r != null && r.field)) return;
291
- const c = I(e, r.field), a = s.getInstance();
292
- if (!a || !c) return;
293
- M(a.getHierarchyState(c.col, c.row)) !== t && a.toggleHierarchyState(c.col, c.row);
294
- }
295
- function oe(e, t) {
296
- var a;
297
- if (!t) return;
298
- const r = g.columns.value.find((d) => d.tree && d.field !== void 0);
299
- if (!(r != null && r.field)) return;
300
- const c = I(e, r.field);
301
- c && ((a = s.getInstance()) == null || a.setLoadingHierarchyState(c.col, c.row));
302
- }
303
- function ae(e, t) {
304
- const r = _(), c = I(e, t);
305
- if (!c)
306
- throw x("TT_VTABLE_RECORD_NOT_FOUND", `未找到 rowKey ${String(e)} 对应编辑单元格。`, {
307
- rowKey: e,
308
- field: t
309
- });
310
- r.startEditCell(c.col, c.row);
311
- }
312
- function se(e) {
313
- if (B(e.originData)) {
314
- u.onNativeSelectionChange(e.originData, e.checked);
315
- return;
316
- }
317
- if (e.checked) {
318
- u.selectCurrentPage();
319
- return;
320
- }
321
- const t = new Set(i.pageRecords.value.map(o.getRowKey));
322
- u.setKeys(u.keys.value.filter((r) => !t.has(r)));
323
- }
324
- function ie(e) {
325
- B(e.originData) && u.onNativeSelectionChange(e.originData, !0);
326
- }
327
- function le(e) {
328
- B(e.originData) && f.onNativeHierarchyChange(e.originData, M(e.hierarchyState));
329
- }
330
- function de(e) {
331
- var c, a, d;
332
- const t = ve(e.field) ? e.field : String(e.field), r = e.order === "asc" || e.order === "desc" ? [{ field: t, order: e.order }] : [];
333
- if (F.value = r, (c = n.onSortChange) == null || c.call(n, r), !R) return !0;
334
- if (((d = (a = n.getFeatures()) == null ? void 0 : a.query) == null ? void 0 : d.resetPageOnSort) ?? !0) {
335
- const y = i.page.value;
336
- i.reset(), i.page.value === y && E();
337
- } else
338
- E();
339
- return !0;
340
- }
341
- function ue(e) {
342
- const t = e.on("checkbox_state_change", se), r = e.on("radio_state_change", ie), c = e.on("tree_hierarchy_state_change", le), a = e.on("sort_click", de), d = Ee(e, n.getNativeEvents());
343
- return () => {
344
- e.off(t), e.off(r), e.off(c), e.off(a), d();
345
- };
346
- }
347
- function ge(e) {
348
- K || (l == null || l(), s.setInstance(e), l = ue(e), p.value = !0, o.syncToEngine(), L(), O(u.keys.value), f.syncExpandedState());
349
- }
350
- function fe(e) {
351
- s.getInstance() === e && (l == null || l(), l = void 0, p.value = !1, s.setInstance(void 0));
352
- }
353
- function he(e, t) {
354
- V.value = e, b.value = t;
355
- }
356
- function me(e) {
357
- R || o.replaceAll(e);
358
- }
359
- function Re() {
360
- K || (K = !0, l == null || l(), l = void 0, m == null || m.cancel(), k.release(), f.release(), o.release(), p.value = !1, s.release());
361
- }
362
- return {
363
- tableApi: ne,
364
- renderColumns: Y,
365
- isRemote: R,
366
- selectionMode: C,
367
- sort: F,
368
- filters: D,
369
- getRowKey: o.getRowKey,
370
- acceptNativeInstance: ge,
371
- clearNativeInstance: fe,
372
- acceptViewportSize: he,
373
- acceptRecords: me,
374
- release: Re
375
- };
376
- }
377
- export {
378
- A as TT_VTABLE_SELECTION_FIELD,
379
- ot as createVTableRuntime
380
- };