@redsift/table 10.3.0-alpha.1 → 10.3.0-alpha.3
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 +50 -25
- 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,
|
|
@@ -21687,20 +21687,23 @@ const TooltipTrigger = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
21687
21687
|
getReferenceProps,
|
|
21688
21688
|
refs,
|
|
21689
21689
|
tooltipId,
|
|
21690
|
-
triggerClassName
|
|
21690
|
+
triggerClassName,
|
|
21691
|
+
color
|
|
21691
21692
|
} = useTooltipContext();
|
|
21692
21693
|
const childrenRef = children.ref;
|
|
21693
21694
|
const triggerRef = useMergeRefs([refs.setReference, ref, childrenRef]);
|
|
21694
21695
|
if ( /*#__PURE__*/React__default.isValidElement(children)) {
|
|
21695
21696
|
var _children$props$child;
|
|
21696
|
-
return /*#__PURE__*/React__default.cloneElement(children, _objectSpread2({}, getReferenceProps(_objectSpread2(_objectSpread2(_objectSpread2({
|
|
21697
|
+
return /*#__PURE__*/React__default.cloneElement(children, _objectSpread2(_objectSpread2({}, getReferenceProps(_objectSpread2(_objectSpread2(_objectSpread2({
|
|
21697
21698
|
ref: triggerRef
|
|
21698
21699
|
}, props), {}, {
|
|
21699
21700
|
'aria-describedby': tooltipId
|
|
21700
21701
|
}, children.props), {}, {
|
|
21701
|
-
children: (_children$props$child = children.props.children) !== null && _children$props$child !== void 0 ? _children$props$child : ''
|
|
21702
|
-
|
|
21703
|
-
|
|
21702
|
+
children: (_children$props$child = children.props.children) !== null && _children$props$child !== void 0 ? _children$props$child : ''
|
|
21703
|
+
}))), {}, {
|
|
21704
|
+
className: classNames(children.props.className, triggerClassName),
|
|
21705
|
+
color: color !== null && color !== void 0 ? color : children.props.color
|
|
21706
|
+
}));
|
|
21704
21707
|
}
|
|
21705
21708
|
return /*#__PURE__*/React__default.createElement("span", _extends$2({
|
|
21706
21709
|
ref: triggerRef
|
|
@@ -21712,6 +21715,7 @@ TooltipTrigger.displayName = COMPONENT_NAME$4;
|
|
|
21712
21715
|
|
|
21713
21716
|
function useTooltip(_ref) {
|
|
21714
21717
|
let {
|
|
21718
|
+
color,
|
|
21715
21719
|
defaultOpen,
|
|
21716
21720
|
delay,
|
|
21717
21721
|
placement,
|
|
@@ -21764,13 +21768,14 @@ function useTooltip(_ref) {
|
|
|
21764
21768
|
});
|
|
21765
21769
|
const interactions = useInteractions([hover, focus, dismiss, role]);
|
|
21766
21770
|
return React__default.useMemo(() => _objectSpread2(_objectSpread2(_objectSpread2({
|
|
21771
|
+
color,
|
|
21767
21772
|
isOpen,
|
|
21768
21773
|
handleOpen
|
|
21769
21774
|
}, interactions), data), {}, {
|
|
21770
21775
|
arrowRef,
|
|
21771
21776
|
tooltipId,
|
|
21772
21777
|
triggerClassName
|
|
21773
|
-
}), [isOpen, handleOpen, interactions, data, arrowRef, tooltipId, triggerClassName]);
|
|
21778
|
+
}), [color, isOpen, handleOpen, interactions, data, arrowRef, tooltipId, triggerClassName]);
|
|
21774
21779
|
}
|
|
21775
21780
|
|
|
21776
21781
|
const ThemeContext = /*#__PURE__*/React__default.createContext(null);
|
|
@@ -21788,6 +21793,7 @@ const DEFAULT_PROPS$2 = {
|
|
|
21788
21793
|
*/
|
|
21789
21794
|
const BaseTooltip = props => {
|
|
21790
21795
|
const {
|
|
21796
|
+
color,
|
|
21791
21797
|
children,
|
|
21792
21798
|
defaultOpen,
|
|
21793
21799
|
delay,
|
|
@@ -21800,6 +21806,7 @@ const BaseTooltip = props => {
|
|
|
21800
21806
|
} = props;
|
|
21801
21807
|
const theme = useTheme$4 ? useTheme$4(propsTheme) : undefined;
|
|
21802
21808
|
const tooltip = useTooltip({
|
|
21809
|
+
color,
|
|
21803
21810
|
defaultOpen,
|
|
21804
21811
|
delay,
|
|
21805
21812
|
placement,
|
|
@@ -24720,9 +24727,18 @@ const onServerSideSelectionStatusChange = _ref => {
|
|
|
24720
24727
|
return;
|
|
24721
24728
|
}
|
|
24722
24729
|
if (selectionStatusType === 'page' && isSamePage && isSamePageSize && numberOfSelectedRowsInPage === numberOfSelectableRowsInPage) {
|
|
24730
|
+
setSelectionStatusType('none');
|
|
24731
|
+
selectionStatus.current = {
|
|
24732
|
+
type: 'none',
|
|
24733
|
+
numberOfSelectedRows,
|
|
24734
|
+
numberOfSelectedRowsInPage,
|
|
24735
|
+
page,
|
|
24736
|
+
pageSize
|
|
24737
|
+
};
|
|
24723
24738
|
setTimeout(() => {
|
|
24724
24739
|
apiRef.current.selectRows(selectedRowsInPage, false, false);
|
|
24725
24740
|
}, 0);
|
|
24741
|
+
return;
|
|
24726
24742
|
}
|
|
24727
24743
|
if (numberOfSelectedRowsInPage === numberOfSelectableRowsInPage && numberOfSelectableRowsInPage != 0) {
|
|
24728
24744
|
setSelectionStatusType('page');
|
|
@@ -24733,7 +24749,9 @@ const onServerSideSelectionStatusChange = _ref => {
|
|
|
24733
24749
|
page,
|
|
24734
24750
|
pageSize
|
|
24735
24751
|
};
|
|
24736
|
-
|
|
24752
|
+
return;
|
|
24753
|
+
}
|
|
24754
|
+
if (numberOfSelectedRows > 0) {
|
|
24737
24755
|
setSelectionStatusType('other');
|
|
24738
24756
|
selectionStatus.current = {
|
|
24739
24757
|
type: 'other',
|
|
@@ -24742,16 +24760,17 @@ const onServerSideSelectionStatusChange = _ref => {
|
|
|
24742
24760
|
page,
|
|
24743
24761
|
pageSize
|
|
24744
24762
|
};
|
|
24745
|
-
|
|
24746
|
-
setSelectionStatusType('none');
|
|
24747
|
-
selectionStatus.current = {
|
|
24748
|
-
type: 'none',
|
|
24749
|
-
numberOfSelectedRows,
|
|
24750
|
-
numberOfSelectedRowsInPage,
|
|
24751
|
-
page,
|
|
24752
|
-
pageSize
|
|
24753
|
-
};
|
|
24763
|
+
return;
|
|
24754
24764
|
}
|
|
24765
|
+
setSelectionStatusType('none');
|
|
24766
|
+
selectionStatus.current = {
|
|
24767
|
+
type: 'none',
|
|
24768
|
+
numberOfSelectedRows,
|
|
24769
|
+
numberOfSelectedRowsInPage,
|
|
24770
|
+
page,
|
|
24771
|
+
pageSize
|
|
24772
|
+
};
|
|
24773
|
+
return;
|
|
24755
24774
|
};
|
|
24756
24775
|
|
|
24757
24776
|
const getSelectableRowsInTable = (apiRef, isRowSelectable) => {
|
|
@@ -24824,7 +24843,7 @@ const ControlledPagination = _ref => {
|
|
|
24824
24843
|
};
|
|
24825
24844
|
|
|
24826
24845
|
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"];
|
|
24846
|
+
_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
24847
|
const COMPONENT_NAME$1 = 'DataGrid';
|
|
24829
24848
|
const CLASSNAME$1 = 'redsift-datagrid';
|
|
24830
24849
|
const DEFAULT_PROPS = {
|
|
@@ -24910,7 +24929,8 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24910
24929
|
theme: propsTheme,
|
|
24911
24930
|
paginationMode = 'client',
|
|
24912
24931
|
rowCount,
|
|
24913
|
-
onSelectionStatusChange: propsOnSelectionStatusChange
|
|
24932
|
+
onSelectionStatusChange: propsOnSelectionStatusChange,
|
|
24933
|
+
isPreviousData
|
|
24914
24934
|
} = props,
|
|
24915
24935
|
forwardedProps = _objectWithoutProperties(props, _excluded2);
|
|
24916
24936
|
const theme = useTheme$4(propsTheme);
|
|
@@ -24958,13 +24978,10 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24958
24978
|
page: paginationModel.page,
|
|
24959
24979
|
pageSize: paginationModel.pageSize
|
|
24960
24980
|
});
|
|
24961
|
-
|
|
24981
|
+
useEffect(() => {
|
|
24962
24982
|
if (propsOnSelectionStatusChange) {
|
|
24963
24983
|
propsOnSelectionStatusChange(selectionStatusType);
|
|
24964
24984
|
}
|
|
24965
|
-
};
|
|
24966
|
-
useEffect(() => {
|
|
24967
|
-
onSelectionStatusChange(selectionStatusType);
|
|
24968
24985
|
}, [selectionStatusType]);
|
|
24969
24986
|
|
|
24970
24987
|
// in server-side pagination we want to update the selection status
|
|
@@ -24983,6 +25000,14 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24983
25000
|
});
|
|
24984
25001
|
}
|
|
24985
25002
|
}, [rowSelectionModel, paginationModel.page, paginationModel.pageSize]);
|
|
25003
|
+
useEffect(() => {
|
|
25004
|
+
if (paginationMode === 'server' && selectionStatusType === 'table' && !isPreviousData) {
|
|
25005
|
+
const selectableRowsInPage = getSelectableRowsInTable(apiRef, isRowSelectable);
|
|
25006
|
+
setTimeout(() => {
|
|
25007
|
+
apiRef.current.selectRows(selectableRowsInPage, false, true);
|
|
25008
|
+
}, 0);
|
|
25009
|
+
}
|
|
25010
|
+
}, [isPreviousData]);
|
|
24986
25011
|
if (!Array.isArray(rows)) {
|
|
24987
25012
|
return null;
|
|
24988
25013
|
}
|