@fmdeui/fmui 1.0.9 → 1.0.10

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.
@@ -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/index.d.ts CHANGED
@@ -1,4 +1,9 @@
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 commonFunction } from './hooks/commonFunction';
5
+ import { EmptyArrayType } from './types';
6
+ import { MessageHandler } from 'element-plus';
2
7
  import { App } from 'vue';
3
8
  export * from './types';
4
9
  export * from './api';
@@ -7,6 +12,29 @@ export * from './stores';
7
12
  export * from './hooks';
8
13
  export * from './router';
9
14
  export * from './locale';
15
+ declare const commonFun: {
16
+ percentFormat: (row: EmptyArrayType, column: number, cellValue: string) => string;
17
+ dateFormatYMD: (row: EmptyArrayType, column: number, cellValue: string) => string;
18
+ dateFormatYMDHMS: (row: EmptyArrayType, column: number, cellValue: string) => string;
19
+ dateFormatHMS: (row: EmptyArrayType, column: number, cellValue: string) => string;
20
+ scaleFormat: (value?: string, scale?: number) => string;
21
+ scale2Format: (value?: string) => string;
22
+ groupSeparator: (value: number, minimumFractionDigits?: number) => string;
23
+ copyText: (text: string) => Promise<unknown>;
24
+ removeHtmlSub: (value: string) => string;
25
+ removeHtml: (value: string) => string;
26
+ getEnumDesc: (key: any, lstEnum: any) => any;
27
+ appendQueryParams: (url: string, params: {
28
+ [key: string]: any;
29
+ }) => string;
30
+ getNameAbbr: (text: string, callback?: (abbr: any) => void) => Promise<any> | MessageHandler | undefined;
31
+ handleConditionalClear: (condition: boolean, fieldValue: any, clearValue?: any) => any;
32
+ getTimeRangePickerShortcuts: () => {
33
+ text: string;
34
+ value: () => Date[];
35
+ }[];
36
+ };
37
+ export { setIntroduction, emitter as mittBus, commonFunction, commonFun, setCssCdn, setJsCdn };
10
38
  export { version } from './version';
11
39
  export declare const install: (app: App) => void;
12
40
  export default installer;
package/es/index.mjs CHANGED
@@ -1,9 +1,12 @@
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
+ import commonFunction from './packages/hooks/commonFunction.mjs';
2
5
  import './packages/types/index.mjs';
3
6
  export { AccountTypeEnum, HttpMethodEnum, JobCreateTypeEnum } from './packages/api/index.mjs';
4
7
  import './packages/utils/index.mjs';
5
8
  import './packages/stores/index.mjs';
6
- export { commonFun } from './packages/hooks/index.mjs';
9
+ import './packages/hooks/index.mjs';
7
10
  export { initRouter } from './packages/router/index.mjs';
8
11
  export { getCountryCode, i18n, iso_3166_1_CountryList, languageList, mergMessage, setupI18n } from './packages/locale/index.mjs';
9
12
  export { version } from './version.mjs';
@@ -15,7 +18,6 @@ export { auth, authAll, auths, hAuth, hAuthAll, hAuths } from './packages/hooks/
15
18
  export { base64ToFile, blobToFile, dataURLtoBlob, fileToBase64, urlToBase64 } from './packages/utils/base64Conver.mjs';
16
19
  export { buildLocaleContext, buildTranslator, translate, useLocale } from './packages/hooks/useLocale.mjs';
17
20
  export { clone, isObjectValueEqual, judgementSameArr, removeDuplicate } from './packages/utils/arrayOperation.mjs';
18
- export { default as commonFunction } from './packages/hooks/commonFunction.mjs';
19
21
  export { configureRoutes, setPathPrefix } from './packages/router/route.mjs';
20
22
  export { downloadByBase64, downloadByData, downloadByOnlineUrl, downloadByUrl, downloadStreamFile, getFileName, openWindow } from './packages/utils/download.mjs';
21
23
  export { default as en } from './packages/locale/lang/en.mjs';
@@ -29,9 +31,7 @@ export { initBackEndControlRoutes, setDynamicViewsModules } from './packages/rou
29
31
  export { initFrontEndControlRoutes } from './packages/router/frontEnd.mjs';
30
32
  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
33
  export { loadSysInfo, updateFavicon } from './packages/hooks/sysInfo.mjs';
32
- export { default as mittBus } from './packages/utils/mitt.mjs';
33
34
  export { saulVModel } from './packages/utils/saulVModel.mjs';
34
- export { default as setIntroduction } from './packages/utils/setIconfont.mjs';
35
35
  export { signatureByKSort } from './packages/utils/data-signature.mjs';
36
36
  export { useApi, useBaseApi } from './packages/api/base/index.mjs';
37
37
  export { useChangeColor } from './packages/utils/theme.mjs';
@@ -47,6 +47,7 @@ export { useVxeTable } from './packages/hooks/useVxeTableOptionsHook.mjs';
47
47
  export { validateFormWithScroll, validateFormWithScrollCallback } from './packages/utils/formValidate.mjs';
48
48
  export { default as zhCn } from './packages/locale/lang/zh-cn.mjs';
49
49
 
50
+ const commonFun = commonFunction();
50
51
  const install = installer.install;
51
52
 
52
- export { installer as default, install };
53
+ export { commonFun, commonFunction, installer as default, install };
@@ -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 };
@@ -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';
@@ -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';
package/index.js CHANGED
@@ -1,49 +1,12 @@
1
- /*! fmdeui-fmui v1.0.9 */
1
+ /*! fmdeui-fmui v1.0.10 */
2
2
  (function (global, factory) {
3
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('pinia'), require('mitt'), require('crypto-js'), require('xlsx-js-style'), require('element-plus'), require('vue'), require('@element-plus/icons-vue'), require('axios'), require('js-cookie'), require('vxe-table'), require('@vxe-ui/plugin-render-element'), require('@vxe-ui/plugin-export-xlsx'), require('vxe-pc-ui'), require('vue-i18n'), require('exceljs'), require('@vueuse/core'), require('lodash-es'), require('vue-router'), require('nprogress')) :
4
- typeof define === 'function' && define.amd ? define(['exports', 'pinia', 'mitt', 'crypto-js', 'xlsx-js-style', 'element-plus', 'vue', '@element-plus/icons-vue', 'axios', 'js-cookie', 'vxe-table', '@vxe-ui/plugin-render-element', '@vxe-ui/plugin-export-xlsx', 'vxe-pc-ui', 'vue-i18n', 'exceljs', '@vueuse/core', 'lodash-es', 'vue-router', 'nprogress'], factory) :
5
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.fmdeuifmui = {}, global.Pinia, global.mitt, global.CryptoJS, global.XLSX, global.ElementPlus, global.Vue, global.ElementPlusIconsVue, global.axios, global.Cookies, global.VxeUITable, global.VxeUIPluginRenderElement, global.VxeUIPluginExportXLSX, global.VxeUIExport, global.vueI18n, global.ExcelJS, global.VueUse, global._, global.vueRouter, global.NProgress));
6
- })(this, (function (exports, pinia$1, mitt, CryptoJS, XLSXS, elementPlus, vue, svg, axios, Cookies, VxeUITable, VxeUIPluginRenderElement, VxeUIPluginExportXLSX, VxeUI, vueI18n, ExcelJS, core, lodashEs, vueRouter, NProgress) { 'use strict';
3
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('pinia'), require('crypto-js'), require('xlsx-js-style'), require('element-plus'), require('vue'), require('@element-plus/icons-vue'), require('axios'), require('js-cookie'), require('vxe-table'), require('@vxe-ui/plugin-render-element'), require('@vxe-ui/plugin-export-xlsx'), require('vxe-pc-ui'), require('vue-i18n'), require('exceljs'), require('lodash-es'), require('@vueuse/core'), require('mitt'), require('vue-router'), require('nprogress')) :
4
+ typeof define === 'function' && define.amd ? define(['exports', 'pinia', 'crypto-js', 'xlsx-js-style', 'element-plus', 'vue', '@element-plus/icons-vue', 'axios', 'js-cookie', 'vxe-table', '@vxe-ui/plugin-render-element', '@vxe-ui/plugin-export-xlsx', 'vxe-pc-ui', 'vue-i18n', 'exceljs', 'lodash-es', '@vueuse/core', 'mitt', 'vue-router', 'nprogress'], factory) :
5
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.fmdeuifmui = {}, global.Pinia, global.CryptoJS, global.XLSX, global.ElementPlus, global.Vue, global.ElementPlusIconsVue, global.axios, global.Cookies, global.VxeUITable, global.VxeUIPluginRenderElement, global.VxeUIPluginExportXLSX, global.VxeUIExport, global.vueI18n, global.ExcelJS, global._, global.VueUse, global.mitt, global.vueRouter, global.NProgress));
6
+ })(this, (function (exports, pinia$1, CryptoJS, XLSXS, elementPlus, vue, svg, axios, Cookies, VxeUITable, VxeUIPluginRenderElement, VxeUIPluginExportXLSX, VxeUI, vueI18n, ExcelJS, lodashEs, core, mitt, vueRouter, NProgress) { 'use strict';
7
7
 
8
8
  const pinia = pinia$1.createPinia();
9
9
 
10
- const emitter = mitt();
11
-
12
- const cssCdnUrlList = [
13
- // 调整为从本地引入,注释下面的 url
14
- // '//at.alicdn.com/t/c/font_2298093_rnp72ifj3ba.css',
15
- // '//netdna.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css',
16
- ];
17
- const jsCdnUrlList = [];
18
- function setCssCdn() {
19
- if (cssCdnUrlList.length <= 0) return false;
20
- cssCdnUrlList.map((v) => {
21
- let link = document.createElement("link");
22
- link.rel = "stylesheet";
23
- link.href = v;
24
- link.crossOrigin = "anonymous";
25
- document.getElementsByTagName("head")[0].appendChild(link);
26
- });
27
- }
28
- function setJsCdn() {
29
- if (jsCdnUrlList.length <= 0) return false;
30
- jsCdnUrlList.map((v) => {
31
- let link = document.createElement("script");
32
- link.src = v;
33
- document.body.appendChild(link);
34
- });
35
- }
36
- const setIntroduction = {
37
- // 设置css
38
- cssCdn: () => {
39
- setCssCdn();
40
- },
41
- // 设置js
42
- jsCdn: () => {
43
- setJsCdn();
44
- }
45
- };
46
-
47
10
  function judgementSameArr(newArr, oldArr) {
48
11
  const news = removeDuplicate(newArr);
49
12
  const olds = removeDuplicate(oldArr);
@@ -18455,6 +18418,31 @@
18455
18418
 
18456
18419
  const FButton = _sfc_main$d;
18457
18420
 
18421
+ const buildTranslator = (locale) => (path, option) => translate(path, option, vue.unref(locale));
18422
+ const translate = (path, option, locale) => lodashEs.get(locale, path, path).replace(
18423
+ /\{(\w+)\}/g,
18424
+ (_, key) => {
18425
+ var _a;
18426
+ return `${(_a = option == null ? void 0 : option[key]) != null ? _a : `{${key}}`}`;
18427
+ }
18428
+ );
18429
+ const buildLocaleContext = (locale) => {
18430
+ const lang = vue.computed(() => vue.unref(locale).name);
18431
+ const localeRef = vue.isRef(locale) ? locale : vue.ref(locale);
18432
+ return {
18433
+ lang,
18434
+ locale: localeRef,
18435
+ t: buildTranslator(locale)
18436
+ };
18437
+ };
18438
+ const useLocale = (localeOverrides) => {
18439
+ const locale = localeOverrides || vue.inject(elementPlus.localeContextKey, vue.ref());
18440
+ return buildLocaleContext(vue.computed(() => {
18441
+ var _a;
18442
+ return ((_a = locale == null ? void 0 : locale.value) == null ? void 0 : _a.plus) ? locale.value : plusZhCn;
18443
+ }));
18444
+ };
18445
+
18458
18446
  const useKeepALiveNames = pinia$1.defineStore("keepALiveNames", {
18459
18447
  state: () => ({
18460
18448
  keepAliveNames: [],
@@ -18532,202 +18520,6 @@
18532
18520
  }
18533
18521
  });
18534
18522
 
18535
- const themeStore = useThemeConfig();
18536
- function commonFunction() {
18537
- const { t } = vueI18n.useI18n();
18538
- const { copy, isSupported } = core.useClipboard();
18539
- const percentFormat = (row, column, cellValue) => {
18540
- return cellValue ? `${cellValue}%` : "-";
18541
- };
18542
- const dateFormatYMD = (row, column, cellValue) => {
18543
- if (!cellValue) return "-";
18544
- return formatDate(new Date(cellValue), "YYYY-mm-dd");
18545
- };
18546
- const dateFormatYMDHMS = (row, column, cellValue) => {
18547
- if (!cellValue) return "-";
18548
- return formatDate(new Date(cellValue), "YYYY-mm-dd HH:MM:SS");
18549
- };
18550
- const dateFormatHMS = (row, column, cellValue) => {
18551
- if (!cellValue) return "-";
18552
- let time = 0;
18553
- if (typeof row === "number") time = row;
18554
- if (typeof cellValue === "number") time = cellValue;
18555
- return formatDate(new Date(time * 1e3), "HH:MM:SS");
18556
- };
18557
- const scaleFormat = (value = "0", scale = 4) => {
18558
- return Number.parseFloat(value).toFixed(scale);
18559
- };
18560
- const scale2Format = (value = "0") => {
18561
- return Number.parseFloat(value).toFixed(2);
18562
- };
18563
- const groupSeparator = (value, minimumFractionDigits = 2) => {
18564
- return value.toLocaleString("en-US", {
18565
- minimumFractionDigits,
18566
- maximumFractionDigits: 2
18567
- });
18568
- };
18569
- const copyText = (text) => {
18570
- return new Promise((resolve, reject) => {
18571
- try {
18572
- if (!isSupported.value) {
18573
- console.error("\u6D4F\u89C8\u5668\u4E0D\u652F\u6301\u526A\u8D34\u677F API");
18574
- reject("\u6D4F\u89C8\u5668\u4E0D\u652F\u6301\u526A\u8D34\u677F API");
18575
- } else {
18576
- copy(text);
18577
- elementPlus.ElMessage.success(t("message.layout.copyTextSuccess"));
18578
- resolve(text);
18579
- }
18580
- } catch (e) {
18581
- elementPlus.ElMessage.error(t("message.layout.copyTextError"));
18582
- reject(e);
18583
- }
18584
- });
18585
- };
18586
- const removeHtmlSub = (value) => {
18587
- var str = value.replace(/<[^>]+>/g, "");
18588
- if (str.length > 50) return str.substring(0, 50) + "......";
18589
- else return str;
18590
- };
18591
- const removeHtml = (value) => {
18592
- return value.replace(/<[^>]+>/g, "");
18593
- };
18594
- const getEnumDesc = (key, lstEnum) => {
18595
- var _a;
18596
- return (_a = lstEnum.find((x) => x.value == key)) == null ? void 0 : _a.describe;
18597
- };
18598
- const appendQueryParams = (url, params) => {
18599
- if (!params || Object.keys(params).length == 0) return url;
18600
- const queryString = Object.keys(params).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(params[key])}`).join("&");
18601
- return `${url}${url.includes("?") ? "&" : "?"}${queryString}`;
18602
- };
18603
- const getNameAbbr = (text, callback) => {
18604
- if (!text) return elementPlus.ElMessage.error("\u83B7\u53D6\u7B80\u79F0\u6587\u672C\u4E0D\u80FD\u4E3A\u7A7A");
18605
- try {
18606
- return useBaseApi("sysCommon").post({ text }, "nameAbbr").then((res) => {
18607
- if (callback) callback(res.data.result);
18608
- return res.data.result;
18609
- });
18610
- } catch (e) {
18611
- elementPlus.ElMessage.error("\u83B7\u53D6\u5931\u8D25");
18612
- }
18613
- };
18614
- const handleConditionalClear = (condition, fieldValue, clearValue = void 0) => {
18615
- if (condition) {
18616
- return clearValue;
18617
- }
18618
- return fieldValue;
18619
- };
18620
- const getTimeRangePickerShortcuts = () => {
18621
- return [
18622
- {
18623
- text: "\u8FD1\u4E00\u5468",
18624
- value: () => {
18625
- const now = new Date(themeStore.themeConfig.serverTime);
18626
- const end = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59, 999);
18627
- const start = new Date(now.getFullYear(), now.getMonth(), now.getDate() - 7);
18628
- return [start, end];
18629
- }
18630
- },
18631
- {
18632
- text: "\u8FD1\u4E00\u6708",
18633
- value: () => {
18634
- const now = new Date(themeStore.themeConfig.serverTime);
18635
- const end = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59, 999);
18636
- const start = new Date(now.getFullYear(), now.getMonth() - 1, now.getDate());
18637
- return [start, end];
18638
- }
18639
- },
18640
- {
18641
- text: "\u8FD1\u4E09\u6708",
18642
- value: () => {
18643
- const now = new Date(themeStore.themeConfig.serverTime);
18644
- const end = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59, 999);
18645
- const start = new Date(now.getFullYear(), now.getMonth() - 3, now.getDate());
18646
- return [start, end];
18647
- }
18648
- },
18649
- {
18650
- text: "\u8FD1\u534A\u5E74",
18651
- value: () => {
18652
- const now = new Date(themeStore.themeConfig.serverTime);
18653
- const end = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59, 999);
18654
- const start = new Date(now.getFullYear(), now.getMonth() - 6, now.getDate());
18655
- return [start, end];
18656
- }
18657
- },
18658
- {
18659
- text: "\u672C\u5E74",
18660
- value: () => {
18661
- const now = new Date(themeStore.themeConfig.serverTime);
18662
- const end = new Date(now.getFullYear(), 11, 31, 23, 59, 59, 999);
18663
- const start = new Date(now.getFullYear(), 0, 1);
18664
- return [start, end];
18665
- }
18666
- },
18667
- {
18668
- text: "\u8FD1\u4E24\u5E74",
18669
- value: () => {
18670
- const now = new Date(themeStore.themeConfig.serverTime);
18671
- const end = new Date(now.getFullYear(), 11, 31, 23, 59, 59, 999);
18672
- const start = new Date(now.getFullYear() - 1, 0, 1);
18673
- return [start, end];
18674
- }
18675
- },
18676
- {
18677
- text: "\u8FD1\u4E09\u5E74",
18678
- value: () => {
18679
- const now = new Date(themeStore.themeConfig.serverTime);
18680
- const end = new Date(now.getFullYear(), 11, 31, 23, 59, 59, 999);
18681
- const start = new Date(now.getFullYear() - 2, 0, 1);
18682
- return [start, end];
18683
- }
18684
- }
18685
- ];
18686
- };
18687
- return {
18688
- percentFormat,
18689
- dateFormatYMD,
18690
- dateFormatYMDHMS,
18691
- dateFormatHMS,
18692
- scaleFormat,
18693
- scale2Format,
18694
- groupSeparator,
18695
- copyText,
18696
- removeHtmlSub,
18697
- removeHtml,
18698
- getEnumDesc,
18699
- appendQueryParams,
18700
- getNameAbbr,
18701
- handleConditionalClear,
18702
- getTimeRangePickerShortcuts
18703
- };
18704
- }
18705
-
18706
- const buildTranslator = (locale) => (path, option) => translate(path, option, vue.unref(locale));
18707
- const translate = (path, option, locale) => lodashEs.get(locale, path, path).replace(
18708
- /\{(\w+)\}/g,
18709
- (_, key) => {
18710
- var _a;
18711
- return `${(_a = option == null ? void 0 : option[key]) != null ? _a : `{${key}}`}`;
18712
- }
18713
- );
18714
- const buildLocaleContext = (locale) => {
18715
- const lang = vue.computed(() => vue.unref(locale).name);
18716
- const localeRef = vue.isRef(locale) ? locale : vue.ref(locale);
18717
- return {
18718
- lang,
18719
- locale: localeRef,
18720
- t: buildTranslator(locale)
18721
- };
18722
- };
18723
- const useLocale = (localeOverrides) => {
18724
- const locale = localeOverrides || vue.inject(elementPlus.localeContextKey, vue.ref());
18725
- return buildLocaleContext(vue.computed(() => {
18726
- var _a;
18727
- return ((_a = locale == null ? void 0 : locale.value) == null ? void 0 : _a.plus) ? locale.value : plusZhCn;
18728
- }));
18729
- };
18730
-
18731
18523
  function auth(value) {
18732
18524
  const stores = useUserInfo();
18733
18525
  return stores.userInfos.authApiList.some((v) => v === value);
@@ -19031,8 +18823,6 @@
19031
18823
  ];
19032
18824
  };
19033
18825
 
19034
- const commonFun = commonFunction();
19035
-
19036
18826
  const _hoisted_1$6 = { key: 0 };
19037
18827
  const _hoisted_2$3 = { key: 0 };
19038
18828
  var _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
@@ -22188,6 +21978,214 @@
22188
21978
 
22189
21979
  var installer = makeInstaller([...plugins]);
22190
21980
 
21981
+ const cssCdnUrlList = [
21982
+ // 调整为从本地引入,注释下面的 url
21983
+ // '//at.alicdn.com/t/c/font_2298093_rnp72ifj3ba.css',
21984
+ // '//netdna.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css',
21985
+ ];
21986
+ const jsCdnUrlList = [];
21987
+ function setCssCdn() {
21988
+ if (cssCdnUrlList.length <= 0) return false;
21989
+ cssCdnUrlList.map((v) => {
21990
+ let link = document.createElement("link");
21991
+ link.rel = "stylesheet";
21992
+ link.href = v;
21993
+ link.crossOrigin = "anonymous";
21994
+ document.getElementsByTagName("head")[0].appendChild(link);
21995
+ });
21996
+ }
21997
+ function setJsCdn() {
21998
+ if (jsCdnUrlList.length <= 0) return false;
21999
+ jsCdnUrlList.map((v) => {
22000
+ let link = document.createElement("script");
22001
+ link.src = v;
22002
+ document.body.appendChild(link);
22003
+ });
22004
+ }
22005
+ const setIntroduction = {
22006
+ // 设置css
22007
+ cssCdn: () => {
22008
+ setCssCdn();
22009
+ },
22010
+ // 设置js
22011
+ jsCdn: () => {
22012
+ setJsCdn();
22013
+ }
22014
+ };
22015
+
22016
+ const emitter = mitt();
22017
+
22018
+ const themeStore = useThemeConfig();
22019
+ function commonFunction() {
22020
+ const { t } = vueI18n.useI18n();
22021
+ const { copy, isSupported } = core.useClipboard();
22022
+ const percentFormat = (row, column, cellValue) => {
22023
+ return cellValue ? `${cellValue}%` : "-";
22024
+ };
22025
+ const dateFormatYMD = (row, column, cellValue) => {
22026
+ if (!cellValue) return "-";
22027
+ return formatDate(new Date(cellValue), "YYYY-mm-dd");
22028
+ };
22029
+ const dateFormatYMDHMS = (row, column, cellValue) => {
22030
+ if (!cellValue) return "-";
22031
+ return formatDate(new Date(cellValue), "YYYY-mm-dd HH:MM:SS");
22032
+ };
22033
+ const dateFormatHMS = (row, column, cellValue) => {
22034
+ if (!cellValue) return "-";
22035
+ let time = 0;
22036
+ if (typeof row === "number") time = row;
22037
+ if (typeof cellValue === "number") time = cellValue;
22038
+ return formatDate(new Date(time * 1e3), "HH:MM:SS");
22039
+ };
22040
+ const scaleFormat = (value = "0", scale = 4) => {
22041
+ return Number.parseFloat(value).toFixed(scale);
22042
+ };
22043
+ const scale2Format = (value = "0") => {
22044
+ return Number.parseFloat(value).toFixed(2);
22045
+ };
22046
+ const groupSeparator = (value, minimumFractionDigits = 2) => {
22047
+ return value.toLocaleString("en-US", {
22048
+ minimumFractionDigits,
22049
+ maximumFractionDigits: 2
22050
+ });
22051
+ };
22052
+ const copyText = (text) => {
22053
+ return new Promise((resolve, reject) => {
22054
+ try {
22055
+ if (!isSupported.value) {
22056
+ console.error("\u6D4F\u89C8\u5668\u4E0D\u652F\u6301\u526A\u8D34\u677F API");
22057
+ reject("\u6D4F\u89C8\u5668\u4E0D\u652F\u6301\u526A\u8D34\u677F API");
22058
+ } else {
22059
+ copy(text);
22060
+ elementPlus.ElMessage.success(t("message.layout.copyTextSuccess"));
22061
+ resolve(text);
22062
+ }
22063
+ } catch (e) {
22064
+ elementPlus.ElMessage.error(t("message.layout.copyTextError"));
22065
+ reject(e);
22066
+ }
22067
+ });
22068
+ };
22069
+ const removeHtmlSub = (value) => {
22070
+ var str = value.replace(/<[^>]+>/g, "");
22071
+ if (str.length > 50) return str.substring(0, 50) + "......";
22072
+ else return str;
22073
+ };
22074
+ const removeHtml = (value) => {
22075
+ return value.replace(/<[^>]+>/g, "");
22076
+ };
22077
+ const getEnumDesc = (key, lstEnum) => {
22078
+ var _a;
22079
+ return (_a = lstEnum.find((x) => x.value == key)) == null ? void 0 : _a.describe;
22080
+ };
22081
+ const appendQueryParams = (url, params) => {
22082
+ if (!params || Object.keys(params).length == 0) return url;
22083
+ const queryString = Object.keys(params).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(params[key])}`).join("&");
22084
+ return `${url}${url.includes("?") ? "&" : "?"}${queryString}`;
22085
+ };
22086
+ const getNameAbbr = (text, callback) => {
22087
+ if (!text) return elementPlus.ElMessage.error("\u83B7\u53D6\u7B80\u79F0\u6587\u672C\u4E0D\u80FD\u4E3A\u7A7A");
22088
+ try {
22089
+ return useBaseApi("sysCommon").post({ text }, "nameAbbr").then((res) => {
22090
+ if (callback) callback(res.data.result);
22091
+ return res.data.result;
22092
+ });
22093
+ } catch (e) {
22094
+ elementPlus.ElMessage.error("\u83B7\u53D6\u5931\u8D25");
22095
+ }
22096
+ };
22097
+ const handleConditionalClear = (condition, fieldValue, clearValue = void 0) => {
22098
+ if (condition) {
22099
+ return clearValue;
22100
+ }
22101
+ return fieldValue;
22102
+ };
22103
+ const getTimeRangePickerShortcuts = () => {
22104
+ return [
22105
+ {
22106
+ text: "\u8FD1\u4E00\u5468",
22107
+ value: () => {
22108
+ const now = new Date(themeStore.themeConfig.serverTime);
22109
+ const end = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59, 999);
22110
+ const start = new Date(now.getFullYear(), now.getMonth(), now.getDate() - 7);
22111
+ return [start, end];
22112
+ }
22113
+ },
22114
+ {
22115
+ text: "\u8FD1\u4E00\u6708",
22116
+ value: () => {
22117
+ const now = new Date(themeStore.themeConfig.serverTime);
22118
+ const end = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59, 999);
22119
+ const start = new Date(now.getFullYear(), now.getMonth() - 1, now.getDate());
22120
+ return [start, end];
22121
+ }
22122
+ },
22123
+ {
22124
+ text: "\u8FD1\u4E09\u6708",
22125
+ value: () => {
22126
+ const now = new Date(themeStore.themeConfig.serverTime);
22127
+ const end = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59, 999);
22128
+ const start = new Date(now.getFullYear(), now.getMonth() - 3, now.getDate());
22129
+ return [start, end];
22130
+ }
22131
+ },
22132
+ {
22133
+ text: "\u8FD1\u534A\u5E74",
22134
+ value: () => {
22135
+ const now = new Date(themeStore.themeConfig.serverTime);
22136
+ const end = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59, 999);
22137
+ const start = new Date(now.getFullYear(), now.getMonth() - 6, now.getDate());
22138
+ return [start, end];
22139
+ }
22140
+ },
22141
+ {
22142
+ text: "\u672C\u5E74",
22143
+ value: () => {
22144
+ const now = new Date(themeStore.themeConfig.serverTime);
22145
+ const end = new Date(now.getFullYear(), 11, 31, 23, 59, 59, 999);
22146
+ const start = new Date(now.getFullYear(), 0, 1);
22147
+ return [start, end];
22148
+ }
22149
+ },
22150
+ {
22151
+ text: "\u8FD1\u4E24\u5E74",
22152
+ value: () => {
22153
+ const now = new Date(themeStore.themeConfig.serverTime);
22154
+ const end = new Date(now.getFullYear(), 11, 31, 23, 59, 59, 999);
22155
+ const start = new Date(now.getFullYear() - 1, 0, 1);
22156
+ return [start, end];
22157
+ }
22158
+ },
22159
+ {
22160
+ text: "\u8FD1\u4E09\u5E74",
22161
+ value: () => {
22162
+ const now = new Date(themeStore.themeConfig.serverTime);
22163
+ const end = new Date(now.getFullYear(), 11, 31, 23, 59, 59, 999);
22164
+ const start = new Date(now.getFullYear() - 2, 0, 1);
22165
+ return [start, end];
22166
+ }
22167
+ }
22168
+ ];
22169
+ };
22170
+ return {
22171
+ percentFormat,
22172
+ dateFormatYMD,
22173
+ dateFormatYMDHMS,
22174
+ dateFormatHMS,
22175
+ scaleFormat,
22176
+ scale2Format,
22177
+ groupSeparator,
22178
+ copyText,
22179
+ removeHtmlSub,
22180
+ removeHtml,
22181
+ getEnumDesc,
22182
+ appendQueryParams,
22183
+ getNameAbbr,
22184
+ handleConditionalClear,
22185
+ getTimeRangePickerShortcuts
22186
+ };
22187
+ }
22188
+
22191
22189
  let pathPrefix = "/@";
22192
22190
  function setPathPrefix(prefix) {
22193
22191
  pathPrefix = prefix;
@@ -22566,6 +22564,7 @@
22566
22564
 
22567
22565
  const version = "1.0.0";
22568
22566
 
22567
+ const commonFun = commonFunction();
22569
22568
  const install = installer.install;
22570
22569
 
22571
22570
  exports.AccountTypeEnum = AccountTypeEnum;
@@ -22650,8 +22649,10 @@
22650
22649
  exports.roles = roles;
22651
22650
  exports.saulVModel = saulVModel;
22652
22651
  exports.service = service;
22652
+ exports.setCssCdn = setCssCdn;
22653
22653
  exports.setDynamicViewsModules = setDynamicViewsModules;
22654
22654
  exports.setIntroduction = setIntroduction;
22655
+ exports.setJsCdn = setJsCdn;
22655
22656
  exports.setPathPrefix = setPathPrefix;
22656
22657
  exports.setupI18n = setupI18n;
22657
22658
  exports.signatureByKSort = signatureByKSort;