@m4l/components 9.2.39-beta-1 → 9.2.41
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/Chip/Chip.js +3 -0
- package/components/Chip/types.d.ts +4 -0
- package/components/DataGrid/dictionary.js +1 -2
- package/components/DataGrid/formatters/ColumnBooleanFormatter/useColumnBoolean.js +3 -6
- package/components/DataGrid/formatters/ColumnChipStatusFormatter/ColumnChipStatusFormatter.js +2 -2
- package/components/DataGrid/formatters/ColumnChipStatusFormatter/useColumnChipStatusFormatter.js +3 -3
- package/components/DataGrid/formatters/ColumnNestedValueFormatter/formatter.js +1 -2
- package/components/DataGrid/formatters/ColumnNestedValueFormatter/useColumnNestedValue.d.ts +1 -1
- package/components/DataGrid/formatters/ColumnNestedValueFormatter/useColumnNestedValue.js +1 -2
- package/components/DataGrid/formatters/ColumnPriceFormatter/useColumnPrice.js +8 -6
- package/components/DataGrid/formatters/ColumnSetCheckFormatter/useColumnSetCheck.js +1 -3
- package/components/DynamicFilter/helpers/frontEndHelpers.js +2 -2
- package/components/DynamicFilter/index.d.ts +2 -3
- package/components/DynamicFilter/subcomponents/PopoverFilter/usePopoverFilter.d.ts +3 -3
- package/components/DynamicFilter/types.d.ts +9 -9
- package/components/DynamicSort/index.d.ts +1 -2
- package/components/DynamicSort/subcomponents/PopoverSort/usePopoverSort.d.ts +3 -3
- package/components/DynamicSort/types.d.ts +1 -0
- package/components/MenuActions/MenuActions.js +14 -17
- package/components/MenuActions/dictionary.js +2 -2
- package/components/Pager/subcomponents/PagerActions/PagerActions.js +0 -4
- package/components/SideBar/SideBar.js +2 -7
- package/components/SideBar/constants.js +3 -3
- package/components/SideBar/context/sideBarContext/index.js +2 -4
- package/components/SideBar/subcomponents/ContentComponent/index.js +1 -1
- package/components/SideBar/subcomponents/ContentGroups/subcomponents/ContainerMenuItemsMain/index.js +5 -3
- package/components/SideBar/subcomponents/ContentGroups/subcomponents/ContainerMenuItemsMain/styles.js +1 -1
- package/components/SideBar/types.d.ts +0 -4
- package/components/formatters/ChipStatusFormatter/ChipStatusFormatter.js +1 -1
- package/components/hook-form/RHFAutocomplete/types.d.ts +1 -1
- package/components/hook-form/RHFAutocompleteAsync/RHFAutocompleteAsync.js +0 -2
- package/components/hook-form/RHFAutocompleteAsync/types.d.ts +0 -1
- package/components/mui_extended/IconButton/types.d.ts +4 -1
- package/components/mui_extended/TabContent/TabContent.d.ts +1 -1
- package/components/mui_extended/TabContent/TabContent.js +5 -5
- package/components/mui_extended/TabContent/TabContent.styles.d.ts +2 -0
- package/components/mui_extended/TabContent/TabContent.styles.js +32 -0
- package/components/mui_extended/TabContent/constants.d.ts +1 -0
- package/components/mui_extended/TabContent/constants.js +4 -0
- package/components/mui_extended/TabContent/index.d.ts +0 -1
- package/components/mui_extended/TabContent/slots/TabContentEnum.d.ts +3 -0
- package/components/mui_extended/TabContent/slots/TabContentEnum.js +7 -0
- package/components/mui_extended/TabContent/slots/TabContentSlots.d.ts +3 -0
- package/components/mui_extended/TabContent/slots/TabContentSlots.js +11 -0
- package/components/mui_extended/TabContent/types.d.ts +6 -2
- package/components/mui_extended/Tabs/Tabs.styles.js +5 -2
- package/index.js +73 -77
- package/package.json +1 -1
- package/storybook/components/extended/mui/TabContent/TabContent.stories.d.ts +17 -0
- package/components/DynamicFilter/helpers/getRawFiltersForNetwork.d.ts +0 -14
- package/components/DynamicFilter/helpers/getRawFiltersForNetwork.js +0 -19
- package/components/DynamicSort/helpers/getRawSortsForNetwork.d.ts +0 -12
- package/components/DynamicSort/helpers/getRawSortsForNetwork.js +0 -20
- package/components/mui_extended/TabContent/classes/constants.d.ts +0 -1
- package/components/mui_extended/TabContent/classes/constants.js +0 -4
- package/components/mui_extended/TabContent/classes/index.d.ts +0 -9
- package/components/mui_extended/TabContent/classes/index.js +0 -23
- package/components/mui_extended/TabContent/classes/types.d.ts +0 -6
- package/components/mui_extended/TabContent/styles.d.ts +0 -1
- package/components/mui_extended/TabContent/styles.js +0 -7
package/components/Chip/Chip.js
CHANGED
|
@@ -3,6 +3,7 @@ import { useModuleSkeleton, useEnvironment } from "@m4l/core";
|
|
|
3
3
|
import clsx from "clsx";
|
|
4
4
|
import { forwardRef, useMemo } from "react";
|
|
5
5
|
import { C as CHIP_CLASSES } from "./constants.js";
|
|
6
|
+
import { T as TEST_PROP_ID } from "../../test/constants_no_mock.js";
|
|
6
7
|
import { u as useComponentSize } from "../../hooks/useComponentSize/useComponentSize.js";
|
|
7
8
|
import { I as IconStyled, S as SkeletonChipStyled, C as ChipRootStyled, T as TextChipStyled, a as IconButtonStyled } from "./slots/ChipSlots.js";
|
|
8
9
|
const Chip = forwardRef((props, ref) => {
|
|
@@ -20,6 +21,7 @@ const Chip = forwardRef((props, ref) => {
|
|
|
20
21
|
onDeleted,
|
|
21
22
|
iconButtonProps,
|
|
22
23
|
className,
|
|
24
|
+
dataTestId,
|
|
23
25
|
...others
|
|
24
26
|
} = props;
|
|
25
27
|
const { currentSize } = useComponentSize(size);
|
|
@@ -77,6 +79,7 @@ const Chip = forwardRef((props, ref) => {
|
|
|
77
79
|
ownerState: { ...ownerState },
|
|
78
80
|
className: clsx(className, CHIP_CLASSES.root),
|
|
79
81
|
ref,
|
|
82
|
+
...process.env.NODE_ENV !== "production" ? { [TEST_PROP_ID]: dataTestId } : {},
|
|
80
83
|
...onClick ? { tabIndex: 0 } : {},
|
|
81
84
|
...others,
|
|
82
85
|
children: [
|
|
@@ -69,6 +69,10 @@ export interface ChipProps {
|
|
|
69
69
|
* If the `Chip` is focusable.
|
|
70
70
|
*/
|
|
71
71
|
focusable?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Test id for the `Chip`.
|
|
74
|
+
*/
|
|
75
|
+
dataTestId?: string;
|
|
72
76
|
}
|
|
73
77
|
/**
|
|
74
78
|
* Owner state of the `Chip` used to define internal style and behavior properties.
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { g as getMenuActionsComponentsDictionary } from "../MenuActions/dictionary.js";
|
|
2
1
|
import { g as getModalDictionary } from "../ModalDialog/dictionary.js";
|
|
3
2
|
import { g as getPagerComponentsDictionary } from "../Pager/dicctionary.js";
|
|
4
3
|
function getDataGridComponentsDictionary() {
|
|
5
|
-
return ["data_grid"].concat(getPagerComponentsDictionary()).concat(
|
|
4
|
+
return ["data_grid"].concat(getPagerComponentsDictionary()).concat(getModalDictionary());
|
|
6
5
|
}
|
|
7
6
|
const dictionary = {
|
|
8
7
|
LABEL_ACTIONS: "actions",
|
|
@@ -3,11 +3,9 @@ import { C as ColumnBooleanFormatter } from "./formatter.js";
|
|
|
3
3
|
import { useModuleDictionary, getPropertyByString } from "@m4l/core";
|
|
4
4
|
import { useState, useRef, useEffect, useMemo } from "react";
|
|
5
5
|
import { deepEqual } from "fast-equals";
|
|
6
|
-
import { g as getColumnKey } from "../../helpers/getColumnKey.js";
|
|
7
6
|
const getCustomBooleanFilter = (props, getLabel) => {
|
|
8
7
|
return (row, value) => {
|
|
9
|
-
const
|
|
10
|
-
const valueMaybeString = getPropertyByString(row, keyWiouthRow);
|
|
8
|
+
const valueMaybeString = getPropertyByString(row, props.fieldValue);
|
|
11
9
|
let fixedValue;
|
|
12
10
|
if (typeof valueMaybeString === "boolean") {
|
|
13
11
|
fixedValue = valueMaybeString;
|
|
@@ -23,9 +21,8 @@ const getCustomBooleanFilter = (props, getLabel) => {
|
|
|
23
21
|
};
|
|
24
22
|
const getCustomBooleanSort = (props, getLabel) => {
|
|
25
23
|
return (a, b) => {
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
const valueMaybeStringB = getPropertyByString(b, keyWiouthRow);
|
|
24
|
+
const valueMaybeStringA = getPropertyByString(a, props.fieldValue);
|
|
25
|
+
const valueMaybeStringB = getPropertyByString(b, props.fieldValue);
|
|
29
26
|
let fixedValueA;
|
|
30
27
|
let fixedValueB;
|
|
31
28
|
if (typeof valueMaybeStringA === "boolean") {
|
package/components/DataGrid/formatters/ColumnChipStatusFormatter/ColumnChipStatusFormatter.js
CHANGED
|
@@ -4,8 +4,8 @@ import { C as ChipStatusFormatter } from "../../../formatters/ChipStatusFormatte
|
|
|
4
4
|
const ColumnChipStatusFormatter = (props) => {
|
|
5
5
|
const { uriStatus, uriLabel, component, statusesColors, fallbackColor, opacity } = props;
|
|
6
6
|
return (obProps) => {
|
|
7
|
-
const label = typeof uriLabel === "string" ? getPropertyByString(obProps, uriStatus.toString()
|
|
8
|
-
const status = getPropertyByString(obProps, uriStatus.toString()
|
|
7
|
+
const label = typeof uriLabel === "string" ? getPropertyByString(obProps, uriStatus.toString()) : uriLabel(obProps, uriStatus);
|
|
8
|
+
const status = getPropertyByString(obProps, uriStatus.toString());
|
|
9
9
|
return /* @__PURE__ */ jsx(
|
|
10
10
|
ChipStatusFormatter,
|
|
11
11
|
{
|
package/components/DataGrid/formatters/ColumnChipStatusFormatter/useColumnChipStatusFormatter.js
CHANGED
|
@@ -6,14 +6,14 @@ import { useState, useRef, useEffect, useMemo } from "react";
|
|
|
6
6
|
const getCustomChipStatusFilter = (props) => {
|
|
7
7
|
const { uriLabel } = props;
|
|
8
8
|
return (row, value) => {
|
|
9
|
-
const valueMaybeString = typeof uriLabel === "string" ? getPropertyByString(row, getColumnKey(uriLabel)
|
|
9
|
+
const valueMaybeString = typeof uriLabel === "string" ? getPropertyByString(row, getColumnKey(uriLabel)) : uriLabel(row, props.uriStatus);
|
|
10
10
|
return valueMaybeString.includes(value.toString());
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
13
|
const getCustomChipStatusSort = (props) => {
|
|
14
14
|
return (a, b) => {
|
|
15
|
-
const valueA = typeof props.uriLabel === "string" ? getPropertyByString(a, getColumnKey(props.uriLabel)
|
|
16
|
-
const valueB = typeof props.uriLabel === "string" ? getPropertyByString(b, getColumnKey(props.uriLabel)
|
|
15
|
+
const valueA = typeof props.uriLabel === "string" ? getPropertyByString(a, getColumnKey(props.uriLabel)) : props.uriLabel(a, props.uriStatus);
|
|
16
|
+
const valueB = typeof props.uriLabel === "string" ? getPropertyByString(b, getColumnKey(props.uriLabel)) : props.uriLabel(b, props.uriStatus);
|
|
17
17
|
return valueA > valueB ? 1 : valueA < valueB ? -1 : 0;
|
|
18
18
|
};
|
|
19
19
|
};
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { getPropertyByString } from "@m4l/core";
|
|
3
3
|
import React from "react";
|
|
4
|
-
import { g as getNullGuard } from "../../../../utils/getNullGuard.js";
|
|
5
4
|
function ColumnNestedValueFormatter(props) {
|
|
6
5
|
const { fieldValue, Component = React.Fragment } = props;
|
|
7
6
|
return (obProps) => {
|
|
8
|
-
const property =
|
|
7
|
+
const property = getPropertyByString(obProps, fieldValue);
|
|
9
8
|
const value = typeof property === "object" ? JSON.stringify(property) : property;
|
|
10
9
|
return /* @__PURE__ */ jsx(Component, { children: value });
|
|
11
10
|
};
|
|
@@ -5,6 +5,6 @@ import { ColumnNestedValueFormatterProps } from './types';
|
|
|
5
5
|
*/
|
|
6
6
|
export declare const useColumnNestedValue: <TRow>(props: ColumnNestedValueFormatterProps) => {
|
|
7
7
|
formatter: (obProps: any) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
customFilter: (row: TRow, value: string) =>
|
|
8
|
+
customFilter: (row: TRow, value: string) => boolean;
|
|
9
9
|
customSort: (a: TRow, b: TRow) => 0 | 1 | -1;
|
|
10
10
|
};
|
|
@@ -3,11 +3,10 @@ import { useState, useRef, useEffect, useMemo } from "react";
|
|
|
3
3
|
import { deepEqual } from "fast-equals";
|
|
4
4
|
import { g as getColumnKey } from "../../helpers/getColumnKey.js";
|
|
5
5
|
import { C as ColumnNestedValueFormatter } from "./formatter.js";
|
|
6
|
-
import { g as getNullGuard } from "../../../../utils/getNullGuard.js";
|
|
7
6
|
const getCustomNestedValueFilter = (props) => {
|
|
8
7
|
return (row, value) => {
|
|
9
8
|
const keyWiouthRow = getColumnKey(props.fieldValue);
|
|
10
|
-
const property =
|
|
9
|
+
const property = getPropertyByString(row, keyWiouthRow) ?? "";
|
|
11
10
|
if (typeof property === "object") {
|
|
12
11
|
return Object.values(property).includes(value);
|
|
13
12
|
}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { useState, useRef, useEffect, useMemo } from "react";
|
|
1
|
+
import { useState, useRef, useEffect, useMemo, useCallback } from "react";
|
|
2
2
|
import { useFormatter } from "@m4l/graphics";
|
|
3
3
|
import { getPropertyByString } from "@m4l/core";
|
|
4
4
|
import { deepEqual } from "fast-equals";
|
|
5
5
|
import { g as getFormatPrice } from "../../../formatters/PriceFormatter/PriceFormatter.js";
|
|
6
6
|
import { g as getColumnKey } from "../../helpers/getColumnKey.js";
|
|
7
7
|
import { C as ColumnPriceFormatter } from "./formatter.js";
|
|
8
|
-
const
|
|
8
|
+
const useCustomPriceFilter = (props) => {
|
|
9
9
|
const { currencyFormatter } = useFormatter();
|
|
10
|
-
|
|
10
|
+
const customFilter = useCallback((row, value) => {
|
|
11
11
|
const fieldValue = getColumnKey(props.fieldValue);
|
|
12
12
|
return getFormatPrice(row, fieldValue, currencyFormatter.code, currencyFormatter.decimalDigits).includes(value);
|
|
13
|
-
};
|
|
13
|
+
}, [props.fieldValue, currencyFormatter]);
|
|
14
|
+
return customFilter;
|
|
14
15
|
};
|
|
15
16
|
const getCustomPriceSort = (props) => {
|
|
16
17
|
return (a, b) => {
|
|
@@ -41,6 +42,7 @@ const getCustomPriceSort = (props) => {
|
|
|
41
42
|
const useColumnPrice = (props) => {
|
|
42
43
|
const [stateProps, setStateProps] = useState(props);
|
|
43
44
|
const refProps = useRef({ ...props });
|
|
45
|
+
const customFilter = useCustomPriceFilter(stateProps);
|
|
44
46
|
useEffect(() => {
|
|
45
47
|
if (!deepEqual(refProps.current, props)) {
|
|
46
48
|
refProps.current = props;
|
|
@@ -49,9 +51,9 @@ const useColumnPrice = (props) => {
|
|
|
49
51
|
}, [props]);
|
|
50
52
|
return useMemo(() => ({
|
|
51
53
|
formatter: ColumnPriceFormatter(stateProps),
|
|
52
|
-
customFilter
|
|
54
|
+
customFilter,
|
|
53
55
|
customSort: getCustomPriceSort(stateProps)
|
|
54
|
-
}), [stateProps]);
|
|
56
|
+
}), [stateProps, customFilter]);
|
|
55
57
|
};
|
|
56
58
|
export {
|
|
57
59
|
useColumnPrice as u
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { useState, useRef, useEffect, useMemo } from "react";
|
|
2
2
|
import { getPropertyByString } from "@m4l/core";
|
|
3
3
|
import { deepEqual } from "fast-equals";
|
|
4
|
-
import { g as getColumnKey } from "../../helpers/getColumnKey.js";
|
|
5
4
|
import { C as ColumnSetCheckFormatter } from "./formatter.js";
|
|
6
5
|
const getCustomFilter = (props) => {
|
|
7
6
|
return (row, value) => {
|
|
8
|
-
const
|
|
9
|
-
const valueCheck = getPropertyByString(row, keyWiouthRow);
|
|
7
|
+
const valueCheck = getPropertyByString(row, props.field);
|
|
10
8
|
return valueCheck === value;
|
|
11
9
|
};
|
|
12
10
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { getDynamicFilterComponentsDictionary } from './dictionary';
|
|
2
2
|
export * from './DynamicFilter';
|
|
3
|
-
export type {
|
|
4
|
-
export {
|
|
5
|
-
export { getRawFiltersForNetwork } from './helpers/getRawFiltersForNetwork';
|
|
3
|
+
export type { FilterField, FilterFieldApplied as FilterFieldApply, InitialFilterApplied, RawFilterFieldApply, } from './types';
|
|
4
|
+
export { getFilterGroupFieldsByName, getIsIfInDynamicFilter } from './helpers/frontEndHelpers';
|
|
@@ -17,11 +17,11 @@ declare function usePopoverFilter(): {
|
|
|
17
17
|
filterFormValue: FormFilterValue;
|
|
18
18
|
formFilter: FormFilterFieldApplied;
|
|
19
19
|
popupValidationSchema: import('yup').ArraySchema<import('yup').BaseSchema<unknown, import('yup/lib/object').AnyObject, unknown> | import('yup/lib/Lazy').default<import('yup').BaseSchema<unknown, import('yup/lib/object').AnyObject, unknown>, import('yup/lib/object').AnyObject>, import('yup/lib/types').AnyObject, unknown[] | undefined, unknown[] | undefined> | import('yup').BaseSchema<any, import('yup/lib/object').AnyObject, any> | import('yup').ObjectSchema<{
|
|
20
|
-
[x: string]: import('yup').ObjectSchema
|
|
20
|
+
[x: string]: import('yup').ObjectSchema</*elided*/ any, import('yup/lib/object').AnyObject, import('yup/lib/object').TypeOfShape</*elided*/ any>, import('yup/lib/object').AssertsShape</*elided*/ any>> | import('yup').BaseSchema<any, import('yup/lib/object').AnyObject, any> | import('yup').ArraySchema<import('yup').BaseSchema<unknown, import('yup/lib/object').AnyObject, unknown> | import('yup/lib/Lazy').default<import('yup').BaseSchema<unknown, import('yup/lib/object').AnyObject, unknown>, import('yup/lib/object').AnyObject>, import('yup/lib/types').AnyObject, unknown[] | undefined, unknown[] | undefined> | import('yup/lib/Lazy').default<import('yup').ObjectSchema</*elided*/ any, import('yup/lib/object').AnyObject, import('yup/lib/object').TypeOfShape</*elided*/ any>, import('yup/lib/object').AssertsShape</*elided*/ any>>, any>;
|
|
21
21
|
}, import('yup/lib/object').AnyObject, import('yup/lib/object').TypeOfShape<{
|
|
22
|
-
[x: string]: import('yup').ObjectSchema
|
|
22
|
+
[x: string]: import('yup').ObjectSchema</*elided*/ any, import('yup/lib/object').AnyObject, import('yup/lib/object').TypeOfShape</*elided*/ any>, import('yup/lib/object').AssertsShape</*elided*/ any>> | import('yup').BaseSchema<any, import('yup/lib/object').AnyObject, any> | import('yup').ArraySchema<import('yup').BaseSchema<unknown, import('yup/lib/object').AnyObject, unknown> | import('yup/lib/Lazy').default<import('yup').BaseSchema<unknown, import('yup/lib/object').AnyObject, unknown>, import('yup/lib/object').AnyObject>, import('yup/lib/types').AnyObject, unknown[] | undefined, unknown[] | undefined> | import('yup/lib/Lazy').default<import('yup').ObjectSchema</*elided*/ any, import('yup/lib/object').AnyObject, import('yup/lib/object').TypeOfShape</*elided*/ any>, import('yup/lib/object').AssertsShape</*elided*/ any>>, any>;
|
|
23
23
|
}>, import('yup/lib/object').AssertsShape<{
|
|
24
|
-
[x: string]: import('yup').ObjectSchema
|
|
24
|
+
[x: string]: import('yup').ObjectSchema</*elided*/ any, import('yup/lib/object').AnyObject, import('yup/lib/object').TypeOfShape</*elided*/ any>, import('yup/lib/object').AssertsShape</*elided*/ any>> | import('yup').BaseSchema<any, import('yup/lib/object').AnyObject, any> | import('yup').ArraySchema<import('yup').BaseSchema<unknown, import('yup/lib/object').AnyObject, unknown> | import('yup/lib/Lazy').default<import('yup').BaseSchema<unknown, import('yup/lib/object').AnyObject, unknown>, import('yup/lib/object').AnyObject>, import('yup/lib/types').AnyObject, unknown[] | undefined, unknown[] | undefined> | import('yup/lib/Lazy').default<import('yup').ObjectSchema</*elided*/ any, import('yup/lib/object').AnyObject, import('yup/lib/object').TypeOfShape</*elided*/ any>, import('yup/lib/object').AssertsShape</*elided*/ any>>, any>;
|
|
25
25
|
}>> | undefined;
|
|
26
26
|
statusLoad: "initial" | "reload_values_provider" | "ready";
|
|
27
27
|
};
|
|
@@ -25,13 +25,13 @@ export type OperandsSelectAsyncArrayValues = Array<FormOperandSelectAsync>;
|
|
|
25
25
|
export type OperandsSelectArrayValues = Array<FormOperandSelect>;
|
|
26
26
|
export type FieldTypeOperator<T extends FieldType> = T extends 'boolean' ? BooleanOperator : T extends 'datetime' ? DateTimeOperator : T extends 'number' ? NumberOperator : T extends 'select' ? SelectOperator : T extends 'string' ? StringOperator : T;
|
|
27
27
|
export type FieldTypeOperand<T extends FieldType> = T extends 'boolean' ? boolean : T extends 'datetime' ? Date : T extends 'number' ? number : T extends 'string' ? string : T extends 'select' ? OperandsSelectArrayValues : T extends 'selectAsync' ? OperandsSelectAsyncArrayValues : FieldType;
|
|
28
|
-
type SelectAsyncOptions
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
getOptionId: (option:
|
|
28
|
+
type SelectAsyncOptions = Pick<RHFAutocompleteAsyncBaseProps<{
|
|
29
|
+
[key: string]: any;
|
|
30
|
+
}>, 'type' | 'endPoint' | 'getOptionLabel' | 'isOptionEqualToValue' | 'multiple' | 'autoComplete' | 'autoCapitalize' | 'parms' | 'timeout'> & {
|
|
31
|
+
getOptionId: (option: Record<string, any>) => string | number;
|
|
32
32
|
};
|
|
33
33
|
type SelectOptions = Omit<RHFSelectProps<any, true>, 'name'>;
|
|
34
|
-
export interface FieldBase<T extends FieldType = FieldType
|
|
34
|
+
export interface FieldBase<T extends FieldType = FieldType> {
|
|
35
35
|
name: string;
|
|
36
36
|
type: T;
|
|
37
37
|
multiple?: boolean;
|
|
@@ -42,10 +42,10 @@ export interface FieldBase<T extends FieldType = FieldType, TOption = any> {
|
|
|
42
42
|
defaultOperand2?: Maybe<FieldTypeOperand<T>>;
|
|
43
43
|
defaultOperandsArray?: Maybe<FieldTypeOperand<T>>;
|
|
44
44
|
selectOptions?: SelectOptions;
|
|
45
|
-
selectAsyncOptions?: SelectAsyncOptions
|
|
45
|
+
selectAsyncOptions?: SelectAsyncOptions;
|
|
46
46
|
}
|
|
47
|
-
export interface FieldWithSelectAsync<T extends 'selectAsync'
|
|
48
|
-
selectAsyncOptions: SelectAsyncOptions
|
|
47
|
+
export interface FieldWithSelectAsync<T extends 'selectAsync'> extends FieldBase<T> {
|
|
48
|
+
selectAsyncOptions: SelectAsyncOptions;
|
|
49
49
|
}
|
|
50
50
|
export interface FieldWithSelect<T extends 'select'> extends FieldBase<T> {
|
|
51
51
|
selectOptions: SelectOptions;
|
|
@@ -58,7 +58,7 @@ export interface Label<T extends FieldType = FieldType> extends FieldBase<T> {
|
|
|
58
58
|
label: string;
|
|
59
59
|
dictionaryId?: undefined;
|
|
60
60
|
}
|
|
61
|
-
export type FilterField<T extends FieldType = FieldType
|
|
61
|
+
export type FilterField<T extends FieldType = FieldType> = T extends 'selectAsync' ? FieldWithSelectAsync<T> & (FieldDictionaryId<T> | Label<T>) : T extends 'select' ? FieldWithSelect<T> & (FieldDictionaryId<T> | Label<T>) : FieldDictionaryId<T> | Label<T>;
|
|
62
62
|
export interface BaseApplyFilter<T extends FieldType = FieldType> {
|
|
63
63
|
id: number;
|
|
64
64
|
field: FilterField<T>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { getDynamicSortComponentsDictionary } from './dictionary';
|
|
2
2
|
export * from './DynamicSort';
|
|
3
|
-
export type { InitialSortApplied, RawSortFieldApply, SortField, SortFieldApplied, SortFieldType, SortOperator, } from './types';
|
|
4
3
|
export { SortCompareValues } from './helpers/frontEndHelpers';
|
|
5
|
-
export {
|
|
4
|
+
export type { InitialSortApplied, RawSortFieldApply, SortField, SortFieldApplied, SortFieldType, SortOperator, } from './types';
|
|
@@ -17,11 +17,11 @@ declare function usePopoverSort(): {
|
|
|
17
17
|
sortFormValue: import('../../types').FormSortValueBase;
|
|
18
18
|
formSort: FormSortFieldApplied;
|
|
19
19
|
popupValidationSchema: import('yup').ArraySchema<import('yup').BaseSchema<unknown, import('yup/lib/object').AnyObject, unknown> | import('yup/lib/Lazy').default<import('yup').BaseSchema<unknown, import('yup/lib/object').AnyObject, unknown>, import('yup/lib/object').AnyObject>, import('yup/lib/types').AnyObject, unknown[] | undefined, unknown[] | undefined> | import('yup').BaseSchema<any, import('yup/lib/object').AnyObject, any> | import('yup').ObjectSchema<{
|
|
20
|
-
[x: string]: import('yup').ObjectSchema
|
|
20
|
+
[x: string]: import('yup').ObjectSchema</*elided*/ any, import('yup/lib/object').AnyObject, import('yup/lib/object').TypeOfShape</*elided*/ any>, import('yup/lib/object').AssertsShape</*elided*/ any>> | import('yup').BaseSchema<any, import('yup/lib/object').AnyObject, any> | import('yup').ArraySchema<import('yup').BaseSchema<unknown, import('yup/lib/object').AnyObject, unknown> | import('yup/lib/Lazy').default<import('yup').BaseSchema<unknown, import('yup/lib/object').AnyObject, unknown>, import('yup/lib/object').AnyObject>, import('yup/lib/types').AnyObject, unknown[] | undefined, unknown[] | undefined> | import('yup/lib/Lazy').default<import('yup').ObjectSchema</*elided*/ any, import('yup/lib/object').AnyObject, import('yup/lib/object').TypeOfShape</*elided*/ any>, import('yup/lib/object').AssertsShape</*elided*/ any>>, any>;
|
|
21
21
|
}, import('yup/lib/object').AnyObject, import('yup/lib/object').TypeOfShape<{
|
|
22
|
-
[x: string]: import('yup').ObjectSchema
|
|
22
|
+
[x: string]: import('yup').ObjectSchema</*elided*/ any, import('yup/lib/object').AnyObject, import('yup/lib/object').TypeOfShape</*elided*/ any>, import('yup/lib/object').AssertsShape</*elided*/ any>> | import('yup').BaseSchema<any, import('yup/lib/object').AnyObject, any> | import('yup').ArraySchema<import('yup').BaseSchema<unknown, import('yup/lib/object').AnyObject, unknown> | import('yup/lib/Lazy').default<import('yup').BaseSchema<unknown, import('yup/lib/object').AnyObject, unknown>, import('yup/lib/object').AnyObject>, import('yup/lib/types').AnyObject, unknown[] | undefined, unknown[] | undefined> | import('yup/lib/Lazy').default<import('yup').ObjectSchema</*elided*/ any, import('yup/lib/object').AnyObject, import('yup/lib/object').TypeOfShape</*elided*/ any>, import('yup/lib/object').AssertsShape</*elided*/ any>>, any>;
|
|
23
23
|
}>, import('yup/lib/object').AssertsShape<{
|
|
24
|
-
[x: string]: import('yup').ObjectSchema
|
|
24
|
+
[x: string]: import('yup').ObjectSchema</*elided*/ any, import('yup/lib/object').AnyObject, import('yup/lib/object').TypeOfShape</*elided*/ any>, import('yup/lib/object').AssertsShape</*elided*/ any>> | import('yup').BaseSchema<any, import('yup/lib/object').AnyObject, any> | import('yup').ArraySchema<import('yup').BaseSchema<unknown, import('yup/lib/object').AnyObject, unknown> | import('yup/lib/Lazy').default<import('yup').BaseSchema<unknown, import('yup/lib/object').AnyObject, unknown>, import('yup/lib/object').AnyObject>, import('yup/lib/types').AnyObject, unknown[] | undefined, unknown[] | undefined> | import('yup/lib/Lazy').default<import('yup').ObjectSchema</*elided*/ any, import('yup/lib/object').AnyObject, import('yup/lib/object').TypeOfShape</*elided*/ any>, import('yup/lib/object').AssertsShape</*elided*/ any>>, any>;
|
|
25
25
|
}>> | undefined;
|
|
26
26
|
statusLoad: "initial" | "reload_values_provider" | "ready";
|
|
27
27
|
};
|
|
@@ -5,7 +5,7 @@ import { u as useComponentSize } from "../../hooks/useComponentSize/useComponent
|
|
|
5
5
|
import { P as Popover } from "../mui_extended/Popover/Popover.js";
|
|
6
6
|
import { M as MenuItem } from "../mui_extended/MenuItem/MenuItem.js";
|
|
7
7
|
import { I as ICON_PATH, a as ICONS, M as MENU_ACTIONS_ } from "./constants.js";
|
|
8
|
-
import {
|
|
8
|
+
import { g as getMenuActionsDictionary, D as DICTIONARY } from "./dictionary.js";
|
|
9
9
|
import { M as MenuDivider } from "../mui_extended/MenuDivider/MenuDivider.js";
|
|
10
10
|
import { M as MenuListStyled, a as MenuLoaderStyled, R as RootStyled, I as IconButtonStyled, H as HeaderMenuActionsStyled, F as FooterMenuActionsStyled } from "./slots/MenuActionsSlots.js";
|
|
11
11
|
import { C as CircularProgress } from "../mui_extended/CircularProgress/CircularProgress.js";
|
|
@@ -74,20 +74,18 @@ function MenuActions(props) {
|
|
|
74
74
|
onOpen(true);
|
|
75
75
|
}
|
|
76
76
|
}, [onOpen]);
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
if (menuActions) {
|
|
81
|
-
if (typeof menuActions === "function") {
|
|
82
|
-
processedActions = menuActions(objItem);
|
|
83
|
-
} else {
|
|
84
|
-
processedActions = menuActions;
|
|
85
|
-
}
|
|
77
|
+
const finalActions = useMemo(() => {
|
|
78
|
+
if (!menuActions) {
|
|
79
|
+
return [];
|
|
86
80
|
}
|
|
87
|
-
|
|
88
|
-
|
|
81
|
+
const processedActions = typeof menuActions === "function" ? menuActions(objItem) : menuActions;
|
|
82
|
+
if (!Array.isArray(processedActions)) {
|
|
83
|
+
return [];
|
|
89
84
|
}
|
|
90
|
-
|
|
85
|
+
return processedActions.filter((action) => !!action.type);
|
|
86
|
+
}, [menuActions, objItem]);
|
|
87
|
+
const renderMenuContent = useCallback(() => {
|
|
88
|
+
if (!finalActions.length) {
|
|
91
89
|
return /* @__PURE__ */ jsx(MenuItem, { disabled: true, role: "menu-no-actions", label: getLabel(getMenuActionsDictionary(DICTIONARY.no_actions_label)) });
|
|
92
90
|
}
|
|
93
91
|
const RenderHeader = () => {
|
|
@@ -107,7 +105,7 @@ function MenuActions(props) {
|
|
|
107
105
|
case "loader":
|
|
108
106
|
return /* @__PURE__ */ jsx(MenuLoaderStyled, { size, ownerState: {}, children: /* @__PURE__ */ jsx(CircularProgress, { size }) }, `loader-${key}`);
|
|
109
107
|
case "customNode":
|
|
110
|
-
return menuAction.customNode;
|
|
108
|
+
return /* @__PURE__ */ jsx(React.Fragment, { children: menuAction.customNode }, `customNode-${key}`);
|
|
111
109
|
case "menuItem":
|
|
112
110
|
return /* @__PURE__ */ jsx(
|
|
113
111
|
MenuItem,
|
|
@@ -127,7 +125,7 @@ function MenuActions(props) {
|
|
|
127
125
|
footer && /* @__PURE__ */ jsx(RenderFooter, {}),
|
|
128
126
|
endListElement && endListElement
|
|
129
127
|
] });
|
|
130
|
-
}, [
|
|
128
|
+
}, [finalActions, header, size, footer, endListElement, getLabel, actionKey, handleClick]);
|
|
131
129
|
return /* @__PURE__ */ jsxs(RootStyled, { className, ownerState: { ownerState }, children: [
|
|
132
130
|
/* @__PURE__ */ jsx(
|
|
133
131
|
IconButtonStyled,
|
|
@@ -141,7 +139,6 @@ function MenuActions(props) {
|
|
|
141
139
|
className: iconButtonClassName,
|
|
142
140
|
selected: open,
|
|
143
141
|
disabled,
|
|
144
|
-
componentPaletteColor: "default",
|
|
145
142
|
badgeContent,
|
|
146
143
|
"aria-label": "menu-actions"
|
|
147
144
|
}
|
|
@@ -157,7 +154,7 @@ function MenuActions(props) {
|
|
|
157
154
|
...other,
|
|
158
155
|
slots: { ...slots },
|
|
159
156
|
slotProps: { paper: { ...paperProps } },
|
|
160
|
-
children: renderMenuContent()
|
|
157
|
+
children: open && renderMenuContent()
|
|
161
158
|
}
|
|
162
159
|
)
|
|
163
160
|
] });
|
|
@@ -29,7 +29,6 @@ function PagerActions(props) {
|
|
|
29
29
|
IconButton,
|
|
30
30
|
{
|
|
31
31
|
size,
|
|
32
|
-
dictionaryTooltipId: "pager.first",
|
|
33
32
|
onClick: handleFirstPageButtonClick,
|
|
34
33
|
disabled: page === 0,
|
|
35
34
|
"aria-label": "first page",
|
|
@@ -40,7 +39,6 @@ function PagerActions(props) {
|
|
|
40
39
|
IconButton,
|
|
41
40
|
{
|
|
42
41
|
size,
|
|
43
|
-
dictionaryTooltipId: "pager.previous",
|
|
44
42
|
onClick: handleBackButtonClick,
|
|
45
43
|
disabled: page === 0,
|
|
46
44
|
"aria-label": "first page",
|
|
@@ -51,7 +49,6 @@ function PagerActions(props) {
|
|
|
51
49
|
IconButton,
|
|
52
50
|
{
|
|
53
51
|
size,
|
|
54
|
-
dictionaryTooltipId: "pager.next",
|
|
55
52
|
onClick: handleNextButtonClick,
|
|
56
53
|
disabled: page >= Math.ceil(count / rowsPerPage) - 1,
|
|
57
54
|
"aria-label": "next page",
|
|
@@ -62,7 +59,6 @@ function PagerActions(props) {
|
|
|
62
59
|
IconButton,
|
|
63
60
|
{
|
|
64
61
|
size,
|
|
65
|
-
dictionaryTooltipId: "pager.last",
|
|
66
62
|
onClick: handleLastPageButtonClick,
|
|
67
63
|
disabled: page >= Math.ceil(count / rowsPerPage) - 1,
|
|
68
64
|
"aria-label": "last page",
|
|
@@ -6,10 +6,7 @@ import { memo, useMemo } from "react";
|
|
|
6
6
|
import { g as getMenuDataWithState } from "./helpers/getMenuDataWithState/index.js";
|
|
7
7
|
import { useIsMobile } from "@m4l/graphics";
|
|
8
8
|
import { g as getDataToSkeleton } from "./helpers/getDataToSkeleton/index.js";
|
|
9
|
-
import { P as PATH_ICONS } from "./constants.js";
|
|
10
|
-
import { useEnvironment } from "@m4l/core";
|
|
11
9
|
const SideBar = memo((props) => {
|
|
12
|
-
const { host_static_assets, environment_assets } = useEnvironment();
|
|
13
10
|
const {
|
|
14
11
|
anchored,
|
|
15
12
|
visible,
|
|
@@ -22,8 +19,7 @@ const SideBar = memo((props) => {
|
|
|
22
19
|
moduleSelectedId,
|
|
23
20
|
expandedWidth = "230px",
|
|
24
21
|
companyName,
|
|
25
|
-
companySlogan
|
|
26
|
-
urlIconPrefix = `${host_static_assets}/${environment_assets}${PATH_ICONS}`
|
|
22
|
+
companySlogan
|
|
27
23
|
} = props;
|
|
28
24
|
const menuDataWithState = useMemo(() => getMenuDataWithState({ menuData: menuData ?? getDataToSkeleton(), moduleSelectedId }), [menuData, moduleSelectedId]);
|
|
29
25
|
const isMobile = useIsMobile();
|
|
@@ -43,8 +39,7 @@ const SideBar = memo((props) => {
|
|
|
43
39
|
moduleSelectedId,
|
|
44
40
|
expandedWidth,
|
|
45
41
|
companyName,
|
|
46
|
-
companySlogan
|
|
47
|
-
urlIconPrefix
|
|
42
|
+
companySlogan
|
|
48
43
|
},
|
|
49
44
|
children: !isMobile ? /* @__PURE__ */ jsx(SideBarDesktop, {}) : /* @__PURE__ */ jsx(SideBarMobile, {})
|
|
50
45
|
}
|
|
@@ -10,9 +10,9 @@ export {
|
|
|
10
10
|
CONTAINER_BTN_ANCHORED as C,
|
|
11
11
|
ITEM_ACTIVE as I,
|
|
12
12
|
LIST_MENU_ITEM as L,
|
|
13
|
-
|
|
13
|
+
PATH_ARROW_RIGHT_ICON as P,
|
|
14
14
|
SIDEBAR_KEY_COMPONENT as S,
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
ITEM_IN_TREE_ACTIVE as a,
|
|
16
|
+
PATH_ICONS as b,
|
|
17
17
|
PATH_ARROW_DOWN_ICON as c
|
|
18
18
|
};
|
|
@@ -31,8 +31,7 @@ const SideBarProvider = (props) => {
|
|
|
31
31
|
expandedWidth,
|
|
32
32
|
moduleSelectedId,
|
|
33
33
|
companyName,
|
|
34
|
-
companySlogan
|
|
35
|
-
urlIconPrefix
|
|
34
|
+
companySlogan
|
|
36
35
|
} = value;
|
|
37
36
|
return (
|
|
38
37
|
// Proporcionar el contexto con las propiedades desestructuradas
|
|
@@ -51,8 +50,7 @@ const SideBarProvider = (props) => {
|
|
|
51
50
|
moduleSelectedId,
|
|
52
51
|
expandedWidth,
|
|
53
52
|
companyName,
|
|
54
|
-
companySlogan
|
|
55
|
-
urlIconPrefix
|
|
53
|
+
companySlogan
|
|
56
54
|
},
|
|
57
55
|
children
|
|
58
56
|
}
|
|
@@ -7,7 +7,7 @@ import { C as ContentGroups } from "../ContentGroups/index.js";
|
|
|
7
7
|
import { F as FooterSidebar } from "../FooterSidebar/index.js";
|
|
8
8
|
import { H as HeaderSidebar } from "../HeaderSidebar/index.js";
|
|
9
9
|
import { a as getComponentSlotRoot } from "../../../../utils/getComponentSlotRoot.js";
|
|
10
|
-
import {
|
|
10
|
+
import { P as PATH_ARROW_RIGHT_ICON, C as CONTAINER_BTN_ANCHORED } from "../../constants.js";
|
|
11
11
|
import { u as useComponentSize } from "../../../../hooks/useComponentSize/useComponentSize.js";
|
|
12
12
|
import { I as IconButton } from "../../../mui_extended/IconButton/IconButton.js";
|
|
13
13
|
const ContentComponent = () => {
|
package/components/SideBar/subcomponents/ContentGroups/subcomponents/ContainerMenuItemsMain/index.js
CHANGED
|
@@ -9,15 +9,17 @@ import { g as getNameDataTestId } from "../../../../tests/utils.js";
|
|
|
9
9
|
import { A as ArrowIcon } from "./subcomponents/ArrowIcon/index.js";
|
|
10
10
|
import { h as ContainerMenuItemsStyled } from "../../../../slots/SideBarSlots.js";
|
|
11
11
|
import { a as getComponentSlotRoot } from "../../../../../../utils/getComponentSlotRoot.js";
|
|
12
|
-
import { I as ITEM_ACTIVE,
|
|
12
|
+
import { I as ITEM_ACTIVE, a as ITEM_IN_TREE_ACTIVE, b as PATH_ICONS, L as LIST_MENU_ITEM } from "../../../../constants.js";
|
|
13
|
+
import { useEnvironment } from "@m4l/core";
|
|
13
14
|
import { u as useComponentSize } from "../../../../../../hooks/useComponentSize/useComponentSize.js";
|
|
14
15
|
import { M as MenuItem } from "../../../../../mui_extended/MenuItem/MenuItem.js";
|
|
15
16
|
function ContainerMenuItemsMain(props) {
|
|
16
17
|
const { item, size } = props;
|
|
17
|
-
const { onMenuItemClick, onToggleVisible
|
|
18
|
+
const { onMenuItemClick, onToggleVisible } = useSideBar();
|
|
18
19
|
const [openSub, setOpenSub] = useState(props.openSubItem ?? false);
|
|
19
20
|
const hasChildren = item.children && Array.isArray(item.children) && item.children.length > 0;
|
|
20
21
|
const isMobile = useIsMobile();
|
|
22
|
+
const { host_static_assets, environment_assets } = useEnvironment();
|
|
21
23
|
const { currentSize } = useComponentSize(size);
|
|
22
24
|
const adjustedSize = currentSize === "small" || currentSize === "medium" ? currentSize : "medium";
|
|
23
25
|
const ownerState = {
|
|
@@ -47,7 +49,7 @@ function ContainerMenuItemsMain(props) {
|
|
|
47
49
|
className: clsx(item.active ? ITEM_ACTIVE : ITEM_IN_TREE_ACTIVE),
|
|
48
50
|
label: item.title,
|
|
49
51
|
selected: item.active || item.itemInTreeActive,
|
|
50
|
-
startIcon: `${
|
|
52
|
+
startIcon: `${host_static_assets}/${environment_assets}${PATH_ICONS}${item.iconUrl}`,
|
|
51
53
|
endIcon: hasChildren ? /* @__PURE__ */ jsx(ArrowIcon, { openState: openSub, active: item.active }) : null,
|
|
52
54
|
onClick: () => handlerClick(),
|
|
53
55
|
size: adjustedSize
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as getHeightSizeStyles } from "../../../../../../utils/getSizeStyles/getSizeStyles.js";
|
|
2
|
-
import {
|
|
2
|
+
import { a as ITEM_IN_TREE_ACTIVE, I as ITEM_ACTIVE } from "../../../../constants.js";
|
|
3
3
|
const containerMenuItemsMainStyles = {
|
|
4
4
|
/**
|
|
5
5
|
* Style aplicado al contenedor de los items del menú
|
|
@@ -68,10 +68,6 @@ export interface SideBarProps {
|
|
|
68
68
|
* Tamaño del componente, puede ser uno de los valores definidos en 'small' , 'medium'
|
|
69
69
|
*/
|
|
70
70
|
size?: Extract<Sizes, 'small' | 'medium'>;
|
|
71
|
-
/**
|
|
72
|
-
* Prefijo de la url de los iconos
|
|
73
|
-
*/
|
|
74
|
-
urlIconPrefix?: string;
|
|
75
71
|
}
|
|
76
72
|
/**
|
|
77
73
|
* Interface que representa el estado de un elemento de menú en la barra lateral.
|
|
@@ -31,7 +31,7 @@ export interface RHFAutocompleteProps<T, Multiple extends boolean | undefined =
|
|
|
31
31
|
dataTestid?: string;
|
|
32
32
|
options: T[];
|
|
33
33
|
getOptionLabel: (option: T | AutocompleteFreeSoloValueMapping<FreeSolo>) => string;
|
|
34
|
-
isOptionEqualToValue: (
|
|
34
|
+
isOptionEqualToValue: (option: T, value: T) => boolean;
|
|
35
35
|
skeletonWidth?: string | number;
|
|
36
36
|
loading?: boolean;
|
|
37
37
|
refresh?: () => void;
|
|
@@ -7,7 +7,6 @@ function RHFAutocompleteAsync(props) {
|
|
|
7
7
|
const {
|
|
8
8
|
name,
|
|
9
9
|
endPoint,
|
|
10
|
-
responseToCamelCase,
|
|
11
10
|
label,
|
|
12
11
|
timeout = 5e3,
|
|
13
12
|
parms,
|
|
@@ -79,7 +78,6 @@ function RHFAutocompleteAsync(props) {
|
|
|
79
78
|
timeout,
|
|
80
79
|
isExternalUrl,
|
|
81
80
|
parms: { ...parms, ...filterParms },
|
|
82
|
-
responseToCamelCase,
|
|
83
81
|
isRemote
|
|
84
82
|
}).then((response) => {
|
|
85
83
|
if (cancel) {
|