@antscorp/antsomi-ui 1.3.5-beta.436 → 1.3.5-beta.437
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/LeftMenu.js +2 -2
- package/es/components/organism/LeftMenu/components/HomeMenu/useHomeMenu.js +11 -5
- package/es/components/organism/LeftMenu/components/common/ChildMenu/components/MenuItemImage/styled.js +1 -1
- package/es/components/organism/LeftMenu/components/common/ChildMenu/index.js +1 -1
- package/es/components/organism/LeftMenu/hooks/useLeftMenu.js +1 -0
- package/es/components/organism/LeftMenu/utils/index.d.ts +1 -0
- package/es/components/organism/LeftMenu/utils/index.js +16 -7
- package/es/components/template/Layout/components/RecommendationWorkspace/components/MenuMapping/components/OldLeftMenu/index.js +14 -7
- package/es/components/template/Layout/components/RecommendationWorkspace/components/MenuMapping/styled.js +1 -0
- package/es/components/template/Layout/components/RecommendationWorkspace/components/RecommendationImage/index.js +3 -3
- package/es/components/template/Layout/components/RecommendationWorkspace/components/RecommendationImage/styled.d.ts +1 -0
- package/es/components/template/Layout/components/RecommendationWorkspace/components/RecommendationImage/styled.js +16 -5
- package/package.json +1 -1
|
@@ -37,9 +37,9 @@ export const LeftMenuComponent = memo(props => {
|
|
|
37
37
|
return React.createElement(CustomMenu, { isHover: true });
|
|
38
38
|
switch (appActiveKey) {
|
|
39
39
|
case isRecommendation ? 'DASHBOARD' : APP_KEYS.HOME:
|
|
40
|
-
return React.createElement(HomeMenu, { isHover:
|
|
40
|
+
return React.createElement(HomeMenu, { isHover: !isRecommendation });
|
|
41
41
|
default:
|
|
42
|
-
return React.createElement(CommonMenu, { isHover:
|
|
42
|
+
return React.createElement(CommonMenu, { isHover: !isRecommendation });
|
|
43
43
|
}
|
|
44
44
|
}, [isCustomized, isRecommendation, state.hoverItem]);
|
|
45
45
|
const renderFeatureMenuItem = useCallback((item) => {
|
|
@@ -21,9 +21,10 @@ import { useLayoutStore } from '@antscorp/antsomi-ui/es/components/template';
|
|
|
21
21
|
import { useCustomRouter } from '@antscorp/antsomi-ui/es/hooks';
|
|
22
22
|
// Queries
|
|
23
23
|
import { useRemoveDashboard } from '@antscorp/antsomi-ui/es/queries/LeftMenu';
|
|
24
|
+
import { ENV } from '@antscorp/antsomi-ui/es/config';
|
|
24
25
|
export const useHomeMenu = (props) => {
|
|
25
26
|
const { isHover } = props;
|
|
26
|
-
const { pathname, search } = window.location;
|
|
27
|
+
const { pathname, search, origin } = window.location;
|
|
27
28
|
const { navigate, replace } = useCustomRouter();
|
|
28
29
|
const appMenuChildren = useLeftMenuContext(store => store.appMenuChildren);
|
|
29
30
|
const appHoverMenuChildren = useLeftMenuContext(store => store.appHoverMenuChildren);
|
|
@@ -66,11 +67,16 @@ export const useHomeMenu = (props) => {
|
|
|
66
67
|
onClickCreateDashboard(e);
|
|
67
68
|
}
|
|
68
69
|
else {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
if (env !== ENV.DEV && origin !== (CDP_API === null || CDP_API === void 0 ? void 0 : CDP_API[`${env}`])) {
|
|
71
|
+
window.location.assign(`${CDP_API === null || CDP_API === void 0 ? void 0 : CDP_API[`${env}`]}${HOME_ROUTE}?${urlParams.toString()}`);
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
navigate(getGeneratePath(HOME_ROUTE, auth));
|
|
75
|
+
urlParams.set('type', HOME_REPORT_ROUTES.CREATE);
|
|
76
|
+
replace({ search: urlParams.toString() });
|
|
77
|
+
}
|
|
72
78
|
}
|
|
73
|
-
}, [auth, navigate, onClickCreateDashboard, replace, urlParams]);
|
|
79
|
+
}, [auth, env, navigate, onClickCreateDashboard, origin, replace, urlParams]);
|
|
74
80
|
const onMenuClick = useCallback((key, _keyPath) => {
|
|
75
81
|
if (!isRecommendation) {
|
|
76
82
|
const newPathName = getGeneratePath(HOME_REPORT_ROUTES.DETAIL, Object.assign(Object.assign({}, auth), { dashboardId: key }));
|
|
@@ -8,7 +8,7 @@ import { Flex } from '../../../../../../../atoms';
|
|
|
8
8
|
export const MaskImage = styled.div `
|
|
9
9
|
width: ${ICON_SIZE}px;
|
|
10
10
|
height: ${ICON_SIZE}px;
|
|
11
|
-
background:
|
|
11
|
+
background: #595959;
|
|
12
12
|
mask-size: contain;
|
|
13
13
|
mask-position: center center;
|
|
14
14
|
mask-repeat: no-repeat;
|
|
@@ -175,7 +175,7 @@ export const ChildMenu = memo(props => {
|
|
|
175
175
|
style: styles.dropdownMenu,
|
|
176
176
|
}, trigger: ['click'] },
|
|
177
177
|
React.createElement(Icon, { className: "child-menu-item-icon", type: "icon-ants-three-dot-vertical", style: styles.dotIcon })))),
|
|
178
|
-
!(children === null || children === void 0 ? void 0 : children.length) && isRecommendation && !!menu_item_path && (React.createElement(Link, { to: getPath(menu_item_path), className: "icon-link", onClick: e => e.stopPropagation() },
|
|
178
|
+
!(children === null || children === void 0 ? void 0 : children.length) && isRecommendation && !!menu_item_path && (React.createElement(Link, { to: getPath(menu_item_path), className: "icon-link", target: "_blank", onClick: e => e.stopPropagation() },
|
|
179
179
|
React.createElement(Icon, { type: "icon-ants-open-in-new-window" })))));
|
|
180
180
|
const renderIcon = () => {
|
|
181
181
|
var _a;
|
|
@@ -98,6 +98,7 @@ export const useLeftMenu = (props) => {
|
|
|
98
98
|
customActiveAppKey: findActiveAppCodeByChild({
|
|
99
99
|
activeCurrentKey: mappedActiveKey || '',
|
|
100
100
|
menuItems: mappingChildrenMenu === null || mappingChildrenMenu === void 0 ? void 0 : mappingChildrenMenu.map(item => recursiveGetMenuItemByPermission(item)),
|
|
101
|
+
isRecommendation: true,
|
|
101
102
|
}) || '',
|
|
102
103
|
customActiveCurrentKey: mappedActiveKey,
|
|
103
104
|
});
|
|
@@ -103,6 +103,7 @@ export declare const findPathOfActiveItem: (args: {
|
|
|
103
103
|
export declare const findActiveAppCodeByChild: (args: {
|
|
104
104
|
activeCurrentKey: string;
|
|
105
105
|
menuItems: TMenuItem[];
|
|
106
|
+
isRecommendation?: boolean;
|
|
106
107
|
}) => string | undefined;
|
|
107
108
|
export declare const getCustomActiveAppCode: (args: {
|
|
108
109
|
activeKey: string;
|
|
@@ -340,17 +340,26 @@ export const findPathOfActiveItem = (args) => {
|
|
|
340
340
|
*/
|
|
341
341
|
export const findActiveAppCodeByChild = (args) => {
|
|
342
342
|
try {
|
|
343
|
-
const { activeCurrentKey, menuItems } = args;
|
|
343
|
+
const { activeCurrentKey, menuItems, isRecommendation } = args;
|
|
344
344
|
let activeAppCode;
|
|
345
|
-
const recursiveCheckHasActiveChild = (items) => {
|
|
345
|
+
const recursiveCheckHasActiveChild = (items, parentKey) => {
|
|
346
346
|
let matchedAppCode = false;
|
|
347
347
|
for (const item of items) {
|
|
348
|
-
if (
|
|
349
|
-
|
|
350
|
-
|
|
348
|
+
if (isRecommendation && activeCurrentKey.includes('DATASOURCES')) {
|
|
349
|
+
const [activeKey, activeParentKey] = activeCurrentKey.split('-');
|
|
350
|
+
if (item.key === activeKey && parentKey === activeParentKey) {
|
|
351
|
+
matchedAppCode = true;
|
|
352
|
+
break;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
else {
|
|
356
|
+
if (item.key === activeCurrentKey) {
|
|
357
|
+
matchedAppCode = true;
|
|
358
|
+
break;
|
|
359
|
+
}
|
|
351
360
|
}
|
|
352
361
|
if ((item === null || item === void 0 ? void 0 : item.children) && item.children.length) {
|
|
353
|
-
matchedAppCode = recursiveCheckHasActiveChild(item.children);
|
|
362
|
+
matchedAppCode = recursiveCheckHasActiveChild(item.children, item.key);
|
|
354
363
|
if (matchedAppCode) {
|
|
355
364
|
break;
|
|
356
365
|
}
|
|
@@ -363,7 +372,7 @@ export const findActiveAppCodeByChild = (args) => {
|
|
|
363
372
|
activeAppCode = activeCurrentKey;
|
|
364
373
|
break;
|
|
365
374
|
}
|
|
366
|
-
const hasActiveChild = recursiveCheckHasActiveChild((menuItem === null || menuItem === void 0 ? void 0 : menuItem.children) || []);
|
|
375
|
+
const hasActiveChild = recursiveCheckHasActiveChild((menuItem === null || menuItem === void 0 ? void 0 : menuItem.children) || [], menuItem.key);
|
|
367
376
|
if (hasActiveChild) {
|
|
368
377
|
activeAppCode = menuItem.key;
|
|
369
378
|
break;
|
|
@@ -49,25 +49,32 @@ export const OldLeftMenu = memo(props => {
|
|
|
49
49
|
},
|
|
50
50
|
},
|
|
51
51
|
});
|
|
52
|
-
const parentKeys = useMemo(() =>
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
const parentKeys = useMemo(() => {
|
|
53
|
+
var _a;
|
|
54
|
+
if (mappedActiveKey.includes('DATASOURCES')) {
|
|
55
|
+
return (_a = mappedActiveKey === null || mappedActiveKey === void 0 ? void 0 : mappedActiveKey.split('-')) === null || _a === void 0 ? void 0 : _a[1];
|
|
56
|
+
}
|
|
57
|
+
return recursiveFindParentOfActiveItem({
|
|
58
|
+
activeMenuItem: mappedActiveKey,
|
|
59
|
+
menuItems: menuListPermission || [],
|
|
60
|
+
});
|
|
61
|
+
}, [mappedActiveKey, menuListPermission]);
|
|
56
62
|
useLayoutEffect(() => setOpenKeys(parentKeys ? [parentKeys] : []), [parentKeys]);
|
|
57
63
|
const onMenuClick = e => {
|
|
58
64
|
onMenuItemClick === null || onMenuItemClick === void 0 ? void 0 : onMenuItemClick(e.key, uniq(e.keyPath));
|
|
59
65
|
};
|
|
60
66
|
const renderMenu = () => {
|
|
61
67
|
var _a;
|
|
62
|
-
const recursiveGetMenuItem = (featureMenuPermission) => {
|
|
68
|
+
const recursiveGetMenuItem = (featureMenuPermission, parentKey) => {
|
|
63
69
|
const { app_code, menu_code, app_name = '', menu_name = '', icon, childs, } = featureMenuPermission;
|
|
70
|
+
const key = menu_code === 'DATASOURCES' ? `${menu_code}-${parentKey}` : menu_code || '';
|
|
64
71
|
return {
|
|
65
|
-
key: app_code ||
|
|
72
|
+
key: app_code || key,
|
|
66
73
|
label: app_code ? (React.createElement(AppLabel, null,
|
|
67
74
|
React.createElement(Typography.Text, { ellipsis: { tooltip: app_name.toUpperCase() } }, app_name.toUpperCase()))) : (React.createElement(MenuLabel, null,
|
|
68
75
|
React.createElement(Typography.Text, { ellipsis: { tooltip: menu_name } }, menu_name))),
|
|
69
76
|
icon: icon ? React.createElement(IconWrapper, { url: icon }) : undefined,
|
|
70
|
-
children: childs === null || childs === void 0 ? void 0 : childs.map(item => recursiveGetMenuItem(omit(item, ['childs']))),
|
|
77
|
+
children: childs === null || childs === void 0 ? void 0 : childs.map(item => recursiveGetMenuItem(omit(item, ['childs']), app_code)),
|
|
71
78
|
};
|
|
72
79
|
};
|
|
73
80
|
const items = ((_a = orderBy(menuListPermission === null || menuListPermission === void 0 ? void 0 : menuListPermission.map(item => (Object.assign(Object.assign({}, item), { app_order: Number(item.app_order) }))), ['app_order'], ['asc'])) === null || _a === void 0 ? void 0 : _a.map(item => recursiveGetMenuItem(item))) || [];
|
|
@@ -22,6 +22,7 @@ export const MenuMappingWrapper = styled.div `
|
|
|
22
22
|
max-height: 100%;
|
|
23
23
|
overflow: hidden;
|
|
24
24
|
height: 763px;
|
|
25
|
+
flex-shrink: 0;
|
|
25
26
|
border-radius: ${(_a = THEME === null || THEME === void 0 ? void 0 : THEME.token) === null || _a === void 0 ? void 0 : _a.borderRadiusXL}px;
|
|
26
27
|
|
|
27
28
|
${MenuMappingContainer} {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { Typography } from '../../../../../../atoms';
|
|
3
3
|
// Assets
|
|
4
4
|
import recommendationHumanImage from '@antscorp/antsomi-ui/es/assets/images/components/Layout/recommendation-human.png';
|
|
5
|
-
import { ImageWrapper, MessageWrapper } from './styled';
|
|
6
|
-
export const RecommendationImage = () => (React.createElement(
|
|
5
|
+
import { ImageWrapper, MessageWrapper, RecommendationImageWrapper } from './styled';
|
|
6
|
+
export const RecommendationImage = () => (React.createElement(RecommendationImageWrapper, null,
|
|
7
7
|
React.createElement(MessageWrapper, null,
|
|
8
8
|
React.createElement(Typography.Paragraph, null, `Having Trouble Navigating the New Menus? Let's Map Functions Together!`),
|
|
9
9
|
React.createElement("div", { className: "arrow-triangle-down" })),
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export declare const MessageWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
2
2
|
export declare const ImageWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
|
+
export declare const RecommendationImageWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -5,6 +5,7 @@ export const MessageWrapper = styled.div `
|
|
|
5
5
|
background-color: #eef5fc;
|
|
6
6
|
border-radius: 30px;
|
|
7
7
|
position: relative;
|
|
8
|
+
flex-shrink: 0;
|
|
8
9
|
|
|
9
10
|
& > div.antsomi-typography {
|
|
10
11
|
margin: 0px !important;
|
|
@@ -27,13 +28,23 @@ export const MessageWrapper = styled.div `
|
|
|
27
28
|
}
|
|
28
29
|
`;
|
|
29
30
|
export const ImageWrapper = styled.div `
|
|
30
|
-
width:
|
|
31
|
-
height:
|
|
32
|
-
|
|
31
|
+
width: 100%;
|
|
32
|
+
height: 100%;
|
|
33
|
+
flex: 1 1 0%;
|
|
34
|
+
overflow: hidden;
|
|
33
35
|
|
|
34
36
|
img {
|
|
35
|
-
width:
|
|
36
|
-
height:
|
|
37
|
+
width: auto;
|
|
38
|
+
height: 100%;
|
|
39
|
+
max-height: 505px;
|
|
37
40
|
object-fit: contain;
|
|
38
41
|
}
|
|
39
42
|
`;
|
|
43
|
+
export const RecommendationImageWrapper = styled.div `
|
|
44
|
+
display: flex;
|
|
45
|
+
gap: 40px;
|
|
46
|
+
max-height: 700px;
|
|
47
|
+
flex-direction: column;
|
|
48
|
+
height: 100%;
|
|
49
|
+
overflow: hidden;
|
|
50
|
+
`;
|