@synerise/ds-table 1.9.10 → 1.9.12
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 +8 -0
- package/README.md +9 -10
- package/dist/Cell/Action/ActionCell.d.ts +2 -2
- package/dist/Cell/Action/ActionCell.js +15 -18
- package/dist/Cell/Action/ActionCell.styles.d.ts +2 -2
- package/dist/Cell/Action/ActionCell.styles.js +10 -11
- package/dist/Cell/Action/ActionCell.types.d.ts +2 -2
- package/dist/Cell/Action/ActionCell.types.js +1 -1
- package/dist/Cell/AvatarLabel/AvatarLabel.d.ts +2 -2
- package/dist/Cell/AvatarLabel/AvatarLabel.js +32 -43
- package/dist/Cell/AvatarLabel/AvatarLabel.styles.d.ts +13 -13
- package/dist/Cell/AvatarLabel/AvatarLabel.styles.js +27 -28
- package/dist/Cell/AvatarLabel/AvatarLabel.types.d.ts +2 -2
- package/dist/Cell/AvatarLabel/AvatarLabel.types.js +1 -1
- package/dist/Cell/Copyable/Copyable.styles.d.ts +2 -2
- package/dist/Cell/Copyable/Copyable.styles.js +9 -15
- package/dist/Cell/Copyable/Copyable.types.d.ts +1 -1
- package/dist/Cell/Copyable/Copyable.types.js +1 -1
- package/dist/Cell/Copyable/CopyableCell.d.ts +2 -2
- package/dist/Cell/Copyable/CopyableCell.js +23 -27
- package/dist/Cell/Editable/EditableCell.d.ts +2 -2
- package/dist/Cell/Editable/EditableCell.js +26 -39
- package/dist/Cell/Editable/EditableCell.styles.d.ts +2 -2
- package/dist/Cell/Editable/EditableCell.styles.js +9 -7
- package/dist/Cell/Editable/EditableCell.types.d.ts +1 -1
- package/dist/Cell/Editable/EditableCell.types.js +1 -1
- package/dist/Cell/FlagLabel/FlagLabelCell.d.ts +2 -2
- package/dist/Cell/FlagLabel/FlagLabelCell.js +15 -14
- package/dist/Cell/FlagLabel/FlagLabelCell.styles.d.ts +1 -1
- package/dist/Cell/FlagLabel/FlagLabelCell.styles.js +6 -3
- package/dist/Cell/FlagLabel/FlagLabelCell.types.d.ts +2 -2
- package/dist/Cell/FlagLabel/FlagLabelCell.types.js +1 -1
- package/dist/Cell/IconLabel/IconLabel.d.ts +2 -2
- package/dist/Cell/IconLabel/IconLabel.js +14 -15
- package/dist/Cell/IconLabel/IconLabel.styles.d.ts +1 -1
- package/dist/Cell/IconLabel/IconLabel.styles.js +7 -6
- package/dist/Cell/IconLabel/IconLabel.types.d.ts +3 -3
- package/dist/Cell/IconLabel/IconLabel.types.js +1 -1
- package/dist/Cell/IconTooltipCell/IconTooltipCell.d.ts +2 -2
- package/dist/Cell/IconTooltipCell/IconTooltipCell.js +18 -23
- package/dist/Cell/IconTooltipCell/IconTooltipCell.styles.d.ts +2 -2
- package/dist/Cell/IconTooltipCell/IconTooltipCell.styles.js +9 -11
- package/dist/Cell/IconTooltipCell/IconTooltipCell.types.d.ts +4 -4
- package/dist/Cell/IconTooltipCell/IconTooltipCell.types.js +1 -1
- package/dist/Cell/InputNumber/InputNumberCell.d.ts +2 -2
- package/dist/Cell/InputNumber/InputNumberCell.js +10 -17
- package/dist/Cell/InputNumber/InputNumberCell.styles.d.ts +1 -1
- package/dist/Cell/InputNumber/InputNumberCell.styles.js +9 -5
- package/dist/Cell/InputNumber/InputNumberCell.types.d.ts +2 -2
- package/dist/Cell/InputNumber/InputNumberCell.types.js +1 -1
- package/dist/Cell/LabelsWithShowMore/LabelsWithShowMore.d.ts +3 -3
- package/dist/Cell/LabelsWithShowMore/LabelsWithShowMore.js +29 -40
- package/dist/Cell/LabelsWithShowMore/LabelsWithShowMore.styles.d.ts +3 -3
- package/dist/Cell/LabelsWithShowMore/LabelsWithShowMore.styles.js +11 -8
- package/dist/Cell/LabelsWithShowMore/LabelsWithShowMore.types.d.ts +2 -2
- package/dist/Cell/LabelsWithShowMore/LabelsWithShowMore.types.js +1 -1
- package/dist/Cell/LabelsWithShowMore/Modal/Modal.d.ts +2 -2
- package/dist/Cell/LabelsWithShowMore/Modal/Modal.js +35 -64
- package/dist/Cell/LabelsWithShowMore/Modal/Modal.types.d.ts +3 -3
- package/dist/Cell/LabelsWithShowMore/Modal/Modal.types.js +1 -1
- package/dist/Cell/Star/StarCell.d.ts +45 -45
- package/dist/Cell/Star/StarCell.js +25 -31
- package/dist/Cell/Star/StarCell.styles.d.ts +2 -2
- package/dist/Cell/Star/StarCell.styles.js +11 -9
- package/dist/Cell/Star/StarCell.types.d.ts +2 -2
- package/dist/Cell/Star/StarCell.types.js +1 -1
- package/dist/Cell/StatusLabel/StatusLabel.d.ts +2 -2
- package/dist/Cell/StatusLabel/StatusLabel.js +17 -19
- package/dist/Cell/StatusLabel/StatusLabel.styles.d.ts +2 -2
- package/dist/Cell/StatusLabel/StatusLabel.styles.js +9 -9
- package/dist/Cell/StatusLabel/StatusLabel.types.d.ts +3 -3
- package/dist/Cell/StatusLabel/StatusLabel.types.js +1 -1
- package/dist/Cell/TagIcon/TagIcon.d.ts +2 -2
- package/dist/Cell/TagIcon/TagIcon.js +9 -13
- package/dist/Cell/TagIcon/TagIcon.styles.d.ts +1 -1
- package/dist/Cell/TagIcon/TagIcon.styles.js +7 -6
- package/dist/Cell/TagIcon/TagIcon.types.d.ts +2 -2
- package/dist/Cell/TagIcon/TagIcon.types.js +1 -1
- package/dist/Cell/TagsGroup/TagsGroup.d.ts +2 -2
- package/dist/Cell/TagsGroup/TagsGroup.js +22 -39
- package/dist/Cell/TagsGroup/TagsGroup.styles.d.ts +2 -2
- package/dist/Cell/TagsGroup/TagsGroup.styles.js +30 -9
- package/dist/Cell/TagsGroup/TagsGroup.types.d.ts +2 -2
- package/dist/Cell/TagsGroup/TagsGroup.types.js +1 -1
- package/dist/Cell/index.d.ts +12 -12
- package/dist/Cell/index.js +28 -14
- package/dist/ColumnSortMenu/SortIcons.d.ts +2 -2
- package/dist/ColumnSortMenu/SortIcons.js +26 -38
- package/dist/ColumnSortMenu/SortRender.styles.d.ts +34 -34
- package/dist/ColumnSortMenu/SortRender.styles.js +13 -10
- package/dist/ColumnSortMenu/SortRenderer.d.ts +2 -2
- package/dist/ColumnSortMenu/SortRenderer.js +74 -108
- package/dist/ColumnSortMenu/TitleWithSort.d.ts +2 -2
- package/dist/ColumnSortMenu/TitleWithSort.js +19 -16
- package/dist/ColumnSortMenu/columnWithSortButtons.d.ts +1 -2
- package/dist/ColumnSortMenu/columnWithSortButtons.js +26 -43
- package/dist/ColumnSortMenu/groupedColumnsSort.d.ts +3 -3
- package/dist/ColumnSortMenu/groupedColumnsSort.js +33 -28
- package/dist/ColumnSortMenu/replaceSortButtons.d.ts +1 -1
- package/dist/ColumnSortMenu/replaceSortButtons.js +14 -15
- package/dist/ColumnSortMenu/useSortState.d.ts +1 -1
- package/dist/ColumnSortMenu/useSortState.js +95 -93
- package/dist/DefaultTable/DefaultTable.d.ts +2 -2
- package/dist/DefaultTable/DefaultTable.js +147 -148
- package/dist/FilterTrigger/FilterTrigger.d.ts +2 -2
- package/dist/FilterTrigger/FilterTrigger.js +42 -67
- package/dist/FilterTrigger/FilterTrigger.styles.d.ts +53 -53
- package/dist/FilterTrigger/FilterTrigger.styles.js +19 -32
- package/dist/FilterTrigger/FilterTrigger.types.d.ts +1 -1
- package/dist/FilterTrigger/FilterTrigger.types.js +1 -1
- package/dist/GroupTable/GroupTable.d.ts +3 -4
- package/dist/GroupTable/GroupTable.js +97 -118
- package/dist/GroupTable/GroupTable.styles.d.ts +25 -25
- package/dist/GroupTable/GroupTable.styles.js +40 -37
- package/dist/GroupTable/GroupTable.types.d.ts +1 -1
- package/dist/GroupTable/GroupTable.types.js +9 -6
- package/dist/GroupTable/GroupTableBody/GroupTableBody.d.ts +1 -1
- package/dist/GroupTable/GroupTableBody/GroupTableBody.js +83 -107
- package/dist/GroupTable/GroupTableBody/GroupTableBody.types.d.ts +3 -3
- package/dist/GroupTable/GroupTableBody/GroupTableBody.types.js +1 -1
- package/dist/GroupTable/GroupTableHeader/GroupTableHeader.d.ts +1 -1
- package/dist/GroupTable/GroupTableHeader/GroupTableHeader.js +25 -28
- package/dist/GroupTable/GroupTableHeader/GroupTableHeader.types.js +1 -1
- package/dist/InfiniteScroll/BackToTopButton.d.ts +2 -2
- package/dist/InfiniteScroll/BackToTopButton.js +7 -15
- package/dist/InfiniteScroll/BackToTopButton.styles.d.ts +34 -34
- package/dist/InfiniteScroll/BackToTopButton.styles.js +11 -9
- package/dist/InfiniteScroll/ErrorItem.d.ts +1 -1
- package/dist/InfiniteScroll/ErrorItem.js +19 -23
- package/dist/InfiniteScroll/ErrorItem.styles.d.ts +1 -1
- package/dist/InfiniteScroll/ErrorItem.styles.js +6 -3
- package/dist/InfiniteScroll/InfiniteLoaderItem.d.ts +2 -2
- package/dist/InfiniteScroll/InfiniteLoaderItem.js +33 -28
- package/dist/InfiniteScroll/InfiniteLoaderItem.styles.d.ts +1 -1
- package/dist/InfiniteScroll/InfiniteLoaderItem.styles.js +7 -4
- package/dist/InfiniteScroll/InfiniteLoaderItem.types.d.ts +1 -1
- package/dist/InfiniteScroll/InfiniteLoaderItem.types.js +1 -1
- package/dist/InfiniteScroll/LoadingItem.d.ts +1 -1
- package/dist/InfiniteScroll/LoadingItem.js +10 -10
- package/dist/InfiniteScroll/NoMoreItem.d.ts +1 -1
- package/dist/InfiniteScroll/NoMoreItem.js +10 -10
- package/dist/InfiniteScroll/OuterListElement.d.ts +1 -1
- package/dist/InfiniteScroll/OuterListElement.js +45 -58
- package/dist/InfiniteScroll/constants.js +4 -1
- package/dist/InfiniteScroll/utils.d.ts +1 -1
- package/dist/InfiniteScroll/utils.js +15 -12
- package/dist/ItemsMenu/ItemsMenu.d.ts +2 -2
- package/dist/ItemsMenu/ItemsMenu.js +7 -6
- package/dist/ItemsMenu/ItemsMenu.styles.d.ts +1 -1
- package/dist/ItemsMenu/ItemsMenu.styles.js +6 -3
- package/dist/ItemsMenu/ItemsMenu.types.d.ts +1 -1
- package/dist/ItemsMenu/ItemsMenu.types.js +1 -1
- package/dist/RowSelection/RowSelectionColumn.d.ts +3 -3
- package/dist/RowSelection/RowSelectionColumn.js +77 -81
- package/dist/RowSelection/RowSelectionColumn.types.d.ts +3 -3
- package/dist/RowSelection/RowSelectionColumn.types.js +1 -1
- package/dist/RowSelection/index.js +4 -1
- package/dist/Table.d.ts +2 -4
- package/dist/Table.js +94 -129
- package/dist/Table.styles.d.ts +23 -23
- package/dist/Table.styles.js +86 -110
- package/dist/Table.types.d.ts +7 -7
- package/dist/Table.types.js +1 -1
- package/dist/TableHeader/TableHeader.d.ts +2 -2
- package/dist/TableHeader/TableHeader.js +91 -129
- package/dist/TableHeader/TableHeader.types.d.ts +2 -2
- package/dist/TableHeader/TableHeader.types.js +1 -1
- package/dist/TableHeader/TableLimit/TableLimit.d.ts +2 -2
- package/dist/TableHeader/TableLimit/TableLimit.js +44 -36
- package/dist/TableHeader/TableLimit/TableLimit.styles.d.ts +4 -4
- package/dist/TableHeader/TableLimit/TableLimit.styles.js +15 -13
- package/dist/TableHeader/TableLimit/TableLimit.types.d.ts +3 -3
- package/dist/TableHeader/TableLimit/TableLimit.types.js +1 -1
- package/dist/TableHeader/TableLimit/index.js +4 -2
- package/dist/TableHeader/TableSelection.d.ts +2 -2
- package/dist/TableHeader/TableSelection.js +163 -180
- package/dist/TableHeader/TableSelection.types.d.ts +1 -1
- package/dist/TableHeader/TableSelection.types.js +1 -1
- package/dist/TreeTable/TreeTable.d.ts +2 -3
- package/dist/TreeTable/TreeTable.js +51 -78
- package/dist/TreeTable/TreeTable.styles.d.ts +5 -5
- package/dist/TreeTable/TreeTable.styles.js +21 -20
- package/dist/VirtualTable/VirtualTable.d.ts +3 -3
- package/dist/VirtualTable/VirtualTable.js +342 -411
- package/dist/VirtualTable/VirtualTable.styles.d.ts +8 -8
- package/dist/VirtualTable/VirtualTable.styles.js +30 -40
- package/dist/VirtualTable/VirtualTable.types.d.ts +4 -4
- package/dist/VirtualTable/VirtualTable.types.js +1 -1
- package/dist/VirtualTable/VirtualTableRow.d.ts +4 -4
- package/dist/VirtualTable/VirtualTableRow.js +103 -111
- package/dist/VirtualTable/constants.js +8 -3
- package/dist/assets/style/index-tn0RQdqM.css +0 -0
- package/dist/constants/Table.constants.js +11 -6
- package/dist/constants/TableSkeleton.constants.d.ts +1 -1
- package/dist/constants/TableSkeleton.constants.js +48 -100
- package/dist/hooks/useBulkSelection/index.js +4 -1
- package/dist/hooks/useBulkSelection/useBulkSelection.d.ts +1 -1
- package/dist/hooks/useBulkSelection/useBulkSelection.js +55 -40
- package/dist/hooks/useRowKey/index.js +4 -1
- package/dist/hooks/useRowKey/useRowKey.js +11 -11
- package/dist/hooks/useRowStar/index.js +4 -2
- package/dist/hooks/useRowStar/useRowStar.d.ts +1 -1
- package/dist/hooks/useRowStar/useRowStar.js +54 -62
- package/dist/hooks/useRowStar/useRowStar.types.d.ts +2 -2
- package/dist/hooks/useRowStar/useRowStar.types.js +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +18 -9
- package/dist/modules.d.js +1 -1
- package/dist/modules.d.ts +0 -0
- package/dist/utils/calculateColumnWidths.d.ts +1 -1
- package/dist/utils/calculateColumnWidths.js +17 -16
- package/dist/utils/calculatePixels.js +11 -12
- package/dist/utils/columnWithCellTooltip.d.ts +1 -1
- package/dist/utils/columnWithCellTooltip.js +18 -15
- package/dist/utils/getChildrenColumnName.js +6 -3
- package/dist/utils/getRecordSelectionStatus.d.ts +1 -1
- package/dist/utils/getRecordSelectionStatus.js +11 -7
- package/dist/utils/getSkeletonProps.d.ts +1 -1
- package/dist/utils/getSkeletonProps.js +26 -36
- package/dist/utils/getValueFromPath.js +9 -6
- package/dist/utils/index.js +23 -9
- package/dist/utils/isGrouped.d.ts +1 -1
- package/dist/utils/isGrouped.js +6 -3
- package/dist/utils/isRecordSelectable.d.ts +1 -1
- package/dist/utils/isRecordSelectable.js +10 -6
- package/dist/utils/locale.d.ts +3 -3
- package/dist/utils/locale.js +115 -111
- package/package.json +31 -31
- package/dist/Cell/TagsGroup/TagsGroup.spec.d.ts +0 -1
- package/dist/ColumnSortMenu/__spec__/groupedColumnsSort.spec.d.ts +0 -1
- package/dist/VirtualTable/VirtualTable.spec.d.ts +0 -1
- package/dist/utils/__specs__/getValueFromPath.spec.d.ts +0 -1
|
@@ -1,44 +1,31 @@
|
|
|
1
|
-
import styled, { css } from
|
|
2
|
-
import Button from
|
|
3
|
-
import ButtonGroup from
|
|
4
|
-
import { IconContainer } from
|
|
5
|
-
|
|
1
|
+
import styled, { css } from "styled-components";
|
|
2
|
+
import Button from "@synerise/ds-button";
|
|
3
|
+
import ButtonGroup from "@synerise/ds-button-group";
|
|
4
|
+
import { IconContainer } from "@synerise/ds-icon";
|
|
5
|
+
const FilterButtonGroup = /* @__PURE__ */ styled(ButtonGroup).withConfig({
|
|
6
6
|
displayName: "FilterTriggerstyles__FilterButtonGroup",
|
|
7
7
|
componentId: "sc-1h4wcrp-0"
|
|
8
8
|
})([".ant-btn-group{width:auto;}"]);
|
|
9
|
-
|
|
9
|
+
const FilterButtonLabel = /* @__PURE__ */ styled.span.withConfig({
|
|
10
10
|
displayName: "FilterTriggerstyles__FilterButtonLabel",
|
|
11
11
|
componentId: "sc-1h4wcrp-1"
|
|
12
12
|
})(["width:100%;max-width:0;overflow:hidden;margin-right:0;"]);
|
|
13
|
-
|
|
13
|
+
const FilterButton = /* @__PURE__ */ styled(Button).withConfig({
|
|
14
14
|
displayName: "FilterTriggerstyles__FilterButton",
|
|
15
15
|
componentId: "sc-1h4wcrp-2"
|
|
16
|
-
})(["&&&{&:focus{.btn-focus{box-shadow:none;}}&:hover{color:", ";span{color:", ";}", "{svg{fill:", " !important;}}}}", " ", ""],
|
|
17
|
-
|
|
18
|
-
}, function (props) {
|
|
19
|
-
return props.theme.palette['blue-600'];
|
|
20
|
-
}, IconContainer, function (props) {
|
|
21
|
-
return props.theme.palette['blue-600'];
|
|
22
|
-
}, function (props) {
|
|
23
|
-
return props.opened && css(["", "{transition:all 0.3s ease;transition-property:width,max-width,margin-right;max-width:100%;}"], FilterButtonLabel);
|
|
24
|
-
}, function (props) {
|
|
25
|
-
return Boolean(props.selected) && css(["", "{margin-right:20px;}"], FilterButtonLabel);
|
|
26
|
-
});
|
|
27
|
-
export var ClearButton = styled(Button).withConfig({
|
|
16
|
+
})(["&&&{&:focus{.btn-focus{box-shadow:none;}}&:hover{color:", ";span{color:", ";}", "{svg{fill:", " !important;}}}}", " ", ""], (props) => props.theme.palette["blue-600"], (props) => props.theme.palette["blue-600"], IconContainer, (props) => props.theme.palette["blue-600"], (props) => props.opened && css(["", "{transition:all 0.3s ease;transition-property:width,max-width,margin-right;max-width:100%;}"], FilterButtonLabel), (props) => Boolean(props.selected) && css(["", "{margin-right:20px;}"], FilterButtonLabel));
|
|
17
|
+
const ClearButton = /* @__PURE__ */ styled(Button).withConfig({
|
|
28
18
|
displayName: "FilterTriggerstyles__ClearButton",
|
|
29
19
|
componentId: "sc-1h4wcrp-3"
|
|
30
|
-
})(["&&&{border-left:0 !important;position:absolute;right:32px;background:none;z-index:2;", "{svg{fill:", " !important;color:", ";}}&:hover{background:none;", "{svg{fill:", ";color:", ";}}}&:focus{.btn-focus{box-shadow:none;}}}"], IconContainer,
|
|
31
|
-
|
|
32
|
-
}, function (props) {
|
|
33
|
-
return props.theme.palette['red-600'];
|
|
34
|
-
}, IconContainer, function (props) {
|
|
35
|
-
return props.theme.palette['red-600'];
|
|
36
|
-
}, function (props) {
|
|
37
|
-
return props.theme.palette['red-600'];
|
|
38
|
-
});
|
|
39
|
-
export var ListButton = styled(Button).withConfig({
|
|
20
|
+
})(["&&&{border-left:0 !important;position:absolute;right:32px;background:none;z-index:2;", "{svg{fill:", " !important;color:", ";}}&:hover{background:none;", "{svg{fill:", ";color:", ";}}}&:focus{.btn-focus{box-shadow:none;}}}"], IconContainer, (props) => props.theme.palette["red-600"], (props) => props.theme.palette["red-600"], IconContainer, (props) => props.theme.palette["red-600"], (props) => props.theme.palette["red-600"]);
|
|
21
|
+
const ListButton = /* @__PURE__ */ styled(Button).withConfig({
|
|
40
22
|
displayName: "FilterTriggerstyles__ListButton",
|
|
41
23
|
componentId: "sc-1h4wcrp-4"
|
|
42
|
-
})(["&&&{&:hover{", "{svg{fill:", " !important;}}}}"], IconContainer,
|
|
43
|
-
|
|
44
|
-
|
|
24
|
+
})(["&&&{&:hover{", "{svg{fill:", " !important;}}}}"], IconContainer, (props) => props.theme.palette["blue-600"]);
|
|
25
|
+
export {
|
|
26
|
+
ClearButton,
|
|
27
|
+
FilterButton,
|
|
28
|
+
FilterButtonGroup,
|
|
29
|
+
FilterButtonLabel,
|
|
30
|
+
ListButton
|
|
31
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import '
|
|
4
|
-
import { type GroupType } from './GroupTable.types';
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { DSTableProps } from '../Table.types';
|
|
3
|
+
import { GroupType } from './GroupTable.types';
|
|
5
4
|
declare function GroupTable<T extends GroupType<T>>(props: DSTableProps<T> & {
|
|
6
5
|
addItem?: (column: string, value: React.ReactText | boolean | object) => void;
|
|
7
6
|
hideGroupExpander?: boolean;
|
|
@@ -1,136 +1,115 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
var addSortClassByState = function addSortClassByState(sortStateApi) {
|
|
29
|
-
return function (column) {
|
|
30
|
-
return sortStateApi.getColumnSortOrder(String(column.key)) ? _extends({}, column, {
|
|
31
|
-
onHeaderCell: function onHeaderCell() {
|
|
32
|
-
return {
|
|
33
|
-
className: 'ant-table-column-sort'
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
}) : column;
|
|
37
|
-
};
|
|
38
|
-
};
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import Table from "antd/lib/table";
|
|
3
|
+
import flow from "lodash.flow";
|
|
4
|
+
import React from "react";
|
|
5
|
+
import { columnWithSortButtons } from "../ColumnSortMenu/columnWithSortButtons.js";
|
|
6
|
+
import { getColumnsWithActiveSorting, sortDataSourceRows } from "../ColumnSortMenu/groupedColumnsSort.js";
|
|
7
|
+
import useSortState, { columnsToSortState } from "../ColumnSortMenu/useSortState.js";
|
|
8
|
+
import GroupTableBody from "./GroupTableBody/GroupTableBody.js";
|
|
9
|
+
import "./../style/index.css";
|
|
10
|
+
const addActiveColumnClass = (activeColumn) => (column) => column.key === activeColumn ? {
|
|
11
|
+
...column,
|
|
12
|
+
onHeaderCell: () => ({
|
|
13
|
+
className: "ds-table-active-column"
|
|
14
|
+
})
|
|
15
|
+
} : column;
|
|
16
|
+
const clearDefaultColumnSortOrder = (column) => ({
|
|
17
|
+
...column,
|
|
18
|
+
sortOrder: null
|
|
19
|
+
});
|
|
20
|
+
const addSortClassByState = (sortStateApi) => (column) => sortStateApi.getColumnSortOrder(String(column.key)) ? {
|
|
21
|
+
...column,
|
|
22
|
+
onHeaderCell: () => ({
|
|
23
|
+
className: "ant-table-column-sort"
|
|
24
|
+
})
|
|
25
|
+
} : column;
|
|
39
26
|
function GroupTable(props) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
var _React$useState2 = React.useState(dataSource || []),
|
|
57
|
-
data = _React$useState2[0],
|
|
58
|
-
setData = _React$useState2[1];
|
|
59
|
-
React.useEffect(function () {
|
|
27
|
+
const {
|
|
28
|
+
selection,
|
|
29
|
+
rowKey,
|
|
30
|
+
dataSource,
|
|
31
|
+
columns,
|
|
32
|
+
cellSize,
|
|
33
|
+
roundedHeader,
|
|
34
|
+
addItem,
|
|
35
|
+
hideGroupExpander,
|
|
36
|
+
initialGroupsCollapsed,
|
|
37
|
+
onSort
|
|
38
|
+
} = props;
|
|
39
|
+
const [expandedGroups, setExpandedGroups] = React.useState(initialGroupsCollapsed || !dataSource ? [] : dataSource.map((group) => group.key));
|
|
40
|
+
const sortStateApi = useSortState(columnsToSortState(columns), onSort);
|
|
41
|
+
const [data, setData] = React.useState(dataSource || []);
|
|
42
|
+
React.useEffect(() => {
|
|
60
43
|
setData(dataSource || []);
|
|
61
|
-
setExpandedGroups(initialGroupsCollapsed || !dataSource ? [] : dataSource.map(
|
|
62
|
-
return group.key;
|
|
63
|
-
}));
|
|
44
|
+
setExpandedGroups(initialGroupsCollapsed || !dataSource ? [] : dataSource.map((group) => group.key));
|
|
64
45
|
}, [dataSource, initialGroupsCollapsed]);
|
|
65
|
-
|
|
46
|
+
const toggleExpand = React.useCallback((groupKey) => {
|
|
66
47
|
if (expandedGroups.indexOf(groupKey) >= 0) {
|
|
67
|
-
setExpandedGroups(expandedGroups.filter(
|
|
68
|
-
return key !== groupKey;
|
|
69
|
-
}));
|
|
48
|
+
setExpandedGroups(expandedGroups.filter((key) => key !== groupKey));
|
|
70
49
|
} else {
|
|
71
|
-
setExpandedGroups([
|
|
50
|
+
setExpandedGroups([...expandedGroups, groupKey]);
|
|
72
51
|
}
|
|
73
52
|
}, [expandedGroups, setExpandedGroups]);
|
|
74
|
-
|
|
75
|
-
return data
|
|
53
|
+
const activeColumn = React.useMemo(() => {
|
|
54
|
+
return data?.length ? data[0].column : void 0;
|
|
76
55
|
}, [data]);
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
dataSource && dataSource.forEach(
|
|
80
|
-
return group.rows.forEach(function (row) {
|
|
81
|
-
return result.push(row);
|
|
82
|
-
});
|
|
83
|
-
});
|
|
56
|
+
const allItems = React.useMemo(() => {
|
|
57
|
+
const result = [];
|
|
58
|
+
dataSource && dataSource.forEach((group) => group.rows.forEach((row) => result.push(row)));
|
|
84
59
|
return result;
|
|
85
60
|
}, [dataSource]);
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
return row.key === key;
|
|
89
|
-
});
|
|
61
|
+
const getActiveGroup = React.useCallback((key) => {
|
|
62
|
+
const active = data.find((row) => row.key === key);
|
|
90
63
|
if (active) {
|
|
91
|
-
|
|
92
|
-
|
|
64
|
+
const {
|
|
65
|
+
rows,
|
|
66
|
+
...activeGroup
|
|
67
|
+
} = active;
|
|
93
68
|
return activeGroup;
|
|
94
69
|
}
|
|
95
|
-
return
|
|
70
|
+
return void 0;
|
|
96
71
|
}, [data]);
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
return
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
72
|
+
const groupTableColumnDecorator = flow(addActiveColumnClass(activeColumn), addSortClassByState(sortStateApi), clearDefaultColumnSortOrder);
|
|
73
|
+
const columnsWithCustomSorting = columns?.map(columnWithSortButtons(sortStateApi));
|
|
74
|
+
const decoratedColumns = columnsWithCustomSorting?.map(groupTableColumnDecorator);
|
|
75
|
+
const columnsWithActiveSorting = getColumnsWithActiveSorting(sortStateApi, columns);
|
|
76
|
+
const sortedRowsData = activeColumn ? sortDataSourceRows(sortStateApi, columnsWithActiveSorting, dataSource) : dataSource;
|
|
77
|
+
return /* @__PURE__ */ jsx("div", { className: `ds-table ds-table-cell-size-${cellSize} ${roundedHeader ? "ds-table-rounded" : ""}`, children: /* @__PURE__ */ jsx(
|
|
78
|
+
Table,
|
|
79
|
+
{
|
|
80
|
+
...props,
|
|
81
|
+
dataSource: sortedRowsData,
|
|
82
|
+
columns: decoratedColumns,
|
|
83
|
+
components: {
|
|
84
|
+
body: {
|
|
85
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
86
|
+
row: (record) => {
|
|
87
|
+
const activeGroup = getActiveGroup(record["data-row-key"]);
|
|
88
|
+
return /* @__PURE__ */ jsx(
|
|
89
|
+
GroupTableBody,
|
|
90
|
+
{
|
|
91
|
+
group: record,
|
|
92
|
+
selection,
|
|
93
|
+
rowKey,
|
|
94
|
+
allItems,
|
|
95
|
+
expanded: expandedGroups.indexOf(record["data-row-key"]) >= 0,
|
|
96
|
+
expandGroup: toggleExpand,
|
|
97
|
+
columns: columnsWithCustomSorting,
|
|
98
|
+
addItem,
|
|
99
|
+
activeGroup,
|
|
100
|
+
hideGroupExpander
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
}
|
|
126
104
|
}
|
|
105
|
+
},
|
|
106
|
+
rowSelection: selection && {
|
|
107
|
+
...selection,
|
|
108
|
+
columnWidth: 64
|
|
127
109
|
}
|
|
128
110
|
}
|
|
129
|
-
|
|
130
|
-
,
|
|
131
|
-
rowSelection: selection && _extends({}, selection, {
|
|
132
|
-
columnWidth: 64
|
|
133
|
-
})
|
|
134
|
-
})));
|
|
111
|
+
) });
|
|
135
112
|
}
|
|
136
|
-
export
|
|
113
|
+
export {
|
|
114
|
+
GroupTable as default
|
|
115
|
+
};
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
export declare const GroupAddItemButton: import(
|
|
1
|
+
export declare const GroupAddItemButton: import('styled-components').StyledComponent<import('react').ForwardRefExoticComponent<Omit<Partial<{
|
|
2
2
|
href: string;
|
|
3
3
|
target?: string;
|
|
4
4
|
onClick?: React.MouseEventHandler<HTMLElement>;
|
|
5
|
-
} & import(
|
|
6
|
-
htmlType?: import(
|
|
5
|
+
} & import('antd/lib/button/button').BaseButtonProps & Omit<import('react').AnchorHTMLAttributes<any>, "onClick" | "type"> & {
|
|
6
|
+
htmlType?: import('antd/lib/button/button').ButtonHTMLType;
|
|
7
7
|
onClick?: React.MouseEventHandler<HTMLElement>;
|
|
8
|
-
} & Omit<import(
|
|
9
|
-
type?: import(
|
|
10
|
-
mode?: import(
|
|
11
|
-
color?: import(
|
|
12
|
-
groupVariant?: import(
|
|
8
|
+
} & Omit<import('react').ButtonHTMLAttributes<any>, "onClick" | "type">>, "type" | "ghost"> & {
|
|
9
|
+
type?: import('@synerise/ds-utils').LiteralStringUnion<import('@synerise/ds-button/dist/Button.types').ButtonType>;
|
|
10
|
+
mode?: import('@synerise/ds-utils').LiteralStringUnion<"single-icon" | "split" | "two-icons" | "label-icon" | "icon-label">;
|
|
11
|
+
color?: import('@synerise/ds-utils').LiteralStringUnion<"blue" | "grey" | "red" | "green" | "yellow" | "pink" | "mars" | "orange" | "fern" | "cyan" | "purple" | "violet">;
|
|
12
|
+
groupVariant?: import('@synerise/ds-utils').LiteralStringUnion<"left-rounded" | "squared" | "right-rounded">;
|
|
13
13
|
justifyContent?: string;
|
|
14
14
|
loading?: boolean | {
|
|
15
15
|
delay?: number;
|
|
16
16
|
};
|
|
17
|
-
onClick?: (event: import(
|
|
18
|
-
iconColor?: import(
|
|
17
|
+
onClick?: (event: import('react').MouseEvent<HTMLElement>) => void;
|
|
18
|
+
iconColor?: import('@synerise/ds-utils').LiteralStringUnion<"blue" | "grey" | "red" | "green" | "yellow" | "pink" | "mars" | "orange" | "fern" | "cyan" | "purple" | "violet">;
|
|
19
19
|
error?: boolean;
|
|
20
20
|
readOnly?: boolean;
|
|
21
|
-
tagProps?: import(
|
|
22
|
-
tooltipProps?: import(
|
|
23
|
-
} & import(
|
|
24
|
-
Creator: import(
|
|
25
|
-
Expander: ({ size, expanded, disabled, onClick, className, }: import(
|
|
26
|
-
Star: (props: import(
|
|
27
|
-
Checkbox: (props: import(
|
|
21
|
+
tagProps?: import('@synerise/ds-tag').TagProps;
|
|
22
|
+
tooltipProps?: import('@synerise/ds-tooltip').TooltipProps;
|
|
23
|
+
} & import('react').RefAttributes<HTMLButtonElement>> & {
|
|
24
|
+
Creator: import('react').ForwardRefExoticComponent<Omit<import('@synerise/ds-button').CreatorProps, "ref"> & import('react').RefAttributes<HTMLButtonElement>>;
|
|
25
|
+
Expander: ({ size, expanded, disabled, onClick, className, }: import('@synerise/ds-button').ExpanderProps) => import("react").JSX.Element;
|
|
26
|
+
Star: (props: import('@synerise/ds-button').StarButtonProps) => React.ReactElement;
|
|
27
|
+
Checkbox: (props: import('@synerise/ds-button').CheckboxButtonProps) => React.ReactElement;
|
|
28
28
|
}, any, {}, never>;
|
|
29
|
-
export declare const GroupTableRow: import(
|
|
30
|
-
export declare const GroupRow: import(
|
|
31
|
-
export declare const GroupRowLeft: import(
|
|
32
|
-
export declare const GroupRowRight: import(
|
|
33
|
-
export declare const GroupSelection: import(
|
|
34
|
-
export declare const GroupValue: import(
|
|
29
|
+
export declare const GroupTableRow: import('styled-components').StyledComponent<"tr", any, {}, never>;
|
|
30
|
+
export declare const GroupRow: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
31
|
+
export declare const GroupRowLeft: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
32
|
+
export declare const GroupRowRight: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
33
|
+
export declare const GroupSelection: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
34
|
+
export declare const GroupValue: import('styled-components').StyledComponent<"div", any, {
|
|
35
35
|
withSelection: boolean;
|
|
36
36
|
}, never>;
|
|
37
|
-
export declare const GroupValueLabel: import(
|
|
38
|
-
export declare const SubRow: import(
|
|
37
|
+
export declare const GroupValueLabel: import('styled-components').StyledComponent<"span", any, {}, never>;
|
|
38
|
+
export declare const SubRow: import('styled-components').StyledComponent<"td", any, {
|
|
39
39
|
selected?: boolean;
|
|
40
40
|
withBorderLeft?: boolean;
|
|
41
41
|
sorted?: boolean;
|
|
@@ -1,67 +1,70 @@
|
|
|
1
|
-
import styled from
|
|
2
|
-
import Button from
|
|
3
|
-
import { CheckboxWrapper } from
|
|
4
|
-
import { StatusTag } from
|
|
5
|
-
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import Button from "@synerise/ds-button";
|
|
3
|
+
import { CheckboxWrapper } from "@synerise/ds-checkbox/dist/Checkbox.styles";
|
|
4
|
+
import { StatusTag } from "@synerise/ds-status/dist/Status.styles";
|
|
5
|
+
const GroupAddItemButton = /* @__PURE__ */ styled(Button).withConfig({
|
|
6
6
|
displayName: "GroupTablestyles__GroupAddItemButton",
|
|
7
7
|
componentId: "sc-1whlllx-0"
|
|
8
8
|
})(["opacity:0;"]);
|
|
9
|
-
|
|
9
|
+
const GroupTableRow = /* @__PURE__ */ styled.tr.withConfig({
|
|
10
10
|
displayName: "GroupTablestyles__GroupTableRow",
|
|
11
11
|
componentId: "sc-1whlllx-1"
|
|
12
12
|
})([":hover{", "{opacity:1;}}"], GroupAddItemButton);
|
|
13
|
-
|
|
13
|
+
const GroupRow = /* @__PURE__ */ styled.div.withConfig({
|
|
14
14
|
displayName: "GroupTablestyles__GroupRow",
|
|
15
15
|
componentId: "sc-1whlllx-2"
|
|
16
16
|
})(["display:flex;flex-direction:row;align-items:center;justify-content:space-between;"]);
|
|
17
|
-
|
|
17
|
+
const GroupRowLeft = /* @__PURE__ */ styled.div.withConfig({
|
|
18
18
|
displayName: "GroupTablestyles__GroupRowLeft",
|
|
19
19
|
componentId: "sc-1whlllx-3"
|
|
20
20
|
})(["display:flex;align-items:center;justify-content:flex-start;", "{margin-left:12px;padding:0 5px;}"], StatusTag);
|
|
21
|
-
|
|
21
|
+
const GroupRowRight = /* @__PURE__ */ styled.div.withConfig({
|
|
22
22
|
displayName: "GroupTablestyles__GroupRowRight",
|
|
23
23
|
componentId: "sc-1whlllx-4"
|
|
24
24
|
})(["display:flex;align-items:center;justify-content:flex-end;.ds-expander{margin-left:24px;}"]);
|
|
25
|
-
|
|
25
|
+
const GroupSelection = /* @__PURE__ */ styled.div.withConfig({
|
|
26
26
|
displayName: "GroupTablestyles__GroupSelection",
|
|
27
27
|
componentId: "sc-1whlllx-5"
|
|
28
28
|
})(["display:flex;padding:0 24px 0 0;", "{padding:0;}"], CheckboxWrapper);
|
|
29
|
-
|
|
29
|
+
const GroupValue = /* @__PURE__ */ styled.div.withConfig({
|
|
30
30
|
displayName: "GroupTablestyles__GroupValue",
|
|
31
31
|
componentId: "sc-1whlllx-6"
|
|
32
|
-
})(["display:flex;padding:", ";flex-direction:row;align-items:center;justify-content:flex-start;"],
|
|
33
|
-
|
|
34
|
-
});
|
|
35
|
-
export var GroupValueLabel = styled.span.withConfig({
|
|
32
|
+
})(["display:flex;padding:", ";flex-direction:row;align-items:center;justify-content:flex-start;"], (props) => props.withSelection ? "0 24px" : "0");
|
|
33
|
+
const GroupValueLabel = /* @__PURE__ */ styled.span.withConfig({
|
|
36
34
|
displayName: "GroupTablestyles__GroupValueLabel",
|
|
37
35
|
componentId: "sc-1whlllx-7"
|
|
38
|
-
})(["font-weight:500;color:", ";"],
|
|
39
|
-
|
|
40
|
-
});
|
|
41
|
-
export var SubRow = styled.td.withConfig({
|
|
36
|
+
})(["font-weight:500;color:", ";"], (props) => props.theme.palette["grey-700"]);
|
|
37
|
+
const SubRow = /* @__PURE__ */ styled.td.withConfig({
|
|
42
38
|
displayName: "GroupTablestyles__SubRow",
|
|
43
39
|
componentId: "sc-1whlllx-8"
|
|
44
|
-
})(["background-color:", ";&&&&&{background-color:", ";}&&&{font-weight:", ";}position:relative;&:before{content:'';width:2px;height:100%;position:absolute;left:0;top:0;background-color:", ";display:", ";}", "{padding:0;}"],
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
40
|
+
})(["background-color:", ";&&&&&{background-color:", ";}&&&{font-weight:", ";}position:relative;&:before{content:'';width:2px;height:100%;position:absolute;left:0;top:0;background-color:", ";display:", ";}", "{padding:0;}"], ({
|
|
41
|
+
theme
|
|
42
|
+
}) => theme.palette["grey-050"], ({
|
|
43
|
+
theme,
|
|
44
|
+
selected,
|
|
45
|
+
sorted
|
|
46
|
+
}) => {
|
|
51
47
|
if (selected) {
|
|
52
|
-
return theme.palette[
|
|
48
|
+
return `${theme.palette["yellow-050"]};`;
|
|
53
49
|
}
|
|
54
50
|
if (sorted) {
|
|
55
|
-
return theme.palette[
|
|
51
|
+
return `${theme.palette["blue-050"]};`;
|
|
56
52
|
}
|
|
57
|
-
return
|
|
58
|
-
},
|
|
53
|
+
return ``;
|
|
54
|
+
}, (props) => {
|
|
59
55
|
if (props.selected || props.sorted) {
|
|
60
|
-
return
|
|
56
|
+
return "500";
|
|
61
57
|
}
|
|
62
|
-
return
|
|
63
|
-
},
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
58
|
+
return "initial";
|
|
59
|
+
}, (props) => props.theme.palette["grey-600"], (props) => props.withBorderLeft ? "flex" : "none", CheckboxWrapper);
|
|
60
|
+
export {
|
|
61
|
+
GroupAddItemButton,
|
|
62
|
+
GroupRow,
|
|
63
|
+
GroupRowLeft,
|
|
64
|
+
GroupRowRight,
|
|
65
|
+
GroupSelection,
|
|
66
|
+
GroupTableRow,
|
|
67
|
+
GroupValue,
|
|
68
|
+
GroupValueLabel,
|
|
69
|
+
SubRow
|
|
70
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ColumnsType } from 'antd/lib/table';
|
|
2
2
|
export type GroupByType = 'value' | 'ranges' | 'interval' | string | undefined;
|
|
3
3
|
export type SortOrderType = 'ascend' | 'descend' | boolean;
|
|
4
4
|
export type GroupColumnsType<T> = ColumnsType<T> & {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Props } from './GroupTableBody.types';
|
|
2
2
|
declare function GroupTableBody<T>({ group, columns, rowKey, selection, allItems, expanded, expandGroup, addItem, activeGroup, hideGroupExpander, }: Props<T>): JSX.Element;
|
|
3
3
|
export default GroupTableBody;
|