@antscorp/antsomi-ui 1.3.5-beta.522 → 1.3.5-beta.524

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.
@@ -57,7 +57,7 @@ export const GeneralAccess = ({ generalAccessSettings }) => {
57
57
  } },
58
58
  React.createElement("div", { className: "general-dropdown-wrapper" },
59
59
  React.createElement("div", { className: "accessable-title" }, isPublic ? 'Public' : 'Restricted'),
60
- allowEdit && React.createElement(Icon, { className: "icon-angle", type: "icon-ants-angle-down" }))),
60
+ allowEdit && (React.createElement(Icon, { className: "icon-angle", type: "icon-ants-expand-more", style: { fontSize: 20 } })))),
61
61
  React.createElement("div", { className: "description" }, renderDescription())),
62
62
  !!isPublic && publicRole && (React.createElement(Dropdown, { placement: "bottomLeft", trigger: ['click'], destroyPopupOnHide: true, disabled: !allowEdit || isShowOnlyText, overlayStyle: { zIndex: 3002 }, menu: {
63
63
  items: [
@@ -75,5 +75,5 @@ export const GeneralAccess = ({ generalAccessSettings }) => {
75
75
  } },
76
76
  React.createElement("div", { className: "public-role-dropdown-wrapper" },
77
77
  React.createElement("div", { className: "for-title" }, ROLE_ACCESS_LABEL[publicRole]),
78
- allowEdit && !isShowOnlyText && (React.createElement(Icon, { className: "icon-angle", type: "icon-ants-angle-down" }))))))));
78
+ allowEdit && !isShowOnlyText && (React.createElement(Icon, { className: "icon-angle", type: "icon-ants-expand-more", style: { fontSize: 20 } }))))))));
79
79
  };
@@ -6,8 +6,7 @@ export const StyledGeneralAccessRoot = styled.div `
6
6
  flex-direction: column;
7
7
 
8
8
  .title {
9
- margin-bottom: 12px;
10
- font-weight: bold;
9
+ margin-bottom: 10px;
11
10
  }
12
11
 
13
12
  .setting {
@@ -15,13 +14,13 @@ export const StyledGeneralAccessRoot = styled.div `
15
14
  justify-content: space-between;
16
15
  border: 1px solid #e6e6e6;
17
16
  border-radius: ${(_a = THEME.token) === null || _a === void 0 ? void 0 : _a.borderRadius}px;
18
- padding: 8px;
17
+ padding: 15px;
19
18
 
20
- .icon-angle {
19
+ /* .icon-angle {
21
20
  font-size: 10px;
22
21
  display: flex;
23
22
  align-items: center;
24
- }
23
+ } */
25
24
 
26
25
  .accessable-icon {
27
26
  font-size: 28px;
@@ -3,5 +3,5 @@ export const StyledLayoutContentRoot = styled.div `
3
3
  font-size: 12px;
4
4
  display: flex;
5
5
  flex-direction: column;
6
- gap: 15px;
6
+ gap: 20px;
7
7
  `;
@@ -104,6 +104,6 @@ export const PeopleAccess = (props) => {
104
104
  } },
105
105
  React.createElement("div", { className: "role-actions" },
106
106
  React.createElement("div", { className: "role" }, ROLE_ACCESS_LABEL[access.role] || ''),
107
- !!actions.length && (React.createElement(Icon, { type: "icon-ants-angle-down", style: { fontSize: 10 } }))))));
107
+ !!actions.length && (React.createElement(Icon, { type: "icon-ants-expand-more", style: { fontSize: 20 } }))))));
108
108
  } })));
109
109
  };
@@ -6,8 +6,7 @@ export const StyledPeopleAccessRoot = styled.div `
6
6
  flex-direction: column;
7
7
 
8
8
  .title {
9
- margin-bottom: 12px;
10
- font-weight: bold;
9
+ margin-bottom: 10px;
11
10
  }
12
11
 
13
12
  .antsomi-list {
@@ -15,12 +14,19 @@ export const StyledPeopleAccessRoot = styled.div `
15
14
  border: 1px solid #e6e6e6;
16
15
 
17
16
  .antsomi-list-items {
18
- padding: 0;
17
+ /* padding: 0; */
18
+ padding: 15px;
19
19
 
20
20
  .antsomi-list-item {
21
- padding: 8px;
21
+ /* padding: 8px; */
22
+ padding: 0;
23
+ margin-bottom: 15px;
22
24
  border: none;
23
25
 
26
+ &:last-child {
27
+ margin-bottom: 0;
28
+ }
29
+
24
30
  .info {
25
31
  flex: 1;
26
32
  margin-left: 15px;
@@ -34,6 +40,10 @@ export const StyledPeopleAccessRoot = styled.div `
34
40
  }
35
41
  }
36
42
 
43
+ /* .antsomi-avatar {
44
+ align-self: flex-start;
45
+ } */
46
+
37
47
  .role-actions {
38
48
  display: flex;
39
49
  align-items: center;
@@ -43,6 +53,10 @@ export const StyledPeopleAccessRoot = styled.div `
43
53
  cursor: pointer;
44
54
  }
45
55
  }
56
+
57
+ /* .role-actions :not(i) {
58
+ align-self: flex-start !important;
59
+ } */
46
60
  }
47
61
  }
48
62
  }
@@ -7,16 +7,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import React, { useEffect, useMemo, useState } from 'react';
11
- import { Avatar, AutoComplete } from 'antd';
10
+ import { Spin } from '@antscorp/antsomi-ui/es/components/atoms';
12
11
  import { useDebounce } from '@antscorp/antsomi-ui/es/hooks/useDebounceV2';
13
- import { StyledSearchUserRoot, StyledSelectItem } from './styled';
14
12
  import { isEmail } from '@antscorp/antsomi-ui/es/utils';
15
- import { useShareAccess } from '../../hooks';
13
+ import { AutoComplete, Avatar, Input } from 'antd';
16
14
  import produce from 'immer';
17
- import { ACCESS_PROPERTIES_BY_ROLE, ROLE_MAPPING } from '../../constants';
15
+ import React, { useEffect, useMemo, useState } from 'react';
18
16
  import { updateObjAccessInfo } from '../../actions';
19
- import { Spin } from '@antscorp/antsomi-ui/es/components/atoms';
17
+ import { ACCESS_PROPERTIES_BY_ROLE, ROLE_MAPPING } from '../../constants';
18
+ import { useShareAccess } from '../../hooks';
19
+ import { StyledSearchUserRoot, StyledSelectItem } from './styled';
20
20
  export const SearchUser = (props) => {
21
21
  const { getUserInfo, placeholder = 'Add people' } = props;
22
22
  const { state, dispatch } = useShareAccess();
@@ -72,18 +72,32 @@ export const SearchUser = (props) => {
72
72
  if (!allowEdit)
73
73
  return null;
74
74
  return (React.createElement(StyledSearchUserRoot, null,
75
- React.createElement(AutoComplete, { placeholder: placeholder, value: searchTerm, onSearch: v => setSearchTerm(v), notFoundContent: isFetching ? (React.createElement(Spin, { style: {
76
- width: '100%',
77
- height: '40px',
78
- display: 'flex',
79
- alignItems: 'center',
80
- justifyContent: 'center',
81
- }, indicatorSize: 28 })) : null, options: (excludedUsers || []).map(user => ({
75
+ React.createElement(AutoComplete, { value: searchTerm, onSearch: v => setSearchTerm(v), notFoundContent: null,
76
+ // TODO: move to inline Input loading - prevent annoying effect when isFetching so fast
77
+ // notFoundContent={
78
+ // isFetching ? (
79
+ // <Spin
80
+ // style={{
81
+ // width: '100%',
82
+ // height: '40px',
83
+ // display: 'flex',
84
+ // alignItems: 'center',
85
+ // justifyContent: 'center',
86
+ // }}
87
+ // indicatorSize={28}
88
+ // />
89
+ // ) : null
90
+ // }
91
+ options: (excludedUsers || []).map(user => ({
82
92
  value: user.user_id,
83
93
  label: (React.createElement(StyledSelectItem, { onClick: () => handleAddUser(user) },
84
94
  React.createElement(Avatar, { src: user.avatar }),
85
95
  React.createElement("div", { className: "info" },
86
96
  React.createElement("div", { className: "name" }, user.user_name),
87
97
  React.createElement("div", { className: "email" }, user.email)))),
88
- })) })));
98
+ })) },
99
+ React.createElement(Input, { style: { padding: '5px' }, placeholder: placeholder, suffix: isFetching ? (React.createElement(Spin, { indicatorSize: 20, style: { paddingLeft: '5px', marginLeft: '10px', alignSelf: 'center' } })) : (
100
+ // TODO: empty span for Input don't lose focus when fetching
101
+ // https://ant.design/components/input#why-input-lose-focus-when-change-prefixsuffixshowcount
102
+ React.createElement("span", null)), autoFocus: true }))));
89
103
  };
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { ReactNode } from 'react';
2
2
  import { FlexProps } from 'antd/lib';
3
3
  export type TChangePageSizePayload = {
4
4
  pageSize: number;
@@ -8,6 +8,7 @@ export interface PaginationProps extends Omit<FlexProps, 'children' | 'onChange'
8
8
  page?: number;
9
9
  pageSize?: number;
10
10
  total?: number;
11
+ extraContent?: ReactNode;
11
12
  onChange?: (payload: TChangePageSizePayload) => void;
12
13
  }
13
14
  export declare const Pagination: React.FC<PaginationProps>;
@@ -25,7 +25,7 @@ import { DEFAULT_PAGE, DEFAULT_PAGE_SIZE, PAGE_SIZE_OPTIONS } from '../../consta
25
25
  const { Text } = Typography;
26
26
  export const Pagination = props => {
27
27
  // Props
28
- const { pageSize = DEFAULT_PAGE_SIZE, page = DEFAULT_PAGE, total = 0, onChange } = props, restProps = __rest(props, ["pageSize", "page", "total", "onChange"]);
28
+ const { pageSize = DEFAULT_PAGE_SIZE, page = DEFAULT_PAGE, total = 0, extraContent, onChange } = props, restProps = __rest(props, ["pageSize", "page", "total", "extraContent", "onChange"]);
29
29
  // Instance
30
30
  const { t } = i18nInstance;
31
31
  // Memo
@@ -40,20 +40,22 @@ export const Pagination = props => {
40
40
  pageSize }, payload));
41
41
  }
42
42
  };
43
- return (React.createElement(PaginationWrapper, Object.assign({ align: "center", gap: 10 }, restProps),
44
- React.createElement(Flex, { align: "center", gap: 10 },
45
- React.createElement(Text, null,
46
- t(translations.pagination.showRow).toString(),
47
- ":"),
48
- React.createElement(Select, { defaultValue: DEFAULT_PAGE_SIZE, value: pageSize, className: "show-row-select", options: paginationSizeOptions, popupMatchSelectWidth: 70, onChange: value => onChangePagination({ pageSize: value, page: 1 }) })),
49
- React.createElement(Text, null, `${total ? page * pageSize - pageSize + 1 : 0} - ${Math.min(page * pageSize, total)} of ${total}`),
50
- React.createElement(Flex, { align: "center", gap: 10 },
51
- React.createElement(ActionButton, { onClick: () => onChangePagination({ page: 1 }), disabled: disabledPrevious },
52
- React.createElement(Icon, { type: "icon-ants-first-page", size: 12 })),
53
- React.createElement(ActionButton, { disabled: disabledPrevious, onClick: () => onChangePagination({ page: page - 1 }) },
54
- React.createElement(Icon, { type: "icon-ants-angle-left", size: 12 })),
55
- React.createElement(ActionButton, { disabled: disabledNext, onClick: () => onChangePagination({ page: page + 1 }) },
56
- React.createElement(Icon, { type: "icon-ants-angle-right", size: 12 })),
57
- React.createElement(ActionButton, { onClick: () => onChangePagination({ page: Math.ceil(total / pageSize) }), disabled: disabledNext },
58
- React.createElement(Icon, { type: "icon-ants-last-page", size: 12 })))));
43
+ return (React.createElement(PaginationWrapper, Object.assign({ align: "center", justify: extraContent ? 'space-between' : 'flex-end', gap: 10 }, restProps),
44
+ extraContent,
45
+ React.createElement(Flex, { align: "center", gap: 10, style: { flexShrink: 0, height: 'fit-content', alignSelf: 'flex-end' } },
46
+ React.createElement(Flex, { align: "center", gap: 10 },
47
+ React.createElement(Text, null,
48
+ t(translations.pagination.showRow).toString(),
49
+ ":"),
50
+ React.createElement(Select, { defaultValue: DEFAULT_PAGE_SIZE, value: pageSize, className: "show-row-select", options: paginationSizeOptions, popupMatchSelectWidth: 70, onChange: value => onChangePagination({ pageSize: value, page: 1 }) })),
51
+ React.createElement(Text, null, `${total ? page * pageSize - pageSize + 1 : 0} - ${Math.min(page * pageSize, total)} of ${total}`),
52
+ React.createElement(Flex, { align: "center", gap: 10 },
53
+ React.createElement(ActionButton, { onClick: () => onChangePagination({ page: 1 }), disabled: disabledPrevious },
54
+ React.createElement(Icon, { type: "icon-ants-first-page", size: 12 })),
55
+ React.createElement(ActionButton, { disabled: disabledPrevious, onClick: () => onChangePagination({ page: page - 1 }) },
56
+ React.createElement(Icon, { type: "icon-ants-angle-left", size: 12 })),
57
+ React.createElement(ActionButton, { disabled: disabledNext, onClick: () => onChangePagination({ page: page + 1 }) },
58
+ React.createElement(Icon, { type: "icon-ants-angle-right", size: 12 })),
59
+ React.createElement(ActionButton, { onClick: () => onChangePagination({ page: Math.ceil(total / pageSize) }), disabled: disabledNext },
60
+ React.createElement(Icon, { type: "icon-ants-last-page", size: 12 }))))));
59
61
  };
@@ -5,7 +5,8 @@ import { Flex } from '@antscorp/antsomi-ui/es/components/atoms';
5
5
  // Constants
6
6
  import { globalToken } from '@antscorp/antsomi-ui/es/constants';
7
7
  export const PaginationWrapper = styled(Flex) `
8
- height: 60px;
8
+ flex-shrink: 0;
9
+ min-height: 40px;
9
10
 
10
11
  .show-row-select {
11
12
  width: 50px;
@@ -69,6 +69,10 @@ export const StyledTable = styled(Table) `
69
69
  .antsomi-table-cell[aria-resizable='true'] {
70
70
  border-inline-end: 2px solid ${blue1} !important;
71
71
  }
72
+
73
+ .antsomi-table-cell {
74
+ overflow: hidden;
75
+ }
72
76
  }
73
77
  }
74
78
 
@@ -9,11 +9,6 @@ export const DataTableWrapper = styled.div `
9
9
  position: relative;
10
10
  width: 100%;
11
11
  height: 100%;
12
-
13
- #data-table-pagination {
14
- margin-top: 5px;
15
- justify-content: flex-end;
16
- }
17
12
  `;
18
13
  export const IconButton = styled.div `
19
14
  width: 20px;
@@ -7,8 +7,10 @@ import { useGetDashboard, useGetDestinationChannel, useGetListMenu, useGetListMe
7
7
  import { useLeftMenuContext } from '../contexts';
8
8
  // Constants
9
9
  import { CDP_API, PERMISSION_API, POST_MESSAGE_TYPES } from '@antscorp/antsomi-ui/es/constants';
10
+ import { ENV } from '@antscorp/antsomi-ui/es/config';
10
11
  // Utils
11
12
  import { findLastMatchedItemByUrl, findPathOfActiveItem, flattenMenuArray, getMappingAppChildren, recursivePermissionMenu, } from '../utils';
13
+ const { DEV, SANDBOX, SANDBOX_CDP } = ENV;
12
14
  export const usePermission = () => {
13
15
  const appConfig = useLeftMenuContext(store => store.appConfig);
14
16
  const isCustomized = useLeftMenuContext(store => store.isCustomized);
@@ -21,11 +23,11 @@ export const usePermission = () => {
21
23
  args: {
22
24
  auth: {
23
25
  // token: '5474r2x214r2b4b4v2d4y444u2v5q2p5o4d4c4f424e4' || auth?.token,
24
- token: ['development', 'sandbox'].includes(env)
26
+ token: [DEV, SANDBOX, SANDBOX_CDP].includes(env)
25
27
  ? '5474r2x214r2b4b4v2d4y444u2v5q2p5o4d4c4f424e4'
26
28
  : auth === null || auth === void 0 ? void 0 : auth.token,
27
29
  // url: 'https://sandbox-permission.ants.vn',
28
- url: ['development', 'sandbox'].includes(env)
30
+ url: [DEV, SANDBOX, SANDBOX_CDP].includes(env)
29
31
  ? 'https://sandbox-permission.ants.vn'
30
32
  : permissionDomain || PERMISSION_API, // NOTE: Hard for sandbox, development
31
33
  portalId: auth === null || auth === void 0 ? void 0 : auth.portalId,
@@ -10,6 +10,7 @@ export type DataTableHeaderItem = {
10
10
  label: string;
11
11
  name: string;
12
12
  sortable: boolean;
13
+ isSort?: string;
13
14
  type: number;
14
15
  };
15
16
  export type DataTableColumnDefItem = {
@@ -304,10 +304,6 @@ export const GlobalStyle = () => {
304
304
  .antsomi-select-dropdown {
305
305
  padding: 8px 0 !important;
306
306
  z-index: 3002 !important;
307
-
308
- /* .antsomi-select-item:not(:last-child) {
309
- margin-bottom: 6px;
310
- } */
311
307
  }
312
308
 
313
309
  .antsomi-select-selection-overflow {
@@ -1,5 +1,6 @@
1
1
  import { DataTableColumnDefItem, DataTableHeaderItem } from '../models/DataTable/DataTableListing';
2
2
  export declare const mapColumnDefItemToGeneral: (columnDefItem: DataTableColumnDefItem) => DataTableHeaderItem;
3
+ export declare const mapColumnToGeneral: ({ sortable, isSort, ...restOfColumn }: DataTableHeaderItem) => DataTableHeaderItem;
3
4
  export declare const mapResponseListingToGeneral: (response: Record<string, any>) => {
4
5
  body: any;
5
6
  header: any;
@@ -1,3 +1,14 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
1
12
  export const mapColumnDefItemToGeneral = (columnDefItem) => ({
2
13
  editable: false,
3
14
  fixColumn: false,
@@ -6,13 +17,19 @@ export const mapColumnDefItemToGeneral = (columnDefItem) => ({
6
17
  sortable: !!parseInt(columnDefItem.enableSorting),
7
18
  type: parseInt(columnDefItem.type),
8
19
  });
20
+ export const mapColumnToGeneral = (_a) => {
21
+ var { sortable, isSort } = _a, restOfColumn = __rest(_a, ["sortable", "isSort"]);
22
+ return (Object.assign(Object.assign({}, restOfColumn), {
23
+ /** Convert isSort to boolean */
24
+ sortable: isSort === '1' ? true : sortable }));
25
+ };
9
26
  // NOTES: Improve typescript
10
27
  export const mapResponseListingToGeneral = (response) => {
11
28
  const { body, header, total, entries, column_defs, rows, total_records } = response || {};
12
29
  return {
13
30
  body: body || entries || rows || [],
14
- header: header ||
15
- column_defs.map(columnDefItem => mapColumnDefItemToGeneral(columnDefItem || {})) ||
31
+ header: (header === null || header === void 0 ? void 0 : header.map(col => mapColumnToGeneral(col || {}))) ||
32
+ (column_defs === null || column_defs === void 0 ? void 0 : column_defs.map(columnDefItem => mapColumnDefItemToGeneral(columnDefItem || {}))) ||
16
33
  [],
17
34
  total: total || total_records || 0,
18
35
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.5-beta.522",
3
+ "version": "1.3.5-beta.524",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",