@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,84 +1,109 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { GlobalConfig as M } from "../../../../hooks/useSetup.js";
|
|
2
|
+
import "axios";
|
|
3
|
+
import "element-plus";
|
|
4
|
+
import { isArray as m } from "../../../../packages/utils/src/is.js";
|
|
5
|
+
import { ref as S, computed as P, unref as t, toValue as V, nextTick as $ } 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 oe(R, r, i, d) {
|
|
18
|
+
const { getRowKey: h } = d, a = S([]), k = S([]), K = P(() => {
|
|
19
|
+
const { showCheckbox: e, showRadio: o } = t(R), c = V(a);
|
|
20
|
+
return e ? c || [] : o ? c ? [c] : [] : [];
|
|
7
21
|
});
|
|
8
|
-
function
|
|
9
|
-
return
|
|
22
|
+
function x() {
|
|
23
|
+
return t(a);
|
|
10
24
|
}
|
|
11
|
-
function
|
|
12
|
-
|
|
13
|
-
|
|
25
|
+
function v() {
|
|
26
|
+
var n, s, w;
|
|
27
|
+
const { showCheckbox: e, showRadio: o, reserveSelection: c } = t(R);
|
|
28
|
+
if (e) {
|
|
29
|
+
const C = ((n = t(r)) == null ? void 0 : n.getCheckboxRecords(!0)) || [];
|
|
30
|
+
if (!c) return C;
|
|
31
|
+
const g = ((s = t(r)) == null ? void 0 : s.getCheckboxReserveRecords(!0)) || [], f = /* @__PURE__ */ new Map();
|
|
32
|
+
return C.forEach((l) => f.set(h(l), l)), g.forEach((l) => {
|
|
33
|
+
const b = h(l);
|
|
34
|
+
f.has(b) || f.set(b, l);
|
|
35
|
+
}), [...f.values()];
|
|
36
|
+
}
|
|
37
|
+
return o ? (w = t(r)) == null ? void 0 : w.getRadioRecord(!0) : [];
|
|
38
|
+
}
|
|
39
|
+
function A() {
|
|
40
|
+
var e;
|
|
41
|
+
return ((e = t(r)) == null ? void 0 : e.getTableData().fullData) || [];
|
|
14
42
|
}
|
|
15
|
-
function
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
keys: i(),
|
|
19
|
-
rows: a(),
|
|
20
|
-
data: e
|
|
21
|
-
});
|
|
43
|
+
function u(e) {
|
|
44
|
+
const o = v();
|
|
45
|
+
k.value = o, a.value = m(o) ? o.map((c) => h(c)) : o ? h(o) : void 0, i("selection-change", { keys: x(), rows: o, data: e });
|
|
22
46
|
}
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
},
|
|
26
|
-
|
|
47
|
+
const B = (e) => {
|
|
48
|
+
u(e), i("checkbox-change", e);
|
|
49
|
+
}, E = (e) => {
|
|
50
|
+
u(e), i("checkbox-all", e);
|
|
27
51
|
}, y = (e) => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
c && c.length === 1 || r(e);
|
|
31
|
-
}, d = async (e, c = []) => {
|
|
32
|
-
const { tableRowId: t, showCheckbox: w, showRadio: R } = o(u);
|
|
33
|
-
h.value = e, w && (b(c) && c.length === 0 && b(e) && e.length !== 0 && (c = e.map((g) => g[t || "id"])), s.value = c, o(n) && await o(n).setCheckboxRow(e, !0)), R && (e = e, s.value = e[t || "id"], o(n) && await o(n).setRadioRow(e)), setTimeout(() => {
|
|
34
|
-
l("selection-change", {
|
|
35
|
-
keys: i(),
|
|
36
|
-
rows: a()
|
|
37
|
-
});
|
|
38
|
-
}, 200);
|
|
39
|
-
}, S = () => {
|
|
40
|
-
const { showCheckbox: e, showRadio: c } = o(u);
|
|
41
|
-
e && (s.value = [], h.value = [], o(n) && o(n).clearCheckboxRow(), l("selection-change", {
|
|
42
|
-
keys: i(),
|
|
43
|
-
rows: a()
|
|
44
|
-
})), c && (s.value = void 0, h.value = void 0, o(n) && o(n).clearRadioRow());
|
|
52
|
+
var o;
|
|
53
|
+
i("checkbox-range-change", e), ((o = e.records) == null ? void 0 : o.length) !== 1 && u(e);
|
|
45
54
|
};
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
rows: a(),
|
|
55
|
-
data: e
|
|
56
|
-
});
|
|
57
|
-
}
|
|
55
|
+
function T(e) {
|
|
56
|
+
k.value = e.row, a.value = e.row ? h(e.row) : void 0, i("radio-change", e), i("selection-change", { keys: x(), rows: v(), data: e });
|
|
57
|
+
}
|
|
58
|
+
async function D(e) {
|
|
59
|
+
const { rows: o, cols: c } = e;
|
|
60
|
+
if (o.length === 1) return;
|
|
61
|
+
const n = t(r);
|
|
62
|
+
!n || !c.some((s) => s.type === "checkbox") || (await n.setCheckboxRow(o, !n.isCheckedByCheckboxRow(o[0])), u(e));
|
|
58
63
|
}
|
|
59
|
-
|
|
60
|
-
var
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
const F = (e) => {
|
|
65
|
+
var n;
|
|
66
|
+
const { checkboxConfig: o, showCheckbox: c } = t(R);
|
|
67
|
+
o != null && o.range && c ? y({ records: e.rows }) : (n = M.table) != null && n.isAreaCheckboxSelection && D(e), i("cell-area-selection-end", e);
|
|
68
|
+
};
|
|
69
|
+
async function G(e, o = []) {
|
|
70
|
+
var f, l;
|
|
71
|
+
const { showCheckbox: c, showRadio: n } = t(R), s = m(e) ? e : e ? [e] : [], w = /* @__PURE__ */ new Set([
|
|
72
|
+
...s.map((b) => h(b)),
|
|
73
|
+
...m(o) ? o : o == null ? [] : [o]
|
|
74
|
+
]), C = A().filter((b) => w.has(h(b))), g = C.length ? C : s;
|
|
75
|
+
c && await ((f = t(r)) == null ? void 0 : f.setCheckboxRow(g, !0)), n && await ((l = t(r)) == null ? void 0 : l.setRadioRow(g[0])), await $(), u();
|
|
76
|
+
}
|
|
77
|
+
function p() {
|
|
78
|
+
var n, s, w;
|
|
79
|
+
const { showCheckbox: e, showRadio: o, reserveSelection: c } = t(R);
|
|
80
|
+
!e && !o || (e && (a.value = [], k.value = [], (n = t(r)) == null || n.clearCheckboxRow(), c && ((s = t(r)) == null || s.clearCheckboxReserve())), o && (a.value = void 0, k.value = void 0, (w = t(r)) == null || w.clearRadioRow()), i("selection-change", { keys: x(), rows: v() }));
|
|
81
|
+
}
|
|
82
|
+
function L() {
|
|
83
|
+
const { showCheckbox: e, reserveSelection: o } = t(R);
|
|
84
|
+
if (!e || !o) {
|
|
85
|
+
p();
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
u();
|
|
66
89
|
}
|
|
67
90
|
return {
|
|
68
|
-
selectedKeys:
|
|
69
|
-
selectedRows:
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
91
|
+
selectedKeys: a,
|
|
92
|
+
selectedRows: k,
|
|
93
|
+
selectedKeyList: K,
|
|
94
|
+
getSelectRowKeys: x,
|
|
95
|
+
getSelectRows: v,
|
|
96
|
+
syncSelection: u,
|
|
97
|
+
setSelectedRowKeys: G,
|
|
98
|
+
clearSelectedRowKeys: p,
|
|
99
|
+
resetSelectionAfterFetch: L,
|
|
100
|
+
onCheckboxChange: B,
|
|
101
|
+
onCheckboxAll: E,
|
|
77
102
|
onCheckboxRangeChange: y,
|
|
78
|
-
onRadioChange:
|
|
79
|
-
|
|
103
|
+
onRadioChange: T,
|
|
104
|
+
onCellAreaSelectionEnd: F
|
|
80
105
|
};
|
|
81
106
|
}
|
|
82
107
|
export {
|
|
83
|
-
|
|
108
|
+
oe as useRowSelection
|
|
84
109
|
};
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
+
import { ComputedRef, Ref, nextTick } from 'vue';
|
|
1
2
|
import { VxeGridInstance } from 'vxe-table';
|
|
2
|
-
import { TtTableLeftRightRowNode, TtTableProps } from '../types/table';
|
|
3
3
|
import { Recordable } from '../../../../../../utils/src';
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
import { TtTableLeftRightRowNode, TtTableProps } from '../types/table';
|
|
5
|
+
/**
|
|
6
|
+
* 表格左右两侧自定义插槽
|
|
7
|
+
*
|
|
8
|
+
* 通过读取 vxe 的 body DOM 尺寸,让两侧插槽与表格行保持同高、同步滚动。
|
|
9
|
+
* @param propsRef 表格 props
|
|
10
|
+
* @param grid vxe-grid 实例
|
|
11
|
+
* @param rows 当前表格数据
|
|
12
|
+
*/
|
|
13
|
+
export declare function useSideSlot(propsRef: ComputedRef<TtTableProps>, grid: Ref<undefined | VxeGridInstance<Recordable>>, rows: Ref<Recordable[]>): {
|
|
14
|
+
refresh: (resetScroll?: boolean) => Promise<void>;
|
|
15
|
+
syncScroll: (scrollTop?: number) => Promise<void>;
|
|
16
|
+
rowNodes: Ref<{
|
|
9
17
|
offsetTop?: number | undefined;
|
|
10
18
|
rowid?: string | undefined;
|
|
11
19
|
item?: any;
|
|
@@ -20,8 +28,12 @@ export declare function useLeftRightSlot(propsRef: ComputedRef<TtTableProps>, xG
|
|
|
20
28
|
index?: number | undefined;
|
|
21
29
|
parent?: any;
|
|
22
30
|
}[]>;
|
|
23
|
-
|
|
24
|
-
|
|
31
|
+
headerHeight: import('vue').ShallowRef<number, number>;
|
|
32
|
+
bodyHeight: import('vue').ShallowRef<number, number>;
|
|
33
|
+
bodyWrapperHeight: import('vue').ShallowRef<number, number>;
|
|
34
|
+
bodyOffsetTop: import('vue').ShallowRef<number, number>;
|
|
35
|
+
bodyScrollHeight: import('vue').ShallowRef<number, number>;
|
|
36
|
+
leftScrollbarRef: Ref<({
|
|
25
37
|
$: import('vue').ComponentInternalInstance;
|
|
26
38
|
$data: {};
|
|
27
39
|
$props: {
|
|
@@ -116,7 +128,7 @@ export declare function useLeftRightSlot(propsRef: ComputedRef<TtTableProps>, xG
|
|
|
116
128
|
errorCaptured?: ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void)[];
|
|
117
129
|
};
|
|
118
130
|
$forceUpdate: () => void;
|
|
119
|
-
$nextTick: typeof
|
|
131
|
+
$nextTick: typeof nextTick;
|
|
120
132
|
$watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import('@vue/reactivity').OnCleanup]) => any : (...args: [any, any, import('@vue/reactivity').OnCleanup]) => any, options?: import('vue').WatchOptions): import('vue').WatchStopHandle;
|
|
121
133
|
} & Readonly<{
|
|
122
134
|
tabindex: number | string;
|
|
@@ -244,7 +256,7 @@ export declare function useLeftRightSlot(propsRef: ComputedRef<TtTableProps>, xG
|
|
|
244
256
|
errorCaptured?: ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void)[];
|
|
245
257
|
};
|
|
246
258
|
$forceUpdate: () => void;
|
|
247
|
-
$nextTick: typeof
|
|
259
|
+
$nextTick: typeof nextTick;
|
|
248
260
|
$watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import('@vue/reactivity').OnCleanup]) => any : (...args: [any, any, import('@vue/reactivity').OnCleanup]) => any, options?: import('vue').WatchOptions): import('vue').WatchStopHandle;
|
|
249
261
|
} & Readonly<{
|
|
250
262
|
tabindex: number | string;
|
|
@@ -278,7 +290,7 @@ export declare function useLeftRightSlot(propsRef: ComputedRef<TtTableProps>, xG
|
|
|
278
290
|
default?: (props: {}) => any;
|
|
279
291
|
};
|
|
280
292
|
}) | undefined>;
|
|
281
|
-
|
|
293
|
+
rightScrollbarRef: Ref<({
|
|
282
294
|
$: import('vue').ComponentInternalInstance;
|
|
283
295
|
$data: {};
|
|
284
296
|
$props: {
|
|
@@ -373,7 +385,7 @@ export declare function useLeftRightSlot(propsRef: ComputedRef<TtTableProps>, xG
|
|
|
373
385
|
errorCaptured?: ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void)[];
|
|
374
386
|
};
|
|
375
387
|
$forceUpdate: () => void;
|
|
376
|
-
$nextTick: typeof
|
|
388
|
+
$nextTick: typeof nextTick;
|
|
377
389
|
$watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import('@vue/reactivity').OnCleanup]) => any : (...args: [any, any, import('@vue/reactivity').OnCleanup]) => any, options?: import('vue').WatchOptions): import('vue').WatchStopHandle;
|
|
378
390
|
} & Readonly<{
|
|
379
391
|
tabindex: number | string;
|
|
@@ -501,7 +513,7 @@ export declare function useLeftRightSlot(propsRef: ComputedRef<TtTableProps>, xG
|
|
|
501
513
|
errorCaptured?: ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void)[];
|
|
502
514
|
};
|
|
503
515
|
$forceUpdate: () => void;
|
|
504
|
-
$nextTick: typeof
|
|
516
|
+
$nextTick: typeof nextTick;
|
|
505
517
|
$watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import('@vue/reactivity').OnCleanup]) => any : (...args: [any, any, import('@vue/reactivity').OnCleanup]) => any, options?: import('vue').WatchOptions): import('vue').WatchStopHandle;
|
|
506
518
|
} & Readonly<{
|
|
507
519
|
tabindex: number | string;
|
|
@@ -535,8 +547,4 @@ export declare function useLeftRightSlot(propsRef: ComputedRef<TtTableProps>, xG
|
|
|
535
547
|
default?: (props: {}) => any;
|
|
536
548
|
};
|
|
537
549
|
}) | undefined>;
|
|
538
|
-
tableBodyHeight: import('vue').ShallowRef<number, number>;
|
|
539
|
-
tableBodyWrapHeight: import('vue').ShallowRef<number, number>;
|
|
540
|
-
tableBodyScrollTop: import('vue').ShallowRef<number, number>;
|
|
541
|
-
tableBodyScrollHeight: import('vue').ShallowRef<number, number>;
|
|
542
550
|
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import "axios";
|
|
2
|
+
import "element-plus";
|
|
3
|
+
import { isUndefined as A, isServer as T } from "../../../../packages/utils/src/is.js";
|
|
4
|
+
import { computed as E, unref as t, ref as b, shallowRef as u, watch as W, onScopeDispose as R, nextTick as k } from "vue";
|
|
5
|
+
import "dayjs";
|
|
6
|
+
import "numeral";
|
|
7
|
+
import "xe-utils";
|
|
8
|
+
import "dayjs/plugin/utc";
|
|
9
|
+
import "dayjs/plugin/timezone";
|
|
10
|
+
import "../../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
|
|
11
|
+
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js";
|
|
12
|
+
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js";
|
|
13
|
+
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
|
|
14
|
+
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
|
|
15
|
+
import "lodash-es";
|
|
16
|
+
function V(c, s, N) {
|
|
17
|
+
const f = E(() => !!(t(c).leftSlotWidth || t(c).rightSlotWidth)), w = b(), g = b(), d = u(0), m = u(0), p = u(0), h = u(0), y = u(0), v = b([]), a = /* @__PURE__ */ new Set();
|
|
18
|
+
function q() {
|
|
19
|
+
return new Promise((r) => {
|
|
20
|
+
let e = !1, o;
|
|
21
|
+
const n = (l) => {
|
|
22
|
+
e || (e = !0, a.delete(i), r(l));
|
|
23
|
+
}, i = () => {
|
|
24
|
+
e || (e = !0, !A(o) && !T && window.cancelAnimationFrame(o), a.delete(i), r(!1));
|
|
25
|
+
};
|
|
26
|
+
a.add(i), k(() => {
|
|
27
|
+
if (!e) {
|
|
28
|
+
if (T || !window.requestAnimationFrame) {
|
|
29
|
+
n(!0);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
o = window.requestAnimationFrame(() => n(!0));
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
async function x(r) {
|
|
38
|
+
var o, n, i, l;
|
|
39
|
+
if (!t(f) || !await q()) return;
|
|
40
|
+
const e = (n = (o = t(s)) == null ? void 0 : o.$el) == null ? void 0 : n.querySelector(".vxe-table--body");
|
|
41
|
+
e && (m.value = e.clientHeight, y.value = Number.parseFloat(e.style.marginTop) || 0, v.value = Array.from(e.querySelectorAll(".vxe-body--row")).map((H) => {
|
|
42
|
+
var F;
|
|
43
|
+
return {
|
|
44
|
+
...(F = t(s)) == null ? void 0 : F.getRowNode(H),
|
|
45
|
+
offsetTop: H.offsetTop
|
|
46
|
+
};
|
|
47
|
+
}), !A(r) && ((i = t(w)) == null || i.scrollTo({ top: r }), (l = t(g)) == null || l.scrollTo({ top: r })));
|
|
48
|
+
}
|
|
49
|
+
async function S(r = !0) {
|
|
50
|
+
var o, n, i, l;
|
|
51
|
+
if (!t(f) || !await q()) return;
|
|
52
|
+
const e = (o = t(s)) == null ? void 0 : o.$el;
|
|
53
|
+
d.value = ((n = e == null ? void 0 : e.querySelector(".vxe-table--body-wrapper")) == null ? void 0 : n.clientHeight) || 0, p.value = ((i = e == null ? void 0 : e.querySelector(".vxe-table--header")) == null ? void 0 : i.clientHeight) || 0, h.value = Number.parseFloat((l = e == null ? void 0 : e.querySelector(".vxe-body--y-space")) == null ? void 0 : l.style.height) || 0, x(r ? 0 : void 0);
|
|
54
|
+
}
|
|
55
|
+
return W(N, () => S()), W([() => t(c).leftSlotWidth, () => t(c).rightSlotWidth], () => {
|
|
56
|
+
if (t(f)) {
|
|
57
|
+
S();
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
d.value = 0, m.value = 0, p.value = 0, y.value = 0, h.value = 0, v.value = [];
|
|
61
|
+
}), R(() => {
|
|
62
|
+
a.forEach((r) => r()), a.clear();
|
|
63
|
+
}), {
|
|
64
|
+
refresh: S,
|
|
65
|
+
syncScroll: x,
|
|
66
|
+
rowNodes: v,
|
|
67
|
+
headerHeight: p,
|
|
68
|
+
bodyHeight: m,
|
|
69
|
+
bodyWrapperHeight: d,
|
|
70
|
+
bodyOffsetTop: y,
|
|
71
|
+
bodyScrollHeight: h,
|
|
72
|
+
leftScrollbarRef: w,
|
|
73
|
+
rightScrollbarRef: g
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
export {
|
|
77
|
+
V as useSideSlot
|
|
78
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Recordable } from '../../../../../../utils/src';
|
|
2
|
+
/**
|
|
3
|
+
* 将父组件显式传入的 props 同步到内部 store。
|
|
4
|
+
*
|
|
5
|
+
* 配置项按 key 建立独立 watcher,外部变化时直接写入对应 key,不保存快照,也不做
|
|
6
|
+
* 内容快照或其他比较。这样内部 API 对 store 的改动不会被无关的父组件更新覆盖,
|
|
7
|
+
* v-model、data 与 columns 也不会被配置 watcher 深度遍历。
|
|
8
|
+
* @param props 组件 props
|
|
9
|
+
* @param setState store 写入方法
|
|
10
|
+
* @param exclude 不参与同步的 props
|
|
11
|
+
*/
|
|
12
|
+
export declare function useSyncProps(props: Recordable, setState: (state: Recordable) => void, exclude?: string[]): void;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { kebabToCamelCase as a } from "../../../../packages/utils/src/string.js";
|
|
2
|
+
import "axios";
|
|
3
|
+
import "element-plus";
|
|
4
|
+
import { isObject as h, isArray as b } from "../../../../packages/utils/src/is.js";
|
|
5
|
+
import { getCurrentInstance as P, watch as p, toValue as g } 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
|
+
const f = ["data"], j = ["columns"];
|
|
18
|
+
function D(t, m, l = []) {
|
|
19
|
+
var c;
|
|
20
|
+
const i = P();
|
|
21
|
+
function u(o) {
|
|
22
|
+
var s;
|
|
23
|
+
const r = ((s = i == null ? void 0 : i.vnode) == null ? void 0 : s.props) || {};
|
|
24
|
+
return Object.keys(r).some((d) => a(d) === o);
|
|
25
|
+
}
|
|
26
|
+
const e = Array.from(
|
|
27
|
+
new Set(
|
|
28
|
+
Object.keys(((c = i == null ? void 0 : i.vnode) == null ? void 0 : c.props) || {}).map(a).filter((o) => !o.startsWith("on") && o in t).filter((o) => !l.includes(o) && !f.includes(o))
|
|
29
|
+
)
|
|
30
|
+
), n = {};
|
|
31
|
+
e.forEach((o) => {
|
|
32
|
+
n[o] = t[o];
|
|
33
|
+
}), Object.keys(n).length && m(n), e.forEach((o) => {
|
|
34
|
+
p(
|
|
35
|
+
() => t[o],
|
|
36
|
+
(r) => m({ [o]: r }),
|
|
37
|
+
// 逐 key 写入是「内部改动不被父组件覆盖」的必要条件,不能合并成一个 deep watcher:
|
|
38
|
+
// 合并后任意一个配置变化都会整包回写,把内部通过 setState 改过的其他 key 冲掉。
|
|
39
|
+
{ deep: !j.includes(o) && (h(t[o]) || b(t[o])) }
|
|
40
|
+
);
|
|
41
|
+
}), f.forEach((o) => {
|
|
42
|
+
p(
|
|
43
|
+
[() => t[o], () => {
|
|
44
|
+
var r;
|
|
45
|
+
return (r = g(t[o])) == null ? void 0 : r.length;
|
|
46
|
+
}],
|
|
47
|
+
([r]) => {
|
|
48
|
+
u(o) && m({ [o]: r });
|
|
49
|
+
},
|
|
50
|
+
{ immediate: !0 }
|
|
51
|
+
);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
export {
|
|
55
|
+
D as useSyncProps
|
|
56
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { MaybeRefOrGetter, ModelRef, Ref } from 'vue';
|
|
2
|
+
import { VxeGridInstance } from 'vxe-table';
|
|
3
|
+
import { Recordable } from '../../../../../../utils/src';
|
|
4
|
+
import { TtTableProps } from '../types/table';
|
|
5
|
+
import { RowsCommitSource } from '../table-mutation-events';
|
|
6
|
+
/** 表格数据相关事件 */
|
|
7
|
+
type DataEmit = {
|
|
8
|
+
(e: "load-data"): void;
|
|
9
|
+
};
|
|
10
|
+
/** 判断当前异步落表任务是否仍可提交。 */
|
|
11
|
+
type RowsCommitGuard = () => boolean;
|
|
12
|
+
/** 表格数据源的独立 store 选择器,避免无关配置变化触发数据监听。 */
|
|
13
|
+
type TableDataSources = {
|
|
14
|
+
api: MaybeRefOrGetter<TtTableProps["api"] | undefined>;
|
|
15
|
+
data: MaybeRefOrGetter<TtTableProps["data"] | undefined>;
|
|
16
|
+
/** 数据进入 VXE 前的行身份预处理。 */
|
|
17
|
+
prepareRows?: (rows: Recordable | Recordable[]) => void;
|
|
18
|
+
/** 通过公开实例调用 VXE 选中方法后,重新读取选中态。 */
|
|
19
|
+
onSelectionMutated?: () => void;
|
|
20
|
+
};
|
|
21
|
+
/** VXE 方法调用的统一类型。 */
|
|
22
|
+
type TableDataOperation<T> = () => Promise<T> | T;
|
|
23
|
+
/**
|
|
24
|
+
* 读取外部传入的表格数据源的当前值。
|
|
25
|
+
*
|
|
26
|
+
* 表格内部的数据源可能来自一个 getter,也可能是 `data: ref(rows)`。
|
|
27
|
+
* 先读取外层 MaybeRefOrGetter,再显式处理 getter 返回的 Ref,避免在业务逻辑中出现
|
|
28
|
+
* 隐晦的嵌套 `toValue`。空数组是有效数据,只有外层数据源不存在时才返回 undefined。
|
|
29
|
+
* @param source 外层数据源
|
|
30
|
+
*/
|
|
31
|
+
export declare function getExternalRowsValue(source: MaybeRefOrGetter<TtTableProps["data"] | undefined>): undefined | Recordable[];
|
|
32
|
+
/**
|
|
33
|
+
* 在操作前后保留树形展开状态
|
|
34
|
+
* @param grid vxe-grid 实例
|
|
35
|
+
* @param reserve 是否需要保留(treeConfig.reserve)
|
|
36
|
+
* @param handler 需要执行的操作
|
|
37
|
+
* @param guard 操作完成后是否仍允许恢复展开状态
|
|
38
|
+
*/
|
|
39
|
+
export declare function withTreeExpand<T>(grid: undefined | VxeGridInstance<Recordable>, reserve: boolean | undefined, handler: () => Promise<T> | T, guard?: () => boolean): Promise<T>;
|
|
40
|
+
/**
|
|
41
|
+
* 表格数据落表的唯一出口
|
|
42
|
+
*
|
|
43
|
+
* 外部 data / v-model 只经由 loadRows 写入 vxe-grid;请求结果和表格内部操作再通过 emitRows 回写 v-model,
|
|
44
|
+
* 避免把输入和输出混在同一条链路里。
|
|
45
|
+
*
|
|
46
|
+
* 外部数据的变化监听只追踪到「行引用」这一层,不进入行对象内部做字段对比:
|
|
47
|
+
* 表格写回时附加一次内部事件版本,外部原样传回时消费版本并跳过重复落表;
|
|
48
|
+
* 换数组、增删行、整行替换都会重新落表,只改行内字段不会 ——
|
|
49
|
+
* 行对象与外部共享,改字段单元格会自己更新,无需重新落表。
|
|
50
|
+
* @param propsRef 表格 props
|
|
51
|
+
* @param grid vxe-grid 实例
|
|
52
|
+
* @param modelValue v-model 数据
|
|
53
|
+
* @param emit 组件 emit
|
|
54
|
+
* @param sources 从 store 独立选择的数据与接口来源
|
|
55
|
+
*/
|
|
56
|
+
export declare function useTableData(propsRef: Ref<TtTableProps>, grid: Ref<undefined | VxeGridInstance<Recordable>>, modelValue: ModelRef<Recordable[] | undefined>, emit: DataEmit, sources: TableDataSources): {
|
|
57
|
+
rows: import('vue').ShallowRef<Recordable[], Recordable[]>;
|
|
58
|
+
loadRows: (nextRows: Recordable[], guard?: RowsCommitGuard) => Promise<boolean>;
|
|
59
|
+
applyRows: (nextRows: Recordable[], guard?: RowsCommitGuard) => Promise<boolean>;
|
|
60
|
+
emitRows: (nextRows: Recordable[]) => void;
|
|
61
|
+
getDataSource: <T = Recordable>() => T[];
|
|
62
|
+
runDataOperation: <T>(operation: TableDataOperation<T>, source?: RowsCommitSource) => Promise<T>;
|
|
63
|
+
scheduleRowsCommit: (source?: RowsCommitSource) => void;
|
|
64
|
+
cancelRowsCommit: () => void;
|
|
65
|
+
onDataChange: () => void;
|
|
66
|
+
commitRows: (source?: RowsCommitSource) => boolean;
|
|
67
|
+
createTableInstanceFacade: (instance: undefined | VxeGridInstance<Recordable>) => VxeGridInstance<Recordable> | undefined;
|
|
68
|
+
/** 判断表格作用域是否仍然有效。 */
|
|
69
|
+
isActive: () => boolean;
|
|
70
|
+
};
|
|
71
|
+
export {};
|