@nocobase/plugin-flow-engine 2.1.0-alpha.19 → 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.
@@ -8,15 +8,15 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "2.1.0-alpha.19",
11
+ "@nocobase/client": "2.1.0-alpha.20",
12
12
  "lodash": "4.18.1",
13
- "@nocobase/database": "2.1.0-alpha.19",
14
- "@nocobase/data-source-manager": "2.1.0-alpha.19",
15
- "@nocobase/resourcer": "2.1.0-alpha.19",
16
- "@nocobase/utils": "2.1.0-alpha.19",
17
- "@nocobase/cache": "2.1.0-alpha.19",
18
- "@nocobase/plugin-localization": "2.1.0-alpha.19",
19
- "@nocobase/server": "2.1.0-alpha.19",
20
- "@nocobase/actions": "2.1.0-alpha.19",
21
- "@nocobase/ai": "2.1.0-alpha.19"
13
+ "@nocobase/database": "2.1.0-alpha.20",
14
+ "@nocobase/data-source-manager": "2.1.0-alpha.20",
15
+ "@nocobase/resourcer": "2.1.0-alpha.20",
16
+ "@nocobase/utils": "2.1.0-alpha.20",
17
+ "@nocobase/cache": "2.1.0-alpha.20",
18
+ "@nocobase/plugin-localization": "2.1.0-alpha.20",
19
+ "@nocobase/server": "2.1.0-alpha.20",
20
+ "@nocobase/actions": "2.1.0-alpha.20",
21
+ "@nocobase/ai": "2.1.0-alpha.20"
22
22
  };
@@ -1 +1 @@
1
- {"name":"ses","version":"1.14.0","description":"Hardened JavaScript for Fearless Cooperation","keywords":["lockdown","harden","Compartment","assert","security","confinement","isolation","object capabilities","ocaps","secure execution","third-party code","prototype pollution","supply-chain attack","plugin"],"author":"Agoric","license":"Apache-2.0","homepage":"https://github.com/Agoric/SES-shim/tree/master/packages/ses#readme","repository":{"type":"git","url":"git+https://github.com/endojs/endo.git","directory":"packages/ses"},"bugs":{"url":"https://github.com/endojs/endo/issues"},"type":"module","main":"./dist/ses.cjs","module":"./index.js","unpkg":"./dist/ses.umd.js","types":"./types.d.ts","exports":{".":{"import":{"types":"./types.d.ts","xs":"./src-xs/index.js","default":"./index.js"},"require":{"types":"./dist/types.d.cts","default":"./dist/ses.cjs"}},"./lockdown":{"import":{"types":"./types.d.ts","default":"./index.js"},"require":{"types":"./dist/types.d.cts","default":"./dist/ses.cjs"}},"./hermes":{"require":{"types":"./dist/types.d.cts","default":"./dist/ses-hermes.cjs"}},"./tools.js":"./tools.js","./assert-shim.js":"./assert-shim.js","./lockdown-shim.js":{"xs":"./src-xs/lockdown-shim.js","default":"./lockdown-shim.js"},"./compartment-shim.js":{"xs":"./src-xs/compartment-shim.js","default":"./compartment-shim.js"},"./console-shim.js":"./console-shim.js","./package.json":"./package.json"},"scripts":{"build:vanilla":"node scripts/bundle.js","build:hermes":"node scripts/bundle.js hermes","build":"yarn build:vanilla && yarn build:hermes","clean":"rm -rf dist","cover":"c8 ava","demo":"python3 -m http.server","lint":"yarn lint:types && yarn lint:eslint","lint-fix":"eslint --fix .","lint:eslint":"eslint .","lint:types":"tsc","prepare":"npm run clean && npm run build","qt":"ava","test":"tsd && ava","test:hermes":"./scripts/hermes-test.sh","test:xs":"xst dist/ses.umd.js test/_lockdown-safe.js && node scripts/generate-test-xs.js && xst tmp/test-xs.js && rm -rf tmp","postpack":"git clean -fX \"*.d.ts*\" \"*.d.cts*\" \"*.d.mts*\" \"*.tsbuildinfo\""},"dependencies":{"@endo/cache-map":"^1.1.0","@endo/env-options":"^1.1.11","@endo/immutable-arraybuffer":"^1.1.2"},"devDependencies":{"@babel/generator":"^7.26.3","@babel/parser":"~7.26.2","@babel/traverse":"~7.25.9","@babel/types":"~7.26.0","@endo/compartment-mapper":"^1.6.3","@endo/module-source":"^1.3.3","@endo/test262-runner":"^0.1.48","@types/babel__traverse":"^7.20.5","ava":"^6.1.3","babel-eslint":"^10.1.0","c8":"^7.14.0","core-js":"^3.31.0","eslint":"^8.57.1","eslint-config-airbnb-base":"^15.0.0","eslint-config-prettier":"^9.1.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-import":"^2.31.0","hermes-engine-cli":"^0.12.0","prettier":"^3.5.3","terser":"^5.16.6","tsd":"^0.31.2","typescript":"~5.8.3"},"files":["./*.d.ts","./*.js","./*.map","LICENSE*","SECURITY*","dist","lib","src","tools"],"publishConfig":{"access":"public"},"eslintConfig":{"extends":["plugin:@endo/ses"]},"ava":{"files":["test/**/*.test.*"],"timeout":"2m"},"typeCoverage":{"atLeast":81.17},"gitHead":"9815aea9541f241389d2135c6097a7442bdffa17","_lastModified":"2026-04-19T04:12:22.128Z"}
1
+ {"name":"ses","version":"1.14.0","description":"Hardened JavaScript for Fearless Cooperation","keywords":["lockdown","harden","Compartment","assert","security","confinement","isolation","object capabilities","ocaps","secure execution","third-party code","prototype pollution","supply-chain attack","plugin"],"author":"Agoric","license":"Apache-2.0","homepage":"https://github.com/Agoric/SES-shim/tree/master/packages/ses#readme","repository":{"type":"git","url":"git+https://github.com/endojs/endo.git","directory":"packages/ses"},"bugs":{"url":"https://github.com/endojs/endo/issues"},"type":"module","main":"./dist/ses.cjs","module":"./index.js","unpkg":"./dist/ses.umd.js","types":"./types.d.ts","exports":{".":{"import":{"types":"./types.d.ts","xs":"./src-xs/index.js","default":"./index.js"},"require":{"types":"./dist/types.d.cts","default":"./dist/ses.cjs"}},"./lockdown":{"import":{"types":"./types.d.ts","default":"./index.js"},"require":{"types":"./dist/types.d.cts","default":"./dist/ses.cjs"}},"./hermes":{"require":{"types":"./dist/types.d.cts","default":"./dist/ses-hermes.cjs"}},"./tools.js":"./tools.js","./assert-shim.js":"./assert-shim.js","./lockdown-shim.js":{"xs":"./src-xs/lockdown-shim.js","default":"./lockdown-shim.js"},"./compartment-shim.js":{"xs":"./src-xs/compartment-shim.js","default":"./compartment-shim.js"},"./console-shim.js":"./console-shim.js","./package.json":"./package.json"},"scripts":{"build:vanilla":"node scripts/bundle.js","build:hermes":"node scripts/bundle.js hermes","build":"yarn build:vanilla && yarn build:hermes","clean":"rm -rf dist","cover":"c8 ava","demo":"python3 -m http.server","lint":"yarn lint:types && yarn lint:eslint","lint-fix":"eslint --fix .","lint:eslint":"eslint .","lint:types":"tsc","prepare":"npm run clean && npm run build","qt":"ava","test":"tsd && ava","test:hermes":"./scripts/hermes-test.sh","test:xs":"xst dist/ses.umd.js test/_lockdown-safe.js && node scripts/generate-test-xs.js && xst tmp/test-xs.js && rm -rf tmp","postpack":"git clean -fX \"*.d.ts*\" \"*.d.cts*\" \"*.d.mts*\" \"*.tsbuildinfo\""},"dependencies":{"@endo/cache-map":"^1.1.0","@endo/env-options":"^1.1.11","@endo/immutable-arraybuffer":"^1.1.2"},"devDependencies":{"@babel/generator":"^7.26.3","@babel/parser":"~7.26.2","@babel/traverse":"~7.25.9","@babel/types":"~7.26.0","@endo/compartment-mapper":"^1.6.3","@endo/module-source":"^1.3.3","@endo/test262-runner":"^0.1.48","@types/babel__traverse":"^7.20.5","ava":"^6.1.3","babel-eslint":"^10.1.0","c8":"^7.14.0","core-js":"^3.31.0","eslint":"^8.57.1","eslint-config-airbnb-base":"^15.0.0","eslint-config-prettier":"^9.1.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-import":"^2.31.0","hermes-engine-cli":"^0.12.0","prettier":"^3.5.3","terser":"^5.16.6","tsd":"^0.31.2","typescript":"~5.8.3"},"files":["./*.d.ts","./*.js","./*.map","LICENSE*","SECURITY*","dist","lib","src","tools"],"publishConfig":{"access":"public"},"eslintConfig":{"extends":["plugin:@endo/ses"]},"ava":{"files":["test/**/*.test.*"],"timeout":"2m"},"typeCoverage":{"atLeast":81.17},"gitHead":"9815aea9541f241389d2135c6097a7442bdffa17","_lastModified":"2026-04-20T10:43:10.802Z"}
@@ -1 +1 @@
1
- {"name":"zod","version":"4.3.5","type":"module","license":"MIT","author":"Colin McDonnell <zod@colinhacks.com>","description":"TypeScript-first schema declaration and validation library with static type inference","homepage":"https://zod.dev","llms":"https://zod.dev/llms.txt","llmsFull":"https://zod.dev/llms-full.txt","mcpServer":"https://mcp.inkeep.com/zod/mcp","funding":"https://github.com/sponsors/colinhacks","sideEffects":false,"files":["src","**/*.js","**/*.mjs","**/*.cjs","**/*.d.ts","**/*.d.mts","**/*.d.cts","**/package.json"],"keywords":["typescript","schema","validation","type","inference"],"main":"./index.cjs","types":"./index.d.cts","module":"./index.js","zshy":{"exports":{"./package.json":"./package.json",".":"./src/index.ts","./mini":"./src/mini/index.ts","./locales":"./src/locales/index.ts","./v3":"./src/v3/index.ts","./v4":"./src/v4/index.ts","./v4-mini":"./src/v4-mini/index.ts","./v4/mini":"./src/v4/mini/index.ts","./v4/core":"./src/v4/core/index.ts","./v4/locales":"./src/v4/locales/index.ts","./v4/locales/*":"./src/v4/locales/*"},"conditions":{"@zod/source":"src"}},"exports":{"./package.json":"./package.json",".":{"@zod/source":"./src/index.ts","types":"./index.d.cts","import":"./index.js","require":"./index.cjs"},"./mini":{"@zod/source":"./src/mini/index.ts","types":"./mini/index.d.cts","import":"./mini/index.js","require":"./mini/index.cjs"},"./locales":{"@zod/source":"./src/locales/index.ts","types":"./locales/index.d.cts","import":"./locales/index.js","require":"./locales/index.cjs"},"./v3":{"@zod/source":"./src/v3/index.ts","types":"./v3/index.d.cts","import":"./v3/index.js","require":"./v3/index.cjs"},"./v4":{"@zod/source":"./src/v4/index.ts","types":"./v4/index.d.cts","import":"./v4/index.js","require":"./v4/index.cjs"},"./v4-mini":{"@zod/source":"./src/v4-mini/index.ts","types":"./v4-mini/index.d.cts","import":"./v4-mini/index.js","require":"./v4-mini/index.cjs"},"./v4/mini":{"@zod/source":"./src/v4/mini/index.ts","types":"./v4/mini/index.d.cts","import":"./v4/mini/index.js","require":"./v4/mini/index.cjs"},"./v4/core":{"@zod/source":"./src/v4/core/index.ts","types":"./v4/core/index.d.cts","import":"./v4/core/index.js","require":"./v4/core/index.cjs"},"./v4/locales":{"@zod/source":"./src/v4/locales/index.ts","types":"./v4/locales/index.d.cts","import":"./v4/locales/index.js","require":"./v4/locales/index.cjs"},"./v4/locales/*":{"@zod/source":"./src/v4/locales/*","types":"./v4/locales/*","import":"./v4/locales/*","require":"./v4/locales/*"}},"repository":{"type":"git","url":"git+https://github.com/colinhacks/zod.git"},"bugs":{"url":"https://github.com/colinhacks/zod/issues"},"support":{"backing":{"npm-funding":true}},"scripts":{"clean":"git clean -xdf . -e node_modules","build":"zshy --project tsconfig.build.json","postbuild":"tsx ../../scripts/write-stub-package-jsons.ts && pnpm biome check --write .","test:watch":"pnpm vitest","test":"pnpm vitest run","prepublishOnly":"tsx ../../scripts/check-versions.ts"},"_lastModified":"2026-04-19T04:12:23.144Z"}
1
+ {"name":"zod","version":"4.3.5","type":"module","license":"MIT","author":"Colin McDonnell <zod@colinhacks.com>","description":"TypeScript-first schema declaration and validation library with static type inference","homepage":"https://zod.dev","llms":"https://zod.dev/llms.txt","llmsFull":"https://zod.dev/llms-full.txt","mcpServer":"https://mcp.inkeep.com/zod/mcp","funding":"https://github.com/sponsors/colinhacks","sideEffects":false,"files":["src","**/*.js","**/*.mjs","**/*.cjs","**/*.d.ts","**/*.d.mts","**/*.d.cts","**/package.json"],"keywords":["typescript","schema","validation","type","inference"],"main":"./index.cjs","types":"./index.d.cts","module":"./index.js","zshy":{"exports":{"./package.json":"./package.json",".":"./src/index.ts","./mini":"./src/mini/index.ts","./locales":"./src/locales/index.ts","./v3":"./src/v3/index.ts","./v4":"./src/v4/index.ts","./v4-mini":"./src/v4-mini/index.ts","./v4/mini":"./src/v4/mini/index.ts","./v4/core":"./src/v4/core/index.ts","./v4/locales":"./src/v4/locales/index.ts","./v4/locales/*":"./src/v4/locales/*"},"conditions":{"@zod/source":"src"}},"exports":{"./package.json":"./package.json",".":{"@zod/source":"./src/index.ts","types":"./index.d.cts","import":"./index.js","require":"./index.cjs"},"./mini":{"@zod/source":"./src/mini/index.ts","types":"./mini/index.d.cts","import":"./mini/index.js","require":"./mini/index.cjs"},"./locales":{"@zod/source":"./src/locales/index.ts","types":"./locales/index.d.cts","import":"./locales/index.js","require":"./locales/index.cjs"},"./v3":{"@zod/source":"./src/v3/index.ts","types":"./v3/index.d.cts","import":"./v3/index.js","require":"./v3/index.cjs"},"./v4":{"@zod/source":"./src/v4/index.ts","types":"./v4/index.d.cts","import":"./v4/index.js","require":"./v4/index.cjs"},"./v4-mini":{"@zod/source":"./src/v4-mini/index.ts","types":"./v4-mini/index.d.cts","import":"./v4-mini/index.js","require":"./v4-mini/index.cjs"},"./v4/mini":{"@zod/source":"./src/v4/mini/index.ts","types":"./v4/mini/index.d.cts","import":"./v4/mini/index.js","require":"./v4/mini/index.cjs"},"./v4/core":{"@zod/source":"./src/v4/core/index.ts","types":"./v4/core/index.d.cts","import":"./v4/core/index.js","require":"./v4/core/index.cjs"},"./v4/locales":{"@zod/source":"./src/v4/locales/index.ts","types":"./v4/locales/index.d.cts","import":"./v4/locales/index.js","require":"./v4/locales/index.cjs"},"./v4/locales/*":{"@zod/source":"./src/v4/locales/*","types":"./v4/locales/*","import":"./v4/locales/*","require":"./v4/locales/*"}},"repository":{"type":"git","url":"git+https://github.com/colinhacks/zod.git"},"bugs":{"url":"https://github.com/colinhacks/zod/issues"},"support":{"backing":{"npm-funding":true}},"scripts":{"clean":"git clean -xdf . -e node_modules","build":"zshy --project tsconfig.build.json","postbuild":"tsx ../../scripts/write-stub-package-jsons.ts && pnpm biome check --write .","test:watch":"pnpm vitest","test":"pnpm vitest run","prepublishOnly":"tsx ../../scripts/check-versions.ts"},"_lastModified":"2026-04-20T10:43:11.885Z"}
@@ -96,9 +96,6 @@ function normalizeBlocks(input) {
96
96
  if (!import_lodash.default.isPlainObject(block)) {
97
97
  (0, import_errors.throwBadRequest)(`flowSurfaces applyApprovalBlueprint blocks[${index}] must be an object`);
98
98
  }
99
- if (!import_lodash.default.isUndefined(block.template)) {
100
- (0, import_errors.throwBadRequest)(`flowSurfaces applyApprovalBlueprint blocks[${index}] does not accept template`);
101
- }
102
99
  });
103
100
  return normalized;
104
101
  }
@@ -43,6 +43,7 @@ module.exports = __toCommonJS(compile_blocks_exports);
43
43
  var import_lodash = __toESM(require("lodash"));
44
44
  var import_errors = require("../errors");
45
45
  var import_service_utils = require("../service-utils");
46
+ var import_default_block_actions = require("../default-block-actions");
46
47
  var import_private_utils = require("./private-utils");
47
48
  const APPLY_BLUEPRINT_BLOCK_TYPE_ENUM = [
48
49
  "table",
@@ -71,6 +72,7 @@ const APPLY_BLUEPRINT_BLOCK_ALLOWED_KEYS = [
71
72
  "template",
72
73
  "settings",
73
74
  "fields",
75
+ "fieldsLayout",
74
76
  "actions",
75
77
  "recordActions",
76
78
  "script",
@@ -127,6 +129,7 @@ const APPLY_BLUEPRINT_BLOCK_RESOURCE_SHORTHAND_KEYS = [
127
129
  "associationField"
128
130
  ];
129
131
  const APPLY_BLUEPRINT_RECORD_CAPABLE_BLOCK_TYPES = /* @__PURE__ */ new Set(["table", "details", "list", "gridCard"]);
132
+ const APPLY_BLUEPRINT_FIELD_GRID_BLOCK_TYPES = /* @__PURE__ */ new Set(["createForm", "editForm", "details", "filterForm"]);
130
133
  const APPLY_BLUEPRINT_AUTO_PROMOTED_RECORD_ACTION_TYPES = /* @__PURE__ */ new Set([
131
134
  "view",
132
135
  "edit",
@@ -141,6 +144,15 @@ function assertNoBlockLevelLayout(input, context) {
141
144
  (0, import_errors.throwBadRequest)(`${context}.layout is not supported; layout is only allowed on tabs[] and popup`);
142
145
  }
143
146
  }
147
+ function assertApplyBlueprintFieldsLayoutHost(block, context) {
148
+ if (!Object.prototype.hasOwnProperty.call(block, "fieldsLayout")) {
149
+ return;
150
+ }
151
+ if (APPLY_BLUEPRINT_FIELD_GRID_BLOCK_TYPES.has((0, import_private_utils.readOptionalString)(block.type) || "")) {
152
+ return;
153
+ }
154
+ (0, import_errors.throwBadRequest)(`${context}.fieldsLayout is only supported on createForm, editForm, details or filterForm`);
155
+ }
144
156
  function assertApplyBlueprintBlockType(type, context) {
145
157
  if (!type) {
146
158
  return;
@@ -464,6 +476,16 @@ function collectReferencedBlockKeys(layout, context) {
464
476
  return referenced;
465
477
  }
466
478
  function compileLayout(layout, blockKeysByLocalKey, context) {
479
+ return compileScopedLayout(layout, blockKeysByLocalKey, context, "block");
480
+ }
481
+ function resolveScopedLayoutKey(rawKey, keysByLocalKey, context, kind) {
482
+ const resolved = keysByLocalKey.get(rawKey) || [...keysByLocalKey.values()].find((value) => value === rawKey);
483
+ if (!resolved) {
484
+ (0, import_errors.throwBadRequest)(`${context} references unknown ${kind} '${rawKey}'`);
485
+ }
486
+ return resolved;
487
+ }
488
+ function compileScopedLayout(layout, keysByLocalKey, context, kind) {
467
489
  const rows = ensureLayoutRows(layout, context);
468
490
  if (!rows) {
469
491
  return void 0;
@@ -471,24 +493,58 @@ function compileLayout(layout, blockKeysByLocalKey, context) {
471
493
  return {
472
494
  rows: rows.map((row, rowIndex) => {
473
495
  return row.map((item, itemIndex) => {
496
+ const cellContext = `${context}.rows[${rowIndex}][${itemIndex}]`;
474
497
  if (typeof item === "string") {
475
498
  const itemKey = (0, import_private_utils.readString)(item);
476
- const resolved2 = blockKeysByLocalKey.get(itemKey) || [...blockKeysByLocalKey.values()].find((value) => value === itemKey);
477
- if (!resolved2) {
478
- (0, import_errors.throwBadRequest)(`${context}.rows[${rowIndex}][${itemIndex}] references unknown block '${item}'`);
479
- }
480
- return resolved2;
499
+ return resolveScopedLayoutKey(itemKey, keysByLocalKey, cellContext, kind);
481
500
  }
482
- const rawKey = (0, import_private_utils.assertNonEmptyString)(item.key, `${context}.rows[${rowIndex}][${itemIndex}].key`);
483
- const resolved = blockKeysByLocalKey.get(rawKey) || [...blockKeysByLocalKey.values()].find((value) => value === rawKey) || rawKey;
501
+ const rawKey = (0, import_private_utils.assertNonEmptyString)(item.key, `${cellContext}.key`);
502
+ const resolved = resolveScopedLayoutKey(rawKey, keysByLocalKey, cellContext, kind);
484
503
  return (0, import_service_utils.buildDefinedPayload)({
485
504
  key: resolved,
486
- span: import_lodash.default.isUndefined(item.span) ? void 0 : import_lodash.default.isNumber(item.span) ? item.span : (0, import_errors.throwBadRequest)(`${context}.rows[${rowIndex}][${itemIndex}].span must be a number`)
505
+ span: import_lodash.default.isUndefined(item.span) ? void 0 : import_lodash.default.isNumber(item.span) ? item.span : (0, import_errors.throwBadRequest)(`${cellContext}.span must be a number`)
487
506
  });
488
507
  });
489
508
  })
490
509
  };
491
510
  }
511
+ function resolveApplyBlueprintFieldLocalKey(input, index, context) {
512
+ if (typeof input === "string") {
513
+ return (0, import_private_utils.assertNonEmptyString)(input, `${context}[${index}]`);
514
+ }
515
+ if (!import_lodash.default.isPlainObject(input)) {
516
+ (0, import_errors.throwBadRequest)(`${context}[${index}] must be a string or object`);
517
+ }
518
+ const fieldPath = (0, import_private_utils.readOptionalString)(input.field);
519
+ const syntheticType = (0, import_private_utils.readOptionalString)(input.type);
520
+ if (!fieldPath && !syntheticType) {
521
+ (0, import_errors.throwBadRequest)(`${context}[${index}] requires field or type`);
522
+ }
523
+ if (fieldPath && syntheticType) {
524
+ (0, import_errors.throwBadRequest)(`${context}[${index}] cannot mix field with synthetic type`);
525
+ }
526
+ return (0, import_private_utils.normalizeBlueprintLocalKey)(
527
+ input.key,
528
+ fieldPath || (syntheticType ? `${syntheticType}_${index + 1}` : `field_${index + 1}`),
529
+ `${context}[${index}].key`
530
+ );
531
+ }
532
+ function buildCompiledFieldKeyMap(inputs, compiledFields, context) {
533
+ const fieldKeysByLocalKey = /* @__PURE__ */ new Map();
534
+ inputs.forEach((input, index) => {
535
+ var _a;
536
+ const localKey = resolveApplyBlueprintFieldLocalKey(input, index, context);
537
+ const compiledKey = (0, import_private_utils.readOptionalString)((_a = compiledFields[index]) == null ? void 0 : _a.key);
538
+ if (!compiledKey) {
539
+ (0, import_errors.throwBadRequest)(`${context}[${index}] key '${localKey}' is missing after field key compilation`);
540
+ }
541
+ if (fieldKeysByLocalKey.has(localKey)) {
542
+ (0, import_errors.throwBadRequest)(`${context}[${index}] key '${localKey}' is duplicated`);
543
+ }
544
+ fieldKeysByLocalKey.set(localKey, compiledKey);
545
+ });
546
+ return fieldKeysByLocalKey;
547
+ }
492
548
  function compilePopup(popup, scopePrefix, assets, context, options = {}) {
493
549
  if (import_lodash.default.isUndefined(popup)) {
494
550
  return {};
@@ -643,6 +699,16 @@ function compileAction(input, index, scopePrefix, assets, context) {
643
699
  popup: popupResult.popup
644
700
  });
645
701
  }
702
+ function compileInjectedDefaultAction(descriptor, scopePrefix, context, index) {
703
+ return (0, import_service_utils.buildDefinedPayload)({
704
+ key: (0, import_service_utils.normalizeFlowSurfaceComposeKey)(
705
+ (0, import_private_utils.buildScopedKey)(scopePrefix, `${descriptor.type}_default_${index + 1}`),
706
+ `${context}[${index}]`
707
+ ),
708
+ type: descriptor.type,
709
+ popup: descriptor.popup ? import_lodash.default.cloneDeep(descriptor.popup) : void 0
710
+ });
711
+ }
646
712
  function compileBlocks(input, scopePrefix, assets, context, requiredExplicitBlockKeys = /* @__PURE__ */ new Set()) {
647
713
  const blockKeysByLocalKey = /* @__PURE__ */ new Map();
648
714
  const referencedBlockKeys = new Set(requiredExplicitBlockKeys);
@@ -666,6 +732,7 @@ function compileBlocks(input, scopePrefix, assets, context, requiredExplicitBloc
666
732
  (0, import_errors.throwBadRequest)(`${context}[${index}] must be an object`);
667
733
  }
668
734
  assertNoBlockLevelLayout(block, `${context}[${index}]`);
735
+ assertApplyBlueprintFieldsLayoutHost(block, `${context}[${index}]`);
669
736
  (0, import_private_utils.assertOnlyAllowedKeys)(block, `${context}[${index}]`, APPLY_BLUEPRINT_BLOCK_ALLOWED_KEYS);
670
737
  assertApplyBlueprintBlockType((0, import_private_utils.readOptionalString)(block.type), `${context}[${index}]`);
671
738
  const explicitKey = (0, import_private_utils.readString)(block.key);
@@ -698,23 +765,49 @@ function compileBlocks(input, scopePrefix, assets, context, requiredExplicitBloc
698
765
  settings.title = (0, import_private_utils.readOptionalString)(block.title);
699
766
  }
700
767
  const template = ensureOptionalTemplate(block.template, `${blockContext}.template`);
701
- const fields = readOptionalItems(block.fields, `${blockContext}.fields`);
768
+ const fieldInputs = readOptionalItems(block.fields, `${blockContext}.fields`);
769
+ const fields = fieldInputs.map(
770
+ (field, fieldIndex) => compileField(field, fieldIndex, key, assets, blockKeysByLocalKey, `${blockContext}.fields`)
771
+ );
772
+ const fieldsLayout = Object.prototype.hasOwnProperty.call(block, "fieldsLayout") ? compileScopedLayout(
773
+ import_lodash.default.isUndefined(block.fieldsLayout) ? void 0 : import_lodash.default.isPlainObject(block.fieldsLayout) ? block.fieldsLayout : (0, import_errors.throwBadRequest)(`${blockContext}.fieldsLayout must be an object`),
774
+ buildCompiledFieldKeyMap(fieldInputs, fields, `${blockContext}.fields`),
775
+ `${blockContext}.fieldsLayout`,
776
+ "field"
777
+ ) : void 0;
702
778
  const { actions, recordActions } = splitApplyBlueprintBlockActionsByScope(block, blockContext);
779
+ const explicitActions = actions.map(
780
+ (action, actionIndex) => compileAction(action, actionIndex, key, assets, `${blockContext}.actions`)
781
+ );
782
+ const explicitRecordActions = recordActions.map(
783
+ (action, actionIndex) => compileAction(action, actionIndex, key, assets, `${blockContext}.recordActions`)
784
+ );
785
+ const injectedActionIndexes = {
786
+ actions: explicitActions.length,
787
+ recordActions: explicitRecordActions.length
788
+ };
789
+ const mergedActions = (0, import_default_block_actions.mergeFlowSurfaceDefaultBlockActions)({
790
+ blockType: (0, import_private_utils.readOptionalString)(block.type),
791
+ template,
792
+ actions: explicitActions,
793
+ recordActions: explicitRecordActions,
794
+ createAction: (descriptor) => compileInjectedDefaultAction(
795
+ descriptor,
796
+ key,
797
+ `${blockContext}.${descriptor.scope}`,
798
+ injectedActionIndexes[descriptor.scope]++
799
+ )
800
+ });
703
801
  return (0, import_service_utils.buildDefinedPayload)({
704
802
  key,
705
803
  type: (0, import_private_utils.readOptionalString)(block.type),
706
804
  resource: buildBlockResource(block, blockContext),
707
805
  template,
708
806
  settings: Object.keys(settings).length ? settings : void 0,
709
- fields: fields.map(
710
- (field, fieldIndex) => compileField(field, fieldIndex, key, assets, blockKeysByLocalKey, `${blockContext}.fields`)
711
- ),
712
- actions: actions.map(
713
- (action, actionIndex) => compileAction(action, actionIndex, key, assets, `${blockContext}.actions`)
714
- ),
715
- recordActions: recordActions.map(
716
- (action, actionIndex) => compileAction(action, actionIndex, key, assets, `${blockContext}.recordActions`)
717
- )
807
+ fields,
808
+ fieldsLayout,
809
+ actions: mergedActions.actions,
810
+ recordActions: mergedActions.recordActions
718
811
  });
719
812
  });
720
813
  return {
@@ -117,6 +117,7 @@ export type FlowSurfaceApplyBlueprintBlockSpec = {
117
117
  template?: Record<string, any>;
118
118
  settings?: Record<string, any>;
119
119
  fields?: FlowSurfaceApplyBlueprintFieldSpec[];
120
+ fieldsLayout?: FlowSurfaceApplyBlueprintLayout;
120
121
  actions?: FlowSurfaceApplyBlueprintActionSpec[];
121
122
  recordActions?: FlowSurfaceApplyBlueprintActionSpec[];
122
123
  script?: string;
@@ -42,6 +42,7 @@ export type FlowSurfaceComposeNormalizedBlockSpec = {
42
42
  template?: FlowSurfaceComposeObject;
43
43
  settings?: FlowSurfaceComposeObject;
44
44
  fields: FlowSurfaceComposeNormalizedFieldSpec[];
45
+ fieldsLayout?: FlowSurfaceComposeObject;
45
46
  actions: FlowSurfaceComposeNormalizedActionSpec[];
46
47
  recordActions: FlowSurfaceComposeNormalizedActionSpec[];
47
48
  };
@@ -31,6 +31,10 @@ export type FlowSurfaceComposeActionResult = {
31
31
  export type FlowSurfaceComposeRuntimeBlockState = {
32
32
  spec: FlowSurfaceComposeNormalizedBlockSpec;
33
33
  result: FlowSurfaceComposeBlockResult;
34
+ createdFields: Array<{
35
+ spec: FlowSurfaceComposeNormalizedFieldSpec;
36
+ result: FlowSurfaceComposeFieldResult;
37
+ }>;
34
38
  fieldResults: Array<Record<string, unknown>>;
35
39
  actionResults: Array<Record<string, unknown>>;
36
40
  recordActionResults: Array<Record<string, unknown>>;
@@ -77,7 +81,7 @@ export type FlowSurfaceComposeRuntimeDeps = {
77
81
  buildExplicitLayoutPayload?: (input: {
78
82
  layout?: FlowSurfaceComposeObject;
79
83
  createdByKey: Record<string, FlowSurfaceComposeTargetKey & Partial<FlowSurfaceComposeBlockResult>>;
80
- gridUid: string;
84
+ targetUid: string;
81
85
  }) => Promise<Record<string, unknown>> | Record<string, unknown>;
82
86
  buildAppendLayoutPayload?: (input: {
83
87
  gridUid: string;
@@ -40,6 +40,7 @@ async function executeComposeRuntime(plan, deps) {
40
40
  await createBlocks(plan, deps, state);
41
41
  await applyBlockSettings(deps, state);
42
42
  await createFields(plan, deps, state);
43
+ await applyBlockFieldLayouts(deps, state);
43
44
  await createActions(plan, deps, state);
44
45
  await createRecordActions(plan, deps, state);
45
46
  const layoutResult = await applyComposeLayout(plan, deps, state);
@@ -118,6 +119,7 @@ async function createBlocks(plan, deps, state) {
118
119
  state.blocks.push({
119
120
  spec: blockTask.spec,
120
121
  result,
122
+ createdFields: [],
121
123
  fieldResults: [],
122
124
  actionResults: [],
123
125
  recordActionResults: []
@@ -181,12 +183,44 @@ async function createFields(plan, deps, state) {
181
183
  if (!createdField) {
182
184
  continue;
183
185
  }
186
+ block.createdFields.push({
187
+ spec: fieldTask.spec,
188
+ result: createdField
189
+ });
184
190
  if (deps.applyFieldSettings && hasInlineSettings(fieldTask.spec.settings)) {
185
191
  await deps.applyFieldSettings("compose field", createdField, fieldTask.spec.settings);
186
192
  }
187
193
  block.fieldResults.push(buildFieldResultSummary(fieldTask.spec, createdField));
188
194
  }
189
195
  }
196
+ async function applyBlockFieldLayouts(deps, state) {
197
+ const buildExplicitLayoutPayload = deps.buildExplicitLayoutPayload;
198
+ const setLayout = deps.setLayout;
199
+ for (const block of state.blocks) {
200
+ if (!hasInlineSettings(block.spec.fieldsLayout)) {
201
+ continue;
202
+ }
203
+ requireComposeRuntimeDep("buildExplicitLayoutPayload", buildExplicitLayoutPayload, "field layout");
204
+ requireComposeRuntimeDep("setLayout", setLayout, "field layout");
205
+ const createdByKey = Object.fromEntries(
206
+ block.createdFields.flatMap(({ spec, result }) => {
207
+ const uid = resolveComposeFieldLayoutUid(result);
208
+ return uid ? [[spec.key, { uid }]] : [];
209
+ })
210
+ );
211
+ const layoutPayload = await buildExplicitLayoutPayload({
212
+ layout: block.spec.fieldsLayout,
213
+ createdByKey,
214
+ targetUid: block.result.uid
215
+ });
216
+ await setLayout({
217
+ target: {
218
+ uid: block.result.uid
219
+ },
220
+ ...layoutPayload
221
+ });
222
+ }
223
+ }
190
224
  async function createActions(plan, deps, state) {
191
225
  for (const actionTask of plan.actions) {
192
226
  const block = requireBlockState(actionTask.blockKey, state);
@@ -252,7 +286,7 @@ async function applyComposeLayout(plan, deps, state) {
252
286
  const layoutPayload2 = await buildExplicitLayoutPayload({
253
287
  layout: plan.layoutPlan.layout,
254
288
  createdByKey: state.keyMap,
255
- gridUid: plan.gridUid
289
+ targetUid: plan.gridUid
256
290
  });
257
291
  return setLayout2({
258
292
  target: {
@@ -316,6 +350,9 @@ function buildActionResultSummary(spec, createdAction, actionKeys) {
316
350
  function hasInlineSettings(value) {
317
351
  return !!value && Object.keys(value).length > 0;
318
352
  }
353
+ function resolveComposeFieldLayoutUid(result) {
354
+ return result.wrapperUid || result.uid;
355
+ }
319
356
  function hasPopupAfterEffect(value) {
320
357
  return typeof value !== "undefined";
321
358
  }
@@ -443,6 +443,11 @@ const ACTION_ASSIGN_OPTIONS = {
443
443
  assignValues: objectOption("Bulk or single-record assigned values", { example: { status: "published" } }),
444
444
  updateMode: stringOption("Update mode", { example: "overwrite" })
445
445
  };
446
+ const APPROVAL_ASSIGN_ACTION_OPTIONS = {
447
+ assignValues: objectOption("Assigned values persisted with the approval action payload", {
448
+ example: { department: "finance" }
449
+ })
450
+ };
446
451
  const ACTION_LINKAGE_OPTIONS = {
447
452
  linkageRules: arrayOption(
448
453
  "Raw linkage-rules payload. For AI/CLI authoring, prefer `getReactionMeta` + `setActionLinkageRules` instead of guessing this configure key directly.",
@@ -461,6 +466,11 @@ const APPROVAL_RETURN_ACTION_OPTIONS = {
461
466
  }
462
467
  })
463
468
  };
469
+ const APPROVAL_COMMENT_ACTION_OPTIONS = {
470
+ commentFormUid: stringOption("Comment form model uid", {
471
+ example: "comment-form-uid"
472
+ })
473
+ };
464
474
  const APPROVAL_REASSIGN_ACTION_OPTIONS = {
465
475
  assigneesScope: objectOption("Approval reassignee scope", {
466
476
  example: {
@@ -569,11 +579,6 @@ function getActionConfigureOptionsByUse(use) {
569
579
  case "ExportActionModel":
570
580
  case "ExportAttachmentActionModel":
571
581
  case "ImportActionModel":
572
- case "ApplyFormSubmitModel":
573
- case "ApplyFormSaveDraftModel":
574
- case "ApplyFormWithdrawModel":
575
- case "ProcessFormApproveModel":
576
- case "ProcessFormRejectModel":
577
582
  case "TemplatePrintCollectionActionModel":
578
583
  case "TemplatePrintRecordActionModel":
579
584
  case "CollectionTriggerWorkflowActionModel":
@@ -586,8 +591,16 @@ function getActionConfigureOptionsByUse(use) {
586
591
  case "FilterFormSubmitActionModel":
587
592
  case "FilterFormResetActionModel":
588
593
  return merged(ACTION_LINKAGE_OPTIONS);
594
+ case "ApplyFormSubmitModel":
595
+ case "ApplyFormSaveDraftModel":
596
+ return merged(ACTION_CONFIRM_OPTIONS, APPROVAL_ASSIGN_ACTION_OPTIONS, ACTION_LINKAGE_OPTIONS);
597
+ case "ApplyFormWithdrawModel":
598
+ return merged(ACTION_CONFIRM_OPTIONS, ACTION_LINKAGE_OPTIONS);
599
+ case "ProcessFormApproveModel":
600
+ case "ProcessFormRejectModel":
601
+ return merged(APPROVAL_COMMENT_ACTION_OPTIONS, ACTION_LINKAGE_OPTIONS);
589
602
  case "ProcessFormReturnModel":
590
- return merged(ACTION_LINKAGE_OPTIONS, APPROVAL_RETURN_ACTION_OPTIONS);
603
+ return merged(APPROVAL_COMMENT_ACTION_OPTIONS, ACTION_LINKAGE_OPTIONS, APPROVAL_RETURN_ACTION_OPTIONS);
591
604
  case "ProcessFormDelegateModel":
592
605
  case "ProcessFormAddAssigneeModel":
593
606
  return merged(ACTION_LINKAGE_OPTIONS, APPROVAL_REASSIGN_ACTION_OPTIONS);
@@ -81,8 +81,8 @@ const FLOW_SURFACE_DEFAULT_ACTION_POPUP_CONFIGS = [
81
81
  key: "defaultSubmit",
82
82
  type: "submit",
83
83
  settings: {
84
- title: "Save",
85
- type: "",
84
+ title: "Submit",
85
+ type: "primary",
86
86
  confirm: false
87
87
  }
88
88
  }
@@ -128,8 +128,8 @@ const FLOW_SURFACE_DEFAULT_ACTION_POPUP_CONFIGS = [
128
128
  key: "defaultSubmit",
129
129
  type: "submit",
130
130
  settings: {
131
- title: "Save Changes",
132
- type: "",
131
+ title: "Submit",
132
+ type: "primary",
133
133
  confirm: false
134
134
  }
135
135
  }
@@ -0,0 +1,32 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ export declare const FLOW_SURFACE_INTERNAL_AUTO_SAVE_DEFAULT_POPUP_TEMPLATE_KEY = "__flowSurfaceAutoSaveDefaultPopupTemplate";
10
+ export type FlowSurfaceDefaultBlockActionScope = 'actions' | 'recordActions';
11
+ export type FlowSurfaceDefaultBlockActionDescriptor = {
12
+ type: string;
13
+ scope: FlowSurfaceDefaultBlockActionScope;
14
+ popup?: Record<string, any>;
15
+ };
16
+ export declare function getFlowSurfaceDefaultBlockActions(input: {
17
+ blockType?: string;
18
+ template?: unknown;
19
+ }): FlowSurfaceDefaultBlockActionDescriptor[];
20
+ export declare function mergeFlowSurfaceDefaultBlockActions<T extends {
21
+ type?: string;
22
+ popup?: Record<string, any>;
23
+ }>(input: {
24
+ blockType?: string;
25
+ template?: unknown;
26
+ actions?: T[];
27
+ recordActions?: T[];
28
+ createAction: (descriptor: FlowSurfaceDefaultBlockActionDescriptor) => T;
29
+ }): {
30
+ actions: T[];
31
+ recordActions: T[];
32
+ };