@antscorp/antsomi-ui 1.3.5-beta.436 → 1.3.5-beta.438
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/es/services/DataTable/index.js +8 -8
- 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
|
+
`;
|
|
@@ -44,9 +44,9 @@ export const dataTableServices = {
|
|
|
44
44
|
try {
|
|
45
45
|
const { url } = auth || {};
|
|
46
46
|
const { type = GET_LIST_MODIFY_COLUMN, objType, objId } = params || {};
|
|
47
|
-
const response = yield axios(Object.assign(Object.assign({}, request), { url, method: 'GET', params: Object.assign(Object.assign(
|
|
47
|
+
const response = yield axios(Object.assign(Object.assign({}, request), { url, method: 'GET', params: Object.assign(Object.assign({ type,
|
|
48
48
|
objType,
|
|
49
|
-
objId }) }));
|
|
49
|
+
objId }, mapAuth(auth)), request === null || request === void 0 ? void 0 : request.params) }));
|
|
50
50
|
return get(response, 'data.data.modifyColumns', []);
|
|
51
51
|
}
|
|
52
52
|
catch (error) {
|
|
@@ -103,9 +103,9 @@ export const dataTableServices = {
|
|
|
103
103
|
try {
|
|
104
104
|
const { url } = auth || {};
|
|
105
105
|
const { type = GET_SAVED_FILTER, objType: object, objId } = params || {};
|
|
106
|
-
const response = yield axios(Object.assign(Object.assign({}, request), { url, method: 'GET', params: Object.assign(Object.assign(
|
|
106
|
+
const response = yield axios(Object.assign(Object.assign({}, request), { url, method: 'GET', params: Object.assign(Object.assign({ type,
|
|
107
107
|
object,
|
|
108
|
-
objId }) }));
|
|
108
|
+
objId }, request === null || request === void 0 ? void 0 : request.params), mapAuth(auth)) }));
|
|
109
109
|
return get(response, 'data.data.filters', []);
|
|
110
110
|
}
|
|
111
111
|
catch (error) {
|
|
@@ -116,9 +116,9 @@ export const dataTableServices = {
|
|
|
116
116
|
try {
|
|
117
117
|
const { url } = auth || {};
|
|
118
118
|
const { type = GET_LIST_FILTER, objType: object, objId } = params || {};
|
|
119
|
-
const response = yield axios(Object.assign(Object.assign({}, request), { url, method: 'GET', params: Object.assign(Object.assign(
|
|
119
|
+
const response = yield axios(Object.assign(Object.assign({}, request), { url, method: 'GET', params: Object.assign(Object.assign({ type,
|
|
120
120
|
object,
|
|
121
|
-
objId }) }));
|
|
121
|
+
objId }, request === null || request === void 0 ? void 0 : request.params), mapAuth(auth)) }));
|
|
122
122
|
return get(response, 'data.data.filters', []);
|
|
123
123
|
}
|
|
124
124
|
catch (error) {
|
|
@@ -184,7 +184,7 @@ export const dataTableServices = {
|
|
|
184
184
|
getTableListing(_a) {
|
|
185
185
|
return __awaiter(this, arguments, void 0, function* ({ auth, params, request, }) {
|
|
186
186
|
try {
|
|
187
|
-
const response = yield axios(Object.assign(Object.assign({}, request), { url: `${auth === null || auth === void 0 ? void 0 : auth.url}`, method: 'GET', params: Object.assign(Object.assign(Object.assign({}, request === null || request === void 0 ? void 0 : request.params), mapAuth(auth))
|
|
187
|
+
const response = yield axios(Object.assign(Object.assign({}, request), { url: `${auth === null || auth === void 0 ? void 0 : auth.url}`, method: 'GET', params: Object.assign(Object.assign(Object.assign({}, params), request === null || request === void 0 ? void 0 : request.params), mapAuth(auth)) }));
|
|
188
188
|
return mapResponseListingToGeneral(get(response, 'data.data', {}));
|
|
189
189
|
}
|
|
190
190
|
catch (error) {
|
|
@@ -199,7 +199,7 @@ export const dataTableServices = {
|
|
|
199
199
|
const { search } = params || {};
|
|
200
200
|
const _b = request || {}, { method = 'GET' } = _b, restOfRequest = __rest(_b, ["method"]);
|
|
201
201
|
try {
|
|
202
|
-
const response = yield axios(Object.assign(Object.assign({}, restOfRequest), { method, url: `${auth === null || auth === void 0 ? void 0 : auth.url}`, params: Object.assign(Object.assign(
|
|
202
|
+
const response = yield axios(Object.assign(Object.assign({}, restOfRequest), { method, url: `${auth === null || auth === void 0 ? void 0 : auth.url}`, params: Object.assign(Object.assign({ search }, request === null || request === void 0 ? void 0 : request.params), mapAuth(auth)) }));
|
|
203
203
|
return mapResponseSearchToGeneral(get(response, 'data.data', {}));
|
|
204
204
|
}
|
|
205
205
|
catch (error) {
|