@gct-paas/core 0.1.5-dev.1 → 0.1.5-dev.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.
Files changed (79) hide show
  1. package/dist/index.esm.min.js +1 -1
  2. package/es/enums/app-designer/index.d.ts +11 -0
  3. package/es/enums/app-designer/index.mjs +14 -1
  4. package/es/enums/appEnum.d.ts +8 -0
  5. package/es/enums/appEnum.mjs +10 -1
  6. package/es/enums/page-designer/designer.d.ts +13 -13
  7. package/es/enums/page-designer/widget.d.ts +2 -2
  8. package/es/global/gct/gct.d.ts +108 -107
  9. package/es/hooks/index.d.ts +1 -0
  10. package/es/hooks/index.mjs +1 -0
  11. package/es/hooks/useFile.d.ts +4 -0
  12. package/es/hooks/useFile.mjs +22 -0
  13. package/es/index.mjs +14 -6
  14. package/es/interface/i-kit-plugin-module/i-kit-plugin-module.d.ts +23 -0
  15. package/es/interface/i-pinia-action/i-global-actions.d.ts +3 -0
  16. package/es/interface/i-popover-options/i-popover-options.d.ts +98 -0
  17. package/es/interface/index.d.ts +3 -2
  18. package/es/interface/index.mjs +1 -0
  19. package/es/interface/model-designer/entity.d.ts +87 -79
  20. package/es/interface/model-designer/serial.d.ts +22 -0
  21. package/es/interface/model-designer/serial.mjs +49 -0
  22. package/es/interface/open-util/i-app-full-screen-container-options/i-app-full-screen-container-options.d.ts +26 -0
  23. package/es/interface/open-util/i-overlay-controller/i-overlay-controller.d.ts +52 -0
  24. package/es/interface/open-util/i-overlay-popover-container/i-overlay-popover-container.d.ts +21 -0
  25. package/es/interface/open-util/index.d.ts +3 -1
  26. package/es/locale/index.d.ts +26 -1
  27. package/es/locale/index.mjs +51 -3
  28. package/es/locale/sys/model.d.ts +5 -0
  29. package/es/locale/sys.d.ts +5 -0
  30. package/es/modules/mqtt/enums/mqtt-status.enum.d.ts +1 -0
  31. package/es/modules/mqtt/enums/mqtt-status.enum.mjs +2 -1
  32. package/es/modules/mqtt/mqtt-manager.d.ts +1 -1
  33. package/es/modules/mqtt/mqtt-manager.mjs +2 -1
  34. package/es/modules/platform-config/store.d.ts +106 -106
  35. package/es/modules/platform-config/store.mjs +0 -1
  36. package/es/modules/platform-config/useSecuritySetting.d.ts +1 -1
  37. package/es/modules/user-stores/store/tenant.store.d.ts +6 -8
  38. package/es/modules/user-stores/store/tenant.store.mjs +12 -14
  39. package/es/modules/user-stores/store/user.store.d.ts +11 -2
  40. package/es/modules/user-stores/store/user.store.mjs +15 -4
  41. package/es/modules/user-stores/types/tenant.d.ts +7 -1
  42. package/es/router/index.mjs +2 -2
  43. package/es/setup-app.mjs +6 -2
  44. package/es/store/global-store.mjs +3 -0
  45. package/es/store/index.d.ts +1 -0
  46. package/es/store/index.mjs +1 -0
  47. package/es/store/session-store.d.ts +7 -0
  48. package/es/store/session-store.mjs +7 -0
  49. package/es/store/storage-store.d.ts +2 -0
  50. package/es/store/storage-store.mjs +3 -2
  51. package/es/types/index.d.ts +0 -1
  52. package/es/utils/file/download.d.ts +1 -1
  53. package/es/utils/file/parser.d.ts +1 -1
  54. package/es/utils/i18n/index.mjs +3 -0
  55. package/es/utils/index.d.ts +3 -0
  56. package/es/utils/index.mjs +4 -0
  57. package/es/utils/kit-pkg-util/kit-pkg-util.d.ts +34 -13
  58. package/es/utils/kit-pkg-util/kit-pkg-util.mjs +51 -40
  59. package/es/utils/openUtil/index.d.ts +1 -0
  60. package/es/utils/openUtil/index.mjs +1 -0
  61. package/es/utils/openUtil/overlay-popover-container/overlay-popover-container.d.ts +15 -0
  62. package/es/utils/openUtil/overlay-popover-container/overlay-popover-container.mjs +19 -0
  63. package/es/utils/plugin-pkg-util/plugin-pkg-util.d.ts +3 -3
  64. package/es/utils/plugin-pkg-util/plugin-pkg-util.mjs +1 -1
  65. package/es/utils/script-loader/script-loader.d.ts +62 -0
  66. package/es/utils/script-loader/script-loader.mjs +92 -0
  67. package/es/utils/style/index.d.ts +8 -0
  68. package/es/utils/style/index.mjs +67 -1
  69. package/es/utils/text-measure/text-measure.d.ts +141 -0
  70. package/es/utils/text-measure/text-measure.mjs +191 -0
  71. package/es/utils/tools/tools.d.ts +1 -1
  72. package/es/utils/uploader/uploader.mjs +3 -5
  73. package/es/utils/util.d.ts +1 -0
  74. package/es/utils/util.mjs +9 -1
  75. package/es/utils/vue-component-code.d.ts +8 -0
  76. package/es/utils/vue-component-code.mjs +37 -0
  77. package/package.json +20 -20
  78. package/es/interface/i-import-style-map/i-import-style-map.d.ts +0 -15
  79. package/es/interface/i-kit-info/i-kit-info.d.ts +0 -20
@@ -0,0 +1,98 @@
1
+ export declare type Alignment = 'start' | 'end';
2
+ export declare type Side = 'top' | 'right' | 'bottom' | 'left';
3
+ export declare type AlignedPlacement = `${Side}-${Alignment}`;
4
+ export declare type Placement = Side | AlignedPlacement;
5
+ interface AxesOffsets {
6
+ /**
7
+ * 浮动元素与参考元素之间的间距
8
+ *
9
+ * @author lxm
10
+ * @date 2022-11-16 18:11:27
11
+ * @type {number}
12
+ */
13
+ mainAxis?: number;
14
+ /**
15
+ * 浮动元素与参考元素之间的偏移量,与mainAxis垂直
16
+ *
17
+ * @author lxm
18
+ * @date 2022-11-16 18:11:49
19
+ * @type {number}
20
+ */
21
+ crossAxis?: number;
22
+ alignmentAxis?: number | null;
23
+ }
24
+ /**
25
+ * 飘窗参数
26
+ *
27
+ * @author chitanda
28
+ * @date 2022-11-08 16:11:37
29
+ * @export
30
+ * @interface IPopoverOptions
31
+ */
32
+ export interface IPopoverOptions<O = unknown> {
33
+ /**
34
+ * 飘窗组件类名
35
+ *
36
+ * @type {string}
37
+ */
38
+ className?: string;
39
+ /**
40
+ * 宽度 数字0-100的时候算百分比,100以上算像素px,字符串原样设置
41
+ *
42
+ * @author lxm
43
+ * @date 2022-09-12 20:09:20
44
+ * @type {string | number}
45
+ */
46
+ width?: string | number;
47
+ /**
48
+ * 高度 数字0-100的时候算百分比,100以上算像素px,字符串原样设置
49
+ *
50
+ * @author lxm
51
+ * @date 2022-09-12 20:09:22
52
+ * @type {string | number}
53
+ */
54
+ height?: string | number;
55
+ maxHeight?: string | number;
56
+ /**
57
+ * 展示方向
58
+ *
59
+ * @author chitanda
60
+ * @date 2022-11-08 16:11:41
61
+ * @type {Placement}
62
+ */
63
+ placement?: Placement;
64
+ /**
65
+ * 是否自动关闭
66
+ *
67
+ * @default true
68
+ * @author chitanda
69
+ * @date 2022-11-08 16:11:43
70
+ * @type {boolean}
71
+ */
72
+ autoClose?: boolean;
73
+ /**
74
+ * offset的参数
75
+ *
76
+ * @author lxm
77
+ * @date 2022-11-16 18:11:13
78
+ * @type {(AxesOffsets | number)}
79
+ */
80
+ offsetOpts?: AxesOffsets | number;
81
+ /**
82
+ * 不显示箭头
83
+ *
84
+ * @author lxm
85
+ * @date 2022-11-16 20:11:58
86
+ * @type {boolean}
87
+ */
88
+ noArrow?: boolean;
89
+ /**
90
+ * 原始飘窗参数
91
+ *
92
+ * @author chitanda
93
+ * @date 2024-01-26 09:01:20
94
+ * @type {O}
95
+ */
96
+ options?: O;
97
+ }
98
+ export {};
@@ -5,12 +5,13 @@ export type { IDictionaryItem } from './i-dictionary/i-dictionary-item';
5
5
  export type { IFieldCodeChain } from './i-field-code-chain/i-field-code-chain';
6
6
  export type { GlobalVar } from './i-global-var/i-global-var';
7
7
  export type { IMobileHomeMenuItem } from './i-mobile-home-menu-item/i-mobile-home-menu-item';
8
- export type { IStyleIMportMap } from './i-import-style-map/i-import-style-map';
9
- export type { IKitInfo } from './i-kit-info/i-kit-info';
8
+ export type { IPluginKitModule } from './i-kit-plugin-module/i-kit-plugin-module';
10
9
  export type { IGlobalActions } from './i-pinia-action/i-global-actions';
11
10
  export type { IGlobalGetters } from './i-pinia-getter/i-global-getters';
12
11
  export type { IGlobalState, emptyDisplayType, } from './i-pinia-state/i-global-state';
12
+ export type { IPopoverOptions } from './i-popover-options/i-popover-options';
13
13
  export type * from './model-designer/entity';
14
+ export * from './model-designer/serial';
14
15
  export type * from './open-util';
15
16
  export type * from './provider';
16
17
  export type * from './style';
@@ -0,0 +1 @@
1
+ import "./model-designer/serial.mjs";
@@ -1,4 +1,78 @@
1
- import { FIELD_TYPE, FieldDefaultValueTypeEnum, FieldSysVarDefaultValueEnum, UniqueConstraintType } from '../../enums';
1
+ import { EntityFormulaReturnTypeEnum, FIELD_TYPE, FieldDefaultValueTypeEnum, FieldSysVarDefaultValueEnum, UniqueConstraintType } from '../../enums';
2
+ export interface UniqueConstraint {
3
+ type: UniqueConstraintType;
4
+ fieldKeys?: string[];
5
+ }
6
+ export interface DefaultValueConfig {
7
+ type: FieldDefaultValueTypeEnum;
8
+ value?: string | number | boolean | FieldSysVarDefaultValueEnum;
9
+ name?: string;
10
+ }
11
+ export interface DisplayRuleConfig {
12
+ exp: string;
13
+ exprInEditor: string;
14
+ relationColumns: string[];
15
+ }
16
+ export interface ExpConfig {
17
+ exp: string;
18
+ expression: string;
19
+ relationColumns: string[];
20
+ nodes?: IObject[];
21
+ designJson?: IObject;
22
+ fieldKey?: string;
23
+ }
24
+ export interface AggConfig {
25
+ /** 汇总类型 */
26
+ aggFunc: string;
27
+ /** 汇总字段名 */
28
+ relationColumns: string[];
29
+ }
30
+ export interface RuleConfigDetail {
31
+ nodes: IObject[];
32
+ designJson: IObject;
33
+ fieldKey: string;
34
+ }
35
+ export interface CustomEnumConfig {
36
+ enabled: number;
37
+ values: string[];
38
+ }
39
+ export interface FormulaConfig {
40
+ exp: string;
41
+ expression: string;
42
+ showQrCode?: boolean;
43
+ digits?: number;
44
+ truelabel?: string;
45
+ falselabel?: string;
46
+ }
47
+ export interface FieldSpecificConfig {
48
+ minValue?: number;
49
+ maxValue?: number;
50
+ digits?: number;
51
+ true?: string;
52
+ false?: string;
53
+ /** 上传最大数量 */
54
+ maxNumber?: number;
55
+ /** 单文件大小限制 */
56
+ fileSize?: number;
57
+ /** 允许的文件类型 */
58
+ fileTypes?: string[];
59
+ /** 四舍五入规则 */
60
+ rulesForRounding?: number;
61
+ /** 流水号规则类型 */
62
+ ruleType?: string;
63
+ /** 显示规则 (人员、模型应用) */
64
+ displayRule?: DisplayRuleConfig;
65
+ ruleConfig?: RuleConfigDetail;
66
+ /** 返回值类型映射 */
67
+ mappingType?: EntityFormulaReturnTypeEnum;
68
+ expType?: string;
69
+ /** 是否实时计算 */
70
+ expRealCompute?: boolean;
71
+ expConfig?: ExpConfig;
72
+ formulaConfig?: FormulaConfig;
73
+ aggConfig?: AggConfig;
74
+ customEnumConfig?: CustomEnumConfig;
75
+ }
2
76
  export interface FieldFormState {
3
77
  id?: string;
4
78
  modelKey: string;
@@ -7,102 +81,36 @@ export interface FieldFormState {
7
81
  type: FIELD_TYPE;
8
82
  required: number;
9
83
  parentField?: number;
10
- uniqueConstraint: {
11
- type: UniqueConstraintType;
12
- fieldKeys?: string[];
13
- };
14
- /** 默认值 */
15
- defaultValue: {
16
- type: FieldDefaultValueTypeEnum;
17
- value?: string | number | boolean | FieldSysVarDefaultValueEnum;
18
- name?: string;
19
- };
20
84
  description: string;
85
+ uniqueConstraint: UniqueConstraint;
86
+ /** 默认值配置 */
87
+ defaultValue: DefaultValueConfig;
21
88
  /** 字段特性配置 */
22
- specificConfig: {
23
- /**数值/长度限制 */
24
- minValue?: number;
25
- /**数值/长度限制 */
26
- maxValue?: number;
27
- /**数值精度 */
28
- digits?: number;
29
- /** 布尔 true 文案 */
30
- true?: string;
31
- /** 布尔 false 文案 */
32
- false?: string;
33
- /** 上传数量 */
34
- maxNumber?: number;
35
- /** 文件大小 */
36
- fileSize?: number;
37
- /** 文件类型 */
38
- fileTypes?: string[];
39
- ruleType?: string;
40
- /** 显示规则 人员、模型应用 */
41
- displayRule?: {
42
- exp: string;
43
- exprInEditor: string;
44
- relationColumns: string[];
45
- };
46
- /**
47
- * 公式新增参数
48
- * 2024年11月21日
49
- */
50
- expType?: string;
51
- /**实时计算 */
52
- expRealCompute?: boolean;
53
- /** 公式配置 */
54
- expConfig?: unknown | {
55
- exp: string;
56
- expression: string;
57
- relationColumns: string[];
58
- };
59
- /** 汇总配置 */
60
- aggConfig?: {
61
- /** 汇总类型 */
62
- aggFunc: string;
63
- /** 汇总字段名 */
64
- relationColumns: string[];
65
- };
66
- ruleConfig?: unknown | {
67
- nodes: IObject[];
68
- designJson: IObject;
69
- fieldKey: string;
70
- };
71
- [k: string]: unknown;
72
- /**枚举 */
73
- customEnumConfig?: {
74
- enabled: number;
75
- values: string[];
76
- };
77
- /**前端公式 */
78
- formulaConfig?: {
79
- exp: string;
80
- expression: string;
81
- showQrCode?: boolean;
82
- digits?: number;
83
- truelabel?: string;
84
- falselabel?: string;
85
- };
86
- };
87
- /**关联信息KEY 如:枚举/主子/关联 */
89
+ specificConfig: FieldSpecificConfig;
90
+ /** 关联信息KEY 如:枚举/主子/关联 */
88
91
  bindInfo?: string;
89
92
  /** 主子/引用关联模型类型 */
90
93
  refModelType?: string;
94
+ /** 多语言配置 */
91
95
  i18nConfig?: string;
92
96
  /**
93
- * 普通数据类型 值为fieldType
97
+ * 普通数据类型值为 fieldType
94
98
  * 映射类型(公式、函数等实际映射的类型)
95
99
  */
96
100
  mappingType?: string;
97
- /** 主子关联 绑定子模型字段 */
101
+ /** 主子关联:绑定子模型字段 */
98
102
  bindFieldKey?: string;
99
103
  /** 在线表单新建字段中的子模型key */
100
104
  subModelKey?: string;
105
+ [key: string]: any;
101
106
  }
102
107
  export interface SpecificConfig {
108
+ /** 公式的表达式(key) */
103
109
  exp?: string;
104
110
  expression?: string;
111
+ /** 公式/汇总 关联的字段集合 */
105
112
  relationColumns?: IObject[];
113
+ /** 汇总字段的枚举 */
106
114
  aggFunc?: string;
107
115
  bindField?: string;
108
116
  refModelType?: string;
@@ -0,0 +1,22 @@
1
+ import { ResetConditionEnum, TypeEnum } from '../../enums';
2
+ export interface SerialConfigType {
3
+ value: string;
4
+ modelKey: string;
5
+ reset: boolean;
6
+ pattern: string;
7
+ patternType: string;
8
+ condition: ResetConditionEnum;
9
+ minLength: number;
10
+ from: number;
11
+ padding: string;
12
+ step: number;
13
+ upper?: number;
14
+ to: number;
15
+ descName?: string;
16
+ }
17
+ export interface SerialListType {
18
+ id: string;
19
+ type: TypeEnum;
20
+ config: Partial<SerialConfigType>;
21
+ }
22
+ export declare const getSeriesList: () => Promise<SerialListType[]>;
@@ -0,0 +1,49 @@
1
+ import { ModelFieldEnum, PatternEnum, ResetConditionEnum, TypeEnum } from "../../enums/app-designer/index.mjs";
2
+ import "../../enums/index.mjs";
3
+ //#region src/interface/model-designer/serial.ts
4
+ var seriesNumberData = [
5
+ {
6
+ id: "",
7
+ type: TypeEnum.FIXED,
8
+ config: { value: "" }
9
+ },
10
+ {
11
+ id: "",
12
+ type: TypeEnum.PLACEHOLDER,
13
+ config: {
14
+ modelKey: ModelFieldEnum.SEX,
15
+ reset: true
16
+ }
17
+ },
18
+ {
19
+ id: "",
20
+ type: TypeEnum.DATE,
21
+ config: {
22
+ pattern: PatternEnum.yyyyMMdd,
23
+ reset: true,
24
+ condition: ResetConditionEnum.YEAR
25
+ }
26
+ },
27
+ {
28
+ id: "",
29
+ type: TypeEnum.INCREASE,
30
+ config: {
31
+ minLength: 10,
32
+ from: 1,
33
+ padding: "0"
34
+ }
35
+ },
36
+ {
37
+ id: "",
38
+ type: TypeEnum.LETTER,
39
+ config: { upper: 0 }
40
+ }
41
+ ];
42
+ var getSeriesList = () => {
43
+ return new Promise((resolve, reject) => {
44
+ if (seriesNumberData) resolve(seriesNumberData);
45
+ else reject("没有值");
46
+ });
47
+ };
48
+ //#endregion
49
+ export { getSeriesList };
@@ -0,0 +1,26 @@
1
+ /**
2
+ * 全屏模态框容器
3
+ *
4
+ * @author zhanghanrui
5
+ * @date 2024-07-04 15:07:12
6
+ * @export
7
+ * @interface IAppFullScreenContainerOptions
8
+ */
9
+ export interface IAppFullScreenContainerOptions {
10
+ /**
11
+ * 是否显示回退按钮
12
+ *
13
+ * @author zhanghanrui
14
+ * @date 2024-07-04 15:07:00
15
+ * @type {boolean}
16
+ */
17
+ backButton?: boolean;
18
+ /**
19
+ * 自定义容器样式
20
+ *
21
+ * @author zhanghanrui
22
+ * @date 2024-07-04 15:07:23
23
+ * @type {string}
24
+ */
25
+ containerClass?: string;
26
+ }
@@ -1,6 +1,11 @@
1
+ import { ComputePositionConfig } from '@floating-ui/dom';
1
2
  import { IOverlayContainer } from '../i-overlay-container/i-overlay-container';
2
3
  import { IModalOptions } from '../i-modal-options/i-modal-options';
3
4
  import { IModalData } from '../i-modal-data/i-modal-data';
5
+ import { IPopoverOptions } from '../../i-popover-options/i-popover-options';
6
+ import { IOverlayPopoverContainer } from '../i-overlay-popover-container/i-overlay-popover-container';
7
+ import { IAppFullScreenContainerOptions } from '../i-app-full-screen-container-options/i-app-full-screen-container-options';
8
+ export type FloatingUIConfig = Partial<ComputePositionConfig>;
4
9
  /**
5
10
  * 全局呈现容器控制器
6
11
  *
@@ -33,4 +38,51 @@ export interface IOverlayController {
33
38
  * @return {*} {IOverlayContainer}
34
39
  */
35
40
  createModal(component: unknown, props?: IParams, opts?: IModalOptions): IOverlayContainer;
41
+ /**
42
+ * 飘窗打开组件
43
+ *
44
+ * @author zhanghanrui
45
+ * @date 2024-04-08 09:04:23
46
+ * @template T
47
+ * @param {HTMLElement} element 飘窗目标元素
48
+ * @param {unknown} component
49
+ * @param {IParams} [props]
50
+ * @param {IPopoverOptions<FloatingUIConfig>} [opts]
51
+ * @return {*} {Promise<T>}
52
+ */
53
+ popover<T = void>(element: HTMLElement, component: unknown, props?: IParams, opts?: IPopoverOptions<FloatingUIConfig>): Promise<T>;
54
+ /**
55
+ * 创建全局飘窗容器
56
+ *
57
+ * @author zhanghanrui
58
+ * @date 2024-04-08 09:04:58
59
+ * @param {unknown} component
60
+ * @param {IParams} [props]
61
+ * @param {IPopoverOptions<FloatingUIConfig>} [opts]
62
+ * @return {*} {IOverlayPopoverContainer}
63
+ */
64
+ createPopover(component: unknown, props?: IParams, opts?: IPopoverOptions<FloatingUIConfig>): IOverlayPopoverContainer;
65
+ /**
66
+ * 全屏容器打开组件
67
+ *
68
+ * @author zhanghanrui
69
+ * @date 2024-07-04 15:07:29
70
+ * @template T
71
+ * @param {unknown} component
72
+ * @param {IParams} [props]
73
+ * @param {IAppFullScreenContainerOptions} [opts]
74
+ * @return {*} {Promise<T>}
75
+ */
76
+ fullScreen<T = void>(component: unknown, props?: IParams, opts?: IAppFullScreenContainerOptions): Promise<T>;
77
+ /**
78
+ * 创建全局全屏容器
79
+ *
80
+ * @author zhanghanrui
81
+ * @date 2024-07-04 15:07:02
82
+ * @param {unknown} component
83
+ * @param {IParams} [props]
84
+ * @param {IAppFullScreenContainerOptions} [opts]
85
+ * @return {*} {IOverlayContainer}
86
+ */
87
+ createFullScreen(component: unknown, props?: IParams, opts?: IAppFullScreenContainerOptions): IOverlayContainer;
36
88
  }
@@ -0,0 +1,21 @@
1
+ import { IOverlayContainer } from '../i-overlay-container/i-overlay-container';
2
+ /**
3
+ * 飘窗容器
4
+ *
5
+ * @author chitanda
6
+ * @date 2022-11-09 14:11:39
7
+ * @export
8
+ * @interface IOverlayPopoverContainer
9
+ * @extends {IOverlayContainer}
10
+ */
11
+ export interface IOverlayPopoverContainer extends IOverlayContainer {
12
+ /**
13
+ * 展示飘窗容器
14
+ *
15
+ * @author chitanda
16
+ * @date 2022-11-09 14:11:47
17
+ * @param {HTMLElement} el
18
+ * @return {*} {Promise<void>}
19
+ */
20
+ present(el?: HTMLElement): Promise<void>;
21
+ }
@@ -1,7 +1,9 @@
1
+ export type { IAppFullScreenContainerOptions } from './i-app-full-screen-container-options/i-app-full-screen-container-options';
1
2
  export type { IMessageParams, IMessageUtil, } from './i-message-util/i-message-util';
2
3
  export type { IModal } from './i-modal/i-modal';
3
4
  export type { IModalData } from './i-modal-data/i-modal-data';
4
5
  export type { IModalOptions } from './i-modal-options/i-modal-options';
5
6
  export type { IOpenWindowOptions } from './i-open-window-options/i-open-window-options';
6
7
  export type { IOverlayContainer } from './i-overlay-container/i-overlay-container';
7
- export type { IOverlayController } from './i-overlay-controller/i-overlay-controller';
8
+ export type { FloatingUIConfig, IOverlayController, } from './i-overlay-controller/i-overlay-controller';
9
+ export type { IOverlayPopoverContainer } from './i-overlay-popover-container/i-overlay-popover-container';
@@ -2,18 +2,37 @@ import { I18n } from 'vue-i18n';
2
2
  import { App } from 'vue';
3
3
  import { I18nConfigResponse } from '@gct-paas/api/platform';
4
4
  type localeItem = Pick<I18nConfigResponse, 'id' | 'configured' | 'defaultLanguage' | 'language' | 'languageTag' | 'state'>;
5
+ type ILocaleMessages = Record<string, string>;
6
+ type ILocaleDeclarations = Record<string, ILocaleMessages>;
5
7
  export declare class LocaleUtil {
6
8
  localeList: localeItem[];
7
9
  i18n: I18n;
8
10
  get locale(): string;
9
11
  get enableLocaleList(): localeItem[];
10
12
  changeLang(lang: string): Promise<void>;
13
+ /**
14
+ * 动态增量新增多语言声明。
15
+ * 传入语言标识与文案键值映射后,会与现有语言包进行增量合并。
16
+ *
17
+ * @param {ILocaleDeclarations} declarations
18
+ */
19
+ addLocaleDeclarations(declarations: ILocaleDeclarations): void;
20
+ /**
21
+ * 动态增量新增单语言声明。
22
+ * 仅对指定语言进行文案合并,适用于按需加载场景。
23
+ *
24
+ * @param {string} locale 语言标识
25
+ * @param {ILocaleMessages} messages 文案键值映射
26
+ */
27
+ addLocaleMessages(locale: string, messages: ILocaleMessages): void;
28
+ /**只加载应用专用i18n JSON */
29
+ initAppJson(): Promise<void>;
11
30
  init(): Promise<void>;
12
31
  /**加载应用国际化json */
13
32
  protected loadI18nJson(): Promise<void>;
14
33
  /**加载语言列表 */
15
34
  protected loadLocales(): Promise<void>;
16
- protected loadMessages(url: string, locale?: string): Promise<void>;
35
+ protected loadMessages(url?: string, locale?: string): Promise<void>;
17
36
  getMessageUrl(payload: {
18
37
  locale: string;
19
38
  } | {
@@ -22,6 +41,12 @@ export declare class LocaleUtil {
22
41
  env: 'dev' | 'test' | 'prod';
23
42
  branch?: string;
24
43
  }): string;
44
+ /**
45
+ * 设置 HTML 根元素的 lang 属性,供浏览器、辅助技术识别当前语言
46
+ *
47
+ * @param locale 语言标识,如 zh-CN、en
48
+ */
49
+ private setHtmlPageLang;
25
50
  }
26
51
  export declare function setupI18n(app: App): void;
27
52
  export {};
@@ -1,6 +1,7 @@
1
1
  import { globalRefStorage } from "../store/storage-store.mjs";
2
2
  import "../store/index.mjs";
3
3
  import { createI18n } from "vue-i18n";
4
+ import { HttpUtil } from "@gct-paas/api";
4
5
  //#region src/locale/index.ts
5
6
  var LocaleUtil = class {
6
7
  localeList = [];
@@ -23,8 +24,41 @@ var LocaleUtil = class {
23
24
  }
24
25
  async changeLang(lang) {
25
26
  globalRefStorage.value.lang = lang;
27
+ this.i18n.global.locale.value = lang;
28
+ this.setHtmlPageLang(lang);
26
29
  await this.loadI18nJson();
27
30
  }
31
+ /**
32
+ * 动态增量新增多语言声明。
33
+ * 传入语言标识与文案键值映射后,会与现有语言包进行增量合并。
34
+ *
35
+ * @param {ILocaleDeclarations} declarations
36
+ */
37
+ addLocaleDeclarations(declarations) {
38
+ Object.entries(declarations).forEach(([locale, messages]) => {
39
+ this.i18n.global.mergeLocaleMessage(locale, messages);
40
+ });
41
+ }
42
+ /**
43
+ * 动态增量新增单语言声明。
44
+ * 仅对指定语言进行文案合并,适用于按需加载场景。
45
+ *
46
+ * @param {string} locale 语言标识
47
+ * @param {ILocaleMessages} messages 文案键值映射
48
+ */
49
+ addLocaleMessages(locale, messages) {
50
+ this.addLocaleDeclarations({ [locale]: messages });
51
+ }
52
+ /**只加载应用专用i18n JSON */
53
+ async initAppJson() {
54
+ const app_platformUrl = this.getMessageUrl({
55
+ locale: this.locale,
56
+ app: _gct.store.context.aid,
57
+ env: _gct.env.getEnv(),
58
+ branch: _gct.store.context.bid
59
+ });
60
+ await this.loadMessages(app_platformUrl);
61
+ }
28
62
  async init() {
29
63
  await this.loadLocales();
30
64
  await this.loadI18nJson();
@@ -32,12 +66,12 @@ var LocaleUtil = class {
32
66
  /**加载应用国际化json */
33
67
  async loadI18nJson() {
34
68
  const platformUrl = this.getMessageUrl({ locale: this.locale });
35
- const app_platformUrl = this.getMessageUrl({
69
+ const app_platformUrl = _gct.store.context.aid ? this.getMessageUrl({
36
70
  locale: this.locale,
37
71
  app: _gct.store.context.aid,
38
72
  env: _gct.env.getEnv(),
39
73
  branch: _gct.store.context.bid
40
- });
74
+ }) : void 0;
41
75
  await Promise.all([this.loadMessages(platformUrl), this.loadMessages(app_platformUrl)]);
42
76
  }
43
77
  /**加载语言列表 */
@@ -54,9 +88,15 @@ var LocaleUtil = class {
54
88
  }).filter((i) => i.configured === 1 && i.state === 1);
55
89
  const defaultItem = this.localeList.find((item) => !!item.defaultLanguage);
56
90
  globalRefStorage.value.lang = (globalRefStorage.value.lang ?? defaultItem?.languageTag) || "zh-CN";
91
+ this.i18n.global.locale.value = globalRefStorage.value.lang;
92
+ this.setHtmlPageLang(globalRefStorage.value.lang);
57
93
  }
58
94
  async loadMessages(url, locale = this.locale) {
59
- const messages = (await (await fetch(url)).text()).split("\n").reduce((acc, item) => {
95
+ if (!url) return;
96
+ const messages = (await HttpUtil.get(url, {}, {}, {}, {
97
+ headers: { "Content-Type": void 0 },
98
+ nativeData: true
99
+ })).split("\n").reduce((acc, item) => {
60
100
  const [key, ...value] = item.split(":");
61
101
  acc[key] = value.join(":");
62
102
  return acc;
@@ -70,6 +110,14 @@ var LocaleUtil = class {
70
110
  }
71
111
  return `/minio/locale-js/${payload.locale}__platform__.json`;
72
112
  }
113
+ /**
114
+ * 设置 HTML 根元素的 lang 属性,供浏览器、辅助技术识别当前语言
115
+ *
116
+ * @param locale 语言标识,如 zh-CN、en
117
+ */
118
+ setHtmlPageLang(locale) {
119
+ document.querySelector("html")?.setAttribute("lang", locale);
120
+ }
73
121
  };
74
122
  function setupI18n(app) {
75
123
  app.use(_gct.i18n);
@@ -0,0 +1,5 @@
1
+ declare const _default: {
2
+ modelNameError: string;
3
+ notModelNameError: string;
4
+ };
5
+ export default _default;
@@ -0,0 +1,5 @@
1
+ declare const _default: {
2
+ notNull: string;
3
+ regError: string;
4
+ };
5
+ export default _default;
@@ -1,3 +1,4 @@
1
+ export declare const DEFAULT_MQTT_INSTANCE_ID = "DEFAULT_MQTT_INSTANCE_ID";
1
2
  /**
2
3
  * MQTT 连接状态枚举
3
4
  *
@@ -1,4 +1,5 @@
1
1
  //#region src/modules/mqtt/enums/mqtt-status.enum.ts
2
+ var DEFAULT_MQTT_INSTANCE_ID = "DEFAULT_MQTT_INSTANCE_ID";
2
3
  /**
3
4
  * MQTT 连接状态枚举
4
5
  *
@@ -21,4 +22,4 @@ var MqttConnectionStatus = /* @__PURE__ */ function(MqttConnectionStatus) {
21
22
  return MqttConnectionStatus;
22
23
  }({});
23
24
  //#endregion
24
- export { MqttConnectionStatus };
25
+ export { DEFAULT_MQTT_INSTANCE_ID, MqttConnectionStatus };