@gct-paas/core 0.1.4-dev.7 → 0.1.4-dev.9

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 (276) hide show
  1. package/dist/index.esm.min.mjs +6520 -18715
  2. package/dist/index.min.cjs +386 -2
  3. package/dist/index.system.min.js +386 -2
  4. package/es/constants/core.mjs +0 -1
  5. package/es/constants/editor-register/editor-register.mjs +0 -1
  6. package/es/constants/editor-type/editor-type.d.ts +65 -1
  7. package/es/constants/editor-type/editor-type.mjs +14 -1
  8. package/es/constants/expression-type/BuiltOperators.d.ts +20 -0
  9. package/es/constants/expression-type/BuiltOperators.mjs +148 -0
  10. package/es/constants/expression-type/FunctionKeys.d.ts +1 -0
  11. package/es/constants/expression-type/FunctionKeys.mjs +81 -0
  12. package/es/constants/expression-type/editor.d.ts +8 -0
  13. package/es/constants/expression-type/editor.mjs +4 -0
  14. package/es/constants/expression-type/function.d.ts +7 -0
  15. package/es/constants/expression-type/function.mjs +875 -0
  16. package/es/constants/expression-type/index.d.ts +42 -0
  17. package/es/constants/expression-type/index.mjs +120 -0
  18. package/es/constants/expression-type/modeCfg.d.ts +30 -0
  19. package/es/constants/expression-type/modeCfg.mjs +268 -0
  20. package/es/constants/expression-type/variable.d.ts +12 -0
  21. package/es/constants/expression-type/variable.mjs +42 -0
  22. package/es/constants/form-container-type/form-container-type.mjs +0 -1
  23. package/es/constants/index.d.ts +5 -0
  24. package/es/constants/index.mjs +6 -6
  25. package/es/controller/edit-form/edit-form.controller.mjs +0 -1
  26. package/es/controller/editor/color-editor.controller.mjs +0 -1
  27. package/es/controller/editor/length-unit-editor.controller.mjs +0 -1
  28. package/es/controller/editor-item/editor-item.controller.mjs +0 -1
  29. package/es/controller/form/form.controller.mjs +5 -4
  30. package/es/controller/form-collapse/form-collapse.controller.mjs +4 -3
  31. package/es/controller/form-collapse-pane/form-collapse-pane.controller.mjs +4 -3
  32. package/es/controller/form-edit-item/form-edit-item.controller.d.ts +1 -0
  33. package/es/controller/form-edit-item/form-edit-item.controller.mjs +6 -2
  34. package/es/controller/form-group/form-group.controller.mjs +4 -3
  35. package/es/controller/form-item/form-item.controller.d.ts +1 -0
  36. package/es/controller/form-item/form-item.controller.mjs +7 -3
  37. package/es/controller/form-item-basic/form-item-basic.controller.mjs +3 -2
  38. package/es/controller/form-item-hidden/form-item-hidden.controller.mjs +0 -1
  39. package/es/controller/form-tab/form-tab.controller.mjs +4 -3
  40. package/es/controller/form-tab-pane/form-tab-pane.controller.mjs +4 -3
  41. package/es/controller/gct-form/gct-form.controller.mjs +5 -4
  42. package/es/create-app-vue.mjs +3 -9
  43. package/es/enums/app-designer/index.d.ts +13 -1
  44. package/es/enums/app-designer/index.mjs +8 -2
  45. package/es/enums/appEnum.d.ts +22 -66
  46. package/es/enums/appEnum.mjs +24 -15
  47. package/es/enums/appStateEnum.mjs +0 -1
  48. package/es/enums/authActionEnum.mjs +0 -1
  49. package/es/enums/breakpointEnum.mjs +0 -1
  50. package/es/enums/cacheEnum.mjs +0 -1
  51. package/es/enums/designEnum.d.ts +2 -2
  52. package/es/enums/designEnum.mjs +31 -32
  53. package/es/enums/developer-center/index.d.ts +1 -0
  54. package/es/enums/developer-center/integration.d.ts +4 -0
  55. package/es/enums/developer-center/integration.mjs +7 -0
  56. package/es/enums/exceptionEnum.mjs +0 -1
  57. package/es/enums/expressionEnum.d.ts +130 -0
  58. package/es/enums/expressionEnum.mjs +75 -0
  59. package/es/enums/globalEnum.d.ts +38 -0
  60. package/es/enums/globalEnum.mjs +25 -0
  61. package/es/enums/httpEnum.mjs +0 -1
  62. package/es/enums/index.d.ts +19 -0
  63. package/es/enums/index.mjs +13 -16
  64. package/es/enums/menuEnum.mjs +0 -1
  65. package/es/enums/page-designer/designer.d.ts +23 -3
  66. package/es/enums/page-designer/designer.mjs +90 -6
  67. package/es/enums/page-designer/panel.d.ts +78 -7
  68. package/es/enums/page-designer/panel.mjs +22 -4
  69. package/es/enums/page-designer/toolkit.mjs +0 -1
  70. package/es/enums/page-designer/widget.d.ts +2 -1
  71. package/es/enums/page-designer/widget.mjs +3 -3
  72. package/es/enums/pageEnum.mjs +0 -1
  73. package/es/enums/plugin-enum.mjs +0 -1
  74. package/es/enums/processEnum.d.ts +54 -0
  75. package/es/enums/processEnum.mjs +36 -2
  76. package/es/enums/roleEnum.mjs +0 -1
  77. package/es/enums/sizeEnum.mjs +0 -1
  78. package/es/global/gct/gct.d.ts +11 -28
  79. package/es/global/gct/gct.mjs +29 -32
  80. package/es/hooks/index.d.ts +2 -1
  81. package/es/hooks/use-app-inst/use-app-inst.d.ts +8 -0
  82. package/es/hooks/use-app-inst/use-app-inst.mjs +8 -0
  83. package/es/hooks/use-form/use-form.mjs +0 -1
  84. package/es/hooks/use-gct-form-value/use-gct-form-value.d.ts +1 -1
  85. package/es/hooks/use-gct-form-value/use-gct-form-value.mjs +0 -4
  86. package/es/hooks/use-modal/use-modal.mjs +0 -1
  87. package/es/hooks/use-overlay-scrollbars/use-overlay-scrollbars.d.ts +11 -0
  88. package/es/hooks/use-sub-app-utils/use-sub-app-utils.d.ts +31 -0
  89. package/es/hooks/use-sub-app-utils/use-sub-app-utils.mjs +30 -0
  90. package/es/hooks/useCopyToClipboard.mjs +0 -1
  91. package/es/index.d.ts +6 -8
  92. package/es/index.mjs +98 -64
  93. package/es/interface/controller/form-edit-item/form-edit-item.controller.d.ts +5 -0
  94. package/es/interface/controller/index.d.ts +0 -1
  95. package/es/interface/form/i-editor/i-editor-basic.d.ts +2 -2
  96. package/es/interface/form/i-editor/i-model-field-select-editor.d.ts +18 -0
  97. package/es/interface/form/i-form/i-form-collapse-pane.d.ts +4 -0
  98. package/es/interface/form/i-form/i-form-item-basic.d.ts +1 -1
  99. package/es/interface/form/i-form/i-form-tab-pane.d.ts +4 -0
  100. package/es/interface/form/index.d.ts +1 -0
  101. package/es/interface/i-app-context/i-app-context.d.ts +34 -0
  102. package/es/interface/i-field-code-chain/i-field-code-chain.d.ts +17 -0
  103. package/es/interface/i-global-var/i-global-var.d.ts +15 -0
  104. package/es/interface/i-mobile-home-menu-item/i-mobile-home-menu-item.d.ts +94 -0
  105. package/es/interface/i-pinia-action/i-global-actions.d.ts +8 -20
  106. package/es/interface/i-pinia-getter/i-global-getters.d.ts +1 -1
  107. package/es/interface/i-pinia-state/i-global-state.d.ts +7 -14
  108. package/es/interface/index.d.ts +5 -5
  109. package/es/interface/open-util/i-message-util/i-message-util.d.ts +54 -0
  110. package/es/interface/{i-modal → open-util/i-modal}/i-modal.d.ts +9 -10
  111. package/es/interface/{i-modal-data → open-util/i-modal-data}/i-modal-data.d.ts +6 -0
  112. package/es/interface/open-util/i-modal-options/i-modal-options.d.ts +12 -0
  113. package/es/interface/open-util/i-open-window-options/i-open-window-options.d.ts +59 -0
  114. package/es/interface/open-util/i-overlay-container/i-overlay-container.d.ts +36 -0
  115. package/es/interface/open-util/i-overlay-controller/i-overlay-controller.d.ts +36 -0
  116. package/es/interface/open-util/index.d.ts +7 -0
  117. package/es/interface/state/index.d.ts +0 -1
  118. package/es/locale/index.mjs +2 -2
  119. package/es/modules/env-manager/env-manager.const.mjs +0 -1
  120. package/es/modules/env-manager/env-manager.interface.mjs +0 -1
  121. package/es/modules/env-manager/env-manager.mjs +7 -8
  122. package/es/modules/error-handler/error-handler.const.mjs +1 -30
  123. package/es/modules/error-handler/error-strategy.mjs +0 -1
  124. package/es/modules/error-handler/index.mjs +0 -1
  125. package/es/modules/platform-config/constants/index.d.ts +7 -0
  126. package/es/modules/platform-config/constants/login.const.d.ts +15 -0
  127. package/es/modules/platform-config/constants/login.const.mjs +50 -0
  128. package/es/modules/platform-config/constants/org.const.d.ts +9 -0
  129. package/es/modules/platform-config/constants/org.const.mjs +54 -0
  130. package/es/modules/platform-config/constants/theme.const.d.ts +9 -0
  131. package/es/modules/platform-config/constants/theme.const.mjs +5 -0
  132. package/es/modules/platform-config/constants/watermark.const.d.ts +16 -0
  133. package/es/modules/platform-config/constants/watermark.const.mjs +14 -0
  134. package/es/modules/platform-config/enums/deploy.enum.d.ts +10 -0
  135. package/es/modules/platform-config/enums/deploy.enum.mjs +7 -0
  136. package/es/modules/platform-config/enums/index.d.ts +6 -0
  137. package/es/modules/platform-config/{constants.d.ts → enums/login.enum.d.ts} +3 -7
  138. package/es/modules/platform-config/enums/login.enum.mjs +16 -0
  139. package/es/modules/platform-config/enums/platform.enum.d.ts +27 -0
  140. package/es/modules/platform-config/enums/platform.enum.mjs +26 -0
  141. package/es/modules/platform-config/index.d.ts +6 -17
  142. package/es/modules/platform-config/interfaces/global-setting.interface.d.ts +7 -0
  143. package/es/modules/platform-config/interfaces/index.d.ts +7 -0
  144. package/es/modules/platform-config/interfaces/login-config.interface.d.ts +17 -0
  145. package/es/modules/platform-config/interfaces/platform-map.interface.d.ts +8 -0
  146. package/es/modules/platform-config/interfaces/theme-setting.interface.d.ts +30 -0
  147. package/es/modules/platform-config/store.d.ts +221 -0
  148. package/es/modules/platform-config/store.mjs +78 -0
  149. package/es/modules/platform-config/useBasicSetting.d.ts +6 -2
  150. package/es/modules/platform-config/useBasicSetting.mjs +39 -0
  151. package/es/modules/platform-config/useDeploySetting.d.ts +9 -4
  152. package/es/modules/platform-config/useDeploySetting.mjs +27 -0
  153. package/es/modules/platform-config/useLoginSetting.d.ts +4 -14
  154. package/es/modules/platform-config/useLoginSetting.mjs +177 -0
  155. package/es/modules/platform-config/useOrgSetting.d.ts +5 -1
  156. package/es/modules/platform-config/useOrgSetting.mjs +66 -0
  157. package/es/modules/platform-config/useProjectSetting.d.ts +12 -0
  158. package/es/modules/platform-config/useProjectSetting.mjs +11 -0
  159. package/es/modules/platform-config/useSecuritySetting.d.ts +5 -1
  160. package/es/modules/platform-config/useSecuritySetting.mjs +60 -0
  161. package/es/modules/platform-config/useThemeSetting.d.ts +6 -3
  162. package/es/modules/platform-config/useThemeSetting.mjs +64 -0
  163. package/es/modules/platform-config/useWatermarkSetting.d.ts +4 -1
  164. package/es/modules/platform-config/useWatermarkSetting.mjs +26 -0
  165. package/es/modules/user-stores/index.d.ts +3 -0
  166. package/es/modules/user-stores/store/permission.store.d.ts +21 -0
  167. package/es/modules/user-stores/store/permission.store.mjs +38 -0
  168. package/es/modules/user-stores/store/tenant.store.d.ts +9 -0
  169. package/es/modules/user-stores/store/tenant.store.mjs +24 -0
  170. package/es/modules/user-stores/store/user.store.d.ts +154 -0
  171. package/es/modules/user-stores/store/user.store.mjs +107 -0
  172. package/es/modules/user-stores/types/permission.d.ts +1 -0
  173. package/es/modules/user-stores/types/tenant.d.ts +1 -0
  174. package/es/modules/user-stores/types/user.d.ts +14 -0
  175. package/es/register/editor-register/editor-register.d.ts +5 -13
  176. package/es/register/editor-register/editor-register.mjs +8 -17
  177. package/es/register/form-item-register/form-item-register.d.ts +4 -15
  178. package/es/register/form-item-register/form-item-register.mjs +7 -17
  179. package/es/register/index.d.ts +12 -2
  180. package/es/router/index.mjs +0 -1
  181. package/es/setup-app.d.ts +8 -0
  182. package/es/setup-app.mjs +30 -0
  183. package/es/state/form/form.state.mjs +0 -1
  184. package/es/state/form-collapse/form-collapse.state.mjs +0 -1
  185. package/es/state/form-collapse-pane/form-collapse-pane.state.mjs +0 -1
  186. package/es/state/form-edit-item/form-edit-item.state.mjs +0 -1
  187. package/es/state/form-group/form-group.state.mjs +0 -1
  188. package/es/state/form-item/form-item.state.mjs +0 -1
  189. package/es/state/form-item-basic/form-item-basic.state.mjs +0 -1
  190. package/es/state/form-tab/form-tab.state.mjs +0 -1
  191. package/es/state/form-tab-pane/form-tab-pane.state.mjs +0 -1
  192. package/es/state/global-pinia-state/global-pinia-state.d.ts +8 -25
  193. package/es/state/global-pinia-state/global-pinia-state.mjs +30 -16
  194. package/es/store/global-store.d.ts +1 -0
  195. package/es/store/global-store.mjs +40 -37
  196. package/es/store/index.d.ts +2 -3
  197. package/es/store/index.mjs +0 -1
  198. package/es/types/index.d.ts +18 -1
  199. package/es/utils/axios/interceptors.mjs +2 -23
  200. package/es/utils/cache-adapter/cache-adapter.d.ts +2 -0
  201. package/es/utils/cache-adapter/cache-adapter.mjs +59 -0
  202. package/es/utils/deviceFingerprint.d.ts +17 -0
  203. package/es/utils/deviceFingerprint.mjs +73 -0
  204. package/es/utils/dictionary/dictionary.mjs +0 -1
  205. package/es/utils/i18n/index.d.ts +2 -1
  206. package/es/utils/i18n/index.mjs +3 -4
  207. package/es/utils/index.d.ts +17 -3
  208. package/es/utils/linked-list/linked-list.d.ts +72 -0
  209. package/es/utils/linked-list/linked-list.mjs +119 -0
  210. package/es/utils/linked-node/linked-node.d.ts +31 -0
  211. package/es/utils/linked-node/linked-node.mjs +32 -0
  212. package/es/utils/lowcode/utils.d.ts +1 -0
  213. package/es/utils/lowcode/utils.mjs +20 -0
  214. package/es/utils/lowcode/validate.d.ts +13 -0
  215. package/es/utils/lowcode/validate.mjs +29 -0
  216. package/es/utils/mitt/mitt.d.ts +1 -0
  217. package/es/utils/mitt/mitt.mjs +5 -0
  218. package/es/utils/model-loader/model-loader.d.ts +118 -0
  219. package/es/utils/model-loader/model-loader.mjs +326 -0
  220. package/es/utils/namespace/namespace.d.ts +8 -0
  221. package/es/utils/namespace/namespace.mjs +4 -2
  222. package/es/utils/openUtil/index.d.ts +2 -0
  223. package/es/utils/openUtil/modal/modal.d.ts +61 -0
  224. package/es/utils/openUtil/modal/modal.mjs +80 -0
  225. package/es/utils/openUtil/overlay-container/overlay-container.d.ts +100 -0
  226. package/es/utils/openUtil/overlay-container/overlay-container.mjs +139 -0
  227. package/es/utils/plugin-static-resource/plugin-static-resource.mjs +0 -1
  228. package/es/utils/props/gct-form-item/gct-form-item.props.d.ts +63 -0
  229. package/es/utils/props/gct-form-item/gct-form-item.props.mjs +66 -0
  230. package/es/utils/props/index.d.ts +1 -0
  231. package/es/utils/style/index.d.ts +16 -0
  232. package/es/utils/style/index.mjs +141 -0
  233. package/es/utils/tools/tools.d.ts +13 -10
  234. package/es/utils/tools/tools.mjs +23 -11
  235. package/es/utils/treeHelper/treeHelper.d.ts +124 -0
  236. package/es/utils/treeHelper/treeHelper.mjs +234 -0
  237. package/es/utils/util.d.ts +39 -0
  238. package/es/utils/util.mjs +40 -0
  239. package/es/utils/uuid/uuid.d.ts +3 -0
  240. package/es/utils/uuid/uuid.mjs +48 -0
  241. package/es/utils/value-helper/value-helper.d.ts +49 -0
  242. package/es/utils/value-helper/value-helper.mjs +111 -0
  243. package/es/utils/width-install/width-install.mjs +4 -2
  244. package/package.json +13 -16
  245. package/es/controller/index.mjs +0 -17
  246. package/es/enums/page-designer/index.mjs +0 -6
  247. package/es/global/index.mjs +0 -3
  248. package/es/hooks/index.mjs +0 -7
  249. package/es/hooks/use-namespace/use-namespace.d.ts +0 -9
  250. package/es/hooks/use-namespace/use-namespace.mjs +0 -9
  251. package/es/interface/controller/i-designer-controller.d.ts +0 -116
  252. package/es/interface/hooks/i-designer-hooks.d.ts +0 -26
  253. package/es/interface/hooks/index.d.ts +0 -1
  254. package/es/interface/i-message-util/i-message-util.d.ts +0 -78
  255. package/es/interface/index.mjs +0 -1
  256. package/es/interface/low-code-types/index.d.ts +0 -4
  257. package/es/interface/low-code-types/modal-types.d.ts +0 -67
  258. package/es/interface/low-code-types/model/index.d.ts +0 -5338
  259. package/es/interface/low-code-types/schema/index.d.ts +0 -12
  260. package/es/interface/low-code-types/widget-basic-types.d.ts +0 -667
  261. package/es/interface/state/i-designer-state.d.ts +0 -27
  262. package/es/modules/env-manager/index.mjs +0 -5
  263. package/es/modules/platform-config/index.mjs +0 -17
  264. package/es/modules/platform-config/types.d.ts +0 -67
  265. package/es/provider/i-designer-provider/i-designer-provider.d.ts +0 -102
  266. package/es/provider/index.d.ts +0 -1
  267. package/es/provider/index.mjs +0 -1
  268. package/es/register/designer-register/designer-register.d.ts +0 -53
  269. package/es/register/designer-register/designer-register.mjs +0 -68
  270. package/es/register/index.mjs +0 -6
  271. package/es/register/render-register/render-register.d.ts +0 -59
  272. package/es/register/render-register/render-register.mjs +0 -64
  273. package/es/state/index.mjs +0 -12
  274. package/es/utils/index.mjs +0 -10
  275. package/es/utils/plugin-pkg-util/plugin-pkg-util.d.ts +0 -96
  276. package/es/utils/plugin-pkg-util/plugin-pkg-util.mjs +0 -260
@@ -0,0 +1,119 @@
1
+ import { LinkedNode } from '../linked-node/linked-node.mjs';
2
+
3
+ class LinkedList {
4
+ /**
5
+ * 当前激活节点
6
+ *
7
+ * @author zhanghanrui
8
+ * @date 2024-07-31 15:07:02
9
+ * @type {(LinkedNode<T> | null)}
10
+ */
11
+ active = null;
12
+ /**
13
+ * 新增节点
14
+ *
15
+ * @author zhanghanrui
16
+ * @date 2024-07-31 15:07:45
17
+ * @param {T} data
18
+ */
19
+ add(data) {
20
+ if (!this.active) {
21
+ this.active = new LinkedNode(data);
22
+ } else {
23
+ if (this.active.next) {
24
+ let next = this.active.next;
25
+ while (next) {
26
+ next = next.next;
27
+ if (next) {
28
+ next.clear();
29
+ }
30
+ }
31
+ }
32
+ const node = new LinkedNode(data, null, this.active);
33
+ this.active.next = node;
34
+ this.active = node;
35
+ }
36
+ }
37
+ /**
38
+ * 删除节点
39
+ *
40
+ * @author zhanghanrui
41
+ * @date 2024-07-31 15:07:11
42
+ * @param {LinkedNode<T>} node
43
+ */
44
+ delete(node) {
45
+ const { prev, next } = node;
46
+ if (prev) {
47
+ prev.next = next;
48
+ }
49
+ if (next) {
50
+ next.prev = prev;
51
+ }
52
+ node.clear();
53
+ }
54
+ /**
55
+ * 上一个节点
56
+ *
57
+ * @author zhanghanrui
58
+ * @date 2024-07-31 16:07:41
59
+ */
60
+ prev() {
61
+ if (this.active && this.active.prev) {
62
+ this.active = this.active.prev;
63
+ }
64
+ }
65
+ /**
66
+ * 下一个节点
67
+ *
68
+ * @author zhanghanrui
69
+ * @date 2024-07-31 16:07:57
70
+ */
71
+ next() {
72
+ if (this.active && this.active.next) {
73
+ this.active = this.active.next;
74
+ }
75
+ }
76
+ /**
77
+ * 清理所有缓存
78
+ *
79
+ * @author zhanghanrui
80
+ * @date 2024-07-31 16:07:43
81
+ */
82
+ clearAll() {
83
+ if (this.active) {
84
+ let prev = this.active.prev;
85
+ let next = this.active.next;
86
+ while (prev) {
87
+ prev.clear();
88
+ prev = prev.prev;
89
+ }
90
+ while (next) {
91
+ next.clear();
92
+ next = next.next;
93
+ }
94
+ this.active.clear();
95
+ }
96
+ }
97
+ /**
98
+ * 是否可以撤销
99
+ *
100
+ * @author zhanghanrui
101
+ * @date 2024-08-21 15:08:57
102
+ * @return {*} {boolean}
103
+ */
104
+ canUndo() {
105
+ return !!this.active && !!this.active.prev;
106
+ }
107
+ /**
108
+ * 是否可以重做
109
+ *
110
+ * @author zhanghanrui
111
+ * @date 2024-08-21 15:08:33
112
+ * @return {*} {boolean}
113
+ */
114
+ canRedo() {
115
+ return !!this.active && !!this.active.next;
116
+ }
117
+ }
118
+
119
+ export { LinkedList };
@@ -0,0 +1,31 @@
1
+ /**
2
+ * 链表节点
3
+ *
4
+ * @author zhanghanrui
5
+ * @date 2024-07-31 15:07:21
6
+ * @export
7
+ * @class LinkedNode
8
+ * @template T
9
+ */
10
+ export declare class LinkedNode<T = any> {
11
+ data: T;
12
+ next: LinkedNode | null;
13
+ prev: LinkedNode | null;
14
+ /**
15
+ * Creates an instance of LinkedNode.
16
+ *
17
+ * @author zhanghanrui
18
+ * @date 2024-07-31 15:07:43
19
+ * @param {T} data 当前节点数据
20
+ * @param {(LinkedNode | null)} [next=null] 下一个节点
21
+ * @param {(LinkedNode | null)} [prev=null] 上一个节点
22
+ */
23
+ constructor(data: T, next?: LinkedNode | null, prev?: LinkedNode | null);
24
+ /**
25
+ * 清理链表,避免内存泄漏
26
+ *
27
+ * @author zhanghanrui
28
+ * @date 2024-07-31 15:07:34
29
+ */
30
+ clear(): void;
31
+ }
@@ -0,0 +1,32 @@
1
+ class LinkedNode {
2
+ data;
3
+ next;
4
+ prev;
5
+ /**
6
+ * Creates an instance of LinkedNode.
7
+ *
8
+ * @author zhanghanrui
9
+ * @date 2024-07-31 15:07:43
10
+ * @param {T} data 当前节点数据
11
+ * @param {(LinkedNode | null)} [next=null] 下一个节点
12
+ * @param {(LinkedNode | null)} [prev=null] 上一个节点
13
+ */
14
+ constructor(data, next = null, prev = null) {
15
+ this.data = data;
16
+ this.next = next;
17
+ this.prev = prev;
18
+ }
19
+ /**
20
+ * 清理链表,避免内存泄漏
21
+ *
22
+ * @author zhanghanrui
23
+ * @date 2024-07-31 15:07:34
24
+ */
25
+ clear() {
26
+ this.data = null;
27
+ this.next = null;
28
+ this.prev = null;
29
+ }
30
+ }
31
+
32
+ export { LinkedNode };
@@ -0,0 +1 @@
1
+ export declare const insertCustomCssToHead: (cssCode: string, modalId?: string) => void;
@@ -0,0 +1,20 @@
1
+ import { isEmpty } from 'lodash-es';
2
+
3
+ const insertCustomCssToHead = function(cssCode, modalId = "") {
4
+ const head = document.getElementsByTagName("head")[0];
5
+ const oldStyle = document.getElementById("gct-custom-css" + modalId);
6
+ if (oldStyle) {
7
+ head.removeChild(oldStyle);
8
+ }
9
+ const newStyle = document.createElement("style");
10
+ newStyle.id = "gct-custom-css" + modalId;
11
+ newStyle.type = "text/css";
12
+ if (isEmpty(modalId)) {
13
+ newStyle.innerHTML = cssCode;
14
+ } else {
15
+ newStyle.innerHTML = `#${modalId}{${cssCode}}`;
16
+ }
17
+ head.appendChild(newStyle);
18
+ };
19
+
20
+ export { insertCustomCssToHead };
@@ -0,0 +1,13 @@
1
+ interface Validation {
2
+ required?: boolean;
3
+ reg?: string | RegExp;
4
+ regHint?: string;
5
+ validateFn?: any;
6
+ }
7
+ interface Rule {
8
+ required?: boolean;
9
+ message?: string;
10
+ validator?: any;
11
+ }
12
+ export declare function buildItemRules(validation: Validation): Rule[];
13
+ export {};
@@ -0,0 +1,29 @@
1
+ import { t } from '../i18n/index.mjs';
2
+
3
+ function buildItemRules(validation) {
4
+ const rules = [];
5
+ if (validation.required) {
6
+ rules.push({
7
+ required: true,
8
+ message: t("sys.notNull")
9
+ });
10
+ }
11
+ if (validation.reg) {
12
+ const { reg, regHint } = validation;
13
+ const regExg = new RegExp(reg);
14
+ const validator = (val) => regExg.test(val);
15
+ rules.push({
16
+ validator,
17
+ message: regHint ?? t("sys.regError")
18
+ });
19
+ }
20
+ const validateEvent = validation.validateFn;
21
+ if (validateEvent) {
22
+ rules.push({
23
+ validator: validateEvent
24
+ });
25
+ }
26
+ return rules;
27
+ }
28
+
29
+ export { buildItemRules };
@@ -0,0 +1 @@
1
+ export declare const mitt: import('mitt').Emitter<Record<import('mitt').EventType, unknown>>;
@@ -0,0 +1,5 @@
1
+ import Mitt from 'mitt';
2
+
3
+ const mitt = Mitt();
4
+
5
+ export { mitt };
@@ -0,0 +1,118 @@
1
+ import { IFieldCodeChain } from '../../interface';
2
+ import { FieldMetaDTO, ModelMetaDTO, ModelPageableRow, QueryRefDataRequest } from '@gct-paas/api/apaas';
3
+ /**
4
+ * 模型加载器,提供模型缓存和请求去重功能
5
+ *
6
+ * @author chitanda
7
+ * @date 2025-06-20 16:06:12
8
+ * @class ModelLoader
9
+ */
10
+ declare class ModelLoader {
11
+ private readonly CACHE_EXPIRATION_TIME;
12
+ private modelCache;
13
+ private modelLoadingCache;
14
+ private modelsLoadingCache;
15
+ private enumCache;
16
+ private enumLoadingCache;
17
+ private queryRefDataCache;
18
+ private queryRefDataLoadingCache;
19
+ /**
20
+ * 检查缓存条目是否过期
21
+ *
22
+ * @param {CacheEntry<any>} entry
23
+ * @returns {*} {boolean}
24
+ */
25
+ private isExpired;
26
+ /**
27
+ * 创建缓存条目
28
+ *
29
+ * @param {T} data
30
+ * @returns {*} {CacheEntry<T>}
31
+ */
32
+ private createCacheEntry;
33
+ /**
34
+ * 加载模型信息,具有缓存和请求去重功能
35
+ *
36
+ * @author chitanda
37
+ * @date 2025-06-20 16:06:05
38
+ * @param {string} modelKey
39
+ * @returns {*} {Promise<ModelMetaDTO>}
40
+ */
41
+ loadModel(modelKey: string): Promise<ModelMetaDTO>;
42
+ /**
43
+ * 加载多个模型信息
44
+ *
45
+ * @author chitanda
46
+ * @date 2025-06-22 15:06:54
47
+ * @param {string[]} modelKeys
48
+ * @returns {*} {Promise<ModelMetaDTO[]>}
49
+ */
50
+ loadModels(modelKeys: string[]): Promise<ModelMetaDTO[]>;
51
+ /**
52
+ * 加载指定模型的字段信息
53
+ *
54
+ * @author chitanda
55
+ * @date 2025-06-22 14:06:37
56
+ * @param {string} modelKey
57
+ * @param {string} fieldKey
58
+ * @returns {*} {(Promise<FieldMetaDTO | undefined>)}
59
+ */
60
+ loadField(modelKey: string, fieldKey: string): Promise<FieldMetaDTO | undefined>;
61
+ /**
62
+ * 加载指定模型的字段路径信息
63
+ *
64
+ * @author chitanda
65
+ * @date 2025-06-22 14:06:11
66
+ * @param {string} modelKey
67
+ * @param {string} fieldKey
68
+ * @returns {*} {Promise<string[]>}
69
+ */
70
+ loadFieldPaths(modelKey: string, fieldKey: string, fieldCodeChain: IFieldCodeChain): Promise<string[]>;
71
+ /**
72
+ * 加载指定模型的枚举列表
73
+ *
74
+ * @param {string} modelKey
75
+ * @param {string} fieldKey
76
+ * @param {string} [modelCategory=EntityModelCategoryEnum.ENTITY]
77
+ * @returns {*} {Promise<IObject[]>}
78
+ */
79
+ loadEnumList(modelKey: string, fieldKey: string, modelCategory?: string): Promise<IObject[]>;
80
+ /**
81
+ * 加载关联数据查询(QueryRef)
82
+ *
83
+ * @param {QueryRefDataRequest} request
84
+ * @returns {*} {Promise<ModelPageableRow>}
85
+ */
86
+ loadQueryRefData(request: QueryRefDataRequest): Promise<ModelPageableRow>;
87
+ /**
88
+ * 获取已缓存的模型
89
+ * @param modelKey 模型键
90
+ * @returns ModelMetaDTO | undefined
91
+ */
92
+ getCachedModel(modelKey: string): ModelMetaDTO | undefined;
93
+ /**
94
+ * 清除指定模型的缓存
95
+ *
96
+ * @author chitanda
97
+ * @date 2025-06-20 16:06:41
98
+ * @param {string} modelKey
99
+ */
100
+ clear(modelKey: string): void;
101
+ /**
102
+ * 清除所有模型缓存
103
+ *
104
+ * @author chitanda
105
+ * @date 2025-06-20 16:06:35
106
+ */
107
+ clearAll(): void;
108
+ /**
109
+ * 获取所有已缓存的模型键
110
+ *
111
+ * @author chitanda
112
+ * @date 2025-06-20 16:06:55
113
+ * @returns {*} {string[]}
114
+ */
115
+ keys(): string[];
116
+ }
117
+ export declare const modelLoader: ModelLoader;
118
+ export {};
@@ -0,0 +1,326 @@
1
+ import { cloneDeep } from 'lodash-es';
2
+ import { EntityModelCategoryEnum } from '../../enums/app-designer/index.mjs';
3
+ import '../../enums/page-designer/designer.mjs';
4
+ import '../../enums/breakpointEnum.mjs';
5
+
6
+ class ModelLoader {
7
+ // 缓存过期时间(毫秒),默认10分钟
8
+ CACHE_EXPIRATION_TIME = 10 * 60 * 1e3;
9
+ modelCache = /* @__PURE__ */ new Map();
10
+ modelLoadingCache = /* @__PURE__ */ new Map();
11
+ modelsLoadingCache = /* @__PURE__ */ new Map();
12
+ enumCache = /* @__PURE__ */ new Map();
13
+ enumLoadingCache = /* @__PURE__ */ new Map();
14
+ queryRefDataCache = /* @__PURE__ */ new Map();
15
+ queryRefDataLoadingCache = /* @__PURE__ */ new Map();
16
+ /**
17
+ * 检查缓存条目是否过期
18
+ *
19
+ * @param {CacheEntry<any>} entry
20
+ * @returns {*} {boolean}
21
+ */
22
+ isExpired(entry) {
23
+ return Date.now() > entry.expiresAt;
24
+ }
25
+ /**
26
+ * 创建缓存条目
27
+ *
28
+ * @param {T} data
29
+ * @returns {*} {CacheEntry<T>}
30
+ */
31
+ createCacheEntry(data) {
32
+ return {
33
+ data,
34
+ expiresAt: Date.now() + this.CACHE_EXPIRATION_TIME
35
+ };
36
+ }
37
+ /**
38
+ * 加载模型信息,具有缓存和请求去重功能
39
+ *
40
+ * @author chitanda
41
+ * @date 2025-06-20 16:06:05
42
+ * @param {string} modelKey
43
+ * @returns {*} {Promise<ModelMetaDTO>}
44
+ */
45
+ async loadModel(modelKey) {
46
+ if (this.modelCache.has(modelKey)) {
47
+ const cacheEntry = this.modelCache.get(modelKey);
48
+ if (!this.isExpired(cacheEntry)) {
49
+ return cacheEntry.data;
50
+ }
51
+ this.modelCache.delete(modelKey);
52
+ }
53
+ if (this.modelLoadingCache.has(modelKey)) {
54
+ return this.modelLoadingCache.get(modelKey);
55
+ }
56
+ const loadPromise = (async () => {
57
+ try {
58
+ const data = await _api.apaas.modelMeta.getDetail({ modelKey });
59
+ if (data) {
60
+ this.modelCache.set(modelKey, this.createCacheEntry(data));
61
+ return data;
62
+ }
63
+ return {};
64
+ } finally {
65
+ this.modelLoadingCache.delete(modelKey);
66
+ }
67
+ })();
68
+ this.modelLoadingCache.set(modelKey, loadPromise);
69
+ return loadPromise;
70
+ }
71
+ /**
72
+ * 加载多个模型信息
73
+ *
74
+ * @author chitanda
75
+ * @date 2025-06-22 15:06:54
76
+ * @param {string[]} modelKeys
77
+ * @returns {*} {Promise<ModelMetaDTO[]>}
78
+ */
79
+ async loadModels(modelKeys) {
80
+ const cacheKey = modelKeys.join(",");
81
+ const allCached = modelKeys.every((key) => {
82
+ const entry = this.modelCache.get(key);
83
+ return entry && !this.isExpired(entry);
84
+ });
85
+ if (allCached) {
86
+ return modelKeys.map((key) => this.modelCache.get(key).data);
87
+ }
88
+ modelKeys.forEach((key) => {
89
+ const entry = this.modelCache.get(key);
90
+ if (entry && this.isExpired(entry)) {
91
+ this.modelCache.delete(key);
92
+ }
93
+ });
94
+ if (this.modelsLoadingCache.has(cacheKey)) {
95
+ return this.modelsLoadingCache.get(cacheKey);
96
+ }
97
+ const loadPromise = (async () => {
98
+ try {
99
+ const pendingKeys = modelKeys.filter((key) => !this.modelCache.has(key));
100
+ if (pendingKeys.length > 0) {
101
+ const data = await _api.apaas.modelMeta.getByKeys({
102
+ modelKeys: pendingKeys.join(",")
103
+ });
104
+ if (data && data.length > 0) {
105
+ data.forEach((model) => {
106
+ this.modelCache.set(model.key, this.createCacheEntry(model));
107
+ model.fieldMetaList = model.fieldMetas || [];
108
+ });
109
+ }
110
+ }
111
+ return modelKeys.map((key) => {
112
+ const entry = this.modelCache.get(key);
113
+ return entry.data;
114
+ });
115
+ } finally {
116
+ this.modelsLoadingCache.delete(cacheKey);
117
+ }
118
+ })();
119
+ this.modelsLoadingCache.set(cacheKey, loadPromise);
120
+ return loadPromise;
121
+ }
122
+ /**
123
+ * 加载指定模型的字段信息
124
+ *
125
+ * @author chitanda
126
+ * @date 2025-06-22 14:06:37
127
+ * @param {string} modelKey
128
+ * @param {string} fieldKey
129
+ * @returns {*} {(Promise<FieldMetaDTO | undefined>)}
130
+ */
131
+ async loadField(modelKey, fieldKey) {
132
+ const model = await this.loadModel(modelKey);
133
+ if (model?.fieldMetaList) {
134
+ return model.fieldMetaList.find((field) => field.key === fieldKey);
135
+ }
136
+ return void 0;
137
+ }
138
+ /**
139
+ * 加载指定模型的字段路径信息
140
+ *
141
+ * @author chitanda
142
+ * @date 2025-06-22 14:06:11
143
+ * @param {string} modelKey
144
+ * @param {string} fieldKey
145
+ * @returns {*} {Promise<string[]>}
146
+ */
147
+ async loadFieldPaths(modelKey, fieldKey, fieldCodeChain) {
148
+ if (!fieldCodeChain) {
149
+ return [];
150
+ }
151
+ const list = [];
152
+ const isFieldModel = !!fieldCodeChain.bindFieldKey;
153
+ const modelKeys = isFieldModel ? fieldCodeChain.modelLink || [
154
+ fieldCodeChain.belongModelKey,
155
+ fieldCodeChain.bindModelKey
156
+ ] : [fieldCodeChain.modelKey];
157
+ const models = await this.loadModels(modelKeys);
158
+ if (isFieldModel) {
159
+ list.push(...models.map((model2) => model2.name));
160
+ } else {
161
+ const model2 = await this.loadModel(fieldCodeChain.modelKey);
162
+ if (model2) {
163
+ list.push(model2.name);
164
+ }
165
+ }
166
+ const model = await this.loadModel(modelKey);
167
+ if (model?.fieldMetaList) {
168
+ const field = model.fieldMetaList.find((field2) => field2.key === fieldKey);
169
+ if (field) {
170
+ list.push(field.name);
171
+ }
172
+ }
173
+ return list;
174
+ }
175
+ /**
176
+ * 加载指定模型的枚举列表
177
+ *
178
+ * @param {string} modelKey
179
+ * @param {string} fieldKey
180
+ * @param {string} [modelCategory=EntityModelCategoryEnum.ENTITY]
181
+ * @returns {*} {Promise<IObject[]>}
182
+ */
183
+ async loadEnumList(modelKey, fieldKey, modelCategory = EntityModelCategoryEnum.ENTITY) {
184
+ const cacheKey = `${modelCategory}:${modelKey}:${fieldKey}`;
185
+ if (this.enumCache.has(cacheKey)) {
186
+ const cacheEntry = this.enumCache.get(cacheKey);
187
+ if (!this.isExpired(cacheEntry)) {
188
+ return cloneDeep(cacheEntry.data);
189
+ }
190
+ this.enumCache.delete(cacheKey);
191
+ this.enumLoadingCache.delete(cacheKey);
192
+ }
193
+ if (this.enumLoadingCache.has(cacheKey)) {
194
+ return this.enumLoadingCache.get(cacheKey);
195
+ }
196
+ const loadPromise = (async () => {
197
+ try {
198
+ return [];
199
+ } finally {
200
+ this.enumLoadingCache.delete(cacheKey);
201
+ }
202
+ })();
203
+ this.enumLoadingCache.set(cacheKey, loadPromise);
204
+ return loadPromise;
205
+ }
206
+ /**
207
+ * 加载关联数据查询(QueryRef)
208
+ *
209
+ * @param {QueryRefDataRequest} request
210
+ * @returns {*} {Promise<ModelPageableRow>}
211
+ */
212
+ async loadQueryRefData(request) {
213
+ if (!request || !request.modelKey) {
214
+ throw new Error(`queryRefData 参数缺失`);
215
+ }
216
+ const cacheKey = JSON.stringify(request);
217
+ if (this.queryRefDataCache.has(cacheKey)) {
218
+ const cacheEntry = this.queryRefDataCache.get(cacheKey);
219
+ if (!this.isExpired(cacheEntry)) {
220
+ return cloneDeep(cacheEntry.data);
221
+ }
222
+ this.queryRefDataCache.delete(cacheKey);
223
+ this.queryRefDataLoadingCache.delete(cacheKey);
224
+ }
225
+ if (this.queryRefDataLoadingCache.has(cacheKey)) {
226
+ return this.queryRefDataLoadingCache.get(cacheKey);
227
+ }
228
+ const loadPromise = (async () => {
229
+ try {
230
+ const data = await _api.apaas.modelData.postQueryRefData(request);
231
+ if (data) {
232
+ this.queryRefDataCache.set(cacheKey, this.createCacheEntry(data));
233
+ return cloneDeep(data);
234
+ }
235
+ return {};
236
+ } finally {
237
+ this.queryRefDataLoadingCache.delete(cacheKey);
238
+ }
239
+ })();
240
+ this.queryRefDataLoadingCache.set(cacheKey, loadPromise);
241
+ return loadPromise;
242
+ }
243
+ /**
244
+ * 获取已缓存的模型
245
+ * @param modelKey 模型键
246
+ * @returns ModelMetaDTO | undefined
247
+ */
248
+ getCachedModel(modelKey) {
249
+ const entry = this.modelCache.get(modelKey);
250
+ if (entry && !this.isExpired(entry)) {
251
+ return entry.data;
252
+ }
253
+ if (entry && this.isExpired(entry)) {
254
+ this.modelCache.delete(modelKey);
255
+ }
256
+ return void 0;
257
+ }
258
+ /**
259
+ * 清除指定模型的缓存
260
+ *
261
+ * @author chitanda
262
+ * @date 2025-06-20 16:06:41
263
+ * @param {string} modelKey
264
+ */
265
+ clear(modelKey) {
266
+ this.modelCache.delete(modelKey);
267
+ this.modelLoadingCache.delete(modelKey);
268
+ const keysToDelete = [];
269
+ this.modelsLoadingCache.forEach((_, cacheKey) => {
270
+ if (cacheKey.includes(modelKey)) {
271
+ keysToDelete.push(cacheKey);
272
+ }
273
+ });
274
+ keysToDelete.forEach((key) => {
275
+ this.modelsLoadingCache.delete(key);
276
+ });
277
+ const enumKeysToDelete = [];
278
+ this.enumCache.forEach((_, cacheKey) => {
279
+ if (cacheKey.includes(modelKey)) {
280
+ enumKeysToDelete.push(cacheKey);
281
+ }
282
+ });
283
+ enumKeysToDelete.forEach((key) => {
284
+ this.enumCache.delete(key);
285
+ this.enumLoadingCache.delete(key);
286
+ });
287
+ const queryRefKeysToDelete = [];
288
+ this.queryRefDataCache.forEach((_, cacheKey) => {
289
+ if (cacheKey.includes(`"modelKey":"${modelKey}"`)) {
290
+ queryRefKeysToDelete.push(cacheKey);
291
+ }
292
+ });
293
+ queryRefKeysToDelete.forEach((key) => {
294
+ this.queryRefDataCache.delete(key);
295
+ this.queryRefDataLoadingCache.delete(key);
296
+ });
297
+ }
298
+ /**
299
+ * 清除所有模型缓存
300
+ *
301
+ * @author chitanda
302
+ * @date 2025-06-20 16:06:35
303
+ */
304
+ clearAll() {
305
+ this.modelCache.clear();
306
+ this.modelLoadingCache.clear();
307
+ this.modelsLoadingCache.clear();
308
+ this.enumCache.clear();
309
+ this.enumLoadingCache.clear();
310
+ this.queryRefDataCache.clear();
311
+ this.queryRefDataLoadingCache.clear();
312
+ }
313
+ /**
314
+ * 获取所有已缓存的模型键
315
+ *
316
+ * @author chitanda
317
+ * @date 2025-06-20 16:06:55
318
+ * @returns {*} {string[]}
319
+ */
320
+ keys() {
321
+ return Array.from(this.modelCache.keys());
322
+ }
323
+ }
324
+ const modelLoader = new ModelLoader();
325
+
326
+ export { modelLoader };