@dt-frames/ui 2.0.1 → 2.0.2
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/es/assets/data/icons/actions.d.ts +1 -0
- package/es/assets/data/icons/actions.ts +423 -0
- package/es/assets/data/icons/code.d.ts +1 -0
- package/es/assets/data/icons/code.ts +10 -0
- package/es/assets/data/icons/commuticate.d.ts +1 -0
- package/es/assets/data/icons/commuticate.ts +182 -0
- package/es/assets/data/icons/currency.d.ts +1 -0
- package/es/assets/data/icons/currency.ts +44 -0
- package/es/assets/data/icons/devices.d.ts +1 -0
- package/es/assets/data/icons/devices.ts +126 -0
- package/es/assets/data/icons/edit.d.ts +1 -0
- package/es/assets/data/icons/edit.ts +163 -0
- package/es/assets/data/icons/file.d.ts +1 -0
- package/es/assets/data/icons/file.ts +99 -0
- package/es/assets/data/icons/math.d.ts +1 -0
- package/es/assets/data/icons/math.ts +53 -0
- package/es/assets/data/icons/message.d.ts +1 -0
- package/es/assets/data/icons/message.ts +68 -0
- package/es/assets/data/icons/navigate.d.ts +1 -0
- package/es/assets/data/icons/navigate.ts +181 -0
- package/es/assets/data/icons/other.d.ts +1 -0
- package/es/assets/data/icons/other.ts +324 -0
- package/es/assets/data/index.d.ts +4 -0
- package/es/assets/data/index.ts +58 -0
- package/es/assets/icons/iconfont.css +7266 -0
- package/es/assets/icons/iconfont.eot +0 -0
- package/es/assets/icons/iconfont.svg +5445 -0
- package/es/assets/icons/iconfont.ttf +0 -0
- package/es/assets/icons/iconfont.woff +0 -0
- package/es/assets/icons/iconfont.woff2 +0 -0
- package/es/assets/imgs/header/avatar.png +0 -0
- package/es/assets/imgs/logo/logo.png +0 -0
- package/es/assets/imgs/table/empty.png +0 -0
- package/es/assets/locales/en.d.ts +101 -0
- package/es/assets/locales/en.ts +101 -0
- package/es/assets/locales/index.d.ts +2 -0
- package/es/assets/locales/index.ts +5 -0
- package/es/assets/locales/zh.d.ts +103 -0
- package/es/assets/locales/zh.ts +103 -0
- package/es/components/container/index.d.ts +93 -0
- package/es/components/container/index.js +288 -0
- package/es/components/container/index.less +64 -0
- package/es/components/container/src/components/bar.d.ts +14 -0
- package/es/components/container/src/components/scroll-bar.d.ts +70 -0
- package/es/components/container/src/hooks/scroll.d.ts +10 -0
- package/es/components/container/src/scroll-container.d.ts +76 -0
- package/es/components/container/src/slot-container.d.ts +18 -0
- package/es/components/container/src/types/scroll.type.d.ts +22 -0
- package/es/components/container/src/utils/scroll.d.ts +5 -0
- package/es/components/curd/index.d.ts +2 -0
- package/es/components/curd/index.js +3098 -0
- package/es/components/curd/src/components/Curd.d.ts +1451 -0
- package/es/components/curd/src/hooks/useCurd.d.ts +112 -0
- package/es/components/curd/src/props.d.ts +188 -0
- package/es/components/curd/src/types/curd.type.d.ts +19 -0
- package/es/components/drawer/index.d.ts +8041 -0
- package/es/components/drawer/index.js +837 -0
- package/es/components/drawer/index.less +10 -0
- package/es/components/drawer/src/components/DrawerFooter.d.ts +139 -0
- package/es/components/drawer/src/components/DrawerHeader.d.ts +13 -0
- package/es/components/drawer/src/hooks/useDrawer.d.ts +3 -0
- package/es/components/drawer/src/index.d.ts +8043 -0
- package/es/components/drawer/src/props.d.ts +64 -0
- package/es/components/drawer/src/types/index.type.d.ts +48 -0
- package/es/components/form/index.d.ts +3367 -0
- package/es/components/form/index.js +1895 -0
- package/es/components/form/index.less +141 -0
- package/es/components/form/src/components/FormButtons.d.ts +88 -0
- package/es/components/form/src/components/FormItem.d.ts +313 -0
- package/es/components/form/src/components/componentMap.d.ts +4 -0
- package/es/components/form/src/components/formIcon.d.ts +1231 -0
- package/es/components/form/src/components/formInputUseDialog.d.ts +911 -0
- package/es/components/form/src/components/index.d.ts +4 -0
- package/es/components/form/src/components/radioButton.d.ts +34 -0
- package/es/components/form/src/enums/index.d.ts +7 -0
- package/es/components/form/src/hooks/helper.d.ts +14 -0
- package/es/components/form/src/hooks/useForm.d.ts +6 -0
- package/es/components/form/src/hooks/useFormActions.d.ts +12 -0
- package/es/components/form/src/hooks/useFormEvent.d.ts +25 -0
- package/es/components/form/src/hooks/useFormValue.d.ts +3 -0
- package/es/components/form/src/hooks/useFormValues.d.ts +11 -0
- package/es/components/form/src/hooks/useLabelWidth.d.ts +22 -0
- package/es/components/form/src/index.d.ts +3113 -0
- package/es/components/form/src/props.d.ts +133 -0
- package/es/components/form/src/types/actions.type.d.ts +15 -0
- package/es/components/form/src/types/form.type.d.ts +70 -0
- package/es/components/icons/index.d.ts +3 -0
- package/es/components/icons/index.js +1969 -0
- package/es/components/icons/index.less +42 -0
- package/es/components/icons/src/pick-icon.d.ts +455 -0
- package/es/components/icons/src/svg-icon.d.ts +44 -0
- package/es/components/modal/index.d.ts +3 -0
- package/es/components/modal/index.js +1192 -0
- package/es/components/modal/index.less +54 -0
- package/es/components/modal/src/components/CloseIcon.d.ts +40 -0
- package/es/components/modal/src/components/Modal.d.ts +215 -0
- package/es/components/modal/src/components/ModalFooter.d.ts +139 -0
- package/es/components/modal/src/components/ModalWrap.d.ts +153 -0
- package/es/components/modal/src/hooks/useDrag.d.ts +7 -0
- package/es/components/modal/src/hooks/useFullScreen.d.ts +6 -0
- package/es/components/modal/src/hooks/useModal.d.ts +5 -0
- package/es/components/modal/src/index.d.ts +881 -0
- package/es/components/modal/src/props.d.ts +100 -0
- package/es/components/modal/src/types/modal.type.d.ts +17 -0
- package/es/components/source/hooks/useDownload.d.ts +8 -0
- package/es/components/source/hooks/useSource.d.ts +40 -0
- package/es/components/source/index.d.ts +2 -0
- package/es/components/source/index.js +331 -0
- package/es/components/source/types/source.type.d.ts +37 -0
- package/es/components/source/utils/index.d.ts +8 -0
- package/es/components/table/index.d.ts +3 -0
- package/es/components/table/index.js +4414 -0
- package/es/components/table/index.less +183 -0
- package/es/components/table/src/components/TableAction.d.ts +70 -0
- package/es/components/table/src/components/TableHeader.d.ts +1243 -0
- package/es/components/table/src/components/TableRender.d.ts +13 -0
- package/es/components/table/src/components/editTable/CellComponent.d.ts +22 -0
- package/es/components/table/src/components/editTable/EditTableCell.d.ts +93 -0
- package/es/components/table/src/components/editTable/componentMap.d.ts +4 -0
- package/es/components/table/src/components/editTable/index.d.ts +9 -0
- package/es/components/table/src/components/editTable/props.d.ts +27 -0
- package/es/components/table/src/components/tableSetting/Column.d.ts +69 -0
- package/es/components/table/src/components/tableSetting/Download.d.ts +1029 -0
- package/es/components/table/src/components/tableSetting/DownloadCtrl.d.ts +995 -0
- package/es/components/table/src/components/tableSetting/Fullscreen.d.ts +22 -0
- package/es/components/table/src/components/tableSetting/index.d.ts +1137 -0
- package/es/components/table/src/hooks/useColumns.d.ts +14 -0
- package/es/components/table/src/hooks/useCustomRow.d.ts +20 -0
- package/es/components/table/src/hooks/useDataSource.d.ts +16 -0
- package/es/components/table/src/hooks/useHeader.d.ts +8 -0
- package/es/components/table/src/hooks/useHeaderCode.d.ts +3 -0
- package/es/components/table/src/hooks/useLoading.d.ts +6 -0
- package/es/components/table/src/hooks/usePagination.d.ts +122 -0
- package/es/components/table/src/hooks/useRow.d.ts +5 -0
- package/es/components/table/src/hooks/useRowSelection.d.ts +12 -0
- package/es/components/table/src/hooks/useTable.d.ts +9 -0
- package/es/components/table/src/hooks/useTableInstance.d.ts +16 -0
- package/es/components/table/src/hooks/useTableScroll.d.ts +13 -0
- package/es/components/table/src/index.d.ts +990 -0
- package/es/components/table/src/props.d.ts +244 -0
- package/es/components/table/src/types/actions.type.d.ts +22 -0
- package/es/components/table/src/types/header.type.d.ts +23 -0
- package/es/components/table/src/types/table.type.d.ts +92 -0
- package/es/directives/icon.d.ts +2 -0
- package/es/directives/index.d.ts +7 -0
- package/es/directives/index.js +2015 -0
- package/es/directives/permission.d.ts +2 -0
- package/es/global.d.ts +7 -0
- package/es/index.d.ts +1 -0
- package/es/index.js +3242 -0
- package/es/theme/index.d.ts +10 -0
- package/es/theme/index.js +3242 -0
- package/es/theme/index.less +603 -0
- package/es/theme/src/components/content/index.d.ts +27 -0
- package/es/theme/src/components/feature/back-top.d.ts +5 -0
- package/es/theme/src/components/feature/index.d.ts +7 -0
- package/es/theme/src/components/footer/index.d.ts +31 -0
- package/es/theme/src/components/header/components/bread-crumb.d.ts +6 -0
- package/es/theme/src/components/header/components/fullscreen.d.ts +5 -0
- package/es/theme/src/components/header/components/index.d.ts +11 -0
- package/es/theme/src/components/header/components/lang-picker.d.ts +23 -0
- package/es/theme/src/components/header/components/logo.d.ts +36 -0
- package/es/theme/src/components/header/components/menu-filter.d.ts +22 -0
- package/es/theme/src/components/header/components/notify.d.ts +23 -0
- package/es/theme/src/components/header/components/setting-theme.d.ts +222 -0
- package/es/theme/src/components/header/components/size.d.ts +282 -0
- package/es/theme/src/components/header/components/theme-drawer/feature.d.ts +138 -0
- package/es/theme/src/components/header/components/theme-drawer/index.d.ts +3 -0
- package/es/theme/src/components/header/components/theme-drawer/menu-type.d.ts +16 -0
- package/es/theme/src/components/header/components/theme-drawer/select.d.ts +58 -0
- package/es/theme/src/components/header/components/theme-drawer/switch.d.ts +49 -0
- package/es/theme/src/components/header/components/trigger.d.ts +10 -0
- package/es/theme/src/components/header/components/user-info.d.ts +36 -0
- package/es/theme/src/components/header/helper/change-theme.d.ts +13 -0
- package/es/theme/src/components/header/helper/menu-tree.d.ts +3 -0
- package/es/theme/src/components/header/index.d.ts +698 -0
- package/es/theme/src/components/header/multiple-header.d.ts +787 -0
- package/es/theme/src/components/sider/components/basic-menu/basic-menu-item.d.ts +62 -0
- package/es/theme/src/components/sider/components/basic-menu/basic-menu.d.ts +207 -0
- package/es/theme/src/components/sider/components/basic-menu/basic-sub-menu-item.d.ts +127 -0
- package/es/theme/src/components/sider/components/basic-menu/menu-item-content.d.ts +26 -0
- package/es/theme/src/components/sider/components/drag-bar.d.ts +14 -0
- package/es/theme/src/components/sider/components/layout-menu.d.ts +22 -0
- package/es/theme/src/components/sider/components/props.d.ts +69 -0
- package/es/theme/src/components/sider/components/sider-trigger.d.ts +18 -0
- package/es/theme/src/components/sider/helper/sider.d.ts +12 -0
- package/es/theme/src/components/sider/helper/split-menu.d.ts +10 -0
- package/es/theme/src/components/sider/index.d.ts +70 -0
- package/es/theme/src/components/tabs/components/TabContent.d.ts +6 -0
- package/es/theme/src/components/tabs/components/TabRedo.d.ts +21 -0
- package/es/theme/src/components/tabs/components/index.d.ts +3 -0
- package/es/theme/src/components/tabs/hooks/useMultifyTabs.d.ts +7 -0
- package/es/theme/src/components/tabs/hooks/useTabDropdown.d.ts +6 -0
- package/es/theme/src/components/tabs/index.d.ts +63 -0
- package/es/theme/src/components/tabs/types/tabs.type.d.ts +7 -0
- package/es/theme/src/enums/index.d.ts +1 -0
- package/es/theme/src/enums/theme.enum.d.ts +33 -0
- package/es/theme/src/hooks/index.d.ts +6 -0
- package/es/theme/src/hooks/useDragLine.d.ts +2 -0
- package/es/theme/src/hooks/useHeader.d.ts +25 -0
- package/es/theme/src/hooks/useMenu.d.ts +27 -0
- package/es/theme/src/hooks/useMultifyTab.d.ts +7 -0
- package/es/theme/src/hooks/useOpenKeys.d.ts +7 -0
- package/es/theme/src/hooks/useTheme.d.ts +9 -0
- package/es/theme/src/index.d.ts +1644 -0
- package/es/theme/src/setting/theme.setting.d.ts +2 -0
- package/es/theme/src/stores/index.d.ts +3 -0
- package/es/theme/src/stores/routeReuse.store.d.ts +23 -0
- package/es/theme/src/stores/theme.store.d.ts +15 -0
- package/es/theme/src/types/index.d.ts +3 -0
- package/es/theme/src/types/menu.type.d.ts +15 -0
- package/es/theme/src/types/theme.type.d.ts +60 -0
- package/es/utils/withInstall.d.ts +4 -0
- package/index.d.ts +10 -0
- package/index.js +34 -0
- package/package.json +1 -5
- package/tailwind.config.cjs +11 -0
- package/tsconfig.json +41 -0
- package/tsconfig.node.json +9 -0
- package/vite.config.ts +78 -0
|
@@ -0,0 +1,837 @@
|
|
|
1
|
+
import { Button, FormItem, Col, Drawer } from "ant-design-vue/es";
|
|
2
|
+
import { defineComponent as defineComponent$1, getCurrentInstance as getCurrentInstance$1, ref as ref$1, inject, computed as computed$1, onUnmounted as onUnmounted$1, h as h$1, openBlock, createElementBlock, createElementVNode, normalizeClass, normalizeStyle, unref as unref$1, createBlock, resolveDynamicComponent, withCtx, renderSlot, createVNode, mergeProps, toDisplayString, resolveDirective, normalizeProps, Fragment, renderList, withDirectives, createCommentVNode, createTextVNode, createSlots, guardReactiveProps } from "vue";
|
|
3
|
+
import { off, on, useI18n, dispatchResize, isFunction, DtCache, CacheKey, deepMerge, isUnDef, useApp, isObject, error } from "@dt-frames/core";
|
|
4
|
+
import "ant-design-vue/es/form/style";
|
|
5
|
+
import "ant-design-vue/es/button/style";
|
|
6
|
+
const _default = "";
|
|
7
|
+
const index$1 = "";
|
|
8
|
+
const isServer = typeof window === "undefined";
|
|
9
|
+
const BAR_MAP = {
|
|
10
|
+
vertical: {
|
|
11
|
+
offset: "offsetHeight",
|
|
12
|
+
scroll: "scrollTop",
|
|
13
|
+
scrollSize: "scrollHeight",
|
|
14
|
+
size: "height",
|
|
15
|
+
key: "vertical",
|
|
16
|
+
axis: "Y",
|
|
17
|
+
client: "clientY",
|
|
18
|
+
direction: "top"
|
|
19
|
+
},
|
|
20
|
+
horizontal: {
|
|
21
|
+
offset: "offsetWidth",
|
|
22
|
+
scroll: "scrollLeft",
|
|
23
|
+
scrollSize: "scrollWidth",
|
|
24
|
+
size: "width",
|
|
25
|
+
key: "horizontal",
|
|
26
|
+
axis: "X",
|
|
27
|
+
client: "clientX",
|
|
28
|
+
direction: "left"
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
function renderThumbStyle({ move, size, bar }) {
|
|
32
|
+
const style = {};
|
|
33
|
+
const translate = `translate${bar.axis}(${move}%)`;
|
|
34
|
+
style[bar.size] = size;
|
|
35
|
+
style.transform = translate;
|
|
36
|
+
style.msTransform = translate;
|
|
37
|
+
style.webkitTransform = translate;
|
|
38
|
+
return style;
|
|
39
|
+
}
|
|
40
|
+
function resizeHandler(entries) {
|
|
41
|
+
for (const entry of entries) {
|
|
42
|
+
const listeners = entry.target.__resizeListeners__ || [];
|
|
43
|
+
if (listeners.length) {
|
|
44
|
+
listeners.forEach((fn) => {
|
|
45
|
+
fn();
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function addResizeListener(element, fn) {
|
|
51
|
+
if (isServer)
|
|
52
|
+
return;
|
|
53
|
+
if (!element.__resizeListeners__) {
|
|
54
|
+
element.__resizeListeners__ = [];
|
|
55
|
+
element.__ro__ = new ResizeObserver(resizeHandler);
|
|
56
|
+
element.__ro__.observe(element);
|
|
57
|
+
}
|
|
58
|
+
element.__resizeListeners__.push(fn);
|
|
59
|
+
}
|
|
60
|
+
function removeResizeListener(element, fn) {
|
|
61
|
+
if (!element || !element.__resizeListeners__)
|
|
62
|
+
return;
|
|
63
|
+
element.__resizeListeners__.splice(element.__resizeListeners__.indexOf(fn), 1);
|
|
64
|
+
if (!element.__resizeListeners__.length) {
|
|
65
|
+
element.__ro__.disconnect();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
const Bar = defineComponent$1({
|
|
69
|
+
name: "Bar",
|
|
70
|
+
props: {
|
|
71
|
+
vertical: Boolean,
|
|
72
|
+
size: String,
|
|
73
|
+
move: Number
|
|
74
|
+
},
|
|
75
|
+
setup(props) {
|
|
76
|
+
const instance = getCurrentInstance$1();
|
|
77
|
+
const thumb = ref$1();
|
|
78
|
+
const wrap = inject("scroll-bar-wrap", {});
|
|
79
|
+
const bar = computed$1(() => {
|
|
80
|
+
return BAR_MAP[props.vertical ? "vertical" : "horizontal"];
|
|
81
|
+
});
|
|
82
|
+
const barStore = ref$1({});
|
|
83
|
+
const cursorDown = ref$1();
|
|
84
|
+
const clickThumbHandler = (e) => {
|
|
85
|
+
if (e.ctrlKey || e.button === 2) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
window.getSelection()?.removeAllRanges();
|
|
89
|
+
startDrag(e);
|
|
90
|
+
barStore.value[bar.value.axis] = e.currentTarget[bar.value.offset] - (e[bar.value.client] - e.currentTarget.getBoundingClientRect()[bar.value.direction]);
|
|
91
|
+
};
|
|
92
|
+
const clickTrackHandler = (e) => {
|
|
93
|
+
const offset = Math.abs(
|
|
94
|
+
e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]
|
|
95
|
+
);
|
|
96
|
+
const thumbHalf = thumb.value[bar.value.offset] / 2;
|
|
97
|
+
const thumbPositionPercentage = (offset - thumbHalf) * 100 / instance?.vnode.el?.[bar.value.offset];
|
|
98
|
+
wrap.value[bar.value.scroll] = thumbPositionPercentage * wrap.value[bar.value.scrollSize] / 100;
|
|
99
|
+
};
|
|
100
|
+
const startDrag = (e) => {
|
|
101
|
+
e.stopImmediatePropagation();
|
|
102
|
+
cursorDown.value = true;
|
|
103
|
+
on(document, "mousemove", mouseMoveDocumentHandler);
|
|
104
|
+
on(document, "mouseup", mouseUpDocumentHandler);
|
|
105
|
+
document.onselectstart = () => false;
|
|
106
|
+
};
|
|
107
|
+
const mouseMoveDocumentHandler = (e) => {
|
|
108
|
+
if (cursorDown.value === false)
|
|
109
|
+
return;
|
|
110
|
+
const prevPage = barStore.value[bar.value.axis];
|
|
111
|
+
if (!prevPage)
|
|
112
|
+
return;
|
|
113
|
+
const offset = (instance?.vnode.el?.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1;
|
|
114
|
+
const thumbClickPosition = thumb.value[bar.value.offset] - prevPage;
|
|
115
|
+
const thumbPositionPercentage = (offset - thumbClickPosition) * 100 / instance?.vnode.el?.[bar.value.offset];
|
|
116
|
+
wrap.value[bar.value.scroll] = thumbPositionPercentage * wrap.value[bar.value.scrollSize] / 100;
|
|
117
|
+
};
|
|
118
|
+
function mouseUpDocumentHandler() {
|
|
119
|
+
cursorDown.value = false;
|
|
120
|
+
barStore.value[bar.value.axis] = 0;
|
|
121
|
+
off(document, "mousemove", mouseMoveDocumentHandler);
|
|
122
|
+
document.onselectstart = null;
|
|
123
|
+
}
|
|
124
|
+
onUnmounted$1(() => {
|
|
125
|
+
off(document, "mouseup", mouseUpDocumentHandler);
|
|
126
|
+
});
|
|
127
|
+
return () => h$1(
|
|
128
|
+
"div",
|
|
129
|
+
{
|
|
130
|
+
class: ["scrollbar__bar", "is-" + bar.value.key],
|
|
131
|
+
onMousedown: clickTrackHandler
|
|
132
|
+
},
|
|
133
|
+
h$1("div", {
|
|
134
|
+
ref: thumb,
|
|
135
|
+
class: "scrollbar__thumb",
|
|
136
|
+
onMousedown: clickThumbHandler,
|
|
137
|
+
style: renderThumbStyle({
|
|
138
|
+
size: props.size,
|
|
139
|
+
move: props.move,
|
|
140
|
+
bar: bar.value
|
|
141
|
+
})
|
|
142
|
+
})
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
const _hoisted_1$3 = { class: "scrollbar relative h-full overflow-hidden" };
|
|
147
|
+
const _sfc_main$6 = /* @__PURE__ */ defineComponent$1({
|
|
148
|
+
__name: "scroll-bar",
|
|
149
|
+
props: {
|
|
150
|
+
wrapClass: {
|
|
151
|
+
type: [String, Array],
|
|
152
|
+
default: ""
|
|
153
|
+
},
|
|
154
|
+
wrapStyle: Array,
|
|
155
|
+
viewClass: {
|
|
156
|
+
type: [String, Array],
|
|
157
|
+
default: ""
|
|
158
|
+
},
|
|
159
|
+
viewStyle: {
|
|
160
|
+
type: [String, Array],
|
|
161
|
+
default: ""
|
|
162
|
+
},
|
|
163
|
+
noresize: Boolean,
|
|
164
|
+
tag: {
|
|
165
|
+
type: String,
|
|
166
|
+
default: "div"
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
setup(__props) {
|
|
170
|
+
const props = __props;
|
|
171
|
+
const sizeWidth = ref("0");
|
|
172
|
+
const sizeHeight = ref("0");
|
|
173
|
+
const moveX = ref(0);
|
|
174
|
+
const moveY = ref(0);
|
|
175
|
+
const wrap = ref();
|
|
176
|
+
const resize = ref();
|
|
177
|
+
provide("scroll-bar-wrap", wrap);
|
|
178
|
+
const style = computed(() => {
|
|
179
|
+
let rsStyle = {};
|
|
180
|
+
if (Array.isArray(props.wrapStyle)) {
|
|
181
|
+
props.wrapStyle.forEach((it) => {
|
|
182
|
+
if (it)
|
|
183
|
+
rsStyle = Object.assign({}, rsStyle, it);
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
return rsStyle;
|
|
187
|
+
});
|
|
188
|
+
const handleScroll = () => {
|
|
189
|
+
moveY.value = unref(wrap).scrollTop * 100 / unref(wrap).clientHeight;
|
|
190
|
+
moveX.value = unref(wrap).scrollLeft * 100 / unref(wrap).clientWidth;
|
|
191
|
+
};
|
|
192
|
+
const update = () => {
|
|
193
|
+
if (!unref(wrap))
|
|
194
|
+
return;
|
|
195
|
+
const heightPercentage = unref(wrap).clientHeight * 100 / unref(wrap).scrollHeight;
|
|
196
|
+
const widthPercentage = unref(wrap).clientWidth * 100 / unref(wrap).scrollWidth;
|
|
197
|
+
sizeHeight.value = heightPercentage < 100 ? heightPercentage + "%" : "";
|
|
198
|
+
sizeWidth.value = widthPercentage < 100 ? widthPercentage + "%" : "";
|
|
199
|
+
};
|
|
200
|
+
onMounted(() => {
|
|
201
|
+
nextTick(update);
|
|
202
|
+
if (!props.noresize) {
|
|
203
|
+
addResizeListener(unref(resize), update);
|
|
204
|
+
addResizeListener(unref(wrap), update);
|
|
205
|
+
addEventListener("resize", update);
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
onBeforeUnmount(() => {
|
|
209
|
+
if (!props.noresize) {
|
|
210
|
+
removeResizeListener(unref(resize), update);
|
|
211
|
+
removeResizeListener(unref(wrap), update);
|
|
212
|
+
removeEventListener("resize", update);
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
return (_ctx, _cache) => {
|
|
216
|
+
return openBlock(), createElementBlock("div", _hoisted_1$3, [
|
|
217
|
+
createElementVNode("div", {
|
|
218
|
+
ref_key: "wrap",
|
|
219
|
+
ref: wrap,
|
|
220
|
+
class: normalizeClass([[__props.wrapClass, "scrollbar__wrap--hidden-default"], "h-full overflow-auto"]),
|
|
221
|
+
style: normalizeStyle(unref$1(style)),
|
|
222
|
+
onScroll: handleScroll
|
|
223
|
+
}, [
|
|
224
|
+
(openBlock(), createBlock(resolveDynamicComponent(__props.tag), {
|
|
225
|
+
class: normalizeClass(["box-border", __props.viewClass]),
|
|
226
|
+
ref_key: "resize",
|
|
227
|
+
ref: resize,
|
|
228
|
+
style: normalizeStyle(__props.viewStyle)
|
|
229
|
+
}, {
|
|
230
|
+
default: withCtx(() => [
|
|
231
|
+
renderSlot(_ctx.$slots, "default")
|
|
232
|
+
]),
|
|
233
|
+
_: 3
|
|
234
|
+
}, 8, ["class", "style"]))
|
|
235
|
+
], 38),
|
|
236
|
+
createVNode(unref$1(Bar), {
|
|
237
|
+
move: unref$1(moveX),
|
|
238
|
+
size: unref$1(sizeWidth)
|
|
239
|
+
}, null, 8, ["move", "size"]),
|
|
240
|
+
createVNode(unref$1(Bar), {
|
|
241
|
+
vertical: "",
|
|
242
|
+
move: unref$1(moveY),
|
|
243
|
+
size: unref$1(sizeHeight)
|
|
244
|
+
}, null, 8, ["move", "size"])
|
|
245
|
+
]);
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
const _sfc_main$5 = /* @__PURE__ */ defineComponent$1({
|
|
250
|
+
__name: "scroll-container",
|
|
251
|
+
setup(__props) {
|
|
252
|
+
const scrollbarRef = ref(null);
|
|
253
|
+
return (_ctx, _cache) => {
|
|
254
|
+
return openBlock(), createBlock(_sfc_main$6, mergeProps({
|
|
255
|
+
ref_key: "scrollbarRef",
|
|
256
|
+
ref: scrollbarRef
|
|
257
|
+
}, _ctx.$attrs, { class: "w-full h-full" }), {
|
|
258
|
+
default: withCtx(() => [
|
|
259
|
+
renderSlot(_ctx.$slots, "default")
|
|
260
|
+
]),
|
|
261
|
+
_: 3
|
|
262
|
+
}, 16);
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
const _sfc_main$4 = defineComponent({
|
|
267
|
+
name: "slot-container",
|
|
268
|
+
props: {
|
|
269
|
+
template: {
|
|
270
|
+
type: Function
|
|
271
|
+
},
|
|
272
|
+
data: {
|
|
273
|
+
type: Object
|
|
274
|
+
}
|
|
275
|
+
},
|
|
276
|
+
setup(props) {
|
|
277
|
+
return () => {
|
|
278
|
+
return h("div", [props.template(props.data)]);
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
const withInstall = (comp) => {
|
|
283
|
+
comp.install = (app) => {
|
|
284
|
+
app.component(comp.name, comp);
|
|
285
|
+
};
|
|
286
|
+
return comp;
|
|
287
|
+
};
|
|
288
|
+
const DtScrollContainer = withInstall(_sfc_main$5);
|
|
289
|
+
withInstall(_sfc_main$4);
|
|
290
|
+
const _hoisted_1$2 = { class: "flex h-full items-center" };
|
|
291
|
+
const _hoisted_2$1 = { class: "pr-12" };
|
|
292
|
+
const _sfc_main$3 = /* @__PURE__ */ defineComponent$1({
|
|
293
|
+
__name: "DrawerHeader",
|
|
294
|
+
props: {
|
|
295
|
+
title: {
|
|
296
|
+
type: String
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
setup(__props) {
|
|
300
|
+
return (_ctx, _cache) => {
|
|
301
|
+
return openBlock(), createElementBlock("div", _hoisted_1$2, [
|
|
302
|
+
createElementVNode("span", null, toDisplayString(__props.title), 1),
|
|
303
|
+
createElementVNode("span", _hoisted_2$1, [
|
|
304
|
+
renderSlot(_ctx.$slots, "titleToolbar")
|
|
305
|
+
])
|
|
306
|
+
]);
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
const index = "";
|
|
311
|
+
const _hoisted_1$1 = {
|
|
312
|
+
key: 0,
|
|
313
|
+
className: "preIcon pr-1"
|
|
314
|
+
};
|
|
315
|
+
const _hoisted_2 = {
|
|
316
|
+
key: 0,
|
|
317
|
+
className: "preIcon pl-1"
|
|
318
|
+
};
|
|
319
|
+
const _hoisted_3 = { class: "text" };
|
|
320
|
+
const _hoisted_4 = /* @__PURE__ */ createElementVNode("i", { class: "text-2xl i ic:baseline-arrow-drop-down" }, null, -1);
|
|
321
|
+
const _hoisted_5 = [
|
|
322
|
+
_hoisted_4
|
|
323
|
+
];
|
|
324
|
+
const _sfc_main$2 = /* @__PURE__ */ defineComponent$1({
|
|
325
|
+
__name: "FormButtons",
|
|
326
|
+
props: {
|
|
327
|
+
mode: {
|
|
328
|
+
type: String,
|
|
329
|
+
default: "search"
|
|
330
|
+
},
|
|
331
|
+
show: {
|
|
332
|
+
type: Boolean,
|
|
333
|
+
default: true
|
|
334
|
+
},
|
|
335
|
+
showAdvancedButton: {
|
|
336
|
+
type: Boolean,
|
|
337
|
+
default: true
|
|
338
|
+
},
|
|
339
|
+
minShowColumn: {
|
|
340
|
+
type: Number,
|
|
341
|
+
default: 2
|
|
342
|
+
},
|
|
343
|
+
buttonList: {
|
|
344
|
+
type: [Array],
|
|
345
|
+
default: []
|
|
346
|
+
},
|
|
347
|
+
isAdvanced: {
|
|
348
|
+
type: Boolean,
|
|
349
|
+
default: true
|
|
350
|
+
}
|
|
351
|
+
},
|
|
352
|
+
emits: ["handle-method"],
|
|
353
|
+
setup(__props, { emit: emits }) {
|
|
354
|
+
const props = __props;
|
|
355
|
+
const { t } = useI18n();
|
|
356
|
+
const advancedRef = ref(props.isAdvanced);
|
|
357
|
+
let key = 0;
|
|
358
|
+
const showAdvanceRef = computed(() => {
|
|
359
|
+
return props.mode === "search" ? props.showAdvancedButton : false;
|
|
360
|
+
});
|
|
361
|
+
const colOpt = computed(() => {
|
|
362
|
+
let style = {
|
|
363
|
+
textAlign: "right"
|
|
364
|
+
};
|
|
365
|
+
if (props.mode === "dialog") {
|
|
366
|
+
Object.assign(style, {
|
|
367
|
+
display: "inline-block"
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
return { style };
|
|
371
|
+
});
|
|
372
|
+
const getAdvanceClass = computed(() => {
|
|
373
|
+
return [
|
|
374
|
+
"basic-arrow",
|
|
375
|
+
{ "basic-arrow--active": !advancedRef.value }
|
|
376
|
+
];
|
|
377
|
+
});
|
|
378
|
+
const toggleAdvanced = () => {
|
|
379
|
+
advancedRef.value = !advancedRef.value;
|
|
380
|
+
dispatchResize();
|
|
381
|
+
emits("handle-method", advancedRef.value);
|
|
382
|
+
};
|
|
383
|
+
function handleBtnClick(button) {
|
|
384
|
+
if (button.onClick && isFunction(button.onClick)) {
|
|
385
|
+
button.onClick();
|
|
386
|
+
} else {
|
|
387
|
+
emits("handle-method", button);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
watch(() => props.isAdvanced, (v) => {
|
|
391
|
+
if (v) {
|
|
392
|
+
nextTick(() => toggleAdvanced());
|
|
393
|
+
}
|
|
394
|
+
}, {
|
|
395
|
+
immediate: true
|
|
396
|
+
});
|
|
397
|
+
watch(
|
|
398
|
+
() => props.buttonList,
|
|
399
|
+
(v) => key = new Date().getTime(),
|
|
400
|
+
{
|
|
401
|
+
immediate: true,
|
|
402
|
+
deep: true
|
|
403
|
+
}
|
|
404
|
+
);
|
|
405
|
+
return (_ctx, _cache) => {
|
|
406
|
+
const _component_AButton = Button;
|
|
407
|
+
const _component_AFormItem = FormItem;
|
|
408
|
+
const _component_ACol = Col;
|
|
409
|
+
const _directive_icon = resolveDirective("icon");
|
|
410
|
+
const _directive_auth = resolveDirective("auth");
|
|
411
|
+
return __props.show ? (openBlock(), createBlock(_component_ACol, normalizeProps(mergeProps({ key: 0 }, unref$1(colOpt))), {
|
|
412
|
+
default: withCtx(() => [
|
|
413
|
+
createVNode(_component_AFormItem, {
|
|
414
|
+
class: "dt-form-btns",
|
|
415
|
+
style: normalizeStyle({
|
|
416
|
+
"margin-bottom": __props.mode === "search" ? "16px" : "0px"
|
|
417
|
+
})
|
|
418
|
+
}, {
|
|
419
|
+
default: withCtx(() => [
|
|
420
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.buttonList, (button) => {
|
|
421
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
422
|
+
(button.show === void 0 ? true : button.show) ? withDirectives((openBlock(), createBlock(_component_AButton, {
|
|
423
|
+
type: button.type,
|
|
424
|
+
class: normalizeClass(button.class),
|
|
425
|
+
loading: button.loading,
|
|
426
|
+
disabled: button.disabled,
|
|
427
|
+
key: unref$1(key),
|
|
428
|
+
onClick: ($event) => handleBtnClick(button)
|
|
429
|
+
}, {
|
|
430
|
+
icon: withCtx(() => [
|
|
431
|
+
button.preIcon ? withDirectives((openBlock(), createElementBlock("span", _hoisted_1$1, null, 512)), [
|
|
432
|
+
[_directive_icon, button.preIcon]
|
|
433
|
+
]) : createCommentVNode("", true)
|
|
434
|
+
]),
|
|
435
|
+
default: withCtx(() => [
|
|
436
|
+
createTextVNode(" " + toDisplayString(unref$1(t)(button.name)) + " ", 1),
|
|
437
|
+
button.postIcon ? withDirectives((openBlock(), createElementBlock("span", _hoisted_2, null, 512)), [
|
|
438
|
+
[_directive_icon, button.postIcon]
|
|
439
|
+
]) : createCommentVNode("", true)
|
|
440
|
+
]),
|
|
441
|
+
_: 2
|
|
442
|
+
}, 1032, ["type", "class", "loading", "disabled", "onClick"])), [
|
|
443
|
+
[_directive_auth, button.auth]
|
|
444
|
+
]) : createCommentVNode("", true)
|
|
445
|
+
], 64);
|
|
446
|
+
}), 256)),
|
|
447
|
+
unref$1(showAdvanceRef) ? (openBlock(), createBlock(_component_AButton, {
|
|
448
|
+
key: 0,
|
|
449
|
+
type: "link",
|
|
450
|
+
class: "advanced",
|
|
451
|
+
onClick: toggleAdvanced
|
|
452
|
+
}, {
|
|
453
|
+
default: withCtx(() => [
|
|
454
|
+
createElementVNode("span", _hoisted_3, toDisplayString(unref$1(advancedRef) ? unref$1(t)("UI.ADVANCED") : unref$1(t)("UI.EXPAND")), 1),
|
|
455
|
+
createElementVNode("span", {
|
|
456
|
+
class: normalizeClass(unref$1(getAdvanceClass))
|
|
457
|
+
}, _hoisted_5, 2)
|
|
458
|
+
]),
|
|
459
|
+
_: 1
|
|
460
|
+
})) : createCommentVNode("", true)
|
|
461
|
+
]),
|
|
462
|
+
_: 1
|
|
463
|
+
}, 8, ["style"])
|
|
464
|
+
]),
|
|
465
|
+
_: 1
|
|
466
|
+
}, 16)) : createCommentVNode("", true);
|
|
467
|
+
};
|
|
468
|
+
}
|
|
469
|
+
});
|
|
470
|
+
const _hoisted_1 = {
|
|
471
|
+
class: "flex items-center",
|
|
472
|
+
style: { gap: "10px" }
|
|
473
|
+
};
|
|
474
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent$1({
|
|
475
|
+
__name: "DrawerFooter",
|
|
476
|
+
props: {
|
|
477
|
+
buttons: Object,
|
|
478
|
+
showSave: { type: Boolean, default: true },
|
|
479
|
+
showCancel: { type: Boolean, default: true },
|
|
480
|
+
okText: { type: String },
|
|
481
|
+
cancelText: { type: String }
|
|
482
|
+
},
|
|
483
|
+
emits: [
|
|
484
|
+
"handleSave",
|
|
485
|
+
"handleCancel"
|
|
486
|
+
],
|
|
487
|
+
setup(__props, { emit: emits }) {
|
|
488
|
+
const props = __props;
|
|
489
|
+
const { t } = useI18n("UI");
|
|
490
|
+
const buttonList = computed$1(() => {
|
|
491
|
+
if (props.buttons && props.buttons.length)
|
|
492
|
+
return props.buttons;
|
|
493
|
+
let buttonActions = [
|
|
494
|
+
{ t: "\u4FDD\u5B58", name: props.okText || t("SAVE"), preIcon: "mdi:content-save", type: "primary", flag: "OK" },
|
|
495
|
+
{ t: "\u5173\u95ED", name: props.cancelText || t("CLOSE"), preIcon: "mdi:close", flag: "CANCEL" }
|
|
496
|
+
];
|
|
497
|
+
if (!props.showSave)
|
|
498
|
+
buttonActions = buttonActions.filter((btn) => btn.flag !== "OK");
|
|
499
|
+
if (!props.showCancel)
|
|
500
|
+
buttonActions = buttonActions.filter((btn) => btn.flag !== "CANCEL");
|
|
501
|
+
return buttonActions;
|
|
502
|
+
});
|
|
503
|
+
function handleMethod(item) {
|
|
504
|
+
switch (item.flag) {
|
|
505
|
+
case "OK":
|
|
506
|
+
emits("handleSave");
|
|
507
|
+
break;
|
|
508
|
+
case "CANCEL":
|
|
509
|
+
emits("handleCancel");
|
|
510
|
+
break;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
return (_ctx, _cache) => {
|
|
514
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
515
|
+
renderSlot(_ctx.$slots, "appendFooter"),
|
|
516
|
+
createVNode(_sfc_main$2, {
|
|
517
|
+
mode: "dialog",
|
|
518
|
+
buttonList: unref$1(buttonList),
|
|
519
|
+
onHandleMethod: _cache[0] || (_cache[0] = ($event) => handleMethod($event))
|
|
520
|
+
}, null, 8, ["buttonList"])
|
|
521
|
+
]);
|
|
522
|
+
};
|
|
523
|
+
}
|
|
524
|
+
});
|
|
525
|
+
const basicProps = {
|
|
526
|
+
t: {
|
|
527
|
+
type: String
|
|
528
|
+
},
|
|
529
|
+
title: {
|
|
530
|
+
type: String
|
|
531
|
+
},
|
|
532
|
+
visible: { type: Boolean },
|
|
533
|
+
loading: { type: Boolean },
|
|
534
|
+
loadingTip: { type: String, default: "\u52A0\u8F7D\u4E2D..." },
|
|
535
|
+
mask: { type: Boolean, default: true },
|
|
536
|
+
maskClosable: { type: Boolean, default: true },
|
|
537
|
+
keyboard: { type: Boolean, default: true },
|
|
538
|
+
maskStyle: Object,
|
|
539
|
+
closeFunc: {
|
|
540
|
+
type: [Function, Object],
|
|
541
|
+
default: null
|
|
542
|
+
},
|
|
543
|
+
destroyOnClose: { type: Boolean },
|
|
544
|
+
getContainer: {
|
|
545
|
+
type: [Object, String]
|
|
546
|
+
},
|
|
547
|
+
width: { type: [String, Number] },
|
|
548
|
+
showOkBtn: {
|
|
549
|
+
type: Boolean,
|
|
550
|
+
default: true
|
|
551
|
+
},
|
|
552
|
+
showCancelBtn: {
|
|
553
|
+
type: Boolean,
|
|
554
|
+
default: true
|
|
555
|
+
},
|
|
556
|
+
okText: {
|
|
557
|
+
type: String
|
|
558
|
+
},
|
|
559
|
+
cancelText: {
|
|
560
|
+
type: String
|
|
561
|
+
},
|
|
562
|
+
footer: {
|
|
563
|
+
type: Array
|
|
564
|
+
},
|
|
565
|
+
afterClose: Function
|
|
566
|
+
};
|
|
567
|
+
const _sfc_main = /* @__PURE__ */ defineComponent$1({
|
|
568
|
+
__name: "index",
|
|
569
|
+
props: basicProps,
|
|
570
|
+
emits: ["cancel", "save", "register", "visible-change"],
|
|
571
|
+
setup(__props, { emit: emits }) {
|
|
572
|
+
const props = __props;
|
|
573
|
+
const attrs = useAttrs();
|
|
574
|
+
const propsRef = ref(null);
|
|
575
|
+
const auths = DtCache.getLocal(CacheKey.AUTHS);
|
|
576
|
+
const visibleRef = ref(false);
|
|
577
|
+
const getMergeProps = computed(() => {
|
|
578
|
+
return deepMerge(toRaw(props), unref(propsRef));
|
|
579
|
+
});
|
|
580
|
+
const getshowFooter = computed(() => {
|
|
581
|
+
const { footer } = unref(getProps);
|
|
582
|
+
if (isUnDef(footer))
|
|
583
|
+
return true;
|
|
584
|
+
const filterFooterLen = footer.filter((it) => {
|
|
585
|
+
if (it.auth && auths.indexOf(it.auth) !== -1 || !it.auth)
|
|
586
|
+
return true;
|
|
587
|
+
return false;
|
|
588
|
+
}).length;
|
|
589
|
+
return !!filterFooterLen;
|
|
590
|
+
});
|
|
591
|
+
const getProps = computed(() => {
|
|
592
|
+
let opt = {
|
|
593
|
+
placement: "right",
|
|
594
|
+
...unref(attrs),
|
|
595
|
+
...unref(getMergeProps),
|
|
596
|
+
visible: unref(visibleRef),
|
|
597
|
+
bodyStyle: {
|
|
598
|
+
padding: 0
|
|
599
|
+
}
|
|
600
|
+
};
|
|
601
|
+
const { getContainer, width } = opt;
|
|
602
|
+
if (!getContainer) {
|
|
603
|
+
opt = {
|
|
604
|
+
...opt,
|
|
605
|
+
getContainer: ".dt-layout-content",
|
|
606
|
+
style: {
|
|
607
|
+
position: "absolute"
|
|
608
|
+
},
|
|
609
|
+
width: width || "100%"
|
|
610
|
+
};
|
|
611
|
+
} else {
|
|
612
|
+
opt.width = width || "30%";
|
|
613
|
+
}
|
|
614
|
+
return opt;
|
|
615
|
+
});
|
|
616
|
+
const getScrollContentStyle = computed(() => {
|
|
617
|
+
return {
|
|
618
|
+
position: "relative",
|
|
619
|
+
height: `100%`
|
|
620
|
+
};
|
|
621
|
+
});
|
|
622
|
+
function handleSave() {
|
|
623
|
+
emits("save");
|
|
624
|
+
}
|
|
625
|
+
async function handleCancel(e = null) {
|
|
626
|
+
const { closeFunc } = unref(getProps);
|
|
627
|
+
if (closeFunc && isFunction(closeFunc)) {
|
|
628
|
+
const isClose = await closeFunc();
|
|
629
|
+
visibleRef.value = !isClose;
|
|
630
|
+
return;
|
|
631
|
+
}
|
|
632
|
+
const { afterClose } = unref(getProps);
|
|
633
|
+
if (afterClose && isFunction(afterClose)) {
|
|
634
|
+
afterClose();
|
|
635
|
+
}
|
|
636
|
+
visibleRef.value = false;
|
|
637
|
+
propsRef.value.visible = false;
|
|
638
|
+
emits("cancel", e);
|
|
639
|
+
}
|
|
640
|
+
function setDrawerProps(props2) {
|
|
641
|
+
propsRef.value = deepMerge(unref(propsRef) || {}, props2);
|
|
642
|
+
}
|
|
643
|
+
const drawerMethods = {
|
|
644
|
+
setDrawerProps
|
|
645
|
+
};
|
|
646
|
+
const instance = getCurrentInstance();
|
|
647
|
+
instance && emits("register", drawerMethods, instance.uid);
|
|
648
|
+
watch(
|
|
649
|
+
() => unref(propsRef).visible,
|
|
650
|
+
(v) => {
|
|
651
|
+
emits("visible-change", v);
|
|
652
|
+
visibleRef.value = v;
|
|
653
|
+
},
|
|
654
|
+
{ immediate: false }
|
|
655
|
+
);
|
|
656
|
+
return (_ctx, _cache) => {
|
|
657
|
+
const _component_ADrawer = Drawer;
|
|
658
|
+
return openBlock(), createBlock(_component_ADrawer, mergeProps({
|
|
659
|
+
class: "dt-drawer",
|
|
660
|
+
onClose: handleCancel
|
|
661
|
+
}, unref$1(getProps), {
|
|
662
|
+
footerStyle: {
|
|
663
|
+
padding: unref$1(getshowFooter) ? "10px 16px" : "0"
|
|
664
|
+
}
|
|
665
|
+
}), createSlots({
|
|
666
|
+
default: withCtx(() => [
|
|
667
|
+
createVNode(unref$1(DtScrollContainer), {
|
|
668
|
+
style: normalizeStyle(unref$1(getScrollContentStyle))
|
|
669
|
+
}, {
|
|
670
|
+
default: withCtx(() => [
|
|
671
|
+
renderSlot(_ctx.$slots, "default")
|
|
672
|
+
]),
|
|
673
|
+
_: 3
|
|
674
|
+
}, 8, ["style"])
|
|
675
|
+
]),
|
|
676
|
+
_: 2
|
|
677
|
+
}, [
|
|
678
|
+
!_ctx.$slots.title ? {
|
|
679
|
+
name: "title",
|
|
680
|
+
fn: withCtx(() => [
|
|
681
|
+
createVNode(_sfc_main$3, {
|
|
682
|
+
title: unref$1(getProps).title
|
|
683
|
+
}, {
|
|
684
|
+
titleToolbar: withCtx(() => [
|
|
685
|
+
renderSlot(_ctx.$slots, "titleToolbar")
|
|
686
|
+
]),
|
|
687
|
+
_: 3
|
|
688
|
+
}, 8, ["title"])
|
|
689
|
+
]),
|
|
690
|
+
key: "0"
|
|
691
|
+
} : {
|
|
692
|
+
name: "title",
|
|
693
|
+
fn: withCtx(() => [
|
|
694
|
+
renderSlot(_ctx.$slots, "title")
|
|
695
|
+
]),
|
|
696
|
+
key: "1"
|
|
697
|
+
},
|
|
698
|
+
unref$1(getshowFooter) ? {
|
|
699
|
+
name: "footer",
|
|
700
|
+
fn: withCtx(() => [
|
|
701
|
+
createVNode(_sfc_main$1, {
|
|
702
|
+
buttons: unref$1(propsRef)?.footer,
|
|
703
|
+
showSave: unref$1(getProps).showOkBtn,
|
|
704
|
+
showCancel: unref$1(getProps).showCancelBtn,
|
|
705
|
+
okText: unref$1(getProps).okText,
|
|
706
|
+
cancelText: unref$1(getProps).cancelText,
|
|
707
|
+
onHandleSave: handleSave,
|
|
708
|
+
onHandleCancel: handleCancel
|
|
709
|
+
}, createSlots({ _: 2 }, [
|
|
710
|
+
renderList(Object.keys(_ctx.$slots), (item) => {
|
|
711
|
+
return {
|
|
712
|
+
name: item,
|
|
713
|
+
fn: withCtx((data) => [
|
|
714
|
+
renderSlot(_ctx.$slots, item, normalizeProps(guardReactiveProps(data || {})))
|
|
715
|
+
])
|
|
716
|
+
};
|
|
717
|
+
})
|
|
718
|
+
]), 1032, ["buttons", "showSave", "showCancel", "okText", "cancelText"])
|
|
719
|
+
]),
|
|
720
|
+
key: "2"
|
|
721
|
+
} : void 0
|
|
722
|
+
]), 1040, ["footerStyle"]);
|
|
723
|
+
};
|
|
724
|
+
}
|
|
725
|
+
});
|
|
726
|
+
const orgDialogProp = reactive({});
|
|
727
|
+
const cbTransfer = reactive({});
|
|
728
|
+
const dataTransfer = reactive({});
|
|
729
|
+
function useDrawerOut() {
|
|
730
|
+
const drawer = ref(null);
|
|
731
|
+
const loaded = ref(false);
|
|
732
|
+
const uid = ref("");
|
|
733
|
+
const { isProd } = useApp();
|
|
734
|
+
function register(drawerMethods, uuid) {
|
|
735
|
+
if (!getCurrentInstance()) {
|
|
736
|
+
throw new Error("useDrawer\u53EA\u80FD\u5728setup()\u6216\u8005\u51FD\u6570\u4E2D\u4F7F\u7528");
|
|
737
|
+
}
|
|
738
|
+
uid.value = uuid;
|
|
739
|
+
onUnmounted(() => {
|
|
740
|
+
if (unref(isProd)) {
|
|
741
|
+
drawer.value = null;
|
|
742
|
+
loaded.value = false;
|
|
743
|
+
dataTransfer[unref(uid)] = null;
|
|
744
|
+
orgDialogProp[unref(uid)] = null;
|
|
745
|
+
cbTransfer[unref(uid)] = (res) => {
|
|
746
|
+
};
|
|
747
|
+
}
|
|
748
|
+
});
|
|
749
|
+
if (unref(loaded) && drawerMethods === unref(drawer))
|
|
750
|
+
return;
|
|
751
|
+
drawer.value = drawerMethods;
|
|
752
|
+
loaded.value = true;
|
|
753
|
+
}
|
|
754
|
+
const getInstance = () => {
|
|
755
|
+
const instance = unref(drawer);
|
|
756
|
+
if (!instance) {
|
|
757
|
+
error("useDrawerOut \u5B9E\u4F8B\u672A\u5B9A\u4E49");
|
|
758
|
+
}
|
|
759
|
+
return instance;
|
|
760
|
+
};
|
|
761
|
+
const methods = {
|
|
762
|
+
setDrawerProps: (props) => {
|
|
763
|
+
getInstance()?.setDrawerProps(props);
|
|
764
|
+
},
|
|
765
|
+
openDrawer: (params = null, afterClose) => {
|
|
766
|
+
const id = unref(uid);
|
|
767
|
+
dataTransfer[id] = isObject(params) ? { ...toRaw(params) } : params;
|
|
768
|
+
getInstance()?.setDrawerProps({
|
|
769
|
+
defaultFullscreen: false,
|
|
770
|
+
...orgDialogProp[id],
|
|
771
|
+
visible: true
|
|
772
|
+
});
|
|
773
|
+
cbTransfer[id] = (res) => {
|
|
774
|
+
if (afterClose && isFunction(afterClose)) {
|
|
775
|
+
afterClose(res);
|
|
776
|
+
}
|
|
777
|
+
};
|
|
778
|
+
},
|
|
779
|
+
closeDrawer: () => {
|
|
780
|
+
getInstance()?.setDrawerProps({ visible: false });
|
|
781
|
+
}
|
|
782
|
+
};
|
|
783
|
+
return [register, methods];
|
|
784
|
+
}
|
|
785
|
+
function useDrawer(props, setModalData) {
|
|
786
|
+
const drawerInstanceRef = ref(null);
|
|
787
|
+
const currentInstance = getCurrentInstance();
|
|
788
|
+
const uidRef = ref("");
|
|
789
|
+
const { isProd } = useApp();
|
|
790
|
+
const getInstance = () => {
|
|
791
|
+
const instance = unref(drawerInstanceRef);
|
|
792
|
+
if (!instance) {
|
|
793
|
+
error("useDrawer \u5B9E\u4F8B\u672A\u5B9A\u4E49");
|
|
794
|
+
}
|
|
795
|
+
return instance;
|
|
796
|
+
};
|
|
797
|
+
function register(drawerInstance, uuid) {
|
|
798
|
+
if (unref(isProd)) {
|
|
799
|
+
drawerInstanceRef.value = null;
|
|
800
|
+
}
|
|
801
|
+
uidRef.value = uuid;
|
|
802
|
+
drawerInstanceRef.value = drawerInstance;
|
|
803
|
+
currentInstance?.emit("register", drawerInstance, uuid);
|
|
804
|
+
orgDialogProp[uuid] = toRaw(props);
|
|
805
|
+
drawerInstance.setDrawerProps(props);
|
|
806
|
+
}
|
|
807
|
+
watchEffect(() => {
|
|
808
|
+
const data = dataTransfer[unref(uidRef)];
|
|
809
|
+
if (!data)
|
|
810
|
+
return;
|
|
811
|
+
if (!setModalData || !isFunction(setModalData))
|
|
812
|
+
return;
|
|
813
|
+
nextTick(() => {
|
|
814
|
+
setModalData(data);
|
|
815
|
+
});
|
|
816
|
+
});
|
|
817
|
+
const methods = {
|
|
818
|
+
changeLoading: (loading = true) => {
|
|
819
|
+
getInstance()?.setDrawerProps({ loading });
|
|
820
|
+
},
|
|
821
|
+
closeDrawer: (rsp) => {
|
|
822
|
+
if (cbTransfer[unref(uidRef)])
|
|
823
|
+
cbTransfer[unref(uidRef)](rsp);
|
|
824
|
+
getInstance()?.setDrawerProps({ visible: false });
|
|
825
|
+
},
|
|
826
|
+
setDrawerProps: (props2) => {
|
|
827
|
+
getInstance()?.setDrawerProps(props2);
|
|
828
|
+
}
|
|
829
|
+
};
|
|
830
|
+
return [register, methods];
|
|
831
|
+
}
|
|
832
|
+
const DtDrawer = withInstall(_sfc_main);
|
|
833
|
+
export {
|
|
834
|
+
DtDrawer,
|
|
835
|
+
useDrawer,
|
|
836
|
+
useDrawerOut
|
|
837
|
+
};
|