@gct-paas/core 0.1.6-dev.2 → 0.1.6-dev.21

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.
Files changed (95) hide show
  1. package/dist/index.esm.min.js +2 -1
  2. package/dist/{redirect-index-Ck5Ddtcb.js → redirect-index-B_rzKQa2.js} +1 -0
  3. package/es/constants/core.d.ts +1 -0
  4. package/es/constants/core.mjs +27 -1
  5. package/es/constants/expression-type/modeCfg.mjs +6 -0
  6. package/es/constants/index.d.ts +1 -1
  7. package/es/create-app-vue.d.ts +1 -1
  8. package/es/create-app-vue.mjs +1 -1
  9. package/es/enums/app-designer/index.d.ts +29 -3
  10. package/es/enums/app-designer/index.mjs +33 -4
  11. package/es/enums/appEnum.d.ts +5 -1
  12. package/es/enums/appEnum.mjs +6 -1
  13. package/es/enums/authActionEnum.d.ts +5 -1
  14. package/es/enums/authActionEnum.mjs +4 -0
  15. package/es/enums/developer-center/integration.d.ts +6 -0
  16. package/es/enums/developer-center/integration.mjs +8 -1
  17. package/es/enums/expressionEnum.d.ts +4 -2
  18. package/es/enums/expressionEnum.mjs +2 -0
  19. package/es/enums/globalEnum.d.ts +47 -0
  20. package/es/enums/globalEnum.mjs +51 -1
  21. package/es/enums/index.d.ts +11 -0
  22. package/es/enums/index.mjs +13 -1
  23. package/es/enums/pageEnum.d.ts +2 -1
  24. package/es/enums/pageEnum.mjs +1 -0
  25. package/es/enums/process.d.ts +5 -0
  26. package/es/enums/process.mjs +9 -0
  27. package/es/enums/sizeEnum.d.ts +4 -0
  28. package/es/enums/sizeEnum.mjs +6 -1
  29. package/es/global/gct/gct.d.ts +15 -15
  30. package/es/global/gct/gct.mjs +4 -5
  31. package/es/hooks/index.d.ts +2 -0
  32. package/es/hooks/index.mjs +2 -0
  33. package/es/hooks/useDebouncePromise.d.ts +14 -0
  34. package/es/hooks/useDebouncePromise.mjs +56 -0
  35. package/es/hooks/useObserver.d.ts +13 -0
  36. package/es/hooks/useObserver.mjs +46 -0
  37. package/es/index.mjs +34 -18
  38. package/es/interface/i-action-item/i-action-item.d.ts +65 -0
  39. package/es/interface/i-app-context/i-app-context.d.ts +13 -0
  40. package/es/interface/i-dictionary/i-dictionary-item.d.ts +80 -0
  41. package/es/interface/i-kit-plugin-module/i-kit-plugin-module.d.ts +2 -2
  42. package/es/interface/i-pinia-action/i-global-actions.d.ts +3 -0
  43. package/es/interface/index.d.ts +2 -1
  44. package/es/interface/open-util/i-drawer-options/i-drawer-options.d.ts +298 -0
  45. package/es/interface/open-util/i-modal/i-modal.d.ts +14 -1
  46. package/es/interface/open-util/i-modal-data/i-modal-data.d.ts +3 -3
  47. package/es/interface/open-util/i-modal-options/i-modal-options.d.ts +2 -1
  48. package/es/interface/open-util/i-overlay-controller/i-overlay-controller.d.ts +9 -0
  49. package/es/interface/open-util/index.d.ts +1 -0
  50. package/es/locale/index.d.ts +2 -1
  51. package/es/modules/env-manager/env-manager.const.d.ts +2 -0
  52. package/es/modules/env-manager/env-manager.const.mjs +4 -2
  53. package/es/modules/env-manager/env-manager.d.ts +1 -13
  54. package/es/modules/env-manager/env-manager.interface.d.ts +6 -8
  55. package/es/modules/env-manager/env-manager.interface.mjs +2 -0
  56. package/es/modules/env-manager/env-manager.mjs +11 -26
  57. package/es/modules/env-manager/env-manager.util.d.ts +5 -0
  58. package/es/modules/env-manager/env-manager.util.mjs +11 -0
  59. package/es/modules/env-manager/index.d.ts +1 -0
  60. package/es/modules/env-manager/index.mjs +4 -0
  61. package/es/modules/platform-config/enums/login.enum.d.ts +3 -1
  62. package/es/modules/platform-config/enums/login.enum.mjs +2 -0
  63. package/es/modules/platform-config/store.d.ts +15 -15
  64. package/es/modules/platform-config/useDeploySetting.d.ts +1 -2
  65. package/es/modules/platform-config/useDeploySetting.mjs +6 -3
  66. package/es/modules/platform-config/useLoginSetting.d.ts +2 -2
  67. package/es/modules/platform-config/useLoginSetting.mjs +29 -31
  68. package/es/modules/platform-config/useOrgSetting.d.ts +2 -2
  69. package/es/modules/platform-config/useOrgSetting.mjs +4 -6
  70. package/es/modules/platform-config/useSecuritySetting.d.ts +2 -2
  71. package/es/modules/platform-config/useSecuritySetting.mjs +2 -3
  72. package/es/modules/platform-config/useWatermarkSetting.d.ts +5 -2
  73. package/es/modules/platform-config/useWatermarkSetting.mjs +2 -3
  74. package/es/modules/user-stores/store/tenant.store.d.ts +3 -5
  75. package/es/modules/user-stores/store/tenant.store.mjs +10 -12
  76. package/es/modules/user-stores/store/user.store.mjs +4 -4
  77. package/es/store/global-store.mjs +12 -4
  78. package/es/store/index.d.ts +1 -1
  79. package/es/store/session-store.d.ts +1 -0
  80. package/es/store/session-store.mjs +2 -1
  81. package/es/types/index.d.ts +13 -0
  82. package/es/utils/axios/interceptors.mjs +12 -0
  83. package/es/utils/deviceFingerprint.mjs +5 -1
  84. package/es/utils/i18n/index.mjs +1 -0
  85. package/es/utils/index.d.ts +3 -2
  86. package/es/utils/index.mjs +1 -0
  87. package/es/utils/namespace/namespace.mjs +1 -0
  88. package/es/utils/openUtil/modal/modal.d.ts +1 -1
  89. package/es/utils/openUtil/overlay-container/overlay-container.d.ts +1 -1
  90. package/es/utils/openUtil/overlay-container/overlay-container.mjs +28 -23
  91. package/es/utils/select-user-utils.d.ts +50 -0
  92. package/es/utils/select-user-utils.mjs +129 -0
  93. package/es/utils/tools/tools.d.ts +4 -2
  94. package/es/utils/tools/tools.mjs +20 -5
  95. package/package.json +3 -3
@@ -0,0 +1,298 @@
1
+ import { CSSProperties } from 'vue';
2
+ /**
3
+ * 模态飘窗配置项
4
+ *
5
+ * @author zhanghanrui
6
+ * @date 2024-03-29 13:03:31
7
+ * @export
8
+ * @interface IDrawerOptions
9
+ */
10
+ export interface IDrawerOptions {
11
+ /**
12
+ * 抽屉展开后是否将焦点切换至其 Dom 节点
13
+ *
14
+ * @default true
15
+ * @author zhanghanrui
16
+ * @date 2024-03-29 13:03:51
17
+ * @type {boolean}
18
+ */
19
+ autofocus?: boolean;
20
+ /**
21
+ * 可用于设置 Drawer 内容部分的样式
22
+ *
23
+ * @author zhanghanrui
24
+ * @date 2024-03-29 13:03:26
25
+ * @type {CSSProperties}
26
+ */
27
+ bodyStyle?: CSSProperties;
28
+ /**
29
+ * 对话框外层容器的类名
30
+ *
31
+ * @author zhanghanrui
32
+ * @date 2024-03-29 13:03:57
33
+ * @type {string}
34
+ */
35
+ class?: string;
36
+ /**
37
+ * 是否显示左上角的关闭按钮
38
+ *
39
+ * @default true
40
+ * @author zhanghanrui
41
+ * @date 2024-03-29 13:03:23
42
+ * @type {boolean}
43
+ */
44
+ closable?: boolean;
45
+ /**
46
+ * 自定义关闭图标
47
+ *
48
+ * @author zhanghanrui
49
+ * @date 2024-03-29 13:03:30
50
+ * @type {*}
51
+ */
52
+ closeIcon?: unknown;
53
+ /**
54
+ * 可用于设置 Drawer 包裹内容部分的样式
55
+ *
56
+ * @author zhanghanrui
57
+ * @date 2024-03-29 13:03:39
58
+ * @type {CSSProperties}
59
+ */
60
+ contentWrapperStyle?: CSSProperties;
61
+ /**
62
+ * 关闭时销毁 Drawer 里的子元素
63
+ *
64
+ * @default false
65
+ * @author zhanghanrui
66
+ * @date 2024-03-29 13:03:25
67
+ * @type {boolean}
68
+ */
69
+ destroyOnClose?: boolean;
70
+ /**
71
+ * 用于设置 Drawer 弹出层的样式
72
+ *
73
+ * @author zhanghanrui
74
+ * @date 2024-03-29 13:03:52
75
+ * @type {Object}
76
+ */
77
+ drawerStyle?: object;
78
+ /**
79
+ * 抽屉右上角的操作区域
80
+ *
81
+ * @author zhanghanrui
82
+ * @date 2024-03-29 13:03:16
83
+ * @type {(VNode | slot)}
84
+ */
85
+ extra?: unknown;
86
+ /**
87
+ * 抽屉的页脚
88
+ *
89
+ * @author zhanghanrui
90
+ * @date 2024-03-29 13:03:04
91
+ * @type {(VNode | slot)}
92
+ */
93
+ footer?: unknown;
94
+ /**
95
+ * 抽屉页脚部件的样式
96
+ *
97
+ * @author zhanghanrui
98
+ * @date 2024-03-29 13:03:23
99
+ * @type {CSSProperties}
100
+ */
101
+ footerStyle?: CSSProperties;
102
+ /**
103
+ * 预渲染 Drawer 内元素
104
+ *
105
+ * @default false
106
+ * @author zhanghanrui
107
+ * @date 2024-03-29 13:03:10
108
+ * @type {boolean}
109
+ */
110
+ forceRender?: boolean;
111
+ /**
112
+ * 指定 Drawer 挂载的 HTML 节点
113
+ *
114
+ * @author zhanghanrui
115
+ * @date 2024-03-29 13:03:49
116
+ */
117
+ getContainer?: HTMLElement;
118
+ /**
119
+ * 用于设置 Drawer 头部的样式
120
+ *
121
+ * @author zhanghanrui
122
+ * @date 2024-03-29 13:03:25
123
+ * @type {CSSProperties}
124
+ */
125
+ headerStyle?: CSSProperties;
126
+ /**
127
+ * 高度, 在 placement 为 top 或 bottom 时使用
128
+ *
129
+ * @author zhanghanrui
130
+ * @date 2024-03-29 13:03:40
131
+ * @type {(string | number)}
132
+ */
133
+ height?: string | number;
134
+ /**
135
+ * 是否支持键盘 esc 关闭
136
+ *
137
+ * @default true
138
+ * @author zhanghanrui
139
+ * @date 2024-03-29 13:03:54
140
+ * @type {boolean}
141
+ */
142
+ keyboard?: boolean;
143
+ /**
144
+ * 是否展示遮罩
145
+ *
146
+ * @default true
147
+ * @author zhanghanrui
148
+ * @date 2024-03-29 13:03:17
149
+ * @type {boolean}
150
+ */
151
+ mask?: boolean;
152
+ /**
153
+ * 点击蒙层是否允许关闭
154
+ *
155
+ * @default true
156
+ * @author zhanghanrui
157
+ * @date 2024-03-29 13:03:34
158
+ * @type {boolean}
159
+ */
160
+ maskClosable?: boolean;
161
+ /**
162
+ * 遮罩样式
163
+ *
164
+ * @author zhanghanrui
165
+ * @date 2024-03-29 13:03:49
166
+ * @type {CSSProperties}
167
+ */
168
+ maskStyle?: CSSProperties;
169
+ /**
170
+ * 抽屉的方向
171
+ *
172
+ * @default 'right'
173
+ * @author zhanghanrui
174
+ * @date 2024-03-29 13:03:05
175
+ * @type {('top' | 'right' | 'bottom' | 'left')}
176
+ */
177
+ placement?: 'top' | 'right' | 'bottom' | 'left';
178
+ /**
179
+ * 用于设置多层 Drawer 的推动行为
180
+ *
181
+ * @default { distance: 180 }
182
+ * @author zhanghanrui
183
+ * @date 2024-03-29 13:03:27
184
+ * @type {(boolean | { distance: string | number })}
185
+ */
186
+ push?: boolean | {
187
+ distance: string | number;
188
+ };
189
+ /**
190
+ * 预设抽屉宽度(或高度)
191
+ *
192
+ * @default 'default'
193
+ * @author zhanghanrui
194
+ * @date 2024-03-29 13:03:01
195
+ * @type {('default' | 'large')}
196
+ */
197
+ size?: 'default' | 'large';
198
+ /**
199
+ * 可用于设置 Drawer 最外层容器的样式,和 drawerStyle 的区别是作用节点包括 mask
200
+ *
201
+ * @author zhanghanrui
202
+ * @date 2024-03-29 13:03:23
203
+ * @type {CSSProperties}
204
+ */
205
+ style?: CSSProperties;
206
+ /**
207
+ * 抽屉的标题
208
+ *
209
+ * @author zhanghanrui
210
+ * @date 2024-03-29 13:03:32
211
+ * @type {string}
212
+ */
213
+ title?: string;
214
+ /**
215
+ * (v-model) Drawer 是否可见
216
+ *
217
+ * @author zhanghanrui
218
+ * @date 2024-03-29 13:03:41
219
+ * @type {boolean}
220
+ */
221
+ visible?: boolean;
222
+ /**
223
+ * 宽度
224
+ *
225
+ * @default 378
226
+ * @author zhanghanrui
227
+ * @date 2024-03-29 13:03:58
228
+ * @type {(string | number)}
229
+ */
230
+ width?: string | number;
231
+ /**
232
+ * 设置 Drawer 的 z-index
233
+ *
234
+ * @default 1000
235
+ * @author zhanghanrui
236
+ * @date 2024-03-29 13:03:21
237
+ * @type {number}
238
+ */
239
+ zIndex?: number;
240
+ /**
241
+ * 是否为详情模式
242
+ *
243
+ * @author zhanghanrui
244
+ * @date 2024-03-29 13:03:34
245
+ * @type {boolean}
246
+ */
247
+ isDetail?: boolean;
248
+ /**
249
+ * loading 状态
250
+ *
251
+ * @default false
252
+ * @author zhanghanrui
253
+ * @date 2024-03-29 13:03:48
254
+ * @type {boolean}
255
+ */
256
+ loading?: boolean;
257
+ /**
258
+ * loading 文本
259
+ *
260
+ * @author zhanghanrui
261
+ * @date 2024-03-29 13:03:02
262
+ * @type {string}
263
+ */
264
+ loadingText?: string;
265
+ /**
266
+ * isDetail=true 状态下是否显示返回按钮
267
+ *
268
+ * @default true
269
+ * @author zhanghanrui
270
+ * @date 2024-03-29 14:03:03
271
+ * @type {boolean}
272
+ */
273
+ showDetailBack?: boolean;
274
+ /**
275
+ * 自定义关闭函数,返回true关闭,否则不关闭
276
+ *
277
+ * @author zhanghanrui
278
+ * @date 2024-03-29 14:03:42
279
+ */
280
+ closeFunc?: () => Promise<boolean>;
281
+ /**
282
+ * 是否显示底部
283
+ *
284
+ * @author zhanghanrui
285
+ * @date 2024-03-29 14:03:55
286
+ * @type {boolean}
287
+ */
288
+ showFooter?: boolean;
289
+ /**
290
+ * 底部区域高度
291
+ *
292
+ * @default 60
293
+ * @author zhanghanrui
294
+ * @date 2024-03-29 14:03:22
295
+ * @type {number}
296
+ */
297
+ footerHeight?: number;
298
+ }
@@ -32,6 +32,18 @@ export interface IModal {
32
32
  * @type {IModalHooks}
33
33
  */
34
34
  hooks: IModalHooks;
35
+ /**
36
+ * 模态界面状态
37
+ *
38
+ * @type {{
39
+ * okDisabled?: boolean; // 确认按钮是否禁用
40
+ * cancelDisabled?: boolean; // 取消按钮是否禁用
41
+ * }}
42
+ */
43
+ state: {
44
+ okDisabled?: boolean;
45
+ cancelDisabled?: boolean;
46
+ };
35
47
  /**
36
48
  * 统一关闭入口
37
49
  *
@@ -58,8 +70,9 @@ export interface IModal {
58
70
  * @author zhanghanrui
59
71
  * @date 2024-03-29 11:03:03
60
72
  * @param {(() => Promise<IModalData | null>)} ok
73
+ * @param {(() => Promise<boolean>)} [cancel]
61
74
  */
62
- callback(ok: () => Promise<IModalData | null>): void;
75
+ callback(ok: () => Promise<IModalData | null>, cancel?: () => Promise<boolean>): void;
63
76
  /**
64
77
  * 取消操作
65
78
  *
@@ -6,7 +6,7 @@
6
6
  * @export
7
7
  * @interface IModalData
8
8
  */
9
- export interface IModalData {
9
+ export interface IModalData<T = IData> {
10
10
  /**
11
11
  * 关闭模态窗时是否操作成功
12
12
  *
@@ -26,9 +26,9 @@ export interface IModalData {
26
26
  *
27
27
  * @author zhanghanrui
28
28
  * @date 2024-03-19 20:03:44
29
- * @type {IData[]}
29
+ * @type {T[]}
30
30
  */
31
- data?: IData[];
31
+ data?: T[];
32
32
  /**
33
33
  * 额外参数
34
34
  *
@@ -1,3 +1,4 @@
1
+ import { VNode } from 'vue';
1
2
  /**
2
3
  * 模态打开参数,此为具体端实现,具体扩充参数由各端定义
3
4
  *
@@ -6,7 +7,7 @@
6
7
  */
7
8
  export interface IModalOptions {
8
9
  [key: string]: any;
9
- title?: string;
10
+ title?: string | VNode;
10
11
  width?: string | number;
11
12
  zIndex?: number;
12
13
  }
@@ -2,6 +2,7 @@ import { ComputePositionConfig } from '@floating-ui/dom';
2
2
  import { IOverlayContainer } from '../i-overlay-container/i-overlay-container';
3
3
  import { IModalOptions } from '../i-modal-options/i-modal-options';
4
4
  import { IModalData } from '../i-modal-data/i-modal-data';
5
+ import { IDrawerOptions } from '../i-drawer-options/i-drawer-options';
5
6
  import { IPopoverOptions } from '../../i-popover-options/i-popover-options';
6
7
  import { IOverlayPopoverContainer } from '../i-overlay-popover-container/i-overlay-popover-container';
7
8
  import { IAppFullScreenContainerOptions } from '../i-app-full-screen-container-options/i-app-full-screen-container-options';
@@ -38,6 +39,14 @@ export interface IOverlayController {
38
39
  * @return {*} {IOverlayContainer}
39
40
  */
40
41
  createModal(component: unknown, props?: IParams, opts?: IModalOptions): IOverlayContainer;
42
+ /**
43
+ * 抽屉打开组件
44
+ */
45
+ drawer<T = IModalData>(component: unknown, props?: IParams, opts?: IDrawerOptions): Promise<T>;
46
+ /**
47
+ * 创建全局抽屉容器
48
+ */
49
+ createDrawer(component: unknown, props?: IParams, opts?: IDrawerOptions): IOverlayContainer;
41
50
  /**
42
51
  * 飘窗打开组件
43
52
  *
@@ -1,3 +1,4 @@
1
+ export type { IDrawerOptions } from './i-drawer-options/i-drawer-options';
1
2
  export type { IAppFullScreenContainerOptions } from './i-app-full-screen-container-options/i-app-full-screen-container-options';
2
3
  export type { IMessageParams, IMessageUtil, } from './i-message-util/i-message-util';
3
4
  export type { IModal } from './i-modal/i-modal';
@@ -1,6 +1,7 @@
1
1
  import { I18n } from 'vue-i18n';
2
2
  import { App } from 'vue';
3
3
  import { I18nConfigResponse } from '@gct-paas/api/platform';
4
+ import { EnvironmentType } from '../modules/env-manager';
4
5
  type localeItem = Pick<I18nConfigResponse, 'id' | 'configured' | 'defaultLanguage' | 'language' | 'languageTag' | 'state'>;
5
6
  type ILocaleMessages = Record<string, string>;
6
7
  type ILocaleDeclarations = Record<string, ILocaleMessages>;
@@ -38,7 +39,7 @@ export declare class LocaleUtil {
38
39
  } | {
39
40
  locale: string;
40
41
  app: string;
41
- env: 'dev' | 'test' | 'prod';
42
+ env: EnvironmentType;
42
43
  branch?: string;
43
44
  }): string;
44
45
  /**
@@ -14,3 +14,5 @@ export declare const DEV_SINGLE_PATH_REG: RegExp;
14
14
  export declare const TEST_SINGLE_PATH_REG: RegExp;
15
15
  /** 沙箱环境路径正则表达式 */
16
16
  export declare const SANDBOX_PATH_REG: RegExp;
17
+ /** 单应用环境路径正则表达式 */
18
+ export declare const SINGLE_PATH_REG: RegExp;
@@ -14,6 +14,8 @@ var DEV_SINGLE_PATH_REG = /\/dev-single\//;
14
14
  /** 测试环境单应用路径正则表达式 */
15
15
  var TEST_SINGLE_PATH_REG = /\/test-single\//;
16
16
  /** 沙箱环境路径正则表达式 */
17
- var SANDBOX_PATH_REG = /(mobile|pad)-sandbox/;
17
+ var SANDBOX_PATH_REG = /(mobile|pad|web)-sandbox/;
18
+ /** 单应用环境路径正则表达式 */
19
+ var SINGLE_PATH_REG = /\/web-single\/|dev-single\/|test-single\//;
18
20
  //#endregion
19
- export { APP_PREVIEW_PATH_REG, APP_PROD_PATH_REG, APP_RUN_PATH_REG, DEV_SINGLE_PATH_REG, HOST_REG, IP_REG, SANDBOX_PATH_REG, TEST_SINGLE_PATH_REG };
21
+ export { APP_PREVIEW_PATH_REG, APP_PROD_PATH_REG, APP_RUN_PATH_REG, DEV_SINGLE_PATH_REG, HOST_REG, IP_REG, SANDBOX_PATH_REG, SINGLE_PATH_REG, TEST_SINGLE_PATH_REG };
@@ -18,21 +18,9 @@ export declare class EnvironmentManager implements IEnvironmentManager {
18
18
  /**安卓混合开发模式下 */
19
19
  get isAndroid(): boolean;
20
20
  /**
21
- * 是否为应用前端运行时
22
- */
23
- get isAppRun(): boolean;
24
- /**
25
- * 是否为应用前端运行时生产环境包含测试环境
21
+ * 是否为生产环境
26
22
  */
27
23
  get isAppProd(): boolean;
28
- /**
29
- * 是否为应用前端运行时预览环境
30
- */
31
- get isAppPreview(): boolean;
32
- /**
33
- * 是否为dev环境单应用
34
- */
35
- get isDevSingleEnv(): boolean;
36
24
  /**
37
25
  * 是否为测试环境
38
26
  */
@@ -8,7 +8,9 @@ export declare enum EnvironmentType {
8
8
  /** 测试环境 */
9
9
  TEST = "test",
10
10
  /** 生产环境 */
11
- PROD = "prod"
11
+ PROD = "prod",
12
+ /** 沙箱环境 */
13
+ SANDBOX = "sbx"
12
14
  }
13
15
  /**
14
16
  * 环境管理器接口
@@ -16,14 +18,8 @@ export declare enum EnvironmentType {
16
18
  export interface IEnvironmentManager {
17
19
  /** 是否为安卓混合模式下运行 */
18
20
  readonly isAndroid: boolean;
19
- /** 是否为应用前端运行时 */
20
- readonly isAppRun: boolean;
21
- /** 是否为应用前端运行时生产环境 */
21
+ /** 是否为生产环境 */
22
22
  readonly isAppProd: boolean;
23
- /** 是否为应用前端运行时预览环境 */
24
- readonly isAppPreview: boolean;
25
- /** 是否为dev环境单应用 */
26
- readonly isDevSingleEnv: boolean;
27
23
  /** 是否为测试环境 */
28
24
  readonly isTestEnv: boolean;
29
25
  /** 平台地址 */
@@ -32,6 +28,8 @@ export interface IEnvironmentManager {
32
28
  readonly isHostMode: boolean;
33
29
  /** 测试环境租户数据 */
34
30
  readonly testTenantData: Tenant;
31
+ /** 是否为沙箱环境 */
32
+ isSandbox: boolean;
35
33
  /**
36
34
  * 检测是否为测试环境
37
35
  * @param loadTenant 是否加载租户信息
@@ -9,6 +9,8 @@ var EnvironmentType = /* @__PURE__ */ function(EnvironmentType) {
9
9
  EnvironmentType["TEST"] = "test";
10
10
  /** 生产环境 */
11
11
  EnvironmentType["PROD"] = "prod";
12
+ /** 沙箱环境 */
13
+ EnvironmentType["SANDBOX"] = "sbx";
12
14
  return EnvironmentType;
13
15
  }({});
14
16
  //#endregion
@@ -1,5 +1,6 @@
1
1
  import { EnvironmentType } from "./env-manager.interface.mjs";
2
- import { APP_PREVIEW_PATH_REG, APP_PROD_PATH_REG, APP_RUN_PATH_REG, DEV_SINGLE_PATH_REG, HOST_REG, IP_REG, SANDBOX_PATH_REG, TEST_SINGLE_PATH_REG } from "./env-manager.const.mjs";
2
+ import { ENV } from "../../store/session-store.mjs";
3
+ import { HOST_REG, IP_REG } from "./env-manager.const.mjs";
3
4
  //#region src/modules/env-manager/env-manager.ts
4
5
  /**
5
6
  * 环境管理器
@@ -21,37 +22,19 @@ var EnvironmentManager = class {
21
22
  }
22
23
  /**安卓混合开发模式下 */
23
24
  get isAndroid() {
24
- return window.location.origin === "file://";
25
+ return window.__GCT_ANDROID__ === true;
25
26
  }
26
27
  /**
27
- * 是否为应用前端运行时
28
- */
29
- get isAppRun() {
30
- return APP_RUN_PATH_REG.test(location.pathname);
31
- }
32
- /**
33
- * 是否为应用前端运行时生产环境包含测试环境
28
+ * 是否为生产环境
34
29
  */
35
30
  get isAppProd() {
36
- return APP_PROD_PATH_REG.test(location.pathname);
37
- }
38
- /**
39
- * 是否为应用前端运行时预览环境
40
- */
41
- get isAppPreview() {
42
- return APP_PREVIEW_PATH_REG.test(location.pathname);
43
- }
44
- /**
45
- * 是否为dev环境单应用
46
- */
47
- get isDevSingleEnv() {
48
- return DEV_SINGLE_PATH_REG.test(location.pathname);
31
+ return _gct.store.context.env === EnvironmentType.PROD;
49
32
  }
50
33
  /**
51
34
  * 是否为测试环境
52
35
  */
53
36
  get isTestEnv() {
54
- return TEST_SINGLE_PATH_REG.test(location.pathname) || this._testEnv;
37
+ return this._testEnv || _gct.store.context.env === EnvironmentType.TEST;
55
38
  }
56
39
  /**
57
40
  * 平台地址
@@ -75,7 +58,7 @@ var EnvironmentManager = class {
75
58
  * 是否为沙箱环境
76
59
  */
77
60
  get isSandbox() {
78
- return SANDBOX_PATH_REG.test(location.pathname);
61
+ return _gct.store.context.env === EnvironmentType.SANDBOX;
79
62
  }
80
63
  /**
81
64
  * 检测是否为测试环境
@@ -100,15 +83,17 @@ var EnvironmentManager = class {
100
83
  }
101
84
  }
102
85
  }
86
+ if (this._testEnv) await _gct.store.setContext({ env: EnvironmentType.TEST });
103
87
  }
104
88
  /**
105
89
  * 获取当前环境类型
106
90
  * @returns 环境类型
107
91
  */
108
92
  getEnv() {
93
+ if (ENV.value) return ENV.value;
109
94
  if (this.isTestEnv) return EnvironmentType.TEST;
110
- else if (this.isAppProd || this.isAndroid) return EnvironmentType.PROD;
111
- else return EnvironmentType.DEV;
95
+ if (_gct.store.context.env) return _gct.store.context.env;
96
+ return EnvironmentType.DEV;
112
97
  }
113
98
  };
114
99
  //#endregion
@@ -0,0 +1,5 @@
1
+ import { EnvironmentType } from './env-manager.interface';
2
+ /**
3
+ * 校验并规范化环境类型
4
+ */
5
+ export declare function normalizeEnv(env: unknown): EnvironmentType | undefined;
@@ -0,0 +1,11 @@
1
+ import { EnvironmentType } from "./env-manager.interface.mjs";
2
+ //#region src/modules/env-manager/env-manager.util.ts
3
+ var ENV_VALUES = new Set(Object.values(EnvironmentType));
4
+ /**
5
+ * 校验并规范化环境类型
6
+ */
7
+ function normalizeEnv(env) {
8
+ if (typeof env === "string" && ENV_VALUES.has(env)) return env;
9
+ }
10
+ //#endregion
11
+ export { normalizeEnv };
@@ -1,3 +1,4 @@
1
1
  export * from './env-manager.interface';
2
2
  export * from './env-manager.const';
3
+ export * from './env-manager.util';
3
4
  export { EnvironmentManager } from './env-manager';
@@ -0,0 +1,4 @@
1
+ import "./env-manager.interface.mjs";
2
+ import "./env-manager.util.mjs";
3
+ import "./env-manager.const.mjs";
4
+ import "./env-manager.mjs";
@@ -21,5 +21,7 @@ export declare enum LoginTypeEnum {
21
21
  /** 飞书 */
22
22
  FEISHU = "FEISHU",
23
23
  /** 企业微信 */
24
- QIYEWEIXIN = "QIYEWEIXIN"
24
+ QIYEWEIXIN = "QIYEWEIXIN",
25
+ /** 微软 */
26
+ MICROSOFT = "MICROSOFT"
25
27
  }
@@ -24,6 +24,8 @@ var LoginTypeEnum = /* @__PURE__ */ function(LoginTypeEnum) {
24
24
  LoginTypeEnum["FEISHU"] = "FEISHU";
25
25
  /** 企业微信 */
26
26
  LoginTypeEnum["QIYEWEIXIN"] = "QIYEWEIXIN";
27
+ /** 微软 */
28
+ LoginTypeEnum["MICROSOFT"] = "MICROSOFT";
27
29
  return LoginTypeEnum;
28
30
  }({});
29
31
  //#endregion