@hmcts/ccd-case-ui-toolkit 7.3.75-case-search-v2 → 7.3.75-exui-4212-rc-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.
|
@@ -8121,9 +8121,6 @@ class RequestOptionsBuilder {
|
|
|
8121
8121
|
* @param value The value to be assessed.
|
|
8122
8122
|
*/
|
|
8123
8123
|
static includeParam(value) {
|
|
8124
|
-
if (Array.isArray(value)) {
|
|
8125
|
-
return value.some(item => RequestOptionsBuilder.includeParam(item));
|
|
8126
|
-
}
|
|
8127
8124
|
/* istanbul ignore else */
|
|
8128
8125
|
if (value) {
|
|
8129
8126
|
/* istanbul ignore else */
|
|
@@ -8134,36 +8131,6 @@ class RequestOptionsBuilder {
|
|
|
8134
8131
|
}
|
|
8135
8132
|
return false;
|
|
8136
8133
|
}
|
|
8137
|
-
static sanitiseValue(value) {
|
|
8138
|
-
const trimmedValue = value.trim ? value.trim() : value;
|
|
8139
|
-
return trimmedValue.replace ? trimmedValue.replace(/’/i, `'`) : trimmedValue;
|
|
8140
|
-
}
|
|
8141
|
-
static getValueByPath(value, path) {
|
|
8142
|
-
return path.split('.').reduce((currentValue, pathPart) => {
|
|
8143
|
-
if (currentValue === undefined || currentValue === null) {
|
|
8144
|
-
return undefined;
|
|
8145
|
-
}
|
|
8146
|
-
return currentValue[pathPart];
|
|
8147
|
-
}, value);
|
|
8148
|
-
}
|
|
8149
|
-
static getCollectionValues(value, criterion) {
|
|
8150
|
-
if (!Array.isArray(value) ||
|
|
8151
|
-
!criterion.includes('.value.') ||
|
|
8152
|
-
value.some(item => item === null || typeof item !== 'object' || !Object.hasOwn(item, 'value'))) {
|
|
8153
|
-
return value;
|
|
8154
|
-
}
|
|
8155
|
-
const valuePath = criterion.substring(criterion.indexOf('.value.') + 1);
|
|
8156
|
-
return value.map(item => RequestOptionsBuilder.getValueByPath(item, valuePath));
|
|
8157
|
-
}
|
|
8158
|
-
static appendParam(params, key, value) {
|
|
8159
|
-
if (Array.isArray(value)) {
|
|
8160
|
-
const values = value
|
|
8161
|
-
.filter(item => RequestOptionsBuilder.includeParam(item))
|
|
8162
|
-
.map(item => RequestOptionsBuilder.sanitiseValue(item));
|
|
8163
|
-
return params.set(key, `[${values.join(', ')}]`);
|
|
8164
|
-
}
|
|
8165
|
-
return params.set(key, RequestOptionsBuilder.sanitiseValue(value));
|
|
8166
|
-
}
|
|
8167
8134
|
buildOptions(metaCriteria, caseCriteria, view) {
|
|
8168
8135
|
// TODO: This should probably be the now built-in URLSearchParams but it
|
|
8169
8136
|
// requires a bigger refactor and there are bigger fish to fry right now.
|
|
@@ -8188,7 +8155,8 @@ class RequestOptionsBuilder {
|
|
|
8188
8155
|
/* istanbul ignore else */
|
|
8189
8156
|
if (RequestOptionsBuilder.includeParam(caseCriteria[criterion])) {
|
|
8190
8157
|
const key = RequestOptionsBuilder.FIELD_PREFIX + criterion;
|
|
8191
|
-
|
|
8158
|
+
const value = caseCriteria[criterion].trim ? caseCriteria[criterion].trim() : caseCriteria[criterion];
|
|
8159
|
+
params = params.set(key, value.replace(/’/i, `'`));
|
|
8192
8160
|
}
|
|
8193
8161
|
}
|
|
8194
8162
|
}
|
|
@@ -10009,8 +9977,10 @@ class CaseEditComponent {
|
|
|
10009
9977
|
return form.value.event.id;
|
|
10010
9978
|
}
|
|
10011
9979
|
generateCaseEventData({ eventTrigger, form }) {
|
|
9980
|
+
const formData = this.replaceHiddenFormValuesWithOriginalCaseData(form.get('data'), eventTrigger.case_fields);
|
|
9981
|
+
this.formValueService.sanitiseDynamicLists(eventTrigger.case_fields, { data: formData });
|
|
10012
9982
|
const caseEventData = {
|
|
10013
|
-
data: this.replaceEmptyComplexFieldValues(this.formValueService.sanitise(
|
|
9983
|
+
data: this.replaceEmptyComplexFieldValues(this.formValueService.sanitise(formData, this.isCaseFlagSubmission)),
|
|
10014
9984
|
event: form.value.event
|
|
10015
9985
|
};
|
|
10016
9986
|
this.formValueService.clearNonCaseFields(caseEventData.data, eventTrigger.case_fields);
|