@ministryofjustice/frontend 6.0.0 → 7.0.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/moj/all.bundle.js +16 -6
- package/moj/all.bundle.js.map +1 -1
- package/moj/all.bundle.mjs +16 -6
- package/moj/all.bundle.mjs.map +1 -1
- package/moj/common/moj-frontend-version.mjs +2 -2
- package/moj/common/moj-frontend-version.mjs.map +1 -1
- package/moj/components/date-picker/date-picker.bundle.js +11 -1
- package/moj/components/date-picker/date-picker.bundle.js.map +1 -1
- package/moj/components/date-picker/date-picker.bundle.mjs +11 -1
- package/moj/components/date-picker/date-picker.bundle.mjs.map +1 -1
- package/moj/components/date-picker/date-picker.mjs +11 -1
- package/moj/components/date-picker/date-picker.mjs.map +1 -1
- package/moj/components/messages/README.md +1 -1
- package/moj/components/multi-file-upload/multi-file-upload.bundle.js +3 -3
- package/moj/components/multi-file-upload/multi-file-upload.bundle.js.map +1 -1
- package/moj/components/multi-file-upload/multi-file-upload.bundle.mjs +3 -3
- package/moj/components/multi-file-upload/multi-file-upload.bundle.mjs.map +1 -1
- package/moj/components/multi-file-upload/multi-file-upload.mjs +3 -3
- package/moj/components/multi-file-upload/multi-file-upload.mjs.map +1 -1
- package/moj/components/pagination/template.njk +2 -2
- package/moj/components/timeline/README.md +1 -1
- package/moj/core/_moj-frontend-properties.scss +1 -1
- package/moj/moj-frontend.min.css +1 -1
- package/moj/moj-frontend.min.css.map +1 -1
- package/moj/moj-frontend.min.js +1 -1
- package/moj/moj-frontend.min.js.map +1 -1
- package/moj/objects/_scrollable-pane.scss +2 -2
- package/moj/objects/_scrollable-pane.scss.map +1 -1
- package/package.json +1 -1
package/moj/all.bundle.mjs
CHANGED
|
@@ -337,11 +337,11 @@ function createAll(Component, config, scopeOrOptions) {
|
|
|
337
337
|
*/
|
|
338
338
|
|
|
339
339
|
/**
|
|
340
|
-
*
|
|
340
|
+
* MOJ Frontend release version
|
|
341
341
|
*
|
|
342
342
|
* {@link https://github.com/ministryofjustice/moj-frontend/releases}
|
|
343
343
|
*/
|
|
344
|
-
const version = '
|
|
344
|
+
const version = '7.0.0';
|
|
345
345
|
|
|
346
346
|
class AddAnother extends Component {
|
|
347
347
|
/**
|
|
@@ -1375,7 +1375,7 @@ class DatePicker extends ConfigurableComponent {
|
|
|
1375
1375
|
const day = match[1];
|
|
1376
1376
|
const month = match[3];
|
|
1377
1377
|
const year = match[4];
|
|
1378
|
-
formattedDate = new Date(
|
|
1378
|
+
formattedDate = new Date(Number(year), Number(month) - 1, Number(day));
|
|
1379
1379
|
if (formattedDate instanceof Date && Number.isFinite(formattedDate.getTime())) {
|
|
1380
1380
|
return formattedDate;
|
|
1381
1381
|
}
|
|
@@ -1551,6 +1551,16 @@ class DatePicker extends ConfigurableComponent {
|
|
|
1551
1551
|
|
|
1552
1552
|
// get the date from the input element
|
|
1553
1553
|
this.inputDate = this.formattedDateFromString(this.$input.value);
|
|
1554
|
+
// move current date to the closest selectable date if it is out of range
|
|
1555
|
+
if (this.minDate && this.minDate > this.inputDate) {
|
|
1556
|
+
this.inputDate = new Date(this.minDate.getTime());
|
|
1557
|
+
}
|
|
1558
|
+
if (this.maxDate && this.maxDate < this.inputDate) {
|
|
1559
|
+
this.inputDate = new Date(this.maxDate.getTime());
|
|
1560
|
+
}
|
|
1561
|
+
if (this.minDate && this.maxDate && this.minDate > this.maxDate) {
|
|
1562
|
+
console.error('min date is after max date. No dates will be selectable');
|
|
1563
|
+
}
|
|
1554
1564
|
this.currentDate = this.inputDate;
|
|
1555
1565
|
this.currentDate.setHours(0, 0, 0, 0);
|
|
1556
1566
|
this.updateCalendar();
|
|
@@ -2498,13 +2508,13 @@ class MultiFileUpload extends ConfigurableComponent {
|
|
|
2498
2508
|
$message.innerHTML = this.getSuccessHtml(xhr.response.success);
|
|
2499
2509
|
this.$status.textContent = xhr.response.success.messageText;
|
|
2500
2510
|
$actions.append(this.getDeleteButton(xhr.response.file));
|
|
2501
|
-
this.config.hooks.exitHook(this, file, xhr, xhr.
|
|
2511
|
+
this.config.hooks.exitHook(this, file, xhr, xhr.statusText);
|
|
2502
2512
|
};
|
|
2503
2513
|
const onError = () => {
|
|
2504
2514
|
const error = new Error(xhr.response && 'error' in xhr.response ? xhr.response.error.message : xhr.statusText || 'Upload failed');
|
|
2505
2515
|
$message.innerHTML = this.getErrorHtml(error);
|
|
2506
2516
|
this.$status.textContent = error.message;
|
|
2507
|
-
this.config.hooks.errorHook(this, file, xhr, xhr.
|
|
2517
|
+
this.config.hooks.errorHook(this, file, xhr, xhr.statusText, error);
|
|
2508
2518
|
};
|
|
2509
2519
|
xhr.addEventListener('load', onLoad);
|
|
2510
2520
|
xhr.addEventListener('error', onError);
|
|
@@ -2541,7 +2551,7 @@ class MultiFileUpload extends ConfigurableComponent {
|
|
|
2541
2551
|
}
|
|
2542
2552
|
const $rowDelete = $rows.find($row => $row.contains($button));
|
|
2543
2553
|
if ($rowDelete) $rowDelete.remove();
|
|
2544
|
-
this.config.hooks.deleteHook(this, undefined, xhr, xhr.
|
|
2554
|
+
this.config.hooks.deleteHook(this, undefined, xhr, xhr.statusText);
|
|
2545
2555
|
});
|
|
2546
2556
|
xhr.open('POST', this.config.deleteUrl);
|
|
2547
2557
|
xhr.setRequestHeader('Content-Type', 'application/json');
|