@redsift/table 11.0.0-alpha.3 → 11.0.0-alpha.4
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 -0
- package/index.js +11 -6
- package/index.js.map +1 -1
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -156,6 +156,8 @@ interface StatefulDataGridProps extends DataGridProps {
|
|
|
156
156
|
};
|
|
157
157
|
/** Pinned custom columns. */
|
|
158
158
|
pinnedCustomColumns?: Required<GridPinnedColumns>;
|
|
159
|
+
/** Local Storage version, to upgrade when we want to force a clean out. */
|
|
160
|
+
localStorageVersion?: number;
|
|
159
161
|
}
|
|
160
162
|
|
|
161
163
|
declare const StatefulDataGrid: Comp<StatefulDataGridProps, HTMLDivElement>;
|
package/index.js
CHANGED
|
@@ -26126,7 +26126,6 @@ const useTableStates = (id, version, customDefaults) => {
|
|
|
26126
26126
|
};
|
|
26127
26127
|
};
|
|
26128
26128
|
|
|
26129
|
-
const DATAGRID_VERSION = 1;
|
|
26130
26129
|
const useStatefulTable = props => {
|
|
26131
26130
|
const {
|
|
26132
26131
|
// density = 'standard',
|
|
@@ -26143,7 +26142,7 @@ const useStatefulTable = props => {
|
|
|
26143
26142
|
right: []
|
|
26144
26143
|
},
|
|
26145
26144
|
useRouter,
|
|
26146
|
-
|
|
26145
|
+
localStorageVersion = 1
|
|
26147
26146
|
} = props;
|
|
26148
26147
|
const {
|
|
26149
26148
|
search,
|
|
@@ -26171,10 +26170,10 @@ const useStatefulTable = props => {
|
|
|
26171
26170
|
setPinnedColumns,
|
|
26172
26171
|
dimensionModel,
|
|
26173
26172
|
setDimensionModel
|
|
26174
|
-
} = useTableStates(id,
|
|
26173
|
+
} = useTableStates(id, localStorageVersion, customDefaults);
|
|
26175
26174
|
|
|
26176
26175
|
// clearing up old version keys, triggering only on first render
|
|
26177
|
-
useEffect(() => clearPreviousVersionStorage(id,
|
|
26176
|
+
useEffect(() => clearPreviousVersionStorage(id, localStorageVersion), [id, localStorageVersion]);
|
|
26178
26177
|
const onColumnDimensionChange = useCallback(_ref => {
|
|
26179
26178
|
let {
|
|
26180
26179
|
newWidth,
|
|
@@ -26206,6 +26205,10 @@ const useStatefulTable = props => {
|
|
|
26206
26205
|
column.width = dimensionModel[column.field] || column.width || 100;
|
|
26207
26206
|
return column;
|
|
26208
26207
|
}), [propsColumns, dimensionModel]);
|
|
26208
|
+
/** Add resetPage method to apiRef. */
|
|
26209
|
+
apiRef.current.resetPage = () => {
|
|
26210
|
+
apiRef.current.setPage(0);
|
|
26211
|
+
};
|
|
26209
26212
|
return {
|
|
26210
26213
|
apiRef,
|
|
26211
26214
|
columns,
|
|
@@ -26284,7 +26287,7 @@ const useStatefulTable = props => {
|
|
|
26284
26287
|
};
|
|
26285
26288
|
};
|
|
26286
26289
|
|
|
26287
|
-
const _excluded$1 = ["apiRef", "autoHeight", "className", "columns", "slots", "slotProps", "filterModel", "columnVisibilityModel", "pinnedColumns", "sortModel", "paginationModel", "height", "hideToolbar", "initialState", "isRowSelectable", "license", "onFilterModelChange", "rowSelectionModel", "onColumnWidthChange", "onPaginationModelChange", "onRowSelectionModelChange", "onColumnVisibilityModelChange", "onPinnedColumnsChange", "onSortModelChange", "pagination", "paginationPlacement", "paginationProps", "pinnedCustomColumns", "rows", "pageSizeOptions", "sx", "theme", "useRouter", "paginationMode", "rowCount"];
|
|
26290
|
+
const _excluded$1 = ["apiRef", "autoHeight", "className", "columns", "slots", "slotProps", "filterModel", "columnVisibilityModel", "pinnedColumns", "sortModel", "paginationModel", "height", "hideToolbar", "initialState", "isRowSelectable", "license", "localStorageVersion", "onFilterModelChange", "rowSelectionModel", "onColumnWidthChange", "onPaginationModelChange", "onRowSelectionModelChange", "onColumnVisibilityModelChange", "onPinnedColumnsChange", "onSortModelChange", "pagination", "paginationPlacement", "paginationProps", "pinnedCustomColumns", "rows", "pageSizeOptions", "sx", "theme", "useRouter", "paginationMode", "rowCount"];
|
|
26288
26291
|
const COMPONENT_NAME$1 = 'DataGrid';
|
|
26289
26292
|
const CLASSNAME$1 = 'redsift-datagrid';
|
|
26290
26293
|
const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
@@ -26306,6 +26309,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
26306
26309
|
initialState,
|
|
26307
26310
|
isRowSelectable,
|
|
26308
26311
|
license = process.env.MUI_LICENSE_KEY,
|
|
26312
|
+
localStorageVersion,
|
|
26309
26313
|
onFilterModelChange: propsOnFilterModelChange,
|
|
26310
26314
|
rowSelectionModel: propsSelectionModel,
|
|
26311
26315
|
onColumnWidthChange: propsOnColumnWidthChange,
|
|
@@ -26375,7 +26379,8 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
26375
26379
|
onPinnedColumnsChange: controlledOnPinnedColumnsChange,
|
|
26376
26380
|
onSortModelChange: controlledOnSortModelChange,
|
|
26377
26381
|
pinnedCustomColumns,
|
|
26378
|
-
useRouter: useRouter
|
|
26382
|
+
useRouter: useRouter,
|
|
26383
|
+
localStorageVersion
|
|
26379
26384
|
});
|
|
26380
26385
|
const [rowSelectionModel, setRowSelectionModel] = useState(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
|
|
26381
26386
|
useEffect(() => {
|