@colisweb/rescript-toolkit 3.6.0 → 3.7.1
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/.yarn/install-state.gz
CHANGED
|
Binary file
|
package/locale/fr.json
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"id": "_04eadf92",
|
|
4
|
+
"defaultMessage": "L'email est invalide.",
|
|
5
|
+
"message": "L'email est invalide."
|
|
6
|
+
},
|
|
2
7
|
{
|
|
3
8
|
"id": "_05a04636",
|
|
4
9
|
"defaultMessage": "Bin packing",
|
|
@@ -14,6 +19,11 @@
|
|
|
14
19
|
"defaultMessage": "Format requis : 14 chiffres",
|
|
15
20
|
"message": "Format requis : 14 chiffres"
|
|
16
21
|
},
|
|
22
|
+
{
|
|
23
|
+
"id": "_242e1892",
|
|
24
|
+
"defaultMessage": "Cette valeur ne peut être supérieure à {value}.",
|
|
25
|
+
"message": "Cette valeur ne peut être supérieure à {value}."
|
|
26
|
+
},
|
|
17
27
|
{
|
|
18
28
|
"id": "_24a9ec30",
|
|
19
29
|
"defaultMessage": "Format requis : 4 caractères ou nombres (exemples : 'A1b2' 'abcd')",
|
|
@@ -69,6 +79,16 @@
|
|
|
69
79
|
"defaultMessage": "Mercredi",
|
|
70
80
|
"message": "Mercredi"
|
|
71
81
|
},
|
|
82
|
+
{
|
|
83
|
+
"id": "_95659302",
|
|
84
|
+
"defaultMessage": "Cette valeur ne peut être supérieure à {value}",
|
|
85
|
+
"message": "Cette valeur ne peut être supérieure à {value}"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"id": "_992d813c",
|
|
89
|
+
"defaultMessage": "Le champ doit avoir au maximum {value} caractères.",
|
|
90
|
+
"message": "Le champ doit avoir au maximum {value} caractères."
|
|
91
|
+
},
|
|
72
92
|
{
|
|
73
93
|
"id": "_9fc912ee",
|
|
74
94
|
"defaultMessage": "Lundi",
|
|
@@ -79,6 +99,11 @@
|
|
|
79
99
|
"defaultMessage": "Déconnexion",
|
|
80
100
|
"message": "Déconnexion"
|
|
81
101
|
},
|
|
102
|
+
{
|
|
103
|
+
"id": "_a86b5641",
|
|
104
|
+
"defaultMessage": "Champ requis",
|
|
105
|
+
"message": "Champ requis"
|
|
106
|
+
},
|
|
82
107
|
{
|
|
83
108
|
"id": "_aaa4996e",
|
|
84
109
|
"defaultMessage": "Dimanche",
|
|
@@ -89,11 +114,21 @@
|
|
|
89
114
|
"defaultMessage": "Doit etre un entier strictement positif",
|
|
90
115
|
"message": "Doit etre un entier strictement positif"
|
|
91
116
|
},
|
|
117
|
+
{
|
|
118
|
+
"id": "_b766f5f3",
|
|
119
|
+
"defaultMessage": "Cette valeur doit être supérieure à {value}",
|
|
120
|
+
"message": "Cette valeur doit être supérieure à {value}"
|
|
121
|
+
},
|
|
92
122
|
{
|
|
93
123
|
"id": "_c05fffa7",
|
|
94
124
|
"defaultMessage": "Afficher le mot de passe",
|
|
95
125
|
"message": "Afficher le mot de passe"
|
|
96
126
|
},
|
|
127
|
+
{
|
|
128
|
+
"id": "_c30ace07",
|
|
129
|
+
"defaultMessage": "Le champ doit avoir au minimum {value} caractères.",
|
|
130
|
+
"message": "Le champ doit avoir au minimum {value} caractères."
|
|
131
|
+
},
|
|
97
132
|
{
|
|
98
133
|
"id": "_c98895d1",
|
|
99
134
|
"defaultMessage": "Doit etre un entier positif",
|
package/package.json
CHANGED
|
@@ -290,6 +290,20 @@ module UnitMeasure = {
|
|
|
290
290
|
})
|
|
291
291
|
}
|
|
292
292
|
|
|
293
|
+
module Speed = {
|
|
294
|
+
module Config = Toolkit__Utils_UnitMeasure.Speed
|
|
295
|
+
|
|
296
|
+
module WithUnit = MakeWithUnit({
|
|
297
|
+
include Config
|
|
298
|
+
let errorPrefix = "Speed with unit"
|
|
299
|
+
})
|
|
300
|
+
|
|
301
|
+
module Km_h = Make({
|
|
302
|
+
include Config
|
|
303
|
+
let wrapValue = Config.wrapValue(#km_h)
|
|
304
|
+
})
|
|
305
|
+
}
|
|
306
|
+
|
|
293
307
|
module Volume = {
|
|
294
308
|
module Config = Toolkit__Utils_UnitMeasure.Volume
|
|
295
309
|
|
|
@@ -22,6 +22,28 @@ module Msg = {
|
|
|
22
22
|
let requiredStrictPosInt = {
|
|
23
23
|
defaultMessage: "Doit etre un entier strictement positif",
|
|
24
24
|
}
|
|
25
|
+
|
|
26
|
+
let stringNonEmpty = {defaultMessage: "Champ requis"}
|
|
27
|
+
let minValue = {
|
|
28
|
+
defaultMessage: "Cette valeur doit être supérieure à {value}",
|
|
29
|
+
}
|
|
30
|
+
let maxValue = {
|
|
31
|
+
defaultMessage: "Cette valeur ne peut être supérieure à {value}",
|
|
32
|
+
}
|
|
33
|
+
let stringMin = {
|
|
34
|
+
defaultMessage: "Le champ doit avoir au minimum {value} caractères.",
|
|
35
|
+
}
|
|
36
|
+
let stringMax = {
|
|
37
|
+
defaultMessage: "Le champ doit avoir au maximum {value} caractères.",
|
|
38
|
+
}
|
|
39
|
+
let email = {defaultMessage: "L'email est invalide."}
|
|
40
|
+
let valueGreaterThan = {
|
|
41
|
+
defaultMessage: "Cette valeur ne peut être supérieure à {value}.",
|
|
42
|
+
}
|
|
43
|
+
let valueLowerThan = {
|
|
44
|
+
defaultMessage: "Cette valeur ne peut être supérieure à {value}.",
|
|
45
|
+
}
|
|
46
|
+
let optionNonEmpty = {defaultMessage: "Champ requis"}
|
|
25
47
|
}
|
|
26
48
|
|
|
27
49
|
let toReSchemaResult = (opt: option<string>): ReSchema.fieldState =>
|
|
@@ -334,3 +356,21 @@ let required14Digits = (intl, value) => {
|
|
|
334
356
|
}
|
|
335
357
|
}
|
|
336
358
|
}
|
|
359
|
+
|
|
360
|
+
let i18n = intl => {
|
|
361
|
+
...ReSchemaI18n.default,
|
|
362
|
+
stringNonEmpty: (~value as _) => intl->Intl.formatMessage(Msg.stringNonEmpty),
|
|
363
|
+
intMin: (~value as _: int, ~min: int) =>
|
|
364
|
+
intl->Intl.formatMessageWithValues(Msg.minValue, {"value": min}),
|
|
365
|
+
intMax: (~value as _: int, ~max: int) =>
|
|
366
|
+
intl->Intl.formatMessageWithValues(Msg.maxValue, {"value": max}),
|
|
367
|
+
floatMin: (~value as _: float, ~min: float) =>
|
|
368
|
+
intl->Intl.formatMessageWithValues(Msg.minValue, {"value": min}),
|
|
369
|
+
floatMax: (~value as _: float, ~max: float) =>
|
|
370
|
+
intl->Intl.formatMessageWithValues(Msg.maxValue, {"value": max}),
|
|
371
|
+
email: (~value as _: string) => intl->Intl.formatMessage(Msg.email),
|
|
372
|
+
stringMin: (~value as _: string, ~min: int) =>
|
|
373
|
+
intl->Intl.formatMessageWithValues(Msg.stringMin, {"value": min}),
|
|
374
|
+
stringMax: (~value as _: string, ~max: int) =>
|
|
375
|
+
intl->Intl.formatMessageWithValues(Msg.stringMax, {"value": max}),
|
|
376
|
+
}
|
|
@@ -180,6 +180,42 @@ module Dimension = {
|
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
+
module Speed = {
|
|
184
|
+
include Unit({
|
|
185
|
+
@deriving(jsConverter)
|
|
186
|
+
type unitEnum = [
|
|
187
|
+
| @as(`km/h`) #km_h
|
|
188
|
+
]
|
|
189
|
+
})
|
|
190
|
+
|
|
191
|
+
type t = [
|
|
192
|
+
| #km_h(float)
|
|
193
|
+
]
|
|
194
|
+
|
|
195
|
+
let wrapValue = (unit: unitEnum, value: float): t =>
|
|
196
|
+
switch unit {
|
|
197
|
+
| #km_h => #km_h(value)
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
let toValue = value =>
|
|
201
|
+
switch value {
|
|
202
|
+
| #km_h(value) => v
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
let display = (value, ~digits=2, ()) => {
|
|
206
|
+
open Js.Float
|
|
207
|
+
switch value {
|
|
208
|
+
| #km_h(value) => v->toFixedWithPrecision(~digits) ++ " km/h"
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
let toString = value => {
|
|
213
|
+
switch value {
|
|
214
|
+
| #km_h(value) => v->Float.toString ++ " km/h"
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
183
219
|
module Volume = {
|
|
184
220
|
include Unit({
|
|
185
221
|
@deriving(jsConverter)
|