@redsift/table 10.3.0-muiv5-alpha.1 → 10.3.0-muiv5-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 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
@@ -79,6 +79,7 @@ interface DataGridProps extends Partial<Pick<DataGridProProps, 'rows'>>, Omit<Da
79
79
  /** Theme. */
80
80
  theme?: Theme;
81
81
  onSelectionStatusChange?: (newSelectionStatus: SelectionStatusType) => void;
82
+ isPreviousData?: boolean;
82
83
  }
83
84
  type SelectionStatusType = 'page' | 'table' | 'other' | 'none';
84
85
  type SelectionStatus = {
package/index.js CHANGED
@@ -21646,14 +21646,14 @@ const TooltipContent = /*#__PURE__*/forwardRef((props, ref) => {
21646
21646
  }, isOpen && /*#__PURE__*/React__default.createElement(StyledTooltipContent, _extends$2({
21647
21647
  className: classNames(TooltipContent.className, className),
21648
21648
  ref: popoverRef,
21649
- $theme: theme,
21649
+ $theme: theme
21650
+ }, getFloatingProps(props), {
21650
21651
  style: _objectSpread2({
21651
21652
  position: strategy,
21652
21653
  top: y !== null && y !== void 0 ? y : 0,
21653
21654
  left: x !== null && x !== void 0 ? x : 0,
21654
21655
  visibility: x == null ? 'hidden' : 'visible'
21655
- }, style)
21656
- }, getFloatingProps(props), {
21656
+ }, style),
21657
21657
  $placement: placement
21658
21658
  }), /*#__PURE__*/React__default.createElement("div", {
21659
21659
  ref: arrowRef,
@@ -24717,9 +24717,18 @@ const onServerSideSelectionStatusChange = _ref => {
24717
24717
  return;
24718
24718
  }
24719
24719
  if (selectionStatusType === 'page' && isSamePage && isSamePageSize && numberOfSelectedRowsInPage === numberOfSelectableRowsInPage) {
24720
+ setSelectionStatusType('none');
24721
+ selectionStatus.current = {
24722
+ type: 'none',
24723
+ numberOfSelectedRows,
24724
+ numberOfSelectedRowsInPage,
24725
+ page,
24726
+ pageSize
24727
+ };
24720
24728
  setTimeout(() => {
24721
24729
  apiRef.current.selectRows(selectedRowsInPage, false, false);
24722
24730
  }, 0);
24731
+ return;
24723
24732
  }
24724
24733
  if (numberOfSelectedRowsInPage === numberOfSelectableRowsInPage && numberOfSelectableRowsInPage != 0) {
24725
24734
  setSelectionStatusType('page');
@@ -24730,7 +24739,9 @@ const onServerSideSelectionStatusChange = _ref => {
24730
24739
  page,
24731
24740
  pageSize
24732
24741
  };
24733
- } else if (numberOfSelectedRows > 0) {
24742
+ return;
24743
+ }
24744
+ if (numberOfSelectedRows > 0) {
24734
24745
  setSelectionStatusType('other');
24735
24746
  selectionStatus.current = {
24736
24747
  type: 'other',
@@ -24739,16 +24750,17 @@ const onServerSideSelectionStatusChange = _ref => {
24739
24750
  page,
24740
24751
  pageSize
24741
24752
  };
24742
- } else {
24743
- setSelectionStatusType('none');
24744
- selectionStatus.current = {
24745
- type: 'none',
24746
- numberOfSelectedRows,
24747
- numberOfSelectedRowsInPage,
24748
- page,
24749
- pageSize
24750
- };
24753
+ return;
24751
24754
  }
24755
+ setSelectionStatusType('none');
24756
+ selectionStatus.current = {
24757
+ type: 'none',
24758
+ numberOfSelectedRows,
24759
+ numberOfSelectedRowsInPage,
24760
+ page,
24761
+ pageSize
24762
+ };
24763
+ return;
24752
24764
  };
24753
24765
 
24754
24766
  const getSelectableRowsInTable = (apiRef, isRowSelectable) => {
@@ -24819,7 +24831,7 @@ const ControlledPagination = _ref => {
24819
24831
  };
24820
24832
 
24821
24833
  const _excluded$1 = ["hideToolbar", "RenderedToolbar", "filterModel", "onFilterModelChange", "pagination", "paginationPlacement", "selectionStatus", "selectionStatusType", "setSelectionStatusType", "apiRef", "isRowSelectable", "page", "onPageChange", "pageSize", "onPageSizeChange", "rowsPerPageOptions", "paginationProps", "paginationMode", "rowCount"],
24822
- _excluded2 = ["apiRef", "autoHeight", "className", "components", "componentsProps", "filterModel", "height", "hideToolbar", "initialState", "isRowSelectable", "license", "onFilterModelChange", "onPageChange", "onPageSizeChange", "selectionModel", "onSelectionModelChange", "page", "pageSize", "pagination", "paginationPlacement", "paginationProps", "rows", "rowsPerPageOptions", "sx", "theme", "paginationMode", "rowCount", "onSelectionStatusChange"];
24834
+ _excluded2 = ["apiRef", "autoHeight", "className", "components", "componentsProps", "filterModel", "height", "hideToolbar", "initialState", "isRowSelectable", "license", "onFilterModelChange", "onPageChange", "onPageSizeChange", "selectionModel", "onSelectionModelChange", "page", "pageSize", "pagination", "paginationPlacement", "paginationProps", "rows", "rowsPerPageOptions", "sx", "theme", "paginationMode", "rowCount", "onSelectionStatusChange", "isPreviousData"];
24823
24835
  const COMPONENT_NAME$1 = 'DataGrid';
24824
24836
  const CLASSNAME$1 = 'redsift-datagrid';
24825
24837
  const DEFAULT_PROPS = {
@@ -24913,7 +24925,8 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
24913
24925
  theme: propsTheme,
24914
24926
  paginationMode = 'client',
24915
24927
  rowCount,
24916
- onSelectionStatusChange: propsOnSelectionStatusChange
24928
+ onSelectionStatusChange: propsOnSelectionStatusChange,
24929
+ isPreviousData
24917
24930
  } = props,
24918
24931
  forwardedProps = _objectWithoutProperties(props, _excluded2);
24919
24932
  const theme = useTheme$4(propsTheme);
@@ -24972,13 +24985,10 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
24972
24985
  setPageSize(propsPageSize);
24973
24986
  }
24974
24987
  }, [propsPageSize]);
24975
- const onSelectionStatusChange = selectionStatusType => {
24988
+ useEffect(() => {
24976
24989
  if (propsOnSelectionStatusChange) {
24977
24990
  propsOnSelectionStatusChange(selectionStatusType);
24978
24991
  }
24979
- };
24980
- useEffect(() => {
24981
- onSelectionStatusChange(selectionStatusType);
24982
24992
  }, [selectionStatusType]);
24983
24993
 
24984
24994
  // in server-side pagination we want to update the selection status
@@ -24997,6 +25007,14 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
24997
25007
  });
24998
25008
  }
24999
25009
  }, [selectionModel, page, pageSize]);
25010
+ useEffect(() => {
25011
+ if (paginationMode === 'server' && selectionStatusType === 'table' && !isPreviousData) {
25012
+ const selectableRowsInPage = getSelectableRowsInTable(apiRef, isRowSelectable);
25013
+ setTimeout(() => {
25014
+ apiRef.current.selectRows(selectableRowsInPage, false, true);
25015
+ }, 0);
25016
+ }
25017
+ }, [isPreviousData]);
25000
25018
  if (!Array.isArray(rows)) {
25001
25019
  return null;
25002
25020
  }