@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/dist/index.esm.js CHANGED
@@ -4,7 +4,7 @@ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProper
4
4
  import _asyncToGenerator$4 from '@babel/runtime/helpers/asyncToGenerator';
5
5
  import _defineProperty$1 from '@babel/runtime/helpers/defineProperty';
6
6
  import React, { useState, useEffect, useRef, forwardRef, useImperativeHandle, useMemo, useContext, createContext, useReducer, useCallback } from 'react';
7
- import { JsonStorage, toPath, computeRealRoutePath, hasOwnProperty, isObject, isEvaluable, transformAndInject, transform, trackContext, trackState, scanPermissionActionsInStoryboard, precookFunction, cook, resolveContextConcurrently, syncResolveContextConcurrently, shouldAllowRecursiveEvaluations, preevaluate, inject, deepFreeze, createProviderClass, scanRouteAliasInStoryboard, loadScript, getTemplateDepsOfStoryboard, getDllAndDepsOfStoryboard, asyncProcessStoryboard, prefetchScript, scanBricksInBrickConf, scanProcessorsInAny, getDllAndDepsByResource, matchPath, asyncProcessBrick, restoreDynamicTemplates, mapCustomApisToNameAndNamespace, scanCustomApisInStoryboard } from '@next-core/brick-utils';
7
+ import { JsonStorage, toPath, computeRealRoutePath, hasOwnProperty, isObject, isEvaluable, transformAndInject, transform, trackContext, trackState, scanPermissionActionsInStoryboard, precookFunction, cook, resolveContextConcurrently, syncResolveContextConcurrently, shouldAllowRecursiveEvaluations, preevaluate, inject, deepFreeze, createProviderClass, scanRouteAliasInStoryboard, loadScript, getTemplateDepsOfStoryboard, getDllAndDepsOfStoryboard, asyncProcessStoryboard, prefetchScript, scanBricksInBrickConf, scanProcessorsInAny, getDllAndDepsByResource, matchPath, scanAppGetMenuInAny, asyncProcessBrick, restoreDynamicTemplates, mapCustomApisToNameAndNamespace, scanCustomApisInStoryboard } from '@next-core/brick-utils';
8
8
  import lodash, { set, get, difference, identity, uniqueId, cloneDeep, isNil, sortBy, merge, orderBy, omit, clamp, isEmpty, noop, isObject as isObject$1, isString } from 'lodash';
9
9
  import { http, HttpResponseError, HttpFetchError } from '@next-core/brick-http';
10
10
  import moment from 'moment';
@@ -2332,7 +2332,9 @@ function evaluate(raw) {
2332
2332
  return hash ? hash.substr(1) : null;
2333
2333
 
2334
2334
  case "APP":
2335
- return cloneDeep(app);
2335
+ return _objectSpread(_objectSpread({}, cloneDeep(app)), {}, {
2336
+ getMenu
2337
+ });
2336
2338
 
2337
2339
  case "CTX":
2338
2340
  return getDynamicReadOnlyProxy({
@@ -2689,7 +2691,19 @@ function _constructMenu() {
2689
2691
  return _constructMenu.apply(this, arguments);
2690
2692
  }
2691
2693
 
2692
- function fetchMenuById(_x4, _x5) {
2694
+ function constructMenuByMenusList(_x4, _x5, _x6) {
2695
+ return _constructMenuByMenusList.apply(this, arguments);
2696
+ }
2697
+
2698
+ function _constructMenuByMenusList() {
2699
+ _constructMenuByMenusList = _asyncToGenerator$4(function* (menus, context, kernel) {
2700
+ yield Promise.all(menus.map(menuId => processMenu(menuId, context, kernel)));
2701
+ });
2702
+ return _constructMenuByMenusList.apply(this, arguments);
2703
+ }
2704
+
2705
+ var getMenu = menuId => menuCache.get(menuId);
2706
+ function fetchMenuById(_x7, _x8) {
2693
2707
  return _fetchMenuById.apply(this, arguments);
2694
2708
  }
2695
2709
 
@@ -2795,7 +2809,7 @@ function processGroupInject(items, menu, injectWithMenus) {
2795
2809
  });
2796
2810
  }
2797
2811
 
2798
- function loadDynamicMenuItems(_x6) {
2812
+ function loadDynamicMenuItems(_x9) {
2799
2813
  return _loadDynamicMenuItems.apply(this, arguments);
2800
2814
  }
2801
2815
 
@@ -2813,7 +2827,7 @@ function _loadDynamicMenuItems() {
2813
2827
  return _loadDynamicMenuItems.apply(this, arguments);
2814
2828
  }
2815
2829
 
2816
- function processMenu(_x7, _x8, _x9, _x10) {
2830
+ function processMenu(_x10, _x11, _x12, _x13) {
2817
2831
  return _processMenu.apply(this, arguments);
2818
2832
  }
2819
2833
 
@@ -2872,13 +2886,13 @@ function computeMenuItemsWithOverrideApp(items, context, kernel) {
2872
2886
  });
2873
2887
  });
2874
2888
 
2875
- return function (_x11) {
2889
+ return function (_x14) {
2876
2890
  return _ref2.apply(this, arguments);
2877
2891
  };
2878
2892
  }()));
2879
2893
  }
2880
2894
 
2881
- function processMenuTitle(_x12) {
2895
+ function processMenuTitle(_x15) {
2882
2896
  return _processMenuTitle.apply(this, arguments);
2883
2897
  }
2884
2898
 
@@ -2973,7 +2987,7 @@ function requireOverrideApp(data) {
2973
2987
  return false;
2974
2988
  }
2975
2989
 
2976
- function computeRealValueWithOverrideApp(_x13, _x14, _x15, _x16) {
2990
+ function computeRealValueWithOverrideApp(_x16, _x17, _x18, _x19) {
2977
2991
  return _computeRealValueWithOverrideApp.apply(this, arguments);
2978
2992
  }
2979
2993
 
@@ -8745,6 +8759,12 @@ class LocationContext {
8745
8759
  if (isRouteConfOfRoutes(route) && Array.isArray(route.routes)) {
8746
8760
  yield _this.mountRoutes(route.routes, slotId, mountRoutesResult);
8747
8761
  } else if (isRouteConfOfBricks(route) && Array.isArray(route.bricks)) {
8762
+ var useMenus = scanAppGetMenuInAny(route);
8763
+
8764
+ if (useMenus.length) {
8765
+ yield constructMenuByMenusList(useMenus, _this.getCurrentContext(), _this.kernel);
8766
+ }
8767
+
8748
8768
  yield _this.mountBricks(route.bricks, matched.match, slotId, mountRoutesResult); // analytics data (page_view event)
8749
8769
 
8750
8770
  if (route.analyticsData) {