@hmcts/ccd-case-ui-toolkit 6.13.0-test1 → 6.13.9-eui-7744-mv-upgrade

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/bundles/hmcts-ccd-case-ui-toolkit.umd.js +486 -258
  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 +20 -3
  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 +30 -19
  8. package/esm2015/lib/shared/components/palette/case-flag/write-case-flag-field.component.js +35 -24
  9. package/esm2015/lib/shared/components/palette/datetime-picker/datetime-picker.component.js +10 -3
  10. package/esm2015/lib/shared/components/palette/palette.module.js +2 -2
  11. package/esm2015/lib/shared/components/search-result/search-result.component.js +10 -14
  12. package/esm2015/lib/shared/directives/conditional-show/domain/conditional-show.model.js +103 -200
  13. package/esm2015/lib/shared/directives/conditional-show/services/condition-parser.service.js +201 -0
  14. package/esm2015/lib/shared/directives/conditional-show/services/condition.peg.js +103 -0
  15. package/esm2015/lib/shared/domain/case-flag/hmcts-service-detail.model.js +1 -1
  16. package/esm2015/lib/shared/services/case-flag/case-flag-refdata.service.js +25 -4
  17. package/fesm2015/hmcts-ccd-case-ui-toolkit.js +502 -238
  18. package/fesm2015/hmcts-ccd-case-ui-toolkit.js.map +1 -1
  19. package/lib/shared/components/case-viewer/case-full-access-view/case-full-access-view.component.d.ts +1 -0
  20. package/lib/shared/components/case-viewer/case-full-access-view/case-full-access-view.component.d.ts.map +1 -1
  21. package/lib/shared/components/palette/case-flag/components/select-flag-type/select-flag-type.component.d.ts +3 -1
  22. package/lib/shared/components/palette/case-flag/components/select-flag-type/select-flag-type.component.d.ts.map +1 -1
  23. package/lib/shared/components/palette/case-flag/write-case-flag-field.component.d.ts +2 -0
  24. package/lib/shared/components/palette/case-flag/write-case-flag-field.component.d.ts.map +1 -1
  25. package/lib/shared/components/palette/datetime-picker/datetime-picker.component.d.ts.map +1 -1
  26. package/lib/shared/directives/conditional-show/domain/conditional-show.model.d.ts +13 -30
  27. package/lib/shared/directives/conditional-show/domain/conditional-show.model.d.ts.map +1 -1
  28. package/lib/shared/directives/conditional-show/services/condition-parser.service.d.ts +30 -0
  29. package/lib/shared/directives/conditional-show/services/condition-parser.service.d.ts.map +1 -0
  30. package/lib/shared/directives/conditional-show/services/condition.peg.d.ts +3 -0
  31. package/lib/shared/directives/conditional-show/services/condition.peg.d.ts.map +1 -0
  32. package/lib/shared/domain/case-flag/hmcts-service-detail.model.d.ts.map +1 -1
  33. package/lib/shared/services/case-flag/case-flag-refdata.service.d.ts +14 -3
  34. package/lib/shared/services/case-flag/case-flag-refdata.service.d.ts.map +1 -1
  35. package/package.json +1 -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('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';
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';
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 ___namespace = /*#__PURE__*/_interopNamespace(_);
34
33
  var moment__namespace = /*#__PURE__*/_interopNamespace(moment);
34
+ var ___namespace = /*#__PURE__*/_interopNamespace(_);
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);
@@ -534,6 +534,64 @@
534
534
  function __param(paramIndex, decorator) {
535
535
  return function (target, key) { decorator(target, key, paramIndex); };
536
536
  }
537
+ function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
538
+ function accept(f) { if (f !== void 0 && typeof f !== "function")
539
+ throw new TypeError("Function expected"); return f; }
540
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
541
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
542
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
543
+ var _, done = false;
544
+ for (var i = decorators.length - 1; i >= 0; i--) {
545
+ var context = {};
546
+ for (var p in contextIn)
547
+ context[p] = p === "access" ? {} : contextIn[p];
548
+ for (var p in contextIn.access)
549
+ context.access[p] = contextIn.access[p];
550
+ context.addInitializer = function (f) { if (done)
551
+ throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
552
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
553
+ if (kind === "accessor") {
554
+ if (result === void 0)
555
+ continue;
556
+ if (result === null || typeof result !== "object")
557
+ throw new TypeError("Object expected");
558
+ if (_ = accept(result.get))
559
+ descriptor.get = _;
560
+ if (_ = accept(result.set))
561
+ descriptor.set = _;
562
+ if (_ = accept(result.init))
563
+ initializers.push(_);
564
+ }
565
+ else if (_ = accept(result)) {
566
+ if (kind === "field")
567
+ initializers.push(_);
568
+ else
569
+ descriptor[key] = _;
570
+ }
571
+ }
572
+ if (target)
573
+ Object.defineProperty(target, contextIn.name, descriptor);
574
+ done = true;
575
+ }
576
+ ;
577
+ function __runInitializers(thisArg, initializers, value) {
578
+ var useValue = arguments.length > 2;
579
+ for (var i = 0; i < initializers.length; i++) {
580
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
581
+ }
582
+ return useValue ? value : void 0;
583
+ }
584
+ ;
585
+ function __propKey(x) {
586
+ return typeof x === "symbol" ? x : "".concat(x);
587
+ }
588
+ ;
589
+ function __setFunctionName(f, name, prefix) {
590
+ if (typeof name === "symbol")
591
+ name = name.description ? "[".concat(name.description, "]") : "";
592
+ return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
593
+ }
594
+ ;
537
595
  function __metadata(metadataKey, metadataValue) {
538
596
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
539
597
  return Reflect.metadata(metadataKey, metadataValue);
@@ -733,7 +791,7 @@
733
791
  function __asyncDelegator(o) {
734
792
  var i, p;
735
793
  return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
736
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
794
+ function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
737
795
  }
738
796
  function __asyncValues(o) {
739
797
  if (!Symbol.asyncIterator)
@@ -4419,183 +4477,69 @@
4419
4477
  }], null, null);
4420
4478
  })();
4421
4479
 
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
- }
4480
+ 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:FieldRef _? 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 FieldRef\n = FieldReference / MetadataFieldReference\n\n MetadataFieldReference\n = s1:openSquare fr:FieldReference s2:closeSquare\n { return s1 + fr + s2 }\n\n FieldReference\n = characters:[A-Za-z0-9._-]+ { return characters.join(\"\"); }\n\n openSquare\n = \"[\"\n\n closeSquare\n = \"]\"\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\"";
4481
+ var peg = pegjs.generate(conditionSource);
4482
+
4483
+ var ConditionParser = /** @class */ (function () {
4484
+ function ConditionParser() {
4436
4485
  }
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 ');
4450
- }
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);
4486
+ /**
4487
+ * Parse the raw formula and output structured condition data
4488
+ * that can be used in evaluating show/hide logic
4489
+ * @param condition raw formula e.g. TextField = "Hello"
4490
+ */
4491
+ ConditionParser.parse = function (condition) {
4492
+ if (!condition) {
4493
+ return null;
4458
4494
  }
4459
- return instance;
4495
+ ;
4496
+ condition = condition.replace(/CONTAINS/g, ' CONTAINS');
4497
+ return peg.parse(condition.trim(), {});
4460
4498
  };
4461
4499
  /**
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.
4500
+ * Evaluate the current fields against the conditions
4501
+ * @param fields the current page fields and their value
4502
+ * @param conditions The PegJS formula output
4468
4503
  */
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
- }
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; }
4504
+ ConditionParser.evaluate = function (fields, conditions, path) {
4505
+ var _this = this;
4506
+ if (!conditions || conditions.length === 0) {
4507
+ return true;
4508
+ }
4509
+ ;
4510
+ var validJoinComparators = ['AND', 'OR'];
4511
+ var result = conditions.reduce(function (accumulator, condition, index) {
4512
+ var isJoinComparator = function (comparator) { return (typeof comparator === 'string' && validJoinComparators.indexOf(comparator) !== -1); };
4513
+ if (isJoinComparator(condition)) {
4514
+ return accumulator;
4515
+ }
4516
+ ;
4517
+ var currentConditionResult = true;
4518
+ if (Array.isArray(condition)) {
4519
+ currentConditionResult = _this.evaluate(fields, condition);
4520
+ if (isJoinComparator(conditions[index - 1])) {
4521
+ return _this.evaluateJoin(accumulator, conditions[index - 1], currentConditionResult);
4520
4522
  }
4521
- return allUnchangeable;
4522
4523
  }
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;
4524
+ if (condition.comparator) {
4525
+ var formula = condition.fieldReference + condition.comparator + condition.value;
4526
+ currentConditionResult = _this.matchEqualityCondition(fields, formula, path);
4530
4527
  }
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;
4528
+ if (isJoinComparator(conditions[index - 1])) {
4529
+ return _this.evaluateJoin(accumulator, conditions[index - 1], currentConditionResult);
4541
4530
  }
4542
- }
4543
- return [condition.split(separator)[0], separator];
4544
- };
4545
- ShowCondition.prototype.match = function (fields, path) {
4546
- if (!this.condition) {
4547
- return true;
4548
- }
4549
- return this.matchAndConditions(fields, this.updatePathName(path));
4550
- };
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;
4580
- }
4581
- else {
4582
- return path;
4583
- }
4531
+ return currentConditionResult;
4532
+ }, true);
4533
+ return result;
4584
4534
  };
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); });
4592
- }
4593
- else {
4594
- return false;
4535
+ ConditionParser.evaluateJoin = function (leftResult, comparator, rightResult) {
4536
+ switch (comparator) {
4537
+ case 'OR': return leftResult || rightResult;
4538
+ case 'AND': return leftResult && rightResult;
4595
4539
  }
4596
4540
  };
4597
- ShowCondition.prototype.matchEqualityCondition = function (fields, condition, path) {
4598
- var _a = __read(ShowCondition.getField(condition), 2), field = _a[0], conditionSeparator = _a[1];
4541
+ ConditionParser.matchEqualityCondition = function (fields, condition, path) {
4542
+ var _a = __read(this.getField(condition), 2), field = _a[0], conditionSeparator = _a[1];
4599
4543
  var _b = __read(field.split('.')), head = _b[0], tail = _b.slice(1);
4600
4544
  var currentValue = this.findValueForComplexCondition(fields, head, tail, path);
4601
4545
  var expectedValue = this.unquoted(condition.split(conditionSeparator)[1]);
@@ -4606,7 +4550,29 @@
4606
4550
  return this.checkValueEquals(expectedValue, currentValue, conditionSeparator);
4607
4551
  }
4608
4552
  };
4609
- ShowCondition.prototype.checkValueEquals = function (expectedValue, currentValue, conditionSeparaor) {
4553
+ ConditionParser.getValue = function (fields, head) {
4554
+ if (this.isDynamicList(fields[head])) {
4555
+ return fields[head].value.code;
4556
+ }
4557
+ else {
4558
+ return fields[head];
4559
+ }
4560
+ };
4561
+ ConditionParser.isDynamicList = function (dynamiclist) {
4562
+ return !___namespace.isEmpty(dynamiclist) &&
4563
+ (___namespace.has(dynamiclist, 'value') && ___namespace.has(dynamiclist, 'list_items'));
4564
+ };
4565
+ ConditionParser.getField = function (condition) {
4566
+ var separator = ShowCondition.CONTAINS;
4567
+ if (condition.indexOf(ShowCondition.CONTAINS) < 0) {
4568
+ separator = ShowCondition.CONDITION_EQUALS;
4569
+ if (condition.indexOf(ShowCondition.CONDITION_NOT_EQUALS) > -1) {
4570
+ separator = ShowCondition.CONDITION_NOT_EQUALS;
4571
+ }
4572
+ }
4573
+ return [condition.split(separator)[0], separator];
4574
+ };
4575
+ ConditionParser.checkValueEquals = function (expectedValue, currentValue, conditionSeparaor) {
4610
4576
  if (expectedValue.search('[,]') > -1) { // for multi-select list
4611
4577
  return this.checkMultiSelectListEquals(expectedValue, currentValue, conditionSeparaor);
4612
4578
  }
@@ -4626,7 +4592,7 @@
4626
4592
  }
4627
4593
  }
4628
4594
  };
4629
- ShowCondition.prototype.checkValueNotEquals = function (expectedValue, currentValue) {
4595
+ ConditionParser.checkValueNotEquals = function (expectedValue, currentValue) {
4630
4596
  var formatCurrentValue = currentValue ? currentValue.toString().trim() : '';
4631
4597
  if ('*' === expectedValue && formatCurrentValue !== '') {
4632
4598
  return false;
@@ -4634,7 +4600,7 @@
4634
4600
  var formatExpectedValue = expectedValue ? expectedValue.toString().trim() : '';
4635
4601
  return formatCurrentValue != formatExpectedValue; // tslint:disable-line
4636
4602
  };
4637
- ShowCondition.prototype.checkMultiSelectListEquals = function (expectedValue, currentValue, conditionSeparator) {
4603
+ ConditionParser.checkMultiSelectListEquals = function (expectedValue, currentValue, conditionSeparator) {
4638
4604
  var expectedValues = expectedValue.split(',').sort().toString();
4639
4605
  var values = currentValue ? currentValue.sort().toString() : '';
4640
4606
  if (conditionSeparator === ShowCondition.CONDITION_NOT_EQUALS) {
@@ -4644,7 +4610,7 @@
4644
4610
  return expectedValues === values;
4645
4611
  }
4646
4612
  };
4647
- ShowCondition.prototype.checkValueContains = function (expectedValue, currentValue) {
4613
+ ConditionParser.checkValueContains = function (expectedValue, currentValue) {
4648
4614
  if (expectedValue.search(',') > -1) {
4649
4615
  var expectedValues = expectedValue.split(',').sort();
4650
4616
  var values_1 = currentValue ? currentValue.sort().toString() : '';
@@ -4655,7 +4621,11 @@
4655
4621
  return values.search(expectedValue) >= 0;
4656
4622
  }
4657
4623
  };
4658
- ShowCondition.prototype.findValueForComplexCondition = function (fields, head, tail, path) {
4624
+ ConditionParser.unquoted = function (str) {
4625
+ var res = str.replace(/^"|"$/g, '');
4626
+ return res;
4627
+ };
4628
+ ConditionParser.findValueForComplexCondition = function (fields, head, tail, path) {
4659
4629
  if (!fields) {
4660
4630
  return undefined;
4661
4631
  }
@@ -4671,7 +4641,7 @@
4671
4641
  }
4672
4642
  }
4673
4643
  };
4674
- ShowCondition.prototype.findValueForComplexConditionForPathIfAny = function (fields, head, tail, path) {
4644
+ ConditionParser.findValueForComplexConditionForPathIfAny = function (fields, head, tail, path) {
4675
4645
  if (path) {
4676
4646
  var _a = __read(path.split(/[_]+/g)), _ = _a[0], pathTail = _a.slice(1);
4677
4647
  return this.findValueForComplexCondition(fields[head], tail[0], tail.slice(1), pathTail.join('_'));
@@ -4680,9 +4650,9 @@
4680
4650
  return this.findValueForComplexCondition(fields[head], tail[0], tail.slice(1), path);
4681
4651
  }
4682
4652
  };
4683
- ShowCondition.prototype.findValueForComplexConditionInArray = function (fields, head, tail, path) {
4653
+ ConditionParser.findValueForComplexConditionInArray = function (fields, head, tail, path) {
4684
4654
  // use the path to resolve which array element we refer to
4685
- if (path && path.startsWith(head)) {
4655
+ if (path.startsWith(head)) {
4686
4656
  var _a = __read(path.split(/[_]+/g)), _ = _a[0], pathTail = _a.slice(1);
4687
4657
  if (pathTail.length > 0) {
4688
4658
  try {
@@ -4691,43 +4661,239 @@
4691
4661
  return (fields[head][arrayIndex] !== undefined) ? this.findValueForComplexCondition(fields[head][arrayIndex]['value'], tail[0], tail.slice(1), dropNumberPath.join('_')) : null;
4692
4662
  }
4693
4663
  catch (e) {
4694
- console.log('Error while parsing number', pathTail[0], e);
4664
+ console.error('Error while parsing number', pathTail[0], e);
4695
4665
  }
4696
4666
  }
4697
4667
  }
4698
4668
  else {
4699
- console.log('Path in formArray should start with ', head, ', full path: ', path);
4669
+ console.error('Path in formArray should start with ', head, ', full path: ', path);
4700
4670
  }
4701
4671
  };
4702
- ShowCondition.prototype.getValue = function (fields, head) {
4703
- if (this.isDynamicList(fields[head])) {
4704
- return fields[head].value.code;
4672
+ ConditionParser.removeStarChar = function (str) {
4673
+ if (str && str.indexOf('*') > -1) {
4674
+ return str.substring(0, str.indexOf('*'));
4675
+ }
4676
+ return str;
4677
+ };
4678
+ ConditionParser.okIfBothEmpty = function (right, value) {
4679
+ return value === null && (right === '');
4680
+ };
4681
+ return ConditionParser;
4682
+ }());
4683
+
4684
+ var ShowCondition = /** @class */ (function () {
4685
+ // Expects a show condition of the form: <fieldName>="string"
4686
+ function ShowCondition(condition) {
4687
+ this.condition = condition;
4688
+ this.conditions = [];
4689
+ if (!!condition) {
4690
+ this.conditions = ConditionParser.parse(condition);
4691
+ }
4692
+ }
4693
+ ShowCondition.addPathPrefixToCondition = function (showCondition, pathPrefix) {
4694
+ if (!pathPrefix || pathPrefix === '') {
4695
+ return showCondition;
4696
+ }
4697
+ if (!showCondition) {
4698
+ return '';
4699
+ }
4700
+ var formula = ConditionParser.parse(showCondition);
4701
+ if (!formula) {
4702
+ return showCondition;
4703
+ }
4704
+ this.processedList = [];
4705
+ showCondition = showCondition.replace(/CONTAINS/g, ' CONTAINS');
4706
+ var processedCondition = this.processAddPathPrefixToCondition(formula, pathPrefix, showCondition);
4707
+ return processedCondition.replace(/ CONTAINS/g, 'CONTAINS');
4708
+ };
4709
+ ShowCondition.processAddPathPrefixToCondition = function (formula, pathPrefix, originalCondition) {
4710
+ var _this = this;
4711
+ var finalCondition = originalCondition;
4712
+ if (Array.isArray(formula)) {
4713
+ formula.forEach(function (condition) {
4714
+ if (typeof condition === 'string' && _this.validJoinComparators.indexOf(condition) !== -1) {
4715
+ // do nothing
4716
+ }
4717
+ else {
4718
+ if (Array.isArray(condition)) {
4719
+ finalCondition = _this.processAddPathPrefixToCondition(condition, pathPrefix, finalCondition);
4720
+ }
4721
+ else {
4722
+ finalCondition = _this.extractConditions(condition, pathPrefix, finalCondition);
4723
+ }
4724
+ }
4725
+ });
4705
4726
  }
4706
4727
  else {
4707
- return fields[head];
4728
+ finalCondition = this.extractConditions(formula, pathPrefix, finalCondition);
4708
4729
  }
4730
+ return finalCondition;
4709
4731
  };
4710
- ShowCondition.prototype.isDynamicList = function (dynamiclist) {
4711
- return !___namespace.isEmpty(dynamiclist) &&
4712
- (___namespace.has(dynamiclist, 'value') && ___namespace.has(dynamiclist, 'list_items'));
4732
+ ShowCondition.extractConditions = function (condition, pathPrefix, originalCondition) {
4733
+ if (condition.fieldReference.startsWith(pathPrefix)) {
4734
+ return originalCondition;
4735
+ }
4736
+ else {
4737
+ if (originalCondition.indexOf(condition.fieldReference) > -1) {
4738
+ if (this.processedList && this.processedList.indexOf(condition.fieldReference) === -1) {
4739
+ this.processedList.push(condition.fieldReference);
4740
+ var regularExp = new RegExp('(\\b)' + condition.fieldReference + '(?=[^"]*(?:"[^"]*"[^"]*)*$)(\\b)', 'g');
4741
+ return originalCondition.replace(regularExp, pathPrefix + '.' + condition.fieldReference);
4742
+ }
4743
+ else {
4744
+ return originalCondition;
4745
+ }
4746
+ }
4747
+ }
4713
4748
  };
4714
- ShowCondition.prototype.unquoted = function (str) {
4715
- return str.replace(/(?:^")|(?:"$)/g, '');
4749
+ // Cache instances so that we can cache results more effectively
4750
+ ShowCondition.getInstance = function (condition) {
4751
+ var instance = this.instanceCache.get(condition);
4752
+ if (!instance) {
4753
+ instance = new ShowCondition(condition);
4754
+ this.instanceCache.set(condition, instance);
4755
+ }
4756
+ return instance;
4716
4757
  };
4717
- ShowCondition.prototype.removeStarChar = function (str) {
4718
- return str.substring(0, str.length - 1);
4758
+ ShowCondition.getField = function (condition) {
4759
+ var separator = ShowCondition.CONTAINS;
4760
+ if (condition.indexOf(ShowCondition.CONTAINS) < 0) {
4761
+ separator = ShowCondition.CONDITION_EQUALS;
4762
+ if (condition.indexOf(ShowCondition.CONDITION_NOT_EQUALS) > -1) {
4763
+ separator = ShowCondition.CONDITION_NOT_EQUALS;
4764
+ }
4765
+ }
4766
+ return [condition.split(separator)[0], separator];
4719
4767
  };
4720
- ShowCondition.prototype.okIfBothEmpty = function (right, value) {
4721
- return value === null && (right === '');
4768
+ ShowCondition.getConditions = function (formula) {
4769
+ var _this = this;
4770
+ var conditionList = [];
4771
+ if (!!formula) {
4772
+ var newFormula = typeof formula === 'string' ? JSON.parse(formula) : formula;
4773
+ if (Array.isArray(newFormula)) {
4774
+ newFormula.forEach(function (condition) {
4775
+ if (!(typeof condition === 'string' && _this.validJoinComparators.indexOf(condition) !== -1)) {
4776
+ if (Array.isArray(condition)) {
4777
+ conditionList.push(ShowCondition.getConditions(condition).toString());
4778
+ }
4779
+ else {
4780
+ conditionList.push(condition.fieldReference + condition.comparator + condition.value);
4781
+ }
4782
+ }
4783
+ });
4784
+ }
4785
+ else {
4786
+ conditionList.push(newFormula.fieldReference + newFormula.comparator + newFormula.value);
4787
+ }
4788
+ }
4789
+ return conditionList.toString();
4790
+ };
4791
+ /**
4792
+ * Determine whether a ShowCondition model is affected by fields that have
4793
+ * a display_context of HIDDEN or READONLY, which means they aren't able to
4794
+ * be changed by the user's actions.
4795
+ *
4796
+ * @param showCondition The ShowCondition model to evaluate.
4797
+ * @param caseFields Inspected to see appropriate display_contexts.
4798
+ */
4799
+ ShowCondition.hiddenCannotChange = function (showCondition, caseFields) {
4800
+ var e_1, _a;
4801
+ if (showCondition && showCondition.conditions.length && caseFields) {
4802
+ var conditions = this.getConditions(showCondition.conditions).split(',');
4803
+ if (conditions && conditions.length > 0) {
4804
+ var allUnchangeable = true;
4805
+ var _loop_1 = function (condition) {
4806
+ var _a = __read(ShowCondition.getField(condition), 1), field = _a[0];
4807
+ var path = field.split('.');
4808
+ var head = path.shift();
4809
+ var caseField = caseFields.find(function (cf) { return cf.id === head; });
4810
+ while (path.length > 0) {
4811
+ head = path.shift();
4812
+ if (caseField) {
4813
+ // Jump out if this is HIDDEN or READONLY, regardless of whether or not it's
4814
+ // complex or a collection - nested fields will "inherit" the display_context.
4815
+ if (['HIDDEN', 'READONLY'].indexOf(caseField.display_context) > -1) {
4816
+ break;
4817
+ }
4818
+ // Consider what type of field this is.
4819
+ var ft = caseField.field_type;
4820
+ switch (ft.type) {
4821
+ case 'Collection':
4822
+ if (ft.collection_field_type.type === 'Complex' && ft.collection_field_type.complex_fields) {
4823
+ caseField = ft.collection_field_type.complex_fields.find(function (cf) { return cf.id === head; });
4824
+ }
4825
+ break;
4826
+ case 'Complex':
4827
+ if (ft.complex_fields) {
4828
+ caseField = ft.complex_fields.find(function (cf) { return cf.id === head; });
4829
+ }
4830
+ break;
4831
+ }
4832
+ }
4833
+ }
4834
+ if (caseField) {
4835
+ allUnchangeable = allUnchangeable && ['HIDDEN', 'READONLY'].indexOf(caseField.display_context) > -1;
4836
+ }
4837
+ };
4838
+ try {
4839
+ for (var conditions_1 = __values(conditions), conditions_1_1 = conditions_1.next(); !conditions_1_1.done; conditions_1_1 = conditions_1.next()) {
4840
+ var condition = conditions_1_1.value;
4841
+ _loop_1(condition);
4842
+ }
4843
+ }
4844
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
4845
+ finally {
4846
+ try {
4847
+ if (conditions_1_1 && !conditions_1_1.done && (_a = conditions_1.return)) _a.call(conditions_1);
4848
+ }
4849
+ finally { if (e_1) throw e_1.error; }
4850
+ }
4851
+ return allUnchangeable;
4852
+ }
4853
+ }
4854
+ return false;
4855
+ };
4856
+ ShowCondition.prototype.match = function (fields, path) {
4857
+ return ConditionParser.evaluate(fields, this.conditions, this.updatePathName(path));
4858
+ };
4859
+ ShowCondition.prototype.updatePathName = function (path) {
4860
+ if (path && path.split(/[_]+/g).length > 0) {
4861
+ /* tslint:disable-next-line */
4862
+ var _a = __read(path.split(/[_]+/g)), pathName_1 = _a[0], pathTail = _a.slice(1);
4863
+ var pathFinalIndex_1 = pathTail.pop();
4864
+ var pathTailString = pathTail.toString();
4865
+ pathTail = pathTail.map(function (value) {
4866
+ return Number(pathFinalIndex_1) === Number(value) ? pathName_1 : value;
4867
+ });
4868
+ return pathTailString !== pathTail.toString()
4869
+ ? pathName_1 + "_" + pathTail.join('_') + "_" + pathFinalIndex_1
4870
+ : path;
4871
+ }
4872
+ else {
4873
+ return path;
4874
+ }
4875
+ };
4876
+ ShowCondition.prototype.matchByContextFields = function (contextFields) {
4877
+ return this.match(FieldsUtils.toValuesMap(contextFields));
4878
+ };
4879
+ /**
4880
+ * Determine whether this is affected by fields that have a display_context
4881
+ * of HIDDEN or READONLY, which means they aren't able to be changed by the
4882
+ * user's actions.
4883
+ *
4884
+ * @param caseFields Inspected to see appropriate display_contexts.
4885
+ */
4886
+ ShowCondition.prototype.hiddenCannotChange = function (caseFields) {
4887
+ return ShowCondition.hiddenCannotChange(this, caseFields);
4722
4888
  };
4723
4889
  return ShowCondition;
4724
4890
  }());
4725
- ShowCondition.AND_CONDITION_REGEXP = new RegExp('\\sAND\\s(?![^"]*"(?:(?:[^"]*"){2})*[^"]*$)', 'g');
4726
- ShowCondition.OR_CONDITION_REGEXP = new RegExp('\\sOR\\s(?![^"]*"(?:(?:[^"]*"){2})*[^"]*$)', 'g');
4727
4891
  ShowCondition.CONDITION_NOT_EQUALS = '!=';
4728
4892
  ShowCondition.CONDITION_EQUALS = '=';
4729
4893
  ShowCondition.CONTAINS = 'CONTAINS';
4730
4894
  ShowCondition.instanceCache = new Map();
4895
+ ShowCondition.validJoinComparators = ['AND', 'OR'];
4896
+ ShowCondition.processedList = [];
4731
4897
 
4732
4898
  var Constants = /** @class */ (function () {
4733
4899
  function Constants() {
@@ -6906,13 +7072,14 @@
6906
7072
  return rxjs.of(null);
6907
7073
  };
6908
7074
  /**
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".)
7075
+ * Retrieves the HMCTS service details for a jurisdiction or service, including service codes. More than one
7076
+ * service code may be present. For example, the Divorce jurisdiction/service has corresponding service codes of
7077
+ * "ABA1" and "ABA2".
6911
7078
  *
6912
7079
  * @param serviceNames The service name(s) to look up, comma-separated if more than one
6913
7080
  * @returns An `Observable` of an array of service details
6914
7081
  */
6915
- CaseFlagRefdataService.prototype.getHmctsServiceDetails = function (serviceNames) {
7082
+ CaseFlagRefdataService.prototype.getHmctsServiceDetailsByServiceName = function (serviceNames) {
6916
7083
  var url = this.appConfig.getLocationRefApiUrl();
6917
7084
  if (url) {
6918
7085
  url += '/orgServices';
@@ -6923,6 +7090,26 @@
6923
7090
  }
6924
7091
  return rxjs.of(null);
6925
7092
  };
7093
+ /**
7094
+ * Retrieves the HMCTS service details for a case type, including service code. For example, the
7095
+ * "FinancialRemedyContested" case type is associated with the Divorce jurisdiction/service and service code "ABA2".
7096
+ *
7097
+ * Note that a case type might not be associated with any service codes of a jurisdiction or service.
7098
+ *
7099
+ * @param caseTypeId The case type ID to look up
7100
+ * @returns An `Observable` of an array of service details
7101
+ */
7102
+ CaseFlagRefdataService.prototype.getHmctsServiceDetailsByCaseType = function (caseTypeId) {
7103
+ var url = this.appConfig.getLocationRefApiUrl();
7104
+ if (url) {
7105
+ url += '/orgServices';
7106
+ if (caseTypeId) {
7107
+ url += "?ccdCaseType=" + caseTypeId;
7108
+ }
7109
+ return this.http.get(url, { observe: 'body' });
7110
+ }
7111
+ return rxjs.of(null);
7112
+ };
6926
7113
  return CaseFlagRefdataService;
6927
7114
  }());
6928
7115
  CaseFlagRefdataService.ɵfac = function CaseFlagRefdataService_Factory(t) { return new (t || CaseFlagRefdataService)(i0__namespace.ɵɵinject(HttpService), i0__namespace.ɵɵinject(AbstractAppConfig)); };
@@ -12283,7 +12470,7 @@
12283
12470
  if (rf & 2) {
12284
12471
  var ctx_r8 = i0__namespace.ɵɵnextContext(2);
12285
12472
  i0__namespace.ɵɵadvance(1);
12286
- i0__namespace.ɵɵproperty("formGroup", ctx_r8.caseFlagParentFormGroup)("jurisdiction", ctx_r8.jurisdiction);
12473
+ i0__namespace.ɵɵproperty("formGroup", ctx_r8.caseFlagParentFormGroup)("jurisdiction", ctx_r8.jurisdiction)("caseTypeId", ctx_r8.caseTypeId)("hmctsServiceId", ctx_r8.hmctsServiceId);
12287
12474
  }
12288
12475
  }
12289
12476
  function WriteCaseFlagFieldComponent_div_1_ng_container_6_Template(rf, ctx) {
@@ -12325,7 +12512,7 @@
12325
12512
  i0__namespace.ɵɵtext(3);
12326
12513
  i0__namespace.ɵɵelementEnd();
12327
12514
  i0__namespace.ɵɵtemplate(4, WriteCaseFlagFieldComponent_div_1_ng_container_4_Template, 2, 2, "ng-container", 11);
12328
- i0__namespace.ɵɵtemplate(5, WriteCaseFlagFieldComponent_div_1_ng_container_5_Template, 2, 2, "ng-container", 11);
12515
+ i0__namespace.ɵɵtemplate(5, WriteCaseFlagFieldComponent_div_1_ng_container_5_Template, 2, 4, "ng-container", 11);
12329
12516
  i0__namespace.ɵɵtemplate(6, WriteCaseFlagFieldComponent_div_1_ng_container_6_Template, 2, 3, "ng-container", 11);
12330
12517
  i0__namespace.ɵɵtemplate(7, WriteCaseFlagFieldComponent_div_1_ng_container_7_Template, 2, 2, "ng-container", 11);
12331
12518
  i0__namespace.ɵɵelementEnd();
@@ -12438,29 +12625,40 @@
12438
12625
  }
12439
12626
  }), true);
12440
12627
  this.createFlagCaption = exports.CaseFlagText.CAPTION;
12441
- // Get the jurisdiction from the CaseView object in the snapshot data (required for retrieving the available flag
12628
+ // Get the case type ID from the CaseView object in the snapshot data (required for retrieving the available flag
12442
12629
  // types for a case)
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;
12630
+ if (this.route.snapshot.data.case && this.route.snapshot.data.case.case_type) {
12631
+ this.caseTypeId = this.route.snapshot.data.case.case_type.id;
12632
+ // Get the jurisdiction (required for retrieving the available flag types if unable to determine using case type ID)
12633
+ if (this.route.snapshot.data.case.case_type.jurisdiction) {
12634
+ this.jurisdiction = this.route.snapshot.data.case.case_type.jurisdiction.id;
12635
+ }
12446
12636
  }
12447
12637
  // Extract all flags-related data from the CaseEventTrigger object in the snapshot data
12448
- if (this.route.snapshot.data.eventTrigger && this.route.snapshot.data.eventTrigger.case_fields) {
12449
- this.flagsData = (this.route.snapshot.data.eventTrigger.case_fields)
12450
- .reduce(function (flags, caseField) {
12451
- return FieldsUtils.extractFlagsDataFromCaseField(flags, caseField, caseField.id, caseField);
12452
- }, []);
12453
- // Set boolean indicating the display_context_parameter is "update"
12454
- this.isDisplayContextParameterUpdate =
12455
- this.setDisplayContextParameterUpdate((this.route.snapshot.data.eventTrigger.case_fields));
12456
- // Set starting field state
12457
- this.fieldState = this.isDisplayContextParameterUpdate ? exports.CaseFlagFieldState.FLAG_MANAGE_CASE_FLAGS : exports.CaseFlagFieldState.FLAG_LOCATION;
12458
- // Get case title, to be used by child components
12459
- this.caseEditDataService.caseTitle$.subscribe({
12460
- next: function (title) {
12461
- _this.caseTitle = title.length > 0 ? title : _this.caseNameMissing;
12462
- }
12463
- });
12638
+ if (this.route.snapshot.data.eventTrigger) {
12639
+ // Get the HMCTSServiceId from supplementary data, if it exists (required for retrieving the available flag types in
12640
+ // the first instance, only falling back on case type ID or jurisidiction if it's not present)
12641
+ if (this.route.snapshot.data.eventTrigger.supplementary_data
12642
+ && this.route.snapshot.data.eventTrigger.supplementary_data.HMCTSServiceId) {
12643
+ this.hmctsServiceId = this.route.snapshot.data.eventTrigger.supplementary_data.HMCTSServiceId;
12644
+ }
12645
+ if (this.route.snapshot.data.eventTrigger.case_fields) {
12646
+ this.flagsData = (this.route.snapshot.data.eventTrigger.case_fields)
12647
+ .reduce(function (flags, caseField) {
12648
+ return FieldsUtils.extractFlagsDataFromCaseField(flags, caseField, caseField.id, caseField);
12649
+ }, []);
12650
+ // Set boolean indicating the display_context_parameter is "update"
12651
+ this.isDisplayContextParameterUpdate =
12652
+ this.setDisplayContextParameterUpdate((this.route.snapshot.data.eventTrigger.case_fields));
12653
+ // Set starting field state
12654
+ this.fieldState = this.isDisplayContextParameterUpdate ? exports.CaseFlagFieldState.FLAG_MANAGE_CASE_FLAGS : exports.CaseFlagFieldState.FLAG_LOCATION;
12655
+ // Get case title, to be used by child components
12656
+ this.caseEditDataService.caseTitle$.subscribe({
12657
+ next: function (title) {
12658
+ _this.caseTitle = title.length > 0 ? title : _this.caseNameMissing;
12659
+ }
12660
+ });
12661
+ }
12464
12662
  }
12465
12663
  };
12466
12664
  WriteCaseFlagFieldComponent.prototype.setDisplayContextParameterUpdate = function (caseFields) {
@@ -12696,7 +12894,7 @@
12696
12894
  return WriteCaseFlagFieldComponent;
12697
12895
  }(AbstractFieldWriteComponent));
12698
12896
  WriteCaseFlagFieldComponent.ɵfac = function WriteCaseFlagFieldComponent_Factory(t) { return new (t || WriteCaseFlagFieldComponent)(i0__namespace.ɵɵdirectiveInject(i1__namespace$1.ActivatedRoute), i0__namespace.ɵɵdirectiveInject(CaseEditDataService)); };
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) {
12897
+ 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", "hmctsServiceId", "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) {
12700
12898
  if (rf & 1) {
12701
12899
  i0__namespace.ɵɵtemplate(0, WriteCaseFlagFieldComponent_div_0_Template, 4, 1, "div", 0);
12702
12900
  i0__namespace.ɵɵtemplate(1, WriteCaseFlagFieldComponent_div_1_Template, 8, 10, "div", 1);
@@ -18072,7 +18270,7 @@
18072
18270
  i0__namespace.ɵɵadvance(2);
18073
18271
  i0__namespace.ɵɵproperty("ngForOf", ctx.currentCategories);
18074
18272
  }
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 });
18273
+ }, 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 });
18076
18274
  (function () {
18077
18275
  (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(CaseFileViewFolderSelectorComponent, [{
18078
18276
  type: i0.Component,
@@ -19084,23 +19282,30 @@
19084
19282
  && this.formGroup['caseField'].id === this.caseLevelCaseFlagsFieldId
19085
19283
  ? exports.RefdataCaseFlagType.CASE
19086
19284
  : exports.RefdataCaseFlagType.PARTY;
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)
19089
- .pipe(
19090
- // Use switchMap to return an inner Observable of the flag types data, having received the service details
19091
- // including service_code. This avoids having nested `subscribe`s, which is an anti-pattern!
19092
- operators.switchMap(function (serviceDetails) {
19093
- return _this.caseFlagRefdataService.getCaseFlagsRefdata(serviceDetails[0].service_code, flagType);
19094
- }))
19095
- .subscribe({
19096
- next: function (flagTypes) {
19285
+ // If hmctsServiceId is present, use this to retrieve the relevant list of flag types
19286
+ if (this.hmctsServiceId) {
19287
+ this.flagRefdata$ = this.caseFlagRefdataService.getCaseFlagsRefdata(this.hmctsServiceId, flagType)
19288
+ .subscribe({
19097
19289
  // 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
- }
19103
- });
19290
+ next: function (flagTypes) { return _this.flagTypes = flagTypes[0].childFlags; },
19291
+ error: function (error) { return _this.onRefdataError(error); }
19292
+ });
19293
+ }
19294
+ else {
19295
+ // Else, HMCTS service code is required to retrieve the relevant list of flag types; attempt to obtain it by case type ID first
19296
+ this.flagRefdata$ = this.caseFlagRefdataService.getHmctsServiceDetailsByCaseType(this.caseTypeId)
19297
+ .pipe(
19298
+ // If an error occurs retrieving HMCTS service details by case type ID, try by service name instead
19299
+ operators.catchError(function (_) { return _this.caseFlagRefdataService.getHmctsServiceDetailsByServiceName(_this.jurisdiction); }),
19300
+ // Use switchMap to return an inner Observable of the flag types data, having received the service details
19301
+ // including service_code. This avoids having nested `subscribe`s, which is an anti-pattern!
19302
+ operators.switchMap(function (serviceDetails) { return _this.caseFlagRefdataService.getCaseFlagsRefdata(serviceDetails[0].service_code, flagType); }))
19303
+ .subscribe({
19304
+ // First (and only) object in the returned array should be the top-level "Party" flag type
19305
+ next: function (flagTypes) { return _this.flagTypes = flagTypes[0].childFlags; },
19306
+ error: function (error) { return _this.onRefdataError(error); }
19307
+ });
19308
+ }
19104
19309
  };
19105
19310
  SelectFlagTypeComponent.prototype.ngOnDestroy = function () {
19106
19311
  if (this.flagRefdata$) {
@@ -19172,7 +19377,7 @@
19172
19377
  return SelectFlagTypeComponent;
19173
19378
  }());
19174
19379
  SelectFlagTypeComponent.ɵfac = function SelectFlagTypeComponent_Factory(t) { return new (t || SelectFlagTypeComponent)(i0__namespace.ɵɵdirectiveInject(CaseFlagRefdataService)); };
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) {
19380
+ SelectFlagTypeComponent.ɵcmp = i0__namespace.ɵɵdefineComponent({ type: SelectFlagTypeComponent, selectors: [["ccd-select-flag-type"]], inputs: { formGroup: "formGroup", jurisdiction: "jurisdiction", caseTypeId: "caseTypeId", hmctsServiceId: "hmctsServiceId" }, 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) {
19176
19381
  if (rf & 1) {
19177
19382
  i0__namespace.ɵɵelementStart(0, "div", 0);
19178
19383
  i0__namespace.ɵɵelementStart(1, "div", 1);
@@ -19220,6 +19425,10 @@
19220
19425
  type: i0.Input
19221
19426
  }], jurisdiction: [{
19222
19427
  type: i0.Input
19428
+ }], caseTypeId: [{
19429
+ type: i0.Input
19430
+ }], hmctsServiceId: [{
19431
+ type: i0.Input
19223
19432
  }], caseFlagStateEmitter: [{
19224
19433
  type: i0.Output
19225
19434
  }], flagCommentsOptionalEmitter: [{
@@ -21494,7 +21703,10 @@
21494
21703
  }
21495
21704
  }, inputs: { dateControl: "dateControl" }, features: [i0__namespace.ɵɵProvidersFeature([
21496
21705
  { provide: i4.NGX_MAT_DATE_FORMATS, useValue: CUSTOM_MOMENT_FORMATS },
21497
- { provide: i4.NgxMatDateAdapter, useClass: momentAdapter.NgxMatMomentAdapter },
21706
+ { provide: i4.NgxMatDateAdapter,
21707
+ useClass: momentAdapter.NgxMatMomentAdapter,
21708
+ deps: [i6.MAT_DATE_LOCALE, momentAdapter.NGX_MAT_MOMENT_DATE_ADAPTER_OPTIONS]
21709
+ },
21498
21710
  { provide: momentAdapter.NGX_MAT_MOMENT_DATE_ADAPTER_OPTIONS, useValue: { useUtc: true } }
21499
21711
  ]), 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) {
21500
21712
  if (rf & 1) {
@@ -21551,7 +21763,10 @@
21551
21763
  encapsulation: i0.ViewEncapsulation.None,
21552
21764
  providers: [
21553
21765
  { provide: i4.NGX_MAT_DATE_FORMATS, useValue: CUSTOM_MOMENT_FORMATS },
21554
- { provide: i4.NgxMatDateAdapter, useClass: momentAdapter.NgxMatMomentAdapter },
21766
+ { provide: i4.NgxMatDateAdapter,
21767
+ useClass: momentAdapter.NgxMatMomentAdapter,
21768
+ deps: [i6.MAT_DATE_LOCALE, momentAdapter.NGX_MAT_MOMENT_DATE_ADAPTER_OPTIONS]
21769
+ },
21555
21770
  { provide: momentAdapter.NGX_MAT_MOMENT_DATE_ADAPTER_OPTIONS, useValue: { useUtc: true } }
21556
21771
  ]
21557
21772
  }]
@@ -22892,8 +23107,8 @@
22892
23107
  i0__namespace.ɵɵsetComponentScope(WriteCollectionFieldComponent, [i1__namespace.NgIf, i1__namespace.NgForOf, FieldWriteComponent, i2__namespace.NgControlStatusGroup, i2__namespace.FormGroupDirective], [FieldLabelPipe, FirstErrorPipe]);
22893
23108
  i0__namespace.ɵɵsetComponentScope(
22894
23109
  // ComponentLauncher web components
22895
- CaseFileViewFieldComponent, [i1__namespace.NgIf, CaseFileViewFolderComponent, i11__namespace.ɵcs], []);
22896
- i0__namespace.ɵɵsetComponentScope(CaseFileViewFieldReadComponent, [i1__namespace.NgIf, CaseFileViewFolderComponent, i11__namespace.ɵcs], []);
23110
+ CaseFileViewFieldComponent, [i1__namespace.NgIf, CaseFileViewFolderComponent, i11__namespace.MediaViewerComponent], []);
23111
+ i0__namespace.ɵɵsetComponentScope(CaseFileViewFieldReadComponent, [i1__namespace.NgIf, CaseFileViewFolderComponent, i11__namespace.MediaViewerComponent], []);
22897
23112
 
22898
23113
  var Confirmation = /** @class */ (function () {
22899
23114
  function Confirmation(caseId, status, header, body) {
@@ -27618,11 +27833,12 @@
27618
27833
  _this.activitySubscription = _this.postViewActivity().subscribe();
27619
27834
  });
27620
27835
  }
27836
+ this.checkRouteAndSetCaseViewTab();
27621
27837
  // Check for active Case Flags
27622
27838
  this.activeCaseFlags = this.hasActiveCaseFlags();
27623
27839
  };
27624
27840
  CaseFullAccessViewComponent.prototype.ngOnChanges = function (changes) {
27625
- if (!changes.prependedTabs.firstChange) {
27841
+ if (changes && changes.prependedTabs && !changes.prependedTabs.firstChange) {
27626
27842
  this.init();
27627
27843
  this.crf.detectChanges();
27628
27844
  this.organiseTabPosition();
@@ -27647,6 +27863,22 @@
27647
27863
  subscription.unsubscribe();
27648
27864
  }
27649
27865
  };
27866
+ CaseFullAccessViewComponent.prototype.checkRouteAndSetCaseViewTab = function () {
27867
+ var _this = this;
27868
+ this.router.events
27869
+ .pipe(operators.filter(function (event) { return event instanceof i1$1.NavigationEnd; }))
27870
+ .subscribe(function (event) {
27871
+ var url = event && event.url;
27872
+ if (url) {
27873
+ var tabUrl = url ? url.split('#') : null;
27874
+ var tab_1 = tabUrl && tabUrl.length > 1 ? tabUrl[tabUrl.length - 1].replaceAll('%20', ' ') : '';
27875
+ var matTab = _this.tabGroup._tabs.find(function (x) { return x.textLabel.toLowerCase() === tab_1.toLowerCase(); });
27876
+ if (matTab && matTab.position) {
27877
+ _this.tabGroup.selectedIndex = matTab.position;
27878
+ }
27879
+ }
27880
+ });
27881
+ };
27650
27882
  CaseFullAccessViewComponent.prototype.postViewActivity = function () {
27651
27883
  return this.activityPollingService.postViewActivity(this.caseDetails.case_id);
27652
27884
  };
@@ -31404,12 +31636,12 @@
31404
31636
  i0__namespace.ɵɵproperty("checked", ctx_r6.allOnPageSelected())("disabled", !ctx_r6.canAnyBeShared());
31405
31637
  }
31406
31638
  }
31407
- function SearchResultComponent_table_0_th_10_div_6_Template(rf, ctx) {
31639
+ function SearchResultComponent_table_0_th_10_div_4_Template(rf, ctx) {
31408
31640
  if (rf & 1) {
31409
31641
  var _r19_1 = i0__namespace.ɵɵgetCurrentView();
31410
31642
  i0__namespace.ɵɵelementStart(0, "div", 27);
31411
31643
  i0__namespace.ɵɵelementStart(1, "a", 28);
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); });
31644
+ 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); });
31413
31645
  i0__namespace.ɵɵelementEnd();
31414
31646
  i0__namespace.ɵɵelementEnd();
31415
31647
  }
@@ -31424,16 +31656,12 @@
31424
31656
  if (rf & 1) {
31425
31657
  var _r22_1 = i0__namespace.ɵɵgetCurrentView();
31426
31658
  i0__namespace.ɵɵelementStart(0, "th");
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();
31659
+ i0__namespace.ɵɵelementStart(1, "div", 24);
31660
+ i0__namespace.ɵɵelementStart(2, "div", 25);
31661
+ 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); });
31662
+ i0__namespace.ɵɵtext(3);
31436
31663
  i0__namespace.ɵɵelementEnd();
31664
+ i0__namespace.ɵɵtemplate(4, SearchResultComponent_table_0_th_10_div_4_Template, 2, 1, "div", 26);
31437
31665
  i0__namespace.ɵɵelementEnd();
31438
31666
  i0__namespace.ɵɵelementEnd();
31439
31667
  }
@@ -31442,7 +31670,7 @@
31442
31670
  var ctx_r7 = i0__namespace.ɵɵnextContext(2);
31443
31671
  i0__namespace.ɵɵadvance(1);
31444
31672
  i0__namespace.ɵɵattribute("aria-label", "Sort by " + col_r15.label + " " + ctx_r7.isSortAscending(col_r15) ? "ascending" : "descending");
31445
- i0__namespace.ɵɵadvance(4);
31673
+ i0__namespace.ɵɵadvance(2);
31446
31674
  i0__namespace.ɵɵtextInterpolate(col_r15.label);
31447
31675
  i0__namespace.ɵɵadvance(1);
31448
31676
  i0__namespace.ɵɵproperty("ngIf", ctx_r7.comparator(col_r15));
@@ -31778,7 +32006,7 @@
31778
32006
  i0__namespace.ɵɵelementStart(7, "thead");
31779
32007
  i0__namespace.ɵɵelementStart(8, "tr", 7);
31780
32008
  i0__namespace.ɵɵtemplate(9, SearchResultComponent_table_0_th_9_Template, 4, 2, "th", 8);
31781
- i0__namespace.ɵɵtemplate(10, SearchResultComponent_table_0_th_10_Template, 7, 3, "th", 9);
32009
+ i0__namespace.ɵɵtemplate(10, SearchResultComponent_table_0_th_10_Template, 5, 3, "th", 9);
31782
32010
  i0__namespace.ɵɵtemplate(11, SearchResultComponent_table_0_th_11_Template, 1, 0, "th", 10);
31783
32011
  i0__namespace.ɵɵelementEnd();
31784
32012
  i0__namespace.ɵɵelementEnd();