@dazhicheng/ui 1.5.198 → 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 +5 -3
- package/dist/index-NG5FNCLD.js +0 -3430
- package/dist/index.modern-4Cf3dcJP.js +0 -3069
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
import { defineComponent as We, useTemplateRef as S, ref as v, shallowRef as we, computed as E, unref as d, nextTick as He, watch as U, createBlock as w, openBlock as r, mergeProps as Me, withCtx as O, createElementVNode as u, createVNode as N, createElementBlock as h, createCommentVNode as Y, Fragment as H, renderList as $, normalizeStyle as j, createTextVNode as ze, toDisplayString as J, renderSlot as K, withModifiers as Ve, normalizeClass as Q } from "vue";
|
|
2
|
+
import { calc as I } from "@dazhicheng/utils";
|
|
3
|
+
import { useDesign as Be } from "@dazhicheng/hooks";
|
|
4
|
+
import { ElCheckbox as Z, ElTooltip as Pe } from "element-plus";
|
|
5
|
+
import Se from "@dazhicheng-ui/components/tt-empty";
|
|
6
|
+
import { TtText as ee } from "@dazhicheng-ui/components/tt-text";
|
|
7
|
+
import { debounce as Ee, cloneDeep as Ne } from "lodash-es";
|
|
8
|
+
import { VxeList as $e } from "vxe-pc-ui";
|
|
9
|
+
import { GRID_MIN_HEIGHT as Ie, GRID_MAX_HEIGHT as Le } from "../const.js";
|
|
10
|
+
import { selectTableProps as Ae } from "../props.js";
|
|
11
|
+
const Ge = { class: "vxe-table--render-default size--mini border--default" }, Xe = { ref: "table" }, Fe = { key: 0 }, qe = { class: "vxe-header--row" }, Ue = { class: "vxe-cell" }, Oe = ["onMousedown"], Ye = {
|
|
12
|
+
key: 0,
|
|
13
|
+
class: "vxe-empty--content"
|
|
14
|
+
}, je = ["onClick", "onMouseenter"], Je = { class: "vxe-cell" }, Ke = {
|
|
15
|
+
key: 1,
|
|
16
|
+
class: "vxe-body--column is--padding col--ellipsis"
|
|
17
|
+
}, Qe = { class: "vxe-cell" }, ct = /* @__PURE__ */ We({
|
|
18
|
+
name: "TtSelectTable",
|
|
19
|
+
__name: "Table",
|
|
20
|
+
props: Ae,
|
|
21
|
+
emits: ["radio-change", "checkbox-change", "scroll", "checkbox-all"],
|
|
22
|
+
setup(te, { expose: le, emit: ne }) {
|
|
23
|
+
const n = te, b = ne, { prefixCls: oe } = Be("select-table"), L = S("vxelist"), ie = S("table"), se = S("resizableBar"), M = v(!1), z = we(), V = v(""), x = v(!1);
|
|
24
|
+
let f = null;
|
|
25
|
+
const k = v([]), y = v(!1), C = E(() => {
|
|
26
|
+
var e, l;
|
|
27
|
+
return {
|
|
28
|
+
maxHeight: Le,
|
|
29
|
+
minHeight: Ie,
|
|
30
|
+
showHeader: ((e = n.grid) == null ? void 0 : e.showHeader) !== void 0 ? n.grid.showHeader : ((l = d(T)) == null ? void 0 : l.length) > 1 && !!n.list.length,
|
|
31
|
+
virtualYConfig: {
|
|
32
|
+
enabled: !0,
|
|
33
|
+
gt: 30,
|
|
34
|
+
sItem: ".vxe-body--row",
|
|
35
|
+
oSize: 5
|
|
36
|
+
},
|
|
37
|
+
size: "mini",
|
|
38
|
+
autoResize: !1,
|
|
39
|
+
loading: n.loading,
|
|
40
|
+
data: n.list
|
|
41
|
+
};
|
|
42
|
+
}), R = E(() => n.list.filter((e) => e.checked)), T = E(() => {
|
|
43
|
+
var l, o, t, s;
|
|
44
|
+
return (o = (l = n.grid) == null ? void 0 : l.columns) != null && o.length ? (t = n.grid) == null ? void 0 : t.columns : [{ title: "label", field: ((s = n.configProps) == null ? void 0 : s.labelField) ?? "label" }];
|
|
45
|
+
});
|
|
46
|
+
function ae(e, l) {
|
|
47
|
+
e.stopPropagation(), e.preventDefault(), M.value = !0;
|
|
48
|
+
const { clientX: o } = e, t = e.target, s = t.parentNode, c = ie.value, i = t.getBoundingClientRect(), a = c == null ? void 0 : c.getBoundingClientRect(), g = t.clientWidth, _ = Math.floor(g / 2), m = I(i.x).sub((a == null ? void 0 : a.x) || 0).add(_).toNumber();
|
|
49
|
+
let D = 0, W = s.clientWidth;
|
|
50
|
+
const Re = I(m).sub(W).add(l.minWidth || 50).toNumber(), p = se.value;
|
|
51
|
+
if (!p) return;
|
|
52
|
+
p.style.left = `${m}px`, p.style.zIndex = "9999";
|
|
53
|
+
const Te = p.querySelector(".vxe-table--resizable-number-tip");
|
|
54
|
+
F(), document.onmousemove = _e, document.onmouseup = function() {
|
|
55
|
+
document.onmousemove = null, document.onmouseup = null, M.value = !1, l.style.width = `${W}px`;
|
|
56
|
+
};
|
|
57
|
+
function _e(P) {
|
|
58
|
+
P.stopPropagation(), P.preventDefault();
|
|
59
|
+
const q = P.clientX - o, De = m + q;
|
|
60
|
+
D = Math.max(De, Re), p && (p.style.left = `${D}px`, W = Math.max(I(s.clientWidth).add(q).toNumber(), l.minWidth), F());
|
|
61
|
+
}
|
|
62
|
+
function F() {
|
|
63
|
+
Te.textContent = `宽:${W}像素`;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function re(e) {
|
|
67
|
+
b("checkbox-all", { checked: e });
|
|
68
|
+
}
|
|
69
|
+
function ce(e) {
|
|
70
|
+
var l;
|
|
71
|
+
e.disabled || e.isDelete || (B(), e.isCurrent = !0, e.checked = !e.checked, n.multiple ? b("checkbox-change", { checked: e.checked, row: e }) : b("radio-change", { oldValue: (l = R.value) == null ? void 0 : l[0], row: e }));
|
|
72
|
+
}
|
|
73
|
+
function de(e, l) {
|
|
74
|
+
if (!l.disabled && !l.isDelete) return;
|
|
75
|
+
const o = e.currentTarget;
|
|
76
|
+
if (!o) return;
|
|
77
|
+
const t = l.message;
|
|
78
|
+
t && (f && (clearTimeout(f), f = null), z.value = o, V.value = t, x.value = !0);
|
|
79
|
+
}
|
|
80
|
+
function ue() {
|
|
81
|
+
x.value = !1, f && clearTimeout(f), f = setTimeout(() => {
|
|
82
|
+
x.value || (z.value = void 0, V.value = ""), f = null;
|
|
83
|
+
}, 300);
|
|
84
|
+
}
|
|
85
|
+
function he(e, l) {
|
|
86
|
+
Array.isArray(e) ? e.forEach((o) => {
|
|
87
|
+
o.checked = l;
|
|
88
|
+
}) : e.checked = l;
|
|
89
|
+
}
|
|
90
|
+
function fe() {
|
|
91
|
+
n.list.forEach((e) => {
|
|
92
|
+
e.checked = !1;
|
|
93
|
+
}), y.value = !1;
|
|
94
|
+
}
|
|
95
|
+
function ge(e) {
|
|
96
|
+
e && (e.checked = !0);
|
|
97
|
+
}
|
|
98
|
+
function me() {
|
|
99
|
+
const e = n.list.find((l) => l.checked);
|
|
100
|
+
e && (e.checked = !1);
|
|
101
|
+
}
|
|
102
|
+
function A(e, l) {
|
|
103
|
+
var o;
|
|
104
|
+
(o = L.value) == null || o.scrollTo(e, l);
|
|
105
|
+
}
|
|
106
|
+
function pe() {
|
|
107
|
+
return n.list.find((e) => e.isCurrent);
|
|
108
|
+
}
|
|
109
|
+
function G(e) {
|
|
110
|
+
return n.list.findIndex((l) => l.value === (e == null ? void 0 : e.value));
|
|
111
|
+
}
|
|
112
|
+
function ve(e) {
|
|
113
|
+
var a, g;
|
|
114
|
+
const l = G(e), o = (a = L.value) == null ? void 0 : a.$el.querySelector(".vxe-list--virtual-wrapper"), t = o.clientHeight, s = (g = o.querySelector(".vxe-body--row")) == null ? void 0 : g.clientHeight, c = Math.floor(t / s - 2), i = (l - c) * s;
|
|
115
|
+
A(null, i);
|
|
116
|
+
}
|
|
117
|
+
function be(e) {
|
|
118
|
+
B(), e.isCurrent = !0;
|
|
119
|
+
}
|
|
120
|
+
function B() {
|
|
121
|
+
const e = n.list.find((l) => l.isCurrent);
|
|
122
|
+
e && (e.isCurrent = !1);
|
|
123
|
+
}
|
|
124
|
+
function xe(e) {
|
|
125
|
+
return e !== void 0 ? n.list[e] : n.list;
|
|
126
|
+
}
|
|
127
|
+
function ke() {
|
|
128
|
+
var o, t;
|
|
129
|
+
const e = n.selectWidth / ((o = d(T)) == null ? void 0 : o.length);
|
|
130
|
+
return ((t = d(T)) == null ? void 0 : t.length) * 130 < n.selectWidth ? e : 130;
|
|
131
|
+
}
|
|
132
|
+
function ye(e) {
|
|
133
|
+
const { scrollTop: l, $event: o } = e, t = o.target.scrollHeight;
|
|
134
|
+
l > 100 && l + C.value.maxHeight >= t && !n.loading && Ce(), b("scroll", e);
|
|
135
|
+
}
|
|
136
|
+
const Ce = Ee(() => {
|
|
137
|
+
const { total: e, currentPage: l = 0 } = n.getPagination();
|
|
138
|
+
(e && n.list.length < e || n.hasNextPage) && (n.setPagination({ currentPage: l + 1 }), He(() => {
|
|
139
|
+
n.reload();
|
|
140
|
+
}));
|
|
141
|
+
}, 200), X = {
|
|
142
|
+
clearCurrentRow: B,
|
|
143
|
+
setCheckboxRow: he,
|
|
144
|
+
clearCheckboxRow: fe,
|
|
145
|
+
setRadioRow: ge,
|
|
146
|
+
clearRadioRow: me,
|
|
147
|
+
scrollTo: A,
|
|
148
|
+
getCurrentRecord: pe,
|
|
149
|
+
getRowIndex: G,
|
|
150
|
+
scrollToRow: ve,
|
|
151
|
+
setCurrentRow: be,
|
|
152
|
+
getData: xe
|
|
153
|
+
};
|
|
154
|
+
return U(
|
|
155
|
+
() => n.grid.columns,
|
|
156
|
+
() => {
|
|
157
|
+
const e = d(T), l = Ne(e) || [];
|
|
158
|
+
n.multiple && n.showCheckbox && l.unshift({
|
|
159
|
+
width: 40,
|
|
160
|
+
type: "checkbox",
|
|
161
|
+
field: "checkbox"
|
|
162
|
+
});
|
|
163
|
+
const o = ke();
|
|
164
|
+
k.value = l.map((t) => {
|
|
165
|
+
const s = e.length <= 1 ? n.selectWidth : t.minWidth || t.width || o, c = e.length <= 1 ? n.selectWidth : t.width || o, i = t.type ? t.width : c, a = {};
|
|
166
|
+
return i && (a.width = `${i}px`), {
|
|
167
|
+
...t,
|
|
168
|
+
title: (t.title, t.title),
|
|
169
|
+
minWidth: s,
|
|
170
|
+
width: i,
|
|
171
|
+
style: a
|
|
172
|
+
};
|
|
173
|
+
});
|
|
174
|
+
},
|
|
175
|
+
{ immediate: !0 }
|
|
176
|
+
), U(
|
|
177
|
+
() => R.value,
|
|
178
|
+
(e) => {
|
|
179
|
+
y.value = e.length === n.list.length;
|
|
180
|
+
}
|
|
181
|
+
), le({
|
|
182
|
+
getGridInstance: () => X,
|
|
183
|
+
...X
|
|
184
|
+
}), (e, l) => (r(), w(d($e), Me({
|
|
185
|
+
ref: "vxelist",
|
|
186
|
+
style: { height: "auto", "max-height": "360px" },
|
|
187
|
+
class: {
|
|
188
|
+
[d(oe)]: !0,
|
|
189
|
+
"pt-5px": !C.value.showHeader,
|
|
190
|
+
"h-60px!": n.list.length === 0 && n.loading
|
|
191
|
+
}
|
|
192
|
+
}, C.value, { onScroll: ye }), {
|
|
193
|
+
default: O(({ items: o }) => [
|
|
194
|
+
u("div", Ge, [
|
|
195
|
+
u("table", Xe, [
|
|
196
|
+
C.value.showHeader ? (r(), h("thead", Fe, [
|
|
197
|
+
u("tr", qe, [
|
|
198
|
+
(r(!0), h(H, null, $(k.value, (t) => {
|
|
199
|
+
var s, c, i;
|
|
200
|
+
return r(), h("th", {
|
|
201
|
+
key: t.field,
|
|
202
|
+
class: "vxe-header--column fixed--width is--padding",
|
|
203
|
+
style: j(t.style)
|
|
204
|
+
}, [
|
|
205
|
+
u("div", Ue, [
|
|
206
|
+
t.type === "checkbox" ? (r(), w(d(Z), {
|
|
207
|
+
key: 0,
|
|
208
|
+
modelValue: y.value,
|
|
209
|
+
"onUpdate:modelValue": l[0] || (l[0] = (a) => y.value = a),
|
|
210
|
+
indeterminate: ((s = R.value) == null ? void 0 : s.length) > 0 && ((c = R.value) == null ? void 0 : c.length) < ((i = n.list) == null ? void 0 : i.length),
|
|
211
|
+
onChange: re
|
|
212
|
+
}, null, 8, ["modelValue", "indeterminate"])) : (r(), h(H, { key: 1 }, [
|
|
213
|
+
ze(J(t.title), 1)
|
|
214
|
+
], 64))
|
|
215
|
+
]),
|
|
216
|
+
u("div", {
|
|
217
|
+
class: "vxe-cell--col-resizable",
|
|
218
|
+
onMousedown: (a) => ae(a, t)
|
|
219
|
+
}, null, 40, Oe)
|
|
220
|
+
], 4);
|
|
221
|
+
}), 128))
|
|
222
|
+
])
|
|
223
|
+
])) : Y("", !0),
|
|
224
|
+
u("tbody", null, [
|
|
225
|
+
!e.loading && !o.length ? (r(), h("div", Ye, [
|
|
226
|
+
K(e.$slots, "empty", {}, () => [
|
|
227
|
+
N(d(Se))
|
|
228
|
+
])
|
|
229
|
+
])) : Y("", !0),
|
|
230
|
+
(r(!0), h(H, null, $(o, (t, s) => {
|
|
231
|
+
var c;
|
|
232
|
+
return r(), h("tr", {
|
|
233
|
+
key: t.value,
|
|
234
|
+
class: Q(["vxe-body--row", {
|
|
235
|
+
"is--selected": t.checked,
|
|
236
|
+
"is--disabled": t.disabled,
|
|
237
|
+
"is--current": t.isCurrent,
|
|
238
|
+
"is--delete": t.isDelete
|
|
239
|
+
}]),
|
|
240
|
+
onClick: Ve((i) => ce(t), ["prevent"]),
|
|
241
|
+
onMouseenter: (i) => de(i, t),
|
|
242
|
+
onMouseleave: ue
|
|
243
|
+
}, [
|
|
244
|
+
(c = k.value) != null && c.length ? (r(!0), h(H, { key: 0 }, $(k.value, (i, a) => {
|
|
245
|
+
var g, _, m;
|
|
246
|
+
return r(), h("td", {
|
|
247
|
+
key: i.field,
|
|
248
|
+
class: "is--padding vxe-body--column col--ellipsis",
|
|
249
|
+
style: j(i.style)
|
|
250
|
+
}, [
|
|
251
|
+
u("div", Je, [
|
|
252
|
+
(g = i.slots) != null && g.default ? K(e.$slots, (_ = i.slots) == null ? void 0 : _.default, {
|
|
253
|
+
key: 0,
|
|
254
|
+
item: { column: i, row: t.item, rowIndex: s, columnIndex: a }
|
|
255
|
+
}) : i.type === "checkbox" ? (r(), w(d(Z), {
|
|
256
|
+
key: 1,
|
|
257
|
+
modelValue: t.checked,
|
|
258
|
+
"onUpdate:modelValue": (D) => t.checked = D,
|
|
259
|
+
disabled: t.isDelete || t.disabled
|
|
260
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "disabled"])) : (r(), w(d(ee), {
|
|
261
|
+
key: 2,
|
|
262
|
+
"model-value": String(((m = t.item) == null ? void 0 : m[i.field]) ?? "")
|
|
263
|
+
}, null, 8, ["model-value"]))
|
|
264
|
+
])
|
|
265
|
+
], 4);
|
|
266
|
+
}), 128)) : (r(), h("td", Ke, [
|
|
267
|
+
u("div", Qe, [
|
|
268
|
+
N(d(ee), {
|
|
269
|
+
"model-value": String(t.label ?? "")
|
|
270
|
+
}, null, 8, ["model-value"])
|
|
271
|
+
])
|
|
272
|
+
]))
|
|
273
|
+
], 42, je);
|
|
274
|
+
}), 128))
|
|
275
|
+
])
|
|
276
|
+
], 512),
|
|
277
|
+
u("div", {
|
|
278
|
+
ref: "resizableBar",
|
|
279
|
+
class: Q(["vxe-table--resizable-col-bar", { "block!": M.value }])
|
|
280
|
+
}, [...l[1] || (l[1] = [
|
|
281
|
+
u("div", { class: "vxe-table--resizable-number-tip" }, null, -1)
|
|
282
|
+
])], 2),
|
|
283
|
+
N(d(Pe), {
|
|
284
|
+
offset: 5,
|
|
285
|
+
"show-arrow": !0,
|
|
286
|
+
"virtual-ref": z.value,
|
|
287
|
+
"virtual-triggering": "",
|
|
288
|
+
visible: x.value,
|
|
289
|
+
placement: "top",
|
|
290
|
+
"popper-options": {
|
|
291
|
+
strategy: "fixed"
|
|
292
|
+
}
|
|
293
|
+
}, {
|
|
294
|
+
content: O(() => [
|
|
295
|
+
u("span", null, J(V.value), 1)
|
|
296
|
+
]),
|
|
297
|
+
_: 1
|
|
298
|
+
}, 8, ["virtual-ref", "visible"])
|
|
299
|
+
])
|
|
300
|
+
]),
|
|
301
|
+
_: 3
|
|
302
|
+
}, 16, ["class"]));
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
export {
|
|
306
|
+
ct as default
|
|
307
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const e = 360, a = 32, t = {
|
|
2
|
+
// 当前页码,默认值为 1
|
|
3
|
+
currentPage: 1,
|
|
4
|
+
// 每页显示的记录数,默认值为 30
|
|
5
|
+
pageSize: 30,
|
|
6
|
+
// 总记录数,默认值为 0
|
|
7
|
+
total: 0,
|
|
8
|
+
// 可选的每页记录数列表
|
|
9
|
+
pageSizes: [300, 500, 1e3, 2e3],
|
|
10
|
+
// 分页器布局
|
|
11
|
+
layouts: ["Total", "PrevPage", "JumpNumber", "NextPage", "Sizes", "FullJump"],
|
|
12
|
+
// 分页器大小
|
|
13
|
+
size: "small"
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
e as GRID_MAX_HEIGHT,
|
|
17
|
+
a as GRID_MIN_HEIGHT,
|
|
18
|
+
t as defaultPagination
|
|
19
|
+
};
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { isFunction as v, isNullOrUnDef as w } from "@dazhicheng/utils";
|
|
2
|
+
import { useDebounceFn as re } from "@vueuse/core";
|
|
3
|
+
import { cloneDeep as B, isArray as k, set as A, get as S } from "lodash-es";
|
|
4
|
+
import { ref as o, computed as u, unref as e, watch as h, nextTick as ge, toValue as b } from "vue";
|
|
5
|
+
import { ElMessage as oe } from "element-plus";
|
|
6
|
+
import { isEqualObject as x } from "../utils/index.js";
|
|
7
|
+
function De(a, l, C) {
|
|
8
|
+
const m = o([]), P = o(""), D = o(!0), K = o([]), M = o(-1), L = o(!1), G = o(!1), E = o(!1), q = o(!1), H = u(() => e(a).isGrpc ? e(a).totalFieldGrpc || "total" : e(a).totalField || "data.pagination.total"), J = u(() => e(a).isGrpc ? e(a).dataFieldGrpc || "items" : e(a).dataField || "data"), Q = u(() => e(a).isGrpc ? e(a).resultFieldGrpc || "items" : e(a).resultField || "data.list"), W = u(() => e(a).searchField || "keyword"), V = u(() => e(a).valueField || "value"), O = u(() => e(a).labelField || "label"), z = u(() => e(a).mergeFields || []), X = u(() => e(a).isGrpc ? e(a).currentPageFieldGrpc || "page.index" : e(a).currentPageField || "pageIndex"), Y = u(() => e(a).isGrpc ? e(a).pageSizeFieldGrpc || "page.size" : e(a).pageSizeField || "pageSize"), R = u(() => e(a).deleteField || ""), Z = u(() => e(a).messageField || ""), $ = u(() => e(a).hasNextPageField), N = u(() => e(a).immediate || !1), p = u(() => e(a).changeDataClearable || !1), ee = u(() => e(a).defaultSingle), te = u(() => e(a).isSelectFirstOption), ae = u(() => e(G) || e(L));
|
|
9
|
+
let I = e(a).isPage ?? !0;
|
|
10
|
+
async function ie(t) {
|
|
11
|
+
const i = e(a).afterFetch;
|
|
12
|
+
return i && v(i) ? await i(t) : t;
|
|
13
|
+
}
|
|
14
|
+
function ne(t, i) {
|
|
15
|
+
const n = S(t, e($) || ""), f = S(t, e(H) || "") !== void 0;
|
|
16
|
+
return { shouldPage: n || i && f, hasNextPage: n };
|
|
17
|
+
}
|
|
18
|
+
function le(t, i, n) {
|
|
19
|
+
l.setHasNextPage(n), l.setShowPager(i || n), i && l.setPagination({
|
|
20
|
+
total: S(t, e(H) || "") || 0
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function ce(t, i) {
|
|
24
|
+
const n = i || b(q) ? e(Q) || "" : e(J) || "";
|
|
25
|
+
return S(t, n) || [];
|
|
26
|
+
}
|
|
27
|
+
async function se(t) {
|
|
28
|
+
const i = await ie(t), { shouldPage: n, hasNextPage: f } = ne(i, I);
|
|
29
|
+
I = n, le(i, n, f);
|
|
30
|
+
const r = ce(i, n);
|
|
31
|
+
q.value = f, y(r), C("fetch-success", r);
|
|
32
|
+
}
|
|
33
|
+
async function T() {
|
|
34
|
+
var d, g;
|
|
35
|
+
if (!e(a).api || !v(e(a).api))
|
|
36
|
+
return oe({
|
|
37
|
+
message: "请传入api方法",
|
|
38
|
+
type: "error",
|
|
39
|
+
plain: !0
|
|
40
|
+
});
|
|
41
|
+
const { defaultData: t } = e(a), { extra: i } = e(l), { currentPage: n, pageSize: f } = l.getPagination() || {}, r = {};
|
|
42
|
+
I && (A(r, e(X) || "", n || 1), A(r, e(Y) || "", f));
|
|
43
|
+
let s = {
|
|
44
|
+
...r,
|
|
45
|
+
...b(i),
|
|
46
|
+
...e(t)
|
|
47
|
+
};
|
|
48
|
+
A(s, e(W), e(P)), l.setLoading(!0);
|
|
49
|
+
const c = e(a).beforeFetch;
|
|
50
|
+
c && v(c) && (s = await c(s));
|
|
51
|
+
try {
|
|
52
|
+
const F = await ((g = (d = e(a)) == null ? void 0 : d.api) == null ? void 0 : g.call(d, s).finally(() => {
|
|
53
|
+
l.setLoading(!1);
|
|
54
|
+
}));
|
|
55
|
+
await se(F), D.value = !1, L.value = !1, G.value = !1;
|
|
56
|
+
} catch (F) {
|
|
57
|
+
C("fetch-error", F);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function U(t) {
|
|
61
|
+
var s, c;
|
|
62
|
+
if (t.isDelete)
|
|
63
|
+
return !0;
|
|
64
|
+
const i = e(a).disableFn && v(e(a).disableFn), n = e(V), f = w(t[n]) ? t.value : t[n], r = i ? (c = (s = e(a)).disableFn) == null ? void 0 : c.call(s, f, b(l.selectValue), t) : t.disabled;
|
|
65
|
+
if (e(l).multiple && e(l.multipleLimit)) {
|
|
66
|
+
const d = b(l.selectValue) || [];
|
|
67
|
+
return r || (e(l.multipleLimit) || 0) > 0 && d.length >= (e(l.multipleLimit) || 0) && !d.includes(f);
|
|
68
|
+
}
|
|
69
|
+
return r;
|
|
70
|
+
}
|
|
71
|
+
function y(t) {
|
|
72
|
+
function i(s) {
|
|
73
|
+
var c;
|
|
74
|
+
if (k(e(z)) && e(z).length > 0) {
|
|
75
|
+
const d = (c = e(z)) == null ? void 0 : c.map((F) => s[F]), g = e(a).joinFn;
|
|
76
|
+
return g && v(g) ? g(d) : d.join("-");
|
|
77
|
+
}
|
|
78
|
+
return s[e(O)];
|
|
79
|
+
}
|
|
80
|
+
function n(s) {
|
|
81
|
+
var d;
|
|
82
|
+
const c = { ...s, mergeLabel: i(s) };
|
|
83
|
+
return w(s) ? s : {
|
|
84
|
+
item: c,
|
|
85
|
+
// 遍历列字段,将对应的值添加到结果中-TODO: 这里可以优化都是用table这里可以去掉
|
|
86
|
+
...(d = l.columnsFields) == null ? void 0 : d.reduce(
|
|
87
|
+
(g, F) => (g[F] = c[F], g),
|
|
88
|
+
{}
|
|
89
|
+
),
|
|
90
|
+
value: w(c[e(V)]) ? c.value : c[e(V)],
|
|
91
|
+
label: w(c[e(O)]) ? c.label : c[e(O)],
|
|
92
|
+
disabled: U(c) || !1,
|
|
93
|
+
message: c[e(Z)] || "",
|
|
94
|
+
...e(R) ? { isDelete: !!c[e(R)] || !1 } : {}
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
let f = t.map((s) => n(s));
|
|
98
|
+
e(a).isFilterEmpty && (f = f.filter((s) => s.value));
|
|
99
|
+
const { currentPage: r } = l.getPagination() || {};
|
|
100
|
+
if (r === 1) {
|
|
101
|
+
const s = e(a).customDefault;
|
|
102
|
+
s && f.unshift(n(s)), m.value = f, _(-1), setTimeout(() => {
|
|
103
|
+
var c;
|
|
104
|
+
if (e(l.multiple)) {
|
|
105
|
+
const d = l.getKeyboardEvent && ((c = l.getKeyboardEvent) == null ? void 0 : c.call(l));
|
|
106
|
+
d && d.ArrowDown();
|
|
107
|
+
}
|
|
108
|
+
}, 30);
|
|
109
|
+
} else
|
|
110
|
+
m.value = [...m.value, ...f];
|
|
111
|
+
K.value = B(e(m));
|
|
112
|
+
}
|
|
113
|
+
const ue = re(T, 300);
|
|
114
|
+
async function j() {
|
|
115
|
+
e(a).api && (P.value = "", l.setPagination({
|
|
116
|
+
currentPage: 1
|
|
117
|
+
}), await T());
|
|
118
|
+
}
|
|
119
|
+
async function de(t) {
|
|
120
|
+
P.value = t;
|
|
121
|
+
}
|
|
122
|
+
function _(t) {
|
|
123
|
+
M.value = t;
|
|
124
|
+
}
|
|
125
|
+
function fe() {
|
|
126
|
+
l.renderType === "table" && m.value.forEach((t) => {
|
|
127
|
+
t.item && (t.disabled = U(t.item));
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
return h(
|
|
131
|
+
() => e(P),
|
|
132
|
+
(t, i) => {
|
|
133
|
+
t !== i && (l.setPagination({
|
|
134
|
+
currentPage: 1
|
|
135
|
+
}), ue());
|
|
136
|
+
}
|
|
137
|
+
), h(
|
|
138
|
+
() => m.value,
|
|
139
|
+
() => {
|
|
140
|
+
e(E) && (e(p) && ge(() => {
|
|
141
|
+
var i, n;
|
|
142
|
+
const t = l.getSelectEvent && ((i = l.getSelectEvent) == null ? void 0 : i.call(l));
|
|
143
|
+
(n = t == null ? void 0 : t.clear) == null || n.call(t);
|
|
144
|
+
}), E.value = !1);
|
|
145
|
+
},
|
|
146
|
+
{ deep: !0 }
|
|
147
|
+
), h(
|
|
148
|
+
() => B(e(a).data),
|
|
149
|
+
(t, i = []) => {
|
|
150
|
+
const n = x({ data: t }, { data: i });
|
|
151
|
+
E.value = !!n, !e(a).api && k(t) && n && (l.setPagination({
|
|
152
|
+
currentPage: 1
|
|
153
|
+
}), y(t), D.value = !1);
|
|
154
|
+
},
|
|
155
|
+
{ immediate: !0 }
|
|
156
|
+
), h(
|
|
157
|
+
() => b(e(l).extra),
|
|
158
|
+
async (t, i) => {
|
|
159
|
+
const n = x(t, i, e(a).watchExtraField || []);
|
|
160
|
+
G.value = !!n, n && e(N) && await j();
|
|
161
|
+
},
|
|
162
|
+
{ deep: !0 }
|
|
163
|
+
), h(
|
|
164
|
+
() => b(e(a).defaultData),
|
|
165
|
+
async (t, i) => {
|
|
166
|
+
const n = x(t, i);
|
|
167
|
+
L.value = !!n, n && e(N) && await j();
|
|
168
|
+
},
|
|
169
|
+
{ deep: !0 }
|
|
170
|
+
), h(
|
|
171
|
+
() => e(a).defaultChecked,
|
|
172
|
+
(t, i) => {
|
|
173
|
+
x(t, i) && D.value && (t && k(t) ? y(t) : t && y([t]));
|
|
174
|
+
},
|
|
175
|
+
{ deep: !0, immediate: !0 }
|
|
176
|
+
), {
|
|
177
|
+
options: m,
|
|
178
|
+
getDefaultSingle: ee,
|
|
179
|
+
getIsSelectFirstOption: te,
|
|
180
|
+
getImmediate: N,
|
|
181
|
+
reload: async (t = !1) => {
|
|
182
|
+
e(a).api && (t ? await j() : await T());
|
|
183
|
+
},
|
|
184
|
+
searchValue: P,
|
|
185
|
+
isLoaded: D,
|
|
186
|
+
dataList: K,
|
|
187
|
+
setSearchValue: de,
|
|
188
|
+
activeIndex: M,
|
|
189
|
+
setActiveIndex: _,
|
|
190
|
+
needLoad: ae,
|
|
191
|
+
updateOptionsDisabled: fe
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
export {
|
|
195
|
+
De as useDataSource
|
|
196
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { isFunction as k } from "lodash-es";
|
|
2
|
+
import { ref as x, computed as v, unref as t } from "vue";
|
|
3
|
+
function D(d, n) {
|
|
4
|
+
const h = x();
|
|
5
|
+
function f(e) {
|
|
6
|
+
const i = t(n).selectWidth / e.length;
|
|
7
|
+
return e.length * 130 < t(n).selectWidth ? i : 130;
|
|
8
|
+
}
|
|
9
|
+
function a() {
|
|
10
|
+
const e = t(h);
|
|
11
|
+
if (!e || !e.getColumns) return {};
|
|
12
|
+
const i = {};
|
|
13
|
+
return e.getColumns().forEach((o) => {
|
|
14
|
+
const l = o.property || o.field || o.id;
|
|
15
|
+
if (!l) return;
|
|
16
|
+
const c = o.renderWidth ?? o.width ?? o.minWidth;
|
|
17
|
+
c != null && (i[l] = c);
|
|
18
|
+
}), i;
|
|
19
|
+
}
|
|
20
|
+
const g = v(() => {
|
|
21
|
+
const e = t(d).columns || [{ title: "label", field: "label" }], i = f(e), r = a(), o = e.map((l) => {
|
|
22
|
+
const c = l.field || l.property, s = c ? r[c] : void 0, W = e.length <= 1 ? t(n).selectWidth : l.minWidth || l.width || i, b = e.length <= 1 ? t(n).selectWidth : l.width || i;
|
|
23
|
+
return {
|
|
24
|
+
resizable: !0,
|
|
25
|
+
// showOverflow: true,
|
|
26
|
+
...l,
|
|
27
|
+
title: l.title,
|
|
28
|
+
minWidth: W,
|
|
29
|
+
width: s !== void 0 ? s : b
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
return t(n).showCheckbox && o.unshift({
|
|
33
|
+
type: t(n).multiple ? "checkbox" : "radio",
|
|
34
|
+
width: 48,
|
|
35
|
+
align: "center",
|
|
36
|
+
visible: t(n).multiple,
|
|
37
|
+
fixed: "left"
|
|
38
|
+
}), o;
|
|
39
|
+
});
|
|
40
|
+
function m({ row: e }) {
|
|
41
|
+
var i, r;
|
|
42
|
+
return (i = t(h)) != null && i.isCheckedByCheckboxRow(e) || (r = t(h)) != null && r.isCheckedByRadioRow(e) ? {
|
|
43
|
+
color: "var(--el-color-primary)",
|
|
44
|
+
fontWeight: 700,
|
|
45
|
+
width: "100%",
|
|
46
|
+
textDecorationLine: e.isDelete ? "line-through" : "none"
|
|
47
|
+
} : u(e) ? {
|
|
48
|
+
color: "var(--el-text-color-placeholder)",
|
|
49
|
+
width: "100%",
|
|
50
|
+
textDecorationLine: e.isDelete ? "line-through" : "none"
|
|
51
|
+
} : {
|
|
52
|
+
color: "var(--el-text-color-regular)",
|
|
53
|
+
width: "100%"
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function u(e) {
|
|
57
|
+
if (e.isDelete)
|
|
58
|
+
return !0;
|
|
59
|
+
const i = t(n).disableFn && k(t(n).disableFn) ? t(n).disableFn(e.value, t(n).selectValue, e) : e.disabled;
|
|
60
|
+
if (t(n).multiple && t(n).multipleLimit) {
|
|
61
|
+
const r = t(n).selectValue || [];
|
|
62
|
+
return i || t(n).multipleLimit > 0 && r.length >= t(n).multipleLimit && !r.includes(e.value);
|
|
63
|
+
}
|
|
64
|
+
return i;
|
|
65
|
+
}
|
|
66
|
+
function C() {
|
|
67
|
+
const e = {
|
|
68
|
+
rowConfig: {
|
|
69
|
+
keyField: "value",
|
|
70
|
+
isHover: !0,
|
|
71
|
+
isCurrent: !0,
|
|
72
|
+
// useKey: true,
|
|
73
|
+
...t(d).rowConfig
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
return t(n).multiple ? e.checkboxConfig = {
|
|
77
|
+
highlight: !1,
|
|
78
|
+
trigger: "row",
|
|
79
|
+
checkMethod: ({ row: i }) => !u(i),
|
|
80
|
+
...t(d).checkboxConfig
|
|
81
|
+
} : e.radioConfig = {
|
|
82
|
+
highlight: !1,
|
|
83
|
+
trigger: "row",
|
|
84
|
+
checkMethod: ({ row: i }) => !u(i),
|
|
85
|
+
...t(d).radioConfig
|
|
86
|
+
}, e;
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
getColumns: g,
|
|
90
|
+
rowStyle: m,
|
|
91
|
+
gridRef: h,
|
|
92
|
+
getOtherGridConfig: C
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
export {
|
|
96
|
+
D as useGrid
|
|
97
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { unref as i, nextTick as x, toValue as I } from "vue";
|
|
2
|
+
function l(r) {
|
|
3
|
+
function c() {
|
|
4
|
+
return r.tableInstance();
|
|
5
|
+
}
|
|
6
|
+
function t() {
|
|
7
|
+
const e = c();
|
|
8
|
+
x(() => {
|
|
9
|
+
if (!e) return;
|
|
10
|
+
i(r.activeIndex) > i(r.options).length - 1 && !I(r.loading) && r.setActiveIndex(0);
|
|
11
|
+
const n = e == null ? void 0 : e.getData(i(r.activeIndex) + 1);
|
|
12
|
+
if (n) {
|
|
13
|
+
if (n != null && n.disabled || n != null && n.isDelete) {
|
|
14
|
+
r.setActiveIndex(i(r.activeIndex) + 1), t();
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
e == null || e.scrollToRow(n), e == null || e.setCurrentRow(n), r.setActiveIndex(i(r.activeIndex) + 1);
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
function d() {
|
|
22
|
+
const e = c();
|
|
23
|
+
if (!e) return;
|
|
24
|
+
i(r.activeIndex) === -1 && r.setActiveIndex(i(r.options).length);
|
|
25
|
+
const n = e == null ? void 0 : e.getData(i(r.activeIndex) - 1);
|
|
26
|
+
if (n) {
|
|
27
|
+
if (n != null && n.disabled || n != null && n.isDelete) {
|
|
28
|
+
r.setActiveIndex(i(r.activeIndex) - 1), d();
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
e == null || e.scrollToRow(n), e == null || e.setCurrentRow(n), r.setActiveIndex(i(r.activeIndex) - 1);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function s() {
|
|
35
|
+
var u;
|
|
36
|
+
if (i(r.activeIndex) <= -1) return;
|
|
37
|
+
const e = c();
|
|
38
|
+
if (!e) return;
|
|
39
|
+
const n = e == null ? void 0 : e.getCurrentRecord(), { radioChange: a, checkboxChange: v } = r.getGridEvent();
|
|
40
|
+
if (n)
|
|
41
|
+
if (i(r.multiple)) {
|
|
42
|
+
const o = (u = i(r.selectValue)) == null ? void 0 : u.includes(n.value);
|
|
43
|
+
e == null || e.setCheckboxRow(n, !o), v({ checked: !o, row: n });
|
|
44
|
+
} else
|
|
45
|
+
e == null || e.setRadioRow(n), a({ row: n });
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
handleKeyDownNext: t,
|
|
49
|
+
handleKeyDownPrev: d,
|
|
50
|
+
handleKeyDownEnter: s,
|
|
51
|
+
keyboardCaptureEvent: {
|
|
52
|
+
// 向上箭头键事件处理函数
|
|
53
|
+
ArrowUp: d,
|
|
54
|
+
// 向下箭头键事件处理函数
|
|
55
|
+
ArrowDown: t,
|
|
56
|
+
// 回车键事件处理函数
|
|
57
|
+
Enter: s
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
export {
|
|
62
|
+
l as useKeyboard
|
|
63
|
+
};
|