@coolon/angular-ui-powerups 3.7.4 → 3.8.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [3.8.0](https://bitbucket.org/coolon/angular-ui-powerups/compare/v3.7.5...v3.8.0) (2021-02-03)
6
+
7
+
8
+ ### Features
9
+
10
+ * added TableModel.onRowClicked with auto curser and hover ([c01dbc6](https://bitbucket.org/coolon/angular-ui-powerups/commit/c01dbc683ec68ef85bbfb564f92c85d4edf4dcd6))
11
+
12
+ ### [3.7.5](https://bitbucket.org/coolon/angular-ui-powerups/compare/v3.7.4...v3.7.5) (2021-02-01)
13
+
5
14
  ### [3.7.4](https://bitbucket.org/coolon/angular-ui-powerups/compare/v3.7.3...v3.7.4) (2021-02-01)
6
15
 
7
16
  ### [3.7.3](https://bitbucket.org/coolon/angular-ui-powerups/compare/v3.7.2...v3.7.3) (2021-01-28)
@@ -2980,6 +2980,7 @@
2980
2980
  this._columns = new pectin.MutableListModel();
2981
2981
  this._editorSessions = new pectin.MutableListModel();
2982
2982
  this.rowClassNamePredicates = [];
2983
+ this.rowClickListeners = new pectin.EventListenerList();
2983
2984
  this._createForm = function (row) { return new pectin.DirtyTrackingForm(); };
2984
2985
  this.trackBy = function (index, item) {
2985
2986
  return _this.identityOf ? _this.identityOf(item) : index;
@@ -2995,7 +2996,6 @@
2995
2996
  this.dataSource = chain(this.sourceOfTruth).replaceAll(this.rowsBeingEdited);
2996
2997
  this.firstEditableColumn = chain(this.columns).select(function (c) { return c.hasEditorPortal(); }).first();
2997
2998
  this.hasColumnsWithRowSelectionExplicitlyEnabled = chain(this._columns).findIndex(function (column) { return column.isRowSelectionExplicitlyEnabled(); }).isGreaterThanOrEqualTo(0);
2998
- this.addRowClass('enable-hover', function () { return _this.isRowSelectionEnabled(); });
2999
2999
  }
3000
3000
  TableModel.fromList = function (sourceOfTruth, builder) {
3001
3001
  var model = new TableModel_1(sourceOfTruth);
@@ -3115,10 +3115,31 @@
3115
3115
  TableModel.prototype.isRowSelectionEnabled = function () {
3116
3116
  return this.hasColumnsWithRowSelectionExplicitlyEnabled.value || this.isRowSelectionEnabledByDefault();
3117
3117
  };
3118
+ TableModel.prototype.isHoverEnabled = function () {
3119
+ return this.isRowSelectionEnabled() || this.rowClickListeners.listenerCount > 0;
3120
+ };
3121
+ TableModel.prototype.isCursorEnabled = function (column) {
3122
+ // console.log({
3123
+ // column: column.columnId,
3124
+ // rowSelectionEnabled: this.isRowSelectionEnabledFor(column),
3125
+ // hasRowListeners: this.rowClickListeners.listenerCount > 0
3126
+ // });
3127
+ return this.isRowSelectionEnabledFor(column) || this.rowClickListeners.listenerCount > 0;
3128
+ };
3118
3129
  TableModel.prototype.selectRow = function (row) {
3119
3130
  var _a;
3120
3131
  (_a = this.selectionColumnModel) === null || _a === void 0 ? void 0 : _a.selectRow(row);
3121
3132
  };
3133
+ TableModel.prototype.onRowClicked = function (callback) {
3134
+ return this.rowClickListeners.add(callback);
3135
+ };
3136
+ // @Trace()
3137
+ TableModel.prototype._notifyCellClicked = function (columnModel, row) {
3138
+ if (this.isRowSelectionEnabledFor(columnModel)) {
3139
+ this.selectRow(row);
3140
+ }
3141
+ this.rowClickListeners.fire(function (l) { return l(row); });
3142
+ };
3122
3143
  return TableModel;
3123
3144
  }());
3124
3145
  exports.TableModel = TableModel_1 = __decorate([
@@ -3173,17 +3194,15 @@
3173
3194
  column.setTemplate(templateRef, viewContainer, fillCell, padChild);
3174
3195
  }
3175
3196
  };
3176
- TableComponent.prototype.onCellClicked = function (columnModel, row) {
3177
- if (this.tableModel.isRowSelectionEnabledFor(columnModel)) {
3178
- this.tableModel.selectRow(row);
3179
- }
3197
+ TableComponent.prototype.notifyCellClicked = function (columnModel, row) {
3198
+ this.tableModel._notifyCellClicked(columnModel, row);
3180
3199
  };
3181
3200
  return TableComponent;
3182
3201
  }(DisposableComponent));
3183
3202
  TableComponent.decorators = [
3184
3203
  { type: i0.Component, args: [{
3185
3204
  selector: 'aup-table',
3186
- template: "<table mat-table [dataSource]=\"tableModel.dataSource.value\" [trackBy]=\"tableModel.trackBy\">\n\n <ng-container *ngFor=\"let column of columns.value; index as index; first as first; last as last\" matColumnDef=\"{{column.columnId}}\">\n <th mat-header-cell *matHeaderCellDef>\n <aup-table-header-cell-renderer [column]=\"column\"\n [attr.column-index]=\"index\"\n [attr.column-id]=\"column.columnId\"\n [class.first-column]=\"first\"\n [class.last-column]=\"last\"\n ></aup-table-header-cell-renderer>\n </th>\n <td mat-cell *matCellDef=\"let row\" (click)=\"onCellClicked(column, row)\" [class.enable-cursor]=\"tableModel.isRowSelectionEnabledFor(column)\">\n <aup-table-cell-renderer [column]=\"column\"\n [row]=\"row\"\n [tableModel]=\"tableModel\"\n [editSession]=\"tableModel.getEditSessionFor(row)\"\n [attr.column-index]=\"index\"\n [attr.column-id]=\"column.columnId\"\n [class.first-column]=\"first\"\n [class.last-column]=\"last\"\n ></aup-table-cell-renderer>\n </td>\n </ng-container>\n\n <tr mat-header-row *matHeaderRowDef=\"columnIds.value\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: columnIds.value; let i = index\"\n [ngClass]=\"tableModel.getRowClasses(row)\" [attr.trackBy]=\"tableModel.trackBy(i, row)\"\n ></tr>\n\n</table>\n",
3205
+ template: "<table mat-table [dataSource]=\"tableModel.dataSource.value\" [trackBy]=\"tableModel.trackBy\">\n\n <ng-container *ngFor=\"let column of columns.value; index as index; first as first; last as last\" matColumnDef=\"{{column.columnId}}\">\n <th mat-header-cell *matHeaderCellDef>\n <aup-table-header-cell-renderer [column]=\"column\"\n [attr.column-index]=\"index\"\n [attr.column-id]=\"column.columnId\"\n [class.first-column]=\"first\"\n [class.last-column]=\"last\"\n ></aup-table-header-cell-renderer>\n </th>\n <td mat-cell *matCellDef=\"let row\" (click)=\"notifyCellClicked(column, row)\" [class.enable-cursor]=\"tableModel.isCursorEnabled(column)\">\n <aup-table-cell-renderer [column]=\"column\"\n [row]=\"row\"\n [tableModel]=\"tableModel\"\n [editSession]=\"tableModel.getEditSessionFor(row)\"\n [attr.column-index]=\"index\"\n [attr.column-id]=\"column.columnId\"\n [class.first-column]=\"first\"\n [class.last-column]=\"last\"\n ></aup-table-cell-renderer>\n </td>\n </ng-container>\n\n <tr mat-header-row *matHeaderRowDef=\"columnIds.value\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: columnIds.value; let i = index\"\n [ngClass]=\"tableModel.getRowClasses(row)\" [class.enable-hover]=\"tableModel.isHoverEnabled()\" [attr.trackBy]=\"tableModel.trackBy(i, row)\"\n ></tr>\n\n</table>\n",
3187
3206
  styles: [":host{align-items:stretch;display:flex;flex-direction:column}:host table{flex:1;width:100%}"]
3188
3207
  },] }
3189
3208
  ];
@@ -6186,26 +6205,16 @@
6186
6205
  var NoAuth = /** @class */ (function () {
6187
6206
  function NoAuth() {
6188
6207
  }
6208
+ // @Trace()
6189
6209
  NoAuth.prototype.isAuthenticated = function () {
6190
6210
  return true;
6191
6211
  };
6212
+ // @Trace()
6192
6213
  NoAuth.prototype.isAuthorised = function (placeDefinition) {
6193
6214
  return true;
6194
6215
  };
6195
6216
  return NoAuth;
6196
6217
  }());
6197
- __decorate([
6198
- pectin.Trace(),
6199
- __metadata("design:type", Function),
6200
- __metadata("design:paramtypes", []),
6201
- __metadata("design:returntype", Object)
6202
- ], NoAuth.prototype, "isAuthenticated", null);
6203
- __decorate([
6204
- pectin.Trace(),
6205
- __metadata("design:type", Function),
6206
- __metadata("design:paramtypes", [PlaceDefinition]),
6207
- __metadata("design:returntype", Boolean)
6208
- ], NoAuth.prototype, "isAuthorised", null);
6209
6218
  PlaceAccessGuard.NoAuth = NoAuth;
6210
6219
  })(exports.PlaceAccessGuard || (exports.PlaceAccessGuard = {}));
6211
6220