ngx-wapp-components 3.0.40-alpha.8 → 3.0.40-alpha.9

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.
@@ -983,6 +983,7 @@ var PeriodSelectEnum;
983
983
  (function (PeriodSelectEnum) {
984
984
  PeriodSelectEnum[PeriodSelectEnum["Last24Hours"] = 1] = "Last24Hours";
985
985
  PeriodSelectEnum[PeriodSelectEnum["Custom"] = 2] = "Custom";
986
+ PeriodSelectEnum[PeriodSelectEnum["Last3Months"] = 3] = "Last3Months";
986
987
  })(PeriodSelectEnum || (PeriodSelectEnum = {}));
987
988
  var CustomColor;
988
989
  (function (CustomColor) {
@@ -4114,7 +4115,6 @@ class WTreeFieldComponent {
4114
4115
  if (!productSectionList)
4115
4116
  return [];
4116
4117
  return productSectionList.map((product) => ({
4117
- key: `${product[this.getFieldId()]}`,
4118
4118
  label: product.name,
4119
4119
  data: product[this.getFieldId()],
4120
4120
  children: this.itemsToTreeNodeMap(product[this.getEntityInverseParent()])
@@ -4343,6 +4343,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImpor
4343
4343
  args: ['translationsOptions']
4344
4344
  }] } });
4345
4345
 
4346
+ const ticketsPeriodSelectType$1 = 'ticketsPeriodSelectType';
4346
4347
  class WPeriodSelectFieldComponent {
4347
4348
  constructor(wLocalStorage, wSessionStorage) {
4348
4349
  this.wLocalStorage = wLocalStorage;
@@ -4360,9 +4361,11 @@ class WPeriodSelectFieldComponent {
4360
4361
  initPeriodCategorySelect() {
4361
4362
  const key24H = PeriodSelectEnum[PeriodSelectEnum.Last24Hours].toLowerCase();
4362
4363
  const keyCustom = PeriodSelectEnum[PeriodSelectEnum.Custom].toLowerCase();
4364
+ const key3M = PeriodSelectEnum[PeriodSelectEnum.Last3Months].toLowerCase();
4363
4365
  this.translationsMap = {
4364
4366
  [PeriodSelectEnum.Last24Hours]: this.translationsObject?.translatedSelectOptions[key24H] || 'Últimas 24 horas',
4365
4367
  [PeriodSelectEnum.Custom]: this.translationsObject?.translatedSelectOptions[keyCustom] || 'Personalizado',
4368
+ [PeriodSelectEnum.Last3Months]: this.translationsObject?.translatedSelectOptions[key3M] || 'Últimos 3 meses',
4366
4369
  };
4367
4370
  this.periodCategories = Object.entries(this.translationsMap).map(([key, value]) => ({
4368
4371
  value: Number(key),
@@ -4396,10 +4399,15 @@ class WPeriodSelectFieldComponent {
4396
4399
  onPeriodCategorySelected() {
4397
4400
  const now = new Date();
4398
4401
  const last24 = new Date(now.getTime() - 24 * 60 * 60 * 1000);
4402
+ const last3Months = new Date(now.setMonth(new Date().getMonth() - 3));
4399
4403
  if (this.periodCategorySelected === PeriodSelectEnum.Last24Hours) {
4400
4404
  this.fromDateValue = last24;
4401
4405
  this.toDateValue = now;
4402
4406
  }
4407
+ else if (this.periodCategorySelected === PeriodSelectEnum.Last3Months) {
4408
+ this.fromDateValue = last3Months;
4409
+ this.toDateValue = now;
4410
+ }
4403
4411
  else {
4404
4412
  const startYesterday = new Date(now);
4405
4413
  startYesterday.setDate(now.getDate() - 1);
@@ -5560,7 +5568,7 @@ class WFilterPanelComponent {
5560
5568
  this.setNoFiltersQueryType(queries).then((resQueries) => {
5561
5569
  if (resQueries.type != 0) {
5562
5570
  this.nullableFilterOperationHandle(queries.basic ? queries.basic : queries.advanced);
5563
- this.setLast24HoursPeriodSelectValue(queries.basic ? queries.basic : queries.advanced);
5571
+ this.setPeriodSelectValue(queries.basic ? queries.basic : queries.advanced);
5564
5572
  }
5565
5573
  }).then((resQueries) => {
5566
5574
  let storedQuery = {
@@ -5643,10 +5651,10 @@ class WFilterPanelComponent {
5643
5651
  }
5644
5652
  }
5645
5653
  }
5646
- setLast24HoursPeriodSelectValue(query) {
5654
+ setPeriodSelectValue(query) {
5647
5655
  if ("rules" in query) {
5648
5656
  query.rules.forEach((rule) => {
5649
- this.setLast24HoursPeriodSelectValue(rule);
5657
+ this.setPeriodSelectValue(rule);
5650
5658
  });
5651
5659
  }
5652
5660
  else {
@@ -5654,6 +5662,10 @@ class WFilterPanelComponent {
5654
5662
  query.value.toDate = new Date();
5655
5663
  query.value.fromDate = new Date(new Date().getTime() - 24 * 60 * 60 * 1000);
5656
5664
  }
5665
+ if (query.field === 'periodSelect' && query.value.periodType === PeriodSelectEnum.Last3Months) {
5666
+ query.value.toDate = new Date();
5667
+ query.value.fromDate = new Date(new Date().setMonth(new Date().getMonth() - 3));
5668
+ }
5657
5669
  }
5658
5670
  }
5659
5671
  inverseNullableFilterOperationHandle(query) {
@@ -5939,6 +5951,19 @@ class WFilterPanelComponent {
5939
5951
  toDate: now
5940
5952
  };
5941
5953
  }
5954
+ if (value == 'PeriodSelectLast3Months') {
5955
+ const now = new Date();
5956
+ let tenantId = this.localStorage.getTenant().tenantId;
5957
+ let ticketsPeriodSelectTypeValue = this.sessionStorage.getTenantPeriodSelectType(tenantId, ticketsPeriodSelectType);
5958
+ if (!ticketsPeriodSelectTypeValue) {
5959
+ this.sessionStorage.setTenantPeriodSelectType(tenantId, ticketsPeriodSelectType, PeriodSelectEnum.Last3Months);
5960
+ }
5961
+ return {
5962
+ periodType: PeriodSelectEnum.Last3Months,
5963
+ fromDate: new Date(now.setMonth(new Date().getMonth() - 3)),
5964
+ toDate: now
5965
+ };
5966
+ }
5942
5967
  return value;
5943
5968
  }
5944
5969
  initQueryBuilder(filterEntities, isBasic) {
@@ -6054,7 +6079,7 @@ class WFilterPanelComponent {
6054
6079
  if (type == this.qbDataTypeEnum.BooleanSelect) {
6055
6080
  return 1;
6056
6081
  }
6057
- if (type == this.qbDataTypeEnum.Multiselect) {
6082
+ if (type == this.qbDataTypeEnum.Multiselect && typeof value === 'string') {
6058
6083
  return this.parseStringToNumberArray(value);
6059
6084
  }
6060
6085
  if (type == this.qbDataTypeEnum.TranslatedSelect) {