@firestitch/list 9.10.0 → 9.11.1

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.
Files changed (35) hide show
  1. package/app/classes/list-controller.d.ts +2 -1
  2. package/app/components/body/row/cell/cell.component.d.ts +1 -1
  3. package/app/components/footer/footer-row/footer-cell/footer-cell.component.d.ts +0 -3
  4. package/app/components/footer/footer-row/footer-row.component.d.ts +0 -2
  5. package/app/components/footer/footer.component.d.ts +0 -2
  6. package/app/interfaces/listconfig.interface.d.ts +6 -1
  7. package/app/models/row-action.model.d.ts +3 -1
  8. package/bundles/firestitch-list.umd.js +35 -25
  9. package/bundles/firestitch-list.umd.js.map +1 -1
  10. package/bundles/firestitch-list.umd.min.js +2 -2
  11. package/bundles/firestitch-list.umd.min.js.map +1 -1
  12. package/esm2015/app/classes/list-controller.js +9 -2
  13. package/esm2015/app/components/body/row/actions/actions.component.js +3 -1
  14. package/esm2015/app/components/body/row/cell/cell.component.js +1 -1
  15. package/esm2015/app/components/footer/footer-row/footer-cell/footer-cell.component.js +2 -11
  16. package/esm2015/app/components/footer/footer-row/footer-row.component.js +2 -6
  17. package/esm2015/app/components/footer/footer.component.js +2 -6
  18. package/esm2015/app/components/list/list.component.js +2 -2
  19. package/esm2015/app/interfaces/listconfig.interface.js +1 -1
  20. package/esm2015/app/models/row-action.model.js +22 -5
  21. package/esm5/app/classes/list-controller.js +9 -2
  22. package/esm5/app/components/body/row/actions/actions.component.js +4 -1
  23. package/esm5/app/components/body/row/cell/cell.component.js +1 -1
  24. package/esm5/app/components/footer/footer-row/footer-cell/footer-cell.component.js +2 -11
  25. package/esm5/app/components/footer/footer-row/footer-row.component.js +2 -6
  26. package/esm5/app/components/footer/footer.component.js +2 -6
  27. package/esm5/app/components/list/list.component.js +2 -2
  28. package/esm5/app/interfaces/listconfig.interface.js +1 -1
  29. package/esm5/app/models/row-action.model.js +22 -5
  30. package/fesm2015/firestitch-list.js +34 -25
  31. package/fesm2015/firestitch-list.js.map +1 -1
  32. package/fesm5/firestitch-list.js +35 -25
  33. package/fesm5/firestitch-list.js.map +1 -1
  34. package/firestitch-list.metadata.json +1 -1
  35. package/package.json +5 -5
@@ -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)
@@ -3144,7 +3161,7 @@ var List = /** @class */ (function (_super) {
3144
3161
  var _this = this;
3145
3162
  var fetch$ = this.fetch$.asObservable();
3146
3163
  // Should wait until saved filters not loaded
3147
- if (!!this.filters && !!this.savedFilters) {
3164
+ if (!!this.filters) {
3148
3165
  fetch$ = combineLatest([fetch$, this.filtersReady$])
3149
3166
  .pipe(map(function (_a) {
3150
3167
  var _b = __read(_a, 1), params = _b[0];
@@ -3404,6 +3421,9 @@ var List = /** @class */ (function (_super) {
3404
3421
  if (((_c = this.emptyState) === null || _c === void 0 ? void 0 : _c.validate) && this.emptyStateTemplate) {
3405
3422
  this.emptyStateEnabled = this.emptyState.validate(query, cloneDeep(response.data));
3406
3423
  }
3424
+ if (this.afterFetchFn) {
3425
+ this.afterFetchFn(query, this.dataController.visibleRowsData);
3426
+ }
3407
3427
  this.fetchComplete$.next();
3408
3428
  this.loading$.next(false);
3409
3429
  };
@@ -3523,6 +3543,10 @@ var List = /** @class */ (function (_super) {
3523
3543
  Alias('fetch'),
3524
3544
  __metadata("design:type", Function)
3525
3545
  ], List.prototype, "fetchFn", void 0);
3546
+ __decorate([
3547
+ Alias('afterFetch'),
3548
+ __metadata("design:type", Function)
3549
+ ], List.prototype, "afterFetchFn", void 0);
3526
3550
  return List;
3527
3551
  }(Model));
3528
3552
 
@@ -4372,7 +4396,7 @@ var FsListComponent = /** @class */ (function () {
4372
4396
  FsListComponent = __decorate([
4373
4397
  Component({
4374
4398
  selector: 'fs-list',
4375
- template: "<div class=\"fs-list-container\"\n [ngClass]=\"{ 'has-filter-input': list.filterInput,\n 'has-filters': list.filterConfig?.items.length,\n 'has-heading': list.heading,\n 'has-status': list.status,\n 'has-chips': list.chips,\n 'has-actions': list.actions.hasActions,\n 'first-load': firstLoad,\n 'loading': list.loading$ | async }\">\n <ng-template [ngTemplateOutlet]=\"listContainerContent\"></ng-template>\n</div>\n\n<ng-template #listContainerContent>\n <ng-container *ngIf=\"list.dataController.visibleRows$ | async as listData\">\n <!-- Header -->\n <div class=\"fs-list-header-container\">\n\n <div class=\"fs-list-header\"\n [ngClass]=\"{ 'no-wrap': reorderController.manualReorderActivated$ || !list.filterConfig?.items.length }\">\n <div class=\"heading-container\">\n <h2 class=\"heading\" *ngIf=\"list.heading\">{{list.heading}}</h2>\n <span class=\"subheading\" *ngIf=\"list.subheading\">{{list.subheading}}</span>\n </div>\n <fs-filter\n class=\"fs-list-filter\"\n *ngIf=\"list.filterConfig\"\n [filter]=\"list.filterConfig\"\n [showSortBy]=\"!list.status\"\n [showFilterInput]=\"list.filterInput\"\n (ready)=\"filterReady()\">\n\n <ng-template fsFilterStatusBar>\n <ng-container *ngIf=\"\n list.paging &&\n !(reorderController.manualReorderActivated$ | async) &&\n (!reorderController.enabled || reorderController.status) &&\n ((list.scrollable && list.scrollable.status) || !list.scrollable)\">\n <!-- Status -->\n <fs-list-status\n class=\"fs-list-status\"\n [ngClass]=\"{ 'hidden-mobile': !list.status }\"\n [rows]=\"listData\"\n [sorting]=\"list.sorting\"\n [paging]=\"list.paging\"\n [firstLoad]=\"firstLoad\"\n [scrollable]=\"list.scrollable\">\n </fs-list-status>\n </ng-container>\n </ng-template>\n </fs-filter>\n </div>\n </div>\n\n <!-- Table implementation -->\n <div class=\"fs-list-table-container\">\n <table class=\"fs-list-table\" role=\"grid\" *ngIf=\"!firstLoad && listData.length > 0 && !list.emptyStateEnabled\">\n <thead fs-list-head\n class=\"fs-list-head\"\n role=\"rowgroup\"\n *ngIf=\"list.columns.hasHeader\"\n [ngClass]=\"list.columns.theadClass\"\n [columns]=\"list.columns.visibleColumns\"\n [sorting]=\"list.sorting\"\n [selection]=\"list.selection\"\n [hasRowActions]=\"list.hasRowActions\"\n >\n </thead>\n\n <tbody fs-list-body\n fsListDraggableList\n class=\"fs-list-body\"\n role=\"rowgroup\"\n [class.disabled]=\"!!(reorderController.reorderDisabled$ | async)\"\n [rows]=\"listData\"\n [rowActionsRaw]=\"list.rowActionsRaw\"\n [groupActionsRaw]=\"list.groupActionsRaw\"\n [hasRowActions]=\"list.hasRowActions\"\n [rowEvents]=\"list.rowEvents\"\n [rowClass]=\"list.rowClass\"\n [columns]=\"list.columns.visibleColumns\"\n [restoreMode]=\"list.restoreMode\"\n [selection]=\"list.selection\"\n [rowRemoved]=\"rowRemoved\"\n >\n </tbody>\n\n <tfoot fs-list-footer\n class=\"fs-list-footer\"\n *ngIf=\"list.columns.hasFooter\"\n [columns]=\"list.columns.visibleColumns\"\n [selection]=\"list.selection\"\n [hasRowActions]=\"list.hasRowActions\"\n [rows]=\"list.dataController.visibleRows\">\n </tfoot>\n </table>\n <fs-list-loader\n *ngIf=\"firstLoad\"\n [columns]=\"list.columns.columns\"\n [loaderLines]=\"loaderLines\">\n </fs-list-loader>\n </div>\n\n <fs-list-pagination\n *ngIf=\"paginatorVisible\"\n class=\"fs-list-pagination\"\n [rows]=\"listData\"\n [pagination]=\"list.paging\">\n </fs-list-pagination>\n\n\n <ng-container *ngIf=\"!firstLoad\">\n <div\n *ngIf=\"listData.length === 0\"\n class=\"fs-list-no-results-container\">\n <div\n *ngIf=\"list.noResults?.message && !list.emptyStateEnabled\"\n class=\"fs-list-no-results\">\n {{ list.noResults?.message }}\n </div>\n <ng-container *ngIf=\"list.emptyStateEnabled\">\n <ng-template [ngTemplateOutlet]=\"list.emptyStateTemplate\"></ng-template>\n </ng-container>\n </div>\n </ng-container>\n </ng-container>\n</ng-template>\n\n",
4399
+ template: "<div class=\"fs-list-container\"\r\n [ngClass]=\"{ 'has-filter-input': list.filterInput,\r\n 'has-filters': list.filterConfig?.items.length,\r\n 'has-heading': list.heading,\r\n 'has-status': list.status,\r\n 'has-chips': list.chips,\r\n 'has-actions': list.actions.hasActions,\r\n 'first-load': firstLoad,\r\n 'loading': list.loading$ | async }\">\r\n <ng-template [ngTemplateOutlet]=\"listContainerContent\"></ng-template>\r\n</div>\r\n\r\n<ng-template #listContainerContent>\r\n <ng-container *ngIf=\"list.dataController.visibleRows$ | async as listData\">\r\n <!-- Header -->\r\n <div class=\"fs-list-header-container\">\r\n\r\n <div class=\"fs-list-header\"\r\n [ngClass]=\"{ 'no-wrap': reorderController.manualReorderActivated$ || !list.filterConfig?.items.length }\">\r\n <div class=\"heading-container\">\r\n <h2 class=\"heading\" *ngIf=\"list.heading\">{{list.heading}}</h2>\r\n <span class=\"subheading\" *ngIf=\"list.subheading\">{{list.subheading}}</span>\r\n </div>\r\n <fs-filter\r\n class=\"fs-list-filter\"\r\n *ngIf=\"list.filterConfig\"\r\n [filter]=\"list.filterConfig\"\r\n [showSortBy]=\"!list.status\"\r\n [showFilterInput]=\"list.filterInput\"\r\n (ready)=\"filterReady()\">\r\n\r\n <ng-template fsFilterStatusBar>\r\n <ng-container *ngIf=\"\r\n list.paging &&\r\n !(reorderController.manualReorderActivated$ | async) &&\r\n (!reorderController.enabled || reorderController.status) &&\r\n ((list.scrollable && list.scrollable.status) || !list.scrollable)\">\r\n <!-- Status -->\r\n <fs-list-status\r\n class=\"fs-list-status\"\r\n [ngClass]=\"{ 'hidden-mobile': !list.status }\"\r\n [rows]=\"listData\"\r\n [sorting]=\"list.sorting\"\r\n [paging]=\"list.paging\"\r\n [firstLoad]=\"firstLoad\"\r\n [scrollable]=\"list.scrollable\">\r\n </fs-list-status>\r\n </ng-container>\r\n </ng-template>\r\n </fs-filter>\r\n </div>\r\n </div>\r\n\r\n <!-- Table implementation -->\r\n <div class=\"fs-list-table-container\">\r\n <table class=\"fs-list-table\" role=\"grid\" *ngIf=\"!firstLoad && listData.length > 0 && !list.emptyStateEnabled\">\r\n <thead fs-list-head\r\n class=\"fs-list-head\"\r\n role=\"rowgroup\"\r\n *ngIf=\"list.columns.hasHeader\"\r\n [ngClass]=\"list.columns.theadClass\"\r\n [columns]=\"list.columns.visibleColumns\"\r\n [sorting]=\"list.sorting\"\r\n [selection]=\"list.selection\"\r\n [hasRowActions]=\"list.hasRowActions\"\r\n >\r\n </thead>\r\n\r\n <tbody fs-list-body\r\n fsListDraggableList\r\n class=\"fs-list-body\"\r\n role=\"rowgroup\"\r\n [class.disabled]=\"!!(reorderController.reorderDisabled$ | async)\"\r\n [rows]=\"listData\"\r\n [rowActionsRaw]=\"list.rowActionsRaw\"\r\n [groupActionsRaw]=\"list.groupActionsRaw\"\r\n [hasRowActions]=\"list.hasRowActions\"\r\n [rowEvents]=\"list.rowEvents\"\r\n [rowClass]=\"list.rowClass\"\r\n [columns]=\"list.columns.visibleColumns\"\r\n [restoreMode]=\"list.restoreMode\"\r\n [selection]=\"list.selection\"\r\n [rowRemoved]=\"rowRemoved\"\r\n >\r\n </tbody>\r\n\r\n <tfoot fs-list-footer\r\n class=\"fs-list-footer\"\r\n *ngIf=\"list.columns.hasFooter\"\r\n [columns]=\"list.columns.visibleColumns\"\r\n [selection]=\"list.selection\"\r\n [hasRowActions]=\"list.hasRowActions\">\r\n </tfoot>\r\n </table>\r\n <fs-list-loader\r\n *ngIf=\"firstLoad\"\r\n [columns]=\"list.columns.columns\"\r\n [loaderLines]=\"loaderLines\">\r\n </fs-list-loader>\r\n </div>\r\n\r\n <fs-list-pagination\r\n *ngIf=\"paginatorVisible\"\r\n class=\"fs-list-pagination\"\r\n [rows]=\"listData\"\r\n [pagination]=\"list.paging\">\r\n </fs-list-pagination>\r\n\r\n\r\n <ng-container *ngIf=\"!firstLoad\">\r\n <div \r\n *ngIf=\"listData.length === 0\" \r\n class=\"fs-list-no-results-container\">\r\n <div \r\n *ngIf=\"list.noResults?.message && !list.emptyStateEnabled\"\r\n class=\"fs-list-no-results\">\r\n {{ list.noResults?.message }}\r\n </div>\r\n <ng-container *ngIf=\"list.emptyStateEnabled\">\r\n <ng-template [ngTemplateOutlet]=\"list.emptyStateTemplate\"></ng-template>\r\n </ng-container> \r\n </div>\r\n </ng-container>\r\n </ng-container>\r\n</ng-template>\r\n\r\n",
4376
4400
  changeDetection: ChangeDetectionStrategy.OnPush,
4377
4401
  providers: [
4378
4402
  GroupExpandNotifierService,
@@ -5294,14 +5318,10 @@ var FsFooterComponent = /** @class */ (function () {
5294
5318
  Input(),
5295
5319
  __metadata("design:type", SelectionController)
5296
5320
  ], FsFooterComponent.prototype, "selection", void 0);
5297
- __decorate([
5298
- Input(),
5299
- __metadata("design:type", Array)
5300
- ], FsFooterComponent.prototype, "rows", void 0);
5301
5321
  FsFooterComponent = __decorate([
5302
5322
  Component({
5303
5323
  selector: '[fs-list-footer]',
5304
- template: "<tr fs-list-footer-row\n [columns]=\"columns\"\n [hasRowActions]=\"hasRowActions\"\n [selection]=\"selection\"\n [rows]=\"rows\"\n></tr>\n",
5324
+ template: "<tr fs-list-footer-row\n [columns]=\"columns\"\n [hasRowActions]=\"hasRowActions\"\n [selection]=\"selection\"\n></tr>\n",
5305
5325
  changeDetection: ChangeDetectionStrategy.OnPush
5306
5326
  }),
5307
5327
  __metadata("design:paramtypes", [])
@@ -5327,14 +5347,10 @@ var FsFooterRowComponent = /** @class */ (function (_super) {
5327
5347
  Input(),
5328
5348
  __metadata("design:type", Boolean)
5329
5349
  ], FsFooterRowComponent.prototype, "hasRowActions", void 0);
5330
- __decorate([
5331
- Input(),
5332
- __metadata("design:type", Array)
5333
- ], FsFooterRowComponent.prototype, "rows", void 0);
5334
5350
  FsFooterRowComponent = __decorate([
5335
5351
  Component({
5336
5352
  selector: '[fs-list-footer-row]',
5337
- template: "<td *ngIf=\"reorderController.leftReorderActivated$ | async\" class=\"fs-list-col drag-col\"></td>\n\n<td *ngIf=\"selection\" class=\"fs-list-col fs-list-col-selection\"></td>\n<ng-container *ngFor=\"let column of columns; trackBy: trackByFn\">\n <td fs-list-footer-cell\n *ngIf=\"!column.footerColspanned\"\n [column]=\"column\"\n [rows]=\"rows\"\n [ngClass]=\"column.footerConfigs.classesArray\"\n [attr.colspan]=\"column.footerConfigs.colspan\"\n [attr.width]=\"column.width\">\n </td>\n</ng-container>\n\n<!-- Drag -->\n<td *ngIf=\"reorderController.rightReorderActivated$ | async\" class=\"fs-list-col row-actions\"></td>\n\n<!-- Row Actions -->\n<td *ngIf=\"hasRowActions && !(reorderController.enabled && reorderController.strategy === ReorderStrategy.Manual)\" class=\"fs-list-col drag-col\"></td>\n",
5353
+ template: "<td *ngIf=\"reorderController.leftReorderActivated$ | async\" class=\"fs-list-col drag-col\"></td>\n\n<td *ngIf=\"selection\" class=\"fs-list-col fs-list-col-selection\"></td>\n<ng-container *ngFor=\"let column of columns; trackBy: trackByFn\">\n <td fs-list-footer-cell\n *ngIf=\"!column.footerColspanned\"\n [column]=\"column\"\n [row]=\"row\"\n [rowIndex]=\"rowIndex\"\n [ngClass]=\"column.footerConfigs.classesArray\"\n [attr.colspan]=\"column.footerConfigs.colspan\"\n [attr.width]=\"column.width\">\n </td>\n</ng-container>\n\n<!-- Drag -->\n<td *ngIf=\"reorderController.rightReorderActivated$ | async\" class=\"fs-list-col row-actions\"></td>\n\n<!-- Row Actions -->\n<td *ngIf=\"hasRowActions && !(reorderController.enabled && reorderController.strategy === ReorderStrategy.Manual)\" class=\"fs-list-col drag-col\"></td>\n",
5338
5354
  changeDetection: ChangeDetectionStrategy.OnPush
5339
5355
  }),
5340
5356
  __metadata("design:paramtypes", [ElementRef,
@@ -5351,15 +5367,6 @@ var FsFooterCellComponent = /** @class */ (function (_super) {
5351
5367
  function FsFooterCellComponent() {
5352
5368
  return _super.call(this) || this;
5353
5369
  }
5354
- FsFooterCellComponent.prototype._initCellContext = function () {
5355
- this.cellContext.column = this.column;
5356
- this.cellContext.$implicit = this.rows
5357
- .map(function (row) { return row.data; });
5358
- };
5359
- __decorate([
5360
- Input(),
5361
- __metadata("design:type", Array)
5362
- ], FsFooterCellComponent.prototype, "rows", void 0);
5363
5370
  FsFooterCellComponent = __decorate([
5364
5371
  Component({
5365
5372
  selector: '[fs-list-footer-cell]',
@@ -5564,7 +5571,10 @@ var FsRowActionsComponent = /** @class */ (function () {
5564
5571
  return index;
5565
5572
  };
5566
5573
  FsRowActionsComponent.prototype.clickOnTrigger = function (event) {
5574
+ var _this = this;
5567
5575
  event.stopPropagation();
5576
+ this.rowActions
5577
+ .forEach(function (action) { return action.updateLabel(_this.row.data); });
5568
5578
  };
5569
5579
  /**
5570
5580
  * Emit that some row must be removed