@dazhicheng/ui 1.5.199 → 1.5.201
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/_virtual/_plugin-vue_export-helper.js +9 -0
- package/dist/api/dataTypeContext.js +17 -0
- package/dist/assets/img/empty_images/no_data.png.js +4 -0
- package/dist/assets/img/empty_images/search.png.js +4 -0
- package/dist/assets/img/image_status/develop.png.js +4 -0
- package/dist/assets/img/image_status/loading.gif.js +4 -0
- package/dist/assets/img/image_status/loading_fail.png.js +4 -0
- package/dist/assets/img/image_status/no_network.png.js +4 -0
- package/dist/assets/img/image_status/no_permission.png.js +4 -0
- package/dist/assets/svg/action_more.svg.js +4 -0
- package/dist/assets/svg/close.svg.js +4 -0
- package/dist/assets/svg/item_error.svg.js +4 -0
- package/dist/assets/svg/paixu-jiangxu.svg.js +4 -0
- package/dist/assets/svg/paixu-moren.svg.js +4 -0
- package/dist/assets/svg/paixu-shengxu.svg.js +4 -0
- package/dist/assets/svg/quanping.svg.js +4 -0
- package/dist/assets/svg/suoxiao.svg.js +4 -0
- package/dist/components/tt-api-component/index.js +7 -0
- package/dist/components/tt-api-component/index.vue.js +7 -0
- package/dist/components/tt-api-component/index.vue2.js +199 -0
- package/dist/components/tt-area/TtArea.vue.js +7 -0
- package/dist/components/tt-area/TtArea.vue2.js +36 -0
- package/dist/components/tt-button/components/AddButton.vue.js +24 -0
- package/dist/components/tt-button/components/AddButton.vue2.js +4 -0
- package/dist/components/tt-button/index.js +9 -0
- package/dist/components/tt-button/index.vue.js +7 -0
- package/dist/components/tt-button/index.vue2.js +68 -0
- package/dist/components/tt-checkbox/index.js +7 -0
- package/dist/components/tt-checkbox/index.vue.js +77 -0
- package/dist/components/tt-checkbox/index.vue2.js +4 -0
- package/dist/components/tt-drawer/index.js +14 -0
- package/dist/components/tt-drawer/src/RenderDrawer.vue.js +156 -0
- package/dist/components/tt-drawer/src/RenderDrawer.vue3.js +5 -0
- package/dist/components/tt-drawer/src/components/DrawerFooter.vue.js +56 -0
- package/dist/components/tt-drawer/src/components/DrawerFooter.vue3.js +5 -0
- package/dist/components/tt-drawer/src/components/DrawerHeader.vue.js +7 -0
- package/dist/components/tt-drawer/src/components/DrawerHeader.vue2.js +21 -0
- package/dist/components/tt-drawer/src/hooks/useDrawerRender.js +124 -0
- package/dist/components/tt-drawer/src/hooks/useResizable.js +98 -0
- package/dist/components/tt-drawer/src/index.js +17 -0
- package/dist/components/tt-drawer/src/props.js +72 -0
- package/dist/components/tt-drawer/src/utils/drawer-api.js +191 -0
- package/dist/components/tt-empty/index.js +34 -0
- package/dist/components/tt-form/index.js +65 -0
- package/dist/components/tt-form/src/components/ExpandableArrow.vue2.js +38 -0
- package/dist/components/tt-form/src/components/ExpandableArrow.vue3.js +5 -0
- package/dist/components/tt-form/src/components/FormActions.vue2.js +177 -0
- package/dist/components/tt-form/src/components/FormActions.vue3.js +5 -0
- package/dist/components/tt-form/src/components/FormElInput.vue.js +80 -0
- package/dist/components/tt-form/src/components/FormElInput.vue2.js +4 -0
- package/dist/components/tt-form/src/components/Slot.js +28 -0
- package/dist/components/tt-form/src/config.js +57 -0
- package/dist/components/tt-form/src/form/FormControl.vue.js +16 -0
- package/dist/components/tt-form/src/form/FormControl.vue2.js +4 -0
- package/dist/components/tt-form/src/form/FormDescription.vue.js +21 -0
- package/dist/components/tt-form/src/form/FormDescription.vue2.js +4 -0
- package/dist/components/tt-form/src/form/FormItem.vue.js +20 -0
- package/dist/components/tt-form/src/form/FormItem.vue2.js +4 -0
- package/dist/components/tt-form/src/form/FormLabel.vue.js +19 -0
- package/dist/components/tt-form/src/form/FormLabel.vue2.js +4 -0
- package/dist/components/tt-form/src/form/FormMessage.vue.js +18 -0
- package/dist/components/tt-form/src/form/FormMessage.vue2.js +4 -0
- package/dist/components/tt-form/src/form/FormMessageToolTip.vue.js +30 -0
- package/dist/components/tt-form/src/form/FormMessageToolTip.vue2.js +4 -0
- package/dist/components/tt-form/src/form/RenderContent.vue.js +31 -0
- package/dist/components/tt-form/src/form/RenderContent.vue2.js +4 -0
- package/dist/components/tt-form/src/form/injectionKeys.js +4 -0
- package/dist/components/tt-form/src/form/useFormField.js +24 -0
- package/dist/components/tt-form/src/form-render/FormField.vue.js +4 -0
- package/dist/components/tt-form/src/form-render/FormField.vue2.js +346 -0
- package/dist/components/tt-form/src/form-render/FormFieldContact.js +54 -0
- package/dist/components/tt-form/src/form-render/FormLabel.vue.js +4 -0
- package/dist/components/tt-form/src/form-render/FormLabel.vue2.js +102 -0
- package/dist/components/tt-form/src/form-render/array-register/FormArrayRegister.js +195 -0
- package/dist/components/tt-form/src/form-render/array-register/props.js +47 -0
- package/dist/components/tt-form/src/form-render/array-register/utils.js +12 -0
- package/dist/components/tt-form/src/form-render/context.js +15 -0
- package/dist/components/tt-form/src/form-render/dependencies.js +51 -0
- package/dist/components/tt-form/src/form-render/expandable.js +46 -0
- package/dist/components/tt-form/src/form-render/form.vue2.js +197 -0
- package/dist/components/tt-form/src/form-render/form.vue3.js +5 -0
- package/dist/components/tt-form/src/form-render/helper.js +22 -0
- package/dist/components/tt-form/src/form-render/rootWrapperClass.js +10 -0
- package/dist/components/tt-form/src/formApi.js +790 -0
- package/dist/components/tt-form/src/group-form/GroupForm.vue2.js +223 -0
- package/dist/components/tt-form/src/group-form/GroupForm.vue3.js +5 -0
- package/dist/components/tt-form/src/group-form/GroupSection.vue2.js +278 -0
- package/dist/components/tt-form/src/group-form/GroupSection.vue3.js +5 -0
- package/dist/components/tt-form/src/group-form/LazyFormField.vue.js +153 -0
- package/dist/components/tt-form/src/group-form/LazyFormField.vue3.js +5 -0
- package/dist/components/tt-form/src/group-form/groupFormApi.js +700 -0
- package/dist/components/tt-form/src/group-form/lazyContext.js +38 -0
- package/dist/components/tt-form/src/group-form/useGroupForm.js +83 -0
- package/dist/components/tt-form/src/group-form/utils.js +106 -0
- package/dist/components/tt-form/src/hooks/useArrayRegistry.js +22 -0
- package/dist/components/tt-form/src/hooks/useFieldArray.js +137 -0
- package/dist/components/tt-form/src/hooks/useForwardPriorityValues.js +33 -0
- package/dist/components/tt-form/src/hooks/useSelectCollapse.js +81 -0
- package/dist/components/tt-form/src/index.vue2.js +149 -0
- package/dist/components/tt-form/src/index.vue3.js +5 -0
- package/dist/components/tt-form/src/shared/createContext.js +14 -0
- package/dist/components/tt-form/src/shared/global-state.js +22 -0
- package/dist/components/tt-form/src/shared/zod-defaults.js +47 -0
- package/dist/components/tt-form/src/types/forms.js +6 -0
- package/dist/components/tt-form/src/useForm.js +28 -0
- package/dist/components/tt-form/src/useFormContext.js +320 -0
- package/dist/components/tt-form/src/utils/array-path.js +18 -0
- package/dist/components/tt-form-item-error-tooltip/index.js +9 -0
- package/dist/components/tt-form-item-error-tooltip/index.vue.js +183 -0
- package/dist/components/tt-form-item-error-tooltip/index.vue3.js +5 -0
- package/dist/components/tt-icon/components/AddIcon.vue.js +28 -0
- package/dist/components/tt-icon/components/AddIcon.vue2.js +4 -0
- package/dist/components/tt-icon/components/SubIcon.vue.js +28 -0
- package/dist/components/tt-icon/components/SubIcon.vue2.js +4 -0
- package/dist/components/tt-icon/index.js +11 -0
- package/dist/components/tt-icon/index.vue.js +8 -0
- package/dist/components/tt-icon/index.vue2.js +115 -0
- package/dist/components/tt-image/index.js +9 -0
- package/dist/components/tt-image/src/components/ImageViewer.js +41 -0
- package/dist/components/tt-image/tt-image.js +55 -0
- package/dist/components/tt-loading/index.js +8 -0
- package/dist/components/tt-loading/src/directive.js +51 -0
- package/dist/components/tt-loading/src/loading.vue.js +7 -0
- package/dist/components/tt-loading/src/loading.vue2.js +75 -0
- package/dist/components/tt-loading/src/service.js +79 -0
- package/dist/components/tt-log/index.js +7 -0
- package/dist/components/tt-log/index.vue.js +30 -0
- package/dist/components/tt-log/index.vue2.js +4 -0
- package/dist/components/tt-modal/index.js +14 -0
- package/dist/components/tt-modal/src/RenderModal.vue.js +310 -0
- package/dist/components/tt-modal/src/RenderModal.vue3.js +5 -0
- package/dist/components/tt-modal/src/components/ModalFooter.vue.js +7 -0
- package/dist/components/tt-modal/src/components/ModalFooter.vue2.js +74 -0
- package/dist/components/tt-modal/src/components/ModalHeader.vue.js +7 -0
- package/dist/components/tt-modal/src/components/ModalHeader.vue2.js +22 -0
- package/dist/components/tt-modal/src/components/ModalWrapper.vue.js +48 -0
- package/dist/components/tt-modal/src/components/ModalWrapper.vue2.js +4 -0
- package/dist/components/tt-modal/src/hooks/useModalRender.js +131 -0
- package/dist/components/tt-modal/src/index.js +17 -0
- package/dist/components/tt-modal/src/props.js +75 -0
- package/dist/components/tt-modal/src/utils/modal-api.js +200 -0
- package/dist/components/tt-modal/src/utils/modal-stack.js +28 -0
- package/dist/components/tt-modal-form/hooks/useModalFormSlot.js +22 -0
- package/dist/components/tt-modal-form/index.vue.js +178 -0
- package/dist/components/tt-modal-form/index.vue2.js +4 -0
- package/dist/components/tt-modal-form/useModalForm.js +30 -0
- package/dist/components/tt-nav-anchor/index.js +8 -0
- package/dist/components/tt-nav-anchor/src/TtNavAnchor.vue.js +234 -0
- package/dist/components/tt-nav-anchor/src/TtNavAnchor.vue3.js +5 -0
- package/dist/components/tt-nav-anchor/src/constants.js +4 -0
- package/dist/components/tt-panel-select/index.js +7 -0
- package/dist/components/tt-panel-select/src/common.js +4 -0
- package/dist/components/tt-panel-select/src/components/PanelLeft.vue.js +56 -0
- package/dist/components/tt-panel-select/src/components/PanelLeft.vue2.js +4 -0
- package/dist/components/tt-panel-select/src/components/PanelMiddle.vue.js +277 -0
- package/dist/components/tt-panel-select/src/components/PanelMiddle.vue2.js +4 -0
- package/dist/components/tt-panel-select/src/components/PanelRight.vue.js +108 -0
- package/dist/components/tt-panel-select/src/components/PanelRight.vue2.js +4 -0
- package/dist/components/tt-panel-select/src/hooks/usePanelData.js +184 -0
- package/dist/components/tt-panel-select/src/hooks/usePanelSelection.js +91 -0
- package/dist/components/tt-panel-select/src/index.vue.js +386 -0
- package/dist/components/tt-panel-select/src/index.vue2.js +4 -0
- package/dist/components/tt-select/index.js +8 -0
- package/dist/components/tt-select/src/Select.vue.js +315 -0
- package/dist/components/tt-select/src/Select.vue3.js +5 -0
- package/dist/components/tt-select/src/components/SelectTable.vue.js +86 -0
- package/dist/components/tt-select/src/components/SelectTable.vue3.js +5 -0
- package/dist/components/tt-select/src/components/Table.vue.js +307 -0
- package/dist/components/tt-select/src/components/Table.vue3.js +5 -0
- package/dist/components/tt-select/src/const.js +19 -0
- package/dist/components/tt-select/src/hooks/useDataSource.js +196 -0
- package/dist/components/tt-select/src/hooks/useGrid.js +97 -0
- package/dist/components/tt-select/src/hooks/useKeyboard.js +63 -0
- package/dist/components/tt-select/src/hooks/usePagination.js +45 -0
- package/dist/components/tt-select/src/hooks/useSelect.js +100 -0
- package/dist/components/tt-select/src/hooks/useSelectTableEvent.d.ts +1 -1
- package/dist/components/tt-select/src/hooks/useSelectTableEvent.js +345 -0
- package/dist/components/tt-select/src/props.js +201 -0
- package/dist/components/tt-select/src/utils/index.js +16 -0
- package/dist/components/tt-table/index.js +33 -0
- package/dist/components/tt-table/src/Table.vue.js +623 -0
- package/dist/components/tt-table/src/Table.vue3.js +5 -0
- package/dist/components/tt-table/src/TableForm.vue.js +317 -0
- package/dist/components/tt-table/src/TableForm.vue2.js +4 -0
- package/dist/components/tt-table/src/componentMap.js +4 -0
- package/dist/components/tt-table/src/components/RowContext.js +24 -0
- package/dist/components/tt-table/src/components/TableAction.vue.js +222 -0
- package/dist/components/tt-table/src/components/TableAction.vue2.js +4 -0
- package/dist/components/tt-table/src/components/TableButtons.js +117 -0
- package/dist/components/tt-table/src/components/TableColumnModal.vue2.js +233 -0
- package/dist/components/tt-table/src/components/TableColumnModal.vue3.js +5 -0
- package/dist/components/tt-table/src/components/TableToobalTools.vue.js +87 -0
- package/dist/components/tt-table/src/components/TableToobalTools.vue2.js +4 -0
- package/dist/components/tt-table/src/emits.js +15 -0
- package/dist/components/tt-table/src/hooks/useCellArea.js +15 -0
- package/dist/components/tt-table/src/hooks/useColumns.js +275 -0
- package/dist/components/tt-table/src/hooks/useCustomColumns.js +53 -0
- package/dist/components/tt-table/src/hooks/useDataSource.js +224 -0
- package/dist/components/tt-table/src/hooks/useLeftRightSlot.js +64 -0
- package/dist/components/tt-table/src/hooks/usePagination.js +44 -0
- package/dist/components/tt-table/src/hooks/useRowSelection.js +84 -0
- package/dist/components/tt-table/src/hooks/useTableContext.js +20 -0
- package/dist/components/tt-table/src/hooks/useTableEvent.js +197 -0
- package/dist/components/tt-table/src/hooks/useTableForm.js +60 -0
- package/dist/components/tt-table/src/hooks/useTableRender.js +33 -0
- package/dist/components/tt-table/src/hooks/useTableSlot.js +17 -0
- package/dist/components/tt-table/src/props.js +482 -0
- package/dist/components/tt-table/src/toolProps.js +30 -0
- package/dist/components/tt-table/src/utils/context.js +17 -0
- package/dist/components/tt-table/src/utils/table-api.js +386 -0
- package/dist/components/tt-table/src/utils/table-form-api.js +122 -0
- package/dist/components/tt-text/index.js +7 -0
- package/dist/components/tt-text/index.vue.js +7 -0
- package/dist/components/tt-text/index.vue2.js +73 -0
- package/dist/components/tt-upload/index.js +9 -0
- package/dist/components/tt-upload/src/TtUpload.vue.js +305 -0
- package/dist/components/tt-upload/src/TtUpload.vue2.js +4 -0
- package/dist/components/tt-upload/src/typing.js +107 -0
- package/dist/directives/auto-tip/index.js +62 -0
- package/dist/directives/dialog-resize/index.js +49 -0
- package/dist/directives/dialog-resize/use-css-variable.js +44 -0
- package/dist/directives/dialog-resize/use-draggable.js +35 -0
- package/dist/directives/dialog-resize/use-fullscreen.js +38 -0
- package/dist/directives/dialog-resize/use-parse-translate.js +9 -0
- package/dist/directives/dialog-resize/use-resizer.js +37 -0
- package/dist/directives/disabled-tip/index.js +78 -0
- package/dist/directives/index.js +8 -0
- package/dist/hooks/useDataPermissionOptions.js +142 -0
- package/dist/hooks/useFormSchemasLink.js +261 -0
- package/dist/hooks/useFormat.js +44 -0
- package/dist/hooks/useLoading.js +22 -0
- package/dist/hooks/useScreenshotOss.js +69 -0
- package/dist/hooks/useSetup.js +59 -0
- package/dist/index.js +142 -60274
- package/dist/plugins/default/renderCellContent.js +58 -0
- package/dist/plugins/vxeTable/switchStatus.js +91 -0
- package/dist/plugins.js +4 -146
- package/dist/style.css +1 -1
- package/dist/utils/xhr.js +8 -0
- package/package.json +3 -1
- package/dist/index-NG5FNCLD.js +0 -3430
- package/dist/index.modern-4Cf3dcJP.js +0 -3069
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { GlobalConfig as E } from "@dazhicheng-ui/hooks/useSetup";
|
|
2
|
+
import { compareObjects as $, isFunction as I } from "@dazhicheng/utils";
|
|
3
|
+
import { useDebounceFn as ie, useTimeoutFn as oe } from "@vueuse/core";
|
|
4
|
+
import { cloneDeep as y, set as L, get as A, isUndefined as ue } from "lodash-es";
|
|
5
|
+
import { shallowRef as M, ref as x, computed as j, unref as e, onMounted as fe, watch as O, toValue as ge } from "vue";
|
|
6
|
+
function Pe(r, {
|
|
7
|
+
xGrid: c,
|
|
8
|
+
setLoading: N,
|
|
9
|
+
paginationRef: F,
|
|
10
|
+
tableData: R,
|
|
11
|
+
getPaginationInfo: V,
|
|
12
|
+
setPagination: p,
|
|
13
|
+
clearSelectedRowKeys: G,
|
|
14
|
+
getIsTableEvent: ee
|
|
15
|
+
}, S) {
|
|
16
|
+
const h = M([]), B = x({}), w = x({}), z = M(!0), U = M(!1), _ = j(() => {
|
|
17
|
+
const { showPager: t, isScrollFetch: a } = e(r);
|
|
18
|
+
return t || a;
|
|
19
|
+
});
|
|
20
|
+
function te(t, a, l) {
|
|
21
|
+
const n = Array.isArray(t), i = n ? t : A(t, "code"), s = n ? t : A(t, a), o = n ? 0 : A(t, l);
|
|
22
|
+
return {
|
|
23
|
+
resultCode: i,
|
|
24
|
+
resultData: s,
|
|
25
|
+
resultTotal: ue(o) ? 0 : Number(o)
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
async function ae(t = ((l) => (l = E.table) == null ? void 0 : l.beforeFetch)(), a) {
|
|
29
|
+
return t && I(t) && (a = await t(a) || a), a;
|
|
30
|
+
}
|
|
31
|
+
async function le(t = ((n) => (n = E.table) == null ? void 0 : n.afterFetch)(), a, l) {
|
|
32
|
+
const { isScrollFetch: i, currentPageField: s = "" } = e(r);
|
|
33
|
+
return t && I(t) && (a = await t(a, e(B)) || a), i && A(l, s, 1) !== 1 && (a = [...e(h), ...a]), a;
|
|
34
|
+
}
|
|
35
|
+
async function m(t) {
|
|
36
|
+
var W, X;
|
|
37
|
+
const {
|
|
38
|
+
api: a,
|
|
39
|
+
filterApi: l,
|
|
40
|
+
searchInfo: n,
|
|
41
|
+
dataField: i,
|
|
42
|
+
beforeFetch: s,
|
|
43
|
+
afterFetch: o,
|
|
44
|
+
currentPageField: u,
|
|
45
|
+
pageSizeField: g,
|
|
46
|
+
totalField: v,
|
|
47
|
+
useSearchForm: T
|
|
48
|
+
} = e(r);
|
|
49
|
+
if (!a || !I(a)) return;
|
|
50
|
+
const { tablePage: f } = t;
|
|
51
|
+
let K = {}, b = f.currentPage || 1;
|
|
52
|
+
const Q = e(r).formApi;
|
|
53
|
+
Q && T && (K = await Q.getValues());
|
|
54
|
+
const D = {};
|
|
55
|
+
L(D, u, b || 1), L(D, g, f.pageSize);
|
|
56
|
+
try {
|
|
57
|
+
N(!0);
|
|
58
|
+
let d = null;
|
|
59
|
+
if (t != null && t.serverFilterParams && l)
|
|
60
|
+
d = await l({
|
|
61
|
+
...t == null ? void 0 : t.serverFilterParams,
|
|
62
|
+
...e(_) ? D : {}
|
|
63
|
+
});
|
|
64
|
+
else {
|
|
65
|
+
l && ((W = e(c)) == null || W.clearSort(), (X = e(c)) == null || X.clearFilter());
|
|
66
|
+
let k = {
|
|
67
|
+
...K,
|
|
68
|
+
...n,
|
|
69
|
+
...t == null ? void 0 : t.searchInfo,
|
|
70
|
+
...e(_) ? D : {}
|
|
71
|
+
};
|
|
72
|
+
k = await ae(s, k), d = await a(k);
|
|
73
|
+
}
|
|
74
|
+
B.value = d;
|
|
75
|
+
const { resultData: ce, resultTotal: Y } = te(d, i, v);
|
|
76
|
+
let P = ce || [];
|
|
77
|
+
P = await le(o, P, D), C(P);
|
|
78
|
+
const Z = Y || P.length || 0, se = Math.max(1, Math.ceil(Z / f.pageSize));
|
|
79
|
+
b > se && (b = 1, q({
|
|
80
|
+
tablePage: {
|
|
81
|
+
currentPage: b,
|
|
82
|
+
pageSize: f.pageSize
|
|
83
|
+
}
|
|
84
|
+
})), p({
|
|
85
|
+
total: Z,
|
|
86
|
+
currentPage: b
|
|
87
|
+
}), w.value = y(e(V)), S("fetch-success", {
|
|
88
|
+
items: P,
|
|
89
|
+
total: Y,
|
|
90
|
+
rawDataSource: d
|
|
91
|
+
}), G(), U.value = !0;
|
|
92
|
+
} catch (d) {
|
|
93
|
+
S("fetch-error", d), C([]);
|
|
94
|
+
} finally {
|
|
95
|
+
setTimeout(() => {
|
|
96
|
+
N(!1);
|
|
97
|
+
}, 50);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
async function q(t) {
|
|
101
|
+
var l;
|
|
102
|
+
const a = {
|
|
103
|
+
...e(F)
|
|
104
|
+
};
|
|
105
|
+
(l = E.table) != null && l.isReloadResetToFirstPage && (a.currentPage = 1), t ? await m({
|
|
106
|
+
tablePage: Object.hasOwn(t, "tablePage") ? t.tablePage : a,
|
|
107
|
+
searchInfo: Object.hasOwn(t, "searchInfo") ? t.searchInfo : t
|
|
108
|
+
}) : await m({
|
|
109
|
+
tablePage: a
|
|
110
|
+
}), e(r).immediate || (z.value = !1);
|
|
111
|
+
}
|
|
112
|
+
async function H(t) {
|
|
113
|
+
var u, g, v, T;
|
|
114
|
+
if (!!!((g = (u = e(r)) == null ? void 0 : u.filterConfig) != null && g.remote)) return;
|
|
115
|
+
const l = {
|
|
116
|
+
...e(F)
|
|
117
|
+
};
|
|
118
|
+
t !== "page" && (l.currentPage = 1);
|
|
119
|
+
const n = ((v = e(c)) == null ? void 0 : v.getSortColumns()) || [], s = (((T = e(c)) == null ? void 0 : T.getCheckedFilters()) || []).map((f) => ({
|
|
120
|
+
fieldName: f.field,
|
|
121
|
+
checkAll: !1,
|
|
122
|
+
includeValues: f.datas[0],
|
|
123
|
+
excludeValues: []
|
|
124
|
+
})), o = n.map((f) => ({
|
|
125
|
+
fieldName: f.field,
|
|
126
|
+
isAscending: f.order === "asc"
|
|
127
|
+
}));
|
|
128
|
+
await m({
|
|
129
|
+
serverFilterParams: {
|
|
130
|
+
filterConditions: s,
|
|
131
|
+
sortConditions: o
|
|
132
|
+
},
|
|
133
|
+
tablePage: l
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
function ne() {
|
|
137
|
+
var a;
|
|
138
|
+
const { tableData: t } = ((a = e(c)) == null ? void 0 : a.getTableData()) || {};
|
|
139
|
+
return t;
|
|
140
|
+
}
|
|
141
|
+
function re(t) {
|
|
142
|
+
h.value = t, S("update:modelValue", t);
|
|
143
|
+
}
|
|
144
|
+
const C = ie((t) => {
|
|
145
|
+
var n, i, s, o, u;
|
|
146
|
+
const a = e(c).getTreeExpandRecords(), l = (i = (n = e(r)) == null ? void 0 : n.treeConfig) == null ? void 0 : i.reserve;
|
|
147
|
+
e(c) && ((s = e(c)) == null || s.loadData(t)), e(r).mergeCells && e(c) && ((o = e(c)) == null || o.setMergeCells(e(r).mergeCells)), e(r).clearTreeExpand ? e(c) && ((u = e(c)) == null || u.clearTreeExpand()) : a.length > 0 && l && e(c).setTreeExpand(a, !0), re(t), S("load-data");
|
|
148
|
+
}, 30);
|
|
149
|
+
function J(t, a) {
|
|
150
|
+
return (t.currentPage || 1) !== a.currentPage || t.pageSize !== a.pageSize;
|
|
151
|
+
}
|
|
152
|
+
return fe(() => {
|
|
153
|
+
w.value = y(e(V)), oe(() => {
|
|
154
|
+
const t = J(e(r).pagerConfig, e(w));
|
|
155
|
+
e(r).immediate && !t && m({
|
|
156
|
+
tablePage: e(V)
|
|
157
|
+
});
|
|
158
|
+
}, 16);
|
|
159
|
+
}), O(
|
|
160
|
+
() => e(F),
|
|
161
|
+
(t) => {
|
|
162
|
+
var l, n, i, s;
|
|
163
|
+
if (J(t, e(w))) {
|
|
164
|
+
if (e(z) && !e(r).immediate) {
|
|
165
|
+
z.value = !1;
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
const o = !!((n = (l = e(r)) == null ? void 0 : l.filterConfig) != null && n.remote), u = ((i = e(c)) == null ? void 0 : i.getSortColumns()) || [], g = ((s = e(c)) == null ? void 0 : s.getCheckedFilters()) || [];
|
|
169
|
+
o && (u.length > 0 || g.length > 0) ? H("page") : m({
|
|
170
|
+
tablePage: e(F)
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
{ deep: !0 }
|
|
175
|
+
), O(
|
|
176
|
+
j(() => ge(e(r).data) || []),
|
|
177
|
+
(t) => {
|
|
178
|
+
var n;
|
|
179
|
+
const { fullData: a } = e(c) ? ((n = e(c)) == null ? void 0 : n.getTableData()) || {} : { fullData: [] };
|
|
180
|
+
if (Object.keys($({ data: t }, { data: a })).length) {
|
|
181
|
+
const { data: i, api: s, modelValue: o } = e(r);
|
|
182
|
+
if ((o ? o.length : 0) === 0 && !s && i) {
|
|
183
|
+
const g = e(r).isDataCloneDeep ? y(e(i)) : e(i);
|
|
184
|
+
C(g);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
immediate: !0,
|
|
190
|
+
deep: !0
|
|
191
|
+
}
|
|
192
|
+
), O(
|
|
193
|
+
j(() => e(r).modelValue || []),
|
|
194
|
+
(t) => {
|
|
195
|
+
var n;
|
|
196
|
+
if (e(ee)) return;
|
|
197
|
+
const { fullData: a } = e(c) ? ((n = e(c)) == null ? void 0 : n.getTableData()) || {} : { fullData: [] };
|
|
198
|
+
if (Object.keys($({ data: t }, { data: a })).length) {
|
|
199
|
+
const { api: i, modelValue: s } = e(r);
|
|
200
|
+
if (!i && s) {
|
|
201
|
+
const o = e(r).isDataCloneDeep ? y(s) : e(s);
|
|
202
|
+
C(o);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
{ immediate: !0, deep: !0 }
|
|
207
|
+
), O(
|
|
208
|
+
() => h.value,
|
|
209
|
+
() => {
|
|
210
|
+
R.value = e(h);
|
|
211
|
+
},
|
|
212
|
+
{ deep: !0, immediate: !0 }
|
|
213
|
+
), {
|
|
214
|
+
dataSource: h,
|
|
215
|
+
fetch: m,
|
|
216
|
+
reload: q,
|
|
217
|
+
reloadFilter: H,
|
|
218
|
+
getDataSource: ne,
|
|
219
|
+
isloaded: U
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
export {
|
|
223
|
+
Pe as useDataSource
|
|
224
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { computed as L, ref as H, shallowRef as s, watch as O, unref as x } from "vue";
|
|
2
|
+
function P(v, r, A) {
|
|
3
|
+
const p = L(() => {
|
|
4
|
+
var t, e;
|
|
5
|
+
return ((t = v.value) == null ? void 0 : t.leftSlotWidth) || ((e = v.value) == null ? void 0 : e.rightSlotWidth);
|
|
6
|
+
}), T = H(), q = H(), h = s(0), y = s(0), f = s(0), g = s(0), b = s(0), d = H([]);
|
|
7
|
+
async function w(t = !0) {
|
|
8
|
+
var a, n, c, i, u, S;
|
|
9
|
+
if (!x(p)) return;
|
|
10
|
+
await new Promise((m) => setTimeout(m, 50));
|
|
11
|
+
const e = (n = (a = r.value) == null ? void 0 : a.$el) == null ? void 0 : n.querySelector(".vxe-table--body-wrapper"), l = (i = (c = r.value) == null ? void 0 : c.$el) == null ? void 0 : i.querySelector(".vxe-table--header"), o = (S = (u = r.value) == null ? void 0 : u.$el) == null ? void 0 : S.querySelector(".vxe-body--y-space");
|
|
12
|
+
h.value = (e == null ? void 0 : e.clientHeight) || 0, b.value = o.style.height, f.value = (l == null ? void 0 : l.clientHeight) || 0, B(t ? 0 : void 0);
|
|
13
|
+
}
|
|
14
|
+
async function B(t) {
|
|
15
|
+
var o, a, n, c, i;
|
|
16
|
+
if (!x(p)) return;
|
|
17
|
+
await new Promise((u) => setTimeout(u, 10));
|
|
18
|
+
const e = (a = (o = r.value) == null ? void 0 : o.$el) == null ? void 0 : a.querySelector(".vxe-table--body");
|
|
19
|
+
y.value = e.clientHeight, g.value = e.style.marginTop || 0;
|
|
20
|
+
const l = e.querySelectorAll(".vxe-body--row");
|
|
21
|
+
d.value = (n = Array.from(l)) == null ? void 0 : n.map((u) => {
|
|
22
|
+
var $;
|
|
23
|
+
const S = ($ = r.value) == null ? void 0 : $.getRowNode(u), m = u.offsetTop;
|
|
24
|
+
return {
|
|
25
|
+
...S,
|
|
26
|
+
offsetTop: m
|
|
27
|
+
};
|
|
28
|
+
}), t !== void 0 && ((c = T.value) == null || c.scrollTo({ top: t }), (i = q.value) == null || i.scrollTo({ top: t }));
|
|
29
|
+
}
|
|
30
|
+
return O(
|
|
31
|
+
() => A.value,
|
|
32
|
+
() => {
|
|
33
|
+
w();
|
|
34
|
+
},
|
|
35
|
+
{ deep: !0 }
|
|
36
|
+
), O(
|
|
37
|
+
() => {
|
|
38
|
+
var t, e;
|
|
39
|
+
return [(t = v.value) == null ? void 0 : t.leftSlotWidth, (e = v.value) == null ? void 0 : e.rightSlotWidth];
|
|
40
|
+
},
|
|
41
|
+
([t, e], [l, o]) => {
|
|
42
|
+
const a = !!(t || e), n = !!(l || o);
|
|
43
|
+
if (!a) {
|
|
44
|
+
h.value = 0, y.value = 0, f.value = 0, g.value = 0, b.value = 0, d.value = [];
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
(!n || t !== l || e !== o) && w();
|
|
48
|
+
}
|
|
49
|
+
), {
|
|
50
|
+
handleLeftRightSlotScroll: B,
|
|
51
|
+
handleLeftRightSlotInit: w,
|
|
52
|
+
leftRightSlotRows: d,
|
|
53
|
+
tableHeaderHight: f,
|
|
54
|
+
leftSlotScrollbarRef: T,
|
|
55
|
+
rightSlotScrollbarRef: q,
|
|
56
|
+
tableBodyHeight: y,
|
|
57
|
+
tableBodyWrapHeight: h,
|
|
58
|
+
tableBodyScrollTop: g,
|
|
59
|
+
tableBodyScrollHeight: b
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
export {
|
|
63
|
+
P as useLeftRightSlot
|
|
64
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { mergeWithArrayOverride as m } from "@dazhicheng/utils";
|
|
2
|
+
import { GlobalConfig as c } from "@dazhicheng-ui/hooks/useSetup";
|
|
3
|
+
import { isEqual as l } from "lodash-es";
|
|
4
|
+
import { ref as s, unref as n, computed as P, watch as h } from "vue";
|
|
5
|
+
function S(o, u) {
|
|
6
|
+
var g;
|
|
7
|
+
const t = s(
|
|
8
|
+
m(n(o).pagerConfig || {}, ((g = c.table) == null ? void 0 : g.pagerConfig) || {})
|
|
9
|
+
), i = P(() => {
|
|
10
|
+
const { showPager: e, pagerConfig: a } = n(o);
|
|
11
|
+
if (!(!e && !a))
|
|
12
|
+
return {
|
|
13
|
+
currentPage: 1,
|
|
14
|
+
pageSize: 300,
|
|
15
|
+
total: 0,
|
|
16
|
+
pageSizes: [300, 500, 1e3, 2e3],
|
|
17
|
+
layouts: ["Total", "PrevPage", "JumpNumber", "NextPage", "Sizes", "FullJump"],
|
|
18
|
+
// ...unref(refProps).pagerConfig,
|
|
19
|
+
...n(t)
|
|
20
|
+
};
|
|
21
|
+
});
|
|
22
|
+
function f() {
|
|
23
|
+
return n(i);
|
|
24
|
+
}
|
|
25
|
+
function r(e) {
|
|
26
|
+
t.value = {
|
|
27
|
+
...n(t),
|
|
28
|
+
...e
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function p(e) {
|
|
32
|
+
u("page-change", e);
|
|
33
|
+
}
|
|
34
|
+
return h(
|
|
35
|
+
() => n(o).pagerConfig,
|
|
36
|
+
(e, a) => {
|
|
37
|
+
e && !l(e, a) && r(e);
|
|
38
|
+
},
|
|
39
|
+
{ deep: !0 }
|
|
40
|
+
), { configRef: t, getPagination: f, getPaginationInfo: i, setPagination: r, handlePageChange: p };
|
|
41
|
+
}
|
|
42
|
+
export {
|
|
43
|
+
S as usePagination
|
|
44
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { isArray as b } from "lodash-es";
|
|
2
|
+
import { ref as f, computed as I, unref as o, toValue as A } from "vue";
|
|
3
|
+
function B(u, l, n) {
|
|
4
|
+
const s = f([]), h = f([]), k = I(() => {
|
|
5
|
+
const { showCheckbox: e, showRadio: c } = o(u), t = A(s);
|
|
6
|
+
return e ? t : c ? t ? [t] : [] : [];
|
|
7
|
+
});
|
|
8
|
+
function i() {
|
|
9
|
+
return o(s);
|
|
10
|
+
}
|
|
11
|
+
function a() {
|
|
12
|
+
const { showCheckbox: e, showRadio: c } = o(u);
|
|
13
|
+
return e ? o(n).getCheckboxRecords(!0) : c ? o(n).getRadioRecord(!0) : [];
|
|
14
|
+
}
|
|
15
|
+
function r(e) {
|
|
16
|
+
const { tableRowId: c } = o(u);
|
|
17
|
+
h.value = a(), s.value = o(h).map((t) => t[c || "id"]), l("selection-change", {
|
|
18
|
+
keys: i(),
|
|
19
|
+
rows: a(),
|
|
20
|
+
data: e
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
const C = (e) => {
|
|
24
|
+
r(e), l("checkbox-change", e);
|
|
25
|
+
}, v = (e) => {
|
|
26
|
+
r(e), l("checkbox-all", e);
|
|
27
|
+
}, y = (e) => {
|
|
28
|
+
l("checkbox-range-change", e);
|
|
29
|
+
const { records: c } = e;
|
|
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());
|
|
45
|
+
};
|
|
46
|
+
async function x(e) {
|
|
47
|
+
const { rows: c, cols: t } = e;
|
|
48
|
+
if (c.length !== 1 && o(n) && t.some((w) => w.type === "checkbox")) {
|
|
49
|
+
const w = o(n).isCheckedByCheckboxRow(c[0]);
|
|
50
|
+
await o(n).setCheckboxRow(c, !w);
|
|
51
|
+
const { tableRowId: R } = o(u);
|
|
52
|
+
h.value = a(), s.value = o(h).map((g) => g[R || "id"]), l("selection-change", {
|
|
53
|
+
keys: i(),
|
|
54
|
+
rows: a(),
|
|
55
|
+
data: e
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function K(e) {
|
|
60
|
+
var c, t;
|
|
61
|
+
h.value = e.row, s.value = (t = e.row) == null ? void 0 : t[((c = o(u)) == null ? void 0 : c.tableRowId) || "id"], l("radio-change", e), l("selection-change", {
|
|
62
|
+
keys: i(),
|
|
63
|
+
rows: a(),
|
|
64
|
+
data: e
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
selectedKeys: s,
|
|
69
|
+
selectedRows: h,
|
|
70
|
+
setSelectedRowKeys: d,
|
|
71
|
+
onCellAreaSelectionEndSetCheckbox: x,
|
|
72
|
+
clearSelectedRowKeys: S,
|
|
73
|
+
onCheckboxChange: C,
|
|
74
|
+
onCheckboxAll: v,
|
|
75
|
+
getSelectRowKeys: i,
|
|
76
|
+
getSelectRows: a,
|
|
77
|
+
onCheckboxRangeChange: y,
|
|
78
|
+
onRadioChange: K,
|
|
79
|
+
getCheckboxSelectedKeys: k
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
export {
|
|
83
|
+
B as useRowSelection
|
|
84
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { provide as e, inject as o } from "vue";
|
|
2
|
+
const n = Symbol("tt-table"), r = Symbol("tt-table-form");
|
|
3
|
+
function a(t) {
|
|
4
|
+
e(n, t);
|
|
5
|
+
}
|
|
6
|
+
function b() {
|
|
7
|
+
return o(n);
|
|
8
|
+
}
|
|
9
|
+
function l(t) {
|
|
10
|
+
e(r, t);
|
|
11
|
+
}
|
|
12
|
+
function m() {
|
|
13
|
+
return o(r);
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
a as createTableContext,
|
|
17
|
+
l as createTableFormContext,
|
|
18
|
+
b as useTableContext,
|
|
19
|
+
m as useTableFormContext
|
|
20
|
+
};
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { delay as w } from "lodash-es";
|
|
2
|
+
import { unref as a, nextTick as i } from "vue";
|
|
3
|
+
function b(n, R, f, E, m, u) {
|
|
4
|
+
const r = () => {
|
|
5
|
+
i(() => {
|
|
6
|
+
const o = a(n), { tableData: t } = o.getTableData();
|
|
7
|
+
E.setState({
|
|
8
|
+
modelValue: t
|
|
9
|
+
}), E.setProxyState({ isTableEvent: !1 }), f("update:modelValue", t);
|
|
10
|
+
});
|
|
11
|
+
}, c = () => {
|
|
12
|
+
E.setProxyState({ isTableEvent: !0 });
|
|
13
|
+
};
|
|
14
|
+
return {
|
|
15
|
+
...{
|
|
16
|
+
/**
|
|
17
|
+
* @description: 插入行
|
|
18
|
+
* @param {VxeTablePropTypes.Row | VxeTablePropTypes.Row[]} records
|
|
19
|
+
* @return {Promise<InsertReturnData>}
|
|
20
|
+
*/
|
|
21
|
+
insert: async function(t) {
|
|
22
|
+
c();
|
|
23
|
+
const s = await a(n).insert(t);
|
|
24
|
+
return r(), s;
|
|
25
|
+
},
|
|
26
|
+
/**
|
|
27
|
+
* @description: 插入指定行
|
|
28
|
+
* @param {VxeTablePropTypes.Row | VxeTablePropTypes.Row[]} records
|
|
29
|
+
* @param {*} row
|
|
30
|
+
* @return {Promise<InsertReturnData>}
|
|
31
|
+
*/
|
|
32
|
+
insertAt: async function(t, e) {
|
|
33
|
+
c();
|
|
34
|
+
const d = await a(n).insertAt(t, e);
|
|
35
|
+
return r(), d;
|
|
36
|
+
},
|
|
37
|
+
/**
|
|
38
|
+
* @description: 退出编辑并还原数据
|
|
39
|
+
* @param {VxeTablePropTypes.Row} row
|
|
40
|
+
*/
|
|
41
|
+
clearEditRevertData: async function(t) {
|
|
42
|
+
var e, s;
|
|
43
|
+
c(), await ((e = a(n)) == null ? void 0 : e.clearEdit()), (s = a(n)) == null || s.revertData(t), r();
|
|
44
|
+
},
|
|
45
|
+
/**
|
|
46
|
+
* @description: 指定行激活编辑
|
|
47
|
+
* @param row 指定行
|
|
48
|
+
* @param fieldOrColumn 指定列
|
|
49
|
+
*/
|
|
50
|
+
setEditRow: async function(t, e) {
|
|
51
|
+
var s;
|
|
52
|
+
await ((s = a(n)) == null ? void 0 : s.setEditRow(t, e));
|
|
53
|
+
},
|
|
54
|
+
/**
|
|
55
|
+
* @description: 指定单元格激活编辑
|
|
56
|
+
* @param row 指定行
|
|
57
|
+
* @param fieldOrColumn 指定列
|
|
58
|
+
*/
|
|
59
|
+
setEditCell: async function(t, e) {
|
|
60
|
+
var s;
|
|
61
|
+
await ((s = a(n)) == null ? void 0 : s.setEditCell(t, e));
|
|
62
|
+
},
|
|
63
|
+
/**
|
|
64
|
+
* @description: 删除行
|
|
65
|
+
* @param {any} row
|
|
66
|
+
* @return {*}
|
|
67
|
+
*/
|
|
68
|
+
remove: async function(t) {
|
|
69
|
+
c();
|
|
70
|
+
const e = await a(n).remove(t);
|
|
71
|
+
return r(), e;
|
|
72
|
+
},
|
|
73
|
+
/**
|
|
74
|
+
* 删除复选框选中的行数据
|
|
75
|
+
*/
|
|
76
|
+
removeCheckboxRow: async function() {
|
|
77
|
+
var e;
|
|
78
|
+
c();
|
|
79
|
+
const t = await a(n).removeCheckboxRow();
|
|
80
|
+
return (e = u == null ? void 0 : u.clearSelectedRowKeys) == null || e.call(u), r(), t;
|
|
81
|
+
},
|
|
82
|
+
/**
|
|
83
|
+
* 删除单选框选中的行数据
|
|
84
|
+
*/
|
|
85
|
+
removeRadioRow: async function() {
|
|
86
|
+
var e;
|
|
87
|
+
c();
|
|
88
|
+
const t = await a(n).removeRadioRow();
|
|
89
|
+
return (e = u == null ? void 0 : u.clearSelectedRowKeys) == null || e.call(u), r(), t;
|
|
90
|
+
},
|
|
91
|
+
/**
|
|
92
|
+
* 删除当前行选中的行数据
|
|
93
|
+
*/
|
|
94
|
+
removeCurrentRow: async function() {
|
|
95
|
+
c();
|
|
96
|
+
const t = await a(n).removeCurrentRow();
|
|
97
|
+
return r(), t;
|
|
98
|
+
},
|
|
99
|
+
/**
|
|
100
|
+
* 删除所有新增的临时数据
|
|
101
|
+
*/
|
|
102
|
+
removeInsertRow: async function() {
|
|
103
|
+
c();
|
|
104
|
+
const t = await a(n).removeInsertRow();
|
|
105
|
+
return r(), t;
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
...{
|
|
109
|
+
/**
|
|
110
|
+
* 加载数据
|
|
111
|
+
* @param data 数据
|
|
112
|
+
*/
|
|
113
|
+
loadData: async function(t) {
|
|
114
|
+
var l, v;
|
|
115
|
+
const e = a(n).getTreeExpandRecords();
|
|
116
|
+
c();
|
|
117
|
+
const s = await a(n).loadData(t), d = (v = (l = a(m)) == null ? void 0 : l.treeConfig) == null ? void 0 : v.reserve;
|
|
118
|
+
return e.length > 0 && d && a(n).setTreeExpand(e, !0), r(), s;
|
|
119
|
+
},
|
|
120
|
+
/**
|
|
121
|
+
* 加载数据并恢复到初始状态
|
|
122
|
+
* @param data 数据
|
|
123
|
+
*/
|
|
124
|
+
reloadData: async function(t) {
|
|
125
|
+
var l, v;
|
|
126
|
+
const e = a(n).getTreeExpandRecords();
|
|
127
|
+
c();
|
|
128
|
+
const s = await a(n).reloadData(t), d = (v = (l = a(m)) == null ? void 0 : l.treeConfig) == null ? void 0 : v.reserve;
|
|
129
|
+
return e.length > 0 && d && a(n).setTreeExpand(e, !0), r(), s;
|
|
130
|
+
},
|
|
131
|
+
/**
|
|
132
|
+
* 重新加载列
|
|
133
|
+
* @param columns 列对象
|
|
134
|
+
*/
|
|
135
|
+
reloadColumn: async function(t) {
|
|
136
|
+
const e = a(n).getTreeExpandRecords();
|
|
137
|
+
return c(), await E.setTableColumns(t), w(() => {
|
|
138
|
+
var l, v;
|
|
139
|
+
const d = (v = (l = a(m)) == null ? void 0 : l.treeConfig) == null ? void 0 : v.reserve;
|
|
140
|
+
e.length > 0 && d && a(n).setTreeExpand(e, !0);
|
|
141
|
+
}, 50), r(), E.getTableColumns();
|
|
142
|
+
},
|
|
143
|
+
/**
|
|
144
|
+
* 局部加载行数据并恢复到初始状态
|
|
145
|
+
* @param rows 行对象
|
|
146
|
+
* @param record 新数据
|
|
147
|
+
* @param field 指定字段名
|
|
148
|
+
*/
|
|
149
|
+
reloadRow: async function(t, e, s) {
|
|
150
|
+
c();
|
|
151
|
+
const d = await a(n).reloadRow(t, e, s);
|
|
152
|
+
return r(), d;
|
|
153
|
+
},
|
|
154
|
+
/**
|
|
155
|
+
* 手动清空单元格内容,如果不传参数,则清空整个表格内容,如果传了行则清空指定行内容,如果传了指定字段,则清空该字段内容
|
|
156
|
+
* @param rows 指定行
|
|
157
|
+
* @param field 字段名
|
|
158
|
+
*/
|
|
159
|
+
clearData: async function(t, e) {
|
|
160
|
+
c();
|
|
161
|
+
const s = await a(n).clearData(t, e);
|
|
162
|
+
return r(), s;
|
|
163
|
+
},
|
|
164
|
+
/**
|
|
165
|
+
* 重新懒加载展开行,并展开内容
|
|
166
|
+
* @param rows 指定行
|
|
167
|
+
*/
|
|
168
|
+
reloadRowExpand: async function(t) {
|
|
169
|
+
c();
|
|
170
|
+
const e = await a(n).reloadRowExpand(t);
|
|
171
|
+
return r(), e;
|
|
172
|
+
},
|
|
173
|
+
/**
|
|
174
|
+
* 重新懒加载树节点,并展开该节点
|
|
175
|
+
* @param rows 指定行
|
|
176
|
+
*/
|
|
177
|
+
reloadTreeExpand: async function(t) {
|
|
178
|
+
c();
|
|
179
|
+
const e = await a(n).reloadTreeExpand(t);
|
|
180
|
+
return r(), e;
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
...{
|
|
184
|
+
/**
|
|
185
|
+
* 设置空数据展示的text
|
|
186
|
+
*/
|
|
187
|
+
setEmptyText: (o) => {
|
|
188
|
+
R.emptyText = o, E.setState({
|
|
189
|
+
emptyText: o
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
export {
|
|
196
|
+
b as useTableEvents
|
|
197
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { omit as p, cloneDeep as y, isFunction as d, isEqual as T } from "lodash-es";
|
|
2
|
+
import { ref as C, computed as f, unref as n, toValue as m, watch as D, watchEffect as E } from "vue";
|
|
3
|
+
function B(o, w, g, F, I) {
|
|
4
|
+
const r = C([]), b = f(() => {
|
|
5
|
+
const { form: t } = n(o), { submitButtonOptions: e = {} } = t || {};
|
|
6
|
+
return Object.assign(e, { loading: n(g) }), {
|
|
7
|
+
...t,
|
|
8
|
+
submitButtonOptions: e
|
|
9
|
+
};
|
|
10
|
+
});
|
|
11
|
+
async function S(t) {
|
|
12
|
+
const e = F(), a = { currentPage: 1, pageSize: e == null ? void 0 : e.pageSize };
|
|
13
|
+
await w({ tablePage: a, searchInfo: t });
|
|
14
|
+
}
|
|
15
|
+
const P = f(() => {
|
|
16
|
+
const { table: t = {}, tableRowId: e, useSearchForm: a, testId: s } = m(o), u = p(n(l), ["tableRowId"]);
|
|
17
|
+
return y({
|
|
18
|
+
useSearchForm: a || !1,
|
|
19
|
+
// TODO: getProps 使用toRaw会导致堆栈溢出问题后续优化
|
|
20
|
+
...t,
|
|
21
|
+
...u,
|
|
22
|
+
tableRowId: (t == null ? void 0 : t.tableRowId) || e,
|
|
23
|
+
// 继承外层的 testId,如果 table.testId 未设置则使用外层的 testId
|
|
24
|
+
testId: (t == null ? void 0 : t.testId) || s,
|
|
25
|
+
beforeFetch: async (i) => {
|
|
26
|
+
const { handleSearchInfoFn: h } = m(o);
|
|
27
|
+
let c = i;
|
|
28
|
+
return h && d(h) && (c = await h(c)), t != null && t.beforeFetch && d(t == null ? void 0 : t.beforeFetch) && (c = await (t == null ? void 0 : t.beforeFetch(c))), c;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}), l = f(() => {
|
|
32
|
+
const { columnsKey: t, showSetting: e, showSetColumn: a, showRefresh: s, showExport: u } = n(o).table || {}, { toolConfig: i } = n(o);
|
|
33
|
+
return {
|
|
34
|
+
columnsKey: t,
|
|
35
|
+
showSetting: e,
|
|
36
|
+
showRefresh: s,
|
|
37
|
+
showSetColumn: a,
|
|
38
|
+
showExport: u,
|
|
39
|
+
...i
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
return D(
|
|
43
|
+
() => r.value,
|
|
44
|
+
(t, e) => {
|
|
45
|
+
T(t, e) || I("update:table-data", t);
|
|
46
|
+
},
|
|
47
|
+
{ deep: !0 }
|
|
48
|
+
), E(() => {
|
|
49
|
+
r.value = n(o).tableData || [];
|
|
50
|
+
}), {
|
|
51
|
+
tableData: r,
|
|
52
|
+
getFormProps: b,
|
|
53
|
+
handleSearchInfoChange: S,
|
|
54
|
+
getTableProps: P,
|
|
55
|
+
getTableToolProps: l
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
export {
|
|
59
|
+
B as useTableForm
|
|
60
|
+
};
|