@firestitch/list 12.13.2 → 12.14.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.
@@ -44,7 +44,7 @@ export declare class FsRowComponent implements OnInit, DoCheck, OnDestroy {
44
44
  private _destroy$;
45
45
  constructor(el: ElementRef, _cdRef: ChangeDetectorRef, _differs: KeyValueDiffers, _renderer: Renderer2, _draggableList: FsListDraggableListDirective);
46
46
  get isGroupRow(): boolean;
47
- get isChildRow(): boolean;
47
+ get isGroupChildRow(): boolean;
48
48
  get isGroupFooterRow(): boolean;
49
49
  get isDragDisabled(): boolean;
50
50
  get isMultipleSelection(): boolean;
@@ -1,6 +1,6 @@
1
1
  export declare enum RowType {
2
- Simple = 0,
3
- Group = 1,
4
- GroupFooter = 2,
5
- Child = 3
2
+ Simple = "simple",
3
+ Group = "group",
4
+ GroupFooter = "groupFooter",
5
+ GroupChild = "groupChild"
6
6
  }
@@ -63,7 +63,7 @@ export interface FsListGroupConfig {
63
63
  initialExpand?: boolean;
64
64
  groupBy?: (row: any) => any;
65
65
  compareBy?: (row: any) => any;
66
- footer?: (row: any, group?: any) => boolean;
66
+ footer?: (group?: any) => boolean;
67
67
  actions?: (FsListRowActionGroup | FsListRowAction)[];
68
68
  }
69
69
  export interface FsListLoadMoreConfig {
@@ -253,5 +253,6 @@ export declare type FsListAfterContentInitFn = (query: Record<string, any>, data
253
253
  export interface FsListRowClassOptions {
254
254
  index: number;
255
255
  groupIndex?: number;
256
+ type?: RowType;
256
257
  }
257
258
  export declare type FsListAfterInitFn = (listComponent: any) => void;
@@ -17,7 +17,7 @@ export declare class Row {
17
17
  get data(): any;
18
18
  get type(): RowType;
19
19
  get isGroup(): boolean;
20
- get isChild(): boolean;
20
+ get isGroupChild(): boolean;
21
21
  get isGroupFooter(): boolean;
22
22
  get parent(): GroupRow;
23
23
  get children(): (ChildRow | GroupFooterRow)[];
@@ -1115,10 +1115,10 @@
1115
1115
 
1116
1116
  exports.RowType = void 0;
1117
1117
  (function (RowType) {
1118
- RowType[RowType["Simple"] = 0] = "Simple";
1119
- RowType[RowType["Group"] = 1] = "Group";
1120
- RowType[RowType["GroupFooter"] = 2] = "GroupFooter";
1121
- RowType[RowType["Child"] = 3] = "Child";
1118
+ RowType["Simple"] = "simple";
1119
+ RowType["Group"] = "group";
1120
+ RowType["GroupFooter"] = "groupFooter";
1121
+ RowType["GroupChild"] = "groupChild";
1122
1122
  })(exports.RowType || (exports.RowType = {}));
1123
1123
 
1124
1124
  var BaseRow = /** @class */ (function () {
@@ -1223,7 +1223,7 @@
1223
1223
  function ChildRow(data, parent) {
1224
1224
  if (data === void 0) { data = {}; }
1225
1225
  if (parent === void 0) { parent = null; }
1226
- var _this = _super.call(this, data, exports.RowType.Child) || this;
1226
+ var _this = _super.call(this, data, exports.RowType.GroupChild) || this;
1227
1227
  _this.visible = true;
1228
1228
  _this._parent = parent;
1229
1229
  if (_this.parent) {
@@ -1316,7 +1316,7 @@
1316
1316
  this._row = new GroupRow(data, initialExpand);
1317
1317
  }
1318
1318
  break;
1319
- case exports.RowType.Child:
1319
+ case exports.RowType.GroupChild:
1320
1320
  {
1321
1321
  this._row = new ChildRow(data, parent);
1322
1322
  }
@@ -1371,7 +1371,7 @@
1371
1371
  enumerable: false,
1372
1372
  configurable: true
1373
1373
  });
1374
- Object.defineProperty(Row.prototype, "isChild", {
1374
+ Object.defineProperty(Row.prototype, "isGroupChild", {
1375
1375
  get: function () {
1376
1376
  return this._row instanceof ChildRow;
1377
1377
  },
@@ -1739,7 +1739,7 @@
1739
1739
  this.visibleRows = this._rowsStack
1740
1740
  .filter(function (row, index) {
1741
1741
  row.index = index;
1742
- return (!row.isChild && !row.isGroupFooter) || row.visible;
1742
+ return (!row.isGroupChild && !row.isGroupFooter) || row.visible;
1743
1743
  });
1744
1744
  };
1745
1745
  DataController.prototype.updateRow = function (targetRow, trackBy) {
@@ -1804,13 +1804,9 @@
1804
1804
  }
1805
1805
  });
1806
1806
  groupRows.forEach(function (groupRow) {
1807
- var footerIndex = groupRow.children
1808
- .findIndex(function (row) {
1809
- return _this._footerRowFn(row.data, Object.assign(Object.assign({}, groupRow.data), { children: groupRow.childrenData }));
1810
- });
1811
- if (footerIndex !== -1) {
1812
- var footerRow = groupRow.children.slice(footerIndex, footerIndex + 1)[0];
1813
- groupRow.children.push(new GroupFooterRow(footerRow.data, groupRow));
1807
+ var hasFooter = _this._footerRowFn(groupRow);
1808
+ if (hasFooter) {
1809
+ groupRow.children.push(new GroupFooterRow(groupRow, groupRow));
1814
1810
  }
1815
1811
  });
1816
1812
  return Array.from(this._store.values())
@@ -2344,7 +2340,7 @@
2344
2340
  * Go to last page
2345
2341
  */
2346
2342
  PaginationController.prototype.goLast = function () {
2347
- if (this.page < this.pages) {
2343
+ if (this.page !== this.pages) {
2348
2344
  this.page = this.pages;
2349
2345
  this.updateOffset();
2350
2346
  this._pageChanged$.next({
@@ -4125,6 +4121,12 @@
4125
4121
  if (this.afterFetchFn) {
4126
4122
  this.afterFetchFn(query, this.dataController.visibleRowsData);
4127
4123
  }
4124
+ // case when have removed all results from last page
4125
+ if (this.dataController.visibleRows.length === 0
4126
+ && this.paging.page > 1
4127
+ && this.paging.page > this.paging.pages) {
4128
+ this.paging.goLast();
4129
+ }
4128
4130
  this.fetchComplete$.next();
4129
4131
  this.loading$.next(false);
4130
4132
  };
@@ -4962,7 +4964,7 @@
4962
4964
  if (this.row.isGroup) {
4963
4965
  this.cellContext.groupIndex = this.row.index;
4964
4966
  }
4965
- else if (this.row.isChild || this.row.isGroupFooter) {
4967
+ else if (this.row.isGroupChild || this.row.isGroupFooter) {
4966
4968
  this.cellContext.groupIndex = this.row.index;
4967
4969
  this.cellContext.groupRow = this.row.parent.data;
4968
4970
  this.cellContext.group = this.row.parent.data;
@@ -5276,7 +5278,7 @@
5276
5278
  // Can not drag before first group and after last group
5277
5279
  var swapWithBoundaryGroupElement = (elemIndex === 0 || elemIndex === this._rows.length - 1)
5278
5280
  && targetRow.isGroup
5279
- && this.draggableItem.isChild;
5281
+ && this.draggableItem.isGroupChild;
5280
5282
  if (!swapWithBoundaryGroupElement) {
5281
5283
  if (elemIndex !== null) {
5282
5284
  if (targetRow.readyToSwap) {
@@ -5710,9 +5712,9 @@
5710
5712
  enumerable: false,
5711
5713
  configurable: true
5712
5714
  });
5713
- Object.defineProperty(FsRowComponent.prototype, "isChildRow", {
5715
+ Object.defineProperty(FsRowComponent.prototype, "isGroupChildRow", {
5714
5716
  get: function () {
5715
- return this.row.isChild;
5717
+ return this.row.isGroupChild;
5716
5718
  },
5717
5719
  enumerable: false,
5718
5720
  configurable: true
@@ -5751,7 +5753,7 @@
5751
5753
  if ((_a = this.row) === null || _a === void 0 ? void 0 : _a.isGroup) {
5752
5754
  cls += ' fs-list-row-group';
5753
5755
  }
5754
- else if ((_b = this.row) === null || _b === void 0 ? void 0 : _b.isChild) {
5756
+ else if ((_b = this.row) === null || _b === void 0 ? void 0 : _b.isGroupChild) {
5755
5757
  cls += ' fs-list-row-group-child';
5756
5758
  }
5757
5759
  else if ((_c = this.row) === null || _c === void 0 ? void 0 : _c.isGroupFooter) {
@@ -5760,12 +5762,13 @@
5760
5762
  if (this.rowClass) {
5761
5763
  var options = {
5762
5764
  index: this.rowIndex,
5765
+ type: this.row.type,
5763
5766
  };
5764
5767
  if (this.row.isGroup) {
5765
5768
  options.groupIndex = this.row.index;
5766
5769
  }
5767
- else if (this.row.isChild) {
5768
- options.groupIndex = this.row.index;
5770
+ else if (this.row.isGroupChild || this.row.isGroupFooter) {
5771
+ options.groupIndex = this.row.parent.index;
5769
5772
  }
5770
5773
  var resultClass = this.rowClass(this.row.data, options);
5771
5774
  if (typeof resultClass === 'string') {
@@ -6061,8 +6064,6 @@
6061
6064
  var _a, _b;
6062
6065
  var currentEl = this.row;
6063
6066
  var targetEl = this._draggableList.draggableItem;
6064
- var currentElGroup = (currentEl.isChild && currentEl.parent) || currentEl;
6065
- var targetElGroup = (targetEl.isChild && targetEl.parent) || targetEl;
6066
6067
  this.row.readyToSwap = this._reorderController.moveDropCallback({
6067
6068
  row1: currentEl === null || currentEl === void 0 ? void 0 : currentEl.data,
6068
6069
  row2: targetEl === null || targetEl === void 0 ? void 0 : targetEl.data,