@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.
@@ -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 {
@@ -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
  }