@antscorp/antsomi-ui 1.3.5-beta.251 → 1.3.5-beta.252
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/AccountSelection/AccountListing.d.ts +1 -1
- package/es/components/molecules/AccountSelection/AccountListing.js +2 -1
- package/es/components/molecules/AccountSelection/AccountSelection.js +2 -2
- package/es/components/molecules/HeaderV2/HeaderV2.js +1 -1
- package/package.json +1 -1
|
@@ -10,7 +10,7 @@ export interface AccountListingProps {
|
|
|
10
10
|
appCode?: string;
|
|
11
11
|
};
|
|
12
12
|
showAllAccount?: boolean;
|
|
13
|
-
currentAccount?: string;
|
|
13
|
+
currentAccount?: string | 'all';
|
|
14
14
|
onChange?: (userId: number | string) => void;
|
|
15
15
|
}
|
|
16
16
|
export declare const AccountListing: React.FC<AccountListingProps>;
|
|
@@ -39,6 +39,7 @@ export const AccountListing = props => {
|
|
|
39
39
|
enabled: portalId !== PORTALS_IDS.SANDBOX_76753,
|
|
40
40
|
},
|
|
41
41
|
});
|
|
42
|
+
const isAllAccount = currentAccount === 'all';
|
|
42
43
|
// Memos
|
|
43
44
|
const accountData = useMemo(() => {
|
|
44
45
|
if (portalId === PORTALS_IDS.SANDBOX_76753) {
|
|
@@ -63,6 +64,6 @@ export const AccountListing = props => {
|
|
|
63
64
|
React.createElement("div", { className: "antsomi-scroll-box account-list" },
|
|
64
65
|
React.createElement("ul", { className: "scroll-content" }, accountData === null || accountData === void 0 ? void 0 : accountData.filter(account => !(recentData === null || recentData === void 0 ? void 0 : recentData.value.includes(account.userId)) &&
|
|
65
66
|
searchStringQuery(account.userName, searchValue)).map(account => (React.createElement(AccountItem, { key: account.userId, userName: account.userName, userId: account.userId, onClick: handleSelectAccount, isSelected: +currentAccount === account.userId }))))),
|
|
66
|
-
showAllAccount ? (React.createElement(Text, { className: `all-account ${
|
|
67
|
+
showAllAccount ? (React.createElement(Text, { className: `all-account ${isAllAccount ? 'is-selected' : ''}`, onClick: () => handleSelectAccount('') },
|
|
67
68
|
React.createElement("strong", null, "All account"))) : null));
|
|
68
69
|
};
|
|
@@ -23,7 +23,7 @@ import { useGetAccountList, useGetPermissionAccountList } from '../../..';
|
|
|
23
23
|
import { PORTALS_IDS } from '@antscorp/antsomi-ui/es/constants';
|
|
24
24
|
export const AccountSelection = props => {
|
|
25
25
|
const { show = true, inputStyle = 'input', inputClassName, onChange, getPopupContainer, zIndex } = props, accountListingProps = __rest(props, ["show", "inputStyle", "inputClassName", "onChange", "getPopupContainer", "zIndex"]);
|
|
26
|
-
const { apiConfig, currentAccount } = props;
|
|
26
|
+
const { apiConfig, currentAccount = '' } = props;
|
|
27
27
|
const { domain, token, userId, appCode, portalId } = apiConfig;
|
|
28
28
|
// States
|
|
29
29
|
const [inputLabel, setInputLabel] = useState('');
|
|
@@ -65,7 +65,7 @@ export const AccountSelection = props => {
|
|
|
65
65
|
// Side Effects
|
|
66
66
|
useEffect(() => {
|
|
67
67
|
var _a;
|
|
68
|
-
const newLabel =
|
|
68
|
+
const newLabel = currentAccount === 'all'
|
|
69
69
|
? 'All account'
|
|
70
70
|
: ((_a = accountData === null || accountData === void 0 ? void 0 : accountData.find(account => account.userId === +currentAccount)) === null || _a === void 0 ? void 0 : _a.userName) || '';
|
|
71
71
|
setInputLabel(newLabel);
|
|
@@ -96,7 +96,7 @@ export const HeaderV2 = memo(props => {
|
|
|
96
96
|
};
|
|
97
97
|
return (React.createElement(HeaderV2Styled, { className: className || '', style: style },
|
|
98
98
|
React.createElement("div", { className: "left-side" },
|
|
99
|
-
React.createElement(AccountSelection, Object.assign({}, accountSelectionProps, { currentAccount: selectedAccount, apiConfig: accountSelectionApiConfig, onChange: handleChangeAccount, inputStyle: inputStyle })),
|
|
99
|
+
React.createElement(AccountSelection, Object.assign({}, accountSelectionProps, { currentAccount: selectedAccount || 'all', apiConfig: accountSelectionApiConfig, onChange: handleChangeAccount, inputStyle: inputStyle })),
|
|
100
100
|
typeof pageTitle === 'string' ? React.createElement("div", { className: "page-title" }, pageTitle) : pageTitle),
|
|
101
101
|
React.createElement("div", { className: "right-side" },
|
|
102
102
|
showHelp ? React.createElement(Help, Object.assign({ configs: helpConfigProps }, helpProps)) : null,
|