@nocobase/plugin-flow-engine 2.1.0-beta.15 → 2.1.0-beta.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/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 +11 -10
- 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/flow-surfaces/action-scope.d.ts +38 -0
- package/dist/server/flow-surfaces/action-scope.js +152 -0
- package/dist/server/flow-surfaces/apply/compiler.d.ts +13 -0
- package/dist/server/flow-surfaces/apply/compiler.js +969 -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-title-field.d.ts +20 -0
- package/dist/server/flow-surfaces/association-title-field.js +158 -0
- package/dist/server/flow-surfaces/blueprint/compile-blocks.d.ts +14 -0
- package/dist/server/flow-surfaces/blueprint/compile-blocks.js +1007 -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 +193 -0
- package/dist/server/flow-surfaces/blueprint/public-types.js +24 -0
- package/dist/server/flow-surfaces/builder.d.ts +211 -0
- package/dist/server/flow-surfaces/builder.js +1029 -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 +78 -0
- package/dist/server/flow-surfaces/catalog.js +3496 -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 +108 -0
- package/dist/server/flow-surfaces/compose-compiler.js +167 -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 +827 -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/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 +185 -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 +23 -0
- package/dist/server/flow-surfaces/field-binding-registry.js +391 -0
- package/dist/server/flow-surfaces/field-semantics.d.ts +15 -0
- package/dist/server/flow-surfaces/field-semantics.js +81 -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 +243 -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 +131 -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 +195 -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 +20 -0
- package/dist/server/flow-surfaces/public-data-surface-default-filter.js +111 -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 +377 -0
- package/dist/server/flow-surfaces/service-utils.d.ts +108 -0
- package/dist/server/flow-surfaces/service-utils.js +811 -0
- package/dist/server/flow-surfaces/service.d.ts +773 -0
- package/dist/server/flow-surfaces/service.js +13008 -0
- package/dist/server/flow-surfaces/support-matrix.d.ts +31 -0
- package/dist/server/flow-surfaces/support-matrix.js +259 -0
- package/dist/server/flow-surfaces/surface-context.d.ts +52 -0
- package/dist/server/flow-surfaces/surface-context.js +437 -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/plugin.js +2 -0
- package/dist/swagger/flow-surfaces.d.ts +5964 -0
- package/dist/swagger/flow-surfaces.examples.d.ts +1533 -0
- package/dist/swagger/flow-surfaces.examples.js +1758 -0
- package/dist/swagger/flow-surfaces.js +5315 -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 +5969 -0
- package/dist/swagger/index.js +50 -0
- package/package.json +2 -2
- /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,391 @@
|
|
|
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 field_binding_registry_exports = {};
|
|
28
|
+
__export(field_binding_registry_exports, {
|
|
29
|
+
getRegisteredFieldUses: () => getRegisteredFieldUses,
|
|
30
|
+
resolveRegisteredFieldBinding: () => resolveRegisteredFieldBinding
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(field_binding_registry_exports);
|
|
33
|
+
var import_field_semantics = require("./field-semantics");
|
|
34
|
+
var import_service_helpers = require("./service-helpers");
|
|
35
|
+
const FILE_MANAGER_PLUGIN = "@nocobase/plugin-file-manager";
|
|
36
|
+
const ATTACHMENT_URL_PLUGIN = "@nocobase/plugin-field-attachment-url";
|
|
37
|
+
const CODE_PLUGIN = "@nocobase/plugin-field-code";
|
|
38
|
+
const FORMULA_PLUGIN = "@nocobase/plugin-field-formula";
|
|
39
|
+
const CHINA_REGION_PLUGIN = "@nocobase/plugin-field-china-region";
|
|
40
|
+
const MAP_PLUGIN = "@nocobase/plugin-map";
|
|
41
|
+
const MARKDOWN_VDITOR_PLUGIN = "@nocobase/plugin-field-markdown-vditor";
|
|
42
|
+
const SORT_PLUGIN = "@nocobase/plugin-field-sort";
|
|
43
|
+
function getCollectionTemplate(collection) {
|
|
44
|
+
var _a;
|
|
45
|
+
return (collection == null ? void 0 : collection.template) || ((_a = collection == null ? void 0 : collection.options) == null ? void 0 : _a.template);
|
|
46
|
+
}
|
|
47
|
+
function isAttachmentInterface(field) {
|
|
48
|
+
return String((0, import_service_helpers.getFieldInterface)(field) || "").trim() === "attachment";
|
|
49
|
+
}
|
|
50
|
+
function getFieldDataType(field) {
|
|
51
|
+
var _a;
|
|
52
|
+
return (field == null ? void 0 : field.dataType) || ((_a = field == null ? void 0 : field.options) == null ? void 0 : _a.dataType);
|
|
53
|
+
}
|
|
54
|
+
function isNumericFormulaDataType(dataType) {
|
|
55
|
+
return ["integer", "bigInt", "double", "decimal", "number"].includes(String(dataType || "").trim());
|
|
56
|
+
}
|
|
57
|
+
function resolveTargetCollection(input) {
|
|
58
|
+
var _a;
|
|
59
|
+
if ((_a = input.field) == null ? void 0 : _a.targetCollection) {
|
|
60
|
+
return input.field.targetCollection;
|
|
61
|
+
}
|
|
62
|
+
if (!input.getCollection || !input.dataSourceKey) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
return (0, import_service_helpers.resolveFieldTargetCollection)(input.field, input.dataSourceKey, input.getCollection);
|
|
66
|
+
}
|
|
67
|
+
function normalizeBindingContainerUse(containerUse) {
|
|
68
|
+
const normalized = String(containerUse || "").trim();
|
|
69
|
+
if (normalized === "FormAssociationItemModel") {
|
|
70
|
+
return "DetailsItemModel";
|
|
71
|
+
}
|
|
72
|
+
return normalized;
|
|
73
|
+
}
|
|
74
|
+
function resolveBindingScope(containerUse) {
|
|
75
|
+
switch ((0, import_field_semantics.normalizeFieldContainerKind)(normalizeBindingContainerUse(containerUse))) {
|
|
76
|
+
case "table":
|
|
77
|
+
case "details":
|
|
78
|
+
return "display";
|
|
79
|
+
case "form":
|
|
80
|
+
return "editable";
|
|
81
|
+
case "filter-form":
|
|
82
|
+
return "filter";
|
|
83
|
+
default:
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function isRuleAvailable(rule, enabledPackages) {
|
|
88
|
+
if (!rule.ownerPlugin || !enabledPackages) {
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
return enabledPackages.has(rule.ownerPlugin);
|
|
92
|
+
}
|
|
93
|
+
function selectPreferredDefaultRule(rules) {
|
|
94
|
+
if (!rules.length) {
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
return rules.find((rule) => typeof rule.when === "function") || rules[0];
|
|
98
|
+
}
|
|
99
|
+
const FIELD_BINDING_RULE_DEFINITIONS = [
|
|
100
|
+
{
|
|
101
|
+
scope: "display",
|
|
102
|
+
modelClassName: "DisplayPreviewFieldModel",
|
|
103
|
+
interfaces: ["url", "attachment", "attachmentURL", "m2m", "m2o", "o2o", "o2m", "oho", "obo", "mbm"],
|
|
104
|
+
ownerPlugin: FILE_MANAGER_PLUGIN,
|
|
105
|
+
isDefault: true,
|
|
106
|
+
when: ({ field, targetCollection }) => isAttachmentInterface(field) || !targetCollection || getCollectionTemplate(targetCollection) === "file"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
scope: "editable",
|
|
110
|
+
modelClassName: "UploadFieldModel",
|
|
111
|
+
interfaces: ["attachment", "m2m", "m2o", "o2o", "o2m", "oho", "obo", "updatedBy", "createdBy", "mbm"],
|
|
112
|
+
ownerPlugin: FILE_MANAGER_PLUGIN,
|
|
113
|
+
isDefault: true,
|
|
114
|
+
order: 30,
|
|
115
|
+
when: ({ field, targetCollection }) => isAttachmentInterface(field) || !targetCollection || getCollectionTemplate(targetCollection) === "file"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
scope: "editable",
|
|
119
|
+
modelClassName: "AttachmentURLFieldModel",
|
|
120
|
+
interfaces: ["attachmentURL"],
|
|
121
|
+
ownerPlugin: ATTACHMENT_URL_PLUGIN,
|
|
122
|
+
isDefault: true
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
scope: "display",
|
|
126
|
+
modelClassName: "DisplayTextFieldModel",
|
|
127
|
+
interfaces: ["attachmentURL"],
|
|
128
|
+
ownerPlugin: ATTACHMENT_URL_PLUGIN,
|
|
129
|
+
isDefault: true
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
scope: "editable",
|
|
133
|
+
modelClassName: "CodeFieldModel",
|
|
134
|
+
interfaces: ["code"],
|
|
135
|
+
ownerPlugin: CODE_PLUGIN,
|
|
136
|
+
isDefault: true
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
scope: "display",
|
|
140
|
+
modelClassName: "DisplayCodeFieldModel",
|
|
141
|
+
interfaces: ["code"],
|
|
142
|
+
ownerPlugin: CODE_PLUGIN,
|
|
143
|
+
isDefault: true
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
scope: "filter",
|
|
147
|
+
modelClassName: "InputFieldModel",
|
|
148
|
+
interfaces: ["code"],
|
|
149
|
+
ownerPlugin: CODE_PLUGIN,
|
|
150
|
+
isDefault: true
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
scope: "editable",
|
|
154
|
+
modelClassName: "VditorFieldModel",
|
|
155
|
+
interfaces: ["vditor", "markdown"],
|
|
156
|
+
ownerPlugin: MARKDOWN_VDITOR_PLUGIN,
|
|
157
|
+
isDefault: true
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
scope: "display",
|
|
161
|
+
modelClassName: "DisplayVditorFieldModel",
|
|
162
|
+
interfaces: ["vditor", "markdown"],
|
|
163
|
+
ownerPlugin: MARKDOWN_VDITOR_PLUGIN,
|
|
164
|
+
isDefault: true
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
scope: "editable",
|
|
168
|
+
modelClassName: "ChinaRegionFieldModel",
|
|
169
|
+
interfaces: ["chinaRegion"],
|
|
170
|
+
ownerPlugin: CHINA_REGION_PLUGIN,
|
|
171
|
+
isDefault: true
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
scope: "display",
|
|
175
|
+
modelClassName: "DisplayChinaRegionFieldModel",
|
|
176
|
+
interfaces: ["chinaRegion"],
|
|
177
|
+
ownerPlugin: CHINA_REGION_PLUGIN,
|
|
178
|
+
isDefault: true
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
scope: "editable",
|
|
182
|
+
modelClassName: "SortFieldModel",
|
|
183
|
+
interfaces: ["sort"],
|
|
184
|
+
ownerPlugin: SORT_PLUGIN,
|
|
185
|
+
isDefault: true
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
scope: "display",
|
|
189
|
+
modelClassName: "DisplayNumberFieldModel",
|
|
190
|
+
interfaces: ["sort"],
|
|
191
|
+
ownerPlugin: SORT_PLUGIN,
|
|
192
|
+
isDefault: true
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
scope: "editable",
|
|
196
|
+
modelClassName: "PointFieldModel",
|
|
197
|
+
interfaces: ["point"],
|
|
198
|
+
ownerPlugin: MAP_PLUGIN,
|
|
199
|
+
isDefault: true
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
scope: "editable",
|
|
203
|
+
modelClassName: "CircleFieldModel",
|
|
204
|
+
interfaces: ["circle"],
|
|
205
|
+
ownerPlugin: MAP_PLUGIN,
|
|
206
|
+
isDefault: true
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
scope: "editable",
|
|
210
|
+
modelClassName: "PolygonFieldModel",
|
|
211
|
+
interfaces: ["polygon"],
|
|
212
|
+
ownerPlugin: MAP_PLUGIN,
|
|
213
|
+
isDefault: true
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
scope: "editable",
|
|
217
|
+
modelClassName: "LineStringFieldModel",
|
|
218
|
+
interfaces: ["lineString"],
|
|
219
|
+
ownerPlugin: MAP_PLUGIN,
|
|
220
|
+
isDefault: true
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
scope: "display",
|
|
224
|
+
modelClassName: "DisplayPointFieldModel",
|
|
225
|
+
interfaces: ["point"],
|
|
226
|
+
ownerPlugin: MAP_PLUGIN,
|
|
227
|
+
isDefault: true
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
scope: "display",
|
|
231
|
+
modelClassName: "DisplayCircleFieldModel",
|
|
232
|
+
interfaces: ["circle"],
|
|
233
|
+
ownerPlugin: MAP_PLUGIN,
|
|
234
|
+
isDefault: true
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
scope: "display",
|
|
238
|
+
modelClassName: "DisplayPolygonFieldModel",
|
|
239
|
+
interfaces: ["polygon"],
|
|
240
|
+
ownerPlugin: MAP_PLUGIN,
|
|
241
|
+
isDefault: true
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
scope: "display",
|
|
245
|
+
modelClassName: "DisplayLineStringFieldModel",
|
|
246
|
+
interfaces: ["lineString"],
|
|
247
|
+
ownerPlugin: MAP_PLUGIN,
|
|
248
|
+
isDefault: true
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
scope: "editable",
|
|
252
|
+
modelClassName: "FormulaFieldModel",
|
|
253
|
+
interfaces: ["formula"],
|
|
254
|
+
ownerPlugin: FORMULA_PLUGIN,
|
|
255
|
+
isDefault: true
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
scope: "display",
|
|
259
|
+
modelClassName: "DisplayCheckboxFieldModel",
|
|
260
|
+
interfaces: ["formula"],
|
|
261
|
+
ownerPlugin: FORMULA_PLUGIN,
|
|
262
|
+
isDefault: true,
|
|
263
|
+
when: ({ field }) => getFieldDataType(field) === "boolean"
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
scope: "display",
|
|
267
|
+
modelClassName: "DisplayDateTimeFieldModel",
|
|
268
|
+
interfaces: ["formula"],
|
|
269
|
+
ownerPlugin: FORMULA_PLUGIN,
|
|
270
|
+
isDefault: true,
|
|
271
|
+
when: ({ field }) => getFieldDataType(field) === "date"
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
scope: "display",
|
|
275
|
+
modelClassName: "DisplayTextFieldModel",
|
|
276
|
+
interfaces: ["formula"],
|
|
277
|
+
ownerPlugin: FORMULA_PLUGIN,
|
|
278
|
+
isDefault: true,
|
|
279
|
+
when: ({ field }) => getFieldDataType(field) === "string"
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
scope: "display",
|
|
283
|
+
modelClassName: "DisplayNumberFieldModel",
|
|
284
|
+
interfaces: ["formula"],
|
|
285
|
+
ownerPlugin: FORMULA_PLUGIN,
|
|
286
|
+
isDefault: true,
|
|
287
|
+
when: ({ field }) => ["double", "bigInt", "integer"].includes(String(getFieldDataType(field) || "").trim())
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
scope: "filter",
|
|
291
|
+
modelClassName: "InputFieldModel",
|
|
292
|
+
interfaces: ["formula"],
|
|
293
|
+
ownerPlugin: FORMULA_PLUGIN,
|
|
294
|
+
when: ({ field }) => {
|
|
295
|
+
const dataType = String(getFieldDataType(field) || "").trim();
|
|
296
|
+
return !["date", "boolean", "integer", "bigInt", "double", "decimal", "number"].includes(dataType);
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
scope: "filter",
|
|
301
|
+
modelClassName: "DateTimeFilterFieldModel",
|
|
302
|
+
interfaces: ["formula"],
|
|
303
|
+
ownerPlugin: FORMULA_PLUGIN,
|
|
304
|
+
when: ({ field }) => getFieldDataType(field) === "date"
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
scope: "filter",
|
|
308
|
+
modelClassName: "CheckboxFieldModel",
|
|
309
|
+
interfaces: ["formula"],
|
|
310
|
+
ownerPlugin: FORMULA_PLUGIN,
|
|
311
|
+
when: ({ field }) => getFieldDataType(field) === "boolean"
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
scope: "filter",
|
|
315
|
+
modelClassName: "NumberFieldModel",
|
|
316
|
+
interfaces: ["formula"],
|
|
317
|
+
ownerPlugin: FORMULA_PLUGIN,
|
|
318
|
+
when: ({ field }) => isNumericFormulaDataType(getFieldDataType(field))
|
|
319
|
+
}
|
|
320
|
+
];
|
|
321
|
+
const FIELD_BINDING_RULES = FIELD_BINDING_RULE_DEFINITIONS.map((rule, index) => ({
|
|
322
|
+
...rule,
|
|
323
|
+
index
|
|
324
|
+
}));
|
|
325
|
+
function getRegisteredFieldUses(scope, enabledPackages) {
|
|
326
|
+
const uses = /* @__PURE__ */ new Set();
|
|
327
|
+
FIELD_BINDING_RULES.forEach((rule) => {
|
|
328
|
+
if (scope && rule.scope !== scope) {
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
if (!isRuleAvailable(rule, enabledPackages)) {
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
uses.add(rule.modelClassName);
|
|
335
|
+
});
|
|
336
|
+
return uses;
|
|
337
|
+
}
|
|
338
|
+
function resolveRegisteredFieldBinding(input) {
|
|
339
|
+
const scope = resolveBindingScope(input.containerUse);
|
|
340
|
+
const fieldInterface = String((0, import_service_helpers.getFieldInterface)(input.field) || "").trim();
|
|
341
|
+
if (!scope || !fieldInterface) {
|
|
342
|
+
return null;
|
|
343
|
+
}
|
|
344
|
+
const targetCollection = resolveTargetCollection(input);
|
|
345
|
+
const candidates = FIELD_BINDING_RULES.filter((rule) => {
|
|
346
|
+
if (rule.scope !== scope) {
|
|
347
|
+
return false;
|
|
348
|
+
}
|
|
349
|
+
if (!rule.interfaces.includes(fieldInterface)) {
|
|
350
|
+
return false;
|
|
351
|
+
}
|
|
352
|
+
if (!isRuleAvailable(rule, input.enabledPackages)) {
|
|
353
|
+
return false;
|
|
354
|
+
}
|
|
355
|
+
if (!rule.when) {
|
|
356
|
+
return true;
|
|
357
|
+
}
|
|
358
|
+
return rule.when({
|
|
359
|
+
...input,
|
|
360
|
+
targetCollection
|
|
361
|
+
});
|
|
362
|
+
}).sort((a, b) => {
|
|
363
|
+
const orderDelta = Number(a.order || 0) - Number(b.order || 0);
|
|
364
|
+
return orderDelta || a.index - b.index;
|
|
365
|
+
});
|
|
366
|
+
const defaultRule = selectPreferredDefaultRule(candidates.filter((rule) => rule.isDefault));
|
|
367
|
+
if (defaultRule) {
|
|
368
|
+
return {
|
|
369
|
+
modelClassName: defaultRule.modelClassName,
|
|
370
|
+
ownerPlugin: defaultRule.ownerPlugin,
|
|
371
|
+
isDefault: true
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
if (input.useStrictOnly) {
|
|
375
|
+
return null;
|
|
376
|
+
}
|
|
377
|
+
const fallbackRule = candidates[0];
|
|
378
|
+
if (!fallbackRule) {
|
|
379
|
+
return null;
|
|
380
|
+
}
|
|
381
|
+
return {
|
|
382
|
+
modelClassName: fallbackRule.modelClassName,
|
|
383
|
+
ownerPlugin: fallbackRule.ownerPlugin,
|
|
384
|
+
isDefault: !!fallbackRule.isDefault
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
388
|
+
0 && (module.exports = {
|
|
389
|
+
getRegisteredFieldUses,
|
|
390
|
+
resolveRegisteredFieldBinding
|
|
391
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
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 MULTI_VALUE_ASSOCIATION_INTERFACES: Set<string>;
|
|
10
|
+
export declare function normalizeFieldContainerKind(containerUse?: string): "form" | "details" | "table" | "filter-form";
|
|
11
|
+
export declare function shouldUseAssociationTitleTextDisplay(input: {
|
|
12
|
+
containerUse?: string;
|
|
13
|
+
associationPathName?: string;
|
|
14
|
+
fieldInterface?: string | null;
|
|
15
|
+
}): boolean;
|
|
@@ -0,0 +1,81 @@
|
|
|
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 field_semantics_exports = {};
|
|
28
|
+
__export(field_semantics_exports, {
|
|
29
|
+
MULTI_VALUE_ASSOCIATION_INTERFACES: () => MULTI_VALUE_ASSOCIATION_INTERFACES,
|
|
30
|
+
normalizeFieldContainerKind: () => normalizeFieldContainerKind,
|
|
31
|
+
shouldUseAssociationTitleTextDisplay: () => shouldUseAssociationTitleTextDisplay
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(field_semantics_exports);
|
|
34
|
+
var import_approval = require("./approval");
|
|
35
|
+
const FORM_FIELD_CONTAINER_USES = /* @__PURE__ */ new Set([
|
|
36
|
+
"FormBlockModel",
|
|
37
|
+
"CreateFormModel",
|
|
38
|
+
"EditFormModel",
|
|
39
|
+
"FormGridModel",
|
|
40
|
+
"FormItemModel",
|
|
41
|
+
"AssignFormModel",
|
|
42
|
+
"AssignFormGridModel"
|
|
43
|
+
]);
|
|
44
|
+
const DETAILS_FIELD_CONTAINER_USES = /* @__PURE__ */ new Set([
|
|
45
|
+
"DetailsBlockModel",
|
|
46
|
+
"DetailsGridModel",
|
|
47
|
+
"DetailsItemModel",
|
|
48
|
+
"ListBlockModel",
|
|
49
|
+
"GridCardBlockModel",
|
|
50
|
+
"ListItemModel",
|
|
51
|
+
"GridCardItemModel"
|
|
52
|
+
]);
|
|
53
|
+
const FILTER_FIELD_CONTAINER_USES = /* @__PURE__ */ new Set(["FilterFormBlockModel", "FilterFormGridModel", "FilterFormItemModel"]);
|
|
54
|
+
const TABLE_FIELD_CONTAINER_USES = /* @__PURE__ */ new Set(["TableBlockModel", "TableColumnModel"]);
|
|
55
|
+
const MULTI_VALUE_ASSOCIATION_INTERFACES = /* @__PURE__ */ new Set(["m2m", "o2m", "mbm"]);
|
|
56
|
+
function normalizeFieldContainerKind(containerUse) {
|
|
57
|
+
const normalized = (0, import_approval.normalizeApprovalSemanticUse)(containerUse);
|
|
58
|
+
if (FORM_FIELD_CONTAINER_USES.has(normalized)) {
|
|
59
|
+
return "form";
|
|
60
|
+
}
|
|
61
|
+
if (DETAILS_FIELD_CONTAINER_USES.has(normalized)) {
|
|
62
|
+
return "details";
|
|
63
|
+
}
|
|
64
|
+
if (FILTER_FIELD_CONTAINER_USES.has(normalized)) {
|
|
65
|
+
return "filter-form";
|
|
66
|
+
}
|
|
67
|
+
if (TABLE_FIELD_CONTAINER_USES.has(normalized)) {
|
|
68
|
+
return "table";
|
|
69
|
+
}
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
function shouldUseAssociationTitleTextDisplay(input) {
|
|
73
|
+
const containerKind = normalizeFieldContainerKind(input.containerUse);
|
|
74
|
+
return (containerKind === "table" || containerKind === "details") && !String(input.associationPathName || "").trim() && MULTI_VALUE_ASSOCIATION_INTERFACES.has(String(input.fieldInterface || "").trim());
|
|
75
|
+
}
|
|
76
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
77
|
+
0 && (module.exports = {
|
|
78
|
+
MULTI_VALUE_ASSOCIATION_INTERFACES,
|
|
79
|
+
normalizeFieldContainerKind,
|
|
80
|
+
shouldUseAssociationTitleTextDisplay
|
|
81
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
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_EMPTY_FILTER_GROUP: {
|
|
10
|
+
logic: string;
|
|
11
|
+
items: any[];
|
|
12
|
+
};
|
|
13
|
+
export declare const FLOW_SURFACE_FILTER_GROUP_EXAMPLE: string;
|
|
14
|
+
export declare function normalizeFlowSurfaceFilterGroupValue(value: any, errorPrefix: string): any;
|
|
15
|
+
export declare function assertFlowSurfaceFilterGroupShape(filter: any): void;
|
|
@@ -0,0 +1,94 @@
|
|
|
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 filter_group_exports = {};
|
|
38
|
+
__export(filter_group_exports, {
|
|
39
|
+
FLOW_SURFACE_EMPTY_FILTER_GROUP: () => FLOW_SURFACE_EMPTY_FILTER_GROUP,
|
|
40
|
+
FLOW_SURFACE_FILTER_GROUP_EXAMPLE: () => FLOW_SURFACE_FILTER_GROUP_EXAMPLE,
|
|
41
|
+
assertFlowSurfaceFilterGroupShape: () => assertFlowSurfaceFilterGroupShape,
|
|
42
|
+
normalizeFlowSurfaceFilterGroupValue: () => normalizeFlowSurfaceFilterGroupValue
|
|
43
|
+
});
|
|
44
|
+
module.exports = __toCommonJS(filter_group_exports);
|
|
45
|
+
var import_utils = require("@nocobase/utils");
|
|
46
|
+
var import_lodash = __toESM(require("lodash"));
|
|
47
|
+
var import_errors = require("./errors");
|
|
48
|
+
const FLOW_SURFACE_EMPTY_FILTER_GROUP = {
|
|
49
|
+
logic: "$and",
|
|
50
|
+
items: []
|
|
51
|
+
};
|
|
52
|
+
const FLOW_SURFACE_FILTER_GROUP_EXAMPLE = JSON.stringify(FLOW_SURFACE_EMPTY_FILTER_GROUP);
|
|
53
|
+
function normalizeFlowSurfaceFilterGroupValue(value, errorPrefix) {
|
|
54
|
+
const normalized = value === null || import_lodash.default.isPlainObject(value) && !Object.keys(value).length ? import_lodash.default.cloneDeep(FLOW_SURFACE_EMPTY_FILTER_GROUP) : import_lodash.default.cloneDeep(value);
|
|
55
|
+
try {
|
|
56
|
+
assertFlowSurfaceFilterGroupShape(normalized);
|
|
57
|
+
(0, import_utils.transformFilter)(normalized);
|
|
58
|
+
return normalized;
|
|
59
|
+
} catch (error) {
|
|
60
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
61
|
+
(0, import_errors.throwBadRequest)(`${errorPrefix}: ${reason}`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function assertFlowSurfaceFilterGroupShape(filter) {
|
|
65
|
+
if (!import_lodash.default.isPlainObject(filter)) {
|
|
66
|
+
throw new Error("Invalid filter: filter must be an object");
|
|
67
|
+
}
|
|
68
|
+
if (!("logic" in filter) || !("items" in filter)) {
|
|
69
|
+
throw new Error("Invalid filter: filter must have logic and items properties");
|
|
70
|
+
}
|
|
71
|
+
if (filter.logic !== "$and" && filter.logic !== "$or") {
|
|
72
|
+
throw new Error("Invalid filter: logic must be '$and' or '$or'");
|
|
73
|
+
}
|
|
74
|
+
if (!Array.isArray(filter.items)) {
|
|
75
|
+
throw new Error("Invalid filter: items must be an array");
|
|
76
|
+
}
|
|
77
|
+
filter.items.forEach((item) => {
|
|
78
|
+
if (import_lodash.default.isPlainObject(item) && "logic" in item && "items" in item) {
|
|
79
|
+
assertFlowSurfaceFilterGroupShape(item);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (import_lodash.default.isPlainObject(item) && typeof item.path === "string" && typeof item.operator === "string") {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
throw new Error("Invalid filter item type");
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
89
|
+
0 && (module.exports = {
|
|
90
|
+
FLOW_SURFACE_EMPTY_FILTER_GROUP,
|
|
91
|
+
FLOW_SURFACE_FILTER_GROUP_EXAMPLE,
|
|
92
|
+
assertFlowSurfaceFilterGroupShape,
|
|
93
|
+
normalizeFlowSurfaceFilterGroupValue
|
|
94
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
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 { Plugin } from '@nocobase/server';
|
|
10
|
+
import { FlowSurfacesService } from './service';
|
|
11
|
+
export declare function registerFlowSurfacesResource(plugin: Plugin): FlowSurfacesService;
|