@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,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 () {
|
|
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
|
-
|
|
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));
|
|
@@ -1984,13 +2000,6 @@
|
|
|
1984
2000
|
};
|
|
1985
2001
|
return _this;
|
|
1986
2002
|
}
|
|
1987
|
-
Object.defineProperty(AbstractInputComponent.prototype, "inputModel", {
|
|
1988
|
-
get: function () {
|
|
1989
|
-
return typescriptUtilities.lang.abstractMethod(this.constructor, "inputModel");
|
|
1990
|
-
},
|
|
1991
|
-
enumerable: true,
|
|
1992
|
-
configurable: true
|
|
1993
|
-
});
|
|
1994
2003
|
AbstractInputComponent.prototype.notifyClick = function () {
|
|
1995
2004
|
this.safelyInvoke(this.clickCommand);
|
|
1996
2005
|
};
|
|
@@ -2425,7 +2434,7 @@
|
|
|
2425
2434
|
ScrollContainerComponent = __decorate([
|
|
2426
2435
|
core.Component({
|
|
2427
2436
|
selector: 'aup-scroll-container',
|
|
2428
|
-
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",
|
|
2429
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}"]
|
|
2430
2439
|
}),
|
|
2431
2440
|
__metadata("design:paramtypes", [])
|
|
@@ -2746,400 +2755,110 @@
|
|
|
2746
2755
|
return SelectHeaderCellRendererComponent;
|
|
2747
2756
|
}(DisposableComponent));
|
|
2748
2757
|
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
*
|
|
2760
|
-
* Editable tables
|
|
2761
|
-
* @example
|
|
2762
|
-
* const saveCommand = UnaryCommand.create((form: Form<Hero>) => {
|
|
2763
|
-
* if (form.validate()) {
|
|
2764
|
-
* // normal form save stuff
|
|
2765
|
-
* return true; // finish editing
|
|
2766
|
-
* }
|
|
2767
|
-
* return false; // continue editiing
|
|
2768
|
-
* }
|
|
2769
|
-
* const colorsNames: ListModel<string> = ...;
|
|
2770
|
-
* const model = TableModel.fromList(heroList, table => {
|
|
2771
|
-
* table.pluck("firstName").cellEditor(StringInputComponent); <-- interface CellEditor { valueModel: FormValueModel<string> | ValueModel<string>; }
|
|
2772
|
-
* table.pluck("lastName").cellEditor(StringInputComponent, {
|
|
2773
|
-
* validators: [Validator.present("We need a last name")]
|
|
2774
|
-
* });
|
|
2775
|
-
* table.pluck("age").cellEditor(NumberInputComponent);
|
|
2776
|
-
* table.pluck("favoriteColor").cellEditor(SelectInputComponent, {
|
|
2777
|
-
* initialiseComponent(component: SelectInputComponent) {
|
|
2778
|
-
* selectInput.optionsModel = colorsNames; // <- initialise our component
|
|
2779
|
-
* }
|
|
2780
|
-
* });
|
|
2781
|
-
* table.addEditControls(saveCommand); // <- required to enable editing
|
|
2782
|
-
* });
|
|
2783
|
-
*
|
|
2784
|
-
* Selection models
|
|
2785
|
-
* @example
|
|
2786
|
-
* const model = TableModel.fromList(heroList, table => {
|
|
2787
|
-
* table.addSelectionColumn(selectionModel); // <- can be single or multiple selection model
|
|
2788
|
-
* table.pluck("firstName");
|
|
2789
|
-
* table.pluck("lastName");
|
|
2790
|
-
* });
|
|
2791
|
-
*
|
|
2792
|
-
* Custom cell renderers and editors
|
|
2793
|
-
* @example
|
|
2794
|
-
* const model = TableModel.fromList(heroList, table => {
|
|
2795
|
-
* table.pluck("favoriteColor")
|
|
2796
|
-
* .cellHeaderRenderer(CellHeaderRendererComponent, (component, column) => {
|
|
2797
|
-
* // configure your component with what ever you need.
|
|
2798
|
-
* });
|
|
2799
|
-
* .cellRenderer(CellRendererComponent) // <-- interface CellEditor { value: string; }
|
|
2800
|
-
* .cellEditor(CellEditorComponent.); // <-- interface CellEditor { valueModel: FormValueModel<string> | ValueModel<string>; }
|
|
2801
|
-
* table.addCustomColumn("fullName", hero => `${hero.firstName} ${hero.lastName}`);
|
|
2802
|
-
* });
|
|
2803
|
-
*
|
|
2804
|
-
* I18n
|
|
2805
|
-
* @example
|
|
2806
|
-
* [table.yml]
|
|
2807
|
-
* table:
|
|
2808
|
-
* columns(ColumnTextProperties[]):
|
|
2809
|
-
* firstName:
|
|
2810
|
-
* headerText: "First Name"
|
|
2811
|
-
* fullName:
|
|
2812
|
-
* headerText: "Full Name"
|
|
2813
|
-
*
|
|
2814
|
-
* const model = TableModel.fromList(heroList, table => {
|
|
2815
|
-
* table.pluck("favoriteColor").cellRenderer(...).cellEditor(...);
|
|
2816
|
-
* table.addCustomColumn("fullName", hero => `${hero.firstName} ${hero.lastName}`);
|
|
2817
|
-
*
|
|
2818
|
-
* table.columnTextProperties(I18n.table.columns); // <- configures all columns
|
|
2819
|
-
* });
|
|
2820
|
-
*/
|
|
2821
|
-
var TableModel = /** @class */ (function () {
|
|
2822
|
-
function TableModel(sourceOfTruth) {
|
|
2823
|
-
this.sourceOfTruth = sourceOfTruth;
|
|
2824
|
-
this._garbage = new pectin.GarbageCollector();
|
|
2825
|
-
this._columns = new pectin.MutableListModel();
|
|
2826
|
-
this._editorSessions = new pectin.MutableListModel();
|
|
2827
|
-
this._createForm = function (row) { return new pectin.Form(); };
|
|
2828
|
-
this.identityOf = sourceOfTruth.identityOf;
|
|
2829
|
-
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;
|
|
2830
|
-
this._columnsById = chain(this._columns).indexBy('columnId');
|
|
2831
|
-
this._rowsBeingEdited = new pectin.MutableListModel([], {
|
|
2832
|
-
identifiedWith: this.identityOf
|
|
2833
|
-
});
|
|
2834
|
-
this._editorSessionByRowId = chain(this._editorSessions).indexBy('rowId');
|
|
2835
|
-
this.editing = chain(this._editorSessions).count().isGreaterThan(0);
|
|
2836
|
-
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() {
|
|
2837
2768
|
}
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
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);
|
|
2843
2782
|
};
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
return this._rowsBeingEdited.readonly;
|
|
2847
|
-
},
|
|
2848
|
-
enumerable: true,
|
|
2849
|
-
configurable: true
|
|
2850
|
-
});
|
|
2851
|
-
TableModel.prototype.getTrackByFunction = function () {
|
|
2852
|
-
var _this = this;
|
|
2853
|
-
return function (index, item) {
|
|
2854
|
-
return _this.identityOf ? _this.identityOf(item) : index;
|
|
2855
|
-
};
|
|
2783
|
+
CellHeaderPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
|
|
2784
|
+
this.initialiseHeader(portalComponent, host.column);
|
|
2856
2785
|
};
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
}
|
|
2864
|
-
|
|
2865
|
-
|
|
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);
|
|
2866
2805
|
};
|
|
2867
|
-
|
|
2868
|
-
|
|
2806
|
+
ComponentCellRendererPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
|
|
2807
|
+
host[PORTAL_RENDERER_COMPONENT] = portalComponent;
|
|
2808
|
+
this.updateComponent(portalComponent, host.getRowData());
|
|
2869
2809
|
};
|
|
2870
|
-
|
|
2871
|
-
|
|
2810
|
+
ComponentCellRendererPortalRef.prototype.pushState = function (host) {
|
|
2811
|
+
if (host[PORTAL_RENDERER_COMPONENT]) {
|
|
2812
|
+
this.updateComponent(host[PORTAL_RENDERER_COMPONENT], host.getRowData());
|
|
2813
|
+
}
|
|
2872
2814
|
};
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
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);
|
|
2876
2828
|
};
|
|
2877
|
-
|
|
2878
|
-
|
|
2829
|
+
// @Trace()
|
|
2830
|
+
CellEditorPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
|
|
2831
|
+
host[PORTAL_EDITOR_COMPONENT] = portalComponent;
|
|
2832
|
+
this.initialiseEditorSession(portalComponent, host.editSession);
|
|
2879
2833
|
};
|
|
2880
|
-
|
|
2881
|
-
|
|
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;
|
|
2882
2846
|
};
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
return this;
|
|
2847
|
+
TemplateCellRendererPortalRef.prototype.initialiseHost = function (host, columnModel) {
|
|
2848
|
+
typescriptUtilities.assert.isTruthy(host);
|
|
2886
2849
|
};
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
}
|
|
2891
|
-
else {
|
|
2892
|
-
this._columns.push(column);
|
|
2893
|
-
}
|
|
2894
|
-
return column;
|
|
2850
|
+
// @Trace()
|
|
2851
|
+
TemplateCellRendererPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
|
|
2852
|
+
// don't care
|
|
2895
2853
|
};
|
|
2896
|
-
|
|
2897
|
-
|
|
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;
|
|
2898
2858
|
};
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
return factory ? factory() : undefined;
|
|
2859
|
+
TemplateCellRendererPortalRef.prototype.createPortal = function (data) {
|
|
2860
|
+
return new portal.TemplatePortal(this.templateRef, this.viewContainer, __assign(__assign({}, (data)), { $implicit: data.row }));
|
|
2902
2861
|
};
|
|
2903
|
-
TableModel.prototype.startEditSession = function (row) {
|
|
2904
|
-
var _this = this;
|
|
2905
|
-
var rowId = this.identityOf(row);
|
|
2906
|
-
if (this._rowsBeingEdited.query().indexOf(row) > -1) {
|
|
2907
|
-
return pectin.lang.illegalState("Row with id=" + rowId + " already being edited");
|
|
2908
|
-
}
|
|
2909
|
-
else {
|
|
2910
|
-
var editSession_1 = new EditSession(rowId, row, this._createForm(row), this.saveCommand);
|
|
2911
|
-
var when = pectin.Dsl.disposeWith(editSession_1).when;
|
|
2912
|
-
when.valueOf(editSession_1.liveRowValue).changes(function (editedValue) {
|
|
2913
|
-
_this._rowsBeingEdited.replaceOrPush(editedValue);
|
|
2914
|
-
}, { initialValue: 'triggerChangeUnlessNil' });
|
|
2915
|
-
this._editorSessions.push(editSession_1);
|
|
2916
|
-
editSession_1.onDispose(function () {
|
|
2917
|
-
_this._rowsBeingEdited.remove(editSession_1.liveRowValue.value);
|
|
2918
|
-
_this._editorSessions.remove(editSession_1);
|
|
2919
|
-
});
|
|
2920
|
-
return editSession_1;
|
|
2921
|
-
}
|
|
2922
|
-
};
|
|
2923
|
-
TableModel.prototype.getEditSessionFor = function (row) {
|
|
2924
|
-
return this._editorSessionByRowId.get(this.identityOf(row));
|
|
2925
|
-
};
|
|
2926
|
-
TableModel.prototype.cancelAllEditorSessions = function () {
|
|
2927
|
-
var _this = this;
|
|
2928
|
-
this._editorSessions.runInTransaction(function (draft) {
|
|
2929
|
-
_this._rowsBeingEdited.runInTransaction(function () {
|
|
2930
|
-
draft.value.forEach(function (session) { return session.dispose(); });
|
|
2931
|
-
});
|
|
2932
|
-
});
|
|
2933
|
-
};
|
|
2934
|
-
var TableModel_1;
|
|
2935
|
-
TableModel.ctorParameters = function () { return [
|
|
2936
|
-
{ type: pectin.ListModel }
|
|
2937
|
-
]; };
|
|
2938
|
-
TableModel = TableModel_1 = __decorate([
|
|
2939
|
-
pectin.TrackExternal.Strategy(new pectin.TrackExternal.OneTimeBinding()),
|
|
2940
|
-
__metadata("design:paramtypes", [pectin.ListModel])
|
|
2941
|
-
], TableModel);
|
|
2942
|
-
return TableModel;
|
|
2943
|
-
}());
|
|
2944
|
-
|
|
2945
|
-
var TableCellRendererComponent = /** @class */ (function () {
|
|
2946
|
-
function TableCellRendererComponent() {
|
|
2947
|
-
var _this = this;
|
|
2948
|
-
this.defaultClassNames = 'aup-cell-renderer';
|
|
2949
|
-
this.fillCell = false;
|
|
2950
|
-
this.padChild = false;
|
|
2951
|
-
this.editRowCommand = pectin.Command.create(function () {
|
|
2952
|
-
_this.tableModel.startEditSession(_this.row);
|
|
2953
|
-
});
|
|
2954
|
-
}
|
|
2955
|
-
TableCellRendererComponent.prototype.ngOnInit = function () {
|
|
2956
|
-
this.column.attachCell(this);
|
|
2957
|
-
};
|
|
2958
|
-
TableCellRendererComponent.prototype.hasActiveEditor = function () {
|
|
2959
|
-
return !!this.editSession && !!this.column.hasEditorPortal();
|
|
2960
|
-
};
|
|
2961
|
-
TableCellRendererComponent.prototype.initialiseRenderer = function (instance) {
|
|
2962
|
-
this.column.onRendererAttached(this, instance);
|
|
2963
|
-
};
|
|
2964
|
-
TableCellRendererComponent.prototype.initialiseEditor = function (instance) {
|
|
2965
|
-
this.column.onEditorAttached(this, instance);
|
|
2966
|
-
};
|
|
2967
|
-
// @Trace()
|
|
2968
|
-
TableCellRendererComponent.prototype.ngOnChanges = function (changes) {
|
|
2969
|
-
this.column.updatePortalContent(this);
|
|
2970
|
-
};
|
|
2971
|
-
TableCellRendererComponent.prototype.getRendererPortal = function () {
|
|
2972
|
-
return this[CELL_RENDERER_PORTAL];
|
|
2973
|
-
};
|
|
2974
|
-
TableCellRendererComponent.prototype.getEditorPortal = function () {
|
|
2975
|
-
return this[CELL_EDITOR_PORTAL];
|
|
2976
|
-
};
|
|
2977
|
-
TableCellRendererComponent.prototype.getRowData = function () {
|
|
2978
|
-
return {
|
|
2979
|
-
row: this.row,
|
|
2980
|
-
editSession: this.editSession,
|
|
2981
|
-
editRowCommand: this.editRowCommand
|
|
2982
|
-
};
|
|
2983
|
-
};
|
|
2984
|
-
__decorate([
|
|
2985
|
-
core.Input(),
|
|
2986
|
-
__metadata("design:type", Object)
|
|
2987
|
-
], TableCellRendererComponent.prototype, "row", void 0);
|
|
2988
|
-
__decorate([
|
|
2989
|
-
core.Input(),
|
|
2990
|
-
__metadata("design:type", ColumnModel)
|
|
2991
|
-
], TableCellRendererComponent.prototype, "column", void 0);
|
|
2992
|
-
__decorate([
|
|
2993
|
-
core.Input(),
|
|
2994
|
-
__metadata("design:type", EditSession)
|
|
2995
|
-
], TableCellRendererComponent.prototype, "editSession", void 0);
|
|
2996
|
-
__decorate([
|
|
2997
|
-
core.Input(),
|
|
2998
|
-
__metadata("design:type", TableModel)
|
|
2999
|
-
], TableCellRendererComponent.prototype, "tableModel", void 0);
|
|
3000
|
-
__decorate([
|
|
3001
|
-
core.HostBinding('class'),
|
|
3002
|
-
__metadata("design:type", Object)
|
|
3003
|
-
], TableCellRendererComponent.prototype, "defaultClassNames", void 0);
|
|
3004
|
-
__decorate([
|
|
3005
|
-
core.HostBinding('class.fillCell'),
|
|
3006
|
-
__metadata("design:type", Object)
|
|
3007
|
-
], TableCellRendererComponent.prototype, "fillCell", void 0);
|
|
3008
|
-
__decorate([
|
|
3009
|
-
core.HostBinding('class.padChild'),
|
|
3010
|
-
__metadata("design:type", Object)
|
|
3011
|
-
], TableCellRendererComponent.prototype, "padChild", void 0);
|
|
3012
|
-
__decorate([
|
|
3013
|
-
pectin.Trace(),
|
|
3014
|
-
__metadata("design:type", Function),
|
|
3015
|
-
__metadata("design:paramtypes", [Object]),
|
|
3016
|
-
__metadata("design:returntype", void 0)
|
|
3017
|
-
], TableCellRendererComponent.prototype, "initialiseEditor", null);
|
|
3018
|
-
TableCellRendererComponent = __decorate([
|
|
3019
|
-
core.Component({
|
|
3020
|
-
selector: 'aup-table-cell-renderer',
|
|
3021
|
-
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",
|
|
3022
|
-
styles: [""]
|
|
3023
|
-
}),
|
|
3024
|
-
__metadata("design:paramtypes", [])
|
|
3025
|
-
], TableCellRendererComponent);
|
|
3026
|
-
return TableCellRendererComponent;
|
|
3027
|
-
}());
|
|
3028
|
-
|
|
3029
|
-
var HEADER_CELL_RENDERER_PORTAL = Symbol('aup-cell-header-renderer-component-ref');
|
|
3030
|
-
var CELL_RENDERER_PORTAL = Symbol('aup-cell-renderer-component-ref');
|
|
3031
|
-
var CELL_EDITOR_PORTAL = Symbol('aup-cell-editor-component-ref');
|
|
3032
|
-
var PORTAL_RENDERER_COMPONENT = Symbol('aup-cell-renderer-portal-component');
|
|
3033
|
-
var PORTAL_EDITOR_COMPONENT = Symbol('aup-cell-editor-portal-component');
|
|
3034
|
-
var noop = function () {
|
|
3035
|
-
};
|
|
3036
|
-
var ɵ0 = noop;
|
|
3037
|
-
var CellPortalRef = /** @class */ (function () {
|
|
3038
|
-
function CellPortalRef() {
|
|
3039
|
-
}
|
|
3040
|
-
return CellPortalRef;
|
|
3041
|
-
}());
|
|
3042
|
-
var CellHeaderPortalRef = /** @class */ (function (_super) {
|
|
3043
|
-
__extends(CellHeaderPortalRef, _super);
|
|
3044
|
-
function CellHeaderPortalRef(componentType, initialiseHeader) {
|
|
3045
|
-
var _this = _super.call(this) || this;
|
|
3046
|
-
_this.componentType = componentType;
|
|
3047
|
-
_this.initialiseHeader = initialiseHeader;
|
|
3048
|
-
return _this;
|
|
3049
|
-
}
|
|
3050
|
-
CellHeaderPortalRef.prototype.initialiseHost = function (host, columnModel) {
|
|
3051
|
-
typescriptUtilities.assert.isTruthy(host);
|
|
3052
|
-
host[HEADER_CELL_RENDERER_PORTAL] = new portal.ComponentPortal(this.componentType);
|
|
3053
|
-
};
|
|
3054
|
-
CellHeaderPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
|
|
3055
|
-
this.initialiseHeader(portalComponent, host.column);
|
|
3056
|
-
};
|
|
3057
|
-
return CellHeaderPortalRef;
|
|
3058
|
-
}(CellPortalRef));
|
|
3059
|
-
var CellRendererPortalRef = /** @class */ (function (_super) {
|
|
3060
|
-
__extends(CellRendererPortalRef, _super);
|
|
3061
|
-
function CellRendererPortalRef() {
|
|
3062
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
3063
|
-
}
|
|
3064
|
-
return CellRendererPortalRef;
|
|
3065
|
-
}(CellPortalRef));
|
|
3066
|
-
var ComponentCellRendererPortalRef = /** @class */ (function (_super) {
|
|
3067
|
-
__extends(ComponentCellRendererPortalRef, _super);
|
|
3068
|
-
function ComponentCellRendererPortalRef(componentType, updateComponent) {
|
|
3069
|
-
var _this = _super.call(this) || this;
|
|
3070
|
-
_this.componentType = componentType;
|
|
3071
|
-
_this.updateComponent = updateComponent;
|
|
3072
|
-
return _this;
|
|
3073
|
-
}
|
|
3074
|
-
ComponentCellRendererPortalRef.prototype.initialiseHost = function (host, columnModel) {
|
|
3075
|
-
host[CELL_RENDERER_PORTAL] = new portal.ComponentPortal(this.componentType);
|
|
3076
|
-
};
|
|
3077
|
-
ComponentCellRendererPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
|
|
3078
|
-
host[PORTAL_RENDERER_COMPONENT] = portalComponent;
|
|
3079
|
-
this.updateComponent(portalComponent, host.getRowData());
|
|
3080
|
-
};
|
|
3081
|
-
ComponentCellRendererPortalRef.prototype.pushState = function (host) {
|
|
3082
|
-
if (host[PORTAL_RENDERER_COMPONENT]) {
|
|
3083
|
-
this.updateComponent(host[PORTAL_RENDERER_COMPONENT], host.getRowData());
|
|
3084
|
-
}
|
|
3085
|
-
};
|
|
3086
|
-
return ComponentCellRendererPortalRef;
|
|
3087
|
-
}(CellRendererPortalRef));
|
|
3088
|
-
var CellEditorPortalRef = /** @class */ (function (_super) {
|
|
3089
|
-
__extends(CellEditorPortalRef, _super);
|
|
3090
|
-
function CellEditorPortalRef(componentType, initialiseEditorSession) {
|
|
3091
|
-
var _this = _super.call(this) || this;
|
|
3092
|
-
_this.componentType = componentType;
|
|
3093
|
-
_this.initialiseEditorSession = initialiseEditorSession;
|
|
3094
|
-
return _this;
|
|
3095
|
-
}
|
|
3096
|
-
CellEditorPortalRef.prototype.initialiseHost = function (host, columnModel) {
|
|
3097
|
-
typescriptUtilities.assert.isTruthy(host);
|
|
3098
|
-
host[CELL_EDITOR_PORTAL] = new portal.ComponentPortal(this.componentType);
|
|
3099
|
-
};
|
|
3100
|
-
CellEditorPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
|
|
3101
|
-
host[PORTAL_EDITOR_COMPONENT] = portalComponent;
|
|
3102
|
-
this.initialiseEditorSession(portalComponent, host.editSession);
|
|
3103
|
-
};
|
|
3104
|
-
__decorate([
|
|
3105
|
-
pectin.Trace(),
|
|
3106
|
-
__metadata("design:type", Function),
|
|
3107
|
-
__metadata("design:paramtypes", [TableCellRendererComponent, Object]),
|
|
3108
|
-
__metadata("design:returntype", void 0)
|
|
3109
|
-
], CellEditorPortalRef.prototype, "onPortalAttached", null);
|
|
3110
|
-
return CellEditorPortalRef;
|
|
3111
|
-
}(CellPortalRef));
|
|
3112
|
-
var TemplateCellRendererPortalRef = /** @class */ (function (_super) {
|
|
3113
|
-
__extends(TemplateCellRendererPortalRef, _super);
|
|
3114
|
-
function TemplateCellRendererPortalRef() {
|
|
3115
|
-
return _super.call(this) || this;
|
|
3116
|
-
}
|
|
3117
|
-
TemplateCellRendererPortalRef.prototype.registerPortal = function (templateRef, viewContainer, fillCell, padChild) {
|
|
3118
|
-
this.templateRef = templateRef;
|
|
3119
|
-
this.viewContainer = viewContainer;
|
|
3120
|
-
this.fillCell = fillCell;
|
|
3121
|
-
this.padChild = padChild;
|
|
3122
|
-
};
|
|
3123
|
-
TemplateCellRendererPortalRef.prototype.initialiseHost = function (host, columnModel) {
|
|
3124
|
-
typescriptUtilities.assert.isTruthy(host);
|
|
3125
|
-
};
|
|
3126
|
-
TemplateCellRendererPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
|
|
3127
|
-
// don't care
|
|
3128
|
-
};
|
|
3129
|
-
TemplateCellRendererPortalRef.prototype.pushState = function (host) {
|
|
3130
|
-
host[CELL_RENDERER_PORTAL] = this.createPortal(host.getRowData());
|
|
3131
|
-
host.fillCell = this.fillCell;
|
|
3132
|
-
host.padChild = this.padChild;
|
|
3133
|
-
};
|
|
3134
|
-
TemplateCellRendererPortalRef.prototype.createPortal = function (data) {
|
|
3135
|
-
return new portal.TemplatePortal(this.templateRef, this.viewContainer, __assign(__assign({}, (data)), { $implicit: data.row }));
|
|
3136
|
-
};
|
|
3137
|
-
__decorate([
|
|
3138
|
-
pectin.Trace(),
|
|
3139
|
-
__metadata("design:type", Function),
|
|
3140
|
-
__metadata("design:paramtypes", [TableCellRendererComponent, void 0]),
|
|
3141
|
-
__metadata("design:returntype", void 0)
|
|
3142
|
-
], TemplateCellRendererPortalRef.prototype, "onPortalAttached", null);
|
|
3143
2862
|
return TemplateCellRendererPortalRef;
|
|
3144
2863
|
}(CellRendererPortalRef));
|
|
3145
2864
|
var ColumnModel = /** @class */ (function () {
|
|
@@ -3195,6 +2914,7 @@
|
|
|
3195
2914
|
ColumnModel.prototype.onRendererAttached = function (host, component) {
|
|
3196
2915
|
this._cellRendererPortalRef.onPortalAttached(host, component);
|
|
3197
2916
|
};
|
|
2917
|
+
// @Trace()
|
|
3198
2918
|
ColumnModel.prototype.onEditorAttached = function (host, component) {
|
|
3199
2919
|
this._cellEditorPortalRef.onPortalAttached(host, component);
|
|
3200
2920
|
};
|
|
@@ -3213,12 +2933,6 @@
|
|
|
3213
2933
|
__metadata("design:paramtypes", []),
|
|
3214
2934
|
__metadata("design:returntype", Object)
|
|
3215
2935
|
], ColumnModel.prototype, "getColumnTextProperties", null);
|
|
3216
|
-
__decorate([
|
|
3217
|
-
pectin.Trace(),
|
|
3218
|
-
__metadata("design:type", Function),
|
|
3219
|
-
__metadata("design:paramtypes", [TableCellRendererComponent, Object]),
|
|
3220
|
-
__metadata("design:returntype", void 0)
|
|
3221
|
-
], ColumnModel.prototype, "onEditorAttached", null);
|
|
3222
2936
|
return ColumnModel;
|
|
3223
2937
|
}());
|
|
3224
2938
|
var PropertyColumnModel = /** @class */ (function (_super) {
|
|
@@ -3370,6 +3084,203 @@
|
|
|
3370
3084
|
return SelectionColumnModel;
|
|
3371
3085
|
}(ColumnModel));
|
|
3372
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
|
+
|
|
3373
3284
|
/**
|
|
3374
3285
|
* Create your model:
|
|
3375
3286
|
* @example
|
|
@@ -3478,6 +3389,103 @@
|
|
|
3478
3389
|
return ColumnTemplateDirective;
|
|
3479
3390
|
}());
|
|
3480
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
|
+
|
|
3481
3489
|
var TableHeaderCellRendererComponent = /** @class */ (function () {
|
|
3482
3490
|
function TableHeaderCellRendererComponent() {
|
|
3483
3491
|
this.defaultClassNames = 'aup-header-cell-renderer';
|
|
@@ -3699,7 +3707,8 @@
|
|
|
3699
3707
|
checkbox.MatCheckboxModule,
|
|
3700
3708
|
InteractionModule,
|
|
3701
3709
|
table.MatTableModule,
|
|
3702
|
-
portal.PortalModule
|
|
3710
|
+
portal.PortalModule,
|
|
3711
|
+
scrolling.CdkScrollableModule
|
|
3703
3712
|
],
|
|
3704
3713
|
exports: [
|
|
3705
3714
|
NumberInputComponent,
|
|
@@ -5756,9 +5765,9 @@
|
|
|
5756
5765
|
PlaceOutletComponent = __decorate([
|
|
5757
5766
|
core.Component({
|
|
5758
5767
|
selector: 'aup-place-outlet',
|
|
5759
|
-
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",
|
|
5760
5769
|
animations: [LEFT_RIGHT_PLACE_ANIMATION],
|
|
5761
|
-
styles: [":host{display:flex;flex-direction:column;min-height:0
|
|
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}"]
|
|
5762
5771
|
}),
|
|
5763
5772
|
__param(2, core.Optional()), __param(2, core.Inject(AUP_PLACE_CONFIG)),
|
|
5764
5773
|
__param(3, core.SkipSelf()), __param(3, core.Optional()),
|