@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.
Files changed (34) hide show
  1. package/bundles/hmcts-ccd-case-ui-toolkit.umd.js +234 -381
  2. package/bundles/hmcts-ccd-case-ui-toolkit.umd.js.map +1 -1
  3. package/bundles/hmcts-ccd-case-ui-toolkit.umd.min.js +1 -1
  4. package/bundles/hmcts-ccd-case-ui-toolkit.umd.min.js.map +1 -1
  5. package/esm2015/lib/shared/components/case-viewer/case-full-access-view/case-full-access-view.component.js +1 -15
  6. package/esm2015/lib/shared/components/palette/case-file-view/components/case-file-view-folder-selector/case-file-view-folder-selector.component.js +1 -1
  7. package/esm2015/lib/shared/components/palette/case-flag/components/select-flag-type/select-flag-type.component.js +15 -13
  8. package/esm2015/lib/shared/components/palette/case-flag/write-case-flag-field.component.js +8 -11
  9. package/esm2015/lib/shared/components/palette/datetime-picker/datetime-picker.component.js +3 -10
  10. package/esm2015/lib/shared/components/search-result/search-result.component.js +14 -10
  11. package/esm2015/lib/shared/directives/conditional-show/domain/conditional-show.model.js +200 -103
  12. package/esm2015/lib/shared/domain/case-flag/hmcts-service-detail.model.js +1 -1
  13. package/esm2015/lib/shared/services/case-flag/case-flag-refdata.service.js +4 -25
  14. package/fesm2015/hmcts-ccd-case-ui-toolkit.js +215 -443
  15. package/fesm2015/hmcts-ccd-case-ui-toolkit.js.map +1 -1
  16. package/lib/shared/components/case-viewer/case-full-access-view/case-full-access-view.component.d.ts +0 -1
  17. package/lib/shared/components/case-viewer/case-full-access-view/case-full-access-view.component.d.ts.map +1 -1
  18. package/lib/shared/components/palette/case-flag/components/select-flag-type/select-flag-type.component.d.ts +1 -2
  19. package/lib/shared/components/palette/case-flag/components/select-flag-type/select-flag-type.component.d.ts.map +1 -1
  20. package/lib/shared/components/palette/case-flag/write-case-flag-field.component.d.ts +0 -1
  21. package/lib/shared/components/palette/case-flag/write-case-flag-field.component.d.ts.map +1 -1
  22. package/lib/shared/components/palette/datetime-picker/datetime-picker.component.d.ts.map +1 -1
  23. package/lib/shared/directives/conditional-show/domain/conditional-show.model.d.ts +30 -13
  24. package/lib/shared/directives/conditional-show/domain/conditional-show.model.d.ts.map +1 -1
  25. package/lib/shared/domain/case-flag/hmcts-service-detail.model.d.ts.map +1 -1
  26. package/lib/shared/services/case-flag/case-flag-refdata.service.d.ts +3 -14
  27. package/lib/shared/services/case-flag/case-flag-refdata.service.d.ts.map +1 -1
  28. package/package.json +1 -1
  29. package/esm2015/lib/shared/directives/conditional-show/services/condition-parser.service.js +0 -201
  30. package/esm2015/lib/shared/directives/conditional-show/services/condition.peg.js +0 -90
  31. package/lib/shared/directives/conditional-show/services/condition-parser.service.d.ts +0 -30
  32. package/lib/shared/directives/conditional-show/services/condition-parser.service.d.ts.map +0 -1
  33. package/lib/shared/directives/conditional-show/services/condition.peg.d.ts +0 -3
  34. package/lib/shared/directives/conditional-show/services/condition.peg.d.ts.map +0 -1
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/router'), require('@angular/forms'), require('rx-polling'), require('rxjs'), require('@angular/common/http'), require('rxjs/operators'), require('class-transformer'), require('moment'), require('underscore'), require('pegjs'), require('util'), require('@edium/fsm'), require('@angular/material/dialog'), require('@angular-material-components/datetime-picker'), require('@angular/cdk/overlay'), require('@angular/cdk/tree'), require('@angular/material/autocomplete'), require('@angular/material/core'), require('@angular/material/datepicker'), require('@angular/material/form-field'), require('@angular/material/input'), require('@hmcts/ccpay-web-component'), require('@hmcts/media-viewer'), require('@nicky-lenaers/ngx-scroll-to'), require('ngx-md'), require('@angular-material-components/moment-adapter'), require('@angular/cdk/portal'), require('ngx-pagination'), require('@angular/material/tabs')) :
3
- typeof define === 'function' && define.amd ? define('@hmcts/ccd-case-ui-toolkit', ['exports', '@angular/core', '@angular/common', '@angular/router', '@angular/forms', 'rx-polling', 'rxjs', '@angular/common/http', 'rxjs/operators', 'class-transformer', 'moment', 'underscore', 'pegjs', 'util', '@edium/fsm', '@angular/material/dialog', '@angular-material-components/datetime-picker', '@angular/cdk/overlay', '@angular/cdk/tree', '@angular/material/autocomplete', '@angular/material/core', '@angular/material/datepicker', '@angular/material/form-field', '@angular/material/input', '@hmcts/ccpay-web-component', '@hmcts/media-viewer', '@nicky-lenaers/ngx-scroll-to', 'ngx-md', '@angular-material-components/moment-adapter', '@angular/cdk/portal', 'ngx-pagination', '@angular/material/tabs'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.hmcts = global.hmcts || {}, global.hmcts["ccd-case-ui-toolkit"] = {}), global.ng.core, global.ng.common, global.ng.router, global.ng.forms, global["rx-polling"], global.rxjs, global.ng.common.http, global.rxjs.operators, global["class-transformer"], global.moment, global.underscore, global.pegjs, global.util, global["@edium/fsm"], global.ng.material.dialog, global["@angular-material-components/datetime-picker"], global.ng.cdk.overlay, global.ng.cdk.tree, global.ng.material.autocomplete, global.ng.material.core, global.ng.material.datepicker, global.ng.material.formField, global.ng.material.input, global["@hmcts/ccpay-web-component"], global.i11, global["@nicky-lenaers/ngx-scroll-to"], global["ngx-md"], global["@angular-material-components/moment-adapter"], global.ng.cdk.portal, global["ngx-pagination"], global.ng.material.tabs));
5
- })(this, (function (exports, i0, i1, i1$1, i2, polling, rxjs, i1$2, operators, classTransformer, moment, _, pegjs, util, fsm, i1$3, i4, i1$4, i7, i5, i6, i5$1, i6$1, i3$1, i3, i11, i2$1, i1$5, momentAdapter, i6$2, i1$6, i9) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/router'), require('@angular/forms'), require('rx-polling'), require('rxjs'), require('@angular/common/http'), require('rxjs/operators'), require('class-transformer'), require('underscore'), require('moment'), require('util'), require('@edium/fsm'), require('@angular/material/dialog'), require('@angular-material-components/datetime-picker'), require('@angular/cdk/overlay'), require('@angular/cdk/tree'), require('@angular/material/autocomplete'), require('@angular/material/core'), require('@angular/material/datepicker'), require('@angular/material/form-field'), require('@angular/material/input'), require('@hmcts/ccpay-web-component'), require('@hmcts/media-viewer'), require('@nicky-lenaers/ngx-scroll-to'), require('ngx-md'), require('@angular-material-components/moment-adapter'), require('@angular/cdk/portal'), require('ngx-pagination'), require('@angular/material/tabs')) :
3
+ typeof define === 'function' && define.amd ? define('@hmcts/ccd-case-ui-toolkit', ['exports', '@angular/core', '@angular/common', '@angular/router', '@angular/forms', 'rx-polling', 'rxjs', '@angular/common/http', 'rxjs/operators', 'class-transformer', 'underscore', 'moment', 'util', '@edium/fsm', '@angular/material/dialog', '@angular-material-components/datetime-picker', '@angular/cdk/overlay', '@angular/cdk/tree', '@angular/material/autocomplete', '@angular/material/core', '@angular/material/datepicker', '@angular/material/form-field', '@angular/material/input', '@hmcts/ccpay-web-component', '@hmcts/media-viewer', '@nicky-lenaers/ngx-scroll-to', 'ngx-md', '@angular-material-components/moment-adapter', '@angular/cdk/portal', 'ngx-pagination', '@angular/material/tabs'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.hmcts = global.hmcts || {}, global.hmcts["ccd-case-ui-toolkit"] = {}), global.ng.core, global.ng.common, global.ng.router, global.ng.forms, global["rx-polling"], global.rxjs, global.ng.common.http, global.rxjs.operators, global["class-transformer"], global.underscore, global.moment, global.util, global["@edium/fsm"], global.ng.material.dialog, global["@angular-material-components/datetime-picker"], global.ng.cdk.overlay, global.ng.cdk.tree, global.ng.material.autocomplete, global.ng.material.core, global.ng.material.datepicker, global.ng.material.formField, global.ng.material.input, global["@hmcts/ccpay-web-component"], global.i11, global["@nicky-lenaers/ngx-scroll-to"], global["ngx-md"], global["@angular-material-components/moment-adapter"], global.ng.cdk.portal, global["ngx-pagination"], global.ng.material.tabs));
5
+ })(this, (function (exports, i0, i1, i1$1, i2, polling, rxjs, i1$2, operators, classTransformer, _, moment, util, fsm, i1$3, i4, i1$4, i7, i5, i6, i5$1, i6$1, i3$1, i3, i11, i2$1, i1$5, momentAdapter, i6$2, i1$6, i9) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -30,8 +30,8 @@
30
30
  var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
31
31
  var polling__default = /*#__PURE__*/_interopDefaultLegacy(polling);
32
32
  var i1__namespace$2 = /*#__PURE__*/_interopNamespace(i1$2);
33
- var moment__namespace = /*#__PURE__*/_interopNamespace(moment);
34
33
  var ___namespace = /*#__PURE__*/_interopNamespace(_);
34
+ var moment__namespace = /*#__PURE__*/_interopNamespace(moment);
35
35
  var i1__namespace$3 = /*#__PURE__*/_interopNamespace(i1$3);
36
36
  var i4__namespace = /*#__PURE__*/_interopNamespace(i4);
37
37
  var i1__namespace$4 = /*#__PURE__*/_interopNamespace(i1$4);
@@ -4419,102 +4419,194 @@
4419
4419
  }], null, null);
4420
4420
  })();
4421
4421
 
4422
- var conditionSource = "{\n function flat(arr, depth = 1) {\n var flatten = function (arr, depth = 1) {\n if (depth) return arr;\n\n // Otherwise, concatenate into the parent array\n return arr.reduce(function (acc, val) {\n return acc.concat(Array.isArray(val) ? flatten(val, depth - 1) : val);\n }, []);\n\n };\n\n return flatten(arr, depth - 1);\n }\n }\n\n Start\n = Formula\n\n Formula\n = EnclosedFormula\n / OpenFormula\n\n EnclosedFormula\n = bracket formula:OpenFormula bracket join:(JoinComparator)*\n { return flat([ [formula], join[0] ], 1) }\n\n OpenFormula\n = eq:OpenEqualityCheck joins:(JoinComparator)*\n { return flat([ eq, flat(joins) ]) }\n\n JoinComparator\n = comp:Comparator eq:OpenEqualityCheck\n { return [comp, eq]; }\n / CompoundJoinComparator\n\n CompoundJoinComparator\n = comp:Comparator bracket f:OpenFormula bracket\n { return [comp, f ] }\n\n OpenEqualityCheck\n = fr:FieldReference _? op:operator _? val:Value\n { return { fieldReference: fr, comparator: op, value: val } }\n\n Comparator\n = _? c:'AND' _?\n { return c; }\n / _? c:'OR' _?\n { return c; }\n\n Word\n = l:Letter+\n { return l.join(\"\"); }\n\n Letter\n = [a-zA-Z]\n\n Value\n = v:quotedValue / v:Word\n { return v.join(\"\") }\n / v:number\n { return parseInt(v.join(\"\")) }\n\n FieldReference\n = characters:[A-Za-z0-9._]+ { return characters.join(\"\"); }\n\n number\n = [0-9]+\n\n quotedValue\n = '\"'val:[A-Za-z0-9.,* _-]*'\"'\n { return val.join(\"\"); }\n\n bracket\n = (_? \"(\"+ _? / _? \")\"+ _? )\n\n operator\n = \"=\" / \"!=\" / \"CONTAINS\"\n\n ws \"Whitespace\"\n = [ \t]\n\n _ \"One or more whitespaces\"\n = ws+\n\n nl \"New line\"\n = \"\\n\"";
4423
- var peg = pegjs.generate(conditionSource);
4424
-
4425
- var ConditionParser = /** @class */ (function () {
4426
- function ConditionParser() {
4422
+ var ShowCondition = /** @class */ (function () {
4423
+ // Expects a show condition of the form: <fieldName>="string"
4424
+ function ShowCondition(condition) {
4425
+ this.condition = condition;
4426
+ this.orConditions = null;
4427
+ this.andConditions = null;
4428
+ if (!!condition) {
4429
+ if (condition.search(ShowCondition.OR_CONDITION_REGEXP) !== -1) {
4430
+ this.orConditions = condition.split(ShowCondition.OR_CONDITION_REGEXP);
4431
+ }
4432
+ else {
4433
+ this.andConditions = condition.split(ShowCondition.AND_CONDITION_REGEXP);
4434
+ }
4435
+ }
4427
4436
  }
4428
- /**
4429
- * Parse the raw formula and output structured condition data
4430
- * that can be used in evaluating show/hide logic
4431
- * @param condition raw formula e.g. TextField = "Hello"
4432
- */
4433
- ConditionParser.parse = function (condition) {
4434
- if (!condition) {
4435
- return null;
4437
+ ShowCondition.addPathPrefixToCondition = function (showCondition, pathPrefix) {
4438
+ if (!pathPrefix || pathPrefix === '') {
4439
+ return showCondition;
4440
+ }
4441
+ if (showCondition.search(ShowCondition.OR_CONDITION_REGEXP) !== -1) {
4442
+ var orConditions = showCondition.split(ShowCondition.OR_CONDITION_REGEXP);
4443
+ orConditions = this.extractConditions(orConditions, pathPrefix);
4444
+ return orConditions.join(' OR ');
4445
+ }
4446
+ else {
4447
+ var andConditions = showCondition.split(ShowCondition.AND_CONDITION_REGEXP);
4448
+ andConditions = this.extractConditions(andConditions, pathPrefix);
4449
+ return andConditions.join(' AND ');
4436
4450
  }
4437
- ;
4438
- condition = condition.replace(/CONTAINS/g, ' CONTAINS');
4439
- return peg.parse(condition.trim(), {});
4451
+ };
4452
+ // Cache instances so that we can cache results more effectively
4453
+ ShowCondition.getInstance = function (condition) {
4454
+ var instance = this.instanceCache.get(condition);
4455
+ if (!instance) {
4456
+ instance = new ShowCondition(condition);
4457
+ this.instanceCache.set(condition, instance);
4458
+ }
4459
+ return instance;
4440
4460
  };
4441
4461
  /**
4442
- * Evaluate the current fields against the conditions
4443
- * @param fields the current page fields and their value
4444
- * @param conditions The PegJS formula output
4462
+ * Determine whether a ShowCondition model is affected by fields that have
4463
+ * a display_context of HIDDEN or READONLY, which means they aren't able to
4464
+ * be changed by the user's actions.
4465
+ *
4466
+ * @param showCondition The ShowCondition model to evaluate.
4467
+ * @param caseFields Inspected to see appropriate display_contexts.
4445
4468
  */
4446
- ConditionParser.evaluate = function (fields, conditions, path) {
4447
- var _this = this;
4448
- if (!conditions) {
4449
- return true;
4450
- }
4451
- ;
4452
- var validJoinComparators = ['AND', 'OR'];
4453
- var result = conditions.reduce(function (accumulator, condition, index) {
4454
- var isJoinComparator = function (comparator) { return (typeof comparator === 'string' && validJoinComparators.indexOf(comparator) !== -1); };
4455
- if (isJoinComparator(condition)) {
4456
- return accumulator;
4457
- }
4458
- ;
4459
- var currentConditionResult = true;
4460
- if (Array.isArray(condition)) {
4461
- currentConditionResult = _this.evaluate(fields, condition);
4462
- if (isJoinComparator(conditions[index - 1])) {
4463
- return _this.evaluateJoin(accumulator, conditions[index - 1], currentConditionResult);
4469
+ ShowCondition.hiddenCannotChange = function (showCondition, caseFields) {
4470
+ var e_1, _a;
4471
+ if (showCondition && caseFields) {
4472
+ var conditions = showCondition.andConditions || showCondition.orConditions;
4473
+ if (conditions && conditions.length > 0) {
4474
+ var allUnchangeable = true;
4475
+ var _loop_1 = function (condition) {
4476
+ var _a = __read(ShowCondition.getField(condition), 1), field = _a[0];
4477
+ var path = field.split('.');
4478
+ var head = path.shift();
4479
+ var caseField = caseFields.find(function (cf) { return cf.id === head; });
4480
+ while (path.length > 0) {
4481
+ head = path.shift();
4482
+ if (caseField) {
4483
+ // Jump out if this is HIDDEN or READONLY, regardless of whether or not it's
4484
+ // complex or a collection - nested fields will "inherit" the display_context.
4485
+ if (['HIDDEN', 'READONLY'].indexOf(caseField.display_context) > -1) {
4486
+ break;
4487
+ }
4488
+ // Consider what type of field this is.
4489
+ var ft = caseField.field_type;
4490
+ switch (ft.type) {
4491
+ case 'Collection':
4492
+ if (ft.collection_field_type.type === 'Complex' && ft.collection_field_type.complex_fields) {
4493
+ caseField = ft.collection_field_type.complex_fields.find(function (cf) { return cf.id === head; });
4494
+ }
4495
+ break;
4496
+ case 'Complex':
4497
+ if (ft.complex_fields) {
4498
+ caseField = ft.complex_fields.find(function (cf) { return cf.id === head; });
4499
+ }
4500
+ break;
4501
+ }
4502
+ }
4503
+ }
4504
+ if (caseField) {
4505
+ allUnchangeable = allUnchangeable && ['HIDDEN', 'READONLY'].indexOf(caseField.display_context) > -1;
4506
+ }
4507
+ };
4508
+ try {
4509
+ for (var conditions_1 = __values(conditions), conditions_1_1 = conditions_1.next(); !conditions_1_1.done; conditions_1_1 = conditions_1.next()) {
4510
+ var condition = conditions_1_1.value;
4511
+ _loop_1(condition);
4512
+ }
4464
4513
  }
4514
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
4515
+ finally {
4516
+ try {
4517
+ if (conditions_1_1 && !conditions_1_1.done && (_a = conditions_1.return)) _a.call(conditions_1);
4518
+ }
4519
+ finally { if (e_1) throw e_1.error; }
4520
+ }
4521
+ return allUnchangeable;
4465
4522
  }
4466
- if (condition.comparator) {
4467
- var formula = condition.fieldReference + condition.comparator + condition.value;
4468
- currentConditionResult = _this.matchEqualityCondition(fields, formula, path);
4523
+ }
4524
+ return false;
4525
+ };
4526
+ ShowCondition.extractConditions = function (conditionsArray, pathPrefix) {
4527
+ var extracted = conditionsArray.map(function (condition) {
4528
+ if (condition.startsWith(pathPrefix)) {
4529
+ return condition;
4469
4530
  }
4470
- if (isJoinComparator(conditions[index - 1])) {
4471
- return _this.evaluateJoin(accumulator, conditions[index - 1], currentConditionResult);
4531
+ return pathPrefix + "." + condition;
4532
+ });
4533
+ return extracted;
4534
+ };
4535
+ ShowCondition.getField = function (condition) {
4536
+ var separator = ShowCondition.CONTAINS;
4537
+ if (condition.indexOf(ShowCondition.CONTAINS) < 0) {
4538
+ separator = ShowCondition.CONDITION_EQUALS;
4539
+ if (condition.indexOf(ShowCondition.CONDITION_NOT_EQUALS) > -1) {
4540
+ separator = ShowCondition.CONDITION_NOT_EQUALS;
4472
4541
  }
4473
- return currentConditionResult;
4474
- }, true);
4475
- return result;
4542
+ }
4543
+ return [condition.split(separator)[0], separator];
4476
4544
  };
4477
- ConditionParser.evaluateJoin = function (leftResult, comparator, rightResult) {
4478
- switch (comparator) {
4479
- case 'OR': return leftResult || rightResult;
4480
- case 'AND': return leftResult && rightResult;
4545
+ ShowCondition.prototype.match = function (fields, path) {
4546
+ if (!this.condition) {
4547
+ return true;
4481
4548
  }
4549
+ return this.matchAndConditions(fields, this.updatePathName(path));
4482
4550
  };
4483
- ConditionParser.matchEqualityCondition = function (fields, condition, path) {
4484
- var _a = __read(this.getField(condition), 2), field = _a[0], conditionSeparator = _a[1];
4485
- var _b = __read(field.split('.')), head = _b[0], tail = _b.slice(1);
4486
- var currentValue = this.findValueForComplexCondition(fields, head, tail, path);
4487
- var expectedValue = this.unquoted(condition.split(conditionSeparator)[1]);
4488
- if (conditionSeparator === ShowCondition.CONTAINS) {
4489
- return this.checkValueContains(expectedValue, currentValue);
4551
+ ShowCondition.prototype.matchByContextFields = function (contextFields) {
4552
+ return this.match(FieldsUtils.toValuesMap(contextFields));
4553
+ };
4554
+ /**
4555
+ * Determine whether this is affected by fields that have a display_context
4556
+ * of HIDDEN or READONLY, which means they aren't able to be changed by the
4557
+ * user's actions.
4558
+ *
4559
+ * @param caseFields Inspected to see appropriate display_contexts.
4560
+ */
4561
+ ShowCondition.prototype.hiddenCannotChange = function (caseFields) {
4562
+ return ShowCondition.hiddenCannotChange(this, caseFields);
4563
+ };
4564
+ /**
4565
+ * Path Name gets updated for complex sub fields
4566
+ * @param path Path name.
4567
+ */
4568
+ ShowCondition.prototype.updatePathName = function (path) {
4569
+ if (path && path.split(/[_]+/g).length > 0) {
4570
+ var _a = __read(path.split(/[_]+/g)), pathName_1 = _a[0], pathTail = _a.slice(1);
4571
+ var pathFinalIndex_1 = pathTail.pop();
4572
+ var pathTailString = pathTail.toString();
4573
+ var mappedPathTail = void 0;
4574
+ mappedPathTail = pathTail.map(function (value) {
4575
+ return Number(pathFinalIndex_1) === Number(value) ? pathName_1 : value;
4576
+ });
4577
+ return pathTailString !== mappedPathTail.toString()
4578
+ ? pathName_1 + "_" + mappedPathTail.join('_') + "_" + pathFinalIndex_1
4579
+ : path;
4490
4580
  }
4491
4581
  else {
4492
- return this.checkValueEquals(expectedValue, currentValue, conditionSeparator);
4582
+ return path;
4493
4583
  }
4494
4584
  };
4495
- ConditionParser.getValue = function (fields, head) {
4496
- if (this.isDynamicList(fields[head])) {
4497
- return fields[head].value.code;
4585
+ ShowCondition.prototype.matchAndConditions = function (fields, path) {
4586
+ var _this = this;
4587
+ if (!!this.orConditions) {
4588
+ return this.orConditions.some(function (orCondition) { return _this.matchEqualityCondition(fields, orCondition, path); });
4589
+ }
4590
+ else if (!!this.andConditions) {
4591
+ return this.andConditions.every(function (andCondition) { return _this.matchEqualityCondition(fields, andCondition, path); });
4498
4592
  }
4499
4593
  else {
4500
- return fields[head];
4594
+ return false;
4501
4595
  }
4502
4596
  };
4503
- ConditionParser.isDynamicList = function (dynamiclist) {
4504
- return !___namespace.isEmpty(dynamiclist) &&
4505
- (___namespace.has(dynamiclist, 'value') && ___namespace.has(dynamiclist, 'list_items'));
4506
- };
4507
- ConditionParser.getField = function (condition) {
4508
- var separator = ShowCondition.CONTAINS;
4509
- if (condition.indexOf(ShowCondition.CONTAINS) < 0) {
4510
- separator = ShowCondition.CONDITION_EQUALS;
4511
- if (condition.indexOf(ShowCondition.CONDITION_NOT_EQUALS) > -1) {
4512
- separator = ShowCondition.CONDITION_NOT_EQUALS;
4513
- }
4597
+ ShowCondition.prototype.matchEqualityCondition = function (fields, condition, path) {
4598
+ var _a = __read(ShowCondition.getField(condition), 2), field = _a[0], conditionSeparator = _a[1];
4599
+ var _b = __read(field.split('.')), head = _b[0], tail = _b.slice(1);
4600
+ var currentValue = this.findValueForComplexCondition(fields, head, tail, path);
4601
+ var expectedValue = this.unquoted(condition.split(conditionSeparator)[1]);
4602
+ if (conditionSeparator === ShowCondition.CONTAINS) {
4603
+ return this.checkValueContains(expectedValue, currentValue);
4604
+ }
4605
+ else {
4606
+ return this.checkValueEquals(expectedValue, currentValue, conditionSeparator);
4514
4607
  }
4515
- return [condition.split(separator)[0], separator];
4516
4608
  };
4517
- ConditionParser.checkValueEquals = function (expectedValue, currentValue, conditionSeparaor) {
4609
+ ShowCondition.prototype.checkValueEquals = function (expectedValue, currentValue, conditionSeparaor) {
4518
4610
  if (expectedValue.search('[,]') > -1) { // for multi-select list
4519
4611
  return this.checkMultiSelectListEquals(expectedValue, currentValue, conditionSeparaor);
4520
4612
  }
@@ -4534,7 +4626,7 @@
4534
4626
  }
4535
4627
  }
4536
4628
  };
4537
- ConditionParser.checkValueNotEquals = function (expectedValue, currentValue) {
4629
+ ShowCondition.prototype.checkValueNotEquals = function (expectedValue, currentValue) {
4538
4630
  var formatCurrentValue = currentValue ? currentValue.toString().trim() : '';
4539
4631
  if ('*' === expectedValue && formatCurrentValue !== '') {
4540
4632
  return false;
@@ -4542,7 +4634,7 @@
4542
4634
  var formatExpectedValue = expectedValue ? expectedValue.toString().trim() : '';
4543
4635
  return formatCurrentValue != formatExpectedValue; // tslint:disable-line
4544
4636
  };
4545
- ConditionParser.checkMultiSelectListEquals = function (expectedValue, currentValue, conditionSeparator) {
4637
+ ShowCondition.prototype.checkMultiSelectListEquals = function (expectedValue, currentValue, conditionSeparator) {
4546
4638
  var expectedValues = expectedValue.split(',').sort().toString();
4547
4639
  var values = currentValue ? currentValue.sort().toString() : '';
4548
4640
  if (conditionSeparator === ShowCondition.CONDITION_NOT_EQUALS) {
@@ -4552,7 +4644,7 @@
4552
4644
  return expectedValues === values;
4553
4645
  }
4554
4646
  };
4555
- ConditionParser.checkValueContains = function (expectedValue, currentValue) {
4647
+ ShowCondition.prototype.checkValueContains = function (expectedValue, currentValue) {
4556
4648
  if (expectedValue.search(',') > -1) {
4557
4649
  var expectedValues = expectedValue.split(',').sort();
4558
4650
  var values_1 = currentValue ? currentValue.sort().toString() : '';
@@ -4563,11 +4655,7 @@
4563
4655
  return values.search(expectedValue) >= 0;
4564
4656
  }
4565
4657
  };
4566
- ConditionParser.unquoted = function (str) {
4567
- var res = str.replace(/^"|"$/g, '');
4568
- return res;
4569
- };
4570
- ConditionParser.findValueForComplexCondition = function (fields, head, tail, path) {
4658
+ ShowCondition.prototype.findValueForComplexCondition = function (fields, head, tail, path) {
4571
4659
  if (!fields) {
4572
4660
  return undefined;
4573
4661
  }
@@ -4583,7 +4671,7 @@
4583
4671
  }
4584
4672
  }
4585
4673
  };
4586
- ConditionParser.findValueForComplexConditionForPathIfAny = function (fields, head, tail, path) {
4674
+ ShowCondition.prototype.findValueForComplexConditionForPathIfAny = function (fields, head, tail, path) {
4587
4675
  if (path) {
4588
4676
  var _a = __read(path.split(/[_]+/g)), _ = _a[0], pathTail = _a.slice(1);
4589
4677
  return this.findValueForComplexCondition(fields[head], tail[0], tail.slice(1), pathTail.join('_'));
@@ -4592,9 +4680,9 @@
4592
4680
  return this.findValueForComplexCondition(fields[head], tail[0], tail.slice(1), path);
4593
4681
  }
4594
4682
  };
4595
- ConditionParser.findValueForComplexConditionInArray = function (fields, head, tail, path) {
4683
+ ShowCondition.prototype.findValueForComplexConditionInArray = function (fields, head, tail, path) {
4596
4684
  // use the path to resolve which array element we refer to
4597
- if (path.startsWith(head)) {
4685
+ if (path && path.startsWith(head)) {
4598
4686
  var _a = __read(path.split(/[_]+/g)), _ = _a[0], pathTail = _a.slice(1);
4599
4687
  if (pathTail.length > 0) {
4600
4688
  try {
@@ -4603,239 +4691,43 @@
4603
4691
  return (fields[head][arrayIndex] !== undefined) ? this.findValueForComplexCondition(fields[head][arrayIndex]['value'], tail[0], tail.slice(1), dropNumberPath.join('_')) : null;
4604
4692
  }
4605
4693
  catch (e) {
4606
- console.error('Error while parsing number', pathTail[0], e);
4694
+ console.log('Error while parsing number', pathTail[0], e);
4607
4695
  }
4608
4696
  }
4609
4697
  }
4610
4698
  else {
4611
- console.error('Path in formArray should start with ', head, ', full path: ', path);
4699
+ console.log('Path in formArray should start with ', head, ', full path: ', path);
4612
4700
  }
4613
4701
  };
4614
- ConditionParser.removeStarChar = function (str) {
4615
- if (str && str.indexOf('*') > -1) {
4616
- return str.substring(0, str.indexOf('*'));
4617
- }
4618
- return str;
4619
- };
4620
- ConditionParser.okIfBothEmpty = function (right, value) {
4621
- return value === null && (right === '');
4622
- };
4623
- return ConditionParser;
4624
- }());
4625
-
4626
- var ShowCondition = /** @class */ (function () {
4627
- // Expects a show condition of the form: <fieldName>="string"
4628
- function ShowCondition(condition) {
4629
- this.condition = condition;
4630
- this.conditions = [];
4631
- if (!!condition) {
4632
- this.conditions = ConditionParser.parse(condition);
4633
- }
4634
- }
4635
- ShowCondition.addPathPrefixToCondition = function (showCondition, pathPrefix) {
4636
- if (!pathPrefix || pathPrefix === '') {
4637
- return showCondition;
4638
- }
4639
- if (!showCondition) {
4640
- return '';
4641
- }
4642
- var formula = ConditionParser.parse(showCondition);
4643
- if (!formula) {
4644
- return showCondition;
4645
- }
4646
- this.processedList = [];
4647
- showCondition = showCondition.replace(/CONTAINS/g, ' CONTAINS');
4648
- var processedCondition = this.processAddPathPrefixToCondition(formula, pathPrefix, showCondition);
4649
- return processedCondition.replace(/ CONTAINS/g, 'CONTAINS');
4650
- };
4651
- ShowCondition.processAddPathPrefixToCondition = function (formula, pathPrefix, originalCondition) {
4652
- var _this = this;
4653
- var finalCondition = originalCondition;
4654
- if (Array.isArray(formula)) {
4655
- formula.forEach(function (condition) {
4656
- if (typeof condition === 'string' && _this.validJoinComparators.indexOf(condition) !== -1) {
4657
- // do nothing
4658
- }
4659
- else {
4660
- if (Array.isArray(condition)) {
4661
- finalCondition = _this.processAddPathPrefixToCondition(condition, pathPrefix, finalCondition);
4662
- }
4663
- else {
4664
- finalCondition = _this.extractConditions(condition, pathPrefix, finalCondition);
4665
- }
4666
- }
4667
- });
4668
- }
4669
- else {
4670
- finalCondition = this.extractConditions(formula, pathPrefix, finalCondition);
4671
- }
4672
- return finalCondition;
4673
- };
4674
- ShowCondition.extractConditions = function (condition, pathPrefix, originalCondition) {
4675
- if (condition.fieldReference.startsWith(pathPrefix)) {
4676
- return originalCondition;
4702
+ ShowCondition.prototype.getValue = function (fields, head) {
4703
+ if (this.isDynamicList(fields[head])) {
4704
+ return fields[head].value.code;
4677
4705
  }
4678
4706
  else {
4679
- if (originalCondition.indexOf(condition.fieldReference) > -1) {
4680
- if (this.processedList && this.processedList.indexOf(condition.fieldReference) === -1) {
4681
- this.processedList.push(condition.fieldReference);
4682
- var regularExp = new RegExp('(\\b)' + condition.fieldReference + '(?=[^"]*(?:"[^"]*"[^"]*)*$)(\\b)', 'g');
4683
- return originalCondition.replace(regularExp, pathPrefix + '.' + condition.fieldReference);
4684
- }
4685
- else {
4686
- return originalCondition;
4687
- }
4688
- }
4689
- }
4690
- };
4691
- // Cache instances so that we can cache results more effectively
4692
- ShowCondition.getInstance = function (condition) {
4693
- var instance = this.instanceCache.get(condition);
4694
- if (!instance) {
4695
- instance = new ShowCondition(condition);
4696
- this.instanceCache.set(condition, instance);
4697
- }
4698
- return instance;
4699
- };
4700
- ShowCondition.getField = function (condition) {
4701
- var separator = ShowCondition.CONTAINS;
4702
- if (condition.indexOf(ShowCondition.CONTAINS) < 0) {
4703
- separator = ShowCondition.CONDITION_EQUALS;
4704
- if (condition.indexOf(ShowCondition.CONDITION_NOT_EQUALS) > -1) {
4705
- separator = ShowCondition.CONDITION_NOT_EQUALS;
4706
- }
4707
- }
4708
- return [condition.split(separator)[0], separator];
4709
- };
4710
- ShowCondition.getConditions = function (formula) {
4711
- var _this = this;
4712
- var conditionList = [];
4713
- if (!!formula) {
4714
- var newFormula = typeof formula === 'string' ? JSON.parse(formula) : formula;
4715
- if (Array.isArray(newFormula)) {
4716
- newFormula.forEach(function (condition) {
4717
- if (!(typeof condition === 'string' && _this.validJoinComparators.indexOf(condition) !== -1)) {
4718
- if (Array.isArray(condition)) {
4719
- conditionList.push(ShowCondition.getConditions(condition).toString());
4720
- }
4721
- else {
4722
- conditionList.push(condition.fieldReference + condition.comparator + condition.value);
4723
- }
4724
- }
4725
- });
4726
- }
4727
- else {
4728
- conditionList.push(newFormula.fieldReference + newFormula.comparator + newFormula.value);
4729
- }
4730
- }
4731
- return conditionList.toString();
4732
- };
4733
- /**
4734
- * Determine whether a ShowCondition model is affected by fields that have
4735
- * a display_context of HIDDEN or READONLY, which means they aren't able to
4736
- * be changed by the user's actions.
4737
- *
4738
- * @param showCondition The ShowCondition model to evaluate.
4739
- * @param caseFields Inspected to see appropriate display_contexts.
4740
- */
4741
- ShowCondition.hiddenCannotChange = function (showCondition, caseFields) {
4742
- var e_1, _a;
4743
- if (showCondition && showCondition.conditions.length && caseFields) {
4744
- var conditions = this.getConditions(showCondition.conditions).split(',');
4745
- if (conditions && conditions.length > 0) {
4746
- var allUnchangeable = true;
4747
- var _loop_1 = function (condition) {
4748
- var _a = __read(ShowCondition.getField(condition), 1), field = _a[0];
4749
- var path = field.split('.');
4750
- var head = path.shift();
4751
- var caseField = caseFields.find(function (cf) { return cf.id === head; });
4752
- while (path.length > 0) {
4753
- head = path.shift();
4754
- if (caseField) {
4755
- // Jump out if this is HIDDEN or READONLY, regardless of whether or not it's
4756
- // complex or a collection - nested fields will "inherit" the display_context.
4757
- if (['HIDDEN', 'READONLY'].indexOf(caseField.display_context) > -1) {
4758
- break;
4759
- }
4760
- // Consider what type of field this is.
4761
- var ft = caseField.field_type;
4762
- switch (ft.type) {
4763
- case 'Collection':
4764
- if (ft.collection_field_type.type === 'Complex' && ft.collection_field_type.complex_fields) {
4765
- caseField = ft.collection_field_type.complex_fields.find(function (cf) { return cf.id === head; });
4766
- }
4767
- break;
4768
- case 'Complex':
4769
- if (ft.complex_fields) {
4770
- caseField = ft.complex_fields.find(function (cf) { return cf.id === head; });
4771
- }
4772
- break;
4773
- }
4774
- }
4775
- }
4776
- if (caseField) {
4777
- allUnchangeable = allUnchangeable && ['HIDDEN', 'READONLY'].indexOf(caseField.display_context) > -1;
4778
- }
4779
- };
4780
- try {
4781
- for (var conditions_1 = __values(conditions), conditions_1_1 = conditions_1.next(); !conditions_1_1.done; conditions_1_1 = conditions_1.next()) {
4782
- var condition = conditions_1_1.value;
4783
- _loop_1(condition);
4784
- }
4785
- }
4786
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
4787
- finally {
4788
- try {
4789
- if (conditions_1_1 && !conditions_1_1.done && (_a = conditions_1.return)) _a.call(conditions_1);
4790
- }
4791
- finally { if (e_1) throw e_1.error; }
4792
- }
4793
- return allUnchangeable;
4794
- }
4707
+ return fields[head];
4795
4708
  }
4796
- return false;
4797
4709
  };
4798
- ShowCondition.prototype.match = function (fields, path) {
4799
- return ConditionParser.evaluate(fields, this.conditions, this.updatePathName(path));
4710
+ ShowCondition.prototype.isDynamicList = function (dynamiclist) {
4711
+ return !___namespace.isEmpty(dynamiclist) &&
4712
+ (___namespace.has(dynamiclist, 'value') && ___namespace.has(dynamiclist, 'list_items'));
4800
4713
  };
4801
- ShowCondition.prototype.updatePathName = function (path) {
4802
- if (path && path.split(/[_]+/g).length > 0) {
4803
- /* tslint:disable-next-line */
4804
- var _a = __read(path.split(/[_]+/g)), pathName_1 = _a[0], pathTail = _a.slice(1);
4805
- var pathFinalIndex_1 = pathTail.pop();
4806
- var pathTailString = pathTail.toString();
4807
- pathTail = pathTail.map(function (value) {
4808
- return Number(pathFinalIndex_1) === Number(value) ? pathName_1 : value;
4809
- });
4810
- return pathTailString !== pathTail.toString()
4811
- ? pathName_1 + "_" + pathTail.join('_') + "_" + pathFinalIndex_1
4812
- : path;
4813
- }
4814
- else {
4815
- return path;
4816
- }
4714
+ ShowCondition.prototype.unquoted = function (str) {
4715
+ return str.replace(/(?:^")|(?:"$)/g, '');
4817
4716
  };
4818
- ShowCondition.prototype.matchByContextFields = function (contextFields) {
4819
- return this.match(FieldsUtils.toValuesMap(contextFields));
4717
+ ShowCondition.prototype.removeStarChar = function (str) {
4718
+ return str.substring(0, str.length - 1);
4820
4719
  };
4821
- /**
4822
- * Determine whether this is affected by fields that have a display_context
4823
- * of HIDDEN or READONLY, which means they aren't able to be changed by the
4824
- * user's actions.
4825
- *
4826
- * @param caseFields Inspected to see appropriate display_contexts.
4827
- */
4828
- ShowCondition.prototype.hiddenCannotChange = function (caseFields) {
4829
- return ShowCondition.hiddenCannotChange(this, caseFields);
4720
+ ShowCondition.prototype.okIfBothEmpty = function (right, value) {
4721
+ return value === null && (right === '');
4830
4722
  };
4831
4723
  return ShowCondition;
4832
4724
  }());
4725
+ ShowCondition.AND_CONDITION_REGEXP = new RegExp('\\sAND\\s(?![^"]*"(?:(?:[^"]*"){2})*[^"]*$)', 'g');
4726
+ ShowCondition.OR_CONDITION_REGEXP = new RegExp('\\sOR\\s(?![^"]*"(?:(?:[^"]*"){2})*[^"]*$)', 'g');
4833
4727
  ShowCondition.CONDITION_NOT_EQUALS = '!=';
4834
4728
  ShowCondition.CONDITION_EQUALS = '=';
4835
4729
  ShowCondition.CONTAINS = 'CONTAINS';
4836
4730
  ShowCondition.instanceCache = new Map();
4837
- ShowCondition.validJoinComparators = ['AND', 'OR'];
4838
- ShowCondition.processedList = [];
4839
4731
 
4840
4732
  var Constants = /** @class */ (function () {
4841
4733
  function Constants() {
@@ -7014,14 +6906,13 @@
7014
6906
  return rxjs.of(null);
7015
6907
  };
7016
6908
  /**
7017
- * Retrieves the HMCTS service details for a jurisdiction or service, including service codes. More than one
7018
- * service code may be present. For example, the Divorce jurisdiction/service has corresponding service codes of
7019
- * "ABA1" and "ABA2".
6909
+ * Retrieves the HMCTS service details for a jurisdiction or service, including service code. (For example, the "SSCS"
6910
+ * service has a corresponding service code of "BBA3".)
7020
6911
  *
7021
6912
  * @param serviceNames The service name(s) to look up, comma-separated if more than one
7022
6913
  * @returns An `Observable` of an array of service details
7023
6914
  */
7024
- CaseFlagRefdataService.prototype.getHmctsServiceDetailsByServiceName = function (serviceNames) {
6915
+ CaseFlagRefdataService.prototype.getHmctsServiceDetails = function (serviceNames) {
7025
6916
  var url = this.appConfig.getLocationRefApiUrl();
7026
6917
  if (url) {
7027
6918
  url += '/orgServices';
@@ -7032,26 +6923,6 @@
7032
6923
  }
7033
6924
  return rxjs.of(null);
7034
6925
  };
7035
- /**
7036
- * Retrieves the HMCTS service details for a case type, including service code. For example, the
7037
- * "FinancialRemedyContested" case type is associated with the Divorce jurisdiction/service and service code "ABA2".
7038
- *
7039
- * Note that a case type might not be associated with any service codes of a jurisdiction or service.
7040
- *
7041
- * @param caseTypeId The case type ID to look up
7042
- * @returns An `Observable` of an array of service details
7043
- */
7044
- CaseFlagRefdataService.prototype.getHmctsServiceDetailsByCaseType = function (caseTypeId) {
7045
- var url = this.appConfig.getLocationRefApiUrl();
7046
- if (url) {
7047
- url += '/orgServices';
7048
- if (caseTypeId) {
7049
- url += "?ccdCaseType=" + caseTypeId;
7050
- }
7051
- return this.http.get(url, { observe: 'body' });
7052
- }
7053
- return rxjs.of(null);
7054
- };
7055
6926
  return CaseFlagRefdataService;
7056
6927
  }());
7057
6928
  CaseFlagRefdataService.ɵfac = function CaseFlagRefdataService_Factory(t) { return new (t || CaseFlagRefdataService)(i0__namespace.ɵɵinject(HttpService), i0__namespace.ɵɵinject(AbstractAppConfig)); };
@@ -12412,7 +12283,7 @@
12412
12283
  if (rf & 2) {
12413
12284
  var ctx_r8 = i0__namespace.ɵɵnextContext(2);
12414
12285
  i0__namespace.ɵɵadvance(1);
12415
- i0__namespace.ɵɵproperty("formGroup", ctx_r8.caseFlagParentFormGroup)("jurisdiction", ctx_r8.jurisdiction)("caseTypeId", ctx_r8.caseTypeId);
12286
+ i0__namespace.ɵɵproperty("formGroup", ctx_r8.caseFlagParentFormGroup)("jurisdiction", ctx_r8.jurisdiction);
12416
12287
  }
12417
12288
  }
12418
12289
  function WriteCaseFlagFieldComponent_div_1_ng_container_6_Template(rf, ctx) {
@@ -12454,7 +12325,7 @@
12454
12325
  i0__namespace.ɵɵtext(3);
12455
12326
  i0__namespace.ɵɵelementEnd();
12456
12327
  i0__namespace.ɵɵtemplate(4, WriteCaseFlagFieldComponent_div_1_ng_container_4_Template, 2, 2, "ng-container", 11);
12457
- i0__namespace.ɵɵtemplate(5, WriteCaseFlagFieldComponent_div_1_ng_container_5_Template, 2, 3, "ng-container", 11);
12328
+ i0__namespace.ɵɵtemplate(5, WriteCaseFlagFieldComponent_div_1_ng_container_5_Template, 2, 2, "ng-container", 11);
12458
12329
  i0__namespace.ɵɵtemplate(6, WriteCaseFlagFieldComponent_div_1_ng_container_6_Template, 2, 3, "ng-container", 11);
12459
12330
  i0__namespace.ɵɵtemplate(7, WriteCaseFlagFieldComponent_div_1_ng_container_7_Template, 2, 2, "ng-container", 11);
12460
12331
  i0__namespace.ɵɵelementEnd();
@@ -12567,14 +12438,11 @@
12567
12438
  }
12568
12439
  }), true);
12569
12440
  this.createFlagCaption = exports.CaseFlagText.CAPTION;
12570
- // Get the case type ID from the CaseView object in the snapshot data (required for retrieving the available flag
12441
+ // Get the jurisdiction from the CaseView object in the snapshot data (required for retrieving the available flag
12571
12442
  // types for a case)
12572
- if (this.route.snapshot.data.case && this.route.snapshot.data.case.case_type) {
12573
- this.caseTypeId = this.route.snapshot.data.case.case_type.id;
12574
- // Get the jurisdiction (required for retrieving the available flag types if unable to determine using case type ID)
12575
- if (this.route.snapshot.data.case.case_type.jurisdiction) {
12576
- this.jurisdiction = this.route.snapshot.data.case.case_type.jurisdiction.id;
12577
- }
12443
+ if (this.route.snapshot.data.case && this.route.snapshot.data.case.case_type &&
12444
+ this.route.snapshot.data.case.case_type.jurisdiction) {
12445
+ this.jurisdiction = this.route.snapshot.data.case.case_type.jurisdiction.id;
12578
12446
  }
12579
12447
  // Extract all flags-related data from the CaseEventTrigger object in the snapshot data
12580
12448
  if (this.route.snapshot.data.eventTrigger && this.route.snapshot.data.eventTrigger.case_fields) {
@@ -12828,7 +12696,7 @@
12828
12696
  return WriteCaseFlagFieldComponent;
12829
12697
  }(AbstractFieldWriteComponent));
12830
12698
  WriteCaseFlagFieldComponent.ɵfac = function WriteCaseFlagFieldComponent_Factory(t) { return new (t || WriteCaseFlagFieldComponent)(i0__namespace.ɵɵdirectiveInject(i1__namespace$1.ActivatedRoute), i0__namespace.ɵɵdirectiveInject(CaseEditDataService)); };
12831
- WriteCaseFlagFieldComponent.ɵcmp = i0__namespace.ɵɵdefineComponent({ type: WriteCaseFlagFieldComponent, selectors: [["ccd-write-case-flag-field"]], features: [i0__namespace.ɵɵ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", "caseTypeId", "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) {
12699
+ WriteCaseFlagFieldComponent.ɵcmp = i0__namespace.ɵɵdefineComponent({ type: WriteCaseFlagFieldComponent, selectors: [["ccd-write-case-flag-field"]], features: [i0__namespace.ɵɵ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) {
12832
12700
  if (rf & 1) {
12833
12701
  i0__namespace.ɵɵtemplate(0, WriteCaseFlagFieldComponent_div_0_Template, 4, 1, "div", 0);
12834
12702
  i0__namespace.ɵɵtemplate(1, WriteCaseFlagFieldComponent_div_1_Template, 8, 10, "div", 1);
@@ -18204,7 +18072,7 @@
18204
18072
  i0__namespace.ɵɵadvance(2);
18205
18073
  i0__namespace.ɵɵproperty("ngForOf", ctx.currentCategories);
18206
18074
  }
18207
- }, directives: [i1__namespace.NgForOf, i1__namespace.NgTemplateOutlet], styles: [":host{position:relative;display:block}.folders{margin-bottom:20px}.folder{display:none;border-top:1px solid #ccc;margin:0 0 -1px}.folder,.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 });
18075
+ }, directives: [i1__namespace.NgForOf, i1__namespace.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 });
18208
18076
  (function () {
18209
18077
  (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(CaseFileViewFolderSelectorComponent, [{
18210
18078
  type: i0.Component,
@@ -19216,18 +19084,22 @@
19216
19084
  && this.formGroup['caseField'].id === this.caseLevelCaseFlagsFieldId
19217
19085
  ? exports.RefdataCaseFlagType.CASE
19218
19086
  : exports.RefdataCaseFlagType.PARTY;
19219
- // HMCTS service code is required to retrieve the relevant list of flag types; attempt to obtain it by case type ID first
19220
- this.flagRefdata$ = this.caseFlagRefdataService.getHmctsServiceDetailsByCaseType(this.caseTypeId)
19087
+ // HMCTS service code for a given jurisdiction is required to retrieve the relevant list of flag types
19088
+ this.flagRefdata$ = this.caseFlagRefdataService.getHmctsServiceDetails(this.jurisdiction)
19221
19089
  .pipe(
19222
- // If an error occurs retrieving HMCTS service details by case type ID, try by service name instead
19223
- operators.catchError(function (_) { return _this.caseFlagRefdataService.getHmctsServiceDetailsByServiceName(_this.jurisdiction); }),
19224
19090
  // Use switchMap to return an inner Observable of the flag types data, having received the service details
19225
19091
  // including service_code. This avoids having nested `subscribe`s, which is an anti-pattern!
19226
- operators.switchMap(function (serviceDetails) { return _this.caseFlagRefdataService.getCaseFlagsRefdata(serviceDetails[0].service_code, flagType); }))
19092
+ operators.switchMap(function (serviceDetails) {
19093
+ return _this.caseFlagRefdataService.getCaseFlagsRefdata(serviceDetails[0].service_code, flagType);
19094
+ }))
19227
19095
  .subscribe({
19228
- // First (and only) object in the returned array should be the top-level "Party" flag type
19229
- next: function (flagTypes) { return _this.flagTypes = flagTypes[0].childFlags; },
19230
- error: function (error) { return _this.onRefdataError(error); }
19096
+ next: function (flagTypes) {
19097
+ // First (and only) object in the returned array should be the top-level "Party" flag type
19098
+ _this.flagTypes = flagTypes[0].childFlags;
19099
+ },
19100
+ error: function (error) {
19101
+ _this.onRefdataError(error);
19102
+ }
19231
19103
  });
19232
19104
  };
19233
19105
  SelectFlagTypeComponent.prototype.ngOnDestroy = function () {
@@ -19300,7 +19172,7 @@
19300
19172
  return SelectFlagTypeComponent;
19301
19173
  }());
19302
19174
  SelectFlagTypeComponent.ɵfac = function SelectFlagTypeComponent_Factory(t) { return new (t || SelectFlagTypeComponent)(i0__namespace.ɵɵdirectiveInject(CaseFlagRefdataService)); };
19303
- SelectFlagTypeComponent.ɵcmp = i0__namespace.ɵɵdefineComponent({ type: SelectFlagTypeComponent, selectors: [["ccd-select-flag-type"]], inputs: { formGroup: "formGroup", jurisdiction: "jurisdiction", caseTypeId: "caseTypeId" }, 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) {
19175
+ SelectFlagTypeComponent.ɵcmp = i0__namespace.ɵɵ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) {
19304
19176
  if (rf & 1) {
19305
19177
  i0__namespace.ɵɵelementStart(0, "div", 0);
19306
19178
  i0__namespace.ɵɵelementStart(1, "div", 1);
@@ -19348,8 +19220,6 @@
19348
19220
  type: i0.Input
19349
19221
  }], jurisdiction: [{
19350
19222
  type: i0.Input
19351
- }], caseTypeId: [{
19352
- type: i0.Input
19353
19223
  }], caseFlagStateEmitter: [{
19354
19224
  type: i0.Output
19355
19225
  }], flagCommentsOptionalEmitter: [{
@@ -21624,10 +21494,7 @@
21624
21494
  }
21625
21495
  }, inputs: { dateControl: "dateControl" }, features: [i0__namespace.ɵɵProvidersFeature([
21626
21496
  { provide: i4.NGX_MAT_DATE_FORMATS, useValue: CUSTOM_MOMENT_FORMATS },
21627
- { provide: i4.NgxMatDateAdapter,
21628
- useClass: momentAdapter.NgxMatMomentAdapter,
21629
- deps: [i6.MAT_DATE_LOCALE, momentAdapter.NGX_MAT_MOMENT_DATE_ADAPTER_OPTIONS]
21630
- },
21497
+ { provide: i4.NgxMatDateAdapter, useClass: momentAdapter.NgxMatMomentAdapter },
21631
21498
  { provide: momentAdapter.NGX_MAT_MOMENT_DATE_ADAPTER_OPTIONS, useValue: { useUtc: true } }
21632
21499
  ]), i0__namespace.ɵɵ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) {
21633
21500
  if (rf & 1) {
@@ -21684,10 +21551,7 @@
21684
21551
  encapsulation: i0.ViewEncapsulation.None,
21685
21552
  providers: [
21686
21553
  { provide: i4.NGX_MAT_DATE_FORMATS, useValue: CUSTOM_MOMENT_FORMATS },
21687
- { provide: i4.NgxMatDateAdapter,
21688
- useClass: momentAdapter.NgxMatMomentAdapter,
21689
- deps: [i6.MAT_DATE_LOCALE, momentAdapter.NGX_MAT_MOMENT_DATE_ADAPTER_OPTIONS]
21690
- },
21554
+ { provide: i4.NgxMatDateAdapter, useClass: momentAdapter.NgxMatMomentAdapter },
21691
21555
  { provide: momentAdapter.NGX_MAT_MOMENT_DATE_ADAPTER_OPTIONS, useValue: { useUtc: true } }
21692
21556
  ]
21693
21557
  }]
@@ -27754,7 +27618,6 @@
27754
27618
  _this.activitySubscription = _this.postViewActivity().subscribe();
27755
27619
  });
27756
27620
  }
27757
- this.checkRouteAndSetCaseViewTab();
27758
27621
  // Check for active Case Flags
27759
27622
  this.activeCaseFlags = this.hasActiveCaseFlags();
27760
27623
  };
@@ -27784,20 +27647,6 @@
27784
27647
  subscription.unsubscribe();
27785
27648
  }
27786
27649
  };
27787
- CaseFullAccessViewComponent.prototype.checkRouteAndSetCaseViewTab = function () {
27788
- var _this = this;
27789
- this.router.events.subscribe(function (val) {
27790
- var url = val && val.url;
27791
- if (url) {
27792
- var tabUrl = url ? url.split('#') : null;
27793
- var tab_1 = tabUrl && tabUrl.length > 1 ? tabUrl[tabUrl.length - 1].replaceAll('%20', ' ') : '';
27794
- var matTab = _this.tabGroup._tabs.find(function (x) { return x.textLabel.toLowerCase() === tab_1.toLowerCase(); });
27795
- if (matTab && matTab.position) {
27796
- _this.tabGroup.selectedIndex = matTab.position;
27797
- }
27798
- }
27799
- });
27800
- };
27801
27650
  CaseFullAccessViewComponent.prototype.postViewActivity = function () {
27802
27651
  return this.activityPollingService.postViewActivity(this.caseDetails.case_id);
27803
27652
  };
@@ -31555,12 +31404,12 @@
31555
31404
  i0__namespace.ɵɵproperty("checked", ctx_r6.allOnPageSelected())("disabled", !ctx_r6.canAnyBeShared());
31556
31405
  }
31557
31406
  }
31558
- function SearchResultComponent_table_0_th_10_div_4_Template(rf, ctx) {
31407
+ function SearchResultComponent_table_0_th_10_div_6_Template(rf, ctx) {
31559
31408
  if (rf & 1) {
31560
31409
  var _r19_1 = i0__namespace.ɵɵgetCurrentView();
31561
31410
  i0__namespace.ɵɵelementStart(0, "div", 27);
31562
31411
  i0__namespace.ɵɵelementStart(1, "a", 28);
31563
- i0__namespace.ɵɵlistener("click", function SearchResultComponent_table_0_th_10_div_4_Template_a_click_1_listener() { i0__namespace.ɵɵrestoreView(_r19_1); var col_r15 = i0__namespace.ɵɵnextContext().$implicit; var ctx_r17 = i0__namespace.ɵɵnextContext(2); return ctx_r17.sort(col_r15); });
31412
+ i0__namespace.ɵɵlistener("click", function SearchResultComponent_table_0_th_10_div_6_Template_a_click_1_listener() { i0__namespace.ɵɵrestoreView(_r19_1); var col_r15 = i0__namespace.ɵɵnextContext().$implicit; var ctx_r17 = i0__namespace.ɵɵnextContext(2); return ctx_r17.sort(col_r15); });
31564
31413
  i0__namespace.ɵɵelementEnd();
31565
31414
  i0__namespace.ɵɵelementEnd();
31566
31415
  }
@@ -31575,12 +31424,16 @@
31575
31424
  if (rf & 1) {
31576
31425
  var _r22_1 = i0__namespace.ɵɵgetCurrentView();
31577
31426
  i0__namespace.ɵɵelementStart(0, "th");
31578
- i0__namespace.ɵɵelementStart(1, "div", 24);
31579
- i0__namespace.ɵɵelementStart(2, "div", 25);
31580
- i0__namespace.ɵɵlistener("click", function SearchResultComponent_table_0_th_10_Template_div_click_2_listener() { i0__namespace.ɵɵrestoreView(_r22_1); var col_r15 = ctx.$implicit; var ctx_r21 = i0__namespace.ɵɵnextContext(2); return ctx_r21.sort(col_r15); });
31581
- i0__namespace.ɵɵtext(3);
31427
+ i0__namespace.ɵɵelementStart(1, "table", 24);
31428
+ i0__namespace.ɵɵelementStart(2, "tr");
31429
+ i0__namespace.ɵɵelementStart(3, "th");
31430
+ i0__namespace.ɵɵelementStart(4, "div", 25);
31431
+ i0__namespace.ɵɵlistener("click", function SearchResultComponent_table_0_th_10_Template_div_click_4_listener() { i0__namespace.ɵɵrestoreView(_r22_1); var col_r15 = ctx.$implicit; var ctx_r21 = i0__namespace.ɵɵnextContext(2); return ctx_r21.sort(col_r15); });
31432
+ i0__namespace.ɵɵtext(5);
31433
+ i0__namespace.ɵɵelementEnd();
31434
+ i0__namespace.ɵɵtemplate(6, SearchResultComponent_table_0_th_10_div_6_Template, 2, 1, "div", 26);
31435
+ i0__namespace.ɵɵelementEnd();
31582
31436
  i0__namespace.ɵɵelementEnd();
31583
- i0__namespace.ɵɵtemplate(4, SearchResultComponent_table_0_th_10_div_4_Template, 2, 1, "div", 26);
31584
31437
  i0__namespace.ɵɵelementEnd();
31585
31438
  i0__namespace.ɵɵelementEnd();
31586
31439
  }
@@ -31589,7 +31442,7 @@
31589
31442
  var ctx_r7 = i0__namespace.ɵɵnextContext(2);
31590
31443
  i0__namespace.ɵɵadvance(1);
31591
31444
  i0__namespace.ɵɵattribute("aria-label", "Sort by " + col_r15.label + " " + ctx_r7.isSortAscending(col_r15) ? "ascending" : "descending");
31592
- i0__namespace.ɵɵadvance(2);
31445
+ i0__namespace.ɵɵadvance(4);
31593
31446
  i0__namespace.ɵɵtextInterpolate(col_r15.label);
31594
31447
  i0__namespace.ɵɵadvance(1);
31595
31448
  i0__namespace.ɵɵproperty("ngIf", ctx_r7.comparator(col_r15));
@@ -31925,7 +31778,7 @@
31925
31778
  i0__namespace.ɵɵelementStart(7, "thead");
31926
31779
  i0__namespace.ɵɵelementStart(8, "tr", 7);
31927
31780
  i0__namespace.ɵɵtemplate(9, SearchResultComponent_table_0_th_9_Template, 4, 2, "th", 8);
31928
- i0__namespace.ɵɵtemplate(10, SearchResultComponent_table_0_th_10_Template, 5, 3, "th", 9);
31781
+ i0__namespace.ɵɵtemplate(10, SearchResultComponent_table_0_th_10_Template, 7, 3, "th", 9);
31929
31782
  i0__namespace.ɵɵtemplate(11, SearchResultComponent_table_0_th_11_Template, 1, 0, "th", 10);
31930
31783
  i0__namespace.ɵɵelementEnd();
31931
31784
  i0__namespace.ɵɵelementEnd();