@m4l/layouts 9.1.14 → 9.1.15

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.
@@ -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;
package/hooks/index.d.ts CHANGED
@@ -2,3 +2,4 @@ export * from './useMasterDetail';
2
2
  export * from './useAuth';
3
3
  export * from './useModule';
4
4
  export * from './useDynamicAccordions';
5
+ export * from './useDynamicPaperForm';
@@ -17,14 +17,14 @@ function useBaseAccordions(props) {
17
17
  },
18
18
  children: accordion.properties.map((property) => {
19
19
  const value = property.getValue(data, endPointData);
20
- return value ? /* @__PURE__ */ jsx(
20
+ return /* @__PURE__ */ jsx(
21
21
  PropertyValue,
22
22
  {
23
23
  property: getLabel(property.dictionaryId),
24
24
  value
25
25
  },
26
26
  property.dictionaryId
27
- ) : null;
27
+ );
28
28
  })
29
29
  },
30
30
  accordion.dictionaryId
@@ -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
+ };
package/index.js CHANGED
@@ -12,7 +12,8 @@ import { u } from "./hooks/useMasterDetail/index.js";
12
12
  import { u as u2 } from "./hooks/useAuth/index.js";
13
13
  import { u as u3 } from "./hooks/useModule/index.js";
14
14
  import { u as u4 } from "./hooks/useDynamicAccordions/useDynamicAccordions.js";
15
- import { c } from "./utils/createAppMF.js";
15
+ import { c, u as u5 } from "./hooks/useDynamicPaperForm/useDynamicPaperForm.js";
16
+ import { c as c2 } from "./utils/createAppMF.js";
16
17
  export {
17
18
  A as AuthContext,
18
19
  a as AuthProvider,
@@ -22,7 +23,8 @@ export {
22
23
  M3 as ModuleDetailTabs,
23
24
  M4 as ModuleLayout,
24
25
  N as NoAuthModuleLayout,
25
- c as createAppMF,
26
+ c2 as createAppMF,
27
+ c as createComponentField,
26
28
  d as defaultModuleLayoutDictionary,
27
29
  d2 as defaultNoAuthModuleLayoutDictionary,
28
30
  g2 as getMasterDetailLayoutComponentsDictionary,
@@ -30,6 +32,7 @@ export {
30
32
  g3 as getNoAuthModuleLayoutComponentsDictionary,
31
33
  u2 as useAuth,
32
34
  u4 as useDynamicAccordions,
35
+ u5 as useDynamicPaperForm,
33
36
  u as useMasterDetail,
34
37
  u3 as useModule
35
38
  };
@@ -2,7 +2,7 @@ import { jsx } from "react/jsx-runtime";
2
2
  import { createContext, useRef } from "react";
3
3
  import { voidFunction } from "@m4l/core";
4
4
  import { c as createMasterDetailLayoutStore } from "./store.js";
5
- import { u as useStore } from "../../../../not_recognized/index.js";
5
+ import { useStore } from "zustand";
6
6
  const initialState = {
7
7
  masterSelection: void 0,
8
8
  onChangeMasterSelection: voidFunction,
@@ -1,4 +1,6 @@
1
- import { c as create, i as immer, d as devtools } from "../../../../not_recognized/index.js";
1
+ import { create } from "zustand";
2
+ import { devtools } from "zustand/middleware";
3
+ import { immer } from "zustand/middleware/immer";
2
4
  import { a as MASTER_DETAIL_LAYOUT_STORE_ID } from "../../constants.js";
3
5
  const createDevtools = (immerMiddlewere, config) => {
4
6
  const { enabled = false } = config;
@@ -1,4 +1,6 @@
1
- import { c as create, i as immer, d as devtools } from "../../../../not_recognized/index.js";
1
+ import { create } from "zustand";
2
+ import { devtools } from "zustand/middleware";
3
+ import { immer } from "zustand/middleware/immer";
2
4
  import { M as MODULE_LAYOUT_STORE_ID } from "../../constants.js";
3
5
  const createDevtools = (immerMiddlewere, config) => {
4
6
  const { enabled = false } = config;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l/layouts",
3
- "version": "9.1.14",
3
+ "version": "9.1.15",
4
4
  "license": "UNLICENSED",
5
5
  "author": "M4L Team",
6
6
  "lint-staged": {
package/commonjs/index.js DELETED
@@ -1,7 +0,0 @@
1
- import "react";
2
- function getDefaultExportFromCjs(x) {
3
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
4
- }
5
- export {
6
- getDefaultExportFromCjs as g
7
- };