@firestitch/list 12.2.1 → 12.3.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.
@@ -29,26 +29,24 @@ import * as i1$1 from '@firestitch/prompt';
29
29
  import { FsPromptModule } from '@firestitch/prompt';
30
30
  import * as i4$1 from '@firestitch/file';
31
31
  import { FsFileModule } from '@firestitch/file';
32
+ import * as i5$1 from '@firestitch/common';
33
+ import { getNormalizedPath, FsCommonModule } from '@firestitch/common';
32
34
  import { isString, isObject, isBoolean, isNumber, isFunction, get, cloneDeep, random, mergeWith, merge as merge$1 } from 'lodash-es';
33
35
  import { BehaviorSubject, Subject, merge, Observable, from, combineLatest, of } from 'rxjs';
34
36
  import { takeUntil, tap, skip, distinctUntilChanged, take, map, debounceTime, switchMap, mapTo, catchError, shareReplay, filter } from 'rxjs/operators';
35
37
  import * as i3$3 from '@firestitch/selection';
36
- import { getNormalizedPath } from '@firestitch/common';
37
38
  import * as i9 from '@firestitch/drawer';
38
- import { __decorate, __metadata } from 'tslib';
39
- import { Model, Alias } from 'tsmodels';
40
39
  import * as i1 from '@firestitch/store';
41
40
  import { FsPersistanceStore } from '@firestitch/store';
42
41
  import * as i5 from '@angular/flex-layout/extended';
43
42
  import * as i3$2 from '@angular/flex-layout/flex';
44
43
 
45
- class StyleConfig extends Model {
44
+ class StyleConfig {
46
45
  constructor(config = {}) {
47
- super();
48
46
  this.className = []; // Can't be used in tempaltes!
49
47
  this.classesArray = []; // Can be used in tempaltes
50
48
  this.classesString = '';
51
- this._fromJSON(config);
49
+ this._init(config);
52
50
  }
53
51
  /**
54
52
  * Create static array of styles for using in templates
@@ -98,6 +96,11 @@ class StyleConfig extends Model {
98
96
  }
99
97
  this.className = targetValue;
100
98
  }
99
+ _init(config) {
100
+ this.colspan = config.colspan;
101
+ this.align = config.align;
102
+ this.className = config.className;
103
+ }
101
104
  /**
102
105
  * Merge params into array
103
106
  * @param to
@@ -112,18 +115,6 @@ class StyleConfig extends Model {
112
115
  }
113
116
  }
114
117
  }
115
- __decorate([
116
- Alias(),
117
- __metadata("design:type", Object)
118
- ], StyleConfig.prototype, "colspan", void 0);
119
- __decorate([
120
- Alias(),
121
- __metadata("design:type", String)
122
- ], StyleConfig.prototype, "align", void 0);
123
- __decorate([
124
- Alias(),
125
- __metadata("design:type", Object)
126
- ], StyleConfig.prototype, "className", void 0);
127
118
 
128
119
  var SortingDirection;
129
120
  (function (SortingDirection) {
@@ -299,14 +290,13 @@ var ActionType;
299
290
  ActionType["MiniFab"] = "mini-fab";
300
291
  })(ActionType || (ActionType = {}));
301
292
 
302
- class RowAction extends Model {
293
+ class RowAction {
303
294
  constructor(config = {}) {
304
- super();
305
295
  this.label = '';
306
296
  this.classArray = [];
307
297
  this.isShown = true;
308
298
  this._isGroup = false;
309
- this._fromJSON(config);
299
+ this._init(config);
310
300
  if (Array.isArray(this.rowActions)) {
311
301
  this._isGroup = true;
312
302
  }
@@ -314,14 +304,16 @@ class RowAction extends Model {
314
304
  get isGroup() {
315
305
  return this._isGroup;
316
306
  }
317
- _fromJSON(value) {
318
- super._fromJSON(value);
319
- if (value.type === void 0) {
320
- this.type = ActionType.Basic;
321
- }
322
- if (this.menu === void 0) {
323
- this.menu = true;
324
- }
307
+ _init(value) {
308
+ var _a, _b, _c;
309
+ this.icon = value.icon;
310
+ this.menu = (_a = value.menu) !== null && _a !== void 0 ? _a : true;
311
+ this.remove = value.remove;
312
+ this.className = value.className;
313
+ this.type = (_b = value.type) !== null && _b !== void 0 ? _b : ActionType.Basic;
314
+ this.show = value.show;
315
+ this.restore = value.restore;
316
+ this.rowActions = (_c = value.rowActions) === null || _c === void 0 ? void 0 : _c.map((action) => new RowAction(action));
325
317
  // Re-assign click function
326
318
  const clickFn = value.click;
327
319
  this.click = (row, event, index, rowActionsRef = null) => {
@@ -405,38 +397,6 @@ class RowAction extends Model {
405
397
  }
406
398
  }
407
399
  }
408
- __decorate([
409
- Alias(),
410
- __metadata("design:type", String)
411
- ], RowAction.prototype, "icon", void 0);
412
- __decorate([
413
- Alias(),
414
- __metadata("design:type", Boolean)
415
- ], RowAction.prototype, "menu", void 0);
416
- __decorate([
417
- Alias(),
418
- __metadata("design:type", Object)
419
- ], RowAction.prototype, "remove", void 0);
420
- __decorate([
421
- Alias(),
422
- __metadata("design:type", String)
423
- ], RowAction.prototype, "className", void 0);
424
- __decorate([
425
- Alias(),
426
- __metadata("design:type", String)
427
- ], RowAction.prototype, "type", void 0);
428
- __decorate([
429
- Alias(),
430
- __metadata("design:type", Function)
431
- ], RowAction.prototype, "show", void 0);
432
- __decorate([
433
- Alias(),
434
- __metadata("design:type", Boolean)
435
- ], RowAction.prototype, "restore", void 0);
436
- __decorate([
437
- Alias('rowActions', RowAction),
438
- __metadata("design:type", Array)
439
- ], RowAction.prototype, "rowActions", void 0);
440
400
 
441
401
  class ColumnsController {
442
402
  constructor() {
@@ -2614,9 +2574,8 @@ class ExternalParamsController {
2614
2574
  }
2615
2575
 
2616
2576
  const SHOW_DELETED_FILTERS_KEY = '$$_show_deleted_$$';
2617
- class List extends Model {
2577
+ class List {
2618
2578
  constructor(el, config = {}, fsScroll, selectionDialog, router, route, persistance, inDialog) {
2619
- super();
2620
2579
  this.el = el;
2621
2580
  this.config = config;
2622
2581
  this.fsScroll = fsScroll;
@@ -2626,7 +2585,6 @@ class List extends Model {
2626
2585
  this.persistance = persistance;
2627
2586
  this.inDialog = inDialog;
2628
2587
  this.filters = [];
2629
- this.scrollable = false;
2630
2588
  // @Alias('rows') private _rows: any;
2631
2589
  this.initialized$ = new BehaviorSubject(false);
2632
2590
  this.loading$ = new BehaviorSubject(false);
@@ -2649,7 +2607,6 @@ class List extends Model {
2649
2607
  this.emptyStateEnabled = false;
2650
2608
  this.onDestroy$ = new Subject();
2651
2609
  this._filtersQuery = new BehaviorSubject(null);
2652
- this._fromJSON(config);
2653
2610
  this.initialize(config);
2654
2611
  this._headerConfig = new StyleConfig(config.header);
2655
2612
  this._groupCellConfig = new StyleConfig(config.cell);
@@ -2839,6 +2796,24 @@ class List extends Model {
2839
2796
  * @param config
2840
2797
  */
2841
2798
  initialize(config) {
2799
+ var _a;
2800
+ this.heading = config.heading;
2801
+ this.trackBy = config.trackBy;
2802
+ this.subheading = config.subheading;
2803
+ this.rowActionsRaw = config.rowActions;
2804
+ this.rowClass = config.rowClass;
2805
+ this.rowEvents = config.rowEvents;
2806
+ this.restore = config.restore;
2807
+ this.persist = config.persist;
2808
+ this.filters = (_a = config.filters) !== null && _a !== void 0 ? _a : [];
2809
+ this.filterInitCb = config.filterInit;
2810
+ this.filterChangeCb = config.filterChange;
2811
+ this.savedFilters = config.savedFilters;
2812
+ this.scrollable = config.scrollable;
2813
+ this.noResults = config.noResults;
2814
+ this.emptyState = config.emptyState;
2815
+ this.fetchFn = config.fetch;
2816
+ this.afterFetchFn = config.afterFetch;
2842
2817
  this.columns.initConfig(config.column);
2843
2818
  this.initDefaultOptions(config);
2844
2819
  this.initRestore();
@@ -3123,7 +3098,7 @@ class List extends Model {
3123
3098
  persist: this.persist,
3124
3099
  items: this.filters || [],
3125
3100
  savedFilters: this.savedFilters,
3126
- inline: this.inlineFilters,
3101
+ // inline: this.inlineFilters,
3127
3102
  actions: this.actions.actions,
3128
3103
  queryParam: this.queryParam,
3129
3104
  sorts: sortValues,
@@ -3279,82 +3254,6 @@ class List extends Model {
3279
3254
  }
3280
3255
  }
3281
3256
  }
3282
- __decorate([
3283
- Alias(),
3284
- __metadata("design:type", String)
3285
- ], List.prototype, "heading", void 0);
3286
- __decorate([
3287
- Alias(),
3288
- __metadata("design:type", String)
3289
- ], List.prototype, "trackBy", void 0);
3290
- __decorate([
3291
- Alias(),
3292
- __metadata("design:type", String)
3293
- ], List.prototype, "subheading", void 0);
3294
- __decorate([
3295
- Alias(),
3296
- __metadata("design:type", Object)
3297
- ], List.prototype, "inlineFilters", void 0);
3298
- __decorate([
3299
- Alias('rowActions'),
3300
- __metadata("design:type", Array)
3301
- ], List.prototype, "rowActionsRaw", void 0);
3302
- __decorate([
3303
- Alias('rowClass'),
3304
- __metadata("design:type", Object)
3305
- ], List.prototype, "rowClass", void 0);
3306
- __decorate([
3307
- Alias(),
3308
- __metadata("design:type", Object)
3309
- ], List.prototype, "rowEvents", void 0);
3310
- __decorate([
3311
- Alias(),
3312
- __metadata("design:type", Object)
3313
- ], List.prototype, "restore", void 0);
3314
- __decorate([
3315
- Alias(),
3316
- __metadata("design:type", Object)
3317
- ], List.prototype, "columnTemplates", void 0);
3318
- __decorate([
3319
- Alias(),
3320
- __metadata("design:type", Boolean)
3321
- ], List.prototype, "persist", void 0);
3322
- __decorate([
3323
- Alias(),
3324
- __metadata("design:type", Object)
3325
- ], List.prototype, "filters", void 0);
3326
- __decorate([
3327
- Alias('filterInit'),
3328
- __metadata("design:type", Function)
3329
- ], List.prototype, "filterInitCb", void 0);
3330
- __decorate([
3331
- Alias('filterChange'),
3332
- __metadata("design:type", Function)
3333
- ], List.prototype, "filterChangeCb", void 0);
3334
- __decorate([
3335
- Alias(),
3336
- __metadata("design:type", Object)
3337
- ], List.prototype, "savedFilters", void 0);
3338
- __decorate([
3339
- Alias(),
3340
- __metadata("design:type", Object)
3341
- ], List.prototype, "scrollable", void 0);
3342
- __decorate([
3343
- Alias(),
3344
- __metadata("design:type", Object)
3345
- ], List.prototype, "noResults", void 0);
3346
- __decorate([
3347
- Alias(),
3348
- __metadata("design:type", Object)
3349
- ], List.prototype, "emptyState", void 0);
3350
- __decorate([
3351
- Alias('fetch'),
3352
- __metadata("design:type", Function)
3353
- ], List.prototype, "fetchFn", void 0);
3354
- __decorate([
3355
- Alias('afterFetch'),
3356
- __metadata("design:type", Function)
3357
- ], List.prototype, "afterFetchFn", void 0);
3358
3257
 
3359
3258
  var ReorderPosition;
3360
3259
  (function (ReorderPosition) {
@@ -4987,7 +4886,7 @@ class FsPaginationComponent {
4987
4886
  }
4988
4887
  }
4989
4888
  FsPaginationComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsPaginationComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
4990
- FsPaginationComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsPaginationComponent, selector: "fs-list-pagination", inputs: { pagination: "pagination", rows: "rows" }, ngImport: i0, template: "<ng-container *ngIf=\"!pagination.loadMoreEnabled; else loadMoreButton\">\n <div class=\"paging\" *ngIf=\"pagination?.pages\">\n <div class=\"records\"></div>\n <div fxFlex>\n <div class=\"pages\">\n <a matRipple matRippleRadius=\"15\" [matRippleCentered]=\"true\" class=\"first\" [class.disabled]=\"!pagination.hasPrevPage\" (click)=\"pagination.goFirst()\">\n <i class=\"material-icons\">first_page</i>\n </a>\n\n <a matRipple matRippleRadius=\"15\" [matRippleCentered]=\"true\" class=\"previous\" [class.disabled]=\"!pagination.hasPrevPage\" (click)=\"pagination.goPrev()\">\n <i class=\"material-icons\">keyboard_arrow_left</i>\n </a>\n\n <div class=\"number\">\n {{ pagination.page }} of {{ pagination.pages }}\n </div>\n\n <a matRipple matRippleRadius=\"15\" [matRippleCentered]=\"true\" class=\"next\" [class.disabled]=\"!pagination.hasNextPage\" (click)=\"pagination.goNext()\">\n <i class=\"material-icons\">keyboard_arrow_right</i>\n </a>\n\n <a matRipple matRippleRadius=\"15\" [matRippleCentered]=\"true\" class=\"last\" [class.disabled]=\"!pagination.hasNextPage\" (click)=\"pagination.goLast()\">\n <i class=\"material-icons\">last_page</i>\n </a>\n\n </div>\n </div>\n </div>\n</ng-container>\n\n<ng-template #loadMoreButton>\n <div class=\"fs-list-load-more\" *ngIf=\"pagination.hasNextPage\">\n <button mat-button (click)=\"pagination.goNext()\">{{ pagination.loadMoreText }}</button>\n </div>\n</ng-template>\n", styles: [":host{display:block}.paging{display:flex}.paging .pages{display:flex;justify-content:center;align-items:center;-webkit-user-select:none;user-select:none}.paging .pages a{text-align:center;color:#000000de;text-decoration:none;font-size:15px;cursor:pointer;display:flex}.paging .pages a:not(.page){padding:10px}.paging .pages a.disabled{pointer-events:none;cursor:default;color:#d8d8d8}.paging .pages .number{font-size:90%}.fs-list-load-more button{width:100%;margin-top:10px}\n"], components: [{ type: i2$1.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3$2.DefaultFlexDirective, selector: " [fxFlex], [fxFlex.xs], [fxFlex.sm], [fxFlex.md], [fxFlex.lg], [fxFlex.xl], [fxFlex.lt-sm], [fxFlex.lt-md], [fxFlex.lt-lg], [fxFlex.lt-xl], [fxFlex.gt-xs], [fxFlex.gt-sm], [fxFlex.gt-md], [fxFlex.gt-lg]", inputs: ["fxFlex", "fxFlex.xs", "fxFlex.sm", "fxFlex.md", "fxFlex.lg", "fxFlex.xl", "fxFlex.lt-sm", "fxFlex.lt-md", "fxFlex.lt-lg", "fxFlex.lt-xl", "fxFlex.gt-xs", "fxFlex.gt-sm", "fxFlex.gt-md", "fxFlex.gt-lg"] }, { type: i4$2.MatRipple, selector: "[mat-ripple], [matRipple]", inputs: ["matRippleRadius", "matRippleDisabled", "matRippleTrigger", "matRippleColor", "matRippleUnbounded", "matRippleCentered", "matRippleAnimation"], exportAs: ["matRipple"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
4889
+ FsPaginationComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsPaginationComponent, selector: "fs-list-pagination", inputs: { pagination: "pagination", rows: "rows" }, ngImport: i0, template: "<ng-container *ngIf=\"!pagination.loadMoreEnabled; else loadMoreButton\">\n <div class=\"paging\" *ngIf=\"pagination?.pages\">\n <div class=\"records\"></div>\n <div fxFlex>\n <div class=\"pages\">\n <a matRipple matRippleRadius=\"15\" [matRippleCentered]=\"true\" class=\"first\" [class.disabled]=\"!pagination.hasPrevPage\" (click)=\"pagination.goFirst()\">\n <i class=\"material-icons\">first_page</i>\n </a>\n\n <a matRipple matRippleRadius=\"15\" [matRippleCentered]=\"true\" class=\"previous\" [class.disabled]=\"!pagination.hasPrevPage\" (click)=\"pagination.goPrev()\">\n <i class=\"material-icons\">keyboard_arrow_left</i>\n </a>\n\n <div class=\"number\">\n {{ pagination.page | fsFormatNumber }} of {{ pagination.pages | fsFormatNumber }}\n </div>\n\n <a matRipple matRippleRadius=\"15\" [matRippleCentered]=\"true\" class=\"next\" [class.disabled]=\"!pagination.hasNextPage\" (click)=\"pagination.goNext()\">\n <i class=\"material-icons\">keyboard_arrow_right</i>\n </a>\n\n <a matRipple matRippleRadius=\"15\" [matRippleCentered]=\"true\" class=\"last\" [class.disabled]=\"!pagination.hasNextPage\" (click)=\"pagination.goLast()\">\n <i class=\"material-icons\">last_page</i>\n </a>\n\n </div>\n </div>\n </div>\n</ng-container>\n\n<ng-template #loadMoreButton>\n <div class=\"fs-list-load-more\" *ngIf=\"pagination.hasNextPage\">\n <button mat-button (click)=\"pagination.goNext()\">{{ pagination.loadMoreText }}</button>\n </div>\n</ng-template>\n", styles: [":host{display:block}.paging{display:flex}.paging .pages{display:flex;justify-content:center;align-items:center;-webkit-user-select:none;user-select:none}.paging .pages a{text-align:center;color:#000000de;text-decoration:none;font-size:15px;cursor:pointer;display:flex}.paging .pages a:not(.page){padding:10px}.paging .pages a.disabled{pointer-events:none;cursor:default;color:#d8d8d8}.paging .pages .number{font-size:90%}.fs-list-load-more button{width:100%;margin-top:10px}\n"], components: [{ type: i2$1.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3$2.DefaultFlexDirective, selector: " [fxFlex], [fxFlex.xs], [fxFlex.sm], [fxFlex.md], [fxFlex.lg], [fxFlex.xl], [fxFlex.lt-sm], [fxFlex.lt-md], [fxFlex.lt-lg], [fxFlex.lt-xl], [fxFlex.gt-xs], [fxFlex.gt-sm], [fxFlex.gt-md], [fxFlex.gt-lg]", inputs: ["fxFlex", "fxFlex.xs", "fxFlex.sm", "fxFlex.md", "fxFlex.lg", "fxFlex.xl", "fxFlex.lt-sm", "fxFlex.lt-md", "fxFlex.lt-lg", "fxFlex.lt-xl", "fxFlex.gt-xs", "fxFlex.gt-sm", "fxFlex.gt-md", "fxFlex.gt-lg"] }, { type: i4$2.MatRipple, selector: "[mat-ripple], [matRipple]", inputs: ["matRippleRadius", "matRippleDisabled", "matRippleTrigger", "matRippleColor", "matRippleUnbounded", "matRippleCentered", "matRippleAnimation"], exportAs: ["matRipple"] }], pipes: { "fsFormatNumber": i5$1.FsFormatNumberPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
4991
4890
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsPaginationComponent, decorators: [{
4992
4891
  type: Component,
4993
4892
  args: [{
@@ -5094,6 +4993,9 @@ class FsListComponent {
5094
4993
  set groupEnabled(value) {
5095
4994
  this.list.groupEnabled(value);
5096
4995
  }
4996
+ get filtersQuery() {
4997
+ return this.list.filtersQuery;
4998
+ }
5097
4999
  ngOnInit() {
5098
5000
  this._subscribeToRemoveRow();
5099
5001
  this._subscribeToGroupExpandStatusChange();
@@ -5488,7 +5390,8 @@ FsListModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "
5488
5390
  FsPromptModule,
5489
5391
  MatDialogModule,
5490
5392
  MatTooltipModule,
5491
- FsFileModule], exports: [FsListComponent,
5393
+ FsFileModule,
5394
+ FsCommonModule], exports: [FsListComponent,
5492
5395
  FsRowComponent,
5493
5396
  FsCellComponent,
5494
5397
  FsListLoaderComponent,
@@ -5518,6 +5421,7 @@ FsListModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
5518
5421
  MatDialogModule,
5519
5422
  MatTooltipModule,
5520
5423
  FsFileModule,
5424
+ FsCommonModule,
5521
5425
  ]] });
5522
5426
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsListModule, decorators: [{
5523
5427
  type: NgModule,
@@ -5539,6 +5443,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
5539
5443
  MatDialogModule,
5540
5444
  MatTooltipModule,
5541
5445
  FsFileModule,
5446
+ FsCommonModule,
5542
5447
  ],
5543
5448
  declarations: [
5544
5449
  // Components