@nocobase/plugin-flow-engine 2.2.0-beta.2 → 2.2.0-beta.3
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 +372 -32
- package/dist/server/flow-surfaces/blueprint/export-document.d.ts +50 -0
- package/dist/server/flow-surfaces/blueprint/export-document.js +2503 -0
- package/dist/server/flow-surfaces/constants.d.ts +9 -2
- package/dist/server/flow-surfaces/constants.js +1 -0
- 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 +19 -0
- package/dist/server/flow-surfaces/service.js +189 -20
- 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
|
@@ -0,0 +1,2503 @@
|
|
|
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 export_document_exports = {};
|
|
38
|
+
__export(export_document_exports, {
|
|
39
|
+
exportFlowSurfaceBlueprintDocument: () => exportFlowSurfaceBlueprintDocument
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(export_document_exports);
|
|
42
|
+
var import_lodash = __toESM(require("lodash"));
|
|
43
|
+
var import_catalog = require("../catalog");
|
|
44
|
+
var import_chart_config = require("../chart-config");
|
|
45
|
+
var import_errors = require("../errors");
|
|
46
|
+
var import_field_type_resolver = require("../field-type-resolver");
|
|
47
|
+
var import_service_utils = require("../service-utils");
|
|
48
|
+
var import_key_registry = require("../planning/key-registry");
|
|
49
|
+
var import_linkage = require("../reaction/linkage");
|
|
50
|
+
var import_field_value = require("../reaction/field-value");
|
|
51
|
+
var import_resolver = require("../reaction/resolver");
|
|
52
|
+
var import_registry = require("../reaction/registry");
|
|
53
|
+
var import_private_utils = require("./private-utils");
|
|
54
|
+
const UNSUPPORTED_MANUAL_ACTION = "Recreate this node manually or add mapper support.";
|
|
55
|
+
const UNSUPPORTED_BLOCK_MANUAL_ACTION = "Recreate this block manually or add mapper support.";
|
|
56
|
+
const APPLY_BLUEPRINT_UNSUPPORTED_BLOCK_TYPES = /* @__PURE__ */ new Set(["form", "map"]);
|
|
57
|
+
const DATA_BLOCK_SETTING_GROUP_BY_TYPE = {
|
|
58
|
+
table: "tableSettings",
|
|
59
|
+
createForm: "formModelSettings",
|
|
60
|
+
editForm: "formModelSettings",
|
|
61
|
+
details: "detailsSettings",
|
|
62
|
+
filterForm: "formFilterBlockModelSettings",
|
|
63
|
+
list: "listSettings",
|
|
64
|
+
gridCard: "GridCardSettings",
|
|
65
|
+
calendar: "calendarSettings",
|
|
66
|
+
kanban: "kanbanSettings",
|
|
67
|
+
tree: "treeSettings",
|
|
68
|
+
comments: "commentsSettings",
|
|
69
|
+
recordHistory: "recordHistorySettings"
|
|
70
|
+
};
|
|
71
|
+
const FIELD_GRID_BLOCK_TYPES = /* @__PURE__ */ new Set(["createForm", "editForm", "details", "filterForm"]);
|
|
72
|
+
const CARD_FIELD_BLOCK_TYPES = /* @__PURE__ */ new Set(["list", "gridCard", "kanban"]);
|
|
73
|
+
const TABLE_ACTIONS_COLUMN_USE = "TableActionsColumnModel";
|
|
74
|
+
const FLOW_REGISTRY_UNSUPPORTED_REASON = "unsupported-flow-registry";
|
|
75
|
+
const TEMPLATE_SUMMARY_UNSUPPORTED_REASON = "unsupported-template-summary";
|
|
76
|
+
const PUBLIC_POPUP_ACTION_TYPES = /* @__PURE__ */ new Set(["addNew", "addChild", "view", "edit", "popup", "duplicate"]);
|
|
77
|
+
const BASIC_ACTION_STEP_PARAM_GROUPS = /* @__PURE__ */ new Set([
|
|
78
|
+
"buttonSettings",
|
|
79
|
+
"deleteSettings",
|
|
80
|
+
"popupSettings",
|
|
81
|
+
"filterSettings",
|
|
82
|
+
"clickSettings",
|
|
83
|
+
"jsSettings"
|
|
84
|
+
]);
|
|
85
|
+
const BASIC_ACTION_PROP_KEYS = /* @__PURE__ */ new Set([
|
|
86
|
+
"title",
|
|
87
|
+
"tooltip",
|
|
88
|
+
"icon",
|
|
89
|
+
"type",
|
|
90
|
+
"danger",
|
|
91
|
+
"color",
|
|
92
|
+
"defaultFilterValue",
|
|
93
|
+
"filterValue",
|
|
94
|
+
"filterableFieldNames",
|
|
95
|
+
"position"
|
|
96
|
+
]);
|
|
97
|
+
const BASIC_ACTION_BUTTON_GENERAL_KEYS = /* @__PURE__ */ new Set(["title", "tooltip", "icon", "type", "danger", "color"]);
|
|
98
|
+
const BASIC_DELETE_ACTION_TYPES = /* @__PURE__ */ new Set(["delete", "bulkDelete"]);
|
|
99
|
+
const RECORD_HISTORY_GENERATED_ACTION_USES = /* @__PURE__ */ new Set([
|
|
100
|
+
"RecordHistoryExpandActionModel",
|
|
101
|
+
"RecordHistoryCollapseActionModel"
|
|
102
|
+
]);
|
|
103
|
+
const BASIC_DELETE_CONFIRM_KEYS = /* @__PURE__ */ new Set(["enable", "title", "content"]);
|
|
104
|
+
const BASIC_INLINE_POPUP_OPEN_VIEW_KEYS = /* @__PURE__ */ new Set(["mode", "title", "tryTemplate", "defaultType"]);
|
|
105
|
+
const BASIC_INLINE_POPUP_DEFAULT_RUNTIME_KEYS = /* @__PURE__ */ new Set([
|
|
106
|
+
"size",
|
|
107
|
+
"pageModelClass",
|
|
108
|
+
"dataSourceKey",
|
|
109
|
+
"collectionName",
|
|
110
|
+
"associationName",
|
|
111
|
+
"sourceId",
|
|
112
|
+
"filterByTk"
|
|
113
|
+
]);
|
|
114
|
+
const JS_ACTION_USES = /* @__PURE__ */ new Set([
|
|
115
|
+
"JSCollectionActionModel",
|
|
116
|
+
"JSRecordActionModel",
|
|
117
|
+
"JSFormActionModel",
|
|
118
|
+
"FilterFormJSActionModel",
|
|
119
|
+
"JSActionModel"
|
|
120
|
+
]);
|
|
121
|
+
const JS_ITEM_ACTION_USES = /* @__PURE__ */ new Set(["JSItemActionModel"]);
|
|
122
|
+
const BASIC_FIELD_STEP_PARAM_GROUPS = /* @__PURE__ */ new Set([
|
|
123
|
+
"fieldSettings",
|
|
124
|
+
"tableColumnSettings",
|
|
125
|
+
"detailItemSettings",
|
|
126
|
+
"editItemSettings",
|
|
127
|
+
"filterFormItemSettings",
|
|
128
|
+
"jsSettings"
|
|
129
|
+
]);
|
|
130
|
+
const EXPORTED_RESOURCE_SETTING_PATHS = [
|
|
131
|
+
"init.dataSourceKey",
|
|
132
|
+
"init.collectionName",
|
|
133
|
+
"init.associationName",
|
|
134
|
+
"init.associationPathName",
|
|
135
|
+
"init.sourceId",
|
|
136
|
+
"init.filterByTk"
|
|
137
|
+
];
|
|
138
|
+
const EXPORTED_DATA_BLOCK_SETTING_PATHS = ["dataScope.filter.*", "defaultSorting.sort", "pageSize.pageSize"];
|
|
139
|
+
const EXPORTED_LIST_BLOCK_SETTING_PATHS = [...EXPORTED_DATA_BLOCK_SETTING_PATHS, "layout.layout"];
|
|
140
|
+
const EXPORTED_GRID_CARD_BLOCK_SETTING_PATHS = [
|
|
141
|
+
"columnCount.columnCount.xs",
|
|
142
|
+
"columnCount.columnCount.sm",
|
|
143
|
+
"columnCount.columnCount.md",
|
|
144
|
+
"columnCount.columnCount.lg",
|
|
145
|
+
"columnCount.columnCount.xl",
|
|
146
|
+
"columnCount.columnCount.xxl",
|
|
147
|
+
"rowCount.rowCount",
|
|
148
|
+
"dataScope.filter.*",
|
|
149
|
+
"defaultSorting.sort",
|
|
150
|
+
"layout.layout"
|
|
151
|
+
];
|
|
152
|
+
const EXPORTED_KANBAN_BLOCK_SETTING_PATHS = [
|
|
153
|
+
"grouping.groupField",
|
|
154
|
+
"grouping.groupTitleField",
|
|
155
|
+
"grouping.groupColorField",
|
|
156
|
+
"grouping.groupOptions.*",
|
|
157
|
+
"styleVariant.styleVariant",
|
|
158
|
+
"defaultSorting.sort",
|
|
159
|
+
"dragEnabled.dragEnabled",
|
|
160
|
+
"dragSortBy.dragSortBy",
|
|
161
|
+
"quickCreate.quickCreateEnabled",
|
|
162
|
+
"popup.*",
|
|
163
|
+
"pageSize.pageSize",
|
|
164
|
+
"columnWidth.columnWidth",
|
|
165
|
+
"dataScope.filter.*"
|
|
166
|
+
];
|
|
167
|
+
const EXPORTED_KANBAN_CARD_ITEM_SETTING_PATHS = [
|
|
168
|
+
"click.enableCardClick",
|
|
169
|
+
"popup.*",
|
|
170
|
+
"layout.layout",
|
|
171
|
+
"layout.labelAlign",
|
|
172
|
+
"layout.labelWidth",
|
|
173
|
+
"layout.labelWrap",
|
|
174
|
+
"layout.colon"
|
|
175
|
+
];
|
|
176
|
+
const EXPORTED_ACTION_PANEL_BLOCK_SETTING_PATHS = ["layout.layout", "ellipsis.ellipsis"];
|
|
177
|
+
const EXPORTED_RECORD_HISTORY_BLOCK_SETTING_PATHS = [
|
|
178
|
+
"sortOrder.order",
|
|
179
|
+
"dataScope.filter.*",
|
|
180
|
+
"expand.expand",
|
|
181
|
+
"template.apply"
|
|
182
|
+
];
|
|
183
|
+
const EXPORTED_CALENDAR_SETTING_PATHS = [
|
|
184
|
+
"titleField.titleField",
|
|
185
|
+
"colorField.colorFieldName",
|
|
186
|
+
"startDateField.start",
|
|
187
|
+
"endDateField.end",
|
|
188
|
+
"defaultView.defaultView",
|
|
189
|
+
"quickCreateEvent.enableQuickCreateEvent",
|
|
190
|
+
"showLunar.showLunar",
|
|
191
|
+
"weekStart.weekStart",
|
|
192
|
+
"quickCreatePopupSettings.*",
|
|
193
|
+
"eventPopupSettings.*",
|
|
194
|
+
"dataScope.filter.*"
|
|
195
|
+
];
|
|
196
|
+
const EXPORTED_TREE_BLOCK_PROP_KEYS = /* @__PURE__ */ new Set([
|
|
197
|
+
"searchable",
|
|
198
|
+
"defaultExpandAll",
|
|
199
|
+
"includeDescendants",
|
|
200
|
+
"fieldNames",
|
|
201
|
+
"pageSize"
|
|
202
|
+
]);
|
|
203
|
+
const EXPORTED_CALENDAR_BLOCK_PROP_KEYS = /* @__PURE__ */ new Set([
|
|
204
|
+
"fieldNames",
|
|
205
|
+
"defaultView",
|
|
206
|
+
"enableQuickCreateEvent",
|
|
207
|
+
"showLunar",
|
|
208
|
+
"weekStart",
|
|
209
|
+
"quickCreatePopupSettings",
|
|
210
|
+
"eventPopupSettings"
|
|
211
|
+
]);
|
|
212
|
+
const EXPORTED_CALENDAR_POPUP_KEYS = /* @__PURE__ */ new Set(["mode", "size", "title", "tryTemplate", "defaultType"]);
|
|
213
|
+
const IGNORED_CALENDAR_POPUP_RUNTIME_KEYS = /* @__PURE__ */ new Set([
|
|
214
|
+
"uid",
|
|
215
|
+
"pageModelClass",
|
|
216
|
+
"collectionName",
|
|
217
|
+
"dataSourceKey",
|
|
218
|
+
"associationName",
|
|
219
|
+
"filterByTk",
|
|
220
|
+
"sourceId",
|
|
221
|
+
"template",
|
|
222
|
+
"popupTemplateUid",
|
|
223
|
+
"popupTemplateContext",
|
|
224
|
+
"popupTemplateMode",
|
|
225
|
+
"popupTemplateHasFilterByTk",
|
|
226
|
+
"popupTemplateHasSourceId"
|
|
227
|
+
]);
|
|
228
|
+
const EXPORTED_KANBAN_BLOCK_PROP_KEYS = /* @__PURE__ */ new Set([
|
|
229
|
+
"groupField",
|
|
230
|
+
"groupTitleField",
|
|
231
|
+
"groupColorField",
|
|
232
|
+
"groupOptions",
|
|
233
|
+
"styleVariant",
|
|
234
|
+
"sortField",
|
|
235
|
+
"globalSort",
|
|
236
|
+
"dragEnabled",
|
|
237
|
+
"dragSortBy",
|
|
238
|
+
"quickCreateEnabled",
|
|
239
|
+
"popupMode",
|
|
240
|
+
"popupSize",
|
|
241
|
+
"popupTemplateUid",
|
|
242
|
+
"popupPageModelClass",
|
|
243
|
+
"popupTargetUid",
|
|
244
|
+
"quickCreatePopupSettings",
|
|
245
|
+
"pageSize",
|
|
246
|
+
"columnWidth"
|
|
247
|
+
]);
|
|
248
|
+
const EXPORTED_KANBAN_CARD_ITEM_PROP_KEYS = /* @__PURE__ */ new Set([
|
|
249
|
+
"enableCardClick",
|
|
250
|
+
"openMode",
|
|
251
|
+
"popupSize",
|
|
252
|
+
"popupTemplateUid",
|
|
253
|
+
"pageModelClass",
|
|
254
|
+
"popupTargetUid",
|
|
255
|
+
"cardPopupSettings",
|
|
256
|
+
"layout",
|
|
257
|
+
"labelAlign",
|
|
258
|
+
"labelWidth",
|
|
259
|
+
"labelWrap",
|
|
260
|
+
"colon"
|
|
261
|
+
]);
|
|
262
|
+
const EXPORTED_KANBAN_POPUP_KEYS = /* @__PURE__ */ new Set(["mode", "size", "title", "tryTemplate", "defaultType"]);
|
|
263
|
+
const IGNORED_KANBAN_POPUP_RUNTIME_KEYS = /* @__PURE__ */ new Set([
|
|
264
|
+
"uid",
|
|
265
|
+
"pageModelClass",
|
|
266
|
+
"collectionName",
|
|
267
|
+
"dataSourceKey",
|
|
268
|
+
"associationName",
|
|
269
|
+
"filterByTk",
|
|
270
|
+
"sourceId",
|
|
271
|
+
"template",
|
|
272
|
+
"popupTemplateUid",
|
|
273
|
+
"popupTemplateContext",
|
|
274
|
+
"popupTemplateMode",
|
|
275
|
+
"popupTemplateHasFilterByTk",
|
|
276
|
+
"popupTemplateHasSourceId"
|
|
277
|
+
]);
|
|
278
|
+
const EXPORTED_ACTION_PANEL_BLOCK_PROP_KEYS = /* @__PURE__ */ new Set(["layout", "ellipsis"]);
|
|
279
|
+
const EXPORTED_JS_BLOCK_DECORATOR_PROP_KEYS = /* @__PURE__ */ new Set(["title", "description"]);
|
|
280
|
+
const EXPORTED_TREE_BLOCK_SETTING_PATHS = [
|
|
281
|
+
"searchable.searchable",
|
|
282
|
+
"defaultExpandAll.defaultExpandAll",
|
|
283
|
+
"includeDescendants.includeDescendants",
|
|
284
|
+
"titleField.titleField",
|
|
285
|
+
...EXPORTED_DATA_BLOCK_SETTING_PATHS
|
|
286
|
+
];
|
|
287
|
+
const EXPORTED_BLOCK_CARD_SETTING_PATHS = [
|
|
288
|
+
"titleDescription.title",
|
|
289
|
+
"titleDescription.description",
|
|
290
|
+
"blockHeight.height",
|
|
291
|
+
"blockHeight.heightMode",
|
|
292
|
+
"linkageRules.value"
|
|
293
|
+
];
|
|
294
|
+
const EXPORTED_SIMPLE_BLOCK_SETTING_PATHS_BY_TYPE = {
|
|
295
|
+
markdown: ["editMarkdown.content"],
|
|
296
|
+
jsBlock: ["runJs.code", "runJs.version"],
|
|
297
|
+
iframe: ["editIframe"]
|
|
298
|
+
};
|
|
299
|
+
const EXPORTED_BLOCK_STEP_PARAM_PATHS_BY_GROUP = {
|
|
300
|
+
resourceSettings: EXPORTED_RESOURCE_SETTING_PATHS,
|
|
301
|
+
TriggerChildPageSettings: EXPORTED_RESOURCE_SETTING_PATHS,
|
|
302
|
+
ApprovalChildPageSettings: EXPORTED_RESOURCE_SETTING_PATHS,
|
|
303
|
+
tableSettings: EXPORTED_DATA_BLOCK_SETTING_PATHS,
|
|
304
|
+
formModelSettings: ["dataScope.filter.*", "defaultSorting.sort", "pageSize.pageSize", "linkageRules.value"],
|
|
305
|
+
detailsSettings: ["dataScope.filter.*", "defaultSorting.sort", "pageSize.pageSize", "linkageRules.value"],
|
|
306
|
+
formFilterBlockModelSettings: ["dataScope.filter.*", "defaultSorting.sort", "pageSize.pageSize"],
|
|
307
|
+
listSettings: EXPORTED_LIST_BLOCK_SETTING_PATHS,
|
|
308
|
+
GridCardSettings: EXPORTED_GRID_CARD_BLOCK_SETTING_PATHS,
|
|
309
|
+
calendarSettings: EXPORTED_CALENDAR_SETTING_PATHS,
|
|
310
|
+
kanbanSettings: EXPORTED_KANBAN_BLOCK_SETTING_PATHS,
|
|
311
|
+
treeSettings: EXPORTED_TREE_BLOCK_SETTING_PATHS,
|
|
312
|
+
commentsSettings: ["dataScope.filter.*", "pageSize.pageSize"],
|
|
313
|
+
actionPanelBlockSetting: EXPORTED_ACTION_PANEL_BLOCK_SETTING_PATHS,
|
|
314
|
+
recordHistorySettings: EXPORTED_RECORD_HISTORY_BLOCK_SETTING_PATHS,
|
|
315
|
+
cardSettings: EXPORTED_BLOCK_CARD_SETTING_PATHS,
|
|
316
|
+
chartSettings: ["configure.*"]
|
|
317
|
+
};
|
|
318
|
+
const EXPORTED_TABLE_COLUMN_SETTING_PATHS = [
|
|
319
|
+
"title.title",
|
|
320
|
+
"tooltip.tooltip",
|
|
321
|
+
"width.width",
|
|
322
|
+
"fixed.fixed",
|
|
323
|
+
"sorter.sorter",
|
|
324
|
+
"quickEdit.editable",
|
|
325
|
+
"fieldNames.label",
|
|
326
|
+
"linkageRules.value"
|
|
327
|
+
];
|
|
328
|
+
const EXPORTED_DETAIL_ITEM_SETTING_PATHS = [
|
|
329
|
+
"showLabel.showLabel",
|
|
330
|
+
"label.title",
|
|
331
|
+
"tooltip.tooltip",
|
|
332
|
+
"description.description",
|
|
333
|
+
"fieldNames.label",
|
|
334
|
+
"linkageRules.value"
|
|
335
|
+
];
|
|
336
|
+
const EXPORTED_EDIT_ITEM_SETTING_PATHS = [
|
|
337
|
+
"showLabel.showLabel",
|
|
338
|
+
"label.label",
|
|
339
|
+
"tooltip.tooltip",
|
|
340
|
+
"description.description",
|
|
341
|
+
"initialValue.defaultValue",
|
|
342
|
+
"required.required",
|
|
343
|
+
"pattern.pattern",
|
|
344
|
+
"titleField.label",
|
|
345
|
+
"linkageRules.value"
|
|
346
|
+
];
|
|
347
|
+
const EXPORTED_FILTER_FORM_ITEM_SETTING_PATHS = [
|
|
348
|
+
"showLabel.showLabel",
|
|
349
|
+
"label.label",
|
|
350
|
+
"tooltip.tooltip",
|
|
351
|
+
"description.description",
|
|
352
|
+
"initialValue.defaultValue"
|
|
353
|
+
];
|
|
354
|
+
const EXPORTED_JS_FIELD_SETTING_PATHS = ["runJs.code", "runJs.version"];
|
|
355
|
+
const EXPORTED_FIELD_DECORATOR_PROP_KEYS = /* @__PURE__ */ new Set(["labelWidth", "labelWrap"]);
|
|
356
|
+
const TABLE_FIELD_PUBLIC_PROP_KEYS = /* @__PURE__ */ new Set([
|
|
357
|
+
"title",
|
|
358
|
+
"tooltip",
|
|
359
|
+
"width",
|
|
360
|
+
"fixed",
|
|
361
|
+
"sorter",
|
|
362
|
+
"editable",
|
|
363
|
+
"dataIndex",
|
|
364
|
+
"titleField"
|
|
365
|
+
]);
|
|
366
|
+
const FORM_FIELD_PUBLIC_PROP_KEYS = /* @__PURE__ */ new Set([
|
|
367
|
+
"label",
|
|
368
|
+
"tooltip",
|
|
369
|
+
"extra",
|
|
370
|
+
"showLabel",
|
|
371
|
+
"initialValue",
|
|
372
|
+
"required",
|
|
373
|
+
"rules",
|
|
374
|
+
"disabled",
|
|
375
|
+
"multiple",
|
|
376
|
+
"allowMultiple",
|
|
377
|
+
"maxCount",
|
|
378
|
+
"pattern",
|
|
379
|
+
"titleField",
|
|
380
|
+
"name"
|
|
381
|
+
]);
|
|
382
|
+
const DETAIL_FIELD_PUBLIC_PROP_KEYS = /* @__PURE__ */ new Set([
|
|
383
|
+
"label",
|
|
384
|
+
"tooltip",
|
|
385
|
+
"extra",
|
|
386
|
+
"showLabel",
|
|
387
|
+
"disabled",
|
|
388
|
+
"pattern",
|
|
389
|
+
"titleField"
|
|
390
|
+
]);
|
|
391
|
+
const FILTER_FIELD_PUBLIC_PROP_KEYS = /* @__PURE__ */ new Set([
|
|
392
|
+
"label",
|
|
393
|
+
"tooltip",
|
|
394
|
+
"extra",
|
|
395
|
+
"showLabel",
|
|
396
|
+
"initialValue",
|
|
397
|
+
"multiple",
|
|
398
|
+
"allowMultiple",
|
|
399
|
+
"maxCount",
|
|
400
|
+
"name"
|
|
401
|
+
]);
|
|
402
|
+
const FIELD_PUBLIC_PROP_KEYS_BY_USE = {
|
|
403
|
+
TableColumnModel: TABLE_FIELD_PUBLIC_PROP_KEYS,
|
|
404
|
+
FormItemModel: FORM_FIELD_PUBLIC_PROP_KEYS,
|
|
405
|
+
PatternFormItemModel: FORM_FIELD_PUBLIC_PROP_KEYS,
|
|
406
|
+
DetailsItemModel: DETAIL_FIELD_PUBLIC_PROP_KEYS,
|
|
407
|
+
ApprovalDetailsItemModel: DETAIL_FIELD_PUBLIC_PROP_KEYS,
|
|
408
|
+
ApplyTaskCardDetailsItemModel: DETAIL_FIELD_PUBLIC_PROP_KEYS,
|
|
409
|
+
ApprovalTaskCardDetailsItemModel: DETAIL_FIELD_PUBLIC_PROP_KEYS,
|
|
410
|
+
FormAssociationItemModel: DETAIL_FIELD_PUBLIC_PROP_KEYS,
|
|
411
|
+
FilterFormItemModel: FILTER_FIELD_PUBLIC_PROP_KEYS
|
|
412
|
+
};
|
|
413
|
+
const REACTION_CONTEXT_SCALAR_PATHS = /* @__PURE__ */ new Set(["role", "locale", "token", "deviceType"]);
|
|
414
|
+
const REACTION_CONTEXT_ROOT_PATHS = /* @__PURE__ */ new Set([
|
|
415
|
+
"user",
|
|
416
|
+
"collection",
|
|
417
|
+
"formValues",
|
|
418
|
+
"record",
|
|
419
|
+
"item",
|
|
420
|
+
"popup",
|
|
421
|
+
"urlSearchParams"
|
|
422
|
+
]);
|
|
423
|
+
const FIELD_TYPES_WITH_NESTED_FIELDS = /* @__PURE__ */ new Set([
|
|
424
|
+
"picker",
|
|
425
|
+
"subForm",
|
|
426
|
+
"subFormList",
|
|
427
|
+
"subDetails",
|
|
428
|
+
"subDetailsList",
|
|
429
|
+
"subTable",
|
|
430
|
+
"popupSubTable"
|
|
431
|
+
]);
|
|
432
|
+
const REACTION_KIND_TO_BLUEPRINT_TYPE = {
|
|
433
|
+
fieldValue: "setFieldValueRules",
|
|
434
|
+
blockLinkage: "setBlockLinkageRules",
|
|
435
|
+
fieldLinkage: "setFieldLinkageRules",
|
|
436
|
+
actionLinkage: "setActionLinkageRules"
|
|
437
|
+
};
|
|
438
|
+
function isNode(value) {
|
|
439
|
+
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
440
|
+
}
|
|
441
|
+
function castNodeArray(value) {
|
|
442
|
+
return import_lodash.default.castArray(value || []).filter(isNode);
|
|
443
|
+
}
|
|
444
|
+
function getSubNode(node, key) {
|
|
445
|
+
var _a;
|
|
446
|
+
const value = (_a = node == null ? void 0 : node.subModels) == null ? void 0 : _a[key];
|
|
447
|
+
if (Array.isArray(value)) {
|
|
448
|
+
return value.find(isNode);
|
|
449
|
+
}
|
|
450
|
+
return isNode(value) ? value : void 0;
|
|
451
|
+
}
|
|
452
|
+
function getSubNodeArray(node, key) {
|
|
453
|
+
var _a;
|
|
454
|
+
return castNodeArray((_a = node == null ? void 0 : node.subModels) == null ? void 0 : _a[key]);
|
|
455
|
+
}
|
|
456
|
+
function readString(value) {
|
|
457
|
+
const normalized = typeof value === "string" ? value.trim() : "";
|
|
458
|
+
return normalized || void 0;
|
|
459
|
+
}
|
|
460
|
+
function readStringOrNull(value) {
|
|
461
|
+
if (import_lodash.default.isNull(value)) {
|
|
462
|
+
return null;
|
|
463
|
+
}
|
|
464
|
+
return readString(value);
|
|
465
|
+
}
|
|
466
|
+
function readBoolean(value) {
|
|
467
|
+
return typeof value === "boolean" ? value : void 0;
|
|
468
|
+
}
|
|
469
|
+
function readNumber(value) {
|
|
470
|
+
return typeof value === "number" ? value : void 0;
|
|
471
|
+
}
|
|
472
|
+
function clonePlainObject(value) {
|
|
473
|
+
return import_lodash.default.isPlainObject(value) ? import_lodash.default.cloneDeep(value) : void 0;
|
|
474
|
+
}
|
|
475
|
+
function cloneArray(value) {
|
|
476
|
+
return Array.isArray(value) ? import_lodash.default.cloneDeep(value) : void 0;
|
|
477
|
+
}
|
|
478
|
+
function cloneDefinedValue(value) {
|
|
479
|
+
return import_lodash.default.isUndefined(value) ? void 0 : import_lodash.default.cloneDeep(value);
|
|
480
|
+
}
|
|
481
|
+
function firstDefined(...values) {
|
|
482
|
+
return values.find((value) => !import_lodash.default.isUndefined(value));
|
|
483
|
+
}
|
|
484
|
+
function hasOwnValue(value, key) {
|
|
485
|
+
return !!value && Object.prototype.hasOwnProperty.call(value, key) && !import_lodash.default.isUndefined(value[key]);
|
|
486
|
+
}
|
|
487
|
+
function getOwnValue(value, key) {
|
|
488
|
+
return hasOwnValue(value, key) ? import_lodash.default.cloneDeep(value == null ? void 0 : value[key]) : void 0;
|
|
489
|
+
}
|
|
490
|
+
function hasNonEmptyPlainObject(value) {
|
|
491
|
+
return import_lodash.default.isPlainObject(value) && Object.keys(value).length > 0;
|
|
492
|
+
}
|
|
493
|
+
function exportTemplateSummary(value) {
|
|
494
|
+
if (!import_lodash.default.isPlainObject(value)) {
|
|
495
|
+
return void 0;
|
|
496
|
+
}
|
|
497
|
+
const uid = readString(value.uid);
|
|
498
|
+
const local = readString(value.local);
|
|
499
|
+
if (!uid && !local) {
|
|
500
|
+
return void 0;
|
|
501
|
+
}
|
|
502
|
+
return buildDefinedPayload({
|
|
503
|
+
uid,
|
|
504
|
+
local,
|
|
505
|
+
mode: readString(value.mode)
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
function exportPopupSummary(value) {
|
|
509
|
+
if (!import_lodash.default.isPlainObject(value)) {
|
|
510
|
+
return void 0;
|
|
511
|
+
}
|
|
512
|
+
const template = exportTemplateSummary(value.template);
|
|
513
|
+
return template ? { template } : void 0;
|
|
514
|
+
}
|
|
515
|
+
function hasUnsupportedTemplateSummary(node) {
|
|
516
|
+
const popup = node == null ? void 0 : node.popup;
|
|
517
|
+
const hasUnsupportedBlockTemplate = hasNonEmptyPlainObject(node == null ? void 0 : node.template) && !exportTemplateSummary(node == null ? void 0 : node.template);
|
|
518
|
+
const hasUnsupportedPopupTemplate = readString(popup == null ? void 0 : popup.mode) === "copy" || hasNonEmptyPlainObject(popup == null ? void 0 : popup.template) && !exportPopupSummary(popup);
|
|
519
|
+
return hasUnsupportedBlockTemplate || hasNonEmptyPlainObject(node == null ? void 0 : node.fieldsTemplate) || hasUnsupportedPopupTemplate;
|
|
520
|
+
}
|
|
521
|
+
function templateSummaryManualAction(kind) {
|
|
522
|
+
if (kind === "block") {
|
|
523
|
+
return "Recreate this template-backed block manually or add mapper support.";
|
|
524
|
+
}
|
|
525
|
+
if (kind === "field") {
|
|
526
|
+
return "Recreate this template-backed field popup manually or add mapper support.";
|
|
527
|
+
}
|
|
528
|
+
if (kind === "action" || kind === "recordAction") {
|
|
529
|
+
return "Recreate this template-backed action popup manually or add mapper support.";
|
|
530
|
+
}
|
|
531
|
+
return "Recreate this template-backed surface manually or add mapper support.";
|
|
532
|
+
}
|
|
533
|
+
function isEmptyPlainContainer(value) {
|
|
534
|
+
if (import_lodash.default.isUndefined(value) || value === null) {
|
|
535
|
+
return true;
|
|
536
|
+
}
|
|
537
|
+
if (import_lodash.default.isPlainObject(value)) {
|
|
538
|
+
return Object.values(value).every(isEmptyPlainContainer);
|
|
539
|
+
}
|
|
540
|
+
if (Array.isArray(value)) {
|
|
541
|
+
return value.length === 0;
|
|
542
|
+
}
|
|
543
|
+
return false;
|
|
544
|
+
}
|
|
545
|
+
function collectLeafPaths(value, prefix = "") {
|
|
546
|
+
if (!import_lodash.default.isPlainObject(value)) {
|
|
547
|
+
return isEmptyPlainContainer(value) ? [] : [prefix];
|
|
548
|
+
}
|
|
549
|
+
return Object.entries(value).flatMap(([key, child]) => {
|
|
550
|
+
const childPath = prefix ? `${prefix}.${key}` : key;
|
|
551
|
+
if (isEmptyPlainContainer(child)) {
|
|
552
|
+
return [];
|
|
553
|
+
}
|
|
554
|
+
return collectLeafPaths(child, childPath);
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
function pathMatchesAllowed(candidate, allowedPath) {
|
|
558
|
+
if (allowedPath.endsWith(".*")) {
|
|
559
|
+
const prefix = allowedPath.slice(0, -2);
|
|
560
|
+
return candidate === prefix || candidate.startsWith(`${prefix}.`);
|
|
561
|
+
}
|
|
562
|
+
return candidate === allowedPath;
|
|
563
|
+
}
|
|
564
|
+
function hasUnsupportedLeafPath(value, allowedPaths) {
|
|
565
|
+
return collectLeafPaths(value).some(
|
|
566
|
+
(path) => !allowedPaths.some((allowedPath) => pathMatchesAllowed(path, allowedPath))
|
|
567
|
+
);
|
|
568
|
+
}
|
|
569
|
+
function getPublicStepParamKeys(stepParams) {
|
|
570
|
+
return Object.keys(stepParams).filter((key) => key !== import_key_registry.FLOW_SURFACE_INTERNAL_META_KEY);
|
|
571
|
+
}
|
|
572
|
+
function buildDefinedPayload(input) {
|
|
573
|
+
return import_lodash.default.pickBy(input, (value) => !import_lodash.default.isUndefined(value));
|
|
574
|
+
}
|
|
575
|
+
function getByPath(node, path) {
|
|
576
|
+
return import_lodash.default.get(node, path);
|
|
577
|
+
}
|
|
578
|
+
function recordUnsupported(ctx, item) {
|
|
579
|
+
ctx.unsupported.push(item);
|
|
580
|
+
ctx.warnings.push(`${item.path}: ${item.reasonCode} (${item.use || item.type || item.kind})`);
|
|
581
|
+
}
|
|
582
|
+
function assertNoUnsupported(ctx) {
|
|
583
|
+
if (ctx.unsupportedPolicy !== "error" || !ctx.unsupported.length) {
|
|
584
|
+
return;
|
|
585
|
+
}
|
|
586
|
+
const first = ctx.unsupported[0];
|
|
587
|
+
(0, import_errors.throwBadRequest)(
|
|
588
|
+
`flowSurfaces exportBlueprint cannot export ${first.kind} '${first.use || first.type || "unknown"}' at ${first.path}: ${first.reasonCode}`
|
|
589
|
+
);
|
|
590
|
+
}
|
|
591
|
+
function normalizeKeyCandidate(value, fallback, context) {
|
|
592
|
+
const token = (0, import_private_utils.normalizeApplyBlueprintToken)(value, fallback);
|
|
593
|
+
return (0, import_service_utils.normalizeFlowSurfaceComposeKey)(token, context);
|
|
594
|
+
}
|
|
595
|
+
function stripScopePrefix(key, scopePrefix) {
|
|
596
|
+
const normalized = String(key || "").trim();
|
|
597
|
+
if (!normalized || !scopePrefix) {
|
|
598
|
+
return normalized;
|
|
599
|
+
}
|
|
600
|
+
const prefix = `${scopePrefix}.`;
|
|
601
|
+
if (normalized.startsWith(prefix)) {
|
|
602
|
+
return normalized.slice(prefix.length);
|
|
603
|
+
}
|
|
604
|
+
if (normalized.includes(".")) {
|
|
605
|
+
return normalized.split(".").filter(Boolean).pop() || normalized;
|
|
606
|
+
}
|
|
607
|
+
return normalized;
|
|
608
|
+
}
|
|
609
|
+
function getDeclaredKey(node, scopePrefix) {
|
|
610
|
+
return stripScopePrefix((0, import_key_registry.getDeclaredKeyFromNode)(node), scopePrefix);
|
|
611
|
+
}
|
|
612
|
+
function inferTabDeclaredKeyFromChildren(tab) {
|
|
613
|
+
const visit = (node) => {
|
|
614
|
+
const rawKey = (0, import_key_registry.getDeclaredKeyFromNode)(node);
|
|
615
|
+
if (rawKey == null ? void 0 : rawKey.includes(".")) {
|
|
616
|
+
return rawKey.split(".").filter(Boolean)[0];
|
|
617
|
+
}
|
|
618
|
+
for (const value of Object.values((node == null ? void 0 : node.subModels) || {})) {
|
|
619
|
+
for (const child of castNodeArray(value)) {
|
|
620
|
+
const matched = visit(child);
|
|
621
|
+
if (matched) {
|
|
622
|
+
return matched;
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
return void 0;
|
|
627
|
+
};
|
|
628
|
+
return visit(tab);
|
|
629
|
+
}
|
|
630
|
+
function dedupeKey(ctx, scope, candidate, fallback, path) {
|
|
631
|
+
const normalized = normalizeKeyCandidate(candidate || fallback, fallback, path);
|
|
632
|
+
if (!scope.used.has(normalized)) {
|
|
633
|
+
scope.used.add(normalized);
|
|
634
|
+
return normalized;
|
|
635
|
+
}
|
|
636
|
+
let suffix = 2;
|
|
637
|
+
let next = `${normalized}_${suffix}`;
|
|
638
|
+
while (scope.used.has(next)) {
|
|
639
|
+
suffix += 1;
|
|
640
|
+
next = `${normalized}_${suffix}`;
|
|
641
|
+
}
|
|
642
|
+
scope.used.add(next);
|
|
643
|
+
ctx.warnings.push(`${path}: key '${normalized}' collided; exported as '${next}'`);
|
|
644
|
+
return next;
|
|
645
|
+
}
|
|
646
|
+
function readPageTitle(page) {
|
|
647
|
+
var _a;
|
|
648
|
+
return readString(getByPath(page, ["stepParams", "pageSettings", "general", "title"])) || readString((_a = page.props) == null ? void 0 : _a.title);
|
|
649
|
+
}
|
|
650
|
+
function exportPage(ctx, page, pageRoute) {
|
|
651
|
+
var _a, _b, _c, _d;
|
|
652
|
+
if (hasNonEmptyPlainObject(page.flowRegistry)) {
|
|
653
|
+
recordUnsupported(ctx, {
|
|
654
|
+
kind: "page",
|
|
655
|
+
use: readString(page.use),
|
|
656
|
+
path: "$.page.flowRegistry",
|
|
657
|
+
reasonCode: FLOW_REGISTRY_UNSUPPORTED_REASON,
|
|
658
|
+
manualAction: "Recreate these event flows manually or add mapper support."
|
|
659
|
+
});
|
|
660
|
+
}
|
|
661
|
+
const general = getByPath(page, ["stepParams", "pageSettings", "general"]) || {};
|
|
662
|
+
return buildDefinedPayload({
|
|
663
|
+
title: readPageTitle(page),
|
|
664
|
+
icon: readString(general.icon) || readString((_a = page.props) == null ? void 0 : _a.icon),
|
|
665
|
+
documentTitle: readString(general.documentTitle),
|
|
666
|
+
enableHeader: typeof general.enableHeader === "boolean" ? general.enableHeader : typeof ((_b = page.props) == null ? void 0 : _b.enableHeader) === "boolean" ? page.props.enableHeader : void 0,
|
|
667
|
+
enableTabs: typeof general.enableTabs === "boolean" ? general.enableTabs : typeof ((_c = page.props) == null ? void 0 : _c.enableTabs) === "boolean" ? page.props.enableTabs : void 0,
|
|
668
|
+
displayTitle: typeof general.displayTitle === "boolean" ? general.displayTitle : typeof ((_d = page.props) == null ? void 0 : _d.displayTitle) === "boolean" ? page.props.displayTitle : void 0
|
|
669
|
+
});
|
|
670
|
+
}
|
|
671
|
+
function readTabTitle(tab) {
|
|
672
|
+
var _a;
|
|
673
|
+
return readString(getByPath(tab, ["stepParams", "pageTabSettings", "tab", "title"])) || readString((_a = tab.props) == null ? void 0 : _a.title);
|
|
674
|
+
}
|
|
675
|
+
function exportTabChrome(tab) {
|
|
676
|
+
var _a;
|
|
677
|
+
const tabSettings = getByPath(tab, ["stepParams", "pageTabSettings", "tab"]) || {};
|
|
678
|
+
return buildDefinedPayload({
|
|
679
|
+
title: readTabTitle(tab),
|
|
680
|
+
icon: readString(tabSettings.icon) || readString((_a = tab.props) == null ? void 0 : _a.icon),
|
|
681
|
+
documentTitle: readString(tabSettings.documentTitle)
|
|
682
|
+
});
|
|
683
|
+
}
|
|
684
|
+
function readResourceInit(block) {
|
|
685
|
+
return clonePlainObject(getByPath(block, ["stepParams", "resourceSettings", "init"])) || clonePlainObject(getByPath(block, ["stepParams", "TriggerChildPageSettings", "init"])) || clonePlainObject(getByPath(block, ["stepParams", "ApprovalChildPageSettings", "init"]));
|
|
686
|
+
}
|
|
687
|
+
function readBlockResourceContext(block) {
|
|
688
|
+
const resourceInit = readResourceInit(block);
|
|
689
|
+
const collectionName = readString(resourceInit == null ? void 0 : resourceInit.collectionName);
|
|
690
|
+
const dataSourceKey = readString(resourceInit == null ? void 0 : resourceInit.dataSourceKey) || (collectionName ? "main" : void 0);
|
|
691
|
+
const associationName = readString(resourceInit == null ? void 0 : resourceInit.associationName);
|
|
692
|
+
return buildDefinedPayload({
|
|
693
|
+
dataSourceKey,
|
|
694
|
+
collectionName,
|
|
695
|
+
associationName
|
|
696
|
+
});
|
|
697
|
+
}
|
|
698
|
+
function exportBlockResource(block) {
|
|
699
|
+
const resourceInit = readResourceInit(block);
|
|
700
|
+
if (!resourceInit) {
|
|
701
|
+
return {};
|
|
702
|
+
}
|
|
703
|
+
const dataSourceKey = readString(resourceInit.dataSourceKey);
|
|
704
|
+
const collectionName = readString(resourceInit.collectionName);
|
|
705
|
+
const associationName = readString(resourceInit.associationName);
|
|
706
|
+
const associationPathName = readString(resourceInit.associationPathName);
|
|
707
|
+
const sourceId = resourceInit.sourceId;
|
|
708
|
+
const filterByTk = resourceInit.filterByTk;
|
|
709
|
+
if (collectionName && (!dataSourceKey || dataSourceKey === "main") && !associationName && !associationPathName && import_lodash.default.isUndefined(sourceId) && import_lodash.default.isUndefined(filterByTk)) {
|
|
710
|
+
return {
|
|
711
|
+
collection: collectionName
|
|
712
|
+
};
|
|
713
|
+
}
|
|
714
|
+
return {
|
|
715
|
+
resource: buildDefinedPayload({
|
|
716
|
+
dataSourceKey: dataSourceKey || (collectionName ? "main" : void 0),
|
|
717
|
+
collectionName,
|
|
718
|
+
associationName,
|
|
719
|
+
associationPathName,
|
|
720
|
+
sourceId,
|
|
721
|
+
filterByTk
|
|
722
|
+
})
|
|
723
|
+
};
|
|
724
|
+
}
|
|
725
|
+
function exportDataBlockSettings(block, type) {
|
|
726
|
+
if (type === "recordHistory") {
|
|
727
|
+
return {};
|
|
728
|
+
}
|
|
729
|
+
const groupKey = DATA_BLOCK_SETTING_GROUP_BY_TYPE[type];
|
|
730
|
+
if (!groupKey) {
|
|
731
|
+
return {};
|
|
732
|
+
}
|
|
733
|
+
const group = getByPath(block, ["stepParams", groupKey]) || {};
|
|
734
|
+
const defaultFilter = clonePlainObject(import_lodash.default.get(group, ["dataScope", "filter"]));
|
|
735
|
+
const sorting = import_lodash.default.cloneDeep(import_lodash.default.get(group, ["defaultSorting", "sort"]));
|
|
736
|
+
const pageSize = import_lodash.default.get(group, ["pageSize", "pageSize"]);
|
|
737
|
+
const settings = buildDefinedPayload({
|
|
738
|
+
sorting: import_lodash.default.isUndefined(sorting) ? void 0 : sorting,
|
|
739
|
+
pageSize: typeof pageSize === "number" ? pageSize : void 0
|
|
740
|
+
});
|
|
741
|
+
return buildDefinedPayload({
|
|
742
|
+
defaultFilter,
|
|
743
|
+
sorting: import_lodash.default.isUndefined(sorting) ? void 0 : sorting,
|
|
744
|
+
pageSize: typeof pageSize === "number" ? pageSize : void 0,
|
|
745
|
+
settings: Object.keys(settings).length ? settings : void 0
|
|
746
|
+
});
|
|
747
|
+
}
|
|
748
|
+
function exportListBlockSettings(block) {
|
|
749
|
+
if (import_catalog.BLOCK_KEY_BY_USE.get(String(block.use || "")) !== "list") {
|
|
750
|
+
return {};
|
|
751
|
+
}
|
|
752
|
+
const listSettings = getByPath(block, ["stepParams", "listSettings"]) || {};
|
|
753
|
+
const settings = buildDefinedPayload({
|
|
754
|
+
pageSize: readNumber(import_lodash.default.get(listSettings, ["pageSize", "pageSize"])),
|
|
755
|
+
sorting: cloneDefinedValue(import_lodash.default.get(listSettings, ["defaultSorting", "sort"])),
|
|
756
|
+
layout: readString(import_lodash.default.get(listSettings, ["layout", "layout"]))
|
|
757
|
+
});
|
|
758
|
+
return Object.keys(settings).length ? { settings } : {};
|
|
759
|
+
}
|
|
760
|
+
function exportGridCardBlockSettings(block) {
|
|
761
|
+
if (import_catalog.BLOCK_KEY_BY_USE.get(String(block.use || "")) !== "gridCard") {
|
|
762
|
+
return {};
|
|
763
|
+
}
|
|
764
|
+
const gridCardSettings = getByPath(block, ["stepParams", "GridCardSettings"]) || {};
|
|
765
|
+
const settings = buildDefinedPayload({
|
|
766
|
+
columns: clonePlainObject(import_lodash.default.get(gridCardSettings, ["columnCount", "columnCount"])),
|
|
767
|
+
rowCount: readNumber(import_lodash.default.get(gridCardSettings, ["rowCount", "rowCount"])),
|
|
768
|
+
sorting: cloneDefinedValue(import_lodash.default.get(gridCardSettings, ["defaultSorting", "sort"])),
|
|
769
|
+
layout: readString(import_lodash.default.get(gridCardSettings, ["layout", "layout"]))
|
|
770
|
+
});
|
|
771
|
+
return Object.keys(settings).length ? { settings } : {};
|
|
772
|
+
}
|
|
773
|
+
function exportTreeBlockSettings(block) {
|
|
774
|
+
if (import_catalog.BLOCK_KEY_BY_USE.get(String(block.use || "")) !== "tree") {
|
|
775
|
+
return {};
|
|
776
|
+
}
|
|
777
|
+
const props = block.props || {};
|
|
778
|
+
const treeSettings = getByPath(block, ["stepParams", "treeSettings"]) || {};
|
|
779
|
+
const settings = buildDefinedPayload({
|
|
780
|
+
searchable: typeof props.searchable === "boolean" ? props.searchable : typeof import_lodash.default.get(treeSettings, ["searchable", "searchable"]) === "boolean" ? import_lodash.default.get(treeSettings, ["searchable", "searchable"]) : void 0,
|
|
781
|
+
defaultExpandAll: typeof props.defaultExpandAll === "boolean" ? props.defaultExpandAll : typeof import_lodash.default.get(treeSettings, ["defaultExpandAll", "defaultExpandAll"]) === "boolean" ? import_lodash.default.get(treeSettings, ["defaultExpandAll", "defaultExpandAll"]) : void 0,
|
|
782
|
+
includeDescendants: typeof props.includeDescendants === "boolean" ? props.includeDescendants : typeof import_lodash.default.get(treeSettings, ["includeDescendants", "includeDescendants"]) === "boolean" ? import_lodash.default.get(treeSettings, ["includeDescendants", "includeDescendants"]) : void 0,
|
|
783
|
+
fieldNames: clonePlainObject(props.fieldNames),
|
|
784
|
+
titleField: readString(import_lodash.default.get(treeSettings, ["titleField", "titleField"])),
|
|
785
|
+
pageSize: typeof props.pageSize === "number" ? props.pageSize : typeof import_lodash.default.get(treeSettings, ["pageSize", "pageSize"]) === "number" ? import_lodash.default.get(treeSettings, ["pageSize", "pageSize"]) : void 0
|
|
786
|
+
});
|
|
787
|
+
return Object.keys(settings).length ? {
|
|
788
|
+
settings
|
|
789
|
+
} : {};
|
|
790
|
+
}
|
|
791
|
+
function readBooleanSetting(propValue, settingValue) {
|
|
792
|
+
if (typeof propValue === "boolean") {
|
|
793
|
+
return propValue;
|
|
794
|
+
}
|
|
795
|
+
return typeof settingValue === "boolean" ? settingValue : void 0;
|
|
796
|
+
}
|
|
797
|
+
function readNumberSetting(propValue, settingValue) {
|
|
798
|
+
if (typeof propValue === "number") {
|
|
799
|
+
return propValue;
|
|
800
|
+
}
|
|
801
|
+
return typeof settingValue === "number" ? settingValue : void 0;
|
|
802
|
+
}
|
|
803
|
+
function readKanbanPopupSetting(block, key) {
|
|
804
|
+
if (key === "quickCreatePopup") {
|
|
805
|
+
const stepValue2 = getByPath(block, ["stepParams", "kanbanSettings", "popup"]);
|
|
806
|
+
if (import_lodash.default.isPlainObject(stepValue2)) {
|
|
807
|
+
return stepValue2;
|
|
808
|
+
}
|
|
809
|
+
const props2 = block.props || {};
|
|
810
|
+
const propValue2 = import_lodash.default.isPlainObject(props2.quickCreatePopupSettings) ? props2.quickCreatePopupSettings : buildDefinedPayload({
|
|
811
|
+
mode: props2.popupMode,
|
|
812
|
+
size: props2.popupSize,
|
|
813
|
+
popupTemplateUid: props2.popupTemplateUid,
|
|
814
|
+
pageModelClass: props2.popupPageModelClass,
|
|
815
|
+
uid: props2.popupTargetUid
|
|
816
|
+
});
|
|
817
|
+
return import_lodash.default.isPlainObject(propValue2) ? propValue2 : void 0;
|
|
818
|
+
}
|
|
819
|
+
const item = getSubNode(block, "item");
|
|
820
|
+
const stepValue = getByPath(item, ["stepParams", "cardSettings", "popup"]);
|
|
821
|
+
if (import_lodash.default.isPlainObject(stepValue)) {
|
|
822
|
+
return stepValue;
|
|
823
|
+
}
|
|
824
|
+
const props = (item == null ? void 0 : item.props) || {};
|
|
825
|
+
const propValue = import_lodash.default.isPlainObject(props.cardPopupSettings) ? props.cardPopupSettings : buildDefinedPayload({
|
|
826
|
+
mode: props.openMode,
|
|
827
|
+
size: props.popupSize,
|
|
828
|
+
popupTemplateUid: props.popupTemplateUid,
|
|
829
|
+
pageModelClass: props.pageModelClass,
|
|
830
|
+
uid: props.popupTargetUid
|
|
831
|
+
});
|
|
832
|
+
return import_lodash.default.isPlainObject(propValue) ? propValue : void 0;
|
|
833
|
+
}
|
|
834
|
+
function exportKanbanPopupSetting(block, key) {
|
|
835
|
+
const value = readKanbanPopupSetting(block, key);
|
|
836
|
+
if (!value) {
|
|
837
|
+
return void 0;
|
|
838
|
+
}
|
|
839
|
+
const exported = buildDefinedPayload({
|
|
840
|
+
mode: readString(value.mode),
|
|
841
|
+
size: readString(value.size),
|
|
842
|
+
title: readString(value.title),
|
|
843
|
+
tryTemplate: readBoolean(value.tryTemplate),
|
|
844
|
+
defaultType: readString(value.defaultType)
|
|
845
|
+
});
|
|
846
|
+
return Object.keys(exported).length ? exported : void 0;
|
|
847
|
+
}
|
|
848
|
+
function exportKanbanBlockSettings(block) {
|
|
849
|
+
if (import_catalog.BLOCK_KEY_BY_USE.get(String(block.use || "")) !== "kanban") {
|
|
850
|
+
return {};
|
|
851
|
+
}
|
|
852
|
+
const props = block.props || {};
|
|
853
|
+
const kanbanSettings = getByPath(block, ["stepParams", "kanbanSettings"]) || {};
|
|
854
|
+
const item = getSubNode(block, "item");
|
|
855
|
+
const itemProps = (item == null ? void 0 : item.props) || {};
|
|
856
|
+
const itemCardSettings = getByPath(item, ["stepParams", "cardSettings"]) || {};
|
|
857
|
+
const styleVariant = readString(import_lodash.default.get(kanbanSettings, ["styleVariant", "styleVariant"]));
|
|
858
|
+
const settings = buildDefinedPayload({
|
|
859
|
+
groupField: readString(import_lodash.default.get(kanbanSettings, ["grouping", "groupField"])) || readString(props.groupField),
|
|
860
|
+
groupTitleField: import_lodash.default.has(kanbanSettings, ["grouping", "groupTitleField"]) ? readStringOrNull(import_lodash.default.get(kanbanSettings, ["grouping", "groupTitleField"])) : readStringOrNull(props.groupTitleField),
|
|
861
|
+
groupColorField: import_lodash.default.has(kanbanSettings, ["grouping", "groupColorField"]) ? readStringOrNull(import_lodash.default.get(kanbanSettings, ["grouping", "groupColorField"])) : readStringOrNull(props.groupColorField),
|
|
862
|
+
groupOptions: firstDefined(
|
|
863
|
+
cloneArray(import_lodash.default.get(kanbanSettings, ["grouping", "groupOptions"])),
|
|
864
|
+
cloneArray(props.groupOptions)
|
|
865
|
+
),
|
|
866
|
+
styleVariant: styleVariant || (readString(props.styleVariant) === "color" ? "filled" : readString(props.styleVariant) === "default" ? "default" : void 0),
|
|
867
|
+
sorting: firstDefined(
|
|
868
|
+
cloneDefinedValue(import_lodash.default.get(kanbanSettings, ["defaultSorting", "sort"])),
|
|
869
|
+
cloneDefinedValue(props.globalSort)
|
|
870
|
+
),
|
|
871
|
+
dragEnabled: readBooleanSetting(props.dragEnabled, import_lodash.default.get(kanbanSettings, ["dragEnabled", "dragEnabled"])),
|
|
872
|
+
dragSortBy: firstDefined(
|
|
873
|
+
readStringOrNull(import_lodash.default.get(kanbanSettings, ["dragSortBy", "dragSortBy"])),
|
|
874
|
+
readStringOrNull(props.dragSortBy)
|
|
875
|
+
),
|
|
876
|
+
quickCreateEnabled: readBooleanSetting(
|
|
877
|
+
props.quickCreateEnabled,
|
|
878
|
+
import_lodash.default.get(kanbanSettings, ["quickCreate", "quickCreateEnabled"])
|
|
879
|
+
),
|
|
880
|
+
quickCreatePopup: exportKanbanPopupSetting(block, "quickCreatePopup"),
|
|
881
|
+
enableCardClick: readBooleanSetting(
|
|
882
|
+
itemProps.enableCardClick,
|
|
883
|
+
import_lodash.default.get(itemCardSettings, ["click", "enableCardClick"])
|
|
884
|
+
),
|
|
885
|
+
cardPopup: exportKanbanPopupSetting(block, "cardPopup"),
|
|
886
|
+
cardLayout: readString(itemProps.layout) || readString(import_lodash.default.get(itemCardSettings, ["layout", "layout"])),
|
|
887
|
+
cardLabelAlign: readString(itemProps.labelAlign) || readString(import_lodash.default.get(itemCardSettings, ["layout", "labelAlign"])),
|
|
888
|
+
cardLabelWidth: firstDefined(
|
|
889
|
+
readStringOrNull(itemProps.labelWidth),
|
|
890
|
+
readStringOrNull(import_lodash.default.get(itemCardSettings, ["layout", "labelWidth"]))
|
|
891
|
+
),
|
|
892
|
+
cardLabelWrap: readBooleanSetting(itemProps.labelWrap, import_lodash.default.get(itemCardSettings, ["layout", "labelWrap"])),
|
|
893
|
+
cardColon: readBooleanSetting(itemProps.colon, import_lodash.default.get(itemCardSettings, ["layout", "colon"])),
|
|
894
|
+
pageSize: readNumberSetting(props.pageSize, import_lodash.default.get(kanbanSettings, ["pageSize", "pageSize"])),
|
|
895
|
+
columnWidth: readNumberSetting(props.columnWidth, import_lodash.default.get(kanbanSettings, ["columnWidth", "columnWidth"]))
|
|
896
|
+
});
|
|
897
|
+
return Object.keys(settings).length ? { settings } : {};
|
|
898
|
+
}
|
|
899
|
+
function readCalendarPopupSetting(block, key) {
|
|
900
|
+
var _a;
|
|
901
|
+
const stepValue = getByPath(block, ["stepParams", "calendarSettings", key]);
|
|
902
|
+
if (import_lodash.default.isPlainObject(stepValue)) {
|
|
903
|
+
return stepValue;
|
|
904
|
+
}
|
|
905
|
+
const propValue = (_a = block.props) == null ? void 0 : _a[key];
|
|
906
|
+
return import_lodash.default.isPlainObject(propValue) ? propValue : void 0;
|
|
907
|
+
}
|
|
908
|
+
function exportCalendarPopupSetting(block, key) {
|
|
909
|
+
const value = readCalendarPopupSetting(block, key);
|
|
910
|
+
if (!value) {
|
|
911
|
+
return void 0;
|
|
912
|
+
}
|
|
913
|
+
const exported = buildDefinedPayload({
|
|
914
|
+
mode: readString(value.mode),
|
|
915
|
+
size: readString(value.size),
|
|
916
|
+
title: readString(value.title),
|
|
917
|
+
tryTemplate: typeof value.tryTemplate === "boolean" ? value.tryTemplate : void 0,
|
|
918
|
+
defaultType: readString(value.defaultType)
|
|
919
|
+
});
|
|
920
|
+
return Object.keys(exported).length ? exported : void 0;
|
|
921
|
+
}
|
|
922
|
+
function hasUnsupportedCalendarPopupSetting(block, key) {
|
|
923
|
+
const value = readCalendarPopupSetting(block, key);
|
|
924
|
+
if (!value) {
|
|
925
|
+
return false;
|
|
926
|
+
}
|
|
927
|
+
return Object.keys(value).some((itemKey) => {
|
|
928
|
+
const child = value[itemKey];
|
|
929
|
+
if (import_lodash.default.isUndefined(child)) {
|
|
930
|
+
return false;
|
|
931
|
+
}
|
|
932
|
+
return !EXPORTED_CALENDAR_POPUP_KEYS.has(itemKey) && !IGNORED_CALENDAR_POPUP_RUNTIME_KEYS.has(itemKey);
|
|
933
|
+
});
|
|
934
|
+
}
|
|
935
|
+
function exportCalendarBlockSettings(block) {
|
|
936
|
+
if (import_catalog.BLOCK_KEY_BY_USE.get(String(block.use || "")) !== "calendar") {
|
|
937
|
+
return {};
|
|
938
|
+
}
|
|
939
|
+
const props = block.props || {};
|
|
940
|
+
const fieldNames = import_lodash.default.isPlainObject(props.fieldNames) ? props.fieldNames : {};
|
|
941
|
+
const calendarSettings = getByPath(block, ["stepParams", "calendarSettings"]) || {};
|
|
942
|
+
const settings = buildDefinedPayload({
|
|
943
|
+
titleField: readString(fieldNames.title) || readString(import_lodash.default.get(calendarSettings, ["titleField", "titleField"])),
|
|
944
|
+
colorField: readString(fieldNames.colorFieldName) || readString(import_lodash.default.get(calendarSettings, ["colorField", "colorFieldName"])),
|
|
945
|
+
startField: readString(fieldNames.start) || readString(import_lodash.default.get(calendarSettings, ["startDateField", "start"])),
|
|
946
|
+
endField: readString(fieldNames.end) || readString(import_lodash.default.get(calendarSettings, ["endDateField", "end"])),
|
|
947
|
+
defaultView: readString(props.defaultView) || readString(import_lodash.default.get(calendarSettings, ["defaultView", "defaultView"])),
|
|
948
|
+
quickCreateEvent: readBooleanSetting(
|
|
949
|
+
props.enableQuickCreateEvent,
|
|
950
|
+
import_lodash.default.get(calendarSettings, ["quickCreateEvent", "enableQuickCreateEvent"])
|
|
951
|
+
),
|
|
952
|
+
showLunar: readBooleanSetting(props.showLunar, import_lodash.default.get(calendarSettings, ["showLunar", "showLunar"])),
|
|
953
|
+
weekStart: readNumberSetting(props.weekStart, import_lodash.default.get(calendarSettings, ["weekStart", "weekStart"])),
|
|
954
|
+
quickCreatePopup: exportCalendarPopupSetting(block, "quickCreatePopupSettings"),
|
|
955
|
+
eventPopup: exportCalendarPopupSetting(block, "eventPopupSettings")
|
|
956
|
+
});
|
|
957
|
+
return Object.keys(settings).length ? {
|
|
958
|
+
settings
|
|
959
|
+
} : {};
|
|
960
|
+
}
|
|
961
|
+
function exportActionPanelBlockSettings(block) {
|
|
962
|
+
if (import_catalog.BLOCK_KEY_BY_USE.get(String(block.use || "")) !== "actionPanel") {
|
|
963
|
+
return {};
|
|
964
|
+
}
|
|
965
|
+
const props = block.props || {};
|
|
966
|
+
const group = getByPath(block, ["stepParams", "actionPanelBlockSetting"]) || {};
|
|
967
|
+
const settings = buildDefinedPayload({
|
|
968
|
+
layout: readString(props.layout) || readString(import_lodash.default.get(group, ["layout", "layout"])),
|
|
969
|
+
ellipsis: readBooleanSetting(props.ellipsis, import_lodash.default.get(group, ["ellipsis", "ellipsis"]))
|
|
970
|
+
});
|
|
971
|
+
return Object.keys(settings).length ? { settings } : {};
|
|
972
|
+
}
|
|
973
|
+
function exportRecordHistoryBlockSettings(block) {
|
|
974
|
+
if (import_catalog.BLOCK_KEY_BY_USE.get(String(block.use || "")) !== "recordHistory") {
|
|
975
|
+
return {};
|
|
976
|
+
}
|
|
977
|
+
const group = getByPath(block, ["stepParams", "recordHistorySettings"]) || {};
|
|
978
|
+
const settings = buildDefinedPayload({
|
|
979
|
+
sortOrder: clonePlainObject(import_lodash.default.get(group, ["sortOrder"])),
|
|
980
|
+
dataScope: clonePlainObject(import_lodash.default.get(group, ["dataScope", "filter"])),
|
|
981
|
+
expand: clonePlainObject(import_lodash.default.get(group, ["expand"])),
|
|
982
|
+
template: clonePlainObject(import_lodash.default.get(group, ["template"]))
|
|
983
|
+
});
|
|
984
|
+
return Object.keys(settings).length ? { settings } : {};
|
|
985
|
+
}
|
|
986
|
+
function createChartAssetKey(ctx, publicKey) {
|
|
987
|
+
const base = (0, import_private_utils.normalizeApplyBlueprintToken)(publicKey, "chart");
|
|
988
|
+
let candidate = base;
|
|
989
|
+
let index = 2;
|
|
990
|
+
while (Object.prototype.hasOwnProperty.call(ctx.chartAssets, candidate)) {
|
|
991
|
+
candidate = `${base}_${index}`;
|
|
992
|
+
index += 1;
|
|
993
|
+
}
|
|
994
|
+
return candidate;
|
|
995
|
+
}
|
|
996
|
+
function exportChartBlockSettings(ctx, block, publicKey, path) {
|
|
997
|
+
if (import_catalog.BLOCK_KEY_BY_USE.get(String(block.use || "")) !== "chart") {
|
|
998
|
+
return {};
|
|
999
|
+
}
|
|
1000
|
+
const configure = clonePlainObject(getByPath(block, ["stepParams", "chartSettings", "configure"]));
|
|
1001
|
+
const semanticState = (0, import_chart_config.deriveChartSemanticState)(configure);
|
|
1002
|
+
if (!semanticState.query || !semanticState.visual) {
|
|
1003
|
+
recordUnsupported(ctx, {
|
|
1004
|
+
kind: "block",
|
|
1005
|
+
use: readString(block.use),
|
|
1006
|
+
type: "chart",
|
|
1007
|
+
path: `${path}.settings`,
|
|
1008
|
+
reasonCode: "unsupported-chart-configure",
|
|
1009
|
+
manualAction: "Recreate this chart configuration manually or add mapper support."
|
|
1010
|
+
});
|
|
1011
|
+
return null;
|
|
1012
|
+
}
|
|
1013
|
+
const assetKey = createChartAssetKey(ctx, publicKey);
|
|
1014
|
+
ctx.chartAssets[assetKey] = buildDefinedPayload({
|
|
1015
|
+
query: semanticState.query,
|
|
1016
|
+
visual: semanticState.visual,
|
|
1017
|
+
events: semanticState.events
|
|
1018
|
+
});
|
|
1019
|
+
return {
|
|
1020
|
+
chart: assetKey
|
|
1021
|
+
};
|
|
1022
|
+
}
|
|
1023
|
+
function exportCardSettings(block) {
|
|
1024
|
+
const cardSettings = getByPath(block, ["stepParams", "cardSettings"]) || {};
|
|
1025
|
+
const titleDescription = import_lodash.default.get(cardSettings, ["titleDescription"]);
|
|
1026
|
+
const blockHeight = import_lodash.default.get(cardSettings, ["blockHeight"]);
|
|
1027
|
+
return buildDefinedPayload({
|
|
1028
|
+
title: readString(titleDescription == null ? void 0 : titleDescription.title),
|
|
1029
|
+
description: readString(titleDescription == null ? void 0 : titleDescription.description),
|
|
1030
|
+
height: typeof (blockHeight == null ? void 0 : blockHeight.height) === "number" ? blockHeight.height : void 0,
|
|
1031
|
+
heightMode: readString(blockHeight == null ? void 0 : blockHeight.heightMode)
|
|
1032
|
+
});
|
|
1033
|
+
}
|
|
1034
|
+
function exportSimpleBlockSettings(block, type) {
|
|
1035
|
+
var _a, _b, _c, _d;
|
|
1036
|
+
if (type === "markdown") {
|
|
1037
|
+
const content = readString(getByPath(block, ["stepParams", "markdownBlockSettings", "editMarkdown", "content"])) || readString((_a = block.props) == null ? void 0 : _a.content) || readString((_b = block.props) == null ? void 0 : _b.value);
|
|
1038
|
+
return content ? { settings: { content } } : {};
|
|
1039
|
+
}
|
|
1040
|
+
if (type === "jsBlock") {
|
|
1041
|
+
const runJs = clonePlainObject(getByPath(block, ["stepParams", "jsSettings", "runJs"]));
|
|
1042
|
+
return buildDefinedPayload({
|
|
1043
|
+
title: readString((_c = block.decoratorProps) == null ? void 0 : _c.title),
|
|
1044
|
+
description: readString((_d = block.decoratorProps) == null ? void 0 : _d.description),
|
|
1045
|
+
settings: runJs
|
|
1046
|
+
});
|
|
1047
|
+
}
|
|
1048
|
+
if (type === "iframe") {
|
|
1049
|
+
const editIframe = clonePlainObject(getByPath(block, ["stepParams", "iframeBlockSettings", "editIframe"]));
|
|
1050
|
+
return editIframe ? { settings: editIframe } : {};
|
|
1051
|
+
}
|
|
1052
|
+
return {};
|
|
1053
|
+
}
|
|
1054
|
+
function getAllowedBlockStepParamPaths(type, groupKey) {
|
|
1055
|
+
if (groupKey === "eventSettings") {
|
|
1056
|
+
return ["linkageRules.value"];
|
|
1057
|
+
}
|
|
1058
|
+
const simpleBlockSettings = EXPORTED_SIMPLE_BLOCK_SETTING_PATHS_BY_TYPE[type];
|
|
1059
|
+
if (type === "markdown" && groupKey === "markdownBlockSettings" || type === "jsBlock" && groupKey === "jsSettings" || type === "iframe" && groupKey === "iframeBlockSettings") {
|
|
1060
|
+
return simpleBlockSettings || [];
|
|
1061
|
+
}
|
|
1062
|
+
return EXPORTED_BLOCK_STEP_PARAM_PATHS_BY_GROUP[groupKey];
|
|
1063
|
+
}
|
|
1064
|
+
function hasUnsupportedBlockProps(block, type) {
|
|
1065
|
+
const props = block.props || {};
|
|
1066
|
+
const propKeys = Object.keys(props).filter((key) => !import_lodash.default.isUndefined(props[key]));
|
|
1067
|
+
if (!propKeys.length) {
|
|
1068
|
+
return false;
|
|
1069
|
+
}
|
|
1070
|
+
if (type === "markdown") {
|
|
1071
|
+
return propKeys.some((key) => key !== "content" && key !== "value");
|
|
1072
|
+
}
|
|
1073
|
+
if (type === "tree") {
|
|
1074
|
+
return propKeys.some((key) => !EXPORTED_TREE_BLOCK_PROP_KEYS.has(key));
|
|
1075
|
+
}
|
|
1076
|
+
if (type === "calendar") {
|
|
1077
|
+
return propKeys.some((key) => !EXPORTED_CALENDAR_BLOCK_PROP_KEYS.has(key));
|
|
1078
|
+
}
|
|
1079
|
+
if (type === "kanban") {
|
|
1080
|
+
return propKeys.some((key) => !EXPORTED_KANBAN_BLOCK_PROP_KEYS.has(key));
|
|
1081
|
+
}
|
|
1082
|
+
if (type === "actionPanel") {
|
|
1083
|
+
return propKeys.some((key) => !EXPORTED_ACTION_PANEL_BLOCK_PROP_KEYS.has(key));
|
|
1084
|
+
}
|
|
1085
|
+
if (type === "jsBlock") {
|
|
1086
|
+
return false;
|
|
1087
|
+
}
|
|
1088
|
+
return true;
|
|
1089
|
+
}
|
|
1090
|
+
function hasUnsupportedKanbanPopupSetting(block, key) {
|
|
1091
|
+
const value = readKanbanPopupSetting(block, key);
|
|
1092
|
+
if (!value) {
|
|
1093
|
+
return false;
|
|
1094
|
+
}
|
|
1095
|
+
return Object.keys(value).some((itemKey) => {
|
|
1096
|
+
const child = value[itemKey];
|
|
1097
|
+
if (import_lodash.default.isUndefined(child)) {
|
|
1098
|
+
return false;
|
|
1099
|
+
}
|
|
1100
|
+
return !EXPORTED_KANBAN_POPUP_KEYS.has(itemKey) && !IGNORED_KANBAN_POPUP_RUNTIME_KEYS.has(itemKey);
|
|
1101
|
+
});
|
|
1102
|
+
}
|
|
1103
|
+
function hasUnsupportedKanbanItemPublicState(block) {
|
|
1104
|
+
const item = getSubNode(block, "item");
|
|
1105
|
+
if (!item) {
|
|
1106
|
+
return false;
|
|
1107
|
+
}
|
|
1108
|
+
if (hasNonEmptyPlainObject(item.flowRegistry)) {
|
|
1109
|
+
return true;
|
|
1110
|
+
}
|
|
1111
|
+
const props = item.props || {};
|
|
1112
|
+
const propKeys = Object.keys(props).filter((key) => !import_lodash.default.isUndefined(props[key]));
|
|
1113
|
+
if (propKeys.some((key) => !EXPORTED_KANBAN_CARD_ITEM_PROP_KEYS.has(key))) {
|
|
1114
|
+
return true;
|
|
1115
|
+
}
|
|
1116
|
+
return Object.entries(item.stepParams || {}).some(([groupKey, groupValue]) => {
|
|
1117
|
+
if (groupKey === import_key_registry.FLOW_SURFACE_INTERNAL_META_KEY || isEmptyPlainContainer(groupValue)) {
|
|
1118
|
+
return false;
|
|
1119
|
+
}
|
|
1120
|
+
if (groupKey !== "cardSettings") {
|
|
1121
|
+
return true;
|
|
1122
|
+
}
|
|
1123
|
+
return hasUnsupportedLeafPath(groupValue, EXPORTED_KANBAN_CARD_ITEM_SETTING_PATHS);
|
|
1124
|
+
});
|
|
1125
|
+
}
|
|
1126
|
+
function hasUnsupportedJsBlockDecoratorProps(block) {
|
|
1127
|
+
const decoratorProps = block.decoratorProps || {};
|
|
1128
|
+
return Object.keys(decoratorProps).some((key) => {
|
|
1129
|
+
const value = decoratorProps[key];
|
|
1130
|
+
if (import_lodash.default.isUndefined(value)) {
|
|
1131
|
+
return false;
|
|
1132
|
+
}
|
|
1133
|
+
if (EXPORTED_JS_BLOCK_DECORATOR_PROP_KEYS.has(key)) {
|
|
1134
|
+
return false;
|
|
1135
|
+
}
|
|
1136
|
+
if (key === "className") {
|
|
1137
|
+
return !!readString(value);
|
|
1138
|
+
}
|
|
1139
|
+
return true;
|
|
1140
|
+
});
|
|
1141
|
+
}
|
|
1142
|
+
function hasUnsupportedBlockPublicState(block, type) {
|
|
1143
|
+
if (hasNonEmptyPlainObject(block.flowRegistry)) {
|
|
1144
|
+
return true;
|
|
1145
|
+
}
|
|
1146
|
+
if (hasUnsupportedBlockProps(block, type)) {
|
|
1147
|
+
return true;
|
|
1148
|
+
}
|
|
1149
|
+
if (type === "calendar" && (hasUnsupportedCalendarPopupSetting(block, "quickCreatePopupSettings") || hasUnsupportedCalendarPopupSetting(block, "eventPopupSettings"))) {
|
|
1150
|
+
return true;
|
|
1151
|
+
}
|
|
1152
|
+
if (type === "kanban" && (hasUnsupportedKanbanPopupSetting(block, "quickCreatePopup") || hasUnsupportedKanbanPopupSetting(block, "cardPopup") || hasUnsupportedKanbanItemPublicState(block))) {
|
|
1153
|
+
return true;
|
|
1154
|
+
}
|
|
1155
|
+
if (type === "jsBlock" && hasUnsupportedJsBlockDecoratorProps(block)) {
|
|
1156
|
+
return true;
|
|
1157
|
+
}
|
|
1158
|
+
return Object.entries(block.stepParams || {}).some(([groupKey, groupValue]) => {
|
|
1159
|
+
if (groupKey === import_key_registry.FLOW_SURFACE_INTERNAL_META_KEY || isEmptyPlainContainer(groupValue)) {
|
|
1160
|
+
return false;
|
|
1161
|
+
}
|
|
1162
|
+
const allowedPaths = getAllowedBlockStepParamPaths(type, groupKey);
|
|
1163
|
+
if (!allowedPaths) {
|
|
1164
|
+
return true;
|
|
1165
|
+
}
|
|
1166
|
+
return hasUnsupportedLeafPath(groupValue, allowedPaths);
|
|
1167
|
+
});
|
|
1168
|
+
}
|
|
1169
|
+
function readFieldInit(fieldHost) {
|
|
1170
|
+
return clonePlainObject(getByPath(fieldHost, ["stepParams", "fieldSettings", "init"])) || clonePlainObject(getByPath(getSubNode(fieldHost, "field"), ["stepParams", "fieldSettings", "init"]));
|
|
1171
|
+
}
|
|
1172
|
+
function readFieldPath(fieldHost) {
|
|
1173
|
+
var _a;
|
|
1174
|
+
return readString((_a = readFieldInit(fieldHost)) == null ? void 0 : _a.fieldPath);
|
|
1175
|
+
}
|
|
1176
|
+
function collectFieldBindingUids(fieldHost) {
|
|
1177
|
+
var _a;
|
|
1178
|
+
return import_lodash.default.uniq(compactStringValues([fieldHost.uid, (_a = getSubNode(fieldHost, "field")) == null ? void 0 : _a.uid]));
|
|
1179
|
+
}
|
|
1180
|
+
function collectNestedFieldHostCandidates(fieldHost, rootFieldPath) {
|
|
1181
|
+
const candidates = [];
|
|
1182
|
+
const seenFieldPaths = /* @__PURE__ */ new Set();
|
|
1183
|
+
const visit = (node) => {
|
|
1184
|
+
if (!node) {
|
|
1185
|
+
return;
|
|
1186
|
+
}
|
|
1187
|
+
const fieldPath = readFieldPath(node);
|
|
1188
|
+
if (fieldPath && fieldPath !== rootFieldPath && !seenFieldPaths.has(fieldPath)) {
|
|
1189
|
+
seenFieldPaths.add(fieldPath);
|
|
1190
|
+
candidates.push(node);
|
|
1191
|
+
}
|
|
1192
|
+
Object.values(node.subModels || {}).forEach((value) => {
|
|
1193
|
+
castNodeArray(value).forEach((child) => visit(child));
|
|
1194
|
+
});
|
|
1195
|
+
};
|
|
1196
|
+
Object.values(fieldHost.subModels || {}).forEach((value) => {
|
|
1197
|
+
castNodeArray(value).forEach((child) => visit(child));
|
|
1198
|
+
});
|
|
1199
|
+
return candidates;
|
|
1200
|
+
}
|
|
1201
|
+
function collectExportableNestedRelationFields(ctx, fieldHost, rootFieldPath, path) {
|
|
1202
|
+
const fields = [];
|
|
1203
|
+
const fieldPaths = [];
|
|
1204
|
+
const candidates = collectNestedFieldHostCandidates(fieldHost, rootFieldPath);
|
|
1205
|
+
candidates.forEach((candidate, index) => {
|
|
1206
|
+
const fieldPath = readFieldPath(candidate);
|
|
1207
|
+
const relativeFieldPath = (fieldPath == null ? void 0 : fieldPath.startsWith(`${rootFieldPath}.`)) ? fieldPath.slice(rootFieldPath.length + 1) : fieldPath;
|
|
1208
|
+
if (!fieldPath || !relativeFieldPath) {
|
|
1209
|
+
return;
|
|
1210
|
+
}
|
|
1211
|
+
const unsupportedReason = hasUnsupportedTemplateSummary(candidate) ? TEMPLATE_SUMMARY_UNSUPPORTED_REASON : isExportableNestedRelationField(candidate, relativeFieldPath) ? void 0 : "unsupported-node";
|
|
1212
|
+
if (unsupportedReason) {
|
|
1213
|
+
recordUnsupported(ctx, {
|
|
1214
|
+
kind: "field",
|
|
1215
|
+
use: readString(candidate.use),
|
|
1216
|
+
path: `${path}[${index}]`,
|
|
1217
|
+
reasonCode: unsupportedReason,
|
|
1218
|
+
manualAction: unsupportedReason === TEMPLATE_SUMMARY_UNSUPPORTED_REASON ? templateSummaryManualAction("field") : UNSUPPORTED_MANUAL_ACTION
|
|
1219
|
+
});
|
|
1220
|
+
return;
|
|
1221
|
+
}
|
|
1222
|
+
fields.push(relativeFieldPath);
|
|
1223
|
+
fieldPaths.push(fieldPath);
|
|
1224
|
+
});
|
|
1225
|
+
return {
|
|
1226
|
+
fields: import_lodash.default.uniq(fields),
|
|
1227
|
+
fieldPaths: import_lodash.default.uniq(fieldPaths)
|
|
1228
|
+
};
|
|
1229
|
+
}
|
|
1230
|
+
const DEFAULT_RELATION_OPEN_VIEW_SOURCE_ID = "{{ctx.view.inputArgs.sourceId}}";
|
|
1231
|
+
const DEFAULT_RELATION_OPEN_VIEW_FILTER_BY_TK = "{{ctx.view.inputArgs.filterByTk}}";
|
|
1232
|
+
const DEFAULT_RELATION_OPEN_VIEW_KEYS = /* @__PURE__ */ new Set([
|
|
1233
|
+
"dataSourceKey",
|
|
1234
|
+
"collectionName",
|
|
1235
|
+
"associationName",
|
|
1236
|
+
"sourceId",
|
|
1237
|
+
"filterByTk"
|
|
1238
|
+
]);
|
|
1239
|
+
function isDefaultRelationOpenViewValue(key, value) {
|
|
1240
|
+
if (key === "sourceId") {
|
|
1241
|
+
return import_lodash.default.isUndefined(value) || value === DEFAULT_RELATION_OPEN_VIEW_SOURCE_ID;
|
|
1242
|
+
}
|
|
1243
|
+
if (key === "filterByTk") {
|
|
1244
|
+
return import_lodash.default.isUndefined(value) || value === DEFAULT_RELATION_OPEN_VIEW_FILTER_BY_TK;
|
|
1245
|
+
}
|
|
1246
|
+
return !!readString(value);
|
|
1247
|
+
}
|
|
1248
|
+
function isDefaultRelationDisplayOpenView(value) {
|
|
1249
|
+
if (!import_lodash.default.isPlainObject(value)) {
|
|
1250
|
+
return false;
|
|
1251
|
+
}
|
|
1252
|
+
const entries = Object.entries(value).filter(([, child]) => !import_lodash.default.isUndefined(child));
|
|
1253
|
+
if (!entries.length || entries.some(([key]) => !DEFAULT_RELATION_OPEN_VIEW_KEYS.has(key))) {
|
|
1254
|
+
return false;
|
|
1255
|
+
}
|
|
1256
|
+
return entries.every(([key, child]) => isDefaultRelationOpenViewValue(key, child));
|
|
1257
|
+
}
|
|
1258
|
+
function isDefaultReferencePopupSummary(value) {
|
|
1259
|
+
if (import_lodash.default.isUndefined(value) || value === null) {
|
|
1260
|
+
return true;
|
|
1261
|
+
}
|
|
1262
|
+
if (!import_lodash.default.isPlainObject(value)) {
|
|
1263
|
+
return false;
|
|
1264
|
+
}
|
|
1265
|
+
const popup = value;
|
|
1266
|
+
if (!Object.keys(popup).length) {
|
|
1267
|
+
return true;
|
|
1268
|
+
}
|
|
1269
|
+
const template = popup.template;
|
|
1270
|
+
if (Object.keys(popup).some((key) => key !== "template") || !import_lodash.default.isPlainObject(template)) {
|
|
1271
|
+
return false;
|
|
1272
|
+
}
|
|
1273
|
+
const templateValue = template;
|
|
1274
|
+
return Object.keys(templateValue).every((key) => key === "uid" || key === "mode") && !!readString(templateValue.uid) && readString(templateValue.mode) === "reference";
|
|
1275
|
+
}
|
|
1276
|
+
function isDefaultRelationDisplayClickToOpenState(innerField) {
|
|
1277
|
+
return innerField.use === "DisplayTextFieldModel" && getByPath(innerField, ["stepParams", "displayFieldSettings", "clickToOpen", "clickToOpen"]) === true && isDefaultRelationDisplayOpenView(getByPath(innerField, ["stepParams", "popupSettings", "openView"])) && isDefaultReferencePopupSummary(innerField.popup);
|
|
1278
|
+
}
|
|
1279
|
+
function hasUnsupportedFieldHostProps(fieldHost) {
|
|
1280
|
+
const props = fieldHost.props;
|
|
1281
|
+
const propKeys = Object.keys(props || {}).filter((key) => !import_lodash.default.isUndefined(props == null ? void 0 : props[key]));
|
|
1282
|
+
if (!propKeys.length) {
|
|
1283
|
+
return false;
|
|
1284
|
+
}
|
|
1285
|
+
const allowedKeys = FIELD_PUBLIC_PROP_KEYS_BY_USE[String(fieldHost.use || "")] || /* @__PURE__ */ new Set();
|
|
1286
|
+
return propKeys.some((key) => {
|
|
1287
|
+
if (key === "titleField") {
|
|
1288
|
+
return (props == null ? void 0 : props[key]) !== null && typeof (props == null ? void 0 : props[key]) !== "string";
|
|
1289
|
+
}
|
|
1290
|
+
return !allowedKeys.has(key);
|
|
1291
|
+
});
|
|
1292
|
+
}
|
|
1293
|
+
function hasUnsupportedFieldDecoratorProps(fieldHost) {
|
|
1294
|
+
const decoratorProps = fieldHost.decoratorProps;
|
|
1295
|
+
const propKeys = Object.keys(decoratorProps || {}).filter((key) => !import_lodash.default.isUndefined(decoratorProps == null ? void 0 : decoratorProps[key]));
|
|
1296
|
+
if (!propKeys.length) {
|
|
1297
|
+
return false;
|
|
1298
|
+
}
|
|
1299
|
+
if (fieldHost.use === "TableColumnModel") {
|
|
1300
|
+
return true;
|
|
1301
|
+
}
|
|
1302
|
+
return propKeys.some((key) => !EXPORTED_FIELD_DECORATOR_PROP_KEYS.has(key));
|
|
1303
|
+
}
|
|
1304
|
+
function hasUnsupportedInnerFieldProps(innerField, options = {}) {
|
|
1305
|
+
const props = innerField.props;
|
|
1306
|
+
const propKeys = Object.keys(props || {}).filter((key) => !import_lodash.default.isUndefined(props == null ? void 0 : props[key]));
|
|
1307
|
+
if (!propKeys.length) {
|
|
1308
|
+
return false;
|
|
1309
|
+
}
|
|
1310
|
+
return propKeys.some((key) => {
|
|
1311
|
+
if (key === "titleField") {
|
|
1312
|
+
return (props == null ? void 0 : props[key]) !== null && typeof (props == null ? void 0 : props[key]) !== "string";
|
|
1313
|
+
}
|
|
1314
|
+
if (key === "clickToOpen" && options.allowDefaultClickToOpen) {
|
|
1315
|
+
return (props == null ? void 0 : props[key]) !== true;
|
|
1316
|
+
}
|
|
1317
|
+
return true;
|
|
1318
|
+
});
|
|
1319
|
+
}
|
|
1320
|
+
function hasUnsupportedFieldStepParams(fieldHost) {
|
|
1321
|
+
const stepParams = fieldHost.stepParams || {};
|
|
1322
|
+
return Object.entries(stepParams).some(([groupKey, groupValue]) => {
|
|
1323
|
+
if (groupKey === import_key_registry.FLOW_SURFACE_INTERNAL_META_KEY || isEmptyPlainContainer(groupValue)) {
|
|
1324
|
+
return false;
|
|
1325
|
+
}
|
|
1326
|
+
if (!BASIC_FIELD_STEP_PARAM_GROUPS.has(groupKey)) {
|
|
1327
|
+
return true;
|
|
1328
|
+
}
|
|
1329
|
+
if (groupKey === "fieldSettings") {
|
|
1330
|
+
return hasUnsupportedLeafPath(groupValue, [
|
|
1331
|
+
"init.dataSourceKey",
|
|
1332
|
+
"init.collectionName",
|
|
1333
|
+
"init.associationName",
|
|
1334
|
+
"init.associationPathName",
|
|
1335
|
+
"init.sourceId",
|
|
1336
|
+
"init.filterByTk",
|
|
1337
|
+
"init.fieldPath",
|
|
1338
|
+
"fieldType"
|
|
1339
|
+
]);
|
|
1340
|
+
}
|
|
1341
|
+
if (groupKey === "tableColumnSettings") {
|
|
1342
|
+
return hasUnsupportedLeafPath(groupValue, EXPORTED_TABLE_COLUMN_SETTING_PATHS);
|
|
1343
|
+
}
|
|
1344
|
+
if (groupKey === "detailItemSettings") {
|
|
1345
|
+
return hasUnsupportedLeafPath(groupValue, EXPORTED_DETAIL_ITEM_SETTING_PATHS);
|
|
1346
|
+
}
|
|
1347
|
+
if (groupKey === "editItemSettings") {
|
|
1348
|
+
return hasUnsupportedLeafPath(groupValue, EXPORTED_EDIT_ITEM_SETTING_PATHS);
|
|
1349
|
+
}
|
|
1350
|
+
if (groupKey === "filterFormItemSettings") {
|
|
1351
|
+
return hasUnsupportedLeafPath(groupValue, EXPORTED_FILTER_FORM_ITEM_SETTING_PATHS);
|
|
1352
|
+
}
|
|
1353
|
+
if (groupKey === "jsSettings") {
|
|
1354
|
+
return fieldHost.use !== "JSColumnModel" && fieldHost.use !== "JSItemModel" && !isEmptyPlainContainer(groupValue) || hasUnsupportedLeafPath(groupValue, EXPORTED_JS_FIELD_SETTING_PATHS);
|
|
1355
|
+
}
|
|
1356
|
+
return true;
|
|
1357
|
+
});
|
|
1358
|
+
}
|
|
1359
|
+
function hasUnsupportedFieldPublicState(fieldHost) {
|
|
1360
|
+
if (hasNonEmptyPlainObject(fieldHost.flowRegistry)) {
|
|
1361
|
+
return true;
|
|
1362
|
+
}
|
|
1363
|
+
if (hasUnsupportedFieldHostProps(fieldHost)) {
|
|
1364
|
+
return true;
|
|
1365
|
+
}
|
|
1366
|
+
if (hasUnsupportedFieldDecoratorProps(fieldHost)) {
|
|
1367
|
+
return true;
|
|
1368
|
+
}
|
|
1369
|
+
if (hasUnsupportedFieldStepParams(fieldHost)) {
|
|
1370
|
+
return true;
|
|
1371
|
+
}
|
|
1372
|
+
const innerField = getSubNode(fieldHost, "field");
|
|
1373
|
+
if (innerField) {
|
|
1374
|
+
if (hasNonEmptyPlainObject(innerField.flowRegistry)) {
|
|
1375
|
+
return true;
|
|
1376
|
+
}
|
|
1377
|
+
if (hasUnsupportedInnerFieldProps(innerField, {
|
|
1378
|
+
allowDefaultClickToOpen: isDefaultRelationDisplayClickToOpenState(innerField)
|
|
1379
|
+
})) {
|
|
1380
|
+
return true;
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
return false;
|
|
1384
|
+
}
|
|
1385
|
+
function readLastFieldPathSegment(fieldPath) {
|
|
1386
|
+
const segments = fieldPath.split(".").filter(Boolean);
|
|
1387
|
+
return segments[segments.length - 1];
|
|
1388
|
+
}
|
|
1389
|
+
function hasUnsupportedNestedFieldHostProps(props, relativeFieldPath) {
|
|
1390
|
+
const propKeys = Object.keys(props || {}).filter((key) => !import_lodash.default.isUndefined(props == null ? void 0 : props[key]));
|
|
1391
|
+
if (!propKeys.length) {
|
|
1392
|
+
return false;
|
|
1393
|
+
}
|
|
1394
|
+
const defaultLabel = readLastFieldPathSegment(relativeFieldPath);
|
|
1395
|
+
return propKeys.some((key) => {
|
|
1396
|
+
if (key === "label") {
|
|
1397
|
+
return (props == null ? void 0 : props[key]) !== defaultLabel;
|
|
1398
|
+
}
|
|
1399
|
+
return true;
|
|
1400
|
+
});
|
|
1401
|
+
}
|
|
1402
|
+
function hasUnsupportedNestedInnerFieldProps(innerField) {
|
|
1403
|
+
const props = innerField.props;
|
|
1404
|
+
const propKeys = Object.keys(props || {}).filter((key) => !import_lodash.default.isUndefined(props == null ? void 0 : props[key]));
|
|
1405
|
+
if (!propKeys.length) {
|
|
1406
|
+
return false;
|
|
1407
|
+
}
|
|
1408
|
+
return propKeys.some((key) => {
|
|
1409
|
+
if (key === "allowClear" && innerField.use === "SelectFieldModel") {
|
|
1410
|
+
return (props == null ? void 0 : props[key]) !== true;
|
|
1411
|
+
}
|
|
1412
|
+
return true;
|
|
1413
|
+
});
|
|
1414
|
+
}
|
|
1415
|
+
function isExportableNestedRelationField(candidate, relativeFieldPath) {
|
|
1416
|
+
if (hasNonEmptyPlainObject(candidate.flowRegistry)) {
|
|
1417
|
+
return false;
|
|
1418
|
+
}
|
|
1419
|
+
if (hasUnsupportedNestedFieldHostProps(candidate.props, relativeFieldPath)) {
|
|
1420
|
+
return false;
|
|
1421
|
+
}
|
|
1422
|
+
if (hasUnsupportedFieldStepParams(candidate)) {
|
|
1423
|
+
return false;
|
|
1424
|
+
}
|
|
1425
|
+
const innerField = getSubNode(candidate, "field");
|
|
1426
|
+
if (!innerField) {
|
|
1427
|
+
return true;
|
|
1428
|
+
}
|
|
1429
|
+
if (hasNonEmptyPlainObject(innerField.flowRegistry)) {
|
|
1430
|
+
return false;
|
|
1431
|
+
}
|
|
1432
|
+
return !hasUnsupportedNestedInnerFieldProps(innerField);
|
|
1433
|
+
}
|
|
1434
|
+
function inferExportFieldType(innerField) {
|
|
1435
|
+
const explicitFieldType = readString(getByPath(innerField, ["stepParams", "fieldSettings", "fieldType"]));
|
|
1436
|
+
if (explicitFieldType) {
|
|
1437
|
+
return explicitFieldType;
|
|
1438
|
+
}
|
|
1439
|
+
const publicFieldType = (0, import_field_type_resolver.getPublicFieldTypeForUse)(readString(getByPath(innerField, ["stepParams", "fieldBinding", "use"]))) || (0, import_field_type_resolver.getPublicFieldTypeForUse)(readString(innerField == null ? void 0 : innerField.use));
|
|
1440
|
+
return publicFieldType && FIELD_TYPES_WITH_NESTED_FIELDS.has(publicFieldType) ? publicFieldType : void 0;
|
|
1441
|
+
}
|
|
1442
|
+
function readFieldPublicSetting(fieldHost, propKey, stepParamPaths = []) {
|
|
1443
|
+
const propValue = getOwnValue(fieldHost.props, propKey);
|
|
1444
|
+
if (!import_lodash.default.isUndefined(propValue)) {
|
|
1445
|
+
return propValue;
|
|
1446
|
+
}
|
|
1447
|
+
for (const stepParamPath of stepParamPaths) {
|
|
1448
|
+
const value = getByPath(fieldHost, ["stepParams", ...stepParamPath]);
|
|
1449
|
+
if (!import_lodash.default.isUndefined(value)) {
|
|
1450
|
+
return import_lodash.default.cloneDeep(value);
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
return void 0;
|
|
1454
|
+
}
|
|
1455
|
+
function readFieldDecoratorSetting(fieldHost, propKey) {
|
|
1456
|
+
return getOwnValue(fieldHost.decoratorProps, propKey);
|
|
1457
|
+
}
|
|
1458
|
+
function exportTableFieldPublicSettings(fieldHost) {
|
|
1459
|
+
return {
|
|
1460
|
+
settings: buildDefinedPayload({
|
|
1461
|
+
title: readFieldPublicSetting(fieldHost, "title", [["tableColumnSettings", "title", "title"]]),
|
|
1462
|
+
tooltip: readFieldPublicSetting(fieldHost, "tooltip", [["tableColumnSettings", "tooltip", "tooltip"]]),
|
|
1463
|
+
width: readFieldPublicSetting(fieldHost, "width", [["tableColumnSettings", "width", "width"]]),
|
|
1464
|
+
fixed: readFieldPublicSetting(fieldHost, "fixed", [["tableColumnSettings", "fixed", "fixed"]]),
|
|
1465
|
+
sorter: readFieldPublicSetting(fieldHost, "sorter", [["tableColumnSettings", "sorter", "sorter"]]),
|
|
1466
|
+
editable: readFieldPublicSetting(fieldHost, "editable", [["tableColumnSettings", "quickEdit", "editable"]]),
|
|
1467
|
+
dataIndex: readFieldPublicSetting(fieldHost, "dataIndex")
|
|
1468
|
+
})
|
|
1469
|
+
};
|
|
1470
|
+
}
|
|
1471
|
+
function exportFormFieldPublicSettings(fieldHost) {
|
|
1472
|
+
const settings = buildDefinedPayload({
|
|
1473
|
+
tooltip: readFieldPublicSetting(fieldHost, "tooltip", [["editItemSettings", "tooltip", "tooltip"]]),
|
|
1474
|
+
extra: readFieldPublicSetting(fieldHost, "extra", [["editItemSettings", "description", "description"]]),
|
|
1475
|
+
showLabel: readFieldPublicSetting(fieldHost, "showLabel", [["editItemSettings", "showLabel", "showLabel"]]),
|
|
1476
|
+
initialValue: readFieldPublicSetting(fieldHost, "initialValue", [
|
|
1477
|
+
["editItemSettings", "initialValue", "defaultValue"]
|
|
1478
|
+
]),
|
|
1479
|
+
required: readFieldPublicSetting(fieldHost, "required", [["editItemSettings", "required", "required"]]),
|
|
1480
|
+
rules: readFieldPublicSetting(fieldHost, "rules"),
|
|
1481
|
+
disabled: readFieldPublicSetting(fieldHost, "disabled"),
|
|
1482
|
+
multiple: readFieldPublicSetting(fieldHost, "multiple"),
|
|
1483
|
+
allowMultiple: readFieldPublicSetting(fieldHost, "allowMultiple"),
|
|
1484
|
+
maxCount: readFieldPublicSetting(fieldHost, "maxCount"),
|
|
1485
|
+
pattern: readFieldPublicSetting(fieldHost, "pattern", [["editItemSettings", "pattern", "pattern"]]),
|
|
1486
|
+
name: readFieldPublicSetting(fieldHost, "name"),
|
|
1487
|
+
labelWidth: readFieldDecoratorSetting(fieldHost, "labelWidth"),
|
|
1488
|
+
labelWrap: readFieldDecoratorSetting(fieldHost, "labelWrap")
|
|
1489
|
+
});
|
|
1490
|
+
return buildDefinedPayload({
|
|
1491
|
+
label: readString(readFieldPublicSetting(fieldHost, "label", [["editItemSettings", "label", "label"]])),
|
|
1492
|
+
settings: Object.keys(settings).length ? settings : void 0
|
|
1493
|
+
});
|
|
1494
|
+
}
|
|
1495
|
+
function exportDetailFieldPublicSettings(fieldHost) {
|
|
1496
|
+
const settings = buildDefinedPayload({
|
|
1497
|
+
tooltip: readFieldPublicSetting(fieldHost, "tooltip", [["detailItemSettings", "tooltip", "tooltip"]]),
|
|
1498
|
+
extra: readFieldPublicSetting(fieldHost, "extra", [["detailItemSettings", "description", "description"]]),
|
|
1499
|
+
showLabel: readFieldPublicSetting(fieldHost, "showLabel", [["detailItemSettings", "showLabel", "showLabel"]]),
|
|
1500
|
+
disabled: readFieldPublicSetting(fieldHost, "disabled"),
|
|
1501
|
+
pattern: readFieldPublicSetting(fieldHost, "pattern"),
|
|
1502
|
+
labelWidth: readFieldDecoratorSetting(fieldHost, "labelWidth"),
|
|
1503
|
+
labelWrap: readFieldDecoratorSetting(fieldHost, "labelWrap")
|
|
1504
|
+
});
|
|
1505
|
+
return buildDefinedPayload({
|
|
1506
|
+
label: readString(readFieldPublicSetting(fieldHost, "label", [["detailItemSettings", "label", "title"]])),
|
|
1507
|
+
settings: Object.keys(settings).length ? settings : void 0
|
|
1508
|
+
});
|
|
1509
|
+
}
|
|
1510
|
+
function exportFilterFieldPublicSettings(fieldHost) {
|
|
1511
|
+
const settings = buildDefinedPayload({
|
|
1512
|
+
tooltip: readFieldPublicSetting(fieldHost, "tooltip", [["filterFormItemSettings", "tooltip", "tooltip"]]),
|
|
1513
|
+
extra: readFieldPublicSetting(fieldHost, "extra", [["filterFormItemSettings", "description", "description"]]),
|
|
1514
|
+
showLabel: readFieldPublicSetting(fieldHost, "showLabel", [["filterFormItemSettings", "showLabel", "showLabel"]]),
|
|
1515
|
+
initialValue: readFieldPublicSetting(fieldHost, "initialValue", [
|
|
1516
|
+
["filterFormItemSettings", "initialValue", "defaultValue"]
|
|
1517
|
+
]),
|
|
1518
|
+
multiple: readFieldPublicSetting(fieldHost, "multiple"),
|
|
1519
|
+
allowMultiple: readFieldPublicSetting(fieldHost, "allowMultiple"),
|
|
1520
|
+
maxCount: readFieldPublicSetting(fieldHost, "maxCount"),
|
|
1521
|
+
name: readFieldPublicSetting(fieldHost, "name"),
|
|
1522
|
+
labelWidth: readFieldDecoratorSetting(fieldHost, "labelWidth"),
|
|
1523
|
+
labelWrap: readFieldDecoratorSetting(fieldHost, "labelWrap")
|
|
1524
|
+
});
|
|
1525
|
+
return buildDefinedPayload({
|
|
1526
|
+
label: readString(readFieldPublicSetting(fieldHost, "label", [["filterFormItemSettings", "label", "label"]])),
|
|
1527
|
+
settings: Object.keys(settings).length ? settings : void 0
|
|
1528
|
+
});
|
|
1529
|
+
}
|
|
1530
|
+
function exportFieldPublicSettings(fieldHost) {
|
|
1531
|
+
switch (fieldHost.use) {
|
|
1532
|
+
case "TableColumnModel":
|
|
1533
|
+
return exportTableFieldPublicSettings(fieldHost);
|
|
1534
|
+
case "FormItemModel":
|
|
1535
|
+
case "PatternFormItemModel":
|
|
1536
|
+
return exportFormFieldPublicSettings(fieldHost);
|
|
1537
|
+
case "DetailsItemModel":
|
|
1538
|
+
case "ApprovalDetailsItemModel":
|
|
1539
|
+
case "ApplyTaskCardDetailsItemModel":
|
|
1540
|
+
case "ApprovalTaskCardDetailsItemModel":
|
|
1541
|
+
case "FormAssociationItemModel":
|
|
1542
|
+
return exportDetailFieldPublicSettings(fieldHost);
|
|
1543
|
+
case "FilterFormItemModel":
|
|
1544
|
+
return exportFilterFieldPublicSettings(fieldHost);
|
|
1545
|
+
default:
|
|
1546
|
+
return {};
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1549
|
+
function exportFieldSettings(fieldHost, nestedFields) {
|
|
1550
|
+
var _a, _b;
|
|
1551
|
+
if (hasUnsupportedFieldPublicState(fieldHost)) {
|
|
1552
|
+
return void 0;
|
|
1553
|
+
}
|
|
1554
|
+
if (fieldHost.use === "JSColumnModel" || fieldHost.use === "JSItemModel") {
|
|
1555
|
+
const runJs = clonePlainObject(getByPath(fieldHost, ["stepParams", "jsSettings", "runJs"]));
|
|
1556
|
+
const type = fieldHost.use === "JSColumnModel" ? "jsColumn" : "jsItem";
|
|
1557
|
+
return buildDefinedPayload({
|
|
1558
|
+
type,
|
|
1559
|
+
settings: runJs
|
|
1560
|
+
});
|
|
1561
|
+
}
|
|
1562
|
+
const init = readFieldInit(fieldHost);
|
|
1563
|
+
const fieldPath = readString(init == null ? void 0 : init.fieldPath);
|
|
1564
|
+
if (!fieldPath) {
|
|
1565
|
+
return void 0;
|
|
1566
|
+
}
|
|
1567
|
+
const publicSettings = exportFieldPublicSettings(fieldHost);
|
|
1568
|
+
const innerField = getSubNode(fieldHost, "field");
|
|
1569
|
+
const fieldType = inferExportFieldType(innerField);
|
|
1570
|
+
const titleField = readString(getByPath(fieldHost, ["stepParams", "tableColumnSettings", "fieldNames", "label"])) || readString(getByPath(fieldHost, ["stepParams", "detailItemSettings", "fieldNames", "label"])) || readString(getByPath(fieldHost, ["stepParams", "editItemSettings", "titleField", "label"])) || readString((_a = fieldHost.props) == null ? void 0 : _a.titleField) || readString((_b = innerField == null ? void 0 : innerField.props) == null ? void 0 : _b.titleField);
|
|
1571
|
+
const popup = exportPopupSummary(fieldHost.popup);
|
|
1572
|
+
return buildDefinedPayload({
|
|
1573
|
+
field: fieldPath,
|
|
1574
|
+
associationPathName: readString(init == null ? void 0 : init.associationPathName),
|
|
1575
|
+
fieldType,
|
|
1576
|
+
fields: fieldType && FIELD_TYPES_WITH_NESTED_FIELDS.has(fieldType) && (nestedFields == null ? void 0 : nestedFields.length) ? nestedFields : void 0,
|
|
1577
|
+
label: publicSettings.label,
|
|
1578
|
+
titleField,
|
|
1579
|
+
settings: publicSettings.settings,
|
|
1580
|
+
popup
|
|
1581
|
+
});
|
|
1582
|
+
}
|
|
1583
|
+
function exportFields(ctx, fieldHosts, scope, path) {
|
|
1584
|
+
return fieldHosts.flatMap((fieldHost, index) => {
|
|
1585
|
+
const fieldPath = `${path}[${index}]`;
|
|
1586
|
+
if (hasUnsupportedTemplateSummary(fieldHost)) {
|
|
1587
|
+
recordUnsupported(ctx, {
|
|
1588
|
+
kind: "field",
|
|
1589
|
+
use: readString(fieldHost.use),
|
|
1590
|
+
path: fieldPath,
|
|
1591
|
+
reasonCode: TEMPLATE_SUMMARY_UNSUPPORTED_REASON,
|
|
1592
|
+
manualAction: templateSummaryManualAction("field")
|
|
1593
|
+
});
|
|
1594
|
+
return [];
|
|
1595
|
+
}
|
|
1596
|
+
const rootFieldPath = readFieldPath(fieldHost);
|
|
1597
|
+
const nested = rootFieldPath ? collectExportableNestedRelationFields(ctx, fieldHost, rootFieldPath, `${fieldPath}.fields`) : { fields: [], fieldPaths: [] };
|
|
1598
|
+
const settings = exportFieldSettings(fieldHost, nested.fields);
|
|
1599
|
+
if (!settings) {
|
|
1600
|
+
recordUnsupported(ctx, {
|
|
1601
|
+
kind: "field",
|
|
1602
|
+
use: readString(fieldHost.use),
|
|
1603
|
+
path: fieldPath,
|
|
1604
|
+
reasonCode: "unsupported-node",
|
|
1605
|
+
manualAction: UNSUPPORTED_MANUAL_ACTION
|
|
1606
|
+
});
|
|
1607
|
+
return [];
|
|
1608
|
+
}
|
|
1609
|
+
const fallback = readString(settings.field) || `field_${index + 1}`;
|
|
1610
|
+
const key = dedupeKey(ctx, scope, getDeclaredKey(fieldHost, scope.prefix), fallback, `${fieldPath}.key`);
|
|
1611
|
+
const spec = buildDefinedPayload({
|
|
1612
|
+
key,
|
|
1613
|
+
...settings
|
|
1614
|
+
});
|
|
1615
|
+
return [
|
|
1616
|
+
{
|
|
1617
|
+
spec,
|
|
1618
|
+
uid: fieldHost.uid,
|
|
1619
|
+
bindingUids: collectFieldBindingUids(fieldHost),
|
|
1620
|
+
key,
|
|
1621
|
+
fieldPaths: import_lodash.default.uniq(
|
|
1622
|
+
compactStringValues([settings.field, ...nested.fieldPaths])
|
|
1623
|
+
)
|
|
1624
|
+
}
|
|
1625
|
+
];
|
|
1626
|
+
});
|
|
1627
|
+
}
|
|
1628
|
+
function getFieldHosts(block, type) {
|
|
1629
|
+
if (type === "table") {
|
|
1630
|
+
return getSubNodeArray(block, "columns").filter((item) => item.use !== TABLE_ACTIONS_COLUMN_USE);
|
|
1631
|
+
}
|
|
1632
|
+
if (FIELD_GRID_BLOCK_TYPES.has(type)) {
|
|
1633
|
+
return getSubNodeArray(getSubNode(block, "grid"), "items");
|
|
1634
|
+
}
|
|
1635
|
+
if (CARD_FIELD_BLOCK_TYPES.has(type)) {
|
|
1636
|
+
return getSubNodeArray(getSubNode(getSubNode(block, "item"), "grid"), "items");
|
|
1637
|
+
}
|
|
1638
|
+
return [];
|
|
1639
|
+
}
|
|
1640
|
+
function isDefaultPopupRuntimeOpenViewValue(key, value, resourceContext) {
|
|
1641
|
+
if (key === "size") {
|
|
1642
|
+
return value === "medium";
|
|
1643
|
+
}
|
|
1644
|
+
if (key === "pageModelClass") {
|
|
1645
|
+
return value === "ChildPageModel";
|
|
1646
|
+
}
|
|
1647
|
+
if (key === "collectionName") {
|
|
1648
|
+
return !!(resourceContext == null ? void 0 : resourceContext.collectionName) && readString(value) === resourceContext.collectionName;
|
|
1649
|
+
}
|
|
1650
|
+
if (key === "associationName") {
|
|
1651
|
+
return !!(resourceContext == null ? void 0 : resourceContext.associationName) && readString(value) === resourceContext.associationName;
|
|
1652
|
+
}
|
|
1653
|
+
if (key === "sourceId") {
|
|
1654
|
+
return value === DEFAULT_RELATION_OPEN_VIEW_SOURCE_ID;
|
|
1655
|
+
}
|
|
1656
|
+
if (key === "filterByTk") {
|
|
1657
|
+
return value === DEFAULT_RELATION_OPEN_VIEW_FILTER_BY_TK;
|
|
1658
|
+
}
|
|
1659
|
+
if (key === "dataSourceKey") {
|
|
1660
|
+
const expectedDataSourceKey = (resourceContext == null ? void 0 : resourceContext.dataSourceKey) || ((resourceContext == null ? void 0 : resourceContext.collectionName) ? "main" : "");
|
|
1661
|
+
return !!expectedDataSourceKey && readString(value) === expectedDataSourceKey;
|
|
1662
|
+
}
|
|
1663
|
+
return false;
|
|
1664
|
+
}
|
|
1665
|
+
function hasUnsupportedPopupSettings(popupSettings, type, resourceContext) {
|
|
1666
|
+
if (!popupSettings) {
|
|
1667
|
+
return false;
|
|
1668
|
+
}
|
|
1669
|
+
if (!PUBLIC_POPUP_ACTION_TYPES.has(type)) {
|
|
1670
|
+
return true;
|
|
1671
|
+
}
|
|
1672
|
+
return Object.entries(popupSettings).some(([key, value]) => {
|
|
1673
|
+
if (BASIC_INLINE_POPUP_OPEN_VIEW_KEYS.has(key)) {
|
|
1674
|
+
return false;
|
|
1675
|
+
}
|
|
1676
|
+
if (BASIC_INLINE_POPUP_DEFAULT_RUNTIME_KEYS.has(key)) {
|
|
1677
|
+
return !isDefaultPopupRuntimeOpenViewValue(key, value, resourceContext);
|
|
1678
|
+
}
|
|
1679
|
+
return true;
|
|
1680
|
+
});
|
|
1681
|
+
}
|
|
1682
|
+
function exportActionButtonSettings(action) {
|
|
1683
|
+
const general = getByPath(action, ["stepParams", "buttonSettings", "general"]) || {};
|
|
1684
|
+
const readValue = (key) => getOwnValue(action.props, key) ?? getOwnValue(general, key);
|
|
1685
|
+
return buildDefinedPayload({
|
|
1686
|
+
title: readValue("title"),
|
|
1687
|
+
tooltip: readValue("tooltip"),
|
|
1688
|
+
icon: readValue("icon"),
|
|
1689
|
+
type: readValue("type"),
|
|
1690
|
+
danger: readValue("danger"),
|
|
1691
|
+
color: readValue("color")
|
|
1692
|
+
});
|
|
1693
|
+
}
|
|
1694
|
+
function exportFilterActionSettings(action) {
|
|
1695
|
+
const filterSettings = getByPath(action, ["stepParams", "filterSettings"]);
|
|
1696
|
+
if (!filterSettings) {
|
|
1697
|
+
return void 0;
|
|
1698
|
+
}
|
|
1699
|
+
const defaultFilter = import_lodash.default.cloneDeep(import_lodash.default.get(filterSettings, ["defaultFilter", "defaultFilter"]));
|
|
1700
|
+
const filterableFieldNames = import_lodash.default.cloneDeep(import_lodash.default.get(filterSettings, ["filterableFieldNames", "filterableFieldNames"]));
|
|
1701
|
+
return buildDefinedPayload({
|
|
1702
|
+
defaultFilter: import_lodash.default.isUndefined(defaultFilter) ? void 0 : defaultFilter,
|
|
1703
|
+
filterableFieldNames: import_lodash.default.isUndefined(filterableFieldNames) ? void 0 : filterableFieldNames
|
|
1704
|
+
});
|
|
1705
|
+
}
|
|
1706
|
+
function exportDeleteActionSettings(action, type) {
|
|
1707
|
+
if (!BASIC_DELETE_ACTION_TYPES.has(type)) {
|
|
1708
|
+
return void 0;
|
|
1709
|
+
}
|
|
1710
|
+
const confirm = clonePlainObject(getByPath(action, ["stepParams", "deleteSettings", "confirm"]));
|
|
1711
|
+
return confirm ? { confirm } : void 0;
|
|
1712
|
+
}
|
|
1713
|
+
function readActionRunJsSettings(action) {
|
|
1714
|
+
return clonePlainObject(getByPath(action, ["stepParams", "clickSettings", "runJs"])) || clonePlainObject(getByPath(action, ["stepParams", "jsSettings", "runJs"]));
|
|
1715
|
+
}
|
|
1716
|
+
function hasUnsupportedActionButtonSettings(action) {
|
|
1717
|
+
const buttonSettings = getByPath(action, ["stepParams", "buttonSettings"]);
|
|
1718
|
+
if (!buttonSettings) {
|
|
1719
|
+
return false;
|
|
1720
|
+
}
|
|
1721
|
+
const unsupportedGroups = Object.keys(buttonSettings).filter((key) => key !== "general" && key !== "linkageRules");
|
|
1722
|
+
if (unsupportedGroups.length) {
|
|
1723
|
+
return true;
|
|
1724
|
+
}
|
|
1725
|
+
const general = getByPath(action, ["stepParams", "buttonSettings", "general"]);
|
|
1726
|
+
if (!general) {
|
|
1727
|
+
return false;
|
|
1728
|
+
}
|
|
1729
|
+
return Object.keys(general).some((key) => !BASIC_ACTION_BUTTON_GENERAL_KEYS.has(key));
|
|
1730
|
+
}
|
|
1731
|
+
function hasUnsupportedActionFilterSettings(action, type) {
|
|
1732
|
+
const filterSettings = getByPath(action, ["stepParams", "filterSettings"]);
|
|
1733
|
+
if (!filterSettings) {
|
|
1734
|
+
return false;
|
|
1735
|
+
}
|
|
1736
|
+
if (type !== "filter") {
|
|
1737
|
+
return true;
|
|
1738
|
+
}
|
|
1739
|
+
const unsupportedGroups = Object.keys(filterSettings).filter(
|
|
1740
|
+
(key) => key !== "defaultFilter" && key !== "filterableFieldNames"
|
|
1741
|
+
);
|
|
1742
|
+
if (unsupportedGroups.length) {
|
|
1743
|
+
return true;
|
|
1744
|
+
}
|
|
1745
|
+
const defaultFilter = getByPath(action, ["stepParams", "filterSettings", "defaultFilter"]);
|
|
1746
|
+
const filterableFieldNames = getByPath(action, [
|
|
1747
|
+
"stepParams",
|
|
1748
|
+
"filterSettings",
|
|
1749
|
+
"filterableFieldNames"
|
|
1750
|
+
]);
|
|
1751
|
+
return defaultFilter && Object.keys(defaultFilter).some((key) => key !== "defaultFilter") || filterableFieldNames && Object.keys(filterableFieldNames).some((key) => key !== "filterableFieldNames");
|
|
1752
|
+
}
|
|
1753
|
+
function hasUnsupportedActionDeleteSettings(action, type) {
|
|
1754
|
+
const deleteSettings = getByPath(action, ["stepParams", "deleteSettings"]);
|
|
1755
|
+
if (!deleteSettings) {
|
|
1756
|
+
return false;
|
|
1757
|
+
}
|
|
1758
|
+
if (!BASIC_DELETE_ACTION_TYPES.has(type)) {
|
|
1759
|
+
return true;
|
|
1760
|
+
}
|
|
1761
|
+
const unsupportedGroups = Object.keys(deleteSettings).filter((key) => key !== "confirm");
|
|
1762
|
+
if (unsupportedGroups.length) {
|
|
1763
|
+
return true;
|
|
1764
|
+
}
|
|
1765
|
+
const confirm = getByPath(action, ["stepParams", "deleteSettings", "confirm"]);
|
|
1766
|
+
return !!confirm && Object.keys(confirm).some((key) => !BASIC_DELETE_CONFIRM_KEYS.has(key));
|
|
1767
|
+
}
|
|
1768
|
+
function hasUnsupportedActionRunJsSettings(action, type) {
|
|
1769
|
+
const clickSettings = getByPath(action, ["stepParams", "clickSettings"]);
|
|
1770
|
+
const jsSettings = getByPath(action, ["stepParams", "jsSettings"]);
|
|
1771
|
+
if (!clickSettings && !jsSettings) {
|
|
1772
|
+
return false;
|
|
1773
|
+
}
|
|
1774
|
+
if (type !== "js" && type !== "jsItem") {
|
|
1775
|
+
return true;
|
|
1776
|
+
}
|
|
1777
|
+
const unsupportedClickSettings = clickSettings && Object.keys(clickSettings).some((key) => key !== "runJs");
|
|
1778
|
+
const unsupportedJsSettings = jsSettings && Object.keys(jsSettings).some((key) => key !== "runJs");
|
|
1779
|
+
if (unsupportedClickSettings || unsupportedJsSettings) {
|
|
1780
|
+
return true;
|
|
1781
|
+
}
|
|
1782
|
+
if (clickSettings && !JS_ACTION_USES.has(String(action.use || ""))) {
|
|
1783
|
+
return true;
|
|
1784
|
+
}
|
|
1785
|
+
if (jsSettings && !JS_ITEM_ACTION_USES.has(String(action.use || ""))) {
|
|
1786
|
+
return true;
|
|
1787
|
+
}
|
|
1788
|
+
const runJs = readActionRunJsSettings(action);
|
|
1789
|
+
return !!runJs && Object.keys(runJs).some((key) => key !== "code" && key !== "version");
|
|
1790
|
+
}
|
|
1791
|
+
function isActionPropExportable(action, type, key) {
|
|
1792
|
+
var _a, _b, _c;
|
|
1793
|
+
if (!BASIC_ACTION_PROP_KEYS.has(key)) {
|
|
1794
|
+
return false;
|
|
1795
|
+
}
|
|
1796
|
+
if (key === "position") {
|
|
1797
|
+
return type === "bulkDelete" && ((_a = action.props) == null ? void 0 : _a.position) === "right";
|
|
1798
|
+
}
|
|
1799
|
+
if (key === "filterableFieldNames") {
|
|
1800
|
+
const exportedFilter = exportFilterActionSettings(action);
|
|
1801
|
+
return type === "filter" && import_lodash.default.isEqual((_b = action.props) == null ? void 0 : _b.filterableFieldNames, exportedFilter == null ? void 0 : exportedFilter.filterableFieldNames);
|
|
1802
|
+
}
|
|
1803
|
+
if (key === "defaultFilterValue" || key === "filterValue") {
|
|
1804
|
+
const exportedFilter = exportFilterActionSettings(action);
|
|
1805
|
+
return type === "filter" && import_lodash.default.isEqual((_c = action.props) == null ? void 0 : _c[key], exportedFilter == null ? void 0 : exportedFilter.defaultFilter);
|
|
1806
|
+
}
|
|
1807
|
+
return true;
|
|
1808
|
+
}
|
|
1809
|
+
function hasUnsupportedActionPublicState(action, type, resourceContext) {
|
|
1810
|
+
if (type === "aiEmployee") {
|
|
1811
|
+
return true;
|
|
1812
|
+
}
|
|
1813
|
+
const props = action.props || {};
|
|
1814
|
+
if (Object.keys(props).some((key) => !isActionPropExportable(action, type, key))) {
|
|
1815
|
+
return true;
|
|
1816
|
+
}
|
|
1817
|
+
const stepParams = action.stepParams || {};
|
|
1818
|
+
if (getPublicStepParamKeys(stepParams).some((key) => !BASIC_ACTION_STEP_PARAM_GROUPS.has(key))) {
|
|
1819
|
+
return true;
|
|
1820
|
+
}
|
|
1821
|
+
if (hasUnsupportedActionButtonSettings(action) || hasUnsupportedActionFilterSettings(action, type) || hasUnsupportedActionDeleteSettings(action, type) || hasUnsupportedActionRunJsSettings(action, type)) {
|
|
1822
|
+
return true;
|
|
1823
|
+
}
|
|
1824
|
+
const popupSettings = getByPath(action, ["stepParams", "popupSettings"]);
|
|
1825
|
+
if (popupSettings && Object.keys(popupSettings).some((key) => key !== "openView")) {
|
|
1826
|
+
return true;
|
|
1827
|
+
}
|
|
1828
|
+
if (getSubNode(action, "page")) {
|
|
1829
|
+
return true;
|
|
1830
|
+
}
|
|
1831
|
+
const openView = getByPath(action, ["stepParams", "popupSettings", "openView"]);
|
|
1832
|
+
if (hasUnsupportedPopupSettings(openView, type, resourceContext)) {
|
|
1833
|
+
return true;
|
|
1834
|
+
}
|
|
1835
|
+
return hasNonEmptyPlainObject(action.flowRegistry);
|
|
1836
|
+
}
|
|
1837
|
+
function exportActionSettings(action, resourceContext) {
|
|
1838
|
+
const type = import_catalog.ACTION_KEY_BY_USE.get(String(action.use || ""));
|
|
1839
|
+
if (!type) {
|
|
1840
|
+
return void 0;
|
|
1841
|
+
}
|
|
1842
|
+
if (hasUnsupportedActionPublicState(action, type, resourceContext)) {
|
|
1843
|
+
return void 0;
|
|
1844
|
+
}
|
|
1845
|
+
const popupSettings = getByPath(action, ["stepParams", "popupSettings", "openView"]);
|
|
1846
|
+
const popupTemplate = exportPopupSummary(action.popup);
|
|
1847
|
+
const settings = buildDefinedPayload({
|
|
1848
|
+
...exportActionButtonSettings(action),
|
|
1849
|
+
...type === "filter" ? exportFilterActionSettings(action) : {},
|
|
1850
|
+
...exportDeleteActionSettings(action, type),
|
|
1851
|
+
...type === "js" || type === "jsItem" ? readActionRunJsSettings(action) : {}
|
|
1852
|
+
});
|
|
1853
|
+
const popup = import_lodash.default.isPlainObject(popupSettings) && PUBLIC_POPUP_ACTION_TYPES.has(type) ? buildDefinedPayload({
|
|
1854
|
+
title: readString(popupSettings.title),
|
|
1855
|
+
mode: readString(popupSettings.mode),
|
|
1856
|
+
tryTemplate: typeof popupSettings.tryTemplate === "boolean" ? popupSettings.tryTemplate : void 0,
|
|
1857
|
+
defaultType: type === "view" ? "view" : type === "edit" ? "edit" : readString(popupSettings.defaultType),
|
|
1858
|
+
...popupTemplate
|
|
1859
|
+
}) : popupTemplate;
|
|
1860
|
+
return buildDefinedPayload({
|
|
1861
|
+
type,
|
|
1862
|
+
settings: settings && Object.keys(settings).length ? settings : void 0,
|
|
1863
|
+
popup: popup && Object.keys(popup).length ? popup : void 0
|
|
1864
|
+
});
|
|
1865
|
+
}
|
|
1866
|
+
function exportActions(ctx, actions, scope, kind, path, resourceContext) {
|
|
1867
|
+
return actions.flatMap((action, index) => {
|
|
1868
|
+
const actionPath = `${path}[${index}]`;
|
|
1869
|
+
if (hasUnsupportedTemplateSummary(action)) {
|
|
1870
|
+
recordUnsupported(ctx, {
|
|
1871
|
+
kind,
|
|
1872
|
+
use: readString(action.use),
|
|
1873
|
+
path: actionPath,
|
|
1874
|
+
reasonCode: TEMPLATE_SUMMARY_UNSUPPORTED_REASON,
|
|
1875
|
+
manualAction: templateSummaryManualAction(kind)
|
|
1876
|
+
});
|
|
1877
|
+
return [];
|
|
1878
|
+
}
|
|
1879
|
+
const settings = exportActionSettings(action, resourceContext);
|
|
1880
|
+
if (!(settings == null ? void 0 : settings.type)) {
|
|
1881
|
+
recordUnsupported(ctx, {
|
|
1882
|
+
kind,
|
|
1883
|
+
use: readString(action.use),
|
|
1884
|
+
path: actionPath,
|
|
1885
|
+
reasonCode: "unsupported-node",
|
|
1886
|
+
manualAction: UNSUPPORTED_MANUAL_ACTION
|
|
1887
|
+
});
|
|
1888
|
+
return [];
|
|
1889
|
+
}
|
|
1890
|
+
const key = dedupeKey(ctx, scope, getDeclaredKey(action, scope.prefix), settings.type, `${actionPath}.key`);
|
|
1891
|
+
const spec = buildDefinedPayload({
|
|
1892
|
+
key,
|
|
1893
|
+
...settings
|
|
1894
|
+
});
|
|
1895
|
+
return [
|
|
1896
|
+
{
|
|
1897
|
+
spec,
|
|
1898
|
+
uid: action.uid,
|
|
1899
|
+
key
|
|
1900
|
+
}
|
|
1901
|
+
];
|
|
1902
|
+
});
|
|
1903
|
+
}
|
|
1904
|
+
function getRecordActionHosts(block, type) {
|
|
1905
|
+
if (type === "table") {
|
|
1906
|
+
const actionsColumn = getSubNodeArray(block, "columns").find((item) => item.use === TABLE_ACTIONS_COLUMN_USE);
|
|
1907
|
+
return getSubNodeArray(actionsColumn, "actions");
|
|
1908
|
+
}
|
|
1909
|
+
if (type === "list" || type === "gridCard" || type === "comments") {
|
|
1910
|
+
return getSubNodeArray(getSubNode(block, "item"), "actions");
|
|
1911
|
+
}
|
|
1912
|
+
return [];
|
|
1913
|
+
}
|
|
1914
|
+
function getBlockActionHosts(block, type) {
|
|
1915
|
+
const actions = getSubNodeArray(block, "actions");
|
|
1916
|
+
if (type !== "recordHistory") {
|
|
1917
|
+
return actions;
|
|
1918
|
+
}
|
|
1919
|
+
return actions.filter((action) => !RECORD_HISTORY_GENERATED_ACTION_USES.has(String(action.use || "")));
|
|
1920
|
+
}
|
|
1921
|
+
function buildLayoutFromGrid(ctx, grid, uidToLocalKey, path) {
|
|
1922
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1923
|
+
const rows = import_lodash.default.isPlainObject((_a = grid == null ? void 0 : grid.props) == null ? void 0 : _a.rows) ? (_b = grid == null ? void 0 : grid.props) == null ? void 0 : _b.rows : {};
|
|
1924
|
+
const rowOrder = Array.isArray((_c = grid == null ? void 0 : grid.props) == null ? void 0 : _c.rowOrder) ? ((_d = grid == null ? void 0 : grid.props) == null ? void 0 : _d.rowOrder).map((item) => String(item)).filter(Boolean) : Object.keys(rows);
|
|
1925
|
+
const sizes = import_lodash.default.isPlainObject((_e = grid == null ? void 0 : grid.props) == null ? void 0 : _e.sizes) ? (_f = grid == null ? void 0 : grid.props) == null ? void 0 : _f.sizes : {};
|
|
1926
|
+
if (!rowOrder.length) {
|
|
1927
|
+
return void 0;
|
|
1928
|
+
}
|
|
1929
|
+
const layoutRows = [];
|
|
1930
|
+
for (const rowKey of rowOrder) {
|
|
1931
|
+
const row = Array.isArray(rows[rowKey]) ? rows[rowKey] : [];
|
|
1932
|
+
const rowSizes = Array.isArray(sizes[rowKey]) ? sizes[rowKey] : [];
|
|
1933
|
+
const cells = row.flatMap((cell, cellIndex) => {
|
|
1934
|
+
const uid = Array.isArray(cell) ? readString(cell[0]) : readString(cell);
|
|
1935
|
+
const key = uid ? uidToLocalKey.get(uid) : void 0;
|
|
1936
|
+
if (!key) {
|
|
1937
|
+
recordUnsupported(ctx, {
|
|
1938
|
+
kind: "layout",
|
|
1939
|
+
path: `${path}.${rowKey}[${cellIndex}]`,
|
|
1940
|
+
reasonCode: "unsupported-layout-cell",
|
|
1941
|
+
manualAction: "Recreate this layout manually or add mapper support."
|
|
1942
|
+
});
|
|
1943
|
+
return [];
|
|
1944
|
+
}
|
|
1945
|
+
const span = typeof rowSizes[cellIndex] === "number" ? rowSizes[cellIndex] : void 0;
|
|
1946
|
+
return [span && span !== 24 ? { key, span } : key];
|
|
1947
|
+
});
|
|
1948
|
+
if (cells.length) {
|
|
1949
|
+
layoutRows.push(cells);
|
|
1950
|
+
}
|
|
1951
|
+
}
|
|
1952
|
+
return layoutRows.length ? {
|
|
1953
|
+
rows: layoutRows
|
|
1954
|
+
} : void 0;
|
|
1955
|
+
}
|
|
1956
|
+
function buildAutoLayoutFromKeys(keys) {
|
|
1957
|
+
return {
|
|
1958
|
+
rows: keys.map((key) => [key])
|
|
1959
|
+
};
|
|
1960
|
+
}
|
|
1961
|
+
function exportFieldsLayout(ctx, block, type, fields) {
|
|
1962
|
+
if (!FIELD_GRID_BLOCK_TYPES.has(type)) {
|
|
1963
|
+
return void 0;
|
|
1964
|
+
}
|
|
1965
|
+
const grid = getSubNode(block, "grid");
|
|
1966
|
+
const uidToLocalKey = /* @__PURE__ */ new Map();
|
|
1967
|
+
fields.forEach((field) => {
|
|
1968
|
+
if (field.uid && field.key) {
|
|
1969
|
+
uidToLocalKey.set(field.uid, field.key);
|
|
1970
|
+
}
|
|
1971
|
+
});
|
|
1972
|
+
return buildLayoutFromGrid(ctx, grid, uidToLocalKey, "$.fieldsLayout");
|
|
1973
|
+
}
|
|
1974
|
+
function prefixExportedKey(prefix, key) {
|
|
1975
|
+
return prefix ? `${prefix}.${key}` : key;
|
|
1976
|
+
}
|
|
1977
|
+
function exportBlock(ctx, block, scope, index, path) {
|
|
1978
|
+
const type = import_catalog.BLOCK_KEY_BY_USE.get(String(block.use || ""));
|
|
1979
|
+
if (!type || APPLY_BLUEPRINT_UNSUPPORTED_BLOCK_TYPES.has(type)) {
|
|
1980
|
+
recordUnsupported(ctx, {
|
|
1981
|
+
kind: "block",
|
|
1982
|
+
use: readString(block.use),
|
|
1983
|
+
type,
|
|
1984
|
+
path,
|
|
1985
|
+
reasonCode: "unsupported-node",
|
|
1986
|
+
manualAction: UNSUPPORTED_BLOCK_MANUAL_ACTION
|
|
1987
|
+
});
|
|
1988
|
+
return {};
|
|
1989
|
+
}
|
|
1990
|
+
if (hasUnsupportedTemplateSummary(block)) {
|
|
1991
|
+
recordUnsupported(ctx, {
|
|
1992
|
+
kind: "block",
|
|
1993
|
+
use: readString(block.use),
|
|
1994
|
+
type,
|
|
1995
|
+
path,
|
|
1996
|
+
reasonCode: TEMPLATE_SUMMARY_UNSUPPORTED_REASON,
|
|
1997
|
+
manualAction: templateSummaryManualAction("block")
|
|
1998
|
+
});
|
|
1999
|
+
return {};
|
|
2000
|
+
}
|
|
2001
|
+
if (hasUnsupportedBlockPublicState(block, type)) {
|
|
2002
|
+
recordUnsupported(ctx, {
|
|
2003
|
+
kind: "block",
|
|
2004
|
+
use: readString(block.use),
|
|
2005
|
+
type,
|
|
2006
|
+
path,
|
|
2007
|
+
reasonCode: "unsupported-public-state",
|
|
2008
|
+
manualAction: UNSUPPORTED_BLOCK_MANUAL_ACTION
|
|
2009
|
+
});
|
|
2010
|
+
return {};
|
|
2011
|
+
}
|
|
2012
|
+
const key = dedupeKey(ctx, scope, getDeclaredKey(block, scope.prefix), `${type}_${index + 1}`, `${path}.key`);
|
|
2013
|
+
const childScope = {
|
|
2014
|
+
prefix: scope.prefix ? `${scope.prefix}.${key}` : key,
|
|
2015
|
+
used: /* @__PURE__ */ new Set()
|
|
2016
|
+
};
|
|
2017
|
+
const resourceContext = readBlockResourceContext(block);
|
|
2018
|
+
const fieldHosts = getFieldHosts(block, type);
|
|
2019
|
+
const fieldResults = exportFields(ctx, fieldHosts, childScope, `${path}.fields`);
|
|
2020
|
+
const actionResults = exportActions(
|
|
2021
|
+
ctx,
|
|
2022
|
+
getBlockActionHosts(block, type),
|
|
2023
|
+
childScope,
|
|
2024
|
+
"action",
|
|
2025
|
+
`${path}.actions`,
|
|
2026
|
+
resourceContext
|
|
2027
|
+
);
|
|
2028
|
+
const recordActionResults = exportActions(
|
|
2029
|
+
ctx,
|
|
2030
|
+
getRecordActionHosts(block, type),
|
|
2031
|
+
childScope,
|
|
2032
|
+
"recordAction",
|
|
2033
|
+
`${path}.recordActions`,
|
|
2034
|
+
resourceContext
|
|
2035
|
+
);
|
|
2036
|
+
const fieldsLayout = exportFieldsLayout(ctx, block, type, fieldResults);
|
|
2037
|
+
const fields = fieldResults.map((item) => item.spec);
|
|
2038
|
+
const fieldPaths = import_lodash.default.uniq(fieldResults.flatMap((field) => field.fieldPaths || []));
|
|
2039
|
+
const actions = actionResults.map((item) => item.spec);
|
|
2040
|
+
const recordActions = recordActionResults.map((item) => item.spec);
|
|
2041
|
+
const blockPublicKey = prefixExportedKey(scope.prefix, key);
|
|
2042
|
+
const chartSettings = exportChartBlockSettings(ctx, block, blockPublicKey, path);
|
|
2043
|
+
if (chartSettings === null) {
|
|
2044
|
+
return {};
|
|
2045
|
+
}
|
|
2046
|
+
const descendantKeys = [
|
|
2047
|
+
...fieldResults.flatMap(
|
|
2048
|
+
(item) => item.key ? (item.bindingUids || compactStringValues([item.uid])).map((bindingUid) => ({
|
|
2049
|
+
uid: bindingUid,
|
|
2050
|
+
key: prefixExportedKey(blockPublicKey, item.key),
|
|
2051
|
+
fieldPaths: item.fieldPaths
|
|
2052
|
+
})) : []
|
|
2053
|
+
),
|
|
2054
|
+
...[...actionResults, ...recordActionResults].flatMap(
|
|
2055
|
+
(item) => item.uid && item.key ? [
|
|
2056
|
+
{
|
|
2057
|
+
uid: item.uid,
|
|
2058
|
+
key: prefixExportedKey(blockPublicKey, item.key),
|
|
2059
|
+
fieldPaths
|
|
2060
|
+
}
|
|
2061
|
+
] : []
|
|
2062
|
+
)
|
|
2063
|
+
];
|
|
2064
|
+
const spec = buildDefinedPayload({
|
|
2065
|
+
key,
|
|
2066
|
+
type,
|
|
2067
|
+
...exportBlockResource(block),
|
|
2068
|
+
...exportCardSettings(block),
|
|
2069
|
+
...exportDataBlockSettings(block, type),
|
|
2070
|
+
...exportListBlockSettings(block),
|
|
2071
|
+
...exportGridCardBlockSettings(block),
|
|
2072
|
+
...exportKanbanBlockSettings(block),
|
|
2073
|
+
...exportTreeBlockSettings(block),
|
|
2074
|
+
...exportCalendarBlockSettings(block),
|
|
2075
|
+
...exportActionPanelBlockSettings(block),
|
|
2076
|
+
...exportRecordHistoryBlockSettings(block),
|
|
2077
|
+
...chartSettings,
|
|
2078
|
+
...exportSimpleBlockSettings(block, type),
|
|
2079
|
+
template: exportTemplateSummary(block.template),
|
|
2080
|
+
fields: fields.length ? fields : void 0,
|
|
2081
|
+
fieldsLayout,
|
|
2082
|
+
actions: actions.length ? actions : void 0,
|
|
2083
|
+
recordActions: recordActions.length ? recordActions : void 0
|
|
2084
|
+
});
|
|
2085
|
+
return {
|
|
2086
|
+
spec,
|
|
2087
|
+
uid: block.uid,
|
|
2088
|
+
key,
|
|
2089
|
+
descendantKeys,
|
|
2090
|
+
fieldPaths
|
|
2091
|
+
};
|
|
2092
|
+
}
|
|
2093
|
+
function extractReactionCanonicalRules(node, slot) {
|
|
2094
|
+
const stepRoot = import_lodash.default.get(node, ["stepParams", slot.flowKey, slot.stepKey]);
|
|
2095
|
+
const rawValue = slot.valuePath == null ? stepRoot : import_lodash.default.get(stepRoot, slot.valuePath);
|
|
2096
|
+
return Array.isArray(rawValue) ? import_lodash.default.cloneDeep(rawValue) : [];
|
|
2097
|
+
}
|
|
2098
|
+
function buildReactionFieldPathMaps(node, scene) {
|
|
2099
|
+
const uidToPath = /* @__PURE__ */ new Map();
|
|
2100
|
+
const visit = (current, depth) => {
|
|
2101
|
+
if (!current) {
|
|
2102
|
+
return;
|
|
2103
|
+
}
|
|
2104
|
+
const isSubFormHostRoot = scene === "subForm" && depth === 0 && (current.use === "SubFormFieldModel" || current.use === "SubFormListFieldModel");
|
|
2105
|
+
if (!isSubFormHostRoot) {
|
|
2106
|
+
const init = readFieldInit(current);
|
|
2107
|
+
const fieldPath = readString(init == null ? void 0 : init.fieldPath);
|
|
2108
|
+
if (current.uid && fieldPath && !uidToPath.has(current.uid)) {
|
|
2109
|
+
uidToPath.set(current.uid, fieldPath);
|
|
2110
|
+
}
|
|
2111
|
+
}
|
|
2112
|
+
Object.values(current.subModels || {}).forEach((value) => {
|
|
2113
|
+
castNodeArray(value).forEach((child) => visit(child, depth + 1));
|
|
2114
|
+
});
|
|
2115
|
+
};
|
|
2116
|
+
visit(node, 0);
|
|
2117
|
+
return uidToPath;
|
|
2118
|
+
}
|
|
2119
|
+
function normalizeReactionRules(kind, canonicalRules, node, scene) {
|
|
2120
|
+
if (kind === "fieldValue") {
|
|
2121
|
+
return normalizeFieldValueExportRules(canonicalRules);
|
|
2122
|
+
}
|
|
2123
|
+
if (kind === "blockLinkage") {
|
|
2124
|
+
return (0, import_linkage.normalizeBlockLinkageRules)(canonicalRules);
|
|
2125
|
+
}
|
|
2126
|
+
if (kind === "actionLinkage") {
|
|
2127
|
+
return (0, import_linkage.normalizeActionLinkageRules)(canonicalRules);
|
|
2128
|
+
}
|
|
2129
|
+
const uidToPath = buildReactionFieldPathMaps(node, scene);
|
|
2130
|
+
return (0, import_linkage.normalizeFieldLinkageRules)(canonicalRules, {
|
|
2131
|
+
scene,
|
|
2132
|
+
resolveFieldPath: (fieldUid) => uidToPath.get(String(fieldUid || "").trim())
|
|
2133
|
+
});
|
|
2134
|
+
}
|
|
2135
|
+
function normalizeFieldValueExportRules(canonicalRules) {
|
|
2136
|
+
return (0, import_field_value.normalizeFieldValueRules)(
|
|
2137
|
+
canonicalRules.map((rule) => {
|
|
2138
|
+
if (!import_lodash.default.isPlainObject(rule)) {
|
|
2139
|
+
return rule;
|
|
2140
|
+
}
|
|
2141
|
+
const current = rule;
|
|
2142
|
+
return {
|
|
2143
|
+
...current,
|
|
2144
|
+
enabled: import_lodash.default.isUndefined(current.enabled) ? current.enable : current.enabled,
|
|
2145
|
+
when: import_lodash.default.isUndefined(current.when) ? current.condition : current.when
|
|
2146
|
+
};
|
|
2147
|
+
})
|
|
2148
|
+
);
|
|
2149
|
+
}
|
|
2150
|
+
function compactStringValues(values) {
|
|
2151
|
+
return values.filter((value) => !!value);
|
|
2152
|
+
}
|
|
2153
|
+
function collectSourcePathReferences(value) {
|
|
2154
|
+
if (Array.isArray(value)) {
|
|
2155
|
+
return value.flatMap((item) => collectSourcePathReferences(item));
|
|
2156
|
+
}
|
|
2157
|
+
if (!import_lodash.default.isPlainObject(value)) {
|
|
2158
|
+
return [];
|
|
2159
|
+
}
|
|
2160
|
+
const source = readString(value.source);
|
|
2161
|
+
if (source) {
|
|
2162
|
+
return source === "path" ? compactStringValues([readString(value.path)]) : [];
|
|
2163
|
+
}
|
|
2164
|
+
return Object.values(value).flatMap((item) => collectSourcePathReferences(item));
|
|
2165
|
+
}
|
|
2166
|
+
function collectReactionFilterFieldPaths(filter) {
|
|
2167
|
+
const visit = (node) => {
|
|
2168
|
+
if (Array.isArray(node)) {
|
|
2169
|
+
return node.flatMap((item) => visit(item));
|
|
2170
|
+
}
|
|
2171
|
+
if (!import_lodash.default.isPlainObject(node)) {
|
|
2172
|
+
return [];
|
|
2173
|
+
}
|
|
2174
|
+
const current = node;
|
|
2175
|
+
const source = readString(current.source);
|
|
2176
|
+
if (source) {
|
|
2177
|
+
return source === "path" ? compactStringValues([readString(current.path)]) : [];
|
|
2178
|
+
}
|
|
2179
|
+
const currentPath = readString(current.path);
|
|
2180
|
+
return import_lodash.default.uniq([
|
|
2181
|
+
...currentPath ? [currentPath] : [],
|
|
2182
|
+
...Object.entries(current).flatMap(([key, value]) => key === "path" ? [] : visit(value))
|
|
2183
|
+
]);
|
|
2184
|
+
};
|
|
2185
|
+
return import_lodash.default.uniq(visit(filter));
|
|
2186
|
+
}
|
|
2187
|
+
function collectFieldLinkageReferencedPaths(rule) {
|
|
2188
|
+
return compactStringValues(
|
|
2189
|
+
import_lodash.default.uniq([
|
|
2190
|
+
...collectReactionFilterFieldPaths(rule.when),
|
|
2191
|
+
...(rule.then || []).flatMap((action) => {
|
|
2192
|
+
if (action.type === "setFieldState") {
|
|
2193
|
+
return action.fieldPaths || [];
|
|
2194
|
+
}
|
|
2195
|
+
if (action.type === "assignField" || action.type === "setFieldDefaultValue") {
|
|
2196
|
+
return (action.items || []).flatMap((item) => [
|
|
2197
|
+
item.targetPath,
|
|
2198
|
+
...collectReactionFilterFieldPaths(item.when),
|
|
2199
|
+
...collectSourcePathReferences(item.value)
|
|
2200
|
+
]);
|
|
2201
|
+
}
|
|
2202
|
+
return [];
|
|
2203
|
+
})
|
|
2204
|
+
])
|
|
2205
|
+
);
|
|
2206
|
+
}
|
|
2207
|
+
function collectFieldValueReferencedPaths(rule) {
|
|
2208
|
+
return compactStringValues(
|
|
2209
|
+
import_lodash.default.uniq([
|
|
2210
|
+
rule.targetPath,
|
|
2211
|
+
...collectReactionFilterFieldPaths(rule.when),
|
|
2212
|
+
...collectSourcePathReferences(rule.value)
|
|
2213
|
+
])
|
|
2214
|
+
);
|
|
2215
|
+
}
|
|
2216
|
+
function collectBlockLinkageReferencedPaths(rule) {
|
|
2217
|
+
return collectReactionFilterFieldPaths(rule.when);
|
|
2218
|
+
}
|
|
2219
|
+
function collectActionLinkageReferencedPaths(rule) {
|
|
2220
|
+
return collectReactionFilterFieldPaths(rule.when);
|
|
2221
|
+
}
|
|
2222
|
+
function shouldCheckExportedFieldPath(path) {
|
|
2223
|
+
const [root] = String(path || "").trim().split(".").filter(Boolean);
|
|
2224
|
+
if (!root) {
|
|
2225
|
+
return false;
|
|
2226
|
+
}
|
|
2227
|
+
return !REACTION_CONTEXT_SCALAR_PATHS.has(root) && !REACTION_CONTEXT_ROOT_PATHS.has(root);
|
|
2228
|
+
}
|
|
2229
|
+
function filterUnavailableReactionFieldReferenceRules(ctx, rules, targetKey, exportedFieldPaths, collectReferencedPaths) {
|
|
2230
|
+
if (!exportedFieldPaths) {
|
|
2231
|
+
return rules;
|
|
2232
|
+
}
|
|
2233
|
+
const filtered = rules.filter(
|
|
2234
|
+
(rule) => collectReferencedPaths(rule).filter(shouldCheckExportedFieldPath).every((fieldPath) => exportedFieldPaths.has(fieldPath))
|
|
2235
|
+
);
|
|
2236
|
+
if (filtered.length !== rules.length) {
|
|
2237
|
+
recordUnsupported(ctx, {
|
|
2238
|
+
kind: "reaction",
|
|
2239
|
+
path: `$.reaction.${targetKey}`,
|
|
2240
|
+
reasonCode: "unsupported-reaction-target-field",
|
|
2241
|
+
manualAction: "Recreate reaction rules that reference skipped fields manually or add mapper support."
|
|
2242
|
+
});
|
|
2243
|
+
}
|
|
2244
|
+
return filtered;
|
|
2245
|
+
}
|
|
2246
|
+
function filterUnavailableFieldLinkageRules(ctx, rules, targetKey, exportedFieldPaths) {
|
|
2247
|
+
return filterUnavailableReactionFieldReferenceRules(
|
|
2248
|
+
ctx,
|
|
2249
|
+
rules,
|
|
2250
|
+
targetKey,
|
|
2251
|
+
exportedFieldPaths,
|
|
2252
|
+
collectFieldLinkageReferencedPaths
|
|
2253
|
+
);
|
|
2254
|
+
}
|
|
2255
|
+
function filterUnavailableFieldValueRules(ctx, rules, targetKey, exportedFieldPaths) {
|
|
2256
|
+
return filterUnavailableReactionFieldReferenceRules(
|
|
2257
|
+
ctx,
|
|
2258
|
+
rules,
|
|
2259
|
+
targetKey,
|
|
2260
|
+
exportedFieldPaths,
|
|
2261
|
+
collectFieldValueReferencedPaths
|
|
2262
|
+
);
|
|
2263
|
+
}
|
|
2264
|
+
function filterUnavailableReactionRules(ctx, kind, rules, targetKey, exportedFieldPaths) {
|
|
2265
|
+
if (kind === "fieldValue") {
|
|
2266
|
+
return filterUnavailableFieldValueRules(ctx, rules, targetKey, exportedFieldPaths);
|
|
2267
|
+
}
|
|
2268
|
+
if (kind === "fieldLinkage") {
|
|
2269
|
+
return filterUnavailableFieldLinkageRules(
|
|
2270
|
+
ctx,
|
|
2271
|
+
rules,
|
|
2272
|
+
targetKey,
|
|
2273
|
+
exportedFieldPaths
|
|
2274
|
+
);
|
|
2275
|
+
}
|
|
2276
|
+
if (kind === "blockLinkage") {
|
|
2277
|
+
return filterUnavailableReactionFieldReferenceRules(
|
|
2278
|
+
ctx,
|
|
2279
|
+
rules,
|
|
2280
|
+
targetKey,
|
|
2281
|
+
exportedFieldPaths,
|
|
2282
|
+
collectBlockLinkageReferencedPaths
|
|
2283
|
+
);
|
|
2284
|
+
}
|
|
2285
|
+
if (kind === "actionLinkage") {
|
|
2286
|
+
return filterUnavailableReactionFieldReferenceRules(
|
|
2287
|
+
ctx,
|
|
2288
|
+
rules,
|
|
2289
|
+
targetKey,
|
|
2290
|
+
exportedFieldPaths,
|
|
2291
|
+
collectActionLinkageReferencedPaths
|
|
2292
|
+
);
|
|
2293
|
+
}
|
|
2294
|
+
return rules;
|
|
2295
|
+
}
|
|
2296
|
+
function exportReactionItems(ctx, root, keyByUid, fieldPathsByTargetKey) {
|
|
2297
|
+
const items = [];
|
|
2298
|
+
const visit = (node) => {
|
|
2299
|
+
if (!(node == null ? void 0 : node.uid)) {
|
|
2300
|
+
return;
|
|
2301
|
+
}
|
|
2302
|
+
const targetKey = keyByUid.get(node.uid);
|
|
2303
|
+
if (targetKey && (0, import_registry.getReactionKindsForUse)(node.use).length) {
|
|
2304
|
+
try {
|
|
2305
|
+
const resolvedTarget = (0, import_resolver.resolveReactionTarget)({
|
|
2306
|
+
target: {
|
|
2307
|
+
uid: node.uid
|
|
2308
|
+
},
|
|
2309
|
+
node,
|
|
2310
|
+
use: node.use
|
|
2311
|
+
});
|
|
2312
|
+
for (const capability of resolvedTarget.capabilities) {
|
|
2313
|
+
const resolvedCapability = (0, import_resolver.resolveReactionCapability)(resolvedTarget, capability.kind);
|
|
2314
|
+
const storageNode = (0, import_resolver.resolveReactionStorageNode)(resolvedTarget, resolvedCapability);
|
|
2315
|
+
const canonicalRules = extractReactionCanonicalRules(storageNode, resolvedCapability.resolvedSlot);
|
|
2316
|
+
if (!canonicalRules.length) {
|
|
2317
|
+
continue;
|
|
2318
|
+
}
|
|
2319
|
+
const normalizedRules = normalizeReactionRules(
|
|
2320
|
+
capability.kind,
|
|
2321
|
+
canonicalRules,
|
|
2322
|
+
node,
|
|
2323
|
+
resolvedCapability.resolvedScene
|
|
2324
|
+
);
|
|
2325
|
+
const rules = filterUnavailableReactionRules(
|
|
2326
|
+
ctx,
|
|
2327
|
+
capability.kind,
|
|
2328
|
+
normalizedRules,
|
|
2329
|
+
targetKey,
|
|
2330
|
+
fieldPathsByTargetKey.get(targetKey)
|
|
2331
|
+
);
|
|
2332
|
+
if (!rules.length) {
|
|
2333
|
+
continue;
|
|
2334
|
+
}
|
|
2335
|
+
items.push({
|
|
2336
|
+
type: REACTION_KIND_TO_BLUEPRINT_TYPE[capability.kind],
|
|
2337
|
+
target: targetKey,
|
|
2338
|
+
rules
|
|
2339
|
+
});
|
|
2340
|
+
}
|
|
2341
|
+
} catch (error) {
|
|
2342
|
+
recordUnsupported(ctx, {
|
|
2343
|
+
kind: "reaction",
|
|
2344
|
+
use: readString(node.use),
|
|
2345
|
+
path: `$.reaction.${targetKey}`,
|
|
2346
|
+
reasonCode: "unsupported-reaction",
|
|
2347
|
+
manualAction: "Recreate these reaction rules manually or add mapper support."
|
|
2348
|
+
});
|
|
2349
|
+
}
|
|
2350
|
+
}
|
|
2351
|
+
Object.values(node.subModels || {}).forEach((value) => {
|
|
2352
|
+
castNodeArray(value).forEach((child) => visit(child));
|
|
2353
|
+
});
|
|
2354
|
+
};
|
|
2355
|
+
visit(root);
|
|
2356
|
+
return items.length ? { items } : void 0;
|
|
2357
|
+
}
|
|
2358
|
+
function exportTab(ctx, tab, index, keyByUid, fieldPathsByTargetKey) {
|
|
2359
|
+
if (hasNonEmptyPlainObject(tab.flowRegistry)) {
|
|
2360
|
+
recordUnsupported(ctx, {
|
|
2361
|
+
kind: "tab",
|
|
2362
|
+
use: readString(tab.use),
|
|
2363
|
+
path: `$.tabs[${index}].flowRegistry`,
|
|
2364
|
+
reasonCode: FLOW_REGISTRY_UNSUPPORTED_REASON,
|
|
2365
|
+
manualAction: "Recreate these event flows manually or add mapper support."
|
|
2366
|
+
});
|
|
2367
|
+
return void 0;
|
|
2368
|
+
}
|
|
2369
|
+
const tabScope = {
|
|
2370
|
+
prefix: "",
|
|
2371
|
+
used: /* @__PURE__ */ new Set()
|
|
2372
|
+
};
|
|
2373
|
+
const tabKey = dedupeKey(
|
|
2374
|
+
ctx,
|
|
2375
|
+
tabScope,
|
|
2376
|
+
getDeclaredKey(tab, "") || inferTabDeclaredKeyFromChildren(tab),
|
|
2377
|
+
`tab_${index + 1}`,
|
|
2378
|
+
`$.tabs[${index}].key`
|
|
2379
|
+
);
|
|
2380
|
+
const blockScope = {
|
|
2381
|
+
prefix: tabKey,
|
|
2382
|
+
used: /* @__PURE__ */ new Set()
|
|
2383
|
+
};
|
|
2384
|
+
const grid = getSubNode(tab, "grid");
|
|
2385
|
+
if (hasNonEmptyPlainObject(grid == null ? void 0 : grid.flowRegistry)) {
|
|
2386
|
+
recordUnsupported(ctx, {
|
|
2387
|
+
kind: "layout",
|
|
2388
|
+
use: readString(grid == null ? void 0 : grid.use),
|
|
2389
|
+
path: `$.tabs[${index}].grid.flowRegistry`,
|
|
2390
|
+
reasonCode: FLOW_REGISTRY_UNSUPPORTED_REASON,
|
|
2391
|
+
manualAction: "Recreate these event flows manually or add mapper support."
|
|
2392
|
+
});
|
|
2393
|
+
return void 0;
|
|
2394
|
+
}
|
|
2395
|
+
const blockResults = getSubNodeArray(grid, "items").map(
|
|
2396
|
+
(block, blockIndex) => exportBlock(ctx, block, blockScope, blockIndex, `$.tabs[${index}].blocks[${blockIndex}]`)
|
|
2397
|
+
);
|
|
2398
|
+
const blocks = blockResults.flatMap((item) => item.spec ? [item.spec] : []);
|
|
2399
|
+
blockResults.forEach((item) => {
|
|
2400
|
+
var _a;
|
|
2401
|
+
if (item.uid && item.key) {
|
|
2402
|
+
keyByUid.set(item.uid, `${tabKey}.${item.key}`);
|
|
2403
|
+
fieldPathsByTargetKey.set(`${tabKey}.${item.key}`, new Set(item.fieldPaths || []));
|
|
2404
|
+
}
|
|
2405
|
+
(_a = item.descendantKeys) == null ? void 0 : _a.forEach((binding) => {
|
|
2406
|
+
var _a2;
|
|
2407
|
+
keyByUid.set(binding.uid, binding.key);
|
|
2408
|
+
if ((_a2 = binding.fieldPaths) == null ? void 0 : _a2.length) {
|
|
2409
|
+
fieldPathsByTargetKey.set(binding.key, new Set(binding.fieldPaths));
|
|
2410
|
+
}
|
|
2411
|
+
});
|
|
2412
|
+
});
|
|
2413
|
+
const uidToLocalKey = /* @__PURE__ */ new Map();
|
|
2414
|
+
blockResults.forEach((item) => {
|
|
2415
|
+
if (item.uid && item.key) {
|
|
2416
|
+
uidToLocalKey.set(item.uid, item.key);
|
|
2417
|
+
}
|
|
2418
|
+
});
|
|
2419
|
+
const layout = buildLayoutFromGrid(ctx, grid, uidToLocalKey, `$.tabs[${index}].layout`);
|
|
2420
|
+
if (!blocks.length) {
|
|
2421
|
+
recordUnsupported(ctx, {
|
|
2422
|
+
kind: "tab",
|
|
2423
|
+
use: readString(tab.use),
|
|
2424
|
+
path: `$.tabs[${index}]`,
|
|
2425
|
+
reasonCode: "empty-tab",
|
|
2426
|
+
manualAction: "Add at least one supported block before exporting this tab."
|
|
2427
|
+
});
|
|
2428
|
+
return void 0;
|
|
2429
|
+
}
|
|
2430
|
+
return buildDefinedPayload({
|
|
2431
|
+
key: tabKey,
|
|
2432
|
+
...exportTabChrome(tab),
|
|
2433
|
+
blocks,
|
|
2434
|
+
layout: layout || buildAutoLayoutFromKeys(blocks.map((block) => block.key).filter(Boolean))
|
|
2435
|
+
});
|
|
2436
|
+
}
|
|
2437
|
+
function exportFlowSurfaceBlueprintDocument(input) {
|
|
2438
|
+
const ctx = {
|
|
2439
|
+
unsupportedPolicy: input.unsupportedPolicy || "error",
|
|
2440
|
+
warnings: [],
|
|
2441
|
+
unsupported: [],
|
|
2442
|
+
chartAssets: {}
|
|
2443
|
+
};
|
|
2444
|
+
const keyByUid = /* @__PURE__ */ new Map();
|
|
2445
|
+
const fieldPathsByTargetKey = /* @__PURE__ */ new Map();
|
|
2446
|
+
const tabs = getSubNodeArray(input.page, "tabs").flatMap((tab, index) => {
|
|
2447
|
+
const exportedTab = exportTab(ctx, tab, index, keyByUid, fieldPathsByTargetKey);
|
|
2448
|
+
return exportedTab ? [exportedTab] : [];
|
|
2449
|
+
});
|
|
2450
|
+
if (!tabs.length) {
|
|
2451
|
+
recordUnsupported(ctx, {
|
|
2452
|
+
kind: "page",
|
|
2453
|
+
use: readString(input.page.use),
|
|
2454
|
+
path: "$.tabs",
|
|
2455
|
+
reasonCode: "empty-page",
|
|
2456
|
+
manualAction: "Add at least one supported tab before exporting this page."
|
|
2457
|
+
});
|
|
2458
|
+
}
|
|
2459
|
+
const page = exportPage(ctx, input.page, input.pageRoute);
|
|
2460
|
+
if (tabs.length === 1 && (page == null ? void 0 : page.enableTabs) === true) {
|
|
2461
|
+
recordUnsupported(ctx, {
|
|
2462
|
+
kind: "page",
|
|
2463
|
+
use: readString(input.page.use),
|
|
2464
|
+
path: "$.page.enableTabs",
|
|
2465
|
+
reasonCode: "unsupported-single-tab-enable-tabs",
|
|
2466
|
+
manualAction: "Disable page tabs for single-tab pages or add replace schema support for single-tab tab chrome."
|
|
2467
|
+
});
|
|
2468
|
+
}
|
|
2469
|
+
const reaction = exportReactionItems(ctx, input.page, keyByUid, fieldPathsByTargetKey);
|
|
2470
|
+
assertNoUnsupported(ctx);
|
|
2471
|
+
if (!tabs.length) {
|
|
2472
|
+
(0, import_errors.throwBadRequest)(`flowSurfaces exportBlueprint cannot export a page without at least one supported tab`);
|
|
2473
|
+
}
|
|
2474
|
+
const document = {
|
|
2475
|
+
version: "1",
|
|
2476
|
+
mode: "replace",
|
|
2477
|
+
target: {
|
|
2478
|
+
pageSchemaUid: input.target.pageSchemaUid
|
|
2479
|
+
},
|
|
2480
|
+
...Object.keys(page || {}).length ? { page } : {},
|
|
2481
|
+
tabs,
|
|
2482
|
+
assets: {
|
|
2483
|
+
scripts: {},
|
|
2484
|
+
charts: ctx.chartAssets
|
|
2485
|
+
},
|
|
2486
|
+
...reaction ? { reaction } : {}
|
|
2487
|
+
};
|
|
2488
|
+
return {
|
|
2489
|
+
document,
|
|
2490
|
+
source: {
|
|
2491
|
+
target: {
|
|
2492
|
+
pageSchemaUid: input.target.pageSchemaUid
|
|
2493
|
+
},
|
|
2494
|
+
pageTitle: readPageTitle(input.page)
|
|
2495
|
+
},
|
|
2496
|
+
warnings: ctx.warnings,
|
|
2497
|
+
unsupported: ctx.unsupported
|
|
2498
|
+
};
|
|
2499
|
+
}
|
|
2500
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
2501
|
+
0 && (module.exports = {
|
|
2502
|
+
exportFlowSurfaceBlueprintDocument
|
|
2503
|
+
});
|