@antscorp/antsomi-ui 1.3.5-beta.390 → 1.3.5-beta.391

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.
@@ -12,12 +12,12 @@ export declare const ROLE_MAPPING: {
12
12
  readonly EDITOR: 2;
13
13
  readonly VIEWER: 3;
14
14
  };
15
- export declare const ACCESS_PROPERTIES_BY_ROLE: Record<AccessRole, Pick<UserAccessInfo, 'role' | 'allowView' | 'allowEdit' | 'allowComment'>>;
16
15
  export declare const ROLE_ACCESS_LABEL: {
17
16
  1: string;
18
17
  2: string;
19
18
  3: string;
20
19
  };
20
+ export declare const ACCESS_PROPERTIES_BY_ROLE: Record<AccessRole, Pick<UserAccessInfo, 'role' | 'allowView' | 'allowEdit' | 'allowComment' | 'accessType'>>;
21
21
  export declare const PEOPLE_ACTION_KEYS: {
22
22
  readonly TO_VIEWER: "to_viewer";
23
23
  readonly TO_EDITOR: "to_editor";
@@ -11,31 +11,43 @@ export const ROLE_MAPPING = {
11
11
  EDITOR: 2,
12
12
  VIEWER: 3,
13
13
  };
14
+ export const ROLE_ACCESS_LABEL = {
15
+ [ROLE_MAPPING.OWNER]: 'Owner',
16
+ [ROLE_MAPPING.EDITOR]: 'Editor',
17
+ [ROLE_MAPPING.VIEWER]: 'Viewer',
18
+ };
14
19
  export const ACCESS_PROPERTIES_BY_ROLE = {
15
20
  [ROLE_MAPPING.OWNER]: {
16
21
  role: ROLE_MAPPING.OWNER,
17
22
  allowView: 1,
18
23
  allowEdit: 1,
19
24
  allowComment: 1,
25
+ accessType: {
26
+ label: ROLE_ACCESS_LABEL[ROLE_MAPPING.OWNER],
27
+ value: ROLE_ACCESS_LABEL[ROLE_MAPPING.OWNER].toLowerCase(),
28
+ },
20
29
  },
21
30
  [ROLE_MAPPING.EDITOR]: {
22
31
  role: ROLE_MAPPING.EDITOR,
23
32
  allowView: 1,
24
33
  allowEdit: 1,
25
34
  allowComment: 1,
35
+ accessType: {
36
+ label: ROLE_ACCESS_LABEL[ROLE_MAPPING.EDITOR],
37
+ value: ROLE_ACCESS_LABEL[ROLE_MAPPING.EDITOR].toLowerCase(),
38
+ },
26
39
  },
27
40
  [ROLE_MAPPING.VIEWER]: {
28
41
  role: ROLE_MAPPING.VIEWER,
29
42
  allowView: 1,
30
43
  allowEdit: 0,
31
44
  allowComment: 0,
45
+ accessType: {
46
+ label: ROLE_ACCESS_LABEL[ROLE_MAPPING.VIEWER],
47
+ value: ROLE_ACCESS_LABEL[ROLE_MAPPING.VIEWER].toLowerCase(),
48
+ },
32
49
  },
33
50
  };
34
- export const ROLE_ACCESS_LABEL = {
35
- [ROLE_MAPPING.OWNER]: 'Owner',
36
- [ROLE_MAPPING.EDITOR]: 'Editor',
37
- [ROLE_MAPPING.VIEWER]: 'Viewer',
38
- };
39
51
  export const PEOPLE_ACTION_KEYS = {
40
52
  TO_VIEWER: 'to_viewer',
41
53
  TO_EDITOR: 'to_editor',
@@ -20,6 +20,10 @@ export type UserAccessInfo = {
20
20
  allowView: number;
21
21
  allowEdit: number;
22
22
  allowComment: number;
23
+ accessType: {
24
+ label: string;
25
+ value: string;
26
+ };
23
27
  [key: string]: any;
24
28
  };
25
29
  export type ObjectAccessInfo = {
@@ -48,6 +48,10 @@ export declare const formattedAccessInfo: (accessInfo: ObjectAccessInfo) => {
48
48
  allowView: number;
49
49
  allowEdit: number;
50
50
  allowComment: number;
51
+ accessType: {
52
+ label: string;
53
+ value: string;
54
+ };
51
55
  }[];
52
56
  isPublic: number;
53
57
  publicRole: number | null;
@@ -1,4 +1,4 @@
1
- import { MENU_PERMISSION, PEOPLE_ACTIONS, PEOPLE_ACTION_KEYS, PUBLIC_ROLE, ROLE_MAPPING, } from './constants';
1
+ import { MENU_PERMISSION, PEOPLE_ACTIONS, PEOPLE_ACTION_KEYS, PUBLIC_ROLE, 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) => {
@@ -59,7 +59,10 @@ export const getActionsByUser = (args) => {
59
59
  export const initAccessInfoDefault = (userInfo) => ({
60
60
  ownerId: +(userInfo === null || userInfo === void 0 ? void 0 : userInfo.user_id),
61
61
  listAccess: [
62
- Object.assign(Object.assign({}, snakeCaseToCamelCase(userInfo)), { role: ROLE_MAPPING.OWNER, allowView: 1, allowEdit: 1, allowComment: 1 }),
62
+ Object.assign(Object.assign({}, snakeCaseToCamelCase(userInfo)), { role: ROLE_MAPPING.OWNER, allowView: 1, allowEdit: 1, allowComment: 1, accessType: {
63
+ label: ROLE_ACCESS_LABEL[ROLE_MAPPING.OWNER],
64
+ value: ROLE_ACCESS_LABEL[ROLE_MAPPING.OWNER].toLowerCase(),
65
+ } }),
63
66
  ],
64
67
  publicRole: PUBLIC_ROLE.ONLY_VIEWER,
65
68
  isPublic: 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.5-beta.390",
3
+ "version": "1.3.5-beta.391",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",