@antscorp/antsomi-ui 1.3.5-beta.601 → 1.3.5-beta.602
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/PeopleAccess/PeopleAccess.js +7 -3
- package/es/components/molecules/ShareAccess/constants.d.ts +1 -0
- package/es/components/molecules/ShareAccess/constants.js +1 -0
- package/es/components/molecules/ShareAccess/utils.d.ts +1 -13
- package/es/components/molecules/ShareAccess/utils.js +4 -2
- package/es/components/organism/LeftMenu/hooks/useLeftMenu.js +2 -2
- package/package.json +1 -1
|
@@ -3,12 +3,13 @@ import produce from 'immer';
|
|
|
3
3
|
import { Avatar, Dropdown, List } from 'antd';
|
|
4
4
|
import { remove, cloneDeep } from 'lodash';
|
|
5
5
|
import React, { useMemo } from 'react';
|
|
6
|
-
import { ACCESS_PROPERTIES_BY_ROLE, PEOPLE_ACTION_KEYS, ROLE_ACCESS_LABEL, ROLE_MAPPING, } from '../../constants';
|
|
6
|
+
import { ACCESS_PROPERTIES_BY_ROLE, PEOPLE_ACTION_KEYS, REGEX_REMOVE_NAME, ROLE_ACCESS_LABEL, ROLE_MAPPING, } from '../../constants';
|
|
7
7
|
import { useShareAccess } from '../../hooks';
|
|
8
8
|
import { getActionsByUser } from '../../utils';
|
|
9
9
|
import { StyledPeopleAccessRoot } from './styled';
|
|
10
10
|
import { updateModalTransferOwnership, updateObjAccessInfo } from '../../actions';
|
|
11
11
|
import { Spin } from '@antscorp/antsomi-ui/es/components/atoms';
|
|
12
|
+
import { globalToken } from '@antscorp/antsomi-ui/es/constants';
|
|
12
13
|
const ROLE_BY_ACTIONS = {
|
|
13
14
|
[PEOPLE_ACTION_KEYS.TO_OWNER]: ROLE_MAPPING.OWNER,
|
|
14
15
|
[PEOPLE_ACTION_KEYS.TO_EDITOR]: ROLE_MAPPING.EDITOR,
|
|
@@ -84,6 +85,7 @@ export const PeopleAccess = (props) => {
|
|
|
84
85
|
return (React.createElement(StyledPeopleAccessRoot, null,
|
|
85
86
|
React.createElement("div", { className: "title" }, "People with access"),
|
|
86
87
|
React.createElement(List, { dataSource: dataSourceSorted, loading: { spinning: dataSourceSorted.length === 0, indicator: React.createElement(Spin, null) }, renderItem: access => {
|
|
88
|
+
var _a;
|
|
87
89
|
const actions = getActionsByUser({
|
|
88
90
|
userId: accessUserId,
|
|
89
91
|
updatedUserId: access.userId,
|
|
@@ -97,8 +99,10 @@ export const PeopleAccess = (props) => {
|
|
|
97
99
|
return (React.createElement(List.Item, null,
|
|
98
100
|
React.createElement(Avatar, { src: access.avatar }),
|
|
99
101
|
React.createElement("div", { className: "info" },
|
|
100
|
-
React.createElement("div", { className: "name" },
|
|
101
|
-
|
|
102
|
+
React.createElement("div", { className: "name" },
|
|
103
|
+
REGEX_REMOVE_NAME.test(access.email || '') && (React.createElement("span", { style: { color: globalToken === null || globalToken === void 0 ? void 0 : globalToken.red6 } }, "[Deleted account]\u00A0")),
|
|
104
|
+
access.fullName || (access === null || access === void 0 ? void 0 : access.name)),
|
|
105
|
+
React.createElement("div", { className: "email" }, (_a = access.email) === null || _a === void 0 ? void 0 : _a.replace(REGEX_REMOVE_NAME, ''))),
|
|
102
106
|
React.createElement(Dropdown, { trigger: ['click'], disabled: !actions.length, overlayStyle: { zIndex: 3002 }, menu: {
|
|
103
107
|
items: renderActionItems(actions),
|
|
104
108
|
onClick: e => handleClickAction(e.key, access.userId),
|
|
@@ -26,19 +26,7 @@ export declare const getActionsByUser: (args: {
|
|
|
26
26
|
updatedUserId?: number;
|
|
27
27
|
objectAccessInfo?: ObjectAccessInfo;
|
|
28
28
|
omit?: Array<(typeof PEOPLE_ACTION_KEYS)[keyof typeof PEOPLE_ACTION_KEYS]>;
|
|
29
|
-
}) =>
|
|
30
|
-
readonly label: "Viewer";
|
|
31
|
-
readonly key: "to_viewer";
|
|
32
|
-
} | {
|
|
33
|
-
readonly label: "Editor";
|
|
34
|
-
readonly key: "to_editor";
|
|
35
|
-
} | {
|
|
36
|
-
readonly label: "Transfer ownership";
|
|
37
|
-
readonly key: "to_owner";
|
|
38
|
-
} | {
|
|
39
|
-
readonly label: "Remove Access";
|
|
40
|
-
readonly key: "remove_acess";
|
|
41
|
-
})[];
|
|
29
|
+
}) => any[];
|
|
42
30
|
export declare const initAccessInfoDefault: (userInfo: Partial<UserInfo>) => ObjectAccessInfo;
|
|
43
31
|
export declare const safeParseAccessInfo: (accessInfo: ObjectAccessInfo) => {
|
|
44
32
|
ownerId: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MENU_PERMISSION, PEOPLE_ACTIONS, PEOPLE_ACTION_KEYS, PUBLIC_ROLE, ROLE_ACCESS_LABEL, ROLE_MAPPING, } from './constants';
|
|
1
|
+
import { MENU_PERMISSION, PEOPLE_ACTIONS, PEOPLE_ACTION_KEYS, PUBLIC_ROLE, REGEX_REMOVE_NAME, ROLE_ACCESS_LABEL, ROLE_MAPPING, } from './constants';
|
|
2
2
|
import { remove } from 'lodash';
|
|
3
3
|
import { snakeCaseToCamelCase } from '@antscorp/antsomi-ui/es/utils';
|
|
4
4
|
export const mergePermission = (objectPermissionAllow, menuPermissionValue) => {
|
|
@@ -54,7 +54,9 @@ export const getActionsByUser = (args) => {
|
|
|
54
54
|
});
|
|
55
55
|
if ((!user && !isPublic) || !updatedUser || !allowEdit || updatedUser.userId === ownerId)
|
|
56
56
|
return [];
|
|
57
|
-
const actions =
|
|
57
|
+
const actions = REGEX_REMOVE_NAME.test(updatedUser.email || '')
|
|
58
|
+
? ['remove_acess']
|
|
59
|
+
: Object.values(PEOPLE_ACTION_KEYS);
|
|
58
60
|
if (userId !== ownerId || (omit === null || omit === void 0 ? void 0 : omit.includes('to_owner'))) {
|
|
59
61
|
remove(actions, actKey => actKey === PEOPLE_ACTION_KEYS.TO_OWNER);
|
|
60
62
|
}
|
|
@@ -68,7 +68,7 @@ export const useLeftMenu = (props) => {
|
|
|
68
68
|
onMenuItemClick === null || onMenuItemClick === void 0 ? void 0 : onMenuItemClick(key, [...keyPath, customActiveAppKey]);
|
|
69
69
|
}, [customActiveAppKey, onMenuItemClick, setLeftMenuContextState, type]);
|
|
70
70
|
useDeepCompareEffect(() => {
|
|
71
|
-
if (
|
|
71
|
+
if (defaultExpandMenu === undefined) {
|
|
72
72
|
cookies.set('_leftmenu_state', state.isExpandMenu ? 1 : 0, {
|
|
73
73
|
domain: `.${origin.split('.').splice(-2).join('.')}`,
|
|
74
74
|
path: '/',
|
|
@@ -76,7 +76,7 @@ export const useLeftMenu = (props) => {
|
|
|
76
76
|
secure: true,
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
|
-
}, [
|
|
79
|
+
}, [cookies, defaultExpandMenu, origin, state.isExpandMenu]);
|
|
80
80
|
useDeepCompareEffect(() => {
|
|
81
81
|
setLeftMenuContextState({
|
|
82
82
|
appConfig,
|