@next-core/brick-kit 2.110.0 → 2.111.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
+ # [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)
7
+
8
+
9
+ ### Features
10
+
11
+ * support APP.getMenu ([#1651](https://github.com/easyops-cn/next-core/issues/1651)) ([5b9f53a](https://github.com/easyops-cn/next-core/commit/5b9f53a3367087a062f415dd68070f15b98bf966))
12
+
13
+
14
+
15
+
16
+
6
17
  # [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
18
 
8
19
 
@@ -2331,7 +2331,9 @@
2331
2331
  return hash ? hash.substr(1) : null;
2332
2332
 
2333
2333
  case "APP":
2334
- return lodash.cloneDeep(app);
2334
+ return _objectSpread__default["default"](_objectSpread__default["default"]({}, lodash.cloneDeep(app)), {}, {
2335
+ getMenu
2336
+ });
2335
2337
 
2336
2338
  case "CTX":
2337
2339
  return getDynamicReadOnlyProxy({
@@ -2688,7 +2690,19 @@
2688
2690
  return _constructMenu.apply(this, arguments);
2689
2691
  }
2690
2692
 
2691
- function fetchMenuById(_x4, _x5) {
2693
+ function constructMenuByMenusList(_x4, _x5, _x6) {
2694
+ return _constructMenuByMenusList.apply(this, arguments);
2695
+ }
2696
+
2697
+ function _constructMenuByMenusList() {
2698
+ _constructMenuByMenusList = _asyncToGenerator__default["default"](function* (menus, context, kernel) {
2699
+ yield Promise.all(menus.map(menuId => processMenu(menuId, context, kernel)));
2700
+ });
2701
+ return _constructMenuByMenusList.apply(this, arguments);
2702
+ }
2703
+
2704
+ var getMenu = menuId => menuCache.get(menuId);
2705
+ function fetchMenuById(_x7, _x8) {
2692
2706
  return _fetchMenuById.apply(this, arguments);
2693
2707
  }
2694
2708
 
@@ -2794,7 +2808,7 @@
2794
2808
  });
2795
2809
  }
2796
2810
 
2797
- function loadDynamicMenuItems(_x6) {
2811
+ function loadDynamicMenuItems(_x9) {
2798
2812
  return _loadDynamicMenuItems.apply(this, arguments);
2799
2813
  }
2800
2814
 
@@ -2812,7 +2826,7 @@
2812
2826
  return _loadDynamicMenuItems.apply(this, arguments);
2813
2827
  }
2814
2828
 
2815
- function processMenu(_x7, _x8, _x9, _x10) {
2829
+ function processMenu(_x10, _x11, _x12, _x13) {
2816
2830
  return _processMenu.apply(this, arguments);
2817
2831
  }
2818
2832
 
@@ -2871,13 +2885,13 @@
2871
2885
  });
2872
2886
  });
2873
2887
 
2874
- return function (_x11) {
2888
+ return function (_x14) {
2875
2889
  return _ref2.apply(this, arguments);
2876
2890
  };
2877
2891
  }()));
2878
2892
  }
2879
2893
 
2880
- function processMenuTitle(_x12) {
2894
+ function processMenuTitle(_x15) {
2881
2895
  return _processMenuTitle.apply(this, arguments);
2882
2896
  }
2883
2897
 
@@ -2972,7 +2986,7 @@
2972
2986
  return false;
2973
2987
  }
2974
2988
 
2975
- function computeRealValueWithOverrideApp(_x13, _x14, _x15, _x16) {
2989
+ function computeRealValueWithOverrideApp(_x16, _x17, _x18, _x19) {
2976
2990
  return _computeRealValueWithOverrideApp.apply(this, arguments);
2977
2991
  }
2978
2992
 
@@ -8744,6 +8758,12 @@
8744
8758
  if (isRouteConfOfRoutes(route) && Array.isArray(route.routes)) {
8745
8759
  yield _this.mountRoutes(route.routes, slotId, mountRoutesResult);
8746
8760
  } else if (isRouteConfOfBricks(route) && Array.isArray(route.bricks)) {
8761
+ var useMenus = brickUtils.scanAppGetMenuInAny(route);
8762
+
8763
+ if (useMenus.length) {
8764
+ yield constructMenuByMenusList(useMenus, _this.getCurrentContext(), _this.kernel);
8765
+ }
8766
+
8747
8767
  yield _this.mountBricks(route.bricks, matched.match, slotId, mountRoutesResult); // analytics data (page_view event)
8748
8768
 
8749
8769
  if (route.analyticsData) {