@antscorp/antsomi-ui 1.3.5-beta.367 → 1.3.5-beta.369

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.
@@ -1,26 +1,6 @@
1
1
  :root {
2
2
  --primary-color: #005fb8;
3
3
  --text-base-color: #222222;
4
-
5
- --border-primary: #005eb8;
6
- --border-normal: #b8cfe6;
7
- --border-hover: #81bcf4;
8
- --border-active: #005eb8;
9
- --border-disable: #d4d4d4;
10
-
11
- --divider-1: #e5e5e5;
12
- --divider-2: #d4d4d4;
13
- --divider-3: #bebebe;
14
4
  }
15
5
 
16
- *,
17
- *:before,
18
- *:after {
19
- -webkit-box-sizing: border-box;
20
- -moz-box-sizing: border-box;
21
- box-sizing: border-box;
22
- }
23
6
 
24
- .rc-virtual-list-scrollbar {
25
- width: 4px !important;
26
- }
@@ -5,7 +5,7 @@ import { SelectAccountContext } from './context';
5
5
  // Components
6
6
  import { AccountChipWrapper } from './styled';
7
7
  import Icon from '@antscorp/icons';
8
- import { Tooltip } from '../../atoms';
8
+ import { Tooltip, Typography } from '../../atoms';
9
9
  const AccountChip = props => {
10
10
  const { user, label, value, disabled, isViewMode, isError, errorMsg, onRemove } = props;
11
11
  const { state } = useContext(SelectAccountContext);
@@ -18,7 +18,7 @@ const AccountChip = props => {
18
18
  const isDisabled = disabled || (state === null || state === void 0 ? void 0 : state.disabled) || (disabledAccount === null || disabledAccount === void 0 ? void 0 : disabledAccount.includes(user === null || user === void 0 ? void 0 : user[userIdKey]));
19
19
  return (React.createElement(Tooltip, { open: isError ? undefined : false, title: errorMsg },
20
20
  React.createElement(AccountChipWrapper, { className: "select-account-chip", style: Object.assign({}, ((styles === null || styles === void 0 ? void 0 : styles.accountChip) || {})), disabled: isDisabled, isError: isError },
21
- React.createElement("div", { className: "name" }, label),
21
+ React.createElement(Typography.Text, { className: "name", ellipsis: { tooltip: { title: label } }, style: { maxWidth: '150px' } }, label),
22
22
  !isViewMode && !(state === null || state === void 0 ? void 0 : state.isViewMode) && !isDisabled && (React.createElement("div", { className: "icon-remove", onClick: handleRemove },
23
23
  React.createElement(Icon, { type: "icon-ants-remove-slim" }))))));
24
24
  };
@@ -1,6 +1,6 @@
1
1
  import React, { useContext, useState } from 'react';
2
2
  import { AccountListBody, AccountListContent, AccountListFooter, AccountListTitleGroup, AccountListWrapper, CheckboxStyled, } from './styled';
3
- import { Button, Icon, Input } from '../../atoms';
3
+ import { Button, Icon, Input, Typography } from '../../atoms';
4
4
  import { Dropdown } from '../Dropdown';
5
5
  import { SelectAccountContext } from './context/SelectAccountContext';
6
6
  const AccountList = () => {
@@ -20,11 +20,13 @@ const AccountList = () => {
20
20
  const handleSearch = text => {
21
21
  dispatch({ type: 'UPDATE_SEARCH_TEXT', payload: text });
22
22
  };
23
+ const TextLabel = ({ children }) => (React.createElement(Typography.Text, { ellipsis: { tooltip: { title: children } }, style: { maxWidth: '230px' } }, children));
23
24
  return (React.createElement(AccountListWrapper, null,
24
25
  React.createElement(AccountListBody, null,
25
26
  React.createElement(Input, { value: searchText, placeholder: "Search", suffix: React.createElement(Icon, { type: "icon-ants-search-2" }), onAfterChange: value => handleSearch(value), debounce: 500 }),
26
27
  (state === null || state === void 0 ? void 0 : state.type) === 'group' ? (React.createElement(React.Fragment, null,
27
- React.createElement(Dropdown, { open: openGroup, getPopupContainer: () => document.getElementById('account-group-list') || document.body, overlayStyle: { position: 'initial' }, trigger: ['click'], dropdownRender: () => (React.createElement(AccountListContent, null, listAccountGroupDisplay === null || listAccountGroupDisplay === void 0 ? void 0 : listAccountGroupDisplay.map((item, idx) => (React.createElement(CheckboxStyled, { key: item === null || item === void 0 ? void 0 : item[state === null || state === void 0 ? void 0 : state.groupIdKey], disabled: disabledAccount === null || disabledAccount === void 0 ? void 0 : disabledAccount.includes(item === null || item === void 0 ? void 0 : item[state === null || state === void 0 ? void 0 : state.groupIdKey]), defaultChecked: draftUsersSelected.includes(item === null || item === void 0 ? void 0 : item[state === null || state === void 0 ? void 0 : state.groupIdKey]), onChange: () => handleCheckbox(item === null || item === void 0 ? void 0 : item[state === null || state === void 0 ? void 0 : state.groupIdKey]) }, item === null || item === void 0 ? void 0 : item[state === null || state === void 0 ? void 0 : state.groupNameKey]))))) },
28
+ React.createElement(Dropdown, { open: openGroup, getPopupContainer: () => document.getElementById('account-group-list') || document.body, overlayStyle: { position: 'initial' }, trigger: ['click'], dropdownRender: () => (React.createElement(AccountListContent, null, listAccountGroupDisplay === null || listAccountGroupDisplay === void 0 ? void 0 : listAccountGroupDisplay.map((item, idx) => (React.createElement(CheckboxStyled, { key: item === null || item === void 0 ? void 0 : item[state === null || state === void 0 ? void 0 : state.groupIdKey], disabled: disabledAccount === null || disabledAccount === void 0 ? void 0 : disabledAccount.includes(item === null || item === void 0 ? void 0 : item[state === null || state === void 0 ? void 0 : state.groupIdKey]), defaultChecked: draftUsersSelected.includes(item === null || item === void 0 ? void 0 : item[state === null || state === void 0 ? void 0 : state.groupIdKey]), onChange: () => handleCheckbox(item === null || item === void 0 ? void 0 : item[state === null || state === void 0 ? void 0 : state.groupIdKey]) },
29
+ React.createElement(TextLabel, null, item === null || item === void 0 ? void 0 : item[state === null || state === void 0 ? void 0 : state.groupNameKey])))))) },
28
30
  React.createElement(AccountListTitleGroup, { onClick: () => setOpenGroup(!openGroup) },
29
31
  React.createElement("div", null, "Account Group"),
30
32
  React.createElement(Icon, { type: "icon-ants-expand-more", size: 20, style: {
@@ -32,14 +34,16 @@ const AccountList = () => {
32
34
  transition: '0.3s',
33
35
  } }))),
34
36
  React.createElement("div", { id: "account-group-list" }),
35
- React.createElement(Dropdown, { open: openAccount, getPopupContainer: () => document.getElementById('account-list') || document.body, overlayStyle: { position: 'initial' }, trigger: ['click'], dropdownRender: () => (React.createElement(AccountListContent, null, usersDisplay === null || usersDisplay === void 0 ? void 0 : usersDisplay.map(item => (React.createElement(CheckboxStyled, { key: item === null || item === void 0 ? void 0 : item[userIdKey], disabled: disabledAccount === null || disabledAccount === void 0 ? void 0 : disabledAccount.includes(item === null || item === void 0 ? void 0 : item[userIdKey]), defaultChecked: draftUsersSelected.includes(item === null || item === void 0 ? void 0 : item[userIdKey]), onChange: () => handleCheckbox(item === null || item === void 0 ? void 0 : item[userIdKey]) }, item === null || item === void 0 ? void 0 : item[nameKey]))))) },
37
+ React.createElement(Dropdown, { open: openAccount, getPopupContainer: () => document.getElementById('account-list') || document.body, overlayStyle: { position: 'initial' }, trigger: ['click'], dropdownRender: () => (React.createElement(AccountListContent, null, usersDisplay === null || usersDisplay === void 0 ? void 0 : usersDisplay.map(item => (React.createElement(CheckboxStyled, { key: item === null || item === void 0 ? void 0 : item[userIdKey], disabled: disabledAccount === null || disabledAccount === void 0 ? void 0 : disabledAccount.includes(item === null || item === void 0 ? void 0 : item[userIdKey]), defaultChecked: draftUsersSelected.includes(item === null || item === void 0 ? void 0 : item[userIdKey]), onChange: () => handleCheckbox(item === null || item === void 0 ? void 0 : item[userIdKey]) },
38
+ React.createElement(TextLabel, null, item === null || item === void 0 ? void 0 : item[nameKey])))))) },
36
39
  React.createElement(AccountListTitleGroup, { onClick: () => setOpenAccount(!openAccount) },
37
40
  React.createElement("div", null, "Account"),
38
41
  React.createElement(Icon, { type: "icon-ants-expand-more", size: 20, style: {
39
42
  transform: openAccount ? 'rotate(180deg)' : 'rotate(0deg)',
40
43
  transition: '0.3s',
41
44
  } }))),
42
- React.createElement("div", { id: "account-list" }))) : (React.createElement(AccountListContent, { style: { marginTop: 15 } }, usersDisplay === null || usersDisplay === void 0 ? void 0 : usersDisplay.map(item => (React.createElement(CheckboxStyled, { key: item === null || item === void 0 ? void 0 : item[userIdKey], disabled: disabledAccount === null || disabledAccount === void 0 ? void 0 : disabledAccount.includes(item === null || item === void 0 ? void 0 : item[userIdKey]), defaultChecked: draftUsersSelected.includes(item === null || item === void 0 ? void 0 : item[userIdKey]), onChange: () => handleCheckbox(item === null || item === void 0 ? void 0 : item[userIdKey]) }, item === null || item === void 0 ? void 0 : item[nameKey])))))),
45
+ React.createElement("div", { id: "account-list" }))) : (React.createElement(AccountListContent, { style: { marginTop: 15 } }, usersDisplay === null || usersDisplay === void 0 ? void 0 : usersDisplay.map(item => (React.createElement(CheckboxStyled, { key: item === null || item === void 0 ? void 0 : item[userIdKey], disabled: disabledAccount === null || disabledAccount === void 0 ? void 0 : disabledAccount.includes(item === null || item === void 0 ? void 0 : item[userIdKey]), defaultChecked: draftUsersSelected.includes(item === null || item === void 0 ? void 0 : item[userIdKey]), onChange: () => handleCheckbox(item === null || item === void 0 ? void 0 : item[userIdKey]) },
46
+ React.createElement(TextLabel, null, item === null || item === void 0 ? void 0 : item[nameKey]))))))),
43
47
  React.createElement(AccountListFooter, null,
44
48
  React.createElement(Button, { onClick: () => handleCancel() }, "Cancel"),
45
49
  React.createElement(Button, { type: "primary", onClick: () => handleApply() }, "Apply"))));
@@ -19,7 +19,7 @@ const ButtonAdd = () => {
19
19
  dispatch({ type: 'UPDATE_SEARCH_TEXT', payload: '' });
20
20
  }
21
21
  };
22
- return (React.createElement(Popover, { open: state.openAccountList, content: React.createElement(AccountList, null), trigger: "click", arrow: false, overlayInnerStyle: { padding: 0 }, destroyTooltipOnHide: true, onOpenChange: handleClose, afterOpenChange: handleAfterClose },
22
+ return (React.createElement(Popover, { open: state.openAccountList, content: React.createElement(AccountList, null), trigger: "click", arrow: false, overlayInnerStyle: { padding: 0 }, onOpenChange: handleClose, afterOpenChange: handleAfterClose },
23
23
  React.createElement(ButtonAddStyled, { className: "select-account-btn-add", style: Object.assign({}, (((_a = state === null || state === void 0 ? void 0 : state.styles) === null || _a === void 0 ? void 0 : _a.btnAdd) || {})), loading: !state.isInitDone, onClick: () => state.openAccountList
24
24
  ? dispatch({ type: 'CLOSE_ACCOUNT_LIST' })
25
25
  : dispatch({ type: 'OPEN_ACCOUNT_LIST' }) },
@@ -22,6 +22,7 @@ export const AccountChipWrapper = styled.div `
22
22
  margin: 0px;
23
23
  padding: 0px;
24
24
 
25
+ line-height: 14px;
25
26
  width: 100%;
26
27
  text-align: center;
27
28
  }
@@ -28,6 +28,9 @@ export const usePermission = () => {
28
28
  type: 'menu-item-permission',
29
29
  },
30
30
  },
31
+ options: {
32
+ enabled: !!(auth === null || auth === void 0 ? void 0 : auth.userId) && !!auth.portalId,
33
+ },
31
34
  });
32
35
  const { data: dashboardData, refetch: refetchDashboard } = useGetDashboard({
33
36
  args: {
@@ -35,7 +35,7 @@ export const Layout = memo(props => {
35
35
  const { leftMenuProps, headerProps = {}, workspaceProps, contentWrapperProps, processingNotificationProps, children, onActiveMenuChange, } = props;
36
36
  const _a = workspaceProps || {}, { workspaceContentProps } = _a, restOfWorkspaceProps = __rest(_a, ["workspaceContentProps"]);
37
37
  const appConfig = useContextSelector(AppConfigContext, state => state);
38
- const { auth, languageCode, appCode, permissionDomain: configPermissionDomain, env } = appConfig;
38
+ const { auth, languageCode, appCode, permissionDomain: configPermissionDomain, iamDomain: configIamDomain, env, } = appConfig;
39
39
  const { token, userId, portalId } = auth || {};
40
40
  const leftMenu = useLayoutStore(store => store.state.leftMenu);
41
41
  const header = useLayoutStore(store => store.state.header);
@@ -84,6 +84,8 @@ export const Layout = memo(props => {
84
84
  }, [appCode, configPermissionDomain, env, portalId]);
85
85
  const iamDomain = useMemo(() => {
86
86
  var _a;
87
+ if (configIamDomain)
88
+ return configIamDomain;
87
89
  /**
88
90
  * Check if appCode not exist and portalId is SANDBOX
89
91
  * then return production iam api
@@ -107,7 +109,7 @@ export const Layout = memo(props => {
107
109
  p_f_longdatetime: "dd MMMM 'at' HH:mm:ss",
108
110
  embeddedData: {},
109
111
  INSIGHT_U_OGS: 'uogs',
110
- } }) }), accountSharingConfig: Object.assign(Object.assign({}, headerProps === null || headerProps === void 0 ? void 0 : headerProps.accountSharingConfig), { u_ogs: 'uogs', appCode: 'APP_CUSTOMER_360' }), accountSelection: Object.assign(Object.assign({}, headerProps === null || headerProps === void 0 ? void 0 : headerProps.accountSelection), { show: !!((_b = headerProps === null || headerProps === void 0 ? void 0 : headerProps.accountSelection) === null || _b === void 0 ? void 0 : _b.show) && showAccountSelection }) }));
112
+ } }) }), accountSharingConfig: Object.assign(Object.assign({}, headerProps === null || headerProps === void 0 ? void 0 : headerProps.accountSharingConfig), { u_ogs: 'uogs', appCode: appCode || 'APP_CUSTOMER_360' }), accountSelection: Object.assign(Object.assign({}, headerProps === null || headerProps === void 0 ? void 0 : headerProps.accountSelection), { show: !!((_b = headerProps === null || headerProps === void 0 ? void 0 : headerProps.accountSelection) === null || _b === void 0 ? void 0 : _b.show) && showAccountSelection }) }));
111
113
  }, [headerProps, iamDomain, permissionDomain, showAccountSelection]);
112
114
  const mergeHeaderProps = useDeepCompareMemo(() => merge(cloneDeep(initialHeaderProps), header), [initialHeaderProps, header]);
113
115
  const _b = useDeepCompareMemo(() => merge(cloneDeep(contentWrapperProps), cloneDeep(contentWrapper)), [contentWrapperProps, contentWrapper]), { noPadding } = _b, mergeContentWrapperProps = __rest(_b, ["noPadding"]);
@@ -10,6 +10,7 @@ export interface AppConfigProps {
10
10
  urlLogout?: string;
11
11
  /** Domain */
12
12
  permissionDomain?: string;
13
+ iamDomain?: string;
13
14
  setAppConfig: React.Dispatch<React.SetStateAction<AppConfigProviderProps>>;
14
15
  }
15
16
  export interface AppConfigProviderProps extends Omit<AppConfigProps, 'setAppConfig'> {
@@ -9,12 +9,30 @@ import { fas } from '@fortawesome/free-solid-svg-icons';
9
9
  import { far } from '@fortawesome/free-regular-svg-icons';
10
10
  import { fab } from '@fortawesome/free-brands-svg-icons';
11
11
  library.add(fas, far, fab);
12
- const { accent6, accent7, gray5, scrollBarSize } = THEME.token || {};
12
+ const { accent6, accent7, gray5, scrollBarSize, bw3, bw4, bw5 } = THEME.token || {};
13
13
  export const GlobalStyle = () => {
14
14
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39;
15
15
  return (React.createElement(Global, { styles: css `
16
16
  @import url('https://fonts.googleapis.com/css2?family=Roboto:wght@100;300;400;500;700;900&display=swap');
17
17
 
18
+ :root {
19
+ --divider-1: ${bw3};
20
+ --divider-2: ${bw4};
21
+ --divider-3: ${bw5};
22
+ }
23
+
24
+ *,
25
+ *:before,
26
+ *:after {
27
+ -webkit-box-sizing: border-box;
28
+ -moz-box-sizing: border-box;
29
+ box-sizing: border-box;
30
+ }
31
+
32
+ .rc-virtual-list-scrollbar {
33
+ width: 4px !important;
34
+ }
35
+
18
36
  /* Custom */
19
37
  .antsomi-scrollbar-hidden {
20
38
  -ms-overflow-style: none; /* for Internet Explorer, Edge */
@@ -25,12 +25,13 @@ export const useUpdateTask = () => {
25
25
  };
26
26
  export const useGetListMenu = (params) => {
27
27
  const { options, args } = params;
28
- return useQuery(Object.assign({ queryKey: [QUERY_KEYS.GET_LIST_MENU, args.params, args.auth], queryFn: () => getListMenu(params.args), onSuccess() { } }, options));
28
+ const { auth } = args || {};
29
+ return useQuery(Object.assign({ queryKey: [QUERY_KEYS.GET_LIST_MENU, args.params, args.auth], queryFn: () => getListMenu(params.args), onSuccess() { }, enabled: !!(auth === null || auth === void 0 ? void 0 : auth.token) && !!auth.portalId && !!(auth === null || auth === void 0 ? void 0 : auth.userId) }, options));
29
30
  };
30
31
  export const useGetListMenuPermission = (params) => {
31
32
  const { options, args } = params;
32
33
  const { token, accountId, userId } = args.auth;
33
- return useQuery(Object.assign({ queryKey: [QUERY_KEYS.GET_LIST_MENU_PERMISSION, args.params, token, accountId, userId], queryFn: () => getListMenuPermission(params.args), onSuccess() { } }, options));
34
+ return useQuery(Object.assign({ queryKey: [QUERY_KEYS.GET_LIST_MENU_PERMISSION, args.params, token, accountId, userId], queryFn: () => getListMenuPermission(params.args), onSuccess() { }, enabled: !!token && !!userId }, options));
34
35
  };
35
36
  export const useGetDestinationChannel = (params) => {
36
37
  const { options, args } = params;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.5-beta.367",
3
+ "version": "1.3.5-beta.369",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",
@@ -59,7 +59,7 @@
59
59
  "not op_mini all"
60
60
  ],
61
61
  "dependencies": {
62
- "@antscorp/icons": "0.27.35",
62
+ "@antscorp/icons": "0.27.36",
63
63
  "@antscorp/image-editor": "1.0.2",
64
64
  "@antscorp/processing-notification": "^1.0.3",
65
65
  "@dnd-kit/core": "^6.1.0",