@next-core/brick-kit 2.138.0 → 2.140.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,28 @@
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
+ # [2.140.0](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.139.0...@next-core/brick-kit@2.140.0) (2022-09-14)
7
+
8
+
9
+ ### Features
10
+
11
+ * allow target/targetRef to be set as evaluable string ([ef06f22](https://github.com/easyops-cn/next-core/commit/ef06f22d8401880a7c450a04f09ed08c9748846c))
12
+
13
+
14
+
15
+
16
+
17
+ # [2.139.0](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.138.0...@next-core/brick-kit@2.139.0) (2022-09-13)
18
+
19
+
20
+ ### Features
21
+
22
+ * support noCurrentApp evalute ([73a0662](https://github.com/easyops-cn/next-core/commit/73a06628ad66625fa8be18edf48819179ea931b4))
23
+
24
+
25
+
26
+
27
+
6
28
  # [2.138.0](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.137.2...@next-core/brick-kit@2.138.0) (2022-09-08)
7
29
 
8
30
 
@@ -6718,24 +6718,42 @@
6718
6718
  }
6719
6719
 
6720
6720
  var targets = [];
6721
+ var rawTarget = handler.target;
6722
+ var rawTargetRef = handler.targetRef;
6723
+ var computedTarget = rawTarget; // Allow `target` to be set as evaluable string.
6721
6724
 
6722
- if (typeof handler.target === "string") {
6723
- if (handler.target === "_self") {
6725
+ if (typeof rawTarget === "string" ? brickUtils.isEvaluable(rawTarget) : isPreEvaluated(rawTarget)) {
6726
+ computedTarget = computeRealValue(rawTarget, context);
6727
+ }
6728
+
6729
+ if (typeof computedTarget === "string") {
6730
+ if (computedTarget === "_self") {
6724
6731
  targets.push(runtimeBrick.element);
6725
6732
  } else if (handler.multiple) {
6726
- targets = Array.from(document.querySelectorAll(handler.target));
6733
+ targets = Array.from(document.querySelectorAll(computedTarget));
6727
6734
  } else {
6728
- var found = document.querySelector(handler.target);
6735
+ var found = document.querySelector(computedTarget);
6729
6736
 
6730
6737
  if (found !== null) {
6731
6738
  targets.push(found);
6732
6739
  }
6733
6740
  }
6734
- } else if (handler.target) {
6735
- targets.push(handler.target);
6736
- } else if (handler.targetRef) {
6741
+ } else if (computedTarget) {
6742
+ if (computedTarget instanceof HTMLElement) {
6743
+ targets.push(computedTarget);
6744
+ } else {
6745
+ // eslint-disable-next-line no-console
6746
+ console.error("unexpected target:", computedTarget);
6747
+ }
6748
+ } else if (rawTargetRef) {
6749
+ var computedTargetRef = rawTargetRef; // Allow `targetRef` to be set as evaluable string.
6750
+
6751
+ if (typeof rawTargetRef === "string" ? brickUtils.isEvaluable(rawTargetRef) : isPreEvaluated(rawTargetRef)) {
6752
+ computedTargetRef = computeRealValue(rawTargetRef, context, true);
6753
+ }
6754
+
6737
6755
  var tpl = getTplContext(context.tplContextId).getBrick().element;
6738
- targets.push(...[].concat(handler.targetRef).map(ref => {
6756
+ targets.push(...[].concat(computedTargetRef).map(ref => {
6739
6757
  var _tpl$$$getElementByRe;
6740
6758
 
6741
6759
  return (_tpl$$$getElementByRe = tpl.$$getElementByRef) === null || _tpl$$$getElementByRe === void 0 ? void 0 : _tpl$$$getElementByRe.call(tpl, ref);
@@ -6744,7 +6762,7 @@
6744
6762
 
6745
6763
  if (targets.length === 0) {
6746
6764
  // eslint-disable-next-line no-console
6747
- console.error("target not found:", handler.target || handler.targetRef);
6765
+ console.error("target not found:", rawTarget || rawTargetRef);
6748
6766
  return;
6749
6767
  }
6750
6768
 
@@ -12081,7 +12099,7 @@
12081
12099
  };
12082
12100
 
12083
12101
  if (storyboard) {
12084
- var _currentApp$breadcrum, _currentApp$breadcrum2;
12102
+ var _currentApp$breadcrum, _currentApp$breadcrum2, _currentApp$breadcrum3, _currentApp$breadcrum4;
12085
12103
 
12086
12104
  var {
12087
12105
  bricks,
@@ -12105,7 +12123,7 @@
12105
12123
  appBar: {
12106
12124
  breadcrumb: [],
12107
12125
  documentId: null,
12108
- noCurrentApp: (_currentApp$breadcrum = (_currentApp$breadcrum2 = currentApp.breadcrumb) === null || _currentApp$breadcrum2 === void 0 ? void 0 : _currentApp$breadcrum2.noCurrentApp) !== null && _currentApp$breadcrum !== void 0 ? _currentApp$breadcrum : false
12126
+ noCurrentApp: typeof ((_currentApp$breadcrum = currentApp.breadcrumb) === null || _currentApp$breadcrum === void 0 ? void 0 : _currentApp$breadcrum.noCurrentApp) === "string" ? computeRealValue((_currentApp$breadcrum2 = currentApp.breadcrumb) === null || _currentApp$breadcrum2 === void 0 ? void 0 : _currentApp$breadcrum2.noCurrentApp, _this3.locationContext.getCurrentContext()) : (_currentApp$breadcrum3 = (_currentApp$breadcrum4 = currentApp.breadcrumb) === null || _currentApp$breadcrum4 === void 0 ? void 0 : _currentApp$breadcrum4.noCurrentApp) !== null && _currentApp$breadcrum3 !== void 0 ? _currentApp$breadcrum3 : false
12109
12127
  },
12110
12128
  flags: {
12111
12129
  redirect: undefined,