@dazhicheng/ui 1.5.266 → 1.6.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.
Files changed (182) hide show
  1. package/dist/components/tt-api-component/index.js +4 -3
  2. package/dist/components/tt-api-component/index.vue2.js +4 -3
  3. package/dist/components/tt-area/TtArea.vue.js +1 -1
  4. package/dist/components/tt-area/TtArea.vue3.js +8 -7
  5. package/dist/components/tt-button/index.js +5 -4
  6. package/dist/components/tt-button/index.vue2.js +4 -3
  7. package/dist/components/tt-checkbox/index.js +4 -3
  8. package/dist/components/tt-checkbox/index.vue.js +4 -3
  9. package/dist/components/tt-drawer/index.js +4 -3
  10. package/dist/components/tt-drawer/src/RenderDrawer.vue.js +4 -3
  11. package/dist/components/tt-drawer/src/components/DrawerFooter.vue.js +8 -7
  12. package/dist/components/tt-drawer/src/components/DrawerHeader.vue.js +2 -2
  13. package/dist/components/tt-drawer/src/components/DrawerHeader.vue2.js +3 -2
  14. package/dist/components/tt-drawer/src/hooks/useResizable.js +2 -2
  15. package/dist/components/tt-drawer/src/props.js +3 -2
  16. package/dist/components/tt-drawer/src/utils/drawer-api.js +4 -2
  17. package/dist/components/tt-empty/index.js +9 -8
  18. package/dist/components/tt-form/index.js +10 -9
  19. package/dist/components/tt-form/src/components/ExpandableArrow.vue2.js +3 -2
  20. package/dist/components/tt-form/src/components/FormActions.vue2.js +4 -2
  21. package/dist/components/tt-form/src/form/FormDescription.vue.js +3 -2
  22. package/dist/components/tt-form/src/form/FormItem.vue.js +6 -5
  23. package/dist/components/tt-form/src/form/FormLabel.vue.js +8 -7
  24. package/dist/components/tt-form/src/form/RenderContent.vue.js +4 -3
  25. package/dist/components/tt-form/src/form-render/FormField.vue2.js +30 -28
  26. package/dist/components/tt-form/src/form-render/FormLabel.vue2.js +4 -2
  27. package/dist/components/tt-form/src/form-render/array-register/FormArrayRegister.d.ts +3 -3
  28. package/dist/components/tt-form/src/form-render/array-register/FormArrayRegister.js +1 -0
  29. package/dist/components/tt-form/src/form-render/array-register/utils.js +6 -4
  30. package/dist/components/tt-form/src/form-render/dependencies.js +19 -18
  31. package/dist/components/tt-form/src/form-render/form.vue2.js +4 -2
  32. package/dist/components/tt-form/src/form-render/helper.js +15 -14
  33. package/dist/components/tt-form/src/form-render/rootWrapperClass.js +3 -2
  34. package/dist/components/tt-form/src/formApi.js +3 -2
  35. package/dist/components/tt-form/src/group-form/GroupForm.vue2.js +4 -3
  36. package/dist/components/tt-form/src/group-form/GroupSection.vue2.js +2 -0
  37. package/dist/components/tt-form/src/group-form/LazyFormField.vue.js +4 -2
  38. package/dist/components/tt-form/src/group-form/groupFormApi.js +4 -3
  39. package/dist/components/tt-form/src/hooks/useForwardPriorityValues.js +3 -2
  40. package/dist/components/tt-form/src/hooks/useSelectCollapse.js +28 -27
  41. package/dist/components/tt-form/src/index.vue2.js +3 -2
  42. package/dist/components/tt-form/src/useFormContext.js +11 -10
  43. package/dist/components/tt-form-item-error-tooltip/index.js +5 -4
  44. package/dist/components/tt-form-item-error-tooltip/index.vue.js +4 -3
  45. package/dist/components/tt-icon/index.js +6 -5
  46. package/dist/components/tt-icon/index.vue.js +2 -2
  47. package/dist/components/tt-image/index.js +6 -5
  48. package/dist/components/tt-image/src/components/ImageViewer.js +7 -6
  49. package/dist/components/tt-loading/index.js +4 -3
  50. package/dist/components/tt-loading/src/directive.js +24 -23
  51. package/dist/components/tt-loading/src/loading.vue.js +2 -2
  52. package/dist/components/tt-log/index.js +4 -3
  53. package/dist/components/tt-log/index.vue.js +3 -2
  54. package/dist/components/tt-modal/index.js +3 -2
  55. package/dist/components/tt-modal/src/RenderModal.vue.js +3 -2
  56. package/dist/components/tt-modal/src/components/ModalFooter.vue2.js +3 -2
  57. package/dist/components/tt-modal/src/components/ModalHeader.vue2.js +3 -2
  58. package/dist/components/tt-modal/src/components/ModalWrapper.vue.js +15 -14
  59. package/dist/components/tt-modal/src/props.js +3 -2
  60. package/dist/components/tt-modal/src/utils/modal-api.js +4 -2
  61. package/dist/components/tt-modal-form/index.vue.js +4 -3
  62. package/dist/components/tt-nav-anchor/index.js +4 -3
  63. package/dist/components/tt-nav-anchor/src/TtNavAnchor.vue.js +15 -14
  64. package/dist/components/tt-panel-select/index.js +4 -3
  65. package/dist/components/tt-panel-select/src/components/PanelMiddle.vue.d.ts +2 -2
  66. package/dist/components/tt-panel-select/src/hooks/usePanelData.js +95 -87
  67. package/dist/components/tt-panel-select/src/index.vue.js +4 -2
  68. package/dist/components/tt-radio-group/index.js +4 -3
  69. package/dist/components/tt-radio-group/index.vue.js +7 -6
  70. package/dist/components/tt-select/index.js +4 -3
  71. package/dist/components/tt-select/src/Select.vue.d.ts +12 -12
  72. package/dist/components/tt-select/src/Select.vue.js +4 -3
  73. package/dist/components/tt-select/src/components/SelectTable.vue.d.ts +116 -7
  74. package/dist/components/tt-select/src/components/SelectTable.vue.js +3 -2
  75. package/dist/components/tt-select/src/components/Table.vue.d.ts +8 -8
  76. package/dist/components/tt-select/src/components/Table.vue.js +3 -2
  77. package/dist/components/tt-select/src/hooks/useDataSource.js +4 -3
  78. package/dist/components/tt-select/src/hooks/useKeyboard.d.ts +7 -1
  79. package/dist/components/tt-select/src/hooks/useSelect.js +3 -2
  80. package/dist/components/tt-select/src/hooks/useSelectTableEvent.d.ts +1 -1
  81. package/dist/components/tt-select/src/hooks/useSelectTableEvent.js +28 -27
  82. package/dist/components/tt-select/src/props.d.ts +2 -2
  83. package/dist/components/tt-table/index.d.ts +526 -361
  84. package/dist/components/tt-table/index.js +7 -5
  85. package/dist/components/tt-table/src/Table.vue.d.ts +308 -218
  86. package/dist/components/tt-table/src/Table.vue.js +406 -618
  87. package/dist/components/tt-table/src/TableForm.vue.d.ts +384 -19
  88. package/dist/components/tt-table/src/TableForm.vue.js +219 -229
  89. package/dist/components/tt-table/src/components/TableAction.vue.js +110 -131
  90. package/dist/components/tt-table/src/components/TableButtons.js +30 -29
  91. package/dist/components/tt-table/src/components/TableColumnModal.vue2.js +88 -84
  92. package/dist/components/tt-table/src/components/TableToolbarTools.vue.d.ts +80 -0
  93. package/dist/components/tt-table/src/components/{TableToobalTools.vue.js → TableToolbarTools.vue.js} +34 -35
  94. package/dist/components/tt-table/src/components/TableToolbarTools.vue2.js +4 -0
  95. package/dist/components/tt-table/src/emits.d.ts +10 -1
  96. package/dist/components/tt-table/src/emits.js +2 -1
  97. package/dist/components/tt-table/src/hooks/useColumnPersistence.d.ts +19 -0
  98. package/dist/components/tt-table/src/hooks/useColumnPersistence.js +64 -0
  99. package/dist/components/tt-table/src/hooks/useColumns.d.ts +505 -21
  100. package/dist/components/tt-table/src/hooks/useColumns.js +101 -245
  101. package/dist/components/tt-table/src/hooks/useGridProps.d.ts +36 -0
  102. package/dist/components/tt-table/src/hooks/useGridProps.js +121 -0
  103. package/dist/components/tt-table/src/hooks/useKeyboardNav.d.ts +11 -0
  104. package/dist/components/tt-table/src/hooks/useKeyboardNav.js +98 -0
  105. package/dist/components/tt-table/src/hooks/usePagination.d.ts +14 -8
  106. package/dist/components/tt-table/src/hooks/usePagination.js +30 -33
  107. package/dist/components/tt-table/src/hooks/useQuery.d.ts +41 -0
  108. package/dist/components/tt-table/src/hooks/useQuery.js +148 -0
  109. package/dist/components/tt-table/src/hooks/useRowIdentity.d.ts +22 -0
  110. package/dist/components/tt-table/src/hooks/useRowIdentity.js +97 -0
  111. package/dist/components/tt-table/src/hooks/useRowSelection.d.ts +24 -12
  112. package/dist/components/tt-table/src/hooks/useRowSelection.js +95 -70
  113. package/dist/components/tt-table/src/hooks/{useLeftRightSlot.d.ts → useSideSlot.d.ts} +25 -17
  114. package/dist/components/tt-table/src/hooks/useSideSlot.js +78 -0
  115. package/dist/components/tt-table/src/hooks/useSyncProps.d.ts +12 -0
  116. package/dist/components/tt-table/src/hooks/useSyncProps.js +56 -0
  117. package/dist/components/tt-table/src/hooks/useTableData.d.ts +71 -0
  118. package/dist/components/tt-table/src/hooks/useTableData.js +308 -0
  119. package/dist/components/tt-table/src/hooks/useTableFooter.d.ts +15 -0
  120. package/dist/components/tt-table/src/hooks/useTableFooter.js +47 -0
  121. package/dist/components/tt-table/src/hooks/useTableForm.d.ts +10 -5
  122. package/dist/components/tt-table/src/hooks/useTableForm.js +56 -48
  123. package/dist/components/tt-table/src/hooks/useTableMethods.d.ts +165 -0
  124. package/dist/components/tt-table/src/hooks/useTableMethods.js +183 -0
  125. package/dist/components/tt-table/src/hooks/useTableRender.d.ts +57 -55
  126. package/dist/components/tt-table/src/props.d.ts +326 -153
  127. package/dist/components/tt-table/src/props.js +125 -271
  128. package/dist/components/tt-table/src/table-defaults.d.ts +25 -0
  129. package/dist/components/tt-table/src/table-defaults.js +71 -0
  130. package/dist/components/tt-table/src/table-mutation-events.d.ts +43 -0
  131. package/dist/components/tt-table/src/table-mutation-events.js +71 -0
  132. package/dist/components/tt-table/src/types/table.d.ts +223 -88
  133. package/dist/components/tt-table/src/types/tableAction.d.ts +23 -0
  134. package/dist/components/tt-table/src/types/tableForm.d.ts +15 -26
  135. package/dist/components/tt-table/src/utils/action-tab-index.d.ts +2 -0
  136. package/dist/components/tt-table/src/utils/action-tab-index.js +51 -0
  137. package/dist/components/tt-table/src/utils/context.js +26 -12
  138. package/dist/components/tt-table/src/utils/table-api.d.ts +136 -58
  139. package/dist/components/tt-table/src/utils/table-api.js +200 -165
  140. package/dist/components/tt-table/src/utils/table-form-api.d.ts +11 -11
  141. package/dist/components/tt-table/src/utils/table-form-api.js +35 -23
  142. package/dist/components/tt-text/index.js +4 -3
  143. package/dist/components/tt-upload/index.js +6 -5
  144. package/dist/components/tt-upload/src/TtUpload.vue.js +4 -3
  145. package/dist/components/types.d.ts +0 -20
  146. package/dist/directives/disabled-tip/index.js +9 -8
  147. package/dist/hooks/useFormSchemasLink.js +4 -3
  148. package/dist/hooks/useFormat.d.ts +35 -71
  149. package/dist/hooks/useFormat.js +28 -39
  150. package/dist/hooks/usePanelSelectSchemas.js +4 -3
  151. package/dist/hooks/useScreenshotOss.js +16 -15
  152. package/dist/hooks/useSetup.js +0 -3
  153. package/dist/packages/hooks/src/useDebounce.js +6 -5
  154. package/dist/packages/hooks/src/useElementScreenshot.js +4 -3
  155. package/dist/packages/hooks/src/usePriorityValue.js +5 -4
  156. package/dist/packages/utils/src/format.js +48 -0
  157. package/dist/packages/utils/src/is.js +20 -18
  158. package/dist/packages/utils/src/tool.js +76 -149
  159. package/dist/plugins/default/renderCellContent.js +4 -3
  160. package/dist/plugins/vxeTable/switchStatus.js +14 -13
  161. package/dist/style.css +1 -1
  162. package/package.json +3 -3
  163. package/dist/components/tt-table/src/components/TableToobalTools.vue.d.ts +0 -576
  164. package/dist/components/tt-table/src/components/TableToobalTools.vue2.js +0 -4
  165. package/dist/components/tt-table/src/enum.d.ts +0 -2
  166. package/dist/components/tt-table/src/hooks/useCellArea.d.ts +0 -15
  167. package/dist/components/tt-table/src/hooks/useCellArea.js +0 -15
  168. package/dist/components/tt-table/src/hooks/useCustomColumns.d.ts +0 -20
  169. package/dist/components/tt-table/src/hooks/useCustomColumns.js +0 -65
  170. package/dist/components/tt-table/src/hooks/useDataSource.d.ts +0 -29
  171. package/dist/components/tt-table/src/hooks/useDataSource.js +0 -232
  172. package/dist/components/tt-table/src/hooks/useLeftRightSlot.js +0 -64
  173. package/dist/components/tt-table/src/hooks/useTable.d.ts +0 -7
  174. package/dist/components/tt-table/src/hooks/useTableEvent.d.ts +0 -101
  175. package/dist/components/tt-table/src/hooks/useTableEvent.js +0 -197
  176. package/dist/components/tt-table/src/hooks/useTableFormEvent.d.ts +0 -10
  177. package/dist/components/tt-table/src/hooks/useTableHeight.d.ts +0 -15
  178. package/dist/components/tt-table/src/hooks/useTableSlot.d.ts +0 -11
  179. package/dist/components/tt-table/src/hooks/useTableSlot.js +0 -17
  180. package/dist/components/tt-table/src/utils/filters.d.ts +0 -109
  181. package/dist/components/tt-table/src/utils/vxeTable.d.ts +0 -28
  182. package/dist/packages/utils/src/check.js +0 -10
@@ -0,0 +1,308 @@
1
+ import "axios";
2
+ import "element-plus";
3
+ import { isString as L, isFunction as N, isObject as Re } from "../../../../packages/utils/src/is.js";
4
+ import { getCurrentInstance as he, shallowRef as J, watch as Q, unref as d, onBeforeUpdate as ve, getCurrentScope as Ce, onScopeDispose as Me, toValue as S, nextTick as P, isRef as be } 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
+ const De = /* @__PURE__ */ new Set([
17
+ "syncData",
18
+ "loadData",
19
+ "reloadData",
20
+ "setRow",
21
+ "revertData",
22
+ "reloadRow",
23
+ "loadTreeChildren",
24
+ "clearData",
25
+ "removeInsertRow",
26
+ "moveRowTo",
27
+ "reloadTreeExpand",
28
+ "undo",
29
+ "redo",
30
+ "pasteCellArea",
31
+ "importData",
32
+ "importByFile",
33
+ "insert",
34
+ "insertAt",
35
+ "insertNextAt",
36
+ "insertChild",
37
+ "insertChildAt",
38
+ "insertChildNextAt",
39
+ "remove",
40
+ "removeCheckboxRow",
41
+ "removeRadioRow",
42
+ "removeCurrentRow",
43
+ "commitProxy"
44
+ ]), Te = /* @__PURE__ */ new Set(["insert", "insert_edit", "insert_actived", "remove"]), xe = /* @__PURE__ */ new Set([
45
+ "setCheckboxRow",
46
+ "toggleCheckboxRow",
47
+ "setAllCheckboxRow",
48
+ "toggleAllCheckboxRow",
49
+ "clearCheckboxRow",
50
+ "clearCheckboxReserve",
51
+ "setRadioRow",
52
+ "clearRadioRow",
53
+ "clearRadioReserve"
54
+ ]), ye = /* @__PURE__ */ new Set(["loadData", "reloadData"]);
55
+ function X(l) {
56
+ const f = S(l);
57
+ if (f)
58
+ return be(f) ? f.value ?? [] : f;
59
+ }
60
+ function x(l) {
61
+ return !l || l();
62
+ }
63
+ async function ke(l, f, C, g = () => !0) {
64
+ const i = (l == null ? void 0 : l.getTreeExpandRecords()) || [], R = await C();
65
+ return f && i.length && g() && await (l == null ? void 0 : l.setTreeExpand(i, !0)), R;
66
+ }
67
+ function je(l, f, C, g, i) {
68
+ const R = he(), b = J([]), D = J();
69
+ let A = !1, s = !1, M = 0, h;
70
+ const q = Symbol("tt-table-emitted-rows-event");
71
+ let Y = 0, m, v = !1, T = 0, U = Promise.resolve();
72
+ function p() {
73
+ var t;
74
+ const e = ((t = R == null ? void 0 : R.vnode) == null ? void 0 : t.props) || {};
75
+ return "modelValue" in e || "model-value" in e;
76
+ }
77
+ function Z() {
78
+ var t;
79
+ const e = ((t = R == null ? void 0 : R.vnode) == null ? void 0 : t.props) || {};
80
+ return p() && ("onUpdate:modelValue" in e || "onUpdate:model-value" in e);
81
+ }
82
+ function _() {
83
+ const e = p() ? d(C) : void 0;
84
+ if (e != null && e.length) return "model";
85
+ const t = X(i.data);
86
+ return t != null && t.length ? "data" : p() ? "model" : "data";
87
+ }
88
+ function y(e) {
89
+ const t = U.then(e);
90
+ return U = t.then(
91
+ () => {
92
+ },
93
+ () => {
94
+ }
95
+ ), t;
96
+ }
97
+ function ee(e, t) {
98
+ return new Proxy(e, {
99
+ get(o, a, r) {
100
+ return a === q ? t : Reflect.get(o, a, r);
101
+ },
102
+ set(o, a, r) {
103
+ const u = Reflect.set(o, a, r);
104
+ return u && t === m && (v = !0), u;
105
+ },
106
+ deleteProperty(o, a) {
107
+ const r = Reflect.deleteProperty(o, a);
108
+ return r && t === m && (v = !0), r;
109
+ },
110
+ defineProperty(o, a, r) {
111
+ const u = Reflect.defineProperty(o, a, r);
112
+ return u && t === m && (v = !0), u;
113
+ }
114
+ });
115
+ }
116
+ function te(e) {
117
+ const t = e == null ? void 0 : e[q], n = m;
118
+ if (n === void 0 || t !== n) return !1;
119
+ const o = v;
120
+ return m = void 0, v = !1, !o;
121
+ }
122
+ function ne(e) {
123
+ P(() => {
124
+ m === e && (m = void 0, v = !1);
125
+ });
126
+ }
127
+ function V(e) {
128
+ const t = S(i.api), n = p(), o = Z(), a = o && !t;
129
+ o && (D.value = "model");
130
+ const r = a ? ++Y : void 0, u = r ? ee(e, r) : e;
131
+ m = r, v = !1, b.value = u, (o || !n) && (C.value = u, r && ne(r));
132
+ }
133
+ function k(e) {
134
+ var n;
135
+ const t = (n = d(f)) == null ? void 0 : n.getTableData();
136
+ return (e === "visible" ? t == null ? void 0 : t.visibleData : t == null ? void 0 : t.fullData) || [];
137
+ }
138
+ function O(e = "full") {
139
+ return s || !d(f) ? !1 : (h = void 0, V(k(e)), !0);
140
+ }
141
+ function j(e = "full") {
142
+ if (s || M || !d(b).length && !k(e).length) return;
143
+ if (h) {
144
+ e === "visible" && (h.source = e);
145
+ return;
146
+ }
147
+ const t = { inputVersion: T, source: e };
148
+ h = t, P().then(() => {
149
+ h === t && (h = void 0, !(s || M || t.inputVersion !== T) && O(t.source));
150
+ });
151
+ }
152
+ function z() {
153
+ h = void 0;
154
+ }
155
+ function oe() {
156
+ j();
157
+ }
158
+ async function F(e, t = "full") {
159
+ const n = T;
160
+ return y(async () => {
161
+ if (!s) {
162
+ M += 1;
163
+ try {
164
+ const o = await e();
165
+ return await P(), !s && n === T && O(t), o;
166
+ } finally {
167
+ M -= 1;
168
+ }
169
+ }
170
+ });
171
+ }
172
+ const K = /* @__PURE__ */ new WeakMap();
173
+ function re(e) {
174
+ const t = Reflect.get(e, "getRefMaps");
175
+ if (!N(t)) return;
176
+ const n = Reflect.apply(t, e, []);
177
+ return S(n.refTable);
178
+ }
179
+ function ie(e) {
180
+ if (L(e)) return e;
181
+ if (Re(e) && L(e.code)) return e.code;
182
+ }
183
+ function ae(e) {
184
+ return e.updateData();
185
+ }
186
+ function le(e, t) {
187
+ var n, o;
188
+ ye.has(e) && t[0] && ((n = i.prepareRows) == null || n.call(i, t[0])), e === "loadTreeChildren" && t[1] && ((o = i.prepareRows) == null || o.call(i, t[1]));
189
+ }
190
+ function se(e) {
191
+ if (!e) return;
192
+ const t = K.get(e);
193
+ if (t) return t;
194
+ const n = /* @__PURE__ */ new Map(), o = new Proxy(e, {
195
+ get(a, r, u) {
196
+ let c = Reflect.get(a, r, u);
197
+ if (!L(r)) return c;
198
+ const W = xe.has(r);
199
+ if (!W && !De.has(r)) return c;
200
+ let E = a;
201
+ if (!N(c)) {
202
+ const w = re(a);
203
+ w && (E = w, c = Reflect.get(w, r));
204
+ }
205
+ if (!N(c)) return c;
206
+ const $ = n.get(r);
207
+ if ($) return $;
208
+ const me = r === "undo" || r === "redo" ? "visible" : "full", G = (...w) => {
209
+ if (W) {
210
+ const B = Reflect.apply(c, E, w);
211
+ return Promise.resolve(B).then((we) => {
212
+ var H;
213
+ return (H = i.onSelectionMutated) == null || H.call(i), we;
214
+ });
215
+ }
216
+ if (le(r, w), r === "syncData") return F(() => ae(a));
217
+ if (r === "commitProxy") {
218
+ const B = ie(w[0]);
219
+ if (!Te.has(B || ""))
220
+ return Reflect.apply(c, E, w);
221
+ }
222
+ return F(() => Reflect.apply(c, E, w), me);
223
+ };
224
+ return n.set(r, G), G;
225
+ }
226
+ });
227
+ return K.set(e, o), o;
228
+ }
229
+ async function I(e, t) {
230
+ var c;
231
+ if (s || !x(t)) return !1;
232
+ const n = d(f);
233
+ if (!n) return !1;
234
+ const { treeConfig: o, clearTreeExpand: a, mergeCells: r } = d(l), u = n.getTreeExpandRecords();
235
+ M += 1;
236
+ try {
237
+ return (c = i.prepareRows) == null || c.call(i, e), await n.loadData(e), s || !x(t) || r && (await n.setMergeCells(r), s || !x(t)) || (a ? await n.clearTreeExpand() : u.length && (o != null && o.reserve) && await n.setTreeExpand(u, !0), s || !x(t)) ? !1 : (b.value = e, g("load-data"), !0);
238
+ } finally {
239
+ M -= 1;
240
+ }
241
+ }
242
+ function ue(e, t) {
243
+ return y(() => I(e, t));
244
+ }
245
+ function fe(e, t) {
246
+ return y(async () => !await I(e, t) || s || !x(t) ? !1 : (V(e), !0));
247
+ }
248
+ function ce(e, t) {
249
+ return y(async () => {
250
+ var o;
251
+ if (await P(), s || !t()) return !1;
252
+ const n = ((o = d(f)) == null ? void 0 : o.getTableData().fullData) || [];
253
+ return !e.length && !d(b).length && !n.length ? !1 : I(e, t);
254
+ });
255
+ }
256
+ function de() {
257
+ var e;
258
+ return ((e = d(f)) == null ? void 0 : e.getTableData().visibleData) || [];
259
+ }
260
+ function pe() {
261
+ const { api: e, data: t } = i;
262
+ if (S(e)) return;
263
+ if (D.value === "model" && p()) return d(C) || [];
264
+ const n = X(t);
265
+ return n !== void 0 ? n : p() ? d(C) || [] : void 0;
266
+ }
267
+ return D.value = _(), A = p(), Q(
268
+ () => p() ? d(C) : void 0,
269
+ () => {
270
+ p() && (D.value = "model");
271
+ },
272
+ { deep: 1, flush: "post" }
273
+ ), Q(
274
+ pe,
275
+ (e, t, n) => {
276
+ let o = !0;
277
+ n(() => {
278
+ o = !1;
279
+ }), !te(e) && (T += 1, z(), e && ce(e, () => o).catch((a) => {
280
+ }));
281
+ },
282
+ { immediate: !0, deep: 1, flush: "post" }
283
+ ), ve(() => {
284
+ const e = p();
285
+ e !== A && (A = e, D.value = _());
286
+ }), Ce() && Me(() => {
287
+ s = !0, h = void 0, m = void 0, v = !1;
288
+ }), {
289
+ rows: b,
290
+ loadRows: ue,
291
+ applyRows: fe,
292
+ emitRows: V,
293
+ getDataSource: de,
294
+ runDataOperation: F,
295
+ scheduleRowsCommit: j,
296
+ cancelRowsCommit: z,
297
+ onDataChange: oe,
298
+ commitRows: O,
299
+ createTableInstanceFacade: se,
300
+ /** 判断表格作用域是否仍然有效。 */
301
+ isActive: () => !s
302
+ };
303
+ }
304
+ export {
305
+ X as getExternalRowsValue,
306
+ je as useTableData,
307
+ ke as withTreeExpand
308
+ };
@@ -0,0 +1,15 @@
1
+ import { ComputedRef } from 'vue';
2
+ import { VxeTablePropTypes } from 'vxe-table';
3
+ import { TtColumnOptions } from '../types/table';
4
+ /**
5
+ * 由列上的 `summary` 声明生成 vxe 的 `footerMethod`。
6
+ *
7
+ * vxe 要求 `footerMethod` 返回二维数组并按可见列顺序逐格对齐,而列顺序会被列设置与列拖拽改变,
8
+ * 所以对齐必须在 vxe 每次调用时按它传入的运行时可见列算,不能让调用方按下标写死。
9
+ * vxe 传入的 `data` 是 `afterFullData`(筛选排序后的完整数据),与 `getDataSource()` 口径一致,
10
+ * 与虚拟滚动的可视区无关。
11
+ * @param columnsRef 当前最终列配置
12
+ */
13
+ export declare function useTableFooter(columnsRef: ComputedRef<TtColumnOptions[]>): {
14
+ footerSummaryMethod: ComputedRef<VxeTablePropTypes.FooterMethod<any> | undefined>;
15
+ };
@@ -0,0 +1,47 @@
1
+ import "axios";
2
+ import "element-plus";
3
+ import { isFunction as s, isNumber as d } from "../../../../packages/utils/src/is.js";
4
+ import { computed as u, unref as a } 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 { get as l } from "lodash-es";
16
+ const c = "合计";
17
+ function h(i, m, f) {
18
+ const r = f.map((t) => l(t, m.field));
19
+ if (s(i)) return i({ values: r, rows: f, column: m });
20
+ if (i === "count") return f.length;
21
+ const e = r.filter(d), o = e.reduce((t, n) => t + n, 0);
22
+ return i === "avg" ? e.length ? o / e.length : 0 : o;
23
+ }
24
+ function z(i) {
25
+ const m = u(() => {
26
+ const r = /* @__PURE__ */ new Map(), e = (o) => {
27
+ o.forEach((t) => {
28
+ var n;
29
+ t.field && t.summary && r.set(t.field, t.summary), (n = t.children) != null && n.length && e(t.children);
30
+ });
31
+ };
32
+ return e(a(i)), r;
33
+ });
34
+ return { footerSummaryMethod: u(() => {
35
+ const r = a(m);
36
+ if (r.size)
37
+ return ({ columns: e, data: o }) => [
38
+ e.map((t, n) => {
39
+ const p = t.field ? r.get(t.field) : void 0;
40
+ return p ? h(p, t, o) : n === 0 ? c : "";
41
+ })
42
+ ];
43
+ }) };
44
+ }
45
+ export {
46
+ z as useTableFooter
47
+ };
@@ -1,15 +1,20 @@
1
1
  import { ComputedRef } from 'vue';
2
2
  import { TtFormProps } from '../../../tt-form';
3
3
  import { VxeGridPropTypes } from 'vxe-table';
4
+ import { Recordable } from '../../../../../../utils/src';
4
5
  import { FetchParams, TtTableProps } from '../types/table';
5
6
  import { TtTableFormProps } from '../types/tableForm';
6
7
  import { TtTableToolsProps } from '../types/tableTools';
7
- export declare function useTableForm(propsRef: ComputedRef<TtTableFormProps>, fetch: (opt?: FetchParams | undefined) => Promise<void>, getLoading: ComputedRef<boolean | undefined> | undefined, getPagination: () => VxeGridPropTypes.PagerConfig | undefined, emit: {
8
- (e: "update:table-data", data?: Recordable): void;
9
- }): {
10
- tableData: import('vue').Ref<Recordable<any>[], Recordable<any>[]>;
8
+ /**
9
+ * TableForm form / table 配置计算
10
+ * @param propsRef 表单+表格 props
11
+ * @param fetch 表格数据请求
12
+ * @param getLoading 表格 loading 状态
13
+ * @param getPagination 获取分页信息
14
+ */
15
+ export declare function useTableForm(propsRef: ComputedRef<TtTableFormProps>, fetch: (opt?: FetchParams | undefined) => Promise<void>, getLoading: ComputedRef<boolean | undefined> | undefined, getPagination: () => VxeGridPropTypes.PagerConfig | undefined): {
11
16
  getFormProps: ComputedRef<TtFormProps<Record<string, any>>>;
12
- handleSearchInfoChange: (info: Recordable) => Promise<void>;
17
+ submitSearchQuery: (info: Recordable) => Promise<void>;
13
18
  getTableProps: ComputedRef<Partial<TtTableProps>>;
14
19
  getTableToolProps: ComputedRef<TtTableToolsProps>;
15
20
  };
@@ -1,60 +1,68 @@
1
- import { omit as p, cloneDeep as y, isFunction as d, isEqual as T } from "lodash-es";
2
- import { ref as C, computed as f, unref as n, toValue as m, watch as D, watchEffect as E } from "vue";
3
- function B(o, w, g, F, I) {
4
- const r = C([]), b = f(() => {
5
- const { form: t } = n(o), { submitButtonOptions: e = {} } = t || {};
6
- return Object.assign(e, { loading: n(g) }), {
1
+ import "axios";
2
+ import "element-plus";
3
+ import { isFunction as m } from "../../../../packages/utils/src/is.js";
4
+ import { computed as c, unref as i, toValue as u } 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 { omit as p } from "lodash-es";
16
+ function j(n, h, l, d) {
17
+ const f = c(() => {
18
+ const { form: t } = i(n), o = {
19
+ ...t == null ? void 0 : t.submitButtonOptions,
20
+ loading: i(l)
21
+ };
22
+ return {
7
23
  ...t,
8
- submitButtonOptions: e
24
+ submitButtonOptions: o
9
25
  };
10
26
  });
11
- async function S(t) {
12
- const e = F(), a = { currentPage: 1, pageSize: e == null ? void 0 : e.pageSize };
13
- await w({ tablePage: a, searchInfo: t });
27
+ async function b(t) {
28
+ const o = d(), r = { currentPage: 1, pageSize: o == null ? void 0 : o.pageSize };
29
+ await h({ tablePage: r, searchInfo: t });
14
30
  }
15
- const P = f(() => {
16
- const { table: t = {}, tableRowId: e, useSearchForm: a, testId: s } = m(o), u = p(n(l), ["tableRowId"]);
17
- return y({
18
- useSearchForm: a || !1,
19
- // TODO: getProps 使用toRaw会导致堆栈溢出问题后续优化
20
- ...t,
21
- ...u,
22
- tableRowId: (t == null ? void 0 : t.tableRowId) || e,
23
- // 继承外层的 testId,如果 table.testId 未设置则使用外层的 testId
24
- testId: (t == null ? void 0 : t.testId) || s,
25
- beforeFetch: async (i) => {
26
- const { handleSearchInfoFn: h } = m(o);
27
- let c = i;
28
- return h && d(h) && (c = await h(c)), t != null && t.beforeFetch && d(t == null ? void 0 : t.beforeFetch) && (c = await (t == null ? void 0 : t.beforeFetch(c))), c;
29
- }
30
- });
31
- }), l = f(() => {
32
- const { columnsKey: t, showSetting: e, showSetColumn: a, showRefresh: s, showExport: u } = n(o).table || {}, { toolConfig: i } = n(o);
31
+ async function w(t) {
32
+ const { handleSearchInfoFn: o, table: r } = u(n);
33
+ let e = t;
34
+ return m(o) && (e = await o(e) || e), m(r == null ? void 0 : r.beforeFetch) && (e = await r.beforeFetch(e) || e), e;
35
+ }
36
+ const a = c(() => {
37
+ const { columnsKey: t, showSetting: o, showSetColumn: r, showRefresh: e, showExport: s } = i(n).table || {}, { toolConfig: F } = i(n);
33
38
  return {
34
39
  columnsKey: t,
35
- showSetting: e,
36
- showRefresh: s,
37
- showSetColumn: a,
38
- showExport: u,
39
- ...i
40
+ showSetting: o,
41
+ showRefresh: e,
42
+ showSetColumn: r,
43
+ showExport: s,
44
+ ...F
45
+ };
46
+ }), g = c(() => {
47
+ const { table: t = {}, tableRowId: o, useSearchForm: r, testId: e } = u(n), s = p(i(a), ["tableRowId"]);
48
+ return {
49
+ useSearchForm: r || !1,
50
+ // 数据由 TableForm 单独绑定,不进入表格配置。
51
+ ...p(t, ["data"]),
52
+ ...s,
53
+ tableRowId: (t == null ? void 0 : t.tableRowId) || o,
54
+ // 继承外层的 testId,如果 table.testId 未设置则使用外层的 testId
55
+ testId: (t == null ? void 0 : t.testId) || e,
56
+ beforeFetch: w
40
57
  };
41
58
  });
42
- return D(
43
- () => r.value,
44
- (t, e) => {
45
- T(t, e) || I("update:table-data", t);
46
- },
47
- { deep: !0 }
48
- ), E(() => {
49
- r.value = n(o).tableData || [];
50
- }), {
51
- tableData: r,
52
- getFormProps: b,
53
- handleSearchInfoChange: S,
54
- getTableProps: P,
55
- getTableToolProps: l
59
+ return {
60
+ getFormProps: f,
61
+ submitSearchQuery: b,
62
+ getTableProps: g,
63
+ getTableToolProps: a
56
64
  };
57
65
  }
58
66
  export {
59
- B as useTableForm
67
+ j as useTableForm
60
68
  };
@@ -0,0 +1,165 @@
1
+ import { ComputedRef, Ref } from 'vue';
2
+ import { VxeGridInstance, VxeTableDefines, VxeTablePropTypes } from 'vxe-table';
3
+ import { Recordable } from '../../../../../../utils/src';
4
+ import { InsertReturnData, TtTableExtendedTableApi, TtTableProps } from '../types/table';
5
+ /**
6
+ * 表格数据与编辑相关的实例方法
7
+ *
8
+ * 所有会改动表格数据的方法都经过 runDataOperation:操作完成后把表格内数据抛给 v-model,
9
+ * 外部原样回传时由 useTableData 的事件版本跳过重复落表。
10
+ * @param propsRef 表格 props
11
+ * @param grid vxe-grid 实例
12
+ * @param tableApi 表格 api
13
+ * @param ctx 表格上下文
14
+ * @param ctx.clearSelectedRowKeys 清除行选择
15
+ * @param ctx.getTableInstance 获取带变更桥接的 VXE 公共实例
16
+ * @param ctx.runDataOperation 统一执行内部数据变更
17
+ * @param ctx.isActive 判断表格作用域是否仍然有效
18
+ * @param ctx.prepareRows 数据进入 VXE 前的行身份预处理
19
+ */
20
+ export declare function useTableMethods(propsRef: ComputedRef<TtTableProps>, grid: Ref<undefined | VxeGridInstance<Recordable>>, tableApi: TtTableExtendedTableApi, { clearSelectedRowKeys, getTableInstance, runDataOperation, isActive, prepareRows, }: {
21
+ clearSelectedRowKeys: () => void;
22
+ getTableInstance: () => VxeGridInstance<Recordable>;
23
+ runDataOperation: <T>(operation: () => Promise<T> | T, source?: "full" | "visible") => Promise<T>;
24
+ isActive: () => boolean;
25
+ prepareRows: (rows: Recordable | Recordable[]) => void;
26
+ }): {
27
+ /**
28
+ * 从第一行插入临时数据
29
+ * @param records 新数据
30
+ */
31
+ insert: (records: VxeTablePropTypes.Row) => Promise<InsertReturnData>;
32
+ /**
33
+ * 在指定行插入临时数据
34
+ * @param records 新数据
35
+ * @param row 指定行,-1 表示插入到底部
36
+ */
37
+ insertAt: (records: VxeTablePropTypes.Row, row: any) => Promise<InsertReturnData>;
38
+ /** 在指定行之后插入临时数据 */
39
+ insertNextAt: (records: VxeTablePropTypes.Row, row: any) => Promise<InsertReturnData>;
40
+ /** 在树节点下插入临时子数据 */
41
+ insertChild: (records: VxeTablePropTypes.Row, parentRow: any) => Promise<InsertReturnData>;
42
+ /** 在树节点下的指定位置插入临时子数据 */
43
+ insertChildAt: (records: VxeTablePropTypes.Row, parentRow: any, row: any) => Promise<InsertReturnData>;
44
+ /** 在树节点下的指定行之后插入临时子数据 */
45
+ insertChildNextAt: (records: VxeTablePropTypes.Row, parentRow: any, row: any) => Promise<InsertReturnData>;
46
+ /**
47
+ * 删除指定行
48
+ * @param rows 指定行
49
+ */
50
+ remove: (rows: VxeTablePropTypes.Row) => Promise<InsertReturnData>;
51
+ /** 删除复选框选中的行 */
52
+ removeCheckboxRow: () => Promise<InsertReturnData>;
53
+ /** 删除单选框选中的行 */
54
+ removeRadioRow: () => Promise<InsertReturnData>;
55
+ /** 删除当前行 */
56
+ removeCurrentRow: () => Promise<InsertReturnData>;
57
+ /** 删除所有新增的临时数据 */
58
+ removeInsertRow: () => Promise<InsertReturnData>;
59
+ /** 清除表格的全部数据状态。该操作不改变业务行数据,无需触发 v-model 回写。 */
60
+ clearAll: () => Promise<void>;
61
+ /**
62
+ * 重新加载 VXE 当前同步数据,兼容旧的 syncData 入口。
63
+ * @deprecated VXE 已废弃 syncData,请使用 reloadData 或 getDataSource。
64
+ */
65
+ syncData: () => Promise<void>;
66
+ /** 重新计算 VXE 的排序、筛选数据视图。该操作不改变业务行数据。 */
67
+ updateData: () => Promise<void>;
68
+ /** 修改指定行数据 */
69
+ setRow: (rows: VxeTablePropTypes.Row | VxeTablePropTypes.Row[], record: VxeTablePropTypes.Row) => Promise<void>;
70
+ /**
71
+ * 退出编辑并还原行数据
72
+ * @param row 指定行
73
+ */
74
+ clearEditRevertData: (row: VxeTablePropTypes.Row) => Promise<void>;
75
+ /**
76
+ * 指定行激活编辑
77
+ * @param row 指定行
78
+ * @param fieldOrColumn 指定列
79
+ */
80
+ setEditRow: (row: VxeTablePropTypes.Row, fieldOrColumn?: boolean | string | VxeTableDefines.ColumnInfo) => Promise<void>;
81
+ /**
82
+ * 指定单元格激活编辑
83
+ * @param row 指定行
84
+ * @param fieldOrColumn 指定列
85
+ */
86
+ setEditCell: (row: VxeTablePropTypes.Row, fieldOrColumn: string | VxeTableDefines.ColumnInfo) => Promise<void>;
87
+ /**
88
+ * 加载数据
89
+ * @param rows 数据
90
+ */
91
+ loadData: (rows: VxeTablePropTypes.Row[]) => Promise<any>;
92
+ /**
93
+ * 加载数据并恢复到初始状态
94
+ * @param rows 数据
95
+ */
96
+ reloadData: (rows: VxeTablePropTypes.Row[]) => Promise<void>;
97
+ /**
98
+ * 重新加载列
99
+ * @param columns 列配置
100
+ */
101
+ reloadColumn: (columns: (VxeTableDefines.ColumnOptions<any> | VxeTableDefines.ColumnInfo<any>)[]) => Promise<any>;
102
+ /**
103
+ * 局部加载行数据并恢复到初始状态
104
+ * @param rows 行
105
+ * @param record 新数据
106
+ * @param field 指定字段名
107
+ */
108
+ reloadRow: (rows: VxeTablePropTypes.Row | VxeTablePropTypes.Row[], record?: VxeTablePropTypes.Row, field?: string) => Promise<void>;
109
+ /** 还原 keep-source 保存的行数据 */
110
+ revertData: (rows?: VxeTablePropTypes.Row | VxeTablePropTypes.Row[], field?: string) => Promise<any>;
111
+ /** 加载树节点的子数据 */
112
+ loadTreeChildren: (row: VxeTablePropTypes.Row, children: VxeTablePropTypes.Row[]) => Promise<any[]>;
113
+ /**
114
+ * 清空单元格内容
115
+ * @param rows 指定行,为空表示整个表格
116
+ * @param field 指定字段名
117
+ */
118
+ clearData: (rows: VxeTablePropTypes.Row | VxeTablePropTypes.Row[], field?: string) => Promise<any>;
119
+ /** 移动行到指定行位置 */
120
+ moveRowTo: (row: any, targetRow: any, options?: Recordable) => Promise<{
121
+ status: boolean;
122
+ }>;
123
+ /** 撤销最近一次数据操作 */
124
+ undo: () => Promise<{
125
+ status: boolean;
126
+ }>;
127
+ /** 重做最近一次数据操作 */
128
+ redo: () => Promise<{
129
+ status: boolean;
130
+ }>;
131
+ /**
132
+ * 重新懒加载展开行并展开内容
133
+ * @param rows 指定行
134
+ */
135
+ reloadRowExpand: (rows: VxeTablePropTypes.Row) => Promise<void>;
136
+ /**
137
+ * 重新懒加载树节点并展开该节点
138
+ * @param rows 指定行
139
+ */
140
+ reloadTreeExpand: (rows: VxeTablePropTypes.Row) => Promise<any>;
141
+ /**
142
+ * 设置空数据提示文字
143
+ * @param text 提示文字
144
+ */
145
+ setEmptyText: (text: string) => void;
146
+ /**
147
+ * 校验表格编辑数据。
148
+ *
149
+ * 只是 vxe 校验能力的门面,不加组件自己的校验逻辑,也不改动校验提示的渲染。
150
+ * 两个分支都传 `true`(校验当前表格全部数据):不传时 vxe 只校验临时变动过的行,
151
+ * 而这个方法的用途是提交前的整表校验。
152
+ * @param isFull `true` 走 vxe 的 fullValidate,逐行校验并收集所有错误;
153
+ * 缺省或 `false` 走 validate,遇到第一个不通过的记录即停止
154
+ * @returns 全部通过时为 `undefined`;否则为 vxe 原生形状 —— 以列字段为键,
155
+ * 值是该字段上每条违规的 `{ rules, row, rowIndex, column, columnIndex, field }`
156
+ */
157
+ validate: (isFull?: boolean) => Promise<undefined | VxeTableDefines.ValidatorErrorMapParams>;
158
+ /**
159
+ * 校验指定行的指定字段。
160
+ * @param row 行数据
161
+ * @param field 列字段名
162
+ * @returns 通过时为 `undefined`,否则为以列字段为键的错误映射
163
+ */
164
+ validateField: (row: VxeTablePropTypes.Row, field: string) => Promise<undefined | VxeTableDefines.ValidatorErrorMapParams>;
165
+ };