@nocobase/plugin-flow-engine 2.1.0-alpha.26 → 2.1.0-alpha.27
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.js +1 -0
- package/dist/ai/ai-employees/nathan/prompt.md +46 -10
- package/dist/ai/ai-employees/nathan/skills/frontend-developer/SKILLS.md +20 -3
- package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/lintAndTestJS.js +4 -2
- package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/patchJSCode.d.ts +10 -0
- package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/patchJSCode.js +65 -0
- package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/readJSCode.d.ts +10 -0
- package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/readJSCode.js +61 -0
- package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/writeJSCode.d.ts +10 -0
- package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/writeJSCode.js +65 -0
- 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/blueprint/compile-blocks.js +8 -8
- package/dist/server/flow-surfaces/blueprint/normalize-document.js +5 -14
- package/dist/server/flow-surfaces/blueprint/private-utils.d.ts +0 -1
- package/dist/server/flow-surfaces/blueprint/private-utils.js +0 -3
- package/dist/server/flow-surfaces/blueprint/public-types.d.ts +0 -1
- package/dist/server/flow-surfaces/catalog.js +1 -0
- package/dist/server/flow-surfaces/compose-compiler.d.ts +0 -1
- package/dist/server/flow-surfaces/compose-compiler.js +0 -1
- package/dist/server/flow-surfaces/configure-options.js +0 -4
- package/dist/server/flow-surfaces/contract-guard.js +11 -3
- package/dist/server/flow-surfaces/field-type-resolver.d.ts +0 -1
- package/dist/server/flow-surfaces/field-type-resolver.js +3 -13
- package/dist/server/flow-surfaces/public-compatibility.d.ts +16 -0
- package/dist/server/flow-surfaces/public-compatibility.js +139 -0
- package/dist/server/flow-surfaces/service-utils.d.ts +0 -1
- package/dist/server/flow-surfaces/service-utils.js +0 -6
- package/dist/server/flow-surfaces/service.d.ts +12 -0
- package/dist/server/flow-surfaces/service.js +360 -82
- package/dist/swagger/flow-surfaces.d.ts +0 -29
- package/dist/swagger/flow-surfaces.js +8 -17
- package/dist/swagger/index.d.ts +0 -29
- package/package.json +2 -2
|
@@ -56,7 +56,6 @@ var import_reference_guards = require("./reference-guards");
|
|
|
56
56
|
var import_key_registry = require("./planning/key-registry");
|
|
57
57
|
var import_blueprint = require("./blueprint");
|
|
58
58
|
var import_compile_blocks = require("./blueprint/compile-blocks");
|
|
59
|
-
var import_private_utils = require("./blueprint/private-utils");
|
|
60
59
|
var import_default_block_actions = require("./default-block-actions");
|
|
61
60
|
var import_public_data_surface_default_filter = require("./public-data-surface-default-filter");
|
|
62
61
|
var import_runtime = require("./planning/runtime");
|
|
@@ -77,6 +76,7 @@ var import_route_sync = require("./route-sync");
|
|
|
77
76
|
var import_surface_context = require("./surface-context");
|
|
78
77
|
var import_context = require("./context");
|
|
79
78
|
var import_configure_options = require("./configure-options");
|
|
79
|
+
var import_public_compatibility = require("./public-compatibility");
|
|
80
80
|
var import_service_helpers = require("./service-helpers");
|
|
81
81
|
var import_errors2 = require("./reaction/errors");
|
|
82
82
|
var import_template_display = require("./template-display");
|
|
@@ -262,6 +262,7 @@ const APPROVAL_CONFIRM_ACTION_USES = /* @__PURE__ */ new Set([
|
|
|
262
262
|
"ApplyFormWithdrawModel"
|
|
263
263
|
]);
|
|
264
264
|
const APPROVAL_ASSIGN_ACTION_USES = /* @__PURE__ */ new Set(["ApplyFormSubmitModel", "ApplyFormSaveDraftModel"]);
|
|
265
|
+
const UPDATE_ASSIGN_ACTION_USES = /* @__PURE__ */ new Set(["UpdateRecordActionModel", "BulkUpdateActionModel"]);
|
|
265
266
|
const APPROVAL_COMMENT_ACTION_USES = /* @__PURE__ */ new Set([
|
|
266
267
|
"ProcessFormApproveModel",
|
|
267
268
|
"ProcessFormRejectModel",
|
|
@@ -288,6 +289,15 @@ const POPUP_RECORD_ACTION_CONTAINER_USES = /* @__PURE__ */ new Set([
|
|
|
288
289
|
"GridCardItemModel"
|
|
289
290
|
]);
|
|
290
291
|
const POPUP_UNSUPPORTED_COLLECTION_SCENES = /* @__PURE__ */ new Set(["select", "subForm", "bulkEditForm"]);
|
|
292
|
+
const POPUP_ASSOCIATED_RECORDS_BLOCK_USES = /* @__PURE__ */ new Set([
|
|
293
|
+
"TableBlockModel",
|
|
294
|
+
"CalendarBlockModel",
|
|
295
|
+
"KanbanBlockModel",
|
|
296
|
+
"ListBlockModel",
|
|
297
|
+
"GridCardBlockModel",
|
|
298
|
+
"MapBlockModel",
|
|
299
|
+
"CommentsBlockModel"
|
|
300
|
+
]);
|
|
291
301
|
const POPUP_COLLECTION_BLOCK_SCENES = {
|
|
292
302
|
CreateFormModel: ["new"],
|
|
293
303
|
EditFormModel: ["one", "many"],
|
|
@@ -306,6 +316,15 @@ const POPUP_COLLECTION_BLOCK_SCENES = {
|
|
|
306
316
|
FilterFormBlockModel: ["filter"],
|
|
307
317
|
FormBlockModel: []
|
|
308
318
|
};
|
|
319
|
+
const UPDATE_ACTION_ASSIGN_SETTINGS_ASSIGNED_VALUES_PATH = [
|
|
320
|
+
"stepParams",
|
|
321
|
+
"assignSettings",
|
|
322
|
+
"assignFieldValues",
|
|
323
|
+
"assignedValues"
|
|
324
|
+
];
|
|
325
|
+
const UPDATE_ACTION_APPLY_ASSIGNED_VALUES_PATH = ["stepParams", "apply", "apply", "assignedValues"];
|
|
326
|
+
const UPDATE_ACTION_ASSIGN_SETTINGS_STEP_PATH = ["assignSettings", "assignFieldValues", "assignedValues"];
|
|
327
|
+
const UPDATE_ACTION_APPLY_STEP_PATH = ["apply", "apply", "assignedValues"];
|
|
309
328
|
const TABLE_COLUMN_STEP_PARAM_MIRRORS = [
|
|
310
329
|
{ domain: "props", key: "title", stepParamsPath: ["tableColumnSettings", "title", "title"] },
|
|
311
330
|
{ domain: "props", key: "tooltip", stepParamsPath: ["tableColumnSettings", "tooltip", "tooltip"] },
|
|
@@ -994,8 +1013,7 @@ class FlowSurfacesService {
|
|
|
994
1013
|
fieldTypes: relationFieldTypes,
|
|
995
1014
|
current: (0, import_service_utils.buildDefinedPayload)({
|
|
996
1015
|
fieldType: (0, import_field_type_resolver.getPublicFieldTypeForUse)(((_g = (_f = innerField == null ? void 0 : innerField.stepParams) == null ? void 0 : _f.fieldBinding) == null ? void 0 : _g.use) || (innerField == null ? void 0 : innerField.use)),
|
|
997
|
-
fields: this.
|
|
998
|
-
selectorFields: this.collectRelationSelectorFieldPaths(innerField),
|
|
1016
|
+
fields: this.collectRelationFieldPaths(innerField),
|
|
999
1017
|
titleField: ((_h = innerField == null ? void 0 : innerField.props) == null ? void 0 : _h.titleField) || ((_i = node == null ? void 0 : node.props) == null ? void 0 : _i.titleField)
|
|
1000
1018
|
}),
|
|
1001
1019
|
defaults: (0, import_service_utils.buildDefinedPayload)({
|
|
@@ -1014,12 +1032,11 @@ class FlowSurfacesService {
|
|
|
1014
1032
|
const defaults = {
|
|
1015
1033
|
titleField: defaultTitleField
|
|
1016
1034
|
};
|
|
1017
|
-
if (["subForm", "subFormList", "subDetails", "subDetailsList", "subTable", "popupSubTable"].includes(
|
|
1035
|
+
if (["picker", "subForm", "subFormList", "subDetails", "subDetailsList", "subTable", "popupSubTable"].includes(
|
|
1036
|
+
fieldType
|
|
1037
|
+
) && defaultTitleField) {
|
|
1018
1038
|
defaults.fields = [defaultTitleField];
|
|
1019
1039
|
}
|
|
1020
|
-
if (fieldType === "picker" && defaultTitleField) {
|
|
1021
|
-
defaults.selectorFields = [defaultTitleField];
|
|
1022
|
-
}
|
|
1023
1040
|
return {
|
|
1024
1041
|
fieldType,
|
|
1025
1042
|
defaults: (0, import_service_utils.buildDefinedPayload)(defaults)
|
|
@@ -1060,6 +1077,9 @@ class FlowSurfacesService {
|
|
|
1060
1077
|
}
|
|
1061
1078
|
return void 0;
|
|
1062
1079
|
}
|
|
1080
|
+
collectRelationFieldPaths(fieldNode) {
|
|
1081
|
+
return this.collectRelationNestedFieldPaths(fieldNode) || this.collectRelationSelectorFieldPaths(fieldNode);
|
|
1082
|
+
}
|
|
1063
1083
|
collectRelationSelectorFieldPaths(fieldNode) {
|
|
1064
1084
|
var _a, _b, _c, _d, _e, _f;
|
|
1065
1085
|
const fieldUse = String(((_b = (_a = fieldNode == null ? void 0 : fieldNode.stepParams) == null ? void 0 : _a.fieldBinding) == null ? void 0 : _b.use) || (fieldNode == null ? void 0 : fieldNode.use) || "").trim();
|
|
@@ -1067,7 +1087,7 @@ class FlowSurfacesService {
|
|
|
1067
1087
|
return void 0;
|
|
1068
1088
|
}
|
|
1069
1089
|
const table = import_lodash.default.castArray(((_e = (_d = (_c = fieldNode == null ? void 0 : fieldNode.subModels) == null ? void 0 : _c["grid-block"]) == null ? void 0 : _d.subModels) == null ? void 0 : _e.items) || []).find(
|
|
1070
|
-
(item) => (item == null ? void 0 : item.use) === "TableBlockModel"
|
|
1090
|
+
(item) => (item == null ? void 0 : item.use) === "TableSelectModel" || (item == null ? void 0 : item.use) === "TableBlockModel"
|
|
1071
1091
|
);
|
|
1072
1092
|
return import_lodash.default.castArray(((_f = table == null ? void 0 : table.subModels) == null ? void 0 : _f.columns) || []).map((item) => {
|
|
1073
1093
|
var _a2, _b2, _c2;
|
|
@@ -1110,6 +1130,9 @@ class FlowSurfacesService {
|
|
|
1110
1130
|
isPopupCollectionBlockSceneUnsupported(scene) {
|
|
1111
1131
|
return POPUP_UNSUPPORTED_COLLECTION_SCENES.has(scene);
|
|
1112
1132
|
}
|
|
1133
|
+
supportsPopupAssociatedRecordsBinding(blockUse) {
|
|
1134
|
+
return POPUP_ASSOCIATED_RECORDS_BLOCK_USES.has(blockUse);
|
|
1135
|
+
}
|
|
1113
1136
|
isPopupCollectionBlockVisibleForScene(blockUse, popupProfile) {
|
|
1114
1137
|
const blockScenes = this.getPopupCollectionBlockScenes(blockUse);
|
|
1115
1138
|
if (this.isPopupCollectionBlockSceneUnsupported(popupProfile.scene)) {
|
|
@@ -1282,7 +1305,7 @@ class FlowSurfacesService {
|
|
|
1282
1305
|
collectionName: popupProfile.collectionName
|
|
1283
1306
|
});
|
|
1284
1307
|
}
|
|
1285
|
-
if (popupProfile.hasCurrentRecord && associationFields.length) {
|
|
1308
|
+
if (this.supportsPopupAssociatedRecordsBinding(blockUse) && popupProfile.hasCurrentRecord && associationFields.length) {
|
|
1286
1309
|
bindings.push({
|
|
1287
1310
|
key: "associatedRecords",
|
|
1288
1311
|
label: "Associated records",
|
|
@@ -1526,7 +1549,17 @@ class FlowSurfacesService {
|
|
|
1526
1549
|
);
|
|
1527
1550
|
}
|
|
1528
1551
|
const resourceBindings = this.buildPopupBlockResourceBindings(input.blockUse, input.popupProfile);
|
|
1529
|
-
|
|
1552
|
+
let requestedBinding = ((_b = input.semanticResource) == null ? void 0 : _b.binding) || this.classifyPopupRawResourceInit(input.popupProfile, input.resourceInit || {});
|
|
1553
|
+
const useLegacyAssociationPopupCurrentRecord = this.shouldUseLegacyAssociationPopupCurrentRecordBinding({
|
|
1554
|
+
blockUse: input.blockUse,
|
|
1555
|
+
popupProfile: input.popupProfile,
|
|
1556
|
+
requestedBinding,
|
|
1557
|
+
semanticResource: input.semanticResource,
|
|
1558
|
+
resourceInit: input.resourceInit || {}
|
|
1559
|
+
});
|
|
1560
|
+
if (useLegacyAssociationPopupCurrentRecord) {
|
|
1561
|
+
requestedBinding = "currentRecord";
|
|
1562
|
+
}
|
|
1530
1563
|
if (!this.isCatalogBlockVisibleForPopupProfile(input.blockUse, input.popupProfile) && requestedBinding && !["currentCollection", "otherRecords"].includes(requestedBinding)) {
|
|
1531
1564
|
(0, import_errors.throwBadRequest)(
|
|
1532
1565
|
`flowSurfaces ${input.actionName} block '${blockKey}' is not available in ${this.describePopupKind(
|
|
@@ -1548,6 +1581,17 @@ class FlowSurfacesService {
|
|
|
1548
1581
|
resource: input.semanticResource
|
|
1549
1582
|
});
|
|
1550
1583
|
}
|
|
1584
|
+
if (useLegacyAssociationPopupCurrentRecord) {
|
|
1585
|
+
return this.compilePopupSemanticResourceInit({
|
|
1586
|
+
actionName: input.actionName,
|
|
1587
|
+
blockUse: input.blockUse,
|
|
1588
|
+
popupProfile: input.popupProfile,
|
|
1589
|
+
resourceBindings,
|
|
1590
|
+
resource: {
|
|
1591
|
+
binding: "currentRecord"
|
|
1592
|
+
}
|
|
1593
|
+
});
|
|
1594
|
+
}
|
|
1551
1595
|
return this.assertPopupRawResourceInit({
|
|
1552
1596
|
actionName: input.actionName,
|
|
1553
1597
|
blockUse: input.blockUse,
|
|
@@ -1556,6 +1600,25 @@ class FlowSurfacesService {
|
|
|
1556
1600
|
resourceInit: input.resourceInit || {}
|
|
1557
1601
|
});
|
|
1558
1602
|
}
|
|
1603
|
+
shouldUseLegacyAssociationPopupCurrentRecordBinding(input) {
|
|
1604
|
+
return !input.semanticResource && input.requestedBinding === "currentCollection" && this.shouldNormalizeLegacyAssociationPopupRecordBlockResource({
|
|
1605
|
+
blockUse: input.blockUse,
|
|
1606
|
+
popupProfile: input.popupProfile,
|
|
1607
|
+
resourceInit: input.resourceInit
|
|
1608
|
+
});
|
|
1609
|
+
}
|
|
1610
|
+
shouldNormalizeLegacyAssociationPopupRecordBlockResource(input) {
|
|
1611
|
+
if (!["DetailsBlockModel", "EditFormModel"].includes(input.blockUse)) {
|
|
1612
|
+
return false;
|
|
1613
|
+
}
|
|
1614
|
+
if (input.popupProfile.popupKind !== "associationPopup" || !input.popupProfile.hasCurrentRecord || !input.popupProfile.hasAssociationContext) {
|
|
1615
|
+
return false;
|
|
1616
|
+
}
|
|
1617
|
+
const normalized = (0, import_service_utils.normalizeSimpleResourceInit)(input.resourceInit) || {};
|
|
1618
|
+
const popupDataSourceKey = input.popupProfile.dataSourceKey || "main";
|
|
1619
|
+
const resourceDataSourceKey = normalized.dataSourceKey || "main";
|
|
1620
|
+
return !!input.popupProfile.collectionName && resourceDataSourceKey === popupDataSourceKey && normalized.collectionName === input.popupProfile.collectionName && !(0, import_service_helpers.hasConfiguredFlowContextValue)(normalized.filterByTk) && !(0, import_service_helpers.hasConfiguredFlowContextValue)(normalized.associationName) && !(0, import_service_helpers.hasConfiguredFlowContextValue)(normalized.sourceId);
|
|
1621
|
+
}
|
|
1559
1622
|
compilePopupSemanticResourceInit(input) {
|
|
1560
1623
|
const binding = input.resource.binding;
|
|
1561
1624
|
const supportedBinding = input.resourceBindings.find((item) => item.key === binding);
|
|
@@ -2420,19 +2483,6 @@ class FlowSurfacesService {
|
|
|
2420
2483
|
`flowSurfaces applyBlueprint navigation.group.title '${groupTitle}' matches ${matchedRoutes.length} existing menu groups; pass navigation.group.routeId explicitly`
|
|
2421
2484
|
);
|
|
2422
2485
|
}
|
|
2423
|
-
const reusedMetadataFields = import_private_utils.APPLY_BLUEPRINT_CREATE_MENU_GROUP_METADATA_KEYS.filter(
|
|
2424
|
-
(key) => {
|
|
2425
|
-
var _a2, _b;
|
|
2426
|
-
return !import_lodash.default.isUndefined((_b = (_a2 = document.navigation) == null ? void 0 : _a2.group) == null ? void 0 : _b[key]);
|
|
2427
|
-
}
|
|
2428
|
-
);
|
|
2429
|
-
if (reusedMetadataFields.length) {
|
|
2430
|
-
(0, import_errors.throwBadRequest)(
|
|
2431
|
-
`flowSurfaces applyBlueprint navigation.group.title '${groupTitle}' matched an existing menu group; do not also pass ${reusedMetadataFields.map((key) => `navigation.group.${key}`).join(
|
|
2432
|
-
", "
|
|
2433
|
-
)} when reusing by title. Same-title reuse is title-only. Keep only navigation.group.title or use navigation.group.routeId for exact targeting, and call flowSurfaces:updateMenu separately if existing group metadata must change`
|
|
2434
|
-
);
|
|
2435
|
-
}
|
|
2436
2486
|
const routeId = this.readRouteField(matchedRoutes[0], "id");
|
|
2437
2487
|
if (import_lodash.default.isNil(routeId) || routeId === "") {
|
|
2438
2488
|
(0, import_errors.throwBadRequest)(
|
|
@@ -3893,83 +3943,89 @@ class FlowSurfacesService {
|
|
|
3893
3943
|
if (!import_lodash.default.isPlainObject(values.changes) || !Object.keys(values.changes).length) {
|
|
3894
3944
|
(0, import_errors.throwBadRequest)("flowSurfaces configure requires a non-empty changes object");
|
|
3895
3945
|
}
|
|
3896
|
-
|
|
3946
|
+
let changes = values.changes;
|
|
3947
|
+
(0, import_service_utils.ensureNoRawSimpleChangeKeys)(changes);
|
|
3897
3948
|
const resolved = await this.locator.resolve(target, options);
|
|
3898
3949
|
const current = await this.loadResolvedNode(resolved, options.transaction);
|
|
3950
|
+
changes = (0, import_public_compatibility.normalizeFlowSurfacePublicSortingAlias)({
|
|
3951
|
+
context: "flowSurfaces configure changes",
|
|
3952
|
+
use: current == null ? void 0 : current.use,
|
|
3953
|
+
settings: changes
|
|
3954
|
+
});
|
|
3899
3955
|
if (resolved.kind === "page" && resolved.pageRoute) {
|
|
3900
|
-
return this.configurePage(target,
|
|
3956
|
+
return this.configurePage(target, changes, options);
|
|
3901
3957
|
}
|
|
3902
3958
|
if (resolved.kind === "tab" && resolved.tabRoute) {
|
|
3903
|
-
return this.configureTab(target,
|
|
3959
|
+
return this.configureTab(target, changes, options);
|
|
3904
3960
|
}
|
|
3905
3961
|
if ((current == null ? void 0 : current.use) === "TableBlockModel") {
|
|
3906
|
-
return this.configureTableBlock(target,
|
|
3962
|
+
return this.configureTableBlock(target, changes, options);
|
|
3907
3963
|
}
|
|
3908
3964
|
if ((current == null ? void 0 : current.use) === "CalendarBlockModel") {
|
|
3909
|
-
return this.configureCalendarBlock(target, current,
|
|
3965
|
+
return this.configureCalendarBlock(target, current, changes, options);
|
|
3910
3966
|
}
|
|
3911
3967
|
if ((current == null ? void 0 : current.use) === "TreeBlockModel") {
|
|
3912
|
-
return this.configureTreeBlock(target, current,
|
|
3968
|
+
return this.configureTreeBlock(target, current, changes, options);
|
|
3913
3969
|
}
|
|
3914
3970
|
if ((current == null ? void 0 : current.use) === "KanbanBlockModel") {
|
|
3915
|
-
return this.configureKanbanBlock(target, current,
|
|
3971
|
+
return this.configureKanbanBlock(target, current, changes, options);
|
|
3916
3972
|
}
|
|
3917
3973
|
if (SIMPLE_FORM_BLOCK_USES.has((current == null ? void 0 : current.use) || "")) {
|
|
3918
|
-
return this.configureFormBlock(target, current.use,
|
|
3974
|
+
return this.configureFormBlock(target, current.use, changes, options);
|
|
3919
3975
|
}
|
|
3920
3976
|
if (DETAILS_BLOCK_USES.has((current == null ? void 0 : current.use) || "")) {
|
|
3921
|
-
return this.configureDetailsBlock(target,
|
|
3977
|
+
return this.configureDetailsBlock(target, changes, options);
|
|
3922
3978
|
}
|
|
3923
3979
|
if ((current == null ? void 0 : current.use) === "FilterFormBlockModel") {
|
|
3924
|
-
return this.configureFilterFormBlock(target,
|
|
3980
|
+
return this.configureFilterFormBlock(target, changes, options);
|
|
3925
3981
|
}
|
|
3926
3982
|
if (LIST_BLOCK_USES.has((current == null ? void 0 : current.use) || "")) {
|
|
3927
|
-
return this.configureListBlock(target,
|
|
3983
|
+
return this.configureListBlock(target, changes, options);
|
|
3928
3984
|
}
|
|
3929
3985
|
if (GRID_CARD_BLOCK_USES.has((current == null ? void 0 : current.use) || "")) {
|
|
3930
|
-
return this.configureGridCardBlock(target,
|
|
3986
|
+
return this.configureGridCardBlock(target, changes, options);
|
|
3931
3987
|
}
|
|
3932
3988
|
if (import_node_use_sets.JS_BLOCK_USES.has((current == null ? void 0 : current.use) || "")) {
|
|
3933
|
-
return this.configureJSBlock(target,
|
|
3989
|
+
return this.configureJSBlock(target, changes, options);
|
|
3934
3990
|
}
|
|
3935
3991
|
if ((current == null ? void 0 : current.use) === "MarkdownBlockModel") {
|
|
3936
|
-
return this.configureMarkdownBlock(target,
|
|
3992
|
+
return this.configureMarkdownBlock(target, changes, options);
|
|
3937
3993
|
}
|
|
3938
3994
|
if ((current == null ? void 0 : current.use) === "IframeBlockModel") {
|
|
3939
|
-
return this.configureIframeBlock(target,
|
|
3995
|
+
return this.configureIframeBlock(target, changes, options);
|
|
3940
3996
|
}
|
|
3941
3997
|
if ((current == null ? void 0 : current.use) === "ChartBlockModel") {
|
|
3942
|
-
return this.configureChartBlock(target,
|
|
3998
|
+
return this.configureChartBlock(target, changes, options);
|
|
3943
3999
|
}
|
|
3944
4000
|
if ((current == null ? void 0 : current.use) === "ActionPanelBlockModel") {
|
|
3945
|
-
return this.configureActionPanelBlock(target,
|
|
4001
|
+
return this.configureActionPanelBlock(target, changes, options);
|
|
3946
4002
|
}
|
|
3947
4003
|
if ((current == null ? void 0 : current.use) === "MapBlockModel") {
|
|
3948
|
-
return this.configureMapBlock(target,
|
|
4004
|
+
return this.configureMapBlock(target, changes, options);
|
|
3949
4005
|
}
|
|
3950
4006
|
if ((current == null ? void 0 : current.use) === "CommentsBlockModel") {
|
|
3951
|
-
return this.configureCommentsBlock(target,
|
|
4007
|
+
return this.configureCommentsBlock(target, changes, options);
|
|
3952
4008
|
}
|
|
3953
4009
|
if ((current == null ? void 0 : current.use) === "TableActionsColumnModel") {
|
|
3954
|
-
return this.configureActionColumn(target,
|
|
4010
|
+
return this.configureActionColumn(target, changes, options);
|
|
3955
4011
|
}
|
|
3956
4012
|
if (import_node_use_sets.FIELD_WRAPPER_USES.has((current == null ? void 0 : current.use) || "")) {
|
|
3957
|
-
return this.configureFieldWrapper(target, current,
|
|
4013
|
+
return this.configureFieldWrapper(target, current, changes, options);
|
|
3958
4014
|
}
|
|
3959
4015
|
if (import_node_use_sets.STANDALONE_FIELD_NODE_USES.has((current == null ? void 0 : current.use) || "")) {
|
|
3960
4016
|
if ((current == null ? void 0 : current.use) === "JSColumnModel") {
|
|
3961
|
-
return this.configureJSColumn(target,
|
|
4017
|
+
return this.configureJSColumn(target, changes, options);
|
|
3962
4018
|
}
|
|
3963
4019
|
if ((current == null ? void 0 : current.use) === "DividerItemModel") {
|
|
3964
|
-
return this.configureDividerItem(target,
|
|
4020
|
+
return this.configureDividerItem(target, changes, options);
|
|
3965
4021
|
}
|
|
3966
|
-
return this.configureJSItem(target,
|
|
4022
|
+
return this.configureJSItem(target, changes, options);
|
|
3967
4023
|
}
|
|
3968
4024
|
if ((0, import_service_utils.isFieldNodeUse)(current == null ? void 0 : current.use)) {
|
|
3969
|
-
return this.configureFieldNode(target,
|
|
4025
|
+
return this.configureFieldNode(target, changes, options);
|
|
3970
4026
|
}
|
|
3971
4027
|
if (import_node_use_sets.ACTION_BUTTON_USES.has((current == null ? void 0 : current.use) || "")) {
|
|
3972
|
-
return this.configureActionNode(target, current.use,
|
|
4028
|
+
return this.configureActionNode(target, current.use, changes, {
|
|
3973
4029
|
...options,
|
|
3974
4030
|
current
|
|
3975
4031
|
});
|
|
@@ -5072,7 +5128,6 @@ class FlowSurfacesService {
|
|
|
5072
5128
|
...fieldSpec.type ? { type: fieldSpec.type } : {},
|
|
5073
5129
|
...fieldSpec.fieldType ? { fieldType: fieldSpec.fieldType } : {},
|
|
5074
5130
|
...!import_lodash.default.isUndefined(fieldSpec.fields) ? { fields: fieldSpec.fields } : {},
|
|
5075
|
-
...!import_lodash.default.isUndefined(fieldSpec.selectorFields) ? { selectorFields: fieldSpec.selectorFields } : {},
|
|
5076
5131
|
...fieldSpec.titleField ? { titleField: fieldSpec.titleField } : {},
|
|
5077
5132
|
...fieldSpec.openMode ? { openMode: fieldSpec.openMode } : {},
|
|
5078
5133
|
...fieldSpec.popupSize ? { popupSize: fieldSpec.popupSize } : {},
|
|
@@ -5314,7 +5369,6 @@ class FlowSurfacesService {
|
|
|
5314
5369
|
dataSourceKey: resolvedField.dataSourceKey,
|
|
5315
5370
|
getCollection: (dataSourceKey, collectionName) => this.getCollection(dataSourceKey, collectionName),
|
|
5316
5371
|
fields: values.fields,
|
|
5317
|
-
selectorFields: values.selectorFields,
|
|
5318
5372
|
titleField: values.titleField,
|
|
5319
5373
|
openMode: values.openMode,
|
|
5320
5374
|
popupSize: values.popupSize,
|
|
@@ -7883,6 +7937,11 @@ class FlowSurfacesService {
|
|
|
7883
7937
|
});
|
|
7884
7938
|
this.syncFilterActionSettingsForUpdateSettings(current, normalizedValues, nextPayload);
|
|
7885
7939
|
this.syncMirroredStepParamsForUpdateSettings(current, nextPayload);
|
|
7940
|
+
const updateActionAssignedValues = this.syncUpdateActionAssignedValuesForUpdateSettings(
|
|
7941
|
+
current,
|
|
7942
|
+
normalizedValues,
|
|
7943
|
+
nextPayload
|
|
7944
|
+
);
|
|
7886
7945
|
const popupActionContext = options.popupActionContext || await this.resolveRecordContextPopupActionContextForHost(current, options.transaction);
|
|
7887
7946
|
await this.normalizeOpenViewForUpdateSettings(
|
|
7888
7947
|
options.openViewActionName || "updateSettings",
|
|
@@ -7935,6 +7994,9 @@ class FlowSurfacesService {
|
|
|
7935
7994
|
};
|
|
7936
7995
|
}
|
|
7937
7996
|
await this.repository.patch(nextPayload, { transaction: options.transaction });
|
|
7997
|
+
if (!import_lodash.default.isUndefined(updateActionAssignedValues)) {
|
|
7998
|
+
await this.syncUpdateActionAssignFormItems(current.uid, updateActionAssignedValues, options.transaction);
|
|
7999
|
+
}
|
|
7938
8000
|
if (!import_lodash.default.isUndefined((_a = nextPayload.stepParams) == null ? void 0 : _a.fieldSettings)) {
|
|
7939
8001
|
await this.syncFieldBindingSettingsForNode(current, effectiveNode, options.transaction);
|
|
7940
8002
|
} else if (current.use === "FilterFormItemModel") {
|
|
@@ -8057,6 +8119,173 @@ class FlowSurfacesService {
|
|
|
8057
8119
|
nextPayload.stepParams = nextStepParams;
|
|
8058
8120
|
}
|
|
8059
8121
|
}
|
|
8122
|
+
syncUpdateActionAssignedValuesForUpdateSettings(current, values, nextPayload) {
|
|
8123
|
+
if (!UPDATE_ASSIGN_ACTION_USES.has(current == null ? void 0 : current.use)) {
|
|
8124
|
+
return void 0;
|
|
8125
|
+
}
|
|
8126
|
+
const hasAssignSettingsAssignedValues = import_lodash.default.has(values, UPDATE_ACTION_ASSIGN_SETTINGS_ASSIGNED_VALUES_PATH);
|
|
8127
|
+
const hasApplyAssignedValues = import_lodash.default.has(values, UPDATE_ACTION_APPLY_ASSIGNED_VALUES_PATH);
|
|
8128
|
+
if (!hasAssignSettingsAssignedValues && !hasApplyAssignedValues) {
|
|
8129
|
+
return void 0;
|
|
8130
|
+
}
|
|
8131
|
+
const nextStepParams = import_lodash.default.cloneDeep(nextPayload.stepParams ?? (current == null ? void 0 : current.stepParams) ?? {});
|
|
8132
|
+
const clearsAssignSettingsAssignedValues = hasAssignSettingsAssignedValues && import_lodash.default.isPlainObject(import_lodash.default.get(values, UPDATE_ACTION_ASSIGN_SETTINGS_ASSIGNED_VALUES_PATH)) && !Object.keys(import_lodash.default.get(values, UPDATE_ACTION_ASSIGN_SETTINGS_ASSIGNED_VALUES_PATH)).length;
|
|
8133
|
+
const clearsApplyAssignedValues = hasApplyAssignedValues && import_lodash.default.isPlainObject(import_lodash.default.get(values, UPDATE_ACTION_APPLY_ASSIGNED_VALUES_PATH)) && !Object.keys(import_lodash.default.get(values, UPDATE_ACTION_APPLY_ASSIGNED_VALUES_PATH)).length;
|
|
8134
|
+
const assignSettingsAssignedValues = clearsAssignSettingsAssignedValues ? {} : import_lodash.default.cloneDeep(import_lodash.default.get(nextStepParams, UPDATE_ACTION_ASSIGN_SETTINGS_STEP_PATH));
|
|
8135
|
+
const applyAssignedValues = clearsApplyAssignedValues ? {} : import_lodash.default.cloneDeep(import_lodash.default.get(nextStepParams, UPDATE_ACTION_APPLY_STEP_PATH));
|
|
8136
|
+
if (hasAssignSettingsAssignedValues && hasApplyAssignedValues && !import_lodash.default.isEqual(assignSettingsAssignedValues, applyAssignedValues)) {
|
|
8137
|
+
(0, import_errors.throwBadRequest)(
|
|
8138
|
+
"flowSurfaces updateSettings update action values 'stepParams.assignSettings.assignFieldValues.assignedValues' and 'stepParams.apply.apply.assignedValues' must match"
|
|
8139
|
+
);
|
|
8140
|
+
}
|
|
8141
|
+
const assignedValues = hasAssignSettingsAssignedValues ? assignSettingsAssignedValues : applyAssignedValues;
|
|
8142
|
+
if (!import_lodash.default.isPlainObject(assignedValues)) {
|
|
8143
|
+
(0, import_errors.throwBadRequest)(
|
|
8144
|
+
"flowSurfaces updateSettings update action values 'stepParams.assignSettings.assignFieldValues.assignedValues' requires an object payload"
|
|
8145
|
+
);
|
|
8146
|
+
}
|
|
8147
|
+
import_lodash.default.set(nextStepParams, UPDATE_ACTION_ASSIGN_SETTINGS_STEP_PATH, import_lodash.default.cloneDeep(assignedValues));
|
|
8148
|
+
import_lodash.default.set(nextStepParams, UPDATE_ACTION_APPLY_STEP_PATH, import_lodash.default.cloneDeep(assignedValues));
|
|
8149
|
+
nextPayload.stepParams = nextStepParams;
|
|
8150
|
+
return assignedValues;
|
|
8151
|
+
}
|
|
8152
|
+
async syncUpdateActionAssignFormItems(actionUid, assignedValues, transaction) {
|
|
8153
|
+
var _a, _b, _c, _d, _e, _f;
|
|
8154
|
+
const actionNode = await this.repository.findModelById(actionUid, {
|
|
8155
|
+
transaction,
|
|
8156
|
+
includeAsyncNode: true
|
|
8157
|
+
});
|
|
8158
|
+
if (!UPDATE_ASSIGN_ACTION_USES.has(actionNode == null ? void 0 : actionNode.use)) {
|
|
8159
|
+
return;
|
|
8160
|
+
}
|
|
8161
|
+
const resourceContext = await this.locator.resolveCollectionContext(actionUid, transaction).catch(() => null);
|
|
8162
|
+
const resourceInit = (resourceContext == null ? void 0 : resourceContext.resourceInit) || {};
|
|
8163
|
+
const dataSourceKey = resourceInit.dataSourceKey || "main";
|
|
8164
|
+
const collectionName = resourceInit.collectionName;
|
|
8165
|
+
const assignFormUid = await this.ensureUpdateActionAssignForm(actionNode, resourceInit, transaction);
|
|
8166
|
+
const assignFormGridUid = await this.ensureUpdateActionAssignFormGrid(assignFormUid, transaction);
|
|
8167
|
+
const refreshedGrid = await this.repository.findModelById(assignFormGridUid, {
|
|
8168
|
+
transaction,
|
|
8169
|
+
includeAsyncNode: true
|
|
8170
|
+
});
|
|
8171
|
+
const existingItems = import_lodash.default.castArray(((_a = refreshedGrid == null ? void 0 : refreshedGrid.subModels) == null ? void 0 : _a.items) || []);
|
|
8172
|
+
const existingItemsByFieldPath = /* @__PURE__ */ new Map();
|
|
8173
|
+
existingItems.forEach((item) => {
|
|
8174
|
+
var _a2, _b2, _c2;
|
|
8175
|
+
const fieldPath = String(((_c2 = (_b2 = (_a2 = item == null ? void 0 : item.stepParams) == null ? void 0 : _a2.fieldSettings) == null ? void 0 : _b2.init) == null ? void 0 : _c2.fieldPath) || "").trim();
|
|
8176
|
+
if (fieldPath && !existingItemsByFieldPath.has(fieldPath)) {
|
|
8177
|
+
existingItemsByFieldPath.set(fieldPath, item);
|
|
8178
|
+
}
|
|
8179
|
+
});
|
|
8180
|
+
const nextFieldPaths = new Set(Object.keys(assignedValues || {}).filter((fieldPath) => String(fieldPath).trim()));
|
|
8181
|
+
const keptFieldPaths = /* @__PURE__ */ new Set();
|
|
8182
|
+
for (const staleItem of existingItems) {
|
|
8183
|
+
const fieldPath = String(((_d = (_c = (_b = staleItem == null ? void 0 : staleItem.stepParams) == null ? void 0 : _b.fieldSettings) == null ? void 0 : _c.init) == null ? void 0 : _d.fieldPath) || "").trim();
|
|
8184
|
+
if (!fieldPath || !nextFieldPaths.has(fieldPath) || keptFieldPaths.has(fieldPath)) {
|
|
8185
|
+
await this.repository.remove(staleItem.uid, { transaction });
|
|
8186
|
+
continue;
|
|
8187
|
+
}
|
|
8188
|
+
keptFieldPaths.add(fieldPath);
|
|
8189
|
+
}
|
|
8190
|
+
for (const fieldPath of nextFieldPaths) {
|
|
8191
|
+
const existingItem = existingItemsByFieldPath.get(fieldPath);
|
|
8192
|
+
await this.repository.upsertModel(
|
|
8193
|
+
this.buildUpdateActionAssignFormItemTree({
|
|
8194
|
+
existingItem,
|
|
8195
|
+
uid: existingItem == null ? void 0 : existingItem.uid,
|
|
8196
|
+
fieldUid: (_f = (_e = existingItem == null ? void 0 : existingItem.subModels) == null ? void 0 : _e.field) == null ? void 0 : _f.uid,
|
|
8197
|
+
parentId: assignFormGridUid,
|
|
8198
|
+
dataSourceKey,
|
|
8199
|
+
collectionName,
|
|
8200
|
+
fieldPath,
|
|
8201
|
+
value: assignedValues[fieldPath]
|
|
8202
|
+
}),
|
|
8203
|
+
{ transaction }
|
|
8204
|
+
);
|
|
8205
|
+
}
|
|
8206
|
+
}
|
|
8207
|
+
async ensureUpdateActionAssignForm(actionNode, resourceInit, transaction) {
|
|
8208
|
+
var _a;
|
|
8209
|
+
const existing = (_a = actionNode == null ? void 0 : actionNode.subModels) == null ? void 0 : _a.assignForm;
|
|
8210
|
+
if (existing == null ? void 0 : existing.uid) {
|
|
8211
|
+
return existing.uid;
|
|
8212
|
+
}
|
|
8213
|
+
const assignFormUid = (0, import_utils.uid)();
|
|
8214
|
+
await this.repository.upsertModel(
|
|
8215
|
+
{
|
|
8216
|
+
uid: assignFormUid,
|
|
8217
|
+
parentId: actionNode.uid,
|
|
8218
|
+
subKey: "assignForm",
|
|
8219
|
+
subType: "object",
|
|
8220
|
+
use: "AssignFormModel",
|
|
8221
|
+
stepParams: {
|
|
8222
|
+
resourceSettings: {
|
|
8223
|
+
init: import_lodash.default.cloneDeep(resourceInit || {})
|
|
8224
|
+
}
|
|
8225
|
+
}
|
|
8226
|
+
},
|
|
8227
|
+
{ transaction }
|
|
8228
|
+
);
|
|
8229
|
+
return assignFormUid;
|
|
8230
|
+
}
|
|
8231
|
+
async ensureUpdateActionAssignFormGrid(assignFormUid, transaction) {
|
|
8232
|
+
return this.ensureGridChild(assignFormUid, "AssignFormGridModel", transaction);
|
|
8233
|
+
}
|
|
8234
|
+
buildUpdateActionAssignFormItemTree(input) {
|
|
8235
|
+
var _a;
|
|
8236
|
+
const init = import_lodash.default.pickBy(
|
|
8237
|
+
{
|
|
8238
|
+
dataSourceKey: input.dataSourceKey,
|
|
8239
|
+
collectionName: input.collectionName,
|
|
8240
|
+
fieldPath: input.fieldPath
|
|
8241
|
+
},
|
|
8242
|
+
(value) => !import_lodash.default.isUndefined(value)
|
|
8243
|
+
);
|
|
8244
|
+
const fieldUse = this.resolveUpdateActionAssignFormFieldUse(
|
|
8245
|
+
input.dataSourceKey,
|
|
8246
|
+
input.collectionName,
|
|
8247
|
+
input.fieldPath
|
|
8248
|
+
);
|
|
8249
|
+
const existingItem = input.existingItem || {};
|
|
8250
|
+
const existingField = ((_a = existingItem == null ? void 0 : existingItem.subModels) == null ? void 0 : _a.field) || {};
|
|
8251
|
+
const itemStepParams = import_lodash.default.cloneDeep(existingItem.stepParams || {});
|
|
8252
|
+
import_lodash.default.set(itemStepParams, ["fieldSettings", "init"], init);
|
|
8253
|
+
import_lodash.default.set(itemStepParams, ["fieldSettings", "assignValue", "value"], import_lodash.default.cloneDeep(input.value));
|
|
8254
|
+
const fieldStepParams = import_lodash.default.cloneDeep(existingField.stepParams || {});
|
|
8255
|
+
import_lodash.default.set(fieldStepParams, ["fieldSettings", "init"], init);
|
|
8256
|
+
return {
|
|
8257
|
+
uid: input.uid || (0, import_utils.uid)(),
|
|
8258
|
+
parentId: input.parentId,
|
|
8259
|
+
subKey: "items",
|
|
8260
|
+
subType: "array",
|
|
8261
|
+
use: "AssignFormItemModel",
|
|
8262
|
+
stepParams: itemStepParams,
|
|
8263
|
+
subModels: {
|
|
8264
|
+
field: {
|
|
8265
|
+
uid: input.fieldUid || (0, import_utils.uid)(),
|
|
8266
|
+
use: existingField.use || fieldUse,
|
|
8267
|
+
stepParams: fieldStepParams
|
|
8268
|
+
}
|
|
8269
|
+
}
|
|
8270
|
+
};
|
|
8271
|
+
}
|
|
8272
|
+
resolveUpdateActionAssignFormFieldUse(dataSourceKey, collectionName, fieldPath) {
|
|
8273
|
+
const collection = collectionName ? this.getCollection(dataSourceKey, collectionName) : null;
|
|
8274
|
+
const field = (0, import_service_helpers.resolveFieldFromCollection)(collection, fieldPath);
|
|
8275
|
+
if (field) {
|
|
8276
|
+
const registeredBinding = this.resolveRegisteredFieldBinding({
|
|
8277
|
+
containerUse: "AssignFormGridModel",
|
|
8278
|
+
field,
|
|
8279
|
+
dataSourceKey,
|
|
8280
|
+
useStrictOnly: true
|
|
8281
|
+
});
|
|
8282
|
+
if (registeredBinding == null ? void 0 : registeredBinding.modelClassName) {
|
|
8283
|
+
return registeredBinding.modelClassName;
|
|
8284
|
+
}
|
|
8285
|
+
return (0, import_service_helpers.inferFieldMenuEditableFieldUse)((0, import_service_helpers.getFieldInterface)(field)) || "InputFieldModel";
|
|
8286
|
+
}
|
|
8287
|
+
return "InputFieldModel";
|
|
8288
|
+
}
|
|
8060
8289
|
normalizeCanonicalBlockHeaderWriteForUpdateSettings(current, values) {
|
|
8061
8290
|
const semanticUse = (0, import_approval.normalizeApprovalSemanticUse)(current == null ? void 0 : current.use);
|
|
8062
8291
|
if (!CANONICAL_BLOCK_HEADER_USES.has(semanticUse)) {
|
|
@@ -11162,7 +11391,6 @@ class FlowSurfacesService {
|
|
|
11162
11391
|
"version",
|
|
11163
11392
|
"fieldType",
|
|
11164
11393
|
"fields",
|
|
11165
|
-
"selectorFields",
|
|
11166
11394
|
"openMode",
|
|
11167
11395
|
"popupSize",
|
|
11168
11396
|
"pageSize",
|
|
@@ -11277,7 +11505,7 @@ class FlowSurfacesService {
|
|
|
11277
11505
|
let effectiveInnerFieldUse = innerField == null ? void 0 : innerField.use;
|
|
11278
11506
|
let fieldTypeResolution;
|
|
11279
11507
|
let relationTitleFieldToApply;
|
|
11280
|
-
if ((0, import_service_utils.hasOwnDefined)(changes, "fieldType") || (0, import_service_utils.hasOwnDefined)(changes, "fields") || (0, import_service_utils.hasOwnDefined)(changes, "
|
|
11508
|
+
if ((0, import_service_utils.hasOwnDefined)(changes, "fieldType") || (0, import_service_utils.hasOwnDefined)(changes, "fields") || (0, import_service_utils.hasOwnDefined)(changes, "titleField") || (0, import_service_utils.hasOwnDefined)(changes, "openMode") || (0, import_service_utils.hasOwnDefined)(changes, "popupSize") || (0, import_service_utils.hasOwnDefined)(changes, "pageSize") || (0, import_service_utils.hasOwnDefined)(changes, "showIndex")) {
|
|
11281
11509
|
if (!innerUid) {
|
|
11282
11510
|
(0, import_errors.throwConflict)(
|
|
11283
11511
|
`flowSurfaces configure field wrapper '${current == null ? void 0 : current.use}' cannot resolve inner field`,
|
|
@@ -11296,7 +11524,6 @@ class FlowSurfacesService {
|
|
|
11296
11524
|
dataSourceKey: (_l = fieldSource.fieldSettingsInit) == null ? void 0 : _l.dataSourceKey,
|
|
11297
11525
|
getCollection: (dataSourceKey, collectionName) => this.getCollection(dataSourceKey, collectionName),
|
|
11298
11526
|
fields: changes.fields,
|
|
11299
|
-
selectorFields: changes.selectorFields,
|
|
11300
11527
|
titleField: (0, import_service_utils.hasOwnDefined)(wrapperChanges, "titleField") ? wrapperChanges.titleField : void 0,
|
|
11301
11528
|
openMode: (0, import_service_utils.hasOwnDefined)(changes, "openMode") ? changes.openMode : void 0,
|
|
11302
11529
|
popupSize: (0, import_service_utils.hasOwnDefined)(changes, "popupSize") ? changes.popupSize : void 0,
|
|
@@ -11327,7 +11554,7 @@ class FlowSurfacesService {
|
|
|
11327
11554
|
targetCollection: fieldTypeResolution.targetCollection,
|
|
11328
11555
|
relationFieldInit: fieldSource.fieldSettingsInit,
|
|
11329
11556
|
fields: (0, import_service_utils.hasOwnDefined)(changes, "fields") || shouldApplyFieldTypeDefaults ? fieldTypeResolution.fields : void 0,
|
|
11330
|
-
selectorFields: (0, import_service_utils.hasOwnDefined)(changes, "
|
|
11557
|
+
selectorFields: (0, import_service_utils.hasOwnDefined)(changes, "fields") || shouldApplyFieldTypeDefaults ? fieldTypeResolution.selectorFields : void 0,
|
|
11331
11558
|
titleField: relationTitleFieldToApply,
|
|
11332
11559
|
openMode: fieldTypeResolution.openMode,
|
|
11333
11560
|
popupSize: fieldTypeResolution.popupSize,
|
|
@@ -11547,6 +11774,12 @@ class FlowSurfacesService {
|
|
|
11547
11774
|
}
|
|
11548
11775
|
return import_lodash.default.cloneDeep(value);
|
|
11549
11776
|
}
|
|
11777
|
+
normalizeActionAssignValues(actionName, value) {
|
|
11778
|
+
if (!import_lodash.default.isPlainObject(value)) {
|
|
11779
|
+
(0, import_errors.throwBadRequest)(`flowSurfaces ${actionName} assignValues must be an object`);
|
|
11780
|
+
}
|
|
11781
|
+
return import_lodash.default.cloneDeep(value);
|
|
11782
|
+
}
|
|
11550
11783
|
async configureActionNode(target, use, changes, options) {
|
|
11551
11784
|
changes = await this.normalizeActionPanelActionChanges(changes, options);
|
|
11552
11785
|
const allowedKeys = (0, import_configure_options.getConfigureOptionKeysForUse)(use);
|
|
@@ -11634,7 +11867,7 @@ class FlowSurfacesService {
|
|
|
11634
11867
|
stepParams.submitSettings = {
|
|
11635
11868
|
confirm: (0, import_service_utils.normalizeSimpleConfirm)(changes.confirm)
|
|
11636
11869
|
};
|
|
11637
|
-
} else if (
|
|
11870
|
+
} else if (UPDATE_ASSIGN_ACTION_USES.has(use)) {
|
|
11638
11871
|
stepParams.assignSettings = {
|
|
11639
11872
|
confirm: (0, import_service_utils.normalizeSimpleConfirm)(changes.confirm)
|
|
11640
11873
|
};
|
|
@@ -11643,25 +11876,26 @@ class FlowSurfacesService {
|
|
|
11643
11876
|
}
|
|
11644
11877
|
}
|
|
11645
11878
|
if ((0, import_service_utils.hasOwnDefined)(changes, "assignValues")) {
|
|
11879
|
+
const assignValues = this.normalizeActionAssignValues("configure", changes.assignValues);
|
|
11646
11880
|
if (APPROVAL_ASSIGN_ACTION_USES.has(use)) {
|
|
11647
11881
|
stepParams.clickSettings = {
|
|
11648
11882
|
...stepParams.clickSettings || {},
|
|
11649
11883
|
assignFieldValues: {
|
|
11650
|
-
assignedValues:
|
|
11884
|
+
assignedValues: assignValues
|
|
11651
11885
|
}
|
|
11652
11886
|
};
|
|
11653
|
-
} else if (!
|
|
11887
|
+
} else if (!UPDATE_ASSIGN_ACTION_USES.has(use)) {
|
|
11654
11888
|
(0, import_errors.throwBadRequest)(`flowSurfaces configure action '${use}' does not support assignValues`);
|
|
11655
11889
|
} else {
|
|
11656
11890
|
stepParams.assignSettings = {
|
|
11657
11891
|
...stepParams.assignSettings || {},
|
|
11658
11892
|
assignFieldValues: {
|
|
11659
|
-
assignedValues:
|
|
11893
|
+
assignedValues: assignValues
|
|
11660
11894
|
}
|
|
11661
11895
|
};
|
|
11662
11896
|
stepParams.apply = {
|
|
11663
11897
|
apply: {
|
|
11664
|
-
assignedValues:
|
|
11898
|
+
assignedValues: assignValues
|
|
11665
11899
|
}
|
|
11666
11900
|
};
|
|
11667
11901
|
}
|
|
@@ -11677,7 +11911,7 @@ class FlowSurfacesService {
|
|
|
11677
11911
|
};
|
|
11678
11912
|
}
|
|
11679
11913
|
if ((0, import_service_utils.hasOwnDefined)(changes, "updateMode")) {
|
|
11680
|
-
if (!
|
|
11914
|
+
if (!UPDATE_ASSIGN_ACTION_USES.has(use)) {
|
|
11681
11915
|
(0, import_errors.throwBadRequest)(`flowSurfaces configure action '${use}' does not support updateMode`);
|
|
11682
11916
|
}
|
|
11683
11917
|
stepParams.assignSettings = {
|
|
@@ -14874,10 +15108,12 @@ class FlowSurfacesService {
|
|
|
14874
15108
|
}
|
|
14875
15109
|
if (input.fieldUse === "RecordPickerFieldModel") {
|
|
14876
15110
|
await this.applyRecordPickerFieldTypeSettings(input);
|
|
15111
|
+
} else if (input.fieldUse === "PopupSubTableFieldModel") {
|
|
15112
|
+
await this.ensureRelationSelectorGridTable(input);
|
|
14877
15113
|
}
|
|
14878
15114
|
}
|
|
14879
15115
|
async applyRecordPickerFieldTypeSettings(input) {
|
|
14880
|
-
var _a
|
|
15116
|
+
var _a;
|
|
14881
15117
|
const fieldNode = await this.repository.findModelById(input.fieldUid, {
|
|
14882
15118
|
transaction: input.transaction,
|
|
14883
15119
|
includeAsyncNode: true
|
|
@@ -14902,6 +15138,10 @@ class FlowSurfacesService {
|
|
|
14902
15138
|
{ transaction: input.transaction }
|
|
14903
15139
|
);
|
|
14904
15140
|
}
|
|
15141
|
+
await this.ensureRelationSelectorGridTable(input);
|
|
15142
|
+
}
|
|
15143
|
+
async ensureRelationSelectorGridTable(input) {
|
|
15144
|
+
var _a, _b, _c;
|
|
14905
15145
|
if (!input.selectorFields) {
|
|
14906
15146
|
return;
|
|
14907
15147
|
}
|
|
@@ -14918,6 +15158,7 @@ class FlowSurfacesService {
|
|
|
14918
15158
|
parentId: input.fieldUid,
|
|
14919
15159
|
subKey: "grid-block",
|
|
14920
15160
|
subType: "object",
|
|
15161
|
+
async: true,
|
|
14921
15162
|
use: "BlockGridModel"
|
|
14922
15163
|
},
|
|
14923
15164
|
{ transaction: input.transaction }
|
|
@@ -14930,30 +15171,67 @@ class FlowSurfacesService {
|
|
|
14930
15171
|
if (!(grid == null ? void 0 : grid.uid)) {
|
|
14931
15172
|
return;
|
|
14932
15173
|
}
|
|
14933
|
-
const
|
|
14934
|
-
|
|
14935
|
-
);
|
|
15174
|
+
const gridItems = import_lodash.default.castArray(((_a = grid == null ? void 0 : grid.subModels) == null ? void 0 : _a.items) || []);
|
|
15175
|
+
const existingTable = gridItems.find((item) => (item == null ? void 0 : item.use) === "TableSelectModel") || gridItems.find((item) => (item == null ? void 0 : item.use) === "TableBlockModel");
|
|
14936
15176
|
const tableUid = (existingTable == null ? void 0 : existingTable.uid) || (0, import_utils.uid)();
|
|
14937
|
-
|
|
14938
|
-
|
|
14939
|
-
|
|
14940
|
-
|
|
14941
|
-
|
|
14942
|
-
|
|
14943
|
-
|
|
14944
|
-
|
|
14945
|
-
|
|
14946
|
-
|
|
14947
|
-
|
|
14948
|
-
|
|
14949
|
-
|
|
14950
|
-
|
|
15177
|
+
for (const item of gridItems) {
|
|
15178
|
+
if ((item == null ? void 0 : item.uid) && item.uid !== tableUid) {
|
|
15179
|
+
await this.removeNodeTreeWithBindings(item.uid, input.transaction);
|
|
15180
|
+
}
|
|
15181
|
+
}
|
|
15182
|
+
await this.repository.upsertModel(
|
|
15183
|
+
{
|
|
15184
|
+
...import_lodash.default.omit(import_lodash.default.cloneDeep(existingTable || {}), [
|
|
15185
|
+
"uid",
|
|
15186
|
+
"use",
|
|
15187
|
+
"subModels",
|
|
15188
|
+
"sortIndex",
|
|
15189
|
+
"parentId",
|
|
15190
|
+
"subKey",
|
|
15191
|
+
"subType"
|
|
15192
|
+
]),
|
|
15193
|
+
uid: tableUid,
|
|
15194
|
+
parentId: grid.uid,
|
|
15195
|
+
subKey: "items",
|
|
15196
|
+
subType: "array",
|
|
15197
|
+
use: "TableSelectModel",
|
|
15198
|
+
stepParams: import_lodash.default.merge({}, import_lodash.default.cloneDeep((existingTable == null ? void 0 : existingTable.stepParams) || {}), {
|
|
15199
|
+
resourceSettings: {
|
|
15200
|
+
init: {
|
|
15201
|
+
dataSourceKey: ((_b = input.targetCollection) == null ? void 0 : _b.dataSourceKey) || "main",
|
|
15202
|
+
collectionName: (0, import_service_helpers.getCollectionName)(input.targetCollection)
|
|
14951
15203
|
}
|
|
14952
15204
|
}
|
|
15205
|
+
})
|
|
15206
|
+
},
|
|
15207
|
+
{ transaction: input.transaction }
|
|
15208
|
+
);
|
|
15209
|
+
const layout = {
|
|
15210
|
+
rows: {
|
|
15211
|
+
row1: [[tableUid]]
|
|
15212
|
+
},
|
|
15213
|
+
sizes: {
|
|
15214
|
+
row1: [24]
|
|
15215
|
+
},
|
|
15216
|
+
rowOrder: ["row1"]
|
|
15217
|
+
};
|
|
15218
|
+
await this.repository.patch(
|
|
15219
|
+
{
|
|
15220
|
+
uid: grid.uid,
|
|
15221
|
+
props: {
|
|
15222
|
+
...grid.props || {},
|
|
15223
|
+
...layout
|
|
14953
15224
|
},
|
|
14954
|
-
|
|
14955
|
-
|
|
14956
|
-
|
|
15225
|
+
stepParams: {
|
|
15226
|
+
...grid.stepParams || {},
|
|
15227
|
+
[GRID_SETTINGS_FLOW_KEY]: {
|
|
15228
|
+
...((_c = grid.stepParams) == null ? void 0 : _c[GRID_SETTINGS_FLOW_KEY]) || {},
|
|
15229
|
+
[GRID_SETTINGS_LAYOUT_STEP_KEY]: layout
|
|
15230
|
+
}
|
|
15231
|
+
}
|
|
15232
|
+
},
|
|
15233
|
+
{ transaction: input.transaction }
|
|
15234
|
+
);
|
|
14957
15235
|
await this.replaceFieldSubModelArray({
|
|
14958
15236
|
parentUid: tableUid,
|
|
14959
15237
|
subKey: "columns",
|