@antscorp/antsomi-ui 1.3.5-beta.593 → 1.3.5-beta.595
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/atoms/Rate/Rate.d.ts +1 -2
- package/es/components/atoms/Rate/Rate.js +1 -2
- package/es/components/atoms/RequiredLabel/styled.d.ts +0 -1
- package/es/components/atoms/RequiredLabel/styled.js +0 -1
- package/es/components/molecules/AccountSelection/AccountSelection.d.ts +2 -0
- package/es/components/molecules/AccountSelection/AccountSelection.js +7 -2
- package/es/components/molecules/AccountSelection/hooks/useAccountSelection.d.ts +1 -0
- package/es/components/molecules/AccountSelection/hooks/useAccountSelection.js +2 -2
- package/es/components/molecules/CaptureScreen/CaptureScreen.js +1 -1
- package/es/components/molecules/HeaderV2/HeaderV2.js +1 -1
- package/es/components/organism/LeftMenu/hooks/useNavigatePath.js +7 -8
- package/es/constants/queries.d.ts +1 -0
- package/es/constants/queries.js +1 -0
- package/es/queries/Account/useGetAccountList.js +1 -1
- package/package.json +4 -2
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
2
|
-
export const Rate = AntdRate;
|
|
1
|
+
export { Rate } from 'antd';
|
|
@@ -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;
|
|
@@ -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 },
|
|
@@ -35,7 +35,7 @@ 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 || ''),
|
|
@@ -56,5 +56,5 @@ export const useAccountSelection = (apiConfig) => {
|
|
|
56
56
|
}
|
|
57
57
|
return (data === null || data === void 0 ? void 0 : data.entries) || [];
|
|
58
58
|
}, [appCode, data === null || data === void 0 ? void 0 : data.entries, permissionAccountList]);
|
|
59
|
-
return { recentData, accountData, updateRecentAccount };
|
|
59
|
+
return { recentData, accountData, updateRecentAccount, refetchRecentAccount };
|
|
60
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)),
|
|
@@ -31,16 +31,15 @@ export const useNavigatePath = () => {
|
|
|
31
31
|
const splitNextPath = (path === null || path === void 0 ? void 0 : path.split('#')) || ['', ''];
|
|
32
32
|
const isCurrentPathIncludeHash = (_b = (_a = window.location) === null || _a === void 0 ? void 0 : _a.href) === null || _b === void 0 ? void 0 : _b.includes('#');
|
|
33
33
|
const isNextPathIncludeHash = path === null || path === void 0 ? void 0 : path.includes('#');
|
|
34
|
+
let currentDomain = (_c = window.location) === null || _c === void 0 ? void 0 : _c.origin;
|
|
35
|
+
let nextDomain = customDomain;
|
|
34
36
|
if (isCurrentPathIncludeHash) {
|
|
35
|
-
|
|
36
|
-
let nextRoute = customDomain;
|
|
37
|
-
// Check case next path has hash
|
|
38
|
-
if (isNextPathIncludeHash) {
|
|
39
|
-
nextRoute = `${customDomain}${splitNextPath[0]}`;
|
|
40
|
-
}
|
|
41
|
-
return currentRoute !== nextRoute;
|
|
37
|
+
currentDomain = ((_f = (_e = (_d = window.location.href) === null || _d === void 0 ? void 0 : _d.split) === null || _e === void 0 ? void 0 : _e['#']) === null || _f === void 0 ? void 0 : _f[0]) || '';
|
|
42
38
|
}
|
|
43
|
-
|
|
39
|
+
if (isNextPathIncludeHash) {
|
|
40
|
+
nextDomain = `${customDomain}${splitNextPath[0]}`;
|
|
41
|
+
}
|
|
42
|
+
return currentDomain !== nextDomain;
|
|
44
43
|
}, [isDev]);
|
|
45
44
|
const getPath = useCallback((path, itemKey) => {
|
|
46
45
|
var _a;
|
|
@@ -26,6 +26,7 @@ export declare const QUERY_KEYS: {
|
|
|
26
26
|
GET_ACCOUNT_LISTING: string;
|
|
27
27
|
GET_PERMISSION_ACCOUNT_LISTING: string;
|
|
28
28
|
GET_RECENT_ACCOUNT: string;
|
|
29
|
+
UPDATE_RECENT_ACCOUNT: string;
|
|
29
30
|
CHECK_ACCOUNT_PERMISSION: string;
|
|
30
31
|
GET_ABSTRACT_USERS: string;
|
|
31
32
|
GET_COLUMN_METRICS: string;
|
package/es/constants/queries.js
CHANGED
|
@@ -37,6 +37,7 @@ export const QUERY_KEYS = {
|
|
|
37
37
|
GET_ACCOUNT_LISTING: 'GET_ACCOUNT_LISTING',
|
|
38
38
|
GET_PERMISSION_ACCOUNT_LISTING: 'GET_PERMISSION_ACCOUNT_LISTING',
|
|
39
39
|
GET_RECENT_ACCOUNT: 'GET_RECENT_ACCOUNT',
|
|
40
|
+
UPDATE_RECENT_ACCOUNT: 'UPDATE_RECENT_ACCOUNT',
|
|
40
41
|
CHECK_ACCOUNT_PERMISSION: 'CHECK_ACCOUNT_PERMISSION',
|
|
41
42
|
// ABSTRACT
|
|
42
43
|
GET_ABSTRACT_USERS: 'GET_ABSTRACT_USERS',
|
|
@@ -17,7 +17,7 @@ export const useUpdateRecentAccount = (props) => {
|
|
|
17
17
|
const { apiConfig, options } = props;
|
|
18
18
|
const queryClient = useQueryClient();
|
|
19
19
|
return useMutation(Object.assign({ mutationFn: variables => updateRecentAccount({ params: apiConfig, data: variables }), onSettled: () => {
|
|
20
|
-
queryClient.invalidateQueries([QUERY_KEYS.
|
|
20
|
+
queryClient.invalidateQueries([QUERY_KEYS.UPDATE_RECENT_ACCOUNT], {
|
|
21
21
|
exact: false,
|
|
22
22
|
});
|
|
23
23
|
} }, options));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antscorp/antsomi-ui",
|
|
3
|
-
"version": "1.3.5-beta.
|
|
3
|
+
"version": "1.3.5-beta.595",
|
|
4
4
|
"description": "An enterprise-class UI design language and React UI library.",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"dist/*",
|
|
@@ -182,7 +182,8 @@
|
|
|
182
182
|
"@types/styled-components": "^5.1.26",
|
|
183
183
|
"@typescript-eslint/eslint-plugin": "^5.55.0",
|
|
184
184
|
"@typescript-eslint/parser": "^5.55.0",
|
|
185
|
-
"@vitejs/plugin-react": "^3.1
|
|
185
|
+
"@vitejs/plugin-react": "^4.3.1",
|
|
186
|
+
"@vitest/ui": "^2.0.4",
|
|
186
187
|
"auto-changelog": "^2.4.0",
|
|
187
188
|
"babel-jest": "^29.7.0",
|
|
188
189
|
"babel-loader": "^8.3.0",
|
|
@@ -209,6 +210,7 @@
|
|
|
209
210
|
"husky": "^8.0.3",
|
|
210
211
|
"jest": "^29.5.0",
|
|
211
212
|
"jest-environment-jsdom": "^29.5.0",
|
|
213
|
+
"jest-styled-components": "^7.2.0",
|
|
212
214
|
"jsdom": "^24.1.1",
|
|
213
215
|
"lint-staged": "^13.2.0",
|
|
214
216
|
"mini-css-extract-plugin": "^2.7.5",
|