@rxap/material-table-system 13.0.0 → 13.0.2

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.
@@ -3,7 +3,7 @@ import { TemplateRef, Directive, Inject, Injectable, ViewContainerRef, Component
3
3
  import { __decorate, __metadata } from 'tslib';
4
4
  import * as i1 from '@angular/cdk/portal';
5
5
  import { TemplatePortal, PortalModule } from '@angular/cdk/portal';
6
- import { Required, equals, coerceBoolean, coerceArray } from '@rxap/utilities';
6
+ import { Required, clone, DeleteEmptyProperties, equals, coerceBoolean, coerceArray } from '@rxap/utilities';
7
7
  import { trigger, state, style, transition, animate, sequence } from '@angular/animations';
8
8
  import { BehaviorSubject, EMPTY, ReplaySubject, Subscription, Subject, isObservable, of } from 'rxjs';
9
9
  import { map, filter, tap, distinctUntilChanged, debounceTime, delay, startWith } from 'rxjs/operators';
@@ -496,12 +496,23 @@ class TableFilterService {
496
496
  constructor() {
497
497
  this.change = new ReplaySubject(1);
498
498
  this.current = {};
499
+ /**
500
+ * a flag to indicate whether any value was already send to the change subject
501
+ * true - a value was send
502
+ * false - no value was send
503
+ * @private
504
+ */
505
+ this._init = false;
499
506
  this._subscription = this.change.subscribe(current => this.current = current);
500
507
  }
501
508
  setMap(map) {
502
509
  const current = this.current;
503
- const next = Object.assign(current, map);
504
- this.change.next(next);
510
+ const copy = clone(this.current);
511
+ const next = DeleteEmptyProperties(Object.assign(current, map));
512
+ if (!this._init || !equals(copy, next)) {
513
+ this._init = true;
514
+ this.change.next(next);
515
+ }
505
516
  }
506
517
  set(key, value) {
507
518
  const current = this.current;
@@ -746,9 +757,7 @@ class FilterHeaderRowDirective extends FormDirective {
746
757
  ngOnInit() {
747
758
  super.ngOnInit();
748
759
  this._subscription = this.form.value$
749
- .pipe(debounceTime(1000), map((values) => Object.entries(values)
750
- .filter(([key, value]) => value !== null && value !== undefined && value !== '')
751
- .reduce((obj, [key, value]) => ({ ...obj, [key]: value }), {})), distinctUntilChanged((a, b) => equals(a, b)), tap(values => this.tableFilter.setMap(values)))
760
+ .pipe(debounceTime(1000), distinctUntilChanged((a, b) => equals(a, b)), tap(values => this.tableFilter.setMap(values)))
752
761
  .subscribe();
753
762
  }
754
763
  ngOnDestroy() {