@m4l/layouts 9.1.14 → 9.2.0-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.
Files changed (33) hide show
  1. package/components/DynamicTabs/DynamicTabs.d.ts +5 -0
  2. package/components/DynamicTabs/DynamicTabs.js +39 -0
  3. package/components/DynamicTabs/index.d.ts +2 -0
  4. package/components/DynamicTabs/index.js +1 -0
  5. package/components/DynamicTabs/types.d.ts +31 -0
  6. package/components/DynamicTabs/useDynamicTabs.d.ts +9 -0
  7. package/components/DynamicTabs/useDynamicTabs.js +23 -0
  8. package/components/ModuleDetailTabs/useModuleDatailTabs.d.ts +83 -83
  9. package/components/index.d.ts +1 -0
  10. package/constants.d.ts +4 -0
  11. package/constants.js +33 -0
  12. package/hooks/index.d.ts +2 -0
  13. package/hooks/useDynamicAccordions/types.d.ts +20 -19
  14. package/hooks/useDynamicAccordions/useBaseAccordions.d.ts +1 -1
  15. package/hooks/useDynamicAccordions/useBaseAccordions.js +12 -8
  16. package/hooks/useDynamicPaperForm/index.d.ts +2 -0
  17. package/hooks/useDynamicPaperForm/index.js +1 -0
  18. package/hooks/useDynamicPaperForm/types.d.ts +25 -0
  19. package/hooks/useDynamicPaperForm/useDynamicPaperForm.d.ts +9 -0
  20. package/hooks/useDynamicPaperForm/useDynamicPaperForm.js +55 -0
  21. package/hooks/useNetworkActionConfirm/index.d.ts +1 -0
  22. package/hooks/useNetworkActionConfirm/index.js +1 -0
  23. package/hooks/useNetworkActionConfirm/types.d.ts +19 -0
  24. package/hooks/useNetworkActionConfirm/useNetworkActionConfirm.d.ts +7 -0
  25. package/hooks/useNetworkActionConfirm/useNetworkActionConfirm.js +49 -0
  26. package/index.d.ts +1 -0
  27. package/index.js +12 -3
  28. package/layouts/MasterDetailLayout/contexts/MasterDetailContext/index.js +1 -1
  29. package/layouts/MasterDetailLayout/contexts/MasterDetailContext/store.js +3 -1
  30. package/layouts/ModuleLayout/contexts/ModuleContext/store.js +3 -1
  31. package/package.json +1 -1
  32. package/commonjs/index.js +0 -7
  33. package/not_recognized/index.js +0 -964
@@ -0,0 +1,5 @@
1
+ import { DynamicTabsProps } from './types';
2
+ /**
3
+ * Componente para mostrar un listado de tabs y contenido en un MasterDetail, basado en las props
4
+ */
5
+ export declare function DynamicTabs(props: DynamicTabsProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,39 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { Stack, Tabs, Tab, TabContent } from "@m4l/components";
3
+ import { u as useDynamicTabs } from "./useDynamicTabs.js";
4
+ function DynamicTabs(props) {
5
+ const { currentTab, finalTabs, handleChangeTab } = useDynamicTabs(props);
6
+ return (
7
+ //Bruce, que no se tenga que usar este style, como podemos lograr esto?
8
+ /* @__PURE__ */ jsxs(Stack, { direction: "column", style: { flexGrow: 1, overflow: "hidden" }, children: [
9
+ /* @__PURE__ */ jsx(
10
+ Tabs,
11
+ {
12
+ value: currentTab,
13
+ scrollButtons: "auto",
14
+ variant: "scrollable",
15
+ allowScrollButtonsMobile: true,
16
+ onChange: (_e, value) => handleChangeTab(value),
17
+ children: finalTabs.map((tab) => {
18
+ const { value, tabProps } = tab;
19
+ return /* @__PURE__ */ jsx(Tab, { value, label: tabProps?.label }, value);
20
+ })
21
+ }
22
+ ),
23
+ finalTabs.map((tab) => {
24
+ const isMatched = tab.value === currentTab;
25
+ return (isMatched || !tab.unmountable) && /* @__PURE__ */ jsx(
26
+ TabContent,
27
+ {
28
+ style: { display: isMatched ? "flex" : "none" },
29
+ children: tab.tabContent
30
+ },
31
+ tab.value
32
+ );
33
+ })
34
+ ] })
35
+ );
36
+ }
37
+ export {
38
+ DynamicTabs as D
39
+ };
@@ -0,0 +1,2 @@
1
+ export { DynamicTabs } from './DynamicTabs';
2
+ export type { DynamicTab } from './types';
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,31 @@
1
+ import { TabProps } from '@m4l/components';
2
+ import { default as React } from 'react';
3
+ export interface DynamicTab {
4
+ /**
5
+ * "unmountable" Indica si el tab se desmonta cuando el tab no está seleccionado, default: true
6
+ */
7
+ unmountable?: boolean;
8
+ /**
9
+ * "value" Valor o key del tab
10
+ */
11
+ value: string;
12
+ /**
13
+ * "tabContent" Contenido del tab, debe ser un componente que acepte como mínimo
14
+ * la prop "data" (DetailComponentProps) que será inyectada automáticamente
15
+ */
16
+ tabContent: React.ReactNode; /**Elemento no instanciado de react, solamente la funcion */
17
+ /**
18
+ * tabProps: Propiedades del componente del tab.
19
+ */
20
+ tabProps?: TabProps;
21
+ }
22
+ export interface DynamicTabsProps {
23
+ /**
24
+ * "defaultTab" Valor o key del tab por defecto, default: el primer tab
25
+ */
26
+ defaultTab: string;
27
+ /**
28
+ * "tabs" Lista de tabs con los siguientes campos:
29
+ */
30
+ tabs: DynamicTab[];
31
+ }
@@ -0,0 +1,9 @@
1
+ import { DynamicTab, DynamicTabsProps } from './types';
2
+ /**
3
+ * Componente para mostrar un listado de tabs y contenido en un MasterDetail, basado en las props
4
+ */
5
+ export declare function useDynamicTabs(props: DynamicTabsProps): {
6
+ currentTab: string;
7
+ finalTabs: DynamicTab[];
8
+ handleChangeTab: (newValue: string) => void;
9
+ };
@@ -0,0 +1,23 @@
1
+ import { useState, useMemo } from "react";
2
+ function useDynamicTabs(props) {
3
+ const { tabs, defaultTab } = props;
4
+ const [currentTab, setCurrentTab] = useState(defaultTab);
5
+ const handleChangeTab = (newValue) => {
6
+ setCurrentTab(newValue);
7
+ };
8
+ const finalTabs = useMemo(() => {
9
+ const arrTabs = [...tabs];
10
+ return arrTabs.map((tab) => ({
11
+ ...tab,
12
+ unmountable: tab.unmountable === void 0 ? true : tab.unmountable
13
+ }));
14
+ }, [tabs]);
15
+ return {
16
+ currentTab,
17
+ finalTabs,
18
+ handleChangeTab
19
+ };
20
+ }
21
+ export {
22
+ useDynamicTabs as u
23
+ };
@@ -19,118 +19,118 @@ export declare function useModuleDetailTabs<T extends Record<string, any> = Reco
19
19
  size?: Extract<import('@m4l/styles').Sizes, "small" | "medium"> | undefined;
20
20
  children?: null | undefined;
21
21
  ref?: ((instance: HTMLDivElement | null) => void | import('react').DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import('react').DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import('react').RefObject<HTMLDivElement> | null | undefined;
22
- title?: string | undefined | undefined;
22
+ title?: string | undefined;
23
23
  component?: React.ElementType | undefined;
24
- id?: string | undefined | undefined;
24
+ id?: string | undefined;
25
25
  disabled?: boolean | undefined;
26
26
  action?: React.Ref<import('@mui/material').ButtonBaseActions> | undefined;
27
- hidden?: boolean | undefined | undefined;
27
+ hidden?: boolean | undefined;
28
28
  color?: Extract<import('@m4l/styles').ComponentPalletColor, "default"> | undefined;
29
- content?: string | undefined | undefined;
29
+ content?: string | undefined;
30
30
  style?: React.CSSProperties | undefined;
31
- translate?: "yes" | "no" | undefined | undefined;
31
+ translate?: "yes" | "no" | undefined;
32
32
  urlIcon?: string | undefined;
33
- lang?: string | undefined | undefined;
34
- slot?: string | undefined | undefined;
35
- dir?: string | undefined | undefined;
33
+ lang?: string | undefined;
34
+ slot?: string | undefined;
35
+ dir?: string | undefined;
36
36
  className?: string | undefined;
37
37
  classes?: (Partial<import('@mui/material').TabClasses> & Partial<import('@mui/material').ClassNameMap<never>>) | undefined;
38
38
  sx?: import('@mui/system').SxProps<import('@mui/material').Theme> | undefined;
39
39
  key?: import('react').Key | null | undefined;
40
- defaultChecked?: boolean | undefined | undefined;
40
+ defaultChecked?: boolean | undefined;
41
41
  defaultValue?: string | number | readonly string[] | undefined;
42
- suppressContentEditableWarning?: boolean | undefined | undefined;
43
- suppressHydrationWarning?: boolean | undefined | undefined;
44
- accessKey?: string | undefined | undefined;
45
- autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {}) | undefined;
46
- autoFocus?: boolean | undefined | undefined;
47
- contentEditable?: "inherit" | (boolean | "false" | "true") | "plaintext-only" | undefined;
48
- contextMenu?: string | undefined | undefined;
42
+ suppressContentEditableWarning?: boolean | undefined;
43
+ suppressHydrationWarning?: boolean | undefined;
44
+ accessKey?: string | undefined;
45
+ autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {});
46
+ autoFocus?: boolean | undefined;
47
+ contentEditable?: (boolean | "false" | "true") | "inherit" | "plaintext-only" | undefined;
48
+ contextMenu?: string | undefined;
49
49
  draggable?: (boolean | "false" | "true") | undefined;
50
- enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined | undefined;
51
- nonce?: string | undefined | undefined;
50
+ enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined;
51
+ nonce?: string | undefined;
52
52
  spellCheck?: (boolean | "false" | "true") | undefined;
53
53
  tabIndex?: NonNullable<React.HTMLAttributes<any>["tabIndex"]> | undefined;
54
- radioGroup?: string | undefined | undefined;
54
+ radioGroup?: string | undefined;
55
55
  role?: import('react').AriaRole | undefined;
56
- about?: string | undefined | undefined;
57
- datatype?: string | undefined | undefined;
56
+ about?: string | undefined;
57
+ datatype?: string | undefined;
58
58
  inlist?: any;
59
- prefix?: string | undefined | undefined;
60
- property?: string | undefined | undefined;
61
- rel?: string | undefined | undefined;
62
- resource?: string | undefined | undefined;
63
- rev?: string | undefined | undefined;
64
- typeof?: string | undefined | undefined;
65
- vocab?: string | undefined | undefined;
66
- autoCorrect?: string | undefined | undefined;
67
- autoSave?: string | undefined | undefined;
68
- itemProp?: string | undefined | undefined;
69
- itemScope?: boolean | undefined | undefined;
70
- itemType?: string | undefined | undefined;
71
- itemID?: string | undefined | undefined;
72
- itemRef?: string | undefined | undefined;
73
- results?: number | undefined | undefined;
74
- security?: string | undefined | undefined;
75
- unselectable?: "on" | "off" | undefined | undefined;
76
- inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined | undefined;
77
- is?: string | undefined | undefined;
78
- "aria-activedescendant"?: string | undefined | undefined;
59
+ prefix?: string | undefined;
60
+ property?: string | undefined;
61
+ rel?: string | undefined;
62
+ resource?: string | undefined;
63
+ rev?: string | undefined;
64
+ typeof?: string | undefined;
65
+ vocab?: string | undefined;
66
+ autoCorrect?: string | undefined;
67
+ autoSave?: string | undefined;
68
+ itemProp?: string | undefined;
69
+ itemScope?: boolean | undefined;
70
+ itemType?: string | undefined;
71
+ itemID?: string | undefined;
72
+ itemRef?: string | undefined;
73
+ results?: number | undefined;
74
+ security?: string | undefined;
75
+ unselectable?: "on" | "off" | undefined;
76
+ inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined;
77
+ is?: string | undefined;
78
+ "aria-activedescendant"?: string | undefined;
79
79
  "aria-atomic"?: (boolean | "false" | "true") | undefined;
80
- "aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined | undefined;
81
- "aria-braillelabel"?: string | undefined | undefined;
82
- "aria-brailleroledescription"?: string | undefined | undefined;
80
+ "aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined;
81
+ "aria-braillelabel"?: string | undefined;
82
+ "aria-brailleroledescription"?: string | undefined;
83
83
  "aria-busy"?: (boolean | "false" | "true") | undefined;
84
- "aria-checked"?: boolean | "false" | "mixed" | "true" | undefined | undefined;
85
- "aria-colcount"?: number | undefined | undefined;
86
- "aria-colindex"?: number | undefined | undefined;
87
- "aria-colindextext"?: string | undefined | undefined;
88
- "aria-colspan"?: number | undefined | undefined;
89
- "aria-controls"?: string | undefined | undefined;
90
- "aria-current"?: boolean | "false" | "true" | "page" | "step" | "location" | "date" | "time" | undefined | undefined;
91
- "aria-describedby"?: string | undefined | undefined;
92
- "aria-description"?: string | undefined | undefined;
93
- "aria-details"?: string | undefined | undefined;
84
+ "aria-checked"?: boolean | "false" | "mixed" | "true" | undefined;
85
+ "aria-colcount"?: number | undefined;
86
+ "aria-colindex"?: number | undefined;
87
+ "aria-colindextext"?: string | undefined;
88
+ "aria-colspan"?: number | undefined;
89
+ "aria-controls"?: string | undefined;
90
+ "aria-current"?: boolean | "false" | "true" | "page" | "step" | "location" | "date" | "time" | undefined;
91
+ "aria-describedby"?: string | undefined;
92
+ "aria-description"?: string | undefined;
93
+ "aria-details"?: string | undefined;
94
94
  "aria-disabled"?: (boolean | "false" | "true") | undefined;
95
- "aria-dropeffect"?: "none" | "copy" | "execute" | "link" | "move" | "popup" | undefined | undefined;
96
- "aria-errormessage"?: string | undefined | undefined;
95
+ "aria-dropeffect"?: "none" | "copy" | "execute" | "link" | "move" | "popup" | undefined;
96
+ "aria-errormessage"?: string | undefined;
97
97
  "aria-expanded"?: (boolean | "false" | "true") | undefined;
98
- "aria-flowto"?: string | undefined | undefined;
98
+ "aria-flowto"?: string | undefined;
99
99
  "aria-grabbed"?: (boolean | "false" | "true") | undefined;
100
- "aria-haspopup"?: boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined | undefined;
100
+ "aria-haspopup"?: boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined;
101
101
  "aria-hidden"?: (boolean | "false" | "true") | undefined;
102
- "aria-invalid"?: boolean | "false" | "true" | "grammar" | "spelling" | undefined | undefined;
103
- "aria-keyshortcuts"?: string | undefined | undefined;
104
- "aria-label"?: string | undefined | undefined;
105
- "aria-labelledby"?: string | undefined | undefined;
106
- "aria-level"?: number | undefined | undefined;
107
- "aria-live"?: "off" | "assertive" | "polite" | undefined | undefined;
102
+ "aria-invalid"?: boolean | "false" | "true" | "grammar" | "spelling" | undefined;
103
+ "aria-keyshortcuts"?: string | undefined;
104
+ "aria-label"?: string | undefined;
105
+ "aria-labelledby"?: string | undefined;
106
+ "aria-level"?: number | undefined;
107
+ "aria-live"?: "off" | "assertive" | "polite" | undefined;
108
108
  "aria-modal"?: (boolean | "false" | "true") | undefined;
109
109
  "aria-multiline"?: (boolean | "false" | "true") | undefined;
110
110
  "aria-multiselectable"?: (boolean | "false" | "true") | undefined;
111
- "aria-orientation"?: "horizontal" | "vertical" | undefined | undefined;
112
- "aria-owns"?: string | undefined | undefined;
113
- "aria-placeholder"?: string | undefined | undefined;
114
- "aria-posinset"?: number | undefined | undefined;
115
- "aria-pressed"?: boolean | "false" | "mixed" | "true" | undefined | undefined;
111
+ "aria-orientation"?: "horizontal" | "vertical" | undefined;
112
+ "aria-owns"?: string | undefined;
113
+ "aria-placeholder"?: string | undefined;
114
+ "aria-posinset"?: number | undefined;
115
+ "aria-pressed"?: boolean | "false" | "mixed" | "true" | undefined;
116
116
  "aria-readonly"?: (boolean | "false" | "true") | undefined;
117
- "aria-relevant"?: "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text" | "text additions" | "text removals" | undefined | undefined;
117
+ "aria-relevant"?: "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text" | "text additions" | "text removals" | undefined;
118
118
  "aria-required"?: (boolean | "false" | "true") | undefined;
119
- "aria-roledescription"?: string | undefined | undefined;
120
- "aria-rowcount"?: number | undefined | undefined;
121
- "aria-rowindex"?: number | undefined | undefined;
122
- "aria-rowindextext"?: string | undefined | undefined;
123
- "aria-rowspan"?: number | undefined | undefined;
119
+ "aria-roledescription"?: string | undefined;
120
+ "aria-rowcount"?: number | undefined;
121
+ "aria-rowindex"?: number | undefined;
122
+ "aria-rowindextext"?: string | undefined;
123
+ "aria-rowspan"?: number | undefined;
124
124
  "aria-selected"?: (boolean | "false" | "true") | undefined;
125
- "aria-setsize"?: number | undefined | undefined;
126
- "aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined | undefined;
127
- "aria-valuemax"?: number | undefined | undefined;
128
- "aria-valuemin"?: number | undefined | undefined;
129
- "aria-valuenow"?: number | undefined | undefined;
130
- "aria-valuetext"?: string | undefined | undefined;
125
+ "aria-setsize"?: number | undefined;
126
+ "aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined;
127
+ "aria-valuemax"?: number | undefined;
128
+ "aria-valuemin"?: number | undefined;
129
+ "aria-valuenow"?: number | undefined;
130
+ "aria-valuetext"?: string | undefined;
131
131
  dangerouslySetInnerHTML?: {
132
132
  __html: string | TrustedHTML;
133
- } | undefined | undefined;
133
+ } | undefined;
134
134
  onCopy?: import('react').ClipboardEventHandler<HTMLDivElement> | undefined;
135
135
  onCopyCapture?: import('react').ClipboardEventHandler<HTMLDivElement> | undefined;
136
136
  onCut?: import('react').ClipboardEventHandler<HTMLDivElement> | undefined;
@@ -302,7 +302,7 @@ export declare function useModuleDetailTabs<T extends Record<string, any> = Reco
302
302
  touchRippleRef?: React.Ref<import('@mui/material/ButtonBase/TouchRipple').TouchRippleActions> | undefined;
303
303
  disableFocusRipple?: boolean | undefined;
304
304
  dataTestId?: string | undefined;
305
- iconPosition?: "top" | "bottom" | "start" | "end" | undefined;
305
+ iconPosition?: ("top" | "bottom" | "start" | "end") | undefined;
306
306
  wrapped?: boolean | undefined;
307
307
  }[];
308
308
  handleChangeTab: (newValue: string) => void;
@@ -2,3 +2,4 @@ export { MFNoAuthApp } from './MFNoAuthApp';
2
2
  export { MFHostApp } from './MFHostApp/MFHostApp';
3
3
  export * from './MFHostApp';
4
4
  export * from './ModuleDetailTabs';
5
+ export * from './DynamicTabs';
package/constants.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ export declare const LIMIT_RECORDS_500_CONFIG: {
2
+ limit: number;
3
+ label: string;
4
+ }[];
package/constants.js ADDED
@@ -0,0 +1,33 @@
1
+ const LIMIT_RECORDS_500_CONFIG = [
2
+ {
3
+ limit: 1,
4
+ label: "1"
5
+ },
6
+ {
7
+ limit: 5,
8
+ label: "5"
9
+ },
10
+ {
11
+ limit: 10,
12
+ label: "10"
13
+ },
14
+ {
15
+ limit: 20,
16
+ label: "20"
17
+ },
18
+ {
19
+ limit: 50,
20
+ label: "50"
21
+ },
22
+ {
23
+ limit: 100,
24
+ label: "100"
25
+ },
26
+ {
27
+ limit: 500,
28
+ label: "500"
29
+ }
30
+ ];
31
+ export {
32
+ LIMIT_RECORDS_500_CONFIG as L
33
+ };
package/hooks/index.d.ts CHANGED
@@ -2,3 +2,5 @@ export * from './useMasterDetail';
2
2
  export * from './useAuth';
3
3
  export * from './useModule';
4
4
  export * from './useDynamicAccordions';
5
+ export * from './useDynamicPaperForm';
6
+ export * from './useNetworkActionConfirm';
@@ -1,6 +1,24 @@
1
- import { AccordionProps } from '@m4l/components';
1
+ import { AccordionProps, 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
+ export interface DynamicAccordionProperty<T extends any = any, K extends any = any> extends Omit<PropertyValueProps, 'value' | 'property'> {
5
+ /**
6
+ * "dictionaryId": Id de la propiedad en el diccionario para mostrar en el label
7
+ */
8
+ dictionaryId: string;
9
+ /**
10
+ * "getValue": Función que se encarga de obtener el valor de la propiedad
11
+ */
12
+ getValue: DynamicAccordionValue<T, K>;
13
+ /**
14
+ * "privilegeToView": Si se requiere un privilegio para ver el valor
15
+ */
16
+ privilegeToView?: string;
17
+ /**
18
+ * isForm
19
+ */
20
+ isForm?: boolean;
21
+ }
4
22
  export interface ConfigDynamicAccordion<T extends any = any, K extends any = any> {
5
23
  /**
6
24
  * "icon": Icono de la propiedad
@@ -17,24 +35,7 @@ export interface ConfigDynamicAccordion<T extends any = any, K extends any = any
17
35
  /**
18
36
  * "properties": Propiedades que se ven en el accordion
19
37
  */
20
- properties: {
21
- /**
22
- * "icon": Icono de la propiedad
23
- */
24
- icon?: string | React.ReactNode;
25
- /**
26
- * "dictionaryId": Id de la propiedad en el diccionario para mostrar en el label
27
- */
28
- dictionaryId: string;
29
- /**
30
- * "getValue": Función que se encarga de obtener el valor de la propiedad
31
- */
32
- getValue: DynamicAccordionValue<T, K>;
33
- /**
34
- * "privilegeToView": Si se requiere un privilegio para ver el valor
35
- */
36
- privilegeToView?: string;
37
- }[];
38
+ properties: DynamicAccordionProperty<T, K>[];
38
39
  }
39
40
  export interface useDynamicAccordionsProps<T extends any = any, K extends any = any> {
40
41
  configDynamicAccordions: ConfigDynamicAccordion<T, K>[];
@@ -2,4 +2,4 @@ import { useBaseDynamicAccordionsProps } from './types';
2
2
  /**
3
3
  * Hook que se encarga de gestionar los accordions del detalle de inventario
4
4
  */
5
- export declare function useBaseAccordions(props: useBaseDynamicAccordionsProps): import("react/jsx-runtime").JSX.Element[];
5
+ export declare function useBaseAccordions(props: useBaseDynamicAccordionsProps): import("react/jsx-runtime").JSX.Element[] | null;
@@ -1,11 +1,14 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { useMemo } from "react";
3
- import { Accordion, PropertyValue } from "@m4l/components";
2
+ import { useMemo, createElement } from "react";
3
+ import { Accordion, Stack, PropertyValue } from "@m4l/components";
4
4
  import { useModuleDictionary } from "@m4l/core";
5
5
  function useBaseAccordions(props) {
6
6
  const { data, endPointData, configDynamicAccordions: accordions } = props;
7
7
  const { getLabel } = useModuleDictionary();
8
8
  const AccordionsComponents = useMemo(() => {
9
+ if (!data) {
10
+ return null;
11
+ }
9
12
  return accordions.map((accordion) => {
10
13
  return /* @__PURE__ */ jsx(
11
14
  Accordion,
@@ -15,17 +18,18 @@ function useBaseAccordions(props) {
15
18
  accordionProps: {
16
19
  ...accordion.accordionProps
17
20
  },
18
- children: accordion.properties.map((property) => {
21
+ children: /* @__PURE__ */ jsx(Stack, { direction: "column", gap: "8px", children: accordion.properties.map((property) => {
19
22
  const value = property.getValue(data, endPointData);
20
- return value ? /* @__PURE__ */ jsx(
23
+ return /* @__PURE__ */ createElement(
21
24
  PropertyValue,
22
25
  {
26
+ ...property,
27
+ key: property.dictionaryId,
23
28
  property: getLabel(property.dictionaryId),
24
29
  value
25
- },
26
- property.dictionaryId
27
- ) : null;
28
- })
30
+ }
31
+ );
32
+ }) })
29
33
  },
30
34
  accordion.dictionaryId
31
35
  );
@@ -0,0 +1,2 @@
1
+ export * from './useDynamicPaperForm';
2
+ export type { PropertyValueField } from './types';
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,25 @@
1
+ interface PropertyValueFieldBase {
2
+ name: string;
3
+ type: 'RHFTexfField' | 'component';
4
+ label: string;
5
+ mandatory?: boolean;
6
+ }
7
+ interface PropertyValueRHFTexfField extends PropertyValueFieldBase {
8
+ type: 'RHFTexfField';
9
+ readOnly?: boolean;
10
+ disabled?: boolean;
11
+ textFieldType?: React.InputHTMLAttributes<unknown>['type'];
12
+ }
13
+ export interface PropertyValueOtherComponent<T extends React.ComponentType<any>> extends PropertyValueFieldBase {
14
+ type: 'component';
15
+ component: T;
16
+ componentProps: React.ComponentProps<T>;
17
+ }
18
+ export type PropertyValueField = PropertyValueRHFTexfField | PropertyValueOtherComponent<any>;
19
+ export type UseDynamicPaperFormProps = {
20
+ fields: PropertyValueField[];
21
+ title: string;
22
+ urlIcon: string;
23
+ isForm: boolean;
24
+ };
25
+ export {};
@@ -0,0 +1,9 @@
1
+ import { PropertyValueOtherComponent, UseDynamicPaperFormProps } from './types';
2
+ /**
3
+ * Factory function to create a component field
4
+ */
5
+ export declare function createComponentField<T extends React.ComponentType<any>>(params: PropertyValueOtherComponent<T>): PropertyValueOtherComponent<T>;
6
+ /**
7
+ * Datos de ubicación
8
+ */
9
+ export declare function useDynamicPaperForm(props: UseDynamicPaperFormProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,55 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { PaperForm, RHFTextField, PropertyValue } from "@m4l/components";
3
+ import { useModuleDictionary } from "@m4l/core";
4
+ function createComponentField(params) {
5
+ return params;
6
+ }
7
+ function useDynamicPaperForm(props) {
8
+ const { getLabel } = useModuleDictionary();
9
+ const { fields, title, urlIcon, isForm } = props;
10
+ return /* @__PURE__ */ jsx(
11
+ PaperForm,
12
+ {
13
+ urlIcon,
14
+ title,
15
+ isForm,
16
+ children: fields.map((field) => {
17
+ let component;
18
+ if (field.type === "RHFTexfField") {
19
+ component = /* @__PURE__ */ jsx(
20
+ RHFTextField,
21
+ {
22
+ name: field.name,
23
+ disabled: field.disabled,
24
+ type: field.textFieldType,
25
+ InputProps: {
26
+ readOnly: field.readOnly
27
+ }
28
+ },
29
+ field.name
30
+ );
31
+ } else {
32
+ component = /* @__PURE__ */ jsx(field.component, { ...field.componentProps });
33
+ }
34
+ return /* @__PURE__ */ jsx(
35
+ PropertyValue,
36
+ {
37
+ property: getLabel(`${field.label}`),
38
+ isForm: true,
39
+ propertyWidth: 150,
40
+ mandatory: field.mandatory,
41
+ mandatoryMessage: "*",
42
+ value: component,
43
+ dataTestId: field.name,
44
+ semanticWidth: "fullWidth"
45
+ },
46
+ field.name
47
+ );
48
+ })
49
+ }
50
+ );
51
+ }
52
+ export {
53
+ createComponentField as c,
54
+ useDynamicPaperForm as u
55
+ };
@@ -0,0 +1 @@
1
+ export * from './useNetworkActionConfirm';
@@ -0,0 +1,19 @@
1
+ import { NetworkProps } from '@m4l/core';
2
+ export interface UseNetworkConfirmActionProps<T> {
3
+ /**
4
+ * Función para refrescar la lista
5
+ */
6
+ fullRefresh: (obj: T) => void;
7
+ /**
8
+ * Función para obtener el endpoint
9
+ */
10
+ getEndPoint: (obj: T) => NetworkProps;
11
+ /**
12
+ * Título del modal
13
+ */
14
+ title: string;
15
+ /**
16
+ * Mensaje del modal
17
+ */
18
+ message: string;
19
+ }
@@ -0,0 +1,7 @@
1
+ import { UseNetworkConfirmActionProps } from './types';
2
+ /**
3
+ * Obtiene las acciones de fila
4
+ */
5
+ export declare function useNetworkActionConfirm<T>(props: UseNetworkConfirmActionProps<T>): {
6
+ onAction: (obj: T) => void;
7
+ };