@senior-gestao-pessoas/hcm-advanced-filter-general 4.0.3 → 4.1.0

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.
@@ -1457,6 +1457,7 @@
1457
1457
  this.structureFilterService = structureFilterService;
1458
1458
  this.locationService = locationService;
1459
1459
  this.advancedFilterEvent = new core.EventEmitter();
1460
+ this.loadFilterFieldsOnInit = true;
1460
1461
  this.ngUnsubscribe = new rxjs.Subject();
1461
1462
  this.visibleSidebar = false;
1462
1463
  this.filterFields = [];
@@ -1532,7 +1533,6 @@
1532
1533
  },
1533
1534
  ];
1534
1535
  this.KEY_STORAGE = "AdvancedFilterComponent";
1535
- this.getAdvancedFilterByLocalStorage();
1536
1536
  this.getActions();
1537
1537
  }
1538
1538
  AdvancedFilterComponent.prototype.getFormGroup = function () {
@@ -1556,6 +1556,7 @@
1556
1556
  this.formGroup = this.getFormGroup();
1557
1557
  this.advancedFilterSearchFields = this.getAdvancedFilterFields();
1558
1558
  this.advancedFilterSearchGridFields = this.getAdvancedFilterFields();
1559
+ this.getAdvancedFilterByLocalStorage();
1559
1560
  this.localeService.get().subscribe(function (localeOptions) { return _this.localeOptions = localeOptions; });
1560
1561
  this.advancedFilterService.getClearAdvancedFilter()
1561
1562
  .pipe(operators.takeUntil(this.ngUnsubscribe))
@@ -1566,14 +1567,16 @@
1566
1567
  });
1567
1568
  };
1568
1569
  AdvancedFilterComponent.prototype.getAdvancedFilterByLocalStorage = function () {
1570
+ var _a;
1569
1571
  return __awaiter(this, void 0, void 0, function () {
1570
1572
  var advancedFilter;
1571
- return __generator(this, function (_a) {
1572
- switch (_a.label) {
1573
+ return __generator(this, function (_b) {
1574
+ switch (_b.label) {
1573
1575
  case 0: return [4 /*yield*/, this.filtersStorageService.getFilters(this.KEY_STORAGE)];
1574
1576
  case 1:
1575
- advancedFilter = _a.sent();
1576
- if (advancedFilter === null || advancedFilter === void 0 ? void 0 : advancedFilter.id) {
1577
+ advancedFilter = _b.sent();
1578
+ (_a = this.formGroup) === null || _a === void 0 ? void 0 : _a.get("advancedFilter").setValue(advancedFilter.advancedFilter);
1579
+ if ((advancedFilter === null || advancedFilter === void 0 ? void 0 : advancedFilter.id) && this.loadFilterFieldsOnInit) {
1577
1580
  this.onSelectLookup(advancedFilter);
1578
1581
  }
1579
1582
  return [2 /*return*/];
@@ -1616,9 +1619,8 @@
1616
1619
  }
1617
1620
  };
1618
1621
  AdvancedFilterComponent.prototype.validateOnlyAdvancedFilterComponent = function () {
1619
- var _a, _b, _c;
1620
- return (!((_a = this.formGroup.get("advancedFilterFields")) === null || _a === void 0 ? void 0 : _a.valid) || !((_b = this.formGroup.get("name")) === null || _b === void 0 ? void 0 : _b.value))
1621
- && !((_c = this.formGroup) === null || _c === void 0 ? void 0 : _c.valid);
1622
+ var _a, _b;
1623
+ return (!((_a = this.formGroup.get("advancedFilterFields")) === null || _a === void 0 ? void 0 : _a.valid) || !((_b = this.formGroup.get("name")) === null || _b === void 0 ? void 0 : _b.value));
1622
1624
  };
1623
1625
  AdvancedFilterComponent.prototype.onSave = function () {
1624
1626
  var _this = this;
@@ -1987,12 +1989,11 @@
1987
1989
  }
1988
1990
  };
1989
1991
  AdvancedFilterComponent.prototype.isRequired = function () {
1990
- var _a;
1991
- var control = this.parentFormGroup.get(this.advancedFilterControlName);
1992
- if (!control || !control.validator) {
1993
- return false;
1994
- }
1995
- return !!((_a = control.validator({})) === null || _a === void 0 ? void 0 : _a.required);
1992
+ var _a, _b;
1993
+ var control = this.advancedFilterControlName
1994
+ ? this.parentFormGroup.get(this.advancedFilterControlName)
1995
+ : null;
1996
+ return !!((_b = (_a = control === null || control === void 0 ? void 0 : control.validator) === null || _a === void 0 ? void 0 : _a.call(control, {})) === null || _b === void 0 ? void 0 : _b.required);
1996
1997
  };
1997
1998
  /**
1998
1999
  * Search methods by company filter
@@ -2242,6 +2243,9 @@
2242
2243
  __decorate([
2243
2244
  core.Input()
2244
2245
  ], AdvancedFilterComponent.prototype, "parentFormGroup", void 0);
2246
+ __decorate([
2247
+ core.Input()
2248
+ ], AdvancedFilterComponent.prototype, "loadFilterFieldsOnInit", void 0);
2245
2249
  AdvancedFilterComponent = __decorate([
2246
2250
  core.Component({
2247
2251
  selector: "fnd-advanced-filter",
@@ -2331,6 +2335,7 @@
2331
2335
  this.tokens = [];
2332
2336
  this.KEY_STORAGE = "AdvancedFilterComponent";
2333
2337
  this.filterTypeChanged = new core.EventEmitter();
2338
+ this.loadFilterFieldsOnInit = true;
2334
2339
  }
2335
2340
  Object.defineProperty(FilterContainerComponent.prototype, "searchTokens", {
2336
2341
  set: function (tokens) {
@@ -2425,6 +2430,7 @@
2425
2430
  advancedFilter = _a.sent();
2426
2431
  if (this.isAdvancedFilterPresent(advancedFilter)) {
2427
2432
  this.advancedFilterIsPresentInCache = true;
2433
+ this.onEventAdvancedFilter(advancedFilter);
2428
2434
  }
2429
2435
  return [2 /*return*/];
2430
2436
  }
@@ -2531,10 +2537,13 @@
2531
2537
  __decorate([
2532
2538
  core.Input()
2533
2539
  ], FilterContainerComponent.prototype, "searchTokens", null);
2540
+ __decorate([
2541
+ core.Input()
2542
+ ], FilterContainerComponent.prototype, "loadFilterFieldsOnInit", void 0);
2534
2543
  FilterContainerComponent = __decorate([
2535
2544
  core.Component({
2536
2545
  selector: "fnd-filter-container",
2537
- template: "<div class=\"ui-fluid\">\n <div class=\"ui-g\">\n <div class=\"ui-g-3 ui-sm-12 select-button-container\" [ngClass]=\"{'list-container': filterType === 'LIST'}\">\n <div class=\"select-button-child\">\n <p-selectButton #selectButton id=\"select-button\" [options]=\"filterOptions\" optionLabel=\"label\"\n [(ngModel)]=\"selectedFilter\" optionValue=\"value\" (onOptionClick)=\"onSwitchSelectButton()\">\n </p-selectButton>\n </div>\n </div>\n <div class=\"ui-g-12 ui-md-12 required\" [ngSwitch]=\"selectedFilterType\">\n <div *ngSwitchCase=\"'BASIC_FILTER'\">\n <ng-content></ng-content>\n </div>\n <div *ngSwitchCase=\"'ADVANCED_FILTER'\">\n <div class=\"ui-g-12 ui-md-6\">\n <fnd-advanced-filter\n [parentFormGroup]=\"formGroup\"\n (advancedFilterEvent)=\"onEventAdvancedFilter($event)\"\n [advancedFilterControlName]=\"filterControls.ADVANCED_FILTER[0]\">\n </fnd-advanced-filter>\n </div>\n </div>\n </div>\n </div>\n</div>\n",
2546
+ template: "<div class=\"ui-fluid\">\n <div class=\"ui-g\">\n <div class=\"ui-g-3 ui-sm-12 select-button-container\" [ngClass]=\"{'list-container': filterType === 'LIST'}\">\n <div class=\"select-button-child\">\n <p-selectButton #selectButton id=\"select-button\" [options]=\"filterOptions\" optionLabel=\"label\"\n [(ngModel)]=\"selectedFilter\" optionValue=\"value\" (onOptionClick)=\"onSwitchSelectButton()\">\n </p-selectButton>\n </div>\n </div>\n <div class=\"ui-g-12 ui-md-12 required\" [ngSwitch]=\"selectedFilterType\">\n <div *ngSwitchCase=\"'BASIC_FILTER'\">\n <ng-content></ng-content>\n </div>\n <div *ngSwitchCase=\"'ADVANCED_FILTER'\">\n <div class=\"ui-g-12 ui-md-6\">\n <fnd-advanced-filter\n [parentFormGroup]=\"formGroup\"\n (advancedFilterEvent)=\"onEventAdvancedFilter($event)\"\n [advancedFilterControlName]=\"filterControls.ADVANCED_FILTER[0]\"\n [loadFilterFieldsOnInit]=\"loadFilterFieldsOnInit\">\n </fnd-advanced-filter>\n </div>\n </div>\n </div>\n </div>\n</div>\n",
2538
2547
  styles: ["::ng-deep .ui-selectbutton.ui-buttonset .ui-button.ui-state-active{background:#428bca!important;color:#fff!important}@media (min-width:640px) and (max-width:1130px){.select-button-container{width:50%}}.list-container{margin-top:.5%}"]
2539
2548
  })
2540
2549
  ], FilterContainerComponent);