@m4l/components 9.1.129 → 9.1.130
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/index.js +2 -1
- package/components/DataGrid/formatters/ColumnBooleanFormatter/useColumnBoolean.d.ts +10 -0
- package/components/DataGrid/formatters/ColumnBooleanFormatter/useColumnBoolean.js +65 -0
- package/components/DataGrid/formatters/ColumnConcatenatedValueFormatter/index.js +2 -1
- package/components/DataGrid/formatters/ColumnConcatenatedValueFormatter/types.d.ts +1 -1
- package/components/DataGrid/formatters/ColumnConcatenatedValueFormatter/useColumnConcatenatedValue.d.ts +9 -0
- package/components/DataGrid/formatters/ColumnConcatenatedValueFormatter/useColumnConcatenatedValue.js +49 -0
- package/components/DataGrid/formatters/ColumnDateFormatter/index.js +2 -1
- package/components/DataGrid/formatters/ColumnDateFormatter/useColumnDate.d.ts +14 -0
- package/components/DataGrid/formatters/ColumnDateFormatter/useColumnDate.js +50 -0
- package/components/DataGrid/formatters/ColumnInteractiveCheckFormatter/useColumnInteractiveCheck.d.ts +12 -0
- package/components/DataGrid/formatters/ColumnInteractiveCheckFormatter/useColumnInteractiveCheck.js +29 -0
- package/components/DataGrid/formatters/ColumnNestedValueFormatter/index.js +1 -1
- package/components/DataGrid/formatters/ColumnNestedValueFormatter/useColumnNestedValue.d.ts +10 -0
- package/components/DataGrid/formatters/ColumnNestedValueFormatter/useColumnNestedValue.js +37 -0
- package/components/DataGrid/formatters/ColumnPointsFormatter/index.js +3 -1
- package/components/DataGrid/formatters/ColumnPointsFormatter/useColumnPoints.d.ts +10 -0
- package/components/DataGrid/formatters/ColumnPointsFormatter/useColumnPoints.js +35 -0
- package/components/DataGrid/formatters/ColumnPriceFormatter/index.js +3 -1
- package/components/DataGrid/formatters/ColumnPriceFormatter/useColumnPrice.d.ts +10 -0
- package/components/DataGrid/formatters/ColumnPriceFormatter/useColumnPrice.js +48 -0
- package/components/DataGrid/formatters/ColumnSetCheckFormatter/useColumnSetCheck.d.ts +11 -0
- package/components/DataGrid/formatters/ColumnSetCheckFormatter/useColumnSetCheck.js +32 -0
- package/components/DataGrid/formatters/ColumnUncertaintyFormatter/index.js +3 -1
- package/components/DataGrid/formatters/ColumnUncertaintyFormatter/useColumnUncertainty.d.ts +11 -0
- package/components/DataGrid/formatters/ColumnUncertaintyFormatter/useColumnUncertainty.js +43 -0
- package/components/DataGrid/formatters/index.d.ts +9 -0
- package/components/DataGrid/helpers/getColumnKey.d.ts +13 -0
- package/components/DataGrid/helpers/getColumnKey.js +11 -0
- package/components/DataGrid/styles.js +2 -1
- package/components/DataGrid/subcomponents/Table/hooks/useSortColumnsRows.js +3 -0
- package/components/DataGrid/tests/ColumnsFormatters.test.d.ts +1 -0
- package/components/DataGrid/types.d.ts +1 -0
- package/components/areas/hooks/index.d.ts +1 -0
- package/components/formatters/BooleanFormatter/BooleanFormatter.d.ts +5 -1
- package/components/formatters/BooleanFormatter/BooleanFormatter.js +23 -17
- package/components/formatters/DateFormatter/DateFormatter.d.ts +2 -1
- package/components/formatters/DateFormatter/DateFormatter.js +4 -4
- package/components/formatters/PriceFormatter/PriceFormatter.js +9 -9
- package/components/formatters/index.d.ts +1 -1
- package/index.js +92 -72
- package/package.json +1 -1
- package/vendor.js +3 -3
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { getPropertyByString } from "@m4l/core";
|
|
3
|
+
import React from "react";
|
|
3
4
|
import { B as BooleanFormatter } from "../../../formatters/BooleanFormatter/BooleanFormatter.js";
|
|
4
5
|
function ColumnBooleanFormatter(props) {
|
|
5
|
-
const { fieldValue, presentationType, Component } = props;
|
|
6
|
+
const { fieldValue, presentationType, Component = React.Fragment } = props;
|
|
6
7
|
return (obProps) => {
|
|
7
8
|
const valueMaybeString = getPropertyByString(obProps, fieldValue);
|
|
8
9
|
let fixedValue;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ColumnBooleanFormatterProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Función helper que retorna
|
|
4
|
+
* el formatter de la columna, el filtro y el customSort
|
|
5
|
+
*/
|
|
6
|
+
export declare const useColumnBoolean: <TRow>(props: ColumnBooleanFormatterProps) => {
|
|
7
|
+
formatter: (obProps: any) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
customFilter: (row: TRow, value: string) => boolean;
|
|
9
|
+
customSort: (a: TRow, b: TRow) => 0 | 1 | -1;
|
|
10
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { g as getFormatBoolean } from "../../../formatters/BooleanFormatter/BooleanFormatter.js";
|
|
2
|
+
import { C as ColumnBooleanFormatter } from "./index.js";
|
|
3
|
+
import { useModuleDictionary, getPropertyByString } from "@m4l/core";
|
|
4
|
+
const getCustomBooleanFilter = (props, getLabel) => {
|
|
5
|
+
return (row, value) => {
|
|
6
|
+
const valueMaybeString = getPropertyByString(row, props.fieldValue);
|
|
7
|
+
let fixedValue;
|
|
8
|
+
if (typeof valueMaybeString === "boolean") {
|
|
9
|
+
fixedValue = valueMaybeString;
|
|
10
|
+
} else {
|
|
11
|
+
fixedValue = void 0;
|
|
12
|
+
}
|
|
13
|
+
return getFormatBoolean(
|
|
14
|
+
props.presentationType,
|
|
15
|
+
fixedValue,
|
|
16
|
+
getLabel
|
|
17
|
+
).includes(value);
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
const getCustomBooleanSort = (props, getLabel) => {
|
|
21
|
+
return (a, b) => {
|
|
22
|
+
const valueMaybeStringA = getPropertyByString(a, props.fieldValue);
|
|
23
|
+
const valueMaybeStringB = getPropertyByString(b, props.fieldValue);
|
|
24
|
+
let fixedValueA;
|
|
25
|
+
let fixedValueB;
|
|
26
|
+
if (typeof valueMaybeStringA === "boolean") {
|
|
27
|
+
fixedValueA = valueMaybeStringA;
|
|
28
|
+
} else {
|
|
29
|
+
fixedValueA = void 0;
|
|
30
|
+
}
|
|
31
|
+
if (typeof valueMaybeStringB === "boolean") {
|
|
32
|
+
fixedValueB = valueMaybeStringB;
|
|
33
|
+
} else {
|
|
34
|
+
fixedValueB = void 0;
|
|
35
|
+
}
|
|
36
|
+
const valueA = getFormatBoolean(
|
|
37
|
+
props.presentationType,
|
|
38
|
+
fixedValueA,
|
|
39
|
+
getLabel
|
|
40
|
+
);
|
|
41
|
+
const valueB = getFormatBoolean(
|
|
42
|
+
props.presentationType,
|
|
43
|
+
fixedValueB,
|
|
44
|
+
getLabel
|
|
45
|
+
);
|
|
46
|
+
if (valueA > valueB) {
|
|
47
|
+
return 1;
|
|
48
|
+
}
|
|
49
|
+
if (valueA < valueB) {
|
|
50
|
+
return -1;
|
|
51
|
+
}
|
|
52
|
+
return 0;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
const useColumnBoolean = (props) => {
|
|
56
|
+
const { getLabel } = useModuleDictionary();
|
|
57
|
+
return {
|
|
58
|
+
formatter: ColumnBooleanFormatter(props),
|
|
59
|
+
customFilter: getCustomBooleanFilter(props, getLabel),
|
|
60
|
+
customSort: getCustomBooleanSort(props, getLabel)
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
export {
|
|
64
|
+
useColumnBoolean as u
|
|
65
|
+
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { getPropertyByString } from "@m4l/core";
|
|
3
|
+
import React from "react";
|
|
3
4
|
import { C as ConcatenatedFormatter } from "../../../formatters/ConcatenatedFormatter/ConcatenatedFormatter.js";
|
|
4
5
|
function ColumnConcatenatedValueFormatter(props) {
|
|
5
|
-
const { fieldValue, fieldSeparator, Component } = props;
|
|
6
|
+
const { fieldValue, fieldSeparator, Component = React.Fragment } = props;
|
|
6
7
|
return (obProps) => {
|
|
7
8
|
const values = fieldValue.map((element) => {
|
|
8
9
|
const valueMaybeString = getPropertyByString(obProps, element);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ColumnConcatenatedValuesFormatterProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Funcion helper que retorna el formatter, filter y customSort de la columna concatenada.
|
|
4
|
+
*/
|
|
5
|
+
export declare const useColumnConcatenatedValue: <TRow>(props: ColumnConcatenatedValuesFormatterProps) => {
|
|
6
|
+
formatter: (obProps: any) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
customFilter: (row: TRow, value: string) => boolean;
|
|
8
|
+
customSort: (a: TRow, b: TRow) => 0 | 1 | -1;
|
|
9
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { getPropertyByString } from "@m4l/core";
|
|
2
|
+
import { C as ColumnConcatenatedValueFormatter } from "./index.js";
|
|
3
|
+
import { g as getColumnKey } from "../../helpers/getColumnKey.js";
|
|
4
|
+
import { g as getFormatConcatenated } from "../../../formatters/ConcatenatedFormatter/ConcatenatedFormatter.js";
|
|
5
|
+
const getArrayValuesWithFieldValue = (row, fieldValue) => {
|
|
6
|
+
const values = fieldValue.map((element) => {
|
|
7
|
+
const keyWiouthRow = getColumnKey(element);
|
|
8
|
+
const valueMaybeString = getPropertyByString(row, keyWiouthRow);
|
|
9
|
+
let fixedValue;
|
|
10
|
+
if (typeof valueMaybeString === "string" || typeof valueMaybeString === "number") {
|
|
11
|
+
fixedValue = valueMaybeString.toString();
|
|
12
|
+
} else {
|
|
13
|
+
fixedValue = "";
|
|
14
|
+
}
|
|
15
|
+
return fixedValue;
|
|
16
|
+
});
|
|
17
|
+
return values;
|
|
18
|
+
};
|
|
19
|
+
const getCustomContatenatedValueFilter = (props) => {
|
|
20
|
+
return (row, value) => {
|
|
21
|
+
const values = getArrayValuesWithFieldValue(row, props.fieldValue);
|
|
22
|
+
return getFormatConcatenated(values, props.fieldSeparator).includes(value);
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
const getCustomConcatenatedValueSort = (props) => {
|
|
26
|
+
return (a, b) => {
|
|
27
|
+
const arrayA = getArrayValuesWithFieldValue(a, props.fieldValue);
|
|
28
|
+
const arrayB = getArrayValuesWithFieldValue(b, props.fieldValue);
|
|
29
|
+
const valueA = getFormatConcatenated(arrayA, props.fieldSeparator);
|
|
30
|
+
const valueB = getFormatConcatenated(arrayB, props.fieldSeparator);
|
|
31
|
+
if (valueA > valueB) {
|
|
32
|
+
return 1;
|
|
33
|
+
}
|
|
34
|
+
if (valueA < valueB) {
|
|
35
|
+
return -1;
|
|
36
|
+
}
|
|
37
|
+
return 0;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
const useColumnConcatenatedValue = (props) => {
|
|
41
|
+
return {
|
|
42
|
+
formatter: ColumnConcatenatedValueFormatter(props),
|
|
43
|
+
customFilter: getCustomContatenatedValueFilter(props),
|
|
44
|
+
customSort: getCustomConcatenatedValueSort(props)
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
export {
|
|
48
|
+
useColumnConcatenatedValue as u
|
|
49
|
+
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { getPropertyByString } from "@m4l/core";
|
|
3
|
+
import React from "react";
|
|
3
4
|
import { D as DateFormatter } from "../../../formatters/DateFormatter/DateFormatter.js";
|
|
4
5
|
function ColumnDateFormatter(props) {
|
|
5
|
-
const { fieldValue, presentationType, Component } = props;
|
|
6
|
+
const { fieldValue, presentationType, Component = React.Fragment } = props;
|
|
6
7
|
return (obProps) => {
|
|
7
8
|
const valueMaybeDateStringNumber = getPropertyByString(obProps, fieldValue);
|
|
8
9
|
let fixedValue;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ColumnDateFormatterProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* funcion para filtrar por fecha en una columna
|
|
4
|
+
*/
|
|
5
|
+
export declare const useCustomDateFilter: <TRow>(props: ColumnDateFormatterProps) => (row: TRow, value: string) => boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Funcion helper que retorna el formatter,
|
|
8
|
+
* customFilter y customSort de una columna de fecha
|
|
9
|
+
*/
|
|
10
|
+
export declare const useColumnDate: <TRow>(props: ColumnDateFormatterProps) => {
|
|
11
|
+
formatter: (obProps: any) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
customFilter: (row: TRow, value: string) => boolean;
|
|
13
|
+
customSort: (a: TRow, b: TRow) => 0 | 1 | -1;
|
|
14
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { getPropertyByString } from "@m4l/core";
|
|
2
|
+
import { g as getFormatDate } from "../../../formatters/DateFormatter/DateFormatter.js";
|
|
3
|
+
import { C as ColumnDateFormatter } from "./index.js";
|
|
4
|
+
import { g as getColumnKey } from "../../helpers/getColumnKey.js";
|
|
5
|
+
import { useFormatter } from "@m4l/graphics";
|
|
6
|
+
const useCustomDateFilter = (props) => {
|
|
7
|
+
const { dateFormatter } = useFormatter();
|
|
8
|
+
return (row, value) => {
|
|
9
|
+
const fieldValue = getColumnKey(props.fieldValue);
|
|
10
|
+
const rawValue = getPropertyByString(row, fieldValue);
|
|
11
|
+
let dateValue = null;
|
|
12
|
+
if (typeof rawValue === "string") {
|
|
13
|
+
dateValue = new Date(rawValue);
|
|
14
|
+
} else if (rawValue instanceof Date) {
|
|
15
|
+
dateValue = rawValue;
|
|
16
|
+
}
|
|
17
|
+
if (!dateValue || isNaN(dateValue.getTime())) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
const formattedDate = getFormatDate(props.presentationType, dateValue, dateFormatter, props.format);
|
|
21
|
+
return formattedDate.includes(value);
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
const getCustomDateSort = (props) => {
|
|
25
|
+
return (a, b) => {
|
|
26
|
+
const key = getColumnKey(props.fieldValue);
|
|
27
|
+
const valueMaybeDateStringNumberA = getPropertyByString(a, key);
|
|
28
|
+
const valueMaybeDateStringNumberB = getPropertyByString(b, key);
|
|
29
|
+
const fixedValueA = new Date(valueMaybeDateStringNumberA);
|
|
30
|
+
const fixedValueB = new Date(valueMaybeDateStringNumberB);
|
|
31
|
+
if (fixedValueA.getTime() > fixedValueB.getTime()) {
|
|
32
|
+
return 1;
|
|
33
|
+
}
|
|
34
|
+
if (fixedValueA.getTime() < fixedValueB.getTime()) {
|
|
35
|
+
return -1;
|
|
36
|
+
}
|
|
37
|
+
return 0;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
const useColumnDate = (props) => {
|
|
41
|
+
const customFilter = useCustomDateFilter(props);
|
|
42
|
+
return {
|
|
43
|
+
formatter: ColumnDateFormatter(props),
|
|
44
|
+
customFilter,
|
|
45
|
+
customSort: getCustomDateSort(props)
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
export {
|
|
49
|
+
useColumnDate as u
|
|
50
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ColumnInteractiveCheckFormatterProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Función que retorna para una columna "check":
|
|
4
|
+
* - formatter: ColumnInteractiveCheckFormatter
|
|
5
|
+
* - filter: getCustomInteractiveCheckFilter
|
|
6
|
+
* - customSort: getCustomInteractiveCheckSort
|
|
7
|
+
*/
|
|
8
|
+
export declare const useColumnInteractiveCheck: <TRow>(props: ColumnInteractiveCheckFormatterProps<TRow>) => {
|
|
9
|
+
formatter: import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
filter: (row: TRow, value: boolean) => boolean;
|
|
11
|
+
customSort: (a: TRow, b: TRow) => 0 | 1 | -1;
|
|
12
|
+
};
|
package/components/DataGrid/formatters/ColumnInteractiveCheckFormatter/useColumnInteractiveCheck.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { C as ColumnInteractiveCheckFormatter } from "./index.js";
|
|
2
|
+
const getCustomInteractiveCheckFilter = (props) => {
|
|
3
|
+
return (row, value) => {
|
|
4
|
+
return row[props.column.key] === value;
|
|
5
|
+
};
|
|
6
|
+
};
|
|
7
|
+
const getCustomInteractiveCheckSort = (props) => {
|
|
8
|
+
return (a, b) => {
|
|
9
|
+
const valueA = a[props.column.key];
|
|
10
|
+
const valueB = b[props.column.key];
|
|
11
|
+
if (valueA > valueB) {
|
|
12
|
+
return 1;
|
|
13
|
+
}
|
|
14
|
+
if (valueA < valueB) {
|
|
15
|
+
return -1;
|
|
16
|
+
}
|
|
17
|
+
return 0;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
const useColumnInteractiveCheck = (props) => {
|
|
21
|
+
return {
|
|
22
|
+
formatter: ColumnInteractiveCheckFormatter(props),
|
|
23
|
+
filter: getCustomInteractiveCheckFilter(props),
|
|
24
|
+
customSort: getCustomInteractiveCheckSort(props)
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export {
|
|
28
|
+
useColumnInteractiveCheck as u
|
|
29
|
+
};
|
|
@@ -5,7 +5,7 @@ function ColumnNestedValueFormatter(props) {
|
|
|
5
5
|
const { fieldValue, Component = WrapperComponent } = props;
|
|
6
6
|
return (obProps) => {
|
|
7
7
|
const property = getPropertyByString(obProps, fieldValue);
|
|
8
|
-
const value = typeof property === "object" ?
|
|
8
|
+
const value = typeof property === "object" ? JSON.stringify(property) : property;
|
|
9
9
|
return /* @__PURE__ */ jsx(Component, { children: value });
|
|
10
10
|
};
|
|
11
11
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ColumnNestedValueFormatterProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Funcion que retorna el formatter, customFilter y customSort
|
|
4
|
+
* de la columna para ColumnNestedValueFormatter.
|
|
5
|
+
*/
|
|
6
|
+
export declare const useColumnNestedValue: <TRow>(props: ColumnNestedValueFormatterProps) => {
|
|
7
|
+
formatter: (obProps: any) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
customFilter: (row: TRow, value: string) => boolean;
|
|
9
|
+
customSort: (a: TRow, b: TRow) => 0 | 1 | -1;
|
|
10
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { getPropertyByString } from "@m4l/core";
|
|
2
|
+
import { C as ColumnNestedValueFormatter } from "./index.js";
|
|
3
|
+
const getCustomNestedValueFilter = (props) => {
|
|
4
|
+
return (row, value) => {
|
|
5
|
+
const property = getPropertyByString(row, props.fieldValue) ?? "";
|
|
6
|
+
if (typeof property === "object") {
|
|
7
|
+
return Object.values(property).includes(value);
|
|
8
|
+
}
|
|
9
|
+
return property.toString().includes(value);
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
const getCustomNestedValueSort = (props) => {
|
|
13
|
+
return (a, b) => {
|
|
14
|
+
const valueA = getPropertyByString(a, props.fieldValue);
|
|
15
|
+
const valueB = getPropertyByString(b, props.fieldValue);
|
|
16
|
+
if (typeof valueA === "object" || typeof valueB === "object" || valueA === void 0 || valueB === void 0) {
|
|
17
|
+
return 0;
|
|
18
|
+
}
|
|
19
|
+
if (valueA > valueB) {
|
|
20
|
+
return 1;
|
|
21
|
+
}
|
|
22
|
+
if (valueA < valueB) {
|
|
23
|
+
return -1;
|
|
24
|
+
}
|
|
25
|
+
return 0;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
const useColumnNestedValue = (props) => {
|
|
29
|
+
return {
|
|
30
|
+
formatter: ColumnNestedValueFormatter(props),
|
|
31
|
+
customFilter: getCustomNestedValueFilter(props),
|
|
32
|
+
customSort: getCustomNestedValueSort(props)
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
export {
|
|
36
|
+
useColumnNestedValue as u
|
|
37
|
+
};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
2
3
|
import { P as PointsFormatter } from "../../../formatters/PointsFormatter/PointsFormatter.js";
|
|
3
4
|
function ColumnPointsFormatter(props) {
|
|
5
|
+
const { Component = React.Fragment } = props;
|
|
4
6
|
return (obProps) => {
|
|
5
|
-
return /* @__PURE__ */ jsx(PointsFormatter, { obProps, ...props });
|
|
7
|
+
return /* @__PURE__ */ jsx(PointsFormatter, { obProps, ...props, Component });
|
|
6
8
|
};
|
|
7
9
|
}
|
|
8
10
|
export {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ColumnPointsFormatterProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Funcion helper que retorna el formatter,
|
|
4
|
+
* customFilter y customSort de la columna de puntos de calibración.
|
|
5
|
+
*/
|
|
6
|
+
export declare const useColumnPoints: <TRow>(props: ColumnPointsFormatterProps) => {
|
|
7
|
+
formatter: (obProps: any) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
customFilter: (row: TRow, value: string) => boolean;
|
|
9
|
+
customSort: (a: TRow, b: TRow) => 0 | 1 | -1;
|
|
10
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { C as ColumnPointsFormatter } from "./index.js";
|
|
2
|
+
import { g as getColumnKey } from "../../helpers/getColumnKey.js";
|
|
3
|
+
import { g as getFormatPoints } from "../../../formatters/PointsFormatter/PointsFormatter.js";
|
|
4
|
+
const getCustomPointsFilter = (props) => {
|
|
5
|
+
return (row, value) => {
|
|
6
|
+
const fieldValue = getColumnKey(props.fieldValue);
|
|
7
|
+
const unitValue = getColumnKey(props.fieldUnit);
|
|
8
|
+
return getFormatPoints(row, fieldValue, unitValue).toLocaleLowerCase().includes(value.toLocaleLowerCase());
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
const getCustomPointsSort = (props) => {
|
|
12
|
+
return (a, b) => {
|
|
13
|
+
const fieldValue = getColumnKey(props.fieldValue);
|
|
14
|
+
const unitValue = getColumnKey(props.fieldUnit);
|
|
15
|
+
const valueA = getFormatPoints(a, fieldValue, unitValue);
|
|
16
|
+
const valueB = getFormatPoints(b, fieldValue, unitValue);
|
|
17
|
+
if (valueA > valueB) {
|
|
18
|
+
return 1;
|
|
19
|
+
}
|
|
20
|
+
if (valueA < valueB) {
|
|
21
|
+
return -1;
|
|
22
|
+
}
|
|
23
|
+
return 0;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
const useColumnPoints = (props) => {
|
|
27
|
+
return {
|
|
28
|
+
formatter: ColumnPointsFormatter(props),
|
|
29
|
+
customFilter: getCustomPointsFilter(props),
|
|
30
|
+
customSort: getCustomPointsSort(props)
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export {
|
|
34
|
+
useColumnPoints as u
|
|
35
|
+
};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
2
3
|
import { P as PriceFormatter } from "../../../formatters/PriceFormatter/PriceFormatter.js";
|
|
3
4
|
function ColumnPriceFormatter(props) {
|
|
5
|
+
const { Component = React.Fragment } = props;
|
|
4
6
|
return (obProps) => {
|
|
5
|
-
return /* @__PURE__ */ jsx(PriceFormatter, { obProps, ...props });
|
|
7
|
+
return /* @__PURE__ */ jsx(PriceFormatter, { obProps, ...props, Component });
|
|
6
8
|
};
|
|
7
9
|
}
|
|
8
10
|
export {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ColumnPriceFormatterProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Función helper que retorna el formatter,
|
|
4
|
+
* customFilter y customSort de la columna de precios.
|
|
5
|
+
*/
|
|
6
|
+
export declare const useColumnPrice: <TRow>(props: ColumnPriceFormatterProps) => {
|
|
7
|
+
formatter: (obProps: any) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
customFilter: (row: TRow, value: string) => boolean;
|
|
9
|
+
customSort: (a: TRow, b: TRow) => 0 | 1 | -1;
|
|
10
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { getPropertyByString } from "@m4l/core";
|
|
2
|
+
import { C as ColumnPriceFormatter } from "./index.js";
|
|
3
|
+
import { g as getColumnKey } from "../../helpers/getColumnKey.js";
|
|
4
|
+
import { g as getFormatPrice } from "../../../formatters/PriceFormatter/PriceFormatter.js";
|
|
5
|
+
import { useFormatter } from "@m4l/graphics";
|
|
6
|
+
const getCustomPriceFilter = (props) => {
|
|
7
|
+
const { currencyFormatter } = useFormatter();
|
|
8
|
+
return (row, value) => {
|
|
9
|
+
const fieldValue = getColumnKey(props.fieldValue);
|
|
10
|
+
return getFormatPrice(row, fieldValue, currencyFormatter.code, currencyFormatter.decimalDigits).includes(value);
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
const getCustomPriceSort = (props) => {
|
|
14
|
+
return (a, b) => {
|
|
15
|
+
const fieldValue = getColumnKey(props.fieldValue);
|
|
16
|
+
const valueMaybeStringA = getPropertyByString(a, fieldValue);
|
|
17
|
+
const valueMaybeStringB = getPropertyByString(b, fieldValue);
|
|
18
|
+
let fixedValueA;
|
|
19
|
+
let fixedValueB;
|
|
20
|
+
if (typeof valueMaybeStringA === "number") {
|
|
21
|
+
fixedValueA = valueMaybeStringA;
|
|
22
|
+
} else {
|
|
23
|
+
fixedValueA = 0;
|
|
24
|
+
}
|
|
25
|
+
if (typeof valueMaybeStringB === "number") {
|
|
26
|
+
fixedValueB = valueMaybeStringB;
|
|
27
|
+
} else {
|
|
28
|
+
fixedValueB = 0;
|
|
29
|
+
}
|
|
30
|
+
if (fixedValueA > fixedValueB) {
|
|
31
|
+
return 1;
|
|
32
|
+
}
|
|
33
|
+
if (fixedValueA < fixedValueB) {
|
|
34
|
+
return -1;
|
|
35
|
+
}
|
|
36
|
+
return 0;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
const useColumnPrice = (props) => {
|
|
40
|
+
return {
|
|
41
|
+
formatter: ColumnPriceFormatter(props),
|
|
42
|
+
customFilter: getCustomPriceFilter(props),
|
|
43
|
+
customSort: getCustomPriceSort(props)
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
export {
|
|
47
|
+
useColumnPrice as u
|
|
48
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ColumnSetCheckFormatterProps } from './types';
|
|
2
|
+
import { RowKey } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Funcion helper que retorna el formatter, customFilter y customSort
|
|
5
|
+
* de la columna de selección de elementos.
|
|
6
|
+
*/
|
|
7
|
+
export declare const useColumnSetCheck: <TRow, TKey extends RowKey = RowKey>(props: ColumnSetCheckFormatterProps<TRow, TKey>) => {
|
|
8
|
+
formatter: (props: import('react-data-grid').FormatterProps<TRow, unknown>) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
customFilter: (row: TRow, value: TKey) => boolean;
|
|
10
|
+
customSort: (a: TRow, b: TRow) => 0 | 1 | -1;
|
|
11
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { C as ColumnSetCheckFormatter } from "./index.js";
|
|
2
|
+
import { getPropertyByString } from "@m4l/core";
|
|
3
|
+
const getCustomFilter = (props) => {
|
|
4
|
+
return (row, value) => {
|
|
5
|
+
const valueCheck = getPropertyByString(row, props.field);
|
|
6
|
+
return valueCheck === value;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
const getCustomSort = (props) => {
|
|
10
|
+
return (a, b) => {
|
|
11
|
+
const { useHook, field, rowKeyGetter } = props;
|
|
12
|
+
const [checkedRows] = useHook(field);
|
|
13
|
+
const indexA = checkedRows.has(rowKeyGetter(a));
|
|
14
|
+
const indexB = checkedRows.has(rowKeyGetter(b));
|
|
15
|
+
if (indexA && !indexB) {
|
|
16
|
+
return 1;
|
|
17
|
+
} else if (!indexA && indexB) {
|
|
18
|
+
return -1;
|
|
19
|
+
}
|
|
20
|
+
return 0;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
const useColumnSetCheck = (props) => {
|
|
24
|
+
return {
|
|
25
|
+
formatter: ColumnSetCheckFormatter(props),
|
|
26
|
+
customFilter: getCustomFilter(props),
|
|
27
|
+
customSort: getCustomSort(props)
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export {
|
|
31
|
+
useColumnSetCheck as u
|
|
32
|
+
};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
2
3
|
import { U as UncertaintyFormatter } from "../../../formatters/UncertaintyFormatter/UncertaintyFormatter.js";
|
|
3
4
|
function ColumnUncertaintyFormatter(props) {
|
|
5
|
+
const { Component = React.Fragment } = props;
|
|
4
6
|
return (obProps) => {
|
|
5
|
-
return /* @__PURE__ */ jsx(UncertaintyFormatter, { obProps, ...props });
|
|
7
|
+
return /* @__PURE__ */ jsx(UncertaintyFormatter, { obProps, ...props, Component });
|
|
6
8
|
};
|
|
7
9
|
}
|
|
8
10
|
export {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ColumnUncertaintyFormatterProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Función helper que retorna el formatter,
|
|
4
|
+
* el filtro y el customSort de la columna
|
|
5
|
+
* de incertidumbre.
|
|
6
|
+
*/
|
|
7
|
+
export declare const useColumnCertanity: <TRow>(props: ColumnUncertaintyFormatterProps) => {
|
|
8
|
+
formatter: (obProps: any) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
customFilter: (row: TRow, value: string) => boolean;
|
|
10
|
+
customSort: (a: TRow, b: TRow) => 0 | 1 | -1;
|
|
11
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { g as getUncertaintyFormat } from "../../../formatters/UncertaintyFormatter/UncertaintyFormatter.js";
|
|
2
|
+
import { C as ColumnUncertaintyFormatter } from "./index.js";
|
|
3
|
+
import { g as getColumnKey } from "../../helpers/getColumnKey.js";
|
|
4
|
+
const getCustomUncertaintyFilter = (props) => {
|
|
5
|
+
return (row, value) => {
|
|
6
|
+
const fieldValue = getColumnKey(props.fieldValue);
|
|
7
|
+
const fieldSymbol = getColumnKey(props.fieldSymbol);
|
|
8
|
+
const fieldUnit = getColumnKey(props.fieldUnit);
|
|
9
|
+
const format = getUncertaintyFormat(
|
|
10
|
+
row,
|
|
11
|
+
fieldValue,
|
|
12
|
+
fieldSymbol,
|
|
13
|
+
fieldUnit
|
|
14
|
+
);
|
|
15
|
+
return format.includes(value);
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
const getCustomUncertaintySort = (props) => {
|
|
19
|
+
return (a, b) => {
|
|
20
|
+
const fieldValue = getColumnKey(props.fieldValue);
|
|
21
|
+
const fieldSymbol = getColumnKey(props.fieldSymbol);
|
|
22
|
+
const fieldUnit = getColumnKey(props.fieldUnit);
|
|
23
|
+
const valueA = getUncertaintyFormat(a, fieldValue, fieldSymbol, fieldUnit);
|
|
24
|
+
const valueB = getUncertaintyFormat(b, fieldValue, fieldSymbol, fieldUnit);
|
|
25
|
+
if (valueA > valueB) {
|
|
26
|
+
return 1;
|
|
27
|
+
}
|
|
28
|
+
if (valueA < valueB) {
|
|
29
|
+
return -1;
|
|
30
|
+
}
|
|
31
|
+
return 0;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
const useColumnCertanity = (props) => {
|
|
35
|
+
return {
|
|
36
|
+
formatter: ColumnUncertaintyFormatter(props),
|
|
37
|
+
customFilter: getCustomUncertaintyFilter(props),
|
|
38
|
+
customSort: getCustomUncertaintySort(props)
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
export {
|
|
42
|
+
useColumnCertanity as u
|
|
43
|
+
};
|
|
@@ -9,3 +9,12 @@ export { ColumnInteractiveCheckFormatter } from './ColumnInteractiveCheckFormatt
|
|
|
9
9
|
export { ColumnSetCheckFormatter } from './ColumnSetCheckFormatter';
|
|
10
10
|
export type { ColumnUncertaintyFormatterProps } from './ColumnUncertaintyFormatter/types';
|
|
11
11
|
export { ColumnIconFormatter } from './ColumnIconFormatter';
|
|
12
|
+
export { useColumnBoolean } from './ColumnBooleanFormatter/useColumnBoolean';
|
|
13
|
+
export { useColumnConcatenatedValue } from './ColumnConcatenatedValueFormatter/useColumnConcatenatedValue';
|
|
14
|
+
export { useColumnDate } from './ColumnDateFormatter/useColumnDate';
|
|
15
|
+
export { useColumnNestedValue } from './ColumnNestedValueFormatter/useColumnNestedValue';
|
|
16
|
+
export { useColumnPrice } from './ColumnPriceFormatter/useColumnPrice';
|
|
17
|
+
export { useColumnCertanity } from './ColumnUncertaintyFormatter/useColumnUncertainty';
|
|
18
|
+
export { useColumnPoints } from './ColumnPointsFormatter/useColumnPoints';
|
|
19
|
+
export { useColumnInteractiveCheck } from './ColumnInteractiveCheckFormatter/useColumnInteractiveCheck';
|
|
20
|
+
export { useColumnSetCheck } from './ColumnSetCheckFormatter/useColumnSetCheck';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Función utilizada para remover la parabra 'row' en la posicion cero de las keys de
|
|
3
|
+
* las columnas concatenadas. Esto se utiliza para obtener la key directa
|
|
4
|
+
* asignada en una columna.
|
|
5
|
+
* @param key - key de la columna
|
|
6
|
+
* @returns key sin la palabra 'row'
|
|
7
|
+
* @example
|
|
8
|
+
* - row.concatenated -> concatenated
|
|
9
|
+
* - row.user.name -> user.name
|
|
10
|
+
* @example
|
|
11
|
+
* getColumnKey('row.concatenated') // 'concatenated'
|
|
12
|
+
*/
|
|
13
|
+
export declare const getColumnKey: (key: string) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -29,6 +29,7 @@ declare module 'react-data-grid' {
|
|
|
29
29
|
withFilter?: boolean;
|
|
30
30
|
withinHeaderRenderer?: React.FunctionComponent<HeaderRendererProps<TRow, TSummaryRow>>;
|
|
31
31
|
customFilter?: (row: TRow, value: string) => boolean;
|
|
32
|
+
customSort?: (a: TRow, b: TRow) => number;
|
|
32
33
|
}
|
|
33
34
|
}
|
|
34
35
|
export declare type RowKey = string | number;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { BooleanFormatterProps } from './types';
|
|
2
|
+
import { BooleanFormatterProps, PresentationType } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* TODO: crearlo aparte como un helper
|
|
5
|
+
*/
|
|
6
|
+
export declare function getFormatBoolean(presentationType: PresentationType, value: boolean | undefined, getLabel: (key: string) => string): string;
|
|
3
7
|
/**
|
|
4
8
|
* BooleanFormatter
|
|
5
9
|
* A component for formatting boolean values (`true` or `false`) into various presentation styles such as text or checkbox.
|
|
@@ -8,29 +8,34 @@ import { B as BOOLEAN_FORMATTER_KEY_COMPONENT } from "./constants.js";
|
|
|
8
8
|
import { g as getPropDataTestId } from "../../../test/getNameDataTestId.js";
|
|
9
9
|
import { B as BooleanFormatterIconStyled, a as BooleanFormatterRootStyled } from "./slots/BooleanFormatterSlots.js";
|
|
10
10
|
import { B as BooleanFormatterSlots } from "./slots/BooleanFormatterEnum.js";
|
|
11
|
+
function getFormatBoolean(presentationType, value = false, getLabel) {
|
|
12
|
+
if (presentationType === "string_yes_no") {
|
|
13
|
+
return value ? getLabel(LABEL_BOOLEAN_YES) : getLabel(LABEL_BOOLEAN_NO);
|
|
14
|
+
}
|
|
15
|
+
if (presentationType === "string_true_false") {
|
|
16
|
+
return value ? getLabel(LABEL_BOOLEAN_TRUE) : getLabel(LABEL_BOOLEAN_FALSE);
|
|
17
|
+
}
|
|
18
|
+
return "";
|
|
19
|
+
}
|
|
11
20
|
function BooleanFormatter(props) {
|
|
12
|
-
const { presentationType, value, Component = BooleanFormatterRootStyled, dataTestId, className, componentProps } = props;
|
|
21
|
+
const { presentationType, value = false, Component = BooleanFormatterRootStyled, dataTestId, className, componentProps } = props;
|
|
13
22
|
const { getLabel } = useModuleDictionary();
|
|
14
23
|
const { host_static_assets, environment_assets } = useEnvironment();
|
|
15
|
-
const final_value = value ?? false;
|
|
16
24
|
const srcCheckTrue = `${host_static_assets}/${environment_assets}/frontend/components/data_grid/components/boolean_formatter/assets/icons/check_true.svg`;
|
|
17
25
|
const srcCheckFalse = `${host_static_assets}/${environment_assets}/frontend/components/data_grid/components/boolean_formatter/assets/icons/check_false.svg`;
|
|
18
|
-
const ownerState = { value
|
|
26
|
+
const ownerState = { value };
|
|
19
27
|
const memoComponent = useMemo(() => {
|
|
20
|
-
if (presentationType === "
|
|
21
|
-
return
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
28
|
+
if (presentationType === "check") {
|
|
29
|
+
return /* @__PURE__ */ jsx(
|
|
30
|
+
BooleanFormatterIconStyled,
|
|
31
|
+
{
|
|
32
|
+
ownerState,
|
|
33
|
+
src: value ? srcCheckTrue : srcCheckFalse
|
|
34
|
+
}
|
|
35
|
+
);
|
|
25
36
|
}
|
|
26
|
-
return
|
|
27
|
-
|
|
28
|
-
{
|
|
29
|
-
ownerState,
|
|
30
|
-
src: final_value ? srcCheckTrue : srcCheckFalse
|
|
31
|
-
}
|
|
32
|
-
);
|
|
33
|
-
}, [final_value, getLabel, presentationType, srcCheckTrue, srcCheckFalse]);
|
|
37
|
+
return getFormatBoolean(presentationType, value, getLabel);
|
|
38
|
+
}, [value, getLabel, presentationType, srcCheckTrue, srcCheckFalse]);
|
|
34
39
|
if (Component === React.Fragment) {
|
|
35
40
|
return memoComponent;
|
|
36
41
|
}
|
|
@@ -47,5 +52,6 @@ function BooleanFormatter(props) {
|
|
|
47
52
|
);
|
|
48
53
|
}
|
|
49
54
|
export {
|
|
50
|
-
BooleanFormatter as B
|
|
55
|
+
BooleanFormatter as B,
|
|
56
|
+
getFormatBoolean as g
|
|
51
57
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
+
import { DateFormatter as DateFormatterType } from '@m4l/graphics';
|
|
2
3
|
import { DateFormatterProps, PresentationType } from './types';
|
|
3
4
|
declare type Maybe<T> = T | undefined | null;
|
|
4
5
|
/**
|
|
@@ -8,7 +9,7 @@ declare type Maybe<T> = T | undefined | null;
|
|
|
8
9
|
* @param format Formato
|
|
9
10
|
* @returns string
|
|
10
11
|
*/
|
|
11
|
-
export declare function
|
|
12
|
+
export declare function getFormatDate(presentationType: PresentationType, value: Maybe<Date | string | number>, dateFormatter: DateFormatterType, format?: string): string;
|
|
12
13
|
/**
|
|
13
14
|
* DateFormatter
|
|
14
15
|
* A component for formatting date values into various presentation styles such as text or custom wrappers.
|
|
@@ -7,8 +7,7 @@ import clsx from "clsx";
|
|
|
7
7
|
import { a as getComponentSlotRoot } from "../../../utils/getComponentSlotRoot.js";
|
|
8
8
|
import { g as getPropDataTestId } from "../../../test/getNameDataTestId.js";
|
|
9
9
|
import { D as DATE_FORMATTER_KEY_COMPONENT } from "./constants.js";
|
|
10
|
-
function
|
|
11
|
-
const { dateFormatter } = useFormatter();
|
|
10
|
+
function getFormatDate(presentationType, value, dateFormatter, format) {
|
|
12
11
|
let finalFormat = format || dateFormatter.datetimeFormat;
|
|
13
12
|
let result;
|
|
14
13
|
let resultDate;
|
|
@@ -49,7 +48,8 @@ function DateFormatter(props) {
|
|
|
49
48
|
className,
|
|
50
49
|
componentProps
|
|
51
50
|
} = props;
|
|
52
|
-
const
|
|
51
|
+
const { dateFormatter } = useFormatter();
|
|
52
|
+
const formattedDate = getFormatDate(presentationType, value, dateFormatter, format);
|
|
53
53
|
const memoComponent = useMemo(() => {
|
|
54
54
|
return formattedDate;
|
|
55
55
|
}, [formattedDate]);
|
|
@@ -69,5 +69,5 @@ function DateFormatter(props) {
|
|
|
69
69
|
}
|
|
70
70
|
export {
|
|
71
71
|
DateFormatter as D,
|
|
72
|
-
|
|
72
|
+
getFormatDate as g
|
|
73
73
|
};
|
|
@@ -12,16 +12,16 @@ import { u as useComponentSize } from "../../../hooks/useComponentSize/useCompon
|
|
|
12
12
|
function getFormatPrice(obProps, fieldValue, currency, decimalDigits) {
|
|
13
13
|
let result = "";
|
|
14
14
|
const value = getPropertyByString(obProps, fieldValue);
|
|
15
|
-
if (isNaN(Number(value))) {
|
|
16
|
-
return Number("").toLocaleString(navigator.language, {
|
|
17
|
-
currency,
|
|
18
|
-
style: "currency",
|
|
19
|
-
currencyDisplay: "symbol",
|
|
20
|
-
useGrouping: true,
|
|
21
|
-
maximumFractionDigits: decimalDigits
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
15
|
try {
|
|
16
|
+
if (isNaN(Number(value))) {
|
|
17
|
+
return Number("").toLocaleString(navigator.language, {
|
|
18
|
+
currency,
|
|
19
|
+
style: "currency",
|
|
20
|
+
currencyDisplay: "symbol",
|
|
21
|
+
useGrouping: true,
|
|
22
|
+
maximumFractionDigits: decimalDigits
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
25
|
result = Number(value).toLocaleString(navigator.language, {
|
|
26
26
|
currency,
|
|
27
27
|
style: "currency",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { BooleanFormatter } from './BooleanFormatter/BooleanFormatter';
|
|
2
|
-
export {
|
|
2
|
+
export { getFormatDate, DateFormatter } from './DateFormatter/DateFormatter';
|
|
3
3
|
export { UncertaintyFormatter, getUncertaintyFormat } from './UncertaintyFormatter/UncertaintyFormatter';
|
|
4
4
|
export { PointsFormatter, getFormatPoints } from './PointsFormatter/PointsFormatter';
|
|
5
5
|
export { getFormatConcatenated, ConcatenatedFormatter } from './ConcatenatedFormatter/ConcatenatedFormatter';
|
package/index.js
CHANGED
|
@@ -22,6 +22,7 @@ import { a as a3, A as A4 } from "./components/areas/contexts/AreasContext/index
|
|
|
22
22
|
import { u } from "./components/areas/hooks/useDynamicMFParameters/index.js";
|
|
23
23
|
import { u as u2 } from "./components/areas/hooks/useWindowToolsMF/index.js";
|
|
24
24
|
import { u as u3 } from "./components/areas/hooks/useSetWindowsTitle/useSetWindowsTitle.js";
|
|
25
|
+
import { u as u4 } from "./components/areas/hooks/useAreas/index.js";
|
|
25
26
|
import { A as A5, a as a4, L as L2, b as b2, g as g3 } from "./components/areas/dictionary.js";
|
|
26
27
|
import { R } from "./components/hook-form/RHFAutocomplete/RHFAutocomplete.js";
|
|
27
28
|
import { g as g4 } from "./components/hook-form/RHFAutocomplete/dictionary.js";
|
|
@@ -47,15 +48,15 @@ import { P, R as R17, S as S2, T as T2 } from "./components/hook-form/RHFPeriod/
|
|
|
47
48
|
import { R as R18 } from "./components/hook-form/RHFUpload/RHFUploadImage/RHFUploadImage.js";
|
|
48
49
|
import { C } from "./components/Chip/Chip.js";
|
|
49
50
|
import { B } from "./components/formatters/BooleanFormatter/BooleanFormatter.js";
|
|
50
|
-
import { D as D2,
|
|
51
|
-
import { U, g as
|
|
52
|
-
import { P as P2, g as
|
|
53
|
-
import { C as C2, g as
|
|
51
|
+
import { D as D2, g as g7 } from "./components/formatters/DateFormatter/DateFormatter.js";
|
|
52
|
+
import { U, g as g8 } from "./components/formatters/UncertaintyFormatter/UncertaintyFormatter.js";
|
|
53
|
+
import { P as P2, g as g9 } from "./components/formatters/PointsFormatter/PointsFormatter.js";
|
|
54
|
+
import { C as C2, g as g10 } from "./components/formatters/ConcatenatedFormatter/ConcatenatedFormatter.js";
|
|
54
55
|
import { P as P3, u as u5 } from "./components/formatters/PeriodFormatter/PeriodFormatter.js";
|
|
55
|
-
import { P as P4, g as
|
|
56
|
-
import { g as
|
|
56
|
+
import { P as P4, g as g11 } from "./components/formatters/PriceFormatter/PriceFormatter.js";
|
|
57
|
+
import { g as g12 } from "./components/formatters/DistanceToNowFormatter/dictionary.js";
|
|
57
58
|
import { D as D3 } from "./components/formatters/DistanceToNowFormatter/DistanceToNowFormatter.js";
|
|
58
|
-
import { g as
|
|
59
|
+
import { g as g13 } from "./components/formatters/dictionary.js";
|
|
59
60
|
import { C as C3 } from "./components/DataGrid/formatters/ColumnUncertaintyFormatter/index.js";
|
|
60
61
|
import { C as C4 } from "./components/DataGrid/formatters/ColumnPointsFormatter/index.js";
|
|
61
62
|
import { C as C5 } from "./components/DataGrid/formatters/ColumnNestedValueFormatter/index.js";
|
|
@@ -66,6 +67,15 @@ import { C as C9 } from "./components/DataGrid/formatters/ColumnPriceFormatter/i
|
|
|
66
67
|
import { C as C10 } from "./components/DataGrid/formatters/ColumnInteractiveCheckFormatter/index.js";
|
|
67
68
|
import { C as C11 } from "./components/DataGrid/formatters/ColumnSetCheckFormatter/index.js";
|
|
68
69
|
import { C as C12 } from "./components/DataGrid/formatters/ColumnIconFormatter/index.js";
|
|
70
|
+
import { u as u6 } from "./components/DataGrid/formatters/ColumnBooleanFormatter/useColumnBoolean.js";
|
|
71
|
+
import { u as u7 } from "./components/DataGrid/formatters/ColumnConcatenatedValueFormatter/useColumnConcatenatedValue.js";
|
|
72
|
+
import { u as u8 } from "./components/DataGrid/formatters/ColumnDateFormatter/useColumnDate.js";
|
|
73
|
+
import { u as u9 } from "./components/DataGrid/formatters/ColumnNestedValueFormatter/useColumnNestedValue.js";
|
|
74
|
+
import { u as u10 } from "./components/DataGrid/formatters/ColumnPriceFormatter/useColumnPrice.js";
|
|
75
|
+
import { u as u11 } from "./components/DataGrid/formatters/ColumnUncertaintyFormatter/useColumnUncertainty.js";
|
|
76
|
+
import { u as u12 } from "./components/DataGrid/formatters/ColumnPointsFormatter/useColumnPoints.js";
|
|
77
|
+
import { u as u13 } from "./components/DataGrid/formatters/ColumnInteractiveCheckFormatter/useColumnInteractiveCheck.js";
|
|
78
|
+
import { u as u14 } from "./components/DataGrid/formatters/ColumnSetCheckFormatter/useColumnSetCheck.js";
|
|
69
79
|
import { a as a5 } from "./components/DynamicFilter/dictionary.js";
|
|
70
80
|
import { D as D4 } from "./components/DynamicFilter/DynamicFilter.js";
|
|
71
81
|
import { a as a6 } from "./components/DynamicSort/dictionary.js";
|
|
@@ -77,7 +87,7 @@ import { A as A7 } from "./components/CommonActions/components/ActionCancel/Acti
|
|
|
77
87
|
import { A as A8 } from "./components/CommonActions/components/ActionIntro/ActionIntro.js";
|
|
78
88
|
import { A as A9 } from "./components/CommonActions/components/ActionFormCancel/ActionFormCancel.js";
|
|
79
89
|
import { A as A10 } from "./components/CommonActions/components/ActionFormIntro/ActionFormIntro.js";
|
|
80
|
-
import { D as D6, d, g as
|
|
90
|
+
import { D as D6, d, g as g14 } from "./components/CommonActions/dictionary.js";
|
|
81
91
|
import { D as D7 } from "./components/DragResizeWindow/DragResizeWindow.js";
|
|
82
92
|
import { d as d2 } from "./components/DragResizeWindow/classes/index.js";
|
|
83
93
|
import { G } from "./components/GridLayout/GridLayout.js";
|
|
@@ -91,8 +101,8 @@ import { L as L5 } from "./components/LinearProgressIndeterminate/LinearProgress
|
|
|
91
101
|
import { I as I3 } from "./components/Image/Image.js";
|
|
92
102
|
import { L as L6 } from "./components/Loadable/index.js";
|
|
93
103
|
import { M as M3 } from "./components/ModalDialog/ModalDialog.js";
|
|
94
|
-
import { g as
|
|
95
|
-
import { d as d4, g as
|
|
104
|
+
import { g as g15 } from "./components/modal/dictionary.js";
|
|
105
|
+
import { d as d4, g as g16 } from "./components/ModalDialog/dictionary.js";
|
|
96
106
|
import { W as W2 } from "./components/WindowConfirm/WindowConfirm.js";
|
|
97
107
|
import { w as w2 } from "./components/WindowBase/WindowBase.styles.js";
|
|
98
108
|
import { W as W3 } from "./components/WindowBase/WindowBase.js";
|
|
@@ -102,13 +112,13 @@ import { W as W5 } from "./components/WindowBase/slots/WindowBaseEnum.js";
|
|
|
102
112
|
import { a as a7, C as C13, b as b3, H as H2, I as I5, e as e2, L as L7, M as M4, c as c4, P as P6, S as S3, d as d5, T as T3, W as W6 } from "./components/WindowBase/slots/WindowBaseSlots.js";
|
|
103
113
|
import { H as H3 } from "./components/WindowBase/subcomponents/Header/HeaderWindowBase.js";
|
|
104
114
|
import { L as L8 } from "./components/LoadingError/LoadingError.js";
|
|
105
|
-
import { g as
|
|
115
|
+
import { g as g17 } from "./components/LoadingError/dictionary.js";
|
|
106
116
|
import { M as M5 } from "./components/MFLoader/MFLoader.js";
|
|
107
|
-
import { g as
|
|
117
|
+
import { g as g18 } from "./components/MFLoader/dictionary.js";
|
|
108
118
|
import { N as N2 } from "./components/NoItemSelected/NoItemSelected.js";
|
|
109
|
-
import { g as
|
|
119
|
+
import { g as g19 } from "./components/NoItemSelected/dictionary.js";
|
|
110
120
|
import { O } from "./components/ObjectLogs/index.js";
|
|
111
|
-
import { d as d6, g as
|
|
121
|
+
import { d as d6, g as g20 } from "./components/ObjectLogs/dictionary.js";
|
|
112
122
|
import { P as P7 } from "./components/PaperForm/PaperForm.js";
|
|
113
123
|
import { P as P8 } from "./components/PDFViewer/PDFViewer.js";
|
|
114
124
|
import { H as H4 } from "./components/HelmetPage/index.js";
|
|
@@ -126,10 +136,10 @@ import { T as T4 } from "./components/ToastContainer/ToastContainer.js";
|
|
|
126
136
|
import { T as T5 } from "./components/ToastContainer/subcomponents/ToastMessage/ToastMessage.js";
|
|
127
137
|
import { S as S6 } from "./components/SideBar/SideBar.js";
|
|
128
138
|
import { A as A11 } from "./components/AppBar/AppBar.js";
|
|
129
|
-
import { g as
|
|
139
|
+
import { g as g21 } from "./components/AppBar/dictionary.js";
|
|
130
140
|
import { A as A12 } from "./components/AccountPopover/AccountPopover.js";
|
|
131
|
-
import { g as
|
|
132
|
-
import { u as
|
|
141
|
+
import { g as g22 } from "./components/AccountPopover/dictionary.js";
|
|
142
|
+
import { u as u15 } from "./components/popups/components/PopupsProvider/hooks/usePopupsStore/index.js";
|
|
133
143
|
import { P as P11, a as a10 } from "./components/popups/components/PopupsProvider/contexts/PopupsContext/PopupsContext.js";
|
|
134
144
|
import { P as P12 } from "./components/popups/components/PopupsViewer/PopupsViewer.js";
|
|
135
145
|
import { A as A13 } from "./components/commercial/AppBarCommercial/index.js";
|
|
@@ -148,7 +158,7 @@ import { L as L9 } from "./components/mui_extended/LinearProgress/index.js";
|
|
|
148
158
|
import { L as L10 } from "./components/mui_extended/LinkWithRoute/index.js";
|
|
149
159
|
import { L as L11 } from "./components/mui_extended/LoadingButton/LoadingButton.js";
|
|
150
160
|
import { P as P13 } from "./components/Pager/Pager.js";
|
|
151
|
-
import { g as
|
|
161
|
+
import { g as g23 } from "./components/Pager/dicctionary.js";
|
|
152
162
|
import { T as T7 } from "./components/mui_extended/Tab/Tab.js";
|
|
153
163
|
import { T as T8 } from "./components/mui_extended/Tooltip/Tooltip.js";
|
|
154
164
|
import { I as I6 } from "./components/mui_extended/IconButton/IconButton.js";
|
|
@@ -174,30 +184,30 @@ import { T as T19 } from "./components/mui_extended/ToggleIconButton/slots/Toggl
|
|
|
174
184
|
import { T as T20 } from "./components/mui_extended/ToggleIconButton/slots/ToggleIconButtonSlots.js";
|
|
175
185
|
import { N as N3 } from "./components/mui_extended/NavLink/NavLink.js";
|
|
176
186
|
import { a as a12, D as D8, M as M8 } from "./components/areas/contexts/DynamicMFParmsContext/index.js";
|
|
177
|
-
import { F as F2, R as R22, u as
|
|
178
|
-
import { g as
|
|
179
|
-
import { u as
|
|
187
|
+
import { F as F2, R as R22, u as u16 } from "./components/hook-form/RHFormContext/index.js";
|
|
188
|
+
import { g as g24 } from "./components/hook-form/RHFormContext/dictionary.js";
|
|
189
|
+
import { u as u17 } from "./contexts/AppearanceComponentContext/useAppearanceComponentStore.js";
|
|
180
190
|
import { A as A16 } from "./contexts/AppearanceComponentContext/AppearanceComponentContext.js";
|
|
181
191
|
import { a as a13, M as M9 } from "./contexts/ModalContext/index.js";
|
|
182
|
-
import { u as
|
|
183
|
-
import { u as
|
|
184
|
-
import { u as
|
|
185
|
-
import { g as
|
|
186
|
-
import { u as
|
|
187
|
-
import { u as
|
|
188
|
-
import { u as
|
|
189
|
-
import { u as
|
|
190
|
-
import { u as
|
|
192
|
+
import { u as u18 } from "./hooks/useFormAddEdit/index.js";
|
|
193
|
+
import { u as u19 } from "./hooks/useModal/index.js";
|
|
194
|
+
import { u as u20 } from "./hooks/useTab/index.js";
|
|
195
|
+
import { g as g25 } from "./hooks/useFormAddEdit/dictionary.js";
|
|
196
|
+
import { u as u21 } from "./hooks/useFormFocus/index.js";
|
|
197
|
+
import { u as u22 } from "./hooks/useInterval/index.js";
|
|
198
|
+
import { u as u23 } from "./hooks/useComponentSize/useComponentSize.js";
|
|
199
|
+
import { u as u24 } from "./hooks/useFormReadyForUpdate/index.js";
|
|
200
|
+
import { u as u25 } from "./hooks/useStateRef/index.js";
|
|
191
201
|
import { a as a14 } from "./hooks/useSvgColor/constants.js";
|
|
192
|
-
import { u as
|
|
202
|
+
import { u as u26 } from "./hooks/useSvgColor/useSvgColor.js";
|
|
193
203
|
import { c as c5 } from "./utils/capitalizeFirstLetter.js";
|
|
194
204
|
import { i as i2 } from "./utils/isValidDate.js";
|
|
195
|
-
import { g as
|
|
196
|
-
import { g as
|
|
197
|
-
import { g as
|
|
198
|
-
import { g as
|
|
205
|
+
import { g as g26 } from "./utils/getComponentUtilityClass.js";
|
|
206
|
+
import { g as g27 } from "./utils/getPaletteColor.js";
|
|
207
|
+
import { g as g28 } from "./utils/getTypographyStyles.js";
|
|
208
|
+
import { g as g29 } from "./utils/getSizeStyles/getSizeStyles.js";
|
|
199
209
|
import { O as O2 } from "./utils/ObjectQueue.js";
|
|
200
|
-
import { g as
|
|
210
|
+
import { g as g30, a as a15 } from "./utils/getComponentSlotRoot.js";
|
|
201
211
|
import { f } from "./utils/formatDistanceToNow/formatDistanteToNow.js";
|
|
202
212
|
import { W as W7, c as c6, b as b4, a as a16, e as e3, d as d7, f as f2 } from "./vendor.js";
|
|
203
213
|
export {
|
|
@@ -391,62 +401,72 @@ export {
|
|
|
391
401
|
d6 as defaultObjectLogDictionary,
|
|
392
402
|
d2 as dragResizeWindowClasses,
|
|
393
403
|
f as formatDistanceToNow,
|
|
394
|
-
|
|
395
|
-
|
|
404
|
+
g22 as getAccountPopoverDictionary,
|
|
405
|
+
g21 as getAppBarDictionary,
|
|
396
406
|
b2 as getAreasComponentsDictionary,
|
|
397
407
|
g3 as getAreasDictionary,
|
|
398
|
-
|
|
399
|
-
|
|
408
|
+
g14 as getCommonActionsDictionary,
|
|
409
|
+
g30 as getComponentClasses,
|
|
400
410
|
a15 as getComponentSlotRoot,
|
|
401
|
-
|
|
411
|
+
g26 as getComponentUtilityClass,
|
|
402
412
|
g as getDataGridComponentsDictionary,
|
|
403
413
|
g2 as getDataGridRowsFromSet,
|
|
404
|
-
|
|
414
|
+
g12 as getDistanceToNowFormatterComponentsDictionary,
|
|
405
415
|
a5 as getDynamicFilterComponentsDictionary,
|
|
406
416
|
a6 as getDynamicSortComponentsDictionary,
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
417
|
+
g24 as getFormComponentsDictionary,
|
|
418
|
+
g10 as getFormatConcatenated,
|
|
419
|
+
g7 as getFormatDate,
|
|
420
|
+
g9 as getFormatPoints,
|
|
421
|
+
g11 as getFormatPrice,
|
|
422
|
+
g13 as getFormattersComponentsDictionary,
|
|
423
|
+
g29 as getHeightSizeStyles,
|
|
424
|
+
g17 as getLoadingErrorComponentsDictionary,
|
|
425
|
+
g18 as getMFLoaderComponentsDictionary,
|
|
416
426
|
a8 as getMenuActionsComponentsDictionary,
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
427
|
+
g16 as getModalDialogComponentsDictionary,
|
|
428
|
+
g15 as getModalDictionary,
|
|
429
|
+
g19 as getNoItemSelectedComponentsDictionary,
|
|
430
|
+
g20 as getObjectLogsComponentsDictionary,
|
|
431
|
+
g23 as getPagerComponentsDictionary,
|
|
432
|
+
g27 as getPaletteColor,
|
|
423
433
|
g6 as getPeriodComponetsDictionary,
|
|
424
434
|
g5 as getRHFAutocompleteAsyncComponentsDictionary,
|
|
425
435
|
g4 as getRHFAutocompleteComponentsDictionary,
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
436
|
+
g28 as getTypographyStyles,
|
|
437
|
+
g8 as getUncertaintyFormat,
|
|
438
|
+
g25 as getformAddEditDictionary,
|
|
429
439
|
i as isEqualLayout,
|
|
430
440
|
k as isEqualLayouts,
|
|
431
441
|
i2 as isValidDate,
|
|
432
442
|
r as rhfPeriodStyles,
|
|
433
443
|
t as toggleButtonStyles,
|
|
434
444
|
t2 as toggleIconButtonStyles,
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
445
|
+
u17 as useAppearanceComponentStore,
|
|
446
|
+
u4 as useAreasStore,
|
|
447
|
+
u6 as useColumnBoolean,
|
|
448
|
+
u11 as useColumnCertanity,
|
|
449
|
+
u7 as useColumnConcatenatedValue,
|
|
450
|
+
u8 as useColumnDate,
|
|
451
|
+
u13 as useColumnInteractiveCheck,
|
|
452
|
+
u9 as useColumnNestedValue,
|
|
453
|
+
u12 as useColumnPoints,
|
|
454
|
+
u10 as useColumnPrice,
|
|
455
|
+
u14 as useColumnSetCheck,
|
|
456
|
+
u23 as useComponentSize,
|
|
457
|
+
u16 as useCustomForm,
|
|
438
458
|
u as useDynamicMFParametersStore,
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
459
|
+
u18 as useFormAddEdit,
|
|
460
|
+
u21 as useFormFocus,
|
|
461
|
+
u24 as useFormReadyForUpdate,
|
|
442
462
|
u5 as useFormatPeriod,
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
463
|
+
u22 as useInterval,
|
|
464
|
+
u19 as useModal,
|
|
465
|
+
u15 as usePopupsStore,
|
|
446
466
|
u3 as useSetWindowsTitle,
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
467
|
+
u25 as useStateRef,
|
|
468
|
+
u26 as useSvgColor,
|
|
469
|
+
u20 as useTab,
|
|
450
470
|
u2 as useWindowToolsMF,
|
|
451
471
|
v2 as varBounce,
|
|
452
472
|
v3 as varContainer,
|
package/package.json
CHANGED
package/vendor.js
CHANGED
|
@@ -56,7 +56,8 @@ const STORYBOOK_ISOLATION_MODULE_ID = "users_list";
|
|
|
56
56
|
const WithContexts = (Story, storyContext) => {
|
|
57
57
|
const { globals, parameters } = storyContext;
|
|
58
58
|
const { themeMode, themeColor, deviceType } = globals ?? {};
|
|
59
|
-
const { isolationForceSkeleton, isolationComponentsDictionary, loadAreasFromNetwork, loadCookiesFromNetwork
|
|
59
|
+
const { isolationForceSkeleton, isolationComponentsDictionary, loadAreasFromNetwork, loadCookiesFromNetwork, onAreasLoad = () => {
|
|
60
|
+
} } = parameters ?? {};
|
|
60
61
|
return /* @__PURE__ */ jsx(
|
|
61
62
|
MFIsolationApp,
|
|
62
63
|
{
|
|
@@ -74,8 +75,7 @@ const WithContexts = (Story, storyContext) => {
|
|
|
74
75
|
isolationForceSkeleton ? "forceSkeleton" : CommonFlags.FLAG_DICTIONARY_LOADED
|
|
75
76
|
],
|
|
76
77
|
privileges: [],
|
|
77
|
-
onLoad:
|
|
78
|
-
},
|
|
78
|
+
onLoad: onAreasLoad,
|
|
79
79
|
componentsDictionary: isolationComponentsDictionary,
|
|
80
80
|
observedDivRef: {},
|
|
81
81
|
forcedDeviceType: deviceType === "automatic" ? void 0 : deviceType,
|