@antscorp/antsomi-ui 1.3.5-beta.334 → 1.3.5-beta.336
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/Dropdown/Dropdown.d.ts +1 -0
- package/es/components/molecules/Dropdown/Dropdown.js +5 -3
- package/es/components/molecules/Dropdown/style.scss +7 -0
- package/es/components/molecules/Dropdown/types.d.ts +2 -0
- package/es/components/molecules/HeaderV2/HeaderV2.js +8 -5
- package/es/components/molecules/Modal/Modal.js +1 -0
- package/es/components/organism/LeftMenu/components/HomeMenu/index.js +1 -2
- package/es/components/organism/LeftMenu/components/HomeMenu/styled.d.ts +1 -1
- package/es/components/organism/LeftMenu/components/HomeMenu/styled.js +9 -6
- package/es/providers/ConfigProvider/GlobalStyle.js +7 -0
- package/package.json +1 -1
|
@@ -14,9 +14,11 @@ import { Space, Typography } from 'antd';
|
|
|
14
14
|
import Icon from '@antscorp/icons';
|
|
15
15
|
import { StyledInputDropdownRoot } from './styled';
|
|
16
16
|
import clsx from 'clsx';
|
|
17
|
+
import './style.scss';
|
|
17
18
|
export { Dropdown } from 'antd';
|
|
19
|
+
const DefaultExpandIcon = React.createElement(Icon, { type: "icon-ants-expand-more" });
|
|
18
20
|
export const InputDropdown = (props) => {
|
|
19
|
-
const { children, disabled = false, className, trigger = ['click'], menu = { items: [] }, width = '100%', onOpenChange = () => { } } = props, rest = __rest(props, ["children", "disabled", "className", "trigger", "menu", "width", "onOpenChange"]);
|
|
21
|
+
const { children, disabled = false, className, trigger = ['click'], menu = { items: [] }, width = '100%', expandIcon = DefaultExpandIcon, onOpenChange = () => { } } = props, rest = __rest(props, ["children", "disabled", "className", "trigger", "menu", "width", "expandIcon", "onOpenChange"]);
|
|
20
22
|
const [enableTooltip, setEnableTooltip] = useState(true);
|
|
21
23
|
const renderChildren = useCallback(() => {
|
|
22
24
|
if (typeof children === 'string') {
|
|
@@ -35,8 +37,8 @@ export const InputDropdown = (props) => {
|
|
|
35
37
|
setEnableTooltip(!open);
|
|
36
38
|
onOpenChange(...args);
|
|
37
39
|
};
|
|
38
|
-
return (React.createElement(StyledInputDropdownRoot, Object.assign({ menu: menu, trigger: trigger, disabled: disabled }, rest, { className: clsx({ disabled }, className), onOpenChange: handleOpen }),
|
|
40
|
+
return (React.createElement(StyledInputDropdownRoot, Object.assign({ menu: menu, trigger: trigger, disabled: disabled }, rest, { className: clsx({ disabled }, className, 'antsomi-input-dropdown'), onOpenChange: handleOpen }),
|
|
39
41
|
React.createElement(Space, { style: { width } },
|
|
40
42
|
renderChildren(),
|
|
41
|
-
|
|
43
|
+
expandIcon)));
|
|
42
44
|
};
|
|
@@ -9,7 +9,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import React, { memo, useMemo, useState } from 'react';
|
|
12
|
+
import React, { memo, useLayoutEffect, useMemo, useState } from 'react';
|
|
13
13
|
import { Link, useLocation } from 'react-router-dom';
|
|
14
14
|
// Hooks
|
|
15
15
|
// Styled
|
|
@@ -26,7 +26,7 @@ import { useCustomRouter } from '@antscorp/antsomi-ui/es/hooks';
|
|
|
26
26
|
const { DATAFLOWS, APP_ANTALYSER } = APP_CODES;
|
|
27
27
|
// const DOUBLE_RIGHT_POINTING = '»'
|
|
28
28
|
export const HeaderV2 = memo(props => {
|
|
29
|
-
var _a
|
|
29
|
+
var _a;
|
|
30
30
|
const { auth, env: envContext, languageCode = 'en', appCode: contextAppCode, urlLogout: urlLogoutProvider = '', menuCode: contextMenuCode, } = useContextSelector(AppConfigContext, state => state);
|
|
31
31
|
const { search } = useLocation();
|
|
32
32
|
// const history = useHistory();
|
|
@@ -37,8 +37,12 @@ export const HeaderV2 = memo(props => {
|
|
|
37
37
|
const { env = envContext, language = languageCode, userId = isNaN(Number(auth === null || auth === void 0 ? void 0 : auth.userId)) ? 0 : Number(auth === null || auth === void 0 ? void 0 : auth.userId), portalId = auth === null || auth === void 0 ? void 0 : auth.portalId, token = auth === null || auth === void 0 ? void 0 : auth.token, permissionDomain = PERMISSION_API, iamDomain = IAM_API, appCode = contextAppCode, menuCode = contextMenuCode, } = config || {};
|
|
38
38
|
const { currentAccount, inputStyle = 'select', onSelectAccount } = accountSelection, accountSelectionProps = __rest(accountSelection, ["currentAccount", "inputStyle", "onSelectAccount"]);
|
|
39
39
|
const urlParams = useMemo(() => new URLSearchParams(search), [search]);
|
|
40
|
-
const oidParam =
|
|
41
|
-
const [selectedAccount, setSelectedAccount] = useState(`${useURLParam ? oidParam : `${(
|
|
40
|
+
const oidParam = urlParams.get('oid') || 'all';
|
|
41
|
+
const [selectedAccount, setSelectedAccount] = useState(`${useURLParam ? oidParam : `${(_a = currentAccount !== null && currentAccount !== void 0 ? currentAccount : userId) !== null && _a !== void 0 ? _a : 'all'}`}`);
|
|
42
|
+
useLayoutEffect(() => {
|
|
43
|
+
if (useURLParam)
|
|
44
|
+
setSelectedAccount(oidParam);
|
|
45
|
+
}, [oidParam, useURLParam]);
|
|
42
46
|
// Memo
|
|
43
47
|
const accountSelectionDomain = useMemo(() => {
|
|
44
48
|
var _a;
|
|
@@ -96,7 +100,6 @@ export const HeaderV2 = memo(props => {
|
|
|
96
100
|
else {
|
|
97
101
|
urlParams.set('oid', userId);
|
|
98
102
|
}
|
|
99
|
-
// history.replace({ search: urlParams.toString() });
|
|
100
103
|
replace({ search: urlParams.toString() });
|
|
101
104
|
}
|
|
102
105
|
onSelectAccount === null || onSelectAccount === void 0 ? void 0 : onSelectAccount(userId);
|
|
@@ -19,6 +19,7 @@ export const OriginalModal = memo(props => {
|
|
|
19
19
|
OriginalModal.displayName = 'OriginalModal';
|
|
20
20
|
export const Modal = OriginalModal;
|
|
21
21
|
Modal.confirm = (props) => StyledModal.confirm(Object.assign({ cancelText: 'Cancel' }, props));
|
|
22
|
+
Modal.useModal = StyledModal.useModal;
|
|
22
23
|
Modal.success = StyledModal.success;
|
|
23
24
|
Modal.info = StyledModal.info;
|
|
24
25
|
Modal.error = StyledModal.error;
|
|
@@ -3,7 +3,6 @@ import React, { memo } from 'react';
|
|
|
3
3
|
// Components
|
|
4
4
|
import { ChildMenu } from '../common';
|
|
5
5
|
import { Flex } from '../../../../atoms';
|
|
6
|
-
import { Modal } from '../../../../molecules';
|
|
7
6
|
// Constants
|
|
8
7
|
import Icon from '@antscorp/icons';
|
|
9
8
|
// Styled
|
|
@@ -56,5 +55,5 @@ export const HomeMenu = memo(() => {
|
|
|
56
55
|
React.createElement("span", null, "Create"))),
|
|
57
56
|
React.createElement("div", { className: "menu-list" },
|
|
58
57
|
React.createElement(ChildMenu, { items: children, onMenuClick: onMenuClick }))),
|
|
59
|
-
React.createElement(
|
|
58
|
+
React.createElement(ModalWrapper, { open: !!removedDashboardId, centered: true, onCancel: () => setRemovedDashboardId(''), title: "Remove this dashboard", okText: "Confirm", cancelText: "Cancel", closable: false, okButtonProps: { loading: isDashboardRemoving }, onOk: onRemoveDashboard }, "Removing this dashboard will delete it permanently. Are you sure you want to perform this action?")));
|
|
60
59
|
});
|
|
@@ -3,4 +3,4 @@ export declare const HomeMenuWrapper: import("styled-components").StyledComponen
|
|
|
3
3
|
export declare const CreateButton: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("antd").ButtonProps & import("react").RefAttributes<HTMLElement>> & {
|
|
4
4
|
Group: import("react").FC<import("antd/es/button").ButtonGroupProps>;
|
|
5
5
|
}, any, {}, never>;
|
|
6
|
-
export declare const ModalWrapper: import("styled-components").StyledComponent<"
|
|
6
|
+
export declare const ModalWrapper: import("styled-components").StyledComponent<import("react").ComponentType<any> | keyof import("react").JSX.IntrinsicElements, any, any, any>;
|
|
@@ -3,6 +3,7 @@ var _a;
|
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
// Components
|
|
5
5
|
import { Button, Flex } from '../../../../atoms';
|
|
6
|
+
import { Modal } from '../../../../molecules';
|
|
6
7
|
// Constants
|
|
7
8
|
import { THEME } from '@antscorp/antsomi-ui/es/constants';
|
|
8
9
|
export const HomeMenuWrapper = styled(Flex) `
|
|
@@ -35,13 +36,15 @@ export const CreateButton = styled(Button) `
|
|
|
35
36
|
font-size: 14px !important;
|
|
36
37
|
flex-shrink: 0;
|
|
37
38
|
`;
|
|
38
|
-
export const ModalWrapper = styled
|
|
39
|
-
|
|
39
|
+
export const ModalWrapper = styled(Modal) `
|
|
40
|
+
&.antsomi-modal {
|
|
41
|
+
width: 379px !important;
|
|
40
42
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
& .antsomi-modal-content {
|
|
44
|
+
& > .antsomi-modal-header,
|
|
45
|
+
& > .antsomi-modal-footer {
|
|
46
|
+
margin: 0px;
|
|
47
|
+
}
|
|
45
48
|
}
|
|
46
49
|
}
|
|
47
50
|
`;
|