@plone/volto 18.10.1 → 18.11.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/CHANGELOG.md +53 -0
- package/README.md +3 -3
- package/locales/ca/LC_MESSAGES/volto.po +46 -0
- package/locales/ca.json +1 -1
- package/locales/de/LC_MESSAGES/volto.po +46 -0
- package/locales/de.json +1 -1
- package/locales/en/LC_MESSAGES/volto.po +46 -0
- package/locales/en.json +1 -1
- package/locales/es/LC_MESSAGES/volto.po +46 -0
- package/locales/es.json +1 -1
- package/locales/eu/LC_MESSAGES/volto.po +46 -0
- package/locales/eu.json +1 -1
- package/locales/fi/LC_MESSAGES/volto.po +46 -0
- package/locales/fi.json +1 -1
- package/locales/fr/LC_MESSAGES/volto.po +46 -0
- package/locales/fr.json +1 -1
- package/locales/hi/LC_MESSAGES/volto.po +46 -0
- package/locales/hi.json +1 -1
- package/locales/it/LC_MESSAGES/volto.po +46 -0
- package/locales/it.json +1 -1
- package/locales/ja/LC_MESSAGES/volto.po +46 -0
- package/locales/ja.json +1 -1
- package/locales/nl/LC_MESSAGES/volto.po +46 -0
- package/locales/nl.json +1 -1
- package/locales/pt/LC_MESSAGES/volto.po +46 -0
- package/locales/pt.json +1 -1
- package/locales/pt_BR/LC_MESSAGES/volto.po +47 -1
- package/locales/pt_BR.json +1 -1
- package/locales/ro/LC_MESSAGES/volto.po +46 -0
- package/locales/ro.json +1 -1
- package/locales/ru/LC_MESSAGES/volto.po +5243 -0
- package/locales/ru.json +1 -0
- package/locales/volto.pot +47 -1
- package/locales/zh_CN/LC_MESSAGES/volto.po +46 -0
- package/locales/zh_CN.json +1 -1
- package/package.json +4 -4
- package/razzle.config.js +1 -1
- package/src/components/index.js +2 -0
- package/src/components/manage/Blocks/Block/BlocksForm.jsx +5 -1
- package/src/components/manage/Blocks/Search/components/SearchInput.jsx +11 -1
- package/src/components/manage/DragDropList/DragDropList.jsx +78 -33
- package/src/components/manage/Form/Field.jsx +38 -29
- package/src/components/manage/Form/Form.jsx +141 -69
- package/src/components/manage/Form/ModalForm.jsx +29 -0
- package/src/components/manage/Sidebar/ObjectBrowserNav.jsx +1 -1
- package/src/components/manage/Sidebar/ObjectBrowserNav.test.jsx +34 -13
- package/src/components/manage/Widgets/CheckboxGroupWidget.jsx +214 -0
- package/src/components/manage/Widgets/CheckboxGroupWidget.stories.jsx +39 -0
- package/src/components/manage/Widgets/CheckboxGroupWidget.test.jsx +45 -0
- package/src/components/manage/Widgets/FileWidget.jsx +43 -2
- package/src/components/manage/Widgets/HiddenWidget.jsx +114 -0
- package/src/components/manage/Widgets/HiddenWidget.stories.jsx +20 -0
- package/src/components/manage/Widgets/HiddenWidget.test.jsx +32 -0
- package/src/components/manage/Widgets/ImageWidget.jsx +3 -0
- package/src/components/manage/Widgets/RadioGroupWidget.jsx +207 -0
- package/src/components/manage/Widgets/RadioGroupWidget.stories.jsx +39 -0
- package/src/components/manage/Widgets/RadioGroupWidget.test.jsx +46 -0
- package/src/components/manage/Widgets/SchemaWidget.jsx +806 -320
- package/src/components/manage/Widgets/SelectWidget.jsx +38 -2
- package/src/components/manage/Widgets/StaticTextWidget.jsx +34 -0
- package/src/components/manage/Widgets/StaticTextWidget.stories.jsx +20 -0
- package/src/components/manage/Widgets/StaticTextWidget.test.jsx +25 -0
- package/src/components/manage/Widgets/TimeWidget.jsx +96 -0
- package/src/components/manage/Widgets/TimeWidget.stories.jsx +22 -0
- package/src/components/manage/Widgets/TimeWidget.test.jsx +35 -0
- package/src/components/manage/Widgets/index.tsx +35 -0
- package/src/components/theme/ContactForm/ContactForm.jsx +7 -4
- package/src/components/theme/Widgets/HiddenWidget.jsx +2 -0
- package/src/components/theme/Widgets/HiddenWidget.stories.jsx +25 -0
- package/src/components/theme/Widgets/HiddenWidget.test.jsx +11 -0
- package/src/components/theme/Widgets/StaticTextWidget.jsx +16 -0
- package/src/components/theme/Widgets/StaticTextWidget.stories.jsx +29 -0
- package/src/components/theme/Widgets/StaticTextWidget.test.jsx +32 -0
- package/src/config/Blocks.jsx +2 -0
- package/src/config/Widgets.jsx +14 -0
- package/src/constants/Languages.cjs +1 -0
- package/src/helpers/FormValidation/FormValidation.jsx +4 -0
- package/src/helpers/FormValidation/FormValidation.test.js +147 -31
- package/src/helpers/FormValidation/validators.ts +4 -1
- package/src/helpers/Utils/Utils.jsx +14 -2
- package/theme/themes/pastanaga/collections/form.overrides +4 -0
- package/theme/themes/pastanaga/elements/input.overrides +7 -0
- package/theme/themes/pastanaga/extras/sidebar.less +2 -0
- package/types/components/index.d.ts +1 -1
- package/types/components/manage/Widgets/CheckboxGroupWidget.d.ts +6 -0
- package/types/components/manage/Widgets/CheckboxGroupWidget.stories.d.ts +15 -0
- package/types/components/manage/Widgets/CheckboxGroupWidget.test.d.ts +1 -0
- package/types/components/manage/Widgets/HiddenWidget.d.ts +54 -0
- package/types/components/manage/Widgets/HiddenWidget.stories.d.ts +9 -0
- package/types/components/manage/Widgets/HiddenWidget.test.d.ts +1 -0
- package/types/components/manage/Widgets/RadioGroupWidget.d.ts +6 -0
- package/types/components/manage/Widgets/RadioGroupWidget.stories.d.ts +15 -0
- package/types/components/manage/Widgets/RadioGroupWidget.test.d.ts +1 -0
- package/types/components/manage/Widgets/StaticTextWidget.d.ts +18 -0
- package/types/components/manage/Widgets/StaticTextWidget.stories.d.ts +9 -0
- package/types/components/manage/Widgets/StaticTextWidget.test.d.ts +1 -0
- package/types/components/manage/Widgets/TimeWidget.d.ts +2 -0
- package/types/components/manage/Widgets/TimeWidget.stories.d.ts +8 -0
- package/types/components/manage/Widgets/TimeWidget.test.d.ts +1 -0
- package/types/components/manage/Widgets/index.d.ts +5 -0
- package/types/components/theme/Widgets/HiddenWidget.d.ts +6 -0
- package/types/components/theme/Widgets/HiddenWidget.stories.d.ts +8 -0
- package/types/components/theme/Widgets/HiddenWidget.test.d.ts +1 -0
- package/types/components/theme/Widgets/StaticTextWidget.d.ts +5 -0
- package/types/components/theme/Widgets/StaticTextWidget.stories.d.ts +8 -0
- package/types/components/theme/Widgets/StaticTextWidget.test.d.ts +1 -0
- package/types/config/Widgets.d.ts +14 -0
- package/types/constants/Languages.d.cts +1 -0
- package/types/helpers/FormValidation/validators.d.ts +1 -1
- package/types/helpers/Utils/Utils.d.ts +1 -1
|
@@ -57,6 +57,9 @@ describe('FormValidation', () => {
|
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
it('required - validates missing', () => {
|
|
60
|
+
const validationErrorMessages = [messages.required.defaultMessage];
|
|
61
|
+
validationErrorMessages.title = 'Username';
|
|
62
|
+
|
|
60
63
|
expect(
|
|
61
64
|
FormValidation.validateFieldsPerFieldset({
|
|
62
65
|
schema,
|
|
@@ -64,7 +67,7 @@ describe('FormValidation', () => {
|
|
|
64
67
|
formatMessage,
|
|
65
68
|
}),
|
|
66
69
|
).toEqual({
|
|
67
|
-
username:
|
|
70
|
+
username: validationErrorMessages,
|
|
68
71
|
});
|
|
69
72
|
});
|
|
70
73
|
|
|
@@ -82,6 +85,10 @@ describe('FormValidation', () => {
|
|
|
82
85
|
},
|
|
83
86
|
required: ['age'],
|
|
84
87
|
};
|
|
88
|
+
|
|
89
|
+
const validationErrorMessages = [messages.required.defaultMessage];
|
|
90
|
+
validationErrorMessages.title = 'age';
|
|
91
|
+
|
|
85
92
|
expect(
|
|
86
93
|
FormValidation.validateFieldsPerFieldset({
|
|
87
94
|
schema: newSchema,
|
|
@@ -89,7 +96,7 @@ describe('FormValidation', () => {
|
|
|
89
96
|
formatMessage,
|
|
90
97
|
}),
|
|
91
98
|
).toEqual({
|
|
92
|
-
age:
|
|
99
|
+
age: validationErrorMessages,
|
|
93
100
|
});
|
|
94
101
|
expect(
|
|
95
102
|
FormValidation.validateFieldsPerFieldset({
|
|
@@ -101,6 +108,9 @@ describe('FormValidation', () => {
|
|
|
101
108
|
});
|
|
102
109
|
|
|
103
110
|
it('email - validates incorrect', () => {
|
|
111
|
+
const validationErrorMessages = [messages.isValidEmail.defaultMessage];
|
|
112
|
+
validationErrorMessages.title = 'Email';
|
|
113
|
+
|
|
104
114
|
expect(
|
|
105
115
|
FormValidation.validateFieldsPerFieldset({
|
|
106
116
|
schema,
|
|
@@ -108,7 +118,7 @@ describe('FormValidation', () => {
|
|
|
108
118
|
formatMessage,
|
|
109
119
|
}),
|
|
110
120
|
).toEqual({
|
|
111
|
-
email:
|
|
121
|
+
email: validationErrorMessages,
|
|
112
122
|
});
|
|
113
123
|
});
|
|
114
124
|
|
|
@@ -124,14 +134,18 @@ describe('FormValidation', () => {
|
|
|
124
134
|
});
|
|
125
135
|
|
|
126
136
|
it('url - validates incorrect url', () => {
|
|
127
|
-
|
|
137
|
+
const validationErrorMessages = [messages.isValidURL.defaultMessage];
|
|
138
|
+
validationErrorMessages.title = 'url';
|
|
139
|
+
|
|
128
140
|
expect(
|
|
129
141
|
FormValidation.validateFieldsPerFieldset({
|
|
130
142
|
schema,
|
|
131
|
-
formData,
|
|
143
|
+
formData: { url: 'foo', username: 'test username' },
|
|
132
144
|
formatMessage,
|
|
133
145
|
}),
|
|
134
|
-
).toEqual({
|
|
146
|
+
).toEqual({
|
|
147
|
+
url: validationErrorMessages,
|
|
148
|
+
});
|
|
135
149
|
});
|
|
136
150
|
|
|
137
151
|
it('url - validates', () => {
|
|
@@ -180,6 +194,9 @@ describe('FormValidation', () => {
|
|
|
180
194
|
required: [],
|
|
181
195
|
};
|
|
182
196
|
|
|
197
|
+
const validationErrorMessages = [messages.isValidURL.defaultMessage];
|
|
198
|
+
validationErrorMessages.title = 'Default field';
|
|
199
|
+
|
|
183
200
|
expect(
|
|
184
201
|
FormValidation.validateFieldsPerFieldset({
|
|
185
202
|
schema: newSchema,
|
|
@@ -190,7 +207,7 @@ describe('FormValidation', () => {
|
|
|
190
207
|
formatMessage,
|
|
191
208
|
}),
|
|
192
209
|
).toEqual({
|
|
193
|
-
customField:
|
|
210
|
+
customField: validationErrorMessages,
|
|
194
211
|
});
|
|
195
212
|
});
|
|
196
213
|
|
|
@@ -213,6 +230,13 @@ describe('FormValidation', () => {
|
|
|
213
230
|
dependencies: { fieldType: 'customfieldtype' },
|
|
214
231
|
method: () => 'Fails',
|
|
215
232
|
});
|
|
233
|
+
|
|
234
|
+
const validationErrorMessages = [
|
|
235
|
+
'Fails',
|
|
236
|
+
messages.isValidURL.defaultMessage,
|
|
237
|
+
];
|
|
238
|
+
validationErrorMessages.title = 'Default field';
|
|
239
|
+
|
|
216
240
|
expect(
|
|
217
241
|
FormValidation.validateFieldsPerFieldset({
|
|
218
242
|
schema: newSchema,
|
|
@@ -223,7 +247,7 @@ describe('FormValidation', () => {
|
|
|
223
247
|
formatMessage,
|
|
224
248
|
}),
|
|
225
249
|
).toEqual({
|
|
226
|
-
customField:
|
|
250
|
+
customField: validationErrorMessages,
|
|
227
251
|
});
|
|
228
252
|
});
|
|
229
253
|
|
|
@@ -243,6 +267,10 @@ describe('FormValidation', () => {
|
|
|
243
267
|
},
|
|
244
268
|
required: [],
|
|
245
269
|
};
|
|
270
|
+
|
|
271
|
+
const validationErrorMessages = [messages.isValidURL.defaultMessage];
|
|
272
|
+
validationErrorMessages.title = 'Default field';
|
|
273
|
+
|
|
246
274
|
expect(
|
|
247
275
|
FormValidation.validateFieldsPerFieldset({
|
|
248
276
|
schema: newSchema,
|
|
@@ -253,7 +281,7 @@ describe('FormValidation', () => {
|
|
|
253
281
|
formatMessage,
|
|
254
282
|
}),
|
|
255
283
|
).toEqual({
|
|
256
|
-
customField:
|
|
284
|
+
customField: validationErrorMessages,
|
|
257
285
|
});
|
|
258
286
|
});
|
|
259
287
|
|
|
@@ -269,6 +297,10 @@ describe('FormValidation', () => {
|
|
|
269
297
|
},
|
|
270
298
|
required: [],
|
|
271
299
|
};
|
|
300
|
+
|
|
301
|
+
const validationErrorMessages = [messages.minLength.defaultMessage];
|
|
302
|
+
validationErrorMessages.title = 'password';
|
|
303
|
+
|
|
272
304
|
expect(
|
|
273
305
|
FormValidation.validateFieldsPerFieldset({
|
|
274
306
|
schema: newSchema,
|
|
@@ -279,7 +311,7 @@ describe('FormValidation', () => {
|
|
|
279
311
|
formatMessage,
|
|
280
312
|
}),
|
|
281
313
|
).toEqual({
|
|
282
|
-
customField:
|
|
314
|
+
customField: validationErrorMessages,
|
|
283
315
|
});
|
|
284
316
|
});
|
|
285
317
|
|
|
@@ -295,6 +327,10 @@ describe('FormValidation', () => {
|
|
|
295
327
|
},
|
|
296
328
|
required: [],
|
|
297
329
|
};
|
|
330
|
+
|
|
331
|
+
const validationErrorMessages = [messages.maxLength.defaultMessage];
|
|
332
|
+
validationErrorMessages.title = 'password';
|
|
333
|
+
|
|
298
334
|
expect(
|
|
299
335
|
FormValidation.validateFieldsPerFieldset({
|
|
300
336
|
schema: newSchema,
|
|
@@ -305,7 +341,7 @@ describe('FormValidation', () => {
|
|
|
305
341
|
formatMessage,
|
|
306
342
|
}),
|
|
307
343
|
).toEqual({
|
|
308
|
-
customField:
|
|
344
|
+
customField: validationErrorMessages,
|
|
309
345
|
});
|
|
310
346
|
});
|
|
311
347
|
|
|
@@ -321,6 +357,10 @@ describe('FormValidation', () => {
|
|
|
321
357
|
},
|
|
322
358
|
required: [],
|
|
323
359
|
};
|
|
360
|
+
|
|
361
|
+
const validationErrorMessages = [messages.pattern.defaultMessage];
|
|
362
|
+
validationErrorMessages.title = 'password';
|
|
363
|
+
|
|
324
364
|
expect(
|
|
325
365
|
FormValidation.validateFieldsPerFieldset({
|
|
326
366
|
schema: newSchema,
|
|
@@ -331,7 +371,7 @@ describe('FormValidation', () => {
|
|
|
331
371
|
formatMessage,
|
|
332
372
|
}),
|
|
333
373
|
).toEqual({
|
|
334
|
-
customField:
|
|
374
|
+
customField: validationErrorMessages,
|
|
335
375
|
});
|
|
336
376
|
});
|
|
337
377
|
|
|
@@ -371,6 +411,10 @@ describe('FormValidation', () => {
|
|
|
371
411
|
},
|
|
372
412
|
required: [],
|
|
373
413
|
};
|
|
414
|
+
|
|
415
|
+
const validationErrorMessages = [messages.isNumber.defaultMessage];
|
|
416
|
+
validationErrorMessages.title = 'Number field';
|
|
417
|
+
|
|
374
418
|
expect(
|
|
375
419
|
FormValidation.validateFieldsPerFieldset({
|
|
376
420
|
schema: newSchema,
|
|
@@ -382,7 +426,7 @@ describe('FormValidation', () => {
|
|
|
382
426
|
formatMessage,
|
|
383
427
|
}),
|
|
384
428
|
).toEqual({
|
|
385
|
-
customField:
|
|
429
|
+
customField: validationErrorMessages,
|
|
386
430
|
});
|
|
387
431
|
});
|
|
388
432
|
|
|
@@ -449,6 +493,10 @@ describe('FormValidation', () => {
|
|
|
449
493
|
},
|
|
450
494
|
required: [],
|
|
451
495
|
};
|
|
496
|
+
|
|
497
|
+
const validationErrorMessages = [messages.minimum.defaultMessage];
|
|
498
|
+
validationErrorMessages.title = 'Number field';
|
|
499
|
+
|
|
452
500
|
expect(
|
|
453
501
|
FormValidation.validateFieldsPerFieldset({
|
|
454
502
|
schema: newSchema,
|
|
@@ -459,7 +507,7 @@ describe('FormValidation', () => {
|
|
|
459
507
|
formatMessage,
|
|
460
508
|
}),
|
|
461
509
|
).toEqual({
|
|
462
|
-
customField:
|
|
510
|
+
customField: validationErrorMessages,
|
|
463
511
|
});
|
|
464
512
|
});
|
|
465
513
|
|
|
@@ -476,6 +524,10 @@ describe('FormValidation', () => {
|
|
|
476
524
|
},
|
|
477
525
|
required: [],
|
|
478
526
|
};
|
|
527
|
+
|
|
528
|
+
const validationErrorMessages = [messages.maximum.defaultMessage];
|
|
529
|
+
validationErrorMessages.title = 'Number field';
|
|
530
|
+
|
|
479
531
|
expect(
|
|
480
532
|
FormValidation.validateFieldsPerFieldset({
|
|
481
533
|
schema: newSchema,
|
|
@@ -486,7 +538,7 @@ describe('FormValidation', () => {
|
|
|
486
538
|
formatMessage,
|
|
487
539
|
}),
|
|
488
540
|
).toEqual({
|
|
489
|
-
customField:
|
|
541
|
+
customField: validationErrorMessages,
|
|
490
542
|
});
|
|
491
543
|
});
|
|
492
544
|
|
|
@@ -502,6 +554,10 @@ describe('FormValidation', () => {
|
|
|
502
554
|
},
|
|
503
555
|
required: [],
|
|
504
556
|
};
|
|
557
|
+
|
|
558
|
+
const validationErrorMessages = [messages.isInteger.defaultMessage];
|
|
559
|
+
validationErrorMessages.title = 'Integer field';
|
|
560
|
+
|
|
505
561
|
expect(
|
|
506
562
|
FormValidation.validateFieldsPerFieldset({
|
|
507
563
|
schema: newSchema,
|
|
@@ -512,7 +568,7 @@ describe('FormValidation', () => {
|
|
|
512
568
|
formatMessage,
|
|
513
569
|
}),
|
|
514
570
|
).toEqual({
|
|
515
|
-
customField:
|
|
571
|
+
customField: validationErrorMessages,
|
|
516
572
|
});
|
|
517
573
|
});
|
|
518
574
|
|
|
@@ -529,6 +585,10 @@ describe('FormValidation', () => {
|
|
|
529
585
|
},
|
|
530
586
|
required: [],
|
|
531
587
|
};
|
|
588
|
+
|
|
589
|
+
const validationErrorMessages = [messages.minimum.defaultMessage];
|
|
590
|
+
validationErrorMessages.title = 'Integer field';
|
|
591
|
+
|
|
532
592
|
expect(
|
|
533
593
|
FormValidation.validateFieldsPerFieldset({
|
|
534
594
|
schema: newSchema,
|
|
@@ -539,7 +599,7 @@ describe('FormValidation', () => {
|
|
|
539
599
|
formatMessage,
|
|
540
600
|
}),
|
|
541
601
|
).toEqual({
|
|
542
|
-
customField:
|
|
602
|
+
customField: validationErrorMessages,
|
|
543
603
|
});
|
|
544
604
|
});
|
|
545
605
|
|
|
@@ -556,6 +616,10 @@ describe('FormValidation', () => {
|
|
|
556
616
|
},
|
|
557
617
|
required: [],
|
|
558
618
|
};
|
|
619
|
+
|
|
620
|
+
const validationErrorMessages = [messages.maximum.defaultMessage];
|
|
621
|
+
validationErrorMessages.title = 'Integer field';
|
|
622
|
+
|
|
559
623
|
expect(
|
|
560
624
|
FormValidation.validateFieldsPerFieldset({
|
|
561
625
|
schema: newSchema,
|
|
@@ -566,7 +630,7 @@ describe('FormValidation', () => {
|
|
|
566
630
|
formatMessage,
|
|
567
631
|
}),
|
|
568
632
|
).toEqual({
|
|
569
|
-
customField:
|
|
633
|
+
customField: validationErrorMessages,
|
|
570
634
|
});
|
|
571
635
|
});
|
|
572
636
|
|
|
@@ -584,6 +648,10 @@ describe('FormValidation', () => {
|
|
|
584
648
|
},
|
|
585
649
|
required: [],
|
|
586
650
|
};
|
|
651
|
+
|
|
652
|
+
const validationErrorMessages = [messages.minLength.defaultMessage];
|
|
653
|
+
validationErrorMessages.title = 'password';
|
|
654
|
+
|
|
587
655
|
expect(
|
|
588
656
|
FormValidation.validateFieldsPerFieldset({
|
|
589
657
|
schema: newSchema,
|
|
@@ -591,7 +659,7 @@ describe('FormValidation', () => {
|
|
|
591
659
|
formatMessage,
|
|
592
660
|
}),
|
|
593
661
|
).toEqual({
|
|
594
|
-
password:
|
|
662
|
+
password: validationErrorMessages,
|
|
595
663
|
});
|
|
596
664
|
});
|
|
597
665
|
|
|
@@ -615,6 +683,10 @@ describe('FormValidation', () => {
|
|
|
615
683
|
},
|
|
616
684
|
required: [],
|
|
617
685
|
};
|
|
686
|
+
|
|
687
|
+
const validationErrorMessages = [messages.minLength.defaultMessage];
|
|
688
|
+
validationErrorMessages.title = 'description';
|
|
689
|
+
|
|
618
690
|
expect(
|
|
619
691
|
FormValidation.validateFieldsPerFieldset({
|
|
620
692
|
schema: newSchema,
|
|
@@ -625,7 +697,7 @@ describe('FormValidation', () => {
|
|
|
625
697
|
formatMessage,
|
|
626
698
|
}),
|
|
627
699
|
).toEqual({
|
|
628
|
-
description:
|
|
700
|
+
description: validationErrorMessages,
|
|
629
701
|
});
|
|
630
702
|
});
|
|
631
703
|
|
|
@@ -643,6 +715,10 @@ describe('FormValidation', () => {
|
|
|
643
715
|
},
|
|
644
716
|
required: [],
|
|
645
717
|
};
|
|
718
|
+
|
|
719
|
+
const validationErrorMessages = [messages.maxLength.defaultMessage];
|
|
720
|
+
validationErrorMessages.title = 'password';
|
|
721
|
+
|
|
646
722
|
expect(
|
|
647
723
|
FormValidation.validateFieldsPerFieldset({
|
|
648
724
|
schema: newSchema,
|
|
@@ -650,7 +726,7 @@ describe('FormValidation', () => {
|
|
|
650
726
|
formatMessage,
|
|
651
727
|
}),
|
|
652
728
|
).toEqual({
|
|
653
|
-
password:
|
|
729
|
+
password: validationErrorMessages,
|
|
654
730
|
});
|
|
655
731
|
});
|
|
656
732
|
|
|
@@ -674,6 +750,10 @@ describe('FormValidation', () => {
|
|
|
674
750
|
},
|
|
675
751
|
required: [],
|
|
676
752
|
};
|
|
753
|
+
|
|
754
|
+
const validationErrorMessages = [messages.maxLength.defaultMessage];
|
|
755
|
+
validationErrorMessages.title = 'description';
|
|
756
|
+
|
|
677
757
|
expect(
|
|
678
758
|
FormValidation.validateFieldsPerFieldset({
|
|
679
759
|
schema: newSchema,
|
|
@@ -684,7 +764,7 @@ describe('FormValidation', () => {
|
|
|
684
764
|
formatMessage,
|
|
685
765
|
}),
|
|
686
766
|
).toEqual({
|
|
687
|
-
description:
|
|
767
|
+
description: validationErrorMessages,
|
|
688
768
|
});
|
|
689
769
|
});
|
|
690
770
|
|
|
@@ -701,6 +781,10 @@ describe('FormValidation', () => {
|
|
|
701
781
|
},
|
|
702
782
|
required: [],
|
|
703
783
|
};
|
|
784
|
+
|
|
785
|
+
const validationErrorMessages = [messages.maxItems.defaultMessage];
|
|
786
|
+
validationErrorMessages.title = 'Array field';
|
|
787
|
+
|
|
704
788
|
expect(
|
|
705
789
|
FormValidation.validateFieldsPerFieldset({
|
|
706
790
|
schema: newSchema,
|
|
@@ -711,7 +795,7 @@ describe('FormValidation', () => {
|
|
|
711
795
|
formatMessage,
|
|
712
796
|
}),
|
|
713
797
|
).toEqual({
|
|
714
|
-
customField:
|
|
798
|
+
customField: validationErrorMessages,
|
|
715
799
|
});
|
|
716
800
|
});
|
|
717
801
|
|
|
@@ -728,6 +812,10 @@ describe('FormValidation', () => {
|
|
|
728
812
|
},
|
|
729
813
|
required: [],
|
|
730
814
|
};
|
|
815
|
+
|
|
816
|
+
const validationErrorMessages = [messages.minItems.defaultMessage];
|
|
817
|
+
validationErrorMessages.title = 'Array field';
|
|
818
|
+
|
|
731
819
|
expect(
|
|
732
820
|
FormValidation.validateFieldsPerFieldset({
|
|
733
821
|
schema: newSchema,
|
|
@@ -738,7 +826,7 @@ describe('FormValidation', () => {
|
|
|
738
826
|
formatMessage,
|
|
739
827
|
}),
|
|
740
828
|
).toEqual({
|
|
741
|
-
customField:
|
|
829
|
+
customField: validationErrorMessages,
|
|
742
830
|
});
|
|
743
831
|
});
|
|
744
832
|
|
|
@@ -755,6 +843,10 @@ describe('FormValidation', () => {
|
|
|
755
843
|
},
|
|
756
844
|
required: [],
|
|
757
845
|
};
|
|
846
|
+
|
|
847
|
+
const validationErrorMessages = [messages.uniqueItems.defaultMessage];
|
|
848
|
+
validationErrorMessages.title = 'Array field';
|
|
849
|
+
|
|
758
850
|
expect(
|
|
759
851
|
FormValidation.validateFieldsPerFieldset({
|
|
760
852
|
schema: newSchema,
|
|
@@ -765,7 +857,7 @@ describe('FormValidation', () => {
|
|
|
765
857
|
formatMessage,
|
|
766
858
|
}),
|
|
767
859
|
).toEqual({
|
|
768
|
-
customField:
|
|
860
|
+
customField: validationErrorMessages,
|
|
769
861
|
});
|
|
770
862
|
});
|
|
771
863
|
|
|
@@ -822,6 +914,10 @@ describe('FormValidation', () => {
|
|
|
822
914
|
dependencies: { format: 'url' },
|
|
823
915
|
method: urlValidator,
|
|
824
916
|
});
|
|
917
|
+
|
|
918
|
+
const validationErrorMessages = [messages.isValidURL.defaultMessage];
|
|
919
|
+
validationErrorMessages.title = 'Default field';
|
|
920
|
+
|
|
825
921
|
expect(
|
|
826
922
|
FormValidation.validateFieldsPerFieldset({
|
|
827
923
|
schema: newSchema,
|
|
@@ -832,7 +928,7 @@ describe('FormValidation', () => {
|
|
|
832
928
|
formatMessage,
|
|
833
929
|
}),
|
|
834
930
|
).toEqual({
|
|
835
|
-
customField:
|
|
931
|
+
customField: validationErrorMessages,
|
|
836
932
|
});
|
|
837
933
|
});
|
|
838
934
|
|
|
@@ -888,6 +984,10 @@ describe('FormValidation', () => {
|
|
|
888
984
|
dependencies: { format: 'url' },
|
|
889
985
|
method: urlValidator,
|
|
890
986
|
});
|
|
987
|
+
|
|
988
|
+
const validationErrorMessages = [messages.isValidURL.defaultMessage];
|
|
989
|
+
validationErrorMessages.title = 'Default field';
|
|
990
|
+
|
|
891
991
|
expect(
|
|
892
992
|
FormValidation.validateFieldsPerFieldset({
|
|
893
993
|
schema: newSchema,
|
|
@@ -898,7 +998,7 @@ describe('FormValidation', () => {
|
|
|
898
998
|
formatMessage,
|
|
899
999
|
}),
|
|
900
1000
|
).toEqual({
|
|
901
|
-
customField:
|
|
1001
|
+
customField: validationErrorMessages,
|
|
902
1002
|
});
|
|
903
1003
|
});
|
|
904
1004
|
|
|
@@ -958,6 +1058,10 @@ describe('FormValidation', () => {
|
|
|
958
1058
|
},
|
|
959
1059
|
method: urlValidator,
|
|
960
1060
|
});
|
|
1061
|
+
|
|
1062
|
+
const validationErrorMessages = [messages.isValidURL.defaultMessage];
|
|
1063
|
+
validationErrorMessages.title = 'Default field';
|
|
1064
|
+
|
|
961
1065
|
expect(
|
|
962
1066
|
FormValidation.validateFieldsPerFieldset({
|
|
963
1067
|
schema: newSchema,
|
|
@@ -968,7 +1072,7 @@ describe('FormValidation', () => {
|
|
|
968
1072
|
formatMessage,
|
|
969
1073
|
}),
|
|
970
1074
|
).toEqual({
|
|
971
|
-
customField:
|
|
1075
|
+
customField: validationErrorMessages,
|
|
972
1076
|
});
|
|
973
1077
|
});
|
|
974
1078
|
|
|
@@ -985,6 +1089,10 @@ describe('FormValidation', () => {
|
|
|
985
1089
|
},
|
|
986
1090
|
required: [],
|
|
987
1091
|
};
|
|
1092
|
+
|
|
1093
|
+
const validationErrorMessages = [messages.startEventRange.defaultMessage];
|
|
1094
|
+
validationErrorMessages.title = 'Start date';
|
|
1095
|
+
|
|
988
1096
|
expect(
|
|
989
1097
|
FormValidation.validateFieldsPerFieldset({
|
|
990
1098
|
schema: contentTypeSchema,
|
|
@@ -995,7 +1103,7 @@ describe('FormValidation', () => {
|
|
|
995
1103
|
formatMessage,
|
|
996
1104
|
}),
|
|
997
1105
|
).toEqual({
|
|
998
|
-
start:
|
|
1106
|
+
start: validationErrorMessages,
|
|
999
1107
|
});
|
|
1000
1108
|
});
|
|
1001
1109
|
|
|
@@ -1012,6 +1120,10 @@ describe('FormValidation', () => {
|
|
|
1012
1120
|
},
|
|
1013
1121
|
required: [],
|
|
1014
1122
|
};
|
|
1123
|
+
|
|
1124
|
+
const validationErrorMessages = [messages.endEventRange.defaultMessage];
|
|
1125
|
+
validationErrorMessages.title = 'End date';
|
|
1126
|
+
|
|
1015
1127
|
expect(
|
|
1016
1128
|
FormValidation.validateFieldsPerFieldset({
|
|
1017
1129
|
schema: contentTypeSchema,
|
|
@@ -1022,7 +1134,7 @@ describe('FormValidation', () => {
|
|
|
1022
1134
|
formatMessage,
|
|
1023
1135
|
}),
|
|
1024
1136
|
).toEqual({
|
|
1025
|
-
end:
|
|
1137
|
+
end: validationErrorMessages,
|
|
1026
1138
|
});
|
|
1027
1139
|
});
|
|
1028
1140
|
|
|
@@ -1042,6 +1154,10 @@ describe('FormValidation', () => {
|
|
|
1042
1154
|
dependencies: { blockType: 'slider', fieldName: 'customField' },
|
|
1043
1155
|
method: urlValidator,
|
|
1044
1156
|
});
|
|
1157
|
+
|
|
1158
|
+
const validationErrorMessages = [messages.isValidURL.defaultMessage];
|
|
1159
|
+
validationErrorMessages.title = 'Default field';
|
|
1160
|
+
|
|
1045
1161
|
expect(
|
|
1046
1162
|
FormValidation.validateFieldsPerFieldset({
|
|
1047
1163
|
schema: newSchema,
|
|
@@ -1053,7 +1169,7 @@ describe('FormValidation', () => {
|
|
|
1053
1169
|
formatMessage,
|
|
1054
1170
|
}),
|
|
1055
1171
|
).toEqual({
|
|
1056
|
-
customField:
|
|
1172
|
+
customField: validationErrorMessages,
|
|
1057
1173
|
});
|
|
1058
1174
|
});
|
|
1059
1175
|
});
|
|
@@ -74,7 +74,10 @@ export const urlValidator = ({ value, formatMessage }: Validator) => {
|
|
|
74
74
|
return !isValid ? formatMessage(messages.isValidURL) : null;
|
|
75
75
|
};
|
|
76
76
|
|
|
77
|
-
export const emailValidator = ({
|
|
77
|
+
export const emailValidator = ({
|
|
78
|
+
value,
|
|
79
|
+
formatMessage,
|
|
80
|
+
}: Validator): string | null => {
|
|
78
81
|
// Email Regex taken from from WHATWG living standard:
|
|
79
82
|
// https://html.spec.whatwg.org/multipage/input.html#e-mail-state-(type=email)
|
|
80
83
|
const emailRegex =
|
|
@@ -301,13 +301,25 @@ export function normalizeString(str) {
|
|
|
301
301
|
/**
|
|
302
302
|
* Slugify a string: remove whitespaces, special chars and replace with _
|
|
303
303
|
* @param {string} string String to be slugified
|
|
304
|
+
* @param {Array} slugs Array with slugs already taken
|
|
304
305
|
* @returns {string} Slugified string
|
|
305
306
|
*/
|
|
306
|
-
export const slugify = (string) => {
|
|
307
|
-
|
|
307
|
+
export const slugify = (string, slugs = []) => {
|
|
308
|
+
let slug = string
|
|
308
309
|
.toLowerCase()
|
|
309
310
|
.replace(/[\s-]+/g, '_')
|
|
310
311
|
.replace(/[^\w]+/g, '');
|
|
312
|
+
let i = 1;
|
|
313
|
+
|
|
314
|
+
if (slugs.includes(slug)) {
|
|
315
|
+
while (slugs.includes(`${slug}_${i}`)) {
|
|
316
|
+
i++;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
slug = `${slug}_${i}`;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
return slug;
|
|
311
323
|
};
|
|
312
324
|
|
|
313
325
|
/**
|
|
@@ -26,6 +26,7 @@ of an error is present, it overrides a default from SemanticUI grid definitions.
|
|
|
26
26
|
|
|
27
27
|
&.required .wrapper {
|
|
28
28
|
> label[for]::after,
|
|
29
|
+
.ui.checkbox::after,
|
|
29
30
|
.ui.label::after {
|
|
30
31
|
display: inline-block;
|
|
31
32
|
width: 10px;
|
|
@@ -37,6 +38,12 @@ of an error is present, it overrides a default from SemanticUI grid definitions.
|
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
40
|
|
|
41
|
+
&.required .wrapper .ui.checkbox::after {
|
|
42
|
+
position: absolute;
|
|
43
|
+
top: 2px;
|
|
44
|
+
right: -14px;
|
|
45
|
+
}
|
|
46
|
+
|
|
40
47
|
&.text {
|
|
41
48
|
.toolbar {
|
|
42
49
|
display: block;
|
|
@@ -121,4 +121,4 @@ export { default as App } from "@plone/volto/components/theme/App/App";
|
|
|
121
121
|
export { Controlpanels, Controlpanel, RulesControlpanel, AddRuleControlpanel, EditRuleControlpanel, ConfigureRuleControlpanel, UsersControlpanel, RenderUsers, UserGroupMembershipControlPanel, GroupsControlpanel, RenderGroups, RelationsControlpanel, AliasesControlpanel, UndoControlpanel, AddonsControlpanel, ContentType, ContentTypeLayout, ContentTypeSchema, ContentTypes, VersionOverview, UpgradeControlPanel, ModerateComments, DatabaseInformation } from "@plone/volto/components/manage/Controlpanels";
|
|
122
122
|
export { Field, InlineForm, ModalForm, UndoToolbar, BlocksToolbar, BlockDataForm, BlocksForm, Form } from "@plone/volto/components/manage/Form";
|
|
123
123
|
export { Contents, ContentsBreadcrumbs, ContentsIndexHeader, ContentsItem, ContentsUploadModal, ContentsPropertiesModal, ContentsRenameModal, ContentsWorkflowModal, ContentsTagsModal } from "@plone/volto/components/manage/Contents";
|
|
124
|
-
export { AlignWidget, ButtonsWidget, ArrayWidget, CheckboxWidget, FileWidget, IdWidget, PasswordWidget, QueryWidget, QuerySortOnWidget, QuerystringWidget, SchemaWidget, SelectWidget, TextareaWidget, TextWidget, TokenWidget, WysiwygWidget, UrlWidget, InternalUrlWidget, EmailWidget, NumberWidget, ImageSizeWidget, RegistryImageWidget, ReferenceWidget, ObjectBrowserWidget, ObjectWidget, ObjectListWidget, VocabularyTermsWidget, SelectMetadataWidget, SelectAutoComplete, ColorPickerWidget, DatetimeWidget, RecurrenceWidget, FormFieldWrapper } from "@plone/volto/components/manage/Widgets";
|
|
124
|
+
export { AlignWidget, ButtonsWidget, ArrayWidget, CheckboxWidget, FileWidget, HiddenWidget, IdWidget, PasswordWidget, QueryWidget, QuerySortOnWidget, QuerystringWidget, SchemaWidget, SelectWidget, StaticTextWidget, TextareaWidget, TextWidget, TokenWidget, WysiwygWidget, UrlWidget, InternalUrlWidget, EmailWidget, NumberWidget, ImageSizeWidget, RegistryImageWidget, ReferenceWidget, ObjectBrowserWidget, ObjectWidget, ObjectListWidget, VocabularyTermsWidget, SelectMetadataWidget, SelectAutoComplete, ColorPickerWidget, DatetimeWidget, RecurrenceWidget, FormFieldWrapper } from "@plone/volto/components/manage/Widgets";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const Default: any;
|
|
2
|
+
declare namespace _default {
|
|
3
|
+
export let title: string;
|
|
4
|
+
export { CheckboxGroupWidgetComponent as component };
|
|
5
|
+
export let decorators: ((Story: any) => import("react/jsx-runtime").JSX.Element)[];
|
|
6
|
+
export namespace argTypes {
|
|
7
|
+
namespace value {
|
|
8
|
+
namespace control {
|
|
9
|
+
let disable: boolean;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export default _default;
|
|
15
|
+
import { CheckboxGroupWidgetComponent } from './CheckboxGroupWidget';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|