@synerise/ds-table 0.57.6 → 0.58.0
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/CHANGELOG.md +11 -0
- package/dist/Cell/index.js +1 -2
- package/dist/Table.d.ts +5 -5
- package/dist/Table.js +29 -25
- package/dist/Table.styles.d.ts +12 -1
- package/dist/Table.styles.js +16 -3
- package/dist/Table.types.d.ts +6 -3
- package/dist/TableHeader/TableHeader.d.ts +1 -2
- package/dist/TableHeader/TableHeader.js +24 -35
- package/dist/TableHeader/TableHeader.types.d.ts +1 -0
- package/dist/TableHeader/TableLimit/TableLimit.d.ts +3 -3
- package/dist/TableHeader/TableLimit/TableLimit.js +4 -5
- package/dist/TableHeader/TableLimit/TableLimit.types.d.ts +6 -6
- package/dist/VirtualTable/VirtualTable.d.ts +6 -2
- package/dist/constants/TableSkeleton.constants.d.ts +20 -0
- package/dist/constants/TableSkeleton.constants.js +101 -0
- package/dist/style/index.css +1 -1
- package/dist/utils/getSkeletonProps.d.ts +7 -0
- package/dist/utils/getSkeletonProps.js +58 -0
- package/package.json +15 -15
- package/dist/TableSkeleton/TableSkeleton.d.ts +0 -3
- package/dist/TableSkeleton/TableSkeleton.js +0 -34
- package/dist/TableSkeleton/TableSkeleton.styles.d.ts +0 -20
- package/dist/TableSkeleton/TableSkeleton.styles.js +0 -58
- package/dist/TableSkeleton/TableSkeleton.types.d.ts +0 -7
- package/dist/TableSkeleton/TableSkeleton.types.js +0 -1
- package/dist/TableSkeleton/components/TableSkeletonBar.d.ts +0 -6
- package/dist/TableSkeleton/components/TableSkeletonBar.js +0 -19
- package/dist/TableSkeleton/components/TableSkeletonBody.d.ts +0 -7
- package/dist/TableSkeleton/components/TableSkeletonBody.js +0 -33
- package/dist/TableSkeleton/components/TableSkeletonHeader.d.ts +0 -4
- package/dist/TableSkeleton/components/TableSkeletonHeader.js +0 -15
- package/dist/TableSkeleton/components/TableSkeletonRowRight.d.ts +0 -2
- package/dist/TableSkeleton/components/TableSkeletonRowRight.js +0 -13
- package/dist/TableSkeleton/components/TableSkeletonSubheader.d.ts +0 -4
- package/dist/TableSkeleton/components/TableSkeletonSubheader.js +0 -10
- package/dist/TableSkeleton/components/index.d.ts +0 -5
- package/dist/TableSkeleton/components/index.js +0 -5
- package/dist/TableSkeleton/constants.d.ts +0 -9
- package/dist/TableSkeleton/constants.js +0 -9
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [0.58.0](https://github.com/synerise/synerise-design/compare/@synerise/ds-table@0.57.6...@synerise/ds-table@0.58.0) (2024-10-14)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **table:** render skeleton using columns ([c84ca2a](https://github.com/synerise/synerise-design/commit/c84ca2a8a8aea9d492c38802d9eb357039dccf2f))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [0.57.6](https://github.com/synerise/synerise-design/compare/@synerise/ds-table@0.57.5...@synerise/ds-table@0.57.6) (2024-10-09)
|
|
7
18
|
|
|
8
19
|
|
package/dist/Cell/index.js
CHANGED
|
@@ -8,6 +8,5 @@ import CopyableCell from './Copyable/CopyableCell';
|
|
|
8
8
|
import ActionCell from './Action/ActionCell';
|
|
9
9
|
import FlagLabelCell from './FlagLabel/FlagLabelCell';
|
|
10
10
|
import StarCell from './Star/StarCell';
|
|
11
|
-
import LabelsWithShowMore from './LabelsWithShowMore/LabelsWithShowMore';
|
|
12
|
-
|
|
11
|
+
import LabelsWithShowMore from './LabelsWithShowMore/LabelsWithShowMore';
|
|
13
12
|
export { IconLabelCell, IconTooltipCell, StatusLabelCell, AvatarLabelCell, TagIconCell, EditableCell, CopyableCell, ActionCell, FlagLabelCell, StarCell, LabelsWithShowMore };
|
package/dist/Table.d.ts
CHANGED
|
@@ -4,9 +4,9 @@ import './style/index.less';
|
|
|
4
4
|
import { DSTableProps } from './Table.types';
|
|
5
5
|
export declare const SELECTION_ALL = "SELECTION_ALL";
|
|
6
6
|
export declare const SELECTION_INVERT = "SELECTION_INVERT";
|
|
7
|
-
declare
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
7
|
+
declare const DSTable: {
|
|
8
|
+
<T extends object>(props: DSTableProps<T>): React.JSX.Element;
|
|
9
|
+
SELECTION_ALL: string;
|
|
10
|
+
SELECTION_INVERT: string;
|
|
11
|
+
};
|
|
12
12
|
export default DSTable;
|
package/dist/Table.js
CHANGED
|
@@ -6,10 +6,10 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
6
6
|
|
|
7
7
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
8
|
|
|
9
|
-
import React from 'react';
|
|
9
|
+
import React, { useCallback, useMemo } from 'react';
|
|
10
10
|
import { useIntl } from 'react-intl';
|
|
11
11
|
import '@synerise/ds-core/dist/js/style';
|
|
12
|
-
import Icon, { AngleLeftS, AngleRightS
|
|
12
|
+
import Icon, { AngleLeftS, AngleRightS } from '@synerise/ds-icon';
|
|
13
13
|
import Button from '@synerise/ds-button';
|
|
14
14
|
import Skeleton from '@synerise/ds-skeleton';
|
|
15
15
|
import { useDataFormat } from '@synerise/ds-data-format';
|
|
@@ -20,6 +20,7 @@ import DefaultTable from './DefaultTable/DefaultTable';
|
|
|
20
20
|
import GroupTable from './GroupTable/GroupTable';
|
|
21
21
|
import { useTableLocale, TableLocaleContext } from './utils/locale';
|
|
22
22
|
import { getChildrenColumnName } from './utils/getChildrenColumnName';
|
|
23
|
+
import { getSkeletonProps } from './utils/getSkeletonProps';
|
|
23
24
|
export var SELECTION_ALL = 'SELECTION_ALL';
|
|
24
25
|
export var SELECTION_INVERT = 'SELECTION_INVERT';
|
|
25
26
|
var ITEM_RENDER_TYPE = {
|
|
@@ -27,7 +28,7 @@ var ITEM_RENDER_TYPE = {
|
|
|
27
28
|
next: 'next'
|
|
28
29
|
};
|
|
29
30
|
|
|
30
|
-
function DSTable(props) {
|
|
31
|
+
var DSTable = function DSTable(props) {
|
|
31
32
|
var intl = useIntl();
|
|
32
33
|
var title = props.title,
|
|
33
34
|
loading = props.loading,
|
|
@@ -52,13 +53,15 @@ function DSTable(props) {
|
|
|
52
53
|
renderSelectionTitle = props.renderSelectionTitle,
|
|
53
54
|
hideTitlePart = props.hideTitlePart,
|
|
54
55
|
disableColumnNamesLineBreak = props.disableColumnNamesLineBreak,
|
|
55
|
-
expandable = props.expandable
|
|
56
|
+
expandable = props.expandable,
|
|
57
|
+
columns = props.columns,
|
|
58
|
+
skeletonProps = props.skeletonProps;
|
|
56
59
|
var tableLocale = useTableLocale(intl, locale);
|
|
57
60
|
|
|
58
61
|
var _useDataFormat = useDataFormat(),
|
|
59
62
|
formatValue = _useDataFormat.formatValue;
|
|
60
63
|
|
|
61
|
-
var renderHeader =
|
|
64
|
+
var renderHeader = useCallback(function () {
|
|
62
65
|
var size = selection && (selection == null ? void 0 : selection.selectedRowKeys) && (selection == null ? void 0 : selection.selectedRowKeys.length);
|
|
63
66
|
var data = grouped ? // @ts-ignore
|
|
64
67
|
dataSource == null ? void 0 : dataSource.reduce(function (items, group) {
|
|
@@ -86,10 +89,11 @@ function DSTable(props) {
|
|
|
86
89
|
locale: tableLocale,
|
|
87
90
|
renderSelectionTitle: renderSelectionTitle,
|
|
88
91
|
hideTitlePart: hideTitlePart,
|
|
89
|
-
childrenColumnName: getChildrenColumnName(expandable == null ? void 0 : expandable.childrenColumnName)
|
|
92
|
+
childrenColumnName: getChildrenColumnName(expandable == null ? void 0 : expandable.childrenColumnName),
|
|
93
|
+
isLoading: loading
|
|
90
94
|
});
|
|
91
|
-
}, [selection, grouped, dataSource, dataSourceTotalCount, hideTitleBar, headerWithBorderTop, title, filters, itemsMenu,
|
|
92
|
-
var footerPagination =
|
|
95
|
+
}, [selection, grouped, dataSource, dataSourceTotalCount, dataSourceFull, hideTitleBar, headerWithBorderTop, title, filters, itemsMenu, searchComponent, filterComponent, headerButton, rowKey, tableLocale, renderSelectionTitle, hideTitlePart, expandable == null ? void 0 : expandable.childrenColumnName, loading]);
|
|
96
|
+
var footerPagination = useMemo(function () {
|
|
93
97
|
return _objectSpread({
|
|
94
98
|
showTotal: function showTotal(total, range) {
|
|
95
99
|
var _tableLocale$paginati, _tableLocale$paginati2;
|
|
@@ -126,35 +130,35 @@ function DSTable(props) {
|
|
|
126
130
|
}
|
|
127
131
|
}, pagination);
|
|
128
132
|
}, [pagination, formatValue, grouped, tableLocale, hideTitlePart]);
|
|
133
|
+
var tableContent = useMemo(function () {
|
|
134
|
+
var extraProps = loading ? getSkeletonProps(skeletonProps, columns) : {
|
|
135
|
+
pagination: pagination ? footerPagination : false
|
|
136
|
+
};
|
|
137
|
+
return /*#__PURE__*/React.createElement(DefaultTable, _extends({
|
|
138
|
+
scroll: {
|
|
139
|
+
x: 'auto'
|
|
140
|
+
},
|
|
141
|
+
tableLayout: "auto"
|
|
142
|
+
}, props, {
|
|
143
|
+
locale: tableLocale,
|
|
144
|
+
title: renderHeader
|
|
145
|
+
}, extraProps));
|
|
146
|
+
}, [columns, footerPagination, loading, pagination, props, renderHeader, skeletonProps, tableLocale]);
|
|
129
147
|
return /*#__PURE__*/React.createElement(TableLocaleContext.Provider, {
|
|
130
148
|
value: tableLocale
|
|
131
149
|
}, /*#__PURE__*/React.createElement(S.TableWrapper, {
|
|
132
150
|
className: "ds-table ds-table-cell-size-" + cellSize + " " + (roundedHeader ? 'ds-table-rounded' : ''),
|
|
133
151
|
hideColumnNames: hideColumnNames,
|
|
134
152
|
disableColumnNamesLineBreak: disableColumnNamesLineBreak
|
|
135
|
-
}, loading &&
|
|
136
|
-
className: "spinner"
|
|
137
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
138
|
-
component: /*#__PURE__*/React.createElement(SpinnerM, null),
|
|
139
|
-
color: "#6a7580"
|
|
140
|
-
})), grouped && dataSource != null && dataSource.length ?
|
|
153
|
+
}, !loading && grouped && dataSource != null && dataSource.length ?
|
|
141
154
|
/*#__PURE__*/
|
|
142
155
|
// @ts-ignore
|
|
143
156
|
React.createElement(GroupTable, _extends({}, props, {
|
|
144
157
|
locale: tableLocale,
|
|
145
158
|
title: renderHeader,
|
|
146
159
|
pagination: dataSource != null && dataSource.length && pagination ? footerPagination : false
|
|
147
|
-
})) :
|
|
148
|
-
|
|
149
|
-
x: 'auto'
|
|
150
|
-
},
|
|
151
|
-
tableLayout: "auto"
|
|
152
|
-
}, props, {
|
|
153
|
-
locale: tableLocale,
|
|
154
|
-
title: renderHeader,
|
|
155
|
-
pagination: dataSource != null && dataSource.length && pagination ? footerPagination : false
|
|
156
|
-
}))));
|
|
157
|
-
}
|
|
160
|
+
})) : tableContent));
|
|
161
|
+
};
|
|
158
162
|
|
|
159
163
|
DSTable.SELECTION_ALL = SELECTION_ALL;
|
|
160
164
|
DSTable.SELECTION_INVERT = SELECTION_INVERT;
|
package/dist/Table.styles.d.ts
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import Menu from '@synerise/ds-menu';
|
|
2
3
|
export declare const Header: import("styled-components").StyledComponent<"div", any, {
|
|
3
4
|
withBorderTop?: boolean | undefined;
|
|
4
5
|
}, never>;
|
|
5
6
|
export declare const Size: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
6
7
|
export declare const TitleContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
7
|
-
export declare const TitlePartEllipsis: import("styled-components").StyledComponent<
|
|
8
|
+
export declare const TitlePartEllipsis: import("styled-components").StyledComponent<({ size, className, children, ellipsis }: {
|
|
9
|
+
size?: import("@synerise/ds-typography").TextSize | undefined;
|
|
10
|
+
ellipsis?: import("@synerise/ds-typography/dist/Ellipsis").EllipsisProps | undefined;
|
|
11
|
+
children?: import("react").ReactNode;
|
|
12
|
+
className?: string | undefined;
|
|
13
|
+
}) => import("react").JSX.Element, any, {}, never>;
|
|
8
14
|
export declare const TitlePart: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
9
15
|
export declare const TitleSeparator: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
10
16
|
export declare const Left: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -24,3 +30,8 @@ export declare const TableWrapper: import("styled-components").StyledComponent<"
|
|
|
24
30
|
hideColumnNames?: boolean | undefined;
|
|
25
31
|
disableColumnNamesLineBreak?: boolean | undefined;
|
|
26
32
|
}, never>;
|
|
33
|
+
export declare const Skeleton: import("styled-components").StyledComponent<({ size, numberOfSkeletons, width, height, className }: import("@synerise/ds-skeleton").SkeletonProps) => import("react").JSX.Element, any, {}, never>;
|
|
34
|
+
export declare const TableSkeletonCell: import("styled-components").StyledComponent<"div", any, {
|
|
35
|
+
height?: number | undefined;
|
|
36
|
+
width?: string | undefined;
|
|
37
|
+
}, never>;
|
package/dist/Table.styles.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import styled, { keyframes } from 'styled-components';
|
|
2
|
-
import { macro } from '@synerise/ds-typography';
|
|
2
|
+
import { macro, Text } from '@synerise/ds-typography';
|
|
3
3
|
import { CheckboxWrapper } from '@synerise/ds-checkbox/dist/Checkbox.styles';
|
|
4
4
|
import Menu from '@synerise/ds-menu';
|
|
5
5
|
import { IconContainer } from '@synerise/ds-icon';
|
|
6
|
+
import DSSkeleton from '@synerise/ds-skeleton';
|
|
6
7
|
export var Header = styled.div.withConfig({
|
|
7
8
|
displayName: "Tablestyles__Header",
|
|
8
9
|
componentId: "dacfhr-0"
|
|
@@ -21,10 +22,10 @@ export var TitleContainer = styled.div.withConfig({
|
|
|
21
22
|
})(["display:flex;max-width:100%;min-width:0;", ";color:", ";padding:0 24px 0 0;strong{font-weight:500;}"], macro.small, function (props) {
|
|
22
23
|
return props.theme.palette['grey-700'];
|
|
23
24
|
});
|
|
24
|
-
export var TitlePartEllipsis = styled.
|
|
25
|
+
export var TitlePartEllipsis = styled(Text).withConfig({
|
|
25
26
|
displayName: "Tablestyles__TitlePartEllipsis",
|
|
26
27
|
componentId: "dacfhr-3"
|
|
27
|
-
})(["
|
|
28
|
+
})(["font-weight:500;"]);
|
|
28
29
|
export var TitlePart = styled.span.withConfig({
|
|
29
30
|
displayName: "Tablestyles__TitlePart",
|
|
30
31
|
componentId: "dacfhr-4"
|
|
@@ -133,4 +134,16 @@ export var TableWrapper = styled.div.withConfig({
|
|
|
133
134
|
return theme.palette['blue-050'];
|
|
134
135
|
}, function (props) {
|
|
135
136
|
return props.disableColumnNamesLineBreak ? 'nowrap' : 'normal';
|
|
137
|
+
});
|
|
138
|
+
export var Skeleton = styled(DSSkeleton).withConfig({
|
|
139
|
+
displayName: "Tablestyles__Skeleton",
|
|
140
|
+
componentId: "dacfhr-15"
|
|
141
|
+
})(["padding:0;"]);
|
|
142
|
+
export var TableSkeletonCell = styled.div.withConfig({
|
|
143
|
+
displayName: "Tablestyles__TableSkeletonCell",
|
|
144
|
+
componentId: "dacfhr-16"
|
|
145
|
+
})(["display:flex;height:", ";width:", ";align-items:center;justify-content:flex-start;"], function (props) {
|
|
146
|
+
return props.height + "px" || 'auto';
|
|
147
|
+
}, function (props) {
|
|
148
|
+
return "" + props.width || '50%';
|
|
136
149
|
});
|
package/dist/Table.types.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ReactNode, ReactText, Ref } from 'react';
|
|
2
2
|
import { ColumnType, TableProps } from 'antd/lib/table';
|
|
3
3
|
import { TableLocale, TableRowSelection } from 'antd/lib/table/interface';
|
|
4
|
-
import { TableSkeletonProps } from 'TableSkeleton/TableSkeleton.types';
|
|
5
4
|
import { LiteralStringUnion } from '@synerise/ds-utils';
|
|
6
5
|
import DSTable from './Table';
|
|
7
6
|
import { GroupType } from './GroupTable/GroupTable.types';
|
|
@@ -127,7 +126,11 @@ export type DSTableProps<T extends any & GroupType<T>> = AntTableProps<T> & {
|
|
|
127
126
|
onSort?: OnSortFn;
|
|
128
127
|
dataSourceFull?: T[];
|
|
129
128
|
dataSourceTotalCount?: number;
|
|
130
|
-
|
|
131
|
-
|
|
129
|
+
skeletonProps?: {
|
|
130
|
+
maxHeight?: number;
|
|
131
|
+
headerHeight?: number;
|
|
132
|
+
subheaderHeight?: number;
|
|
133
|
+
cellHeight?: number;
|
|
134
|
+
};
|
|
132
135
|
};
|
|
133
136
|
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
declare const TableHeader: React.FC<Props>;
|
|
2
|
+
declare const TableHeader: ({ title, filters, searchComponent, filterComponent, selectedRows, itemsMenu, selection, dataSource, dataSourceFull, dataSourceTotalCount, rowKey, withBorderTop, headerButton, locale, renderSelectionTitle, hideTitlePart, childrenColumnName, isLoading, }: any) => React.JSX.Element;
|
|
4
3
|
export default TableHeader;
|
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import Tooltip from '@synerise/ds-tooltip';
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
3
2
|
import { useDataFormat } from '@synerise/ds-data-format';
|
|
4
3
|
import * as S from '../Table.styles';
|
|
5
4
|
import FilterTrigger from '../FilterTrigger/FilterTrigger';
|
|
6
5
|
import TableSelection from './TableSelection';
|
|
7
6
|
import { TableLimit } from './TableLimit';
|
|
8
7
|
|
|
9
|
-
var isTruncated = function isTruncated(element) {
|
|
10
|
-
return element && element.offsetWidth < element.scrollWidth;
|
|
11
|
-
}; // @ts-ignore
|
|
12
|
-
|
|
13
|
-
|
|
14
8
|
var TableHeader = function TableHeader(_ref) {
|
|
15
9
|
var title = _ref.title,
|
|
16
10
|
filters = _ref.filters,
|
|
@@ -28,25 +22,13 @@ var TableHeader = function TableHeader(_ref) {
|
|
|
28
22
|
locale = _ref.locale,
|
|
29
23
|
renderSelectionTitle = _ref.renderSelectionTitle,
|
|
30
24
|
hideTitlePart = _ref.hideTitlePart,
|
|
31
|
-
childrenColumnName = _ref.childrenColumnName
|
|
25
|
+
childrenColumnName = _ref.childrenColumnName,
|
|
26
|
+
isLoading = _ref.isLoading;
|
|
32
27
|
|
|
33
28
|
var _useDataFormat = useDataFormat(),
|
|
34
29
|
formatValue = _useDataFormat.formatValue;
|
|
35
30
|
|
|
36
|
-
var
|
|
37
|
-
|
|
38
|
-
var _React$useState = React.useState(false),
|
|
39
|
-
isTitleTruncated = _React$useState[0],
|
|
40
|
-
setIsTitleTruncated = _React$useState[1];
|
|
41
|
-
|
|
42
|
-
React.useEffect(function () {
|
|
43
|
-
var isElementTruncated = isTruncated(titleRef.current || undefined);
|
|
44
|
-
|
|
45
|
-
if (isElementTruncated !== undefined && isElementTruncated !== isTitleTruncated) {
|
|
46
|
-
setIsTitleTruncated(isElementTruncated);
|
|
47
|
-
}
|
|
48
|
-
}, [titleRef, isTitleTruncated, title]);
|
|
49
|
-
var renderLeftSide = React.useMemo(function () {
|
|
31
|
+
var renderLeftSide = useMemo(function () {
|
|
50
32
|
if (selection != null && selection.limit) return /*#__PURE__*/React.createElement(TableLimit, {
|
|
51
33
|
total: dataSourceTotalCount || dataSource.length,
|
|
52
34
|
selection: selection,
|
|
@@ -62,26 +44,33 @@ var TableHeader = function TableHeader(_ref) {
|
|
|
62
44
|
selection: selection,
|
|
63
45
|
locale: locale,
|
|
64
46
|
childrenColumnName: childrenColumnName
|
|
65
|
-
}), renderSelectionTitle ? renderSelectionTitle(selection, filters) : /*#__PURE__*/React.createElement(S.TitleContainer, null, /*#__PURE__*/React.createElement(S.TitlePart, null, /*#__PURE__*/React.createElement("strong", null, formatValue(selectedRows)), " ", /*#__PURE__*/React.createElement("span", null, locale.selected))), itemsMenu) : /*#__PURE__*/React.createElement(S.Left, {
|
|
47
|
+
}), renderSelectionTitle ? /*#__PURE__*/React.createElement(React.Fragment, null, renderSelectionTitle(selection, filters)) : /*#__PURE__*/React.createElement(S.TitleContainer, null, /*#__PURE__*/React.createElement(S.TitlePart, null, /*#__PURE__*/React.createElement("strong", null, formatValue(selectedRows)), " ", /*#__PURE__*/React.createElement("span", null, locale.selected))), itemsMenu) : /*#__PURE__*/React.createElement(S.Left, {
|
|
66
48
|
"data-testid": "ds-table-title"
|
|
67
|
-
}, selection && /*#__PURE__*/React.createElement(TableSelection, {
|
|
49
|
+
}, selection && !isLoading && /*#__PURE__*/React.createElement(TableSelection, {
|
|
68
50
|
rowKey: rowKey,
|
|
69
51
|
dataSource: dataSource,
|
|
70
52
|
dataSourceFull: dataSourceFull,
|
|
71
53
|
selection: selection,
|
|
72
54
|
locale: locale,
|
|
73
55
|
childrenColumnName: childrenColumnName
|
|
74
|
-
}), /*#__PURE__*/React.createElement(S.TitleContainer, null,
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}, title
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
56
|
+
}), /*#__PURE__*/React.createElement(S.TitleContainer, null, isLoading && /*#__PURE__*/React.createElement("div", {
|
|
57
|
+
style: {
|
|
58
|
+
width: '100px'
|
|
59
|
+
}
|
|
60
|
+
}, /*#__PURE__*/React.createElement(S.Skeleton, {
|
|
61
|
+
width: "L",
|
|
62
|
+
numberOfSkeletons: 1
|
|
63
|
+
})), !isLoading && title && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(S.TitlePartEllipsis, {
|
|
64
|
+
ellipsis: {
|
|
65
|
+
tooltipProps: {
|
|
66
|
+
description: title,
|
|
67
|
+
type: 'largeSimple',
|
|
68
|
+
offset: 'small',
|
|
69
|
+
autoAdjustOverflow: true
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}, title), !hideTitlePart && /*#__PURE__*/React.createElement(S.TitleSeparator, null)), !isLoading && !hideTitlePart && /*#__PURE__*/React.createElement(S.TitlePart, null, /*#__PURE__*/React.createElement("strong", null, formatValue(dataSourceTotalCount)), " ", /*#__PURE__*/React.createElement("span", null, locale.pagination.items))));
|
|
73
|
+
}, [selection, dataSourceTotalCount, dataSource, itemsMenu, locale, selectedRows, rowKey, dataSourceFull, childrenColumnName, renderSelectionTitle, filters, formatValue, title, hideTitlePart, isLoading]);
|
|
85
74
|
return /*#__PURE__*/React.createElement(S.Header, {
|
|
86
75
|
withBorderTop: withBorderTop
|
|
87
76
|
}, renderLeftSide, /*#__PURE__*/React.createElement(S.Right, null, headerButton, filters == null ? void 0 : filters.map(function (filter) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { ReactText } from 'react';
|
|
2
2
|
import { TableLimitProps } from './TableLimit.types';
|
|
3
3
|
export declare function TableLimit<T extends {
|
|
4
|
-
key:
|
|
4
|
+
key: ReactText;
|
|
5
5
|
children?: T[];
|
|
6
|
-
}>({ total, locale, itemsMenu, selection, }: TableLimitProps<T>): React.
|
|
6
|
+
}>({ total, locale, itemsMenu, selection, }: TableLimitProps<T>): React.JSX.Element;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
2
|
import Alert from '@synerise/ds-alert';
|
|
3
3
|
import { useDataFormat } from '@synerise/ds-data-format';
|
|
4
4
|
import * as S from './TableLimit.styles';
|
|
5
|
-
// eslint-disable-next-line import/prefer-default-export
|
|
6
5
|
export function TableLimit(_ref) {
|
|
7
6
|
var total = _ref.total,
|
|
8
7
|
locale = _ref.locale,
|
|
@@ -12,16 +11,16 @@ export function TableLimit(_ref) {
|
|
|
12
11
|
var _useDataFormat = useDataFormat(),
|
|
13
12
|
formatValue = _useDataFormat.formatValue;
|
|
14
13
|
|
|
15
|
-
var selectedRows =
|
|
14
|
+
var selectedRows = useMemo(function () {
|
|
16
15
|
return (selection == null ? void 0 : selection.selectedRowKeys.length) || 0;
|
|
17
16
|
}, [selection]);
|
|
18
|
-
var limitReachedInfo =
|
|
17
|
+
var limitReachedInfo = useMemo(function () {
|
|
19
18
|
return (selection == null ? void 0 : selection.limit) && (selection == null ? void 0 : selection.limit) <= selectedRows && /*#__PURE__*/React.createElement(S.Alert, null, /*#__PURE__*/React.createElement(Alert.InlineAlert, {
|
|
20
19
|
type: "warning",
|
|
21
20
|
message: locale.selectionLimitWarning
|
|
22
21
|
}));
|
|
23
22
|
}, [locale, selectedRows, selection]);
|
|
24
|
-
var selected =
|
|
23
|
+
var selected = useMemo(function () {
|
|
25
24
|
var _locale$pagination, _locale$pagination2;
|
|
26
25
|
|
|
27
26
|
return selectedRows > 0 ? /*#__PURE__*/React.createElement(S.Title, null, /*#__PURE__*/React.createElement("strong", null, formatValue(selectedRows)), " ", locale.selected, " /", ' ', formatValue(total) + " " + ((_locale$pagination = locale.pagination) == null ? void 0 : _locale$pagination.items)) : /*#__PURE__*/React.createElement(S.Title, null, /*#__PURE__*/React.createElement("strong", null, formatValue(total)), " ", (_locale$pagination2 = locale.pagination) == null ? void 0 : _locale$pagination2.items);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ReactNode, ReactText } from 'react';
|
|
2
2
|
import { Locale, RowSelection } from '../../Table.types';
|
|
3
|
-
export
|
|
4
|
-
key:
|
|
5
|
-
}> {
|
|
3
|
+
export type TableLimitProps<T extends {
|
|
4
|
+
key: ReactText;
|
|
5
|
+
}> = {
|
|
6
6
|
selection?: RowSelection<T>;
|
|
7
7
|
total: number;
|
|
8
|
-
itemsMenu:
|
|
8
|
+
itemsMenu: ReactNode;
|
|
9
9
|
locale: Locale;
|
|
10
|
-
}
|
|
10
|
+
};
|
|
@@ -35,8 +35,12 @@ declare const _default: <T extends object & RowType<T> & {
|
|
|
35
35
|
onSort?: import("../Table.types").OnSortFn | undefined;
|
|
36
36
|
dataSourceFull?: T[] | undefined;
|
|
37
37
|
dataSourceTotalCount?: number | undefined;
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
skeletonProps?: {
|
|
39
|
+
maxHeight?: number | undefined;
|
|
40
|
+
headerHeight?: number | undefined;
|
|
41
|
+
subheaderHeight?: number | undefined;
|
|
42
|
+
cellHeight?: number | undefined;
|
|
43
|
+
} | undefined;
|
|
40
44
|
} & {
|
|
41
45
|
cellHeight: number;
|
|
42
46
|
infiniteScroll?: import("../InfiniteScroll/InfiniteLoaderItem.types").InfiniteScrollProps | undefined;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const DEFAULT_ROW_COUNT = 10;
|
|
3
|
+
export declare const HEADER_HEIGHT = 73;
|
|
4
|
+
export declare const SUBHEADER_HEIGHT = 64;
|
|
5
|
+
export declare const ROW_HEIGHT = 73;
|
|
6
|
+
export declare const SKELETON_BAR_TINY = 16;
|
|
7
|
+
export declare const SKELETON_BAR_STANDARD = 72;
|
|
8
|
+
export declare const SKELETON_BAR_WIDE = 100;
|
|
9
|
+
export declare const SKELETON_BAR_EXTRA_WIDE = 164;
|
|
10
|
+
export declare const getDefaultSkeletonColumns: (height?: number) => ({
|
|
11
|
+
width: number;
|
|
12
|
+
title: React.JSX.Element;
|
|
13
|
+
render: () => React.JSX.Element;
|
|
14
|
+
minWidth?: undefined;
|
|
15
|
+
} | {
|
|
16
|
+
minWidth: number;
|
|
17
|
+
title: string;
|
|
18
|
+
render: () => React.JSX.Element;
|
|
19
|
+
width?: undefined;
|
|
20
|
+
})[];
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SkeletonAvatar } from '@synerise/ds-skeleton';
|
|
3
|
+
import * as S from '../Table.styles';
|
|
4
|
+
import { AvatarLabelCell } from '../Cell';
|
|
5
|
+
export var DEFAULT_ROW_COUNT = 10;
|
|
6
|
+
export var HEADER_HEIGHT = 73;
|
|
7
|
+
export var SUBHEADER_HEIGHT = 64;
|
|
8
|
+
export var ROW_HEIGHT = 73;
|
|
9
|
+
export var SKELETON_BAR_TINY = 16;
|
|
10
|
+
export var SKELETON_BAR_STANDARD = 72;
|
|
11
|
+
export var SKELETON_BAR_WIDE = 100;
|
|
12
|
+
export var SKELETON_BAR_EXTRA_WIDE = 164;
|
|
13
|
+
export var getDefaultSkeletonColumns = function getDefaultSkeletonColumns(height) {
|
|
14
|
+
if (height === void 0) {
|
|
15
|
+
height = ROW_HEIGHT;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return [{
|
|
19
|
+
width: 350,
|
|
20
|
+
title: /*#__PURE__*/React.createElement("div", {
|
|
21
|
+
style: {
|
|
22
|
+
width: '100px'
|
|
23
|
+
}
|
|
24
|
+
}, /*#__PURE__*/React.createElement(S.Skeleton, {
|
|
25
|
+
numberOfSkeletons: 1,
|
|
26
|
+
width: "M"
|
|
27
|
+
})),
|
|
28
|
+
render: function render() {
|
|
29
|
+
return /*#__PURE__*/React.createElement(S.TableSkeletonCell, {
|
|
30
|
+
width: "100%",
|
|
31
|
+
height: height
|
|
32
|
+
}, /*#__PURE__*/React.createElement(AvatarLabelCell, {
|
|
33
|
+
title: /*#__PURE__*/React.createElement("div", {
|
|
34
|
+
style: {
|
|
35
|
+
width: '100px'
|
|
36
|
+
}
|
|
37
|
+
}, /*#__PURE__*/React.createElement(S.Skeleton, {
|
|
38
|
+
numberOfSkeletons: 1,
|
|
39
|
+
width: "M"
|
|
40
|
+
})),
|
|
41
|
+
avatar: /*#__PURE__*/React.createElement(SkeletonAvatar, {
|
|
42
|
+
shape: "square",
|
|
43
|
+
size: "M"
|
|
44
|
+
})
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
}, {
|
|
48
|
+
minWidth: 100,
|
|
49
|
+
title: '',
|
|
50
|
+
render: function render() {
|
|
51
|
+
return /*#__PURE__*/React.createElement(S.TableSkeletonCell, {
|
|
52
|
+
height: height
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}, {
|
|
56
|
+
width: 120,
|
|
57
|
+
title: /*#__PURE__*/React.createElement(S.Skeleton, {
|
|
58
|
+
numberOfSkeletons: 1,
|
|
59
|
+
size: "M"
|
|
60
|
+
}),
|
|
61
|
+
render: function render() {
|
|
62
|
+
return /*#__PURE__*/React.createElement(S.TableSkeletonCell, {
|
|
63
|
+
width: "100%",
|
|
64
|
+
height: height
|
|
65
|
+
}, /*#__PURE__*/React.createElement(S.Skeleton, {
|
|
66
|
+
numberOfSkeletons: 1,
|
|
67
|
+
size: "M"
|
|
68
|
+
}));
|
|
69
|
+
}
|
|
70
|
+
}, {
|
|
71
|
+
width: 212,
|
|
72
|
+
title: /*#__PURE__*/React.createElement(S.Skeleton, {
|
|
73
|
+
numberOfSkeletons: 1,
|
|
74
|
+
size: "M"
|
|
75
|
+
}),
|
|
76
|
+
render: function render() {
|
|
77
|
+
return /*#__PURE__*/React.createElement(S.TableSkeletonCell, {
|
|
78
|
+
width: "100%",
|
|
79
|
+
height: height
|
|
80
|
+
}, /*#__PURE__*/React.createElement(S.Skeleton, {
|
|
81
|
+
numberOfSkeletons: 1,
|
|
82
|
+
size: "M"
|
|
83
|
+
}));
|
|
84
|
+
}
|
|
85
|
+
}, {
|
|
86
|
+
width: 120,
|
|
87
|
+
title: /*#__PURE__*/React.createElement(S.Skeleton, {
|
|
88
|
+
numberOfSkeletons: 1,
|
|
89
|
+
size: "M"
|
|
90
|
+
}),
|
|
91
|
+
render: function render() {
|
|
92
|
+
return /*#__PURE__*/React.createElement(S.TableSkeletonCell, {
|
|
93
|
+
width: "100%",
|
|
94
|
+
height: height
|
|
95
|
+
}, /*#__PURE__*/React.createElement(S.Skeleton, {
|
|
96
|
+
numberOfSkeletons: 1,
|
|
97
|
+
size: "M"
|
|
98
|
+
}));
|
|
99
|
+
}
|
|
100
|
+
}];
|
|
101
|
+
};
|