@movalib/movalib-commons 1.0.56 → 1.0.58
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 -1
- package/dist/index.js +3 -1
- package/dist/src/Loader.d.ts +7 -0
- package/dist/src/Loader.js +27 -0
- package/dist/src/MovaDialog.d.ts +1 -0
- package/dist/src/MovaDialog.js +10 -4
- package/dist/src/helpers/Types.d.ts +4 -0
- package/dist/src/models/Event.d.ts +3 -2
- package/dist/src/models/Event.js +1 -1
- package/index.ts +2 -1
- package/package.json +1 -1
- package/src/Loader.tsx +38 -0
- package/src/MovaDialog.tsx +12 -3
- package/src/helpers/Types.ts +4 -0
- package/src/models/Event.ts +4 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { default as Loader } from './src/Loader';
|
|
1
2
|
export { default as MovaDialog } from './src/MovaDialog';
|
|
2
3
|
export { default as QRCode } from './src/QRCode';
|
|
3
4
|
export { default as VehiclePlateField } from './src/VehiclePlateField';
|
|
@@ -18,7 +19,7 @@ export { default as Garage } from './src/models/Garage';
|
|
|
18
19
|
export { default as Schedule } from './src/models/Schedule';
|
|
19
20
|
export { default as Event } from './src/models/Event';
|
|
20
21
|
export { default as VehicleTire } from './src/models/VehicleTire';
|
|
21
|
-
export type { MovaFormField, MovaLoginForm, MovaUserSignUpForm, MovaInterval } from './src/helpers/Types';
|
|
22
|
+
export type { MovaFormField, MovaLoginForm, MovaUserSignUpForm, MovaInterval, OriginReference } from './src/helpers/Types';
|
|
22
23
|
export { validateField } from './src/helpers/Tools';
|
|
23
24
|
export { validatePhoneNumber, validateText, validateEmail } from './src/helpers/Validator';
|
|
24
25
|
export { RoleType, MovaAppType, DayOfWeek, EventState, EventType, DocumentType, DigitalPassportIndex, DocumentState, Gender } from './src/helpers/Enums';
|
package/dist/index.js
CHANGED
|
@@ -4,8 +4,10 @@ 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.Gender = exports.DocumentState = exports.DigitalPassportIndex = exports.DocumentType = exports.EventType = exports.EventState = exports.DayOfWeek = exports.MovaAppType = exports.RoleType = exports.validateEmail = exports.validateText = exports.validatePhoneNumber = exports.validateField = exports.VehicleTire = exports.Event = exports.Schedule = exports.Garage = exports.Document = exports.Vehicle = exports.Address = exports.Role = exports.User = exports.GenderSelector = exports.ConfirmationDialog = exports.MovaVehicleTireField = exports.MovaCopyright = exports.MovaSignUp = exports.MovaLogin = exports.MovaSnackbar = exports.TestButton = exports.VehiclePlateField = exports.QRCode = exports.MovaDialog = void 0;
|
|
7
|
+
exports.Gender = exports.DocumentState = exports.DigitalPassportIndex = exports.DocumentType = exports.EventType = exports.EventState = exports.DayOfWeek = exports.MovaAppType = exports.RoleType = exports.validateEmail = exports.validateText = exports.validatePhoneNumber = exports.validateField = exports.VehicleTire = exports.Event = exports.Schedule = exports.Garage = exports.Document = exports.Vehicle = exports.Address = exports.Role = exports.User = exports.GenderSelector = exports.ConfirmationDialog = exports.MovaVehicleTireField = exports.MovaCopyright = exports.MovaSignUp = exports.MovaLogin = exports.MovaSnackbar = exports.TestButton = exports.VehiclePlateField = exports.QRCode = exports.MovaDialog = exports.Loader = void 0;
|
|
8
8
|
// Export des composants
|
|
9
|
+
var Loader_1 = require("./src/Loader");
|
|
10
|
+
Object.defineProperty(exports, "Loader", { enumerable: true, get: function () { return __importDefault(Loader_1).default; } });
|
|
9
11
|
var MovaDialog_1 = require("./src/MovaDialog");
|
|
10
12
|
Object.defineProperty(exports, "MovaDialog", { enumerable: true, get: function () { return __importDefault(MovaDialog_1).default; } });
|
|
11
13
|
var QRCode_1 = require("./src/QRCode");
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
15
|
+
var material_1 = require("@mui/material");
|
|
16
|
+
var Loader = function (_a) {
|
|
17
|
+
var loading = _a.loading, _b = _a.padding, padding = _b === void 0 ? 3 : _b;
|
|
18
|
+
var theme = (0, material_1.useTheme)();
|
|
19
|
+
var containerStyle = {
|
|
20
|
+
width: '100%',
|
|
21
|
+
textAlign: 'center',
|
|
22
|
+
paddingTop: theme.spacing(padding),
|
|
23
|
+
paddingBottom: theme.spacing(padding)
|
|
24
|
+
};
|
|
25
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: loading && (0, jsx_runtime_1.jsx)(material_1.Backdrop, __assign({ sx: { color: '#fff', zIndex: function (theme) { return theme.zIndex.drawer + 1; } }, open: loading }, { children: (0, jsx_runtime_1.jsx)(material_1.CircularProgress, { color: "inherit" }) })) }));
|
|
26
|
+
};
|
|
27
|
+
exports.default = Loader;
|
package/dist/src/MovaDialog.d.ts
CHANGED
package/dist/src/MovaDialog.js
CHANGED
|
@@ -22,7 +22,7 @@ var leaf_green_large_png_1 = __importDefault(require("./assets/images/leaf_green
|
|
|
22
22
|
var leaf_yellow_large_png_1 = __importDefault(require("./assets/images/leaf_yellow_large.png"));
|
|
23
23
|
var leaf_pink_large_png_1 = __importDefault(require("./assets/images/leaf_pink_large.png"));
|
|
24
24
|
var MovaDialog = function (_a) {
|
|
25
|
-
var fullScreen = _a.fullScreen, open = _a.open, onClose = _a.onClose, children = _a.children, title = _a.title, titleStyle = _a.titleStyle, message = _a.message, leafImageColor = _a.leafImageColor, transition = _a.transition, actions = _a.actions;
|
|
25
|
+
var fullScreen = _a.fullScreen, open = _a.open, onClose = _a.onClose, _b = _a.closable, closable = _b === void 0 ? false : _b, children = _a.children, title = _a.title, titleStyle = _a.titleStyle, message = _a.message, leafImageColor = _a.leafImageColor, transition = _a.transition, actions = _a.actions;
|
|
26
26
|
var getTransition = function () {
|
|
27
27
|
switch (transition) {
|
|
28
28
|
case "fade":
|
|
@@ -41,11 +41,17 @@ var MovaDialog = function (_a) {
|
|
|
41
41
|
var LeafImageComponent = getLeafImage();
|
|
42
42
|
var purgeLocalState = function () {
|
|
43
43
|
};
|
|
44
|
-
var
|
|
44
|
+
var handleOnBack = function () {
|
|
45
45
|
purgeLocalState();
|
|
46
46
|
onClose();
|
|
47
47
|
};
|
|
48
|
-
|
|
48
|
+
var handleOnClose = function () {
|
|
49
|
+
if (closable) {
|
|
50
|
+
purgeLocalState();
|
|
51
|
+
onClose();
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Dialog, __assign({ fullScreen: fullScreen, fullWidth: true, TransitionComponent: getTransition(), open: open, "aria-labelledby": "garage-dialog-title", "aria-describedby": "garage-dialog-description", onClose: handleOnClose, sx: { textAlign: 'center' } }, { children: [(0, jsx_runtime_1.jsx)("img", { src: getLeafImage(), style: {
|
|
49
55
|
position: 'fixed',
|
|
50
56
|
float: 'left',
|
|
51
57
|
width: '150px',
|
|
@@ -54,6 +60,6 @@ var MovaDialog = function (_a) {
|
|
|
54
60
|
zIndex: 0,
|
|
55
61
|
left: 0,
|
|
56
62
|
opacity: '0.2'
|
|
57
|
-
}, alt: 'Feuille Rose Movalib' }), (0, jsx_runtime_1.jsx)(material_1.DialogTitle, __assign({ id: "garage-dialog-title", sx: { textAlign: 'center', p: 0, pt: 1, mt: 0, mb: 0, zIndex: 10 } }, { children: (0, jsx_runtime_1.jsx)(material_1.AppBar, __assign({ sx: { position: 'relative' }, color: "transparent", elevation: 0 }, { children: (0, jsx_runtime_1.jsxs)(material_1.Toolbar, { children: [(0, jsx_runtime_1.jsx)(material_1.IconButton, __assign({ edge: "start", color: "inherit", onClick:
|
|
63
|
+
}, alt: 'Feuille Rose Movalib' }), (0, jsx_runtime_1.jsx)(material_1.DialogTitle, __assign({ id: "garage-dialog-title", sx: { textAlign: 'center', p: 0, pt: 1, mt: 0, mb: 0, zIndex: 10 } }, { children: (0, jsx_runtime_1.jsx)(material_1.AppBar, __assign({ sx: { position: 'relative' }, color: "transparent", elevation: 0 }, { children: (0, jsx_runtime_1.jsxs)(material_1.Toolbar, { children: [(0, jsx_runtime_1.jsx)(material_1.IconButton, __assign({ edge: "start", color: "inherit", onClick: handleOnBack, "aria-label": "close" }, { children: (0, jsx_runtime_1.jsx)(ArrowBackIosNewRounded_1.default, {}) })), title && (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ sx: { textAlign: 'center', fontSize: 20, flexGrow: 1, pl: '20px', pr: '40px' }, style: titleStyle }, { children: title }))] }) })) })), (0, jsx_runtime_1.jsxs)(material_1.DialogContent, __assign({ sx: { zIndex: 20 } }, { children: [children, message && (0, jsx_runtime_1.jsx)(material_1.Alert, __assign({ severity: "error", sx: { mb: 2 } }, { children: message }))] })), (0, jsx_runtime_1.jsx)(material_1.DialogActions, __assign({ sx: { justifyContent: 'center' } }, { children: actions }))] })));
|
|
58
64
|
};
|
|
59
65
|
exports.default = MovaDialog;
|
|
@@ -3,6 +3,7 @@ import { EventState, EventType } from "../helpers/Enums";
|
|
|
3
3
|
import Prestation from "./Prestation";
|
|
4
4
|
import Customer from "./Customer";
|
|
5
5
|
import Vehicle from "./Vehicle";
|
|
6
|
+
import { OriginReference } from "../helpers/Types";
|
|
6
7
|
export default class Event {
|
|
7
8
|
id: string;
|
|
8
9
|
ownerId: number;
|
|
@@ -34,7 +35,7 @@ export default class Event {
|
|
|
34
35
|
/**
|
|
35
36
|
* MVP : pour l'instant les références sont transmises sous cette forme classique
|
|
36
37
|
*/
|
|
37
|
-
originReferences?: [
|
|
38
|
+
originReferences?: OriginReference[];
|
|
38
39
|
constructor({ id, notes, ownerId, type, title, garageName, garageId, state, startDate, endDate, prestations, guestsId, vehicleId, quoteId, originReferences }: {
|
|
39
40
|
id: string;
|
|
40
41
|
notes?: string;
|
|
@@ -50,7 +51,7 @@ export default class Event {
|
|
|
50
51
|
guestsId?: string[];
|
|
51
52
|
vehicleId?: number;
|
|
52
53
|
quoteId?: number;
|
|
53
|
-
originReferences?: [
|
|
54
|
+
originReferences?: OriginReference[];
|
|
54
55
|
});
|
|
55
56
|
static getOriginReferences(event: Event): string | undefined;
|
|
56
57
|
static getServicesList(event: Event): string[];
|
package/dist/src/models/Event.js
CHANGED
|
@@ -24,7 +24,7 @@ var Event = /** @class */ (function () {
|
|
|
24
24
|
var list = '';
|
|
25
25
|
if (event.originReferences && event.originReferences.length !== 0) {
|
|
26
26
|
(_a = event.originReferences) === null || _a === void 0 ? void 0 : _a.forEach(function (reference) {
|
|
27
|
-
list = "".concat(reference
|
|
27
|
+
list = "".concat(reference.key, " : ").concat(reference.value);
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
30
|
return list;
|
package/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
2
|
|
|
3
3
|
// Export des composants
|
|
4
|
+
export { default as Loader } from './src/Loader';
|
|
4
5
|
export { default as MovaDialog } from './src/MovaDialog';
|
|
5
6
|
export { default as QRCode } from './src/QRCode';
|
|
6
7
|
export { default as VehiclePlateField } from './src/VehiclePlateField';
|
|
@@ -25,7 +26,7 @@ export { default as Event } from './src/models/Event';
|
|
|
25
26
|
export { default as VehicleTire } from './src/models/VehicleTire';
|
|
26
27
|
|
|
27
28
|
// Export des types
|
|
28
|
-
export type { MovaFormField, MovaLoginForm, MovaUserSignUpForm, MovaInterval } from './src/helpers/Types';
|
|
29
|
+
export type { MovaFormField, MovaLoginForm, MovaUserSignUpForm, MovaInterval, OriginReference } from './src/helpers/Types';
|
|
29
30
|
|
|
30
31
|
// Export des méthodes utilitaires
|
|
31
32
|
export { validateField } from './src/helpers/Tools';
|
package/package.json
CHANGED
package/src/Loader.tsx
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Backdrop, CircularProgress, useTheme } from "@mui/material";
|
|
2
|
+
import { CSSProperties, FunctionComponent } from "react";
|
|
3
|
+
|
|
4
|
+
interface LoaderProps {
|
|
5
|
+
loading:boolean,
|
|
6
|
+
padding?: number
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const Loader: FunctionComponent<LoaderProps> = ({ loading, padding = 3 }) => {
|
|
10
|
+
|
|
11
|
+
const theme = useTheme();
|
|
12
|
+
|
|
13
|
+
const containerStyle: CSSProperties = {
|
|
14
|
+
width:'100%',
|
|
15
|
+
textAlign: 'center',
|
|
16
|
+
paddingTop: theme.spacing(padding),
|
|
17
|
+
paddingBottom: theme.spacing(padding)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<>
|
|
22
|
+
{loading && <Backdrop
|
|
23
|
+
sx={{ color: '#fff', zIndex: (theme) => theme.zIndex.drawer + 1 }}
|
|
24
|
+
open={loading}
|
|
25
|
+
>
|
|
26
|
+
<CircularProgress color="inherit" />
|
|
27
|
+
</Backdrop>
|
|
28
|
+
}
|
|
29
|
+
{/* {loading &&
|
|
30
|
+
<div style={containerStyle}>
|
|
31
|
+
<CircularProgress />
|
|
32
|
+
</div>
|
|
33
|
+
} */}
|
|
34
|
+
</>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export default Loader;
|
package/src/MovaDialog.tsx
CHANGED
|
@@ -12,6 +12,7 @@ interface MovaDialogProps {
|
|
|
12
12
|
fullScreen: boolean,
|
|
13
13
|
open: boolean,
|
|
14
14
|
onClose: () => void,
|
|
15
|
+
closable?: boolean,
|
|
15
16
|
actions?: React.ReactNode,
|
|
16
17
|
message?:string,
|
|
17
18
|
transition?: "fade",
|
|
@@ -20,7 +21,7 @@ interface MovaDialogProps {
|
|
|
20
21
|
titleStyle?: CSSProperties;
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
const MovaDialog: FC<MovaDialogProps> = ({fullScreen, open, onClose, children, title, titleStyle, message, leafImageColor, transition, actions}) => {
|
|
24
|
+
const MovaDialog: FC<MovaDialogProps> = ({fullScreen, open, onClose, closable = false, children, title, titleStyle, message, leafImageColor, transition, actions}) => {
|
|
24
25
|
|
|
25
26
|
const getTransition = () => {
|
|
26
27
|
switch(transition){
|
|
@@ -50,10 +51,17 @@ const MovaDialog: FC<MovaDialogProps> = ({fullScreen, open, onClose, children, t
|
|
|
50
51
|
|
|
51
52
|
}
|
|
52
53
|
|
|
53
|
-
const
|
|
54
|
+
const handleOnBack = () => {
|
|
54
55
|
purgeLocalState();
|
|
55
56
|
onClose();
|
|
56
57
|
}
|
|
58
|
+
|
|
59
|
+
const handleOnClose = () => {
|
|
60
|
+
if(closable){
|
|
61
|
+
purgeLocalState();
|
|
62
|
+
onClose();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
57
65
|
|
|
58
66
|
return (
|
|
59
67
|
<Dialog
|
|
@@ -63,6 +71,7 @@ const MovaDialog: FC<MovaDialogProps> = ({fullScreen, open, onClose, children, t
|
|
|
63
71
|
open={open}
|
|
64
72
|
aria-labelledby="garage-dialog-title"
|
|
65
73
|
aria-describedby="garage-dialog-description"
|
|
74
|
+
onClose={handleOnClose}
|
|
66
75
|
sx={{ textAlign:'center'}}
|
|
67
76
|
>
|
|
68
77
|
<img src={getLeafImage()} style={{
|
|
@@ -81,7 +90,7 @@ const MovaDialog: FC<MovaDialogProps> = ({fullScreen, open, onClose, children, t
|
|
|
81
90
|
<IconButton
|
|
82
91
|
edge="start"
|
|
83
92
|
color="inherit"
|
|
84
|
-
onClick={
|
|
93
|
+
onClick={handleOnBack}
|
|
85
94
|
aria-label="close"
|
|
86
95
|
>
|
|
87
96
|
<BackIcon />
|
package/src/helpers/Types.ts
CHANGED
package/src/models/Event.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { EventState, EventType } from "../helpers/Enums";
|
|
|
3
3
|
import Prestation from "./Prestation";
|
|
4
4
|
import Customer from "./Customer";
|
|
5
5
|
import Vehicle from "./Vehicle";
|
|
6
|
+
import { OriginReference } from "../helpers/Types";
|
|
6
7
|
|
|
7
8
|
export default class Event {
|
|
8
9
|
|
|
@@ -38,12 +39,12 @@ export default class Event {
|
|
|
38
39
|
/**
|
|
39
40
|
* MVP : pour l'instant les références sont transmises sous cette forme classique
|
|
40
41
|
*/
|
|
41
|
-
originReferences?: [
|
|
42
|
+
originReferences?: OriginReference[];
|
|
42
43
|
|
|
43
44
|
constructor({ id, notes, ownerId, type, title, garageName, garageId, state, startDate, endDate, prestations, guestsId, vehicleId, quoteId, originReferences }
|
|
44
45
|
: { id: string; notes?: string; ownerId: number; type : EventType; title: string; garageName: string; garageId: number;
|
|
45
46
|
state: EventState; startDate?: Date; endDate?: Date, prestations?: Prestation[],
|
|
46
|
-
guestsId?: string[], vehicleId?: number, quoteId?: number, originReferences?: [
|
|
47
|
+
guestsId?: string[], vehicleId?: number, quoteId?: number, originReferences?: OriginReference[]})
|
|
47
48
|
{
|
|
48
49
|
this.id = id;
|
|
49
50
|
this.notes = notes;
|
|
@@ -67,7 +68,7 @@ export default class Event {
|
|
|
67
68
|
|
|
68
69
|
if(event.originReferences && event.originReferences.length !== 0){
|
|
69
70
|
event.originReferences?.forEach(reference => {
|
|
70
|
-
list = `${reference
|
|
71
|
+
list = `${reference.key} : ${reference.value}`;
|
|
71
72
|
})
|
|
72
73
|
}
|
|
73
74
|
return list;
|