@next-core/brick-kit 2.171.4 → 2.172.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
@@ -506,6 +506,52 @@ var InstanceApi_postSearch = /*#__PURE__*/function () {
506
506
  };
507
507
  }();
508
508
 
509
+ /**
510
+ * @description 获取菜单信息
511
+ * @endpoint GET /api/v1/micro-app/menus/:menuId
512
+ */
513
+ var InstalledMicroAppApi_getMenusInfo = /*#__PURE__*/function () {
514
+ var _ref = _asyncToGenerator$3(function* (menuId, options) {
515
+ return (/**! @contract easyops.api.micro_app.installed_micro_app.GetMenusInfo@1.0.0 */(yield http.get("api/gateway/micro_app.installed_micro_app.GetMenusInfo/api/v1/micro-app/menus/".concat(menuId), options)).data
516
+ );
517
+ });
518
+ return function InstalledMicroAppApi_getMenusInfo(_x, _x2) {
519
+ return _ref.apply(this, arguments);
520
+ };
521
+ }();
522
+
523
+ /** 微应用的i18n信息 */
524
+
525
+ /**
526
+ * @description 获取微应用的i18n数据
527
+ * @endpoint GET /api/v1/micro-app/i18n
528
+ */
529
+ var InstalledMicroAppApi_getI18NData = /*#__PURE__*/function () {
530
+ var _ref = _asyncToGenerator$3(function* (params, options) {
531
+ return (/**! @contract easyops.api.micro_app.installed_micro_app.GetI18NData@1.0.0 */(yield http.get("api/gateway/micro_app.installed_micro_app.GetI18NData/api/v1/micro-app/i18n", _objectSpread(_objectSpread({}, options), {}, {
532
+ params
533
+ }))).data
534
+ );
535
+ });
536
+ return function InstalledMicroAppApi_getI18NData(_x, _x2) {
537
+ return _ref.apply(this, arguments);
538
+ };
539
+ }();
540
+
541
+ /**
542
+ * @description 校验系统权限
543
+ * @endpoint POST /api/micro_app/v1/permission/validate
544
+ */
545
+ var PermissionApi_validatePermissions = /*#__PURE__*/function () {
546
+ var _ref = _asyncToGenerator$3(function* (data, options) {
547
+ return (/**! @contract easyops.api.micro_app.permission.ValidatePermissions@1.0.0 */(yield http.post("api/gateway/micro_app.permission.ValidatePermissions/api/micro_app/v1/permission/validate", data, options)).data
548
+ );
549
+ });
550
+ return function PermissionApi_validatePermissions(_x, _x2) {
551
+ return _ref.apply(this, arguments);
552
+ };
553
+ }();
554
+
509
555
  function supply(attemptToVisitGlobals, providedGlobalVariables, mock) {
510
556
  var globalVariables = _objectSpread({}, providedGlobalVariables);
511
557
  // Allow limited browser builtin values.
@@ -1232,38 +1278,6 @@ function i18nText(data) {
1232
1278
  }
1233
1279
  }
1234
1280
 
1235
- /**
1236
- * @description 获取微应用的i18n数据
1237
- * @endpoint GET /api/v1/micro-app/i18n
1238
- */
1239
- var InstalledMicroAppApi_getI18NData = /*#__PURE__*/function () {
1240
- var _ref = _asyncToGenerator$3(function* (params, options) {
1241
- return (/**! @contract easyops.api.micro_app.installed_micro_app.GetI18NData@1.0.0 */
1242
- (yield http.get("api/gateway/micro_app.installed_micro_app.GetI18NData/api/v1/micro-app/i18n", _objectSpread(_objectSpread({}, options), {}, {
1243
- params
1244
- }))).data
1245
- );
1246
- });
1247
- return function InstalledMicroAppApi_getI18NData(_x, _x2) {
1248
- return _ref.apply(this, arguments);
1249
- };
1250
- }();
1251
-
1252
- /**
1253
- * @description 校验系统权限
1254
- * @endpoint POST /api/micro_app/v1/permission/validate
1255
- */
1256
- var PermissionApi_validatePermissions = /*#__PURE__*/function () {
1257
- var _ref = _asyncToGenerator$3(function* (data, options) {
1258
- return (/**! @contract easyops.api.micro_app.permission.ValidatePermissions@1.0.0 */
1259
- (yield http.post("api/gateway/micro_app.permission.ValidatePermissions/api/micro_app/v1/permission/validate", data, options)).data
1260
- );
1261
- });
1262
- return function PermissionApi_validatePermissions(_x, _x2) {
1263
- return _ref.apply(this, arguments);
1264
- };
1265
- }();
1266
-
1267
1281
  var auth = {};
1268
1282
 
1269
1283
  /** @internal */
@@ -2941,7 +2955,7 @@ function _fetchMenuById() {
2941
2955
  if (menuCache.has(menuId)) {
2942
2956
  return menuCache.get(menuId);
2943
2957
  }
2944
- var menuList = window.STANDALONE_MICRO_APPS ? yield kernel.getStandaloneMenus(menuId, isPreFetch) : (yield InstanceApi_postSearch("EASYOPS_STORYBOARD_MENU", {
2958
+ var menuList = window.STANDALONE_MICRO_APPS ? yield kernel.getStandaloneMenus(menuId, isPreFetch) : kernel.getFeatureFlags()["three-level-menu-layout"] ? (yield InstalledMicroAppApi_getMenusInfo(menuId)).menus : (yield InstanceApi_postSearch("EASYOPS_STORYBOARD_MENU", {
2945
2959
  page: 1,
2946
2960
  page_size: 200,
2947
2961
  fields: {
@@ -3090,6 +3104,24 @@ function _loadDynamicMenuItems() {
3090
3104
  });
3091
3105
  return _loadDynamicMenuItems.apply(this, arguments);
3092
3106
  }
3107
+ function walkMenuItems(menuItems) {
3108
+ return menuItems === null || menuItems === void 0 ? void 0 : menuItems.filter(
3109
+ // `if` is already evaluated.
3110
+ looseCheckIfOfComputed).map(item => {
3111
+ var children = walkMenuItems(item.children);
3112
+ return item.type === "group" ? {
3113
+ type: "group",
3114
+ title: item.text,
3115
+ items: children
3116
+ } : children !== null && children !== void 0 && children.length ? {
3117
+ type: "subMenu",
3118
+ title: item.text,
3119
+ icon: item.icon,
3120
+ items: children,
3121
+ defaultExpanded: item.defaultExpanded
3122
+ } : item;
3123
+ });
3124
+ }
3093
3125
  function processMenu(_x15, _x16, _x17, _x18, _x19) {
3094
3126
  return _processMenu.apply(this, arguments);
3095
3127
  }
@@ -3117,25 +3149,7 @@ function _processMenu() {
3117
3149
  title: yield processMenuTitle(menuData),
3118
3150
  icon: menuData.icon,
3119
3151
  link: menuData.link,
3120
- menuItems: menuData.items.filter(
3121
- // `if` is already evaluated.
3122
- looseCheckIfOfComputed).map(item => {
3123
- var _item$children;
3124
- var children = (_item$children = item.children) === null || _item$children === void 0 ? void 0 : _item$children.filter(
3125
- // `if` is already evaluated.
3126
- looseCheckIfOfComputed);
3127
- return item.type === "group" ? {
3128
- type: "group",
3129
- title: item.text,
3130
- items: children
3131
- } : children !== null && children !== void 0 && children.length ? {
3132
- type: "subMenu",
3133
- title: item.text,
3134
- icon: item.icon,
3135
- items: children,
3136
- defaultExpanded: item.defaultExpanded
3137
- } : item;
3138
- }),
3152
+ menuItems: walkMenuItems(menuData.items),
3139
3153
  defaultCollapsed: menuData.defaultCollapsed || hasSubMenu,
3140
3154
  defaultCollapsedBreakpoint: menuData.defaultCollapsedBreakpoint
3141
3155
  };