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