@gct-paas/render 0.1.4-dev.8 → 0.1.5-dev.0

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 (121) hide show
  1. package/dist/index.min.css +2 -0
  2. package/dist/loader.esm.min.js +1 -0
  3. package/es/Event/Dependency/controller.d.ts +13 -0
  4. package/es/Event/Dependency/controller.mjs +84 -0
  5. package/es/Event/Dependency/displayRule.d.ts +19 -0
  6. package/es/Event/Dependency/displayRule.mjs +138 -0
  7. package/es/Event/Dependency/useDependency.d.ts +7 -0
  8. package/es/Event/Dependency/useDependency.mjs +117 -0
  9. package/es/Event/Dependency/useDependencyToShow.d.ts +10 -0
  10. package/es/Event/Dependency/useDependencyToShow.mjs +113 -0
  11. package/es/Event/baseEvent.d.ts +156 -0
  12. package/es/Event/baseEvent.mjs +389 -0
  13. package/es/Event/bizServiceRequest.d.ts +26 -0
  14. package/es/Event/bizServiceRequest.mjs +35 -0
  15. package/es/Event/eventType.d.ts +20 -0
  16. package/es/Event/eventType.mjs +1 -0
  17. package/es/Event/index.d.ts +7 -0
  18. package/es/Event/index.mjs +7 -0
  19. package/es/Event/utils/appRedis.d.ts +29 -0
  20. package/es/Event/utils/appRedis.mjs +40 -0
  21. package/es/Event/utils/globalLoading.d.ts +13 -0
  22. package/es/Event/utils/globalLoading.mjs +104 -0
  23. package/es/Event/utils/processRovedInfo.d.ts +100 -0
  24. package/es/Event/utils/processRovedInfo.mjs +231 -0
  25. package/es/Event/utils/runGlobalByPage.d.ts +335 -0
  26. package/es/Event/utils/runGlobalByPage.mjs +302 -0
  27. package/es/Event/utils/verificationVar.d.ts +2 -0
  28. package/es/Event/utils/verificationVar.mjs +36 -0
  29. package/es/_virtual/_plugin-vue_export-helper.mjs +8 -0
  30. package/es/_virtual/_rolldown/runtime.mjs +13 -0
  31. package/es/components/HandwritingPad.vue.d.ts +27 -0
  32. package/es/components/HandwritingPad.vue.mjs +7 -0
  33. package/es/components/HandwritingPad.vue_vue_type_script_setup_true_name_HandwritingPad_lang.mjs +109 -0
  34. package/es/components/HandwritingPad.vue_vue_type_style_index_0_scoped_d5b980b7_lang.css +9 -0
  35. package/es/components/index.d.ts +2 -0
  36. package/es/components/index.mjs +1 -0
  37. package/es/constant/data-format.d.ts +52 -0
  38. package/es/constant/data-format.mjs +66 -0
  39. package/es/constant/date-time.d.ts +99 -0
  40. package/es/constant/date-time.mjs +187 -0
  41. package/es/constant/index.d.ts +94 -0
  42. package/es/constant/index.mjs +100 -0
  43. package/es/controller/design-render/design-render.controller.d.ts +18 -0
  44. package/es/controller/design-render/design-render.controller.mjs +78 -0
  45. package/es/controller/design-render-base/design-render-base.controller.d.ts +9 -0
  46. package/es/controller/design-render-base/design-render-base.controller.mjs +12 -0
  47. package/es/controller/design-render-container/design-render-container.controller.d.ts +4 -0
  48. package/es/controller/design-render-container/design-render-container.controller.mjs +5 -0
  49. package/es/controller/design-render-item/design-render-item.controller.d.ts +4 -0
  50. package/es/controller/design-render-item/design-render-item.controller.mjs +5 -0
  51. package/es/controller/index.d.ts +4 -0
  52. package/es/controller/index.mjs +4 -0
  53. package/es/enums/index.d.ts +14 -0
  54. package/es/enums/index.mjs +18 -0
  55. package/es/hooks/index.d.ts +2 -0
  56. package/es/hooks/index.mjs +2 -0
  57. package/es/hooks/use-design-render-controller/use-design-render-controller.d.ts +11 -0
  58. package/es/hooks/use-design-render-controller/use-design-render-controller.mjs +32 -0
  59. package/es/hooks/useStorageRef.d.ts +9 -0
  60. package/es/hooks/useStorageRef.mjs +37 -0
  61. package/es/index.d.ts +6 -0
  62. package/es/index.mjs +36 -1
  63. package/es/interface/controller/i-design-render-base.controller.d.ts +43 -0
  64. package/es/interface/controller/i-design-render-container.controller.d.ts +7 -0
  65. package/es/interface/controller/i-design-render-item.controller.d.ts +7 -0
  66. package/es/interface/controller/i-design-render.controller.d.ts +93 -0
  67. package/es/interface/index.d.ts +12 -0
  68. package/es/interface/provider/i-render-base-node.provider.d.ts +45 -0
  69. package/es/interface/provider/i-render-container-node.provider.d.ts +30 -0
  70. package/es/interface/provider/i-render-editor-node.provider.d.ts +29 -0
  71. package/es/interface/provider/i-render-item-node.provider.d.ts +30 -0
  72. package/es/interface/state/i-design-render-base.state.d.ts +19 -0
  73. package/es/interface/state/i-design-render-container.state.d.ts +11 -0
  74. package/es/interface/state/i-design-render-item.state.d.ts +11 -0
  75. package/es/interface/state/i-design-render.state.d.ts +18 -0
  76. package/es/loader.d.ts +1 -0
  77. package/es/register/index.d.ts +2 -0
  78. package/es/register/index.mjs +2 -0
  79. package/es/register/node/node.register.d.ts +92 -0
  80. package/es/register/node/node.register.mjs +116 -0
  81. package/es/register/render-register/render-register.d.ts +54 -0
  82. package/es/register/render-register/render-register.mjs +64 -0
  83. package/es/state/design-render/design-render.state.d.ts +13 -0
  84. package/es/state/design-render/design-render.state.mjs +15 -0
  85. package/es/state/design-render-base/design-render-base.state.d.ts +4 -0
  86. package/es/state/design-render-base/design-render-base.state.mjs +6 -0
  87. package/es/state/design-render-container/design-render-container.state.d.ts +4 -0
  88. package/es/state/design-render-item/design-render-item.state.d.ts +4 -0
  89. package/es/state/index.d.ts +4 -0
  90. package/es/types/index.d.ts +6 -0
  91. package/es/utils/cacheAdapter.d.ts +7 -0
  92. package/es/utils/cacheAdapter.mjs +65 -0
  93. package/es/utils/expression/index.d.ts +6 -0
  94. package/es/utils/expression/index.mjs +116 -0
  95. package/es/utils/expression/regularExpression/methods.d.ts +77 -0
  96. package/es/utils/expression/regularExpression/methods.mjs +588 -0
  97. package/es/utils/field-attrs/basicAttrs.mjs +56 -80
  98. package/es/utils/field-attrs/index.d.ts +1 -1
  99. package/es/utils/field-attrs/index.mjs +16 -13
  100. package/es/utils/get-ref-data.d.ts +1 -0
  101. package/es/utils/get-ref-data.mjs +44 -0
  102. package/es/utils/getFieldSchema.d.ts +1 -3
  103. package/es/utils/getFieldSchema.mjs +69 -0
  104. package/es/utils/index.d.ts +8 -0
  105. package/es/utils/index.mjs +11 -0
  106. package/es/utils/model-transformer.d.ts +46 -0
  107. package/es/utils/model-transformer.mjs +87 -0
  108. package/es/utils/render-plugin-pkg-util/render-plugin-pkg-util.d.ts +43 -0
  109. package/es/utils/render-plugin-pkg-util/render-plugin-pkg-util.mjs +65 -0
  110. package/es/utils/search/index.d.ts +2 -0
  111. package/es/utils/search/index.mjs +2 -0
  112. package/es/utils/search/search-default-value.d.ts +7 -0
  113. package/es/utils/search/search-default-value.mjs +244 -0
  114. package/es/utils/search/search-hooks.d.ts +6 -0
  115. package/es/utils/search/search-hooks.mjs +67 -0
  116. package/es/utils/useStyle.d.ts +21 -0
  117. package/es/utils/useStyle.mjs +22 -0
  118. package/package.json +33 -11
  119. package/dist/index.esm.min.mjs +0 -89
  120. package/dist/index.min.cjs +0 -1
  121. package/dist/index.system.min.js +0 -1
@@ -0,0 +1,335 @@
1
+ import { RuntimePageJson } from '@gct-paas/schema';
2
+ import { Events } from '../baseEvent';
3
+ export declare enum PageTypeEnum {
4
+ /** WEB */
5
+ WEB = "web_module",
6
+ /** MOBILE */
7
+ MOBILE = "mobile_module",
8
+ /** PAD */
9
+ PAD = "pad_module"
10
+ }
11
+ export declare const pageGlobaVariables: import('vue').Ref<Record<string, IObject>, Record<string, IObject>>;
12
+ /**app全局变量 */
13
+ export declare const globalVarCaches: import('vue').Ref<Record<string, IObject>, Record<string, IObject>>;
14
+ export declare const formMap: import('vue').Ref<Record<string, IObject>, Record<string, IObject>>;
15
+ export declare function setFormData(key: string, formData: IObject): void;
16
+ /**页面信息 */
17
+ export declare const pageDataforJson: import('vue').Ref<{
18
+ pageStyle?: {
19
+ position?: string | undefined;
20
+ top?: string | undefined;
21
+ left?: string | undefined;
22
+ right?: string | undefined;
23
+ bottom?: string | undefined;
24
+ width?: string | undefined;
25
+ height?: string | undefined;
26
+ maxHeight?: string | undefined;
27
+ backgroundColor?: string | undefined;
28
+ marginAll?: string | undefined;
29
+ marginTop?: string | undefined;
30
+ marginRight?: string | undefined;
31
+ marginBottom?: string | undefined;
32
+ marginLeft?: string | undefined;
33
+ paddingAll?: string | undefined;
34
+ paddingTop?: string | undefined;
35
+ paddingRight?: string | undefined;
36
+ paddingBottom?: string | undefined;
37
+ paddingLeft?: string | undefined;
38
+ labelFont?: {
39
+ fontSize: string;
40
+ bold: boolean;
41
+ italic: boolean;
42
+ textDecoration: import('@gct-paas/core').TextDecoration;
43
+ color: string;
44
+ align: "left" | "right" | "justify";
45
+ } | undefined;
46
+ contentFont?: {
47
+ fontSize: string;
48
+ bold: boolean;
49
+ italic: boolean;
50
+ textDecoration: import('@gct-paas/core').TextDecoration;
51
+ color: string;
52
+ align: "left" | "right" | "justify";
53
+ } | undefined;
54
+ tagStyle?: {
55
+ color?: string | undefined;
56
+ tagType?: import('@gct-paas/core').TagTypeEnum | undefined;
57
+ } | undefined;
58
+ tagStyleOpen?: boolean | undefined;
59
+ borderAll?: {
60
+ borderWidth?: string | undefined;
61
+ borderStyle?: string | undefined;
62
+ borderColor?: string | undefined;
63
+ } | undefined;
64
+ borderLeft?: {
65
+ borderWidth?: string | undefined;
66
+ borderStyle?: string | undefined;
67
+ borderColor?: string | undefined;
68
+ } | undefined;
69
+ borderRight?: {
70
+ borderWidth?: string | undefined;
71
+ borderStyle?: string | undefined;
72
+ borderColor?: string | undefined;
73
+ } | undefined;
74
+ borderBottom?: {
75
+ borderWidth?: string | undefined;
76
+ borderStyle?: string | undefined;
77
+ borderColor?: string | undefined;
78
+ } | undefined;
79
+ borderTop?: {
80
+ borderWidth?: string | undefined;
81
+ borderStyle?: string | undefined;
82
+ borderColor?: string | undefined;
83
+ } | undefined;
84
+ borderTopRightRadius?: string | undefined;
85
+ borderTopLeftRadius?: string | undefined;
86
+ borderBottomRightRadius?: string | undefined;
87
+ borderBottomLeftRadius?: string | undefined;
88
+ borderAllRadius?: string | undefined;
89
+ columnwidthConfigure?: import('@gct-paas/core').tableColumnWidthEnum | undefined;
90
+ columnwidth?: number | undefined;
91
+ columnFontStyleByRule?: {
92
+ displayRule: string;
93
+ contentFont: {
94
+ fontSize: string;
95
+ bold: boolean;
96
+ italic: boolean;
97
+ textDecoration: import('@gct-paas/core').TextDecoration;
98
+ color: string;
99
+ align: "left" | "right" | "justify";
100
+ };
101
+ tagStyle: {
102
+ color?: string | undefined;
103
+ tagType?: import('@gct-paas/core').TagTypeEnum | undefined;
104
+ };
105
+ progressStyle: {
106
+ color: string;
107
+ tagType: import('@gct-paas/core').ProgressTypeEnum;
108
+ };
109
+ tagType: import('@gct-paas/core').tagEnum;
110
+ tagStyleOpen: boolean;
111
+ }[] | undefined;
112
+ columnBackgroundByRule?: {
113
+ displayRule: string;
114
+ backgroundColor?: string | undefined;
115
+ }[] | undefined;
116
+ tableheight?: number | undefined;
117
+ tableheightConfigure?: import('@gct-paas/core').tableColumnWidthEnum | undefined;
118
+ enableHeaderBGColor?: boolean | undefined;
119
+ enableBGColor?: boolean | undefined;
120
+ } | undefined;
121
+ pageConfig?: {
122
+ title?: string | undefined;
123
+ i18n?: {
124
+ key?: string | undefined;
125
+ title?: string | undefined;
126
+ } | undefined;
127
+ hasFooter?: boolean | undefined;
128
+ } | undefined;
129
+ pageName?: string | undefined;
130
+ }, {
131
+ pageStyle?: RuntimePageJson["pageStyle"];
132
+ pageConfig?: RuntimePageJson["pageConfig"];
133
+ pageName?: string;
134
+ } | {
135
+ pageStyle?: {
136
+ position?: string | undefined;
137
+ top?: string | undefined;
138
+ left?: string | undefined;
139
+ right?: string | undefined;
140
+ bottom?: string | undefined;
141
+ width?: string | undefined;
142
+ height?: string | undefined;
143
+ maxHeight?: string | undefined;
144
+ backgroundColor?: string | undefined;
145
+ marginAll?: string | undefined;
146
+ marginTop?: string | undefined;
147
+ marginRight?: string | undefined;
148
+ marginBottom?: string | undefined;
149
+ marginLeft?: string | undefined;
150
+ paddingAll?: string | undefined;
151
+ paddingTop?: string | undefined;
152
+ paddingRight?: string | undefined;
153
+ paddingBottom?: string | undefined;
154
+ paddingLeft?: string | undefined;
155
+ labelFont?: {
156
+ fontSize: string;
157
+ bold: boolean;
158
+ italic: boolean;
159
+ textDecoration: import('@gct-paas/core').TextDecoration;
160
+ color: string;
161
+ align: "left" | "right" | "justify";
162
+ } | undefined;
163
+ contentFont?: {
164
+ fontSize: string;
165
+ bold: boolean;
166
+ italic: boolean;
167
+ textDecoration: import('@gct-paas/core').TextDecoration;
168
+ color: string;
169
+ align: "left" | "right" | "justify";
170
+ } | undefined;
171
+ tagStyle?: {
172
+ color?: string | undefined;
173
+ tagType?: import('@gct-paas/core').TagTypeEnum | undefined;
174
+ } | undefined;
175
+ tagStyleOpen?: boolean | undefined;
176
+ borderAll?: {
177
+ borderWidth?: string | undefined;
178
+ borderStyle?: string | undefined;
179
+ borderColor?: string | undefined;
180
+ } | undefined;
181
+ borderLeft?: {
182
+ borderWidth?: string | undefined;
183
+ borderStyle?: string | undefined;
184
+ borderColor?: string | undefined;
185
+ } | undefined;
186
+ borderRight?: {
187
+ borderWidth?: string | undefined;
188
+ borderStyle?: string | undefined;
189
+ borderColor?: string | undefined;
190
+ } | undefined;
191
+ borderBottom?: {
192
+ borderWidth?: string | undefined;
193
+ borderStyle?: string | undefined;
194
+ borderColor?: string | undefined;
195
+ } | undefined;
196
+ borderTop?: {
197
+ borderWidth?: string | undefined;
198
+ borderStyle?: string | undefined;
199
+ borderColor?: string | undefined;
200
+ } | undefined;
201
+ borderTopRightRadius?: string | undefined;
202
+ borderTopLeftRadius?: string | undefined;
203
+ borderBottomRightRadius?: string | undefined;
204
+ borderBottomLeftRadius?: string | undefined;
205
+ borderAllRadius?: string | undefined;
206
+ columnwidthConfigure?: import('@gct-paas/core').tableColumnWidthEnum | undefined;
207
+ columnwidth?: number | undefined;
208
+ columnFontStyleByRule?: {
209
+ displayRule: string;
210
+ contentFont: {
211
+ fontSize: string;
212
+ bold: boolean;
213
+ italic: boolean;
214
+ textDecoration: import('@gct-paas/core').TextDecoration;
215
+ color: string;
216
+ align: "left" | "right" | "justify";
217
+ };
218
+ tagStyle: {
219
+ color?: string | undefined;
220
+ tagType?: import('@gct-paas/core').TagTypeEnum | undefined;
221
+ };
222
+ progressStyle: {
223
+ color: string;
224
+ tagType: import('@gct-paas/core').ProgressTypeEnum;
225
+ };
226
+ tagType: import('@gct-paas/core').tagEnum;
227
+ tagStyleOpen: boolean;
228
+ }[] | undefined;
229
+ columnBackgroundByRule?: {
230
+ displayRule: string;
231
+ backgroundColor?: string | undefined;
232
+ }[] | undefined;
233
+ tableheight?: number | undefined;
234
+ tableheightConfigure?: import('@gct-paas/core').tableColumnWidthEnum | undefined;
235
+ enableHeaderBGColor?: boolean | undefined;
236
+ enableBGColor?: boolean | undefined;
237
+ } | undefined;
238
+ pageConfig?: {
239
+ title?: string | undefined;
240
+ i18n?: {
241
+ key?: string | undefined;
242
+ title?: string | undefined;
243
+ } | undefined;
244
+ hasFooter?: boolean | undefined;
245
+ } | undefined;
246
+ pageName?: string | undefined;
247
+ }>;
248
+ /**页面信息 */
249
+ export declare const getPageTitle: Readonly<import('vue').Ref<string | undefined, string | undefined>>;
250
+ /**页面全局事件 */
251
+ export declare class Globals {
252
+ /**模态框缓存 */
253
+ static modalsCache: Record<string, RuntimePageJson['modals'][number]>;
254
+ /**
255
+ * 上下文缓存
256
+ */
257
+ static pageID: string;
258
+ static permissions: Record<string, string>;
259
+ static ContextCache: IObject;
260
+ /**常量刷新锁 */
261
+ static startRuning: boolean;
262
+ /**全局钩子 */
263
+ static globalHookCaches: {
264
+ pageMounted: (() => void)[];
265
+ pageActivated: (() => void)[];
266
+ pageDestroyed: (() => void)[];
267
+ };
268
+ /**
269
+ * 设置模态框
270
+ * @param list
271
+ */
272
+ static setModals(list?: RuntimePageJson['modals']): void;
273
+ /**获取模态框信息 */
274
+ static getModalById(key?: string): Promise<import('@gct-paas/schema').RuntimeModal>;
275
+ /**
276
+ * 角色权限
277
+ * @param id 组件标识
278
+ */
279
+ static getPremission(id?: string): boolean;
280
+ /**
281
+ *设置组件权限
282
+ * @param key 权限标识
283
+ * @param id 组件标识
284
+ */
285
+ static setPremission(key: string, id: string): void;
286
+ static setContextByKey(context: IObject, key?: string): void;
287
+ static getContextByKey(key?: string): any;
288
+ /**
289
+ *获取页面变量
290
+ */
291
+ static initvars(): Promise<void>;
292
+ /**
293
+ * 获取APP全局钩子
294
+ */
295
+ static inithooks(): Promise<void>;
296
+ static initPermission(permissions: IObject): Promise<void>;
297
+ static initGlobalS(data: IObject): Promise<void>;
298
+ static getGlobalVar(id: string): any;
299
+ static setGlobalVar(id: string, value: string): Promise<void>;
300
+ /**
301
+ * 获取页面变量
302
+ * @param key
303
+ * @returns
304
+ */
305
+ static getPageVar(key: string): any;
306
+ /**
307
+ *设置页面变量
308
+ * @param key
309
+ * @param value
310
+ */
311
+ static setPageVar(key: string, value: string): Promise<void>;
312
+ /**
313
+ * 获取页面全局变量老版本兼容问题暂时不删除 后续不维护
314
+ * @param key
315
+ * @returns
316
+ */
317
+ static getPageGlobalVar(key: string): any;
318
+ /**设置页面变量老版本 兼容问题暂时不删除 后续不维护*/
319
+ static setPageGlobalVar(key: string, value: string): void;
320
+ static initPageByid(id: string, pageType?: PageTypeEnum): Promise<{
321
+ res: import('@gct-paas/api/apaas').PadPageResponse;
322
+ data: RuntimePageJson;
323
+ name: string | undefined;
324
+ }>;
325
+ static initHistoryByid(id: string): Promise<{
326
+ res: import('@gct-paas/api/apaas').PageDesignerLogResponse;
327
+ data: any;
328
+ name: string | undefined;
329
+ }>;
330
+ /**注册钩子 */
331
+ static usePageHooks<T extends Events = Events>(Event: T, pageEvents?: RuntimePageJson['pageEvents'], globalEvents?: RuntimePageJson['globalEvents'], pageCallback?: (Event: T) => Promise<void>): {
332
+ pageload: import('vue').Ref<boolean, boolean>;
333
+ };
334
+ }
335
+ export declare const getPremission: typeof Globals.getPremission;
@@ -0,0 +1,302 @@
1
+ import { useCreateAppredis } from "./appRedis.mjs";
2
+ import { verificationData } from "./verificationVar.mjs";
3
+ import { usePermissionStore } from "@gct-paas/core";
4
+ import "@gct-paas/schema";
5
+ import { nextTick, onActivated, onBeforeUnmount, onMounted, ref, toRef } from "vue";
6
+ //#region src/Event/utils/runGlobalByPage.ts
7
+ var PageTypeEnum = /* @__PURE__ */ function(PageTypeEnum) {
8
+ /** WEB */
9
+ PageTypeEnum["WEB"] = "web_module";
10
+ /** MOBILE */
11
+ PageTypeEnum["MOBILE"] = "mobile_module";
12
+ /** PAD */
13
+ PageTypeEnum["PAD"] = "pad_module";
14
+ return PageTypeEnum;
15
+ }({});
16
+ var getPageApiByMap = {
17
+ [PageTypeEnum.WEB]: { getPageInfo: _gct.api.apaas.webpage.getInfo },
18
+ [PageTypeEnum.MOBILE]: { getPageInfo: _gct.api.apaas.mobilePage.getInfo },
19
+ [PageTypeEnum.PAD]: { getPageInfo: _gct.api.apaas.padPage.getInfo }
20
+ };
21
+ var pageGlobaVariables = ref({});
22
+ /**app全局变量 */
23
+ var globalVarCaches = ref({});
24
+ var formMap = ref({});
25
+ function setFormData(key, formData) {
26
+ formMap.value[key] = formData;
27
+ }
28
+ /**页面信息 */
29
+ var pageDataforJson = ref({
30
+ pageStyle: {},
31
+ pageConfig: {},
32
+ pageName: ""
33
+ });
34
+ /**页面信息 */
35
+ var getPageTitle = toRef(() => {
36
+ const { title } = pageDataforJson.value.pageConfig || {};
37
+ return title;
38
+ });
39
+ /**页面全局事件 */
40
+ var Globals = class Globals {
41
+ /**模态框缓存 */
42
+ static modalsCache = {};
43
+ /**
44
+ * 上下文缓存
45
+ */
46
+ static pageID = "";
47
+ static permissions = {};
48
+ static ContextCache = {};
49
+ /**常量刷新锁 */
50
+ static startRuning = false;
51
+ /**全局钩子 */
52
+ static globalHookCaches = {
53
+ pageMounted: [],
54
+ pageActivated: [],
55
+ pageDestroyed: []
56
+ };
57
+ /**
58
+ * 设置模态框
59
+ * @param list
60
+ */
61
+ static setModals(list) {
62
+ this.modalsCache = {};
63
+ list?.forEach((i) => {
64
+ this.modalsCache[i.id] = i;
65
+ });
66
+ }
67
+ /**获取模态框信息 */
68
+ static async getModalById(key) {
69
+ if (!key) return Promise.reject();
70
+ if (/^i?g_modal_/.test(key) && !this.modalsCache[key]) {
71
+ const [res] = await _api.apaas.appGlobalSettings.getInfo({
72
+ keys: key,
73
+ fullInfo: true
74
+ }) || [];
75
+ if (res?.configJson) {
76
+ const modal = JSON.parse(res.configJson);
77
+ this.modalsCache[key] = modal;
78
+ }
79
+ }
80
+ const data = this.modalsCache[key];
81
+ if (!data) {
82
+ console.error(`模态框${key}不存在`);
83
+ return Promise.reject();
84
+ }
85
+ return data;
86
+ }
87
+ /**
88
+ * 角色权限
89
+ * @param id 组件标识
90
+ */
91
+ static getPremission(id) {
92
+ if (!id) return true;
93
+ const key = this.permissions[id];
94
+ if (!key) return true;
95
+ return usePermissionStore().getPermissionByKey(this.pageID, key);
96
+ }
97
+ /**
98
+ *设置组件权限
99
+ * @param key 权限标识
100
+ * @param id 组件标识
101
+ */
102
+ static setPremission(key, id) {
103
+ this.permissions[id] = key;
104
+ }
105
+ static setContextByKey(context, key) {
106
+ if (key) this.ContextCache[key] = context;
107
+ else this.ContextCache = { page: context };
108
+ }
109
+ static getContextByKey(key) {
110
+ return this.ContextCache[key || "page"];
111
+ }
112
+ /**
113
+ *获取页面变量
114
+ */
115
+ static async initvars() {
116
+ (await _gct.api.apaas.appGlobalSettings.getList({
117
+ type: "var",
118
+ fullInfo: true
119
+ }) || []).forEach((i) => {
120
+ if (!i.configJson) return;
121
+ try {
122
+ const datavalue = JSON.parse(i.configJson);
123
+ globalVarCaches.value[datavalue.key] = useCreateAppredis({
124
+ value: datavalue.defaultValue,
125
+ appredis: datavalue.appredis,
126
+ key: datavalue.key,
127
+ type: datavalue.type
128
+ });
129
+ } catch (error) {
130
+ console.error("initvars", error);
131
+ }
132
+ });
133
+ }
134
+ /**
135
+ * 获取APP全局钩子
136
+ */
137
+ static async inithooks() {
138
+ (await _gct.api.apaas.appGlobalSettings.getList({
139
+ type: "event",
140
+ fullInfo: true
141
+ }) || []).forEach((i) => {
142
+ if (!i.configJson) return;
143
+ try {
144
+ const fun = new Function(JSON.parse(i.configJson).runJs);
145
+ const catchFun = this.globalHookCaches[i.key];
146
+ if (catchFun) catchFun.push(fun);
147
+ } catch (error) {
148
+ console.error("inithooks", error);
149
+ }
150
+ });
151
+ }
152
+ static async initPermission(permissions) {
153
+ this.permissions = permissions || {};
154
+ }
155
+ static async initGlobalS(data) {
156
+ this.setModals(data.modals);
157
+ /**初始化页面变量 */
158
+ data.pageVars?.forEach((i) => {
159
+ pageGlobaVariables.value[i.key] = {
160
+ value: i.varInfo?.defaultValue,
161
+ type: i.varInfo.type
162
+ };
163
+ });
164
+ if (this.startRuning) return;
165
+ this.startRuning = true;
166
+ try {
167
+ await Promise.all([this.initvars(), this.inithooks()]);
168
+ } catch (error) {
169
+ console.log(error);
170
+ }
171
+ }
172
+ static getGlobalVar(id) {
173
+ const data = globalVarCaches.value[id];
174
+ if (!data) return console.warn("变量key不存在");
175
+ return data.value;
176
+ }
177
+ static async setGlobalVar(id, value) {
178
+ const data = globalVarCaches.value[id];
179
+ if (!data) return console.warn("变量key不存在");
180
+ data.value = value;
181
+ }
182
+ /**
183
+ * 获取页面变量
184
+ * @param key
185
+ * @returns
186
+ */
187
+ static getPageVar(key) {
188
+ const data = pageGlobaVariables.value[key];
189
+ if (!data) return console.warn("变量key不存在");
190
+ return data.value;
191
+ }
192
+ /**
193
+ *设置页面变量
194
+ * @param key
195
+ * @param value
196
+ */
197
+ static async setPageVar(key, value) {
198
+ const data = pageGlobaVariables.value[key];
199
+ if (!data) return console.warn("变量key不存在");
200
+ await verificationData(value, data.type);
201
+ if (!pageGlobaVariables.value[key]) return;
202
+ pageGlobaVariables.value[key].value = value;
203
+ }
204
+ /**
205
+ * 获取页面全局变量老版本兼容问题暂时不删除 后续不维护
206
+ * @param key
207
+ * @returns
208
+ */
209
+ static getPageGlobalVar(key) {
210
+ return pageGlobaVariables.value[key]?.value;
211
+ }
212
+ /**设置页面变量老版本 兼容问题暂时不删除 后续不维护*/
213
+ static setPageGlobalVar(key, value) {
214
+ if (pageGlobaVariables.value[key]) pageGlobaVariables.value[key].value = value;
215
+ else pageGlobaVariables.value[key] = {
216
+ value,
217
+ type: "string"
218
+ };
219
+ }
220
+ static async initPageByid(id, pageType = PageTypeEnum.WEB) {
221
+ this.pageID = id;
222
+ const getJSon = getPageApiByMap[pageType].getPageInfo;
223
+ const res = await getJSon({ id });
224
+ const { runtimeJson, name } = res || {};
225
+ pageDataforJson.value.pageName = name;
226
+ if (!runtimeJson) return Promise.reject();
227
+ const data = JSON.parse(runtimeJson);
228
+ if (!data.widgets.filter((item) => item.type !== "bottom-button-container").length) return Promise.reject();
229
+ await this.initGlobalS(data);
230
+ pageDataforJson.value.pageConfig = data.pageConfig || {};
231
+ pageDataforJson.value.pageStyle = data.pageStyle || {};
232
+ return {
233
+ res,
234
+ data,
235
+ name
236
+ };
237
+ }
238
+ static async initHistoryByid(id) {
239
+ this.pageID = id;
240
+ const res = await _gct.api.apaas.pageDesignerLog.getInfo({ id });
241
+ const { runtimeJson, name } = res || {};
242
+ if (!runtimeJson) return Promise.reject();
243
+ pageDataforJson.value.pageName = name;
244
+ const data = JSON.parse(runtimeJson);
245
+ await this.initGlobalS(data);
246
+ pageDataforJson.value.pageConfig = data.pageConfig || {};
247
+ pageDataforJson.value.pageStyle = data.pageStyle || {};
248
+ return {
249
+ res,
250
+ data,
251
+ name
252
+ };
253
+ }
254
+ /**注册钩子 */
255
+ static usePageHooks(Event, pageEvents, globalEvents, pageCallback) {
256
+ /**页面加载 */
257
+ const pageload = ref(false);
258
+ onMounted(async () => {
259
+ await nextTick();
260
+ const pageBeforeMountData = pageEvents?.pageBeforeMount;
261
+ if (pageBeforeMountData?.name)
262
+ /**页面钩子 */
263
+ /**异步执行保存内部组件初始化 */
264
+ await Event.runExportByName(pageBeforeMountData.name, pageBeforeMountData.extraParams);
265
+ /**自定义初始化回调 */
266
+ if (pageCallback) await pageCallback(Event);
267
+ pageload.value = true;
268
+ /**全局钩子 */
269
+ if (globalEvents?.pageMounted) for (const fun of this.globalHookCaches.pageMounted) await fun();
270
+ const { extraParams, name } = pageEvents?.pageMounted || {};
271
+ if (name)
272
+ /**页面钩子 */
273
+ /**异步执行保存内部组件初始化 */
274
+ Event.runAsyncExportByName(name, extraParams);
275
+ });
276
+ onBeforeUnmount(async () => {
277
+ /**清空页面data */
278
+ pageDataforJson.value = {};
279
+ const { extraParams, name } = pageEvents?.pageDestroyed || {};
280
+ if (name)
281
+ /**页面钩子 */
282
+ /**页面销毁时候的钩子函数 */
283
+ Event.runExportByName(name, extraParams);
284
+ /**全局钩子 */
285
+ if (globalEvents?.pageDestroyed) for (const fun of this.globalHookCaches.pageDestroyed) await fun();
286
+ });
287
+ onActivated(async () => {
288
+ Globals.setContextByKey(Event.context);
289
+ /**全局钩子 */
290
+ if (globalEvents?.pageActivated) for (const fun of this.globalHookCaches.pageActivated) await fun();
291
+ const { extraParams, name } = pageEvents?.pageActivated || {};
292
+ if (name)
293
+ /**页面钩子 */
294
+ /**异步执行保存内部组件初始化 */
295
+ Event.runAsyncExportByName(name, extraParams);
296
+ });
297
+ return { pageload };
298
+ }
299
+ };
300
+ var getPremission = Globals.getPremission.bind(Globals);
301
+ //#endregion
302
+ export { Globals, PageTypeEnum, formMap, getPageTitle, getPremission, globalVarCaches, pageDataforJson, pageGlobaVariables, setFormData };
@@ -0,0 +1,2 @@
1
+ import { GLOBAL_VAR_TYPE } from '@gct-paas/core';
2
+ export declare function verificationData(value: string, type: GLOBAL_VAR_TYPE): true | Promise<void>;
@@ -0,0 +1,36 @@
1
+ import { GLOBAL_VAR_TYPE } from "@gct-paas/core";
2
+ import dayjs from "dayjs";
3
+ //#region src/Event/utils/verificationVar.ts
4
+ var verificationMap = {
5
+ [GLOBAL_VAR_TYPE.DATE]: {
6
+ callback(value) {
7
+ return dayjs(value, ["YYYY-MM-DD", "YYYY/MM/DD"], true).isValid();
8
+ },
9
+ message: "日期变量格式为YYYY-MM-DD,YYYY/MM/DD"
10
+ },
11
+ [GLOBAL_VAR_TYPE.TIME]: {
12
+ callback(value) {
13
+ return dayjs(value, "HH:mm:ss", true).isValid();
14
+ },
15
+ message: "时间变量格式HH:mm:ss"
16
+ },
17
+ [GLOBAL_VAR_TYPE.DATETIME]: {
18
+ callback(value) {
19
+ return dayjs(value, ["YYYY-MM-DD HH:mm:ss", "YYYY/MM/DD HH:mm:ss"]).isValid();
20
+ },
21
+ message: "日期时间变量格式为YYYY-MM-DD HH:mm:ss,YYYY/MM/DD HH:mm:ss"
22
+ }
23
+ };
24
+ function verificationData(value, type) {
25
+ if (type === GLOBAL_VAR_TYPE.NULL) return true;
26
+ const { callback, message } = verificationMap[type] || {
27
+ callback(v) {
28
+ return Object.prototype.toString.call(v).slice(8, -1).toLowerCase() === type;
29
+ },
30
+ value: "变量值必须为" + type
31
+ };
32
+ if (callback(value)) return Promise.resolve();
33
+ else return Promise.reject(message);
34
+ }
35
+ //#endregion
36
+ export { verificationData };
@@ -0,0 +1,8 @@
1
+ //#region \0plugin-vue:export-helper
2
+ var _plugin_vue_export_helper_default = (sfc, props) => {
3
+ const target = sfc.__vccOpts || sfc;
4
+ for (const [key, val] of props) target[key] = val;
5
+ return target;
6
+ };
7
+ //#endregion
8
+ export { _plugin_vue_export_helper_default as default };
@@ -0,0 +1,13 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __defProp = Object.defineProperty;
3
+ var __exportAll = (all, no_symbols) => {
4
+ let target = {};
5
+ for (var name in all) __defProp(target, name, {
6
+ get: all[name],
7
+ enumerable: true
8
+ });
9
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
10
+ return target;
11
+ };
12
+ //#endregion
13
+ export { __exportAll };