@firestitch/list 12.19.2 → 12.20.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.
@@ -71,12 +71,13 @@ export declare class FsRowComponent implements OnInit, DoCheck, OnDestroy {
71
71
  /**
72
72
  * Set event listeners for row
73
73
  */
74
- private initRowEvents;
74
+ private _initRowEvents;
75
+ private _getRowClasses;
75
76
  /**
76
77
  * Subscribe to selection change events
77
78
  */
78
- private initSelection;
79
- private filterActionsByCategories;
79
+ private _initSelection;
80
+ private _filterActionsByCategories;
80
81
  static ɵfac: i0.ɵɵFactoryDeclaration<FsRowComponent, never>;
81
82
  static ɵcmp: i0.ɵɵComponentDeclaration<FsRowComponent, "[fs-list-row]", never, { "row": "row"; "rowActionsRaw": "rowActionsRaw"; "groupActionsRaw": "groupActionsRaw"; "hasRowActions": "hasRowActions"; "rowEvents": "rowEvents"; "rowClass": "rowClass"; "restoreMode": "restoreMode"; "rowIndex": "rowIndex"; "columns": "columns"; "selection": "selection"; "rowRemoved": "rowRemoved"; "activeFiltersCount": "activeFiltersCount"; "reorderEnabled": "reorderEnabled"; "reorderPosition": "reorderPosition"; "reorderStrategy": "reorderStrategy"; "reorderMultiple": "reorderMultiple"; }, {}, never, never>;
82
83
  }
@@ -1387,62 +1387,30 @@
1387
1387
  });
1388
1388
  Object.defineProperty(FsRowComponent.prototype, "rowCssClass", {
1389
1389
  get: function () {
1390
- var e_1, _d;
1391
1390
  var _a, _b, _c;
1392
- var cls = 'fs-list-row';
1391
+ var classes = ['fs-list-row'];
1393
1392
  if (this.rowIndex % 2 !== 0) {
1394
- cls += ' fs-list-row-odd';
1393
+ classes.push('fs-list-row-odd');
1395
1394
  }
1396
1395
  if (this.rowIndex % 2 === 0) {
1397
- cls += ' fs-list-row-even';
1396
+ classes.push('fs-list-row-even');
1398
1397
  }
1399
1398
  if ((_a = this.row) === null || _a === void 0 ? void 0 : _a.isGroup) {
1400
- cls += ' fs-list-row-group';
1399
+ classes.push('fs-list-row-group');
1401
1400
  }
1402
1401
  else if ((_b = this.row) === null || _b === void 0 ? void 0 : _b.isChild) { // TODO fix isChild & all
1403
- cls += ' fs-list-row-group-child';
1402
+ classes.push('fs-list-row-group-child');
1404
1403
  }
1405
1404
  else if ((_c = this.row) === null || _c === void 0 ? void 0 : _c.isGroupFooter) {
1406
- cls += ' fs-list-row-group-footer';
1405
+ classes.push('fs-list-row-group-footer');
1407
1406
  }
1408
1407
  else {
1409
- cls += ' fs-list-row-body';
1408
+ classes.push('fs-list-row-body');
1410
1409
  }
1411
1410
  if (this.rowClass) {
1412
- var options = {
1413
- index: this.rowIndex,
1414
- type: this.row.type,
1415
- };
1416
- if (this.row.isGroup) {
1417
- options.groupIndex = this.row.index;
1418
- }
1419
- else if (this.row.isChild || this.row.isGroupFooter) { // TODO fix isChild & all
1420
- options.groupIndex = this.row.parent.index;
1421
- }
1422
- var resultClass = this.rowClass(this.row.data, options);
1423
- if (typeof resultClass === 'string') {
1424
- cls += " " + resultClass;
1425
- }
1426
- else if (typeof resultClass === 'object') {
1427
- var keys = Object.keys(resultClass);
1428
- try {
1429
- for (var keys_1 = __values(keys), keys_1_1 = keys_1.next(); !keys_1_1.done; keys_1_1 = keys_1.next()) {
1430
- var k = keys_1_1.value;
1431
- if (resultClass[k] === true) {
1432
- cls += " " + k;
1433
- }
1434
- }
1435
- }
1436
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
1437
- finally {
1438
- try {
1439
- if (keys_1_1 && !keys_1_1.done && (_d = keys_1.return)) _d.call(keys_1);
1440
- }
1441
- finally { if (e_1) throw e_1.error; }
1442
- }
1443
- }
1411
+ classes = __spreadArray(__spreadArray([], __read(classes)), __read(this._getRowClasses(this.rowClass)));
1444
1412
  }
1445
- return cls;
1413
+ return classes.join(' ');
1446
1414
  },
1447
1415
  enumerable: false,
1448
1416
  configurable: true
@@ -1458,7 +1426,7 @@
1458
1426
  get: function () {
1459
1427
  return this.reorderEnabled
1460
1428
  && this.reorderPosition === exports.ReorderPosition.Left
1461
- && this.activeFiltersCount == 0;
1429
+ && this.activeFiltersCount === 0;
1462
1430
  },
1463
1431
  enumerable: false,
1464
1432
  configurable: true
@@ -1467,23 +1435,23 @@
1467
1435
  get: function () {
1468
1436
  return this.reorderEnabled
1469
1437
  && this.reorderPosition === exports.ReorderPosition.Right
1470
- && this.activeFiltersCount == 0;
1438
+ && this.activeFiltersCount === 0;
1471
1439
  },
1472
1440
  enumerable: false,
1473
1441
  configurable: true
1474
1442
  });
1475
1443
  FsRowComponent.prototype.ngOnInit = function () {
1476
- this.initRowEvents();
1477
- this.initSelection();
1444
+ this._initRowEvents();
1445
+ this._initSelection();
1478
1446
  if (this.row && this.row.isGroup) {
1479
1447
  if (this.row && this.row.isGroup && this.groupActionsRaw) {
1480
1448
  this.rowActions = this.groupActionsRaw.map(function (action) { return new RowAction(action); });
1481
- this.filterActionsByCategories();
1449
+ this._filterActionsByCategories();
1482
1450
  }
1483
1451
  }
1484
1452
  else if (this.rowActionsRaw) {
1485
1453
  this.rowActions = this.rowActionsRaw.map(function (action) { return new RowAction(action); });
1486
- this.filterActionsByCategories();
1454
+ this._filterActionsByCategories();
1487
1455
  }
1488
1456
  };
1489
1457
  FsRowComponent.prototype.ngDoCheck = function () {
@@ -1494,7 +1462,7 @@
1494
1462
  action.checkShowStatus(_this.row.data, _this.rowIndex);
1495
1463
  action.updateLink(_this.row.data);
1496
1464
  });
1497
- this.filterActionsByCategories();
1465
+ this._filterActionsByCategories();
1498
1466
  }
1499
1467
  this._cdRef.markForCheck();
1500
1468
  }
@@ -1533,13 +1501,13 @@
1533
1501
  /**
1534
1502
  * Set event listeners for row
1535
1503
  */
1536
- FsRowComponent.prototype.initRowEvents = function () {
1504
+ FsRowComponent.prototype._initRowEvents = function () {
1537
1505
  var _this = this;
1538
- var _loop_1 = function (event) {
1539
- if (this_1.rowEvents.hasOwnProperty(event)) {
1540
- var listener = this_1._renderer.listen(this_1.el.nativeElement, event, function (evt) {
1541
- // evt.preventDefault();
1542
- // evt.stopPropagation();
1506
+ Object.keys(this.rowEvents)
1507
+ .forEach(function (event) {
1508
+ if (_this.rowEvents.hasOwnProperty(event)) {
1509
+ var listener = _this._renderer
1510
+ .listen(_this.el.nativeElement, event, function (evt) {
1543
1511
  if (!_this.reorderEnabled) {
1544
1512
  _this.rowEvents[event]({
1545
1513
  event: evt,
@@ -1548,18 +1516,53 @@
1548
1516
  });
1549
1517
  }
1550
1518
  });
1551
- this_1._eventListeners.push(listener);
1519
+ _this._eventListeners.push(listener);
1552
1520
  }
1521
+ });
1522
+ };
1523
+ FsRowComponent.prototype._getRowClasses = function (rowClass) {
1524
+ var e_1, _d;
1525
+ var classes = [];
1526
+ var options = {
1527
+ index: this.rowIndex,
1528
+ type: this.row.type,
1553
1529
  };
1554
- var this_1 = this;
1555
- for (var event in this.rowEvents) {
1556
- _loop_1(event);
1530
+ if (this.row.isGroup) {
1531
+ options.groupIndex = this.row.index;
1532
+ }
1533
+ else if (this.row.isChild || this.row.isGroupFooter) { // TODO fix isChild & all
1534
+ options.groupIndex = this.row.parent.index;
1535
+ }
1536
+ var resultClass = rowClass(this.row.data, options);
1537
+ if (resultClass) {
1538
+ if (typeof resultClass === 'string') {
1539
+ classes.push(resultClass);
1540
+ }
1541
+ else if (typeof resultClass === 'object') {
1542
+ var keys = Object.keys(resultClass);
1543
+ try {
1544
+ for (var keys_1 = __values(keys), keys_1_1 = keys_1.next(); !keys_1_1.done; keys_1_1 = keys_1.next()) {
1545
+ var k = keys_1_1.value;
1546
+ if (resultClass[k] === true) {
1547
+ classes.push(k);
1548
+ }
1549
+ }
1550
+ }
1551
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
1552
+ finally {
1553
+ try {
1554
+ if (keys_1_1 && !keys_1_1.done && (_d = keys_1.return)) _d.call(keys_1);
1555
+ }
1556
+ finally { if (e_1) throw e_1.error; }
1557
+ }
1558
+ }
1557
1559
  }
1560
+ return classes;
1558
1561
  };
1559
1562
  /**
1560
1563
  * Subscribe to selection change events
1561
1564
  */
1562
- FsRowComponent.prototype.initSelection = function () {
1565
+ FsRowComponent.prototype._initSelection = function () {
1563
1566
  var _this = this;
1564
1567
  if (this.selection) {
1565
1568
  this.selected = this.row && this.selection.isRowSelected(this.row.data);
@@ -1590,7 +1593,7 @@
1590
1593
  });
1591
1594
  }
1592
1595
  };
1593
- FsRowComponent.prototype.filterActionsByCategories = function () {
1596
+ FsRowComponent.prototype._filterActionsByCategories = function () {
1594
1597
  var _this = this;
1595
1598
  this.menuRowActions = [];
1596
1599
  this.inlineRowActions = [];