@coolon/angular-ui-powerups 12.0.1 → 12.0.3

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.
@@ -3552,6 +3552,50 @@
3552
3552
  menu: [{ type: i0.ViewChild, args: [menu.MatMenuTrigger,] }]
3553
3553
  };
3554
3554
 
3555
+ var ColumnListModel = /** @class */ (function (_super) {
3556
+ __extends(ColumnListModel, _super);
3557
+ function ColumnListModel() {
3558
+ var _this = _super.call(this) || this;
3559
+ _this._allColumns = new pectin.MutableListModel();
3560
+ var chain = pectin.Dsl.disposeWith(_this).chain;
3561
+ _this.columnsById = chain(_this._allColumns).indexBy('columnId');
3562
+ return _this;
3563
+ }
3564
+ Object.defineProperty(ColumnListModel.prototype, "allColumns", {
3565
+ get: function () {
3566
+ return this._allColumns.readonly;
3567
+ },
3568
+ enumerable: false,
3569
+ configurable: true
3570
+ });
3571
+ ColumnListModel.prototype.getColumn = function (id) {
3572
+ return this.columnsById.get(id);
3573
+ };
3574
+ ColumnListModel.prototype.hasColumn = function (id) {
3575
+ return !!this.columnsById.get(id);
3576
+ };
3577
+ ColumnListModel.prototype.addColumn = function (column, index) {
3578
+ var _this = this;
3579
+ if (this.hasColumn(column.columnId)) {
3580
+ pectin.lang.illegalState("Column with id=" + column.columnId + " already exists");
3581
+ }
3582
+ this.runInTransaction(function () {
3583
+ if (!___namespace.isNil(index)) {
3584
+ _this._allColumns.insert(index, column);
3585
+ }
3586
+ else {
3587
+ _this._allColumns.push(column);
3588
+ }
3589
+ _this.trackSource(column.visible);
3590
+ });
3591
+ return column;
3592
+ };
3593
+ ColumnListModel.prototype.doComputeValue = function () {
3594
+ return this._allColumns.value.filter(function (c) { return c.visible.value; });
3595
+ };
3596
+ return ColumnListModel;
3597
+ }(pectin.AbstractComputedListModel));
3598
+
3555
3599
  var EditSession = /** @class */ (function (_super) {
3556
3600
  __extends(EditSession, _super);
3557
3601
  function EditSession(rowId, row, form, saveCommand) {
@@ -3585,32 +3629,12 @@
3585
3629
  }
3586
3630
  return RowClass;
3587
3631
  }());
3588
- var VisibleColumnListModel = /** @class */ (function (_super) {
3589
- __extends(VisibleColumnListModel, _super);
3590
- function VisibleColumnListModel() {
3591
- var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
3592
- _this.columns = [];
3593
- return _this;
3594
- }
3595
- VisibleColumnListModel.prototype.addColumn = function (column) {
3596
- var _this = this;
3597
- this.runInTransaction(function () {
3598
- _this.columns.push(column);
3599
- _this.trackSource(column.visible);
3600
- });
3601
- };
3602
- VisibleColumnListModel.prototype.doComputeValue = function () {
3603
- return this.columns.filter(function (c) { return c.visible.value; });
3604
- };
3605
- return VisibleColumnListModel;
3606
- }(pectin.AbstractComputedListModel));
3607
3632
  var AbstractTableModel = /** @class */ (function (_super) {
3608
3633
  __extends(AbstractTableModel, _super);
3609
3634
  function AbstractTableModel(sourceOfTruth) {
3610
3635
  var _this = _super.call(this) || this;
3611
3636
  _this.sourceOfTruth = sourceOfTruth;
3612
- _this._columns = new pectin.MutableListModel();
3613
- _this._visibleColumnTracker = new VisibleColumnListModel();
3637
+ _this._columnList = _this.registerDisposable(new ColumnListModel());
3614
3638
  _this._editorSessions = new pectin.MutableListModel();
3615
3639
  _this.rowClassNamePredicates = [];
3616
3640
  _this.rowClickListeners = new pectin.EventListenerList();
@@ -3620,7 +3644,6 @@
3620
3644
  };
3621
3645
  _this.identityOf = sourceOfTruth.identityOf;
3622
3646
  var _b = pectin.Dsl.disposeWith(_this), chain = _b.chain, valueOf = _b.valueOf, before = _b.before, when = _b.when, after = _b.after, observe = _b.observe, switchOn = _b.switchOn;
3623
- _this._columnsById = chain(_this._columns).indexBy('columnId');
3624
3647
  _this._rowsBeingEdited = new pectin.MutableListModel([], {
3625
3648
  identifiedWith: _this.identityOf
3626
3649
  });
@@ -3628,9 +3651,9 @@
3628
3651
  _this.editing = chain(_this._editorSessions).count().isGreaterThan(0);
3629
3652
  _this.dataSource = chain(_this.sourceOfTruth).replaceAll(_this.rowsBeingEdited);
3630
3653
  _this.firstEditableColumn = chain(_this.columns).select(function (c) { return c.hasEditorPortal(); }).first();
3631
- _this.firstVisibleColumn = chain(_this._visibleColumnTracker).first();
3632
- _this.lastVisibleColumn = chain(_this._visibleColumnTracker).last();
3633
- _this.rowSelectionDisabledOnAllColumns = chain(_this._visibleColumnTracker).select(function (column) { return column.isRowSelectionEnabled(); }).count().equals(0);
3654
+ _this.firstVisibleColumn = chain(_this._columnList).first();
3655
+ _this.lastVisibleColumn = chain(_this._columnList).last();
3656
+ _this.rowSelectionDisabledOnAllColumns = chain(_this._columnList).select(function (column) { return column.isRowSelectionEnabled(); }).count().equals(0);
3634
3657
  return _this;
3635
3658
  }
3636
3659
  Object.defineProperty(AbstractTableModel.prototype, "rowsBeingEdited", {
@@ -3642,14 +3665,14 @@
3642
3665
  });
3643
3666
  Object.defineProperty(AbstractTableModel.prototype, "columns", {
3644
3667
  get: function () {
3645
- return this._columns.readonly;
3668
+ return this._columnList.allColumns;
3646
3669
  },
3647
3670
  enumerable: false,
3648
3671
  configurable: true
3649
3672
  });
3650
3673
  Object.defineProperty(AbstractTableModel.prototype, "visibleColumns", {
3651
3674
  get: function () {
3652
- return this._visibleColumnTracker.readonly;
3675
+ return this._columnList.readonly;
3653
3676
  },
3654
3677
  enumerable: false,
3655
3678
  configurable: true
@@ -3670,7 +3693,7 @@
3670
3693
  var columnId = 'selection-column';
3671
3694
  this.selectionColumnModel = new SelectionColumnModel(columnId, function () { return _this.getColumnTextProperties(columnId); }, selectionModel);
3672
3695
  this.addRowClass('aup-row-selected', function (row) { return _this.selectionColumnModel.isSelected(row); });
3673
- var selectionColumnModel = this.addColumn(this.selectionColumnModel);
3696
+ var selectionColumnModel = this.addColumn(this.selectionColumnModel, 0);
3674
3697
  if (!___namespace.isNil(visible)) {
3675
3698
  selectionColumnModel.visibleWhile(visible instanceof pectin.ValueModel ? visible : pectin.ValueModel.constant(visible));
3676
3699
  }
@@ -3710,15 +3733,8 @@
3710
3733
  this._createForm = factory;
3711
3734
  return this;
3712
3735
  };
3713
- AbstractTableModel.prototype.addColumn = function (column) {
3714
- if (this._columnsById.get(column.columnId)) {
3715
- pectin.lang.illegalState("Column with id=" + column.columnId + " already exists");
3716
- }
3717
- else {
3718
- this._columns.push(column);
3719
- this._visibleColumnTracker.addColumn(column);
3720
- }
3721
- return column;
3736
+ AbstractTableModel.prototype.addColumn = function (column, index) {
3737
+ return this._columnList.addColumn(column, index);
3722
3738
  };
3723
3739
  // removeColumn(column: ColumnModel<Row>) {
3724
3740
  //
@@ -9704,6 +9720,7 @@
9704
9720
  exports.CellPortalRef = CellPortalRef;
9705
9721
  exports.CellRendererPortalRef = CellRendererPortalRef;
9706
9722
  exports.CheckboxInputComponent = CheckboxInputComponent;
9723
+ exports.ColumnListModel = ColumnListModel;
9707
9724
  exports.ColumnModel = ColumnModel;
9708
9725
  exports.ColumnTemplateDirective = ColumnTemplateDirective;
9709
9726
  exports.CommandComponent = CommandComponent;