@nocobase/flow-engine 2.0.0-alpha.9 → 2.0.0-beta.2

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 (305) hide show
  1. package/lib/BlockScopedFlowEngine.d.ts +23 -0
  2. package/lib/BlockScopedFlowEngine.js +92 -0
  3. package/lib/FlowDefinition.d.ts +6 -4
  4. package/lib/JSRunner.js +3 -0
  5. package/lib/ViewScopedFlowEngine.js +15 -1
  6. package/lib/acl/Acl.d.ts +12 -12
  7. package/lib/acl/Acl.js +78 -30
  8. package/lib/components/DynamicFlowsEditor.js +2 -4
  9. package/lib/components/FieldModelRenderer.js +10 -8
  10. package/lib/components/FieldSkeleton.d.ts +10 -0
  11. package/lib/components/FieldSkeleton.js +64 -0
  12. package/lib/components/FlowContextSelector.js +19 -3
  13. package/lib/components/FlowModelRenderer.d.ts +2 -1
  14. package/lib/components/FlowModelRenderer.js +34 -12
  15. package/lib/components/FormItem.js +5 -1
  16. package/lib/components/MobilePopup.d.ts +20 -0
  17. package/lib/components/MobilePopup.js +102 -0
  18. package/lib/components/MobilePopup.style.d.ts +17 -0
  19. package/lib/components/MobilePopup.style.js +186 -0
  20. package/lib/components/common/withFlowDesignMode.d.ts +1 -1
  21. package/lib/components/common/withFlowDesignMode.js +5 -5
  22. package/lib/components/index.d.ts +1 -0
  23. package/lib/components/index.js +3 -1
  24. package/lib/components/settings/independents/dropdown/FlowsDropdownButton.js +71 -53
  25. package/lib/components/settings/wrappers/component/SelectWithTitle.d.ts +19 -0
  26. package/lib/components/settings/wrappers/component/SelectWithTitle.js +136 -0
  27. package/lib/components/settings/wrappers/component/SwitchWithTitle.d.ts +10 -0
  28. package/lib/components/settings/wrappers/component/SwitchWithTitle.js +110 -0
  29. package/lib/components/settings/wrappers/contextual/DefaultSettingsIcon.js +221 -93
  30. package/lib/components/settings/wrappers/contextual/FlowsContextMenu.js +71 -54
  31. package/lib/components/settings/wrappers/contextual/FlowsFloatContextMenu.d.ts +2 -2
  32. package/lib/components/settings/wrappers/contextual/FlowsFloatContextMenu.js +63 -23
  33. package/lib/components/settings/wrappers/contextual/StepSettingsDialog.js +11 -6
  34. package/lib/components/settings/wrappers/embedded/FlowSettings.js +42 -28
  35. package/lib/components/settings/wrappers/embedded/FlowsSettings.js +3 -3
  36. package/lib/components/settings/wrappers/embedded/FlowsSettingsContent.js +52 -32
  37. package/lib/components/subModel/AddSubModelButton.d.ts +7 -0
  38. package/lib/components/subModel/AddSubModelButton.js +78 -8
  39. package/lib/components/subModel/LazyDropdown.js +14 -15
  40. package/lib/components/subModel/utils.d.ts +1 -1
  41. package/lib/components/subModel/utils.js +21 -11
  42. package/lib/components/variables/VariableInput.js +5 -3
  43. package/lib/components/variables/types.d.ts +2 -0
  44. package/lib/components/variables/utils.js +4 -2
  45. package/lib/data-source/index.d.ts +43 -4
  46. package/lib/data-source/index.js +104 -11
  47. package/lib/data-source/jioToJoiSchema.js +1 -0
  48. package/lib/emitter.d.ts +6 -0
  49. package/lib/emitter.js +12 -0
  50. package/lib/executor/FlowExecutor.js +48 -7
  51. package/lib/flow-registry/GlobalFlowRegistry.d.ts +1 -0
  52. package/lib/flow-registry/GlobalFlowRegistry.js +3 -0
  53. package/lib/flow-registry/InstanceFlowRegistry.d.ts +1 -0
  54. package/lib/flow-registry/InstanceFlowRegistry.js +3 -0
  55. package/lib/flowContext.d.ts +6 -0
  56. package/lib/flowContext.js +111 -30
  57. package/lib/flowEngine.d.ts +49 -0
  58. package/lib/flowEngine.js +265 -10
  59. package/lib/flowSettings.d.ts +4 -3
  60. package/lib/flowSettings.js +33 -11
  61. package/lib/hooks/useApplyAutoFlows.d.ts +1 -0
  62. package/lib/hooks/useApplyAutoFlows.js +2 -2
  63. package/lib/index.d.ts +4 -2
  64. package/lib/index.js +11 -5
  65. package/lib/locale/de-DE.json +62 -0
  66. package/lib/locale/en-US.json +57 -45
  67. package/lib/locale/es-ES.json +62 -0
  68. package/lib/locale/fr-FR.json +62 -0
  69. package/lib/locale/hu-HU.json +62 -0
  70. package/lib/locale/id-ID.json +62 -0
  71. package/lib/locale/index.d.ts +114 -90
  72. package/lib/locale/it-IT.json +62 -0
  73. package/lib/locale/ja-JP.json +62 -0
  74. package/lib/locale/ko-KR.json +62 -0
  75. package/lib/locale/nl-NL.json +62 -0
  76. package/lib/locale/pt-BR.json +62 -0
  77. package/lib/locale/ru-RU.json +62 -0
  78. package/lib/locale/tr-TR.json +62 -0
  79. package/lib/locale/uk-UA.json +62 -0
  80. package/lib/locale/vi-VN.json +62 -0
  81. package/lib/locale/zh-CN.json +58 -46
  82. package/lib/locale/zh-TW.json +62 -0
  83. package/lib/models/CollectionFieldModel.d.ts +6 -2
  84. package/lib/models/CollectionFieldModel.js +60 -14
  85. package/lib/models/flowModel.d.ts +43 -4
  86. package/lib/models/flowModel.js +128 -26
  87. package/lib/models/forkFlowModel.d.ts +6 -2
  88. package/lib/models/forkFlowModel.js +9 -2
  89. package/lib/provider.d.ts +3 -1
  90. package/lib/provider.js +4 -3
  91. package/lib/reactive/index.d.ts +10 -0
  92. package/lib/reactive/index.js +41 -0
  93. package/lib/reactive/observer.d.ts +19 -0
  94. package/lib/reactive/observer.js +109 -0
  95. package/lib/resources/baseRecordResource.d.ts +1 -0
  96. package/lib/resources/baseRecordResource.js +14 -3
  97. package/lib/resources/multiRecordResource.d.ts +4 -2
  98. package/lib/resources/multiRecordResource.js +15 -6
  99. package/lib/resources/singleRecordResource.js +6 -3
  100. package/lib/resources/sqlResource.d.ts +1 -0
  101. package/lib/resources/sqlResource.js +22 -25
  102. package/lib/runjs-context/contexts/base.js +42 -6
  103. package/lib/runjs-context/snippets/global/clipboard-copy-text.snippet.d.ts +11 -0
  104. package/lib/runjs-context/snippets/global/clipboard-copy-text.snippet.js +61 -0
  105. package/lib/runjs-context/snippets/index.js +3 -0
  106. package/lib/runjs-context/snippets/scene/block/render-antd-icons.snippet.d.ts +11 -0
  107. package/lib/runjs-context/snippets/scene/block/render-antd-icons.snippet.js +65 -0
  108. package/lib/runjs-context/snippets/scene/block/render-button-handler.snippet.js +6 -4
  109. package/lib/runjs-context/snippets/scene/block/render-info-card.snippet.js +15 -16
  110. package/lib/runjs-context/snippets/scene/block/render-react-jsx.snippet.d.ts +11 -0
  111. package/lib/runjs-context/snippets/scene/block/render-react-jsx.snippet.js +58 -0
  112. package/lib/runjs-context/snippets/scene/block/render-react.snippet.js +7 -7
  113. package/lib/runjs-context/snippets/scene/block/render-statistics.snippet.js +24 -29
  114. package/lib/runjs-context/snippets/scene/block/render-timeline.snippet.js +20 -21
  115. package/lib/scheduler/ModelOperationScheduler.d.ts +51 -0
  116. package/lib/scheduler/ModelOperationScheduler.js +262 -0
  117. package/lib/types.d.ts +42 -7
  118. package/lib/types.js +4 -3
  119. package/lib/utils/associationObjectVariable.d.ts +32 -0
  120. package/lib/utils/associationObjectVariable.js +157 -0
  121. package/lib/utils/createCollectionContextMeta.d.ts +1 -1
  122. package/lib/utils/createCollectionContextMeta.js +8 -4
  123. package/lib/utils/createEphemeralContext.d.ts +13 -0
  124. package/lib/utils/createEphemeralContext.js +140 -0
  125. package/lib/utils/flows.d.ts +10 -0
  126. package/lib/utils/flows.js +48 -0
  127. package/lib/utils/index.d.ts +7 -3
  128. package/lib/utils/index.js +20 -0
  129. package/lib/utils/jsxTransform.d.ts +15 -0
  130. package/lib/utils/jsxTransform.js +68 -0
  131. package/lib/utils/params-resolvers.js +3 -3
  132. package/lib/utils/parsePathnameToViewParams.d.ts +1 -1
  133. package/lib/utils/parsePathnameToViewParams.js +41 -5
  134. package/lib/utils/pruneFilter.d.ts +21 -0
  135. package/lib/utils/pruneFilter.js +52 -0
  136. package/lib/utils/safeGlobals.d.ts +5 -3
  137. package/lib/utils/safeGlobals.js +42 -1
  138. package/lib/utils/schema-utils.d.ts +6 -0
  139. package/lib/utils/schema-utils.js +71 -6
  140. package/lib/utils/serverContextParams.d.ts +3 -0
  141. package/lib/utils/serverContextParams.js +2 -0
  142. package/lib/utils/translation.d.ts +4 -1
  143. package/lib/utils/translation.js +6 -2
  144. package/lib/utils/variablesParams.d.ts +21 -5
  145. package/lib/utils/variablesParams.js +103 -34
  146. package/lib/views/DialogComponent.js +1 -5
  147. package/lib/views/DrawerComponent.js +18 -9
  148. package/lib/views/PageComponent.js +3 -4
  149. package/lib/views/ViewNavigation.d.ts +11 -15
  150. package/lib/views/ViewNavigation.js +37 -19
  151. package/lib/views/createViewMeta.d.ts +3 -2
  152. package/lib/views/createViewMeta.js +164 -53
  153. package/lib/views/useDialog.d.ts +2 -1
  154. package/lib/views/useDialog.js +36 -30
  155. package/lib/views/useDrawer.d.ts +2 -1
  156. package/lib/views/useDrawer.js +33 -26
  157. package/lib/views/usePage.d.ts +2 -1
  158. package/lib/views/usePage.js +40 -29
  159. package/package.json +6 -3
  160. package/src/BlockScopedFlowEngine.ts +88 -0
  161. package/src/JSRunner.ts +3 -0
  162. package/src/ViewScopedFlowEngine.ts +16 -0
  163. package/src/__tests__/JSRunner.test.ts +62 -53
  164. package/src/__tests__/blockScopedFlowEngine.test.ts +154 -0
  165. package/src/__tests__/createViewMeta.popup.test.ts +142 -0
  166. package/src/__tests__/flow-engine.test.ts +3 -0
  167. package/src/__tests__/flowContext.test.ts +70 -0
  168. package/src/__tests__/flowEngine.destroyModel.test.ts +74 -0
  169. package/src/__tests__/flowEngine.moveModel.test.ts +43 -0
  170. package/src/__tests__/flowEngine.removeModel.test.ts +72 -0
  171. package/src/__tests__/flowEngine.saveModel.test.ts +4 -0
  172. package/src/__tests__/flowModel.openView.navigation.test.ts +3 -2
  173. package/src/__tests__/flowSettings.open.test.tsx +2 -0
  174. package/src/__tests__/flowSettings.test.ts +2 -0
  175. package/src/__tests__/globalFlowRegistry.test.ts +1 -1
  176. package/src/__tests__/modelOperationScheduler.test.ts +346 -0
  177. package/src/__tests__/objectVariable.test.ts +464 -0
  178. package/src/__tests__/runjsRuntimeFeatures.test.ts +12 -0
  179. package/src/__tests__/viewScopedFlowEngine.test.ts +98 -0
  180. package/src/acl/Acl.tsx +85 -31
  181. package/src/acl/__tests__/Acl.test.tsx +43 -1
  182. package/src/components/DynamicFlowsEditor.tsx +0 -10
  183. package/src/components/FieldModelRenderer.tsx +15 -8
  184. package/src/components/FieldSkeleton.tsx +27 -0
  185. package/src/components/FlowContextSelector.tsx +20 -2
  186. package/src/components/FlowModelRenderer.tsx +46 -12
  187. package/src/components/FormItem.tsx +8 -1
  188. package/src/components/MobilePopup.style.ts +220 -0
  189. package/src/components/MobilePopup.tsx +86 -0
  190. package/src/components/__tests__/FlowModelRenderer.test.tsx +89 -0
  191. package/src/components/__tests__/flow-model-render-error-fallback.test.tsx +1 -1
  192. package/src/components/common/withFlowDesignMode.tsx +5 -5
  193. package/src/components/index.ts +1 -0
  194. package/src/components/settings/independents/dropdown/FlowsDropdownButton.tsx +34 -17
  195. package/src/components/settings/wrappers/component/SelectWithTitle.tsx +110 -0
  196. package/src/components/settings/wrappers/component/SwitchWithTitle.tsx +82 -0
  197. package/src/components/settings/wrappers/contextual/DefaultSettingsIcon.tsx +260 -121
  198. package/src/components/settings/wrappers/contextual/FlowsContextMenu.tsx +34 -18
  199. package/src/components/settings/wrappers/contextual/FlowsFloatContextMenu.tsx +56 -18
  200. package/src/components/settings/wrappers/contextual/StepSettings.tsx +1 -2
  201. package/src/components/settings/wrappers/contextual/StepSettingsDialog.tsx +12 -6
  202. package/src/components/settings/wrappers/contextual/__tests__/DefaultSettingsIcon.test.tsx +565 -0
  203. package/src/components/settings/wrappers/embedded/FlowSettings.tsx +47 -35
  204. package/src/components/settings/wrappers/embedded/FlowsSettings.tsx +1 -1
  205. package/src/components/settings/wrappers/embedded/FlowsSettingsContent.tsx +64 -42
  206. package/src/components/subModel/AddSubModelButton.tsx +104 -9
  207. package/src/components/subModel/LazyDropdown.tsx +14 -14
  208. package/src/components/subModel/__tests__/AddSubModelButton.test.tsx +168 -7
  209. package/src/components/subModel/__tests__/utils.test.ts +12 -12
  210. package/src/components/subModel/utils.ts +25 -6
  211. package/src/components/variables/VariableInput.tsx +5 -3
  212. package/src/components/variables/types.ts +2 -0
  213. package/src/components/variables/utils.ts +7 -3
  214. package/src/data-source/index.ts +169 -11
  215. package/src/data-source/jioToJoiSchema.ts +1 -0
  216. package/src/emitter.ts +14 -0
  217. package/src/executor/FlowExecutor.ts +56 -8
  218. package/src/executor/__tests__/ctx-defs-injection.test.ts +197 -0
  219. package/src/flow-registry/GlobalFlowRegistry.ts +1 -0
  220. package/src/flow-registry/InstanceFlowRegistry.ts +1 -0
  221. package/src/flow-registry/__tests__/globalFlowRegistry.test.ts +54 -0
  222. package/src/flowContext.ts +144 -29
  223. package/src/flowEngine.ts +328 -8
  224. package/src/flowSettings.ts +47 -19
  225. package/src/hooks/useApplyAutoFlows.ts +3 -3
  226. package/src/index.ts +4 -2
  227. package/src/locale/de-DE.json +62 -0
  228. package/src/locale/en-US.json +57 -45
  229. package/src/locale/es-ES.json +62 -0
  230. package/src/locale/fr-FR.json +62 -0
  231. package/src/locale/hu-HU.json +62 -0
  232. package/src/locale/id-ID.json +62 -0
  233. package/src/locale/it-IT.json +62 -0
  234. package/src/locale/ja-JP.json +62 -0
  235. package/src/locale/ko-KR.json +62 -0
  236. package/src/locale/nl-NL.json +62 -0
  237. package/src/locale/pt-BR.json +62 -0
  238. package/src/locale/ru-RU.json +62 -0
  239. package/src/locale/tr-TR.json +62 -0
  240. package/src/locale/uk-UA.json +62 -0
  241. package/src/locale/vi-VN.json +62 -0
  242. package/src/locale/zh-CN.json +58 -46
  243. package/src/locale/zh-TW.json +62 -0
  244. package/src/models/CollectionFieldModel.tsx +79 -17
  245. package/src/models/__tests__/dispatchEvent.behavior.test.ts +169 -0
  246. package/src/models/__tests__/flowEngine.resolveUse.test.ts +170 -0
  247. package/src/models/__tests__/flowModel.getFlows.sort.test.ts +29 -5
  248. package/src/models/__tests__/flowModel.scheduleModelOperation.test.tsx +129 -0
  249. package/src/models/__tests__/flowModel.test.ts +65 -27
  250. package/src/models/__tests__/forkFlowModel.test.ts +40 -7
  251. package/src/models/flowModel.tsx +192 -30
  252. package/src/models/forkFlowModel.ts +11 -3
  253. package/src/provider.tsx +5 -5
  254. package/src/reactive/__tests__/observer.test.tsx +211 -0
  255. package/src/reactive/index.ts +11 -0
  256. package/src/reactive/observer.tsx +101 -0
  257. package/src/resources/baseRecordResource.ts +15 -3
  258. package/src/resources/multiRecordResource.ts +17 -8
  259. package/src/resources/singleRecordResource.ts +6 -3
  260. package/src/resources/sqlResource.ts +22 -26
  261. package/src/runjs-context/contexts/base.ts +47 -6
  262. package/src/runjs-context/snippets/global/clipboard-copy-text.snippet.ts +42 -0
  263. package/src/runjs-context/snippets/index.ts +3 -0
  264. package/src/runjs-context/snippets/scene/block/render-antd-icons.snippet.ts +46 -0
  265. package/src/runjs-context/snippets/scene/block/render-button-handler.snippet.ts +6 -4
  266. package/src/runjs-context/snippets/scene/block/render-info-card.snippet.ts +15 -16
  267. package/src/runjs-context/snippets/scene/block/render-react-jsx.snippet.ts +39 -0
  268. package/src/runjs-context/snippets/scene/block/render-react.snippet.ts +7 -7
  269. package/src/runjs-context/snippets/scene/block/render-statistics.snippet.ts +24 -29
  270. package/src/runjs-context/snippets/scene/block/render-timeline.snippet.ts +20 -21
  271. package/src/scheduler/ModelOperationScheduler.ts +304 -0
  272. package/src/types.ts +50 -4
  273. package/src/utils/__tests__/createCollectionContextMeta.test.ts +51 -0
  274. package/src/utils/__tests__/flows.test.ts +65 -0
  275. package/src/utils/__tests__/jsxTransform.test.ts +38 -0
  276. package/src/utils/__tests__/parsePathnameToViewParams.test.ts +25 -0
  277. package/src/utils/__tests__/pruneFilter.test.ts +38 -0
  278. package/src/utils/__tests__/safeGlobals.test.ts +23 -1
  279. package/src/utils/__tests__/utils.test.ts +114 -15
  280. package/src/utils/__tests__/variablesParams.test.ts +120 -0
  281. package/src/utils/associationObjectVariable.ts +180 -0
  282. package/src/utils/createCollectionContextMeta.ts +8 -3
  283. package/src/utils/createEphemeralContext.ts +142 -0
  284. package/src/utils/flows.ts +23 -0
  285. package/src/utils/index.ts +11 -2
  286. package/src/utils/jsxTransform.ts +39 -0
  287. package/src/utils/params-resolvers.ts +2 -2
  288. package/src/utils/parsePathnameToViewParams.ts +50 -6
  289. package/src/utils/pruneFilter.ts +41 -0
  290. package/src/utils/safeGlobals.ts +51 -4
  291. package/src/utils/schema-utils.ts +81 -3
  292. package/src/utils/serverContextParams.ts +5 -0
  293. package/src/utils/translation.ts +7 -2
  294. package/src/utils/variablesParams.ts +125 -42
  295. package/src/views/DialogComponent.tsx +1 -4
  296. package/src/views/DrawerComponent.tsx +19 -7
  297. package/src/views/PageComponent.tsx +2 -4
  298. package/src/views/ViewNavigation.ts +49 -43
  299. package/src/views/__tests__/FlowView.usePage.test.tsx +133 -0
  300. package/src/views/__tests__/ViewNavigation.test.ts +54 -34
  301. package/src/views/__tests__/useDialog.closeDestroy.test.tsx +132 -0
  302. package/src/views/createViewMeta.ts +179 -42
  303. package/src/views/useDialog.tsx +36 -24
  304. package/src/views/useDrawer.tsx +37 -24
  305. package/src/views/usePage.tsx +46 -27
@@ -0,0 +1,23 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import { FlowEngine } from './flowEngine';
10
+ /**
11
+ * BlockScopedFlowEngine(区块作用域引擎)
12
+ *
13
+ * 设计目标:
14
+ * - 仅在“区块”作用域内隔离“模型实例表”和“事件缓存”;
15
+ * - 其余能力(动作/事件/模型类/资源/仓库/设置/日志/翻译等)全部直接代理到父引擎;
16
+ * - 使用 Proxy 实现“最小代理”,保持与父引擎的全局一致性。
17
+ *
18
+ * 注意:
19
+ * - 本地化的字段仅有:`_modelInstances`、`_applyFlowCache`、`executor`、`context`、栈指针;
20
+ * - 其它字段/方法均通过 Proxy 转发到父引擎;
21
+ * - 这样可满足“同一 uid 的模型可在不同区块隔离出现(实例/缓存隔离)”与“共享全局注册/仓库”的诉求。
22
+ */
23
+ export declare function createBlockScopedEngine(parent: FlowEngine): FlowEngine;
@@ -0,0 +1,92 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ var __defProp = Object.defineProperty;
11
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
+ var __getOwnPropNames = Object.getOwnPropertyNames;
13
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
14
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
15
+ var __export = (target, all) => {
16
+ for (var name in all)
17
+ __defProp(target, name, { get: all[name], enumerable: true });
18
+ };
19
+ var __copyProps = (to, from, except, desc) => {
20
+ if (from && typeof from === "object" || typeof from === "function") {
21
+ for (let key of __getOwnPropNames(from))
22
+ if (!__hasOwnProp.call(to, key) && key !== except)
23
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
24
+ }
25
+ return to;
26
+ };
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var BlockScopedFlowEngine_exports = {};
29
+ __export(BlockScopedFlowEngine_exports, {
30
+ createBlockScopedEngine: () => createBlockScopedEngine
31
+ });
32
+ module.exports = __toCommonJS(BlockScopedFlowEngine_exports);
33
+ var import_flowEngine = require("./flowEngine");
34
+ function createBlockScopedEngine(parent) {
35
+ const local = new import_flowEngine.FlowEngine();
36
+ if (parent.modelRepository) {
37
+ local.setModelRepository(parent.modelRepository);
38
+ }
39
+ local.context.addDelegate(parent.context);
40
+ const originalUnlink = local.unlinkFromStack.bind(local);
41
+ local.unlinkFromStack = function() {
42
+ const prev = local._previousEngine;
43
+ const next = local._nextEngine;
44
+ if (prev) prev._nextEngine = next;
45
+ if (next) next._previousEngine = prev;
46
+ local._previousEngine = void 0;
47
+ local._nextEngine = void 0;
48
+ };
49
+ const localOnly = /* @__PURE__ */ new Set([
50
+ "_modelInstances",
51
+ "_applyFlowCache",
52
+ "executor",
53
+ "context",
54
+ "previousEngine",
55
+ "nextEngine",
56
+ // 栈指针维护方法需要在本地执行,而非代理到父引擎
57
+ "unlinkFromStack",
58
+ "linkAfter",
59
+ "_previousEngine",
60
+ "_nextEngine",
61
+ // getModel 需要在本地执行以确保全局查找时正确遍历整个引擎栈
62
+ "getModel"
63
+ ]);
64
+ const handler = {
65
+ get(target, prop, receiver) {
66
+ if (localOnly.has(prop)) {
67
+ return Reflect.get(target, prop, receiver);
68
+ }
69
+ const value = Reflect.get(parent, prop, receiver);
70
+ if (prop === "registerModels" && typeof value === "function") {
71
+ return value.bind(parent);
72
+ }
73
+ return value;
74
+ },
75
+ set(target, prop, value) {
76
+ if (localOnly.has(prop)) {
77
+ return Reflect.set(target, prop, value);
78
+ }
79
+ return Reflect.set(parent, prop, value);
80
+ },
81
+ has(target, prop) {
82
+ return prop in target || prop in parent;
83
+ }
84
+ };
85
+ local.linkAfter(parent);
86
+ return new Proxy(local, handler);
87
+ }
88
+ __name(createBlockScopedEngine, "createBlockScopedEngine");
89
+ // Annotate the CommonJS export names for ESM import in node:
90
+ 0 && (module.exports = {
91
+ createBlockScopedEngine
92
+ });
@@ -240,12 +240,8 @@ export declare class FlowStep {
240
240
  use?: string;
241
241
  sort?: number;
242
242
  preset?: boolean;
243
- paramsRequired?: boolean;
244
- hideInSettings?: boolean;
245
243
  uiMode?: import("./types").StepUIMode | ((ctx: import("./flowContext").FlowRuntimeContext<import(".").FlowModel<import("./types").DefaultStructure>, any>) => import("./types").StepUIMode | Promise<import("./types").StepUIMode>);
246
244
  title?: string;
247
- defaultParams?: Record<string, any> | ((ctx: import("./flowContext").FlowRuntimeContext<import(".").FlowModel<import("./types").DefaultStructure>, any>) => Record<string, any> | Promise<Record<string, any>>);
248
- handler?: (ctx: import("./flowContext").FlowRuntimeContext<import(".").FlowModel<import("./types").DefaultStructure>, any>, params: any) => any;
249
245
  uiSchema?: Record<string, import("@formily/json-schema").Stringify<{
250
246
  [key: symbol]: any;
251
247
  [key: `x-${string}`]: any;
@@ -415,9 +411,15 @@ export declare class FlowStep {
415
411
  "x-read-pretty"?: boolean;
416
412
  "x-compile-omitted"?: string[];
417
413
  }>>>);
414
+ defaultParams?: Record<string, any> | ((ctx: import("./flowContext").FlowRuntimeContext<import(".").FlowModel<import("./types").DefaultStructure>, any>) => Record<string, any> | Promise<Record<string, any>>);
415
+ handler?: (ctx: import("./flowContext").FlowRuntimeContext<import(".").FlowModel<import("./types").DefaultStructure>, any>, params: any) => any;
418
416
  beforeParamsSave?: (ctx: import("./flowContext").FlowSettingsContext<import(".").FlowModel<import("./types").DefaultStructure>>, params: any, previousParams: any) => void | Promise<void>;
419
417
  afterParamsSave?: (ctx: import("./flowContext").FlowSettingsContext<import(".").FlowModel<import("./types").DefaultStructure>>, params: any, previousParams: any) => void | Promise<void>;
420
418
  useRawParams?: boolean | ((ctx: import("./flowContext").FlowRuntimeContext<import(".").FlowModel<import("./types").DefaultStructure>, any>) => boolean | Promise<boolean>);
421
419
  scene?: import("./types").ActionScene | import("./types").ActionScene[];
420
+ paramsRequired?: boolean;
421
+ hideInSettings?: boolean | ((ctx: import("./flowContext").FlowRuntimeContext<import(".").FlowModel<import("./types").DefaultStructure>, any>) => boolean | Promise<boolean>);
422
+ defineProperties?: Record<string, import("./flowContext").PropertyOptions> | ((ctx: import("./flowContext").FlowRuntimeContext<import(".").FlowModel<import("./types").DefaultStructure>, any>) => Record<string, import("./flowContext").PropertyOptions> | Promise<Record<string, import("./flowContext").PropertyOptions>>);
423
+ defineMethods?: Record<string, (this: import("./flowContext").FlowRuntimeContext<import(".").FlowModel<import("./types").DefaultStructure>, any>, ...args: any[]) => any> | ((ctx: import("./flowContext").FlowRuntimeContext<import(".").FlowModel<import("./types").DefaultStructure>, any>) => Record<string, (this: import("./flowContext").FlowRuntimeContext<import(".").FlowModel<import("./types").DefaultStructure>, any>, ...args: any[]) => any> | Promise<Record<string, (this: import("./flowContext").FlowRuntimeContext<import(".").FlowModel<import("./types").DefaultStructure>, any>, ...args: any[]) => any>>);
422
424
  };
423
425
  }
package/lib/JSRunner.js CHANGED
@@ -62,6 +62,9 @@ const _JSRunner = class _JSRunner {
62
62
  * 异步运行代码,带错误处理和超时机制
63
63
  */
64
64
  async run(code) {
65
+ if (location == null ? void 0 : location.search.includes("skipRunJs=true")) {
66
+ return { success: true, value: null };
67
+ }
65
68
  const wrapped = `(async () => {
66
69
  try {
67
70
  ${code};
@@ -37,6 +37,12 @@ function createViewScopedEngine(parent) {
37
37
  local.setModelRepository(parent.modelRepository);
38
38
  }
39
39
  local.context.addDelegate(parent.context);
40
+ const originalUnlink = local.unlinkFromStack.bind(local);
41
+ local.unlinkFromStack = function() {
42
+ var _a;
43
+ (_a = local.disposeScheduler) == null ? void 0 : _a.call(local);
44
+ return originalUnlink();
45
+ };
40
46
  const localOnly = /* @__PURE__ */ new Set([
41
47
  "_modelInstances",
42
48
  "_applyFlowCache",
@@ -44,11 +50,19 @@ function createViewScopedEngine(parent) {
44
50
  "context",
45
51
  "previousEngine",
46
52
  "nextEngine",
53
+ // 调度器与事件总线局部化
54
+ "emitter",
55
+ "_modelOperationScheduler",
56
+ "getScheduler",
57
+ "scheduleModelOperation",
58
+ "disposeScheduler",
47
59
  // 栈指针维护方法需要在本地执行,而非代理到父引擎
48
60
  "unlinkFromStack",
49
61
  "linkAfter",
50
62
  "_previousEngine",
51
- "_nextEngine"
63
+ "_nextEngine",
64
+ // getModel 需要在本地执行以确保全局查找时正确遍历整个引擎栈
65
+ "getModel"
52
66
  ]);
53
67
  const handler = {
54
68
  get(target, prop, receiver) {
package/lib/acl/Acl.d.ts CHANGED
@@ -1,29 +1,29 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
1
  import { FlowEngine } from '../flowEngine';
10
2
  interface CheckOptions {
11
3
  dataSourceKey: string;
12
4
  resourceName: string;
13
5
  actionName: string;
14
6
  fields?: string[];
7
+ recordPkValue?: string | number;
8
+ allowedActions: any[];
15
9
  }
16
10
  export declare class ACL {
17
11
  private flowEngine;
18
- private dataSources;
12
+ private data;
13
+ private meta;
19
14
  private loaded;
20
15
  private loadingPromise;
16
+ private lastToken;
21
17
  constructor(flowEngine: FlowEngine);
18
+ setData(data: Record<string, any>): void;
19
+ setMeta(data: Record<string, any>): void;
22
20
  load(): Promise<void>;
23
21
  getActionAlias(actionName: string): any;
24
- inResources(resourceName: string): any;
25
- getResourceActionParams(resourceName: any, actionName: any): any;
26
- getStrategyActionParams(actionName: string): {};
22
+ inResources(resourceName: string, dataSourceName: any): any;
23
+ getResourceActionParams(resourceName: any, actionName: any, dataSourceName: any): any;
24
+ getStrategyActionParams(actionName: string, dataSourceName: any): {};
25
+ getIgnoreScope: (options?: any) => boolean;
26
+ verifyScope: (actionName: string, recordPkValue: any, allowedActions: any) => boolean;
27
27
  parseAction(options: CheckOptions): any;
28
28
  parseField(options: CheckOptions): boolean;
29
29
  aclCheck(options: CheckOptions): Promise<boolean>;
package/lib/acl/Acl.js CHANGED
@@ -30,59 +30,109 @@ __export(Acl_exports, {
30
30
  ACL: () => ACL
31
31
  });
32
32
  module.exports = __toCommonJS(Acl_exports);
33
+ var import_lodash = require("lodash");
33
34
  const _ACL = class _ACL {
34
35
  constructor(flowEngine) {
35
36
  this.flowEngine = flowEngine;
36
37
  }
37
- dataSources = {};
38
+ data = {};
39
+ meta = {};
38
40
  loaded = false;
39
41
  loadingPromise = null;
42
+ // 用于识别当前鉴权状态(例如切换登录用户后应重新加载)
43
+ // 记录上一次用于鉴权的 token,用于识别登录态变更
44
+ lastToken = null;
45
+ setData(data) {
46
+ this.data = data;
47
+ }
48
+ setMeta(data) {
49
+ this.meta = data;
50
+ }
40
51
  async load() {
41
- if (this.loaded) return;
42
- if (!this.loadingPromise) {
43
- this.loadingPromise = (async () => {
44
- const { data } = await this.flowEngine.context.api.request({
45
- url: "roles:check"
46
- });
47
- this.dataSources = data || {};
48
- this.loaded = true;
49
- })();
52
+ var _a, _b, _c, _d;
53
+ const currentToken = ((_d = (_c = (_b = (_a = this.flowEngine) == null ? void 0 : _a.context) == null ? void 0 : _b.api) == null ? void 0 : _c.auth) == null ? void 0 : _d.token) || "";
54
+ if (this.loaded && this.lastToken !== currentToken) {
55
+ this.loaded = false;
56
+ this.loadingPromise = null;
57
+ this.data = {};
58
+ this.meta = {};
50
59
  }
60
+ const { data } = await this.flowEngine.context.api.request({
61
+ url: "roles:check"
62
+ });
63
+ this.data = (data == null ? void 0 : data.data) || {};
64
+ this.meta = (data == null ? void 0 : data.meta) || {};
65
+ this.loaded = true;
66
+ this.lastToken = currentToken;
51
67
  await this.loadingPromise;
52
68
  }
53
69
  getActionAlias(actionName) {
54
- var _a, _b;
55
- return ((_b = (_a = this.dataSources.data) == null ? void 0 : _a.actionAlias) == null ? void 0 : _b[actionName]) || actionName;
70
+ var _a;
71
+ return ((_a = this.data.actionAlias) == null ? void 0 : _a[actionName]) || actionName;
56
72
  }
57
- inResources(resourceName) {
58
- var _a, _b, _c;
59
- return (_c = (_b = (_a = this.dataSources.data) == null ? void 0 : _a.resources) == null ? void 0 : _b.includes) == null ? void 0 : _c.call(_b, resourceName);
73
+ inResources(resourceName, dataSourceName) {
74
+ var _a, _b;
75
+ const { dataSources: dataSourcesAcl } = (this == null ? void 0 : this.meta) || {};
76
+ const data = { ...this.data, ...(0, import_lodash.omit)(dataSourcesAcl == null ? void 0 : dataSourcesAcl[dataSourceName], "snippets") };
77
+ return (_b = (_a = data.resources) == null ? void 0 : _a.includes) == null ? void 0 : _b.call(_a, resourceName);
60
78
  }
61
- getResourceActionParams(resourceName, actionName) {
62
- var _a, _b, _c, _d;
79
+ getResourceActionParams(resourceName, actionName, dataSourceName) {
80
+ var _a, _b;
63
81
  const actionAlias = this.getActionAlias(actionName);
64
- return ((_b = (_a = this.dataSources.data) == null ? void 0 : _a.actions) == null ? void 0 : _b[`${resourceName}:${actionAlias}`]) || ((_d = (_c = this.dataSources.data) == null ? void 0 : _c.actions) == null ? void 0 : _d[actionName]);
82
+ const { dataSources: dataSourcesAcl } = (this == null ? void 0 : this.meta) || {};
83
+ const data = { ...this.data, ...(0, import_lodash.omit)(dataSourcesAcl == null ? void 0 : dataSourcesAcl[dataSourceName], "snippets") };
84
+ return ((_a = data.actions) == null ? void 0 : _a[`${resourceName}:${actionAlias}`]) || ((_b = data.actions) == null ? void 0 : _b[actionName]);
65
85
  }
66
- getStrategyActionParams(actionName) {
67
- var _a, _b, _c;
86
+ getStrategyActionParams(actionName, dataSourceName) {
87
+ var _a, _b;
68
88
  const actionAlias = this.getActionAlias(actionName);
69
- const strategyAction = (_c = (_b = (_a = this.dataSources.data) == null ? void 0 : _a.strategy) == null ? void 0 : _b.actions) == null ? void 0 : _c.find((action) => {
89
+ const { dataSources: dataSourcesAcl } = (this == null ? void 0 : this.meta) || {};
90
+ const data = { ...this.data, ...(0, import_lodash.omit)(dataSourcesAcl == null ? void 0 : dataSourcesAcl[dataSourceName], "snippets") };
91
+ const strategyAction = (_b = (_a = data == null ? void 0 : data.strategy) == null ? void 0 : _a.actions) == null ? void 0 : _b.find((action) => {
70
92
  const [value] = action.split(":");
71
93
  return value === actionAlias;
72
94
  });
73
95
  return strategyAction ? {} : null;
74
96
  }
97
+ getIgnoreScope = /* @__PURE__ */ __name((options = {}) => {
98
+ const { recordPkValue, allowedActions, actionName } = options;
99
+ let ignoreScope = false;
100
+ if (options.ignoreScope) {
101
+ ignoreScope = true;
102
+ }
103
+ if (actionName === "create") {
104
+ ignoreScope = true;
105
+ }
106
+ if (!recordPkValue || !allowedActions) {
107
+ ignoreScope = true;
108
+ }
109
+ return ignoreScope;
110
+ }, "getIgnoreScope");
111
+ verifyScope = /* @__PURE__ */ __name((actionName, recordPkValue, allowedActions) => {
112
+ const actionAlias = this.getActionAlias(actionName);
113
+ const scopeValues = allowedActions == null ? void 0 : allowedActions[actionAlias];
114
+ if (!Array.isArray(scopeValues)) {
115
+ return null;
116
+ }
117
+ return scopeValues.map((v) => String(v)).includes(String(recordPkValue));
118
+ }, "verifyScope");
75
119
  parseAction(options) {
76
120
  var _a;
77
- const { resourceName, actionName, dataSourceKey = "main" } = options;
121
+ const { resourceName, actionName, dataSourceKey = "main", recordPkValue, allowedActions } = options;
78
122
  const targetResource = (resourceName == null ? void 0 : resourceName.includes(".")) && ((_a = this.flowEngine.context.dataSourceManager.getDataSource(dataSourceKey).collectionManager.getAssociation(resourceName)) == null ? void 0 : _a.target);
79
- if (this.inResources(targetResource)) {
80
- return this.getResourceActionParams(targetResource, actionName);
123
+ if (!this.getIgnoreScope(options)) {
124
+ const r = this.verifyScope(actionName, recordPkValue, allowedActions);
125
+ if (!r) {
126
+ return null;
127
+ }
128
+ }
129
+ if (this.inResources(targetResource, dataSourceKey)) {
130
+ return this.getResourceActionParams(targetResource, actionName, dataSourceKey);
81
131
  }
82
- if (this.inResources(resourceName)) {
83
- return this.getResourceActionParams(resourceName, actionName);
132
+ if (this.inResources(resourceName, dataSourceKey)) {
133
+ return this.getResourceActionParams(resourceName, actionName, dataSourceKey);
84
134
  }
85
- return this.getStrategyActionParams(actionName);
135
+ return this.getStrategyActionParams(actionName, dataSourceKey);
86
136
  }
87
137
  parseField(options) {
88
138
  const { fields } = options;
@@ -95,9 +145,7 @@ const _ACL = class _ACL {
95
145
  return allowed;
96
146
  }
97
147
  async aclCheck(options) {
98
- await this.load();
99
- const { data } = this.dataSources;
100
- const { allowAll } = data;
148
+ const { allowAll } = this.data;
101
149
  if (allowAll) {
102
150
  return true;
103
151
  }
@@ -39,10 +39,8 @@ __export(DynamicFlowsEditor_exports, {
39
39
  DynamicFlowsEditor: () => DynamicFlowsEditor
40
40
  });
41
41
  module.exports = __toCommonJS(DynamicFlowsEditor_exports);
42
- var import_antd = require("antd");
43
- var import_react2 = __toESM(require("react"));
44
- const Panel = import_antd.Collapse.Panel;
45
- const DynamicFlowsEditor = /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, "Uncomment and fix issues after refactoring flow definitions");
42
+ var import_react = __toESM(require("react"));
43
+ const DynamicFlowsEditor = /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, "Uncomment and fix issues after refactoring flow definitions");
46
44
  // Annotate the CommonJS export names for ESM import in node:
47
45
  0 && (module.exports = {
48
46
  DynamicFlowsEditor
@@ -65,10 +65,10 @@ function FieldModelRenderer(props) {
65
65
  let val;
66
66
  if (e && e.target && typeof e.target.value !== "undefined") {
67
67
  val = e.target.value;
68
- } else if (typeof e === "string") {
68
+ } else if (typeof e === "string" || typeof e === "number" || typeof e === "boolean" || typeof e === "object" && !(e instanceof Event)) {
69
69
  val = e;
70
70
  } else {
71
- val = "";
71
+ val = null;
72
72
  }
73
73
  model.setProps({ value: val });
74
74
  if (!composingRef.current) {
@@ -78,18 +78,20 @@ function FieldModelRenderer(props) {
78
78
  const handleCompositionStart = /* @__PURE__ */ __name(() => {
79
79
  composingRef.current = true;
80
80
  }, "handleCompositionStart");
81
- const handleCompositionEnd = /* @__PURE__ */ __name((e) => {
81
+ const handleCompositionEnd = /* @__PURE__ */ __name((e, flag = true) => {
82
82
  composingRef.current = false;
83
- props.onChange(e);
83
+ if (flag) {
84
+ props.onChange(e);
85
+ }
84
86
  }, "handleCompositionEnd");
85
87
  const modelProps = {
86
- ...import_lodash.default.omit(rest, flowModelRendererPropKeys),
87
- onChange: handleChange,
88
88
  onCompositionStart: handleCompositionStart,
89
- onCompositionEnd: handleCompositionEnd
89
+ onCompositionEnd: handleCompositionEnd,
90
+ ...import_lodash.default.omit(rest, flowModelRendererPropKeys),
91
+ onChange: handleChange
90
92
  };
91
93
  (0, import_react.useEffect)(() => {
92
- model.setProps(modelProps);
94
+ model && model.setProps(modelProps);
93
95
  }, [modelProps]);
94
96
  return /* @__PURE__ */ import_react.default.createElement(import_flow_engine.FlowModelRenderer, { model, ...rest });
95
97
  }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import React from 'react';
10
+ export declare const FieldSkeleton: React.FC;
@@ -0,0 +1,64 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ var __create = Object.create;
11
+ var __defProp = Object.defineProperty;
12
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
+ var __getOwnPropNames = Object.getOwnPropertyNames;
14
+ var __getProtoOf = Object.getPrototypeOf;
15
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
16
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
17
+ var __export = (target, all) => {
18
+ for (var name in all)
19
+ __defProp(target, name, { get: all[name], enumerable: true });
20
+ };
21
+ var __copyProps = (to, from, except, desc) => {
22
+ if (from && typeof from === "object" || typeof from === "function") {
23
+ for (let key of __getOwnPropNames(from))
24
+ if (!__hasOwnProp.call(to, key) && key !== except)
25
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
26
+ }
27
+ return to;
28
+ };
29
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
30
+ // If the importer is in node compatibility mode or this is not an ESM
31
+ // file that has been converted to a CommonJS file using a Babel-
32
+ // compatible transform (i.e. "__esModule" has not been set), then set
33
+ // "default" to the CommonJS "module.exports" for node compatibility.
34
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
35
+ mod
36
+ ));
37
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
38
+ var FieldSkeleton_exports = {};
39
+ __export(FieldSkeleton_exports, {
40
+ FieldSkeleton: () => FieldSkeleton
41
+ });
42
+ module.exports = __toCommonJS(FieldSkeleton_exports);
43
+ var import_react = __toESM(require("react"));
44
+ var import_provider = require("../provider");
45
+ const FieldSkeleton = /* @__PURE__ */ __name(() => {
46
+ const flowEngine = (0, import_provider.useFlowEngine)();
47
+ const token = flowEngine.context.themeToken;
48
+ return /* @__PURE__ */ import_react.default.createElement(
49
+ "span",
50
+ {
51
+ style: {
52
+ display: "inline-block",
53
+ width: "100%",
54
+ height: 16,
55
+ backgroundColor: token.colorFillSecondary,
56
+ borderRadius: token.borderRadiusSM
57
+ }
58
+ }
59
+ );
60
+ }, "FieldSkeleton");
61
+ // Annotate the CommonJS export names for ESM import in node:
62
+ 0 && (module.exports = {
63
+ FieldSkeleton
64
+ });
@@ -43,6 +43,7 @@ module.exports = __toCommonJS(FlowContextSelector_exports);
43
43
  var import_react = __toESM(require("react"));
44
44
  var import_antd = require("antd");
45
45
  var import_icons = require("@ant-design/icons");
46
+ var import_css = require("@emotion/css");
46
47
  var import_utils = require("./variables/utils");
47
48
  var import_useResolvedMetaTree = require("./variables/useResolvedMetaTree");
48
49
  var import_FlowContextProvider = require("../FlowContextProvider");
@@ -50,6 +51,12 @@ const defaultButtonStyle = {
50
51
  fontStyle: "italic",
51
52
  fontFamily: "New York, Times New Roman, Times, serif"
52
53
  };
54
+ const cascaderPopupAutoHeightClassName = import_css.css`
55
+ .ant-cascader-menu {
56
+ height: fit-content;
57
+ max-height: 50vh;
58
+ }
59
+ `;
53
60
  const FlowContextSelectorComponent = /* @__PURE__ */ __name(({
54
61
  value,
55
62
  onChange,
@@ -60,6 +67,7 @@ const FlowContextSelectorComponent = /* @__PURE__ */ __name(({
60
67
  formatPathToValue: customFormatPathToValue,
61
68
  open,
62
69
  onlyLeafSelectable = false,
70
+ ignoreFieldNames,
63
71
  ...cascaderProps
64
72
  }) => {
65
73
  const lastSelectedRef = (0, import_react.useRef)(null);
@@ -98,8 +106,12 @@ const FlowContextSelectorComponent = /* @__PURE__ */ __name(({
98
106
  const options = (0, import_react.useMemo)(() => {
99
107
  if (!resolvedMetaTree) return [];
100
108
  const base = (0, import_utils.buildContextSelectorItems)(resolvedMetaTree);
101
- return translateOptions(base);
102
- }, [resolvedMetaTree, updateFlag, translateOptions]);
109
+ return translateOptions(base).filter((item) => {
110
+ var _a;
111
+ if (!ignoreFieldNames || ignoreFieldNames.length === 0) return true;
112
+ return !ignoreFieldNames.includes(((_a = item.meta) == null ? void 0 : _a.name) || "");
113
+ });
114
+ }, [resolvedMetaTree, updateFlag, translateOptions, ignoreFieldNames]);
103
115
  const [tempSelectedPath, setTempSelectedPath] = (0, import_react.useState)([]);
104
116
  const handleLoadData = (0, import_react.useCallback)(
105
117
  async (selectedOptions) => {
@@ -197,6 +209,9 @@ const FlowContextSelectorComponent = /* @__PURE__ */ __name(({
197
209
  },
198
210
  [onChange, customFormatPathToValue, onlyLeafSelectable]
199
211
  );
212
+ const mergedPopupClassName = (0, import_react.useMemo)(() => {
213
+ return (0, import_css.cx)(cascaderPopupAutoHeightClassName, cascaderProps.popupClassName);
214
+ }, [cascaderProps.popupClassName]);
200
215
  return /* @__PURE__ */ import_react.default.createElement(
201
216
  import_antd.Cascader,
202
217
  {
@@ -209,7 +224,8 @@ const FlowContextSelectorComponent = /* @__PURE__ */ __name(({
209
224
  changeOnSelect: !onlyLeafSelectable,
210
225
  expandTrigger: "click",
211
226
  open,
212
- showSearch: children === null
227
+ showSearch: children === null,
228
+ popupClassName: mergedPopupClassName
213
229
  },
214
230
  children === null ? null : children || defaultChildren
215
231
  );
@@ -24,7 +24,7 @@ export interface FlowModelRendererProps {
24
24
  /**
25
25
  * @default 'inside'
26
26
  */
27
- toolbarPosition?: 'inside' | 'above';
27
+ toolbarPosition?: 'inside' | 'above' | 'below';
28
28
  };
29
29
  /** 流程设置的交互风格 */
30
30
  flowSettingsVariant?: 'dropdown' | 'contextMenu' | 'modal' | 'drawer';
@@ -40,6 +40,7 @@ export interface FlowModelRendererProps {
40
40
  settingsMenuLevel?: number;
41
41
  /** 额外的工具栏项目,仅应用于此实例 */
42
42
  extraToolbarItems?: ToolbarItemConfig[];
43
+ useCache?: boolean;
43
44
  }
44
45
  /**
45
46
  * A React component responsible for rendering a FlowModel.