@dazhicheng/ui 1.6.0 → 1.6.2
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.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.vue2.js +3 -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.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-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-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/hooks/usePanelData.js +4 -3
- package/dist/components/tt-panel-select/src/index.vue.js +3 -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 +8 -8
- 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 +4 -4
- 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 +6 -6
- package/dist/components/tt-table/index.js +1 -1
- package/dist/components/tt-table/src/Table.vue.d.ts +4 -4
- package/dist/components/tt-table/src/Table.vue.js +178 -175
- package/dist/components/tt-table/src/TableForm.vue.d.ts +6 -6
- package/dist/components/tt-table/src/TableForm.vue.js +2 -2
- package/dist/components/tt-table/src/components/TableAction.vue.js +19 -17
- package/dist/components/tt-table/src/components/TableButtons.js +10 -9
- package/dist/components/tt-table/src/components/TableColumnModal.vue2.js +4 -3
- package/dist/components/tt-table/src/components/TableToolbarTools.vue.js +18 -17
- package/dist/components/tt-table/src/emits.d.ts +10 -1
- package/dist/components/tt-table/src/hooks/useColumnPersistence.js +17 -16
- package/dist/components/tt-table/src/hooks/useColumns.js +4 -3
- package/dist/components/tt-table/src/hooks/useKeyboardNav.js +34 -33
- package/dist/components/tt-table/src/hooks/usePagination.js +12 -11
- package/dist/components/tt-table/src/hooks/useQuery.js +6 -5
- package/dist/components/tt-table/src/hooks/useRowIdentity.d.ts +1 -0
- package/dist/components/tt-table/src/hooks/useRowIdentity.js +68 -54
- package/dist/components/tt-table/src/hooks/useRowSelection.d.ts +5 -7
- package/dist/components/tt-table/src/hooks/useRowSelection.js +70 -68
- package/dist/components/tt-table/src/hooks/useSideSlot.js +4 -3
- package/dist/components/tt-table/src/hooks/useSyncProps.js +4 -3
- package/dist/components/tt-table/src/hooks/useTableData.js +6 -5
- package/dist/components/tt-table/src/hooks/useTableFooter.js +9 -8
- package/dist/components/tt-table/src/hooks/useTableForm.js +4 -3
- package/dist/components/tt-table/src/hooks/useTableRender.d.ts +37 -4
- package/dist/components/tt-table/src/props.d.ts +12 -6
- package/dist/components/tt-table/src/props.js +14 -7
- package/dist/components/tt-table/src/table-mutation-events.js +10 -9
- package/dist/components/tt-table/src/types/table.d.ts +16 -0
- package/dist/components/tt-table/src/utils/action-tab-index.js +15 -14
- package/dist/components/tt-table/src/utils/context.js +5 -4
- package/dist/components/tt-table/src/utils/table-api.js +4 -2
- package/dist/components/tt-table/src/utils/table-form-api.js +22 -20
- 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/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/packages/hooks/src/useDebounce.js +5 -4
- 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/plugins/default/renderCellContent.js +4 -3
- package/dist/plugins/vxeTable/switchStatus.js +14 -13
- package/package.json +3 -3
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import "axios";
|
|
2
2
|
import "element-plus";
|
|
3
|
-
import { isObject as
|
|
4
|
-
import { getCurrentInstance as
|
|
5
|
-
import "xe-utils";
|
|
3
|
+
import { isObject as _, isFunction as E, isArray as C, isNumber as W, isString as $ } from "../../../../packages/utils/src/is.js";
|
|
4
|
+
import { getCurrentInstance as q, unref as s, toRaw as P } from "vue";
|
|
6
5
|
import "dayjs";
|
|
6
|
+
import "numeral";
|
|
7
|
+
import "xe-utils";
|
|
7
8
|
import "dayjs/plugin/utc";
|
|
8
9
|
import "dayjs/plugin/timezone";
|
|
9
10
|
import "../../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
|
|
@@ -11,86 +12,99 @@ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/ae
|
|
|
11
12
|
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js";
|
|
12
13
|
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
|
|
13
14
|
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
|
|
14
|
-
import { get as
|
|
15
|
-
const
|
|
16
|
-
function c(
|
|
17
|
-
return
|
|
15
|
+
import { get as S } from "lodash-es";
|
|
16
|
+
const l = "__tt_table_internal_row_key__";
|
|
17
|
+
function c(r) {
|
|
18
|
+
return W(r) ? !0 : $(r) && !!r;
|
|
19
|
+
}
|
|
20
|
+
function A(r) {
|
|
21
|
+
return r.includes(".") || r.includes("[");
|
|
18
22
|
}
|
|
19
|
-
function
|
|
23
|
+
function O(r, d) {
|
|
24
|
+
return A(d) ? S(r, d) : r[d];
|
|
25
|
+
}
|
|
26
|
+
function ne(r) {
|
|
20
27
|
var v;
|
|
21
|
-
const
|
|
22
|
-
let
|
|
28
|
+
const d = ((v = q()) == null ? void 0 : v.uid) || 0;
|
|
29
|
+
let w = 0;
|
|
23
30
|
const K = /* @__PURE__ */ new WeakSet();
|
|
24
|
-
function
|
|
25
|
-
return
|
|
31
|
+
function f() {
|
|
32
|
+
return s(r).tableRowId || "id";
|
|
26
33
|
}
|
|
27
|
-
function p(e) {
|
|
28
|
-
const
|
|
29
|
-
return c(
|
|
34
|
+
function p(e, t = f()) {
|
|
35
|
+
const n = O(e, t);
|
|
36
|
+
return c(n) ? n : void 0;
|
|
30
37
|
}
|
|
31
38
|
function g(e) {
|
|
32
|
-
const t = Reflect.get(e,
|
|
39
|
+
const t = Reflect.get(e, l);
|
|
33
40
|
return c(t) ? t : void 0;
|
|
34
41
|
}
|
|
35
|
-
function
|
|
36
|
-
return
|
|
42
|
+
function j() {
|
|
43
|
+
return w += 1, `tt_row_${d}_${w}`;
|
|
37
44
|
}
|
|
38
|
-
function
|
|
39
|
-
const
|
|
40
|
-
if (
|
|
45
|
+
function I(e, t) {
|
|
46
|
+
const n = P(e), i = Object.getOwnPropertyDescriptor(n, l), o = i && c(i.value) ? i.value : t;
|
|
47
|
+
if (i && !i.enumerable && c(i.value)) return o;
|
|
41
48
|
try {
|
|
42
|
-
Object.defineProperty(
|
|
49
|
+
Object.defineProperty(n, l, {
|
|
43
50
|
configurable: !0,
|
|
44
51
|
enumerable: !1,
|
|
45
|
-
value:
|
|
52
|
+
value: o,
|
|
46
53
|
writable: !0
|
|
47
54
|
});
|
|
48
55
|
} catch {
|
|
49
|
-
K.has(
|
|
56
|
+
K.has(n) || K.add(n);
|
|
50
57
|
}
|
|
51
|
-
return
|
|
58
|
+
return o;
|
|
52
59
|
}
|
|
53
|
-
function
|
|
54
|
-
var
|
|
60
|
+
function m({ row: e }) {
|
|
61
|
+
var y;
|
|
55
62
|
const t = g(e);
|
|
56
63
|
if (c(t)) return t;
|
|
57
|
-
const
|
|
58
|
-
return
|
|
64
|
+
const n = (y = s(r).rowConfig) == null ? void 0 : y.createKeyMethod, i = E(n) ? n({ row: e, keyField: f() }) : void 0, o = p(e), u = c(i) ? i : c(o) ? o : j();
|
|
65
|
+
return I(e, u);
|
|
59
66
|
}
|
|
60
|
-
function
|
|
67
|
+
function M(e = {}) {
|
|
61
68
|
return e.keyField ? e : {
|
|
62
69
|
...e,
|
|
63
|
-
keyField:
|
|
64
|
-
createKeyMethod:
|
|
70
|
+
keyField: l,
|
|
71
|
+
createKeyMethod: m
|
|
65
72
|
};
|
|
66
73
|
}
|
|
67
|
-
function
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
if (
|
|
71
|
-
|
|
72
|
-
if (r) {
|
|
73
|
-
const u = l(e, r);
|
|
74
|
+
function R(e, t, n) {
|
|
75
|
+
const i = p(e, t);
|
|
76
|
+
if (c(i)) return i;
|
|
77
|
+
if (n) {
|
|
78
|
+
const u = O(e, n);
|
|
74
79
|
return c(u) ? u : void 0;
|
|
75
80
|
}
|
|
76
|
-
const
|
|
77
|
-
return c(
|
|
81
|
+
const o = g(e);
|
|
82
|
+
return c(o) ? o : m({ row: e });
|
|
83
|
+
}
|
|
84
|
+
function x(e) {
|
|
85
|
+
var t;
|
|
86
|
+
return R(e, f(), (t = s(r).rowConfig) == null ? void 0 : t.keyField);
|
|
87
|
+
}
|
|
88
|
+
function B(e) {
|
|
89
|
+
var i;
|
|
90
|
+
const t = f(), n = (i = s(r).rowConfig) == null ? void 0 : i.keyField;
|
|
91
|
+
return e.map((o) => R(o, t, n));
|
|
78
92
|
}
|
|
79
|
-
function
|
|
80
|
-
var u,
|
|
81
|
-
if ((u =
|
|
82
|
-
const t =
|
|
83
|
-
function
|
|
84
|
-
const
|
|
85
|
-
if (
|
|
86
|
-
|
|
87
|
-
const
|
|
88
|
-
|
|
93
|
+
function D(e) {
|
|
94
|
+
var u, y, F;
|
|
95
|
+
if ((u = s(r).rowConfig) != null && u.keyField) return;
|
|
96
|
+
const t = C(e) ? e : [e], n = /* @__PURE__ */ new WeakSet(), i = ((y = s(r).treeConfig) == null ? void 0 : y.childrenField) || ((F = s(r).treeConfig) == null ? void 0 : F.children) || "children";
|
|
97
|
+
function o(a) {
|
|
98
|
+
const k = P(a);
|
|
99
|
+
if (n.has(k)) return;
|
|
100
|
+
n.add(k), m({ row: a });
|
|
101
|
+
const b = S(a, i);
|
|
102
|
+
C(b) && b.forEach((h) => _(h) && o(h));
|
|
89
103
|
}
|
|
90
|
-
t.forEach((
|
|
104
|
+
t.forEach((a) => _(a) && o(a));
|
|
91
105
|
}
|
|
92
|
-
return { getRowKey:
|
|
106
|
+
return { getRowKey: x, getRowKeys: B, prepareRows: D, toVxeRowConfig: M };
|
|
93
107
|
}
|
|
94
108
|
export {
|
|
95
|
-
|
|
109
|
+
ne as useRowIdentity
|
|
96
110
|
};
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import { ComputedRef, Ref } from 'vue';
|
|
2
2
|
import { VxeGridDefines, VxeGridEvents, VxeGridInstance, VxeTableExtendCellAreaDefines } from 'vxe-table';
|
|
3
3
|
import { Recordable } from '../../../../../../utils/src';
|
|
4
|
-
import { TtSelectRowKeysType, TtSelectRowsType, TtTableProps } from '../types/table';
|
|
4
|
+
import { TtSelectRowKeysType, TtSelectRowsType, TtTableProps, TtTableSelectionPayload } from '../types/table';
|
|
5
5
|
/** 行选择相关事件 */
|
|
6
6
|
type SelectionEmit = {
|
|
7
|
-
(e: "selection-change", data?:
|
|
8
|
-
keys: TtSelectRowKeysType;
|
|
9
|
-
rows: TtSelectRowsType;
|
|
10
|
-
data?: Recordable;
|
|
11
|
-
}): void;
|
|
7
|
+
(e: "selection-change", data?: TtTableSelectionPayload): void;
|
|
12
8
|
(e: "checkbox-change", data?: VxeGridDefines.CheckboxChangeEventParams): void;
|
|
13
9
|
(e: "checkbox-all", data?: VxeGridDefines.CheckboxAllEventParams): void;
|
|
14
10
|
(e: "checkbox-range-change", data?: VxeGridDefines.CheckboxRangeChangeEventParams): void;
|
|
@@ -19,6 +15,8 @@ type SelectionEmit = {
|
|
|
19
15
|
type RowSelectionIdentity = {
|
|
20
16
|
/** 获取业务兼容的行主键。 */
|
|
21
17
|
getRowKey: (row: Recordable) => number | string | undefined;
|
|
18
|
+
/** 批量获取行主键,配置只解析一次。 */
|
|
19
|
+
getRowKeys: (rows: Recordable[]) => Array<number | string | undefined>;
|
|
22
20
|
};
|
|
23
21
|
/**
|
|
24
22
|
* 行选择状态(复选框、单选框、区域选择)
|
|
@@ -29,7 +27,7 @@ type RowSelectionIdentity = {
|
|
|
29
27
|
*/
|
|
30
28
|
export declare function useRowSelection(propsRef: ComputedRef<TtTableProps>, grid: Ref<undefined | VxeGridInstance<Recordable>>, emit: SelectionEmit, identity: RowSelectionIdentity): {
|
|
31
29
|
selectedKeys: Ref<any, any>;
|
|
32
|
-
selectedRows:
|
|
30
|
+
selectedRows: import('vue').ShallowRef<any, any>;
|
|
33
31
|
selectedKeyList: ComputedRef<(string | number)[]>;
|
|
34
32
|
getSelectRowKeys: () => any;
|
|
35
33
|
getSelectRows: () => TtSelectRowsType;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { GlobalConfig as
|
|
1
|
+
import { GlobalConfig as _ } from "../../../../hooks/useSetup.js";
|
|
2
2
|
import "axios";
|
|
3
3
|
import "element-plus";
|
|
4
|
-
import { isArray as
|
|
5
|
-
import { ref as
|
|
6
|
-
import "xe-utils";
|
|
4
|
+
import { isArray as S } from "../../../../packages/utils/src/is.js";
|
|
5
|
+
import { ref as $, shallowRef as j, computed as q, unref as t, toValue as z, nextTick as H } from "vue";
|
|
7
6
|
import "dayjs";
|
|
7
|
+
import "numeral";
|
|
8
|
+
import "xe-utils";
|
|
8
9
|
import "dayjs/plugin/utc";
|
|
9
10
|
import "dayjs/plugin/timezone";
|
|
10
11
|
import "../../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
|
|
@@ -13,96 +14,97 @@ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/en
|
|
|
13
14
|
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
|
|
14
15
|
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
|
|
15
16
|
import "lodash-es";
|
|
16
|
-
function
|
|
17
|
-
const { getRowKey:
|
|
18
|
-
const { showCheckbox: e, showRadio: o } = t(
|
|
19
|
-
return e ?
|
|
17
|
+
function re(f, s, i, A) {
|
|
18
|
+
const { getRowKey: K, getRowKeys: b } = A, l = $([]), k = j([]), B = q(() => {
|
|
19
|
+
const { showCheckbox: e, showRadio: o } = t(f), n = z(l);
|
|
20
|
+
return e ? n || [] : o ? n ? [n] : [] : [];
|
|
20
21
|
});
|
|
21
22
|
function x() {
|
|
22
|
-
return t(
|
|
23
|
+
return t(l);
|
|
23
24
|
}
|
|
24
|
-
function
|
|
25
|
-
var
|
|
26
|
-
const { showCheckbox: e, showRadio: o, reserveSelection:
|
|
25
|
+
function y() {
|
|
26
|
+
var c, r, a;
|
|
27
|
+
const { showCheckbox: e, showRadio: o, reserveSelection: n } = t(f);
|
|
27
28
|
if (e) {
|
|
28
|
-
const
|
|
29
|
-
if (!
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
const u = ((c = t(s)) == null ? void 0 : c.getCheckboxRecords(!0)) || [];
|
|
30
|
+
if (!n) return u;
|
|
31
|
+
const C = ((r = t(s)) == null ? void 0 : r.getCheckboxReserveRecords(!0)) || [];
|
|
32
|
+
if (!C.length) return u;
|
|
33
|
+
const w = /* @__PURE__ */ new Map(), m = b(u), g = b(C);
|
|
34
|
+
return u.forEach((R, v) => w.set(m[v], R)), C.forEach((R, v) => {
|
|
35
|
+
w.has(g[v]) || w.set(g[v], R);
|
|
36
|
+
}), [...w.values()];
|
|
35
37
|
}
|
|
36
|
-
return o ? (
|
|
38
|
+
return o ? (a = t(s)) == null ? void 0 : a.getRadioRecord(!0) : [];
|
|
37
39
|
}
|
|
38
|
-
function
|
|
40
|
+
function E() {
|
|
39
41
|
var e;
|
|
40
42
|
return ((e = t(s)) == null ? void 0 : e.getTableData().fullData) || [];
|
|
41
43
|
}
|
|
42
|
-
function
|
|
43
|
-
const o =
|
|
44
|
-
k.value = o,
|
|
44
|
+
function h(e) {
|
|
45
|
+
const o = y();
|
|
46
|
+
k.value = o, l.value = S(o) ? b(o) : o ? K(o) : void 0, i("selection-change", { keys: x(), rows: o, data: e });
|
|
45
47
|
}
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
},
|
|
48
|
+
const T = (e) => {
|
|
49
|
+
h(e), i("checkbox-change", e);
|
|
50
|
+
}, D = (e) => {
|
|
51
|
+
h(e), i("checkbox-all", e);
|
|
52
|
+
}, d = (e) => {
|
|
51
53
|
var o;
|
|
52
|
-
i("checkbox-range-change", e), ((o = e.records) == null ? void 0 : o.length) !== 1 &&
|
|
54
|
+
i("checkbox-range-change", e), ((o = e.records) == null ? void 0 : o.length) !== 1 && h(e);
|
|
53
55
|
};
|
|
54
|
-
function
|
|
55
|
-
k.value = e.row,
|
|
56
|
+
function P(e) {
|
|
57
|
+
k.value = e.row, l.value = e.row ? K(e.row) : void 0, i("radio-change", e), i("selection-change", { keys: x(), rows: y(), data: e });
|
|
56
58
|
}
|
|
57
|
-
async function
|
|
58
|
-
const { rows: o, cols:
|
|
59
|
+
async function F(e) {
|
|
60
|
+
const { rows: o, cols: n } = e;
|
|
59
61
|
if (o.length === 1) return;
|
|
60
|
-
const
|
|
61
|
-
!
|
|
62
|
+
const c = t(s);
|
|
63
|
+
!c || !n.some((r) => r.type === "checkbox") || (await c.setCheckboxRow(o, !c.isCheckedByCheckboxRow(o[0])), h(e));
|
|
62
64
|
}
|
|
63
|
-
const
|
|
64
|
-
var
|
|
65
|
-
const { checkboxConfig: o, showCheckbox:
|
|
66
|
-
o != null && o.range &&
|
|
65
|
+
const G = (e) => {
|
|
66
|
+
var c;
|
|
67
|
+
const { checkboxConfig: o, showCheckbox: n } = t(f);
|
|
68
|
+
o != null && o.range && n ? d({ records: e.rows }) : (c = _.table) != null && c.isAreaCheckboxSelection && F(e), i("cell-area-selection-end", e);
|
|
67
69
|
};
|
|
68
|
-
async function
|
|
69
|
-
var
|
|
70
|
-
const { showCheckbox:
|
|
71
|
-
...
|
|
72
|
-
...
|
|
73
|
-
]), C =
|
|
74
|
-
|
|
70
|
+
async function L(e, o = []) {
|
|
71
|
+
var g, R;
|
|
72
|
+
const { showCheckbox: n, showRadio: c } = t(f), r = S(e) ? e : e ? [e] : [], a = /* @__PURE__ */ new Set([
|
|
73
|
+
...b(r),
|
|
74
|
+
...S(o) ? o : o == null ? [] : [o]
|
|
75
|
+
]), u = E(), C = b(u), w = u.filter((v, V) => a.has(C[V])), m = w.length ? w : r;
|
|
76
|
+
n && await ((g = t(s)) == null ? void 0 : g.setCheckboxRow(m, !0)), c && await ((R = t(s)) == null ? void 0 : R.setRadioRow(m[0])), await H(), h();
|
|
75
77
|
}
|
|
76
|
-
function
|
|
77
|
-
var
|
|
78
|
-
const { showCheckbox: e, showRadio: o, reserveSelection:
|
|
79
|
-
!e && !o || (e && (
|
|
78
|
+
function p() {
|
|
79
|
+
var c, r, a;
|
|
80
|
+
const { showCheckbox: e, showRadio: o, reserveSelection: n } = t(f);
|
|
81
|
+
!e && !o || (e && (l.value = [], k.value = [], (c = t(s)) == null || c.clearCheckboxRow(), n && ((r = t(s)) == null || r.clearCheckboxReserve())), o && (l.value = void 0, k.value = void 0, (a = t(s)) == null || a.clearRadioRow()), i("selection-change", { keys: x(), rows: y() }));
|
|
80
82
|
}
|
|
81
|
-
function
|
|
82
|
-
const { showCheckbox: e, reserveSelection: o } = t(
|
|
83
|
+
function M() {
|
|
84
|
+
const { showCheckbox: e, reserveSelection: o } = t(f);
|
|
83
85
|
if (!e || !o) {
|
|
84
|
-
|
|
86
|
+
p();
|
|
85
87
|
return;
|
|
86
88
|
}
|
|
87
|
-
|
|
89
|
+
h();
|
|
88
90
|
}
|
|
89
91
|
return {
|
|
90
|
-
selectedKeys:
|
|
92
|
+
selectedKeys: l,
|
|
91
93
|
selectedRows: k,
|
|
92
|
-
selectedKeyList:
|
|
94
|
+
selectedKeyList: B,
|
|
93
95
|
getSelectRowKeys: x,
|
|
94
|
-
getSelectRows:
|
|
95
|
-
syncSelection:
|
|
96
|
-
setSelectedRowKeys:
|
|
97
|
-
clearSelectedRowKeys:
|
|
98
|
-
resetSelectionAfterFetch:
|
|
99
|
-
onCheckboxChange:
|
|
100
|
-
onCheckboxAll:
|
|
101
|
-
onCheckboxRangeChange:
|
|
102
|
-
onRadioChange:
|
|
103
|
-
onCellAreaSelectionEnd:
|
|
96
|
+
getSelectRows: y,
|
|
97
|
+
syncSelection: h,
|
|
98
|
+
setSelectedRowKeys: L,
|
|
99
|
+
clearSelectedRowKeys: p,
|
|
100
|
+
resetSelectionAfterFetch: M,
|
|
101
|
+
onCheckboxChange: T,
|
|
102
|
+
onCheckboxAll: D,
|
|
103
|
+
onCheckboxRangeChange: d,
|
|
104
|
+
onRadioChange: P,
|
|
105
|
+
onCellAreaSelectionEnd: G
|
|
104
106
|
};
|
|
105
107
|
}
|
|
106
108
|
export {
|
|
107
|
-
|
|
109
|
+
re as useRowSelection
|
|
108
110
|
};
|
|
@@ -2,8 +2,9 @@ import "axios";
|
|
|
2
2
|
import "element-plus";
|
|
3
3
|
import { isUndefined as A, isServer as T } from "../../../../packages/utils/src/is.js";
|
|
4
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 "xe-utils";
|
|
6
5
|
import "dayjs";
|
|
6
|
+
import "numeral";
|
|
7
|
+
import "xe-utils";
|
|
7
8
|
import "dayjs/plugin/utc";
|
|
8
9
|
import "dayjs/plugin/timezone";
|
|
9
10
|
import "../../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
|
|
@@ -12,7 +13,7 @@ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/en
|
|
|
12
13
|
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
|
|
13
14
|
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
|
|
14
15
|
import "lodash-es";
|
|
15
|
-
function
|
|
16
|
+
function V(c, s, N) {
|
|
16
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();
|
|
17
18
|
function q() {
|
|
18
19
|
return new Promise((r) => {
|
|
@@ -73,5 +74,5 @@ function Q(c, s, N) {
|
|
|
73
74
|
};
|
|
74
75
|
}
|
|
75
76
|
export {
|
|
76
|
-
|
|
77
|
+
V as useSideSlot
|
|
77
78
|
};
|
|
@@ -3,8 +3,9 @@ import "axios";
|
|
|
3
3
|
import "element-plus";
|
|
4
4
|
import { isObject as h, isArray as b } from "../../../../packages/utils/src/is.js";
|
|
5
5
|
import { getCurrentInstance as P, watch as p, toValue as g } from "vue";
|
|
6
|
-
import "xe-utils";
|
|
7
6
|
import "dayjs";
|
|
7
|
+
import "numeral";
|
|
8
|
+
import "xe-utils";
|
|
8
9
|
import "dayjs/plugin/utc";
|
|
9
10
|
import "dayjs/plugin/timezone";
|
|
10
11
|
import "../../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
|
|
@@ -14,7 +15,7 @@ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mo
|
|
|
14
15
|
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
|
|
15
16
|
import "lodash-es";
|
|
16
17
|
const f = ["data"], j = ["columns"];
|
|
17
|
-
function
|
|
18
|
+
function D(t, m, l = []) {
|
|
18
19
|
var c;
|
|
19
20
|
const i = P();
|
|
20
21
|
function u(o) {
|
|
@@ -51,5 +52,5 @@ function B(t, m, l = []) {
|
|
|
51
52
|
});
|
|
52
53
|
}
|
|
53
54
|
export {
|
|
54
|
-
|
|
55
|
+
D as useSyncProps
|
|
55
56
|
};
|
|
@@ -2,8 +2,9 @@ import "axios";
|
|
|
2
2
|
import "element-plus";
|
|
3
3
|
import { isString as L, isFunction as N, isObject as Re } from "../../../../packages/utils/src/is.js";
|
|
4
4
|
import { getCurrentInstance as he, shallowRef as J, watch as Q, unref as d, onBeforeUpdate as ve, getCurrentScope as Ce, onScopeDispose as Me, toValue as S, nextTick as P, isRef as be } from "vue";
|
|
5
|
-
import "xe-utils";
|
|
6
5
|
import "dayjs";
|
|
6
|
+
import "numeral";
|
|
7
|
+
import "xe-utils";
|
|
7
8
|
import "dayjs/plugin/utc";
|
|
8
9
|
import "dayjs/plugin/timezone";
|
|
9
10
|
import "../../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
|
|
@@ -59,11 +60,11 @@ function X(l) {
|
|
|
59
60
|
function x(l) {
|
|
60
61
|
return !l || l();
|
|
61
62
|
}
|
|
62
|
-
async function
|
|
63
|
+
async function ke(l, f, C, g = () => !0) {
|
|
63
64
|
const i = (l == null ? void 0 : l.getTreeExpandRecords()) || [], R = await C();
|
|
64
65
|
return f && i.length && g() && await (l == null ? void 0 : l.setTreeExpand(i, !0)), R;
|
|
65
66
|
}
|
|
66
|
-
function
|
|
67
|
+
function je(l, f, C, g, i) {
|
|
67
68
|
const R = he(), b = J([]), D = J();
|
|
68
69
|
let A = !1, s = !1, M = 0, h;
|
|
69
70
|
const q = Symbol("tt-table-emitted-rows-event");
|
|
@@ -302,6 +303,6 @@ function ke(l, f, C, g, i) {
|
|
|
302
303
|
}
|
|
303
304
|
export {
|
|
304
305
|
X as getExternalRowsValue,
|
|
305
|
-
|
|
306
|
-
|
|
306
|
+
je as useTableData,
|
|
307
|
+
ke as withTreeExpand
|
|
307
308
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import "axios";
|
|
2
2
|
import "element-plus";
|
|
3
3
|
import { isFunction as s, isNumber as d } from "../../../../packages/utils/src/is.js";
|
|
4
|
-
import { computed as
|
|
5
|
-
import "xe-utils";
|
|
4
|
+
import { computed as u, unref as a } from "vue";
|
|
6
5
|
import "dayjs";
|
|
6
|
+
import "numeral";
|
|
7
|
+
import "xe-utils";
|
|
7
8
|
import "dayjs/plugin/utc";
|
|
8
9
|
import "dayjs/plugin/timezone";
|
|
9
10
|
import "../../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
|
|
@@ -20,8 +21,8 @@ function h(i, m, f) {
|
|
|
20
21
|
const e = r.filter(d), o = e.reduce((t, n) => t + n, 0);
|
|
21
22
|
return i === "avg" ? e.length ? o / e.length : 0 : o;
|
|
22
23
|
}
|
|
23
|
-
function
|
|
24
|
-
const m =
|
|
24
|
+
function z(i) {
|
|
25
|
+
const m = u(() => {
|
|
25
26
|
const r = /* @__PURE__ */ new Map(), e = (o) => {
|
|
26
27
|
o.forEach((t) => {
|
|
27
28
|
var n;
|
|
@@ -30,17 +31,17 @@ function x(i) {
|
|
|
30
31
|
};
|
|
31
32
|
return e(a(i)), r;
|
|
32
33
|
});
|
|
33
|
-
return { footerSummaryMethod:
|
|
34
|
+
return { footerSummaryMethod: u(() => {
|
|
34
35
|
const r = a(m);
|
|
35
36
|
if (r.size)
|
|
36
37
|
return ({ columns: e, data: o }) => [
|
|
37
38
|
e.map((t, n) => {
|
|
38
|
-
const
|
|
39
|
-
return
|
|
39
|
+
const p = t.field ? r.get(t.field) : void 0;
|
|
40
|
+
return p ? h(p, t, o) : n === 0 ? c : "";
|
|
40
41
|
})
|
|
41
42
|
];
|
|
42
43
|
}) };
|
|
43
44
|
}
|
|
44
45
|
export {
|
|
45
|
-
|
|
46
|
+
z as useTableFooter
|
|
46
47
|
};
|
|
@@ -2,8 +2,9 @@ import "axios";
|
|
|
2
2
|
import "element-plus";
|
|
3
3
|
import { isFunction as m } from "../../../../packages/utils/src/is.js";
|
|
4
4
|
import { computed as c, unref as i, toValue as u } from "vue";
|
|
5
|
-
import "xe-utils";
|
|
6
5
|
import "dayjs";
|
|
6
|
+
import "numeral";
|
|
7
|
+
import "xe-utils";
|
|
7
8
|
import "dayjs/plugin/utc";
|
|
8
9
|
import "dayjs/plugin/timezone";
|
|
9
10
|
import "../../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
|
|
@@ -12,7 +13,7 @@ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/en
|
|
|
12
13
|
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
|
|
13
14
|
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
|
|
14
15
|
import { omit as p } from "lodash-es";
|
|
15
|
-
function
|
|
16
|
+
function j(n, h, l, d) {
|
|
16
17
|
const f = c(() => {
|
|
17
18
|
const { form: t } = i(n), o = {
|
|
18
19
|
...t == null ? void 0 : t.submitButtonOptions,
|
|
@@ -63,5 +64,5 @@ function V(n, h, l, d) {
|
|
|
63
64
|
};
|
|
64
65
|
}
|
|
65
66
|
export {
|
|
66
|
-
|
|
67
|
+
j as useTableForm
|
|
67
68
|
};
|
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
import { DefineSetupFnComponent, SlotsType } from 'vue';
|
|
2
2
|
import { TtTableExtendedTableApi, TtTableProps, TtTableRenderProps, TtTableSlots } from '../types/table';
|
|
3
3
|
import { TtTableExtendedTableFormApi, TtTableFormProps } from '../types/tableForm';
|
|
4
|
+
/**
|
|
5
|
+
* 表格渲染组件的事件声明。
|
|
6
|
+
*
|
|
7
|
+
* 不能写成 `Record<string, any>`:Vue 的 `EmitsToProps` 走对象分支时会算
|
|
8
|
+
* `T[K] extends (...args: infer P) => any ? P : ...`,而 `T[K]` 为 `any` 时 `P` 被推断成
|
|
9
|
+
* `unknown[]`,生成的 `on${Capitalize<string>}` 索引签名参数变成 `unknown[]`。
|
|
10
|
+
* 该类型处于参数逆变位置,会让业务侧任何具名参数的回调(`@selection-change="({ rows }) => ..."`)
|
|
11
|
+
* 都无法赋值。值声明为宽松函数签名后,`P` 推断为 `any[]`,与任意回调双向兼容。
|
|
12
|
+
*/
|
|
13
|
+
type TtTableRenderEmits = Record<string, (...args: any[]) => any>;
|
|
4
14
|
/**
|
|
5
15
|
* useTableFormRender 的返回值
|
|
6
16
|
*
|
|
7
17
|
* `Row` 是业务行数据类型,传入后表格插槽作用域与 `tableFormApi.tableApi` 的方法签名跟着推断。
|
|
8
18
|
*/
|
|
9
19
|
export type TtUseTableFormRenderReturnType<Row = any> = [
|
|
10
|
-
DefineSetupFnComponent<TtTableFormProps<Row>,
|
|
20
|
+
DefineSetupFnComponent<TtTableFormProps<Row>, TtTableRenderEmits, SlotsType<TtTableSlots<Row>>>,
|
|
11
21
|
TtTableExtendedTableFormApi<Row>
|
|
12
22
|
];
|
|
13
23
|
/**
|
|
@@ -16,7 +26,7 @@ export type TtUseTableFormRenderReturnType<Row = any> = [
|
|
|
16
26
|
* `Row` 是业务行数据类型,传入后组件的 `modelValue`、插槽作用域与 `tableApi` 的方法签名跟着推断。
|
|
17
27
|
*/
|
|
18
28
|
export type TtUseTableRenderReturnType<Row = any> = [
|
|
19
|
-
DefineSetupFnComponent<TtTableRenderProps<Row>,
|
|
29
|
+
DefineSetupFnComponent<TtTableRenderProps<Row>, TtTableRenderEmits, SlotsType<TtTableSlots<Row>>>,
|
|
20
30
|
TtTableExtendedTableApi<Row>
|
|
21
31
|
];
|
|
22
32
|
/**
|
|
@@ -24,6 +34,13 @@ export type TtUseTableRenderReturnType<Row = any> = [
|
|
|
24
34
|
*
|
|
25
35
|
* 返回 [FormTable 组件, TableFormApi API]。
|
|
26
36
|
*
|
|
37
|
+
* `options` 的类型不含 `Row`,`Row` 只出现在返回类型上。这是为了打断业务常见写法里的循环推断:
|
|
38
|
+
* `const [FormTable, api] = useTableFormRender({ form: { schemas: [{ onChange: () => f(api) }] } })`
|
|
39
|
+
* 中 `api` 的类型来自返回值,而实参字面量里的回调又引用 `api`。只要参数类型带 `Row`,
|
|
40
|
+
* TS 就必须先检查实参才能定下返回类型,于是判定为循环并把 `api` 退化成隐式 any(TS7022/TS7023)。
|
|
41
|
+
* `NoInfer` 只能阻止推断、阻止不了这次实参检查,所以这里直接让参数与 `Row` 解耦。
|
|
42
|
+
* 需要行类型时显式写 `useTableFormRender<Row>({ ... })`,不写则为 `any`。
|
|
43
|
+
*
|
|
27
44
|
* @param options 表格渲染配置项
|
|
28
45
|
* @returns [FormTable组件, TableFormApi API]
|
|
29
46
|
*
|
|
@@ -36,15 +53,25 @@ export type TtUseTableRenderReturnType<Row = any> = [
|
|
|
36
53
|
* ...配置
|
|
37
54
|
* })
|
|
38
55
|
*
|
|
56
|
+
* // 需要行类型推断时显式传入
|
|
57
|
+
* const [FormTable, tableApi] = useTableFormRender<OrderRow>({
|
|
58
|
+
* ...配置
|
|
59
|
+
* })
|
|
60
|
+
*
|
|
39
61
|
* // 在模板中使用
|
|
40
62
|
* <FormTable />
|
|
41
63
|
*/
|
|
42
|
-
export declare function useTableFormRender<Row = any>(options: TtTableFormProps<
|
|
64
|
+
export declare function useTableFormRender<Row = any>(options: TtTableFormProps<any>): TtUseTableFormRenderReturnType<Row>;
|
|
43
65
|
/**
|
|
44
66
|
* 用于渲染表格的 hooks,返回 [TableRender 组件, 表格API]。
|
|
45
67
|
*
|
|
46
68
|
* options 只接受表格配置;单向数据使用 data,双向数据绑定到返回的 TableRender 组件。
|
|
47
69
|
*
|
|
70
|
+
* `options` 的类型不含 `Row`,与 `useTableFormRender` 保持一致:`Row` 参与参数类型时,
|
|
71
|
+
* 业务写 `useTableRender({ data: [], columns: [...] })` 会让 `Row` 从空数组推断成 `never`,
|
|
72
|
+
* 组件的 `data` prop 类型退化为 `MaybeRef<never[]>`,之后传入任何具体行类型都报 TS2322。
|
|
73
|
+
* 需要行类型时显式写 `useTableRender<Row>({ ... })`,不写则为 `any`。
|
|
74
|
+
*
|
|
48
75
|
* @param options 表格渲染配置项
|
|
49
76
|
* @returns [TableRender组件, 表格API]
|
|
50
77
|
*
|
|
@@ -56,7 +83,13 @@ export declare function useTableFormRender<Row = any>(options: TtTableFormProps<
|
|
|
56
83
|
* ...其它配置
|
|
57
84
|
* })
|
|
58
85
|
*
|
|
86
|
+
* // 需要行类型推断时显式传入
|
|
87
|
+
* const [TableRender, tableApi] = useTableRender<OrderRow>({
|
|
88
|
+
* columns: [...],
|
|
89
|
+
* })
|
|
90
|
+
*
|
|
59
91
|
* // 在模板中使用
|
|
60
92
|
* <TableRender />
|
|
61
93
|
*/
|
|
62
|
-
export declare function useTableRender<Row = any>(options: TtTableProps<
|
|
94
|
+
export declare function useTableRender<Row = any>(options: TtTableProps<any>): TtUseTableRenderReturnType<Row>;
|
|
95
|
+
export {};
|