@antscorp/antsomi-ui 1.3.5-beta.582 → 1.3.5-beta.584

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.
@@ -1,5 +1,6 @@
1
- import { MENU_CODE, APP_ROLE_SCOPE, MENU_PERMISSIONS, DUPLICATE_PERMISSION_MENU_CODES, } from '../constants';
1
+ import { MENU_CODE, APP_ROLE_SCOPE, MENU_PERMISSIONS } from '../constants';
2
2
  import { isEmpty } from 'lodash';
3
+ import { MAP_MENU_TO_PARENT_APP_CODE } from '../../../organism/LeftMenu/constants';
3
4
  const EDIT_ROLE = new Set(['CREATE', 'UPDATE', 'DELETE']);
4
5
  /**
5
6
  *
@@ -51,7 +52,7 @@ export const checkingRoleScope = (args) => {
51
52
  return isOK;
52
53
  };
53
54
  export const hasSelectAccountPermission = (args) => {
54
- const { activeItemPath, flattenPermissionList, menuListPermission, appItem } = args;
55
+ const { activeItemPath, flattenPermissionList, menuListPermission } = args;
55
56
  if (isEmpty(activeItemPath))
56
57
  return false;
57
58
  let roleScope = false;
@@ -74,20 +75,10 @@ export const hasSelectAccountPermission = (args) => {
74
75
  }
75
76
  const menuPermission = (() => {
76
77
  var _a;
77
- if (DUPLICATE_PERMISSION_MENU_CODES.includes(activeItem.menu_item_code)) {
78
- if (appItem) {
79
- const appPermission = (() => {
80
- switch (appItem === null || appItem === void 0 ? void 0 : appItem.permission_code) {
81
- case 'SQL_WORKSPACE':
82
- return 'APP_ANTALYSER';
83
- default:
84
- return appItem === null || appItem === void 0 ? void 0 : appItem.permission_code;
85
- }
86
- })();
87
- const parentMenu = menuListPermission === null || menuListPermission === void 0 ? void 0 : menuListPermission.find(item => item.app_code === appPermission);
88
- return (_a = parentMenu === null || parentMenu === void 0 ? void 0 : parentMenu.childs) === null || _a === void 0 ? void 0 : _a.find(item => item.menu_code === permissionCode);
89
- }
90
- return;
78
+ const parentAppCode = MAP_MENU_TO_PARENT_APP_CODE[activeItem.menu_item_code];
79
+ if (parentAppCode) {
80
+ const parentMenu = menuListPermission === null || menuListPermission === void 0 ? void 0 : menuListPermission.find(item => item.app_code === parentAppCode);
81
+ return (_a = parentMenu === null || parentMenu === void 0 ? void 0 : parentMenu.childs) === null || _a === void 0 ? void 0 : _a.find(item => item.menu_code === permissionCode);
91
82
  }
92
83
  return flattenPermissionList === null || flattenPermissionList === void 0 ? void 0 : flattenPermissionList.find(item => permissionCode === item.menu_code);
93
84
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.5-beta.582",
3
+ "version": "1.3.5-beta.584",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",