@antscorp/antsomi-ui 2.0.118 → 2.0.119
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/LayoutContent/LayoutContent.js +2 -3
- package/es/components/molecules/ShareAccess/reducer.js +1 -0
- package/es/components/molecules/ShareAccess/types.d.ts +5 -0
- package/es/components/molecules/ShareAccess/utils.js +11 -2
- package/package.json +1 -1
|
@@ -5,10 +5,9 @@ import { ModalTransferOwnership } from '../ModalTransferOwnerShip/ModalTransferO
|
|
|
5
5
|
import { PeopleAccess } from '../PeopleAccess';
|
|
6
6
|
import { SearchUser } from '../SearchUser';
|
|
7
7
|
import { StyledLayoutContentRoot } from './styled';
|
|
8
|
-
import { Spin } from '@antscorp/antsomi-ui/es/components/atoms';
|
|
9
8
|
export const LayoutContent = (props) => {
|
|
10
|
-
const { getUserInfo, generalAccessSettings, excludeUserAccess, placeholder, allowAddUser = true, hideTransferOwnership, } = props;
|
|
9
|
+
const { getUserInfo, generalAccessSettings, excludeUserAccess, placeholder, allowAddUser = true, hideTransferOwnership, className, } = props;
|
|
11
10
|
const { state } = useShareAccess();
|
|
12
11
|
const { isLoading } = state;
|
|
13
|
-
return (
|
|
12
|
+
return (_jsxs(StyledLayoutContentRoot, { className: className, children: [!isLoading && allowAddUser && (_jsx(SearchUser, { getUserInfo: getUserInfo, placeholder: placeholder })), _jsx(PeopleAccess, { excludeUserAccess: excludeUserAccess, hideTransferOwnership: hideTransferOwnership }), _jsx(GeneralAccess, { generalAccessSettings: generalAccessSettings }), _jsx(ModalTransferOwnership, {})] }));
|
|
14
13
|
};
|
|
@@ -5,6 +5,7 @@ export const shareAccessReducer = (onChange, onRawChange) => (state, action) =>
|
|
|
5
5
|
switch (action.type) {
|
|
6
6
|
case TYPES.UPDATE_OBJECT_ACCESS_INFO: {
|
|
7
7
|
const { updated, triggerOut = true } = action.payload;
|
|
8
|
+
// console.log({ action });
|
|
8
9
|
draft.accessInfo = updated;
|
|
9
10
|
if (triggerOut) {
|
|
10
11
|
const mapped = mappingOutData(action.payload.updated);
|
|
@@ -34,6 +34,10 @@ export type UserAccessInfoRaw = {
|
|
|
34
34
|
allow_view: number;
|
|
35
35
|
allow_edit: number;
|
|
36
36
|
allow_comment: number;
|
|
37
|
+
full_name?: string;
|
|
38
|
+
email?: string;
|
|
39
|
+
avatar?: string;
|
|
40
|
+
[key: string]: any;
|
|
37
41
|
};
|
|
38
42
|
export type ObjectAccessInfoRaw = {
|
|
39
43
|
is_public: number;
|
|
@@ -47,6 +51,7 @@ export type GeneralAccessSettings = {
|
|
|
47
51
|
publicOnlyWith?: boolean;
|
|
48
52
|
};
|
|
49
53
|
export type ShareAccessProps = {
|
|
54
|
+
className?: string;
|
|
50
55
|
userId?: number;
|
|
51
56
|
userPermission?: {
|
|
52
57
|
edit: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MENU_PERMISSION, PEOPLE_ACTIONS, PEOPLE_ACTION_KEYS, PUBLIC_ROLE, REGEX_REMOVE_NAME, ROLE_ACCESS_LABEL, ROLE_MAPPING, } from './constants';
|
|
2
|
-
import { remove } from 'lodash';
|
|
2
|
+
import { remove, mapKeys, camelCase, snakeCase } from 'lodash';
|
|
3
3
|
import { snakeCaseToCamelCase } from '@antscorp/antsomi-ui/es/utils';
|
|
4
4
|
export const mergePermission = (objectPermissionAllow, menuPermissionValue) => {
|
|
5
5
|
const valueMapping = {
|
|
@@ -87,7 +87,14 @@ export const safeParseAccessInfo = (accessInfo) => {
|
|
|
87
87
|
return {
|
|
88
88
|
...accessInfo,
|
|
89
89
|
ownerId: +(ownerId || -1),
|
|
90
|
-
listAccess: accessInfo?.listAccess?.map(user => ({
|
|
90
|
+
listAccess: accessInfo?.listAccess?.map(user => ({
|
|
91
|
+
...user,
|
|
92
|
+
userId: +user.userId,
|
|
93
|
+
role: +user.role,
|
|
94
|
+
allowView: +user.allowView,
|
|
95
|
+
allowEdit: +user.allowEdit,
|
|
96
|
+
allowComment: +user.allowComment,
|
|
97
|
+
})),
|
|
91
98
|
};
|
|
92
99
|
};
|
|
93
100
|
export const fromRaw = (raw) => ({
|
|
@@ -95,6 +102,7 @@ export const fromRaw = (raw) => ({
|
|
|
95
102
|
publicRole: raw.public_role,
|
|
96
103
|
ownerId: raw.owner_id ?? -1,
|
|
97
104
|
listAccess: raw.list_access.map(u => ({
|
|
105
|
+
...mapKeys(u, (_v, key) => camelCase(key)),
|
|
98
106
|
userId: u.user_id,
|
|
99
107
|
role: u.role,
|
|
100
108
|
allowView: u.allow_view,
|
|
@@ -107,6 +115,7 @@ export const toRaw = (info) => ({
|
|
|
107
115
|
public_role: info.publicRole,
|
|
108
116
|
owner_id: info.ownerId,
|
|
109
117
|
list_access: info.listAccess.map(u => ({
|
|
118
|
+
...mapKeys(u, (_v, key) => snakeCase(key)),
|
|
110
119
|
user_id: u.userId,
|
|
111
120
|
role: u.role,
|
|
112
121
|
allow_view: u.allowView,
|