@hmcts/ccd-case-ui-toolkit 6.16.1 → 6.16.2-ccpay-upgrade
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/bundles/hmcts-ccd-case-ui-toolkit.umd.js +117 -88
- package/bundles/hmcts-ccd-case-ui-toolkit.umd.js.map +1 -1
- package/bundles/hmcts-ccd-case-ui-toolkit.umd.min.js +1 -1
- package/bundles/hmcts-ccd-case-ui-toolkit.umd.min.js.map +1 -1
- package/esm2015/lib/shared/components/case-editor/case-edit/case-edit.component.js +12 -14
- package/esm2015/lib/shared/components/case-editor/case-edit-submit/case-edit-submit.component.js +19 -17
- package/esm2015/lib/shared/components/palette/complex/read-complex-field-table.component.js +2 -2
- package/esm2015/lib/shared/directives/conditional-show/services/condition-parser.service.js +4 -1
- package/esm2015/lib/shared/services/fields/fields.utils.js +22 -1
- package/esm2015/lib/shared/services/form/form-value.service.js +37 -43
- package/fesm2015/hmcts-ccd-case-ui-toolkit.js +90 -72
- package/fesm2015/hmcts-ccd-case-ui-toolkit.js.map +1 -1
- package/lib/shared/components/case-editor/case-edit/case-edit.component.d.ts.map +1 -1
- package/lib/shared/components/case-editor/case-edit-submit/case-edit-submit.component.d.ts.map +1 -1
- package/lib/shared/directives/conditional-show/services/condition-parser.service.d.ts.map +1 -1
- package/lib/shared/services/fields/fields.utils.d.ts +16 -0
- package/lib/shared/services/fields/fields.utils.d.ts.map +1 -1
- package/lib/shared/services/form/form-value.service.d.ts +14 -13
- package/lib/shared/services/form/form-value.service.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -4124,18 +4124,39 @@
|
|
|
4124
4124
|
}
|
|
4125
4125
|
return this.isFlagsFieldType(caseField.field_type);
|
|
4126
4126
|
};
|
|
4127
|
+
/**
|
|
4128
|
+
* @deprecated Use {@link isCaseFieldOfType} instead, passing 'FlagLauncher' as the single type in the `types` array
|
|
4129
|
+
*/
|
|
4127
4130
|
FieldsUtils.isFlagLauncherCaseField = function (caseField) {
|
|
4128
4131
|
if (!caseField) {
|
|
4129
4132
|
return false;
|
|
4130
4133
|
}
|
|
4131
4134
|
return caseField.field_type.type === 'FlagLauncher';
|
|
4132
4135
|
};
|
|
4136
|
+
/**
|
|
4137
|
+
* @deprecated Use {@link isCaseFieldOfType} instead, passing 'ComponentLauncher' as the single type in the `types`
|
|
4138
|
+
* array
|
|
4139
|
+
*/
|
|
4133
4140
|
FieldsUtils.isComponentLauncherCaseField = function (caseField) {
|
|
4134
4141
|
if (!caseField) {
|
|
4135
4142
|
return false;
|
|
4136
4143
|
}
|
|
4137
4144
|
return caseField.field_type.type === 'ComponentLauncher';
|
|
4138
4145
|
};
|
|
4146
|
+
/**
|
|
4147
|
+
* Checks if a {@link CaseField} is of one of the given field types.
|
|
4148
|
+
*
|
|
4149
|
+
* @param caseField The `CaseField` to check
|
|
4150
|
+
* @param types An array of one or more field types
|
|
4151
|
+
* @returns `true` if the `CaseField` type is one of those in the array of types to check against; `false`
|
|
4152
|
+
* otherwise or if `caseField` or `types` are falsy
|
|
4153
|
+
*/
|
|
4154
|
+
FieldsUtils.isCaseFieldOfType = function (caseField, types) {
|
|
4155
|
+
if (!caseField || !types) {
|
|
4156
|
+
return false;
|
|
4157
|
+
}
|
|
4158
|
+
return types.some(function (type) { return type === caseField.field_type.type; });
|
|
4159
|
+
};
|
|
4139
4160
|
FieldsUtils.isLinkedCasesCaseField = function (caseField) {
|
|
4140
4161
|
return FieldsUtils.isComponentLauncherCaseField(caseField) &&
|
|
4141
4162
|
caseField.id === 'LinkedCasesComponentLauncher';
|
|
@@ -4651,6 +4672,9 @@
|
|
|
4651
4672
|
var _a = __read(path.split(/[_]+/g)), _ = _a[0], pathTail = _a.slice(1);
|
|
4652
4673
|
return this.findValueForComplexCondition(fields[head], tail[0], tail.slice(1), pathTail.join('_'));
|
|
4653
4674
|
}
|
|
4675
|
+
else if (!fields[head]) {
|
|
4676
|
+
return this.findValueForComplexCondition(fields, tail[0], tail.slice(1), path);
|
|
4677
|
+
}
|
|
4654
4678
|
else {
|
|
4655
4679
|
return this.findValueForComplexCondition(fields[head], tail[0], tail.slice(1), path);
|
|
4656
4680
|
}
|
|
@@ -6320,65 +6344,70 @@
|
|
|
6320
6344
|
}
|
|
6321
6345
|
};
|
|
6322
6346
|
/**
|
|
6323
|
-
* Remove the
|
|
6347
|
+
* Remove from the top level of the form data any case fields of a given type or types that are not intended to be
|
|
6348
|
+
* persisted. This function is intended to remove "special" case field types from the data, such as FlagLauncher or
|
|
6349
|
+
* ComponentLauncher fields.
|
|
6324
6350
|
*
|
|
6325
|
-
* @param data The object tree of form values on which to perform the removal
|
|
6351
|
+
* @param data The object tree of form values on which to perform the removal at the top level only
|
|
6326
6352
|
* @param caseFields The list of underlying {@link CaseField} domain model objects for each field
|
|
6353
|
+
* @param types An array of one or more field types
|
|
6327
6354
|
*/
|
|
6328
|
-
FormValueService.prototype.
|
|
6329
|
-
|
|
6330
|
-
|
|
6331
|
-
|
|
6332
|
-
|
|
6333
|
-
|
|
6355
|
+
FormValueService.prototype.removeCaseFieldsOfType = function (data, caseFields, types) {
|
|
6356
|
+
var e_12, _a;
|
|
6357
|
+
if (data && caseFields && caseFields.length > 0 && types.length > 0) {
|
|
6358
|
+
var caseFieldsToRemove = caseFields.filter(function (caseField) { return FieldsUtils.isCaseFieldOfType(caseField, types); });
|
|
6359
|
+
try {
|
|
6360
|
+
for (var caseFieldsToRemove_1 = __values(caseFieldsToRemove), caseFieldsToRemove_1_1 = caseFieldsToRemove_1.next(); !caseFieldsToRemove_1_1.done; caseFieldsToRemove_1_1 = caseFieldsToRemove_1.next()) {
|
|
6361
|
+
var caseField = caseFieldsToRemove_1_1.value;
|
|
6362
|
+
delete data[caseField.id];
|
|
6363
|
+
}
|
|
6364
|
+
}
|
|
6365
|
+
catch (e_12_1) { e_12 = { error: e_12_1 }; }
|
|
6366
|
+
finally {
|
|
6367
|
+
try {
|
|
6368
|
+
if (caseFieldsToRemove_1_1 && !caseFieldsToRemove_1_1.done && (_a = caseFieldsToRemove_1.return)) _a.call(caseFieldsToRemove_1);
|
|
6369
|
+
}
|
|
6370
|
+
finally { if (e_12) throw e_12.error; }
|
|
6334
6371
|
}
|
|
6335
6372
|
}
|
|
6336
6373
|
};
|
|
6337
6374
|
/**
|
|
6338
|
-
*
|
|
6375
|
+
* Re-populate the form data from the values held in the case fields. This is necessary in order to pick up, for
|
|
6376
|
+
* each `Flags` field, any flag details data not currently present.
|
|
6377
|
+
*
|
|
6378
|
+
* `Flags` fields may be contained in other `CaseField` instances, either as a sub-field of a Complex field, or
|
|
6379
|
+
* fields in a collection (or sub-fields of Complex fields in a collection). Therefore, it is necessary to
|
|
6380
|
+
* iterate through all `CaseField`s.
|
|
6339
6381
|
*
|
|
6340
6382
|
* @param data The object tree of form values on which to perform the data population
|
|
6341
6383
|
* @param caseFields The list of underlying {@link CaseField} domain model objects for each field
|
|
6342
6384
|
*/
|
|
6343
|
-
FormValueService.prototype.
|
|
6344
|
-
if (data && caseFields && caseFields.length > 0
|
|
6345
|
-
|
|
6346
|
-
//
|
|
6347
|
-
|
|
6348
|
-
caseFields.filter(function (caseField) { return !FieldsUtils.isFlagLauncherCaseField(caseField); })
|
|
6385
|
+
FormValueService.prototype.repopulateFormDataFromCaseFieldValues = function (data, caseFields) {
|
|
6386
|
+
if (data && caseFields && caseFields.length > 0 &&
|
|
6387
|
+
caseFields.findIndex(function (caseField) { return FieldsUtils.isCaseFieldOfType(caseField, ['FlagLauncher']); }) > -1) {
|
|
6388
|
+
// Ignore the FlagLauncher CaseField because it does not hold any values
|
|
6389
|
+
caseFields.filter(function (caseField) { return !FieldsUtils.isCaseFieldOfType(caseField, ['FlagLauncher']); })
|
|
6349
6390
|
.forEach(function (caseField) {
|
|
6350
|
-
// Ensure that the data object is populated for all
|
|
6351
|
-
//
|
|
6391
|
+
// Ensure that the data object is populated for all CaseField keys it contains, even if for a given
|
|
6392
|
+
// CaseField key, the data object has a falsy value (hence the use of hasOwnProperty() for the check below)
|
|
6393
|
+
// See https://tools.hmcts.net/jira/browse/EUI-7377
|
|
6352
6394
|
if (data.hasOwnProperty(caseField.id) && caseField.value) {
|
|
6353
|
-
// Create new object for the
|
|
6354
|
-
|
|
6355
|
-
|
|
6356
|
-
|
|
6357
|
-
Object.keys(data[caseField.id]).forEach(function (key) {
|
|
6358
|
-
if (caseField.value.hasOwnProperty(key)) {
|
|
6359
|
-
data[caseField.id][key] = caseField.value[key];
|
|
6360
|
-
}
|
|
6361
|
-
});
|
|
6395
|
+
// Create new object for the CaseField ID within the data object, if necessary (i.e. if the current value
|
|
6396
|
+
// is falsy)
|
|
6397
|
+
if (!data[caseField.id]) {
|
|
6398
|
+
data[caseField.id] = {};
|
|
6362
6399
|
}
|
|
6400
|
+
// Copy all values from the corresponding CaseField; this ensures all nested flag data (for example, a
|
|
6401
|
+
// Flags field within a Complex field or a collection of Complex fields) is copied across
|
|
6402
|
+
Object.keys(data[caseField.id]).forEach(function (key) {
|
|
6403
|
+
if (caseField.value.hasOwnProperty(key)) {
|
|
6404
|
+
data[caseField.id][key] = caseField.value[key];
|
|
6405
|
+
}
|
|
6406
|
+
});
|
|
6363
6407
|
}
|
|
6364
6408
|
});
|
|
6365
6409
|
}
|
|
6366
6410
|
};
|
|
6367
|
-
/**
|
|
6368
|
-
* Remove the ComponentLauncher case field, which is not intended to be persisted.
|
|
6369
|
-
*
|
|
6370
|
-
* @param data The object tree of form values on which to perform the removal
|
|
6371
|
-
* @param caseFields The list of underlying {@link CaseField} domain model objects for each field
|
|
6372
|
-
*/
|
|
6373
|
-
FormValueService.prototype.removeComponentLauncherField = function (data, caseFields) {
|
|
6374
|
-
if (data && caseFields && caseFields.length > 0) {
|
|
6375
|
-
var componentLauncherCaseField = caseFields.filter(function (caseField) { return FieldsUtils.isComponentLauncherCaseField(caseField); });
|
|
6376
|
-
if (componentLauncherCaseField.length > 0) {
|
|
6377
|
-
// There should be only one ComponentLauncher case field
|
|
6378
|
-
delete data[componentLauncherCaseField[0].id];
|
|
6379
|
-
}
|
|
6380
|
-
}
|
|
6381
|
-
};
|
|
6382
6411
|
/**
|
|
6383
6412
|
* Populate the linked cases from the data held in its corresponding CaseField.
|
|
6384
6413
|
*
|
|
@@ -6387,7 +6416,7 @@
|
|
|
6387
6416
|
*/
|
|
6388
6417
|
FormValueService.prototype.populateLinkedCasesDetailsFromCaseFields = function (data, caseFields) {
|
|
6389
6418
|
if (data && caseFields && caseFields.length > 0) {
|
|
6390
|
-
caseFields.filter(function (caseField) { return !FieldsUtils.
|
|
6419
|
+
caseFields.filter(function (caseField) { return !FieldsUtils.isCaseFieldOfType(caseField, ['ComponentLauncher']); })
|
|
6391
6420
|
.forEach(function (caseField) {
|
|
6392
6421
|
if (data.hasOwnProperty('caseLinks') && caseField.value) {
|
|
6393
6422
|
data[caseField.id] = caseField.value;
|
|
@@ -9611,7 +9640,9 @@
|
|
|
9611
9640
|
form: this.form,
|
|
9612
9641
|
});
|
|
9613
9642
|
/* istanbul ignore else */
|
|
9614
|
-
if (!nextPage &&
|
|
9643
|
+
if (!nextPage &&
|
|
9644
|
+
!(this.eventTrigger.show_summary || this.eventTrigger.show_summary === null) &&
|
|
9645
|
+
!this.eventTrigger.show_event_notes) {
|
|
9615
9646
|
this.submitForm({
|
|
9616
9647
|
eventTrigger: this.eventTrigger,
|
|
9617
9648
|
form: this.form,
|
|
@@ -9703,16 +9734,13 @@
|
|
|
9703
9734
|
// Remove collection fields that have "min" validation of greater than zero set on the FieldType but are empty;
|
|
9704
9735
|
// these will fail validation
|
|
9705
9736
|
this.formValueService.removeEmptyCollectionsWithMinValidation(caseEventData.data, eventTrigger.case_fields);
|
|
9706
|
-
//
|
|
9707
|
-
//
|
|
9708
|
-
|
|
9709
|
-
|
|
9710
|
-
|
|
9711
|
-
|
|
9712
|
-
|
|
9713
|
-
this.formValueService.populateLinkedCasesDetailsFromCaseFields(caseEventData.data, eventTrigger.case_fields);
|
|
9714
|
-
this.formValueService.removeComponentLauncherField(caseEventData.data, eventTrigger.case_fields);
|
|
9715
|
-
}
|
|
9737
|
+
// For Case Flag submissions (where a FlagLauncher field is present in the event trigger), the flag details data
|
|
9738
|
+
// needs populating for each Flags field, then the FlagLauncher field needs removing
|
|
9739
|
+
this.formValueService.repopulateFormDataFromCaseFieldValues(caseEventData.data, eventTrigger.case_fields);
|
|
9740
|
+
// Data population step required for Linked Cases
|
|
9741
|
+
this.formValueService.populateLinkedCasesDetailsFromCaseFields(caseEventData.data, eventTrigger.case_fields);
|
|
9742
|
+
// Remove "Launcher"-type fields (these have no values and are not intended to be persisted)
|
|
9743
|
+
this.formValueService.removeCaseFieldsOfType(caseEventData.data, eventTrigger.case_fields, ['FlagLauncher', 'ComponentLauncher']);
|
|
9716
9744
|
caseEventData.event_token = eventTrigger.event_token;
|
|
9717
9745
|
caseEventData.ignore_warning = this.ignoreWarning;
|
|
9718
9746
|
if (this.confirmation) {
|
|
@@ -9834,8 +9862,7 @@
|
|
|
9834
9862
|
_this.sessionStorageService.removeItem('eventUrl');
|
|
9835
9863
|
var confirmation = _this.buildConfirmation(response);
|
|
9836
9864
|
if (confirmation && (confirmation.getHeader() || confirmation.getBody())) {
|
|
9837
|
-
|
|
9838
|
-
_this.confirm(confirmation).finally();
|
|
9865
|
+
_this.confirm(confirmation);
|
|
9839
9866
|
}
|
|
9840
9867
|
else {
|
|
9841
9868
|
_this.emitSubmitted(response);
|
|
@@ -23449,7 +23476,7 @@
|
|
|
23449
23476
|
i0__namespace.ɵɵadvance(4);
|
|
23450
23477
|
i0__namespace.ɵɵtextInterpolate(ctx.caseField.label);
|
|
23451
23478
|
i0__namespace.ɵɵadvance(4);
|
|
23452
|
-
i0__namespace.ɵɵproperty("ngForOf", i0__namespace.ɵɵpipeBind4(9, 2, ctx.caseField, false, undefined,
|
|
23479
|
+
i0__namespace.ɵɵproperty("ngForOf", i0__namespace.ɵɵpipeBind4(9, 2, ctx.caseField, false, undefined, true));
|
|
23453
23480
|
}
|
|
23454
23481
|
}, styles: [".complex-panel[_ngcontent-%COMP%]{margin:13px 0;border:1px solid #bfc1c3}.complex-panel[_ngcontent-%COMP%] .complex-panel-title[_ngcontent-%COMP%]{background-color:#dee0e2;border-bottom:1px solid #bfc1c3;display:block;color:#0b0c0c;padding:5px 5px 2px;font-family:nta,Arial,sans-serif;font-weight:700;text-transform:none;font-size:16px;line-height:1.25}@media (min-width:641px){.complex-panel[_ngcontent-%COMP%] .complex-panel-title[_ngcontent-%COMP%]{font-size:19px;line-height:1.3157894737}}.complex-panel[_ngcontent-%COMP%] .complex-panel-table[_ngcontent-%COMP%] > tbody[_ngcontent-%COMP%] > tr[_ngcontent-%COMP%] > th[_ngcontent-%COMP%]{vertical-align:top}.complex-panel[_ngcontent-%COMP%] .complex-panel-table[_ngcontent-%COMP%] > tbody[_ngcontent-%COMP%] > tr[_ngcontent-%COMP%]:last-child > td[_ngcontent-%COMP%], .complex-panel[_ngcontent-%COMP%] .complex-panel-table[_ngcontent-%COMP%] > tbody[_ngcontent-%COMP%] > tr[_ngcontent-%COMP%]:last-child > th[_ngcontent-%COMP%]{border-bottom:none}.complex-panel[_ngcontent-%COMP%] .complex-panel-simple-field[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{padding-left:5px;width:295px}.complex-panel[_ngcontent-%COMP%] .complex-panel-compound-field[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{padding:5px}"] });
|
|
23455
23482
|
var ɵReadComplexFieldTableComponent_BaseFactory = /*@__PURE__*/ i0__namespace.ɵɵgetInheritedFactory(ReadComplexFieldTableComponent);
|
|
@@ -26785,9 +26812,10 @@
|
|
|
26785
26812
|
this.contextFields = this.getCaseFields();
|
|
26786
26813
|
// Indicates if the submission is for a Case Flag, as opposed to a "regular" form submission, by the presence of
|
|
26787
26814
|
// a FlagLauncher field in the event trigger
|
|
26788
|
-
this.caseEdit.isCaseFlagSubmission =
|
|
26815
|
+
this.caseEdit.isCaseFlagSubmission =
|
|
26816
|
+
this.eventTrigger.case_fields.some(function (caseField) { return FieldsUtils.isCaseFieldOfType(caseField, ['FlagLauncher']); });
|
|
26789
26817
|
this.caseEdit.isLinkedCasesSubmission =
|
|
26790
|
-
this.eventTrigger.case_fields.some(function (caseField) { return FieldsUtils.
|
|
26818
|
+
this.eventTrigger.case_fields.some(function (caseField) { return FieldsUtils.isCaseFieldOfType(caseField, ['ComponentLauncher']); });
|
|
26791
26819
|
this.pageTitle = this.caseEdit.isCaseFlagSubmission ? 'Review flag details' : 'Check your answers';
|
|
26792
26820
|
};
|
|
26793
26821
|
CaseEditSubmitComponent.prototype.ngOnDestroy = function () {
|
|
@@ -26860,49 +26888,50 @@
|
|
|
26860
26888
|
CaseEditSubmitComponent.prototype.checkYourAnswerFieldsToDisplayExists = function () {
|
|
26861
26889
|
var e_1, _d, e_2, _e;
|
|
26862
26890
|
/* istanbul ignore else */
|
|
26863
|
-
if (
|
|
26864
|
-
|
|
26865
|
-
|
|
26866
|
-
|
|
26867
|
-
|
|
26868
|
-
|
|
26869
|
-
|
|
26870
|
-
|
|
26871
|
-
|
|
26872
|
-
|
|
26873
|
-
|
|
26874
|
-
|
|
26875
|
-
|
|
26876
|
-
|
|
26877
|
-
return true;
|
|
26891
|
+
if (this.eventTrigger.show_summary || this.eventTrigger.show_summary === null) {
|
|
26892
|
+
try {
|
|
26893
|
+
for (var _f = __values(this.wizard.pages), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
26894
|
+
var page = _g.value;
|
|
26895
|
+
/* istanbul ignore else */
|
|
26896
|
+
if (page.case_fields && this.isShown(page)) {
|
|
26897
|
+
try {
|
|
26898
|
+
for (var _h = (e_2 = void 0, __values(page.case_fields)), _j = _h.next(); !_j.done; _j = _h.next()) {
|
|
26899
|
+
var field = _j.value;
|
|
26900
|
+
/* istanbul ignore else */
|
|
26901
|
+
if (this.canShowFieldInCYA(field)) {
|
|
26902
|
+
// at least one field needs showing
|
|
26903
|
+
return true;
|
|
26904
|
+
}
|
|
26878
26905
|
}
|
|
26879
26906
|
}
|
|
26880
|
-
|
|
26881
|
-
|
|
26882
|
-
|
|
26883
|
-
|
|
26884
|
-
|
|
26907
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
26908
|
+
finally {
|
|
26909
|
+
try {
|
|
26910
|
+
if (_j && !_j.done && (_e = _h.return)) _e.call(_h);
|
|
26911
|
+
}
|
|
26912
|
+
finally { if (e_2) throw e_2.error; }
|
|
26885
26913
|
}
|
|
26886
|
-
finally { if (e_2) throw e_2.error; }
|
|
26887
26914
|
}
|
|
26888
26915
|
}
|
|
26889
26916
|
}
|
|
26890
|
-
|
|
26891
|
-
|
|
26892
|
-
|
|
26893
|
-
|
|
26894
|
-
|
|
26917
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
26918
|
+
finally {
|
|
26919
|
+
try {
|
|
26920
|
+
if (_g && !_g.done && (_d = _f.return)) _d.call(_f);
|
|
26921
|
+
}
|
|
26922
|
+
finally { if (e_1) throw e_1.error; }
|
|
26895
26923
|
}
|
|
26896
|
-
finally { if (e_1) throw e_1.error; }
|
|
26897
26924
|
}
|
|
26898
|
-
|
|
26899
|
-
|
|
26925
|
+
else {
|
|
26926
|
+
// found no fields to show in CYA summary page
|
|
26927
|
+
return false;
|
|
26928
|
+
}
|
|
26900
26929
|
};
|
|
26901
26930
|
CaseEditSubmitComponent.prototype.readOnlySummaryFieldsToDisplayExists = function () {
|
|
26902
26931
|
return this.eventTrigger.case_fields.some(function (field) { return field.show_summary_content_option >= 0; });
|
|
26903
26932
|
};
|
|
26904
26933
|
CaseEditSubmitComponent.prototype.showEventNotes = function () {
|
|
26905
|
-
return this.eventTrigger.show_event_notes
|
|
26934
|
+
return !!this.eventTrigger.show_event_notes;
|
|
26906
26935
|
};
|
|
26907
26936
|
CaseEditSubmitComponent.prototype.getLastPageShown = function () {
|
|
26908
26937
|
var _this = this;
|