@firestitch/list 9.10.2 → 9.11.3
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.
- package/app/classes/list-controller.d.ts +4 -2
- package/app/classes/reorder-controller.d.ts +2 -0
- package/app/components/list/list.component.d.ts +1 -0
- package/app/interfaces/listconfig.interface.d.ts +4 -1
- package/app/models/row-action.model.d.ts +3 -1
- package/bundles/firestitch-list.umd.js +65 -9
- package/bundles/firestitch-list.umd.js.map +1 -1
- package/bundles/firestitch-list.umd.min.js +2 -2
- package/bundles/firestitch-list.umd.min.js.map +1 -1
- package/esm2015/app/classes/list-controller.js +11 -4
- package/esm2015/app/classes/reorder-controller.js +12 -3
- package/esm2015/app/components/body/row/actions/actions.component.js +3 -1
- package/esm2015/app/components/list/list.component.js +12 -1
- package/esm2015/app/interfaces/listconfig.interface.js +1 -1
- package/esm2015/app/models/row-action.model.js +22 -5
- package/esm5/app/classes/list-controller.js +19 -4
- package/esm5/app/classes/reorder-controller.js +12 -3
- package/esm5/app/components/body/row/actions/actions.component.js +4 -1
- package/esm5/app/components/list/list.component.js +13 -1
- package/esm5/app/interfaces/listconfig.interface.js +1 -1
- package/esm5/app/models/row-action.model.js +22 -5
- package/fesm2015/firestitch-list.js +55 -9
- package/fesm2015/firestitch-list.js.map +1 -1
- package/fesm5/firestitch-list.js +65 -9
- package/fesm5/firestitch-list.js.map +1 -1
- package/firestitch-list.metadata.json +1 -1
- package/package.json +5 -5
|
@@ -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
|
}
|
|
@@ -143,7 +143,7 @@ export interface FsListRowActionGroup {
|
|
|
143
143
|
rowActions: FsListRowAction[];
|
|
144
144
|
}
|
|
145
145
|
export interface FsListRowAction {
|
|
146
|
-
label?: string;
|
|
146
|
+
label?: string | FsListRowActionLabelFn;
|
|
147
147
|
type?: ActionType;
|
|
148
148
|
className?: string;
|
|
149
149
|
icon?: string;
|
|
@@ -160,6 +160,9 @@ export interface FsListRowAction {
|
|
|
160
160
|
export interface FsListRowActionLinkFn {
|
|
161
161
|
(row: FsListAbstractRow): FsListRowActionLink;
|
|
162
162
|
}
|
|
163
|
+
export interface FsListRowActionLabelFn {
|
|
164
|
+
(row: FsListAbstractRow): string;
|
|
165
|
+
}
|
|
163
166
|
export interface FsListRowActionLink {
|
|
164
167
|
link: any[] | string;
|
|
165
168
|
queryParams?: Record<string, any>;
|
|
@@ -3,7 +3,6 @@ import { ActionType } from '../enums/button-type.enum';
|
|
|
3
3
|
import { FsListRowActionLink } from '../interfaces';
|
|
4
4
|
export declare class RowAction extends Model {
|
|
5
5
|
icon: string;
|
|
6
|
-
label: string;
|
|
7
6
|
menu: boolean;
|
|
8
7
|
remove: {
|
|
9
8
|
title: string;
|
|
@@ -14,16 +13,19 @@ export declare class RowAction extends Model {
|
|
|
14
13
|
show: Function;
|
|
15
14
|
restore: boolean;
|
|
16
15
|
rowActions: RowAction[];
|
|
16
|
+
label: string;
|
|
17
17
|
routerLink: FsListRowActionLink;
|
|
18
18
|
classArray: string[];
|
|
19
19
|
isShown: boolean;
|
|
20
20
|
click: Function;
|
|
21
21
|
private _linkFn;
|
|
22
|
+
private _labelFn;
|
|
22
23
|
private readonly _isGroup;
|
|
23
24
|
constructor(config?: any);
|
|
24
25
|
get isGroup(): boolean;
|
|
25
26
|
_fromJSON(value: any): void;
|
|
26
27
|
checkShowStatus(row: any, index: any): void;
|
|
27
28
|
updateLink(row: any): void;
|
|
29
|
+
updateLabel(row: any): void;
|
|
28
30
|
private clickEvent;
|
|
29
31
|
}
|
|
@@ -517,6 +517,7 @@
|
|
|
517
517
|
function RowAction(config) {
|
|
518
518
|
if (config === void 0) { config = {}; }
|
|
519
519
|
var _this = _super.call(this) || this;
|
|
520
|
+
_this.label = '';
|
|
520
521
|
_this.classArray = [];
|
|
521
522
|
_this.isShown = true;
|
|
522
523
|
_this._isGroup = false;
|
|
@@ -549,6 +550,13 @@
|
|
|
549
550
|
return _this.clickEvent(row, event, index, rowActionsRef, clickFn);
|
|
550
551
|
};
|
|
551
552
|
this._linkFn = value.link;
|
|
553
|
+
if (typeof value.label === 'function') {
|
|
554
|
+
this._labelFn = value.label;
|
|
555
|
+
this.label = '';
|
|
556
|
+
}
|
|
557
|
+
else {
|
|
558
|
+
this.label = value.label;
|
|
559
|
+
}
|
|
552
560
|
if (this.className) {
|
|
553
561
|
this.classArray = this.className.split(' ').reduce(function (acc, elem) {
|
|
554
562
|
acc.push(elem);
|
|
@@ -583,6 +591,19 @@
|
|
|
583
591
|
}
|
|
584
592
|
}
|
|
585
593
|
};
|
|
594
|
+
RowAction.prototype.updateLabel = function (row) {
|
|
595
|
+
if (!this.isShown) {
|
|
596
|
+
return;
|
|
597
|
+
}
|
|
598
|
+
if (this.isGroup) {
|
|
599
|
+
this.rowActions.forEach(function (action) {
|
|
600
|
+
action.updateLabel(row);
|
|
601
|
+
});
|
|
602
|
+
}
|
|
603
|
+
else if (this._labelFn) {
|
|
604
|
+
this.label = this._labelFn(row);
|
|
605
|
+
}
|
|
606
|
+
};
|
|
586
607
|
RowAction.prototype.clickEvent = function (row, event, index, rowActionsRef, clickFn) {
|
|
587
608
|
// Stop event propagation for parent
|
|
588
609
|
event.stopPropagation();
|
|
@@ -599,10 +620,6 @@
|
|
|
599
620
|
tsmodels.Alias(),
|
|
600
621
|
__metadata("design:type", String)
|
|
601
622
|
], RowAction.prototype, "icon", void 0);
|
|
602
|
-
__decorate([
|
|
603
|
-
tsmodels.Alias(),
|
|
604
|
-
__metadata("design:type", String)
|
|
605
|
-
], RowAction.prototype, "label", void 0);
|
|
606
623
|
__decorate([
|
|
607
624
|
tsmodels.Alias(),
|
|
608
625
|
__metadata("design:type", Boolean)
|
|
@@ -3027,6 +3044,7 @@
|
|
|
3027
3044
|
// Empty state
|
|
3028
3045
|
_this.emptyStateEnabled = false;
|
|
3029
3046
|
_this.onDestroy$ = new rxjs.Subject();
|
|
3047
|
+
_this._filtersQuery = new rxjs.BehaviorSubject(null);
|
|
3030
3048
|
_this._fromJSON(config);
|
|
3031
3049
|
_this.initialize(config);
|
|
3032
3050
|
_this._headerConfig = new StyleConfig(config.header);
|
|
@@ -3048,6 +3066,20 @@
|
|
|
3048
3066
|
enumerable: true,
|
|
3049
3067
|
configurable: true
|
|
3050
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
|
+
});
|
|
3051
3083
|
List.prototype.fetchRemote = function (query) {
|
|
3052
3084
|
var options = {
|
|
3053
3085
|
state: this.dataController.operation,
|
|
@@ -3338,7 +3370,7 @@
|
|
|
3338
3370
|
var _this = this;
|
|
3339
3371
|
var fetch$ = this.fetch$.asObservable();
|
|
3340
3372
|
// Should wait until saved filters not loaded
|
|
3341
|
-
if (!!this.filters
|
|
3373
|
+
if (!!this.filters) {
|
|
3342
3374
|
fetch$ = rxjs.combineLatest([fetch$, this.filtersReady$])
|
|
3343
3375
|
.pipe(operators.map(function (_a) {
|
|
3344
3376
|
var _b = __read(_a, 1), params = _b[0];
|
|
@@ -3511,7 +3543,7 @@
|
|
|
3511
3543
|
if (this.filterInitCb) {
|
|
3512
3544
|
this.filterInitCb(filters);
|
|
3513
3545
|
}
|
|
3514
|
-
this.
|
|
3546
|
+
this._filtersQuery.next(filters);
|
|
3515
3547
|
this.checkRestoreFilter();
|
|
3516
3548
|
};
|
|
3517
3549
|
/**
|
|
@@ -3523,7 +3555,7 @@
|
|
|
3523
3555
|
if (this.filterChangeCb) {
|
|
3524
3556
|
this.filterChangeCb(filterQuery, filterSort);
|
|
3525
3557
|
}
|
|
3526
|
-
this.
|
|
3558
|
+
this._filtersQuery.next(filterQuery);
|
|
3527
3559
|
this.restoreMode = false;
|
|
3528
3560
|
// Restore option
|
|
3529
3561
|
this.checkRestoreFilter();
|
|
@@ -3743,6 +3775,7 @@
|
|
|
3743
3775
|
this._enabled$ = new rxjs.BehaviorSubject(false);
|
|
3744
3776
|
this._manualReorderActivated$ = new rxjs.BehaviorSubject(false);
|
|
3745
3777
|
this._reorderDisabled$ = new rxjs.BehaviorSubject(false);
|
|
3778
|
+
this._numberOfActiveFilters = 0;
|
|
3746
3779
|
this._destroy$ = new rxjs.Subject();
|
|
3747
3780
|
}
|
|
3748
3781
|
Object.defineProperty(ReorderController.prototype, "enabled", {
|
|
@@ -3776,7 +3809,9 @@
|
|
|
3776
3809
|
return this._enabled$
|
|
3777
3810
|
.pipe(operators.map(function (enabled) {
|
|
3778
3811
|
return enabled && _this.position === exports.ReorderPosition.Left;
|
|
3779
|
-
}), operators.
|
|
3812
|
+
}), operators.map(function (enabled) {
|
|
3813
|
+
return enabled && _this._numberOfActiveFilters === 0;
|
|
3814
|
+
}), operators.distinctUntilChanged(), operators.shareReplay());
|
|
3780
3815
|
},
|
|
3781
3816
|
enumerable: true,
|
|
3782
3817
|
configurable: true
|
|
@@ -3787,7 +3822,9 @@
|
|
|
3787
3822
|
return this._enabled$
|
|
3788
3823
|
.pipe(operators.map(function (enabled) {
|
|
3789
3824
|
return enabled && _this.position === exports.ReorderPosition.Right;
|
|
3790
|
-
}), operators.
|
|
3825
|
+
}), operators.map(function (enabled) {
|
|
3826
|
+
return enabled && _this._numberOfActiveFilters === 0;
|
|
3827
|
+
}), operators.distinctUntilChanged(), operators.shareReplay());
|
|
3791
3828
|
},
|
|
3792
3829
|
enumerable: true,
|
|
3793
3830
|
configurable: true
|
|
@@ -3910,6 +3947,10 @@
|
|
|
3910
3947
|
this._reorderDisabled$.next(true);
|
|
3911
3948
|
this._actionsController.updateDisabledState();
|
|
3912
3949
|
};
|
|
3950
|
+
ReorderController.prototype.setNunberOfActiveFilters = function (activeFilters) {
|
|
3951
|
+
this._numberOfActiveFilters = activeFilters;
|
|
3952
|
+
this.enabled = this.enabled;
|
|
3953
|
+
};
|
|
3913
3954
|
ReorderController = __decorate([
|
|
3914
3955
|
core.Injectable(),
|
|
3915
3956
|
__metadata("design:paramtypes", [])
|
|
@@ -4436,6 +4477,7 @@
|
|
|
4436
4477
|
this._updateCustomizeAction(listConfig.actions);
|
|
4437
4478
|
this.list = new List(this._el, listConfig, this.fsScroll, this.selectionDialog, this._router, this._route, this._persistance, this._inDialog);
|
|
4438
4479
|
this._waitFirstLoad();
|
|
4480
|
+
this._listenFiltersQueryChange();
|
|
4439
4481
|
this.reorderController.initWithConfig(config.reorder, this.list.dataController, this.list.actions);
|
|
4440
4482
|
if (this.listColumnDirectives) {
|
|
4441
4483
|
this.list.tranformTemplatesToColumns(this.listColumnDirectives);
|
|
@@ -4513,6 +4555,17 @@
|
|
|
4513
4555
|
_this.cdRef.markForCheck();
|
|
4514
4556
|
});
|
|
4515
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
|
+
};
|
|
4516
4569
|
FsListComponent.prototype._configMergeCustomizer = function (objValue, srcValue) {
|
|
4517
4570
|
if (Array.isArray(objValue)) {
|
|
4518
4571
|
return objValue;
|
|
@@ -5748,7 +5801,10 @@
|
|
|
5748
5801
|
return index;
|
|
5749
5802
|
};
|
|
5750
5803
|
FsRowActionsComponent.prototype.clickOnTrigger = function (event) {
|
|
5804
|
+
var _this = this;
|
|
5751
5805
|
event.stopPropagation();
|
|
5806
|
+
this.rowActions
|
|
5807
|
+
.forEach(function (action) { return action.updateLabel(_this.row.data); });
|
|
5752
5808
|
};
|
|
5753
5809
|
/**
|
|
5754
5810
|
* Emit that some row must be removed
|