@dazhicheng/ui 1.5.265 → 1.6.0

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 (104) hide show
  1. package/dist/components/tt-area/TtArea.vue.js +1 -1
  2. package/dist/components/tt-drawer/src/components/DrawerHeader.vue.js +2 -2
  3. package/dist/components/tt-drawer/src/hooks/useResizable.js +2 -2
  4. package/dist/components/tt-form/src/components/FormElInput.vue.js +51 -38
  5. package/dist/components/tt-form/src/form-render/FormField.vue2.js +36 -36
  6. package/dist/components/tt-form/src/form-render/array-register/FormArrayRegister.d.ts +3 -3
  7. package/dist/components/tt-form/src/form-render/array-register/FormArrayRegister.js +3 -1
  8. package/dist/components/tt-icon/index.vue.js +2 -2
  9. package/dist/components/tt-loading/src/loading.vue.js +2 -2
  10. package/dist/components/tt-modal-form/index.vue.js +13 -12
  11. package/dist/components/tt-panel-select/src/components/PanelMiddle.vue.d.ts +2 -2
  12. package/dist/components/tt-panel-select/src/hooks/usePanelData.js +93 -86
  13. package/dist/components/tt-panel-select/src/index.vue.js +1 -0
  14. package/dist/components/tt-select/src/Select.vue.d.ts +4 -4
  15. package/dist/components/tt-select/src/components/Table.vue.d.ts +4 -4
  16. package/dist/components/tt-table/index.d.ts +523 -358
  17. package/dist/components/tt-table/index.js +7 -4
  18. package/dist/components/tt-table/src/Table.vue.d.ts +306 -216
  19. package/dist/components/tt-table/src/Table.vue.js +405 -618
  20. package/dist/components/tt-table/src/TableForm.vue.d.ts +384 -19
  21. package/dist/components/tt-table/src/TableForm.vue.js +219 -228
  22. package/dist/components/tt-table/src/components/TableAction.vue.js +108 -131
  23. package/dist/components/tt-table/src/components/TableButtons.js +25 -25
  24. package/dist/components/tt-table/src/components/TableColumnModal.vue2.js +88 -85
  25. package/dist/components/tt-table/src/components/TableToolbarTools.vue.d.ts +80 -0
  26. package/dist/components/tt-table/src/components/{TableToobalTools.vue.js → TableToolbarTools.vue.js} +29 -31
  27. package/dist/components/tt-table/src/components/TableToolbarTools.vue2.js +4 -0
  28. package/dist/components/tt-table/src/emits.js +2 -1
  29. package/dist/components/tt-table/src/hooks/useColumnPersistence.d.ts +19 -0
  30. package/dist/components/tt-table/src/hooks/useColumnPersistence.js +63 -0
  31. package/dist/components/tt-table/src/hooks/useColumns.d.ts +505 -21
  32. package/dist/components/tt-table/src/hooks/useColumns.js +100 -245
  33. package/dist/components/tt-table/src/hooks/useGridProps.d.ts +36 -0
  34. package/dist/components/tt-table/src/hooks/useGridProps.js +121 -0
  35. package/dist/components/tt-table/src/hooks/useKeyboardNav.d.ts +11 -0
  36. package/dist/components/tt-table/src/hooks/useKeyboardNav.js +97 -0
  37. package/dist/components/tt-table/src/hooks/usePagination.d.ts +14 -8
  38. package/dist/components/tt-table/src/hooks/usePagination.js +29 -33
  39. package/dist/components/tt-table/src/hooks/useQuery.d.ts +41 -0
  40. package/dist/components/tt-table/src/hooks/useQuery.js +147 -0
  41. package/dist/components/tt-table/src/hooks/useRowIdentity.d.ts +22 -0
  42. package/dist/components/tt-table/src/hooks/useRowIdentity.js +96 -0
  43. package/dist/components/tt-table/src/hooks/useRowSelection.d.ts +23 -7
  44. package/dist/components/tt-table/src/hooks/useRowSelection.js +95 -71
  45. package/dist/components/tt-table/src/hooks/{useLeftRightSlot.d.ts → useSideSlot.d.ts} +25 -17
  46. package/dist/components/tt-table/src/hooks/useSideSlot.js +77 -0
  47. package/dist/components/tt-table/src/hooks/useSyncProps.d.ts +12 -0
  48. package/dist/components/tt-table/src/hooks/useSyncProps.js +55 -0
  49. package/dist/components/tt-table/src/hooks/useTableData.d.ts +71 -0
  50. package/dist/components/tt-table/src/hooks/useTableData.js +307 -0
  51. package/dist/components/tt-table/src/hooks/useTableFooter.d.ts +15 -0
  52. package/dist/components/tt-table/src/hooks/useTableFooter.js +46 -0
  53. package/dist/components/tt-table/src/hooks/useTableForm.d.ts +10 -5
  54. package/dist/components/tt-table/src/hooks/useTableForm.js +55 -48
  55. package/dist/components/tt-table/src/hooks/useTableMethods.d.ts +165 -0
  56. package/dist/components/tt-table/src/hooks/useTableMethods.js +183 -0
  57. package/dist/components/tt-table/src/hooks/useTableRender.d.ts +24 -55
  58. package/dist/components/tt-table/src/props.d.ts +318 -151
  59. package/dist/components/tt-table/src/props.js +117 -270
  60. package/dist/components/tt-table/src/table-defaults.d.ts +25 -0
  61. package/dist/components/tt-table/src/table-defaults.js +71 -0
  62. package/dist/components/tt-table/src/table-mutation-events.d.ts +43 -0
  63. package/dist/components/tt-table/src/table-mutation-events.js +70 -0
  64. package/dist/components/tt-table/src/types/table.d.ts +207 -88
  65. package/dist/components/tt-table/src/types/tableAction.d.ts +23 -0
  66. package/dist/components/tt-table/src/types/tableForm.d.ts +15 -26
  67. package/dist/components/tt-table/src/utils/action-tab-index.d.ts +2 -0
  68. package/dist/components/tt-table/src/utils/action-tab-index.js +50 -0
  69. package/dist/components/tt-table/src/utils/context.js +25 -12
  70. package/dist/components/tt-table/src/utils/table-api.d.ts +136 -58
  71. package/dist/components/tt-table/src/utils/table-api.js +198 -165
  72. package/dist/components/tt-table/src/utils/table-form-api.d.ts +11 -11
  73. package/dist/components/tt-table/src/utils/table-form-api.js +41 -31
  74. package/dist/components/types.d.ts +0 -20
  75. package/dist/hooks/useSetup.js +0 -3
  76. package/dist/index.d.ts +1 -0
  77. package/dist/index.js +105 -101
  78. package/dist/packages/hooks/src/useDebounce.js +6 -6
  79. package/dist/packages/utils/src/is.js +20 -18
  80. package/dist/packages/utils/src/tool.js +76 -149
  81. package/dist/style.css +1 -1
  82. package/dist/utils/uppercaseInput.d.ts +29 -0
  83. package/dist/utils/uppercaseInput.js +16 -0
  84. package/package.json +3 -3
  85. package/dist/components/tt-table/src/components/TableToobalTools.vue.d.ts +0 -576
  86. package/dist/components/tt-table/src/components/TableToobalTools.vue2.js +0 -4
  87. package/dist/components/tt-table/src/enum.d.ts +0 -2
  88. package/dist/components/tt-table/src/hooks/useCellArea.d.ts +0 -15
  89. package/dist/components/tt-table/src/hooks/useCellArea.js +0 -15
  90. package/dist/components/tt-table/src/hooks/useCustomColumns.d.ts +0 -20
  91. package/dist/components/tt-table/src/hooks/useCustomColumns.js +0 -65
  92. package/dist/components/tt-table/src/hooks/useDataSource.d.ts +0 -29
  93. package/dist/components/tt-table/src/hooks/useDataSource.js +0 -232
  94. package/dist/components/tt-table/src/hooks/useLeftRightSlot.js +0 -64
  95. package/dist/components/tt-table/src/hooks/useTable.d.ts +0 -7
  96. package/dist/components/tt-table/src/hooks/useTableEvent.d.ts +0 -101
  97. package/dist/components/tt-table/src/hooks/useTableEvent.js +0 -197
  98. package/dist/components/tt-table/src/hooks/useTableFormEvent.d.ts +0 -10
  99. package/dist/components/tt-table/src/hooks/useTableHeight.d.ts +0 -15
  100. package/dist/components/tt-table/src/hooks/useTableSlot.d.ts +0 -11
  101. package/dist/components/tt-table/src/hooks/useTableSlot.js +0 -17
  102. package/dist/components/tt-table/src/utils/filters.d.ts +0 -109
  103. package/dist/components/tt-table/src/utils/vxeTable.d.ts +0 -28
  104. package/dist/packages/utils/src/check.js +0 -10
@@ -1,16 +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";
12
- import "dayjs";
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";
13
13
  import "xe-utils";
14
+ import "dayjs";
14
15
  import "dayjs/plugin/utc";
15
16
  import "dayjs/plugin/timezone";
16
17
  import "../../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
@@ -20,79 +21,81 @@ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mo
20
21
  import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
21
22
  import "lodash-es";
22
23
  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({
24
+ import re from "sortablejs";
25
+ import { useModalRender as ue } from "../../../tt-modal/src/hooks/useModalRender.js";
26
+ const de = ["aria-label", "onClick"], Ae = /* @__PURE__ */ X({
26
27
  __name: "TableColumnModal",
27
28
  props: {
28
29
  openColumn: { type: Function },
29
30
  openExport: { type: Function }
30
31
  },
31
32
  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);
33
+ setup(I, { expose: D, emit: L }) {
34
+ const c = I, R = L, { prefixCls: n } = ne("table-column-modal"), [G, g] = ue(), d = x([]), i = x([]), y = x(!1);
35
+ let v = null, E = null;
36
+ const S = b(
37
+ () => i.value.map((t) => d.value.find((l) => l.field === t)).filter(Boolean)
38
+ ), 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
39
  function M(t) {
39
- return u.value.some((l) => l.field === t && l.locked);
40
+ return d.value.some((l) => l.field === t && l.locked);
40
41
  }
41
- function U(t) {
42
- i.value = u.value.filter((l) => l.locked ? i.value.includes(l.field) : !!t).map((l) => l.field);
42
+ function q(t) {
43
+ i.value = d.value.filter((l) => l.locked ? i.value.includes(l.field) : !!t).map((l) => l.field);
43
44
  }
44
- function j(t) {
45
+ function H(t) {
45
46
  i.value = i.value.filter((l) => l !== t);
46
47
  }
47
- function q() {
48
+ function J() {
48
49
  i.value = i.value.filter(M);
49
50
  }
50
51
  function _() {
51
- D("on-submit", {
52
+ R("on-submit", {
52
53
  checkedModel: [...i.value],
53
54
  modalApi: g,
54
55
  isExport: y.value
55
56
  });
56
57
  }
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();
58
+ function K({ columns: t, displayFields: l = [], disabledColumnField: o, isExport: f }) {
59
+ y.value = f ?? !1, d.value = t.filter((s) => s.field).map((s) => ({ ...s, locked: o.includes(s.field) }));
60
+ const k = new Set(d.value.map((s) => s.field));
61
+ i.value = [...new Set(l.filter((s) => k.has(s)))], g.openModal();
61
62
  }
62
- function J(t) {
63
- p == null || p.destroy(), p = null, t && (p = ae.create(t, {
63
+ function Q(t) {
64
+ const l = t || null;
65
+ l !== E && (v == null || v.destroy(), v = null, E = l, l && (v = re.create(l, {
64
66
  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;
67
+ onStart: (o) => o.item.style.opacity = "0",
68
+ onEnd(o) {
69
+ o.item.style.opacity = "1";
70
+ const { oldIndex: f, newIndex: k } = o;
71
+ if (!A(f) || !A(k) || !Number.isFinite(f) || !Number.isFinite(k))
72
+ return;
73
+ const s = [...i.value];
74
+ s.splice(k, 0, ...s.splice(f, 1)), i.value = s;
72
75
  }
73
- }));
76
+ })));
74
77
  }
75
- function K() {
78
+ function W() {
76
79
  var t, l;
77
- y.value ? (t = m.openExport) == null || t.call(m, !0) : (l = m.openColumn) == null || l.call(m, !0);
80
+ y.value ? (t = c.openExport) == null || t.call(c, !0) : (l = c.openColumn) == null || l.call(c, !0);
78
81
  }
79
- return A({
82
+ return D({
80
83
  handleSubmit: _,
81
- openModal: H,
84
+ openModal: K,
82
85
  setModalProps(t) {
83
86
  g.setModalProps(t);
84
87
  }
85
- }), (t, l) => (f(), F(e(L), {
88
+ }), (t, l) => (p(), w(e(G), {
86
89
  width: "720",
87
90
  class: a(e(n)),
88
91
  onOk: _
89
- }, W({
90
- beforeFooter: s(() => [
91
- c("div", {
92
+ }, Y({
93
+ beforeFooter: r(() => [
94
+ m("div", {
92
95
  class: a(`${e(n)}-footer-left`)
93
96
  }, [
94
- r(e(te), { onClick: K }, {
95
- default: s(() => [...l[1] || (l[1] = [
97
+ u(e(ie), { onClick: W }, {
98
+ default: r(() => [...l[1] || (l[1] = [
96
99
  h("重置", -1)
97
100
  ])]),
98
101
  _: 1
@@ -100,43 +103,43 @@ const re = ["aria-label", "onClick"], Be = /* @__PURE__ */ Q({
100
103
  V(t.$slots, "beforeFooter")
101
104
  ], 2)
102
105
  ]),
103
- default: s(() => [
104
- c("div", {
106
+ default: r(() => [
107
+ m("div", {
105
108
  class: a(`${e(n)}-body`)
106
109
  }, [
107
- r(e(B), {
110
+ u(e(B), {
108
111
  class: a(`${e(n)}-source`)
109
112
  }, {
110
- default: s(() => [
111
- r(e(N), {
113
+ default: r(() => [
114
+ u(e(z), {
112
115
  class: a(`${e(n)}-all`),
113
- "model-value": S.value,
114
- indeterminate: O.value,
115
- onChange: U
116
+ "model-value": F.value,
117
+ indeterminate: j.value,
118
+ onChange: q
116
119
  }, {
117
- default: s(() => [
118
- h(" 全部(" + $(i.value.length) + "/" + $(u.value.length) + ") ", 1)
120
+ default: r(() => [
121
+ h(" 全部(" + $(i.value.length) + "/" + $(d.value.length) + ") ", 1)
119
122
  ]),
120
123
  _: 1
121
124
  }, 8, ["class", "model-value", "indeterminate"]),
122
- r(e(ie), {
125
+ u(e(ae), {
123
126
  modelValue: i.value,
124
127
  "onUpdate:modelValue": l[0] || (l[0] = (o) => i.value = o),
125
128
  class: a(`${e(n)}-group`)
126
129
  }, {
127
- default: s(() => [
128
- (f(!0), C(w, null, T(u.value, (o) => (f(), F(e(N), {
130
+ default: r(() => [
131
+ (p(!0), C(N, null, T(d.value, (o) => (p(), w(e(z), {
129
132
  key: o.field,
130
133
  value: o.field,
131
134
  disabled: o.locked
132
135
  }, {
133
- default: s(() => [
134
- r(e(ne), {
136
+ default: r(() => [
137
+ u(e(se), {
135
138
  content: o.title || "",
136
139
  "show-after": 400,
137
140
  placement: "top"
138
141
  }, {
139
- default: s(() => [
142
+ default: r(() => [
140
143
  h($(o.title || ""), 1)
141
144
  ]),
142
145
  _: 2
@@ -150,59 +153,59 @@ const re = ["aria-label", "onClick"], Be = /* @__PURE__ */ Q({
150
153
  ]),
151
154
  _: 1
152
155
  }, 8, ["class"]),
153
- c("div", {
156
+ m("div", {
154
157
  class: a(`${e(n)}-picked`)
155
158
  }, [
156
- c("header", {
159
+ m("header", {
157
160
  class: a(`${e(n)}-picked-head`)
158
161
  }, [
159
- c("span", null, "已选 " + $(E.value.length) + " 列", 1),
160
- c("span", {
162
+ m("span", null, "已选 " + $(S.value.length) + " 列", 1),
163
+ m("span", {
161
164
  class: a(`${e(n)}-clear`),
162
- onClick: q
165
+ onClick: J
163
166
  }, "清空", 2)
164
167
  ], 2),
165
- r(e(B), null, {
166
- default: s(() => [
167
- c("ul", {
168
- ref: J,
168
+ u(e(B), null, {
169
+ default: r(() => [
170
+ m("ul", {
171
+ ref: Q,
169
172
  class: a(`${e(n)}-list`)
170
173
  }, [
171
- (f(!0), C(w, null, T(E.value, (o) => (f(), C("li", {
174
+ (p(!0), C(N, null, T(S.value, (o) => (p(), C("li", {
172
175
  key: o.field,
173
176
  class: a(`${e(n)}-item`)
174
177
  }, [
175
- c("span", {
178
+ m("span", {
176
179
  class: a(`${e(n)}-item-main`)
177
180
  }, [
178
- r(e(P), {
181
+ u(e(P), {
179
182
  class: a(`${e(n)}-item-drag`),
180
183
  size: 14,
181
- icon: e(ee),
184
+ icon: e(te),
182
185
  "is-custom-svg": ""
183
186
  }, null, 8, ["class", "icon"]),
184
- r(e(le), {
187
+ u(e(oe), {
185
188
  "tool-tip": !1,
186
189
  class: a(`${e(n)}-item-title`)
187
190
  }, {
188
- default: s(() => [
191
+ default: r(() => [
189
192
  h($(o.title || ""), 1)
190
193
  ]),
191
194
  _: 2
192
195
  }, 1032, ["class"])
193
196
  ], 2),
194
- o.locked ? X("", !0) : (f(), C("button", {
197
+ o.locked ? Z("", !0) : (p(), C("button", {
195
198
  key: 0,
196
199
  type: "button",
197
200
  class: a(`${e(n)}-item-remove`),
198
201
  "aria-label": `移除${o.title || ""}`,
199
- onClick: Y((v) => j(o.field), ["stop"])
202
+ onClick: ee((f) => H(o.field), ["stop"])
200
203
  }, [
201
- r(e(P), {
204
+ u(e(P), {
202
205
  size: 12,
203
- "icon-font": e(Z)
206
+ "icon-font": e(le)
204
207
  }, null, 8, ["icon-font"])
205
- ], 10, re))
208
+ ], 10, de))
206
209
  ], 2))), 128))
207
210
  ], 2)
208
211
  ]),
@@ -215,7 +218,7 @@ const re = ["aria-label", "onClick"], Be = /* @__PURE__ */ Q({
215
218
  }, [
216
219
  t.$slots.title ? {
217
220
  name: "header",
218
- fn: s(() => [
221
+ fn: r(() => [
219
222
  V(t.$slots, "title")
220
223
  ]),
221
224
  key: "0"
@@ -224,5 +227,5 @@ const re = ["aria-label", "onClick"], Be = /* @__PURE__ */ Q({
224
227
  }
225
228
  });
226
229
  export {
227
- Be as default
230
+ Ae as default
228
231
  };
@@ -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,4 +1,4 @@
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 o, 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";
@@ -14,57 +14,55 @@ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/en
14
14
  import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
15
15
  import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
16
16
  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,
17
+ import { toolProps as V } from "../toolProps.js";
18
+ import j from "../../../../assets/svg/RiRefreshLine.svg.js";
19
+ import F from "../../../../assets/svg/exportSvg.svg.js";
20
+ import L from "../../../../assets/svg/columnSet.svg.js";
21
+ const P = ["data-testid"], lt = /* @__PURE__ */ x({
22
+ __name: "TableToolbarTools",
23
+ props: V,
24
24
  emits: ["on-refresh", "on-columns-setting", "on-export"],
25
25
  setup(k, { emit: g }) {
26
- const n = k, l = g, v = E(
26
+ const r = k, l = g, v = E(
27
27
  "tableIdContext",
28
28
  a(() => "")
29
- ), C = a(() => N(o(v), "table-toolbar-tools")), p = I(/* @__PURE__ */ new Set());
30
- function T(t, c) {
31
- p.value.add(t), c();
29
+ ), C = a(() => N(o(v), "table-toolbar-tools")), c = I(/* @__PURE__ */ new Set());
30
+ function T(t, p) {
31
+ c.value.add(t), p();
32
32
  }
33
- function _(t) {
34
- p.value.delete(t);
33
+ function S(t) {
34
+ c.value.delete(t);
35
35
  }
36
- const S = a(() => [
36
+ const _ = a(() => [
37
37
  {
38
38
  label: "自定义导出",
39
- icon: j,
39
+ icon: F,
40
40
  handler: () => l("on-export"),
41
- if: n.showExport
41
+ if: r.showExport
42
42
  },
43
43
  {
44
44
  label: "刷新",
45
- icon: V,
45
+ icon: j,
46
46
  handler: () => l("on-refresh"),
47
- if: n.showRefresh
47
+ if: r.showRefresh
48
48
  },
49
49
  {
50
50
  label: "列设置",
51
- icon: F,
51
+ icon: L,
52
52
  handler: () => l("on-columns-setting"),
53
- if: n.showSetColumn
53
+ if: r.showSetColumn
54
54
  }
55
55
  ]);
56
- return (t, c) => (r(), s("div", { "data-testid": C.value }, [
57
- t.showSetting ? (r(), f(o(A), {
56
+ return (t, p) => (n(), s("div", { "data-testid": C.value }, [
57
+ t.showSetting ? (n(), d(o(A), {
58
58
  key: 0,
59
59
  size: 12
60
60
  }, {
61
61
  default: m(() => [
62
62
  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), {
63
+ (n(!0), s(b, null, B(_.value, (e, i) => (n(), s(b, { key: i }, [
64
+ e.if ? (n(), d(o(z), {
65
65
  key: 0,
66
- ref_for: !0,
67
- ref: "tooltipRef",
68
66
  class: "box-item",
69
67
  effect: "dark",
70
68
  content: e.label,
@@ -76,7 +74,7 @@ const L = ["data-testid"], lt = /* @__PURE__ */ x({
76
74
  class: "icon-table-btn",
77
75
  "aria-label": e.label,
78
76
  onClick: (w) => T(i, e.handler),
79
- onAnimationend: (w) => _(i)
77
+ onAnimationend: (w) => S(i)
80
78
  }, {
81
79
  default: m(() => [
82
80
  h(o($), {
@@ -89,13 +87,13 @@ const L = ["data-testid"], lt = /* @__PURE__ */ x({
89
87
  }, 1032, ["aria-label", "onClick", "onAnimationend"])
90
88
  ]),
91
89
  _: 2
92
- }, 1032, ["content"])) : d("", !0)
90
+ }, 1032, ["content"])) : f("", !0)
93
91
  ], 64))), 128)),
94
92
  u(t.$slots, "toolbar-right")
95
93
  ]),
96
94
  _: 3
97
- })) : d("", !0)
98
- ], 8, L));
95
+ })) : f("", !0)
96
+ ], 8, P));
99
97
  }
100
98
  });
101
99
  export {
@@ -0,0 +1,4 @@
1
+ import f from "./TableToolbarTools.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -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,63 @@
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 "xe-utils";
7
+ import "dayjs";
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
+ function Y({
17
+ getTableProps: K,
18
+ getProps: O,
19
+ tableMethods: S
20
+ }) {
21
+ const m = B();
22
+ let c = 0, d = !1;
23
+ const A = (t) => w(t) ? t() : t ?? "";
24
+ async function q() {
25
+ var e, r, i, u;
26
+ const t = ++c;
27
+ try {
28
+ const { columns: s, columnsKey: j, defaultDisplayFields: l, getColumnsApi: C } = f(K), g = A(j);
29
+ if (!((r = (e = a(O)) == null ? void 0 : e.table) != null && r.useHttpCache) || !g || !v.userId) return;
30
+ const n = (i = a(s)) != null && i.length ? a(s) : S.getTableColumns(), y = await (C == null ? void 0 : C({ permissionOnlyCode: g, userId: v.userId }));
31
+ if (d || t !== c) return;
32
+ const o = (u = y == null ? void 0 : y.records) == null ? void 0 : u[0];
33
+ let I;
34
+ if (o != null && o.json) {
35
+ const h = JSON.parse(o.json), x = new Map((n == null ? void 0 : n.map((p) => [p.field, p])) ?? []);
36
+ I = h.map((p) => x.get(p)).filter(Boolean);
37
+ } else
38
+ I = l != null && l.length ? n == null ? void 0 : n.filter((h) => l.includes(h.field)) : n;
39
+ m.value = o == null ? void 0 : o.id, S.setTableColumns(I);
40
+ } catch {
41
+ if (d || t !== c) return;
42
+ }
43
+ }
44
+ async function b(t) {
45
+ var i, u;
46
+ const e = (i = a(O)) == null ? void 0 : i.table, r = {
47
+ userId: v.userId,
48
+ permissionOnlyCode: A((u = f(K)) == null ? void 0 : u.columnsKey)
49
+ };
50
+ if (f(m) && w(e == null ? void 0 : e.updateColumnsApi))
51
+ return await e.updateColumnsApi({ id: f(m), json: t, ...r });
52
+ if (w(e == null ? void 0 : e.setColumnsApi)) {
53
+ const s = await e.setColumnsApi({ ...r, json: t });
54
+ return m.value = s, s;
55
+ }
56
+ }
57
+ return D() && G(() => {
58
+ d = !0, c += 1;
59
+ }), { restoreColumns: q, saveColumns: b };
60
+ }
61
+ export {
62
+ Y as useColumnPersistence
63
+ };