@antscorp/antsomi-ui 1.3.5-beta.435 → 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/DataTable/hooks/useDataTableListing/useDataTableListing.d.ts +1 -0
- package/es/components/organism/DataTable/hooks/useDataTableListing/useDataTableListing.js +12 -5
- 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/components/template/TemplateListing/components/CategoryListing/index.js +2 -4
- package/package.json +2 -1
|
@@ -24,6 +24,7 @@ interface TUseDataTableListing<TTableType = any> {
|
|
|
24
24
|
getFilterMetricList: ReturnType<typeof useGetFilterMetricList>;
|
|
25
25
|
getSearchListing: ReturnType<typeof useGetSearchListing>;
|
|
26
26
|
};
|
|
27
|
+
onChangeSelectedRow: (selectedRowKeys: React.Key[], selectedRows?: TTableType[]) => void;
|
|
27
28
|
setDatTableListingState: React.Dispatch<React.SetStateAction<TState<TTableType>>>;
|
|
28
29
|
}
|
|
29
30
|
type TState<TTableType = any> = {
|
|
@@ -75,7 +75,7 @@ export function useDataTableListing(props) {
|
|
|
75
75
|
const _f = apiSearch || {}, { url: searchUrl = '', enabled: enabledApiSearch = true } = _f, restOfApiSearchRequest = __rest(_f, ["url", "enabled"]);
|
|
76
76
|
const { filters, selectedFilterId, pagination, selectedRowKeys, searchValue, table, sorter, selectedRow, } = state;
|
|
77
77
|
const { externalFilters, includeDataType = false } = filterProps || {};
|
|
78
|
-
const { sortDirectionKey = 'az' } = tableProps || {};
|
|
78
|
+
const { sortDirectionKey = 'az', mainColumnKey } = tableProps || {};
|
|
79
79
|
const modifyColumnAuth = Object.assign(Object.assign({}, auth), { url: columnUrl });
|
|
80
80
|
const filterAuth = Object.assign(Object.assign({}, auth), { url: filterUrl });
|
|
81
81
|
const listingAuth = Object.assign(Object.assign({}, auth), { url: listingUrl });
|
|
@@ -471,6 +471,14 @@ export function useDataTableListing(props) {
|
|
|
471
471
|
pageSize,
|
|
472
472
|
});
|
|
473
473
|
}, [handleUpdatePagination]);
|
|
474
|
+
const onChangeSelectedRow = useCallback((selectedRowKeys, selectedRows) => {
|
|
475
|
+
setState(prev => (Object.assign(Object.assign({}, prev), { selectedRowKeys, selectedRow: {
|
|
476
|
+
keys: selectedRowKeys,
|
|
477
|
+
rows: selectedRows ||
|
|
478
|
+
(selectedRowKeys === null || selectedRowKeys === void 0 ? void 0 : selectedRowKeys.map(key => tableData === null || tableData === void 0 ? void 0 : tableData.find(row => { var _a; return ((_a = row[mainColumnKey]) === null || _a === void 0 ? void 0 : _a.toString()) === key.toString(); })).filter(Boolean)) ||
|
|
479
|
+
[],
|
|
480
|
+
} })));
|
|
481
|
+
}, [mainColumnKey, tableData]);
|
|
474
482
|
return {
|
|
475
483
|
/* Modify Column */
|
|
476
484
|
modifyColumn: {
|
|
@@ -506,10 +514,8 @@ export function useDataTableListing(props) {
|
|
|
506
514
|
dataSource: tableData,
|
|
507
515
|
columnWidths: table.columnWidths || {},
|
|
508
516
|
rowSelection: {
|
|
509
|
-
selectedRowKeys,
|
|
510
|
-
onChange
|
|
511
|
-
setState(prev => (Object.assign(Object.assign({}, prev), { selectedRowKeys, selectedRow: { keys: selectedRowKeys, rows: selectedRows } })));
|
|
512
|
-
},
|
|
517
|
+
selectedRowKeys: selectedRow.keys || [],
|
|
518
|
+
onChange: onChangeSelectedRow,
|
|
513
519
|
},
|
|
514
520
|
onChange: onChangeTable,
|
|
515
521
|
onColumnResize(data) {
|
|
@@ -549,6 +555,7 @@ export function useDataTableListing(props) {
|
|
|
549
555
|
getSearchListing,
|
|
550
556
|
},
|
|
551
557
|
// Handles
|
|
558
|
+
onChangeSelectedRow,
|
|
552
559
|
setDatTableListingState: setState,
|
|
553
560
|
};
|
|
554
561
|
}
|
|
@@ -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
|
+
`;
|
|
@@ -20,7 +20,6 @@ import { CustomLabelStyled, CustomRootLabel, MenuWrapper, TextWrapper } from './
|
|
|
20
20
|
// Components
|
|
21
21
|
import { Checkbox, Scrollbars, Spin } from '../../../../atoms';
|
|
22
22
|
import { Menu } from '../../../../organism';
|
|
23
|
-
import { Empty } from '../Empty';
|
|
24
23
|
// Utils
|
|
25
24
|
import { handleError } from '@antscorp/antsomi-ui/es/utils';
|
|
26
25
|
// Constants
|
|
@@ -118,8 +117,7 @@ export const CategoryListing = memo(props => {
|
|
|
118
117
|
header,
|
|
119
118
|
React.createElement(Scrollbars, { className: "category__listing" },
|
|
120
119
|
React.createElement(Spin, { spinning: loading, wrapperClassName: "template-listing__loading" },
|
|
121
|
-
|
|
122
|
-
React.createElement(Empty, Object.assign({}, emptyProps)))) : (React.createElement(Menu, Object.assign({ selectedKeys: [], items: menuItems, inlineIndent: 0, mode: "inline", defaultOpenKeys: items === null || items === void 0 ? void 0 : items.map(item => String(item.key)), expandIcon: ({ isOpen }) => {
|
|
120
|
+
React.createElement(Menu, Object.assign({ selectedKeys: [], items: menuItems, inlineIndent: 0, mode: "inline", defaultOpenKeys: items === null || items === void 0 ? void 0 : items.map(item => String(item.key)), expandIcon: ({ isOpen }) => {
|
|
123
121
|
var _a;
|
|
124
122
|
return (React.createElement(Icon, { type: "icon-ants-expand-more", style: {
|
|
125
123
|
fontSize: 20,
|
|
@@ -139,7 +137,7 @@ export const CategoryListing = memo(props => {
|
|
|
139
137
|
// }}
|
|
140
138
|
// />
|
|
141
139
|
// }
|
|
142
|
-
onClick: handleClickMenu }, restOfProps))
|
|
140
|
+
onClick: handleClickMenu }, restOfProps)),
|
|
143
141
|
footer)))) : null;
|
|
144
142
|
});
|
|
145
143
|
CategoryListing.displayName = 'CategoryListing';
|
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.437",
|
|
4
4
|
"description": "An enterprise-class UI design language and React UI library.",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"dist/*",
|
|
@@ -111,6 +111,7 @@
|
|
|
111
111
|
"react-custom-scrollbars": "^4.2.1",
|
|
112
112
|
"react-draggable": "^4.4.5",
|
|
113
113
|
"react-frame-component": "^5.2.6",
|
|
114
|
+
"react-konva": "^18.2.10",
|
|
114
115
|
"react-intersection-observer": "^9.10.3",
|
|
115
116
|
"react-konva": "^18.2.10",
|
|
116
117
|
"react-markdown": "^8.0.7",
|