@next-core/brick-kit 2.110.0 → 2.111.2

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,36 @@
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.111.2](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.111.1...@next-core/brick-kit@2.111.2) (2022-03-28)
7
+
8
+ **Note:** Version bump only for package @next-core/brick-kit
9
+
10
+
11
+
12
+
13
+
14
+ ## [2.111.1](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.111.0...@next-core/brick-kit@2.111.1) (2022-03-24)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * support mocked location in storyboard functions ([260e775](https://github.com/easyops-cn/next-core/commit/260e77567a61c7f3199a174171de2eead4007d06))
20
+
21
+
22
+
23
+
24
+
25
+ # [2.111.0](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.110.0...@next-core/brick-kit@2.111.0) (2022-03-24)
26
+
27
+
28
+ ### Features
29
+
30
+ * support APP.getMenu ([#1651](https://github.com/easyops-cn/next-core/issues/1651)) ([5b9f53a](https://github.com/easyops-cn/next-core/commit/5b9f53a3367087a062f415dd68070f15b98bf966))
31
+
32
+
33
+
34
+
35
+
6
36
  # [2.110.0](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.109.0...@next-core/brick-kit@2.110.0) (2022-03-23)
7
37
 
8
38
 
@@ -635,12 +635,6 @@
635
635
  case "PIPES":
636
636
  return pipes.pipes;
637
637
 
638
- case "location":
639
- return {
640
- href: location.href,
641
- origin: location.origin
642
- };
643
-
644
638
  case "TAG_URL":
645
639
  return tagUrlFactory(true);
646
640
 
@@ -1596,6 +1590,15 @@
1596
1590
 
1597
1591
  case "console":
1598
1592
  return isStoryboardFunction ? getReadOnlyProxy(console) : undefined;
1593
+
1594
+ case "location":
1595
+ return collectCoverage ? {
1596
+ href: "http://localhost:3000/functions/test",
1597
+ origin: "http://localhost:3000"
1598
+ } : {
1599
+ href: location.href,
1600
+ origin: location.origin
1601
+ };
1599
1602
  }
1600
1603
  }
1601
1604
 
@@ -2331,7 +2334,9 @@
2331
2334
  return hash ? hash.substr(1) : null;
2332
2335
 
2333
2336
  case "APP":
2334
- return lodash.cloneDeep(app);
2337
+ return _objectSpread__default["default"](_objectSpread__default["default"]({}, lodash.cloneDeep(app)), {}, {
2338
+ getMenu
2339
+ });
2335
2340
 
2336
2341
  case "CTX":
2337
2342
  return getDynamicReadOnlyProxy({
@@ -2688,7 +2693,19 @@
2688
2693
  return _constructMenu.apply(this, arguments);
2689
2694
  }
2690
2695
 
2691
- function fetchMenuById(_x4, _x5) {
2696
+ function constructMenuByMenusList(_x4, _x5, _x6) {
2697
+ return _constructMenuByMenusList.apply(this, arguments);
2698
+ }
2699
+
2700
+ function _constructMenuByMenusList() {
2701
+ _constructMenuByMenusList = _asyncToGenerator__default["default"](function* (menus, context, kernel) {
2702
+ yield Promise.all(menus.map(menuId => processMenu(menuId, context, kernel)));
2703
+ });
2704
+ return _constructMenuByMenusList.apply(this, arguments);
2705
+ }
2706
+
2707
+ var getMenu = menuId => menuCache.get(menuId);
2708
+ function fetchMenuById(_x7, _x8) {
2692
2709
  return _fetchMenuById.apply(this, arguments);
2693
2710
  }
2694
2711
 
@@ -2794,7 +2811,7 @@
2794
2811
  });
2795
2812
  }
2796
2813
 
2797
- function loadDynamicMenuItems(_x6) {
2814
+ function loadDynamicMenuItems(_x9) {
2798
2815
  return _loadDynamicMenuItems.apply(this, arguments);
2799
2816
  }
2800
2817
 
@@ -2812,7 +2829,7 @@
2812
2829
  return _loadDynamicMenuItems.apply(this, arguments);
2813
2830
  }
2814
2831
 
2815
- function processMenu(_x7, _x8, _x9, _x10) {
2832
+ function processMenu(_x10, _x11, _x12, _x13) {
2816
2833
  return _processMenu.apply(this, arguments);
2817
2834
  }
2818
2835
 
@@ -2871,13 +2888,13 @@
2871
2888
  });
2872
2889
  });
2873
2890
 
2874
- return function (_x11) {
2891
+ return function (_x14) {
2875
2892
  return _ref2.apply(this, arguments);
2876
2893
  };
2877
2894
  }()));
2878
2895
  }
2879
2896
 
2880
- function processMenuTitle(_x12) {
2897
+ function processMenuTitle(_x15) {
2881
2898
  return _processMenuTitle.apply(this, arguments);
2882
2899
  }
2883
2900
 
@@ -2972,7 +2989,7 @@
2972
2989
  return false;
2973
2990
  }
2974
2991
 
2975
- function computeRealValueWithOverrideApp(_x13, _x14, _x15, _x16) {
2992
+ function computeRealValueWithOverrideApp(_x16, _x17, _x18, _x19) {
2976
2993
  return _computeRealValueWithOverrideApp.apply(this, arguments);
2977
2994
  }
2978
2995
 
@@ -8744,6 +8761,12 @@
8744
8761
  if (isRouteConfOfRoutes(route) && Array.isArray(route.routes)) {
8745
8762
  yield _this.mountRoutes(route.routes, slotId, mountRoutesResult);
8746
8763
  } else if (isRouteConfOfBricks(route) && Array.isArray(route.bricks)) {
8764
+ var useMenus = brickUtils.scanAppGetMenuInAny(route);
8765
+
8766
+ if (useMenus.length) {
8767
+ yield constructMenuByMenusList(useMenus, _this.getCurrentContext(), _this.kernel);
8768
+ }
8769
+
8747
8770
  yield _this.mountBricks(route.bricks, matched.match, slotId, mountRoutesResult); // analytics data (page_view event)
8748
8771
 
8749
8772
  if (route.analyticsData) {