@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.
- package/dist/components/tt-area/TtArea.vue.js +1 -1
- package/dist/components/tt-drawer/src/components/DrawerHeader.vue.js +2 -2
- package/dist/components/tt-drawer/src/hooks/useResizable.js +2 -2
- package/dist/components/tt-form/src/components/FormElInput.vue.js +51 -38
- package/dist/components/tt-form/src/form-render/FormField.vue2.js +36 -36
- package/dist/components/tt-form/src/form-render/array-register/FormArrayRegister.d.ts +3 -3
- package/dist/components/tt-form/src/form-render/array-register/FormArrayRegister.js +3 -1
- package/dist/components/tt-icon/index.vue.js +2 -2
- package/dist/components/tt-loading/src/loading.vue.js +2 -2
- package/dist/components/tt-modal-form/index.vue.js +13 -12
- package/dist/components/tt-panel-select/src/components/PanelMiddle.vue.d.ts +2 -2
- package/dist/components/tt-panel-select/src/hooks/usePanelData.js +93 -86
- package/dist/components/tt-panel-select/src/index.vue.js +1 -0
- package/dist/components/tt-select/src/Select.vue.d.ts +4 -4
- package/dist/components/tt-select/src/components/Table.vue.d.ts +4 -4
- package/dist/components/tt-table/index.d.ts +523 -358
- package/dist/components/tt-table/index.js +7 -4
- package/dist/components/tt-table/src/Table.vue.d.ts +306 -216
- package/dist/components/tt-table/src/Table.vue.js +405 -618
- package/dist/components/tt-table/src/TableForm.vue.d.ts +384 -19
- package/dist/components/tt-table/src/TableForm.vue.js +219 -228
- package/dist/components/tt-table/src/components/TableAction.vue.js +108 -131
- package/dist/components/tt-table/src/components/TableButtons.js +25 -25
- package/dist/components/tt-table/src/components/TableColumnModal.vue2.js +88 -85
- package/dist/components/tt-table/src/components/TableToolbarTools.vue.d.ts +80 -0
- package/dist/components/tt-table/src/components/{TableToobalTools.vue.js → TableToolbarTools.vue.js} +29 -31
- package/dist/components/tt-table/src/components/TableToolbarTools.vue2.js +4 -0
- package/dist/components/tt-table/src/emits.js +2 -1
- package/dist/components/tt-table/src/hooks/useColumnPersistence.d.ts +19 -0
- package/dist/components/tt-table/src/hooks/useColumnPersistence.js +63 -0
- package/dist/components/tt-table/src/hooks/useColumns.d.ts +505 -21
- package/dist/components/tt-table/src/hooks/useColumns.js +100 -245
- package/dist/components/tt-table/src/hooks/useGridProps.d.ts +36 -0
- package/dist/components/tt-table/src/hooks/useGridProps.js +121 -0
- package/dist/components/tt-table/src/hooks/useKeyboardNav.d.ts +11 -0
- package/dist/components/tt-table/src/hooks/useKeyboardNav.js +97 -0
- package/dist/components/tt-table/src/hooks/usePagination.d.ts +14 -8
- package/dist/components/tt-table/src/hooks/usePagination.js +29 -33
- package/dist/components/tt-table/src/hooks/useQuery.d.ts +41 -0
- package/dist/components/tt-table/src/hooks/useQuery.js +147 -0
- package/dist/components/tt-table/src/hooks/useRowIdentity.d.ts +22 -0
- package/dist/components/tt-table/src/hooks/useRowIdentity.js +96 -0
- package/dist/components/tt-table/src/hooks/useRowSelection.d.ts +23 -7
- package/dist/components/tt-table/src/hooks/useRowSelection.js +95 -71
- package/dist/components/tt-table/src/hooks/{useLeftRightSlot.d.ts → useSideSlot.d.ts} +25 -17
- package/dist/components/tt-table/src/hooks/useSideSlot.js +77 -0
- package/dist/components/tt-table/src/hooks/useSyncProps.d.ts +12 -0
- package/dist/components/tt-table/src/hooks/useSyncProps.js +55 -0
- package/dist/components/tt-table/src/hooks/useTableData.d.ts +71 -0
- package/dist/components/tt-table/src/hooks/useTableData.js +307 -0
- package/dist/components/tt-table/src/hooks/useTableFooter.d.ts +15 -0
- package/dist/components/tt-table/src/hooks/useTableFooter.js +46 -0
- package/dist/components/tt-table/src/hooks/useTableForm.d.ts +10 -5
- package/dist/components/tt-table/src/hooks/useTableForm.js +55 -48
- package/dist/components/tt-table/src/hooks/useTableMethods.d.ts +165 -0
- package/dist/components/tt-table/src/hooks/useTableMethods.js +183 -0
- package/dist/components/tt-table/src/hooks/useTableRender.d.ts +24 -55
- package/dist/components/tt-table/src/props.d.ts +318 -151
- package/dist/components/tt-table/src/props.js +117 -270
- package/dist/components/tt-table/src/table-defaults.d.ts +25 -0
- package/dist/components/tt-table/src/table-defaults.js +71 -0
- package/dist/components/tt-table/src/table-mutation-events.d.ts +43 -0
- package/dist/components/tt-table/src/table-mutation-events.js +70 -0
- package/dist/components/tt-table/src/types/table.d.ts +207 -88
- package/dist/components/tt-table/src/types/tableAction.d.ts +23 -0
- package/dist/components/tt-table/src/types/tableForm.d.ts +15 -26
- package/dist/components/tt-table/src/utils/action-tab-index.d.ts +2 -0
- package/dist/components/tt-table/src/utils/action-tab-index.js +50 -0
- package/dist/components/tt-table/src/utils/context.js +25 -12
- package/dist/components/tt-table/src/utils/table-api.d.ts +136 -58
- package/dist/components/tt-table/src/utils/table-api.js +198 -165
- package/dist/components/tt-table/src/utils/table-form-api.d.ts +11 -11
- package/dist/components/tt-table/src/utils/table-form-api.js +41 -31
- package/dist/components/types.d.ts +0 -20
- package/dist/hooks/useSetup.js +0 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.js +105 -101
- package/dist/packages/hooks/src/useDebounce.js +6 -6
- package/dist/packages/utils/src/is.js +20 -18
- package/dist/packages/utils/src/tool.js +76 -149
- package/dist/style.css +1 -1
- package/dist/utils/uppercaseInput.d.ts +29 -0
- package/dist/utils/uppercaseInput.js +16 -0
- package/package.json +3 -3
- package/dist/components/tt-table/src/components/TableToobalTools.vue.d.ts +0 -576
- package/dist/components/tt-table/src/components/TableToobalTools.vue2.js +0 -4
- package/dist/components/tt-table/src/enum.d.ts +0 -2
- package/dist/components/tt-table/src/hooks/useCellArea.d.ts +0 -15
- package/dist/components/tt-table/src/hooks/useCellArea.js +0 -15
- package/dist/components/tt-table/src/hooks/useCustomColumns.d.ts +0 -20
- package/dist/components/tt-table/src/hooks/useCustomColumns.js +0 -65
- package/dist/components/tt-table/src/hooks/useDataSource.d.ts +0 -29
- package/dist/components/tt-table/src/hooks/useDataSource.js +0 -232
- package/dist/components/tt-table/src/hooks/useLeftRightSlot.js +0 -64
- package/dist/components/tt-table/src/hooks/useTable.d.ts +0 -7
- package/dist/components/tt-table/src/hooks/useTableEvent.d.ts +0 -101
- package/dist/components/tt-table/src/hooks/useTableEvent.js +0 -197
- package/dist/components/tt-table/src/hooks/useTableFormEvent.d.ts +0 -10
- package/dist/components/tt-table/src/hooks/useTableHeight.d.ts +0 -15
- package/dist/components/tt-table/src/hooks/useTableSlot.d.ts +0 -11
- package/dist/components/tt-table/src/hooks/useTableSlot.js +0 -17
- package/dist/components/tt-table/src/utils/filters.d.ts +0 -109
- package/dist/components/tt-table/src/utils/vxeTable.d.ts +0 -28
- package/dist/packages/utils/src/check.js +0 -10
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
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
|
|
5
|
+
import { TtText as oe } from "../../../tt-text/index.js";
|
|
6
6
|
import "../../../tt-modal/index.js";
|
|
7
|
-
import { TtButton as
|
|
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
|
|
9
|
+
import { useDesign as ne } from "../../../../packages/hooks/src/useDesign.js";
|
|
10
10
|
import "axios";
|
|
11
|
-
import { ElScrollbar as B, ElCheckbox as
|
|
12
|
-
import "
|
|
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
|
|
24
|
-
import { useModalRender as
|
|
25
|
-
const
|
|
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(
|
|
33
|
-
const
|
|
34
|
-
let
|
|
35
|
-
const
|
|
36
|
-
() => i.value.map((t) =>
|
|
37
|
-
),
|
|
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
|
|
40
|
+
return d.value.some((l) => l.field === t && l.locked);
|
|
40
41
|
}
|
|
41
|
-
function
|
|
42
|
-
i.value =
|
|
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
|
|
45
|
+
function H(t) {
|
|
45
46
|
i.value = i.value.filter((l) => l !== t);
|
|
46
47
|
}
|
|
47
|
-
function
|
|
48
|
+
function J() {
|
|
48
49
|
i.value = i.value.filter(M);
|
|
49
50
|
}
|
|
50
51
|
function _() {
|
|
51
|
-
|
|
52
|
+
R("on-submit", {
|
|
52
53
|
checkedModel: [...i.value],
|
|
53
54
|
modalApi: g,
|
|
54
55
|
isExport: y.value
|
|
55
56
|
});
|
|
56
57
|
}
|
|
57
|
-
function
|
|
58
|
-
y.value =
|
|
59
|
-
const k = new Set(
|
|
60
|
-
i.value = [...new Set(l.filter((
|
|
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
|
|
63
|
-
|
|
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: (
|
|
66
|
-
onEnd(
|
|
67
|
-
|
|
68
|
-
const { oldIndex:
|
|
69
|
-
if (
|
|
70
|
-
|
|
71
|
-
|
|
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
|
|
78
|
+
function W() {
|
|
76
79
|
var t, l;
|
|
77
|
-
y.value ? (t =
|
|
80
|
+
y.value ? (t = c.openExport) == null || t.call(c, !0) : (l = c.openColumn) == null || l.call(c, !0);
|
|
78
81
|
}
|
|
79
|
-
return
|
|
82
|
+
return D({
|
|
80
83
|
handleSubmit: _,
|
|
81
|
-
openModal:
|
|
84
|
+
openModal: K,
|
|
82
85
|
setModalProps(t) {
|
|
83
86
|
g.setModalProps(t);
|
|
84
87
|
}
|
|
85
|
-
}), (t, l) => (
|
|
88
|
+
}), (t, l) => (p(), w(e(G), {
|
|
86
89
|
width: "720",
|
|
87
90
|
class: a(e(n)),
|
|
88
91
|
onOk: _
|
|
89
|
-
},
|
|
90
|
-
beforeFooter:
|
|
91
|
-
|
|
92
|
+
}, Y({
|
|
93
|
+
beforeFooter: r(() => [
|
|
94
|
+
m("div", {
|
|
92
95
|
class: a(`${e(n)}-footer-left`)
|
|
93
96
|
}, [
|
|
94
|
-
|
|
95
|
-
default:
|
|
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:
|
|
104
|
-
|
|
106
|
+
default: r(() => [
|
|
107
|
+
m("div", {
|
|
105
108
|
class: a(`${e(n)}-body`)
|
|
106
109
|
}, [
|
|
107
|
-
|
|
110
|
+
u(e(B), {
|
|
108
111
|
class: a(`${e(n)}-source`)
|
|
109
112
|
}, {
|
|
110
|
-
default:
|
|
111
|
-
|
|
113
|
+
default: r(() => [
|
|
114
|
+
u(e(z), {
|
|
112
115
|
class: a(`${e(n)}-all`),
|
|
113
|
-
"model-value":
|
|
114
|
-
indeterminate:
|
|
115
|
-
onChange:
|
|
116
|
+
"model-value": F.value,
|
|
117
|
+
indeterminate: j.value,
|
|
118
|
+
onChange: q
|
|
116
119
|
}, {
|
|
117
|
-
default:
|
|
118
|
-
h(" 全部(" + $(i.value.length) + "/" + $(
|
|
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
|
-
|
|
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:
|
|
128
|
-
(
|
|
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:
|
|
134
|
-
|
|
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:
|
|
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
|
-
|
|
156
|
+
m("div", {
|
|
154
157
|
class: a(`${e(n)}-picked`)
|
|
155
158
|
}, [
|
|
156
|
-
|
|
159
|
+
m("header", {
|
|
157
160
|
class: a(`${e(n)}-picked-head`)
|
|
158
161
|
}, [
|
|
159
|
-
|
|
160
|
-
|
|
162
|
+
m("span", null, "已选 " + $(S.value.length) + " 列", 1),
|
|
163
|
+
m("span", {
|
|
161
164
|
class: a(`${e(n)}-clear`),
|
|
162
|
-
onClick:
|
|
165
|
+
onClick: J
|
|
163
166
|
}, "清空", 2)
|
|
164
167
|
], 2),
|
|
165
|
-
|
|
166
|
-
default:
|
|
167
|
-
|
|
168
|
-
ref:
|
|
168
|
+
u(e(B), null, {
|
|
169
|
+
default: r(() => [
|
|
170
|
+
m("ul", {
|
|
171
|
+
ref: Q,
|
|
169
172
|
class: a(`${e(n)}-list`)
|
|
170
173
|
}, [
|
|
171
|
-
(
|
|
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
|
-
|
|
178
|
+
m("span", {
|
|
176
179
|
class: a(`${e(n)}-item-main`)
|
|
177
180
|
}, [
|
|
178
|
-
|
|
181
|
+
u(e(P), {
|
|
179
182
|
class: a(`${e(n)}-item-drag`),
|
|
180
183
|
size: 14,
|
|
181
|
-
icon: e(
|
|
184
|
+
icon: e(te),
|
|
182
185
|
"is-custom-svg": ""
|
|
183
186
|
}, null, 8, ["class", "icon"]),
|
|
184
|
-
|
|
187
|
+
u(e(oe), {
|
|
185
188
|
"tool-tip": !1,
|
|
186
189
|
class: a(`${e(n)}-item-title`)
|
|
187
190
|
}, {
|
|
188
|
-
default:
|
|
191
|
+
default: r(() => [
|
|
189
192
|
h($(o.title || ""), 1)
|
|
190
193
|
]),
|
|
191
194
|
_: 2
|
|
192
195
|
}, 1032, ["class"])
|
|
193
196
|
], 2),
|
|
194
|
-
o.locked ?
|
|
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:
|
|
202
|
+
onClick: ee((f) => H(o.field), ["stop"])
|
|
200
203
|
}, [
|
|
201
|
-
|
|
204
|
+
u(e(P), {
|
|
202
205
|
size: 12,
|
|
203
|
-
"icon-font": e(
|
|
206
|
+
"icon-font": e(le)
|
|
204
207
|
}, null, 8, ["icon-font"])
|
|
205
|
-
], 10,
|
|
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:
|
|
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
|
-
|
|
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
|
+
};
|
package/dist/components/tt-table/src/components/{TableToobalTools.vue.js → TableToolbarTools.vue.js}
RENAMED
|
@@ -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
|
|
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
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
const
|
|
22
|
-
__name: "
|
|
23
|
-
props:
|
|
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
|
|
26
|
+
const r = k, l = g, v = E(
|
|
27
27
|
"tableIdContext",
|
|
28
28
|
a(() => "")
|
|
29
|
-
), C = a(() => N(o(v), "table-toolbar-tools")),
|
|
30
|
-
function T(t,
|
|
31
|
-
|
|
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
|
|
34
|
-
|
|
33
|
+
function S(t) {
|
|
34
|
+
c.value.delete(t);
|
|
35
35
|
}
|
|
36
|
-
const
|
|
36
|
+
const _ = a(() => [
|
|
37
37
|
{
|
|
38
38
|
label: "自定义导出",
|
|
39
|
-
icon:
|
|
39
|
+
icon: F,
|
|
40
40
|
handler: () => l("on-export"),
|
|
41
|
-
if:
|
|
41
|
+
if: r.showExport
|
|
42
42
|
},
|
|
43
43
|
{
|
|
44
44
|
label: "刷新",
|
|
45
|
-
icon:
|
|
45
|
+
icon: j,
|
|
46
46
|
handler: () => l("on-refresh"),
|
|
47
|
-
if:
|
|
47
|
+
if: r.showRefresh
|
|
48
48
|
},
|
|
49
49
|
{
|
|
50
50
|
label: "列设置",
|
|
51
|
-
icon:
|
|
51
|
+
icon: L,
|
|
52
52
|
handler: () => l("on-columns-setting"),
|
|
53
|
-
if:
|
|
53
|
+
if: r.showSetColumn
|
|
54
54
|
}
|
|
55
55
|
]);
|
|
56
|
-
return (t,
|
|
57
|
-
t.showSetting ? (
|
|
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
|
-
(
|
|
64
|
-
e.if ? (
|
|
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) =>
|
|
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"])) :
|
|
90
|
+
}, 1032, ["content"])) : f("", !0)
|
|
93
91
|
], 64))), 128)),
|
|
94
92
|
u(t.$slots, "toolbar-right")
|
|
95
93
|
]),
|
|
96
94
|
_: 3
|
|
97
|
-
})) :
|
|
98
|
-
], 8,
|
|
95
|
+
})) : f("", !0)
|
|
96
|
+
], 8, P));
|
|
99
97
|
}
|
|
100
98
|
});
|
|
101
99
|
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
|
+
};
|