@nocobase/flow-engine 2.0.0-alpha.2 → 2.0.0-alpha.20

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 (387) hide show
  1. package/lib/BlockScopedFlowEngine.d.ts +23 -0
  2. package/lib/BlockScopedFlowEngine.js +90 -0
  3. package/lib/FlowContextProvider.d.ts +2 -2
  4. package/lib/FlowContextProvider.js +3 -3
  5. package/lib/FlowDefinition.d.ts +2 -2
  6. package/lib/JSRunner.js +3 -0
  7. package/lib/ViewScopedFlowEngine.d.ts +1 -1
  8. package/lib/components/FieldModelRenderer.js +10 -4
  9. package/lib/components/FieldSkeleton.d.ts +10 -0
  10. package/lib/components/FieldSkeleton.js +64 -0
  11. package/lib/components/FlowContextSelector.js +7 -2
  12. package/lib/components/FlowModelRenderer.d.ts +2 -5
  13. package/lib/components/FlowModelRenderer.js +16 -47
  14. package/lib/components/FormItem.js +5 -1
  15. package/lib/{runjs-context/snippets/global/requireAsync.snippet.d.ts → components/dnd/findModelUidPosition.d.ts} +4 -7
  16. package/lib/{runjs-context/snippets/scene/jsblock/jsx-mount.snippet.js → components/dnd/findModelUidPosition.js} +23 -19
  17. package/lib/components/dnd/gridDragPlanner.d.ts +130 -0
  18. package/lib/components/dnd/gridDragPlanner.js +497 -0
  19. package/lib/components/dnd/index.d.ts +2 -2
  20. package/lib/components/dnd/index.js +5 -5
  21. package/lib/components/settings/wrappers/contextual/StepSettingsDialog.js +7 -1
  22. package/lib/components/variables/VariableInput.js +16 -2
  23. package/lib/components/variables/VariableTag.js +43 -2
  24. package/lib/components/variables/types.d.ts +2 -0
  25. package/lib/data-source/index.d.ts +12 -4
  26. package/lib/data-source/index.js +18 -12
  27. package/lib/data-source/sortCollectionsByInherits.d.ts +10 -0
  28. package/lib/data-source/sortCollectionsByInherits.js +71 -0
  29. package/lib/executor/FlowExecutor.d.ts +4 -5
  30. package/lib/executor/FlowExecutor.js +122 -94
  31. package/lib/flowContext.d.ts +33 -5
  32. package/lib/flowContext.js +145 -74
  33. package/lib/flowEngine.d.ts +8 -1
  34. package/lib/flowEngine.js +12 -2
  35. package/lib/flowSettings.d.ts +2 -1
  36. package/lib/flowSettings.js +7 -3
  37. package/lib/hooks/useApplyAutoFlows.js +2 -1
  38. package/lib/index.d.ts +6 -1
  39. package/lib/index.js +29 -3
  40. package/lib/models/CollectionFieldModel.d.ts +2 -0
  41. package/lib/models/CollectionFieldModel.js +43 -3
  42. package/lib/models/flowModel.d.ts +28 -29
  43. package/lib/models/flowModel.js +110 -88
  44. package/lib/models/forkFlowModel.d.ts +2 -2
  45. package/lib/models/forkFlowModel.js +29 -6
  46. package/lib/provider.d.ts +3 -1
  47. package/lib/provider.js +7 -5
  48. package/lib/resources/multiRecordResource.js +2 -0
  49. package/lib/resources/singleRecordResource.js +1 -0
  50. package/lib/runjs-context/contexts/FormJSFieldItemRunJSContext.d.ts +1 -6
  51. package/lib/runjs-context/contexts/FormJSFieldItemRunJSContext.js +27 -20
  52. package/lib/runjs-context/contexts/JSBlockRunJSContext.d.ts +1 -6
  53. package/lib/runjs-context/contexts/JSBlockRunJSContext.js +46 -33
  54. package/lib/runjs-context/contexts/JSCollectionActionRunJSContext.d.ts +1 -2
  55. package/lib/runjs-context/contexts/JSCollectionActionRunJSContext.js +14 -15
  56. package/lib/runjs-context/contexts/{LinkageRunJSContext.d.ts → JSColumnRunJSContext.d.ts} +6 -3
  57. package/lib/runjs-context/contexts/JSColumnRunJSContext.js +78 -0
  58. package/lib/runjs-context/contexts/JSFieldRunJSContext.d.ts +1 -6
  59. package/lib/runjs-context/contexts/JSFieldRunJSContext.js +28 -24
  60. package/lib/runjs-context/contexts/JSItemRunJSContext.d.ts +1 -6
  61. package/lib/runjs-context/contexts/JSItemRunJSContext.js +24 -20
  62. package/lib/runjs-context/contexts/JSRecordActionRunJSContext.d.ts +1 -2
  63. package/lib/runjs-context/contexts/JSRecordActionRunJSContext.js +16 -17
  64. package/lib/runjs-context/contexts/base.d.ts +9 -0
  65. package/lib/runjs-context/contexts/base.js +169 -0
  66. package/lib/runjs-context/helpers.d.ts +5 -2
  67. package/lib/runjs-context/helpers.js +36 -27
  68. package/lib/runjs-context/registry.d.ts +7 -4
  69. package/lib/runjs-context/registry.js +10 -42
  70. package/lib/runjs-context/setup.d.ts +9 -0
  71. package/lib/runjs-context/setup.js +82 -0
  72. package/lib/runjs-context/snippets/global/{copy-record-json.snippet.js → api-request.snippet.js} +25 -10
  73. package/lib/runjs-context/snippets/global/clipboard-copy-text.snippet.js +61 -0
  74. package/lib/runjs-context/snippets/global/{view-navigation-push.snippet.js → import-esm.snippet.js} +26 -12
  75. package/lib/runjs-context/snippets/global/message-error.snippet.js +6 -0
  76. package/lib/runjs-context/snippets/global/message-success.snippet.js +6 -0
  77. package/lib/runjs-context/snippets/global/notification-open.snippet.d.ts +3 -8
  78. package/lib/runjs-context/snippets/global/notification-open.snippet.js +8 -1
  79. package/lib/runjs-context/snippets/global/open-view-dialog.snippet.js +10 -3
  80. package/lib/runjs-context/snippets/global/open-view-drawer.snippet.js +10 -3
  81. package/lib/runjs-context/snippets/global/query-selector.snippet.js +53 -0
  82. package/lib/runjs-context/snippets/global/require-amd.snippet.d.ts +11 -0
  83. package/lib/runjs-context/snippets/global/{requireAsync.snippet.js → require-amd.snippet.js} +16 -13
  84. package/lib/runjs-context/snippets/global/window-open.snippet.d.ts +3 -8
  85. package/lib/runjs-context/snippets/global/window-open.snippet.js +8 -1
  86. package/lib/runjs-context/snippets/index.d.ts +14 -3
  87. package/lib/runjs-context/snippets/index.js +160 -40
  88. package/lib/runjs-context/snippets/scene/block/add-event-listener.snippet.d.ts +11 -0
  89. package/lib/runjs-context/snippets/scene/{jsblock → block}/add-event-listener.snippet.js +11 -2
  90. package/lib/runjs-context/snippets/scene/block/api-fetch-render-list.snippet.d.ts +11 -0
  91. package/lib/runjs-context/snippets/scene/block/api-fetch-render-list.snippet.js +64 -0
  92. package/lib/runjs-context/snippets/scene/block/chartjs-bar.snippet.d.ts +11 -0
  93. package/lib/runjs-context/snippets/scene/block/chartjs-bar.snippet.js +99 -0
  94. package/lib/runjs-context/snippets/{libs → scene/block}/echarts-init.snippet.js +24 -7
  95. package/lib/runjs-context/snippets/scene/block/render-button-handler.snippet.d.ts +11 -0
  96. package/lib/runjs-context/snippets/scene/{jsblock → block}/render-button-handler.snippet.js +12 -6
  97. package/lib/runjs-context/snippets/scene/block/render-iframe.snippet.d.ts +11 -0
  98. package/lib/runjs-context/snippets/scene/block/render-iframe.snippet.js +57 -0
  99. package/lib/runjs-context/snippets/scene/block/render-info-card.snippet.d.ts +11 -0
  100. package/lib/runjs-context/snippets/scene/block/render-info-card.snippet.js +72 -0
  101. package/lib/runjs-context/snippets/scene/block/render-react.snippet.d.ts +11 -0
  102. package/lib/runjs-context/snippets/scene/{jsblock → block}/render-react.snippet.js +12 -11
  103. package/lib/runjs-context/snippets/scene/block/render-statistics.snippet.d.ts +11 -0
  104. package/lib/runjs-context/snippets/scene/block/render-statistics.snippet.js +100 -0
  105. package/lib/runjs-context/snippets/scene/block/render-timeline.snippet.d.ts +11 -0
  106. package/lib/runjs-context/snippets/scene/block/render-timeline.snippet.js +85 -0
  107. package/lib/runjs-context/snippets/scene/block/resource-example.snippet.d.ts +11 -0
  108. package/lib/runjs-context/snippets/scene/block/resource-example.snippet.js +60 -0
  109. package/lib/runjs-context/snippets/scene/block/three-users-orbit.snippet.d.ts +11 -0
  110. package/lib/runjs-context/snippets/scene/block/three-users-orbit.snippet.js +283 -0
  111. package/lib/runjs-context/snippets/scene/block/vue-component.snippet.d.ts +11 -0
  112. package/lib/runjs-context/snippets/scene/block/vue-component.snippet.js +124 -0
  113. package/lib/runjs-context/snippets/scene/detail/color-by-value.snippet.d.ts +11 -0
  114. package/lib/runjs-context/snippets/scene/{jsfield → detail}/color-by-value.snippet.js +13 -3
  115. package/lib/runjs-context/snippets/scene/detail/copy-to-clipboard.snippet.d.ts +11 -0
  116. package/lib/runjs-context/snippets/{global → scene/detail}/copy-to-clipboard.snippet.js +28 -6
  117. package/lib/runjs-context/snippets/scene/detail/format-number.snippet.d.ts +11 -0
  118. package/lib/runjs-context/snippets/scene/{jsfield → detail}/format-number.snippet.js +13 -3
  119. package/lib/runjs-context/snippets/scene/detail/innerHTML-value.snippet.d.ts +11 -0
  120. package/lib/runjs-context/snippets/scene/{jsfield → detail}/innerHTML-value.snippet.js +13 -3
  121. package/lib/runjs-context/snippets/scene/detail/percentage-bar.snippet.d.ts +11 -0
  122. package/lib/runjs-context/snippets/scene/detail/percentage-bar.snippet.js +82 -0
  123. package/lib/runjs-context/snippets/scene/detail/relative-time.snippet.d.ts +11 -0
  124. package/lib/runjs-context/snippets/scene/detail/relative-time.snippet.js +80 -0
  125. package/lib/runjs-context/snippets/scene/detail/status-tag.snippet.d.ts +11 -0
  126. package/lib/runjs-context/snippets/scene/detail/status-tag.snippet.js +74 -0
  127. package/lib/runjs-context/snippets/scene/form/calculate-total.snippet.d.ts +11 -0
  128. package/lib/runjs-context/snippets/scene/form/calculate-total.snippet.js +63 -0
  129. package/lib/runjs-context/snippets/scene/form/cascade-select.snippet.d.ts +11 -0
  130. package/lib/runjs-context/snippets/scene/form/cascade-select.snippet.js +81 -0
  131. package/lib/runjs-context/snippets/scene/form/conditional-required.snippet.d.ts +11 -0
  132. package/lib/runjs-context/snippets/scene/form/conditional-required.snippet.js +64 -0
  133. package/lib/runjs-context/snippets/scene/form/copy-field-values.snippet.d.ts +11 -0
  134. package/lib/runjs-context/snippets/scene/form/copy-field-values.snippet.js +74 -0
  135. package/lib/runjs-context/snippets/scene/form/render-basic.snippet.d.ts +11 -0
  136. package/lib/runjs-context/snippets/scene/{jsitem → form}/render-basic.snippet.js +11 -2
  137. package/lib/runjs-context/snippets/scene/form/set-disabled.snippet.d.ts +11 -0
  138. package/lib/runjs-context/snippets/scene/{linkage → form}/set-disabled.snippet.js +12 -3
  139. package/lib/runjs-context/snippets/scene/form/set-field-value.snippet.d.ts +11 -0
  140. package/lib/runjs-context/snippets/scene/{linkage → form}/set-field-value.snippet.js +12 -3
  141. package/lib/runjs-context/snippets/scene/form/set-required.snippet.d.ts +11 -0
  142. package/lib/runjs-context/snippets/scene/{linkage → form}/set-required.snippet.js +12 -3
  143. package/lib/runjs-context/snippets/scene/form/toggle-multiple-fields.snippet.d.ts +11 -0
  144. package/lib/runjs-context/snippets/scene/form/toggle-multiple-fields.snippet.js +67 -0
  145. package/lib/runjs-context/snippets/scene/form/toggle-visible.snippet.d.ts +11 -0
  146. package/lib/runjs-context/snippets/scene/{linkage → form}/toggle-visible.snippet.js +12 -3
  147. package/lib/runjs-context/snippets/scene/table/cell-open-dialog.snippet.d.ts +11 -0
  148. package/lib/runjs-context/snippets/scene/table/cell-open-dialog.snippet.js +64 -0
  149. package/lib/runjs-context/snippets/scene/table/collection-selected-count.snippet.d.ts +11 -0
  150. package/lib/runjs-context/snippets/scene/{actions → table}/collection-selected-count.snippet.js +11 -2
  151. package/lib/runjs-context/snippets/scene/table/concat-fields.snippet.d.ts +11 -0
  152. package/lib/runjs-context/snippets/scene/table/concat-fields.snippet.js +79 -0
  153. package/lib/runjs-context/snippets/scene/table/destroy-selected.snippet.d.ts +11 -0
  154. package/lib/runjs-context/snippets/{global/log-json-record.snippet.js → scene/table/destroy-selected.snippet.js} +24 -11
  155. package/lib/runjs-context/snippets/scene/table/export-selected-json.snippet.d.ts +11 -0
  156. package/lib/runjs-context/snippets/scene/table/export-selected-json.snippet.js +64 -0
  157. package/lib/runjs-context/snippets/scene/table/iterate-selected-rows.snippet.d.ts +11 -0
  158. package/lib/runjs-context/snippets/scene/{actions → table}/iterate-selected-rows.snippet.js +11 -2
  159. package/lib/runjs-context/snippets/types.d.ts +9 -1
  160. package/lib/types.d.ts +15 -3
  161. package/lib/types.js +4 -3
  162. package/lib/utils/buildSettingsViewInputArgs.d.ts +19 -0
  163. package/lib/utils/buildSettingsViewInputArgs.js +75 -0
  164. package/lib/utils/index.d.ts +3 -2
  165. package/lib/utils/index.js +5 -2
  166. package/lib/utils/params-resolvers.js +2 -2
  167. package/lib/utils/safeGlobals.d.ts +5 -3
  168. package/lib/utils/safeGlobals.js +40 -0
  169. package/lib/utils/serverContextParams.d.ts +1 -0
  170. package/lib/utils/variablesParams.d.ts +9 -5
  171. package/lib/utils/variablesParams.js +47 -36
  172. package/lib/views/PageComponent.js +2 -1
  173. package/lib/views/createViewMeta.d.ts +29 -1
  174. package/lib/views/createViewMeta.js +321 -72
  175. package/lib/views/index.d.ts +1 -0
  176. package/lib/views/index.js +3 -0
  177. package/lib/views/useDialog.d.ts +8 -8
  178. package/lib/views/useDialog.js +8 -7
  179. package/lib/views/useDrawer.d.ts +8 -8
  180. package/lib/views/useDrawer.js +40 -26
  181. package/lib/views/usePage.d.ts +8 -8
  182. package/lib/views/usePage.js +8 -7
  183. package/package.json +4 -3
  184. package/src/BlockScopedFlowEngine.ts +86 -0
  185. package/src/FlowContextProvider.tsx +4 -2
  186. package/src/JSRunner.ts +3 -0
  187. package/src/ViewScopedFlowEngine.ts +1 -1
  188. package/src/__tests__/JSRunner.test.ts +62 -53
  189. package/src/__tests__/blockScopedFlowEngine.test.ts +154 -0
  190. package/src/__tests__/flow-engine.test.ts +3 -0
  191. package/src/__tests__/flowContextCreateJSRunner.test.ts +163 -0
  192. package/src/__tests__/flowEngine.saveModel.test.ts +4 -0
  193. package/src/__tests__/flowRunJSContextDefine.test.ts +508 -0
  194. package/src/__tests__/globalFlowRegistry.test.ts +1 -1
  195. package/src/__tests__/runjsContext.test.ts +216 -35
  196. package/src/__tests__/runjsContextImplementations.test.ts +217 -0
  197. package/src/__tests__/runjsContextRuntime.test.ts +269 -0
  198. package/src/__tests__/runjsEdgeCases.test.ts +281 -0
  199. package/src/__tests__/runjsLocales.test.ts +36 -0
  200. package/src/__tests__/runjsRuntimeFeatures.test.ts +449 -0
  201. package/src/__tests__/runjsSnippets.test.ts +140 -0
  202. package/src/__tests__/viewScopedFlowEngine.test.ts +3 -3
  203. package/src/components/DynamicFlowsEditor.tsx +3 -4
  204. package/src/components/FieldModelRenderer.tsx +16 -5
  205. package/src/components/FieldSkeleton.tsx +27 -0
  206. package/src/components/FlowContextSelector.tsx +6 -2
  207. package/src/components/FlowModelRenderer.tsx +30 -78
  208. package/src/components/FormItem.tsx +8 -1
  209. package/src/components/__tests__/flow-model-render-error-fallback.test.tsx +5 -5
  210. package/src/components/__tests__/gridDragPlanner.test.ts +494 -0
  211. package/src/components/dnd/README.md +149 -0
  212. package/src/components/dnd/findModelUidPosition.ts +26 -0
  213. package/src/components/dnd/gridDragPlanner.ts +659 -0
  214. package/src/components/dnd/index.tsx +3 -3
  215. package/src/components/settings/wrappers/contextual/StepSettingsDialog.tsx +14 -1
  216. package/src/components/subModel/__tests__/AddSubModelButton.test.tsx +1 -0
  217. package/src/components/variables/VariableInput.tsx +22 -2
  218. package/src/components/variables/VariableTag.tsx +54 -2
  219. package/src/components/variables/types.ts +2 -0
  220. package/src/data-source/__tests__/sortCollectionsByInherits.test.ts +125 -0
  221. package/src/data-source/index.ts +16 -10
  222. package/src/data-source/sortCollectionsByInherits.ts +61 -0
  223. package/src/executor/FlowExecutor.ts +160 -114
  224. package/src/executor/__tests__/flowExecutor.test.ts +151 -5
  225. package/src/flowContext.ts +196 -93
  226. package/src/flowEngine.ts +13 -2
  227. package/src/flowSettings.ts +8 -3
  228. package/src/hooks/useApplyAutoFlows.ts +3 -1
  229. package/src/index.ts +11 -1
  230. package/src/models/CollectionFieldModel.tsx +43 -4
  231. package/src/models/__tests__/flowModel.getFlows.sort.test.ts +4 -4
  232. package/src/models/__tests__/flowModel.test.ts +218 -95
  233. package/src/models/flowModel.tsx +146 -122
  234. package/src/models/forkFlowModel.ts +37 -5
  235. package/src/provider.tsx +10 -7
  236. package/src/resources/multiRecordResource.ts +2 -0
  237. package/src/resources/singleRecordResource.ts +1 -0
  238. package/src/runjs-context/contexts/FormJSFieldItemRunJSContext.ts +28 -21
  239. package/src/runjs-context/contexts/JSBlockRunJSContext.ts +46 -34
  240. package/src/runjs-context/contexts/JSCollectionActionRunJSContext.ts +15 -16
  241. package/src/runjs-context/contexts/JSColumnRunJSContext.ts +58 -0
  242. package/src/runjs-context/contexts/JSFieldRunJSContext.ts +30 -25
  243. package/src/runjs-context/contexts/JSItemRunJSContext.ts +25 -21
  244. package/src/runjs-context/contexts/JSRecordActionRunJSContext.ts +17 -18
  245. package/src/runjs-context/contexts/base.ts +155 -0
  246. package/src/runjs-context/helpers.ts +32 -30
  247. package/src/runjs-context/registry.ts +16 -47
  248. package/src/runjs-context/setup.ts +51 -0
  249. package/src/runjs-context/snippets/global/api-request.snippet.ts +38 -0
  250. package/src/runjs-context/snippets/global/clipboard-copy-text.snippet.ts +42 -0
  251. package/src/runjs-context/snippets/global/import-esm.snippet.ts +39 -0
  252. package/src/runjs-context/snippets/global/message-error.snippet.ts +6 -0
  253. package/src/runjs-context/snippets/global/message-success.snippet.ts +6 -0
  254. package/src/runjs-context/snippets/global/notification-open.snippet.ts +11 -1
  255. package/src/runjs-context/snippets/global/open-view-dialog.snippet.ts +10 -3
  256. package/src/runjs-context/snippets/global/open-view-drawer.snippet.ts +10 -3
  257. package/src/runjs-context/snippets/global/query-selector.snippet.ts +34 -0
  258. package/src/runjs-context/snippets/global/require-amd.snippet.ts +30 -0
  259. package/src/runjs-context/snippets/global/window-open.snippet.ts +11 -1
  260. package/src/runjs-context/snippets/index.ts +176 -39
  261. package/src/runjs-context/snippets/scene/{jsblock → block}/add-event-listener.snippet.ts +14 -2
  262. package/src/runjs-context/snippets/scene/block/api-fetch-render-list.snippet.ts +45 -0
  263. package/src/runjs-context/snippets/scene/block/chartjs-bar.snippet.ts +80 -0
  264. package/src/runjs-context/snippets/scene/block/echarts-init.snippet.ts +44 -0
  265. package/src/runjs-context/snippets/scene/{jsblock → block}/render-button-handler.snippet.ts +15 -6
  266. package/src/runjs-context/snippets/scene/block/render-iframe.snippet.ts +38 -0
  267. package/src/runjs-context/snippets/scene/block/render-info-card.snippet.ts +53 -0
  268. package/src/runjs-context/snippets/scene/{jsblock → block}/render-react.snippet.ts +15 -11
  269. package/src/runjs-context/snippets/scene/block/render-statistics.snippet.ts +81 -0
  270. package/src/runjs-context/snippets/scene/block/render-timeline.snippet.ts +66 -0
  271. package/src/runjs-context/snippets/scene/block/resource-example.snippet.ts +46 -0
  272. package/src/runjs-context/snippets/scene/block/three-users-orbit.snippet.ts +264 -0
  273. package/src/runjs-context/snippets/scene/block/vue-component.snippet.ts +105 -0
  274. package/src/runjs-context/snippets/scene/detail/color-by-value.snippet.ts +33 -0
  275. package/src/runjs-context/snippets/scene/detail/copy-to-clipboard.snippet.ts +45 -0
  276. package/src/runjs-context/snippets/scene/detail/format-number.snippet.ts +32 -0
  277. package/src/runjs-context/snippets/scene/detail/innerHTML-value.snippet.ts +31 -0
  278. package/src/runjs-context/snippets/scene/detail/percentage-bar.snippet.ts +63 -0
  279. package/src/runjs-context/snippets/scene/detail/relative-time.snippet.ts +61 -0
  280. package/src/runjs-context/snippets/scene/detail/status-tag.snippet.ts +55 -0
  281. package/src/runjs-context/snippets/scene/form/calculate-total.snippet.ts +44 -0
  282. package/src/runjs-context/snippets/scene/form/cascade-select.snippet.ts +62 -0
  283. package/src/runjs-context/snippets/scene/form/conditional-required.snippet.ts +45 -0
  284. package/src/runjs-context/snippets/scene/form/copy-field-values.snippet.ts +55 -0
  285. package/src/runjs-context/snippets/scene/{jsitem → form}/render-basic.snippet.ts +14 -2
  286. package/src/runjs-context/snippets/scene/{linkage → form}/set-disabled.snippet.ts +15 -3
  287. package/src/runjs-context/snippets/scene/{linkage → form}/set-field-value.snippet.ts +15 -3
  288. package/src/runjs-context/snippets/scene/{linkage → form}/set-required.snippet.ts +15 -3
  289. package/src/runjs-context/snippets/scene/form/toggle-multiple-fields.snippet.ts +48 -0
  290. package/src/runjs-context/snippets/scene/{linkage → form}/toggle-visible.snippet.ts +15 -3
  291. package/src/runjs-context/snippets/scene/table/cell-open-dialog.snippet.ts +45 -0
  292. package/src/runjs-context/snippets/scene/{actions → table}/collection-selected-count.snippet.ts +14 -2
  293. package/src/runjs-context/snippets/scene/table/concat-fields.snippet.ts +60 -0
  294. package/src/runjs-context/snippets/scene/table/destroy-selected.snippet.ts +36 -0
  295. package/src/runjs-context/snippets/scene/table/export-selected-json.snippet.ts +45 -0
  296. package/src/runjs-context/snippets/scene/{actions → table}/iterate-selected-rows.snippet.ts +14 -2
  297. package/src/runjs-context/snippets/types.ts +5 -1
  298. package/src/types.ts +13 -0
  299. package/src/utils/__tests__/safeGlobals.test.ts +22 -1
  300. package/src/utils/buildSettingsViewInputArgs.ts +72 -0
  301. package/src/utils/index.ts +2 -2
  302. package/src/utils/params-resolvers.ts +1 -1
  303. package/src/utils/safeGlobals.ts +49 -3
  304. package/src/utils/serverContextParams.ts +1 -0
  305. package/src/utils/variablesParams.ts +50 -38
  306. package/src/views/PageComponent.tsx +1 -1
  307. package/src/views/createViewMeta.ts +372 -70
  308. package/src/views/index.tsx +1 -0
  309. package/src/views/useDialog.tsx +12 -10
  310. package/src/views/useDrawer.tsx +60 -36
  311. package/src/views/usePage.tsx +13 -10
  312. package/lib/components/dnd/getMousePositionOnElement.d.ts +0 -50
  313. package/lib/components/dnd/getMousePositionOnElement.js +0 -95
  314. package/lib/components/dnd/moveBlock.d.ts +0 -33
  315. package/lib/components/dnd/moveBlock.js +0 -302
  316. package/lib/runjs-context/contexts/FlowRunJSContext.d.ts +0 -38
  317. package/lib/runjs-context/contexts/FlowRunJSContext.js +0 -217
  318. package/lib/runjs-context/contexts/LinkageRunJSContext.js +0 -62
  319. package/lib/runjs-context/index.d.ts +0 -19
  320. package/lib/runjs-context/index.js +0 -57
  321. package/lib/runjs-context/snippets/global/api-request-get.snippet.d.ts +0 -16
  322. package/lib/runjs-context/snippets/global/api-request-get.snippet.js +0 -42
  323. package/lib/runjs-context/snippets/global/api-request-post.snippet.d.ts +0 -16
  324. package/lib/runjs-context/snippets/global/api-request-post.snippet.js +0 -42
  325. package/lib/runjs-context/snippets/global/console-log-ctx.snippet.d.ts +0 -16
  326. package/lib/runjs-context/snippets/global/console-log-ctx.snippet.js +0 -41
  327. package/lib/runjs-context/snippets/global/sleep.snippet.d.ts +0 -16
  328. package/lib/runjs-context/snippets/global/sleep.snippet.js +0 -43
  329. package/lib/runjs-context/snippets/global/try-catch-async.snippet.d.ts +0 -16
  330. package/lib/runjs-context/snippets/global/try-catch-async.snippet.js +0 -44
  331. package/lib/runjs-context/snippets/libs/echarts-init.snippet.d.ts +0 -15
  332. package/lib/runjs-context/snippets/scene/actions/collection-selected-count.snippet.d.ts +0 -15
  333. package/lib/runjs-context/snippets/scene/actions/iterate-selected-rows.snippet.d.ts +0 -15
  334. package/lib/runjs-context/snippets/scene/actions/record-id-message.snippet.d.ts +0 -15
  335. package/lib/runjs-context/snippets/scene/actions/record-id-message.snippet.js +0 -43
  336. package/lib/runjs-context/snippets/scene/actions/run-action-basic.snippet.d.ts +0 -15
  337. package/lib/runjs-context/snippets/scene/actions/run-action-basic.snippet.js +0 -40
  338. package/lib/runjs-context/snippets/scene/jsblock/add-event-listener.snippet.d.ts +0 -15
  339. package/lib/runjs-context/snippets/scene/jsblock/append-style.snippet.d.ts +0 -15
  340. package/lib/runjs-context/snippets/scene/jsblock/append-style.snippet.js +0 -42
  341. package/lib/runjs-context/snippets/scene/jsblock/jsx-mount.snippet.d.ts +0 -15
  342. package/lib/runjs-context/snippets/scene/jsblock/jsx-unmount.snippet.d.ts +0 -15
  343. package/lib/runjs-context/snippets/scene/jsblock/jsx-unmount.snippet.js +0 -41
  344. package/lib/runjs-context/snippets/scene/jsblock/render-basic.snippet.d.ts +0 -15
  345. package/lib/runjs-context/snippets/scene/jsblock/render-basic.snippet.js +0 -41
  346. package/lib/runjs-context/snippets/scene/jsblock/render-button-handler.snippet.d.ts +0 -15
  347. package/lib/runjs-context/snippets/scene/jsblock/render-card.snippet.js +0 -45
  348. package/lib/runjs-context/snippets/scene/jsblock/render-react.snippet.d.ts +0 -15
  349. package/lib/runjs-context/snippets/scene/jsfield/color-by-value.snippet.d.ts +0 -15
  350. package/lib/runjs-context/snippets/scene/jsfield/format-number.snippet.d.ts +0 -15
  351. package/lib/runjs-context/snippets/scene/jsfield/innerHTML-value.snippet.d.ts +0 -15
  352. package/lib/runjs-context/snippets/scene/jsitem/render-basic.snippet.d.ts +0 -15
  353. package/lib/runjs-context/snippets/scene/linkage/set-disabled.snippet.d.ts +0 -15
  354. package/lib/runjs-context/snippets/scene/linkage/set-field-value.snippet.d.ts +0 -15
  355. package/lib/runjs-context/snippets/scene/linkage/set-required.snippet.d.ts +0 -15
  356. package/lib/runjs-context/snippets/scene/linkage/toggle-visible.snippet.d.ts +0 -15
  357. package/src/components/dnd/getMousePositionOnElement.ts +0 -115
  358. package/src/components/dnd/moveBlock.ts +0 -379
  359. package/src/runjs-context/contexts/FlowRunJSContext.ts +0 -190
  360. package/src/runjs-context/contexts/LinkageRunJSContext.ts +0 -35
  361. package/src/runjs-context/index.ts +0 -20
  362. package/src/runjs-context/snippets/global/api-request-get.snippet.ts +0 -20
  363. package/src/runjs-context/snippets/global/api-request-post.snippet.ts +0 -20
  364. package/src/runjs-context/snippets/global/console-log-ctx.snippet.ts +0 -19
  365. package/src/runjs-context/snippets/global/copy-record-json.snippet.ts +0 -21
  366. package/src/runjs-context/snippets/global/copy-to-clipboard.snippet.ts +0 -21
  367. package/src/runjs-context/snippets/global/log-json-record.snippet.ts +0 -21
  368. package/src/runjs-context/snippets/global/requireAsync.snippet.ts +0 -24
  369. package/src/runjs-context/snippets/global/sleep.snippet.ts +0 -21
  370. package/src/runjs-context/snippets/global/try-catch-async.snippet.ts +0 -22
  371. package/src/runjs-context/snippets/global/view-navigation-push.snippet.ts +0 -23
  372. package/src/runjs-context/snippets/libs/echarts-init.snippet.ts +0 -24
  373. package/src/runjs-context/snippets/scene/actions/record-id-message.snippet.ts +0 -21
  374. package/src/runjs-context/snippets/scene/actions/run-action-basic.snippet.ts +0 -18
  375. package/src/runjs-context/snippets/scene/jsblock/append-style.snippet.ts +0 -20
  376. package/src/runjs-context/snippets/scene/jsblock/jsx-mount.snippet.ts +0 -24
  377. package/src/runjs-context/snippets/scene/jsblock/jsx-unmount.snippet.ts +0 -19
  378. package/src/runjs-context/snippets/scene/jsblock/render-basic.snippet.ts +0 -24
  379. package/src/runjs-context/snippets/scene/jsblock/render-card.snippet.ts +0 -30
  380. package/src/runjs-context/snippets/scene/jsfield/color-by-value.snippet.ts +0 -20
  381. package/src/runjs-context/snippets/scene/jsfield/format-number.snippet.ts +0 -19
  382. package/src/runjs-context/snippets/scene/jsfield/innerHTML-value.snippet.ts +0 -18
  383. /package/lib/runjs-context/snippets/global/{copy-record-json.snippet.d.ts → api-request.snippet.d.ts} +0 -0
  384. /package/lib/runjs-context/snippets/global/{copy-to-clipboard.snippet.d.ts → clipboard-copy-text.snippet.d.ts} +0 -0
  385. /package/lib/runjs-context/snippets/global/{log-json-record.snippet.d.ts → import-esm.snippet.d.ts} +0 -0
  386. /package/lib/runjs-context/snippets/global/{view-navigation-push.snippet.d.ts → query-selector.snippet.d.ts} +0 -0
  387. /package/lib/runjs-context/snippets/scene/{jsblock/render-card.snippet.d.ts → block/echarts-init.snippet.d.ts} +0 -0
@@ -130,6 +130,7 @@ const _MultiRecordResource = class _MultiRecordResource extends import_baseRecor
130
130
  async create(data, options) {
131
131
  const config = this.mergeRequestConfig({ data }, this.createActionOptions, options);
132
132
  await this.runAction("create", config);
133
+ this.emit("saved", data);
133
134
  await this.refresh();
134
135
  }
135
136
  async get(filterByTk) {
@@ -155,6 +156,7 @@ const _MultiRecordResource = class _MultiRecordResource extends import_baseRecor
155
156
  options
156
157
  );
157
158
  await this.runAction("update", config);
159
+ this.emit("saved", data);
158
160
  await this.refresh();
159
161
  }
160
162
  async destroySelectedRows() {
@@ -69,6 +69,7 @@ const _SingleRecordResource = class _SingleRecordResource extends import_baseRec
69
69
  ...config,
70
70
  data
71
71
  });
72
+ this.emit("saved", data);
72
73
  if ((options == null ? void 0 : options.refresh) !== false) {
73
74
  await this.refresh();
74
75
  }
@@ -6,11 +6,6 @@
6
6
  * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
- import { FlowRunJSContext } from './FlowRunJSContext';
9
+ import { FlowRunJSContext } from '../../flowContext';
10
10
  export declare class FormJSFieldItemRunJSContext extends FlowRunJSContext {
11
- static injectDefaultGlobals(): {
12
- window: {};
13
- document: {};
14
- };
15
- constructor(delegate: any);
16
11
  }
@@ -30,36 +30,43 @@ __export(FormJSFieldItemRunJSContext_exports, {
30
30
  FormJSFieldItemRunJSContext: () => FormJSFieldItemRunJSContext
31
31
  });
32
32
  module.exports = __toCommonJS(FormJSFieldItemRunJSContext_exports);
33
- var import_FlowRunJSContext = require("./FlowRunJSContext");
34
- var import_utils = require("../../utils");
35
- const _FormJSFieldItemRunJSContext = class _FormJSFieldItemRunJSContext extends import_FlowRunJSContext.FlowRunJSContext {
36
- static injectDefaultGlobals() {
37
- return { window: (0, import_utils.createSafeWindow)(), document: (0, import_utils.createSafeDocument)() };
38
- }
39
- constructor(delegate) {
40
- super(delegate);
41
- this.defineProperty("element", { get: /* @__PURE__ */ __name(() => this._delegate["element"], "get") });
42
- this.defineProperty("record", { get: /* @__PURE__ */ __name(() => this._delegate["record"], "get") });
43
- this.defineProperty("value", { get: /* @__PURE__ */ __name(() => this._delegate["value"], "get") });
44
- }
33
+ var import_flowContext = require("../../flowContext");
34
+ const _FormJSFieldItemRunJSContext = class _FormJSFieldItemRunJSContext extends import_flowContext.FlowRunJSContext {
45
35
  };
46
36
  __name(_FormJSFieldItemRunJSContext, "FormJSFieldItemRunJSContext");
47
37
  let FormJSFieldItemRunJSContext = _FormJSFieldItemRunJSContext;
48
38
  FormJSFieldItemRunJSContext.define({
49
39
  label: "FormJSFieldItem RunJS context",
50
40
  properties: {
51
- element: "ElementProxy\uFF0C\u8868\u5355\u5B57\u6BB5\u5BB9\u5668",
52
- value: "\u5B57\u6BB5\u503C\uFF08\u8BFB/\u53D7\u63A7\u573A\u666F\u9700\u901A\u8FC7 setProps \u4FEE\u6539\uFF09",
53
- record: "\u5F53\u524D\u8BB0\u5F55\uFF08\u53EA\u8BFB\uFF09"
41
+ element: `ElementProxy instance providing a safe DOM container for form field rendering.
42
+ Supports innerHTML, append, and other DOM manipulation methods.`,
43
+ value: `Current field value (read-only in display mode; in controlled scenarios, use setProps to modify).`,
44
+ record: `Current record data object (read-only).
45
+ Contains all field values of the parent record.`
54
46
  },
55
47
  methods: {
56
- onRefReady: "\u5BB9\u5668\u5C31\u7EEA\u56DE\u8C03",
57
- setProps: "\u8BBE\u7F6E\u8868\u5355\u9879\u5C5E\u6027\uFF1A`setProps(fieldModel, { value })`\uFF08\u7531\u8054\u52A8/\u8868\u5355\u4E0A\u4E0B\u6587\u63D0\u4F9B\uFF09"
58
- },
59
- snipastes: {
60
- \u663E\u793A\u5B57\u6BB5\u503C: { $ref: "scene/jsfield/innerHTML-value", prefix: "sn-form-value" }
48
+ onRefReady: `Wait for form field container DOM element to be ready before executing callback.
49
+ Parameters: (ref: React.RefObject, callback: (element: HTMLElement) => void, timeout?: number) => void`,
50
+ setProps: `Set form field properties programmatically.
51
+ Parameters: (fieldModel: any, props: { value?: any, disabled?: boolean, visible?: boolean }) => void
52
+ Example: ctx.setProps(fieldModel, { value: "new value" })`
61
53
  }
62
54
  });
55
+ FormJSFieldItemRunJSContext.define(
56
+ {
57
+ label: "\u8868\u5355 JS \u5B57\u6BB5\u9879 RunJS \u4E0A\u4E0B\u6587",
58
+ properties: {
59
+ element: "ElementProxy\uFF0C\u8868\u5355\u5B57\u6BB5\u5BB9\u5668",
60
+ value: "\u5B57\u6BB5\u503C\uFF08\u5C55\u793A\u6A21\u5F0F\u4E3A\u53EA\u8BFB\uFF1B\u53D7\u63A7\u573A\u666F\u7528 setProps \u4FEE\u6539\uFF09",
61
+ record: "\u5F53\u524D\u8BB0\u5F55\uFF08\u53EA\u8BFB\uFF09"
62
+ },
63
+ methods: {
64
+ onRefReady: "\u5BB9\u5668\u5C31\u7EEA\u56DE\u8C03",
65
+ setProps: "\u8BBE\u7F6E\u8868\u5355\u9879\u5C5E\u6027\uFF1A`setProps(fieldModel, { value })`\uFF08\u7531\u8054\u52A8/\u8868\u5355\u4E0A\u4E0B\u6587\u63D0\u4F9B\uFF09"
66
+ }
67
+ },
68
+ { locale: "zh-CN" }
69
+ );
63
70
  // Annotate the CommonJS export names for ESM import in node:
64
71
  0 && (module.exports = {
65
72
  FormJSFieldItemRunJSContext
@@ -6,11 +6,6 @@
6
6
  * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
- import { FlowRunJSContext } from './FlowRunJSContext';
9
+ import { FlowRunJSContext } from '../../flowContext';
10
10
  export declare class JSBlockRunJSContext extends FlowRunJSContext {
11
- static injectDefaultGlobals(): {
12
- window: {};
13
- document: {};
14
- };
15
- constructor(delegate: any);
16
11
  }
@@ -30,48 +30,61 @@ __export(JSBlockRunJSContext_exports, {
30
30
  JSBlockRunJSContext: () => JSBlockRunJSContext
31
31
  });
32
32
  module.exports = __toCommonJS(JSBlockRunJSContext_exports);
33
- var import_FlowRunJSContext = require("./FlowRunJSContext");
34
- var import_utils = require("../../utils");
35
- const _JSBlockRunJSContext = class _JSBlockRunJSContext extends import_FlowRunJSContext.FlowRunJSContext {
36
- static injectDefaultGlobals() {
37
- return { window: (0, import_utils.createSafeWindow)(), document: (0, import_utils.createSafeDocument)() };
38
- }
39
- constructor(delegate) {
40
- super(delegate);
41
- this.defineProperty("element", { get: /* @__PURE__ */ __name(() => this._delegate["element"], "get") });
42
- this.defineProperty("record", { get: /* @__PURE__ */ __name(() => this._delegate["record"], "get") });
43
- this.defineProperty("value", { get: /* @__PURE__ */ __name(() => this._delegate["value"], "get") });
44
- }
33
+ var import_flowContext = require("../../flowContext");
34
+ const _JSBlockRunJSContext = class _JSBlockRunJSContext extends import_flowContext.FlowRunJSContext {
45
35
  };
46
36
  __name(_JSBlockRunJSContext, "JSBlockRunJSContext");
47
37
  let JSBlockRunJSContext = _JSBlockRunJSContext;
48
38
  JSBlockRunJSContext.define({
49
- label: "JSBlock RunJS context",
39
+ label: "RunJS context",
50
40
  properties: {
51
- element: "ElementProxy\uFF0C\u5B89\u5168 DOM \u5BB9\u5668\u3002\u652F\u6301 innerHTML/append \u7B49",
52
- record: "\u5F53\u524D\u8BB0\u5F55\uFF08\u53EA\u8BFB\uFF0C\u5B58\u5728\u4E8E\u6570\u636E\u5757/\u8BE6\u60C5\u7B49\u573A\u666F\uFF09",
53
- value: "\u5F53\u524D\u503C\uFF08\u82E5\u5B58\u5728\uFF09",
54
- React: "React\uFF08\u5DF2\u6CE8\u5165\uFF09",
55
- antd: "AntD\uFF08\u5DF2\u6CE8\u5165\uFF09"
41
+ element: {
42
+ description: `ElementProxy instance providing a safe DOM container.
43
+ Supports innerHTML, append, and other DOM manipulation methods.
44
+ Use this to render content in the JS block.`,
45
+ detail: "ElementProxy",
46
+ properties: {
47
+ innerHTML: "Set or read the HTML content of the container element."
48
+ }
49
+ },
50
+ record: `Current record data object (read-only).
51
+ Available when the JS block is within a data block or detail view context.`,
52
+ value: "Current value of the field or component, if available in the current context.",
53
+ React: "React library",
54
+ antd: "Ant Design library"
56
55
  },
57
56
  methods: {
58
- onRefReady: "Container ref ready callback:\n```js\nctx.onRefReady(ctx.ref, el => { /* ... */ })\n```",
59
- requireAsync: "Load external library: `const lib = await ctx.requireAsync(url)`"
60
- },
61
- snipastes: {
62
- "Render HTML": { $ref: "scene/jsblock/render-basic", prefix: "sn-jsb-html" },
63
- "Render React": { $ref: "scene/jsblock/render-react", prefix: "sn-jsb-react" },
64
- "Init ECharts": { $ref: "libs/echarts-init", prefix: "sn-echarts" },
65
- "Render card": { $ref: "scene/jsblock/render-card", prefix: "sn-jsb-card" },
66
- "Button handler": { $ref: "scene/jsblock/render-button-handler", prefix: "sn-jsb-button" },
67
- "JSX mount": { $ref: "scene/jsblock/jsx-mount", prefix: "sn-jsx-mount" },
68
- "JSX unmount": { $ref: "scene/jsblock/jsx-unmount", prefix: "sn-jsx-unmount" },
69
- Notification: { $ref: "global/notification-open", prefix: "sn-notify" },
70
- "Window open": { $ref: "global/window-open", prefix: "sn-window-open" },
71
- "Add click listener": { $ref: "scene/jsblock/add-event-listener", prefix: "sn-jsb-click" },
72
- "Append style": { $ref: "scene/jsblock/append-style", prefix: "sn-jsb-style" }
57
+ onRefReady: `Wait for container DOM element to be ready before executing callback.
58
+ Parameters: (ref: React.RefObject, callback: (element: HTMLElement) => void, timeout?: number) => void
59
+ Example: ctx.onRefReady(ctx.ref, (el) => { el.innerHTML = "Ready!" })`,
60
+ requireAsync: "Load external library: `const lib = await ctx.requireAsync(url)`",
61
+ importAsync: "Dynamically import ESM module: `const mod = await ctx.importAsync(url)`"
73
62
  }
74
63
  });
64
+ JSBlockRunJSContext.define(
65
+ {
66
+ label: "RunJS \u4E0A\u4E0B\u6587",
67
+ properties: {
68
+ element: {
69
+ description: "ElementProxy\uFF0C\u5B89\u5168\u7684 DOM \u5BB9\u5668\uFF0C\u652F\u6301 innerHTML/append \u7B49",
70
+ detail: "ElementProxy",
71
+ properties: {
72
+ innerHTML: "\u8BFB\u53D6\u6216\u8BBE\u7F6E\u5BB9\u5668\u7684 HTML \u5185\u5BB9"
73
+ }
74
+ },
75
+ record: "\u5F53\u524D\u8BB0\u5F55\uFF08\u53EA\u8BFB\uFF0C\u7528\u4E8E\u6570\u636E\u533A\u5757/\u8BE6\u60C5\u7B49\u573A\u666F\uFF09",
76
+ value: "\u5F53\u524D\u503C\uFF08\u82E5\u5B58\u5728\uFF09",
77
+ React: "React \u5E93",
78
+ antd: "Ant Design \u5E93"
79
+ },
80
+ methods: {
81
+ onRefReady: "\u5BB9\u5668 ref \u5C31\u7EEA\u56DE\u8C03\uFF1A\n```js\nctx.onRefReady(ctx.ref, el => { /* ... */ })\n```",
82
+ requireAsync: "\u52A0\u8F7D\u5916\u90E8\u5E93\uFF1A`const lib = await ctx.requireAsync(url)`",
83
+ importAsync: "\u6309 URL \u52A8\u6001\u5BFC\u5165 ESM \u6A21\u5757\uFF1A`const mod = await ctx.importAsync(url)`"
84
+ }
85
+ },
86
+ { locale: "zh-CN" }
87
+ );
75
88
  // Annotate the CommonJS export names for ESM import in node:
76
89
  0 && (module.exports = {
77
90
  JSBlockRunJSContext
@@ -6,7 +6,6 @@
6
6
  * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
- import { FlowRunJSContext } from './FlowRunJSContext';
9
+ import { FlowRunJSContext } from '../../flowContext';
10
10
  export declare class JSCollectionActionRunJSContext extends FlowRunJSContext {
11
- constructor(delegate: any);
12
11
  }
@@ -30,29 +30,28 @@ __export(JSCollectionActionRunJSContext_exports, {
30
30
  JSCollectionActionRunJSContext: () => JSCollectionActionRunJSContext
31
31
  });
32
32
  module.exports = __toCommonJS(JSCollectionActionRunJSContext_exports);
33
- var import_FlowRunJSContext = require("./FlowRunJSContext");
34
- const _JSCollectionActionRunJSContext = class _JSCollectionActionRunJSContext extends import_FlowRunJSContext.FlowRunJSContext {
35
- constructor(delegate) {
36
- super(delegate);
37
- this.defineProperty("resource", { get: /* @__PURE__ */ __name(() => this._delegate["resource"], "get") });
38
- }
33
+ var import_flowContext = require("../../flowContext");
34
+ const _JSCollectionActionRunJSContext = class _JSCollectionActionRunJSContext extends import_flowContext.FlowRunJSContext {
39
35
  };
40
36
  __name(_JSCollectionActionRunJSContext, "JSCollectionActionRunJSContext");
41
37
  let JSCollectionActionRunJSContext = _JSCollectionActionRunJSContext;
42
38
  JSCollectionActionRunJSContext.define({
43
39
  label: "JSCollectionAction RunJS context",
44
40
  properties: {
45
- resource: "\u5217\u8868\u8D44\u6E90\uFF08\u9009\u4E2D\u884C/\u5206\u9875\u7B49\uFF09"
46
- },
47
- methods: {
48
- runAction: "Run action",
49
- message: "Message API"
50
- },
51
- snipastes: {
52
- "Selected count": { $ref: "scene/actions/collection-selected-count", prefix: "sn-act-selected-count" },
53
- "Iterate selected rows": { $ref: "scene/actions/iterate-selected-rows", prefix: "sn-act-iterate" }
41
+ resource: `Collection resource instance providing access to selected rows, pagination, and data operations.
42
+ Use ctx.resource.selectedRows to get selected records.
43
+ Use ctx.resource.pagination for page info.`
54
44
  }
55
45
  });
46
+ JSCollectionActionRunJSContext.define(
47
+ {
48
+ label: "JS \u96C6\u5408\u52A8\u4F5C RunJS \u4E0A\u4E0B\u6587",
49
+ properties: {
50
+ resource: "\u5217\u8868\u8D44\u6E90\uFF08\u5305\u542B\u9009\u4E2D\u884C/\u5206\u9875\u4FE1\u606F\u7B49\uFF09"
51
+ }
52
+ },
53
+ { locale: "zh-CN" }
54
+ );
56
55
  // Annotate the CommonJS export names for ESM import in node:
57
56
  0 && (module.exports = {
58
57
  JSCollectionActionRunJSContext
@@ -6,7 +6,10 @@
6
6
  * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
- import { FlowRunJSContext } from './FlowRunJSContext';
10
- export declare class LinkageRunJSContext extends FlowRunJSContext {
11
- constructor(delegate: any);
9
+ import { FlowRunJSContext } from '../../flowContext';
10
+ /**
11
+ * RunJS context for JSColumnModel (table custom column).
12
+ * Focused on per-row rendering with access to current record and cell element.
13
+ */
14
+ export declare class JSColumnRunJSContext extends FlowRunJSContext {
12
15
  }
@@ -0,0 +1,78 @@
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 JSColumnRunJSContext_exports = {};
29
+ __export(JSColumnRunJSContext_exports, {
30
+ JSColumnRunJSContext: () => JSColumnRunJSContext
31
+ });
32
+ module.exports = __toCommonJS(JSColumnRunJSContext_exports);
33
+ var import_flowContext = require("../../flowContext");
34
+ const _JSColumnRunJSContext = class _JSColumnRunJSContext extends import_flowContext.FlowRunJSContext {
35
+ };
36
+ __name(_JSColumnRunJSContext, "JSColumnRunJSContext");
37
+ let JSColumnRunJSContext = _JSColumnRunJSContext;
38
+ JSColumnRunJSContext.define({
39
+ label: "JSColumn RunJS context",
40
+ properties: {
41
+ element: "ElementProxy instance providing a safe DOM container for the current table cell. Supports innerHTML/append and basic DOM APIs.",
42
+ record: "Current row record object (read-only).",
43
+ recordIndex: "Index of the current row in the page (0-based).",
44
+ collection: "Collection definition metadata (read-only).",
45
+ viewer: "View controller providing dialog/drawer/embed helpers for interactions initiated from the cell (e.g., open details).",
46
+ React: "React library",
47
+ antd: "Ant Design library"
48
+ },
49
+ methods: {
50
+ onRefReady: "Wait for cell DOM element to be ready before executing callback. Parameters: (ref, callback, timeout?) => void",
51
+ requireAsync: "Load external library by URL: `const lib = await ctx.requireAsync(url)`",
52
+ importAsync: "Dynamically import ESM module by URL: `const mod = await ctx.importAsync(url)`"
53
+ }
54
+ });
55
+ JSColumnRunJSContext.define(
56
+ {
57
+ label: "JS \u5217 RunJS \u4E0A\u4E0B\u6587",
58
+ properties: {
59
+ element: "ElementProxy\uFF0C\u8868\u683C\u5355\u5143\u683C\u7684\u5B89\u5168 DOM \u5BB9\u5668\uFF0C\u652F\u6301 innerHTML/append \u7B49",
60
+ record: "\u5F53\u524D\u884C\u8BB0\u5F55\u5BF9\u8C61\uFF08\u53EA\u8BFB\uFF09",
61
+ recordIndex: "\u5F53\u524D\u884C\u7D22\u5F15\uFF08\u4ECE 0 \u5F00\u59CB\uFF09",
62
+ collection: "\u96C6\u5408\u5B9A\u4E49\u5143\u6570\u636E\uFF08\u53EA\u8BFB\uFF09",
63
+ viewer: "\u89C6\u56FE\u63A7\u5236\u5668\uFF0C\u53EF\u7528\u4E8E\u5728\u5355\u5143\u683C\u4E2D\u89E6\u53D1\u62BD\u5C49/\u5BF9\u8BDD\u6846/\u5185\u5D4C\u7B49\u4EA4\u4E92",
64
+ React: "React \u5E93",
65
+ antd: "Ant Design \u5E93"
66
+ },
67
+ methods: {
68
+ onRefReady: "\u7B49\u5F85\u5355\u5143\u683C DOM \u5C31\u7EEA\u540E\u6267\u884C\u56DE\u8C03\u3002\u53C2\u6570\uFF1A(ref, callback, timeout?)",
69
+ requireAsync: "\u6309 URL \u5F02\u6B65\u52A0\u8F7D\u5916\u90E8\u5E93\uFF1A`const lib = await ctx.requireAsync(url)`",
70
+ importAsync: "\u6309 URL \u52A8\u6001\u5BFC\u5165 ESM \u6A21\u5757\uFF1A`const mod = await ctx.importAsync(url)`"
71
+ }
72
+ },
73
+ { locale: "zh-CN" }
74
+ );
75
+ // Annotate the CommonJS export names for ESM import in node:
76
+ 0 && (module.exports = {
77
+ JSColumnRunJSContext
78
+ });
@@ -6,11 +6,6 @@
6
6
  * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
- import { FlowRunJSContext } from './FlowRunJSContext';
9
+ import { FlowRunJSContext } from '../../flowContext';
10
10
  export declare class JSFieldRunJSContext extends FlowRunJSContext {
11
- static injectDefaultGlobals(): {
12
- window: {};
13
- document: {};
14
- };
15
- constructor(delegate: any);
16
11
  }
@@ -30,40 +30,44 @@ __export(JSFieldRunJSContext_exports, {
30
30
  JSFieldRunJSContext: () => JSFieldRunJSContext
31
31
  });
32
32
  module.exports = __toCommonJS(JSFieldRunJSContext_exports);
33
- var import_FlowRunJSContext = require("./FlowRunJSContext");
34
- var import_utils = require("../../utils");
35
- const _JSFieldRunJSContext = class _JSFieldRunJSContext extends import_FlowRunJSContext.FlowRunJSContext {
36
- static injectDefaultGlobals() {
37
- return { window: (0, import_utils.createSafeWindow)(), document: (0, import_utils.createSafeDocument)() };
38
- }
39
- constructor(delegate) {
40
- super(delegate);
41
- this.defineProperty("element", { get: /* @__PURE__ */ __name(() => this._delegate["element"], "get") });
42
- this.defineProperty("value", { get: /* @__PURE__ */ __name(() => this._delegate["value"], "get") });
43
- this.defineProperty("record", { get: /* @__PURE__ */ __name(() => this._delegate["record"], "get") });
44
- this.defineProperty("collection", { get: /* @__PURE__ */ __name(() => this._delegate["collection"], "get") });
45
- }
33
+ var import_flowContext = require("../../flowContext");
34
+ const _JSFieldRunJSContext = class _JSFieldRunJSContext extends import_flowContext.FlowRunJSContext {
46
35
  };
47
36
  __name(_JSFieldRunJSContext, "JSFieldRunJSContext");
48
37
  let JSFieldRunJSContext = _JSFieldRunJSContext;
49
38
  JSFieldRunJSContext.define({
50
39
  label: "JSField RunJS context",
51
40
  properties: {
52
- element: "ElementProxy\uFF0C\u5B57\u6BB5\u6E32\u67D3\u5BB9\u5668",
53
- value: "\u5B57\u6BB5\u5F53\u524D\u503C\uFF08\u53EA\u8BFB\uFF09",
54
- record: "\u5F53\u524D\u8BB0\u5F55\uFF08\u53EA\u8BFB\uFF09",
55
- collection: "\u96C6\u5408\u5B9A\u4E49\uFF08\u53EA\u8BFB\uFF09"
41
+ element: `ElementProxy instance providing a safe DOM container for field rendering.
42
+ Supports innerHTML, append, and other DOM manipulation methods.`,
43
+ value: `Current value of the field (read-only).
44
+ Contains the data value stored in this field.`,
45
+ record: `Current record data object (read-only).
46
+ Contains all field values of the parent record.`,
47
+ collection: `Collection definition metadata (read-only).
48
+ Provides schema information about the collection this field belongs to.`
56
49
  },
57
50
  methods: {
58
- onRefReady: "Container ready callback"
59
- },
60
- snipastes: {
61
- "Render value": { $ref: "scene/jsfield/innerHTML-value", prefix: "sn-jsf-value" },
62
- "Message success": { $ref: "global/message-success", prefix: "sn-msg-ok" },
63
- "Format number": { $ref: "scene/jsfield/format-number", prefix: "sn-jsf-num" },
64
- "Color by value": { $ref: "scene/jsfield/color-by-value", prefix: "sn-jsf-color" }
51
+ onRefReady: `Wait for field container DOM element to be ready before executing callback.
52
+ Parameters: (ref: React.RefObject, callback: (element: HTMLElement) => void, timeout?: number) => void
53
+ Example: ctx.onRefReady(ctx.ref, (el) => { el.innerHTML = ctx.value })`
65
54
  }
66
55
  });
56
+ JSFieldRunJSContext.define(
57
+ {
58
+ label: "JS \u5B57\u6BB5 RunJS \u4E0A\u4E0B\u6587",
59
+ properties: {
60
+ element: "ElementProxy\uFF0C\u5B57\u6BB5\u6E32\u67D3\u5BB9\u5668\uFF0C\u652F\u6301 innerHTML/append \u7B49 DOM \u64CD\u4F5C",
61
+ value: "\u5B57\u6BB5\u5F53\u524D\u503C\uFF08\u53EA\u8BFB\uFF09",
62
+ record: "\u5F53\u524D\u8BB0\u5F55\u5BF9\u8C61\uFF08\u53EA\u8BFB\uFF0C\u5305\u542B\u7236\u8BB0\u5F55\u5168\u90E8\u5B57\u6BB5\u503C\uFF09",
63
+ collection: "\u96C6\u5408\u5B9A\u4E49\u5143\u6570\u636E\uFF08\u53EA\u8BFB\uFF0C\u63CF\u8FF0\u5B57\u6BB5\u6240\u5C5E\u96C6\u5408\u7684 Schema\uFF09"
64
+ },
65
+ methods: {
66
+ onRefReady: "\u5728\u5B57\u6BB5\u5BB9\u5668 DOM \u5C31\u7EEA\u540E\u6267\u884C\u56DE\u8C03\u3002\u53C2\u6570\uFF1A(ref, callback, timeout?)\uFF1B\u793A\u4F8B\uFF1Actx.onRefReady(ctx.ref, el => { el.innerHTML = ctx.value })"
67
+ }
68
+ },
69
+ { locale: "zh-CN" }
70
+ );
67
71
  // Annotate the CommonJS export names for ESM import in node:
68
72
  0 && (module.exports = {
69
73
  JSFieldRunJSContext
@@ -6,11 +6,6 @@
6
6
  * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
- import { FlowRunJSContext } from './FlowRunJSContext';
9
+ import { FlowRunJSContext } from '../../flowContext';
10
10
  export declare class JSItemRunJSContext extends FlowRunJSContext {
11
- static injectDefaultGlobals(): {
12
- window: {};
13
- document: {};
14
- };
15
- constructor(delegate: any);
16
11
  }
@@ -30,36 +30,40 @@ __export(JSItemRunJSContext_exports, {
30
30
  JSItemRunJSContext: () => JSItemRunJSContext
31
31
  });
32
32
  module.exports = __toCommonJS(JSItemRunJSContext_exports);
33
- var import_FlowRunJSContext = require("./FlowRunJSContext");
34
- var import_utils = require("../../utils");
35
- const _JSItemRunJSContext = class _JSItemRunJSContext extends import_FlowRunJSContext.FlowRunJSContext {
36
- static injectDefaultGlobals() {
37
- return { window: (0, import_utils.createSafeWindow)(), document: (0, import_utils.createSafeDocument)() };
38
- }
39
- constructor(delegate) {
40
- super(delegate);
41
- this.defineProperty("element", { get: /* @__PURE__ */ __name(() => this._delegate["element"], "get") });
42
- this.defineProperty("record", { get: /* @__PURE__ */ __name(() => this._delegate["record"], "get") });
43
- this.defineProperty("resource", { get: /* @__PURE__ */ __name(() => this._delegate["resource"], "get") });
44
- }
33
+ var import_flowContext = require("../../flowContext");
34
+ const _JSItemRunJSContext = class _JSItemRunJSContext extends import_flowContext.FlowRunJSContext {
45
35
  };
46
36
  __name(_JSItemRunJSContext, "JSItemRunJSContext");
47
37
  let JSItemRunJSContext = _JSItemRunJSContext;
48
38
  JSItemRunJSContext.define({
49
39
  label: "JSItem RunJS context",
50
40
  properties: {
51
- element: "ElementProxy\uFF0C\u8868\u5355\u9879\u6E32\u67D3\u5BB9\u5668",
52
- resource: "\u5F53\u524D\u8D44\u6E90\uFF08\u53EA\u8BFB\uFF09",
53
- record: "\u5F53\u524D\u8BB0\u5F55\uFF08\u53EA\u8BFB\uFF09"
41
+ element: `ElementProxy instance providing a safe DOM container for form item rendering.
42
+ Supports innerHTML, append, and other DOM manipulation methods.`,
43
+ resource: `Current resource instance (read-only).
44
+ Provides access to the data resource associated with the current form context.`,
45
+ record: `Current record data object (read-only).
46
+ Contains all field values of the parent record.`
54
47
  },
55
48
  methods: {
56
- onRefReady: "Container ready callback",
57
- requireAsync: "Load external library"
58
- },
59
- snipastes: {
60
- "Render form item": { $ref: "scene/jsitem/render-basic", prefix: "sn-jsitem-basic" }
49
+ onRefReady: `Wait for form item container DOM element to be ready before executing callback.
50
+ Parameters: (ref: React.RefObject, callback: (element: HTMLElement) => void, timeout?: number) => void`
61
51
  }
62
52
  });
53
+ JSItemRunJSContext.define(
54
+ {
55
+ label: "JS \u8868\u5355\u9879 RunJS \u4E0A\u4E0B\u6587",
56
+ properties: {
57
+ element: "ElementProxy\uFF0C\u8868\u5355\u9879\u6E32\u67D3\u5BB9\u5668\uFF0C\u652F\u6301 innerHTML/append \u7B49 DOM \u64CD\u4F5C",
58
+ resource: "\u5F53\u524D\u8D44\u6E90\uFF08\u53EA\u8BFB\uFF09",
59
+ record: "\u5F53\u524D\u8BB0\u5F55\uFF08\u53EA\u8BFB\uFF09"
60
+ },
61
+ methods: {
62
+ onRefReady: "\u5BB9\u5668\u5C31\u7EEA\u540E\u6267\u884C\u56DE\u8C03\u3002\u53C2\u6570\uFF1A(ref, callback, timeout?)"
63
+ }
64
+ },
65
+ { locale: "zh-CN" }
66
+ );
63
67
  // Annotate the CommonJS export names for ESM import in node:
64
68
  0 && (module.exports = {
65
69
  JSItemRunJSContext
@@ -6,7 +6,6 @@
6
6
  * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
- import { FlowRunJSContext } from './FlowRunJSContext';
9
+ import { FlowRunJSContext } from '../../flowContext';
10
10
  export declare class JSRecordActionRunJSContext extends FlowRunJSContext {
11
- constructor(delegate: any);
12
11
  }
@@ -30,31 +30,30 @@ __export(JSRecordActionRunJSContext_exports, {
30
30
  JSRecordActionRunJSContext: () => JSRecordActionRunJSContext
31
31
  });
32
32
  module.exports = __toCommonJS(JSRecordActionRunJSContext_exports);
33
- var import_FlowRunJSContext = require("./FlowRunJSContext");
34
- const _JSRecordActionRunJSContext = class _JSRecordActionRunJSContext extends import_FlowRunJSContext.FlowRunJSContext {
35
- constructor(delegate) {
36
- super(delegate);
37
- this.defineProperty("record", { get: /* @__PURE__ */ __name(() => this._delegate["record"], "get") });
38
- this.defineProperty("filterByTk", { get: /* @__PURE__ */ __name(() => this._delegate["filterByTk"], "get") });
39
- }
33
+ var import_flowContext = require("../../flowContext");
34
+ const _JSRecordActionRunJSContext = class _JSRecordActionRunJSContext extends import_flowContext.FlowRunJSContext {
40
35
  };
41
36
  __name(_JSRecordActionRunJSContext, "JSRecordActionRunJSContext");
42
37
  let JSRecordActionRunJSContext = _JSRecordActionRunJSContext;
43
38
  JSRecordActionRunJSContext.define({
44
39
  label: "JSRecordAction RunJS context",
45
40
  properties: {
46
- record: "\u5F53\u524D\u8BB0\u5F55\uFF08\u53EA\u8BFB\uFF09",
47
- filterByTk: "\u4E3B\u952E/\u8FC7\u6EE4\u952E\uFF08\u53EA\u8BFB\uFF09"
48
- },
49
- methods: {
50
- runAction: "Run action: `await ctx.runAction(name, params)`",
51
- message: "Message API"
52
- },
53
- snipastes: {
54
- "Show record id": { $ref: "scene/actions/record-id-message", prefix: "sn-act-record-id" },
55
- "Run action": { $ref: "scene/actions/run-action-basic", prefix: "sn-act-run" }
41
+ record: `Current record data object (read-only).
42
+ Contains all field values of the record associated with this action.`,
43
+ filterByTk: `Primary key or filter key of the current record (read-only).
44
+ Used to identify the specific record in database operations.`
56
45
  }
57
46
  });
47
+ JSRecordActionRunJSContext.define(
48
+ {
49
+ label: "JS \u8BB0\u5F55\u52A8\u4F5C RunJS \u4E0A\u4E0B\u6587",
50
+ properties: {
51
+ record: "\u5F53\u524D\u8BB0\u5F55\uFF08\u53EA\u8BFB\uFF09",
52
+ filterByTk: "\u4E3B\u952E/\u8FC7\u6EE4\u952E\uFF08\u53EA\u8BFB\uFF09"
53
+ }
54
+ },
55
+ { locale: "zh-CN" }
56
+ );
58
57
  // Annotate the CommonJS export names for ESM import in node:
59
58
  0 && (module.exports = {
60
59
  JSRecordActionRunJSContext
@@ -0,0 +1,9 @@
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
+ export declare function defineBaseContextMeta(): void;