@nocobase/plugin-flow-engine 2.1.0-beta.15 → 2.1.0-beta.16

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