@dazhicheng/ui 1.5.199 → 1.5.202
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/_plugin-vue_export-helper.js +9 -0
- package/dist/api/dataTypeContext.js +17 -0
- package/dist/assets/img/empty_images/no_data.png.js +4 -0
- package/dist/assets/img/empty_images/search.png.js +4 -0
- package/dist/assets/img/image_status/develop.png.js +4 -0
- package/dist/assets/img/image_status/loading.gif.js +4 -0
- package/dist/assets/img/image_status/loading_fail.png.js +4 -0
- package/dist/assets/img/image_status/no_network.png.js +4 -0
- package/dist/assets/img/image_status/no_permission.png.js +4 -0
- package/dist/assets/svg/RiRefreshLine.svg.js +4 -0
- package/dist/assets/svg/action_more.svg.js +4 -0
- package/dist/assets/svg/add.svg.js +4 -0
- package/dist/assets/svg/addCircleLine.svg.js +4 -0
- package/dist/assets/svg/arrowDown.svg.js +4 -0
- package/dist/assets/svg/arrowLineDown.svg.js +5 -0
- package/dist/assets/svg/arrowSUp.svg.js +4 -0
- package/dist/assets/svg/arrowUp.svg.js +4 -0
- package/dist/assets/svg/close.svg.js +4 -0
- package/dist/assets/svg/columnSet.svg.js +4 -0
- package/dist/assets/svg/determinateCircleLine.svg.js +5 -0
- package/dist/assets/svg/drag.svg.js +5 -0
- package/dist/assets/svg/exportSvg.svg.js +4 -0
- package/dist/assets/svg/fileSvg.svg.js +4 -0
- package/dist/assets/svg/help.svg.js +4 -0
- package/dist/assets/svg/item_error.svg.js +4 -0
- package/dist/assets/svg/paixu-jiangxu.svg.js +4 -0
- package/dist/assets/svg/paixu-moren.svg.js +4 -0
- package/dist/assets/svg/paixu-shengxu.svg.js +4 -0
- package/dist/assets/svg/quanping.svg.js +4 -0
- package/dist/assets/svg/suoxiao.svg.js +4 -0
- package/dist/components/tt-api-component/index.js +7 -0
- package/dist/components/tt-api-component/index.vue.js +7 -0
- package/dist/components/tt-api-component/index.vue2.js +199 -0
- package/dist/components/tt-area/TtArea.vue.js +7 -0
- package/dist/components/tt-area/TtArea.vue3.js +36 -0
- package/dist/components/tt-button/components/AddButton.vue.js +24 -0
- package/dist/components/tt-button/components/AddButton.vue2.js +4 -0
- package/dist/components/tt-button/index.js +9 -0
- package/dist/components/tt-button/index.vue.js +7 -0
- package/dist/components/tt-button/index.vue2.js +68 -0
- package/dist/components/tt-checkbox/index.js +7 -0
- package/dist/components/tt-checkbox/index.vue.js +77 -0
- package/dist/components/tt-checkbox/index.vue2.js +4 -0
- package/dist/components/tt-drawer/index.js +14 -0
- package/dist/components/tt-drawer/src/RenderDrawer.vue.js +157 -0
- package/dist/components/tt-drawer/src/RenderDrawer.vue3.js +5 -0
- package/dist/components/tt-drawer/src/components/DrawerFooter.vue.js +56 -0
- package/dist/components/tt-drawer/src/components/DrawerFooter.vue3.js +5 -0
- package/dist/components/tt-drawer/src/components/DrawerHeader.vue.js +7 -0
- package/dist/components/tt-drawer/src/components/DrawerHeader.vue2.js +21 -0
- package/dist/components/tt-drawer/src/hooks/useDrawerRender.js +124 -0
- package/dist/components/tt-drawer/src/hooks/useResizable.js +98 -0
- package/dist/components/tt-drawer/src/index.js +17 -0
- package/dist/components/tt-drawer/src/props.js +72 -0
- package/dist/components/tt-drawer/src/utils/drawer-api.js +191 -0
- package/dist/components/tt-empty/index.js +34 -0
- package/dist/components/tt-form/index.js +59 -0
- package/dist/components/tt-form/src/components/ExpandableArrow.vue2.js +38 -0
- package/dist/components/tt-form/src/components/ExpandableArrow.vue3.js +5 -0
- package/dist/components/tt-form/src/components/FormActions.vue2.js +177 -0
- package/dist/components/tt-form/src/components/FormActions.vue3.js +5 -0
- package/dist/components/tt-form/src/components/FormElInput.vue.js +80 -0
- package/dist/components/tt-form/src/components/FormElInput.vue2.js +4 -0
- package/dist/components/tt-form/src/components/Slot.js +28 -0
- package/dist/components/tt-form/src/config.js +57 -0
- package/dist/components/tt-form/src/form/FormControl.vue.js +16 -0
- package/dist/components/tt-form/src/form/FormControl.vue2.js +4 -0
- package/dist/components/tt-form/src/form/FormDescription.vue.js +21 -0
- package/dist/components/tt-form/src/form/FormDescription.vue2.js +4 -0
- package/dist/components/tt-form/src/form/FormItem.vue.js +20 -0
- package/dist/components/tt-form/src/form/FormItem.vue2.js +4 -0
- package/dist/components/tt-form/src/form/FormLabel.vue.js +19 -0
- package/dist/components/tt-form/src/form/FormLabel.vue2.js +4 -0
- package/dist/components/tt-form/src/form/FormMessage.vue.js +18 -0
- package/dist/components/tt-form/src/form/FormMessage.vue2.js +4 -0
- package/dist/components/tt-form/src/form/FormMessageToolTip.vue.js +30 -0
- package/dist/components/tt-form/src/form/FormMessageToolTip.vue2.js +4 -0
- package/dist/components/tt-form/src/form/RenderContent.vue.js +31 -0
- package/dist/components/tt-form/src/form/RenderContent.vue2.js +4 -0
- package/dist/components/tt-form/src/form/injectionKeys.js +4 -0
- package/dist/components/tt-form/src/form/useFormField.js +24 -0
- package/dist/components/tt-form/src/form-render/FormField.vue.js +4 -0
- package/dist/components/tt-form/src/form-render/FormField.vue2.js +345 -0
- package/dist/components/tt-form/src/form-render/FormFieldContact.js +54 -0
- package/dist/components/tt-form/src/form-render/FormLabel.vue.js +4 -0
- package/dist/components/tt-form/src/form-render/FormLabel.vue2.js +101 -0
- package/dist/components/tt-form/src/form-render/array-register/FormArrayRegister.js +195 -0
- package/dist/components/tt-form/src/form-render/array-register/props.js +47 -0
- package/dist/components/tt-form/src/form-render/array-register/utils.js +12 -0
- package/dist/components/tt-form/src/form-render/context.js +15 -0
- package/dist/components/tt-form/src/form-render/dependencies.js +51 -0
- package/dist/components/tt-form/src/form-render/expandable.js +46 -0
- package/dist/components/tt-form/src/form-render/form.vue2.js +196 -0
- package/dist/components/tt-form/src/form-render/form.vue3.js +5 -0
- package/dist/components/tt-form/src/form-render/helper.js +22 -0
- package/dist/components/tt-form/src/form-render/rootWrapperClass.js +10 -0
- package/dist/components/tt-form/src/formApi.js +790 -0
- package/dist/components/tt-form/src/group-form/GroupForm.vue2.js +223 -0
- package/dist/components/tt-form/src/group-form/GroupForm.vue3.js +5 -0
- package/dist/components/tt-form/src/group-form/GroupSection.vue2.js +277 -0
- package/dist/components/tt-form/src/group-form/GroupSection.vue3.js +5 -0
- package/dist/components/tt-form/src/group-form/LazyFormField.vue.js +153 -0
- package/dist/components/tt-form/src/group-form/LazyFormField.vue3.js +5 -0
- package/dist/components/tt-form/src/group-form/groupFormApi.js +700 -0
- package/dist/components/tt-form/src/group-form/lazyContext.js +38 -0
- package/dist/components/tt-form/src/group-form/useGroupForm.js +83 -0
- package/dist/components/tt-form/src/group-form/utils.js +106 -0
- package/dist/components/tt-form/src/hooks/useArrayRegistry.js +22 -0
- package/dist/components/tt-form/src/hooks/useFieldArray.js +137 -0
- package/dist/components/tt-form/src/hooks/useForwardPriorityValues.js +33 -0
- package/dist/components/tt-form/src/hooks/useSelectCollapse.js +81 -0
- package/dist/components/tt-form/src/index.vue2.js +147 -0
- package/dist/components/tt-form/src/index.vue3.js +5 -0
- package/dist/components/tt-form/src/shared/createContext.js +14 -0
- package/dist/components/tt-form/src/shared/global-state.js +22 -0
- package/dist/components/tt-form/src/shared/zod-defaults.js +47 -0
- package/dist/components/tt-form/src/types/forms.js +6 -0
- package/dist/components/tt-form/src/useForm.js +28 -0
- package/dist/components/tt-form/src/useFormContext.js +320 -0
- package/dist/components/tt-form/src/utils/array-path.js +18 -0
- package/dist/components/tt-form-item-error-tooltip/index.js +9 -0
- package/dist/components/tt-form-item-error-tooltip/index.vue.js +183 -0
- package/dist/components/tt-form-item-error-tooltip/index.vue3.js +5 -0
- package/dist/components/tt-icon/components/AddIcon.vue.js +28 -0
- package/dist/components/tt-icon/components/AddIcon.vue2.js +4 -0
- package/dist/components/tt-icon/components/SubIcon.vue.js +28 -0
- package/dist/components/tt-icon/components/SubIcon.vue2.js +4 -0
- package/dist/components/tt-icon/index.js +11 -0
- package/dist/components/tt-icon/index.vue.js +8 -0
- package/dist/components/tt-icon/index.vue2.js +115 -0
- package/dist/components/tt-image/index.js +9 -0
- package/dist/components/tt-image/src/components/ImageViewer.js +41 -0
- package/dist/components/tt-image/tt-image.js +55 -0
- package/dist/components/tt-loading/index.js +8 -0
- package/dist/components/tt-loading/src/directive.js +51 -0
- package/dist/components/tt-loading/src/loading.vue.js +7 -0
- package/dist/components/tt-loading/src/loading.vue2.js +75 -0
- package/dist/components/tt-loading/src/service.js +79 -0
- package/dist/components/tt-log/index.js +7 -0
- package/dist/components/tt-log/index.vue.js +31 -0
- package/dist/components/tt-log/index.vue2.js +4 -0
- package/dist/components/tt-modal/index.js +14 -0
- package/dist/components/tt-modal/src/RenderModal.vue.js +310 -0
- package/dist/components/tt-modal/src/RenderModal.vue3.js +5 -0
- package/dist/components/tt-modal/src/components/ModalFooter.vue.js +7 -0
- package/dist/components/tt-modal/src/components/ModalFooter.vue2.js +74 -0
- package/dist/components/tt-modal/src/components/ModalHeader.vue.js +7 -0
- package/dist/components/tt-modal/src/components/ModalHeader.vue2.js +22 -0
- package/dist/components/tt-modal/src/components/ModalWrapper.vue.js +48 -0
- package/dist/components/tt-modal/src/components/ModalWrapper.vue2.js +4 -0
- package/dist/components/tt-modal/src/hooks/useModalRender.js +131 -0
- package/dist/components/tt-modal/src/index.js +17 -0
- package/dist/components/tt-modal/src/props.js +75 -0
- package/dist/components/tt-modal/src/utils/modal-api.js +200 -0
- package/dist/components/tt-modal/src/utils/modal-stack.js +28 -0
- package/dist/components/tt-modal-form/hooks/useModalFormSlot.js +22 -0
- package/dist/components/tt-modal-form/index.vue.js +201 -0
- package/dist/components/tt-modal-form/index.vue2.js +4 -0
- package/dist/components/tt-modal-form/useModalForm.js +30 -0
- package/dist/components/tt-nav-anchor/index.js +8 -0
- package/dist/components/tt-nav-anchor/src/TtNavAnchor.vue.js +234 -0
- package/dist/components/tt-nav-anchor/src/TtNavAnchor.vue3.js +5 -0
- package/dist/components/tt-nav-anchor/src/constants.js +4 -0
- package/dist/components/tt-panel-select/index.js +7 -0
- package/dist/components/tt-panel-select/src/common.js +4 -0
- package/dist/components/tt-panel-select/src/components/PanelLeft.vue.js +56 -0
- package/dist/components/tt-panel-select/src/components/PanelLeft.vue2.js +4 -0
- package/dist/components/tt-panel-select/src/components/PanelMiddle.vue.js +277 -0
- package/dist/components/tt-panel-select/src/components/PanelMiddle.vue2.js +4 -0
- package/dist/components/tt-panel-select/src/components/PanelRight.vue.js +108 -0
- package/dist/components/tt-panel-select/src/components/PanelRight.vue2.js +4 -0
- package/dist/components/tt-panel-select/src/hooks/usePanelData.js +184 -0
- package/dist/components/tt-panel-select/src/hooks/usePanelSelection.js +91 -0
- package/dist/components/tt-panel-select/src/index.vue.js +386 -0
- package/dist/components/tt-panel-select/src/index.vue2.js +4 -0
- package/dist/components/tt-select/index.js +8 -0
- package/dist/components/tt-select/src/Select.vue.js +315 -0
- package/dist/components/tt-select/src/Select.vue3.js +5 -0
- package/dist/components/tt-select/src/components/SelectTable.vue.js +86 -0
- package/dist/components/tt-select/src/components/SelectTable.vue3.js +5 -0
- package/dist/components/tt-select/src/components/Table.vue.js +307 -0
- package/dist/components/tt-select/src/components/Table.vue3.js +5 -0
- package/dist/components/tt-select/src/const.js +19 -0
- package/dist/components/tt-select/src/hooks/useDataSource.js +196 -0
- package/dist/components/tt-select/src/hooks/useGrid.js +97 -0
- package/dist/components/tt-select/src/hooks/useKeyboard.js +63 -0
- package/dist/components/tt-select/src/hooks/usePagination.js +45 -0
- package/dist/components/tt-select/src/hooks/useSelect.js +100 -0
- package/dist/components/tt-select/src/hooks/useSelectTableEvent.d.ts +1 -1
- package/dist/components/tt-select/src/hooks/useSelectTableEvent.js +345 -0
- package/dist/components/tt-select/src/props.js +201 -0
- package/dist/components/tt-select/src/utils/index.js +16 -0
- package/dist/components/tt-table/index.js +63 -0
- package/dist/components/tt-table/src/Table.vue.js +623 -0
- package/dist/components/tt-table/src/Table.vue3.js +5 -0
- package/dist/components/tt-table/src/TableForm.vue.js +356 -0
- package/dist/components/tt-table/src/TableForm.vue2.js +4 -0
- package/dist/components/tt-table/src/componentMap.js +4 -0
- package/dist/components/tt-table/src/components/RowContext.js +24 -0
- package/dist/components/tt-table/src/components/TableAction.vue.js +222 -0
- package/dist/components/tt-table/src/components/TableAction.vue2.js +4 -0
- package/dist/components/tt-table/src/components/TableButtons.js +117 -0
- package/dist/components/tt-table/src/components/TableColumnModal.vue2.js +234 -0
- package/dist/components/tt-table/src/components/TableColumnModal.vue3.js +5 -0
- package/dist/components/tt-table/src/components/TableToobalTools.vue.js +87 -0
- package/dist/components/tt-table/src/components/TableToobalTools.vue2.js +4 -0
- package/dist/components/tt-table/src/emits.js +15 -0
- package/dist/components/tt-table/src/hooks/useCellArea.js +15 -0
- package/dist/components/tt-table/src/hooks/useColumns.js +275 -0
- package/dist/components/tt-table/src/hooks/useCustomColumns.js +53 -0
- package/dist/components/tt-table/src/hooks/useDataSource.js +224 -0
- package/dist/components/tt-table/src/hooks/useLeftRightSlot.js +64 -0
- package/dist/components/tt-table/src/hooks/usePagination.js +44 -0
- package/dist/components/tt-table/src/hooks/useRowSelection.js +84 -0
- package/dist/components/tt-table/src/hooks/useTableContext.js +20 -0
- package/dist/components/tt-table/src/hooks/useTableEvent.js +197 -0
- package/dist/components/tt-table/src/hooks/useTableForm.js +60 -0
- package/dist/components/tt-table/src/hooks/useTableRender.js +33 -0
- package/dist/components/tt-table/src/hooks/useTableSlot.js +17 -0
- package/dist/components/tt-table/src/props.js +482 -0
- package/dist/components/tt-table/src/toolProps.js +30 -0
- package/dist/components/tt-table/src/utils/context.js +17 -0
- package/dist/components/tt-table/src/utils/table-api.js +386 -0
- package/dist/components/tt-table/src/utils/table-form-api.js +122 -0
- package/dist/components/tt-text/index.js +7 -0
- package/dist/components/tt-text/index.vue.js +7 -0
- package/dist/components/tt-text/index.vue2.js +73 -0
- package/dist/components/tt-upload/index.js +9 -0
- package/dist/components/tt-upload/src/TtUpload.vue.js +306 -0
- package/dist/components/tt-upload/src/TtUpload.vue2.js +4 -0
- package/dist/components/tt-upload/src/typing.js +107 -0
- package/dist/directives/auto-tip/index.js +62 -0
- package/dist/directives/dialog-resize/index.js +49 -0
- package/dist/directives/dialog-resize/use-css-variable.js +44 -0
- package/dist/directives/dialog-resize/use-draggable.js +35 -0
- package/dist/directives/dialog-resize/use-fullscreen.js +38 -0
- package/dist/directives/dialog-resize/use-parse-translate.js +9 -0
- package/dist/directives/dialog-resize/use-resizer.js +37 -0
- package/dist/directives/disabled-tip/index.js +78 -0
- package/dist/directives/index.js +8 -0
- package/dist/hooks/useDataPermissionOptions.js +142 -0
- package/dist/hooks/useFormSchemasLink.js +261 -0
- package/dist/hooks/useFormat.js +44 -0
- package/dist/hooks/useLoading.js +22 -0
- package/dist/hooks/useScreenshotOss.js +69 -0
- package/dist/hooks/useSetup.js +59 -0
- package/dist/hooks/useTable.js +13 -0
- package/dist/hooks/useTemplateSlot.js +13 -0
- package/dist/index.js +142 -60274
- package/dist/plugins/default/renderCellContent.js +58 -0
- package/dist/plugins/vxeTable/switchStatus.js +91 -0
- package/dist/plugins.js +4 -146
- package/dist/style.css +1 -1
- package/dist/utils/xhr.js +8 -0
- package/package.json +5 -3
- package/dist/index-NG5FNCLD.js +0 -3430
- package/dist/index.modern-4Cf3dcJP.js +0 -3069
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
import { defineComponent as de, mergeModels as z, useModel as ce, useSlots as fe, ref as b, computed as m, createBlock as pe, openBlock as me, createVNode as a, mergeProps as we, createTextVNode as w } from "vue";
|
|
2
|
+
import ve from "../../../assets/svg/exportSvg.svg.js";
|
|
3
|
+
import A from "../../../assets/svg/fileSvg.svg.js";
|
|
4
|
+
import { TtButton as $ } from "../../tt-button/index.js";
|
|
5
|
+
import { TtIcon as S } from "../../tt-icon/index.js";
|
|
6
|
+
import "../../tt-modal/index.js";
|
|
7
|
+
import { useDesign as ge } from "@dazhicheng/hooks";
|
|
8
|
+
import { TtText as R } from "../../tt-text/index.js";
|
|
9
|
+
import { ElMessage as f, ElImageViewer as _e, ElUpload as he } from "element-plus";
|
|
10
|
+
import { omit as ye, isFunction as V } from "lodash-es";
|
|
11
|
+
import { isString as Ue, isNumber as be } from "@dazhicheng/utils";
|
|
12
|
+
/* empty css */
|
|
13
|
+
import { ttUploadProps as $e } from "./typing.js";
|
|
14
|
+
import { GlobalConfig as F } from "../../../hooks/useSetup.js";
|
|
15
|
+
import { useModalRender as Se } from "../../tt-modal/src/hooks/useModalRender.js";
|
|
16
|
+
const De = /* @__PURE__ */ de({
|
|
17
|
+
name: "TtUpload",
|
|
18
|
+
__name: "TtUpload",
|
|
19
|
+
props: /* @__PURE__ */ z($e, {
|
|
20
|
+
modelValue: {
|
|
21
|
+
default: () => []
|
|
22
|
+
},
|
|
23
|
+
modelModifiers: {}
|
|
24
|
+
}),
|
|
25
|
+
emits: /* @__PURE__ */ z(["afterUpload", "preview", "download", "delete", "templateDownload", "ok", "close", "error"], ["update:modelValue"]),
|
|
26
|
+
setup(C, {
|
|
27
|
+
expose: N,
|
|
28
|
+
emit: P
|
|
29
|
+
}) {
|
|
30
|
+
const D = ["modal", "modelValue", "uploadOssApi", "uploadTip", "maxSize", "showFileList", "showTemplateDownload", "templateText", "showPreview", "showDownload", "showDelete", "gridThreshold", "gridColumns", "showCount", "uploadOssViewApi", "beforeUpload", "onError"], I = /* @__PURE__ */ new Set(["jpg", "jpeg", "png", "gif", "webp", "bmp", "svg"]);
|
|
31
|
+
function B(e) {
|
|
32
|
+
var t;
|
|
33
|
+
const o = ((t = e.split(".").pop()) == null ? void 0 : t.toLowerCase()) || "";
|
|
34
|
+
return I.has(o);
|
|
35
|
+
}
|
|
36
|
+
function K(e, o, t) {
|
|
37
|
+
var u;
|
|
38
|
+
if (!(t != null && t.trim())) return !0;
|
|
39
|
+
const l = e.includes(".") ? ((u = e.split(".").pop()) == null ? void 0 : u.toLowerCase()) ?? "" : "";
|
|
40
|
+
return t.split(",").map((p) => p.trim()).filter(Boolean).some((p) => p.startsWith(".") ? l === p.slice(1).toLowerCase() : p.endsWith("/*") ? o.startsWith(p.slice(0, -1)) : o === p);
|
|
41
|
+
}
|
|
42
|
+
const n = C, c = P, s = ce(C, "modelValue"), d = fe(), {
|
|
43
|
+
prefixCls: r
|
|
44
|
+
} = ge("upload"), x = b(), y = b(!1), k = b([]), [j, v] = Se({
|
|
45
|
+
onOk() {
|
|
46
|
+
c("ok", s.value);
|
|
47
|
+
},
|
|
48
|
+
onClose() {
|
|
49
|
+
v.closeModal(), c("close");
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
function W() {
|
|
53
|
+
return [...s.value];
|
|
54
|
+
}
|
|
55
|
+
N({
|
|
56
|
+
openModal: () => {
|
|
57
|
+
s.value = [], v.openModal();
|
|
58
|
+
},
|
|
59
|
+
setModalProps: v.setModalProps,
|
|
60
|
+
closeModal: v.closeModal,
|
|
61
|
+
getFileList: W
|
|
62
|
+
});
|
|
63
|
+
const U = m(() => s.value.length > n.gridThreshold), g = m(() => n.limit ?? 0), _ = m(() => n.uploadOssApi ?? F.uploadOssApi), G = m(() => n.uploadOssViewApi ?? F.uploadOssViewApi);
|
|
64
|
+
async function q(e, o) {
|
|
65
|
+
const l = `${n.ossDir || o.dir || "notice"}/${Date.now()}_${e.name}`, i = new FormData();
|
|
66
|
+
i.append("key", l), i.append("policy", o.policy), i.append("x-oss-signature-version", o.version), i.append("x-oss-signature", o.signature), i.append("x-oss-credential", o.x_oss_credential), i.append("x-oss-date", o.x_oss_date), i.append("x-oss-security-token", o.security_token), o.callback && i.append("callback", o.callback), i.append("success_action_status", "200"), i.append("file", e);
|
|
67
|
+
const u = await fetch(o.host, {
|
|
68
|
+
method: "POST",
|
|
69
|
+
body: i
|
|
70
|
+
});
|
|
71
|
+
if (!u.ok && u.status !== 203)
|
|
72
|
+
throw new Error(`OSS 上传失败: ${u.status}`);
|
|
73
|
+
return l;
|
|
74
|
+
}
|
|
75
|
+
function L(e) {
|
|
76
|
+
const o = e.uid;
|
|
77
|
+
s.value = s.value.filter((t) => {
|
|
78
|
+
var l;
|
|
79
|
+
return t.uid !== o && ((l = t.file) == null ? void 0 : l.uid) !== o;
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function T(e, o) {
|
|
83
|
+
throw L(o.file), e;
|
|
84
|
+
}
|
|
85
|
+
async function X(e) {
|
|
86
|
+
var o;
|
|
87
|
+
try {
|
|
88
|
+
const t = e.file, l = URL.createObjectURL(t), i = {
|
|
89
|
+
fileName: t.name,
|
|
90
|
+
fileSize: t.size ?? 0,
|
|
91
|
+
fileSuffix: ((o = t.name.split(".").pop()) == null ? void 0 : o.toLowerCase()) || "",
|
|
92
|
+
file: t,
|
|
93
|
+
uid: t.uid,
|
|
94
|
+
url: l
|
|
95
|
+
};
|
|
96
|
+
return s.value = [...s.value, i], c("afterUpload", i), e.onSuccess(i), i;
|
|
97
|
+
} catch (t) {
|
|
98
|
+
f.warning((t == null ? void 0 : t.message) ?? "上传失败"), T(t, e);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
async function Y(e) {
|
|
102
|
+
var t;
|
|
103
|
+
const o = _.value;
|
|
104
|
+
try {
|
|
105
|
+
const l = await o(e.file), i = await q(e.file, l), u = {
|
|
106
|
+
fileName: e.file.name,
|
|
107
|
+
ossUploadBaseDir: l.dir,
|
|
108
|
+
ossKey: i,
|
|
109
|
+
fileSize: e.file.size ?? 0,
|
|
110
|
+
fileSuffix: ((t = e.file.name.split(".").pop()) == null ? void 0 : t.toLowerCase()) || "",
|
|
111
|
+
file: e.file,
|
|
112
|
+
uid: e.file.uid
|
|
113
|
+
};
|
|
114
|
+
s.value = [...s.value, u], f.success("上传成功"), c("afterUpload", u), e.onSuccess(l);
|
|
115
|
+
} catch (l) {
|
|
116
|
+
f.warning((l == null ? void 0 : l.message) ?? "上传失败"), T(l, e);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
function H(e, o, t) {
|
|
120
|
+
var l;
|
|
121
|
+
o.raw && (L(o.raw), c("error", e, o.raw)), (l = n.onError) == null || l.call(n, e, o, t);
|
|
122
|
+
}
|
|
123
|
+
const J = m(() => ({
|
|
124
|
+
...ye(n, D),
|
|
125
|
+
showFileList: !1,
|
|
126
|
+
beforeUpload: Q,
|
|
127
|
+
onExceed: Z,
|
|
128
|
+
onError: H,
|
|
129
|
+
action: "",
|
|
130
|
+
autoUpload: !0,
|
|
131
|
+
httpRequest: _.value ? Y : X
|
|
132
|
+
}));
|
|
133
|
+
function Q(e) {
|
|
134
|
+
if (!K(e.name, e.type, n.accept))
|
|
135
|
+
return f.warning(`文件格式不支持,仅支持:${n.accept}`), !1;
|
|
136
|
+
const o = s.value.map((t) => Ue(t.fileSize) || be(t.fileSize) ? +t.fileSize : 0).reduce((t, l) => t + l, 0);
|
|
137
|
+
return n.maxSize && (e.size + o) / 1024 / 1024 > n.maxSize ? (f.warning(`文件大小不能超过 ${n.maxSize}MB`), !1) : g.value > 0 && s.value.length >= g.value ? (f.warning("已超过上传数量"), !1) : V(n.beforeUpload) ? n.beforeUpload(e) : !0;
|
|
138
|
+
}
|
|
139
|
+
function Z() {
|
|
140
|
+
f.warning("已超过上传数量");
|
|
141
|
+
}
|
|
142
|
+
function h(e) {
|
|
143
|
+
return e.ossKey ? e.ossKey : e.uid != null ? e.uid : e.fileName;
|
|
144
|
+
}
|
|
145
|
+
function ee(e) {
|
|
146
|
+
var l;
|
|
147
|
+
const o = h(e);
|
|
148
|
+
if (!o)
|
|
149
|
+
throw new Error("No OssKey");
|
|
150
|
+
const t = s.value.filter((i) => h(i) !== o);
|
|
151
|
+
t.length !== s.value.length && (s.value = t), e.file && ((l = x.value) == null || l.handleRemove(e.file)), c("delete", e);
|
|
152
|
+
}
|
|
153
|
+
async function E(e) {
|
|
154
|
+
var t;
|
|
155
|
+
const o = G.value;
|
|
156
|
+
if (!(!o || !e.ossKey))
|
|
157
|
+
try {
|
|
158
|
+
const i = (t = (await o({
|
|
159
|
+
filePath: e.ossKey
|
|
160
|
+
})).find((u) => u.fileName === e.ossKey)) == null ? void 0 : t.fileUrl;
|
|
161
|
+
return e.url = i, i;
|
|
162
|
+
} catch (l) {
|
|
163
|
+
f.warning((l == null ? void 0 : l.message) ?? "获取文件地址失败");
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
async function oe(e, o) {
|
|
168
|
+
const l = await (await fetch(e)).blob(), i = URL.createObjectURL(l), u = document.createElement("a");
|
|
169
|
+
u.href = i, u.download = o, u.click(), URL.revokeObjectURL(i);
|
|
170
|
+
}
|
|
171
|
+
async function te(e) {
|
|
172
|
+
c("preview", e);
|
|
173
|
+
let o = await E(e);
|
|
174
|
+
_.value || (o = URL.createObjectURL(e.file)), o && (B(e.fileName) ? (k.value = [o], y.value = !0) : window.open(o, "_blank"));
|
|
175
|
+
}
|
|
176
|
+
async function le(e) {
|
|
177
|
+
let o = !1;
|
|
178
|
+
if (o = V(n.beforeDownload) ? !!await n.beforeDownload(e) : n.beforeDownload, !o) {
|
|
179
|
+
c("download", e);
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
let t;
|
|
183
|
+
_.value ? t = await E(e) : t = URL.createObjectURL(e.file), t && oe(t, e.fileName);
|
|
184
|
+
}
|
|
185
|
+
const ae = () => a("div", {
|
|
186
|
+
class: `${r}-area`
|
|
187
|
+
}, [a(he, we({
|
|
188
|
+
ref: x
|
|
189
|
+
}, J.value), {
|
|
190
|
+
default: () => {
|
|
191
|
+
var e, o;
|
|
192
|
+
return [((e = d.uploadContent) == null ? void 0 : e.call(d)) || a("div", {
|
|
193
|
+
class: `${r}-dragger`
|
|
194
|
+
}, [a(S, {
|
|
195
|
+
icon: ve,
|
|
196
|
+
size: 32,
|
|
197
|
+
isCustomSvg: !0
|
|
198
|
+
}, null), a("div", {
|
|
199
|
+
class: `${r}-dragger__text`
|
|
200
|
+
}, [w("上传附件")]), a("div", {
|
|
201
|
+
class: `${r}-dragger__tip`
|
|
202
|
+
}, [((o = d.uploadTip) == null ? void 0 : o.call(d)) || n.uploadTip]), n.showTemplateDownload && a("div", {
|
|
203
|
+
class: `${r}-dragger__template`,
|
|
204
|
+
onClick: (t) => {
|
|
205
|
+
t.stopPropagation(), c("templateDownload");
|
|
206
|
+
}
|
|
207
|
+
}, [n.templateText])])];
|
|
208
|
+
}
|
|
209
|
+
})]), O = (e, o) => d.fileActions ? d.fileActions({
|
|
210
|
+
file: e,
|
|
211
|
+
index: o
|
|
212
|
+
}) : a("div", {
|
|
213
|
+
class: `${r}-file__actions`
|
|
214
|
+
}, [n.showPreview && a($, {
|
|
215
|
+
type: "primary",
|
|
216
|
+
link: !0,
|
|
217
|
+
onClick: () => te(e)
|
|
218
|
+
}, {
|
|
219
|
+
default: () => [w("查看")]
|
|
220
|
+
}), n.showDownload && a($, {
|
|
221
|
+
type: "primary",
|
|
222
|
+
link: !0,
|
|
223
|
+
onClick: () => le(e)
|
|
224
|
+
}, {
|
|
225
|
+
default: () => [w("下载")]
|
|
226
|
+
}), n.showDelete && a($, {
|
|
227
|
+
type: "danger",
|
|
228
|
+
link: !0,
|
|
229
|
+
onClick: () => ee(e)
|
|
230
|
+
}, {
|
|
231
|
+
default: () => [w("删除")]
|
|
232
|
+
})]), ne = (e, o) => a("div", {
|
|
233
|
+
class: `${r}-file__card`,
|
|
234
|
+
key: h(e)
|
|
235
|
+
}, [a("div", {
|
|
236
|
+
class: `${r}-file__card-header`
|
|
237
|
+
}, [a("div", {
|
|
238
|
+
class: `${r}-file__card-icon`
|
|
239
|
+
}, [a(S, {
|
|
240
|
+
icon: A,
|
|
241
|
+
size: 28,
|
|
242
|
+
isCustomSvg: !0
|
|
243
|
+
}, null)]), a("div", {
|
|
244
|
+
class: `${r}-file__card-info`
|
|
245
|
+
}, [a(R, {
|
|
246
|
+
class: `${r}-file__card-name`
|
|
247
|
+
}, {
|
|
248
|
+
default: () => [e.fileName]
|
|
249
|
+
})])]), a("div", {
|
|
250
|
+
class: `${r}-file__card-footer`
|
|
251
|
+
}, [O(e, o)])]), ie = (e, o) => a("div", {
|
|
252
|
+
class: `${r}-file__row`,
|
|
253
|
+
key: h(e)
|
|
254
|
+
}, [a("div", {
|
|
255
|
+
class: `${r}-file__row-icon`
|
|
256
|
+
}, [a(S, {
|
|
257
|
+
icon: A,
|
|
258
|
+
size: 28,
|
|
259
|
+
isCustomSvg: !0
|
|
260
|
+
}, null)]), a("div", {
|
|
261
|
+
class: `${r}-file__row-info`
|
|
262
|
+
}, [a(R, {
|
|
263
|
+
class: `${r}-file__row-name`
|
|
264
|
+
}, {
|
|
265
|
+
default: () => [e.fileName]
|
|
266
|
+
})]), a("div", {
|
|
267
|
+
class: `${r}-file__row-actions`
|
|
268
|
+
}, [O(e, o)])]), re = (e, o) => d.fileItem ? d.fileItem({
|
|
269
|
+
file: e,
|
|
270
|
+
index: o
|
|
271
|
+
}) : U.value ? ne(e, o) : ie(e, o), se = () => {
|
|
272
|
+
if (!n.showFileList || s.value.length === 0) return null;
|
|
273
|
+
const e = s.value.map((l, i) => re(l, i)), o = U.value ? `${r}-filelist__grid` : `${r}-filelist__list`, t = U.value ? {
|
|
274
|
+
gridTemplateColumns: `repeat(${n.gridColumns}, 1fr)`
|
|
275
|
+
} : void 0;
|
|
276
|
+
return a("div", {
|
|
277
|
+
class: `${r}-filelist`
|
|
278
|
+
}, [a("div", {
|
|
279
|
+
class: o,
|
|
280
|
+
style: t
|
|
281
|
+
}, [e]), n.showCount && g.value > 0 && a("div", {
|
|
282
|
+
class: `${r}-filelist__count`
|
|
283
|
+
}, [a("span", {
|
|
284
|
+
class: `${r}-filelist__count-current-number`
|
|
285
|
+
}, [s.value.length]), a("span", null, [w(" / ")]), a("span", {
|
|
286
|
+
class: `${r}-filelist__count-total-number`
|
|
287
|
+
}, [g.value])])]);
|
|
288
|
+
}, M = () => {
|
|
289
|
+
var e;
|
|
290
|
+
return a("div", {
|
|
291
|
+
class: r
|
|
292
|
+
}, [ae(), se(), (e = d.footer) == null ? void 0 : e.call(d), y.value && a(_e, {
|
|
293
|
+
urlList: k.value,
|
|
294
|
+
hideOnClickModal: !0,
|
|
295
|
+
teleported: !0,
|
|
296
|
+
onClose: () => y.value = !1
|
|
297
|
+
}, null)]);
|
|
298
|
+
}, ue = () => n.modal ? a(j, null, {
|
|
299
|
+
default: () => M()
|
|
300
|
+
}) : M();
|
|
301
|
+
return (e, o) => (me(), pe(ue));
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
export {
|
|
305
|
+
De as default
|
|
306
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { uploadProps as e } from "element-plus";
|
|
2
|
+
const o = {
|
|
3
|
+
...e,
|
|
4
|
+
action: {
|
|
5
|
+
type: String,
|
|
6
|
+
default: ""
|
|
7
|
+
},
|
|
8
|
+
accept: {
|
|
9
|
+
type: String,
|
|
10
|
+
default: ".pdf,.xlsx,.xls,.doc,.docx,.jpg,.jpeg,.png"
|
|
11
|
+
},
|
|
12
|
+
/** 上传前的钩子;在内置类型/大小/数量校验通过后调用,返回 false 可阻止上传 */
|
|
13
|
+
beforeUpload: e.beforeUpload,
|
|
14
|
+
multiple: {
|
|
15
|
+
type: Boolean,
|
|
16
|
+
default: !0
|
|
17
|
+
},
|
|
18
|
+
drag: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: !0
|
|
21
|
+
},
|
|
22
|
+
/** 是否使用弹框模式 */
|
|
23
|
+
modal: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: !0
|
|
26
|
+
},
|
|
27
|
+
/** 获取 OSS 签名信息的接口 ,不传则使用全局 setup 的 uploadOssApi */
|
|
28
|
+
uploadOssApi: {
|
|
29
|
+
type: Function,
|
|
30
|
+
default: void 0
|
|
31
|
+
},
|
|
32
|
+
/** 根据 ossKey 获取文件预览/下载 URL 的接口,不传则使用全局 setup 的 uploadOssViewApi */
|
|
33
|
+
uploadOssViewApi: {
|
|
34
|
+
type: Function,
|
|
35
|
+
default: void 0
|
|
36
|
+
},
|
|
37
|
+
/** 上传提示文字 */
|
|
38
|
+
uploadTip: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: "可以上传pdf、excel、word、图片格式"
|
|
41
|
+
},
|
|
42
|
+
/** 最大上传文件大小(MB) */
|
|
43
|
+
maxSize: {
|
|
44
|
+
type: Number,
|
|
45
|
+
default: void 0
|
|
46
|
+
},
|
|
47
|
+
/** 是否显示已上传列表 */
|
|
48
|
+
showFileList: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
default: !0
|
|
51
|
+
},
|
|
52
|
+
/** 是否显示模板下载链接 */
|
|
53
|
+
showTemplateDownload: {
|
|
54
|
+
type: Boolean,
|
|
55
|
+
default: !1
|
|
56
|
+
},
|
|
57
|
+
/** 模板下载链接文字 */
|
|
58
|
+
templateText: {
|
|
59
|
+
type: String,
|
|
60
|
+
default: "模板下载"
|
|
61
|
+
},
|
|
62
|
+
/** 是否显示查看按钮 */
|
|
63
|
+
showPreview: {
|
|
64
|
+
type: Boolean,
|
|
65
|
+
default: !0
|
|
66
|
+
},
|
|
67
|
+
/** 是否显示下载按钮 */
|
|
68
|
+
showDownload: {
|
|
69
|
+
type: Boolean,
|
|
70
|
+
default: !0
|
|
71
|
+
},
|
|
72
|
+
/** 是否显示删除按钮 */
|
|
73
|
+
showDelete: {
|
|
74
|
+
type: Boolean,
|
|
75
|
+
default: !0
|
|
76
|
+
},
|
|
77
|
+
/** 文件数量达到该值时切换为网格布局 */
|
|
78
|
+
gridThreshold: {
|
|
79
|
+
type: Number,
|
|
80
|
+
default: 4
|
|
81
|
+
},
|
|
82
|
+
/** 网格模式下每行列数 */
|
|
83
|
+
gridColumns: {
|
|
84
|
+
type: Number,
|
|
85
|
+
default: 4
|
|
86
|
+
},
|
|
87
|
+
/** 显示已上传数量统计(需传入 limit) */
|
|
88
|
+
showCount: {
|
|
89
|
+
type: Boolean,
|
|
90
|
+
default: !0
|
|
91
|
+
},
|
|
92
|
+
/** 自定义oss存储目录 */
|
|
93
|
+
ossDir: {
|
|
94
|
+
type: String,
|
|
95
|
+
default: void 0
|
|
96
|
+
},
|
|
97
|
+
/**
|
|
98
|
+
* 下载前的参数
|
|
99
|
+
*/
|
|
100
|
+
beforeDownload: {
|
|
101
|
+
type: [Boolean, Function],
|
|
102
|
+
default: !1
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
export {
|
|
106
|
+
o as ttUploadProps
|
|
107
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { createVNode as l, Fragment as s, render as d } from "vue";
|
|
2
|
+
import { ElTooltip as r } from "element-plus";
|
|
3
|
+
const n = {
|
|
4
|
+
value: null
|
|
5
|
+
};
|
|
6
|
+
function c(t) {
|
|
7
|
+
const e = !!(t != null && t.textContent), o = t.scrollWidth > t.clientWidth, i = t.scrollHeight >= t.clientHeight * 1.2;
|
|
8
|
+
return e && (o || i);
|
|
9
|
+
}
|
|
10
|
+
function u(t) {
|
|
11
|
+
const e = t.currentTarget;
|
|
12
|
+
if (n.value && (n.value.props.trigger = "manual"), !!e.boundingValue && c(e)) {
|
|
13
|
+
if (!n.value) {
|
|
14
|
+
const o = l(r, {
|
|
15
|
+
content: "",
|
|
16
|
+
placement: e.boundingValue.placement || "top",
|
|
17
|
+
teleported: !1,
|
|
18
|
+
// 确保 tooltip 在当前 DOM 中
|
|
19
|
+
manual: !0,
|
|
20
|
+
// 手动控制显示隐藏
|
|
21
|
+
virtualTriggering: !0,
|
|
22
|
+
// fallbackPlacements: ['right', 'left', 'top', 'bottom'],
|
|
23
|
+
virtualRef: e,
|
|
24
|
+
hideAfter: 100,
|
|
25
|
+
popperClass: "!z-[9999]"
|
|
26
|
+
// trigger: 'hover',
|
|
27
|
+
// enterable: true,
|
|
28
|
+
}, {
|
|
29
|
+
content: () => l(s, null, [l("div", {
|
|
30
|
+
class: "tt-tip-el-popper-content"
|
|
31
|
+
}, [e.textContent])])
|
|
32
|
+
}), i = document.createElement("div");
|
|
33
|
+
d(o, i), document.body.appendChild(i), n.value = o.component;
|
|
34
|
+
}
|
|
35
|
+
n.value.props.content = e.boundingValue.content || e.textContent, n.value.props.placement = e.boundingValue.placement || "top", n.value.props.fallbackPlacements = ["right", "left", "top", "bottom"], n.value.props.trigger = "hover", n.value.props.popperClass = "tt-tip-el-popper", n.value.props.virtualRef = e, n.value.exposed.onOpen(), setTimeout(() => {
|
|
36
|
+
const o = document.querySelector(".tt-tip-el-popper-content");
|
|
37
|
+
o && (o.style.maxWidth = `${e.boundingValue.toolTipMaxWidth || 400}px`, o.style.maxHeight = `${e.boundingValue.toolTipMaxHeight || 600}px`, o.textContent = e.textContent), n.value.exposed.updatePopper();
|
|
38
|
+
}, 20);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function a() {
|
|
42
|
+
n.value && n.value.exposed.onClose();
|
|
43
|
+
}
|
|
44
|
+
function p(t, {
|
|
45
|
+
value: e = {}
|
|
46
|
+
}) {
|
|
47
|
+
const o = e === void 0 ? {} : e;
|
|
48
|
+
t.boundingValue = o, o && !(o != null && o.listened) && (t.addEventListener("mouseenter", u), t.addEventListener("mouseleave", a), t.boundingValue.listened = !0);
|
|
49
|
+
}
|
|
50
|
+
function v(t) {
|
|
51
|
+
var e;
|
|
52
|
+
(e = t.boundingValue) != null && e.listened && (t.removeEventListener("mouseenter", u), t.removeEventListener("mouseleave", a), n.value && n.value.exposed.onClose());
|
|
53
|
+
}
|
|
54
|
+
const g = {
|
|
55
|
+
created: p,
|
|
56
|
+
beforeMount: p,
|
|
57
|
+
updated: p,
|
|
58
|
+
unmounted: v
|
|
59
|
+
};
|
|
60
|
+
export {
|
|
61
|
+
g as default
|
|
62
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { isArray as E } from "lodash-es";
|
|
2
|
+
import { nextTick as M, computed as h } from "vue";
|
|
3
|
+
import R from "./use-css-variable.js";
|
|
4
|
+
import S from "./use-draggable.js";
|
|
5
|
+
import w from "./use-fullscreen.js";
|
|
6
|
+
import A from "./use-resizer.js";
|
|
7
|
+
const l = {};
|
|
8
|
+
function v(u, r, t) {
|
|
9
|
+
var f, m, p;
|
|
10
|
+
const o = E(t.children), a = (m = (f = t.children[0]) == null ? void 0 : f.props) == null ? void 0 : m.modelValue;
|
|
11
|
+
if (!o || !a) return;
|
|
12
|
+
const n = ((p = t.ctx) == null ? void 0 : p.uid) || `D_${Math.random()}`;
|
|
13
|
+
l[n] = l[n] ?? [];
|
|
14
|
+
const c = l[n], d = u.getAttribute("aria-tt-id") || u.getAttribute("aria-tt-id");
|
|
15
|
+
d && M(() => {
|
|
16
|
+
var g, b;
|
|
17
|
+
const _ = t.children[0].component, s = document, y = s == null ? void 0 : s.querySelector(`.${d} .el-overlay-dialog`);
|
|
18
|
+
if (!y)
|
|
19
|
+
return;
|
|
20
|
+
y.style.overflow = "hidden";
|
|
21
|
+
const e = s.querySelector(`.${d} .el-dialog`);
|
|
22
|
+
e.style.display = "flex", e.style.flexDirection = "column", e.style.overflow = "auto";
|
|
23
|
+
const x = e.querySelector(".el-dialog__body");
|
|
24
|
+
x.style.flexGrow = "1";
|
|
25
|
+
const z = e.querySelector("header.el-dialog__header"), D = h(() => {
|
|
26
|
+
var i;
|
|
27
|
+
return ((i = r.value) == null ? void 0 : i.resizer) ?? !0;
|
|
28
|
+
}), q = h(() => {
|
|
29
|
+
var i;
|
|
30
|
+
return ((i = r.value) == null ? void 0 : i.draggable) ?? !1;
|
|
31
|
+
});
|
|
32
|
+
S(e, z, q, c, r), (g = r.value) != null && g.resizer && (R(e), A(e, D, c, r)), (b = r.value) != null && b.fullscreen && w(e, _);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
const C = {
|
|
36
|
+
mounted: v,
|
|
37
|
+
updated: v,
|
|
38
|
+
beforeUnmount: (u, r, t) => {
|
|
39
|
+
const o = t.ctx;
|
|
40
|
+
if (!(!(o != null && o.uid) || !l[o.uid])) {
|
|
41
|
+
for (const a of l[o.uid] ?? [])
|
|
42
|
+
typeof a == "function" && a();
|
|
43
|
+
l[o.uid] = [];
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
export {
|
|
48
|
+
C as default
|
|
49
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { useElementBounding as i } from "@vueuse/core";
|
|
2
|
+
import { watch as a, reactive as m } from "vue";
|
|
3
|
+
import { addUnit as o } from "./use-draggable.js";
|
|
4
|
+
function c(e) {
|
|
5
|
+
const l = e.querySelector("header.el-dialog__header");
|
|
6
|
+
{
|
|
7
|
+
const t = i(l);
|
|
8
|
+
a(
|
|
9
|
+
() => t.height,
|
|
10
|
+
(r) => {
|
|
11
|
+
requestAnimationFrame(
|
|
12
|
+
() => e.style.setProperty("--el-dialog-header-height", o(r.value))
|
|
13
|
+
);
|
|
14
|
+
},
|
|
15
|
+
{ immediate: !0 }
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
const s = e.querySelector("footer.el-dialog__footer");
|
|
19
|
+
if (s) {
|
|
20
|
+
const t = i(s);
|
|
21
|
+
a(
|
|
22
|
+
() => t.height,
|
|
23
|
+
(r) => {
|
|
24
|
+
requestAnimationFrame(
|
|
25
|
+
() => e.style.setProperty("--el-dialog-footer-height", o(r.value))
|
|
26
|
+
);
|
|
27
|
+
},
|
|
28
|
+
{ immediate: !0 }
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
const d = i(e);
|
|
32
|
+
a(
|
|
33
|
+
() => m([d.width.value, d.height.value]),
|
|
34
|
+
([t, r]) => {
|
|
35
|
+
requestAnimationFrame(() => {
|
|
36
|
+
e.style.setProperty("--el-dialog-width", o(t)), e.style.setProperty("--el-dialog-height", o(r));
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
{ immediate: !0, deep: !0 }
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
export {
|
|
43
|
+
c as default
|
|
44
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { isString as S, isNumber as U } from "lodash-es";
|
|
2
|
+
import { unref as x, watchEffect as j } from "vue";
|
|
3
|
+
import k from "./use-parse-translate.js";
|
|
4
|
+
function M(e, o = "px") {
|
|
5
|
+
if (!e) return "";
|
|
6
|
+
if (S(e))
|
|
7
|
+
return e;
|
|
8
|
+
if (U(e))
|
|
9
|
+
return `${e}${o}`;
|
|
10
|
+
}
|
|
11
|
+
function J(e, o, N, R, s) {
|
|
12
|
+
const t = x(e), n = x(o), c = (l) => {
|
|
13
|
+
var p, v, h, L, E, b;
|
|
14
|
+
const Y = l.clientX, $ = l.clientY, { x: a, y: i } = k(t.style.transform), T = ((v = (p = s.value) == null ? void 0 : p.draggableLimit) == null ? void 0 : v[1]) || 50, y = ((L = (h = s.value) == null ? void 0 : h.draggableLimit) == null ? void 0 : L[2]) || 50, D = ((b = (E = s.value) == null ? void 0 : E.draggableLimit) == null ? void 0 : b[3]) || 50, m = t.getBoundingClientRect(), u = m.left, d = m.top, W = m.width, B = document.documentElement.clientWidth, H = document.documentElement.clientHeight, _ = -u - W + D + a, q = -d + i, A = B - u - T + a, C = H - d - y + i, f = (w) => {
|
|
15
|
+
requestAnimationFrame(() => {
|
|
16
|
+
const F = Math.min(Math.max(a + w.clientX - Y, _), A), P = Math.min(Math.max(i + w.clientY - $, q), C);
|
|
17
|
+
t.style.transform = `translate(${M(F)}, ${M(P)})`;
|
|
18
|
+
});
|
|
19
|
+
}, g = () => {
|
|
20
|
+
document.removeEventListener("mousemove", f), document.removeEventListener("mouseup", g);
|
|
21
|
+
};
|
|
22
|
+
document.addEventListener("mousemove", f), document.addEventListener("mouseup", g);
|
|
23
|
+
}, X = () => {
|
|
24
|
+
n && t && (t.className = `${t.className} is-draggable`, n.addEventListener("mousedown", c));
|
|
25
|
+
}, r = () => {
|
|
26
|
+
n && t && (t.className = t.className.replace("is-draggable", ""), n.removeEventListener("mousedown", c));
|
|
27
|
+
};
|
|
28
|
+
j(() => {
|
|
29
|
+
N.value ? X() : r();
|
|
30
|
+
}), R.push(r);
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
M as addUnit,
|
|
34
|
+
J as default
|
|
35
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { nextTick as f, createVNode as d, render as m } from "vue";
|
|
2
|
+
import h from "../../assets/svg/quanping.svg.js";
|
|
3
|
+
import y from "../../assets/svg/suoxiao.svg.js";
|
|
4
|
+
import { TtIcon as g } from "../../components/tt-icon/index.js";
|
|
5
|
+
function C(n, r) {
|
|
6
|
+
var p;
|
|
7
|
+
const s = n.querySelector("header.el-dialog__header");
|
|
8
|
+
let i = !1, l;
|
|
9
|
+
function o() {
|
|
10
|
+
if (n.className.includes("is-draggable") && (i = !0), r.props.fullscreen || (l = s.getBoundingClientRect().width), r.props.fullscreen) {
|
|
11
|
+
if (!l) return;
|
|
12
|
+
n.style.setProperty("--el-dialog-width", `${l}px`), n.style.width = `${l}px`, l = void 0;
|
|
13
|
+
}
|
|
14
|
+
r.props.fullscreen = !r.props.fullscreen, !r.props.fullscreen && i && f(() => {
|
|
15
|
+
n.className = `${n.className} is-draggable`;
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
const e = s.querySelector(".el-dialog__headerbtn");
|
|
19
|
+
if (!e) return;
|
|
20
|
+
const t = document.createElement("button");
|
|
21
|
+
t.className = "el-dialog__headerbtn", t.type = "button", t.style.right = `${((e == null ? void 0 : e.getBoundingClientRect().width) || 0) * 2 + 6}px`, t.onclick = o;
|
|
22
|
+
function u() {
|
|
23
|
+
const a = d(g, {
|
|
24
|
+
icon: r.props.fullscreen ? y : h,
|
|
25
|
+
isCustomSvg: !0,
|
|
26
|
+
size: 14
|
|
27
|
+
}, null);
|
|
28
|
+
m(a, t);
|
|
29
|
+
}
|
|
30
|
+
t.onclick = () => {
|
|
31
|
+
o(), u();
|
|
32
|
+
}, u(), (p = e == null ? void 0 : e.parentNode) == null || p.insertBefore(t, e), s.appendChild(e);
|
|
33
|
+
const c = document.createElement("style");
|
|
34
|
+
c.type = "text/css", c.innerHTML = ".el-dialog.is-fullscreen {width:100%!important;height:100%!important;}", document.querySelector("head").appendChild(c);
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
C as default
|
|
38
|
+
};
|