@antscorp/antsomi-ui 1.3.5-beta.310 → 1.3.5-beta.312
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/assets/css/main.scss +19 -1
- package/es/components/atoms/Input/Input.d.ts +2 -1
- package/es/components/atoms/Input/Input.js +6 -2
- package/es/components/atoms/Scrollbars/Scrollbars.js +3 -3
- package/es/components/molecules/HeaderV2/HeaderV2.js +7 -3
- package/es/components/molecules/SearchPopover/SearchPopover.d.ts +8 -0
- package/es/components/molecules/SearchPopover/SearchPopover.js +24 -0
- package/es/components/molecules/SearchPopover/index.d.ts +1 -0
- package/es/components/molecules/SearchPopover/index.js +1 -0
- package/es/components/molecules/SearchPopover/styles.scss +29 -0
- package/es/components/molecules/VirtualizedMenu/VirtualizedMenu.d.ts +3 -0
- package/es/components/molecules/VirtualizedMenu/VirtualizedMenu.js +16 -0
- package/es/components/molecules/VirtualizedMenu/__mocks__/index.d.ts +2 -0
- package/es/components/molecules/VirtualizedMenu/__mocks__/index.js +2698 -0
- package/es/components/molecules/VirtualizedMenu/components/Item/Item.d.ts +8 -0
- package/es/components/molecules/VirtualizedMenu/components/Item/Item.js +25 -0
- package/es/components/molecules/VirtualizedMenu/components/Item/index.d.ts +1 -0
- package/es/components/molecules/VirtualizedMenu/components/Item/index.js +1 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/MenuInline.d.ts +3 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/MenuInline.js +95 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/index.d.ts +1 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/index.js +1 -0
- package/es/components/molecules/VirtualizedMenu/components/index.d.ts +2 -0
- package/es/components/molecules/VirtualizedMenu/components/index.js +2 -0
- package/es/components/molecules/VirtualizedMenu/config.d.ts +12 -0
- package/es/components/molecules/VirtualizedMenu/config.js +12 -0
- package/es/components/molecules/VirtualizedMenu/index.d.ts +2 -0
- package/es/components/molecules/VirtualizedMenu/index.js +1 -0
- package/es/components/molecules/VirtualizedMenu/styled.d.ts +4 -0
- package/es/components/molecules/VirtualizedMenu/styled.js +64 -0
- package/es/components/molecules/VirtualizedMenu/types.d.ts +30 -0
- package/es/components/molecules/VirtualizedMenu/types.js +1 -0
- package/es/components/molecules/VirtualizedMenu/utils.d.ts +16 -0
- package/es/components/molecules/VirtualizedMenu/utils.js +17 -0
- package/es/components/molecules/index.d.ts +4 -0
- package/es/components/molecules/index.js +2 -0
- package/es/components/organism/LeftMenu/components/HomeMenu/useHomeMenu.js +12 -10
- package/es/constants/theme.js +3 -1
- package/es/hooks/index.d.ts +1 -0
- package/es/hooks/index.js +1 -0
- package/es/hooks/useCustomRouter.d.ts +33 -0
- package/es/hooks/useCustomRouter.js +62 -0
- package/es/queries/LeftMenu/index.js +2 -1
- package/package.json +5 -2
package/es/assets/css/main.scss
CHANGED
|
@@ -1,4 +1,22 @@
|
|
|
1
1
|
:root {
|
|
2
2
|
--primary-color: #005fb8;
|
|
3
3
|
--text-base-color: #222222;
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
--border-primary: #005eb8;
|
|
6
|
+
--border-normal: #b8cfe6;
|
|
7
|
+
--border-hover: #81bcf4;
|
|
8
|
+
--border-active: #005eb8;
|
|
9
|
+
--border-disable: #d4d4d4;
|
|
10
|
+
|
|
11
|
+
--divider-1: #e5e5e5;
|
|
12
|
+
--divider-2: #d4d4d4;
|
|
13
|
+
--divider-3: #bebebe;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
*,
|
|
17
|
+
*:before,
|
|
18
|
+
*:after {
|
|
19
|
+
-webkit-box-sizing: border-box;
|
|
20
|
+
-moz-box-sizing: border-box;
|
|
21
|
+
box-sizing: border-box;
|
|
22
|
+
}
|
|
@@ -5,7 +5,7 @@ export interface InputProps extends AntdInputProps {
|
|
|
5
5
|
noborder?: 'true' | 'false' | boolean;
|
|
6
6
|
debounce?: number;
|
|
7
7
|
label?: ReactNode;
|
|
8
|
-
onAfterChange?: (value:
|
|
8
|
+
onAfterChange?: (value: string) => void;
|
|
9
9
|
errorArchive?: string;
|
|
10
10
|
required?: boolean;
|
|
11
11
|
isReverseMask?: boolean;
|
|
@@ -14,6 +14,7 @@ export interface InputProps extends AntdInputProps {
|
|
|
14
14
|
focused?: boolean;
|
|
15
15
|
errorMsg?: string;
|
|
16
16
|
disableUndo?: boolean;
|
|
17
|
+
withWrapper?: boolean;
|
|
17
18
|
}
|
|
18
19
|
export declare const Input: string & import("styled-components").StyledComponentBase<React.ForwardRefExoticComponent<AntdInputProps & React.RefAttributes<import("antd").InputRef>> & {
|
|
19
20
|
Group: React.FC<import("antd/es/input").GroupProps>;
|
|
@@ -24,7 +24,7 @@ import { StyledInput } from './styled';
|
|
|
24
24
|
const PATH = '@antscorp/antsomi-ui/es/components/atoms/Input/Input.tsx';
|
|
25
25
|
const OriginInput = props => {
|
|
26
26
|
// Props
|
|
27
|
-
const { debounce, errorArchive, required, labelColor, isReverseMask, isHideErrMessage, focused, label, onAfterChange, onChange, errorMsg } = props, restProps = __rest(props, ["debounce", "errorArchive", "required", "labelColor", "isReverseMask", "isHideErrMessage", "focused", "label", "onAfterChange", "onChange", "errorMsg"]);
|
|
27
|
+
const { withWrapper, debounce, errorArchive, required, labelColor, isReverseMask, isHideErrMessage, focused, label, onAfterChange, onChange, errorMsg } = props, restProps = __rest(props, ["withWrapper", "debounce", "errorArchive", "required", "labelColor", "isReverseMask", "isHideErrMessage", "focused", "label", "onAfterChange", "onChange", "errorMsg"]);
|
|
28
28
|
// State
|
|
29
29
|
const [value, setValue] = useState(props.value);
|
|
30
30
|
const [isFocused, setFocused] = useState(false);
|
|
@@ -76,7 +76,7 @@ const OriginInput = props => {
|
|
|
76
76
|
if (props.disableUndo) {
|
|
77
77
|
listDisableActions.push('undo');
|
|
78
78
|
}
|
|
79
|
-
|
|
79
|
+
const content = (React.createElement(React.Fragment, null,
|
|
80
80
|
label && renderRequiredLabel(label),
|
|
81
81
|
React.createElement(StyledInput, Object.assign({}, restProps, { value: value, onBlur: e => {
|
|
82
82
|
if (!isFocused) {
|
|
@@ -85,10 +85,14 @@ const OriginInput = props => {
|
|
|
85
85
|
restProps.onBlur && restProps.onBlur(e);
|
|
86
86
|
}, onChange: onChangeInput }, getPreventKeyboardAction(listDisableActions))),
|
|
87
87
|
(restProps.status === 'error' || errorArchive || requiredMsg) && !isHideErrMessage ? (React.createElement(Text, { color: "#ff4d4f", style: { marginLeft: 8, marginTop: 5 } }, errorMsg || errorArchive || requiredMsg)) : null));
|
|
88
|
+
if (!withWrapper)
|
|
89
|
+
return content;
|
|
90
|
+
return React.createElement("div", { className: "input__wrapper" }, content);
|
|
88
91
|
};
|
|
89
92
|
OriginInput.defaultProps = {
|
|
90
93
|
debounce: 400,
|
|
91
94
|
isHideErrMessage: false,
|
|
95
|
+
withWrapper: true,
|
|
92
96
|
};
|
|
93
97
|
export const Input = OriginInput;
|
|
94
98
|
Input.TextArea = StyledInput.TextArea;
|
|
@@ -72,9 +72,9 @@ export const Scrollbars = props => {
|
|
|
72
72
|
// Set a minimum height for the view to ensure space for the scrollbar
|
|
73
73
|
newStyle.minHeight = THUMB_SIZE;
|
|
74
74
|
// If autoHeightMax is defined, adjust the maxHeight to include space for the scrollbar
|
|
75
|
-
if (autoHeightMax) {
|
|
76
|
-
|
|
77
|
-
}
|
|
75
|
+
// if (autoHeightMax) {
|
|
76
|
+
// newStyle.maxHeight = parseInt(`${autoHeightMax}`) + THUMB_SIZE;
|
|
77
|
+
// }
|
|
78
78
|
// Return a div element with the adjusted styles and original props, applying a custom class for styling
|
|
79
79
|
return React.createElement("div", Object.assign({ className: "scrollbar-view" }, props, { style: newStyle }));
|
|
80
80
|
}, onUpdate: onUpdate, hideTracksWhenNotNeeded: true }, restProps)));
|
|
@@ -10,7 +10,8 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import React, { memo, useMemo, useState } from 'react';
|
|
13
|
-
import { Link,
|
|
13
|
+
import { Link, useLocation } from 'react-router-dom';
|
|
14
|
+
// Hooks
|
|
14
15
|
// Styled
|
|
15
16
|
import { HeaderV2Styled } from './styled';
|
|
16
17
|
// Components
|
|
@@ -21,13 +22,15 @@ import { APP_CODES, APP_PERMISSION_DOMAIN, CDP_API, IAM_API, ISSUE_API, PERMISSI
|
|
|
21
22
|
import { useContextSelector } from 'use-context-selector';
|
|
22
23
|
import { AppConfigContext } from '../../..';
|
|
23
24
|
import { isNil } from 'lodash';
|
|
25
|
+
import { useCustomRouter } from '@antscorp/antsomi-ui/es/hooks';
|
|
24
26
|
const { DATAFLOWS, APP_ANTALYSER } = APP_CODES;
|
|
25
27
|
// const DOUBLE_RIGHT_POINTING = '»'
|
|
26
28
|
export const HeaderV2 = memo(props => {
|
|
27
29
|
var _a, _b;
|
|
28
30
|
const { auth, env: envContext, languageCode = 'en', appCode: contextAppCode, urlLogout: urlLogoutProvider = '', menuCode: contextMenuCode, } = useContextSelector(AppConfigContext, state => state);
|
|
29
31
|
const { search } = useLocation();
|
|
30
|
-
const history = useHistory();
|
|
32
|
+
// const history = useHistory();
|
|
33
|
+
const { navigate } = useCustomRouter();
|
|
31
34
|
// * Prefer to use Header in AppConfigContext
|
|
32
35
|
const { className, style, breadcrumbs, pageTitle = '', accountSelection = {}, helpConfig, notificationConfig = {}, accountSharingConfig, useURLParam, config, } = props;
|
|
33
36
|
/** General config for children component */
|
|
@@ -93,7 +96,8 @@ export const HeaderV2 = memo(props => {
|
|
|
93
96
|
else {
|
|
94
97
|
urlParams.delete('oid');
|
|
95
98
|
}
|
|
96
|
-
history.replace({ search: urlParams.toString() });
|
|
99
|
+
// history.replace({ search: urlParams.toString() });
|
|
100
|
+
navigate({ search: urlParams.toString() });
|
|
97
101
|
}
|
|
98
102
|
onSelectAccount === null || onSelectAccount === void 0 ? void 0 : onSelectAccount(userId);
|
|
99
103
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React, { PropsWithChildren } from 'react';
|
|
2
|
+
import { PopoverProps } from 'antd';
|
|
3
|
+
import { InputProps } from '../../atoms/Input';
|
|
4
|
+
import './styles.scss';
|
|
5
|
+
export type SearchPopoverProps = PropsWithChildren<PopoverProps & {
|
|
6
|
+
inputSearchProps?: InputProps;
|
|
7
|
+
}>;
|
|
8
|
+
export declare const SearchPopover: (props: SearchPopoverProps) => React.JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import { Popover } from 'antd';
|
|
14
|
+
import { Input } from '../../atoms/Input';
|
|
15
|
+
import Icon from '@antscorp/icons';
|
|
16
|
+
import './styles.scss';
|
|
17
|
+
import clsx from 'clsx';
|
|
18
|
+
export const SearchPopover = (props) => {
|
|
19
|
+
const { inputSearchProps } = props, popoverProps = __rest(props, ["inputSearchProps"]);
|
|
20
|
+
const { overlayClassName, arrow = false, children, content, trigger = ['click'] } = popoverProps, restPopoverProps = __rest(popoverProps, ["overlayClassName", "arrow", "children", "content", "trigger"]);
|
|
21
|
+
return (React.createElement(Popover, Object.assign({ trigger: trigger, arrow: arrow }, restPopoverProps, { overlayClassName: clsx('search-popover-overlay', overlayClassName), overlay: true, content: React.createElement(React.Fragment, null,
|
|
22
|
+
React.createElement(Input, Object.assign({ placeholder: (inputSearchProps === null || inputSearchProps === void 0 ? void 0 : inputSearchProps.placeholder) || 'Search...', addonAfter: React.createElement(Icon, { type: "icon-ants-search-2" }), bordered: false }, inputSearchProps, { withWrapper: false })),
|
|
23
|
+
content) }), children));
|
|
24
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SearchPopover, SearchPopoverProps } from './SearchPopover';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SearchPopover } from './SearchPopover';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
.search-popover-overlay {
|
|
2
|
+
&.antsomi-popover {
|
|
3
|
+
.antsomi-popover-inner {
|
|
4
|
+
padding: 0;
|
|
5
|
+
|
|
6
|
+
.antsomi-input-group-wrapper {
|
|
7
|
+
padding: 8px 10px;
|
|
8
|
+
border-bottom: 1px solid var(--divider-1);
|
|
9
|
+
|
|
10
|
+
.antsomi-input {
|
|
11
|
+
padding-left: 0;
|
|
12
|
+
padding-right: 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.antsomi-input-group-addon {
|
|
16
|
+
border: none;
|
|
17
|
+
background: transparent;
|
|
18
|
+
font-size: 20px;
|
|
19
|
+
padding: 0;
|
|
20
|
+
|
|
21
|
+
> i {
|
|
22
|
+
font-size: 24px;
|
|
23
|
+
color: #595959;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { MODE } from './config';
|
|
3
|
+
import { MenuInline } from './components';
|
|
4
|
+
export const VirtualizedMenu = (props) => {
|
|
5
|
+
const { mode = MODE.Inline } = props;
|
|
6
|
+
let content = null;
|
|
7
|
+
switch (mode) {
|
|
8
|
+
case MODE.Inline: {
|
|
9
|
+
content = React.createElement(MenuInline, Object.assign({}, props));
|
|
10
|
+
break;
|
|
11
|
+
}
|
|
12
|
+
default:
|
|
13
|
+
break;
|
|
14
|
+
}
|
|
15
|
+
return content;
|
|
16
|
+
};
|