@m4l/layouts 9.1.13 → 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.
- package/components/ModuleDetailTabs/useModuleDatailTabs.d.ts +83 -83
- package/hooks/index.d.ts +1 -0
- package/hooks/useDynamicAccordions/useBaseAccordions.js +2 -2
- package/hooks/useDynamicPaperForm/index.d.ts +2 -0
- package/hooks/useDynamicPaperForm/index.js +1 -0
- package/hooks/useDynamicPaperForm/types.d.ts +25 -0
- package/hooks/useDynamicPaperForm/useDynamicPaperForm.d.ts +9 -0
- package/hooks/useDynamicPaperForm/useDynamicPaperForm.js +55 -0
- package/index.js +5 -2
- package/layouts/MasterDetailLayout/MasterDetailLayout.js +15 -18
- package/layouts/MasterDetailLayout/constants.d.ts +2 -0
- package/layouts/MasterDetailLayout/constants.js +6 -0
- package/layouts/MasterDetailLayout/contexts/MasterDetailContext/index.js +14 -5
- package/layouts/MasterDetailLayout/contexts/MasterDetailContext/store.d.ts +16 -0
- package/layouts/MasterDetailLayout/contexts/MasterDetailContext/store.js +50 -0
- package/layouts/MasterDetailLayout/contexts/MasterDetailContext/types.d.ts +28 -0
- package/layouts/MasterDetailLayout/dicctionary.d.ts +6 -2
- package/layouts/MasterDetailLayout/dicctionary.js +8 -3
- package/layouts/MasterDetailLayout/helpers/getTotalModuleActions.d.ts +5 -0
- package/layouts/MasterDetailLayout/helpers/getTotalModuleActions.js +8 -0
- package/layouts/MasterDetailLayout/icons.d.ts +5 -0
- package/layouts/MasterDetailLayout/icons.js +8 -0
- package/layouts/MasterDetailLayout/slots/MasterDetailLayoutEnum.d.ts +3 -0
- package/layouts/MasterDetailLayout/slots/MasterDetailLayoutEnum.js +7 -0
- package/layouts/MasterDetailLayout/slots/MasterDetailLayoutSlot.d.ts +1 -0
- package/layouts/MasterDetailLayout/slots/MasterDetailLayoutSlot.js +11 -0
- package/layouts/MasterDetailLayout/styles.d.ts +2 -1
- package/layouts/MasterDetailLayout/styles.js +37 -5
- package/layouts/MasterDetailLayout/tests/MasterDetailLayout.test.d.ts +1 -0
- package/layouts/MasterDetailLayout/types.d.ts +6 -0
- package/layouts/ModuleLayout/contexts/ModuleContext/store.js +3 -1
- package/package.json +1 -1
- package/storybook/layouts/MasterDetailLayout/MasterDetailLayout.stories.d.ts +6 -0
- package/storybook/layouts/MasterDetailLayout/moks/mokData.d.ts +7 -0
- package/storybook/layouts/MasterDetailLayout/subcomponents/RenderMasterDetailLayout.d.ts +6 -0
- package/test/constants.d.ts +0 -2
- package/test/mocks.d.ts +2 -0
- package/commonjs/index.js +0 -7
- package/layouts/MasterDetailLayout/classes/constants.d.ts +0 -1
- package/layouts/MasterDetailLayout/classes/constants.js +0 -4
- package/layouts/MasterDetailLayout/classes/index.d.ts +0 -9
- package/layouts/MasterDetailLayout/classes/index.js +0 -23
- package/layouts/MasterDetailLayout/classes/types.d.ts +0 -6
- package/not_recognized/index.js +0 -963
|
@@ -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
|
|
22
|
+
title?: string | undefined;
|
|
23
23
|
component?: React.ElementType | undefined;
|
|
24
|
-
id?: string | undefined
|
|
24
|
+
id?: string | undefined;
|
|
25
25
|
disabled?: boolean | undefined;
|
|
26
26
|
action?: React.Ref<import('@mui/material').ButtonBaseActions> | undefined;
|
|
27
|
-
hidden?: boolean | undefined
|
|
27
|
+
hidden?: boolean | undefined;
|
|
28
28
|
color?: Extract<import('@m4l/styles').ComponentPalletColor, "default"> | undefined;
|
|
29
|
-
content?: string | undefined
|
|
29
|
+
content?: string | undefined;
|
|
30
30
|
style?: React.CSSProperties | undefined;
|
|
31
|
-
translate?: "yes" | "no" | undefined
|
|
31
|
+
translate?: "yes" | "no" | undefined;
|
|
32
32
|
urlIcon?: string | undefined;
|
|
33
|
-
lang?: string | undefined
|
|
34
|
-
slot?: string | undefined
|
|
35
|
-
dir?: string | 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
|
|
40
|
+
defaultChecked?: boolean | undefined;
|
|
41
41
|
defaultValue?: string | number | readonly string[] | 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?:
|
|
48
|
-
contextMenu?: string | 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
|
|
51
|
-
nonce?: string | 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
|
|
54
|
+
radioGroup?: string | undefined;
|
|
55
55
|
role?: import('react').AriaRole | undefined;
|
|
56
|
-
about?: string | undefined
|
|
57
|
-
datatype?: string | undefined
|
|
56
|
+
about?: string | undefined;
|
|
57
|
+
datatype?: string | undefined;
|
|
58
58
|
inlist?: any;
|
|
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
|
|
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
|
|
81
|
-
"aria-braillelabel"?: string | undefined
|
|
82
|
-
"aria-brailleroledescription"?: string | 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
|
|
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
|
|
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
|
|
96
|
-
"aria-errormessage"?: string | 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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
112
|
-
"aria-owns"?: string | undefined
|
|
113
|
-
"aria-placeholder"?: string | undefined
|
|
114
|
-
"aria-posinset"?: number | undefined
|
|
115
|
-
"aria-pressed"?: boolean | "false" | "mixed" | "true" | 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
|
|
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
|
|
120
|
-
"aria-rowcount"?: number | undefined
|
|
121
|
-
"aria-rowindex"?: number | undefined
|
|
122
|
-
"aria-rowindextext"?: string | undefined
|
|
123
|
-
"aria-rowspan"?: number | 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
|
|
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
|
|
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
|
|
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
|
@@ -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
|
|
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
|
-
)
|
|
27
|
+
);
|
|
28
28
|
})
|
|
29
29
|
},
|
|
30
30
|
accordion.dictionaryId
|
|
@@ -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 "./
|
|
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
|
-
|
|
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
|
};
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useRef, useCallback, useMemo } from "react";
|
|
3
3
|
import { useEnvironment, useModuleDictionary } from "@m4l/core";
|
|
4
|
-
import { WindowBase, SplitLayout } from "@m4l/components";
|
|
4
|
+
import { WindowBase, getComponentSlotRoot, SplitLayout } from "@m4l/components";
|
|
5
5
|
import { M as ModuleLayout } from "../ModuleLayout/ModuleLayout.js";
|
|
6
6
|
import { a as MasterDetailProvider } from "./contexts/MasterDetailContext/index.js";
|
|
7
7
|
import { useIsMobile } from "@m4l/graphics";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return totalActions;
|
|
14
|
-
}
|
|
8
|
+
import { i as icons } from "./icons.js";
|
|
9
|
+
import { d as dictionary } from "./dicctionary.js";
|
|
10
|
+
import { M as MasterDetailLayoutRootStyled } from "./slots/MasterDetailLayoutSlot.js";
|
|
11
|
+
import { M as MASTER_DETAIL_LAYOUT_PREFIX } from "./constants.js";
|
|
12
|
+
import { g as getTotalModuleActions } from "./helpers/getTotalModuleActions.js";
|
|
15
13
|
function MasterDetailLayout(props) {
|
|
16
14
|
const {
|
|
17
15
|
moduleId,
|
|
@@ -19,7 +17,6 @@ function MasterDetailLayout(props) {
|
|
|
19
17
|
detailComponent,
|
|
20
18
|
moduleActions,
|
|
21
19
|
version
|
|
22
|
-
// defaultDictionary,
|
|
23
20
|
} = props;
|
|
24
21
|
const { host_static_assets, environment_assets } = useEnvironment();
|
|
25
22
|
const [splitPosition, setSplitPosition] = useState("vertical");
|
|
@@ -32,30 +29,30 @@ function MasterDetailLayout(props) {
|
|
|
32
29
|
const splitActions = useMemo(
|
|
33
30
|
() => [
|
|
34
31
|
{
|
|
35
|
-
iconUrl: `${host_static_assets}/${environment_assets}
|
|
32
|
+
iconUrl: `${host_static_assets}/${environment_assets}/${icons.splitVertical}`,
|
|
36
33
|
onClick: () => onChangePostionInternal("vertical"),
|
|
37
34
|
visibility: "main",
|
|
38
|
-
label: getLabel(
|
|
35
|
+
label: getLabel(dictionary.LABEL_SPLIT_VERTICAL),
|
|
39
36
|
tag: "vertical",
|
|
40
37
|
className: "splitactions",
|
|
41
38
|
disabled: splitPosition === "vertical",
|
|
42
39
|
key: "vertical"
|
|
43
40
|
},
|
|
44
41
|
{
|
|
45
|
-
iconUrl: `${host_static_assets}/${environment_assets}
|
|
42
|
+
iconUrl: `${host_static_assets}/${environment_assets}/${icons.splitHorizontal}`,
|
|
46
43
|
onClick: () => onChangePostionInternal("horizontal"),
|
|
47
44
|
visibility: "main",
|
|
48
|
-
label: getLabel(
|
|
45
|
+
label: getLabel(dictionary.LABEL_SPLIT_HORIZONTAL),
|
|
49
46
|
tag: "horizontal",
|
|
50
47
|
className: "splitactions",
|
|
51
48
|
disabled: splitPosition === "horizontal",
|
|
52
49
|
key: "horizontal"
|
|
53
50
|
},
|
|
54
51
|
{
|
|
55
|
-
iconUrl: `${host_static_assets}/${environment_assets}
|
|
52
|
+
iconUrl: `${host_static_assets}/${environment_assets}/${icons.noSplit}`,
|
|
56
53
|
onClick: () => onChangePostionInternal("none"),
|
|
57
54
|
visibility: "main",
|
|
58
|
-
label: getLabel(
|
|
55
|
+
label: getLabel(dictionary.LABEL_NO_SPLIT),
|
|
59
56
|
tag: "none",
|
|
60
57
|
className: "splitactions",
|
|
61
58
|
disabled: splitPosition === "none",
|
|
@@ -71,7 +68,7 @@ function MasterDetailLayout(props) {
|
|
|
71
68
|
window: /* @__PURE__ */ jsx(
|
|
72
69
|
WindowBase,
|
|
73
70
|
{
|
|
74
|
-
title: getLabel(
|
|
71
|
+
title: getLabel(dictionary.LABEL_VIEW_DETAIL),
|
|
75
72
|
onClose: () => {
|
|
76
73
|
moduleLayoutRef.current?.closeModal();
|
|
77
74
|
},
|
|
@@ -87,8 +84,8 @@ function MasterDetailLayout(props) {
|
|
|
87
84
|
);
|
|
88
85
|
return actions;
|
|
89
86
|
}, [splitActions, moduleActions]);
|
|
90
|
-
const
|
|
91
|
-
return /* @__PURE__ */ jsx(MasterDetailProvider, { onClickViewDetail, children: /* @__PURE__ */ jsx(
|
|
87
|
+
const classRoot = getComponentSlotRoot(MASTER_DETAIL_LAYOUT_PREFIX);
|
|
88
|
+
return /* @__PURE__ */ jsx(MasterDetailProvider, { onClickViewDetail, children: /* @__PURE__ */ jsx(MasterDetailLayoutRootStyled, { className: classRoot, children: /* @__PURE__ */ jsx(
|
|
92
89
|
ModuleLayout,
|
|
93
90
|
{
|
|
94
91
|
ref: moduleLayoutRef,
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { createContext,
|
|
2
|
+
import { createContext, useRef } from "react";
|
|
3
3
|
import { voidFunction } from "@m4l/core";
|
|
4
|
+
import { c as createMasterDetailLayoutStore } from "./store.js";
|
|
5
|
+
import { useStore } from "zustand";
|
|
4
6
|
const initialState = {
|
|
5
7
|
masterSelection: void 0,
|
|
6
8
|
onChangeMasterSelection: voidFunction,
|
|
@@ -11,17 +13,24 @@ const initialState = {
|
|
|
11
13
|
const MasterDetailContext = createContext(initialState);
|
|
12
14
|
function MasterDetailProvider(props) {
|
|
13
15
|
const { children, onClickViewDetail } = props;
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
+
const masterDetailLayoutStoreRef = useRef();
|
|
17
|
+
if (!masterDetailLayoutStoreRef.current) {
|
|
18
|
+
masterDetailLayoutStoreRef.current = createMasterDetailLayoutStore({
|
|
19
|
+
masterSelection: void 0,
|
|
20
|
+
refreshMaster: voidFunction
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
const store = useStore(masterDetailLayoutStoreRef.current, (state) => state);
|
|
24
|
+
const { masterSelection, updateMasterSelection, updateRefreshMaster, refreshMaster } = store;
|
|
16
25
|
return /* @__PURE__ */ jsx(
|
|
17
26
|
MasterDetailContext.Provider,
|
|
18
27
|
{
|
|
19
28
|
value: {
|
|
20
29
|
masterSelection,
|
|
21
|
-
onChangeMasterSelection:
|
|
30
|
+
onChangeMasterSelection: updateMasterSelection,
|
|
22
31
|
onClickViewDetail,
|
|
23
32
|
refreshMaster,
|
|
24
|
-
setRefreshMaster
|
|
33
|
+
setRefreshMaster: updateRefreshMaster
|
|
25
34
|
},
|
|
26
35
|
children
|
|
27
36
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MasterDetailLayoutState, MasterDetailLayoutStateWithActions } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Crea el Store para ModuleLayout.
|
|
4
|
+
* Este store se encarga de manejar el estado del layout de módulo.
|
|
5
|
+
* @param props Las props iniciales del store.
|
|
6
|
+
*/
|
|
7
|
+
export declare const createMasterDetailLayoutStore: (initProps: MasterDetailLayoutState, storeDevtoolsEnabled?: boolean) => import('zustand').UseBoundStore<Omit<Omit<import('zustand').StoreApi<MasterDetailLayoutStateWithActions>, "setState"> & {
|
|
8
|
+
setState<A extends string | {
|
|
9
|
+
type: unknown;
|
|
10
|
+
}>(partial: MasterDetailLayoutStateWithActions | Partial<MasterDetailLayoutStateWithActions> | ((state: MasterDetailLayoutStateWithActions) => MasterDetailLayoutStateWithActions | Partial<MasterDetailLayoutStateWithActions>), replace?: boolean | undefined, action?: A | undefined): void;
|
|
11
|
+
}, "setState"> & {
|
|
12
|
+
setState(nextStateOrUpdater: MasterDetailLayoutStateWithActions | Partial<MasterDetailLayoutStateWithActions> | ((state: import('immer/dist/internal').WritableDraft<MasterDetailLayoutStateWithActions>) => void), shouldReplace?: boolean | undefined, action?: string | {
|
|
13
|
+
type: unknown;
|
|
14
|
+
} | undefined): void;
|
|
15
|
+
}>;
|
|
16
|
+
export type MasterDetailLayoutStore = ReturnType<typeof createMasterDetailLayoutStore>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { create } from "zustand";
|
|
2
|
+
import { devtools } from "zustand/middleware";
|
|
3
|
+
import { immer } from "zustand/middleware/immer";
|
|
4
|
+
import { a as MASTER_DETAIL_LAYOUT_STORE_ID } from "../../constants.js";
|
|
5
|
+
const createDevtools = (immerMiddlewere, config) => {
|
|
6
|
+
const { enabled = false } = config;
|
|
7
|
+
if (enabled && process.env.NODE_ENV === "development") {
|
|
8
|
+
return devtools(immerMiddlewere, config);
|
|
9
|
+
}
|
|
10
|
+
return immerMiddlewere;
|
|
11
|
+
};
|
|
12
|
+
const createMasterDetailLayoutStore = (initProps, storeDevtoolsEnabled = false) => {
|
|
13
|
+
const { refreshMaster, masterSelection } = initProps;
|
|
14
|
+
const startProps = {
|
|
15
|
+
refreshMaster,
|
|
16
|
+
masterSelection
|
|
17
|
+
};
|
|
18
|
+
return create(
|
|
19
|
+
createDevtools(
|
|
20
|
+
immer((set) => ({
|
|
21
|
+
...startProps,
|
|
22
|
+
/**
|
|
23
|
+
* Initilize the store
|
|
24
|
+
*/
|
|
25
|
+
init: () => {
|
|
26
|
+
},
|
|
27
|
+
/**
|
|
28
|
+
* Update the master selection
|
|
29
|
+
*/
|
|
30
|
+
updateMasterSelection: (newMasterSelection) => {
|
|
31
|
+
set((state) => {
|
|
32
|
+
state.masterSelection = newMasterSelection;
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
/**
|
|
36
|
+
* Update the refresh master
|
|
37
|
+
*/
|
|
38
|
+
updateRefreshMaster: (callback) => {
|
|
39
|
+
set((state) => {
|
|
40
|
+
state.refreshMaster = callback;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
})),
|
|
44
|
+
{ name: `${MASTER_DETAIL_LAYOUT_STORE_ID}: ${initProps.storeId}`, enabled: storeDevtoolsEnabled }
|
|
45
|
+
)
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
export {
|
|
49
|
+
createMasterDetailLayoutStore as c
|
|
50
|
+
};
|
|
@@ -6,9 +6,37 @@ export interface MasterDetailContextStateProps {
|
|
|
6
6
|
export interface MasterDetailProviderProps {
|
|
7
7
|
children: ReactNode;
|
|
8
8
|
onClickViewDetail: () => void;
|
|
9
|
+
/**
|
|
10
|
+
* "storeDevtoolsEnabled" enable store devtools
|
|
11
|
+
*/
|
|
12
|
+
storeDevtoolsEnabled?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* "storeId" store identifier
|
|
15
|
+
*/
|
|
16
|
+
storeId?: string;
|
|
9
17
|
}
|
|
10
18
|
export interface MasterDetailContextProps extends MasterDetailContextStateProps, Pick<MasterDetailProviderProps, 'onClickViewDetail'> {
|
|
11
19
|
onChangeMasterSelection: (newMasterSelection: MasterSelecion) => void;
|
|
12
20
|
refreshMaster: () => void;
|
|
13
21
|
setRefreshMaster: (callback: () => void) => void;
|
|
14
22
|
}
|
|
23
|
+
export interface MasterDetailLayoutState extends Pick<MasterDetailContextStateProps, 'masterSelection'>, Pick<MasterDetailProviderProps, 'storeId'> {
|
|
24
|
+
/**
|
|
25
|
+
* Refresh master: Action to refresh data inthe master component
|
|
26
|
+
*/
|
|
27
|
+
refreshMaster: () => void;
|
|
28
|
+
}
|
|
29
|
+
export interface MasterDetailLayoutStateWithActions extends MasterDetailLayoutState {
|
|
30
|
+
/**
|
|
31
|
+
* Initialize MasterDetailLayout store.
|
|
32
|
+
*/
|
|
33
|
+
init: () => void;
|
|
34
|
+
/**
|
|
35
|
+
* Update MasterDetailLayout store.
|
|
36
|
+
*/
|
|
37
|
+
updateMasterSelection: (newMasterSelection: MasterSelecion) => void;
|
|
38
|
+
/**
|
|
39
|
+
* Update MasterDetailLayout store.
|
|
40
|
+
*/
|
|
41
|
+
updateRefreshMaster: (callback: () => void) => void;
|
|
42
|
+
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
import { Dictionary } from '@m4l/core';
|
|
2
1
|
export declare function getMasterDetailLayoutComponentsDictionary(): string[];
|
|
3
|
-
export declare const
|
|
2
|
+
export declare const dictionary: {
|
|
3
|
+
LABEL_SPLIT_VERTICAL: string;
|
|
4
|
+
LABEL_SPLIT_HORIZONTAL: string;
|
|
5
|
+
LABEL_NO_SPLIT: string;
|
|
6
|
+
LABEL_VIEW_DETAIL: string;
|
|
7
|
+
};
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import { g as getModuleLayoutComponentsDictionary } from "../ModuleLayout/dicctionary.js";
|
|
2
|
-
import { getNoItemSelectedComponentsDictionary } from "@m4l/components";
|
|
3
1
|
function getMasterDetailLayoutComponentsDictionary() {
|
|
4
|
-
return ["master_detail_layout"]
|
|
2
|
+
return ["master_detail_layout"];
|
|
5
3
|
}
|
|
4
|
+
const dictionary = {
|
|
5
|
+
LABEL_SPLIT_VERTICAL: `${getMasterDetailLayoutComponentsDictionary()[0]}.split_vertical`,
|
|
6
|
+
LABEL_SPLIT_HORIZONTAL: `${getMasterDetailLayoutComponentsDictionary()[0]}.split_horizontal`,
|
|
7
|
+
LABEL_NO_SPLIT: `${getMasterDetailLayoutComponentsDictionary()[0]}.no_split`,
|
|
8
|
+
LABEL_VIEW_DETAIL: `${getMasterDetailLayoutComponentsDictionary()[0]}.view_detail`
|
|
9
|
+
};
|
|
6
10
|
export {
|
|
11
|
+
dictionary as d,
|
|
7
12
|
getMasterDetailLayoutComponentsDictionary as g
|
|
8
13
|
};
|