@fmdeui/fmui 1.0.9 → 1.0.11
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/components/svgIcon/index.d.ts +7 -26
- package/es/hooks/index.d.ts +0 -26
- package/es/hooks/other.d.ts +0 -8
- package/es/index.d.ts +30 -0
- package/es/index.mjs +8 -5
- package/es/make-installer.mjs +8 -3
- package/es/packages/components/index.mjs +10 -0
- package/es/packages/components/svgIcon/index.mjs +17 -0
- package/es/packages/components/svgIcon/svgicon.vue.mjs +5 -0
- package/es/packages/components/svgIcon/svgicon.vue2.mjs +94 -0
- package/es/packages/hooks/index.mjs +0 -5
- package/es/packages/hooks/other.mjs +137 -0
- package/es/packages/utils/index.mjs +0 -3
- package/es/utils/index.d.ts +0 -4
- package/index.js +752 -497
- package/index.min.js +4 -4
- package/index.min.mjs +4 -4
- package/index.mjs +732 -499
- package/lib/components/svgIcon/index.d.ts +7 -26
- package/lib/hooks/index.d.ts +0 -26
- package/lib/hooks/other.d.ts +0 -8
- package/lib/index.d.ts +30 -0
- package/lib/index.js +30 -23
- package/lib/make-installer.js +9 -4
- package/lib/packages/components/index.js +25 -0
- package/lib/packages/components/svgIcon/index.js +38 -0
- package/lib/packages/components/svgIcon/svgicon.vue.js +9 -0
- package/lib/packages/components/svgIcon/svgicon.vue2.js +98 -0
- package/lib/packages/hooks/index.js +1 -4
- package/lib/packages/hooks/other.js +149 -0
- package/lib/packages/utils/index.js +0 -5
- package/lib/utils/index.d.ts +0 -4
- package/locale/en.js +1 -1
- package/locale/en.min.js +1 -1
- package/locale/en.min.mjs +1 -1
- package/locale/en.mjs +1 -1
- package/locale/zh-cn.js +1 -1
- package/locale/zh-cn.min.js +1 -1
- package/locale/zh-cn.min.mjs +1 -1
- package/locale/zh-cn.mjs +1 -1
- package/package.json +1 -1
- /package/es/components/svgIcon/{index.vue.d.ts → svgicon.vue.d.ts} +0 -0
- /package/{lib → es}/defaults.css +0 -0
- /package/lib/components/svgIcon/{index.vue.d.ts → svgicon.vue.d.ts} +0 -0
- /package/{es/make-installer.css → lib/version.css} +0 -0
|
@@ -1,26 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
default: () => number;
|
|
9
|
-
};
|
|
10
|
-
color: {
|
|
11
|
-
type: StringConstructor;
|
|
12
|
-
};
|
|
13
|
-
}>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly< ExtractPropTypes<{
|
|
14
|
-
name: {
|
|
15
|
-
type: StringConstructor;
|
|
16
|
-
};
|
|
17
|
-
size: {
|
|
18
|
-
type: NumberConstructor;
|
|
19
|
-
default: () => number;
|
|
20
|
-
};
|
|
21
|
-
color: {
|
|
22
|
-
type: StringConstructor;
|
|
23
|
-
};
|
|
24
|
-
}>> & Readonly<{}>, {
|
|
25
|
-
size: number;
|
|
26
|
-
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
1
|
+
import { App } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* 导出全局注册 element plus svg 图标
|
|
4
|
+
* @param app vue 实例
|
|
5
|
+
* @description 使用:https://element-plus.gitee.io/zh-CN/component/icon.html
|
|
6
|
+
*/
|
|
7
|
+
export declare function elSvg(app: App): void;
|
package/es/hooks/index.d.ts
CHANGED
|
@@ -1,29 +1,3 @@
|
|
|
1
|
-
import { default as commonFunction } from './commonFunction';
|
|
2
|
-
import { EmptyArrayType } from 'fmdeui-fmui';
|
|
3
|
-
import { MessageHandler } from 'element-plus';
|
|
4
|
-
declare const commonFun: {
|
|
5
|
-
percentFormat: (row: EmptyArrayType, column: number, cellValue: string) => string;
|
|
6
|
-
dateFormatYMD: (row: EmptyArrayType, column: number, cellValue: string) => string;
|
|
7
|
-
dateFormatYMDHMS: (row: EmptyArrayType, column: number, cellValue: string) => string;
|
|
8
|
-
dateFormatHMS: (row: EmptyArrayType, column: number, cellValue: string) => string;
|
|
9
|
-
scaleFormat: (value?: string, scale?: number) => string;
|
|
10
|
-
scale2Format: (value?: string) => string;
|
|
11
|
-
groupSeparator: (value: number, minimumFractionDigits?: number) => string;
|
|
12
|
-
copyText: (text: string) => Promise<unknown>;
|
|
13
|
-
removeHtmlSub: (value: string) => string;
|
|
14
|
-
removeHtml: (value: string) => string;
|
|
15
|
-
getEnumDesc: (key: any, lstEnum: any) => any;
|
|
16
|
-
appendQueryParams: (url: string, params: {
|
|
17
|
-
[key: string]: any;
|
|
18
|
-
}) => string;
|
|
19
|
-
getNameAbbr: (text: string, callback?: (abbr: any) => void) => Promise<any> | MessageHandler | undefined;
|
|
20
|
-
handleConditionalClear: (condition: boolean, fieldValue: any, clearValue?: any) => any;
|
|
21
|
-
getTimeRangePickerShortcuts: () => {
|
|
22
|
-
text: string;
|
|
23
|
-
value: () => Date[];
|
|
24
|
-
}[];
|
|
25
|
-
};
|
|
26
|
-
export { commonFunction, commonFun, };
|
|
27
1
|
export * from './useLocale';
|
|
28
2
|
export * from './authFunction';
|
|
29
3
|
export * from './useVxeTableOptionsHook';
|
package/es/hooks/other.d.ts
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import { App } from 'vue';
|
|
2
1
|
import { EmptyArrayType, EmptyObjectType, RouteItem, RouteToFrom } from 'fmdeui-fmui/es/types';
|
|
3
|
-
/**
|
|
4
|
-
* 导出全局注册 element plus svg 图标
|
|
5
|
-
* @param app vue 实例
|
|
6
|
-
* @description 使用:https://element-plus.gitee.io/zh-CN/component/icon.html
|
|
7
|
-
*/
|
|
8
|
-
export declare function elSvg(app: App): void;
|
|
9
2
|
/**
|
|
10
3
|
* 设置浏览器标题国际化
|
|
11
4
|
* @method const title = useTitle(); ==> title()
|
|
@@ -64,7 +57,6 @@ export declare function handleOpenLink(val: RouteItem): void;
|
|
|
64
57
|
* @method handleOpenLink 打开外部链接
|
|
65
58
|
*/
|
|
66
59
|
declare const other: {
|
|
67
|
-
elSvg: (app: App) => void;
|
|
68
60
|
useTitle: () => void;
|
|
69
61
|
setTagsViewNameI18n(route: RouteToFrom): string;
|
|
70
62
|
lazyImg: (el: string, arr: EmptyArrayType) => void;
|
package/es/index.d.ts
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { default as installer } from './defaults';
|
|
2
|
+
import { default as setIntroduction, setCssCdn, setJsCdn } from './utils/setIconfont';
|
|
3
|
+
import { default as emitter } from './utils/mitt';
|
|
4
|
+
import { default as Watermark } from './utils/watermark';
|
|
5
|
+
import { default as commonFunction } from './hooks/commonFunction';
|
|
6
|
+
import { default as other } from './hooks/other';
|
|
7
|
+
import { EmptyArrayType } from './types';
|
|
8
|
+
import { MessageHandler } from 'element-plus';
|
|
2
9
|
import { App } from 'vue';
|
|
3
10
|
export * from './types';
|
|
4
11
|
export * from './api';
|
|
@@ -7,6 +14,29 @@ export * from './stores';
|
|
|
7
14
|
export * from './hooks';
|
|
8
15
|
export * from './router';
|
|
9
16
|
export * from './locale';
|
|
17
|
+
declare const commonFun: {
|
|
18
|
+
percentFormat: (row: EmptyArrayType, column: number, cellValue: string) => string;
|
|
19
|
+
dateFormatYMD: (row: EmptyArrayType, column: number, cellValue: string) => string;
|
|
20
|
+
dateFormatYMDHMS: (row: EmptyArrayType, column: number, cellValue: string) => string;
|
|
21
|
+
dateFormatHMS: (row: EmptyArrayType, column: number, cellValue: string) => string;
|
|
22
|
+
scaleFormat: (value?: string, scale?: number) => string;
|
|
23
|
+
scale2Format: (value?: string) => string;
|
|
24
|
+
groupSeparator: (value: number, minimumFractionDigits?: number) => string;
|
|
25
|
+
copyText: (text: string) => Promise<unknown>;
|
|
26
|
+
removeHtmlSub: (value: string) => string;
|
|
27
|
+
removeHtml: (value: string) => string;
|
|
28
|
+
getEnumDesc: (key: any, lstEnum: any) => any;
|
|
29
|
+
appendQueryParams: (url: string, params: {
|
|
30
|
+
[key: string]: any;
|
|
31
|
+
}) => string;
|
|
32
|
+
getNameAbbr: (text: string, callback?: (abbr: any) => void) => Promise<any> | MessageHandler | undefined;
|
|
33
|
+
handleConditionalClear: (condition: boolean, fieldValue: any, clearValue?: any) => any;
|
|
34
|
+
getTimeRangePickerShortcuts: () => {
|
|
35
|
+
text: string;
|
|
36
|
+
value: () => Date[];
|
|
37
|
+
}[];
|
|
38
|
+
};
|
|
39
|
+
export { setIntroduction, emitter as mittBus, Watermark, other, commonFunction, commonFun, setCssCdn, setJsCdn };
|
|
10
40
|
export { version } from './version';
|
|
11
41
|
export declare const install: (app: App) => void;
|
|
12
42
|
export default installer;
|
package/es/index.mjs
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import installer from './defaults.mjs';
|
|
2
|
+
export { setCssCdn, default as setIntroduction, setJsCdn } from './packages/utils/setIconfont.mjs';
|
|
3
|
+
export { default as mittBus } from './packages/utils/mitt.mjs';
|
|
4
|
+
export { default as Watermark } from './packages/utils/watermark.mjs';
|
|
5
|
+
import commonFunction from './packages/hooks/commonFunction.mjs';
|
|
6
|
+
export { default as other } from './packages/hooks/other.mjs';
|
|
2
7
|
import './packages/types/index.mjs';
|
|
3
8
|
export { AccountTypeEnum, HttpMethodEnum, JobCreateTypeEnum } from './packages/api/index.mjs';
|
|
4
9
|
import './packages/utils/index.mjs';
|
|
5
10
|
import './packages/stores/index.mjs';
|
|
6
|
-
|
|
11
|
+
import './packages/hooks/index.mjs';
|
|
7
12
|
export { initRouter } from './packages/router/index.mjs';
|
|
8
13
|
export { getCountryCode, i18n, iso_3166_1_CountryList, languageList, mergMessage, setupI18n } from './packages/locale/index.mjs';
|
|
9
14
|
export { version } from './version.mjs';
|
|
@@ -15,7 +20,6 @@ export { auth, authAll, auths, hAuth, hAuthAll, hAuths } from './packages/hooks/
|
|
|
15
20
|
export { base64ToFile, blobToFile, dataURLtoBlob, fileToBase64, urlToBase64 } from './packages/utils/base64Conver.mjs';
|
|
16
21
|
export { buildLocaleContext, buildTranslator, translate, useLocale } from './packages/hooks/useLocale.mjs';
|
|
17
22
|
export { clone, isObjectValueEqual, judgementSameArr, removeDuplicate } from './packages/utils/arrayOperation.mjs';
|
|
18
|
-
export { default as commonFunction } from './packages/hooks/commonFunction.mjs';
|
|
19
23
|
export { configureRoutes, setPathPrefix } from './packages/router/route.mjs';
|
|
20
24
|
export { downloadByBase64, downloadByData, downloadByOnlineUrl, downloadByUrl, downloadStreamFile, getFileName, openWindow } from './packages/utils/download.mjs';
|
|
21
25
|
export { default as en } from './packages/locale/lang/en.mjs';
|
|
@@ -29,9 +33,7 @@ export { initBackEndControlRoutes, setDynamicViewsModules } from './packages/rou
|
|
|
29
33
|
export { initFrontEndControlRoutes } from './packages/router/frontEnd.mjs';
|
|
30
34
|
export { judgementIdCard, verifiyNumberInteger, verifyAccount, verifyAndSpace, verifyCarNum, verifyCnAndSpace, verifyEmail, verifyEnAndSpace, verifyFullName, verifyIPAddress, verifyIdCard, verifyNumberCnUppercase, verifyNumberComma, verifyNumberIntegerAndFloat, verifyNumberPercentage, verifyNumberPercentageFloat, verifyPassword, verifyPasswordPowerful, verifyPasswordStrength, verifyPhone, verifyPostalCode, verifyTelPhone, verifyTextColor, verifyUrl } from './packages/utils/toolsValidate.mjs';
|
|
31
35
|
export { loadSysInfo, updateFavicon } from './packages/hooks/sysInfo.mjs';
|
|
32
|
-
export { default as mittBus } from './packages/utils/mitt.mjs';
|
|
33
36
|
export { saulVModel } from './packages/utils/saulVModel.mjs';
|
|
34
|
-
export { default as setIntroduction } from './packages/utils/setIconfont.mjs';
|
|
35
37
|
export { signatureByKSort } from './packages/utils/data-signature.mjs';
|
|
36
38
|
export { useApi, useBaseApi } from './packages/api/base/index.mjs';
|
|
37
39
|
export { useChangeColor } from './packages/utils/theme.mjs';
|
|
@@ -47,6 +49,7 @@ export { useVxeTable } from './packages/hooks/useVxeTableOptionsHook.mjs';
|
|
|
47
49
|
export { validateFormWithScroll, validateFormWithScrollCallback } from './packages/utils/formValidate.mjs';
|
|
48
50
|
export { default as zhCn } from './packages/locale/lang/zh-cn.mjs';
|
|
49
51
|
|
|
52
|
+
const commonFun = commonFunction();
|
|
50
53
|
const install = installer.install;
|
|
51
54
|
|
|
52
|
-
export { installer as default, install };
|
|
55
|
+
export { commonFun, commonFunction, installer as default, install };
|
package/es/make-installer.mjs
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import pinia from './packages/stores/inpinia.mjs';
|
|
2
2
|
import { directive } from './packages/directive/index.mjs';
|
|
3
3
|
import { setupVXETable } from './packages/hooks/setupVXETableHook.mjs';
|
|
4
|
+
import './packages/components/index.mjs';
|
|
5
|
+
import { elSvg } from './packages/components/svgIcon/index.mjs';
|
|
4
6
|
|
|
5
7
|
const makeInstaller = (components = []) => {
|
|
6
8
|
const install = (app) => {
|
|
@@ -11,9 +13,12 @@ const makeInstaller = (components = []) => {
|
|
|
11
13
|
}
|
|
12
14
|
}
|
|
13
15
|
);
|
|
14
|
-
app
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
if (app) {
|
|
17
|
+
app.use(pinia);
|
|
18
|
+
elSvg(app);
|
|
19
|
+
directive(app);
|
|
20
|
+
app.use(setupVXETable);
|
|
21
|
+
}
|
|
17
22
|
};
|
|
18
23
|
return {
|
|
19
24
|
install
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { FButton } from './button/index.mjs';
|
|
2
|
+
export { FInput } from './input/index.mjs';
|
|
3
|
+
export { FLayoutPage } from './layout-page/index.mjs';
|
|
4
|
+
export { FLayoutPageItem } from './layout-page-item/index.mjs';
|
|
5
|
+
export { FChart } from './chart/index.mjs';
|
|
6
|
+
export { FSelect } from './select/index.mjs';
|
|
7
|
+
export { FSelectTable } from './select-table/index.mjs';
|
|
8
|
+
export { FQueryCondition } from './query-condition/index.mjs';
|
|
9
|
+
export { FForm } from './form/index.mjs';
|
|
10
|
+
export { elSvg } from './svgIcon/index.mjs';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as svg from '@element-plus/icons-vue';
|
|
2
|
+
import './svgicon.vue.mjs';
|
|
3
|
+
import _sfc_main from './svgicon.vue2.mjs';
|
|
4
|
+
|
|
5
|
+
function elSvg(app) {
|
|
6
|
+
const icons = svg;
|
|
7
|
+
for (const i in icons) {
|
|
8
|
+
if (!app._context.components[`ele-${icons[i].name}`]) {
|
|
9
|
+
app.component(`ele-${icons[i].name}`, icons[i]);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
if (!app._context.components[`SvgIcon`]) {
|
|
13
|
+
app.component("SvgIcon", _sfc_main);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { elSvg };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { defineComponent, computed, openBlock, createElementBlock, normalizeStyle, createBlock, resolveDynamicComponent, createElementVNode, normalizeClass } from 'vue';
|
|
2
|
+
|
|
3
|
+
const _hoisted_1 = ["src"];
|
|
4
|
+
var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
5
|
+
...{
|
|
6
|
+
name: "svgIcon"
|
|
7
|
+
},
|
|
8
|
+
__name: "svgicon",
|
|
9
|
+
props: {
|
|
10
|
+
// svg 图标组件名字
|
|
11
|
+
name: {
|
|
12
|
+
type: String
|
|
13
|
+
},
|
|
14
|
+
// svg 大小
|
|
15
|
+
size: {
|
|
16
|
+
type: Number,
|
|
17
|
+
default: () => 14
|
|
18
|
+
},
|
|
19
|
+
// svg 颜色
|
|
20
|
+
color: {
|
|
21
|
+
type: String
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
setup(__props) {
|
|
25
|
+
const props = __props;
|
|
26
|
+
const linesString = ["https", "http", "/src", "/assets", "data:image", window.__env__.VITE_PUBLIC_PATH];
|
|
27
|
+
const getIconName = computed(() => {
|
|
28
|
+
return props == null ? void 0 : props.name;
|
|
29
|
+
});
|
|
30
|
+
const isShowIconSvg = computed(() => {
|
|
31
|
+
var _a;
|
|
32
|
+
return (_a = props == null ? void 0 : props.name) == null ? void 0 : _a.startsWith("ele-");
|
|
33
|
+
});
|
|
34
|
+
const isShowIconImg = computed(() => {
|
|
35
|
+
return linesString.find((str) => {
|
|
36
|
+
var _a;
|
|
37
|
+
return (_a = props.name) == null ? void 0 : _a.startsWith(str);
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
const setIconSvgStyle = computed(() => {
|
|
41
|
+
return `font-size: ${props.size}px;color: ${props.color};`;
|
|
42
|
+
});
|
|
43
|
+
const setIconImgOutStyle = computed(() => {
|
|
44
|
+
return `width: ${props.size}px;height: ${props.size}px;display: inline-block;overflow: hidden;`;
|
|
45
|
+
});
|
|
46
|
+
const setIconSvgInsStyle = computed(() => {
|
|
47
|
+
const filterStyle = [];
|
|
48
|
+
const compatibles = ["-webkit", "-ms", "-o", "-moz"];
|
|
49
|
+
compatibles.forEach((j) => filterStyle.push(`${j}-filter: drop-shadow(${props.color} ${props.size}px 0);`));
|
|
50
|
+
return `width: ${props.size}px;height: ${props.size}px;position: relative;left: -${props.size}px;${filterStyle.join("")}`;
|
|
51
|
+
});
|
|
52
|
+
return (_ctx, _cache) => {
|
|
53
|
+
return isShowIconSvg.value ? (openBlock(), createElementBlock(
|
|
54
|
+
"i",
|
|
55
|
+
{
|
|
56
|
+
key: 0,
|
|
57
|
+
class: "el-icon",
|
|
58
|
+
style: normalizeStyle(setIconSvgStyle.value)
|
|
59
|
+
},
|
|
60
|
+
[
|
|
61
|
+
(openBlock(), createBlock(resolveDynamicComponent(getIconName.value)))
|
|
62
|
+
],
|
|
63
|
+
4
|
|
64
|
+
/* STYLE */
|
|
65
|
+
)) : isShowIconImg.value ? (openBlock(), createElementBlock(
|
|
66
|
+
"div",
|
|
67
|
+
{
|
|
68
|
+
key: 1,
|
|
69
|
+
style: normalizeStyle(setIconImgOutStyle.value)
|
|
70
|
+
},
|
|
71
|
+
[
|
|
72
|
+
createElementVNode("img", {
|
|
73
|
+
src: getIconName.value,
|
|
74
|
+
style: normalizeStyle(setIconSvgInsStyle.value)
|
|
75
|
+
}, null, 12, _hoisted_1)
|
|
76
|
+
],
|
|
77
|
+
4
|
|
78
|
+
/* STYLE */
|
|
79
|
+
)) : (openBlock(), createElementBlock(
|
|
80
|
+
"i",
|
|
81
|
+
{
|
|
82
|
+
key: 2,
|
|
83
|
+
class: normalizeClass(getIconName.value),
|
|
84
|
+
style: normalizeStyle(setIconSvgStyle.value)
|
|
85
|
+
},
|
|
86
|
+
null,
|
|
87
|
+
6
|
|
88
|
+
/* CLASS, STYLE */
|
|
89
|
+
));
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
export { _sfc_main as default };
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import commonFunction from './commonFunction.mjs';
|
|
2
1
|
export { buildLocaleContext, buildTranslator, translate, useLocale } from './useLocale.mjs';
|
|
3
2
|
export { auth, authAll, auths, hAuth, hAuthAll, hAuths } from './authFunction.mjs';
|
|
4
3
|
export { useVxeTable } from './useVxeTableOptionsHook.mjs';
|
|
5
4
|
export { loadSysInfo, updateFavicon } from './sysInfo.mjs';
|
|
6
5
|
export { hasPrivilege, hasRoleCode, isAdmin, isMember, isNormalUser, isSupperAdmin, isTenantAdmin, orgId, orgName, posId, posName, roles, tenantId, userAccount, userEmail, userFriendName, userId, userName, userPhone } from './useInfo.mjs';
|
|
7
6
|
export { useDateTimeShortCust } from './dateTimeShortCust.mjs';
|
|
8
|
-
|
|
9
|
-
const commonFun = commonFunction();
|
|
10
|
-
|
|
11
|
-
export { commonFun, commonFunction };
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { nextTick } from 'vue';
|
|
2
|
+
import '../router/index.mjs';
|
|
3
|
+
import pinia from '../stores/inpinia.mjs';
|
|
4
|
+
import { storeToRefs } from 'pinia';
|
|
5
|
+
import { useThemeConfig } from '../stores/themeConfig.mjs';
|
|
6
|
+
import { i18n } from '../locale/index.mjs';
|
|
7
|
+
import { verifyUrl } from '../utils/toolsValidate.mjs';
|
|
8
|
+
import { router } from '../router/createRouter.mjs';
|
|
9
|
+
|
|
10
|
+
function useTitle() {
|
|
11
|
+
const stores = useThemeConfig(pinia);
|
|
12
|
+
const { themeConfig } = storeToRefs(stores);
|
|
13
|
+
nextTick(() => {
|
|
14
|
+
let webTitle = "";
|
|
15
|
+
let globalTitle = themeConfig.value.globalTitle;
|
|
16
|
+
const { path, meta } = router.currentRoute.value;
|
|
17
|
+
if (path === "/login") {
|
|
18
|
+
webTitle = meta.title;
|
|
19
|
+
} else {
|
|
20
|
+
webTitle = setTagsViewNameI18n(router.currentRoute.value);
|
|
21
|
+
}
|
|
22
|
+
document.title = `${webTitle} - ${globalTitle}` || globalTitle;
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function setTagsViewNameI18n(item) {
|
|
26
|
+
let tagsViewName = "";
|
|
27
|
+
const { query, params, meta } = item;
|
|
28
|
+
const pattern = /^\{("(zh-CN|en|zh-TW)":"[^,]+",?){1,3}}$/;
|
|
29
|
+
if ((query == null ? void 0 : query.tagsViewName) || (params == null ? void 0 : params.tagsViewName)) {
|
|
30
|
+
if (pattern.test(query == null ? void 0 : query.tagsViewName) || pattern.test(params == null ? void 0 : params.tagsViewName)) {
|
|
31
|
+
const urlTagsParams = (query == null ? void 0 : query.tagsViewName) && JSON.parse(query == null ? void 0 : query.tagsViewName) || (params == null ? void 0 : params.tagsViewName) && JSON.parse(params == null ? void 0 : params.tagsViewName);
|
|
32
|
+
tagsViewName = urlTagsParams[i18n.global.locale.value];
|
|
33
|
+
} else {
|
|
34
|
+
tagsViewName = (query == null ? void 0 : query.tagsViewName) || (params == null ? void 0 : params.tagsViewName);
|
|
35
|
+
}
|
|
36
|
+
} else {
|
|
37
|
+
tagsViewName = i18n.global.t(`message.menu.${meta.title}`);
|
|
38
|
+
}
|
|
39
|
+
return tagsViewName;
|
|
40
|
+
}
|
|
41
|
+
const lazyImg = (el, arr) => {
|
|
42
|
+
const io = new IntersectionObserver((res) => {
|
|
43
|
+
res.forEach((v) => {
|
|
44
|
+
if (v.isIntersecting) {
|
|
45
|
+
const { img, key } = v.target.dataset;
|
|
46
|
+
v.target.src = img;
|
|
47
|
+
v.target.onload = () => {
|
|
48
|
+
io.unobserve(v.target);
|
|
49
|
+
arr[key]["loading"] = false;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
nextTick(() => {
|
|
55
|
+
document.querySelectorAll(el).forEach((img) => io.observe(img));
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
const globalComponentSize = () => {
|
|
59
|
+
const stores = useThemeConfig(pinia);
|
|
60
|
+
const { themeConfig } = storeToRefs(stores);
|
|
61
|
+
return themeConfig.value.globalComponentSize;
|
|
62
|
+
};
|
|
63
|
+
function deepClone(obj) {
|
|
64
|
+
let newObj;
|
|
65
|
+
try {
|
|
66
|
+
newObj = obj.push ? [] : {};
|
|
67
|
+
} catch (error) {
|
|
68
|
+
newObj = {};
|
|
69
|
+
}
|
|
70
|
+
for (let attr in obj) {
|
|
71
|
+
if (obj[attr] && typeof obj[attr] === "object") {
|
|
72
|
+
newObj[attr] = deepClone(obj[attr]);
|
|
73
|
+
} else {
|
|
74
|
+
newObj[attr] = obj[attr];
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return newObj;
|
|
78
|
+
}
|
|
79
|
+
function isMobile() {
|
|
80
|
+
if (navigator.userAgent.match(/('phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone')/i)) {
|
|
81
|
+
return true;
|
|
82
|
+
} else {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function handleEmpty(list) {
|
|
87
|
+
const arr = [];
|
|
88
|
+
for (const i in list) {
|
|
89
|
+
const d = [];
|
|
90
|
+
for (const j in list[i]) {
|
|
91
|
+
d.push(list[i][j]);
|
|
92
|
+
}
|
|
93
|
+
const leng = d.filter((item) => item === "").length;
|
|
94
|
+
if (leng !== d.length) {
|
|
95
|
+
arr.push(list[i]);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return arr;
|
|
99
|
+
}
|
|
100
|
+
function handleOpenLink(val) {
|
|
101
|
+
var _a, _b, _c;
|
|
102
|
+
const { origin, pathname } = window.location;
|
|
103
|
+
router.push(val.path);
|
|
104
|
+
if (verifyUrl((_a = val.meta) == null ? void 0 : _a.isLink)) window.open((_b = val.meta) == null ? void 0 : _b.isLink);
|
|
105
|
+
else window.open(`${origin}${pathname}#${(_c = val.meta) == null ? void 0 : _c.isLink}`);
|
|
106
|
+
}
|
|
107
|
+
const other = {
|
|
108
|
+
// elSvg: (app: App) => {
|
|
109
|
+
// elSvg(app);
|
|
110
|
+
// },
|
|
111
|
+
useTitle: () => {
|
|
112
|
+
useTitle();
|
|
113
|
+
},
|
|
114
|
+
setTagsViewNameI18n(route) {
|
|
115
|
+
return setTagsViewNameI18n(route);
|
|
116
|
+
},
|
|
117
|
+
lazyImg: (el, arr) => {
|
|
118
|
+
lazyImg(el, arr);
|
|
119
|
+
},
|
|
120
|
+
globalComponentSize: () => {
|
|
121
|
+
return globalComponentSize();
|
|
122
|
+
},
|
|
123
|
+
deepClone: (obj) => {
|
|
124
|
+
return deepClone(obj);
|
|
125
|
+
},
|
|
126
|
+
isMobile: () => {
|
|
127
|
+
return isMobile();
|
|
128
|
+
},
|
|
129
|
+
handleEmpty: (list) => {
|
|
130
|
+
return handleEmpty(list);
|
|
131
|
+
},
|
|
132
|
+
handleOpenLink: (val) => {
|
|
133
|
+
handleOpenLink(val);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
export { deepClone, other as default, globalComponentSize, handleEmpty, handleOpenLink, isMobile, lazyImg, setTagsViewNameI18n, useTitle };
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
export { default as mittBus } from './mitt.mjs';
|
|
2
|
-
export { default as setIntroduction } from './setIconfont.mjs';
|
|
3
1
|
export { clone, isObjectValueEqual, judgementSameArr, removeDuplicate } from './arrayOperation.mjs';
|
|
4
2
|
import './auto-update.mjs';
|
|
5
3
|
export { base64ToFile, blobToFile, dataURLtoBlob, fileToBase64, urlToBase64 } from './base64Conver.mjs';
|
|
@@ -20,4 +18,3 @@ export { saulVModel } from './saulVModel.mjs';
|
|
|
20
18
|
export { Local, Session } from './storage.mjs';
|
|
21
19
|
export { useChangeColor } from './theme.mjs';
|
|
22
20
|
export { judgementIdCard, verifiyNumberInteger, verifyAccount, verifyAndSpace, verifyCarNum, verifyCnAndSpace, verifyEmail, verifyEnAndSpace, verifyFullName, verifyIPAddress, verifyIdCard, verifyNumberCnUppercase, verifyNumberComma, verifyNumberIntegerAndFloat, verifyNumberPercentage, verifyNumberPercentageFloat, verifyPassword, verifyPasswordPowerful, verifyPasswordStrength, verifyPhone, verifyPostalCode, verifyTelPhone, verifyTextColor, verifyUrl } from './toolsValidate.mjs';
|
|
23
|
-
import './watermark.mjs';
|
package/es/utils/index.d.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { default as mittBus } from './mitt';
|
|
2
|
-
import { default as setIntroduction } from './setIconfont';
|
|
3
|
-
export { mittBus, setIntroduction };
|
|
4
1
|
export * from './arrayOperation';
|
|
5
2
|
export * from './auto-update';
|
|
6
3
|
export * from './base64Conver';
|
|
@@ -21,4 +18,3 @@ export * from './saulVModel';
|
|
|
21
18
|
export * from './storage';
|
|
22
19
|
export * from './theme';
|
|
23
20
|
export * from './toolsValidate';
|
|
24
|
-
export * from './watermark';
|