@antscorp/antsomi-ui 1.3.5-beta.77 → 1.3.5-beta.78

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,2 +1,5 @@
1
- import React from 'react';
2
- export declare const GeneralAccess: () => React.JSX.Element | null;
1
+ import { FC } from 'react';
2
+ import { ShareAccessProps } from '../../types';
3
+ type GeneralAccessProps = Pick<ShareAccessProps, 'generalAccessSettings'>;
4
+ export declare const GeneralAccess: FC<GeneralAccessProps>;
5
+ export {};
@@ -6,12 +6,13 @@ import { updateObjAccessInfo } from '../../actions';
6
6
  import { GENERAL_ACCESS, PUBLIC_ROLE, ROLE_ACCESS_LABEL } from '../../constants';
7
7
  import { useShareAccess } from '../../hooks';
8
8
  import { StyledGeneralAccessRoot } from './styled';
9
- export const GeneralAccess = () => {
9
+ export const GeneralAccess = ({ generalAccessSettings }) => {
10
10
  const { state, dispatch } = useShareAccess();
11
11
  const { accessInfo, allowEdit } = state;
12
12
  if (!accessInfo)
13
13
  return null;
14
14
  const { isPublic, publicRole } = accessInfo;
15
+ const isShowOnlyText = !!(generalAccessSettings === null || generalAccessSettings === void 0 ? void 0 : generalAccessSettings.publicOnlyWith);
15
16
  const handleChangeGeneralAccess = (value) => {
16
17
  if (!accessInfo || !dispatch || !allowEdit)
17
18
  return;
@@ -58,7 +59,7 @@ export const GeneralAccess = () => {
58
59
  React.createElement("div", { className: "accessable-title" }, isPublic ? 'Public' : 'Restricted'),
59
60
  allowEdit && React.createElement(Icon, { className: "icon-angle", type: "icon-ants-angle-down" }))),
60
61
  React.createElement("div", { className: "description" }, renderDescription())),
61
- !!isPublic && publicRole && (React.createElement(Dropdown, { placement: "bottomLeft", trigger: ['click'], destroyPopupOnHide: true, disabled: !allowEdit, overlayStyle: { zIndex: 3002 }, menu: {
62
+ !!isPublic && publicRole && (React.createElement(Dropdown, { placement: "bottomLeft", trigger: ['click'], destroyPopupOnHide: true, disabled: !allowEdit || isShowOnlyText, overlayStyle: { zIndex: 3002 }, menu: {
62
63
  items: [
63
64
  publicRole === PUBLIC_ROLE.ONLY_VIEWER
64
65
  ? {
@@ -74,5 +75,5 @@ export const GeneralAccess = () => {
74
75
  } },
75
76
  React.createElement("div", { className: "public-role-dropdown-wrapper" },
76
77
  React.createElement("div", { className: "for-title" }, ROLE_ACCESS_LABEL[publicRole]),
77
- allowEdit && React.createElement(Icon, { className: "icon-angle", type: "icon-ants-angle-down" })))))));
78
+ allowEdit && !isShowOnlyText && (React.createElement(Icon, { className: "icon-angle", type: "icon-ants-angle-down" }))))))));
78
79
  };
@@ -6,7 +6,7 @@ import { PeopleAccess } from '../PeopleAccess';
6
6
  import { SearchUser } from '../SearchUser';
7
7
  import { StyledLayoutContentRoot } from './styled';
8
8
  export const LayoutContent = (props) => {
9
- const { getUserInfo, excludeUserAccess, allowAddUser = true } = props;
9
+ const { getUserInfo, generalAccessSettings, excludeUserAccess, allowAddUser = true } = props;
10
10
  const { state } = useShareAccess();
11
11
  const { allowEdit, allowView } = state;
12
12
  if (!allowEdit && !allowView)
@@ -14,6 +14,6 @@ export const LayoutContent = (props) => {
14
14
  return (React.createElement(StyledLayoutContentRoot, null,
15
15
  allowAddUser && React.createElement(SearchUser, { getUserInfo: getUserInfo }),
16
16
  React.createElement(PeopleAccess, { excludeUserAccess: excludeUserAccess }),
17
- React.createElement(GeneralAccess, null),
17
+ React.createElement(GeneralAccess, { generalAccessSettings: generalAccessSettings }),
18
18
  React.createElement(ModalTransferOwnership, null)));
19
19
  };
@@ -29,6 +29,9 @@ export type ObjectAccessInfo = {
29
29
  listAccess: UserAccessInfo[];
30
30
  };
31
31
  export type ExcludeUserAccess = Array<(typeof PEOPLE_ACTION_KEYS)[keyof typeof PEOPLE_ACTION_KEYS]>;
32
+ export type GeneralAccessSettings = {
33
+ publicOnlyWith?: boolean;
34
+ };
32
35
  export type ShareAccessProps = {
33
36
  userId?: number;
34
37
  userPermission?: {
@@ -39,6 +42,7 @@ export type ShareAccessProps = {
39
42
  allowAddUser?: boolean;
40
43
  excludeUserAccess?: ExcludeUserAccess;
41
44
  getUserInfo?(search: string, signal: AbortSignal): Promise<UserInfo[]> | UserInfo[];
45
+ generalAccessSettings?: GeneralAccessSettings;
42
46
  onChange?: (accessInfo: ObjectAccessInfo) => void;
43
47
  };
44
48
  export type ShareAccessState = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.5-beta.77",
3
+ "version": "1.3.5-beta.78",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",