@next-core/brick-kit 2.171.4 → 2.173.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,54 @@ 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, params, 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), _objectSpread(_objectSpread({}, options), {}, {
516
+ params
517
+ }))).data
518
+ );
519
+ });
520
+ return function InstalledMicroAppApi_getMenusInfo(_x, _x2, _x3) {
521
+ return _ref.apply(this, arguments);
522
+ };
523
+ }();
524
+
525
+ /** 微应用的i18n信息 */
526
+
527
+ /**
528
+ * @description 获取微应用的i18n数据
529
+ * @endpoint GET /api/v1/micro-app/i18n
530
+ */
531
+ var InstalledMicroAppApi_getI18NData = /*#__PURE__*/function () {
532
+ var _ref = _asyncToGenerator$3(function* (params, options) {
533
+ 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), {}, {
534
+ params
535
+ }))).data
536
+ );
537
+ });
538
+ return function InstalledMicroAppApi_getI18NData(_x, _x2) {
539
+ return _ref.apply(this, arguments);
540
+ };
541
+ }();
542
+
543
+ /**
544
+ * @description 校验系统权限
545
+ * @endpoint POST /api/micro_app/v1/permission/validate
546
+ */
547
+ var PermissionApi_validatePermissions = /*#__PURE__*/function () {
548
+ var _ref = _asyncToGenerator$3(function* (data, options) {
549
+ 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
550
+ );
551
+ });
552
+ return function PermissionApi_validatePermissions(_x, _x2) {
553
+ return _ref.apply(this, arguments);
554
+ };
555
+ }();
556
+
509
557
  function supply(attemptToVisitGlobals, providedGlobalVariables, mock) {
510
558
  var globalVariables = _objectSpread({}, providedGlobalVariables);
511
559
  // Allow limited browser builtin values.
@@ -1232,38 +1280,6 @@ function i18nText(data) {
1232
1280
  }
1233
1281
  }
1234
1282
 
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
1283
  var auth = {};
1268
1284
 
1269
1285
  /** @internal */
@@ -2941,7 +2957,9 @@ function _fetchMenuById() {
2941
2957
  if (menuCache.has(menuId)) {
2942
2958
  return menuCache.get(menuId);
2943
2959
  }
2944
- var menuList = window.STANDALONE_MICRO_APPS ? yield kernel.getStandaloneMenus(menuId, isPreFetch) : (yield InstanceApi_postSearch("EASYOPS_STORYBOARD_MENU", {
2960
+ var menuList = window.STANDALONE_MICRO_APPS ? yield kernel.getStandaloneMenus(menuId, isPreFetch) : kernel.getFeatureFlags()["three-level-menu-layout"] ? (yield InstalledMicroAppApi_getMenusInfo(menuId, {
2961
+ menuObjectId: "EASYOPS_STORYBOARD_MENU"
2962
+ })).menus : (yield InstanceApi_postSearch("EASYOPS_STORYBOARD_MENU", {
2945
2963
  page: 1,
2946
2964
  page_size: 200,
2947
2965
  fields: {
@@ -3090,6 +3108,26 @@ function _loadDynamicMenuItems() {
3090
3108
  });
3091
3109
  return _loadDynamicMenuItems.apply(this, arguments);
3092
3110
  }
3111
+ function walkMenuItems(menuItems) {
3112
+ return menuItems === null || menuItems === void 0 ? void 0 : menuItems.filter(
3113
+ // `if` is already evaluated.
3114
+ looseCheckIfOfComputed).map(item => {
3115
+ var children = walkMenuItems(item.children);
3116
+ return item.type === "group" ? {
3117
+ type: "group",
3118
+ childLayout: item.childLayout,
3119
+ title: item.text,
3120
+ items: children
3121
+ } : children !== null && children !== void 0 && children.length ? {
3122
+ type: "subMenu",
3123
+ childLayout: item.childLayout,
3124
+ title: item.text,
3125
+ icon: item.icon,
3126
+ items: children,
3127
+ defaultExpanded: item.defaultExpanded
3128
+ } : item;
3129
+ });
3130
+ }
3093
3131
  function processMenu(_x15, _x16, _x17, _x18, _x19) {
3094
3132
  return _processMenu.apply(this, arguments);
3095
3133
  }
@@ -3117,25 +3155,7 @@ function _processMenu() {
3117
3155
  title: yield processMenuTitle(menuData),
3118
3156
  icon: menuData.icon,
3119
3157
  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
- }),
3158
+ menuItems: walkMenuItems(menuData.items),
3139
3159
  defaultCollapsed: menuData.defaultCollapsed || hasSubMenu,
3140
3160
  defaultCollapsedBreakpoint: menuData.defaultCollapsedBreakpoint
3141
3161
  };
@@ -3258,6 +3278,9 @@ function computeRealValueWithOverrideApp(_x22, _x23, _x24, _x25) {
3258
3278
  }
3259
3279
  function _computeRealValueWithOverrideApp() {
3260
3280
  _computeRealValueWithOverrideApp = _asyncToGenerator$3(function* (data, overrideAppId, context, kernel) {
3281
+ if ("if" in data && data.if === null) {
3282
+ delete data.if;
3283
+ }
3261
3284
  var newContext = context;
3262
3285
  if (overrideAppId !== context.app.id && attemptToVisit(data, ["APP", "I18N", "IMG"])) {
3263
3286
  if (window.STANDALONE_MICRO_APPS) {
@@ -9499,7 +9522,9 @@ class Kernel {
9499
9522
  });
9500
9523
  if (!filterMenus.length) {
9501
9524
  var _ref6, _yield$InstanceApi_po;
9502
- filterMenus = (_ref6 = (_yield$InstanceApi_po = yield InstanceApi_postSearch("STANDALONE_MENU@EASYOPS", {
9525
+ filterMenus = (_ref6 = _this12.getFeatureFlags()["three-level-menu-layout"] ? (yield InstalledMicroAppApi_getMenusInfo(menuId, {
9526
+ menuObjectId: "STANDALONE_MENU@EASYOPS"
9527
+ })).menus : (_yield$InstanceApi_po = yield InstanceApi_postSearch("STANDALONE_MENU@EASYOPS", {
9503
9528
  page: 1,
9504
9529
  page_size: 200,
9505
9530
  fields: {