@redsift/table 10.3.0-alpha.1 → 10.3.0-alpha.2
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/CONTRIBUTING.md +4 -0
- package/index.d.ts +1 -0
- package/index.js +37 -19
- package/index.js.map +1 -1
- package/package.json +2 -2
package/CONTRIBUTING.md
CHANGED
|
@@ -58,6 +58,10 @@ The Design System is following a monorepo architecture, providing multiple packa
|
|
|
58
58
|
|
|
59
59
|
This package provides dashboard-related components and decorators to make charts and datagrid filterable using [crossfilter](https://crossfilter.github.io/crossfilter/).
|
|
60
60
|
|
|
61
|
+
- `@redsift/products`
|
|
62
|
+
|
|
63
|
+
This package provides ready-to-use implementation of components with a customize style to fit Red Sift's use cases. It is based on all other packages.
|
|
64
|
+
|
|
61
65
|
- _Deprecated_ `@redsift/design-system-legacy`
|
|
62
66
|
|
|
63
67
|
This package contains all components prior to the 6.0.0 version. These components are deprecated and contributing to this package is discouraged since it will be removed in the future.
|
package/index.d.ts
CHANGED
|
@@ -80,6 +80,7 @@ interface DataGridProps extends Partial<Pick<DataGridProProps, 'rows'>>, Omit<Da
|
|
|
80
80
|
/** Theme. */
|
|
81
81
|
theme?: Theme;
|
|
82
82
|
onSelectionStatusChange?: (newSelectionStatus: SelectionStatusType) => void;
|
|
83
|
+
isPreviousData?: boolean;
|
|
83
84
|
}
|
|
84
85
|
type SelectionStatusType = 'page' | 'table' | 'other' | 'none';
|
|
85
86
|
type SelectionStatus = {
|
package/index.js
CHANGED
|
@@ -21647,14 +21647,14 @@ const TooltipContent = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
21647
21647
|
}, isOpen && /*#__PURE__*/React__default.createElement(StyledTooltipContent, _extends$2({
|
|
21648
21648
|
className: classNames(TooltipContent.className, className),
|
|
21649
21649
|
ref: popoverRef,
|
|
21650
|
-
$theme: theme
|
|
21650
|
+
$theme: theme
|
|
21651
|
+
}, getFloatingProps(props), {
|
|
21651
21652
|
style: _objectSpread2({
|
|
21652
21653
|
position: strategy,
|
|
21653
21654
|
top: y !== null && y !== void 0 ? y : 0,
|
|
21654
21655
|
left: x !== null && x !== void 0 ? x : 0,
|
|
21655
21656
|
visibility: x == null ? 'hidden' : 'visible'
|
|
21656
|
-
}, style)
|
|
21657
|
-
}, getFloatingProps(props), {
|
|
21657
|
+
}, style),
|
|
21658
21658
|
$placement: placement
|
|
21659
21659
|
}), /*#__PURE__*/React__default.createElement("div", {
|
|
21660
21660
|
ref: arrowRef,
|
|
@@ -24720,9 +24720,18 @@ const onServerSideSelectionStatusChange = _ref => {
|
|
|
24720
24720
|
return;
|
|
24721
24721
|
}
|
|
24722
24722
|
if (selectionStatusType === 'page' && isSamePage && isSamePageSize && numberOfSelectedRowsInPage === numberOfSelectableRowsInPage) {
|
|
24723
|
+
setSelectionStatusType('none');
|
|
24724
|
+
selectionStatus.current = {
|
|
24725
|
+
type: 'none',
|
|
24726
|
+
numberOfSelectedRows,
|
|
24727
|
+
numberOfSelectedRowsInPage,
|
|
24728
|
+
page,
|
|
24729
|
+
pageSize
|
|
24730
|
+
};
|
|
24723
24731
|
setTimeout(() => {
|
|
24724
24732
|
apiRef.current.selectRows(selectedRowsInPage, false, false);
|
|
24725
24733
|
}, 0);
|
|
24734
|
+
return;
|
|
24726
24735
|
}
|
|
24727
24736
|
if (numberOfSelectedRowsInPage === numberOfSelectableRowsInPage && numberOfSelectableRowsInPage != 0) {
|
|
24728
24737
|
setSelectionStatusType('page');
|
|
@@ -24733,7 +24742,9 @@ const onServerSideSelectionStatusChange = _ref => {
|
|
|
24733
24742
|
page,
|
|
24734
24743
|
pageSize
|
|
24735
24744
|
};
|
|
24736
|
-
|
|
24745
|
+
return;
|
|
24746
|
+
}
|
|
24747
|
+
if (numberOfSelectedRows > 0) {
|
|
24737
24748
|
setSelectionStatusType('other');
|
|
24738
24749
|
selectionStatus.current = {
|
|
24739
24750
|
type: 'other',
|
|
@@ -24742,16 +24753,17 @@ const onServerSideSelectionStatusChange = _ref => {
|
|
|
24742
24753
|
page,
|
|
24743
24754
|
pageSize
|
|
24744
24755
|
};
|
|
24745
|
-
|
|
24746
|
-
setSelectionStatusType('none');
|
|
24747
|
-
selectionStatus.current = {
|
|
24748
|
-
type: 'none',
|
|
24749
|
-
numberOfSelectedRows,
|
|
24750
|
-
numberOfSelectedRowsInPage,
|
|
24751
|
-
page,
|
|
24752
|
-
pageSize
|
|
24753
|
-
};
|
|
24756
|
+
return;
|
|
24754
24757
|
}
|
|
24758
|
+
setSelectionStatusType('none');
|
|
24759
|
+
selectionStatus.current = {
|
|
24760
|
+
type: 'none',
|
|
24761
|
+
numberOfSelectedRows,
|
|
24762
|
+
numberOfSelectedRowsInPage,
|
|
24763
|
+
page,
|
|
24764
|
+
pageSize
|
|
24765
|
+
};
|
|
24766
|
+
return;
|
|
24755
24767
|
};
|
|
24756
24768
|
|
|
24757
24769
|
const getSelectableRowsInTable = (apiRef, isRowSelectable) => {
|
|
@@ -24824,7 +24836,7 @@ const ControlledPagination = _ref => {
|
|
|
24824
24836
|
};
|
|
24825
24837
|
|
|
24826
24838
|
const _excluded$1 = ["hideToolbar", "RenderedToolbar", "filterModel", "onFilterModelChange", "pagination", "paginationPlacement", "selectionStatus", "selectionStatusType", "setSelectionStatusType", "apiRef", "isRowSelectable", "paginationModel", "onPaginationModelChange", "pageSizeOptions", "paginationProps", "paginationMode", "rowCount"],
|
|
24827
|
-
_excluded2 = ["apiRef", "autoHeight", "className", "slots", "slotProps", "filterModel", "height", "hideToolbar", "initialState", "isRowSelectable", "license", "onFilterModelChange", "paginationModel", "onPaginationModelChange", "pageSizeOptions", "rowSelectionModel", "onRowSelectionModelChange", "pagination", "paginationPlacement", "paginationProps", "rows", "sx", "theme", "paginationMode", "rowCount", "onSelectionStatusChange"];
|
|
24839
|
+
_excluded2 = ["apiRef", "autoHeight", "className", "slots", "slotProps", "filterModel", "height", "hideToolbar", "initialState", "isRowSelectable", "license", "onFilterModelChange", "paginationModel", "onPaginationModelChange", "pageSizeOptions", "rowSelectionModel", "onRowSelectionModelChange", "pagination", "paginationPlacement", "paginationProps", "rows", "sx", "theme", "paginationMode", "rowCount", "onSelectionStatusChange", "isPreviousData"];
|
|
24828
24840
|
const COMPONENT_NAME$1 = 'DataGrid';
|
|
24829
24841
|
const CLASSNAME$1 = 'redsift-datagrid';
|
|
24830
24842
|
const DEFAULT_PROPS = {
|
|
@@ -24910,7 +24922,8 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24910
24922
|
theme: propsTheme,
|
|
24911
24923
|
paginationMode = 'client',
|
|
24912
24924
|
rowCount,
|
|
24913
|
-
onSelectionStatusChange: propsOnSelectionStatusChange
|
|
24925
|
+
onSelectionStatusChange: propsOnSelectionStatusChange,
|
|
24926
|
+
isPreviousData
|
|
24914
24927
|
} = props,
|
|
24915
24928
|
forwardedProps = _objectWithoutProperties(props, _excluded2);
|
|
24916
24929
|
const theme = useTheme$4(propsTheme);
|
|
@@ -24958,13 +24971,10 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24958
24971
|
page: paginationModel.page,
|
|
24959
24972
|
pageSize: paginationModel.pageSize
|
|
24960
24973
|
});
|
|
24961
|
-
|
|
24974
|
+
useEffect(() => {
|
|
24962
24975
|
if (propsOnSelectionStatusChange) {
|
|
24963
24976
|
propsOnSelectionStatusChange(selectionStatusType);
|
|
24964
24977
|
}
|
|
24965
|
-
};
|
|
24966
|
-
useEffect(() => {
|
|
24967
|
-
onSelectionStatusChange(selectionStatusType);
|
|
24968
24978
|
}, [selectionStatusType]);
|
|
24969
24979
|
|
|
24970
24980
|
// in server-side pagination we want to update the selection status
|
|
@@ -24983,6 +24993,14 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24983
24993
|
});
|
|
24984
24994
|
}
|
|
24985
24995
|
}, [rowSelectionModel, paginationModel.page, paginationModel.pageSize]);
|
|
24996
|
+
useEffect(() => {
|
|
24997
|
+
if (paginationMode === 'server' && selectionStatusType === 'table' && !isPreviousData) {
|
|
24998
|
+
const selectableRowsInPage = getSelectableRowsInTable(apiRef, isRowSelectable);
|
|
24999
|
+
setTimeout(() => {
|
|
25000
|
+
apiRef.current.selectRows(selectableRowsInPage, false, true);
|
|
25001
|
+
}, 0);
|
|
25002
|
+
}
|
|
25003
|
+
}, [isPreviousData]);
|
|
24986
25004
|
if (!Array.isArray(rows)) {
|
|
24987
25005
|
return null;
|
|
24988
25006
|
}
|