@m4l/components 9.2.10 → 9.2.12
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/components/DataGrid/formatters/ColumnBooleanFormatter/useColumnBoolean.js +15 -5
- package/components/DataGrid/formatters/ColumnChipStatusFormatter/useColumnChipStatusFormatter.js +15 -5
- package/components/DataGrid/formatters/ColumnConcatenatedValueFormatter/useColumnConcatenatedValue.js +15 -5
- package/components/DataGrid/formatters/ColumnDateFormatter/useColumnDate.js +18 -7
- package/components/DataGrid/formatters/ColumnInteractiveCheckFormatter/useColumnInteractiveCheck.d.ts +1 -1
- package/components/DataGrid/formatters/ColumnInteractiveCheckFormatter/useColumnInteractiveCheck.js +15 -5
- package/components/DataGrid/formatters/ColumnNestedValueFormatter/useColumnNestedValue.js +15 -5
- package/components/DataGrid/formatters/ColumnPointsFormatter/useColumnPoints.js +15 -5
- package/components/DataGrid/formatters/ColumnPriceFormatter/useColumnPrice.js +18 -8
- package/components/DataGrid/formatters/ColumnSetCheckFormatter/useColumnSetCheck.d.ts +1 -1
- package/components/DataGrid/formatters/ColumnSetCheckFormatter/useColumnSetCheck.js +16 -6
- package/components/DataGrid/formatters/ColumnUncertaintyFormatter/useColumnUncertainty.js +16 -6
- package/components/DynamicFilter/DynamicFIlter.styles.js +123 -222
- package/components/DynamicFilter/slots/SlotsEnum.d.ts +3 -14
- package/components/DynamicFilter/slots/SlotsEnum.js +2 -13
- package/components/DynamicFilter/slots/dynamicFilterSlots.d.ts +5 -38
- package/components/DynamicFilter/slots/dynamicFilterSlots.js +27 -80
- package/components/DynamicFilter/store/DynamicFilterContext.js +17 -2
- package/components/DynamicFilter/store/DynamicFilterStore.js +12 -1
- package/components/DynamicFilter/store/types.d.ts +10 -1
- package/components/DynamicFilter/subcomponents/AppliedFilterChip/AppliedFilterChip.d.ts +1 -1
- package/components/DynamicFilter/subcomponents/AppliedFilterChip/AppliedFilterChip.js +17 -21
- package/components/DynamicFilter/subcomponents/AppliedFilterChip/useAppliedFilterChip.d.ts +0 -1
- package/components/DynamicFilter/subcomponents/AppliedFilterChip/useAppliedFilterChip.js +1 -4
- package/components/DynamicFilter/subcomponents/AppliedFilters/AppliedFilters.js +2 -3
- package/components/DynamicFilter/subcomponents/DynamicFilterBase/useDynamicFilterBase.d.ts +1 -0
- package/components/DynamicFilter/subcomponents/DynamicFilterBase/useDynamicFilterBase.js +2 -1
- package/components/DynamicFilter/subcomponents/FieldTypes/fieldFactory.d.ts +1 -1
- package/components/DynamicFilter/subcomponents/FilterActions/FilterActions.d.ts +1 -1
- package/components/DynamicFilter/subcomponents/FilterActions/FilterActions.js +8 -9
- package/components/DynamicFilter/subcomponents/FilterActions/useFilterActions.d.ts +0 -1
- package/components/DynamicFilter/subcomponents/FilterActions/useFilterActions.js +1 -5
- package/components/DynamicFilter/subcomponents/InputFilter/InputFilter.d.ts +1 -1
- package/components/DynamicFilter/subcomponents/InputFilter/InputFilter.js +31 -23
- package/components/DynamicFilter/subcomponents/InputFilter/useInputFilter.d.ts +8 -0
- package/components/DynamicFilter/subcomponents/InputFilter/useInputFilter.js +10 -1
- package/components/DynamicFilter/subcomponents/PopoverFilter/PopoverFilter.js +12 -7
- package/components/DynamicFilter/subcomponents/PopoverMenuFields/PopoverMenuFields.js +6 -3
- package/components/DynamicFilter/tests/DynamicFilter.test.d.ts +1 -0
- package/components/DynamicFilter/tests/constants.d.ts +9 -0
- package/components/DynamicFilter/types.d.ts +9 -0
- package/components/DynamicSort/DynamicSort.styles.js +61 -112
- package/components/DynamicSort/slots/DynamicSortSlots.d.ts +2 -14
- package/components/DynamicSort/slots/DynamicSortSlots.js +17 -40
- package/components/DynamicSort/slots/SlotsEnum.d.ts +1 -5
- package/components/DynamicSort/slots/SlotsEnum.js +1 -5
- package/components/DynamicSort/slots/tests/DynamicSort.test.d.ts +1 -0
- package/components/DynamicSort/store/DynamicSortContext.js +5 -2
- package/components/DynamicSort/subcomponents/AppliedSortChip/AppliedSortChip.js +2 -3
- package/components/DynamicSort/subcomponents/AppliedSorts/AppliedSorts.js +2 -3
- package/components/DynamicSort/subcomponents/InputSort/InputSort.js +5 -4
- package/components/DynamicSort/subcomponents/PopoverMenuFields/PopoverMenuFields.js +6 -5
- package/components/DynamicSort/subcomponents/PopoverSort/PopoverSort.js +11 -8
- package/components/DynamicSort/subcomponents/SortActions/SortActions.js +1 -1
- package/package.json +1 -1
- package/storybook/components/DynamicFilter/mocks/mocksData.d.ts +1 -0
- package/components/DynamicFilter/subcomponents/FilterActions/FilterActionsSkeleton.d.ts +0 -5
- package/components/DynamicFilter/subcomponents/FilterActions/FilterActionsSkeleton.js +0 -12
- package/components/DynamicFilter/subcomponents/InputFilter/InputFilterSkeleton.d.ts +0 -5
- package/components/DynamicFilter/subcomponents/InputFilter/InputFilterSkeleton.js +0 -19
- package/utils/containerQuery.js +0 -6
- /package/components/DynamicFilter/{__tests__/DynamicFilter.test.d.ts → store/tests/DynamicFilterStore.test.d.ts} +0 -0
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { g as getFormatBoolean } from "../../../formatters/BooleanFormatter/BooleanFormatter.js";
|
|
2
2
|
import { C as ColumnBooleanFormatter } from "./index.js";
|
|
3
3
|
import { useModuleDictionary, getPropertyByString } from "@m4l/core";
|
|
4
|
+
import { useState, useRef, useEffect, useMemo } from "react";
|
|
5
|
+
import { deepEqual } from "fast-equals";
|
|
4
6
|
const getCustomBooleanFilter = (props, getLabel) => {
|
|
5
7
|
return (row, value) => {
|
|
6
8
|
const valueMaybeString = getPropertyByString(row, props.fieldValue);
|
|
@@ -54,11 +56,19 @@ const getCustomBooleanSort = (props, getLabel) => {
|
|
|
54
56
|
};
|
|
55
57
|
const useColumnBoolean = (props) => {
|
|
56
58
|
const { getLabel } = useModuleDictionary();
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
const [stateProps, setStateProps] = useState(props);
|
|
60
|
+
const refProps = useRef({ ...props });
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
if (!deepEqual(refProps.current, props)) {
|
|
63
|
+
refProps.current = props;
|
|
64
|
+
setStateProps(props);
|
|
65
|
+
}
|
|
66
|
+
}, [props]);
|
|
67
|
+
return useMemo(() => ({
|
|
68
|
+
formatter: ColumnBooleanFormatter(stateProps),
|
|
69
|
+
customFilter: getCustomBooleanFilter(stateProps, getLabel),
|
|
70
|
+
customSort: getCustomBooleanSort(stateProps, getLabel)
|
|
71
|
+
}), [stateProps, getLabel]);
|
|
62
72
|
};
|
|
63
73
|
export {
|
|
64
74
|
useColumnBoolean as u
|
package/components/DataGrid/formatters/ColumnChipStatusFormatter/useColumnChipStatusFormatter.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { getPropertyByString } from "@m4l/core";
|
|
2
2
|
import { C as ColumnChipStatusFormatter } from "./ColumnChipStatusFormatter.js";
|
|
3
3
|
import { g as getColumnKey } from "../../helpers/getColumnKey.js";
|
|
4
|
+
import { deepEqual } from "fast-equals";
|
|
5
|
+
import { useState, useRef, useEffect, useMemo } from "react";
|
|
4
6
|
const getCustomChipStatusFilter = (props) => {
|
|
5
7
|
const { uriLabel } = props;
|
|
6
8
|
return (row, value) => {
|
|
@@ -16,11 +18,19 @@ const getCustomChipStatusSort = (props) => {
|
|
|
16
18
|
};
|
|
17
19
|
};
|
|
18
20
|
const useColumnChipStatus = (props) => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
const [stateProps, setStateProps] = useState(props);
|
|
22
|
+
const refProps = useRef({ ...props });
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (!deepEqual(refProps.current, props)) {
|
|
25
|
+
refProps.current = props;
|
|
26
|
+
setStateProps(props);
|
|
27
|
+
}
|
|
28
|
+
}, [props]);
|
|
29
|
+
return useMemo(() => ({
|
|
30
|
+
formatter: ColumnChipStatusFormatter(stateProps),
|
|
31
|
+
customFilter: getCustomChipStatusFilter(stateProps),
|
|
32
|
+
customSort: getCustomChipStatusSort(stateProps)
|
|
33
|
+
}), [stateProps]);
|
|
24
34
|
};
|
|
25
35
|
export {
|
|
26
36
|
useColumnChipStatus as u
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { getPropertyByString } from "@m4l/core";
|
|
2
|
+
import { deepEqual } from "fast-equals";
|
|
2
3
|
import { C as ColumnConcatenatedValueFormatter } from "./index.js";
|
|
3
4
|
import { g as getColumnKey } from "../../helpers/getColumnKey.js";
|
|
4
5
|
import { g as getFormatConcatenated } from "../../../formatters/ConcatenatedFormatter/ConcatenatedFormatter.js";
|
|
6
|
+
import { useState, useRef, useEffect, useMemo } from "react";
|
|
5
7
|
const getArrayValuesWithFieldValue = (row, fieldValue) => {
|
|
6
8
|
const values = fieldValue.map((element) => {
|
|
7
9
|
const keyWiouthRow = getColumnKey(element);
|
|
@@ -38,11 +40,19 @@ const getCustomConcatenatedValueSort = (props) => {
|
|
|
38
40
|
};
|
|
39
41
|
};
|
|
40
42
|
const useColumnConcatenatedValue = (props) => {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
const [stateProps, setStateProps] = useState(props);
|
|
44
|
+
const refProps = useRef({ ...props });
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
if (!deepEqual(refProps.current, props)) {
|
|
47
|
+
refProps.current = props;
|
|
48
|
+
setStateProps(props);
|
|
49
|
+
}
|
|
50
|
+
}, [props]);
|
|
51
|
+
return useMemo(() => ({
|
|
52
|
+
formatter: ColumnConcatenatedValueFormatter(stateProps),
|
|
53
|
+
customFilter: getCustomContatenatedValueFilter(stateProps),
|
|
54
|
+
customSort: getCustomConcatenatedValueSort(stateProps)
|
|
55
|
+
}), [stateProps]);
|
|
46
56
|
};
|
|
47
57
|
export {
|
|
48
58
|
useColumnConcatenatedValue as u
|
|
@@ -4,9 +4,11 @@ import { C as ColumnDateFormatter } from "./index.js";
|
|
|
4
4
|
import { g as getColumnKey } from "../../helpers/getColumnKey.js";
|
|
5
5
|
import { useFormatter } from "@m4l/graphics";
|
|
6
6
|
import { g as getValidDate } from "../../../../utils/getValidDate.js";
|
|
7
|
+
import { useState, useRef, useEffect, useMemo, useCallback } from "react";
|
|
8
|
+
import { deepEqual } from "fast-equals";
|
|
7
9
|
const useCustomDateFilter = (props) => {
|
|
8
10
|
const { dateFormatter } = useFormatter();
|
|
9
|
-
|
|
11
|
+
const ret = useCallback((row, value) => {
|
|
10
12
|
const fieldValue = getColumnKey(props.fieldValue);
|
|
11
13
|
const rawValue = getPropertyByString(row, fieldValue);
|
|
12
14
|
let dateValue = null;
|
|
@@ -20,7 +22,8 @@ const useCustomDateFilter = (props) => {
|
|
|
20
22
|
}
|
|
21
23
|
const formattedDate = getFormatDate(props.presentationType, dateValue, dateFormatter, props.format);
|
|
22
24
|
return formattedDate.includes(value);
|
|
23
|
-
};
|
|
25
|
+
}, [props.presentationType, props.format, dateFormatter]);
|
|
26
|
+
return ret;
|
|
24
27
|
};
|
|
25
28
|
const getCustomDateSort = (props) => {
|
|
26
29
|
return (a, b) => {
|
|
@@ -42,12 +45,20 @@ const getCustomDateSort = (props) => {
|
|
|
42
45
|
};
|
|
43
46
|
};
|
|
44
47
|
const useColumnDate = (props) => {
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
+
const [stateProps, setStateProps] = useState(props);
|
|
49
|
+
const customFilter = useCustomDateFilter(stateProps);
|
|
50
|
+
const refProps = useRef({ ...props });
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
if (!deepEqual(refProps.current, props)) {
|
|
53
|
+
refProps.current = props;
|
|
54
|
+
setStateProps(props);
|
|
55
|
+
}
|
|
56
|
+
}, [props]);
|
|
57
|
+
return useMemo(() => ({
|
|
58
|
+
formatter: ColumnDateFormatter(stateProps),
|
|
48
59
|
customFilter,
|
|
49
|
-
customSort: getCustomDateSort(
|
|
50
|
-
};
|
|
60
|
+
customSort: getCustomDateSort(stateProps)
|
|
61
|
+
}), [stateProps, customFilter]);
|
|
51
62
|
};
|
|
52
63
|
export {
|
|
53
64
|
useColumnDate as u
|
|
@@ -7,6 +7,6 @@ import { ColumnInteractiveCheckFormatterProps } from './types';
|
|
|
7
7
|
*/
|
|
8
8
|
export declare const useColumnInteractiveCheck: <TRow>(props: ColumnInteractiveCheckFormatterProps<TRow>) => {
|
|
9
9
|
formatter: import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
|
|
10
|
+
customFilter: (row: TRow, value: boolean) => boolean;
|
|
11
11
|
customSort: (a: TRow, b: TRow) => 0 | 1 | -1;
|
|
12
12
|
};
|
package/components/DataGrid/formatters/ColumnInteractiveCheckFormatter/useColumnInteractiveCheck.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { useState, useRef, useEffect, useMemo } from "react";
|
|
2
|
+
import { deepEqual } from "fast-equals";
|
|
1
3
|
import { C as ColumnInteractiveCheckFormatter } from "./index.js";
|
|
2
4
|
const getCustomInteractiveCheckFilter = (props) => {
|
|
3
5
|
return (row, value) => {
|
|
@@ -18,11 +20,19 @@ const getCustomInteractiveCheckSort = (props) => {
|
|
|
18
20
|
};
|
|
19
21
|
};
|
|
20
22
|
const useColumnInteractiveCheck = (props) => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
const [stateProps, setStateProps] = useState(props);
|
|
24
|
+
const refProps = useRef({ ...props });
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (!deepEqual(refProps.current, props)) {
|
|
27
|
+
refProps.current = props;
|
|
28
|
+
setStateProps(props);
|
|
29
|
+
}
|
|
30
|
+
}, [props]);
|
|
31
|
+
return useMemo(() => ({
|
|
32
|
+
formatter: ColumnInteractiveCheckFormatter(stateProps),
|
|
33
|
+
customFilter: getCustomInteractiveCheckFilter(stateProps),
|
|
34
|
+
customSort: getCustomInteractiveCheckSort(stateProps)
|
|
35
|
+
}), [stateProps]);
|
|
26
36
|
};
|
|
27
37
|
export {
|
|
28
38
|
useColumnInteractiveCheck as u
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { getPropertyByString } from "@m4l/core";
|
|
2
2
|
import { C as ColumnNestedValueFormatter } from "./index.js";
|
|
3
|
+
import { useState, useRef, useEffect, useMemo } from "react";
|
|
4
|
+
import { deepEqual } from "fast-equals";
|
|
3
5
|
const getCustomNestedValueFilter = (props) => {
|
|
4
6
|
return (row, value) => {
|
|
5
7
|
const property = getPropertyByString(row, props.fieldValue) ?? "";
|
|
@@ -26,11 +28,19 @@ const getCustomNestedValueSort = (props) => {
|
|
|
26
28
|
};
|
|
27
29
|
};
|
|
28
30
|
const useColumnNestedValue = (props) => {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
const [stateProps, setStateProps] = useState(props);
|
|
32
|
+
const refProps = useRef({ ...props });
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (!deepEqual(refProps.current, props)) {
|
|
35
|
+
refProps.current = props;
|
|
36
|
+
setStateProps(props);
|
|
37
|
+
}
|
|
38
|
+
}, [props]);
|
|
39
|
+
return useMemo(() => ({
|
|
40
|
+
formatter: ColumnNestedValueFormatter(stateProps),
|
|
41
|
+
customFilter: getCustomNestedValueFilter(stateProps),
|
|
42
|
+
customSort: getCustomNestedValueSort(stateProps)
|
|
43
|
+
}), [stateProps]);
|
|
34
44
|
};
|
|
35
45
|
export {
|
|
36
46
|
useColumnNestedValue as u
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { useState, useRef, useEffect, useMemo } from "react";
|
|
2
|
+
import { deepEqual } from "fast-equals";
|
|
1
3
|
import { C as ColumnPointsFormatter } from "./index.js";
|
|
2
4
|
import { g as getColumnKey } from "../../helpers/getColumnKey.js";
|
|
3
5
|
import { g as getFormatPoints } from "../../../formatters/PointsFormatter/PointsFormatter.js";
|
|
@@ -24,11 +26,19 @@ const getCustomPointsSort = (props) => {
|
|
|
24
26
|
};
|
|
25
27
|
};
|
|
26
28
|
const useColumnPoints = (props) => {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
const [stateProps, setStateProps] = useState(props);
|
|
30
|
+
const refProps = useRef({ ...props });
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (!deepEqual(refProps.current, props)) {
|
|
33
|
+
refProps.current = props;
|
|
34
|
+
setStateProps(props);
|
|
35
|
+
}
|
|
36
|
+
}, [props]);
|
|
37
|
+
return useMemo(() => ({
|
|
38
|
+
formatter: ColumnPointsFormatter(stateProps),
|
|
39
|
+
customFilter: getCustomPointsFilter(stateProps),
|
|
40
|
+
customSort: getCustomPointsSort(stateProps)
|
|
41
|
+
}), [stateProps]);
|
|
32
42
|
};
|
|
33
43
|
export {
|
|
34
44
|
useColumnPoints as u
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { useState, useRef, useEffect, useMemo } from "react";
|
|
2
|
+
import { useFormatter } from "@m4l/graphics";
|
|
1
3
|
import { getPropertyByString } from "@m4l/core";
|
|
2
|
-
import {
|
|
3
|
-
import { g as getColumnKey } from "../../helpers/getColumnKey.js";
|
|
4
|
+
import { deepEqual } from "fast-equals";
|
|
4
5
|
import { g as getFormatPrice } from "../../../formatters/PriceFormatter/PriceFormatter.js";
|
|
5
|
-
import {
|
|
6
|
+
import { g as getColumnKey } from "../../helpers/getColumnKey.js";
|
|
7
|
+
import { C as ColumnPriceFormatter } from "./index.js";
|
|
6
8
|
const getCustomPriceFilter = (props) => {
|
|
7
9
|
const { currencyFormatter } = useFormatter();
|
|
8
10
|
return (row, value) => {
|
|
@@ -37,11 +39,19 @@ const getCustomPriceSort = (props) => {
|
|
|
37
39
|
};
|
|
38
40
|
};
|
|
39
41
|
const useColumnPrice = (props) => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
const [stateProps, setStateProps] = useState(props);
|
|
43
|
+
const refProps = useRef({ ...props });
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
if (!deepEqual(refProps.current, props)) {
|
|
46
|
+
refProps.current = props;
|
|
47
|
+
setStateProps(props);
|
|
48
|
+
}
|
|
49
|
+
}, [props]);
|
|
50
|
+
return useMemo(() => ({
|
|
51
|
+
formatter: ColumnPriceFormatter(stateProps),
|
|
52
|
+
customFilter: getCustomPriceFilter(stateProps),
|
|
53
|
+
customSort: getCustomPriceSort(stateProps)
|
|
54
|
+
}), [stateProps]);
|
|
45
55
|
};
|
|
46
56
|
export {
|
|
47
57
|
useColumnPrice as u
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ColumnSetCheckFormatterProps } from './types';
|
|
2
1
|
import { RowKey } from '../../types';
|
|
2
|
+
import { ColumnSetCheckFormatterProps } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* Funcion helper que retorna el formatter, customFilter y customSort
|
|
5
5
|
* de la columna de selección de elementos.
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useState, useRef, useEffect, useMemo } from "react";
|
|
2
2
|
import { getPropertyByString } from "@m4l/core";
|
|
3
|
+
import { deepEqual } from "fast-equals";
|
|
4
|
+
import { C as ColumnSetCheckFormatter } from "./index.js";
|
|
3
5
|
const getCustomFilter = (props) => {
|
|
4
6
|
return (row, value) => {
|
|
5
7
|
const valueCheck = getPropertyByString(row, props.field);
|
|
@@ -21,11 +23,19 @@ const getCustomSort = (props) => {
|
|
|
21
23
|
};
|
|
22
24
|
};
|
|
23
25
|
const useColumnSetCheck = (props) => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
const [stateProps, setStateProps] = useState(props);
|
|
27
|
+
const refProps = useRef({ ...props });
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (!deepEqual(refProps.current, props)) {
|
|
30
|
+
refProps.current = props;
|
|
31
|
+
setStateProps(props);
|
|
32
|
+
}
|
|
33
|
+
}, [props]);
|
|
34
|
+
return useMemo(() => ({
|
|
35
|
+
formatter: ColumnSetCheckFormatter(stateProps),
|
|
36
|
+
customFilter: getCustomFilter(stateProps),
|
|
37
|
+
customSort: getCustomSort(stateProps)
|
|
38
|
+
}), [stateProps]);
|
|
29
39
|
};
|
|
30
40
|
export {
|
|
31
41
|
useColumnSetCheck as u
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { useState, useRef, useEffect, useMemo } from "react";
|
|
2
|
+
import { deepEqual } from "fast-equals";
|
|
1
3
|
import { g as getUncertaintyFormat } from "../../../formatters/UncertaintyFormatter/UncertaintyFormatter.js";
|
|
2
|
-
import { C as ColumnUncertaintyFormatter } from "./index.js";
|
|
3
4
|
import { g as getColumnKey } from "../../helpers/getColumnKey.js";
|
|
5
|
+
import { C as ColumnUncertaintyFormatter } from "./index.js";
|
|
4
6
|
const getCustomUncertaintyFilter = (props) => {
|
|
5
7
|
return (row, value) => {
|
|
6
8
|
const fieldValue = getColumnKey(props.fieldValue);
|
|
@@ -32,11 +34,19 @@ const getCustomUncertaintySort = (props) => {
|
|
|
32
34
|
};
|
|
33
35
|
};
|
|
34
36
|
const useColumnCertanity = (props) => {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
const [stateProps, setStateProps] = useState(props);
|
|
38
|
+
const refProps = useRef({ ...props });
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (!deepEqual(refProps.current, props)) {
|
|
41
|
+
refProps.current = props;
|
|
42
|
+
setStateProps(props);
|
|
43
|
+
}
|
|
44
|
+
}, [props]);
|
|
45
|
+
return useMemo(() => ({
|
|
46
|
+
formatter: ColumnUncertaintyFormatter(stateProps),
|
|
47
|
+
customFilter: getCustomUncertaintyFilter(stateProps),
|
|
48
|
+
customSort: getCustomUncertaintySort(stateProps)
|
|
49
|
+
}), [stateProps]);
|
|
40
50
|
};
|
|
41
51
|
export {
|
|
42
52
|
useColumnCertanity as u
|