@gct-paas/render 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.
Files changed (35) hide show
  1. package/dist/index.esm.min.js +6118 -0
  2. package/es/Event/Dependency/controller.mjs +81 -94
  3. package/es/Event/Dependency/displayRule.mjs +65 -67
  4. package/es/Event/Dependency/useDependency.mjs +117 -0
  5. package/es/Event/Dependency/useDependencyToShow.mjs +100 -96
  6. package/es/Event/baseEvent.d.ts +6 -5
  7. package/es/Event/baseEvent.mjs +382 -423
  8. package/es/Event/bizServiceRequest.mjs +28 -40
  9. package/es/Event/index.d.ts +2 -1
  10. package/es/Event/index.mjs +4 -0
  11. package/es/Event/utils/appRedis.mjs +39 -49
  12. package/es/Event/utils/globalLoading.mjs +95 -94
  13. package/es/Event/utils/processRovedInfo.mjs +228 -294
  14. package/es/Event/utils/runGlobalByPage.mjs +296 -300
  15. package/es/Event/utils/verificationVar.mjs +32 -38
  16. package/es/_virtual/_rolldown/runtime.mjs +13 -0
  17. package/es/enums/index.mjs +17 -5
  18. package/es/hooks/useStorageRef.mjs +35 -31
  19. package/es/index.mjs +18 -21
  20. package/es/register/render-register/render-register.mjs +63 -58
  21. package/es/utils/cacheAdapter.mjs +62 -54
  22. package/es/utils/expression/index.mjs +105 -122
  23. package/es/utils/expression/regularExpression/methods.mjs +426 -567
  24. package/es/utils/field-attrs/basicAttrs.mjs +56 -80
  25. package/es/utils/field-attrs/index.mjs +16 -13
  26. package/es/utils/get-ref-data.mjs +41 -59
  27. package/es/utils/getFieldSchema.mjs +66 -80
  28. package/es/utils/index.d.ts +1 -1
  29. package/es/utils/index.mjs +6 -0
  30. package/es/utils/model-transformer.mjs +74 -64
  31. package/es/utils/useStyle.mjs +12 -15
  32. package/package.json +7 -7
  33. package/dist/index.esm.min.mjs +0 -7042
  34. package/dist/index.min.cjs +0 -17
  35. package/dist/index.system.min.js +0 -17
@@ -1,47 +1,35 @@
1
- import { EntityModelCategoryEnum, BizServiceEnum } from '@gct-paas/core';
2
-
3
- const bizServiceRequestHook = (api) => (path, query = {}, data = {}, config = {}) => {
4
- return api(
5
- {
6
- modelKey: path.key,
7
- bsKey: path.action,
8
- modelCategory: path.modelCategory ?? EntityModelCategoryEnum.ENTITY
9
- },
10
- query,
11
- data,
12
- config
13
- );
1
+ import { BizServiceEnum, EntityModelCategoryEnum } from "@gct-paas/core";
2
+ //#region src/Event/bizServiceRequest.ts
3
+ var bizServiceRequestHook = (api) => (path, query = {}, data = {}, config = {}) => {
4
+ return api({
5
+ modelKey: path.key,
6
+ bsKey: path.action,
7
+ modelCategory: path.modelCategory ?? EntityModelCategoryEnum.ENTITY
8
+ }, query, data, config);
14
9
  };
15
- const BizService = {
16
- post: bizServiceRequestHook(
17
- _gct.api.apaas.modelComprehensive.postBizServiceModelCategoryModelKeyBsKey
18
- ),
19
- get: bizServiceRequestHook(
20
- _gct.api.apaas.modelComprehensive.getBizServiceModelCategoryModelKeyBsKey
21
- ),
22
- put: bizServiceRequestHook(
23
- _gct.api.apaas.modelComprehensive.putBizServiceModelCategoryModelKeyBsKey
24
- ),
25
- delete: bizServiceRequestHook(
26
- _gct.api.apaas.modelComprehensive.deleteBizServiceModelCategoryModelKeyBsKey
27
- )
10
+ var BizService = {
11
+ post: bizServiceRequestHook(_gct.api.apaas.modelComprehensive.postBizServiceModelCategoryModelKeyBsKey),
12
+ get: bizServiceRequestHook(_gct.api.apaas.modelComprehensive.getBizServiceModelCategoryModelKeyBsKey),
13
+ put: bizServiceRequestHook(_gct.api.apaas.modelComprehensive.putBizServiceModelCategoryModelKeyBsKey),
14
+ delete: bizServiceRequestHook(_gct.api.apaas.modelComprehensive.deleteBizServiceModelCategoryModelKeyBsKey)
28
15
  };
16
+ /**
17
+ * 系统内置业务服务请求
18
+ * @param path
19
+ * @param params
20
+ * @param config
21
+ * @returns
22
+ */
29
23
  async function $httpBizService(path, params, config = {}) {
30
- const method = BizServiceEnum[path.action];
31
- return BizService[method](path, params, config);
24
+ return BizService[BizServiceEnum[path.action]](path, params, config);
32
25
  }
26
+ /**post 业务服务请求 */
33
27
  async function $request(modelKey, action, { body = {}, query = {} } = {}, config = {}) {
34
- const res = await _gct.api.apaas.modelComprehensive.postBizServiceGeneralModelCategoryModelKeyBsKey(
35
- {
36
- bsKey: action,
37
- modelKey,
38
- modelCategory: EntityModelCategoryEnum.ENTITY
39
- },
40
- query,
41
- body,
42
- config
43
- );
44
- return res;
28
+ return await _gct.api.apaas.modelComprehensive.postBizServiceGeneralModelCategoryModelKeyBsKey({
29
+ bsKey: action,
30
+ modelKey,
31
+ modelCategory: EntityModelCategoryEnum.ENTITY
32
+ }, query, body, config);
45
33
  }
46
-
34
+ //#endregion
47
35
  export { $httpBizService, $request, BizService };
@@ -1,4 +1,5 @@
1
1
  export { Globals, pageGlobaVariables, globalVarCaches, formMap, setFormData, pageDataforJson, getPageTitle, getPremission, } from './utils/runGlobalByPage';
2
- export { Events, Context, GctComponent } from './baseEvent';
2
+ export { Events, Context, GctComponent, type ModalInstance } from './baseEvent';
3
3
  export { type EventsConstructor } from './eventType';
4
4
  export * from './Dependency/useDependencyToShow';
5
+ export * from './Dependency/useDependency';
@@ -0,0 +1,4 @@
1
+ import "./utils/runGlobalByPage.mjs";
2
+ import "./baseEvent.mjs";
3
+ import "./Dependency/useDependencyToShow.mjs";
4
+ import "./Dependency/useDependency.mjs";
@@ -1,50 +1,40 @@
1
- import { useGctSelect } from '../../hooks/useStorageRef.mjs';
2
-
3
- class GlobaAppInfo {
4
- /**环境变量 */
5
- static ENV;
6
- /**应用标识 */
7
- static AID;
8
- /**用户信息 */
9
- static userInfo;
10
- /**app初始化变量 */
11
- static runApp({ userInfo, env, aid }) {
12
- this.ENV = env;
13
- this.AID = aid;
14
- this.userInfo = userInfo;
15
- }
16
- }
17
- const useCreateAppredis = ({
18
- value: defaultValue,
19
- appredis,
20
- key: varKey,
21
- type
22
- }) => {
23
- const isredis = GlobaAppInfo.ENV !== "dev" ? appredis : false;
24
- const key = `${GlobaAppInfo.AID}_${GlobaAppInfo.userInfo?.userId}`;
25
- const { cacheMap } = useGctSelect(key);
26
- const globalVar = new Proxy(
27
- { value: defaultValue, type },
28
- {
29
- get(target, name) {
30
- if (isredis && name === "value") {
31
- return cacheMap.value[varKey];
32
- }
33
- return Reflect.get(target, name);
34
- },
35
- set(target, name, value, receiver) {
36
- if (isredis && name === "value") {
37
- if (cacheMap.value[varKey]) {
38
- cacheMap.value[varKey] = value;
39
- } else {
40
- cacheMap.value = { ...cacheMap.value, [varKey]: value };
41
- }
42
- }
43
- return Reflect.set(target, name, value, receiver);
44
- }
45
- }
46
- );
47
- return globalVar;
1
+ import { useGctSelect } from "../../hooks/useStorageRef.mjs";
2
+ //#region src/Event/utils/appRedis.ts
3
+ var GlobaAppInfo = class {
4
+ /**环境变量 */
5
+ static ENV;
6
+ /**应用标识 */
7
+ static AID;
8
+ /**用户信息 */
9
+ static userInfo;
10
+ /**app初始化变量 */
11
+ static runApp({ userInfo, env, aid }) {
12
+ this.ENV = env;
13
+ this.AID = aid;
14
+ this.userInfo = userInfo;
15
+ }
48
16
  };
49
-
50
- export { GlobaAppInfo, useCreateAppredis };
17
+ /**获取缓存变量 */
18
+ var useCreateAppredis = ({ value: defaultValue, appredis, key: varKey, type }) => {
19
+ const isredis = GlobaAppInfo.ENV !== "dev" ? appredis : false;
20
+ const { cacheMap } = useGctSelect(`${GlobaAppInfo.AID}_${GlobaAppInfo.userInfo?.userId}`);
21
+ return new Proxy({
22
+ value: defaultValue,
23
+ type
24
+ }, {
25
+ get(target, name) {
26
+ if (isredis && name === "value") return cacheMap.value[varKey];
27
+ return Reflect.get(target, name);
28
+ },
29
+ set(target, name, value, receiver) {
30
+ if (isredis && name === "value") if (cacheMap.value[varKey]) cacheMap.value[varKey] = value;
31
+ else cacheMap.value = {
32
+ ...cacheMap.value,
33
+ [varKey]: value
34
+ };
35
+ return Reflect.set(target, name, value, receiver);
36
+ }
37
+ });
38
+ };
39
+ //#endregion
40
+ export { useCreateAppredis };
@@ -1,82 +1,86 @@
1
- class GlobalLoading {
2
- static instance;
3
- mask;
4
- container;
5
- spinner;
6
- constructor() {
7
- if (GlobalLoading.instance) return GlobalLoading.instance;
8
- GlobalLoading.instance = this;
9
- this.createLoadingElement();
10
- this.initStyle();
11
- }
12
- // 创建 DOM 元素
13
- createLoadingElement() {
14
- this.mask = document.createElement("div");
15
- this.mask.id = "gct-global-loading-mask";
16
- this.container = document.createElement("div");
17
- this.container.id = "gct-global-loading-container";
18
- this.spinner = document.createElement("div");
19
- this.spinner.id = "gct-global-loading-spinner";
20
- this.container.appendChild(this.spinner);
21
- this.mask.appendChild(this.container);
22
- document.body.appendChild(this.mask);
23
- }
24
- // 初始化样式(内联样式,无需额外 CSS 文件)
25
- initStyle() {
26
- Object.assign(this.mask.style, {
27
- position: "fixed",
28
- top: 0,
29
- left: 0,
30
- width: "100vw",
31
- height: "100vh",
32
- backgroundColor: "rgba(255, 255, 255, 0.5)",
33
- // 半透明黑色遮罩
34
- zIndex: 9999,
35
- // 确保在最上层
36
- display: "none",
37
- // 默认隐藏
38
- justifyContent: "center",
39
- alignItems: "center"
40
- });
41
- Object.assign(this.container.style, {
42
- display: "flex",
43
- flexDirection: "column",
44
- alignItems: "center",
45
- width: "43px",
46
- height: "43px",
47
- backgroundColor: "transparent",
48
- boxShadow: "0 2px 12px rgba(0, 0, 0, 0.15)"
49
- });
50
- Object.assign(this.spinner.style, {
51
- display: "grid",
52
- width: "43px",
53
- height: "43px",
54
- gridTemplateColumns: "repeat(2, 1fr)",
55
- gridTemplateRows: "repeat(2, 1fr)",
56
- gap: "3px"
57
- });
58
- const rootStyle = getComputedStyle(document.documentElement);
59
- const elPrimary = rootStyle.getPropertyValue("--gct-color-primary").trim();
60
- const blockConfig = [
61
- { id: "gct-global-loading-item_1", delay: "0s" },
62
- // 第一个方块用主色
63
- { id: "gct-global-loading-item_2", delay: "0.25s" },
64
- { id: "gct-global-loading-item_3", delay: "0.75s" },
65
- { id: "gct-global-loading-item_4", delay: "0.5s" }
66
- ];
67
- blockConfig.forEach((config) => {
68
- const block = document.createElement("div");
69
- block.id = config.id;
70
- Object.assign(block.style, {
71
- backgroundColor: elPrimary,
72
- opacity: 0.2,
73
- animation: "globalLoading 1s infinite",
74
- animationDelay: config.delay
75
- });
76
- this.spinner.appendChild(block);
77
- });
78
- const styleTag = document.createElement("style");
79
- styleTag.textContent = `
1
+ var globalLoading = new class GlobalLoading {
2
+ static instance;
3
+ mask;
4
+ container;
5
+ spinner;
6
+ constructor() {
7
+ if (GlobalLoading.instance) return GlobalLoading.instance;
8
+ GlobalLoading.instance = this;
9
+ this.createLoadingElement();
10
+ this.initStyle();
11
+ }
12
+ createLoadingElement() {
13
+ this.mask = document.createElement("div");
14
+ this.mask.id = "gct-global-loading-mask";
15
+ this.container = document.createElement("div");
16
+ this.container.id = "gct-global-loading-container";
17
+ this.spinner = document.createElement("div");
18
+ this.spinner.id = "gct-global-loading-spinner";
19
+ this.container.appendChild(this.spinner);
20
+ this.mask.appendChild(this.container);
21
+ document.body.appendChild(this.mask);
22
+ }
23
+ initStyle() {
24
+ Object.assign(this.mask.style, {
25
+ position: "fixed",
26
+ top: 0,
27
+ left: 0,
28
+ width: "100vw",
29
+ height: "100vh",
30
+ backgroundColor: "rgba(255, 255, 255, 0.5)",
31
+ zIndex: 9999,
32
+ display: "none",
33
+ justifyContent: "center",
34
+ alignItems: "center"
35
+ });
36
+ Object.assign(this.container.style, {
37
+ display: "flex",
38
+ flexDirection: "column",
39
+ alignItems: "center",
40
+ width: "43px",
41
+ height: "43px",
42
+ backgroundColor: "transparent",
43
+ boxShadow: "0 2px 12px rgba(0, 0, 0, 0.15)"
44
+ });
45
+ Object.assign(this.spinner.style, {
46
+ display: "grid",
47
+ width: "43px",
48
+ height: "43px",
49
+ gridTemplateColumns: "repeat(2, 1fr)",
50
+ gridTemplateRows: "repeat(2, 1fr)",
51
+ gap: "3px"
52
+ });
53
+ const elPrimary = getComputedStyle(document.documentElement).getPropertyValue("--gct-color-primary").trim();
54
+ [
55
+ {
56
+ id: "gct-global-loading-item_1",
57
+ delay: "0s"
58
+ },
59
+ {
60
+ id: "gct-global-loading-item_2",
61
+ delay: "0.25s"
62
+ },
63
+ {
64
+ id: "gct-global-loading-item_3",
65
+ delay: "0.75s"
66
+ },
67
+ {
68
+ id: "gct-global-loading-item_4",
69
+ delay: "0.5s"
70
+ }
71
+ ].forEach((config) => {
72
+ const block = document.createElement("div");
73
+ block.id = config.id;
74
+ Object.assign(block.style, {
75
+ backgroundColor: elPrimary,
76
+ opacity: .2,
77
+ animation: "globalLoading 1s infinite",
78
+ animationDelay: config.delay
79
+ });
80
+ this.spinner.appendChild(block);
81
+ });
82
+ const styleTag = document.createElement("style");
83
+ styleTag.textContent = `
80
84
  @keyframes globalLoading {
81
85
  0% {
82
86
  opacity: 1;
@@ -85,19 +89,16 @@ class GlobalLoading {
85
89
  opacity: 0.2;
86
90
  }
87
91
  }`;
88
- document.head.appendChild(styleTag);
89
- }
90
- // 显示 Loading(支持自定义文案)
91
- show() {
92
- this.mask.style.display = "flex";
93
- document.body.style.overflow = "hidden";
94
- }
95
- // 隐藏 Loading
96
- hide() {
97
- this.mask.style.display = "none";
98
- document.body.style.overflow = "";
99
- }
100
- }
101
- const globalLoading = new GlobalLoading();
102
-
92
+ document.head.appendChild(styleTag);
93
+ }
94
+ show() {
95
+ this.mask.style.display = "flex";
96
+ document.body.style.overflow = "hidden";
97
+ }
98
+ hide() {
99
+ this.mask.style.display = "none";
100
+ document.body.style.overflow = "";
101
+ }
102
+ }();
103
+ //#endregion
103
104
  export { globalLoading };