@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.
- package/dist/components/tt-api-component/index.js +4 -3
- package/dist/components/tt-api-component/index.vue2.js +4 -3
- package/dist/components/tt-area/TtArea.vue.js +1 -1
- package/dist/components/tt-area/TtArea.vue3.js +8 -7
- package/dist/components/tt-button/index.js +5 -4
- package/dist/components/tt-button/index.vue2.js +4 -3
- package/dist/components/tt-checkbox/index.js +4 -3
- package/dist/components/tt-checkbox/index.vue.js +4 -3
- package/dist/components/tt-drawer/index.js +4 -3
- package/dist/components/tt-drawer/src/RenderDrawer.vue.js +4 -3
- package/dist/components/tt-drawer/src/components/DrawerFooter.vue.js +8 -7
- package/dist/components/tt-drawer/src/components/DrawerHeader.vue.js +2 -2
- package/dist/components/tt-drawer/src/components/DrawerHeader.vue2.js +3 -2
- package/dist/components/tt-drawer/src/hooks/useResizable.js +2 -2
- package/dist/components/tt-drawer/src/props.js +3 -2
- package/dist/components/tt-drawer/src/utils/drawer-api.js +4 -2
- package/dist/components/tt-empty/index.js +9 -8
- package/dist/components/tt-form/index.js +10 -9
- package/dist/components/tt-form/src/components/ExpandableArrow.vue2.js +3 -2
- package/dist/components/tt-form/src/components/FormActions.vue2.js +4 -2
- package/dist/components/tt-form/src/form/FormDescription.vue.js +3 -2
- package/dist/components/tt-form/src/form/FormItem.vue.js +6 -5
- package/dist/components/tt-form/src/form/FormLabel.vue.js +8 -7
- package/dist/components/tt-form/src/form/RenderContent.vue.js +4 -3
- package/dist/components/tt-form/src/form-render/FormField.vue2.js +30 -28
- package/dist/components/tt-form/src/form-render/FormLabel.vue2.js +4 -2
- 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 +1 -0
- package/dist/components/tt-form/src/form-render/array-register/utils.js +6 -4
- package/dist/components/tt-form/src/form-render/dependencies.js +19 -18
- package/dist/components/tt-form/src/form-render/form.vue2.js +4 -2
- package/dist/components/tt-form/src/form-render/helper.js +15 -14
- package/dist/components/tt-form/src/form-render/rootWrapperClass.js +3 -2
- package/dist/components/tt-form/src/formApi.js +3 -2
- package/dist/components/tt-form/src/group-form/GroupForm.vue2.js +4 -3
- package/dist/components/tt-form/src/group-form/GroupSection.vue2.js +2 -0
- package/dist/components/tt-form/src/group-form/LazyFormField.vue.js +4 -2
- package/dist/components/tt-form/src/group-form/groupFormApi.js +4 -3
- package/dist/components/tt-form/src/hooks/useForwardPriorityValues.js +3 -2
- package/dist/components/tt-form/src/hooks/useSelectCollapse.js +28 -27
- package/dist/components/tt-form/src/index.vue2.js +3 -2
- package/dist/components/tt-form/src/useFormContext.js +11 -10
- package/dist/components/tt-form-item-error-tooltip/index.js +5 -4
- package/dist/components/tt-form-item-error-tooltip/index.vue.js +4 -3
- package/dist/components/tt-icon/index.js +6 -5
- package/dist/components/tt-icon/index.vue.js +2 -2
- package/dist/components/tt-image/index.js +6 -5
- package/dist/components/tt-image/src/components/ImageViewer.js +7 -6
- package/dist/components/tt-loading/index.js +4 -3
- package/dist/components/tt-loading/src/directive.js +24 -23
- package/dist/components/tt-loading/src/loading.vue.js +2 -2
- package/dist/components/tt-log/index.js +4 -3
- package/dist/components/tt-log/index.vue.js +3 -2
- package/dist/components/tt-modal/index.js +3 -2
- package/dist/components/tt-modal/src/RenderModal.vue.js +3 -2
- package/dist/components/tt-modal/src/components/ModalFooter.vue2.js +3 -2
- package/dist/components/tt-modal/src/components/ModalHeader.vue2.js +3 -2
- package/dist/components/tt-modal/src/components/ModalWrapper.vue.js +15 -14
- package/dist/components/tt-modal/src/props.js +3 -2
- package/dist/components/tt-modal/src/utils/modal-api.js +4 -2
- package/dist/components/tt-modal-form/index.vue.js +4 -3
- package/dist/components/tt-nav-anchor/index.js +4 -3
- package/dist/components/tt-nav-anchor/src/TtNavAnchor.vue.js +15 -14
- package/dist/components/tt-panel-select/index.js +4 -3
- package/dist/components/tt-panel-select/src/components/PanelMiddle.vue.d.ts +2 -2
- package/dist/components/tt-panel-select/src/hooks/usePanelData.js +95 -87
- package/dist/components/tt-panel-select/src/index.vue.js +4 -2
- package/dist/components/tt-radio-group/index.js +4 -3
- package/dist/components/tt-radio-group/index.vue.js +7 -6
- package/dist/components/tt-select/index.js +4 -3
- package/dist/components/tt-select/src/Select.vue.d.ts +12 -12
- package/dist/components/tt-select/src/Select.vue.js +4 -3
- package/dist/components/tt-select/src/components/SelectTable.vue.d.ts +116 -7
- package/dist/components/tt-select/src/components/SelectTable.vue.js +3 -2
- package/dist/components/tt-select/src/components/Table.vue.d.ts +8 -8
- package/dist/components/tt-select/src/components/Table.vue.js +3 -2
- package/dist/components/tt-select/src/hooks/useDataSource.js +4 -3
- package/dist/components/tt-select/src/hooks/useKeyboard.d.ts +7 -1
- package/dist/components/tt-select/src/hooks/useSelect.js +3 -2
- package/dist/components/tt-select/src/hooks/useSelectTableEvent.d.ts +1 -1
- package/dist/components/tt-select/src/hooks/useSelectTableEvent.js +28 -27
- package/dist/components/tt-select/src/props.d.ts +2 -2
- package/dist/components/tt-table/index.d.ts +526 -361
- package/dist/components/tt-table/index.js +7 -5
- package/dist/components/tt-table/src/Table.vue.d.ts +308 -218
- package/dist/components/tt-table/src/Table.vue.js +406 -618
- package/dist/components/tt-table/src/TableForm.vue.d.ts +384 -19
- package/dist/components/tt-table/src/TableForm.vue.js +219 -229
- package/dist/components/tt-table/src/components/TableAction.vue.js +110 -131
- package/dist/components/tt-table/src/components/TableButtons.js +30 -29
- package/dist/components/tt-table/src/components/TableColumnModal.vue2.js +88 -84
- 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} +34 -35
- package/dist/components/tt-table/src/components/TableToolbarTools.vue2.js +4 -0
- package/dist/components/tt-table/src/emits.d.ts +10 -1
- 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 +64 -0
- package/dist/components/tt-table/src/hooks/useColumns.d.ts +505 -21
- package/dist/components/tt-table/src/hooks/useColumns.js +101 -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 +98 -0
- package/dist/components/tt-table/src/hooks/usePagination.d.ts +14 -8
- package/dist/components/tt-table/src/hooks/usePagination.js +30 -33
- package/dist/components/tt-table/src/hooks/useQuery.d.ts +41 -0
- package/dist/components/tt-table/src/hooks/useQuery.js +148 -0
- package/dist/components/tt-table/src/hooks/useRowIdentity.d.ts +22 -0
- package/dist/components/tt-table/src/hooks/useRowIdentity.js +97 -0
- package/dist/components/tt-table/src/hooks/useRowSelection.d.ts +24 -12
- package/dist/components/tt-table/src/hooks/useRowSelection.js +95 -70
- package/dist/components/tt-table/src/hooks/{useLeftRightSlot.d.ts → useSideSlot.d.ts} +25 -17
- package/dist/components/tt-table/src/hooks/useSideSlot.js +78 -0
- package/dist/components/tt-table/src/hooks/useSyncProps.d.ts +12 -0
- package/dist/components/tt-table/src/hooks/useSyncProps.js +56 -0
- package/dist/components/tt-table/src/hooks/useTableData.d.ts +71 -0
- package/dist/components/tt-table/src/hooks/useTableData.js +308 -0
- package/dist/components/tt-table/src/hooks/useTableFooter.d.ts +15 -0
- package/dist/components/tt-table/src/hooks/useTableFooter.js +47 -0
- package/dist/components/tt-table/src/hooks/useTableForm.d.ts +10 -5
- package/dist/components/tt-table/src/hooks/useTableForm.js +56 -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 +57 -55
- package/dist/components/tt-table/src/props.d.ts +326 -153
- package/dist/components/tt-table/src/props.js +125 -271
- 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 +71 -0
- package/dist/components/tt-table/src/types/table.d.ts +223 -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 +51 -0
- package/dist/components/tt-table/src/utils/context.js +26 -12
- package/dist/components/tt-table/src/utils/table-api.d.ts +136 -58
- package/dist/components/tt-table/src/utils/table-api.js +200 -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 +35 -23
- package/dist/components/tt-text/index.js +4 -3
- package/dist/components/tt-upload/index.js +6 -5
- package/dist/components/tt-upload/src/TtUpload.vue.js +4 -3
- package/dist/components/types.d.ts +0 -20
- package/dist/directives/disabled-tip/index.js +9 -8
- package/dist/hooks/useFormSchemasLink.js +4 -3
- package/dist/hooks/useFormat.d.ts +35 -71
- package/dist/hooks/useFormat.js +28 -39
- package/dist/hooks/usePanelSelectSchemas.js +4 -3
- package/dist/hooks/useScreenshotOss.js +16 -15
- package/dist/hooks/useSetup.js +0 -3
- package/dist/packages/hooks/src/useDebounce.js +6 -5
- package/dist/packages/hooks/src/useElementScreenshot.js +4 -3
- package/dist/packages/hooks/src/usePriorityValue.js +5 -4
- package/dist/packages/utils/src/format.js +48 -0
- package/dist/packages/utils/src/is.js +20 -18
- package/dist/packages/utils/src/tool.js +76 -149
- package/dist/plugins/default/renderCellContent.js +4 -3
- package/dist/plugins/vxeTable/switchStatus.js +14 -13
- package/dist/style.css +1 -1
- 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,15 +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
|
|
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
|
|
24
|
-
import { useModalRender as
|
|
25
|
-
const
|
|
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(
|
|
33
|
-
const
|
|
34
|
-
let
|
|
35
|
-
const
|
|
36
|
-
() => i.value.map((t) =>
|
|
37
|
-
),
|
|
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
|
|
41
|
+
return d.value.some((l) => l.field === t && l.locked);
|
|
40
42
|
}
|
|
41
|
-
function
|
|
42
|
-
i.value =
|
|
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
|
|
46
|
+
function H(t) {
|
|
45
47
|
i.value = i.value.filter((l) => l !== t);
|
|
46
48
|
}
|
|
47
|
-
function
|
|
49
|
+
function J() {
|
|
48
50
|
i.value = i.value.filter(M);
|
|
49
51
|
}
|
|
50
52
|
function _() {
|
|
51
|
-
|
|
53
|
+
R("on-submit", {
|
|
52
54
|
checkedModel: [...i.value],
|
|
53
55
|
modalApi: g,
|
|
54
56
|
isExport: y.value
|
|
55
57
|
});
|
|
56
58
|
}
|
|
57
|
-
function
|
|
58
|
-
y.value =
|
|
59
|
-
const k = new Set(
|
|
60
|
-
i.value = [...new Set(l.filter((
|
|
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
|
|
63
|
-
|
|
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: (
|
|
66
|
-
onEnd(
|
|
67
|
-
|
|
68
|
-
const { oldIndex:
|
|
69
|
-
if (
|
|
70
|
-
|
|
71
|
-
|
|
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
|
|
79
|
+
function W() {
|
|
76
80
|
var t, l;
|
|
77
|
-
y.value ? (t =
|
|
81
|
+
y.value ? (t = c.openExport) == null || t.call(c, !0) : (l = c.openColumn) == null || l.call(c, !0);
|
|
78
82
|
}
|
|
79
|
-
return
|
|
83
|
+
return D({
|
|
80
84
|
handleSubmit: _,
|
|
81
|
-
openModal:
|
|
85
|
+
openModal: K,
|
|
82
86
|
setModalProps(t) {
|
|
83
87
|
g.setModalProps(t);
|
|
84
88
|
}
|
|
85
|
-
}), (t, l) => (
|
|
89
|
+
}), (t, l) => (p(), w(e(G), {
|
|
86
90
|
width: "720",
|
|
87
91
|
class: a(e(n)),
|
|
88
92
|
onOk: _
|
|
89
|
-
},
|
|
90
|
-
beforeFooter:
|
|
91
|
-
|
|
93
|
+
}, Y({
|
|
94
|
+
beforeFooter: r(() => [
|
|
95
|
+
m("div", {
|
|
92
96
|
class: a(`${e(n)}-footer-left`)
|
|
93
97
|
}, [
|
|
94
|
-
|
|
95
|
-
default:
|
|
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:
|
|
104
|
-
|
|
107
|
+
default: r(() => [
|
|
108
|
+
m("div", {
|
|
105
109
|
class: a(`${e(n)}-body`)
|
|
106
110
|
}, [
|
|
107
|
-
|
|
111
|
+
u(e(B), {
|
|
108
112
|
class: a(`${e(n)}-source`)
|
|
109
113
|
}, {
|
|
110
|
-
default:
|
|
111
|
-
|
|
114
|
+
default: r(() => [
|
|
115
|
+
u(e(z), {
|
|
112
116
|
class: a(`${e(n)}-all`),
|
|
113
|
-
"model-value":
|
|
114
|
-
indeterminate:
|
|
115
|
-
onChange:
|
|
117
|
+
"model-value": F.value,
|
|
118
|
+
indeterminate: j.value,
|
|
119
|
+
onChange: q
|
|
116
120
|
}, {
|
|
117
|
-
default:
|
|
118
|
-
h(" 全部(" + $(i.value.length) + "/" + $(
|
|
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
|
-
|
|
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:
|
|
128
|
-
(
|
|
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:
|
|
134
|
-
|
|
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:
|
|
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
|
-
|
|
157
|
+
m("div", {
|
|
154
158
|
class: a(`${e(n)}-picked`)
|
|
155
159
|
}, [
|
|
156
|
-
|
|
160
|
+
m("header", {
|
|
157
161
|
class: a(`${e(n)}-picked-head`)
|
|
158
162
|
}, [
|
|
159
|
-
|
|
160
|
-
|
|
163
|
+
m("span", null, "已选 " + $(S.value.length) + " 列", 1),
|
|
164
|
+
m("span", {
|
|
161
165
|
class: a(`${e(n)}-clear`),
|
|
162
|
-
onClick:
|
|
166
|
+
onClick: J
|
|
163
167
|
}, "清空", 2)
|
|
164
168
|
], 2),
|
|
165
|
-
|
|
166
|
-
default:
|
|
167
|
-
|
|
168
|
-
ref:
|
|
169
|
+
u(e(B), null, {
|
|
170
|
+
default: r(() => [
|
|
171
|
+
m("ul", {
|
|
172
|
+
ref: Q,
|
|
169
173
|
class: a(`${e(n)}-list`)
|
|
170
174
|
}, [
|
|
171
|
-
(
|
|
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
|
-
|
|
179
|
+
m("span", {
|
|
176
180
|
class: a(`${e(n)}-item-main`)
|
|
177
181
|
}, [
|
|
178
|
-
|
|
182
|
+
u(e(P), {
|
|
179
183
|
class: a(`${e(n)}-item-drag`),
|
|
180
184
|
size: 14,
|
|
181
|
-
icon: e(
|
|
185
|
+
icon: e(te),
|
|
182
186
|
"is-custom-svg": ""
|
|
183
187
|
}, null, 8, ["class", "icon"]),
|
|
184
|
-
|
|
188
|
+
u(e(oe), {
|
|
185
189
|
"tool-tip": !1,
|
|
186
190
|
class: a(`${e(n)}-item-title`)
|
|
187
191
|
}, {
|
|
188
|
-
default:
|
|
192
|
+
default: r(() => [
|
|
189
193
|
h($(o.title || ""), 1)
|
|
190
194
|
]),
|
|
191
195
|
_: 2
|
|
192
196
|
}, 1032, ["class"])
|
|
193
197
|
], 2),
|
|
194
|
-
o.locked ?
|
|
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:
|
|
203
|
+
onClick: ee((f) => H(o.field), ["stop"])
|
|
200
204
|
}, [
|
|
201
|
-
|
|
205
|
+
u(e(P), {
|
|
202
206
|
size: 12,
|
|
203
|
-
"icon-font": e(
|
|
207
|
+
"icon-font": e(le)
|
|
204
208
|
}, null, 8, ["icon-font"])
|
|
205
|
-
], 10,
|
|
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:
|
|
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
|
-
|
|
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
|
+
};
|
package/dist/components/tt-table/src/components/{TableToobalTools.vue.js → TableToolbarTools.vue.js}
RENAMED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { defineComponent as x, inject as E, computed as a, unref as
|
|
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
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
const
|
|
22
|
-
__name: "
|
|
23
|
-
props:
|
|
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
|
|
27
|
+
const r = k, l = g, v = E(
|
|
27
28
|
"tableIdContext",
|
|
28
29
|
a(() => "")
|
|
29
|
-
), C = a(() => N(
|
|
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
|
|
34
|
+
function S(t) {
|
|
34
35
|
p.value.delete(t);
|
|
35
36
|
}
|
|
36
|
-
const
|
|
37
|
+
const _ = a(() => [
|
|
37
38
|
{
|
|
38
39
|
label: "自定义导出",
|
|
39
|
-
icon:
|
|
40
|
+
icon: F,
|
|
40
41
|
handler: () => l("on-export"),
|
|
41
|
-
if:
|
|
42
|
+
if: r.showExport
|
|
42
43
|
},
|
|
43
44
|
{
|
|
44
45
|
label: "刷新",
|
|
45
|
-
icon:
|
|
46
|
+
icon: j,
|
|
46
47
|
handler: () => l("on-refresh"),
|
|
47
|
-
if:
|
|
48
|
+
if: r.showRefresh
|
|
48
49
|
},
|
|
49
50
|
{
|
|
50
51
|
label: "列设置",
|
|
51
|
-
icon:
|
|
52
|
+
icon: L,
|
|
52
53
|
handler: () => l("on-columns-setting"),
|
|
53
|
-
if:
|
|
54
|
+
if: r.showSetColumn
|
|
54
55
|
}
|
|
55
56
|
]);
|
|
56
|
-
return (t, c) => (
|
|
57
|
-
t.showSetting ? (
|
|
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
|
-
(
|
|
64
|
-
|
|
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:
|
|
69
|
+
content: o.label,
|
|
71
70
|
placement: "top",
|
|
72
71
|
"show-after": 200
|
|
73
72
|
}, {
|
|
74
73
|
default: m(() => [
|
|
75
|
-
h(
|
|
74
|
+
h(e(y), {
|
|
76
75
|
class: "icon-table-btn",
|
|
77
|
-
"aria-label":
|
|
78
|
-
onClick: (w) => T(i,
|
|
79
|
-
onAnimationend: (w) =>
|
|
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(
|
|
83
|
-
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"])) :
|
|
91
|
+
}, 1032, ["content"])) : f("", !0)
|
|
93
92
|
], 64))), 128)),
|
|
94
93
|
u(t.$slots, "toolbar-right")
|
|
95
94
|
]),
|
|
96
95
|
_: 3
|
|
97
|
-
})) :
|
|
98
|
-
], 8,
|
|
96
|
+
})) : f("", !0)
|
|
97
|
+
], 8, P));
|
|
99
98
|
}
|
|
100
99
|
});
|
|
101
100
|
export {
|
|
102
|
-
|
|
101
|
+
it as default
|
|
103
102
|
};
|
|
@@ -1 +1,10 @@
|
|
|
1
|
-
|
|
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[];
|
|
@@ -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
|
+
};
|