@annalib/anna-core 28.6.15 → 28.6.17

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.
@@ -1596,11 +1596,13 @@ class TooltipModelForColumnLevelFiltering {
1596
1596
  }
1597
1597
  }
1598
1598
  class RadioButtonModel {
1599
- constructor(key, value, sort, filter) {
1599
+ constructor(key, value, sort, filter, showSplitedOptions = false, spitKey = ", ") {
1600
1600
  this.key = key;
1601
1601
  this.label = value;
1602
1602
  this.isSortRequired = sort;
1603
1603
  this.isFilterRequired = filter;
1604
+ this.showSplitedOptions = showSplitedOptions;
1605
+ this.splitKey = spitKey;
1604
1606
  }
1605
1607
  }
1606
1608
  var AllSelectedStatus;
@@ -1789,6 +1791,8 @@ class AnnaFilterService {
1789
1791
  this.tooltipMap = new Map();
1790
1792
  this.tooltipSelectedMap = new Map();
1791
1793
  this.appliedFiltersArray = [];
1794
+ this.SPLITED_CHECKBOX_FILTER_KEY = "_SplitedCheckBoxOptions";
1795
+ this.DEFAULT_SPLIT_SEPARATOR = ", ";
1792
1796
  this.sliderCurrencySet = new Set([
1793
1797
  "booked",
1794
1798
  "cpp",
@@ -2001,6 +2005,7 @@ class AnnaFilterService {
2001
2005
  "ViolatingSpotDate",
2002
2006
  "ViolatedSpotDate",
2003
2007
  "ActualWeekStartDate",
2008
+ "LastFetchedDate",
2004
2009
  ];
2005
2010
  const timeArr = [
2006
2011
  "StartTimeForFilter",
@@ -2128,7 +2133,8 @@ class AnnaFilterService {
2128
2133
  this.selectedRadio === "GeneratedOn" ||
2129
2134
  this.selectedRadio === "Week" ||
2130
2135
  this.selectedRadio === "ActualWeekStartDate" ||
2131
- this.selectedRadio === "scheduledDate") {
2136
+ this.selectedRadio === "scheduledDate" ||
2137
+ this.selectedRadio === "LastFetchedDate") {
2132
2138
  isDataFiltered =
2133
2139
  !isEqual(this.initialValueMap.get(this.selectedRadio), this.tooltipSelectedMap.get(this.selectedRadio)) && !isEqual(this.tooltipSelectedMap.get(this.selectedRadio), this.flightDateRange);
2134
2140
  if (!isDataFiltered && this.tooltipSelectedMap.has(this.selectedRadio)) {
@@ -2178,6 +2184,11 @@ class AnnaFilterService {
2178
2184
  filteredData = this.checkIfSortingIsAppliedThenSortTheData(originalData);
2179
2185
  }
2180
2186
  this.tooltipSelectedMap.forEach((value, key) => {
2187
+ const filterSplitedValues = key.includes(this.SPLITED_CHECKBOX_FILTER_KEY);
2188
+ if (filterSplitedValues) {
2189
+ // eslint-disable-next-line no-param-reassign
2190
+ key = key.split(this.SPLITED_CHECKBOX_FILTER_KEY)[0];
2191
+ }
2181
2192
  if (key !== keyToSkip && originalData.length > 0 && Object.keys(originalData[0]).includes(key)) {
2182
2193
  if (this.sliderSet.has(key)) {
2183
2194
  filteredData = filteredData.filter((obj) => obj[key] >= value.min && obj[key] <= value.max);
@@ -2198,7 +2209,8 @@ class AnnaFilterService {
2198
2209
  key === "ActualWeekStartDate" ||
2199
2210
  key === "ViolatedSpotDate" ||
2200
2211
  key === "ViolatingSpotDate" ||
2201
- key === "scheduledDate") {
2212
+ key === "scheduledDate" ||
2213
+ key === "LastFetchedDate") {
2202
2214
  filteredData = filteredData.filter((obj) => this.isObjectInTheRange(obj, value, key));
2203
2215
  }
2204
2216
  else if (key === "period") {
@@ -2220,7 +2232,7 @@ class AnnaFilterService {
2220
2232
  filteredData = filteredData.filter((obj) => this.returnDataForStartAndEndTimeRange(obj, value, key));
2221
2233
  }
2222
2234
  else if (value.length > 0) {
2223
- filteredData = filteredData.filter((u) => value.includes(u[key]));
2235
+ filteredData = filteredData.filter((u) => filterSplitedValues ? value.find((val) => u[key].includes(val)) : value.includes(u[key]));
2224
2236
  }
2225
2237
  }
2226
2238
  });
@@ -2403,7 +2415,8 @@ class AnnaFilterService {
2403
2415
  key === "ActualWeekStartDate" ||
2404
2416
  key === "ViolatedSpotDate" ||
2405
2417
  key === "ViolatingSpotDate" ||
2406
- key === "scheduledDate") {
2418
+ key === "scheduledDate" ||
2419
+ key === "LastFetchedDate") {
2407
2420
  filteredData = filteredData.filter((obj) => this.isObjectInTheRange(obj, value, key));
2408
2421
  }
2409
2422
  else if (key === "period") {
@@ -2526,19 +2539,33 @@ class AnnaFilterService {
2526
2539
  currentColumnSortFilter = currentColumnSortFilter || SortTypeEnum.DEFAULT;
2527
2540
  return currentColumnSortFilter;
2528
2541
  }
2529
- createListForCheckboxFilter(header, optionData) {
2530
- const tooltipOptions = this.getTooltipModelFromOptionData(optionData, header);
2542
+ createListForCheckboxFilter(header, optionData, showSplitedOptions = false, splitKey = this.DEFAULT_SPLIT_SEPARATOR) {
2543
+ const tooltipOptions = this.getTooltipModelFromOptionData(optionData, header, showSplitedOptions, splitKey);
2531
2544
  this.selectUnselectListCheckbox(tooltipOptions, header);
2532
2545
  this.formatNullOptionToSpecifiedString(tooltipOptions, this.nullToBeFormatedIntoString);
2533
2546
  return tooltipOptions;
2534
2547
  }
2535
- getTooltipModelFromOptionData(optionData, header) {
2536
- const uniqOptionData = uniq(optionData.map((item) => item[header]));
2548
+ getTooltipModelFromOptionData(optionData, header, showSplitedOptions = false, splitKey = this.DEFAULT_SPLIT_SEPARATOR) {
2549
+ let uniqOptionData = [];
2550
+ if (showSplitedOptions) {
2551
+ let splittedOptions = [];
2552
+ optionData.forEach((option) => {
2553
+ splittedOptions = [...splittedOptions, ...option[header].split(splitKey)];
2554
+ });
2555
+ uniqOptionData = uniq(splittedOptions);
2556
+ }
2557
+ else {
2558
+ uniqOptionData = uniq(optionData.map((item) => item[header]));
2559
+ }
2537
2560
  return uniqOptionData.map((item, index) => new TooltipModel(item, index + 1));
2538
2561
  }
2539
2562
  selectUnselectListCheckbox(tooltipOptions, header) {
2540
- if (this.tooltipSelectedMap.has(header)) {
2541
- const selectedValueSet = new Set(this.tooltipSelectedMap.get(header));
2563
+ const tooltipSelectedMapWithOriginalKeys = new Map();
2564
+ this.tooltipSelectedMap.forEach((value, key) => {
2565
+ tooltipSelectedMapWithOriginalKeys.set(key.split(this.SPLITED_CHECKBOX_FILTER_KEY)[0], value);
2566
+ });
2567
+ if (tooltipSelectedMapWithOriginalKeys.has(header)) {
2568
+ const selectedValueSet = new Set(tooltipSelectedMapWithOriginalKeys.get(header));
2542
2569
  tooltipOptions.forEach((item) => {
2543
2570
  item.isSelected = selectedValueSet.has(item.value);
2544
2571
  });
@@ -3182,6 +3209,21 @@ class AnnaFilterService {
3182
3209
  });
3183
3210
  });
3184
3211
  }
3212
+ // for date type of filters we need to update tooltip selected map start and end date values to dayjs object.
3213
+ updateDateFilterTooltipSelectedMap(keys) {
3214
+ keys.forEach((key) => {
3215
+ if (this.tooltipSelectedMap?.has(key)) {
3216
+ const dateRange = this.tooltipSelectedMap.get(key);
3217
+ if (dateRange?.fromDate && dateRange?.toDate) {
3218
+ const selectedDateObj = {
3219
+ fromDate: dayjs(dateRange.fromDate),
3220
+ toDate: dayjs(dateRange.toDate),
3221
+ };
3222
+ this.tooltipSelectedMap.set(key, selectedDateObj);
3223
+ }
3224
+ }
3225
+ });
3226
+ }
3185
3227
  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 }); }
3186
3228
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AnnaFilterService, providedIn: "root" }); }
3187
3229
  }
@@ -3275,10 +3317,13 @@ class AnnaColumnCheckboxFilterComponent {
3275
3317
  this.searchItem = null;
3276
3318
  this.showSortComponent = activeTab.isSortRequired;
3277
3319
  this.showFilterComponent = activeTab.isFilterRequired;
3320
+ this.showSplitedOptions = activeTab.showSplitedOptions;
3321
+ this.splitKey = this.showSplitedOptions ? (activeTab.splitKey ?? this.annaFilterService.DEFAULT_SPLIT_SEPARATOR) : "";
3278
3322
  this.tempSortOrder = null;
3279
3323
  this.isFilterChanged = false;
3280
3324
  this.isSortChanged = false;
3281
3325
  this.annaFilterService.selectedRadio = header;
3326
+ this.selectedRadioKey = `${header}${(this.showSplitedOptions) ? (this.annaFilterService.SPLITED_CHECKBOX_FILTER_KEY) : ""}`;
3282
3327
  if (reload) {
3283
3328
  setTimeout(() => {
3284
3329
  this.createFilterTooltipData(activeTab, header);
@@ -3308,7 +3353,7 @@ class AnnaColumnCheckboxFilterComponent {
3308
3353
  }
3309
3354
  createListForCheckboxFilter(header) {
3310
3355
  const optionData = this.annaFilterService.getFilterOptionsData(this.tableData, this.clonedTableData);
3311
- const tooltipOptions = this.annaFilterService.createListForCheckboxFilter(header, optionData);
3356
+ const tooltipOptions = this.annaFilterService.createListForCheckboxFilter(header, optionData, this.showSplitedOptions, this.splitKey);
3312
3357
  return tooltipOptions;
3313
3358
  }
3314
3359
  selectUnselectListCheckbox(tooltipOptions, header) {
@@ -3406,8 +3451,8 @@ class AnnaColumnCheckboxFilterComponent {
3406
3451
  if (this.showFilterComponent && this.isFilterChanged) {
3407
3452
  const currentSelectedValue = this.annaFilterService.getCheckboxCurrentSelectedValue(this.searchItem, this.tooltipOptions);
3408
3453
  this.annaFilterService.reOrderAppliedFiltersState(this.clonedTableData, currentSelectedValue);
3409
- this.annaFilterService.tooltipSelectedMap.set(this.annaFilterService.selectedRadio, currentSelectedValue);
3410
- this.tableData = this.annaFilterService.filterData(this.clonedTableData, "");
3454
+ this.annaFilterService.tooltipSelectedMap.set(this.selectedRadioKey, currentSelectedValue);
3455
+ this.tableData = this.annaFilterService.filterData(this.clonedTableData, "", false);
3411
3456
  this.annaSortService.noSortingAppliedData = cloneDeep(this.tableData);
3412
3457
  }
3413
3458
  }
@@ -4747,8 +4792,6 @@ class AnnaNonEditableGenericTableComponent {
4747
4792
  // this.tooltipRadioTextMap.set("odValue", "$ OD");
4748
4793
  this.tooltipRadioTextMap.set("udValue", "Proj. $ UD");
4749
4794
  this.tooltipRadioTextMap.set("odValue", "Proj. $ OD");
4750
- this.tooltipRadioTextMap.set("buyerNames", "Buyers");
4751
- this.tooltipRadioTextMap.set("repUserNames", "Reps");
4752
4795
  this.tooltipRadioTextMap.set("InventoryCode", "Inventory Code");
4753
4796
  this.tooltipRadioTextMap.set("BuyerProgramName", "Buyer Program Name");
4754
4797
  this.tooltipRadioTextMap.set("StartTime", "Start Time");
@@ -4791,6 +4834,22 @@ class AnnaNonEditableGenericTableComponent {
4791
4834
  this.tooltipRadioTextMap.set("SellerProgInvCode", "Seller Pgm (Inv Code)");
4792
4835
  this.tooltipRadioTextMap.set("SellerProgramName", "Seller Program");
4793
4836
  this.tooltipRadioTextMap.set("buyerProgramName", "Buyer Program");
4837
+ this.tooltipRadioTextMap.set("LastFetchedDate", "Last Fetched");
4838
+ this.tooltipRadioTextMap.set("bookedDps", "Booked Dps");
4839
+ this.tooltipRadioTextMap.set("totalBookedGrp", "Total Booked Grp");
4840
+ this.tooltipRadioTextMap.set("totalBookedImps", "Total Booked Imps");
4841
+ this.tooltipRadioTextMap.set("bookedGrpToDate", "Booked GRP To-Date");
4842
+ this.tooltipRadioTextMap.set("bookedImpsToDate", "Booked IMPS To-Date");
4843
+ this.tooltipRadioTextMap.set("goalGrpToDate", "Goal GRP To-Date");
4844
+ this.tooltipRadioTextMap.set("goalImpsToDate", "Goal IMPS To-Date");
4845
+ this.tooltipRadioTextMap.set("postedGrpToDate", "Posted GRP To-Date");
4846
+ this.tooltipRadioTextMap.set("postedImpsToDate", "Posted IMPS To-Date");
4847
+ this.tooltipRadioTextMap.set("udGrpToDate", "UD GRP To-Date");
4848
+ this.tooltipRadioTextMap.set("udImpsToDate", "UD IMPS To-Date");
4849
+ this.tooltipRadioTextMap.set("odGrpToDate", "OD GRP To-Date");
4850
+ this.tooltipRadioTextMap.set("odImpsToDate", "OD IMPS To-Date");
4851
+ this.tooltipRadioTextMap.set("scheduledADUs", "Scheduled ADUs");
4852
+ this.tooltipRadioTextMap.set("postedADUs", "Posted ADUs");
4794
4853
  }
4795
4854
  selectOrUnselectCheckbox(rowData, columnKeys, isCheckboxSelected) {
4796
4855
  rowData[columnKeys] = !rowData[columnKeys];
@@ -4887,7 +4946,7 @@ class AnnaNonEditableGenericTableComponent {
4887
4946
  this.filterTabObjects = header.map((key, index) => {
4888
4947
  // change to display name
4889
4948
  const value = this.tooltipRadioTextMap.has(key) ? this.tooltipRadioTextMap.get(key) : key;
4890
- return new RadioButtonModel(key, value, columnHeader.isSortRequired[index], columnHeader.isFilterRequired[index]);
4949
+ return new RadioButtonModel(key, value, columnHeader.isSortRequired[index], columnHeader.isFilterRequired[index], columnHeader?.showSplitedOptionsInFilter, columnHeader?.splitKey);
4891
4950
  });
4892
4951
  }
4893
4952
  disableEnableEachColumnTooltipIcon() {