@movalib/movalib-commons 1.1.18 → 1.1.19
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/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/src/MovaSignUp.js +8 -1
- package/dist/src/helpers/DateUtils.d.ts +0 -1
- package/dist/src/helpers/DateUtils.js +4 -12
- package/dist/src/helpers/Tools.d.ts +1 -0
- package/dist/src/helpers/Tools.js +10 -1
- package/index.ts +3 -2
- package/package.json +1 -1
- package/src/MovaSignUp.tsx +15 -4
- package/src/helpers/DateUtils.ts +2 -12
- package/src/helpers/Tools.ts +11 -0
package/dist/index.d.ts
CHANGED
|
@@ -37,7 +37,7 @@ export type { APIRequest, APIResponse } from './src/helpers/ApiHelper';
|
|
|
37
37
|
export type { DaySchedule, DayInterval } from './src/ScheduleFields';
|
|
38
38
|
export type { MovaFormField, MovaLoginForm, MovaUserSignUpForm, MovaInterval, MovaVehicleForm, AddressFieldName } from './src/helpers/Types';
|
|
39
39
|
export { readCookie, deleteCookie } from './src/helpers/CookieUtils';
|
|
40
|
-
export { validateField, formatVehicleTire, formatFrenchVehiclePlate, isEmpty, getApplicationShortLabel } from './src/helpers/Tools';
|
|
40
|
+
export { validateField, formatVehicleTire, formatFrenchVehiclePlate, isEmpty, getApplicationShortLabel, capitalizeFirstLetter } from './src/helpers/Tools';
|
|
41
41
|
export { validatePhoneNumber, validateText, validateEmail } from './src/helpers/Validator';
|
|
42
|
-
export { formatDateByCountryCode, getLongFormattedDateTime
|
|
42
|
+
export { formatDateByCountryCode, getLongFormattedDateTime } from './src/helpers/DateUtils';
|
|
43
43
|
export { RoleType, MovaAppType, DayOfWeek, EventState, EventType, DocumentType, DigitalPassportIndex, DocumentState, Gender, DateFormatTypes, PartsApplicationType, ProductType, OrderPreference, OrderState, SlotAlgorithm, VehiclePlateFormat as VehiclePlateType } from './src/helpers/Enums';
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
5
|
};
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.MovaAppType = exports.RoleType = exports.
|
|
7
|
+
exports.MovaAppType = exports.RoleType = exports.getLongFormattedDateTime = exports.formatDateByCountryCode = exports.validateEmail = exports.validateText = exports.validatePhoneNumber = exports.capitalizeFirstLetter = exports.getApplicationShortLabel = exports.isEmpty = exports.formatFrenchVehiclePlate = exports.formatVehicleTire = exports.validateField = exports.deleteCookie = exports.readCookie = exports.VehicleTire = exports.Event = exports.Schedule = exports.Garage = exports.Document = exports.Vehicle = exports.Address = exports.Role = exports.User = exports.Customer = exports.Logger = exports.Operation = exports.Prestation = exports.Product = exports.Supplier = exports.GenderSelector = exports.ConfirmationDialog = exports.MovaVehicleTireField = exports.MovaCopyright = exports.MovaSignUp = exports.MovaLogin = exports.MovaSnackbar = exports.TestButton = exports.VehiclePlateField = exports.QRCode = exports.MovaDialog = exports.Loader = exports.MovaDigitalPassport = exports.VehicleFullCard = exports.ScheduleFields = exports.AddressFields = exports.AccountValidation = exports.UserService = exports.GarageService = exports.AuthenticationService = void 0;
|
|
8
8
|
exports.VehiclePlateType = exports.SlotAlgorithm = exports.OrderState = exports.OrderPreference = exports.ProductType = exports.PartsApplicationType = exports.DateFormatTypes = exports.Gender = exports.DocumentState = exports.DigitalPassportIndex = exports.DocumentType = exports.EventType = exports.EventState = exports.DayOfWeek = void 0;
|
|
9
9
|
// Export des services
|
|
10
10
|
var AuthenticationService_1 = require("./src/services/AuthenticationService");
|
|
@@ -89,6 +89,7 @@ Object.defineProperty(exports, "formatVehicleTire", { enumerable: true, get: fun
|
|
|
89
89
|
Object.defineProperty(exports, "formatFrenchVehiclePlate", { enumerable: true, get: function () { return Tools_1.formatFrenchVehiclePlate; } });
|
|
90
90
|
Object.defineProperty(exports, "isEmpty", { enumerable: true, get: function () { return Tools_1.isEmpty; } });
|
|
91
91
|
Object.defineProperty(exports, "getApplicationShortLabel", { enumerable: true, get: function () { return Tools_1.getApplicationShortLabel; } });
|
|
92
|
+
Object.defineProperty(exports, "capitalizeFirstLetter", { enumerable: true, get: function () { return Tools_1.capitalizeFirstLetter; } });
|
|
92
93
|
var Validator_1 = require("./src/helpers/Validator");
|
|
93
94
|
Object.defineProperty(exports, "validatePhoneNumber", { enumerable: true, get: function () { return Validator_1.validatePhoneNumber; } });
|
|
94
95
|
Object.defineProperty(exports, "validateText", { enumerable: true, get: function () { return Validator_1.validateText; } });
|
|
@@ -96,7 +97,6 @@ Object.defineProperty(exports, "validateEmail", { enumerable: true, get: functio
|
|
|
96
97
|
var DateUtils_1 = require("./src/helpers/DateUtils");
|
|
97
98
|
Object.defineProperty(exports, "formatDateByCountryCode", { enumerable: true, get: function () { return DateUtils_1.formatDateByCountryCode; } });
|
|
98
99
|
Object.defineProperty(exports, "getLongFormattedDateTime", { enumerable: true, get: function () { return DateUtils_1.getLongFormattedDateTime; } });
|
|
99
|
-
Object.defineProperty(exports, "capitalizeFirstLetter", { enumerable: true, get: function () { return DateUtils_1.capitalizeFirstLetter; } });
|
|
100
100
|
// Export des enums
|
|
101
101
|
var Enums_1 = require("./src/helpers/Enums");
|
|
102
102
|
Object.defineProperty(exports, "RoleType", { enumerable: true, get: function () { return Enums_1.RoleType; } });
|
package/dist/src/MovaSignUp.js
CHANGED
|
@@ -99,7 +99,6 @@ var MovaLogin = function (_a) {
|
|
|
99
99
|
var _e = (0, react_1.useState)(false), showPassword = _e[0], setShowPassword = _e[1];
|
|
100
100
|
var handleDateChange = function (name, date) {
|
|
101
101
|
var _a;
|
|
102
|
-
console.log(date);
|
|
103
102
|
if (name && date) {
|
|
104
103
|
var fieldName = name;
|
|
105
104
|
var fieldValue = date;
|
|
@@ -112,6 +111,14 @@ var MovaLogin = function (_a) {
|
|
|
112
111
|
if (e) {
|
|
113
112
|
var fieldName = e.target.name;
|
|
114
113
|
var fieldValue = e.target.value;
|
|
114
|
+
// Capitalisation automatique du prénom
|
|
115
|
+
if (fieldName == "firstname") {
|
|
116
|
+
fieldValue = (0, Tools_1.capitalizeFirstLetter)(fieldValue);
|
|
117
|
+
}
|
|
118
|
+
// Uppercase automatique pour le nom
|
|
119
|
+
if (fieldName == "lastname") {
|
|
120
|
+
fieldValue = fieldValue.toUpperCase();
|
|
121
|
+
}
|
|
115
122
|
var newField = (_a = {}, _a[fieldName] = { value: fieldValue, isValid: true }, _a);
|
|
116
123
|
setUserForm(__assign(__assign({}, userForm), newField));
|
|
117
124
|
}
|
|
@@ -5,4 +5,3 @@ export declare const countryTimeZones: {
|
|
|
5
5
|
export declare const toUTCToLocaleDate: (date: "" | Date | null, countryCode: string) => Date;
|
|
6
6
|
export declare const formatDateByCountryCode: (date: Date | undefined, countryCode: string, formatType: DateFormatTypes) => string;
|
|
7
7
|
export declare function getLongFormattedDateTime(date: Date | undefined, timeZone: string, locale: Locale): string;
|
|
8
|
-
export declare function capitalizeFirstLetter(str: string): string;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getLongFormattedDateTime = exports.formatDateByCountryCode = exports.toUTCToLocaleDate = exports.countryTimeZones = void 0;
|
|
4
4
|
var date_fns_tz_1 = require("date-fns-tz");
|
|
5
5
|
var locale_1 = require("date-fns/locale");
|
|
6
6
|
var Enums_1 = require("./Enums");
|
|
7
|
+
var Tools_1 = require("./Tools");
|
|
7
8
|
// Tableau de correspondance entre les codes de pays et les fuseaux horaires
|
|
8
9
|
exports.countryTimeZones = {
|
|
9
10
|
'FR': 'Europe/Paris',
|
|
@@ -42,8 +43,8 @@ var formatDateByCountryCode = function (date, countryCode, formatType) {
|
|
|
42
43
|
exports.formatDateByCountryCode = formatDateByCountryCode;
|
|
43
44
|
function getLongFormattedDateTime(date, timeZone, locale) {
|
|
44
45
|
if (date) {
|
|
45
|
-
var day = capitalizeFirstLetter((0, date_fns_tz_1.format)(date, 'eeee', { timeZone: timeZone, locale: locale }));
|
|
46
|
-
var month = capitalizeFirstLetter((0, date_fns_tz_1.format)(date, 'MMMM', { timeZone: timeZone, locale: locale }));
|
|
46
|
+
var day = (0, Tools_1.capitalizeFirstLetter)((0, date_fns_tz_1.format)(date, 'eeee', { timeZone: timeZone, locale: locale }));
|
|
47
|
+
var month = (0, Tools_1.capitalizeFirstLetter)((0, date_fns_tz_1.format)(date, 'MMMM', { timeZone: timeZone, locale: locale }));
|
|
47
48
|
var hours = (0, date_fns_tz_1.format)(date, 'HH', { timeZone: timeZone, locale: locale });
|
|
48
49
|
var minutes = (0, date_fns_tz_1.format)(date, 'mm', { timeZone: timeZone, locale: locale });
|
|
49
50
|
var dayOfMonth = (0, date_fns_tz_1.format)(date, 'dd', { timeZone: timeZone, locale: locale });
|
|
@@ -52,12 +53,3 @@ function getLongFormattedDateTime(date, timeZone, locale) {
|
|
|
52
53
|
return '';
|
|
53
54
|
}
|
|
54
55
|
exports.getLongFormattedDateTime = getLongFormattedDateTime;
|
|
55
|
-
function capitalizeFirstLetter(str) {
|
|
56
|
-
if (str.length === 0) {
|
|
57
|
-
return str;
|
|
58
|
-
}
|
|
59
|
-
var firstChar = str.charAt(0).toUpperCase();
|
|
60
|
-
var restOfString = str.slice(1);
|
|
61
|
-
return firstChar + restOfString;
|
|
62
|
-
}
|
|
63
|
-
exports.capitalizeFirstLetter = capitalizeFirstLetter;
|
|
@@ -2,6 +2,7 @@ import VehicleTire from "../models/VehicleTire";
|
|
|
2
2
|
import { MovaFormField } from "./Types";
|
|
3
3
|
import { CSSProperties } from "react";
|
|
4
4
|
import { PartsApplicationType } from "./Enums";
|
|
5
|
+
export declare const capitalizeFirstLetter: (str: string) => string;
|
|
5
6
|
export declare const getApplicationShortLabel: (application: PartsApplicationType | undefined) => "" | "AV" | "AR" | "AV + AR" | "G" | "D" | "G + D";
|
|
6
7
|
export declare const flexEnd: CSSProperties;
|
|
7
8
|
export declare const flexCenter: CSSProperties;
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateField = exports.formatVehicleTireStr = exports.formatVehicleTire = exports.formatFrenchVehiclePlate = exports.isEmpty = exports.flexCenter = exports.flexEnd = exports.getApplicationShortLabel = void 0;
|
|
3
|
+
exports.validateField = exports.formatVehicleTireStr = exports.formatVehicleTire = exports.formatFrenchVehiclePlate = exports.isEmpty = exports.flexCenter = exports.flexEnd = exports.getApplicationShortLabel = exports.capitalizeFirstLetter = void 0;
|
|
4
4
|
var Enums_1 = require("./Enums");
|
|
5
|
+
var capitalizeFirstLetter = function (str) {
|
|
6
|
+
if (str.length === 0) {
|
|
7
|
+
return str;
|
|
8
|
+
}
|
|
9
|
+
var firstChar = str.charAt(0).toUpperCase();
|
|
10
|
+
var restOfString = str.slice(1);
|
|
11
|
+
return firstChar + restOfString;
|
|
12
|
+
};
|
|
13
|
+
exports.capitalizeFirstLetter = capitalizeFirstLetter;
|
|
5
14
|
var getApplicationShortLabel = function (application) {
|
|
6
15
|
if (application) {
|
|
7
16
|
switch (application) {
|
package/index.ts
CHANGED
|
@@ -49,9 +49,10 @@ export type { MovaFormField, MovaLoginForm, MovaUserSignUpForm, MovaInterval,
|
|
|
49
49
|
|
|
50
50
|
// Export des méthodes utilitaires
|
|
51
51
|
export { readCookie, deleteCookie } from './src/helpers/CookieUtils';
|
|
52
|
-
export { validateField, formatVehicleTire, formatFrenchVehiclePlate, isEmpty, getApplicationShortLabel
|
|
52
|
+
export { validateField, formatVehicleTire, formatFrenchVehiclePlate, isEmpty, getApplicationShortLabel,
|
|
53
|
+
capitalizeFirstLetter } from './src/helpers/Tools';
|
|
53
54
|
export { validatePhoneNumber, validateText, validateEmail } from './src/helpers/Validator';
|
|
54
|
-
export { formatDateByCountryCode, getLongFormattedDateTime
|
|
55
|
+
export { formatDateByCountryCode, getLongFormattedDateTime } from './src/helpers/DateUtils';
|
|
55
56
|
|
|
56
57
|
// Export des enums
|
|
57
58
|
export { RoleType, MovaAppType, DayOfWeek, EventState, EventType, DocumentType,
|
package/package.json
CHANGED
package/src/MovaSignUp.tsx
CHANGED
|
@@ -14,7 +14,7 @@ import { MovaFormField, MovaUserSignUpForm } from "./helpers/Types";
|
|
|
14
14
|
import { MovaAppType } from "./helpers/Enums";
|
|
15
15
|
import { validateEmail } from "./helpers/Validator";
|
|
16
16
|
import GenderSelector from "./GenderSelector";
|
|
17
|
-
import { validateField } from "./helpers/Tools";
|
|
17
|
+
import { capitalizeFirstLetter, validateField } from "./helpers/Tools";
|
|
18
18
|
import { useHistory } from "react-router-dom";
|
|
19
19
|
import InputAdornment from '@mui/material/InputAdornment';
|
|
20
20
|
import Visibility from '@mui/icons-material/Visibility';
|
|
@@ -68,7 +68,7 @@ const MovaLogin: FunctionComponent<MovaSignUpProps> = ({ loading, movaAppType, o
|
|
|
68
68
|
const [showPassword, setShowPassword] = useState(false);
|
|
69
69
|
|
|
70
70
|
const handleDateChange = (name: string, date: Date | null) => {
|
|
71
|
-
|
|
71
|
+
|
|
72
72
|
if(name && date){
|
|
73
73
|
const fieldName: string = name;
|
|
74
74
|
const fieldValue: Date = date;
|
|
@@ -81,9 +81,20 @@ const MovaLogin: FunctionComponent<MovaSignUpProps> = ({ loading, movaAppType, o
|
|
|
81
81
|
const handleInputChange = (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement> | null): void => {
|
|
82
82
|
if(e){
|
|
83
83
|
const fieldName: string = e.target.name;
|
|
84
|
-
|
|
84
|
+
let fieldValue: string = e.target.value;
|
|
85
|
+
|
|
86
|
+
// Capitalisation automatique du prénom
|
|
87
|
+
if (fieldName == "firstname"){
|
|
88
|
+
fieldValue = capitalizeFirstLetter(fieldValue);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Uppercase automatique pour le nom
|
|
92
|
+
if (fieldName == "lastname"){
|
|
93
|
+
fieldValue = fieldValue.toUpperCase();
|
|
94
|
+
}
|
|
95
|
+
|
|
85
96
|
const newField: MovaFormField = { [fieldName]: { value: fieldValue, isValid: true } };
|
|
86
|
-
|
|
97
|
+
|
|
87
98
|
setUserForm({ ...userForm, ...newField});
|
|
88
99
|
}
|
|
89
100
|
}
|
package/src/helpers/DateUtils.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { format, utcToZonedTime } from 'date-fns-tz';
|
|
2
2
|
import { fr } from 'date-fns/locale';
|
|
3
3
|
import { DateFormatTypes } from './Enums';
|
|
4
|
+
import { capitalizeFirstLetter } from './Tools';
|
|
4
5
|
|
|
5
6
|
// Tableau de correspondance entre les codes de pays et les fuseaux horaires
|
|
6
7
|
export const countryTimeZones: { [key: string]: string } = {
|
|
@@ -62,15 +63,4 @@ export function getLongFormattedDateTime(date: Date | undefined, timeZone: strin
|
|
|
62
63
|
return `${day} ${dayOfMonth} ${month} à ${hours}:${minutes}`;
|
|
63
64
|
}
|
|
64
65
|
return '';
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export function capitalizeFirstLetter(str: string): string {
|
|
68
|
-
if (str.length === 0) {
|
|
69
|
-
return str;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const firstChar = str.charAt(0).toUpperCase();
|
|
73
|
-
const restOfString = str.slice(1);
|
|
74
|
-
|
|
75
|
-
return firstChar + restOfString;
|
|
76
|
-
}
|
|
66
|
+
}
|
package/src/helpers/Tools.ts
CHANGED
|
@@ -4,6 +4,17 @@ import { MovaFormField } from "./Types";
|
|
|
4
4
|
import { CSSProperties } from "react";
|
|
5
5
|
import { PartsApplicationType, VehiclePlateFormat } from "./Enums";
|
|
6
6
|
|
|
7
|
+
export const capitalizeFirstLetter = (str: string): string => {
|
|
8
|
+
if (str.length === 0) {
|
|
9
|
+
return str;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const firstChar = str.charAt(0).toUpperCase();
|
|
13
|
+
const restOfString = str.slice(1);
|
|
14
|
+
|
|
15
|
+
return firstChar + restOfString;
|
|
16
|
+
}
|
|
17
|
+
|
|
7
18
|
export const getApplicationShortLabel = (application:PartsApplicationType | undefined) => {
|
|
8
19
|
if(application){
|
|
9
20
|
switch(application){
|