@next-core/brick-kit 2.128.0 → 2.128.1

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
@@ -5,7 +5,7 @@ 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
7
  import { JsonStorage, toPath, computeRealRoutePath, hasOwnProperty, isObject, isEvaluable, transformAndInject, transform, trackContext, trackState, scanPermissionActionsInStoryboard, precookFunction, cook, resolveContextConcurrently, syncResolveContextConcurrently, shouldAllowRecursiveEvaluations, preevaluate, inject, deepFreeze, createProviderClass, getTemplateDepsOfStoryboard, getDllAndDepsOfStoryboard, asyncProcessStoryboard, getDllAndDepsByResource, scanRouteAliasInStoryboard, prefetchScript, scanBricksInBrickConf, scanProcessorsInAny, loadScript, matchPath, scanAppGetMenuInAny, asyncProcessBrick, scanInstalledAppsInStoryboard, restoreDynamicTemplates, scanStoryboard, mapCustomApisToNameAndNamespace } from '@next-core/brick-utils';
8
- import _, { set, get, difference, identity, uniqueId, cloneDeep, clamp, isNil, sortBy, merge, isEmpty, isObject as isObject$1, pick, orderBy, omit, findLastIndex, noop, isString } from 'lodash';
8
+ import _, { set, get, difference, identity, uniqueId, cloneDeep, clamp, isNil, isEmpty, sortBy, merge, isObject as isObject$1, pick, orderBy, omit, findLastIndex, noop, isString } from 'lodash';
9
9
  import { http, HttpResponseError, HttpFetchError } from '@next-core/brick-http';
10
10
  import moment from 'moment';
11
11
  import { pipes } from '@next-core/pipes';
@@ -3012,30 +3012,30 @@ function _constructMenu() {
3012
3012
  return _constructMenu.apply(this, arguments);
3013
3013
  }
3014
3014
 
3015
- function constructMenuByMenusList(_x4, _x5, _x6) {
3016
- return _constructMenuByMenusList.apply(this, arguments);
3015
+ function preConstructMenus(_x4, _x5, _x6) {
3016
+ return _preConstructMenus.apply(this, arguments);
3017
3017
  }
3018
3018
 
3019
- function _constructMenuByMenusList() {
3020
- _constructMenuByMenusList = _asyncToGenerator$4(function* (menus, context, kernel) {
3021
- var data = yield Promise.all(menus.map(menuId => processMenu(menuId, context, kernel)));
3019
+ function _preConstructMenus() {
3020
+ _preConstructMenus = _asyncToGenerator$4(function* (menus, context, kernel) {
3021
+ var data = yield Promise.all(menus.map(menuId => processMenu(menuId, context, kernel, undefined, true)));
3022
3022
  data.forEach((item, index) => processMenuCache.set(menus[index], item));
3023
3023
  });
3024
- return _constructMenuByMenusList.apply(this, arguments);
3024
+ return _preConstructMenus.apply(this, arguments);
3025
3025
  }
3026
3026
 
3027
3027
  var getMenu = menuId => processMenuCache.get(menuId);
3028
- function fetchMenuById(_x7, _x8) {
3028
+ function fetchMenuById(_x7, _x8, _x9) {
3029
3029
  return _fetchMenuById.apply(this, arguments);
3030
3030
  }
3031
3031
 
3032
3032
  function _fetchMenuById() {
3033
- _fetchMenuById = _asyncToGenerator$4(function* (menuId, kernel) {
3033
+ _fetchMenuById = _asyncToGenerator$4(function* (menuId, kernel, isPreFetch) {
3034
3034
  if (menuCache.has(menuId)) {
3035
3035
  return menuCache.get(menuId);
3036
3036
  }
3037
3037
 
3038
- var menuList = window.STANDALONE_MICRO_APPS ? kernel.getStandaloneMenus(menuId) : (yield InstanceApi_postSearch("EASYOPS_STORYBOARD_MENU", {
3038
+ var menuList = window.STANDALONE_MICRO_APPS ? kernel.getStandaloneMenus(menuId, isPreFetch) : (yield InstanceApi_postSearch("EASYOPS_STORYBOARD_MENU", {
3039
3039
  page: 1,
3040
3040
  page_size: 200,
3041
3041
  fields: {
@@ -3131,7 +3131,7 @@ function processGroupInject(items, menu, injectWithMenus) {
3131
3131
  });
3132
3132
  }
3133
3133
 
3134
- function loadDynamicMenuItems(_x9) {
3134
+ function loadDynamicMenuItems(_x10) {
3135
3135
  return _loadDynamicMenuItems.apply(this, arguments);
3136
3136
  }
3137
3137
 
@@ -3149,13 +3149,13 @@ function _loadDynamicMenuItems() {
3149
3149
  return _loadDynamicMenuItems.apply(this, arguments);
3150
3150
  }
3151
3151
 
3152
- function processMenu(_x10, _x11, _x12, _x13) {
3152
+ function processMenu(_x11, _x12, _x13, _x14, _x15) {
3153
3153
  return _processMenu.apply(this, arguments);
3154
3154
  }
3155
3155
 
3156
3156
  function _processMenu() {
3157
- _processMenu = _asyncToGenerator$4(function* (menuId, context, kernel, hasSubMenu) {
3158
- var _yield$fetchMenuById = yield fetchMenuById(menuId, kernel),
3157
+ _processMenu = _asyncToGenerator$4(function* (menuId, context, kernel, hasSubMenu, isPreFetch) {
3158
+ var _yield$fetchMenuById = yield fetchMenuById(menuId, kernel, isPreFetch),
3159
3159
  {
3160
3160
  items,
3161
3161
  app
@@ -3208,19 +3208,19 @@ function computeMenuItemsWithOverrideApp(items, context, kernel) {
3208
3208
  });
3209
3209
  });
3210
3210
 
3211
- return function (_x14) {
3211
+ return function (_x16) {
3212
3212
  return _ref2.apply(this, arguments);
3213
3213
  };
3214
3214
  }()));
3215
3215
  }
3216
3216
 
3217
- function processMenuTitle(_x15) {
3217
+ function processMenuTitle(_x17) {
3218
3218
  return _processMenuTitle.apply(this, arguments);
3219
3219
  }
3220
3220
 
3221
3221
  function _processMenuTitle() {
3222
3222
  _processMenuTitle = _asyncToGenerator$4(function* (menuData) {
3223
- if (menuData.title || !menuData.titleDataSource) {
3223
+ if (menuData.title || isEmpty(menuData.titleDataSource)) {
3224
3224
  return menuData.title;
3225
3225
  }
3226
3226
 
@@ -3309,7 +3309,7 @@ function requireOverrideApp(data) {
3309
3309
  return false;
3310
3310
  }
3311
3311
 
3312
- function computeRealValueWithOverrideApp(_x16, _x17, _x18, _x19) {
3312
+ function computeRealValueWithOverrideApp(_x18, _x19, _x20, _x21) {
3313
3313
  return _computeRealValueWithOverrideApp.apply(this, arguments);
3314
3314
  }
3315
3315
 
@@ -9522,10 +9522,11 @@ class Kernel {
9522
9522
  return Object.assign({}, (_this$bootstrapData = this.bootstrapData) === null || _this$bootstrapData === void 0 ? void 0 : (_this$bootstrapData$s = _this$bootstrapData.settings) === null || _this$bootstrapData$s === void 0 ? void 0 : _this$bootstrapData$s.featureFlags);
9523
9523
  }
9524
9524
 
9525
- getStandaloneMenus(menuId) {
9525
+ getStandaloneMenus(menuId, isPreFetch) {
9526
9526
  var _currentStoryboard$me, _currentStoryboard$me2;
9527
9527
 
9528
- var currentAppId = this.currentApp.id;
9528
+ var app = isPreFetch ? this.nextApp : this.currentApp;
9529
+ var currentAppId = app.id;
9529
9530
  var currentStoryboard = this.bootstrapData.storyboards.find(storyboard => storyboard.app.id === currentAppId);
9530
9531
  var menus = (_currentStoryboard$me = currentStoryboard.meta) !== null && _currentStoryboard$me !== void 0 && _currentStoryboard$me.injectMenus ? cloneDeep(currentStoryboard.meta.injectMenus) : (_currentStoryboard$me2 = currentStoryboard.meta) !== null && _currentStoryboard$me2 !== void 0 && _currentStoryboard$me2.menus ? cloneDeep(currentStoryboard.meta.menus) : [];
9531
9532
  return menus.filter(menu => menu.menuId === menuId).map(menu => {
@@ -10956,7 +10957,7 @@ class LocationContext {
10956
10957
  var useMenus = scanAppGetMenuInAny(data);
10957
10958
 
10958
10959
  if (useMenus.length) {
10959
- yield constructMenuByMenusList(useMenus, _this7.getCurrentContext(), _this7.kernel);
10960
+ yield preConstructMenus(useMenus, _this7.getCurrentContext(), _this7.kernel);
10960
10961
  }
10961
10962
  })();
10962
10963
  }