@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/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
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.128.1](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.128.0...@next-core/brick-kit@2.128.1) (2022-08-19)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * fix menu prefetch in standalone apps ([e96b0cf](https://github.com/easyops-cn/next-core/commit/e96b0cfbe973a285ec6f8b5ceb2d8a3e638210bb))
12
+ * support setting standalone app root ([8e0d3e4](https://github.com/easyops-cn/next-core/commit/8e0d3e49c2c2b93f2b05de4a857c6c6724f27b82))
13
+
14
+
15
+
16
+
17
+
6
18
  # [2.128.0](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.127.3...@next-core/brick-kit@2.128.0) (2022-08-18)
7
19
 
8
20
 
@@ -3011,30 +3011,30 @@
3011
3011
  return _constructMenu.apply(this, arguments);
3012
3012
  }
3013
3013
 
3014
- function constructMenuByMenusList(_x4, _x5, _x6) {
3015
- return _constructMenuByMenusList.apply(this, arguments);
3014
+ function preConstructMenus(_x4, _x5, _x6) {
3015
+ return _preConstructMenus.apply(this, arguments);
3016
3016
  }
3017
3017
 
3018
- function _constructMenuByMenusList() {
3019
- _constructMenuByMenusList = _asyncToGenerator__default["default"](function* (menus, context, kernel) {
3020
- var data = yield Promise.all(menus.map(menuId => processMenu(menuId, context, kernel)));
3018
+ function _preConstructMenus() {
3019
+ _preConstructMenus = _asyncToGenerator__default["default"](function* (menus, context, kernel) {
3020
+ var data = yield Promise.all(menus.map(menuId => processMenu(menuId, context, kernel, undefined, true)));
3021
3021
  data.forEach((item, index) => processMenuCache.set(menus[index], item));
3022
3022
  });
3023
- return _constructMenuByMenusList.apply(this, arguments);
3023
+ return _preConstructMenus.apply(this, arguments);
3024
3024
  }
3025
3025
 
3026
3026
  var getMenu = menuId => processMenuCache.get(menuId);
3027
- function fetchMenuById(_x7, _x8) {
3027
+ function fetchMenuById(_x7, _x8, _x9) {
3028
3028
  return _fetchMenuById.apply(this, arguments);
3029
3029
  }
3030
3030
 
3031
3031
  function _fetchMenuById() {
3032
- _fetchMenuById = _asyncToGenerator__default["default"](function* (menuId, kernel) {
3032
+ _fetchMenuById = _asyncToGenerator__default["default"](function* (menuId, kernel, isPreFetch) {
3033
3033
  if (menuCache.has(menuId)) {
3034
3034
  return menuCache.get(menuId);
3035
3035
  }
3036
3036
 
3037
- var menuList = window.STANDALONE_MICRO_APPS ? kernel.getStandaloneMenus(menuId) : (yield InstanceApi_postSearch("EASYOPS_STORYBOARD_MENU", {
3037
+ var menuList = window.STANDALONE_MICRO_APPS ? kernel.getStandaloneMenus(menuId, isPreFetch) : (yield InstanceApi_postSearch("EASYOPS_STORYBOARD_MENU", {
3038
3038
  page: 1,
3039
3039
  page_size: 200,
3040
3040
  fields: {
@@ -3130,7 +3130,7 @@
3130
3130
  });
3131
3131
  }
3132
3132
 
3133
- function loadDynamicMenuItems(_x9) {
3133
+ function loadDynamicMenuItems(_x10) {
3134
3134
  return _loadDynamicMenuItems.apply(this, arguments);
3135
3135
  }
3136
3136
 
@@ -3148,13 +3148,13 @@
3148
3148
  return _loadDynamicMenuItems.apply(this, arguments);
3149
3149
  }
3150
3150
 
3151
- function processMenu(_x10, _x11, _x12, _x13) {
3151
+ function processMenu(_x11, _x12, _x13, _x14, _x15) {
3152
3152
  return _processMenu.apply(this, arguments);
3153
3153
  }
3154
3154
 
3155
3155
  function _processMenu() {
3156
- _processMenu = _asyncToGenerator__default["default"](function* (menuId, context, kernel, hasSubMenu) {
3157
- var _yield$fetchMenuById = yield fetchMenuById(menuId, kernel),
3156
+ _processMenu = _asyncToGenerator__default["default"](function* (menuId, context, kernel, hasSubMenu, isPreFetch) {
3157
+ var _yield$fetchMenuById = yield fetchMenuById(menuId, kernel, isPreFetch),
3158
3158
  {
3159
3159
  items,
3160
3160
  app
@@ -3207,19 +3207,19 @@
3207
3207
  });
3208
3208
  });
3209
3209
 
3210
- return function (_x14) {
3210
+ return function (_x16) {
3211
3211
  return _ref2.apply(this, arguments);
3212
3212
  };
3213
3213
  }()));
3214
3214
  }
3215
3215
 
3216
- function processMenuTitle(_x15) {
3216
+ function processMenuTitle(_x17) {
3217
3217
  return _processMenuTitle.apply(this, arguments);
3218
3218
  }
3219
3219
 
3220
3220
  function _processMenuTitle() {
3221
3221
  _processMenuTitle = _asyncToGenerator__default["default"](function* (menuData) {
3222
- if (menuData.title || !menuData.titleDataSource) {
3222
+ if (menuData.title || _.isEmpty(menuData.titleDataSource)) {
3223
3223
  return menuData.title;
3224
3224
  }
3225
3225
 
@@ -3308,7 +3308,7 @@
3308
3308
  return false;
3309
3309
  }
3310
3310
 
3311
- function computeRealValueWithOverrideApp(_x16, _x17, _x18, _x19) {
3311
+ function computeRealValueWithOverrideApp(_x18, _x19, _x20, _x21) {
3312
3312
  return _computeRealValueWithOverrideApp.apply(this, arguments);
3313
3313
  }
3314
3314
 
@@ -9521,10 +9521,11 @@
9521
9521
  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);
9522
9522
  }
9523
9523
 
9524
- getStandaloneMenus(menuId) {
9524
+ getStandaloneMenus(menuId, isPreFetch) {
9525
9525
  var _currentStoryboard$me, _currentStoryboard$me2;
9526
9526
 
9527
- var currentAppId = this.currentApp.id;
9527
+ var app = isPreFetch ? this.nextApp : this.currentApp;
9528
+ var currentAppId = app.id;
9528
9529
  var currentStoryboard = this.bootstrapData.storyboards.find(storyboard => storyboard.app.id === currentAppId);
9529
9530
  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) : [];
9530
9531
  return menus.filter(menu => menu.menuId === menuId).map(menu => {
@@ -10955,7 +10956,7 @@
10955
10956
  var useMenus = brickUtils.scanAppGetMenuInAny(data);
10956
10957
 
10957
10958
  if (useMenus.length) {
10958
- yield constructMenuByMenusList(useMenus, _this7.getCurrentContext(), _this7.kernel);
10959
+ yield preConstructMenus(useMenus, _this7.getCurrentContext(), _this7.kernel);
10959
10960
  }
10960
10961
  })();
10961
10962
  }