@redsift/table 9.2.2 → 9.2.3-muiv5
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/index.d.ts +2 -3
- package/index.js +278 -85
- package/index.js.map +1 -1
- package/package.json +4 -4
package/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as _mui_x_data_grid_pro from '@mui/x-data-grid-pro';
|
|
2
2
|
import { GridFilterItem, GridCellParams, GridFilterOperator, GridFilterInputMultipleValue, DataGridProProps, GridToolbarExportProps, GridToolbarFilterButtonProps, GridFilterModel, GridToolbarColumnsButton, GridToolbarDensitySelector } from '@mui/x-data-grid-pro';
|
|
3
|
-
export
|
|
4
|
-
export { GridAlignment, GridColDef, GridFilterItem, GridFilterModel, getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators } from '@mui/x-data-grid-pro';
|
|
3
|
+
export { GridAlignment, GridColDef, GridColumns, GridFilterItem, GridFilterModel, GridSelectionModel, getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators } from '@mui/x-data-grid-pro';
|
|
5
4
|
import { Comp, IconProps, NotificationsColorPalette, ProductColorPalette, ShieldVariant } from '@redsift/design-system';
|
|
6
5
|
import React, { ReactNode, RefObject, ComponentProps } from 'react';
|
|
7
6
|
import { TablePaginationProps } from '@mui/material';
|
|
@@ -11,7 +10,7 @@ declare const DETAIL_PANEL_TOGGLE_COL_DEF: _mui_x_data_grid_pro.GridColDef<any,
|
|
|
11
10
|
declare const IS_BETWEEN: {
|
|
12
11
|
label: string;
|
|
13
12
|
value: string;
|
|
14
|
-
getApplyFilterFn: (filterItem: GridFilterItem) => ((params: GridCellParams
|
|
13
|
+
getApplyFilterFn: (filterItem: GridFilterItem) => ((params: GridCellParams) => boolean) | null;
|
|
15
14
|
InputComponent: (props: any) => JSX.Element;
|
|
16
15
|
};
|
|
17
16
|
|
package/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { GRID_DETAIL_PANEL_TOGGLE_COL_DEF, getGridNumericOperators as getGridNumericOperators$1, GridFilterInputMultipleValue, getGridStringOperators as getGridStringOperators$1, GridToolbarContainer, GridToolbarFilterButton, GridToolbarColumnsButton, GridToolbarDensitySelector, GridToolbarExport,
|
|
2
|
-
export * from '@mui/x-data-grid-pro';
|
|
1
|
+
import { GRID_DETAIL_PANEL_TOGGLE_COL_DEF, getGridNumericOperators as getGridNumericOperators$1, GridFilterInputMultipleValue, getGridStringOperators as getGridStringOperators$1, GridToolbarContainer, GridToolbarFilterButton, GridToolbarColumnsButton, GridToolbarDensitySelector, GridToolbarExport, gridVisibleSortedRowIdsSelector, useGridApiRef, DataGridPro, gridPaginatedVisibleSortedGridRowEntriesSelector, gridPaginatedVisibleSortedGridRowIdsSelector, gridFilteredSortedRowEntriesSelector, gridFilteredSortedRowIdsSelector } from '@mui/x-data-grid-pro';
|
|
3
2
|
export { getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators } from '@mui/x-data-grid-pro';
|
|
4
3
|
import * as React from 'react';
|
|
5
4
|
import React__default, { Children, isValidElement, cloneElement, useLayoutEffect, useEffect, useRef, forwardRef, useState, useCallback, createElement } from 'react';
|
|
@@ -17467,7 +17466,7 @@ const isBetweenOperator = {
|
|
|
17467
17466
|
label: 'is between',
|
|
17468
17467
|
value: 'isBetween',
|
|
17469
17468
|
getApplyFilterFn: filterItem => {
|
|
17470
|
-
if (!filterItem.
|
|
17469
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17471
17470
|
return null;
|
|
17472
17471
|
}
|
|
17473
17472
|
if (!Array.isArray(filterItem.value) || filterItem.value.length !== 2) {
|
|
@@ -17480,7 +17479,7 @@ const isBetweenOperator = {
|
|
|
17480
17479
|
return null;
|
|
17481
17480
|
}
|
|
17482
17481
|
return params => {
|
|
17483
|
-
return params.value !== null &&
|
|
17482
|
+
return params.value !== null && filterItem.value[0] <= params.value && params.value <= filterItem.value[1];
|
|
17484
17483
|
};
|
|
17485
17484
|
},
|
|
17486
17485
|
InputComponent: InputNumberInterval
|
|
@@ -17493,7 +17492,7 @@ const containsAnyOfOperator = {
|
|
|
17493
17492
|
label: 'contains any of',
|
|
17494
17493
|
value: 'containsAnyOf',
|
|
17495
17494
|
getApplyFilterFn: filterItem => {
|
|
17496
|
-
if (!filterItem.
|
|
17495
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17497
17496
|
return null;
|
|
17498
17497
|
}
|
|
17499
17498
|
return params => {
|
|
@@ -17518,7 +17517,7 @@ const endsWithAnyOfOperator = {
|
|
|
17518
17517
|
label: 'ends with any of',
|
|
17519
17518
|
value: 'endsWithAnyOf',
|
|
17520
17519
|
getApplyFilterFn: filterItem => {
|
|
17521
|
-
if (!filterItem.
|
|
17520
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17522
17521
|
return null;
|
|
17523
17522
|
}
|
|
17524
17523
|
return params => {
|
|
@@ -17545,7 +17544,7 @@ const isAnyOfOperator = {
|
|
|
17545
17544
|
label: 'is any of',
|
|
17546
17545
|
value: 'isAnyOf',
|
|
17547
17546
|
getApplyFilterFn: filterItem => {
|
|
17548
|
-
if (!filterItem.
|
|
17547
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17549
17548
|
return null;
|
|
17550
17549
|
}
|
|
17551
17550
|
return params => {
|
|
@@ -17569,7 +17568,7 @@ const isNotAnyOfOperator = {
|
|
|
17569
17568
|
label: 'is not any of',
|
|
17570
17569
|
value: 'isNotAnyOf',
|
|
17571
17570
|
getApplyFilterFn: filterItem => {
|
|
17572
|
-
if (!filterItem.
|
|
17571
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17573
17572
|
return null;
|
|
17574
17573
|
}
|
|
17575
17574
|
return params => {
|
|
@@ -17593,7 +17592,7 @@ const startsWithAnyOfOperator = {
|
|
|
17593
17592
|
label: 'starts with any of',
|
|
17594
17593
|
value: 'startsWithAnyOf',
|
|
17595
17594
|
getApplyFilterFn: filterItem => {
|
|
17596
|
-
if (!filterItem.
|
|
17595
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17597
17596
|
return null;
|
|
17598
17597
|
}
|
|
17599
17598
|
return params => {
|
|
@@ -20976,6 +20975,182 @@ const useRole = function (_ref, _temp) {
|
|
|
20976
20975
|
}, [enabled, role, open, rootId, referenceId]);
|
|
20977
20976
|
};
|
|
20978
20977
|
|
|
20978
|
+
function isPointInPolygon(point, polygon) {
|
|
20979
|
+
const [x, y] = point;
|
|
20980
|
+
let isInside = false;
|
|
20981
|
+
const length = polygon.length;
|
|
20982
|
+
for (let i = 0, j = length - 1; i < length; j = i++) {
|
|
20983
|
+
const [xi, yi] = polygon[i] || [0, 0];
|
|
20984
|
+
const [xj, yj] = polygon[j] || [0, 0];
|
|
20985
|
+
const intersect = yi >= y !== yj >= y && x <= (xj - xi) * (y - yi) / (yj - yi) + xi;
|
|
20986
|
+
if (intersect) {
|
|
20987
|
+
isInside = !isInside;
|
|
20988
|
+
}
|
|
20989
|
+
}
|
|
20990
|
+
return isInside;
|
|
20991
|
+
}
|
|
20992
|
+
function isInside(point, rect) {
|
|
20993
|
+
return point[0] >= rect.x && point[0] <= rect.x + rect.width && point[1] >= rect.y && point[1] <= rect.y + rect.height;
|
|
20994
|
+
}
|
|
20995
|
+
function safePolygon(_temp) {
|
|
20996
|
+
let {
|
|
20997
|
+
restMs = 0,
|
|
20998
|
+
buffer = 0.5,
|
|
20999
|
+
blockPointerEvents = false
|
|
21000
|
+
} = _temp === void 0 ? {} : _temp;
|
|
21001
|
+
let timeoutId;
|
|
21002
|
+
let isInsideRect = false;
|
|
21003
|
+
let hasLanded = false;
|
|
21004
|
+
const fn = _ref => {
|
|
21005
|
+
let {
|
|
21006
|
+
x,
|
|
21007
|
+
y,
|
|
21008
|
+
placement,
|
|
21009
|
+
elements,
|
|
21010
|
+
onClose,
|
|
21011
|
+
nodeId,
|
|
21012
|
+
tree
|
|
21013
|
+
} = _ref;
|
|
21014
|
+
return function onMouseMove(event) {
|
|
21015
|
+
function close() {
|
|
21016
|
+
clearTimeout(timeoutId);
|
|
21017
|
+
onClose();
|
|
21018
|
+
}
|
|
21019
|
+
clearTimeout(timeoutId);
|
|
21020
|
+
if (!elements.domReference || !elements.floating || placement == null || x == null || y == null) {
|
|
21021
|
+
return;
|
|
21022
|
+
}
|
|
21023
|
+
const {
|
|
21024
|
+
clientX,
|
|
21025
|
+
clientY
|
|
21026
|
+
} = event;
|
|
21027
|
+
const clientPoint = [clientX, clientY];
|
|
21028
|
+
const target = getTarget(event);
|
|
21029
|
+
const isLeave = event.type === 'mouseleave';
|
|
21030
|
+
const isOverFloatingEl = contains(elements.floating, target);
|
|
21031
|
+
const isOverReferenceEl = contains(elements.domReference, target);
|
|
21032
|
+
const refRect = elements.domReference.getBoundingClientRect();
|
|
21033
|
+
const rect = elements.floating.getBoundingClientRect();
|
|
21034
|
+
const side = placement.split('-')[0];
|
|
21035
|
+
const cursorLeaveFromRight = x > rect.right - rect.width / 2;
|
|
21036
|
+
const cursorLeaveFromBottom = y > rect.bottom - rect.height / 2;
|
|
21037
|
+
const isOverReferenceRect = isInside(clientPoint, refRect);
|
|
21038
|
+
if (isOverFloatingEl) {
|
|
21039
|
+
hasLanded = true;
|
|
21040
|
+
if (!isLeave) {
|
|
21041
|
+
return;
|
|
21042
|
+
}
|
|
21043
|
+
}
|
|
21044
|
+
if (isOverReferenceEl) {
|
|
21045
|
+
hasLanded = false;
|
|
21046
|
+
}
|
|
21047
|
+
if (isOverReferenceEl && !isLeave) {
|
|
21048
|
+
hasLanded = true;
|
|
21049
|
+
return;
|
|
21050
|
+
}
|
|
21051
|
+
|
|
21052
|
+
// Prevent overlapping floating element from being stuck in an open-close
|
|
21053
|
+
// loop: https://github.com/floating-ui/floating-ui/issues/1910
|
|
21054
|
+
if (isLeave && isElement(event.relatedTarget) && contains(elements.floating, event.relatedTarget)) {
|
|
21055
|
+
return;
|
|
21056
|
+
}
|
|
21057
|
+
|
|
21058
|
+
// If any nested child is open, abort.
|
|
21059
|
+
if (tree && getChildren(tree.nodesRef.current, nodeId).some(_ref2 => {
|
|
21060
|
+
let {
|
|
21061
|
+
context
|
|
21062
|
+
} = _ref2;
|
|
21063
|
+
return context == null ? void 0 : context.open;
|
|
21064
|
+
})) {
|
|
21065
|
+
return;
|
|
21066
|
+
}
|
|
21067
|
+
|
|
21068
|
+
// If the pointer is leaving from the opposite side, the "buffer" logic
|
|
21069
|
+
// creates a point where the floating element remains open, but should be
|
|
21070
|
+
// ignored.
|
|
21071
|
+
// A constant of 1 handles floating point rounding errors.
|
|
21072
|
+
if (side === 'top' && y >= refRect.bottom - 1 || side === 'bottom' && y <= refRect.top + 1 || side === 'left' && x >= refRect.right - 1 || side === 'right' && x <= refRect.left + 1) {
|
|
21073
|
+
return close();
|
|
21074
|
+
}
|
|
21075
|
+
|
|
21076
|
+
// Ignore when the cursor is within the rectangular trough between the
|
|
21077
|
+
// two elements. Since the triangle is created from the cursor point,
|
|
21078
|
+
// which can start beyond the ref element's edge, traversing back and
|
|
21079
|
+
// forth from the ref to the floating element can cause it to close. This
|
|
21080
|
+
// ensures it always remains open in that case.
|
|
21081
|
+
let rectPoly = [];
|
|
21082
|
+
switch (side) {
|
|
21083
|
+
case 'top':
|
|
21084
|
+
rectPoly = [[rect.left, refRect.top + 1], [rect.left, rect.bottom - 1], [rect.right, rect.bottom - 1], [rect.right, refRect.top + 1]];
|
|
21085
|
+
isInsideRect = clientX >= rect.left && clientX <= rect.right && clientY >= rect.top && clientY <= refRect.top + 1;
|
|
21086
|
+
break;
|
|
21087
|
+
case 'bottom':
|
|
21088
|
+
rectPoly = [[rect.left, rect.top + 1], [rect.left, refRect.bottom - 1], [rect.right, refRect.bottom - 1], [rect.right, rect.top + 1]];
|
|
21089
|
+
isInsideRect = clientX >= rect.left && clientX <= rect.right && clientY >= refRect.bottom - 1 && clientY <= rect.bottom;
|
|
21090
|
+
break;
|
|
21091
|
+
case 'left':
|
|
21092
|
+
rectPoly = [[rect.right - 1, rect.bottom], [rect.right - 1, rect.top], [refRect.left + 1, rect.top], [refRect.left + 1, rect.bottom]];
|
|
21093
|
+
isInsideRect = clientX >= rect.left && clientX <= refRect.left + 1 && clientY >= rect.top && clientY <= rect.bottom;
|
|
21094
|
+
break;
|
|
21095
|
+
case 'right':
|
|
21096
|
+
rectPoly = [[refRect.right - 1, rect.bottom], [refRect.right - 1, rect.top], [rect.left + 1, rect.top], [rect.left + 1, rect.bottom]];
|
|
21097
|
+
isInsideRect = clientX >= refRect.right - 1 && clientX <= rect.right && clientY >= rect.top && clientY <= rect.bottom;
|
|
21098
|
+
break;
|
|
21099
|
+
}
|
|
21100
|
+
function getPolygon(_ref3) {
|
|
21101
|
+
let [x, y] = _ref3;
|
|
21102
|
+
const isFloatingWider = rect.width > refRect.width;
|
|
21103
|
+
const isFloatingTaller = rect.height > refRect.height;
|
|
21104
|
+
switch (side) {
|
|
21105
|
+
case 'top':
|
|
21106
|
+
{
|
|
21107
|
+
const cursorPointOne = [isFloatingWider ? x + buffer / 2 : cursorLeaveFromRight ? x + buffer * 4 : x - buffer * 4, y + buffer + 1];
|
|
21108
|
+
const cursorPointTwo = [isFloatingWider ? x - buffer / 2 : cursorLeaveFromRight ? x + buffer * 4 : x - buffer * 4, y + buffer + 1];
|
|
21109
|
+
const commonPoints = [[rect.left, cursorLeaveFromRight ? rect.bottom - buffer : isFloatingWider ? rect.bottom - buffer : rect.top], [rect.right, cursorLeaveFromRight ? isFloatingWider ? rect.bottom - buffer : rect.top : rect.bottom - buffer]];
|
|
21110
|
+
return [cursorPointOne, cursorPointTwo, ...commonPoints];
|
|
21111
|
+
}
|
|
21112
|
+
case 'bottom':
|
|
21113
|
+
{
|
|
21114
|
+
const cursorPointOne = [isFloatingWider ? x + buffer / 2 : cursorLeaveFromRight ? x + buffer * 4 : x - buffer * 4, y - buffer];
|
|
21115
|
+
const cursorPointTwo = [isFloatingWider ? x - buffer / 2 : cursorLeaveFromRight ? x + buffer * 4 : x - buffer * 4, y - buffer];
|
|
21116
|
+
const commonPoints = [[rect.left, cursorLeaveFromRight ? rect.top + buffer : isFloatingWider ? rect.top + buffer : rect.bottom], [rect.right, cursorLeaveFromRight ? isFloatingWider ? rect.top + buffer : rect.bottom : rect.top + buffer]];
|
|
21117
|
+
return [cursorPointOne, cursorPointTwo, ...commonPoints];
|
|
21118
|
+
}
|
|
21119
|
+
case 'left':
|
|
21120
|
+
{
|
|
21121
|
+
const cursorPointOne = [x + buffer + 1, isFloatingTaller ? y + buffer / 2 : cursorLeaveFromBottom ? y + buffer * 4 : y - buffer * 4];
|
|
21122
|
+
const cursorPointTwo = [x + buffer + 1, isFloatingTaller ? y - buffer / 2 : cursorLeaveFromBottom ? y + buffer * 4 : y - buffer * 4];
|
|
21123
|
+
const commonPoints = [[cursorLeaveFromBottom ? rect.right - buffer : isFloatingTaller ? rect.right - buffer : rect.left, rect.top], [cursorLeaveFromBottom ? isFloatingTaller ? rect.right - buffer : rect.left : rect.right - buffer, rect.bottom]];
|
|
21124
|
+
return [...commonPoints, cursorPointOne, cursorPointTwo];
|
|
21125
|
+
}
|
|
21126
|
+
case 'right':
|
|
21127
|
+
{
|
|
21128
|
+
const cursorPointOne = [x - buffer, isFloatingTaller ? y + buffer / 2 : cursorLeaveFromBottom ? y + buffer * 4 : y - buffer * 4];
|
|
21129
|
+
const cursorPointTwo = [x - buffer, isFloatingTaller ? y - buffer / 2 : cursorLeaveFromBottom ? y + buffer * 4 : y - buffer * 4];
|
|
21130
|
+
const commonPoints = [[cursorLeaveFromBottom ? rect.left + buffer : isFloatingTaller ? rect.left + buffer : rect.right, rect.top], [cursorLeaveFromBottom ? isFloatingTaller ? rect.left + buffer : rect.right : rect.left + buffer, rect.bottom]];
|
|
21131
|
+
return [cursorPointOne, cursorPointTwo, ...commonPoints];
|
|
21132
|
+
}
|
|
21133
|
+
}
|
|
21134
|
+
}
|
|
21135
|
+
const poly = isInsideRect ? rectPoly : getPolygon([x, y]);
|
|
21136
|
+
if (isInsideRect) {
|
|
21137
|
+
return;
|
|
21138
|
+
} else if (hasLanded && !isOverReferenceRect) {
|
|
21139
|
+
return close();
|
|
21140
|
+
}
|
|
21141
|
+
if (!isPointInPolygon([clientX, clientY], poly)) {
|
|
21142
|
+
close();
|
|
21143
|
+
} else if (restMs && !hasLanded) {
|
|
21144
|
+
timeoutId = setTimeout(close, restMs);
|
|
21145
|
+
}
|
|
21146
|
+
};
|
|
21147
|
+
};
|
|
21148
|
+
fn.__options = {
|
|
21149
|
+
blockPointerEvents
|
|
21150
|
+
};
|
|
21151
|
+
return fn;
|
|
21152
|
+
}
|
|
21153
|
+
|
|
20979
21154
|
/**
|
|
20980
21155
|
* Provides data to position a floating element and context to add interactions.
|
|
20981
21156
|
* @see https://floating-ui.com/docs/react
|
|
@@ -21374,7 +21549,8 @@ function useTooltip(_ref) {
|
|
|
21374
21549
|
delay: {
|
|
21375
21550
|
open: delay,
|
|
21376
21551
|
close: 0
|
|
21377
|
-
}
|
|
21552
|
+
},
|
|
21553
|
+
handleClose: safePolygon()
|
|
21378
21554
|
});
|
|
21379
21555
|
const focus = useFocus(context);
|
|
21380
21556
|
const dismiss = useDismiss(context);
|
|
@@ -21710,7 +21886,7 @@ const Toolbar$2 = props => {
|
|
|
21710
21886
|
let {
|
|
21711
21887
|
apiRef
|
|
21712
21888
|
} = _ref;
|
|
21713
|
-
return
|
|
21889
|
+
return gridVisibleSortedRowIdsSelector(apiRef);
|
|
21714
21890
|
}
|
|
21715
21891
|
},
|
|
21716
21892
|
printOptions: {
|
|
@@ -24165,7 +24341,7 @@ process.env.NODE_ENV !== "production" ? TablePagination.propTypes /* remove-prop
|
|
|
24165
24341
|
} : void 0;
|
|
24166
24342
|
var TablePagination$1 = TablePagination;
|
|
24167
24343
|
|
|
24168
|
-
const _excluded$1 = ["apiRef", "autoHeight", "className", "
|
|
24344
|
+
const _excluded$1 = ["apiRef", "autoHeight", "className", "components", "componentsProps", "filterModel", "height", "hideToolbar", "initialState", "isRowSelectable", "license", "onFilterModelChange", "onPageChange", "onPageSizeChange", "onSelectionModelChange", "page", "pageSize", "pagination", "paginationPlacement", "paginationProps", "rows", "rowsPerPageOptions", "sx"];
|
|
24169
24345
|
const COMPONENT_NAME$1 = 'DataGrid';
|
|
24170
24346
|
const CLASSNAME$1 = 'redsift-datagrid';
|
|
24171
24347
|
const DEFAULT_PROPS = {
|
|
@@ -24194,9 +24370,11 @@ const ControlledPagination = _ref3 => {
|
|
|
24194
24370
|
displayPagination = false,
|
|
24195
24371
|
selectionStatus,
|
|
24196
24372
|
apiRef,
|
|
24197
|
-
|
|
24198
|
-
|
|
24199
|
-
|
|
24373
|
+
page,
|
|
24374
|
+
onPageChange,
|
|
24375
|
+
pageSize,
|
|
24376
|
+
onPageSizeChange,
|
|
24377
|
+
rowsPerPageOptions,
|
|
24200
24378
|
isRowSelectable,
|
|
24201
24379
|
paginationProps
|
|
24202
24380
|
} = _ref3;
|
|
@@ -24226,28 +24404,24 @@ const ControlledPagination = _ref3 => {
|
|
|
24226
24404
|
}, `${selectionStatus.numberOfSelectedRows} row${selectionStatus.numberOfSelectedRows > 1 ? 's' : ''} selected`) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$2({
|
|
24227
24405
|
component: "div",
|
|
24228
24406
|
count: numberOfFilteredRowsInTable,
|
|
24229
|
-
page:
|
|
24230
|
-
onPageChange: (event,
|
|
24231
|
-
|
|
24232
|
-
|
|
24233
|
-
|
|
24234
|
-
|
|
24235
|
-
|
|
24236
|
-
page: paginationModel.page,
|
|
24237
|
-
pageSize: parseInt(event.target.value, 10)
|
|
24238
|
-
}),
|
|
24239
|
-
rowsPerPageOptions: displayRowsPerPage ? pageSizeOptions : []
|
|
24407
|
+
page: page,
|
|
24408
|
+
onPageChange: (event, newPage) => onPageChange(newPage),
|
|
24409
|
+
rowsPerPage: pageSize,
|
|
24410
|
+
onRowsPerPageChange: event => {
|
|
24411
|
+
onPageSizeChange(parseInt(event.target.value, 10));
|
|
24412
|
+
},
|
|
24413
|
+
rowsPerPageOptions: displayRowsPerPage ? rowsPerPageOptions : []
|
|
24240
24414
|
}, paginationProps)) : null);
|
|
24241
24415
|
};
|
|
24242
24416
|
const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
24243
|
-
var
|
|
24417
|
+
var _initialState$paginat, _initialState$paginat2;
|
|
24244
24418
|
const datagridRef = ref || useRef();
|
|
24245
24419
|
const {
|
|
24246
24420
|
apiRef: propsApiRef,
|
|
24247
24421
|
autoHeight,
|
|
24248
24422
|
className,
|
|
24249
|
-
|
|
24250
|
-
|
|
24423
|
+
components,
|
|
24424
|
+
componentsProps,
|
|
24251
24425
|
filterModel: propsFilterModel,
|
|
24252
24426
|
height: propsHeight,
|
|
24253
24427
|
hideToolbar,
|
|
@@ -24255,20 +24429,22 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24255
24429
|
isRowSelectable,
|
|
24256
24430
|
license,
|
|
24257
24431
|
onFilterModelChange: propsOnFilterModelChange,
|
|
24258
|
-
|
|
24259
|
-
|
|
24260
|
-
|
|
24432
|
+
onPageChange: propsOnPageChange,
|
|
24433
|
+
onPageSizeChange: propsOnPageSizeChange,
|
|
24434
|
+
onSelectionModelChange,
|
|
24435
|
+
page: propsPage,
|
|
24436
|
+
pageSize: propsPageSize,
|
|
24261
24437
|
pagination,
|
|
24262
24438
|
paginationPlacement,
|
|
24263
24439
|
paginationProps,
|
|
24264
24440
|
rows,
|
|
24265
|
-
|
|
24441
|
+
rowsPerPageOptions,
|
|
24266
24442
|
sx
|
|
24267
24443
|
} = props,
|
|
24268
24444
|
forwardedProps = _objectWithoutProperties(props, _excluded$1);
|
|
24269
24445
|
const _apiRef = useGridApiRef();
|
|
24270
24446
|
const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
|
|
24271
|
-
const RenderedToolbar =
|
|
24447
|
+
const RenderedToolbar = components !== null && components !== void 0 && components.Toolbar ? components.Toolbar : Toolbar$2;
|
|
24272
24448
|
LicenseInfo.setLicenseKey(license);
|
|
24273
24449
|
const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
|
|
24274
24450
|
const selectionStatus = useRef({
|
|
@@ -24286,22 +24462,33 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24286
24462
|
setFilterModel(model);
|
|
24287
24463
|
}
|
|
24288
24464
|
};
|
|
24289
|
-
const [
|
|
24290
|
-
|
|
24291
|
-
|
|
24292
|
-
|
|
24293
|
-
|
|
24294
|
-
|
|
24295
|
-
|
|
24465
|
+
const [page, setPage] = React__default.useState((initialState === null || initialState === void 0 ? void 0 : (_initialState$paginat = initialState.pagination) === null || _initialState$paginat === void 0 ? void 0 : _initialState$paginat.page) || propsPage || 0);
|
|
24466
|
+
const [pageSize, setPageSize] = React__default.useState((initialState === null || initialState === void 0 ? void 0 : (_initialState$paginat2 = initialState.pagination) === null || _initialState$paginat2 === void 0 ? void 0 : _initialState$paginat2.pageSize) || propsPageSize || (rowsPerPageOptions === null || rowsPerPageOptions === void 0 ? void 0 : rowsPerPageOptions[0]) || 100);
|
|
24467
|
+
const onPageChange = page => {
|
|
24468
|
+
if (propsOnPageChange) {
|
|
24469
|
+
propsOnPageChange(page, undefined);
|
|
24470
|
+
} else {
|
|
24471
|
+
setPage(page);
|
|
24472
|
+
}
|
|
24473
|
+
};
|
|
24474
|
+
useEffect(() => {
|
|
24475
|
+
if (propsPage || propsPage === 0) {
|
|
24476
|
+
setPage(propsPage);
|
|
24477
|
+
}
|
|
24478
|
+
}, [propsPage]);
|
|
24479
|
+
const onPageSizeChange = pageSize => {
|
|
24480
|
+
onPageChange(0);
|
|
24481
|
+
if (propsOnPageSizeChange) {
|
|
24482
|
+
propsOnPageSizeChange(pageSize, undefined);
|
|
24296
24483
|
} else {
|
|
24297
|
-
|
|
24484
|
+
setPageSize(pageSize);
|
|
24298
24485
|
}
|
|
24299
24486
|
};
|
|
24300
24487
|
useEffect(() => {
|
|
24301
|
-
if (
|
|
24302
|
-
|
|
24488
|
+
if (propsPageSize) {
|
|
24489
|
+
setPageSize(propsPageSize);
|
|
24303
24490
|
}
|
|
24304
|
-
}, [
|
|
24491
|
+
}, [propsPageSize]);
|
|
24305
24492
|
if (!Array.isArray(rows)) {
|
|
24306
24493
|
return null;
|
|
24307
24494
|
}
|
|
@@ -24313,46 +24500,46 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24313
24500
|
apiRef: apiRef,
|
|
24314
24501
|
autoHeight: autoHeight,
|
|
24315
24502
|
checkboxSelectionVisibleOnly: Boolean(pagination),
|
|
24316
|
-
|
|
24317
|
-
|
|
24318
|
-
|
|
24319
|
-
//
|
|
24320
|
-
|
|
24321
|
-
|
|
24503
|
+
components: _objectSpread2(_objectSpread2({
|
|
24504
|
+
BaseButton,
|
|
24505
|
+
BaseCheckbox,
|
|
24506
|
+
// BaseTextField,
|
|
24507
|
+
BasePopper,
|
|
24508
|
+
ColumnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24322
24509
|
displayName: "ColumnFilteredIcon"
|
|
24323
24510
|
})),
|
|
24324
|
-
|
|
24511
|
+
ColumnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24325
24512
|
displayName: "ColumnSelectorIcon"
|
|
24326
24513
|
})),
|
|
24327
|
-
|
|
24514
|
+
ColumnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24328
24515
|
displayName: "ColumnSortedAscendingIcon"
|
|
24329
24516
|
})),
|
|
24330
|
-
|
|
24517
|
+
ColumnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24331
24518
|
displayName: "ColumnSortedDescendingIcon"
|
|
24332
24519
|
})),
|
|
24333
|
-
|
|
24520
|
+
DensityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24334
24521
|
displayName: "DensityCompactIcon"
|
|
24335
24522
|
})),
|
|
24336
|
-
|
|
24523
|
+
DensityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24337
24524
|
displayName: "DensityStandardIcon"
|
|
24338
24525
|
})),
|
|
24339
|
-
|
|
24526
|
+
DensityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24340
24527
|
displayName: "DensityComfortableIcon"
|
|
24341
24528
|
})),
|
|
24342
|
-
|
|
24529
|
+
DetailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24343
24530
|
displayName: "DetailPanelCollapseIcon"
|
|
24344
24531
|
})),
|
|
24345
|
-
|
|
24532
|
+
DetailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24346
24533
|
displayName: "DetailPanelExpandIcon"
|
|
24347
24534
|
})),
|
|
24348
|
-
|
|
24535
|
+
ExportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24349
24536
|
displayName: "ExportIcon"
|
|
24350
24537
|
})),
|
|
24351
|
-
|
|
24538
|
+
OpenFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({
|
|
24352
24539
|
displayName: "OpenFilterButtonIcon"
|
|
24353
24540
|
}, props))
|
|
24354
|
-
},
|
|
24355
|
-
|
|
24541
|
+
}, components), {}, {
|
|
24542
|
+
Toolbar: props => {
|
|
24356
24543
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, !hideToolbar ? /*#__PURE__*/React__default.createElement(RenderedToolbar, _extends$2({}, props, {
|
|
24357
24544
|
filterModel: filterModel,
|
|
24358
24545
|
onFilterModelChange: onFilterModelChange
|
|
@@ -24363,27 +24550,31 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24363
24550
|
selectionStatus: selectionStatus.current,
|
|
24364
24551
|
apiRef: apiRef,
|
|
24365
24552
|
isRowSelectable: isRowSelectable,
|
|
24366
|
-
|
|
24367
|
-
|
|
24368
|
-
|
|
24553
|
+
page: page,
|
|
24554
|
+
onPageChange: onPageChange,
|
|
24555
|
+
pageSize: pageSize,
|
|
24556
|
+
onPageSizeChange: onPageSizeChange,
|
|
24557
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
24369
24558
|
paginationProps: paginationProps
|
|
24370
24559
|
}) : null);
|
|
24371
24560
|
},
|
|
24372
|
-
|
|
24561
|
+
Pagination: props => pagination ? /*#__PURE__*/React__default.createElement(ControlledPagination, _extends$2({}, props, {
|
|
24373
24562
|
displaySelection: false,
|
|
24374
24563
|
displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
|
|
24375
24564
|
displayPagination: ['bottom', 'both'].includes(paginationPlacement),
|
|
24376
24565
|
selectionStatus: selectionStatus.current,
|
|
24377
24566
|
apiRef: apiRef,
|
|
24378
24567
|
isRowSelectable: isRowSelectable,
|
|
24379
|
-
|
|
24380
|
-
|
|
24381
|
-
|
|
24568
|
+
page: page,
|
|
24569
|
+
onPageChange: onPageChange,
|
|
24570
|
+
pageSize: pageSize,
|
|
24571
|
+
onPageSizeChange: onPageSizeChange,
|
|
24572
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
24382
24573
|
paginationProps: paginationProps
|
|
24383
24574
|
})) : null
|
|
24384
24575
|
}),
|
|
24385
|
-
|
|
24386
|
-
toolbar: _objectSpread2({},
|
|
24576
|
+
componentsProps: _objectSpread2(_objectSpread2({}, componentsProps), {}, {
|
|
24577
|
+
toolbar: _objectSpread2({}, componentsProps === null || componentsProps === void 0 ? void 0 : componentsProps.toolbar)
|
|
24387
24578
|
}),
|
|
24388
24579
|
filterModel: filterModel,
|
|
24389
24580
|
initialState: initialState,
|
|
@@ -24391,38 +24582,40 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24391
24582
|
onFilterModelChange: onFilterModelChange,
|
|
24392
24583
|
pagination: pagination,
|
|
24393
24584
|
rows: rows,
|
|
24394
|
-
|
|
24395
|
-
|
|
24396
|
-
|
|
24397
|
-
|
|
24585
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
24586
|
+
page: page,
|
|
24587
|
+
onPageChange: onPageChange,
|
|
24588
|
+
pageSize: pageSize,
|
|
24589
|
+
onPageSizeChange: onPageSizeChange,
|
|
24590
|
+
onSelectionModelChange: (newSelectionModel, details) => {
|
|
24398
24591
|
if (pagination) {
|
|
24399
|
-
const selectableRowsInPage = props.isRowSelectable && typeof props.isRowSelectable === 'function' ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(
|
|
24592
|
+
const selectableRowsInPage = props.isRowSelectable && typeof props.isRowSelectable === 'function' ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref4 => {
|
|
24400
24593
|
var _props$isRowSelectabl;
|
|
24401
24594
|
let {
|
|
24402
24595
|
model
|
|
24403
|
-
} =
|
|
24596
|
+
} = _ref4;
|
|
24404
24597
|
return (_props$isRowSelectabl = props.isRowSelectable) === null || _props$isRowSelectabl === void 0 ? void 0 : _props$isRowSelectabl.call(props, {
|
|
24405
24598
|
row: model
|
|
24406
24599
|
});
|
|
24407
|
-
}).map(
|
|
24600
|
+
}).map(_ref5 => {
|
|
24408
24601
|
let {
|
|
24409
24602
|
id
|
|
24410
|
-
} =
|
|
24603
|
+
} = _ref5;
|
|
24411
24604
|
return id;
|
|
24412
24605
|
}) : gridPaginatedVisibleSortedGridRowIdsSelector(apiRef);
|
|
24413
24606
|
const numberOfSelectableRowsInPage = selectableRowsInPage.length;
|
|
24414
|
-
const selectableRowsInTable = props.isRowSelectable && typeof props.isRowSelectable === 'function' ? gridFilteredSortedRowEntriesSelector(apiRef).filter(
|
|
24607
|
+
const selectableRowsInTable = props.isRowSelectable && typeof props.isRowSelectable === 'function' ? gridFilteredSortedRowEntriesSelector(apiRef).filter(_ref6 => {
|
|
24415
24608
|
var _props$isRowSelectabl2;
|
|
24416
24609
|
let {
|
|
24417
24610
|
model
|
|
24418
|
-
} =
|
|
24611
|
+
} = _ref6;
|
|
24419
24612
|
return (_props$isRowSelectabl2 = props.isRowSelectable) === null || _props$isRowSelectabl2 === void 0 ? void 0 : _props$isRowSelectabl2.call(props, {
|
|
24420
24613
|
row: model
|
|
24421
24614
|
});
|
|
24422
|
-
}).map(
|
|
24615
|
+
}).map(_ref7 => {
|
|
24423
24616
|
let {
|
|
24424
24617
|
id
|
|
24425
|
-
} =
|
|
24618
|
+
} = _ref7;
|
|
24426
24619
|
return id;
|
|
24427
24620
|
}) : gridFilteredSortedRowIdsSelector(apiRef);
|
|
24428
24621
|
const numberOfSelectableRowsInTable = selectableRowsInTable.length;
|
|
@@ -24454,7 +24647,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24454
24647
|
};
|
|
24455
24648
|
}
|
|
24456
24649
|
}
|
|
24457
|
-
|
|
24650
|
+
onSelectionModelChange === null || onSelectionModelChange === void 0 ? void 0 : onSelectionModelChange(newSelectionModel, details);
|
|
24458
24651
|
},
|
|
24459
24652
|
sx: _objectSpread2(_objectSpread2({}, sx), {}, {
|
|
24460
24653
|
'.MuiDataGrid-columnHeaders': {
|