@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,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('@angular/forms'), require('@angular/material/form-field'), require('@angular/material/input'), require('@angular/material/select'), require('@angular/material/tabs'), require('@angular/platform-browser/animations'), require('@angular/cdk/portal'), require('@angular/material/button'), require('@angular/material/checkbox'), require('@angular/material/icon'), require('@angular/material/table'), require('@coolon/pectin'), require('@angular/flex-layout'), require('@angular/material/dialog'), require('@angular/router'), require('lodash'), require('@coolon/typescript-utilities'), require('@angular/cdk/overlay'), require('@typescript-plus/fast-memoize-decorator/dist/src'), require('immer'), require('@angular/material/progress-spinner'), require('@angular/material/list'), require('@angular/material/tooltip'), require('@typescript-plus/fast-memoize-decorator'), require('reflect-metadata'), require('@angular/animations'), require('resize-observer-polyfill'), require('rxjs')) :
3
- typeof define === 'function' && define.amd ? define('@coolon/angular-ui-powerups', ['exports', '@angular/common', '@angular/core', '@angular/forms', '@angular/material/form-field', '@angular/material/input', '@angular/material/select', '@angular/material/tabs', '@angular/platform-browser/animations', '@angular/cdk/portal', '@angular/material/button', '@angular/material/checkbox', '@angular/material/icon', '@angular/material/table', '@coolon/pectin', '@angular/flex-layout', '@angular/material/dialog', '@angular/router', 'lodash', '@coolon/typescript-utilities', '@angular/cdk/overlay', '@typescript-plus/fast-memoize-decorator/dist/src', 'immer', '@angular/material/progress-spinner', '@angular/material/list', '@angular/material/tooltip', '@typescript-plus/fast-memoize-decorator', 'reflect-metadata', '@angular/animations', 'resize-observer-polyfill', 'rxjs'], factory) :
4
- (global = global || self, factory((global.coolon = global.coolon || {}, global.coolon['angular-ui-powerups'] = {}), global.ng.common, global.ng.core, global.ng.forms, global.ng.material.formField, global.ng.material.input, global.ng.material.select, global.ng.material.tabs, global.ng.platformBrowser.animations, global.ng.cdk.portal, global.ng.material.button, global.ng.material.checkbox, global.ng.material.icon, global.ng.material.table, global.pectin, global.ng.flexLayout, global.ng.material.dialog, global.ng.router, global.___default, global.typescriptUtilities, global.ng.cdk.overlay, global.src, global.produce, global.ng.material.progressSpinner, global.ng.material.list, global.ng.material.tooltip, global.fastMemoizeDecorator, null, global.ng.animations, global.ResizeObserver, global.rxjs));
5
- }(this, (function (exports, common, core, forms, formField, input, select, tabs, animations, portal, button, checkbox, icon, table, pectin, flexLayout, dialog, router, ___default, typescriptUtilities, overlay, src, produce, progressSpinner, list, tooltip, fastMemoizeDecorator, reflectMetadata, animations$1, ResizeObserver, rxjs) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('@angular/forms'), require('@angular/material/form-field'), require('@angular/material/input'), require('@angular/material/select'), require('@angular/material/tabs'), require('@angular/platform-browser/animations'), require('@angular/cdk/portal'), require('@angular/cdk/scrolling'), require('@angular/material/button'), require('@angular/material/checkbox'), require('@angular/material/icon'), require('@angular/material/table'), require('@coolon/pectin'), require('@angular/flex-layout'), require('@angular/material/dialog'), require('@angular/router'), require('lodash'), require('@coolon/typescript-utilities'), require('@angular/cdk/overlay'), require('@typescript-plus/fast-memoize-decorator/dist/src'), require('immer'), require('@angular/material/progress-spinner'), require('@angular/material/list'), require('@angular/material/tooltip'), require('@typescript-plus/fast-memoize-decorator'), require('reflect-metadata'), require('@angular/animations'), require('resize-observer-polyfill'), require('rxjs')) :
3
+ typeof define === 'function' && define.amd ? define('@coolon/angular-ui-powerups', ['exports', '@angular/common', '@angular/core', '@angular/forms', '@angular/material/form-field', '@angular/material/input', '@angular/material/select', '@angular/material/tabs', '@angular/platform-browser/animations', '@angular/cdk/portal', '@angular/cdk/scrolling', '@angular/material/button', '@angular/material/checkbox', '@angular/material/icon', '@angular/material/table', '@coolon/pectin', '@angular/flex-layout', '@angular/material/dialog', '@angular/router', 'lodash', '@coolon/typescript-utilities', '@angular/cdk/overlay', '@typescript-plus/fast-memoize-decorator/dist/src', 'immer', '@angular/material/progress-spinner', '@angular/material/list', '@angular/material/tooltip', '@typescript-plus/fast-memoize-decorator', 'reflect-metadata', '@angular/animations', 'resize-observer-polyfill', 'rxjs'], factory) :
4
+ (global = global || self, factory((global.coolon = global.coolon || {}, global.coolon['angular-ui-powerups'] = {}), global.ng.common, global.ng.core, global.ng.forms, global.ng.material.formField, global.ng.material.input, global.ng.material.select, global.ng.material.tabs, global.ng.platformBrowser.animations, global.ng.cdk.portal, global.ng.cdk.scrolling, global.ng.material.button, global.ng.material.checkbox, global.ng.material.icon, global.ng.material.table, global.pectin, global.ng.flexLayout, global.ng.material.dialog, global.ng.router, global.___default, global.typescriptUtilities, global.ng.cdk.overlay, global.src, global.produce, global.ng.material.progressSpinner, global.ng.material.list, global.ng.material.tooltip, global.fastMemoizeDecorator, null, global.ng.animations, global.ResizeObserver, global.rxjs));
5
+ }(this, (function (exports, common, core, forms, formField, input, select, tabs, animations, portal, scrolling, button, checkbox, icon, table, pectin, flexLayout, dialog, router, ___default, typescriptUtilities, overlay, src, produce, progressSpinner, list, tooltip, fastMemoizeDecorator, reflectMetadata, animations$1, ResizeObserver, rxjs) { 'use strict';
6
6
 
7
7
  var ___default__default = 'default' in ___default ? ___default['default'] : ___default;
8
8
  produce = produce && Object.prototype.hasOwnProperty.call(produce, 'default') ? produce['default'] : produce;
@@ -1446,13 +1446,14 @@
1446
1446
 
1447
1447
  var PopupInteractionContextComponent = /** @class */ (function (_super) {
1448
1448
  __extends(PopupInteractionContextComponent, _super);
1449
- function PopupInteractionContextComponent(_element, _overlay) {
1449
+ function PopupInteractionContextComponent(_element, _overlay, scrollable) {
1450
1450
  var _this = _super.call(this) || this;
1451
1451
  _this._element = _element;
1452
1452
  _this._overlay = _overlay;
1453
1453
  _this.outputPortal = new portal.ComponentPortal(InPlaceInteractionContextComponent);
1454
1454
  _this.anchorX = 'start';
1455
1455
  _this.anchorY = 'bottom';
1456
+ _this.scrollContainers = scrollable ? [scrollable] : [];
1456
1457
  return _this;
1457
1458
  }
1458
1459
  Object.defineProperty(PopupInteractionContextComponent.prototype, "active", {
@@ -1464,14 +1465,21 @@
1464
1465
  });
1465
1466
  PopupInteractionContextComponent.prototype.startActivity = function (activityType, data) {
1466
1467
  var _this = this;
1468
+ // console.log({ element: this._element });
1469
+ var self = this;
1467
1470
  var overlayRef = this._overlay.create({
1468
1471
  hasBackdrop: false,
1469
1472
  panelClass: 'aup-popup-interaction-panel',
1470
1473
  positionStrategy: this._overlay.position()
1471
1474
  .flexibleConnectedTo(this._element)
1475
+ .withPush(true)
1472
1476
  .withPositions(this.computePositions())
1473
1477
  .withGrowAfterOpen(true)
1478
+ .withScrollableContainers(self.scrollContainers) // this isn't working. sigh.
1474
1479
  });
1480
+ var subs = this.scrollContainers.map(function (sc) { return sc.elementScrolled().subscribe(function () {
1481
+ overlayRef.updatePosition();
1482
+ }); });
1475
1483
  var componentRef = overlayRef.attach(this.outputPortal);
1476
1484
  this.interactionContext = componentRef.instance;
1477
1485
  return new Promise(function (resolve, reject) {
@@ -1480,7 +1488,13 @@
1480
1488
  _this.interactionContext.startActivity(activityType, data)
1481
1489
  .then(resolve)
1482
1490
  .catch(reject)
1483
- .finally(function () { return overlayRef.dispose(); });
1491
+ .finally(function () {
1492
+ subs.forEach(function (s) { return s.unsubscribe(); });
1493
+ overlayRef.dispose();
1494
+ });
1495
+ setTimeout(function () {
1496
+ overlayRef.updatePosition();
1497
+ });
1484
1498
  });
1485
1499
  });
1486
1500
  };
@@ -1506,7 +1520,8 @@
1506
1520
  };
1507
1521
  PopupInteractionContextComponent.ctorParameters = function () { return [
1508
1522
  { type: core.ElementRef },
1509
- { type: overlay.Overlay }
1523
+ { type: overlay.Overlay },
1524
+ { type: overlay.CdkScrollable, decorators: [{ type: core.Optional }, { type: core.SkipSelf }] }
1510
1525
  ]; };
1511
1526
  __decorate([
1512
1527
  core.HostBinding('class.interaction-active'),
@@ -1527,7 +1542,8 @@
1527
1542
  template: "<ng-content></ng-content>\n",
1528
1543
  styles: [":host{display:inline}:host.interaction-active{background:rgba(0,0,0,.05)}"]
1529
1544
  }),
1530
- __metadata("design:paramtypes", [core.ElementRef, overlay.Overlay])
1545
+ __param(2, core.Optional()), __param(2, core.SkipSelf()),
1546
+ __metadata("design:paramtypes", [core.ElementRef, overlay.Overlay, overlay.CdkScrollable])
1531
1547
  ], PopupInteractionContextComponent);
1532
1548
  return PopupInteractionContextComponent;
1533
1549
  }(DisposableComponent));
@@ -2418,7 +2434,7 @@
2418
2434
  ScrollContainerComponent = __decorate([
2419
2435
  core.Component({
2420
2436
  selector: 'aup-scroll-container',
2421
- template: "<div class=\"container\">\n <ng-content></ng-content>\n</div>\n",
2437
+ template: "<div class=\"container\" cdkScrollable>\n <ng-content></ng-content>\n</div>\n",
2422
2438
  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}"]
2423
2439
  }),
2424
2440
  __metadata("design:paramtypes", [])
@@ -2739,400 +2755,110 @@
2739
2755
  return SelectHeaderCellRendererComponent;
2740
2756
  }(DisposableComponent));
2741
2757
 
2742
- // export type StringPropertiesOf<T> = { [K in keyof T]: T[K] extends string ? K : never }[keyof T];
2743
- // export type NumberPropertiesOf<T> = { [K in keyof T]: T[K] extends number ? K : never }[keyof T];
2744
- /**
2745
- * Example:
2746
- * @example
2747
- * const model = TableModel.fromList(heroList, table => {
2748
- * table.pluck("firstName");
2749
- * table.pluck("lastName");
2750
- * table.addCustomColumn("fullName", hero => `${hero.firstName} ${hero.lastName}`);
2751
- * });
2752
- *
2753
- * Editable tables
2754
- * @example
2755
- * const saveCommand = UnaryCommand.create((form: Form<Hero>) => {
2756
- * if (form.validate()) {
2757
- * // normal form save stuff
2758
- * return true; // finish editing
2759
- * }
2760
- * return false; // continue editiing
2761
- * }
2762
- * const colorsNames: ListModel<string> = ...;
2763
- * const model = TableModel.fromList(heroList, table => {
2764
- * table.pluck("firstName").cellEditor(StringInputComponent); <-- interface CellEditor { valueModel: FormValueModel<string> | ValueModel<string>; }
2765
- * table.pluck("lastName").cellEditor(StringInputComponent, {
2766
- * validators: [Validator.present("We need a last name")]
2767
- * });
2768
- * table.pluck("age").cellEditor(NumberInputComponent);
2769
- * table.pluck("favoriteColor").cellEditor(SelectInputComponent, {
2770
- * initialiseComponent(component: SelectInputComponent) {
2771
- * selectInput.optionsModel = colorsNames; // <- initialise our component
2772
- * }
2773
- * });
2774
- * table.addEditControls(saveCommand); // <- required to enable editing
2775
- * });
2776
- *
2777
- * Selection models
2778
- * @example
2779
- * const model = TableModel.fromList(heroList, table => {
2780
- * table.addSelectionColumn(selectionModel); // <- can be single or multiple selection model
2781
- * table.pluck("firstName");
2782
- * table.pluck("lastName");
2783
- * });
2784
- *
2785
- * Custom cell renderers and editors
2786
- * @example
2787
- * const model = TableModel.fromList(heroList, table => {
2788
- * table.pluck("favoriteColor")
2789
- * .cellHeaderRenderer(CellHeaderRendererComponent, (component, column) => {
2790
- * // configure your component with what ever you need.
2791
- * });
2792
- * .cellRenderer(CellRendererComponent) // <-- interface CellEditor { value: string; }
2793
- * .cellEditor(CellEditorComponent.); // <-- interface CellEditor { valueModel: FormValueModel<string> | ValueModel<string>; }
2794
- * table.addCustomColumn("fullName", hero => `${hero.firstName} ${hero.lastName}`);
2795
- * });
2796
- *
2797
- * I18n
2798
- * @example
2799
- * [table.yml]
2800
- * table:
2801
- * columns(ColumnTextProperties[]):
2802
- * firstName:
2803
- * headerText: "First Name"
2804
- * fullName:
2805
- * headerText: "Full Name"
2806
- *
2807
- * const model = TableModel.fromList(heroList, table => {
2808
- * table.pluck("favoriteColor").cellRenderer(...).cellEditor(...);
2809
- * table.addCustomColumn("fullName", hero => `${hero.firstName} ${hero.lastName}`);
2810
- *
2811
- * table.columnTextProperties(I18n.table.columns); // <- configures all columns
2812
- * });
2813
- */
2814
- var TableModel = /** @class */ (function () {
2815
- function TableModel(sourceOfTruth) {
2816
- this.sourceOfTruth = sourceOfTruth;
2817
- this._garbage = new pectin.GarbageCollector();
2818
- this._columns = new pectin.MutableListModel();
2819
- this._editorSessions = new pectin.MutableListModel();
2820
- this._createForm = function (row) { return new pectin.Form(); };
2821
- this.identityOf = sourceOfTruth.identityOf;
2822
- var _a = pectin.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;
2823
- this._columnsById = chain(this._columns).indexBy('columnId');
2824
- this._rowsBeingEdited = new pectin.MutableListModel([], {
2825
- identifiedWith: this.identityOf
2826
- });
2827
- this._editorSessionByRowId = chain(this._editorSessions).indexBy('rowId');
2828
- this.editing = chain(this._editorSessions).count().isGreaterThan(0);
2829
- this.dataSource = chain(this.sourceOfTruth).replaceAll(this.rowsBeingEdited);
2758
+ var HEADER_CELL_RENDERER_PORTAL = Symbol('aup-cell-header-renderer-component-ref');
2759
+ var CELL_RENDERER_PORTAL = Symbol('aup-cell-renderer-component-ref');
2760
+ var CELL_EDITOR_PORTAL = Symbol('aup-cell-editor-component-ref');
2761
+ var PORTAL_RENDERER_COMPONENT = Symbol('aup-cell-renderer-portal-component');
2762
+ var PORTAL_EDITOR_COMPONENT = Symbol('aup-cell-editor-portal-component');
2763
+ var noop = function () {
2764
+ };
2765
+ var ɵ0 = noop;
2766
+ var CellPortalRef = /** @class */ (function () {
2767
+ function CellPortalRef() {
2830
2768
  }
2831
- TableModel_1 = TableModel;
2832
- TableModel.fromList = function (sourceOfTruth, builder) {
2833
- var model = new TableModel_1(sourceOfTruth);
2834
- builder(model);
2835
- return model;
2836
- };
2837
- Object.defineProperty(TableModel.prototype, "rowsBeingEdited", {
2838
- get: function () {
2839
- return this._rowsBeingEdited.readonly;
2840
- },
2841
- enumerable: true,
2842
- configurable: true
2843
- });
2844
- TableModel.prototype.getTrackByFunction = function () {
2845
- var _this = this;
2846
- return function (index, item) {
2847
- return _this.identityOf ? _this.identityOf(item) : index;
2848
- };
2769
+ return CellPortalRef;
2770
+ }());
2771
+ var CellHeaderPortalRef = /** @class */ (function (_super) {
2772
+ __extends(CellHeaderPortalRef, _super);
2773
+ function CellHeaderPortalRef(componentType, initialiseHeader) {
2774
+ var _this = _super.call(this) || this;
2775
+ _this.componentType = componentType;
2776
+ _this.initialiseHeader = initialiseHeader;
2777
+ return _this;
2778
+ }
2779
+ CellHeaderPortalRef.prototype.initialiseHost = function (host, columnModel) {
2780
+ typescriptUtilities.assert.isTruthy(host);
2781
+ host[HEADER_CELL_RENDERER_PORTAL] = new portal.ComponentPortal(this.componentType);
2849
2782
  };
2850
- Object.defineProperty(TableModel.prototype, "columns", {
2851
- get: function () {
2852
- return this._columns.readonly;
2853
- },
2854
- enumerable: true,
2855
- configurable: true
2856
- });
2857
- TableModel.prototype.pluck = function (property) {
2858
- return this.addColumn(new PropertyColumnModel(property, this));
2783
+ CellHeaderPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
2784
+ this.initialiseHeader(portalComponent, host.column);
2859
2785
  };
2860
- TableModel.prototype.pluckList = function (property) {
2861
- return this.addColumn(new ListPropertyColumnModel(property, this));
2786
+ return CellHeaderPortalRef;
2787
+ }(CellPortalRef));
2788
+ var CellRendererPortalRef = /** @class */ (function (_super) {
2789
+ __extends(CellRendererPortalRef, _super);
2790
+ function CellRendererPortalRef() {
2791
+ return _super !== null && _super.apply(this, arguments) || this;
2792
+ }
2793
+ return CellRendererPortalRef;
2794
+ }(CellPortalRef));
2795
+ var ComponentCellRendererPortalRef = /** @class */ (function (_super) {
2796
+ __extends(ComponentCellRendererPortalRef, _super);
2797
+ function ComponentCellRendererPortalRef(componentType, updateComponent) {
2798
+ var _this = _super.call(this) || this;
2799
+ _this.componentType = componentType;
2800
+ _this.updateComponent = updateComponent;
2801
+ return _this;
2802
+ }
2803
+ ComponentCellRendererPortalRef.prototype.initialiseHost = function (host, columnModel) {
2804
+ host[CELL_RENDERER_PORTAL] = new portal.ComponentPortal(this.componentType);
2862
2805
  };
2863
- TableModel.prototype.addSelectionColumn = function (selectionModel) {
2864
- return this.addColumn(new SelectionColumnModel('selection', this, selectionModel));
2806
+ ComponentCellRendererPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
2807
+ host[PORTAL_RENDERER_COMPONENT] = portalComponent;
2808
+ this.updateComponent(portalComponent, host.getRowData());
2865
2809
  };
2866
- TableModel.prototype.addEditControls = function (saveCommand) {
2867
- this.saveCommand = saveCommand;
2868
- return this.addColumn(new EditorControlColumnModel('editControls', saveCommand, this));
2810
+ ComponentCellRendererPortalRef.prototype.pushState = function (host) {
2811
+ if (host[PORTAL_RENDERER_COMPONENT]) {
2812
+ this.updateComponent(host[PORTAL_RENDERER_COMPONENT], host.getRowData());
2813
+ }
2869
2814
  };
2870
- TableModel.prototype.addCustomColumn = function (columnId, dataAccessor) {
2871
- return this.addColumn(new CustomValueColumnModel(columnId, this, dataAccessor));
2815
+ return ComponentCellRendererPortalRef;
2816
+ }(CellRendererPortalRef));
2817
+ var CellEditorPortalRef = /** @class */ (function (_super) {
2818
+ __extends(CellEditorPortalRef, _super);
2819
+ function CellEditorPortalRef(componentType, initialiseEditorSession) {
2820
+ var _this = _super.call(this) || this;
2821
+ _this.componentType = componentType;
2822
+ _this.initialiseEditorSession = initialiseEditorSession;
2823
+ return _this;
2824
+ }
2825
+ CellEditorPortalRef.prototype.initialiseHost = function (host, columnModel) {
2826
+ typescriptUtilities.assert.isTruthy(host);
2827
+ host[CELL_EDITOR_PORTAL] = new portal.ComponentPortal(this.componentType);
2872
2828
  };
2873
- TableModel.prototype.addTemplateColumn = function (columnId) {
2874
- return this.addColumn(new CustomTemplateColumnModel(columnId, this));
2829
+ // @Trace()
2830
+ CellEditorPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
2831
+ host[PORTAL_EDITOR_COMPONENT] = portalComponent;
2832
+ this.initialiseEditorSession(portalComponent, host.editSession);
2875
2833
  };
2876
- TableModel.prototype.useFormFactory = function (factory) {
2877
- this._createForm = factory;
2878
- return this;
2834
+ return CellEditorPortalRef;
2835
+ }(CellPortalRef));
2836
+ var TemplateCellRendererPortalRef = /** @class */ (function (_super) {
2837
+ __extends(TemplateCellRendererPortalRef, _super);
2838
+ function TemplateCellRendererPortalRef() {
2839
+ return _super.call(this) || this;
2840
+ }
2841
+ TemplateCellRendererPortalRef.prototype.registerPortal = function (templateRef, viewContainer, fillCell, padChild) {
2842
+ this.templateRef = templateRef;
2843
+ this.viewContainer = viewContainer;
2844
+ this.fillCell = fillCell;
2845
+ this.padChild = padChild;
2879
2846
  };
2880
- TableModel.prototype.addColumn = function (column) {
2881
- if (this._columnsById.get(column.columnId)) {
2882
- pectin.lang.illegalState("Column with id=" + column.columnId + " already exists");
2883
- }
2884
- else {
2885
- this._columns.push(column);
2886
- }
2887
- return column;
2847
+ TemplateCellRendererPortalRef.prototype.initialiseHost = function (host, columnModel) {
2848
+ typescriptUtilities.assert.isTruthy(host);
2888
2849
  };
2889
- TableModel.prototype.columnTextProperties = function (columnTextProperties) {
2890
- this._columnTextPropertiesLookup = columnTextProperties;
2850
+ // @Trace()
2851
+ TemplateCellRendererPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
2852
+ // don't care
2891
2853
  };
2892
- TableModel.prototype.getColumnTextProperties = function (column) {
2893
- var factory = this._columnTextPropertiesLookup ? this._columnTextPropertiesLookup[column.columnId] : undefined;
2894
- return factory ? factory() : undefined;
2854
+ TemplateCellRendererPortalRef.prototype.pushState = function (host) {
2855
+ host[CELL_RENDERER_PORTAL] = this.createPortal(host.getRowData());
2856
+ host.fillCell = this.fillCell;
2857
+ host.padChild = this.padChild;
2895
2858
  };
2896
- TableModel.prototype.startEditSession = function (row) {
2897
- var _this = this;
2898
- var rowId = this.identityOf(row);
2899
- if (this._rowsBeingEdited.query().indexOf(row) > -1) {
2900
- return pectin.lang.illegalState("Row with id=" + rowId + " already being edited");
2901
- }
2902
- else {
2903
- var editSession_1 = new EditSession(rowId, row, this._createForm(row), this.saveCommand);
2904
- var when = pectin.Dsl.disposeWith(editSession_1).when;
2905
- when.valueOf(editSession_1.liveRowValue).changes(function (editedValue) {
2906
- _this._rowsBeingEdited.replaceOrPush(editedValue);
2907
- }, { initialValue: 'triggerChangeUnlessNil' });
2908
- this._editorSessions.push(editSession_1);
2909
- editSession_1.onDispose(function () {
2910
- _this._rowsBeingEdited.remove(editSession_1.liveRowValue.value);
2911
- _this._editorSessions.remove(editSession_1);
2912
- });
2913
- return editSession_1;
2914
- }
2859
+ TemplateCellRendererPortalRef.prototype.createPortal = function (data) {
2860
+ return new portal.TemplatePortal(this.templateRef, this.viewContainer, __assign(__assign({}, (data)), { $implicit: data.row }));
2915
2861
  };
2916
- TableModel.prototype.getEditSessionFor = function (row) {
2917
- return this._editorSessionByRowId.get(this.identityOf(row));
2918
- };
2919
- TableModel.prototype.cancelAllEditorSessions = function () {
2920
- var _this = this;
2921
- this._editorSessions.runInTransaction(function (draft) {
2922
- _this._rowsBeingEdited.runInTransaction(function () {
2923
- draft.value.forEach(function (session) { return session.dispose(); });
2924
- });
2925
- });
2926
- };
2927
- var TableModel_1;
2928
- TableModel.ctorParameters = function () { return [
2929
- { type: pectin.ListModel }
2930
- ]; };
2931
- TableModel = TableModel_1 = __decorate([
2932
- pectin.TrackExternal.Strategy(new pectin.TrackExternal.OneTimeBinding()),
2933
- __metadata("design:paramtypes", [pectin.ListModel])
2934
- ], TableModel);
2935
- return TableModel;
2936
- }());
2937
-
2938
- var TableCellRendererComponent = /** @class */ (function () {
2939
- function TableCellRendererComponent() {
2940
- var _this = this;
2941
- this.defaultClassNames = 'aup-cell-renderer';
2942
- this.fillCell = false;
2943
- this.padChild = false;
2944
- this.editRowCommand = pectin.Command.create(function () {
2945
- _this.tableModel.startEditSession(_this.row);
2946
- });
2947
- }
2948
- TableCellRendererComponent.prototype.ngOnInit = function () {
2949
- this.column.attachCell(this);
2950
- };
2951
- TableCellRendererComponent.prototype.hasActiveEditor = function () {
2952
- return !!this.editSession && !!this.column.hasEditorPortal();
2953
- };
2954
- TableCellRendererComponent.prototype.initialiseRenderer = function (instance) {
2955
- this.column.onRendererAttached(this, instance);
2956
- };
2957
- TableCellRendererComponent.prototype.initialiseEditor = function (instance) {
2958
- this.column.onEditorAttached(this, instance);
2959
- };
2960
- // @Trace()
2961
- TableCellRendererComponent.prototype.ngOnChanges = function (changes) {
2962
- this.column.updatePortalContent(this);
2963
- };
2964
- TableCellRendererComponent.prototype.getRendererPortal = function () {
2965
- return this[CELL_RENDERER_PORTAL];
2966
- };
2967
- TableCellRendererComponent.prototype.getEditorPortal = function () {
2968
- return this[CELL_EDITOR_PORTAL];
2969
- };
2970
- TableCellRendererComponent.prototype.getRowData = function () {
2971
- return {
2972
- row: this.row,
2973
- editSession: this.editSession,
2974
- editRowCommand: this.editRowCommand
2975
- };
2976
- };
2977
- __decorate([
2978
- core.Input(),
2979
- __metadata("design:type", Object)
2980
- ], TableCellRendererComponent.prototype, "row", void 0);
2981
- __decorate([
2982
- core.Input(),
2983
- __metadata("design:type", ColumnModel)
2984
- ], TableCellRendererComponent.prototype, "column", void 0);
2985
- __decorate([
2986
- core.Input(),
2987
- __metadata("design:type", EditSession)
2988
- ], TableCellRendererComponent.prototype, "editSession", void 0);
2989
- __decorate([
2990
- core.Input(),
2991
- __metadata("design:type", TableModel)
2992
- ], TableCellRendererComponent.prototype, "tableModel", void 0);
2993
- __decorate([
2994
- core.HostBinding('class'),
2995
- __metadata("design:type", Object)
2996
- ], TableCellRendererComponent.prototype, "defaultClassNames", void 0);
2997
- __decorate([
2998
- core.HostBinding('class.fillCell'),
2999
- __metadata("design:type", Object)
3000
- ], TableCellRendererComponent.prototype, "fillCell", void 0);
3001
- __decorate([
3002
- core.HostBinding('class.padChild'),
3003
- __metadata("design:type", Object)
3004
- ], TableCellRendererComponent.prototype, "padChild", void 0);
3005
- __decorate([
3006
- pectin.Trace(),
3007
- __metadata("design:type", Function),
3008
- __metadata("design:paramtypes", [Object]),
3009
- __metadata("design:returntype", void 0)
3010
- ], TableCellRendererComponent.prototype, "initialiseEditor", null);
3011
- TableCellRendererComponent = __decorate([
3012
- core.Component({
3013
- selector: 'aup-table-cell-renderer',
3014
- 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",
3015
- styles: [""]
3016
- }),
3017
- __metadata("design:paramtypes", [])
3018
- ], TableCellRendererComponent);
3019
- return TableCellRendererComponent;
3020
- }());
3021
-
3022
- var HEADER_CELL_RENDERER_PORTAL = Symbol('aup-cell-header-renderer-component-ref');
3023
- var CELL_RENDERER_PORTAL = Symbol('aup-cell-renderer-component-ref');
3024
- var CELL_EDITOR_PORTAL = Symbol('aup-cell-editor-component-ref');
3025
- var PORTAL_RENDERER_COMPONENT = Symbol('aup-cell-renderer-portal-component');
3026
- var PORTAL_EDITOR_COMPONENT = Symbol('aup-cell-editor-portal-component');
3027
- var noop = function () {
3028
- };
3029
- var ɵ0 = noop;
3030
- var CellPortalRef = /** @class */ (function () {
3031
- function CellPortalRef() {
3032
- }
3033
- return CellPortalRef;
3034
- }());
3035
- var CellHeaderPortalRef = /** @class */ (function (_super) {
3036
- __extends(CellHeaderPortalRef, _super);
3037
- function CellHeaderPortalRef(componentType, initialiseHeader) {
3038
- var _this = _super.call(this) || this;
3039
- _this.componentType = componentType;
3040
- _this.initialiseHeader = initialiseHeader;
3041
- return _this;
3042
- }
3043
- CellHeaderPortalRef.prototype.initialiseHost = function (host, columnModel) {
3044
- typescriptUtilities.assert.isTruthy(host);
3045
- host[HEADER_CELL_RENDERER_PORTAL] = new portal.ComponentPortal(this.componentType);
3046
- };
3047
- CellHeaderPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
3048
- this.initialiseHeader(portalComponent, host.column);
3049
- };
3050
- return CellHeaderPortalRef;
3051
- }(CellPortalRef));
3052
- var CellRendererPortalRef = /** @class */ (function (_super) {
3053
- __extends(CellRendererPortalRef, _super);
3054
- function CellRendererPortalRef() {
3055
- return _super !== null && _super.apply(this, arguments) || this;
3056
- }
3057
- return CellRendererPortalRef;
3058
- }(CellPortalRef));
3059
- var ComponentCellRendererPortalRef = /** @class */ (function (_super) {
3060
- __extends(ComponentCellRendererPortalRef, _super);
3061
- function ComponentCellRendererPortalRef(componentType, updateComponent) {
3062
- var _this = _super.call(this) || this;
3063
- _this.componentType = componentType;
3064
- _this.updateComponent = updateComponent;
3065
- return _this;
3066
- }
3067
- ComponentCellRendererPortalRef.prototype.initialiseHost = function (host, columnModel) {
3068
- host[CELL_RENDERER_PORTAL] = new portal.ComponentPortal(this.componentType);
3069
- };
3070
- ComponentCellRendererPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
3071
- host[PORTAL_RENDERER_COMPONENT] = portalComponent;
3072
- this.updateComponent(portalComponent, host.getRowData());
3073
- };
3074
- ComponentCellRendererPortalRef.prototype.pushState = function (host) {
3075
- if (host[PORTAL_RENDERER_COMPONENT]) {
3076
- this.updateComponent(host[PORTAL_RENDERER_COMPONENT], host.getRowData());
3077
- }
3078
- };
3079
- return ComponentCellRendererPortalRef;
3080
- }(CellRendererPortalRef));
3081
- var CellEditorPortalRef = /** @class */ (function (_super) {
3082
- __extends(CellEditorPortalRef, _super);
3083
- function CellEditorPortalRef(componentType, initialiseEditorSession) {
3084
- var _this = _super.call(this) || this;
3085
- _this.componentType = componentType;
3086
- _this.initialiseEditorSession = initialiseEditorSession;
3087
- return _this;
3088
- }
3089
- CellEditorPortalRef.prototype.initialiseHost = function (host, columnModel) {
3090
- typescriptUtilities.assert.isTruthy(host);
3091
- host[CELL_EDITOR_PORTAL] = new portal.ComponentPortal(this.componentType);
3092
- };
3093
- CellEditorPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
3094
- host[PORTAL_EDITOR_COMPONENT] = portalComponent;
3095
- this.initialiseEditorSession(portalComponent, host.editSession);
3096
- };
3097
- __decorate([
3098
- pectin.Trace(),
3099
- __metadata("design:type", Function),
3100
- __metadata("design:paramtypes", [TableCellRendererComponent, Object]),
3101
- __metadata("design:returntype", void 0)
3102
- ], CellEditorPortalRef.prototype, "onPortalAttached", null);
3103
- return CellEditorPortalRef;
3104
- }(CellPortalRef));
3105
- var TemplateCellRendererPortalRef = /** @class */ (function (_super) {
3106
- __extends(TemplateCellRendererPortalRef, _super);
3107
- function TemplateCellRendererPortalRef() {
3108
- return _super.call(this) || this;
3109
- }
3110
- TemplateCellRendererPortalRef.prototype.registerPortal = function (templateRef, viewContainer, fillCell, padChild) {
3111
- this.templateRef = templateRef;
3112
- this.viewContainer = viewContainer;
3113
- this.fillCell = fillCell;
3114
- this.padChild = padChild;
3115
- };
3116
- TemplateCellRendererPortalRef.prototype.initialiseHost = function (host, columnModel) {
3117
- typescriptUtilities.assert.isTruthy(host);
3118
- };
3119
- TemplateCellRendererPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
3120
- // don't care
3121
- };
3122
- TemplateCellRendererPortalRef.prototype.pushState = function (host) {
3123
- host[CELL_RENDERER_PORTAL] = this.createPortal(host.getRowData());
3124
- host.fillCell = this.fillCell;
3125
- host.padChild = this.padChild;
3126
- };
3127
- TemplateCellRendererPortalRef.prototype.createPortal = function (data) {
3128
- return new portal.TemplatePortal(this.templateRef, this.viewContainer, __assign(__assign({}, (data)), { $implicit: data.row }));
3129
- };
3130
- __decorate([
3131
- pectin.Trace(),
3132
- __metadata("design:type", Function),
3133
- __metadata("design:paramtypes", [TableCellRendererComponent, void 0]),
3134
- __metadata("design:returntype", void 0)
3135
- ], TemplateCellRendererPortalRef.prototype, "onPortalAttached", null);
3136
2862
  return TemplateCellRendererPortalRef;
3137
2863
  }(CellRendererPortalRef));
3138
2864
  var ColumnModel = /** @class */ (function () {
@@ -3188,6 +2914,7 @@
3188
2914
  ColumnModel.prototype.onRendererAttached = function (host, component) {
3189
2915
  this._cellRendererPortalRef.onPortalAttached(host, component);
3190
2916
  };
2917
+ // @Trace()
3191
2918
  ColumnModel.prototype.onEditorAttached = function (host, component) {
3192
2919
  this._cellEditorPortalRef.onPortalAttached(host, component);
3193
2920
  };
@@ -3206,12 +2933,6 @@
3206
2933
  __metadata("design:paramtypes", []),
3207
2934
  __metadata("design:returntype", Object)
3208
2935
  ], ColumnModel.prototype, "getColumnTextProperties", null);
3209
- __decorate([
3210
- pectin.Trace(),
3211
- __metadata("design:type", Function),
3212
- __metadata("design:paramtypes", [TableCellRendererComponent, Object]),
3213
- __metadata("design:returntype", void 0)
3214
- ], ColumnModel.prototype, "onEditorAttached", null);
3215
2936
  return ColumnModel;
3216
2937
  }());
3217
2938
  var PropertyColumnModel = /** @class */ (function (_super) {
@@ -3363,6 +3084,203 @@
3363
3084
  return SelectionColumnModel;
3364
3085
  }(ColumnModel));
3365
3086
 
3087
+ // export type StringPropertiesOf<T> = { [K in keyof T]: T[K] extends string ? K : never }[keyof T];
3088
+ // export type NumberPropertiesOf<T> = { [K in keyof T]: T[K] extends number ? K : never }[keyof T];
3089
+ /**
3090
+ * Example:
3091
+ * @example
3092
+ * const model = TableModel.fromList(heroList, table => {
3093
+ * table.pluck("firstName");
3094
+ * table.pluck("lastName");
3095
+ * table.addCustomColumn("fullName", hero => `${hero.firstName} ${hero.lastName}`);
3096
+ * });
3097
+ *
3098
+ * Editable tables
3099
+ * @example
3100
+ * const saveCommand = UnaryCommand.create((form: Form<Hero>) => {
3101
+ * if (form.validate()) {
3102
+ * // normal form save stuff
3103
+ * return true; // finish editing
3104
+ * }
3105
+ * return false; // continue editiing
3106
+ * }
3107
+ * const colorsNames: ListModel<string> = ...;
3108
+ * const model = TableModel.fromList(heroList, table => {
3109
+ * table.pluck("firstName").cellEditor(StringInputComponent); <-- interface CellEditor { valueModel: FormValueModel<string> | ValueModel<string>; }
3110
+ * table.pluck("lastName").cellEditor(StringInputComponent, {
3111
+ * validators: [Validator.present("We need a last name")]
3112
+ * });
3113
+ * table.pluck("age").cellEditor(NumberInputComponent);
3114
+ * table.pluck("favoriteColor").cellEditor(SelectInputComponent, {
3115
+ * initialiseComponent(component: SelectInputComponent) {
3116
+ * selectInput.optionsModel = colorsNames; // <- initialise our component
3117
+ * }
3118
+ * });
3119
+ * table.addEditControls(saveCommand); // <- required to enable editing
3120
+ * });
3121
+ *
3122
+ * Selection models
3123
+ * @example
3124
+ * const model = TableModel.fromList(heroList, table => {
3125
+ * table.addSelectionColumn(selectionModel); // <- can be single or multiple selection model
3126
+ * table.pluck("firstName");
3127
+ * table.pluck("lastName");
3128
+ * });
3129
+ *
3130
+ * Custom cell renderers and editors
3131
+ * @example
3132
+ * const model = TableModel.fromList(heroList, table => {
3133
+ * table.pluck("favoriteColor")
3134
+ * .cellHeaderRenderer(CellHeaderRendererComponent, (component, column) => {
3135
+ * // configure your component with what ever you need.
3136
+ * });
3137
+ * .cellRenderer(CellRendererComponent) // <-- interface CellEditor { value: string; }
3138
+ * .cellEditor(CellEditorComponent.); // <-- interface CellEditor { valueModel: FormValueModel<string> | ValueModel<string>; }
3139
+ * table.addCustomColumn("fullName", hero => `${hero.firstName} ${hero.lastName}`);
3140
+ * });
3141
+ *
3142
+ * I18n
3143
+ * @example
3144
+ * [table.yml]
3145
+ * table:
3146
+ * columns(ColumnTextProperties[]):
3147
+ * firstName:
3148
+ * headerText: "First Name"
3149
+ * fullName:
3150
+ * headerText: "Full Name"
3151
+ *
3152
+ * const model = TableModel.fromList(heroList, table => {
3153
+ * table.pluck("favoriteColor").cellRenderer(...).cellEditor(...);
3154
+ * table.addCustomColumn("fullName", hero => `${hero.firstName} ${hero.lastName}`);
3155
+ *
3156
+ * table.columnTextProperties(I18n.table.columns); // <- configures all columns
3157
+ * });
3158
+ */
3159
+ var TableModel = /** @class */ (function () {
3160
+ function TableModel(sourceOfTruth) {
3161
+ this.sourceOfTruth = sourceOfTruth;
3162
+ this._garbage = new pectin.GarbageCollector();
3163
+ this._columns = new pectin.MutableListModel();
3164
+ this._editorSessions = new pectin.MutableListModel();
3165
+ this._createForm = function (row) { return new pectin.Form(); };
3166
+ this.identityOf = sourceOfTruth.identityOf;
3167
+ var _a = pectin.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;
3168
+ this._columnsById = chain(this._columns).indexBy('columnId');
3169
+ this._rowsBeingEdited = new pectin.MutableListModel([], {
3170
+ identifiedWith: this.identityOf
3171
+ });
3172
+ this._editorSessionByRowId = chain(this._editorSessions).indexBy('rowId');
3173
+ this.editing = chain(this._editorSessions).count().isGreaterThan(0);
3174
+ this.dataSource = chain(this.sourceOfTruth).replaceAll(this.rowsBeingEdited);
3175
+ this.firstEditableColumn = chain(this.columns).select(function (c) { return c.hasEditorPortal(); }).first();
3176
+ }
3177
+ TableModel_1 = TableModel;
3178
+ TableModel.fromList = function (sourceOfTruth, builder) {
3179
+ var model = new TableModel_1(sourceOfTruth);
3180
+ builder(model);
3181
+ return model;
3182
+ };
3183
+ Object.defineProperty(TableModel.prototype, "rowsBeingEdited", {
3184
+ get: function () {
3185
+ return this._rowsBeingEdited.readonly;
3186
+ },
3187
+ enumerable: true,
3188
+ configurable: true
3189
+ });
3190
+ TableModel.prototype.getTrackByFunction = function () {
3191
+ var _this = this;
3192
+ return function (index, item) {
3193
+ return _this.identityOf ? _this.identityOf(item) : index;
3194
+ };
3195
+ };
3196
+ Object.defineProperty(TableModel.prototype, "columns", {
3197
+ get: function () {
3198
+ return this._columns.readonly;
3199
+ },
3200
+ enumerable: true,
3201
+ configurable: true
3202
+ });
3203
+ TableModel.prototype.pluck = function (property) {
3204
+ return this.addColumn(new PropertyColumnModel(property, this));
3205
+ };
3206
+ TableModel.prototype.pluckList = function (property) {
3207
+ return this.addColumn(new ListPropertyColumnModel(property, this));
3208
+ };
3209
+ TableModel.prototype.addSelectionColumn = function (selectionModel) {
3210
+ return this.addColumn(new SelectionColumnModel('selection', this, selectionModel));
3211
+ };
3212
+ TableModel.prototype.addEditControls = function (saveCommand) {
3213
+ this.saveCommand = saveCommand;
3214
+ return this.addColumn(new EditorControlColumnModel('editControls', saveCommand, this));
3215
+ };
3216
+ TableModel.prototype.addCustomColumn = function (columnId, dataAccessor) {
3217
+ return this.addColumn(new CustomValueColumnModel(columnId, this, dataAccessor));
3218
+ };
3219
+ TableModel.prototype.addTemplateColumn = function (columnId) {
3220
+ return this.addColumn(new CustomTemplateColumnModel(columnId, this));
3221
+ };
3222
+ TableModel.prototype.useFormFactory = function (factory) {
3223
+ this._createForm = factory;
3224
+ return this;
3225
+ };
3226
+ TableModel.prototype.addColumn = function (column) {
3227
+ if (this._columnsById.get(column.columnId)) {
3228
+ pectin.lang.illegalState("Column with id=" + column.columnId + " already exists");
3229
+ }
3230
+ else {
3231
+ this._columns.push(column);
3232
+ }
3233
+ return column;
3234
+ };
3235
+ TableModel.prototype.columnTextProperties = function (columnTextProperties) {
3236
+ this._columnTextPropertiesLookup = columnTextProperties;
3237
+ };
3238
+ TableModel.prototype.getColumnTextProperties = function (column) {
3239
+ var factory = this._columnTextPropertiesLookup ? this._columnTextPropertiesLookup[column.columnId] : undefined;
3240
+ return factory ? factory() : undefined;
3241
+ };
3242
+ TableModel.prototype.startEditSession = function (row) {
3243
+ var _this = this;
3244
+ var rowId = this.identityOf(row);
3245
+ if (this._rowsBeingEdited.query().indexOf(row) > -1) {
3246
+ return pectin.lang.illegalState("Row with id=" + rowId + " already being edited");
3247
+ }
3248
+ else {
3249
+ var editSession_1 = new EditSession(rowId, row, this._createForm(row), this.saveCommand);
3250
+ var when = pectin.Dsl.disposeWith(editSession_1).when;
3251
+ when.valueOf(editSession_1.liveRowValue).changes(function (editedValue) {
3252
+ _this._rowsBeingEdited.replaceOrPush(editedValue);
3253
+ }, { initialValue: 'triggerChangeUnlessNil' });
3254
+ this._editorSessions.push(editSession_1);
3255
+ editSession_1.onDispose(function () {
3256
+ _this._rowsBeingEdited.remove(editSession_1.liveRowValue.value);
3257
+ _this._editorSessions.remove(editSession_1);
3258
+ });
3259
+ return editSession_1;
3260
+ }
3261
+ };
3262
+ TableModel.prototype.getEditSessionFor = function (row) {
3263
+ return this._editorSessionByRowId.get(this.identityOf(row));
3264
+ };
3265
+ TableModel.prototype.cancelAllEditorSessions = function () {
3266
+ var _this = this;
3267
+ this._editorSessions.runInTransaction(function (draft) {
3268
+ _this._rowsBeingEdited.runInTransaction(function () {
3269
+ draft.value.forEach(function (session) { return session.dispose(); });
3270
+ });
3271
+ });
3272
+ };
3273
+ var TableModel_1;
3274
+ TableModel.ctorParameters = function () { return [
3275
+ { type: pectin.ListModel }
3276
+ ]; };
3277
+ TableModel = TableModel_1 = __decorate([
3278
+ pectin.TrackExternal.Strategy(new pectin.TrackExternal.OneTimeBinding()),
3279
+ __metadata("design:paramtypes", [pectin.ListModel])
3280
+ ], TableModel);
3281
+ return TableModel;
3282
+ }());
3283
+
3366
3284
  /**
3367
3285
  * Create your model:
3368
3286
  * @example
@@ -3471,6 +3389,103 @@
3471
3389
  return ColumnTemplateDirective;
3472
3390
  }());
3473
3391
 
3392
+ var TableCellRendererComponent = /** @class */ (function (_super) {
3393
+ __extends(TableCellRendererComponent, _super);
3394
+ function TableCellRendererComponent() {
3395
+ var _this = _super.call(this) || this;
3396
+ _this.defaultClassNames = 'aup-cell-renderer';
3397
+ _this.fillCell = false;
3398
+ _this.padChild = false;
3399
+ _this.editRowCommand = pectin.Command.create(function () {
3400
+ _this.tableModel.startEditSession(_this.row);
3401
+ });
3402
+ return _this;
3403
+ }
3404
+ TableCellRendererComponent.prototype.ngOnInit = function () {
3405
+ var _a = pectin.Dsl.disposeWith(this), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
3406
+ this.firstEditableColumn = chain(this.tableModel.firstEditableColumn).equals(this.column); // this would break if the column changed.
3407
+ this.column.attachCell(this);
3408
+ };
3409
+ TableCellRendererComponent.prototype.hasActiveEditor = function () {
3410
+ return !!this.editSession && !!this.column.hasEditorPortal();
3411
+ };
3412
+ TableCellRendererComponent.prototype.initialiseRenderer = function (instance) {
3413
+ this.column.onRendererAttached(this, instance);
3414
+ };
3415
+ TableCellRendererComponent.prototype.initialiseEditor = function (instance) {
3416
+ var _this = this;
3417
+ this.column.onEditorAttached(this, instance);
3418
+ if (this.firstEditableColumn.value) {
3419
+ // @see https://github.com/angular/components/issues/12070
3420
+ setTimeout(function () { return _this.tryAndFocusEditor(instance); });
3421
+ }
3422
+ };
3423
+ TableCellRendererComponent.prototype.tryAndFocusEditor = function (editor) {
3424
+ var _a;
3425
+ if (editor.requestFocus) {
3426
+ editor.requestFocus();
3427
+ }
3428
+ else {
3429
+ var model = (editor['valueModel'] || editor['listModel']);
3430
+ (_a = model === null || model === void 0 ? void 0 : model.focusContext) === null || _a === void 0 ? void 0 : _a.requestFocus();
3431
+ }
3432
+ };
3433
+ // @Trace()
3434
+ TableCellRendererComponent.prototype.ngOnChanges = function (changes) {
3435
+ this.column.updatePortalContent(this);
3436
+ };
3437
+ TableCellRendererComponent.prototype.getRendererPortal = function () {
3438
+ return this[CELL_RENDERER_PORTAL];
3439
+ };
3440
+ TableCellRendererComponent.prototype.getEditorPortal = function () {
3441
+ return this[CELL_EDITOR_PORTAL];
3442
+ };
3443
+ TableCellRendererComponent.prototype.getRowData = function () {
3444
+ return {
3445
+ row: this.row,
3446
+ editSession: this.editSession,
3447
+ editRowCommand: this.editRowCommand
3448
+ };
3449
+ };
3450
+ __decorate([
3451
+ core.Input(),
3452
+ __metadata("design:type", Object)
3453
+ ], TableCellRendererComponent.prototype, "row", void 0);
3454
+ __decorate([
3455
+ core.Input(),
3456
+ __metadata("design:type", ColumnModel)
3457
+ ], TableCellRendererComponent.prototype, "column", void 0);
3458
+ __decorate([
3459
+ core.Input(),
3460
+ __metadata("design:type", EditSession)
3461
+ ], TableCellRendererComponent.prototype, "editSession", void 0);
3462
+ __decorate([
3463
+ core.Input(),
3464
+ __metadata("design:type", TableModel)
3465
+ ], TableCellRendererComponent.prototype, "tableModel", void 0);
3466
+ __decorate([
3467
+ core.HostBinding('class'),
3468
+ __metadata("design:type", Object)
3469
+ ], TableCellRendererComponent.prototype, "defaultClassNames", void 0);
3470
+ __decorate([
3471
+ core.HostBinding('class.fillCell'),
3472
+ __metadata("design:type", Object)
3473
+ ], TableCellRendererComponent.prototype, "fillCell", void 0);
3474
+ __decorate([
3475
+ core.HostBinding('class.padChild'),
3476
+ __metadata("design:type", Object)
3477
+ ], TableCellRendererComponent.prototype, "padChild", void 0);
3478
+ TableCellRendererComponent = __decorate([
3479
+ core.Component({
3480
+ selector: 'aup-table-cell-renderer',
3481
+ 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",
3482
+ styles: [""]
3483
+ }),
3484
+ __metadata("design:paramtypes", [])
3485
+ ], TableCellRendererComponent);
3486
+ return TableCellRendererComponent;
3487
+ }(DisposableComponent));
3488
+
3474
3489
  var TableHeaderCellRendererComponent = /** @class */ (function () {
3475
3490
  function TableHeaderCellRendererComponent() {
3476
3491
  this.defaultClassNames = 'aup-header-cell-renderer';
@@ -3692,7 +3707,8 @@
3692
3707
  checkbox.MatCheckboxModule,
3693
3708
  InteractionModule,
3694
3709
  table.MatTableModule,
3695
- portal.PortalModule
3710
+ portal.PortalModule,
3711
+ scrolling.CdkScrollableModule
3696
3712
  ],
3697
3713
  exports: [
3698
3714
  NumberInputComponent,
@@ -5749,9 +5765,9 @@
5749
5765
  PlaceOutletComponent = __decorate([
5750
5766
  core.Component({
5751
5767
  selector: 'aup-place-outlet',
5752
- 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",
5768
+ 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",
5753
5769
  animations: [LEFT_RIGHT_PLACE_ANIMATION],
5754
- 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}"]
5770
+ 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}"]
5755
5771
  }),
5756
5772
  __param(2, core.Optional()), __param(2, core.Inject(AUP_PLACE_CONFIG)),
5757
5773
  __param(3, core.SkipSelf()), __param(3, core.Optional()),