@nocobase/client-v2 2.1.0-alpha.4 → 2.1.0-alpha.45

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 (1341) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +99 -0
  3. package/es/APIClient.d.ts +16 -0
  4. package/es/Application.d.ts +54 -0
  5. package/es/BaseApplication.d.ts +197 -0
  6. package/es/PinnedPluginListContext.d.ts +22 -0
  7. package/es/Plugin.d.ts +59 -0
  8. package/es/PluginManager.d.ts +48 -0
  9. package/es/PluginSettingsManager.d.ts +206 -0
  10. package/es/RouteRepository.d.ts +124 -0
  11. package/{lib → es}/RouterManager.d.ts +27 -13
  12. package/{lib → es}/WebSocketClient.d.ts +3 -3
  13. package/es/acl/ACLProvider.d.ts +81 -0
  14. package/es/acl/createAclSnippetAllow.d.ts +16 -0
  15. package/es/acl/index.d.ts +11 -0
  16. package/es/acl/useAclSnippets.d.ts +16 -0
  17. package/es/ai/ai-manager.d.ts +15 -0
  18. package/es/ai/index.d.ts +12 -0
  19. package/{lib/components → es/ai/skills-manager}/index.d.ts +1 -2
  20. package/es/ai/skills-manager/types.d.ts +23 -0
  21. package/es/ai/tools-manager/hooks/context.d.ts +17 -0
  22. package/es/ai/tools-manager/hooks/index.d.ts +11 -0
  23. package/es/ai/tools-manager/hooks/provider.d.ts +16 -0
  24. package/es/ai/tools-manager/index.d.ts +20 -0
  25. package/es/ai/tools-manager/types.d.ts +90 -0
  26. package/es/ai/utils.d.ts +10 -0
  27. package/es/authRedirect.d.ts +56 -0
  28. package/es/collection-field-interface/CollectionFieldInterface.d.ts +107 -0
  29. package/es/collection-field-interface/CollectionFieldInterfaceManager.d.ts +188 -0
  30. package/es/collection-manager/field-configure.d.ts +80 -0
  31. package/es/collection-manager/field-validation.d.ts +43 -0
  32. package/es/collection-manager/filter-operators/index.d.ts +46 -0
  33. package/es/collection-manager/filter-operators/operators.d.ts +30 -0
  34. package/es/collection-manager/interfaces/checkbox.d.ts +47 -0
  35. package/es/collection-manager/interfaces/checkboxGroup.d.ts +106 -0
  36. package/es/collection-manager/interfaces/collection.d.ts +106 -0
  37. package/es/collection-manager/interfaces/color.d.ts +47 -0
  38. package/es/collection-manager/interfaces/createdAt.d.ts +53 -0
  39. package/es/collection-manager/interfaces/createdBy.d.ts +59 -0
  40. package/es/collection-manager/interfaces/dateOnly.d.ts +66 -0
  41. package/es/collection-manager/interfaces/datetime.d.ts +78 -0
  42. package/es/collection-manager/interfaces/datetimeNoTz.d.ts +78 -0
  43. package/es/collection-manager/interfaces/email.d.ts +59 -0
  44. package/es/collection-manager/interfaces/icon.d.ts +44 -0
  45. package/es/collection-manager/interfaces/id.d.ts +56 -0
  46. package/es/collection-manager/interfaces/index.d.ts +48 -0
  47. package/es/collection-manager/interfaces/input.d.ts +86 -0
  48. package/es/collection-manager/interfaces/integer.d.ts +92 -0
  49. package/es/collection-manager/interfaces/json.d.ts +71 -0
  50. package/es/collection-manager/interfaces/m2m.d.ts +260 -0
  51. package/es/collection-manager/interfaces/m2o.d.ts +207 -0
  52. package/es/collection-manager/interfaces/markdown.d.ts +46 -0
  53. package/es/collection-manager/interfaces/multipleSelect.d.ts +109 -0
  54. package/es/collection-manager/interfaces/nanoid.d.ts +98 -0
  55. package/es/collection-manager/interfaces/number.d.ts +101 -0
  56. package/es/collection-manager/interfaces/o2m.d.ts +231 -0
  57. package/es/collection-manager/interfaces/obo.d.ts +207 -0
  58. package/es/collection-manager/interfaces/oho.d.ts +207 -0
  59. package/es/collection-manager/interfaces/password.d.ts +57 -0
  60. package/es/collection-manager/interfaces/percent.d.ts +74 -0
  61. package/es/collection-manager/interfaces/phone.d.ts +61 -0
  62. package/es/collection-manager/interfaces/properties/index.d.ts +117 -0
  63. package/es/collection-manager/interfaces/radioGroup.d.ts +106 -0
  64. package/es/collection-manager/interfaces/richText.d.ts +48 -0
  65. package/es/collection-manager/interfaces/select.d.ts +107 -0
  66. package/es/collection-manager/interfaces/snowflake-id.d.ts +84 -0
  67. package/es/collection-manager/interfaces/tableoid.d.ts +50 -0
  68. package/es/collection-manager/interfaces/textarea.d.ts +57 -0
  69. package/es/collection-manager/interfaces/time.d.ts +49 -0
  70. package/es/collection-manager/interfaces/types.d.ts +29 -0
  71. package/es/collection-manager/interfaces/unixTimestamp.d.ts +81 -0
  72. package/es/collection-manager/interfaces/updatedAt.d.ts +53 -0
  73. package/es/collection-manager/interfaces/updatedBy.d.ts +59 -0
  74. package/es/collection-manager/interfaces/url.d.ts +53 -0
  75. package/es/collection-manager/interfaces/utils/index.d.ts +14 -0
  76. package/es/collection-manager/interfaces/uuid.d.ts +87 -0
  77. package/es/collection-manager/template-fields.d.ts +53 -0
  78. package/es/components/AppComponents.d.ts +27 -0
  79. package/es/components/Icon.d.ts +24 -0
  80. package/es/components/KeepAlive.d.ts +22 -0
  81. package/es/components/PoweredBy.d.ts +18 -0
  82. package/{lib → es}/components/RouterBridge.d.ts +9 -0
  83. package/es/components/SwitchLanguage.d.ts +11 -0
  84. package/es/components/form/DialogFormLayout.d.ts +51 -0
  85. package/es/components/form/DrawerFormLayout.d.ts +49 -0
  86. package/es/components/form/EnvVariableInput.d.ts +44 -0
  87. package/es/components/form/FileSizeInput.d.ts +27 -0
  88. package/es/components/form/JsonTextArea.d.ts +18 -0
  89. package/es/components/form/PasswordInput.d.ts +40 -0
  90. package/es/components/form/RemoteSelect.d.ts +79 -0
  91. package/es/components/form/VariableInput.d.ts +124 -0
  92. package/es/components/form/createFormRegistry.d.ts +33 -0
  93. package/es/components/form/filter/CollectionFilter.d.ts +49 -0
  94. package/es/components/form/filter/CollectionFilterItem.d.ts +49 -0
  95. package/es/components/form/filter/DateFilterDynamicComponent.d.ts +57 -0
  96. package/es/components/form/filter/FilterValueInput.d.ts +29 -0
  97. package/es/components/form/filter/index.d.ts +11 -0
  98. package/es/components/form/filter/useFilterActionProps.d.ts +96 -0
  99. package/es/components/form/index.d.ts +18 -0
  100. package/es/components/form/table/RowOverlayPreview.d.ts +27 -0
  101. package/es/components/form/table/SelectionCell.d.ts +36 -0
  102. package/es/components/form/table/Table.d.ts +82 -0
  103. package/es/components/form/table/constants.d.ts +15 -0
  104. package/es/components/form/table/dnd/SortableRow.d.ts +40 -0
  105. package/{lib/hooks → es/components/form/table/dnd}/index.d.ts +1 -3
  106. package/es/components/form/table/index.d.ts +9 -0
  107. package/es/components/form/table/styles.d.ts +51 -0
  108. package/es/components/form/table/utils.d.ts +44 -0
  109. package/es/components/index.d.ts +17 -0
  110. package/es/css-variable/CSSVariableProvider.d.ts +15 -0
  111. package/es/data-source/ExtendCollectionsProvider.d.ts +50 -0
  112. package/es/data-source/index.d.ts +9 -0
  113. package/es/flow/FlowModelRepository.d.ts +36 -0
  114. package/es/flow/FlowPage.d.ts +21 -0
  115. package/es/flow/actions/aclCheck.d.ts +9 -0
  116. package/es/flow/actions/aclCheckRefresh.d.ts +9 -0
  117. package/es/flow/actions/afterSuccess.d.ts +9 -0
  118. package/es/flow/actions/blockHeight.d.ts +9 -0
  119. package/es/flow/actions/columnFixed.d.ts +9 -0
  120. package/es/flow/actions/confirm.d.ts +9 -0
  121. package/es/flow/actions/customVariable.d.ts +9 -0
  122. package/es/flow/actions/dataLoadingMode.d.ts +9 -0
  123. package/es/flow/actions/dataScope.d.ts +9 -0
  124. package/es/flow/actions/dataScopeFilter.d.ts +9 -0
  125. package/es/flow/actions/dateRangeLimit.d.ts +9 -0
  126. package/es/flow/actions/dateTimeFormat.d.ts +9 -0
  127. package/es/flow/actions/displayFieldComponent.d.ts +19 -0
  128. package/es/flow/actions/fieldComponent.d.ts +9 -0
  129. package/es/flow/actions/filterFormDefaultValues.d.ts +9 -0
  130. package/es/flow/actions/formAssignRules.d.ts +9 -0
  131. package/es/flow/actions/index.d.ts +41 -0
  132. package/es/flow/actions/layout.d.ts +10 -0
  133. package/es/flow/actions/linkageRules.d.ts +25 -0
  134. package/es/flow/actions/linkageRulesFormValueRefresh.d.ts +10 -0
  135. package/es/flow/actions/linkageRulesRefresh.d.ts +9 -0
  136. package/es/flow/actions/navigateToURL.d.ts +9 -0
  137. package/es/flow/actions/numberFormat.d.ts +9 -0
  138. package/es/flow/actions/openView.d.ts +15 -0
  139. package/es/flow/actions/overflowMode.d.ts +9 -0
  140. package/es/flow/actions/pattern.d.ts +9 -0
  141. package/es/flow/actions/refreshTargetBlocks.d.ts +9 -0
  142. package/es/flow/actions/renderMode.d.ts +9 -0
  143. package/es/flow/actions/required.d.ts +9 -0
  144. package/es/flow/actions/runjs.d.ts +9 -0
  145. package/es/flow/actions/setTargetDataScope.d.ts +10 -0
  146. package/es/flow/actions/showMessage.d.ts +9 -0
  147. package/es/flow/actions/showNotification.d.ts +9 -0
  148. package/es/flow/actions/sortingRules.d.ts +9 -0
  149. package/es/flow/actions/titleField.d.ts +9 -0
  150. package/es/flow/actions/validation.d.ts +9 -0
  151. package/es/flow/admin-shell/AdminLayoutRouteCoordinator.d.ts +19 -0
  152. package/es/flow/admin-shell/BaseLayoutModel.d.ts +89 -0
  153. package/es/flow/admin-shell/BaseLayoutRouteCoordinator.d.ts +74 -0
  154. package/es/flow/admin-shell/admin-layout/AdminLayoutCompat.d.ts +112 -0
  155. package/es/flow/admin-shell/admin-layout/AdminLayoutComponent.d.ts +10 -0
  156. package/es/flow/admin-shell/admin-layout/AdminLayoutEntryGuard.d.ts +12 -0
  157. package/es/flow/admin-shell/admin-layout/AdminLayoutMenuFlowUtils.d.ts +107 -0
  158. package/es/flow/admin-shell/admin-layout/AdminLayoutMenuModels.d.ts +64 -0
  159. package/es/flow/admin-shell/admin-layout/AdminLayoutMenuUtils.d.ts +167 -0
  160. package/es/flow/admin-shell/admin-layout/AdminLayoutModel.d.ts +72 -0
  161. package/es/flow/admin-shell/admin-layout/AdminLayoutSlotModels.d.ts +31 -0
  162. package/es/flow/admin-shell/admin-layout/AppListRender.d.ts +11 -0
  163. package/es/flow/admin-shell/admin-layout/HelpLite.d.ts +13 -0
  164. package/es/flow/admin-shell/admin-layout/PinnedPluginListLite.d.ts +15 -0
  165. package/es/flow/admin-shell/admin-layout/ResetThemeTokenAndKeepAlgorithm.d.ts +13 -0
  166. package/es/flow/admin-shell/admin-layout/TopbarActionsBar.d.ts +25 -0
  167. package/es/flow/admin-shell/admin-layout/constants.d.ts +9 -0
  168. package/es/flow/admin-shell/admin-layout/flowSettingsPreference.d.ts +23 -0
  169. package/es/flow/admin-shell/admin-layout/index.d.ts +22 -0
  170. package/es/flow/admin-shell/admin-layout/mobile-layout.d.ts +12 -0
  171. package/es/flow/admin-shell/admin-layout/mobileMenuNavigation.d.ts +15 -0
  172. package/es/flow/admin-shell/admin-layout/resolveAdminRouteRuntimeTarget.d.ts +47 -0
  173. package/es/flow/admin-shell/admin-layout/useApplications.d.ts +13 -0
  174. package/es/flow/admin-shell/useAdminLayoutRoutePage.d.ts +28 -0
  175. package/es/flow/admin-shell/useLayoutRoutePage.d.ts +23 -0
  176. package/es/flow/common/Liquid.d.ts +33 -0
  177. package/es/flow/common/Markdown/Display.d.ts +9 -0
  178. package/es/flow/common/Markdown/Edit.d.ts +23 -0
  179. package/es/flow/common/Markdown/Markdown.d.ts +24 -0
  180. package/es/flow/common/Markdown/style.d.ts +14 -0
  181. package/es/flow/common/Markdown/useCDN.d.ts +9 -0
  182. package/es/flow/components/AdminLayout.d.ts +11 -0
  183. package/es/flow/components/BlockItemCard.d.ts +16 -0
  184. package/es/flow/components/ConditionBuilder.d.ts +17 -0
  185. package/es/flow/components/DefaultValue.d.ts +20 -0
  186. package/es/flow/components/DynamicFlowsIcon.d.ts +13 -0
  187. package/es/flow/components/EllipsisWithTooltip.d.ts +17 -0
  188. package/es/flow/components/ExpiresRadio/index.d.ts +12 -0
  189. package/es/flow/components/FieldAssignEditor.d.ts +32 -0
  190. package/es/flow/components/FieldAssignExactDatePicker.d.ts +23 -0
  191. package/es/flow/components/FieldAssignRulesEditor.d.ts +71 -0
  192. package/es/flow/components/FieldAssignValueInput.d.ts +88 -0
  193. package/es/flow/components/FlowRoute.d.ts +37 -0
  194. package/es/flow/components/Grid/index.d.ts +28 -0
  195. package/es/flow/components/JsonEditor.d.ts +19 -0
  196. package/es/flow/components/RunJSValueEditor.d.ts +19 -0
  197. package/{lib/hooks/useApp.d.ts → es/flow/components/SkeletonFallback.d.ts} +2 -2
  198. package/es/flow/components/TextAreaWithContextSelector.d.ts +45 -0
  199. package/es/flow/components/code-editor/core/EditorCore.d.ts +25 -0
  200. package/es/flow/components/code-editor/core/tooltipParent.d.ts +9 -0
  201. package/es/flow/components/code-editor/errorHelpers.d.ts +17 -0
  202. package/es/flow/components/code-editor/extension/CodeEditorExtension.d.ts +14 -0
  203. package/es/flow/components/code-editor/extension/index.d.ts +9 -0
  204. package/es/flow/components/code-editor/formatDocInfo.d.ts +17 -0
  205. package/es/flow/components/code-editor/hooks/useCodeRunner.d.ts +23 -0
  206. package/es/flow/components/code-editor/hooks/useRunJSDocCompletions.d.ts +15 -0
  207. package/es/flow/components/code-editor/htmlCompletion.d.ts +11 -0
  208. package/es/flow/components/code-editor/index.d.ts +32 -0
  209. package/es/flow/components/code-editor/javascriptCompletion.d.ts +11 -0
  210. package/es/flow/components/code-editor/javascriptHtmlTemplate.d.ts +16 -0
  211. package/es/flow/components/code-editor/jsxCompletion.d.ts +10 -0
  212. package/es/flow/components/code-editor/linter.d.ts +19 -0
  213. package/es/flow/components/code-editor/panels/LogsPanel.d.ts +15 -0
  214. package/es/flow/components/code-editor/panels/RightExtra.d.ts +18 -0
  215. package/es/flow/components/code-editor/panels/SnippetsDrawer.d.ts +18 -0
  216. package/es/flow/components/code-editor/resolveScenes.d.ts +10 -0
  217. package/es/flow/components/code-editor/runjsCompletionSource.d.ts +20 -0
  218. package/es/flow/components/code-editor/runjsCompletions.d.ts +23 -0
  219. package/es/flow/components/code-editor/runjsDiagnostics.d.ts +46 -0
  220. package/es/flow/components/code-editor/types.d.ts +33 -0
  221. package/es/flow/components/drag-drop/Sortable.d.ts +12 -0
  222. package/es/flow/components/drag-drop/SortableItem.d.ts +12 -0
  223. package/es/flow/components/drag-drop/index.d.ts +10 -0
  224. package/es/flow/components/fieldAssignOptions.d.ts +23 -0
  225. package/es/flow/components/filter/FilterContainer.d.ts +67 -0
  226. package/es/flow/components/filter/FilterGroup.d.ts +66 -0
  227. package/es/flow/components/filter/FilterItem.d.ts +40 -0
  228. package/es/flow/components/filter/LinkageFilterItem.d.ts +51 -0
  229. package/es/flow/components/filter/VariableFilterItem.d.ts +37 -0
  230. package/es/flow/components/filter/fieldsToOptions.d.ts +9 -0
  231. package/es/flow/components/filter/index.d.ts +18 -0
  232. package/es/flow/components/filter/useFilterOptions.d.ts +66 -0
  233. package/es/flow/components/index.d.ts +14 -0
  234. package/es/flow/components/placeholders/BlockPlaceholder.d.ts +11 -0
  235. package/es/flow/components/placeholders/FieldPlaceholder.d.ts +10 -0
  236. package/es/flow/components/useAssociationTitleFieldSync.d.ts +13 -0
  237. package/es/flow/flows/editMarkdownFlow.d.ts +10 -0
  238. package/es/flow/flows/openViewFlow.d.ts +17 -0
  239. package/es/flow/formily/ReactiveField.d.ts +19 -0
  240. package/es/flow/formily/index.d.ts +8 -0
  241. package/es/flow/getViewDiffAndUpdateHidden.d.ts +21 -0
  242. package/es/flow/index.d.ts +35 -0
  243. package/es/flow/internal/components/Markdown/DisplayMarkdown.d.ts +10 -0
  244. package/es/flow/internal/components/Markdown/markdown-it-plugins/mermaidPlugin.d.ts +13 -0
  245. package/es/flow/internal/components/Markdown/md.d.ts +11 -0
  246. package/es/flow/internal/components/Markdown/style.d.ts +9 -0
  247. package/es/flow/internal/components/Markdown/util.d.ts +15 -0
  248. package/es/flow/internal/constants/HeightMode.d.ts +13 -0
  249. package/es/flow/internal/index.d.ts +11 -0
  250. package/es/flow/internal/utils/associationValueCoercion.d.ts +15 -0
  251. package/es/flow/internal/utils/dateTimeUtils.d.ts +10 -0
  252. package/es/flow/internal/utils/enumOptionsUtils.d.ts +28 -0
  253. package/es/flow/internal/utils/modelUtils.d.ts +27 -0
  254. package/es/flow/internal/utils/operatorSchemaHelper.d.ts +15 -0
  255. package/es/flow/internal/utils/rebuildFieldSubModel.d.ts +34 -0
  256. package/es/flow/internal/utils/saveStepParamsWithSubModels.d.ts +11 -0
  257. package/es/flow/internal/utils/titleFieldQuickSync.d.ts +36 -0
  258. package/es/flow/models/actions/AddChildActionModel.d.ts +16 -0
  259. package/es/flow/models/actions/AddNewActionModel.d.ts +16 -0
  260. package/es/flow/models/actions/AssociateActionModel.d.ts +19 -0
  261. package/es/flow/models/actions/AssociationActionUtils.d.ts +22 -0
  262. package/es/flow/models/actions/BulkDeleteActionModel.d.ts +16 -0
  263. package/es/flow/models/actions/DeleteActionModel.d.ts +15 -0
  264. package/es/flow/models/actions/DisassociateActionModel.d.ts +16 -0
  265. package/es/flow/models/actions/EditActionModel.d.ts +16 -0
  266. package/es/flow/models/actions/ExpandCollapseActionModel.d.ts +19 -0
  267. package/es/flow/models/actions/FilterActionModel.d.ts +26 -0
  268. package/es/flow/models/actions/JSActionModel.d.ts +13 -0
  269. package/es/flow/models/actions/JSCollectionActionModel.d.ts +14 -0
  270. package/es/flow/models/actions/JSItemActionModel.d.ts +19 -0
  271. package/es/flow/models/actions/JSRecordActionModel.d.ts +14 -0
  272. package/es/flow/models/actions/LinkActionModel.d.ts +15 -0
  273. package/es/flow/models/actions/LinkActionUtils.d.ts +34 -0
  274. package/es/flow/models/actions/PopupCollectionActionModel.d.ts +14 -0
  275. package/es/flow/models/actions/RefreshActionModel.d.ts +14 -0
  276. package/es/flow/models/actions/UpdateRecordActionModel.d.ts +27 -0
  277. package/es/flow/models/actions/UpdateRecordActionUtils.d.ts +12 -0
  278. package/es/flow/models/actions/ViewActionModel.d.ts +15 -0
  279. package/es/flow/models/actions/index.d.ts +27 -0
  280. package/es/flow/models/actions/joinUrlSearch.d.ts +12 -0
  281. package/es/flow/models/base/ActionGroupModel.d.ts +9 -0
  282. package/es/flow/models/base/ActionGroupModelCore.d.ts +29 -0
  283. package/es/flow/models/base/ActionModel.d.ts +9 -0
  284. package/es/flow/models/base/ActionModelCore.d.ts +51 -0
  285. package/es/flow/models/base/AssociationFieldGroupModel.d.ts +49 -0
  286. package/es/flow/models/base/BlockGridModel.d.ts +22 -0
  287. package/es/flow/models/base/BlockModel.d.ts +57 -0
  288. package/es/flow/models/base/CollectionActionModel.d.ts +12 -0
  289. package/es/flow/models/base/CollectionBlockModel.d.ts +71 -0
  290. package/es/flow/models/base/CommonItemModel.d.ts +11 -0
  291. package/es/flow/models/base/DataBlockModel.d.ts +12 -0
  292. package/es/flow/models/base/FieldModel.d.ts +17 -0
  293. package/es/flow/models/base/FilterBlockModel.d.ts +12 -0
  294. package/es/flow/models/base/GridModel.d.ts +120 -0
  295. package/es/flow/models/base/PageModel/ChildPageModel.d.ts +21 -0
  296. package/es/flow/models/base/PageModel/MainPageModel.d.ts +17 -0
  297. package/es/flow/models/base/PageModel/OldPageModel.d.ts +21 -0
  298. package/es/flow/models/base/PageModel/PageModel.d.ts +59 -0
  299. package/es/flow/models/base/PageModel/PageTabModel.d.ts +42 -0
  300. package/es/flow/models/base/PageModel/RootPageModel.d.ts +33 -0
  301. package/es/flow/models/base/PageModel/SubPageModel.d.ts +17 -0
  302. package/es/flow/models/base/PageModel/closeGuard.d.ts +31 -0
  303. package/{lib → es/flow/models/base/PageModel}/index.d.ts +6 -6
  304. package/es/flow/models/base/PopupActionModel.d.ts +13 -0
  305. package/es/flow/models/base/RecordActionModel.d.ts +12 -0
  306. package/es/flow/models/base/RouteModel.d.ts +11 -0
  307. package/es/flow/models/base/index.d.ts +24 -0
  308. package/es/flow/models/blocks/assign-form/AssignFormGridModel.d.ts +15 -0
  309. package/es/flow/models/blocks/assign-form/AssignFormItemModel.d.ts +22 -0
  310. package/es/flow/models/blocks/assign-form/AssignFormModel.d.ts +26 -0
  311. package/es/flow/models/blocks/assign-form/assignFieldValuesFlow.d.ts +84 -0
  312. package/es/flow/models/blocks/assign-form/index.d.ts +12 -0
  313. package/es/flow/models/blocks/details/DetailsAssociationFieldGroupModel.d.ts +12 -0
  314. package/es/flow/models/blocks/details/DetailsBlockModel.d.ts +41 -0
  315. package/es/flow/models/blocks/details/DetailsCustomItemModel.d.ts +13 -0
  316. package/es/flow/models/blocks/details/DetailsGridModel.d.ts +33 -0
  317. package/es/flow/models/blocks/details/DetailsItemModel.d.ts +60 -0
  318. package/es/flow/models/blocks/details/DetailsJSFieldItemModel.d.ts +19 -0
  319. package/es/flow/models/blocks/details/index.d.ts +14 -0
  320. package/es/flow/models/blocks/details/utils.d.ts +16 -0
  321. package/es/flow/models/blocks/filter-form/FieldModelSelect.d.ts +10 -0
  322. package/es/flow/models/blocks/filter-form/FieldOperatorSelect.d.ts +10 -0
  323. package/es/flow/models/blocks/filter-form/FilterFormActionGroupModel.d.ts +13 -0
  324. package/es/flow/models/blocks/filter-form/FilterFormActionModel.d.ts +11 -0
  325. package/es/flow/models/blocks/filter-form/FilterFormBlockModel.d.ts +51 -0
  326. package/es/flow/models/blocks/filter-form/FilterFormCollapseActionModel.d.ts +18 -0
  327. package/es/flow/models/blocks/filter-form/FilterFormCustomItemModel.d.ts +13 -0
  328. package/es/flow/models/blocks/filter-form/FilterFormGridModel.d.ts +53 -0
  329. package/es/flow/models/blocks/filter-form/FilterFormItemModel.d.ts +59 -0
  330. package/es/flow/models/blocks/filter-form/FilterFormJSActionModel.d.ts +11 -0
  331. package/es/flow/models/blocks/filter-form/FilterFormResetActionModel.d.ts +13 -0
  332. package/es/flow/models/blocks/filter-form/FilterFormSubmitActionModel.d.ts +15 -0
  333. package/es/flow/models/blocks/filter-form/SourceCascader.d.ts +10 -0
  334. package/es/flow/models/blocks/filter-form/customFieldOperators.d.ts +34 -0
  335. package/es/flow/models/blocks/filter-form/fields/FieldComponentProps.d.ts +13 -0
  336. package/es/flow/models/blocks/filter-form/fields/FilterFormCustomFieldModel.d.ts +52 -0
  337. package/es/flow/models/blocks/filter-form/fields/FilterFormCustomRecordSelectFieldModel.d.ts +20 -0
  338. package/es/flow/models/blocks/filter-form/fields/FilterFormFieldModel.d.ts +11 -0
  339. package/es/flow/models/blocks/filter-form/fields/FilterFormRecordSelectFieldModel.d.ts +12 -0
  340. package/es/flow/models/blocks/filter-form/fields/date-time/DateOnlyFilterFieldModel.d.ts +14 -0
  341. package/es/flow/models/blocks/filter-form/fields/date-time/DateTimeFilterFieldModel.d.ts +13 -0
  342. package/es/flow/models/blocks/filter-form/fields/date-time/DateTimeNoTzFilterFieldModel.d.ts +13 -0
  343. package/es/flow/models/blocks/filter-form/fields/date-time/DateTimeTzFilterFieldModel.d.ts +14 -0
  344. package/es/flow/models/blocks/filter-form/fields/date-time/components/DateFilterDynamicComponent.d.ts +10 -0
  345. package/es/flow/models/blocks/filter-form/fields/date-time/components/FilterDatePicker.d.ts +10 -0
  346. package/es/flow/models/blocks/filter-form/fields/date-time/components/FilterRangePicker.d.ts +10 -0
  347. package/es/flow/models/blocks/filter-form/fields/date-time/index.d.ts +12 -0
  348. package/es/flow/models/blocks/filter-form/fields/index.d.ts +13 -0
  349. package/es/flow/models/blocks/filter-form/index.d.ts +23 -0
  350. package/es/flow/models/blocks/filter-form/legacyDefaultValueMigration.d.ts +13 -0
  351. package/es/flow/models/blocks/filter-form/valueNormalization.d.ts +17 -0
  352. package/es/flow/models/blocks/filter-manager/FilterManager.d.ts +145 -0
  353. package/es/flow/models/blocks/filter-manager/flow-actions/connectFields.d.ts +10 -0
  354. package/es/flow/models/blocks/filter-manager/flow-actions/customizeFilterRender.d.ts +10 -0
  355. package/es/flow/models/blocks/filter-manager/flow-actions/defaultOperator.d.ts +9 -0
  356. package/es/flow/models/blocks/filter-manager/flow-actions/index.d.ts +12 -0
  357. package/es/flow/models/blocks/filter-manager/flow-actions/operatorComponentProps.d.ts +10 -0
  358. package/es/flow/models/blocks/filter-manager/index.d.ts +11 -0
  359. package/es/flow/models/blocks/filter-manager/utils.d.ts +21 -0
  360. package/es/flow/models/blocks/form/CreateFormModel.d.ts +22 -0
  361. package/es/flow/models/blocks/form/EditFormModel.d.ts +26 -0
  362. package/es/flow/models/blocks/form/FormActionGroupModel.d.ts +14 -0
  363. package/es/flow/models/blocks/form/FormActionModel.d.ts +28 -0
  364. package/es/flow/models/blocks/form/FormAssociationFieldGroupModel.d.ts +12 -0
  365. package/es/flow/models/blocks/form/FormAssociationItemModel.d.ts +39 -0
  366. package/es/flow/models/blocks/form/FormBlockModel.d.ts +96 -0
  367. package/es/flow/models/blocks/form/FormCustomItemModel.d.ts +13 -0
  368. package/es/flow/models/blocks/form/FormGridModel.d.ts +35 -0
  369. package/es/flow/models/blocks/form/FormItemModel.d.ts +39 -0
  370. package/es/flow/models/blocks/form/FormJSFieldItemModel.d.ts +18 -0
  371. package/es/flow/models/blocks/form/JSFormActionModel.d.ts +11 -0
  372. package/es/flow/models/blocks/form/QuickEditFormModel.d.ts +44 -0
  373. package/es/flow/models/blocks/form/assignRulesUpdateAssociationValues.d.ts +18 -0
  374. package/es/flow/models/blocks/form/dynamicNamePath.d.ts +19 -0
  375. package/es/flow/models/blocks/form/index.d.ts +21 -0
  376. package/es/flow/models/blocks/form/legacyDefaultValueMigration.d.ts +13 -0
  377. package/es/flow/models/blocks/form/submitHandler.d.ts +9 -0
  378. package/es/flow/models/blocks/form/submitValues.d.ts +40 -0
  379. package/es/flow/models/blocks/form/value-runtime/conditions.d.ts +9 -0
  380. package/es/flow/models/blocks/form/value-runtime/deps.d.ts +23 -0
  381. package/es/flow/models/blocks/form/value-runtime/form-patch.d.ts +19 -0
  382. package/es/flow/models/blocks/form/value-runtime/index.d.ts +11 -0
  383. package/es/flow/models/blocks/form/value-runtime/path.d.ts +25 -0
  384. package/es/flow/models/blocks/form/value-runtime/rules.d.ts +137 -0
  385. package/es/flow/models/blocks/form/value-runtime/runtime.d.ts +95 -0
  386. package/es/flow/models/blocks/form/value-runtime/types.d.ts +62 -0
  387. package/es/flow/models/blocks/form/value-runtime/utils.d.ts +12 -0
  388. package/es/flow/models/blocks/index.d.ts +15 -0
  389. package/es/flow/models/blocks/js-block/JSBlock.d.ts +16 -0
  390. package/es/flow/models/blocks/js-block/index.d.ts +9 -0
  391. package/es/flow/models/blocks/shared/filterOperators.d.ts +9 -0
  392. package/es/flow/models/blocks/shared/legacyDefaultValueMigrationBase.d.ts +21 -0
  393. package/es/flow/models/blocks/table/JSColumnModel.d.ts +21 -0
  394. package/es/flow/models/blocks/table/TableActionsColumnModel.d.ts +18 -0
  395. package/es/flow/models/blocks/table/TableAssociationFieldGroupModel.d.ts +12 -0
  396. package/es/flow/models/blocks/table/TableBlockModel.d.ts +79 -0
  397. package/es/flow/models/blocks/table/TableColumnModel.d.ts +29 -0
  398. package/es/flow/models/blocks/table/TableCustomColumnModel.d.ts +12 -0
  399. package/es/flow/models/blocks/table/TableJSFieldItemModel.d.ts +19 -0
  400. package/es/flow/models/blocks/table/TableSelectModel.d.ts +22 -0
  401. package/es/flow/models/blocks/table/dragSort/dragSortComponents.d.ts +9 -0
  402. package/es/flow/models/blocks/table/dragSort/dragSortHooks.d.ts +17 -0
  403. package/es/flow/models/blocks/table/dragSort/dragSortSettings.d.ts +39 -0
  404. package/es/flow/models/blocks/table/dragSort/dragSortUtils.d.ts +37 -0
  405. package/es/flow/models/blocks/table/dragSort/index.d.ts +12 -0
  406. package/es/flow/models/blocks/table/index.d.ts +16 -0
  407. package/es/flow/models/blocks/table/sortUtils.d.ts +32 -0
  408. package/es/flow/models/blocks/table/utils.d.ts +18 -0
  409. package/es/flow/models/blocks/utils/transformChildrenToJS.d.ts +42 -0
  410. package/es/flow/models/fields/AssociationFieldModel/AssociationFieldModel.d.ts +5 -0
  411. package/es/flow/models/fields/AssociationFieldModel/CascadeSelectFieldModel.d.ts +45 -0
  412. package/es/flow/models/fields/AssociationFieldModel/PopupSubTableFieldModel/PopupSubTableActionGroupModel.d.ts +11 -0
  413. package/es/flow/models/fields/AssociationFieldModel/PopupSubTableFieldModel/PopupSubTableActionsColumnModel.d.ts +19 -0
  414. package/es/flow/models/fields/AssociationFieldModel/PopupSubTableFieldModel/PopupSubTableFieldModel.d.ts +30 -0
  415. package/es/flow/models/fields/AssociationFieldModel/PopupSubTableFieldModel/actions/PopupSubTableEditActionModel.d.ts +29 -0
  416. package/es/flow/models/fields/AssociationFieldModel/PopupSubTableFieldModel/actions/PopupSubTableFormSubmitActionModel.d.ts +18 -0
  417. package/es/flow/models/fields/AssociationFieldModel/PopupSubTableFieldModel/actions/PopupSubTableRemoveActionModel.d.ts +14 -0
  418. package/es/flow/models/fields/AssociationFieldModel/PopupSubTableFieldModel/actions/popupSubTableBeforeClose.d.ts +25 -0
  419. package/es/flow/models/fields/AssociationFieldModel/PopupSubTableFieldModel/blocks/PopupSubTableFormModel.d.ts +36 -0
  420. package/es/flow/models/fields/AssociationFieldModel/PopupSubTableFieldModel/index.d.ts +17 -0
  421. package/es/flow/models/fields/AssociationFieldModel/RecordPickerFieldModel.d.ts +45 -0
  422. package/es/flow/models/fields/AssociationFieldModel/RecordSelectFieldModel.d.ts +46 -0
  423. package/es/flow/models/fields/AssociationFieldModel/SubFormFieldModel.d.ts +32 -0
  424. package/es/flow/models/fields/AssociationFieldModel/SubTableFieldModel/SubTableColumnModel.d.ts +42 -0
  425. package/es/flow/models/fields/AssociationFieldModel/SubTableFieldModel/SubTableField.d.ts +10 -0
  426. package/es/flow/models/fields/AssociationFieldModel/SubTableFieldModel/index.d.ts +19 -0
  427. package/es/flow/models/fields/AssociationFieldModel/SubTableFieldModel/rowIdentity.d.ts +18 -0
  428. package/es/flow/models/fields/AssociationFieldModel/index.d.ts +15 -0
  429. package/es/flow/models/fields/AssociationFieldModel/itemChain.d.ts +99 -0
  430. package/es/flow/models/fields/AssociationFieldModel/recordSelectSettingsUtils.d.ts +9 -0
  431. package/es/flow/models/fields/AssociationFieldModel/recordSelectShared.d.ts +48 -0
  432. package/es/flow/models/fields/CheckboxFieldModel.d.ts +13 -0
  433. package/es/flow/models/fields/CheckboxGroupFieldModel.d.ts +13 -0
  434. package/es/flow/models/fields/ClickableFieldModel.d.ts +28 -0
  435. package/es/flow/models/fields/CollectionSelectorFieldModel.d.ts +13 -0
  436. package/es/flow/models/fields/ColorFieldModel.d.ts +14 -0
  437. package/es/flow/models/fields/DateTimeFieldModel/DateOnlyFieldModel.d.ts +7 -0
  438. package/es/flow/models/fields/DateTimeFieldModel/DateTimeFieldModel.d.ts +3 -0
  439. package/es/flow/models/fields/DateTimeFieldModel/DateTimeNoTzFieldModel.d.ts +6 -0
  440. package/es/flow/models/fields/DateTimeFieldModel/DateTimeTzFieldModel.d.ts +7 -0
  441. package/es/flow/models/fields/DateTimeFieldModel/dateLimit.d.ts +20 -0
  442. package/es/flow/models/fields/DateTimeFieldModel/index.d.ts +11 -0
  443. package/es/flow/models/fields/DisplayAssociationField/DisplaySubItemFieldModel.d.ts +26 -0
  444. package/es/flow/models/fields/DisplayAssociationField/DisplaySubListFieldModel.d.ts +26 -0
  445. package/es/flow/models/fields/DisplayAssociationField/DisplaySubTableFieldModel.d.ts +20 -0
  446. package/es/flow/models/fields/DisplayAssociationField/displaySubListUtils.d.ts +14 -0
  447. package/es/flow/models/fields/DisplayAssociationField/index.d.ts +11 -0
  448. package/es/flow/models/fields/DisplayCheckboxFieldModel.d.ts +13 -0
  449. package/es/flow/models/fields/DisplayColorFieldModel.d.ts +13 -0
  450. package/es/flow/models/fields/DisplayDateTimeFieldModel.d.ts +13 -0
  451. package/es/flow/models/fields/DisplayEnumFieldModel.d.ts +20 -0
  452. package/es/flow/models/fields/DisplayHtmlFieldModel.d.ts +13 -0
  453. package/es/flow/models/fields/DisplayIconFieldModel.d.ts +13 -0
  454. package/es/flow/models/fields/DisplayJSONFieldModel.d.ts +13 -0
  455. package/es/flow/models/fields/DisplayNumberFieldModel.d.ts +33 -0
  456. package/es/flow/models/fields/DisplayPasswordFieldModel.d.ts +13 -0
  457. package/es/flow/models/fields/DisplayPercentFieldModel.d.ts +13 -0
  458. package/es/flow/models/fields/DisplayTextFieldModel.d.ts +14 -0
  459. package/es/flow/models/fields/DisplayTimeFieldModel.d.ts +13 -0
  460. package/es/flow/models/fields/DisplayTitleFieldModel.d.ts +18 -0
  461. package/es/flow/models/fields/DisplayURLFieldModel.d.ts +13 -0
  462. package/es/flow/models/fields/DividerItemModel.d.ts +13 -0
  463. package/es/flow/models/fields/IconFieldModel.d.ts +13 -0
  464. package/es/flow/models/fields/InputFieldModel.d.ts +13 -0
  465. package/es/flow/models/fields/JSEditableFieldModel.d.ts +31 -0
  466. package/es/flow/models/fields/JSFieldModel.d.ts +50 -0
  467. package/es/flow/models/fields/JSItemModel.d.ts +27 -0
  468. package/es/flow/models/fields/JsonFieldModel.d.ts +6 -0
  469. package/es/flow/models/fields/MarkdownItemModel.d.ts +14 -0
  470. package/es/flow/models/fields/NumberFieldModel.d.ts +15 -0
  471. package/es/flow/models/fields/PasswordFieldModel.d.ts +13 -0
  472. package/es/flow/models/fields/PercentFieldModel.d.ts +14 -0
  473. package/es/flow/models/fields/RadioGroupFieldModel.d.ts +13 -0
  474. package/es/flow/models/fields/RichTextFieldModel/index.d.ts +14 -0
  475. package/es/flow/models/fields/RichTextFieldModel/registerFontSize.d.ts +9 -0
  476. package/es/flow/models/fields/RichTextFieldModel/registerImageResize.d.ts +9 -0
  477. package/es/flow/models/fields/RichTextFieldModel/registerSmartBreak.d.ts +12 -0
  478. package/es/flow/models/fields/RichTextFieldModel/style.d.ts +9 -0
  479. package/es/flow/models/fields/SelectFieldModel.d.ts +13 -0
  480. package/es/flow/models/fields/TextareaFieldModel.d.ts +13 -0
  481. package/es/flow/models/fields/TimeFieldModel.d.ts +5 -0
  482. package/es/flow/models/fields/VariableFieldFormModel.d.ts +18 -0
  483. package/es/flow/models/fields/index.d.ts +47 -0
  484. package/es/flow/models/fields/mobile-components/MobileDatePicker.d.ts +10 -0
  485. package/es/flow/models/fields/mobile-components/MobileLazySelect.d.ts +11 -0
  486. package/es/flow/models/fields/mobile-components/MobileSelect.d.ts +10 -0
  487. package/es/flow/models/fields/mobile-components/MobileTimePicker.d.ts +10 -0
  488. package/es/flow/models/index.d.ts +13 -0
  489. package/es/flow/models/topbar/TopbarActionModel.d.ts +114 -0
  490. package/es/flow/models/topbar/UserCenterTopbarActionModel.d.ts +68 -0
  491. package/es/flow/models/topbar/index.d.ts +10 -0
  492. package/es/flow/models/utils/displayValueUtils.d.ts +12 -0
  493. package/es/flow/models/utils/resolveRunJsParams.d.ts +19 -0
  494. package/es/flow/resolveViewParamsToViewList.d.ts +20 -0
  495. package/es/flow/system-settings/SystemSettingsSource.d.ts +97 -0
  496. package/es/flow/system-settings/index.d.ts +10 -0
  497. package/es/flow/system-settings/useSystemSettings.d.ts +30 -0
  498. package/es/flow/utils/actionCapability.d.ts +60 -0
  499. package/es/flow/utils/blockUtils.d.ts +16 -0
  500. package/es/flow/utils/dataScopeFormValueClear.d.ts +14 -0
  501. package/es/flow/utils/dispatchEventDeep.d.ts +20 -0
  502. package/es/flow/utils/index.d.ts +11 -0
  503. package/es/flow/utils/pagination.d.ts +29 -0
  504. package/es/flow/utils/useJsonTemplateResolver.d.ts +9 -0
  505. package/es/flow-compat/ColorPicker.d.ts +15 -0
  506. package/es/flow-compat/FieldValidation.d.ts +31 -0
  507. package/es/flow-compat/HighPerformanceSpin.d.ts +11 -0
  508. package/es/flow-compat/Icon.d.ts +10 -0
  509. package/es/flow-compat/IconPicker.d.ts +19 -0
  510. package/es/flow-compat/Password.d.ts +16 -0
  511. package/es/flow-compat/PasswordStrength.d.ts +16 -0
  512. package/es/flow-compat/Popover.d.ts +12 -0
  513. package/es/flow-compat/data.d.ts +22 -0
  514. package/es/flow-compat/date.d.ts +114 -0
  515. package/es/flow-compat/fieldValidationConstants.d.ts +383 -0
  516. package/es/flow-compat/index.d.ts +27 -0
  517. package/es/flow-compat/lazy.d.ts +17 -0
  518. package/es/flow-compat/operators.d.ts +582 -0
  519. package/es/flow-compat/passwordUtils.d.ts +9 -0
  520. package/es/flow-compat/routeTypes.d.ts +56 -0
  521. package/es/flow-compat/useFullscreenOverlay.d.ts +20 -0
  522. package/es/flow-compat/zIndexContext.d.ts +12 -0
  523. package/es/hooks/index.d.ts +13 -0
  524. package/es/hooks/useApp.d.ts +12 -0
  525. package/es/hooks/useCurrentAppInfo.d.ts +9 -0
  526. package/{lib → es}/hooks/usePlugin.d.ts +2 -2
  527. package/{lib → es}/hooks/useRouter.d.ts +1 -1
  528. package/es/i18n.d.ts +22 -0
  529. package/es/index.d.ts +41 -0
  530. package/es/index.mjs +1214 -0
  531. package/es/index.mjs.LICENSE.txt +1 -0
  532. package/es/json-logic/globalOperators.d.ts +11 -0
  533. package/es/layout-manager/LayoutContentRoute.d.ts +14 -0
  534. package/es/layout-manager/LayoutManager.d.ts +22 -0
  535. package/es/layout-manager/LayoutRoute.d.ts +14 -0
  536. package/es/layout-manager/index.d.ts +13 -0
  537. package/es/layout-manager/types.d.ts +20 -0
  538. package/es/layout-manager/utils.d.ts +14 -0
  539. package/es/locale/languageCodes.d.ts +13 -0
  540. package/es/nocobase-buildin-plugin/index.d.ts +42 -0
  541. package/es/nocobase-buildin-plugin/plugins/LocalePlugin.d.ts +15 -0
  542. package/es/nocobase-buildin-plugin/plugins/dayjsLocale.d.ts +76 -0
  543. package/es/nocobase-buildin-plugin/plugins/loadConstrueLocale.d.ts +9 -0
  544. package/es/settings-center/AdminSettingsLayout.d.ts +24 -0
  545. package/es/settings-center/AdminSettingsLayoutModel.d.ts +28 -0
  546. package/es/settings-center/SystemSettingsPage.d.ts +17 -0
  547. package/es/settings-center/index.d.ts +13 -0
  548. package/es/settings-center/plugin-manager/BulkEnableButton.d.ts +15 -0
  549. package/es/settings-center/plugin-manager/PluginCard.d.ts +15 -0
  550. package/es/settings-center/plugin-manager/PluginDetail.d.ts +16 -0
  551. package/es/settings-center/plugin-manager/index.d.ts +11 -0
  552. package/es/settings-center/plugin-manager/types.d.ts +34 -0
  553. package/es/settings-center/utils.d.ts +94 -0
  554. package/es/theme/AntdAppProvider.d.ts +18 -0
  555. package/es/theme/compatOldTheme.d.ts +11 -0
  556. package/es/theme/customAlgorithm.d.ts +12 -0
  557. package/es/theme/defaultTheme.d.ts +11 -0
  558. package/es/theme/globalStyles.d.ts +9 -0
  559. package/es/theme/index.d.ts +36 -0
  560. package/es/theme/type.d.ts +41 -0
  561. package/es/utils/appVersionHTML.d.ts +10 -0
  562. package/es/utils/globalDeps.d.ts +20 -0
  563. package/{lib → es}/utils/index.d.ts +2 -1
  564. package/{lib → es}/utils/remotePlugins.d.ts +9 -10
  565. package/lib/index.js +1214 -40
  566. package/lib/index.js.LICENSE.txt +1 -0
  567. package/lib/locale/languageCodes.js +96 -0
  568. package/package.json +39 -6
  569. package/src/APIClient.ts +68 -0
  570. package/src/Application.tsx +117 -421
  571. package/src/BaseApplication.tsx +698 -0
  572. package/src/PinnedPluginListContext.tsx +33 -0
  573. package/src/Plugin.ts +24 -8
  574. package/src/PluginManager.ts +34 -19
  575. package/src/PluginSettingsManager.ts +505 -98
  576. package/src/RouteRepository.ts +247 -0
  577. package/src/RouterManager.tsx +79 -18
  578. package/src/WebSocketClient.ts +4 -4
  579. package/src/__tests__/PluginSettingsManager.test.ts +286 -0
  580. package/src/__tests__/PoweredBy.test.tsx +130 -0
  581. package/src/__tests__/app.test.tsx +373 -37
  582. package/src/__tests__/authRedirect.test.ts +287 -0
  583. package/src/__tests__/dataSourceRuntime.test.tsx +34 -0
  584. package/src/__tests__/globalDeps.test.ts +37 -0
  585. package/src/__tests__/nocobase-buildin-plugin-auth.test.tsx +216 -0
  586. package/src/__tests__/plugin-manager.test.tsx +177 -0
  587. package/src/__tests__/plugin.test.ts +61 -0
  588. package/src/__tests__/remotePlugins.test.ts +313 -0
  589. package/src/__tests__/settings-center.test.tsx +415 -0
  590. package/src/__tests__/useCurrentRoles.test.tsx +100 -0
  591. package/src/acl/ACLProvider.tsx +284 -0
  592. package/src/acl/__tests__/createAclSnippetAllow.test.ts +42 -0
  593. package/src/acl/createAclSnippetAllow.ts +33 -0
  594. package/src/acl/index.ts +12 -0
  595. package/src/acl/useAclSnippets.ts +25 -0
  596. package/src/ai/ai-manager.ts +19 -0
  597. package/src/ai/index.ts +13 -0
  598. package/src/ai/skills-manager/index.ts +10 -0
  599. package/src/ai/skills-manager/types.ts +26 -0
  600. package/src/ai/tools-manager/hooks/context.ts +20 -0
  601. package/src/ai/tools-manager/hooks/index.ts +22 -0
  602. package/src/ai/tools-manager/hooks/provider.tsx +53 -0
  603. package/src/ai/tools-manager/index.ts +42 -0
  604. package/src/ai/tools-manager/types.ts +106 -0
  605. package/src/ai/utils.ts +12 -0
  606. package/src/authRedirect.ts +236 -0
  607. package/src/collection-field-interface/CollectionFieldInterface.ts +194 -0
  608. package/src/collection-field-interface/CollectionFieldInterfaceManager.ts +374 -0
  609. package/src/collection-manager/field-configure.ts +548 -0
  610. package/src/collection-manager/field-validation.ts +195 -0
  611. package/src/collection-manager/filter-operators/index.ts +176 -0
  612. package/src/collection-manager/filter-operators/operators.ts +363 -0
  613. package/src/collection-manager/interfaces/checkbox.ts +34 -0
  614. package/src/collection-manager/interfaces/checkboxGroup.ts +37 -0
  615. package/src/collection-manager/interfaces/collection.ts +40 -0
  616. package/src/collection-manager/interfaces/color.ts +34 -0
  617. package/src/collection-manager/interfaces/createdAt.ts +41 -0
  618. package/src/collection-manager/interfaces/createdBy.ts +69 -0
  619. package/src/collection-manager/interfaces/dateOnly.ts +54 -0
  620. package/src/collection-manager/interfaces/datetime.ts +66 -0
  621. package/src/collection-manager/interfaces/datetimeNoTz.ts +66 -0
  622. package/src/collection-manager/interfaces/email.ts +40 -0
  623. package/src/collection-manager/interfaces/icon.ts +31 -0
  624. package/src/collection-manager/interfaces/id.ts +60 -0
  625. package/src/collection-manager/interfaces/index.ts +50 -0
  626. package/src/collection-manager/interfaces/input.ts +93 -0
  627. package/src/collection-manager/interfaces/integer.ts +66 -0
  628. package/src/collection-manager/interfaces/json.tsx +80 -0
  629. package/src/collection-manager/interfaces/m2m.tsx +241 -0
  630. package/src/collection-manager/interfaces/m2o.tsx +174 -0
  631. package/src/collection-manager/interfaces/markdown.ts +35 -0
  632. package/src/collection-manager/interfaces/multipleSelect.ts +40 -0
  633. package/src/collection-manager/interfaces/nanoid.ts +82 -0
  634. package/src/collection-manager/interfaces/number.ts +90 -0
  635. package/src/collection-manager/interfaces/o2m.tsx +196 -0
  636. package/src/collection-manager/interfaces/obo.tsx +145 -0
  637. package/src/collection-manager/interfaces/oho.tsx +145 -0
  638. package/src/collection-manager/interfaces/password.ts +38 -0
  639. package/src/collection-manager/interfaces/percent.ts +106 -0
  640. package/src/collection-manager/interfaces/phone.ts +43 -0
  641. package/src/collection-manager/interfaces/properties/index.ts +449 -0
  642. package/src/collection-manager/interfaces/radioGroup.ts +37 -0
  643. package/src/collection-manager/interfaces/richText.ts +35 -0
  644. package/src/collection-manager/interfaces/select.ts +38 -0
  645. package/src/collection-manager/interfaces/snowflake-id.ts +61 -0
  646. package/src/collection-manager/interfaces/tableoid.ts +52 -0
  647. package/src/collection-manager/interfaces/textarea.ts +44 -0
  648. package/src/collection-manager/interfaces/time.ts +37 -0
  649. package/src/collection-manager/interfaces/types.ts +33 -0
  650. package/src/collection-manager/interfaces/unixTimestamp.tsx +68 -0
  651. package/src/collection-manager/interfaces/updatedAt.ts +41 -0
  652. package/src/collection-manager/interfaces/updatedBy.ts +68 -0
  653. package/src/collection-manager/interfaces/url.ts +46 -0
  654. package/src/collection-manager/interfaces/utils/index.ts +20 -0
  655. package/src/collection-manager/interfaces/uuid.ts +72 -0
  656. package/src/collection-manager/template-fields.ts +109 -0
  657. package/src/components/AppComponents.tsx +245 -0
  658. package/src/components/Icon.tsx +68 -0
  659. package/src/components/KeepAlive.tsx +131 -0
  660. package/src/components/PoweredBy.tsx +71 -0
  661. package/src/components/README.md +398 -0
  662. package/src/components/README.zh-CN.md +395 -0
  663. package/src/components/RouterBridge.tsx +28 -4
  664. package/src/components/SwitchLanguage.tsx +48 -0
  665. package/src/components/__tests__/KeepAlive.test.tsx +63 -0
  666. package/src/components/__tests__/RouterBridge.test.tsx +27 -0
  667. package/src/components/form/DialogFormLayout.tsx +87 -0
  668. package/src/components/form/DrawerFormLayout.tsx +84 -0
  669. package/src/components/form/EnvVariableInput.tsx +91 -0
  670. package/src/components/form/FileSizeInput.tsx +105 -0
  671. package/src/components/form/JsonTextArea.tsx +129 -0
  672. package/src/components/form/PasswordInput.tsx +211 -0
  673. package/src/components/form/RemoteSelect.tsx +137 -0
  674. package/src/components/form/VariableInput.tsx +250 -0
  675. package/src/components/form/__tests__/EnvVariableInput.test.tsx +175 -0
  676. package/src/components/form/__tests__/VariableInput.test.ts +85 -0
  677. package/src/components/form/createFormRegistry.ts +60 -0
  678. package/src/components/form/filter/CollectionFilter.tsx +111 -0
  679. package/src/components/form/filter/CollectionFilterItem.tsx +184 -0
  680. package/src/components/form/filter/DateFilterDynamicComponent.tsx +283 -0
  681. package/src/components/form/filter/FilterValueInput.tsx +198 -0
  682. package/src/components/form/filter/__tests__/CollectionFilterItem.test.tsx +247 -0
  683. package/src/components/form/filter/__tests__/DateFilterDynamicComponent.test.tsx +148 -0
  684. package/src/components/form/filter/__tests__/FilterValueInput.test.tsx +243 -0
  685. package/src/components/form/filter/__tests__/compileFilterGroup.test.ts +146 -0
  686. package/src/components/form/filter/index.ts +13 -0
  687. package/src/components/form/filter/useFilterActionProps.ts +203 -0
  688. package/src/components/form/index.tsx +19 -0
  689. package/src/components/form/table/RowOverlayPreview.tsx +51 -0
  690. package/src/components/form/table/SelectionCell.tsx +72 -0
  691. package/src/components/form/table/Table.tsx +280 -0
  692. package/src/components/form/table/__tests__/Table.pagination.test.tsx +80 -0
  693. package/src/components/form/table/constants.ts +16 -0
  694. package/src/components/form/table/dnd/SortableRow.tsx +106 -0
  695. package/src/components/form/table/dnd/index.ts +10 -0
  696. package/src/components/form/table/index.tsx +13 -0
  697. package/src/components/form/table/styles.ts +129 -0
  698. package/src/components/form/table/utils.ts +75 -0
  699. package/src/components/index.ts +7 -0
  700. package/src/css-variable/CSSVariableProvider.tsx +117 -0
  701. package/src/data-source/ExtendCollectionsProvider.tsx +144 -0
  702. package/src/data-source/__tests__/ExtendCollectionsProvider.test.tsx +264 -0
  703. package/src/data-source/index.ts +10 -0
  704. package/src/flow/FlowModelRepository.ts +222 -0
  705. package/src/flow/FlowPage.tsx +146 -0
  706. package/src/flow/__tests__/FlowModelRepository.test.ts +61 -0
  707. package/src/flow/__tests__/FlowPage.test.tsx +79 -0
  708. package/src/flow/__tests__/FlowRoute.test.tsx +1000 -0
  709. package/src/flow/__tests__/getKey.test.ts +61 -0
  710. package/src/flow/__tests__/getViewDiff.test.ts +180 -0
  711. package/src/flow/__tests__/helpers/mockFlowApp.ts +49 -0
  712. package/src/flow/__tests__/resolveViewParamsToViewList.test.ts +278 -0
  713. package/src/flow/actions/__tests__/aclCheckRefresh.test.ts +129 -0
  714. package/src/flow/actions/__tests__/actionLinkageRules.race.repro.test.ts +199 -0
  715. package/src/flow/actions/__tests__/dataLoadingMode.test.tsx +69 -0
  716. package/src/flow/actions/__tests__/dataScope.leftMetaTree.test.tsx +192 -0
  717. package/src/flow/actions/__tests__/dataScopeFilter.test.ts +237 -0
  718. package/src/flow/actions/__tests__/dataScopeFormValueClear.test.ts +96 -0
  719. package/src/flow/actions/__tests__/fieldLinkageRules.scopeDepth.test.ts +1016 -0
  720. package/src/flow/actions/__tests__/formAssignRules.legacyMigration.test.tsx +173 -0
  721. package/src/flow/actions/__tests__/linkageAssignField.legacy.test.ts +470 -0
  722. package/src/flow/actions/__tests__/linkageRules.assignFieldOptions.test.tsx +56 -0
  723. package/src/flow/actions/__tests__/linkageRules.formValueDrivenRefresh.test.ts +443 -0
  724. package/src/flow/actions/__tests__/linkageRules.menu.test.ts +90 -0
  725. package/src/flow/actions/__tests__/linkageRules.runjsTemplateResolution.test.ts +71 -0
  726. package/src/flow/actions/__tests__/linkageRules.subFormSetFieldProps.test.ts +775 -0
  727. package/src/flow/actions/__tests__/linkageRulesRefresh.test.ts +206 -0
  728. package/src/flow/actions/__tests__/openView.beforeClose.test.tsx +263 -0
  729. package/src/flow/actions/__tests__/openView.closeDestroy.test.tsx +95 -0
  730. package/src/flow/actions/__tests__/openView.defineProps.route.test.tsx +152 -0
  731. package/src/flow/actions/__tests__/openView.subModelKey.test.tsx +128 -0
  732. package/src/flow/actions/__tests__/pattern.test.ts +324 -0
  733. package/src/flow/actions/__tests__/setTargetDataScope.leftMetaTree.test.tsx +225 -0
  734. package/src/flow/actions/__tests__/showMessageNotification.test.ts +79 -0
  735. package/src/flow/actions/__tests__/subFormFieldLinkageRules.inputArgs.test.ts +173 -0
  736. package/src/flow/actions/__tests__/titleField.test.ts +45 -0
  737. package/src/flow/actions/aclCheck.tsx +50 -0
  738. package/src/flow/actions/aclCheckRefresh.tsx +172 -0
  739. package/src/flow/actions/afterSuccess.tsx +138 -0
  740. package/src/flow/actions/blockHeight.tsx +77 -0
  741. package/src/flow/actions/columnFixed.tsx +35 -0
  742. package/src/flow/actions/confirm.tsx +63 -0
  743. package/src/flow/actions/customVariable.tsx +399 -0
  744. package/src/flow/actions/dataLoadingMode.tsx +61 -0
  745. package/src/flow/actions/dataScope.tsx +66 -0
  746. package/src/flow/actions/dataScopeFilter.ts +70 -0
  747. package/src/flow/actions/dateRangeLimit.tsx +66 -0
  748. package/src/flow/actions/dateTimeFormat.tsx +192 -0
  749. package/src/flow/actions/displayFieldComponent.tsx +103 -0
  750. package/src/flow/actions/fieldComponent.tsx +114 -0
  751. package/src/flow/actions/filterFormDefaultValues.tsx +154 -0
  752. package/src/flow/actions/formAssignRules.tsx +132 -0
  753. package/src/flow/actions/index.ts +58 -0
  754. package/src/flow/actions/layout.tsx +107 -0
  755. package/src/flow/actions/linkageRules.tsx +2847 -0
  756. package/src/flow/actions/linkageRulesFormValueRefresh.ts +486 -0
  757. package/src/flow/actions/linkageRulesRefresh.tsx +84 -0
  758. package/src/flow/actions/navigateToURL.tsx +142 -0
  759. package/src/flow/actions/numberFormat.tsx +145 -0
  760. package/src/flow/actions/openView.tsx +537 -0
  761. package/src/flow/actions/overflowMode.tsx +36 -0
  762. package/src/flow/actions/pattern.tsx +180 -0
  763. package/src/flow/actions/refreshTargetBlocks.tsx +91 -0
  764. package/src/flow/actions/renderMode.tsx +42 -0
  765. package/src/flow/actions/required.tsx +70 -0
  766. package/src/flow/actions/runjs.tsx +48 -0
  767. package/src/flow/actions/setTargetDataScope.tsx +141 -0
  768. package/src/flow/actions/showMessage.tsx +155 -0
  769. package/src/flow/actions/showNotification.tsx +179 -0
  770. package/src/flow/actions/sortingRules.tsx +125 -0
  771. package/src/flow/actions/titleField.tsx +148 -0
  772. package/src/flow/actions/validation.tsx +77 -0
  773. package/src/flow/admin-shell/AdminLayoutRouteCoordinator.ts +27 -0
  774. package/src/flow/admin-shell/BaseLayoutModel.tsx +455 -0
  775. package/src/flow/admin-shell/BaseLayoutRouteCoordinator.ts +502 -0
  776. package/src/flow/admin-shell/__tests__/AdminLayoutRouteCoordinator.test.ts +661 -0
  777. package/src/flow/admin-shell/admin-layout/AdminLayoutCompat.tsx +326 -0
  778. package/src/flow/admin-shell/admin-layout/AdminLayoutComponent.tsx +713 -0
  779. package/src/flow/admin-shell/admin-layout/AdminLayoutEntryGuard.tsx +160 -0
  780. package/src/flow/admin-shell/admin-layout/AdminLayoutMenuFlowUtils.ts +338 -0
  781. package/src/flow/admin-shell/admin-layout/AdminLayoutMenuModels.tsx +818 -0
  782. package/src/flow/admin-shell/admin-layout/AdminLayoutMenuUtils.tsx +903 -0
  783. package/src/flow/admin-shell/admin-layout/AdminLayoutModel.tsx +168 -0
  784. package/src/flow/admin-shell/admin-layout/AdminLayoutSlotModels.tsx +140 -0
  785. package/src/flow/admin-shell/admin-layout/AppListRender.tsx +139 -0
  786. package/src/flow/admin-shell/admin-layout/HelpLite.tsx +167 -0
  787. package/src/flow/admin-shell/admin-layout/PinnedPluginListLite.tsx +129 -0
  788. package/src/flow/admin-shell/admin-layout/ResetThemeTokenAndKeepAlgorithm.tsx +30 -0
  789. package/src/flow/admin-shell/admin-layout/TopbarActionsBar.tsx +211 -0
  790. package/src/flow/admin-shell/admin-layout/__tests__/AdminLayoutMenuModels.test.ts +2267 -0
  791. package/src/flow/admin-shell/admin-layout/__tests__/AdminLayoutModel.test.tsx +406 -0
  792. package/src/flow/admin-shell/admin-layout/__tests__/TopbarActionsBar.test.tsx +211 -0
  793. package/src/flow/admin-shell/admin-layout/__tests__/flowSettingsPreference.test.ts +44 -0
  794. package/src/flow/admin-shell/admin-layout/constants.ts +10 -0
  795. package/src/flow/admin-shell/admin-layout/flowSettingsPreference.ts +54 -0
  796. package/src/flow/admin-shell/admin-layout/index.ts +23 -0
  797. package/src/flow/admin-shell/admin-layout/mobile-layout.tsx +35 -0
  798. package/src/flow/admin-shell/admin-layout/mobileMenuNavigation.ts +30 -0
  799. package/src/flow/admin-shell/admin-layout/resolveAdminRouteRuntimeTarget.test.ts +363 -0
  800. package/src/flow/admin-shell/admin-layout/resolveAdminRouteRuntimeTarget.ts +282 -0
  801. package/src/flow/admin-shell/admin-layout/useApplications.tsx +48 -0
  802. package/src/flow/admin-shell/useAdminLayoutRoutePage.ts +40 -0
  803. package/src/flow/admin-shell/useLayoutRoutePage.ts +61 -0
  804. package/src/flow/common/Liquid.tsx +148 -0
  805. package/src/flow/common/Markdown/Display.tsx +213 -0
  806. package/src/flow/common/Markdown/Edit.tsx +437 -0
  807. package/src/flow/common/Markdown/Markdown.tsx +44 -0
  808. package/src/flow/common/Markdown/style.ts +53 -0
  809. package/src/flow/common/Markdown/useCDN.ts +21 -0
  810. package/src/flow/components/AdminLayout.tsx +17 -0
  811. package/src/flow/components/BlockItemCard.tsx +204 -0
  812. package/src/flow/components/ConditionBuilder.tsx +40 -0
  813. package/src/flow/components/DefaultValue.tsx +732 -0
  814. package/src/flow/components/DynamicFlowsIcon.tsx +838 -0
  815. package/src/flow/components/EllipsisWithTooltip.tsx +106 -0
  816. package/src/flow/components/ExpiresRadio/index.tsx +139 -0
  817. package/src/flow/components/FieldAssignEditor.tsx +80 -0
  818. package/src/flow/components/FieldAssignExactDatePicker.tsx +225 -0
  819. package/src/flow/components/FieldAssignRulesEditor.tsx +1015 -0
  820. package/src/flow/components/FieldAssignValueInput.tsx +1491 -0
  821. package/src/flow/components/FlowRoute.tsx +276 -0
  822. package/src/flow/components/Grid/index.tsx +204 -0
  823. package/src/flow/components/JsonEditor.tsx +53 -0
  824. package/src/flow/components/RunJSValueEditor.tsx +50 -0
  825. package/src/flow/components/SkeletonFallback.tsx +19 -0
  826. package/src/flow/components/TextAreaWithContextSelector.tsx +163 -0
  827. package/src/flow/components/__tests__/DefaultValue.test.tsx +1289 -0
  828. package/src/flow/components/__tests__/DynamicFlowsIcon.test.tsx +380 -0
  829. package/src/flow/components/__tests__/FieldAssignExactDatePicker.test.tsx +121 -0
  830. package/src/flow/components/__tests__/FieldAssignRulesEditor.test.tsx +835 -0
  831. package/src/flow/components/__tests__/FieldAssignValueInput.exactDate.test.tsx +180 -0
  832. package/src/flow/components/__tests__/FieldAssignValueInput.path.test.ts +298 -0
  833. package/src/flow/components/__tests__/fieldAssignOptions.test.ts +97 -0
  834. package/src/flow/components/code-editor/__tests__/SnippetsDrawer.test.tsx +51 -0
  835. package/src/flow/components/code-editor/__tests__/errorHelpers.test.ts +37 -0
  836. package/src/flow/components/code-editor/__tests__/javascriptHtmlTemplate.test.ts +101 -0
  837. package/src/flow/components/code-editor/__tests__/linter.test.ts +124 -0
  838. package/src/flow/components/code-editor/__tests__/resolveScenes.test.ts +44 -0
  839. package/src/flow/components/code-editor/__tests__/runjsCompletionSource.test.ts +251 -0
  840. package/src/flow/components/code-editor/__tests__/runjsCompletions.test.ts +245 -0
  841. package/src/flow/components/code-editor/__tests__/runjsDiagnostics.test.ts +256 -0
  842. package/src/flow/components/code-editor/__tests__/runjsLocales.test.ts +24 -0
  843. package/src/flow/components/code-editor/__tests__/useCodeRunner.test.tsx +354 -0
  844. package/src/flow/components/code-editor/core/EditorCore.tsx +216 -0
  845. package/src/flow/components/code-editor/core/tooltipParent.ts +28 -0
  846. package/src/flow/components/code-editor/errorHelpers.ts +92 -0
  847. package/src/flow/components/code-editor/extension/CodeEditorExtension.tsx +23 -0
  848. package/src/flow/components/code-editor/extension/index.ts +10 -0
  849. package/src/flow/components/code-editor/formatDocInfo.ts +98 -0
  850. package/src/flow/components/code-editor/hooks/useCodeRunner.ts +365 -0
  851. package/src/flow/components/code-editor/hooks/useRunJSDocCompletions.ts +41 -0
  852. package/src/flow/components/code-editor/htmlCompletion.ts +155 -0
  853. package/src/flow/components/code-editor/index.tsx +291 -0
  854. package/src/flow/components/code-editor/javascriptCompletion.ts +121 -0
  855. package/src/flow/components/code-editor/javascriptHtmlTemplate.ts +68 -0
  856. package/src/flow/components/code-editor/jsxCompletion.ts +244 -0
  857. package/src/flow/components/code-editor/linter.ts +949 -0
  858. package/src/flow/components/code-editor/panels/LogsPanel.tsx +68 -0
  859. package/src/flow/components/code-editor/panels/RightExtra.tsx +71 -0
  860. package/src/flow/components/code-editor/panels/SnippetsDrawer.tsx +104 -0
  861. package/src/flow/components/code-editor/resolveScenes.ts +38 -0
  862. package/src/flow/components/code-editor/runjsCompletionSource.ts +456 -0
  863. package/src/flow/components/code-editor/runjsCompletions.ts +306 -0
  864. package/src/flow/components/code-editor/runjsDiagnostics.ts +1141 -0
  865. package/src/flow/components/code-editor/types.ts +37 -0
  866. package/src/flow/components/drag-drop/Sortable.tsx +48 -0
  867. package/src/flow/components/drag-drop/SortableItem.tsx +28 -0
  868. package/src/flow/components/drag-drop/index.ts +11 -0
  869. package/src/flow/components/fieldAssignOptions.ts +212 -0
  870. package/src/flow/components/filter/FilterContainer.tsx +123 -0
  871. package/src/flow/components/filter/FilterGroup.tsx +320 -0
  872. package/src/flow/components/filter/FilterItem.tsx +144 -0
  873. package/src/flow/components/filter/LinkageFilterItem.tsx +519 -0
  874. package/src/flow/components/filter/VariableFilterItem.tsx +681 -0
  875. package/src/flow/components/filter/__tests__/FilterGroup.test.tsx +143 -0
  876. package/src/flow/components/filter/__tests__/LinkageFilterItem.metaTree.test.ts +167 -0
  877. package/src/flow/components/filter/__tests__/LinkageFilterItem.test.tsx +405 -0
  878. package/src/flow/components/filter/__tests__/VariableFilterItem.leftMetaTree.test.tsx +196 -0
  879. package/src/flow/components/filter/__tests__/VariableFilterItem.test.tsx +497 -0
  880. package/src/flow/components/filter/fieldsToOptions.ts +71 -0
  881. package/src/flow/components/filter/index.ts +20 -0
  882. package/src/flow/components/filter/useFilterOptions.ts +102 -0
  883. package/src/flow/components/index.tsx +16 -0
  884. package/src/flow/components/placeholders/BlockPlaceholder.tsx +68 -0
  885. package/src/flow/components/placeholders/FieldPlaceholder.tsx +32 -0
  886. package/src/flow/components/useAssociationTitleFieldSync.ts +49 -0
  887. package/src/flow/flows/editMarkdownFlow.tsx +143 -0
  888. package/src/flow/flows/openViewFlow.ts +89 -0
  889. package/src/flow/formily/ReactiveField.tsx +106 -0
  890. package/src/flow/formily/index.tsx +8 -0
  891. package/src/flow/getViewDiffAndUpdateHidden.tsx +86 -0
  892. package/src/flow/index.ts +113 -0
  893. package/src/flow/internal/components/Markdown/DisplayMarkdown.tsx +85 -0
  894. package/src/flow/internal/components/Markdown/markdown-it-plugins/mermaidPlugin.ts +85 -0
  895. package/src/flow/internal/components/Markdown/md.ts +24 -0
  896. package/src/flow/internal/components/Markdown/style.ts +165 -0
  897. package/src/flow/internal/components/Markdown/util.ts +45 -0
  898. package/src/flow/internal/constants/HeightMode.ts +14 -0
  899. package/src/flow/internal/index.ts +16 -0
  900. package/src/flow/internal/utils/__tests__/associationValueCoercion.test.ts +57 -0
  901. package/src/flow/internal/utils/__tests__/enumOptionsUtils.test.ts +67 -0
  902. package/src/flow/internal/utils/__tests__/modelUtils.test.ts +66 -0
  903. package/src/flow/internal/utils/__tests__/rebuildFieldSubModel.test.ts +184 -0
  904. package/src/flow/internal/utils/__tests__/titleFieldQuickSync.test.ts +94 -0
  905. package/src/flow/internal/utils/associationValueCoercion.ts +29 -0
  906. package/src/flow/internal/utils/dateTimeUtils.ts +53 -0
  907. package/src/flow/internal/utils/enumOptionsUtils.ts +95 -0
  908. package/src/flow/internal/utils/modelUtils.ts +158 -0
  909. package/src/flow/internal/utils/operatorSchemaHelper.ts +30 -0
  910. package/src/flow/internal/utils/rebuildFieldSubModel.ts +110 -0
  911. package/src/flow/internal/utils/saveStepParamsWithSubModels.ts +40 -0
  912. package/src/flow/internal/utils/titleFieldQuickSync.ts +95 -0
  913. package/src/flow/models/actions/AddChildActionModel.tsx +69 -0
  914. package/src/flow/models/actions/AddNewActionModel.tsx +32 -0
  915. package/src/flow/models/actions/AssociateActionModel.tsx +196 -0
  916. package/src/flow/models/actions/AssociationActionUtils.ts +104 -0
  917. package/src/flow/models/actions/BulkDeleteActionModel.tsx +61 -0
  918. package/src/flow/models/actions/DeleteActionModel.tsx +61 -0
  919. package/src/flow/models/actions/DisassociateActionModel.tsx +57 -0
  920. package/src/flow/models/actions/EditActionModel.tsx +31 -0
  921. package/src/flow/models/actions/ExpandCollapseActionModel.tsx +113 -0
  922. package/src/flow/models/actions/FilterActionModel.tsx +328 -0
  923. package/src/flow/models/actions/JSActionModel.tsx +84 -0
  924. package/src/flow/models/actions/JSCollectionActionModel.tsx +90 -0
  925. package/src/flow/models/actions/JSItemActionModel.tsx +166 -0
  926. package/src/flow/models/actions/JSRecordActionModel.tsx +90 -0
  927. package/src/flow/models/actions/LinkActionModel.tsx +198 -0
  928. package/src/flow/models/actions/LinkActionUtils.ts +65 -0
  929. package/src/flow/models/actions/PopupCollectionActionModel.tsx +25 -0
  930. package/src/flow/models/actions/RefreshActionModel.tsx +45 -0
  931. package/src/flow/models/actions/UpdateRecordActionModel.tsx +120 -0
  932. package/src/flow/models/actions/UpdateRecordActionUtils.ts +86 -0
  933. package/src/flow/models/actions/ViewActionModel.tsx +31 -0
  934. package/src/flow/models/actions/__tests__/AssignFormRefill.test.ts +80 -0
  935. package/src/flow/models/actions/__tests__/AssociationActionModel.test.ts +313 -0
  936. package/src/flow/models/actions/__tests__/JSItemActionModel.test.tsx +85 -0
  937. package/src/flow/models/actions/__tests__/LinkActionModel.test.ts +110 -0
  938. package/src/flow/models/actions/__tests__/UpdateRecordActionModel.test.ts +72 -0
  939. package/src/flow/models/actions/index.ts +29 -0
  940. package/src/flow/models/actions/joinUrlSearch.ts +42 -0
  941. package/src/flow/models/base/ActionGroupModel.tsx +10 -0
  942. package/src/flow/models/base/ActionGroupModelCore.tsx +117 -0
  943. package/src/flow/models/base/ActionModel.tsx +149 -0
  944. package/src/flow/models/base/ActionModelCore.tsx +182 -0
  945. package/src/flow/models/base/AssociationFieldGroupModel.tsx +100 -0
  946. package/src/flow/models/base/BlockGridModel.tsx +144 -0
  947. package/src/flow/models/base/BlockModel.tsx +247 -0
  948. package/src/flow/models/base/CollectionActionModel.tsx +23 -0
  949. package/src/flow/models/base/CollectionBlockModel.tsx +710 -0
  950. package/src/flow/models/base/CommonItemModel.tsx +12 -0
  951. package/src/flow/models/base/DataBlockModel.tsx +41 -0
  952. package/src/flow/models/base/FieldModel.tsx +26 -0
  953. package/src/flow/models/base/FilterBlockModel.tsx +15 -0
  954. package/src/flow/models/base/GridModel.tsx +1363 -0
  955. package/src/flow/models/base/PageModel/ChildPageModel.tsx +114 -0
  956. package/src/flow/models/base/PageModel/MainPageModel.tsx +32 -0
  957. package/src/flow/models/base/PageModel/OldPageModel.tsx +97 -0
  958. package/src/flow/models/base/PageModel/PageModel.tsx +531 -0
  959. package/src/flow/models/base/PageModel/PageTabModel.tsx +259 -0
  960. package/src/flow/models/base/PageModel/RootPageModel.tsx +189 -0
  961. package/src/flow/models/base/PageModel/SubPageModel.tsx +32 -0
  962. package/src/flow/models/base/PageModel/__tests__/ChildPageModel.test.ts +196 -0
  963. package/src/flow/models/base/PageModel/__tests__/PageModel.beforeCloseGuard.test.ts +111 -0
  964. package/src/flow/models/base/PageModel/__tests__/PageModel.test.ts +927 -0
  965. package/src/flow/models/base/PageModel/__tests__/PageTabModel.test.ts +225 -0
  966. package/src/flow/models/base/PageModel/__tests__/RootPageModel.test.ts +358 -0
  967. package/src/flow/models/base/PageModel/closeGuard.ts +48 -0
  968. package/src/flow/models/base/PageModel/index.tsx +16 -0
  969. package/src/flow/models/base/PopupActionModel.tsx +26 -0
  970. package/src/flow/models/base/RecordActionModel.tsx +23 -0
  971. package/src/flow/models/base/RouteModel.tsx +29 -0
  972. package/src/flow/models/base/__tests__/ActionGroupModel.test.ts +200 -0
  973. package/src/flow/models/base/__tests__/BlockGridModel.dragOverlayConfig.test.ts +44 -0
  974. package/src/flow/models/base/__tests__/BlockGridModel.newScene.test.ts +37 -0
  975. package/src/flow/models/base/__tests__/BlockGridModel.selectSceneAddBlock.test.ts +83 -0
  976. package/src/flow/models/base/__tests__/CollectionBlockModel.capability.test.ts +96 -0
  977. package/src/flow/models/base/__tests__/CollectionBlockModel.dirtyRefresh.association.test.ts +110 -0
  978. package/src/flow/models/base/__tests__/CollectionBlockModel.initialBeforeRenderRefresh.test.ts +131 -0
  979. package/src/flow/models/base/__tests__/CollectionBlockModel.newScene.associatedRecordsVisibility.test.ts +161 -0
  980. package/src/flow/models/base/__tests__/CollectionBlockModel.title.test.ts +95 -0
  981. package/src/flow/models/base/__tests__/GridModel.computeOverlayRect.test.ts +452 -0
  982. package/src/flow/models/base/__tests__/GridModel.dragOverlay.test.ts +129 -0
  983. package/src/flow/models/base/__tests__/GridModel.dragSnapshotContainer.test.ts +384 -0
  984. package/src/flow/models/base/__tests__/GridModel.mergeRows.test.ts +107 -0
  985. package/src/flow/models/base/__tests__/GridModel.recalculateGridSizes.test.ts +67 -0
  986. package/src/flow/models/base/__tests__/GridModel.resizeLayout.test.ts +124 -0
  987. package/src/flow/models/base/__tests__/GridModel.visibleLayout.test.ts +329 -0
  988. package/src/flow/models/base/__tests__/transformRowsToSingleColumn.test.ts +58 -0
  989. package/src/flow/models/base/index.ts +26 -0
  990. package/src/flow/models/blocks/assign-form/AssignFormGridModel.tsx +161 -0
  991. package/src/flow/models/blocks/assign-form/AssignFormItemModel.tsx +470 -0
  992. package/src/flow/models/blocks/assign-form/AssignFormModel.tsx +96 -0
  993. package/src/flow/models/blocks/assign-form/assignFieldValuesFlow.tsx +206 -0
  994. package/src/flow/models/blocks/assign-form/index.ts +13 -0
  995. package/src/flow/models/blocks/details/DetailsAssociationFieldGroupModel.tsx +18 -0
  996. package/src/flow/models/blocks/details/DetailsBlockModel.tsx +404 -0
  997. package/src/flow/models/blocks/details/DetailsCustomItemModel.tsx +51 -0
  998. package/src/flow/models/blocks/details/DetailsGridModel.tsx +106 -0
  999. package/src/flow/models/blocks/details/DetailsItemModel.tsx +389 -0
  1000. package/src/flow/models/blocks/details/DetailsJSFieldItemModel.tsx +37 -0
  1001. package/src/flow/models/blocks/details/__tests__/DetailsBlockModel.blockHeight.test.tsx +139 -0
  1002. package/src/flow/models/blocks/details/__tests__/DetailsBlockModel.initialPaginationChangeRefresh.test.ts +128 -0
  1003. package/src/flow/models/blocks/details/__tests__/DetailsItemModel.value.test.ts +49 -0
  1004. package/src/flow/models/blocks/details/index.ts +16 -0
  1005. package/src/flow/models/blocks/details/utils.ts +67 -0
  1006. package/src/flow/models/blocks/filter-form/FieldModelSelect.tsx +59 -0
  1007. package/src/flow/models/blocks/filter-form/FieldOperatorSelect.tsx +109 -0
  1008. package/src/flow/models/blocks/filter-form/FilterFormActionGroupModel.tsx +15 -0
  1009. package/src/flow/models/blocks/filter-form/FilterFormActionModel.tsx +12 -0
  1010. package/src/flow/models/blocks/filter-form/FilterFormBlockModel.tsx +686 -0
  1011. package/src/flow/models/blocks/filter-form/FilterFormCollapseActionModel.tsx +132 -0
  1012. package/src/flow/models/blocks/filter-form/FilterFormCustomItemModel.tsx +42 -0
  1013. package/src/flow/models/blocks/filter-form/FilterFormGridModel.tsx +422 -0
  1014. package/src/flow/models/blocks/filter-form/FilterFormItemModel.tsx +820 -0
  1015. package/src/flow/models/blocks/filter-form/FilterFormJSActionModel.tsx +72 -0
  1016. package/src/flow/models/blocks/filter-form/FilterFormResetActionModel.tsx +52 -0
  1017. package/src/flow/models/blocks/filter-form/FilterFormSubmitActionModel.tsx +49 -0
  1018. package/src/flow/models/blocks/filter-form/SourceCascader.tsx +137 -0
  1019. package/src/flow/models/blocks/filter-form/__tests__/FilterFormBlockModel.cleanup.test.ts +138 -0
  1020. package/src/flow/models/blocks/filter-form/__tests__/FilterFormGridModel.onModelCreated.test.ts +247 -0
  1021. package/src/flow/models/blocks/filter-form/__tests__/FilterFormGridModel.toggleFormFieldsCollapse.test.ts +457 -0
  1022. package/src/flow/models/blocks/filter-form/__tests__/FilterFormItemModel.defineChildren.test.ts +329 -0
  1023. package/src/flow/models/blocks/filter-form/__tests__/FilterFormItemModel.getFilterValue.test.ts +177 -0
  1024. package/src/flow/models/blocks/filter-form/__tests__/customFieldOperators.test.tsx +665 -0
  1025. package/src/flow/models/blocks/filter-form/__tests__/defaultValues.wiring.test.ts +388 -0
  1026. package/src/flow/models/blocks/filter-form/__tests__/legacyDefaultValueMigration.test.ts +110 -0
  1027. package/src/flow/models/blocks/filter-form/__tests__/valueNormalization.test.ts +50 -0
  1028. package/src/flow/models/blocks/filter-form/customFieldOperators.ts +236 -0
  1029. package/src/flow/models/blocks/filter-form/fields/FieldComponentProps.tsx +488 -0
  1030. package/src/flow/models/blocks/filter-form/fields/FilterFormCustomFieldModel.tsx +411 -0
  1031. package/src/flow/models/blocks/filter-form/fields/FilterFormCustomRecordSelectFieldModel.tsx +543 -0
  1032. package/src/flow/models/blocks/filter-form/fields/FilterFormFieldModel.tsx +12 -0
  1033. package/src/flow/models/blocks/filter-form/fields/FilterFormRecordSelectFieldModel.tsx +85 -0
  1034. package/src/flow/models/blocks/filter-form/fields/__tests__/FilterFormCustomFieldModel.recordSelect.test.tsx +651 -0
  1035. package/src/flow/models/blocks/filter-form/fields/date-time/DateOnlyFilterFieldModel.tsx +42 -0
  1036. package/src/flow/models/blocks/filter-form/fields/date-time/DateTimeFilterFieldModel.tsx +17 -0
  1037. package/src/flow/models/blocks/filter-form/fields/date-time/DateTimeNoTzFilterFieldModel.tsx +30 -0
  1038. package/src/flow/models/blocks/filter-form/fields/date-time/DateTimeTzFilterFieldModel.tsx +48 -0
  1039. package/src/flow/models/blocks/filter-form/fields/date-time/components/DateFilterDynamicComponent.tsx +184 -0
  1040. package/src/flow/models/blocks/filter-form/fields/date-time/components/FilterDatePicker.tsx +108 -0
  1041. package/src/flow/models/blocks/filter-form/fields/date-time/components/FilterRangePicker.tsx +84 -0
  1042. package/src/flow/models/blocks/filter-form/fields/date-time/components/__tests__/FilterDatePickers.test.tsx +121 -0
  1043. package/src/flow/models/blocks/filter-form/fields/date-time/index.ts +13 -0
  1044. package/src/flow/models/blocks/filter-form/fields/index.ts +14 -0
  1045. package/src/flow/models/blocks/filter-form/index.ts +25 -0
  1046. package/src/flow/models/blocks/filter-form/legacyDefaultValueMigration.ts +36 -0
  1047. package/src/flow/models/blocks/filter-form/valueNormalization.ts +92 -0
  1048. package/src/flow/models/blocks/filter-manager/FilterManager.ts +602 -0
  1049. package/src/flow/models/blocks/filter-manager/__tests__/FilterManager.bindToTarget.test.ts +446 -0
  1050. package/src/flow/models/blocks/filter-manager/__tests__/FilterManager.test.ts +972 -0
  1051. package/src/flow/models/blocks/filter-manager/__tests__/FilterManager.unbindFromTarget.test.ts +242 -0
  1052. package/src/flow/models/blocks/filter-manager/__tests__/getDefaultOperator.test.ts +69 -0
  1053. package/src/flow/models/blocks/filter-manager/flow-actions/__tests__/defaultOperator.test.tsx +58 -0
  1054. package/src/flow/models/blocks/filter-manager/flow-actions/connectFields.tsx +488 -0
  1055. package/src/flow/models/blocks/filter-manager/flow-actions/customizeFilterRender.tsx +78 -0
  1056. package/src/flow/models/blocks/filter-manager/flow-actions/defaultOperator.tsx +48 -0
  1057. package/src/flow/models/blocks/filter-manager/flow-actions/index.ts +13 -0
  1058. package/src/flow/models/blocks/filter-manager/flow-actions/operatorComponentProps.tsx +47 -0
  1059. package/src/flow/models/blocks/filter-manager/index.ts +13 -0
  1060. package/src/flow/models/blocks/filter-manager/utils.ts +71 -0
  1061. package/src/flow/models/blocks/form/CreateFormModel.tsx +124 -0
  1062. package/src/flow/models/blocks/form/EditFormModel.tsx +298 -0
  1063. package/src/flow/models/blocks/form/FormActionGroupModel.tsx +29 -0
  1064. package/src/flow/models/blocks/form/FormActionModel.tsx +139 -0
  1065. package/src/flow/models/blocks/form/FormAssociationFieldGroupModel.tsx +18 -0
  1066. package/src/flow/models/blocks/form/FormAssociationItemModel.tsx +359 -0
  1067. package/src/flow/models/blocks/form/FormBlockModel.tsx +739 -0
  1068. package/src/flow/models/blocks/form/FormCustomItemModel.tsx +54 -0
  1069. package/src/flow/models/blocks/form/FormGridModel.tsx +106 -0
  1070. package/src/flow/models/blocks/form/FormItemModel.tsx +501 -0
  1071. package/src/flow/models/blocks/form/FormJSFieldItemModel.tsx +36 -0
  1072. package/src/flow/models/blocks/form/JSFormActionModel.tsx +85 -0
  1073. package/src/flow/models/blocks/form/QuickEditFormModel.tsx +303 -0
  1074. package/src/flow/models/blocks/form/__tests__/FormActionGroupModel.test.ts +46 -0
  1075. package/src/flow/models/blocks/form/__tests__/FormBlockModel.test.tsx +865 -0
  1076. package/src/flow/models/blocks/form/__tests__/FormItemModel.defineChildren.test.ts +108 -0
  1077. package/src/flow/models/blocks/form/__tests__/QuickEditFormModel.quickEdit.test.ts +69 -0
  1078. package/src/flow/models/blocks/form/__tests__/assignRulesUpdateAssociationValues.test.ts +81 -0
  1079. package/src/flow/models/blocks/form/__tests__/dynamicNamePath.test.ts +33 -0
  1080. package/src/flow/models/blocks/form/__tests__/legacyDefaultValueMigration.test.ts +138 -0
  1081. package/src/flow/models/blocks/form/__tests__/submitHandler.test.ts +71 -0
  1082. package/src/flow/models/blocks/form/__tests__/submitValues.test.ts +224 -0
  1083. package/src/flow/models/blocks/form/assignRulesUpdateAssociationValues.ts +73 -0
  1084. package/src/flow/models/blocks/form/dynamicNamePath.ts +68 -0
  1085. package/src/flow/models/blocks/form/index.tsx +23 -0
  1086. package/src/flow/models/blocks/form/legacyDefaultValueMigration.ts +32 -0
  1087. package/src/flow/models/blocks/form/submitHandler.ts +70 -0
  1088. package/src/flow/models/blocks/form/submitValues.ts +230 -0
  1089. package/src/flow/models/blocks/form/value-runtime/__tests__/deps.test.ts +28 -0
  1090. package/src/flow/models/blocks/form/value-runtime/__tests__/runtime.test.ts +3436 -0
  1091. package/src/flow/models/blocks/form/value-runtime/__tests__/subtable-nested.test.ts +103 -0
  1092. package/src/flow/models/blocks/form/value-runtime/conditions.ts +22 -0
  1093. package/src/flow/models/blocks/form/value-runtime/deps.ts +181 -0
  1094. package/src/flow/models/blocks/form/value-runtime/form-patch.ts +83 -0
  1095. package/src/flow/models/blocks/form/value-runtime/index.ts +12 -0
  1096. package/src/flow/models/blocks/form/value-runtime/path.ts +144 -0
  1097. package/src/flow/models/blocks/form/value-runtime/rules.ts +1935 -0
  1098. package/src/flow/models/blocks/form/value-runtime/runtime.ts +1215 -0
  1099. package/src/flow/models/blocks/form/value-runtime/types.ts +72 -0
  1100. package/src/flow/models/blocks/form/value-runtime/utils.ts +25 -0
  1101. package/src/flow/models/blocks/index.ts +17 -0
  1102. package/src/flow/models/blocks/js-block/JSBlock.tsx +180 -0
  1103. package/src/flow/models/blocks/js-block/index.ts +10 -0
  1104. package/src/flow/models/blocks/shared/filterOperators.ts +14 -0
  1105. package/src/flow/models/blocks/shared/legacyDefaultValueMigrationBase.ts +192 -0
  1106. package/src/flow/models/blocks/table/JSColumnModel.tsx +307 -0
  1107. package/src/flow/models/blocks/table/TableActionsColumnModel.tsx +243 -0
  1108. package/src/flow/models/blocks/table/TableAssociationFieldGroupModel.tsx +18 -0
  1109. package/src/flow/models/blocks/table/TableBlockModel.tsx +1203 -0
  1110. package/src/flow/models/blocks/table/TableColumnModel.tsx +564 -0
  1111. package/src/flow/models/blocks/table/TableCustomColumnModel.tsx +116 -0
  1112. package/src/flow/models/blocks/table/TableJSFieldItemModel.tsx +38 -0
  1113. package/src/flow/models/blocks/table/TableSelectModel.tsx +85 -0
  1114. package/src/flow/models/blocks/table/__tests__/JSColumnModel.test.tsx +51 -0
  1115. package/src/flow/models/blocks/table/__tests__/TableActionsColumnModel.test.tsx +282 -0
  1116. package/src/flow/models/blocks/table/__tests__/TableBlockModel.blockHeight.test.tsx +120 -0
  1117. package/src/flow/models/blocks/table/__tests__/TableBlockModel.popupSourceId.test.ts +87 -0
  1118. package/src/flow/models/blocks/table/__tests__/TableBlockModel.quickEditRefresh.test.ts +49 -0
  1119. package/src/flow/models/blocks/table/__tests__/TableBlockModel.rowClick.test.ts +69 -0
  1120. package/src/flow/models/blocks/table/__tests__/TableBlockModel.rowSelection.test.tsx +114 -0
  1121. package/src/flow/models/blocks/table/__tests__/TableColumnModel.test.tsx +203 -0
  1122. package/src/flow/models/blocks/table/__tests__/TableSelectModel.test.ts +41 -0
  1123. package/src/flow/models/blocks/table/__tests__/sortUtils.test.ts +58 -0
  1124. package/src/flow/models/blocks/table/dragSort/dragSortComponents.tsx +10 -0
  1125. package/src/flow/models/blocks/table/dragSort/dragSortHooks.tsx +130 -0
  1126. package/src/flow/models/blocks/table/dragSort/dragSortSettings.ts +62 -0
  1127. package/src/flow/models/blocks/table/dragSort/dragSortUtils.ts +57 -0
  1128. package/src/flow/models/blocks/table/dragSort/index.ts +13 -0
  1129. package/src/flow/models/blocks/table/index.ts +18 -0
  1130. package/src/flow/models/blocks/table/sortUtils.ts +52 -0
  1131. package/src/flow/models/blocks/table/utils.ts +125 -0
  1132. package/src/flow/models/blocks/utils/__tests__/transformChildrenToJS.test.ts +216 -0
  1133. package/src/flow/models/blocks/utils/transformChildrenToJS.ts +158 -0
  1134. package/src/flow/models/fields/AssociationFieldModel/AssociationFieldModel.tsx +47 -0
  1135. package/src/flow/models/fields/AssociationFieldModel/CascadeSelectFieldModel.tsx +822 -0
  1136. package/src/flow/models/fields/AssociationFieldModel/PopupSubTableFieldModel/PopupSubTableActionGroupModel.tsx +19 -0
  1137. package/src/flow/models/fields/AssociationFieldModel/PopupSubTableFieldModel/PopupSubTableActionsColumnModel.tsx +212 -0
  1138. package/src/flow/models/fields/AssociationFieldModel/PopupSubTableFieldModel/PopupSubTableFieldModel.tsx +913 -0
  1139. package/src/flow/models/fields/AssociationFieldModel/PopupSubTableFieldModel/actions/PopupSubTableEditActionModel.tsx +383 -0
  1140. package/src/flow/models/fields/AssociationFieldModel/PopupSubTableFieldModel/actions/PopupSubTableFormSubmitActionModel.tsx +121 -0
  1141. package/src/flow/models/fields/AssociationFieldModel/PopupSubTableFieldModel/actions/PopupSubTableRemoveActionModel.tsx +101 -0
  1142. package/src/flow/models/fields/AssociationFieldModel/PopupSubTableFieldModel/actions/__tests__/popupSubTableBeforeClose.test.ts +98 -0
  1143. package/src/flow/models/fields/AssociationFieldModel/PopupSubTableFieldModel/actions/popupSubTableBeforeClose.ts +158 -0
  1144. package/src/flow/models/fields/AssociationFieldModel/PopupSubTableFieldModel/blocks/PopupSubTableFormModel.tsx +235 -0
  1145. package/src/flow/models/fields/AssociationFieldModel/PopupSubTableFieldModel/index.tsx +18 -0
  1146. package/src/flow/models/fields/AssociationFieldModel/RecordPickerFieldModel.tsx +514 -0
  1147. package/src/flow/models/fields/AssociationFieldModel/RecordSelectFieldModel.tsx +1009 -0
  1148. package/src/flow/models/fields/AssociationFieldModel/SubFormFieldModel.tsx +655 -0
  1149. package/src/flow/models/fields/AssociationFieldModel/SubTableFieldModel/SubTableColumnModel.tsx +1055 -0
  1150. package/src/flow/models/fields/AssociationFieldModel/SubTableFieldModel/SubTableField.tsx +306 -0
  1151. package/src/flow/models/fields/AssociationFieldModel/SubTableFieldModel/__tests__/SubTableColumnModel.rowRecord.test.ts +211 -0
  1152. package/src/flow/models/fields/AssociationFieldModel/SubTableFieldModel/__tests__/SubTableField.refresh.test.tsx +122 -0
  1153. package/src/flow/models/fields/AssociationFieldModel/SubTableFieldModel/index.tsx +401 -0
  1154. package/src/flow/models/fields/AssociationFieldModel/SubTableFieldModel/rowIdentity.ts +70 -0
  1155. package/src/flow/models/fields/AssociationFieldModel/__tests__/RecordPickerFieldModel.itemContext.test.ts +248 -0
  1156. package/src/flow/models/fields/AssociationFieldModel/__tests__/SubTableRowIdentity.test.ts +45 -0
  1157. package/src/flow/models/fields/AssociationFieldModel/__tests__/recordSelectShared.fieldNames.test.ts +60 -0
  1158. package/src/flow/models/fields/AssociationFieldModel/index.tsx +16 -0
  1159. package/src/flow/models/fields/AssociationFieldModel/itemChain.ts +362 -0
  1160. package/src/flow/models/fields/AssociationFieldModel/recordSelectSettingsUtils.ts +20 -0
  1161. package/src/flow/models/fields/AssociationFieldModel/recordSelectShared.tsx +283 -0
  1162. package/src/flow/models/fields/CheckboxFieldModel.tsx +31 -0
  1163. package/src/flow/models/fields/CheckboxGroupFieldModel.tsx +25 -0
  1164. package/src/flow/models/fields/ClickableFieldModel.tsx +355 -0
  1165. package/src/flow/models/fields/CollectionSelectorFieldModel.tsx +100 -0
  1166. package/src/flow/models/fields/ColorFieldModel.tsx +61 -0
  1167. package/src/flow/models/fields/DateTimeFieldModel/DateOnlyFieldModel.tsx +70 -0
  1168. package/src/flow/models/fields/DateTimeFieldModel/DateTimeFieldModel.tsx +30 -0
  1169. package/src/flow/models/fields/DateTimeFieldModel/DateTimeNoTzFieldModel.tsx +62 -0
  1170. package/src/flow/models/fields/DateTimeFieldModel/DateTimeTzFieldModel.tsx +105 -0
  1171. package/src/flow/models/fields/DateTimeFieldModel/__tests__/DateTimeNoTzFieldModel.dateLimit.test.tsx +242 -0
  1172. package/src/flow/models/fields/DateTimeFieldModel/dateLimit.ts +152 -0
  1173. package/src/flow/models/fields/DateTimeFieldModel/index.ts +12 -0
  1174. package/src/flow/models/fields/DisplayAssociationField/DisplaySubItemFieldModel.tsx +70 -0
  1175. package/src/flow/models/fields/DisplayAssociationField/DisplaySubListFieldModel.tsx +136 -0
  1176. package/src/flow/models/fields/DisplayAssociationField/DisplaySubTableFieldModel.tsx +271 -0
  1177. package/src/flow/models/fields/DisplayAssociationField/__tests__/DisplaySubListFieldModel.utils.test.ts +41 -0
  1178. package/src/flow/models/fields/DisplayAssociationField/displaySubListUtils.ts +29 -0
  1179. package/src/flow/models/fields/DisplayAssociationField/index.tsx +12 -0
  1180. package/src/flow/models/fields/DisplayCheckboxFieldModel.tsx +36 -0
  1181. package/src/flow/models/fields/DisplayColorFieldModel.tsx +45 -0
  1182. package/src/flow/models/fields/DisplayDateTimeFieldModel.tsx +59 -0
  1183. package/src/flow/models/fields/DisplayEnumFieldModel.tsx +173 -0
  1184. package/src/flow/models/fields/DisplayHtmlFieldModel.tsx +39 -0
  1185. package/src/flow/models/fields/DisplayIconFieldModel.tsx +24 -0
  1186. package/src/flow/models/fields/DisplayJSONFieldModel.tsx +103 -0
  1187. package/src/flow/models/fields/DisplayNumberFieldModel.tsx +239 -0
  1188. package/src/flow/models/fields/DisplayPasswordFieldModel.tsx +30 -0
  1189. package/src/flow/models/fields/DisplayPercentFieldModel.tsx +165 -0
  1190. package/src/flow/models/fields/DisplayTextFieldModel.tsx +51 -0
  1191. package/src/flow/models/fields/DisplayTimeFieldModel.tsx +47 -0
  1192. package/src/flow/models/fields/DisplayTitleFieldModel.tsx +112 -0
  1193. package/src/flow/models/fields/DisplayURLFieldModel.tsx +41 -0
  1194. package/src/flow/models/fields/DividerItemModel.tsx +115 -0
  1195. package/src/flow/models/fields/IconFieldModel.tsx +172 -0
  1196. package/src/flow/models/fields/InputFieldModel.tsx +65 -0
  1197. package/src/flow/models/fields/JSEditableFieldModel.tsx +415 -0
  1198. package/src/flow/models/fields/JSFieldModel.tsx +224 -0
  1199. package/src/flow/models/fields/JSItemModel.tsx +163 -0
  1200. package/src/flow/models/fields/JsonFieldModel.tsx +121 -0
  1201. package/src/flow/models/fields/MarkdownItemModel.tsx +68 -0
  1202. package/src/flow/models/fields/NumberFieldModel.tsx +68 -0
  1203. package/src/flow/models/fields/PasswordFieldModel.tsx +53 -0
  1204. package/src/flow/models/fields/PercentFieldModel.tsx +53 -0
  1205. package/src/flow/models/fields/RadioGroupFieldModel.tsx +26 -0
  1206. package/src/flow/models/fields/RichTextFieldModel/index.tsx +115 -0
  1207. package/src/flow/models/fields/RichTextFieldModel/registerFontSize.tsx +18 -0
  1208. package/src/flow/models/fields/RichTextFieldModel/registerImageResize.tsx +56 -0
  1209. package/src/flow/models/fields/RichTextFieldModel/registerSmartBreak.tsx +90 -0
  1210. package/src/flow/models/fields/RichTextFieldModel/style.ts +493 -0
  1211. package/src/flow/models/fields/SelectFieldModel.tsx +166 -0
  1212. package/src/flow/models/fields/TextareaFieldModel.tsx +31 -0
  1213. package/src/flow/models/fields/TimeFieldModel.tsx +66 -0
  1214. package/src/flow/models/fields/VariableFieldFormModel.tsx +67 -0
  1215. package/src/flow/models/fields/__tests__/ClickableFieldModel.test.ts +288 -0
  1216. package/src/flow/models/fields/__tests__/DisplayEnumFieldModel.test.tsx +39 -0
  1217. package/src/flow/models/fields/__tests__/JSEditableFieldModel.test.tsx +307 -0
  1218. package/src/flow/models/fields/__tests__/TimeFieldModel.test.tsx +61 -0
  1219. package/src/flow/models/fields/index.ts +52 -0
  1220. package/src/flow/models/fields/mobile-components/MobileDatePicker.tsx +125 -0
  1221. package/src/flow/models/fields/mobile-components/MobileLazySelect.tsx +319 -0
  1222. package/src/flow/models/fields/mobile-components/MobileSelect.tsx +102 -0
  1223. package/src/flow/models/fields/mobile-components/MobileTimePicker.tsx +37 -0
  1224. package/src/flow/models/fields/mobile-components/__tests__/MobileDatePicker.test.tsx +94 -0
  1225. package/src/flow/models/fields/mobile-components/__tests__/MobileSelect.test.tsx +242 -0
  1226. package/src/flow/models/index.ts +14 -0
  1227. package/src/flow/models/topbar/TopbarActionModel.tsx +414 -0
  1228. package/src/flow/models/topbar/UserCenterTopbarActionModel.tsx +592 -0
  1229. package/src/flow/models/topbar/index.ts +11 -0
  1230. package/src/flow/models/utils/displayValueUtils.ts +57 -0
  1231. package/src/flow/models/utils/resolveRunJsParams.ts +24 -0
  1232. package/src/flow/resolveViewParamsToViewList.tsx +79 -0
  1233. package/src/flow/system-settings/SystemSettingsSource.ts +155 -0
  1234. package/src/flow/system-settings/index.ts +11 -0
  1235. package/src/flow/system-settings/useSystemSettings.tsx +86 -0
  1236. package/src/flow/utils/__tests__/actionCapability.test.ts +79 -0
  1237. package/src/flow/utils/__tests__/dateTimeFormat.test.ts +91 -0
  1238. package/src/flow/utils/__tests__/dispatchEventDeep.test.ts +72 -0
  1239. package/src/flow/utils/__tests__/pagination.test.ts +64 -0
  1240. package/src/flow/utils/actionCapability.ts +150 -0
  1241. package/src/flow/utils/blockUtils.ts +32 -0
  1242. package/src/flow/utils/dataScopeFormValueClear.ts +278 -0
  1243. package/src/flow/utils/dispatchEventDeep.ts +66 -0
  1244. package/src/flow/utils/index.ts +12 -0
  1245. package/src/flow/utils/pagination.ts +110 -0
  1246. package/src/flow/utils/useJsonTemplateResolver.ts +25 -0
  1247. package/src/flow-compat/ColorPicker.tsx +88 -0
  1248. package/src/flow-compat/FieldValidation.tsx +598 -0
  1249. package/src/flow-compat/HighPerformanceSpin.tsx +45 -0
  1250. package/src/flow-compat/Icon.tsx +11 -0
  1251. package/src/flow-compat/IconPicker.tsx +186 -0
  1252. package/src/flow-compat/Password.tsx +78 -0
  1253. package/src/flow-compat/PasswordStrength.tsx +27 -0
  1254. package/src/flow-compat/Popover.tsx +60 -0
  1255. package/src/flow-compat/data.ts +43 -0
  1256. package/src/flow-compat/date.ts +116 -0
  1257. package/src/flow-compat/fieldValidationConstants.ts +305 -0
  1258. package/src/flow-compat/index.ts +34 -0
  1259. package/src/flow-compat/lazy.tsx +110 -0
  1260. package/src/flow-compat/operators.ts +367 -0
  1261. package/src/flow-compat/passwordUtils.ts +153 -0
  1262. package/src/flow-compat/routeTypes.ts +61 -0
  1263. package/src/flow-compat/useFullscreenOverlay.ts +139 -0
  1264. package/src/flow-compat/zIndexContext.tsx +28 -0
  1265. package/src/hooks/index.ts +2 -0
  1266. package/src/hooks/useApp.ts +5 -3
  1267. package/src/hooks/useCurrentAppInfo.ts +36 -0
  1268. package/src/hooks/usePlugin.ts +2 -2
  1269. package/src/i18n.ts +25 -0
  1270. package/src/index.ts +28 -0
  1271. package/src/json-logic/globalOperators.js +731 -0
  1272. package/src/layout-manager/LayoutContentRoute.tsx +90 -0
  1273. package/src/layout-manager/LayoutManager.tsx +185 -0
  1274. package/src/layout-manager/LayoutRoute.tsx +138 -0
  1275. package/src/layout-manager/__tests__/LayoutManager.test.tsx +335 -0
  1276. package/src/layout-manager/__tests__/LayoutRoute.test.tsx +473 -0
  1277. package/src/layout-manager/index.ts +14 -0
  1278. package/src/layout-manager/types.ts +22 -0
  1279. package/src/layout-manager/utils.ts +37 -0
  1280. package/src/locale/languageCodes.ts +83 -0
  1281. package/src/nocobase-buildin-plugin/index.tsx +374 -0
  1282. package/src/nocobase-buildin-plugin/plugins/LocalePlugin.ts +62 -0
  1283. package/src/nocobase-buildin-plugin/plugins/dayjsLocale.ts +77 -0
  1284. package/src/nocobase-buildin-plugin/plugins/loadConstrueLocale.ts +182 -0
  1285. package/src/react-is.d.ts +12 -0
  1286. package/src/settings-center/AdminSettingsLayout.tsx +333 -0
  1287. package/src/settings-center/AdminSettingsLayoutModel.tsx +32 -0
  1288. package/src/settings-center/SystemSettingsPage.tsx +298 -0
  1289. package/src/settings-center/index.ts +14 -0
  1290. package/src/settings-center/plugin-manager/BulkEnableButton.tsx +111 -0
  1291. package/src/settings-center/plugin-manager/PluginCard.tsx +270 -0
  1292. package/src/settings-center/plugin-manager/PluginDetail.tsx +195 -0
  1293. package/src/settings-center/plugin-manager/index.tsx +254 -0
  1294. package/src/settings-center/plugin-manager/types.ts +35 -0
  1295. package/src/settings-center/utils.tsx +284 -0
  1296. package/src/theme/AntdAppProvider.tsx +52 -0
  1297. package/src/theme/__tests__/globalStyles.test.ts +24 -0
  1298. package/src/theme/compatOldTheme.ts +21 -0
  1299. package/src/theme/customAlgorithm.ts +43 -0
  1300. package/src/theme/defaultTheme.ts +32 -0
  1301. package/src/theme/globalStyles.ts +31 -0
  1302. package/src/theme/index.tsx +105 -0
  1303. package/src/theme/type.ts +50 -0
  1304. package/src/utils/appVersionHTML.ts +28 -0
  1305. package/src/utils/globalDeps.ts +107 -0
  1306. package/src/utils/index.tsx +10 -4
  1307. package/src/utils/remotePlugins.ts +131 -48
  1308. package/src/utils/requirejs.ts +1 -1
  1309. package/LICENSE.txt +0 -172
  1310. package/lib/Application.d.ts +0 -124
  1311. package/lib/Application.js +0 -489
  1312. package/lib/MockApplication.js +0 -96
  1313. package/lib/Plugin.d.ts +0 -33
  1314. package/lib/Plugin.js +0 -89
  1315. package/lib/PluginManager.d.ts +0 -46
  1316. package/lib/PluginManager.js +0 -114
  1317. package/lib/PluginSettingsManager.d.ts +0 -67
  1318. package/lib/PluginSettingsManager.js +0 -148
  1319. package/lib/RouterManager.js +0 -198
  1320. package/lib/WebSocketClient.js +0 -217
  1321. package/lib/components/BlankComponent.js +0 -48
  1322. package/lib/components/MainComponent.js +0 -54
  1323. package/lib/components/RouterBridge.js +0 -66
  1324. package/lib/components/RouterContextCleaner.js +0 -61
  1325. package/lib/components/index.js +0 -32
  1326. package/lib/context.js +0 -38
  1327. package/lib/hooks/index.js +0 -34
  1328. package/lib/hooks/useApp.js +0 -41
  1329. package/lib/hooks/usePlugin.js +0 -42
  1330. package/lib/hooks/useRouter.js +0 -41
  1331. package/lib/utils/index.js +0 -79
  1332. package/lib/utils/remotePlugins.js +0 -131
  1333. package/lib/utils/requirejs.js +0 -1361
  1334. package/lib/utils/types.js +0 -28
  1335. /package/{lib → es}/MockApplication.d.ts +0 -0
  1336. /package/{lib → es}/components/BlankComponent.d.ts +0 -0
  1337. /package/{lib → es}/components/MainComponent.d.ts +0 -0
  1338. /package/{lib → es}/components/RouterContextCleaner.d.ts +0 -0
  1339. /package/{lib → es}/context.d.ts +0 -0
  1340. /package/{lib → es}/utils/requirejs.d.ts +0 -0
  1341. /package/{lib → es}/utils/types.d.ts +0 -0
@@ -0,0 +1,1935 @@
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
+ import { isObservable, reaction, toJS } from '@formily/reactive';
11
+ import { FlowContext, FlowModel, isRunJSValue, normalizeRunJSValue, runjsWithSafeGlobals } from '@nocobase/flow-engine';
12
+ import _ from 'lodash';
13
+ import { dayjs } from '@nocobase/utils/client';
14
+ import { evaluateCondition } from './conditions';
15
+ import { collectStaticDepsFromRunJSValue, collectStaticDepsFromTemplateValue, DepCollector, recordDep } from './deps';
16
+ import { namePathToPathKey, parsePathString, pathKeyToNamePath } from './path';
17
+ import type { FormAssignRuleItem, FormValueWriteMeta, NamePath, Patch, SetOptions, ValueSource } from './types';
18
+ import { createTxId, isEmptyValue } from './utils';
19
+ import { isToManyAssociationField } from '../../../../internal/utils/modelUtils';
20
+ import { getSubTableRowIdentity } from '../../../fields/AssociationFieldModel/SubTableFieldModel/rowIdentity';
21
+
22
+ /** Symbol to indicate rule value resolution should be skipped */
23
+ const SKIP_RULE_VALUE = Symbol('SKIP_RULE_VALUE');
24
+ const UNRESOLVED_ASSOCIATION_IDENTITY = Symbol('UNRESOLVED_ASSOCIATION_IDENTITY');
25
+
26
+ // default 规则的优先级:
27
+ // - step 初始值(editItemSettings/formItemSettings.initialValue):priority=0(低于表单赋值)
28
+ // - props.initialValue(通常为联动规则临时写入):需要覆盖表单赋值,因此提升优先级
29
+ const LINKAGE_DEFAULT_RULE_PRIORITY = 1000;
30
+
31
+ type RuleDeps = Set<string>;
32
+
33
+ type RuleState = {
34
+ deps: RuleDeps;
35
+ depDisposers: Array<() => void>;
36
+ runSeq: number;
37
+ /** Write sequence when this rule was last scheduled */
38
+ scheduledAtWriteSeq: number;
39
+ };
40
+
41
+ type RuntimeRule = {
42
+ id: string;
43
+ source: ValueSource;
44
+ priority: number;
45
+ debounceMs: number;
46
+ getEnabled: () => boolean;
47
+ getTarget: () => string | NamePath;
48
+ getValue: () => any;
49
+ getCondition?: () => any;
50
+ getContext: () => any;
51
+ };
52
+
53
+ type ObservableBinding = {
54
+ source: ValueSource;
55
+ pathKey: string;
56
+ dispose: () => void;
57
+ };
58
+
59
+ type AssignMode = 'default' | 'assign';
60
+
61
+ export type RuleEngineOptions = {
62
+ getBlockModelUid: () => string;
63
+ getActionName: () => string | undefined;
64
+ getBlockContext: () => any;
65
+ getEngine: () => any;
66
+ getEngineModel: (uid: string) => FlowModel | null;
67
+ isDisposed: () => boolean;
68
+ valuesMirror: any;
69
+ changeTick: { value: number };
70
+ getWriteSeq: () => number;
71
+ txWriteCounts: Map<string, Map<string, number>>;
72
+ createTrackingFormValues: (collector: DepCollector) => any;
73
+ tryResolveNamePath: (callerCtx: any, path: string | NamePath) => NamePath | null;
74
+ getFormValueAtPath: (namePath: NamePath) => any;
75
+ setFormValues: (callerCtx: any, patch: Patch, options?: SetOptions) => Promise<void>;
76
+ findExplicitHit: (pathKey: string) => string | null;
77
+ lastDefaultValueByPathKey: Map<string, any>;
78
+ lastWriteMetaByPathKey: Map<string, FormValueWriteMeta>;
79
+ observableBindings: Map<string, ObservableBinding>;
80
+ };
81
+
82
+ export class RuleEngine {
83
+ private readonly options: RuleEngineOptions;
84
+
85
+ private readonly rules = new Map<string, { rule: RuntimeRule; state: RuleState }>();
86
+ // 仅用于 rule 引擎内部的“同源 default 规则”优先级仲裁;避免低优先级 default 在高优先级 default 写入后再次回写覆盖。
87
+ private readonly lastRuleWriteByTargetKey = new Map<
88
+ string,
89
+ { source: ValueSource; priority: number; writeSeq: number }
90
+ >();
91
+ private readonly assignTemplatesByTargetPath = new Map<
92
+ string,
93
+ Array<FormAssignRuleItem & { __key: string; __order: number }>
94
+ >();
95
+ /** 当前表单中“已配置到 UI 的字段(FormItemModel)”的 targetPath 集合,用于避免对 row grid 重复注册规则 */
96
+ private readonly formItemTargetPaths = new Set<string>();
97
+ /** targetPath -> updateAssociation(SubForm/SubTable 等) */
98
+ private readonly updateAssociationByTargetPath = new Map<string, boolean>();
99
+ private readonly pendingRuleIds = new Set<string>();
100
+ private readonly ruleDebounceUntilById = new Map<string, number>();
101
+ private readonly ruleDebounceTimersById = new Map<string, ReturnType<typeof setTimeout>>();
102
+
103
+ private readonly defaultRuleIdsByMasterUid = new Map<string, Set<string>>();
104
+ private readonly defaultRuleMasterDisposers = new Map<string, () => void>();
105
+
106
+ private runningRules = false;
107
+ private rulesEnabled = false;
108
+ private currentRuleTxId: string | null = null;
109
+
110
+ constructor(options: RuleEngineOptions) {
111
+ this.options = options;
112
+ }
113
+
114
+ private getAssignRuleBlockId(templateKey: string) {
115
+ return `form-assign:${templateKey}:block`;
116
+ }
117
+
118
+ private removeAssignRuleBlockInstance(templateKey: string) {
119
+ const blockId = this.getAssignRuleBlockId(templateKey);
120
+ if (this.rules.has(blockId)) {
121
+ this.removeRule(blockId);
122
+ }
123
+ }
124
+
125
+ private removeRowGridAssignRuleInstances(templateKey: string) {
126
+ const prefix = `form-assign:${templateKey}:`;
127
+ const blockId = this.getAssignRuleBlockId(templateKey);
128
+ const toRemove: string[] = [];
129
+
130
+ for (const [id, entry] of this.rules.entries()) {
131
+ if (!id.startsWith(prefix)) continue;
132
+ if (id === blockId) continue;
133
+ const ctx = entry?.rule?.getContext?.();
134
+ const ctxModel = ctx?.model;
135
+ if (ctxModel && this.isRowGridModel(ctxModel as any)) {
136
+ toRemove.push(id);
137
+ }
138
+ }
139
+
140
+ for (const id of toRemove) {
141
+ this.removeRule(id);
142
+ }
143
+ }
144
+
145
+ private hasAnyNonBlockAssignRuleInstance(templateKey: string) {
146
+ const prefix = `form-assign:${templateKey}:`;
147
+ const blockId = this.getAssignRuleBlockId(templateKey);
148
+ for (const id of this.rules.keys()) {
149
+ if (!id.startsWith(prefix)) continue;
150
+ if (id === blockId) continue;
151
+ return true;
152
+ }
153
+ return false;
154
+ }
155
+
156
+ private ensureBlockAssignRuleInstancesForTargetPath(targetPath: string) {
157
+ if (this.options.isDisposed()) return;
158
+ if (!targetPath) return;
159
+ if (!this.shouldCreateBlockLevelAssignRule(targetPath)) return;
160
+
161
+ const templates = this.assignTemplatesByTargetPath.get(targetPath) || [];
162
+ if (!templates.length) return;
163
+
164
+ for (const template of templates) {
165
+ const templateKey = template?.__key ? String(template.__key) : '';
166
+ if (!templateKey) continue;
167
+ if (this.hasAnyNonBlockAssignRuleInstance(templateKey)) continue;
168
+
169
+ const mode: AssignMode = template?.mode === 'default' ? 'default' : 'assign';
170
+ const source: ValueSource = mode === 'default' ? 'default' : 'system';
171
+ const enabled = template?.enable !== false;
172
+ const id = this.getAssignRuleBlockId(templateKey);
173
+ if (this.rules.has(id)) continue;
174
+
175
+ const rule: RuntimeRule = {
176
+ id,
177
+ source,
178
+ priority: 10 + (template.__order || 0),
179
+ debounceMs: 0,
180
+ getEnabled: () => enabled && !!targetPath,
181
+ getTarget: () => targetPath,
182
+ getValue: () => template?.value,
183
+ getCondition: () => template?.condition,
184
+ getContext: () => this.options.getBlockContext(),
185
+ };
186
+
187
+ this.rules.set(id, { rule, state: { deps: new Set(), depDisposers: [], runSeq: 0, scheduledAtWriteSeq: 0 } });
188
+ this.scheduleRule(id);
189
+ }
190
+ }
191
+
192
+ private getCollectionFromContext(baseCtx: any): any | undefined {
193
+ return baseCtx?.collection ?? baseCtx?.model?.context?.collection;
194
+ }
195
+
196
+ private getRootCollection(): any | undefined {
197
+ const blockCtx = this.options.getBlockContext();
198
+ return this.getCollectionFromContext(blockCtx);
199
+ }
200
+
201
+ private shouldCreateBlockLevelAssignRule(targetPath: string): boolean {
202
+ const blockCtx = this.options.getBlockContext();
203
+ let collection = this.getCollectionFromContext(blockCtx);
204
+ if (!collection?.getField) return true;
205
+
206
+ const segs = parsePathString(targetPath).filter((seg) => typeof seg !== 'object') as NamePath;
207
+ if (segs.length <= 1) return true;
208
+
209
+ for (let i = 0; i < segs.length - 1; i++) {
210
+ const seg = segs[i];
211
+ if (typeof seg !== 'string') continue;
212
+
213
+ const field = collection?.getField?.(seg);
214
+ if (!field?.isAssociationField?.()) break;
215
+
216
+ // 对多关联:若后续没有显式 index,则 block 级无法确定要写入哪一行,必须等 row fork 上下文
217
+ if (isToManyAssociationField(field)) {
218
+ const next = segs[i + 1];
219
+ if (typeof next !== 'number') {
220
+ return false;
221
+ }
222
+ // 已显式指定 index(如 users[0].nickname):跳过 index 段继续解析
223
+ i += 1;
224
+ }
225
+
226
+ collection = field?.targetCollection;
227
+ if (!collection?.getField) break;
228
+ }
229
+
230
+ return true;
231
+ }
232
+
233
+ /**
234
+ * 对关联字段嵌套属性(如 user.name / user.profile.name):
235
+ * - 依赖应包含关联对象本身(user / user.profile),否则当关联对象从 null -> {id} 时,user.name 仍为 undefined,无法触发 rule re-run。
236
+ * - 写入前需校验关联对象已存在,避免隐式创建关联对象。
237
+ */
238
+ private collectAssociationPrefixPaths(baseCtx: any, targetNamePath: NamePath): NamePath[] {
239
+ const out: NamePath[] = [];
240
+ let collection = this.getRootCollection() || this.getCollectionFromContext(baseCtx);
241
+ if (!collection?.getField) return out;
242
+
243
+ const prefix: NamePath = [];
244
+ for (let i = 0; i < targetNamePath.length - 1; i++) {
245
+ const seg = targetNamePath[i];
246
+ if (typeof seg !== 'string') break;
247
+
248
+ const field = collection?.getField?.(seg);
249
+ if (!field?.isAssociationField?.()) break;
250
+
251
+ prefix.push(seg);
252
+
253
+ // 对多关联:需要将 index 一并纳入 prefix(如 users[0]),否则无法检查/追踪行内的关联对象
254
+ if (isToManyAssociationField(field)) {
255
+ const next = targetNamePath[i + 1];
256
+ if (typeof next !== 'number') break;
257
+ prefix.push(next);
258
+ i += 1;
259
+ }
260
+
261
+ out.push([...prefix]);
262
+ collection = (field as any)?.targetCollection;
263
+ if (!collection?.getField) break;
264
+ }
265
+
266
+ return out;
267
+ }
268
+
269
+ private shouldSkipToManyAssociationWriteWithoutIndex(baseCtx: any, targetNamePath: NamePath): boolean {
270
+ let collection = this.getRootCollection() || this.getCollectionFromContext(baseCtx);
271
+ if (!collection?.getField) return false;
272
+
273
+ for (let i = 0; i < targetNamePath.length - 1; i++) {
274
+ const seg = targetNamePath[i];
275
+ if (typeof seg !== 'string') continue;
276
+
277
+ const field = collection?.getField?.(seg);
278
+ if (!field?.isAssociationField?.()) break;
279
+
280
+ if (isToManyAssociationField(field)) {
281
+ const next = targetNamePath[i + 1];
282
+ if (typeof next !== 'number') {
283
+ return true;
284
+ }
285
+ i += 1;
286
+ }
287
+
288
+ collection = field?.targetCollection;
289
+ if (!collection?.getField) break;
290
+ }
291
+
292
+ return false;
293
+ }
294
+
295
+ private shouldSkipAssociationNestedWrite(baseCtx: any, targetNamePath: NamePath): boolean {
296
+ const prefixes = this.collectAssociationPrefixPaths(baseCtx, targetNamePath);
297
+ if (!prefixes.length) return false;
298
+
299
+ for (const p of prefixes) {
300
+ const v = this.options.getFormValueAtPath(p);
301
+ if (v == null) {
302
+ // updateAssociation(子表单/子表格)场景下允许隐式创建关联对象/行,
303
+ // 以便嵌套字段的默认值/复制模式在首次渲染时即可生效。
304
+ const targetPath = p.filter((seg) => typeof seg === 'string').join('.');
305
+ if (targetPath && this.getUpdateAssociationForTargetPath(targetPath)) {
306
+ continue;
307
+ }
308
+ // 特殊:当目标为“关联记录主键/targetKey”(如 user.id)时,允许在关联对象为空时写入,
309
+ // 以支持通过主键为关联字段设置默认值/赋值(常见于 RecordSelect/RecordPicker)。
310
+ if (this.isAssociationTargetKeyWrite(baseCtx, targetNamePath, p)) {
311
+ continue;
312
+ }
313
+ return true;
314
+ }
315
+ if (typeof v !== 'object') return true;
316
+ }
317
+
318
+ return false;
319
+ }
320
+
321
+ private getAssociationTargetKeyFields(associationField: any): string[] {
322
+ const raw =
323
+ associationField?.targetKey ??
324
+ associationField?.targetCollection?.filterTargetKey ??
325
+ associationField?.targetCollection?.filterByTk ??
326
+ 'id';
327
+ if (Array.isArray(raw)) {
328
+ return raw.filter((v): v is string => typeof v === 'string' && !!v);
329
+ }
330
+ if (typeof raw === 'string' && raw) return [raw];
331
+ return ['id'];
332
+ }
333
+
334
+ private resolveAssociationFieldByPrefixPath(baseCtx: any, prefixPath: NamePath): any | null {
335
+ let collection = this.getRootCollection() || this.getCollectionFromContext(baseCtx);
336
+ if (!collection?.getField) return null;
337
+
338
+ let lastAssociationField: any | null = null;
339
+ for (const seg of prefixPath) {
340
+ if (typeof seg === 'number') {
341
+ // index segment for to-many association
342
+ continue;
343
+ }
344
+ if (typeof seg !== 'string' || !seg) break;
345
+ const field: any = collection?.getField?.(seg);
346
+ if (!field?.isAssociationField?.()) break;
347
+ lastAssociationField = field;
348
+ collection = field?.targetCollection;
349
+ if (!collection?.getField) break;
350
+ }
351
+ return lastAssociationField;
352
+ }
353
+
354
+ private isAssociationTargetKeyWrite(baseCtx: any, targetNamePath: NamePath, prefixPath: NamePath): boolean {
355
+ // Only allow direct `assoc.<targetKey>` writes (e.g. `user.id`).
356
+ if (!Array.isArray(targetNamePath) || !Array.isArray(prefixPath)) return false;
357
+ if (targetNamePath.length !== prefixPath.length + 1) return false;
358
+ const keySeg = targetNamePath[prefixPath.length];
359
+ if (typeof keySeg !== 'string' || !keySeg) return false;
360
+
361
+ const assocField = this.resolveAssociationFieldByPrefixPath(baseCtx, prefixPath);
362
+ if (!assocField?.isAssociationField?.()) return false;
363
+ if (isToManyAssociationField(assocField)) return false;
364
+
365
+ const keys = this.getAssociationTargetKeyFields(assocField);
366
+ return keys.includes(keySeg);
367
+ }
368
+
369
+ private collectUpdateAssociationInitPatches(
370
+ baseCtx: any,
371
+ targetNamePath: NamePath,
372
+ ): Array<{ path: NamePath; value: any }> | null {
373
+ const prefixes = this.collectAssociationPrefixPaths(baseCtx, targetNamePath);
374
+ if (!prefixes.length) return [];
375
+
376
+ const patches: Array<{ path: NamePath; value: any }> = [];
377
+
378
+ for (const p of prefixes) {
379
+ const v = this.options.getFormValueAtPath(p);
380
+ if (v == null) {
381
+ const targetPath = p.filter((seg) => typeof seg === 'string').join('.');
382
+ if (!targetPath) return null;
383
+ if (this.getUpdateAssociationForTargetPath(targetPath)) {
384
+ // 标记为“新增记录”,与子表单的 add({ __is_new__: true }) 行为一致。
385
+ patches.push({ path: [...p, '__is_new__'], value: true });
386
+ continue;
387
+ }
388
+
389
+ // 特殊:当目标为“关联记录主键/targetKey”(如 user.id)时,
390
+ // 允许在关联对象为空时写入,并初始化为空对象以确保后续 setFieldValue 能正确落值。
391
+ if (this.isAssociationTargetKeyWrite(baseCtx, targetNamePath, p)) {
392
+ patches.push({ path: [...p], value: {} });
393
+ continue;
394
+ }
395
+
396
+ return null;
397
+ }
398
+ if (typeof v !== 'object') return null;
399
+ }
400
+
401
+ const byKey = new Map<string, { path: NamePath; value: any }>();
402
+ for (const it of patches) {
403
+ const k = namePathToPathKey(it.path as any);
404
+ if (!byKey.has(k)) {
405
+ byKey.set(k, it);
406
+ }
407
+ }
408
+
409
+ return Array.from(byKey.values());
410
+ }
411
+
412
+ dispose() {
413
+ for (const { state } of this.rules.values()) {
414
+ state.depDisposers.forEach((d) => d());
415
+ }
416
+ this.rules.clear();
417
+ this.pendingRuleIds.clear();
418
+ this.assignTemplatesByTargetPath.clear();
419
+
420
+ for (const disposer of this.defaultRuleMasterDisposers.values()) {
421
+ disposer();
422
+ }
423
+ this.defaultRuleMasterDisposers.clear();
424
+ this.defaultRuleIdsByMasterUid.clear();
425
+
426
+ for (const timer of this.ruleDebounceTimersById.values()) {
427
+ clearTimeout(timer);
428
+ }
429
+ this.ruleDebounceTimersById.clear();
430
+ this.ruleDebounceUntilById.clear();
431
+ }
432
+
433
+ enable() {
434
+ this.rulesEnabled = true;
435
+ if (this.pendingRuleIds.size && !this.runningRules) {
436
+ void this.flushRules();
437
+ }
438
+ }
439
+
440
+ syncAssignRules(items: FormAssignRuleItem[]) {
441
+ if (this.options.isDisposed()) return;
442
+ const raw = Array.isArray(items) ? items : [];
443
+ const next = raw.map((item, index) => ({
444
+ ...item,
445
+ key: item?.key ? String(item.key) : `idx:${index}`,
446
+ }));
447
+ const prefix = 'form-assign:';
448
+
449
+ // 1) 清理旧的 assign 规则实例(含 block 级与 fork 级)
450
+ for (const id of Array.from(this.rules.keys())) {
451
+ if (!id.startsWith(prefix)) continue;
452
+ this.removeRule(id);
453
+ }
454
+ this.assignTemplatesByTargetPath.clear();
455
+ this.formItemTargetPaths.clear();
456
+ this.updateAssociationByTargetPath.clear();
457
+
458
+ // 2) 归一化模板:按 targetPath 分组,后续在 model:mounted 时按实例注册
459
+ let order = 0;
460
+ for (const item of next) {
461
+ const targetPath = item?.targetPath ? String(item.targetPath) : '';
462
+ if (!targetPath) continue;
463
+ const arr = this.assignTemplatesByTargetPath.get(targetPath) || [];
464
+ order += 1;
465
+ arr.push({ ...(item as any), __key: String(item.key), __order: order });
466
+ this.assignTemplatesByTargetPath.set(targetPath, arr);
467
+ }
468
+
469
+ // 3) 为当前已存在的模型实例创建 rule(含 fork);对“无对应字段模型”的模板创建 block 级 rule
470
+ const engine = this.options.getEngine();
471
+ const matchedTargetPaths = new Set<string>();
472
+ if (engine?.forEachModel) {
473
+ // 3.1) 记录当前表单中已配置字段(FormItemModel)的 targetPath,避免在 row grid 上重复注册
474
+ engine.forEachModel((model: FlowModel) => {
475
+ if (!this.isModelInThisForm(model)) return;
476
+ if (!(model as any)?.subModels?.field) return;
477
+ const p = this.getModelTargetPath(model);
478
+ if (p) this.formItemTargetPaths.add(p);
479
+ this.cacheUpdateAssociationForModel(model);
480
+ });
481
+
482
+ const visit = (model: FlowModel) => {
483
+ this.cacheUpdateAssociationForModel(model);
484
+ this.tryRegisterAssignRuleInstancesForModel(model, matchedTargetPaths);
485
+
486
+ // fork models(例如子表单行内 item fork / 字段 fork)不会被注册到 FlowEngine.modelInstances,
487
+ // 因此不会出现在 engine.forEachModel 中;需要从 master.forks 中补齐,确保保存后 syncAssignRules 也能覆盖已挂载的子表单行。
488
+ const forks: any = (model as any)?.forks;
489
+ if (forks && typeof forks.forEach === 'function') {
490
+ forks.forEach((fork: any) => {
491
+ if (!fork || (fork as any)?.disposed) return;
492
+ this.tryRegisterAssignRuleInstancesForModel(fork as any, matchedTargetPaths);
493
+ });
494
+ }
495
+ };
496
+ engine.forEachModel((model: FlowModel) => {
497
+ visit(model);
498
+ });
499
+ }
500
+
501
+ // block 级(嵌套属性等):当当前 form 内没有任何模型命中该 targetPath 时,使用 blockContext 运行
502
+ for (const [targetPath, templates] of this.assignTemplatesByTargetPath.entries()) {
503
+ if (matchedTargetPaths.has(targetPath)) continue;
504
+ if (!this.shouldCreateBlockLevelAssignRule(targetPath)) continue;
505
+ for (const template of templates) {
506
+ const mode: AssignMode = template?.mode === 'default' ? 'default' : 'assign';
507
+ const source: ValueSource = mode === 'default' ? 'default' : 'system';
508
+ const enabled = template?.enable !== false;
509
+ const id = `${prefix}${template.__key}:block`;
510
+ if (this.rules.has(id)) this.removeRule(id);
511
+
512
+ const rule: RuntimeRule = {
513
+ id,
514
+ source,
515
+ priority: 10 + (template.__order || 0),
516
+ debounceMs: 0,
517
+ getEnabled: () => enabled && !!targetPath,
518
+ getTarget: () => targetPath,
519
+ getValue: () => template?.value,
520
+ getCondition: () => template?.condition,
521
+ getContext: () => this.options.getBlockContext(),
522
+ };
523
+
524
+ this.rules.set(id, { rule, state: { deps: new Set(), depDisposers: [], runSeq: 0, scheduledAtWriteSeq: 0 } });
525
+ this.scheduleRule(id);
526
+ }
527
+ }
528
+
529
+ for (const id of Array.from(this.rules.keys())) {
530
+ if (!id.startsWith('default:')) continue;
531
+ this.scheduleRule(id);
532
+ }
533
+ }
534
+
535
+ onModelMounted(model: FlowModel) {
536
+ // 维护“已配置到 UI 的字段 targetPath”集合:仅 master 参与(fork 不代表配置项存在/删除)
537
+ if (this.isModelInThisForm(model) && !(model as any)?.isFork && (model as any)?.subModels?.field) {
538
+ const p = this.getModelTargetPath(model);
539
+ if (p) this.formItemTargetPaths.add(p);
540
+ this.cacheUpdateAssociationForModel(model);
541
+ }
542
+ this.tryRegisterDefaultRuleInstance(model);
543
+ this.tryRegisterAssignRuleInstancesForModel(model);
544
+ }
545
+
546
+ onModelUnmounted(model: FlowModel) {
547
+ this.tryUnregisterDefaultRuleInstance(model);
548
+ this.tryUnregisterAssignRuleInstancesForModel(model);
549
+
550
+ // 字段模型卸载后:为其对应的 targetPath(以及潜在的嵌套 targetPath)恢复 block-level 兜底实例,
551
+ // 以保证“先配置规则→后添加字段→再移除字段”行为稳定。
552
+ if (this.isModelInThisForm(model) && (model as any)?.subModels?.field) {
553
+ const p = this.getModelTargetPath(model);
554
+ if (p) {
555
+ this.ensureBlockAssignRuleInstancesForTargetPath(p);
556
+
557
+ if (!(model as any)?.isFork) {
558
+ this.updateAssociationByTargetPath.delete(p);
559
+ this.formItemTargetPaths.delete(p);
560
+
561
+ // 对一关联字段可能承载其子属性规则实例;卸载时这些子属性规则也需要回退到 block-level。
562
+ const prefix = `${p}.`;
563
+ for (const targetPath of this.assignTemplatesByTargetPath.keys()) {
564
+ if (!targetPath.startsWith(prefix)) continue;
565
+ this.ensureBlockAssignRuleInstancesForTargetPath(targetPath);
566
+ }
567
+
568
+ // 对多子表单场景:若该字段是 users.age 这类路径,row grid 模型仍在时需要重刷一次以便重新注册 row-grid 规则。
569
+ // 这里避免做全量 sync,仅触发一次按当前模型树的重新注册。
570
+ const engine = this.options.getEngine();
571
+ if (engine?.forEachModel) {
572
+ const visit = (m: FlowModel) => {
573
+ this.tryRegisterAssignRuleInstancesForModel(m);
574
+ const forks: any = (m as any)?.forks;
575
+ if (forks && typeof forks.forEach === 'function') {
576
+ forks.forEach((fork: any) => {
577
+ if (!fork || (fork as any)?.disposed) return;
578
+ this.tryRegisterAssignRuleInstancesForModel(fork as any);
579
+ });
580
+ }
581
+ };
582
+ engine.forEachModel((m: FlowModel) => visit(m));
583
+ }
584
+ }
585
+ }
586
+ }
587
+ }
588
+
589
+ private isModelInThisForm(model: FlowModel) {
590
+ const block = model?.context?.blockModel;
591
+ if (!block) return false;
592
+ return String(block.uid) === String(this.options.getBlockModelUid());
593
+ }
594
+
595
+ private cacheUpdateAssociationForModel(model: FlowModel) {
596
+ if (this.options.isDisposed()) return;
597
+ if (!this.isModelInThisForm(model)) return;
598
+ if (!model || typeof model !== 'object') return;
599
+ if ((model as any)?.isFork) return;
600
+ if (!(model as any)?.subModels?.field) return;
601
+
602
+ const p = this.getModelTargetPath(model);
603
+ if (!p) return;
604
+
605
+ const fieldModel: any = (model as any)?.subModels?.field;
606
+ const next = !!fieldModel?.updateAssociation;
607
+ const prev = this.updateAssociationByTargetPath.get(p);
608
+
609
+ // once true, keep true (avoid being overwritten by another model instance)
610
+ if (prev === true) return;
611
+ this.updateAssociationByTargetPath.set(p, next);
612
+ }
613
+
614
+ private getUpdateAssociationForTargetPath(targetPath: string): boolean {
615
+ const key = String(targetPath || '');
616
+ if (!key) return false;
617
+
618
+ if (this.updateAssociationByTargetPath.has(key)) {
619
+ return !!this.updateAssociationByTargetPath.get(key);
620
+ }
621
+
622
+ // Fallback: scan existing models once (e.g. called before syncAssignRules finishes scanning).
623
+ const engine = this.options.getEngine();
624
+ if (engine?.forEachModel) {
625
+ engine.forEachModel((m: FlowModel) => {
626
+ this.cacheUpdateAssociationForModel(m);
627
+ });
628
+ }
629
+
630
+ if (this.updateAssociationByTargetPath.has(key)) {
631
+ return !!this.updateAssociationByTargetPath.get(key);
632
+ }
633
+
634
+ // Cache negative result; model:mounted will override when applicable.
635
+ this.updateAssociationByTargetPath.set(key, false);
636
+ return false;
637
+ }
638
+
639
+ private getDefaultRuleId(model: FlowModel) {
640
+ const forkId = model?.['isFork'] ? String(model?.['forkId'] ?? 'fork') : 'master';
641
+ const uid = model?.uid ? String(model.uid) : String(model);
642
+ return `default:${uid}:${forkId}`;
643
+ }
644
+
645
+ private getModelTargetNamePath(model: FlowModel): NamePath | null {
646
+ const fp = model?.context?.fieldPathArray;
647
+ if (Array.isArray(fp) && fp.length) return fp as NamePath;
648
+
649
+ const props = typeof model?.getProps === 'function' ? model.getProps() : model?.props;
650
+ const name = props?.name;
651
+ if (Array.isArray(name)) return name as any;
652
+ if (typeof name === 'string') {
653
+ return name.includes('.') ? (name.split('.') as any) : ([name] as any);
654
+ }
655
+ return null;
656
+ }
657
+
658
+ private getAssignTemplateTargetPathForModel(model: FlowModel): string {
659
+ const direct = this.getModelTargetPath(model);
660
+ if (direct) return direct;
661
+
662
+ const targetNamePath = this.getModelTargetNamePath(model);
663
+ if (!targetNamePath?.length) return '';
664
+
665
+ const normalized = targetNamePath.filter((seg) => typeof seg !== 'number');
666
+ if (!normalized.length) return '';
667
+
668
+ return namePathToPathKey(normalized as NamePath);
669
+ }
670
+
671
+ private hasAssignTemplateForTargetPath(targetPath: string): boolean {
672
+ const key = String(targetPath || '');
673
+ if (!key) return false;
674
+ return this.assignTemplatesByTargetPath.has(key);
675
+ }
676
+
677
+ private tryRegisterDefaultRuleInstance(model: FlowModel) {
678
+ if (this.options.isDisposed()) return;
679
+ if (!this.isModelInThisForm(model)) return;
680
+ if (!model || typeof model !== 'object') return;
681
+
682
+ const props = typeof model.getProps === 'function' ? model.getProps() : (model as any).props;
683
+ if (!props || typeof props !== 'object') return;
684
+
685
+ const target = this.getModelTargetNamePath(model);
686
+ if (!target) return;
687
+
688
+ const id = this.getDefaultRuleId(model);
689
+ if (this.rules.has(id)) return;
690
+
691
+ const master = (model as any).master || model;
692
+ const assignTemplateTargetPath = this.getAssignTemplateTargetPathForModel(model);
693
+ this.bindMasterInitialValue(master, id);
694
+
695
+ const getRawPropsInitialValue = () => {
696
+ const p = (master as any)?.getProps?.() ?? (master as any)?.props;
697
+ return p?.initialValue;
698
+ };
699
+
700
+ const initialPropsInitialValue = getRawPropsInitialValue();
701
+ let hasRuntimePropsInitialValueChange = false;
702
+
703
+ const getPropsInitialValue = () => {
704
+ const next = getRawPropsInitialValue();
705
+ if (!hasRuntimePropsInitialValueChange && !_.isEqual(next, initialPropsInitialValue)) {
706
+ hasRuntimePropsInitialValueChange = true;
707
+ }
708
+ if (!this.hasAssignTemplateForTargetPath(assignTemplateTargetPath)) {
709
+ return next;
710
+ }
711
+ if (hasRuntimePropsInitialValueChange) {
712
+ return next;
713
+ }
714
+ if (typeof initialPropsInitialValue !== 'undefined') {
715
+ return undefined;
716
+ }
717
+ return next;
718
+ };
719
+
720
+ const getDefaultRulePriority = () => {
721
+ return typeof getPropsInitialValue() !== 'undefined' ? LINKAGE_DEFAULT_RULE_PRIORITY : 0;
722
+ };
723
+
724
+ const getStepDefaultValue = () => {
725
+ if (this.hasAssignTemplateForTargetPath(assignTemplateTargetPath)) {
726
+ return undefined;
727
+ }
728
+ try {
729
+ const fromEdit = master?.getStepParams?.('editItemSettings', 'initialValue')?.defaultValue;
730
+ if (typeof fromEdit !== 'undefined') return fromEdit;
731
+ const fromLegacy = master?.getStepParams?.('formItemSettings', 'initialValue')?.defaultValue;
732
+ if (typeof fromLegacy !== 'undefined') return fromLegacy;
733
+ } catch {
734
+ // ignore
735
+ }
736
+ return undefined;
737
+ };
738
+
739
+ const rule: RuntimeRule = {
740
+ id,
741
+ source: 'default',
742
+ priority: getDefaultRulePriority(),
743
+ debounceMs: 0,
744
+ getEnabled: () => {
745
+ const fromProps = getPropsInitialValue();
746
+ if (typeof fromProps !== 'undefined') return true;
747
+ const fromStep = getStepDefaultValue();
748
+ return typeof fromStep !== 'undefined';
749
+ },
750
+ getTarget: () => {
751
+ return this.getModelTargetNamePath(model) || target;
752
+ },
753
+ getValue: () => {
754
+ const fromProps = getPropsInitialValue();
755
+ if (typeof fromProps !== 'undefined') return fromProps;
756
+ return getStepDefaultValue();
757
+ },
758
+ getContext: () => model?.context,
759
+ };
760
+
761
+ this.rules.set(id, {
762
+ rule,
763
+ state: { deps: new Set(), depDisposers: [], runSeq: 0, scheduledAtWriteSeq: 0 },
764
+ });
765
+
766
+ this.scheduleRule(id);
767
+ }
768
+
769
+ private getModelTargetPath(model: FlowModel): string | null {
770
+ try {
771
+ const init = (model as any)?.getStepParams?.('fieldSettings', 'init');
772
+ const fp = init?.fieldPath;
773
+ if (fp) return String(fp);
774
+ } catch {
775
+ // ignore
776
+ }
777
+ const fp2 = (model as any)?.fieldPath;
778
+ if (fp2) return String(fp2);
779
+
780
+ const np = this.getModelTargetNamePath(model);
781
+ if (np?.length) {
782
+ const normalized = np.filter((seg) => typeof seg === 'string').join('.');
783
+ return normalized || null;
784
+ }
785
+ return null;
786
+ }
787
+
788
+ private getAssignRuleInstanceId(templateKey: string, model: FlowModel) {
789
+ const forkId = model?.['isFork'] ? String(model?.['forkId'] ?? 'fork') : 'master';
790
+ const uid = model?.uid ? String(model.uid) : String(model);
791
+ return `form-assign:${templateKey}:${uid}:${forkId}`;
792
+ }
793
+
794
+ private getDeepestFieldIndexKey(baseCtx: any): string | null {
795
+ const fieldIndex = baseCtx?.model?.context?.fieldIndex ?? baseCtx?.fieldIndex;
796
+ const arr = Array.isArray(fieldIndex) ? fieldIndex : [];
797
+ if (!arr.length) return null;
798
+ const last = arr[arr.length - 1];
799
+ if (typeof last !== 'string') return null;
800
+ const [k, v] = last.split(':');
801
+ if (!k) return null;
802
+ const n = Number(v);
803
+ if (Number.isNaN(n)) return null;
804
+ return k;
805
+ }
806
+
807
+ private getDeepestToManyAssociationKey(targetPath: string): string | null {
808
+ const rootCollection = this.getRootCollection();
809
+ if (!rootCollection?.getField) return null;
810
+
811
+ const segs = parsePathString(String(targetPath || '')).filter((seg) => typeof seg !== 'object') as NamePath;
812
+ if (segs.length < 2) return null;
813
+
814
+ let collection = rootCollection;
815
+ let deepest: string | null = null;
816
+
817
+ for (let i = 0; i < segs.length - 1; i++) {
818
+ const seg = segs[i];
819
+ if (typeof seg !== 'string') continue;
820
+ const field = collection?.getField?.(seg);
821
+ if (!field?.isAssociationField?.()) break;
822
+
823
+ const toMany = isToManyAssociationField(field);
824
+ if (toMany) deepest = seg;
825
+
826
+ // 对多关联:若包含显式 index(如 users[0]),跳过 index 段;否则按字段名继续
827
+ if (toMany) {
828
+ const next = segs[i + 1];
829
+ if (typeof next === 'number') {
830
+ i += 1;
831
+ }
832
+ }
833
+
834
+ collection = field?.targetCollection;
835
+ if (!collection?.getField) break;
836
+ }
837
+
838
+ return deepest;
839
+ }
840
+
841
+ private isRowGridModel(model: FlowModel): boolean {
842
+ // grid fork(SubFormList 内每行一个 grid fork):有 subModels.items,但没有 subModels.field
843
+ if (!model || typeof model !== 'object') return false;
844
+ if ((model as any)?.subModels?.field) return false;
845
+ if (!(model as any)?.subModels?.items) return false;
846
+
847
+ const baseCtx: any = (model as any)?.context;
848
+ const rowKey = this.getDeepestFieldIndexKey(baseCtx);
849
+ return !!rowKey;
850
+ }
851
+
852
+ private tryRegisterAssignRuleInstancesForModel(model: FlowModel, matchedTargetPaths?: Set<string>) {
853
+ if (this.options.isDisposed()) return;
854
+ if (!this.isModelInThisForm(model)) return;
855
+
856
+ const register = (
857
+ targetPathForRule: string,
858
+ ruleTemplates: Array<FormAssignRuleItem & { __key: string; __order: number }>,
859
+ ) => {
860
+ if (!ruleTemplates || ruleTemplates.length === 0) return;
861
+ matchedTargetPaths?.add(targetPathForRule);
862
+
863
+ for (const template of ruleTemplates) {
864
+ // 若之前在无字段模型时创建了 block-level/row-grid 兜底实例,这里在字段模型可用时迁移到字段实例,避免双挂载。
865
+ this.removeAssignRuleBlockInstance(template.__key);
866
+ if ((model as any)?.subModels?.field) {
867
+ this.removeRowGridAssignRuleInstances(template.__key);
868
+ }
869
+
870
+ const mode: AssignMode = template?.mode === 'default' ? 'default' : 'assign';
871
+ const source: ValueSource = mode === 'default' ? 'default' : 'system';
872
+ const enabled = template?.enable !== false;
873
+ const id = this.getAssignRuleInstanceId(template.__key, model);
874
+
875
+ // 若已存在则替换,避免残留旧 deps/binding
876
+ if (this.rules.has(id)) {
877
+ this.removeRule(id);
878
+ }
879
+
880
+ const rule: RuntimeRule = {
881
+ id,
882
+ source,
883
+ priority: 10 + (template.__order || 0),
884
+ debounceMs: 0,
885
+ getEnabled: () => enabled && !!targetPathForRule,
886
+ getTarget: () => targetPathForRule,
887
+ getValue: () => template?.value,
888
+ getCondition: () => template?.condition,
889
+ getContext: () => model?.context,
890
+ };
891
+
892
+ this.rules.set(id, { rule, state: { deps: new Set(), depDisposers: [], runSeq: 0, scheduledAtWriteSeq: 0 } });
893
+ this.scheduleRule(id);
894
+ }
895
+ };
896
+
897
+ // A) row grid:支持对子表单/子表单列表中“未配置到 UI 的属性字段”赋值。
898
+ // 当 targetPath 穿过对多关联(例如 users.age / users.user.name)且不存在对应 FormItemModel 时,
899
+ // 将规则挂载到 row grid 的上下文上运行,以便自动插入数组 index 并按行评估条件。
900
+ if (this.isRowGridModel(model)) {
901
+ const baseCtx: any = (model as any)?.context;
902
+ const rowKey = this.getDeepestFieldIndexKey(baseCtx);
903
+ if (rowKey) {
904
+ for (const [templateTargetPath, templates] of this.assignTemplatesByTargetPath.entries()) {
905
+ // 已配置到 UI 的字段(存在 FormItemModel)仍由字段实例处理,避免重复运行
906
+ if (this.formItemTargetPaths.has(templateTargetPath)) continue;
907
+
908
+ const anchor = this.getDeepestToManyAssociationKey(templateTargetPath);
909
+ if (!anchor || anchor !== rowKey) continue;
910
+
911
+ register(templateTargetPath, templates);
912
+ }
913
+ }
914
+ return;
915
+ }
916
+
917
+ // B) FormItemModel(及其 fork):常规字段赋值
918
+ if (!(model as any)?.subModels?.field) return;
919
+
920
+ const targetPath = this.getModelTargetPath(model);
921
+ if (!targetPath) return;
922
+
923
+ // 1) 精确命中:表单上存在对应字段模型
924
+ const exactTemplates = this.assignTemplatesByTargetPath.get(targetPath) || [];
925
+ if (exactTemplates.length) {
926
+ register(targetPath, exactTemplates);
927
+ }
928
+
929
+ // 2) 嵌套属性:当当前字段为对一关联(record picker 等)时,将其子属性赋值规则挂载到该字段实例上运行(包括对多子表单行内的对一关联)
930
+ const fieldModel: any = (model as any)?.subModels?.field;
931
+ const collectionField: any = fieldModel?.context?.collectionField;
932
+ const isAssoc = !!collectionField?.isAssociationField?.();
933
+ const isToMany = isToManyAssociationField(collectionField);
934
+ if (isAssoc && !isToMany) {
935
+ const prefix = `${targetPath}.`;
936
+ for (const [templateTargetPath, templates] of this.assignTemplatesByTargetPath.entries()) {
937
+ if (!templateTargetPath || typeof templateTargetPath !== 'string') continue;
938
+ if (!templateTargetPath.startsWith(prefix)) continue;
939
+ register(templateTargetPath, templates);
940
+ }
941
+ }
942
+ }
943
+
944
+ private tryUnregisterAssignRuleInstancesForModel(model: FlowModel) {
945
+ if (this.options.isDisposed()) return;
946
+ if (!this.isModelInThisForm(model)) return;
947
+
948
+ const unregister = (templates: Array<FormAssignRuleItem & { __key: string }>) => {
949
+ for (const template of templates || []) {
950
+ const id = this.getAssignRuleInstanceId(template.__key, model);
951
+ if (!this.rules.has(id)) continue;
952
+ this.removeRule(id);
953
+ }
954
+ };
955
+
956
+ // A) row grid:清理挂载到 row grid 上的“未配置字段”规则
957
+ if (this.isRowGridModel(model)) {
958
+ const baseCtx: any = (model as any)?.context;
959
+ const rowKey = this.getDeepestFieldIndexKey(baseCtx);
960
+ if (!rowKey) return;
961
+
962
+ for (const [templateTargetPath, templates] of this.assignTemplatesByTargetPath.entries()) {
963
+ if (this.formItemTargetPaths.has(templateTargetPath)) continue;
964
+ const anchor = this.getDeepestToManyAssociationKey(templateTargetPath);
965
+ if (!anchor || anchor !== rowKey) continue;
966
+ unregister(templates);
967
+ }
968
+ return;
969
+ }
970
+
971
+ // B) FormItemModel(及其 fork):常规字段赋值
972
+ if (!(model as any)?.subModels?.field) return;
973
+
974
+ const targetPath = this.getModelTargetPath(model);
975
+ if (!targetPath) return;
976
+
977
+ // 1) 精确命中:按当前字段 targetPath 清理
978
+ const exactTemplates = this.assignTemplatesByTargetPath.get(targetPath) || [];
979
+ if (exactTemplates.length) {
980
+ unregister(exactTemplates);
981
+ }
982
+
983
+ // 2) 嵌套属性:对一关联字段会挂载子属性规则到自身实例,卸载时需要一并清理
984
+ const fieldModel: any = (model as any)?.subModels?.field;
985
+ const collectionField: any = fieldModel?.context?.collectionField;
986
+ const isAssoc = !!collectionField?.isAssociationField?.();
987
+ const isToMany = isToManyAssociationField(collectionField);
988
+ if (isAssoc && !isToMany) {
989
+ const prefix = `${targetPath}.`;
990
+ for (const [templateTargetPath, templates] of this.assignTemplatesByTargetPath.entries()) {
991
+ if (!templateTargetPath || typeof templateTargetPath !== 'string') continue;
992
+ if (!templateTargetPath.startsWith(prefix)) continue;
993
+ unregister(templates);
994
+ }
995
+ }
996
+ }
997
+
998
+ private tryUnregisterDefaultRuleInstance(model: FlowModel) {
999
+ if (this.options.isDisposed()) return;
1000
+ if (!this.isModelInThisForm(model)) return;
1001
+ const id = this.getDefaultRuleId(model);
1002
+ if (!this.rules.has(id)) return;
1003
+ this.removeRule(id);
1004
+ }
1005
+
1006
+ private bindMasterInitialValue(master: any, ruleId: string) {
1007
+ const uid = master?.uid ? String(master.uid) : ruleId;
1008
+ const set = this.defaultRuleIdsByMasterUid.get(uid) || new Set<string>();
1009
+ set.add(ruleId);
1010
+ this.defaultRuleIdsByMasterUid.set(uid, set);
1011
+
1012
+ if (this.defaultRuleMasterDisposers.has(uid)) return;
1013
+
1014
+ const disposer = reaction(
1015
+ () => {
1016
+ const p = (master as any)?.getProps?.() ?? (master as any)?.props;
1017
+ return p?.initialValue;
1018
+ },
1019
+ (next, prev) => {
1020
+ if (_.isEqual(next, prev)) return;
1021
+ const ids = this.defaultRuleIdsByMasterUid.get(uid);
1022
+ if (!ids) return;
1023
+ const p = (master as any)?.getProps?.() ?? (master as any)?.props;
1024
+ const nextPriority = typeof p?.initialValue !== 'undefined' ? LINKAGE_DEFAULT_RULE_PRIORITY : 0;
1025
+ for (const id of ids) {
1026
+ const entry = this.rules.get(id);
1027
+ if (entry) {
1028
+ entry.rule.priority = nextPriority;
1029
+ }
1030
+ this.scheduleRule(id);
1031
+ }
1032
+ },
1033
+ );
1034
+ this.defaultRuleMasterDisposers.set(uid, disposer);
1035
+ }
1036
+
1037
+ private removeRule(id: string) {
1038
+ const entry = this.rules.get(id);
1039
+ if (!entry) return;
1040
+
1041
+ try {
1042
+ const baseCtx = entry.rule.getContext();
1043
+ const rawTarget = entry.rule.getTarget();
1044
+ const targetNamePath = this.options.tryResolveNamePath(baseCtx, rawTarget as any);
1045
+ if (targetNamePath) {
1046
+ const targetKey = namePathToPathKey(targetNamePath);
1047
+ const existing = this.options.observableBindings.get(targetKey);
1048
+ if (existing && existing.source === entry.rule.source) {
1049
+ existing.dispose();
1050
+ this.options.observableBindings.delete(targetKey);
1051
+ }
1052
+ }
1053
+ } catch {
1054
+ // ignore
1055
+ }
1056
+
1057
+ entry.state.depDisposers.forEach((d) => d());
1058
+ this.rules.delete(id);
1059
+ this.pendingRuleIds.delete(id);
1060
+ const timer = this.ruleDebounceTimersById.get(id);
1061
+ if (timer) clearTimeout(timer);
1062
+ this.ruleDebounceTimersById.delete(id);
1063
+ this.ruleDebounceUntilById.delete(id);
1064
+
1065
+ for (const [masterUid, ids] of this.defaultRuleIdsByMasterUid.entries()) {
1066
+ if (!ids.has(id)) continue;
1067
+ ids.delete(id);
1068
+ if (ids.size > 0) continue;
1069
+ this.defaultRuleIdsByMasterUid.delete(masterUid);
1070
+ const disposer = this.defaultRuleMasterDisposers.get(masterUid);
1071
+ if (disposer) disposer();
1072
+ this.defaultRuleMasterDisposers.delete(masterUid);
1073
+ }
1074
+ }
1075
+
1076
+ rescheduleAllRules() {
1077
+ if (this.options.isDisposed()) return;
1078
+
1079
+ this.lastRuleWriteByTargetKey.clear();
1080
+ for (const entry of this.rules.values()) {
1081
+ entry.state.runSeq += 1;
1082
+ }
1083
+ for (const id of this.rules.keys()) {
1084
+ this.scheduleRule(id);
1085
+ }
1086
+ }
1087
+
1088
+ private scheduleRule(id: string) {
1089
+ if (this.options.isDisposed()) return;
1090
+ const entry = this.rules.get(id);
1091
+ if (!entry) return;
1092
+ const { rule, state } = entry;
1093
+
1094
+ // Used to detect "a higher priority source has already written the target after we were scheduled".
1095
+ state.scheduledAtWriteSeq = this.options.getWriteSeq();
1096
+
1097
+ const debounceMs = rule?.debounceMs ?? 0;
1098
+ this.pendingRuleIds.add(id);
1099
+
1100
+ // debounce:确保在 flush 时也能跳过未到期的 rule
1101
+ if (debounceMs > 0) {
1102
+ const until = Date.now() + debounceMs;
1103
+ const prevUntil = this.ruleDebounceUntilById.get(id) || 0;
1104
+ if (until > prevUntil) this.ruleDebounceUntilById.set(id, until);
1105
+ const existing = this.ruleDebounceTimersById.get(id);
1106
+ if (existing) clearTimeout(existing);
1107
+ const timer = setTimeout(() => {
1108
+ this.ruleDebounceTimersById.delete(id);
1109
+ if (!this.rulesEnabled) return;
1110
+ if (this.runningRules) return;
1111
+ if (!this.pendingRuleIds.has(id)) return;
1112
+ void this.flushRules();
1113
+ }, debounceMs);
1114
+ this.ruleDebounceTimersById.set(id, timer);
1115
+ } else {
1116
+ const existing = this.ruleDebounceTimersById.get(id);
1117
+ if (existing) clearTimeout(existing);
1118
+ this.ruleDebounceTimersById.delete(id);
1119
+ this.ruleDebounceUntilById.delete(id);
1120
+ }
1121
+
1122
+ if (!this.rulesEnabled) return;
1123
+ if (this.runningRules) return;
1124
+ void this.flushRules();
1125
+ }
1126
+
1127
+ private async flushRules() {
1128
+ if (this.runningRules) return;
1129
+ this.runningRules = true;
1130
+ const txId = this.currentRuleTxId || createTxId();
1131
+ this.currentRuleTxId = txId;
1132
+ try {
1133
+ while (this.pendingRuleIds.size) {
1134
+ const now = Date.now();
1135
+ const ready: string[] = [];
1136
+ for (const id of this.pendingRuleIds) {
1137
+ const until = this.ruleDebounceUntilById.get(id) || 0;
1138
+ if (until > now) continue;
1139
+ ready.push(id);
1140
+ }
1141
+ if (!ready.length) break;
1142
+ for (const id of ready) {
1143
+ this.pendingRuleIds.delete(id);
1144
+ this.ruleDebounceUntilById.delete(id);
1145
+ }
1146
+
1147
+ ready.sort((a, b) => {
1148
+ const ra = this.rules.get(a)?.rule;
1149
+ const rb = this.rules.get(b)?.rule;
1150
+ const pa = ra?.priority ?? 0;
1151
+ const pb = rb?.priority ?? 0;
1152
+ if (pa !== pb) return pa - pb;
1153
+ return a.localeCompare(b);
1154
+ });
1155
+ for (const id of ready) {
1156
+ await this.runRule(id);
1157
+ }
1158
+ }
1159
+ } finally {
1160
+ this.runningRules = false;
1161
+ this.currentRuleTxId = null;
1162
+ this.options.txWriteCounts.delete(txId);
1163
+ }
1164
+ }
1165
+
1166
+ private async runRule(id: string) {
1167
+ const entry = this.rules.get(id);
1168
+ if (!entry) return;
1169
+
1170
+ const { rule, state } = entry;
1171
+ state.runSeq += 1;
1172
+ const seq = state.runSeq;
1173
+ const scheduledAtWriteSeq = state.scheduledAtWriteSeq;
1174
+
1175
+ const ruleContext = this.prepareRuleContext(rule);
1176
+ const { baseCtx, targetNamePath, targetKey, clearDeps, disposeBinding } = ruleContext;
1177
+ if (!this.shouldRunRule(rule, targetNamePath, targetKey, baseCtx)) {
1178
+ clearDeps(state);
1179
+ disposeBinding();
1180
+ return;
1181
+ }
1182
+ if (!targetNamePath || !targetKey) {
1183
+ clearDeps(state);
1184
+ disposeBinding();
1185
+ return;
1186
+ }
1187
+ const ensuredTargetNamePath = targetNamePath;
1188
+ const ensuredTargetKey = targetKey;
1189
+
1190
+ const { collector, evalCtx } = this.createRuleCollectorAndContext(rule, ruleContext);
1191
+
1192
+ if (rule.getCondition) {
1193
+ const shouldContinue = await this.evaluateRuleCondition(rule, state, seq, evalCtx, collector);
1194
+ if (!shouldContinue) return;
1195
+ }
1196
+
1197
+ const resolved = await this.resolveRuleValue(rule, state, seq, evalCtx, collector);
1198
+ if (resolved === SKIP_RULE_VALUE) return;
1199
+ if (seq !== state.runSeq) return;
1200
+
1201
+ this.commitRuleDeps(rule, state, collector);
1202
+
1203
+ const normalizedResolved = this.normalizeResolvedValueForTarget(baseCtx, resolved);
1204
+ const normalizedResolvedForTarget = this.normalizeResolvedValueForAssociationTarget(
1205
+ baseCtx,
1206
+ ensuredTargetNamePath,
1207
+ normalizedResolved,
1208
+ );
1209
+
1210
+ if (rule.source === 'default') {
1211
+ const shouldApply = this.checkDefaultRuleCanApply(
1212
+ normalizedResolvedForTarget,
1213
+ ensuredTargetNamePath,
1214
+ ensuredTargetKey,
1215
+ clearDeps,
1216
+ disposeBinding,
1217
+ state,
1218
+ );
1219
+ if (!shouldApply) return;
1220
+ }
1221
+
1222
+ if (rule.source === 'default') {
1223
+ const lastWrite = this.lastRuleWriteByTargetKey.get(ensuredTargetKey);
1224
+ if (
1225
+ lastWrite?.source === 'default' &&
1226
+ lastWrite.priority > rule.priority &&
1227
+ lastWrite.writeSeq >= scheduledAtWriteSeq
1228
+ ) {
1229
+ disposeBinding();
1230
+ return;
1231
+ }
1232
+ }
1233
+
1234
+ if (rule.source === 'system') {
1235
+ const lastWrite = this.options.lastWriteMetaByPathKey.get(ensuredTargetKey);
1236
+ if (lastWrite?.source === 'linkage' && lastWrite.writeSeq >= scheduledAtWriteSeq) {
1237
+ disposeBinding();
1238
+ return;
1239
+ }
1240
+ }
1241
+
1242
+ if (this.shouldSkipAssociationNestedWrite(baseCtx, ensuredTargetNamePath)) return;
1243
+
1244
+ if (this.shouldSkipToManyAssociationWriteWithoutIndex(baseCtx, ensuredTargetNamePath)) return;
1245
+
1246
+ const nextSnapshot = normalizedResolvedForTarget;
1247
+ const semanticallyEqual = this.isAssociationTargetSemanticallyEqual(
1248
+ baseCtx,
1249
+ ensuredTargetNamePath,
1250
+ this.options.getFormValueAtPath(ensuredTargetNamePath),
1251
+ nextSnapshot,
1252
+ );
1253
+ if (semanticallyEqual) return;
1254
+
1255
+ const initPatches = this.collectUpdateAssociationInitPatches(baseCtx, ensuredTargetNamePath);
1256
+ if (initPatches == null) return;
1257
+
1258
+ if (rule.source === 'system' || rule.source === 'default') {
1259
+ const modelForUi = baseCtx?.model;
1260
+ const fieldModelForUi = modelForUi?.subModels?.field;
1261
+ if (fieldModelForUi) {
1262
+ const modelTarget = this.getModelTargetNamePath(modelForUi);
1263
+ if (modelTarget && namePathToPathKey(modelTarget) === ensuredTargetKey) {
1264
+ modelForUi.setProps({ value: normalizedResolvedForTarget });
1265
+ fieldModelForUi.setProps?.({ value: normalizedResolvedForTarget });
1266
+ }
1267
+ }
1268
+ }
1269
+
1270
+ const beforeWriteSeq = this.options.getWriteSeq();
1271
+ const patches = [...initPatches, { path: ensuredTargetNamePath, value: normalizedResolvedForTarget }];
1272
+ await this.options.setFormValues(evalCtx, patches, {
1273
+ source: rule.source,
1274
+ txId: this.currentRuleTxId || undefined,
1275
+ });
1276
+ const afterWriteSeq = this.options.getWriteSeq();
1277
+ if (afterWriteSeq !== beforeWriteSeq) {
1278
+ this.lastRuleWriteByTargetKey.set(ensuredTargetKey, {
1279
+ source: rule.source,
1280
+ priority: rule.priority,
1281
+ writeSeq: afterWriteSeq,
1282
+ });
1283
+ }
1284
+ }
1285
+
1286
+ private isTzAwareTargetInterface(targetInterface: unknown): boolean {
1287
+ if (typeof targetInterface !== 'string') {
1288
+ return false;
1289
+ }
1290
+
1291
+ return ['datetime', 'createdAt', 'updatedAt', 'unixTimestamp'].includes(targetInterface);
1292
+ }
1293
+
1294
+ private normalizeDateOnlyToStartOfDayIso(value: string): string {
1295
+ const raw = String(value || '').trim();
1296
+ if (!raw) return value;
1297
+ if (!/^\d{4}-\d{2}-\d{2}$/.test(raw)) return value;
1298
+
1299
+ const parsed = dayjs(raw, 'YYYY-MM-DD', true);
1300
+ if (!parsed.isValid()) return value;
1301
+ return parsed.startOf('day').toISOString();
1302
+ }
1303
+
1304
+ private normalizeResolvedValueForTarget(baseCtx: any, resolved: any): any {
1305
+ const targetInterface = baseCtx?.model?.context?.collectionField?.interface;
1306
+ if (!this.isTzAwareTargetInterface(targetInterface)) {
1307
+ return resolved;
1308
+ }
1309
+
1310
+ if (typeof resolved === 'string') {
1311
+ return this.normalizeDateOnlyToStartOfDayIso(resolved);
1312
+ }
1313
+
1314
+ if (Array.isArray(resolved)) {
1315
+ return resolved.map((item) => (typeof item === 'string' ? this.normalizeDateOnlyToStartOfDayIso(item) : item));
1316
+ }
1317
+
1318
+ return resolved;
1319
+ }
1320
+
1321
+ private isPrimitiveAssociationTargetValue(value: unknown): value is string | number | boolean {
1322
+ return typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean';
1323
+ }
1324
+
1325
+ private extractAssociationIdentity(associationField: any, value: any): any | typeof UNRESOLVED_ASSOCIATION_IDENTITY {
1326
+ const targetKeys = this.getAssociationTargetKeyFields(associationField);
1327
+ const singleTargetKey = targetKeys.length === 1 ? targetKeys[0] : null;
1328
+
1329
+ const toIdentity = (item: any): any | typeof UNRESOLVED_ASSOCIATION_IDENTITY => {
1330
+ if (item == null) return item;
1331
+
1332
+ if (this.isPrimitiveAssociationTargetValue(item)) {
1333
+ if (!singleTargetKey) return UNRESOLVED_ASSOCIATION_IDENTITY;
1334
+ return item;
1335
+ }
1336
+
1337
+ if (!item || typeof item !== 'object') {
1338
+ return UNRESOLVED_ASSOCIATION_IDENTITY;
1339
+ }
1340
+
1341
+ if (singleTargetKey) {
1342
+ if (typeof item[singleTargetKey] === 'undefined') {
1343
+ return UNRESOLVED_ASSOCIATION_IDENTITY;
1344
+ }
1345
+ return item[singleTargetKey];
1346
+ }
1347
+
1348
+ const compositeIdentity: Record<string, any> = {};
1349
+ for (const key of targetKeys) {
1350
+ if (typeof item[key] === 'undefined') {
1351
+ return UNRESOLVED_ASSOCIATION_IDENTITY;
1352
+ }
1353
+ compositeIdentity[key] = item[key];
1354
+ }
1355
+ return compositeIdentity;
1356
+ };
1357
+
1358
+ if (isToManyAssociationField(associationField)) {
1359
+ const arr = Array.isArray(value) ? value : [value];
1360
+ const identities: any[] = [];
1361
+ for (const item of arr) {
1362
+ if (item == null) continue;
1363
+ const identity = toIdentity(item);
1364
+ if (identity === UNRESOLVED_ASSOCIATION_IDENTITY) {
1365
+ return UNRESOLVED_ASSOCIATION_IDENTITY;
1366
+ }
1367
+ identities.push(identity);
1368
+ }
1369
+ return identities;
1370
+ }
1371
+
1372
+ const toOneValue = Array.isArray(value) ? value.find((item) => item != null) : value;
1373
+ if (toOneValue == null) return toOneValue;
1374
+ return toIdentity(toOneValue);
1375
+ }
1376
+
1377
+ private isAssociationTargetSemanticallyEqual(
1378
+ baseCtx: any,
1379
+ targetNamePath: NamePath,
1380
+ currentValue: any,
1381
+ nextValue: any,
1382
+ ): boolean {
1383
+ const targetField = this.resolveCollectionFieldByNamePath(baseCtx, targetNamePath);
1384
+ if (!targetField?.isAssociationField?.()) {
1385
+ return _.isEqual(currentValue, nextValue);
1386
+ }
1387
+
1388
+ const currentIdentity = this.extractAssociationIdentity(targetField, currentValue);
1389
+ const nextIdentity = this.extractAssociationIdentity(targetField, nextValue);
1390
+ if (currentIdentity === UNRESOLVED_ASSOCIATION_IDENTITY || nextIdentity === UNRESOLVED_ASSOCIATION_IDENTITY) {
1391
+ return _.isEqual(currentValue, nextValue);
1392
+ }
1393
+
1394
+ return _.isEqual(currentIdentity, nextIdentity);
1395
+ }
1396
+
1397
+ private resolveCollectionFieldByNamePath(baseCtx: any, targetNamePath: NamePath): any | null {
1398
+ if (!Array.isArray(targetNamePath) || !targetNamePath.length) return null;
1399
+
1400
+ let collection = this.getRootCollection() || this.getCollectionFromContext(baseCtx);
1401
+ if (!collection?.getField) return null;
1402
+
1403
+ for (let i = 0; i < targetNamePath.length; i++) {
1404
+ const seg = targetNamePath[i];
1405
+ if (typeof seg !== 'string' || !seg) return null;
1406
+
1407
+ const field = collection?.getField?.(seg);
1408
+ if (!field) return null;
1409
+
1410
+ const isLast = i === targetNamePath.length - 1;
1411
+ if (isLast) return field;
1412
+
1413
+ if (!field?.isAssociationField?.() || !field?.targetCollection) {
1414
+ return null;
1415
+ }
1416
+
1417
+ if (isToManyAssociationField(field)) {
1418
+ const nextSeg = targetNamePath[i + 1];
1419
+ if (typeof nextSeg !== 'number') {
1420
+ return null;
1421
+ }
1422
+ i += 1;
1423
+ }
1424
+
1425
+ collection = field.targetCollection;
1426
+ if (!collection?.getField) return null;
1427
+ }
1428
+
1429
+ return null;
1430
+ }
1431
+
1432
+ private normalizeResolvedValueForAssociationTarget(baseCtx: any, targetNamePath: NamePath, resolved: any): any {
1433
+ const targetField = this.resolveCollectionFieldByNamePath(baseCtx, targetNamePath);
1434
+ if (!targetField?.isAssociationField?.()) return resolved;
1435
+
1436
+ const targetKeys = this.getAssociationTargetKeyFields(targetField);
1437
+ const singleTargetKey = targetKeys.length === 1 ? targetKeys[0] : null;
1438
+ const normalizeItem = (item: any) => {
1439
+ if (item == null) return undefined;
1440
+ if (singleTargetKey && this.isPrimitiveAssociationTargetValue(item)) {
1441
+ return { [singleTargetKey]: item };
1442
+ }
1443
+ return item;
1444
+ };
1445
+
1446
+ if (isToManyAssociationField(targetField)) {
1447
+ const rawItems = Array.isArray(resolved) ? resolved : [resolved];
1448
+ return rawItems.map((item) => normalizeItem(item)).filter((item) => typeof item !== 'undefined' && item !== null);
1449
+ }
1450
+
1451
+ const toOneValue = Array.isArray(resolved) ? resolved.find((item) => item != null) : resolved;
1452
+ if (toOneValue == null) return toOneValue;
1453
+
1454
+ const normalizedOne = normalizeItem(toOneValue);
1455
+ return normalizedOne;
1456
+ }
1457
+
1458
+ private prepareRuleContext(rule: RuntimeRule) {
1459
+ const baseCtx = rule.getContext();
1460
+ const rawTarget = rule.getTarget();
1461
+ const targetNamePath = this.options.tryResolveNamePath(baseCtx, rawTarget as any);
1462
+ const targetKey = targetNamePath ? namePathToPathKey(targetNamePath) : null;
1463
+
1464
+ const clearDeps = (state: RuleState) => {
1465
+ state.depDisposers.forEach((d) => d());
1466
+ state.depDisposers = [];
1467
+ state.deps = new Set();
1468
+ };
1469
+
1470
+ const disposeBinding = () => {
1471
+ if (!targetKey) return;
1472
+ const existing = this.options.observableBindings.get(targetKey);
1473
+ if (!existing) return;
1474
+ if (existing.source !== rule.source) return;
1475
+ existing.dispose();
1476
+ this.options.observableBindings.delete(targetKey);
1477
+ };
1478
+
1479
+ return { baseCtx, targetNamePath, targetKey, clearDeps, disposeBinding };
1480
+ }
1481
+
1482
+ private shouldApplyDefaultRuleInCurrentState(baseCtx: any): boolean {
1483
+ const actionName = this.options.getActionName?.();
1484
+ if (actionName !== 'update') {
1485
+ return true;
1486
+ }
1487
+
1488
+ // 编辑态默认值规则:
1489
+ // - 顶层编辑表单:不应用默认值
1490
+ // - 子表单:仅对“新增行/新增对象”(__is_new__ = true)应用默认值
1491
+ return this.getItemContext(baseCtx)?.__is_new__ === true;
1492
+ }
1493
+
1494
+ private isStaleToManyItemContext(baseCtx: any): boolean {
1495
+ const item = this.getItemContext(baseCtx);
1496
+ if (!Number.isFinite(item?.index) || !Number.isFinite(item?.length)) return false;
1497
+ return item.index < 0 || item.index >= item.length;
1498
+ }
1499
+
1500
+ private getItemContext(baseCtx: any) {
1501
+ try {
1502
+ return baseCtx?.item;
1503
+ } catch {
1504
+ return undefined;
1505
+ }
1506
+ }
1507
+
1508
+ private getRowTargetKey(baseCtx: any, rowPath: NamePath): string | string[] {
1509
+ let collection = this.getRootCollection() || this.getCollectionFromContext(baseCtx);
1510
+ let field: any;
1511
+ let lastAssociationField: any;
1512
+ for (const seg of rowPath) {
1513
+ if (typeof seg === 'number') continue;
1514
+ if (typeof seg !== 'string' || !seg || !collection?.getField) break;
1515
+
1516
+ field = collection?.getField?.(seg);
1517
+ if (!field?.isAssociationField?.()) break;
1518
+ lastAssociationField = field;
1519
+ collection = field?.targetCollection;
1520
+ }
1521
+
1522
+ const raw =
1523
+ lastAssociationField?.targetCollection?.filterTargetKey ??
1524
+ lastAssociationField?.targetCollection?.filterByTk ??
1525
+ lastAssociationField?.targetKey;
1526
+ if (Array.isArray(raw)) {
1527
+ const keys = raw.filter((key): key is string => typeof key === 'string' && !!key);
1528
+ return keys.length ? keys : 'id';
1529
+ }
1530
+ return typeof raw === 'string' && raw ? raw : 'id';
1531
+ }
1532
+
1533
+ private isMismatchedToManyItemContext(baseCtx: any, targetNamePath: NamePath): boolean {
1534
+ const item = this.getItemContext(baseCtx);
1535
+ if (!item) return false;
1536
+
1537
+ for (let i = targetNamePath.length - 1; i >= 0; i--) {
1538
+ if (typeof targetNamePath[i] !== 'number') continue;
1539
+
1540
+ const rowPath = targetNamePath.slice(0, i + 1);
1541
+ const targetKey = this.getRowTargetKey(baseCtx, rowPath);
1542
+ const currentRow = this.options.getFormValueAtPath(rowPath);
1543
+ const currentIdentity = getSubTableRowIdentity(currentRow, targetKey);
1544
+ const itemIdentity = getSubTableRowIdentity(item.value, targetKey);
1545
+ return !!currentIdentity && !!itemIdentity && currentIdentity !== itemIdentity;
1546
+ }
1547
+
1548
+ return false;
1549
+ }
1550
+
1551
+ private shouldRunRule(
1552
+ rule: RuntimeRule,
1553
+ targetNamePath: NamePath | null,
1554
+ targetKey: string | null,
1555
+ baseCtx: any,
1556
+ ): boolean {
1557
+ if (!rule.getEnabled()) return false;
1558
+ if (!targetNamePath || !targetKey) return false;
1559
+ if (this.isStaleToManyItemContext(baseCtx)) return false;
1560
+ if (this.isMismatchedToManyItemContext(baseCtx, targetNamePath)) return false;
1561
+ if (rule.source === 'default') {
1562
+ if (!this.shouldApplyDefaultRuleInCurrentState(baseCtx)) return false;
1563
+ if (this.options.findExplicitHit(targetKey)) return false;
1564
+ }
1565
+ return true;
1566
+ }
1567
+
1568
+ private createRuleCollectorAndContext(rule: RuntimeRule, ruleContext: ReturnType<typeof this.prepareRuleContext>) {
1569
+ const { baseCtx, targetNamePath } = ruleContext;
1570
+ const rawValue = rule.getValue();
1571
+ const isRunJS = isRunJSValue(rawValue);
1572
+
1573
+ const collector: DepCollector = { deps: new Set(), wildcard: false };
1574
+
1575
+ // 静态路径提取:覆盖"服务端解析但前端不触达 formValues 子路径"的场景
1576
+ if (rule.getCondition) {
1577
+ collectStaticDepsFromTemplateValue(rule.getCondition(), collector);
1578
+ }
1579
+ if (isRunJS) {
1580
+ collectStaticDepsFromRunJSValue(rawValue, collector);
1581
+ } else {
1582
+ collectStaticDepsFromTemplateValue(rawValue, collector);
1583
+ }
1584
+ // 规则可用性依赖 target 当前值(空/等于上次默认值)
1585
+ if (targetNamePath) {
1586
+ recordDep(targetNamePath, collector);
1587
+ // 关联字段嵌套属性:额外依赖关联对象本身,确保从 null -> {id} 时可触发重新计算
1588
+ for (const p of this.collectAssociationPrefixPaths(baseCtx, targetNamePath)) {
1589
+ recordDep(p, collector);
1590
+ }
1591
+ }
1592
+
1593
+ const evalCtx = this.createRuleEvaluationContext(baseCtx, collector, targetNamePath);
1594
+ return { collector, evalCtx, rawValue, isRunJS };
1595
+ }
1596
+
1597
+ private async evaluateRuleCondition(
1598
+ rule: RuntimeRule,
1599
+ state: RuleState,
1600
+ seq: number,
1601
+ evalCtx: any,
1602
+ collector: DepCollector,
1603
+ ): Promise<boolean> {
1604
+ const getCondition = rule.getCondition;
1605
+ if (!getCondition) return true;
1606
+ const cond = getCondition();
1607
+ let resolvedCond = cond;
1608
+ if (cond) {
1609
+ try {
1610
+ resolvedCond = await evalCtx?.resolveJsonTemplate?.(cond);
1611
+ } catch {
1612
+ resolvedCond = cond;
1613
+ }
1614
+ }
1615
+ if (seq !== state.runSeq) return false;
1616
+ if (cond && !evaluateCondition(evalCtx, resolvedCond)) {
1617
+ this.commitRuleDeps(rule, state, collector);
1618
+ return false;
1619
+ }
1620
+ return true;
1621
+ }
1622
+
1623
+ private async resolveRuleValue(
1624
+ rule: RuntimeRule,
1625
+ state: RuleState,
1626
+ seq: number,
1627
+ evalCtx: any,
1628
+ collector: DepCollector,
1629
+ ): Promise<any> {
1630
+ const rawValue = rule.getValue();
1631
+ const isRunJS = isRunJSValue(rawValue);
1632
+
1633
+ if (isRunJS) {
1634
+ return this.resolveRunJSValue(rawValue, state, seq, evalCtx, collector, rule);
1635
+ }
1636
+ return this.resolveTemplateValue(rawValue, state, seq, evalCtx, collector, rule);
1637
+ }
1638
+
1639
+ private async resolveRunJSValue(
1640
+ rawValue: any,
1641
+ state: RuleState,
1642
+ seq: number,
1643
+ evalCtx: any,
1644
+ collector: DepCollector,
1645
+ rule: RuntimeRule,
1646
+ ): Promise<any> {
1647
+ try {
1648
+ const { code, version } = normalizeRunJSValue(rawValue);
1649
+ const ret = await runjsWithSafeGlobals(evalCtx, code, { version });
1650
+ if (!ret?.success) {
1651
+ if (seq !== state.runSeq) return SKIP_RULE_VALUE;
1652
+ this.commitRuleDeps(rule, state, collector);
1653
+ return SKIP_RULE_VALUE;
1654
+ }
1655
+ return ret.value;
1656
+ } catch {
1657
+ if (seq !== state.runSeq) return SKIP_RULE_VALUE;
1658
+ this.commitRuleDeps(rule, state, collector);
1659
+ return SKIP_RULE_VALUE;
1660
+ }
1661
+ }
1662
+
1663
+ private async resolveTemplateValue(
1664
+ rawValue: any,
1665
+ state: RuleState,
1666
+ seq: number,
1667
+ evalCtx: any,
1668
+ collector: DepCollector,
1669
+ rule: RuntimeRule,
1670
+ ): Promise<any> {
1671
+ try {
1672
+ return await evalCtx?.resolveJsonTemplate?.(rawValue);
1673
+ } catch {
1674
+ if (seq !== state.runSeq) return SKIP_RULE_VALUE;
1675
+ this.commitRuleDeps(rule, state, collector);
1676
+ return SKIP_RULE_VALUE;
1677
+ }
1678
+ }
1679
+
1680
+ private commitRuleDeps(rule: RuntimeRule, state: RuleState, collector: DepCollector) {
1681
+ const nextDeps: RuleDeps = new Set(collector.deps);
1682
+ if (collector.wildcard) {
1683
+ nextDeps.add('fv:*');
1684
+ }
1685
+ this.updateRuleDeps(rule, state, nextDeps);
1686
+ }
1687
+
1688
+ /**
1689
+ * Check if default rule value can be applied.
1690
+ * Default value can overwrite when:
1691
+ * 1. Current value is empty
1692
+ * 2. Current value equals the last default value (user hasn't modified it)
1693
+ */
1694
+ private checkDefaultRuleCanApply(
1695
+ resolved: any,
1696
+ targetNamePath: NamePath,
1697
+ targetKey: string,
1698
+ clearDeps: (state: RuleState) => void,
1699
+ disposeBinding: () => void,
1700
+ state: RuleState,
1701
+ ): boolean {
1702
+ if (typeof resolved === 'undefined') return false;
1703
+
1704
+ const explicitHitAfterResolve = this.options.findExplicitHit(targetKey);
1705
+ if (explicitHitAfterResolve) {
1706
+ clearDeps(state);
1707
+ disposeBinding();
1708
+ return false;
1709
+ }
1710
+
1711
+ const current = this.options.getFormValueAtPath(targetNamePath);
1712
+ const last = this.options.lastDefaultValueByPathKey.get(targetKey);
1713
+ const canOverwrite = isEmptyValue(current) || (typeof last !== 'undefined' && _.isEqual(current, last));
1714
+
1715
+ // 若外部已把当前值更新为"解析后的默认值",同步 lastDefault,避免后续默认值变更无法覆盖
1716
+ const nextSnapshot = isObservable(resolved) ? toJS(resolved) : resolved;
1717
+ if (!canOverwrite && _.isEqual(current, nextSnapshot)) {
1718
+ this.options.lastDefaultValueByPathKey.set(targetKey, nextSnapshot);
1719
+ return false;
1720
+ }
1721
+
1722
+ return canOverwrite;
1723
+ }
1724
+
1725
+ private createRuleEvaluationContext(baseCtx: any, collector: DepCollector, targetNamePath: NamePath | null) {
1726
+ const trackingFormValues = this.options.createTrackingFormValues(collector);
1727
+ const ctx: any = new FlowContext();
1728
+ try {
1729
+ ctx.delegate(baseCtx);
1730
+ } catch {
1731
+ // ignore
1732
+ }
1733
+ const baseOptions = baseCtx?.getPropertyOptions?.('formValues');
1734
+ if (baseOptions && typeof baseOptions === 'object') {
1735
+ ctx.defineProperty('formValues', {
1736
+ ...baseOptions,
1737
+ get: () => trackingFormValues,
1738
+ cache: false,
1739
+ });
1740
+ } else {
1741
+ ctx.defineProperty('formValues', { get: () => trackingFormValues, cache: false });
1742
+ }
1743
+
1744
+ // “当前项”链:用于多层级关系字段条件
1745
+ // 语义:ctx.item -> { index?, length?, __is_new__?, __is_stored__?, value, parentItem? },其中:
1746
+ // - index:仅当当前对象位于对多关联行内时存在(0-based)
1747
+ // - length:仅当当前对象位于对多关联行内时存在,表示当前层数组总数
1748
+ // - value:当前对象的值(来自 formValues 的对应切片,支持无限嵌套属性访问)
1749
+ // - parentItem:上级项(同结构,可链式 parentItem.parentItem...)
1750
+ // 计算顺序:
1751
+ // 1) 优先按 targetNamePath 从 formValues 构建“关联链 item”
1752
+ // 2) 若无法构建(例如目标字段是顶层路径),回退到上游显式注入的 baseCtx.item
1753
+ // (如 PopupSubTable 新增弹窗传入的 parentItem 链)
1754
+ let itemCached: any;
1755
+ let itemCachedReady = false;
1756
+ const getItem = () => {
1757
+ if (!itemCachedReady) {
1758
+ const chainItem = this.buildItemChainValue(baseCtx, trackingFormValues, targetNamePath);
1759
+ itemCached = chainItem ?? baseCtx?.item;
1760
+ itemCachedReady = true;
1761
+ }
1762
+ return itemCached;
1763
+ };
1764
+ ctx.defineProperty('item', { get: getItem, cache: false });
1765
+ return ctx;
1766
+ }
1767
+
1768
+ private buildItemChainValue(baseCtx: any, trackingFormValues: any, targetNamePath: NamePath | null) {
1769
+ const rootCollection = this.getRootCollection() || this.getCollectionFromContext(baseCtx);
1770
+ const buildNode = (value: any, index: number | undefined, length: number | undefined, parentItem: any) => {
1771
+ return {
1772
+ index,
1773
+ length,
1774
+ __is_new__: value?.__is_new__,
1775
+ __is_stored__: value?.__is_stored__,
1776
+ value,
1777
+ parentItem,
1778
+ };
1779
+ };
1780
+ const defaultRoot = buildNode(trackingFormValues, undefined, undefined, undefined);
1781
+ // item 仅用于“关系字段的子路径”场景;
1782
+ // 顶层字段/非关联嵌套对象字段应使用 formValues。
1783
+ if (!targetNamePath || !Array.isArray(targetNamePath) || !targetNamePath.length) return undefined;
1784
+ if (!rootCollection?.getField) return undefined;
1785
+
1786
+ const assocEntries: Array<{ path: NamePath; toMany: boolean }> = [];
1787
+ const prefix: NamePath = [];
1788
+ let collection = rootCollection;
1789
+
1790
+ for (let i = 0; i < targetNamePath.length - 1; i++) {
1791
+ const seg = targetNamePath[i];
1792
+ if (typeof seg !== 'string') break;
1793
+
1794
+ const field = collection?.getField?.(seg);
1795
+ if (!field?.isAssociationField?.()) break;
1796
+
1797
+ const toMany = isToManyAssociationField(field);
1798
+ prefix.push(seg);
1799
+
1800
+ if (toMany) {
1801
+ const next = targetNamePath[i + 1];
1802
+ if (typeof next !== 'number') break;
1803
+ prefix.push(next);
1804
+ i += 1;
1805
+ }
1806
+
1807
+ const targetCollection = field?.targetCollection;
1808
+ if (!targetCollection) break;
1809
+
1810
+ assocEntries.push({ path: [...prefix], toMany });
1811
+ collection = targetCollection;
1812
+ }
1813
+
1814
+ const build = (idx: number): any => {
1815
+ if (idx < 0) return defaultRoot;
1816
+ const assocEntry = assocEntries[idx];
1817
+ const value = _.get(trackingFormValues, assocEntry.path);
1818
+ const lastSeg = assocEntry.path[assocEntry.path.length - 1];
1819
+ const index = assocEntry.toMany && typeof lastSeg === 'number' ? lastSeg : undefined;
1820
+ const length = (() => {
1821
+ if (!assocEntry.toMany) return undefined;
1822
+ // assocEntry.path: [..., associationKey, rowIndex]
1823
+ const listPath = assocEntry.path.slice(0, -1);
1824
+ const list = _.get(trackingFormValues, listPath);
1825
+ return Array.isArray(list) ? list.length : undefined;
1826
+ })();
1827
+ return buildNode(value, index, length, build(idx - 1));
1828
+ };
1829
+
1830
+ return assocEntries.length ? build(assocEntries.length - 1) : undefined;
1831
+ }
1832
+
1833
+ private getFieldIndexSignature(baseCtx: any): string {
1834
+ const fieldIndex = baseCtx?.model?.context?.fieldIndex ?? baseCtx?.fieldIndex;
1835
+ const arr = Array.isArray(fieldIndex) ? fieldIndex : [];
1836
+ return arr.filter((it) => typeof it === 'string').join('|');
1837
+ }
1838
+
1839
+ private updateRuleDeps(rule: RuntimeRule, state: RuleState, deps: RuleDeps) {
1840
+ state.depDisposers.forEach((d) => d());
1841
+ state.depDisposers = [];
1842
+ state.deps = deps;
1843
+
1844
+ if (deps.has('fv:*')) {
1845
+ const disposer = reaction(
1846
+ () => this.options.changeTick.value,
1847
+ () => this.scheduleRule(rule.id),
1848
+ );
1849
+ state.depDisposers.push(disposer);
1850
+ }
1851
+
1852
+ const baseCtx: any = (() => {
1853
+ try {
1854
+ return rule.getContext();
1855
+ } catch {
1856
+ return undefined;
1857
+ }
1858
+ })();
1859
+
1860
+ // Row/grid rules resolve target paths through fieldIndex (for example `roles.title`
1861
+ // -> `roles[1].title`). When a row is deleted or reordered, the rule must reschedule
1862
+ // even if its value/condition does not reference ctx.item directly.
1863
+ const fieldIndex = baseCtx?.model?.context?.fieldIndex ?? baseCtx?.fieldIndex;
1864
+ const shouldWatchFieldIndex = Array.isArray(fieldIndex) && fieldIndex.some((it) => typeof it === 'string');
1865
+ if (shouldWatchFieldIndex) {
1866
+ const fieldIndexDisposer = reaction(
1867
+ () => this.getFieldIndexSignature(baseCtx),
1868
+ () => this.scheduleRule(rule.id),
1869
+ );
1870
+ state.depDisposers.push(fieldIndexDisposer);
1871
+ }
1872
+
1873
+ for (const depKey of deps) {
1874
+ if (depKey === 'fv:*') {
1875
+ continue;
1876
+ }
1877
+ // backward compat: treat unknown keys as formValues deps
1878
+ if (!depKey.startsWith('fv:') && !depKey.startsWith('ctx:')) {
1879
+ const depPath = pathKeyToNamePath(depKey);
1880
+ const disposer = reaction(
1881
+ () => _.get(this.options.valuesMirror, depPath),
1882
+ () => this.scheduleRule(rule.id),
1883
+ );
1884
+ state.depDisposers.push(disposer);
1885
+ continue;
1886
+ }
1887
+
1888
+ if (depKey.startsWith('fv:')) {
1889
+ const inner = depKey.slice('fv:'.length);
1890
+ const depPath = pathKeyToNamePath(inner);
1891
+ const disposer = reaction(
1892
+ () => _.get(this.options.valuesMirror, depPath),
1893
+ () => this.scheduleRule(rule.id),
1894
+ );
1895
+ state.depDisposers.push(disposer);
1896
+ continue;
1897
+ }
1898
+
1899
+ // ctx deps: ctx:<varName>[:<subPath>]
1900
+ const rest = depKey.slice('ctx:'.length);
1901
+ const sep = rest.indexOf(':');
1902
+ const varName = sep >= 0 ? rest.slice(0, sep) : rest;
1903
+ const subPath = sep >= 0 ? rest.slice(sep + 1) : '';
1904
+ const depPath = subPath ? (parsePathString(subPath).filter((seg) => typeof seg !== 'object') as NamePath) : [];
1905
+
1906
+ // 特殊变量:item 为 RuleEngine 注入的计算属性(不直接存在于 baseCtx 上)。
1907
+ // fieldIndex 的变化已统一在上面监听,这里只补 item 自身取值的依赖。
1908
+ if (varName === 'item') {
1909
+ if (depPath.length) {
1910
+ const trackingFormValues = this.options.createTrackingFormValues({ deps: new Set(), wildcard: false });
1911
+ const itemValueDisposer = reaction(
1912
+ () => {
1913
+ const targetPath = rule.getTarget?.();
1914
+ const targetNamePath = targetPath ? this.options.tryResolveNamePath(baseCtx, targetPath) : null;
1915
+ const itemRoot = this.buildItemChainValue(baseCtx, trackingFormValues, targetNamePath) ?? baseCtx?.item;
1916
+ return _.get(itemRoot, depPath);
1917
+ },
1918
+ () => this.scheduleRule(rule.id),
1919
+ );
1920
+ state.depDisposers.push(itemValueDisposer);
1921
+ }
1922
+ continue;
1923
+ }
1924
+
1925
+ const disposer = reaction(
1926
+ () => {
1927
+ const root = baseCtx ? baseCtx[varName] : undefined;
1928
+ return depPath.length ? _.get(root, depPath) : root;
1929
+ },
1930
+ () => this.scheduleRule(rule.id),
1931
+ );
1932
+ state.depDisposers.push(disposer);
1933
+ }
1934
+ }
1935
+ }