@next-core/editor-bricks-helper 0.33.2-alpha.7 → 0.33.4
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/CHANGELOG.md +133 -10
- package/dist/index.bundle.js +178 -135
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +178 -135
- package/dist/index.esm.js.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,43 +3,166 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [0.33.
|
|
6
|
+
## [0.33.4](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.33.3...@next-core/editor-bricks-helper@0.33.4) (2021-12-29)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [0.33.3](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.33.2...@next-core/editor-bricks-helper@0.33.3) (2021-12-28)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [0.33.2](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.33.1...@next-core/editor-bricks-helper@0.33.2) (2021-12-28)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## [0.33.1](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.33.0...@next-core/editor-bricks-helper@0.33.1) (2021-12-24)
|
|
31
|
+
|
|
32
|
+
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
# [0.33.0](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.32.36...@next-core/editor-bricks-helper@0.33.0) (2021-12-23)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### Features
|
|
42
|
+
|
|
43
|
+
* display brick alias/id/dataset.testid/brick.name in order ([3645841](https://github.com/easyops-cn/next-core/commit/3645841ccf12f8ca3fe74f673a541ec75ff45d1c))
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
## [0.32.36](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.32.35...@next-core/editor-bricks-helper@0.32.36) (2021-12-17)
|
|
50
|
+
|
|
51
|
+
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
## [0.32.35](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.32.34...@next-core/editor-bricks-helper@0.32.35) (2021-12-15)
|
|
58
|
+
|
|
59
|
+
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
60
|
+
|
|
61
|
+
## [0.32.34](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.32.33...@next-core/editor-bricks-helper@0.32.34) (2021-12-06)
|
|
62
|
+
|
|
63
|
+
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
64
|
+
|
|
65
|
+
## [0.32.33](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.32.32...@next-core/editor-bricks-helper@0.32.33) (2021-12-06)
|
|
66
|
+
|
|
67
|
+
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
68
|
+
|
|
69
|
+
## [0.32.32](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.32.31...@next-core/editor-bricks-helper@0.32.32) (2021-12-05)
|
|
70
|
+
|
|
71
|
+
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
72
|
+
|
|
73
|
+
## [0.32.31](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.32.30...@next-core/editor-bricks-helper@0.32.31) (2021-12-03)
|
|
74
|
+
|
|
75
|
+
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
76
|
+
|
|
77
|
+
## [0.32.30](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.32.29...@next-core/editor-bricks-helper@0.32.30) (2021-12-03)
|
|
78
|
+
|
|
79
|
+
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
80
|
+
|
|
81
|
+
## [0.32.29](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.32.28...@next-core/editor-bricks-helper@0.32.29) (2021-12-01)
|
|
82
|
+
|
|
83
|
+
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
84
|
+
|
|
85
|
+
## [0.32.28](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.32.27...@next-core/editor-bricks-helper@0.32.28) (2021-11-29)
|
|
86
|
+
|
|
87
|
+
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
88
|
+
|
|
89
|
+
## [0.32.27](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.32.26...@next-core/editor-bricks-helper@0.32.27) (2021-11-26)
|
|
90
|
+
|
|
91
|
+
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
92
|
+
|
|
93
|
+
## [0.32.26](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.32.25...@next-core/editor-bricks-helper@0.32.26) (2021-11-25)
|
|
94
|
+
|
|
95
|
+
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
96
|
+
|
|
97
|
+
## [0.32.25](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.32.24...@next-core/editor-bricks-helper@0.32.25) (2021-11-25)
|
|
98
|
+
|
|
99
|
+
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
100
|
+
|
|
101
|
+
## [0.32.24](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.32.23...@next-core/editor-bricks-helper@0.32.24) (2021-11-25)
|
|
102
|
+
|
|
103
|
+
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
104
|
+
|
|
105
|
+
## [0.32.23](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.32.22...@next-core/editor-bricks-helper@0.32.23) (2021-11-25)
|
|
106
|
+
|
|
107
|
+
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
108
|
+
|
|
109
|
+
## [0.32.22](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.32.21...@next-core/editor-bricks-helper@0.32.22) (2021-11-23)
|
|
110
|
+
|
|
111
|
+
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
112
|
+
|
|
113
|
+
## [0.32.21](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.32.20...@next-core/editor-bricks-helper@0.32.21) (2021-11-23)
|
|
114
|
+
|
|
115
|
+
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
116
|
+
|
|
117
|
+
## [0.32.20](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.32.19...@next-core/editor-bricks-helper@0.32.20) (2021-11-23)
|
|
118
|
+
|
|
119
|
+
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
120
|
+
|
|
121
|
+
## [0.32.19](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.32.18...@next-core/editor-bricks-helper@0.32.19) (2021-11-18)
|
|
122
|
+
|
|
123
|
+
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
124
|
+
|
|
125
|
+
## [0.32.18](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.32.17...@next-core/editor-bricks-helper@0.32.18) (2021-11-18)
|
|
126
|
+
|
|
127
|
+
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
128
|
+
|
|
129
|
+
## [0.32.17](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.32.16...@next-core/editor-bricks-helper@0.32.17) (2021-11-12)
|
|
130
|
+
|
|
131
|
+
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
132
|
+
|
|
133
|
+
## [0.32.16](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.32.15...@next-core/editor-bricks-helper@0.32.16) (2021-11-12)
|
|
11
134
|
|
|
12
135
|
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
13
136
|
|
|
14
|
-
## [0.
|
|
137
|
+
## [0.32.15](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.32.14...@next-core/editor-bricks-helper@0.32.15) (2021-11-11)
|
|
15
138
|
|
|
16
139
|
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
17
140
|
|
|
18
|
-
## [0.
|
|
141
|
+
## [0.32.14](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.32.13...@next-core/editor-bricks-helper@0.32.14) (2021-11-10)
|
|
19
142
|
|
|
20
143
|
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
21
144
|
|
|
22
|
-
## [0.
|
|
145
|
+
## [0.32.13](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.32.12...@next-core/editor-bricks-helper@0.32.13) (2021-11-09)
|
|
23
146
|
|
|
24
147
|
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
25
148
|
|
|
26
|
-
## [0.
|
|
149
|
+
## [0.32.12](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.32.11...@next-core/editor-bricks-helper@0.32.12) (2021-11-08)
|
|
27
150
|
|
|
28
151
|
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
29
152
|
|
|
30
|
-
## [0.
|
|
153
|
+
## [0.32.11](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.32.10...@next-core/editor-bricks-helper@0.32.11) (2021-11-08)
|
|
31
154
|
|
|
32
155
|
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
33
156
|
|
|
34
|
-
## [0.
|
|
157
|
+
## [0.32.10](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.32.9...@next-core/editor-bricks-helper@0.32.10) (2021-11-08)
|
|
35
158
|
|
|
36
159
|
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
37
160
|
|
|
38
|
-
## [0.
|
|
161
|
+
## [0.32.9](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.32.8...@next-core/editor-bricks-helper@0.32.9) (2021-11-04)
|
|
39
162
|
|
|
40
163
|
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
41
164
|
|
|
42
|
-
|
|
165
|
+
## [0.32.8](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.32.7...@next-core/editor-bricks-helper@0.32.8) (2021-11-04)
|
|
43
166
|
|
|
44
167
|
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
45
168
|
|
package/dist/index.bundle.js
CHANGED
|
@@ -182,12 +182,13 @@
|
|
|
182
182
|
return uniqueIdCursor += 1;
|
|
183
183
|
}
|
|
184
184
|
|
|
185
|
-
function expandTemplateEdges({
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
185
|
+
function expandTemplateEdges(_ref) {
|
|
186
|
+
var {
|
|
187
|
+
nodes,
|
|
188
|
+
// Here expanded edges should be excluded.
|
|
189
|
+
edges,
|
|
190
|
+
rootId
|
|
191
|
+
} = _ref;
|
|
191
192
|
var newEdges = edges.slice();
|
|
192
193
|
var reorderedEdgesMap = new WeakMap();
|
|
193
194
|
|
|
@@ -265,14 +266,16 @@
|
|
|
265
266
|
return edges;
|
|
266
267
|
}
|
|
267
268
|
|
|
268
|
-
function reorderBuilderEdges({
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
269
|
+
function reorderBuilderEdges(_ref, _ref2) {
|
|
270
|
+
var {
|
|
271
|
+
rootId,
|
|
272
|
+
nodes,
|
|
273
|
+
edges
|
|
274
|
+
} = _ref;
|
|
275
|
+
var {
|
|
276
|
+
parentUid,
|
|
277
|
+
nodeUids
|
|
278
|
+
} = _ref2;
|
|
276
279
|
// When we do edge-reordering, we simply remove existed
|
|
277
280
|
// expanded edges and re-expand them.
|
|
278
281
|
var edgesExcludeExpanded = edges.filter(edge => !edge.$$isTemplateExpanded);
|
|
@@ -289,11 +292,12 @@
|
|
|
289
292
|
});
|
|
290
293
|
}
|
|
291
294
|
|
|
292
|
-
function deleteNodeFromTree(nodeUid, {
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
295
|
+
function deleteNodeFromTree(nodeUid, _ref) {
|
|
296
|
+
var {
|
|
297
|
+
rootId,
|
|
298
|
+
nodes,
|
|
299
|
+
edges
|
|
300
|
+
} = _ref;
|
|
297
301
|
var idsToDelete = new Set();
|
|
298
302
|
collectIdsToDelete(nodeUid, edges, idsToDelete);
|
|
299
303
|
return {
|
|
@@ -350,7 +354,9 @@
|
|
|
350
354
|
}
|
|
351
355
|
|
|
352
356
|
if (!lodash.isEmpty(node.$$parsedLifeCycle)) {
|
|
353
|
-
handlers = handlers.concat(Object.entries(node.$$parsedLifeCycle).flatMap(
|
|
357
|
+
handlers = handlers.concat(Object.entries(node.$$parsedLifeCycle).flatMap(_ref => {
|
|
358
|
+
var [lifeCycleName, lifeCycleConf] = _ref;
|
|
359
|
+
|
|
354
360
|
switch (lifeCycleName) {
|
|
355
361
|
case "onBeforePageLoad":
|
|
356
362
|
case "onPageLoad":
|
|
@@ -408,10 +414,11 @@
|
|
|
408
414
|
}
|
|
409
415
|
}
|
|
410
416
|
|
|
411
|
-
var nodeIgnoreFields = ["parent", "children", "graphInfo", "mountPoint"];
|
|
412
|
-
|
|
413
|
-
var _nodeData$alias;
|
|
417
|
+
var nodeIgnoreFields = ["parent", "children", "graphInfo", "mountPoint"]; // Match evaluations and placeholders,
|
|
418
|
+
// E.g.: `<% QUERY.x %>` or `${QUERY.x}`.
|
|
414
419
|
|
|
420
|
+
var computationRegExp = /[<{]/;
|
|
421
|
+
function getBuilderNode(nodeData, nodeUid, isTemplateInternalNode) {
|
|
415
422
|
var matchedSelectors = [];
|
|
416
423
|
|
|
417
424
|
if (nodeData.brick) {
|
|
@@ -421,22 +428,33 @@
|
|
|
421
428
|
var normalized = brickUtils.normalizeBuilderNode(nodeData);
|
|
422
429
|
var jsonFieldsInBrick = ["properties", "events", "lifeCycle"];
|
|
423
430
|
var parsedFields = [];
|
|
431
|
+
var parsedId;
|
|
432
|
+
var parsedTestId;
|
|
424
433
|
|
|
425
434
|
for (var field of jsonFieldsInBrick) {
|
|
426
435
|
var parsed = lodash.cloneDeep(normalized === null || normalized === void 0 ? void 0 : normalized[field]);
|
|
427
436
|
parsedFields.push(["$$parsed".concat(lodash.upperFirst(field)), parsed !== null && parsed !== void 0 ? parsed : {}]);
|
|
428
437
|
|
|
429
|
-
if (field === "properties"
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
438
|
+
if (field === "properties") {
|
|
439
|
+
var _parsed$dataset;
|
|
440
|
+
|
|
441
|
+
var tempParsedId = void 0;
|
|
442
|
+
var tempParsedTestId = void 0;
|
|
443
|
+
|
|
444
|
+
if ((tempParsedId = parsed === null || parsed === void 0 ? void 0 : parsed.id, typeof tempParsedId === "string") && !computationRegExp.test(tempParsedId)) {
|
|
445
|
+
parsedId = tempParsedId;
|
|
446
|
+
matchedSelectors.push("#".concat(parsedId));
|
|
447
|
+
} else if ((tempParsedTestId = parsed === null || parsed === void 0 ? void 0 : (_parsed$dataset = parsed.dataset) === null || _parsed$dataset === void 0 ? void 0 : _parsed$dataset.testid, typeof tempParsedTestId === "string") && !computationRegExp.test(tempParsedTestId)) {
|
|
448
|
+
parsedTestId = tempParsedTestId;
|
|
449
|
+
}
|
|
433
450
|
}
|
|
434
451
|
}
|
|
435
452
|
|
|
436
|
-
return Object.fromEntries(Object.entries(nodeData).filter(entry => !nodeIgnoreFields.includes(entry[0])).concat([["alias",
|
|
453
|
+
return Object.fromEntries(Object.entries(nodeData).filter(entry => !nodeIgnoreFields.includes(entry[0])).concat([["alias", nodeData.alias || (brickUtils.isBrickNode(nodeData) ? parsedId || parsedTestId || nodeData.brick.split(".").pop() : undefined)], ["$$uid", nodeUid], ["$$matchedSelectors", matchedSelectors], ["$$isTemplateInternalNode", isTemplateInternalNode], ["$$normalized", normalized]]).concat(parsedFields));
|
|
437
454
|
}
|
|
438
455
|
|
|
439
|
-
function getAppendingNodesAndEdges(nodeData, nodeUid, templateSourceMap
|
|
456
|
+
function getAppendingNodesAndEdges(nodeData, nodeUid, templateSourceMap) {
|
|
457
|
+
var storyList = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
440
458
|
var nodes = [];
|
|
441
459
|
var edges = [];
|
|
442
460
|
|
|
@@ -835,12 +853,13 @@
|
|
|
835
853
|
var newNodes = nodes.slice();
|
|
836
854
|
var newEdges = edges.slice();
|
|
837
855
|
|
|
838
|
-
var walk =
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
856
|
+
var walk = _ref => {
|
|
857
|
+
var {
|
|
858
|
+
parentUid,
|
|
859
|
+
nodeUid,
|
|
860
|
+
nodeData,
|
|
861
|
+
children
|
|
862
|
+
} = _ref;
|
|
844
863
|
var {
|
|
845
864
|
nodes: appendingNodes,
|
|
846
865
|
edges: appendingEdges
|
|
@@ -1161,10 +1180,11 @@
|
|
|
1161
1180
|
return data;
|
|
1162
1181
|
}
|
|
1163
1182
|
|
|
1164
|
-
function useBuilderNode({
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1183
|
+
function useBuilderNode(_ref) {
|
|
1184
|
+
var {
|
|
1185
|
+
nodeUid,
|
|
1186
|
+
isRoot
|
|
1187
|
+
} = _ref;
|
|
1168
1188
|
var {
|
|
1169
1189
|
rootId,
|
|
1170
1190
|
nodes
|
|
@@ -1272,16 +1292,17 @@
|
|
|
1272
1292
|
return droppingStatus;
|
|
1273
1293
|
}
|
|
1274
1294
|
|
|
1275
|
-
function EditorContainer({
|
|
1276
|
-
nodeUid,
|
|
1277
|
-
type,
|
|
1278
|
-
isTransparentContainer,
|
|
1279
|
-
editorContainerStyle,
|
|
1280
|
-
editorBodyStyle,
|
|
1281
|
-
children
|
|
1282
|
-
}) {
|
|
1295
|
+
function EditorContainer(_ref) {
|
|
1283
1296
|
var _droppingStatus$get$v, _droppingStatus$get;
|
|
1284
1297
|
|
|
1298
|
+
var {
|
|
1299
|
+
nodeUid,
|
|
1300
|
+
type,
|
|
1301
|
+
isTransparentContainer,
|
|
1302
|
+
editorContainerStyle,
|
|
1303
|
+
editorBodyStyle,
|
|
1304
|
+
children
|
|
1305
|
+
} = _ref;
|
|
1285
1306
|
var editorContainerRef = React.useRef();
|
|
1286
1307
|
var highlightNodes = useHighlightNodes();
|
|
1287
1308
|
var node = useBuilderNode({
|
|
@@ -1483,10 +1504,11 @@
|
|
|
1483
1504
|
var styles$2 = {"slotContentLayoutBlock":"EditorBrickAsComponent--slotContentLayoutBlock--1aed4lu","selfLayoutBlock":"EditorBrickAsComponent--selfLayoutBlock--1aed4lu","selfLayoutContainer":"EditorBrickAsComponent--selfLayoutContainer--1aed4lu","slotContentLayoutInline":"EditorBrickAsComponent--slotContentLayoutInline--1aed4lu","selfLayoutInline":"EditorBrickAsComponent--selfLayoutInline--1aed4lu","dragging":"EditorBrickAsComponent--dragging--1aed4lu","baseView":"EditorBrickAsComponent--baseView--1aed4lu"};
|
|
1484
1505
|
styleInject(css_248z$2);
|
|
1485
1506
|
|
|
1486
|
-
function EditorBrickAsComponent({
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1507
|
+
function EditorBrickAsComponent(_ref) {
|
|
1508
|
+
var {
|
|
1509
|
+
node,
|
|
1510
|
+
slotContentLayout
|
|
1511
|
+
} = _ref;
|
|
1490
1512
|
var [initialized, setInitialized] = React__default["default"].useState(false);
|
|
1491
1513
|
var [editorBrick, setEditorBrick] = React__default["default"].useState();
|
|
1492
1514
|
var [loadEditorError, setLoadEditorError] = React__default["default"].useState();
|
|
@@ -1576,11 +1598,12 @@
|
|
|
1576
1598
|
}))) : /*#__PURE__*/React__default["default"].createElement("span", null, loadEditorError) : /*#__PURE__*/React__default["default"].createElement("span", null, "Loading...");
|
|
1577
1599
|
}
|
|
1578
1600
|
|
|
1579
|
-
function useBuilderGroupedChildNodes({
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1601
|
+
function useBuilderGroupedChildNodes(_ref) {
|
|
1602
|
+
var {
|
|
1603
|
+
nodeUid,
|
|
1604
|
+
isRoot,
|
|
1605
|
+
doNotExpandTemplates
|
|
1606
|
+
} = _ref;
|
|
1584
1607
|
var {
|
|
1585
1608
|
rootId,
|
|
1586
1609
|
nodes,
|
|
@@ -1593,12 +1616,13 @@
|
|
|
1593
1616
|
doNotExpandTemplates
|
|
1594
1617
|
}), [doNotExpandTemplates, edges, isRoot, nodeUid, nodes, rootId]);
|
|
1595
1618
|
}
|
|
1596
|
-
function getBuilderGroupedChildNodes({
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1619
|
+
function getBuilderGroupedChildNodes(_ref2) {
|
|
1620
|
+
var {
|
|
1621
|
+
nodeUid,
|
|
1622
|
+
nodes,
|
|
1623
|
+
edges,
|
|
1624
|
+
doNotExpandTemplates
|
|
1625
|
+
} = _ref2;
|
|
1602
1626
|
var groups = new Map();
|
|
1603
1627
|
var relatedEdges = lodash.sortBy(edges.filter(edge => edge.parent === nodeUid && (doNotExpandTemplates ? !edge.$$isTemplateInternal : !edge.$$isTemplateDelegated)), [edge => edge.sort]);
|
|
1604
1628
|
|
|
@@ -1616,10 +1640,13 @@
|
|
|
1616
1640
|
_loop(edge);
|
|
1617
1641
|
}
|
|
1618
1642
|
|
|
1619
|
-
return Array.from(groups.entries()).map(
|
|
1620
|
-
mountPoint,
|
|
1621
|
-
|
|
1622
|
-
|
|
1643
|
+
return Array.from(groups.entries()).map(_ref3 => {
|
|
1644
|
+
var [mountPoint, childNodes] = _ref3;
|
|
1645
|
+
return {
|
|
1646
|
+
mountPoint,
|
|
1647
|
+
childNodes
|
|
1648
|
+
};
|
|
1649
|
+
});
|
|
1623
1650
|
}
|
|
1624
1651
|
|
|
1625
1652
|
/**
|
|
@@ -1914,18 +1941,22 @@
|
|
|
1914
1941
|
// The reverse operation of *normalize*.
|
|
1915
1942
|
// https://github.com/easyops-cn/next-basics/blob/5a6710d567821bcb4a0c71e22d55212193d8b0cb/bricks/next-builder/src/shared/storyboard/buildStoryboard.ts#L394
|
|
1916
1943
|
function reverseNormalize(brickConf, ctx) {
|
|
1917
|
-
return Object.fromEntries(Object.entries(brickConf).map(
|
|
1944
|
+
return Object.fromEntries(Object.entries(brickConf).map(_ref => {
|
|
1945
|
+
var [key, value] = _ref;
|
|
1946
|
+
return value === undefined || ignoredFieldsInBrick.includes(key) ? undefined : jsonFieldsInBrick.includes(key) ? [key, JSON.stringify(value)] : yamlFieldsInBrick.includes(key) ? [key, yaml__default["default"].safeDump(value)] : [key, value];
|
|
1947
|
+
}).filter(Boolean).concat(Object.entries(ctx.nodeData), [["brick", ctx.nodeData.type === "template" ? brickConf.template : brickConf.brick], ["portal", ctx.isPortalCanvas || brickConf.portal]]));
|
|
1918
1948
|
}
|
|
1919
1949
|
|
|
1920
|
-
function getSnippetNodeDetail({
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1950
|
+
function getSnippetNodeDetail(_ref) {
|
|
1951
|
+
var {
|
|
1952
|
+
parent,
|
|
1953
|
+
parentUid,
|
|
1954
|
+
mountPoint,
|
|
1955
|
+
nodeUid,
|
|
1956
|
+
brickConf,
|
|
1957
|
+
isPortalCanvas,
|
|
1958
|
+
sort
|
|
1959
|
+
} = _ref;
|
|
1929
1960
|
var type = brickConf.template ? "template" : brickConf.bg ? "provider" : "brick";
|
|
1930
1961
|
return {
|
|
1931
1962
|
nodeUid,
|
|
@@ -1939,34 +1970,42 @@
|
|
|
1939
1970
|
sort
|
|
1940
1971
|
}
|
|
1941
1972
|
}),
|
|
1942
|
-
children: brickConf.slots ? Object.entries(brickConf.slots).flatMap(
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
}, index) =>
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1973
|
+
children: brickConf.slots ? Object.entries(brickConf.slots).flatMap(_ref2 => {
|
|
1974
|
+
var [mountPoint, slotConf] = _ref2;
|
|
1975
|
+
return slotConf.bricks.map(childBrickConf => ({
|
|
1976
|
+
childBrickConf,
|
|
1977
|
+
mountPoint
|
|
1978
|
+
}));
|
|
1979
|
+
}).map((_ref3, index) => {
|
|
1980
|
+
var {
|
|
1981
|
+
childBrickConf,
|
|
1982
|
+
mountPoint
|
|
1983
|
+
} = _ref3;
|
|
1984
|
+
return getSnippetNodeDetail({
|
|
1985
|
+
parentUid: nodeUid,
|
|
1986
|
+
mountPoint,
|
|
1987
|
+
nodeUid: getUniqueNodeId(),
|
|
1988
|
+
brickConf: childBrickConf,
|
|
1989
|
+
sort: index
|
|
1990
|
+
});
|
|
1991
|
+
}) : []
|
|
1955
1992
|
};
|
|
1956
1993
|
}
|
|
1957
1994
|
|
|
1958
|
-
function processDrop({
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1995
|
+
function processDrop(_ref) {
|
|
1996
|
+
var {
|
|
1997
|
+
manager,
|
|
1998
|
+
type,
|
|
1999
|
+
data,
|
|
2000
|
+
droppingIndex,
|
|
2001
|
+
droppingParentUid,
|
|
2002
|
+
droppingParentInstanceId,
|
|
2003
|
+
droppingMountPoint,
|
|
2004
|
+
droppingChildNodes,
|
|
2005
|
+
droppingSiblingGroups,
|
|
2006
|
+
isPortalCanvas
|
|
2007
|
+
} = _ref;
|
|
2008
|
+
|
|
1970
2009
|
if (type === exports.BuilderDataTransferType.NODE_TO_ADD) {
|
|
1971
2010
|
// Drag a new node into canvas.
|
|
1972
2011
|
var {
|
|
@@ -2080,21 +2119,22 @@
|
|
|
2080
2119
|
styleInject(css_248z$1);
|
|
2081
2120
|
|
|
2082
2121
|
var _excluded = ["type"];
|
|
2083
|
-
function DropZone({
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2122
|
+
function DropZone(_ref) {
|
|
2123
|
+
var {
|
|
2124
|
+
nodeUid,
|
|
2125
|
+
isRoot,
|
|
2126
|
+
separateCanvas,
|
|
2127
|
+
isPortalCanvas,
|
|
2128
|
+
independentPortalCanvas,
|
|
2129
|
+
canvasIndex,
|
|
2130
|
+
mountPoint,
|
|
2131
|
+
fullscreen,
|
|
2132
|
+
delegatedContext,
|
|
2133
|
+
dropZoneStyle,
|
|
2134
|
+
dropZoneBodyStyle,
|
|
2135
|
+
slotContentLayout,
|
|
2136
|
+
showOutlineIfEmpty
|
|
2137
|
+
} = _ref;
|
|
2098
2138
|
var dropZoneBody = React__default["default"].useRef();
|
|
2099
2139
|
var [dropPositionCursor, setDropPositionCursor] = React__default["default"].useState(null);
|
|
2100
2140
|
var dropPositionCursorRef = React__default["default"].useRef();
|
|
@@ -2269,17 +2309,18 @@
|
|
|
2269
2309
|
styleInject(css_248z);
|
|
2270
2310
|
|
|
2271
2311
|
/* istanbul-ignore-file */
|
|
2272
|
-
function SlotContainer({
|
|
2273
|
-
nodeUid,
|
|
2274
|
-
slotName,
|
|
2275
|
-
slotContainerStyle,
|
|
2276
|
-
dropZoneStyle,
|
|
2277
|
-
dropZoneBodyStyle,
|
|
2278
|
-
slotContentLayout,
|
|
2279
|
-
showOutlineIfEmpty
|
|
2280
|
-
}) {
|
|
2312
|
+
function SlotContainer(_ref) {
|
|
2281
2313
|
var _droppingStatus$get;
|
|
2282
2314
|
|
|
2315
|
+
var {
|
|
2316
|
+
nodeUid,
|
|
2317
|
+
slotName,
|
|
2318
|
+
slotContainerStyle,
|
|
2319
|
+
dropZoneStyle,
|
|
2320
|
+
dropZoneBodyStyle,
|
|
2321
|
+
slotContentLayout,
|
|
2322
|
+
showOutlineIfEmpty
|
|
2323
|
+
} = _ref;
|
|
2283
2324
|
var node = useBuilderNode({
|
|
2284
2325
|
nodeUid
|
|
2285
2326
|
});
|
|
@@ -2325,9 +2366,10 @@
|
|
|
2325
2366
|
|
|
2326
2367
|
var refCount = 0;
|
|
2327
2368
|
|
|
2328
|
-
function LegacyBuilderProvider({
|
|
2329
|
-
|
|
2330
|
-
|
|
2369
|
+
function LegacyBuilderProvider(_ref) {
|
|
2370
|
+
var {
|
|
2371
|
+
children
|
|
2372
|
+
} = _ref;
|
|
2331
2373
|
var context = createSingletonBuilderContext();
|
|
2332
2374
|
/**
|
|
2333
2375
|
* If the global context was used to store the DND context
|
|
@@ -2353,8 +2395,8 @@
|
|
|
2353
2395
|
function EditorElementFactory(EditorComponent, options) {
|
|
2354
2396
|
var NewEditorElement = _decorate__default["default"](null, function (_initialize, _UpdatingElement) {
|
|
2355
2397
|
class NewEditorElement extends _UpdatingElement {
|
|
2356
|
-
constructor(
|
|
2357
|
-
super(...
|
|
2398
|
+
constructor() {
|
|
2399
|
+
super(...arguments);
|
|
2358
2400
|
|
|
2359
2401
|
_initialize(this);
|
|
2360
2402
|
}
|
|
@@ -2434,11 +2476,12 @@
|
|
|
2434
2476
|
/** @deprecated no more usage but for compatibility only. */
|
|
2435
2477
|
var DroppingStatusContext = /*#__PURE__*/React.createContext({});
|
|
2436
2478
|
|
|
2437
|
-
function useBuilderNodeMountPoints({
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2479
|
+
function useBuilderNodeMountPoints(_ref) {
|
|
2480
|
+
var {
|
|
2481
|
+
nodeUid,
|
|
2482
|
+
isRoot,
|
|
2483
|
+
doNotExpandTemplates
|
|
2484
|
+
} = _ref;
|
|
2442
2485
|
var {
|
|
2443
2486
|
rootId,
|
|
2444
2487
|
edges
|