@hmcts/ccd-case-ui-toolkit 6.13.0-rc1 → 6.13.0-test1
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 +234 -381
- 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-viewer/case-full-access-view/case-full-access-view.component.js +1 -15
- package/esm2015/lib/shared/components/palette/case-file-view/components/case-file-view-folder-selector/case-file-view-folder-selector.component.js +1 -1
- package/esm2015/lib/shared/components/palette/case-flag/components/select-flag-type/select-flag-type.component.js +15 -13
- package/esm2015/lib/shared/components/palette/case-flag/write-case-flag-field.component.js +8 -11
- package/esm2015/lib/shared/components/palette/datetime-picker/datetime-picker.component.js +3 -10
- package/esm2015/lib/shared/components/search-result/search-result.component.js +14 -10
- package/esm2015/lib/shared/directives/conditional-show/domain/conditional-show.model.js +200 -103
- package/esm2015/lib/shared/domain/case-flag/hmcts-service-detail.model.js +1 -1
- package/esm2015/lib/shared/services/case-flag/case-flag-refdata.service.js +4 -25
- package/fesm2015/hmcts-ccd-case-ui-toolkit.js +215 -443
- package/fesm2015/hmcts-ccd-case-ui-toolkit.js.map +1 -1
- package/lib/shared/components/case-viewer/case-full-access-view/case-full-access-view.component.d.ts +0 -1
- package/lib/shared/components/case-viewer/case-full-access-view/case-full-access-view.component.d.ts.map +1 -1
- package/lib/shared/components/palette/case-flag/components/select-flag-type/select-flag-type.component.d.ts +1 -2
- package/lib/shared/components/palette/case-flag/components/select-flag-type/select-flag-type.component.d.ts.map +1 -1
- package/lib/shared/components/palette/case-flag/write-case-flag-field.component.d.ts +0 -1
- package/lib/shared/components/palette/case-flag/write-case-flag-field.component.d.ts.map +1 -1
- package/lib/shared/components/palette/datetime-picker/datetime-picker.component.d.ts.map +1 -1
- package/lib/shared/directives/conditional-show/domain/conditional-show.model.d.ts +30 -13
- package/lib/shared/directives/conditional-show/domain/conditional-show.model.d.ts.map +1 -1
- package/lib/shared/domain/case-flag/hmcts-service-detail.model.d.ts.map +1 -1
- package/lib/shared/services/case-flag/case-flag-refdata.service.d.ts +3 -14
- package/lib/shared/services/case-flag/case-flag-refdata.service.d.ts.map +1 -1
- package/package.json +1 -1
- package/esm2015/lib/shared/directives/conditional-show/services/condition-parser.service.js +0 -201
- package/esm2015/lib/shared/directives/conditional-show/services/condition.peg.js +0 -90
- package/lib/shared/directives/conditional-show/services/condition-parser.service.d.ts +0 -30
- package/lib/shared/directives/conditional-show/services/condition-parser.service.d.ts.map +0 -1
- package/lib/shared/directives/conditional-show/services/condition.peg.d.ts +0 -3
- package/lib/shared/directives/conditional-show/services/condition.peg.d.ts.map +0 -1
|
@@ -12,10 +12,9 @@ import * as i1$2 from '@angular/common/http';
|
|
|
12
12
|
import { HttpErrorResponse, HttpHeaders, HttpParams } from '@angular/common/http';
|
|
13
13
|
import { catchError, map, publish, refCount, debounceTime, delay, distinctUntilChanged, finalize, publishReplay, take, tap, first, switchMap, takeUntil, filter } from 'rxjs/operators';
|
|
14
14
|
import { Type, Expose, plainToClassFromExist, plainToClass } from 'class-transformer';
|
|
15
|
+
import * as _ from 'underscore';
|
|
15
16
|
import * as moment from 'moment';
|
|
16
17
|
import { __decorate, __metadata } from 'tslib';
|
|
17
|
-
import * as _ from 'underscore';
|
|
18
|
-
import { generate } from 'pegjs';
|
|
19
18
|
import { isUndefined } from 'util';
|
|
20
19
|
import { StateMachine } from '@edium/fsm';
|
|
21
20
|
import * as i1$3 from '@angular/material/dialog';
|
|
@@ -3800,173 +3799,104 @@ FieldsUtils.ɵprov = i0.ɵɵdefineInjectable({ token: FieldsUtils, factory: Fiel
|
|
|
3800
3799
|
type: Injectable
|
|
3801
3800
|
}], null, null); })();
|
|
3802
3801
|
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
};
|
|
3814
|
-
|
|
3815
|
-
return flatten(arr, depth - 1);
|
|
3816
|
-
}
|
|
3817
|
-
}
|
|
3818
|
-
|
|
3819
|
-
Start
|
|
3820
|
-
= Formula
|
|
3821
|
-
|
|
3822
|
-
Formula
|
|
3823
|
-
= EnclosedFormula
|
|
3824
|
-
/ OpenFormula
|
|
3825
|
-
|
|
3826
|
-
EnclosedFormula
|
|
3827
|
-
= bracket formula:OpenFormula bracket join:(JoinComparator)*
|
|
3828
|
-
{ return flat([ [formula], join[0] ], 1) }
|
|
3829
|
-
|
|
3830
|
-
OpenFormula
|
|
3831
|
-
= eq:OpenEqualityCheck joins:(JoinComparator)*
|
|
3832
|
-
{ return flat([ eq, flat(joins) ]) }
|
|
3833
|
-
|
|
3834
|
-
JoinComparator
|
|
3835
|
-
= comp:Comparator eq:OpenEqualityCheck
|
|
3836
|
-
{ return [comp, eq]; }
|
|
3837
|
-
/ CompoundJoinComparator
|
|
3838
|
-
|
|
3839
|
-
CompoundJoinComparator
|
|
3840
|
-
= comp:Comparator bracket f:OpenFormula bracket
|
|
3841
|
-
{ return [comp, f ] }
|
|
3842
|
-
|
|
3843
|
-
OpenEqualityCheck
|
|
3844
|
-
= fr:FieldReference _? op:operator _? val:Value
|
|
3845
|
-
{ return { fieldReference: fr, comparator: op, value: val } }
|
|
3846
|
-
|
|
3847
|
-
Comparator
|
|
3848
|
-
= _? c:'AND' _?
|
|
3849
|
-
{ return c; }
|
|
3850
|
-
/ _? c:'OR' _?
|
|
3851
|
-
{ return c; }
|
|
3852
|
-
|
|
3853
|
-
Word
|
|
3854
|
-
= l:Letter+
|
|
3855
|
-
{ return l.join(""); }
|
|
3856
|
-
|
|
3857
|
-
Letter
|
|
3858
|
-
= [a-zA-Z]
|
|
3859
|
-
|
|
3860
|
-
Value
|
|
3861
|
-
= v:quotedValue / v:Word
|
|
3862
|
-
{ return v.join("") }
|
|
3863
|
-
/ v:number
|
|
3864
|
-
{ return parseInt(v.join("")) }
|
|
3865
|
-
|
|
3866
|
-
FieldReference
|
|
3867
|
-
= characters:[A-Za-z0-9._]+ { return characters.join(""); }
|
|
3868
|
-
|
|
3869
|
-
number
|
|
3870
|
-
= [0-9]+
|
|
3871
|
-
|
|
3872
|
-
quotedValue
|
|
3873
|
-
= '"'val:[A-Za-z0-9.,* _-]*'"'
|
|
3874
|
-
{ return val.join(""); }
|
|
3875
|
-
|
|
3876
|
-
bracket
|
|
3877
|
-
= (_? "("+ _? / _? ")"+ _? )
|
|
3878
|
-
|
|
3879
|
-
operator
|
|
3880
|
-
= "=" / "!=" / "CONTAINS"
|
|
3881
|
-
|
|
3882
|
-
ws "Whitespace"
|
|
3883
|
-
= [ \t]
|
|
3884
|
-
|
|
3885
|
-
_ "One or more whitespaces"
|
|
3886
|
-
= ws+
|
|
3887
|
-
|
|
3888
|
-
nl "New line"
|
|
3889
|
-
= "\\n"`;
|
|
3890
|
-
var peg = generate(conditionSource);
|
|
3891
|
-
|
|
3892
|
-
class ConditionParser {
|
|
3893
|
-
/**
|
|
3894
|
-
* Parse the raw formula and output structured condition data
|
|
3895
|
-
* that can be used in evaluating show/hide logic
|
|
3896
|
-
* @param condition raw formula e.g. TextField = "Hello"
|
|
3897
|
-
*/
|
|
3898
|
-
static parse(condition) {
|
|
3899
|
-
if (!condition) {
|
|
3900
|
-
return null;
|
|
3901
|
-
}
|
|
3902
|
-
;
|
|
3903
|
-
condition = condition.replace(/CONTAINS/g, ' CONTAINS');
|
|
3904
|
-
return peg.parse(condition.trim(), {});
|
|
3905
|
-
}
|
|
3906
|
-
/**
|
|
3907
|
-
* Evaluate the current fields against the conditions
|
|
3908
|
-
* @param fields the current page fields and their value
|
|
3909
|
-
* @param conditions The PegJS formula output
|
|
3910
|
-
*/
|
|
3911
|
-
static evaluate(fields, conditions, path) {
|
|
3912
|
-
if (!conditions) {
|
|
3913
|
-
return true;
|
|
3914
|
-
}
|
|
3915
|
-
;
|
|
3916
|
-
const validJoinComparators = ['AND', 'OR'];
|
|
3917
|
-
const result = conditions.reduce((accumulator, condition, index) => {
|
|
3918
|
-
const isJoinComparator = (comparator) => (typeof comparator === 'string' && validJoinComparators.indexOf(comparator) !== -1);
|
|
3919
|
-
if (isJoinComparator(condition)) {
|
|
3920
|
-
return accumulator;
|
|
3921
|
-
}
|
|
3922
|
-
;
|
|
3923
|
-
let currentConditionResult = true;
|
|
3924
|
-
if (Array.isArray(condition)) {
|
|
3925
|
-
currentConditionResult = this.evaluate(fields, condition);
|
|
3926
|
-
if (isJoinComparator(conditions[index - 1])) {
|
|
3927
|
-
return this.evaluateJoin(accumulator, conditions[index - 1], currentConditionResult);
|
|
3928
|
-
}
|
|
3929
|
-
}
|
|
3930
|
-
if (condition.comparator) {
|
|
3931
|
-
const formula = condition.fieldReference + condition.comparator + condition.value;
|
|
3932
|
-
currentConditionResult = this.matchEqualityCondition(fields, formula, path);
|
|
3802
|
+
class ShowCondition {
|
|
3803
|
+
// Expects a show condition of the form: <fieldName>="string"
|
|
3804
|
+
constructor(condition) {
|
|
3805
|
+
this.condition = condition;
|
|
3806
|
+
this.orConditions = null;
|
|
3807
|
+
this.andConditions = null;
|
|
3808
|
+
if (!!condition) {
|
|
3809
|
+
if (condition.search(ShowCondition.OR_CONDITION_REGEXP) !== -1) {
|
|
3810
|
+
this.orConditions = condition.split(ShowCondition.OR_CONDITION_REGEXP);
|
|
3933
3811
|
}
|
|
3934
|
-
|
|
3935
|
-
|
|
3812
|
+
else {
|
|
3813
|
+
this.andConditions = condition.split(ShowCondition.AND_CONDITION_REGEXP);
|
|
3936
3814
|
}
|
|
3937
|
-
return currentConditionResult;
|
|
3938
|
-
}, true);
|
|
3939
|
-
return result;
|
|
3940
|
-
}
|
|
3941
|
-
static evaluateJoin(leftResult, comparator, rightResult) {
|
|
3942
|
-
switch (comparator) {
|
|
3943
|
-
case 'OR': return leftResult || rightResult;
|
|
3944
|
-
case 'AND': return leftResult && rightResult;
|
|
3945
3815
|
}
|
|
3946
3816
|
}
|
|
3947
|
-
static
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3817
|
+
static addPathPrefixToCondition(showCondition, pathPrefix) {
|
|
3818
|
+
if (!pathPrefix || pathPrefix === '') {
|
|
3819
|
+
return showCondition;
|
|
3820
|
+
}
|
|
3821
|
+
if (showCondition.search(ShowCondition.OR_CONDITION_REGEXP) !== -1) {
|
|
3822
|
+
let orConditions = showCondition.split(ShowCondition.OR_CONDITION_REGEXP);
|
|
3823
|
+
orConditions = this.extractConditions(orConditions, pathPrefix);
|
|
3824
|
+
return orConditions.join(' OR ');
|
|
3954
3825
|
}
|
|
3955
3826
|
else {
|
|
3956
|
-
|
|
3827
|
+
let andConditions = showCondition.split(ShowCondition.AND_CONDITION_REGEXP);
|
|
3828
|
+
andConditions = this.extractConditions(andConditions, pathPrefix);
|
|
3829
|
+
return andConditions.join(' AND ');
|
|
3957
3830
|
}
|
|
3958
3831
|
}
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3832
|
+
// Cache instances so that we can cache results more effectively
|
|
3833
|
+
static getInstance(condition) {
|
|
3834
|
+
let instance = this.instanceCache.get(condition);
|
|
3835
|
+
if (!instance) {
|
|
3836
|
+
instance = new ShowCondition(condition);
|
|
3837
|
+
this.instanceCache.set(condition, instance);
|
|
3962
3838
|
}
|
|
3963
|
-
|
|
3964
|
-
|
|
3839
|
+
return instance;
|
|
3840
|
+
}
|
|
3841
|
+
/**
|
|
3842
|
+
* Determine whether a ShowCondition model is affected by fields that have
|
|
3843
|
+
* a display_context of HIDDEN or READONLY, which means they aren't able to
|
|
3844
|
+
* be changed by the user's actions.
|
|
3845
|
+
*
|
|
3846
|
+
* @param showCondition The ShowCondition model to evaluate.
|
|
3847
|
+
* @param caseFields Inspected to see appropriate display_contexts.
|
|
3848
|
+
*/
|
|
3849
|
+
static hiddenCannotChange(showCondition, caseFields) {
|
|
3850
|
+
if (showCondition && caseFields) {
|
|
3851
|
+
const conditions = showCondition.andConditions || showCondition.orConditions;
|
|
3852
|
+
if (conditions && conditions.length > 0) {
|
|
3853
|
+
let allUnchangeable = true;
|
|
3854
|
+
for (const condition of conditions) {
|
|
3855
|
+
const [field] = ShowCondition.getField(condition);
|
|
3856
|
+
const path = field.split('.');
|
|
3857
|
+
let head = path.shift();
|
|
3858
|
+
let caseField = caseFields.find(cf => cf.id === head);
|
|
3859
|
+
while (path.length > 0) {
|
|
3860
|
+
head = path.shift();
|
|
3861
|
+
if (caseField) {
|
|
3862
|
+
// Jump out if this is HIDDEN or READONLY, regardless of whether or not it's
|
|
3863
|
+
// complex or a collection - nested fields will "inherit" the display_context.
|
|
3864
|
+
if (['HIDDEN', 'READONLY'].indexOf(caseField.display_context) > -1) {
|
|
3865
|
+
break;
|
|
3866
|
+
}
|
|
3867
|
+
// Consider what type of field this is.
|
|
3868
|
+
const ft = caseField.field_type;
|
|
3869
|
+
switch (ft.type) {
|
|
3870
|
+
case 'Collection':
|
|
3871
|
+
if (ft.collection_field_type.type === 'Complex' && ft.collection_field_type.complex_fields) {
|
|
3872
|
+
caseField = ft.collection_field_type.complex_fields.find(cf => cf.id === head);
|
|
3873
|
+
}
|
|
3874
|
+
break;
|
|
3875
|
+
case 'Complex':
|
|
3876
|
+
if (ft.complex_fields) {
|
|
3877
|
+
caseField = ft.complex_fields.find(cf => cf.id === head);
|
|
3878
|
+
}
|
|
3879
|
+
break;
|
|
3880
|
+
}
|
|
3881
|
+
}
|
|
3882
|
+
}
|
|
3883
|
+
if (caseField) {
|
|
3884
|
+
allUnchangeable = allUnchangeable && ['HIDDEN', 'READONLY'].indexOf(caseField.display_context) > -1;
|
|
3885
|
+
}
|
|
3886
|
+
}
|
|
3887
|
+
return allUnchangeable;
|
|
3888
|
+
}
|
|
3965
3889
|
}
|
|
3890
|
+
return false;
|
|
3966
3891
|
}
|
|
3967
|
-
static
|
|
3968
|
-
|
|
3969
|
-
(
|
|
3892
|
+
static extractConditions(conditionsArray, pathPrefix) {
|
|
3893
|
+
const extracted = conditionsArray.map(condition => {
|
|
3894
|
+
if (condition.startsWith(pathPrefix)) {
|
|
3895
|
+
return condition;
|
|
3896
|
+
}
|
|
3897
|
+
return `${pathPrefix}.${condition}`;
|
|
3898
|
+
});
|
|
3899
|
+
return extracted;
|
|
3970
3900
|
}
|
|
3971
3901
|
static getField(condition) {
|
|
3972
3902
|
let separator = ShowCondition.CONTAINS;
|
|
@@ -3978,7 +3908,70 @@ class ConditionParser {
|
|
|
3978
3908
|
}
|
|
3979
3909
|
return [condition.split(separator)[0], separator];
|
|
3980
3910
|
}
|
|
3981
|
-
|
|
3911
|
+
match(fields, path) {
|
|
3912
|
+
if (!this.condition) {
|
|
3913
|
+
return true;
|
|
3914
|
+
}
|
|
3915
|
+
return this.matchAndConditions(fields, this.updatePathName(path));
|
|
3916
|
+
}
|
|
3917
|
+
matchByContextFields(contextFields) {
|
|
3918
|
+
return this.match(FieldsUtils.toValuesMap(contextFields));
|
|
3919
|
+
}
|
|
3920
|
+
/**
|
|
3921
|
+
* Determine whether this is affected by fields that have a display_context
|
|
3922
|
+
* of HIDDEN or READONLY, which means they aren't able to be changed by the
|
|
3923
|
+
* user's actions.
|
|
3924
|
+
*
|
|
3925
|
+
* @param caseFields Inspected to see appropriate display_contexts.
|
|
3926
|
+
*/
|
|
3927
|
+
hiddenCannotChange(caseFields) {
|
|
3928
|
+
return ShowCondition.hiddenCannotChange(this, caseFields);
|
|
3929
|
+
}
|
|
3930
|
+
/**
|
|
3931
|
+
* Path Name gets updated for complex sub fields
|
|
3932
|
+
* @param path Path name.
|
|
3933
|
+
*/
|
|
3934
|
+
updatePathName(path) {
|
|
3935
|
+
if (path && path.split(/[_]+/g).length > 0) {
|
|
3936
|
+
const [pathName, ...pathTail] = path.split(/[_]+/g);
|
|
3937
|
+
const pathFinalIndex = pathTail.pop();
|
|
3938
|
+
const pathTailString = pathTail.toString();
|
|
3939
|
+
let mappedPathTail;
|
|
3940
|
+
mappedPathTail = pathTail.map((value) => {
|
|
3941
|
+
return Number(pathFinalIndex) === Number(value) ? pathName : value;
|
|
3942
|
+
});
|
|
3943
|
+
return pathTailString !== mappedPathTail.toString()
|
|
3944
|
+
? `${pathName}_${mappedPathTail.join('_')}_${pathFinalIndex}`
|
|
3945
|
+
: path;
|
|
3946
|
+
}
|
|
3947
|
+
else {
|
|
3948
|
+
return path;
|
|
3949
|
+
}
|
|
3950
|
+
}
|
|
3951
|
+
matchAndConditions(fields, path) {
|
|
3952
|
+
if (!!this.orConditions) {
|
|
3953
|
+
return this.orConditions.some(orCondition => this.matchEqualityCondition(fields, orCondition, path));
|
|
3954
|
+
}
|
|
3955
|
+
else if (!!this.andConditions) {
|
|
3956
|
+
return this.andConditions.every(andCondition => this.matchEqualityCondition(fields, andCondition, path));
|
|
3957
|
+
}
|
|
3958
|
+
else {
|
|
3959
|
+
return false;
|
|
3960
|
+
}
|
|
3961
|
+
}
|
|
3962
|
+
matchEqualityCondition(fields, condition, path) {
|
|
3963
|
+
const [field, conditionSeparator] = ShowCondition.getField(condition);
|
|
3964
|
+
const [head, ...tail] = field.split('.');
|
|
3965
|
+
const currentValue = this.findValueForComplexCondition(fields, head, tail, path);
|
|
3966
|
+
const expectedValue = this.unquoted(condition.split(conditionSeparator)[1]);
|
|
3967
|
+
if (conditionSeparator === ShowCondition.CONTAINS) {
|
|
3968
|
+
return this.checkValueContains(expectedValue, currentValue);
|
|
3969
|
+
}
|
|
3970
|
+
else {
|
|
3971
|
+
return this.checkValueEquals(expectedValue, currentValue, conditionSeparator);
|
|
3972
|
+
}
|
|
3973
|
+
}
|
|
3974
|
+
checkValueEquals(expectedValue, currentValue, conditionSeparaor) {
|
|
3982
3975
|
if (expectedValue.search('[,]') > -1) { // for multi-select list
|
|
3983
3976
|
return this.checkMultiSelectListEquals(expectedValue, currentValue, conditionSeparaor);
|
|
3984
3977
|
}
|
|
@@ -3998,7 +3991,7 @@ class ConditionParser {
|
|
|
3998
3991
|
}
|
|
3999
3992
|
}
|
|
4000
3993
|
}
|
|
4001
|
-
|
|
3994
|
+
checkValueNotEquals(expectedValue, currentValue) {
|
|
4002
3995
|
const formatCurrentValue = currentValue ? currentValue.toString().trim() : '';
|
|
4003
3996
|
if ('*' === expectedValue && formatCurrentValue !== '') {
|
|
4004
3997
|
return false;
|
|
@@ -4006,7 +3999,7 @@ class ConditionParser {
|
|
|
4006
3999
|
const formatExpectedValue = expectedValue ? expectedValue.toString().trim() : '';
|
|
4007
4000
|
return formatCurrentValue != formatExpectedValue; // tslint:disable-line
|
|
4008
4001
|
}
|
|
4009
|
-
|
|
4002
|
+
checkMultiSelectListEquals(expectedValue, currentValue, conditionSeparator) {
|
|
4010
4003
|
const expectedValues = expectedValue.split(',').sort().toString();
|
|
4011
4004
|
const values = currentValue ? currentValue.sort().toString() : '';
|
|
4012
4005
|
if (conditionSeparator === ShowCondition.CONDITION_NOT_EQUALS) {
|
|
@@ -4016,7 +4009,7 @@ class ConditionParser {
|
|
|
4016
4009
|
return expectedValues === values;
|
|
4017
4010
|
}
|
|
4018
4011
|
}
|
|
4019
|
-
|
|
4012
|
+
checkValueContains(expectedValue, currentValue) {
|
|
4020
4013
|
if (expectedValue.search(',') > -1) {
|
|
4021
4014
|
const expectedValues = expectedValue.split(',').sort();
|
|
4022
4015
|
const values = currentValue ? currentValue.sort().toString() : '';
|
|
@@ -4027,11 +4020,7 @@ class ConditionParser {
|
|
|
4027
4020
|
return values.search(expectedValue) >= 0;
|
|
4028
4021
|
}
|
|
4029
4022
|
}
|
|
4030
|
-
|
|
4031
|
-
const res = str.replace(/^"|"$/g, '');
|
|
4032
|
-
return res;
|
|
4033
|
-
}
|
|
4034
|
-
static findValueForComplexCondition(fields, head, tail, path) {
|
|
4023
|
+
findValueForComplexCondition(fields, head, tail, path) {
|
|
4035
4024
|
if (!fields) {
|
|
4036
4025
|
return undefined;
|
|
4037
4026
|
}
|
|
@@ -4047,7 +4036,7 @@ class ConditionParser {
|
|
|
4047
4036
|
}
|
|
4048
4037
|
}
|
|
4049
4038
|
}
|
|
4050
|
-
|
|
4039
|
+
findValueForComplexConditionForPathIfAny(fields, head, tail, path) {
|
|
4051
4040
|
if (path) {
|
|
4052
4041
|
const [_, ...pathTail] = path.split(/[_]+/g);
|
|
4053
4042
|
return this.findValueForComplexCondition(fields[head], tail[0], tail.slice(1), pathTail.join('_'));
|
|
@@ -4056,9 +4045,9 @@ class ConditionParser {
|
|
|
4056
4045
|
return this.findValueForComplexCondition(fields[head], tail[0], tail.slice(1), path);
|
|
4057
4046
|
}
|
|
4058
4047
|
}
|
|
4059
|
-
|
|
4048
|
+
findValueForComplexConditionInArray(fields, head, tail, path) {
|
|
4060
4049
|
// use the path to resolve which array element we refer to
|
|
4061
|
-
if (path.startsWith(head)) {
|
|
4050
|
+
if (path && path.startsWith(head)) {
|
|
4062
4051
|
const [_, ...pathTail] = path.split(/[_]+/g);
|
|
4063
4052
|
if (pathTail.length > 0) {
|
|
4064
4053
|
try {
|
|
@@ -4067,221 +4056,42 @@ class ConditionParser {
|
|
|
4067
4056
|
return (fields[head][arrayIndex] !== undefined) ? this.findValueForComplexCondition(fields[head][arrayIndex]['value'], tail[0], tail.slice(1), dropNumberPath.join('_')) : null;
|
|
4068
4057
|
}
|
|
4069
4058
|
catch (e) {
|
|
4070
|
-
console.
|
|
4059
|
+
console.log('Error while parsing number', pathTail[0], e);
|
|
4071
4060
|
}
|
|
4072
4061
|
}
|
|
4073
4062
|
}
|
|
4074
4063
|
else {
|
|
4075
|
-
console.
|
|
4076
|
-
}
|
|
4077
|
-
}
|
|
4078
|
-
static removeStarChar(str) {
|
|
4079
|
-
if (str && str.indexOf('*') > -1) {
|
|
4080
|
-
return str.substring(0, str.indexOf('*'));
|
|
4081
|
-
}
|
|
4082
|
-
return str;
|
|
4083
|
-
}
|
|
4084
|
-
static okIfBothEmpty(right, value) {
|
|
4085
|
-
return value === null && (right === '');
|
|
4086
|
-
}
|
|
4087
|
-
}
|
|
4088
|
-
|
|
4089
|
-
class ShowCondition {
|
|
4090
|
-
// Expects a show condition of the form: <fieldName>="string"
|
|
4091
|
-
constructor(condition) {
|
|
4092
|
-
this.condition = condition;
|
|
4093
|
-
this.conditions = [];
|
|
4094
|
-
if (!!condition) {
|
|
4095
|
-
this.conditions = ConditionParser.parse(condition);
|
|
4096
|
-
}
|
|
4097
|
-
}
|
|
4098
|
-
static addPathPrefixToCondition(showCondition, pathPrefix) {
|
|
4099
|
-
if (!pathPrefix || pathPrefix === '') {
|
|
4100
|
-
return showCondition;
|
|
4101
|
-
}
|
|
4102
|
-
if (!showCondition) {
|
|
4103
|
-
return '';
|
|
4104
|
-
}
|
|
4105
|
-
const formula = ConditionParser.parse(showCondition);
|
|
4106
|
-
if (!formula) {
|
|
4107
|
-
return showCondition;
|
|
4108
|
-
}
|
|
4109
|
-
this.processedList = [];
|
|
4110
|
-
showCondition = showCondition.replace(/CONTAINS/g, ' CONTAINS');
|
|
4111
|
-
const processedCondition = this.processAddPathPrefixToCondition(formula, pathPrefix, showCondition);
|
|
4112
|
-
return processedCondition.replace(/ CONTAINS/g, 'CONTAINS');
|
|
4113
|
-
}
|
|
4114
|
-
static processAddPathPrefixToCondition(formula, pathPrefix, originalCondition) {
|
|
4115
|
-
let finalCondition = originalCondition;
|
|
4116
|
-
if (Array.isArray(formula)) {
|
|
4117
|
-
formula.forEach(condition => {
|
|
4118
|
-
if (typeof condition === 'string' && this.validJoinComparators.indexOf(condition) !== -1) {
|
|
4119
|
-
// do nothing
|
|
4120
|
-
}
|
|
4121
|
-
else {
|
|
4122
|
-
if (Array.isArray(condition)) {
|
|
4123
|
-
finalCondition = this.processAddPathPrefixToCondition(condition, pathPrefix, finalCondition);
|
|
4124
|
-
}
|
|
4125
|
-
else {
|
|
4126
|
-
finalCondition = this.extractConditions(condition, pathPrefix, finalCondition);
|
|
4127
|
-
}
|
|
4128
|
-
}
|
|
4129
|
-
});
|
|
4130
|
-
}
|
|
4131
|
-
else {
|
|
4132
|
-
finalCondition = this.extractConditions(formula, pathPrefix, finalCondition);
|
|
4064
|
+
console.log('Path in formArray should start with ', head, ', full path: ', path);
|
|
4133
4065
|
}
|
|
4134
|
-
return finalCondition;
|
|
4135
4066
|
}
|
|
4136
|
-
|
|
4137
|
-
if (
|
|
4138
|
-
return
|
|
4067
|
+
getValue(fields, head) {
|
|
4068
|
+
if (this.isDynamicList(fields[head])) {
|
|
4069
|
+
return fields[head].value.code;
|
|
4139
4070
|
}
|
|
4140
4071
|
else {
|
|
4141
|
-
|
|
4142
|
-
if (this.processedList && this.processedList.indexOf(condition.fieldReference) === -1) {
|
|
4143
|
-
this.processedList.push(condition.fieldReference);
|
|
4144
|
-
const regularExp = new RegExp('(\\b)' + condition.fieldReference + '(?=[^"]*(?:"[^"]*"[^"]*)*$)(\\b)', 'g');
|
|
4145
|
-
return originalCondition.replace(regularExp, pathPrefix + '.' + condition.fieldReference);
|
|
4146
|
-
}
|
|
4147
|
-
else {
|
|
4148
|
-
return originalCondition;
|
|
4149
|
-
}
|
|
4150
|
-
}
|
|
4151
|
-
}
|
|
4152
|
-
}
|
|
4153
|
-
// Cache instances so that we can cache results more effectively
|
|
4154
|
-
static getInstance(condition) {
|
|
4155
|
-
let instance = this.instanceCache.get(condition);
|
|
4156
|
-
if (!instance) {
|
|
4157
|
-
instance = new ShowCondition(condition);
|
|
4158
|
-
this.instanceCache.set(condition, instance);
|
|
4159
|
-
}
|
|
4160
|
-
return instance;
|
|
4161
|
-
}
|
|
4162
|
-
static getField(condition) {
|
|
4163
|
-
let separator = ShowCondition.CONTAINS;
|
|
4164
|
-
if (condition.indexOf(ShowCondition.CONTAINS) < 0) {
|
|
4165
|
-
separator = ShowCondition.CONDITION_EQUALS;
|
|
4166
|
-
if (condition.indexOf(ShowCondition.CONDITION_NOT_EQUALS) > -1) {
|
|
4167
|
-
separator = ShowCondition.CONDITION_NOT_EQUALS;
|
|
4168
|
-
}
|
|
4169
|
-
}
|
|
4170
|
-
return [condition.split(separator)[0], separator];
|
|
4171
|
-
}
|
|
4172
|
-
static getConditions(formula) {
|
|
4173
|
-
const conditionList = [];
|
|
4174
|
-
if (!!formula) {
|
|
4175
|
-
const newFormula = typeof formula === 'string' ? JSON.parse(formula) : formula;
|
|
4176
|
-
if (Array.isArray(newFormula)) {
|
|
4177
|
-
newFormula.forEach(condition => {
|
|
4178
|
-
if (!(typeof condition === 'string' && this.validJoinComparators.indexOf(condition) !== -1)) {
|
|
4179
|
-
if (Array.isArray(condition)) {
|
|
4180
|
-
conditionList.push(ShowCondition.getConditions(condition).toString());
|
|
4181
|
-
}
|
|
4182
|
-
else {
|
|
4183
|
-
conditionList.push(condition.fieldReference + condition.comparator + condition.value);
|
|
4184
|
-
}
|
|
4185
|
-
}
|
|
4186
|
-
});
|
|
4187
|
-
}
|
|
4188
|
-
else {
|
|
4189
|
-
conditionList.push(newFormula.fieldReference + newFormula.comparator + newFormula.value);
|
|
4190
|
-
}
|
|
4191
|
-
}
|
|
4192
|
-
return conditionList.toString();
|
|
4193
|
-
}
|
|
4194
|
-
/**
|
|
4195
|
-
* Determine whether a ShowCondition model is affected by fields that have
|
|
4196
|
-
* a display_context of HIDDEN or READONLY, which means they aren't able to
|
|
4197
|
-
* be changed by the user's actions.
|
|
4198
|
-
*
|
|
4199
|
-
* @param showCondition The ShowCondition model to evaluate.
|
|
4200
|
-
* @param caseFields Inspected to see appropriate display_contexts.
|
|
4201
|
-
*/
|
|
4202
|
-
static hiddenCannotChange(showCondition, caseFields) {
|
|
4203
|
-
if (showCondition && showCondition.conditions.length && caseFields) {
|
|
4204
|
-
const conditions = this.getConditions(showCondition.conditions).split(',');
|
|
4205
|
-
if (conditions && conditions.length > 0) {
|
|
4206
|
-
let allUnchangeable = true;
|
|
4207
|
-
for (const condition of conditions) {
|
|
4208
|
-
const [field] = ShowCondition.getField(condition);
|
|
4209
|
-
const path = field.split('.');
|
|
4210
|
-
let head = path.shift();
|
|
4211
|
-
let caseField = caseFields.find(cf => cf.id === head);
|
|
4212
|
-
while (path.length > 0) {
|
|
4213
|
-
head = path.shift();
|
|
4214
|
-
if (caseField) {
|
|
4215
|
-
// Jump out if this is HIDDEN or READONLY, regardless of whether or not it's
|
|
4216
|
-
// complex or a collection - nested fields will "inherit" the display_context.
|
|
4217
|
-
if (['HIDDEN', 'READONLY'].indexOf(caseField.display_context) > -1) {
|
|
4218
|
-
break;
|
|
4219
|
-
}
|
|
4220
|
-
// Consider what type of field this is.
|
|
4221
|
-
const ft = caseField.field_type;
|
|
4222
|
-
switch (ft.type) {
|
|
4223
|
-
case 'Collection':
|
|
4224
|
-
if (ft.collection_field_type.type === 'Complex' && ft.collection_field_type.complex_fields) {
|
|
4225
|
-
caseField = ft.collection_field_type.complex_fields.find(cf => cf.id === head);
|
|
4226
|
-
}
|
|
4227
|
-
break;
|
|
4228
|
-
case 'Complex':
|
|
4229
|
-
if (ft.complex_fields) {
|
|
4230
|
-
caseField = ft.complex_fields.find(cf => cf.id === head);
|
|
4231
|
-
}
|
|
4232
|
-
break;
|
|
4233
|
-
}
|
|
4234
|
-
}
|
|
4235
|
-
}
|
|
4236
|
-
if (caseField) {
|
|
4237
|
-
allUnchangeable = allUnchangeable && ['HIDDEN', 'READONLY'].indexOf(caseField.display_context) > -1;
|
|
4238
|
-
}
|
|
4239
|
-
}
|
|
4240
|
-
return allUnchangeable;
|
|
4241
|
-
}
|
|
4072
|
+
return fields[head];
|
|
4242
4073
|
}
|
|
4243
|
-
return false;
|
|
4244
4074
|
}
|
|
4245
|
-
|
|
4246
|
-
return
|
|
4075
|
+
isDynamicList(dynamiclist) {
|
|
4076
|
+
return !_.isEmpty(dynamiclist) &&
|
|
4077
|
+
(_.has(dynamiclist, 'value') && _.has(dynamiclist, 'list_items'));
|
|
4247
4078
|
}
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
/* tslint:disable-next-line */
|
|
4251
|
-
let [pathName, ...pathTail] = path.split(/[_]+/g);
|
|
4252
|
-
const pathFinalIndex = pathTail.pop();
|
|
4253
|
-
const pathTailString = pathTail.toString();
|
|
4254
|
-
pathTail = pathTail.map((value) => {
|
|
4255
|
-
return Number(pathFinalIndex) === Number(value) ? pathName : value;
|
|
4256
|
-
});
|
|
4257
|
-
return pathTailString !== pathTail.toString()
|
|
4258
|
-
? `${pathName}_${pathTail.join('_')}_${pathFinalIndex}`
|
|
4259
|
-
: path;
|
|
4260
|
-
}
|
|
4261
|
-
else {
|
|
4262
|
-
return path;
|
|
4263
|
-
}
|
|
4079
|
+
unquoted(str) {
|
|
4080
|
+
return str.replace(/(?:^")|(?:"$)/g, '');
|
|
4264
4081
|
}
|
|
4265
|
-
|
|
4266
|
-
return
|
|
4082
|
+
removeStarChar(str) {
|
|
4083
|
+
return str.substring(0, str.length - 1);
|
|
4267
4084
|
}
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
* of HIDDEN or READONLY, which means they aren't able to be changed by the
|
|
4271
|
-
* user's actions.
|
|
4272
|
-
*
|
|
4273
|
-
* @param caseFields Inspected to see appropriate display_contexts.
|
|
4274
|
-
*/
|
|
4275
|
-
hiddenCannotChange(caseFields) {
|
|
4276
|
-
return ShowCondition.hiddenCannotChange(this, caseFields);
|
|
4085
|
+
okIfBothEmpty(right, value) {
|
|
4086
|
+
return value === null && (right === '');
|
|
4277
4087
|
}
|
|
4278
4088
|
}
|
|
4089
|
+
ShowCondition.AND_CONDITION_REGEXP = new RegExp('\\sAND\\s(?![^"]*"(?:(?:[^"]*"){2})*[^"]*$)', 'g');
|
|
4090
|
+
ShowCondition.OR_CONDITION_REGEXP = new RegExp('\\sOR\\s(?![^"]*"(?:(?:[^"]*"){2})*[^"]*$)', 'g');
|
|
4279
4091
|
ShowCondition.CONDITION_NOT_EQUALS = '!=';
|
|
4280
4092
|
ShowCondition.CONDITION_EQUALS = '=';
|
|
4281
4093
|
ShowCondition.CONTAINS = 'CONTAINS';
|
|
4282
4094
|
ShowCondition.instanceCache = new Map();
|
|
4283
|
-
ShowCondition.validJoinComparators = ['AND', 'OR'];
|
|
4284
|
-
ShowCondition.processedList = [];
|
|
4285
4095
|
|
|
4286
4096
|
class Constants {
|
|
4287
4097
|
}
|
|
@@ -6076,14 +5886,13 @@ class CaseFlagRefdataService {
|
|
|
6076
5886
|
return of(null);
|
|
6077
5887
|
}
|
|
6078
5888
|
/**
|
|
6079
|
-
* Retrieves the HMCTS service details for a jurisdiction or service, including service
|
|
6080
|
-
* service
|
|
6081
|
-
* "ABA1" and "ABA2".
|
|
5889
|
+
* Retrieves the HMCTS service details for a jurisdiction or service, including service code. (For example, the "SSCS"
|
|
5890
|
+
* service has a corresponding service code of "BBA3".)
|
|
6082
5891
|
*
|
|
6083
5892
|
* @param serviceNames The service name(s) to look up, comma-separated if more than one
|
|
6084
5893
|
* @returns An `Observable` of an array of service details
|
|
6085
5894
|
*/
|
|
6086
|
-
|
|
5895
|
+
getHmctsServiceDetails(serviceNames) {
|
|
6087
5896
|
let url = this.appConfig.getLocationRefApiUrl();
|
|
6088
5897
|
if (url) {
|
|
6089
5898
|
url += '/orgServices';
|
|
@@ -6094,26 +5903,6 @@ class CaseFlagRefdataService {
|
|
|
6094
5903
|
}
|
|
6095
5904
|
return of(null);
|
|
6096
5905
|
}
|
|
6097
|
-
/**
|
|
6098
|
-
* Retrieves the HMCTS service details for a case type, including service code. For example, the
|
|
6099
|
-
* "FinancialRemedyContested" case type is associated with the Divorce jurisdiction/service and service code "ABA2".
|
|
6100
|
-
*
|
|
6101
|
-
* Note that a case type might not be associated with any service codes of a jurisdiction or service.
|
|
6102
|
-
*
|
|
6103
|
-
* @param caseTypeId The case type ID to look up
|
|
6104
|
-
* @returns An `Observable` of an array of service details
|
|
6105
|
-
*/
|
|
6106
|
-
getHmctsServiceDetailsByCaseType(caseTypeId) {
|
|
6107
|
-
let url = this.appConfig.getLocationRefApiUrl();
|
|
6108
|
-
if (url) {
|
|
6109
|
-
url += '/orgServices';
|
|
6110
|
-
if (caseTypeId) {
|
|
6111
|
-
url += `?ccdCaseType=${caseTypeId}`;
|
|
6112
|
-
}
|
|
6113
|
-
return this.http.get(url, { observe: 'body' });
|
|
6114
|
-
}
|
|
6115
|
-
return of(null);
|
|
6116
|
-
}
|
|
6117
5906
|
}
|
|
6118
5907
|
CaseFlagRefdataService.ɵfac = function CaseFlagRefdataService_Factory(t) { return new (t || CaseFlagRefdataService)(i0.ɵɵinject(HttpService), i0.ɵɵinject(AbstractAppConfig)); };
|
|
6119
5908
|
CaseFlagRefdataService.ɵprov = i0.ɵɵdefineInjectable({ token: CaseFlagRefdataService, factory: CaseFlagRefdataService.ɵfac });
|
|
@@ -10995,7 +10784,7 @@ function WriteCaseFlagFieldComponent_div_1_ng_container_5_Template(rf, ctx) { if
|
|
|
10995
10784
|
} if (rf & 2) {
|
|
10996
10785
|
const ctx_r8 = i0.ɵɵnextContext(2);
|
|
10997
10786
|
i0.ɵɵadvance(1);
|
|
10998
|
-
i0.ɵɵproperty("formGroup", ctx_r8.caseFlagParentFormGroup)("jurisdiction", ctx_r8.jurisdiction)
|
|
10787
|
+
i0.ɵɵproperty("formGroup", ctx_r8.caseFlagParentFormGroup)("jurisdiction", ctx_r8.jurisdiction);
|
|
10999
10788
|
} }
|
|
11000
10789
|
function WriteCaseFlagFieldComponent_div_1_ng_container_6_Template(rf, ctx) { if (rf & 1) {
|
|
11001
10790
|
const _r17 = i0.ɵɵgetCurrentView();
|
|
@@ -11029,7 +10818,7 @@ function WriteCaseFlagFieldComponent_div_1_Template(rf, ctx) { if (rf & 1) {
|
|
|
11029
10818
|
i0.ɵɵtext(3);
|
|
11030
10819
|
i0.ɵɵelementEnd();
|
|
11031
10820
|
i0.ɵɵtemplate(4, WriteCaseFlagFieldComponent_div_1_ng_container_4_Template, 2, 2, "ng-container", 11);
|
|
11032
|
-
i0.ɵɵtemplate(5, WriteCaseFlagFieldComponent_div_1_ng_container_5_Template, 2,
|
|
10821
|
+
i0.ɵɵtemplate(5, WriteCaseFlagFieldComponent_div_1_ng_container_5_Template, 2, 2, "ng-container", 11);
|
|
11033
10822
|
i0.ɵɵtemplate(6, WriteCaseFlagFieldComponent_div_1_ng_container_6_Template, 2, 3, "ng-container", 11);
|
|
11034
10823
|
i0.ɵɵtemplate(7, WriteCaseFlagFieldComponent_div_1_ng_container_7_Template, 2, 2, "ng-container", 11);
|
|
11035
10824
|
i0.ɵɵelementEnd();
|
|
@@ -11128,14 +10917,11 @@ class WriteCaseFlagFieldComponent extends AbstractFieldWriteComponent {
|
|
|
11128
10917
|
}
|
|
11129
10918
|
}), true);
|
|
11130
10919
|
this.createFlagCaption = CaseFlagText.CAPTION;
|
|
11131
|
-
// Get the
|
|
10920
|
+
// Get the jurisdiction from the CaseView object in the snapshot data (required for retrieving the available flag
|
|
11132
10921
|
// types for a case)
|
|
11133
|
-
if (this.route.snapshot.data.case && this.route.snapshot.data.case.case_type
|
|
11134
|
-
this.
|
|
11135
|
-
|
|
11136
|
-
if (this.route.snapshot.data.case.case_type.jurisdiction) {
|
|
11137
|
-
this.jurisdiction = this.route.snapshot.data.case.case_type.jurisdiction.id;
|
|
11138
|
-
}
|
|
10922
|
+
if (this.route.snapshot.data.case && this.route.snapshot.data.case.case_type &&
|
|
10923
|
+
this.route.snapshot.data.case.case_type.jurisdiction) {
|
|
10924
|
+
this.jurisdiction = this.route.snapshot.data.case.case_type.jurisdiction.id;
|
|
11139
10925
|
}
|
|
11140
10926
|
// Extract all flags-related data from the CaseEventTrigger object in the snapshot data
|
|
11141
10927
|
if (this.route.snapshot.data.eventTrigger && this.route.snapshot.data.eventTrigger.case_fields) {
|
|
@@ -11386,7 +11172,7 @@ class WriteCaseFlagFieldComponent extends AbstractFieldWriteComponent {
|
|
|
11386
11172
|
}
|
|
11387
11173
|
}
|
|
11388
11174
|
WriteCaseFlagFieldComponent.ɵfac = function WriteCaseFlagFieldComponent_Factory(t) { return new (t || WriteCaseFlagFieldComponent)(i0.ɵɵdirectiveInject(i1$1.ActivatedRoute), i0.ɵɵdirectiveInject(CaseEditDataService)); };
|
|
11389
|
-
WriteCaseFlagFieldComponent.ɵcmp = i0.ɵɵdefineComponent({ type: WriteCaseFlagFieldComponent, selectors: [["ccd-write-case-flag-field"]], features: [i0.ɵɵInheritDefinitionFeature], decls: 3, vars: 3, consts: [["class", "govuk-error-summary", "aria-labelledby", "error-summary-title", "role", "alert", "tabindex", "-1", "data-module", "govuk-error-summary", 4, "ngIf"], ["class", "form-group", 3, "formGroup", 4, "ngIf"], ["aria-labelledby", "error-summary-title", "role", "alert", "tabindex", "-1", "data-module", "govuk-error-summary", 1, "govuk-error-summary"], ["id", "error-summary-title", 1, "govuk-error-summary__title"], ["class", "govuk-error-summary__body", 4, "ngFor", "ngForOf"], [1, "govuk-error-summary__body"], [1, "govuk-list", "govuk-error-summary__list"], [1, "validation-error", 3, "click"], [1, "form-group", 3, "formGroup"], [1, "govuk-form-group", 3, "ngSwitch"], ["id", "create-flag-caption", 1, "govuk-caption-l", 3, "ngClass"], [4, "ngSwitchCase"], [3, "formGroup", "flagsData", "caseFlagStateEmitter"], [3, "formGroup", "jurisdiction", "
|
|
11175
|
+
WriteCaseFlagFieldComponent.ɵcmp = i0.ɵɵdefineComponent({ type: WriteCaseFlagFieldComponent, selectors: [["ccd-write-case-flag-field"]], features: [i0.ɵɵInheritDefinitionFeature], decls: 3, vars: 3, consts: [["class", "govuk-error-summary", "aria-labelledby", "error-summary-title", "role", "alert", "tabindex", "-1", "data-module", "govuk-error-summary", 4, "ngIf"], ["class", "form-group", 3, "formGroup", 4, "ngIf"], ["aria-labelledby", "error-summary-title", "role", "alert", "tabindex", "-1", "data-module", "govuk-error-summary", 1, "govuk-error-summary"], ["id", "error-summary-title", 1, "govuk-error-summary__title"], ["class", "govuk-error-summary__body", 4, "ngFor", "ngForOf"], [1, "govuk-error-summary__body"], [1, "govuk-list", "govuk-error-summary__list"], [1, "validation-error", 3, "click"], [1, "form-group", 3, "formGroup"], [1, "govuk-form-group", 3, "ngSwitch"], ["id", "create-flag-caption", 1, "govuk-caption-l", 3, "ngClass"], [4, "ngSwitchCase"], [3, "formGroup", "flagsData", "caseFlagStateEmitter"], [3, "formGroup", "jurisdiction", "caseFlagStateEmitter", "flagCommentsOptionalEmitter"], [3, "formGroup", "languages", "flagCode", "caseFlagStateEmitter"], [3, "formGroup", "optional", "caseFlagStateEmitter"], [3, "formGroup", "flagsData", "caseTitle", "caseFlagStateEmitter"], [3, "formGroup", "selectedFlag", "caseFlagStateEmitter"]], template: function WriteCaseFlagFieldComponent_Template(rf, ctx) { if (rf & 1) {
|
|
11390
11176
|
i0.ɵɵtemplate(0, WriteCaseFlagFieldComponent_div_0_Template, 4, 1, "div", 0);
|
|
11391
11177
|
i0.ɵɵtemplate(1, WriteCaseFlagFieldComponent_div_1_Template, 8, 10, "div", 1);
|
|
11392
11178
|
i0.ɵɵtemplate(2, WriteCaseFlagFieldComponent_div_2_Template, 4, 4, "div", 1);
|
|
@@ -15700,7 +15486,7 @@ CaseFileViewFolderSelectorComponent.ɵcmp = i0.ɵɵdefineComponent({ type: CaseF
|
|
|
15700
15486
|
i0.ɵɵtextInterpolate1("Where do you want to move \"", ctx.data.document.document_filename, "\" file?");
|
|
15701
15487
|
i0.ɵɵadvance(2);
|
|
15702
15488
|
i0.ɵɵproperty("ngForOf", ctx.currentCategories);
|
|
15703
|
-
} }, directives: [i1.NgForOf, i1.NgTemplateOutlet], styles: [":host{position:relative;display:block}.folders{margin-bottom:20px}.folder{display:none;border-top:1px solid #ccc;margin:0 0 -1px}.folder
|
|
15489
|
+
} }, directives: [i1.NgForOf, i1.NgTemplateOutlet], styles: [":host{position:relative;display:block}.folders{margin-bottom:20px}.folder{display:none;border-top:1px solid #ccc;margin:0 0 -1px}.folder:last-child{border-bottom:1px solid #ccc}.folders>.folder,input:checked~.folder{display:block}.iconImg{position:relative;display:inline-block;height:28px}.folder>.folder{margin-left:20px}.folder label:before{top:3px}.folder label:after{top:13px}p{font-weight:700}button{margin-right:20px}.close{float:right;width:30px;height:30px;background:url(/assets/img/x.PNG) no-repeat 50%}.cancel,.close{cursor:pointer}.cdk-overlay-pane{overflow:auto}.cdk-overlay-pane::-webkit-scrollbar{width:7px}.cdk-overlay-pane::-webkit-scrollbar-thumb{border:4px solid transparent;background-clip:padding-box;border-radius:9999px;background-color:#aaa}.cdk-overlay-pane::-webkit-scrollbar-button{display:none}.cdk-overlay-pane::-webkit-scrollbar-track-piece{background:#eee}.cdk-overlay-pane::-webkit-scrollbar-thumb{background:#ccc}"], encapsulation: 2 });
|
|
15704
15490
|
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CaseFileViewFolderSelectorComponent, [{
|
|
15705
15491
|
type: Component,
|
|
15706
15492
|
args: [{
|
|
@@ -16584,18 +16370,22 @@ class SelectFlagTypeComponent {
|
|
|
16584
16370
|
&& this.formGroup['caseField'].id === this.caseLevelCaseFlagsFieldId
|
|
16585
16371
|
? RefdataCaseFlagType.CASE
|
|
16586
16372
|
: RefdataCaseFlagType.PARTY;
|
|
16587
|
-
// HMCTS service code is required to retrieve the relevant list of flag types
|
|
16588
|
-
this.flagRefdata$ = this.caseFlagRefdataService.
|
|
16373
|
+
// HMCTS service code for a given jurisdiction is required to retrieve the relevant list of flag types
|
|
16374
|
+
this.flagRefdata$ = this.caseFlagRefdataService.getHmctsServiceDetails(this.jurisdiction)
|
|
16589
16375
|
.pipe(
|
|
16590
|
-
// If an error occurs retrieving HMCTS service details by case type ID, try by service name instead
|
|
16591
|
-
catchError(_ => this.caseFlagRefdataService.getHmctsServiceDetailsByServiceName(this.jurisdiction)),
|
|
16592
16376
|
// Use switchMap to return an inner Observable of the flag types data, having received the service details
|
|
16593
16377
|
// including service_code. This avoids having nested `subscribe`s, which is an anti-pattern!
|
|
16594
|
-
switchMap(serviceDetails =>
|
|
16378
|
+
switchMap(serviceDetails => {
|
|
16379
|
+
return this.caseFlagRefdataService.getCaseFlagsRefdata(serviceDetails[0].service_code, flagType);
|
|
16380
|
+
}))
|
|
16595
16381
|
.subscribe({
|
|
16596
|
-
|
|
16597
|
-
|
|
16598
|
-
|
|
16382
|
+
next: flagTypes => {
|
|
16383
|
+
// First (and only) object in the returned array should be the top-level "Party" flag type
|
|
16384
|
+
this.flagTypes = flagTypes[0].childFlags;
|
|
16385
|
+
},
|
|
16386
|
+
error: error => {
|
|
16387
|
+
this.onRefdataError(error);
|
|
16388
|
+
}
|
|
16599
16389
|
});
|
|
16600
16390
|
}
|
|
16601
16391
|
ngOnDestroy() {
|
|
@@ -16667,7 +16457,7 @@ class SelectFlagTypeComponent {
|
|
|
16667
16457
|
}
|
|
16668
16458
|
}
|
|
16669
16459
|
SelectFlagTypeComponent.ɵfac = function SelectFlagTypeComponent_Factory(t) { return new (t || SelectFlagTypeComponent)(i0.ɵɵdirectiveInject(CaseFlagRefdataService)); };
|
|
16670
|
-
SelectFlagTypeComponent.ɵcmp = i0.ɵɵdefineComponent({ type: SelectFlagTypeComponent, selectors: [["ccd-select-flag-type"]], inputs: { formGroup: "formGroup", jurisdiction: "jurisdiction"
|
|
16460
|
+
SelectFlagTypeComponent.ɵcmp = i0.ɵɵdefineComponent({ type: SelectFlagTypeComponent, selectors: [["ccd-select-flag-type"]], inputs: { formGroup: "formGroup", jurisdiction: "jurisdiction" }, outputs: { caseFlagStateEmitter: "caseFlagStateEmitter", flagCommentsOptionalEmitter: "flagCommentsOptionalEmitter" }, decls: 11, vars: 9, consts: [[1, "form-group", 3, "formGroup"], [1, "govuk-form-group", 3, "ngClass"], ["aria-describedby", "flag-type-heading", 1, "govuk-fieldset"], [1, "govuk-fieldset__legend", "govuk-fieldset__legend--l"], ["id", "flag-type-heading", 1, "govuk-fieldset__heading"], ["id", "flag-type-not-selected-error-message", "class", "govuk-error-message", 4, "ngIf"], ["data-module", "govuk-radios", "id", "conditional-radios-list", 1, "govuk-radios", "govuk-radios--conditional"], ["class", "govuk-radios__item", 4, "ngFor", "ngForOf"], ["class", "govuk-radios__conditional", "id", "conditional-flagType", 4, "ngIf"], ["class", "govuk-button-group", 4, "ngIf"], ["id", "flag-type-not-selected-error-message", 1, "govuk-error-message"], [1, "govuk-visually-hidden"], [1, "govuk-radios__item"], ["type", "radio", 1, "govuk-radios__input", 3, "id", "name", "value", "formControlName", "change"], [1, "govuk-label", "govuk-radios__label", 3, "for"], ["id", "conditional-flagType", 1, "govuk-radios__conditional"], ["for", "other-flag-type-description", 1, "govuk-label"], ["id", "flag-type-error-message", "class", "govuk-error-message", 4, "ngIf"], ["id", "other-flag-type-description", "type", "text", 1, "govuk-input", "govuk-!-width-one-half", 3, "ngClass", "name", "formControlName"], ["id", "flag-type-error-message", 1, "govuk-error-message"], [1, "govuk-button-group"], ["type", "button", 1, "button", "button-primary", 3, "click"]], template: function SelectFlagTypeComponent_Template(rf, ctx) { if (rf & 1) {
|
|
16671
16461
|
i0.ɵɵelementStart(0, "div", 0);
|
|
16672
16462
|
i0.ɵɵelementStart(1, "div", 1);
|
|
16673
16463
|
i0.ɵɵelementStart(2, "fieldset", 2);
|
|
@@ -16711,8 +16501,6 @@ SelectFlagTypeComponent.ɵcmp = i0.ɵɵdefineComponent({ type: SelectFlagTypeCom
|
|
|
16711
16501
|
type: Input
|
|
16712
16502
|
}], jurisdiction: [{
|
|
16713
16503
|
type: Input
|
|
16714
|
-
}], caseTypeId: [{
|
|
16715
|
-
type: Input
|
|
16716
16504
|
}], caseFlagStateEmitter: [{
|
|
16717
16505
|
type: Output
|
|
16718
16506
|
}], flagCommentsOptionalEmitter: [{
|
|
@@ -18724,10 +18512,7 @@ DatetimePickerComponent.ɵcmp = i0.ɵɵdefineComponent({ type: DatetimePickerCom
|
|
|
18724
18512
|
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.inputElement = _t.first);
|
|
18725
18513
|
} }, inputs: { dateControl: "dateControl" }, features: [i0.ɵɵProvidersFeature([
|
|
18726
18514
|
{ provide: NGX_MAT_DATE_FORMATS, useValue: CUSTOM_MOMENT_FORMATS },
|
|
18727
|
-
{ provide: NgxMatDateAdapter,
|
|
18728
|
-
useClass: NgxMatMomentAdapter,
|
|
18729
|
-
deps: [MAT_DATE_LOCALE, NGX_MAT_MOMENT_DATE_ADAPTER_OPTIONS]
|
|
18730
|
-
},
|
|
18515
|
+
{ provide: NgxMatDateAdapter, useClass: NgxMatMomentAdapter },
|
|
18731
18516
|
{ provide: NGX_MAT_MOMENT_DATE_ADAPTER_OPTIONS, useValue: { useUtc: true } }
|
|
18732
18517
|
]), i0.ɵɵInheritDefinitionFeature], decls: 14, vars: 26, consts: [[1, "govuk-form-group", "bottom-30", 3, "id", "ngClass"], ["class", "form-label", 4, "ngIf"], ["class", "form-hint", 4, "ngIf"], ["class", "error-message", 4, "ngIf"], [1, "datepicker-container"], ["ng-model-options", "{timezone:'utc'}", 1, "govuk-input", 3, "min", "max", "formControl", "ngxMatDatetimePicker", "focusin", "focusout", "dateChange"], ["input", ""], ["matSuffix", "", "id", "pickerOpener", 3, "for"], [3, "color", "touchUi", "hideTime", "startView", "stepHour", "stepSecond", "stepMinute", "showSeconds", "showSpinners", "disableMinute", "enableMeridian", "yearSelected", "monthSelected", "opened"], ["picker", ""], [1, "form-label"], [1, "form-hint"], [1, "error-message"]], template: function DatetimePickerComponent_Template(rf, ctx) { if (rf & 1) {
|
|
18733
18518
|
i0.ɵɵelementStart(0, "div", 0);
|
|
@@ -18780,10 +18565,7 @@ DatetimePickerComponent.ɵcmp = i0.ɵɵdefineComponent({ type: DatetimePickerCom
|
|
|
18780
18565
|
encapsulation: ViewEncapsulation.None,
|
|
18781
18566
|
providers: [
|
|
18782
18567
|
{ provide: NGX_MAT_DATE_FORMATS, useValue: CUSTOM_MOMENT_FORMATS },
|
|
18783
|
-
{ provide: NgxMatDateAdapter,
|
|
18784
|
-
useClass: NgxMatMomentAdapter,
|
|
18785
|
-
deps: [MAT_DATE_LOCALE, NGX_MAT_MOMENT_DATE_ADAPTER_OPTIONS]
|
|
18786
|
-
},
|
|
18568
|
+
{ provide: NgxMatDateAdapter, useClass: NgxMatMomentAdapter },
|
|
18787
18569
|
{ provide: NGX_MAT_MOMENT_DATE_ADAPTER_OPTIONS, useValue: { useUtc: true } }
|
|
18788
18570
|
]
|
|
18789
18571
|
}]
|
|
@@ -24156,7 +23938,6 @@ class CaseFullAccessViewComponent {
|
|
|
24156
23938
|
this.activitySubscription = this.postViewActivity().subscribe();
|
|
24157
23939
|
});
|
|
24158
23940
|
}
|
|
24159
|
-
this.checkRouteAndSetCaseViewTab();
|
|
24160
23941
|
// Check for active Case Flags
|
|
24161
23942
|
this.activeCaseFlags = this.hasActiveCaseFlags();
|
|
24162
23943
|
}
|
|
@@ -24186,19 +23967,6 @@ class CaseFullAccessViewComponent {
|
|
|
24186
23967
|
subscription.unsubscribe();
|
|
24187
23968
|
}
|
|
24188
23969
|
}
|
|
24189
|
-
checkRouteAndSetCaseViewTab() {
|
|
24190
|
-
this.router.events.subscribe((val) => {
|
|
24191
|
-
const url = val && val.url;
|
|
24192
|
-
if (url) {
|
|
24193
|
-
const tabUrl = url ? url.split('#') : null;
|
|
24194
|
-
const tab = tabUrl && tabUrl.length > 1 ? tabUrl[tabUrl.length - 1].replaceAll('%20', ' ') : '';
|
|
24195
|
-
const matTab = this.tabGroup._tabs.find((x) => x.textLabel.toLowerCase() === tab.toLowerCase());
|
|
24196
|
-
if (matTab && matTab.position) {
|
|
24197
|
-
this.tabGroup.selectedIndex = matTab.position;
|
|
24198
|
-
}
|
|
24199
|
-
}
|
|
24200
|
-
});
|
|
24201
|
-
}
|
|
24202
23970
|
postViewActivity() {
|
|
24203
23971
|
return this.activityPollingService.postViewActivity(this.caseDetails.case_id);
|
|
24204
23972
|
}
|
|
@@ -27655,11 +27423,11 @@ function SearchResultComponent_table_0_th_9_Template(rf, ctx) { if (rf & 1) {
|
|
|
27655
27423
|
i0.ɵɵadvance(2);
|
|
27656
27424
|
i0.ɵɵproperty("checked", ctx_r6.allOnPageSelected())("disabled", !ctx_r6.canAnyBeShared());
|
|
27657
27425
|
} }
|
|
27658
|
-
function
|
|
27426
|
+
function SearchResultComponent_table_0_th_10_div_6_Template(rf, ctx) { if (rf & 1) {
|
|
27659
27427
|
const _r19 = i0.ɵɵgetCurrentView();
|
|
27660
27428
|
i0.ɵɵelementStart(0, "div", 27);
|
|
27661
27429
|
i0.ɵɵelementStart(1, "a", 28);
|
|
27662
|
-
i0.ɵɵlistener("click", function
|
|
27430
|
+
i0.ɵɵlistener("click", function SearchResultComponent_table_0_th_10_div_6_Template_a_click_1_listener() { i0.ɵɵrestoreView(_r19); const col_r15 = i0.ɵɵnextContext().$implicit; const ctx_r17 = i0.ɵɵnextContext(2); return ctx_r17.sort(col_r15); });
|
|
27663
27431
|
i0.ɵɵelementEnd();
|
|
27664
27432
|
i0.ɵɵelementEnd();
|
|
27665
27433
|
} if (rf & 2) {
|
|
@@ -27671,12 +27439,16 @@ function SearchResultComponent_table_0_th_10_div_4_Template(rf, ctx) { if (rf &
|
|
|
27671
27439
|
function SearchResultComponent_table_0_th_10_Template(rf, ctx) { if (rf & 1) {
|
|
27672
27440
|
const _r22 = i0.ɵɵgetCurrentView();
|
|
27673
27441
|
i0.ɵɵelementStart(0, "th");
|
|
27674
|
-
i0.ɵɵelementStart(1, "
|
|
27675
|
-
i0.ɵɵelementStart(2, "
|
|
27676
|
-
i0.ɵɵ
|
|
27677
|
-
i0.ɵɵ
|
|
27442
|
+
i0.ɵɵelementStart(1, "table", 24);
|
|
27443
|
+
i0.ɵɵelementStart(2, "tr");
|
|
27444
|
+
i0.ɵɵelementStart(3, "th");
|
|
27445
|
+
i0.ɵɵelementStart(4, "div", 25);
|
|
27446
|
+
i0.ɵɵlistener("click", function SearchResultComponent_table_0_th_10_Template_div_click_4_listener() { i0.ɵɵrestoreView(_r22); const col_r15 = ctx.$implicit; const ctx_r21 = i0.ɵɵnextContext(2); return ctx_r21.sort(col_r15); });
|
|
27447
|
+
i0.ɵɵtext(5);
|
|
27448
|
+
i0.ɵɵelementEnd();
|
|
27449
|
+
i0.ɵɵtemplate(6, SearchResultComponent_table_0_th_10_div_6_Template, 2, 1, "div", 26);
|
|
27450
|
+
i0.ɵɵelementEnd();
|
|
27678
27451
|
i0.ɵɵelementEnd();
|
|
27679
|
-
i0.ɵɵtemplate(4, SearchResultComponent_table_0_th_10_div_4_Template, 2, 1, "div", 26);
|
|
27680
27452
|
i0.ɵɵelementEnd();
|
|
27681
27453
|
i0.ɵɵelementEnd();
|
|
27682
27454
|
} if (rf & 2) {
|
|
@@ -27684,7 +27456,7 @@ function SearchResultComponent_table_0_th_10_Template(rf, ctx) { if (rf & 1) {
|
|
|
27684
27456
|
const ctx_r7 = i0.ɵɵnextContext(2);
|
|
27685
27457
|
i0.ɵɵadvance(1);
|
|
27686
27458
|
i0.ɵɵattribute("aria-label", "Sort by " + col_r15.label + " " + ctx_r7.isSortAscending(col_r15) ? "ascending" : "descending");
|
|
27687
|
-
i0.ɵɵadvance(
|
|
27459
|
+
i0.ɵɵadvance(4);
|
|
27688
27460
|
i0.ɵɵtextInterpolate(col_r15.label);
|
|
27689
27461
|
i0.ɵɵadvance(1);
|
|
27690
27462
|
i0.ɵɵproperty("ngIf", ctx_r7.comparator(col_r15));
|
|
@@ -27956,7 +27728,7 @@ function SearchResultComponent_table_0_Template(rf, ctx) { if (rf & 1) {
|
|
|
27956
27728
|
i0.ɵɵelementStart(7, "thead");
|
|
27957
27729
|
i0.ɵɵelementStart(8, "tr", 7);
|
|
27958
27730
|
i0.ɵɵtemplate(9, SearchResultComponent_table_0_th_9_Template, 4, 2, "th", 8);
|
|
27959
|
-
i0.ɵɵtemplate(10, SearchResultComponent_table_0_th_10_Template,
|
|
27731
|
+
i0.ɵɵtemplate(10, SearchResultComponent_table_0_th_10_Template, 7, 3, "th", 9);
|
|
27960
27732
|
i0.ɵɵtemplate(11, SearchResultComponent_table_0_th_11_Template, 1, 0, "th", 10);
|
|
27961
27733
|
i0.ɵɵelementEnd();
|
|
27962
27734
|
i0.ɵɵelementEnd();
|