@nocobase/plugin-flow-engine 2.1.0-alpha.2 → 2.1.0-alpha.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (232) 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 +41 -0
  5. package/dist/ai/ai-employees/nathan/prompt.md +132 -0
  6. package/dist/ai/ai-employees/nathan/skills/frontend-developer/SKILLS.md +69 -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 +2 -2
  11. package/dist/ai/docs/runjs/context/block-model.md +35 -35
  12. package/dist/ai/docs/runjs/context/collection-field.md +53 -51
  13. package/dist/ai/docs/runjs/context/collection.md +39 -39
  14. package/dist/ai/docs/runjs/context/data-source-manager.md +40 -30
  15. package/dist/ai/docs/runjs/context/data-source.md +52 -44
  16. package/dist/ai/docs/runjs/context/element.md +44 -38
  17. package/dist/ai/docs/runjs/context/exit-all.md +37 -35
  18. package/dist/ai/docs/runjs/context/exit.md +38 -35
  19. package/dist/ai/docs/runjs/context/filter-manager.md +36 -30
  20. package/dist/ai/docs/runjs/context/form.md +57 -57
  21. package/dist/ai/docs/runjs/context/get-model.md +22 -21
  22. package/dist/ai/docs/runjs/context/get-value.md +20 -19
  23. package/dist/ai/docs/runjs/context/get-var.md +61 -55
  24. package/dist/ai/docs/runjs/context/i18n.md +17 -14
  25. package/dist/ai/docs/runjs/context/import-async.md +333 -45
  26. package/dist/ai/docs/runjs/context/init-resource.md +20 -20
  27. package/dist/ai/docs/runjs/context/libs.md +31 -31
  28. package/dist/ai/docs/runjs/context/location.md +34 -31
  29. package/dist/ai/docs/runjs/context/logger.md +41 -40
  30. package/dist/ai/docs/runjs/context/make-resource.md +27 -26
  31. package/dist/ai/docs/runjs/context/message.md +42 -41
  32. package/dist/ai/docs/runjs/context/modal.md +44 -44
  33. package/dist/ai/docs/runjs/context/model.md +36 -33
  34. package/dist/ai/docs/runjs/context/notification.md +41 -40
  35. package/dist/ai/docs/runjs/context/off.md +14 -14
  36. package/dist/ai/docs/runjs/context/on.md +30 -29
  37. package/dist/ai/docs/runjs/context/open-view.md +40 -40
  38. package/dist/ai/docs/runjs/context/render.md +37 -32
  39. package/dist/ai/docs/runjs/context/request.md +46 -45
  40. package/dist/ai/docs/runjs/context/require-async.md +28 -25
  41. package/dist/ai/docs/runjs/context/resource.md +34 -34
  42. package/dist/ai/docs/runjs/context/route.md +36 -34
  43. package/dist/ai/docs/runjs/context/router.md +43 -31
  44. package/dist/ai/docs/runjs/context/set-value.md +18 -17
  45. package/dist/ai/docs/runjs/context/sql.md +7 -15
  46. package/dist/ai/docs/runjs/context/t.md +20 -17
  47. package/dist/ai/docs/runjs/context/view.md +49 -46
  48. package/dist/ai/docs/runjs/document.md +1 -0
  49. package/dist/ai/docs/runjs/import-modules.md +32 -32
  50. package/dist/ai/docs/runjs/index.md +13 -13
  51. package/dist/ai/docs/runjs/jsx.md +19 -19
  52. package/dist/ai/docs/runjs/model/form-block-model.md +1 -3
  53. package/dist/ai/docs/runjs/render.md +15 -15
  54. package/dist/ai/docs/runjs/resource/api-resource.md +53 -53
  55. package/dist/ai/docs/runjs/resource/multi-record-resource.md +64 -64
  56. package/dist/ai/docs/runjs/resource/single-record-resource.md +55 -55
  57. package/dist/ai/docs/runjs/resource/sql-resource.md +57 -57
  58. package/dist/ai/docs/runjs/window.md +5 -5
  59. package/dist/client/index.js +1 -1
  60. package/dist/externalVersion.js +11 -11
  61. package/dist/locale/en-US.json +1 -0
  62. package/dist/locale/index.d.ts +2 -0
  63. package/dist/locale/zh-CN.json +1 -0
  64. package/dist/node_modules/ses/package.json +1 -1
  65. package/dist/node_modules/zod/package.json +1 -1
  66. package/dist/server/collections/flowsql.js +1 -0
  67. package/dist/server/flow-surfaces/action-scope.d.ts +37 -0
  68. package/dist/server/flow-surfaces/action-scope.js +148 -0
  69. package/dist/server/flow-surfaces/apply/compiler.d.ts +13 -0
  70. package/dist/server/flow-surfaces/apply/compiler.js +969 -0
  71. package/dist/server/flow-surfaces/apply/layout.d.ts +34 -0
  72. package/dist/server/flow-surfaces/apply/layout.js +175 -0
  73. package/dist/server/flow-surfaces/apply/matching.d.ts +16 -0
  74. package/dist/server/flow-surfaces/apply/matching.js +181 -0
  75. package/dist/server/flow-surfaces/approval/blueprint-service.d.ts +84 -0
  76. package/dist/server/flow-surfaces/approval/blueprint-service.js +589 -0
  77. package/dist/server/flow-surfaces/approval/blueprint.d.ts +21 -0
  78. package/dist/server/flow-surfaces/approval/blueprint.js +187 -0
  79. package/dist/server/flow-surfaces/approval/builder.d.ts +225 -0
  80. package/dist/server/flow-surfaces/approval/builder.js +384 -0
  81. package/dist/server/flow-surfaces/approval/catalog-specs.d.ts +33 -0
  82. package/dist/server/flow-surfaces/approval/catalog-specs.js +156 -0
  83. package/dist/server/flow-surfaces/approval/index.d.ts +14 -0
  84. package/dist/server/flow-surfaces/approval/index.js +40 -0
  85. package/dist/server/flow-surfaces/approval/runtime-config.d.ts +44 -0
  86. package/dist/server/flow-surfaces/approval/runtime-config.js +299 -0
  87. package/dist/server/flow-surfaces/approval/semantic-use.d.ts +23 -0
  88. package/dist/server/flow-surfaces/approval/semantic-use.js +155 -0
  89. package/dist/server/flow-surfaces/association-title-field.d.ts +20 -0
  90. package/dist/server/flow-surfaces/association-title-field.js +158 -0
  91. package/dist/server/flow-surfaces/blueprint/compile-blocks.d.ts +14 -0
  92. package/dist/server/flow-surfaces/blueprint/compile-blocks.js +844 -0
  93. package/dist/server/flow-surfaces/blueprint/compile-plan.d.ts +13 -0
  94. package/dist/server/flow-surfaces/blueprint/compile-plan.js +308 -0
  95. package/dist/server/flow-surfaces/blueprint/compile-reaction.d.ts +11 -0
  96. package/dist/server/flow-surfaces/blueprint/compile-reaction.js +72 -0
  97. package/dist/server/flow-surfaces/blueprint/index.d.ts +12 -0
  98. package/dist/server/flow-surfaces/blueprint/index.js +44 -0
  99. package/dist/server/flow-surfaces/blueprint/normalize-document.d.ts +10 -0
  100. package/dist/server/flow-surfaces/blueprint/normalize-document.js +296 -0
  101. package/dist/server/flow-surfaces/blueprint/private-utils.d.ts +26 -0
  102. package/dist/server/flow-surfaces/blueprint/private-utils.js +182 -0
  103. package/dist/server/flow-surfaces/blueprint/public-types.d.ts +161 -0
  104. package/dist/server/flow-surfaces/blueprint/public-types.js +24 -0
  105. package/dist/server/flow-surfaces/builder.d.ts +211 -0
  106. package/dist/server/flow-surfaces/builder.js +931 -0
  107. package/dist/server/flow-surfaces/catalog-smart.d.ts +18 -0
  108. package/dist/server/flow-surfaces/catalog-smart.js +239 -0
  109. package/dist/server/flow-surfaces/catalog-smart.projector.d.ts +15 -0
  110. package/dist/server/flow-surfaces/catalog-smart.projector.js +157 -0
  111. package/dist/server/flow-surfaces/catalog-smart.types.d.ts +99 -0
  112. package/dist/server/flow-surfaces/catalog-smart.types.js +24 -0
  113. package/dist/server/flow-surfaces/catalog.d.ts +78 -0
  114. package/dist/server/flow-surfaces/catalog.js +3254 -0
  115. package/dist/server/flow-surfaces/chart-config.d.ts +121 -0
  116. package/dist/server/flow-surfaces/chart-config.js +1394 -0
  117. package/dist/server/flow-surfaces/compose-compiler.d.ts +106 -0
  118. package/dist/server/flow-surfaces/compose-compiler.js +163 -0
  119. package/dist/server/flow-surfaces/compose-runtime.d.ts +93 -0
  120. package/dist/server/flow-surfaces/compose-runtime.js +375 -0
  121. package/dist/server/flow-surfaces/configure-options.d.ts +23 -0
  122. package/dist/server/flow-surfaces/configure-options.js +751 -0
  123. package/dist/server/flow-surfaces/constants.d.ts +351 -0
  124. package/dist/server/flow-surfaces/constants.js +104 -0
  125. package/dist/server/flow-surfaces/context.d.ts +72 -0
  126. package/dist/server/flow-surfaces/context.js +556 -0
  127. package/dist/server/flow-surfaces/contract-guard.d.ts +19 -0
  128. package/dist/server/flow-surfaces/contract-guard.js +411 -0
  129. package/dist/server/flow-surfaces/default-action-popup.d.ts +53 -0
  130. package/dist/server/flow-surfaces/default-action-popup.js +262 -0
  131. package/dist/server/flow-surfaces/default-block-actions.d.ts +32 -0
  132. package/dist/server/flow-surfaces/default-block-actions.js +178 -0
  133. package/dist/server/flow-surfaces/errors.d.ts +47 -0
  134. package/dist/server/flow-surfaces/errors.js +145 -0
  135. package/dist/server/flow-surfaces/executor.d.ts +23 -0
  136. package/dist/server/flow-surfaces/executor.js +132 -0
  137. package/dist/server/flow-surfaces/field-binding-registry.d.ts +23 -0
  138. package/dist/server/flow-surfaces/field-binding-registry.js +391 -0
  139. package/dist/server/flow-surfaces/field-semantics.d.ts +15 -0
  140. package/dist/server/flow-surfaces/field-semantics.js +81 -0
  141. package/dist/server/flow-surfaces/index.d.ts +11 -0
  142. package/dist/server/flow-surfaces/index.js +175 -0
  143. package/dist/server/flow-surfaces/locator.d.ts +28 -0
  144. package/dist/server/flow-surfaces/locator.js +240 -0
  145. package/dist/server/flow-surfaces/node-use-sets.d.ts +15 -0
  146. package/dist/server/flow-surfaces/node-use-sets.js +126 -0
  147. package/dist/server/flow-surfaces/payload-shape.d.ts +9 -0
  148. package/dist/server/flow-surfaces/payload-shape.js +61 -0
  149. package/dist/server/flow-surfaces/placement.d.ts +33 -0
  150. package/dist/server/flow-surfaces/placement.js +192 -0
  151. package/dist/server/flow-surfaces/planning/action-specs.d.ts +179 -0
  152. package/dist/server/flow-surfaces/planning/action-specs.js +190 -0
  153. package/dist/server/flow-surfaces/planning/compiler.d.ts +37 -0
  154. package/dist/server/flow-surfaces/planning/compiler.js +376 -0
  155. package/dist/server/flow-surfaces/planning/context.d.ts +30 -0
  156. package/dist/server/flow-surfaces/planning/context.js +139 -0
  157. package/dist/server/flow-surfaces/planning/created-keys.d.ts +34 -0
  158. package/dist/server/flow-surfaces/planning/created-keys.js +375 -0
  159. package/dist/server/flow-surfaces/planning/key-kind.d.ts +11 -0
  160. package/dist/server/flow-surfaces/planning/key-kind.js +88 -0
  161. package/dist/server/flow-surfaces/planning/key-persistence.d.ts +34 -0
  162. package/dist/server/flow-surfaces/planning/key-persistence.js +148 -0
  163. package/dist/server/flow-surfaces/planning/key-registry.d.ts +40 -0
  164. package/dist/server/flow-surfaces/planning/key-registry.js +206 -0
  165. package/dist/server/flow-surfaces/planning/runtime.d.ts +37 -0
  166. package/dist/server/flow-surfaces/planning/runtime.js +259 -0
  167. package/dist/server/flow-surfaces/planning/step-link.d.ts +14 -0
  168. package/dist/server/flow-surfaces/planning/step-link.js +104 -0
  169. package/dist/server/flow-surfaces/planning/types.d.ts +55 -0
  170. package/dist/server/flow-surfaces/planning/types.js +24 -0
  171. package/dist/server/flow-surfaces/reaction/errors.d.ts +20 -0
  172. package/dist/server/flow-surfaces/reaction/errors.js +69 -0
  173. package/dist/server/flow-surfaces/reaction/field-value.d.ts +34 -0
  174. package/dist/server/flow-surfaces/reaction/field-value.js +181 -0
  175. package/dist/server/flow-surfaces/reaction/fingerprint.d.ts +16 -0
  176. package/dist/server/flow-surfaces/reaction/fingerprint.js +71 -0
  177. package/dist/server/flow-surfaces/reaction/linkage.d.ts +136 -0
  178. package/dist/server/flow-surfaces/reaction/linkage.js +882 -0
  179. package/dist/server/flow-surfaces/reaction/meta.d.ts +11 -0
  180. package/dist/server/flow-surfaces/reaction/meta.js +451 -0
  181. package/dist/server/flow-surfaces/reaction/registry.d.ts +149 -0
  182. package/dist/server/flow-surfaces/reaction/registry.js +199 -0
  183. package/dist/server/flow-surfaces/reaction/resolver.d.ts +22 -0
  184. package/dist/server/flow-surfaces/reaction/resolver.js +202 -0
  185. package/dist/server/flow-surfaces/reaction/types.d.ts +241 -0
  186. package/dist/server/flow-surfaces/reaction/types.js +24 -0
  187. package/dist/server/flow-surfaces/reaction/utils.d.ts +17 -0
  188. package/dist/server/flow-surfaces/reaction/utils.js +67 -0
  189. package/dist/server/flow-surfaces/reaction/value-expr.d.ts +15 -0
  190. package/dist/server/flow-surfaces/reaction/value-expr.js +209 -0
  191. package/dist/server/flow-surfaces/reference-guards.d.ts +19 -0
  192. package/dist/server/flow-surfaces/reference-guards.js +103 -0
  193. package/dist/server/flow-surfaces/route-sync.d.ts +47 -0
  194. package/dist/server/flow-surfaces/route-sync.js +392 -0
  195. package/dist/server/flow-surfaces/service-helpers.d.ts +42 -0
  196. package/dist/server/flow-surfaces/service-helpers.js +377 -0
  197. package/dist/server/flow-surfaces/service-utils.d.ts +101 -0
  198. package/dist/server/flow-surfaces/service-utils.js +762 -0
  199. package/dist/server/flow-surfaces/service.d.ts +703 -0
  200. package/dist/server/flow-surfaces/service.js +11376 -0
  201. package/dist/server/flow-surfaces/support-matrix.d.ts +28 -0
  202. package/dist/server/flow-surfaces/support-matrix.js +246 -0
  203. package/dist/server/flow-surfaces/surface-context.d.ts +52 -0
  204. package/dist/server/flow-surfaces/surface-context.js +436 -0
  205. package/dist/server/flow-surfaces/template-compatibility.d.ts +42 -0
  206. package/dist/server/flow-surfaces/template-compatibility.js +189 -0
  207. package/dist/server/flow-surfaces/template-service-utils.d.ts +62 -0
  208. package/dist/server/flow-surfaces/template-service-utils.js +281 -0
  209. package/dist/server/flow-surfaces/types.d.ts +287 -0
  210. package/dist/server/flow-surfaces/types.js +24 -0
  211. package/dist/server/index.d.ts +1 -0
  212. package/dist/server/index.js +7 -2
  213. package/dist/server/plugin.d.ts +0 -1
  214. package/dist/server/plugin.js +9 -34
  215. package/dist/server/repository.js +0 -5
  216. package/dist/server/variables/resolve.d.ts +21 -0
  217. package/dist/server/variables/resolve.js +79 -0
  218. package/dist/swagger/flow-surfaces.d.ts +5804 -0
  219. package/dist/swagger/flow-surfaces.examples.d.ts +1427 -0
  220. package/dist/swagger/flow-surfaces.examples.js +1607 -0
  221. package/dist/swagger/flow-surfaces.js +5195 -0
  222. package/dist/swagger/flow-surfaces.template-action-docs.d.ts +62 -0
  223. package/dist/swagger/flow-surfaces.template-action-docs.js +121 -0
  224. package/dist/swagger/flow-surfaces.template-schemas.d.ts +239 -0
  225. package/dist/swagger/flow-surfaces.template-schemas.js +255 -0
  226. package/dist/swagger/index.d.ts +5809 -0
  227. package/dist/swagger/index.js +50 -0
  228. package/package.json +3 -3
  229. /package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextApis.d.ts +0 -0
  230. /package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextEnvs.d.ts +0 -0
  231. /package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextVars.d.ts +0 -0
  232. /package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/lintAndTestJS.d.ts +0 -0
@@ -0,0 +1,931 @@
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
+ });
49
+ module.exports = __toCommonJS(builder_exports);
50
+ var import_utils = require("@nocobase/utils");
51
+ var import_lodash = __toESM(require("lodash"));
52
+ var import_catalog = require("./catalog");
53
+ var import_chart_config = require("./chart-config");
54
+ var import_approval = require("./approval");
55
+ var import_service_utils = require("./service-utils");
56
+ const JS_BLOCK_DEFAULT_CODE = [
57
+ "// Welcome to the JS block",
58
+ "ctx.render(`",
59
+ ` <div style="padding: 24px; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; line-height: 1.6;">`,
60
+ ' <h2 style="color: #1890ff; margin: 0 0 12px 0; font-size: 24px; font-weight: 600;">JS Block</h2>',
61
+ ' <p style="color: #666; margin: 0;">Replace this code with your custom JavaScript to build an interactive block.</p>',
62
+ " </div>",
63
+ "`);"
64
+ ].join("\n");
65
+ const JS_FIELD_DEFAULT_CODE = [
66
+ "function JsReadonlyField() {",
67
+ " const React = ctx.React;",
68
+ " const { prefix, suffix, overflowMode } = ctx.model?.props || {};",
69
+ " const text = String(ctx.value ?? '');",
70
+ " const whiteSpace = overflowMode === 'wrap' ? 'pre-line' : 'nowrap';",
71
+ "",
72
+ " return (",
73
+ " <span style={{ whiteSpace }}>",
74
+ " {prefix}",
75
+ " {text}",
76
+ " {suffix}",
77
+ " </span>",
78
+ " );",
79
+ "}",
80
+ "",
81
+ "ctx.render(<JsReadonlyField />);"
82
+ ].join("\n");
83
+ const JS_EDITABLE_FIELD_DEFAULT_CODE = [
84
+ "// Render an editable antd Input via JSX and keep it in sync with form value.",
85
+ "function JsEditableField() {",
86
+ " const React = ctx.React;",
87
+ " const { Input } = ctx.antd;",
88
+ " const [value, setValue] = React.useState(ctx.getValue?.() ?? '');",
89
+ "",
90
+ " React.useEffect(() => {",
91
+ " const handler = (ev) => setValue(ev?.detail ?? '');",
92
+ " ctx.element?.addEventListener('js-field:value-change', handler);",
93
+ " return () => ctx.element?.removeEventListener('js-field:value-change', handler);",
94
+ " }, []);",
95
+ "",
96
+ " const onChange = (e) => {",
97
+ " const v = e?.target?.value ?? '';",
98
+ " setValue(v);",
99
+ " ctx.setValue?.(v);",
100
+ " };",
101
+ "",
102
+ " return <Input {...ctx.model.props} value={value} onChange={onChange} />;",
103
+ "}",
104
+ "",
105
+ "ctx.render(<JsEditableField />);"
106
+ ].join("\n");
107
+ const JS_ITEM_DEFAULT_CODE = [
108
+ "function JsItem() {",
109
+ " return (",
110
+ ` <div style={{ fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif", lineHeight: 1.6 }}>`,
111
+ " <h3 style={{ color: '#1890ff', margin: '0 0 12px 0', fontSize: 18, fontWeight: 600 }}>JS Item</h3>",
112
+ " <div style={{ color: '#555' }}>This area is rendered by your JavaScript code.</div>",
113
+ " </div>",
114
+ " );",
115
+ "}",
116
+ "",
117
+ "ctx.render(<JsItem />);"
118
+ ].join("\n");
119
+ const JS_COLUMN_DEFAULT_CODE = `ctx.render('<span class="nb-js-column">JS column</span>');`;
120
+ const JS_ACTION_DEFAULT_CODE_BY_USE = {
121
+ JSCollectionActionModel: [
122
+ "const rows = ctx.resource?.getSelectedRows?.() || [];",
123
+ "if (!rows.length) {",
124
+ " ctx.message.warning('Please select data first.');",
125
+ "} else {",
126
+ " ctx.message.success('Selected ' + rows.length + ' row(s).');",
127
+ "}"
128
+ ].join("\n"),
129
+ JSRecordActionModel: [
130
+ "if (!ctx.record) {",
131
+ " ctx.message.error('No record');",
132
+ "} else {",
133
+ " ctx.message.success('Record ID: ' + (ctx.filterByTk ?? ctx.record?.id));",
134
+ "}"
135
+ ].join("\n"),
136
+ JSFormActionModel: [
137
+ "const values = ctx.form?.getFieldsValue?.() || {};",
138
+ "ctx.message.success('Current form values: ' + JSON.stringify(values));"
139
+ ].join("\n"),
140
+ JSItemActionModel: [
141
+ "const values = ctx.form?.getFieldsValue?.() || ctx.formValues || {};",
142
+ "ctx.message.success('Current form values: ' + JSON.stringify(values));"
143
+ ].join("\n"),
144
+ FilterFormJSActionModel: "",
145
+ JSActionModel: "ctx.message.info('Hello JS action.');"
146
+ };
147
+ function buildRunJsStepParams(code) {
148
+ return {
149
+ runJs: {
150
+ version: "v2",
151
+ code
152
+ }
153
+ };
154
+ }
155
+ function buildPersistedRootPageModel(options) {
156
+ const pageUid = options.pageUid || (0, import_utils.uid)();
157
+ const enableTabs = !!options.enableTabs;
158
+ const displayTitle = options.displayTitle !== false;
159
+ return {
160
+ uid: pageUid,
161
+ use: "RootPageModel",
162
+ props: {
163
+ routeId: options.routeId,
164
+ title: options.pageTitle,
165
+ enableTabs,
166
+ displayTitle
167
+ },
168
+ stepParams: {
169
+ pageSettings: {
170
+ general: {
171
+ title: options.pageTitle,
172
+ displayTitle,
173
+ enableTabs,
174
+ documentTitle: options.pageDocumentTitle
175
+ }
176
+ }
177
+ }
178
+ };
179
+ }
180
+ function buildSyntheticRootPageTabModel(options) {
181
+ var _a;
182
+ const stepParams = import_lodash.default.cloneDeep(options.stepParams || {});
183
+ return {
184
+ uid: options.uid,
185
+ use: options.use || "RootPageTabModel",
186
+ props: {
187
+ ...options.props || {},
188
+ route: import_lodash.default.cloneDeep(options.route),
189
+ title: options.title,
190
+ icon: options.icon
191
+ },
192
+ decoratorProps: import_lodash.default.cloneDeep(options.decoratorProps || {}),
193
+ flowRegistry: import_lodash.default.cloneDeep(options.flowRegistry || {}),
194
+ stepParams: {
195
+ ...stepParams,
196
+ pageTabSettings: {
197
+ ...stepParams.pageTabSettings || {},
198
+ tab: {
199
+ ...((_a = stepParams.pageTabSettings) == null ? void 0 : _a.tab) || {},
200
+ title: options.title,
201
+ icon: options.icon,
202
+ documentTitle: options.documentTitle
203
+ }
204
+ }
205
+ },
206
+ ...options.grid ? { subModels: { grid: options.grid } } : {}
207
+ };
208
+ }
209
+ function buildBlockTree(options) {
210
+ const use = (0, import_catalog.resolveSupportedBlockCatalogItem)(
211
+ {
212
+ type: options.type,
213
+ use: options.use,
214
+ containerUse: options.containerUse
215
+ },
216
+ {
217
+ requireCreateSupported: true
218
+ }
219
+ ).use;
220
+ const defaults = buildBlockDefaults(use);
221
+ const approvalBlockDefaults = (0, import_approval.buildApprovalBlockDefaults)(use);
222
+ const baseStepParams = import_lodash.default.merge(
223
+ {},
224
+ import_lodash.default.cloneDeep(defaults.stepParams || {}),
225
+ import_lodash.default.cloneDeep((approvalBlockDefaults == null ? void 0 : approvalBlockDefaults.stepParams) || {}),
226
+ import_lodash.default.cloneDeep(options.stepParams || {})
227
+ );
228
+ const normalizedResourceInit = import_lodash.default.pickBy(import_lodash.default.cloneDeep(options.resourceInit || {}), (value) => !import_lodash.default.isUndefined(value));
229
+ if (use === "ChartBlockModel") {
230
+ import_lodash.default.unset(baseStepParams, "resourceSettings");
231
+ const currentConfigure = import_lodash.default.get(baseStepParams, ["chartSettings", "configure"]) || {};
232
+ const nextConfigure = import_lodash.default.merge(
233
+ {
234
+ query: {
235
+ mode: "builder"
236
+ },
237
+ chart: {
238
+ option: {
239
+ mode: "basic"
240
+ }
241
+ }
242
+ },
243
+ import_lodash.default.cloneDeep(currentConfigure)
244
+ );
245
+ if (Object.keys(normalizedResourceInit).length) {
246
+ import_lodash.default.set(nextConfigure, ["query", "mode"], "builder");
247
+ import_lodash.default.set(
248
+ nextConfigure,
249
+ ["query", "collectionPath"],
250
+ [normalizedResourceInit.dataSourceKey || import_chart_config.CHART_DEFAULT_DATA_SOURCE_KEY, normalizedResourceInit.collectionName]
251
+ );
252
+ import_lodash.default.unset(nextConfigure, ["query", "resource"]);
253
+ }
254
+ import_lodash.default.set(baseStepParams, ["chartSettings", "configure"], nextConfigure);
255
+ } else if (Object.keys(normalizedResourceInit).length) {
256
+ import_lodash.default.set(baseStepParams, ["resourceSettings", "init"], normalizedResourceInit);
257
+ }
258
+ const model = {
259
+ use,
260
+ ...typeof (approvalBlockDefaults == null ? void 0 : approvalBlockDefaults.async) === "boolean" ? { async: approvalBlockDefaults.async } : {},
261
+ props: import_lodash.default.merge(
262
+ {},
263
+ import_lodash.default.cloneDeep(defaults.props || {}),
264
+ import_lodash.default.cloneDeep((approvalBlockDefaults == null ? void 0 : approvalBlockDefaults.props) || {}),
265
+ import_lodash.default.cloneDeep(options.props || {})
266
+ ),
267
+ decoratorProps: import_lodash.default.merge(
268
+ {},
269
+ import_lodash.default.cloneDeep(defaults.decoratorProps || {}),
270
+ import_lodash.default.cloneDeep((approvalBlockDefaults == null ? void 0 : approvalBlockDefaults.decoratorProps) || {}),
271
+ import_lodash.default.cloneDeep(options.decoratorProps || {})
272
+ ),
273
+ stepParams: baseStepParams
274
+ };
275
+ const flowRegistry = import_lodash.default.merge(
276
+ {},
277
+ import_lodash.default.cloneDeep(defaults.flowRegistry || {}),
278
+ import_lodash.default.cloneDeep((approvalBlockDefaults == null ? void 0 : approvalBlockDefaults.flowRegistry) || {}),
279
+ import_lodash.default.cloneDeep(options.flowRegistry || {})
280
+ );
281
+ if (Object.keys(flowRegistry).length) {
282
+ model.flowRegistry = flowRegistry;
283
+ }
284
+ if (approvalBlockDefaults == null ? void 0 : approvalBlockDefaults.subModels) {
285
+ model.subModels = {};
286
+ const gridDefaults = (0, import_service_utils.getSingleNodeSubModel)(approvalBlockDefaults.subModels.grid);
287
+ if (gridDefaults == null ? void 0 : gridDefaults.use) {
288
+ model.subModels.grid = {
289
+ uid: (0, import_utils.uid)(),
290
+ use: gridDefaults.use
291
+ };
292
+ }
293
+ if (Array.isArray(approvalBlockDefaults.subModels.actions) && approvalBlockDefaults.subModels.actions.length) {
294
+ model.subModels.actions = approvalBlockDefaults.subModels.actions.map((action) => ({
295
+ uid: (0, import_utils.uid)(),
296
+ ...buildActionTree({
297
+ use: action.use,
298
+ containerUse: use
299
+ })
300
+ }));
301
+ }
302
+ } else if (use === "TableBlockModel") {
303
+ model.subModels = {
304
+ columns: [buildCanonicalTableActionsColumnNode()]
305
+ };
306
+ } else if (["FormBlockModel", "CreateFormModel", "EditFormModel", "AssignFormModel"].includes(use)) {
307
+ model.subModels = {
308
+ grid: {
309
+ uid: (0, import_utils.uid)(),
310
+ use: use === "AssignFormModel" ? "AssignFormGridModel" : "FormGridModel"
311
+ }
312
+ };
313
+ } else if (use === "DetailsBlockModel") {
314
+ model.subModels = {
315
+ grid: {
316
+ uid: (0, import_utils.uid)(),
317
+ use: "DetailsGridModel"
318
+ }
319
+ };
320
+ } else if (use === "FilterFormBlockModel") {
321
+ model.subModels = {
322
+ grid: {
323
+ uid: (0, import_utils.uid)(),
324
+ use: "FilterFormGridModel"
325
+ }
326
+ };
327
+ } else if (use === "ListBlockModel") {
328
+ model.subModels = {
329
+ item: {
330
+ uid: (0, import_utils.uid)(),
331
+ use: "ListItemModel",
332
+ subModels: {
333
+ grid: {
334
+ uid: (0, import_utils.uid)(),
335
+ use: "DetailsGridModel"
336
+ }
337
+ }
338
+ }
339
+ };
340
+ } else if (use === "GridCardBlockModel") {
341
+ model.subModels = {
342
+ item: {
343
+ uid: (0, import_utils.uid)(),
344
+ use: "GridCardItemModel",
345
+ subModels: {
346
+ grid: {
347
+ uid: (0, import_utils.uid)(),
348
+ use: "DetailsGridModel"
349
+ }
350
+ }
351
+ }
352
+ };
353
+ }
354
+ return assignClientKeysToUids(model, {});
355
+ }
356
+ function buildPopupPageTree(options) {
357
+ const pageUid = options.pageUid || (0, import_utils.uid)();
358
+ const tabUid = options.tabUid || (0, import_utils.uid)();
359
+ const gridUid = options.gridUid || (0, import_utils.uid)();
360
+ const displayTitle = options.displayTitle === true;
361
+ const enableTabs = options.enableTabs !== false;
362
+ const tabTitle = options.tabTitle || "Details";
363
+ return {
364
+ uid: pageUid,
365
+ use: "ChildPageModel",
366
+ props: {
367
+ ...options.pageTitle ? { title: options.pageTitle } : {},
368
+ displayTitle,
369
+ enableTabs
370
+ },
371
+ stepParams: {
372
+ pageSettings: {
373
+ general: {
374
+ ...options.pageTitle ? { title: options.pageTitle } : {},
375
+ displayTitle,
376
+ enableTabs
377
+ }
378
+ }
379
+ },
380
+ subModels: {
381
+ tabs: [
382
+ {
383
+ uid: tabUid,
384
+ use: "ChildPageTabModel",
385
+ props: {
386
+ title: tabTitle
387
+ },
388
+ stepParams: {
389
+ pageTabSettings: {
390
+ tab: {
391
+ title: tabTitle
392
+ }
393
+ }
394
+ },
395
+ subModels: {
396
+ grid: {
397
+ uid: gridUid,
398
+ use: "BlockGridModel"
399
+ }
400
+ }
401
+ }
402
+ ]
403
+ }
404
+ };
405
+ }
406
+ function buildFieldTree(params) {
407
+ const wrapperUid = params.uid || (0, import_utils.uid)();
408
+ const innerUid = params.innerUid || (0, import_utils.uid)();
409
+ const fieldDefaults = getStandaloneFieldDefaults(params.fieldUse);
410
+ const approvalTree = (0, import_approval.buildApprovalFieldTree)({
411
+ ...params,
412
+ uid: wrapperUid,
413
+ innerUid,
414
+ fieldDefaults
415
+ });
416
+ if (approvalTree) {
417
+ return {
418
+ wrapperUid: approvalTree.wrapperUid,
419
+ innerUid: approvalTree.innerUid,
420
+ model: approvalTree.model
421
+ };
422
+ }
423
+ const initPayload = import_lodash.default.pickBy(
424
+ {
425
+ dataSourceKey: params.dataSourceKey,
426
+ collectionName: params.collectionName,
427
+ fieldPath: params.fieldPath,
428
+ ...params.associationPathName ? { associationPathName: params.associationPathName } : {}
429
+ },
430
+ (value) => !import_lodash.default.isUndefined(value)
431
+ );
432
+ const stepParams = {
433
+ fieldSettings: {
434
+ init: initPayload
435
+ }
436
+ };
437
+ if (params.filterFormInit) {
438
+ stepParams.filterFormItemSettings = {
439
+ init: params.filterFormInit
440
+ };
441
+ }
442
+ return {
443
+ wrapperUid,
444
+ innerUid,
445
+ model: {
446
+ uid: wrapperUid,
447
+ use: params.wrapperUse,
448
+ props: import_lodash.default.cloneDeep(params.wrapperProps || {}),
449
+ stepParams,
450
+ subModels: {
451
+ field: {
452
+ uid: innerUid,
453
+ use: params.fieldUse,
454
+ props: import_lodash.default.cloneDeep(params.fieldProps || {}),
455
+ stepParams: import_lodash.default.merge(
456
+ {},
457
+ fieldDefaults.stepParams || {},
458
+ import_lodash.default.cloneDeep({
459
+ fieldSettings: {
460
+ init: initPayload
461
+ }
462
+ })
463
+ )
464
+ }
465
+ }
466
+ }
467
+ };
468
+ }
469
+ function buildStandaloneFieldNode(options) {
470
+ const defaults = getStandaloneFieldDefaults(options.use);
471
+ return {
472
+ uid: options.uid || (0, import_utils.uid)(),
473
+ use: options.use,
474
+ props: import_lodash.default.merge({}, import_lodash.default.cloneDeep(defaults.props || {}), import_lodash.default.cloneDeep(options.props || {})),
475
+ decoratorProps: import_lodash.default.merge({}, import_lodash.default.cloneDeep(defaults.decoratorProps || {}), import_lodash.default.cloneDeep(options.decoratorProps || {})),
476
+ stepParams: import_lodash.default.merge({}, import_lodash.default.cloneDeep(defaults.stepParams || {}), import_lodash.default.cloneDeep(options.stepParams || {}))
477
+ };
478
+ }
479
+ function buildActionTree(options) {
480
+ var _a;
481
+ const catalogItem = (0, import_catalog.resolveSupportedActionCatalogItem)(
482
+ {
483
+ type: options.type,
484
+ use: options.use,
485
+ containerUse: options.containerUse
486
+ },
487
+ {
488
+ requireCreateSupported: true
489
+ }
490
+ );
491
+ const use = catalogItem.use;
492
+ const defaults = buildActionDefaults({
493
+ use,
494
+ catalogItem,
495
+ containerUse: options.containerUse,
496
+ resourceInit: options.resourceInit
497
+ });
498
+ const props = import_lodash.default.merge({}, import_lodash.default.cloneDeep(defaults.props || {}), import_lodash.default.cloneDeep(options.props || {}));
499
+ const stepParams = import_lodash.default.merge({}, import_lodash.default.cloneDeep(defaults.stepParams || {}), import_lodash.default.cloneDeep(options.stepParams || {}));
500
+ if (import_lodash.default.isPlainObject((_a = stepParams == null ? void 0 : stepParams.buttonSettings) == null ? void 0 : _a.general)) {
501
+ stepParams.buttonSettings.general = import_lodash.default.merge({}, stepParams.buttonSettings.general, pickButtonGeneralProps(props));
502
+ }
503
+ return {
504
+ use,
505
+ props,
506
+ decoratorProps: import_lodash.default.merge({}, import_lodash.default.cloneDeep(defaults.decoratorProps || {}), import_lodash.default.cloneDeep(options.decoratorProps || {})),
507
+ stepParams,
508
+ flowRegistry: import_lodash.default.merge({}, import_lodash.default.cloneDeep(defaults.flowRegistry || {}), import_lodash.default.cloneDeep(options.flowRegistry || {})),
509
+ ...defaults.subModels ? { subModels: import_lodash.default.cloneDeep(defaults.subModels) } : {}
510
+ };
511
+ }
512
+ function buildCanonicalTableActionsColumnNode(options = {}) {
513
+ return {
514
+ uid: options.uid || (0, import_utils.uid)(),
515
+ use: "TableActionsColumnModel",
516
+ props: import_lodash.default.cloneDeep(options.props || {}),
517
+ decoratorProps: import_lodash.default.cloneDeep(options.decoratorProps || {}),
518
+ stepParams: import_lodash.default.merge(
519
+ {},
520
+ {
521
+ tableColumnSettings: {
522
+ title: {
523
+ title: '{{t("Actions")}}'
524
+ }
525
+ }
526
+ },
527
+ import_lodash.default.cloneDeep(options.stepParams || {})
528
+ ),
529
+ flowRegistry: import_lodash.default.cloneDeep(options.flowRegistry || {})
530
+ };
531
+ }
532
+ function pickButtonGeneralProps(props) {
533
+ return import_lodash.default.pickBy(
534
+ import_lodash.default.pick(props || {}, ["title", "tooltip", "icon", "type", "danger", "color"]),
535
+ (value) => !import_lodash.default.isUndefined(value)
536
+ );
537
+ }
538
+ function assignClientKeysToUids(spec, clientKeyToUid) {
539
+ const next = import_lodash.default.cloneDeep(spec);
540
+ const walk = (node) => {
541
+ if (!node.uid) {
542
+ node.uid = (0, import_utils.uid)();
543
+ }
544
+ if (node.clientKey) {
545
+ clientKeyToUid[node.clientKey] = node.uid;
546
+ }
547
+ Object.values(node.subModels || {}).forEach((value) => {
548
+ import_lodash.default.castArray(value).forEach((child) => walk(child));
549
+ });
550
+ };
551
+ walk(next);
552
+ return next;
553
+ }
554
+ function buildActionDefaults(options) {
555
+ var _a, _b, _c;
556
+ const approvalDefaults = (0, import_approval.buildApprovalActionDefaults)(options.use);
557
+ const props = import_lodash.default.merge(
558
+ {},
559
+ inferActionDefaultProps(options.use, options.catalogItem.scope),
560
+ (approvalDefaults == null ? void 0 : approvalDefaults.props) || {}
561
+ );
562
+ const normalizedProps = applyContainerActionStyle(props, options.containerUse);
563
+ const stepParams = import_lodash.default.merge({}, import_lodash.default.cloneDeep((approvalDefaults == null ? void 0 : approvalDefaults.stepParams) || {}), {
564
+ buttonSettings: {
565
+ general: pickButtonGeneralProps(normalizedProps)
566
+ }
567
+ });
568
+ const subModels = import_lodash.default.cloneDeep((approvalDefaults == null ? void 0 : approvalDefaults.subModels) || {});
569
+ if (approvalDefaults) {
570
+ return {
571
+ props: normalizedProps,
572
+ stepParams,
573
+ ...Object.keys(subModels).length ? { subModels } : {}
574
+ };
575
+ }
576
+ if ([
577
+ "AddNewActionModel",
578
+ "ViewActionModel",
579
+ "EditActionModel",
580
+ "PopupCollectionActionModel",
581
+ "DuplicateActionModel",
582
+ "AddChildActionModel",
583
+ "MailSendActionModel"
584
+ ].includes(options.use)) {
585
+ const popupSourceId = inferPopupActionSourceId(options.resourceInit);
586
+ stepParams.popupSettings = {
587
+ openView: {
588
+ mode: "drawer",
589
+ size: "medium",
590
+ pageModelClass: "ChildPageModel",
591
+ ...((_a = options.resourceInit) == null ? void 0 : _a.dataSourceKey) ? { dataSourceKey: options.resourceInit.dataSourceKey } : {},
592
+ ...((_b = options.resourceInit) == null ? void 0 : _b.collectionName) ? { collectionName: options.resourceInit.collectionName } : {},
593
+ ...((_c = options.resourceInit) == null ? void 0 : _c.associationName) ? { associationName: options.resourceInit.associationName } : {},
594
+ ...popupSourceId ? { sourceId: popupSourceId } : {}
595
+ }
596
+ };
597
+ }
598
+ if (options.use === "DeleteActionModel" || options.use === "BulkDeleteActionModel") {
599
+ stepParams.deleteSettings = {
600
+ confirm: {
601
+ enable: true,
602
+ title: "Delete record",
603
+ content: "Are you sure you want to delete it?"
604
+ }
605
+ };
606
+ }
607
+ if (options.use === "FormSubmitActionModel") {
608
+ stepParams.submitSettings = {
609
+ confirm: {
610
+ enable: false,
611
+ title: "Submit record",
612
+ content: "Are you sure you want to save it?"
613
+ }
614
+ };
615
+ }
616
+ if (["UpdateRecordActionModel", "BulkUpdateActionModel"].includes(options.use)) {
617
+ stepParams.assignSettings = {
618
+ confirm: {
619
+ enable: false,
620
+ title: options.use === "BulkUpdateActionModel" ? "Perform the Bulk update" : "Perform the Update record",
621
+ content: options.use === "BulkUpdateActionModel" ? "Are you sure you want to perform the Bulk update action?" : "Are you sure you want to perform the Update record action?"
622
+ },
623
+ assignFieldValues: {
624
+ assignedValues: {}
625
+ }
626
+ };
627
+ stepParams.apply = {
628
+ apply: {
629
+ assignedValues: {}
630
+ }
631
+ };
632
+ subModels.assignForm = {
633
+ uid: (0, import_utils.uid)(),
634
+ use: "AssignFormModel",
635
+ stepParams: {
636
+ resourceSettings: {
637
+ init: import_lodash.default.cloneDeep(options.resourceInit || {})
638
+ }
639
+ },
640
+ subModels: {
641
+ grid: {
642
+ uid: (0, import_utils.uid)(),
643
+ use: "AssignFormGridModel"
644
+ }
645
+ }
646
+ };
647
+ }
648
+ if (JS_ACTION_DEFAULT_CODE_BY_USE[options.use] !== void 0) {
649
+ stepParams.clickSettings = buildRunJsStepParams(JS_ACTION_DEFAULT_CODE_BY_USE[options.use]);
650
+ }
651
+ return {
652
+ props: normalizedProps,
653
+ stepParams,
654
+ ...Object.keys(subModels).length ? { subModels } : {}
655
+ };
656
+ }
657
+ function inferPopupActionSourceId(resourceInit) {
658
+ if (!(resourceInit == null ? void 0 : resourceInit.associationName)) {
659
+ return void 0;
660
+ }
661
+ const sourceId = typeof (resourceInit == null ? void 0 : resourceInit.sourceId) === "string" ? resourceInit.sourceId.trim() : resourceInit == null ? void 0 : resourceInit.sourceId;
662
+ if (!sourceId) {
663
+ return void 0;
664
+ }
665
+ if (sourceId === "{{ctx.view.inputArgs.filterByTk}}") {
666
+ return "{{ctx.view.inputArgs.sourceId}}";
667
+ }
668
+ return sourceId;
669
+ }
670
+ function inferActionDefaultProps(use, scope) {
671
+ const map = {
672
+ AddNewActionModel: {
673
+ type: "primary",
674
+ title: "Add new",
675
+ icon: "PlusOutlined"
676
+ },
677
+ ViewActionModel: {
678
+ type: "link",
679
+ title: "View",
680
+ icon: "EyeOutlined"
681
+ },
682
+ EditActionModel: {
683
+ title: "Edit",
684
+ icon: "EditOutlined"
685
+ },
686
+ PopupCollectionActionModel: {
687
+ title: "Popup",
688
+ icon: "ExportOutlined"
689
+ },
690
+ DeleteActionModel: {
691
+ type: "link",
692
+ title: "Delete",
693
+ icon: "DeleteOutlined"
694
+ },
695
+ UpdateRecordActionModel: {
696
+ type: "link",
697
+ title: "Update record",
698
+ icon: "EditOutlined"
699
+ },
700
+ BulkUpdateActionModel: {
701
+ title: "Bulk update",
702
+ icon: "EditOutlined"
703
+ },
704
+ FilterActionModel: {
705
+ title: "Filter",
706
+ icon: "FilterOutlined"
707
+ },
708
+ RefreshActionModel: {
709
+ title: "Refresh",
710
+ icon: "ReloadOutlined"
711
+ },
712
+ ExpandCollapseActionModel: {
713
+ title: "Expand/Collapse",
714
+ icon: "DownOutlined"
715
+ },
716
+ BulkDeleteActionModel: {
717
+ title: "Delete",
718
+ icon: "DeleteOutlined"
719
+ },
720
+ BulkEditActionModel: {
721
+ title: "Bulk edit",
722
+ icon: "EditOutlined"
723
+ },
724
+ ExportActionModel: {
725
+ title: "Export",
726
+ icon: "DownloadOutlined"
727
+ },
728
+ ExportAttachmentActionModel: {
729
+ title: "Export attachments",
730
+ icon: "DownloadOutlined"
731
+ },
732
+ ImportActionModel: {
733
+ title: "Import",
734
+ icon: "UploadOutlined"
735
+ },
736
+ LinkActionModel: {
737
+ type: "link",
738
+ title: "Link"
739
+ },
740
+ UploadActionModel: {
741
+ title: "Upload",
742
+ icon: "UploadOutlined"
743
+ },
744
+ DuplicateActionModel: {
745
+ type: "link",
746
+ title: "Duplicate",
747
+ icon: "CopyOutlined"
748
+ },
749
+ AddChildActionModel: {
750
+ type: "link",
751
+ title: "Add child",
752
+ icon: "PlusOutlined"
753
+ },
754
+ TemplatePrintCollectionActionModel: {
755
+ title: "Template print",
756
+ icon: "PrinterOutlined"
757
+ },
758
+ TemplatePrintRecordActionModel: {
759
+ type: "link",
760
+ title: "Template print",
761
+ icon: "PrinterOutlined"
762
+ },
763
+ CollectionTriggerWorkflowActionModel: {
764
+ title: "Trigger workflow",
765
+ icon: "PlayCircleOutlined"
766
+ },
767
+ RecordTriggerWorkflowActionModel: {
768
+ type: "link",
769
+ title: "Trigger workflow",
770
+ icon: "PlayCircleOutlined"
771
+ },
772
+ FormTriggerWorkflowActionModel: {
773
+ title: "Trigger workflow",
774
+ icon: "PlayCircleOutlined"
775
+ },
776
+ WorkbenchTriggerWorkflowActionModel: {
777
+ title: "Trigger workflow",
778
+ icon: "PlayCircleOutlined"
779
+ },
780
+ MailSendActionModel: {
781
+ title: "Compose email",
782
+ icon: "MailOutlined"
783
+ },
784
+ FormSubmitActionModel: {
785
+ title: "Submit",
786
+ type: "primary",
787
+ htmlType: "submit"
788
+ },
789
+ FilterFormSubmitActionModel: {
790
+ title: "Filter",
791
+ type: "primary"
792
+ },
793
+ FilterFormResetActionModel: {
794
+ title: "Reset"
795
+ },
796
+ FilterFormCollapseActionModel: {
797
+ type: "link",
798
+ title: "Collapse button"
799
+ },
800
+ JSCollectionActionModel: {
801
+ title: "JS action",
802
+ icon: "JavaScriptOutlined"
803
+ },
804
+ JSRecordActionModel: {
805
+ type: "link",
806
+ title: "JS action",
807
+ icon: "JavaScriptOutlined"
808
+ },
809
+ JSFormActionModel: {
810
+ title: "JS action",
811
+ icon: "JavaScriptOutlined"
812
+ },
813
+ JSItemActionModel: {
814
+ title: "JS item",
815
+ icon: "JavaScriptOutlined"
816
+ },
817
+ FilterFormJSActionModel: {
818
+ title: "JS action",
819
+ icon: "JavaScriptOutlined"
820
+ },
821
+ JSActionModel: {
822
+ type: "default",
823
+ title: "JS action",
824
+ icon: "JavaScriptOutlined"
825
+ }
826
+ };
827
+ return import_lodash.default.cloneDeep(
828
+ map[use] || {
829
+ title: humanizeActionTitle(use),
830
+ ...scope === "record" ? { type: "link" } : { type: "default" }
831
+ }
832
+ );
833
+ }
834
+ function applyContainerActionStyle(props, containerUse) {
835
+ if (containerUse === "TableActionsColumnModel") {
836
+ return {
837
+ ...props,
838
+ type: "link",
839
+ icon: null
840
+ };
841
+ }
842
+ if (containerUse === "DetailsBlockModel") {
843
+ return {
844
+ ...props,
845
+ type: "default"
846
+ };
847
+ }
848
+ return props;
849
+ }
850
+ function buildBlockDefaults(use) {
851
+ if (use === "JSBlockModel") {
852
+ return {
853
+ stepParams: {
854
+ jsSettings: buildRunJsStepParams(JS_BLOCK_DEFAULT_CODE)
855
+ }
856
+ };
857
+ }
858
+ if (use === "ChartBlockModel") {
859
+ return {
860
+ stepParams: {
861
+ chartSettings: {
862
+ configure: {
863
+ query: {
864
+ mode: "builder"
865
+ },
866
+ chart: {
867
+ option: {
868
+ mode: "basic"
869
+ }
870
+ }
871
+ }
872
+ }
873
+ }
874
+ };
875
+ }
876
+ return {};
877
+ }
878
+ function getStandaloneFieldDefaults(use) {
879
+ switch (use) {
880
+ case "JSFieldModel":
881
+ return {
882
+ stepParams: {
883
+ jsSettings: buildRunJsStepParams(JS_FIELD_DEFAULT_CODE)
884
+ }
885
+ };
886
+ case "JSEditableFieldModel":
887
+ return {
888
+ stepParams: {
889
+ jsSettings: buildRunJsStepParams(JS_EDITABLE_FIELD_DEFAULT_CODE)
890
+ }
891
+ };
892
+ case "JSColumnModel":
893
+ return {
894
+ props: {
895
+ title: "JS column"
896
+ },
897
+ stepParams: {
898
+ tableColumnSettings: {
899
+ title: {
900
+ title: "JS column"
901
+ }
902
+ },
903
+ jsSettings: buildRunJsStepParams(JS_COLUMN_DEFAULT_CODE)
904
+ }
905
+ };
906
+ case "JSItemModel":
907
+ return {
908
+ stepParams: {
909
+ jsSettings: buildRunJsStepParams(JS_ITEM_DEFAULT_CODE)
910
+ }
911
+ };
912
+ default:
913
+ return {};
914
+ }
915
+ }
916
+ function humanizeActionTitle(use) {
917
+ const normalized = String(use || "").replace(/ActionModel$/, "").replace(/(Collection|Record|Form|Workbench)$/, "");
918
+ return import_lodash.default.startCase(normalized).replace(/\bJs\b/g, "JS").trim() || "Action";
919
+ }
920
+ // Annotate the CommonJS export names for ESM import in node:
921
+ 0 && (module.exports = {
922
+ assignClientKeysToUids,
923
+ buildActionTree,
924
+ buildBlockTree,
925
+ buildCanonicalTableActionsColumnNode,
926
+ buildFieldTree,
927
+ buildPersistedRootPageModel,
928
+ buildPopupPageTree,
929
+ buildStandaloneFieldNode,
930
+ buildSyntheticRootPageTabModel
931
+ });