@firestitch/list 12.4.0 → 12.5.0

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.
@@ -61,7 +61,7 @@ export interface FsListGroupConfig {
61
61
  initialExpand?: boolean;
62
62
  groupBy?: (row: any) => any;
63
63
  compareBy?: (row: any) => any;
64
- footer?: (row: any) => boolean;
64
+ footer?: (row: any, group?: any) => boolean;
65
65
  actions?: (FsListRowActionGroup | FsListRowAction)[];
66
66
  }
67
67
  export interface FsListLoadMoreConfig {
@@ -246,5 +246,4 @@ export declare type FsListAfterContentInitFn = (query: Record<string, any>, data
246
246
  export interface FsListRowClassOptions {
247
247
  index: number;
248
248
  groupIndex?: number;
249
- groupChildIndex?: number;
250
249
  }
@@ -5,6 +5,6 @@ export declare class GroupFooterRow extends BaseRow {
5
5
  private readonly _parent;
6
6
  constructor(data?: any, parent?: GroupRow);
7
7
  get parent(): GroupRow;
8
- get isFooter(): boolean;
8
+ get isGroupFooter(): boolean;
9
9
  destroy(): void;
10
10
  }
@@ -5,6 +5,7 @@ export declare class GroupRow extends BaseRow {
5
5
  children: (ChildRow | GroupFooterRow)[];
6
6
  private readonly _expanded;
7
7
  constructor(data?: any, initialExpand?: boolean);
8
+ get childrenData(): any[];
8
9
  get isGroup(): boolean;
9
10
  get expanded(): boolean;
10
11
  get expanded$(): import("rxjs").Observable<boolean>;
@@ -18,7 +18,7 @@ export declare class Row {
18
18
  get type(): RowType;
19
19
  get isGroup(): boolean;
20
20
  get isChild(): boolean;
21
- get isFooter(): boolean;
21
+ get isGroupFooter(): boolean;
22
22
  get parent(): GroupRow;
23
23
  get children(): (ChildRow | GroupFooterRow)[];
24
24
  get expanded(): boolean;
@@ -1183,6 +1183,14 @@
1183
1183
  }
1184
1184
  return _this;
1185
1185
  }
1186
+ Object.defineProperty(GroupRow.prototype, "childrenData", {
1187
+ get: function () {
1188
+ return this.children
1189
+ .map(function (child) { return child.data; });
1190
+ },
1191
+ enumerable: false,
1192
+ configurable: true
1193
+ });
1186
1194
  Object.defineProperty(GroupRow.prototype, "isGroup", {
1187
1195
  get: function () {
1188
1196
  return true;
@@ -1297,7 +1305,7 @@
1297
1305
  enumerable: false,
1298
1306
  configurable: true
1299
1307
  });
1300
- Object.defineProperty(GroupFooterRow.prototype, "isFooter", {
1308
+ Object.defineProperty(GroupFooterRow.prototype, "isGroupFooter", {
1301
1309
  get: function () {
1302
1310
  return true;
1303
1311
  },
@@ -1386,7 +1394,7 @@
1386
1394
  enumerable: false,
1387
1395
  configurable: true
1388
1396
  });
1389
- Object.defineProperty(Row.prototype, "isFooter", {
1397
+ Object.defineProperty(Row.prototype, "isGroupFooter", {
1390
1398
  get: function () {
1391
1399
  return this._row instanceof GroupFooterRow;
1392
1400
  },
@@ -1725,7 +1733,7 @@
1725
1733
  DataController.prototype._updateVisibleRows = function () {
1726
1734
  this.visibleRows = this._rowsStack
1727
1735
  .filter(function (row) {
1728
- return (!row.isChild && !row.isFooter) || row.visible;
1736
+ return (!row.isChild && !row.isGroupFooter) || row.visible;
1729
1737
  });
1730
1738
  };
1731
1739
  DataController.prototype.updateRow = function (targetRow, trackBy) {
@@ -1766,25 +1774,19 @@
1766
1774
  * Split existing rows by groups and store them for future use
1767
1775
  */
1768
1776
  DataController.prototype.groupRowsBy = function (rows) {
1769
- var e_1, _b;
1770
1777
  var _this = this;
1771
1778
  if (!this._groupByFn || !this._compareByFn) {
1772
1779
  return rows;
1773
1780
  }
1774
- var numberOfGroups = 0;
1781
+ var groupRows = [];
1775
1782
  var footerRows = new Map();
1776
1783
  rows.forEach(function (row) {
1777
1784
  var mainGroup = _this._groupByFn(row);
1778
- var isFooterRow = _this._footerRowFn(row);
1779
1785
  var mainGroupKey = _this._compareByFn(mainGroup);
1780
- if (isFooterRow) {
1781
- footerRows.set(mainGroupKey, row);
1782
- return;
1783
- }
1784
1786
  if (!_this._store.has(mainGroupKey)) {
1785
1787
  var group = new GroupRow(mainGroup, _this._initialExpand);
1786
- group.index = numberOfGroups;
1787
- numberOfGroups++;
1788
+ group.index = groupRows.length;
1789
+ groupRows.push(group);
1788
1790
  var childRow = new ChildRow(row, group);
1789
1791
  _this._store.set(mainGroupKey, group);
1790
1792
  group.children.push(childRow);
@@ -1795,23 +1797,16 @@
1795
1797
  group.children.push(childRow);
1796
1798
  }
1797
1799
  });
1798
- try {
1799
- for (var footerRows_1 = __values(footerRows), footerRows_1_1 = footerRows_1.next(); !footerRows_1_1.done; footerRows_1_1 = footerRows_1.next()) {
1800
- var _c = __read(footerRows_1_1.value, 2), key = _c[0], value = _c[1];
1801
- var group = this._store.get(key);
1802
- if (group) {
1803
- var footerRow = new GroupFooterRow(value, group);
1804
- group.children.push(footerRow);
1805
- }
1806
- }
1807
- }
1808
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
1809
- finally {
1810
- try {
1811
- if (footerRows_1_1 && !footerRows_1_1.done && (_b = footerRows_1.return)) _b.call(footerRows_1);
1800
+ groupRows.forEach(function (groupRow) {
1801
+ var footerIndex = groupRow.children
1802
+ .findIndex(function (row) {
1803
+ return _this._footerRowFn(row.data, Object.assign(Object.assign({}, groupRow.data), { children: groupRow.childrenData }));
1804
+ });
1805
+ if (footerIndex !== -1) {
1806
+ var footerRow = groupRow.children.slice(footerIndex, footerIndex + 1)[0];
1807
+ groupRow.children.push(new GroupFooterRow(footerRow.data, groupRow));
1812
1808
  }
1813
- finally { if (e_1) throw e_1.error; }
1814
- }
1809
+ });
1815
1810
  return Array.from(this._store.values())
1816
1811
  .reduce(function (acc, item) {
1817
1812
  if (item.isGroup) {
@@ -4875,9 +4870,21 @@
4875
4870
  if (this.row.isGroup) {
4876
4871
  this.cellContext.groupIndex = this.row.index;
4877
4872
  }
4878
- else if (this.row.isChild || this.row.isFooter) {
4879
- this.cellContext.groupChildIndex = this.row.index;
4873
+ else if (this.row.isChild || this.row.isGroupFooter) {
4874
+ this.cellContext.groupIndex = this.row.index;
4880
4875
  this.cellContext.groupRow = this.row.parent.data;
4876
+ this.cellContext.group = this.row.parent.data;
4877
+ }
4878
+ if (this.row.isGroup) {
4879
+ this.cellContext.group = this.row.data;
4880
+ this.cellContext.groupChildren = this.row.children
4881
+ .map(function (child) { return child.data; });
4882
+ }
4883
+ else if (this.row.isGroupFooter) {
4884
+ this.cellContext.group = this.row.parent.data;
4885
+ this.cellContext.groupIndex = this.row.index;
4886
+ this.cellContext.groupChildren = this.row.parent.children
4887
+ .map(function (child) { return child.data; });
4881
4888
  }
4882
4889
  }
4883
4890
  this.cellContext.column = this.column;
@@ -4893,7 +4900,7 @@
4893
4900
  if ((_a = this.row) === null || _a === void 0 ? void 0 : _a.isGroup) {
4894
4901
  this.cellTemplate = this.column.groupHeaderTemplate || this.column.cellTemplate;
4895
4902
  }
4896
- else if ((_b = this.row) === null || _b === void 0 ? void 0 : _b.isFooter) {
4903
+ else if ((_b = this.row) === null || _b === void 0 ? void 0 : _b.isGroupFooter) {
4897
4904
  this.cellTemplate = this.column.groupFooterTemplate || this.column.cellTemplate;
4898
4905
  }
4899
4906
  else {
@@ -5510,7 +5517,7 @@
5510
5517
  });
5511
5518
  Object.defineProperty(FsRowComponent.prototype, "isGroupFooterRow", {
5512
5519
  get: function () {
5513
- return this.row.isFooter;
5520
+ return this.row.isGroupFooter;
5514
5521
  },
5515
5522
  enumerable: false,
5516
5523
  configurable: true
@@ -5533,7 +5540,7 @@
5533
5540
  options.groupIndex = this.row.index;
5534
5541
  }
5535
5542
  else if (this.row.isChild) {
5536
- options.groupChildIndex = this.row.index;
5543
+ options.groupIndex = this.row.index;
5537
5544
  }
5538
5545
  var resultClass = this.rowClass(this.row.data, options);
5539
5546
  if (typeof resultClass === 'string') {
@@ -5706,7 +5713,7 @@
5706
5713
  return FsRowComponent;
5707
5714
  }());
5708
5715
  FsRowComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsRowComponent, deps: [{ token: i0__namespace.ElementRef }, { token: ReorderController }, { token: i0__namespace.ChangeDetectorRef }, { token: i0__namespace.KeyValueDiffers }, { token: i0__namespace.Renderer2 }, { token: FsListDraggableListDirective }], target: i0__namespace.ɵɵFactoryTarget.Component });
5709
- FsRowComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsRowComponent, selector: "[fs-list-row]", inputs: { row: "row", rowActionsRaw: "rowActionsRaw", groupActionsRaw: "groupActionsRaw", hasRowActions: "hasRowActions", rowEvents: "rowEvents", rowClass: "rowClass", restoreMode: "restoreMode", rowIndex: "rowIndex", columns: "columns", selection: "selection", rowRemoved: "rowRemoved" }, host: { properties: { "attr.role": "this.role", "class": "this.rowCssClass" } }, viewQueries: [{ propertyName: "cellRefs", predicate: ["td"], descendants: true }], ngImport: i0__namespace, template: "<!-- Drag -->\n<ng-container *ngIf=\"reorderController.leftReorderActivated$ | async\">\n <ng-container *ngTemplateOutlet=\"dragCell\"></ng-container>\n</ng-container>\n\n<!-- Selection -->\n<ng-container *ngIf=\"selection\">\n <td class=\"fs-list-col fs-list-col-selection\">\n <ng-container *ngIf=\"!row.isFooter\">\n <mat-checkbox (change)=\"selectRow($event)\"\n [checked]=\"selected\"\n [indeterminate]=\"indeterminateSelected\">\n </mat-checkbox>\n </ng-container>\n </td>\n</ng-container>\n\n<!-- Content -->\n<ng-container *ngFor=\"let column of columns; trackBy: trackByFn; let isFirst = first\">\n <td fs-cell\n *ngIf=\"(isGroupRow && !column.groupHeaderColspanned)\n || (isGroupFooterRow && !column.groupFooterColspanned)\n || (!isGroupRow && !isGroupFooterRow && !column.cellColspanned)\"\n [column]=\"column\"\n [row]=\"row\"\n [rowIndex]=\"rowIndex\"\n [class]=\"(isGroupRow && column.groupHeaderConfigs.classesString)\n || (isGroupFooterRow && column.groupFooterConfigs.classesString)\n || (!isGroupFooterRow && column.cellConfigs.classesString)\"\n [ngClass]=\"{ 'primary-col': isFirst }\"\n [attr.colspan]=\"(isGroupRow && column.groupHeaderConfigs.colspan)\n || (isGroupFooterRow && column.groupFooterConfigs.colspan)\n || column.cellConfigs.colspan\"\n [attr.width]=\"column.width\"\n >\n </td>\n</ng-container>\n\n<!-- Drag -->\n<ng-container *ngIf=\"reorderController.rightReorderActivated$ | async\">\n <ng-container *ngTemplateOutlet=\"dragCell\"></ng-container>\n</ng-container>\n\n<!-- Row Actions -->\n<td *ngIf=\"hasRowActions && !(reorderController.manualReorderActivated$ | async)\" class=\"fs-list-col row-actions\">\n <ng-container *ngIf=\"!isGroupFooterRow\">\n <fs-list-row-actions [row]=\"row\"\n [index]=\"rowIndex\"\n [rowActions]=\"rowActions\"\n [menuRowActions]=\"menuRowActions\"\n [inlineRowActions]=\"inlineRowActions\"\n [restoreAction]=\"restoreAction\"\n [restoreMode]=\"restoreMode\"\n [rowRemoved]=\"rowRemoved\"\n ></fs-list-row-actions>\n </ng-container>\n</td>\n\n<ng-template #dragCell>\n <ng-container *ngIf=\"dragCellVisible && !isGroupFooterRow; else emptyCell\">\n <td class=\"fs-list-col drag-col\"\n (mousedown)=\"dragStart($event)\"\n (touchstart)=\"dragStart($event)\"\n >\n <mat-icon>drag_handle</mat-icon>\n </td>\n </ng-container>\n <ng-template #emptyCell>\n <td class=\"fs-list-col drag-col\"></td>\n </ng-template>\n</ng-template>\n", components: [{ type: i2__namespace.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex", "aria-label", "aria-labelledby", "id", "labelPosition", "name", "required", "checked", "disabled", "indeterminate", "aria-describedby", "value"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { type: FsCellComponent, selector: "[fs-cell]", inputs: ["column", "row", "rowIndex"] }, { type: FsRowActionsComponent, selector: "fs-list-row-actions", inputs: ["row", "index", "restoreMode", "rowActions", "rowRemoved", "menuRowActions", "inlineRowActions", "restoreAction"] }, { type: i3__namespace.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], directives: [{ type: i3__namespace$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3__namespace$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i3__namespace$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i3__namespace$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i5__namespace.DefaultClassDirective, selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }], pipes: { "async": i3__namespace$1.AsyncPipe }, changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
5716
+ FsRowComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsRowComponent, selector: "[fs-list-row]", inputs: { row: "row", rowActionsRaw: "rowActionsRaw", groupActionsRaw: "groupActionsRaw", hasRowActions: "hasRowActions", rowEvents: "rowEvents", rowClass: "rowClass", restoreMode: "restoreMode", rowIndex: "rowIndex", columns: "columns", selection: "selection", rowRemoved: "rowRemoved" }, host: { properties: { "attr.role": "this.role", "class": "this.rowCssClass" } }, viewQueries: [{ propertyName: "cellRefs", predicate: ["td"], descendants: true }], ngImport: i0__namespace, template: "<!-- Drag -->\n<ng-container *ngIf=\"reorderController.leftReorderActivated$ | async\">\n <ng-container *ngTemplateOutlet=\"dragCell\"></ng-container>\n</ng-container>\n\n<!-- Selection -->\n<ng-container *ngIf=\"selection\">\n <td class=\"fs-list-col fs-list-col-selection\">\n <ng-container *ngIf=\"!row.isGroupFooter\">\n <mat-checkbox (change)=\"selectRow($event)\"\n [checked]=\"selected\"\n [indeterminate]=\"indeterminateSelected\">\n </mat-checkbox>\n </ng-container>\n </td>\n</ng-container>\n\n<!-- Content -->\n<ng-container *ngFor=\"let column of columns; trackBy: trackByFn; let isFirst = first\">\n <td fs-cell\n *ngIf=\"(isGroupRow && !column.groupHeaderColspanned)\n || (isGroupFooterRow && !column.groupFooterColspanned)\n || (!isGroupRow && !isGroupFooterRow && !column.cellColspanned)\"\n [column]=\"column\"\n [row]=\"row\"\n [rowIndex]=\"rowIndex\"\n [class]=\"(isGroupRow && column.groupHeaderConfigs.classesString)\n || (isGroupFooterRow && column.groupFooterConfigs.classesString)\n || (!isGroupFooterRow && column.cellConfigs.classesString)\"\n [ngClass]=\"{ 'primary-col': isFirst }\"\n [attr.colspan]=\"(isGroupRow && column.groupHeaderConfigs.colspan)\n || (isGroupFooterRow && column.groupFooterConfigs.colspan)\n || column.cellConfigs.colspan\"\n [attr.width]=\"column.width\"\n >\n </td>\n</ng-container>\n\n<!-- Drag -->\n<ng-container *ngIf=\"reorderController.rightReorderActivated$ | async\">\n <ng-container *ngTemplateOutlet=\"dragCell\"></ng-container>\n</ng-container>\n\n<!-- Row Actions -->\n<td *ngIf=\"hasRowActions && !(reorderController.manualReorderActivated$ | async)\" class=\"fs-list-col row-actions\">\n <ng-container *ngIf=\"!isGroupFooterRow\">\n <fs-list-row-actions [row]=\"row\"\n [index]=\"rowIndex\"\n [rowActions]=\"rowActions\"\n [menuRowActions]=\"menuRowActions\"\n [inlineRowActions]=\"inlineRowActions\"\n [restoreAction]=\"restoreAction\"\n [restoreMode]=\"restoreMode\"\n [rowRemoved]=\"rowRemoved\"\n ></fs-list-row-actions>\n </ng-container>\n</td>\n\n<ng-template #dragCell>\n <ng-container *ngIf=\"dragCellVisible && !isGroupFooterRow; else emptyCell\">\n <td class=\"fs-list-col drag-col\"\n (mousedown)=\"dragStart($event)\"\n (touchstart)=\"dragStart($event)\"\n >\n <mat-icon>drag_handle</mat-icon>\n </td>\n </ng-container>\n <ng-template #emptyCell>\n <td class=\"fs-list-col drag-col\"></td>\n </ng-template>\n</ng-template>\n", components: [{ type: i2__namespace.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex", "aria-label", "aria-labelledby", "id", "labelPosition", "name", "required", "checked", "disabled", "indeterminate", "aria-describedby", "value"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { type: FsCellComponent, selector: "[fs-cell]", inputs: ["column", "row", "rowIndex"] }, { type: FsRowActionsComponent, selector: "fs-list-row-actions", inputs: ["row", "index", "restoreMode", "rowActions", "rowRemoved", "menuRowActions", "inlineRowActions", "restoreAction"] }, { type: i3__namespace.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], directives: [{ type: i3__namespace$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3__namespace$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i3__namespace$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i3__namespace$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i5__namespace.DefaultClassDirective, selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }], pipes: { "async": i3__namespace$1.AsyncPipe }, changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
5710
5717
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsRowComponent, decorators: [{
5711
5718
  type: i0.Component,
5712
5719
  args: [{