@hmcts/ccd-case-ui-toolkit 7.0.3-error-message-fix → 7.0.3-exui-1123
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/esm2020/lib/shared/components/case-editor/services/wizard-page-field-to-case-field.mapper.mjs +4 -3
- package/esm2020/lib/shared/components/palette/base-field/abstract-form-field.component.mjs +5 -1
- package/esm2020/lib/shared/components/palette/document/write-document-field.component.mjs +2 -14
- package/esm2020/lib/shared/pipes/complex/ccd-read-fields-filter.pipe.mjs +4 -2
- package/esm2020/lib/shared/pipes/complex/fields-filter.pipe.mjs +4 -2
- package/esm2020/lib/shared/services/fields/fields.utils.mjs +6 -1
- package/esm2020/lib/shared/services/form/form-value.service.mjs +2 -2
- package/fesm2015/hmcts-ccd-case-ui-toolkit.mjs +21 -18
- package/fesm2015/hmcts-ccd-case-ui-toolkit.mjs.map +1 -1
- package/fesm2020/hmcts-ccd-case-ui-toolkit.mjs +20 -18
- package/fesm2020/hmcts-ccd-case-ui-toolkit.mjs.map +1 -1
- package/lib/shared/components/case-editor/services/wizard-page-field-to-case-field.mapper.d.ts.map +1 -1
- package/lib/shared/components/palette/base-field/abstract-form-field.component.d.ts.map +1 -1
- package/lib/shared/components/palette/document/write-document-field.component.d.ts.map +1 -1
- package/lib/shared/pipes/complex/ccd-read-fields-filter.pipe.d.ts.map +1 -1
- package/lib/shared/pipes/complex/fields-filter.pipe.d.ts.map +1 -1
- package/lib/shared/services/fields/fields.utils.d.ts +1 -0
- package/lib/shared/services/fields/fields.utils.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -3237,6 +3237,11 @@ class WorkbasketInput {
|
|
|
3237
3237
|
|
|
3238
3238
|
// @dynamic
|
|
3239
3239
|
class FieldsUtils {
|
|
3240
|
+
static isValidDisplayContext(ctx) {
|
|
3241
|
+
return (ctx === 'MANDATORY' || ctx === 'READONLY'
|
|
3242
|
+
|| ctx === 'OPTIONAL' || ctx === 'HIDDEN'
|
|
3243
|
+
|| ctx === 'COMPLEX');
|
|
3244
|
+
}
|
|
3240
3245
|
static convertToCaseField(obj) {
|
|
3241
3246
|
if (!(obj instanceof CaseField)) {
|
|
3242
3247
|
return plainToClassFromExist(new CaseField(), obj);
|
|
@@ -4385,12 +4390,17 @@ class AbstractFormFieldComponent {
|
|
|
4385
4390
|
return this.idPrefix + this.caseField.id;
|
|
4386
4391
|
}
|
|
4387
4392
|
registerControl(control, replace = false) {
|
|
4393
|
+
var _a;
|
|
4388
4394
|
const container = this.parent || this.formGroup;
|
|
4389
4395
|
if (!container) {
|
|
4390
4396
|
return control;
|
|
4391
4397
|
}
|
|
4392
4398
|
const existing = container.controls[this.caseField.id];
|
|
4399
|
+
// update the field value which has been set in mid-event call back
|
|
4393
4400
|
if (existing) {
|
|
4401
|
+
if (existing.value === null && ((_a = this.caseField) === null || _a === void 0 ? void 0 : _a.value)) {
|
|
4402
|
+
existing.value = this.caseField.value;
|
|
4403
|
+
}
|
|
4394
4404
|
if (replace) {
|
|
4395
4405
|
// Set the validators on the replacement with what already exists.
|
|
4396
4406
|
control.setValidators(existing.validator);
|
|
@@ -5446,7 +5456,7 @@ class FormValueService {
|
|
|
5446
5456
|
// Retain anything that is readonly and not a label.
|
|
5447
5457
|
continue;
|
|
5448
5458
|
}
|
|
5449
|
-
if (field.hidden === true && field.display_context !== 'HIDDEN' && field.id !== 'caseLinks' && !field.retain_hidden_value) {
|
|
5459
|
+
if (field.hidden === true && field.display_context !== 'HIDDEN' && field.display_context !== 'HIDDEN_TEMP' && field.id !== 'caseLinks' && !field.retain_hidden_value) {
|
|
5450
5460
|
// Delete anything that is hidden (that is NOT readonly), and that
|
|
5451
5461
|
// hasn't had its display_context overridden to make it hidden.
|
|
5452
5462
|
delete data[field.id];
|
|
@@ -7554,7 +7564,8 @@ class WizardPageFieldToCaseFieldMapper {
|
|
|
7554
7564
|
childrenCaseFields.forEach(e => this.hideParentIfAllChildrenHidden(e));
|
|
7555
7565
|
if (childrenCaseFields.length > 0 && this.allCaseFieldsHidden(childrenCaseFields)) {
|
|
7556
7566
|
caseField.hidden = true;
|
|
7557
|
-
|
|
7567
|
+
// marking display_context as special hidden so field not being deleted in event submission
|
|
7568
|
+
caseField.display_context = 'HIDDEN_TEMP';
|
|
7558
7569
|
}
|
|
7559
7570
|
}
|
|
7560
7571
|
getCaseFieldChildren(caseField) {
|
|
@@ -7568,7 +7579,7 @@ class WizardPageFieldToCaseFieldMapper {
|
|
|
7568
7579
|
return childrenCaseFields;
|
|
7569
7580
|
}
|
|
7570
7581
|
allCaseFieldsHidden(children) {
|
|
7571
|
-
return
|
|
7582
|
+
return children.every(e => e.display_context === 'HIDDEN' || e.display_context === 'HIDDEN_TEMP');
|
|
7572
7583
|
}
|
|
7573
7584
|
}
|
|
7574
7585
|
WizardPageFieldToCaseFieldMapper.ɵfac = function WizardPageFieldToCaseFieldMapper_Factory(t) { return new (t || WizardPageFieldToCaseFieldMapper)(); };
|
|
@@ -12686,7 +12697,9 @@ class FieldsFilterPipe {
|
|
|
12686
12697
|
.filter(f => keepEmpty || FieldsFilterPipe.keepField(f))
|
|
12687
12698
|
.map(f => {
|
|
12688
12699
|
if (!f.display_context) {
|
|
12689
|
-
|
|
12700
|
+
if (FieldsUtils.isValidDisplayContext(complexField.display_context)) {
|
|
12701
|
+
f.display_context = complexField.display_context;
|
|
12702
|
+
}
|
|
12690
12703
|
}
|
|
12691
12704
|
return f;
|
|
12692
12705
|
});
|
|
@@ -13347,19 +13360,7 @@ class WriteDocumentFieldComponent extends AbstractFieldWriteComponent {
|
|
|
13347
13360
|
if (0 === error.status || 502 === error.status) {
|
|
13348
13361
|
return WriteDocumentFieldComponent.UPLOAD_ERROR_NOT_AVAILABLE;
|
|
13349
13362
|
}
|
|
13350
|
-
|
|
13351
|
-
if (error && (error === null || error === void 0 ? void 0 : error.error)) {
|
|
13352
|
-
const fullError = error.error;
|
|
13353
|
-
const start = fullError.indexOf('{');
|
|
13354
|
-
if (start >= 0) {
|
|
13355
|
-
const json = fullError.substring(start, fullError.length - 1).split('<EOL>').join('');
|
|
13356
|
-
const obj = JSON.parse(json);
|
|
13357
|
-
if (obj && (obj === null || obj === void 0 ? void 0 : obj.error)) {
|
|
13358
|
-
errorMsg = obj.error;
|
|
13359
|
-
}
|
|
13360
|
-
}
|
|
13361
|
-
}
|
|
13362
|
-
return errorMsg;
|
|
13363
|
+
return error.error;
|
|
13363
13364
|
}
|
|
13364
13365
|
buildDocumentUploadData(selectedFile) {
|
|
13365
13366
|
const documentUpload = new FormData();
|
|
@@ -23735,7 +23736,9 @@ class ReadFieldsFilterPipe {
|
|
|
23735
23736
|
})
|
|
23736
23737
|
.map(f => {
|
|
23737
23738
|
if (!f.display_context) {
|
|
23738
|
-
|
|
23739
|
+
if (FieldsUtils.isValidDisplayContext(complexField.display_context)) {
|
|
23740
|
+
f.display_context = complexField.display_context;
|
|
23741
|
+
}
|
|
23739
23742
|
}
|
|
23740
23743
|
if (setupHidden) {
|
|
23741
23744
|
ReadFieldsFilterPipe.evaluateConditionalShow(f, checkConditionalShowAgainst, path, formGroupAvailable, complexField.id);
|