@fmdeui/fmui 1.0.7 → 1.0.9

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/index.js CHANGED
@@ -1,12 +1,49 @@
1
- /*! fmdeui-fmui v1.0.7 */
1
+ /*! fmdeui-fmui v1.0.9 */
2
2
  (function (global, factory) {
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('mitt'), 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('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', 'mitt', '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', '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.mitt, global.axios, global.Cookies, global.VxeUITable, global.VxeUIPluginRenderElement, global.VxeUIPluginExportXLSX, global.VxeUIExport, global.vueI18n, global.ExcelJS, global._, global.VueUse, global.vueRouter, global.NProgress));
6
- })(this, (function (exports, pinia$1, CryptoJS, XLSXS, elementPlus, vue, svg, mitt, axios, Cookies, VxeUITable, VxeUIPluginRenderElement, VxeUIPluginExportXLSX, VxeUI, vueI18n, ExcelJS, lodashEs, core, vueRouter, NProgress) { 'use strict';
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';
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
+
10
47
  function judgementSameArr(newArr, oldArr) {
11
48
  const news = removeDuplicate(newArr);
12
49
  const olds = removeDuplicate(oldArr);
@@ -1163,8 +1200,6 @@
1163
1200
  }
1164
1201
  };
1165
1202
 
1166
- mitt();
1167
-
1168
1203
  const Local = {
1169
1204
  // 查看 v2.4.3版本更新日志
1170
1205
  setKey(key) {
@@ -1445,31 +1480,6 @@
1445
1480
  });
1446
1481
  };
1447
1482
 
1448
- const cssCdnUrlList = [
1449
- // 调整为从本地引入,注释下面的 url
1450
- // '//at.alicdn.com/t/c/font_2298093_rnp72ifj3ba.css',
1451
- // '//netdna.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css',
1452
- ];
1453
- const jsCdnUrlList = [];
1454
- function setCssCdn() {
1455
- if (cssCdnUrlList.length <= 0) return false;
1456
- cssCdnUrlList.map((v) => {
1457
- let link = document.createElement("link");
1458
- link.rel = "stylesheet";
1459
- link.href = v;
1460
- link.crossOrigin = "anonymous";
1461
- document.getElementsByTagName("head")[0].appendChild(link);
1462
- });
1463
- }
1464
- function setJsCdn() {
1465
- if (jsCdnUrlList.length <= 0) return false;
1466
- jsCdnUrlList.map((v) => {
1467
- let link = document.createElement("script");
1468
- link.src = v;
1469
- document.body.appendChild(link);
1470
- });
1471
- }
1472
-
1473
1483
  function useChangeColor() {
1474
1484
  const hexToRgb = (str) => {
1475
1485
  let hexs = "";
@@ -18445,31 +18455,6 @@
18445
18455
 
18446
18456
  const FButton = _sfc_main$d;
18447
18457
 
18448
- const buildTranslator = (locale) => (path, option) => translate(path, option, vue.unref(locale));
18449
- const translate = (path, option, locale) => lodashEs.get(locale, path, path).replace(
18450
- /\{(\w+)\}/g,
18451
- (_, key) => {
18452
- var _a;
18453
- return `${(_a = option == null ? void 0 : option[key]) != null ? _a : `{${key}}`}`;
18454
- }
18455
- );
18456
- const buildLocaleContext = (locale) => {
18457
- const lang = vue.computed(() => vue.unref(locale).name);
18458
- const localeRef = vue.isRef(locale) ? locale : vue.ref(locale);
18459
- return {
18460
- lang,
18461
- locale: localeRef,
18462
- t: buildTranslator(locale)
18463
- };
18464
- };
18465
- const useLocale = (localeOverrides) => {
18466
- const locale = localeOverrides || vue.inject(elementPlus.localeContextKey, vue.ref());
18467
- return buildLocaleContext(vue.computed(() => {
18468
- var _a;
18469
- return ((_a = locale == null ? void 0 : locale.value) == null ? void 0 : _a.plus) ? locale.value : plusZhCn;
18470
- }));
18471
- };
18472
-
18473
18458
  const useKeepALiveNames = pinia$1.defineStore("keepALiveNames", {
18474
18459
  state: () => ({
18475
18460
  keepAliveNames: [],
@@ -18547,6 +18532,202 @@
18547
18532
  }
18548
18533
  });
18549
18534
 
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
+
18550
18731
  function auth(value) {
18551
18732
  const stores = useUserInfo();
18552
18733
  return stores.userInfos.authApiList.some((v) => v === value);
@@ -18850,6 +19031,8 @@
18850
19031
  ];
18851
19032
  };
18852
19033
 
19034
+ const commonFun = commonFunction();
19035
+
18853
19036
  const _hoisted_1$6 = { key: 0 };
18854
19037
  const _hoisted_2$3 = { key: 0 };
18855
19038
  var _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
@@ -22406,6 +22589,8 @@
22406
22589
  exports.clearAccessTokens = clearAccessTokens;
22407
22590
  exports.clearTokens = clearTokens;
22408
22591
  exports.clone = clone;
22592
+ exports.commonFun = commonFun;
22593
+ exports.commonFunction = commonFunction;
22409
22594
  exports.configureRoutes = configureRoutes;
22410
22595
  exports.dataURLtoBlob = dataURLtoBlob;
22411
22596
  exports.decryptJWT = decryptJWT;
@@ -22452,6 +22637,7 @@
22452
22637
  exports.languageList = languageList;
22453
22638
  exports.loadSysInfo = loadSysInfo;
22454
22639
  exports.mergMessage = mergMessage;
22640
+ exports.mittBus = emitter;
22455
22641
  exports.openWindow = openWindow;
22456
22642
  exports.orgId = orgId;
22457
22643
  exports.orgName = orgName;
@@ -22464,9 +22650,8 @@
22464
22650
  exports.roles = roles;
22465
22651
  exports.saulVModel = saulVModel;
22466
22652
  exports.service = service;
22467
- exports.setCssCdn = setCssCdn;
22468
22653
  exports.setDynamicViewsModules = setDynamicViewsModules;
22469
- exports.setJsCdn = setJsCdn;
22654
+ exports.setIntroduction = setIntroduction;
22470
22655
  exports.setPathPrefix = setPathPrefix;
22471
22656
  exports.setupI18n = setupI18n;
22472
22657
  exports.signatureByKSort = signatureByKSort;