@hmcts/ccd-case-ui-toolkit 4.12.0 → 4.12.1-rc2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @hmcts/ccd-case-ui-toolkit - Case UI Toolkit
3
- * @version v4.12.0
3
+ * @version v4.12.1-rc2
4
4
  * @link undefined
5
5
  * @license MIT
6
6
  */
@@ -23584,16 +23584,33 @@ var CaseFullAccessViewComponent = /** @class */ (function () {
23584
23584
  var matTab;
23585
23585
  var url = this.location.path(true);
23586
23586
  var hashValue = url.substring(url.indexOf('#') + 1);
23587
- // if we have prepended tabs route to one of the prepended tabs
23588
- if (!url.includes('#') && this.prependedTabs && this.prependedTabs.length) {
23587
+ if (!url.includes('#')) {
23589
23588
  var paths = url.split('/');
23590
- var tabName_1 = decodeURIComponent(paths[paths.length - 1]);
23591
- var selectedTab_1 = this.prependedTabs.find(function (caseTab) { return caseTab.id.toLowerCase() === tabName_1.toLowerCase(); });
23592
- var tab = selectedTab_1 ? selectedTab_1.id : 'tasks';
23593
- this.router.navigate(['cases', 'case-details', this.caseDetails.case_id, tab]).then(function () {
23594
- matTab = _this.tabGroup._tabs.find(function (x) { return x.textLabel === selectedTab_1.label; });
23595
- _this.tabGroup.selectedIndex = matTab.position;
23596
- });
23589
+ // lastPath can be /caseId, or the tabs /tasks, /hearings etc.
23590
+ var lastPath_1 = decodeURIComponent(paths[paths.length - 1]);
23591
+ var foundTab_1 = null;
23592
+ var additionalTabs = this.prependedTabs.concat(this.appendedTabs);
23593
+ if (additionalTabs && additionalTabs.length) {
23594
+ foundTab_1 = additionalTabs.find(function (caseTab) { return caseTab.id.toLowerCase() === lastPath_1.toLowerCase(); });
23595
+ }
23596
+ // found tasks or hearing tab
23597
+ if (foundTab_1) {
23598
+ this.router.navigate(['cases', 'case-details', this.caseDetails.case_id, foundTab_1.id]).then(function () {
23599
+ matTab = _this.tabGroup._tabs.find(function (x) { return x.textLabel === foundTab_1.label; });
23600
+ _this.tabGroup.selectedIndex = matTab.position;
23601
+ });
23602
+ // last path is caseId
23603
+ }
23604
+ else {
23605
+ // sort with the order of CCD predefined tabs
23606
+ this.caseDetails.tabs.sort(function (aTab, bTab) { return aTab.order > bTab.order ? 1 : (bTab.order > aTab.order ? -1 : 0); });
23607
+ // preselect the 1st order of CCD predefined tabs
23608
+ var preSelectTab_1 = this.caseDetails.tabs[0];
23609
+ this.router.navigate(['cases', 'case-details', this.caseDetails.case_id]).then(function () {
23610
+ matTab = _this.tabGroup._tabs.find(function (x) { return x.textLabel === preSelectTab_1.label; });
23611
+ _this.tabGroup.selectedIndex = matTab.position;
23612
+ });
23613
+ }
23597
23614
  }
23598
23615
  else {
23599
23616
  var regExp = new RegExp(CaseFullAccessViewComponent_1.UNICODE_SPACE, 'g');
@@ -42230,11 +42247,11 @@ var FieldsUtils = /** @class */ (function () {
42230
42247
  if (isDynamicField) {
42231
42248
  var dynamicListValue = _this.getDynamicListValue(rootCaseField.value, field.id);
42232
42249
  if (dynamicListValue) {
42233
- var list_items = dynamicListValue.list_items;
42234
- var complexValue = dynamicListValue.value;
42250
+ var list_items = dynamicListValue[0].list_items;
42251
+ var complexValue = dynamicListValue.map(function (data) { return data.value; });
42235
42252
  var value = {
42236
42253
  list_items: list_items,
42237
- value: complexValue ? complexValue : undefined
42254
+ value: complexValue.length > 0 ? complexValue : undefined
42238
42255
  };
42239
42256
  field.value = __assign({}, value);
42240
42257
  field.formatted_value = __assign({}, field.formatted_value, value);
@@ -42256,17 +42273,22 @@ var FieldsUtils = /** @class */ (function () {
42256
42273
  }
42257
42274
  };
42258
42275
  FieldsUtils.getDynamicListValue = function (jsonBlock, key) {
42259
- if (jsonBlock[key]) {
42260
- return jsonBlock[key];
42276
+ var data = jsonBlock ? this.getNestedFieldValues(jsonBlock, key, []) : [];
42277
+ return data.length > 0 ? data : null;
42278
+ };
42279
+ FieldsUtils.getNestedFieldValues = function (jsonData, key, output) {
42280
+ if (output === void 0) { output = []; }
42281
+ if (jsonData && jsonData[key]) {
42282
+ output.push(jsonData[key]);
42261
42283
  }
42262
42284
  else {
42263
- for (var elementKey in jsonBlock) {
42264
- if (typeof jsonBlock === 'object' && jsonBlock.hasOwnProperty(elementKey)) {
42265
- return this.getDynamicListValue(jsonBlock[elementKey], key);
42285
+ for (var elementKey in jsonData) {
42286
+ if (typeof jsonData === 'object' && jsonData.hasOwnProperty(elementKey)) {
42287
+ this.getNestedFieldValues(jsonData[elementKey], key, output);
42266
42288
  }
42267
42289
  }
42268
42290
  }
42269
- return null;
42291
+ return output;
42270
42292
  };
42271
42293
  FieldsUtils.prototype.buildCanShowPredicate = function (eventTrigger, form) {
42272
42294
  var currentState = this.getCurrentEventState(eventTrigger, form);