@next-core/editor-bricks-helper 0.32.36 → 0.33.0

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 CHANGED
@@ -3,6 +3,17 @@
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.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)
7
+
8
+
9
+ ### Features
10
+
11
+ * display brick alias/id/dataset.testid/brick.name in order ([3645841](https://github.com/easyops-cn/next-core/commit/3645841ccf12f8ca3fe74f673a541ec75ff45d1c))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [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)
7
18
 
8
19
  **Note:** Version bump only for package @next-core/editor-bricks-helper
@@ -414,10 +414,11 @@
414
414
  }
415
415
  }
416
416
 
417
- var nodeIgnoreFields = ["parent", "children", "graphInfo", "mountPoint"];
418
- function getBuilderNode(nodeData, nodeUid, isTemplateInternalNode) {
419
- var _nodeData$alias;
417
+ var nodeIgnoreFields = ["parent", "children", "graphInfo", "mountPoint"]; // Match evaluations and placeholders,
418
+ // E.g.: `<% QUERY.x %>` or `${QUERY.x}`.
420
419
 
420
+ var computationRegExp = /[<{]/;
421
+ function getBuilderNode(nodeData, nodeUid, isTemplateInternalNode) {
421
422
  var matchedSelectors = [];
422
423
 
423
424
  if (nodeData.brick) {
@@ -427,19 +428,29 @@
427
428
  var normalized = brickUtils.normalizeBuilderNode(nodeData);
428
429
  var jsonFieldsInBrick = ["properties", "events", "lifeCycle"];
429
430
  var parsedFields = [];
431
+ var parsedId;
432
+ var parsedTestId;
430
433
 
431
434
  for (var field of jsonFieldsInBrick) {
432
435
  var parsed = lodash.cloneDeep(normalized === null || normalized === void 0 ? void 0 : normalized[field]);
433
436
  parsedFields.push(["$$parsed".concat(lodash.upperFirst(field)), parsed !== null && parsed !== void 0 ? parsed : {}]);
434
437
 
435
- if (field === "properties" && parsed !== null && parsed !== void 0 && parsed.id && typeof parsed.id === "string" && // Ignore evaluations and placeholders,
436
- // E.g.: `<% QUERY.x %>` or `${QUERY.x}`.
437
- !/[<{]/.test(parsed.id)) {
438
- matchedSelectors.push("#".concat(parsed.id));
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
+ }
439
450
  }
440
451
  }
441
452
 
442
- return Object.fromEntries(Object.entries(nodeData).filter(entry => !nodeIgnoreFields.includes(entry[0])).concat([["alias", (_nodeData$alias = nodeData.alias) !== null && _nodeData$alias !== void 0 ? _nodeData$alias : brickUtils.isBrickNode(nodeData) ? nodeData.brick.split(".").pop() : undefined], ["$$uid", nodeUid], ["$$matchedSelectors", matchedSelectors], ["$$isTemplateInternalNode", isTemplateInternalNode], ["$$normalized", normalized]]).concat(parsedFields));
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));
443
454
  }
444
455
 
445
456
  function getAppendingNodesAndEdges(nodeData, nodeUid, templateSourceMap) {