@antscorp/antsomi-ui 1.3.5-beta.189 → 1.3.5-beta.190
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/es/components/organism/LeftMenu/components/ContentMenu/index.js +3 -1
- package/es/components/organism/LeftMenu/components/DataMenu/index.js +3 -1
- package/es/components/organism/LeftMenu/components/HomeMenu/index.js +2 -1
- package/es/components/organism/LeftMenu/components/InsightsMenu/index.js +3 -1
- package/es/components/organism/LeftMenu/components/MarketingMenu/constants.d.ts +4 -0
- package/es/components/organism/LeftMenu/components/MarketingMenu/constants.js +1 -0
- package/es/components/organism/LeftMenu/components/MarketingMenu/index.js +3 -1
- package/es/components/organism/LeftMenu/components/MarketingMenu/useMarketingMenu.js +5 -5
- package/es/components/organism/LeftMenu/components/ProfilesMenu/index.js +3 -1
- package/es/components/organism/LeftMenu/components/SettingsMenu/index.js +3 -1
- package/es/components/organism/LeftMenu/components/TemplatesMenu/index.js +3 -1
- package/es/components/organism/LeftMenu/components/common/ChildMenu/index.d.ts +1 -0
- package/es/components/organism/LeftMenu/components/common/ChildMenu/index.js +6 -2
- package/es/components/organism/LeftMenu/hooks/useLeftMenu.d.ts +1 -1
- package/es/components/organism/LeftMenu/hooks/useLeftMenu.js +24 -12
- package/es/components/organism/LeftMenu/index.js +8 -6
- package/es/components/organism/LeftMenu/stores/index.d.ts +1 -0
- package/es/components/organism/LeftMenu/stores/index.js +1 -0
- package/es/components/organism/LeftMenu/stores/useLeftMenuStore.d.ts +9 -0
- package/es/components/organism/LeftMenu/stores/useLeftMenuStore.js +11 -0
- package/es/components/organism/LeftMenu/utils/index.js +3 -3
- package/es/components/template/Layout/styled.js +4 -0
- package/package.json +4 -2
|
@@ -4,7 +4,9 @@ import React, { memo } from 'react';
|
|
|
4
4
|
import { ChildMenu } from '../common';
|
|
5
5
|
// Hooks
|
|
6
6
|
import { useContentMenu } from './useContentMenu';
|
|
7
|
+
// Constants
|
|
8
|
+
import { FEATURE_KEYS } from '../../constants';
|
|
7
9
|
export const ContentMenu = memo(() => {
|
|
8
10
|
const { children } = useContentMenu();
|
|
9
|
-
return React.createElement(ChildMenu, { items: children });
|
|
11
|
+
return React.createElement(ChildMenu, { items: children, parentKey: FEATURE_KEYS.CONTENT });
|
|
10
12
|
});
|
|
@@ -4,7 +4,9 @@ import React, { memo } from 'react';
|
|
|
4
4
|
import { ChildMenu } from '../common';
|
|
5
5
|
// Hooks
|
|
6
6
|
import { useDataMenu } from './useDataMenu';
|
|
7
|
+
// Constants
|
|
8
|
+
import { FEATURE_KEYS } from '../../constants';
|
|
7
9
|
export const DataMenu = memo(() => {
|
|
8
10
|
const { children } = useDataMenu();
|
|
9
|
-
return React.createElement(ChildMenu, { items: children });
|
|
11
|
+
return React.createElement(ChildMenu, { items: children, parentKey: FEATURE_KEYS.DATA });
|
|
10
12
|
});
|
|
@@ -5,6 +5,7 @@ import { ChildMenu } from '../common';
|
|
|
5
5
|
import { Flex } from '../../../../atoms';
|
|
6
6
|
// Constants
|
|
7
7
|
import Icon from '@antscorp/icons';
|
|
8
|
+
import { FEATURE_KEYS } from '../../constants';
|
|
8
9
|
// Styled
|
|
9
10
|
import { CreateButton, HomeMenuWrapper } from './styled';
|
|
10
11
|
// Hooks
|
|
@@ -18,5 +19,5 @@ export const HomeMenu = memo(() => {
|
|
|
18
19
|
React.createElement(Icon, { type: "icon-ants-plus-slim", style: { fontSize: 14 } }),
|
|
19
20
|
React.createElement("span", null, "Create"))),
|
|
20
21
|
React.createElement("div", { className: "menu-list" },
|
|
21
|
-
React.createElement(ChildMenu, { items: children, onMenuClick: onMenuClick }))));
|
|
22
|
+
React.createElement(ChildMenu, { items: children, parentKey: FEATURE_KEYS.HOME, onMenuClick: onMenuClick }))));
|
|
22
23
|
});
|
|
@@ -4,7 +4,9 @@ import React, { memo } from 'react';
|
|
|
4
4
|
import { ChildMenu } from '../common';
|
|
5
5
|
// Contexts
|
|
6
6
|
import { useInsightsMenu } from './useInsightsMenu';
|
|
7
|
+
// Constants
|
|
8
|
+
import { FEATURE_KEYS } from '../../constants';
|
|
7
9
|
export const InsightsMenu = memo(() => {
|
|
8
10
|
const { children } = useInsightsMenu();
|
|
9
|
-
return React.createElement(ChildMenu, { items: children });
|
|
11
|
+
return React.createElement(ChildMenu, { items: children, parentKey: FEATURE_KEYS.INSIGHTS });
|
|
10
12
|
});
|
|
@@ -4,7 +4,9 @@ import React, { memo } from 'react';
|
|
|
4
4
|
import { ChildMenu } from '../common';
|
|
5
5
|
// Hooks
|
|
6
6
|
import { useMarketingMenu } from './useMarketingMenu';
|
|
7
|
+
// Constants
|
|
8
|
+
import { FEATURE_KEYS } from '../../constants';
|
|
7
9
|
export const MarketingMenu = memo(() => {
|
|
8
10
|
const { children } = useMarketingMenu();
|
|
9
|
-
return React.createElement(ChildMenu, { items: children });
|
|
11
|
+
return React.createElement(ChildMenu, { items: children, parentKey: FEATURE_KEYS.MARKETING });
|
|
10
12
|
});
|
|
@@ -10,7 +10,7 @@ import { useGetDestinationChannel } from '@antscorp/antsomi-ui/es/queries/LeftMe
|
|
|
10
10
|
// Utils
|
|
11
11
|
import { getGeneratePath, getMenuItem } from '../../utils';
|
|
12
12
|
// Constants
|
|
13
|
-
import { MARKETING_ROUTES } from './constants';
|
|
13
|
+
import { CHANNEL_KEY, MARKETING_ROUTES } from './constants';
|
|
14
14
|
export const useMarketingMenu = () => {
|
|
15
15
|
// Contexts
|
|
16
16
|
const appConfig = useContextSelector(AppConfigContext, state => state);
|
|
@@ -34,21 +34,21 @@ export const useMarketingMenu = () => {
|
|
|
34
34
|
});
|
|
35
35
|
// Memos
|
|
36
36
|
const customChildren = useMemo(() => featureChildren === null || featureChildren === void 0 ? void 0 : featureChildren.map(item => {
|
|
37
|
-
var _a;
|
|
37
|
+
var _a, _b;
|
|
38
38
|
let children = [];
|
|
39
39
|
switch (item.menu_item_code) {
|
|
40
40
|
case 'ALL_CHANNEL':
|
|
41
|
-
item.menu_item_path = getGeneratePath(MARKETING_ROUTES.CHANNEL, Object.assign(Object.assign({}, auth), { channelId:
|
|
41
|
+
item.menu_item_path = getGeneratePath(MARKETING_ROUTES.CHANNEL, Object.assign(Object.assign({}, auth), { channelId: CHANNEL_KEY.ALL_CHANNEL }));
|
|
42
42
|
break;
|
|
43
43
|
case 'ORCHESTRATION':
|
|
44
|
-
item.menu_item_path = getGeneratePath(MARKETING_ROUTES.CHANNEL, Object.assign(Object.assign({}, auth), { channelId:
|
|
44
|
+
item.menu_item_path = getGeneratePath(MARKETING_ROUTES.CHANNEL, Object.assign(Object.assign({}, auth), { channelId: CHANNEL_KEY.ORCHESTRATION }));
|
|
45
45
|
break;
|
|
46
46
|
default:
|
|
47
47
|
break;
|
|
48
48
|
}
|
|
49
49
|
if ((item === null || item === void 0 ? void 0 : item.render_option) === 'destination_channel') {
|
|
50
50
|
children =
|
|
51
|
-
((_a = destinationChannel === null || destinationChannel === void 0 ? void 0 : destinationChannel.entries) === null || _a === void 0 ? void 0 : _a.map(item => ({
|
|
51
|
+
((_b = (_a = destinationChannel === null || destinationChannel === void 0 ? void 0 : destinationChannel.entries) === null || _a === void 0 ? void 0 : _a.filter(item => item.channelId !== CHANNEL_KEY.ORCHESTRATION)) === null || _b === void 0 ? void 0 : _b.map(item => ({
|
|
52
52
|
menu_item_code: item.channelCode,
|
|
53
53
|
menu_item_name: item.translateLabel,
|
|
54
54
|
logo_url: item.logoUrl,
|
|
@@ -4,7 +4,9 @@ import React, { memo } from 'react';
|
|
|
4
4
|
import { ChildMenu } from '../common';
|
|
5
5
|
// Hooks
|
|
6
6
|
import { useProfilesMenu } from './useProfilesMenu';
|
|
7
|
+
// Constants
|
|
8
|
+
import { FEATURE_KEYS } from '../../constants';
|
|
7
9
|
export const ProfilesMenu = memo(() => {
|
|
8
10
|
const { children } = useProfilesMenu();
|
|
9
|
-
return React.createElement(ChildMenu, { items: children });
|
|
11
|
+
return React.createElement(ChildMenu, { items: children, parentKey: FEATURE_KEYS.PROFILES });
|
|
10
12
|
});
|
|
@@ -4,7 +4,9 @@ import React, { memo } from 'react';
|
|
|
4
4
|
import { ChildMenu } from '../common';
|
|
5
5
|
// Hooks
|
|
6
6
|
import { useSettingsMenu } from './useSettingsMenu';
|
|
7
|
+
// Constants
|
|
8
|
+
import { FEATURE_KEYS } from '../../constants';
|
|
7
9
|
export const SettingsMenu = memo(() => {
|
|
8
10
|
const { children } = useSettingsMenu();
|
|
9
|
-
return React.createElement(ChildMenu, { items: children });
|
|
11
|
+
return React.createElement(ChildMenu, { items: children, parentKey: FEATURE_KEYS.SETTINGS });
|
|
10
12
|
});
|
|
@@ -4,7 +4,9 @@ import React, { memo } from 'react';
|
|
|
4
4
|
import { ChildMenu } from '../common';
|
|
5
5
|
// Hooks
|
|
6
6
|
import { useTemplatesMenu } from './useTemplatesMenu';
|
|
7
|
+
// Constants
|
|
8
|
+
import { FEATURE_KEYS } from '../../constants';
|
|
7
9
|
export const TemplatesMenu = memo(() => {
|
|
8
10
|
const { children } = useTemplatesMenu();
|
|
9
|
-
return React.createElement(ChildMenu, { items: children });
|
|
11
|
+
return React.createElement(ChildMenu, { items: children, parentKey: FEATURE_KEYS.TEMPLATES });
|
|
10
12
|
});
|
|
@@ -17,11 +17,13 @@ import { ENV } from '@antscorp/antsomi-ui/es/config';
|
|
|
17
17
|
import { AppConfigContext } from '@antscorp/antsomi-ui/es/providers';
|
|
18
18
|
// Utils
|
|
19
19
|
import { getGeneratePath } from '../../../utils';
|
|
20
|
+
import { useLeftMenuStore } from '../../../stores';
|
|
20
21
|
export const ChildMenu = memo(props => {
|
|
21
|
-
const { items = [], onMenuClick } = props;
|
|
22
|
+
const { items = [], parentKey, onMenuClick } = props;
|
|
22
23
|
// Selectors
|
|
23
24
|
const auth = useContextSelector(AppConfigContext, state => state === null || state === void 0 ? void 0 : state.auth);
|
|
24
25
|
const env = useContextSelector(AppConfigContext, state => state === null || state === void 0 ? void 0 : state.env);
|
|
26
|
+
const setLeftMenuStoreState = useLeftMenuStore(state => state.setState);
|
|
25
27
|
// States
|
|
26
28
|
const [currentActiveItem, setCurrentActiveItem] = useState('');
|
|
27
29
|
// Hooks
|
|
@@ -52,7 +54,9 @@ export const ChildMenu = memo(props => {
|
|
|
52
54
|
if (activeItem && activeItem !== currentActiveItem) {
|
|
53
55
|
setCurrentActiveItem(activeItem);
|
|
54
56
|
}
|
|
55
|
-
|
|
57
|
+
// Set Active Parent key
|
|
58
|
+
setLeftMenuStoreState({ activeAppCode: parentKey || '' });
|
|
59
|
+
}, [auth, currentActiveItem, hash, items, pathname, search, parentKey, setLeftMenuStoreState]);
|
|
56
60
|
// Handlers
|
|
57
61
|
const onClick = e => {
|
|
58
62
|
onMenuClick === null || onMenuClick === void 0 ? void 0 : onMenuClick(e.key, e.keyPath);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { TFeatureMenu } from '@antscorp/antsomi-ui/es/models/LeftMenu/FeatureMenu';
|
|
3
3
|
interface TState {
|
|
4
|
-
activeItem: string;
|
|
5
4
|
hoverItem: string;
|
|
6
5
|
isExpandMenu: boolean;
|
|
7
6
|
featureChildren: TFeatureMenu[];
|
|
8
7
|
}
|
|
9
8
|
export declare const useLeftMenu: () => {
|
|
10
9
|
state: TState;
|
|
10
|
+
activeAppCode: string;
|
|
11
11
|
permissionMenu: TFeatureMenu[];
|
|
12
12
|
appConfig: import("@antscorp/antsomi-ui/es/providers").AppConfigProviderProps;
|
|
13
13
|
setState: import("react").Dispatch<import("react").SetStateAction<TState>>;
|
|
@@ -7,13 +7,12 @@ import { useLocation } from 'react-router-dom';
|
|
|
7
7
|
import { AppConfigContext } from '@antscorp/antsomi-ui/es/providers';
|
|
8
8
|
// Queries
|
|
9
9
|
import { useGetListMenu, useGetListMenuPermission } from '@antscorp/antsomi-ui/es/queries/LeftMenu';
|
|
10
|
-
// Constants
|
|
11
|
-
import { FEATURE_KEYS } from '../constants';
|
|
12
10
|
// Utils
|
|
13
11
|
import { flattenMenuArray, getGeneratePath, recursivePermissionMenu } from '../utils';
|
|
14
12
|
import isEqual from 'react-fast-compare';
|
|
13
|
+
import { useLeftMenuStore } from '../stores';
|
|
15
14
|
const initialState = {
|
|
16
|
-
activeItem: FEATURE_KEYS.HOME,
|
|
15
|
+
// activeItem: FEATURE_KEYS.HOME,
|
|
17
16
|
hoverItem: '',
|
|
18
17
|
isExpandMenu: true,
|
|
19
18
|
featureChildren: [],
|
|
@@ -27,6 +26,9 @@ export const useLeftMenu = () => {
|
|
|
27
26
|
const { auth, languageCode } = appConfig;
|
|
28
27
|
// State
|
|
29
28
|
const [state, setState] = useState(initialState);
|
|
29
|
+
// NOTES: Trial Zustand
|
|
30
|
+
const activeAppCode = useLeftMenuStore(store => store.state.activeAppCode);
|
|
31
|
+
const setLeftMenuStoreState = useLeftMenuStore(state => state.setState);
|
|
30
32
|
// Queries
|
|
31
33
|
const { data: menuList } = useGetListMenu({
|
|
32
34
|
args: {
|
|
@@ -68,22 +70,30 @@ export const useLeftMenu = () => {
|
|
|
68
70
|
const url = `${pathname}${hash}${search}`;
|
|
69
71
|
const activeItem = (_a = permissionMenu === null || permissionMenu === void 0 ? void 0 : permissionMenu.find(item => !isNil(item === null || item === void 0 ? void 0 : item.menu_item_path) &&
|
|
70
72
|
url.includes(getGeneratePath(item.menu_item_path, appConfig.auth)))) === null || _a === void 0 ? void 0 : _a.menu_item_code;
|
|
71
|
-
if (activeItem && activeItem !==
|
|
72
|
-
|
|
73
|
+
if (activeItem && activeItem !== activeAppCode) {
|
|
74
|
+
setLeftMenuStoreState({ activeAppCode: activeItem });
|
|
73
75
|
}
|
|
74
|
-
}, [
|
|
76
|
+
}, [
|
|
77
|
+
activeAppCode,
|
|
78
|
+
appConfig.auth,
|
|
79
|
+
hash,
|
|
80
|
+
pathname,
|
|
81
|
+
permissionMenu,
|
|
82
|
+
search,
|
|
83
|
+
setLeftMenuStoreState,
|
|
84
|
+
]);
|
|
75
85
|
useEffect(() => {
|
|
76
86
|
var _a;
|
|
77
|
-
if (
|
|
78
|
-
const featureChildren = ((_a = permissionMenu === null || permissionMenu === void 0 ? void 0 : permissionMenu.find(item => item.menu_item_code ===
|
|
87
|
+
if (activeAppCode) {
|
|
88
|
+
const featureChildren = ((_a = permissionMenu === null || permissionMenu === void 0 ? void 0 : permissionMenu.find(item => item.menu_item_code === activeAppCode)) === null || _a === void 0 ? void 0 : _a.children) || [];
|
|
79
89
|
if (!isEqual(featureChildren, state.featureChildren) && !state.hoverItem) {
|
|
80
90
|
setState(prev => {
|
|
81
91
|
var _a;
|
|
82
|
-
return (Object.assign(Object.assign({}, prev), { featureChildren: ((_a = permissionMenu === null || permissionMenu === void 0 ? void 0 : permissionMenu.find(item => item.menu_item_code ===
|
|
92
|
+
return (Object.assign(Object.assign({}, prev), { featureChildren: ((_a = permissionMenu === null || permissionMenu === void 0 ? void 0 : permissionMenu.find(item => item.menu_item_code === activeAppCode)) === null || _a === void 0 ? void 0 : _a.children) || [] }));
|
|
83
93
|
});
|
|
84
94
|
}
|
|
85
95
|
}
|
|
86
|
-
}, [permissionMenu,
|
|
96
|
+
}, [permissionMenu, activeAppCode, state.featureChildren, state.hoverItem]);
|
|
87
97
|
/* Callbacks */
|
|
88
98
|
const onToggleChildMenu = useCallback(() => {
|
|
89
99
|
setState(prev => (Object.assign(Object.assign({}, prev), { isExpandMenu: !prev.isExpandMenu })));
|
|
@@ -93,10 +103,10 @@ export const useLeftMenu = () => {
|
|
|
93
103
|
if (!state.isExpandMenu) {
|
|
94
104
|
const featureChildren = !isNil(children)
|
|
95
105
|
? children
|
|
96
|
-
: ((_a = permissionMenu === null || permissionMenu === void 0 ? void 0 : permissionMenu.find(item => item.menu_item_code ===
|
|
106
|
+
: ((_a = permissionMenu === null || permissionMenu === void 0 ? void 0 : permissionMenu.find(item => item.menu_item_code === activeAppCode)) === null || _a === void 0 ? void 0 : _a.children) || [];
|
|
97
107
|
setState(prev => (Object.assign(Object.assign({}, prev), { hoverItem: key, featureChildren })));
|
|
98
108
|
}
|
|
99
|
-
}, [permissionMenu,
|
|
109
|
+
}, [permissionMenu, activeAppCode, state.isExpandMenu]);
|
|
100
110
|
const onMouseLeave = useCallback(() => {
|
|
101
111
|
if (!state.isExpandMenu) {
|
|
102
112
|
setState(prev => (Object.assign(Object.assign({}, prev), { hoverItem: '' })));
|
|
@@ -105,6 +115,8 @@ export const useLeftMenu = () => {
|
|
|
105
115
|
return {
|
|
106
116
|
/* State */
|
|
107
117
|
state,
|
|
118
|
+
/* Zustand */
|
|
119
|
+
activeAppCode,
|
|
108
120
|
/* Data Queries */
|
|
109
121
|
permissionMenu,
|
|
110
122
|
appConfig,
|
|
@@ -27,13 +27,15 @@ export const LeftMenu = memo(props => {
|
|
|
27
27
|
const {
|
|
28
28
|
/* State */
|
|
29
29
|
state,
|
|
30
|
+
/* Store */
|
|
31
|
+
activeAppCode,
|
|
30
32
|
/* Data Queries */
|
|
31
33
|
permissionMenu, appConfig,
|
|
32
34
|
/* Callbacks */
|
|
33
35
|
onToggleChildMenu, onMouseEnter, onMouseLeave, } = useLeftMenu();
|
|
34
36
|
// Memo
|
|
35
37
|
const childMenu = useMemo(() => {
|
|
36
|
-
const selectedFeatureKey = state.hoverItem ||
|
|
38
|
+
const selectedFeatureKey = state.hoverItem || activeAppCode;
|
|
37
39
|
switch (selectedFeatureKey) {
|
|
38
40
|
case FEATURE_KEYS.HOME: {
|
|
39
41
|
return React.createElement(HomeMenu, null);
|
|
@@ -62,12 +64,12 @@ export const LeftMenu = memo(props => {
|
|
|
62
64
|
default:
|
|
63
65
|
return null;
|
|
64
66
|
}
|
|
65
|
-
}, [
|
|
67
|
+
}, [activeAppCode, state.hoverItem]);
|
|
66
68
|
// Render components
|
|
67
69
|
const renderFeatureMenuItems = (item) => {
|
|
68
70
|
const { menu_item_name, menu_item, icon_name, menu_item_code, menu_item_path, menu_item_domain, children = [], } = item;
|
|
69
71
|
const domain = !isNil(menu_item_domain) && (appConfig === null || appConfig === void 0 ? void 0 : appConfig.env) === ENV.DEV ? menu_item_domain : '';
|
|
70
|
-
const isActive =
|
|
72
|
+
const isActive = activeAppCode === menu_item_code;
|
|
71
73
|
const isHover = state.hoverItem === menu_item_code;
|
|
72
74
|
const labelComponent = () => (React.createElement("li", { role: "menuitem", className: classNames({ isActive, isHover }) },
|
|
73
75
|
React.createElement("div", { className: "icon-wrapper" }, isNil(icon_name) ? null : React.createElement(Icon, { type: icon_name, style: { fontSize: ICON_SIZE } })),
|
|
@@ -76,7 +78,7 @@ export const LeftMenu = memo(props => {
|
|
|
76
78
|
return (React.createElement(FeatureMenuItem, { key: menu_item, onMouseEnter: () => onMouseEnter(menu_item_code, children) }, isString(menu_item_path) ? (React.createElement(Link, { to: getGeneratePath(`${domain}${menu_item_path}`, appConfig === null || appConfig === void 0 ? void 0 : appConfig.auth), className: "menu-link" }, labelComponent())) : (labelComponent())));
|
|
77
79
|
};
|
|
78
80
|
return (React.createElement(LeftMenuProvider, { value: {
|
|
79
|
-
activeItem:
|
|
81
|
+
activeItem: activeAppCode,
|
|
80
82
|
featureChildren: state.featureChildren,
|
|
81
83
|
permissionMenu,
|
|
82
84
|
objectType,
|
|
@@ -86,12 +88,12 @@ export const LeftMenu = memo(props => {
|
|
|
86
88
|
React.createElement(LeftMenuNavWrapper, { style: style, className: className },
|
|
87
89
|
React.createElement(LeftMenuNav, null,
|
|
88
90
|
React.createElement(FeatureMenuWrapper, { isExpandMenu: state.isExpandMenu, vertical: true },
|
|
89
|
-
React.createElement(NavLogoWrapper, { align: "center", justify: "center", onMouseEnter: () => onMouseEnter(
|
|
91
|
+
React.createElement(NavLogoWrapper, { align: "center", justify: "center", onMouseEnter: () => onMouseEnter(activeAppCode) },
|
|
90
92
|
React.createElement("div", { className: "image-wrapper" },
|
|
91
93
|
React.createElement("img", { src: SubLogoAntsomi, alt: "Antsomi sub logo" }))),
|
|
92
94
|
React.createElement(FeatureMenu, { role: "menu", className: "antsomi-scroll-box", onMouseLeave: onMouseLeave },
|
|
93
95
|
React.createElement("div", { className: "menu-content scroll-content" }, (_a = permissionMenu === null || permissionMenu === void 0 ? void 0 : permissionMenu.filter(item => item.menu_item_code !== FEATURE_KEYS.SETTINGS)) === null || _a === void 0 ? void 0 : _a.map(item => renderFeatureMenuItems(item))),
|
|
94
|
-
React.createElement("div", { className: "nav-blank", onMouseEnter: () => onMouseEnter(
|
|
96
|
+
React.createElement("div", { className: "nav-blank", onMouseEnter: () => onMouseEnter(activeAppCode) }),
|
|
95
97
|
React.createElement(PopoverWrapper, { className: "antsomi-scroll-box antsomi-child-menu-popover", onMouseLeave: onMouseLeave },
|
|
96
98
|
React.createElement("div", { className: "scroll-content" }, childMenu))),
|
|
97
99
|
React.createElement("div", { style: { flexShrink: 0 } }, (() => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useLeftMenuStore';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useLeftMenuStore';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface LeftMenuStoreState {
|
|
2
|
+
activeAppCode: string;
|
|
3
|
+
}
|
|
4
|
+
interface LeftMenuStore {
|
|
5
|
+
state: LeftMenuStoreState;
|
|
6
|
+
setState: (state: Partial<LeftMenuStoreState>) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const useLeftMenuStore: import("zustand").UseBoundStore<import("zustand").StoreApi<LeftMenuStore>>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Libraries
|
|
2
|
+
import { create } from 'zustand';
|
|
3
|
+
// Constants
|
|
4
|
+
import { FEATURE_KEYS } from '../constants';
|
|
5
|
+
const initialState = {
|
|
6
|
+
activeAppCode: FEATURE_KEYS.HOME,
|
|
7
|
+
};
|
|
8
|
+
export const useLeftMenuStore = create(set => ({
|
|
9
|
+
state: initialState,
|
|
10
|
+
setState: newState => set(store => ({ state: Object.assign(Object.assign({}, store.state), newState) })),
|
|
11
|
+
}));
|
|
@@ -52,10 +52,10 @@ export const getGeneratePath = (path, params) => {
|
|
|
52
52
|
try {
|
|
53
53
|
return generatePath(path.replace('#', `/${params === null || params === void 0 ? void 0 : params.portalId}#`), {
|
|
54
54
|
user_id: (params === null || params === void 0 ? void 0 : params.userId) || '',
|
|
55
|
-
networkId: (params === null || params === void 0 ? void 0 : params.portalId) || -1,
|
|
56
|
-
portalId: (params === null || params === void 0 ? void 0 : params.portalId) || -1,
|
|
55
|
+
networkId: !isNil(params === null || params === void 0 ? void 0 : params.portalId) ? params === null || params === void 0 ? void 0 : params.portalId : -1,
|
|
56
|
+
portalId: !isNil(params === null || params === void 0 ? void 0 : params.portalId) ? params === null || params === void 0 ? void 0 : params.portalId : -1,
|
|
57
57
|
reportId: (params === null || params === void 0 ? void 0 : params.reportId) || '',
|
|
58
|
-
channelId: (params === null || params === void 0 ? void 0 : params.channelId) || -1,
|
|
58
|
+
channelId: !isNil(params === null || params === void 0 ? void 0 : params.channelId) ? params === null || params === void 0 ? void 0 : params.channelId : -1,
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
61
|
catch (error) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antscorp/antsomi-ui",
|
|
3
|
-
"version": "1.3.5-beta.
|
|
3
|
+
"version": "1.3.5-beta.190",
|
|
4
4
|
"description": "An enterprise-class UI design language and React UI library.",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"dist/*",
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
"not op_mini all"
|
|
61
61
|
],
|
|
62
62
|
"dependencies": {
|
|
63
|
+
"@antscorp/antsomi-ui": "file:.yalc/@antscorp/antsomi-ui",
|
|
63
64
|
"@antscorp/icons": "^0.27.14",
|
|
64
65
|
"@antscorp/image-editor": "1.0.2",
|
|
65
66
|
"@antscorp/processing-notification": "^1.0.0",
|
|
@@ -114,7 +115,8 @@
|
|
|
114
115
|
"tui-image-editor": "^3.15.3",
|
|
115
116
|
"uniqid": "^5.4.0",
|
|
116
117
|
"use-context-selector": "^1.4.4",
|
|
117
|
-
"use-immer": "^0.9.0"
|
|
118
|
+
"use-immer": "^0.9.0",
|
|
119
|
+
"zustand": "^4.5.2"
|
|
118
120
|
},
|
|
119
121
|
"devDependencies": {
|
|
120
122
|
"@ant-design/cssinjs": "^1.6.2",
|