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