@annalib/anna-core 28.6.14 → 28.6.15

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.
@@ -3119,6 +3119,69 @@ class AnnaFilterService {
3119
3119
  }
3120
3120
  });
3121
3121
  }
3122
+ checkIfUniqueValuePresentForTheHeader(header, enabledHeaders, tableData, clonedTableData) {
3123
+ header.filterSortObjectKeys.forEach((item) => {
3124
+ const dataToCheck = this.getFilterOptionsData(tableData, clonedTableData, item);
3125
+ if (item === "period") {
3126
+ const uniqStartDate = uniq(dataToCheck.map((u) => u.startDate));
3127
+ const uniqEndDate = uniq(dataToCheck.map((u) => u.endDate));
3128
+ if (uniqStartDate.length > 1 ||
3129
+ uniqEndDate.length > 1 ||
3130
+ this.isTooltipActive([item], this.annaSortService.columnSortState)) {
3131
+ enabledHeaders.push(item);
3132
+ }
3133
+ }
3134
+ else {
3135
+ const values = dataToCheck.map((u) => u[item]);
3136
+ // if last applied filter is this header, push it alos as enabledHeader
3137
+ let activeAndLastlyAppliedHeader = false;
3138
+ if (this.appliedFiltersArray.length > 0 &&
3139
+ this.appliedFiltersArray[this.appliedFiltersArray.length - 1] === item) {
3140
+ activeAndLastlyAppliedHeader = true;
3141
+ }
3142
+ if (header.filter === "CHECKBOX" && (uniq(values).length > 1 || activeAndLastlyAppliedHeader)) {
3143
+ enabledHeaders.push(item);
3144
+ }
3145
+ else if (header.filter !== "CHECKBOX" &&
3146
+ (uniq(values).filter((n) => n != null && n !== "-").length > 1 || activeAndLastlyAppliedHeader)) {
3147
+ enabledHeaders.push(item);
3148
+ }
3149
+ }
3150
+ });
3151
+ }
3152
+ disableEnableEachColumnTooltipIcon(tableHeaders, tableData, clonedTableData) {
3153
+ tableHeaders.forEach((header) => {
3154
+ header.headerInfo.forEach((item) => {
3155
+ if (item.showTooltipIcon) {
3156
+ let values = [];
3157
+ item.disableTooltipIcon = true;
3158
+ item.filterSortObjectKeys.forEach((key) => {
3159
+ const latestFilters = this.appliedFiltersArray;
3160
+ if (latestFilters.length > 0 &&
3161
+ item.disableTooltipIcon &&
3162
+ latestFilters[latestFilters.length - 1] === key) {
3163
+ item.disableTooltipIcon = false;
3164
+ }
3165
+ if (item.disableTooltipIcon) {
3166
+ if (key === "period") {
3167
+ const uniqStartDate = uniq(tableData.map((u) => u.startDate));
3168
+ const uniqEndDate = uniq(tableData.map((u) => u.endDate));
3169
+ item.disableTooltipIcon = !(uniqStartDate.length > 1 || uniqEndDate.length > 1);
3170
+ }
3171
+ else {
3172
+ values = tableData.map((u) => u[key]);
3173
+ if ((item.filter === "CHECKBOX" && uniq(values).length > 1) ||
3174
+ (item.filter !== "CHECKBOX" &&
3175
+ uniq(values).filter((n) => n != null && n !== "-").length > 1)) {
3176
+ item.disableTooltipIcon = false;
3177
+ }
3178
+ }
3179
+ }
3180
+ });
3181
+ }
3182
+ });
3183
+ });
3184
+ }
3122
3185
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AnnaFilterService, deps: [{ token: AnnaDateTimeFormatService }, { token: AnnaSortService }], target: i0.ɵɵFactoryTarget.Injectable }); }
3123
3186
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AnnaFilterService, providedIn: "root" }); }
3124
3187
  }
@@ -4291,7 +4354,7 @@ class AnnaNonEditableGenericTableComponent {
4291
4354
  }
4292
4355
  else {
4293
4356
  this.setInitialRowsForTable();
4294
- this.disableEnableEachColumnTooltipIcon();
4357
+ this.annaFilterService.disableEnableEachColumnTooltipIcon(this.tableHeaders, this.tableData, this.clonedTableData);
4295
4358
  this.tableColumns = this.tableHeaders.filter((x) => x.visible).map((x) => x.headerInfo[0].objectKey);
4296
4359
  if ((this.tableData && this.tableData.length === 0) ||
4297
4360
  (this.tableData.length === 2 && this.checkIfAllTheElementsAreZero())) {
@@ -4684,6 +4747,8 @@ class AnnaNonEditableGenericTableComponent {
4684
4747
  // this.tooltipRadioTextMap.set("odValue", "$ OD");
4685
4748
  this.tooltipRadioTextMap.set("udValue", "Proj. $ UD");
4686
4749
  this.tooltipRadioTextMap.set("odValue", "Proj. $ OD");
4750
+ this.tooltipRadioTextMap.set("buyerNames", "Buyers");
4751
+ this.tooltipRadioTextMap.set("repUserNames", "Reps");
4687
4752
  this.tooltipRadioTextMap.set("InventoryCode", "Inventory Code");
4688
4753
  this.tooltipRadioTextMap.set("BuyerProgramName", "Buyer Program Name");
4689
4754
  this.tooltipRadioTextMap.set("StartTime", "Start Time");
@@ -4726,21 +4791,6 @@ class AnnaNonEditableGenericTableComponent {
4726
4791
  this.tooltipRadioTextMap.set("SellerProgInvCode", "Seller Pgm (Inv Code)");
4727
4792
  this.tooltipRadioTextMap.set("SellerProgramName", "Seller Program");
4728
4793
  this.tooltipRadioTextMap.set("buyerProgramName", "Buyer Program");
4729
- this.tooltipRadioTextMap.set("bookedDps", "Booked Dps");
4730
- this.tooltipRadioTextMap.set("totalBookedGrp", "Total Booked Grp");
4731
- this.tooltipRadioTextMap.set("totalBookedImps", "Total Booked Imps");
4732
- this.tooltipRadioTextMap.set("bookedGrpToDate", "Booked GRP To-Date");
4733
- this.tooltipRadioTextMap.set("bookedImpsToDate", "Booked IMPS To-Date");
4734
- this.tooltipRadioTextMap.set("goalGrpToDate", "Goal GRP To-Date");
4735
- this.tooltipRadioTextMap.set("goalImpsToDate", "Goal IMPS To-Date");
4736
- this.tooltipRadioTextMap.set("postedGrpToDate", "Posted GRP To-Date");
4737
- this.tooltipRadioTextMap.set("postedImpsToDate", "Posted IMPS To-Date");
4738
- this.tooltipRadioTextMap.set("udGrpToDate", "UD GRP To-Date");
4739
- this.tooltipRadioTextMap.set("udImpsToDate", "UD IMPS To-Date");
4740
- this.tooltipRadioTextMap.set("odGrpToDate", "OD GRP To-Date");
4741
- this.tooltipRadioTextMap.set("odImpsToDate", "OD IMPS To-Date");
4742
- this.tooltipRadioTextMap.set("scheduledADUs", "Scheduled ADUs");
4743
- this.tooltipRadioTextMap.set("postedADUs", "Posted ADUs");
4744
4794
  }
4745
4795
  selectOrUnselectCheckbox(rowData, columnKeys, isCheckboxSelected) {
4746
4796
  rowData[columnKeys] = !rowData[columnKeys];
@@ -4786,7 +4836,7 @@ class AnnaNonEditableGenericTableComponent {
4786
4836
  }
4787
4837
  else {
4788
4838
  const enabledHeaders = [];
4789
- this.checkIfUniqueValuePresentForTheHeader(header, enabledHeaders);
4839
+ this.annaFilterService.checkIfUniqueValuePresentForTheHeader(header, enabledHeaders, this.tableData, this.clonedTableData);
4790
4840
  this.openTooltip(tooltip, enabledHeaders, header);
4791
4841
  if (window.innerWidth < 1500 &&
4792
4842
  window.innerHeight < 768 &&
@@ -5079,14 +5129,14 @@ class AnnaNonEditableGenericTableComponent {
5079
5129
  this.tableData = tableData;
5080
5130
  this.setScrollToInitialPosition();
5081
5131
  this.setInitialRowsForTable();
5082
- this.disableEnableEachColumnTooltipIcon();
5132
+ this.annaFilterService.disableEnableEachColumnTooltipIcon(this.tableHeaders, this.tableData, this.clonedTableData);
5083
5133
  this.filterAppliedToTable.emit(tableData);
5084
5134
  this.closeTooltip();
5085
5135
  }
5086
5136
  sortingApplied(tableData) {
5087
5137
  this.tableData = tableData;
5088
5138
  this.setInitialRowsForTable();
5089
- this.disableEnableEachColumnTooltipIcon();
5139
+ this.annaFilterService.disableEnableEachColumnTooltipIcon(this.tableHeaders, this.tableData, this.clonedTableData);
5090
5140
  this.sortingAppliedToTable.emit(tableData);
5091
5141
  this.closeTooltip();
5092
5142
  }