@wizishop/angular-components 0.0.99 → 0.0.100

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.
@@ -698,6 +698,8 @@
698
698
  currentPage: 0
699
699
  };
700
700
  var filterGroup = this.filterRoutingBuilder.group(dataTableFilters, dataTableName);
701
+ filterGroup.tableFiltersValuesChange$ = new rxjs.ReplaySubject(1);
702
+ filterGroup.tableFiltersValuesDebouncedChange$ = filterGroup.tableFiltersValuesChange$.pipe(operators.debounceTime(300));
701
703
  this.filterGroups.set(dataTableName, filterGroup);
702
704
  return filterGroup;
703
705
  };
@@ -720,6 +722,9 @@
720
722
  currentPage: currentPage
721
723
  });
722
724
  };
725
+ /*
726
+ Add defaults filters in the URL if they not exists.
727
+ */
723
728
  FiltersTableService.prototype.setInitialPaginationFiltersIfNotExist = function (dataTableName, itemsPerPage, currentPage) {
724
729
  var filterGroup = this.getTableFilterGroup(dataTableName);
725
730
  filterGroup.setValues({
@@ -762,12 +767,11 @@
762
767
  this.headerCheckBoxId = uuid.v4(); // Create checkbox unique id
763
768
  /* Handle routing filters */
764
769
  if (this.tableRoutingName) {
765
- this._filterGroup = this.filtersTableService.getTableFilterGroup(this.tableRoutingName);
766
- // Performe initial fetch data
767
- this._filterGroup.valuesChange$.next([]);
770
+ this.filtersTableService.setInitialPaginationFiltersIfNotExist(this.tableRoutingName, this.tableFilters.itemsPerPage, this.tableFilters.currentPage);
771
+ this._tableFiltersGroup = this.filtersTableService.getTableFilterGroup(this.tableRoutingName);
768
772
  this.setTablesFilters();
769
773
  // Listen to filters changes with debounced time to limit multiple api calls
770
- this.filterGroupChangeSub = this._filterGroup.valuesChange$.subscribe(function (filters) {
774
+ this.filterGroupChangeSub = this._tableFiltersGroup.valuesChange$.subscribe(function (filters) {
771
775
  _this.setTablesFilters();
772
776
  });
773
777
  }
@@ -782,8 +786,8 @@
782
786
  this.tableFilters.currentPage = 1;
783
787
  this.tableFiltersChange.emit(this.tableFilters);
784
788
  // Reset routing filters
785
- if (this._filterGroup) {
786
- this._filterGroup.setValues({
789
+ if (this._tableFiltersGroup) {
790
+ this._tableFiltersGroup.setValues({
787
791
  searchValue: this.tableFilters.searchValue,
788
792
  sort: undefined,
789
793
  order: undefined,
@@ -793,8 +797,8 @@
793
797
  };
794
798
  TableComponent.prototype.pageChange = function () {
795
799
  this.tableFiltersChange.emit(this.tableFilters);
796
- if (this._filterGroup) {
797
- this._filterGroup.setValues({
800
+ if (this._tableFiltersGroup) {
801
+ this._tableFiltersGroup.setValues({
798
802
  itemsPerPage: this.tableFilters.itemsPerPage,
799
803
  currentPage: this.tableFilters.currentPage
800
804
  });
@@ -805,14 +809,15 @@
805
809
  * */
806
810
  TableComponent.prototype.setTablesFilters = function () {
807
811
  this.tableFilters = {
808
- sort: this._filterGroup.get('sort'),
809
- order: this._filterGroup.get('order'),
810
- searchValue: this._filterGroup.get('searchValue'),
811
- itemsPerPage: this._filterGroup.get('itemsPerPage') ? parseInt(this._filterGroup.get('itemsPerPage')) : 0,
812
- currentPage: this._filterGroup.get('currentPage') ? parseInt(this._filterGroup.get('currentPage')) : 0,
812
+ sort: this._tableFiltersGroup.get('sort'),
813
+ order: this._tableFiltersGroup.get('order'),
814
+ searchValue: this._tableFiltersGroup.get('searchValue'),
815
+ itemsPerPage: this._tableFiltersGroup.get('itemsPerPage') ? parseInt(this._tableFiltersGroup.get('itemsPerPage')) : 0,
816
+ currentPage: this._tableFiltersGroup.get('currentPage') ? parseInt(this._tableFiltersGroup.get('currentPage')) : 0,
813
817
  totalItems: this.tableFilters.totalItems
814
818
  };
815
819
  this.tableFiltersChange.emit(this.tableFilters);
820
+ this._tableFiltersGroup.tableFiltersValuesChange$.next(this.tableFilters);
816
821
  };
817
822
  TableComponent.prototype.ngDestroy = function () {
818
823
  if (this.filterGroupChangeSub) {
@@ -4041,6 +4046,14 @@
4041
4046
  },] }
4042
4047
  ];
4043
4048
 
4049
+ var TableFiltersGroup = /** @class */ (function (_super) {
4050
+ __extends(TableFiltersGroup, _super);
4051
+ function TableFiltersGroup() {
4052
+ return _super !== null && _super.apply(this, arguments) || this;
4053
+ }
4054
+ return TableFiltersGroup;
4055
+ }(i1$1.NwbFilterGroup));
4056
+
4044
4057
  /*
4045
4058
  * Public API Surface of angular-components
4046
4059
  */
@@ -4107,6 +4120,7 @@
4107
4120
  exports.TableColumn = TableColumn;
4108
4121
  exports.TableColumnHeader = TableColumnHeader;
4109
4122
  exports.TableComponent = TableComponent;
4123
+ exports.TableFiltersGroup = TableFiltersGroup;
4110
4124
  exports.TableRow = TableRow;
4111
4125
  exports.TagComponent = TagComponent;
4112
4126
  exports.TextAreaComponent = TextAreaComponent;