@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,113 +1,89 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import Button from "@synerise/ds-button";
|
|
4
|
+
import Checkbox from "@synerise/ds-checkbox";
|
|
5
|
+
import Icon, { AddS } from "@synerise/ds-icon";
|
|
6
|
+
import Status from "@synerise/ds-status";
|
|
7
|
+
import { useRowKey } from "../../hooks/useRowKey/useRowKey.js";
|
|
8
|
+
import { GroupTableRow, GroupRow, GroupRowLeft, GroupSelection, GroupValue, GroupValueLabel, GroupRowRight, GroupAddItemButton, SubRow } from "../GroupTable.styles.js";
|
|
9
|
+
import { GROUP_BY } from "../GroupTable.types.js";
|
|
10
|
+
function GroupTableBody({
|
|
11
|
+
group,
|
|
12
|
+
columns,
|
|
13
|
+
rowKey,
|
|
14
|
+
selection,
|
|
15
|
+
allItems,
|
|
16
|
+
expanded,
|
|
17
|
+
expandGroup,
|
|
18
|
+
addItem,
|
|
19
|
+
activeGroup,
|
|
20
|
+
hideGroupExpander
|
|
21
|
+
}) {
|
|
22
|
+
const {
|
|
23
|
+
getRowKey
|
|
24
|
+
} = useRowKey(rowKey);
|
|
25
|
+
const allRowKeys = React.useMemo(() => {
|
|
26
|
+
return group.children.length ? group.children[0].props.record.rows.map((row) => getRowKey(row)) : [];
|
|
26
27
|
}, [group, getRowKey]);
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return (selection == null || (_selection$selectedRo = selection.selectedRowKeys) == null ? void 0 : _selection$selectedRo.filter(function (key) {
|
|
30
|
-
return allRowKeys.includes(key);
|
|
31
|
-
}).length) || 0;
|
|
28
|
+
const selectedRowsNumber = React.useMemo(() => {
|
|
29
|
+
return selection?.selectedRowKeys?.filter((key) => allRowKeys.includes(key)).length || 0;
|
|
32
30
|
}, [allRowKeys, selection]);
|
|
33
|
-
|
|
34
|
-
return group.children.length ? columns
|
|
35
|
-
return column.dataIndex === group.children[0].props.record.column;
|
|
36
|
-
}) : undefined;
|
|
31
|
+
const activeColumn = React.useMemo(() => {
|
|
32
|
+
return group.children.length ? columns?.find((column) => column.dataIndex === group.children[0].props.record.column) : void 0;
|
|
37
33
|
}, [columns, group]);
|
|
38
|
-
|
|
39
|
-
return !hideGroupExpander &&
|
|
40
|
-
onClick: function onClick() {
|
|
41
|
-
return expandGroup(group['data-row-key']);
|
|
42
|
-
},
|
|
43
|
-
expanded: expanded
|
|
44
|
-
});
|
|
34
|
+
const groupExpander = React.useMemo(() => {
|
|
35
|
+
return !hideGroupExpander && /* @__PURE__ */ jsx(Button.Expander, { onClick: () => expandGroup(group["data-row-key"]), expanded });
|
|
45
36
|
}, [expanded, expandGroup, hideGroupExpander, group]);
|
|
46
|
-
return
|
|
47
|
-
className: group.className
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
37
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
38
|
+
/* @__PURE__ */ jsx(GroupTableRow, { className: `${group.className} ds-group-row`, children: /* @__PURE__ */ jsx("td", { colSpan: group.children.length + 1, children: /* @__PURE__ */ jsxs(GroupRow, { children: [
|
|
39
|
+
/* @__PURE__ */ jsxs(GroupRowLeft, { children: [
|
|
40
|
+
selection && /* @__PURE__ */ jsx(GroupSelection, { children: /* @__PURE__ */ jsx(Checkbox, { checked: selectedRowsNumber === allRowKeys.length && allRowKeys.length > 0, disabled: allRowKeys.length === 0, indeterminate: selectedRowsNumber > 0 && selectedRowsNumber < allRowKeys.length, onChange: (event) => {
|
|
41
|
+
if (event.target.checked) {
|
|
42
|
+
const selectedKeys = Array.from(/* @__PURE__ */ new Set([...selection?.selectedRowKeys || [], ...allRowKeys]));
|
|
43
|
+
selection.onChange(selectedKeys, allItems.filter((item) => selectedKeys.indexOf(getRowKey(item)) >= 0));
|
|
44
|
+
} else {
|
|
45
|
+
const selectedKeys = selection?.selectedRowKeys.filter((selected) => allRowKeys.indexOf(selected) < 0);
|
|
46
|
+
selection.onChange(selectedKeys, allItems.filter((item) => {
|
|
47
|
+
const key = getRowKey(item);
|
|
48
|
+
return key && selectedKeys?.indexOf(key) < 0;
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
} }) }),
|
|
52
|
+
/* @__PURE__ */ jsxs(GroupValue, { withSelection: Boolean(selection), children: [
|
|
53
|
+
activeColumn?.render && activeGroup?.groupType === GROUP_BY.value ? activeColumn.render(group.children[0].props.record.value, {}, -1) : /* @__PURE__ */ jsx(GroupValueLabel, { children: group.children[0].props.record.value }),
|
|
54
|
+
/* @__PURE__ */ jsx(Status, { type: "disabled", label: group.children[0].props.record.rows.length })
|
|
55
|
+
] })
|
|
56
|
+
] }),
|
|
57
|
+
/* @__PURE__ */ jsxs(GroupRowRight, { children: [
|
|
58
|
+
addItem && activeGroup && /* @__PURE__ */ jsxs(GroupAddItemButton, { type: "ghost", mode: "icon-label", onClick: () => {
|
|
59
|
+
addItem(activeGroup.column, activeGroup.value);
|
|
60
|
+
}, children: [
|
|
61
|
+
/* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(AddS, {}) }),
|
|
62
|
+
"Add item"
|
|
63
|
+
] }),
|
|
64
|
+
groupExpander
|
|
65
|
+
] })
|
|
66
|
+
] }) }) }),
|
|
67
|
+
expanded && group.children[0].props.record.rows.map(
|
|
68
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
69
|
+
(rowRecord) => {
|
|
70
|
+
const key = getRowKey(rowRecord);
|
|
71
|
+
return /* @__PURE__ */ jsxs("tr", { children: [
|
|
72
|
+
selection && /* @__PURE__ */ jsx(SubRow, { withBorderLeft: true, children: /* @__PURE__ */ jsx(Checkbox, { checked: key !== void 0 && selection.selectedRowKeys.indexOf(key) >= 0, onChange: (event) => {
|
|
73
|
+
if (event.target.checked && key !== void 0) {
|
|
74
|
+
selection.onChange([...selection.selectedRowKeys, key], [...allItems, rowRecord]);
|
|
75
|
+
} else {
|
|
76
|
+
selection.onChange(selection?.selectedRowKeys.filter((item) => item !== key), allItems.filter((item) => getRowKey(item) !== key));
|
|
77
|
+
}
|
|
78
|
+
} }) }),
|
|
79
|
+
columns?.map((column, index) => {
|
|
80
|
+
return column.dataIndex && /* @__PURE__ */ jsx(SubRow, { selected: column.dataIndex === group.children[0].props.record.column, sorted: Boolean(column.sortOrder), children: column.render && column.render(rowRecord[column.dataIndex], rowRecord, index) || rowRecord[column.dataIndex] }, column.dataIndex);
|
|
81
|
+
})
|
|
82
|
+
] }, rowRecord.column);
|
|
68
83
|
}
|
|
69
|
-
|
|
70
|
-
})
|
|
71
|
-
withSelection: Boolean(selection)
|
|
72
|
-
}, activeColumn != null && activeColumn.render && (activeGroup == null ? void 0 : activeGroup.groupType) === GROUP_BY.value ? activeColumn.render(group.children[0].props.record.value, {}, -1) : /*#__PURE__*/React.createElement(S.GroupValueLabel, null, group.children[0].props.record.value), /*#__PURE__*/React.createElement(Status, {
|
|
73
|
-
type: "disabled",
|
|
74
|
-
label: group.children[0].props.record.rows.length
|
|
75
|
-
}))), /*#__PURE__*/React.createElement(S.GroupRowRight, null, addItem && activeGroup && /*#__PURE__*/React.createElement(S.GroupAddItemButton, {
|
|
76
|
-
type: "ghost",
|
|
77
|
-
mode: "icon-label",
|
|
78
|
-
onClick: function onClick() {
|
|
79
|
-
addItem(activeGroup.column, activeGroup.value);
|
|
80
|
-
}
|
|
81
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
82
|
-
component: /*#__PURE__*/React.createElement(AddS, null)
|
|
83
|
-
}), "Add item"), groupExpander)))), expanded && group.children[0].props.record.rows.map(
|
|
84
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
85
|
-
function (rowRecord) {
|
|
86
|
-
var key = getRowKey(rowRecord);
|
|
87
|
-
return /*#__PURE__*/React.createElement("tr", {
|
|
88
|
-
key: rowRecord.column
|
|
89
|
-
}, selection && /*#__PURE__*/React.createElement(S.SubRow, {
|
|
90
|
-
withBorderLeft: true
|
|
91
|
-
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
92
|
-
checked: key !== undefined && selection.selectedRowKeys.indexOf(key) >= 0,
|
|
93
|
-
onChange: function onChange(event) {
|
|
94
|
-
if (event.target.checked && key !== undefined) {
|
|
95
|
-
selection.onChange([].concat(selection.selectedRowKeys, [key]), [].concat(allItems, [rowRecord]));
|
|
96
|
-
} else {
|
|
97
|
-
selection.onChange(selection == null ? void 0 : selection.selectedRowKeys.filter(function (item) {
|
|
98
|
-
return item !== key;
|
|
99
|
-
}), allItems.filter(function (item) {
|
|
100
|
-
return getRowKey(item) !== key;
|
|
101
|
-
}));
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
})), columns == null ? void 0 : columns.map(function (column, index) {
|
|
105
|
-
return column.dataIndex && /*#__PURE__*/React.createElement(S.SubRow, {
|
|
106
|
-
key: column.dataIndex,
|
|
107
|
-
selected: column.dataIndex === group.children[0].props.record.column,
|
|
108
|
-
sorted: Boolean(column.sortOrder)
|
|
109
|
-
}, column.render && column.render(rowRecord[column.dataIndex], rowRecord, index) || rowRecord[column.dataIndex]);
|
|
110
|
-
}));
|
|
111
|
-
}));
|
|
84
|
+
)
|
|
85
|
+
] });
|
|
112
86
|
}
|
|
113
|
-
export
|
|
87
|
+
export {
|
|
88
|
+
GroupTableBody as default
|
|
89
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { RowSelection } from '../../Table.types';
|
|
3
|
+
import { GroupColumnsType, GroupType } from '../GroupTable.types';
|
|
4
4
|
export interface Props<T> {
|
|
5
5
|
group: any;
|
|
6
6
|
rowKey: string | Function | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
@@ -1,30 +1,27 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
function GroupTableHeader({
|
|
4
|
+
header,
|
|
5
|
+
activeColumnKey,
|
|
6
|
+
sortColumn
|
|
7
|
+
}) {
|
|
8
|
+
const clickHandle = React.useCallback(
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
|
+
(child) => {
|
|
11
|
+
if (child.props.column.sorter) {
|
|
12
|
+
sortColumn(child);
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
[sortColumn]
|
|
16
|
+
);
|
|
17
|
+
return /* @__PURE__ */ jsx("tr", { children: header.children.map(
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
19
|
+
(child) => {
|
|
20
|
+
const isColumnActive = activeColumnKey === child.key;
|
|
21
|
+
return /* @__PURE__ */ jsx("th", { rowSpan: child.props.rowspan, onClick: isColumnActive ? (e) => e.preventDefault() : () => clickHandle(child), className: `${child.props.className} ${child.props.additionalProps?.className || ""} ${isColumnActive ? "ds-table-active-column" : ""}`, children: child.props.children }, child.key);
|
|
11
22
|
}
|
|
12
|
-
}
|
|
13
|
-
return /*#__PURE__*/React.createElement("tr", null, header.children.map(
|
|
14
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15
|
-
function (child) {
|
|
16
|
-
var _child$props$addition;
|
|
17
|
-
var isColumnActive = activeColumnKey === child.key;
|
|
18
|
-
return /*#__PURE__*/React.createElement("th", {
|
|
19
|
-
key: child.key,
|
|
20
|
-
rowSpan: child.props.rowspan,
|
|
21
|
-
onClick: isColumnActive ? function (e) {
|
|
22
|
-
return e.preventDefault();
|
|
23
|
-
} : function () {
|
|
24
|
-
return clickHandle(child);
|
|
25
|
-
},
|
|
26
|
-
className: child.props.className + " " + (((_child$props$addition = child.props.additionalProps) == null ? void 0 : _child$props$addition.className) || '') + " " + (isColumnActive ? 'ds-table-active-column' : '')
|
|
27
|
-
}, child.props.children);
|
|
28
|
-
}));
|
|
23
|
+
) });
|
|
29
24
|
}
|
|
30
|
-
export
|
|
25
|
+
export {
|
|
26
|
+
GroupTableHeader as default
|
|
27
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ButtonProps } from '@synerise/ds-button';
|
|
3
3
|
export declare const BackToTopButton: (props: ButtonProps & {
|
|
4
4
|
isSticky?: boolean;
|
|
5
5
|
}) => React.ReactElement;
|
|
@@ -1,16 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
mode: "icon-label",
|
|
9
|
-
color: "grey",
|
|
10
|
-
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
11
|
-
component: /*#__PURE__*/React.createElement(ArrowUpCircleM, null)
|
|
12
|
-
}),
|
|
13
|
-
className: "virtual-table-back-to-top-button"
|
|
14
|
-
}, props));
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import Icon, { ArrowUpCircleM } from "@synerise/ds-icon";
|
|
3
|
+
import { OffsetButton } from "./BackToTopButton.styles.js";
|
|
4
|
+
const BackToTopButton = (props) => /* @__PURE__ */ jsx(OffsetButton, { type: "custom-color", mode: "icon-label", color: "grey", icon: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(ArrowUpCircleM, {}) }), className: "virtual-table-back-to-top-button", ...props });
|
|
5
|
+
export {
|
|
6
|
+
BackToTopButton,
|
|
7
|
+
BackToTopButton as default
|
|
15
8
|
};
|
|
16
|
-
export default BackToTopButton;
|
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
export declare const OffsetButton: import(
|
|
1
|
+
export declare const OffsetButton: 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, {
|
|
29
29
|
isSticky?: boolean;
|
|
30
30
|
}, never>;
|
|
31
31
|
declare const _default: {
|
|
32
|
-
OffsetButton: import(
|
|
32
|
+
OffsetButton: import('styled-components').StyledComponent<import('react').ForwardRefExoticComponent<Omit<Partial<{
|
|
33
33
|
href: string;
|
|
34
34
|
target?: string;
|
|
35
35
|
onClick?: React.MouseEventHandler<HTMLElement>;
|
|
36
|
-
} & import(
|
|
37
|
-
htmlType?: import(
|
|
36
|
+
} & import('antd/lib/button/button').BaseButtonProps & Omit<import('react').AnchorHTMLAttributes<any>, "onClick" | "type"> & {
|
|
37
|
+
htmlType?: import('antd/lib/button/button').ButtonHTMLType;
|
|
38
38
|
onClick?: React.MouseEventHandler<HTMLElement>;
|
|
39
|
-
} & Omit<import(
|
|
40
|
-
type?: import(
|
|
41
|
-
mode?: import(
|
|
42
|
-
color?: import(
|
|
43
|
-
groupVariant?: import(
|
|
39
|
+
} & Omit<import('react').ButtonHTMLAttributes<any>, "onClick" | "type">>, "type" | "ghost"> & {
|
|
40
|
+
type?: import('@synerise/ds-utils').LiteralStringUnion<import('@synerise/ds-button/dist/Button.types').ButtonType>;
|
|
41
|
+
mode?: import('@synerise/ds-utils').LiteralStringUnion<"single-icon" | "split" | "two-icons" | "label-icon" | "icon-label">;
|
|
42
|
+
color?: import('@synerise/ds-utils').LiteralStringUnion<"blue" | "grey" | "red" | "green" | "yellow" | "pink" | "mars" | "orange" | "fern" | "cyan" | "purple" | "violet">;
|
|
43
|
+
groupVariant?: import('@synerise/ds-utils').LiteralStringUnion<"left-rounded" | "squared" | "right-rounded">;
|
|
44
44
|
justifyContent?: string;
|
|
45
45
|
loading?: boolean | {
|
|
46
46
|
delay?: number;
|
|
47
47
|
};
|
|
48
|
-
onClick?: (event: import(
|
|
49
|
-
iconColor?: import(
|
|
48
|
+
onClick?: (event: import('react').MouseEvent<HTMLElement>) => void;
|
|
49
|
+
iconColor?: import('@synerise/ds-utils').LiteralStringUnion<"blue" | "grey" | "red" | "green" | "yellow" | "pink" | "mars" | "orange" | "fern" | "cyan" | "purple" | "violet">;
|
|
50
50
|
error?: boolean;
|
|
51
51
|
readOnly?: boolean;
|
|
52
|
-
tagProps?: import(
|
|
53
|
-
tooltipProps?: import(
|
|
54
|
-
} & import(
|
|
55
|
-
Creator: import(
|
|
56
|
-
Expander: ({ size, expanded, disabled, onClick, className, }: import(
|
|
57
|
-
Star: (props: import(
|
|
58
|
-
Checkbox: (props: import(
|
|
52
|
+
tagProps?: import('@synerise/ds-tag').TagProps;
|
|
53
|
+
tooltipProps?: import('@synerise/ds-tooltip').TooltipProps;
|
|
54
|
+
} & import('react').RefAttributes<HTMLButtonElement>> & {
|
|
55
|
+
Creator: import('react').ForwardRefExoticComponent<Omit<import('@synerise/ds-button').CreatorProps, "ref"> & import('react').RefAttributes<HTMLButtonElement>>;
|
|
56
|
+
Expander: ({ size, expanded, disabled, onClick, className, }: import('@synerise/ds-button').ExpanderProps) => import("react").JSX.Element;
|
|
57
|
+
Star: (props: import('@synerise/ds-button').StarButtonProps) => React.ReactElement;
|
|
58
|
+
Checkbox: (props: import('@synerise/ds-button').CheckboxButtonProps) => React.ReactElement;
|
|
59
59
|
}, any, {
|
|
60
60
|
isSticky?: boolean;
|
|
61
61
|
}, never>;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import styled, { css } from
|
|
2
|
-
import Button from
|
|
3
|
-
|
|
1
|
+
import styled, { css } from "styled-components";
|
|
2
|
+
import Button from "@synerise/ds-button";
|
|
3
|
+
const OffsetButton = /* @__PURE__ */ styled(Button).withConfig({
|
|
4
4
|
displayName: "BackToTopButtonstyles__OffsetButton",
|
|
5
5
|
componentId: "sc-8vxnei-0"
|
|
6
|
-
})(["", ""],
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
})(["", ""], (props) => props.isSticky ? css(["&&&{transform:translate(10px,-100%);}"]) : css(["&&&{position:absolute;right:-16px;bottom:-16px;z-index:2;}"]));
|
|
7
|
+
const BackToTopButton_styles = {
|
|
8
|
+
OffsetButton
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
OffsetButton,
|
|
12
|
+
BackToTopButton_styles as default
|
|
13
|
+
};
|
|
@@ -1,24 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
import Alert from
|
|
3
|
-
import Button from
|
|
4
|
-
import Icon, { RefreshM } from
|
|
5
|
-
import { useTableLocaleContext } from
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
message: tableLocale.infiniteScrollError
|
|
13
|
-
|
|
14
|
-
onClick: onRetryClick,
|
|
15
|
-
type: "ghost",
|
|
16
|
-
mode: "icon-label",
|
|
17
|
-
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
18
|
-
component: /*#__PURE__*/React.createElement(RefreshM, null)
|
|
19
|
-
}),
|
|
20
|
-
style: {
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import Alert from "@synerise/ds-alert";
|
|
3
|
+
import Button from "@synerise/ds-button";
|
|
4
|
+
import Icon, { RefreshM } from "@synerise/ds-icon";
|
|
5
|
+
import { useTableLocaleContext } from "../utils/locale.js";
|
|
6
|
+
import { ErrorItemWrapper } from "./ErrorItem.styles.js";
|
|
7
|
+
const ErrorItem = ({
|
|
8
|
+
onRetryClick
|
|
9
|
+
}) => {
|
|
10
|
+
const tableLocale = useTableLocaleContext();
|
|
11
|
+
return /* @__PURE__ */ jsxs(ErrorItemWrapper, { children: [
|
|
12
|
+
/* @__PURE__ */ jsx(Alert.InlineAlert, { type: "alert", message: tableLocale.infiniteScrollError }),
|
|
13
|
+
onRetryClick && /* @__PURE__ */ jsx(Button, { onClick: onRetryClick, type: "ghost", mode: "icon-label", icon: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(RefreshM, {}) }), style: {
|
|
21
14
|
marginLeft: 8
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
};
|
|
15
|
+
}, children: tableLocale.infiniteScrollRetry })
|
|
16
|
+
] });
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
ErrorItem
|
|
20
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const ErrorItemWrapper: import(
|
|
1
|
+
export declare const ErrorItemWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import styled from
|
|
2
|
-
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
const ErrorItemWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
3
3
|
displayName: "ErrorItemstyles__ErrorItemWrapper",
|
|
4
4
|
componentId: "sc-1cy3ay2-0"
|
|
5
|
-
})(["display:flex;gap:8px;"]);
|
|
5
|
+
})(["display:flex;gap:8px;"]);
|
|
6
|
+
export {
|
|
7
|
+
ErrorItemWrapper
|
|
8
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { LoaderItemProps } from './InfiniteLoaderItem.types';
|
|
3
3
|
declare const InfiniteLoaderItem: ({ infiniteScroll, position }: LoaderItemProps) => React.JSX.Element;
|
|
4
4
|
export default InfiniteLoaderItem;
|
|
@@ -1,38 +1,43 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
import { ErrorItem } from "./ErrorItem.js";
|
|
4
|
+
import { LoadingItem } from "./LoadingItem.js";
|
|
5
|
+
import { NoMoreItem } from "./NoMoreItem.js";
|
|
6
|
+
import { infiniteScrollPropsToState } from "./utils.js";
|
|
7
|
+
const InfiniteLoaderItem = ({
|
|
8
|
+
infiniteScroll,
|
|
9
|
+
position
|
|
10
|
+
}) => {
|
|
11
|
+
const {
|
|
12
|
+
hasMore,
|
|
13
|
+
isLoading,
|
|
14
|
+
onScrollEndReach,
|
|
15
|
+
hasError,
|
|
16
|
+
onRetryButtonClick,
|
|
17
|
+
render
|
|
18
|
+
} = infiniteScroll;
|
|
19
|
+
const handleRetryClick = onRetryButtonClick ? () => {
|
|
16
20
|
onRetryButtonClick(position);
|
|
17
|
-
} :
|
|
18
|
-
|
|
19
|
-
// @ts-expect-error TS7030: Not all code paths return a value
|
|
20
|
-
|
|
21
|
-
useEffect(function () {
|
|
21
|
+
} : void 0;
|
|
22
|
+
useEffect(() => {
|
|
22
23
|
if (!isLoading && hasMore) {
|
|
23
|
-
if ((!position || position ===
|
|
24
|
-
|
|
25
|
-
return
|
|
24
|
+
if ((!position || position === "BOTTOM") && typeof onScrollEndReach === "function") {
|
|
25
|
+
const timeout = setTimeout(onScrollEndReach, 0);
|
|
26
|
+
return () => {
|
|
26
27
|
clearTimeout(timeout);
|
|
27
28
|
};
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
31
|
}, [hasMore, isLoading, onScrollEndReach, position]);
|
|
31
|
-
if (typeof render ===
|
|
32
|
+
if (typeof render === "function") {
|
|
32
33
|
return render(infiniteScrollPropsToState(infiniteScroll));
|
|
33
34
|
}
|
|
34
|
-
return
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
36
|
+
isLoading && /* @__PURE__ */ jsx(LoadingItem, {}),
|
|
37
|
+
!isLoading && !hasMore && /* @__PURE__ */ jsx(NoMoreItem, {}),
|
|
38
|
+
!isLoading && hasError && /* @__PURE__ */ jsx(ErrorItem, { onRetryClick: handleRetryClick })
|
|
39
|
+
] });
|
|
40
|
+
};
|
|
41
|
+
export {
|
|
42
|
+
InfiniteLoaderItem as default
|
|
37
43
|
};
|
|
38
|
-
export default InfiniteLoaderItem;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const Loader: import(
|
|
1
|
+
export declare const Loader: import('styled-components').StyledComponent<({ size, label, labelPosition, color, percent, percentFormatter, text, fontSize, mode, className, }: import('@synerise/ds-loader/dist/Loader.types').LoaderProps) => React.JSX.Element, any, {}, never>;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import styled from
|
|
2
|
-
import DSLoader from
|
|
3
|
-
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import DSLoader from "@synerise/ds-loader";
|
|
3
|
+
const Loader = /* @__PURE__ */ styled(DSLoader).withConfig({
|
|
4
4
|
displayName: "InfiniteLoaderItemstyles__Loader",
|
|
5
5
|
componentId: "sc-lvwx4m-0"
|
|
6
|
-
})(["justify-content:flex-start;"]);
|
|
6
|
+
})(["justify-content:flex-start;"]);
|
|
7
|
+
export {
|
|
8
|
+
Loader
|
|
9
|
+
};
|