@coolon/angular-ui-powerups 1.13.1 → 1.13.3
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 +557 -540
- 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/index.js +1 -0
- package/esm2015/lib/components/index.js.map +1 -1
- package/esm2015/lib/components/index.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/cell-protal-ref.js +89 -0
- package/esm2015/lib/components/table/cell-protal-ref.js.map +1 -0
- package/esm2015/lib/components/table/cell-protal-ref.metadata.json +1 -0
- package/esm2015/lib/components/table/column-model.js +3 -105
- 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 +22 -9
- 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-header-cell-renderer/table-header-cell-renderer.component.js +2 -1
- package/esm2015/lib/components/table/table-header-cell-renderer/table-header-cell-renderer.component.js.map +1 -1
- package/esm2015/lib/components/table/table-header-cell-renderer/table-header-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/index.js +1 -0
- package/esm5/lib/components/index.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/cell-protal-ref.js +113 -0
- package/esm5/lib/components/table/cell-protal-ref.js.map +1 -0
- package/esm5/lib/components/table/column-model.js +4 -129
- package/esm5/lib/components/table/column-model.js.map +1 -1
- package/esm5/lib/components/table/table-cell-renderer/table-cell-renderer.component.js +31 -16
- package/esm5/lib/components/table/table-cell-renderer/table-cell-renderer.component.js.map +1 -1
- package/esm5/lib/components/table/table-header-cell-renderer/table-header-cell-renderer.component.js +2 -1
- package/esm5/lib/components/table/table-header-cell-renderer/table-header-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 +527 -511
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/fesm5/coolon-angular-ui-powerups.js +556 -538
- package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
- package/lib/components/index.d.ts +1 -0
- package/lib/components/table/cell-protal-ref.d.ts +53 -0
- package/lib/components/table/column-model.d.ts +2 -48
- package/lib/components/table/table-cell-renderer/table-cell-renderer.component.d.ts +8 -3
- package/lib/components/table/table-header-cell-renderer/table-header-cell-renderer.component.d.ts +2 -1
- 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));
|
|
@@ -2418,7 +2434,7 @@
|
|
|
2418
2434
|
ScrollContainerComponent = __decorate([
|
|
2419
2435
|
core.Component({
|
|
2420
2436
|
selector: 'aup-scroll-container',
|
|
2421
|
-
template: "<div class=\"container\">\n <ng-content></ng-content>\n</div>\n",
|
|
2437
|
+
template: "<div class=\"container\" cdkScrollable>\n <ng-content></ng-content>\n</div>\n",
|
|
2422
2438
|
styles: [":host{display:flex;flex-direction:column;min-height:0;align-items:stretch}.container{display:flex;flex-direction:column;flex:1;flex-basis:0;overflow-y:scroll;align-items:stretch}"]
|
|
2423
2439
|
}),
|
|
2424
2440
|
__metadata("design:paramtypes", [])
|
|
@@ -2562,6 +2578,110 @@
|
|
|
2562
2578
|
return SwitchCaseComponent;
|
|
2563
2579
|
}(DisposableComponent));
|
|
2564
2580
|
|
|
2581
|
+
var HEADER_CELL_RENDERER_PORTAL = Symbol('aup-cell-header-renderer-component-ref');
|
|
2582
|
+
var CELL_RENDERER_PORTAL = Symbol('aup-cell-renderer-component-ref');
|
|
2583
|
+
var CELL_EDITOR_PORTAL = Symbol('aup-cell-editor-component-ref');
|
|
2584
|
+
var PORTAL_RENDERER_COMPONENT = Symbol('aup-cell-renderer-portal-component');
|
|
2585
|
+
var PORTAL_EDITOR_COMPONENT = Symbol('aup-cell-editor-portal-component');
|
|
2586
|
+
var CellPortalRef = /** @class */ (function () {
|
|
2587
|
+
function CellPortalRef() {
|
|
2588
|
+
}
|
|
2589
|
+
return CellPortalRef;
|
|
2590
|
+
}());
|
|
2591
|
+
var CellHeaderPortalRef = /** @class */ (function (_super) {
|
|
2592
|
+
__extends(CellHeaderPortalRef, _super);
|
|
2593
|
+
function CellHeaderPortalRef(componentType, initialiseHeader) {
|
|
2594
|
+
var _this = _super.call(this) || this;
|
|
2595
|
+
_this.componentType = componentType;
|
|
2596
|
+
_this.initialiseHeader = initialiseHeader;
|
|
2597
|
+
return _this;
|
|
2598
|
+
}
|
|
2599
|
+
CellHeaderPortalRef.prototype.initialiseHost = function (host, columnModel) {
|
|
2600
|
+
typescriptUtilities.assert.isTruthy(host);
|
|
2601
|
+
host[HEADER_CELL_RENDERER_PORTAL] = new portal.ComponentPortal(this.componentType);
|
|
2602
|
+
};
|
|
2603
|
+
CellHeaderPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
|
|
2604
|
+
this.initialiseHeader(portalComponent, host.column);
|
|
2605
|
+
};
|
|
2606
|
+
return CellHeaderPortalRef;
|
|
2607
|
+
}(CellPortalRef));
|
|
2608
|
+
var CellRendererPortalRef = /** @class */ (function (_super) {
|
|
2609
|
+
__extends(CellRendererPortalRef, _super);
|
|
2610
|
+
function CellRendererPortalRef() {
|
|
2611
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
2612
|
+
}
|
|
2613
|
+
return CellRendererPortalRef;
|
|
2614
|
+
}(CellPortalRef));
|
|
2615
|
+
var ComponentCellRendererPortalRef = /** @class */ (function (_super) {
|
|
2616
|
+
__extends(ComponentCellRendererPortalRef, _super);
|
|
2617
|
+
function ComponentCellRendererPortalRef(componentType, updateComponent) {
|
|
2618
|
+
var _this = _super.call(this) || this;
|
|
2619
|
+
_this.componentType = componentType;
|
|
2620
|
+
_this.updateComponent = updateComponent;
|
|
2621
|
+
return _this;
|
|
2622
|
+
}
|
|
2623
|
+
ComponentCellRendererPortalRef.prototype.initialiseHost = function (host, columnModel) {
|
|
2624
|
+
host[CELL_RENDERER_PORTAL] = new portal.ComponentPortal(this.componentType);
|
|
2625
|
+
};
|
|
2626
|
+
ComponentCellRendererPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
|
|
2627
|
+
host[PORTAL_RENDERER_COMPONENT] = portalComponent;
|
|
2628
|
+
this.updateComponent(portalComponent, host.getRowData());
|
|
2629
|
+
};
|
|
2630
|
+
ComponentCellRendererPortalRef.prototype.pushState = function (host) {
|
|
2631
|
+
if (host[PORTAL_RENDERER_COMPONENT]) {
|
|
2632
|
+
this.updateComponent(host[PORTAL_RENDERER_COMPONENT], host.getRowData());
|
|
2633
|
+
}
|
|
2634
|
+
};
|
|
2635
|
+
return ComponentCellRendererPortalRef;
|
|
2636
|
+
}(CellRendererPortalRef));
|
|
2637
|
+
var CellEditorPortalRef = /** @class */ (function (_super) {
|
|
2638
|
+
__extends(CellEditorPortalRef, _super);
|
|
2639
|
+
function CellEditorPortalRef(componentType, initialiseEditorSession) {
|
|
2640
|
+
var _this = _super.call(this) || this;
|
|
2641
|
+
_this.componentType = componentType;
|
|
2642
|
+
_this.initialiseEditorSession = initialiseEditorSession;
|
|
2643
|
+
return _this;
|
|
2644
|
+
}
|
|
2645
|
+
CellEditorPortalRef.prototype.initialiseHost = function (host, columnModel) {
|
|
2646
|
+
typescriptUtilities.assert.isTruthy(host);
|
|
2647
|
+
host[CELL_EDITOR_PORTAL] = new portal.ComponentPortal(this.componentType);
|
|
2648
|
+
};
|
|
2649
|
+
// @Trace()
|
|
2650
|
+
CellEditorPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
|
|
2651
|
+
host[PORTAL_EDITOR_COMPONENT] = portalComponent;
|
|
2652
|
+
this.initialiseEditorSession(portalComponent, host.editSession);
|
|
2653
|
+
};
|
|
2654
|
+
return CellEditorPortalRef;
|
|
2655
|
+
}(CellPortalRef));
|
|
2656
|
+
var TemplateCellRendererPortalRef = /** @class */ (function (_super) {
|
|
2657
|
+
__extends(TemplateCellRendererPortalRef, _super);
|
|
2658
|
+
function TemplateCellRendererPortalRef() {
|
|
2659
|
+
return _super.call(this) || this;
|
|
2660
|
+
}
|
|
2661
|
+
TemplateCellRendererPortalRef.prototype.registerPortal = function (templateRef, viewContainer, fillCell, padChild) {
|
|
2662
|
+
this.templateRef = templateRef;
|
|
2663
|
+
this.viewContainer = viewContainer;
|
|
2664
|
+
this.fillCell = fillCell;
|
|
2665
|
+
this.padChild = padChild;
|
|
2666
|
+
};
|
|
2667
|
+
TemplateCellRendererPortalRef.prototype.initialiseHost = function (host, columnModel) {
|
|
2668
|
+
typescriptUtilities.assert.isTruthy(host);
|
|
2669
|
+
};
|
|
2670
|
+
// @Trace()
|
|
2671
|
+
TemplateCellRendererPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
|
|
2672
|
+
// don't care
|
|
2673
|
+
};
|
|
2674
|
+
TemplateCellRendererPortalRef.prototype.pushState = function (host) {
|
|
2675
|
+
host[CELL_RENDERER_PORTAL] = this.createPortal(host.getRowData());
|
|
2676
|
+
host.fillCell = this.fillCell;
|
|
2677
|
+
host.padChild = this.padChild;
|
|
2678
|
+
};
|
|
2679
|
+
TemplateCellRendererPortalRef.prototype.createPortal = function (data) {
|
|
2680
|
+
return new portal.TemplatePortal(this.templateRef, this.viewContainer, __assign(__assign({}, (data)), { $implicit: data.row }));
|
|
2681
|
+
};
|
|
2682
|
+
return TemplateCellRendererPortalRef;
|
|
2683
|
+
}(CellRendererPortalRef));
|
|
2684
|
+
|
|
2565
2685
|
var DefaultCellRendererComponent = /** @class */ (function () {
|
|
2566
2686
|
function DefaultCellRendererComponent() {
|
|
2567
2687
|
}
|
|
@@ -2739,432 +2859,39 @@
|
|
|
2739
2859
|
return SelectHeaderCellRendererComponent;
|
|
2740
2860
|
}(DisposableComponent));
|
|
2741
2861
|
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
* });
|
|
2752
|
-
*
|
|
2753
|
-
* Editable tables
|
|
2754
|
-
* @example
|
|
2755
|
-
* const saveCommand = UnaryCommand.create((form: Form<Hero>) => {
|
|
2756
|
-
* if (form.validate()) {
|
|
2757
|
-
* // normal form save stuff
|
|
2758
|
-
* return true; // finish editing
|
|
2759
|
-
* }
|
|
2760
|
-
* return false; // continue editiing
|
|
2761
|
-
* }
|
|
2762
|
-
* const colorsNames: ListModel<string> = ...;
|
|
2763
|
-
* const model = TableModel.fromList(heroList, table => {
|
|
2764
|
-
* table.pluck("firstName").cellEditor(StringInputComponent); <-- interface CellEditor { valueModel: FormValueModel<string> | ValueModel<string>; }
|
|
2765
|
-
* table.pluck("lastName").cellEditor(StringInputComponent, {
|
|
2766
|
-
* validators: [Validator.present("We need a last name")]
|
|
2767
|
-
* });
|
|
2768
|
-
* table.pluck("age").cellEditor(NumberInputComponent);
|
|
2769
|
-
* table.pluck("favoriteColor").cellEditor(SelectInputComponent, {
|
|
2770
|
-
* initialiseComponent(component: SelectInputComponent) {
|
|
2771
|
-
* selectInput.optionsModel = colorsNames; // <- initialise our component
|
|
2772
|
-
* }
|
|
2773
|
-
* });
|
|
2774
|
-
* table.addEditControls(saveCommand); // <- required to enable editing
|
|
2775
|
-
* });
|
|
2776
|
-
*
|
|
2777
|
-
* Selection models
|
|
2778
|
-
* @example
|
|
2779
|
-
* const model = TableModel.fromList(heroList, table => {
|
|
2780
|
-
* table.addSelectionColumn(selectionModel); // <- can be single or multiple selection model
|
|
2781
|
-
* table.pluck("firstName");
|
|
2782
|
-
* table.pluck("lastName");
|
|
2783
|
-
* });
|
|
2784
|
-
*
|
|
2785
|
-
* Custom cell renderers and editors
|
|
2786
|
-
* @example
|
|
2787
|
-
* const model = TableModel.fromList(heroList, table => {
|
|
2788
|
-
* table.pluck("favoriteColor")
|
|
2789
|
-
* .cellHeaderRenderer(CellHeaderRendererComponent, (component, column) => {
|
|
2790
|
-
* // configure your component with what ever you need.
|
|
2791
|
-
* });
|
|
2792
|
-
* .cellRenderer(CellRendererComponent) // <-- interface CellEditor { value: string; }
|
|
2793
|
-
* .cellEditor(CellEditorComponent.); // <-- interface CellEditor { valueModel: FormValueModel<string> | ValueModel<string>; }
|
|
2794
|
-
* table.addCustomColumn("fullName", hero => `${hero.firstName} ${hero.lastName}`);
|
|
2795
|
-
* });
|
|
2796
|
-
*
|
|
2797
|
-
* I18n
|
|
2798
|
-
* @example
|
|
2799
|
-
* [table.yml]
|
|
2800
|
-
* table:
|
|
2801
|
-
* columns(ColumnTextProperties[]):
|
|
2802
|
-
* firstName:
|
|
2803
|
-
* headerText: "First Name"
|
|
2804
|
-
* fullName:
|
|
2805
|
-
* headerText: "Full Name"
|
|
2806
|
-
*
|
|
2807
|
-
* const model = TableModel.fromList(heroList, table => {
|
|
2808
|
-
* table.pluck("favoriteColor").cellRenderer(...).cellEditor(...);
|
|
2809
|
-
* table.addCustomColumn("fullName", hero => `${hero.firstName} ${hero.lastName}`);
|
|
2810
|
-
*
|
|
2811
|
-
* table.columnTextProperties(I18n.table.columns); // <- configures all columns
|
|
2812
|
-
* });
|
|
2813
|
-
*/
|
|
2814
|
-
var TableModel = /** @class */ (function () {
|
|
2815
|
-
function TableModel(sourceOfTruth) {
|
|
2816
|
-
this.sourceOfTruth = sourceOfTruth;
|
|
2817
|
-
this._garbage = new pectin.GarbageCollector();
|
|
2818
|
-
this._columns = new pectin.MutableListModel();
|
|
2819
|
-
this._editorSessions = new pectin.MutableListModel();
|
|
2820
|
-
this._createForm = function (row) { return new pectin.Form(); };
|
|
2821
|
-
this.identityOf = sourceOfTruth.identityOf;
|
|
2822
|
-
var _a = pectin.Dsl.disposeWith(this._garbage), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
|
|
2823
|
-
this._columnsById = chain(this._columns).indexBy('columnId');
|
|
2824
|
-
this._rowsBeingEdited = new pectin.MutableListModel([], {
|
|
2825
|
-
identifiedWith: this.identityOf
|
|
2862
|
+
var noop = function () {
|
|
2863
|
+
};
|
|
2864
|
+
var ɵ0 = noop;
|
|
2865
|
+
var ColumnModel = /** @class */ (function () {
|
|
2866
|
+
function ColumnModel(columnId, defaults) {
|
|
2867
|
+
this.columnId = columnId;
|
|
2868
|
+
this.defaults = defaults;
|
|
2869
|
+
this.cellHeaderRenderer(DefaultHeaderCellRendererComponent, function (component, column) {
|
|
2870
|
+
component.headerText = column.getHeaderText();
|
|
2826
2871
|
});
|
|
2827
|
-
this._editorSessionByRowId = chain(this._editorSessions).indexBy('rowId');
|
|
2828
|
-
this.editing = chain(this._editorSessions).count().isGreaterThan(0);
|
|
2829
|
-
this.dataSource = chain(this.sourceOfTruth).replaceAll(this.rowsBeingEdited);
|
|
2830
2872
|
}
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
builder(model);
|
|
2835
|
-
return model;
|
|
2873
|
+
ColumnModel.prototype.getHeaderText = function () {
|
|
2874
|
+
var _a;
|
|
2875
|
+
return ((_a = this.getColumnTextProperties()) === null || _a === void 0 ? void 0 : _a.headerText()) || this.getDefaultHeaderText();
|
|
2836
2876
|
};
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
return this._rowsBeingEdited.readonly;
|
|
2840
|
-
},
|
|
2841
|
-
enumerable: true,
|
|
2842
|
-
configurable: true
|
|
2843
|
-
});
|
|
2844
|
-
TableModel.prototype.getTrackByFunction = function () {
|
|
2845
|
-
var _this = this;
|
|
2846
|
-
return function (index, item) {
|
|
2847
|
-
return _this.identityOf ? _this.identityOf(item) : index;
|
|
2848
|
-
};
|
|
2877
|
+
ColumnModel.prototype.getDefaultHeaderText = function () {
|
|
2878
|
+
return this.columnId;
|
|
2849
2879
|
};
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
return this._columns.readonly;
|
|
2853
|
-
},
|
|
2854
|
-
enumerable: true,
|
|
2855
|
-
configurable: true
|
|
2856
|
-
});
|
|
2857
|
-
TableModel.prototype.pluck = function (property) {
|
|
2858
|
-
return this.addColumn(new PropertyColumnModel(property, this));
|
|
2880
|
+
ColumnModel.prototype.getColumnTextProperties = function () {
|
|
2881
|
+
return this._columnTextProperties || this.defaults.getColumnTextProperties(this);
|
|
2859
2882
|
};
|
|
2860
|
-
|
|
2861
|
-
|
|
2883
|
+
ColumnModel.prototype.textProperties = function (columnTextProperties) {
|
|
2884
|
+
this._columnTextProperties = columnTextProperties;
|
|
2885
|
+
return this;
|
|
2862
2886
|
};
|
|
2863
|
-
|
|
2864
|
-
|
|
2887
|
+
ColumnModel.prototype.configureHeaderRenderer = function (config) {
|
|
2888
|
+
this._columnHeaderPortalRef = config;
|
|
2865
2889
|
};
|
|
2866
|
-
|
|
2867
|
-
this.
|
|
2868
|
-
return this.addColumn(new EditorControlColumnModel('editControls', saveCommand, this));
|
|
2890
|
+
ColumnModel.prototype.configureCellRenderer = function (config) {
|
|
2891
|
+
this._cellRendererPortalRef = config;
|
|
2869
2892
|
};
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
};
|
|
2873
|
-
TableModel.prototype.addTemplateColumn = function (columnId) {
|
|
2874
|
-
return this.addColumn(new CustomTemplateColumnModel(columnId, this));
|
|
2875
|
-
};
|
|
2876
|
-
TableModel.prototype.useFormFactory = function (factory) {
|
|
2877
|
-
this._createForm = factory;
|
|
2878
|
-
return this;
|
|
2879
|
-
};
|
|
2880
|
-
TableModel.prototype.addColumn = function (column) {
|
|
2881
|
-
if (this._columnsById.get(column.columnId)) {
|
|
2882
|
-
pectin.lang.illegalState("Column with id=" + column.columnId + " already exists");
|
|
2883
|
-
}
|
|
2884
|
-
else {
|
|
2885
|
-
this._columns.push(column);
|
|
2886
|
-
}
|
|
2887
|
-
return column;
|
|
2888
|
-
};
|
|
2889
|
-
TableModel.prototype.columnTextProperties = function (columnTextProperties) {
|
|
2890
|
-
this._columnTextPropertiesLookup = columnTextProperties;
|
|
2891
|
-
};
|
|
2892
|
-
TableModel.prototype.getColumnTextProperties = function (column) {
|
|
2893
|
-
var factory = this._columnTextPropertiesLookup ? this._columnTextPropertiesLookup[column.columnId] : undefined;
|
|
2894
|
-
return factory ? factory() : undefined;
|
|
2895
|
-
};
|
|
2896
|
-
TableModel.prototype.startEditSession = function (row) {
|
|
2897
|
-
var _this = this;
|
|
2898
|
-
var rowId = this.identityOf(row);
|
|
2899
|
-
if (this._rowsBeingEdited.query().indexOf(row) > -1) {
|
|
2900
|
-
return pectin.lang.illegalState("Row with id=" + rowId + " already being edited");
|
|
2901
|
-
}
|
|
2902
|
-
else {
|
|
2903
|
-
var editSession_1 = new EditSession(rowId, row, this._createForm(row), this.saveCommand);
|
|
2904
|
-
var when = pectin.Dsl.disposeWith(editSession_1).when;
|
|
2905
|
-
when.valueOf(editSession_1.liveRowValue).changes(function (editedValue) {
|
|
2906
|
-
_this._rowsBeingEdited.replaceOrPush(editedValue);
|
|
2907
|
-
}, { initialValue: 'triggerChangeUnlessNil' });
|
|
2908
|
-
this._editorSessions.push(editSession_1);
|
|
2909
|
-
editSession_1.onDispose(function () {
|
|
2910
|
-
_this._rowsBeingEdited.remove(editSession_1.liveRowValue.value);
|
|
2911
|
-
_this._editorSessions.remove(editSession_1);
|
|
2912
|
-
});
|
|
2913
|
-
return editSession_1;
|
|
2914
|
-
}
|
|
2915
|
-
};
|
|
2916
|
-
TableModel.prototype.getEditSessionFor = function (row) {
|
|
2917
|
-
return this._editorSessionByRowId.get(this.identityOf(row));
|
|
2918
|
-
};
|
|
2919
|
-
TableModel.prototype.cancelAllEditorSessions = function () {
|
|
2920
|
-
var _this = this;
|
|
2921
|
-
this._editorSessions.runInTransaction(function (draft) {
|
|
2922
|
-
_this._rowsBeingEdited.runInTransaction(function () {
|
|
2923
|
-
draft.value.forEach(function (session) { return session.dispose(); });
|
|
2924
|
-
});
|
|
2925
|
-
});
|
|
2926
|
-
};
|
|
2927
|
-
var TableModel_1;
|
|
2928
|
-
TableModel.ctorParameters = function () { return [
|
|
2929
|
-
{ type: pectin.ListModel }
|
|
2930
|
-
]; };
|
|
2931
|
-
TableModel = TableModel_1 = __decorate([
|
|
2932
|
-
pectin.TrackExternal.Strategy(new pectin.TrackExternal.OneTimeBinding()),
|
|
2933
|
-
__metadata("design:paramtypes", [pectin.ListModel])
|
|
2934
|
-
], TableModel);
|
|
2935
|
-
return TableModel;
|
|
2936
|
-
}());
|
|
2937
|
-
|
|
2938
|
-
var TableCellRendererComponent = /** @class */ (function () {
|
|
2939
|
-
function TableCellRendererComponent() {
|
|
2940
|
-
var _this = this;
|
|
2941
|
-
this.defaultClassNames = 'aup-cell-renderer';
|
|
2942
|
-
this.fillCell = false;
|
|
2943
|
-
this.padChild = false;
|
|
2944
|
-
this.editRowCommand = pectin.Command.create(function () {
|
|
2945
|
-
_this.tableModel.startEditSession(_this.row);
|
|
2946
|
-
});
|
|
2947
|
-
}
|
|
2948
|
-
TableCellRendererComponent.prototype.ngOnInit = function () {
|
|
2949
|
-
this.column.attachCell(this);
|
|
2950
|
-
};
|
|
2951
|
-
TableCellRendererComponent.prototype.hasActiveEditor = function () {
|
|
2952
|
-
return !!this.editSession && !!this.column.hasEditorPortal();
|
|
2953
|
-
};
|
|
2954
|
-
TableCellRendererComponent.prototype.initialiseRenderer = function (instance) {
|
|
2955
|
-
this.column.onRendererAttached(this, instance);
|
|
2956
|
-
};
|
|
2957
|
-
TableCellRendererComponent.prototype.initialiseEditor = function (instance) {
|
|
2958
|
-
this.column.onEditorAttached(this, instance);
|
|
2959
|
-
};
|
|
2960
|
-
// @Trace()
|
|
2961
|
-
TableCellRendererComponent.prototype.ngOnChanges = function (changes) {
|
|
2962
|
-
this.column.updatePortalContent(this);
|
|
2963
|
-
};
|
|
2964
|
-
TableCellRendererComponent.prototype.getRendererPortal = function () {
|
|
2965
|
-
return this[CELL_RENDERER_PORTAL];
|
|
2966
|
-
};
|
|
2967
|
-
TableCellRendererComponent.prototype.getEditorPortal = function () {
|
|
2968
|
-
return this[CELL_EDITOR_PORTAL];
|
|
2969
|
-
};
|
|
2970
|
-
TableCellRendererComponent.prototype.getRowData = function () {
|
|
2971
|
-
return {
|
|
2972
|
-
row: this.row,
|
|
2973
|
-
editSession: this.editSession,
|
|
2974
|
-
editRowCommand: this.editRowCommand
|
|
2975
|
-
};
|
|
2976
|
-
};
|
|
2977
|
-
__decorate([
|
|
2978
|
-
core.Input(),
|
|
2979
|
-
__metadata("design:type", Object)
|
|
2980
|
-
], TableCellRendererComponent.prototype, "row", void 0);
|
|
2981
|
-
__decorate([
|
|
2982
|
-
core.Input(),
|
|
2983
|
-
__metadata("design:type", ColumnModel)
|
|
2984
|
-
], TableCellRendererComponent.prototype, "column", void 0);
|
|
2985
|
-
__decorate([
|
|
2986
|
-
core.Input(),
|
|
2987
|
-
__metadata("design:type", EditSession)
|
|
2988
|
-
], TableCellRendererComponent.prototype, "editSession", void 0);
|
|
2989
|
-
__decorate([
|
|
2990
|
-
core.Input(),
|
|
2991
|
-
__metadata("design:type", TableModel)
|
|
2992
|
-
], TableCellRendererComponent.prototype, "tableModel", void 0);
|
|
2993
|
-
__decorate([
|
|
2994
|
-
core.HostBinding('class'),
|
|
2995
|
-
__metadata("design:type", Object)
|
|
2996
|
-
], TableCellRendererComponent.prototype, "defaultClassNames", void 0);
|
|
2997
|
-
__decorate([
|
|
2998
|
-
core.HostBinding('class.fillCell'),
|
|
2999
|
-
__metadata("design:type", Object)
|
|
3000
|
-
], TableCellRendererComponent.prototype, "fillCell", void 0);
|
|
3001
|
-
__decorate([
|
|
3002
|
-
core.HostBinding('class.padChild'),
|
|
3003
|
-
__metadata("design:type", Object)
|
|
3004
|
-
], TableCellRendererComponent.prototype, "padChild", void 0);
|
|
3005
|
-
__decorate([
|
|
3006
|
-
pectin.Trace(),
|
|
3007
|
-
__metadata("design:type", Function),
|
|
3008
|
-
__metadata("design:paramtypes", [Object]),
|
|
3009
|
-
__metadata("design:returntype", void 0)
|
|
3010
|
-
], TableCellRendererComponent.prototype, "initialiseEditor", null);
|
|
3011
|
-
TableCellRendererComponent = __decorate([
|
|
3012
|
-
core.Component({
|
|
3013
|
-
selector: 'aup-table-cell-renderer',
|
|
3014
|
-
template: "<ng-container *ngIf=\"!hasActiveEditor()\" [cdkPortalOutlet]=\"getRendererPortal()\" (attached)=\"initialiseRenderer($event.instance)\"></ng-container>\n<ng-container *ngIf=\"hasActiveEditor()\" [cdkPortalOutlet]=\"getEditorPortal()\" (attached)=\"initialiseEditor($event.instance)\"></ng-container>\n",
|
|
3015
|
-
styles: [""]
|
|
3016
|
-
}),
|
|
3017
|
-
__metadata("design:paramtypes", [])
|
|
3018
|
-
], TableCellRendererComponent);
|
|
3019
|
-
return TableCellRendererComponent;
|
|
3020
|
-
}());
|
|
3021
|
-
|
|
3022
|
-
var HEADER_CELL_RENDERER_PORTAL = Symbol('aup-cell-header-renderer-component-ref');
|
|
3023
|
-
var CELL_RENDERER_PORTAL = Symbol('aup-cell-renderer-component-ref');
|
|
3024
|
-
var CELL_EDITOR_PORTAL = Symbol('aup-cell-editor-component-ref');
|
|
3025
|
-
var PORTAL_RENDERER_COMPONENT = Symbol('aup-cell-renderer-portal-component');
|
|
3026
|
-
var PORTAL_EDITOR_COMPONENT = Symbol('aup-cell-editor-portal-component');
|
|
3027
|
-
var noop = function () {
|
|
3028
|
-
};
|
|
3029
|
-
var ɵ0 = noop;
|
|
3030
|
-
var CellPortalRef = /** @class */ (function () {
|
|
3031
|
-
function CellPortalRef() {
|
|
3032
|
-
}
|
|
3033
|
-
return CellPortalRef;
|
|
3034
|
-
}());
|
|
3035
|
-
var CellHeaderPortalRef = /** @class */ (function (_super) {
|
|
3036
|
-
__extends(CellHeaderPortalRef, _super);
|
|
3037
|
-
function CellHeaderPortalRef(componentType, initialiseHeader) {
|
|
3038
|
-
var _this = _super.call(this) || this;
|
|
3039
|
-
_this.componentType = componentType;
|
|
3040
|
-
_this.initialiseHeader = initialiseHeader;
|
|
3041
|
-
return _this;
|
|
3042
|
-
}
|
|
3043
|
-
CellHeaderPortalRef.prototype.initialiseHost = function (host, columnModel) {
|
|
3044
|
-
typescriptUtilities.assert.isTruthy(host);
|
|
3045
|
-
host[HEADER_CELL_RENDERER_PORTAL] = new portal.ComponentPortal(this.componentType);
|
|
3046
|
-
};
|
|
3047
|
-
CellHeaderPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
|
|
3048
|
-
this.initialiseHeader(portalComponent, host.column);
|
|
3049
|
-
};
|
|
3050
|
-
return CellHeaderPortalRef;
|
|
3051
|
-
}(CellPortalRef));
|
|
3052
|
-
var CellRendererPortalRef = /** @class */ (function (_super) {
|
|
3053
|
-
__extends(CellRendererPortalRef, _super);
|
|
3054
|
-
function CellRendererPortalRef() {
|
|
3055
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
3056
|
-
}
|
|
3057
|
-
return CellRendererPortalRef;
|
|
3058
|
-
}(CellPortalRef));
|
|
3059
|
-
var ComponentCellRendererPortalRef = /** @class */ (function (_super) {
|
|
3060
|
-
__extends(ComponentCellRendererPortalRef, _super);
|
|
3061
|
-
function ComponentCellRendererPortalRef(componentType, updateComponent) {
|
|
3062
|
-
var _this = _super.call(this) || this;
|
|
3063
|
-
_this.componentType = componentType;
|
|
3064
|
-
_this.updateComponent = updateComponent;
|
|
3065
|
-
return _this;
|
|
3066
|
-
}
|
|
3067
|
-
ComponentCellRendererPortalRef.prototype.initialiseHost = function (host, columnModel) {
|
|
3068
|
-
host[CELL_RENDERER_PORTAL] = new portal.ComponentPortal(this.componentType);
|
|
3069
|
-
};
|
|
3070
|
-
ComponentCellRendererPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
|
|
3071
|
-
host[PORTAL_RENDERER_COMPONENT] = portalComponent;
|
|
3072
|
-
this.updateComponent(portalComponent, host.getRowData());
|
|
3073
|
-
};
|
|
3074
|
-
ComponentCellRendererPortalRef.prototype.pushState = function (host) {
|
|
3075
|
-
if (host[PORTAL_RENDERER_COMPONENT]) {
|
|
3076
|
-
this.updateComponent(host[PORTAL_RENDERER_COMPONENT], host.getRowData());
|
|
3077
|
-
}
|
|
3078
|
-
};
|
|
3079
|
-
return ComponentCellRendererPortalRef;
|
|
3080
|
-
}(CellRendererPortalRef));
|
|
3081
|
-
var CellEditorPortalRef = /** @class */ (function (_super) {
|
|
3082
|
-
__extends(CellEditorPortalRef, _super);
|
|
3083
|
-
function CellEditorPortalRef(componentType, initialiseEditorSession) {
|
|
3084
|
-
var _this = _super.call(this) || this;
|
|
3085
|
-
_this.componentType = componentType;
|
|
3086
|
-
_this.initialiseEditorSession = initialiseEditorSession;
|
|
3087
|
-
return _this;
|
|
3088
|
-
}
|
|
3089
|
-
CellEditorPortalRef.prototype.initialiseHost = function (host, columnModel) {
|
|
3090
|
-
typescriptUtilities.assert.isTruthy(host);
|
|
3091
|
-
host[CELL_EDITOR_PORTAL] = new portal.ComponentPortal(this.componentType);
|
|
3092
|
-
};
|
|
3093
|
-
CellEditorPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
|
|
3094
|
-
host[PORTAL_EDITOR_COMPONENT] = portalComponent;
|
|
3095
|
-
this.initialiseEditorSession(portalComponent, host.editSession);
|
|
3096
|
-
};
|
|
3097
|
-
__decorate([
|
|
3098
|
-
pectin.Trace(),
|
|
3099
|
-
__metadata("design:type", Function),
|
|
3100
|
-
__metadata("design:paramtypes", [TableCellRendererComponent, Object]),
|
|
3101
|
-
__metadata("design:returntype", void 0)
|
|
3102
|
-
], CellEditorPortalRef.prototype, "onPortalAttached", null);
|
|
3103
|
-
return CellEditorPortalRef;
|
|
3104
|
-
}(CellPortalRef));
|
|
3105
|
-
var TemplateCellRendererPortalRef = /** @class */ (function (_super) {
|
|
3106
|
-
__extends(TemplateCellRendererPortalRef, _super);
|
|
3107
|
-
function TemplateCellRendererPortalRef() {
|
|
3108
|
-
return _super.call(this) || this;
|
|
3109
|
-
}
|
|
3110
|
-
TemplateCellRendererPortalRef.prototype.registerPortal = function (templateRef, viewContainer, fillCell, padChild) {
|
|
3111
|
-
this.templateRef = templateRef;
|
|
3112
|
-
this.viewContainer = viewContainer;
|
|
3113
|
-
this.fillCell = fillCell;
|
|
3114
|
-
this.padChild = padChild;
|
|
3115
|
-
};
|
|
3116
|
-
TemplateCellRendererPortalRef.prototype.initialiseHost = function (host, columnModel) {
|
|
3117
|
-
typescriptUtilities.assert.isTruthy(host);
|
|
3118
|
-
};
|
|
3119
|
-
TemplateCellRendererPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
|
|
3120
|
-
// don't care
|
|
3121
|
-
};
|
|
3122
|
-
TemplateCellRendererPortalRef.prototype.pushState = function (host) {
|
|
3123
|
-
host[CELL_RENDERER_PORTAL] = this.createPortal(host.getRowData());
|
|
3124
|
-
host.fillCell = this.fillCell;
|
|
3125
|
-
host.padChild = this.padChild;
|
|
3126
|
-
};
|
|
3127
|
-
TemplateCellRendererPortalRef.prototype.createPortal = function (data) {
|
|
3128
|
-
return new portal.TemplatePortal(this.templateRef, this.viewContainer, __assign(__assign({}, (data)), { $implicit: data.row }));
|
|
3129
|
-
};
|
|
3130
|
-
__decorate([
|
|
3131
|
-
pectin.Trace(),
|
|
3132
|
-
__metadata("design:type", Function),
|
|
3133
|
-
__metadata("design:paramtypes", [TableCellRendererComponent, void 0]),
|
|
3134
|
-
__metadata("design:returntype", void 0)
|
|
3135
|
-
], TemplateCellRendererPortalRef.prototype, "onPortalAttached", null);
|
|
3136
|
-
return TemplateCellRendererPortalRef;
|
|
3137
|
-
}(CellRendererPortalRef));
|
|
3138
|
-
var ColumnModel = /** @class */ (function () {
|
|
3139
|
-
function ColumnModel(columnId, defaults) {
|
|
3140
|
-
this.columnId = columnId;
|
|
3141
|
-
this.defaults = defaults;
|
|
3142
|
-
this.cellHeaderRenderer(DefaultHeaderCellRendererComponent, function (component, column) {
|
|
3143
|
-
component.headerText = column.getHeaderText();
|
|
3144
|
-
});
|
|
3145
|
-
}
|
|
3146
|
-
ColumnModel.prototype.getHeaderText = function () {
|
|
3147
|
-
var _a;
|
|
3148
|
-
return ((_a = this.getColumnTextProperties()) === null || _a === void 0 ? void 0 : _a.headerText()) || this.getDefaultHeaderText();
|
|
3149
|
-
};
|
|
3150
|
-
ColumnModel.prototype.getDefaultHeaderText = function () {
|
|
3151
|
-
return this.columnId;
|
|
3152
|
-
};
|
|
3153
|
-
ColumnModel.prototype.getColumnTextProperties = function () {
|
|
3154
|
-
return this._columnTextProperties || this.defaults.getColumnTextProperties(this);
|
|
3155
|
-
};
|
|
3156
|
-
ColumnModel.prototype.textProperties = function (columnTextProperties) {
|
|
3157
|
-
this._columnTextProperties = columnTextProperties;
|
|
3158
|
-
return this;
|
|
3159
|
-
};
|
|
3160
|
-
ColumnModel.prototype.configureHeaderRenderer = function (config) {
|
|
3161
|
-
this._columnHeaderPortalRef = config;
|
|
3162
|
-
};
|
|
3163
|
-
ColumnModel.prototype.configureCellRenderer = function (config) {
|
|
3164
|
-
this._cellRendererPortalRef = config;
|
|
3165
|
-
};
|
|
3166
|
-
ColumnModel.prototype.configureCellEditor = function (cellEditor) {
|
|
3167
|
-
this._cellEditorPortalRef = cellEditor;
|
|
2893
|
+
ColumnModel.prototype.configureCellEditor = function (cellEditor) {
|
|
2894
|
+
this._cellEditorPortalRef = cellEditor;
|
|
3168
2895
|
};
|
|
3169
2896
|
ColumnModel.prototype.cellHeaderRenderer = function (componentType, initialiser) {
|
|
3170
2897
|
this.configureHeaderRenderer(new CellHeaderPortalRef(componentType, initialiser));
|
|
@@ -3188,6 +2915,7 @@
|
|
|
3188
2915
|
ColumnModel.prototype.onRendererAttached = function (host, component) {
|
|
3189
2916
|
this._cellRendererPortalRef.onPortalAttached(host, component);
|
|
3190
2917
|
};
|
|
2918
|
+
// @Trace()
|
|
3191
2919
|
ColumnModel.prototype.onEditorAttached = function (host, component) {
|
|
3192
2920
|
this._cellEditorPortalRef.onPortalAttached(host, component);
|
|
3193
2921
|
};
|
|
@@ -3206,12 +2934,6 @@
|
|
|
3206
2934
|
__metadata("design:paramtypes", []),
|
|
3207
2935
|
__metadata("design:returntype", Object)
|
|
3208
2936
|
], ColumnModel.prototype, "getColumnTextProperties", null);
|
|
3209
|
-
__decorate([
|
|
3210
|
-
pectin.Trace(),
|
|
3211
|
-
__metadata("design:type", Function),
|
|
3212
|
-
__metadata("design:paramtypes", [TableCellRendererComponent, Object]),
|
|
3213
|
-
__metadata("design:returntype", void 0)
|
|
3214
|
-
], ColumnModel.prototype, "onEditorAttached", null);
|
|
3215
2937
|
return ColumnModel;
|
|
3216
2938
|
}());
|
|
3217
2939
|
var PropertyColumnModel = /** @class */ (function (_super) {
|
|
@@ -3246,122 +2968,319 @@
|
|
|
3246
2968
|
}));
|
|
3247
2969
|
return this;
|
|
3248
2970
|
};
|
|
3249
|
-
PropertyColumnModel.prototype.format = function (formatter) {
|
|
3250
|
-
typescriptUtilities.assert.isFunction(formatter);
|
|
3251
|
-
this._format = formatter;
|
|
3252
|
-
return this;
|
|
2971
|
+
PropertyColumnModel.prototype.format = function (formatter) {
|
|
2972
|
+
typescriptUtilities.assert.isFunction(formatter);
|
|
2973
|
+
this._format = formatter;
|
|
2974
|
+
return this;
|
|
2975
|
+
};
|
|
2976
|
+
return PropertyColumnModel;
|
|
2977
|
+
}(ColumnModel));
|
|
2978
|
+
var ListPropertyColumnModel = /** @class */ (function (_super) {
|
|
2979
|
+
__extends(ListPropertyColumnModel, _super);
|
|
2980
|
+
function ListPropertyColumnModel(property, defaults) {
|
|
2981
|
+
var _this = _super.call(this, property.toString(), defaults) || this;
|
|
2982
|
+
_this.property = property;
|
|
2983
|
+
_this._format = function (value) { return value.map(function (v) { return v === null || v === void 0 ? void 0 : v.toString(); }).join(', '); };
|
|
2984
|
+
_this.cellRenderer(DefaultCellRendererComponent);
|
|
2985
|
+
return _this;
|
|
2986
|
+
}
|
|
2987
|
+
ListPropertyColumnModel.prototype.cellRenderer = function (componentType) {
|
|
2988
|
+
var _this = this;
|
|
2989
|
+
this.configureCellRenderer(new ComponentCellRendererPortalRef(componentType, function (component, rowData) {
|
|
2990
|
+
component.value = _this._format(rowData.row[_this.property]);
|
|
2991
|
+
}));
|
|
2992
|
+
return this;
|
|
2993
|
+
};
|
|
2994
|
+
ListPropertyColumnModel.prototype.cellEditor = function (editor, validatorsOrInitialiser, initialiseComponent) {
|
|
2995
|
+
var _this = this;
|
|
2996
|
+
var validators = Array.isArray(validatorsOrInitialiser) ? validatorsOrInitialiser : undefined;
|
|
2997
|
+
var initialiser = ___default__default.isFunction(validatorsOrInitialiser) ? validatorsOrInitialiser : initialiseComponent;
|
|
2998
|
+
this.configureCellEditor(new CellEditorPortalRef(editor, function (component, editSession) {
|
|
2999
|
+
var formListModel = editSession.form.pluckList(_this.property);
|
|
3000
|
+
if (validators) {
|
|
3001
|
+
formListModel.validateUsing(validators);
|
|
3002
|
+
}
|
|
3003
|
+
component.listModel = formListModel;
|
|
3004
|
+
if (initialiser) {
|
|
3005
|
+
initialiser(component);
|
|
3006
|
+
}
|
|
3007
|
+
}));
|
|
3008
|
+
return this;
|
|
3009
|
+
};
|
|
3010
|
+
ListPropertyColumnModel.prototype.format = function (formatter) {
|
|
3011
|
+
typescriptUtilities.assert.isFunction(formatter);
|
|
3012
|
+
this._format = formatter;
|
|
3013
|
+
return this;
|
|
3014
|
+
};
|
|
3015
|
+
return ListPropertyColumnModel;
|
|
3016
|
+
}(ColumnModel));
|
|
3017
|
+
var CustomValueColumnModel = /** @class */ (function (_super) {
|
|
3018
|
+
__extends(CustomValueColumnModel, _super);
|
|
3019
|
+
function CustomValueColumnModel(columnId, defaults, getValue) {
|
|
3020
|
+
var _this = _super.call(this, columnId, defaults) || this;
|
|
3021
|
+
_this.getValue = getValue;
|
|
3022
|
+
_this.cellRenderer(DefaultCellRendererComponent);
|
|
3023
|
+
return _this;
|
|
3024
|
+
}
|
|
3025
|
+
CustomValueColumnModel.prototype.cellRenderer = function (componentType) {
|
|
3026
|
+
var _this = this;
|
|
3027
|
+
this.configureCellRenderer(new ComponentCellRendererPortalRef(componentType, function (component, rowData) {
|
|
3028
|
+
component.value = _this.getValue(rowData.row);
|
|
3029
|
+
}));
|
|
3030
|
+
return this;
|
|
3031
|
+
};
|
|
3032
|
+
return CustomValueColumnModel;
|
|
3033
|
+
}(ColumnModel));
|
|
3034
|
+
var EditorControlColumnModel = /** @class */ (function (_super) {
|
|
3035
|
+
__extends(EditorControlColumnModel, _super);
|
|
3036
|
+
function EditorControlColumnModel(columnId, saveCommand, defaults) {
|
|
3037
|
+
var _this = _super.call(this, columnId, defaults) || this;
|
|
3038
|
+
_this.cellRenderer(EditRowControls);
|
|
3039
|
+
return _this;
|
|
3040
|
+
}
|
|
3041
|
+
EditorControlColumnModel.prototype.cellRenderer = function (componentType) {
|
|
3042
|
+
this.configureCellRenderer(new ComponentCellRendererPortalRef(componentType, function (component, rowData) {
|
|
3043
|
+
component.row = rowData.row;
|
|
3044
|
+
component.editSession = rowData.editSession;
|
|
3045
|
+
component.editRowCommand = rowData.editRowCommand;
|
|
3046
|
+
}));
|
|
3047
|
+
return this;
|
|
3048
|
+
};
|
|
3049
|
+
EditorControlColumnModel.prototype.getDefaultHeaderText = function () {
|
|
3050
|
+
return '';
|
|
3051
|
+
};
|
|
3052
|
+
return EditorControlColumnModel;
|
|
3053
|
+
}(ColumnModel));
|
|
3054
|
+
var CustomTemplateColumnModel = /** @class */ (function (_super) {
|
|
3055
|
+
__extends(CustomTemplateColumnModel, _super);
|
|
3056
|
+
function CustomTemplateColumnModel(columnId, defaults) {
|
|
3057
|
+
var _this = _super.call(this, columnId, defaults) || this;
|
|
3058
|
+
_this.config = new TemplateCellRendererPortalRef();
|
|
3059
|
+
_this.configureCellRenderer(_this.config);
|
|
3060
|
+
return _this;
|
|
3061
|
+
}
|
|
3062
|
+
CustomTemplateColumnModel.prototype.setTemplate = function (templateRef, viewContainer, fillCell, padChild) {
|
|
3063
|
+
this.config.registerPortal(templateRef, viewContainer, fillCell, padChild);
|
|
3064
|
+
};
|
|
3065
|
+
return CustomTemplateColumnModel;
|
|
3066
|
+
}(ColumnModel));
|
|
3067
|
+
var SelectionColumnModel = /** @class */ (function (_super) {
|
|
3068
|
+
__extends(SelectionColumnModel, _super);
|
|
3069
|
+
function SelectionColumnModel(columnId, defaults, selectionModel) {
|
|
3070
|
+
var _this = _super.call(this, columnId, defaults) || this;
|
|
3071
|
+
if (selectionModel instanceof pectin.MultipleSelectionModel) {
|
|
3072
|
+
_this.cellHeaderRenderer(SelectHeaderCellRendererComponent, function (component) {
|
|
3073
|
+
component.selectionModel = selectionModel;
|
|
3074
|
+
});
|
|
3075
|
+
}
|
|
3076
|
+
_this.configureCellRenderer(new ComponentCellRendererPortalRef(SelectCellRendererComponent, function (component, rowData) {
|
|
3077
|
+
component.row = rowData.row;
|
|
3078
|
+
component.selectionModel = selectionModel;
|
|
3079
|
+
}));
|
|
3080
|
+
return _this;
|
|
3081
|
+
}
|
|
3082
|
+
SelectionColumnModel.prototype.getDefaultHeaderText = function () {
|
|
3083
|
+
return '';
|
|
3084
|
+
};
|
|
3085
|
+
return SelectionColumnModel;
|
|
3086
|
+
}(ColumnModel));
|
|
3087
|
+
|
|
3088
|
+
// export type StringPropertiesOf<T> = { [K in keyof T]: T[K] extends string ? K : never }[keyof T];
|
|
3089
|
+
// export type NumberPropertiesOf<T> = { [K in keyof T]: T[K] extends number ? K : never }[keyof T];
|
|
3090
|
+
/**
|
|
3091
|
+
* Example:
|
|
3092
|
+
* @example
|
|
3093
|
+
* const model = TableModel.fromList(heroList, table => {
|
|
3094
|
+
* table.pluck("firstName");
|
|
3095
|
+
* table.pluck("lastName");
|
|
3096
|
+
* table.addCustomColumn("fullName", hero => `${hero.firstName} ${hero.lastName}`);
|
|
3097
|
+
* });
|
|
3098
|
+
*
|
|
3099
|
+
* Editable tables
|
|
3100
|
+
* @example
|
|
3101
|
+
* const saveCommand = UnaryCommand.create((form: Form<Hero>) => {
|
|
3102
|
+
* if (form.validate()) {
|
|
3103
|
+
* // normal form save stuff
|
|
3104
|
+
* return true; // finish editing
|
|
3105
|
+
* }
|
|
3106
|
+
* return false; // continue editiing
|
|
3107
|
+
* }
|
|
3108
|
+
* const colorsNames: ListModel<string> = ...;
|
|
3109
|
+
* const model = TableModel.fromList(heroList, table => {
|
|
3110
|
+
* table.pluck("firstName").cellEditor(StringInputComponent); <-- interface CellEditor { valueModel: FormValueModel<string> | ValueModel<string>; }
|
|
3111
|
+
* table.pluck("lastName").cellEditor(StringInputComponent, {
|
|
3112
|
+
* validators: [Validator.present("We need a last name")]
|
|
3113
|
+
* });
|
|
3114
|
+
* table.pluck("age").cellEditor(NumberInputComponent);
|
|
3115
|
+
* table.pluck("favoriteColor").cellEditor(SelectInputComponent, {
|
|
3116
|
+
* initialiseComponent(component: SelectInputComponent) {
|
|
3117
|
+
* selectInput.optionsModel = colorsNames; // <- initialise our component
|
|
3118
|
+
* }
|
|
3119
|
+
* });
|
|
3120
|
+
* table.addEditControls(saveCommand); // <- required to enable editing
|
|
3121
|
+
* });
|
|
3122
|
+
*
|
|
3123
|
+
* Selection models
|
|
3124
|
+
* @example
|
|
3125
|
+
* const model = TableModel.fromList(heroList, table => {
|
|
3126
|
+
* table.addSelectionColumn(selectionModel); // <- can be single or multiple selection model
|
|
3127
|
+
* table.pluck("firstName");
|
|
3128
|
+
* table.pluck("lastName");
|
|
3129
|
+
* });
|
|
3130
|
+
*
|
|
3131
|
+
* Custom cell renderers and editors
|
|
3132
|
+
* @example
|
|
3133
|
+
* const model = TableModel.fromList(heroList, table => {
|
|
3134
|
+
* table.pluck("favoriteColor")
|
|
3135
|
+
* .cellHeaderRenderer(CellHeaderRendererComponent, (component, column) => {
|
|
3136
|
+
* // configure your component with what ever you need.
|
|
3137
|
+
* });
|
|
3138
|
+
* .cellRenderer(CellRendererComponent) // <-- interface CellEditor { value: string; }
|
|
3139
|
+
* .cellEditor(CellEditorComponent.); // <-- interface CellEditor { valueModel: FormValueModel<string> | ValueModel<string>; }
|
|
3140
|
+
* table.addCustomColumn("fullName", hero => `${hero.firstName} ${hero.lastName}`);
|
|
3141
|
+
* });
|
|
3142
|
+
*
|
|
3143
|
+
* I18n
|
|
3144
|
+
* @example
|
|
3145
|
+
* [table.yml]
|
|
3146
|
+
* table:
|
|
3147
|
+
* columns(ColumnTextProperties[]):
|
|
3148
|
+
* firstName:
|
|
3149
|
+
* headerText: "First Name"
|
|
3150
|
+
* fullName:
|
|
3151
|
+
* headerText: "Full Name"
|
|
3152
|
+
*
|
|
3153
|
+
* const model = TableModel.fromList(heroList, table => {
|
|
3154
|
+
* table.pluck("favoriteColor").cellRenderer(...).cellEditor(...);
|
|
3155
|
+
* table.addCustomColumn("fullName", hero => `${hero.firstName} ${hero.lastName}`);
|
|
3156
|
+
*
|
|
3157
|
+
* table.columnTextProperties(I18n.table.columns); // <- configures all columns
|
|
3158
|
+
* });
|
|
3159
|
+
*/
|
|
3160
|
+
var TableModel = /** @class */ (function () {
|
|
3161
|
+
function TableModel(sourceOfTruth) {
|
|
3162
|
+
this.sourceOfTruth = sourceOfTruth;
|
|
3163
|
+
this._garbage = new pectin.GarbageCollector();
|
|
3164
|
+
this._columns = new pectin.MutableListModel();
|
|
3165
|
+
this._editorSessions = new pectin.MutableListModel();
|
|
3166
|
+
this._createForm = function (row) { return new pectin.Form(); };
|
|
3167
|
+
this.identityOf = sourceOfTruth.identityOf;
|
|
3168
|
+
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;
|
|
3169
|
+
this._columnsById = chain(this._columns).indexBy('columnId');
|
|
3170
|
+
this._rowsBeingEdited = new pectin.MutableListModel([], {
|
|
3171
|
+
identifiedWith: this.identityOf
|
|
3172
|
+
});
|
|
3173
|
+
this._editorSessionByRowId = chain(this._editorSessions).indexBy('rowId');
|
|
3174
|
+
this.editing = chain(this._editorSessions).count().isGreaterThan(0);
|
|
3175
|
+
this.dataSource = chain(this.sourceOfTruth).replaceAll(this.rowsBeingEdited);
|
|
3176
|
+
this.firstEditableColumn = chain(this.columns).select(function (c) { return c.hasEditorPortal(); }).first();
|
|
3177
|
+
}
|
|
3178
|
+
TableModel_1 = TableModel;
|
|
3179
|
+
TableModel.fromList = function (sourceOfTruth, builder) {
|
|
3180
|
+
var model = new TableModel_1(sourceOfTruth);
|
|
3181
|
+
builder(model);
|
|
3182
|
+
return model;
|
|
3183
|
+
};
|
|
3184
|
+
Object.defineProperty(TableModel.prototype, "rowsBeingEdited", {
|
|
3185
|
+
get: function () {
|
|
3186
|
+
return this._rowsBeingEdited.readonly;
|
|
3187
|
+
},
|
|
3188
|
+
enumerable: true,
|
|
3189
|
+
configurable: true
|
|
3190
|
+
});
|
|
3191
|
+
TableModel.prototype.getTrackByFunction = function () {
|
|
3192
|
+
var _this = this;
|
|
3193
|
+
return function (index, item) {
|
|
3194
|
+
return _this.identityOf ? _this.identityOf(item) : index;
|
|
3195
|
+
};
|
|
3196
|
+
};
|
|
3197
|
+
Object.defineProperty(TableModel.prototype, "columns", {
|
|
3198
|
+
get: function () {
|
|
3199
|
+
return this._columns.readonly;
|
|
3200
|
+
},
|
|
3201
|
+
enumerable: true,
|
|
3202
|
+
configurable: true
|
|
3203
|
+
});
|
|
3204
|
+
TableModel.prototype.pluck = function (property) {
|
|
3205
|
+
return this.addColumn(new PropertyColumnModel(property, this));
|
|
3206
|
+
};
|
|
3207
|
+
TableModel.prototype.pluckList = function (property) {
|
|
3208
|
+
return this.addColumn(new ListPropertyColumnModel(property, this));
|
|
3253
3209
|
};
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
var ListPropertyColumnModel = /** @class */ (function (_super) {
|
|
3257
|
-
__extends(ListPropertyColumnModel, _super);
|
|
3258
|
-
function ListPropertyColumnModel(property, defaults) {
|
|
3259
|
-
var _this = _super.call(this, property.toString(), defaults) || this;
|
|
3260
|
-
_this.property = property;
|
|
3261
|
-
_this._format = function (value) { return value.map(function (v) { return v === null || v === void 0 ? void 0 : v.toString(); }).join(', '); };
|
|
3262
|
-
_this.cellRenderer(DefaultCellRendererComponent);
|
|
3263
|
-
return _this;
|
|
3264
|
-
}
|
|
3265
|
-
ListPropertyColumnModel.prototype.cellRenderer = function (componentType) {
|
|
3266
|
-
var _this = this;
|
|
3267
|
-
this.configureCellRenderer(new ComponentCellRendererPortalRef(componentType, function (component, rowData) {
|
|
3268
|
-
component.value = _this._format(rowData.row[_this.property]);
|
|
3269
|
-
}));
|
|
3270
|
-
return this;
|
|
3210
|
+
TableModel.prototype.addSelectionColumn = function (selectionModel) {
|
|
3211
|
+
return this.addColumn(new SelectionColumnModel('selection', this, selectionModel));
|
|
3271
3212
|
};
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
var initialiser = ___default__default.isFunction(validatorsOrInitialiser) ? validatorsOrInitialiser : initialiseComponent;
|
|
3276
|
-
this.configureCellEditor(new CellEditorPortalRef(editor, function (component, editSession) {
|
|
3277
|
-
var formListModel = editSession.form.pluckList(_this.property);
|
|
3278
|
-
if (validators) {
|
|
3279
|
-
formListModel.validateUsing(validators);
|
|
3280
|
-
}
|
|
3281
|
-
component.listModel = formListModel;
|
|
3282
|
-
if (initialiser) {
|
|
3283
|
-
initialiser(component);
|
|
3284
|
-
}
|
|
3285
|
-
}));
|
|
3286
|
-
return this;
|
|
3213
|
+
TableModel.prototype.addEditControls = function (saveCommand) {
|
|
3214
|
+
this.saveCommand = saveCommand;
|
|
3215
|
+
return this.addColumn(new EditorControlColumnModel('editControls', saveCommand, this));
|
|
3287
3216
|
};
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
this._format = formatter;
|
|
3291
|
-
return this;
|
|
3217
|
+
TableModel.prototype.addCustomColumn = function (columnId, dataAccessor) {
|
|
3218
|
+
return this.addColumn(new CustomValueColumnModel(columnId, this, dataAccessor));
|
|
3292
3219
|
};
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
var CustomValueColumnModel = /** @class */ (function (_super) {
|
|
3296
|
-
__extends(CustomValueColumnModel, _super);
|
|
3297
|
-
function CustomValueColumnModel(columnId, defaults, getValue) {
|
|
3298
|
-
var _this = _super.call(this, columnId, defaults) || this;
|
|
3299
|
-
_this.getValue = getValue;
|
|
3300
|
-
_this.cellRenderer(DefaultCellRendererComponent);
|
|
3301
|
-
return _this;
|
|
3302
|
-
}
|
|
3303
|
-
CustomValueColumnModel.prototype.cellRenderer = function (componentType) {
|
|
3304
|
-
var _this = this;
|
|
3305
|
-
this.configureCellRenderer(new ComponentCellRendererPortalRef(componentType, function (component, rowData) {
|
|
3306
|
-
component.value = _this.getValue(rowData.row);
|
|
3307
|
-
}));
|
|
3308
|
-
return this;
|
|
3220
|
+
TableModel.prototype.addTemplateColumn = function (columnId) {
|
|
3221
|
+
return this.addColumn(new CustomTemplateColumnModel(columnId, this));
|
|
3309
3222
|
};
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
var EditorControlColumnModel = /** @class */ (function (_super) {
|
|
3313
|
-
__extends(EditorControlColumnModel, _super);
|
|
3314
|
-
function EditorControlColumnModel(columnId, saveCommand, defaults) {
|
|
3315
|
-
var _this = _super.call(this, columnId, defaults) || this;
|
|
3316
|
-
_this.cellRenderer(EditRowControls);
|
|
3317
|
-
return _this;
|
|
3318
|
-
}
|
|
3319
|
-
EditorControlColumnModel.prototype.cellRenderer = function (componentType) {
|
|
3320
|
-
this.configureCellRenderer(new ComponentCellRendererPortalRef(componentType, function (component, rowData) {
|
|
3321
|
-
component.row = rowData.row;
|
|
3322
|
-
component.editSession = rowData.editSession;
|
|
3323
|
-
component.editRowCommand = rowData.editRowCommand;
|
|
3324
|
-
}));
|
|
3223
|
+
TableModel.prototype.useFormFactory = function (factory) {
|
|
3224
|
+
this._createForm = factory;
|
|
3325
3225
|
return this;
|
|
3326
3226
|
};
|
|
3327
|
-
|
|
3328
|
-
|
|
3227
|
+
TableModel.prototype.addColumn = function (column) {
|
|
3228
|
+
if (this._columnsById.get(column.columnId)) {
|
|
3229
|
+
pectin.lang.illegalState("Column with id=" + column.columnId + " already exists");
|
|
3230
|
+
}
|
|
3231
|
+
else {
|
|
3232
|
+
this._columns.push(column);
|
|
3233
|
+
}
|
|
3234
|
+
return column;
|
|
3329
3235
|
};
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
var CustomTemplateColumnModel = /** @class */ (function (_super) {
|
|
3333
|
-
__extends(CustomTemplateColumnModel, _super);
|
|
3334
|
-
function CustomTemplateColumnModel(columnId, defaults) {
|
|
3335
|
-
var _this = _super.call(this, columnId, defaults) || this;
|
|
3336
|
-
_this.config = new TemplateCellRendererPortalRef();
|
|
3337
|
-
_this.configureCellRenderer(_this.config);
|
|
3338
|
-
return _this;
|
|
3339
|
-
}
|
|
3340
|
-
CustomTemplateColumnModel.prototype.setTemplate = function (templateRef, viewContainer, fillCell, padChild) {
|
|
3341
|
-
this.config.registerPortal(templateRef, viewContainer, fillCell, padChild);
|
|
3236
|
+
TableModel.prototype.columnTextProperties = function (columnTextProperties) {
|
|
3237
|
+
this._columnTextPropertiesLookup = columnTextProperties;
|
|
3342
3238
|
};
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
function
|
|
3348
|
-
var _this =
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3239
|
+
TableModel.prototype.getColumnTextProperties = function (column) {
|
|
3240
|
+
var factory = this._columnTextPropertiesLookup ? this._columnTextPropertiesLookup[column.columnId] : undefined;
|
|
3241
|
+
return factory ? factory() : undefined;
|
|
3242
|
+
};
|
|
3243
|
+
TableModel.prototype.startEditSession = function (row) {
|
|
3244
|
+
var _this = this;
|
|
3245
|
+
var rowId = this.identityOf(row);
|
|
3246
|
+
if (this._rowsBeingEdited.query().indexOf(row) > -1) {
|
|
3247
|
+
return pectin.lang.illegalState("Row with id=" + rowId + " already being edited");
|
|
3248
|
+
}
|
|
3249
|
+
else {
|
|
3250
|
+
var editSession_1 = new EditSession(rowId, row, this._createForm(row), this.saveCommand);
|
|
3251
|
+
var when = pectin.Dsl.disposeWith(editSession_1).when;
|
|
3252
|
+
when.valueOf(editSession_1.liveRowValue).changes(function (editedValue) {
|
|
3253
|
+
_this._rowsBeingEdited.replaceOrPush(editedValue);
|
|
3254
|
+
}, { initialValue: 'triggerChangeUnlessNil' });
|
|
3255
|
+
this._editorSessions.push(editSession_1);
|
|
3256
|
+
editSession_1.onDispose(function () {
|
|
3257
|
+
_this._rowsBeingEdited.remove(editSession_1.liveRowValue.value);
|
|
3258
|
+
_this._editorSessions.remove(editSession_1);
|
|
3352
3259
|
});
|
|
3260
|
+
return editSession_1;
|
|
3353
3261
|
}
|
|
3354
|
-
_this.configureCellRenderer(new ComponentCellRendererPortalRef(SelectCellRendererComponent, function (component, rowData) {
|
|
3355
|
-
component.row = rowData.row;
|
|
3356
|
-
component.selectionModel = selectionModel;
|
|
3357
|
-
}));
|
|
3358
|
-
return _this;
|
|
3359
|
-
}
|
|
3360
|
-
SelectionColumnModel.prototype.getDefaultHeaderText = function () {
|
|
3361
|
-
return '';
|
|
3362
3262
|
};
|
|
3363
|
-
|
|
3364
|
-
|
|
3263
|
+
TableModel.prototype.getEditSessionFor = function (row) {
|
|
3264
|
+
return this._editorSessionByRowId.get(this.identityOf(row));
|
|
3265
|
+
};
|
|
3266
|
+
TableModel.prototype.cancelAllEditorSessions = function () {
|
|
3267
|
+
var _this = this;
|
|
3268
|
+
this._editorSessions.runInTransaction(function (draft) {
|
|
3269
|
+
_this._rowsBeingEdited.runInTransaction(function () {
|
|
3270
|
+
draft.value.forEach(function (session) { return session.dispose(); });
|
|
3271
|
+
});
|
|
3272
|
+
});
|
|
3273
|
+
};
|
|
3274
|
+
var TableModel_1;
|
|
3275
|
+
TableModel.ctorParameters = function () { return [
|
|
3276
|
+
{ type: pectin.ListModel }
|
|
3277
|
+
]; };
|
|
3278
|
+
TableModel = TableModel_1 = __decorate([
|
|
3279
|
+
pectin.TrackExternal.Strategy(new pectin.TrackExternal.OneTimeBinding()),
|
|
3280
|
+
__metadata("design:paramtypes", [pectin.ListModel])
|
|
3281
|
+
], TableModel);
|
|
3282
|
+
return TableModel;
|
|
3283
|
+
}());
|
|
3365
3284
|
|
|
3366
3285
|
/**
|
|
3367
3286
|
* Create your model:
|
|
@@ -3471,6 +3390,103 @@
|
|
|
3471
3390
|
return ColumnTemplateDirective;
|
|
3472
3391
|
}());
|
|
3473
3392
|
|
|
3393
|
+
var TableCellRendererComponent = /** @class */ (function (_super) {
|
|
3394
|
+
__extends(TableCellRendererComponent, _super);
|
|
3395
|
+
function TableCellRendererComponent() {
|
|
3396
|
+
var _this = _super.call(this) || this;
|
|
3397
|
+
_this.defaultClassNames = 'aup-cell-renderer';
|
|
3398
|
+
_this.fillCell = false;
|
|
3399
|
+
_this.padChild = false;
|
|
3400
|
+
_this.editRowCommand = pectin.Command.create(function () {
|
|
3401
|
+
_this.tableModel.startEditSession(_this.row);
|
|
3402
|
+
});
|
|
3403
|
+
return _this;
|
|
3404
|
+
}
|
|
3405
|
+
TableCellRendererComponent.prototype.ngOnInit = function () {
|
|
3406
|
+
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;
|
|
3407
|
+
this.firstEditableColumn = chain(this.tableModel.firstEditableColumn).equals(this.column); // this would break if the column changed.
|
|
3408
|
+
this.column.attachCell(this);
|
|
3409
|
+
};
|
|
3410
|
+
TableCellRendererComponent.prototype.hasActiveEditor = function () {
|
|
3411
|
+
return !!this.editSession && !!this.column.hasEditorPortal();
|
|
3412
|
+
};
|
|
3413
|
+
TableCellRendererComponent.prototype.initialiseRenderer = function (instance) {
|
|
3414
|
+
this.column.onRendererAttached(this, instance);
|
|
3415
|
+
};
|
|
3416
|
+
TableCellRendererComponent.prototype.initialiseEditor = function (instance) {
|
|
3417
|
+
var _this = this;
|
|
3418
|
+
this.column.onEditorAttached(this, instance);
|
|
3419
|
+
if (this.firstEditableColumn.value) {
|
|
3420
|
+
// @see https://github.com/angular/components/issues/12070
|
|
3421
|
+
setTimeout(function () { return _this.tryAndFocusEditor(instance); });
|
|
3422
|
+
}
|
|
3423
|
+
};
|
|
3424
|
+
TableCellRendererComponent.prototype.tryAndFocusEditor = function (editor) {
|
|
3425
|
+
var _a;
|
|
3426
|
+
if (editor.requestFocus) {
|
|
3427
|
+
editor.requestFocus();
|
|
3428
|
+
}
|
|
3429
|
+
else {
|
|
3430
|
+
var model = (editor['valueModel'] || editor['listModel']);
|
|
3431
|
+
(_a = model === null || model === void 0 ? void 0 : model.focusContext) === null || _a === void 0 ? void 0 : _a.requestFocus();
|
|
3432
|
+
}
|
|
3433
|
+
};
|
|
3434
|
+
// @Trace()
|
|
3435
|
+
TableCellRendererComponent.prototype.ngOnChanges = function (changes) {
|
|
3436
|
+
this.column.updatePortalContent(this);
|
|
3437
|
+
};
|
|
3438
|
+
TableCellRendererComponent.prototype.getRendererPortal = function () {
|
|
3439
|
+
return this[CELL_RENDERER_PORTAL];
|
|
3440
|
+
};
|
|
3441
|
+
TableCellRendererComponent.prototype.getEditorPortal = function () {
|
|
3442
|
+
return this[CELL_EDITOR_PORTAL];
|
|
3443
|
+
};
|
|
3444
|
+
TableCellRendererComponent.prototype.getRowData = function () {
|
|
3445
|
+
return {
|
|
3446
|
+
row: this.row,
|
|
3447
|
+
editSession: this.editSession,
|
|
3448
|
+
editRowCommand: this.editRowCommand
|
|
3449
|
+
};
|
|
3450
|
+
};
|
|
3451
|
+
__decorate([
|
|
3452
|
+
core.Input(),
|
|
3453
|
+
__metadata("design:type", Object)
|
|
3454
|
+
], TableCellRendererComponent.prototype, "row", void 0);
|
|
3455
|
+
__decorate([
|
|
3456
|
+
core.Input(),
|
|
3457
|
+
__metadata("design:type", ColumnModel)
|
|
3458
|
+
], TableCellRendererComponent.prototype, "column", void 0);
|
|
3459
|
+
__decorate([
|
|
3460
|
+
core.Input(),
|
|
3461
|
+
__metadata("design:type", EditSession)
|
|
3462
|
+
], TableCellRendererComponent.prototype, "editSession", void 0);
|
|
3463
|
+
__decorate([
|
|
3464
|
+
core.Input(),
|
|
3465
|
+
__metadata("design:type", TableModel)
|
|
3466
|
+
], TableCellRendererComponent.prototype, "tableModel", void 0);
|
|
3467
|
+
__decorate([
|
|
3468
|
+
core.HostBinding('class'),
|
|
3469
|
+
__metadata("design:type", Object)
|
|
3470
|
+
], TableCellRendererComponent.prototype, "defaultClassNames", void 0);
|
|
3471
|
+
__decorate([
|
|
3472
|
+
core.HostBinding('class.fillCell'),
|
|
3473
|
+
__metadata("design:type", Object)
|
|
3474
|
+
], TableCellRendererComponent.prototype, "fillCell", void 0);
|
|
3475
|
+
__decorate([
|
|
3476
|
+
core.HostBinding('class.padChild'),
|
|
3477
|
+
__metadata("design:type", Object)
|
|
3478
|
+
], TableCellRendererComponent.prototype, "padChild", void 0);
|
|
3479
|
+
TableCellRendererComponent = __decorate([
|
|
3480
|
+
core.Component({
|
|
3481
|
+
selector: 'aup-table-cell-renderer',
|
|
3482
|
+
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",
|
|
3483
|
+
styles: [""]
|
|
3484
|
+
}),
|
|
3485
|
+
__metadata("design:paramtypes", [])
|
|
3486
|
+
], TableCellRendererComponent);
|
|
3487
|
+
return TableCellRendererComponent;
|
|
3488
|
+
}(DisposableComponent));
|
|
3489
|
+
|
|
3474
3490
|
var TableHeaderCellRendererComponent = /** @class */ (function () {
|
|
3475
3491
|
function TableHeaderCellRendererComponent() {
|
|
3476
3492
|
this.defaultClassNames = 'aup-header-cell-renderer';
|
|
@@ -3692,7 +3708,8 @@
|
|
|
3692
3708
|
checkbox.MatCheckboxModule,
|
|
3693
3709
|
InteractionModule,
|
|
3694
3710
|
table.MatTableModule,
|
|
3695
|
-
portal.PortalModule
|
|
3711
|
+
portal.PortalModule,
|
|
3712
|
+
scrolling.CdkScrollableModule
|
|
3696
3713
|
],
|
|
3697
3714
|
exports: [
|
|
3698
3715
|
NumberInputComponent,
|
|
@@ -5749,9 +5766,9 @@
|
|
|
5749
5766
|
PlaceOutletComponent = __decorate([
|
|
5750
5767
|
core.Component({
|
|
5751
5768
|
selector: 'aup-place-outlet',
|
|
5752
|
-
template: "<ng-container *ngIf=\"animateModel.value\">\n <div class=\"router-outlet-container\"\n [@routeAnimations]=\"{value: getAnimationOrder(), params:{duration: animationDuration}}\"\n (@routeAnimations.start)=\"animationStarted()\"\n (@routeAnimations.done)=\"animationDone()\"\n >\n <router-outlet #routerOutlet=\"outlet\"\n (activate)=\"onOutletActivated(routerOutlet, $event)\"\n (deactivate)=\"onOutletDeactivated()\">\n </router-outlet>\n </div>\n</ng-container>\n\n<ng-container *ngIf=\"!animateModel.value\">\n <div class=\"router-outlet-container\">\n <router-outlet #routerOutlet=\"outlet\"\n (activate)=\"onOutletActivated(routerOutlet, $event)\"\n (deactivate)=\"onOutletDeactivated()\">\n </router-outlet>\n </div>\n</ng-container>\n\n",
|
|
5769
|
+
template: "<ng-container *ngIf=\"animateModel.value\">\n <div class=\"router-outlet-container\" cdkScrollable\n [@routeAnimations]=\"{value: getAnimationOrder(), params:{duration: animationDuration}}\"\n (@routeAnimations.start)=\"animationStarted()\"\n (@routeAnimations.done)=\"animationDone()\"\n >\n <router-outlet #routerOutlet=\"outlet\"\n (activate)=\"onOutletActivated(routerOutlet, $event)\"\n (deactivate)=\"onOutletDeactivated()\">\n </router-outlet>\n </div>\n</ng-container>\n\n<ng-container *ngIf=\"!animateModel.value\">\n <div class=\"router-outlet-container\" cdkScrollable>\n <router-outlet #routerOutlet=\"outlet\"\n (activate)=\"onOutletActivated(routerOutlet, $event)\"\n (deactivate)=\"onOutletDeactivated()\">\n </router-outlet>\n </div>\n</ng-container>\n\n",
|
|
5753
5770
|
animations: [LEFT_RIGHT_PLACE_ANIMATION],
|
|
5754
|
-
styles: [":host{display:flex;flex-direction:column;min-height:0
|
|
5771
|
+
styles: [":host{display:flex;flex-direction:column;min-height:0}.router-outlet-container{flex:1;display:block;position:relative;min-height:0;overflow-x:hidden;overflow-y:scroll}router-outlet{display:none}"]
|
|
5755
5772
|
}),
|
|
5756
5773
|
__param(2, core.Optional()), __param(2, core.Inject(AUP_PLACE_CONFIG)),
|
|
5757
5774
|
__param(3, core.SkipSelf()), __param(3, core.Optional()),
|