@m4l/components 9.3.19 → 9.3.21-JAEBeta.0
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/@types/types.d.ts +1 -1
- package/components/Chip/Chip.js +9 -7
- package/components/Chip/ChipStyles.js +4 -31
- package/components/Chip/helpers.d.ts +10 -0
- package/components/Chip/helpers.js +34 -0
- package/components/Chip/types.d.ts +6 -0
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/hooks/useModalSettings/index.js +1 -1
- package/components/DragResizeWindowRND/DragResizeWindowRND.js +14 -10
- package/components/DragResizeWindowRND/helpers/expandingParentContainer.d.ts +1 -1
- package/components/DragResizeWindowRND/helpers/expandingParentContainer.js +24 -19
- package/components/DragResizeWindowRND/helpers/getInitialSize.d.ts +3 -3
- package/components/DragResizeWindowRND/helpers/getInitialSize.js +18 -15
- package/components/DragResizeWindowRND/helpers/shrinkingParentContainer.d.ts +1 -1
- package/components/DragResizeWindowRND/helpers/shrinkingParentContainer.js +17 -9
- package/components/DragResizeWindowRND/hooks/useRNDDimensionEffects.js +4 -1
- package/components/DragResizeWindowRND/index.d.ts +1 -0
- package/components/DragResizeWindowRND/types.d.ts +12 -2
- package/components/DynamicFilter/DynamicFilter.js +2 -1
- package/components/DynamicFilter/helpers/frontEndHelpers.d.ts +2 -2
- package/components/DynamicFilter/helpers/frontEndHelpers.js +31 -9
- package/components/DynamicFilter/subcomponents/DynamicFilterBase/DynamicFilterBase.d.ts +2 -1
- package/components/DynamicFilter/subcomponents/DynamicFilterBase/DynamicFilterBase.js +4 -2
- package/components/DynamicFilter/subcomponents/DynamicFilterBase/types.d.ts +3 -0
- package/components/DynamicFilter/subcomponents/PopoverFilter/PopoverFilter.js +1 -1
- package/components/DynamicFilter/types.d.ts +4 -0
- package/components/DynamicSort/DynamicSort.js +2 -1
- package/components/DynamicSort/subcomponents/DynamicSortBase/DynamicSortBase.d.ts +2 -1
- package/components/DynamicSort/subcomponents/DynamicSortBase/DynamicSortBase.js +4 -2
- package/components/DynamicSort/subcomponents/DynamicSortBase/types.d.ts +3 -0
- package/components/DynamicSort/subcomponents/PopoverSort/PopoverSort.js +1 -1
- package/components/DynamicSort/types.d.ts +4 -0
- package/components/Image/Image.js +4 -1
- package/components/MFLoader/MFLoader.js +3 -2
- package/components/MFLoader/types.d.ts +5 -0
- package/components/ObjectLogs/hooks/useDetailFormatter.js +1 -1
- package/components/Stepper/Stepper.styles.js +17 -14
- package/components/Stepper/helpers/getInitialFieldValues/index.d.ts +12 -0
- package/components/Stepper/helpers/getInitialFieldValues/index.js +14 -0
- package/components/Stepper/helpers/index.d.ts +2 -0
- package/components/Stepper/helpers/parseWatchedValues/index.d.ts +17 -0
- package/components/Stepper/helpers/parseWatchedValues/index.js +12 -0
- package/components/Stepper/hooks/useDynamicValidation/index.d.ts +11 -0
- package/components/Stepper/hooks/useDynamicValidation/index.js +69 -0
- package/components/Stepper/hooks/useStepperActions/index.js +19 -3
- package/components/Stepper/store/StepperStore/index.js +20 -1
- package/components/Stepper/subcomponents/StepArea/index.js +45 -25
- package/components/Stepper/subcomponents/StepArea/subcomponents/Inidicator/index.js +18 -10
- package/components/Stepper/subcomponents/StepperButtons/StepperCancelButton/index.d.ts +2 -1
- package/components/Stepper/subcomponents/StepperButtons/StepperCancelButton/index.js +38 -5
- package/components/Stepper/subcomponents/StepperButtons/StepperNextButton/index.d.ts +2 -1
- package/components/Stepper/subcomponents/StepperButtons/StepperNextButton/index.js +5 -3
- package/components/Stepper/subcomponents/StepperButtons/StepperPrevButton/index.d.ts +2 -1
- package/components/Stepper/subcomponents/StepperButtons/StepperPrevButton/index.js +5 -3
- package/components/Stepper/subcomponents/StepperButtons/StepperSubmitButton/index.d.ts +2 -1
- package/components/Stepper/subcomponents/StepperButtons/StepperSubmitButton/index.js +5 -3
- package/components/Stepper/subcomponents/StepperContent/subcomponents/Step/index.js +30 -11
- package/components/Stepper/subcomponents/StepperFooter/subcomponents/StepperFooterRightActions/index.js +20 -10
- package/components/Stepper/types.d.ts +7 -0
- package/components/WindowBase/WindowBase.js +3 -3
- package/components/WindowBase/WindowBase.styles.js +36 -31
- package/components/WindowBase/constants.d.ts +1 -1
- package/components/WindowBase/constants.js +2 -2
- package/components/WindowBase/index.d.ts +1 -0
- package/components/WindowBase/subcomponents/Component/index.js +2 -2
- package/components/WindowBase/subcomponents/Component/types.d.ts +2 -0
- package/components/WindowBase/subcomponents/Header/HeaderWindowBase.js +7 -7
- package/components/WindowBase/subcomponents/Header/types.d.ts +1 -1
- package/components/WindowBase/subcomponents/MicroFrontend/types.d.ts +2 -0
- package/components/WindowBase/types.d.ts +3 -3
- package/components/WindowConfirm/WindowConfirm.js +1 -1
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/Window.js +3 -1
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/hooks/useWindow.js +17 -2
- package/components/areas/contexts/AreasContext/store.js +2 -2
- package/components/areas/index.d.ts +1 -1
- package/components/areas/types.d.ts +1 -1
- package/components/formatters/DistanceToNowFormatter/DistanceToNowFormatter.js +3 -34
- package/components/formatters/DistanceToNowFormatter/dictionary.d.ts +8 -0
- package/components/formatters/DistanceToNowFormatter/hooks/useDistanceToNowFormatter.d.ts +13 -0
- package/components/formatters/DistanceToNowFormatter/hooks/useDistanceToNowFormatter.js +65 -0
- package/components/formatters/DistanceToNowFormatter/index.d.ts +1 -0
- package/components/formatters/DistanceToNowFormatter/types.d.ts +4 -1
- package/components/hook-form/RHFAutocomplete/RHFAutocomplete.js +5 -1
- package/components/hook-form/RHFAutocomplete/constants.d.ts +1 -0
- package/components/hook-form/RHFAutocomplete/constants.js +5 -1
- package/components/hook-form/RHFAutocompleteAsync/RHFAutocompleteAsync.js +3 -1
- package/components/hook-form/RHFAutocompleteAsync/types.d.ts +4 -0
- package/components/hook-form/RHFormContext/index.d.ts +1 -1
- package/components/hook-form/RHFormContext/index.js +29 -4
- package/components/mui_extended/ToggleIconButton/ToggleIconButton.js +6 -2
- package/components/mui_extended/ToggleIconButton/ToggleIconButton.styles.js +9 -0
- package/components/mui_extended/ToggleIconButton/types.d.ts +1 -0
- package/components/mui_extended/index.d.ts +1 -1
- package/components/popups/components/PopupsProvider/hooks/usePopups.d.ts +2 -2
- package/components/popups/components/PopupsProvider/hooks/usePopups.js +0 -1
- package/components/popups/components/PopupsViewer/PopupsViewer.js +2 -2
- package/components/popups/components/PopupsViewer/subcomponents/Popup/Popup.js +3 -1
- package/components/popups/components/PopupsViewer/types.d.ts +1 -0
- package/hooks/index.d.ts +1 -0
- package/hooks/useSizeContainer/index.d.ts +2 -1
- package/hooks/useSizeContainer/index.js +22 -13
- package/hooks/useSizeContainer/types.d.ts +6 -0
- package/hooks/useStateRef/index.js +4 -4
- package/index.js +45 -38
- package/package.json +1 -1
- package/utils/deepShallow.d.ts +17 -0
- package/utils/deepShallow.js +76 -0
- package/utils/formatDistanceToNow/formatDistanteToNow.d.ts +2 -2
- package/utils/formatDistanceToNow/formatDistanteToNow.js +18 -2
- package/utils/formatDistanceToNow/types.d.ts +13 -0
- package/utils/index.d.ts +1 -0
|
@@ -9,7 +9,7 @@ const replaceValues = (label, ...values) => {
|
|
|
9
9
|
};
|
|
10
10
|
const formatDistanceToNow = (type, date, dictionary) => {
|
|
11
11
|
if (!(date instanceof Date)) {
|
|
12
|
-
return "No date";
|
|
12
|
+
return { time: "No date", value: "", unit: "" };
|
|
13
13
|
}
|
|
14
14
|
const now = /* @__PURE__ */ new Date();
|
|
15
15
|
const diff = now.getTime() - date.getTime();
|
|
@@ -19,6 +19,8 @@ const formatDistanceToNow = (type, date, dictionary) => {
|
|
|
19
19
|
const days = Math.floor(hours / 24);
|
|
20
20
|
const months = Math.floor(days / 30);
|
|
21
21
|
const years = Math.floor(months / 12);
|
|
22
|
+
let value;
|
|
23
|
+
let unit;
|
|
22
24
|
let timeElaped = "";
|
|
23
25
|
const unitYears = years > 1 ? dictionary.label_unit_time_years : dictionary.label_unit_time_year;
|
|
24
26
|
const unitMonths = months % 12 > 1 ? dictionary.label_unit_time_months : dictionary.label_unit_time_month;
|
|
@@ -32,6 +34,8 @@ const formatDistanceToNow = (type, date, dictionary) => {
|
|
|
32
34
|
} else if (type === "future") {
|
|
33
35
|
label = dictionary.label_sentence_future_others;
|
|
34
36
|
}
|
|
37
|
+
const separatorTime = ":";
|
|
38
|
+
const separatorDate = "-";
|
|
35
39
|
if (seconds < 60) {
|
|
36
40
|
if (type === "past") {
|
|
37
41
|
timeElaped = replaceValues(dictionary.label_sentence_past_seconds, seconds + "", unitSeconds);
|
|
@@ -48,34 +52,46 @@ const formatDistanceToNow = (type, date, dictionary) => {
|
|
|
48
52
|
unitSeconds
|
|
49
53
|
);
|
|
50
54
|
}
|
|
55
|
+
value = seconds.toString().padStart(2, "0") + "";
|
|
56
|
+
unit = dictionary.label_unit_time_seconds_short;
|
|
51
57
|
} else if (minutes < 60) {
|
|
52
58
|
timeElaped = replaceValues(label, `${minutes}`, unitMinutes);
|
|
59
|
+
value = minutes.toString().padStart(2, "0") + ":" + (seconds % 60).toString().padStart(2, "0");
|
|
60
|
+
unit = dictionary.label_unit_time_minutes_short + dictionary.label_separator_time + dictionary.label_unit_time_seconds_short;
|
|
53
61
|
} else if (hours < 24) {
|
|
54
62
|
if (minutes % 60 > 0) {
|
|
55
63
|
timeElaped = replaceValues(label, `${hours} ${unitHours} ${minutes % 60} ${unitMinutes}`, "");
|
|
56
64
|
} else {
|
|
57
65
|
timeElaped = replaceValues(label, `${hours} ${unitHours}`, "");
|
|
58
66
|
}
|
|
67
|
+
value = hours.toString().padStart(2, "0") + ":" + (minutes % 60).toString().padStart(2, "0");
|
|
68
|
+
unit = dictionary.label_unit_time_hours_short + separatorTime + dictionary.label_unit_time_minutes_short;
|
|
59
69
|
} else if (days < 30) {
|
|
60
70
|
if (hours % 24 > 0) {
|
|
61
71
|
timeElaped = replaceValues(label, `${days} ${unitDays} ${hours % 24} ${unitHours}`, "");
|
|
62
72
|
} else {
|
|
63
73
|
timeElaped = replaceValues(label, `${days} ${unitDays}`, "");
|
|
64
74
|
}
|
|
75
|
+
value = days.toString().padStart(2, "0") + " " + (hours % 24).toString().padStart(2, "0");
|
|
76
|
+
unit = dictionary.label_unit_time_days_short + " " + dictionary.label_unit_time_hours_short;
|
|
65
77
|
} else if (months < 12) {
|
|
66
78
|
if (days % 30 > 0) {
|
|
67
79
|
timeElaped = replaceValues(label, `${months} ${unitMonths} ${days % 30} ${unitDays}`, "");
|
|
68
80
|
} else {
|
|
69
81
|
timeElaped = replaceValues(label, `${months} ${unitMonths}`, "");
|
|
70
82
|
}
|
|
83
|
+
value = months.toString().padStart(2, "0") + separatorDate + (days % 30).toString().padStart(2, "0");
|
|
84
|
+
unit = dictionary.label_unit_time_months_short + separatorDate + dictionary.label_unit_time_days_short;
|
|
71
85
|
} else {
|
|
72
86
|
if (months % 12 > 0) {
|
|
73
87
|
timeElaped = replaceValues(label, `${years} ${unitYears} ${months % 12} ${unitMonths}`, "");
|
|
74
88
|
} else {
|
|
75
89
|
timeElaped = replaceValues(label, `${years} ${unitYears}`, "");
|
|
76
90
|
}
|
|
91
|
+
value = years.toString().padStart(2, "0") + separatorDate + (months % 12).toString().padStart(2, "0");
|
|
92
|
+
unit = dictionary.label_unit_time_years_short + separatorDate + dictionary.label_unit_time_months_short;
|
|
77
93
|
}
|
|
78
|
-
return timeElaped;
|
|
94
|
+
return { time: timeElaped, value, unit };
|
|
79
95
|
};
|
|
80
96
|
export {
|
|
81
97
|
formatDistanceToNow as f
|
|
@@ -13,9 +13,22 @@ export type FormatDistanteToNowDictionary = {
|
|
|
13
13
|
label_unit_time_month: string;
|
|
14
14
|
label_unit_time_year: string;
|
|
15
15
|
label_unit_time_seconds: string;
|
|
16
|
+
label_unit_time_seconds_short: string;
|
|
16
17
|
label_unit_time_minutes: string;
|
|
18
|
+
label_unit_time_minutes_short: string;
|
|
17
19
|
label_unit_time_hours: string;
|
|
20
|
+
label_unit_time_hours_short: string;
|
|
18
21
|
label_unit_time_days: string;
|
|
22
|
+
label_unit_time_days_short: string;
|
|
19
23
|
label_unit_time_months: string;
|
|
24
|
+
label_unit_time_months_short: string;
|
|
20
25
|
label_unit_time_years: string;
|
|
26
|
+
label_unit_time_years_short: string;
|
|
27
|
+
label_separator_time: string;
|
|
28
|
+
label_separator_date: string;
|
|
29
|
+
};
|
|
30
|
+
export type FormatDistanceToNowReturn = {
|
|
31
|
+
time: string;
|
|
32
|
+
value: string;
|
|
33
|
+
unit: string;
|
|
21
34
|
};
|
package/utils/index.d.ts
CHANGED