@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,322 @@
|
|
|
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 default_action_popup_exports = {};
|
|
38
|
+
__export(default_action_popup_exports, {
|
|
39
|
+
FLOW_SURFACE_DEFAULT_ACTION_POPUP_TYPES: () => FLOW_SURFACE_DEFAULT_ACTION_POPUP_TYPES,
|
|
40
|
+
FLOW_SURFACE_DEFAULT_ACTION_POPUP_USES: () => FLOW_SURFACE_DEFAULT_ACTION_POPUP_USES,
|
|
41
|
+
buildFlowSurfaceDefaultActionPopupBlocks: () => buildFlowSurfaceDefaultActionPopupBlocks,
|
|
42
|
+
getFlowSurfaceDefaultActionPopupConfigByUse: () => getFlowSurfaceDefaultActionPopupConfigByUse,
|
|
43
|
+
hasFlowSurfaceInlinePopupBlocks: () => hasFlowSurfaceInlinePopupBlocks,
|
|
44
|
+
hasFlowSurfaceInlinePopupTemplate: () => hasFlowSurfaceInlinePopupTemplate,
|
|
45
|
+
isFlowSurfaceDefaultActionPopupType: () => isFlowSurfaceDefaultActionPopupType,
|
|
46
|
+
isFlowSurfaceDefaultActionPopupUse: () => isFlowSurfaceDefaultActionPopupUse,
|
|
47
|
+
pickFlowSurfaceDefaultActionPopupFieldGroups: () => pickFlowSurfaceDefaultActionPopupFieldGroups,
|
|
48
|
+
pickFlowSurfaceDefaultActionPopupFieldPaths: () => pickFlowSurfaceDefaultActionPopupFieldPaths,
|
|
49
|
+
resolveFlowSurfaceDefaultActionPopupTabTitle: () => resolveFlowSurfaceDefaultActionPopupTabTitle
|
|
50
|
+
});
|
|
51
|
+
module.exports = __toCommonJS(default_action_popup_exports);
|
|
52
|
+
var import_lodash = __toESM(require("lodash"));
|
|
53
|
+
var import_association_interfaces = require("./association-interfaces");
|
|
54
|
+
var import_service_helpers = require("./service-helpers");
|
|
55
|
+
const DEFAULT_ACTION_POPUP_SYSTEM_FIELD_NAMES = /* @__PURE__ */ new Set(["id", "createdBy", "createdById", "updatedBy", "updatedById"]);
|
|
56
|
+
const DEFAULT_ACTION_POPUP_SYSTEM_FIELD_INTERFACES = /* @__PURE__ */ new Set([
|
|
57
|
+
"id",
|
|
58
|
+
"snowflakeId",
|
|
59
|
+
"createdBy",
|
|
60
|
+
"createdById",
|
|
61
|
+
"updatedBy",
|
|
62
|
+
"updatedById"
|
|
63
|
+
]);
|
|
64
|
+
const DEFAULT_ACTION_POPUP_AUDIT_TIMESTAMP_FIELD_NAMES = /* @__PURE__ */ new Set(["createdAt", "updatedAt"]);
|
|
65
|
+
const DEFAULT_ACTION_POPUP_AUDIT_TIMESTAMP_FIELD_INTERFACES = /* @__PURE__ */ new Set(["createdAt", "updatedAt"]);
|
|
66
|
+
const FLOW_SURFACE_DEFAULT_ACTION_POPUP_CONFIGS = [
|
|
67
|
+
{
|
|
68
|
+
type: "addNew",
|
|
69
|
+
use: "AddNewActionModel",
|
|
70
|
+
defaultButtonTitle: '{{t("Add new")}}',
|
|
71
|
+
defaultPopupTabTitle: '{{t("Add new")}}',
|
|
72
|
+
blockKey: "defaultCreateForm",
|
|
73
|
+
blockType: "createForm",
|
|
74
|
+
blockUse: "CreateFormModel",
|
|
75
|
+
resourceBinding: "currentCollection",
|
|
76
|
+
blockSettings: {
|
|
77
|
+
layout: "vertical",
|
|
78
|
+
colon: false,
|
|
79
|
+
assignRules: []
|
|
80
|
+
},
|
|
81
|
+
submitAction: {
|
|
82
|
+
key: "defaultSubmit",
|
|
83
|
+
type: "submit",
|
|
84
|
+
settings: {
|
|
85
|
+
title: '{{t("Submit")}}',
|
|
86
|
+
type: "primary",
|
|
87
|
+
confirm: false
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
type: "view",
|
|
93
|
+
use: "ViewActionModel",
|
|
94
|
+
defaultButtonTitle: '{{t("View")}}',
|
|
95
|
+
defaultPopupTabTitle: '{{t("Details")}}',
|
|
96
|
+
blockKey: "defaultDetails",
|
|
97
|
+
blockType: "details",
|
|
98
|
+
blockUse: "DetailsBlockModel",
|
|
99
|
+
resourceBinding: "currentRecord",
|
|
100
|
+
blockSettings: {
|
|
101
|
+
layout: "vertical",
|
|
102
|
+
colon: true,
|
|
103
|
+
dataScope: {
|
|
104
|
+
logic: "$and",
|
|
105
|
+
items: []
|
|
106
|
+
},
|
|
107
|
+
linkageRules: []
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
type: "edit",
|
|
112
|
+
use: "EditActionModel",
|
|
113
|
+
defaultButtonTitle: '{{t("Edit")}}',
|
|
114
|
+
defaultPopupTabTitle: '{{t("Edit")}}',
|
|
115
|
+
blockKey: "defaultEditForm",
|
|
116
|
+
blockType: "editForm",
|
|
117
|
+
blockUse: "EditFormModel",
|
|
118
|
+
resourceBinding: "currentRecord",
|
|
119
|
+
blockSettings: {
|
|
120
|
+
layout: "vertical",
|
|
121
|
+
colon: false,
|
|
122
|
+
assignRules: [],
|
|
123
|
+
dataScope: {
|
|
124
|
+
logic: "$and",
|
|
125
|
+
items: []
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
submitAction: {
|
|
129
|
+
key: "defaultSubmit",
|
|
130
|
+
type: "submit",
|
|
131
|
+
settings: {
|
|
132
|
+
title: '{{t("Submit")}}',
|
|
133
|
+
type: "primary",
|
|
134
|
+
confirm: false
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
];
|
|
139
|
+
const FLOW_SURFACE_DEFAULT_ACTION_POPUP_TYPES = new Set(
|
|
140
|
+
FLOW_SURFACE_DEFAULT_ACTION_POPUP_CONFIGS.map((item) => item.type)
|
|
141
|
+
);
|
|
142
|
+
const FLOW_SURFACE_DEFAULT_ACTION_POPUP_USES = new Set(
|
|
143
|
+
FLOW_SURFACE_DEFAULT_ACTION_POPUP_CONFIGS.map((item) => item.use)
|
|
144
|
+
);
|
|
145
|
+
const FLOW_SURFACE_DEFAULT_ACTION_POPUP_CONFIG_BY_USE = FLOW_SURFACE_DEFAULT_ACTION_POPUP_CONFIGS.reduce(
|
|
146
|
+
(result, item) => {
|
|
147
|
+
result[item.use] = item;
|
|
148
|
+
return result;
|
|
149
|
+
},
|
|
150
|
+
{}
|
|
151
|
+
);
|
|
152
|
+
const FLOW_SURFACE_DEFAULT_ACTION_POPUP_LEGACY_BUTTON_TITLES = {
|
|
153
|
+
AddNewActionModel: "Add new",
|
|
154
|
+
ViewActionModel: "View",
|
|
155
|
+
EditActionModel: "Edit"
|
|
156
|
+
};
|
|
157
|
+
function isFlowSurfaceDefaultActionPopupType(type) {
|
|
158
|
+
return FLOW_SURFACE_DEFAULT_ACTION_POPUP_TYPES.has(String(type || "").trim());
|
|
159
|
+
}
|
|
160
|
+
function isFlowSurfaceDefaultActionPopupUse(use) {
|
|
161
|
+
return FLOW_SURFACE_DEFAULT_ACTION_POPUP_USES.has(String(use || "").trim());
|
|
162
|
+
}
|
|
163
|
+
function getFlowSurfaceDefaultActionPopupConfigByUse(use) {
|
|
164
|
+
const normalizedUse = String(use || "").trim();
|
|
165
|
+
if (!isFlowSurfaceDefaultActionPopupUse(normalizedUse)) {
|
|
166
|
+
return void 0;
|
|
167
|
+
}
|
|
168
|
+
return FLOW_SURFACE_DEFAULT_ACTION_POPUP_CONFIG_BY_USE[normalizedUse];
|
|
169
|
+
}
|
|
170
|
+
function resolveFlowSurfaceDefaultActionPopupTabTitle(use, currentTitle) {
|
|
171
|
+
const actionConfig = getFlowSurfaceDefaultActionPopupConfigByUse(use);
|
|
172
|
+
if (!actionConfig) {
|
|
173
|
+
return void 0;
|
|
174
|
+
}
|
|
175
|
+
const normalizedTitle = String(currentTitle || "").trim();
|
|
176
|
+
const legacyDefaultButtonTitle = FLOW_SURFACE_DEFAULT_ACTION_POPUP_LEGACY_BUTTON_TITLES[actionConfig.use];
|
|
177
|
+
if (normalizedTitle && normalizedTitle !== actionConfig.defaultButtonTitle && normalizedTitle !== legacyDefaultButtonTitle) {
|
|
178
|
+
return normalizedTitle;
|
|
179
|
+
}
|
|
180
|
+
return actionConfig.defaultPopupTabTitle;
|
|
181
|
+
}
|
|
182
|
+
function isFlowSurfaceDefaultActionPopupSystemField(field) {
|
|
183
|
+
var _a, _b;
|
|
184
|
+
const fieldName = String((0, import_service_helpers.getFieldName)(field) || "").trim();
|
|
185
|
+
const fieldInterface = String((0, import_service_helpers.getFieldInterface)(field) || "").trim();
|
|
186
|
+
return DEFAULT_ACTION_POPUP_SYSTEM_FIELD_NAMES.has(fieldName) || DEFAULT_ACTION_POPUP_SYSTEM_FIELD_INTERFACES.has(fieldInterface) || !!(field == null ? void 0 : field.primaryKey) || !!((_a = field == null ? void 0 : field.options) == null ? void 0 : _a.primaryKey) || !!(field == null ? void 0 : field.autoIncrement) || !!((_b = field == null ? void 0 : field.options) == null ? void 0 : _b.autoIncrement);
|
|
187
|
+
}
|
|
188
|
+
function isFlowSurfaceDefaultActionPopupTechnicalIdField(field) {
|
|
189
|
+
var _a, _b;
|
|
190
|
+
const fieldName = String((0, import_service_helpers.getFieldName)(field) || "").trim();
|
|
191
|
+
const fieldInterface = String((0, import_service_helpers.getFieldInterface)(field) || "").trim();
|
|
192
|
+
return fieldName === "id" || fieldInterface === "id" || fieldInterface === "snowflakeId" || !!(field == null ? void 0 : field.primaryKey) || !!((_a = field == null ? void 0 : field.options) == null ? void 0 : _a.primaryKey) || !!(field == null ? void 0 : field.autoIncrement) || !!((_b = field == null ? void 0 : field.options) == null ? void 0 : _b.autoIncrement);
|
|
193
|
+
}
|
|
194
|
+
function isFlowSurfaceDefaultActionPopupAuditTimestampField(field) {
|
|
195
|
+
const fieldName = String((0, import_service_helpers.getFieldName)(field) || "").trim();
|
|
196
|
+
const fieldInterface = String((0, import_service_helpers.getFieldInterface)(field) || "").trim();
|
|
197
|
+
return DEFAULT_ACTION_POPUP_AUDIT_TIMESTAMP_FIELD_NAMES.has(fieldName) || DEFAULT_ACTION_POPUP_AUDIT_TIMESTAMP_FIELD_INTERFACES.has(fieldInterface);
|
|
198
|
+
}
|
|
199
|
+
function isFlowSurfaceDefaultActionPopupMultiValueAssociationField(field) {
|
|
200
|
+
const fieldInterface = String((0, import_service_helpers.getFieldInterface)(field) || "").trim();
|
|
201
|
+
return import_association_interfaces.MULTI_VALUE_ASSOCIATION_INTERFACES.has(fieldInterface);
|
|
202
|
+
}
|
|
203
|
+
function isFlowSurfaceDefaultActionPopupAssociationField(field) {
|
|
204
|
+
const fieldType = String((0, import_service_helpers.getFieldType)(field) || "").trim();
|
|
205
|
+
return fieldType === "belongsTo" || fieldType === "hasOne" || fieldType === "hasMany" || fieldType === "belongsToMany";
|
|
206
|
+
}
|
|
207
|
+
function collectFlowSurfaceDefaultActionPopupAssociationForeignKeys(candidates) {
|
|
208
|
+
return new Set(
|
|
209
|
+
candidates.map((candidate) => candidate == null ? void 0 : candidate.field).filter((field) => (0, import_service_helpers.getFieldType)(field) === "belongsTo").map((field) => {
|
|
210
|
+
var _a;
|
|
211
|
+
return String((field == null ? void 0 : field.foreignKey) || ((_a = field == null ? void 0 : field.options) == null ? void 0 : _a.foreignKey) || "").trim();
|
|
212
|
+
}).filter(Boolean)
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
function isFlowSurfaceDefaultActionPopupAssociationForeignKeyField(field, associationForeignKeys) {
|
|
216
|
+
const fieldName = String((0, import_service_helpers.getFieldName)(field) || "").trim();
|
|
217
|
+
return !!fieldName && associationForeignKeys.has(fieldName);
|
|
218
|
+
}
|
|
219
|
+
function pickFlowSurfaceDefaultActionPopupFieldPaths(candidates, options = {}) {
|
|
220
|
+
return filterFlowSurfaceDefaultActionPopupFieldCandidates(candidates, options).map((candidate) => String((candidate == null ? void 0 : candidate.fieldPath) || "").trim()).filter(Boolean);
|
|
221
|
+
}
|
|
222
|
+
function filterFlowSurfaceDefaultActionPopupFieldCandidates(candidates, options = {}) {
|
|
223
|
+
const associationForeignKeys = collectFlowSurfaceDefaultActionPopupAssociationForeignKeys(candidates);
|
|
224
|
+
const preferredCandidates = candidates.filter(
|
|
225
|
+
(candidate) => !isFlowSurfaceDefaultActionPopupSystemField(candidate.field) && (!options.excludeAuditTimestampFields || !isFlowSurfaceDefaultActionPopupAuditTimestampField(candidate.field)) && (!options.excludeAssociationFields || !isFlowSurfaceDefaultActionPopupAssociationField(candidate.field)) && !isFlowSurfaceDefaultActionPopupMultiValueAssociationField(candidate.field) && !isFlowSurfaceDefaultActionPopupAssociationForeignKeyField(candidate.field, associationForeignKeys)
|
|
226
|
+
);
|
|
227
|
+
const fallbackCandidates = candidates.filter(
|
|
228
|
+
(candidate) => !isFlowSurfaceDefaultActionPopupTechnicalIdField(candidate.field) && (!options.excludeAuditTimestampFields || !isFlowSurfaceDefaultActionPopupAuditTimestampField(candidate.field)) && (!options.excludeAssociationFields || !isFlowSurfaceDefaultActionPopupAssociationField(candidate.field)) && !isFlowSurfaceDefaultActionPopupMultiValueAssociationField(candidate.field) && !isFlowSurfaceDefaultActionPopupAssociationForeignKeyField(candidate.field, associationForeignKeys)
|
|
229
|
+
);
|
|
230
|
+
const baseCandidates = preferredCandidates.length ? preferredCandidates : fallbackCandidates;
|
|
231
|
+
return baseCandidates.filter((candidate) => String((candidate == null ? void 0 : candidate.fieldPath) || "").trim());
|
|
232
|
+
}
|
|
233
|
+
function pickFlowSurfaceDefaultActionPopupFieldGroups(candidates, fieldGroups, options = {}) {
|
|
234
|
+
const allowedFieldPaths = new Set(
|
|
235
|
+
filterFlowSurfaceDefaultActionPopupFieldCandidates(candidates, options).map(
|
|
236
|
+
(candidate) => String((candidate == null ? void 0 : candidate.fieldPath) || "").trim()
|
|
237
|
+
)
|
|
238
|
+
);
|
|
239
|
+
const usedFieldPaths = /* @__PURE__ */ new Set();
|
|
240
|
+
return import_lodash.default.castArray(fieldGroups || []).flatMap((group) => {
|
|
241
|
+
const title = String((group == null ? void 0 : group.title) || "").trim();
|
|
242
|
+
if (!title) {
|
|
243
|
+
return [];
|
|
244
|
+
}
|
|
245
|
+
const fields = import_lodash.default.castArray((group == null ? void 0 : group.fields) || []).map((field) => String(field || "").trim()).filter((field) => {
|
|
246
|
+
if (!field || !allowedFieldPaths.has(field) || usedFieldPaths.has(field)) {
|
|
247
|
+
return false;
|
|
248
|
+
}
|
|
249
|
+
usedFieldPaths.add(field);
|
|
250
|
+
return true;
|
|
251
|
+
});
|
|
252
|
+
if (!fields.length) {
|
|
253
|
+
return [];
|
|
254
|
+
}
|
|
255
|
+
return [
|
|
256
|
+
import_lodash.default.pickBy(
|
|
257
|
+
{
|
|
258
|
+
key: String((group == null ? void 0 : group.key) || "").trim() || void 0,
|
|
259
|
+
title,
|
|
260
|
+
fields
|
|
261
|
+
},
|
|
262
|
+
(value) => !import_lodash.default.isUndefined(value)
|
|
263
|
+
)
|
|
264
|
+
];
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
function normalizeDefaultActionPopupFieldsInput(input) {
|
|
268
|
+
if (Array.isArray(input)) {
|
|
269
|
+
return {
|
|
270
|
+
fieldPaths: input,
|
|
271
|
+
fieldGroups: []
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
return {
|
|
275
|
+
fieldPaths: import_lodash.default.castArray((input == null ? void 0 : input.fieldPaths) || []).map((field) => String(field || "").trim()).filter(Boolean),
|
|
276
|
+
fieldGroups: import_lodash.default.castArray((input == null ? void 0 : input.fieldGroups) || []).filter((group) => import_lodash.default.isPlainObject(group))
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
function buildFlowSurfaceDefaultActionPopupBlocks(use, fieldsInput) {
|
|
280
|
+
const actionConfig = getFlowSurfaceDefaultActionPopupConfigByUse(use);
|
|
281
|
+
if (!actionConfig) {
|
|
282
|
+
return [];
|
|
283
|
+
}
|
|
284
|
+
const { fieldPaths, fieldGroups } = normalizeDefaultActionPopupFieldsInput(fieldsInput);
|
|
285
|
+
const hasFieldGroups = !!fieldGroups.length;
|
|
286
|
+
return [
|
|
287
|
+
import_lodash.default.pickBy(
|
|
288
|
+
{
|
|
289
|
+
key: actionConfig.blockKey,
|
|
290
|
+
type: actionConfig.blockType,
|
|
291
|
+
resource: {
|
|
292
|
+
binding: actionConfig.resourceBinding
|
|
293
|
+
},
|
|
294
|
+
settings: import_lodash.default.cloneDeep(actionConfig.blockSettings),
|
|
295
|
+
fields: hasFieldGroups ? void 0 : fieldPaths,
|
|
296
|
+
fieldGroups: hasFieldGroups ? fieldGroups : void 0,
|
|
297
|
+
actions: actionConfig.submitAction ? [import_lodash.default.cloneDeep(actionConfig.submitAction)] : void 0
|
|
298
|
+
},
|
|
299
|
+
(value) => !import_lodash.default.isUndefined(value)
|
|
300
|
+
)
|
|
301
|
+
];
|
|
302
|
+
}
|
|
303
|
+
function hasFlowSurfaceInlinePopupTemplate(popup) {
|
|
304
|
+
return typeof popup !== "undefined" && typeof (popup == null ? void 0 : popup.template) !== "undefined";
|
|
305
|
+
}
|
|
306
|
+
function hasFlowSurfaceInlinePopupBlocks(popup) {
|
|
307
|
+
return Array.isArray(popup == null ? void 0 : popup.blocks) && popup.blocks.length > 0;
|
|
308
|
+
}
|
|
309
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
310
|
+
0 && (module.exports = {
|
|
311
|
+
FLOW_SURFACE_DEFAULT_ACTION_POPUP_TYPES,
|
|
312
|
+
FLOW_SURFACE_DEFAULT_ACTION_POPUP_USES,
|
|
313
|
+
buildFlowSurfaceDefaultActionPopupBlocks,
|
|
314
|
+
getFlowSurfaceDefaultActionPopupConfigByUse,
|
|
315
|
+
hasFlowSurfaceInlinePopupBlocks,
|
|
316
|
+
hasFlowSurfaceInlinePopupTemplate,
|
|
317
|
+
isFlowSurfaceDefaultActionPopupType,
|
|
318
|
+
isFlowSurfaceDefaultActionPopupUse,
|
|
319
|
+
pickFlowSurfaceDefaultActionPopupFieldGroups,
|
|
320
|
+
pickFlowSurfaceDefaultActionPopupFieldPaths,
|
|
321
|
+
resolveFlowSurfaceDefaultActionPopupTabTitle
|
|
322
|
+
});
|
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,209 @@
|
|
|
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 default_block_actions_exports = {};
|
|
38
|
+
__export(default_block_actions_exports, {
|
|
39
|
+
FLOW_SURFACE_INTERNAL_AUTO_SAVE_DEFAULT_POPUP_TEMPLATE_KEY: () => FLOW_SURFACE_INTERNAL_AUTO_SAVE_DEFAULT_POPUP_TEMPLATE_KEY,
|
|
40
|
+
getFlowSurfaceDefaultBlockActions: () => getFlowSurfaceDefaultBlockActions,
|
|
41
|
+
mergeFlowSurfaceDefaultBlockActions: () => mergeFlowSurfaceDefaultBlockActions
|
|
42
|
+
});
|
|
43
|
+
module.exports = __toCommonJS(default_block_actions_exports);
|
|
44
|
+
var import_lodash = __toESM(require("lodash"));
|
|
45
|
+
var import_defaults = require("./blueprint/defaults");
|
|
46
|
+
const FLOW_SURFACE_INTERNAL_AUTO_SAVE_DEFAULT_POPUP_TEMPLATE_KEY = "__flowSurfaceAutoSaveDefaultPopupTemplate";
|
|
47
|
+
const FLOW_SURFACE_DEFAULT_BLOCK_ACTIONS = {
|
|
48
|
+
table: [
|
|
49
|
+
{ type: "filter", scope: "actions" },
|
|
50
|
+
{
|
|
51
|
+
type: "addNew",
|
|
52
|
+
scope: "actions",
|
|
53
|
+
popup: {
|
|
54
|
+
tryTemplate: true,
|
|
55
|
+
[FLOW_SURFACE_INTERNAL_AUTO_SAVE_DEFAULT_POPUP_TEMPLATE_KEY]: true
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
{ type: "refresh", scope: "actions" }
|
|
59
|
+
],
|
|
60
|
+
list: [
|
|
61
|
+
{ type: "filter", scope: "actions" },
|
|
62
|
+
{
|
|
63
|
+
type: "addNew",
|
|
64
|
+
scope: "actions",
|
|
65
|
+
popup: {
|
|
66
|
+
tryTemplate: true,
|
|
67
|
+
[FLOW_SURFACE_INTERNAL_AUTO_SAVE_DEFAULT_POPUP_TEMPLATE_KEY]: true
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
{ type: "refresh", scope: "actions" }
|
|
71
|
+
],
|
|
72
|
+
gridCard: [
|
|
73
|
+
{ type: "filter", scope: "actions" },
|
|
74
|
+
{
|
|
75
|
+
type: "addNew",
|
|
76
|
+
scope: "actions",
|
|
77
|
+
popup: {
|
|
78
|
+
tryTemplate: true,
|
|
79
|
+
[FLOW_SURFACE_INTERNAL_AUTO_SAVE_DEFAULT_POPUP_TEMPLATE_KEY]: true
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
{ type: "refresh", scope: "actions" }
|
|
83
|
+
],
|
|
84
|
+
calendar: [
|
|
85
|
+
{ type: "filter", scope: "actions" },
|
|
86
|
+
{
|
|
87
|
+
type: "addNew",
|
|
88
|
+
scope: "actions",
|
|
89
|
+
popup: {
|
|
90
|
+
tryTemplate: true,
|
|
91
|
+
[FLOW_SURFACE_INTERNAL_AUTO_SAVE_DEFAULT_POPUP_TEMPLATE_KEY]: true
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
{ type: "refresh", scope: "actions" }
|
|
95
|
+
],
|
|
96
|
+
kanban: [
|
|
97
|
+
{ type: "filter", scope: "actions" },
|
|
98
|
+
{
|
|
99
|
+
type: "addNew",
|
|
100
|
+
scope: "actions",
|
|
101
|
+
popup: {
|
|
102
|
+
tryTemplate: true,
|
|
103
|
+
[FLOW_SURFACE_INTERNAL_AUTO_SAVE_DEFAULT_POPUP_TEMPLATE_KEY]: true
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
{ type: "refresh", scope: "actions" }
|
|
107
|
+
],
|
|
108
|
+
createForm: [{ type: "submit", scope: "actions" }],
|
|
109
|
+
editForm: [{ type: "submit", scope: "actions" }],
|
|
110
|
+
details: [
|
|
111
|
+
{
|
|
112
|
+
type: "edit",
|
|
113
|
+
scope: "recordActions",
|
|
114
|
+
popup: {
|
|
115
|
+
tryTemplate: true,
|
|
116
|
+
defaultType: "edit",
|
|
117
|
+
[FLOW_SURFACE_INTERNAL_AUTO_SAVE_DEFAULT_POPUP_TEMPLATE_KEY]: true
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
]
|
|
121
|
+
};
|
|
122
|
+
function cloneDefaultActionDescriptor(descriptor) {
|
|
123
|
+
return {
|
|
124
|
+
...descriptor,
|
|
125
|
+
...descriptor.popup ? { popup: import_lodash.default.cloneDeep(descriptor.popup) } : {}
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function normalizeActionType(value) {
|
|
129
|
+
return typeof value === "string" ? value.trim() : String(value || "").trim();
|
|
130
|
+
}
|
|
131
|
+
function resolveDefaultBlockActions(blockType, template) {
|
|
132
|
+
const normalizedBlockType = normalizeActionType(blockType);
|
|
133
|
+
if (!normalizedBlockType || !import_lodash.default.isUndefined(template)) {
|
|
134
|
+
return [];
|
|
135
|
+
}
|
|
136
|
+
return (FLOW_SURFACE_DEFAULT_BLOCK_ACTIONS[normalizedBlockType] || []).map(cloneDefaultActionDescriptor);
|
|
137
|
+
}
|
|
138
|
+
function shouldMergeDefaultPopup(popup) {
|
|
139
|
+
if (!import_lodash.default.isPlainObject(popup)) {
|
|
140
|
+
return true;
|
|
141
|
+
}
|
|
142
|
+
const keys = Object.keys(popup);
|
|
143
|
+
if (!keys.length) {
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
146
|
+
return keys.every(
|
|
147
|
+
(key) => ["mode", "size", "title", "defaultType", "tryTemplate", import_defaults.FLOW_SURFACE_APPLY_BLUEPRINT_POPUP_DEFAULTS_KEY].includes(
|
|
148
|
+
key
|
|
149
|
+
)
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
function mergeExplicitActionWithDescriptor(item, descriptor) {
|
|
153
|
+
if (!descriptor.popup || !shouldMergeDefaultPopup(item == null ? void 0 : item.popup)) {
|
|
154
|
+
return item;
|
|
155
|
+
}
|
|
156
|
+
return {
|
|
157
|
+
...item,
|
|
158
|
+
popup: import_lodash.default.isPlainObject(item == null ? void 0 : item.popup) ? {
|
|
159
|
+
...import_lodash.default.cloneDeep(descriptor.popup),
|
|
160
|
+
...import_lodash.default.cloneDeep(item.popup)
|
|
161
|
+
} : import_lodash.default.cloneDeep(descriptor.popup)
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
function mergeDefaultActionList(existing, descriptors, createAction) {
|
|
165
|
+
const existingList = Array.isArray(existing) ? existing : [];
|
|
166
|
+
if (!descriptors.length) {
|
|
167
|
+
return [...existingList];
|
|
168
|
+
}
|
|
169
|
+
const defaultTypes = new Set(descriptors.map((descriptor) => descriptor.type));
|
|
170
|
+
const explicitByType = /* @__PURE__ */ new Map();
|
|
171
|
+
const extras = [];
|
|
172
|
+
for (const item of existingList) {
|
|
173
|
+
const type = normalizeActionType(item == null ? void 0 : item.type);
|
|
174
|
+
if (!type || !defaultTypes.has(type)) {
|
|
175
|
+
extras.push(item);
|
|
176
|
+
continue;
|
|
177
|
+
}
|
|
178
|
+
if (!explicitByType.has(type)) {
|
|
179
|
+
explicitByType.set(type, item);
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
extras.push(item);
|
|
183
|
+
}
|
|
184
|
+
return [
|
|
185
|
+
...descriptors.map((descriptor) => {
|
|
186
|
+
const explicit = explicitByType.get(descriptor.type);
|
|
187
|
+
return explicit ? mergeExplicitActionWithDescriptor(explicit, descriptor) : createAction(descriptor);
|
|
188
|
+
}),
|
|
189
|
+
...extras
|
|
190
|
+
];
|
|
191
|
+
}
|
|
192
|
+
function getFlowSurfaceDefaultBlockActions(input) {
|
|
193
|
+
return resolveDefaultBlockActions(input.blockType, input.template);
|
|
194
|
+
}
|
|
195
|
+
function mergeFlowSurfaceDefaultBlockActions(input) {
|
|
196
|
+
const descriptors = resolveDefaultBlockActions(input.blockType, input.template);
|
|
197
|
+
const actionDescriptors = descriptors.filter((descriptor) => descriptor.scope === "actions");
|
|
198
|
+
const recordActionDescriptors = descriptors.filter((descriptor) => descriptor.scope === "recordActions");
|
|
199
|
+
return {
|
|
200
|
+
actions: mergeDefaultActionList(input.actions, actionDescriptors, input.createAction),
|
|
201
|
+
recordActions: mergeDefaultActionList(input.recordActions, recordActionDescriptors, input.createAction)
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
205
|
+
0 && (module.exports = {
|
|
206
|
+
FLOW_SURFACE_INTERNAL_AUTO_SAVE_DEFAULT_POPUP_TEMPLATE_KEY,
|
|
207
|
+
getFlowSurfaceDefaultBlockActions,
|
|
208
|
+
mergeFlowSurfaceDefaultBlockActions
|
|
209
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
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 type FlowSurfaceErrorType = 'bad_request' | 'forbidden' | 'conflict' | 'internal_error';
|
|
10
|
+
export interface FlowSurfaceErrorItem {
|
|
11
|
+
message: string;
|
|
12
|
+
type: FlowSurfaceErrorType;
|
|
13
|
+
code: string;
|
|
14
|
+
status: number;
|
|
15
|
+
}
|
|
16
|
+
export declare class FlowSurfaceError extends Error {
|
|
17
|
+
readonly status: number;
|
|
18
|
+
readonly type: FlowSurfaceErrorType;
|
|
19
|
+
readonly code: string;
|
|
20
|
+
constructor(message: string, status: number, type: FlowSurfaceErrorType, code: string);
|
|
21
|
+
toResponseBody(): {
|
|
22
|
+
errors: FlowSurfaceErrorItem[];
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export declare class FlowSurfaceBadRequestError extends FlowSurfaceError {
|
|
26
|
+
constructor(message: string, code?: string);
|
|
27
|
+
}
|
|
28
|
+
export declare class FlowSurfaceForbiddenError extends FlowSurfaceError {
|
|
29
|
+
constructor(message: string, code?: string);
|
|
30
|
+
}
|
|
31
|
+
export declare class FlowSurfaceConflictError extends FlowSurfaceError {
|
|
32
|
+
constructor(message: string, code?: string);
|
|
33
|
+
}
|
|
34
|
+
export declare class FlowSurfaceInternalError extends FlowSurfaceError {
|
|
35
|
+
constructor(message: string, code?: string);
|
|
36
|
+
}
|
|
37
|
+
export declare function isFlowSurfaceError(error: unknown): error is FlowSurfaceError;
|
|
38
|
+
export declare function isFlowSurfaceBadRequestError(error: unknown): error is FlowSurfaceBadRequestError;
|
|
39
|
+
export declare function isFlowSurfaceForbiddenError(error: unknown): error is FlowSurfaceForbiddenError;
|
|
40
|
+
export declare function isFlowSurfaceConflictError(error: unknown): error is FlowSurfaceConflictError;
|
|
41
|
+
export declare function isFlowSurfaceInternalError(error: unknown): error is FlowSurfaceInternalError;
|
|
42
|
+
export declare function toFlowSurfaceErrorItem(error: FlowSurfaceError): FlowSurfaceErrorItem;
|
|
43
|
+
export declare function normalizeFlowSurfaceError(error: unknown): FlowSurfaceError;
|
|
44
|
+
export declare function throwBadRequest(message: string, code?: string): never;
|
|
45
|
+
export declare function throwForbidden(message: string, code?: string): never;
|
|
46
|
+
export declare function throwConflict(message: string, code?: string): never;
|
|
47
|
+
export declare function throwInternalError(message: string, code?: string): never;
|