@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/dist/index.esm.js CHANGED
@@ -6719,24 +6719,42 @@ function customListenerFactory(handler, ifContainer, context, runtimeBrick) {
6719
6719
  }
6720
6720
 
6721
6721
  var targets = [];
6722
+ var rawTarget = handler.target;
6723
+ var rawTargetRef = handler.targetRef;
6724
+ var computedTarget = rawTarget; // Allow `target` to be set as evaluable string.
6722
6725
 
6723
- if (typeof handler.target === "string") {
6724
- if (handler.target === "_self") {
6726
+ if (typeof rawTarget === "string" ? isEvaluable(rawTarget) : isPreEvaluated(rawTarget)) {
6727
+ computedTarget = computeRealValue(rawTarget, context);
6728
+ }
6729
+
6730
+ if (typeof computedTarget === "string") {
6731
+ if (computedTarget === "_self") {
6725
6732
  targets.push(runtimeBrick.element);
6726
6733
  } else if (handler.multiple) {
6727
- targets = Array.from(document.querySelectorAll(handler.target));
6734
+ targets = Array.from(document.querySelectorAll(computedTarget));
6728
6735
  } else {
6729
- var found = document.querySelector(handler.target);
6736
+ var found = document.querySelector(computedTarget);
6730
6737
 
6731
6738
  if (found !== null) {
6732
6739
  targets.push(found);
6733
6740
  }
6734
6741
  }
6735
- } else if (handler.target) {
6736
- targets.push(handler.target);
6737
- } else if (handler.targetRef) {
6742
+ } else if (computedTarget) {
6743
+ if (computedTarget instanceof HTMLElement) {
6744
+ targets.push(computedTarget);
6745
+ } else {
6746
+ // eslint-disable-next-line no-console
6747
+ console.error("unexpected target:", computedTarget);
6748
+ }
6749
+ } else if (rawTargetRef) {
6750
+ var computedTargetRef = rawTargetRef; // Allow `targetRef` to be set as evaluable string.
6751
+
6752
+ if (typeof rawTargetRef === "string" ? isEvaluable(rawTargetRef) : isPreEvaluated(rawTargetRef)) {
6753
+ computedTargetRef = computeRealValue(rawTargetRef, context, true);
6754
+ }
6755
+
6738
6756
  var tpl = getTplContext(context.tplContextId).getBrick().element;
6739
- targets.push(...[].concat(handler.targetRef).map(ref => {
6757
+ targets.push(...[].concat(computedTargetRef).map(ref => {
6740
6758
  var _tpl$$$getElementByRe;
6741
6759
 
6742
6760
  return (_tpl$$$getElementByRe = tpl.$$getElementByRef) === null || _tpl$$$getElementByRe === void 0 ? void 0 : _tpl$$$getElementByRe.call(tpl, ref);
@@ -6745,7 +6763,7 @@ function customListenerFactory(handler, ifContainer, context, runtimeBrick) {
6745
6763
 
6746
6764
  if (targets.length === 0) {
6747
6765
  // eslint-disable-next-line no-console
6748
- console.error("target not found:", handler.target || handler.targetRef);
6766
+ console.error("target not found:", rawTarget || rawTargetRef);
6749
6767
  return;
6750
6768
  }
6751
6769
 
@@ -12082,7 +12100,7 @@ class Router {
12082
12100
  };
12083
12101
 
12084
12102
  if (storyboard) {
12085
- var _currentApp$breadcrum, _currentApp$breadcrum2;
12103
+ var _currentApp$breadcrum, _currentApp$breadcrum2, _currentApp$breadcrum3, _currentApp$breadcrum4;
12086
12104
 
12087
12105
  var {
12088
12106
  bricks,
@@ -12106,7 +12124,7 @@ class Router {
12106
12124
  appBar: {
12107
12125
  breadcrumb: [],
12108
12126
  documentId: null,
12109
- 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
12127
+ 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
12110
12128
  },
12111
12129
  flags: {
12112
12130
  redirect: undefined,