@firestitch/list 9.10.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.
- 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 +68 -10
- 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 +14 -5
- 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 +22 -5
- 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 +58 -10
- package/fesm2015/firestitch-list.js.map +1 -1
- package/fesm5/firestitch-list.js +68 -10
- package/fesm5/firestitch-list.js.map +1 -1
- package/firestitch-list.metadata.json +1 -1
- package/package.json +5 -5
package/fesm5/firestitch-list.js
CHANGED
|
@@ -323,6 +323,7 @@ var RowAction = /** @class */ (function (_super) {
|
|
|
323
323
|
function RowAction(config) {
|
|
324
324
|
if (config === void 0) { config = {}; }
|
|
325
325
|
var _this = _super.call(this) || this;
|
|
326
|
+
_this.label = '';
|
|
326
327
|
_this.classArray = [];
|
|
327
328
|
_this.isShown = true;
|
|
328
329
|
_this._isGroup = false;
|
|
@@ -355,6 +356,13 @@ var RowAction = /** @class */ (function (_super) {
|
|
|
355
356
|
return _this.clickEvent(row, event, index, rowActionsRef, clickFn);
|
|
356
357
|
};
|
|
357
358
|
this._linkFn = value.link;
|
|
359
|
+
if (typeof value.label === 'function') {
|
|
360
|
+
this._labelFn = value.label;
|
|
361
|
+
this.label = '';
|
|
362
|
+
}
|
|
363
|
+
else {
|
|
364
|
+
this.label = value.label;
|
|
365
|
+
}
|
|
358
366
|
if (this.className) {
|
|
359
367
|
this.classArray = this.className.split(' ').reduce(function (acc, elem) {
|
|
360
368
|
acc.push(elem);
|
|
@@ -389,6 +397,19 @@ var RowAction = /** @class */ (function (_super) {
|
|
|
389
397
|
}
|
|
390
398
|
}
|
|
391
399
|
};
|
|
400
|
+
RowAction.prototype.updateLabel = function (row) {
|
|
401
|
+
if (!this.isShown) {
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
if (this.isGroup) {
|
|
405
|
+
this.rowActions.forEach(function (action) {
|
|
406
|
+
action.updateLabel(row);
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
else if (this._labelFn) {
|
|
410
|
+
this.label = this._labelFn(row);
|
|
411
|
+
}
|
|
412
|
+
};
|
|
392
413
|
RowAction.prototype.clickEvent = function (row, event, index, rowActionsRef, clickFn) {
|
|
393
414
|
// Stop event propagation for parent
|
|
394
415
|
event.stopPropagation();
|
|
@@ -405,10 +426,6 @@ var RowAction = /** @class */ (function (_super) {
|
|
|
405
426
|
Alias(),
|
|
406
427
|
__metadata("design:type", String)
|
|
407
428
|
], RowAction.prototype, "icon", void 0);
|
|
408
|
-
__decorate([
|
|
409
|
-
Alias(),
|
|
410
|
-
__metadata("design:type", String)
|
|
411
|
-
], RowAction.prototype, "label", void 0);
|
|
412
429
|
__decorate([
|
|
413
430
|
Alias(),
|
|
414
431
|
__metadata("design:type", Boolean)
|
|
@@ -2833,6 +2850,7 @@ var List = /** @class */ (function (_super) {
|
|
|
2833
2850
|
// Empty state
|
|
2834
2851
|
_this.emptyStateEnabled = false;
|
|
2835
2852
|
_this.onDestroy$ = new Subject();
|
|
2853
|
+
_this._filtersQuery = new BehaviorSubject(null);
|
|
2836
2854
|
_this._fromJSON(config);
|
|
2837
2855
|
_this.initialize(config);
|
|
2838
2856
|
_this._headerConfig = new StyleConfig(config.header);
|
|
@@ -2854,6 +2872,20 @@ var List = /** @class */ (function (_super) {
|
|
|
2854
2872
|
enumerable: true,
|
|
2855
2873
|
configurable: true
|
|
2856
2874
|
});
|
|
2875
|
+
Object.defineProperty(List.prototype, "filtersQuery", {
|
|
2876
|
+
get: function () {
|
|
2877
|
+
return this._filtersQuery.getValue();
|
|
2878
|
+
},
|
|
2879
|
+
enumerable: true,
|
|
2880
|
+
configurable: true
|
|
2881
|
+
});
|
|
2882
|
+
Object.defineProperty(List.prototype, "filtersQuery$", {
|
|
2883
|
+
get: function () {
|
|
2884
|
+
return this._filtersQuery.asObservable();
|
|
2885
|
+
},
|
|
2886
|
+
enumerable: true,
|
|
2887
|
+
configurable: true
|
|
2888
|
+
});
|
|
2857
2889
|
List.prototype.fetchRemote = function (query) {
|
|
2858
2890
|
var options = {
|
|
2859
2891
|
state: this.dataController.operation,
|
|
@@ -3144,7 +3176,7 @@ var List = /** @class */ (function (_super) {
|
|
|
3144
3176
|
var _this = this;
|
|
3145
3177
|
var fetch$ = this.fetch$.asObservable();
|
|
3146
3178
|
// Should wait until saved filters not loaded
|
|
3147
|
-
if (!!this.filters
|
|
3179
|
+
if (!!this.filters) {
|
|
3148
3180
|
fetch$ = combineLatest([fetch$, this.filtersReady$])
|
|
3149
3181
|
.pipe(map(function (_a) {
|
|
3150
3182
|
var _b = __read(_a, 1), params = _b[0];
|
|
@@ -3317,7 +3349,7 @@ var List = /** @class */ (function (_super) {
|
|
|
3317
3349
|
if (this.filterInitCb) {
|
|
3318
3350
|
this.filterInitCb(filters);
|
|
3319
3351
|
}
|
|
3320
|
-
this.
|
|
3352
|
+
this._filtersQuery.next(filters);
|
|
3321
3353
|
this.checkRestoreFilter();
|
|
3322
3354
|
};
|
|
3323
3355
|
/**
|
|
@@ -3329,7 +3361,7 @@ var List = /** @class */ (function (_super) {
|
|
|
3329
3361
|
if (this.filterChangeCb) {
|
|
3330
3362
|
this.filterChangeCb(filterQuery, filterSort);
|
|
3331
3363
|
}
|
|
3332
|
-
this.
|
|
3364
|
+
this._filtersQuery.next(filterQuery);
|
|
3333
3365
|
this.restoreMode = false;
|
|
3334
3366
|
// Restore option
|
|
3335
3367
|
this.checkRestoreFilter();
|
|
@@ -3404,7 +3436,9 @@ var List = /** @class */ (function (_super) {
|
|
|
3404
3436
|
if (((_c = this.emptyState) === null || _c === void 0 ? void 0 : _c.validate) && this.emptyStateTemplate) {
|
|
3405
3437
|
this.emptyStateEnabled = this.emptyState.validate(query, cloneDeep(response.data));
|
|
3406
3438
|
}
|
|
3407
|
-
this.afterFetchFn
|
|
3439
|
+
if (this.afterFetchFn) {
|
|
3440
|
+
this.afterFetchFn(query, this.dataController.visibleRowsData);
|
|
3441
|
+
}
|
|
3408
3442
|
this.fetchComplete$.next();
|
|
3409
3443
|
this.loading$.next(false);
|
|
3410
3444
|
};
|
|
@@ -3547,6 +3581,7 @@ var ReorderController = /** @class */ (function () {
|
|
|
3547
3581
|
this._enabled$ = new BehaviorSubject(false);
|
|
3548
3582
|
this._manualReorderActivated$ = new BehaviorSubject(false);
|
|
3549
3583
|
this._reorderDisabled$ = new BehaviorSubject(false);
|
|
3584
|
+
this._numberOfActiveFilters = 0;
|
|
3550
3585
|
this._destroy$ = new Subject();
|
|
3551
3586
|
}
|
|
3552
3587
|
Object.defineProperty(ReorderController.prototype, "enabled", {
|
|
@@ -3580,7 +3615,9 @@ var ReorderController = /** @class */ (function () {
|
|
|
3580
3615
|
return this._enabled$
|
|
3581
3616
|
.pipe(map(function (enabled) {
|
|
3582
3617
|
return enabled && _this.position === ReorderPosition.Left;
|
|
3583
|
-
}),
|
|
3618
|
+
}), map(function () {
|
|
3619
|
+
return _this._numberOfActiveFilters === 0;
|
|
3620
|
+
}), distinctUntilChanged(), shareReplay());
|
|
3584
3621
|
},
|
|
3585
3622
|
enumerable: true,
|
|
3586
3623
|
configurable: true
|
|
@@ -3591,7 +3628,9 @@ var ReorderController = /** @class */ (function () {
|
|
|
3591
3628
|
return this._enabled$
|
|
3592
3629
|
.pipe(map(function (enabled) {
|
|
3593
3630
|
return enabled && _this.position === ReorderPosition.Right;
|
|
3594
|
-
}),
|
|
3631
|
+
}), map(function () {
|
|
3632
|
+
return _this._numberOfActiveFilters === 0;
|
|
3633
|
+
}), distinctUntilChanged(), shareReplay());
|
|
3595
3634
|
},
|
|
3596
3635
|
enumerable: true,
|
|
3597
3636
|
configurable: true
|
|
@@ -3714,6 +3753,10 @@ var ReorderController = /** @class */ (function () {
|
|
|
3714
3753
|
this._reorderDisabled$.next(true);
|
|
3715
3754
|
this._actionsController.updateDisabledState();
|
|
3716
3755
|
};
|
|
3756
|
+
ReorderController.prototype.setNunberOfActiveFilters = function (activeFilters) {
|
|
3757
|
+
this._numberOfActiveFilters = activeFilters;
|
|
3758
|
+
this.enabled = this.enabled;
|
|
3759
|
+
};
|
|
3717
3760
|
ReorderController = __decorate([
|
|
3718
3761
|
Injectable(),
|
|
3719
3762
|
__metadata("design:paramtypes", [])
|
|
@@ -4240,6 +4283,7 @@ var FsListComponent = /** @class */ (function () {
|
|
|
4240
4283
|
this._updateCustomizeAction(listConfig.actions);
|
|
4241
4284
|
this.list = new List(this._el, listConfig, this.fsScroll, this.selectionDialog, this._router, this._route, this._persistance, this._inDialog);
|
|
4242
4285
|
this._waitFirstLoad();
|
|
4286
|
+
this._listenFiltersQueryChange();
|
|
4243
4287
|
this.reorderController.initWithConfig(config.reorder, this.list.dataController, this.list.actions);
|
|
4244
4288
|
if (this.listColumnDirectives) {
|
|
4245
4289
|
this.list.tranformTemplatesToColumns(this.listColumnDirectives);
|
|
@@ -4317,6 +4361,17 @@ var FsListComponent = /** @class */ (function () {
|
|
|
4317
4361
|
_this.cdRef.markForCheck();
|
|
4318
4362
|
});
|
|
4319
4363
|
};
|
|
4364
|
+
FsListComponent.prototype._listenFiltersQueryChange = function () {
|
|
4365
|
+
var _this = this;
|
|
4366
|
+
this.list.filtersQuery$
|
|
4367
|
+
.pipe(takeUntil(this.list.onDestroy$), takeUntil(this._destroy))
|
|
4368
|
+
.subscribe(function (value) {
|
|
4369
|
+
if (value) {
|
|
4370
|
+
var activeFilters = Object.keys(value).length;
|
|
4371
|
+
_this.reorderController.setNunberOfActiveFilters(activeFilters);
|
|
4372
|
+
}
|
|
4373
|
+
});
|
|
4374
|
+
};
|
|
4320
4375
|
FsListComponent.prototype._configMergeCustomizer = function (objValue, srcValue) {
|
|
4321
4376
|
if (Array.isArray(objValue)) {
|
|
4322
4377
|
return objValue;
|
|
@@ -5552,7 +5607,10 @@ var FsRowActionsComponent = /** @class */ (function () {
|
|
|
5552
5607
|
return index;
|
|
5553
5608
|
};
|
|
5554
5609
|
FsRowActionsComponent.prototype.clickOnTrigger = function (event) {
|
|
5610
|
+
var _this = this;
|
|
5555
5611
|
event.stopPropagation();
|
|
5612
|
+
this.rowActions
|
|
5613
|
+
.forEach(function (action) { return action.updateLabel(_this.row.data); });
|
|
5556
5614
|
};
|
|
5557
5615
|
/**
|
|
5558
5616
|
* Emit that some row must be removed
|