@m4l/layouts 9.3.5-B08072025beta.3 → 9.3.5-B09072025beta.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.
@@ -30,7 +30,7 @@ function ModuleDetailTabs(props) {
30
30
  TabContent,
31
31
  {
32
32
  style: { display: isMatched ? "flex" : "none" },
33
- hasBackground: true,
33
+ background: !!tab.background,
34
34
  children: /* @__PURE__ */ jsx(tab.tabContent, { data: detailData, endPointData, hasPrivilegeDetail, ...tab.componentProps })
35
35
  },
36
36
  tab.value
@@ -1,2 +1,2 @@
1
1
  export * from './useDynamicAccordions';
2
- export type { useDynamicAccordionsProps, ConfigDynamicAccordion as DynamicAccordion, DynamicAccordionValue } from './types';
2
+ export type { useDynamicAccordionsProps, ConfigDynamicAccordion as DynamicAccordion, DynamicAccordionValue, GroupConfigDynamicAccordion as DynamicAccordionGroup } from './types';
@@ -1,4 +1,4 @@
1
- import { AccordionProps, PropertyValueProps } from '@m4l/components';
1
+ import { AccordionProps, ContainerFlowProps, PropertyValueProps } from '@m4l/components';
2
2
  import { ModuleDetailTabContent } from '../../components/ModuleDetailTabs';
3
3
  export type DynamicAccordionValue<T extends any = any, K extends any = any> = (data: T, endPointData?: K) => string | React.ReactNode;
4
4
  export interface DynamicAccordionProperty<T extends any = any, K extends any = any> extends Omit<PropertyValueProps, 'value' | 'property'> {
@@ -19,6 +19,16 @@ export interface DynamicAccordionProperty<T extends any = any, K extends any = a
19
19
  */
20
20
  isForm?: boolean;
21
21
  }
22
+ export interface GroupConfigDynamicAccordion<T extends any = any, K extends any = any> {
23
+ /**
24
+ * "icon": Icono de la propiedad
25
+ */
26
+ minWidth?: ContainerFlowProps['minWidth'];
27
+ /**
28
+ * "children": Propiedades que se ven en el accordion
29
+ */
30
+ children: ConfigDynamicAccordion<T, K>[];
31
+ }
22
32
  export interface ConfigDynamicAccordion<T extends any = any, K extends any = any> {
23
33
  /**
24
34
  * "icon": Icono de la propiedad
@@ -36,8 +46,12 @@ export interface ConfigDynamicAccordion<T extends any = any, K extends any = any
36
46
  * "properties": Propiedades que se ven en el accordion
37
47
  */
38
48
  properties: DynamicAccordionProperty<T, K>[];
49
+ /**
50
+ * "minWidth": Ancho mínimo del accordion
51
+ */
52
+ minWidth?: ContainerFlowProps['minWidth'];
39
53
  }
40
54
  export interface useDynamicAccordionsProps<T extends any = any, K extends any = any> {
41
- configDynamicAccordions: ConfigDynamicAccordion<T, K>[];
55
+ configDynamicAccordions: ConfigDynamicAccordion<T, K>[] | GroupConfigDynamicAccordion<T, K>[];
42
56
  }
43
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 { Accordion, Stack, 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;
@@ -9,16 +9,52 @@ function useBaseAccordions(props) {
9
9
  if (!data) {
10
10
  return null;
11
11
  }
12
- return accordions.map((accordion) => {
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
50
  Accordion,
15
51
  {
16
- icon: accordion.icon,
17
- label: getLabel(accordion.dictionaryId),
52
+ icon: configAccordion.icon,
53
+ label: getLabel(configAccordion.dictionaryId),
18
54
  accordionProps: {
19
- ...accordion.accordionProps
55
+ ...configAccordion.accordionProps
20
56
  },
21
- children: /* @__PURE__ */ jsx(Stack, { direction: "column", children: accordion.properties.map((property) => {
57
+ children: /* @__PURE__ */ jsx(Stack, { direction: "column", children: configAccordion.properties.map((property) => {
22
58
  const value = property.getValue(data, endPointData);
23
59
  return /* @__PURE__ */ createElement(
24
60
  PropertyValue,
@@ -31,7 +67,7 @@ function useBaseAccordions(props) {
31
67
  );
32
68
  }) })
33
69
  },
34
- accordion.dictionaryId
70
+ configAccordion.dictionaryId
35
71
  );
36
72
  });
37
73
  }, [accordions, data, endPointData, getLabel]);
@@ -1,5 +1,5 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { Stack } from "@m4l/components";
2
+ import { ContainerFlow, Stack } from "@m4l/components";
3
3
  import { u as useBaseAccordions } from "./useBaseAccordions.js";
4
4
  function useDynamicAccordions(props) {
5
5
  const { configDynamicAccordions } = props;
@@ -10,7 +10,11 @@ function useDynamicAccordions(props) {
10
10
  endPointData,
11
11
  configDynamicAccordions
12
12
  });
13
- return /* @__PURE__ */ jsx(Stack, { direction: "column", gap: "8px", style: { height: "auto" }, 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 });
14
18
  };
15
19
  }
16
20
  export {
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@m4l/layouts",
3
- "version": "9.3.5-B08072025beta.3",
3
+ "version": "9.3.5-B09072025beta.1",
4
4
  "license": "UNLICENSED",
5
- "author": "M4L Team",
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": "9.2.62-B08072025beta.3",
10
+ "@m4l/components": "9.2.62-B09072025beta.1",
11
11
  "@m4l/core": "^2.0.0",
12
- "@m4l/graphics": "7.1.2-B08072025beta.3",
13
- "@m4l/styles": "7.1.30-B08072025beta.3"
12
+ "@m4l/graphics": "^7.0.0",
13
+ "@m4l/styles": "^7.0.0"
14
14
  },
15
15
  "resolutions": {
16
16
  "glob": "^10.4.5",