@antscorp/antsomi-ui 2.0.118 → 2.0.120

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.
@@ -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 (_jsx(Spin, { spinning: !!isLoading, children: _jsxs(StyledLayoutContentRoot, { children: [!isLoading && allowAddUser && (_jsx(SearchUser, { getUserInfo: getUserInfo, placeholder: placeholder })), _jsx(PeopleAccess, { excludeUserAccess: excludeUserAccess, hideTransferOwnership: hideTransferOwnership }), _jsx(GeneralAccess, { generalAccessSettings: generalAccessSettings }), _jsx(ModalTransferOwnership, {})] }) }));
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 => ({ ...user, userId: +user.userId })),
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,
@@ -528,5 +528,6 @@ export const AccountSharing = props => {
528
528
  backgroundColor: THEME.token?.blue1_2,
529
529
  padding: '20px 15px',
530
530
  width: '400px',
531
+ maxHeight: 'calc(100dvh - 80px)',
531
532
  }, children: _jsxs(TriggerPopoverStyled, { children: [_jsx("div", { className: "brand-logo", children: currentNetwork?.logo ? _jsx("img", { src: currentNetwork.logo, alt: "" }) : null }), _jsx("div", { className: "avatar", children: infoAccount ? _jsx("img", { src: infoAccount.avatar, alt: "" }) : null })] }) }), _jsx(AccountProfile, { accountId: accountId, iamDomain: formatDomain, token: token, isDisabledEdit: false, open: openAccountProfile, onClose: () => setOpenAccountProfile(false) })] }));
532
533
  };
@@ -270,7 +270,7 @@ export const PackageSharingStyled = styled.div `
270
270
  grid-template-columns: 1fr 1fr 1fr;
271
271
  gap: 15px;
272
272
  margin-top: 26px;
273
- max-height: 335px;
273
+ max-height: min(335px, calc(100dvh - 380px));
274
274
  overflow-y: auto;
275
275
  padding: 0 7px;
276
276
  .network-item {
@@ -1,6 +1,8 @@
1
+ import { StyleProviderProps } from '@ant-design/cssinjs';
1
2
  import { ConfigProviderProps as AntdConfigProviderProps } from 'antd/es/config-provider';
2
3
  import React, { ReactNode } from 'react';
3
4
  import '@antscorp/antsomi-ui/es/assets/css/main.scss';
5
+ import { type GlobalStyleProps } from './GlobalStyle';
4
6
  import { TLocale } from '@antscorp/antsomi-ui/es/types';
5
7
  import 'animate.css';
6
8
  import { AppConfigProviderProps } from '../AppConfigProvider';
@@ -8,6 +10,8 @@ interface ConfigProviderProps extends Omit<AntdConfigProviderProps, 'locale'> {
8
10
  children?: ReactNode;
9
11
  locale?: TLocale;
10
12
  appConfig?: AppConfigProviderProps;
13
+ globalStyle?: GlobalStyleProps;
14
+ styleProviderProps?: StyleProviderProps;
11
15
  }
12
16
  declare const ConfigProvider: React.FC<ConfigProviderProps>;
13
17
  export default ConfigProvider;
@@ -22,7 +22,6 @@ import 'animate.css';
22
22
  import { AppConfigProvider } from '../AppConfigProvider';
23
23
  // Hooks
24
24
  import { useMutationObserver } from '../../hooks';
25
- import { QueryDevtoolsAntsomiUI } from '../../queries';
26
25
  // Providers
27
26
  // import {
28
27
  // QueryClientProviderAntsomiUI,
@@ -37,7 +36,7 @@ dayjs.extend(timezone);
37
36
  dayjs.extend(relativeTime);
38
37
  const ConfigProvider = props => {
39
38
  // Props
40
- const { children, locale, appConfig, theme = THEME, prefixCls = ANTSOMI_COMPONENT_PREFIX_CLS, ...restOfProps } = props;
39
+ const { children, locale, appConfig, theme = THEME, prefixCls = ANTSOMI_COMPONENT_PREFIX_CLS, globalStyle = {}, styleProviderProps = {}, ...restOfProps } = props;
41
40
  // Refs
42
41
  const ref = useRef(null);
43
42
  // Handlers
@@ -82,6 +81,6 @@ const ConfigProvider = props => {
82
81
  const containers = document.getElementsByClassName('antsomi-scroll-box');
83
82
  handleScrollAction(Array.from(containers));
84
83
  }, []);
85
- return (_jsx(AntdConfigProvider, { theme: theme, prefixCls: prefixCls, ...restOfProps, children: _jsx(AppConfigProvider, { value: appConfig, children: _jsx("div", { ref: ref, children: _jsxs(App, { children: [_jsx(GlobalStyle, {}), _jsx(StyleProvider, { hashPriority: "high", children: children }), _jsx(QueryDevtoolsAntsomiUI, { position: "bottom-right" })] }) }) }) }));
84
+ return (_jsx(AntdConfigProvider, { theme: theme, prefixCls: prefixCls, ...restOfProps, children: _jsx(AppConfigProvider, { value: appConfig, children: _jsx("div", { ref: ref, children: _jsxs(App, { children: [_jsx(GlobalStyle, { ...globalStyle }), _jsx(StyleProvider, { ...styleProviderProps, hashPriority: "high", children: children })] }) }) }) }));
86
85
  };
87
86
  export default ConfigProvider;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- interface GlobalStyleProps {
2
+ export interface GlobalStyleProps {
3
+ resetStyles?: boolean;
3
4
  }
4
5
  export declare const GlobalStyle: React.FC<GlobalStyleProps>;
5
- export {};
@@ -9,7 +9,7 @@ import { far } from '@fortawesome/free-regular-svg-icons';
9
9
  import { fab } from '@fortawesome/free-brands-svg-icons';
10
10
  library.add(fas, far, fab);
11
11
  const { accent7, gray5, scrollBarSize, bw3, bw4, bw5 } = THEME.token || {};
12
- export const GlobalStyle = () => (_jsx(Global, { styles: css `
12
+ export const GlobalStyle = props => (_jsx(Global, { styles: css `
13
13
  @import url('https://fonts.googleapis.com/css2?family=Roboto:wght@100;300;400;500;700;900&display=swap');
14
14
 
15
15
  :root {
@@ -18,69 +18,72 @@ export const GlobalStyle = () => (_jsx(Global, { styles: css `
18
18
  --divider-3: ${bw5};
19
19
  }
20
20
 
21
- *,
22
- *:before,
23
- *:after {
24
- -webkit-box-sizing: border-box;
25
- -moz-box-sizing: border-box;
26
- box-sizing: border-box;
27
- border-width: 0;
28
- border-style: solid;
29
- }
30
-
31
- blockquote,
32
- dl,
33
- dd,
34
- h1,
35
- h2,
36
- h3,
37
- h4,
38
- h5,
39
- h6,
40
- hr,
41
- figure,
42
- p,
43
- pre {
44
- margin: 0;
45
- }
46
-
47
- h1,
48
- h2,
49
- h3,
50
- h4,
51
- h5,
52
- h6 {
53
- font-size: inherit;
54
- font-weight: inherit;
55
- }
56
-
57
- ol,
58
- ul {
59
- list-style: none;
60
- margin: 0;
61
- padding: 0;
62
- }
63
-
64
- img,
65
- svg,
66
- video,
67
- canvas,
68
- audio,
69
- iframe,
70
- embed,
71
- object {
72
- vertical-align: middle;
73
- }
74
-
75
- img,
76
- video {
77
- max-width: 100%;
78
- height: auto;
79
- }
80
-
81
- hr {
82
- border-color: var(--divider-1);
83
- }
21
+ ${props.resetStyles !== false &&
22
+ `
23
+ *,
24
+ *:before,
25
+ *:after {
26
+ -webkit-box-sizing: border-box;
27
+ -moz-box-sizing: border-box;
28
+ box-sizing: border-box;
29
+ border-width: 0;
30
+ border-style: solid;
31
+ }
32
+
33
+ blockquote,
34
+ dl,
35
+ dd,
36
+ h1,
37
+ h2,
38
+ h3,
39
+ h4,
40
+ h5,
41
+ h6,
42
+ hr,
43
+ figure,
44
+ p,
45
+ pre {
46
+ margin: 0;
47
+ }
48
+
49
+ h1,
50
+ h2,
51
+ h3,
52
+ h4,
53
+ h5,
54
+ h6 {
55
+ font-size: inherit;
56
+ font-weight: inherit;
57
+ }
58
+
59
+ ol,
60
+ ul {
61
+ list-style: none;
62
+ margin: 0;
63
+ padding: 0;
64
+ }
65
+
66
+ img,
67
+ svg,
68
+ video,
69
+ canvas,
70
+ audio,
71
+ iframe,
72
+ embed,
73
+ object {
74
+ vertical-align: middle;
75
+ }
76
+
77
+ img,
78
+ video {
79
+ max-width: 100%;
80
+ height: auto;
81
+ }
82
+
83
+ hr {
84
+ border-color: var(--divider-1);
85
+ }
86
+ `}
84
87
 
85
88
  .rc-virtual-list-scrollbar {
86
89
  width: 4px !important;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "2.0.118",
3
+ "version": "2.0.120",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",