axidio-styleguide-library1-v2 0.7.12 → 0.7.13

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.
@@ -3043,58 +3043,87 @@ class DropdownComponent {
3043
3043
  }
3044
3044
  handleListHeaderClick(event, data, entireList) {
3045
3045
  this.handleListPanelClick(event);
3046
- const updated = { ...this.selectedCompareBy };
3047
- if (updated[data.name]) {
3048
- delete updated[data.name];
3046
+ if (this.dropdownHeaderName != 'Compare By' && !data.children) {
3047
+ this.dropdownHeaderName = data.name;
3048
+ this.isDropdownOpen = false;
3049
+ if (this.dropdownHeaderName == 'Compare by')
3050
+ this.setDropDownStatus();
3051
+ else
3052
+ sessionStorage.setItem('chartHeaderDropdown2', 'false');
3053
+ this.selectedCompareBy = {};
3054
+ }
3055
+ let keysArray = Object.keys(this.selectedCompareBy);
3056
+ if (!keysArray.length || !keysArray.includes(data.name)) {
3057
+ this.selectedCompareBy[data.name] = data.children ? data.children : data;
3058
+ }
3059
+ else if (data.children) {
3060
+ delete this.selectedCompareBy[data.name];
3061
+ }
3062
+ if (this.dropdownHeaderName != 'Compare by' &&
3063
+ ((sessionStorage.getItem('selectedCompare2By') &&
3064
+ sessionStorage.getItem('selectedCompare2By') != '{}' &&
3065
+ JSON.stringify(this.selectedCompareBy) ==
3066
+ sessionStorage.getItem('selectedCompare2By')) ||
3067
+ (!sessionStorage.getItem('selectedCompare2By') &&
3068
+ JSON.stringify(this.selectedCompareBy)
3069
+ .toLowerCase()
3070
+ .includes(this.dropdownHeaderName.toLowerCase())))) {
3049
3071
  }
3050
3072
  else {
3051
- updated[data.name] = data.children ? [...data.children] : data;
3073
+ this.selectedFromDropdown.emit({
3074
+ compareByFilters: this.selectedCompareBy,
3075
+ entireList: entireList,
3076
+ });
3077
+ }
3078
+ if (this.dropdownHeaderName == 'Compare by' && data.children)
3079
+ sessionStorage.setItem('selectedCompareBy', JSON.stringify(this.selectedCompareBy));
3080
+ else {
3081
+ sessionStorage.setItem('selectedCompare2By', JSON.stringify(this.selectedCompareBy));
3052
3082
  }
3053
- this.selectedCompareBy = updated;
3054
- this.selectedFromDropdown.emit({
3055
- compareByFilters: this.selectedCompareBy,
3056
- entireList,
3057
- });
3058
- sessionStorage.setItem(this.dropdownHeaderName === 'Compare by'
3059
- ? 'selectedCompareBy'
3060
- : 'selectedCompare2By', JSON.stringify(this.selectedCompareBy));
3061
3083
  }
3062
3084
  handleListChildrenClick(event, parent, child) {
3063
3085
  this.handleListPanelClick(event);
3064
- const updated = { ...this.selectedCompareBy };
3065
- const currentChildren = updated[parent.name]
3066
- ? [...updated[parent.name]]
3067
- : [];
3068
- const index = currentChildren.findIndex(c => c.name === child.name);
3069
- if (index === -1) {
3070
- currentChildren.push(child);
3071
- }
3072
- else {
3073
- currentChildren.splice(index, 1);
3074
- }
3075
- if (currentChildren.length > 0) {
3076
- updated[parent.name] = currentChildren;
3086
+ let keysArray = Object.keys(this.selectedCompareBy);
3087
+ if (!keysArray.length || !keysArray.includes(parent.name)) {
3088
+ this.selectedCompareBy[parent.name] = [child];
3077
3089
  }
3078
3090
  else {
3079
- delete updated[parent.name];
3091
+ /** check if the child is already present */
3092
+ let childObjFound = this.selectedCompareBy[parent.name].find((childObj) => childObj.name === child.name);
3093
+ if (!childObjFound) {
3094
+ /**child not found */
3095
+ this.selectedCompareBy[parent.name].push(child);
3096
+ }
3097
+ else {
3098
+ /**child already selected - hence delete that child*/
3099
+ this.selectedCompareBy[parent.name] = this.selectedCompareBy[parent.name].filter((childObj) => childObj.name !== child.name);
3100
+ if (this.selectedCompareBy[parent.name] &&
3101
+ !this.selectedCompareBy[parent.name].length) {
3102
+ delete this.selectedCompareBy[parent.name];
3103
+ }
3104
+ }
3080
3105
  }
3081
- this.selectedCompareBy = updated;
3082
3106
  this.selectedFromDropdown.emit({
3083
3107
  compareByFilters: this.selectedCompareBy,
3084
- entireList: parent.children,
3108
+ entireList: parent?.children,
3085
3109
  });
3086
- sessionStorage.setItem(this.dropdownHeaderName === 'Compare by'
3087
- ? 'selectedCompareBy'
3088
- : 'selectedCompare2By', JSON.stringify(this.selectedCompareBy));
3110
+ if (this.dropdownHeaderName == 'Compare by' && parent.children)
3111
+ sessionStorage.setItem('selectedCompareBy', JSON.stringify(this.selectedCompareBy));
3112
+ else {
3113
+ sessionStorage.setItem('selectedCompare2By', JSON.stringify(this.selectedCompareBy));
3114
+ }
3089
3115
  }
3090
3116
  handleIfPresent(data) {
3091
- const selected = this.selectedCompareBy[data.name];
3092
- if (!selected)
3093
- return false;
3094
- if (Array.isArray(selected) && data.children) {
3095
- return selected.length === data.children.length;
3117
+ let parentObj = this.dropdownData.find((obj) => obj.name === data.name);
3118
+ if (this.selectedCompareBy[data.name] &&
3119
+ parentObj.children &&
3120
+ parentObj.children.length == this.selectedCompareBy[data.name]?.length) {
3121
+ return true;
3096
3122
  }
3097
- return true;
3123
+ if (this.selectedCompareBy[data.name] && !parentObj.children) {
3124
+ return true;
3125
+ }
3126
+ return false;
3098
3127
  }
3099
3128
  handleIfChildPresent(parent, child) {
3100
3129
  if (!Object.keys(this.selectedCompareBy).length) {
@@ -8042,7 +8071,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
8042
8071
  }
8043
8072
  else if (groupsCount > 8 || subgroupsCount > 2) {
8044
8073
  innerContainer.style('overflow-x', 'auto');
8045
- innerContainer.classed('scroll-enabled', true);
8074
+ innerContainer.classed('scroll-enabled', false);
8046
8075
  }
8047
8076
  else {
8048
8077
  innerContainer.style('overflow-x', 'hidden');