@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
@@ -1,15 +1,17 @@
1
- import { defineComponent as Q, ref as x, computed as b, createBlock as F, openBlock as f, unref as e, normalizeClass as a, createSlots as W, withCtx as s, createElementVNode as c, createVNode as r, createTextVNode as h, toDisplayString as $, createElementBlock as C, Fragment as w, renderList as T, createCommentVNode as X, withModifiers as Y, renderSlot as V } from "vue";
2
- import Z from "../../../../assets/svg/close.svg.js";
3
- import ee from "../../../../assets/svg/drag.svg.js";
1
+ import { defineComponent as X, ref as x, computed as b, createBlock as w, openBlock as p, unref as e, normalizeClass as a, createSlots as Y, withCtx as r, createElementVNode as m, createVNode as u, createTextVNode as h, toDisplayString as $, createElementBlock as C, Fragment as N, renderList as T, createCommentVNode as Z, withModifiers as ee, renderSlot as V } from "vue";
2
+ import le from "../../../../assets/svg/close.svg.js";
3
+ import te from "../../../../assets/svg/drag.svg.js";
4
4
  import { TtIcon as P } from "../../../tt-icon/index.js";
5
- import { TtText as le } from "../../../tt-text/index.js";
5
+ import { TtText as oe } from "../../../tt-text/index.js";
6
6
  import "../../../tt-modal/index.js";
7
- import { TtButton as te } from "../../../tt-button/index.js";
7
+ import { TtButton as ie } from "../../../tt-button/index.js";
8
8
  import "../../../../node_modules/.pnpm/vue-types@5.1.3_vue@3.5.21_typescript@5.9.3_/node_modules/vue-types/shim/index.modern.js";
9
- import { useDesign as oe } from "../../../../packages/hooks/src/useDesign.js";
9
+ import { useDesign as ne } from "../../../../packages/hooks/src/useDesign.js";
10
10
  import "axios";
11
- import { ElScrollbar as B, ElCheckbox as N, ElCheckboxGroup as ie, ElTooltip as ne } from "element-plus";
11
+ import { ElScrollbar as B, ElCheckbox as z, ElCheckboxGroup as ae, ElTooltip as se } from "element-plus";
12
+ import { isNumber as A } from "../../../../packages/utils/src/is.js";
12
13
  import "dayjs";
14
+ import "numeral";
13
15
  import "xe-utils";
14
16
  import "dayjs/plugin/utc";
15
17
  import "dayjs/plugin/timezone";
@@ -20,79 +22,81 @@ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mo
20
22
  import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
21
23
  import "lodash-es";
22
24
  import "vue-router";
23
- import ae from "sortablejs";
24
- import { useModalRender as se } from "../../../tt-modal/src/hooks/useModalRender.js";
25
- const re = ["aria-label", "onClick"], Be = /* @__PURE__ */ Q({
25
+ import re from "sortablejs";
26
+ import { useModalRender as ue } from "../../../tt-modal/src/hooks/useModalRender.js";
27
+ const de = ["aria-label", "onClick"], Ie = /* @__PURE__ */ X({
26
28
  __name: "TableColumnModal",
27
29
  props: {
28
30
  openColumn: { type: Function },
29
31
  openExport: { type: Function }
30
32
  },
31
33
  emits: ["on-submit"],
32
- setup(z, { expose: A, emit: I }) {
33
- const m = z, D = I, { prefixCls: n } = oe("table-column-modal"), [L, g] = se(), u = x([]), i = x([]), y = x(!1);
34
- let p = null;
35
- const E = b(
36
- () => i.value.map((t) => u.value.find((l) => l.field === t)).filter(Boolean)
37
- ), R = b(() => u.value.filter((t) => !t.locked)), G = b(() => i.value.filter((t) => !M(t))), S = b(() => G.value.length === R.value.length), O = b(() => i.value.length > 0 && !S.value);
34
+ setup(I, { expose: D, emit: L }) {
35
+ const c = I, R = L, { prefixCls: n } = ne("table-column-modal"), [G, g] = ue(), d = x([]), i = x([]), y = x(!1);
36
+ let v = null, E = null;
37
+ const S = b(
38
+ () => i.value.map((t) => d.value.find((l) => l.field === t)).filter(Boolean)
39
+ ), O = b(() => d.value.filter((t) => !t.locked)), U = b(() => i.value.filter((t) => !M(t))), F = b(() => U.value.length === O.value.length), j = b(() => i.value.length > 0 && !F.value);
38
40
  function M(t) {
39
- return u.value.some((l) => l.field === t && l.locked);
41
+ return d.value.some((l) => l.field === t && l.locked);
40
42
  }
41
- function U(t) {
42
- i.value = u.value.filter((l) => l.locked ? i.value.includes(l.field) : !!t).map((l) => l.field);
43
+ function q(t) {
44
+ i.value = d.value.filter((l) => l.locked ? i.value.includes(l.field) : !!t).map((l) => l.field);
43
45
  }
44
- function j(t) {
46
+ function H(t) {
45
47
  i.value = i.value.filter((l) => l !== t);
46
48
  }
47
- function q() {
49
+ function J() {
48
50
  i.value = i.value.filter(M);
49
51
  }
50
52
  function _() {
51
- D("on-submit", {
53
+ R("on-submit", {
52
54
  checkedModel: [...i.value],
53
55
  modalApi: g,
54
56
  isExport: y.value
55
57
  });
56
58
  }
57
- function H({ columns: t, displayFields: l = [], disabledColumnField: o, isExport: v }) {
58
- y.value = v ?? !1, u.value = t.filter((d) => d.field).map((d) => ({ ...d, locked: o.includes(d.field) }));
59
- const k = new Set(u.value.map((d) => d.field));
60
- i.value = [...new Set(l.filter((d) => k.has(d)))], g.openModal();
59
+ function K({ columns: t, displayFields: l = [], disabledColumnField: o, isExport: f }) {
60
+ y.value = f ?? !1, d.value = t.filter((s) => s.field).map((s) => ({ ...s, locked: o.includes(s.field) }));
61
+ const k = new Set(d.value.map((s) => s.field));
62
+ i.value = [...new Set(l.filter((s) => k.has(s)))], g.openModal();
61
63
  }
62
- function J(t) {
63
- p == null || p.destroy(), p = null, t && (p = ae.create(t, {
64
+ function Q(t) {
65
+ const l = t || null;
66
+ l !== E && (v == null || v.destroy(), v = null, E = l, l && (v = re.create(l, {
64
67
  animation: 300,
65
- onStart: (l) => l.item.style.opacity = "0",
66
- onEnd(l) {
67
- l.item.style.opacity = "1";
68
- const { oldIndex: o, newIndex: v } = l;
69
- if (o == null || v == null) return;
70
- const k = [...i.value];
71
- k.splice(v, 0, ...k.splice(o, 1)), i.value = k;
68
+ onStart: (o) => o.item.style.opacity = "0",
69
+ onEnd(o) {
70
+ o.item.style.opacity = "1";
71
+ const { oldIndex: f, newIndex: k } = o;
72
+ if (!A(f) || !A(k) || !Number.isFinite(f) || !Number.isFinite(k))
73
+ return;
74
+ const s = [...i.value];
75
+ s.splice(k, 0, ...s.splice(f, 1)), i.value = s;
72
76
  }
73
- }));
77
+ })));
74
78
  }
75
- function K() {
79
+ function W() {
76
80
  var t, l;
77
- y.value ? (t = m.openExport) == null || t.call(m, !0) : (l = m.openColumn) == null || l.call(m, !0);
81
+ y.value ? (t = c.openExport) == null || t.call(c, !0) : (l = c.openColumn) == null || l.call(c, !0);
78
82
  }
79
- return A({
83
+ return D({
80
84
  handleSubmit: _,
81
- openModal: H,
85
+ openModal: K,
82
86
  setModalProps(t) {
83
87
  g.setModalProps(t);
84
88
  }
85
- }), (t, l) => (f(), F(e(L), {
89
+ }), (t, l) => (p(), w(e(G), {
86
90
  width: "720",
87
91
  class: a(e(n)),
88
92
  onOk: _
89
- }, W({
90
- beforeFooter: s(() => [
91
- c("div", {
93
+ }, Y({
94
+ beforeFooter: r(() => [
95
+ m("div", {
92
96
  class: a(`${e(n)}-footer-left`)
93
97
  }, [
94
- r(e(te), { onClick: K }, {
95
- default: s(() => [...l[1] || (l[1] = [
98
+ u(e(ie), { onClick: W }, {
99
+ default: r(() => [...l[1] || (l[1] = [
96
100
  h("重置", -1)
97
101
  ])]),
98
102
  _: 1
@@ -100,43 +104,43 @@ const re = ["aria-label", "onClick"], Be = /* @__PURE__ */ Q({
100
104
  V(t.$slots, "beforeFooter")
101
105
  ], 2)
102
106
  ]),
103
- default: s(() => [
104
- c("div", {
107
+ default: r(() => [
108
+ m("div", {
105
109
  class: a(`${e(n)}-body`)
106
110
  }, [
107
- r(e(B), {
111
+ u(e(B), {
108
112
  class: a(`${e(n)}-source`)
109
113
  }, {
110
- default: s(() => [
111
- r(e(N), {
114
+ default: r(() => [
115
+ u(e(z), {
112
116
  class: a(`${e(n)}-all`),
113
- "model-value": S.value,
114
- indeterminate: O.value,
115
- onChange: U
117
+ "model-value": F.value,
118
+ indeterminate: j.value,
119
+ onChange: q
116
120
  }, {
117
- default: s(() => [
118
- h(" 全部(" + $(i.value.length) + "/" + $(u.value.length) + ") ", 1)
121
+ default: r(() => [
122
+ h(" 全部(" + $(i.value.length) + "/" + $(d.value.length) + ") ", 1)
119
123
  ]),
120
124
  _: 1
121
125
  }, 8, ["class", "model-value", "indeterminate"]),
122
- r(e(ie), {
126
+ u(e(ae), {
123
127
  modelValue: i.value,
124
128
  "onUpdate:modelValue": l[0] || (l[0] = (o) => i.value = o),
125
129
  class: a(`${e(n)}-group`)
126
130
  }, {
127
- default: s(() => [
128
- (f(!0), C(w, null, T(u.value, (o) => (f(), F(e(N), {
131
+ default: r(() => [
132
+ (p(!0), C(N, null, T(d.value, (o) => (p(), w(e(z), {
129
133
  key: o.field,
130
134
  value: o.field,
131
135
  disabled: o.locked
132
136
  }, {
133
- default: s(() => [
134
- r(e(ne), {
137
+ default: r(() => [
138
+ u(e(se), {
135
139
  content: o.title || "",
136
140
  "show-after": 400,
137
141
  placement: "top"
138
142
  }, {
139
- default: s(() => [
143
+ default: r(() => [
140
144
  h($(o.title || ""), 1)
141
145
  ]),
142
146
  _: 2
@@ -150,59 +154,59 @@ const re = ["aria-label", "onClick"], Be = /* @__PURE__ */ Q({
150
154
  ]),
151
155
  _: 1
152
156
  }, 8, ["class"]),
153
- c("div", {
157
+ m("div", {
154
158
  class: a(`${e(n)}-picked`)
155
159
  }, [
156
- c("header", {
160
+ m("header", {
157
161
  class: a(`${e(n)}-picked-head`)
158
162
  }, [
159
- c("span", null, "已选 " + $(E.value.length) + " 列", 1),
160
- c("span", {
163
+ m("span", null, "已选 " + $(S.value.length) + " 列", 1),
164
+ m("span", {
161
165
  class: a(`${e(n)}-clear`),
162
- onClick: q
166
+ onClick: J
163
167
  }, "清空", 2)
164
168
  ], 2),
165
- r(e(B), null, {
166
- default: s(() => [
167
- c("ul", {
168
- ref: J,
169
+ u(e(B), null, {
170
+ default: r(() => [
171
+ m("ul", {
172
+ ref: Q,
169
173
  class: a(`${e(n)}-list`)
170
174
  }, [
171
- (f(!0), C(w, null, T(E.value, (o) => (f(), C("li", {
175
+ (p(!0), C(N, null, T(S.value, (o) => (p(), C("li", {
172
176
  key: o.field,
173
177
  class: a(`${e(n)}-item`)
174
178
  }, [
175
- c("span", {
179
+ m("span", {
176
180
  class: a(`${e(n)}-item-main`)
177
181
  }, [
178
- r(e(P), {
182
+ u(e(P), {
179
183
  class: a(`${e(n)}-item-drag`),
180
184
  size: 14,
181
- icon: e(ee),
185
+ icon: e(te),
182
186
  "is-custom-svg": ""
183
187
  }, null, 8, ["class", "icon"]),
184
- r(e(le), {
188
+ u(e(oe), {
185
189
  "tool-tip": !1,
186
190
  class: a(`${e(n)}-item-title`)
187
191
  }, {
188
- default: s(() => [
192
+ default: r(() => [
189
193
  h($(o.title || ""), 1)
190
194
  ]),
191
195
  _: 2
192
196
  }, 1032, ["class"])
193
197
  ], 2),
194
- o.locked ? X("", !0) : (f(), C("button", {
198
+ o.locked ? Z("", !0) : (p(), C("button", {
195
199
  key: 0,
196
200
  type: "button",
197
201
  class: a(`${e(n)}-item-remove`),
198
202
  "aria-label": `移除${o.title || ""}`,
199
- onClick: Y((v) => j(o.field), ["stop"])
203
+ onClick: ee((f) => H(o.field), ["stop"])
200
204
  }, [
201
- r(e(P), {
205
+ u(e(P), {
202
206
  size: 12,
203
- "icon-font": e(Z)
207
+ "icon-font": e(le)
204
208
  }, null, 8, ["icon-font"])
205
- ], 10, re))
209
+ ], 10, de))
206
210
  ], 2))), 128))
207
211
  ], 2)
208
212
  ]),
@@ -215,7 +219,7 @@ const re = ["aria-label", "onClick"], Be = /* @__PURE__ */ Q({
215
219
  }, [
216
220
  t.$slots.title ? {
217
221
  name: "header",
218
- fn: s(() => [
222
+ fn: r(() => [
219
223
  V(t.$slots, "title")
220
224
  ]),
221
225
  key: "0"
@@ -224,5 +228,5 @@ const re = ["aria-label", "onClick"], Be = /* @__PURE__ */ Q({
224
228
  }
225
229
  });
226
230
  export {
227
- Be as default
231
+ Ie as default
228
232
  };
@@ -0,0 +1,80 @@
1
+ import { Recordable } from '../../../../../../utils/src';
2
+ declare function __VLS_template(): {
3
+ attrs: Partial<{}>;
4
+ slots: Readonly<{
5
+ default: (props: Recordable) => void;
6
+ "toolbar-left": (props: Recordable) => void;
7
+ "toolbar-right": (props: Recordable) => void;
8
+ }> & {
9
+ default: (props: Recordable) => void;
10
+ "toolbar-left": (props: Recordable) => void;
11
+ "toolbar-right": (props: Recordable) => void;
12
+ };
13
+ refs: {};
14
+ rootEl: HTMLDivElement;
15
+ };
16
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
17
+ declare const __VLS_component: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
18
+ showSetting: {
19
+ type: BooleanConstructor;
20
+ default: boolean;
21
+ };
22
+ showRefresh: {
23
+ type: BooleanConstructor;
24
+ default: boolean;
25
+ };
26
+ showExport: {
27
+ type: BooleanConstructor;
28
+ default: boolean;
29
+ };
30
+ showSetColumn: {
31
+ type: BooleanConstructor;
32
+ default: boolean;
33
+ };
34
+ columnsKey: {
35
+ type: import('vue').PropType<string | (() => string)>;
36
+ default: string;
37
+ };
38
+ }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
39
+ "on-refresh": () => any;
40
+ "on-columns-setting": () => any;
41
+ "on-export": () => any;
42
+ }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
43
+ showSetting: {
44
+ type: BooleanConstructor;
45
+ default: boolean;
46
+ };
47
+ showRefresh: {
48
+ type: BooleanConstructor;
49
+ default: boolean;
50
+ };
51
+ showExport: {
52
+ type: BooleanConstructor;
53
+ default: boolean;
54
+ };
55
+ showSetColumn: {
56
+ type: BooleanConstructor;
57
+ default: boolean;
58
+ };
59
+ columnsKey: {
60
+ type: import('vue').PropType<string | (() => string)>;
61
+ default: string;
62
+ };
63
+ }>> & Readonly<{
64
+ "onOn-refresh"?: (() => any) | undefined;
65
+ "onOn-columns-setting"?: (() => any) | undefined;
66
+ "onOn-export"?: (() => any) | undefined;
67
+ }>, {
68
+ showSetting: boolean;
69
+ showRefresh: boolean;
70
+ showExport: boolean;
71
+ columnsKey: string | (() => string);
72
+ showSetColumn: boolean;
73
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
74
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
75
+ export default _default;
76
+ type __VLS_WithTemplateSlots<T, S> = T & {
77
+ new (): {
78
+ $slots: S;
79
+ };
80
+ };
@@ -1,9 +1,10 @@
1
- import { defineComponent as x, inject as E, computed as a, unref as o, ref as I, createElementBlock as s, openBlock as r, createBlock as f, createCommentVNode as d, withCtx as m, renderSlot as u, Fragment as b, renderList as B, createVNode as h } from "vue";
1
+ import { defineComponent as x, inject as E, computed as a, unref as e, ref as I, createElementBlock as s, openBlock as n, createBlock as d, createCommentVNode as f, withCtx as m, renderSlot as u, Fragment as b, renderList as B, createVNode as h } from "vue";
2
2
  import { TtIcon as $ } from "../../../tt-icon/index.js";
3
3
  import { TtButton as y } from "../../../tt-button/index.js";
4
4
  import "axios";
5
5
  import { ElSpace as A, ElTooltip as z } from "element-plus";
6
6
  import "dayjs";
7
+ import "numeral";
7
8
  import { generateTestId as N } from "../../../../packages/utils/src/testid-helper.js";
8
9
  import "xe-utils";
9
10
  import "dayjs/plugin/utc";
@@ -14,73 +15,71 @@ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/en
14
15
  import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
15
16
  import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
16
17
  import "lodash-es";
17
- import { toolProps as R } from "../toolProps.js";
18
- import V from "../../../../assets/svg/RiRefreshLine.svg.js";
19
- import j from "../../../../assets/svg/exportSvg.svg.js";
20
- import F from "../../../../assets/svg/columnSet.svg.js";
21
- const L = ["data-testid"], lt = /* @__PURE__ */ x({
22
- __name: "TableToobalTools",
23
- props: R,
18
+ import { toolProps as V } from "../toolProps.js";
19
+ import j from "../../../../assets/svg/RiRefreshLine.svg.js";
20
+ import F from "../../../../assets/svg/exportSvg.svg.js";
21
+ import L from "../../../../assets/svg/columnSet.svg.js";
22
+ const P = ["data-testid"], it = /* @__PURE__ */ x({
23
+ __name: "TableToolbarTools",
24
+ props: V,
24
25
  emits: ["on-refresh", "on-columns-setting", "on-export"],
25
26
  setup(k, { emit: g }) {
26
- const n = k, l = g, v = E(
27
+ const r = k, l = g, v = E(
27
28
  "tableIdContext",
28
29
  a(() => "")
29
- ), C = a(() => N(o(v), "table-toolbar-tools")), p = I(/* @__PURE__ */ new Set());
30
+ ), C = a(() => N(e(v), "table-toolbar-tools")), p = I(/* @__PURE__ */ new Set());
30
31
  function T(t, c) {
31
32
  p.value.add(t), c();
32
33
  }
33
- function _(t) {
34
+ function S(t) {
34
35
  p.value.delete(t);
35
36
  }
36
- const S = a(() => [
37
+ const _ = a(() => [
37
38
  {
38
39
  label: "自定义导出",
39
- icon: j,
40
+ icon: F,
40
41
  handler: () => l("on-export"),
41
- if: n.showExport
42
+ if: r.showExport
42
43
  },
43
44
  {
44
45
  label: "刷新",
45
- icon: V,
46
+ icon: j,
46
47
  handler: () => l("on-refresh"),
47
- if: n.showRefresh
48
+ if: r.showRefresh
48
49
  },
49
50
  {
50
51
  label: "列设置",
51
- icon: F,
52
+ icon: L,
52
53
  handler: () => l("on-columns-setting"),
53
- if: n.showSetColumn
54
+ if: r.showSetColumn
54
55
  }
55
56
  ]);
56
- return (t, c) => (r(), s("div", { "data-testid": C.value }, [
57
- t.showSetting ? (r(), f(o(A), {
57
+ return (t, c) => (n(), s("div", { "data-testid": C.value }, [
58
+ t.showSetting ? (n(), d(e(A), {
58
59
  key: 0,
59
60
  size: 12
60
61
  }, {
61
62
  default: m(() => [
62
63
  u(t.$slots, "toolbar-left"),
63
- (r(!0), s(b, null, B(S.value, (e, i) => (r(), s(b, { key: i }, [
64
- e.if ? (r(), f(o(z), {
64
+ (n(!0), s(b, null, B(_.value, (o, i) => (n(), s(b, { key: i }, [
65
+ o.if ? (n(), d(e(z), {
65
66
  key: 0,
66
- ref_for: !0,
67
- ref: "tooltipRef",
68
67
  class: "box-item",
69
68
  effect: "dark",
70
- content: e.label,
69
+ content: o.label,
71
70
  placement: "top",
72
71
  "show-after": 200
73
72
  }, {
74
73
  default: m(() => [
75
- h(o(y), {
74
+ h(e(y), {
76
75
  class: "icon-table-btn",
77
- "aria-label": e.label,
78
- onClick: (w) => T(i, e.handler),
79
- onAnimationend: (w) => _(i)
76
+ "aria-label": o.label,
77
+ onClick: (w) => T(i, o.handler),
78
+ onAnimationend: (w) => S(i)
80
79
  }, {
81
80
  default: m(() => [
82
- h(o($), {
83
- icon: e.icon,
81
+ h(e($), {
82
+ icon: o.icon,
84
83
  size: 14,
85
84
  "is-custom-svg": ""
86
85
  }, null, 8, ["icon"])
@@ -89,15 +88,15 @@ const L = ["data-testid"], lt = /* @__PURE__ */ x({
89
88
  }, 1032, ["aria-label", "onClick", "onAnimationend"])
90
89
  ]),
91
90
  _: 2
92
- }, 1032, ["content"])) : d("", !0)
91
+ }, 1032, ["content"])) : f("", !0)
93
92
  ], 64))), 128)),
94
93
  u(t.$slots, "toolbar-right")
95
94
  ]),
96
95
  _: 3
97
- })) : d("", !0)
98
- ], 8, L));
96
+ })) : f("", !0)
97
+ ], 8, P));
99
98
  }
100
99
  });
101
100
  export {
102
- lt as default
101
+ it as default
103
102
  };
@@ -0,0 +1,4 @@
1
+ import f from "./TableToolbarTools.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -1 +1,10 @@
1
- export declare const basicTableEmits: any[];
1
+ /**
2
+ * 表格透传给 vxe-table 的事件名,加上组件库自己的事件。
3
+ *
4
+ * 必须显式标注 `string[]`:`tableEmits` 来自没有类型声明的 vxe 内部路径,类型是 `any`,
5
+ * 展开进数组后会让整个数组退化为 `any[]`。Vue 由此生成的 props 会落到
6
+ * `[x: \`on${Capitalize<string>}\`]: ((...args: any[] | unknown[]) => any) | undefined` 索引签名,
7
+ * 其中的 `unknown[]` 在参数逆变位置上与任何具名参数的回调都不兼容,
8
+ * 业务侧 `@selection-change="({ rows }) => ..."` 这类写法会整片报 TS2322。
9
+ */
10
+ export declare const basicTableEmits: string[];
@@ -7,7 +7,8 @@ const c = [
7
7
  "dynamic-change",
8
8
  "row-dragend",
9
9
  "page-change",
10
- "load-data"
10
+ "load-data",
11
+ "toolbar-button-click"
11
12
  // 缺少的在这里添加
12
13
  ];
13
14
  export {
@@ -0,0 +1,19 @@
1
+ import { ComputedRef } from 'vue';
2
+ import { VxeTablePropTypes } from 'vxe-table';
3
+ import { TtTableMethods, TtTableProps } from '../types/table';
4
+ import { TtTableFormProps } from '../types/tableForm';
5
+ /**
6
+ * 列配置的服务端持久化
7
+ * @param ctx 上下文
8
+ * @param ctx.getTableProps 表格配置
9
+ * @param ctx.getProps 表单+表格配置
10
+ * @param ctx.tableMethods 表格方法
11
+ */
12
+ export declare function useColumnPersistence({ getTableProps, getProps, tableMethods, }: {
13
+ getTableProps: ComputedRef<Partial<TtTableProps>>;
14
+ getProps: ComputedRef<TtTableFormProps>;
15
+ tableMethods: Pick<TtTableMethods<VxeTablePropTypes.Row>, "getTableColumns" | "setTableColumns">;
16
+ }): {
17
+ restoreColumns: () => Promise<void>;
18
+ saveColumns: (json: string) => Promise<any>;
19
+ };
@@ -0,0 +1,64 @@
1
+ import { GlobalConfig as v } from "../../../../hooks/useSetup.js";
2
+ import "axios";
3
+ import "element-plus";
4
+ import { isFunction as w } from "../../../../packages/utils/src/is.js";
5
+ import { ref as B, getCurrentScope as D, onScopeDispose as G, toValue as a, unref as f } from "vue";
6
+ import "dayjs";
7
+ import "numeral";
8
+ import "xe-utils";
9
+ import "dayjs/plugin/utc";
10
+ import "dayjs/plugin/timezone";
11
+ import "../../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
12
+ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js";
13
+ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js";
14
+ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
15
+ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
16
+ import "lodash-es";
17
+ function Z({
18
+ getTableProps: K,
19
+ getProps: O,
20
+ tableMethods: S
21
+ }) {
22
+ const m = B();
23
+ let p = 0, d = !1;
24
+ const A = (t) => w(t) ? t() : t ?? "";
25
+ async function q() {
26
+ var e, r, i, u;
27
+ const t = ++p;
28
+ try {
29
+ const { columns: s, columnsKey: j, defaultDisplayFields: c, getColumnsApi: C } = f(K), g = A(j);
30
+ if (!((r = (e = a(O)) == null ? void 0 : e.table) != null && r.useHttpCache) || !g || !v.userId) return;
31
+ const o = (i = a(s)) != null && i.length ? a(s) : S.getTableColumns(), y = await (C == null ? void 0 : C({ permissionOnlyCode: g, userId: v.userId }));
32
+ if (d || t !== p) return;
33
+ const n = (u = y == null ? void 0 : y.records) == null ? void 0 : u[0];
34
+ let I;
35
+ if (n != null && n.json) {
36
+ const h = JSON.parse(n.json), x = new Map((o == null ? void 0 : o.map((l) => [l.field, l])) ?? []);
37
+ I = h.map((l) => x.get(l)).filter(Boolean);
38
+ } else
39
+ I = c != null && c.length ? o == null ? void 0 : o.filter((h) => c.includes(h.field)) : o;
40
+ m.value = n == null ? void 0 : n.id, S.setTableColumns(I);
41
+ } catch {
42
+ if (d || t !== p) return;
43
+ }
44
+ }
45
+ async function b(t) {
46
+ var i, u;
47
+ const e = (i = a(O)) == null ? void 0 : i.table, r = {
48
+ userId: v.userId,
49
+ permissionOnlyCode: A((u = f(K)) == null ? void 0 : u.columnsKey)
50
+ };
51
+ if (f(m) && w(e == null ? void 0 : e.updateColumnsApi))
52
+ return await e.updateColumnsApi({ id: f(m), json: t, ...r });
53
+ if (w(e == null ? void 0 : e.setColumnsApi)) {
54
+ const s = await e.setColumnsApi({ ...r, json: t });
55
+ return m.value = s, s;
56
+ }
57
+ }
58
+ return D() && G(() => {
59
+ d = !0, p += 1;
60
+ }), { restoreColumns: q, saveColumns: b };
61
+ }
62
+ export {
63
+ Z as useColumnPersistence
64
+ };