@antscorp/antsomi-ui 1.8.2 → 1.8.3

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.
Files changed (55) hide show
  1. package/es/components/atoms/Input/Input.d.ts +8 -8
  2. package/es/components/atoms/Input/Input.js +4 -4
  3. package/es/components/atoms/PreviewTabs/styled.js +3 -1
  4. package/es/components/atoms/Rate/Rate.d.ts +1 -2
  5. package/es/components/atoms/Rate/Rate.js +1 -2
  6. package/es/components/atoms/RequiredLabel/styled.d.ts +0 -1
  7. package/es/components/atoms/RequiredLabel/styled.js +0 -1
  8. package/es/components/icons/DomainManagementIcon.js +3 -3
  9. package/es/components/molecules/AccountSelection/AccountListing.js +11 -2
  10. package/es/components/molecules/AccountSelection/AccountSelection.d.ts +2 -0
  11. package/es/components/molecules/AccountSelection/AccountSelection.js +7 -2
  12. package/es/components/molecules/AccountSelection/hooks/useAccountSelection.d.ts +2 -0
  13. package/es/components/molecules/AccountSelection/hooks/useAccountSelection.js +6 -3
  14. package/es/components/molecules/CaptureScreen/CaptureScreen.js +1 -1
  15. package/es/components/molecules/HeaderV2/HeaderV2.js +1 -1
  16. package/es/components/molecules/ShareAccess/components/PeopleAccess/styled.js +2 -2
  17. package/es/components/molecules/ThumbnailCard/ThumbnailCard.js +0 -187
  18. package/es/components/organism/AccountSharing/styled.js +14 -14
  19. package/es/components/organism/DataTable/components/Filter/SavedFilterAndMetrics.js +9 -2
  20. package/es/components/organism/DataTable/components/Toolbar/SearchPopover.js +11 -2
  21. package/es/components/organism/DataTable/hooks/useDataTableListing/types.d.ts +4 -1
  22. package/es/components/organism/DataTable/hooks/useDataTableListing/useDataTableListing.js +7 -1
  23. package/es/components/organism/Help/Help.js +4 -2
  24. package/es/components/organism/LeftMenu/LeftMenu.js +35 -24
  25. package/es/components/organism/LeftMenu/components/HomeMenu/index.js +2 -2
  26. package/es/components/organism/LeftMenu/components/HomeMenu/useHomeMenu.d.ts +1 -1
  27. package/es/components/organism/LeftMenu/components/HomeMenu/useHomeMenu.js +4 -4
  28. package/es/components/organism/LeftMenu/components/common/ChildMenu/components/MenuItemImage/styled.js +3 -3
  29. package/es/components/organism/LeftMenu/components/common/ChildMenu/index.js +24 -14
  30. package/es/components/organism/LeftMenu/components/common/ChildMenu/styled.js +4 -4
  31. package/es/components/organism/LeftMenu/hooks/useLeftMenu.js +47 -69
  32. package/es/components/organism/LeftMenu/hooks/useNavigatePath.js +8 -5
  33. package/es/components/organism/LeftMenu/hooks/usePermission.js +8 -8
  34. package/es/components/organism/LeftMenu/index.d.ts +5 -5
  35. package/es/components/organism/LeftMenu/index.js +2 -1
  36. package/es/components/organism/LeftMenu/stores/index.d.ts +2 -3
  37. package/es/components/organism/LeftMenu/stores/index.js +2 -2
  38. package/es/components/organism/LeftMenu/styled.js +7 -7
  39. package/es/components/organism/LeftMenu/types/index.d.ts +1 -0
  40. package/es/components/organism/LeftMenu/utils/index.js +1 -0
  41. package/es/components/template/Layout/Layout.js +3 -3
  42. package/es/components/template/Layout/components/RecommendationWorkspace/components/MenuMapping/index.d.ts +6 -1
  43. package/es/components/template/Layout/components/RecommendationWorkspace/components/MenuMapping/index.js +17 -6
  44. package/es/components/template/Layout/components/RecommendationWorkspace/components/MenuMapping/styled.js +5 -5
  45. package/es/constants/queries.d.ts +1 -0
  46. package/es/constants/queries.js +1 -0
  47. package/es/locales/en/translation.json +1 -1
  48. package/es/queries/Account/useGetAccountList.d.ts +11 -2
  49. package/es/queries/Account/useGetAccountList.js +11 -2
  50. package/es/services/Account/index.d.ts +7 -0
  51. package/es/services/Account/index.js +28 -0
  52. package/es/test.js +6 -2
  53. package/package.json +12 -7
  54. package/es/components/template/Layout/components/RecommendationWorkspace/components/MenuMapping/components/OldLeftMenu/constants/index.d.ts +0 -0
  55. package/es/components/template/Layout/components/RecommendationWorkspace/components/MenuMapping/components/OldLeftMenu/constants/index.js +0 -1
@@ -1,6 +1,6 @@
1
1
  /// <reference types="hoist-non-react-statics" />
2
2
  import React, { ReactNode } from 'react';
3
- import { InputProps as AntdInputProps, Input as AntdInput } from 'antd';
3
+ import { InputProps as AntdInputProps, Input as AntdInput, InputRef } from 'antd';
4
4
  export interface InputProps extends AntdInputProps {
5
5
  noborder?: 'true' | 'false' | boolean;
6
6
  debounce?: number;
@@ -16,20 +16,20 @@ export interface InputProps extends AntdInputProps {
16
16
  disableUndo?: boolean;
17
17
  withWrapper?: boolean;
18
18
  }
19
- export declare const Input: string & import("styled-components").StyledComponentBase<React.ForwardRefExoticComponent<AntdInputProps & React.RefAttributes<import("antd").InputRef>> & {
19
+ export declare const Input: string & import("styled-components").StyledComponentBase<React.ForwardRefExoticComponent<AntdInputProps & React.RefAttributes<InputRef>> & {
20
20
  Group: React.FC<import("antd/es/input").GroupProps>;
21
- Search: React.ForwardRefExoticComponent<import("antd/es/input").SearchProps & React.RefAttributes<import("antd").InputRef>>;
21
+ Search: React.ForwardRefExoticComponent<import("antd/es/input").SearchProps & React.RefAttributes<InputRef>>;
22
22
  TextArea: React.ForwardRefExoticComponent<import("antd/es/input").TextAreaProps & React.RefAttributes<import("antd/es/input/TextArea").TextAreaRef>>;
23
- Password: React.ForwardRefExoticComponent<import("antd/es/input").PasswordProps & React.RefAttributes<import("antd").InputRef>>;
24
- }, any, InputProps, never> & import("hoist-non-react-statics").NonReactStatics<React.ForwardRefExoticComponent<AntdInputProps & React.RefAttributes<import("antd").InputRef>> & {
23
+ Password: React.ForwardRefExoticComponent<import("antd/es/input").PasswordProps & React.RefAttributes<InputRef>>;
24
+ }, any, InputProps, never> & import("hoist-non-react-statics").NonReactStatics<React.ForwardRefExoticComponent<AntdInputProps & React.RefAttributes<InputRef>> & {
25
25
  Group: React.FC<import("antd/es/input").GroupProps>;
26
- Search: React.ForwardRefExoticComponent<import("antd/es/input").SearchProps & React.RefAttributes<import("antd").InputRef>>;
26
+ Search: React.ForwardRefExoticComponent<import("antd/es/input").SearchProps & React.RefAttributes<InputRef>>;
27
27
  TextArea: React.ForwardRefExoticComponent<import("antd/es/input").TextAreaProps & React.RefAttributes<import("antd/es/input/TextArea").TextAreaRef>>;
28
- Password: React.ForwardRefExoticComponent<import("antd/es/input").PasswordProps & React.RefAttributes<import("antd").InputRef>>;
28
+ Password: React.ForwardRefExoticComponent<import("antd/es/input").PasswordProps & React.RefAttributes<InputRef>>;
29
29
  }, {}> & {
30
30
  DefaultInput: typeof AntdInput;
31
31
  CustomSearch: typeof SearchInput;
32
32
  };
33
- declare const SearchInput: React.FC<InputProps>;
33
+ declare const SearchInput: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<InputRef>>;
34
34
  export declare const TextArea: React.ForwardRefExoticComponent<import("antd/es/input").TextAreaProps & React.RefAttributes<import("antd/es/input/TextArea").TextAreaRef>>;
35
35
  export {};
@@ -23,7 +23,7 @@ import { getPreventKeyboardAction } from '@antscorp/antsomi-ui/es/utils/web';
23
23
  import { StyledInput } from './styled';
24
24
  import { globalToken } from '@antscorp/antsomi-ui/es/constants';
25
25
  const PATH = '@antscorp/antsomi-ui/es/components/atoms/Input/Input.tsx';
26
- const OriginInput = props => {
26
+ const OriginInput = React.forwardRef((props, ref) => {
27
27
  // Props
28
28
  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"]);
29
29
  // State
@@ -79,7 +79,7 @@ const OriginInput = props => {
79
79
  }
80
80
  const content = (React.createElement(React.Fragment, null,
81
81
  label && renderRequiredLabel(label),
82
- React.createElement(StyledInput, Object.assign({}, restProps, { value: value, onBlur: e => {
82
+ React.createElement(StyledInput, Object.assign({}, restProps, { ref: ref, value: value, onBlur: e => {
83
83
  if (!isFocused) {
84
84
  setFocused(true);
85
85
  }
@@ -89,14 +89,14 @@ const OriginInput = props => {
89
89
  if (!withWrapper)
90
90
  return content;
91
91
  return React.createElement("div", { className: "input__wrapper" }, content);
92
- };
92
+ });
93
93
  OriginInput.defaultProps = {
94
94
  debounce: 400,
95
95
  isHideErrMessage: false,
96
96
  withWrapper: true,
97
97
  };
98
98
  export const Input = OriginInput;
99
- const SearchInput = props => (React.createElement(OriginInput, Object.assign({ bordered: false, autoFocus: true, suffix: React.createElement(Icon, { type: "icon-ants-search-2", size: 24, color: globalToken === null || globalToken === void 0 ? void 0 : globalToken.bw8 }) }, props, { className: `${props.className} antsomi-search-input` })));
99
+ const SearchInput = React.forwardRef((props, ref) => (React.createElement(OriginInput, Object.assign({ bordered: false, autoFocus: true, suffix: React.createElement(Icon, { type: "icon-ants-search-2", size: 24, color: globalToken === null || globalToken === void 0 ? void 0 : globalToken.bw8 }) }, props, { ref: ref, className: `${props.className} antsomi-search-input` }))));
100
100
  Input.CustomSearch = SearchInput;
101
101
  Input.TextArea = StyledInput.TextArea;
102
102
  Input.DefaultInput = AntdInput;
@@ -1,4 +1,6 @@
1
+ var _a;
1
2
  // Components
3
+ import { THEME } from '@antscorp/antsomi-ui/es/constants';
2
4
  import { Flex } from '../Flex';
3
5
  // Styled
4
6
  import styled from 'styled-components';
@@ -54,7 +56,7 @@ export const NavigationButton = styled(Flex) `
54
56
 
55
57
  i {
56
58
  font-size: 12px;
57
- color: #595959;
59
+ color: ${(_a = THEME === null || THEME === void 0 ? void 0 : THEME.token) === null || _a === void 0 ? void 0 : _a.bw8};
58
60
  }
59
61
 
60
62
  &.navigation--previous {
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
- export declare const Rate: import("react").ForwardRefExoticComponent<import("antd").RateProps & import("react").RefAttributes<import("rc-rate/lib/Rate").RateRef>>;
1
+ export { Rate } from 'antd';
@@ -1,2 +1 @@
1
- import { Rate as AntdRate } from 'antd';
2
- export const Rate = AntdRate;
1
+ export { Rate } from 'antd';
@@ -1,2 +1 @@
1
- export declare const RequiredLabelWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
2
1
  export declare const StyledRequired: import("styled-components").StyledComponent<"span", any, {}, never>;
@@ -3,7 +3,6 @@ var _a;
3
3
  import styled from 'styled-components';
4
4
  // Constants
5
5
  import { THEME } from '@antscorp/antsomi-ui/es/constants';
6
- export const RequiredLabelWrapper = styled.div ``;
7
6
  export const StyledRequired = styled.span `
8
7
  color: ${(_a = THEME.token) === null || _a === void 0 ? void 0 : _a.red6};
9
8
  margin-right: 4px;
@@ -6,7 +6,7 @@ export const DomainManagementIcon = forwardRef((props, ref) => {
6
6
  // width="29"
7
7
  // height="29"
8
8
  viewBox: "0 0 29 29", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg" }, props, { ref: ref, width: width, height: height }),
9
- React.createElement("path", { d: "M10 20C8.02219 20 6.08879 19.4135 4.4443 18.3147C2.79981 17.2159 1.51809 15.6541 0.761209 13.8268C0.00433286 11.9996 -0.1937 9.98891 0.192152 8.0491C0.578004 6.10929 1.53041 4.32746 2.92894 2.92894C4.32746 1.53041 6.10929 0.578004 8.0491 0.192152C9.98891 -0.1937 11.9996 0.00433286 13.8268 0.761209C15.6541 1.51809 17.2159 2.79981 18.3147 4.4443C19.4135 6.08879 20 8.02219 20 10C19.9974 12.6514 18.9429 15.1934 17.0681 17.0681C15.1934 18.9429 12.6514 19.9974 10 20ZM6.59667 8.39167H6.60667C7.42334 8.42334 8.87667 9.875 9.285 11.07C9.4297 11.5445 9.47273 12.0441 9.41127 12.5364C9.34982 13.0286 9.18526 13.5023 8.92834 13.9267C8.79 14.2283 8.61 14.6683 8.41834 15.135C8.09667 15.9233 7.73167 16.8167 7.41834 17.42C8.69991 17.8646 10.0747 17.9705 11.4092 17.7272C12.7437 17.484 13.9927 16.8999 15.035 16.0317C14.99 15.1317 15 12 15 11.9633C14.6817 11.8633 11.9267 10.9117 12.5 8.74834C12.7925 8.21523 13.2351 7.77975 13.7728 7.49591C14.3106 7.21207 14.9198 7.09237 15.525 7.15167C16.1834 7.14554 16.8371 7.26372 17.4517 7.5C17.1519 6.60523 16.6922 5.77228 16.095 5.04167C16.0615 5.00484 16.0201 4.97598 15.974 4.95724C15.9278 4.93849 15.8781 4.93032 15.8283 4.93334C15.606 4.95883 15.3951 5.04513 15.2187 5.18274C15.0422 5.32035 14.9072 5.50394 14.8283 5.71334C14.7967 5.80667 14.7733 5.895 14.7483 5.98167C14.6417 6.365 14.565 6.64834 14.0817 6.64834C13.9698 6.64709 13.8582 6.63593 13.7483 6.615C13.6293 6.60047 13.5146 6.56124 13.4115 6.49983C13.3085 6.43841 13.2194 6.35616 13.15 6.25834C13.0268 6.04163 12.986 5.78774 13.035 5.54334H13.7483V5H13.7383C13.5433 4.91667 13.0833 4.70334 13.0283 4.53834C13.023 4.52714 13.0202 4.5149 13.0202 4.5025C13.0202 4.49011 13.023 4.47786 13.0283 4.46667C13.4144 4.07223 13.849 3.72837 14.3217 3.44334C14.0489 3.26422 13.7656 3.10171 13.4733 2.95667C13.3667 3.14667 13.1217 3.22834 12.66 3.22834C12.5617 3.22834 12.4483 3.22834 12.315 3.21667C12.2256 3.22398 12.1359 3.20711 12.0552 3.16781C11.9746 3.12852 11.906 3.06825 11.8567 2.99334C11.8247 2.89165 11.8196 2.78343 11.8418 2.67918C11.864 2.57493 11.9127 2.47819 11.9833 2.39834C10.7781 2.08637 9.51627 2.06239 8.3 2.32834C8.26785 3.51083 7.93887 4.66625 7.34334 5.68834C7.275 5.815 7.205 5.94167 7.13834 6.07334C6.67167 6.98 4.48167 7.85 4.46 7.85834C4.85392 8.4311 5.21183 9.02781 5.53167 9.645C5.53874 9.3457 5.64838 9.0579 5.84224 8.82975C6.0361 8.60161 6.30243 8.44696 6.59667 8.39167ZM2.375 8.09334C1.99053 9.64021 2.08472 11.2674 2.6451 12.7595C3.20549 14.2517 4.20567 15.5386 5.51334 16.45C5.59575 15.6714 5.60356 14.8867 5.53667 14.1067L3.75 12.5L4.28667 10C4.27834 10 3.13167 8.73167 2.375 8.09334Z" }),
10
- React.createElement("path", { d: "M13.3674 12.0699L11.2275 11.2247L12.0693 13.3659L16.2184 23.9195L17.0515 26.0386L18.0482 23.9913L19.1392 21.7502L22.1044 24.708L22.8088 25.4106L23.515 24.7099L24.7044 23.5297L25.4298 22.8099L24.6944 22.1003L21.7366 19.2459L24.1054 18.1204L26.1842 17.1326L24.0436 16.2871L13.3674 12.0699Z", stroke: "white", strokeWidth: "2" }),
11
- React.createElement("path", { d: "M19.016 18.8012C19.0016 18.8894 18.9992 18.978 19.0081 19.0648C18.9031 19.0483 18.7949 19.0485 18.6873 19.0666C18.3687 19.1202 18.0957 19.3245 17.9543 19.615L17.2466 21.0686L14.7725 14.7753L21.1682 17.3017L19.5737 18.0593C19.2773 18.2001 19.0689 18.4774 19.016 18.8012Z", fill: "white", stroke: "#595959", strokeWidth: "2", strokeMiterlimit: "7.6613", strokeLinejoin: "round" })));
9
+ React.createElement("path", { d: "M15.7,15.7l1.9,0.8c1.6-1.8,2.4-4.1,2.4-6.5c0-2-0.6-3.9-1.7-5.6c-1.1-1.6-2.7-2.9-4.5-3.7C12,0,10-0.2,8,0.2\n\tC6.1,0.6,4.3,1.5,2.9,2.9C1.5,4.3,0.6,6.1,0.2,8c-0.4,2-0.2,4,0.6,5.8s2,3.4,3.7,4.5C6.1,19.4,8,20,10,20c2.3,0,4.7-0.9,6.4-2.4\n\tL15.7,15.7z M5.5,16.5c-1.3-0.9-2.3-2.2-2.9-3.7C2.1,11.3,2,9.6,2.4,8.1C3.1,8.7,4.3,10,4.3,10l-0.5,2.5l1.8,1.6\n\tC5.6,14.9,5.6,15.7,5.5,16.5z M13.8,7.5c-0.5,0.3-1,0.7-1.3,1.3C11.9,11,14.7,11.9,15,12c0,0,0,3.2,0,4.1c-1,0.9-2.3,1.5-3.6,1.7\n\tc-1.3,0.2-2.7,0.1-4-0.3c0.3-0.6,0.7-1.5,1-2.3c0.2-0.5,0.4-0.9,0.5-1.2c0.3-0.4,0.4-0.9,0.5-1.4c0.1-0.5,0-1-0.1-1.5\n\tC8.9,9.9,7.4,8.4,6.6,8.4C6.3,8.4,6,8.6,5.8,8.8S5.5,9.3,5.5,9.6C5.2,9,4.9,8.4,4.5,7.9c0,0,2.2-0.9,2.7-1.8C7.3,6,7.3,5.8,7.4,5.7\n\tc0.6-1,0.9-2.2,1-3.4c1.2-0.3,2.5-0.2,3.7,0.1C12,2.5,12,2.6,12,2.7c0,0.1,0,0.2,0,0.3s0.1,0.1,0.2,0.2c0.1,0,0.2,0.1,0.3,0\n\tc0.1,0,0.2,0,0.3,0c0.5,0,0.7-0.1,0.8-0.3c0.3,0.1,0.6,0.3,0.8,0.5c-0.5,0.3-0.9,0.6-1.3,1c0.1,0.2,0.5,0.4,0.7,0.5v0.5H13\n\tc0,0.2,0,0.5,0.1,0.7c0.1,0.1,0.2,0.2,0.3,0.2c0.1,0.1,0.2,0.1,0.3,0.1c0.1,0,0.2,0,0.3,0c0.5,0,0.6-0.3,0.7-0.7\n\tc0-0.1,0-0.2,0.1-0.3C14.9,5.2,15,5,15.2,4.9c0.2,0.1,0.4,0.1,0.6,0h0.1c0,0,0.1,0,0.1,0.1c0.6,0.7,1.1,1.6,1.4,2.5\n\tc-0.6-0.2-1.3-0.4-1.9-0.3C14.9,7.1,14.3,7.2,13.8,7.5z" }),
10
+ React.createElement("path", { fill: "white", d: "M28.7,17L9.5,9.4L17,28.5l2.5-5.1l3.4,3.4l4.1-4l-3.4-3.3L28.7,17z M19,18c-0.1,0-0.2,0.2-0.3,0.4l-0.1,0.2\n\tl-0.2,0.1c-0.2,0.1-0.4,0.2-0.6,0.4l-0.5,0.5l-1.5-3.9l4.5,1.8L19,18z" }),
11
+ React.createElement("path", { d: "M20,19l3.7-1.7L13,13l4.1,10.6l1.7-3.5l4,3.9l1.2-1.2L20,19z M18.2,18.2c-0.3,0.1-0.6,0.3-0.8,0.5l-0.8-2.1l2.2,0.9\n\tC18.5,17.6,18.3,17.9,18.2,18.2z" })));
12
12
  });
@@ -12,7 +12,7 @@ export const AccountListing = React.forwardRef((props, ref) => {
12
12
  const { className, apiConfig, showAllAccount = true, currentAccount = '', onChange } = props;
13
13
  // States
14
14
  const [searchValue, setSearchValue] = useState('');
15
- const { accountData, recentData } = useAccountSelection(apiConfig);
15
+ const { accountData, recentData, updateRecentAccount } = useAccountSelection(apiConfig);
16
16
  const isAllAccount = currentAccount === 'all';
17
17
  useImperativeHandle(ref, () => ({
18
18
  getUsers() {
@@ -21,8 +21,17 @@ export const AccountListing = React.forwardRef((props, ref) => {
21
21
  }), [recentData, accountData]);
22
22
  // Handlers
23
23
  const handleSelectAccount = useCallback((userId) => {
24
+ const currentRecent = (recentData === null || recentData === void 0 ? void 0 : recentData.value) || [];
25
+ const body = userId !== currentRecent[0]
26
+ ? [userId, currentRecent[0]]
27
+ : currentRecent[1]
28
+ ? [userId, currentRecent[1]]
29
+ : [userId, currentRecent[0]];
30
+ updateRecentAccount(body.map(id => Number(id)));
24
31
  onChange === null || onChange === void 0 ? void 0 : onChange(userId);
25
- }, [onChange]);
32
+ },
33
+ // eslint-disable-next-line react-hooks/exhaustive-deps
34
+ [onChange, recentData]);
26
35
  return (React.createElement(AccountSelectionStyled, { className: className },
27
36
  React.createElement(Input, { placeholder: "Search", suffix: React.createElement(Icon, { type: "icon-ants-search-2", style: { fontSize: '24px', color: (_a = THEME.token) === null || _a === void 0 ? void 0 : _a.bw8 } }), value: searchValue, onChange: event => setSearchValue(event.target.value) }),
28
37
  React.createElement("div", { className: "account-list" },
@@ -8,5 +8,7 @@ export interface AccountSelectionProps extends Omit<AccountListingProps, 'onChan
8
8
  zIndex?: PopoverProps['zIndex'];
9
9
  onChange?: (userId: string) => void;
10
10
  getPopupContainer?: PopoverProps['getPopupContainer'];
11
+ /** refresh recent account when select account */
12
+ refreshOnSelect?: boolean;
11
13
  }
12
14
  export declare const AccountSelection: React.FC<AccountSelectionProps>;
@@ -21,12 +21,12 @@ import { AccountListing } from './AccountListing';
21
21
  // Constants
22
22
  import { useAccountSelection } from './hooks';
23
23
  export const AccountSelection = props => {
24
- const { show = true, inputStyle = 'input', inputClassName, onChange, getPopupContainer, zIndex } = props, accountListingProps = __rest(props, ["show", "inputStyle", "inputClassName", "onChange", "getPopupContainer", "zIndex"]);
24
+ const { show = true, inputStyle = 'input', inputClassName, onChange, getPopupContainer, zIndex, refreshOnSelect } = props, accountListingProps = __rest(props, ["show", "inputStyle", "inputClassName", "onChange", "getPopupContainer", "zIndex", "refreshOnSelect"]);
25
25
  const { apiConfig, currentAccount = '' } = props;
26
26
  // States
27
27
  const [inputLabel, setInputLabel] = useState('');
28
28
  const [open, setOpen] = useState(false);
29
- const { accountData } = useAccountSelection(apiConfig);
29
+ const { accountData, refetchRecentAccount } = useAccountSelection(apiConfig);
30
30
  // Side Effects
31
31
  useEffect(() => {
32
32
  var _a;
@@ -40,6 +40,11 @@ export const AccountSelection = props => {
40
40
  setOpen(false);
41
41
  onChange === null || onChange === void 0 ? void 0 : onChange(String(userId));
42
42
  }, [onChange]);
43
+ useEffect(() => {
44
+ if (open && refreshOnSelect) {
45
+ refetchRecentAccount();
46
+ }
47
+ }, [open, refreshOnSelect, refetchRecentAccount]);
43
48
  return (show && (React.createElement(Popover, { content: React.createElement(AccountListing, Object.assign({}, accountListingProps, { onChange: handleSelectAccount })), trigger: "click", overlayInnerStyle: { padding: 0 }, getPopupContainer: getPopupContainer, placement: "bottomLeft", arrow: false, open: open, onOpenChange: setOpen, zIndex: zIndex || 1300 },
44
49
  React.createElement(PopoverFieldStyled, { className: `${inputStyle || ''} ${inputClassName || ''}` },
45
50
  React.createElement(Tooltip, { title: inputLabel },
@@ -17,5 +17,7 @@ export declare const useAccountSelection: (apiConfig: {
17
17
  }) => {
18
18
  recentData?: AccountRecent;
19
19
  accountData: Array<AccountData>;
20
+ updateRecentAccount: (values: [number, number]) => void;
21
+ refetchRecentAccount: () => void;
20
22
  };
21
23
  export {};
@@ -1,7 +1,7 @@
1
1
  // Libraries
2
2
  import { useMemo } from 'react';
3
3
  // Queries
4
- import { useGetAccountList, useGetPermissionAccountList, useGetRecentAccount, } from '@antscorp/antsomi-ui/es/queries';
4
+ import { useGetAccountList, useGetPermissionAccountList, useGetRecentAccount, useUpdateRecentAccount, } from '@antscorp/antsomi-ui/es/queries';
5
5
  // Constant
6
6
  import { APP_CODES } from '@antscorp/antsomi-ui/es/constants';
7
7
  const { APP_ANTALYSER, DATAFLOWS } = APP_CODES;
@@ -35,12 +35,15 @@ export const useAccountSelection = (apiConfig) => {
35
35
  enabled: isUsePermissionAccount(appCode || '') && !!token && !!userId && !!permissionDomain,
36
36
  },
37
37
  });
38
- const { data: recentData } = useGetRecentAccount({
38
+ const { data: recentData, refetch: refetchRecentAccount } = useGetRecentAccount({
39
39
  apiConfig,
40
40
  options: {
41
41
  enabled: !isUsePermissionAccount(appCode || ''),
42
42
  },
43
43
  });
44
+ const { mutateAsync: updateRecentAccount } = useUpdateRecentAccount({
45
+ apiConfig,
46
+ });
44
47
  // Memos
45
48
  const accountData = useMemo(() => {
46
49
  if (isUsePermissionAccount(appCode || '')) {
@@ -53,5 +56,5 @@ export const useAccountSelection = (apiConfig) => {
53
56
  }
54
57
  return (data === null || data === void 0 ? void 0 : data.entries) || [];
55
58
  }, [appCode, data === null || data === void 0 ? void 0 : data.entries, permissionAccountList]);
56
- return { recentData, accountData };
59
+ return { recentData, accountData, updateRecentAccount, refetchRecentAccount };
57
60
  };
@@ -696,7 +696,7 @@ const CaptureScreen = (props) => {
696
696
  'icon-ants-mute': React.createElement(MuteIcon, { style: style }),
697
697
  'icon-ants-pause': React.createElement(PauseIcon, { style: style }),
698
698
  'icon-ants-stop-record': React.createElement(StopRecordIcon, { style: style }),
699
- }[name]);
699
+ })[name];
700
700
  const renderDrawActionList = () => DRAW_ACTION_LIST.map(drawItem => {
701
701
  var _a, _b, _c, _d;
702
702
  if ((drawItem === null || drawItem === void 0 ? void 0 : drawItem.type) === 'divider') {
@@ -112,7 +112,7 @@ export const HeaderV2 = memo(props => {
112
112
  React.createElement("div", { className: "left-side" },
113
113
  showLogo && (React.createElement(LogoWrapper, { className: "logo-wrapper" },
114
114
  React.createElement("img", { src: SubLogoAntsomi, alt: "Antsomi sub logo" }))),
115
- React.createElement(AccountSelection, Object.assign({}, accountSelectionProps, { currentAccount: selectedAccount, apiConfig: accountSelectionApiConfig, onChange: handleChangeAccount, inputStyle: inputStyle })),
115
+ React.createElement(AccountSelection, Object.assign({}, accountSelectionProps, { currentAccount: selectedAccount, apiConfig: accountSelectionApiConfig, onChange: handleChangeAccount, inputStyle: inputStyle, refreshOnSelect: true })),
116
116
  React.createElement("div", { className: "title-container" },
117
117
  breadcrumbs ? (React.createElement("div", { className: "header-breadcrumbs" }, breadcrumbs.map((item, index) => (React.createElement(React.Fragment, { key: `${item.title}_${item.link}` },
118
118
  isNil(item.useExternalLink) && !item.useExternalLink ? (React.createElement(Link, { to: item.link || '', className: "header-breadcrumbs__item" }, item.title)) : (React.createElement("a", { href: item.link, className: "header-breadcrumbs__item" }, item.title)),
@@ -1,4 +1,4 @@
1
- var _a;
1
+ var _a, _b;
2
2
  import { THEME } from '@antscorp/antsomi-ui/es/constants';
3
3
  import styled from 'styled-components';
4
4
  export const StyledPeopleAccessRoot = styled.div `
@@ -36,7 +36,7 @@ export const StyledPeopleAccessRoot = styled.div `
36
36
  }
37
37
 
38
38
  .email {
39
- color: #595959;
39
+ color: ${(_b = THEME === null || THEME === void 0 ? void 0 : THEME.token) === null || _b === void 0 ? void 0 : _b.bw8};
40
40
  }
41
41
  }
42
42
 
@@ -30,193 +30,6 @@ import { Button, Flex, Typography, Spin, Tooltip, Icon } from '../../atoms';
30
30
  import { THUMBNAIL_CARD_ACTION_OPTIONS, THUMBNAIL_CARD_DEFAULT_HEIGHT, THUMBNAIL_CARD_DEFAULT_WIDTH, } from './constants';
31
31
  import { getUrlNoCache, checkShowSkeletonBaseUrl } from '@antscorp/antsomi-ui/es/utils';
32
32
  import { translations } from '@antscorp/antsomi-ui/es/locales/translations';
33
- // export const ThumbnailCard: React.FC<ThumbnailCardProps> = memo(props => {
34
- // const [modal, contextHolder] = Modal.useModal();
35
- // const {
36
- // id,
37
- // name,
38
- // width = THUMBNAIL_CARD_DEFAULT_WIDTH,
39
- // height = THUMBNAIL_CARD_DEFAULT_HEIGHT,
40
- // thumbnail,
41
- // thumbnailFit,
42
- // removable = true,
43
- // actionAvailable = true,
44
- // showSkeleton,
45
- // loading = false,
46
- // removeModalProps,
47
- // editBtnProps,
48
- // previewBtnProps,
49
- // thumbnailCacheValue,
50
- // actionButtons,
51
- // onClickWrapper,
52
- // ...restOfProps
53
- // } = props;
54
- // const { onOk, ...restOfRemoveTemplateModalProps } = removeModalProps || {};
55
- // const {
56
- // text: editText = 'Use template',
57
- // onClick: onClickEdit,
58
- // ...restOfEditBtnProps
59
- // } = editBtnProps || {};
60
- // const {
61
- // text: previewText = 'Preview',
62
- // onClick: onClickPreview,
63
- // ...restOfPreviewBtnProps
64
- // } = previewBtnProps || {};
65
- // // Memo
66
- // const showSkeletonMemo =
67
- // // NOTES: Hot fix for showSkeleton base url if showSkeleton is not defined
68
- // typeof showSkeleton === 'undefined'
69
- // ? checkShowSkeletonBaseUrl(thumbnail)
70
- // : typeof showSkeleton === 'function'
71
- // ? showSkeleton(props)
72
- // : showSkeleton;
73
- // // Handlers
74
- // const handleRemoveThumbnail: React.MouseEventHandler<HTMLElement> = e => {
75
- // e.stopPropagation();
76
- // modal.confirm({
77
- // title: 'Remove template',
78
- // centered: true,
79
- // icon: <Icon type="icon-ants-info" style={{ fontSize: 16, lineHeight: '25px' }} />,
80
- // content: (
81
- // <div>
82
- // <p>Are you sure you want to remove the template?</p>
83
- // <p>This action can not be undone.</p>
84
- // </div>
85
- // ),
86
- // okText: 'Remove',
87
- // cancelText: 'Cancel',
88
- // closable: true,
89
- // ...restOfRemoveTemplateModalProps,
90
- // onOk: async () => {
91
- // if (onOk) onOk(id);
92
- // },
93
- // });
94
- // };
95
- // const handleWrapperClick: React.MouseEventHandler<HTMLElement> = e => {
96
- // e.stopPropagation();
97
- // onClickWrapper?.(id);
98
- // };
99
- // // Handlers
100
- // const renderActionButtons = () => {
101
- // if (!actionButtons) return null;
102
- // return Object.keys(actionButtons)
103
- // .map(key => {
104
- // const option = THUMBNAIL_CARD_ACTION_OPTIONS[key];
105
- // const actionSettings = actionButtons[key as TActionButtonKey];
106
- // if (actionSettings) {
107
- // const { buttonProps, key, customRender } = actionSettings;
108
- // const icon = actionSettings.icon || option.icon || '';
109
- // const label = actionSettings.label || option.label || '';
110
- // const ButtonComponent = (
111
- // <Tooltip title={label}>
112
- // <Button
113
- // key={key || option.key}
114
- // type="primary"
115
- // icon={
116
- // <Icon type={icon || option.icon} style={{ fontSize: 24, color: '#FFFFFF' }} />
117
- // }
118
- // {...buttonProps}
119
- // />
120
- // </Tooltip>
121
- // );
122
- // /**
123
- // * Handle custom render for action button
124
- // * If customRender is a function, return the function callback the ButtonComponent
125
- // * If not, return ButtonComponent
126
- // */
127
- // return typeof customRender === 'function'
128
- // ? customRender(ButtonComponent)
129
- // : ButtonComponent;
130
- // }
131
- // return null;
132
- // })
133
- // .filter(Boolean);
134
- // };
135
- // return (
136
- // <Flex gap={10} vertical {...restOfProps} style={{ width, ...restOfProps.style }}>
137
- // <ThumbnailCardWrapper
138
- // $showSkeleton={showSkeletonMemo}
139
- // style={{ height, cursor: actionAvailable ? 'default' : 'pointer' }}
140
- // onClick={handleWrapperClick}
141
- // >
142
- // <div className="screen">
143
- // {thumbnail && (
144
- // <img
145
- // src={getUrlNoCache(thumbnail, thumbnailCacheValue)}
146
- // alt=""
147
- // style={{ objectFit: thumbnailFit }}
148
- // onError={e => {
149
- // e.currentTarget.style.display = 'none';
150
- // }}
151
- // />
152
- // )}
153
- // </div>
154
- // {actionAvailable && !loading && (
155
- // <>
156
- // <Flex className="center-action" align="center" gap={10} vertical>
157
- // <Button
158
- // type="primary"
159
- // className="animate__animated animate__fadeIn"
160
- // {...restOfEditBtnProps}
161
- // onClick={e => {
162
- // e.stopPropagation();
163
- // onClickEdit?.(id);
164
- // }}
165
- // >
166
- // <Typography.Text
167
- // ellipsis={{ tooltip: editText }}
168
- // style={{ maxWidth: '100%', color: 'inherit' }}
169
- // >
170
- // {editText}
171
- // </Typography.Text>
172
- // </Button>
173
- // <Button
174
- // className="animate__animated animate__fadeIn"
175
- // onClick={e => {
176
- // e.stopPropagation();
177
- // onClickPreview?.(id);
178
- // }}
179
- // {...restOfPreviewBtnProps}
180
- // >
181
- // <Typography.Text
182
- // ellipsis={{ tooltip: previewText }}
183
- // style={{ maxWidth: '100%', color: 'inherit' }}
184
- // >
185
- // {previewText}
186
- // </Typography.Text>
187
- // </Button>
188
- // </Flex>
189
- // <div className="top-right-corner-action animate__animated animate__fadeIn">
190
- // {renderActionButtons()}
191
- // {removable && (
192
- // <Tooltip title={i18nInstance.t(translations.remove).toString()}>
193
- // <Button
194
- // type="primary"
195
- // icon={
196
- // <Icon
197
- // type="icon-ants-trash-outline"
198
- // style={{ fontSize: 24, color: '#FFFFFF' }}
199
- // />
200
- // }
201
- // onClick={handleRemoveThumbnail}
202
- // />
203
- // </Tooltip>
204
- // )}
205
- // </div>
206
- // <div className="backdrop" />
207
- // <div>{contextHolder}</div>
208
- // </>
209
- // )}
210
- // {loading && <Spin className="thumbnail__loading" spinning />}
211
- // </ThumbnailCardWrapper>
212
- // {!!name && (
213
- // <Typography.Text ellipsis={{ tooltip: name }} style={{ maxWidth: '100%' }}>
214
- // {name}
215
- // </Typography.Text>
216
- // )}
217
- // </Flex>
218
- // );
219
- // });
220
33
  export const ThumbnailCard = (props) => {
221
34
  const [modal, contextHolder] = Modal.useModal();
222
35
  const { id, name, width = THUMBNAIL_CARD_DEFAULT_WIDTH, height = THUMBNAIL_CARD_DEFAULT_HEIGHT, thumbnail, thumbnailFit, removable = true, actionAvailable = true, showSkeleton, loading = false, removeModalProps, editBtnProps, previewBtnProps, thumbnailCacheValue, actionButtons, onClickWrapper } = props, restOfProps = __rest(props, ["id", "name", "width", "height", "thumbnail", "thumbnailFit", "removable", "actionAvailable", "showSkeleton", "loading", "removeModalProps", "editBtnProps", "previewBtnProps", "thumbnailCacheValue", "actionButtons", "onClickWrapper"]);
@@ -1,4 +1,4 @@
1
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
1
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
2
2
  import styled from 'styled-components';
3
3
  import { THEME } from '@antscorp/antsomi-ui/es/constants';
4
4
  export const InputSearchStyled = styled.div `
@@ -45,7 +45,7 @@ export const InputSearchStyled = styled.div `
45
45
 
46
46
  svg {
47
47
  position: absolute;
48
- fill: #595959;
48
+ fill: ${(_a = THEME === null || THEME === void 0 ? void 0 : THEME.token) === null || _a === void 0 ? void 0 : _a.bw8};
49
49
  right: 5px;
50
50
  width: 20px;
51
51
  height: 20px;
@@ -70,7 +70,7 @@ export const TriggerPopoverStyled = styled.div `
70
70
  justify-content: space-between;
71
71
  gap: 15px;
72
72
  padding: 3px 3px 3px 10px;
73
- border: 1px solid ${(_a = THEME.token) === null || _a === void 0 ? void 0 : _a.bw3};
73
+ border: 1px solid ${(_b = THEME.token) === null || _b === void 0 ? void 0 : _b.bw3};
74
74
  background-color: white;
75
75
  border-radius: 999px;
76
76
 
@@ -105,7 +105,7 @@ export const PackageSharingStyled = styled.div `
105
105
  font-size: 13px;
106
106
  color: #666;
107
107
 
108
- background-color: ${(_b = THEME.token) === null || _b === void 0 ? void 0 : _b.blue1_2};
108
+ background-color: ${(_c = THEME.token) === null || _c === void 0 ? void 0 : _c.blue1_2};
109
109
 
110
110
  min-width: 400px;
111
111
  max-width: 400px;
@@ -203,14 +203,14 @@ export const PackageSharingStyled = styled.div `
203
203
  li {
204
204
  cursor: pointer;
205
205
  padding: 8px 5px;
206
- border-radius: ${(_c = THEME.token) === null || _c === void 0 ? void 0 : _c.borderRadius}px;
206
+ border-radius: ${(_d = THEME.token) === null || _d === void 0 ? void 0 : _d.borderRadius}px;
207
207
  display: flex;
208
208
  justify-content: space-between;
209
209
  align-items: center;
210
210
  gap: 10px;
211
211
 
212
212
  &:hover {
213
- background-color: ${(_d = THEME.token) === null || _d === void 0 ? void 0 : _d.blue};
213
+ background-color: ${(_e = THEME.token) === null || _e === void 0 ? void 0 : _e.blue};
214
214
  }
215
215
 
216
216
  .account-name {
@@ -257,7 +257,7 @@ export const PackageSharingStyled = styled.div `
257
257
  height: 42px;
258
258
  padding: 10px;
259
259
  border-radius: 10px;
260
- border: 1px solid ${(_e = THEME.token) === null || _e === void 0 ? void 0 : _e.bw4};
260
+ border: 1px solid ${(_f = THEME.token) === null || _f === void 0 ? void 0 : _f.bw4};
261
261
 
262
262
  & img {
263
263
  width: 100%;
@@ -281,15 +281,15 @@ export const PackageSharingStyled = styled.div `
281
281
  cursor: pointer;
282
282
  &:hover {
283
283
  .image-wrapper {
284
- background-color: ${(_f = THEME.token) === null || _f === void 0 ? void 0 : _f.blue};
285
- border-color: ${(_g = THEME.token) === null || _g === void 0 ? void 0 : _g.blue3};
284
+ background-color: ${(_g = THEME.token) === null || _g === void 0 ? void 0 : _g.blue};
285
+ border-color: ${(_h = THEME.token) === null || _h === void 0 ? void 0 : _h.blue3};
286
286
  }
287
287
  }
288
288
  &.disabled {
289
289
  cursor: default;
290
290
  .image-wrapper {
291
- background: ${(_h = THEME.token) === null || _h === void 0 ? void 0 : _h.blue1_1};
292
- border-color: ${(_j = THEME.token) === null || _j === void 0 ? void 0 : _j.blue7};
291
+ background: ${(_j = THEME.token) === null || _j === void 0 ? void 0 : _j.blue1_1};
292
+ border-color: ${(_k = THEME.token) === null || _k === void 0 ? void 0 : _k.blue7};
293
293
  img {
294
294
  cursor: default;
295
295
  }
@@ -298,7 +298,7 @@ export const PackageSharingStyled = styled.div `
298
298
  .image-wrapper {
299
299
  border: 1px solid #ddd;
300
300
  padding: 10px;
301
- border-radius: ${(_k = THEME.token) === null || _k === void 0 ? void 0 : _k.borderRadius}px;
301
+ border-radius: ${(_l = THEME.token) === null || _l === void 0 ? void 0 : _l.borderRadius}px;
302
302
  transition: all 0.2s ease-in-out;
303
303
  /* width: 108px;
304
304
  height: 45px; */
@@ -307,7 +307,7 @@ export const PackageSharingStyled = styled.div `
307
307
  }
308
308
  }
309
309
  .network-name {
310
- color: ${(_l = THEME.token) === null || _l === void 0 ? void 0 : _l.bw8};
310
+ color: ${(_m = THEME.token) === null || _m === void 0 ? void 0 : _m.bw8};
311
311
  font-size: 11px;
312
312
  margin-top: 5px;
313
313
  margin-bottom: 0;
@@ -337,7 +337,7 @@ export const PackageSharingStyled = styled.div `
337
337
  export const InnerCardStyled = styled.div `
338
338
  width: 370px;
339
339
  background-color: white;
340
- border-radius: ${(_m = THEME.token) === null || _m === void 0 ? void 0 : _m.borderRadius}px;
340
+ border-radius: ${(_o = THEME.token) === null || _o === void 0 ? void 0 : _o.borderRadius}px;
341
341
  padding: 10px;
342
342
  margin-bottom: 15px;
343
343
  `;
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  // Libraries
11
- import React, { memo, useEffect, useState } from 'react';
11
+ import React, { memo, useEffect, useRef, useState } from 'react';
12
12
  import { isEmpty } from 'lodash';
13
13
  import i18nInstance from '@antscorp/antsomi-ui/es/locales/i18n';
14
14
  // Components
@@ -44,6 +44,8 @@ export const SavedFilterAndMetrics = memo(props => {
44
44
  const [state, setState] = useState(initialState);
45
45
  // Variables
46
46
  const { searchValue } = state;
47
+ // Refs
48
+ const searchInputRef = useRef();
47
49
  // Memos
48
50
  const savedFilterList = useDeepCompareMemo(() => (list === null || list === void 0 ? void 0 : list.filter(({ name }) => searchStringQuery(name, searchValue))) || [], [list, searchValue]);
49
51
  const { matchedParents, results: filterMetricList } = useDeepCompareMemo(() => recursiveSearchItems({
@@ -55,6 +57,11 @@ export const SavedFilterAndMetrics = memo(props => {
55
57
  // Effects
56
58
  useEffect(() => {
57
59
  setState(initialState);
60
+ // Handle auto focus input search when component is mount
61
+ setTimeout(() => {
62
+ var _a;
63
+ (_a = searchInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
64
+ }, 200);
58
65
  }, []);
59
66
  // Handlers
60
67
  const renderSavedFilter = () => {
@@ -109,7 +116,7 @@ export const SavedFilterAndMetrics = memo(props => {
109
116
  }), [filterMetricList, onSelectFilterMetric]);
110
117
  const renderFilterMetrics = () => (React.createElement(Menu, { key: matchedParents.map(item => `${item.id}`).join(','), mode: "inline", inlineIndent: 10, defaultOpenKeys: matchedParents.map(item => `${item.id}`), items: filterMetricItems }));
111
118
  return (React.createElement(FilterSelectFieldsContent, null,
112
- React.createElement(Input, { bordered: false, value: searchValue, className: "search-input", autoFocus: true, onAfterChange: value => setState(prev => (Object.assign(Object.assign({}, prev), { searchValue: value }))), suffix: React.createElement(Icon, { type: "icon-ants-search-2", size: 24 }) }),
119
+ React.createElement(Input.CustomSearch, { ref: searchInputRef, value: searchValue, className: "search-input", autoFocus: true, onAfterChange: value => setState(prev => (Object.assign(Object.assign({}, prev), { searchValue: value }))) }),
113
120
  React.createElement(Divider, { style: { borderColor: globalToken === null || globalToken === void 0 ? void 0 : globalToken.bw3, margin: '8px 0 2px 0' } }),
114
121
  isEmpty(savedFilterList) && isEmpty(filterMetricList) ? (React.createElement(EmptyData, { showIcon: false, title: "No data" })) : (React.createElement(Scrollbars, { autoHeight: true, autoHeightMax: 300, autoHide: true },
115
122
  renderSavedFilter(),