@antscorp/antsomi-ui 1.3.5-beta.617 → 1.3.5-beta.619
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/molecules/ShareAccess/components/SearchUser/styled.js +5 -0
- package/es/components/organism/LeftMenu/components/common/ChildMenu/index.js +10 -14
- package/es/components/organism/LeftMenu/components/common/ChildMenu/styled.js +5 -0
- package/es/components/organism/LeftMenu/hooks/useNavigatePath.d.ts +1 -0
- package/es/components/organism/LeftMenu/hooks/useNavigatePath.js +5 -1
- package/es/components/template/Layout/components/RecommendationWorkspace/components/MenuMapping/components/OldLeftMenu/index.js +1 -1
- package/es/providers/ConfigProvider/GlobalStyle.js +6 -0
- package/package.json +1 -1
|
@@ -4,6 +4,7 @@ import React, { memo, useState } from 'react';
|
|
|
4
4
|
import Icon from '@antscorp/icons';
|
|
5
5
|
import { isEmpty, isNil, uniq } from 'lodash';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
|
+
import { Link } from 'react-router-dom';
|
|
7
8
|
// Components
|
|
8
9
|
import { Dropdown, Menu } from 'antd';
|
|
9
10
|
import { MenuItemImage } from './components';
|
|
@@ -52,7 +53,7 @@ export const ChildMenu = memo(props => {
|
|
|
52
53
|
const [currentActiveItem, setCurrentActiveItem] = useState('');
|
|
53
54
|
const [openKeys, setOpenKeys] = useState([]);
|
|
54
55
|
const { pathname, hash } = window.location;
|
|
55
|
-
const { isPushDifferentDomain, getPath, navigatePath } = useNavigatePath();
|
|
56
|
+
const { isPushDifferentDomain, getPath, getPathWithDomain, navigatePath } = useNavigatePath();
|
|
56
57
|
useDeepCompareEffect(() => {
|
|
57
58
|
setOpenKeys((items === null || items === void 0 ? void 0 : items.map(item => item.key)) || []);
|
|
58
59
|
}, [items]);
|
|
@@ -167,16 +168,6 @@ export const ChildMenu = memo(props => {
|
|
|
167
168
|
onMenuClick === null || onMenuClick === void 0 ? void 0 : onMenuClick(e.key, e.keyPath);
|
|
168
169
|
}
|
|
169
170
|
};
|
|
170
|
-
const onClickMenuItem = (menuItem) => {
|
|
171
|
-
const { key, menu_item_domain = '', menu_item_path = '' } = menuItem || {};
|
|
172
|
-
// If menu_item_path is empty then return
|
|
173
|
-
if (!menu_item_path)
|
|
174
|
-
return;
|
|
175
|
-
if (isPushDifferentDomain(menu_item_domain, menu_item_path)) {
|
|
176
|
-
return navigatePath(menu_item_domain, menu_item_path);
|
|
177
|
-
}
|
|
178
|
-
navigate(getPath(menu_item_path, key));
|
|
179
|
-
};
|
|
180
171
|
const customMenuItems = (args) => {
|
|
181
172
|
var _a;
|
|
182
173
|
return (_a = args === null || args === void 0 ? void 0 : args.items) === null || _a === void 0 ? void 0 : _a.map(item => {
|
|
@@ -205,11 +196,16 @@ export const ChildMenu = memo(props => {
|
|
|
205
196
|
React.createElement(Icon, { type: icon }))) : !isNil(logo_url) ? (React.createElement(MenuItemImage, { imageUrl: logo_url, fallbackIcon: (_a = args === null || args === void 0 ? void 0 : args.parent) === null || _a === void 0 ? void 0 : _a.icon, className: classNames({ isActive: currentActiveItem === key }) })) : null)) : null;
|
|
206
197
|
};
|
|
207
198
|
const renderTitle = () => !menu_item_path || type === 'recommendation' ? (renderLabel()) : (React.createElement("div", { className: "menu-link" }, renderLabel()));
|
|
199
|
+
let Label = (React.createElement(Flex, { gap: 10, align: "center", justify: "space-between", style: { height: '100%' } },
|
|
200
|
+
renderIcon(),
|
|
201
|
+
React.createElement(Flex, { style: styles.menuItemTitle, align: "center" }, renderTitle())));
|
|
202
|
+
// Check if type not recommendation then render with link wrapper
|
|
203
|
+
if (type !== 'recommendation' && !!menu_item_path) {
|
|
204
|
+
Label = isPushDifferentDomain(menu_item_domain, menu_item_path) ? (React.createElement("a", { href: getPathWithDomain(menu_item_domain, menu_item_path) }, Label)) : (React.createElement(Link, { to: getPath(menu_item_path, key) }, Label));
|
|
205
|
+
}
|
|
208
206
|
return {
|
|
209
207
|
key,
|
|
210
|
-
label:
|
|
211
|
-
renderIcon(),
|
|
212
|
-
React.createElement(Flex, { style: styles.menuItemTitle, align: "center" }, renderTitle()))),
|
|
208
|
+
label: Label,
|
|
213
209
|
disabled,
|
|
214
210
|
children: customMenuItems({
|
|
215
211
|
parent: item,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare const useNavigatePath: () => {
|
|
2
2
|
isPushDifferentDomain: (domain: string | null, path: string | null) => boolean;
|
|
3
3
|
getPath: (path: string | null, itemKey?: string) => string;
|
|
4
|
+
getPathWithDomain: (domain: string | null, path: string | null) => string;
|
|
4
5
|
navigatePath: (domain: string | null, path: string | null, newTab?: boolean) => void;
|
|
5
6
|
};
|
|
@@ -49,6 +49,10 @@ export const useNavigatePath = () => {
|
|
|
49
49
|
}
|
|
50
50
|
return getGeneratePath(`${path !== null && path !== void 0 ? path : ''}${searchParams}`, auth);
|
|
51
51
|
}, [auth, searchParams]);
|
|
52
|
+
const getPathWithDomain = useCallback((domain, path) => {
|
|
53
|
+
const newDomain = isNil(domain) || env === ENV.DEV ? '' : domain;
|
|
54
|
+
return getGeneratePath(`${newDomain}${path}${searchParams}`, auth);
|
|
55
|
+
}, [auth, env, searchParams]);
|
|
52
56
|
const navigatePath = useCallback((domain, path, newTab = false) => {
|
|
53
57
|
const newDomain = isNil(domain) || env === ENV.DEV ? '' : domain;
|
|
54
58
|
const newPath = getGeneratePath(`${newDomain}${path}${searchParams}`, auth);
|
|
@@ -58,5 +62,5 @@ export const useNavigatePath = () => {
|
|
|
58
62
|
}
|
|
59
63
|
window.location.assign(newPath);
|
|
60
64
|
}, [auth, env, searchParams]);
|
|
61
|
-
return { isPushDifferentDomain, getPath, navigatePath };
|
|
65
|
+
return { isPushDifferentDomain, getPath, getPathWithDomain, navigatePath };
|
|
62
66
|
};
|
|
@@ -78,7 +78,7 @@ export const OldLeftMenu = memo(props => {
|
|
|
78
78
|
React.createElement(Typography.Text, { ellipsis: { tooltip: app_name.toUpperCase() } }, app_name.toUpperCase()))) : (React.createElement(MenuLabel, null,
|
|
79
79
|
React.createElement(Typography.Text, { ellipsis: { tooltip: menu_name } }, menu_name))),
|
|
80
80
|
icon: icon ? React.createElement(IconWrapper, { url: icon }) : undefined,
|
|
81
|
-
children: childs === null || childs === void 0 ? void 0 : childs.map(item => recursiveGetMenuItem(omit(item, ['childs']), app_code)),
|
|
81
|
+
children: childs === null || childs === void 0 ? void 0 : childs.map(item => item.show_hide ? recursiveGetMenuItem(omit(item, ['childs']), app_code) : null).filter(Boolean),
|
|
82
82
|
};
|
|
83
83
|
};
|
|
84
84
|
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))) || [];
|
|
@@ -321,6 +321,12 @@ export const GlobalStyle = () => {
|
|
|
321
321
|
box-shadow: none !important;
|
|
322
322
|
}
|
|
323
323
|
|
|
324
|
+
.antsomi-select-auto-complete {
|
|
325
|
+
.antsomi-select-selector {
|
|
326
|
+
border: none !important;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
324
330
|
.antsomi-select-dropdown {
|
|
325
331
|
padding: 8px 0 !important;
|
|
326
332
|
z-index: 3002 !important;
|