@coolon/angular-ui-powerups 1.13.1 → 1.13.2

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.
Files changed (53) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/bundles/coolon-angular-ui-powerups.umd.js +415 -399
  3. package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
  4. package/bundles/coolon-angular-ui-powerups.umd.min.js +2 -2
  5. package/bundles/coolon-angular-ui-powerups.umd.min.js.map +1 -1
  6. package/coolon-angular-ui-powerups.metadata.json +1 -1
  7. package/esm2015/lib/components/components.module.js +3 -1
  8. package/esm2015/lib/components/components.module.js.map +1 -1
  9. package/esm2015/lib/components/components.module.metadata.json +1 -1
  10. package/esm2015/lib/components/components.module.ngfactory.js.map +1 -1
  11. package/esm2015/lib/components/scroll-container/scroll-container.component.js +1 -1
  12. package/esm2015/lib/components/scroll-container/scroll-container.component.js.map +1 -1
  13. package/esm2015/lib/components/scroll-container/scroll-container.component.metadata.json +1 -1
  14. package/esm2015/lib/components/table/cell-editors.js.map +1 -1
  15. package/esm2015/lib/components/table/column-model.js +4 -20
  16. package/esm2015/lib/components/table/column-model.js.map +1 -1
  17. package/esm2015/lib/components/table/column-model.metadata.json +1 -1
  18. package/esm2015/lib/components/table/table-cell-renderer/table-cell-renderer.component.js +20 -8
  19. package/esm2015/lib/components/table/table-cell-renderer/table-cell-renderer.component.js.map +1 -1
  20. package/esm2015/lib/components/table/table-cell-renderer/table-cell-renderer.component.metadata.json +1 -1
  21. package/esm2015/lib/components/table/table-model.js +2 -1
  22. package/esm2015/lib/components/table/table-model.js.map +1 -1
  23. package/esm2015/lib/components/table/table-model.metadata.json +1 -1
  24. package/esm2015/lib/interaction/components/popup-interaction-context/popup-interaction-context.component.js +23 -7
  25. package/esm2015/lib/interaction/components/popup-interaction-context/popup-interaction-context.component.js.map +1 -1
  26. package/esm2015/lib/interaction/components/popup-interaction-context/popup-interaction-context.component.metadata.json +1 -1
  27. package/esm2015/lib/place/components/place-outlet/place-outlet.component.js +2 -2
  28. package/esm2015/lib/place/components/place-outlet/place-outlet.component.js.map +1 -1
  29. package/esm2015/lib/place/components/place-outlet/place-outlet.component.metadata.json +1 -1
  30. package/esm5/lib/components/components.module.js +3 -1
  31. package/esm5/lib/components/components.module.js.map +1 -1
  32. package/esm5/lib/components/components.module.ngfactory.js.map +1 -1
  33. package/esm5/lib/components/scroll-container/scroll-container.component.js +1 -1
  34. package/esm5/lib/components/scroll-container/scroll-container.component.js.map +1 -1
  35. package/esm5/lib/components/table/cell-editors.js.map +1 -1
  36. package/esm5/lib/components/table/column-model.js +4 -20
  37. package/esm5/lib/components/table/column-model.js.map +1 -1
  38. package/esm5/lib/components/table/table-cell-renderer/table-cell-renderer.component.js +29 -15
  39. package/esm5/lib/components/table/table-cell-renderer/table-cell-renderer.component.js.map +1 -1
  40. package/esm5/lib/components/table/table-model.js +2 -1
  41. package/esm5/lib/components/table/table-model.js.map +1 -1
  42. package/esm5/lib/interaction/components/popup-interaction-context/popup-interaction-context.component.js +23 -7
  43. package/esm5/lib/interaction/components/popup-interaction-context/popup-interaction-context.component.js.map +1 -1
  44. package/esm5/lib/place/components/place-outlet/place-outlet.component.js +2 -2
  45. package/esm5/lib/place/components/place-outlet/place-outlet.component.js.map +1 -1
  46. package/fesm2015/coolon-angular-ui-powerups.js +387 -372
  47. package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
  48. package/fesm5/coolon-angular-ui-powerups.js +414 -397
  49. package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
  50. package/lib/components/table/table-cell-renderer/table-cell-renderer.component.d.ts +6 -2
  51. package/lib/components/table/table-model.d.ts +2 -1
  52. package/lib/interaction/components/popup-interaction-context/popup-interaction-context.component.d.ts +3 -2
  53. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import { __extends, __decorate, __metadata, __param, __awaiter, __generator, __assign, __spread } from 'tslib';
2
2
  import { DOCUMENT, CommonModule, Location } from '@angular/common';
3
- import { ElementRef, Inject, Input, HostListener, Directive, NgZone, ɵɵdefineInjectable, ɵɵinject, Injectable, NgModule, HostBinding, Component, InjectionToken, Injector, ComponentFactoryResolver, ViewContainerRef, ViewChild, ViewChildren, QueryList, Optional, EventEmitter, Output, ContentChild, TemplateRef, Self, ChangeDetectorRef, ContentChildren, SkipSelf } from '@angular/core';
3
+ import { ElementRef, Inject, Input, HostListener, Directive, NgZone, ɵɵdefineInjectable, ɵɵinject, Injectable, NgModule, HostBinding, Component, InjectionToken, Injector, ComponentFactoryResolver, ViewContainerRef, ViewChild, ViewChildren, QueryList, Optional, SkipSelf, EventEmitter, Output, ContentChild, TemplateRef, Self, ChangeDetectorRef, ContentChildren } from '@angular/core';
4
4
  import { FormsModule } from '@angular/forms';
5
5
  import { MatFormFieldModule } from '@angular/material/form-field';
6
6
  import { MatInputModule } from '@angular/material/input';
@@ -8,6 +8,7 @@ import { MatSelectModule } from '@angular/material/select';
8
8
  import { MatTabsModule, MatTabGroup, MAT_TABS_CONFIG } from '@angular/material/tabs';
9
9
  import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
10
10
  import { ComponentPortal, PortalModule, TemplatePortal } from '@angular/cdk/portal';
11
+ import { CdkScrollableModule } from '@angular/cdk/scrolling';
11
12
  import { MatButtonModule } from '@angular/material/button';
12
13
  import { MatCheckboxModule } from '@angular/material/checkbox';
13
14
  import { MatIconModule } from '@angular/material/icon';
@@ -18,7 +19,7 @@ import { MatDialogModule, MatDialog, MatDialogConfig, MAT_DIALOG_DEFAULT_OPTIONS
18
19
  import { RouterModule, UrlSegment, Router, UrlSerializer, NavigationStart, NavigationEnd, NavigationError, NavigationCancel, RouterOutlet } from '@angular/router';
19
20
  import ___default, { isEqual, isNil } from 'lodash';
20
21
  import { assert as assert$1, lang as lang$1, Opts, Klass } from '@coolon/typescript-utilities';
21
- import { Overlay } from '@angular/cdk/overlay';
22
+ import { Overlay, CdkScrollable } from '@angular/cdk/overlay';
22
23
  import { Memoize } from '@typescript-plus/fast-memoize-decorator/dist/src';
23
24
  import produce from 'immer';
24
25
  import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
@@ -1271,13 +1272,14 @@ var AddItemInteractionContextComponent = /** @class */ (function (_super) {
1271
1272
 
1272
1273
  var PopupInteractionContextComponent = /** @class */ (function (_super) {
1273
1274
  __extends(PopupInteractionContextComponent, _super);
1274
- function PopupInteractionContextComponent(_element, _overlay) {
1275
+ function PopupInteractionContextComponent(_element, _overlay, scrollable) {
1275
1276
  var _this = _super.call(this) || this;
1276
1277
  _this._element = _element;
1277
1278
  _this._overlay = _overlay;
1278
1279
  _this.outputPortal = new ComponentPortal(InPlaceInteractionContextComponent);
1279
1280
  _this.anchorX = 'start';
1280
1281
  _this.anchorY = 'bottom';
1282
+ _this.scrollContainers = scrollable ? [scrollable] : [];
1281
1283
  return _this;
1282
1284
  }
1283
1285
  Object.defineProperty(PopupInteractionContextComponent.prototype, "active", {
@@ -1289,14 +1291,21 @@ var PopupInteractionContextComponent = /** @class */ (function (_super) {
1289
1291
  });
1290
1292
  PopupInteractionContextComponent.prototype.startActivity = function (activityType, data) {
1291
1293
  var _this = this;
1294
+ // console.log({ element: this._element });
1295
+ var self = this;
1292
1296
  var overlayRef = this._overlay.create({
1293
1297
  hasBackdrop: false,
1294
1298
  panelClass: 'aup-popup-interaction-panel',
1295
1299
  positionStrategy: this._overlay.position()
1296
1300
  .flexibleConnectedTo(this._element)
1301
+ .withPush(true)
1297
1302
  .withPositions(this.computePositions())
1298
1303
  .withGrowAfterOpen(true)
1304
+ .withScrollableContainers(self.scrollContainers) // this isn't working. sigh.
1299
1305
  });
1306
+ var subs = this.scrollContainers.map(function (sc) { return sc.elementScrolled().subscribe(function () {
1307
+ overlayRef.updatePosition();
1308
+ }); });
1300
1309
  var componentRef = overlayRef.attach(this.outputPortal);
1301
1310
  this.interactionContext = componentRef.instance;
1302
1311
  return new Promise(function (resolve, reject) {
@@ -1305,7 +1314,13 @@ var PopupInteractionContextComponent = /** @class */ (function (_super) {
1305
1314
  _this.interactionContext.startActivity(activityType, data)
1306
1315
  .then(resolve)
1307
1316
  .catch(reject)
1308
- .finally(function () { return overlayRef.dispose(); });
1317
+ .finally(function () {
1318
+ subs.forEach(function (s) { return s.unsubscribe(); });
1319
+ overlayRef.dispose();
1320
+ });
1321
+ setTimeout(function () {
1322
+ overlayRef.updatePosition();
1323
+ });
1309
1324
  });
1310
1325
  });
1311
1326
  };
@@ -1331,7 +1346,8 @@ var PopupInteractionContextComponent = /** @class */ (function (_super) {
1331
1346
  };
1332
1347
  PopupInteractionContextComponent.ctorParameters = function () { return [
1333
1348
  { type: ElementRef },
1334
- { type: Overlay }
1349
+ { type: Overlay },
1350
+ { type: CdkScrollable, decorators: [{ type: Optional }, { type: SkipSelf }] }
1335
1351
  ]; };
1336
1352
  __decorate([
1337
1353
  HostBinding('class.interaction-active'),
@@ -1352,7 +1368,8 @@ var PopupInteractionContextComponent = /** @class */ (function (_super) {
1352
1368
  template: "<ng-content></ng-content>\n",
1353
1369
  styles: [":host{display:inline}:host.interaction-active{background:rgba(0,0,0,.05)}"]
1354
1370
  }),
1355
- __metadata("design:paramtypes", [ElementRef, Overlay])
1371
+ __param(2, Optional()), __param(2, SkipSelf()),
1372
+ __metadata("design:paramtypes", [ElementRef, Overlay, CdkScrollable])
1356
1373
  ], PopupInteractionContextComponent);
1357
1374
  return PopupInteractionContextComponent;
1358
1375
  }(DisposableComponent));
@@ -2243,7 +2260,7 @@ var ScrollContainerComponent = /** @class */ (function () {
2243
2260
  ScrollContainerComponent = __decorate([
2244
2261
  Component({
2245
2262
  selector: 'aup-scroll-container',
2246
- template: "<div class=\"container\">\n <ng-content></ng-content>\n</div>\n",
2263
+ template: "<div class=\"container\" cdkScrollable>\n <ng-content></ng-content>\n</div>\n",
2247
2264
  styles: [":host{display:flex;flex-direction:column;min-height:0;align-items:stretch}.container{display:flex;flex-direction:column;flex:1;flex-basis:0;overflow-y:scroll;align-items:stretch}"]
2248
2265
  }),
2249
2266
  __metadata("design:paramtypes", [])
@@ -2564,400 +2581,110 @@ var SelectHeaderCellRendererComponent = /** @class */ (function (_super) {
2564
2581
  return SelectHeaderCellRendererComponent;
2565
2582
  }(DisposableComponent));
2566
2583
 
2567
- // export type StringPropertiesOf<T> = { [K in keyof T]: T[K] extends string ? K : never }[keyof T];
2568
- // export type NumberPropertiesOf<T> = { [K in keyof T]: T[K] extends number ? K : never }[keyof T];
2569
- /**
2570
- * Example:
2571
- * @example
2572
- * const model = TableModel.fromList(heroList, table => {
2573
- * table.pluck("firstName");
2574
- * table.pluck("lastName");
2575
- * table.addCustomColumn("fullName", hero => `${hero.firstName} ${hero.lastName}`);
2576
- * });
2577
- *
2578
- * Editable tables
2579
- * @example
2580
- * const saveCommand = UnaryCommand.create((form: Form<Hero>) => {
2581
- * if (form.validate()) {
2582
- * // normal form save stuff
2583
- * return true; // finish editing
2584
- * }
2585
- * return false; // continue editiing
2586
- * }
2587
- * const colorsNames: ListModel<string> = ...;
2588
- * const model = TableModel.fromList(heroList, table => {
2589
- * table.pluck("firstName").cellEditor(StringInputComponent); <-- interface CellEditor { valueModel: FormValueModel<string> | ValueModel<string>; }
2590
- * table.pluck("lastName").cellEditor(StringInputComponent, {
2591
- * validators: [Validator.present("We need a last name")]
2592
- * });
2593
- * table.pluck("age").cellEditor(NumberInputComponent);
2594
- * table.pluck("favoriteColor").cellEditor(SelectInputComponent, {
2595
- * initialiseComponent(component: SelectInputComponent) {
2596
- * selectInput.optionsModel = colorsNames; // <- initialise our component
2597
- * }
2598
- * });
2599
- * table.addEditControls(saveCommand); // <- required to enable editing
2600
- * });
2601
- *
2602
- * Selection models
2603
- * @example
2604
- * const model = TableModel.fromList(heroList, table => {
2605
- * table.addSelectionColumn(selectionModel); // <- can be single or multiple selection model
2606
- * table.pluck("firstName");
2607
- * table.pluck("lastName");
2608
- * });
2609
- *
2610
- * Custom cell renderers and editors
2611
- * @example
2612
- * const model = TableModel.fromList(heroList, table => {
2613
- * table.pluck("favoriteColor")
2614
- * .cellHeaderRenderer(CellHeaderRendererComponent, (component, column) => {
2615
- * // configure your component with what ever you need.
2616
- * });
2617
- * .cellRenderer(CellRendererComponent) // <-- interface CellEditor { value: string; }
2618
- * .cellEditor(CellEditorComponent.); // <-- interface CellEditor { valueModel: FormValueModel<string> | ValueModel<string>; }
2619
- * table.addCustomColumn("fullName", hero => `${hero.firstName} ${hero.lastName}`);
2620
- * });
2621
- *
2622
- * I18n
2623
- * @example
2624
- * [table.yml]
2625
- * table:
2626
- * columns(ColumnTextProperties[]):
2627
- * firstName:
2628
- * headerText: "First Name"
2629
- * fullName:
2630
- * headerText: "Full Name"
2631
- *
2632
- * const model = TableModel.fromList(heroList, table => {
2633
- * table.pluck("favoriteColor").cellRenderer(...).cellEditor(...);
2634
- * table.addCustomColumn("fullName", hero => `${hero.firstName} ${hero.lastName}`);
2635
- *
2636
- * table.columnTextProperties(I18n.table.columns); // <- configures all columns
2637
- * });
2638
- */
2639
- var TableModel = /** @class */ (function () {
2640
- function TableModel(sourceOfTruth) {
2641
- this.sourceOfTruth = sourceOfTruth;
2642
- this._garbage = new GarbageCollector();
2643
- this._columns = new MutableListModel();
2644
- this._editorSessions = new MutableListModel();
2645
- this._createForm = function (row) { return new Form(); };
2646
- this.identityOf = sourceOfTruth.identityOf;
2647
- var _a = Dsl.disposeWith(this._garbage), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
2648
- this._columnsById = chain(this._columns).indexBy('columnId');
2649
- this._rowsBeingEdited = new MutableListModel([], {
2650
- identifiedWith: this.identityOf
2651
- });
2652
- this._editorSessionByRowId = chain(this._editorSessions).indexBy('rowId');
2653
- this.editing = chain(this._editorSessions).count().isGreaterThan(0);
2654
- this.dataSource = chain(this.sourceOfTruth).replaceAll(this.rowsBeingEdited);
2584
+ var HEADER_CELL_RENDERER_PORTAL = Symbol('aup-cell-header-renderer-component-ref');
2585
+ var CELL_RENDERER_PORTAL = Symbol('aup-cell-renderer-component-ref');
2586
+ var CELL_EDITOR_PORTAL = Symbol('aup-cell-editor-component-ref');
2587
+ var PORTAL_RENDERER_COMPONENT = Symbol('aup-cell-renderer-portal-component');
2588
+ var PORTAL_EDITOR_COMPONENT = Symbol('aup-cell-editor-portal-component');
2589
+ var noop = function () {
2590
+ };
2591
+ var ɵ0 = noop;
2592
+ var CellPortalRef = /** @class */ (function () {
2593
+ function CellPortalRef() {
2655
2594
  }
2656
- TableModel_1 = TableModel;
2657
- TableModel.fromList = function (sourceOfTruth, builder) {
2658
- var model = new TableModel_1(sourceOfTruth);
2659
- builder(model);
2660
- return model;
2661
- };
2662
- Object.defineProperty(TableModel.prototype, "rowsBeingEdited", {
2663
- get: function () {
2664
- return this._rowsBeingEdited.readonly;
2665
- },
2666
- enumerable: true,
2667
- configurable: true
2668
- });
2669
- TableModel.prototype.getTrackByFunction = function () {
2670
- var _this = this;
2671
- return function (index, item) {
2672
- return _this.identityOf ? _this.identityOf(item) : index;
2673
- };
2595
+ return CellPortalRef;
2596
+ }());
2597
+ var CellHeaderPortalRef = /** @class */ (function (_super) {
2598
+ __extends(CellHeaderPortalRef, _super);
2599
+ function CellHeaderPortalRef(componentType, initialiseHeader) {
2600
+ var _this = _super.call(this) || this;
2601
+ _this.componentType = componentType;
2602
+ _this.initialiseHeader = initialiseHeader;
2603
+ return _this;
2604
+ }
2605
+ CellHeaderPortalRef.prototype.initialiseHost = function (host, columnModel) {
2606
+ assert$1.isTruthy(host);
2607
+ host[HEADER_CELL_RENDERER_PORTAL] = new ComponentPortal(this.componentType);
2674
2608
  };
2675
- Object.defineProperty(TableModel.prototype, "columns", {
2676
- get: function () {
2677
- return this._columns.readonly;
2678
- },
2679
- enumerable: true,
2680
- configurable: true
2681
- });
2682
- TableModel.prototype.pluck = function (property) {
2683
- return this.addColumn(new PropertyColumnModel(property, this));
2609
+ CellHeaderPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
2610
+ this.initialiseHeader(portalComponent, host.column);
2684
2611
  };
2685
- TableModel.prototype.pluckList = function (property) {
2686
- return this.addColumn(new ListPropertyColumnModel(property, this));
2612
+ return CellHeaderPortalRef;
2613
+ }(CellPortalRef));
2614
+ var CellRendererPortalRef = /** @class */ (function (_super) {
2615
+ __extends(CellRendererPortalRef, _super);
2616
+ function CellRendererPortalRef() {
2617
+ return _super !== null && _super.apply(this, arguments) || this;
2618
+ }
2619
+ return CellRendererPortalRef;
2620
+ }(CellPortalRef));
2621
+ var ComponentCellRendererPortalRef = /** @class */ (function (_super) {
2622
+ __extends(ComponentCellRendererPortalRef, _super);
2623
+ function ComponentCellRendererPortalRef(componentType, updateComponent) {
2624
+ var _this = _super.call(this) || this;
2625
+ _this.componentType = componentType;
2626
+ _this.updateComponent = updateComponent;
2627
+ return _this;
2628
+ }
2629
+ ComponentCellRendererPortalRef.prototype.initialiseHost = function (host, columnModel) {
2630
+ host[CELL_RENDERER_PORTAL] = new ComponentPortal(this.componentType);
2687
2631
  };
2688
- TableModel.prototype.addSelectionColumn = function (selectionModel) {
2689
- return this.addColumn(new SelectionColumnModel('selection', this, selectionModel));
2632
+ ComponentCellRendererPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
2633
+ host[PORTAL_RENDERER_COMPONENT] = portalComponent;
2634
+ this.updateComponent(portalComponent, host.getRowData());
2690
2635
  };
2691
- TableModel.prototype.addEditControls = function (saveCommand) {
2692
- this.saveCommand = saveCommand;
2693
- return this.addColumn(new EditorControlColumnModel('editControls', saveCommand, this));
2636
+ ComponentCellRendererPortalRef.prototype.pushState = function (host) {
2637
+ if (host[PORTAL_RENDERER_COMPONENT]) {
2638
+ this.updateComponent(host[PORTAL_RENDERER_COMPONENT], host.getRowData());
2639
+ }
2694
2640
  };
2695
- TableModel.prototype.addCustomColumn = function (columnId, dataAccessor) {
2696
- return this.addColumn(new CustomValueColumnModel(columnId, this, dataAccessor));
2641
+ return ComponentCellRendererPortalRef;
2642
+ }(CellRendererPortalRef));
2643
+ var CellEditorPortalRef = /** @class */ (function (_super) {
2644
+ __extends(CellEditorPortalRef, _super);
2645
+ function CellEditorPortalRef(componentType, initialiseEditorSession) {
2646
+ var _this = _super.call(this) || this;
2647
+ _this.componentType = componentType;
2648
+ _this.initialiseEditorSession = initialiseEditorSession;
2649
+ return _this;
2650
+ }
2651
+ CellEditorPortalRef.prototype.initialiseHost = function (host, columnModel) {
2652
+ assert$1.isTruthy(host);
2653
+ host[CELL_EDITOR_PORTAL] = new ComponentPortal(this.componentType);
2697
2654
  };
2698
- TableModel.prototype.addTemplateColumn = function (columnId) {
2699
- return this.addColumn(new CustomTemplateColumnModel(columnId, this));
2655
+ // @Trace()
2656
+ CellEditorPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
2657
+ host[PORTAL_EDITOR_COMPONENT] = portalComponent;
2658
+ this.initialiseEditorSession(portalComponent, host.editSession);
2700
2659
  };
2701
- TableModel.prototype.useFormFactory = function (factory) {
2702
- this._createForm = factory;
2703
- return this;
2660
+ return CellEditorPortalRef;
2661
+ }(CellPortalRef));
2662
+ var TemplateCellRendererPortalRef = /** @class */ (function (_super) {
2663
+ __extends(TemplateCellRendererPortalRef, _super);
2664
+ function TemplateCellRendererPortalRef() {
2665
+ return _super.call(this) || this;
2666
+ }
2667
+ TemplateCellRendererPortalRef.prototype.registerPortal = function (templateRef, viewContainer, fillCell, padChild) {
2668
+ this.templateRef = templateRef;
2669
+ this.viewContainer = viewContainer;
2670
+ this.fillCell = fillCell;
2671
+ this.padChild = padChild;
2704
2672
  };
2705
- TableModel.prototype.addColumn = function (column) {
2706
- if (this._columnsById.get(column.columnId)) {
2707
- lang.illegalState("Column with id=" + column.columnId + " already exists");
2708
- }
2709
- else {
2710
- this._columns.push(column);
2711
- }
2712
- return column;
2673
+ TemplateCellRendererPortalRef.prototype.initialiseHost = function (host, columnModel) {
2674
+ assert$1.isTruthy(host);
2713
2675
  };
2714
- TableModel.prototype.columnTextProperties = function (columnTextProperties) {
2715
- this._columnTextPropertiesLookup = columnTextProperties;
2676
+ // @Trace()
2677
+ TemplateCellRendererPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
2678
+ // don't care
2716
2679
  };
2717
- TableModel.prototype.getColumnTextProperties = function (column) {
2718
- var factory = this._columnTextPropertiesLookup ? this._columnTextPropertiesLookup[column.columnId] : undefined;
2719
- return factory ? factory() : undefined;
2680
+ TemplateCellRendererPortalRef.prototype.pushState = function (host) {
2681
+ host[CELL_RENDERER_PORTAL] = this.createPortal(host.getRowData());
2682
+ host.fillCell = this.fillCell;
2683
+ host.padChild = this.padChild;
2720
2684
  };
2721
- TableModel.prototype.startEditSession = function (row) {
2722
- var _this = this;
2723
- var rowId = this.identityOf(row);
2724
- if (this._rowsBeingEdited.query().indexOf(row) > -1) {
2725
- return lang.illegalState("Row with id=" + rowId + " already being edited");
2726
- }
2727
- else {
2728
- var editSession_1 = new EditSession(rowId, row, this._createForm(row), this.saveCommand);
2729
- var when = Dsl.disposeWith(editSession_1).when;
2730
- when.valueOf(editSession_1.liveRowValue).changes(function (editedValue) {
2731
- _this._rowsBeingEdited.replaceOrPush(editedValue);
2732
- }, { initialValue: 'triggerChangeUnlessNil' });
2733
- this._editorSessions.push(editSession_1);
2734
- editSession_1.onDispose(function () {
2735
- _this._rowsBeingEdited.remove(editSession_1.liveRowValue.value);
2736
- _this._editorSessions.remove(editSession_1);
2737
- });
2738
- return editSession_1;
2739
- }
2685
+ TemplateCellRendererPortalRef.prototype.createPortal = function (data) {
2686
+ return new TemplatePortal(this.templateRef, this.viewContainer, __assign(__assign({}, (data)), { $implicit: data.row }));
2740
2687
  };
2741
- TableModel.prototype.getEditSessionFor = function (row) {
2742
- return this._editorSessionByRowId.get(this.identityOf(row));
2743
- };
2744
- TableModel.prototype.cancelAllEditorSessions = function () {
2745
- var _this = this;
2746
- this._editorSessions.runInTransaction(function (draft) {
2747
- _this._rowsBeingEdited.runInTransaction(function () {
2748
- draft.value.forEach(function (session) { return session.dispose(); });
2749
- });
2750
- });
2751
- };
2752
- var TableModel_1;
2753
- TableModel.ctorParameters = function () { return [
2754
- { type: ListModel }
2755
- ]; };
2756
- TableModel = TableModel_1 = __decorate([
2757
- TrackExternal.Strategy(new TrackExternal.OneTimeBinding()),
2758
- __metadata("design:paramtypes", [ListModel])
2759
- ], TableModel);
2760
- return TableModel;
2761
- }());
2762
-
2763
- var TableCellRendererComponent = /** @class */ (function () {
2764
- function TableCellRendererComponent() {
2765
- var _this = this;
2766
- this.defaultClassNames = 'aup-cell-renderer';
2767
- this.fillCell = false;
2768
- this.padChild = false;
2769
- this.editRowCommand = Command.create(function () {
2770
- _this.tableModel.startEditSession(_this.row);
2771
- });
2772
- }
2773
- TableCellRendererComponent.prototype.ngOnInit = function () {
2774
- this.column.attachCell(this);
2775
- };
2776
- TableCellRendererComponent.prototype.hasActiveEditor = function () {
2777
- return !!this.editSession && !!this.column.hasEditorPortal();
2778
- };
2779
- TableCellRendererComponent.prototype.initialiseRenderer = function (instance) {
2780
- this.column.onRendererAttached(this, instance);
2781
- };
2782
- TableCellRendererComponent.prototype.initialiseEditor = function (instance) {
2783
- this.column.onEditorAttached(this, instance);
2784
- };
2785
- // @Trace()
2786
- TableCellRendererComponent.prototype.ngOnChanges = function (changes) {
2787
- this.column.updatePortalContent(this);
2788
- };
2789
- TableCellRendererComponent.prototype.getRendererPortal = function () {
2790
- return this[CELL_RENDERER_PORTAL];
2791
- };
2792
- TableCellRendererComponent.prototype.getEditorPortal = function () {
2793
- return this[CELL_EDITOR_PORTAL];
2794
- };
2795
- TableCellRendererComponent.prototype.getRowData = function () {
2796
- return {
2797
- row: this.row,
2798
- editSession: this.editSession,
2799
- editRowCommand: this.editRowCommand
2800
- };
2801
- };
2802
- __decorate([
2803
- Input(),
2804
- __metadata("design:type", Object)
2805
- ], TableCellRendererComponent.prototype, "row", void 0);
2806
- __decorate([
2807
- Input(),
2808
- __metadata("design:type", ColumnModel)
2809
- ], TableCellRendererComponent.prototype, "column", void 0);
2810
- __decorate([
2811
- Input(),
2812
- __metadata("design:type", EditSession)
2813
- ], TableCellRendererComponent.prototype, "editSession", void 0);
2814
- __decorate([
2815
- Input(),
2816
- __metadata("design:type", TableModel)
2817
- ], TableCellRendererComponent.prototype, "tableModel", void 0);
2818
- __decorate([
2819
- HostBinding('class'),
2820
- __metadata("design:type", Object)
2821
- ], TableCellRendererComponent.prototype, "defaultClassNames", void 0);
2822
- __decorate([
2823
- HostBinding('class.fillCell'),
2824
- __metadata("design:type", Object)
2825
- ], TableCellRendererComponent.prototype, "fillCell", void 0);
2826
- __decorate([
2827
- HostBinding('class.padChild'),
2828
- __metadata("design:type", Object)
2829
- ], TableCellRendererComponent.prototype, "padChild", void 0);
2830
- __decorate([
2831
- Trace(),
2832
- __metadata("design:type", Function),
2833
- __metadata("design:paramtypes", [Object]),
2834
- __metadata("design:returntype", void 0)
2835
- ], TableCellRendererComponent.prototype, "initialiseEditor", null);
2836
- TableCellRendererComponent = __decorate([
2837
- Component({
2838
- selector: 'aup-table-cell-renderer',
2839
- template: "<ng-container *ngIf=\"!hasActiveEditor()\" [cdkPortalOutlet]=\"getRendererPortal()\" (attached)=\"initialiseRenderer($event.instance)\"></ng-container>\n<ng-container *ngIf=\"hasActiveEditor()\" [cdkPortalOutlet]=\"getEditorPortal()\" (attached)=\"initialiseEditor($event.instance)\"></ng-container>\n",
2840
- styles: [""]
2841
- }),
2842
- __metadata("design:paramtypes", [])
2843
- ], TableCellRendererComponent);
2844
- return TableCellRendererComponent;
2845
- }());
2846
-
2847
- var HEADER_CELL_RENDERER_PORTAL = Symbol('aup-cell-header-renderer-component-ref');
2848
- var CELL_RENDERER_PORTAL = Symbol('aup-cell-renderer-component-ref');
2849
- var CELL_EDITOR_PORTAL = Symbol('aup-cell-editor-component-ref');
2850
- var PORTAL_RENDERER_COMPONENT = Symbol('aup-cell-renderer-portal-component');
2851
- var PORTAL_EDITOR_COMPONENT = Symbol('aup-cell-editor-portal-component');
2852
- var noop = function () {
2853
- };
2854
- var ɵ0 = noop;
2855
- var CellPortalRef = /** @class */ (function () {
2856
- function CellPortalRef() {
2857
- }
2858
- return CellPortalRef;
2859
- }());
2860
- var CellHeaderPortalRef = /** @class */ (function (_super) {
2861
- __extends(CellHeaderPortalRef, _super);
2862
- function CellHeaderPortalRef(componentType, initialiseHeader) {
2863
- var _this = _super.call(this) || this;
2864
- _this.componentType = componentType;
2865
- _this.initialiseHeader = initialiseHeader;
2866
- return _this;
2867
- }
2868
- CellHeaderPortalRef.prototype.initialiseHost = function (host, columnModel) {
2869
- assert$1.isTruthy(host);
2870
- host[HEADER_CELL_RENDERER_PORTAL] = new ComponentPortal(this.componentType);
2871
- };
2872
- CellHeaderPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
2873
- this.initialiseHeader(portalComponent, host.column);
2874
- };
2875
- return CellHeaderPortalRef;
2876
- }(CellPortalRef));
2877
- var CellRendererPortalRef = /** @class */ (function (_super) {
2878
- __extends(CellRendererPortalRef, _super);
2879
- function CellRendererPortalRef() {
2880
- return _super !== null && _super.apply(this, arguments) || this;
2881
- }
2882
- return CellRendererPortalRef;
2883
- }(CellPortalRef));
2884
- var ComponentCellRendererPortalRef = /** @class */ (function (_super) {
2885
- __extends(ComponentCellRendererPortalRef, _super);
2886
- function ComponentCellRendererPortalRef(componentType, updateComponent) {
2887
- var _this = _super.call(this) || this;
2888
- _this.componentType = componentType;
2889
- _this.updateComponent = updateComponent;
2890
- return _this;
2891
- }
2892
- ComponentCellRendererPortalRef.prototype.initialiseHost = function (host, columnModel) {
2893
- host[CELL_RENDERER_PORTAL] = new ComponentPortal(this.componentType);
2894
- };
2895
- ComponentCellRendererPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
2896
- host[PORTAL_RENDERER_COMPONENT] = portalComponent;
2897
- this.updateComponent(portalComponent, host.getRowData());
2898
- };
2899
- ComponentCellRendererPortalRef.prototype.pushState = function (host) {
2900
- if (host[PORTAL_RENDERER_COMPONENT]) {
2901
- this.updateComponent(host[PORTAL_RENDERER_COMPONENT], host.getRowData());
2902
- }
2903
- };
2904
- return ComponentCellRendererPortalRef;
2905
- }(CellRendererPortalRef));
2906
- var CellEditorPortalRef = /** @class */ (function (_super) {
2907
- __extends(CellEditorPortalRef, _super);
2908
- function CellEditorPortalRef(componentType, initialiseEditorSession) {
2909
- var _this = _super.call(this) || this;
2910
- _this.componentType = componentType;
2911
- _this.initialiseEditorSession = initialiseEditorSession;
2912
- return _this;
2913
- }
2914
- CellEditorPortalRef.prototype.initialiseHost = function (host, columnModel) {
2915
- assert$1.isTruthy(host);
2916
- host[CELL_EDITOR_PORTAL] = new ComponentPortal(this.componentType);
2917
- };
2918
- CellEditorPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
2919
- host[PORTAL_EDITOR_COMPONENT] = portalComponent;
2920
- this.initialiseEditorSession(portalComponent, host.editSession);
2921
- };
2922
- __decorate([
2923
- Trace(),
2924
- __metadata("design:type", Function),
2925
- __metadata("design:paramtypes", [TableCellRendererComponent, Object]),
2926
- __metadata("design:returntype", void 0)
2927
- ], CellEditorPortalRef.prototype, "onPortalAttached", null);
2928
- return CellEditorPortalRef;
2929
- }(CellPortalRef));
2930
- var TemplateCellRendererPortalRef = /** @class */ (function (_super) {
2931
- __extends(TemplateCellRendererPortalRef, _super);
2932
- function TemplateCellRendererPortalRef() {
2933
- return _super.call(this) || this;
2934
- }
2935
- TemplateCellRendererPortalRef.prototype.registerPortal = function (templateRef, viewContainer, fillCell, padChild) {
2936
- this.templateRef = templateRef;
2937
- this.viewContainer = viewContainer;
2938
- this.fillCell = fillCell;
2939
- this.padChild = padChild;
2940
- };
2941
- TemplateCellRendererPortalRef.prototype.initialiseHost = function (host, columnModel) {
2942
- assert$1.isTruthy(host);
2943
- };
2944
- TemplateCellRendererPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
2945
- // don't care
2946
- };
2947
- TemplateCellRendererPortalRef.prototype.pushState = function (host) {
2948
- host[CELL_RENDERER_PORTAL] = this.createPortal(host.getRowData());
2949
- host.fillCell = this.fillCell;
2950
- host.padChild = this.padChild;
2951
- };
2952
- TemplateCellRendererPortalRef.prototype.createPortal = function (data) {
2953
- return new TemplatePortal(this.templateRef, this.viewContainer, __assign(__assign({}, (data)), { $implicit: data.row }));
2954
- };
2955
- __decorate([
2956
- Trace(),
2957
- __metadata("design:type", Function),
2958
- __metadata("design:paramtypes", [TableCellRendererComponent, void 0]),
2959
- __metadata("design:returntype", void 0)
2960
- ], TemplateCellRendererPortalRef.prototype, "onPortalAttached", null);
2961
2688
  return TemplateCellRendererPortalRef;
2962
2689
  }(CellRendererPortalRef));
2963
2690
  var ColumnModel = /** @class */ (function () {
@@ -3013,6 +2740,7 @@ var ColumnModel = /** @class */ (function () {
3013
2740
  ColumnModel.prototype.onRendererAttached = function (host, component) {
3014
2741
  this._cellRendererPortalRef.onPortalAttached(host, component);
3015
2742
  };
2743
+ // @Trace()
3016
2744
  ColumnModel.prototype.onEditorAttached = function (host, component) {
3017
2745
  this._cellEditorPortalRef.onPortalAttached(host, component);
3018
2746
  };
@@ -3031,12 +2759,6 @@ var ColumnModel = /** @class */ (function () {
3031
2759
  __metadata("design:paramtypes", []),
3032
2760
  __metadata("design:returntype", Object)
3033
2761
  ], ColumnModel.prototype, "getColumnTextProperties", null);
3034
- __decorate([
3035
- Trace(),
3036
- __metadata("design:type", Function),
3037
- __metadata("design:paramtypes", [TableCellRendererComponent, Object]),
3038
- __metadata("design:returntype", void 0)
3039
- ], ColumnModel.prototype, "onEditorAttached", null);
3040
2762
  return ColumnModel;
3041
2763
  }());
3042
2764
  var PropertyColumnModel = /** @class */ (function (_super) {
@@ -3188,6 +2910,203 @@ var SelectionColumnModel = /** @class */ (function (_super) {
3188
2910
  return SelectionColumnModel;
3189
2911
  }(ColumnModel));
3190
2912
 
2913
+ // export type StringPropertiesOf<T> = { [K in keyof T]: T[K] extends string ? K : never }[keyof T];
2914
+ // export type NumberPropertiesOf<T> = { [K in keyof T]: T[K] extends number ? K : never }[keyof T];
2915
+ /**
2916
+ * Example:
2917
+ * @example
2918
+ * const model = TableModel.fromList(heroList, table => {
2919
+ * table.pluck("firstName");
2920
+ * table.pluck("lastName");
2921
+ * table.addCustomColumn("fullName", hero => `${hero.firstName} ${hero.lastName}`);
2922
+ * });
2923
+ *
2924
+ * Editable tables
2925
+ * @example
2926
+ * const saveCommand = UnaryCommand.create((form: Form<Hero>) => {
2927
+ * if (form.validate()) {
2928
+ * // normal form save stuff
2929
+ * return true; // finish editing
2930
+ * }
2931
+ * return false; // continue editiing
2932
+ * }
2933
+ * const colorsNames: ListModel<string> = ...;
2934
+ * const model = TableModel.fromList(heroList, table => {
2935
+ * table.pluck("firstName").cellEditor(StringInputComponent); <-- interface CellEditor { valueModel: FormValueModel<string> | ValueModel<string>; }
2936
+ * table.pluck("lastName").cellEditor(StringInputComponent, {
2937
+ * validators: [Validator.present("We need a last name")]
2938
+ * });
2939
+ * table.pluck("age").cellEditor(NumberInputComponent);
2940
+ * table.pluck("favoriteColor").cellEditor(SelectInputComponent, {
2941
+ * initialiseComponent(component: SelectInputComponent) {
2942
+ * selectInput.optionsModel = colorsNames; // <- initialise our component
2943
+ * }
2944
+ * });
2945
+ * table.addEditControls(saveCommand); // <- required to enable editing
2946
+ * });
2947
+ *
2948
+ * Selection models
2949
+ * @example
2950
+ * const model = TableModel.fromList(heroList, table => {
2951
+ * table.addSelectionColumn(selectionModel); // <- can be single or multiple selection model
2952
+ * table.pluck("firstName");
2953
+ * table.pluck("lastName");
2954
+ * });
2955
+ *
2956
+ * Custom cell renderers and editors
2957
+ * @example
2958
+ * const model = TableModel.fromList(heroList, table => {
2959
+ * table.pluck("favoriteColor")
2960
+ * .cellHeaderRenderer(CellHeaderRendererComponent, (component, column) => {
2961
+ * // configure your component with what ever you need.
2962
+ * });
2963
+ * .cellRenderer(CellRendererComponent) // <-- interface CellEditor { value: string; }
2964
+ * .cellEditor(CellEditorComponent.); // <-- interface CellEditor { valueModel: FormValueModel<string> | ValueModel<string>; }
2965
+ * table.addCustomColumn("fullName", hero => `${hero.firstName} ${hero.lastName}`);
2966
+ * });
2967
+ *
2968
+ * I18n
2969
+ * @example
2970
+ * [table.yml]
2971
+ * table:
2972
+ * columns(ColumnTextProperties[]):
2973
+ * firstName:
2974
+ * headerText: "First Name"
2975
+ * fullName:
2976
+ * headerText: "Full Name"
2977
+ *
2978
+ * const model = TableModel.fromList(heroList, table => {
2979
+ * table.pluck("favoriteColor").cellRenderer(...).cellEditor(...);
2980
+ * table.addCustomColumn("fullName", hero => `${hero.firstName} ${hero.lastName}`);
2981
+ *
2982
+ * table.columnTextProperties(I18n.table.columns); // <- configures all columns
2983
+ * });
2984
+ */
2985
+ var TableModel = /** @class */ (function () {
2986
+ function TableModel(sourceOfTruth) {
2987
+ this.sourceOfTruth = sourceOfTruth;
2988
+ this._garbage = new GarbageCollector();
2989
+ this._columns = new MutableListModel();
2990
+ this._editorSessions = new MutableListModel();
2991
+ this._createForm = function (row) { return new Form(); };
2992
+ this.identityOf = sourceOfTruth.identityOf;
2993
+ var _a = Dsl.disposeWith(this._garbage), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
2994
+ this._columnsById = chain(this._columns).indexBy('columnId');
2995
+ this._rowsBeingEdited = new MutableListModel([], {
2996
+ identifiedWith: this.identityOf
2997
+ });
2998
+ this._editorSessionByRowId = chain(this._editorSessions).indexBy('rowId');
2999
+ this.editing = chain(this._editorSessions).count().isGreaterThan(0);
3000
+ this.dataSource = chain(this.sourceOfTruth).replaceAll(this.rowsBeingEdited);
3001
+ this.firstEditableColumn = chain(this.columns).select(function (c) { return c.hasEditorPortal(); }).first();
3002
+ }
3003
+ TableModel_1 = TableModel;
3004
+ TableModel.fromList = function (sourceOfTruth, builder) {
3005
+ var model = new TableModel_1(sourceOfTruth);
3006
+ builder(model);
3007
+ return model;
3008
+ };
3009
+ Object.defineProperty(TableModel.prototype, "rowsBeingEdited", {
3010
+ get: function () {
3011
+ return this._rowsBeingEdited.readonly;
3012
+ },
3013
+ enumerable: true,
3014
+ configurable: true
3015
+ });
3016
+ TableModel.prototype.getTrackByFunction = function () {
3017
+ var _this = this;
3018
+ return function (index, item) {
3019
+ return _this.identityOf ? _this.identityOf(item) : index;
3020
+ };
3021
+ };
3022
+ Object.defineProperty(TableModel.prototype, "columns", {
3023
+ get: function () {
3024
+ return this._columns.readonly;
3025
+ },
3026
+ enumerable: true,
3027
+ configurable: true
3028
+ });
3029
+ TableModel.prototype.pluck = function (property) {
3030
+ return this.addColumn(new PropertyColumnModel(property, this));
3031
+ };
3032
+ TableModel.prototype.pluckList = function (property) {
3033
+ return this.addColumn(new ListPropertyColumnModel(property, this));
3034
+ };
3035
+ TableModel.prototype.addSelectionColumn = function (selectionModel) {
3036
+ return this.addColumn(new SelectionColumnModel('selection', this, selectionModel));
3037
+ };
3038
+ TableModel.prototype.addEditControls = function (saveCommand) {
3039
+ this.saveCommand = saveCommand;
3040
+ return this.addColumn(new EditorControlColumnModel('editControls', saveCommand, this));
3041
+ };
3042
+ TableModel.prototype.addCustomColumn = function (columnId, dataAccessor) {
3043
+ return this.addColumn(new CustomValueColumnModel(columnId, this, dataAccessor));
3044
+ };
3045
+ TableModel.prototype.addTemplateColumn = function (columnId) {
3046
+ return this.addColumn(new CustomTemplateColumnModel(columnId, this));
3047
+ };
3048
+ TableModel.prototype.useFormFactory = function (factory) {
3049
+ this._createForm = factory;
3050
+ return this;
3051
+ };
3052
+ TableModel.prototype.addColumn = function (column) {
3053
+ if (this._columnsById.get(column.columnId)) {
3054
+ lang.illegalState("Column with id=" + column.columnId + " already exists");
3055
+ }
3056
+ else {
3057
+ this._columns.push(column);
3058
+ }
3059
+ return column;
3060
+ };
3061
+ TableModel.prototype.columnTextProperties = function (columnTextProperties) {
3062
+ this._columnTextPropertiesLookup = columnTextProperties;
3063
+ };
3064
+ TableModel.prototype.getColumnTextProperties = function (column) {
3065
+ var factory = this._columnTextPropertiesLookup ? this._columnTextPropertiesLookup[column.columnId] : undefined;
3066
+ return factory ? factory() : undefined;
3067
+ };
3068
+ TableModel.prototype.startEditSession = function (row) {
3069
+ var _this = this;
3070
+ var rowId = this.identityOf(row);
3071
+ if (this._rowsBeingEdited.query().indexOf(row) > -1) {
3072
+ return lang.illegalState("Row with id=" + rowId + " already being edited");
3073
+ }
3074
+ else {
3075
+ var editSession_1 = new EditSession(rowId, row, this._createForm(row), this.saveCommand);
3076
+ var when = Dsl.disposeWith(editSession_1).when;
3077
+ when.valueOf(editSession_1.liveRowValue).changes(function (editedValue) {
3078
+ _this._rowsBeingEdited.replaceOrPush(editedValue);
3079
+ }, { initialValue: 'triggerChangeUnlessNil' });
3080
+ this._editorSessions.push(editSession_1);
3081
+ editSession_1.onDispose(function () {
3082
+ _this._rowsBeingEdited.remove(editSession_1.liveRowValue.value);
3083
+ _this._editorSessions.remove(editSession_1);
3084
+ });
3085
+ return editSession_1;
3086
+ }
3087
+ };
3088
+ TableModel.prototype.getEditSessionFor = function (row) {
3089
+ return this._editorSessionByRowId.get(this.identityOf(row));
3090
+ };
3091
+ TableModel.prototype.cancelAllEditorSessions = function () {
3092
+ var _this = this;
3093
+ this._editorSessions.runInTransaction(function (draft) {
3094
+ _this._rowsBeingEdited.runInTransaction(function () {
3095
+ draft.value.forEach(function (session) { return session.dispose(); });
3096
+ });
3097
+ });
3098
+ };
3099
+ var TableModel_1;
3100
+ TableModel.ctorParameters = function () { return [
3101
+ { type: ListModel }
3102
+ ]; };
3103
+ TableModel = TableModel_1 = __decorate([
3104
+ TrackExternal.Strategy(new TrackExternal.OneTimeBinding()),
3105
+ __metadata("design:paramtypes", [ListModel])
3106
+ ], TableModel);
3107
+ return TableModel;
3108
+ }());
3109
+
3191
3110
  /**
3192
3111
  * Create your model:
3193
3112
  * @example
@@ -3296,6 +3215,103 @@ var ColumnTemplateDirective = /** @class */ (function () {
3296
3215
  return ColumnTemplateDirective;
3297
3216
  }());
3298
3217
 
3218
+ var TableCellRendererComponent = /** @class */ (function (_super) {
3219
+ __extends(TableCellRendererComponent, _super);
3220
+ function TableCellRendererComponent() {
3221
+ var _this = _super.call(this) || this;
3222
+ _this.defaultClassNames = 'aup-cell-renderer';
3223
+ _this.fillCell = false;
3224
+ _this.padChild = false;
3225
+ _this.editRowCommand = Command.create(function () {
3226
+ _this.tableModel.startEditSession(_this.row);
3227
+ });
3228
+ return _this;
3229
+ }
3230
+ TableCellRendererComponent.prototype.ngOnInit = function () {
3231
+ var _a = Dsl.disposeWith(this), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
3232
+ this.firstEditableColumn = chain(this.tableModel.firstEditableColumn).equals(this.column); // this would break if the column changed.
3233
+ this.column.attachCell(this);
3234
+ };
3235
+ TableCellRendererComponent.prototype.hasActiveEditor = function () {
3236
+ return !!this.editSession && !!this.column.hasEditorPortal();
3237
+ };
3238
+ TableCellRendererComponent.prototype.initialiseRenderer = function (instance) {
3239
+ this.column.onRendererAttached(this, instance);
3240
+ };
3241
+ TableCellRendererComponent.prototype.initialiseEditor = function (instance) {
3242
+ var _this = this;
3243
+ this.column.onEditorAttached(this, instance);
3244
+ if (this.firstEditableColumn.value) {
3245
+ // @see https://github.com/angular/components/issues/12070
3246
+ setTimeout(function () { return _this.tryAndFocusEditor(instance); });
3247
+ }
3248
+ };
3249
+ TableCellRendererComponent.prototype.tryAndFocusEditor = function (editor) {
3250
+ var _a;
3251
+ if (editor.requestFocus) {
3252
+ editor.requestFocus();
3253
+ }
3254
+ else {
3255
+ var model = (editor['valueModel'] || editor['listModel']);
3256
+ (_a = model === null || model === void 0 ? void 0 : model.focusContext) === null || _a === void 0 ? void 0 : _a.requestFocus();
3257
+ }
3258
+ };
3259
+ // @Trace()
3260
+ TableCellRendererComponent.prototype.ngOnChanges = function (changes) {
3261
+ this.column.updatePortalContent(this);
3262
+ };
3263
+ TableCellRendererComponent.prototype.getRendererPortal = function () {
3264
+ return this[CELL_RENDERER_PORTAL];
3265
+ };
3266
+ TableCellRendererComponent.prototype.getEditorPortal = function () {
3267
+ return this[CELL_EDITOR_PORTAL];
3268
+ };
3269
+ TableCellRendererComponent.prototype.getRowData = function () {
3270
+ return {
3271
+ row: this.row,
3272
+ editSession: this.editSession,
3273
+ editRowCommand: this.editRowCommand
3274
+ };
3275
+ };
3276
+ __decorate([
3277
+ Input(),
3278
+ __metadata("design:type", Object)
3279
+ ], TableCellRendererComponent.prototype, "row", void 0);
3280
+ __decorate([
3281
+ Input(),
3282
+ __metadata("design:type", ColumnModel)
3283
+ ], TableCellRendererComponent.prototype, "column", void 0);
3284
+ __decorate([
3285
+ Input(),
3286
+ __metadata("design:type", EditSession)
3287
+ ], TableCellRendererComponent.prototype, "editSession", void 0);
3288
+ __decorate([
3289
+ Input(),
3290
+ __metadata("design:type", TableModel)
3291
+ ], TableCellRendererComponent.prototype, "tableModel", void 0);
3292
+ __decorate([
3293
+ HostBinding('class'),
3294
+ __metadata("design:type", Object)
3295
+ ], TableCellRendererComponent.prototype, "defaultClassNames", void 0);
3296
+ __decorate([
3297
+ HostBinding('class.fillCell'),
3298
+ __metadata("design:type", Object)
3299
+ ], TableCellRendererComponent.prototype, "fillCell", void 0);
3300
+ __decorate([
3301
+ HostBinding('class.padChild'),
3302
+ __metadata("design:type", Object)
3303
+ ], TableCellRendererComponent.prototype, "padChild", void 0);
3304
+ TableCellRendererComponent = __decorate([
3305
+ Component({
3306
+ selector: 'aup-table-cell-renderer',
3307
+ template: "<ng-container *ngIf=\"!hasActiveEditor()\" [cdkPortalOutlet]=\"getRendererPortal()\" (attached)=\"initialiseRenderer($event.instance)\"></ng-container>\n<ng-container *ngIf=\"hasActiveEditor()\" [cdkPortalOutlet]=\"getEditorPortal()\" (attached)=\"initialiseEditor($event.instance)\"></ng-container>\n",
3308
+ styles: [""]
3309
+ }),
3310
+ __metadata("design:paramtypes", [])
3311
+ ], TableCellRendererComponent);
3312
+ return TableCellRendererComponent;
3313
+ }(DisposableComponent));
3314
+
3299
3315
  var TableHeaderCellRendererComponent = /** @class */ (function () {
3300
3316
  function TableHeaderCellRendererComponent() {
3301
3317
  this.defaultClassNames = 'aup-header-cell-renderer';
@@ -3517,7 +3533,8 @@ var ComponentsModule = /** @class */ (function () {
3517
3533
  MatCheckboxModule,
3518
3534
  InteractionModule,
3519
3535
  MatTableModule,
3520
- PortalModule
3536
+ PortalModule,
3537
+ CdkScrollableModule
3521
3538
  ],
3522
3539
  exports: [
3523
3540
  NumberInputComponent,
@@ -5574,9 +5591,9 @@ var PlaceOutletComponent = /** @class */ (function (_super) {
5574
5591
  PlaceOutletComponent = __decorate([
5575
5592
  Component({
5576
5593
  selector: 'aup-place-outlet',
5577
- template: "<ng-container *ngIf=\"animateModel.value\">\n <div class=\"router-outlet-container\"\n [@routeAnimations]=\"{value: getAnimationOrder(), params:{duration: animationDuration}}\"\n (@routeAnimations.start)=\"animationStarted()\"\n (@routeAnimations.done)=\"animationDone()\"\n >\n <router-outlet #routerOutlet=\"outlet\"\n (activate)=\"onOutletActivated(routerOutlet, $event)\"\n (deactivate)=\"onOutletDeactivated()\">\n </router-outlet>\n </div>\n</ng-container>\n\n<ng-container *ngIf=\"!animateModel.value\">\n <div class=\"router-outlet-container\">\n <router-outlet #routerOutlet=\"outlet\"\n (activate)=\"onOutletActivated(routerOutlet, $event)\"\n (deactivate)=\"onOutletDeactivated()\">\n </router-outlet>\n </div>\n</ng-container>\n\n",
5594
+ template: "<ng-container *ngIf=\"animateModel.value\">\n <div class=\"router-outlet-container\" cdkScrollable\n [@routeAnimations]=\"{value: getAnimationOrder(), params:{duration: animationDuration}}\"\n (@routeAnimations.start)=\"animationStarted()\"\n (@routeAnimations.done)=\"animationDone()\"\n >\n <router-outlet #routerOutlet=\"outlet\"\n (activate)=\"onOutletActivated(routerOutlet, $event)\"\n (deactivate)=\"onOutletDeactivated()\">\n </router-outlet>\n </div>\n</ng-container>\n\n<ng-container *ngIf=\"!animateModel.value\">\n <div class=\"router-outlet-container\" cdkScrollable>\n <router-outlet #routerOutlet=\"outlet\"\n (activate)=\"onOutletActivated(routerOutlet, $event)\"\n (deactivate)=\"onOutletDeactivated()\">\n </router-outlet>\n </div>\n</ng-container>\n\n",
5578
5595
  animations: [LEFT_RIGHT_PLACE_ANIMATION],
5579
- styles: [":host{display:flex;flex-direction:column;min-height:0;overflow-x:hidden}.router-outlet-container{flex:1;display:block;position:relative;min-height:0}router-outlet{display:none}"]
5596
+ styles: [":host{display:flex;flex-direction:column;min-height:0}.router-outlet-container{flex:1;display:block;position:relative;min-height:0;overflow-x:hidden;overflow-y:scroll}router-outlet{display:none}"]
5580
5597
  }),
5581
5598
  __param(2, Optional()), __param(2, Inject(AUP_PLACE_CONFIG)),
5582
5599
  __param(3, SkipSelf()), __param(3, Optional()),