@m4l/layouts 9.3.8 → 9.3.9
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 +85 -85
- package/hooks/useDynamicPaperForm/types.d.ts +4 -4
- package/hooks/useDynamicPaperForm/useDynamicPaperForm.js +1 -1
- package/hooks/useNetworkActionConfirm/types.d.ts +14 -3
- package/hooks/useNetworkActionConfirm/useNetworkActionConfirm.d.ts +2 -2
- package/hooks/useNetworkActionConfirm/useNetworkActionConfirm.js +12 -5
- package/package.json +1 -1
|
@@ -20,120 +20,120 @@ export declare function useModuleDetailTabs<T extends Record<string, any> = Reco
|
|
|
20
20
|
size?: Extract<import('@m4l/styles').Sizes, "small" | "medium"> | undefined;
|
|
21
21
|
children?: null | undefined;
|
|
22
22
|
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;
|
|
23
|
-
title?: string | undefined
|
|
23
|
+
title?: string | undefined;
|
|
24
24
|
component?: React.ElementType | undefined;
|
|
25
|
-
id?: string | undefined
|
|
25
|
+
id?: string | undefined;
|
|
26
26
|
disabled?: boolean | undefined;
|
|
27
27
|
action?: React.Ref<import('@mui/material').ButtonBaseActions> | undefined;
|
|
28
|
-
hidden?: boolean | undefined
|
|
28
|
+
hidden?: boolean | undefined;
|
|
29
29
|
color?: Extract<import('@m4l/styles').ComponentPalletColor, "default"> | undefined;
|
|
30
|
-
content?: string | undefined
|
|
30
|
+
content?: string | undefined;
|
|
31
31
|
style?: React.CSSProperties | undefined;
|
|
32
|
-
translate?: "yes" | "no" | undefined
|
|
32
|
+
translate?: "yes" | "no" | undefined;
|
|
33
33
|
urlIcon?: string | undefined;
|
|
34
|
-
lang?: string | undefined
|
|
35
|
-
slot?: string | undefined
|
|
36
|
-
dir?: string | undefined
|
|
34
|
+
lang?: string | undefined;
|
|
35
|
+
slot?: string | undefined;
|
|
36
|
+
dir?: string | undefined;
|
|
37
37
|
className?: string | undefined;
|
|
38
38
|
classes?: (Partial<import('@mui/material').TabClasses> & Partial<import('@mui/material').ClassNameMap<never>>) | undefined;
|
|
39
39
|
sx?: import('@mui/system').SxProps<import('@mui/material').Theme> | undefined;
|
|
40
40
|
key?: import('react').Key | null | undefined;
|
|
41
|
-
defaultChecked?: boolean | undefined
|
|
41
|
+
defaultChecked?: boolean | undefined;
|
|
42
42
|
defaultValue?: string | number | readonly string[] | undefined;
|
|
43
|
-
suppressContentEditableWarning?: boolean | undefined
|
|
44
|
-
suppressHydrationWarning?: boolean | undefined
|
|
45
|
-
accessKey?: string | undefined
|
|
46
|
-
autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {})
|
|
47
|
-
autoFocus?: boolean | undefined
|
|
48
|
-
contentEditable?:
|
|
49
|
-
contextMenu?: string | undefined
|
|
43
|
+
suppressContentEditableWarning?: boolean | undefined;
|
|
44
|
+
suppressHydrationWarning?: boolean | undefined;
|
|
45
|
+
accessKey?: string | undefined;
|
|
46
|
+
autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {});
|
|
47
|
+
autoFocus?: boolean | undefined;
|
|
48
|
+
contentEditable?: (boolean | "false" | "true") | "inherit" | "plaintext-only" | undefined;
|
|
49
|
+
contextMenu?: string | undefined;
|
|
50
50
|
draggable?: (boolean | "false" | "true") | undefined;
|
|
51
|
-
enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined
|
|
52
|
-
nonce?: string | undefined
|
|
51
|
+
enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined;
|
|
52
|
+
nonce?: string | undefined;
|
|
53
53
|
spellCheck?: (boolean | "false" | "true") | undefined;
|
|
54
54
|
tabIndex?: NonNullable<React.HTMLAttributes<any>["tabIndex"]> | undefined;
|
|
55
|
-
radioGroup?: string | undefined
|
|
55
|
+
radioGroup?: string | undefined;
|
|
56
56
|
role?: import('react').AriaRole | undefined;
|
|
57
|
-
about?: string | undefined
|
|
58
|
-
datatype?: string | undefined
|
|
57
|
+
about?: string | undefined;
|
|
58
|
+
datatype?: string | undefined;
|
|
59
59
|
inlist?: any;
|
|
60
|
-
prefix?: string | undefined
|
|
61
|
-
property?: string | undefined
|
|
62
|
-
rel?: string | undefined
|
|
63
|
-
resource?: string | undefined
|
|
64
|
-
rev?: string | undefined
|
|
65
|
-
typeof?: string | undefined
|
|
66
|
-
vocab?: string | undefined
|
|
67
|
-
autoCorrect?: string | undefined
|
|
68
|
-
autoSave?: string | undefined
|
|
69
|
-
itemProp?: string | undefined
|
|
70
|
-
itemScope?: boolean | undefined
|
|
71
|
-
itemType?: string | undefined
|
|
72
|
-
itemID?: string | undefined
|
|
73
|
-
itemRef?: string | undefined
|
|
74
|
-
results?: number | undefined
|
|
75
|
-
security?: string | undefined
|
|
76
|
-
unselectable?: "on" | "off" | undefined
|
|
77
|
-
inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined
|
|
78
|
-
is?: string | undefined
|
|
79
|
-
exportparts?: string | undefined
|
|
80
|
-
part?: string | undefined
|
|
81
|
-
"aria-activedescendant"?: string | undefined
|
|
60
|
+
prefix?: string | undefined;
|
|
61
|
+
property?: string | undefined;
|
|
62
|
+
rel?: string | undefined;
|
|
63
|
+
resource?: string | undefined;
|
|
64
|
+
rev?: string | undefined;
|
|
65
|
+
typeof?: string | undefined;
|
|
66
|
+
vocab?: string | undefined;
|
|
67
|
+
autoCorrect?: string | undefined;
|
|
68
|
+
autoSave?: string | undefined;
|
|
69
|
+
itemProp?: string | undefined;
|
|
70
|
+
itemScope?: boolean | undefined;
|
|
71
|
+
itemType?: string | undefined;
|
|
72
|
+
itemID?: string | undefined;
|
|
73
|
+
itemRef?: string | undefined;
|
|
74
|
+
results?: number | undefined;
|
|
75
|
+
security?: string | undefined;
|
|
76
|
+
unselectable?: "on" | "off" | undefined;
|
|
77
|
+
inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined;
|
|
78
|
+
is?: string | undefined;
|
|
79
|
+
exportparts?: string | undefined;
|
|
80
|
+
part?: string | undefined;
|
|
81
|
+
"aria-activedescendant"?: string | undefined;
|
|
82
82
|
"aria-atomic"?: (boolean | "false" | "true") | undefined;
|
|
83
|
-
"aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined
|
|
84
|
-
"aria-braillelabel"?: string | undefined
|
|
85
|
-
"aria-brailleroledescription"?: string | undefined
|
|
83
|
+
"aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined;
|
|
84
|
+
"aria-braillelabel"?: string | undefined;
|
|
85
|
+
"aria-brailleroledescription"?: string | undefined;
|
|
86
86
|
"aria-busy"?: (boolean | "false" | "true") | undefined;
|
|
87
|
-
"aria-checked"?: boolean | "false" | "mixed" | "true" | undefined
|
|
88
|
-
"aria-colcount"?: number | undefined
|
|
89
|
-
"aria-colindex"?: number | undefined
|
|
90
|
-
"aria-colindextext"?: string | undefined
|
|
91
|
-
"aria-colspan"?: number | undefined
|
|
92
|
-
"aria-controls"?: string | undefined
|
|
93
|
-
"aria-current"?: boolean | "false" | "true" | "page" | "step" | "location" | "date" | "time" | undefined
|
|
94
|
-
"aria-describedby"?: string | undefined
|
|
95
|
-
"aria-description"?: string | undefined
|
|
96
|
-
"aria-details"?: string | undefined
|
|
87
|
+
"aria-checked"?: boolean | "false" | "mixed" | "true" | undefined;
|
|
88
|
+
"aria-colcount"?: number | undefined;
|
|
89
|
+
"aria-colindex"?: number | undefined;
|
|
90
|
+
"aria-colindextext"?: string | undefined;
|
|
91
|
+
"aria-colspan"?: number | undefined;
|
|
92
|
+
"aria-controls"?: string | undefined;
|
|
93
|
+
"aria-current"?: boolean | "false" | "true" | "page" | "step" | "location" | "date" | "time" | undefined;
|
|
94
|
+
"aria-describedby"?: string | undefined;
|
|
95
|
+
"aria-description"?: string | undefined;
|
|
96
|
+
"aria-details"?: string | undefined;
|
|
97
97
|
"aria-disabled"?: (boolean | "false" | "true") | undefined;
|
|
98
|
-
"aria-dropeffect"?: "none" | "copy" | "execute" | "link" | "move" | "popup" | undefined
|
|
99
|
-
"aria-errormessage"?: string | undefined
|
|
98
|
+
"aria-dropeffect"?: "none" | "copy" | "execute" | "link" | "move" | "popup" | undefined;
|
|
99
|
+
"aria-errormessage"?: string | undefined;
|
|
100
100
|
"aria-expanded"?: (boolean | "false" | "true") | undefined;
|
|
101
|
-
"aria-flowto"?: string | undefined
|
|
101
|
+
"aria-flowto"?: string | undefined;
|
|
102
102
|
"aria-grabbed"?: (boolean | "false" | "true") | undefined;
|
|
103
|
-
"aria-haspopup"?: boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined
|
|
103
|
+
"aria-haspopup"?: boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined;
|
|
104
104
|
"aria-hidden"?: (boolean | "false" | "true") | undefined;
|
|
105
|
-
"aria-invalid"?: boolean | "false" | "true" | "grammar" | "spelling" | undefined
|
|
106
|
-
"aria-keyshortcuts"?: string | undefined
|
|
107
|
-
"aria-label"?: string | undefined
|
|
108
|
-
"aria-labelledby"?: string | undefined
|
|
109
|
-
"aria-level"?: number | undefined
|
|
110
|
-
"aria-live"?: "off" | "assertive" | "polite" | undefined
|
|
105
|
+
"aria-invalid"?: boolean | "false" | "true" | "grammar" | "spelling" | undefined;
|
|
106
|
+
"aria-keyshortcuts"?: string | undefined;
|
|
107
|
+
"aria-label"?: string | undefined;
|
|
108
|
+
"aria-labelledby"?: string | undefined;
|
|
109
|
+
"aria-level"?: number | undefined;
|
|
110
|
+
"aria-live"?: "off" | "assertive" | "polite" | undefined;
|
|
111
111
|
"aria-modal"?: (boolean | "false" | "true") | undefined;
|
|
112
112
|
"aria-multiline"?: (boolean | "false" | "true") | undefined;
|
|
113
113
|
"aria-multiselectable"?: (boolean | "false" | "true") | undefined;
|
|
114
|
-
"aria-orientation"?: "horizontal" | "vertical" | undefined
|
|
115
|
-
"aria-owns"?: string | undefined
|
|
116
|
-
"aria-placeholder"?: string | undefined
|
|
117
|
-
"aria-posinset"?: number | undefined
|
|
118
|
-
"aria-pressed"?: boolean | "false" | "mixed" | "true" | undefined
|
|
114
|
+
"aria-orientation"?: "horizontal" | "vertical" | undefined;
|
|
115
|
+
"aria-owns"?: string | undefined;
|
|
116
|
+
"aria-placeholder"?: string | undefined;
|
|
117
|
+
"aria-posinset"?: number | undefined;
|
|
118
|
+
"aria-pressed"?: boolean | "false" | "mixed" | "true" | undefined;
|
|
119
119
|
"aria-readonly"?: (boolean | "false" | "true") | undefined;
|
|
120
|
-
"aria-relevant"?: "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text" | "text additions" | "text removals" | undefined
|
|
120
|
+
"aria-relevant"?: "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text" | "text additions" | "text removals" | undefined;
|
|
121
121
|
"aria-required"?: (boolean | "false" | "true") | undefined;
|
|
122
|
-
"aria-roledescription"?: string | undefined
|
|
123
|
-
"aria-rowcount"?: number | undefined
|
|
124
|
-
"aria-rowindex"?: number | undefined
|
|
125
|
-
"aria-rowindextext"?: string | undefined
|
|
126
|
-
"aria-rowspan"?: number | undefined
|
|
122
|
+
"aria-roledescription"?: string | undefined;
|
|
123
|
+
"aria-rowcount"?: number | undefined;
|
|
124
|
+
"aria-rowindex"?: number | undefined;
|
|
125
|
+
"aria-rowindextext"?: string | undefined;
|
|
126
|
+
"aria-rowspan"?: number | undefined;
|
|
127
127
|
"aria-selected"?: (boolean | "false" | "true") | undefined;
|
|
128
|
-
"aria-setsize"?: number | undefined
|
|
129
|
-
"aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined
|
|
130
|
-
"aria-valuemax"?: number | undefined
|
|
131
|
-
"aria-valuemin"?: number | undefined
|
|
132
|
-
"aria-valuenow"?: number | undefined
|
|
133
|
-
"aria-valuetext"?: string | undefined
|
|
128
|
+
"aria-setsize"?: number | undefined;
|
|
129
|
+
"aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined;
|
|
130
|
+
"aria-valuemax"?: number | undefined;
|
|
131
|
+
"aria-valuemin"?: number | undefined;
|
|
132
|
+
"aria-valuenow"?: number | undefined;
|
|
133
|
+
"aria-valuetext"?: string | undefined;
|
|
134
134
|
dangerouslySetInnerHTML?: {
|
|
135
135
|
__html: string | TrustedHTML;
|
|
136
|
-
} | undefined
|
|
136
|
+
} | undefined;
|
|
137
137
|
onCopy?: import('react').ClipboardEventHandler<HTMLDivElement> | undefined;
|
|
138
138
|
onCopyCapture?: import('react').ClipboardEventHandler<HTMLDivElement> | undefined;
|
|
139
139
|
onCut?: import('react').ClipboardEventHandler<HTMLDivElement> | undefined;
|
|
@@ -304,7 +304,7 @@ export declare function useModuleDetailTabs<T extends Record<string, any> = Reco
|
|
|
304
304
|
touchRippleRef?: React.Ref<import('@mui/material/ButtonBase/TouchRipple').TouchRippleActions> | undefined;
|
|
305
305
|
disableFocusRipple?: boolean | undefined;
|
|
306
306
|
ariaLabel?: string | undefined;
|
|
307
|
-
iconPosition?: "top" | "bottom" | "start" | "end" | undefined;
|
|
307
|
+
iconPosition?: ("top" | "bottom" | "start" | "end") | undefined;
|
|
308
308
|
wrapped?: boolean | undefined;
|
|
309
309
|
}[];
|
|
310
310
|
handleChangeTab: (newValue: string) => void;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { PropertyValueProps, RHFTextFieldProps } from '@m4l/components';
|
|
2
2
|
interface PropertyValueFieldBase extends Pick<PropertyValueProps, 'semanticWidth'> {
|
|
3
3
|
name: string;
|
|
4
|
-
type: '
|
|
4
|
+
type: 'RHFTextField' | 'component';
|
|
5
5
|
label: string;
|
|
6
6
|
mandatory?: boolean;
|
|
7
7
|
}
|
|
8
|
-
interface
|
|
9
|
-
type: '
|
|
8
|
+
interface PropertyValueRHFTextField extends PropertyValueFieldBase, Pick<RHFTextFieldProps, 'multiline' | 'rows'> {
|
|
9
|
+
type: 'RHFTextField';
|
|
10
10
|
readOnly?: boolean;
|
|
11
11
|
disabled?: boolean;
|
|
12
12
|
textFieldType?: React.InputHTMLAttributes<unknown>['type'];
|
|
@@ -16,7 +16,7 @@ export interface PropertyValueOtherComponent<T extends React.ComponentType<any>>
|
|
|
16
16
|
component: T;
|
|
17
17
|
componentProps: React.ComponentProps<T>;
|
|
18
18
|
}
|
|
19
|
-
export type PropertyValueField =
|
|
19
|
+
export type PropertyValueField = PropertyValueRHFTextField | PropertyValueOtherComponent<any>;
|
|
20
20
|
export type UseDynamicPaperFormProps = {
|
|
21
21
|
fields: PropertyValueField[];
|
|
22
22
|
title: string;
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { NetworkProps } from '@m4l/core';
|
|
2
|
-
export
|
|
2
|
+
export type NetworkConfirmResponse = {
|
|
3
|
+
message: string;
|
|
4
|
+
};
|
|
5
|
+
export type ToastConfig = {
|
|
6
|
+
title: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
};
|
|
9
|
+
export interface UseNetworkActionConfirmProps<T, K extends NetworkConfirmResponse = NetworkConfirmResponse> {
|
|
3
10
|
/**
|
|
4
11
|
* Función para refrescar la lista
|
|
5
12
|
*/
|
|
@@ -11,9 +18,13 @@ export interface UseNetworkConfirmActionProps<T> {
|
|
|
11
18
|
/**
|
|
12
19
|
* Título del modal
|
|
13
20
|
*/
|
|
14
|
-
title: string;
|
|
21
|
+
title: string | ((obj: T) => string);
|
|
15
22
|
/**
|
|
16
23
|
* Mensaje del modal
|
|
17
24
|
*/
|
|
18
|
-
message: string;
|
|
25
|
+
message: string | ((obj: T) => string);
|
|
26
|
+
/**
|
|
27
|
+
* Configuración personalizada de la notificación de toast success, si retorna undefined o null no se muestra la notificación
|
|
28
|
+
*/
|
|
29
|
+
customToastConfig?: (obj: T, response: K) => ToastConfig | undefined | null;
|
|
19
30
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NetworkConfirmResponse, UseNetworkActionConfirmProps } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* Obtiene las acciones de fila
|
|
4
4
|
*/
|
|
5
|
-
export declare function useNetworkActionConfirm<T>(props:
|
|
5
|
+
export declare function useNetworkActionConfirm<T, K extends NetworkConfirmResponse = NetworkConfirmResponse>(props: UseNetworkActionConfirmProps<T, K>): {
|
|
6
6
|
onAction: (obj: T) => void;
|
|
7
7
|
};
|
|
@@ -3,7 +3,7 @@ import { useModal, useWindowToolsMF, WindowConfirm } from "@m4l/components";
|
|
|
3
3
|
import { useNetwork, useHostTools } from "@m4l/core";
|
|
4
4
|
import { useCallback } from "react";
|
|
5
5
|
function useNetworkActionConfirm(props) {
|
|
6
|
-
const { fullRefresh, getEndPoint, title, message } = props;
|
|
6
|
+
const { fullRefresh, getEndPoint, title, message, customToastConfig } = props;
|
|
7
7
|
const { networkOperation } = useNetwork();
|
|
8
8
|
const { toast } = useHostTools();
|
|
9
9
|
const { openModal, closeModal } = useModal();
|
|
@@ -16,22 +16,29 @@ function useNetworkActionConfirm(props) {
|
|
|
16
16
|
},
|
|
17
17
|
...getEndPoint(obj)
|
|
18
18
|
}).then((response) => {
|
|
19
|
-
|
|
19
|
+
if (customToastConfig) {
|
|
20
|
+
const toastConfig = customToastConfig(obj, response);
|
|
21
|
+
if (toastConfig) {
|
|
22
|
+
toast(toastConfig, { type: "success" });
|
|
23
|
+
}
|
|
24
|
+
} else {
|
|
25
|
+
toast({ title: `${response.message}` }, { type: "success" });
|
|
26
|
+
}
|
|
20
27
|
}).catch((response) => {
|
|
21
28
|
toast({ title: `${response.message}` }, { type: "error" });
|
|
22
29
|
}).finally(() => {
|
|
23
30
|
fullRefresh(obj);
|
|
24
31
|
});
|
|
25
32
|
closeModal();
|
|
26
|
-
}, [
|
|
33
|
+
}, [networkOperation, startProgress, stopProgress, getEndPoint, closeModal, customToastConfig, toast, fullRefresh]);
|
|
27
34
|
const onAction = useCallback(
|
|
28
35
|
(obj) => {
|
|
29
36
|
openModal({
|
|
30
37
|
window: /* @__PURE__ */ jsx(
|
|
31
38
|
WindowConfirm,
|
|
32
39
|
{
|
|
33
|
-
title,
|
|
34
|
-
msg: message,
|
|
40
|
+
title: typeof title === "function" ? title(obj) : title,
|
|
41
|
+
msg: typeof message === "function" ? message(obj) : message,
|
|
35
42
|
onClickIntro: () => onConfirm(obj)
|
|
36
43
|
}
|
|
37
44
|
),
|