@annalib/anna-core 29.1.0 → 29.1.2

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.
@@ -1806,6 +1806,8 @@ class AnnaFilterService {
1806
1806
  "userMG",
1807
1807
  "udValue",
1808
1808
  "odValue",
1809
+ "buyerBookedValue",
1810
+ "trafficBookedValue",
1809
1811
  ]);
1810
1812
  this.isFilterSortActive = {};
1811
1813
  this.resetFilterSortActiveStatus = true;
@@ -2179,7 +2181,7 @@ class AnnaFilterService {
2179
2181
  filteredData = this.checkIfSortingIsAppliedThenSortTheData(originalData);
2180
2182
  }
2181
2183
  this.tooltipSelectedMap.forEach((value, key) => {
2182
- if (key !== keyToSkip && originalData.length > 0 && Object.keys(originalData[0]).includes(key)) {
2184
+ if (key !== keyToSkip && originalData.length > 0 && this.nestedKeyExists(originalData[0], key)) {
2183
2185
  if (this.sliderSet.has(key)) {
2184
2186
  filteredData = filteredData.filter((obj) => obj[key] >= value.min && obj[key] <= value.max);
2185
2187
  }
@@ -2221,12 +2223,23 @@ class AnnaFilterService {
2221
2223
  filteredData = filteredData.filter((obj) => this.returnDataForStartAndEndTimeRange(obj, value, key));
2222
2224
  }
2223
2225
  else if (value.length > 0) {
2224
- filteredData = filteredData.filter((u) => value.includes(u[key]));
2226
+ filteredData = filteredData.filter((u) => value.includes(this.getValueFromObject(u, key)));
2225
2227
  }
2226
2228
  }
2227
2229
  });
2228
2230
  return filteredData;
2229
2231
  }
2232
+ getValueFromObject(obj, key) {
2233
+ return key.split(".").reduce((res, currentKey) => res && res[currentKey], obj);
2234
+ }
2235
+ nestedKeyExists(obj, key) {
2236
+ return (key.split(".").reduce((acc, currentKey) => {
2237
+ if (acc && currentKey in acc) {
2238
+ return acc[currentKey];
2239
+ }
2240
+ return undefined;
2241
+ }, obj) !== undefined);
2242
+ }
2230
2243
  returnOrdersInTheRange(order, range, key) {
2231
2244
  const isDateBetweenTheSelectedRange = dayjs(order[key]).isBetween(range.minSelectedDate, range.maxSelectedDate);
2232
2245
  const isDateSameAsTheMinSelectedDate = dayjs(order[key]).isSame(range.minSelectedDate);
@@ -4863,34 +4876,6 @@ class AnnaNonEditableGenericTableComponent {
4863
4876
  this.bindValueFuncCalled = false;
4864
4877
  }
4865
4878
  }
4866
- checkIfUniqueValuePresentForTheHeader(header, enabledHeaders) {
4867
- header.filterSortObjectKeys.forEach((item) => {
4868
- const dataToCheck = this.annaFilterService.getFilterOptionsData(this.tableData, this.clonedTableData, item);
4869
- if (item === "period") {
4870
- const uniqStartDate = uniq(dataToCheck.map((u) => u.startDate));
4871
- const uniqEndDate = uniq(dataToCheck.map((u) => u.endDate));
4872
- if (uniqStartDate.length > 1 || uniqEndDate.length > 1 || this.isTooltipActive([item])) {
4873
- enabledHeaders.push(item);
4874
- }
4875
- }
4876
- else {
4877
- const values = dataToCheck.map((u) => u[item]);
4878
- // if last applied filter is this header, push it alos as enabledHeader
4879
- let activeAndLastlyAppliedHeader = false;
4880
- if (this.annaFilterService.appliedFiltersArray.length > 0 &&
4881
- this.annaFilterService.appliedFiltersArray[this.annaFilterService.appliedFiltersArray.length - 1] === item) {
4882
- activeAndLastlyAppliedHeader = true;
4883
- }
4884
- if (header.filter === "CHECKBOX" && (uniq(values).length > 1 || activeAndLastlyAppliedHeader)) {
4885
- enabledHeaders.push(item);
4886
- }
4887
- else if (header.filter !== "CHECKBOX" &&
4888
- (uniq(values).filter((n) => n != null && n !== "-").length > 1 || activeAndLastlyAppliedHeader)) {
4889
- enabledHeaders.push(item);
4890
- }
4891
- }
4892
- });
4893
- }
4894
4879
  openTooltip(tooltip, header, columnHeader) {
4895
4880
  this.closeTooltip();
4896
4881
  this.tooltip = tooltip;
@@ -4902,39 +4887,6 @@ class AnnaNonEditableGenericTableComponent {
4902
4887
  return new RadioButtonModel(key, value, columnHeader.isSortRequired[index], columnHeader.isFilterRequired[index]);
4903
4888
  });
4904
4889
  }
4905
- disableEnableEachColumnTooltipIcon() {
4906
- this.tableHeaders.forEach((header) => {
4907
- header.headerInfo.forEach((item) => {
4908
- if (item.showTooltipIcon) {
4909
- let values = [];
4910
- item.disableTooltipIcon = true;
4911
- item.filterSortObjectKeys.forEach((key) => {
4912
- const latestFilters = this.annaFilterService.appliedFiltersArray;
4913
- if (latestFilters.length > 0 &&
4914
- item.disableTooltipIcon &&
4915
- latestFilters[latestFilters.length - 1] === key) {
4916
- item.disableTooltipIcon = false;
4917
- }
4918
- if (item.disableTooltipIcon) {
4919
- if (key === "period") {
4920
- const uniqStartDate = uniq(this.tableData.map((u) => u.startDate));
4921
- const uniqEndDate = uniq(this.tableData.map((u) => u.endDate));
4922
- item.disableTooltipIcon = !(uniqStartDate.length > 1 || uniqEndDate.length > 1);
4923
- }
4924
- else {
4925
- values = this.tableData.map((u) => u[key]);
4926
- if ((item.filter === "CHECKBOX" && uniq(values).length > 1) ||
4927
- (item.filter !== "CHECKBOX" &&
4928
- uniq(values).filter((n) => n != null && n !== "-").length > 1)) {
4929
- item.disableTooltipIcon = false;
4930
- }
4931
- }
4932
- }
4933
- });
4934
- }
4935
- });
4936
- });
4937
- }
4938
4890
  dataRowClicked(rowData) {
4939
4891
  this.rowClicked.emit(rowData);
4940
4892
  }