@firestitch/list 9.11.1 → 9.11.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.
@@ -4,7 +4,7 @@ import { ChangeFn, FilterConfig, IFilterSavedFiltersConfig } from '@firestitch/f
4
4
  import { FsScrollInstance, FsScrollService } from '@firestitch/scroll';
5
5
  import { SelectionDialog } from '@firestitch/selection';
6
6
  import { Model } from 'tsmodels';
7
- import { BehaviorSubject, Subject } from 'rxjs';
7
+ import { BehaviorSubject, Observable, Subject } from 'rxjs';
8
8
  import { FsListAfterFetchFn, FsListConfig, FsListEmptyStateConfig, FsListFetchFn, FsListFetchSubscription, FsListNoResultsConfig, FsListRestoreConfig, FsListScrollableConfig, FsListTrackByFn } from '../interfaces';
9
9
  import { ColumnsController } from './columns-controller';
10
10
  import { ActionsController } from './index';
@@ -45,7 +45,6 @@ export declare class List extends Model {
45
45
  afterFetchFn: FsListAfterFetchFn;
46
46
  initialized$: BehaviorSubject<boolean>;
47
47
  loading$: BehaviorSubject<boolean>;
48
- filtersQuery: any;
49
48
  hasRowActions: any;
50
49
  paging: PaginationController;
51
50
  columns: ColumnsController;
@@ -68,6 +67,7 @@ export declare class List extends Model {
68
67
  emptyStateTemplate: TemplateRef<any>;
69
68
  fsScrollInstance: FsScrollInstance;
70
69
  onDestroy$: Subject<unknown>;
70
+ private readonly _filtersQuery;
71
71
  private readonly _headerConfig;
72
72
  private readonly _groupCellConfig;
73
73
  private readonly _cellConfig;
@@ -75,6 +75,8 @@ export declare class List extends Model {
75
75
  private _fsScrollSubscription;
76
76
  constructor(el: ElementRef, config: FsListConfig, fsScroll: FsScrollService, selectionDialog: SelectionDialog, router: Router, route: ActivatedRoute, persistance: PersistanceController, inDialog: boolean);
77
77
  get hasSavedFilters(): boolean;
78
+ get filtersQuery(): Record<string, any>;
79
+ get filtersQuery$(): Observable<Record<string, any>>;
78
80
  fetchRemote(query: any): any;
79
81
  /**
80
82
  * Transform templates for using
@@ -27,6 +27,7 @@ export declare class ReorderController implements OnDestroy {
27
27
  private _enabled$;
28
28
  private _manualReorderActivated$;
29
29
  private _reorderDisabled$;
30
+ private _numberOfActiveFilters;
30
31
  private _destroy$;
31
32
  constructor();
32
33
  get enabled(): boolean;
@@ -53,4 +54,5 @@ export declare class ReorderController implements OnDestroy {
53
54
  * Disable reorder action and update filter actions state
54
55
  */
55
56
  disableReorderAction(): void;
57
+ setNunberOfActiveFilters(activeFilters: number): void;
56
58
  }
@@ -103,6 +103,7 @@ export declare class FsListComponent implements OnInit, OnDestroy {
103
103
  private _subscribeToRemoveRow;
104
104
  private _subscribeToGroupExpandStatusChange;
105
105
  private _waitFirstLoad;
106
+ private _listenFiltersQueryChange;
106
107
  private _configMergeCustomizer;
107
108
  private _restorePersistance;
108
109
  }
@@ -3044,6 +3044,7 @@
3044
3044
  // Empty state
3045
3045
  _this.emptyStateEnabled = false;
3046
3046
  _this.onDestroy$ = new rxjs.Subject();
3047
+ _this._filtersQuery = new rxjs.BehaviorSubject(null);
3047
3048
  _this._fromJSON(config);
3048
3049
  _this.initialize(config);
3049
3050
  _this._headerConfig = new StyleConfig(config.header);
@@ -3065,6 +3066,20 @@
3065
3066
  enumerable: true,
3066
3067
  configurable: true
3067
3068
  });
3069
+ Object.defineProperty(List.prototype, "filtersQuery", {
3070
+ get: function () {
3071
+ return this._filtersQuery.getValue();
3072
+ },
3073
+ enumerable: true,
3074
+ configurable: true
3075
+ });
3076
+ Object.defineProperty(List.prototype, "filtersQuery$", {
3077
+ get: function () {
3078
+ return this._filtersQuery.asObservable();
3079
+ },
3080
+ enumerable: true,
3081
+ configurable: true
3082
+ });
3068
3083
  List.prototype.fetchRemote = function (query) {
3069
3084
  var options = {
3070
3085
  state: this.dataController.operation,
@@ -3528,7 +3543,7 @@
3528
3543
  if (this.filterInitCb) {
3529
3544
  this.filterInitCb(filters);
3530
3545
  }
3531
- this.filtersQuery = filters;
3546
+ this._filtersQuery.next(filters);
3532
3547
  this.checkRestoreFilter();
3533
3548
  };
3534
3549
  /**
@@ -3540,7 +3555,7 @@
3540
3555
  if (this.filterChangeCb) {
3541
3556
  this.filterChangeCb(filterQuery, filterSort);
3542
3557
  }
3543
- this.filtersQuery = filterQuery;
3558
+ this._filtersQuery.next(filterQuery);
3544
3559
  this.restoreMode = false;
3545
3560
  // Restore option
3546
3561
  this.checkRestoreFilter();
@@ -3760,6 +3775,7 @@
3760
3775
  this._enabled$ = new rxjs.BehaviorSubject(false);
3761
3776
  this._manualReorderActivated$ = new rxjs.BehaviorSubject(false);
3762
3777
  this._reorderDisabled$ = new rxjs.BehaviorSubject(false);
3778
+ this._numberOfActiveFilters = 0;
3763
3779
  this._destroy$ = new rxjs.Subject();
3764
3780
  }
3765
3781
  Object.defineProperty(ReorderController.prototype, "enabled", {
@@ -3793,7 +3809,9 @@
3793
3809
  return this._enabled$
3794
3810
  .pipe(operators.map(function (enabled) {
3795
3811
  return enabled && _this.position === exports.ReorderPosition.Left;
3796
- }), operators.distinctUntilChanged(), operators.shareReplay(), operators.takeUntil(this._destroy$));
3812
+ }), operators.map(function () {
3813
+ return _this._numberOfActiveFilters === 0;
3814
+ }), operators.distinctUntilChanged(), operators.shareReplay());
3797
3815
  },
3798
3816
  enumerable: true,
3799
3817
  configurable: true
@@ -3804,7 +3822,9 @@
3804
3822
  return this._enabled$
3805
3823
  .pipe(operators.map(function (enabled) {
3806
3824
  return enabled && _this.position === exports.ReorderPosition.Right;
3807
- }), operators.distinctUntilChanged(), operators.shareReplay(), operators.takeUntil(this._destroy$));
3825
+ }), operators.map(function () {
3826
+ return _this._numberOfActiveFilters === 0;
3827
+ }), operators.distinctUntilChanged(), operators.shareReplay());
3808
3828
  },
3809
3829
  enumerable: true,
3810
3830
  configurable: true
@@ -3927,6 +3947,10 @@
3927
3947
  this._reorderDisabled$.next(true);
3928
3948
  this._actionsController.updateDisabledState();
3929
3949
  };
3950
+ ReorderController.prototype.setNunberOfActiveFilters = function (activeFilters) {
3951
+ this._numberOfActiveFilters = activeFilters;
3952
+ this.enabled = this.enabled;
3953
+ };
3930
3954
  ReorderController = __decorate([
3931
3955
  core.Injectable(),
3932
3956
  __metadata("design:paramtypes", [])
@@ -4453,6 +4477,7 @@
4453
4477
  this._updateCustomizeAction(listConfig.actions);
4454
4478
  this.list = new List(this._el, listConfig, this.fsScroll, this.selectionDialog, this._router, this._route, this._persistance, this._inDialog);
4455
4479
  this._waitFirstLoad();
4480
+ this._listenFiltersQueryChange();
4456
4481
  this.reorderController.initWithConfig(config.reorder, this.list.dataController, this.list.actions);
4457
4482
  if (this.listColumnDirectives) {
4458
4483
  this.list.tranformTemplatesToColumns(this.listColumnDirectives);
@@ -4530,6 +4555,17 @@
4530
4555
  _this.cdRef.markForCheck();
4531
4556
  });
4532
4557
  };
4558
+ FsListComponent.prototype._listenFiltersQueryChange = function () {
4559
+ var _this = this;
4560
+ this.list.filtersQuery$
4561
+ .pipe(operators.takeUntil(this.list.onDestroy$), operators.takeUntil(this._destroy))
4562
+ .subscribe(function (value) {
4563
+ if (value) {
4564
+ var activeFilters = Object.keys(value).length;
4565
+ _this.reorderController.setNunberOfActiveFilters(activeFilters);
4566
+ }
4567
+ });
4568
+ };
4533
4569
  FsListComponent.prototype._configMergeCustomizer = function (objValue, srcValue) {
4534
4570
  if (Array.isArray(objValue)) {
4535
4571
  return objValue;