@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,75 @@
|
|
|
1
|
+
import { propTypes as e } from "@dazhicheng/hooks";
|
|
2
|
+
import { GlobalConfig as t } from "@dazhicheng-ui/hooks/useSetup";
|
|
3
|
+
const o = {
|
|
4
|
+
/** 测试标识 */
|
|
5
|
+
testId: e.string,
|
|
6
|
+
/** 是否显示 */
|
|
7
|
+
visible: { type: Boolean },
|
|
8
|
+
/** 标题 */
|
|
9
|
+
title: e.string.def(""),
|
|
10
|
+
/** 取消按钮文本 */
|
|
11
|
+
cancelText: { type: String, default: "取消" },
|
|
12
|
+
/** 确定按钮文本 */
|
|
13
|
+
okText: { type: String, default: "确定" },
|
|
14
|
+
/** 最小高度 */
|
|
15
|
+
minHeight: e.number.def(192),
|
|
16
|
+
/** 高度 */
|
|
17
|
+
height: e.number,
|
|
18
|
+
/** 是否滚动到顶 */
|
|
19
|
+
scrollTop: { type: Boolean, default: !0 },
|
|
20
|
+
/** 取消前的函数 */
|
|
21
|
+
closeFunc: Function,
|
|
22
|
+
/** 是否允许拖拽 */
|
|
23
|
+
draggable: { type: Boolean, default: !0 },
|
|
24
|
+
/** 是否允许放大 */
|
|
25
|
+
fullscreen: { type: Boolean, default: !1 },
|
|
26
|
+
/** 是否允许自定义大小 */
|
|
27
|
+
resizer: { type: Boolean, default: !1 }
|
|
28
|
+
}, n = Object.assign({}, o, {
|
|
29
|
+
/** 弹窗的loading */
|
|
30
|
+
loading: { type: Boolean, default: !1 },
|
|
31
|
+
/** 弹窗的loading提示 */
|
|
32
|
+
loadingTip: { type: String },
|
|
33
|
+
/** 是否显示footer */
|
|
34
|
+
showFooter: { type: Boolean, default: !0 },
|
|
35
|
+
/** 是否显示取消按钮 */
|
|
36
|
+
showCancelBtn: { type: Boolean, default: !0 },
|
|
37
|
+
/** 是否显示确定按钮 */
|
|
38
|
+
showOkBtn: { type: Boolean, default: !0 },
|
|
39
|
+
/** 是否显示确定按钮loading */
|
|
40
|
+
confirmLoading: { type: Boolean },
|
|
41
|
+
/** 是否显示取消按钮loading */
|
|
42
|
+
cancelLoading: { type: Boolean },
|
|
43
|
+
/** 宽度 */
|
|
44
|
+
width: [String, Number],
|
|
45
|
+
/** 弹窗距离顶部的距离需要带px单位 */
|
|
46
|
+
top: { type: String },
|
|
47
|
+
/** 弹大小 */
|
|
48
|
+
size: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: "small"
|
|
51
|
+
},
|
|
52
|
+
/** 确定按钮的样式 */
|
|
53
|
+
okButtonProps: {
|
|
54
|
+
type: Object,
|
|
55
|
+
default: {
|
|
56
|
+
type: "primary"
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
/** 取消按钮的样式 */
|
|
60
|
+
cancelButtonProps: {
|
|
61
|
+
type: Object,
|
|
62
|
+
default: {}
|
|
63
|
+
},
|
|
64
|
+
/** 是否贴住底部 */
|
|
65
|
+
isBottom: { type: Boolean, default: !1 },
|
|
66
|
+
/** 是否显示modal */
|
|
67
|
+
modal: {
|
|
68
|
+
type: Boolean,
|
|
69
|
+
default: () => t.showMask
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
export {
|
|
73
|
+
n as basicProps,
|
|
74
|
+
o as modalProps
|
|
75
|
+
};
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
var v = Object.defineProperty;
|
|
2
|
+
var b = (o, t, e) => t in o ? v(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
|
|
3
|
+
var i = (o, t, e) => b(o, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { mergeWithArrayOverride as u, bindMethods as S, isElement as w, isFunction as n } from "@dazhicheng/utils";
|
|
5
|
+
import { Store as C } from "@tanstack/vue-store";
|
|
6
|
+
import { useDebounceFn as k } from "@vueuse/core";
|
|
7
|
+
import { computed as y } from "vue";
|
|
8
|
+
import { GlobalConfig as D } from "@dazhicheng-ui/hooks/useSetup";
|
|
9
|
+
class x {
|
|
10
|
+
/** 构造函数,初始化弹窗的API接口和状态 */
|
|
11
|
+
constructor(t = {}) {
|
|
12
|
+
/** 共享数据对象,用于在组件间传递数据 */
|
|
13
|
+
i(this, "sharedData", {
|
|
14
|
+
payload: {}
|
|
15
|
+
});
|
|
16
|
+
/** 状态存储对象,使用Store管理弹窗的各种状态 */
|
|
17
|
+
i(this, "store");
|
|
18
|
+
/** 弹窗的API接口,用于处理外部事件 */
|
|
19
|
+
i(this, "api");
|
|
20
|
+
/** 弹窗的当前状态,使用Partial<ModalRenderState>类型 */
|
|
21
|
+
i(this, "state");
|
|
22
|
+
/** 弹窗的实例方法,用于处理弹窗的各种操作 */
|
|
23
|
+
i(this, "methods");
|
|
24
|
+
/**
|
|
25
|
+
* 确认操作
|
|
26
|
+
*/
|
|
27
|
+
i(this, "onOk", k(async () => {
|
|
28
|
+
var t, e;
|
|
29
|
+
try {
|
|
30
|
+
this.changeOkLoading(!0), this.api.onOk && await ((e = (t = this.api).onOk) == null ? void 0 : e.call(t));
|
|
31
|
+
} catch (s) {
|
|
32
|
+
throw new Error(s);
|
|
33
|
+
} finally {
|
|
34
|
+
this.changeOkLoading(!1);
|
|
35
|
+
}
|
|
36
|
+
}, 100));
|
|
37
|
+
/**
|
|
38
|
+
* 获取弹窗的可见状态
|
|
39
|
+
* @returns 弹窗的可见状态
|
|
40
|
+
*/
|
|
41
|
+
i(this, "getVisible", y(() => this.state.visible));
|
|
42
|
+
const {
|
|
43
|
+
connectedComponent: e,
|
|
44
|
+
onVisibleChange: s,
|
|
45
|
+
onClose: a,
|
|
46
|
+
onClosed: r,
|
|
47
|
+
onOk: f,
|
|
48
|
+
onReceiveSharedData: m,
|
|
49
|
+
...g
|
|
50
|
+
} = t, p = {
|
|
51
|
+
visible: !1,
|
|
52
|
+
title: "",
|
|
53
|
+
cancelText: "取消",
|
|
54
|
+
okText: "确定",
|
|
55
|
+
minHeight: 192,
|
|
56
|
+
height: void 0,
|
|
57
|
+
scrollTop: !0,
|
|
58
|
+
closeFunc: void 0,
|
|
59
|
+
draggable: !0,
|
|
60
|
+
fullscreen: !1,
|
|
61
|
+
resizer: !1,
|
|
62
|
+
loading: !1,
|
|
63
|
+
loadingTip: "",
|
|
64
|
+
showFooter: !0,
|
|
65
|
+
showCancelBtn: !0,
|
|
66
|
+
showOkBtn: !0,
|
|
67
|
+
confirmLoading: !1,
|
|
68
|
+
cancelLoading: !1,
|
|
69
|
+
width: void 0,
|
|
70
|
+
top: void 0,
|
|
71
|
+
size: "small",
|
|
72
|
+
okButtonProps: {
|
|
73
|
+
type: "primary"
|
|
74
|
+
},
|
|
75
|
+
cancelButtonProps: {},
|
|
76
|
+
isBottom: !1,
|
|
77
|
+
resizeChange: void 0,
|
|
78
|
+
modal: D.showMask
|
|
79
|
+
};
|
|
80
|
+
this.store = new C(u(g, p), {
|
|
81
|
+
onUpdate: () => {
|
|
82
|
+
var h, c, d;
|
|
83
|
+
const l = this.store.state;
|
|
84
|
+
this.state = l, l.visible !== ((h = this.state) == null ? void 0 : h.visible) && ((d = (c = this.api).onVisibleChange) == null || d.call(c, !!l.visible));
|
|
85
|
+
}
|
|
86
|
+
}), this.state = this.store.state, this.api = { onVisibleChange: s, onClose: a, onClosed: r, onOk: f, onReceiveSharedData: m }, S(this);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* 挂载弹窗实例和API接口
|
|
90
|
+
* @param api - 外部传入的API接口
|
|
91
|
+
* @param methods - 外部传入的实例方法
|
|
92
|
+
*/
|
|
93
|
+
mount(t, e) {
|
|
94
|
+
this.api = u(t, this.api), this.methods = e;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* 关闭弹窗
|
|
98
|
+
*/
|
|
99
|
+
async close() {
|
|
100
|
+
var a, r;
|
|
101
|
+
const t = document.querySelector('.viewer-container[aria-modal="true"]');
|
|
102
|
+
if (w(t))
|
|
103
|
+
return;
|
|
104
|
+
const { closeFunc: e } = this.state;
|
|
105
|
+
let s = !0;
|
|
106
|
+
e && n(e) && (s = await e()), this.setState({ visible: !s }), (r = (a = this.api).onClosed) == null || r.call(a);
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* 取消操作
|
|
110
|
+
*/
|
|
111
|
+
onClosed() {
|
|
112
|
+
var t, e;
|
|
113
|
+
this.api.onClose ? (e = (t = this.api).onClose) == null || e.call(t) : this.close();
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* 获取共享数据
|
|
117
|
+
* @returns 共享数据对象
|
|
118
|
+
*/
|
|
119
|
+
getData() {
|
|
120
|
+
var t;
|
|
121
|
+
return ((t = this.sharedData) == null ? void 0 : t.payload) ?? {};
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* 设置弹窗的状态
|
|
125
|
+
* @param stateOrFn - 状态对象或状态函数
|
|
126
|
+
* @returns 当前实例
|
|
127
|
+
*/
|
|
128
|
+
setState(t) {
|
|
129
|
+
return n(t) ? this.store.setState(t) : this.store.setState((e) => ({ ...e, ...t })), this;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* 打开弹窗
|
|
133
|
+
* @param visible - 是否可见
|
|
134
|
+
* @param data - 共享数据
|
|
135
|
+
*/
|
|
136
|
+
openModal(t = !0, e) {
|
|
137
|
+
this.setState({ visible: t }), this.setData(e);
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* 设置弹窗的属性
|
|
141
|
+
* @param props - 属性对象
|
|
142
|
+
* @returns 当前实例
|
|
143
|
+
*/
|
|
144
|
+
async setModalProps(t) {
|
|
145
|
+
if (this.setState(t), Reflect.has(t, "visible"))
|
|
146
|
+
if (!t.visible && this.state.closeFunc && n(this.state.closeFunc)) {
|
|
147
|
+
let e = !0;
|
|
148
|
+
e = await this.state.closeFunc(), this.setState({ visible: !e });
|
|
149
|
+
} else
|
|
150
|
+
this.setState({ visible: !t.visible });
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* 设置弹窗的加载状态
|
|
154
|
+
* @param loading - 是否加载中
|
|
155
|
+
* @returns 当前实例
|
|
156
|
+
*/
|
|
157
|
+
changeLoading(t = !0) {
|
|
158
|
+
return this.setState({ loading: t });
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* 设置确认按钮的加载状态
|
|
162
|
+
* @param loading - 是否加载中
|
|
163
|
+
* @returns 当前实例
|
|
164
|
+
*/
|
|
165
|
+
changeOkLoading(t = !0) {
|
|
166
|
+
return this.setState({ confirmLoading: t });
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* 设置共享数据
|
|
170
|
+
* @param payload - 共享数据
|
|
171
|
+
* @returns 当前实例
|
|
172
|
+
*/
|
|
173
|
+
setData(t) {
|
|
174
|
+
var e, s;
|
|
175
|
+
return this.sharedData.payload = t, (s = (e = this.api).onReceiveSharedData) == null || s.call(e, t), this;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* 关闭弹窗
|
|
179
|
+
*/
|
|
180
|
+
closeModal() {
|
|
181
|
+
this.setState({ visible: !1 });
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* 重置弹窗高度
|
|
185
|
+
*/
|
|
186
|
+
redoModalHeight() {
|
|
187
|
+
var t, e;
|
|
188
|
+
(e = (t = this.methods) == null ? void 0 : t.redoModalHeight) == null || e.call(t);
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* 滚动到底部
|
|
192
|
+
*/
|
|
193
|
+
scrollToBottom() {
|
|
194
|
+
var t, e;
|
|
195
|
+
(e = (t = this.methods) == null ? void 0 : t.scrollToBottom) == null || e.call(t);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
export {
|
|
199
|
+
x as ModalApi
|
|
200
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const n = [];
|
|
2
|
+
let r = !1;
|
|
3
|
+
function u(e) {
|
|
4
|
+
if (!e || !(e instanceof HTMLElement)) return !1;
|
|
5
|
+
const t = e.tagName;
|
|
6
|
+
return !!(t === "INPUT" || t === "TEXTAREA" || t === "SELECT" || e.isContentEditable || e.closest(
|
|
7
|
+
".el-select, .el-select-v2, .el-cascader, .el-date-editor, .el-time-picker, .el-color-picker, .el-input, .el-textarea, .el-autocomplete, .el-input-number, .el-mention"
|
|
8
|
+
));
|
|
9
|
+
}
|
|
10
|
+
function i(e) {
|
|
11
|
+
if (e.key !== "Escape" && e.key !== "Esc" || n.length === 0) return;
|
|
12
|
+
const t = e.target ?? document.activeElement;
|
|
13
|
+
if (u(t))
|
|
14
|
+
return;
|
|
15
|
+
const o = n[n.length - 1];
|
|
16
|
+
o && (e.stopPropagation(), o.close());
|
|
17
|
+
}
|
|
18
|
+
function l(e) {
|
|
19
|
+
c(e.uid), n.push(e), !r && typeof document < "u" && (document.addEventListener("keydown", i), r = !0);
|
|
20
|
+
}
|
|
21
|
+
function c(e) {
|
|
22
|
+
const t = n.findIndex((o) => o.uid === e);
|
|
23
|
+
t !== -1 && n.splice(t, 1), n.length === 0 && r && typeof document < "u" && (document.removeEventListener("keydown", i), r = !1);
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
l as pushModal,
|
|
27
|
+
c as removeModal
|
|
28
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { computed as l } from "vue";
|
|
2
|
+
function u(o) {
|
|
3
|
+
const n = l(() => Object.keys(o).map((r) => r.startsWith("modal-") ? r : null).filter(Boolean));
|
|
4
|
+
function e(t) {
|
|
5
|
+
var r;
|
|
6
|
+
return t ? ((r = t == null ? void 0 : t.replace) == null ? void 0 : r.call(t, /modal-/, "")) ?? "" : "";
|
|
7
|
+
}
|
|
8
|
+
const a = l(() => Object.keys(o).map((r) => r.startsWith("form-") ? r : null).filter(Boolean));
|
|
9
|
+
function s(t) {
|
|
10
|
+
var r;
|
|
11
|
+
return t ? ((r = t == null ? void 0 : t.replace) == null ? void 0 : r.call(t, /form-/, "")) ?? "" : "";
|
|
12
|
+
}
|
|
13
|
+
return {
|
|
14
|
+
getFormSlotKeys: a,
|
|
15
|
+
getModalSlotKeys: n,
|
|
16
|
+
replaceModalSlotKey: e,
|
|
17
|
+
replaceFormSlotKey: s
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
u as useModalFormSlot
|
|
22
|
+
};
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { defineComponent as G, useSlots as H, ref as K, computed as F, toValue as J, nextTick as y, watch as Q, createBlock as C, openBlock as M, unref as p, createSlots as B, withCtx as A, renderSlot as h, createVNode as W, renderList as P, normalizeProps as S, guardReactiveProps as b, createCommentVNode as X } from "vue";
|
|
2
|
+
import { isFunction as c } from "@dazhicheng/utils";
|
|
3
|
+
import { useForm as Y } from "@dazhicheng-ui/components/tt-form";
|
|
4
|
+
import { useModalRender as Z } from "@dazhicheng-ui/components/tt-modal";
|
|
5
|
+
import { ElCheckbox as ee, ElMessage as V } from "element-plus";
|
|
6
|
+
import { get as oe } from "lodash-es";
|
|
7
|
+
import { useModalFormSlot as te } from "./hooks/useModalFormSlot.js";
|
|
8
|
+
const ue = /* @__PURE__ */ G({
|
|
9
|
+
name: "TtModalForm",
|
|
10
|
+
__name: "index",
|
|
11
|
+
props: {
|
|
12
|
+
model: {},
|
|
13
|
+
addApi: {},
|
|
14
|
+
editApi: {},
|
|
15
|
+
infoApi: {},
|
|
16
|
+
infoApiBefore: {},
|
|
17
|
+
infoApiAfter: {},
|
|
18
|
+
saveApiBefore: {},
|
|
19
|
+
infoDataKey: {},
|
|
20
|
+
infoApiIdKey: { default: "id" },
|
|
21
|
+
infoApiParams: { default: () => ({}) },
|
|
22
|
+
apiParams: { default: () => ({}) },
|
|
23
|
+
formProps: { default: () => ({}) },
|
|
24
|
+
isContinuousChecked: { type: Boolean, default: !1 },
|
|
25
|
+
dataField: { default: "" },
|
|
26
|
+
modalProps: {},
|
|
27
|
+
getFormApi: {},
|
|
28
|
+
getModalApi: {},
|
|
29
|
+
checkedOptions: { default: () => ({}) }
|
|
30
|
+
},
|
|
31
|
+
emits: ["submit", "fetch", "getinfo"],
|
|
32
|
+
setup(I, { emit: O }) {
|
|
33
|
+
var k, w;
|
|
34
|
+
const o = I, d = O, D = H(), f = K(), s = K(!1), { getFormSlotKeys: L, getModalSlotKeys: E, replaceFormSlotKey: R, replaceModalSlotKey: _ } = te(D), x = F(() => E.value.filter(Boolean)), T = F(() => L.value.filter(Boolean)), [$, l] = Y({
|
|
35
|
+
showDefaultActions: !1,
|
|
36
|
+
...J(o.formProps)
|
|
37
|
+
}), [z, a] = Z({
|
|
38
|
+
...o.modalProps,
|
|
39
|
+
onReceiveSharedData: async (e) => {
|
|
40
|
+
if (!e) {
|
|
41
|
+
f.value = void 0;
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
if (e.schemas && l.setState({ schema: e.schemas }), e != null && e.title && a.setModalProps({ title: e.title }), f.value = e[o.infoApiIdKey], e != null && e[o.infoApiIdKey]) {
|
|
45
|
+
const i = o.infoApi;
|
|
46
|
+
if (!c(i)) {
|
|
47
|
+
v(e);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
a.changeLoading(!0);
|
|
51
|
+
try {
|
|
52
|
+
const t = {
|
|
53
|
+
...o.infoApiParams,
|
|
54
|
+
[o.infoApiIdKey]: e[o.infoApiIdKey]
|
|
55
|
+
}, n = c(o.infoApiBefore) ? await o.infoApiBefore(t) : t, r = await i(n), m = o.dataField ? oe(r, o.dataField) : r, u = c(o.infoApiAfter) ? await o.infoApiAfter(m) : m;
|
|
56
|
+
g(u), d("getinfo", u), await y(), await l.resetForm({ values: u });
|
|
57
|
+
} finally {
|
|
58
|
+
a.changeLoading(!1);
|
|
59
|
+
}
|
|
60
|
+
} else
|
|
61
|
+
v(e);
|
|
62
|
+
},
|
|
63
|
+
async onOk() {
|
|
64
|
+
await q();
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
function v(e) {
|
|
68
|
+
const i = e[o.infoDataKey || ""] || {};
|
|
69
|
+
g(i), y(() => {
|
|
70
|
+
l.resetForm({ values: i });
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
function g(e) {
|
|
74
|
+
const i = Object.keys(o.checkedOptions || {});
|
|
75
|
+
i.length && i.forEach((t) => {
|
|
76
|
+
var u;
|
|
77
|
+
const n = (u = o.checkedOptions) == null ? void 0 : u[t];
|
|
78
|
+
if (!Array.isArray(n) || n.length === 0)
|
|
79
|
+
return;
|
|
80
|
+
const [r, m] = n.length === 1 ? [n[0], n[0]] : n;
|
|
81
|
+
!r || !m || (e[t] = {
|
|
82
|
+
label: e[r],
|
|
83
|
+
value: e[m]
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
async function N() {
|
|
88
|
+
const e = await l.getValues(), { apiParams: i } = o;
|
|
89
|
+
let t = {
|
|
90
|
+
...e,
|
|
91
|
+
...i
|
|
92
|
+
};
|
|
93
|
+
return t = c(o.saveApiBefore) ? await o.saveApiBefore(t) : t, { reqParams: t, formValue: e };
|
|
94
|
+
}
|
|
95
|
+
async function j(e, i) {
|
|
96
|
+
const { editApi: t } = o;
|
|
97
|
+
!t || !c(t) || (e[o.infoApiIdKey] = f.value, await t(e, i.files), V.success("修改成功"), d("submit", {
|
|
98
|
+
...e,
|
|
99
|
+
continuousChecked: s.value
|
|
100
|
+
}), a.closeModal());
|
|
101
|
+
}
|
|
102
|
+
async function U(e, i) {
|
|
103
|
+
const { addApi: t } = o;
|
|
104
|
+
!t || !c(t) || (await t(e, i.files), V.success("新增成功"), d("submit", {
|
|
105
|
+
...e,
|
|
106
|
+
continuousChecked: s.value
|
|
107
|
+
}), (!s.value || !o.isContinuousChecked) && a.closeModal());
|
|
108
|
+
}
|
|
109
|
+
async function q() {
|
|
110
|
+
a.changeOkLoading(!0);
|
|
111
|
+
try {
|
|
112
|
+
const { valid: e } = await l.validate();
|
|
113
|
+
if (!e) return;
|
|
114
|
+
const { reqParams: i, formValue: t } = await N();
|
|
115
|
+
if (!i)
|
|
116
|
+
return;
|
|
117
|
+
const { addApi: n, editApi: r } = o;
|
|
118
|
+
if (!n && !r) {
|
|
119
|
+
d("submit", {
|
|
120
|
+
...i,
|
|
121
|
+
[o.infoApiIdKey]: f.value,
|
|
122
|
+
continuousChecked: s.value
|
|
123
|
+
});
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
f.value ? await j(i, t) : await U(i, t);
|
|
127
|
+
} finally {
|
|
128
|
+
a.changeOkLoading(!1);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return (k = o.getFormApi) == null || k.call(o, l), (w = o.getModalApi) == null || w.call(o, a), Q(
|
|
132
|
+
() => {
|
|
133
|
+
var e;
|
|
134
|
+
return (e = a.getVisible) == null ? void 0 : e.value;
|
|
135
|
+
},
|
|
136
|
+
async (e) => {
|
|
137
|
+
if (e) {
|
|
138
|
+
await y();
|
|
139
|
+
const i = await l.getValues();
|
|
140
|
+
d("fetch", i);
|
|
141
|
+
} else
|
|
142
|
+
s.value = !1;
|
|
143
|
+
}
|
|
144
|
+
), (e, i) => (M(), C(p(z), null, B({
|
|
145
|
+
insertFooter: A(() => [
|
|
146
|
+
o.isContinuousChecked && !f.value ? (M(), C(p(ee), {
|
|
147
|
+
key: 0,
|
|
148
|
+
modelValue: s.value,
|
|
149
|
+
"onUpdate:modelValue": i[0] || (i[0] = (t) => s.value = t),
|
|
150
|
+
label: "连续添加",
|
|
151
|
+
size: "small"
|
|
152
|
+
}, null, 8, ["modelValue"])) : X("", !0)
|
|
153
|
+
]),
|
|
154
|
+
default: A(() => [
|
|
155
|
+
h(e.$slots, "BasicMsgTop"),
|
|
156
|
+
W(p($), null, B({ _: 2 }, [
|
|
157
|
+
P(T.value, (t) => ({
|
|
158
|
+
name: p(R)(t),
|
|
159
|
+
fn: A((n) => [
|
|
160
|
+
h(e.$slots, t, S(b(n)))
|
|
161
|
+
])
|
|
162
|
+
}))
|
|
163
|
+
]), 1024)
|
|
164
|
+
]),
|
|
165
|
+
_: 2
|
|
166
|
+
}, [
|
|
167
|
+
P(x.value, (t) => ({
|
|
168
|
+
name: p(_)(t),
|
|
169
|
+
fn: A((n) => [
|
|
170
|
+
h(e.$slots, t, S(b(n)))
|
|
171
|
+
])
|
|
172
|
+
}))
|
|
173
|
+
]), 1024));
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
export {
|
|
177
|
+
ue as default
|
|
178
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ref as t, defineComponent as p, h as l } from "vue";
|
|
2
|
+
import d from "./index.vue.js";
|
|
3
|
+
function A(e) {
|
|
4
|
+
const r = t(), n = t();
|
|
5
|
+
function m(o) {
|
|
6
|
+
r.value = o;
|
|
7
|
+
}
|
|
8
|
+
function i(o) {
|
|
9
|
+
n.value = o;
|
|
10
|
+
}
|
|
11
|
+
return [p(
|
|
12
|
+
(o, { attrs: a, slots: f }) => () => l(
|
|
13
|
+
d,
|
|
14
|
+
{
|
|
15
|
+
...e,
|
|
16
|
+
...a,
|
|
17
|
+
getFormApi: m,
|
|
18
|
+
getModalApi: i
|
|
19
|
+
},
|
|
20
|
+
f
|
|
21
|
+
),
|
|
22
|
+
{
|
|
23
|
+
name: "TtModalFormRender",
|
|
24
|
+
inheritAttrs: !1
|
|
25
|
+
}
|
|
26
|
+
), { formApi: r, modalApi: n }];
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
A as useModalForm
|
|
30
|
+
};
|