@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,233 @@
|
|
|
1
|
+
import { defineComponent as X, ref as T, reactive as Y, computed as C, watch as S, createBlock as E, openBlock as m, unref as n, normalizeClass as b, withCtx as c, createElementVNode as d, createVNode as a, toDisplayString as h, createElementBlock as v, Fragment as M, renderList as V, createTextVNode as _, createCommentVNode as Z, withModifiers as ee } from "vue";
|
|
2
|
+
import le from "@/assets/svg/close.svg?raw";
|
|
3
|
+
import te from "@/assets/svg/drag.svg?raw";
|
|
4
|
+
import { TtIcon as B } from "@dazhicheng-ui/components/tt-icon";
|
|
5
|
+
import { TtText as oe } from "@dazhicheng-ui/components/tt-text";
|
|
6
|
+
import { useModalRender as ne } from "@dazhicheng-ui/components/tt-modal";
|
|
7
|
+
import { TtButton as se } from "@dazhicheng-ui/components/tt-button";
|
|
8
|
+
import { useDesign as ie } from "@dazhicheng/hooks";
|
|
9
|
+
import { ElScrollbar as $, ElCheckbox as I, ElCheckboxGroup as de, ElTooltip as ce } from "element-plus";
|
|
10
|
+
import { cloneDeep as ae } from "lodash-es";
|
|
11
|
+
import re from "sortablejs";
|
|
12
|
+
const ue = { class: "flex-1" }, me = { class: "cb flex items-center" }, fe = { class: "text-[var(--el-text-color-primary)] font-bold" }, pe = { class: "flex flex-col w-[200px] shrink-0" }, he = { class: "flex items-center justify-between px-15px pt-12px pb-6px text-xs text-[var(--el-text-color-regular)]" }, xe = { class: "flex items-center text-xs" }, Ce = ["onClick"], be = { class: "text-left" }, Ve = /* @__PURE__ */ X({
|
|
13
|
+
__name: "TableColumnModal",
|
|
14
|
+
props: {
|
|
15
|
+
openColumn: { type: Function },
|
|
16
|
+
openExport: { type: Function }
|
|
17
|
+
},
|
|
18
|
+
emits: ["on-submit"],
|
|
19
|
+
setup(R, { expose: A, emit: N }) {
|
|
20
|
+
const r = R, j = N, { prefixCls: u } = ie("table-column-modal"), F = T(), [z, x] = ne(), k = T(!1), l = Y({
|
|
21
|
+
allColumns: [],
|
|
22
|
+
checkedFields: [],
|
|
23
|
+
selectedColumns: [],
|
|
24
|
+
disabledColumnField: []
|
|
25
|
+
});
|
|
26
|
+
let f = null, g = null;
|
|
27
|
+
const p = C(() => l.allColumns.filter((e) => e.field)), D = C(() => p.value.filter((e) => !e.disabled)), O = C(() => {
|
|
28
|
+
const e = D.value.length;
|
|
29
|
+
return e === 0 ? !0 : l.checkedFields.filter((t) => !l.disabledColumnField.includes(t)).length === e;
|
|
30
|
+
}), P = C(() => {
|
|
31
|
+
const e = [.../* @__PURE__ */ new Set([...l.checkedFields, ...l.disabledColumnField])];
|
|
32
|
+
return e.length > 0 && e.length < p.value.length;
|
|
33
|
+
});
|
|
34
|
+
function q(e) {
|
|
35
|
+
const o = p.value;
|
|
36
|
+
l.checkedFields = e ? o.map((t) => t.field) : o.filter((t) => l.disabledColumnField.includes(t.field)).map((t) => t.field);
|
|
37
|
+
}
|
|
38
|
+
function G(e) {
|
|
39
|
+
l.checkedFields = l.checkedFields.filter((o) => o !== e);
|
|
40
|
+
}
|
|
41
|
+
function L() {
|
|
42
|
+
l.checkedFields = l.checkedFields.filter((e) => l.disabledColumnField.includes(e));
|
|
43
|
+
}
|
|
44
|
+
const y = () => {
|
|
45
|
+
j("on-submit", {
|
|
46
|
+
checkedModel: [...l.selectedColumns.map((e) => e.field)],
|
|
47
|
+
modalApi: x,
|
|
48
|
+
isExport: k.value
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
function U({ columns: e, displayFields: o = [], disabledColumnField: t, isExport: s }) {
|
|
52
|
+
k.value = s ?? !1, x.openModal();
|
|
53
|
+
const K = ae(e).filter((i) => i.field);
|
|
54
|
+
l.disabledColumnField = t, l.allColumns = K.map((i) => ({ ...i, disabled: t.includes(i.field) }));
|
|
55
|
+
const Q = new Set(l.allColumns.map((i) => i.field)), w = o.filter((i) => i && Q.has(i));
|
|
56
|
+
l.checkedFields = [...w], l.selectedColumns = w.map((i) => l.allColumns.find((W) => W.field === i)).filter(Boolean), g = setTimeout(H, 100);
|
|
57
|
+
}
|
|
58
|
+
function H() {
|
|
59
|
+
var o;
|
|
60
|
+
const e = (o = n(F)) == null ? void 0 : o.querySelector(`.${u}-move-box`);
|
|
61
|
+
e && (f = re.create(e, {
|
|
62
|
+
animation: 300,
|
|
63
|
+
handle: `.${u}-item-move:not(.is-disabled)`,
|
|
64
|
+
onStart: (t) => t.item.style.opacity = "0",
|
|
65
|
+
onEnd(t) {
|
|
66
|
+
if (t.oldIndex == null || t.newIndex == null) return;
|
|
67
|
+
const [s] = l.selectedColumns.splice(t.oldIndex, 1);
|
|
68
|
+
l.selectedColumns.splice(t.newIndex, 0, s), t.item.style.opacity = "1";
|
|
69
|
+
}
|
|
70
|
+
}));
|
|
71
|
+
}
|
|
72
|
+
S(
|
|
73
|
+
() => l.checkedFields,
|
|
74
|
+
(e) => {
|
|
75
|
+
const o = new Set(e);
|
|
76
|
+
l.selectedColumns = l.selectedColumns.filter((s) => o.has(s.field || ""));
|
|
77
|
+
const t = new Set(l.selectedColumns.map((s) => s.field || ""));
|
|
78
|
+
l.selectedColumns.push(
|
|
79
|
+
...l.allColumns.filter((s) => o.has(s.field || "") && !t.has(s.field || ""))
|
|
80
|
+
);
|
|
81
|
+
},
|
|
82
|
+
{ deep: !0 }
|
|
83
|
+
), S(
|
|
84
|
+
() => {
|
|
85
|
+
var e;
|
|
86
|
+
return (e = x.getVisible) == null ? void 0 : e.value;
|
|
87
|
+
},
|
|
88
|
+
(e) => {
|
|
89
|
+
e || (g && clearTimeout(g), f == null || f.destroy(), f = null, Object.assign(l, { allColumns: [], checkedFields: [], selectedColumns: [] }));
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
function J() {
|
|
93
|
+
var e, o;
|
|
94
|
+
k.value ? (e = r.openExport) == null || e.call(r, !0) : (o = r.openColumn) == null || o.call(r, !0);
|
|
95
|
+
}
|
|
96
|
+
return A({
|
|
97
|
+
handleSubmit: y,
|
|
98
|
+
openModal: U,
|
|
99
|
+
setModalProps(e) {
|
|
100
|
+
x.setModalProps(e);
|
|
101
|
+
}
|
|
102
|
+
}), (e, o) => (m(), E(n(z), {
|
|
103
|
+
width: "720",
|
|
104
|
+
class: b(n(u)),
|
|
105
|
+
onOk: y
|
|
106
|
+
}, {
|
|
107
|
+
beforeFooter: c(() => [
|
|
108
|
+
d("div", be, [
|
|
109
|
+
a(n(se), { onClick: J }, {
|
|
110
|
+
default: c(() => [...o[1] || (o[1] = [
|
|
111
|
+
_("重置", -1)
|
|
112
|
+
])]),
|
|
113
|
+
_: 1
|
|
114
|
+
})
|
|
115
|
+
])
|
|
116
|
+
]),
|
|
117
|
+
default: c(() => [
|
|
118
|
+
d("div", {
|
|
119
|
+
ref_key: "contentRef",
|
|
120
|
+
ref: F,
|
|
121
|
+
class: "flex h-[400px]"
|
|
122
|
+
}, [
|
|
123
|
+
d("div", ue, [
|
|
124
|
+
a(n($), { class: "h-full px-24px py-12px" }, {
|
|
125
|
+
default: c(() => [
|
|
126
|
+
d("div", me, [
|
|
127
|
+
a(n(I), {
|
|
128
|
+
"model-value": O.value,
|
|
129
|
+
class: "checkbox-all",
|
|
130
|
+
indeterminate: P.value,
|
|
131
|
+
onChange: q
|
|
132
|
+
}, {
|
|
133
|
+
default: c(() => [
|
|
134
|
+
d("span", fe, " 全部(" + h(l.checkedFields.length) + "/" + h(p.value.length) + ") ", 1)
|
|
135
|
+
]),
|
|
136
|
+
_: 1
|
|
137
|
+
}, 8, ["model-value", "indeterminate"])
|
|
138
|
+
]),
|
|
139
|
+
a(n(de), {
|
|
140
|
+
modelValue: l.checkedFields,
|
|
141
|
+
"onUpdate:modelValue": o[0] || (o[0] = (t) => l.checkedFields = t),
|
|
142
|
+
class: "mb-10px w-full"
|
|
143
|
+
}, {
|
|
144
|
+
default: c(() => [
|
|
145
|
+
(m(!0), v(M, null, V(p.value, (t) => (m(), E(n(I), {
|
|
146
|
+
key: t.field,
|
|
147
|
+
value: t.field,
|
|
148
|
+
disabled: t.disabled
|
|
149
|
+
}, {
|
|
150
|
+
default: c(() => [
|
|
151
|
+
a(n(ce), {
|
|
152
|
+
"show-after": 400,
|
|
153
|
+
content: t.title || "",
|
|
154
|
+
placement: "top"
|
|
155
|
+
}, {
|
|
156
|
+
default: c(() => [
|
|
157
|
+
_(h(t.title || ""), 1)
|
|
158
|
+
]),
|
|
159
|
+
_: 2
|
|
160
|
+
}, 1032, ["content"])
|
|
161
|
+
]),
|
|
162
|
+
_: 2
|
|
163
|
+
}, 1032, ["value", "disabled"]))), 128))
|
|
164
|
+
]),
|
|
165
|
+
_: 1
|
|
166
|
+
}, 8, ["modelValue"])
|
|
167
|
+
]),
|
|
168
|
+
_: 1
|
|
169
|
+
})
|
|
170
|
+
]),
|
|
171
|
+
d("div", pe, [
|
|
172
|
+
d("div", he, [
|
|
173
|
+
d("span", null, "已选 " + h(l.selectedColumns.length) + " 列", 1),
|
|
174
|
+
d("span", {
|
|
175
|
+
class: "cursor-pointer text-(--el-color-primary)",
|
|
176
|
+
onClick: L
|
|
177
|
+
}, "清空")
|
|
178
|
+
]),
|
|
179
|
+
a(n($), { class: "flex-1" }, {
|
|
180
|
+
default: c(() => [
|
|
181
|
+
d("div", {
|
|
182
|
+
class: b([`${n(u)}-move-box`, "px-7px"])
|
|
183
|
+
}, [
|
|
184
|
+
(m(!0), v(M, null, V(l.selectedColumns, (t) => (m(), v("div", {
|
|
185
|
+
key: t.field,
|
|
186
|
+
class: b([
|
|
187
|
+
`${n(u)}-item-move`,
|
|
188
|
+
"flex h-36px items-center justify-between pr-12px py-2 cursor-pointer"
|
|
189
|
+
])
|
|
190
|
+
}, [
|
|
191
|
+
d("div", xe, [
|
|
192
|
+
a(n(B), {
|
|
193
|
+
class: "shrink-0 text-[var(--el-text-color-secondary)]",
|
|
194
|
+
size: 14,
|
|
195
|
+
icon: n(te),
|
|
196
|
+
"is-custom-svg": ""
|
|
197
|
+
}, null, 8, ["icon"]),
|
|
198
|
+
a(n(oe), {
|
|
199
|
+
"tool-tip": !1,
|
|
200
|
+
class: "ml-1"
|
|
201
|
+
}, {
|
|
202
|
+
default: c(() => [
|
|
203
|
+
_(h(t.title || ""), 1)
|
|
204
|
+
]),
|
|
205
|
+
_: 2
|
|
206
|
+
}, 1024)
|
|
207
|
+
]),
|
|
208
|
+
l.disabledColumnField.includes(t.field) ? Z("", !0) : (m(), v("span", {
|
|
209
|
+
key: 0,
|
|
210
|
+
class: b(`${n(u)}-action-btn`),
|
|
211
|
+
onClick: ee((s) => G(t.field), ["stop"])
|
|
212
|
+
}, [
|
|
213
|
+
a(n(B), {
|
|
214
|
+
class: "text-[var(--el-text-color-secondary)]",
|
|
215
|
+
size: 12,
|
|
216
|
+
"icon-font": n(le)
|
|
217
|
+
}, null, 8, ["icon-font"])
|
|
218
|
+
], 10, Ce))
|
|
219
|
+
], 2))), 128))
|
|
220
|
+
], 2)
|
|
221
|
+
]),
|
|
222
|
+
_: 1
|
|
223
|
+
})
|
|
224
|
+
])
|
|
225
|
+
], 512)
|
|
226
|
+
]),
|
|
227
|
+
_: 1
|
|
228
|
+
}, 8, ["class"]));
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
export {
|
|
232
|
+
Ve as default
|
|
233
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { defineComponent as w, inject as E, computed as i, unref as n, ref as x, createElementBlock as a, openBlock as t, createBlock as d, createCommentVNode as f, withCtx as p, renderSlot as u, Fragment as h, renderList as I, createElementVNode as $, createVNode as y } from "vue";
|
|
2
|
+
import { TtIcon as A } from "@dazhicheng-ui/components/tt-icon";
|
|
3
|
+
import { generateTestId as B } from "@dazhicheng/utils";
|
|
4
|
+
import { ElSpace as N, ElTooltip as V } from "element-plus";
|
|
5
|
+
import { toolProps as z } from "../toolProps.js";
|
|
6
|
+
import R from "@/assets/svg/RiRefreshLine.svg?raw";
|
|
7
|
+
import j from "@/assets/svg/exportSvg.svg?raw";
|
|
8
|
+
import F from "@/assets/svg/columnSet.svg?raw";
|
|
9
|
+
const L = ["data-testid"], P = ["onClick", "onAnimationend"], Q = /* @__PURE__ */ w({
|
|
10
|
+
__name: "TableToobalTools",
|
|
11
|
+
props: z,
|
|
12
|
+
emits: ["on-refresh", "on-columns-setting", "on-export"],
|
|
13
|
+
setup(b, { emit: k }) {
|
|
14
|
+
const r = b, l = k, v = E(
|
|
15
|
+
"tableIdContext",
|
|
16
|
+
i(() => "")
|
|
17
|
+
), _ = i(() => B(n(v), "table-toolbar-tools")), c = x(/* @__PURE__ */ new Set());
|
|
18
|
+
function g(e, m) {
|
|
19
|
+
c.value.add(e), m();
|
|
20
|
+
}
|
|
21
|
+
function C(e) {
|
|
22
|
+
c.value.delete(e);
|
|
23
|
+
}
|
|
24
|
+
const S = i(() => [
|
|
25
|
+
{
|
|
26
|
+
label: "自定义导出",
|
|
27
|
+
icon: j,
|
|
28
|
+
handler: () => l("on-export"),
|
|
29
|
+
if: r.showExport
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
label: "刷新",
|
|
33
|
+
icon: R,
|
|
34
|
+
handler: () => l("on-refresh"),
|
|
35
|
+
if: r.showRefresh
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
label: "列设置",
|
|
39
|
+
icon: F,
|
|
40
|
+
handler: () => l("on-columns-setting"),
|
|
41
|
+
if: r.showSetColumn
|
|
42
|
+
}
|
|
43
|
+
]);
|
|
44
|
+
return (e, m) => (t(), a("div", { "data-testid": _.value }, [
|
|
45
|
+
e.showSetting ? (t(), d(n(N), {
|
|
46
|
+
key: 0,
|
|
47
|
+
size: 12
|
|
48
|
+
}, {
|
|
49
|
+
default: p(() => [
|
|
50
|
+
u(e.$slots, "toolbar-left"),
|
|
51
|
+
(t(!0), a(h, null, I(S.value, (o, s) => (t(), a(h, { key: s }, [
|
|
52
|
+
o.if ? (t(), d(n(V), {
|
|
53
|
+
key: 0,
|
|
54
|
+
ref_for: !0,
|
|
55
|
+
ref: "tooltipRef",
|
|
56
|
+
class: "box-item",
|
|
57
|
+
effect: "dark",
|
|
58
|
+
content: o.label,
|
|
59
|
+
placement: "top",
|
|
60
|
+
"show-after": 200
|
|
61
|
+
}, {
|
|
62
|
+
default: p(() => [
|
|
63
|
+
$("div", {
|
|
64
|
+
class: "icon-table-btn",
|
|
65
|
+
onClick: (T) => g(s, o.handler),
|
|
66
|
+
onAnimationend: (T) => C(s)
|
|
67
|
+
}, [
|
|
68
|
+
y(n(A), {
|
|
69
|
+
icon: o.icon,
|
|
70
|
+
size: 14,
|
|
71
|
+
"is-custom-svg": ""
|
|
72
|
+
}, null, 8, ["icon"])
|
|
73
|
+
], 40, P)
|
|
74
|
+
]),
|
|
75
|
+
_: 2
|
|
76
|
+
}, 1032, ["content"])) : f("", !0)
|
|
77
|
+
], 64))), 128)),
|
|
78
|
+
u(e.$slots, "toolbar-right")
|
|
79
|
+
]),
|
|
80
|
+
_: 3
|
|
81
|
+
})) : f("", !0)
|
|
82
|
+
], 8, L));
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
export {
|
|
86
|
+
Q as default
|
|
87
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { tableEmits as e } from "vxe-table/es/table/src/emits";
|
|
2
|
+
const c = [
|
|
3
|
+
...e,
|
|
4
|
+
"fetch-success",
|
|
5
|
+
"fetch-error",
|
|
6
|
+
"selection-change",
|
|
7
|
+
"dynamic-change",
|
|
8
|
+
"row-dragend",
|
|
9
|
+
"page-change",
|
|
10
|
+
"load-data"
|
|
11
|
+
// 缺少的在这里添加
|
|
12
|
+
];
|
|
13
|
+
export {
|
|
14
|
+
c as basicTableEmits
|
|
15
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { GlobalConfig as t } from "@dazhicheng-ui/hooks/useSetup";
|
|
2
|
+
import { unref as c } from "vue";
|
|
3
|
+
function h(o, i, C, n) {
|
|
4
|
+
return {
|
|
5
|
+
onCellAreaSelectionEnd: function(e) {
|
|
6
|
+
var l, r;
|
|
7
|
+
(l = c(o).checkboxConfig) != null && l.range && c(o).showCheckbox ? n.onCheckboxRangeChange({
|
|
8
|
+
records: e.rows
|
|
9
|
+
}) : (r = t.table) != null && r.isAreaCheckboxSelection && n.onCellAreaSelectionEndSetCheckbox(e), i("cell-area-selection-end", e);
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
h as useCellArea
|
|
15
|
+
};
|
|
@@ -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 "@dazhicheng-ui/hooks/useSetup";
|
|
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 "@dazhicheng-ui/hooks/useSetup";
|
|
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
|
+
};
|