@coolon/angular-ui-powerups 1.13.0 → 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.
- package/CHANGELOG.md +15 -0
- package/bundles/coolon-angular-ui-powerups.umd.js +415 -406
- package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
- package/bundles/coolon-angular-ui-powerups.umd.min.js +2 -2
- package/bundles/coolon-angular-ui-powerups.umd.min.js.map +1 -1
- package/coolon-angular-ui-powerups.metadata.json +1 -1
- package/esm2015/lib/components/components.module.js +3 -1
- package/esm2015/lib/components/components.module.js.map +1 -1
- package/esm2015/lib/components/components.module.metadata.json +1 -1
- package/esm2015/lib/components/components.module.ngfactory.js.map +1 -1
- package/esm2015/lib/components/forms/abstract-input.component.js +0 -4
- package/esm2015/lib/components/forms/abstract-input.component.js.map +1 -1
- package/esm2015/lib/components/forms/abstract-input.component.metadata.json +1 -1
- package/esm2015/lib/components/scroll-container/scroll-container.component.js +1 -1
- package/esm2015/lib/components/scroll-container/scroll-container.component.js.map +1 -1
- package/esm2015/lib/components/scroll-container/scroll-container.component.metadata.json +1 -1
- package/esm2015/lib/components/table/cell-editors.js.map +1 -1
- package/esm2015/lib/components/table/column-model.js +4 -20
- package/esm2015/lib/components/table/column-model.js.map +1 -1
- package/esm2015/lib/components/table/column-model.metadata.json +1 -1
- package/esm2015/lib/components/table/table-cell-renderer/table-cell-renderer.component.js +20 -8
- package/esm2015/lib/components/table/table-cell-renderer/table-cell-renderer.component.js.map +1 -1
- package/esm2015/lib/components/table/table-cell-renderer/table-cell-renderer.component.metadata.json +1 -1
- package/esm2015/lib/components/table/table-model.js +2 -1
- package/esm2015/lib/components/table/table-model.js.map +1 -1
- package/esm2015/lib/components/table/table-model.metadata.json +1 -1
- package/esm2015/lib/interaction/components/popup-interaction-context/popup-interaction-context.component.js +23 -7
- package/esm2015/lib/interaction/components/popup-interaction-context/popup-interaction-context.component.js.map +1 -1
- package/esm2015/lib/interaction/components/popup-interaction-context/popup-interaction-context.component.metadata.json +1 -1
- package/esm2015/lib/place/components/place-outlet/place-outlet.component.js +2 -2
- package/esm2015/lib/place/components/place-outlet/place-outlet.component.js.map +1 -1
- package/esm2015/lib/place/components/place-outlet/place-outlet.component.metadata.json +1 -1
- package/esm5/lib/components/components.module.js +3 -1
- package/esm5/lib/components/components.module.js.map +1 -1
- package/esm5/lib/components/components.module.ngfactory.js.map +1 -1
- package/esm5/lib/components/forms/abstract-input.component.js +0 -8
- package/esm5/lib/components/forms/abstract-input.component.js.map +1 -1
- package/esm5/lib/components/scroll-container/scroll-container.component.js +1 -1
- package/esm5/lib/components/scroll-container/scroll-container.component.js.map +1 -1
- package/esm5/lib/components/table/cell-editors.js.map +1 -1
- package/esm5/lib/components/table/column-model.js +4 -20
- package/esm5/lib/components/table/column-model.js.map +1 -1
- package/esm5/lib/components/table/table-cell-renderer/table-cell-renderer.component.js +29 -15
- package/esm5/lib/components/table/table-cell-renderer/table-cell-renderer.component.js.map +1 -1
- package/esm5/lib/components/table/table-model.js +2 -1
- package/esm5/lib/components/table/table-model.js.map +1 -1
- package/esm5/lib/interaction/components/popup-interaction-context/popup-interaction-context.component.js +23 -7
- package/esm5/lib/interaction/components/popup-interaction-context/popup-interaction-context.component.js.map +1 -1
- package/esm5/lib/place/components/place-outlet/place-outlet.component.js +2 -2
- package/esm5/lib/place/components/place-outlet/place-outlet.component.js.map +1 -1
- package/fesm2015/coolon-angular-ui-powerups.js +384 -372
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/fesm5/coolon-angular-ui-powerups.js +414 -404
- package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
- package/lib/components/forms/abstract-input.component.d.ts +1 -1
- package/lib/components/table/table-cell-renderer/table-cell-renderer.component.d.ts +6 -2
- package/lib/components/table/table-model.d.ts +2 -1
- package/lib/interaction/components/popup-interaction-context/popup-interaction-context.component.d.ts +3 -2
- 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
|
|
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 () {
|
|
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
|
-
|
|
1371
|
+
__param(2, Optional()), __param(2, SkipSelf()),
|
|
1372
|
+
__metadata("design:paramtypes", [ElementRef, Overlay, CdkScrollable])
|
|
1356
1373
|
], PopupInteractionContextComponent);
|
|
1357
1374
|
return PopupInteractionContextComponent;
|
|
1358
1375
|
}(DisposableComponent));
|
|
@@ -1809,13 +1826,6 @@ var AbstractInputComponent = /** @class */ (function (_super) {
|
|
|
1809
1826
|
};
|
|
1810
1827
|
return _this;
|
|
1811
1828
|
}
|
|
1812
|
-
Object.defineProperty(AbstractInputComponent.prototype, "inputModel", {
|
|
1813
|
-
get: function () {
|
|
1814
|
-
return lang$1.abstractMethod(this.constructor, "inputModel");
|
|
1815
|
-
},
|
|
1816
|
-
enumerable: true,
|
|
1817
|
-
configurable: true
|
|
1818
|
-
});
|
|
1819
1829
|
AbstractInputComponent.prototype.notifyClick = function () {
|
|
1820
1830
|
this.safelyInvoke(this.clickCommand);
|
|
1821
1831
|
};
|
|
@@ -2250,7 +2260,7 @@ var ScrollContainerComponent = /** @class */ (function () {
|
|
|
2250
2260
|
ScrollContainerComponent = __decorate([
|
|
2251
2261
|
Component({
|
|
2252
2262
|
selector: 'aup-scroll-container',
|
|
2253
|
-
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",
|
|
2254
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}"]
|
|
2255
2265
|
}),
|
|
2256
2266
|
__metadata("design:paramtypes", [])
|
|
@@ -2571,400 +2581,110 @@ var SelectHeaderCellRendererComponent = /** @class */ (function (_super) {
|
|
|
2571
2581
|
return SelectHeaderCellRendererComponent;
|
|
2572
2582
|
}(DisposableComponent));
|
|
2573
2583
|
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
*
|
|
2585
|
-
* Editable tables
|
|
2586
|
-
* @example
|
|
2587
|
-
* const saveCommand = UnaryCommand.create((form: Form<Hero>) => {
|
|
2588
|
-
* if (form.validate()) {
|
|
2589
|
-
* // normal form save stuff
|
|
2590
|
-
* return true; // finish editing
|
|
2591
|
-
* }
|
|
2592
|
-
* return false; // continue editiing
|
|
2593
|
-
* }
|
|
2594
|
-
* const colorsNames: ListModel<string> = ...;
|
|
2595
|
-
* const model = TableModel.fromList(heroList, table => {
|
|
2596
|
-
* table.pluck("firstName").cellEditor(StringInputComponent); <-- interface CellEditor { valueModel: FormValueModel<string> | ValueModel<string>; }
|
|
2597
|
-
* table.pluck("lastName").cellEditor(StringInputComponent, {
|
|
2598
|
-
* validators: [Validator.present("We need a last name")]
|
|
2599
|
-
* });
|
|
2600
|
-
* table.pluck("age").cellEditor(NumberInputComponent);
|
|
2601
|
-
* table.pluck("favoriteColor").cellEditor(SelectInputComponent, {
|
|
2602
|
-
* initialiseComponent(component: SelectInputComponent) {
|
|
2603
|
-
* selectInput.optionsModel = colorsNames; // <- initialise our component
|
|
2604
|
-
* }
|
|
2605
|
-
* });
|
|
2606
|
-
* table.addEditControls(saveCommand); // <- required to enable editing
|
|
2607
|
-
* });
|
|
2608
|
-
*
|
|
2609
|
-
* Selection models
|
|
2610
|
-
* @example
|
|
2611
|
-
* const model = TableModel.fromList(heroList, table => {
|
|
2612
|
-
* table.addSelectionColumn(selectionModel); // <- can be single or multiple selection model
|
|
2613
|
-
* table.pluck("firstName");
|
|
2614
|
-
* table.pluck("lastName");
|
|
2615
|
-
* });
|
|
2616
|
-
*
|
|
2617
|
-
* Custom cell renderers and editors
|
|
2618
|
-
* @example
|
|
2619
|
-
* const model = TableModel.fromList(heroList, table => {
|
|
2620
|
-
* table.pluck("favoriteColor")
|
|
2621
|
-
* .cellHeaderRenderer(CellHeaderRendererComponent, (component, column) => {
|
|
2622
|
-
* // configure your component with what ever you need.
|
|
2623
|
-
* });
|
|
2624
|
-
* .cellRenderer(CellRendererComponent) // <-- interface CellEditor { value: string; }
|
|
2625
|
-
* .cellEditor(CellEditorComponent.); // <-- interface CellEditor { valueModel: FormValueModel<string> | ValueModel<string>; }
|
|
2626
|
-
* table.addCustomColumn("fullName", hero => `${hero.firstName} ${hero.lastName}`);
|
|
2627
|
-
* });
|
|
2628
|
-
*
|
|
2629
|
-
* I18n
|
|
2630
|
-
* @example
|
|
2631
|
-
* [table.yml]
|
|
2632
|
-
* table:
|
|
2633
|
-
* columns(ColumnTextProperties[]):
|
|
2634
|
-
* firstName:
|
|
2635
|
-
* headerText: "First Name"
|
|
2636
|
-
* fullName:
|
|
2637
|
-
* headerText: "Full Name"
|
|
2638
|
-
*
|
|
2639
|
-
* const model = TableModel.fromList(heroList, table => {
|
|
2640
|
-
* table.pluck("favoriteColor").cellRenderer(...).cellEditor(...);
|
|
2641
|
-
* table.addCustomColumn("fullName", hero => `${hero.firstName} ${hero.lastName}`);
|
|
2642
|
-
*
|
|
2643
|
-
* table.columnTextProperties(I18n.table.columns); // <- configures all columns
|
|
2644
|
-
* });
|
|
2645
|
-
*/
|
|
2646
|
-
var TableModel = /** @class */ (function () {
|
|
2647
|
-
function TableModel(sourceOfTruth) {
|
|
2648
|
-
this.sourceOfTruth = sourceOfTruth;
|
|
2649
|
-
this._garbage = new GarbageCollector();
|
|
2650
|
-
this._columns = new MutableListModel();
|
|
2651
|
-
this._editorSessions = new MutableListModel();
|
|
2652
|
-
this._createForm = function (row) { return new Form(); };
|
|
2653
|
-
this.identityOf = sourceOfTruth.identityOf;
|
|
2654
|
-
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;
|
|
2655
|
-
this._columnsById = chain(this._columns).indexBy('columnId');
|
|
2656
|
-
this._rowsBeingEdited = new MutableListModel([], {
|
|
2657
|
-
identifiedWith: this.identityOf
|
|
2658
|
-
});
|
|
2659
|
-
this._editorSessionByRowId = chain(this._editorSessions).indexBy('rowId');
|
|
2660
|
-
this.editing = chain(this._editorSessions).count().isGreaterThan(0);
|
|
2661
|
-
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() {
|
|
2662
2594
|
}
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
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);
|
|
2668
2608
|
};
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
return this._rowsBeingEdited.readonly;
|
|
2672
|
-
},
|
|
2673
|
-
enumerable: true,
|
|
2674
|
-
configurable: true
|
|
2675
|
-
});
|
|
2676
|
-
TableModel.prototype.getTrackByFunction = function () {
|
|
2677
|
-
var _this = this;
|
|
2678
|
-
return function (index, item) {
|
|
2679
|
-
return _this.identityOf ? _this.identityOf(item) : index;
|
|
2680
|
-
};
|
|
2609
|
+
CellHeaderPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
|
|
2610
|
+
this.initialiseHeader(portalComponent, host.column);
|
|
2681
2611
|
};
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
}
|
|
2689
|
-
|
|
2690
|
-
|
|
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);
|
|
2691
2631
|
};
|
|
2692
|
-
|
|
2693
|
-
|
|
2632
|
+
ComponentCellRendererPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
|
|
2633
|
+
host[PORTAL_RENDERER_COMPONENT] = portalComponent;
|
|
2634
|
+
this.updateComponent(portalComponent, host.getRowData());
|
|
2694
2635
|
};
|
|
2695
|
-
|
|
2696
|
-
|
|
2636
|
+
ComponentCellRendererPortalRef.prototype.pushState = function (host) {
|
|
2637
|
+
if (host[PORTAL_RENDERER_COMPONENT]) {
|
|
2638
|
+
this.updateComponent(host[PORTAL_RENDERER_COMPONENT], host.getRowData());
|
|
2639
|
+
}
|
|
2697
2640
|
};
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
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);
|
|
2701
2654
|
};
|
|
2702
|
-
|
|
2703
|
-
|
|
2655
|
+
// @Trace()
|
|
2656
|
+
CellEditorPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
|
|
2657
|
+
host[PORTAL_EDITOR_COMPONENT] = portalComponent;
|
|
2658
|
+
this.initialiseEditorSession(portalComponent, host.editSession);
|
|
2704
2659
|
};
|
|
2705
|
-
|
|
2706
|
-
|
|
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;
|
|
2707
2672
|
};
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
return this;
|
|
2673
|
+
TemplateCellRendererPortalRef.prototype.initialiseHost = function (host, columnModel) {
|
|
2674
|
+
assert$1.isTruthy(host);
|
|
2711
2675
|
};
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
}
|
|
2716
|
-
else {
|
|
2717
|
-
this._columns.push(column);
|
|
2718
|
-
}
|
|
2719
|
-
return column;
|
|
2676
|
+
// @Trace()
|
|
2677
|
+
TemplateCellRendererPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
|
|
2678
|
+
// don't care
|
|
2720
2679
|
};
|
|
2721
|
-
|
|
2722
|
-
|
|
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;
|
|
2723
2684
|
};
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
return factory ? factory() : undefined;
|
|
2685
|
+
TemplateCellRendererPortalRef.prototype.createPortal = function (data) {
|
|
2686
|
+
return new TemplatePortal(this.templateRef, this.viewContainer, __assign(__assign({}, (data)), { $implicit: data.row }));
|
|
2727
2687
|
};
|
|
2728
|
-
TableModel.prototype.startEditSession = function (row) {
|
|
2729
|
-
var _this = this;
|
|
2730
|
-
var rowId = this.identityOf(row);
|
|
2731
|
-
if (this._rowsBeingEdited.query().indexOf(row) > -1) {
|
|
2732
|
-
return lang.illegalState("Row with id=" + rowId + " already being edited");
|
|
2733
|
-
}
|
|
2734
|
-
else {
|
|
2735
|
-
var editSession_1 = new EditSession(rowId, row, this._createForm(row), this.saveCommand);
|
|
2736
|
-
var when = Dsl.disposeWith(editSession_1).when;
|
|
2737
|
-
when.valueOf(editSession_1.liveRowValue).changes(function (editedValue) {
|
|
2738
|
-
_this._rowsBeingEdited.replaceOrPush(editedValue);
|
|
2739
|
-
}, { initialValue: 'triggerChangeUnlessNil' });
|
|
2740
|
-
this._editorSessions.push(editSession_1);
|
|
2741
|
-
editSession_1.onDispose(function () {
|
|
2742
|
-
_this._rowsBeingEdited.remove(editSession_1.liveRowValue.value);
|
|
2743
|
-
_this._editorSessions.remove(editSession_1);
|
|
2744
|
-
});
|
|
2745
|
-
return editSession_1;
|
|
2746
|
-
}
|
|
2747
|
-
};
|
|
2748
|
-
TableModel.prototype.getEditSessionFor = function (row) {
|
|
2749
|
-
return this._editorSessionByRowId.get(this.identityOf(row));
|
|
2750
|
-
};
|
|
2751
|
-
TableModel.prototype.cancelAllEditorSessions = function () {
|
|
2752
|
-
var _this = this;
|
|
2753
|
-
this._editorSessions.runInTransaction(function (draft) {
|
|
2754
|
-
_this._rowsBeingEdited.runInTransaction(function () {
|
|
2755
|
-
draft.value.forEach(function (session) { return session.dispose(); });
|
|
2756
|
-
});
|
|
2757
|
-
});
|
|
2758
|
-
};
|
|
2759
|
-
var TableModel_1;
|
|
2760
|
-
TableModel.ctorParameters = function () { return [
|
|
2761
|
-
{ type: ListModel }
|
|
2762
|
-
]; };
|
|
2763
|
-
TableModel = TableModel_1 = __decorate([
|
|
2764
|
-
TrackExternal.Strategy(new TrackExternal.OneTimeBinding()),
|
|
2765
|
-
__metadata("design:paramtypes", [ListModel])
|
|
2766
|
-
], TableModel);
|
|
2767
|
-
return TableModel;
|
|
2768
|
-
}());
|
|
2769
|
-
|
|
2770
|
-
var TableCellRendererComponent = /** @class */ (function () {
|
|
2771
|
-
function TableCellRendererComponent() {
|
|
2772
|
-
var _this = this;
|
|
2773
|
-
this.defaultClassNames = 'aup-cell-renderer';
|
|
2774
|
-
this.fillCell = false;
|
|
2775
|
-
this.padChild = false;
|
|
2776
|
-
this.editRowCommand = Command.create(function () {
|
|
2777
|
-
_this.tableModel.startEditSession(_this.row);
|
|
2778
|
-
});
|
|
2779
|
-
}
|
|
2780
|
-
TableCellRendererComponent.prototype.ngOnInit = function () {
|
|
2781
|
-
this.column.attachCell(this);
|
|
2782
|
-
};
|
|
2783
|
-
TableCellRendererComponent.prototype.hasActiveEditor = function () {
|
|
2784
|
-
return !!this.editSession && !!this.column.hasEditorPortal();
|
|
2785
|
-
};
|
|
2786
|
-
TableCellRendererComponent.prototype.initialiseRenderer = function (instance) {
|
|
2787
|
-
this.column.onRendererAttached(this, instance);
|
|
2788
|
-
};
|
|
2789
|
-
TableCellRendererComponent.prototype.initialiseEditor = function (instance) {
|
|
2790
|
-
this.column.onEditorAttached(this, instance);
|
|
2791
|
-
};
|
|
2792
|
-
// @Trace()
|
|
2793
|
-
TableCellRendererComponent.prototype.ngOnChanges = function (changes) {
|
|
2794
|
-
this.column.updatePortalContent(this);
|
|
2795
|
-
};
|
|
2796
|
-
TableCellRendererComponent.prototype.getRendererPortal = function () {
|
|
2797
|
-
return this[CELL_RENDERER_PORTAL];
|
|
2798
|
-
};
|
|
2799
|
-
TableCellRendererComponent.prototype.getEditorPortal = function () {
|
|
2800
|
-
return this[CELL_EDITOR_PORTAL];
|
|
2801
|
-
};
|
|
2802
|
-
TableCellRendererComponent.prototype.getRowData = function () {
|
|
2803
|
-
return {
|
|
2804
|
-
row: this.row,
|
|
2805
|
-
editSession: this.editSession,
|
|
2806
|
-
editRowCommand: this.editRowCommand
|
|
2807
|
-
};
|
|
2808
|
-
};
|
|
2809
|
-
__decorate([
|
|
2810
|
-
Input(),
|
|
2811
|
-
__metadata("design:type", Object)
|
|
2812
|
-
], TableCellRendererComponent.prototype, "row", void 0);
|
|
2813
|
-
__decorate([
|
|
2814
|
-
Input(),
|
|
2815
|
-
__metadata("design:type", ColumnModel)
|
|
2816
|
-
], TableCellRendererComponent.prototype, "column", void 0);
|
|
2817
|
-
__decorate([
|
|
2818
|
-
Input(),
|
|
2819
|
-
__metadata("design:type", EditSession)
|
|
2820
|
-
], TableCellRendererComponent.prototype, "editSession", void 0);
|
|
2821
|
-
__decorate([
|
|
2822
|
-
Input(),
|
|
2823
|
-
__metadata("design:type", TableModel)
|
|
2824
|
-
], TableCellRendererComponent.prototype, "tableModel", void 0);
|
|
2825
|
-
__decorate([
|
|
2826
|
-
HostBinding('class'),
|
|
2827
|
-
__metadata("design:type", Object)
|
|
2828
|
-
], TableCellRendererComponent.prototype, "defaultClassNames", void 0);
|
|
2829
|
-
__decorate([
|
|
2830
|
-
HostBinding('class.fillCell'),
|
|
2831
|
-
__metadata("design:type", Object)
|
|
2832
|
-
], TableCellRendererComponent.prototype, "fillCell", void 0);
|
|
2833
|
-
__decorate([
|
|
2834
|
-
HostBinding('class.padChild'),
|
|
2835
|
-
__metadata("design:type", Object)
|
|
2836
|
-
], TableCellRendererComponent.prototype, "padChild", void 0);
|
|
2837
|
-
__decorate([
|
|
2838
|
-
Trace(),
|
|
2839
|
-
__metadata("design:type", Function),
|
|
2840
|
-
__metadata("design:paramtypes", [Object]),
|
|
2841
|
-
__metadata("design:returntype", void 0)
|
|
2842
|
-
], TableCellRendererComponent.prototype, "initialiseEditor", null);
|
|
2843
|
-
TableCellRendererComponent = __decorate([
|
|
2844
|
-
Component({
|
|
2845
|
-
selector: 'aup-table-cell-renderer',
|
|
2846
|
-
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",
|
|
2847
|
-
styles: [""]
|
|
2848
|
-
}),
|
|
2849
|
-
__metadata("design:paramtypes", [])
|
|
2850
|
-
], TableCellRendererComponent);
|
|
2851
|
-
return TableCellRendererComponent;
|
|
2852
|
-
}());
|
|
2853
|
-
|
|
2854
|
-
var HEADER_CELL_RENDERER_PORTAL = Symbol('aup-cell-header-renderer-component-ref');
|
|
2855
|
-
var CELL_RENDERER_PORTAL = Symbol('aup-cell-renderer-component-ref');
|
|
2856
|
-
var CELL_EDITOR_PORTAL = Symbol('aup-cell-editor-component-ref');
|
|
2857
|
-
var PORTAL_RENDERER_COMPONENT = Symbol('aup-cell-renderer-portal-component');
|
|
2858
|
-
var PORTAL_EDITOR_COMPONENT = Symbol('aup-cell-editor-portal-component');
|
|
2859
|
-
var noop = function () {
|
|
2860
|
-
};
|
|
2861
|
-
var ɵ0 = noop;
|
|
2862
|
-
var CellPortalRef = /** @class */ (function () {
|
|
2863
|
-
function CellPortalRef() {
|
|
2864
|
-
}
|
|
2865
|
-
return CellPortalRef;
|
|
2866
|
-
}());
|
|
2867
|
-
var CellHeaderPortalRef = /** @class */ (function (_super) {
|
|
2868
|
-
__extends(CellHeaderPortalRef, _super);
|
|
2869
|
-
function CellHeaderPortalRef(componentType, initialiseHeader) {
|
|
2870
|
-
var _this = _super.call(this) || this;
|
|
2871
|
-
_this.componentType = componentType;
|
|
2872
|
-
_this.initialiseHeader = initialiseHeader;
|
|
2873
|
-
return _this;
|
|
2874
|
-
}
|
|
2875
|
-
CellHeaderPortalRef.prototype.initialiseHost = function (host, columnModel) {
|
|
2876
|
-
assert$1.isTruthy(host);
|
|
2877
|
-
host[HEADER_CELL_RENDERER_PORTAL] = new ComponentPortal(this.componentType);
|
|
2878
|
-
};
|
|
2879
|
-
CellHeaderPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
|
|
2880
|
-
this.initialiseHeader(portalComponent, host.column);
|
|
2881
|
-
};
|
|
2882
|
-
return CellHeaderPortalRef;
|
|
2883
|
-
}(CellPortalRef));
|
|
2884
|
-
var CellRendererPortalRef = /** @class */ (function (_super) {
|
|
2885
|
-
__extends(CellRendererPortalRef, _super);
|
|
2886
|
-
function CellRendererPortalRef() {
|
|
2887
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
2888
|
-
}
|
|
2889
|
-
return CellRendererPortalRef;
|
|
2890
|
-
}(CellPortalRef));
|
|
2891
|
-
var ComponentCellRendererPortalRef = /** @class */ (function (_super) {
|
|
2892
|
-
__extends(ComponentCellRendererPortalRef, _super);
|
|
2893
|
-
function ComponentCellRendererPortalRef(componentType, updateComponent) {
|
|
2894
|
-
var _this = _super.call(this) || this;
|
|
2895
|
-
_this.componentType = componentType;
|
|
2896
|
-
_this.updateComponent = updateComponent;
|
|
2897
|
-
return _this;
|
|
2898
|
-
}
|
|
2899
|
-
ComponentCellRendererPortalRef.prototype.initialiseHost = function (host, columnModel) {
|
|
2900
|
-
host[CELL_RENDERER_PORTAL] = new ComponentPortal(this.componentType);
|
|
2901
|
-
};
|
|
2902
|
-
ComponentCellRendererPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
|
|
2903
|
-
host[PORTAL_RENDERER_COMPONENT] = portalComponent;
|
|
2904
|
-
this.updateComponent(portalComponent, host.getRowData());
|
|
2905
|
-
};
|
|
2906
|
-
ComponentCellRendererPortalRef.prototype.pushState = function (host) {
|
|
2907
|
-
if (host[PORTAL_RENDERER_COMPONENT]) {
|
|
2908
|
-
this.updateComponent(host[PORTAL_RENDERER_COMPONENT], host.getRowData());
|
|
2909
|
-
}
|
|
2910
|
-
};
|
|
2911
|
-
return ComponentCellRendererPortalRef;
|
|
2912
|
-
}(CellRendererPortalRef));
|
|
2913
|
-
var CellEditorPortalRef = /** @class */ (function (_super) {
|
|
2914
|
-
__extends(CellEditorPortalRef, _super);
|
|
2915
|
-
function CellEditorPortalRef(componentType, initialiseEditorSession) {
|
|
2916
|
-
var _this = _super.call(this) || this;
|
|
2917
|
-
_this.componentType = componentType;
|
|
2918
|
-
_this.initialiseEditorSession = initialiseEditorSession;
|
|
2919
|
-
return _this;
|
|
2920
|
-
}
|
|
2921
|
-
CellEditorPortalRef.prototype.initialiseHost = function (host, columnModel) {
|
|
2922
|
-
assert$1.isTruthy(host);
|
|
2923
|
-
host[CELL_EDITOR_PORTAL] = new ComponentPortal(this.componentType);
|
|
2924
|
-
};
|
|
2925
|
-
CellEditorPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
|
|
2926
|
-
host[PORTAL_EDITOR_COMPONENT] = portalComponent;
|
|
2927
|
-
this.initialiseEditorSession(portalComponent, host.editSession);
|
|
2928
|
-
};
|
|
2929
|
-
__decorate([
|
|
2930
|
-
Trace(),
|
|
2931
|
-
__metadata("design:type", Function),
|
|
2932
|
-
__metadata("design:paramtypes", [TableCellRendererComponent, Object]),
|
|
2933
|
-
__metadata("design:returntype", void 0)
|
|
2934
|
-
], CellEditorPortalRef.prototype, "onPortalAttached", null);
|
|
2935
|
-
return CellEditorPortalRef;
|
|
2936
|
-
}(CellPortalRef));
|
|
2937
|
-
var TemplateCellRendererPortalRef = /** @class */ (function (_super) {
|
|
2938
|
-
__extends(TemplateCellRendererPortalRef, _super);
|
|
2939
|
-
function TemplateCellRendererPortalRef() {
|
|
2940
|
-
return _super.call(this) || this;
|
|
2941
|
-
}
|
|
2942
|
-
TemplateCellRendererPortalRef.prototype.registerPortal = function (templateRef, viewContainer, fillCell, padChild) {
|
|
2943
|
-
this.templateRef = templateRef;
|
|
2944
|
-
this.viewContainer = viewContainer;
|
|
2945
|
-
this.fillCell = fillCell;
|
|
2946
|
-
this.padChild = padChild;
|
|
2947
|
-
};
|
|
2948
|
-
TemplateCellRendererPortalRef.prototype.initialiseHost = function (host, columnModel) {
|
|
2949
|
-
assert$1.isTruthy(host);
|
|
2950
|
-
};
|
|
2951
|
-
TemplateCellRendererPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
|
|
2952
|
-
// don't care
|
|
2953
|
-
};
|
|
2954
|
-
TemplateCellRendererPortalRef.prototype.pushState = function (host) {
|
|
2955
|
-
host[CELL_RENDERER_PORTAL] = this.createPortal(host.getRowData());
|
|
2956
|
-
host.fillCell = this.fillCell;
|
|
2957
|
-
host.padChild = this.padChild;
|
|
2958
|
-
};
|
|
2959
|
-
TemplateCellRendererPortalRef.prototype.createPortal = function (data) {
|
|
2960
|
-
return new TemplatePortal(this.templateRef, this.viewContainer, __assign(__assign({}, (data)), { $implicit: data.row }));
|
|
2961
|
-
};
|
|
2962
|
-
__decorate([
|
|
2963
|
-
Trace(),
|
|
2964
|
-
__metadata("design:type", Function),
|
|
2965
|
-
__metadata("design:paramtypes", [TableCellRendererComponent, void 0]),
|
|
2966
|
-
__metadata("design:returntype", void 0)
|
|
2967
|
-
], TemplateCellRendererPortalRef.prototype, "onPortalAttached", null);
|
|
2968
2688
|
return TemplateCellRendererPortalRef;
|
|
2969
2689
|
}(CellRendererPortalRef));
|
|
2970
2690
|
var ColumnModel = /** @class */ (function () {
|
|
@@ -3020,6 +2740,7 @@ var ColumnModel = /** @class */ (function () {
|
|
|
3020
2740
|
ColumnModel.prototype.onRendererAttached = function (host, component) {
|
|
3021
2741
|
this._cellRendererPortalRef.onPortalAttached(host, component);
|
|
3022
2742
|
};
|
|
2743
|
+
// @Trace()
|
|
3023
2744
|
ColumnModel.prototype.onEditorAttached = function (host, component) {
|
|
3024
2745
|
this._cellEditorPortalRef.onPortalAttached(host, component);
|
|
3025
2746
|
};
|
|
@@ -3038,12 +2759,6 @@ var ColumnModel = /** @class */ (function () {
|
|
|
3038
2759
|
__metadata("design:paramtypes", []),
|
|
3039
2760
|
__metadata("design:returntype", Object)
|
|
3040
2761
|
], ColumnModel.prototype, "getColumnTextProperties", null);
|
|
3041
|
-
__decorate([
|
|
3042
|
-
Trace(),
|
|
3043
|
-
__metadata("design:type", Function),
|
|
3044
|
-
__metadata("design:paramtypes", [TableCellRendererComponent, Object]),
|
|
3045
|
-
__metadata("design:returntype", void 0)
|
|
3046
|
-
], ColumnModel.prototype, "onEditorAttached", null);
|
|
3047
2762
|
return ColumnModel;
|
|
3048
2763
|
}());
|
|
3049
2764
|
var PropertyColumnModel = /** @class */ (function (_super) {
|
|
@@ -3195,6 +2910,203 @@ var SelectionColumnModel = /** @class */ (function (_super) {
|
|
|
3195
2910
|
return SelectionColumnModel;
|
|
3196
2911
|
}(ColumnModel));
|
|
3197
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
|
+
|
|
3198
3110
|
/**
|
|
3199
3111
|
* Create your model:
|
|
3200
3112
|
* @example
|
|
@@ -3303,6 +3215,103 @@ var ColumnTemplateDirective = /** @class */ (function () {
|
|
|
3303
3215
|
return ColumnTemplateDirective;
|
|
3304
3216
|
}());
|
|
3305
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
|
+
|
|
3306
3315
|
var TableHeaderCellRendererComponent = /** @class */ (function () {
|
|
3307
3316
|
function TableHeaderCellRendererComponent() {
|
|
3308
3317
|
this.defaultClassNames = 'aup-header-cell-renderer';
|
|
@@ -3524,7 +3533,8 @@ var ComponentsModule = /** @class */ (function () {
|
|
|
3524
3533
|
MatCheckboxModule,
|
|
3525
3534
|
InteractionModule,
|
|
3526
3535
|
MatTableModule,
|
|
3527
|
-
PortalModule
|
|
3536
|
+
PortalModule,
|
|
3537
|
+
CdkScrollableModule
|
|
3528
3538
|
],
|
|
3529
3539
|
exports: [
|
|
3530
3540
|
NumberInputComponent,
|
|
@@ -5581,9 +5591,9 @@ var PlaceOutletComponent = /** @class */ (function (_super) {
|
|
|
5581
5591
|
PlaceOutletComponent = __decorate([
|
|
5582
5592
|
Component({
|
|
5583
5593
|
selector: 'aup-place-outlet',
|
|
5584
|
-
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",
|
|
5585
5595
|
animations: [LEFT_RIGHT_PLACE_ANIMATION],
|
|
5586
|
-
styles: [":host{display:flex;flex-direction:column;min-height:0
|
|
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}"]
|
|
5587
5597
|
}),
|
|
5588
5598
|
__param(2, Optional()), __param(2, Inject(AUP_PLACE_CONFIG)),
|
|
5589
5599
|
__param(3, SkipSelf()), __param(3, Optional()),
|