@coolon/angular-ui-powerups 1.13.2 → 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.
Files changed (41) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/bundles/coolon-angular-ui-powerups.umd.js +104 -103
  3. package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
  4. package/bundles/coolon-angular-ui-powerups.umd.min.js +1 -1
  5. package/bundles/coolon-angular-ui-powerups.umd.min.js.map +1 -1
  6. package/coolon-angular-ui-powerups.metadata.json +1 -1
  7. package/esm2015/lib/components/index.js +1 -0
  8. package/esm2015/lib/components/index.js.map +1 -1
  9. package/esm2015/lib/components/index.metadata.json +1 -1
  10. package/esm2015/lib/components/table/cell-protal-ref.js +89 -0
  11. package/esm2015/lib/components/table/cell-protal-ref.js.map +1 -0
  12. package/esm2015/lib/components/table/cell-protal-ref.metadata.json +1 -0
  13. package/esm2015/lib/components/table/column-model.js +1 -87
  14. package/esm2015/lib/components/table/column-model.js.map +1 -1
  15. package/esm2015/lib/components/table/column-model.metadata.json +1 -1
  16. package/esm2015/lib/components/table/table-cell-renderer/table-cell-renderer.component.js +2 -1
  17. package/esm2015/lib/components/table/table-cell-renderer/table-cell-renderer.component.js.map +1 -1
  18. package/esm2015/lib/components/table/table-cell-renderer/table-cell-renderer.component.metadata.json +1 -1
  19. package/esm2015/lib/components/table/table-header-cell-renderer/table-header-cell-renderer.component.js +2 -1
  20. package/esm2015/lib/components/table/table-header-cell-renderer/table-header-cell-renderer.component.js.map +1 -1
  21. package/esm2015/lib/components/table/table-header-cell-renderer/table-header-cell-renderer.component.metadata.json +1 -1
  22. package/esm5/lib/components/index.js +1 -0
  23. package/esm5/lib/components/index.js.map +1 -1
  24. package/esm5/lib/components/table/cell-protal-ref.js +113 -0
  25. package/esm5/lib/components/table/cell-protal-ref.js.map +1 -0
  26. package/esm5/lib/components/table/column-model.js +2 -111
  27. package/esm5/lib/components/table/column-model.js.map +1 -1
  28. package/esm5/lib/components/table/table-cell-renderer/table-cell-renderer.component.js +2 -1
  29. package/esm5/lib/components/table/table-cell-renderer/table-cell-renderer.component.js.map +1 -1
  30. package/esm5/lib/components/table/table-header-cell-renderer/table-header-cell-renderer.component.js +2 -1
  31. package/esm5/lib/components/table/table-header-cell-renderer/table-header-cell-renderer.component.js.map +1 -1
  32. package/fesm2015/coolon-angular-ui-powerups.js +87 -86
  33. package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
  34. package/fesm5/coolon-angular-ui-powerups.js +104 -103
  35. package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
  36. package/lib/components/index.d.ts +1 -0
  37. package/lib/components/table/cell-protal-ref.d.ts +53 -0
  38. package/lib/components/table/column-model.d.ts +2 -48
  39. package/lib/components/table/table-cell-renderer/table-cell-renderer.component.d.ts +2 -1
  40. package/lib/components/table/table-header-cell-renderer/table-header-cell-renderer.component.d.ts +2 -1
  41. package/package.json +1 -1
@@ -0,0 +1,113 @@
1
+ import { __assign, __extends } from "tslib";
2
+ import { ComponentPortal, TemplatePortal } from '@angular/cdk/portal';
3
+ import { assert } from '@coolon/typescript-utilities';
4
+ export var HEADER_CELL_RENDERER_PORTAL = Symbol('aup-cell-header-renderer-component-ref');
5
+ export var CELL_RENDERER_PORTAL = Symbol('aup-cell-renderer-component-ref');
6
+ export var CELL_EDITOR_PORTAL = Symbol('aup-cell-editor-component-ref');
7
+ export var PORTAL_RENDERER_COMPONENT = Symbol('aup-cell-renderer-portal-component');
8
+ export var PORTAL_EDITOR_COMPONENT = Symbol('aup-cell-editor-portal-component');
9
+ var CellPortalRef = /** @class */ (function () {
10
+ function CellPortalRef() {
11
+ }
12
+ return CellPortalRef;
13
+ }());
14
+ export { CellPortalRef };
15
+ var CellHeaderPortalRef = /** @class */ (function (_super) {
16
+ __extends(CellHeaderPortalRef, _super);
17
+ function CellHeaderPortalRef(componentType, initialiseHeader) {
18
+ var _this = _super.call(this) || this;
19
+ _this.componentType = componentType;
20
+ _this.initialiseHeader = initialiseHeader;
21
+ return _this;
22
+ }
23
+ CellHeaderPortalRef.prototype.initialiseHost = function (host, columnModel) {
24
+ assert.isTruthy(host);
25
+ host[HEADER_CELL_RENDERER_PORTAL] = new ComponentPortal(this.componentType);
26
+ };
27
+ CellHeaderPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
28
+ this.initialiseHeader(portalComponent, host.column);
29
+ };
30
+ return CellHeaderPortalRef;
31
+ }(CellPortalRef));
32
+ export { CellHeaderPortalRef };
33
+ var CellRendererPortalRef = /** @class */ (function (_super) {
34
+ __extends(CellRendererPortalRef, _super);
35
+ function CellRendererPortalRef() {
36
+ return _super !== null && _super.apply(this, arguments) || this;
37
+ }
38
+ return CellRendererPortalRef;
39
+ }(CellPortalRef));
40
+ export { CellRendererPortalRef };
41
+ var ComponentCellRendererPortalRef = /** @class */ (function (_super) {
42
+ __extends(ComponentCellRendererPortalRef, _super);
43
+ function ComponentCellRendererPortalRef(componentType, updateComponent) {
44
+ var _this = _super.call(this) || this;
45
+ _this.componentType = componentType;
46
+ _this.updateComponent = updateComponent;
47
+ return _this;
48
+ }
49
+ ComponentCellRendererPortalRef.prototype.initialiseHost = function (host, columnModel) {
50
+ host[CELL_RENDERER_PORTAL] = new ComponentPortal(this.componentType);
51
+ };
52
+ ComponentCellRendererPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
53
+ host[PORTAL_RENDERER_COMPONENT] = portalComponent;
54
+ this.updateComponent(portalComponent, host.getRowData());
55
+ };
56
+ ComponentCellRendererPortalRef.prototype.pushState = function (host) {
57
+ if (host[PORTAL_RENDERER_COMPONENT]) {
58
+ this.updateComponent(host[PORTAL_RENDERER_COMPONENT], host.getRowData());
59
+ }
60
+ };
61
+ return ComponentCellRendererPortalRef;
62
+ }(CellRendererPortalRef));
63
+ export { ComponentCellRendererPortalRef };
64
+ var CellEditorPortalRef = /** @class */ (function (_super) {
65
+ __extends(CellEditorPortalRef, _super);
66
+ function CellEditorPortalRef(componentType, initialiseEditorSession) {
67
+ var _this = _super.call(this) || this;
68
+ _this.componentType = componentType;
69
+ _this.initialiseEditorSession = initialiseEditorSession;
70
+ return _this;
71
+ }
72
+ CellEditorPortalRef.prototype.initialiseHost = function (host, columnModel) {
73
+ assert.isTruthy(host);
74
+ host[CELL_EDITOR_PORTAL] = new ComponentPortal(this.componentType);
75
+ };
76
+ // @Trace()
77
+ CellEditorPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
78
+ host[PORTAL_EDITOR_COMPONENT] = portalComponent;
79
+ this.initialiseEditorSession(portalComponent, host.editSession);
80
+ };
81
+ return CellEditorPortalRef;
82
+ }(CellPortalRef));
83
+ export { CellEditorPortalRef };
84
+ var TemplateCellRendererPortalRef = /** @class */ (function (_super) {
85
+ __extends(TemplateCellRendererPortalRef, _super);
86
+ function TemplateCellRendererPortalRef() {
87
+ return _super.call(this) || this;
88
+ }
89
+ TemplateCellRendererPortalRef.prototype.registerPortal = function (templateRef, viewContainer, fillCell, padChild) {
90
+ this.templateRef = templateRef;
91
+ this.viewContainer = viewContainer;
92
+ this.fillCell = fillCell;
93
+ this.padChild = padChild;
94
+ };
95
+ TemplateCellRendererPortalRef.prototype.initialiseHost = function (host, columnModel) {
96
+ assert.isTruthy(host);
97
+ };
98
+ // @Trace()
99
+ TemplateCellRendererPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
100
+ // don't care
101
+ };
102
+ TemplateCellRendererPortalRef.prototype.pushState = function (host) {
103
+ host[CELL_RENDERER_PORTAL] = this.createPortal(host.getRowData());
104
+ host.fillCell = this.fillCell;
105
+ host.padChild = this.padChild;
106
+ };
107
+ TemplateCellRendererPortalRef.prototype.createPortal = function (data) {
108
+ return new TemplatePortal(this.templateRef, this.viewContainer, __assign(__assign({}, (data)), { $implicit: data.row }));
109
+ };
110
+ return TemplateCellRendererPortalRef;
111
+ }(CellRendererPortalRef));
112
+ export { TemplateCellRendererPortalRef };
113
+ //# sourceMappingURL=cell-protal-ref.js.map
@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ay';\nimport { ComponentPortal, TemplatePortal } from '@angular/cdk/portal';\nimport { TemplateRef, ViewContainerRef } from '@angular/core';\nimport { assert } from '@coolon/typescript-utilities';\nimport { ColumnModel, RowData } from './column-model';\nimport { TableHeaderCellRendererComponent } from './table-header-cell-renderer/table-header-cell-renderer.component';\nimport { TableCellRendererComponent } from './table-cell-renderer/table-cell-renderer.component';\nimport { EditSession } from './edit-session';\n\nexport const HEADER_CELL_RENDERER_PORTAL = Symbol('aup-cell-header-renderer-component-ref');\nexport const CELL_RENDERER_PORTAL = Symbol('aup-cell-renderer-component-ref');\nexport const CELL_EDITOR_PORTAL = Symbol('aup-cell-editor-component-ref');\nexport const PORTAL_RENDERER_COMPONENT = Symbol('aup-cell-renderer-portal-component');\nexport const PORTAL_EDITOR_COMPONENT = Symbol('aup-cell-editor-portal-component');\n\n\nexport abstract class CellPortalRef<Row, Host, Portal> {\n constructor() {\n }\n\n abstract initialiseHost(host: Host, columnModel: ColumnModel<Row>)\n\n abstract onPortalAttached(host: Host, portalComponent: Portal);\n}\n\nexport class CellHeaderPortalRef<Row, C> extends CellPortalRef<Row, TableHeaderCellRendererComponent, C> {\n constructor(readonly componentType: ComponentType<C>, readonly initialiseHeader: (component: C, columnModel: ColumnModel<Row>) => void) {\n super();\n }\n\n initialiseHost(host: TableHeaderCellRendererComponent, columnModel: ColumnModel<Row>) {\n assert.isTruthy(host);\n host[HEADER_CELL_RENDERER_PORTAL] = new ComponentPortal(this.componentType);\n }\n\n onPortalAttached(host: TableHeaderCellRendererComponent, portalComponent: C) {\n this.initialiseHeader(portalComponent, host.column);\n }\n\n}\n\nexport abstract class CellRendererPortalRef<Row, Portal> extends CellPortalRef<Row, TableCellRendererComponent<Row>, Portal> {\n abstract pushState(host: TableCellRendererComponent<Row>): void;\n}\n\nexport class ComponentCellRendererPortalRef<Row, Portal> extends CellRendererPortalRef<Row, Portal> {\n\n\n constructor(readonly componentType: ComponentType<Portal>, readonly updateComponent: (component: Portal, rowData: RowData<Row>) => void) {\n super();\n }\n\n initialiseHost(host: TableCellRendererComponent<Row>, columnModel: ColumnModel<Row>) {\n host[CELL_RENDERER_PORTAL] = new ComponentPortal(this.componentType);\n }\n\n onPortalAttached(host: TableCellRendererComponent<Row>, portalComponent: Portal) {\n host[PORTAL_RENDERER_COMPONENT] = portalComponent;\n this.updateComponent(portalComponent, host.getRowData());\n }\n\n pushState(host: TableCellRendererComponent<Row>): void {\n if (host[PORTAL_RENDERER_COMPONENT]) {\n this.updateComponent(host[PORTAL_RENDERER_COMPONENT], host.getRowData());\n }\n }\n\n}\n\nexport class CellEditorPortalRef<Row, Portal> extends CellPortalRef<Row, TableCellRendererComponent<Row>, Portal> {\n\n constructor(readonly componentType: ComponentType<Portal>, readonly initialiseEditorSession: (component: Portal, editSession: EditSession<Row>) => void) {\n super();\n }\n\n initialiseHost(host: TableCellRendererComponent<Row>, columnModel: ColumnModel<Row>) {\n assert.isTruthy(host);\n host[CELL_EDITOR_PORTAL] = new ComponentPortal(this.componentType);\n }\n\n // @Trace()\n onPortalAttached(host: TableCellRendererComponent<Row>, portalComponent: Portal) {\n host[PORTAL_EDITOR_COMPONENT] = portalComponent;\n this.initialiseEditorSession(portalComponent, host.editSession);\n }\n\n}\n\nexport class TemplateCellRendererPortalRef<Row> extends CellRendererPortalRef<Row, undefined> {\n\n private templateRef: TemplateRef<any>;\n private viewContainer: ViewContainerRef;\n private fillCell: boolean;\n private padChild: boolean;\n\n constructor() {\n super();\n }\n\n public registerPortal(templateRef: TemplateRef<any>, viewContainer: ViewContainerRef, fillCell: boolean, padChild: boolean) {\n this.templateRef = templateRef;\n this.viewContainer = viewContainer;\n this.fillCell = fillCell;\n this.padChild = padChild;\n }\n\n initialiseHost(host: TableCellRendererComponent<Row>, columnModel: ColumnModel<Row>) {\n assert.isTruthy(host);\n }\n\n // @Trace()\n onPortalAttached(host: TableCellRendererComponent<Row>, portalComponent: undefined) {\n // don't care\n }\n\n pushState(host: TableCellRendererComponent<Row>): void {\n host[CELL_RENDERER_PORTAL] = this.createPortal(host.getRowData());\n host.fillCell = this.fillCell;\n host.padChild = this.padChild;\n }\n\n private createPortal(data: RowData<Row>) {\n return new TemplatePortal<any>(this.templateRef, this.viewContainer, { ...(data), $implicit: data.row });\n }\n}\n"]}
@@ -1,126 +1,17 @@
1
- import { __assign, __decorate, __extends, __metadata } from "tslib";
2
- import { ComponentPortal, TemplatePortal } from '@angular/cdk/portal';
1
+ import { __decorate, __extends, __metadata } from "tslib";
3
2
  import { MultipleSelectionModel } from '@coolon/pectin';
4
3
  import { assert } from '@coolon/typescript-utilities';
5
4
  import { Memoize } from '@typescript-plus/fast-memoize-decorator/dist/src';
6
5
  import _ from 'lodash';
6
+ import { CellEditorPortalRef, CellHeaderPortalRef, ComponentCellRendererPortalRef, TemplateCellRendererPortalRef } from './cell-protal-ref';
7
7
  import { DefaultCellRendererComponent } from './default-cell-renderer/default-cell-renderer.component';
8
8
  import { DefaultHeaderCellRendererComponent } from './default-header-cell-renderer/default-header-cell-renderer.component';
9
9
  import { EditRowControls } from './edit-row-controls/edit-row-controls.component';
10
10
  import { SelectCellRendererComponent } from './select-cell-renderer/select-cell-renderer.component';
11
11
  import { SelectHeaderCellRendererComponent } from './select-header-cell-renderer/select-header-cell-renderer.component';
12
- export var HEADER_CELL_RENDERER_PORTAL = Symbol('aup-cell-header-renderer-component-ref');
13
- export var CELL_RENDERER_PORTAL = Symbol('aup-cell-renderer-component-ref');
14
- export var CELL_EDITOR_PORTAL = Symbol('aup-cell-editor-component-ref');
15
- export var PORTAL_RENDERER_COMPONENT = Symbol('aup-cell-renderer-portal-component');
16
- export var PORTAL_EDITOR_COMPONENT = Symbol('aup-cell-editor-portal-component');
17
12
  var noop = function () {
18
13
  };
19
14
  var ɵ0 = noop;
20
- var CellPortalRef = /** @class */ (function () {
21
- function CellPortalRef() {
22
- }
23
- return CellPortalRef;
24
- }());
25
- export { CellPortalRef };
26
- var CellHeaderPortalRef = /** @class */ (function (_super) {
27
- __extends(CellHeaderPortalRef, _super);
28
- function CellHeaderPortalRef(componentType, initialiseHeader) {
29
- var _this = _super.call(this) || this;
30
- _this.componentType = componentType;
31
- _this.initialiseHeader = initialiseHeader;
32
- return _this;
33
- }
34
- CellHeaderPortalRef.prototype.initialiseHost = function (host, columnModel) {
35
- assert.isTruthy(host);
36
- host[HEADER_CELL_RENDERER_PORTAL] = new ComponentPortal(this.componentType);
37
- };
38
- CellHeaderPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
39
- this.initialiseHeader(portalComponent, host.column);
40
- };
41
- return CellHeaderPortalRef;
42
- }(CellPortalRef));
43
- export { CellHeaderPortalRef };
44
- var CellRendererPortalRef = /** @class */ (function (_super) {
45
- __extends(CellRendererPortalRef, _super);
46
- function CellRendererPortalRef() {
47
- return _super !== null && _super.apply(this, arguments) || this;
48
- }
49
- return CellRendererPortalRef;
50
- }(CellPortalRef));
51
- export { CellRendererPortalRef };
52
- var ComponentCellRendererPortalRef = /** @class */ (function (_super) {
53
- __extends(ComponentCellRendererPortalRef, _super);
54
- function ComponentCellRendererPortalRef(componentType, updateComponent) {
55
- var _this = _super.call(this) || this;
56
- _this.componentType = componentType;
57
- _this.updateComponent = updateComponent;
58
- return _this;
59
- }
60
- ComponentCellRendererPortalRef.prototype.initialiseHost = function (host, columnModel) {
61
- host[CELL_RENDERER_PORTAL] = new ComponentPortal(this.componentType);
62
- };
63
- ComponentCellRendererPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
64
- host[PORTAL_RENDERER_COMPONENT] = portalComponent;
65
- this.updateComponent(portalComponent, host.getRowData());
66
- };
67
- ComponentCellRendererPortalRef.prototype.pushState = function (host) {
68
- if (host[PORTAL_RENDERER_COMPONENT]) {
69
- this.updateComponent(host[PORTAL_RENDERER_COMPONENT], host.getRowData());
70
- }
71
- };
72
- return ComponentCellRendererPortalRef;
73
- }(CellRendererPortalRef));
74
- export { ComponentCellRendererPortalRef };
75
- var CellEditorPortalRef = /** @class */ (function (_super) {
76
- __extends(CellEditorPortalRef, _super);
77
- function CellEditorPortalRef(componentType, initialiseEditorSession) {
78
- var _this = _super.call(this) || this;
79
- _this.componentType = componentType;
80
- _this.initialiseEditorSession = initialiseEditorSession;
81
- return _this;
82
- }
83
- CellEditorPortalRef.prototype.initialiseHost = function (host, columnModel) {
84
- assert.isTruthy(host);
85
- host[CELL_EDITOR_PORTAL] = new ComponentPortal(this.componentType);
86
- };
87
- // @Trace()
88
- CellEditorPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
89
- host[PORTAL_EDITOR_COMPONENT] = portalComponent;
90
- this.initialiseEditorSession(portalComponent, host.editSession);
91
- };
92
- return CellEditorPortalRef;
93
- }(CellPortalRef));
94
- export { CellEditorPortalRef };
95
- var TemplateCellRendererPortalRef = /** @class */ (function (_super) {
96
- __extends(TemplateCellRendererPortalRef, _super);
97
- function TemplateCellRendererPortalRef() {
98
- return _super.call(this) || this;
99
- }
100
- TemplateCellRendererPortalRef.prototype.registerPortal = function (templateRef, viewContainer, fillCell, padChild) {
101
- this.templateRef = templateRef;
102
- this.viewContainer = viewContainer;
103
- this.fillCell = fillCell;
104
- this.padChild = padChild;
105
- };
106
- TemplateCellRendererPortalRef.prototype.initialiseHost = function (host, columnModel) {
107
- assert.isTruthy(host);
108
- };
109
- // @Trace()
110
- TemplateCellRendererPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
111
- // don't care
112
- };
113
- TemplateCellRendererPortalRef.prototype.pushState = function (host) {
114
- host[CELL_RENDERER_PORTAL] = this.createPortal(host.getRowData());
115
- host.fillCell = this.fillCell;
116
- host.padChild = this.padChild;
117
- };
118
- TemplateCellRendererPortalRef.prototype.createPortal = function (data) {
119
- return new TemplatePortal(this.templateRef, this.viewContainer, __assign(__assign({}, (data)), { $implicit: data.row }));
120
- };
121
- return TemplateCellRendererPortalRef;
122
- }(CellRendererPortalRef));
123
- export { TemplateCellRendererPortalRef };
124
15
  var ColumnModel = /** @class */ (function () {
125
16
  function ColumnModel(columnId, defaults) {
126
17
  this.columnId = columnId;
@@ -1 +1 @@
1
- {"version":3,"file":"column-model.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/components/table/column-model.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAEtE,OAAO,EAGL,sBAAsB,EAMvB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,kDAAkD,CAAC;AAC3E,OAAO,CAAC,MAAM,QAAQ,CAAC;AAIvB,OAAO,EAAE,4BAA4B,EAAE,MAAM,yDAAyD,CAAC;AACvG,OAAO,EAAE,kCAAkC,EAAE,MAAM,uEAAuE,CAAC;AAC3H,OAAO,EAAE,eAAe,EAAE,MAAM,iDAAiD,CAAC;AAElF,OAAO,EAAE,2BAA2B,EAAE,MAAM,uDAAuD,CAAC;AACpG,OAAO,EAAE,iCAAiC,EAAE,MAAM,qEAAqE,CAAC;AAKxH,MAAM,CAAC,IAAM,2BAA2B,GAAG,MAAM,CAAC,wCAAwC,CAAC,CAAC;AAC5F,MAAM,CAAC,IAAM,oBAAoB,GAAG,MAAM,CAAC,iCAAiC,CAAC,CAAC;AAC9E,MAAM,CAAC,IAAM,kBAAkB,GAAG,MAAM,CAAC,+BAA+B,CAAC,CAAC;AAC1E,MAAM,CAAC,IAAM,yBAAyB,GAAG,MAAM,CAAC,oCAAoC,CAAC,CAAC;AACtF,MAAM,CAAC,IAAM,uBAAuB,GAAG,MAAM,CAAC,kCAAkC,CAAC,CAAC;AAElF,IAAM,IAAI,GAAG;AACb,CAAC,CAAC;;AAQF;IACE;IACA,CAAC;IAKH,oBAAC;AAAD,CAAC,AAPD,IAOC;;AAED;IAAiD,uCAAuD;IACtG,6BAAqB,aAA+B,EAAW,gBAAuE;QAAtI,YACE,iBAAO,SACR;QAFoB,mBAAa,GAAb,aAAa,CAAkB;QAAW,sBAA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GAAX,UAAY,WAA6B,EAAE,aAA+B,EAAE,QAAiB,EAAE,QAAiB;QAC9G,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,WAAW,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC7E,CAAC;IACH,gCAAC;AAAD,CAAC,AAXD,CAAoD,WAAW,GAW9D;;AAED;IAA+C,wCAAgB;IAC7D,8BAAY,QAAgB,EAAE,QAA8B,EAAE,cAAmC;QAAjG,YACE,kBAAM,QAAQ,EAAE,QAAQ,CAAC,SAU1B;QATC,IAAI,cAAc,YAAY,sBAAsB,EAAE;YACpD,KAAI,CAAC,kBAAkB,CAAC,iCAAiC,EAAE,UAAC,SAAS;gBACnE,SAAS,CAAC,cAAc,GAAG,cAAc,CAAC;YAC5C,CAAC,CAAC,CAAC;SACJ;QACD,KAAI,CAAC,qBAAqB,CAAC,IAAI,8BAA8B,CAAC,2BAA2B,EAAE,UAAC,SAAS,EAAE,OAAqB;YAC1H,SAAS,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;YAC5B,SAAS,CAAC,cAAc,GAAG,cAAc,CAAC;QAC5C,CAAC,CAAC,CAAC,CAAC;;IACN,CAAC;IAES,mDAAoB,GAA9B;QACE,OAAO,EAAE,CAAC;IACZ,CAAC;IACH,2BAAC;AAAD,CAAC,AAjBD,CAA+C,WAAW,GAiBzD","sourcesContent":["import { ComponentType } from '@angular/cdk/overlay';\nimport { ComponentPortal, TemplatePortal } from '@angular/cdk/portal';\nimport { TemplateRef, ViewContainerRef } from '@angular/core';\nimport {\n Command,\n Form,\n MultipleSelectionModel,\n SelectionModel,\n Trace,\n Types,\n UnaryCommand,\n Validator\n} from '@coolon/pectin';\nimport { assert } from '@coolon/typescript-utilities';\nimport { Memoize } from '@typescript-plus/fast-memoize-decorator/dist/src';\nimport _ from 'lodash';\nimport { doc } from 'prettier';\nimport { CellEditorComponent, CellListEditorComponent } from './cell-editors';\nimport { ColumnTextProperties } from './column-text-properties';\nimport { DefaultCellRendererComponent } from './default-cell-renderer/default-cell-renderer.component';\nimport { DefaultHeaderCellRendererComponent } from './default-header-cell-renderer/default-header-cell-renderer.component';\nimport { EditRowControls } from './edit-row-controls/edit-row-controls.component';\nimport { EditSession } from './edit-session';\nimport { SelectCellRendererComponent } from './select-cell-renderer/select-cell-renderer.component';\nimport { SelectHeaderCellRendererComponent } from './select-header-cell-renderer/select-header-cell-renderer.component';\nimport { TableCellRendererComponent } from './table-cell-renderer/table-cell-renderer.component';\nimport { TableHeaderCellRendererComponent } from './table-header-cell-renderer/table-header-cell-renderer.component';\n\n\nexport const HEADER_CELL_RENDERER_PORTAL = Symbol('aup-cell-header-renderer-component-ref');\nexport const CELL_RENDERER_PORTAL = Symbol('aup-cell-renderer-component-ref');\nexport const CELL_EDITOR_PORTAL = Symbol('aup-cell-editor-component-ref');\nexport const PORTAL_RENDERER_COMPONENT = Symbol('aup-cell-renderer-portal-component');\nexport const PORTAL_EDITOR_COMPONENT = Symbol('aup-cell-editor-portal-component');\n\nconst noop = () => {\n};\n\nexport interface RowData<Row> {\n row: Row;\n editSession?: EditSession<Row>;\n editRowCommand: Command<void>;\n}\n\nexport abstract class CellPortalRef<Row, Host, Portal> {\n constructor() {\n }\n\n abstract initialiseHost(host: Host, columnModel: ColumnModel<Row>)\n\n abstract onPortalAttached(host: Host, portalComponent: Portal);\n}\n\nexport class CellHeaderPortalRef<Row, C> extends CellPortalRef<Row, TableHeaderCellRendererComponent, C> {\n constructor(readonly componentType: ComponentType<C>, readonly initialiseHeader: (component: C, columnModel: ColumnModel<Row>) => void) {\n super();\n }\n\n initialiseHost(host: TableHeaderCellRendererComponent, columnModel: ColumnModel<Row>) {\n assert.isTruthy(host);\n host[HEADER_CELL_RENDERER_PORTAL] = new ComponentPortal(this.componentType);\n }\n\n onPortalAttached(host: TableHeaderCellRendererComponent, portalComponent: C) {\n this.initialiseHeader(portalComponent, host.column);\n }\n\n}\n\nexport abstract class CellRendererPortalRef<Row, Portal> extends CellPortalRef<Row, TableCellRendererComponent<Row>, Portal> {\n abstract pushState(host: TableCellRendererComponent<Row>): void;\n}\n\nexport class ComponentCellRendererPortalRef<Row, Portal> extends CellRendererPortalRef<Row, Portal> {\n\n\n constructor(readonly componentType: ComponentType<Portal>, readonly updateComponent: (component: Portal, rowData: RowData<Row>) => void) {\n super();\n }\n\n initialiseHost(host: TableCellRendererComponent<Row>, columnModel: ColumnModel<Row>) {\n host[CELL_RENDERER_PORTAL] = new ComponentPortal(this.componentType);\n }\n\n onPortalAttached(host: TableCellRendererComponent<Row>, portalComponent: Portal) {\n host[PORTAL_RENDERER_COMPONENT] = portalComponent;\n this.updateComponent(portalComponent, host.getRowData());\n }\n\n pushState(host: TableCellRendererComponent<Row>): void {\n if (host[PORTAL_RENDERER_COMPONENT]) {\n this.updateComponent(host[PORTAL_RENDERER_COMPONENT], host.getRowData());\n }\n }\n\n}\n\nexport class CellEditorPortalRef<Row, Portal> extends CellPortalRef<Row, TableCellRendererComponent<Row>, Portal> {\n\n constructor(readonly componentType: ComponentType<Portal>, readonly initialiseEditorSession: (component: Portal, editSession: EditSession<Row>) => void) {\n super();\n }\n\n initialiseHost(host: TableCellRendererComponent<Row>, columnModel: ColumnModel<Row>) {\n assert.isTruthy(host);\n host[CELL_EDITOR_PORTAL] = new ComponentPortal(this.componentType);\n }\n\n // @Trace()\n onPortalAttached(host: TableCellRendererComponent<Row>, portalComponent: Portal) {\n host[PORTAL_EDITOR_COMPONENT] = portalComponent;\n this.initialiseEditorSession(portalComponent, host.editSession);\n }\n\n}\n\nexport class TemplateCellRendererPortalRef<Row> extends CellRendererPortalRef<Row, undefined> {\n\n private templateRef: TemplateRef<any>;\n private viewContainer: ViewContainerRef;\n private fillCell: boolean;\n private padChild: boolean;\n\n constructor() {\n super();\n }\n\n public registerPortal(templateRef: TemplateRef<any>, viewContainer: ViewContainerRef, fillCell: boolean, padChild: boolean) {\n this.templateRef = templateRef;\n this.viewContainer = viewContainer;\n this.fillCell = fillCell;\n this.padChild = padChild;\n }\n\n initialiseHost(host: TableCellRendererComponent<Row>, columnModel: ColumnModel<Row>) {\n assert.isTruthy(host);\n }\n\n // @Trace()\n onPortalAttached(host: TableCellRendererComponent<Row>, portalComponent: undefined) {\n // don't care\n }\n\n pushState(host: TableCellRendererComponent<Row>): void {\n host[CELL_RENDERER_PORTAL] = this.createPortal(host.getRowData());\n host.fillCell = this.fillCell;\n host.padChild = this.padChild;\n }\n\n private createPortal(data: RowData<Row>) {\n return new TemplatePortal<any>(this.templateRef, this.viewContainer, { ...(data), $implicit: data.row });\n }\n}\n\n\nexport class ColumnModel<Row> {\n\n private _columnTextProperties: ColumnTextProperties;\n\n private _columnHeaderPortalRef: CellPortalRef<Row, TableHeaderCellRendererComponent, any>;\n private _cellRendererPortalRef: CellRendererPortalRef<Row, any>;\n private _cellEditorPortalRef: CellEditorPortalRef<Row, any>;\n\n constructor(readonly columnId: string, private defaults: ColumnModel.Defaults) {\n this.cellHeaderRenderer(DefaultHeaderCellRendererComponent, (component, column) => {\n component.headerText = column.getHeaderText();\n });\n }\n\n @Memoize()\n getHeaderText(): string {\n return this.getColumnTextProperties()?.headerText() || this.getDefaultHeaderText();\n }\n\n protected getDefaultHeaderText() {\n return this.columnId;\n }\n\n @Memoize()\n getColumnTextProperties(): ColumnTextProperties {\n return this._columnTextProperties || this.defaults.getColumnTextProperties(this);\n }\n\n textProperties(columnTextProperties: ColumnTextProperties): this {\n this._columnTextProperties = columnTextProperties;\n return this;\n }\n\n protected configureHeaderRenderer<C>(config: CellPortalRef<Row, any, any>): void {\n this._columnHeaderPortalRef = config;\n }\n\n protected configureCellRenderer<C>(config: CellRendererPortalRef<Row, any>): void {\n this._cellRendererPortalRef = config;\n }\n\n protected configureCellEditor<E>(cellEditor: CellEditorPortalRef<Row, E>): void {\n this._cellEditorPortalRef = cellEditor;\n }\n\n cellHeaderRenderer<C>(componentType: ComponentType<C>, initialiser: (component: C, column: ColumnModel<Row>) => void): this {\n this.configureHeaderRenderer(new CellHeaderPortalRef<Row, C>(componentType, initialiser));\n return this;\n }\n\n hasEditorPortal() {\n return !!this._cellEditorPortalRef;\n }\n\n attachHeaderCell(host: any) {\n this._columnHeaderPortalRef.initialiseHost(host, this);\n }\n\n attachCell(host: any) {\n this._cellRendererPortalRef.initialiseHost(host, this);\n if (this.hasEditorPortal()) {\n this._cellEditorPortalRef.initialiseHost(host, this);\n }\n }\n\n onHeaderAttached(host: TableHeaderCellRendererComponent, component: any) {\n this._columnHeaderPortalRef.onPortalAttached(host, component);\n }\n\n onRendererAttached(host: TableCellRendererComponent<Row>, component: any) {\n this._cellRendererPortalRef.onPortalAttached(host, component);\n }\n\n // @Trace()\n onEditorAttached(host: TableCellRendererComponent<Row>, component: any) {\n this._cellEditorPortalRef.onPortalAttached(host, component);\n }\n\n updatePortalContent(host: TableCellRendererComponent<Row>) {\n this._cellRendererPortalRef.pushState(host);\n }\n}\n\nexport namespace ColumnModel {\n export interface Defaults {\n getColumnTextProperties(columnModel: ColumnModel<any>): ColumnTextProperties;\n }\n}\n\nexport interface CellEditorOptions<V, C> { //extends CellRendererOptions<E> {\n validators?: Validator<V>[];\n\n initialiseComponent?(component: C);\n}\n\nexport class PropertyColumnModel<Row, P extends Types.ValuePropertiesOf<Row>> extends ColumnModel<Row> {\n\n\n private _format: (value: Row[P]) => any = (value) => value;\n\n constructor(readonly property: P, defaults: ColumnModel.Defaults) {\n super(property.toString(), defaults);\n this.cellRenderer(DefaultCellRendererComponent);\n }\n\n cellRenderer(componentType: ComponentType<{ value: Row[P] }>): this {\n this.configureCellRenderer(new ComponentCellRendererPortalRef(componentType, (component, rowData) => {\n component.value = this._format(rowData.row[this.property]);\n }));\n return this;\n }\n\n cellEditor<E extends CellEditorComponent<Row[P]>>(editor: ComponentType<E>, validators?: Validator<Row[P]>[], initialiseComponent?: (component: E) => void): this\n cellEditor<E extends CellEditorComponent<Row[P]>>(editor: ComponentType<E>, initialiseComponent?: (component: E) => void): this\n cellEditor<E extends CellEditorComponent<Row[P]>>(editor: ComponentType<E>, validatorsOrInitialiser?: Validator<Row[P]>[] | ((component: E) => void), initialiseComponent?: (component: E) => void): this {\n const validators = Array.isArray(validatorsOrInitialiser) ? validatorsOrInitialiser : undefined;\n const initialiser = _.isFunction(validatorsOrInitialiser) ? validatorsOrInitialiser : initialiseComponent;\n this.configureCellEditor(new CellEditorPortalRef(editor, (component: E, editSession: EditSession<Row>) => {\n const formValueModel = editSession.form.pluck(this.property);\n if (validators) {\n formValueModel.validateUsing(validators);\n }\n component.valueModel = formValueModel;\n if (initialiser) {\n initialiser(component);\n }\n }));\n return this;\n }\n\n format(formatter: (value: Row[P]) => any): this {\n assert.isFunction(formatter);\n this._format = formatter;\n return this;\n }\n}\n\nexport class ListPropertyColumnModel<Row, P extends Types.ArrayPropertiesOf<Row>> extends ColumnModel<Row> {\n\n private _format: (value: Types.ArrayElementType<Row, P>[]) => any = (value) => value.map(v => v?.toString()).join(', ');\n\n constructor(readonly property: P, defaults: ColumnModel.Defaults) {\n super(property.toString(), defaults);\n this.cellRenderer(DefaultCellRendererComponent);\n }\n\n cellRenderer(componentType: ComponentType<{ value: Types.ArrayElementType<Row, P>[] }>): this {\n this.configureCellRenderer(new ComponentCellRendererPortalRef(componentType, (component, rowData) => {\n component.value = this._format(rowData.row[this.property]);\n }));\n return this;\n }\n\n cellEditor<C extends CellListEditorComponent<Types.ArrayElementType<Row, P>>>(editor: ComponentType<C>, validators?: Validator<Types.ArrayElementType<Row, P>[]>[], initialiseComponent?: (component: C) => void): this\n cellEditor<C extends CellListEditorComponent<Types.ArrayElementType<Row, P>>>(editor: ComponentType<C>, initialiseComponent?: (component: C) => void): this\n cellEditor<C extends CellListEditorComponent<Types.ArrayElementType<Row, P>>>(editor: ComponentType<C>, validatorsOrInitialiser?: Validator<Types.ArrayElementType<Row, P>[]>[] | ((component: C) => void), initialiseComponent?: (component: C) => void): this {\n const validators = Array.isArray(validatorsOrInitialiser) ? validatorsOrInitialiser : undefined;\n const initialiser = _.isFunction(validatorsOrInitialiser) ? validatorsOrInitialiser : initialiseComponent;\n\n this.configureCellEditor(new CellEditorPortalRef(editor, (component: C, editSession: EditSession<Row>) => {\n const formListModel = editSession.form.pluckList(this.property);\n if (validators) {\n formListModel.validateUsing(validators);\n }\n component.listModel = formListModel;\n if (initialiser) {\n initialiser(component);\n }\n }));\n return this;\n }\n\n format(formatter: (value: Types.ArrayElementType<Row, P>[]) => any): this {\n assert.isFunction(formatter);\n this._format = formatter;\n return this;\n }\n}\n\nexport class CustomValueColumnModel<Row, V> extends ColumnModel<Row> {\n constructor(columnId: string, defaults: ColumnModel.Defaults, private getValue: (row: Row) => V) {\n super(columnId, defaults);\n this.cellRenderer(DefaultCellRendererComponent);\n }\n\n cellRenderer(componentType: ComponentType<{ value: V }>): this {\n this.configureCellRenderer(new ComponentCellRendererPortalRef(componentType, (component, rowData) => {\n component.value = this.getValue(rowData.row);\n }));\n return this;\n }\n}\n\nexport class EditorControlColumnModel<Row> extends ColumnModel<Row> {\n\n constructor(columnId: string, saveCommand: UnaryCommand<Form<Row>, boolean>, defaults: ColumnModel.Defaults) {\n super(columnId, defaults);\n this.cellRenderer(EditRowControls);\n }\n\n cellRenderer(componentType: ComponentType<{ row: Row, editSession: EditSession<Row>, editRowCommand: Command<void> }>): this {\n this.configureCellRenderer(new ComponentCellRendererPortalRef(componentType, (component, rowData: RowData<Row>) => {\n component.row = rowData.row;\n component.editSession = rowData.editSession;\n component.editRowCommand = rowData.editRowCommand;\n }));\n return this;\n }\n\n protected getDefaultHeaderText(): string {\n return '';\n }\n}\n\nexport class CustomTemplateColumnModel<Row> extends ColumnModel<Row> {\n private readonly config = new TemplateCellRendererPortalRef<Row>();\n\n constructor(columnId: string, defaults: ColumnModel.Defaults) {\n super(columnId, defaults);\n this.configureCellRenderer(this.config);\n }\n\n setTemplate(templateRef: TemplateRef<any>, viewContainer: ViewContainerRef, fillCell: boolean, padChild: boolean) {\n this.config.registerPortal(templateRef, viewContainer, fillCell, padChild);\n }\n}\n\nexport class SelectionColumnModel<Row> extends ColumnModel<Row> {\n constructor(columnId: string, defaults: ColumnModel.Defaults, selectionModel: SelectionModel<Row>) {\n super(columnId, defaults);\n if (selectionModel instanceof MultipleSelectionModel) {\n this.cellHeaderRenderer(SelectHeaderCellRendererComponent, (component) => {\n component.selectionModel = selectionModel;\n });\n }\n this.configureCellRenderer(new ComponentCellRendererPortalRef(SelectCellRendererComponent, (component, rowData: RowData<Row>) => {\n component.row = rowData.row;\n component.selectionModel = selectionModel;\n }));\n }\n\n protected getDefaultHeaderText(): string {\n return '';\n }\n}\n\n\n"]}
1
+ {"version":3,"file":"column-model.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/components/table/column-model.ts"],"names":[],"mappings":";AAEA,OAAO,EAAiB,sBAAsB,EAAkD,MAAM,gBAAgB,CAAC;AACvH,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,kDAAkD,CAAC;AAC3E,OAAO,CAAC,MAAM,QAAQ,CAAC;AAEvB,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EAEnB,8BAA8B,EAC9B,6BAA6B,EAC9B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,4BAA4B,EAAE,MAAM,yDAAyD,CAAC;AACvG,OAAO,EAAE,kCAAkC,EAAE,MAAM,uEAAuE,CAAC;AAC3H,OAAO,EAAE,eAAe,EAAE,MAAM,iDAAiD,CAAC;AAElF,OAAO,EAAE,2BAA2B,EAAE,MAAM,uDAAuD,CAAC;AACpG,OAAO,EAAE,iCAAiC,EAAE,MAAM,qEAAqE,CAAC;AAKxH,IAAM,IAAI,GAAG;AACb,CAAC,CAAC;;AASF;IAQE,qBAAqB,QAAgB,EAAU,QAA8B;QAAxD,aAAQ,GAAR,QAAQ,CAAQ;QAAU,aAAQ,GAAR,QAAQ,CAAsB;QAC3E,IAAI,CAAC,kBAAkB,CAAC,kCAAkC,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A2B,EAAE,UAAC,SAAS,EAAE,OAAqB;YAC1H,SAAS,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;YAC5B,SAAS,CAAC,cAAc,GAAG,cAAc,CAAC;QAC5C,CAAC,CAAC,CAAC,CAAC;;IACN,CAAC;IAES,mDAAoB,GAA9B;QACE,OAAO,EAAE,CAAC;IACZ,CAAC;IACH,2BAAC;AAAD,CAAC,AAjBD,CAA+C,WAAW,GAiBzD","sourcesContent":["import { ComponentType } from '@angular/cdk/overlay';\nimport { TemplateRef, ViewContainerRef } from '@angular/core';\nimport { Command, Form, MultipleSelectionModel, SelectionModel, Types, UnaryCommand, Validator } from '@coolon/pectin';\nimport { assert } from '@coolon/typescript-utilities';\nimport { Memoize } from '@typescript-plus/fast-memoize-decorator/dist/src';\nimport _ from 'lodash';\nimport { CellEditorComponent, CellListEditorComponent } from './cell-editors';\nimport {\n CellEditorPortalRef,\n CellHeaderPortalRef,\n CellRendererPortalRef,\n ComponentCellRendererPortalRef,\n TemplateCellRendererPortalRef\n} from './cell-protal-ref';\nimport { ColumnTextProperties } from './column-text-properties';\nimport { DefaultCellRendererComponent } from './default-cell-renderer/default-cell-renderer.component';\nimport { DefaultHeaderCellRendererComponent } from './default-header-cell-renderer/default-header-cell-renderer.component';\nimport { EditRowControls } from './edit-row-controls/edit-row-controls.component';\nimport { EditSession } from './edit-session';\nimport { SelectCellRendererComponent } from './select-cell-renderer/select-cell-renderer.component';\nimport { SelectHeaderCellRendererComponent } from './select-header-cell-renderer/select-header-cell-renderer.component';\nimport { TableCellRendererComponent } from './table-cell-renderer/table-cell-renderer.component';\nimport { TableHeaderCellRendererComponent } from './table-header-cell-renderer/table-header-cell-renderer.component';\n\n\nconst noop = () => {\n};\n\nexport interface RowData<Row> {\n row: Row;\n editSession?: EditSession<Row>;\n editRowCommand: Command<void>;\n}\n\n\nexport class ColumnModel<Row> {\n\n private _columnTextProperties: ColumnTextProperties;\n\n private _columnHeaderPortalRef: CellHeaderPortalRef<Row, any>;\n private _cellRendererPortalRef: CellRendererPortalRef<Row, any>;\n private _cellEditorPortalRef: CellEditorPortalRef<Row, any>;\n\n constructor(readonly columnId: string, private defaults: ColumnModel.Defaults) {\n this.cellHeaderRenderer(DefaultHeaderCellRendererComponent, (component, column) => {\n component.headerText = column.getHeaderText();\n });\n }\n\n @Memoize()\n getHeaderText(): string {\n return this.getColumnTextProperties()?.headerText() || this.getDefaultHeaderText();\n }\n\n protected getDefaultHeaderText() {\n return this.columnId;\n }\n\n @Memoize()\n getColumnTextProperties(): ColumnTextProperties {\n return this._columnTextProperties || this.defaults.getColumnTextProperties(this);\n }\n\n textProperties(columnTextProperties: ColumnTextProperties): this {\n this._columnTextProperties = columnTextProperties;\n return this;\n }\n\n protected configureHeaderRenderer<C>(config: CellHeaderPortalRef<Row, any>): void {\n this._columnHeaderPortalRef = config;\n }\n\n protected configureCellRenderer<C>(config: CellRendererPortalRef<Row, any>): void {\n this._cellRendererPortalRef = config;\n }\n\n protected configureCellEditor<E>(cellEditor: CellEditorPortalRef<Row, E>): void {\n this._cellEditorPortalRef = cellEditor;\n }\n\n cellHeaderRenderer<C>(componentType: ComponentType<C>, initialiser: (component: C, column: ColumnModel<Row>) => void): this {\n this.configureHeaderRenderer(new CellHeaderPortalRef<Row, C>(componentType, initialiser));\n return this;\n }\n\n hasEditorPortal() {\n return !!this._cellEditorPortalRef;\n }\n\n attachHeaderCell(host: any) {\n this._columnHeaderPortalRef.initialiseHost(host, this);\n }\n\n attachCell(host: any) {\n this._cellRendererPortalRef.initialiseHost(host, this);\n if (this.hasEditorPortal()) {\n this._cellEditorPortalRef.initialiseHost(host, this);\n }\n }\n\n onHeaderAttached(host: TableHeaderCellRendererComponent, component: any) {\n this._columnHeaderPortalRef.onPortalAttached(host, component);\n }\n\n onRendererAttached(host: TableCellRendererComponent<Row>, component: any) {\n this._cellRendererPortalRef.onPortalAttached(host, component);\n }\n\n // @Trace()\n onEditorAttached(host: TableCellRendererComponent<Row>, component: any) {\n this._cellEditorPortalRef.onPortalAttached(host, component);\n }\n\n updatePortalContent(host: TableCellRendererComponent<Row>) {\n this._cellRendererPortalRef.pushState(host);\n }\n}\n\nexport namespace ColumnModel {\n export interface Defaults {\n getColumnTextProperties(columnModel: ColumnModel<any>): ColumnTextProperties;\n }\n}\n\nexport interface CellEditorOptions<V, C> { //extends CellRendererOptions<E> {\n validators?: Validator<V>[];\n\n initialiseComponent?(component: C);\n}\n\nexport class PropertyColumnModel<Row, P extends Types.ValuePropertiesOf<Row>> extends ColumnModel<Row> {\n\n\n private _format: (value: Row[P]) => any = (value) => value;\n\n constructor(readonly property: P, defaults: ColumnModel.Defaults) {\n super(property.toString(), defaults);\n this.cellRenderer(DefaultCellRendererComponent);\n }\n\n cellRenderer(componentType: ComponentType<{ value: Row[P] }>): this {\n this.configureCellRenderer(new ComponentCellRendererPortalRef(componentType, (component, rowData) => {\n component.value = this._format(rowData.row[this.property]);\n }));\n return this;\n }\n\n cellEditor<E extends CellEditorComponent<Row[P]>>(editor: ComponentType<E>, validators?: Validator<Row[P]>[], initialiseComponent?: (component: E) => void): this\n cellEditor<E extends CellEditorComponent<Row[P]>>(editor: ComponentType<E>, initialiseComponent?: (component: E) => void): this\n cellEditor<E extends CellEditorComponent<Row[P]>>(editor: ComponentType<E>, validatorsOrInitialiser?: Validator<Row[P]>[] | ((component: E) => void), initialiseComponent?: (component: E) => void): this {\n const validators = Array.isArray(validatorsOrInitialiser) ? validatorsOrInitialiser : undefined;\n const initialiser = _.isFunction(validatorsOrInitialiser) ? validatorsOrInitialiser : initialiseComponent;\n this.configureCellEditor(new CellEditorPortalRef(editor, (component: E, editSession: EditSession<Row>) => {\n const formValueModel = editSession.form.pluck(this.property);\n if (validators) {\n formValueModel.validateUsing(validators);\n }\n component.valueModel = formValueModel;\n if (initialiser) {\n initialiser(component);\n }\n }));\n return this;\n }\n\n format(formatter: (value: Row[P]) => any): this {\n assert.isFunction(formatter);\n this._format = formatter;\n return this;\n }\n}\n\nexport class ListPropertyColumnModel<Row, P extends Types.ArrayPropertiesOf<Row>> extends ColumnModel<Row> {\n\n private _format: (value: Types.ArrayElementType<Row, P>[]) => any = (value) => value.map(v => v?.toString()).join(', ');\n\n constructor(readonly property: P, defaults: ColumnModel.Defaults) {\n super(property.toString(), defaults);\n this.cellRenderer(DefaultCellRendererComponent);\n }\n\n cellRenderer(componentType: ComponentType<{ value: Types.ArrayElementType<Row, P>[] }>): this {\n this.configureCellRenderer(new ComponentCellRendererPortalRef(componentType, (component, rowData) => {\n component.value = this._format(rowData.row[this.property]);\n }));\n return this;\n }\n\n cellEditor<C extends CellListEditorComponent<Types.ArrayElementType<Row, P>>>(editor: ComponentType<C>, validators?: Validator<Types.ArrayElementType<Row, P>[]>[], initialiseComponent?: (component: C) => void): this\n cellEditor<C extends CellListEditorComponent<Types.ArrayElementType<Row, P>>>(editor: ComponentType<C>, initialiseComponent?: (component: C) => void): this\n cellEditor<C extends CellListEditorComponent<Types.ArrayElementType<Row, P>>>(editor: ComponentType<C>, validatorsOrInitialiser?: Validator<Types.ArrayElementType<Row, P>[]>[] | ((component: C) => void), initialiseComponent?: (component: C) => void): this {\n const validators = Array.isArray(validatorsOrInitialiser) ? validatorsOrInitialiser : undefined;\n const initialiser = _.isFunction(validatorsOrInitialiser) ? validatorsOrInitialiser : initialiseComponent;\n\n this.configureCellEditor(new CellEditorPortalRef(editor, (component: C, editSession: EditSession<Row>) => {\n const formListModel = editSession.form.pluckList(this.property);\n if (validators) {\n formListModel.validateUsing(validators);\n }\n component.listModel = formListModel;\n if (initialiser) {\n initialiser(component);\n }\n }));\n return this;\n }\n\n format(formatter: (value: Types.ArrayElementType<Row, P>[]) => any): this {\n assert.isFunction(formatter);\n this._format = formatter;\n return this;\n }\n}\n\nexport class CustomValueColumnModel<Row, V> extends ColumnModel<Row> {\n constructor(columnId: string, defaults: ColumnModel.Defaults, private getValue: (row: Row) => V) {\n super(columnId, defaults);\n this.cellRenderer(DefaultCellRendererComponent);\n }\n\n cellRenderer(componentType: ComponentType<{ value: V }>): this {\n this.configureCellRenderer(new ComponentCellRendererPortalRef(componentType, (component, rowData) => {\n component.value = this.getValue(rowData.row);\n }));\n return this;\n }\n}\n\nexport class EditorControlColumnModel<Row> extends ColumnModel<Row> {\n\n constructor(columnId: string, saveCommand: UnaryCommand<Form<Row>, boolean>, defaults: ColumnModel.Defaults) {\n super(columnId, defaults);\n this.cellRenderer(EditRowControls);\n }\n\n cellRenderer(componentType: ComponentType<{ row: Row, editSession: EditSession<Row>, editRowCommand: Command<void> }>): this {\n this.configureCellRenderer(new ComponentCellRendererPortalRef(componentType, (component, rowData: RowData<Row>) => {\n component.row = rowData.row;\n component.editSession = rowData.editSession;\n component.editRowCommand = rowData.editRowCommand;\n }));\n return this;\n }\n\n protected getDefaultHeaderText(): string {\n return '';\n }\n}\n\nexport class CustomTemplateColumnModel<Row> extends ColumnModel<Row> {\n private readonly config = new TemplateCellRendererPortalRef<Row>();\n\n constructor(columnId: string, defaults: ColumnModel.Defaults) {\n super(columnId, defaults);\n this.configureCellRenderer(this.config);\n }\n\n setTemplate(templateRef: TemplateRef<any>, viewContainer: ViewContainerRef, fillCell: boolean, padChild: boolean) {\n this.config.registerPortal(templateRef, viewContainer, fillCell, padChild);\n }\n}\n\nexport class SelectionColumnModel<Row> extends ColumnModel<Row> {\n constructor(columnId: string, defaults: ColumnModel.Defaults, selectionModel: SelectionModel<Row>) {\n super(columnId, defaults);\n if (selectionModel instanceof MultipleSelectionModel) {\n this.cellHeaderRenderer(SelectHeaderCellRendererComponent, (component) => {\n component.selectionModel = selectionModel;\n });\n }\n this.configureCellRenderer(new ComponentCellRendererPortalRef(SelectCellRendererComponent, (component, rowData: RowData<Row>) => {\n component.row = rowData.row;\n component.selectionModel = selectionModel;\n }));\n }\n\n protected getDefaultHeaderText(): string {\n return '';\n }\n}\n\n\n"]}
@@ -2,9 +2,10 @@ import { __decorate, __extends, __metadata } from "tslib";
2
2
  import { Component, HostBinding, Input } from '@angular/core';
3
3
  import { Command, Dsl } from '@coolon/pectin';
4
4
  import { DisposableComponent } from '../../disposable-component';
5
- import { CELL_EDITOR_PORTAL, CELL_RENDERER_PORTAL, ColumnModel } from '../column-model';
5
+ import { ColumnModel } from '../column-model';
6
6
  import { EditSession } from '../edit-session';
7
7
  import { TableModel } from '../table-model';
8
+ import { CELL_RENDERER_PORTAL, CELL_EDITOR_PORTAL } from '../cell-protal-ref';
8
9
  var TableCellRendererComponent = /** @class */ (function (_super) {
9
10
  __extends(TableCellRendererComponent, _super);
10
11
  function TableCellRendererComponent() {
@@ -1 +1 @@
1
- {"version":3,"file":"table-cell-renderer.component.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/components/table/table-cell-renderer/table-cell-renderer.component.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,KAAK,EAAoC,MAAM,eAAe,CAAC;AAChG,OAAO,EAA0B,OAAO,EAAE,GAAG,EAA2B,MAAM,gBAAgB,CAAC;AAC/F,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,WAAW,EAAW,MAAM,iBAAiB,CAAC;AACjG,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAO5C;IAAqD,8CAAmB;IA8BtE;QAAA,YACE,iBAAO,SAIR;QAfD,uBAAiB,GAAG,mBAAmB,CAAC;QAGxC,cAAQ,GAAG,KAAK,CAAC;QAGjB,cAAQ,GAAG,KAAK,CAAC;QAMf,KAAI,CAAC,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC;YACnC,KAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,KAAI,CAAC,GAAG,CAAC,CAAC;QAC7C,CAAC,CAAC,CAAC;;IACL,CAAC;IAED,6CAAQ,GAAR;QACQ,IAAA,0BAAkF,EAAhF,g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,CAAC,MAAM,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;IAED,sDAAiB,GAAjB;QACE,OAAO,IAAI,CAAC,oBAAoB,CAAC,CAAC;IACpC,CAAC;IAED,oDAAe,GAAf;QACE,OAAO,IAAI,CAAC,kBAAkB,CAAC,CAAC;IAClC,CAAC;IAED,+CAAU,GAAV;QACE,OAAO;YACL,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,cAAc,EAAE,IAAI,CAAC,cAAc;SACpC,CAAC;IACJ,CAAC;IApFD;QADC,KAAK,EAAE;;2DACC;IAGT;QADC,KAAK,EAAE;kCACA,WAAW;8DAAM;IAGzB;QADC,KAAK,EAAE;kCACK,WAAW;mEAAM;IAG9B;QADC,KAAK,EAAE;kCACI,UAAU;kEAAM;IAQ5B;QADC,WAAW,CAAC,OAAO,CAAC;;yEACmB;IAGxC;QADC,WAAW,CAAC,gBAAgB,CAAC;;gEACb;IAGjB;QADC,WAAW,CAAC,gBAAgB,CAAC;;gEACb;IA1BN,0BAA0B;QALtC,SAAS,CAAC;YACT,QAAQ,EAAE,yBAAyB;YACnC,yTAAmD;;SAEpD,CAAC;;OACW,0BAA0B,CAwFtC;IAAD,iCAAC;CAAA,AAxFD,CAAqD,mBAAmB,GAwFvE;SAxFY,0BAA0B","sourcesContent":["import { Portal } from '@angular/cdk/portal';\nimport { Component, HostBinding, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core';\nimport { BooleanValueModelChain, Command, Dsl, HasFocusTracking, Trace } from '@coolon/pectin';\nimport { DisposableComponent } from '../../disposable-component';\nimport { CellEditorComponent, CellListEditorComponent } from '../cell-editors';\nimport { CELL_EDITOR_PORTAL, CELL_RENDERER_PORTAL, ColumnModel, RowData } from '../column-model';\nimport { EditSession } from '../edit-session';\nimport { TableModel } from '../table-model';\n\n@Component({\n selector: 'aup-table-cell-renderer',\n templateUrl: './table-cell-renderer.component.html',\n styleUrls: ['./table-cell-renderer.component.scss']\n})\nexport class TableCellRendererComponent<Row> extends DisposableComponent implements OnInit, OnChanges {\n\n @Input()\n row: Row;\n\n @Input()\n column: ColumnModel<Row>;\n\n @Input()\n editSession: EditSession<Row>;\n\n @Input()\n tableModel: TableModel<Row>;\n\n private editRowCommand: Command<void>;\n\n [CELL_RENDERER_PORTAL]: Portal<any>;\n [CELL_EDITOR_PORTAL]: Portal<any>;\n\n @HostBinding('class')\n defaultClassNames = 'aup-cell-renderer';\n\n @HostBinding('class.fillCell')\n fillCell = false;\n\n @HostBinding('class.padChild')\n padChild = false;\n\n private firstEditableColumn: BooleanValueModelChain;\n\n constructor() {\n super()\n this.editRowCommand = Command.create(() => {\n this.tableModel.startEditSession(this.row);\n });\n }\n\n ngOnInit(): void {\n const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);\n this.firstEditableColumn = chain(this.tableModel.firstEditableColumn).equals(this.column); // this would break if the column changed.\n this.column.attachCell(this);\n }\n\n hasActiveEditor(): boolean {\n return !!this.editSession && !!this.column.hasEditorPortal();\n }\n\n initialiseRenderer(instance: any) {\n this.column.onRendererAttached(this, instance);\n }\n\n initialiseEditor(instance: CellEditorComponent<Row> | CellListEditorComponent<Row>) {\n this.column.onEditorAttached(this, instance);\n if (this.firstEditableColumn.value) {\n // @see https://github.com/angular/components/issues/12070\n setTimeout(() => this.tryAndFocusEditor(instance))\n }\n }\n\n private tryAndFocusEditor(editor: CellEditorComponent<Row> | CellListEditorComponent<Row>) {\n if (editor.requestFocus) {\n editor.requestFocus();\n } else {\n const model = (editor['valueModel'] || editor['listModel']) as HasFocusTracking;\n model?.focusContext?.requestFocus();\n }\n }\n\n // @Trace()\n ngOnChanges(changes: SimpleChanges): void {\n this.column.updatePortalContent(this);\n }\n\n getRendererPortal() {\n return this[CELL_RENDERER_PORTAL];\n }\n\n getEditorPortal() {\n return this[CELL_EDITOR_PORTAL];\n }\n\n getRowData(): RowData<Row> {\n return {\n row: this.row,\n editSession: this.editSession,\n editRowCommand: this.editRowCommand\n };\n }\n}\n"]}
1
+ {"version":3,"file":"table-cell-renderer.component.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/components/table/table-cell-renderer/table-cell-renderer.component.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,KAAK,EAAoC,MAAM,eAAe,CAAC;AAChG,OAAO,EAA0B,OAAO,EAAE,GAAG,EAAoB,MAAM,gBAAgB,CAAC;AACxF,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE,OAAO,EAAE,WAAW,EAAW,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAO9E;IAAqD,8CAAmB;IA8BtE;QAAA,YACE,iBAAO,SAIR;QAfD,uBAAiB,GAAG,mBAAmB,CAAC;QAGxC,cAAQ,GAAG,KAAK,CAAC;QAGjB,cAAQ,GAAG,KAAK,CAAC;QAMf,KAAI,CAAC,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC;YACnC,KAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,KAAI,CAAC,GAAG,CAAC,CAAC;QAC7C,CAAC,CAAC,CAAC;;IACL,CAAC;IAED,6CAAQ,GAAR;QACQ,IAAA,0BAAkF,EAAhF,gBAAK,EAAE,oBAAO,EAAE,kBAAM,EAAE,cAAI,EAAE,gBAAK,EAAE,oBAAO,EAAE,sBAAkC,CAAC;QACzF,IAAI,CAAC,mBAAmB,GAAG,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,0CAA0C;QACrI,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,I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,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,cAAc,EAAE,IAAI,CAAC,cAAc;SACpC,CAAC;IACJ,CAAC;IApFD;QADC,KAAK,EAAE;;2DACC;IAGT;QADC,KAAK,EAAE;kCACA,WAAW;8DAAM;IAGzB;QADC,KAAK,EAAE;kCACK,WAAW;mEAAM;IAG9B;QADC,KAAK,EAAE;kCACI,UAAU;kEAAM;IAQ5B;QADC,WAAW,CAAC,OAAO,CAAC;;yEACmB;IAGxC;QADC,WAAW,CAAC,gBAAgB,CAAC;;gEACb;IAGjB;QADC,WAAW,CAAC,gBAAgB,CAAC;;gEACb;IA1BN,0BAA0B;QALtC,SAAS,CAAC;YACT,QAAQ,EAAE,yBAAyB;YACnC,yTAAmD;;SAEpD,CAAC;;OACW,0BAA0B,CAwFtC;IAAD,iCAAC;CAAA,AAxFD,CAAqD,mBAAmB,GAwFvE;SAxFY,0BAA0B","sourcesContent":["import { Portal } from '@angular/cdk/portal';\nimport { Component, HostBinding, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core';\nimport { BooleanValueModelChain, Command, Dsl, HasFocusTracking } from '@coolon/pectin';\nimport { DisposableComponent } from '../../disposable-component';\nimport { CellEditorComponent, CellListEditorComponent } from '../cell-editors';\nimport { ColumnModel, RowData } from '../column-model';\nimport { EditSession } from '../edit-session';\nimport { TableModel } from '../table-model';\nimport { CELL_RENDERER_PORTAL, CELL_EDITOR_PORTAL } from '../cell-protal-ref';\n\n@Component({\n selector: 'aup-table-cell-renderer',\n templateUrl: './table-cell-renderer.component.html',\n styleUrls: ['./table-cell-renderer.component.scss']\n})\nexport class TableCellRendererComponent<Row> extends DisposableComponent implements OnInit, OnChanges {\n\n @Input()\n row: Row;\n\n @Input()\n column: ColumnModel<Row>;\n\n @Input()\n editSession: EditSession<Row>;\n\n @Input()\n tableModel: TableModel<Row>;\n\n private editRowCommand: Command<void>;\n\n [CELL_RENDERER_PORTAL]: Portal<any>;\n [CELL_EDITOR_PORTAL]: Portal<any>;\n\n @HostBinding('class')\n defaultClassNames = 'aup-cell-renderer';\n\n @HostBinding('class.fillCell')\n fillCell = false;\n\n @HostBinding('class.padChild')\n padChild = false;\n\n private firstEditableColumn: BooleanValueModelChain;\n\n constructor() {\n super();\n this.editRowCommand = Command.create(() => {\n this.tableModel.startEditSession(this.row);\n });\n }\n\n ngOnInit(): void {\n const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);\n this.firstEditableColumn = chain(this.tableModel.firstEditableColumn).equals(this.column); // this would break if the column changed.\n this.column.attachCell(this);\n }\n\n hasActiveEditor(): boolean {\n return !!this.editSession && !!this.column.hasEditorPortal();\n }\n\n initialiseRenderer(instance: any) {\n this.column.onRendererAttached(this, instance);\n }\n\n initialiseEditor(instance: CellEditorComponent<Row> | CellListEditorComponent<Row>) {\n this.column.onEditorAttached(this, instance);\n if (this.firstEditableColumn.value) {\n // @see https://github.com/angular/components/issues/12070\n setTimeout(() => this.tryAndFocusEditor(instance));\n }\n }\n\n private tryAndFocusEditor(editor: CellEditorComponent<Row> | CellListEditorComponent<Row>) {\n if (editor.requestFocus) {\n editor.requestFocus();\n } else {\n const model = (editor['valueModel'] || editor['listModel']) as HasFocusTracking;\n model?.focusContext?.requestFocus();\n }\n }\n\n // @Trace()\n ngOnChanges(changes: SimpleChanges): void {\n this.column.updatePortalContent(this);\n }\n\n getRendererPortal() {\n return this[CELL_RENDERER_PORTAL];\n }\n\n getEditorPortal() {\n return this[CELL_EDITOR_PORTAL];\n }\n\n getRowData(): RowData<Row> {\n return {\n row: this.row,\n editSession: this.editSession,\n editRowCommand: this.editRowCommand\n };\n }\n}\n"]}
@@ -1,6 +1,7 @@
1
1
  import { __decorate, __metadata } from "tslib";
2
2
  import { Component, HostBinding, Input } from '@angular/core';
3
- import { ColumnModel, HEADER_CELL_RENDERER_PORTAL } from '../column-model';
3
+ import { ColumnModel } from '../column-model';
4
+ import { HEADER_CELL_RENDERER_PORTAL } from '../cell-protal-ref';
4
5
  var TableHeaderCellRendererComponent = /** @class */ (function () {
5
6
  function TableHeaderCellRendererComponent() {
6
7
  this.defaultClassNames = 'aup-header-cell-renderer';
@@ -1 +1 @@
1
- {"version":3,"file":"table-header-cell-renderer.component.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/components/table/table-header-cell-renderer/table-header-cell-renderer.component.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,KAAK,EAAU,MAAM,eAAe,CAAC;AACtE,OAAO,EAAsB,WAAW,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAO/F;IAUE;QAJA,sBAAiB,GAAG,0BAA0B,CAAC;IAK/C,CAAC;IAED,mDAAQ,GAAR;QACE,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAA;IACpC,CAAC;IAED,WAAW;IACX,2DAAgB,GAAhB,UAAiB,QAAa;QAC5B,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC/C,CAAC;IAED,oDAAS,GAAT;QACE,OAAO,IAAI,CAAC,2BAA2B,CAAC,CAAC;IAC3C,CAAC;IArBD;QADC,KAAK,EAAE;kCACA,WAAW;oEAAM;IAGzB;QADC,WAAW,CAAC,OAAO,CAAC;;+EAC0B;IANpC,gCAAgC;QAL5C,SAAS,CAAC;YACT,QAAQ,EAAE,gCAAgC;YAC1C,8HAA0D;;SAE3D,CAAC;;OACW,gCAAgC,CAyB5C;IAAD,uCAAC;CAAA,AAzBD,IAyBC;SAzBY,gCAAgC","sourcesContent":["import { Portal } from '@angular/cdk/portal';\nimport { Component, HostBinding, Input, OnInit } from '@angular/core';\nimport { CELL_EDITOR_PORTAL, ColumnModel, HEADER_CELL_RENDERER_PORTAL } from '../column-model';\n\n@Component({\n selector: 'aup-table-header-cell-renderer',\n templateUrl: './table-header-cell-renderer.component.html',\n styleUrls: ['./table-header-cell-renderer.component.scss']\n})\nexport class TableHeaderCellRendererComponent implements OnInit {\n\n @Input()\n column: ColumnModel<any>;\n\n @HostBinding('class')\n defaultClassNames = 'aup-header-cell-renderer';\n\n [HEADER_CELL_RENDERER_PORTAL]: Portal<any>\n\n constructor() {\n }\n\n ngOnInit() {\n this.column.attachHeaderCell(this)\n }\n\n // @Trace()\n initialiseHeader(instance: any) {\n this.column.onHeaderAttached(this, instance);\n }\n\n getPortal() {\n return this[HEADER_CELL_RENDERER_PORTAL];\n }\n}\n"]}
1
+ {"version":3,"file":"table-header-cell-renderer.component.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/components/table/table-header-cell-renderer/table-header-cell-renderer.component.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,KAAK,EAAU,MAAM,eAAe,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AAOjE;IAUE;QAJA,sBAAiB,GAAG,0BAA0B,CAAC;IAK/C,CAAC;IAED,mDAAQ,GAAR;QACE,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;IAED,WAAW;IACX,2DAAgB,GAAhB,UAAiB,QAAa;QAC5B,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC/C,CAAC;IAED,oDAAS,GAAT;QACE,OAAO,IAAI,CAAC,2BAA2B,CAAC,CAAC;IAC3C,CAAC;IArBD;QADC,KAAK,EAAE;kCACA,WAAW;oEAAM;IAGzB;QADC,WAAW,CAAC,OAAO,CAAC;;+EAC0B;IANpC,gCAAgC;QAL5C,SAAS,CAAC;YACT,QAAQ,EAAE,gCAAgC;YAC1C,8HAA0D;;SAE3D,CAAC;;OACW,gCAAgC,CAyB5C;IAAD,uCAAC;CAAA,AAzBD,IAyBC;SAzBY,gCAAgC","sourcesContent":["import { Portal } from '@angular/cdk/portal';\nimport { Component, HostBinding, Input, OnInit } from '@angular/core';\nimport { ColumnModel } from '../column-model';\nimport { HEADER_CELL_RENDERER_PORTAL } from '../cell-protal-ref';\n\n@Component({\n selector: 'aup-table-header-cell-renderer',\n templateUrl: './table-header-cell-renderer.component.html',\n styleUrls: ['./table-header-cell-renderer.component.scss']\n})\nexport class TableHeaderCellRendererComponent implements OnInit {\n\n @Input()\n column: ColumnModel<any>;\n\n @HostBinding('class')\n defaultClassNames = 'aup-header-cell-renderer';\n\n [HEADER_CELL_RENDERER_PORTAL]: Portal<any>;\n\n constructor() {\n }\n\n ngOnInit() {\n this.column.attachHeaderCell(this);\n }\n\n // @Trace()\n initialiseHeader(instance: any) {\n this.column.onHeaderAttached(this, instance);\n }\n\n getPortal() {\n return this[HEADER_CELL_RENDERER_PORTAL];\n }\n}\n"]}
@@ -2162,6 +2162,93 @@ SwitchCaseComponent = __decorate([
2162
2162
  __metadata("design:paramtypes", [ChangeDetectorRef])
2163
2163
  ], SwitchCaseComponent);
2164
2164
 
2165
+ const HEADER_CELL_RENDERER_PORTAL = Symbol('aup-cell-header-renderer-component-ref');
2166
+ const CELL_RENDERER_PORTAL = Symbol('aup-cell-renderer-component-ref');
2167
+ const CELL_EDITOR_PORTAL = Symbol('aup-cell-editor-component-ref');
2168
+ const PORTAL_RENDERER_COMPONENT = Symbol('aup-cell-renderer-portal-component');
2169
+ const PORTAL_EDITOR_COMPONENT = Symbol('aup-cell-editor-portal-component');
2170
+ class CellPortalRef {
2171
+ constructor() {
2172
+ }
2173
+ }
2174
+ class CellHeaderPortalRef extends CellPortalRef {
2175
+ constructor(componentType, initialiseHeader) {
2176
+ super();
2177
+ this.componentType = componentType;
2178
+ this.initialiseHeader = initialiseHeader;
2179
+ }
2180
+ initialiseHost(host, columnModel) {
2181
+ assert$1.isTruthy(host);
2182
+ host[HEADER_CELL_RENDERER_PORTAL] = new ComponentPortal(this.componentType);
2183
+ }
2184
+ onPortalAttached(host, portalComponent) {
2185
+ this.initialiseHeader(portalComponent, host.column);
2186
+ }
2187
+ }
2188
+ class CellRendererPortalRef extends CellPortalRef {
2189
+ }
2190
+ class ComponentCellRendererPortalRef extends CellRendererPortalRef {
2191
+ constructor(componentType, updateComponent) {
2192
+ super();
2193
+ this.componentType = componentType;
2194
+ this.updateComponent = updateComponent;
2195
+ }
2196
+ initialiseHost(host, columnModel) {
2197
+ host[CELL_RENDERER_PORTAL] = new ComponentPortal(this.componentType);
2198
+ }
2199
+ onPortalAttached(host, portalComponent) {
2200
+ host[PORTAL_RENDERER_COMPONENT] = portalComponent;
2201
+ this.updateComponent(portalComponent, host.getRowData());
2202
+ }
2203
+ pushState(host) {
2204
+ if (host[PORTAL_RENDERER_COMPONENT]) {
2205
+ this.updateComponent(host[PORTAL_RENDERER_COMPONENT], host.getRowData());
2206
+ }
2207
+ }
2208
+ }
2209
+ class CellEditorPortalRef extends CellPortalRef {
2210
+ constructor(componentType, initialiseEditorSession) {
2211
+ super();
2212
+ this.componentType = componentType;
2213
+ this.initialiseEditorSession = initialiseEditorSession;
2214
+ }
2215
+ initialiseHost(host, columnModel) {
2216
+ assert$1.isTruthy(host);
2217
+ host[CELL_EDITOR_PORTAL] = new ComponentPortal(this.componentType);
2218
+ }
2219
+ // @Trace()
2220
+ onPortalAttached(host, portalComponent) {
2221
+ host[PORTAL_EDITOR_COMPONENT] = portalComponent;
2222
+ this.initialiseEditorSession(portalComponent, host.editSession);
2223
+ }
2224
+ }
2225
+ class TemplateCellRendererPortalRef extends CellRendererPortalRef {
2226
+ constructor() {
2227
+ super();
2228
+ }
2229
+ registerPortal(templateRef, viewContainer, fillCell, padChild) {
2230
+ this.templateRef = templateRef;
2231
+ this.viewContainer = viewContainer;
2232
+ this.fillCell = fillCell;
2233
+ this.padChild = padChild;
2234
+ }
2235
+ initialiseHost(host, columnModel) {
2236
+ assert$1.isTruthy(host);
2237
+ }
2238
+ // @Trace()
2239
+ onPortalAttached(host, portalComponent) {
2240
+ // don't care
2241
+ }
2242
+ pushState(host) {
2243
+ host[CELL_RENDERER_PORTAL] = this.createPortal(host.getRowData());
2244
+ host.fillCell = this.fillCell;
2245
+ host.padChild = this.padChild;
2246
+ }
2247
+ createPortal(data) {
2248
+ return new TemplatePortal(this.templateRef, this.viewContainer, Object.assign(Object.assign({}, (data)), { $implicit: data.row }));
2249
+ }
2250
+ }
2251
+
2165
2252
  let DefaultCellRendererComponent = class DefaultCellRendererComponent {
2166
2253
  constructor() {
2167
2254
  }
@@ -2317,95 +2404,9 @@ SelectHeaderCellRendererComponent = __decorate([
2317
2404
  __metadata("design:paramtypes", [])
2318
2405
  ], SelectHeaderCellRendererComponent);
2319
2406
 
2320
- const HEADER_CELL_RENDERER_PORTAL = Symbol('aup-cell-header-renderer-component-ref');
2321
- const CELL_RENDERER_PORTAL = Symbol('aup-cell-renderer-component-ref');
2322
- const CELL_EDITOR_PORTAL = Symbol('aup-cell-editor-component-ref');
2323
- const PORTAL_RENDERER_COMPONENT = Symbol('aup-cell-renderer-portal-component');
2324
- const PORTAL_EDITOR_COMPONENT = Symbol('aup-cell-editor-portal-component');
2325
2407
  const noop = () => {
2326
2408
  };
2327
2409
  const ɵ0 = noop;
2328
- class CellPortalRef {
2329
- constructor() {
2330
- }
2331
- }
2332
- class CellHeaderPortalRef extends CellPortalRef {
2333
- constructor(componentType, initialiseHeader) {
2334
- super();
2335
- this.componentType = componentType;
2336
- this.initialiseHeader = initialiseHeader;
2337
- }
2338
- initialiseHost(host, columnModel) {
2339
- assert$1.isTruthy(host);
2340
- host[HEADER_CELL_RENDERER_PORTAL] = new ComponentPortal(this.componentType);
2341
- }
2342
- onPortalAttached(host, portalComponent) {
2343
- this.initialiseHeader(portalComponent, host.column);
2344
- }
2345
- }
2346
- class CellRendererPortalRef extends CellPortalRef {
2347
- }
2348
- class ComponentCellRendererPortalRef extends CellRendererPortalRef {
2349
- constructor(componentType, updateComponent) {
2350
- super();
2351
- this.componentType = componentType;
2352
- this.updateComponent = updateComponent;
2353
- }
2354
- initialiseHost(host, columnModel) {
2355
- host[CELL_RENDERER_PORTAL] = new ComponentPortal(this.componentType);
2356
- }
2357
- onPortalAttached(host, portalComponent) {
2358
- host[PORTAL_RENDERER_COMPONENT] = portalComponent;
2359
- this.updateComponent(portalComponent, host.getRowData());
2360
- }
2361
- pushState(host) {
2362
- if (host[PORTAL_RENDERER_COMPONENT]) {
2363
- this.updateComponent(host[PORTAL_RENDERER_COMPONENT], host.getRowData());
2364
- }
2365
- }
2366
- }
2367
- class CellEditorPortalRef extends CellPortalRef {
2368
- constructor(componentType, initialiseEditorSession) {
2369
- super();
2370
- this.componentType = componentType;
2371
- this.initialiseEditorSession = initialiseEditorSession;
2372
- }
2373
- initialiseHost(host, columnModel) {
2374
- assert$1.isTruthy(host);
2375
- host[CELL_EDITOR_PORTAL] = new ComponentPortal(this.componentType);
2376
- }
2377
- // @Trace()
2378
- onPortalAttached(host, portalComponent) {
2379
- host[PORTAL_EDITOR_COMPONENT] = portalComponent;
2380
- this.initialiseEditorSession(portalComponent, host.editSession);
2381
- }
2382
- }
2383
- class TemplateCellRendererPortalRef extends CellRendererPortalRef {
2384
- constructor() {
2385
- super();
2386
- }
2387
- registerPortal(templateRef, viewContainer, fillCell, padChild) {
2388
- this.templateRef = templateRef;
2389
- this.viewContainer = viewContainer;
2390
- this.fillCell = fillCell;
2391
- this.padChild = padChild;
2392
- }
2393
- initialiseHost(host, columnModel) {
2394
- assert$1.isTruthy(host);
2395
- }
2396
- // @Trace()
2397
- onPortalAttached(host, portalComponent) {
2398
- // don't care
2399
- }
2400
- pushState(host) {
2401
- host[CELL_RENDERER_PORTAL] = this.createPortal(host.getRowData());
2402
- host.fillCell = this.fillCell;
2403
- host.padChild = this.padChild;
2404
- }
2405
- createPortal(data) {
2406
- return new TemplatePortal(this.templateRef, this.viewContainer, Object.assign(Object.assign({}, (data)), { $implicit: data.row }));
2407
- }
2408
- }
2409
2410
  class ColumnModel {
2410
2411
  constructor(columnId, defaults) {
2411
2412
  this.columnId = columnId;