@campxdev/react-blueprint 1.6.3 → 1.6.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/package.json +1 -1
- package/src/components/DataDisplay/DataTable/DataTable.tsx +2 -0
- package/src/components/Layout/PageHeader/components/DensitySelector/DensitySelector.tsx +3 -3
- package/src/components/Layout/PageHeader/components/TableColumnsSelector/TableColumnsSelector.tsx +3 -5
- package/src/hooks/usePageHeader.ts +1 -1
- package/src/redux/export.ts +1 -2
- package/src/redux/reducers.ts +5 -0
- package/src/redux/slices/pageHeaderSlice.ts +1 -3
- package/src/redux/store.ts +3 -5
package/package.json
CHANGED
|
@@ -2,7 +2,8 @@ import { MenuListProps, MenuProps, Stack, useTheme } from '@mui/material';
|
|
|
2
2
|
import { GridDensity } from '@mui/x-data-grid';
|
|
3
3
|
import { capitalize } from 'lodash';
|
|
4
4
|
import { useDispatch, useSelector } from 'react-redux';
|
|
5
|
-
import {
|
|
5
|
+
import { setDensity } from '../../../../../redux/slices/pageHeaderSlice';
|
|
6
|
+
import { RootState } from '../../../../../redux/store';
|
|
6
7
|
import { Button, DropdownMenu, Icons, Typography } from '../../../../export';
|
|
7
8
|
import { DensityAnchor } from '../Anchors';
|
|
8
9
|
|
|
@@ -18,8 +19,7 @@ export const DensitySelector = ({
|
|
|
18
19
|
}: DensitySelectorProps) => {
|
|
19
20
|
const dispatch = useDispatch();
|
|
20
21
|
const density = useSelector(
|
|
21
|
-
(state: RootState) =>
|
|
22
|
-
state.pageHeaderSlice[uniqueId]?.density || 'standard',
|
|
22
|
+
(state: RootState) => state.pageHeader[uniqueId]?.density || 'standard',
|
|
23
23
|
);
|
|
24
24
|
const gridDensity: GridDensity[] = ['compact', 'standard', 'comfortable'];
|
|
25
25
|
|
package/src/components/Layout/PageHeader/components/TableColumnsSelector/TableColumnsSelector.tsx
CHANGED
|
@@ -3,10 +3,8 @@ import { MenuListProps, MenuProps, Typography, useTheme } from '@mui/material';
|
|
|
3
3
|
import { GridColDef, GridColumnVisibilityModel } from '@mui/x-data-grid';
|
|
4
4
|
import { useState } from 'react';
|
|
5
5
|
import { useDispatch, useSelector } from 'react-redux';
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
setColumnVisibilityModel,
|
|
9
|
-
} from '../../../../../redux/export';
|
|
6
|
+
import { setColumnVisibilityModel } from '../../../../../redux/slices/pageHeaderSlice';
|
|
7
|
+
import { RootState } from '../../../../../redux/store';
|
|
10
8
|
import { Button, Icons, SearchBar, SingleCheckBox } from '../../../../export';
|
|
11
9
|
import { DropdownMenu } from '../../../../Navigation/export';
|
|
12
10
|
|
|
@@ -26,7 +24,7 @@ export const TableColumnsSelector = ({
|
|
|
26
24
|
|
|
27
25
|
const columnVisibilityModel = useSelector(
|
|
28
26
|
(state: RootState) =>
|
|
29
|
-
state.
|
|
27
|
+
state.pageHeader[uniqueId]?.columnVisibilityModel ||
|
|
30
28
|
columns.reduce((acc, column) => {
|
|
31
29
|
acc[column.field] = true;
|
|
32
30
|
return acc;
|
|
@@ -10,7 +10,7 @@ export const usePageHeader = () => {
|
|
|
10
10
|
const dispatch = useDispatch();
|
|
11
11
|
const filterState = useSelector(
|
|
12
12
|
(state: RootState) =>
|
|
13
|
-
state.
|
|
13
|
+
state.pageHeader[uuidRef.current] ||
|
|
14
14
|
({} as {
|
|
15
15
|
density: GridDensity;
|
|
16
16
|
columnVisibilityModel: GridColumnVisibilityModel;
|
package/src/redux/export.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './store';
|
|
1
|
+
export * from './reducers';
|
|
@@ -10,7 +10,7 @@ export type PageHeaderState = {
|
|
|
10
10
|
|
|
11
11
|
const initialState: PageHeaderState = {};
|
|
12
12
|
|
|
13
|
-
const pageHeaderSlice = createSlice({
|
|
13
|
+
export const pageHeaderSlice = createSlice({
|
|
14
14
|
name: 'pageHeader',
|
|
15
15
|
initialState,
|
|
16
16
|
reducers: {
|
|
@@ -31,5 +31,3 @@ const pageHeaderSlice = createSlice({
|
|
|
31
31
|
|
|
32
32
|
export const { setColumnVisibilityModel, setDensity, resetStateForUniqueId } =
|
|
33
33
|
pageHeaderSlice.actions;
|
|
34
|
-
|
|
35
|
-
export default pageHeaderSlice.reducer;
|
package/src/redux/store.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { configureStore } from '@reduxjs/toolkit';
|
|
2
|
-
import
|
|
1
|
+
import { combineReducers, configureStore } from '@reduxjs/toolkit';
|
|
2
|
+
import { reactBlueprintReducers } from './reducers';
|
|
3
3
|
|
|
4
4
|
export const store = configureStore({
|
|
5
|
-
reducer:
|
|
6
|
-
pageHeaderSlice,
|
|
7
|
-
},
|
|
5
|
+
reducer: combineReducers(reactBlueprintReducers),
|
|
8
6
|
});
|
|
9
7
|
|
|
10
8
|
export type RootState = ReturnType<typeof store.getState>;
|