@dazhicheng/ui 1.5.199 → 1.5.202
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/RiRefreshLine.svg.js +4 -0
- package/dist/assets/svg/action_more.svg.js +4 -0
- package/dist/assets/svg/add.svg.js +4 -0
- package/dist/assets/svg/addCircleLine.svg.js +4 -0
- package/dist/assets/svg/arrowDown.svg.js +4 -0
- package/dist/assets/svg/arrowLineDown.svg.js +5 -0
- package/dist/assets/svg/arrowSUp.svg.js +4 -0
- package/dist/assets/svg/arrowUp.svg.js +4 -0
- package/dist/assets/svg/close.svg.js +4 -0
- package/dist/assets/svg/columnSet.svg.js +4 -0
- package/dist/assets/svg/determinateCircleLine.svg.js +5 -0
- package/dist/assets/svg/drag.svg.js +5 -0
- package/dist/assets/svg/exportSvg.svg.js +4 -0
- package/dist/assets/svg/fileSvg.svg.js +4 -0
- package/dist/assets/svg/help.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.vue3.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 +157 -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 +59 -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 +345 -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 +101 -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 +196 -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 +277 -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 +147 -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 +31 -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 +201 -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 +63 -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 +356 -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 +234 -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 +306 -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/hooks/useTable.js +13 -0
- package/dist/hooks/useTemplateSlot.js +13 -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 +5 -3
- package/dist/index-NG5FNCLD.js +0 -3430
- package/dist/index.modern-4Cf3dcJP.js +0 -3069
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import { calcWordsWidth as G } from "@dazhicheng/utils";
|
|
2
|
+
import { ElMessage as Y } from "element-plus";
|
|
3
|
+
import { GlobalConfig as R } from "../../../../hooks/useSetup.js";
|
|
4
|
+
import { isEqual as U, debounce as B, cloneDeep as L, flattenDeep as ee, isArray as ne, isFunction as te } from "lodash-es";
|
|
5
|
+
import { ref as x, shallowRef as le, computed as T, unref as n, watch as E, toValue as oe, watchEffect as ie, onUnmounted as se, nextTick as ue } from "vue";
|
|
6
|
+
function S(e) {
|
|
7
|
+
var u;
|
|
8
|
+
const s = L(e || []);
|
|
9
|
+
for (let t = 0; t < (e || []).length; t++) {
|
|
10
|
+
const i = e[t];
|
|
11
|
+
i != null && i.slots && (s[t].slots = { ...i.slots }), i != null && i.children && ((u = s[t]) != null && u.children) && (s[t].children = S(i.children));
|
|
12
|
+
}
|
|
13
|
+
return s;
|
|
14
|
+
}
|
|
15
|
+
function ce(e) {
|
|
16
|
+
const {
|
|
17
|
+
showCheckbox: s,
|
|
18
|
+
showIndex: u,
|
|
19
|
+
showExpand: t,
|
|
20
|
+
showRadio: i,
|
|
21
|
+
indexColumnProps: h,
|
|
22
|
+
checkboxColumnProps: b,
|
|
23
|
+
expandColumnProps: W,
|
|
24
|
+
radioColumnProps: C
|
|
25
|
+
} = n(e), a = [];
|
|
26
|
+
return u && a.unshift({
|
|
27
|
+
type: "seq",
|
|
28
|
+
title: "序号",
|
|
29
|
+
width: 60,
|
|
30
|
+
resizable: !1,
|
|
31
|
+
align: "center",
|
|
32
|
+
fixed: "left",
|
|
33
|
+
...h
|
|
34
|
+
}), i && a.unshift({
|
|
35
|
+
type: "radio",
|
|
36
|
+
width: 48,
|
|
37
|
+
resizable: !1,
|
|
38
|
+
align: "center",
|
|
39
|
+
fixed: "left",
|
|
40
|
+
...C
|
|
41
|
+
}), s && a.unshift({
|
|
42
|
+
type: "checkbox",
|
|
43
|
+
width: 48,
|
|
44
|
+
resizable: !1,
|
|
45
|
+
align: "center",
|
|
46
|
+
fixed: "left",
|
|
47
|
+
...b
|
|
48
|
+
}), t && a.push({
|
|
49
|
+
type: "expand",
|
|
50
|
+
width: 20,
|
|
51
|
+
resizable: !1,
|
|
52
|
+
align: "center",
|
|
53
|
+
fixed: "left",
|
|
54
|
+
padding: !1,
|
|
55
|
+
slots: { content: "expand-content" },
|
|
56
|
+
...W
|
|
57
|
+
}), a;
|
|
58
|
+
}
|
|
59
|
+
function de(e) {
|
|
60
|
+
const { showAction: s, actionProps: u, actionWidth: t, actionTitle: i } = n(e);
|
|
61
|
+
return s ? [
|
|
62
|
+
{
|
|
63
|
+
field: "action",
|
|
64
|
+
title: i || "操作",
|
|
65
|
+
width: t,
|
|
66
|
+
resizable: !1,
|
|
67
|
+
fixed: "right",
|
|
68
|
+
showOverflow: !1,
|
|
69
|
+
slots: { default: "action" },
|
|
70
|
+
...u
|
|
71
|
+
}
|
|
72
|
+
] : [];
|
|
73
|
+
}
|
|
74
|
+
function re(e, s) {
|
|
75
|
+
const u = (t, i) => {
|
|
76
|
+
if (t.sortable && i) {
|
|
77
|
+
const h = `${t.field}_header`;
|
|
78
|
+
return s.value.push(h), Object.assign(t, {
|
|
79
|
+
slots: {
|
|
80
|
+
...t.slots,
|
|
81
|
+
header: h
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
return t;
|
|
86
|
+
};
|
|
87
|
+
return e.children && (e.children = e.children.map((t) => u(t, !1))), u(e, e.field !== "action");
|
|
88
|
+
}
|
|
89
|
+
function ae(e, s, u) {
|
|
90
|
+
if (u.value.length) {
|
|
91
|
+
const i = e.editRender && u.value.includes(e.field || "") ? `${e.field}_Valid` : void 0;
|
|
92
|
+
return i ? (s.value.push(i), Object.assign(e, {
|
|
93
|
+
slots: {
|
|
94
|
+
...e.slots,
|
|
95
|
+
valid: i
|
|
96
|
+
}
|
|
97
|
+
})) : e;
|
|
98
|
+
}
|
|
99
|
+
return e;
|
|
100
|
+
}
|
|
101
|
+
function he(e) {
|
|
102
|
+
const u = document.getElementsByTagName("body")[0], t = window.getComputedStyle(u).fontFamily;
|
|
103
|
+
return e.minWidth = e.minWidth === "auto" ? (G(e.title, "12px", t) + 60).toFixed(0) : e.minWidth, e;
|
|
104
|
+
}
|
|
105
|
+
function fe({
|
|
106
|
+
propsRef: e,
|
|
107
|
+
item: s,
|
|
108
|
+
validSolts: u,
|
|
109
|
+
titleSolts: t,
|
|
110
|
+
validRulesKeys: i
|
|
111
|
+
// httpFieldSolts,
|
|
112
|
+
// httpFieldEditSolts,
|
|
113
|
+
}) {
|
|
114
|
+
var g;
|
|
115
|
+
const { columnsFieldSort: h, columnsFieldNoSort: b, isCellSort: W, isCellResize: C, customizeColumn: a } = n(e);
|
|
116
|
+
let v = W;
|
|
117
|
+
h.length > 0 && (v = h.includes(s.field)), b.length > 0 && (v = !b.includes(s.field));
|
|
118
|
+
let r = {
|
|
119
|
+
minWidth: 140,
|
|
120
|
+
sortable: v,
|
|
121
|
+
resizable: C,
|
|
122
|
+
...s
|
|
123
|
+
};
|
|
124
|
+
const m = a || ((g = R.table) == null ? void 0 : g.customizeColumn);
|
|
125
|
+
return m && te(m) && (r = m(r)), r = re(r, t), r = ae(r, u, i), r = he(r), r;
|
|
126
|
+
}
|
|
127
|
+
function xe(e, {
|
|
128
|
+
xGrid: s,
|
|
129
|
+
tableWidth: u
|
|
130
|
+
}, t) {
|
|
131
|
+
const i = x([]), h = x([]), b = x([]), W = x([]), C = x([]), a = x([]), v = le(!0), r = x(!1);
|
|
132
|
+
let m = null, g = [];
|
|
133
|
+
function j(o) {
|
|
134
|
+
var c;
|
|
135
|
+
const l = { ...o };
|
|
136
|
+
return (c = l.children) != null && c.length && (l.children = l.children.map((z) => j(z))), fe({
|
|
137
|
+
propsRef: e,
|
|
138
|
+
item: l,
|
|
139
|
+
titleSolts: h,
|
|
140
|
+
validSolts: b,
|
|
141
|
+
validRulesKeys: W
|
|
142
|
+
// httpFieldSolts,
|
|
143
|
+
// httpFieldEditSolts,
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
const q = T(() => {
|
|
147
|
+
const o = S(n(i));
|
|
148
|
+
return o ? o.map((c) => j(c)) : [];
|
|
149
|
+
}), H = () => ({
|
|
150
|
+
leftColumn: n(C),
|
|
151
|
+
actionColumn: n(a)
|
|
152
|
+
});
|
|
153
|
+
function D(o) {
|
|
154
|
+
const l = S(o);
|
|
155
|
+
if (ne(l)) {
|
|
156
|
+
if (l.length <= 0) {
|
|
157
|
+
i.value = [];
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
i.value = g = l;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
function $() {
|
|
164
|
+
return g;
|
|
165
|
+
}
|
|
166
|
+
function N(o) {
|
|
167
|
+
ue(() => {
|
|
168
|
+
const l = n(s);
|
|
169
|
+
l && l.reloadColumn(ee(o));
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
function V(o) {
|
|
173
|
+
m || (m = n(s).$el.querySelector(".vxe-table--scroll-y-virtual"));
|
|
174
|
+
const l = [...n(C), ...n(a)], { column: c } = o, { tableColumn: z } = n(s).getTableColumn(), w = L(
|
|
175
|
+
z.filter((d) => !l.map((f) => (f == null ? void 0 : f.type) || f.field).includes((d == null ? void 0 : d.type) || d.field))
|
|
176
|
+
), F = l.reduce((d, f) => d + (f.width || 0), 0), I = (n(u) || 0) - F, A = w.filter((d) => d.field !== c.field).reduce((d, f) => d + Number(f.renderWidth), 0), p = I - A;
|
|
177
|
+
if (c.resizeWidth < p) {
|
|
178
|
+
const d = (m == null ? void 0 : m.offsetWidth) || 0;
|
|
179
|
+
c.resizeWidth = p - d, c.renderWidth = c.resizeWidth, n(s).setColumnWidth(w, c.resizeWidth), Y.warning("不能小于拖动的最小宽度,会导致表格右侧空白");
|
|
180
|
+
}
|
|
181
|
+
const k = w == null ? void 0 : w.find((d) => d.field === c.field);
|
|
182
|
+
k && (k.width = c.resizeWidth);
|
|
183
|
+
}
|
|
184
|
+
function J(o) {
|
|
185
|
+
V(o), t("resizable-change", o);
|
|
186
|
+
}
|
|
187
|
+
function K(o) {
|
|
188
|
+
V(o), t("column-resizable-change", o);
|
|
189
|
+
}
|
|
190
|
+
function Q(o) {
|
|
191
|
+
var _;
|
|
192
|
+
r.value = !0;
|
|
193
|
+
const l = [], { showAction: c, showCheckbox: z, showIndex: w, showRadio: F, showExpand: I } = n(e);
|
|
194
|
+
c && l.push("action"), z && l.push("checkbox"), w && l.push("seq"), F && l.push("radio"), I && l.push("expand");
|
|
195
|
+
const { collectColumn: A } = ((_ = o.$grid) == null ? void 0 : _.getTableColumn()) || { collectColumn: [] }, p = A.filter((P) => !l.includes(P.field) && !l.includes(P.type)), k = $();
|
|
196
|
+
function d(P, X) {
|
|
197
|
+
const M = [];
|
|
198
|
+
return P.forEach((O) => {
|
|
199
|
+
const y = X.find((Z) => Z.field === O.field);
|
|
200
|
+
y && (O.children && y.children && (y.children = d(O.children, y.children)), M.push(y));
|
|
201
|
+
}), M;
|
|
202
|
+
}
|
|
203
|
+
const f = d(p, k);
|
|
204
|
+
D(f), t("column-dragend", o);
|
|
205
|
+
}
|
|
206
|
+
return E(
|
|
207
|
+
T(() => oe(n(e).columns)),
|
|
208
|
+
(o, l) => {
|
|
209
|
+
if (!U(o, l)) {
|
|
210
|
+
const c = S(o || []);
|
|
211
|
+
i.value = g = c || [];
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
deep: !0,
|
|
216
|
+
immediate: !0
|
|
217
|
+
}
|
|
218
|
+
), E(
|
|
219
|
+
() => [C.value, q.value, a.value],
|
|
220
|
+
(o, l) => {
|
|
221
|
+
if (n(r))
|
|
222
|
+
return r.value = !1, !1;
|
|
223
|
+
v.value && (N(o), v.value = !1), U(o, l) || N(o);
|
|
224
|
+
},
|
|
225
|
+
{ deep: !0 }
|
|
226
|
+
), ie(() => {
|
|
227
|
+
n(e).editRules && (W.value = Object.keys(n(e).editRules));
|
|
228
|
+
}), E(
|
|
229
|
+
T(() => [
|
|
230
|
+
n(e).showCheckbox,
|
|
231
|
+
n(e).showRadio,
|
|
232
|
+
n(e).showIndex,
|
|
233
|
+
n(e).showExpand,
|
|
234
|
+
n(e).indexColumnProps,
|
|
235
|
+
n(e).checkboxColumnProps,
|
|
236
|
+
n(e).radioColumnProps,
|
|
237
|
+
n(e).expandColumnProps,
|
|
238
|
+
n(e).isI18n
|
|
239
|
+
]),
|
|
240
|
+
() => {
|
|
241
|
+
C.value = ce(e);
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
immediate: !0
|
|
245
|
+
}
|
|
246
|
+
), E(
|
|
247
|
+
T(() => [
|
|
248
|
+
n(e).showAction,
|
|
249
|
+
n(e).actionProps,
|
|
250
|
+
n(e).actionWidth,
|
|
251
|
+
n(e).isI18n
|
|
252
|
+
]),
|
|
253
|
+
() => {
|
|
254
|
+
a.value = de(e);
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
immediate: !0
|
|
258
|
+
}
|
|
259
|
+
), se(() => {
|
|
260
|
+
g = [];
|
|
261
|
+
}), {
|
|
262
|
+
getColumnsRef: q,
|
|
263
|
+
getFixedColums: H,
|
|
264
|
+
titleSolts: h,
|
|
265
|
+
validSolts: b,
|
|
266
|
+
setTableColumns: D,
|
|
267
|
+
getTableColumns: $,
|
|
268
|
+
onResizableChange: B(J, 100),
|
|
269
|
+
onColumnResizableChange: B(K, 100),
|
|
270
|
+
onColumnDragend: Q
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
export {
|
|
274
|
+
xe as useColumns
|
|
275
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { GlobalConfig as f } from "../../../../hooks/useSetup.js";
|
|
2
|
+
import { isFunction as d } from "@dazhicheng/utils";
|
|
3
|
+
import { ref as j, toValue as c, unref as S } from "vue";
|
|
4
|
+
function N({
|
|
5
|
+
getTableProps: C,
|
|
6
|
+
tableMethods: v,
|
|
7
|
+
getProps: I
|
|
8
|
+
}) {
|
|
9
|
+
const l = j(), w = (o) => d(o) ? o() : o ?? "";
|
|
10
|
+
return {
|
|
11
|
+
initCustomSetting: async () => {
|
|
12
|
+
var y, A, K, i, O, h;
|
|
13
|
+
const o = v.getTableColumns(), { columns: s, columnsKey: r, defaultDisplayFields: t } = S(C), u = w(r), e = (y = c(s)) != null && y.length ? c(s) : o;
|
|
14
|
+
if (!((K = (A = c(I)) == null ? void 0 : A.table) != null && K.useHttpCache) || !u || !f.userId)
|
|
15
|
+
return;
|
|
16
|
+
const n = (h = (await ((O = (i = C.value) == null ? void 0 : i.getColumnsApi) == null ? void 0 : O.call(i, {
|
|
17
|
+
permissionOnlyCode: u,
|
|
18
|
+
userId: f.userId
|
|
19
|
+
}))).records) == null ? void 0 : h[0];
|
|
20
|
+
let p = [];
|
|
21
|
+
if (!(n != null && n.json))
|
|
22
|
+
p = t != null && t.length ? e == null ? void 0 : e.filter((a) => t.includes(a.field)) : e;
|
|
23
|
+
else {
|
|
24
|
+
const a = JSON.parse(n == null ? void 0 : n.json), g = new Map((e == null ? void 0 : e.map((m) => [m.field, m])) ?? []);
|
|
25
|
+
p = a.map((m) => g.get(m)).filter(Boolean);
|
|
26
|
+
}
|
|
27
|
+
l.value = n == null ? void 0 : n.id, v.setTableColumns(p);
|
|
28
|
+
},
|
|
29
|
+
saveColumns: async (o) => {
|
|
30
|
+
var t, u;
|
|
31
|
+
const s = (t = c(I)) == null ? void 0 : t.table, r = {
|
|
32
|
+
userId: f.userId,
|
|
33
|
+
permissionOnlyCode: w((u = S(C)) == null ? void 0 : u.columnsKey)
|
|
34
|
+
};
|
|
35
|
+
if (l.value && d(s == null ? void 0 : s.updateColumnsApi))
|
|
36
|
+
return await s.updateColumnsApi({
|
|
37
|
+
id: l.value,
|
|
38
|
+
json: o,
|
|
39
|
+
...r
|
|
40
|
+
});
|
|
41
|
+
if (d(s == null ? void 0 : s.setColumnsApi)) {
|
|
42
|
+
const e = await s.setColumnsApi({
|
|
43
|
+
...r,
|
|
44
|
+
json: o
|
|
45
|
+
});
|
|
46
|
+
return l.value = e, e;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
export {
|
|
52
|
+
N as useCustomColumns
|
|
53
|
+
};
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { GlobalConfig as E } from "../../../../hooks/useSetup.js";
|
|
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 "../../../../hooks/useSetup.js";
|
|
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
|
+
};
|