@annalib/anna-core 4.2.14 → 4.2.16

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.
@@ -1196,14 +1196,22 @@ class AnnaFilterService {
1196
1196
  ]);
1197
1197
  this.isFilterSortActive = null;
1198
1198
  this.percentTranslateFunction = (data) => {
1199
- const val = data.toFixed(1) + "%";
1200
- return val;
1199
+ if (Math.abs(data) >= 1000) {
1200
+ let isNegVal = data < 0;
1201
+ const val = (Math.abs(data) / 1000).toFixed(1) + "k%";
1202
+ return isNegVal ? "-" + val : val;
1203
+ }
1204
+ else {
1205
+ let isNegVal = data < 0;
1206
+ let isWholeNum = parseInt(data.toString()) == data;
1207
+ let val = isWholeNum ? Math.abs(data).toString() : Math.abs(data).toFixed(1);
1208
+ return isNegVal ? "-" + val + "%" : val + "%";
1209
+ }
1201
1210
  };
1202
1211
  this.currencyTranslateFunction = (data) => {
1203
1212
  if (Math.abs(data) >= 1000) {
1204
1213
  let isNegVal = data < 0;
1205
- const val = "$" + (Math.abs(data) / 1000).toFixed(1);
1206
- +"k";
1214
+ const val = "$" + (Math.abs(data) / 1000).toFixed(1) + "k";
1207
1215
  return isNegVal ? "-" + val : val;
1208
1216
  }
1209
1217
  else {
@@ -2008,6 +2016,7 @@ class AnnaNonEditableGenericTableComponent {
2008
2016
  }
2009
2017
  checkIfUniqueValuePresentForTheHeader(header, enabledHeaders) {
2010
2018
  header.filterSortObjectKeys.forEach((item) => {
2019
+ console.log(uniq(this.tableData.map((u) => u[item])));
2011
2020
  if (item == "period") {
2012
2021
  let uniqStartDate = uniq(this.tableData.map((u) => u["startDate"]));
2013
2022
  let uniqEndDate = uniq(this.tableData.map((u) => u["endDate"]));
@@ -2015,8 +2024,14 @@ class AnnaNonEditableGenericTableComponent {
2015
2024
  enabledHeaders.push(item);
2016
2025
  }
2017
2026
  }
2018
- else if (uniq(this.tableData.map((u) => u[item])).length > 1 || this.isTooltipActive([item])) {
2019
- enabledHeaders.push(item);
2027
+ else {
2028
+ let values = this.tableData.map((u) => u[item]);
2029
+ if (header.filter == "CHECKBOX" && uniq(values).filter(n => n != null).length > 1) {
2030
+ enabledHeaders.push(item);
2031
+ }
2032
+ else if (header.filter != "CHECKBOX" && uniq(values).filter(n => n != null && n != "-").length > 1) {
2033
+ enabledHeaders.push(item);
2034
+ }
2020
2035
  }
2021
2036
  });
2022
2037
  }