@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.
@@ -0,0 +1,24 @@
1
+ import { EmptyArrayType } from 'fmdeui-fmui/es/types';
2
+ import { MessageHandler } from 'element-plus';
3
+ export default function (): {
4
+ percentFormat: (row: EmptyArrayType, column: number, cellValue: string) => string;
5
+ dateFormatYMD: (row: EmptyArrayType, column: number, cellValue: string) => string;
6
+ dateFormatYMDHMS: (row: EmptyArrayType, column: number, cellValue: string) => string;
7
+ dateFormatHMS: (row: EmptyArrayType, column: number, cellValue: string) => string;
8
+ scaleFormat: (value?: string, scale?: number) => string;
9
+ scale2Format: (value?: string) => string;
10
+ groupSeparator: (value: number, minimumFractionDigits?: number) => string;
11
+ copyText: (text: string) => Promise<unknown>;
12
+ removeHtmlSub: (value: string) => string;
13
+ removeHtml: (value: string) => string;
14
+ getEnumDesc: (key: any, lstEnum: any) => any;
15
+ appendQueryParams: (url: string, params: {
16
+ [key: string]: any;
17
+ }) => string;
18
+ getNameAbbr: (text: string, callback?: (abbr: any) => void) => Promise<any> | MessageHandler | undefined;
19
+ handleConditionalClear: (condition: boolean, fieldValue: any, clearValue?: any) => any;
20
+ getTimeRangePickerShortcuts: () => {
21
+ text: string;
22
+ value: () => Date[];
23
+ }[];
24
+ };
@@ -1,3 +1,29 @@
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, };
1
27
  export * from './useLocale';
2
28
  export * from './authFunction';
3
29
  export * from './useVxeTableOptionsHook';
package/es/index.mjs CHANGED
@@ -3,7 +3,7 @@ import './packages/types/index.mjs';
3
3
  export { AccountTypeEnum, HttpMethodEnum, JobCreateTypeEnum } from './packages/api/index.mjs';
4
4
  import './packages/utils/index.mjs';
5
5
  import './packages/stores/index.mjs';
6
- import './packages/hooks/index.mjs';
6
+ export { commonFun } from './packages/hooks/index.mjs';
7
7
  export { initRouter } from './packages/router/index.mjs';
8
8
  export { getCountryCode, i18n, iso_3166_1_CountryList, languageList, mergMessage, setupI18n } from './packages/locale/index.mjs';
9
9
  export { version } from './version.mjs';
@@ -15,6 +15,7 @@ export { auth, authAll, auths, hAuth, hAuthAll, hAuths } from './packages/hooks/
15
15
  export { base64ToFile, blobToFile, dataURLtoBlob, fileToBase64, urlToBase64 } from './packages/utils/base64Conver.mjs';
16
16
  export { buildLocaleContext, buildTranslator, translate, useLocale } from './packages/hooks/useLocale.mjs';
17
17
  export { clone, isObjectValueEqual, judgementSameArr, removeDuplicate } from './packages/utils/arrayOperation.mjs';
18
+ export { default as commonFunction } from './packages/hooks/commonFunction.mjs';
18
19
  export { configureRoutes, setPathPrefix } from './packages/router/route.mjs';
19
20
  export { downloadByBase64, downloadByData, downloadByOnlineUrl, downloadByUrl, downloadStreamFile, getFileName, openWindow } from './packages/utils/download.mjs';
20
21
  export { default as en } from './packages/locale/lang/en.mjs';
@@ -28,8 +29,9 @@ export { initBackEndControlRoutes, setDynamicViewsModules } from './packages/rou
28
29
  export { initFrontEndControlRoutes } from './packages/router/frontEnd.mjs';
29
30
  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';
30
31
  export { loadSysInfo, updateFavicon } from './packages/hooks/sysInfo.mjs';
32
+ export { default as mittBus } from './packages/utils/mitt.mjs';
31
33
  export { saulVModel } from './packages/utils/saulVModel.mjs';
32
- export { setCssCdn, setJsCdn } from './packages/utils/setIconfont.mjs';
34
+ export { default as setIntroduction } from './packages/utils/setIconfont.mjs';
33
35
  export { signatureByKSort } from './packages/utils/data-signature.mjs';
34
36
  export { useApi, useBaseApi } from './packages/api/base/index.mjs';
35
37
  export { useChangeColor } from './packages/utils/theme.mjs';
@@ -0,0 +1,182 @@
1
+ import { useClipboard } from '@vueuse/core';
2
+ import { ElMessage } from 'element-plus';
3
+ import { useI18n } from 'vue-i18n';
4
+ import '../utils/index.mjs';
5
+ import '../stores/index.mjs';
6
+ import '../api/index.mjs';
7
+ import { useThemeConfig } from '../stores/themeConfig.mjs';
8
+ import { formatDate } from '../utils/formatTime.mjs';
9
+ import { useBaseApi } from '../api/base/index.mjs';
10
+
11
+ const themeStore = useThemeConfig();
12
+ function commonFunction() {
13
+ const { t } = useI18n();
14
+ const { copy, isSupported } = useClipboard();
15
+ const percentFormat = (row, column, cellValue) => {
16
+ return cellValue ? `${cellValue}%` : "-";
17
+ };
18
+ const dateFormatYMD = (row, column, cellValue) => {
19
+ if (!cellValue) return "-";
20
+ return formatDate(new Date(cellValue), "YYYY-mm-dd");
21
+ };
22
+ const dateFormatYMDHMS = (row, column, cellValue) => {
23
+ if (!cellValue) return "-";
24
+ return formatDate(new Date(cellValue), "YYYY-mm-dd HH:MM:SS");
25
+ };
26
+ const dateFormatHMS = (row, column, cellValue) => {
27
+ if (!cellValue) return "-";
28
+ let time = 0;
29
+ if (typeof row === "number") time = row;
30
+ if (typeof cellValue === "number") time = cellValue;
31
+ return formatDate(new Date(time * 1e3), "HH:MM:SS");
32
+ };
33
+ const scaleFormat = (value = "0", scale = 4) => {
34
+ return Number.parseFloat(value).toFixed(scale);
35
+ };
36
+ const scale2Format = (value = "0") => {
37
+ return Number.parseFloat(value).toFixed(2);
38
+ };
39
+ const groupSeparator = (value, minimumFractionDigits = 2) => {
40
+ return value.toLocaleString("en-US", {
41
+ minimumFractionDigits,
42
+ maximumFractionDigits: 2
43
+ });
44
+ };
45
+ const copyText = (text) => {
46
+ return new Promise((resolve, reject) => {
47
+ try {
48
+ if (!isSupported.value) {
49
+ console.error("\u6D4F\u89C8\u5668\u4E0D\u652F\u6301\u526A\u8D34\u677F API");
50
+ reject("\u6D4F\u89C8\u5668\u4E0D\u652F\u6301\u526A\u8D34\u677F API");
51
+ } else {
52
+ copy(text);
53
+ ElMessage.success(t("message.layout.copyTextSuccess"));
54
+ resolve(text);
55
+ }
56
+ } catch (e) {
57
+ ElMessage.error(t("message.layout.copyTextError"));
58
+ reject(e);
59
+ }
60
+ });
61
+ };
62
+ const removeHtmlSub = (value) => {
63
+ var str = value.replace(/<[^>]+>/g, "");
64
+ if (str.length > 50) return str.substring(0, 50) + "......";
65
+ else return str;
66
+ };
67
+ const removeHtml = (value) => {
68
+ return value.replace(/<[^>]+>/g, "");
69
+ };
70
+ const getEnumDesc = (key, lstEnum) => {
71
+ var _a;
72
+ return (_a = lstEnum.find((x) => x.value == key)) == null ? void 0 : _a.describe;
73
+ };
74
+ const appendQueryParams = (url, params) => {
75
+ if (!params || Object.keys(params).length == 0) return url;
76
+ const queryString = Object.keys(params).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(params[key])}`).join("&");
77
+ return `${url}${url.includes("?") ? "&" : "?"}${queryString}`;
78
+ };
79
+ const getNameAbbr = (text, callback) => {
80
+ if (!text) return ElMessage.error("\u83B7\u53D6\u7B80\u79F0\u6587\u672C\u4E0D\u80FD\u4E3A\u7A7A");
81
+ try {
82
+ return useBaseApi("sysCommon").post({ text }, "nameAbbr").then((res) => {
83
+ if (callback) callback(res.data.result);
84
+ return res.data.result;
85
+ });
86
+ } catch (e) {
87
+ ElMessage.error("\u83B7\u53D6\u5931\u8D25");
88
+ }
89
+ };
90
+ const handleConditionalClear = (condition, fieldValue, clearValue = void 0) => {
91
+ if (condition) {
92
+ return clearValue;
93
+ }
94
+ return fieldValue;
95
+ };
96
+ const getTimeRangePickerShortcuts = () => {
97
+ return [
98
+ {
99
+ text: "\u8FD1\u4E00\u5468",
100
+ value: () => {
101
+ const now = new Date(themeStore.themeConfig.serverTime);
102
+ const end = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59, 999);
103
+ const start = new Date(now.getFullYear(), now.getMonth(), now.getDate() - 7);
104
+ return [start, end];
105
+ }
106
+ },
107
+ {
108
+ text: "\u8FD1\u4E00\u6708",
109
+ value: () => {
110
+ const now = new Date(themeStore.themeConfig.serverTime);
111
+ const end = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59, 999);
112
+ const start = new Date(now.getFullYear(), now.getMonth() - 1, now.getDate());
113
+ return [start, end];
114
+ }
115
+ },
116
+ {
117
+ text: "\u8FD1\u4E09\u6708",
118
+ value: () => {
119
+ const now = new Date(themeStore.themeConfig.serverTime);
120
+ const end = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59, 999);
121
+ const start = new Date(now.getFullYear(), now.getMonth() - 3, now.getDate());
122
+ return [start, end];
123
+ }
124
+ },
125
+ {
126
+ text: "\u8FD1\u534A\u5E74",
127
+ value: () => {
128
+ const now = new Date(themeStore.themeConfig.serverTime);
129
+ const end = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59, 999);
130
+ const start = new Date(now.getFullYear(), now.getMonth() - 6, now.getDate());
131
+ return [start, end];
132
+ }
133
+ },
134
+ {
135
+ text: "\u672C\u5E74",
136
+ value: () => {
137
+ const now = new Date(themeStore.themeConfig.serverTime);
138
+ const end = new Date(now.getFullYear(), 11, 31, 23, 59, 59, 999);
139
+ const start = new Date(now.getFullYear(), 0, 1);
140
+ return [start, end];
141
+ }
142
+ },
143
+ {
144
+ text: "\u8FD1\u4E24\u5E74",
145
+ value: () => {
146
+ const now = new Date(themeStore.themeConfig.serverTime);
147
+ const end = new Date(now.getFullYear(), 11, 31, 23, 59, 59, 999);
148
+ const start = new Date(now.getFullYear() - 1, 0, 1);
149
+ return [start, end];
150
+ }
151
+ },
152
+ {
153
+ text: "\u8FD1\u4E09\u5E74",
154
+ value: () => {
155
+ const now = new Date(themeStore.themeConfig.serverTime);
156
+ const end = new Date(now.getFullYear(), 11, 31, 23, 59, 59, 999);
157
+ const start = new Date(now.getFullYear() - 2, 0, 1);
158
+ return [start, end];
159
+ }
160
+ }
161
+ ];
162
+ };
163
+ return {
164
+ percentFormat,
165
+ dateFormatYMD,
166
+ dateFormatYMDHMS,
167
+ dateFormatHMS,
168
+ scaleFormat,
169
+ scale2Format,
170
+ groupSeparator,
171
+ copyText,
172
+ removeHtmlSub,
173
+ removeHtml,
174
+ getEnumDesc,
175
+ appendQueryParams,
176
+ getNameAbbr,
177
+ handleConditionalClear,
178
+ getTimeRangePickerShortcuts
179
+ };
180
+ }
181
+
182
+ export { commonFunction as default };
@@ -1,6 +1,11 @@
1
+ import commonFunction from './commonFunction.mjs';
1
2
  export { buildLocaleContext, buildTranslator, translate, useLocale } from './useLocale.mjs';
2
3
  export { auth, authAll, auths, hAuth, hAuthAll, hAuths } from './authFunction.mjs';
3
4
  export { useVxeTable } from './useVxeTableOptionsHook.mjs';
4
5
  export { loadSysInfo, updateFavicon } from './sysInfo.mjs';
5
6
  export { hasPrivilege, hasRoleCode, isAdmin, isMember, isNormalUser, isSupperAdmin, isTenantAdmin, orgId, orgName, posId, posName, roles, tenantId, userAccount, userEmail, userFriendName, userId, userName, userPhone } from './useInfo.mjs';
6
7
  export { useDateTimeShortCust } from './dateTimeShortCust.mjs';
8
+
9
+ const commonFun = commonFunction();
10
+
11
+ export { commonFun, commonFunction };
@@ -1,3 +1,5 @@
1
+ export { default as mittBus } from './mitt.mjs';
2
+ export { default as setIntroduction } from './setIconfont.mjs';
1
3
  export { clone, isObjectValueEqual, judgementSameArr, removeDuplicate } from './arrayOperation.mjs';
2
4
  import './auto-update.mjs';
3
5
  export { base64ToFile, blobToFile, dataURLtoBlob, fileToBase64, urlToBase64 } from './base64Conver.mjs';
@@ -13,10 +15,8 @@ export { gcj02ToBd09, wgs84ToBd09, wgs84ToGcj02 } from './gpsConvertor.mjs';
13
15
  export { StringToObj } from './json-utils.mjs';
14
16
  export { NextLoading } from './loading.mjs';
15
17
  import './md5Signature.mjs';
16
- import './mitt.mjs';
17
18
  export { accessTokenKey, axiosInstance, cancelAllRequest, cancelRequest, clearAccessTokens, clearTokens, decryptJWT, getHeader, getJWTDate, getToken, reLoadLoginAccessToken, refreshAccessTokenKey, request2, default as service, sleep, tansParams } from './request.mjs';
18
19
  export { saulVModel } from './saulVModel.mjs';
19
- export { setCssCdn, setJsCdn } from './setIconfont.mjs';
20
20
  export { Local, Session } from './storage.mjs';
21
21
  export { useChangeColor } from './theme.mjs';
22
22
  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';
@@ -1 +1,47 @@
1
- export {};
1
+ import { RouteRecordRaw } from '../router';
2
+ export type AsideState = {
3
+ menuList: RouteRecordRaw[];
4
+ clientWidth: number;
5
+ };
6
+ export type ColumnsAsideState<T = any> = {
7
+ columnsAsideList: T[];
8
+ liIndex: number;
9
+ liOldIndex: null | number;
10
+ liHoverIndex: null | number;
11
+ liOldPath: null | string;
12
+ difference: number;
13
+ routeSplit: string[];
14
+ };
15
+ export type BreadcrumbState<T = any> = {
16
+ breadcrumbList: T[];
17
+ routeSplit: string[];
18
+ routeSplitFirst: string;
19
+ routeSplitIndex: number;
20
+ };
21
+ export type SearchState<T = any> = {
22
+ isShowSearch: boolean;
23
+ menuQuery: string;
24
+ tagsViewList: T[];
25
+ };
26
+ export type TagsViewState<T = any> = {
27
+ routeActive: string | T;
28
+ routePath: string | unknown;
29
+ dropdown: {
30
+ x: string | number;
31
+ y: string | number;
32
+ };
33
+ sortable: T;
34
+ tagsRefsIndex: number;
35
+ tagsViewList: T[];
36
+ tagsViewRoutesList: T[];
37
+ };
38
+ export type ParentViewState<T = any> = {
39
+ refreshRouterViewKey: string;
40
+ iframeRefreshKey: string;
41
+ keepAliveNameList: string[];
42
+ iframeList: T[];
43
+ };
44
+ export type LinkViewState = {
45
+ title: string;
46
+ isLink: string;
47
+ };
@@ -99,5 +99,6 @@ export interface ThemeConfigState {
99
99
  mobileLogin: boolean;
100
100
  scanLogin: boolean;
101
101
  signUp: boolean;
102
+ serverTime?: any;
102
103
  };
103
104
  }
@@ -1,3 +1,6 @@
1
+ import { default as mittBus } from './mitt';
2
+ import { default as setIntroduction } from './setIconfont';
3
+ export { mittBus, setIntroduction };
1
4
  export * from './arrayOperation';
2
5
  export * from './auto-update';
3
6
  export * from './base64Conver';
@@ -13,10 +16,8 @@ export * from './gpsConvertor';
13
16
  export * from './json-utils';
14
17
  export * from './loading';
15
18
  export * from './md5Signature';
16
- export * from './mitt';
17
19
  export * from './request';
18
20
  export * from './saulVModel';
19
- export * from './setIconfont';
20
21
  export * from './storage';
21
22
  export * from './theme';
22
23
  export * from './toolsValidate';