@antscorp/antsomi-ui 1.3.5-beta.217 → 1.3.5-beta.219

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.
@@ -13,6 +13,7 @@ export interface AccountSelectionProps {
13
13
  showAllAccount?: boolean;
14
14
  currentAccount?: number | 'ALL_ACCOUNT';
15
15
  inputStyle?: 'select' | 'input';
16
+ inputClassName?: string;
16
17
  onChange?: (userId: number | 'ALL_ACCOUNT') => void;
17
18
  }
18
19
  export declare const AccountSelection: React.FC<AccountSelectionProps>;
@@ -8,7 +8,7 @@ import { Tooltip } from 'antd';
8
8
  import { searchStringQuery } from '@antscorp/antsomi-ui/es/utils';
9
9
  import { PORTALS_IDS } from '@antscorp/antsomi-ui/es/constants';
10
10
  export const AccountSelection = props => {
11
- const { show = true, className, apiConfig, showAllAccount = true, currentAccount, inputStyle = 'input', onChange, } = props;
11
+ const { show = true, className, apiConfig, showAllAccount = true, currentAccount, inputStyle = 'input', inputClassName, onChange, } = props;
12
12
  const { domain, token, userId, appCode, portalId } = apiConfig;
13
13
  const { data } = useGetAccountList({
14
14
  apiConfig,
@@ -56,6 +56,7 @@ export const AccountSelection = props => {
56
56
  if (onChange)
57
57
  onChange(userId);
58
58
  }, [onChange]);
59
+ const inputLabel = currentAccount === 'ALL_ACCOUNT' ? 'All account' : currentAccountInfo === null || currentAccountInfo === void 0 ? void 0 : currentAccountInfo.userName;
59
60
  return (show && (React.createElement(Popover, { content: React.createElement(AccountSelectionStyled, { className: className },
60
61
  React.createElement(Input, { placeholder: "Search", suffix: React.createElement(Icon, { type: "icon-ants-search-2", style: { fontSize: '24px' } }), value: searchValue, onChange: event => setSearchValue(event.target.value) }),
61
62
  !!(recentData === null || recentData === void 0 ? void 0 : recentData.value) && (React.createElement(React.Fragment, null,
@@ -65,9 +66,9 @@ export const AccountSelection = props => {
65
66
  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)) &&
66
67
  searchStringQuery(account.userName, searchValue)).map(account => (React.createElement(AccountItem, { key: account.userId, userName: account.userName, userId: account.userId, onClick: handleSelectAccount, isSelected: currentAccount === account.userId }))))),
67
68
  showAllAccount ? (React.createElement(Text, { className: `all-account ${currentAccount === 'ALL_ACCOUNT' ? 'is-selected' : ''}`, onClick: () => handleSelectAccount('ALL_ACCOUNT') },
68
- React.createElement("strong", null, "All account"))) : null), trigger: "click", overlayInnerStyle: { padding: 0 }, placement: "bottomLeft", arrow: false, open: open, onOpenChange: setOpen },
69
- React.createElement(PopoverFieldStyled, { className: inputStyle },
70
- React.createElement(Tooltip, { title: currentAccount === 'ALL_ACCOUNT' ? 'All account' : currentAccountInfo === null || currentAccountInfo === void 0 ? void 0 : currentAccountInfo.userName },
71
- React.createElement("span", null, currentAccount === 'ALL_ACCOUNT' ? 'All account' : currentAccountInfo === null || currentAccountInfo === void 0 ? void 0 : currentAccountInfo.userName)),
69
+ React.createElement("strong", null, "All account"))) : null), trigger: "click", overlayInnerStyle: { padding: 0 }, getPopupContainer: triggerNode => triggerNode, placement: "bottomLeft", arrow: false, open: open, onOpenChange: setOpen },
70
+ React.createElement(PopoverFieldStyled, { className: `${inputStyle || ''} ${inputClassName || ''}` },
71
+ React.createElement(Tooltip, { title: inputLabel },
72
+ React.createElement("span", { className: !inputLabel ? 'is-placeholder' : '' }, inputLabel || 'Select an account')),
72
73
  React.createElement(Icon, { type: "icon-ants-angle-down", style: { width: '20px', textAlign: 'center' } })))));
73
74
  };
@@ -1,4 +1,4 @@
1
- var _a, _b, _c, _d, _e, _f, _g;
1
+ var _a, _b, _c, _d, _e, _f, _g, _h;
2
2
  import { THEME } from '@antscorp/antsomi-ui/es/constants';
3
3
  import styled from 'styled-components';
4
4
  export const AccountSelectionStyled = styled.div `
@@ -92,4 +92,9 @@ export const PopoverFieldStyled = styled.div `
92
92
  border-bottom: 1px solid ${(_g = THEME.token) === null || _g === void 0 ? void 0 : _g.colorPrimary};
93
93
  width: 300px;
94
94
  }
95
+
96
+ & .is-placeholder {
97
+ color: ${(_h = THEME.token) === null || _h === void 0 ? void 0 : _h.bw6};
98
+ font-weight: normal;
99
+ }
95
100
  `;
@@ -251,6 +251,7 @@ export const Notification = React.memo(props => {
251
251
  padding: '2px 4px',
252
252
  display: 'flex',
253
253
  alignItems: 'center',
254
+ justifyContent: 'center',
254
255
  backgroundColor: themeToken.red6,
255
256
  } },
256
257
  React.createElement(ActionButton, { icon: React.createElement(Icon, { type: "icon-ants-bell" }) }))));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.5-beta.217",
3
+ "version": "1.3.5-beta.219",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",