@antscorp/antsomi-ui 1.3.5-beta.521 → 1.3.5-beta.523
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/ShareAccess/components/GeneralAccess/GeneralAccess.js +2 -2
- package/es/components/molecules/ShareAccess/components/GeneralAccess/styled.js +4 -5
- package/es/components/molecules/ShareAccess/components/LayoutContent/styled.js +1 -1
- package/es/components/molecules/ShareAccess/components/PeopleAccess/PeopleAccess.js +1 -1
- package/es/components/molecules/ShareAccess/components/PeopleAccess/styled.js +18 -4
- package/es/components/molecules/ShareAccess/components/SearchUser/SearchUser.js +28 -14
- package/es/components/organism/LeftMenu/hooks/usePermission.js +4 -2
- package/es/providers/ConfigProvider/GlobalStyle.js +0 -4
- package/package.json +1 -1
|
@@ -57,7 +57,7 @@ export const GeneralAccess = ({ generalAccessSettings }) => {
|
|
|
57
57
|
} },
|
|
58
58
|
React.createElement("div", { className: "general-dropdown-wrapper" },
|
|
59
59
|
React.createElement("div", { className: "accessable-title" }, isPublic ? 'Public' : 'Restricted'),
|
|
60
|
-
allowEdit && React.createElement(Icon, { className: "icon-angle", type: "icon-ants-
|
|
60
|
+
allowEdit && (React.createElement(Icon, { className: "icon-angle", type: "icon-ants-expand-more", style: { fontSize: 20 } })))),
|
|
61
61
|
React.createElement("div", { className: "description" }, renderDescription())),
|
|
62
62
|
!!isPublic && publicRole && (React.createElement(Dropdown, { placement: "bottomLeft", trigger: ['click'], destroyPopupOnHide: true, disabled: !allowEdit || isShowOnlyText, overlayStyle: { zIndex: 3002 }, menu: {
|
|
63
63
|
items: [
|
|
@@ -75,5 +75,5 @@ export const GeneralAccess = ({ generalAccessSettings }) => {
|
|
|
75
75
|
} },
|
|
76
76
|
React.createElement("div", { className: "public-role-dropdown-wrapper" },
|
|
77
77
|
React.createElement("div", { className: "for-title" }, ROLE_ACCESS_LABEL[publicRole]),
|
|
78
|
-
allowEdit && !isShowOnlyText && (React.createElement(Icon, { className: "icon-angle", type: "icon-ants-
|
|
78
|
+
allowEdit && !isShowOnlyText && (React.createElement(Icon, { className: "icon-angle", type: "icon-ants-expand-more", style: { fontSize: 20 } }))))))));
|
|
79
79
|
};
|
|
@@ -6,8 +6,7 @@ export const StyledGeneralAccessRoot = styled.div `
|
|
|
6
6
|
flex-direction: column;
|
|
7
7
|
|
|
8
8
|
.title {
|
|
9
|
-
margin-bottom:
|
|
10
|
-
font-weight: bold;
|
|
9
|
+
margin-bottom: 10px;
|
|
11
10
|
}
|
|
12
11
|
|
|
13
12
|
.setting {
|
|
@@ -15,13 +14,13 @@ export const StyledGeneralAccessRoot = styled.div `
|
|
|
15
14
|
justify-content: space-between;
|
|
16
15
|
border: 1px solid #e6e6e6;
|
|
17
16
|
border-radius: ${(_a = THEME.token) === null || _a === void 0 ? void 0 : _a.borderRadius}px;
|
|
18
|
-
padding:
|
|
17
|
+
padding: 15px;
|
|
19
18
|
|
|
20
|
-
.icon-angle {
|
|
19
|
+
/* .icon-angle {
|
|
21
20
|
font-size: 10px;
|
|
22
21
|
display: flex;
|
|
23
22
|
align-items: center;
|
|
24
|
-
}
|
|
23
|
+
} */
|
|
25
24
|
|
|
26
25
|
.accessable-icon {
|
|
27
26
|
font-size: 28px;
|
|
@@ -104,6 +104,6 @@ export const PeopleAccess = (props) => {
|
|
|
104
104
|
} },
|
|
105
105
|
React.createElement("div", { className: "role-actions" },
|
|
106
106
|
React.createElement("div", { className: "role" }, ROLE_ACCESS_LABEL[access.role] || ''),
|
|
107
|
-
!!actions.length && (React.createElement(Icon, { type: "icon-ants-
|
|
107
|
+
!!actions.length && (React.createElement(Icon, { type: "icon-ants-expand-more", style: { fontSize: 20 } }))))));
|
|
108
108
|
} })));
|
|
109
109
|
};
|
|
@@ -6,8 +6,7 @@ export const StyledPeopleAccessRoot = styled.div `
|
|
|
6
6
|
flex-direction: column;
|
|
7
7
|
|
|
8
8
|
.title {
|
|
9
|
-
margin-bottom:
|
|
10
|
-
font-weight: bold;
|
|
9
|
+
margin-bottom: 10px;
|
|
11
10
|
}
|
|
12
11
|
|
|
13
12
|
.antsomi-list {
|
|
@@ -15,12 +14,19 @@ export const StyledPeopleAccessRoot = styled.div `
|
|
|
15
14
|
border: 1px solid #e6e6e6;
|
|
16
15
|
|
|
17
16
|
.antsomi-list-items {
|
|
18
|
-
padding: 0;
|
|
17
|
+
/* padding: 0; */
|
|
18
|
+
padding: 15px;
|
|
19
19
|
|
|
20
20
|
.antsomi-list-item {
|
|
21
|
-
padding: 8px;
|
|
21
|
+
/* padding: 8px; */
|
|
22
|
+
padding: 0;
|
|
23
|
+
margin-bottom: 15px;
|
|
22
24
|
border: none;
|
|
23
25
|
|
|
26
|
+
&:last-child {
|
|
27
|
+
margin-bottom: 0;
|
|
28
|
+
}
|
|
29
|
+
|
|
24
30
|
.info {
|
|
25
31
|
flex: 1;
|
|
26
32
|
margin-left: 15px;
|
|
@@ -34,6 +40,10 @@ export const StyledPeopleAccessRoot = styled.div `
|
|
|
34
40
|
}
|
|
35
41
|
}
|
|
36
42
|
|
|
43
|
+
/* .antsomi-avatar {
|
|
44
|
+
align-self: flex-start;
|
|
45
|
+
} */
|
|
46
|
+
|
|
37
47
|
.role-actions {
|
|
38
48
|
display: flex;
|
|
39
49
|
align-items: center;
|
|
@@ -43,6 +53,10 @@ export const StyledPeopleAccessRoot = styled.div `
|
|
|
43
53
|
cursor: pointer;
|
|
44
54
|
}
|
|
45
55
|
}
|
|
56
|
+
|
|
57
|
+
/* .role-actions :not(i) {
|
|
58
|
+
align-self: flex-start !important;
|
|
59
|
+
} */
|
|
46
60
|
}
|
|
47
61
|
}
|
|
48
62
|
}
|
|
@@ -7,16 +7,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import
|
|
11
|
-
import { Avatar, AutoComplete } from 'antd';
|
|
10
|
+
import { Spin } from '@antscorp/antsomi-ui/es/components/atoms';
|
|
12
11
|
import { useDebounce } from '@antscorp/antsomi-ui/es/hooks/useDebounceV2';
|
|
13
|
-
import { StyledSearchUserRoot, StyledSelectItem } from './styled';
|
|
14
12
|
import { isEmail } from '@antscorp/antsomi-ui/es/utils';
|
|
15
|
-
import {
|
|
13
|
+
import { AutoComplete, Avatar, Input } from 'antd';
|
|
16
14
|
import produce from 'immer';
|
|
17
|
-
import {
|
|
15
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
18
16
|
import { updateObjAccessInfo } from '../../actions';
|
|
19
|
-
import {
|
|
17
|
+
import { ACCESS_PROPERTIES_BY_ROLE, ROLE_MAPPING } from '../../constants';
|
|
18
|
+
import { useShareAccess } from '../../hooks';
|
|
19
|
+
import { StyledSearchUserRoot, StyledSelectItem } from './styled';
|
|
20
20
|
export const SearchUser = (props) => {
|
|
21
21
|
const { getUserInfo, placeholder = 'Add people' } = props;
|
|
22
22
|
const { state, dispatch } = useShareAccess();
|
|
@@ -72,18 +72,32 @@ export const SearchUser = (props) => {
|
|
|
72
72
|
if (!allowEdit)
|
|
73
73
|
return null;
|
|
74
74
|
return (React.createElement(StyledSearchUserRoot, null,
|
|
75
|
-
React.createElement(AutoComplete, {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
75
|
+
React.createElement(AutoComplete, { value: searchTerm, onSearch: v => setSearchTerm(v), notFoundContent: null,
|
|
76
|
+
// TODO: move to inline Input loading - prevent annoying effect when isFetching so fast
|
|
77
|
+
// notFoundContent={
|
|
78
|
+
// isFetching ? (
|
|
79
|
+
// <Spin
|
|
80
|
+
// style={{
|
|
81
|
+
// width: '100%',
|
|
82
|
+
// height: '40px',
|
|
83
|
+
// display: 'flex',
|
|
84
|
+
// alignItems: 'center',
|
|
85
|
+
// justifyContent: 'center',
|
|
86
|
+
// }}
|
|
87
|
+
// indicatorSize={28}
|
|
88
|
+
// />
|
|
89
|
+
// ) : null
|
|
90
|
+
// }
|
|
91
|
+
options: (excludedUsers || []).map(user => ({
|
|
82
92
|
value: user.user_id,
|
|
83
93
|
label: (React.createElement(StyledSelectItem, { onClick: () => handleAddUser(user) },
|
|
84
94
|
React.createElement(Avatar, { src: user.avatar }),
|
|
85
95
|
React.createElement("div", { className: "info" },
|
|
86
96
|
React.createElement("div", { className: "name" }, user.user_name),
|
|
87
97
|
React.createElement("div", { className: "email" }, user.email)))),
|
|
88
|
-
})) }
|
|
98
|
+
})) },
|
|
99
|
+
React.createElement(Input, { style: { padding: '5px' }, placeholder: placeholder, suffix: isFetching ? (React.createElement(Spin, { indicatorSize: 20, style: { paddingLeft: '5px', marginLeft: '10px', alignSelf: 'center' } })) : (
|
|
100
|
+
// TODO: empty span for Input don't lose focus when fetching
|
|
101
|
+
// https://ant.design/components/input#why-input-lose-focus-when-change-prefixsuffixshowcount
|
|
102
|
+
React.createElement("span", null)), autoFocus: true }))));
|
|
89
103
|
};
|
|
@@ -7,8 +7,10 @@ import { useGetDashboard, useGetDestinationChannel, useGetListMenu, useGetListMe
|
|
|
7
7
|
import { useLeftMenuContext } from '../contexts';
|
|
8
8
|
// Constants
|
|
9
9
|
import { CDP_API, PERMISSION_API, POST_MESSAGE_TYPES } from '@antscorp/antsomi-ui/es/constants';
|
|
10
|
+
import { ENV } from '@antscorp/antsomi-ui/es/config';
|
|
10
11
|
// Utils
|
|
11
12
|
import { findLastMatchedItemByUrl, findPathOfActiveItem, flattenMenuArray, getMappingAppChildren, recursivePermissionMenu, } from '../utils';
|
|
13
|
+
const { DEV, SANDBOX, SANDBOX_CDP } = ENV;
|
|
12
14
|
export const usePermission = () => {
|
|
13
15
|
const appConfig = useLeftMenuContext(store => store.appConfig);
|
|
14
16
|
const isCustomized = useLeftMenuContext(store => store.isCustomized);
|
|
@@ -21,11 +23,11 @@ export const usePermission = () => {
|
|
|
21
23
|
args: {
|
|
22
24
|
auth: {
|
|
23
25
|
// token: '5474r2x214r2b4b4v2d4y444u2v5q2p5o4d4c4f424e4' || auth?.token,
|
|
24
|
-
token: [
|
|
26
|
+
token: [DEV, SANDBOX, SANDBOX_CDP].includes(env)
|
|
25
27
|
? '5474r2x214r2b4b4v2d4y444u2v5q2p5o4d4c4f424e4'
|
|
26
28
|
: auth === null || auth === void 0 ? void 0 : auth.token,
|
|
27
29
|
// url: 'https://sandbox-permission.ants.vn',
|
|
28
|
-
url: [
|
|
30
|
+
url: [DEV, SANDBOX, SANDBOX_CDP].includes(env)
|
|
29
31
|
? 'https://sandbox-permission.ants.vn'
|
|
30
32
|
: permissionDomain || PERMISSION_API, // NOTE: Hard for sandbox, development
|
|
31
33
|
portalId: auth === null || auth === void 0 ? void 0 : auth.portalId,
|
|
@@ -304,10 +304,6 @@ export const GlobalStyle = () => {
|
|
|
304
304
|
.antsomi-select-dropdown {
|
|
305
305
|
padding: 8px 0 !important;
|
|
306
306
|
z-index: 3002 !important;
|
|
307
|
-
|
|
308
|
-
/* .antsomi-select-item:not(:last-child) {
|
|
309
|
-
margin-bottom: 6px;
|
|
310
|
-
} */
|
|
311
307
|
}
|
|
312
308
|
|
|
313
309
|
.antsomi-select-selection-overflow {
|