@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,37 @@
|
|
|
1
|
+
import { unref as M, watchEffect as W } from "vue";
|
|
2
|
+
import $ from "./use-parse-translate.js";
|
|
3
|
+
function q(w, b, R, u) {
|
|
4
|
+
var g;
|
|
5
|
+
const t = M(w), e = document.createElement("div");
|
|
6
|
+
e.className = "el-dialog-resizer", e.style.width = "15px", e.style.height = "15px", e.style.zIndex = "3000", e.style.background = "transparent", e.style.position = "absolute", e.style.bottom = "0", e.style.right = "0", e.style.cursor = "se-resize";
|
|
7
|
+
let o, r;
|
|
8
|
+
const l = { x: 0, y: 0 };
|
|
9
|
+
let d;
|
|
10
|
+
const s = (g = u.value) == null ? void 0 : g.resizerLimit, a = (s == null ? void 0 : s[0]) || 260, m = (s == null ? void 0 : s[1]) || 180;
|
|
11
|
+
function h(n) {
|
|
12
|
+
requestAnimationFrame(() => {
|
|
13
|
+
var c, E;
|
|
14
|
+
const i = n.clientX - o.right + l.x, D = n.clientY - o.bottom + l.y, { x: H, y: L } = $(d), v = o.width + i, p = o.height + D, x = v > a ? v : a, z = p > m ? p : m;
|
|
15
|
+
t.style.width = `${x}px`, t.style.height = `${z}px`, t.style.transform = `translate(${H + i / 2}px,${L}px)`, (E = (c = u.value) == null ? void 0 : c.resizeChange) == null || E.call(c, x, z);
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
const y = (n) => {
|
|
19
|
+
document.body.style.userSelect = "none", document.body.style.cursor = "se-resize", o = t.getBoundingClientRect(), r = e.getBoundingClientRect(), l.x = r.right - n.clientX, l.y = r.bottom - n.clientY, d = t.style.transform === "" ? void 0 : t.style.transform;
|
|
20
|
+
function i() {
|
|
21
|
+
requestAnimationFrame(() => {
|
|
22
|
+
o = void 0, r = void 0, d = void 0, document.body.style.userSelect = "", document.body.style.cursor = "";
|
|
23
|
+
}), document.removeEventListener("mousemove", h), document.removeEventListener("mouseup", i);
|
|
24
|
+
}
|
|
25
|
+
document.addEventListener("mousemove", h), document.addEventListener("mouseup", i);
|
|
26
|
+
}, C = () => {
|
|
27
|
+
e && t && (e.addEventListener("mousedown", y), t.appendChild(e));
|
|
28
|
+
}, f = () => {
|
|
29
|
+
e && t && (e.removeEventListener("mousedown", y), t.removeChild(e));
|
|
30
|
+
};
|
|
31
|
+
W(() => {
|
|
32
|
+
b.value ? C() : f();
|
|
33
|
+
}), R.push(f);
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
q as default
|
|
37
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { isArray as p, isObject as c } from "@dazhicheng/utils";
|
|
2
|
+
import { ElTooltip as b } from "element-plus";
|
|
3
|
+
import { shallowRef as v, toValue as i, h as d, createVNode as g, render as h } from "vue";
|
|
4
|
+
let n;
|
|
5
|
+
const l = v();
|
|
6
|
+
function V(e) {
|
|
7
|
+
if (p(e) && e.length > 0)
|
|
8
|
+
return e.filter((t) => i(t.condition) ?? !0).map((t) => t.message);
|
|
9
|
+
if (c(e)) {
|
|
10
|
+
const t = e;
|
|
11
|
+
return !!i(t.condition) ? t.message : null;
|
|
12
|
+
}
|
|
13
|
+
return typeof e == "string" ? e : null;
|
|
14
|
+
}
|
|
15
|
+
function x(e) {
|
|
16
|
+
return p(e) && e.length > 0 ? e[0].placement || "bottom" : c(e) && e.placement || "bottom";
|
|
17
|
+
}
|
|
18
|
+
function y(e, t, o = "bottom") {
|
|
19
|
+
if (l.value = Array.isArray(t) ? t.map((r) => d("div", {}, r)) : t, n)
|
|
20
|
+
n.props.trigger = "hover", n.props.virtualRef = e, n.props.placement = o, n.exposed.updatePopper(), n.exposed.onOpen();
|
|
21
|
+
else {
|
|
22
|
+
const r = g(
|
|
23
|
+
b,
|
|
24
|
+
{
|
|
25
|
+
content: "",
|
|
26
|
+
placement: o,
|
|
27
|
+
effect: "dark",
|
|
28
|
+
manual: !0,
|
|
29
|
+
hideAfter: 0,
|
|
30
|
+
teleported: !1,
|
|
31
|
+
virtualTriggering: !0,
|
|
32
|
+
virtualRef: e,
|
|
33
|
+
popperClass: "!z-[9999]"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
content: () => d(
|
|
37
|
+
"div",
|
|
38
|
+
{
|
|
39
|
+
style: {
|
|
40
|
+
"font-size": "12px"
|
|
41
|
+
},
|
|
42
|
+
class: "tt-disabled-popper-content"
|
|
43
|
+
},
|
|
44
|
+
l.value
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
), u = document.createElement("div");
|
|
48
|
+
h(r, u), n = r.component, document.body.appendChild(u), n == null || n.exposed.onOpen();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
async function m(e) {
|
|
52
|
+
var u, a;
|
|
53
|
+
n && (n.props.trigger = "manual");
|
|
54
|
+
const t = e.currentTarget;
|
|
55
|
+
if (!t) return;
|
|
56
|
+
const o = (u = t.boundingValue) == null ? void 0 : u.messages, r = ((a = t.boundingValue) == null ? void 0 : a.placement) || "bottom";
|
|
57
|
+
o != null && o.length && t && y(t, o, r);
|
|
58
|
+
}
|
|
59
|
+
function f() {
|
|
60
|
+
n && n.exposed.onClose();
|
|
61
|
+
}
|
|
62
|
+
async function s(e, t) {
|
|
63
|
+
var a;
|
|
64
|
+
const o = t.value, r = V(o), u = x(o);
|
|
65
|
+
e.boundingValue = e.boundingValue || { listened: !1, messages: r, placement: u }, e.boundingValue.messages = r, e.boundingValue.placement = u, !((a = e.boundingValue) != null && a.listened) && (r != null && r.length) && (e.addEventListener("mouseenter", m), e.addEventListener("mouseleave", f), e.boundingValue.listened = !0);
|
|
66
|
+
}
|
|
67
|
+
const L = {
|
|
68
|
+
created: s,
|
|
69
|
+
beforeMount: s,
|
|
70
|
+
updated: s,
|
|
71
|
+
unmounted(e) {
|
|
72
|
+
var t, o;
|
|
73
|
+
(t = e.boundingValue) != null && t.listened && (e.removeEventListener("mouseenter", m), e.removeEventListener("mouseleave", f), (o = n == null ? void 0 : n.exposed) == null || o.onClose());
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
export {
|
|
77
|
+
L as default
|
|
78
|
+
};
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { queryDataPermissionDetailDataTypeContext as x, pageUser as T } from "../api/dataTypeContext.js";
|
|
2
|
+
import { ref as K, watchEffect as L, unref as q, watch as U, computed as b } from "vue";
|
|
3
|
+
import { useRoute as M } from "vue-router";
|
|
4
|
+
const c = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map();
|
|
5
|
+
let C, m;
|
|
6
|
+
const V = "all", _ = { label: "全部", value: V }, j = {
|
|
7
|
+
platformId: ["platformName", "platformId"],
|
|
8
|
+
shopId: ["shopName", "shopId"],
|
|
9
|
+
purchasePlaceId: ["purchasePlaceName", "purchasePlaceCode"],
|
|
10
|
+
businessType: ["itemName", "itemCode"],
|
|
11
|
+
lockUserId: ["userName", "userId"],
|
|
12
|
+
userId: ["fullName", "id"]
|
|
13
|
+
};
|
|
14
|
+
async function E() {
|
|
15
|
+
if (C) return C;
|
|
16
|
+
if (m) return m;
|
|
17
|
+
m = T({ pageNo: 1, pageSize: 9999 }).then((a) => {
|
|
18
|
+
const l = a.records || [];
|
|
19
|
+
return C = l, l;
|
|
20
|
+
});
|
|
21
|
+
try {
|
|
22
|
+
return await m;
|
|
23
|
+
} finally {
|
|
24
|
+
m = void 0;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function G(a) {
|
|
28
|
+
const l = M(), P = K({});
|
|
29
|
+
function p(t = {}) {
|
|
30
|
+
P.value = a.codes.reduce(
|
|
31
|
+
(e, r) => {
|
|
32
|
+
const [s, d] = j[r], y = (t[r] || []).map((f) => {
|
|
33
|
+
const u = r === "purchasePlaceId" ? f.purchaseInfo || {} : f;
|
|
34
|
+
return {
|
|
35
|
+
...f,
|
|
36
|
+
label: u == null ? void 0 : u[s],
|
|
37
|
+
value: u == null ? void 0 : u[d]
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
return e[r] = y, e;
|
|
41
|
+
},
|
|
42
|
+
{}
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
function N(t) {
|
|
46
|
+
var e;
|
|
47
|
+
return typeof a.showAll == "boolean" ? a.showAll : ((e = a.showAll) == null ? void 0 : e[t]) ?? !1;
|
|
48
|
+
}
|
|
49
|
+
function O() {
|
|
50
|
+
I.clear(), c.clear(), g.clear(), C = void 0, m = void 0;
|
|
51
|
+
}
|
|
52
|
+
function A(t) {
|
|
53
|
+
c.delete(t);
|
|
54
|
+
}
|
|
55
|
+
async function D(t = !1) {
|
|
56
|
+
const e = l.path, r = q(a.dataSource);
|
|
57
|
+
if (r) {
|
|
58
|
+
const i = { ...c.get(e) || {}, ...r };
|
|
59
|
+
c.set(e, i), p(i);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const s = c.get(e) || {};
|
|
63
|
+
let d = t ? [...a.codes] : a.codes.filter((n) => !Object.prototype.hasOwnProperty.call(s, n));
|
|
64
|
+
if (!d.length) {
|
|
65
|
+
p(s);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const y = t ? void 0 : I.get(e);
|
|
69
|
+
if (y) {
|
|
70
|
+
const n = await y, o = { ...c.get(e) || {}, ...n };
|
|
71
|
+
if (c.set(e, o), d = a.codes.filter((h) => !Object.prototype.hasOwnProperty.call(o, h)), !d.length) {
|
|
72
|
+
p(o);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const f = d.filter((n) => n !== "userId"), u = d.includes("userId"), v = Promise.all([
|
|
77
|
+
f.length ? x({ dataTypeName: f }).then(
|
|
78
|
+
(n) => n
|
|
79
|
+
) : Promise.resolve([]),
|
|
80
|
+
u ? E() : Promise.resolve(void 0)
|
|
81
|
+
]).then(([n, i]) => ({
|
|
82
|
+
...i ? { userId: i } : {},
|
|
83
|
+
...n.reduce((o, h) => {
|
|
84
|
+
const S = h == null ? void 0 : h.dataTypeCode;
|
|
85
|
+
return S && (o[S] = h.originalItems || []), o;
|
|
86
|
+
}, {})
|
|
87
|
+
})), w = (g.get(e) || 0) + 1;
|
|
88
|
+
g.set(e, w), I.set(e, v);
|
|
89
|
+
try {
|
|
90
|
+
const n = await v;
|
|
91
|
+
if (g.get(e) !== w) return;
|
|
92
|
+
const o = { ...c.get(e) || {}, ...n };
|
|
93
|
+
c.set(e, o), p(o);
|
|
94
|
+
} finally {
|
|
95
|
+
g.get(e) === w && I.delete(e);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
async function R() {
|
|
99
|
+
const t = l.path;
|
|
100
|
+
O(), A(t), await D(!0);
|
|
101
|
+
}
|
|
102
|
+
return L(() => {
|
|
103
|
+
const t = q(a.dataSource);
|
|
104
|
+
if (!t) return;
|
|
105
|
+
const e = l.path, s = { ...c.get(e) || {}, ...t };
|
|
106
|
+
c.set(e, s), p(s);
|
|
107
|
+
}), U(
|
|
108
|
+
() => l.path,
|
|
109
|
+
() => {
|
|
110
|
+
D();
|
|
111
|
+
},
|
|
112
|
+
{ immediate: !0 }
|
|
113
|
+
), {
|
|
114
|
+
/**
|
|
115
|
+
* 数据源
|
|
116
|
+
*/
|
|
117
|
+
dataSource: b(() => {
|
|
118
|
+
const t = a.codes.reduce(
|
|
119
|
+
(e, r) => {
|
|
120
|
+
const s = P.value[r] || [];
|
|
121
|
+
return e[r] = N(r) ? [_, ...s] : s, e;
|
|
122
|
+
},
|
|
123
|
+
{}
|
|
124
|
+
);
|
|
125
|
+
return new Proxy(t, {
|
|
126
|
+
get(e, r) {
|
|
127
|
+
return typeof r != "string" ? [] : t[r] || [];
|
|
128
|
+
},
|
|
129
|
+
set() {
|
|
130
|
+
return !1;
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
}),
|
|
134
|
+
/**
|
|
135
|
+
* @description 清空所有缓存,重新请求
|
|
136
|
+
*/
|
|
137
|
+
reload: R
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
export {
|
|
141
|
+
G as useDataPermissionOptions
|
|
142
|
+
};
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import { useDataPermissionOptions as j } from "./useDataPermissionOptions.js";
|
|
2
|
+
import { isFunction as E } from "@dazhicheng/utils";
|
|
3
|
+
import { ElSelectV2 as q } from "element-plus";
|
|
4
|
+
import { omit as y } from "lodash-es";
|
|
5
|
+
const u = "all", T = { label: "全部", value: u }, D = [
|
|
6
|
+
"platformId",
|
|
7
|
+
"shopId",
|
|
8
|
+
"purchasePlaceId",
|
|
9
|
+
"businessType",
|
|
10
|
+
"lockUserId",
|
|
11
|
+
"userId"
|
|
12
|
+
], z = {
|
|
13
|
+
platformId: "platformIds",
|
|
14
|
+
shopId: "shopIds",
|
|
15
|
+
purchasePlaceId: "purchasePlaceId",
|
|
16
|
+
businessType: "businessType",
|
|
17
|
+
lockUserId: "lockUserId"
|
|
18
|
+
}, G = {
|
|
19
|
+
platformId: "平台",
|
|
20
|
+
shopId: "店铺",
|
|
21
|
+
purchasePlaceId: "采购地",
|
|
22
|
+
businessType: "业务线",
|
|
23
|
+
lockUserId: "锁单人"
|
|
24
|
+
};
|
|
25
|
+
function k(t) {
|
|
26
|
+
return typeof t == "string" && t.toLowerCase() === u.toLowerCase();
|
|
27
|
+
}
|
|
28
|
+
function w(t) {
|
|
29
|
+
return Array.isArray(t) ? t : t == null || t === "" ? [] : [t];
|
|
30
|
+
}
|
|
31
|
+
function J(t = []) {
|
|
32
|
+
return [T].concat(t);
|
|
33
|
+
}
|
|
34
|
+
function K(t, c, i, b) {
|
|
35
|
+
return t ? E(t) ? t(c, i, b) : t : {};
|
|
36
|
+
}
|
|
37
|
+
function Q(t, c, i, b) {
|
|
38
|
+
var C;
|
|
39
|
+
c == null || c(t);
|
|
40
|
+
const a = b(), f = (C = a.values) == null ? void 0 : C[a.fieldName];
|
|
41
|
+
i == null || i(f, a);
|
|
42
|
+
}
|
|
43
|
+
function W(t = {}, c = D) {
|
|
44
|
+
const i = t.scene || "list", b = c.reduce(
|
|
45
|
+
(o, n) => (n === "userId" || (o[n] = A(n).showAll ?? !1), o),
|
|
46
|
+
{}
|
|
47
|
+
), { dataSource: a } = j({
|
|
48
|
+
codes: c,
|
|
49
|
+
dataSource: t.dataSource,
|
|
50
|
+
showAll: b
|
|
51
|
+
});
|
|
52
|
+
function f(o) {
|
|
53
|
+
return A(o).fieldName || z[o];
|
|
54
|
+
}
|
|
55
|
+
function C(o) {
|
|
56
|
+
return A(o).rules;
|
|
57
|
+
}
|
|
58
|
+
function S(o) {
|
|
59
|
+
return A(o).label || G[o];
|
|
60
|
+
}
|
|
61
|
+
function A(o) {
|
|
62
|
+
var n;
|
|
63
|
+
return ((n = t.fieldConfigs) == null ? void 0 : n[o]) || {};
|
|
64
|
+
}
|
|
65
|
+
function M(o, n) {
|
|
66
|
+
const e = A(o).dependencies;
|
|
67
|
+
if (!n) return e;
|
|
68
|
+
if (!e) return n;
|
|
69
|
+
const s = {
|
|
70
|
+
...n,
|
|
71
|
+
...e
|
|
72
|
+
};
|
|
73
|
+
if (n && e) {
|
|
74
|
+
const l = n.triggerFields, r = e.triggerFields;
|
|
75
|
+
s.triggerFields = r ?? l;
|
|
76
|
+
}
|
|
77
|
+
return s;
|
|
78
|
+
}
|
|
79
|
+
function P(o) {
|
|
80
|
+
return A(o).multiple ?? !0;
|
|
81
|
+
}
|
|
82
|
+
function F(o) {
|
|
83
|
+
return a.value[o] || [];
|
|
84
|
+
}
|
|
85
|
+
function _(o) {
|
|
86
|
+
return w(o).some((n) => k(n));
|
|
87
|
+
}
|
|
88
|
+
function O(o) {
|
|
89
|
+
const n = _(o), e = Array.isArray(o) ? o.length > 1 : !1;
|
|
90
|
+
return i === "action" && (n || e);
|
|
91
|
+
}
|
|
92
|
+
function B(o) {
|
|
93
|
+
const n = F("shopId"), e = w(o);
|
|
94
|
+
if (!e.length)
|
|
95
|
+
return i === "action" ? [] : n;
|
|
96
|
+
if (O(o)) return [];
|
|
97
|
+
const s = n.filter((r) => e.includes(r.platformId));
|
|
98
|
+
return !s.some((r) => k(r.value)) || s.length <= 1 ? s : J(s.filter((r) => !k(r.value)));
|
|
99
|
+
}
|
|
100
|
+
function x(o, n, e, s, l) {
|
|
101
|
+
const r = f(o), I = l ? s.filter((d) => {
|
|
102
|
+
var h;
|
|
103
|
+
return (h = n[r]) == null ? void 0 : h.includes(d.value);
|
|
104
|
+
}) || [] : s.find((d) => d.value === n[r]);
|
|
105
|
+
return {
|
|
106
|
+
values: n,
|
|
107
|
+
actions: e,
|
|
108
|
+
fieldName: r,
|
|
109
|
+
dataType: o,
|
|
110
|
+
options: s,
|
|
111
|
+
currentOption: I
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
function N(o, n, e, s, l) {
|
|
115
|
+
const r = A(o), I = K(r.componentProps, n, e, s), d = P(o), { onChange: h, ...m } = I, p = E(r.customOptions) ? r.customOptions(n, s) : s;
|
|
116
|
+
return {
|
|
117
|
+
multiple: d,
|
|
118
|
+
component: q,
|
|
119
|
+
...m,
|
|
120
|
+
options: p,
|
|
121
|
+
onChange(g) {
|
|
122
|
+
Q(
|
|
123
|
+
g,
|
|
124
|
+
l,
|
|
125
|
+
r.onChange,
|
|
126
|
+
() => x(o, n, e, p, d)
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
function L(o) {
|
|
132
|
+
return {
|
|
133
|
+
component: "TtApiComponent",
|
|
134
|
+
fieldName: f(o),
|
|
135
|
+
label: S(o),
|
|
136
|
+
rules: C(o),
|
|
137
|
+
dependencies: M(o),
|
|
138
|
+
componentProps: (e, s) => {
|
|
139
|
+
var h;
|
|
140
|
+
const l = F(o), r = f(o), I = P(o), d = ((h = e[r]) == null ? void 0 : h.at(-1)) !== u;
|
|
141
|
+
return N(o, e, s, l, (m) => {
|
|
142
|
+
const p = e[r];
|
|
143
|
+
I && (d && (m == null ? void 0 : m.at(-1)) === u ? e[r] = [u] : e[r] = p == null ? void 0 : p.filter((g) => g !== u));
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
const U = {
|
|
149
|
+
// 平台
|
|
150
|
+
platformId: {
|
|
151
|
+
component: "TtApiComponent",
|
|
152
|
+
fieldName: f("platformId"),
|
|
153
|
+
label: S("platformId"),
|
|
154
|
+
rules: C("platformId"),
|
|
155
|
+
componentProps: (o, n) => {
|
|
156
|
+
var m;
|
|
157
|
+
const e = "platformId", s = f(e), l = f("shopId"), r = P(e), I = P("shopId"), d = F(e), h = ((m = o[s]) == null ? void 0 : m.at(-1)) !== u;
|
|
158
|
+
return N(e, o, n, d, (p) => {
|
|
159
|
+
const g = o[s];
|
|
160
|
+
r && (h && (p == null ? void 0 : p.at(-1)) === u ? o[s] = [u] : o[s] = g == null ? void 0 : g.filter((V) => V !== u)), o[l] = I ? [] : void 0;
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
// 店铺
|
|
165
|
+
shopId: {
|
|
166
|
+
component: "TtApiComponent",
|
|
167
|
+
fieldName: f("shopId"),
|
|
168
|
+
label: S("shopId"),
|
|
169
|
+
componentProps: (o, n) => {
|
|
170
|
+
var h;
|
|
171
|
+
const e = "shopId", s = f(e), l = o[f("platformId")], r = B(l), I = P(e), d = ((h = o[s]) == null ? void 0 : h.at(-1)) !== u;
|
|
172
|
+
return N(e, o, n, r, (m) => {
|
|
173
|
+
const p = o[s];
|
|
174
|
+
I && (d && (m == null ? void 0 : m.at(-1)) === u ? o[s] = [u] : o[s] = p == null ? void 0 : p.filter((g) => g !== u));
|
|
175
|
+
});
|
|
176
|
+
},
|
|
177
|
+
dependencies: M("shopId", {
|
|
178
|
+
triggerFields: [f("platformId")],
|
|
179
|
+
disabled(o) {
|
|
180
|
+
return O(o[f("platformId")]);
|
|
181
|
+
},
|
|
182
|
+
rules(o) {
|
|
183
|
+
return O(o[f("platformId")]) ? null : C("shopId") || null;
|
|
184
|
+
}
|
|
185
|
+
})
|
|
186
|
+
},
|
|
187
|
+
purchasePlaceId: L("purchasePlaceId"),
|
|
188
|
+
businessType: L("businessType"),
|
|
189
|
+
lockUserId: L("lockUserId")
|
|
190
|
+
};
|
|
191
|
+
function R() {
|
|
192
|
+
return Object.keys(U).reduce(
|
|
193
|
+
(o, n) => {
|
|
194
|
+
var l;
|
|
195
|
+
const e = U[n], s = (l = t.fieldConfigs) == null ? void 0 : l[n];
|
|
196
|
+
return o[n] = {
|
|
197
|
+
...e,
|
|
198
|
+
...y(s, ["componentProps", "rules"])
|
|
199
|
+
}, o;
|
|
200
|
+
},
|
|
201
|
+
{}
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
return {
|
|
205
|
+
...R(),
|
|
206
|
+
dataSource: a
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
function H() {
|
|
210
|
+
const t = {
|
|
211
|
+
options: {},
|
|
212
|
+
codes: [...D]
|
|
213
|
+
}, c = {
|
|
214
|
+
/**
|
|
215
|
+
* @description 渲染查询场景
|
|
216
|
+
*/
|
|
217
|
+
list() {
|
|
218
|
+
return t.options.scene = "list", c;
|
|
219
|
+
},
|
|
220
|
+
/**
|
|
221
|
+
* @description 渲染新增编辑场景
|
|
222
|
+
*/
|
|
223
|
+
action() {
|
|
224
|
+
return t.options.scene = "action", c;
|
|
225
|
+
},
|
|
226
|
+
/**
|
|
227
|
+
* @param scene 场景值 list为查询 action为新增编辑等操作
|
|
228
|
+
* @returns FormSchemasLinkBuilder
|
|
229
|
+
*/
|
|
230
|
+
scene(i) {
|
|
231
|
+
return t.options.scene = i, c;
|
|
232
|
+
},
|
|
233
|
+
/**
|
|
234
|
+
* @param codes 接口请求所需要的入参,需要什么数据源就传什么入参
|
|
235
|
+
* @returns FormSchemasLinkBuilder
|
|
236
|
+
*/
|
|
237
|
+
codes(i) {
|
|
238
|
+
return t.codes = [...i], c;
|
|
239
|
+
},
|
|
240
|
+
dataSource(i) {
|
|
241
|
+
return t.options.dataSource = i, c;
|
|
242
|
+
},
|
|
243
|
+
field(i, b) {
|
|
244
|
+
var a;
|
|
245
|
+
return t.options.fieldConfigs = {
|
|
246
|
+
...t.options.fieldConfigs,
|
|
247
|
+
[i]: {
|
|
248
|
+
...((a = t.options.fieldConfigs) == null ? void 0 : a[i]) || {},
|
|
249
|
+
...b
|
|
250
|
+
}
|
|
251
|
+
}, c;
|
|
252
|
+
},
|
|
253
|
+
build() {
|
|
254
|
+
return W(t.options, t.codes);
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
return c;
|
|
258
|
+
}
|
|
259
|
+
export {
|
|
260
|
+
H as useFormSchemasLink
|
|
261
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import m from "dayjs";
|
|
2
|
+
import f from "numeral";
|
|
3
|
+
const i = "YYYY-MM-DD HH:mm:ss", a = "YYYY-MM-DD";
|
|
4
|
+
function F() {
|
|
5
|
+
return {
|
|
6
|
+
formatFormRole: (t, r = "change") => [{ required: !0, message: t, trigger: r }],
|
|
7
|
+
formatToDateTime: (t, r = i) => m(t).isValid() ? m(t).format(r) : "--",
|
|
8
|
+
formatToDate: (t, r = a, o = !1) => o ? t ? m(+t).format(r) : "--" : m(t).isValid() ? m(t).format(r) : "--",
|
|
9
|
+
formatAmount: (t, r = "0,0.00") => t ? f(t).format(r) : "0.00",
|
|
10
|
+
formatAmountOfPlace: (t, r = "0,0.00") => t ? f(t).format(r) : "0.00",
|
|
11
|
+
formatPlaceOfAmount: (t) => {
|
|
12
|
+
if (t) {
|
|
13
|
+
const r = f(t).format("0,0.00");
|
|
14
|
+
return f(r).value();
|
|
15
|
+
}
|
|
16
|
+
return 0;
|
|
17
|
+
},
|
|
18
|
+
formatDecimal: (t, r) => {
|
|
19
|
+
let o = Number.parseFloat(t.toString());
|
|
20
|
+
if (Number.isNaN(o)) return "";
|
|
21
|
+
o = Math.round(o * 10 ** r) / 10 ** r;
|
|
22
|
+
let e = o.toString(), n = e.indexOf(".");
|
|
23
|
+
for (n < 0 && (n = e.length, e += "."); e.length <= n + r; ) e += "0";
|
|
24
|
+
return e;
|
|
25
|
+
},
|
|
26
|
+
formatFileSize: (t, r = 2) => {
|
|
27
|
+
if (t === 0) return "0 Bytes";
|
|
28
|
+
const o = 1e3, e = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"], n = Math.floor(Math.log(t) / Math.log(o));
|
|
29
|
+
return `${Number.parseFloat((t / o ** n).toFixed(r))} ${e[n]}`;
|
|
30
|
+
},
|
|
31
|
+
formatPeriod: (t, r = "period") => {
|
|
32
|
+
if (!t) return "";
|
|
33
|
+
typeof t == "number" && (t = t.toString()), typeof t == "string" && (t = t.replace(/[-.]/g, ""));
|
|
34
|
+
const o = t.slice(0, 4), e = t.slice(4, 6), n = {
|
|
35
|
+
period: "期",
|
|
36
|
+
month: "月"
|
|
37
|
+
};
|
|
38
|
+
return r === "period" ? `${o}年${e}${n[r]}` : ` ${e}/${o}`;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export {
|
|
43
|
+
F as useFormat
|
|
44
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ref as u, watch as i, toValue as f, computed as r, unref as c } from "vue";
|
|
2
|
+
function l(o) {
|
|
3
|
+
const e = u(!1);
|
|
4
|
+
i(
|
|
5
|
+
// 监听的数据源,获取 props 中的 loading 属性
|
|
6
|
+
() => f(o),
|
|
7
|
+
// 当 loading 属性变化时执行的回调函数
|
|
8
|
+
(t) => {
|
|
9
|
+
e.value = t || !1;
|
|
10
|
+
},
|
|
11
|
+
// 选项配置,立即执行一次回调函数
|
|
12
|
+
{ immediate: !0 }
|
|
13
|
+
);
|
|
14
|
+
const n = r(() => c(e));
|
|
15
|
+
function a(t) {
|
|
16
|
+
e.value = t;
|
|
17
|
+
}
|
|
18
|
+
return { getLoading: n, setLoading: a };
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
l as useLoading
|
|
22
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { useElementScreenshot as y } from "@dazhicheng/hooks";
|
|
2
|
+
import { GlobalConfig as g } from "./useSetup.js";
|
|
3
|
+
function O(a = "png") {
|
|
4
|
+
const e = a === "jpeg" ? "jpg" : "png";
|
|
5
|
+
return `screenshot-${Date.now()}.${e}`;
|
|
6
|
+
}
|
|
7
|
+
function h(a, e) {
|
|
8
|
+
return new File([a], e, { type: a.type || "image/png" });
|
|
9
|
+
}
|
|
10
|
+
function d(a) {
|
|
11
|
+
return new Promise((e, s) => {
|
|
12
|
+
const n = new FileReader();
|
|
13
|
+
n.onload = () => e(n.result), n.onerror = () => s(n.error ?? new Error("Blob 转 DataURL 失败")), n.readAsDataURL(a);
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
async function x(a, e, s) {
|
|
17
|
+
const o = `${s || e.dir || "notice"}/${Date.now()}_${a.name}`, t = new FormData();
|
|
18
|
+
t.append("key", o), t.append("policy", e.policy), t.append("x-oss-signature-version", e.version), t.append("x-oss-signature", e.signature), t.append("x-oss-credential", e.x_oss_credential), t.append("x-oss-date", e.x_oss_date), t.append("x-oss-security-token", e.security_token), e.callback && t.append("callback", e.callback), t.append("success_action_status", "200"), t.append("file", a);
|
|
19
|
+
const r = await fetch(e.host, { method: "POST", body: t });
|
|
20
|
+
if (!r.ok && r.status !== 203)
|
|
21
|
+
throw new Error(`OSS 上传失败: ${r.status}`);
|
|
22
|
+
return o;
|
|
23
|
+
}
|
|
24
|
+
function k(a) {
|
|
25
|
+
const e = a ?? g.uploadOssApi;
|
|
26
|
+
if (!e)
|
|
27
|
+
throw new Error("未配置 uploadOssApi,请先通过 setup({ uploadOssApi }) 或在 options 中传入 uploadOssApi");
|
|
28
|
+
return e;
|
|
29
|
+
}
|
|
30
|
+
async function l(a, e) {
|
|
31
|
+
const s = k(e == null ? void 0 : e.uploadOssApi), n = (e == null ? void 0 : e.format) ?? "png", o = (e == null ? void 0 : e.fileName) ?? O(n), t = h(a, o), r = await s(t), c = await x(t, r, e == null ? void 0 : e.ossDir);
|
|
32
|
+
return { blob: a, file: t, ossKey: c };
|
|
33
|
+
}
|
|
34
|
+
function _() {
|
|
35
|
+
const a = y();
|
|
36
|
+
async function e(o, t) {
|
|
37
|
+
const r = await a.captureToBlob(o, t);
|
|
38
|
+
return l(r, t);
|
|
39
|
+
}
|
|
40
|
+
async function s(o, t) {
|
|
41
|
+
const r = await a.captureToBlob(o, t), [c, u] = await Promise.all([d(r), l(r, t)]);
|
|
42
|
+
return { ...u, dataUrl: c };
|
|
43
|
+
}
|
|
44
|
+
async function n(o, t) {
|
|
45
|
+
const { ossDir: r, fileName: c, uploadOssApi: u, output: f, ...m } = t, i = await a.captureComponent(o, {
|
|
46
|
+
...m,
|
|
47
|
+
output: "blob"
|
|
48
|
+
}), b = {
|
|
49
|
+
format: t.format,
|
|
50
|
+
quality: t.quality,
|
|
51
|
+
ossDir: r,
|
|
52
|
+
fileName: c,
|
|
53
|
+
uploadOssApi: u
|
|
54
|
+
}, p = await l(i, b);
|
|
55
|
+
if (f === "blob")
|
|
56
|
+
return p;
|
|
57
|
+
const w = await d(i);
|
|
58
|
+
return { ...p, dataUrl: w };
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
captureToBlob: e,
|
|
62
|
+
captureToDataUrl: s,
|
|
63
|
+
captureComponent: n,
|
|
64
|
+
isCapturing: a.isCapturing
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
export {
|
|
68
|
+
_ as useScreenshotOss
|
|
69
|
+
};
|