@gct-paas/core 0.1.4-dev.11 → 0.1.4-dev.12
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/dist/index.esm.min.js +21679 -0
- package/es/constants/core.mjs +5 -4
- package/es/constants/default-date-type/default-date-type.mjs +73 -21
- package/es/constants/editor-register/editor-register.mjs +17 -5
- package/es/constants/expression-type/BuiltOperators.mjs +152 -147
- package/es/constants/expression-type/FunctionKeys.mjs +75 -79
- package/es/constants/expression-type/editor.mjs +10 -3
- package/es/constants/expression-type/function.mjs +602 -613
- package/es/constants/expression-type/index.mjs +111 -113
- package/es/constants/expression-type/modeCfg.mjs +256 -263
- package/es/constants/expression-type/variable.mjs +43 -39
- package/es/constants/form-container-type/form-container-type.mjs +17 -5
- package/es/constants/index.mjs +30 -10
- package/es/constants/page-designer/model.mjs +15 -5
- package/es/create-app-vue.mjs +15 -9
- package/es/enums/app-designer/index.d.ts +19 -0
- package/es/enums/app-designer/index.mjs +131 -63
- package/es/enums/appEnum.mjs +681 -360
- package/es/enums/appStateEnum.mjs +17 -10
- package/es/enums/authActionEnum.mjs +63 -51
- package/es/enums/breakpointEnum.mjs +27 -26
- package/es/enums/cacheEnum.mjs +22 -21
- package/es/enums/designEnum.mjs +110 -71
- package/es/enums/developer-center/integration.mjs +7 -6
- package/es/enums/exceptionEnum.mjs +21 -17
- package/es/enums/expressionEnum.d.ts +1 -1
- package/es/enums/expressionEnum.mjs +81 -74
- package/es/enums/globalEnum.mjs +59 -36
- package/es/enums/httpEnum.mjs +71 -61
- package/es/enums/index.mjs +43 -14
- package/es/enums/menuEnum.mjs +42 -38
- package/es/enums/page-designer/designer.mjs +403 -407
- package/es/enums/page-designer/index.mjs +4 -0
- package/es/enums/page-designer/panel.mjs +341 -213
- package/es/enums/page-designer/toolkit.mjs +13 -12
- package/es/enums/page-designer/widget.mjs +425 -338
- package/es/enums/pageEnum.mjs +14 -13
- package/es/enums/plugin-enum.mjs +23 -7
- package/es/enums/processEnum.mjs +95 -60
- package/es/enums/roleEnum.mjs +7 -6
- package/es/enums/sizeEnum.d.ts +18 -0
- package/es/enums/sizeEnum.mjs +28 -8
- package/es/global/gct/gct.mjs +84 -96
- package/es/global/index.mjs +1 -0
- package/es/hooks/index.mjs +4 -0
- package/es/hooks/use-app-inst/use-app-inst.mjs +11 -5
- package/es/hooks/use-modal/use-modal.mjs +16 -10
- package/es/hooks/use-sub-app-utils/use-sub-app-utils.mjs +43 -23
- package/es/hooks/useCopyToClipboard.mjs +50 -50
- package/es/index.mjs +122 -114
- package/es/locale/index.mjs +43 -57
- package/es/modules/env-manager/env-manager.const.mjs +16 -8
- package/es/modules/env-manager/env-manager.interface.mjs +14 -7
- package/es/modules/env-manager/env-manager.mjs +104 -107
- package/es/modules/error-handler/error-handler.const.mjs +11 -16
- package/es/modules/error-handler/error-strategy.mjs +199 -175
- package/es/modules/error-handler/index.mjs +120 -106
- package/es/modules/mqtt/constants/mqtt.const.mjs +21 -24
- package/es/modules/mqtt/enums/mqtt-status.enum.mjs +23 -9
- package/es/modules/mqtt/index.mjs +4 -0
- package/es/modules/mqtt/mqtt-client.mjs +228 -261
- package/es/modules/mqtt/mqtt-manager.mjs +117 -77
- package/es/modules/platform-config/constants/index.mjs +4 -0
- package/es/modules/platform-config/constants/login.const.mjs +48 -45
- package/es/modules/platform-config/constants/org.const.mjs +57 -52
- package/es/modules/platform-config/constants/theme.const.mjs +11 -4
- package/es/modules/platform-config/constants/watermark.const.mjs +17 -12
- package/es/modules/platform-config/enums/deploy.enum.mjs +13 -6
- package/es/modules/platform-config/enums/login.enum.mjs +29 -15
- package/es/modules/platform-config/enums/platform.enum.mjs +16 -13
- package/es/modules/platform-config/index.mjs +9 -0
- package/es/modules/platform-config/store.mjs +68 -79
- package/es/modules/platform-config/useBasicSetting.mjs +47 -35
- package/es/modules/platform-config/useDeploySetting.mjs +29 -21
- package/es/modules/platform-config/useLoginSetting.mjs +151 -173
- package/es/modules/platform-config/useOrgSetting.mjs +63 -62
- package/es/modules/platform-config/useProjectSetting.mjs +14 -6
- package/es/modules/platform-config/useSecuritySetting.mjs +68 -56
- package/es/modules/platform-config/useThemeSetting.mjs +78 -59
- package/es/modules/platform-config/useWatermarkSetting.mjs +37 -23
- package/es/modules/user-stores/index.mjs +3 -0
- package/es/modules/user-stores/store/permission.store.mjs +27 -36
- package/es/modules/user-stores/store/tenant.store.mjs +20 -22
- package/es/modules/user-stores/store/user.store.mjs +94 -117
- package/es/router/index.mjs +25 -28
- package/es/setup-app.mjs +23 -39
- package/es/state/global-pinia-state/global-pinia-state.mjs +49 -71
- package/es/state/index.mjs +1 -0
- package/es/store/global-store.mjs +50 -72
- package/es/store/index.mjs +25 -19
- package/es/types/index.d.ts +7 -0
- package/es/utils/axios/interceptors.mjs +21 -17
- package/es/utils/cache-adapter/cache-adapter.mjs +61 -56
- package/es/utils/design/design.mjs +18 -12
- package/es/utils/deviceFingerprint.mjs +74 -63
- package/es/utils/dictionary/dictionary.mjs +142 -145
- package/es/utils/file/base64Conver.mjs +35 -30
- package/es/utils/file/download.mjs +94 -98
- package/es/utils/file/parser.d.ts +3 -0
- package/es/utils/file/parser.mjs +29 -0
- package/es/utils/i18n/index.mjs +14 -3
- package/es/utils/index.d.ts +1 -0
- package/es/utils/index.mjs +31 -0
- package/es/utils/is-sort-filed/is-sort-filed.mjs +42 -37
- package/es/utils/linked-list/linked-list.mjs +115 -118
- package/es/utils/linked-node/linked-node.mjs +41 -31
- package/es/utils/lowcode/utils.mjs +13 -18
- package/es/utils/lowcode/validate.mjs +20 -26
- package/es/utils/mitt/mitt.mjs +4 -4
- package/es/utils/model-loader/model-loader.mjs +280 -325
- package/es/utils/namespace/namespace.mjs +178 -164
- package/es/utils/openUtil/index.mjs +2 -0
- package/es/utils/openUtil/modal/modal.mjs +72 -79
- package/es/utils/openUtil/overlay-container/overlay-container.mjs +144 -138
- package/es/utils/permission.mjs +33 -37
- package/es/utils/plugin-static-resource/plugin-static-resource.mjs +46 -42
- package/es/utils/style/index.mjs +94 -138
- package/es/utils/tools/tools.mjs +86 -54
- package/es/utils/treeHelper/treeHelper.mjs +205 -233
- package/es/utils/uploader/uploader.mjs +81 -115
- package/es/utils/useUUid.mjs +79 -87
- package/es/utils/util.mjs +55 -35
- package/es/utils/uuid/uuid.d.ts +1 -0
- package/es/utils/uuid/uuid.mjs +36 -43
- package/es/utils/validate.mjs +15 -19
- package/es/utils/value-helper/value-helper.mjs +113 -98
- package/package.json +12 -13
- package/dist/index.esm.min.mjs +0 -18322
- package/dist/index.min.cjs +0 -393
- package/dist/index.system.min.js +0 -393
package/es/utils/style/index.mjs
CHANGED
|
@@ -1,141 +1,97 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
if (border.top.style && !ignoringStyle.includes("borderTopStyle")) {
|
|
73
|
-
style["border-top-style"] = border.top.style;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
if (border.right) {
|
|
77
|
-
if (border.right.color != null && border.right.color != "" && !ignoringStyle.includes("borderRightColor")) {
|
|
78
|
-
style["border-right-color"] = border.right.color;
|
|
79
|
-
}
|
|
80
|
-
if (border.right.width != null && border.right.width != "" && !ignoringStyle.includes("borderRightWidth")) {
|
|
81
|
-
style["border-right-width"] = border.right.width;
|
|
82
|
-
}
|
|
83
|
-
if (border.right.style && !ignoringStyle.includes("borderRightStyle")) {
|
|
84
|
-
style["border-right-style"] = border.right.style;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
if (border.bottom) {
|
|
88
|
-
if (border.bottom.color != null && border.bottom.color != "" && !ignoringStyle.includes("borderBottomColor")) {
|
|
89
|
-
style["border-bottom-color"] = border.bottom.color;
|
|
90
|
-
}
|
|
91
|
-
if (border.bottom.width != null && border.bottom.width != "" && !ignoringStyle.includes("borderBottomWidth")) {
|
|
92
|
-
style["border-bottom-width"] = border.bottom.width;
|
|
93
|
-
}
|
|
94
|
-
if (border.bottom.style && !ignoringStyle.includes("borderBottomStyle")) {
|
|
95
|
-
style["border-bottom-style"] = border.bottom.style;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
if (border.left) {
|
|
99
|
-
if (border.left.color != null && border.left.color != "" && !ignoringStyle.includes("borderLeftColor")) {
|
|
100
|
-
style["border-left-color"] = border.left.color;
|
|
101
|
-
}
|
|
102
|
-
if (border.left.width != null && border.left.width != "" && !ignoringStyle.includes("borderLeftWidth")) {
|
|
103
|
-
style["border-left-width"] = border.left.width;
|
|
104
|
-
}
|
|
105
|
-
if (border.left.style && !ignoringStyle.includes("borderLeftStyle")) {
|
|
106
|
-
style["border-left-style"] = border.left.style;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
if (data.border_radius) {
|
|
111
|
-
style["border-radius"] = `${data.border_radius}px`;
|
|
112
|
-
}
|
|
113
|
-
return style;
|
|
1
|
+
//#region src/utils/style/index.ts
|
|
2
|
+
/**
|
|
3
|
+
* 计算配置样式
|
|
4
|
+
*
|
|
5
|
+
* @param data
|
|
6
|
+
* @param ignoringStyle 忽略计算的样式
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
var calcStyle = (data, ignoringStyle = []) => {
|
|
10
|
+
const style = {};
|
|
11
|
+
const padding = data.padding;
|
|
12
|
+
if (padding) {
|
|
13
|
+
if (padding.top != null && padding.top != "" && !ignoringStyle.includes("paddingTop")) style["padding-top"] = padding.top;
|
|
14
|
+
if (padding.right != null && padding.right != "" && !ignoringStyle.includes("paddingRight")) style["padding-right"] = padding.right;
|
|
15
|
+
if (padding.bottom != null && padding.bottom != "" && !ignoringStyle.includes("paddingBottom")) style["padding-bottom"] = padding.bottom;
|
|
16
|
+
if (padding.left != null && padding.left != "" && !ignoringStyle.includes("paddingLeft")) style["padding-left"] = padding.left;
|
|
17
|
+
}
|
|
18
|
+
const margin = data.margin;
|
|
19
|
+
if (margin) {
|
|
20
|
+
if (margin.top != null && margin.top != "" && !ignoringStyle.includes("marginTop")) style["margin-top"] = margin.top;
|
|
21
|
+
if (margin.right != null && margin.right != "" && !ignoringStyle.includes("marginRight")) style["margin-right"] = margin.right;
|
|
22
|
+
if (margin.bottom != null && margin.bottom != "" && !ignoringStyle.includes("marginBottom")) style["margin-bottom"] = margin.bottom;
|
|
23
|
+
if (margin.left != null && margin.left != "" && !ignoringStyle.includes("marginLeft")) style["margin-left"] = margin.left;
|
|
24
|
+
}
|
|
25
|
+
if (data.background != null && data.background != "" && !ignoringStyle.includes("backgroundColor")) style["background-color"] = data.background;
|
|
26
|
+
if (data.width != null && data.width != "" && !ignoringStyle.includes("width")) style.width = data.width;
|
|
27
|
+
if (data.height != null && data.height != "" && !ignoringStyle.includes("height")) {
|
|
28
|
+
style.height = data.height;
|
|
29
|
+
style.overflowX = "hidden";
|
|
30
|
+
style.overflowY = "auto";
|
|
31
|
+
}
|
|
32
|
+
const position = data.position;
|
|
33
|
+
if (position) {
|
|
34
|
+
if (position.position != null && position.position != "" && !ignoringStyle.includes("zIndex")) {
|
|
35
|
+
style.position = position.position;
|
|
36
|
+
style["z-index"] = 1;
|
|
37
|
+
}
|
|
38
|
+
if (position.top != null && position.top != "" && !ignoringStyle.includes("top")) style.top = `${position.top}px`;
|
|
39
|
+
if (position.right != null && position.right != "" && !ignoringStyle.includes("right")) style.right = `${position.right}px`;
|
|
40
|
+
if (position.bottom != null && position.bottom != "" && !ignoringStyle.includes("bottom")) style.bottom = `${position.bottom}px`;
|
|
41
|
+
if (position.left != null && position.left != "" && !ignoringStyle.includes("left")) style.left = `${position.left}px`;
|
|
42
|
+
}
|
|
43
|
+
const border = data.border;
|
|
44
|
+
if (border) {
|
|
45
|
+
if (border.topLeftRadius != null && border.topLeftRadius != "" && !ignoringStyle.includes("borderTopLeftRadius")) style["border-top-left-radius"] = border.topLeftRadius;
|
|
46
|
+
if (border.topRightRadius != null && border.topRightRadius != "" && !ignoringStyle.includes("borderTopRightRadius")) style["border-top-right-radius"] = border.topRightRadius;
|
|
47
|
+
if (border.bottomLeftRadius != null && border.bottomLeftRadius != "" && !ignoringStyle.includes("borderBottomLeftRadius")) style["border-bottom-left-radius"] = border.bottomLeftRadius;
|
|
48
|
+
if (border.bottomRightRadius != null && border.bottomRightRadius != "" && !ignoringStyle.includes("borderBottomRightRadius")) style["border-bottom-right-radius"] = border.bottomRightRadius;
|
|
49
|
+
if (border.top) {
|
|
50
|
+
if (border.top.color != null && border.top.color != "" && !ignoringStyle.includes("borderTopColor")) style["border-top-color"] = border.top.color;
|
|
51
|
+
if (border.top.width != null && border.top.width != "" && !ignoringStyle.includes("borderTopWidth")) style["border-top-width"] = border.top.width;
|
|
52
|
+
if (border.top.style && !ignoringStyle.includes("borderTopStyle")) style["border-top-style"] = border.top.style;
|
|
53
|
+
}
|
|
54
|
+
if (border.right) {
|
|
55
|
+
if (border.right.color != null && border.right.color != "" && !ignoringStyle.includes("borderRightColor")) style["border-right-color"] = border.right.color;
|
|
56
|
+
if (border.right.width != null && border.right.width != "" && !ignoringStyle.includes("borderRightWidth")) style["border-right-width"] = border.right.width;
|
|
57
|
+
if (border.right.style && !ignoringStyle.includes("borderRightStyle")) style["border-right-style"] = border.right.style;
|
|
58
|
+
}
|
|
59
|
+
if (border.bottom) {
|
|
60
|
+
if (border.bottom.color != null && border.bottom.color != "" && !ignoringStyle.includes("borderBottomColor")) style["border-bottom-color"] = border.bottom.color;
|
|
61
|
+
if (border.bottom.width != null && border.bottom.width != "" && !ignoringStyle.includes("borderBottomWidth")) style["border-bottom-width"] = border.bottom.width;
|
|
62
|
+
if (border.bottom.style && !ignoringStyle.includes("borderBottomStyle")) style["border-bottom-style"] = border.bottom.style;
|
|
63
|
+
}
|
|
64
|
+
if (border.left) {
|
|
65
|
+
if (border.left.color != null && border.left.color != "" && !ignoringStyle.includes("borderLeftColor")) style["border-left-color"] = border.left.color;
|
|
66
|
+
if (border.left.width != null && border.left.width != "" && !ignoringStyle.includes("borderLeftWidth")) style["border-left-width"] = border.left.width;
|
|
67
|
+
if (border.left.style && !ignoringStyle.includes("borderLeftStyle")) style["border-left-style"] = border.left.style;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (data.border_radius) style["border-radius"] = `${data.border_radius}px`;
|
|
71
|
+
return style;
|
|
114
72
|
};
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
}
|
|
138
|
-
return style;
|
|
73
|
+
/**
|
|
74
|
+
* 计算字体样式
|
|
75
|
+
*
|
|
76
|
+
* @param data
|
|
77
|
+
* @param ignoringStyle 忽略的样式
|
|
78
|
+
* @returns
|
|
79
|
+
*/
|
|
80
|
+
var calcFontStyle = (data, ignoringStyle = []) => {
|
|
81
|
+
const style = {};
|
|
82
|
+
const labelFont = data.labelFont;
|
|
83
|
+
if (labelFont) {
|
|
84
|
+
if (labelFont.color != null && labelFont.color != "" && !ignoringStyle.includes("color")) style.color = labelFont.color;
|
|
85
|
+
if (labelFont.fontSize != null && labelFont.fontSize != "" && !ignoringStyle.includes("fontSize")) style["font-size"] = labelFont.fontSize;
|
|
86
|
+
if (labelFont.align && !ignoringStyle.includes("textAlign")) {
|
|
87
|
+
style["text-align"] = labelFont.align;
|
|
88
|
+
style["text-align-last"] = labelFont.align;
|
|
89
|
+
}
|
|
90
|
+
if (labelFont.bold === true && !ignoringStyle.includes("fontWeight")) style["font-weight"] = "bold";
|
|
91
|
+
if (labelFont.italic === true && !ignoringStyle.includes("fontStyle")) style["font-style"] = "italic";
|
|
92
|
+
if (labelFont.textDecoration && !ignoringStyle.includes("textDecoration")) style["text-decoration"] = labelFont.textDecoration;
|
|
93
|
+
}
|
|
94
|
+
return style;
|
|
139
95
|
};
|
|
140
|
-
|
|
96
|
+
//#endregion
|
|
141
97
|
export { calcFontStyle, calcStyle };
|
package/es/utils/tools/tools.mjs
CHANGED
|
@@ -1,72 +1,104 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import "../../enums/cacheEnum.mjs";
|
|
2
|
+
import "../../enums/index.mjs";
|
|
3
|
+
import { CoreConst } from "../../constants/core.mjs";
|
|
4
|
+
import "../../constants/index.mjs";
|
|
5
|
+
import qs from "qs";
|
|
6
|
+
import { cloneDeep, isEqual, mergeWith, unionWith } from "lodash-es";
|
|
7
|
+
import { clearCookie, getCookie, setCookie } from "qx-util";
|
|
8
|
+
//#region src/utils/tools/tools.ts
|
|
9
|
+
/**
|
|
10
|
+
* 获取认证令牌
|
|
11
|
+
*
|
|
12
|
+
* @export
|
|
13
|
+
* @returns {*} {(string | null)}
|
|
14
|
+
*/
|
|
14
15
|
function getToken() {
|
|
15
|
-
|
|
16
|
+
return getCookie(CoreConst.TOKEN);
|
|
16
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* 设置认证令牌(目前只有 session 级别生效)
|
|
20
|
+
*
|
|
21
|
+
* @export
|
|
22
|
+
* @param {string} token
|
|
23
|
+
*/
|
|
17
24
|
function setToken(token) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
} else {
|
|
21
|
-
clearCookie(CoreConst.TOKEN, true);
|
|
22
|
-
}
|
|
25
|
+
if (token) setCookie(CoreConst.TOKEN, token, 7, true);
|
|
26
|
+
else clearCookie(CoreConst.TOKEN, true);
|
|
23
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* 从 cookie 获取租户标识
|
|
30
|
+
*
|
|
31
|
+
* @export
|
|
32
|
+
* @returns {*} {(string | null)}
|
|
33
|
+
*/
|
|
24
34
|
function getTenant() {
|
|
25
|
-
|
|
35
|
+
return getCookie(CoreConst.TENANT);
|
|
26
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* 设置租户标识至 cookie
|
|
39
|
+
*
|
|
40
|
+
* @export
|
|
41
|
+
* @param {string} tenant
|
|
42
|
+
*/
|
|
27
43
|
function setTenant(tenant) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
} else {
|
|
31
|
-
clearCookie(CoreConst.TENANT, true);
|
|
32
|
-
}
|
|
44
|
+
if (tenant) setCookie(CoreConst.TENANT, tenant, 7, true);
|
|
45
|
+
else clearCookie(CoreConst.TENANT, true);
|
|
33
46
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
47
|
+
/**
|
|
48
|
+
* 是否为移动端设备
|
|
49
|
+
*/
|
|
50
|
+
var isMobile = (() => {
|
|
51
|
+
const ua = navigator.userAgent;
|
|
52
|
+
const mobileRegex = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/;
|
|
53
|
+
const isSmallScreen = window.innerWidth <= 768;
|
|
54
|
+
const isTouch = "ontouchstart" in window || navigator.maxTouchPoints > 0;
|
|
55
|
+
return mobileRegex.test(ua) || isSmallScreen && isTouch;
|
|
40
56
|
})();
|
|
57
|
+
/**
|
|
58
|
+
* 获取时区,默认: UTC+08:00
|
|
59
|
+
*
|
|
60
|
+
* @export
|
|
61
|
+
* @returns {*}
|
|
62
|
+
*/
|
|
41
63
|
function getTimezone() {
|
|
42
|
-
|
|
64
|
+
return localStorage.getItem("TIMEZONE__") || "UTC+08:00";
|
|
43
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* 递归合并两个对象
|
|
68
|
+
*
|
|
69
|
+
* @template T
|
|
70
|
+
* @template U
|
|
71
|
+
* @param {T} target 目标对象,合并后结果存放于此
|
|
72
|
+
* @param {U} source 要合并的源对象
|
|
73
|
+
* @returns {(T & U)} 合并后的对象
|
|
74
|
+
*/
|
|
44
75
|
function deepMerge(target, source) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
(prevValue, nextValue) => {
|
|
51
|
-
return Array.isArray(prevValue) ? unionWith(prevValue, nextValue, isEqual) : void 0;
|
|
52
|
-
}
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
});
|
|
76
|
+
return mergeWith(cloneDeep(target), source, (objValue, srcValue) => {
|
|
77
|
+
if (typeof objValue === "object" && typeof srcValue === "object") return mergeWith(cloneDeep(objValue), srcValue, (prevValue, nextValue) => {
|
|
78
|
+
return Array.isArray(prevValue) ? unionWith(prevValue, nextValue, isEqual) : void 0;
|
|
79
|
+
});
|
|
80
|
+
});
|
|
56
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* 对象 → 矩阵参数(stringify)
|
|
84
|
+
* @param {*} params
|
|
85
|
+
* @returns
|
|
86
|
+
*/
|
|
57
87
|
function stringifyMatrixParams(params) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
88
|
+
const str = qs.stringify(params, {
|
|
89
|
+
encode: true,
|
|
90
|
+
delimiter: ";"
|
|
91
|
+
});
|
|
92
|
+
return str ? `;${str}` : "";
|
|
63
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* 矩阵参数 → 对象(parse)
|
|
96
|
+
* @param {*} path
|
|
97
|
+
* @returns
|
|
98
|
+
*/
|
|
64
99
|
function parseMatrixParams(path) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
return qs.parse(path, {
|
|
68
|
-
delimiter: ";"
|
|
69
|
-
});
|
|
100
|
+
if (path.indexOf(";") === -1) return {};
|
|
101
|
+
return qs.parse(path, { delimiter: ";" });
|
|
70
102
|
}
|
|
71
|
-
|
|
103
|
+
//#endregion
|
|
72
104
|
export { deepMerge, getTenant, getTimezone, getToken, isMobile, parseMatrixParams, setTenant, setToken, stringifyMatrixParams };
|