@annalib/anna-core 4.2.12 → 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.
@@ -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 {
@@ -2006,6 +2014,7 @@ class AnnaNonEditableGenericTableComponent {
2006
2014
  }
2007
2015
  checkIfUniqueValuePresentForTheHeader(header, enabledHeaders) {
2008
2016
  header.filterSortObjectKeys.forEach((item) => {
2017
+ console.log(uniq(this.tableData.map((u) => u[item])));
2009
2018
  if (item == "period") {
2010
2019
  let uniqStartDate = uniq(this.tableData.map((u) => u["startDate"]));
2011
2020
  let uniqEndDate = uniq(this.tableData.map((u) => u["endDate"]));
@@ -2013,8 +2022,14 @@ class AnnaNonEditableGenericTableComponent {
2013
2022
  enabledHeaders.push(item);
2014
2023
  }
2015
2024
  }
2016
- else if (uniq(this.tableData.map((u) => u[item])).length > 1 || this.isTooltipActive([item])) {
2017
- enabledHeaders.push(item);
2025
+ else {
2026
+ let values = this.tableData.map((u) => u[item]);
2027
+ if (header.filter == "CHECKBOX" && uniq(values).filter(n => n != null).length > 1) {
2028
+ enabledHeaders.push(item);
2029
+ }
2030
+ else if (header.filter != "CHECKBOX" && uniq(values).filter(n => n != null && n != "-").length > 1) {
2031
+ enabledHeaders.push(item);
2032
+ }
2018
2033
  }
2019
2034
  });
2020
2035
  }