@antscorp/antsomi-ui 2.0.15 → 2.0.17

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.
@@ -126,5 +126,5 @@ export const DrawerDetail = props => {
126
126
  onClose(e);
127
127
  }, children: _jsx(Icon, { type: "icon-ants-remove-slim", size: 14 }) })), showExpandButton && !fullScreen && (_jsx(ToggleDrawerSizeButton, { style: {
128
128
  ...(!showMenu && { background: '#ffffff' }),
129
- }, onClick: () => handleToggleDrawerSize(), collapse: collapseDrawer })), showMenu && (_jsxs(LeftMenu, { className: "animate__animated animate__fadeIn", children: [_jsxs("div", { children: [showClose && (_jsx(CloseBtn, { onClick: onClose, children: _jsx(Icon, { type: "icon-ants-remove-slim", size: 14 }) })), _jsx(Flex, { vertical: true, gap: 10, align: "center", justify: "center", children: items?.map((item) => (_jsx(Tooltip, { title: item?.label, mouseEnterDelay: 0.3, placement: "right", children: _jsx(MenuItem, { className: selectedKeys?.includes(item.key) ? 'active' : '', onClick: () => onClick && onClick(item), children: item.icon }, item?.key) }, item?.key))) })] }), _jsx(MenuFooter, { children: footer })] })), _jsxs(Content, { children: [headerProps?.children && (_jsx(DrawerHeader, { align: "center", ...restOfHeaderProps, children: headerChildren })), children] })] }));
129
+ }, onClick: () => handleToggleDrawerSize(), collapse: collapseDrawer })), showMenu && (_jsxs(LeftMenu, { className: "animate__animated animate__fadeIn", children: [_jsxs("div", { children: [showClose && (_jsx(CloseBtn, { onClick: onClose, children: _jsx(Icon, { type: "icon-ants-remove-slim", size: 14 }) })), _jsx(Flex, { vertical: true, gap: 10, align: "center", justify: "center", children: items?.map((item) => (_jsx(Tooltip, { title: item?.label, mouseEnterDelay: 0.3, placement: "right", children: _jsx(MenuItem, { className: selectedKeys?.includes(item.key) ? 'active' : '', onClick: () => onClick && onClick(item), children: item.icon }, item?.key) }, item?.key))) })] }), _jsx(MenuFooter, { children: footer })] })), _jsxs(Content, { className: "drawer-detail-content", children: [headerProps?.children && (_jsx(DrawerHeader, { align: "center", ...restOfHeaderProps, children: headerChildren })), children] })] }));
130
130
  };
@@ -344,7 +344,7 @@ export function MatchesAny(props) {
344
344
  return (_jsx(ConfigProvider, { theme: MATCHES_ANY_THEME, children: _jsxs(MatchesAnyWrapper, { ...restOfProps, vertical: true, justify: "space-between", children: [_jsxs(Flex, { style: { width: '100%', height: '100%' }, children: [renderSelectList(), renderSelectedList()] }), _jsxs(Flex, { className: "matches-any__footer", align: "center", justify: "space-between", children: [_jsxs(Flex, { align: "center", gap: 10, children: [_jsx(Button, { type: "primary", disabled: isDisableApply, onClick: onClickApply, children: t(translations.apply.title).toString() }), _jsx(Button, { onClick: () => onCancel(), children: t(translations.cancel.title).toString() })] }), showExtendValue && (_jsx(ExtendValuePopup, { getPopupContainer: trigger => trigger.parentElement || document.body, onApply: onApplyExtendValue, children: _jsx(Button, { icon: _jsx(Icon, { type: "icon-ants-empty-flag" }), children: t(translations.extendValue.title).toString() }) }))] })] }) }));
345
345
  }
346
346
  export function MatchesAnySelect(props) {
347
- const { placeholder = 'Select an item', dropdownStyle, objectName, selectedItems, items, loading, popupClassName, groupSelectProps, renderExtraValues, customItemRenders, popoverProps, listEmptyProps, selectedListEmptyProps, selectedTreeData, onChangeSearch, onChange = () => { }, onLoadMore, ...restProps } = props;
347
+ const { placeholder = 'Select an item', dropdownStyle, objectName, selectedItems, items, loading, popupClassName, groupSelectProps, renderExtraValues, customItemRenders, popoverProps, listEmptyProps, selectedListEmptyProps, selectedTreeData, error, onChangeSearch, onChange = () => { }, onLoadMore, ...restProps } = props;
348
348
  // State
349
349
  const [state, setState] = useState(initialState);
350
350
  // Variables
@@ -372,12 +372,12 @@ export function MatchesAnySelect(props) {
372
372
  },
373
373
  }, overlayStyle: { width: 700 }, overlayInnerStyle: {
374
374
  padding: 0,
375
- }, trigger: ['click'], destroyTooltipOnHide: true, onOpenChange: () => setState(prev => ({ ...prev, isOpenPopover: !isOpenPopover })), zIndex: 1400, ...popoverProps, children: _jsx(Tooltip, { mouseEnterDelay: 0.5, title: `${selectedItems ? selectedItems?.map(item => item.title).join(', ') : ''}`, overlayInnerStyle: {
375
+ }, trigger: ['click'], destroyTooltipOnHide: true, onOpenChange: () => setState(prev => ({ ...prev, isOpenPopover: !isOpenPopover })), zIndex: 1400, ...popoverProps, children: _jsxs(Tooltip, { mouseEnterDelay: 0.5, title: `${selectedItems ? selectedItems?.map(item => item.title).join(', ') : ''}`, overlayInnerStyle: {
376
376
  maxHeight: 300,
377
377
  overflow: 'auto',
378
- }, children: _jsx(Select, { title: "", value: value, placeholder: placeholder, popupMatchSelectWidth: 700, dropdownStyle: {
379
- ...dropdownStyle,
380
- display: 'none',
381
- padding: 0,
382
- }, loading: loading, ...restProps }) }) }));
378
+ }, children: [_jsx(Select, { title: "", value: value, placeholder: placeholder, popupMatchSelectWidth: 700, dropdownStyle: {
379
+ ...dropdownStyle,
380
+ display: 'none',
381
+ padding: 0,
382
+ }, loading: loading, status: props.status || (error ? 'error' : undefined), ...restProps }), !!error && _jsx(Text, { className: 'ant-form-item-explain-error', type: 'danger', children: error })] }) }));
383
383
  }
@@ -106,6 +106,7 @@ export const MatchesAnyWrapper = styled(props => _jsx(Flex, { ...props })) `
106
106
  gap: 10px;
107
107
  width: 100%;
108
108
  height: 100%;
109
+ user-select: text;
109
110
  overflow: auto;
110
111
 
111
112
  > .left-content {
@@ -52,6 +52,8 @@ export interface MatchesAnySelectProps<TItem = any> extends Omit<SelectProps, 'o
52
52
  selectedListEmptyProps?: EmptyDataProps;
53
53
  /** Search value */
54
54
  searchValue?: string;
55
+ /** Error message */
56
+ error?: string;
55
57
  /** Callback function that is called when the selected items change. */
56
58
  onChange?: (selectedItems: MatchesAnyItem<TItem>[], selectedTreeData?: MatchesAnyItem<TItem>[]) => void;
57
59
  /** Callback function that is called when the search value changes */
@@ -3,16 +3,13 @@ import { Tree as AntdTree } from 'antd';
3
3
  // styled
4
4
  import { StyledTree, StyledTreeDirectory } from './styled';
5
5
  // icon
6
- import { ExpandMoreIcon } from '../../icons';
6
+ import { DraftDocumentIcon, ExpandMoreIcon, FolderCreateNewFolderIcon } from '../../icons';
7
7
  const StandardTree = props => {
8
8
  const { switcherIcon = _jsx(ExpandMoreIcon, { size: 20 }), ...restProps } = props;
9
9
  return _jsx(StyledTree, { switcherIcon: switcherIcon, ...restProps });
10
10
  // return <StyledTree switcherIcon={(props) => <ExpandMoreIcon size={20} />} {...restProps} />;
11
11
  };
12
12
  export const Tree = AntdTree;
13
- const DirectoryTree = props => {
14
- const { switcherIcon = _jsx(ExpandMoreIcon, { size: 20 }), ...restProps } = props;
15
- return _jsx(StyledTreeDirectory, { switcherIcon: switcherIcon, ...restProps });
16
- };
13
+ const DirectoryTree = props => (_jsx(StyledTreeDirectory, { switcherIcon: ({ expanded }) => (_jsx(ExpandMoreIcon, { size: 20, style: !expanded ? { transform: 'rotate(-90deg)' } : undefined })), icon: ({ isLeaf }) => (isLeaf ? _jsx(DraftDocumentIcon, {}) : _jsx(FolderCreateNewFolderIcon, {})), ...props }));
17
14
  Tree.DirectoryTree = DirectoryTree;
18
15
  Tree.Standard = StandardTree;
@@ -37,7 +37,7 @@ export const AccountSetting = memo(forwardRef((props, ref) => {
37
37
  const [logo, setLogo] = useState({ url: '' });
38
38
  const [logoManual, setLogoManual] = useState({ url: '' });
39
39
  const [openChangeEmail, setOpenChangeEmail] = useState(null);
40
- const [apiEndpoint] = useState(`${iamDomain}/api/account/index/${accountId}?_token=${token}&_user_id=${accountId}&_account_id=${accountId}`);
40
+ const [apiEndpoint] = useState(`${iamDomain}api/account/index/${accountId}?_token=${token}&_user_id=${accountId}&_account_id=${accountId}`);
41
41
  const saveRef = useRef(false);
42
42
  const tempAccountRef = useRef({});
43
43
  const readyCheckRef = useRef(false);
@@ -4,6 +4,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
4
4
  import axios from 'axios';
5
5
  import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
6
6
  import { CookiesProvider, useCookies } from 'react-cookie';
7
+ import { useInView } from 'react-intersection-observer';
7
8
  // Icons
8
9
  import { Text } from '@antscorp/antsomi-ui/es/components/atoms/Text';
9
10
  import { Typography } from '@antscorp/antsomi-ui/es/components/atoms/Typography';
@@ -31,7 +32,14 @@ import { ENV } from '@antscorp/antsomi-ui/es/config';
31
32
  // };
32
33
  const InputSearch = props => {
33
34
  const { value, onChange, className, onClickRemove } = props;
34
- return (_jsxs(InputSearchStyled, { className: className || '', children: [_jsx("input", { className: "input-search-account", placeholder: "Search...", value: value, onChange: e => onChange(e.target.value) }), value ? (_jsx(CloseIcon, { className: "remove-icon", onClick: onClickRemove })) : (_jsx(SearchIcon, { className: "search-icon" }))] }));
35
+ const inputRef = useRef(null);
36
+ const { ref: wrapperRef, inView: componentInView } = useInView();
37
+ useEffect(() => {
38
+ if (componentInView) {
39
+ inputRef.current?.focus();
40
+ }
41
+ }, [componentInView]);
42
+ return (_jsxs(InputSearchStyled, { className: className || '', ref: wrapperRef, children: [_jsx("input", { className: "input-search-account", placeholder: "Search...", value: value, onChange: e => onChange(e.target.value), ref: inputRef }), value ? (_jsx(CloseIcon, { className: "remove-icon", onClick: onClickRemove })) : (_jsx(SearchIcon, { className: "search-icon" }))] }));
35
43
  };
36
44
  export const AccountSharing = props => {
37
45
  const { permissionDomain = '', iamDomain = '', token = '', accountId = 0, networkId = 0, appCode = '', lang = 'en', translateData = DEFAULT_TRANSLATE_DATA, urlEditProfile = '', callbackGetInfoAccount, urlLogout = '', isShowSharing = false, isShareAccountAccess = false, u_ogs = '', callbackLogout, usePrivilege = true, } = props;
@@ -511,5 +519,5 @@ export const AccountSharing = props => {
511
519
  backgroundColor: THEME.token?.blue1_2,
512
520
  padding: '20px 15px',
513
521
  width: '400px',
514
- }, children: _jsxs(TriggerPopoverStyled, { children: [_jsx("div", { className: "brand-logo", children: currentNetwork?.logo ? _jsx("img", { src: currentNetwork.logo, alt: "" }) : null }), _jsx("div", { className: "avatar", children: infoAccount ? _jsx("img", { src: infoAccount.avatar, alt: "" }) : null })] }) }), _jsx(AccountProfile, { accountId: accountId, iamDomain: iamDomain, token: token, isDisabledEdit: false, open: openAccountProfile, onClose: () => setOpenAccountProfile(false) })] }));
522
+ }, children: _jsxs(TriggerPopoverStyled, { children: [_jsx("div", { className: "brand-logo", children: currentNetwork?.logo ? _jsx("img", { src: currentNetwork.logo, alt: "" }) : null }), _jsx("div", { className: "avatar", children: infoAccount ? _jsx("img", { src: infoAccount.avatar, alt: "" }) : null })] }) }), _jsx(AccountProfile, { accountId: accountId, iamDomain: domain, token: token, isDisabledEdit: false, open: openAccountProfile, onClose: () => setOpenAccountProfile(false) })] }));
515
523
  };
@@ -106,8 +106,8 @@ export const PackageSharingStyled = styled.div `
106
106
 
107
107
  background-color: ${THEME.token?.blue1_2};
108
108
 
109
- min-width: 400px;
110
- max-width: 400px;
109
+ /* min-width: 400px;
110
+ max-width: 400px; */
111
111
 
112
112
  .info-account {
113
113
  display: flex;
@@ -30,7 +30,7 @@ import { expendDefault, formatParams, postCustomEvent } from './utils';
30
30
  const antIcon = _jsx(LoadingOutlined, { style: { fontSize: 40 }, spin: true });
31
31
  const Loading = ({ isLoading, height, width }) => isLoading && (_jsx(WrapperLoading, { className: "loader-container", height: height, width: width, children: _jsx(Spin, { indicator: antIcon }) }));
32
32
  const Help = props => {
33
- const { configs, triggerType, boundsDraggable, isShowResizeHover, children } = props;
33
+ const { configs, triggerType, buttonProps, boundsDraggable, isShowResizeHover, children } = props;
34
34
  const { apiKey, domainPlatform, appCode, domain, portalId, token, userId, config, domainTicket, avatar, } = configs;
35
35
  // const [isOpenDropdown, setIsOpenDropdown] = useState<boolean>(false);
36
36
  const [defaultPositionDrawActions, setDefaultPositionDrawActions] = useState(DEFAULT_POSITIONS.capture);
@@ -886,7 +886,7 @@ const Help = props => {
886
886
  onClick: info => handleClick(info),
887
887
  },
888
888
  // onOpenChange={isOpen => setIsOpenDropdown(isOpen)}
889
- trigger: triggerType, placement: "bottomRight", children: children || (_jsx(IconButtonStyled, { children: _jsx(Icon, { type: "icon-ants-help" }) })) }), isShowPopup &&
889
+ trigger: triggerType, placement: "bottomRight", children: children || (_jsx(IconButtonStyled, { ...buttonProps, children: _jsx(Icon, { type: "icon-ants-help" }) })) }), isShowPopup &&
890
890
  createPortal(_jsx(PopupDraggable, { isHiddenResizing: true, bounds: boundsDraggable, isShowResizeHover: isShowResizeHover, callback: callback, styleContainer: {
891
891
  display: 'flex',
892
892
  flexDirection: 'column',
@@ -1,5 +1,6 @@
1
1
  import { ReactNode } from 'react';
2
2
  import type { TabPaneProps } from 'antd';
3
+ import { ButtonProps } from '@antscorp/antsomi-ui/es/components/atoms/Button';
3
4
  type TriggerTypeDropdown = Array<'hover' | 'contextMenu' | 'click'>;
4
5
  type ConfigProps = {
5
6
  domain: string;
@@ -30,6 +31,7 @@ export interface AllAppOptionsProps {
30
31
  raw?: any;
31
32
  }
32
33
  export interface IHelpProps {
34
+ buttonProps?: ButtonProps;
33
35
  configs: ConfigProps;
34
36
  boundsDraggable?: string;
35
37
  isShowResizeHover?: boolean;