@m4l/layouts 9.3.7-B17072025-beta.1 → 9.3.7-JT17072025.beta.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.
@@ -152,7 +152,7 @@ export declare function useModuleDetailTabs<T extends Record<string, any> = Reco
152
152
  onBlurCapture?: import('react').FocusEventHandler<HTMLDivElement> | undefined;
153
153
  onChange?: import('react').FormEventHandler<HTMLDivElement> | undefined;
154
154
  onChangeCapture?: import('react').FormEventHandler<HTMLDivElement> | undefined;
155
- onBeforeInput?: import('react').InputEventHandler<HTMLDivElement> | undefined;
155
+ onBeforeInput?: import('react').FormEventHandler<HTMLDivElement> | undefined;
156
156
  onBeforeInputCapture?: import('react').FormEventHandler<HTMLDivElement> | undefined;
157
157
  onInput?: import('react').FormEventHandler<HTMLDivElement> | undefined;
158
158
  onInputCapture?: import('react').FormEventHandler<HTMLDivElement> | undefined;
@@ -54,6 +54,4 @@ export interface ConfigDynamicAccordion<T extends any = any, K extends any = any
54
54
  export interface useDynamicAccordionsProps<T extends any = any, K extends any = any> {
55
55
  configDynamicAccordions: ConfigDynamicAccordion<T, K>[] | GroupConfigDynamicAccordion<T, K>[];
56
56
  }
57
- export interface useBaseDynamicAccordionsProps<T extends any = any, K extends any = any> extends ModuleDetailTabContent {
58
- configDynamicAccordions: GroupConfigDynamicAccordion<T, K>[];
59
- }
57
+ export type useBaseDynamicAccordionsProps<T extends any = any, K extends any = any> = useDynamicAccordionsProps<T, K> & ModuleDetailTabContent;
@@ -1,6 +1,6 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { useMemo, createElement } from "react";
3
- import { ContainerFlow, Accordion, PropertyValue } from "@m4l/components";
3
+ import { ContainerFlow, Accordion, PropertyValue, Stack } from "@m4l/components";
4
4
  import { useModuleDictionary } from "@m4l/core";
5
5
  function useBaseAccordions(props) {
6
6
  const { data, endPointData, configDynamicAccordions: accordions } = props;
@@ -10,38 +10,64 @@ function useBaseAccordions(props) {
10
10
  return null;
11
11
  }
12
12
  return accordions.map((accordion, index) => {
13
+ if ("children" in accordion && accordion.children && accordion.children.length > 0) {
14
+ return /* @__PURE__ */ jsx(
15
+ ContainerFlow,
16
+ {
17
+ variant: "column-flex",
18
+ minWidth: accordion.minWidth,
19
+ gap: "compact",
20
+ children: accordion.children.map((child) => /* @__PURE__ */ jsx(
21
+ Accordion,
22
+ {
23
+ icon: child.icon,
24
+ label: getLabel(child.dictionaryId),
25
+ accordionProps: {
26
+ ...child.accordionProps
27
+ },
28
+ children: /* @__PURE__ */ jsx(ContainerFlow, { variant: "column-flex", minWidth: 150, gap: "standard", children: child.properties.map((property) => {
29
+ const value = property.getValue(data, endPointData);
30
+ return /* @__PURE__ */ createElement(
31
+ PropertyValue,
32
+ {
33
+ ...property,
34
+ key: property.dictionaryId,
35
+ property: getLabel(property.dictionaryId),
36
+ value,
37
+ isForm: property.isForm ?? true
38
+ }
39
+ );
40
+ }) })
41
+ },
42
+ child.dictionaryId
43
+ ))
44
+ },
45
+ `group-${index}`
46
+ );
47
+ }
48
+ const configAccordion = accordion;
13
49
  return /* @__PURE__ */ jsx(
14
- ContainerFlow,
50
+ Accordion,
15
51
  {
16
- variant: "column-flex",
17
- minWidth: accordion.minWidth,
18
- gap: "compact",
19
- children: accordion.children.map((child) => /* @__PURE__ */ jsx(
20
- Accordion,
21
- {
22
- icon: child.icon,
23
- label: getLabel(child.dictionaryId),
24
- accordionProps: {
25
- ...child.accordionProps
26
- },
27
- children: /* @__PURE__ */ jsx(ContainerFlow, { variant: "column-flex", minWidth: 150, gap: "standard", children: child.properties.map((property) => {
28
- const value = property.getValue(data, endPointData);
29
- return /* @__PURE__ */ createElement(
30
- PropertyValue,
31
- {
32
- ...property,
33
- key: property.dictionaryId,
34
- property: getLabel(property.dictionaryId),
35
- value,
36
- isForm: property.isForm ?? true
37
- }
38
- );
39
- }) })
40
- },
41
- child.dictionaryId
42
- ))
52
+ icon: configAccordion.icon,
53
+ label: getLabel(configAccordion.dictionaryId),
54
+ accordionProps: {
55
+ ...configAccordion.accordionProps
56
+ },
57
+ children: /* @__PURE__ */ jsx(Stack, { direction: "column", children: configAccordion.properties.map((property) => {
58
+ const value = property.getValue(data, endPointData);
59
+ return /* @__PURE__ */ createElement(
60
+ PropertyValue,
61
+ {
62
+ ...property,
63
+ key: property.dictionaryId,
64
+ property: getLabel(property.dictionaryId),
65
+ value
66
+ }
67
+ );
68
+ }) })
43
69
  },
44
- `group-${index}`
70
+ configAccordion.dictionaryId
45
71
  );
46
72
  });
47
73
  }, [accordions, data, endPointData, getLabel]);
@@ -1,18 +1,20 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { ContainerFlow } from "@m4l/components";
2
+ import { ContainerFlow, Stack } from "@m4l/components";
3
3
  import { u as useBaseAccordions } from "./useBaseAccordions.js";
4
- import { n as normalizeDynamicAccordions } from "./helpers/normalizeDynamicAccordions/normalizeDynamicAccordions.js";
5
4
  function useDynamicAccordions(props) {
6
5
  const { configDynamicAccordions } = props;
7
6
  return function General(propsGeneral) {
8
7
  const { data, endPointData } = propsGeneral;
9
- const configDynamicAccordionsNormalized = normalizeDynamicAccordions({ configDynamicAccordions });
10
8
  const accordionsComponents = useBaseAccordions({
11
9
  data,
12
10
  endPointData,
13
- configDynamicAccordions: configDynamicAccordionsNormalized
11
+ configDynamicAccordions
14
12
  });
15
- return /* @__PURE__ */ jsx(ContainerFlow, { variant: "column-flex", minWidth: 370, gap: "compact", children: accordionsComponents });
13
+ const hasChildrens = configDynamicAccordions.some((accordion) => "children" in accordion && accordion.children && accordion.children.length > 0);
14
+ if (hasChildrens) {
15
+ return /* @__PURE__ */ jsx(ContainerFlow, { variant: "column-flex", minWidth: 370, gap: "compact", children: accordionsComponents });
16
+ }
17
+ return /* @__PURE__ */ jsx(Stack, { direction: "column", gap: "16px", style: { height: "auto" }, children: accordionsComponents });
16
18
  };
17
19
  }
18
20
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l/layouts",
3
- "version": "9.3.7-B17072025-beta.1",
3
+ "version": "9.3.7-JT17072025.beta.1",
4
4
  "license": "UNLICENSED",
5
5
  "author": "M4L Team",
6
6
  "lint-staged": {
@@ -1,8 +0,0 @@
1
- import { GroupConfigDynamicAccordion } from '../../types';
2
- import { NormalizeDynamicAccordionsProps } from './types';
3
- /**
4
- * Garantiza la agrupación de accordiones.
5
- * @param props - Las propiedades de los accordions
6
- * @returns Las propiedades de los accordions normalizadas
7
- */
8
- export declare const normalizeDynamicAccordions: (props: NormalizeDynamicAccordionsProps) => GroupConfigDynamicAccordion<any, any>[];
@@ -1,18 +0,0 @@
1
- const normalizeDynamicAccordions = (props) => {
2
- const { configDynamicAccordions } = props;
3
- const isGroup = (item) => Array.isArray(item.children);
4
- const hasChildren = configDynamicAccordions.some(isGroup);
5
- if (hasChildren) {
6
- return configDynamicAccordions;
7
- }
8
- const configDynamicAccordionsNormalized = configDynamicAccordions.map((accordion) => {
9
- return {
10
- minWidth: void 0,
11
- children: [accordion]
12
- };
13
- });
14
- return configDynamicAccordionsNormalized;
15
- };
16
- export {
17
- normalizeDynamicAccordions as n
18
- };
@@ -1,4 +0,0 @@
1
- import { useDynamicAccordionsProps } from '../../types';
2
- export interface NormalizeDynamicAccordionsProps {
3
- configDynamicAccordions: useDynamicAccordionsProps['configDynamicAccordions'];
4
- }