@nocobase/plugin-flow-engine 2.1.0-beta.20 → 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/dist/externalVersion.js +10 -10
- package/dist/node_modules/ses/package.json +1 -1
- package/dist/node_modules/zod/package.json +1 -1
- package/dist/server/flow-surfaces/apply/compiler.js +4 -2
- 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/blueprint/compile-blocks.js +50 -5
- package/dist/server/flow-surfaces/blueprint/public-types.d.ts +9 -1
- package/dist/server/flow-surfaces/builder.d.ts +27 -1
- package/dist/server/flow-surfaces/builder.js +36 -4
- package/dist/server/flow-surfaces/catalog.d.ts +1 -0
- package/dist/server/flow-surfaces/catalog.js +129 -13
- package/dist/server/flow-surfaces/compose-compiler.d.ts +8 -0
- package/dist/server/flow-surfaces/compose-compiler.js +8 -0
- package/dist/server/flow-surfaces/configure-options.js +39 -6
- package/dist/server/flow-surfaces/default-action-popup.js +2 -2
- package/dist/server/flow-surfaces/field-binding-registry.d.ts +1 -0
- package/dist/server/flow-surfaces/field-binding-registry.js +5 -0
- package/dist/server/flow-surfaces/field-semantics.d.ts +1 -1
- package/dist/server/flow-surfaces/field-semantics.js +4 -3
- 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/node-use-sets.js +1 -0
- package/dist/server/flow-surfaces/service-utils.d.ts +13 -1
- package/dist/server/flow-surfaces/service-utils.js +58 -6
- package/dist/server/flow-surfaces/service.d.ts +17 -1
- package/dist/server/flow-surfaces/service.js +820 -53
- package/dist/server/flow-surfaces/support-matrix.js +11 -0
- package/dist/swagger/flow-surfaces.d.ts +173 -2
- package/dist/swagger/flow-surfaces.examples.d.ts +20 -15
- package/dist/swagger/flow-surfaces.examples.js +22 -11
- package/dist/swagger/flow-surfaces.js +72 -10
- package/dist/swagger/index.d.ts +173 -2
- package/package.json +2 -2
|
@@ -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 field_type_resolver_exports = {};
|
|
38
|
+
__export(field_type_resolver_exports, {
|
|
39
|
+
FLOW_SURFACE_INTERNAL_FIELD_KEYS: () => FLOW_SURFACE_INTERNAL_FIELD_KEYS,
|
|
40
|
+
FLOW_SURFACE_PUBLIC_FIELD_TYPE_SET: () => FLOW_SURFACE_PUBLIC_FIELD_TYPE_SET,
|
|
41
|
+
FLOW_SURFACE_PUBLIC_RELATION_FIELD_TYPES: () => FLOW_SURFACE_PUBLIC_RELATION_FIELD_TYPES,
|
|
42
|
+
FLOW_SURFACE_RESERVED_RELATION_FIELD_TYPES: () => FLOW_SURFACE_RESERVED_RELATION_FIELD_TYPES,
|
|
43
|
+
assertNoInternalFieldKeys: () => assertNoInternalFieldKeys,
|
|
44
|
+
getPublicFieldTypeForUse: () => getPublicFieldTypeForUse,
|
|
45
|
+
normalizePublicFieldNameList: () => normalizePublicFieldNameList,
|
|
46
|
+
normalizePublicFieldType: () => normalizePublicFieldType,
|
|
47
|
+
resolveRelationFieldType: () => resolveRelationFieldType,
|
|
48
|
+
usesNestedRelationFields: () => usesNestedRelationFields
|
|
49
|
+
});
|
|
50
|
+
module.exports = __toCommonJS(field_type_resolver_exports);
|
|
51
|
+
var import_lodash = __toESM(require("lodash"));
|
|
52
|
+
var import_errors = require("./errors");
|
|
53
|
+
var import_association_interfaces = require("./association-interfaces");
|
|
54
|
+
var import_field_semantics = require("./field-semantics");
|
|
55
|
+
var import_service_helpers = require("./service-helpers");
|
|
56
|
+
var import_association_title_field = require("./association-title-field");
|
|
57
|
+
const FLOW_SURFACE_PUBLIC_RELATION_FIELD_TYPES = [
|
|
58
|
+
"text",
|
|
59
|
+
"select",
|
|
60
|
+
"picker",
|
|
61
|
+
"subForm",
|
|
62
|
+
"subFormList",
|
|
63
|
+
"subDetails",
|
|
64
|
+
"subDetailsList",
|
|
65
|
+
"subTable",
|
|
66
|
+
"popupSubTable"
|
|
67
|
+
];
|
|
68
|
+
const FLOW_SURFACE_RESERVED_RELATION_FIELD_TYPES = ["cascade", "upload", "preview"];
|
|
69
|
+
const FLOW_SURFACE_PUBLIC_FIELD_TYPE_SET = /* @__PURE__ */ new Set([
|
|
70
|
+
...FLOW_SURFACE_PUBLIC_RELATION_FIELD_TYPES,
|
|
71
|
+
...FLOW_SURFACE_RESERVED_RELATION_FIELD_TYPES
|
|
72
|
+
]);
|
|
73
|
+
const FLOW_SURFACE_INTERNAL_FIELD_KEYS = [
|
|
74
|
+
"fieldComponent",
|
|
75
|
+
"fieldModel",
|
|
76
|
+
"componentFields",
|
|
77
|
+
"use",
|
|
78
|
+
"fieldUse",
|
|
79
|
+
"subModels",
|
|
80
|
+
"props",
|
|
81
|
+
"stepParams"
|
|
82
|
+
];
|
|
83
|
+
const FIELD_USE_TO_PUBLIC_FIELD_TYPE = {
|
|
84
|
+
DisplayTextFieldModel: "text",
|
|
85
|
+
RecordSelectFieldModel: "select",
|
|
86
|
+
RecordPickerFieldModel: "picker",
|
|
87
|
+
SubFormFieldModel: "subForm",
|
|
88
|
+
SubFormListFieldModel: "subFormList",
|
|
89
|
+
DisplaySubItemFieldModel: "subDetails",
|
|
90
|
+
DisplaySubListFieldModel: "subDetailsList",
|
|
91
|
+
DisplaySubTableFieldModel: "subTable",
|
|
92
|
+
SubTableFieldModel: "subTable",
|
|
93
|
+
PopupSubTableFieldModel: "popupSubTable"
|
|
94
|
+
};
|
|
95
|
+
const FIELD_TYPES_WITH_FIELDS = /* @__PURE__ */ new Set([
|
|
96
|
+
"subForm",
|
|
97
|
+
"subFormList",
|
|
98
|
+
"subDetails",
|
|
99
|
+
"subDetailsList",
|
|
100
|
+
"subTable",
|
|
101
|
+
"popupSubTable"
|
|
102
|
+
]);
|
|
103
|
+
const FIELD_TYPES_WITH_SELECTOR_FIELDS = /* @__PURE__ */ new Set(["picker"]);
|
|
104
|
+
const FIELD_TYPES_WITH_TABLE_PROPS = /* @__PURE__ */ new Set(["subTable", "popupSubTable"]);
|
|
105
|
+
function assertNoInternalFieldKeys(input, context) {
|
|
106
|
+
if (!import_lodash.default.isPlainObject(input)) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
const forbidden = FLOW_SURFACE_INTERNAL_FIELD_KEYS.filter((key) => Object.prototype.hasOwnProperty.call(input, key));
|
|
110
|
+
if (forbidden.length) {
|
|
111
|
+
(0, import_errors.throwBadRequest)(`${context} does not accept internal field keys: ${forbidden.join(", ")}`);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
function normalizePublicFieldType(value, context) {
|
|
115
|
+
if (import_lodash.default.isUndefined(value) || import_lodash.default.isNull(value) || value === "") {
|
|
116
|
+
return void 0;
|
|
117
|
+
}
|
|
118
|
+
const normalized = String(value || "").trim();
|
|
119
|
+
if (!normalized) {
|
|
120
|
+
return void 0;
|
|
121
|
+
}
|
|
122
|
+
if (FLOW_SURFACE_RESERVED_RELATION_FIELD_TYPES.includes(normalized)) {
|
|
123
|
+
(0, import_errors.throwBadRequest)(`flowSurfaces ${context} fieldType '${normalized}' is reserved for plugin-specific field types`);
|
|
124
|
+
}
|
|
125
|
+
if (!FLOW_SURFACE_PUBLIC_RELATION_FIELD_TYPES.includes(normalized)) {
|
|
126
|
+
(0, import_errors.throwBadRequest)(
|
|
127
|
+
`flowSurfaces ${context} fieldType '${normalized}' is not supported; supported fieldTypes: ${FLOW_SURFACE_PUBLIC_RELATION_FIELD_TYPES.join(
|
|
128
|
+
", "
|
|
129
|
+
)}`
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
return normalized;
|
|
133
|
+
}
|
|
134
|
+
function normalizePublicFieldNameList(value, context) {
|
|
135
|
+
if (import_lodash.default.isUndefined(value)) {
|
|
136
|
+
return void 0;
|
|
137
|
+
}
|
|
138
|
+
if (!Array.isArray(value)) {
|
|
139
|
+
(0, import_errors.throwBadRequest)(`flowSurfaces ${context} must be an array of field names`);
|
|
140
|
+
}
|
|
141
|
+
return value.map((item, index) => {
|
|
142
|
+
const normalized = String(item || "").trim();
|
|
143
|
+
if (!normalized) {
|
|
144
|
+
(0, import_errors.throwBadRequest)(`flowSurfaces ${context}[${index + 1}] cannot be empty`);
|
|
145
|
+
}
|
|
146
|
+
return normalized;
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
function getPublicFieldTypeForUse(use) {
|
|
150
|
+
return FIELD_USE_TO_PUBLIC_FIELD_TYPE[String(use || "").trim()];
|
|
151
|
+
}
|
|
152
|
+
function getAssociationCardinality(field) {
|
|
153
|
+
const fieldInterface = String((0, import_service_helpers.getFieldInterface)(field) || "").trim();
|
|
154
|
+
if (import_association_interfaces.SINGLE_VALUE_ASSOCIATION_INTERFACES.has(fieldInterface)) {
|
|
155
|
+
return "single";
|
|
156
|
+
}
|
|
157
|
+
if (import_association_interfaces.MULTI_VALUE_ASSOCIATION_INTERFACES.has(fieldInterface)) {
|
|
158
|
+
return "multi";
|
|
159
|
+
}
|
|
160
|
+
return null;
|
|
161
|
+
}
|
|
162
|
+
function pickCollectionFallbackFieldName(collection) {
|
|
163
|
+
var _a;
|
|
164
|
+
const safeTitleFieldName = (_a = (0, import_association_title_field.resolveCollectionSafeTitleField)(collection)) == null ? void 0 : _a.fieldName;
|
|
165
|
+
if (safeTitleFieldName && (0, import_service_helpers.resolveFieldFromCollection)(collection, safeTitleFieldName)) {
|
|
166
|
+
return safeTitleFieldName;
|
|
167
|
+
}
|
|
168
|
+
const primaryField = (0, import_service_helpers.getCollectionFields)(collection).find(
|
|
169
|
+
(field) => {
|
|
170
|
+
var _a2;
|
|
171
|
+
return !!(field == null ? void 0 : field.primaryKey) || !!((_a2 = field == null ? void 0 : field.options) == null ? void 0 : _a2.primaryKey);
|
|
172
|
+
}
|
|
173
|
+
);
|
|
174
|
+
return (0, import_service_helpers.getFieldName)(primaryField) || "id";
|
|
175
|
+
}
|
|
176
|
+
function assertTargetFieldNamesExist(targetCollection, fields, context) {
|
|
177
|
+
fields.forEach((fieldName) => {
|
|
178
|
+
if (!(0, import_service_helpers.resolveFieldFromCollection)(targetCollection, fieldName)) {
|
|
179
|
+
(0, import_errors.throwBadRequest)(`flowSurfaces ${context} field '${fieldName}' does not exist on relation target collection`);
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
function resolveRelationFieldType(input) {
|
|
184
|
+
const fieldType = normalizePublicFieldType(input.fieldType, input.context);
|
|
185
|
+
if (!fieldType) {
|
|
186
|
+
return void 0;
|
|
187
|
+
}
|
|
188
|
+
if (!(0, import_service_helpers.isAssociationField)(input.field)) {
|
|
189
|
+
throw new import_errors.FlowSurfaceBadRequestError("flowSurfaces fieldType is only supported for relation fields");
|
|
190
|
+
}
|
|
191
|
+
const targetCollection = (0, import_service_helpers.resolveFieldTargetCollection)(
|
|
192
|
+
input.field,
|
|
193
|
+
input.dataSourceKey || "main",
|
|
194
|
+
input.getCollection
|
|
195
|
+
);
|
|
196
|
+
if (!targetCollection) {
|
|
197
|
+
(0, import_errors.throwBadRequest)(`flowSurfaces ${input.context} fieldType '${fieldType}' cannot resolve relation target collection`);
|
|
198
|
+
}
|
|
199
|
+
const cardinality = getAssociationCardinality(input.field);
|
|
200
|
+
if (!cardinality) {
|
|
201
|
+
(0, import_errors.throwBadRequest)(`flowSurfaces ${input.context} fieldType '${fieldType}' is not supported for this relation field`);
|
|
202
|
+
}
|
|
203
|
+
const containerKind = (0, import_field_semantics.normalizeFieldContainerKind)(input.containerUse);
|
|
204
|
+
let fieldUse;
|
|
205
|
+
switch (fieldType) {
|
|
206
|
+
case "text":
|
|
207
|
+
fieldUse = containerKind === "form" ? "RecordSelectFieldModel" : "DisplayTextFieldModel";
|
|
208
|
+
break;
|
|
209
|
+
case "select":
|
|
210
|
+
fieldUse = "RecordSelectFieldModel";
|
|
211
|
+
break;
|
|
212
|
+
case "picker":
|
|
213
|
+
fieldUse = "RecordPickerFieldModel";
|
|
214
|
+
break;
|
|
215
|
+
case "subForm":
|
|
216
|
+
if (cardinality !== "single") {
|
|
217
|
+
(0, import_errors.throwBadRequest)(`flowSurfaces ${input.context} fieldType 'subForm' only supports single relation fields`);
|
|
218
|
+
}
|
|
219
|
+
fieldUse = "SubFormFieldModel";
|
|
220
|
+
break;
|
|
221
|
+
case "subFormList":
|
|
222
|
+
if (cardinality !== "multi") {
|
|
223
|
+
(0, import_errors.throwBadRequest)(`flowSurfaces ${input.context} fieldType 'subFormList' only supports multi relation fields`);
|
|
224
|
+
}
|
|
225
|
+
fieldUse = "SubFormListFieldModel";
|
|
226
|
+
break;
|
|
227
|
+
case "subDetails":
|
|
228
|
+
if (cardinality !== "single") {
|
|
229
|
+
(0, import_errors.throwBadRequest)(`flowSurfaces ${input.context} fieldType 'subDetails' only supports single relation fields`);
|
|
230
|
+
}
|
|
231
|
+
fieldUse = "DisplaySubItemFieldModel";
|
|
232
|
+
break;
|
|
233
|
+
case "subDetailsList":
|
|
234
|
+
if (cardinality !== "multi") {
|
|
235
|
+
(0, import_errors.throwBadRequest)(`flowSurfaces ${input.context} fieldType 'subDetailsList' only supports multi relation fields`);
|
|
236
|
+
}
|
|
237
|
+
fieldUse = "DisplaySubListFieldModel";
|
|
238
|
+
break;
|
|
239
|
+
case "subTable":
|
|
240
|
+
if (cardinality !== "multi") {
|
|
241
|
+
(0, import_errors.throwBadRequest)(`flowSurfaces ${input.context} fieldType 'subTable' only supports multi relation fields`);
|
|
242
|
+
}
|
|
243
|
+
fieldUse = containerKind === "form" ? "SubTableFieldModel" : "DisplaySubTableFieldModel";
|
|
244
|
+
break;
|
|
245
|
+
case "popupSubTable":
|
|
246
|
+
if (cardinality !== "multi") {
|
|
247
|
+
(0, import_errors.throwBadRequest)(`flowSurfaces ${input.context} fieldType 'popupSubTable' only supports multi relation fields`);
|
|
248
|
+
}
|
|
249
|
+
fieldUse = "PopupSubTableFieldModel";
|
|
250
|
+
break;
|
|
251
|
+
}
|
|
252
|
+
const explicitFields = normalizePublicFieldNameList(input.fields, `${input.context}.fields`);
|
|
253
|
+
const explicitSelectorFields = normalizePublicFieldNameList(input.selectorFields, `${input.context}.selectorFields`);
|
|
254
|
+
if (explicitFields && explicitSelectorFields) {
|
|
255
|
+
(0, import_errors.throwBadRequest)(`flowSurfaces ${input.context} cannot mix fields and selectorFields on the same field`);
|
|
256
|
+
}
|
|
257
|
+
if (explicitFields && !FIELD_TYPES_WITH_FIELDS.has(fieldType)) {
|
|
258
|
+
(0, import_errors.throwBadRequest)(`flowSurfaces ${input.context} fieldType '${fieldType}' does not support fields`);
|
|
259
|
+
}
|
|
260
|
+
if (explicitSelectorFields && !FIELD_TYPES_WITH_SELECTOR_FIELDS.has(fieldType)) {
|
|
261
|
+
(0, import_errors.throwBadRequest)(`flowSurfaces ${input.context} fieldType '${fieldType}' does not support selectorFields`);
|
|
262
|
+
}
|
|
263
|
+
if ((!import_lodash.default.isUndefined(input.openMode) || !import_lodash.default.isUndefined(input.popupSize)) && fieldType !== "picker") {
|
|
264
|
+
(0, import_errors.throwBadRequest)(`flowSurfaces ${input.context} fieldType '${fieldType}' does not support openMode or popupSize`);
|
|
265
|
+
}
|
|
266
|
+
if ((!import_lodash.default.isUndefined(input.pageSize) || !import_lodash.default.isUndefined(input.showIndex)) && !FIELD_TYPES_WITH_TABLE_PROPS.has(fieldType)) {
|
|
267
|
+
(0, import_errors.throwBadRequest)(`flowSurfaces ${input.context} fieldType '${fieldType}' does not support pageSize or showIndex`);
|
|
268
|
+
}
|
|
269
|
+
const shouldApplyDefaults = input.applyDefaults !== false;
|
|
270
|
+
const defaultTargetField = shouldApplyDefaults ? pickCollectionFallbackFieldName(targetCollection) : void 0;
|
|
271
|
+
const fields = explicitFields ?? (shouldApplyDefaults && usesNestedRelationFields(fieldUse) ? [defaultTargetField] : void 0);
|
|
272
|
+
const selectorFields = explicitSelectorFields ?? (shouldApplyDefaults && fieldType === "picker" && import_lodash.default.isUndefined(input.selectorFields) ? [defaultTargetField] : void 0);
|
|
273
|
+
const titleField = import_lodash.default.isUndefined(input.titleField) ? defaultTargetField : String(input.titleField || "").trim() || void 0;
|
|
274
|
+
if (fields == null ? void 0 : fields.length) {
|
|
275
|
+
assertTargetFieldNamesExist(targetCollection, fields, `${input.context}.fields`);
|
|
276
|
+
}
|
|
277
|
+
if (selectorFields == null ? void 0 : selectorFields.length) {
|
|
278
|
+
assertTargetFieldNamesExist(targetCollection, selectorFields, `${input.context}.selectorFields`);
|
|
279
|
+
}
|
|
280
|
+
if (titleField && !(0, import_service_helpers.resolveFieldFromCollection)(targetCollection, titleField)) {
|
|
281
|
+
(0, import_errors.throwBadRequest)(
|
|
282
|
+
`flowSurfaces ${input.context}.titleField '${titleField}' does not exist on relation target collection`
|
|
283
|
+
);
|
|
284
|
+
}
|
|
285
|
+
return {
|
|
286
|
+
fieldType,
|
|
287
|
+
fieldUse,
|
|
288
|
+
cardinality,
|
|
289
|
+
targetCollection,
|
|
290
|
+
fields,
|
|
291
|
+
selectorFields,
|
|
292
|
+
titleField,
|
|
293
|
+
openMode: input.openMode,
|
|
294
|
+
popupSize: input.popupSize,
|
|
295
|
+
pageSize: input.pageSize,
|
|
296
|
+
showIndex: input.showIndex
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
function usesNestedRelationFields(fieldUse) {
|
|
300
|
+
return [
|
|
301
|
+
"SubTableFieldModel",
|
|
302
|
+
"PopupSubTableFieldModel",
|
|
303
|
+
"DisplaySubTableFieldModel",
|
|
304
|
+
"SubFormFieldModel",
|
|
305
|
+
"SubFormListFieldModel",
|
|
306
|
+
"DisplaySubItemFieldModel",
|
|
307
|
+
"DisplaySubListFieldModel"
|
|
308
|
+
].includes(String(fieldUse || "").trim());
|
|
309
|
+
}
|
|
310
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
311
|
+
0 && (module.exports = {
|
|
312
|
+
FLOW_SURFACE_INTERNAL_FIELD_KEYS,
|
|
313
|
+
FLOW_SURFACE_PUBLIC_FIELD_TYPE_SET,
|
|
314
|
+
FLOW_SURFACE_PUBLIC_RELATION_FIELD_TYPES,
|
|
315
|
+
FLOW_SURFACE_RESERVED_RELATION_FIELD_TYPES,
|
|
316
|
+
assertNoInternalFieldKeys,
|
|
317
|
+
getPublicFieldTypeForUse,
|
|
318
|
+
normalizePublicFieldNameList,
|
|
319
|
+
normalizePublicFieldType,
|
|
320
|
+
resolveRelationFieldType,
|
|
321
|
+
usesNestedRelationFields
|
|
322
|
+
});
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
import _ from 'lodash';
|
|
10
10
|
import { FLOW_SURFACE_APPLY_BLUEPRINT_POPUP_DEFAULTS_KEY, type FlowSurfaceApplyBlueprintPopupDefaultsMetadata } from './blueprint/defaults';
|
|
11
11
|
import type { FlowSurfaceNodeSpec, FlowSurfaceNodeSubModel } from './types';
|
|
12
|
+
import { type FlowSurfacePublicRelationFieldType } from './field-type-resolver';
|
|
12
13
|
export declare function buildDefinedPayload(payload: Record<string, any>): _.Dictionary<any>;
|
|
13
14
|
export declare function normalizeFlowSurfaceComposeKey(key: any, context: string): string;
|
|
14
15
|
export declare function assertFlowSurfaceComposeUniqueKeys(items: Array<{
|
|
@@ -65,6 +66,14 @@ export type NormalizedComposeFieldSpec = {
|
|
|
65
66
|
associationPathName?: string;
|
|
66
67
|
renderer?: string;
|
|
67
68
|
type?: string;
|
|
69
|
+
fieldType?: FlowSurfacePublicRelationFieldType;
|
|
70
|
+
fields?: string[];
|
|
71
|
+
selectorFields?: string[];
|
|
72
|
+
titleField?: string;
|
|
73
|
+
openMode?: string;
|
|
74
|
+
popupSize?: string;
|
|
75
|
+
pageSize?: number;
|
|
76
|
+
showIndex?: boolean;
|
|
68
77
|
target?: string;
|
|
69
78
|
settings: Record<string, any>;
|
|
70
79
|
popup?: Record<string, any>;
|
|
@@ -72,6 +81,9 @@ export type NormalizedComposeFieldSpec = {
|
|
|
72
81
|
[FLOW_SURFACE_APPLY_BLUEPRINT_POPUP_DEFAULTS_KEY]?: FlowSurfaceApplyBlueprintPopupDefaultsMetadata;
|
|
73
82
|
};
|
|
74
83
|
export declare function normalizeComposeFieldSpec(input: any, index: number): NormalizedComposeFieldSpec;
|
|
84
|
+
export declare function resolveRequestedFieldComponent(values: Record<string, any> | undefined): any;
|
|
85
|
+
export declare function resolveRequestedFieldUse(values: Record<string, any> | undefined): any;
|
|
86
|
+
export declare function resolveRequestedFieldUseAlias(values: Record<string, any> | undefined): string;
|
|
75
87
|
export declare function normalizeComposeActionSpec(input: any, index: number): {
|
|
76
88
|
popup?: any;
|
|
77
89
|
key: string;
|
|
@@ -99,7 +111,7 @@ export declare function splitComposeFieldChanges(changes: Record<string, any>, w
|
|
|
99
111
|
wrapperChanges: _.Dictionary<any>;
|
|
100
112
|
fieldChanges: _.Dictionary<any>;
|
|
101
113
|
};
|
|
102
|
-
export declare function getCatalogRecordActionContainerUse(use?: string): "DetailsBlockModel" | "
|
|
114
|
+
export declare function getCatalogRecordActionContainerUse(use?: string): "DetailsBlockModel" | "ListItemModel" | "GridCardItemModel" | "TableActionsColumnModel";
|
|
103
115
|
export declare function normalizeRowSpans(spans?: Array<number | undefined>): number[];
|
|
104
116
|
export declare function normalizePublicBlockHeightMode(input: any): string;
|
|
105
117
|
export declare function normalizeStoredChartCardHeightMode(input: any): string;
|
|
@@ -72,6 +72,9 @@ __export(service_utils_exports, {
|
|
|
72
72
|
normalizeSimpleLayoutValue: () => normalizeSimpleLayoutValue,
|
|
73
73
|
normalizeSimpleResourceInit: () => normalizeSimpleResourceInit,
|
|
74
74
|
normalizeStoredChartCardHeightMode: () => normalizeStoredChartCardHeightMode,
|
|
75
|
+
resolveRequestedFieldComponent: () => resolveRequestedFieldComponent,
|
|
76
|
+
resolveRequestedFieldUse: () => resolveRequestedFieldUse,
|
|
77
|
+
resolveRequestedFieldUseAlias: () => resolveRequestedFieldUseAlias,
|
|
75
78
|
rethrowInlineConfigurationError: () => rethrowInlineConfigurationError,
|
|
76
79
|
splitComposeFieldChanges: () => splitComposeFieldChanges,
|
|
77
80
|
toFlowSurfaceBatchItemError: () => toFlowSurfaceBatchItemError
|
|
@@ -84,6 +87,7 @@ var import_defaults = require("./blueprint/defaults");
|
|
|
84
87
|
var import_errors = require("./errors");
|
|
85
88
|
var import_service_helpers = require("./service-helpers");
|
|
86
89
|
var import_key_registry = require("./planning/key-registry");
|
|
90
|
+
var import_field_type_resolver = require("./field-type-resolver");
|
|
87
91
|
function buildDefinedPayload(payload) {
|
|
88
92
|
return import_lodash.default.pickBy(payload, (value) => !import_lodash.default.isUndefined(value));
|
|
89
93
|
}
|
|
@@ -299,7 +303,18 @@ function hasDefinedValue(input, keys) {
|
|
|
299
303
|
return keys.some((key) => hasOwnDefined(input, key));
|
|
300
304
|
}
|
|
301
305
|
function ensureNoRawSimpleChangeKeys(changes) {
|
|
302
|
-
const rawKeys = [
|
|
306
|
+
const rawKeys = [
|
|
307
|
+
"props",
|
|
308
|
+
"decoratorProps",
|
|
309
|
+
"stepParams",
|
|
310
|
+
"flowRegistry",
|
|
311
|
+
"use",
|
|
312
|
+
"fieldUse",
|
|
313
|
+
"fieldComponent",
|
|
314
|
+
"fieldModel",
|
|
315
|
+
"componentFields",
|
|
316
|
+
"subModels"
|
|
317
|
+
];
|
|
303
318
|
const forbidden = Object.keys(changes).filter((key) => rawKeys.includes(key));
|
|
304
319
|
if (forbidden.length) {
|
|
305
320
|
(0, import_errors.throwBadRequest)(
|
|
@@ -346,12 +361,22 @@ function normalizeComposeFieldSpec(input, index) {
|
|
|
346
361
|
if (!import_lodash.default.isPlainObject(input)) {
|
|
347
362
|
(0, import_errors.throwBadRequest)(`flowSurfaces compose field #${index + 1} must be a string or object`);
|
|
348
363
|
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
}
|
|
364
|
+
(0, import_field_type_resolver.assertNoInternalFieldKeys)(input, `flowSurfaces compose field #${index + 1}`);
|
|
365
|
+
(0, import_field_type_resolver.assertNoInternalFieldKeys)(input.settings, `flowSurfaces compose field #${index + 1}.settings`);
|
|
352
366
|
const semanticType = String(input.type || "").trim() || void 0;
|
|
353
367
|
const fieldPath = String(input.fieldPath || "").trim();
|
|
354
368
|
const renderer = typeof input.renderer === "undefined" ? void 0 : String(input.renderer || "").trim();
|
|
369
|
+
const fieldType = (0, import_field_type_resolver.normalizePublicFieldType)(input.fieldType, `compose field #${index + 1}`);
|
|
370
|
+
const fields = (0, import_field_type_resolver.normalizePublicFieldNameList)(input.fields, `compose field #${index + 1}.fields`);
|
|
371
|
+
const selectorFields = (0, import_field_type_resolver.normalizePublicFieldNameList)(
|
|
372
|
+
input.selectorFields,
|
|
373
|
+
`compose field #${index + 1}.selectorFields`
|
|
374
|
+
);
|
|
375
|
+
const titleField = typeof input.titleField === "undefined" ? void 0 : String(input.titleField || "").trim();
|
|
376
|
+
const openMode = typeof input.openMode === "undefined" ? void 0 : String(input.openMode || "").trim();
|
|
377
|
+
const popupSize = typeof input.popupSize === "undefined" ? void 0 : String(input.popupSize || "").trim();
|
|
378
|
+
const pageSize = typeof input.pageSize === "undefined" ? void 0 : Number(input.pageSize);
|
|
379
|
+
const showIndex = typeof input.showIndex === "undefined" ? void 0 : !!input.showIndex;
|
|
355
380
|
if (!import_lodash.default.isUndefined(input.popup) && !import_lodash.default.isPlainObject(input.popup)) {
|
|
356
381
|
(0, import_errors.throwBadRequest)(`flowSurfaces compose field #${index + 1} popup must be an object`);
|
|
357
382
|
}
|
|
@@ -376,6 +401,14 @@ function normalizeComposeFieldSpec(input, index) {
|
|
|
376
401
|
associationPathName: String(input.associationPathName || "").trim() || void 0,
|
|
377
402
|
...renderer ? { renderer } : {},
|
|
378
403
|
...semanticType ? { type: semanticType } : {},
|
|
404
|
+
...fieldType ? { fieldType } : {},
|
|
405
|
+
...!import_lodash.default.isUndefined(fields) ? { fields } : {},
|
|
406
|
+
...!import_lodash.default.isUndefined(selectorFields) ? { selectorFields } : {},
|
|
407
|
+
...titleField ? { titleField } : {},
|
|
408
|
+
...openMode ? { openMode } : {},
|
|
409
|
+
...popupSize ? { popupSize } : {},
|
|
410
|
+
...!import_lodash.default.isUndefined(pageSize) && Number.isFinite(pageSize) ? { pageSize } : {},
|
|
411
|
+
...!import_lodash.default.isUndefined(showIndex) ? { showIndex } : {},
|
|
379
412
|
target: typeof input.target === "string" ? String(input.target || "").trim() || void 0 : void 0,
|
|
380
413
|
settings: import_lodash.default.isPlainObject(input.settings) ? input.settings : {},
|
|
381
414
|
popup: import_lodash.default.isPlainObject(input.popup) ? input.popup : void 0,
|
|
@@ -383,6 +416,16 @@ function normalizeComposeFieldSpec(input, index) {
|
|
|
383
416
|
...popupDefaultsMetadata ? { [import_defaults.FLOW_SURFACE_APPLY_BLUEPRINT_POPUP_DEFAULTS_KEY]: popupDefaultsMetadata } : {}
|
|
384
417
|
};
|
|
385
418
|
}
|
|
419
|
+
function resolveRequestedFieldComponent(values) {
|
|
420
|
+
return void 0;
|
|
421
|
+
}
|
|
422
|
+
function resolveRequestedFieldUse(values) {
|
|
423
|
+
return resolveRequestedFieldComponent(values) || resolveRequestedFieldUseAlias(values);
|
|
424
|
+
}
|
|
425
|
+
function resolveRequestedFieldUseAlias(values) {
|
|
426
|
+
const legacyFieldUse = String((values == null ? void 0 : values.fieldUse) || "").trim();
|
|
427
|
+
return legacyFieldUse || void 0;
|
|
428
|
+
}
|
|
386
429
|
function normalizeComposeActionSpec(input, index) {
|
|
387
430
|
if (typeof input === "string") {
|
|
388
431
|
const type2 = String(input || "").trim();
|
|
@@ -595,13 +638,19 @@ function splitComposeFieldChanges(changes, wrapperUse) {
|
|
|
595
638
|
"disabled",
|
|
596
639
|
"maxCount",
|
|
597
640
|
"pattern",
|
|
598
|
-
"titleField",
|
|
599
641
|
"dataIndex",
|
|
600
642
|
"editable",
|
|
601
643
|
"labelWidth",
|
|
602
644
|
"labelWrap",
|
|
603
645
|
"name",
|
|
604
|
-
"
|
|
646
|
+
"fieldType",
|
|
647
|
+
"fields",
|
|
648
|
+
"selectorFields",
|
|
649
|
+
"titleField",
|
|
650
|
+
"openMode",
|
|
651
|
+
"popupSize",
|
|
652
|
+
"pageSize",
|
|
653
|
+
"showIndex",
|
|
605
654
|
...wrapperUse === "TableColumnModel" ? ["title"] : []
|
|
606
655
|
]);
|
|
607
656
|
const fieldChanges = import_lodash.default.pick(changes, [
|
|
@@ -805,6 +854,9 @@ function getFieldBindingDefaultProps(containerUse, fieldUse, field) {
|
|
|
805
854
|
normalizeSimpleLayoutValue,
|
|
806
855
|
normalizeSimpleResourceInit,
|
|
807
856
|
normalizeStoredChartCardHeightMode,
|
|
857
|
+
resolveRequestedFieldComponent,
|
|
858
|
+
resolveRequestedFieldUse,
|
|
859
|
+
resolveRequestedFieldUseAlias,
|
|
808
860
|
rethrowInlineConfigurationError,
|
|
809
861
|
splitComposeFieldChanges,
|
|
810
862
|
toFlowSurfaceBatchItemError
|
|
@@ -75,6 +75,9 @@ export declare class FlowSurfacesService {
|
|
|
75
75
|
private analyzeCatalogTarget;
|
|
76
76
|
private projectCatalogNode;
|
|
77
77
|
private patchResolvedNodeConfigureOptions;
|
|
78
|
+
private buildRelationFieldTypeCandidates;
|
|
79
|
+
private collectRelationNestedFieldPaths;
|
|
80
|
+
private collectRelationSelectorFieldPaths;
|
|
78
81
|
private projectCatalogItem;
|
|
79
82
|
private buildCatalogBlockItem;
|
|
80
83
|
private isCollectionBlockUse;
|
|
@@ -665,6 +668,7 @@ export declare class FlowSurfacesService {
|
|
|
665
668
|
private configureTab;
|
|
666
669
|
private configureTableBlock;
|
|
667
670
|
private configureCalendarBlock;
|
|
671
|
+
private configureTreeBlock;
|
|
668
672
|
private configureKanbanBlock;
|
|
669
673
|
private configureFormBlock;
|
|
670
674
|
private configureDetailsBlock;
|
|
@@ -687,6 +691,7 @@ export declare class FlowSurfacesService {
|
|
|
687
691
|
private configureFieldNode;
|
|
688
692
|
private normalizeFilterActionDefaultFilterValue;
|
|
689
693
|
private configureActionNode;
|
|
694
|
+
private normalizeActionPanelActionChanges;
|
|
690
695
|
private buildFieldCatalog;
|
|
691
696
|
private getFieldMenuCatalogMode;
|
|
692
697
|
private resolveRegisteredFieldBinding;
|
|
@@ -794,18 +799,29 @@ export declare class FlowSurfacesService {
|
|
|
794
799
|
private buildAssociationTitleFieldUnavailableMessage;
|
|
795
800
|
private resolveTitleFieldSyncDecision;
|
|
796
801
|
private resolvePreferredFieldForCapability;
|
|
802
|
+
private supportsFieldTitleFieldProp;
|
|
803
|
+
private normalizeFieldPropsForUse;
|
|
797
804
|
private ensureGridChild;
|
|
798
805
|
private ensureTableActionsColumn;
|
|
799
806
|
private ensurePopupSurface;
|
|
800
807
|
private ensureFlowRoutePageSchemaShell;
|
|
801
808
|
private removeFlowRoutePageSchemaShell;
|
|
802
809
|
private normalizeDisplayFieldBinding;
|
|
810
|
+
private getCollectionFieldOrBadRequest;
|
|
811
|
+
private buildRelationTargetFieldInit;
|
|
812
|
+
private buildRelationTargetTableColumnNode;
|
|
813
|
+
private buildRelationTargetGridItemNode;
|
|
814
|
+
private replaceFieldSubModelArray;
|
|
815
|
+
private buildPopupSubTableActionsColumnNode;
|
|
816
|
+
private ensureFieldGridSubModel;
|
|
817
|
+
private applyResolvedRelationFieldType;
|
|
818
|
+
private applyRecordPickerFieldTypeSettings;
|
|
803
819
|
private buildExactFieldSettingsInitPayload;
|
|
804
820
|
private patchFieldSettingsInitExact;
|
|
805
821
|
private inferFieldComponentFlowDomain;
|
|
806
822
|
private resolveFieldComponentFieldSource;
|
|
807
823
|
private assertSupportedFieldComponentUse;
|
|
808
|
-
private
|
|
824
|
+
private syncFieldTypeStepParams;
|
|
809
825
|
private rebuildFieldSubModelOnServer;
|
|
810
826
|
private parseFieldPath;
|
|
811
827
|
private loadResolvedNode;
|