@next-core/brick-kit 2.117.8 → 2.117.11

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,40 @@
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.117.11](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.117.10...@next-core/brick-kit@2.117.11) (2022-04-15)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * template preview with context ([f71bc07](https://github.com/easyops-cn/next-core/commit/f71bc07d1b5b0eea719d5886a177712dcb934c4c))
12
+
13
+
14
+
15
+
16
+
17
+ ## [2.117.10](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.117.9...@next-core/brick-kit@2.117.10) (2022-04-14)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * put template preview route between specific ones and others ([923d6f3](https://github.com/easyops-cn/next-core/commit/923d6f3e71f4d9211516045e4b09b96c0c82285b))
23
+
24
+
25
+
26
+
27
+
28
+ ## [2.117.9](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.117.8...@next-core/brick-kit@2.117.9) (2022-04-14)
29
+
30
+
31
+ ### Bug Fixes
32
+
33
+ * put template preview route before others ([bcb1cac](https://github.com/easyops-cn/next-core/commit/bcb1cac988befac5dab41c325921d7738bb8c306))
34
+ * support setting targetRef as array ([ec822f3](https://github.com/easyops-cn/next-core/commit/ec822f37f881efe96a06b7fe53af17e6a40c79c6))
35
+
36
+
37
+
38
+
39
+
6
40
  ## [2.117.8](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.117.7...@next-core/brick-kit@2.117.8) (2022-04-14)
7
41
 
8
42
 
@@ -6259,15 +6259,12 @@
6259
6259
  } else if (handler.target) {
6260
6260
  targets.push(handler.target);
6261
6261
  } else if (handler.targetRef) {
6262
- var _tpl$$$getElementByRe;
6263
-
6264
6262
  var tpl = getTplContext(context.tplContextId).getBrick().element;
6263
+ targets.push(...[].concat(handler.targetRef).map(ref => {
6264
+ var _tpl$$$getElementByRe;
6265
6265
 
6266
- var _found = (_tpl$$$getElementByRe = tpl.$$getElementByRef) === null || _tpl$$$getElementByRe === void 0 ? void 0 : _tpl$$$getElementByRe.call(tpl, handler.targetRef);
6267
-
6268
- if (_found) {
6269
- targets.push(_found);
6270
- }
6266
+ return (_tpl$$$getElementByRe = tpl.$$getElementByRef) === null || _tpl$$$getElementByRe === void 0 ? void 0 : _tpl$$$getElementByRe.call(tpl, ref);
6267
+ }).filter(Boolean));
6271
6268
  }
6272
6269
 
6273
6270
  if (targets.length === 0) {
@@ -8083,13 +8080,13 @@
8083
8080
  path: previewPath,
8084
8081
  bricks: [_objectSpread__default["default"]({
8085
8082
  brick: templateId
8086
- }, lodash.pick(settings, "properties", "events", "lifeCycle"))],
8083
+ }, lodash.pick(settings, "properties", "events", "lifeCycle", "context"))],
8087
8084
  menu: false,
8088
8085
  exact: true
8089
8086
  };
8090
8087
 
8091
8088
  if (previewRouteIndex === -1) {
8092
- routes.push(newPreviewRoute);
8089
+ routes.unshift(newPreviewRoute);
8093
8090
  } else {
8094
8091
  routes.splice(previewRouteIndex, 1, newPreviewRoute);
8095
8092
  }
@@ -10212,15 +10209,16 @@
10212
10209
  };
10213
10210
 
10214
10211
  try {
10215
- yield locationContext.mountRoutes( // Concat with a placeholder when loading template preview settings.
10216
- [{
10212
+ var specificTemplatePreviewIndex = lodash.findLastIndex(storyboard.routes, route => route.path.startsWith("${APP.homepage}/_dev_only_/template-preview/"));
10213
+ var mergedRoutes = [...storyboard.routes.slice(0, specificTemplatePreviewIndex + 1), {
10217
10214
  path: "${APP.homepage}/_dev_only_/template-preview/:templateId",
10218
10215
  bricks: [{
10219
10216
  brick: "span"
10220
10217
  }],
10221
10218
  menu: false,
10222
10219
  exact: true
10223
- }].concat(storyboard.routes), undefined, mountRoutesResult);
10220
+ }, ...storyboard.routes.slice(specificTemplatePreviewIndex + 1)];
10221
+ yield locationContext.mountRoutes(mergedRoutes, undefined, mountRoutesResult);
10224
10222
  } catch (error) {
10225
10223
  // eslint-disable-next-line no-console
10226
10224
  console.error(error); // Redirect to login page if not logged in.