@redsift/table 10.3.0-muiv5-alpha.1 → 10.3.0-muiv5-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
|
@@ -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,
|
|
@@ -21686,20 +21686,23 @@ const TooltipTrigger = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
21686
21686
|
getReferenceProps,
|
|
21687
21687
|
refs,
|
|
21688
21688
|
tooltipId,
|
|
21689
|
-
triggerClassName
|
|
21689
|
+
triggerClassName,
|
|
21690
|
+
color
|
|
21690
21691
|
} = useTooltipContext();
|
|
21691
21692
|
const childrenRef = children.ref;
|
|
21692
21693
|
const triggerRef = useMergeRefs([refs.setReference, ref, childrenRef]);
|
|
21693
21694
|
if ( /*#__PURE__*/React__default.isValidElement(children)) {
|
|
21694
21695
|
var _children$props$child;
|
|
21695
|
-
return /*#__PURE__*/React__default.cloneElement(children, _objectSpread2({}, getReferenceProps(_objectSpread2(_objectSpread2(_objectSpread2({
|
|
21696
|
+
return /*#__PURE__*/React__default.cloneElement(children, _objectSpread2(_objectSpread2({}, getReferenceProps(_objectSpread2(_objectSpread2(_objectSpread2({
|
|
21696
21697
|
ref: triggerRef
|
|
21697
21698
|
}, props), {}, {
|
|
21698
21699
|
'aria-describedby': tooltipId
|
|
21699
21700
|
}, children.props), {}, {
|
|
21700
|
-
children: (_children$props$child = children.props.children) !== null && _children$props$child !== void 0 ? _children$props$child : ''
|
|
21701
|
-
|
|
21702
|
-
|
|
21701
|
+
children: (_children$props$child = children.props.children) !== null && _children$props$child !== void 0 ? _children$props$child : ''
|
|
21702
|
+
}))), {}, {
|
|
21703
|
+
className: classNames(children.props.className, triggerClassName),
|
|
21704
|
+
color: color !== null && color !== void 0 ? color : children.props.color
|
|
21705
|
+
}));
|
|
21703
21706
|
}
|
|
21704
21707
|
return /*#__PURE__*/React__default.createElement("span", _extends$2({
|
|
21705
21708
|
ref: triggerRef
|
|
@@ -21711,6 +21714,7 @@ TooltipTrigger.displayName = COMPONENT_NAME$4;
|
|
|
21711
21714
|
|
|
21712
21715
|
function useTooltip(_ref) {
|
|
21713
21716
|
let {
|
|
21717
|
+
color,
|
|
21714
21718
|
defaultOpen,
|
|
21715
21719
|
delay,
|
|
21716
21720
|
placement,
|
|
@@ -21763,13 +21767,14 @@ function useTooltip(_ref) {
|
|
|
21763
21767
|
});
|
|
21764
21768
|
const interactions = useInteractions([hover, focus, dismiss, role]);
|
|
21765
21769
|
return React__default.useMemo(() => _objectSpread2(_objectSpread2(_objectSpread2({
|
|
21770
|
+
color,
|
|
21766
21771
|
isOpen,
|
|
21767
21772
|
handleOpen
|
|
21768
21773
|
}, interactions), data), {}, {
|
|
21769
21774
|
arrowRef,
|
|
21770
21775
|
tooltipId,
|
|
21771
21776
|
triggerClassName
|
|
21772
|
-
}), [isOpen, handleOpen, interactions, data, arrowRef, tooltipId, triggerClassName]);
|
|
21777
|
+
}), [color, isOpen, handleOpen, interactions, data, arrowRef, tooltipId, triggerClassName]);
|
|
21773
21778
|
}
|
|
21774
21779
|
|
|
21775
21780
|
const ThemeContext = /*#__PURE__*/React__default.createContext(null);
|
|
@@ -21787,6 +21792,7 @@ const DEFAULT_PROPS$2 = {
|
|
|
21787
21792
|
*/
|
|
21788
21793
|
const BaseTooltip = props => {
|
|
21789
21794
|
const {
|
|
21795
|
+
color,
|
|
21790
21796
|
children,
|
|
21791
21797
|
defaultOpen,
|
|
21792
21798
|
delay,
|
|
@@ -21799,6 +21805,7 @@ const BaseTooltip = props => {
|
|
|
21799
21805
|
} = props;
|
|
21800
21806
|
const theme = useTheme$4 ? useTheme$4(propsTheme) : undefined;
|
|
21801
21807
|
const tooltip = useTooltip({
|
|
21808
|
+
color,
|
|
21802
21809
|
defaultOpen,
|
|
21803
21810
|
delay,
|
|
21804
21811
|
placement,
|
|
@@ -24717,9 +24724,18 @@ const onServerSideSelectionStatusChange = _ref => {
|
|
|
24717
24724
|
return;
|
|
24718
24725
|
}
|
|
24719
24726
|
if (selectionStatusType === 'page' && isSamePage && isSamePageSize && numberOfSelectedRowsInPage === numberOfSelectableRowsInPage) {
|
|
24727
|
+
setSelectionStatusType('none');
|
|
24728
|
+
selectionStatus.current = {
|
|
24729
|
+
type: 'none',
|
|
24730
|
+
numberOfSelectedRows,
|
|
24731
|
+
numberOfSelectedRowsInPage,
|
|
24732
|
+
page,
|
|
24733
|
+
pageSize
|
|
24734
|
+
};
|
|
24720
24735
|
setTimeout(() => {
|
|
24721
24736
|
apiRef.current.selectRows(selectedRowsInPage, false, false);
|
|
24722
24737
|
}, 0);
|
|
24738
|
+
return;
|
|
24723
24739
|
}
|
|
24724
24740
|
if (numberOfSelectedRowsInPage === numberOfSelectableRowsInPage && numberOfSelectableRowsInPage != 0) {
|
|
24725
24741
|
setSelectionStatusType('page');
|
|
@@ -24730,7 +24746,9 @@ const onServerSideSelectionStatusChange = _ref => {
|
|
|
24730
24746
|
page,
|
|
24731
24747
|
pageSize
|
|
24732
24748
|
};
|
|
24733
|
-
|
|
24749
|
+
return;
|
|
24750
|
+
}
|
|
24751
|
+
if (numberOfSelectedRows > 0) {
|
|
24734
24752
|
setSelectionStatusType('other');
|
|
24735
24753
|
selectionStatus.current = {
|
|
24736
24754
|
type: 'other',
|
|
@@ -24739,16 +24757,17 @@ const onServerSideSelectionStatusChange = _ref => {
|
|
|
24739
24757
|
page,
|
|
24740
24758
|
pageSize
|
|
24741
24759
|
};
|
|
24742
|
-
|
|
24743
|
-
setSelectionStatusType('none');
|
|
24744
|
-
selectionStatus.current = {
|
|
24745
|
-
type: 'none',
|
|
24746
|
-
numberOfSelectedRows,
|
|
24747
|
-
numberOfSelectedRowsInPage,
|
|
24748
|
-
page,
|
|
24749
|
-
pageSize
|
|
24750
|
-
};
|
|
24760
|
+
return;
|
|
24751
24761
|
}
|
|
24762
|
+
setSelectionStatusType('none');
|
|
24763
|
+
selectionStatus.current = {
|
|
24764
|
+
type: 'none',
|
|
24765
|
+
numberOfSelectedRows,
|
|
24766
|
+
numberOfSelectedRowsInPage,
|
|
24767
|
+
page,
|
|
24768
|
+
pageSize
|
|
24769
|
+
};
|
|
24770
|
+
return;
|
|
24752
24771
|
};
|
|
24753
24772
|
|
|
24754
24773
|
const getSelectableRowsInTable = (apiRef, isRowSelectable) => {
|
|
@@ -24819,7 +24838,7 @@ const ControlledPagination = _ref => {
|
|
|
24819
24838
|
};
|
|
24820
24839
|
|
|
24821
24840
|
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"];
|
|
24841
|
+
_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
24842
|
const COMPONENT_NAME$1 = 'DataGrid';
|
|
24824
24843
|
const CLASSNAME$1 = 'redsift-datagrid';
|
|
24825
24844
|
const DEFAULT_PROPS = {
|
|
@@ -24913,7 +24932,8 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24913
24932
|
theme: propsTheme,
|
|
24914
24933
|
paginationMode = 'client',
|
|
24915
24934
|
rowCount,
|
|
24916
|
-
onSelectionStatusChange: propsOnSelectionStatusChange
|
|
24935
|
+
onSelectionStatusChange: propsOnSelectionStatusChange,
|
|
24936
|
+
isPreviousData
|
|
24917
24937
|
} = props,
|
|
24918
24938
|
forwardedProps = _objectWithoutProperties(props, _excluded2);
|
|
24919
24939
|
const theme = useTheme$4(propsTheme);
|
|
@@ -24972,13 +24992,10 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24972
24992
|
setPageSize(propsPageSize);
|
|
24973
24993
|
}
|
|
24974
24994
|
}, [propsPageSize]);
|
|
24975
|
-
|
|
24995
|
+
useEffect(() => {
|
|
24976
24996
|
if (propsOnSelectionStatusChange) {
|
|
24977
24997
|
propsOnSelectionStatusChange(selectionStatusType);
|
|
24978
24998
|
}
|
|
24979
|
-
};
|
|
24980
|
-
useEffect(() => {
|
|
24981
|
-
onSelectionStatusChange(selectionStatusType);
|
|
24982
24999
|
}, [selectionStatusType]);
|
|
24983
25000
|
|
|
24984
25001
|
// in server-side pagination we want to update the selection status
|
|
@@ -24997,6 +25014,14 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24997
25014
|
});
|
|
24998
25015
|
}
|
|
24999
25016
|
}, [selectionModel, page, pageSize]);
|
|
25017
|
+
useEffect(() => {
|
|
25018
|
+
if (paginationMode === 'server' && selectionStatusType === 'table' && !isPreviousData) {
|
|
25019
|
+
const selectableRowsInPage = getSelectableRowsInTable(apiRef, isRowSelectable);
|
|
25020
|
+
setTimeout(() => {
|
|
25021
|
+
apiRef.current.selectRows(selectableRowsInPage, false, true);
|
|
25022
|
+
}, 0);
|
|
25023
|
+
}
|
|
25024
|
+
}, [isPreviousData]);
|
|
25000
25025
|
if (!Array.isArray(rows)) {
|
|
25001
25026
|
return null;
|
|
25002
25027
|
}
|