@antscorp/antsomi-ui 1.3.5-beta.419 → 1.3.5-beta.420
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/organism/DataTable/components/Table/ResizableCell.js +28 -8
- package/es/components/organism/DataTable/components/Table/index.js +2 -2
- package/es/components/organism/DataTable/constants/common.d.ts +5 -1
- package/es/components/organism/DataTable/constants/common.js +5 -1
- package/es/components/organism/DataTable/hooks/useDataTableListing/useDataTableListing.d.ts +2 -0
- package/es/components/organism/DataTable/hooks/useDataTableListing/useDataTableListing.js +17 -9
- package/es/components/organism/LeftMenu/components/common/ChildMenu/index.js +1 -25
- package/es/components/organism/LeftMenu/hooks/useLeftMenu.js +3 -4
- package/es/components/organism/LeftMenu/hooks/useNavigatePath.js +0 -1
- package/es/components/template/Layout/Layout.js +6 -5
- package/es/services/DataTable/index.d.ts +2 -0
- package/es/tests/DataTableTest.js +2 -1
- package/es/utils/index.d.ts +0 -1
- package/es/utils/index.js +0 -1
- package/package.json +1 -1
- package/es/utils/cookies.d.ts +0 -14
- package/es/utils/cookies.js +0 -33
|
@@ -13,17 +13,17 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
13
13
|
import React, { useMemo } from 'react';
|
|
14
14
|
import { Resizable } from 'react-resizable';
|
|
15
15
|
import { MIN_COLUMN_WIDTH } from '../../constants';
|
|
16
|
-
// Components
|
|
17
|
-
import { Typography } from '@antscorp/antsomi-ui/es/components/atoms';
|
|
18
16
|
export const ResizableCell = props => {
|
|
19
17
|
var _a;
|
|
20
|
-
const { width, handleProps, disableResize, children, style, fixed, index, tableRef, onResize, onResizeStop } = props, restProps = __rest(props, ["width", "handleProps", "disableResize", "children", "style", "fixed", "index", "tableRef", "onResize", "onResizeStop"]);
|
|
18
|
+
const { width, handleProps, disableResize, children, style, fixed, index, tableRef, onResize, onResizeStop, onClick = () => { } } = props, restProps = __rest(props, ["width", "handleProps", "disableResize", "children", "style", "fixed", "index", "tableRef", "onResize", "onResizeStop", "onClick"]);
|
|
19
|
+
// Ref
|
|
20
|
+
const isResizing = React.useRef(false);
|
|
21
21
|
// Memos
|
|
22
22
|
const columnStyle = useMemo(() => (Object.assign(Object.assign({}, style), { zIndex: fixed ? 100 - (index || 0) : undefined })), [style, fixed, index]);
|
|
23
|
+
const CellHeaderContent = children;
|
|
23
24
|
const isRowSelectionCol = (_a = props === null || props === void 0 ? void 0 : props.className) === null || _a === void 0 ? void 0 : _a.includes('antsomi-table-selection-column');
|
|
24
25
|
if (isRowSelectionCol || !width || disableResize) {
|
|
25
|
-
return (React.createElement("th", Object.assign({}, restProps, { style: columnStyle }),
|
|
26
|
-
React.createElement(Typography.Text, { ellipsis: { tooltip: true } }, children)));
|
|
26
|
+
return (React.createElement("th", Object.assign({}, restProps, { style: columnStyle, onClick: onClick }), CellHeaderContent));
|
|
27
27
|
}
|
|
28
28
|
const toggleCellClass = (className = 'resizable-cell') => {
|
|
29
29
|
var _a, _b;
|
|
@@ -37,8 +37,28 @@ export const ResizableCell = props => {
|
|
|
37
37
|
};
|
|
38
38
|
return (React.createElement(Resizable, { width: width || 0, height: 0, minConstraints: [MIN_COLUMN_WIDTH, 0], handle: React.createElement("div", { className: "resizable-handle-wrapper", onClick: e => {
|
|
39
39
|
e.stopPropagation();
|
|
40
|
+
},
|
|
41
|
+
// onMouseEnter={() => toggleCellClass()}
|
|
42
|
+
onMouseLeave: e => {
|
|
43
|
+
e.stopPropagation();
|
|
40
44
|
} },
|
|
41
|
-
React.createElement("span", Object.assign({ className: "resizable-handle" }, handleProps))), onResize: (...args) =>
|
|
42
|
-
|
|
43
|
-
|
|
45
|
+
React.createElement("span", Object.assign({ className: "resizable-handle" }, handleProps))), onResize: (...args) => {
|
|
46
|
+
if (onResize) {
|
|
47
|
+
onResize(...args);
|
|
48
|
+
}
|
|
49
|
+
}, onResizeStart: () => {
|
|
50
|
+
isResizing.current = true;
|
|
51
|
+
}, onResizeStop: (...args) => {
|
|
52
|
+
setTimeout(() => {
|
|
53
|
+
isResizing.current = false;
|
|
54
|
+
});
|
|
55
|
+
if (onResizeStop) {
|
|
56
|
+
onResizeStop(...args);
|
|
57
|
+
}
|
|
58
|
+
}, draggableOpts: { enableUserSelectHack: false } },
|
|
59
|
+
React.createElement("th", Object.assign({}, restProps, { style: columnStyle, onClick: e => {
|
|
60
|
+
if (!isResizing.current) {
|
|
61
|
+
onClick(e);
|
|
62
|
+
}
|
|
63
|
+
} }), CellHeaderContent)));
|
|
44
64
|
};
|
|
@@ -68,7 +68,7 @@ export const Table = memo(() => {
|
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
70
|
}, [(_a = tableProps.columns) === null || _a === void 0 ? void 0 : _a.map(col => col.width), columnWidths]);
|
|
71
|
-
return (React.createElement(StyledTable, Object.assign({}, tableProps, {
|
|
71
|
+
return (React.createElement(StyledTable, Object.assign({}, tableProps, { ref: ref => {
|
|
72
72
|
tableRef.current = ref === null || ref === void 0 ? void 0 : ref.nativeElement;
|
|
73
73
|
}, scroll: Object.assign(Object.assign({}, scroll), { y: (scroll === null || scroll === void 0 ? void 0 : scroll.y) || '500px', x: (scroll === null || scroll === void 0 ? void 0 : scroll.x) || '100%' }), components: {
|
|
74
74
|
header: Object.assign({ cell: ResizableCell }, (_b = tableProps === null || tableProps === void 0 ? void 0 : tableProps.components) === null || _b === void 0 ? void 0 : _b.header),
|
|
@@ -89,7 +89,7 @@ export const Table = memo(() => {
|
|
|
89
89
|
index,
|
|
90
90
|
onResize: onResize(index),
|
|
91
91
|
onResizeStop: onResizeStop(index),
|
|
92
|
-
}) }))), bordered: true, pagination: false, loading: {
|
|
92
|
+
}) }))), bordered: true, showSorterTooltip: false, sortDirections: ['descend', 'ascend'], pagination: false, loading: {
|
|
93
93
|
indicator: React.createElement(Spin, null),
|
|
94
94
|
spinning: !!tableProps.loading,
|
|
95
95
|
}, tableLayout: "fixed" })));
|
|
@@ -6,4 +6,8 @@ declare const DEFAULT_ROW_SELECTION_WIDTH = 47;
|
|
|
6
6
|
declare const DEFAULT_TOGGLE_WIDTH = 55;
|
|
7
7
|
declare const DEFAULT_COLUMN_WIDTHS: number[];
|
|
8
8
|
declare const DEFAULT_CELL_EMPTY = "--";
|
|
9
|
-
|
|
9
|
+
declare const SORT_MAP: {
|
|
10
|
+
ascend: string;
|
|
11
|
+
descend: string;
|
|
12
|
+
};
|
|
13
|
+
export { DATA_TABLE_DEFAULT_NAME, DATA_TABLE_PREFIX, DEFAULT_COLUMN_WIDTH, DEFAULT_ROW_SELECTION_WIDTH, MIN_COLUMN_WIDTH, DEFAULT_COLUMN_WIDTHS, DEFAULT_TOGGLE_WIDTH, DEFAULT_CELL_EMPTY, SORT_MAP, };
|
|
@@ -7,4 +7,8 @@ const DEFAULT_ROW_SELECTION_WIDTH = 47;
|
|
|
7
7
|
const DEFAULT_TOGGLE_WIDTH = 55;
|
|
8
8
|
const DEFAULT_COLUMN_WIDTHS = [DEFAULT_FIRST_COLUMN_WIDTH].concat(Array.from({ length: 20 }, () => DEFAULT_COLUMN_WIDTH));
|
|
9
9
|
const DEFAULT_CELL_EMPTY = '--';
|
|
10
|
-
|
|
10
|
+
const SORT_MAP = {
|
|
11
|
+
ascend: 'asc',
|
|
12
|
+
descend: 'desc',
|
|
13
|
+
};
|
|
14
|
+
export { DATA_TABLE_DEFAULT_NAME, DATA_TABLE_PREFIX, DEFAULT_COLUMN_WIDTH, DEFAULT_ROW_SELECTION_WIDTH, MIN_COLUMN_WIDTH, DEFAULT_COLUMN_WIDTHS, DEFAULT_TOGGLE_WIDTH, DEFAULT_CELL_EMPTY, SORT_MAP, };
|
|
@@ -3,6 +3,7 @@ import { useGetColumnMetrics, useGetFilterMetricList, useGetModifyColumnList, us
|
|
|
3
3
|
import { UseDataTableListingProps } from './types';
|
|
4
4
|
import { FilterItem, FilterProps, TColumnActionButton, TSearchActionButton, TableProps } from '../../types';
|
|
5
5
|
import { PaginationProps } from '../../components';
|
|
6
|
+
import { SorterResult } from 'antd/es/table/interface';
|
|
6
7
|
interface TUseDataTableListing<TTableType = any> {
|
|
7
8
|
modifyColumn: TColumnActionButton;
|
|
8
9
|
filter: FilterProps;
|
|
@@ -27,6 +28,7 @@ type TState<TTableType = any> = {
|
|
|
27
28
|
table: TableProps<TTableType>;
|
|
28
29
|
selectedRowKeys: React.Key[];
|
|
29
30
|
searchValue?: string;
|
|
31
|
+
sorter?: SorterResult<TTableType>;
|
|
30
32
|
};
|
|
31
33
|
export declare function useDataTableListing<TTableType = Record<string, any>, TSearchType = any>(props: UseDataTableListingProps<TTableType, TSearchType>): TUseDataTableListing<TTableType>;
|
|
32
34
|
export {};
|
|
@@ -29,7 +29,7 @@ import { Typography, Switch, Flex } from '@antscorp/antsomi-ui/es/components/ato
|
|
|
29
29
|
// Constants
|
|
30
30
|
import { COLUMN_DOMAIN, globalToken } from '@antscorp/antsomi-ui/es/constants';
|
|
31
31
|
import { MODIFY_COLUMN_DISABLE_EDITABLE, MODIFY_COLUMN_DISABLE_REMOVE, SAVED_FILTER_DEFAULT, TABLE_LISTING_PREFIX, } from './constants';
|
|
32
|
-
import { DEFAULT_CELL_EMPTY, DEFAULT_TOGGLE_WIDTH } from '../../constants';
|
|
32
|
+
import { DEFAULT_CELL_EMPTY, DEFAULT_TOGGLE_WIDTH, SORT_MAP } from '../../constants';
|
|
33
33
|
// Hooks
|
|
34
34
|
import { useDeepCompareEffect, useDeepCompareMemo } from '@antscorp/antsomi-ui/es/hooks';
|
|
35
35
|
import { useCreateModifyColumn, useDeleteModifyColumn, useDeleteSavedFilter, useGetColumnMetrics, useGetFilterMetricList, useGetModifyColumnList, useGetSavedFilterList, useGetSearchListing, useGetTableListing, useSaveFilter, useUpdateFilter, useUpdateModifyColumn, } from '@antscorp/antsomi-ui/es/queries';
|
|
@@ -52,6 +52,7 @@ const initialState = {
|
|
|
52
52
|
},
|
|
53
53
|
selectedRowKeys: [],
|
|
54
54
|
searchValue: '',
|
|
55
|
+
sorter: {},
|
|
55
56
|
};
|
|
56
57
|
export function useDataTableListing(props) {
|
|
57
58
|
// Props
|
|
@@ -67,7 +68,7 @@ export function useDataTableListing(props) {
|
|
|
67
68
|
const _b = apiFilter || {}, { url: filterUrl = `${COLUMN_DOMAIN[env || 'development']}/api/filter`, enabled: enabledApiFilter = true } = _b, restOfApiFilterRequest = __rest(_b, ["url", "enabled"]);
|
|
68
69
|
const _c = apiListing || {}, { url: listingUrl = '', enabled: enabledApiListing = true } = _c, restOfApiListingRequest = __rest(_c, ["url", "enabled"]);
|
|
69
70
|
const _d = apiSearch || {}, { url: searchUrl = '', enabled: enabledApiSearch = true } = _d, restOfApiSearchRequest = __rest(_d, ["url", "enabled"]);
|
|
70
|
-
const { filters, selectedFilterId, pagination, selectedRowKeys, searchValue, table } = state;
|
|
71
|
+
const { filters, selectedFilterId, pagination, selectedRowKeys, searchValue, table, sorter } = state;
|
|
71
72
|
const { externalFilters } = filterProps || {};
|
|
72
73
|
const modifyColumnAuth = Object.assign(Object.assign({}, auth), { url: columnUrl });
|
|
73
74
|
const filterAuth = Object.assign(Object.assign({}, auth), { url: filterUrl });
|
|
@@ -128,11 +129,11 @@ export function useDataTableListing(props) {
|
|
|
128
129
|
const getTableListing = useGetTableListing({
|
|
129
130
|
args: {
|
|
130
131
|
auth: listingAuth,
|
|
131
|
-
params: {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
},
|
|
132
|
+
params: Object.assign({ limit: pagination.pageSize, page: pagination.page, filter: JSON.stringify(mapFiltersToApiFilters([...(filters || []), ...(externalFilters || [])])) }, ((sorter === null || sorter === void 0 ? void 0 : sorter.order) &&
|
|
133
|
+
(sorter === null || sorter === void 0 ? void 0 : sorter.columnKey) && {
|
|
134
|
+
sort: sorter.columnKey.toString(),
|
|
135
|
+
az: SORT_MAP[sorter.order],
|
|
136
|
+
})),
|
|
136
137
|
request: restOfApiListingRequest,
|
|
137
138
|
},
|
|
138
139
|
options: {
|
|
@@ -246,8 +247,8 @@ export function useDataTableListing(props) {
|
|
|
246
247
|
} }));
|
|
247
248
|
}
|
|
248
249
|
data = data.concat((tableHeader === null || tableHeader === void 0 ? void 0 : tableHeader.map(headerCol => {
|
|
249
|
-
const { name, label, fixColumn } = headerCol;
|
|
250
|
-
return Object.assign(Object.assign({ key: name, dataIndex: name, title: label, fixed: fixColumn ? 'left' : undefined }, columns === null || columns === void 0 ? void 0 : columns[name]), { render(value, record, index) {
|
|
250
|
+
const { name, label, fixColumn, sortable } = headerCol;
|
|
251
|
+
return Object.assign(Object.assign({ key: name, dataIndex: name, title: label, fixed: fixColumn ? 'left' : undefined, sorter: !!sortable }, columns === null || columns === void 0 ? void 0 : columns[name]), { render(value, record, index) {
|
|
251
252
|
var _a;
|
|
252
253
|
const { link } = (columns === null || columns === void 0 ? void 0 : columns[name]) || {};
|
|
253
254
|
const RenderComponent = (React.createElement(Text, { ellipsis: { tooltip: true }, style: Object.assign({}, (link
|
|
@@ -439,6 +440,12 @@ export function useDataTableListing(props) {
|
|
|
439
440
|
}
|
|
440
441
|
return { success: !!status };
|
|
441
442
|
}), [deleteSavedFilter, handleUpdateFilter, mapObject, selectedFilterId]);
|
|
443
|
+
/* Table */
|
|
444
|
+
const onChangeTable = useCallback((_pagination, _filters, sorter, _extra) => {
|
|
445
|
+
if (sorter) {
|
|
446
|
+
setState(prev => (Object.assign(Object.assign({}, prev), { sorter })));
|
|
447
|
+
}
|
|
448
|
+
}, []);
|
|
442
449
|
/* Pagination */
|
|
443
450
|
const onChangePagination = useCallback(({ page, pageSize }) => {
|
|
444
451
|
handleUpdatePagination({
|
|
@@ -486,6 +493,7 @@ export function useDataTableListing(props) {
|
|
|
486
493
|
setState(prev => (Object.assign(Object.assign({}, prev), { selectedRowKeys })));
|
|
487
494
|
},
|
|
488
495
|
},
|
|
496
|
+
onChange: onChangeTable,
|
|
489
497
|
onColumnResize(data) {
|
|
490
498
|
const { index, width } = data;
|
|
491
499
|
handleUpdateTable({
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
// Libraries
|
|
2
|
-
import React, { memo,
|
|
2
|
+
import React, { memo, useState } from 'react';
|
|
3
3
|
import Icon from '@antscorp/icons';
|
|
4
4
|
import { isEmpty, isNil, uniq } from 'lodash';
|
|
5
5
|
import classNames from 'classnames';
|
|
6
6
|
import { Link } from 'react-router-dom';
|
|
7
|
-
import { Cookies } from 'react-cookie';
|
|
8
7
|
// Components
|
|
9
8
|
import { Dropdown, Menu } from 'antd';
|
|
10
9
|
import { MenuItemImage } from './components';
|
|
@@ -39,7 +38,6 @@ const styles = {
|
|
|
39
38
|
};
|
|
40
39
|
export const ChildMenu = memo(props => {
|
|
41
40
|
const { items = [], onMenuClick } = props;
|
|
42
|
-
const cookies = useMemo(() => new Cookies(), []);
|
|
43
41
|
const auth = useLeftMenuContext(store => { var _a; return (_a = store.appConfig) === null || _a === void 0 ? void 0 : _a.auth; });
|
|
44
42
|
const env = useLeftMenuContext(store => { var _a; return (_a = store.appConfig) === null || _a === void 0 ? void 0 : _a.env; });
|
|
45
43
|
const activeAppCode = useLeftMenuContext(store => store.activeAppCode);
|
|
@@ -47,34 +45,12 @@ export const ChildMenu = memo(props => {
|
|
|
47
45
|
const customItems = useLeftMenuContext(store => store.customItems);
|
|
48
46
|
const isCustomized = useLeftMenuContext(store => store.isCustomized);
|
|
49
47
|
const isRecommendation = useLeftMenuContext(store => store.isRecommendation);
|
|
50
|
-
const customActiveAppKey = useLeftMenuContext(store => store.customActiveAppKey);
|
|
51
48
|
const customActiveCurrentKey = useLeftMenuContext(store => store.customActiveCurrentKey);
|
|
52
49
|
const setLeftMenuState = useLeftMenuContext(store => store.setState);
|
|
53
|
-
const activeApp = useMemo(() => (isCustomized ? customActiveAppKey : activeAppCode), [activeAppCode, customActiveAppKey, isCustomized]);
|
|
54
|
-
// const leftMenuCookies = cookies.get('_leftmenu_state');
|
|
55
|
-
// const openMenuKeys = cookies.get('_leftmenu_state')?.openMenuKeys?.[activeApp] || [];
|
|
56
50
|
const [currentActiveItem, setCurrentActiveItem] = useState('');
|
|
57
51
|
const [openKeys, setOpenKeys] = useState([]);
|
|
58
52
|
const { pathname, hash } = window.location;
|
|
59
53
|
const { isPushDifferentDomain, getPath, navigatePath } = useNavigatePath();
|
|
60
|
-
// useLayoutEffect(() => {
|
|
61
|
-
// if (activeApp)
|
|
62
|
-
// cookies.set(
|
|
63
|
-
// '_leftmenu_state',
|
|
64
|
-
// {
|
|
65
|
-
// ...leftMenuCookies,
|
|
66
|
-
// openMenuKeys: {
|
|
67
|
-
// ...leftMenuCookies?.openMenuKeys,
|
|
68
|
-
// [activeApp]: uniq(openKeys?.filter(item => item !== activeApp)),
|
|
69
|
-
// },
|
|
70
|
-
// },
|
|
71
|
-
// {
|
|
72
|
-
// domain: 'antsomi.com',
|
|
73
|
-
// // domain: origin.split('.').slice(-2).join('.'),
|
|
74
|
-
// path: '/; samesite=None',
|
|
75
|
-
// },
|
|
76
|
-
// );
|
|
77
|
-
// }, [activeApp, cookies, leftMenuCookies, openKeys]);
|
|
78
54
|
useDeepCompareEffect(() => {
|
|
79
55
|
var _a;
|
|
80
56
|
switch (true) {
|
|
@@ -39,9 +39,8 @@ export const useLeftMenu = (props) => {
|
|
|
39
39
|
const setLeftMenuContextState = useLeftMenuContext(store => store.setState);
|
|
40
40
|
const { auth, env } = appConfig || {};
|
|
41
41
|
const timeoutPopover = useRef(null);
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
const isOpenMenu = !isNil(leftMenuCookies === null || leftMenuCookies === void 0 ? void 0 : leftMenuCookies.expand) ? leftMenuCookies === null || leftMenuCookies === void 0 ? void 0 : leftMenuCookies.expand : true;
|
|
42
|
+
const openLeftMenuCookies = cookies.get('_leftmenu_state');
|
|
43
|
+
const isOpenMenu = !isNil(openLeftMenuCookies) ? Boolean(openLeftMenuCookies) : true;
|
|
45
44
|
const [state, setState] = useState({
|
|
46
45
|
hoverItem: '',
|
|
47
46
|
isShowPopover: false,
|
|
@@ -63,7 +62,7 @@ export const useLeftMenu = (props) => {
|
|
|
63
62
|
secure: true,
|
|
64
63
|
});
|
|
65
64
|
}
|
|
66
|
-
}, [
|
|
65
|
+
}, [openLeftMenuCookies, origin, state.isExpandMenu]);
|
|
67
66
|
useDeepCompareEffect(() => {
|
|
68
67
|
setLeftMenuContextState({
|
|
69
68
|
appConfig,
|
|
@@ -47,7 +47,6 @@ export const useNavigatePath = () => {
|
|
|
47
47
|
}, [auth, searchParams]);
|
|
48
48
|
const navigatePath = useCallback((domain, path) => {
|
|
49
49
|
const newDomain = isNil(domain) || env === ENV.DEV ? '' : domain;
|
|
50
|
-
console.log({ name: 'navigatePath', path, domain });
|
|
51
50
|
window.location.assign(getGeneratePath(`${newDomain}${path}${searchParams}`, auth));
|
|
52
51
|
}, [auth, env, searchParams]);
|
|
53
52
|
return { isPushDifferentDomain, getPath, navigatePath };
|
|
@@ -11,8 +11,10 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
// Libraries
|
|
13
13
|
import React, { memo, useCallback, useMemo, useRef, useState } from 'react';
|
|
14
|
+
import { useContextSelector } from 'use-context-selector';
|
|
14
15
|
import AntsProcessingNotification from '@antscorp/processing-notification';
|
|
15
16
|
import { cloneDeep, merge, omit } from 'lodash';
|
|
17
|
+
import isEqual from 'react-fast-compare';
|
|
16
18
|
// Styled
|
|
17
19
|
import { ChildrenWrapper, ContentWrapper, LayoutWrapper, NotificationWrapper } from './styled';
|
|
18
20
|
// Components
|
|
@@ -20,7 +22,7 @@ import { LeftMenu } from '../../organism';
|
|
|
20
22
|
import { Flex } from '../../atoms';
|
|
21
23
|
import { HeaderV2 } from '../../molecules';
|
|
22
24
|
// Contexts
|
|
23
|
-
import {
|
|
25
|
+
import { AppConfigContext } from '../../..';
|
|
24
26
|
// Constants
|
|
25
27
|
import { APP_CODES, APP_IAM_DOMAIN, APP_PERMISSION_DOMAIN, IAM_API, PERMISSION_API, PORTALS_IDS, SOCKET_API, } from '../../../constants';
|
|
26
28
|
// Css
|
|
@@ -35,8 +37,8 @@ const { DATAFLOWS, APP_ANTALYSER } = APP_CODES;
|
|
|
35
37
|
export const Layout = memo(props => {
|
|
36
38
|
const { leftMenuProps, headerProps = {}, workspaceProps, contentWrapperProps, processingNotificationProps, children, onActiveMenuChange, } = props;
|
|
37
39
|
const _a = workspaceProps || {}, { workspaceContentProps } = _a, restOfWorkspaceProps = __rest(_a, ["workspaceContentProps"]);
|
|
38
|
-
const
|
|
39
|
-
const { auth, languageCode, appCode, permissionDomain: configPermissionDomain, iamDomain: configIamDomain, env, } = appConfig
|
|
40
|
+
const appConfig = useContextSelector(AppConfigContext, state => state);
|
|
41
|
+
const { auth, languageCode, appCode, permissionDomain: configPermissionDomain, iamDomain: configIamDomain, env, } = appConfig;
|
|
40
42
|
const { token, userId, portalId } = auth || {};
|
|
41
43
|
const leftMenu = useLayoutStore(store => store.state.leftMenu);
|
|
42
44
|
const header = useLayoutStore(store => store.state.header);
|
|
@@ -50,7 +52,6 @@ export const Layout = memo(props => {
|
|
|
50
52
|
// Hooks
|
|
51
53
|
useMutationObserver(() => {
|
|
52
54
|
if (notificationWrapperRef.current) {
|
|
53
|
-
console.log('dfjdsoifjdsoijoi');
|
|
54
55
|
const child = notificationWrapperRef.current.querySelector('div');
|
|
55
56
|
setNoSpaceTopContent(!!child);
|
|
56
57
|
}
|
|
@@ -138,4 +139,4 @@ export const Layout = memo(props => {
|
|
|
138
139
|
React.createElement(AntsProcessingNotification, Object.assign({}, antsProcessingNotificationConfig))),
|
|
139
140
|
React.createElement(ChildrenWrapper, Object.assign({}, workspaceContentProps),
|
|
140
141
|
React.createElement("div", null, children))))))));
|
|
141
|
-
});
|
|
142
|
+
}, (prevProps, nextProps) => isEqual(prevProps, nextProps));
|
|
@@ -6,6 +6,7 @@ import { DataTable } from '../components/organism/DataTable';
|
|
|
6
6
|
import { Popover } from '../components';
|
|
7
7
|
// Styled
|
|
8
8
|
import { TableTestWrapper } from './styled';
|
|
9
|
+
// Constants
|
|
9
10
|
import { random } from '../utils';
|
|
10
11
|
import { useDataTableListing } from '../components/organism/DataTable/hooks/useDataTableListing';
|
|
11
12
|
import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
|
|
@@ -140,7 +141,7 @@ export const DataTableTest = () => {
|
|
|
140
141
|
}, []);
|
|
141
142
|
return (React.createElement(BrowserRouter, null,
|
|
142
143
|
React.createElement(TableTestWrapper, null,
|
|
143
|
-
React.createElement(DataTable, { table: table, filter: Object.assign(Object.assign({}, filter), { actionButtons: {
|
|
144
|
+
React.createElement(DataTable, { table: Object.assign(Object.assign({}, table), { rowSelection: undefined }), filter: Object.assign(Object.assign({}, filter), { actionButtons: {
|
|
144
145
|
SAVE: {},
|
|
145
146
|
RESET: {},
|
|
146
147
|
} }), toolbar: {
|
package/es/utils/index.d.ts
CHANGED
package/es/utils/index.js
CHANGED
package/package.json
CHANGED
package/es/utils/cookies.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sets a cookie with the specified name, value, expiration days, and domain.
|
|
3
|
-
*
|
|
4
|
-
* @param {string} name - The name of the cookie.
|
|
5
|
-
* @param {any} value - The value to be stored in the cookie.
|
|
6
|
-
* @param {number} exdays - The number of days until the cookie expires.
|
|
7
|
-
* @param {string} domain - The domain associated with the cookie.
|
|
8
|
-
*/
|
|
9
|
-
export declare const setCookie: (args: {
|
|
10
|
-
name: string;
|
|
11
|
-
value: any;
|
|
12
|
-
exdays: number;
|
|
13
|
-
domain: string;
|
|
14
|
-
}) => void;
|
package/es/utils/cookies.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { get } from 'lodash';
|
|
2
|
-
// Utils
|
|
3
|
-
import { handleError } from './handleError';
|
|
4
|
-
const PATH = 'src/utils/cookies.ts';
|
|
5
|
-
/**
|
|
6
|
-
* Sets a cookie with the specified name, value, expiration days, and domain.
|
|
7
|
-
*
|
|
8
|
-
* @param {string} name - The name of the cookie.
|
|
9
|
-
* @param {any} value - The value to be stored in the cookie.
|
|
10
|
-
* @param {number} exdays - The number of days until the cookie expires.
|
|
11
|
-
* @param {string} domain - The domain associated with the cookie.
|
|
12
|
-
*/
|
|
13
|
-
export const setCookie = (args) => {
|
|
14
|
-
try {
|
|
15
|
-
const { name, value, exdays, domain } = args;
|
|
16
|
-
const { protocol = 'https:' } = get(window, 'location', '') || {};
|
|
17
|
-
const d = new Date();
|
|
18
|
-
d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1000);
|
|
19
|
-
if (protocol === 'https:') {
|
|
20
|
-
document.cookie = `${name}=${value}; Domain=${domain}; Path=/; Expires=${d.toUTCString()}; SameSite=None; Secure`;
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
document.cookie = `${name}=${value}; Domain=${domain}; Path=/; Expires=${d.toUTCString()};`;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
catch (error) {
|
|
27
|
-
handleError(error, {
|
|
28
|
-
path: PATH,
|
|
29
|
-
name: setCookie.name,
|
|
30
|
-
args,
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
};
|