@m4l/layouts 9.3.19 → 9.3.20-BE20260205-1
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/hooks/useDynamicAccordions/useBaseAccordions.js +27 -5
- package/package.json +2 -2
- package/storybook/hooks/useBaseAccordions/moks/mokData.d.ts +22 -0
- package/storybook/hooks/useBaseAccordions/subcomponents/RenderUseBaseAccordions.d.ts +13 -0
- package/storybook/hooks/useBaseAccordions/useBaseAccordions.stories.d.ts +21 -0
|
@@ -26,14 +26,36 @@ function useBaseAccordions(props) {
|
|
|
26
26
|
},
|
|
27
27
|
children: /* @__PURE__ */ jsx(ContainerFlow, { variant: "column-flex", minWidth: 150, gap: "standard", children: child.properties.map((property) => {
|
|
28
28
|
const value = property.getValue(data, endPointData);
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
{
|
|
32
|
-
...
|
|
33
|
-
|
|
29
|
+
const { startAdornment, iconVariant, iconColor, dictionaryId, getValue, privilegeToView, ...restProperty } = property;
|
|
30
|
+
if (startAdornment !== null && startAdornment !== void 0) {
|
|
31
|
+
const propertyValueProps = {
|
|
32
|
+
...restProperty,
|
|
33
|
+
startAdornment,
|
|
34
|
+
...iconVariant !== void 0 && { iconVariant },
|
|
35
|
+
...iconColor !== void 0 && { iconColor },
|
|
34
36
|
property: getLabel(property.dictionaryId),
|
|
35
37
|
value,
|
|
36
38
|
isForm: property.isForm ?? true
|
|
39
|
+
};
|
|
40
|
+
return /* @__PURE__ */ createElement(
|
|
41
|
+
PropertyValue,
|
|
42
|
+
{
|
|
43
|
+
...propertyValueProps,
|
|
44
|
+
key: property.dictionaryId
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
const propertyValuePropsWithoutAdornment = {
|
|
49
|
+
...restProperty,
|
|
50
|
+
property: getLabel(property.dictionaryId),
|
|
51
|
+
value,
|
|
52
|
+
isForm: property.isForm ?? true
|
|
53
|
+
};
|
|
54
|
+
return /* @__PURE__ */ createElement(
|
|
55
|
+
PropertyValue,
|
|
56
|
+
{
|
|
57
|
+
...propertyValuePropsWithoutAdornment,
|
|
58
|
+
key: property.dictionaryId
|
|
37
59
|
}
|
|
38
60
|
);
|
|
39
61
|
}) })
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m4l/layouts",
|
|
3
|
-
"version": "9.3.
|
|
3
|
+
"version": "9.3.20-BE20260205-1+PR665-dateRangePicker",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"author": "M4L Team",
|
|
6
6
|
"lint-staged": {
|
|
7
7
|
"*.{js,ts,tsx}": "eslint --fix --max-warnings 0"
|
|
8
8
|
},
|
|
9
9
|
"peerDependencies": {
|
|
10
|
-
"@m4l/components": "
|
|
10
|
+
"@m4l/components": "9.4.19-BE20260205-1+PR665-dateRangePicker",
|
|
11
11
|
"@m4l/core": "^2.0.0",
|
|
12
12
|
"@m4l/graphics": "^7.0.0",
|
|
13
13
|
"@m4l/styles": "^7.0.0"
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { GroupConfigDynamicAccordion } from '../../../../src/hooks/useDynamicAccordions/types';
|
|
2
|
+
export interface MockUserData {
|
|
3
|
+
id: number;
|
|
4
|
+
nombre: string;
|
|
5
|
+
apellido: string;
|
|
6
|
+
email: string;
|
|
7
|
+
telefono: string;
|
|
8
|
+
fechaNacimiento: string;
|
|
9
|
+
activo: boolean;
|
|
10
|
+
departamento: string;
|
|
11
|
+
salario: number;
|
|
12
|
+
fechaIngreso: string;
|
|
13
|
+
}
|
|
14
|
+
export interface MockEndpointData {
|
|
15
|
+
historial: string[];
|
|
16
|
+
notas: string;
|
|
17
|
+
ultimaModificacion: string;
|
|
18
|
+
}
|
|
19
|
+
export declare const MOCK_USER_DATA: MockUserData;
|
|
20
|
+
export declare const MOCK_ENDPOINT_DATA: MockEndpointData;
|
|
21
|
+
export declare const MOCK_ACCORDIONS_CONFIG: GroupConfigDynamicAccordion<MockUserData, MockEndpointData>[];
|
|
22
|
+
export declare const MOCK_ACCORDIONS_CONFIG_WITH_ADORNMENT: GroupConfigDynamicAccordion<MockUserData, MockEndpointData>[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { GroupConfigDynamicAccordion } from '../../../../src/hooks/useDynamicAccordions/types';
|
|
2
|
+
import { MockUserData, MockEndpointData } from '../moks/mokData';
|
|
3
|
+
interface RenderUseBaseAccordionsProps {
|
|
4
|
+
data: MockUserData | null;
|
|
5
|
+
endPointData?: MockEndpointData;
|
|
6
|
+
configDynamicAccordions: GroupConfigDynamicAccordion<MockUserData, MockEndpointData>[];
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Componente wrapper que utiliza el hook useBaseAccordions
|
|
10
|
+
* para renderizar los accordions dinámicos
|
|
11
|
+
*/
|
|
12
|
+
declare const RenderUseBaseAccordions: ({ data, endPointData, configDynamicAccordions, }: RenderUseBaseAccordionsProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export default RenderUseBaseAccordions;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { PaperForm } from '@m4l/components';
|
|
3
|
+
declare const meta: Meta<typeof PaperForm>;
|
|
4
|
+
type Story = StoryObj<typeof PaperForm>;
|
|
5
|
+
/**
|
|
6
|
+
* Historia por defecto que muestra el hook con datos básicos
|
|
7
|
+
*/
|
|
8
|
+
export declare const Default: Story;
|
|
9
|
+
/**
|
|
10
|
+
* Historia que muestra el hook sin datos de endpoint
|
|
11
|
+
*/
|
|
12
|
+
export declare const SinEndpointData: Story;
|
|
13
|
+
/**
|
|
14
|
+
* Historia que muestra el hook con propiedades que incluyen startAdornment
|
|
15
|
+
*/
|
|
16
|
+
export declare const ConIconos: Story;
|
|
17
|
+
/**
|
|
18
|
+
* Historia que muestra el hook con datos vacíos (debe mostrar "No hay datos disponibles")
|
|
19
|
+
*/
|
|
20
|
+
export declare const SinDatos: Story;
|
|
21
|
+
export default meta;
|