@nocobase/plugin-flow-engine 2.1.0-beta.2 → 2.1.0-beta.21
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.
- package/LICENSE +201 -661
- package/README.md +79 -9
- package/dist/ai/ai-employees/nathan/index.d.ts +10 -0
- package/dist/ai/ai-employees/nathan/index.js +41 -0
- package/dist/ai/ai-employees/nathan/prompt.md +132 -0
- package/dist/ai/ai-employees/nathan/skills/frontend-developer/SKILLS.md +69 -0
- package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextApis.js +2 -2
- package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextEnvs.js +2 -2
- package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextVars.js +2 -2
- package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/lintAndTestJS.js +2 -2
- package/dist/ai/docs/runjs/context/block-model.md +35 -35
- package/dist/ai/docs/runjs/context/collection-field.md +53 -51
- package/dist/ai/docs/runjs/context/collection.md +39 -39
- package/dist/ai/docs/runjs/context/data-source-manager.md +40 -30
- package/dist/ai/docs/runjs/context/data-source.md +52 -44
- package/dist/ai/docs/runjs/context/element.md +44 -38
- package/dist/ai/docs/runjs/context/exit-all.md +37 -35
- package/dist/ai/docs/runjs/context/exit.md +38 -35
- package/dist/ai/docs/runjs/context/filter-manager.md +36 -30
- package/dist/ai/docs/runjs/context/form.md +57 -57
- package/dist/ai/docs/runjs/context/get-model.md +22 -21
- package/dist/ai/docs/runjs/context/get-value.md +20 -19
- package/dist/ai/docs/runjs/context/get-var.md +61 -55
- package/dist/ai/docs/runjs/context/i18n.md +17 -14
- package/dist/ai/docs/runjs/context/import-async.md +333 -45
- package/dist/ai/docs/runjs/context/init-resource.md +20 -20
- package/dist/ai/docs/runjs/context/libs.md +31 -31
- package/dist/ai/docs/runjs/context/location.md +34 -31
- package/dist/ai/docs/runjs/context/logger.md +41 -40
- package/dist/ai/docs/runjs/context/make-resource.md +27 -26
- package/dist/ai/docs/runjs/context/message.md +42 -41
- package/dist/ai/docs/runjs/context/modal.md +44 -44
- package/dist/ai/docs/runjs/context/model.md +36 -33
- package/dist/ai/docs/runjs/context/notification.md +41 -40
- package/dist/ai/docs/runjs/context/off.md +14 -14
- package/dist/ai/docs/runjs/context/on.md +30 -29
- package/dist/ai/docs/runjs/context/open-view.md +40 -40
- package/dist/ai/docs/runjs/context/render.md +37 -32
- package/dist/ai/docs/runjs/context/request.md +46 -45
- package/dist/ai/docs/runjs/context/require-async.md +28 -25
- package/dist/ai/docs/runjs/context/resource.md +34 -34
- package/dist/ai/docs/runjs/context/route.md +36 -34
- package/dist/ai/docs/runjs/context/router.md +43 -31
- package/dist/ai/docs/runjs/context/set-value.md +18 -17
- package/dist/ai/docs/runjs/context/sql.md +7 -15
- package/dist/ai/docs/runjs/context/t.md +20 -17
- package/dist/ai/docs/runjs/context/view.md +49 -46
- package/dist/ai/docs/runjs/document.md +1 -0
- package/dist/ai/docs/runjs/import-modules.md +32 -32
- package/dist/ai/docs/runjs/index.md +13 -13
- package/dist/ai/docs/runjs/jsx.md +19 -19
- package/dist/ai/docs/runjs/model/form-block-model.md +1 -3
- package/dist/ai/docs/runjs/render.md +15 -15
- package/dist/ai/docs/runjs/resource/api-resource.md +53 -53
- package/dist/ai/docs/runjs/resource/multi-record-resource.md +64 -64
- package/dist/ai/docs/runjs/resource/single-record-resource.md +55 -55
- package/dist/ai/docs/runjs/resource/sql-resource.md +57 -57
- package/dist/ai/docs/runjs/window.md +5 -5
- package/dist/client/index.js +1 -1
- package/dist/externalVersion.js +12 -11
- package/dist/locale/en-US.json +1 -0
- package/dist/locale/index.d.ts +2 -0
- package/dist/locale/zh-CN.json +1 -0
- package/dist/node_modules/ses/dist/ses.cjs +1 -1
- package/dist/node_modules/ses/package.json +1 -1
- package/dist/node_modules/zod/index.cjs +1 -1
- package/dist/node_modules/zod/package.json +1 -1
- package/dist/server/collections/flowsql.js +1 -0
- package/dist/server/flow-surfaces/action-scope.d.ts +39 -0
- package/dist/server/flow-surfaces/action-scope.js +156 -0
- package/dist/server/flow-surfaces/apply/compiler.d.ts +13 -0
- package/dist/server/flow-surfaces/apply/compiler.js +971 -0
- package/dist/server/flow-surfaces/apply/layout.d.ts +34 -0
- package/dist/server/flow-surfaces/apply/layout.js +175 -0
- package/dist/server/flow-surfaces/apply/matching.d.ts +16 -0
- package/dist/server/flow-surfaces/apply/matching.js +181 -0
- package/dist/server/flow-surfaces/approval/blueprint-service.d.ts +84 -0
- package/dist/server/flow-surfaces/approval/blueprint-service.js +589 -0
- package/dist/server/flow-surfaces/approval/blueprint.d.ts +21 -0
- package/dist/server/flow-surfaces/approval/blueprint.js +187 -0
- package/dist/server/flow-surfaces/approval/builder.d.ts +225 -0
- package/dist/server/flow-surfaces/approval/builder.js +384 -0
- package/dist/server/flow-surfaces/approval/catalog-specs.d.ts +33 -0
- package/dist/server/flow-surfaces/approval/catalog-specs.js +156 -0
- package/dist/server/flow-surfaces/approval/index.d.ts +14 -0
- package/dist/server/flow-surfaces/approval/index.js +40 -0
- package/dist/server/flow-surfaces/approval/runtime-config.d.ts +44 -0
- package/dist/server/flow-surfaces/approval/runtime-config.js +299 -0
- package/dist/server/flow-surfaces/approval/semantic-use.d.ts +23 -0
- package/dist/server/flow-surfaces/approval/semantic-use.js +155 -0
- package/dist/server/flow-surfaces/association-interfaces.d.ts +10 -0
- package/dist/server/flow-surfaces/association-interfaces.js +39 -0
- package/dist/server/flow-surfaces/association-title-field.d.ts +20 -0
- package/dist/server/flow-surfaces/association-title-field.js +192 -0
- package/dist/server/flow-surfaces/blueprint/compile-blocks.d.ts +14 -0
- package/dist/server/flow-surfaces/blueprint/compile-blocks.js +1074 -0
- package/dist/server/flow-surfaces/blueprint/compile-plan.d.ts +13 -0
- package/dist/server/flow-surfaces/blueprint/compile-plan.js +308 -0
- package/dist/server/flow-surfaces/blueprint/compile-reaction.d.ts +11 -0
- package/dist/server/flow-surfaces/blueprint/compile-reaction.js +72 -0
- package/dist/server/flow-surfaces/blueprint/defaults.d.ts +26 -0
- package/dist/server/flow-surfaces/blueprint/defaults.js +133 -0
- package/dist/server/flow-surfaces/blueprint/index.d.ts +12 -0
- package/dist/server/flow-surfaces/blueprint/index.js +44 -0
- package/dist/server/flow-surfaces/blueprint/normalize-document.d.ts +10 -0
- package/dist/server/flow-surfaces/blueprint/normalize-document.js +416 -0
- package/dist/server/flow-surfaces/blueprint/private-utils.d.ts +26 -0
- package/dist/server/flow-surfaces/blueprint/private-utils.js +182 -0
- package/dist/server/flow-surfaces/blueprint/public-types.d.ts +201 -0
- package/dist/server/flow-surfaces/blueprint/public-types.js +24 -0
- package/dist/server/flow-surfaces/builder.d.ts +237 -0
- package/dist/server/flow-surfaces/builder.js +1129 -0
- package/dist/server/flow-surfaces/catalog-smart.d.ts +18 -0
- package/dist/server/flow-surfaces/catalog-smart.js +239 -0
- package/dist/server/flow-surfaces/catalog-smart.projector.d.ts +15 -0
- package/dist/server/flow-surfaces/catalog-smart.projector.js +157 -0
- package/dist/server/flow-surfaces/catalog-smart.types.d.ts +99 -0
- package/dist/server/flow-surfaces/catalog-smart.types.js +24 -0
- package/dist/server/flow-surfaces/catalog.d.ts +79 -0
- package/dist/server/flow-surfaces/catalog.js +3693 -0
- package/dist/server/flow-surfaces/chart-config.d.ts +121 -0
- package/dist/server/flow-surfaces/chart-config.js +1394 -0
- package/dist/server/flow-surfaces/compose-compiler.d.ts +116 -0
- package/dist/server/flow-surfaces/compose-compiler.js +175 -0
- package/dist/server/flow-surfaces/compose-runtime.d.ts +93 -0
- package/dist/server/flow-surfaces/compose-runtime.js +375 -0
- package/dist/server/flow-surfaces/configure-options.d.ts +23 -0
- package/dist/server/flow-surfaces/configure-options.js +893 -0
- package/dist/server/flow-surfaces/constants.d.ts +351 -0
- package/dist/server/flow-surfaces/constants.js +104 -0
- package/dist/server/flow-surfaces/context.d.ts +72 -0
- package/dist/server/flow-surfaces/context.js +556 -0
- package/dist/server/flow-surfaces/contract-guard.d.ts +19 -0
- package/dist/server/flow-surfaces/contract-guard.js +402 -0
- package/dist/server/flow-surfaces/core-field-default-bindings.d.ts +12 -0
- package/dist/server/flow-surfaces/core-field-default-bindings.js +157 -0
- package/dist/server/flow-surfaces/default-action-popup.d.ts +63 -0
- package/dist/server/flow-surfaces/default-action-popup.js +322 -0
- package/dist/server/flow-surfaces/default-block-actions.d.ts +32 -0
- package/dist/server/flow-surfaces/default-block-actions.js +209 -0
- package/dist/server/flow-surfaces/errors.d.ts +47 -0
- package/dist/server/flow-surfaces/errors.js +145 -0
- package/dist/server/flow-surfaces/executor.d.ts +23 -0
- package/dist/server/flow-surfaces/executor.js +132 -0
- package/dist/server/flow-surfaces/field-binding-registry.d.ts +24 -0
- package/dist/server/flow-surfaces/field-binding-registry.js +396 -0
- package/dist/server/flow-surfaces/field-semantics.d.ts +15 -0
- package/dist/server/flow-surfaces/field-semantics.js +84 -0
- package/dist/server/flow-surfaces/field-type-resolver.d.ts +46 -0
- package/dist/server/flow-surfaces/field-type-resolver.js +322 -0
- package/dist/server/flow-surfaces/filter-group.d.ts +15 -0
- package/dist/server/flow-surfaces/filter-group.js +94 -0
- package/dist/server/flow-surfaces/index.d.ts +11 -0
- package/dist/server/flow-surfaces/index.js +302 -0
- package/dist/server/flow-surfaces/locator.d.ts +28 -0
- package/dist/server/flow-surfaces/locator.js +240 -0
- package/dist/server/flow-surfaces/node-use-sets.d.ts +15 -0
- package/dist/server/flow-surfaces/node-use-sets.js +135 -0
- package/dist/server/flow-surfaces/payload-shape.d.ts +9 -0
- package/dist/server/flow-surfaces/payload-shape.js +61 -0
- package/dist/server/flow-surfaces/placement.d.ts +33 -0
- package/dist/server/flow-surfaces/placement.js +198 -0
- package/dist/server/flow-surfaces/planning/action-specs.d.ts +179 -0
- package/dist/server/flow-surfaces/planning/action-specs.js +190 -0
- package/dist/server/flow-surfaces/planning/compiler.d.ts +37 -0
- package/dist/server/flow-surfaces/planning/compiler.js +376 -0
- package/dist/server/flow-surfaces/planning/context.d.ts +30 -0
- package/dist/server/flow-surfaces/planning/context.js +139 -0
- package/dist/server/flow-surfaces/planning/created-keys.d.ts +34 -0
- package/dist/server/flow-surfaces/planning/created-keys.js +375 -0
- package/dist/server/flow-surfaces/planning/key-kind.d.ts +11 -0
- package/dist/server/flow-surfaces/planning/key-kind.js +88 -0
- package/dist/server/flow-surfaces/planning/key-persistence.d.ts +34 -0
- package/dist/server/flow-surfaces/planning/key-persistence.js +148 -0
- package/dist/server/flow-surfaces/planning/key-registry.d.ts +40 -0
- package/dist/server/flow-surfaces/planning/key-registry.js +206 -0
- package/dist/server/flow-surfaces/planning/runtime.d.ts +37 -0
- package/dist/server/flow-surfaces/planning/runtime.js +259 -0
- package/dist/server/flow-surfaces/planning/step-link.d.ts +14 -0
- package/dist/server/flow-surfaces/planning/step-link.js +104 -0
- package/dist/server/flow-surfaces/planning/types.d.ts +55 -0
- package/dist/server/flow-surfaces/planning/types.js +24 -0
- package/dist/server/flow-surfaces/public-data-surface-default-filter.d.ts +24 -0
- package/dist/server/flow-surfaces/public-data-surface-default-filter.js +152 -0
- package/dist/server/flow-surfaces/reaction/errors.d.ts +20 -0
- package/dist/server/flow-surfaces/reaction/errors.js +69 -0
- package/dist/server/flow-surfaces/reaction/field-value.d.ts +34 -0
- package/dist/server/flow-surfaces/reaction/field-value.js +181 -0
- package/dist/server/flow-surfaces/reaction/fingerprint.d.ts +16 -0
- package/dist/server/flow-surfaces/reaction/fingerprint.js +71 -0
- package/dist/server/flow-surfaces/reaction/linkage.d.ts +136 -0
- package/dist/server/flow-surfaces/reaction/linkage.js +882 -0
- package/dist/server/flow-surfaces/reaction/meta.d.ts +11 -0
- package/dist/server/flow-surfaces/reaction/meta.js +451 -0
- package/dist/server/flow-surfaces/reaction/registry.d.ts +156 -0
- package/dist/server/flow-surfaces/reaction/registry.js +206 -0
- package/dist/server/flow-surfaces/reaction/resolver.d.ts +22 -0
- package/dist/server/flow-surfaces/reaction/resolver.js +202 -0
- package/dist/server/flow-surfaces/reaction/types.d.ts +241 -0
- package/dist/server/flow-surfaces/reaction/types.js +24 -0
- package/dist/server/flow-surfaces/reaction/utils.d.ts +17 -0
- package/dist/server/flow-surfaces/reaction/utils.js +67 -0
- package/dist/server/flow-surfaces/reaction/value-expr.d.ts +15 -0
- package/dist/server/flow-surfaces/reaction/value-expr.js +209 -0
- package/dist/server/flow-surfaces/reference-guards.d.ts +19 -0
- package/dist/server/flow-surfaces/reference-guards.js +103 -0
- package/dist/server/flow-surfaces/route-sync.d.ts +47 -0
- package/dist/server/flow-surfaces/route-sync.js +392 -0
- package/dist/server/flow-surfaces/service-helpers.d.ts +42 -0
- package/dist/server/flow-surfaces/service-helpers.js +310 -0
- package/dist/server/flow-surfaces/service-utils.d.ts +120 -0
- package/dist/server/flow-surfaces/service-utils.js +863 -0
- package/dist/server/flow-surfaces/service.d.ts +830 -0
- package/dist/server/flow-surfaces/service.js +15043 -0
- package/dist/server/flow-surfaces/support-matrix.d.ts +31 -0
- package/dist/server/flow-surfaces/support-matrix.js +282 -0
- package/dist/server/flow-surfaces/surface-context.d.ts +52 -0
- package/dist/server/flow-surfaces/surface-context.js +440 -0
- package/dist/server/flow-surfaces/template-compatibility.d.ts +42 -0
- package/dist/server/flow-surfaces/template-compatibility.js +189 -0
- package/dist/server/flow-surfaces/template-display.d.ts +20 -0
- package/dist/server/flow-surfaces/template-display.js +289 -0
- package/dist/server/flow-surfaces/template-service-utils.d.ts +62 -0
- package/dist/server/flow-surfaces/template-service-utils.js +281 -0
- package/dist/server/flow-surfaces/types.d.ts +288 -0
- package/dist/server/flow-surfaces/types.js +24 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +7 -2
- package/dist/server/plugin.d.ts +0 -1
- package/dist/server/plugin.js +9 -34
- package/dist/server/repository.js +0 -5
- package/dist/server/variables/resolve.d.ts +21 -0
- package/dist/server/variables/resolve.js +79 -0
- package/dist/swagger/flow-surfaces.d.ts +6135 -0
- package/dist/swagger/flow-surfaces.examples.d.ts +1577 -0
- package/dist/swagger/flow-surfaces.examples.js +1816 -0
- package/dist/swagger/flow-surfaces.js +5384 -0
- package/dist/swagger/flow-surfaces.template-action-docs.d.ts +62 -0
- package/dist/swagger/flow-surfaces.template-action-docs.js +121 -0
- package/dist/swagger/flow-surfaces.template-schemas.d.ts +239 -0
- package/dist/swagger/flow-surfaces.template-schemas.js +255 -0
- package/dist/swagger/index.d.ts +6140 -0
- package/dist/swagger/index.js +50 -0
- package/package.json +3 -3
- /package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextApis.d.ts +0 -0
- /package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextEnvs.d.ts +0 -0
- /package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextVars.d.ts +0 -0
- /package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/lintAndTestJS.d.ts +0 -0
|
@@ -0,0 +1,375 @@
|
|
|
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 __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var compose_runtime_exports = {};
|
|
28
|
+
__export(compose_runtime_exports, {
|
|
29
|
+
createComposeRuntimeState: () => createComposeRuntimeState,
|
|
30
|
+
executeComposeRuntime: () => executeComposeRuntime
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(compose_runtime_exports);
|
|
33
|
+
var import_errors = require("./errors");
|
|
34
|
+
var import_default_action_popup = require("./default-action-popup");
|
|
35
|
+
var import_compose_compiler = require("./compose-compiler");
|
|
36
|
+
async function executeComposeRuntime(plan, deps) {
|
|
37
|
+
assertComposeRuntimeDeps(plan, deps);
|
|
38
|
+
const state = createComposeRuntimeState();
|
|
39
|
+
await removeExistingItemsForReplace(plan, deps);
|
|
40
|
+
await createBlocks(plan, deps, state);
|
|
41
|
+
await applyBlockSettings(deps, state);
|
|
42
|
+
await createFields(plan, deps, state);
|
|
43
|
+
await applyBlockFieldLayouts(deps, state);
|
|
44
|
+
await createActions(plan, deps, state);
|
|
45
|
+
await createRecordActions(plan, deps, state);
|
|
46
|
+
const layoutResult = await applyComposeLayout(plan, deps, state);
|
|
47
|
+
return {
|
|
48
|
+
target: {
|
|
49
|
+
uid: plan.gridUid
|
|
50
|
+
},
|
|
51
|
+
mode: plan.mode,
|
|
52
|
+
blocks: state.blocks.map((block) => ({
|
|
53
|
+
key: block.spec.key,
|
|
54
|
+
type: block.spec.type,
|
|
55
|
+
uid: block.result.uid,
|
|
56
|
+
gridUid: block.result.gridUid,
|
|
57
|
+
itemUid: block.result.itemUid,
|
|
58
|
+
itemGridUid: block.result.itemGridUid,
|
|
59
|
+
actionsColumnUid: block.result.actionsColumnUid,
|
|
60
|
+
fields: block.fieldResults,
|
|
61
|
+
actions: block.actionResults,
|
|
62
|
+
recordActions: block.recordActionResults
|
|
63
|
+
})),
|
|
64
|
+
...typeof layoutResult === "undefined" ? {} : { layout: layoutResult }
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function createComposeRuntimeState() {
|
|
68
|
+
return {
|
|
69
|
+
keyMap: {},
|
|
70
|
+
blocks: []
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function shouldApplyActionPopupAfterEffect(spec) {
|
|
74
|
+
return hasPopupAfterEffect(spec.popup) || (0, import_default_action_popup.isFlowSurfaceDefaultActionPopupType)(spec.type);
|
|
75
|
+
}
|
|
76
|
+
function assertComposeRuntimeDeps(plan, deps) {
|
|
77
|
+
if (plan.mode === "replace" && plan.existingItemUids.length) {
|
|
78
|
+
requireComposeRuntimeDep("removeExistingItem", deps.removeExistingItem, "replace");
|
|
79
|
+
}
|
|
80
|
+
if (plan.blocks.some((block) => hasInlineSettings(block.spec.settings))) {
|
|
81
|
+
requireComposeRuntimeDep("applyNodeSettings", deps.applyNodeSettings, "block settings");
|
|
82
|
+
}
|
|
83
|
+
if (plan.fields.some((field) => hasInlineSettings(field.spec.settings))) {
|
|
84
|
+
requireComposeRuntimeDep("applyFieldSettings", deps.applyFieldSettings, "field settings");
|
|
85
|
+
}
|
|
86
|
+
if ([...plan.actions, ...plan.recordActions].some(
|
|
87
|
+
(action) => hasInlineSettings(action.spec.settings) || shouldApplyActionPopupAfterEffect(action.spec)
|
|
88
|
+
)) {
|
|
89
|
+
if ([...plan.actions, ...plan.recordActions].some((action) => hasInlineSettings(action.spec.settings))) {
|
|
90
|
+
requireComposeRuntimeDep("applyNodeSettings", deps.applyNodeSettings, "action settings");
|
|
91
|
+
}
|
|
92
|
+
if ([...plan.actions, ...plan.recordActions].some((action) => shouldApplyActionPopupAfterEffect(action.spec))) {
|
|
93
|
+
requireComposeRuntimeDep("applyActionPopup", deps.applyActionPopup, "action popup");
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
function requireComposeRuntimeDep(name, dep, stage) {
|
|
98
|
+
if (dep) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
(0, import_errors.throwConflict)(
|
|
102
|
+
`flowSurfaces compose ${stage} runtime deps missing '${name}'`,
|
|
103
|
+
"FLOW_SURFACE_COMPOSE_RUNTIME_DEPS_MISSING"
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
async function removeExistingItemsForReplace(plan, deps) {
|
|
107
|
+
if (plan.mode !== "replace" || !plan.existingItemUids.length) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
const removeExistingItem = deps.removeExistingItem;
|
|
111
|
+
requireComposeRuntimeDep("removeExistingItem", removeExistingItem, "replace");
|
|
112
|
+
for (const uid of plan.existingItemUids) {
|
|
113
|
+
await removeExistingItem(uid);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
async function createBlocks(plan, deps, state) {
|
|
117
|
+
for (const blockTask of plan.blocks) {
|
|
118
|
+
const result = await deps.createBlock(blockTask.payload, blockTask.spec);
|
|
119
|
+
state.blocks.push({
|
|
120
|
+
spec: blockTask.spec,
|
|
121
|
+
result,
|
|
122
|
+
createdFields: [],
|
|
123
|
+
fieldResults: [],
|
|
124
|
+
actionResults: [],
|
|
125
|
+
recordActionResults: []
|
|
126
|
+
});
|
|
127
|
+
state.keyMap[blockTask.key] = {
|
|
128
|
+
uid: result.uid,
|
|
129
|
+
gridUid: result.gridUid,
|
|
130
|
+
itemUid: result.itemUid,
|
|
131
|
+
itemGridUid: result.itemGridUid,
|
|
132
|
+
actionsColumnUid: result.actionsColumnUid
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
async function applyBlockSettings(deps, state) {
|
|
137
|
+
const applyNodeSettings = deps.applyNodeSettings;
|
|
138
|
+
if (!applyNodeSettings) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
for (const block of state.blocks) {
|
|
142
|
+
if (!hasInlineSettings(block.spec.settings)) {
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
await applyNodeSettings("compose block", block.result.uid, block.spec.settings);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
async function createFields(plan, deps, state) {
|
|
149
|
+
for (const fieldTask of plan.fields) {
|
|
150
|
+
const block = requireBlockState(fieldTask.blockKey, state);
|
|
151
|
+
const targetUid = fieldTask.containerSource === "item" ? block.result.itemUid || block.result.uid : block.result.uid;
|
|
152
|
+
let createdField;
|
|
153
|
+
try {
|
|
154
|
+
createdField = await deps.createField(
|
|
155
|
+
{
|
|
156
|
+
target: {
|
|
157
|
+
uid: targetUid
|
|
158
|
+
},
|
|
159
|
+
...fieldTask.payload,
|
|
160
|
+
...readComposeFieldTargetKey(fieldTask.spec.target) ? {
|
|
161
|
+
defaultTargetUid: (0, import_compose_compiler.resolveComposeTargetKey)(
|
|
162
|
+
readComposeFieldTargetKey(fieldTask.spec.target),
|
|
163
|
+
state.keyMap,
|
|
164
|
+
"field"
|
|
165
|
+
)
|
|
166
|
+
} : {}
|
|
167
|
+
},
|
|
168
|
+
fieldTask.spec,
|
|
169
|
+
block.result
|
|
170
|
+
);
|
|
171
|
+
} catch (error) {
|
|
172
|
+
const decision = deps.onFieldError ? await deps.onFieldError({
|
|
173
|
+
error,
|
|
174
|
+
spec: fieldTask.spec,
|
|
175
|
+
blockSpec: block.spec,
|
|
176
|
+
blockResult: block.result
|
|
177
|
+
}) : void 0;
|
|
178
|
+
if (decision === "continue") {
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
throw error;
|
|
182
|
+
}
|
|
183
|
+
if (!createdField) {
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
block.createdFields.push({
|
|
187
|
+
spec: fieldTask.spec,
|
|
188
|
+
result: createdField
|
|
189
|
+
});
|
|
190
|
+
if (deps.applyFieldSettings && hasInlineSettings(fieldTask.spec.settings)) {
|
|
191
|
+
await deps.applyFieldSettings("compose field", createdField, fieldTask.spec.settings);
|
|
192
|
+
}
|
|
193
|
+
block.fieldResults.push(buildFieldResultSummary(fieldTask.spec, createdField));
|
|
194
|
+
}
|
|
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
|
+
}
|
|
224
|
+
async function createActions(plan, deps, state) {
|
|
225
|
+
for (const actionTask of plan.actions) {
|
|
226
|
+
const block = requireBlockState(actionTask.blockKey, state);
|
|
227
|
+
const createdAction = await deps.createAction(
|
|
228
|
+
{
|
|
229
|
+
target: {
|
|
230
|
+
uid: block.result.uid
|
|
231
|
+
},
|
|
232
|
+
...actionTask.payload
|
|
233
|
+
},
|
|
234
|
+
actionTask.spec,
|
|
235
|
+
block.result
|
|
236
|
+
);
|
|
237
|
+
if (deps.applyNodeSettings && hasInlineSettings(actionTask.spec.settings)) {
|
|
238
|
+
await deps.applyNodeSettings("compose action", createdAction.uid, actionTask.spec.settings);
|
|
239
|
+
}
|
|
240
|
+
if (deps.applyActionPopup && shouldApplyActionPopupAfterEffect(actionTask.spec)) {
|
|
241
|
+
await deps.applyActionPopup("compose action", createdAction.uid, actionTask.spec.popup);
|
|
242
|
+
}
|
|
243
|
+
const actionKeys = deps.collectActionKeys ? await deps.collectActionKeys(createdAction.uid) : {};
|
|
244
|
+
block.actionResults.push(buildActionResultSummary(actionTask.spec, createdAction, actionKeys));
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
async function createRecordActions(plan, deps, state) {
|
|
248
|
+
for (const recordActionTask of plan.recordActions) {
|
|
249
|
+
const block = requireBlockState(recordActionTask.blockKey, state);
|
|
250
|
+
const createdAction = await deps.createRecordAction(
|
|
251
|
+
{
|
|
252
|
+
target: {
|
|
253
|
+
uid: block.result.uid
|
|
254
|
+
},
|
|
255
|
+
...recordActionTask.payload
|
|
256
|
+
},
|
|
257
|
+
recordActionTask.spec,
|
|
258
|
+
block.result
|
|
259
|
+
);
|
|
260
|
+
if (!block.result.actionsColumnUid && block.spec.type === "table" && createdAction.parentUid) {
|
|
261
|
+
block.result.actionsColumnUid = createdAction.parentUid;
|
|
262
|
+
state.keyMap[recordActionTask.blockKey] = {
|
|
263
|
+
...state.keyMap[recordActionTask.blockKey],
|
|
264
|
+
actionsColumnUid: createdAction.parentUid
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
if (deps.applyNodeSettings && hasInlineSettings(recordActionTask.spec.settings)) {
|
|
268
|
+
await deps.applyNodeSettings("compose recordAction", createdAction.uid, recordActionTask.spec.settings);
|
|
269
|
+
}
|
|
270
|
+
if (deps.applyActionPopup && shouldApplyActionPopupAfterEffect(recordActionTask.spec)) {
|
|
271
|
+
await deps.applyActionPopup("compose recordAction", createdAction.uid, recordActionTask.spec.popup);
|
|
272
|
+
}
|
|
273
|
+
const actionKeys = deps.collectActionKeys ? await deps.collectActionKeys(createdAction.uid) : {};
|
|
274
|
+
block.recordActionResults.push(buildActionResultSummary(recordActionTask.spec, createdAction, actionKeys));
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
async function applyComposeLayout(plan, deps, state) {
|
|
278
|
+
if (plan.layoutPlan.kind === "none") {
|
|
279
|
+
return void 0;
|
|
280
|
+
}
|
|
281
|
+
if (plan.layoutPlan.kind === "explicit") {
|
|
282
|
+
const buildExplicitLayoutPayload = deps.buildExplicitLayoutPayload;
|
|
283
|
+
const setLayout2 = deps.setLayout;
|
|
284
|
+
requireComposeRuntimeDep("buildExplicitLayoutPayload", buildExplicitLayoutPayload, "explicit layout");
|
|
285
|
+
requireComposeRuntimeDep("setLayout", setLayout2, "explicit layout");
|
|
286
|
+
const layoutPayload2 = await buildExplicitLayoutPayload({
|
|
287
|
+
layout: plan.layoutPlan.layout,
|
|
288
|
+
createdByKey: state.keyMap,
|
|
289
|
+
targetUid: plan.gridUid
|
|
290
|
+
});
|
|
291
|
+
return setLayout2({
|
|
292
|
+
target: {
|
|
293
|
+
uid: plan.gridUid
|
|
294
|
+
},
|
|
295
|
+
...layoutPayload2
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
const buildAppendLayoutPayload = deps.buildAppendLayoutPayload;
|
|
299
|
+
const setLayout = deps.setLayout;
|
|
300
|
+
requireComposeRuntimeDep("buildAppendLayoutPayload", buildAppendLayoutPayload, "append layout");
|
|
301
|
+
requireComposeRuntimeDep("setLayout", setLayout, "append layout");
|
|
302
|
+
const layoutPayload = await buildAppendLayoutPayload({
|
|
303
|
+
gridUid: plan.gridUid,
|
|
304
|
+
appendedItemUids: state.blocks.map((block) => block.result.uid)
|
|
305
|
+
});
|
|
306
|
+
return setLayout({
|
|
307
|
+
target: {
|
|
308
|
+
uid: plan.gridUid
|
|
309
|
+
},
|
|
310
|
+
...layoutPayload
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
function requireBlockState(blockKey, state) {
|
|
314
|
+
const matched = state.blocks.find((block) => block.spec.key === blockKey);
|
|
315
|
+
if (!matched) {
|
|
316
|
+
(0, import_errors.throwConflict)(
|
|
317
|
+
`flowSurfaces compose block '${blockKey}' is missing from runtime state`,
|
|
318
|
+
"FLOW_SURFACE_COMPOSE_BLOCK_MISSING"
|
|
319
|
+
);
|
|
320
|
+
}
|
|
321
|
+
return matched;
|
|
322
|
+
}
|
|
323
|
+
function buildFieldResultSummary(spec, createdField) {
|
|
324
|
+
return {
|
|
325
|
+
key: spec.key,
|
|
326
|
+
uid: createdField.uid,
|
|
327
|
+
...spec.type ? { type: spec.type } : {},
|
|
328
|
+
...spec.renderer ? { renderer: spec.renderer } : {},
|
|
329
|
+
fieldPath: spec.fieldPath,
|
|
330
|
+
associationPathName: spec.associationPathName,
|
|
331
|
+
wrapperUid: createdField.wrapperUid,
|
|
332
|
+
fieldUid: createdField.fieldUid,
|
|
333
|
+
innerFieldUid: createdField.innerFieldUid,
|
|
334
|
+
popupPageUid: createdField.popupPageUid,
|
|
335
|
+
popupTabUid: createdField.popupTabUid,
|
|
336
|
+
popupGridUid: createdField.popupGridUid,
|
|
337
|
+
...spec.target ? { target: spec.target } : {}
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
function buildActionResultSummary(spec, createdAction, actionKeys) {
|
|
341
|
+
return {
|
|
342
|
+
key: spec.key,
|
|
343
|
+
type: spec.type,
|
|
344
|
+
scope: createdAction.scope,
|
|
345
|
+
uid: createdAction.uid,
|
|
346
|
+
parentUid: createdAction.parentUid,
|
|
347
|
+
...actionKeys
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
function hasInlineSettings(value) {
|
|
351
|
+
return !!value && Object.keys(value).length > 0;
|
|
352
|
+
}
|
|
353
|
+
function resolveComposeFieldLayoutUid(result) {
|
|
354
|
+
return result.wrapperUid || result.uid;
|
|
355
|
+
}
|
|
356
|
+
function hasPopupAfterEffect(value) {
|
|
357
|
+
return typeof value !== "undefined";
|
|
358
|
+
}
|
|
359
|
+
function readComposeFieldTargetKey(target) {
|
|
360
|
+
if (typeof target === "string") {
|
|
361
|
+
const normalized2 = target.trim();
|
|
362
|
+
return normalized2 || void 0;
|
|
363
|
+
}
|
|
364
|
+
if (!target || typeof target !== "object") {
|
|
365
|
+
return void 0;
|
|
366
|
+
}
|
|
367
|
+
const key = typeof target.composeKey === "string" ? target.composeKey : target.key;
|
|
368
|
+
const normalized = typeof key === "string" ? key.trim() : "";
|
|
369
|
+
return normalized || void 0;
|
|
370
|
+
}
|
|
371
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
372
|
+
0 && (module.exports = {
|
|
373
|
+
createComposeRuntimeState,
|
|
374
|
+
executeComposeRuntime
|
|
375
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
import type { FlowSurfaceCatalogItem, FlowSurfaceConfigureOptions, FlowSurfaceContainerKind } from './types';
|
|
10
|
+
export declare function getConfigureOptionsForUse(use?: string): FlowSurfaceConfigureOptions;
|
|
11
|
+
export declare function getConfigureOptionsForResolvedNode(input: {
|
|
12
|
+
kind?: FlowSurfaceContainerKind;
|
|
13
|
+
use?: string;
|
|
14
|
+
}): FlowSurfaceConfigureOptions;
|
|
15
|
+
export declare function getConfigureOptionsForCatalogItem(item?: Pick<FlowSurfaceCatalogItem, 'kind' | 'use'> | {
|
|
16
|
+
kind?: FlowSurfaceCatalogItem['kind'];
|
|
17
|
+
use?: string;
|
|
18
|
+
} | null): FlowSurfaceConfigureOptions;
|
|
19
|
+
export declare function getConfigureOptionKeysForUse(use?: string): string[];
|
|
20
|
+
export declare function getConfigureOptionKeysForResolvedNode(input: {
|
|
21
|
+
kind?: FlowSurfaceContainerKind;
|
|
22
|
+
use?: string;
|
|
23
|
+
}): string[];
|