@nocobase/plugin-flow-engine 2.2.0-beta.2 → 2.2.0-beta.5
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 +9 -9
- package/dist/node_modules/@ant-design/icons-svg/package.json +1 -1
- package/dist/node_modules/acorn/package.json +1 -1
- package/dist/node_modules/acorn-jsx/package.json +1 -1
- package/dist/node_modules/acorn-walk/package.json +1 -1
- package/dist/node_modules/ses/package.json +1 -1
- package/dist/node_modules/zod/package.json +1 -1
- package/dist/server/flow-surfaces/approval/authoring-validation.d.ts +9 -0
- package/dist/server/flow-surfaces/approval/authoring-validation.js +1151 -0
- package/dist/server/flow-surfaces/approval/blueprint-service.js +2 -0
- package/dist/server/flow-surfaces/authoring-validation.js +429 -32
- package/dist/server/flow-surfaces/blueprint/export-document.d.ts +50 -0
- package/dist/server/flow-surfaces/blueprint/export-document.js +2505 -0
- package/dist/server/flow-surfaces/builder.js +16 -1
- package/dist/server/flow-surfaces/catalog.js +3 -1
- package/dist/server/flow-surfaces/configure-options.js +4 -3
- package/dist/server/flow-surfaces/constants.d.ts +9 -2
- package/dist/server/flow-surfaces/constants.js +1 -0
- package/dist/server/flow-surfaces/contract-guard.js +24 -2
- package/dist/server/flow-surfaces/default-action-popup.d.ts +2 -0
- package/dist/server/flow-surfaces/default-action-popup.js +27 -13
- package/dist/server/flow-surfaces/filter-group.d.ts +19 -2
- package/dist/server/flow-surfaces/filter-group.js +232 -3
- package/dist/server/flow-surfaces/planning/compiler.d.ts +1 -0
- package/dist/server/flow-surfaces/planning/compiler.js +205 -82
- package/dist/server/flow-surfaces/planning/runtime.js +1 -0
- package/dist/server/flow-surfaces/planning/step-link.d.ts +1 -1
- package/dist/server/flow-surfaces/planning/step-link.js +22 -3
- package/dist/server/flow-surfaces/public-data-surface-default-filter.js +0 -9
- package/dist/server/flow-surfaces/reaction/field-value.d.ts +9 -0
- package/dist/server/flow-surfaces/reaction/field-value.js +51 -2
- package/dist/server/flow-surfaces/reaction/linkage.d.ts +6 -1
- package/dist/server/flow-surfaces/reaction/linkage.js +18 -3
- package/dist/server/flow-surfaces/reaction/meta.js +19 -1
- package/dist/server/flow-surfaces/reaction/types.d.ts +19 -0
- package/dist/server/flow-surfaces/relation-backing-foreign-key.d.ts +10 -0
- package/dist/server/flow-surfaces/relation-backing-foreign-key.js +79 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/source.d.ts +1 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/source.js +20 -0
- package/dist/server/flow-surfaces/runjs-authoring/scan/filter.js +12 -2
- package/dist/server/flow-surfaces/runjs-authoring/scan/index.js +9 -1
- package/dist/server/flow-surfaces/service.d.ts +24 -0
- package/dist/server/flow-surfaces/service.js +308 -27
- package/dist/server/variables/registry.js +3 -0
- package/dist/swagger/flow-surfaces.d.ts +180 -0
- package/dist/swagger/flow-surfaces.examples.d.ts +8 -0
- package/dist/swagger/flow-surfaces.examples.js +8 -0
- package/dist/swagger/flow-surfaces.js +160 -4
- package/dist/swagger/index.d.ts +180 -0
- package/package.json +2 -2
|
@@ -45,6 +45,7 @@ var import_lodash = __toESM(require("lodash"));
|
|
|
45
45
|
var import_service_utils = require("../service-utils");
|
|
46
46
|
var import_errors = require("../errors");
|
|
47
47
|
var import_blueprint = require("./blueprint");
|
|
48
|
+
var import_authoring_validation = require("./authoring-validation");
|
|
48
49
|
var import_builder = require("./builder");
|
|
49
50
|
class FlowSurfaceApprovalBlueprintService {
|
|
50
51
|
constructor(deps) {
|
|
@@ -541,6 +542,7 @@ class FlowSurfaceApprovalBlueprintService {
|
|
|
541
542
|
}
|
|
542
543
|
}
|
|
543
544
|
async applyApprovalBlueprint(values, options = {}) {
|
|
545
|
+
(0, import_authoring_validation.assertFlowSurfaceApprovalBlueprintAuthoringPayload)(values);
|
|
544
546
|
const document = (0, import_blueprint.prepareFlowSurfaceApplyApprovalBlueprintDocument)(values);
|
|
545
547
|
const bindingContext = await this.resolveApprovalBlueprintBindingContext(document, options.transaction);
|
|
546
548
|
const surfaceRoot = await this.ensureApprovalBlueprintSurfaceRoot(bindingContext, options.transaction);
|
|
@@ -51,6 +51,7 @@ var import_association_title_field = require("./association-title-field");
|
|
|
51
51
|
var import_chart_config = require("./chart-config");
|
|
52
52
|
var import_public_data_surface_default_filter = require("./public-data-surface-default-filter");
|
|
53
53
|
var import_default_action_popup = require("./default-action-popup");
|
|
54
|
+
var import_relation_backing_foreign_key = require("./relation-backing-foreign-key");
|
|
54
55
|
var import_default_block_actions = require("./default-block-actions");
|
|
55
56
|
var import_hidden_popup_contract = require("./hidden-popup-contract");
|
|
56
57
|
var import_node_use_sets = require("./node-use-sets");
|
|
@@ -60,6 +61,7 @@ var import_association_interfaces = require("./association-interfaces");
|
|
|
60
61
|
var import_defaults = require("./blueprint/defaults");
|
|
61
62
|
var import_runjs_authoring = require("./runjs-authoring");
|
|
62
63
|
var import_configure_options = require("./configure-options");
|
|
64
|
+
var import_context = require("./context");
|
|
63
65
|
var import_filter_group = require("./filter-group");
|
|
64
66
|
const MAIN_BLOCK_UNSUPPORTED_SECTIONS = {
|
|
65
67
|
calendar: ["fields", "fieldGroups", "recordActions", "fieldsLayout"],
|
|
@@ -472,7 +474,10 @@ async function collectFlowSurfaceAuthoringErrors(actionName, values, context = {
|
|
|
472
474
|
blocks.forEach(({ block }) => collectLocalKeys(block, localKeys));
|
|
473
475
|
}
|
|
474
476
|
blocks.forEach(({ block, path }) => collectBlockErrors(block, path, errors, localKeys, validationContext));
|
|
475
|
-
collectReactionErrors(values == null ? void 0 : values.reaction, "$.reaction", localKeys, errors
|
|
477
|
+
collectReactionErrors(values == null ? void 0 : values.reaction, "$.reaction", localKeys, errors, {
|
|
478
|
+
values,
|
|
479
|
+
context: validationContext
|
|
480
|
+
});
|
|
476
481
|
if (!validationContext.skipGeneratedPopupDefaultFieldGroups) {
|
|
477
482
|
collectGeneratedPopupDefaultFieldGroupErrors(actionName, values, validationContext, errors);
|
|
478
483
|
}
|
|
@@ -1177,47 +1182,69 @@ function collectBuilderChartAssetQueryErrors(query, path, context, errors) {
|
|
|
1177
1182
|
errors,
|
|
1178
1183
|
withChartRepairHint()
|
|
1179
1184
|
);
|
|
1180
|
-
collectChartQueryFilterOperatorErrors(query, `${path}.query`, errors);
|
|
1185
|
+
collectChartQueryFilterOperatorErrors(query, `${path}.query`, errors, context);
|
|
1181
1186
|
collectBuilderChartAssetFieldErrors(query, path, context, errors);
|
|
1182
1187
|
}
|
|
1183
|
-
|
|
1188
|
+
const AUTHORABLE_REACTION_SCALAR_CONTEXT_PATHS = /* @__PURE__ */ new Set(["role", "locale", "token", "deviceType"]);
|
|
1189
|
+
const AUTHORABLE_REACTION_CONTEXT_ROOTS = /* @__PURE__ */ new Set([
|
|
1190
|
+
"user",
|
|
1191
|
+
"collection",
|
|
1192
|
+
"formValues",
|
|
1193
|
+
"record",
|
|
1194
|
+
"item",
|
|
1195
|
+
"popup",
|
|
1196
|
+
"urlSearchParams"
|
|
1197
|
+
]);
|
|
1198
|
+
function collectChartQueryFilterOperatorErrors(query, path, errors, context) {
|
|
1184
1199
|
if (!_.isPlainObject(query) || !hasOwn(query, "filter")) {
|
|
1185
1200
|
return;
|
|
1186
1201
|
}
|
|
1187
|
-
collectChartFilterOperatorErrors(
|
|
1202
|
+
collectChartFilterOperatorErrors(
|
|
1203
|
+
query.filter,
|
|
1204
|
+
`${path}.filter`,
|
|
1205
|
+
errors,
|
|
1206
|
+
createChartQueryDateConditionFieldResolver(query, context)
|
|
1207
|
+
);
|
|
1188
1208
|
}
|
|
1189
|
-
function collectChartFilterOperatorErrors(filter, path, errors) {
|
|
1209
|
+
function collectChartFilterOperatorErrors(filter, path, errors, resolveField) {
|
|
1190
1210
|
if (_.isUndefined(filter) || _.isNull(filter) || !_.isPlainObject(filter)) {
|
|
1191
1211
|
return;
|
|
1192
1212
|
}
|
|
1193
1213
|
if (Array.isArray(filter.items)) {
|
|
1194
|
-
collectChartFilterGroupOperatorErrors(filter.items, `${path}.items`, errors);
|
|
1214
|
+
collectChartFilterGroupOperatorErrors(filter.items, `${path}.items`, errors, resolveField);
|
|
1195
1215
|
return;
|
|
1196
1216
|
}
|
|
1197
|
-
collectBackendQueryFilterOperatorErrors(filter, path, errors);
|
|
1217
|
+
collectBackendQueryFilterOperatorErrors(filter, path, errors, resolveField);
|
|
1198
1218
|
}
|
|
1199
|
-
function collectChartFilterGroupOperatorErrors(items, path, errors) {
|
|
1219
|
+
function collectChartFilterGroupOperatorErrors(items, path, errors, resolveField) {
|
|
1200
1220
|
items.forEach((item, index) => {
|
|
1201
1221
|
const itemPath = `${path}[${index}]`;
|
|
1202
1222
|
if (!_.isPlainObject(item)) {
|
|
1203
1223
|
return;
|
|
1204
1224
|
}
|
|
1205
1225
|
if (Array.isArray(item.items)) {
|
|
1206
|
-
collectChartFilterGroupOperatorErrors(item.items, `${itemPath}.items`, errors);
|
|
1226
|
+
collectChartFilterGroupOperatorErrors(item.items, `${itemPath}.items`, errors, resolveField);
|
|
1207
1227
|
return;
|
|
1208
1228
|
}
|
|
1209
1229
|
if (hasOwn(item, "operator")) {
|
|
1210
1230
|
collectChartFilterOperatorError(item.operator, `${itemPath}.operator`, errors);
|
|
1211
|
-
|
|
1231
|
+
const fieldPath = String(item.path || item.field || "").trim();
|
|
1232
|
+
collectChartFilterDateValueError(
|
|
1233
|
+
item.operator,
|
|
1234
|
+
item.value,
|
|
1235
|
+
`${itemPath}.value`,
|
|
1236
|
+
errors,
|
|
1237
|
+
fieldPath ? (resolveField == null ? void 0 : resolveField(fieldPath)) || { fieldPath } : void 0
|
|
1238
|
+
);
|
|
1212
1239
|
}
|
|
1213
1240
|
});
|
|
1214
1241
|
}
|
|
1215
|
-
function collectBackendQueryFilterOperatorErrors(filter, path, errors) {
|
|
1242
|
+
function collectBackendQueryFilterOperatorErrors(filter, path, errors, resolveField) {
|
|
1216
1243
|
Object.entries(filter).forEach(([field, condition]) => {
|
|
1217
1244
|
const fieldPath = `${path}.${field}`;
|
|
1218
1245
|
if ((field === "$and" || field === "$or") && Array.isArray(condition)) {
|
|
1219
1246
|
condition.forEach(
|
|
1220
|
-
(operand, index) => collectChartFilterOperatorErrors(operand, `${fieldPath}[${index}]`, errors)
|
|
1247
|
+
(operand, index) => collectChartFilterOperatorErrors(operand, `${fieldPath}[${index}]`, errors, resolveField)
|
|
1221
1248
|
);
|
|
1222
1249
|
return;
|
|
1223
1250
|
}
|
|
@@ -1226,11 +1253,17 @@ function collectBackendQueryFilterOperatorErrors(filter, path, errors) {
|
|
|
1226
1253
|
}
|
|
1227
1254
|
Object.keys(condition).forEach((operator) => {
|
|
1228
1255
|
if (operator === "$and" || operator === "$or") {
|
|
1229
|
-
collectChartFilterOperatorErrors({ [operator]: condition[operator] }, fieldPath, errors);
|
|
1256
|
+
collectChartFilterOperatorErrors({ [operator]: condition[operator] }, fieldPath, errors, resolveField);
|
|
1230
1257
|
return;
|
|
1231
1258
|
}
|
|
1232
1259
|
collectChartFilterOperatorError(operator, `${fieldPath}.${operator}`, errors);
|
|
1233
|
-
collectChartFilterDateValueError(
|
|
1260
|
+
collectChartFilterDateValueError(
|
|
1261
|
+
operator,
|
|
1262
|
+
condition[operator],
|
|
1263
|
+
`${fieldPath}.${operator}`,
|
|
1264
|
+
errors,
|
|
1265
|
+
(resolveField == null ? void 0 : resolveField(field)) || { fieldPath: field }
|
|
1266
|
+
);
|
|
1234
1267
|
});
|
|
1235
1268
|
});
|
|
1236
1269
|
}
|
|
@@ -1245,9 +1278,18 @@ function collectChartFilterOperatorError(operator, path, errors) {
|
|
|
1245
1278
|
throw error;
|
|
1246
1279
|
}
|
|
1247
1280
|
}
|
|
1248
|
-
function collectChartFilterDateValueError(operator, value, path, errors) {
|
|
1281
|
+
function collectChartFilterDateValueError(operator, value, path, errors, fieldContext) {
|
|
1282
|
+
const fieldMeta = getDateConditionFieldContextMeta(fieldContext);
|
|
1283
|
+
const normalizedOperator = typeof operator === "string" ? operator.trim() : "";
|
|
1284
|
+
if (!import_filter_group.FLOW_SURFACE_DATE_FILTER_OPERATORS.has(normalizedOperator) && !(0, import_filter_group.isFlowSurfaceDateLikeFieldMeta)(fieldMeta)) {
|
|
1285
|
+
return;
|
|
1286
|
+
}
|
|
1249
1287
|
try {
|
|
1250
|
-
(0, import_filter_group.
|
|
1288
|
+
(0, import_filter_group.normalizeFlowSurfaceDateConditionValue)(operator, value, path, {
|
|
1289
|
+
fieldPath: fieldContext == null ? void 0 : fieldContext.fieldPath,
|
|
1290
|
+
fieldType: fieldMeta.type,
|
|
1291
|
+
fieldInterface: fieldMeta.interface
|
|
1292
|
+
});
|
|
1251
1293
|
} catch (error) {
|
|
1252
1294
|
if (error instanceof import_errors.FlowSurfaceBadRequestError) {
|
|
1253
1295
|
pushChartBadRequestAuthoringError(errors, error, path);
|
|
@@ -1256,6 +1298,38 @@ function collectChartFilterDateValueError(operator, value, path, errors) {
|
|
|
1256
1298
|
throw error;
|
|
1257
1299
|
}
|
|
1258
1300
|
}
|
|
1301
|
+
function createChartQueryDateConditionFieldResolver(query, context) {
|
|
1302
|
+
const resource = _.isPlainObject(query == null ? void 0 : query.resource) ? query.resource : null;
|
|
1303
|
+
const collectionName = String((resource == null ? void 0 : resource.collectionName) || "").trim();
|
|
1304
|
+
if (!collectionName || typeof (context == null ? void 0 : context.getCollection) !== "function") {
|
|
1305
|
+
return null;
|
|
1306
|
+
}
|
|
1307
|
+
const dataSourceKey = String((resource == null ? void 0 : resource.dataSourceKey) || "main").trim() || "main";
|
|
1308
|
+
const collection = context.getCollection(dataSourceKey, collectionName);
|
|
1309
|
+
if (!collection) {
|
|
1310
|
+
return null;
|
|
1311
|
+
}
|
|
1312
|
+
return (fieldPath) => {
|
|
1313
|
+
const normalizedFieldPath = (0, import_service_helpers.normalizeFieldPath)(fieldPath);
|
|
1314
|
+
const resolved = resolveDefaultFilterFieldPath(collection, normalizedFieldPath, dataSourceKey, context);
|
|
1315
|
+
return {
|
|
1316
|
+
fieldPath,
|
|
1317
|
+
field: resolved.field
|
|
1318
|
+
};
|
|
1319
|
+
};
|
|
1320
|
+
}
|
|
1321
|
+
function getDateConditionFieldMeta(field) {
|
|
1322
|
+
return {
|
|
1323
|
+
type: (0, import_service_helpers.getFieldType)(field),
|
|
1324
|
+
interface: (0, import_service_helpers.getFieldInterface)(field)
|
|
1325
|
+
};
|
|
1326
|
+
}
|
|
1327
|
+
function getDateConditionFieldContextMeta(fieldContext) {
|
|
1328
|
+
return {
|
|
1329
|
+
...getDateConditionFieldMeta(fieldContext == null ? void 0 : fieldContext.field),
|
|
1330
|
+
...(fieldContext == null ? void 0 : fieldContext.fieldMeta) || {}
|
|
1331
|
+
};
|
|
1332
|
+
}
|
|
1259
1333
|
function normalizeChartAssetFieldPath(input) {
|
|
1260
1334
|
if (Array.isArray(input)) {
|
|
1261
1335
|
return input.map((item) => String(item || "").trim()).filter(Boolean).join(".");
|
|
@@ -3616,6 +3690,9 @@ function getGeneratedPopupBusinessFieldCandidates(collection) {
|
|
|
3616
3690
|
if (!fieldName || !(0, import_default_action_popup.isFlowSurfaceDefaultActionPopupBusinessField)(field)) {
|
|
3617
3691
|
return [];
|
|
3618
3692
|
}
|
|
3693
|
+
if ((0, import_relation_backing_foreign_key.isRelationBackingForeignKeyField)(collection, field)) {
|
|
3694
|
+
return [];
|
|
3695
|
+
}
|
|
3619
3696
|
return [
|
|
3620
3697
|
{
|
|
3621
3698
|
field,
|
|
@@ -3730,11 +3807,15 @@ function getGeneratedPopupDefaultFormFieldPaths(candidates, fieldGroups) {
|
|
|
3730
3807
|
}
|
|
3731
3808
|
function getGeneratedPopupRuntimeFieldCandidates(input) {
|
|
3732
3809
|
const candidateContext = DEFAULT_ACTION_POPUP_FIELD_CONTEXT_BY_TYPE[input.actionType];
|
|
3810
|
+
const explicitDefaultFieldPaths = (0, import_default_action_popup.collectFlowSurfaceDefaultActionPopupFieldGroupFieldPaths)(input.fieldGroups);
|
|
3733
3811
|
return (0, import_service_helpers.getCollectionFields)(input.collection).flatMap((field) => {
|
|
3734
3812
|
const fieldName = (0, import_service_helpers.getFieldName)(field);
|
|
3735
3813
|
if (!fieldName || !(0, import_default_action_popup.isFlowSurfaceDefaultActionPopupBusinessField)(field)) {
|
|
3736
3814
|
return [];
|
|
3737
3815
|
}
|
|
3816
|
+
if ((0, import_relation_backing_foreign_key.isRelationBackingForeignKeyField)(input.collection, field) && !explicitDefaultFieldPaths.has(fieldName)) {
|
|
3817
|
+
return [];
|
|
3818
|
+
}
|
|
3738
3819
|
const fieldInterface = (0, import_service_helpers.getFieldInterface)(field);
|
|
3739
3820
|
const registeredBinding = (0, import_field_binding_registry.resolveRegisteredFieldBinding)({
|
|
3740
3821
|
containerUse: candidateContext.ownerUse,
|
|
@@ -3958,9 +4039,16 @@ function collectBlockErrors(block, path, errors, localKeys, context) {
|
|
|
3958
4039
|
collectChartDisplayTitleErrors(block, blockType, path, errors);
|
|
3959
4040
|
collectTreeTableExplicitFieldsErrors(block, blockType, path, errors, context);
|
|
3960
4041
|
collectTreeConnectFieldsErrors((_a = block.settings) == null ? void 0 : _a.connectFields, `${path}.settings.connectFields`, errors);
|
|
3961
|
-
collectTableSettingsErrors(
|
|
3962
|
-
|
|
3963
|
-
|
|
4042
|
+
collectTableSettingsErrors(
|
|
4043
|
+
block,
|
|
4044
|
+
blockType,
|
|
4045
|
+
path,
|
|
4046
|
+
errors,
|
|
4047
|
+
{
|
|
4048
|
+
deferPublicDataScopeErrors: context.authoringActionName === "addBlocks"
|
|
4049
|
+
},
|
|
4050
|
+
context
|
|
4051
|
+
);
|
|
3964
4052
|
collectGridCardSettingsErrors(block, blockType, path, errors);
|
|
3965
4053
|
const descendantContext = getBlockDescendantValidationContext(block, context);
|
|
3966
4054
|
collectActionListErrors(block.actions, `${path}.actions`, errors, block, descendantContext, "actions");
|
|
@@ -4268,8 +4356,8 @@ async function collectConfigureErrors(values, errors, context) {
|
|
|
4268
4356
|
collectCommentsBlockErrors(changesBlock, hostBlockType, "$.changes", errors, context);
|
|
4269
4357
|
collectRecordHistoryBlockErrors(changesBlock, hostBlockType, "$.changes", errors, context);
|
|
4270
4358
|
collectChartDisplayTitleErrors(changes, hostBlockType, "$.changes", errors);
|
|
4271
|
-
collectChartConfigureFilterOperatorErrors(changes, hostBlockType, "$.changes", errors);
|
|
4272
|
-
collectTableSettingsErrors(changes, hostBlockType, "$.changes", errors, { directSettings: true });
|
|
4359
|
+
collectChartConfigureFilterOperatorErrors(changes, hostBlockType, "$.changes", errors, context);
|
|
4360
|
+
collectTableSettingsErrors(changes, hostBlockType, "$.changes", errors, { directSettings: true }, context);
|
|
4273
4361
|
collectGridCardSettingsErrors(changes, hostBlockType, "$.changes", errors, { directSettings: true });
|
|
4274
4362
|
collectAssignValuesErrors(changes.assignValues, "$.changes.assignValues", errors, changesBlock, context);
|
|
4275
4363
|
collectTriggerWorkflowsErrors(changes.triggerWorkflows, "$.changes.triggerWorkflows", errors);
|
|
@@ -4357,10 +4445,20 @@ function collectUnsupportedDefaultFilterOperatorError(operator, path, errors) {
|
|
|
4357
4445
|
}
|
|
4358
4446
|
});
|
|
4359
4447
|
}
|
|
4360
|
-
function collectDefaultFilterDateValueError(operator, value, path, errors) {
|
|
4448
|
+
function collectDefaultFilterDateValueError(operator, value, path, errors, fieldContext, options = {}) {
|
|
4361
4449
|
var _a, _b, _c;
|
|
4450
|
+
const fieldMeta = getDateConditionFieldContextMeta(fieldContext);
|
|
4451
|
+
const normalizedOperator = typeof operator === "string" ? operator.trim() : "";
|
|
4452
|
+
if (!import_filter_group.FLOW_SURFACE_DATE_FILTER_OPERATORS.has(normalizedOperator) && !(0, import_filter_group.isFlowSurfaceDateLikeFieldMeta)(fieldMeta)) {
|
|
4453
|
+
return;
|
|
4454
|
+
}
|
|
4362
4455
|
try {
|
|
4363
|
-
(0, import_filter_group.
|
|
4456
|
+
(0, import_filter_group.normalizeFlowSurfaceDateConditionValue)(operator, value, path, {
|
|
4457
|
+
fieldPath: fieldContext == null ? void 0 : fieldContext.fieldPath,
|
|
4458
|
+
fieldType: fieldMeta.type,
|
|
4459
|
+
fieldInterface: fieldMeta.interface,
|
|
4460
|
+
allowContextPathValue: options.allowContextPathValue
|
|
4461
|
+
});
|
|
4364
4462
|
} catch (error) {
|
|
4365
4463
|
if (!(error instanceof import_errors.FlowSurfaceBadRequestError)) {
|
|
4366
4464
|
throw error;
|
|
@@ -5423,13 +5521,13 @@ function collectChartDisplayTitleErrors(block, blockType, blockPath, errors) {
|
|
|
5423
5521
|
message: "Chart block settings do not support displayTitle in the current flowSurfaces runtime; keep settings.title and omit displayTitle."
|
|
5424
5522
|
});
|
|
5425
5523
|
}
|
|
5426
|
-
function collectChartConfigureFilterOperatorErrors(changes, hostBlockType, path, errors) {
|
|
5524
|
+
function collectChartConfigureFilterOperatorErrors(changes, hostBlockType, path, errors, context) {
|
|
5427
5525
|
if (hostBlockType !== "chart" || !_.isPlainObject(changes)) {
|
|
5428
5526
|
return;
|
|
5429
5527
|
}
|
|
5430
|
-
collectChartQueryFilterOperatorErrors(changes.query, `${path}.query`, errors);
|
|
5528
|
+
collectChartQueryFilterOperatorErrors(changes.query, `${path}.query`, errors, context);
|
|
5431
5529
|
if (_.isPlainObject(changes.configure)) {
|
|
5432
|
-
collectChartQueryFilterOperatorErrors(changes.configure.query, `${path}.configure.query`, errors);
|
|
5530
|
+
collectChartQueryFilterOperatorErrors(changes.configure.query, `${path}.configure.query`, errors, context);
|
|
5433
5531
|
}
|
|
5434
5532
|
}
|
|
5435
5533
|
function visitFilterItems(value, path, errors, block, context = {}) {
|
|
@@ -5446,7 +5544,13 @@ function visitFilterItems(value, path, errors, block, context = {}) {
|
|
|
5446
5544
|
}
|
|
5447
5545
|
if (typeof value.operator === "string") {
|
|
5448
5546
|
collectUnsupportedDefaultFilterOperatorError(value.operator, `${path}.operator`, errors);
|
|
5449
|
-
collectDefaultFilterDateValueError(
|
|
5547
|
+
collectDefaultFilterDateValueError(
|
|
5548
|
+
value.operator,
|
|
5549
|
+
value.value,
|
|
5550
|
+
`${path}.value`,
|
|
5551
|
+
errors,
|
|
5552
|
+
fieldRef ? resolveDefaultFilterDateConditionField(fieldRef.value, block, context) : void 0
|
|
5553
|
+
);
|
|
5450
5554
|
}
|
|
5451
5555
|
const filterItems = value.items;
|
|
5452
5556
|
if (Array.isArray(filterItems)) {
|
|
@@ -5472,11 +5576,33 @@ function visitFilterItems(value, path, errors, block, context = {}) {
|
|
|
5472
5576
|
if (_.isPlainObject(child)) {
|
|
5473
5577
|
Object.entries(child).forEach(([operator, operatorValue]) => {
|
|
5474
5578
|
collectUnsupportedDefaultFilterOperatorError(operator, `${path}.${key}.${operator}`, errors);
|
|
5475
|
-
collectDefaultFilterDateValueError(
|
|
5579
|
+
collectDefaultFilterDateValueError(
|
|
5580
|
+
operator,
|
|
5581
|
+
operatorValue,
|
|
5582
|
+
`${path}.${key}.${operator}`,
|
|
5583
|
+
errors,
|
|
5584
|
+
resolveDefaultFilterDateConditionField(key, block, context)
|
|
5585
|
+
);
|
|
5476
5586
|
});
|
|
5477
5587
|
}
|
|
5478
5588
|
});
|
|
5479
5589
|
}
|
|
5590
|
+
function resolveDefaultFilterDateConditionField(rawFieldPath, block, context) {
|
|
5591
|
+
const fieldPath = String(rawFieldPath || "").trim();
|
|
5592
|
+
if (!fieldPath || fieldPath.startsWith("$") || fieldPath.startsWith("{{")) {
|
|
5593
|
+
return null;
|
|
5594
|
+
}
|
|
5595
|
+
const collection = getBlockCollection(block, context);
|
|
5596
|
+
if (!collection) {
|
|
5597
|
+
return null;
|
|
5598
|
+
}
|
|
5599
|
+
const dataSourceKey = getBlockDataSourceKey(block, context);
|
|
5600
|
+
const resolved = resolveDefaultFilterFieldPath(collection, (0, import_service_helpers.normalizeFieldPath)(fieldPath), dataSourceKey, context);
|
|
5601
|
+
return {
|
|
5602
|
+
fieldPath,
|
|
5603
|
+
field: resolved.field
|
|
5604
|
+
};
|
|
5605
|
+
}
|
|
5480
5606
|
function collectTreeConnectFieldsErrors(value, path, errors) {
|
|
5481
5607
|
if (_.isUndefined(value)) {
|
|
5482
5608
|
return [];
|
|
@@ -5825,7 +5951,7 @@ function getCollectionFilterTargetKey(collection) {
|
|
|
5825
5951
|
function normalizeDataSourceKey(value) {
|
|
5826
5952
|
return String(value || "main").trim() || "main";
|
|
5827
5953
|
}
|
|
5828
|
-
function collectTableSettingsErrors(block, blockType, blockPath, errors, options = {}) {
|
|
5954
|
+
function collectTableSettingsErrors(block, blockType, blockPath, errors, options = {}, context = {}) {
|
|
5829
5955
|
if (blockType !== "table" || !_.isPlainObject(block)) {
|
|
5830
5956
|
return;
|
|
5831
5957
|
}
|
|
@@ -5836,6 +5962,9 @@ function collectTableSettingsErrors(block, blockType, blockPath, errors, options
|
|
|
5836
5962
|
});
|
|
5837
5963
|
const hasSettings = _.isPlainObject(block == null ? void 0 : block.settings);
|
|
5838
5964
|
if (!hasSettings) {
|
|
5965
|
+
if (options.directSettings === true && !shouldDeferPublicDataScopeErrorsToBatchItem(blockPath, errors, options)) {
|
|
5966
|
+
collectPublicDataScopeErrors(block.dataScope, `${blockPath}.dataScope`, errors, block, context);
|
|
5967
|
+
}
|
|
5839
5968
|
return;
|
|
5840
5969
|
}
|
|
5841
5970
|
const settings = block.settings;
|
|
@@ -5850,7 +5979,7 @@ function collectTableSettingsErrors(block, blockType, blockPath, errors, options
|
|
|
5850
5979
|
pushTableSettingsUnsupportedError(errors, `${settingsPath}.${key}`, key);
|
|
5851
5980
|
});
|
|
5852
5981
|
if (!shouldDeferPublicDataScopeErrorsToBatchItem(blockPath, errors, options)) {
|
|
5853
|
-
collectPublicDataScopeErrors(settings.dataScope, `${settingsPath}.dataScope`, errors);
|
|
5982
|
+
collectPublicDataScopeErrors(settings.dataScope, `${settingsPath}.dataScope`, errors, block, context);
|
|
5854
5983
|
}
|
|
5855
5984
|
}
|
|
5856
5985
|
function pushTableSettingsUnsupportedError(errors, path, key) {
|
|
@@ -5865,7 +5994,7 @@ function pushTableSettingsUnsupportedError(errors, path, key) {
|
|
|
5865
5994
|
}
|
|
5866
5995
|
});
|
|
5867
5996
|
}
|
|
5868
|
-
function collectPublicDataScopeErrors(value, path, errors) {
|
|
5997
|
+
function collectPublicDataScopeErrors(value, path, errors, block, context) {
|
|
5869
5998
|
if (_.isUndefined(value)) {
|
|
5870
5999
|
return;
|
|
5871
6000
|
}
|
|
@@ -5885,6 +6014,62 @@ function collectPublicDataScopeErrors(value, path, errors) {
|
|
|
5885
6014
|
repairHint: 'Use settings.dataScope with logic/items, for example {"logic":"$and","items":[{"path":"status","operator":"$eq","value":"Active"}]}; do not use a field-name map.'
|
|
5886
6015
|
}
|
|
5887
6016
|
});
|
|
6017
|
+
return;
|
|
6018
|
+
}
|
|
6019
|
+
collectPublicDataScopeFieldPathErrors(validationValue, path, errors, block, context);
|
|
6020
|
+
collectFilterGroupDateConditionErrors(validationValue, path, errors, block, context);
|
|
6021
|
+
}
|
|
6022
|
+
function collectPublicDataScopeFieldPathErrors(value, path, errors, block, context) {
|
|
6023
|
+
if (!_.isPlainObject(value)) {
|
|
6024
|
+
return;
|
|
6025
|
+
}
|
|
6026
|
+
if (hasOwn(value, "operator")) {
|
|
6027
|
+
collectPublicDataScopeFieldPathError(value.path, `${path}.path`, block, context, errors);
|
|
6028
|
+
}
|
|
6029
|
+
if (Array.isArray(value.items)) {
|
|
6030
|
+
value.items.forEach(
|
|
6031
|
+
(item, index) => collectPublicDataScopeFieldPathErrors(item, `${path}.items[${index}]`, errors, block, context)
|
|
6032
|
+
);
|
|
6033
|
+
}
|
|
6034
|
+
}
|
|
6035
|
+
function collectPublicDataScopeFieldPathError(rawFieldPath, path, block, context, errors) {
|
|
6036
|
+
const fieldPath = String(rawFieldPath || "").trim();
|
|
6037
|
+
if (!fieldPath || fieldPath.startsWith("$") || fieldPath.startsWith("{{")) {
|
|
6038
|
+
return;
|
|
6039
|
+
}
|
|
6040
|
+
const collection = getBlockCollection(block, context);
|
|
6041
|
+
if (!collection) {
|
|
6042
|
+
return;
|
|
6043
|
+
}
|
|
6044
|
+
const resolved = resolveDefaultFilterFieldPath(
|
|
6045
|
+
collection,
|
|
6046
|
+
(0, import_service_helpers.normalizeFieldPath)(fieldPath),
|
|
6047
|
+
getBlockDataSourceKey(block, context),
|
|
6048
|
+
context
|
|
6049
|
+
);
|
|
6050
|
+
if (!resolved.field) {
|
|
6051
|
+
pushAuthoringError(errors, {
|
|
6052
|
+
path,
|
|
6053
|
+
ruleId: "field-path-unknown",
|
|
6054
|
+
message: `flowSurfaces authoring ${path} references unknown field '${fieldPath}'`,
|
|
6055
|
+
details: {
|
|
6056
|
+
fieldPath,
|
|
6057
|
+
collection: (0, import_service_helpers.getCollectionName)(resolved.collection || collection),
|
|
6058
|
+
availableFields: (0, import_service_helpers.getCollectionFields)(resolved.collection || collection).map((field) => String((0, import_service_helpers.getFieldName)(field) || "").trim()).filter(Boolean)
|
|
6059
|
+
}
|
|
6060
|
+
});
|
|
6061
|
+
return;
|
|
6062
|
+
}
|
|
6063
|
+
if ((0, import_service_helpers.isAssociationField)(resolved.field)) {
|
|
6064
|
+
pushAuthoringError(errors, {
|
|
6065
|
+
path,
|
|
6066
|
+
ruleId: "defaultFilter-relation-field-unsupported",
|
|
6067
|
+
message: `flowSurfaces authoring ${path} cannot use relation field '${fieldPath}' itself; use a scalar subfield instead`,
|
|
6068
|
+
details: {
|
|
6069
|
+
fieldPath,
|
|
6070
|
+
fieldName: (0, import_service_helpers.getFieldName)(resolved.field)
|
|
6071
|
+
}
|
|
6072
|
+
});
|
|
5888
6073
|
}
|
|
5889
6074
|
}
|
|
5890
6075
|
function shouldDeferPublicDataScopeErrorsToBatchItem(blockPath, errors, options) {
|
|
@@ -5906,6 +6091,28 @@ function normalizePublicDataScopeValueForValidation(value) {
|
|
|
5906
6091
|
}
|
|
5907
6092
|
return value;
|
|
5908
6093
|
}
|
|
6094
|
+
function collectFilterGroupDateConditionErrors(value, path, errors, block, context) {
|
|
6095
|
+
if (!_.isPlainObject(value)) {
|
|
6096
|
+
return;
|
|
6097
|
+
}
|
|
6098
|
+
if (Array.isArray(value.items)) {
|
|
6099
|
+
value.items.forEach(
|
|
6100
|
+
(item, index) => collectFilterGroupDateConditionErrors(item, `${path}.items[${index}]`, errors, block, context)
|
|
6101
|
+
);
|
|
6102
|
+
return;
|
|
6103
|
+
}
|
|
6104
|
+
if (!hasOwn(value, "operator")) {
|
|
6105
|
+
return;
|
|
6106
|
+
}
|
|
6107
|
+
const fieldPath = String(value.path || value.field || "").trim();
|
|
6108
|
+
collectDefaultFilterDateValueError(
|
|
6109
|
+
value.operator,
|
|
6110
|
+
value.value,
|
|
6111
|
+
`${path}.value`,
|
|
6112
|
+
errors,
|
|
6113
|
+
fieldPath ? resolveDefaultFilterDateConditionField(fieldPath, block, context) : void 0
|
|
6114
|
+
);
|
|
6115
|
+
}
|
|
5909
6116
|
function collectGridCardSettingsErrors(block, blockType, blockPath, errors, options = {}) {
|
|
5910
6117
|
const hasSettings = _.isPlainObject(block == null ? void 0 : block.settings);
|
|
5911
6118
|
if (!hasSettings && options.directSettings !== true) {
|
|
@@ -6516,7 +6723,7 @@ function collectNestedBlockErrors(blocks, path, errors, localKeys, context) {
|
|
|
6516
6723
|
}
|
|
6517
6724
|
blocks.forEach((block, index) => collectBlockErrors(block, `${path}[${index}]`, errors, localKeys, context));
|
|
6518
6725
|
}
|
|
6519
|
-
function collectReactionErrors(reaction, path, localKeys, errors) {
|
|
6726
|
+
function collectReactionErrors(reaction, path, localKeys, errors, options = {}) {
|
|
6520
6727
|
const items = Array.isArray(reaction == null ? void 0 : reaction.items) ? reaction.items : [];
|
|
6521
6728
|
items.forEach((item, index) => {
|
|
6522
6729
|
const rawTarget = (item == null ? void 0 : item.target) ?? (item == null ? void 0 : item.targetKey) ?? (item == null ? void 0 : item.targetBlock);
|
|
@@ -6534,8 +6741,198 @@ function collectReactionErrors(reaction, path, localKeys, errors) {
|
|
|
6534
6741
|
message: `flowSurfaces authoring ${path}.items[${index}].target references unknown local target '${target}'`
|
|
6535
6742
|
});
|
|
6536
6743
|
}
|
|
6744
|
+
collectReactionItemDateConditionErrors(item, `${path}.items[${index}]`, target, errors, options);
|
|
6745
|
+
});
|
|
6746
|
+
}
|
|
6747
|
+
function collectReactionItemDateConditionErrors(item, path, target, errors, options) {
|
|
6748
|
+
if (!_.isPlainObject(item) || !_.isPlainObject(options.values) || !options.context) {
|
|
6749
|
+
return;
|
|
6750
|
+
}
|
|
6751
|
+
const targetMatch = findApplyBlueprintReactionTargetBlock(options.values, target, options.context);
|
|
6752
|
+
if (!targetMatch) {
|
|
6753
|
+
return;
|
|
6754
|
+
}
|
|
6755
|
+
const type = String(item.type || "").trim();
|
|
6756
|
+
const conditionFieldMetaByPath = buildApplyBlueprintReactionConditionFieldMetaByPath(
|
|
6757
|
+
targetMatch.block,
|
|
6758
|
+
targetMatch.context
|
|
6759
|
+
);
|
|
6760
|
+
_.castArray(item.rules || []).forEach((rule, ruleIndex) => {
|
|
6761
|
+
collectReactionFilterDateConditionErrors(
|
|
6762
|
+
(rule == null ? void 0 : rule.when) ?? (rule == null ? void 0 : rule.condition),
|
|
6763
|
+
`${path}.rules[${ruleIndex}].when`,
|
|
6764
|
+
errors,
|
|
6765
|
+
targetMatch.block,
|
|
6766
|
+
targetMatch.context,
|
|
6767
|
+
conditionFieldMetaByPath
|
|
6768
|
+
);
|
|
6769
|
+
if (type !== "setFieldLinkageRules") {
|
|
6770
|
+
return;
|
|
6771
|
+
}
|
|
6772
|
+
_.castArray((rule == null ? void 0 : rule.then) || (rule == null ? void 0 : rule.actions) || []).forEach((action, actionIndex) => {
|
|
6773
|
+
_.castArray((action == null ? void 0 : action.items) || []).forEach((assignItem, itemIndex) => {
|
|
6774
|
+
collectReactionFilterDateConditionErrors(
|
|
6775
|
+
(assignItem == null ? void 0 : assignItem.when) ?? (assignItem == null ? void 0 : assignItem.condition),
|
|
6776
|
+
`${path}.rules[${ruleIndex}].then[${actionIndex}].items[${itemIndex}].when`,
|
|
6777
|
+
errors,
|
|
6778
|
+
targetMatch.block,
|
|
6779
|
+
targetMatch.context,
|
|
6780
|
+
conditionFieldMetaByPath
|
|
6781
|
+
);
|
|
6782
|
+
});
|
|
6783
|
+
});
|
|
6537
6784
|
});
|
|
6538
6785
|
}
|
|
6786
|
+
function collectReactionFilterDateConditionErrors(filter, path, errors, block, context, fieldMetaByPath = {}) {
|
|
6787
|
+
if (!_.isPlainObject(filter)) {
|
|
6788
|
+
return;
|
|
6789
|
+
}
|
|
6790
|
+
if (Array.isArray(filter.items)) {
|
|
6791
|
+
filter.items.forEach(
|
|
6792
|
+
(item, index) => collectReactionFilterDateConditionErrors(
|
|
6793
|
+
item,
|
|
6794
|
+
`${path}.items[${index}]`,
|
|
6795
|
+
errors,
|
|
6796
|
+
block,
|
|
6797
|
+
context,
|
|
6798
|
+
fieldMetaByPath
|
|
6799
|
+
)
|
|
6800
|
+
);
|
|
6801
|
+
return;
|
|
6802
|
+
}
|
|
6803
|
+
if (!hasOwn(filter, "operator")) {
|
|
6804
|
+
return;
|
|
6805
|
+
}
|
|
6806
|
+
const conditionPath = normalizeReactionConditionPath(filter.path);
|
|
6807
|
+
const fieldContext = resolveReactionConditionFieldContext(conditionPath, block, context, fieldMetaByPath);
|
|
6808
|
+
collectDefaultFilterDateValueError(filter.operator, filter.value, `${path}.value`, errors, fieldContext, {
|
|
6809
|
+
allowContextPathValue: true
|
|
6810
|
+
});
|
|
6811
|
+
}
|
|
6812
|
+
function normalizeReactionConditionPath(rawPath) {
|
|
6813
|
+
const value = String(rawPath || "").trim();
|
|
6814
|
+
const templateMatch = /^\{\{\s*ctx(?:\.([^}]+?))?\s*\}\}$/.exec(value);
|
|
6815
|
+
const path = templateMatch ? String(templateMatch[1] || "").trim() : value.replace(/^ctx\./, "");
|
|
6816
|
+
return path.split(".").map((segment) => segment.trim()).filter(Boolean).join(".");
|
|
6817
|
+
}
|
|
6818
|
+
function buildApplyBlueprintReactionConditionFieldMetaByPath(block, context) {
|
|
6819
|
+
var _a, _b;
|
|
6820
|
+
const collection = getBlockCollection(block, context);
|
|
6821
|
+
const dataSourceKey = getBlockDataSourceKey(block, context);
|
|
6822
|
+
const userCollection = ((_a = context.getCollection) == null ? void 0 : _a.call(context, "main", "users")) || ((_b = context.getCollection) == null ? void 0 : _b.call(context, dataSourceKey, "users")) || null;
|
|
6823
|
+
const response = (0, import_context.buildFlowSurfaceContextResponse)({
|
|
6824
|
+
semantic: {
|
|
6825
|
+
collection,
|
|
6826
|
+
userCollection,
|
|
6827
|
+
recordCollection: collection,
|
|
6828
|
+
formValuesCollection: collection,
|
|
6829
|
+
itemCollections: collection ? [collection] : [],
|
|
6830
|
+
itemRootCollection: collection || void 0,
|
|
6831
|
+
popupLevels: context.isPopupSurface || context.popupHasCurrentRecord ? [
|
|
6832
|
+
{
|
|
6833
|
+
recordCollection: collection,
|
|
6834
|
+
sourceRecordCollection: collection
|
|
6835
|
+
}
|
|
6836
|
+
] : []
|
|
6837
|
+
},
|
|
6838
|
+
maxDepth: 4
|
|
6839
|
+
});
|
|
6840
|
+
const fieldMetaByPath = collectAuthorableReactionContextFieldMetaByPath(response);
|
|
6841
|
+
addCollectionFieldMetaAliases(fieldMetaByPath, collection, ["collection", "record", "formValues"]);
|
|
6842
|
+
addCollectionFieldMetaAliases(fieldMetaByPath, collection, ["item"], {
|
|
6843
|
+
preserveExisting: true,
|
|
6844
|
+
reservedKeys: /* @__PURE__ */ new Set(["index", "length", "value", "parentItem"])
|
|
6845
|
+
});
|
|
6846
|
+
if (userCollection) {
|
|
6847
|
+
addCollectionFieldMetaAliases(fieldMetaByPath, userCollection, ["user"]);
|
|
6848
|
+
}
|
|
6849
|
+
return fieldMetaByPath;
|
|
6850
|
+
}
|
|
6851
|
+
function collectAuthorableReactionContextFieldMetaByPath(context) {
|
|
6852
|
+
const fieldMetaByPath = {};
|
|
6853
|
+
const visit = (prefix, info) => {
|
|
6854
|
+
if (!prefix || !info) {
|
|
6855
|
+
return;
|
|
6856
|
+
}
|
|
6857
|
+
if (isAuthorableReactionContextPath(prefix)) {
|
|
6858
|
+
fieldMetaByPath[prefix] = {
|
|
6859
|
+
...info.type ? { type: info.type } : {},
|
|
6860
|
+
...info.interface ? { interface: info.interface } : {}
|
|
6861
|
+
};
|
|
6862
|
+
}
|
|
6863
|
+
if (info.dynamicProperties) {
|
|
6864
|
+
visit(`${prefix}.*`, info.dynamicProperties);
|
|
6865
|
+
}
|
|
6866
|
+
Object.entries(info.properties || {}).forEach(([key, child]) => visit(`${prefix}.${key}`, child));
|
|
6867
|
+
};
|
|
6868
|
+
Object.entries((context == null ? void 0 : context.vars) || {}).forEach(([key, info]) => visit(key, info));
|
|
6869
|
+
return fieldMetaByPath;
|
|
6870
|
+
}
|
|
6871
|
+
function isAuthorableReactionContextPath(path) {
|
|
6872
|
+
const segments = String(path || "").split(".").filter(Boolean);
|
|
6873
|
+
const root = segments[0];
|
|
6874
|
+
if (!root) {
|
|
6875
|
+
return false;
|
|
6876
|
+
}
|
|
6877
|
+
if (AUTHORABLE_REACTION_SCALAR_CONTEXT_PATHS.has(root)) {
|
|
6878
|
+
return segments.length === 1;
|
|
6879
|
+
}
|
|
6880
|
+
return AUTHORABLE_REACTION_CONTEXT_ROOTS.has(root);
|
|
6881
|
+
}
|
|
6882
|
+
function addCollectionFieldMetaAliases(fieldMetaByPath, collection, roots, options = {}) {
|
|
6883
|
+
var _a;
|
|
6884
|
+
for (const field of (0, import_service_helpers.getCollectionFields)(collection)) {
|
|
6885
|
+
const fieldName = (0, import_service_helpers.getFieldName)(field);
|
|
6886
|
+
if (!fieldName) {
|
|
6887
|
+
continue;
|
|
6888
|
+
}
|
|
6889
|
+
const fieldMeta = {
|
|
6890
|
+
...(0, import_service_helpers.getFieldType)(field) ? { type: (0, import_service_helpers.getFieldType)(field) } : {},
|
|
6891
|
+
...(0, import_service_helpers.getFieldInterface)(field) ? { interface: (0, import_service_helpers.getFieldInterface)(field) } : {}
|
|
6892
|
+
};
|
|
6893
|
+
for (const root of roots) {
|
|
6894
|
+
if ((_a = options.reservedKeys) == null ? void 0 : _a.has(fieldName)) {
|
|
6895
|
+
continue;
|
|
6896
|
+
}
|
|
6897
|
+
const aliasPath = `${root}.${fieldName}`;
|
|
6898
|
+
if (options.preserveExisting && fieldMetaByPath[aliasPath]) {
|
|
6899
|
+
continue;
|
|
6900
|
+
}
|
|
6901
|
+
fieldMetaByPath[aliasPath] = {
|
|
6902
|
+
...fieldMetaByPath[aliasPath],
|
|
6903
|
+
...fieldMeta
|
|
6904
|
+
};
|
|
6905
|
+
}
|
|
6906
|
+
}
|
|
6907
|
+
}
|
|
6908
|
+
function resolveReactionConditionFieldContext(path, block, context, fieldMetaByPath) {
|
|
6909
|
+
const normalized = String(path || "").trim();
|
|
6910
|
+
const contextMeta = resolveReactionConditionFieldMeta(normalized, fieldMetaByPath);
|
|
6911
|
+
if (contextMeta) {
|
|
6912
|
+
return {
|
|
6913
|
+
fieldPath: normalized,
|
|
6914
|
+
fieldMeta: contextMeta
|
|
6915
|
+
};
|
|
6916
|
+
}
|
|
6917
|
+
const fieldPath = resolveReactionConditionFieldPath(normalized);
|
|
6918
|
+
return fieldPath ? resolveDefaultFilterDateConditionField(fieldPath, block, context) || void 0 : void 0;
|
|
6919
|
+
}
|
|
6920
|
+
function resolveReactionConditionFieldMeta(path, fieldMetaByPath) {
|
|
6921
|
+
if (fieldMetaByPath[path]) {
|
|
6922
|
+
return fieldMetaByPath[path];
|
|
6923
|
+
}
|
|
6924
|
+
const wildcardPath = Object.keys(fieldMetaByPath).filter((candidate) => candidate.endsWith(".*")).sort((a, b) => b.length - a.length).find((candidate) => {
|
|
6925
|
+
const prefix = candidate.slice(0, -2);
|
|
6926
|
+
return path.startsWith(`${prefix}.`) && path.length > prefix.length + 1;
|
|
6927
|
+
});
|
|
6928
|
+
return wildcardPath ? fieldMetaByPath[wildcardPath] : void 0;
|
|
6929
|
+
}
|
|
6930
|
+
function resolveReactionConditionFieldPath(path) {
|
|
6931
|
+
const normalized = String(path || "").trim();
|
|
6932
|
+
const prefixes = ["formValues.", "record.", "item.value.", "item.", "popup.record.", "collection.", "user."];
|
|
6933
|
+
const prefix = prefixes.find((candidate) => normalized.startsWith(candidate));
|
|
6934
|
+
return prefix ? normalized.slice(prefix.length) : "";
|
|
6935
|
+
}
|
|
6539
6936
|
function collectFieldListErrors(fields, path, errors, localKeys, context, block) {
|
|
6540
6937
|
if (!Array.isArray(fields)) {
|
|
6541
6938
|
return;
|