@nocobase/plugin-flow-engine 2.1.0-alpha.3 → 2.1.0-alpha.31

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 (264) hide show
  1. package/LICENSE +201 -661
  2. package/README.md +79 -9
  3. package/dist/ai/ai-employees/nathan/index.d.ts +10 -0
  4. package/dist/ai/ai-employees/nathan/index.js +42 -0
  5. package/dist/ai/ai-employees/nathan/prompt.md +168 -0
  6. package/dist/ai/ai-employees/nathan/skills/frontend-developer/SKILLS.md +86 -0
  7. package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextApis.js +2 -2
  8. package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextEnvs.js +2 -2
  9. package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextVars.js +2 -2
  10. package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/lintAndTestJS.js +6 -4
  11. package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/patchJSCode.d.ts +10 -0
  12. package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/patchJSCode.js +65 -0
  13. package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/readJSCode.d.ts +10 -0
  14. package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/readJSCode.js +61 -0
  15. package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/writeJSCode.d.ts +10 -0
  16. package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/writeJSCode.js +65 -0
  17. package/dist/ai/docs/runjs/context/block-model.md +35 -35
  18. package/dist/ai/docs/runjs/context/collection-field.md +53 -51
  19. package/dist/ai/docs/runjs/context/collection.md +39 -39
  20. package/dist/ai/docs/runjs/context/data-source-manager.md +40 -30
  21. package/dist/ai/docs/runjs/context/data-source.md +52 -44
  22. package/dist/ai/docs/runjs/context/element.md +44 -38
  23. package/dist/ai/docs/runjs/context/exit-all.md +37 -35
  24. package/dist/ai/docs/runjs/context/exit.md +38 -35
  25. package/dist/ai/docs/runjs/context/filter-manager.md +36 -30
  26. package/dist/ai/docs/runjs/context/form.md +57 -57
  27. package/dist/ai/docs/runjs/context/get-model.md +22 -21
  28. package/dist/ai/docs/runjs/context/get-value.md +20 -19
  29. package/dist/ai/docs/runjs/context/get-var.md +61 -55
  30. package/dist/ai/docs/runjs/context/i18n.md +17 -14
  31. package/dist/ai/docs/runjs/context/import-async.md +333 -45
  32. package/dist/ai/docs/runjs/context/init-resource.md +20 -20
  33. package/dist/ai/docs/runjs/context/libs.md +31 -31
  34. package/dist/ai/docs/runjs/context/location.md +34 -31
  35. package/dist/ai/docs/runjs/context/logger.md +41 -40
  36. package/dist/ai/docs/runjs/context/make-resource.md +27 -26
  37. package/dist/ai/docs/runjs/context/message.md +42 -41
  38. package/dist/ai/docs/runjs/context/modal.md +44 -44
  39. package/dist/ai/docs/runjs/context/model.md +36 -33
  40. package/dist/ai/docs/runjs/context/notification.md +41 -40
  41. package/dist/ai/docs/runjs/context/off.md +14 -14
  42. package/dist/ai/docs/runjs/context/on.md +30 -29
  43. package/dist/ai/docs/runjs/context/open-view.md +40 -40
  44. package/dist/ai/docs/runjs/context/render.md +37 -32
  45. package/dist/ai/docs/runjs/context/request.md +46 -45
  46. package/dist/ai/docs/runjs/context/require-async.md +28 -25
  47. package/dist/ai/docs/runjs/context/resource.md +34 -34
  48. package/dist/ai/docs/runjs/context/route.md +36 -34
  49. package/dist/ai/docs/runjs/context/router.md +43 -31
  50. package/dist/ai/docs/runjs/context/set-value.md +18 -17
  51. package/dist/ai/docs/runjs/context/sql.md +7 -15
  52. package/dist/ai/docs/runjs/context/t.md +20 -17
  53. package/dist/ai/docs/runjs/context/view.md +49 -46
  54. package/dist/ai/docs/runjs/document.md +1 -0
  55. package/dist/ai/docs/runjs/import-modules.md +32 -32
  56. package/dist/ai/docs/runjs/index.md +13 -13
  57. package/dist/ai/docs/runjs/jsx.md +19 -19
  58. package/dist/ai/docs/runjs/model/form-block-model.md +1 -3
  59. package/dist/ai/docs/runjs/render.md +15 -15
  60. package/dist/ai/docs/runjs/resource/api-resource.md +53 -53
  61. package/dist/ai/docs/runjs/resource/multi-record-resource.md +64 -64
  62. package/dist/ai/docs/runjs/resource/single-record-resource.md +55 -55
  63. package/dist/ai/docs/runjs/resource/sql-resource.md +57 -57
  64. package/dist/ai/docs/runjs/window.md +5 -5
  65. package/dist/client/index.js +1 -1
  66. package/dist/externalVersion.js +12 -11
  67. package/dist/locale/en-US.json +1 -0
  68. package/dist/locale/index.d.ts +2 -0
  69. package/dist/locale/zh-CN.json +1 -0
  70. package/dist/node_modules/ses/dist/ses.cjs +1 -1
  71. package/dist/node_modules/ses/package.json +1 -1
  72. package/dist/node_modules/zod/index.cjs +1 -1
  73. package/dist/node_modules/zod/package.json +1 -1
  74. package/dist/server/collections/flowsql.js +1 -0
  75. package/dist/server/flow-surfaces/action-scope.d.ts +39 -0
  76. package/dist/server/flow-surfaces/action-scope.js +156 -0
  77. package/dist/server/flow-surfaces/apply/compiler.d.ts +13 -0
  78. package/dist/server/flow-surfaces/apply/compiler.js +971 -0
  79. package/dist/server/flow-surfaces/apply/layout.d.ts +34 -0
  80. package/dist/server/flow-surfaces/apply/layout.js +175 -0
  81. package/dist/server/flow-surfaces/apply/matching.d.ts +16 -0
  82. package/dist/server/flow-surfaces/apply/matching.js +181 -0
  83. package/dist/server/flow-surfaces/approval/blueprint-service.d.ts +84 -0
  84. package/dist/server/flow-surfaces/approval/blueprint-service.js +589 -0
  85. package/dist/server/flow-surfaces/approval/blueprint.d.ts +21 -0
  86. package/dist/server/flow-surfaces/approval/blueprint.js +187 -0
  87. package/dist/server/flow-surfaces/approval/builder.d.ts +225 -0
  88. package/dist/server/flow-surfaces/approval/builder.js +384 -0
  89. package/dist/server/flow-surfaces/approval/catalog-specs.d.ts +33 -0
  90. package/dist/server/flow-surfaces/approval/catalog-specs.js +156 -0
  91. package/dist/server/flow-surfaces/approval/index.d.ts +14 -0
  92. package/dist/server/flow-surfaces/approval/index.js +40 -0
  93. package/dist/server/flow-surfaces/approval/runtime-config.d.ts +44 -0
  94. package/dist/server/flow-surfaces/approval/runtime-config.js +299 -0
  95. package/dist/server/flow-surfaces/approval/semantic-use.d.ts +23 -0
  96. package/dist/server/flow-surfaces/approval/semantic-use.js +155 -0
  97. package/dist/server/flow-surfaces/association-interfaces.d.ts +10 -0
  98. package/dist/server/flow-surfaces/association-interfaces.js +39 -0
  99. package/dist/server/flow-surfaces/association-title-field.d.ts +20 -0
  100. package/dist/server/flow-surfaces/association-title-field.js +192 -0
  101. package/dist/server/flow-surfaces/blueprint/compile-blocks.d.ts +15 -0
  102. package/dist/server/flow-surfaces/blueprint/compile-blocks.js +1251 -0
  103. package/dist/server/flow-surfaces/blueprint/compile-plan.d.ts +14 -0
  104. package/dist/server/flow-surfaces/blueprint/compile-plan.js +308 -0
  105. package/dist/server/flow-surfaces/blueprint/compile-reaction.d.ts +11 -0
  106. package/dist/server/flow-surfaces/blueprint/compile-reaction.js +72 -0
  107. package/dist/server/flow-surfaces/blueprint/defaults.d.ts +26 -0
  108. package/dist/server/flow-surfaces/blueprint/defaults.js +133 -0
  109. package/dist/server/flow-surfaces/blueprint/index.d.ts +12 -0
  110. package/dist/server/flow-surfaces/blueprint/index.js +44 -0
  111. package/dist/server/flow-surfaces/blueprint/normalize-document.d.ts +10 -0
  112. package/dist/server/flow-surfaces/blueprint/normalize-document.js +407 -0
  113. package/dist/server/flow-surfaces/blueprint/private-utils.d.ts +25 -0
  114. package/dist/server/flow-surfaces/blueprint/private-utils.js +179 -0
  115. package/dist/server/flow-surfaces/blueprint/public-types.d.ts +201 -0
  116. package/dist/server/flow-surfaces/blueprint/public-types.js +24 -0
  117. package/dist/server/flow-surfaces/builder.d.ts +238 -0
  118. package/dist/server/flow-surfaces/builder.js +1261 -0
  119. package/dist/server/flow-surfaces/catalog-smart.d.ts +18 -0
  120. package/dist/server/flow-surfaces/catalog-smart.js +239 -0
  121. package/dist/server/flow-surfaces/catalog-smart.projector.d.ts +15 -0
  122. package/dist/server/flow-surfaces/catalog-smart.projector.js +157 -0
  123. package/dist/server/flow-surfaces/catalog-smart.types.d.ts +99 -0
  124. package/dist/server/flow-surfaces/catalog-smart.types.js +24 -0
  125. package/dist/server/flow-surfaces/catalog.d.ts +79 -0
  126. package/dist/server/flow-surfaces/catalog.js +3743 -0
  127. package/dist/server/flow-surfaces/chart-config.d.ts +121 -0
  128. package/dist/server/flow-surfaces/chart-config.js +1394 -0
  129. package/dist/server/flow-surfaces/compose-compiler.d.ts +115 -0
  130. package/dist/server/flow-surfaces/compose-compiler.js +174 -0
  131. package/dist/server/flow-surfaces/compose-runtime.d.ts +94 -0
  132. package/dist/server/flow-surfaces/compose-runtime.js +376 -0
  133. package/dist/server/flow-surfaces/configure-options.d.ts +23 -0
  134. package/dist/server/flow-surfaces/configure-options.js +904 -0
  135. package/dist/server/flow-surfaces/constants.d.ts +351 -0
  136. package/dist/server/flow-surfaces/constants.js +104 -0
  137. package/dist/server/flow-surfaces/context.d.ts +72 -0
  138. package/dist/server/flow-surfaces/context.js +556 -0
  139. package/dist/server/flow-surfaces/contract-guard.d.ts +19 -0
  140. package/dist/server/flow-surfaces/contract-guard.js +410 -0
  141. package/dist/server/flow-surfaces/core-field-default-bindings.d.ts +12 -0
  142. package/dist/server/flow-surfaces/core-field-default-bindings.js +157 -0
  143. package/dist/server/flow-surfaces/default-action-popup.d.ts +63 -0
  144. package/dist/server/flow-surfaces/default-action-popup.js +322 -0
  145. package/dist/server/flow-surfaces/default-block-actions.d.ts +32 -0
  146. package/dist/server/flow-surfaces/default-block-actions.js +210 -0
  147. package/dist/server/flow-surfaces/errors.d.ts +47 -0
  148. package/dist/server/flow-surfaces/errors.js +145 -0
  149. package/dist/server/flow-surfaces/executor.d.ts +23 -0
  150. package/dist/server/flow-surfaces/executor.js +132 -0
  151. package/dist/server/flow-surfaces/field-binding-registry.d.ts +24 -0
  152. package/dist/server/flow-surfaces/field-binding-registry.js +396 -0
  153. package/dist/server/flow-surfaces/field-semantics.d.ts +15 -0
  154. package/dist/server/flow-surfaces/field-semantics.js +84 -0
  155. package/dist/server/flow-surfaces/field-type-resolver.d.ts +45 -0
  156. package/dist/server/flow-surfaces/field-type-resolver.js +312 -0
  157. package/dist/server/flow-surfaces/filter-group.d.ts +15 -0
  158. package/dist/server/flow-surfaces/filter-group.js +94 -0
  159. package/dist/server/flow-surfaces/hidden-popup-calendar.d.ts +86 -0
  160. package/dist/server/flow-surfaces/hidden-popup-calendar.js +554 -0
  161. package/dist/server/flow-surfaces/hidden-popup-contract.d.ts +116 -0
  162. package/dist/server/flow-surfaces/hidden-popup-contract.js +611 -0
  163. package/dist/server/flow-surfaces/hidden-popup-kanban.d.ts +62 -0
  164. package/dist/server/flow-surfaces/hidden-popup-kanban.js +651 -0
  165. package/dist/server/flow-surfaces/index.d.ts +11 -0
  166. package/dist/server/flow-surfaces/index.js +302 -0
  167. package/dist/server/flow-surfaces/locator.d.ts +28 -0
  168. package/dist/server/flow-surfaces/locator.js +240 -0
  169. package/dist/server/flow-surfaces/node-use-sets.d.ts +15 -0
  170. package/dist/server/flow-surfaces/node-use-sets.js +135 -0
  171. package/dist/server/flow-surfaces/payload-shape.d.ts +9 -0
  172. package/dist/server/flow-surfaces/payload-shape.js +61 -0
  173. package/dist/server/flow-surfaces/placement.d.ts +33 -0
  174. package/dist/server/flow-surfaces/placement.js +199 -0
  175. package/dist/server/flow-surfaces/planning/action-specs.d.ts +179 -0
  176. package/dist/server/flow-surfaces/planning/action-specs.js +190 -0
  177. package/dist/server/flow-surfaces/planning/compiler.d.ts +37 -0
  178. package/dist/server/flow-surfaces/planning/compiler.js +376 -0
  179. package/dist/server/flow-surfaces/planning/context.d.ts +30 -0
  180. package/dist/server/flow-surfaces/planning/context.js +139 -0
  181. package/dist/server/flow-surfaces/planning/created-keys.d.ts +34 -0
  182. package/dist/server/flow-surfaces/planning/created-keys.js +375 -0
  183. package/dist/server/flow-surfaces/planning/key-kind.d.ts +11 -0
  184. package/dist/server/flow-surfaces/planning/key-kind.js +88 -0
  185. package/dist/server/flow-surfaces/planning/key-persistence.d.ts +34 -0
  186. package/dist/server/flow-surfaces/planning/key-persistence.js +148 -0
  187. package/dist/server/flow-surfaces/planning/key-registry.d.ts +40 -0
  188. package/dist/server/flow-surfaces/planning/key-registry.js +206 -0
  189. package/dist/server/flow-surfaces/planning/runtime.d.ts +37 -0
  190. package/dist/server/flow-surfaces/planning/runtime.js +259 -0
  191. package/dist/server/flow-surfaces/planning/step-link.d.ts +14 -0
  192. package/dist/server/flow-surfaces/planning/step-link.js +104 -0
  193. package/dist/server/flow-surfaces/planning/types.d.ts +55 -0
  194. package/dist/server/flow-surfaces/planning/types.js +24 -0
  195. package/dist/server/flow-surfaces/public-compatibility.d.ts +28 -0
  196. package/dist/server/flow-surfaces/public-compatibility.js +161 -0
  197. package/dist/server/flow-surfaces/public-data-surface-default-filter.d.ts +24 -0
  198. package/dist/server/flow-surfaces/public-data-surface-default-filter.js +152 -0
  199. package/dist/server/flow-surfaces/reaction/errors.d.ts +20 -0
  200. package/dist/server/flow-surfaces/reaction/errors.js +69 -0
  201. package/dist/server/flow-surfaces/reaction/field-value.d.ts +34 -0
  202. package/dist/server/flow-surfaces/reaction/field-value.js +181 -0
  203. package/dist/server/flow-surfaces/reaction/fingerprint.d.ts +16 -0
  204. package/dist/server/flow-surfaces/reaction/fingerprint.js +71 -0
  205. package/dist/server/flow-surfaces/reaction/linkage.d.ts +136 -0
  206. package/dist/server/flow-surfaces/reaction/linkage.js +882 -0
  207. package/dist/server/flow-surfaces/reaction/meta.d.ts +11 -0
  208. package/dist/server/flow-surfaces/reaction/meta.js +451 -0
  209. package/dist/server/flow-surfaces/reaction/registry.d.ts +156 -0
  210. package/dist/server/flow-surfaces/reaction/registry.js +206 -0
  211. package/dist/server/flow-surfaces/reaction/resolver.d.ts +22 -0
  212. package/dist/server/flow-surfaces/reaction/resolver.js +202 -0
  213. package/dist/server/flow-surfaces/reaction/types.d.ts +241 -0
  214. package/dist/server/flow-surfaces/reaction/types.js +24 -0
  215. package/dist/server/flow-surfaces/reaction/utils.d.ts +17 -0
  216. package/dist/server/flow-surfaces/reaction/utils.js +67 -0
  217. package/dist/server/flow-surfaces/reaction/value-expr.d.ts +15 -0
  218. package/dist/server/flow-surfaces/reaction/value-expr.js +209 -0
  219. package/dist/server/flow-surfaces/reference-guards.d.ts +19 -0
  220. package/dist/server/flow-surfaces/reference-guards.js +103 -0
  221. package/dist/server/flow-surfaces/route-sync.d.ts +50 -0
  222. package/dist/server/flow-surfaces/route-sync.js +393 -0
  223. package/dist/server/flow-surfaces/service-helpers.d.ts +42 -0
  224. package/dist/server/flow-surfaces/service-helpers.js +310 -0
  225. package/dist/server/flow-surfaces/service-utils.d.ts +120 -0
  226. package/dist/server/flow-surfaces/service-utils.js +878 -0
  227. package/dist/server/flow-surfaces/service.d.ts +896 -0
  228. package/dist/server/flow-surfaces/service.js +16248 -0
  229. package/dist/server/flow-surfaces/support-matrix.d.ts +31 -0
  230. package/dist/server/flow-surfaces/support-matrix.js +282 -0
  231. package/dist/server/flow-surfaces/surface-context.d.ts +52 -0
  232. package/dist/server/flow-surfaces/surface-context.js +440 -0
  233. package/dist/server/flow-surfaces/template-compatibility.d.ts +42 -0
  234. package/dist/server/flow-surfaces/template-compatibility.js +189 -0
  235. package/dist/server/flow-surfaces/template-display.d.ts +20 -0
  236. package/dist/server/flow-surfaces/template-display.js +289 -0
  237. package/dist/server/flow-surfaces/template-service-utils.d.ts +62 -0
  238. package/dist/server/flow-surfaces/template-service-utils.js +281 -0
  239. package/dist/server/flow-surfaces/types.d.ts +288 -0
  240. package/dist/server/flow-surfaces/types.js +24 -0
  241. package/dist/server/index.d.ts +1 -0
  242. package/dist/server/index.js +7 -2
  243. package/dist/server/migrations/20260508000000-remove-flow-model-options-runtime-uid.d.ts +13 -0
  244. package/dist/server/migrations/20260508000000-remove-flow-model-options-runtime-uid.js +67 -0
  245. package/dist/server/plugin.d.ts +0 -1
  246. package/dist/server/plugin.js +9 -34
  247. package/dist/server/repository.js +0 -5
  248. package/dist/server/variables/resolve.d.ts +21 -0
  249. package/dist/server/variables/resolve.js +79 -0
  250. package/dist/swagger/flow-surfaces.d.ts +6106 -0
  251. package/dist/swagger/flow-surfaces.examples.d.ts +1577 -0
  252. package/dist/swagger/flow-surfaces.examples.js +1816 -0
  253. package/dist/swagger/flow-surfaces.js +5375 -0
  254. package/dist/swagger/flow-surfaces.template-action-docs.d.ts +62 -0
  255. package/dist/swagger/flow-surfaces.template-action-docs.js +121 -0
  256. package/dist/swagger/flow-surfaces.template-schemas.d.ts +239 -0
  257. package/dist/swagger/flow-surfaces.template-schemas.js +255 -0
  258. package/dist/swagger/index.d.ts +6111 -0
  259. package/dist/swagger/index.js +50 -0
  260. package/package.json +3 -3
  261. /package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextApis.d.ts +0 -0
  262. /package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextEnvs.d.ts +0 -0
  263. /package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextVars.d.ts +0 -0
  264. /package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/lintAndTestJS.d.ts +0 -0
@@ -0,0 +1,1261 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ var __create = Object.create;
11
+ var __defProp = Object.defineProperty;
12
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
+ var __getOwnPropNames = Object.getOwnPropertyNames;
14
+ var __getProtoOf = Object.getPrototypeOf;
15
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
16
+ var __export = (target, all) => {
17
+ for (var name in all)
18
+ __defProp(target, name, { get: all[name], enumerable: true });
19
+ };
20
+ var __copyProps = (to, from, except, desc) => {
21
+ if (from && typeof from === "object" || typeof from === "function") {
22
+ for (let key of __getOwnPropNames(from))
23
+ if (!__hasOwnProp.call(to, key) && key !== except)
24
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
+ }
26
+ return to;
27
+ };
28
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
29
+ // If the importer is in node compatibility mode or this is not an ESM
30
+ // file that has been converted to a CommonJS file using a Babel-
31
+ // compatible transform (i.e. "__esModule" has not been set), then set
32
+ // "default" to the CommonJS "module.exports" for node compatibility.
33
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
34
+ mod
35
+ ));
36
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
37
+ var builder_exports = {};
38
+ __export(builder_exports, {
39
+ assignClientKeysToUids: () => assignClientKeysToUids,
40
+ buildActionTree: () => buildActionTree,
41
+ buildBlockTree: () => buildBlockTree,
42
+ buildCanonicalTableActionsColumnNode: () => buildCanonicalTableActionsColumnNode,
43
+ buildFieldTree: () => buildFieldTree,
44
+ buildPersistedRootPageModel: () => buildPersistedRootPageModel,
45
+ buildPopupPageTree: () => buildPopupPageTree,
46
+ buildStandaloneFieldNode: () => buildStandaloneFieldNode,
47
+ buildSyntheticRootPageTabModel: () => buildSyntheticRootPageTabModel,
48
+ getStandaloneFieldDefaults: () => getStandaloneFieldDefaults
49
+ });
50
+ module.exports = __toCommonJS(builder_exports);
51
+ var import_utils = require("@nocobase/utils");
52
+ var import_lodash = __toESM(require("lodash"));
53
+ var import_catalog = require("./catalog");
54
+ var import_chart_config = require("./chart-config");
55
+ var import_approval = require("./approval");
56
+ var import_service_utils = require("./service-utils");
57
+ var import_public_compatibility = require("./public-compatibility");
58
+ var import_hidden_popup_contract = require("./hidden-popup-contract");
59
+ const JS_BLOCK_DEFAULT_CODE = [
60
+ "// Welcome to the JS block",
61
+ "ctx.render(`",
62
+ ` <div style="padding: 24px; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; line-height: 1.6;">`,
63
+ ' <h2 style="color: #1890ff; margin: 0 0 12px 0; font-size: 24px; font-weight: 600;">JS Block</h2>',
64
+ ' <p style="color: #666; margin: 0;">Replace this code with your custom JavaScript to build an interactive block.</p>',
65
+ " </div>",
66
+ "`);"
67
+ ].join("\n");
68
+ const JS_FIELD_DEFAULT_CODE = [
69
+ "function JsReadonlyField() {",
70
+ " const React = ctx.React;",
71
+ " const { prefix, suffix, overflowMode } = ctx.model?.props || {};",
72
+ " const text = String(ctx.value ?? '');",
73
+ " const whiteSpace = overflowMode === 'wrap' ? 'pre-line' : 'nowrap';",
74
+ "",
75
+ " return (",
76
+ " <span style={{ whiteSpace }}>",
77
+ " {prefix}",
78
+ " {text}",
79
+ " {suffix}",
80
+ " </span>",
81
+ " );",
82
+ "}",
83
+ "",
84
+ "ctx.render(<JsReadonlyField />);"
85
+ ].join("\n");
86
+ const JS_EDITABLE_FIELD_DEFAULT_CODE = [
87
+ "// Render an editable antd Input via JSX and keep it in sync with form value.",
88
+ "function JsEditableField() {",
89
+ " const React = ctx.React;",
90
+ " const { Input } = ctx.antd;",
91
+ " const [value, setValue] = React.useState(ctx.getValue?.() ?? '');",
92
+ "",
93
+ " React.useEffect(() => {",
94
+ " const handler = (ev) => setValue(ev?.detail ?? '');",
95
+ " ctx.element?.addEventListener('js-field:value-change', handler);",
96
+ " return () => ctx.element?.removeEventListener('js-field:value-change', handler);",
97
+ " }, []);",
98
+ "",
99
+ " const onChange = (e) => {",
100
+ " const v = e?.target?.value ?? '';",
101
+ " setValue(v);",
102
+ " ctx.setValue?.(v);",
103
+ " };",
104
+ "",
105
+ " return <Input {...ctx.model.props} value={value} onChange={onChange} />;",
106
+ "}",
107
+ "",
108
+ "ctx.render(<JsEditableField />);"
109
+ ].join("\n");
110
+ const JS_ITEM_DEFAULT_CODE = [
111
+ "function JsItem() {",
112
+ " return (",
113
+ ` <div style={{ fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif", lineHeight: 1.6 }}>`,
114
+ " <h3 style={{ color: '#1890ff', margin: '0 0 12px 0', fontSize: 18, fontWeight: 600 }}>JS Item</h3>",
115
+ " <div style={{ color: '#555' }}>This area is rendered by your JavaScript code.</div>",
116
+ " </div>",
117
+ " );",
118
+ "}",
119
+ "",
120
+ "ctx.render(<JsItem />);"
121
+ ].join("\n");
122
+ const JS_COLUMN_DEFAULT_CODE = `ctx.render('<span class="nb-js-column">JS column</span>');`;
123
+ const CALENDAR_QUICK_CREATE_ACTION_KEY = "quickCreateAction";
124
+ const CALENDAR_EVENT_VIEW_ACTION_KEY = "eventViewAction";
125
+ const KANBAN_QUICK_CREATE_ACTION_KEY = "quickCreateAction";
126
+ const KANBAN_CARD_VIEW_ACTION_KEY = "cardViewAction";
127
+ const KANBAN_LEGACY_PARENT_CARD_POPUP_PROP_KEYS = [
128
+ "cardOpenMode",
129
+ "cardPopupSize",
130
+ "cardPopupTemplateUid",
131
+ "cardPopupPageModelClass",
132
+ "cardPopupTargetUid"
133
+ ];
134
+ const KANBAN_LEGACY_QUICK_CREATE_POPUP_PROP_KEYS = [
135
+ "popupMode",
136
+ "popupSize",
137
+ "popupTemplateUid",
138
+ "popupPageModelClass",
139
+ "popupTargetUid"
140
+ ];
141
+ const KANBAN_BLOCK_CARD_POPUP_STEP_PARAMS_PATH = ["cardSettings", "popup"];
142
+ const CALENDAR_READONLY_ACTION_MODEL_USES = /* @__PURE__ */ new Set([
143
+ "CalendarNavActionModel",
144
+ "CalendarTitleActionModel",
145
+ "CalendarViewSelectActionModel"
146
+ ]);
147
+ function resolveModelStepParamsOrLegacyObject(model, path, legacyValue) {
148
+ if (import_lodash.default.has(model.stepParams, path)) {
149
+ const value = import_lodash.default.get(model.stepParams, path);
150
+ return import_lodash.default.isPlainObject(value) ? value : {};
151
+ }
152
+ return import_lodash.default.isPlainObject(legacyValue) ? legacyValue : void 0;
153
+ }
154
+ function resolvePersistableModelStepParamsOrLegacyObject(model, path, legacyValue) {
155
+ const value = resolveModelStepParamsOrLegacyObject(model, path, legacyValue);
156
+ if (!import_lodash.default.isPlainObject(value)) {
157
+ return void 0;
158
+ }
159
+ const normalized = normalizeInitialKanbanPopupSettings(value);
160
+ return Object.keys(normalized).length ? normalized : void 0;
161
+ }
162
+ function extractPersistableModelStepParamsOrLegacyObject(model, path, legacyValue) {
163
+ const value = resolvePersistableModelStepParamsOrLegacyObject(model, path, legacyValue);
164
+ import_lodash.default.unset(model.stepParams, path);
165
+ return value;
166
+ }
167
+ function persistModelPopupStepParams(model, path, popupSettings) {
168
+ if (!import_lodash.default.isPlainObject(popupSettings)) {
169
+ return;
170
+ }
171
+ import_lodash.default.set(model.stepParams, path, import_lodash.default.cloneDeep(popupSettings));
172
+ }
173
+ function normalizeInitialKanbanPopupSettings(popupSettings) {
174
+ return (0, import_hidden_popup_contract.normalizeHiddenPopupSettings)(popupSettings);
175
+ }
176
+ function normalizeInitialKanbanPopupSettingsFromProps(actionKey, props) {
177
+ if (!import_lodash.default.isPlainObject(props)) {
178
+ return void 0;
179
+ }
180
+ const rawSettings = actionKey === KANBAN_QUICK_CREATE_ACTION_KEY ? (0, import_service_utils.buildDefinedPayload)({
181
+ mode: props.popupMode,
182
+ size: props.popupSize,
183
+ popupTemplateUid: props.popupTemplateUid,
184
+ pageModelClass: props.popupPageModelClass,
185
+ uid: props.popupTargetUid
186
+ }) : (0, import_service_utils.buildDefinedPayload)({
187
+ mode: props.cardOpenMode,
188
+ size: props.cardPopupSize,
189
+ popupTemplateUid: props.cardPopupTemplateUid,
190
+ pageModelClass: props.cardPopupPageModelClass,
191
+ uid: props.cardPopupTargetUid
192
+ });
193
+ const normalized = normalizeInitialKanbanPopupSettings(rawSettings);
194
+ return Object.keys(normalized).length ? normalized : void 0;
195
+ }
196
+ const JS_ACTION_DEFAULT_CODE_BY_USE = {
197
+ JSCollectionActionModel: [
198
+ "const rows = ctx.resource?.getSelectedRows?.() || [];",
199
+ "if (!rows.length) {",
200
+ " ctx.message.warning('Please select data first.');",
201
+ "} else {",
202
+ " ctx.message.success('Selected ' + rows.length + ' row(s).');",
203
+ "}"
204
+ ].join("\n"),
205
+ JSRecordActionModel: [
206
+ "if (!ctx.record) {",
207
+ " ctx.message.error('No record');",
208
+ "} else {",
209
+ " ctx.message.success('Record ID: ' + (ctx.filterByTk ?? ctx.record?.id));",
210
+ "}"
211
+ ].join("\n"),
212
+ JSFormActionModel: [
213
+ "const values = ctx.form?.getFieldsValue?.() || {};",
214
+ "ctx.message.success('Current form values: ' + JSON.stringify(values));"
215
+ ].join("\n"),
216
+ JSItemActionModel: [
217
+ "const values = ctx.form?.getFieldsValue?.() || ctx.formValues || {};",
218
+ "ctx.message.success('Current form values: ' + JSON.stringify(values));"
219
+ ].join("\n"),
220
+ FilterFormJSActionModel: "",
221
+ JSActionModel: "ctx.message.info('Hello JS action.');"
222
+ };
223
+ function buildRunJsStepParams(code) {
224
+ return {
225
+ runJs: {
226
+ version: "v2",
227
+ code
228
+ }
229
+ };
230
+ }
231
+ function buildPersistedRootPageModel(options) {
232
+ const pageUid = options.pageUid || (0, import_utils.uid)();
233
+ const enableTabs = !!options.enableTabs;
234
+ const displayTitle = options.displayTitle !== false;
235
+ return {
236
+ uid: pageUid,
237
+ use: "RootPageModel",
238
+ props: {
239
+ routeId: options.routeId,
240
+ title: options.pageTitle,
241
+ enableTabs,
242
+ displayTitle
243
+ },
244
+ stepParams: {
245
+ pageSettings: {
246
+ general: {
247
+ title: options.pageTitle,
248
+ displayTitle,
249
+ enableTabs,
250
+ documentTitle: options.pageDocumentTitle
251
+ }
252
+ }
253
+ }
254
+ };
255
+ }
256
+ function buildSyntheticRootPageTabModel(options) {
257
+ var _a;
258
+ const stepParams = import_lodash.default.cloneDeep(options.stepParams || {});
259
+ return {
260
+ uid: options.uid,
261
+ use: options.use || "RootPageTabModel",
262
+ props: {
263
+ ...options.props || {},
264
+ route: import_lodash.default.cloneDeep(options.route),
265
+ title: options.title,
266
+ icon: options.icon
267
+ },
268
+ decoratorProps: import_lodash.default.cloneDeep(options.decoratorProps || {}),
269
+ flowRegistry: import_lodash.default.cloneDeep(options.flowRegistry || {}),
270
+ stepParams: {
271
+ ...stepParams,
272
+ pageTabSettings: {
273
+ ...stepParams.pageTabSettings || {},
274
+ tab: {
275
+ ...((_a = stepParams.pageTabSettings) == null ? void 0 : _a.tab) || {},
276
+ title: options.title,
277
+ icon: options.icon,
278
+ documentTitle: options.documentTitle
279
+ }
280
+ }
281
+ },
282
+ ...options.grid ? { subModels: { grid: options.grid } } : {}
283
+ };
284
+ }
285
+ function buildBlockTree(options) {
286
+ var _a, _b, _c, _d;
287
+ const use = (0, import_catalog.resolveSupportedBlockCatalogItem)(
288
+ {
289
+ type: options.type,
290
+ use: options.use,
291
+ containerUse: options.containerUse
292
+ },
293
+ {
294
+ requireCreateSupported: true
295
+ }
296
+ ).use;
297
+ const defaults = buildBlockDefaults(use);
298
+ const approvalBlockDefaults = (0, import_approval.buildApprovalBlockDefaults)(use);
299
+ const baseStepParams = import_lodash.default.merge(
300
+ {},
301
+ import_lodash.default.cloneDeep(defaults.stepParams || {}),
302
+ import_lodash.default.cloneDeep((approvalBlockDefaults == null ? void 0 : approvalBlockDefaults.stepParams) || {}),
303
+ import_lodash.default.cloneDeep(options.stepParams || {})
304
+ );
305
+ const normalizedResourceInit = import_lodash.default.pickBy(import_lodash.default.cloneDeep(options.resourceInit || {}), (value) => !import_lodash.default.isUndefined(value));
306
+ if (use === "ChartBlockModel") {
307
+ import_lodash.default.unset(baseStepParams, "resourceSettings");
308
+ const currentConfigure = import_lodash.default.get(baseStepParams, ["chartSettings", "configure"]) || {};
309
+ const nextConfigure = import_lodash.default.merge(
310
+ {
311
+ query: {
312
+ mode: "builder"
313
+ },
314
+ chart: {
315
+ option: {
316
+ mode: "basic"
317
+ }
318
+ }
319
+ },
320
+ import_lodash.default.cloneDeep(currentConfigure)
321
+ );
322
+ if (Object.keys(normalizedResourceInit).length) {
323
+ import_lodash.default.set(nextConfigure, ["query", "mode"], "builder");
324
+ import_lodash.default.set(
325
+ nextConfigure,
326
+ ["query", "collectionPath"],
327
+ [normalizedResourceInit.dataSourceKey || import_chart_config.CHART_DEFAULT_DATA_SOURCE_KEY, normalizedResourceInit.collectionName]
328
+ );
329
+ import_lodash.default.unset(nextConfigure, ["query", "resource"]);
330
+ }
331
+ import_lodash.default.set(baseStepParams, ["chartSettings", "configure"], nextConfigure);
332
+ } else if (Object.keys(normalizedResourceInit).length) {
333
+ import_lodash.default.set(baseStepParams, ["resourceSettings", "init"], normalizedResourceInit);
334
+ }
335
+ if (options.enableDefaultSorting) {
336
+ applyDefaultSortingIfMissing(baseStepParams, use);
337
+ }
338
+ const model = {
339
+ ...use === "CalendarBlockModel" || use === "KanbanBlockModel" ? { uid: (0, import_utils.uid)() } : {},
340
+ use,
341
+ ...typeof (approvalBlockDefaults == null ? void 0 : approvalBlockDefaults.async) === "boolean" ? { async: approvalBlockDefaults.async } : {},
342
+ props: import_lodash.default.merge(
343
+ {},
344
+ import_lodash.default.cloneDeep(defaults.props || {}),
345
+ import_lodash.default.cloneDeep((approvalBlockDefaults == null ? void 0 : approvalBlockDefaults.props) || {}),
346
+ import_lodash.default.cloneDeep(options.props || {})
347
+ ),
348
+ decoratorProps: import_lodash.default.merge(
349
+ {},
350
+ import_lodash.default.cloneDeep(defaults.decoratorProps || {}),
351
+ import_lodash.default.cloneDeep((approvalBlockDefaults == null ? void 0 : approvalBlockDefaults.decoratorProps) || {}),
352
+ import_lodash.default.cloneDeep(options.decoratorProps || {})
353
+ ),
354
+ stepParams: baseStepParams
355
+ };
356
+ const flowRegistry = import_lodash.default.merge(
357
+ {},
358
+ import_lodash.default.cloneDeep(defaults.flowRegistry || {}),
359
+ import_lodash.default.cloneDeep((approvalBlockDefaults == null ? void 0 : approvalBlockDefaults.flowRegistry) || {}),
360
+ import_lodash.default.cloneDeep(options.flowRegistry || {})
361
+ );
362
+ if (Object.keys(flowRegistry).length) {
363
+ model.flowRegistry = flowRegistry;
364
+ }
365
+ if (approvalBlockDefaults == null ? void 0 : approvalBlockDefaults.subModels) {
366
+ model.subModels = {};
367
+ const gridDefaults = (0, import_service_utils.getSingleNodeSubModel)(approvalBlockDefaults.subModels.grid);
368
+ if (gridDefaults == null ? void 0 : gridDefaults.use) {
369
+ model.subModels.grid = {
370
+ uid: (0, import_utils.uid)(),
371
+ use: gridDefaults.use
372
+ };
373
+ }
374
+ if (Array.isArray(approvalBlockDefaults.subModels.actions) && approvalBlockDefaults.subModels.actions.length) {
375
+ model.subModels.actions = approvalBlockDefaults.subModels.actions.map((action) => ({
376
+ uid: (0, import_utils.uid)(),
377
+ ...buildActionTree({
378
+ use: action.use,
379
+ containerUse: use
380
+ })
381
+ }));
382
+ }
383
+ } else if (use === "TableBlockModel") {
384
+ model.subModels = {
385
+ columns: [buildCanonicalTableActionsColumnNode()]
386
+ };
387
+ } else if (["FormBlockModel", "CreateFormModel", "EditFormModel", "AssignFormModel"].includes(use)) {
388
+ model.subModels = {
389
+ grid: {
390
+ uid: (0, import_utils.uid)(),
391
+ use: use === "AssignFormModel" ? "AssignFormGridModel" : "FormGridModel"
392
+ }
393
+ };
394
+ } else if (use === "DetailsBlockModel") {
395
+ model.subModels = {
396
+ grid: {
397
+ uid: (0, import_utils.uid)(),
398
+ use: "DetailsGridModel"
399
+ }
400
+ };
401
+ } else if (use === "FilterFormBlockModel") {
402
+ model.subModels = {
403
+ grid: {
404
+ uid: (0, import_utils.uid)(),
405
+ use: "FilterFormGridModel"
406
+ }
407
+ };
408
+ } else if (use === "ListBlockModel") {
409
+ model.subModels = {
410
+ item: {
411
+ uid: (0, import_utils.uid)(),
412
+ use: "ListItemModel",
413
+ subModels: {
414
+ grid: {
415
+ uid: (0, import_utils.uid)(),
416
+ use: "DetailsGridModel"
417
+ }
418
+ }
419
+ }
420
+ };
421
+ } else if (use === "GridCardBlockModel") {
422
+ model.subModels = {
423
+ item: {
424
+ uid: (0, import_utils.uid)(),
425
+ use: "GridCardItemModel",
426
+ subModels: {
427
+ grid: {
428
+ uid: (0, import_utils.uid)(),
429
+ use: "DetailsGridModel"
430
+ }
431
+ }
432
+ }
433
+ };
434
+ } else if (use === "KanbanBlockModel") {
435
+ const blockUid = model.uid || (0, import_utils.uid)();
436
+ model.uid = blockUid;
437
+ const quickCreatePopupSettings = resolvePersistableModelStepParamsOrLegacyObject(
438
+ model,
439
+ ["kanbanSettings", "popup"],
440
+ (_a = model.props) == null ? void 0 : _a.quickCreatePopupSettings
441
+ ) || normalizeInitialKanbanPopupSettingsFromProps(KANBAN_QUICK_CREATE_ACTION_KEY, model.props);
442
+ const cardPopupSettings = extractPersistableModelStepParamsOrLegacyObject(
443
+ model,
444
+ KANBAN_BLOCK_CARD_POPUP_STEP_PARAMS_PATH,
445
+ (_b = model.props) == null ? void 0 : _b.cardPopupSettings
446
+ ) || normalizeInitialKanbanPopupSettingsFromProps(KANBAN_CARD_VIEW_ACTION_KEY, model.props);
447
+ persistModelPopupStepParams(model, ["kanbanSettings", "popup"], quickCreatePopupSettings);
448
+ if (model.props) {
449
+ delete model.props.quickCreatePopupSettings;
450
+ delete model.props.cardPopupSettings;
451
+ for (const propKey of KANBAN_LEGACY_QUICK_CREATE_POPUP_PROP_KEYS) {
452
+ delete model.props[propKey];
453
+ }
454
+ for (const propKey of KANBAN_LEGACY_PARENT_CARD_POPUP_PROP_KEYS) {
455
+ delete model.props[propKey];
456
+ }
457
+ }
458
+ model.subModels = {
459
+ item: {
460
+ uid: (0, import_utils.uid)(),
461
+ use: "KanbanCardItemModel",
462
+ ...cardPopupSettings && import_lodash.default.isPlainObject(cardPopupSettings) ? {
463
+ stepParams: {
464
+ cardSettings: {
465
+ popup: import_lodash.default.cloneDeep(cardPopupSettings)
466
+ }
467
+ }
468
+ } : {},
469
+ subModels: {
470
+ grid: {
471
+ uid: (0, import_utils.uid)(),
472
+ use: "DetailsGridModel"
473
+ }
474
+ }
475
+ },
476
+ [KANBAN_QUICK_CREATE_ACTION_KEY]: buildKanbanPopupActionNode({
477
+ actionKey: KANBAN_QUICK_CREATE_ACTION_KEY,
478
+ blockUid,
479
+ resourceInit: normalizedResourceInit,
480
+ popupSettings: quickCreatePopupSettings
481
+ }),
482
+ [KANBAN_CARD_VIEW_ACTION_KEY]: buildKanbanPopupActionNode({
483
+ actionKey: KANBAN_CARD_VIEW_ACTION_KEY,
484
+ blockUid,
485
+ resourceInit: normalizedResourceInit,
486
+ popupSettings: cardPopupSettings
487
+ })
488
+ };
489
+ } else if (use === "CalendarBlockModel") {
490
+ const blockUid = model.uid || (0, import_utils.uid)();
491
+ model.uid = blockUid;
492
+ const quickCreatePopupSettings = resolveModelStepParamsOrLegacyObject(
493
+ model,
494
+ ["calendarSettings", "quickCreatePopupSettings"],
495
+ (_c = model.props) == null ? void 0 : _c.quickCreatePopupSettings
496
+ );
497
+ const eventPopupSettings = resolveModelStepParamsOrLegacyObject(
498
+ model,
499
+ ["calendarSettings", "eventPopupSettings"],
500
+ (_d = model.props) == null ? void 0 : _d.eventPopupSettings
501
+ );
502
+ persistModelPopupStepParams(model, ["calendarSettings", "quickCreatePopupSettings"], quickCreatePopupSettings);
503
+ persistModelPopupStepParams(model, ["calendarSettings", "eventPopupSettings"], eventPopupSettings);
504
+ if (model.props) {
505
+ delete model.props.quickCreatePopupSettings;
506
+ delete model.props.eventPopupSettings;
507
+ }
508
+ model.subModels = {
509
+ [CALENDAR_QUICK_CREATE_ACTION_KEY]: buildCalendarPopupActionNode({
510
+ actionKey: CALENDAR_QUICK_CREATE_ACTION_KEY,
511
+ blockUid,
512
+ resourceInit: normalizedResourceInit,
513
+ popupSettings: quickCreatePopupSettings
514
+ }),
515
+ [CALENDAR_EVENT_VIEW_ACTION_KEY]: buildCalendarPopupActionNode({
516
+ actionKey: CALENDAR_EVENT_VIEW_ACTION_KEY,
517
+ blockUid,
518
+ resourceInit: normalizedResourceInit,
519
+ popupSettings: eventPopupSettings
520
+ })
521
+ };
522
+ }
523
+ return assignClientKeysToUids(model, {});
524
+ }
525
+ function buildKanbanPopupActionNode(options) {
526
+ const actionUid = options.actionKey === KANBAN_QUICK_CREATE_ACTION_KEY ? `${options.blockUid}-quick-create-action` : `${options.blockUid}-card-view-action`;
527
+ return {
528
+ uid: actionUid,
529
+ use: options.actionKey === KANBAN_QUICK_CREATE_ACTION_KEY ? "KanbanQuickCreateActionModel" : "KanbanCardViewActionModel",
530
+ stepParams: {
531
+ popupSettings: {
532
+ openView: buildKanbanPopupOpenView({
533
+ actionUid,
534
+ resourceInit: options.resourceInit,
535
+ popupSettings: options.popupSettings
536
+ })
537
+ }
538
+ }
539
+ };
540
+ }
541
+ function buildKanbanPopupOpenView(options) {
542
+ return (0, import_hidden_popup_contract.buildHiddenPopupOpenView)({
543
+ actionUid: options.actionUid,
544
+ resourceInit: options.resourceInit,
545
+ popupSettings: options.popupSettings,
546
+ normalizePopupSettings: normalizeInitialKanbanPopupSettings
547
+ });
548
+ }
549
+ function buildCalendarPopupActionNode(options) {
550
+ const actionUid = `${options.blockUid}-${options.actionKey}`;
551
+ return {
552
+ uid: actionUid,
553
+ use: options.actionKey === CALENDAR_QUICK_CREATE_ACTION_KEY ? "CalendarQuickCreateActionModel" : "CalendarEventViewActionModel",
554
+ stepParams: {
555
+ popupSettings: {
556
+ openView: buildCalendarPopupOpenView({
557
+ actionUid,
558
+ resourceInit: options.resourceInit,
559
+ popupSettings: options.popupSettings
560
+ })
561
+ }
562
+ }
563
+ };
564
+ }
565
+ function buildCalendarPopupOpenView(options) {
566
+ return (0, import_hidden_popup_contract.buildHiddenPopupOpenView)(options);
567
+ }
568
+ function buildPopupPageTree(options) {
569
+ const pageUid = options.pageUid || (0, import_utils.uid)();
570
+ const tabUid = options.tabUid || (0, import_utils.uid)();
571
+ const gridUid = options.gridUid || (0, import_utils.uid)();
572
+ const displayTitle = options.displayTitle === true;
573
+ const enableTabs = options.enableTabs !== false;
574
+ const tabTitle = options.tabTitle || '{{t("Details")}}';
575
+ return {
576
+ uid: pageUid,
577
+ use: "ChildPageModel",
578
+ props: {
579
+ ...options.pageTitle ? { title: options.pageTitle } : {},
580
+ displayTitle,
581
+ enableTabs
582
+ },
583
+ stepParams: {
584
+ pageSettings: {
585
+ general: {
586
+ ...options.pageTitle ? { title: options.pageTitle } : {},
587
+ displayTitle,
588
+ enableTabs
589
+ }
590
+ }
591
+ },
592
+ subModels: {
593
+ tabs: [
594
+ {
595
+ uid: tabUid,
596
+ use: "ChildPageTabModel",
597
+ props: {
598
+ title: tabTitle
599
+ },
600
+ stepParams: {
601
+ pageTabSettings: {
602
+ tab: {
603
+ title: tabTitle
604
+ }
605
+ }
606
+ },
607
+ subModels: {
608
+ grid: {
609
+ uid: gridUid,
610
+ use: "BlockGridModel"
611
+ }
612
+ }
613
+ }
614
+ ]
615
+ }
616
+ };
617
+ }
618
+ function buildFieldTree(params) {
619
+ const wrapperUid = params.uid || (0, import_utils.uid)();
620
+ const innerUid = params.innerUid || (0, import_utils.uid)();
621
+ const fieldDefaults = getStandaloneFieldDefaults(params.fieldUse);
622
+ const approvalTree = (0, import_approval.buildApprovalFieldTree)({
623
+ ...params,
624
+ uid: wrapperUid,
625
+ innerUid,
626
+ fieldDefaults
627
+ });
628
+ if (approvalTree) {
629
+ return {
630
+ wrapperUid: approvalTree.wrapperUid,
631
+ innerUid: approvalTree.innerUid,
632
+ model: approvalTree.model
633
+ };
634
+ }
635
+ const initPayload = import_lodash.default.pickBy(
636
+ {
637
+ dataSourceKey: params.dataSourceKey,
638
+ collectionName: params.collectionName,
639
+ fieldPath: params.fieldPath,
640
+ ...params.associationPathName ? { associationPathName: params.associationPathName } : {}
641
+ },
642
+ (value) => !import_lodash.default.isUndefined(value)
643
+ );
644
+ const stepParams = {
645
+ fieldSettings: {
646
+ init: initPayload
647
+ }
648
+ };
649
+ if (params.filterFormInit) {
650
+ stepParams.filterFormItemSettings = {
651
+ init: params.filterFormInit
652
+ };
653
+ }
654
+ return {
655
+ wrapperUid,
656
+ innerUid,
657
+ model: {
658
+ uid: wrapperUid,
659
+ use: params.wrapperUse,
660
+ props: import_lodash.default.cloneDeep(params.wrapperProps || {}),
661
+ stepParams,
662
+ subModels: {
663
+ field: {
664
+ uid: innerUid,
665
+ use: params.fieldUse,
666
+ props: import_lodash.default.cloneDeep(params.fieldProps || {}),
667
+ stepParams: import_lodash.default.merge(
668
+ {},
669
+ fieldDefaults.stepParams || {},
670
+ import_lodash.default.cloneDeep({
671
+ fieldSettings: {
672
+ init: initPayload
673
+ }
674
+ })
675
+ ),
676
+ ...fieldDefaults.subModels ? { subModels: import_lodash.default.cloneDeep(fieldDefaults.subModels) } : {}
677
+ }
678
+ }
679
+ }
680
+ };
681
+ }
682
+ function buildStandaloneFieldNode(options) {
683
+ const defaults = getStandaloneFieldDefaults(options.use);
684
+ return {
685
+ uid: options.uid || (0, import_utils.uid)(),
686
+ use: options.use,
687
+ props: import_lodash.default.merge({}, import_lodash.default.cloneDeep(defaults.props || {}), import_lodash.default.cloneDeep(options.props || {})),
688
+ decoratorProps: import_lodash.default.merge({}, import_lodash.default.cloneDeep(defaults.decoratorProps || {}), import_lodash.default.cloneDeep(options.decoratorProps || {})),
689
+ stepParams: import_lodash.default.merge({}, import_lodash.default.cloneDeep(defaults.stepParams || {}), import_lodash.default.cloneDeep(options.stepParams || {}))
690
+ };
691
+ }
692
+ function buildActionTree(options) {
693
+ var _a;
694
+ const catalogItem = (0, import_catalog.resolveSupportedActionCatalogItem)(
695
+ {
696
+ type: options.type,
697
+ use: options.use,
698
+ containerUse: options.containerUse
699
+ },
700
+ {
701
+ requireCreateSupported: true
702
+ }
703
+ );
704
+ const use = catalogItem.use;
705
+ const defaults = buildActionDefaults({
706
+ use,
707
+ catalogItem,
708
+ containerUse: options.containerUse,
709
+ resourceInit: options.resourceInit
710
+ });
711
+ const props = import_lodash.default.merge({}, import_lodash.default.cloneDeep(defaults.props || {}), import_lodash.default.cloneDeep(options.props || {}));
712
+ const stepParams = import_lodash.default.merge({}, import_lodash.default.cloneDeep(defaults.stepParams || {}), import_lodash.default.cloneDeep(options.stepParams || {}));
713
+ if (import_lodash.default.isPlainObject((_a = stepParams == null ? void 0 : stepParams.buttonSettings) == null ? void 0 : _a.general)) {
714
+ stepParams.buttonSettings.general = import_lodash.default.merge({}, stepParams.buttonSettings.general, pickButtonGeneralProps(props));
715
+ }
716
+ return {
717
+ use,
718
+ props,
719
+ decoratorProps: import_lodash.default.merge({}, import_lodash.default.cloneDeep(defaults.decoratorProps || {}), import_lodash.default.cloneDeep(options.decoratorProps || {})),
720
+ stepParams,
721
+ flowRegistry: import_lodash.default.merge({}, import_lodash.default.cloneDeep(defaults.flowRegistry || {}), import_lodash.default.cloneDeep(options.flowRegistry || {})),
722
+ ...defaults.subModels ? { subModels: import_lodash.default.cloneDeep(defaults.subModels) } : {}
723
+ };
724
+ }
725
+ function buildCanonicalTableActionsColumnNode(options = {}) {
726
+ return {
727
+ uid: options.uid || (0, import_utils.uid)(),
728
+ use: "TableActionsColumnModel",
729
+ props: import_lodash.default.cloneDeep(options.props || {}),
730
+ decoratorProps: import_lodash.default.cloneDeep(options.decoratorProps || {}),
731
+ stepParams: import_lodash.default.merge(
732
+ {},
733
+ {
734
+ tableColumnSettings: {
735
+ title: {
736
+ title: '{{t("Actions")}}'
737
+ }
738
+ }
739
+ },
740
+ import_lodash.default.cloneDeep(options.stepParams || {})
741
+ ),
742
+ flowRegistry: import_lodash.default.cloneDeep(options.flowRegistry || {})
743
+ };
744
+ }
745
+ function pickButtonGeneralProps(props) {
746
+ return import_lodash.default.pickBy(
747
+ import_lodash.default.pick(props || {}, ["title", "tooltip", "icon", "type", "danger", "color"]),
748
+ (value) => !import_lodash.default.isUndefined(value)
749
+ );
750
+ }
751
+ function assignClientKeysToUids(spec, clientKeyToUid) {
752
+ const next = import_lodash.default.cloneDeep(spec);
753
+ const walk = (node) => {
754
+ if (!node.uid) {
755
+ node.uid = (0, import_utils.uid)();
756
+ }
757
+ if (node.clientKey) {
758
+ clientKeyToUid[node.clientKey] = node.uid;
759
+ }
760
+ Object.values(node.subModels || {}).forEach((value) => {
761
+ import_lodash.default.castArray(value).forEach((child) => walk(child));
762
+ });
763
+ };
764
+ walk(next);
765
+ return next;
766
+ }
767
+ function buildActionDefaults(options) {
768
+ var _a, _b, _c;
769
+ const approvalDefaults = (0, import_approval.buildApprovalActionDefaults)(options.use);
770
+ const readonlyCalendarAction = CALENDAR_READONLY_ACTION_MODEL_USES.has(options.use);
771
+ const props = import_lodash.default.merge(
772
+ {},
773
+ inferActionDefaultProps(options.use, options.catalogItem.scope),
774
+ (approvalDefaults == null ? void 0 : approvalDefaults.props) || {}
775
+ );
776
+ const normalizedProps = applyContainerActionStyle(props, options.containerUse);
777
+ const stepParams = import_lodash.default.merge(
778
+ {},
779
+ import_lodash.default.cloneDeep((approvalDefaults == null ? void 0 : approvalDefaults.stepParams) || {}),
780
+ readonlyCalendarAction ? {} : {
781
+ buttonSettings: {
782
+ general: pickButtonGeneralProps(normalizedProps)
783
+ }
784
+ }
785
+ );
786
+ const subModels = import_lodash.default.cloneDeep((approvalDefaults == null ? void 0 : approvalDefaults.subModels) || {});
787
+ if (approvalDefaults) {
788
+ return {
789
+ props: normalizedProps,
790
+ stepParams,
791
+ ...Object.keys(subModels).length ? { subModels } : {}
792
+ };
793
+ }
794
+ if ([
795
+ "AddNewActionModel",
796
+ "ViewActionModel",
797
+ "EditActionModel",
798
+ "PopupCollectionActionModel",
799
+ "DuplicateActionModel",
800
+ "AddChildActionModel",
801
+ "MailSendActionModel"
802
+ ].includes(options.use)) {
803
+ const popupSourceId = inferPopupActionSourceId(options.resourceInit);
804
+ stepParams.popupSettings = {
805
+ openView: {
806
+ mode: "drawer",
807
+ size: "medium",
808
+ pageModelClass: "ChildPageModel",
809
+ ...((_a = options.resourceInit) == null ? void 0 : _a.dataSourceKey) ? { dataSourceKey: options.resourceInit.dataSourceKey } : {},
810
+ ...((_b = options.resourceInit) == null ? void 0 : _b.collectionName) ? { collectionName: options.resourceInit.collectionName } : {},
811
+ ...((_c = options.resourceInit) == null ? void 0 : _c.associationName) ? { associationName: options.resourceInit.associationName } : {},
812
+ ...popupSourceId ? { sourceId: popupSourceId } : {}
813
+ }
814
+ };
815
+ }
816
+ if (options.use === "DeleteActionModel" || options.use === "BulkDeleteActionModel") {
817
+ stepParams.deleteSettings = {
818
+ confirm: {
819
+ enable: true,
820
+ title: '{{t("Delete record")}}',
821
+ content: '{{t("Are you sure you want to delete it?")}}'
822
+ }
823
+ };
824
+ }
825
+ if (options.use === "FormSubmitActionModel") {
826
+ stepParams.submitSettings = {
827
+ confirm: {
828
+ enable: false,
829
+ title: '{{t("Submit record")}}',
830
+ content: '{{t("Are you sure you want to save it?")}}'
831
+ }
832
+ };
833
+ }
834
+ if (["UpdateRecordActionModel", "BulkUpdateActionModel"].includes(options.use)) {
835
+ stepParams.assignSettings = {
836
+ confirm: {
837
+ enable: false,
838
+ title: options.use === "BulkUpdateActionModel" ? '{{t("Bulk update")}}' : '{{t("Perform the Update record")}}',
839
+ content: '{{t("Are you sure you want to perform the Update record action?")}}'
840
+ },
841
+ assignFieldValues: {
842
+ assignedValues: {}
843
+ }
844
+ };
845
+ stepParams.apply = {
846
+ apply: {
847
+ assignedValues: {}
848
+ }
849
+ };
850
+ subModels.assignForm = {
851
+ uid: (0, import_utils.uid)(),
852
+ use: "AssignFormModel",
853
+ stepParams: {
854
+ resourceSettings: {
855
+ init: import_lodash.default.cloneDeep(options.resourceInit || {})
856
+ }
857
+ },
858
+ subModels: {
859
+ grid: {
860
+ uid: (0, import_utils.uid)(),
861
+ use: "AssignFormGridModel"
862
+ }
863
+ }
864
+ };
865
+ }
866
+ if (JS_ACTION_DEFAULT_CODE_BY_USE[options.use] !== void 0) {
867
+ stepParams.clickSettings = buildRunJsStepParams(JS_ACTION_DEFAULT_CODE_BY_USE[options.use]);
868
+ }
869
+ return {
870
+ props: normalizedProps,
871
+ stepParams,
872
+ ...Object.keys(subModels).length ? { subModels } : {}
873
+ };
874
+ }
875
+ function inferPopupActionSourceId(resourceInit) {
876
+ if (!(resourceInit == null ? void 0 : resourceInit.associationName)) {
877
+ return void 0;
878
+ }
879
+ const sourceId = typeof (resourceInit == null ? void 0 : resourceInit.sourceId) === "string" ? resourceInit.sourceId.trim() : resourceInit == null ? void 0 : resourceInit.sourceId;
880
+ if (!sourceId) {
881
+ return void 0;
882
+ }
883
+ if (sourceId === "{{ctx.view.inputArgs.filterByTk}}") {
884
+ return "{{ctx.view.inputArgs.sourceId}}";
885
+ }
886
+ return sourceId;
887
+ }
888
+ function inferActionDefaultProps(use, scope) {
889
+ const map = {
890
+ AddNewActionModel: {
891
+ type: "primary",
892
+ title: '{{t("Add new")}}',
893
+ icon: "PlusOutlined"
894
+ },
895
+ ViewActionModel: {
896
+ type: "link",
897
+ title: '{{t("View")}}',
898
+ icon: "EyeOutlined"
899
+ },
900
+ EditActionModel: {
901
+ title: '{{t("Edit")}}',
902
+ icon: "EditOutlined"
903
+ },
904
+ PopupCollectionActionModel: {
905
+ title: '{{t("Popup")}}',
906
+ icon: "ExportOutlined"
907
+ },
908
+ DeleteActionModel: {
909
+ type: "link",
910
+ title: '{{t("Delete")}}',
911
+ icon: "DeleteOutlined"
912
+ },
913
+ UpdateRecordActionModel: {
914
+ type: "link",
915
+ title: '{{t("Update record")}}',
916
+ icon: "EditOutlined"
917
+ },
918
+ BulkUpdateActionModel: {
919
+ title: '{{t("Bulk update")}}',
920
+ icon: "EditOutlined"
921
+ },
922
+ FilterActionModel: {
923
+ title: '{{t("Filter")}}',
924
+ icon: "FilterOutlined"
925
+ },
926
+ RefreshActionModel: {
927
+ title: '{{t("Refresh")}}',
928
+ icon: "ReloadOutlined"
929
+ },
930
+ ExpandCollapseActionModel: {
931
+ icon: "DownOutlined"
932
+ },
933
+ BulkDeleteActionModel: {
934
+ title: "",
935
+ tooltip: '{{t("Delete")}}',
936
+ icon: "DeleteOutlined",
937
+ position: "right"
938
+ },
939
+ BulkEditActionModel: {
940
+ title: '{{t("Bulk edit")}}',
941
+ icon: "EditOutlined"
942
+ },
943
+ ExportActionModel: {
944
+ title: '{{t("Export")}}',
945
+ icon: "DownloadOutlined"
946
+ },
947
+ ExportAttachmentActionModel: {
948
+ title: '{{t("Export attachments")}}',
949
+ icon: "DownloadOutlined"
950
+ },
951
+ ImportActionModel: {
952
+ title: '{{t("Import")}}',
953
+ icon: "UploadOutlined"
954
+ },
955
+ LinkActionModel: {
956
+ type: "link",
957
+ title: '{{t("Link")}}'
958
+ },
959
+ UploadActionModel: {
960
+ title: '{{t("Upload")}}',
961
+ icon: "UploadOutlined"
962
+ },
963
+ DuplicateActionModel: {
964
+ type: "link",
965
+ title: '{{t("Duplicate")}}',
966
+ icon: "CopyOutlined"
967
+ },
968
+ AddChildActionModel: {
969
+ type: "link",
970
+ title: '{{t("Add child")}}',
971
+ icon: "PlusOutlined"
972
+ },
973
+ TemplatePrintCollectionActionModel: {
974
+ title: '{{t("Template print", { ns: "@nocobase/plugin-action-template-print" })}}',
975
+ icon: "PrinterOutlined"
976
+ },
977
+ TemplatePrintRecordActionModel: {
978
+ type: "link",
979
+ title: '{{t("Template print", { ns: "@nocobase/plugin-action-template-print" })}}',
980
+ icon: "PrinterOutlined"
981
+ },
982
+ CollectionTriggerWorkflowActionModel: {
983
+ title: '{{t("Trigger workflow", { ns: "@nocobase/plugin-workflow-custom-action-trigger" })}}',
984
+ icon: "PlayCircleOutlined"
985
+ },
986
+ RecordTriggerWorkflowActionModel: {
987
+ type: "link",
988
+ title: '{{t("Trigger workflow", { ns: "@nocobase/plugin-workflow-custom-action-trigger" })}}',
989
+ icon: "PlayCircleOutlined"
990
+ },
991
+ FormTriggerWorkflowActionModel: {
992
+ title: '{{t("Trigger workflow", { ns: "@nocobase/plugin-workflow-custom-action-trigger" })}}',
993
+ icon: "PlayCircleOutlined"
994
+ },
995
+ WorkbenchTriggerWorkflowActionModel: {
996
+ title: '{{t("Trigger global workflow", { ns: "@nocobase/plugin-workflow-custom-action-trigger" })}}',
997
+ icon: "PlayCircleOutlined"
998
+ },
999
+ MailSendActionModel: {
1000
+ title: '{{t("Compose email", { ns: ["@nocobase/plugin-email-manager", "client"] })}}',
1001
+ icon: "MailOutlined"
1002
+ },
1003
+ FormSubmitActionModel: {
1004
+ title: '{{t("Submit")}}',
1005
+ type: "primary",
1006
+ htmlType: "submit"
1007
+ },
1008
+ FilterFormSubmitActionModel: {
1009
+ title: '{{t("Filter")}}',
1010
+ type: "primary"
1011
+ },
1012
+ FilterFormResetActionModel: {
1013
+ title: '{{t("Reset")}}'
1014
+ },
1015
+ FilterFormCollapseActionModel: {
1016
+ type: "link",
1017
+ title: '{{t("Collapse button")}}'
1018
+ },
1019
+ CalendarTodayActionModel: {
1020
+ type: "default",
1021
+ title: '{{t("Today", { ns: "calendar" })}}'
1022
+ },
1023
+ CalendarNavActionModel: {},
1024
+ CalendarTitleActionModel: {},
1025
+ CalendarViewSelectActionModel: {},
1026
+ JSCollectionActionModel: {
1027
+ title: '{{t("JS action")}}',
1028
+ icon: "JavaScriptOutlined"
1029
+ },
1030
+ JSRecordActionModel: {
1031
+ type: "link",
1032
+ title: '{{t("JS action")}}',
1033
+ icon: "JavaScriptOutlined"
1034
+ },
1035
+ JSFormActionModel: {
1036
+ title: '{{t("JS action")}}',
1037
+ icon: "JavaScriptOutlined"
1038
+ },
1039
+ JSItemActionModel: {
1040
+ title: '{{t("JS item")}}',
1041
+ icon: "JavaScriptOutlined"
1042
+ },
1043
+ FilterFormJSActionModel: {
1044
+ title: '{{t("JS action")}}',
1045
+ icon: "JavaScriptOutlined"
1046
+ },
1047
+ JSActionModel: {
1048
+ type: "default",
1049
+ title: '{{t("JS action")}}',
1050
+ icon: "JavaScriptOutlined"
1051
+ }
1052
+ };
1053
+ return import_lodash.default.cloneDeep(
1054
+ map[use] || {
1055
+ title: humanizeActionTitle(use),
1056
+ ...scope === "record" ? { type: "link" } : { type: "default" }
1057
+ }
1058
+ );
1059
+ }
1060
+ function applyContainerActionStyle(props, containerUse) {
1061
+ if (["TableActionsColumnModel", "ListItemModel", "GridCardItemModel"].includes(String(containerUse || "").trim())) {
1062
+ return {
1063
+ ...props,
1064
+ type: "link",
1065
+ icon: null
1066
+ };
1067
+ }
1068
+ if (containerUse === "DetailsBlockModel") {
1069
+ return {
1070
+ ...props,
1071
+ type: "default"
1072
+ };
1073
+ }
1074
+ return props;
1075
+ }
1076
+ const BLOCK_DEFAULT_SORTING_PATH_BY_USE = {
1077
+ KanbanBlockModel: ["kanbanSettings", "defaultSorting", "sort"],
1078
+ TreeBlockModel: ["treeSettings", "defaultSorting", "sort"],
1079
+ TableBlockModel: ["tableSettings", "defaultSorting", "sort"],
1080
+ DetailsBlockModel: ["detailsSettings", "defaultSorting", "sort"],
1081
+ ListBlockModel: ["listSettings", "defaultSorting", "sort"],
1082
+ GridCardBlockModel: ["GridCardSettings", "defaultSorting", "sort"],
1083
+ MapBlockModel: ["createMapBlock", "lineSort", "sort"]
1084
+ };
1085
+ function applyDefaultSortingIfMissing(stepParams, use) {
1086
+ const path = BLOCK_DEFAULT_SORTING_PATH_BY_USE[use];
1087
+ if (!path) {
1088
+ return;
1089
+ }
1090
+ const currentSorting = import_lodash.default.get(stepParams, path);
1091
+ if (Array.isArray(currentSorting) || import_lodash.default.isNull(currentSorting) || import_lodash.default.isUndefined(currentSorting)) {
1092
+ if (!import_lodash.default.has(stepParams, path) || import_lodash.default.isNull(currentSorting) || import_lodash.default.isUndefined(currentSorting)) {
1093
+ import_lodash.default.set(stepParams, path, import_lodash.default.cloneDeep(import_public_compatibility.FLOW_SURFACE_DEFAULT_SORTING));
1094
+ }
1095
+ }
1096
+ }
1097
+ function buildBlockDefaults(use) {
1098
+ if (use === "JSBlockModel") {
1099
+ return {
1100
+ stepParams: {
1101
+ jsSettings: buildRunJsStepParams(JS_BLOCK_DEFAULT_CODE)
1102
+ }
1103
+ };
1104
+ }
1105
+ if (use === "ChartBlockModel") {
1106
+ return {
1107
+ stepParams: {
1108
+ chartSettings: {
1109
+ configure: {
1110
+ query: {
1111
+ mode: "builder"
1112
+ },
1113
+ chart: {
1114
+ option: {
1115
+ mode: "basic"
1116
+ }
1117
+ }
1118
+ }
1119
+ }
1120
+ }
1121
+ };
1122
+ }
1123
+ if (use === "CalendarBlockModel") {
1124
+ return {
1125
+ props: {
1126
+ fieldNames: {
1127
+ id: "id"
1128
+ },
1129
+ defaultView: "month",
1130
+ enableQuickCreateEvent: true,
1131
+ weekStart: 1
1132
+ },
1133
+ stepParams: {
1134
+ cardSettings: {
1135
+ blockHeight: {
1136
+ heightMode: "fullHeight"
1137
+ }
1138
+ }
1139
+ }
1140
+ };
1141
+ }
1142
+ if (use === "KanbanBlockModel") {
1143
+ return {
1144
+ stepParams: {
1145
+ cardSettings: {
1146
+ blockHeight: {
1147
+ heightMode: "fullHeight"
1148
+ }
1149
+ }
1150
+ }
1151
+ };
1152
+ }
1153
+ if (use === "TreeBlockModel") {
1154
+ return {
1155
+ props: {
1156
+ searchable: true,
1157
+ defaultExpandAll: false,
1158
+ includeDescendants: true
1159
+ }
1160
+ };
1161
+ }
1162
+ if (use === "TableBlockModel") {
1163
+ return {};
1164
+ }
1165
+ if (use === "DetailsBlockModel") {
1166
+ return {};
1167
+ }
1168
+ if (use === "ListBlockModel") {
1169
+ return {};
1170
+ }
1171
+ if (use === "GridCardBlockModel") {
1172
+ return {};
1173
+ }
1174
+ if (use === "MapBlockModel") {
1175
+ return {};
1176
+ }
1177
+ return {};
1178
+ }
1179
+ function getStandaloneFieldDefaults(use) {
1180
+ switch (use) {
1181
+ case "PopupSubTableFieldModel":
1182
+ return {
1183
+ subModels: {
1184
+ subTableColumns: [
1185
+ {
1186
+ use: "PopupSubTableActionsColumnModel",
1187
+ subModels: {
1188
+ actions: [
1189
+ {
1190
+ use: "PopupSubTableEditActionModel"
1191
+ },
1192
+ {
1193
+ use: "PopupSubTableRemoveActionModel"
1194
+ }
1195
+ ]
1196
+ }
1197
+ }
1198
+ ]
1199
+ }
1200
+ };
1201
+ case "JSFieldModel":
1202
+ return {
1203
+ stepParams: {
1204
+ jsSettings: buildRunJsStepParams(JS_FIELD_DEFAULT_CODE)
1205
+ }
1206
+ };
1207
+ case "JSEditableFieldModel":
1208
+ return {
1209
+ stepParams: {
1210
+ jsSettings: buildRunJsStepParams(JS_EDITABLE_FIELD_DEFAULT_CODE)
1211
+ }
1212
+ };
1213
+ case "JSColumnModel":
1214
+ return {
1215
+ props: {
1216
+ title: '{{t("JS column")}}'
1217
+ },
1218
+ stepParams: {
1219
+ tableColumnSettings: {
1220
+ title: {
1221
+ title: '{{t("JS column")}}'
1222
+ }
1223
+ },
1224
+ jsSettings: buildRunJsStepParams(JS_COLUMN_DEFAULT_CODE)
1225
+ }
1226
+ };
1227
+ case "JSItemModel":
1228
+ return {
1229
+ stepParams: {
1230
+ jsSettings: buildRunJsStepParams(JS_ITEM_DEFAULT_CODE)
1231
+ }
1232
+ };
1233
+ case "DividerItemModel":
1234
+ return {
1235
+ props: {
1236
+ label: '{{t("Divider")}}',
1237
+ orientation: "left"
1238
+ }
1239
+ };
1240
+ default:
1241
+ return {};
1242
+ }
1243
+ }
1244
+ function humanizeActionTitle(use) {
1245
+ const normalized = String(use || "").replace(/ActionModel$/, "").replace(/(Collection|Record|Form|Workbench)$/, "");
1246
+ const title = import_lodash.default.startCase(normalized).replace(/\bJs\b/g, "JS").trim() || "Action";
1247
+ return `{{t(${JSON.stringify(title)})}}`;
1248
+ }
1249
+ // Annotate the CommonJS export names for ESM import in node:
1250
+ 0 && (module.exports = {
1251
+ assignClientKeysToUids,
1252
+ buildActionTree,
1253
+ buildBlockTree,
1254
+ buildCanonicalTableActionsColumnNode,
1255
+ buildFieldTree,
1256
+ buildPersistedRootPageModel,
1257
+ buildPopupPageTree,
1258
+ buildStandaloneFieldNode,
1259
+ buildSyntheticRootPageTabModel,
1260
+ getStandaloneFieldDefaults
1261
+ });