yuang-framework-ui-pc 1.1.42 → 1.1.43
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/utils/chart-theme-dark.d.ts +373 -0
- package/es/utils/chart-theme-dark.js +397 -0
- package/es/utils/chart-theme.d.ts +368 -0
- package/es/utils/chart-theme.js +392 -0
- package/es/utils/menu-util.d.ts +14 -0
- package/es/utils/menu-util.js +78 -0
- package/es/utils/message-box.d.ts +25 -0
- package/es/utils/message-box.js +98 -0
- package/es/utils/message.d.ts +66 -0
- package/es/utils/message.js +267 -0
- package/es/utils/resolvers.d.ts +18 -0
- package/es/utils/resolvers.js +50 -0
- package/es/utils/theme-util.d.ts +6 -0
- package/es/utils/theme-util.js +42 -0
- package/es/utils/validate.d.ts +182 -0
- package/es/utils/validate.js +197 -0
- package/lib/core.d.ts +3 -0
- package/lib/ele-admin-layout/components/layout-tabs.d.ts +5646 -0
- package/lib/ele-admin-layout/components/layout-tool.d.ts +2 -0
- package/lib/ele-admin-layout/style/index.d.ts +1 -0
- package/lib/ele-admin-layout/types.d.ts +54 -0
- package/lib/ele-alert/index.d.ts +131 -0
- package/lib/ele-alert/props.d.ts +58 -0
- package/lib/ele-app/el.d.ts +304 -0
- package/lib/ele-app/style/common/index.d.ts +1 -0
- package/lib/ele-app/style/overwrite/backtop/index.d.ts +1 -0
- package/lib/ele-app/style/overwrite/checkbox/index.d.ts +1 -0
- package/lib/ele-app/style/overwrite/date-picker/index.d.ts +1 -0
- package/lib/ele-app/style/overwrite/message-box/index.d.ts +1 -0
- package/lib/ele-app/style/overwrite/popper/index.d.ts +1 -0
- package/lib/ele-app/style/overwrite/select/index.d.ts +1 -0
- package/lib/ele-app/style/overwrite/tag/index.d.ts +1 -0
- package/lib/ele-app/style/overwrite/tree/index.d.ts +1 -0
- package/lib/ele-app/style/scrollbar/index.d.ts +1 -0
- package/lib/ele-app/types.d.ts +48 -0
- package/lib/ele-avatar-group/props.d.ts +56 -0
- package/lib/ele-avatar-group/style/index.d.ts +1 -0
- package/lib/ele-avatar-group/types.d.ts +21 -0
- package/lib/ele-backtop/props.d.ts +36 -0
- package/lib/ele-bar-code/index.d.ts +26 -0
- package/lib/ele-bottom-bar/index.d.ts +15 -0
- package/lib/ele-bottom-bar/props.d.ts +15 -0
- package/lib/ele-breadcrumb/index.d.ts +278 -0
- package/lib/ele-breadcrumb/props.d.ts +24 -0
- package/lib/ele-breadcrumb/style/index.d.ts +1 -0
- package/lib/ele-card/index.d.ts +106 -0
- package/lib/ele-card/style/index.d.ts +1 -0
- package/lib/ele-check-card/components/card-item.d.ts +37 -0
- package/lib/ele-check-card/props.d.ts +49 -0
- package/lib/ele-check-card/style/index.d.ts +1 -0
- package/lib/ele-check-card/types.d.ts +37 -0
- package/lib/ele-config-provider/components/receiver-view.d.ts +71 -0
- package/lib/ele-config-provider/props.d.ts +26 -0
- package/lib/ele-config-provider/style/index.d.ts +0 -0
- package/lib/ele-config-provider/types.d.ts +103 -0
- package/lib/ele-copyable/style/index.d.ts +1 -0
- package/lib/ele-copyable/types.d.ts +14 -0
- package/lib/ele-count-up/style/index.d.ts +0 -0
- package/lib/ele-cropper/index.d.ts +2824 -0
- package/lib/ele-cropper/props.d.ts +68 -0
- package/lib/ele-cropper/style/index.d.ts +1 -0
- package/lib/ele-cropper-modal/props.d.ts +58 -0
- package/lib/ele-cropper-modal/style/index.d.ts +1 -0
- package/lib/ele-dashboard/index.d.ts +14 -0
- package/lib/ele-dashboard/style/index.d.ts +1 -0
- package/lib/ele-dashboard/types.d.ts +4 -0
- package/lib/ele-data-table/props.d.ts +272 -0
- package/lib/ele-data-table/style/index.d.ts +1 -0
- package/lib/ele-data-table/types.d.ts +253 -0
- package/lib/ele-data-table/util.d.ts +172 -0
- package/lib/ele-dialog/index.d.ts +1074 -0
- package/lib/ele-dialog/style/index.d.ts +1 -0
- package/lib/ele-dialog/util.d.ts +52 -0
- package/lib/ele-dot/index.d.ts +29 -0
- package/lib/ele-dot/props.d.ts +25 -0
- package/lib/ele-dot/style/index.d.ts +1 -0
- package/lib/ele-drawer/index.d.ts +1170 -0
- package/lib/ele-drawer/props.d.ts +184 -0
- package/lib/ele-drawer/style/index.d.ts +1 -0
- package/lib/ele-dropdown/components/dropdown-menu-item.d.ts +97 -0
- package/lib/ele-dropdown/index.d.ts +4846 -0
- package/lib/ele-dropdown/types.d.ts +22 -0
- package/lib/ele-edit-tag/props.d.ts +55 -0
- package/lib/ele-edit-tag/style/index.d.ts +1 -0
- package/lib/ele-edit-tag/types.d.ts +9 -0
- package/lib/ele-ellipsis/index.d.ts +1660 -0
- package/lib/ele-icon-select/types.d.ts +16 -0
- package/lib/ele-image-viewer/index.d.ts +635 -0
- package/lib/ele-loading/props.d.ts +33 -0
- package/lib/ele-loading/types.d.ts +19 -0
- package/lib/ele-map-picker/style/index.d.ts +1 -0
- package/lib/ele-menus/components/item-title.d.ts +323 -0
- package/lib/ele-menus/types.d.ts +107 -0
- package/lib/ele-pagination/style/index.d.ts +1 -0
- package/lib/ele-pagination/types.d.ts +9 -0
- package/lib/ele-printer/index.d.ts +111 -0
- package/lib/ele-printer/util.d.ts +25 -0
- package/lib/ele-pro-layout/components/pro-iframe.d.ts +39 -0
- package/lib/ele-pro-layout/style/index.d.ts +1 -0
- package/lib/ele-pro-layout/util.d.ts +88 -0
- package/lib/ele-pro-table/components/tool-column.d.ts +3722 -0
- package/lib/ele-pro-table/components/tool-print-header-cell.d.ts +39 -0
- package/lib/ele-pro-table/style/index.d.ts +1 -0
- package/lib/ele-pro-table/types.d.ts +489 -0
- package/lib/ele-qr-code/components/canvas-render.d.ts +67 -0
- package/lib/ele-qr-code/qrcodegen.d.ts +95 -0
- package/lib/ele-qr-code/style/index.d.ts +0 -0
- package/lib/ele-qr-code/util.d.ts +27 -0
- package/lib/ele-segmented/index.d.ts +485 -0
- package/lib/ele-segmented/style/index.d.ts +1 -0
- package/lib/ele-split-panel/index.d.ts +192 -0
- package/lib/ele-split-panel/props.d.ts +47 -0
- package/lib/ele-steps/index.d.ts +638 -0
- package/lib/ele-steps/style/index.d.ts +1 -0
- package/lib/ele-steps/types.d.ts +14 -0
- package/lib/ele-tab-tool/index.d.ts +75 -0
- package/lib/ele-tab-tool/props.d.ts +14 -0
- package/lib/ele-tab-wrap/components/tab-dropdown.d.ts +5006 -0
- package/lib/ele-tab-wrap/props.d.ts +13 -0
- package/lib/ele-tab-wrap/style/index.d.ts +0 -0
- package/lib/ele-table/index.d.ts +28 -0
- package/lib/ele-table/style/index.d.ts +1 -0
- package/lib/ele-table-select/props.d.ts +120 -0
- package/lib/ele-table-select/style/index.d.ts +1 -0
- package/lib/ele-tabs/props.d.ts +88 -0
- package/lib/ele-test/index.d.ts +2 -0
- package/lib/ele-test/style/index.d.ts +1 -0
- package/lib/ele-text/index.d.ts +93 -0
- package/lib/ele-text/style/index.d.ts +1 -0
- package/lib/ele-text/types.d.ts +35 -0
- package/lib/ele-toolbar/index.d.ts +1633 -0
- package/lib/ele-tooltip/props.d.ts +187 -0
- package/lib/ele-tooltip/style/index.d.ts +1 -0
- package/lib/ele-tour/types.d.ts +42 -0
- package/lib/ele-tour/util.d.ts +20 -0
- package/lib/ele-tree-select/style/index.d.ts +1 -0
- package/lib/ele-upload-list/components/list-item.d.ts +902 -0
- package/lib/ele-upload-list/props.d.ts +81 -0
- package/lib/ele-upload-list/types.d.ts +71 -0
- package/lib/ele-virtual-table/components/body-row.d.ts +984 -0
- package/lib/ele-virtual-table/components/expand-row.d.ts +19 -0
- package/lib/ele-virtual-table/components/footer-row.d.ts +65 -0
- package/lib/ele-virtual-table/components/header-cell.d.ts +3929 -0
- package/lib/ele-virtual-table/index.d.ts +7882 -0
- package/lib/ele-virtual-table/util.d.ts +229 -0
- package/lib/ele-watermark/index.d.ts +57 -0
- package/lib/ele-watermark/types.d.ts +39 -0
- package/lib/ele-xg-player/index.d.ts +22 -0
- package/lib/ele-xg-player/style/index.d.ts +1 -0
- package/lib/icons/AppstoreAddOutlined.d.ts +2 -0
- package/lib/icons/AppstoreOutlined.d.ts +2 -0
- package/lib/icons/ArrowLeft.d.ts +2 -0
- package/lib/icons/ArrowLeftOutlined.d.ts +2 -0
- package/lib/icons/ArrowRight.d.ts +2 -0
- package/lib/icons/ArrowRightOutlined.d.ts +2 -0
- package/lib/icons/ArrowUp.d.ts +2 -0
- package/lib/icons/ArrowUpOutlined.d.ts +2 -0
- package/lib/icons/BellOutlined.d.ts +2 -0
- package/lib/icons/BookOutlined.d.ts +2 -0
- package/lib/icons/CaretDownFilled.d.ts +2 -0
- package/lib/icons/CaretUpFilled.d.ts +2 -0
- package/lib/icons/CheckOutlined.d.ts +2 -0
- package/lib/icons/ClockCircleOutlined.d.ts +2 -0
- package/lib/icons/CloudUploadOutlined.d.ts +2 -0
- package/lib/icons/ClusterOutlined.d.ts +2 -0
- package/lib/icons/CodeOutlined.d.ts +2 -0
- package/lib/icons/CompassOutlined.d.ts +2 -0
- package/lib/icons/ConnectionOutlined.d.ts +2 -0
- package/lib/icons/ControlOutlined.d.ts +2 -0
- package/lib/icons/CornerRightFilled.d.ts +2 -0
- package/lib/icons/DashboardOutlined.d.ts +2 -0
- package/lib/icons/DesktopOutlined.d.ts +2 -0
- package/lib/icons/DragOutlined.d.ts +2 -0
- package/lib/icons/EditOutlined.d.ts +2 -0
- package/lib/icons/EnvironmentOutlined.d.ts +2 -0
- package/lib/icons/FileOutlined.d.ts +2 -0
- package/lib/icons/FilterFilled.d.ts +2 -0
- package/lib/icons/GlobalOutlined.d.ts +2 -0
- package/lib/icons/HomeOutlined.d.ts +2 -0
- package/lib/icons/LoadingDotOutlined.d.ts +2 -0
- package/lib/icons/LoadingOutlined.d.ts +2 -0
- package/lib/icons/LockOutlined.d.ts +2 -0
- package/lib/icons/LogOutlined.d.ts +2 -0
- package/lib/icons/MailOutlined.d.ts +2 -0
- package/lib/icons/MenuFoldOutlined.d.ts +2 -0
- package/lib/icons/MenuOutlined.d.ts +2 -0
- package/lib/icons/MenuUnfoldOutlined.d.ts +2 -0
- package/lib/icons/MessageOutlined.d.ts +2 -0
- package/lib/icons/MinusCircleOutlined.d.ts +2 -0
- package/lib/icons/MoonOutlined.d.ts +2 -0
- package/lib/icons/MoreOutlined.d.ts +2 -0
- package/lib/icons/PauseFilled.d.ts +2 -0
- package/lib/icons/PieChartOutlined.d.ts +2 -0
- package/lib/icons/PlusOutlined.d.ts +2 -0
- package/lib/icons/ProtectOutlined.d.ts +2 -0
- package/lib/icons/QuestionCircleOutlined.d.ts +2 -0
- package/lib/icons/ReloadOutlined.d.ts +2 -0
- package/lib/icons/SortOutlined.d.ts +2 -0
- package/lib/icons/StarFilled.d.ts +2 -0
- package/lib/icons/StepForwardFilled.d.ts +2 -0
- package/lib/icons/UndoOutlined.d.ts +2 -0
- package/lib/icons/UnlockOutlined.d.ts +2 -0
- package/lib/icons/VerticalLeftOutlined.d.ts +2 -0
- package/lib/icons/WarningOutlined.d.ts +2 -0
- package/lib/icons/ZoomOutOutlined.d.ts +2 -0
- package/lib/index.d.ts +4 -0
- package/lib/installer.d.ts +3 -0
- package/lib/lang/en_US.d.ts +4 -0
- package/lib/lang/zh_CN.d.ts +4 -0
- package/lib/utils/chart-theme-dark.d.ts +373 -0
- package/lib/utils/chart-theme.d.ts +368 -0
- package/lib/utils/core.cjs +318 -0
- package/lib/utils/core.d.ts +168 -0
- package/lib/utils/hook.cjs +264 -0
- package/lib/utils/hook.d.ts +113 -0
- package/lib/utils/menu-util.d.ts +14 -0
- package/lib/utils/message-box.d.ts +25 -0
- package/lib/utils/message.d.ts +66 -0
- package/lib/utils/resolvers.cjs +50 -0
- package/lib/utils/resolvers.d.ts +18 -0
- package/lib/utils/theme-util.d.ts +6 -0
- package/lib/utils/validate.cjs +197 -0
- package/lib/utils/validate.d.ts +182 -0
- package/lib/yu-framework-slider-captcha-dialog/SliderCaptcha.d.ts +67 -0
- package/lib/yu-framework-slider-captcha-dialog/index.d.ts +14 -0
- package/package.json +1 -1
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import { getCurrentInstance, provide, inject, onActivated, onDeactivated, onBeforeUnmount, unref, isVNode, h, mergeProps } from "vue";
|
|
2
|
+
import { ElMessage } from "element-plus";
|
|
3
|
+
import { useGlobalProps } from "../ele-config-provider/receiver";
|
|
4
|
+
import { useLayoutState } from "../ele-pro-layout/util";
|
|
5
|
+
import MessageBody from "../ele-app/components/message-body";
|
|
6
|
+
import { omit, queryChild } from "./core";
|
|
7
|
+
function blurCurrentFocus() {
|
|
8
|
+
var _a;
|
|
9
|
+
if (typeof ((_a = document == null ? void 0 : document.body) == null ? void 0 : _a.querySelector) === "function") {
|
|
10
|
+
const el = document.body.querySelector(":focus");
|
|
11
|
+
typeof (el == null ? void 0 : el.blur) === "function" && el.blur();
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function getWrapEl(bodyEl, force, groupKey) {
|
|
15
|
+
const parent = bodyEl || document.body;
|
|
16
|
+
const className = "ele-message-wrapper";
|
|
17
|
+
const attr = "data-group";
|
|
18
|
+
const attrSelector = groupKey == null ? void 0 : [attr, groupKey];
|
|
19
|
+
const el = force ? void 0 : queryChild(parent, className, attrSelector);
|
|
20
|
+
if (el != null) {
|
|
21
|
+
return el;
|
|
22
|
+
}
|
|
23
|
+
const elem = document.createElement("div");
|
|
24
|
+
elem.classList.add(className);
|
|
25
|
+
if (groupKey) {
|
|
26
|
+
elem.setAttribute(attr, groupKey);
|
|
27
|
+
}
|
|
28
|
+
parent.appendChild(elem);
|
|
29
|
+
return elem;
|
|
30
|
+
}
|
|
31
|
+
function getDefaultGroupKey() {
|
|
32
|
+
const url = location == null ? void 0 : location.href;
|
|
33
|
+
const pi = url.indexOf("?");
|
|
34
|
+
return url.substring(0, pi < 0 ? void 0 : pi);
|
|
35
|
+
}
|
|
36
|
+
function getOffsetStyle(offset, userStyle) {
|
|
37
|
+
const mt = typeof offset === "number" ? `${offset}px` : offset;
|
|
38
|
+
return mergeProps({ style: { marginTop: mt } }, { style: userStyle }).style;
|
|
39
|
+
}
|
|
40
|
+
function isObjOpt(params) {
|
|
41
|
+
return params != null && typeof params === "object" && !isVNode(params);
|
|
42
|
+
}
|
|
43
|
+
function normalizeOption(params, globalOpt, onClose, type, loading, getWrapEl2, groupKey, messageId, onMessageDestroy) {
|
|
44
|
+
const opt = { ...globalOpt || {} };
|
|
45
|
+
if (isObjOpt(params)) {
|
|
46
|
+
Object.assign(opt, params);
|
|
47
|
+
} else {
|
|
48
|
+
opt.message = params;
|
|
49
|
+
}
|
|
50
|
+
opt.type = type ?? opt.type;
|
|
51
|
+
opt.appendTo = (opt.appendTo == null ? void 0 : unref(opt.appendTo)) ?? (getWrapEl2 == null ? void 0 : getWrapEl2(opt.inner));
|
|
52
|
+
const classes = ["ele-message"];
|
|
53
|
+
if (opt.original === "plain") {
|
|
54
|
+
classes.push("is-plain-alert");
|
|
55
|
+
} else if (opt.original) {
|
|
56
|
+
classes.push("is-alert");
|
|
57
|
+
} else if (opt.plain) {
|
|
58
|
+
classes.push("is-plain");
|
|
59
|
+
}
|
|
60
|
+
if (loading) {
|
|
61
|
+
classes.push("is-loading");
|
|
62
|
+
opt.duration = opt.duration ?? 0;
|
|
63
|
+
if (opt.mask) {
|
|
64
|
+
classes.push("is-show-mask");
|
|
65
|
+
}
|
|
66
|
+
if (opt.centered) {
|
|
67
|
+
classes.push("is-centered");
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (opt.inner) {
|
|
71
|
+
classes.push("is-inner");
|
|
72
|
+
}
|
|
73
|
+
if (opt.customClass) {
|
|
74
|
+
classes.push(opt.customClass);
|
|
75
|
+
}
|
|
76
|
+
opt.customClass = classes.join(" ");
|
|
77
|
+
if (opt.offset != null && opt.offset !== "") {
|
|
78
|
+
opt.style = getOffsetStyle(opt.offset, opt.style);
|
|
79
|
+
}
|
|
80
|
+
const content = opt.message;
|
|
81
|
+
const isFn = typeof content === "function";
|
|
82
|
+
const isStr = !(isFn || isVNode(content));
|
|
83
|
+
opt.icon = h(
|
|
84
|
+
MessageBody,
|
|
85
|
+
{
|
|
86
|
+
message: isStr && content != null ? String(content) : void 0,
|
|
87
|
+
type: opt.type,
|
|
88
|
+
icon: opt.icon,
|
|
89
|
+
showClose: opt.showClose,
|
|
90
|
+
dangerouslyUseHTMLString: opt.dangerouslyUseHTMLString,
|
|
91
|
+
loading,
|
|
92
|
+
messageId,
|
|
93
|
+
onClose,
|
|
94
|
+
onMessageDestroy
|
|
95
|
+
},
|
|
96
|
+
{ default: isFn ? content : isStr ? void 0 : () => content }
|
|
97
|
+
);
|
|
98
|
+
const key = (opt.inner ? groupKey : void 0) ?? "";
|
|
99
|
+
opt.message = isStr ? `${key}_${content ?? ""}` : void 0;
|
|
100
|
+
opt.grouping = isStr ? opt.grouping : false;
|
|
101
|
+
return omit(opt, [
|
|
102
|
+
"showClose",
|
|
103
|
+
"dangerouslyUseHTMLString",
|
|
104
|
+
"offset",
|
|
105
|
+
"original",
|
|
106
|
+
"plain",
|
|
107
|
+
"mask",
|
|
108
|
+
"centered",
|
|
109
|
+
"inner",
|
|
110
|
+
"groupKey"
|
|
111
|
+
]);
|
|
112
|
+
}
|
|
113
|
+
const EleMessage = function(params, context) {
|
|
114
|
+
const onClose = () => ins.close();
|
|
115
|
+
const getWrap = () => getWrapEl();
|
|
116
|
+
const opt = normalizeOption(params, null, onClose, null, null, getWrap);
|
|
117
|
+
const ins = ElMessage(opt, context);
|
|
118
|
+
return ins;
|
|
119
|
+
};
|
|
120
|
+
EleMessage.success = function(params, context) {
|
|
121
|
+
const onClose = () => ins.close();
|
|
122
|
+
const getWrap = () => getWrapEl();
|
|
123
|
+
const opt = normalizeOption(params, null, onClose, "success", null, getWrap);
|
|
124
|
+
const ins = ElMessage(opt, context);
|
|
125
|
+
return ins;
|
|
126
|
+
};
|
|
127
|
+
EleMessage.warning = function(params, context) {
|
|
128
|
+
const onClose = () => ins.close();
|
|
129
|
+
const getWrap = () => getWrapEl();
|
|
130
|
+
const opt = normalizeOption(params, null, onClose, "warning", null, getWrap);
|
|
131
|
+
const ins = ElMessage(opt, context);
|
|
132
|
+
return ins;
|
|
133
|
+
};
|
|
134
|
+
EleMessage.error = function(params, context) {
|
|
135
|
+
const onClose = () => ins.close();
|
|
136
|
+
const getWrap = () => getWrapEl();
|
|
137
|
+
const opt = normalizeOption(params, null, onClose, "error", null, getWrap);
|
|
138
|
+
const ins = ElMessage(opt, context);
|
|
139
|
+
return ins;
|
|
140
|
+
};
|
|
141
|
+
EleMessage.info = function(params, context) {
|
|
142
|
+
const onClose = () => ins.close();
|
|
143
|
+
const getWrap = () => getWrapEl();
|
|
144
|
+
const opt = normalizeOption(params, null, onClose, null, null, getWrap);
|
|
145
|
+
const ins = ElMessage(opt, context);
|
|
146
|
+
return ins;
|
|
147
|
+
};
|
|
148
|
+
EleMessage.loading = function(params, context) {
|
|
149
|
+
blurCurrentFocus();
|
|
150
|
+
const onClose = () => ins.close();
|
|
151
|
+
const getWrap = () => getWrapEl();
|
|
152
|
+
const opt = normalizeOption(params, null, onClose, null, true, getWrap);
|
|
153
|
+
const ins = ElMessage(opt, context);
|
|
154
|
+
return ins;
|
|
155
|
+
};
|
|
156
|
+
EleMessage.closeAll = function(type) {
|
|
157
|
+
return ElMessage.closeAll(type);
|
|
158
|
+
};
|
|
159
|
+
const MESSAGE_KEY = Symbol("message");
|
|
160
|
+
function useMessage(globalOpt) {
|
|
161
|
+
var _a, _b;
|
|
162
|
+
const layoutState = useLayoutState();
|
|
163
|
+
const globalProps = useGlobalProps("message");
|
|
164
|
+
const appContext = (_b = (_a = getCurrentInstance) == null ? void 0 : _a()) == null ? void 0 : _b.appContext;
|
|
165
|
+
const groupKey = (globalOpt == null ? void 0 : globalOpt.groupKey) || getDefaultGroupKey();
|
|
166
|
+
const state = { wrapEl: null, isActivated: true, id: 0 };
|
|
167
|
+
const instances = /* @__PURE__ */ new Map();
|
|
168
|
+
const hideClass = "is-hide";
|
|
169
|
+
provide(MESSAGE_KEY, { groupKey, getInnerWrap: () => getWrap(true) });
|
|
170
|
+
const parentMsg = inject(MESSAGE_KEY, null);
|
|
171
|
+
onActivated(() => {
|
|
172
|
+
state.isActivated = true;
|
|
173
|
+
state.wrapEl && state.wrapEl.classList.remove(hideClass);
|
|
174
|
+
});
|
|
175
|
+
onDeactivated(() => {
|
|
176
|
+
state.isActivated = false;
|
|
177
|
+
state.wrapEl && state.wrapEl.classList.add(hideClass);
|
|
178
|
+
});
|
|
179
|
+
onBeforeUnmount(() => {
|
|
180
|
+
for (const [_key, ins] of instances) {
|
|
181
|
+
ins && ins.close && ins.close();
|
|
182
|
+
}
|
|
183
|
+
instances.clear();
|
|
184
|
+
});
|
|
185
|
+
const getWrap = (inner) => {
|
|
186
|
+
if (inner) {
|
|
187
|
+
if (parentMsg != null && parentMsg.groupKey === groupKey) {
|
|
188
|
+
return parentMsg.getInnerWrap();
|
|
189
|
+
}
|
|
190
|
+
if (state.wrapEl == null && layoutState.modalsEl != null) {
|
|
191
|
+
state.wrapEl = getWrapEl(layoutState.modalsEl, false, groupKey);
|
|
192
|
+
if (!state.isActivated) {
|
|
193
|
+
state.wrapEl.classList.add(hideClass);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
if (state.wrapEl != null) {
|
|
197
|
+
return state.wrapEl;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return getWrapEl();
|
|
201
|
+
};
|
|
202
|
+
const getOpt = function(params, onClose, type, loading) {
|
|
203
|
+
state.id++;
|
|
204
|
+
const msgId = `m_${state.id}`;
|
|
205
|
+
const opt = normalizeOption(
|
|
206
|
+
params,
|
|
207
|
+
{ ...globalProps.value || {}, ...globalOpt || {} },
|
|
208
|
+
onClose,
|
|
209
|
+
type,
|
|
210
|
+
loading,
|
|
211
|
+
getWrap,
|
|
212
|
+
groupKey,
|
|
213
|
+
msgId,
|
|
214
|
+
(messageId) => {
|
|
215
|
+
messageId && instances.delete(messageId);
|
|
216
|
+
}
|
|
217
|
+
);
|
|
218
|
+
return { opt, msgId };
|
|
219
|
+
};
|
|
220
|
+
const message = function(params) {
|
|
221
|
+
const { opt, msgId } = getOpt(params, () => ins.close());
|
|
222
|
+
const ins = ElMessage(opt, appContext);
|
|
223
|
+
instances.set(msgId, ins);
|
|
224
|
+
return ins;
|
|
225
|
+
};
|
|
226
|
+
message.success = function(params) {
|
|
227
|
+
const { opt, msgId } = getOpt(params, () => ins.close(), "success", false);
|
|
228
|
+
const ins = ElMessage(opt, appContext);
|
|
229
|
+
instances.set(msgId, ins);
|
|
230
|
+
return ins;
|
|
231
|
+
};
|
|
232
|
+
message.warning = function(params) {
|
|
233
|
+
const { opt, msgId } = getOpt(params, () => ins.close(), "warning", false);
|
|
234
|
+
const ins = ElMessage(opt, appContext);
|
|
235
|
+
instances.set(msgId, ins);
|
|
236
|
+
return ins;
|
|
237
|
+
};
|
|
238
|
+
message.error = function(params) {
|
|
239
|
+
const { opt, msgId } = getOpt(params, () => ins.close(), "error", false);
|
|
240
|
+
const ins = ElMessage(opt, appContext);
|
|
241
|
+
instances.set(msgId, ins);
|
|
242
|
+
return ins;
|
|
243
|
+
};
|
|
244
|
+
message.info = function(params) {
|
|
245
|
+
const { opt, msgId } = getOpt(params, () => ins.close());
|
|
246
|
+
const ins = ElMessage(opt, appContext);
|
|
247
|
+
instances.set(msgId, ins);
|
|
248
|
+
return ins;
|
|
249
|
+
};
|
|
250
|
+
message.loading = function(params) {
|
|
251
|
+
blurCurrentFocus();
|
|
252
|
+
const { opt, msgId } = getOpt(params, () => ins.close(), void 0, true);
|
|
253
|
+
const ins = ElMessage(opt, appContext);
|
|
254
|
+
instances.set(msgId, ins);
|
|
255
|
+
return ins;
|
|
256
|
+
};
|
|
257
|
+
message.closeAll = function(type) {
|
|
258
|
+
instances.clear();
|
|
259
|
+
return ElMessage.closeAll(type);
|
|
260
|
+
};
|
|
261
|
+
return message;
|
|
262
|
+
}
|
|
263
|
+
export {
|
|
264
|
+
EleMessage,
|
|
265
|
+
MESSAGE_KEY,
|
|
266
|
+
useMessage
|
|
267
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ComponentResolver } from 'unplugin-vue-components/types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 参数类型
|
|
5
|
+
*/
|
|
6
|
+
export interface EleAdminResolverOptions {
|
|
7
|
+
/** 包路径 */
|
|
8
|
+
path?: string | '' | '/es' | '/lib' | '/es/core' | '/lib/core';
|
|
9
|
+
/** 排除的组件名称 */
|
|
10
|
+
exclude?: string[];
|
|
11
|
+
/** 是否导入样式 */
|
|
12
|
+
importStyle?: boolean | 'css' | 'sass';
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* 按需加载插件,这里控制打包后的组件按需加载,如果匹配不上,会出现:开发环境组件正常显示,但是生产环境无法解析组件的情况
|
|
16
|
+
* @param options 参数
|
|
17
|
+
*/
|
|
18
|
+
export declare function EleAdminResolver(options?: EleAdminResolverOptions): ComponentResolver;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
function getSideEffects(path, options) {
|
|
2
|
+
const importStyle = options == null ? void 0 : options.importStyle;
|
|
3
|
+
if (!importStyle) {
|
|
4
|
+
return;
|
|
5
|
+
}
|
|
6
|
+
if (importStyle === "css") {
|
|
7
|
+
return `${path}/style/css`;
|
|
8
|
+
}
|
|
9
|
+
return `${path}/style/index`;
|
|
10
|
+
}
|
|
11
|
+
function getStylePath(namePath, packageName, path) {
|
|
12
|
+
if (!path) {
|
|
13
|
+
return `${packageName}/es/${namePath}`;
|
|
14
|
+
}
|
|
15
|
+
if (path === "/es/core") {
|
|
16
|
+
return `${packageName}/es/${namePath}`;
|
|
17
|
+
}
|
|
18
|
+
if (path === "/lib/core") {
|
|
19
|
+
return `${packageName}/lib/${namePath}`;
|
|
20
|
+
}
|
|
21
|
+
return `${packageName}${path}/${namePath}`;
|
|
22
|
+
}
|
|
23
|
+
function EleAdminResolver(options) {
|
|
24
|
+
return {
|
|
25
|
+
type: "component",
|
|
26
|
+
resolve: (name) => {
|
|
27
|
+
var _a;
|
|
28
|
+
const { path, exclude } = options || {};
|
|
29
|
+
if ((name.match(/^Ele[A-Z]/) || name.match(/^Yu[A-Z]/)) && !((_a = exclude == null ? void 0 : exclude.includes) == null ? void 0 : _a.call(exclude, name))) {
|
|
30
|
+
const packageName = "yuang-framework-ui-pc";
|
|
31
|
+
const namePath = name.replace(/([A-Z])/g, " $1").trim().split(" ").join("-").toLowerCase();
|
|
32
|
+
const stylePath = getStylePath(namePath, packageName, path);
|
|
33
|
+
if (!path || path === "/es/core" || path === "/lib/core") {
|
|
34
|
+
return {
|
|
35
|
+
name,
|
|
36
|
+
from: `${packageName}${path ?? "/es"}`,
|
|
37
|
+
sideEffects: getSideEffects(stylePath, options)
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
from: `${packageName}${path}/${namePath}/index`,
|
|
42
|
+
sideEffects: getSideEffects(stylePath, options)
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export {
|
|
49
|
+
EleAdminResolver
|
|
50
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { generate } from "@ant-design/colors";
|
|
2
|
+
function changeColor(color, dark) {
|
|
3
|
+
const $html = document.documentElement;
|
|
4
|
+
if (!$html) {
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
7
|
+
const id = "ele-theme-var";
|
|
8
|
+
const elem = document.getElementById(id);
|
|
9
|
+
if (elem == null ? void 0 : elem.parentNode) {
|
|
10
|
+
elem.parentNode.removeChild(elem);
|
|
11
|
+
}
|
|
12
|
+
if (color) {
|
|
13
|
+
const colors = generate(color, dark ? { theme: "dark" } : {});
|
|
14
|
+
const selector = dark ? "html.dark" : ":root";
|
|
15
|
+
const elem2 = document.createElement("style");
|
|
16
|
+
elem2.id = id;
|
|
17
|
+
elem2.setAttribute("type", "text/css");
|
|
18
|
+
elem2.innerHTML = [
|
|
19
|
+
`${selector}{`,
|
|
20
|
+
`--el-color-primary:${color};`,
|
|
21
|
+
`--el-color-primary-light-3:${colors[4]};`,
|
|
22
|
+
`--el-color-primary-light-5:${colors[3]};`,
|
|
23
|
+
`--el-color-primary-light-7:${colors[2]};`,
|
|
24
|
+
`--el-color-primary-light-8:${colors[1]};`,
|
|
25
|
+
`--el-color-primary-light-9:${colors[0]};`,
|
|
26
|
+
`--el-color-primary-dark-2:${colors[6]};`,
|
|
27
|
+
"}"
|
|
28
|
+
].join("");
|
|
29
|
+
document.head.appendChild(elem2);
|
|
30
|
+
$html.dataset.color = color;
|
|
31
|
+
} else {
|
|
32
|
+
$html.removeAttribute("data-color");
|
|
33
|
+
}
|
|
34
|
+
if (dark) {
|
|
35
|
+
$html.classList.add("dark");
|
|
36
|
+
} else {
|
|
37
|
+
$html.classList.remove("dark");
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export {
|
|
41
|
+
changeColor
|
|
42
|
+
};
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/** 格式校验工具 */
|
|
2
|
+
/**
|
|
3
|
+
* 手机号正则表达式
|
|
4
|
+
*/
|
|
5
|
+
export declare const phoneReg: RegExp;
|
|
6
|
+
/**
|
|
7
|
+
* 手机号正则表达式(强校验)
|
|
8
|
+
*/
|
|
9
|
+
export declare const phoneStrongReg: RegExp;
|
|
10
|
+
/**
|
|
11
|
+
* 固话正则表达式
|
|
12
|
+
*/
|
|
13
|
+
export declare const telReg: RegExp;
|
|
14
|
+
/**
|
|
15
|
+
* 邮箱正则表达式
|
|
16
|
+
*/
|
|
17
|
+
export declare const emailReg: RegExp;
|
|
18
|
+
/**
|
|
19
|
+
* 网址正则表达式
|
|
20
|
+
*/
|
|
21
|
+
export declare const urlReg: RegExp;
|
|
22
|
+
/**
|
|
23
|
+
* 身份证正则表达式
|
|
24
|
+
*/
|
|
25
|
+
export declare const identityReg: RegExp;
|
|
26
|
+
/**
|
|
27
|
+
* 日期正则表达式
|
|
28
|
+
*/
|
|
29
|
+
export declare const dateReg: RegExp;
|
|
30
|
+
/**
|
|
31
|
+
* 数字正则表达式
|
|
32
|
+
*/
|
|
33
|
+
export declare const numberReg: RegExp;
|
|
34
|
+
/**
|
|
35
|
+
* 整数正则表达式
|
|
36
|
+
*/
|
|
37
|
+
export declare const integerReg: RegExp;
|
|
38
|
+
/**
|
|
39
|
+
* 正整数正则表达式
|
|
40
|
+
*/
|
|
41
|
+
export declare const positiveIntegerReg: RegExp;
|
|
42
|
+
/**
|
|
43
|
+
* 负整数正则表达式
|
|
44
|
+
*/
|
|
45
|
+
export declare const negativeIntegerReg: RegExp;
|
|
46
|
+
/**
|
|
47
|
+
* 非负整数(正整数或0)正则表达式
|
|
48
|
+
*/
|
|
49
|
+
export declare const nonNegativeIntegerReg: RegExp;
|
|
50
|
+
/**
|
|
51
|
+
* 非正整数(负整数或0)正则表达式
|
|
52
|
+
*/
|
|
53
|
+
export declare const nonPositiveIntegerReg: RegExp;
|
|
54
|
+
/**
|
|
55
|
+
* 中文正则表达式
|
|
56
|
+
*/
|
|
57
|
+
export declare const chineseReg: RegExp;
|
|
58
|
+
/**
|
|
59
|
+
* 端口号正则表达式
|
|
60
|
+
*/
|
|
61
|
+
export declare const portReg: RegExp;
|
|
62
|
+
/**
|
|
63
|
+
* IP 正则表达式
|
|
64
|
+
*/
|
|
65
|
+
export declare const ipReg: RegExp;
|
|
66
|
+
/**
|
|
67
|
+
* 经度正则表达式, -180.0 ~ +180.0(整数部分为 0 ~ 180 , 必须输入 1 到 5 位小数)
|
|
68
|
+
*/
|
|
69
|
+
export declare const longitudeReg: RegExp;
|
|
70
|
+
/**
|
|
71
|
+
* 纬度正则表达式, -90.0 ~ +90.0(整数部分为 0 ~ 90, 必须输入 1 到 5 位小数)
|
|
72
|
+
*/
|
|
73
|
+
export declare const latitudeReg: RegExp;
|
|
74
|
+
/**
|
|
75
|
+
* 是否是手机号
|
|
76
|
+
* @param value
|
|
77
|
+
*/
|
|
78
|
+
export declare function isPhone(value: string): boolean;
|
|
79
|
+
/**
|
|
80
|
+
* 是否是手机号(强校验)
|
|
81
|
+
* @param value
|
|
82
|
+
*/
|
|
83
|
+
export declare function isPhoneStrong(value: string): boolean;
|
|
84
|
+
/**
|
|
85
|
+
* 是否为固话
|
|
86
|
+
* @param value
|
|
87
|
+
*/
|
|
88
|
+
export declare function isTel(value: string): boolean;
|
|
89
|
+
/**
|
|
90
|
+
* 是否是邮箱
|
|
91
|
+
* @param value
|
|
92
|
+
*/
|
|
93
|
+
export declare function isEmail(value: string): boolean;
|
|
94
|
+
/**
|
|
95
|
+
* 是否是网址
|
|
96
|
+
* @param value
|
|
97
|
+
*/
|
|
98
|
+
export declare function isUrl(value: string): boolean;
|
|
99
|
+
/**
|
|
100
|
+
* 是否是身份证
|
|
101
|
+
* @param value
|
|
102
|
+
*/
|
|
103
|
+
export declare function isIdentity(value: string): boolean;
|
|
104
|
+
/**
|
|
105
|
+
* 是否是日期
|
|
106
|
+
* @param value
|
|
107
|
+
*/
|
|
108
|
+
export declare function isDate(value: string): boolean;
|
|
109
|
+
/**
|
|
110
|
+
* 是否是数字
|
|
111
|
+
* @param value
|
|
112
|
+
*/
|
|
113
|
+
export declare function isNumber(value: string): boolean;
|
|
114
|
+
/**
|
|
115
|
+
* 是否是整数
|
|
116
|
+
* @param value
|
|
117
|
+
*/
|
|
118
|
+
export declare function isInteger(value: string): boolean;
|
|
119
|
+
/**
|
|
120
|
+
* 是否是正整数
|
|
121
|
+
* @param value
|
|
122
|
+
*/
|
|
123
|
+
export declare function isPositiveInteger(value: string): boolean;
|
|
124
|
+
/**
|
|
125
|
+
* 是否是负整数
|
|
126
|
+
* @param value
|
|
127
|
+
*/
|
|
128
|
+
export declare function isNegativeInteger(value: string): boolean;
|
|
129
|
+
/**
|
|
130
|
+
* 是否是非负整数(正整数或 0)
|
|
131
|
+
* @param value
|
|
132
|
+
*/
|
|
133
|
+
export declare function isNonNegativeInteger(value: string): boolean;
|
|
134
|
+
/**
|
|
135
|
+
* 是否是非正整数(负整数或 0)
|
|
136
|
+
* @param value
|
|
137
|
+
*/
|
|
138
|
+
export declare function isNonPositiveInteger(value: string): boolean;
|
|
139
|
+
/**
|
|
140
|
+
* 是否是中文
|
|
141
|
+
* @param value
|
|
142
|
+
*/
|
|
143
|
+
export declare function isChinese(value: string): boolean;
|
|
144
|
+
/**
|
|
145
|
+
* 是否是端口号
|
|
146
|
+
* @param value
|
|
147
|
+
*/
|
|
148
|
+
export declare function isPort(value: string): boolean;
|
|
149
|
+
/**
|
|
150
|
+
* 是否是 IP
|
|
151
|
+
* @param value
|
|
152
|
+
*/
|
|
153
|
+
export declare function isIP(value: string): boolean;
|
|
154
|
+
/**
|
|
155
|
+
* 是否是经度, -180.0 ~ +180.0(整数部分为 0 ~ 180 , 必须输入 1 到 5 位小数)
|
|
156
|
+
* @param value
|
|
157
|
+
*/
|
|
158
|
+
export declare function isLongitude(value: string): boolean;
|
|
159
|
+
/**
|
|
160
|
+
* 是否是纬度, -90.0 ~ +90.0(整数部分为 0 ~ 90 , 必须输入 1 到 5 位小数)
|
|
161
|
+
* @param value
|
|
162
|
+
*/
|
|
163
|
+
export declare function isLatitude(value: string): boolean;
|
|
164
|
+
/**
|
|
165
|
+
* 验证最小长度, 最大长度
|
|
166
|
+
* @param value
|
|
167
|
+
* @param minLength
|
|
168
|
+
* @param maxLength
|
|
169
|
+
*/
|
|
170
|
+
export declare function maxMinLength(value: string, minLength?: number, maxLength?: number): boolean;
|
|
171
|
+
/**
|
|
172
|
+
* 验证最小值, 最大值
|
|
173
|
+
* @param value
|
|
174
|
+
* @param min
|
|
175
|
+
* @param max
|
|
176
|
+
*/
|
|
177
|
+
export declare function maxMin(value: number, min?: number, max?: number): boolean;
|
|
178
|
+
/**
|
|
179
|
+
* 是否是身份证(强校验)
|
|
180
|
+
* @param value
|
|
181
|
+
*/
|
|
182
|
+
export declare function isIdentityStrong(value: string): string | null | undefined;
|