@coolon/angular-ui-powerups 1.12.0 → 1.13.1
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/assets/table.scss +32 -1
- package/bundles/coolon-angular-ui-powerups.umd.js +757 -430
- 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.d.ts +58 -55
- package/coolon-angular-ui-powerups.metadata.json +1 -1
- package/esm2015/coolon-angular-ui-powerups.js +56 -53
- package/esm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/esm2015/coolon-angular-ui-powerups.metadata.json +1 -1
- package/esm2015/lib/angular-ui-powerups.module.ngfactory.js.map +1 -1
- package/esm2015/lib/components/card-container/card-container.component.js +1 -1
- package/esm2015/lib/components/card-container/card-container.component.metadata.json +1 -1
- package/esm2015/lib/components/components.module.js +9 -2
- package/esm2015/lib/components/components.module.js.map +1 -1
- package/esm2015/lib/components/components.module.metadata.json +1 -1
- package/esm2015/lib/components/components.module.ngfactory.js.map +1 -1
- package/esm2015/lib/components/forms/abstract-input.component.js +6 -15
- package/esm2015/lib/components/forms/abstract-input.component.js.map +1 -1
- package/esm2015/lib/components/forms/abstract-input.component.metadata.json +1 -1
- package/esm2015/lib/components/forms/abstract-list-input.component.js +27 -0
- package/esm2015/lib/components/forms/abstract-list-input.component.js.map +1 -0
- package/esm2015/lib/components/forms/abstract-list-input.component.metadata.json +1 -0
- package/esm2015/lib/components/forms/abstract-list-input.component.ngfactory.js.map +1 -0
- package/esm2015/lib/components/forms/abstract-value-input.component.js +27 -0
- package/esm2015/lib/components/forms/abstract-value-input.component.js.map +1 -0
- package/esm2015/lib/components/forms/abstract-value-input.component.metadata.json +1 -0
- package/esm2015/lib/components/forms/abstract-value-input.component.ngfactory.js.map +1 -0
- package/esm2015/lib/components/forms/checkbox-input/checkbox-input.component.js +3 -3
- package/esm2015/lib/components/forms/checkbox-input/checkbox-input.component.js.map +1 -1
- package/esm2015/lib/components/forms/checkbox-input/checkbox-input.component.metadata.json +1 -1
- package/esm2015/lib/components/forms/multiple-select-input/multiple-select-input.component.js +54 -0
- package/esm2015/lib/components/forms/multiple-select-input/multiple-select-input.component.js.map +1 -0
- package/esm2015/lib/components/forms/multiple-select-input/multiple-select-input.component.metadata.json +1 -0
- package/esm2015/lib/components/forms/multiple-select-input/multiple-select-input.component.ngfactory.js.map +1 -0
- package/esm2015/lib/components/forms/multiple-select-input/multiple-select-input.component.scss.shim.ngstyle.js.map +1 -0
- package/esm2015/lib/components/forms/number-input/number-input.component.js +4 -4
- package/esm2015/lib/components/forms/number-input/number-input.component.js.map +1 -1
- package/esm2015/lib/components/forms/number-input/number-input.component.metadata.json +1 -1
- package/esm2015/lib/components/forms/password-input/password-input.component.js +4 -4
- package/esm2015/lib/components/forms/password-input/password-input.component.js.map +1 -1
- package/esm2015/lib/components/forms/password-input/password-input.component.metadata.json +1 -1
- package/esm2015/lib/components/forms/select-input/select-input.component.js +4 -4
- package/esm2015/lib/components/forms/select-input/select-input.component.js.map +1 -1
- package/esm2015/lib/components/forms/select-input/select-input.component.metadata.json +1 -1
- package/esm2015/lib/components/forms/string-input/string-input.component.js +4 -4
- package/esm2015/lib/components/forms/string-input/string-input.component.js.map +1 -1
- package/esm2015/lib/components/forms/string-input/string-input.component.metadata.json +1 -1
- package/esm2015/lib/components/forms/text-input/text-input.component.js +4 -4
- package/esm2015/lib/components/forms/text-input/text-input.component.js.map +1 -1
- package/esm2015/lib/components/forms/text-input/text-input.component.metadata.json +1 -1
- package/esm2015/lib/components/index.js +3 -0
- package/esm2015/lib/components/index.js.map +1 -1
- package/esm2015/lib/components/index.metadata.json +1 -1
- package/esm2015/lib/components/table/cell-editors.js +1 -0
- package/esm2015/lib/components/table/cell-editors.js.map +1 -0
- package/esm2015/lib/components/table/cell-editors.metadata.json +1 -0
- package/esm2015/lib/components/table/column-model.js +205 -60
- 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/column-template/column-template.directive.js +26 -1
- package/esm2015/lib/components/table/column-template/column-template.directive.js.map +1 -1
- package/esm2015/lib/components/table/column-template/column-template.directive.metadata.json +1 -1
- package/esm2015/lib/components/table/edit-session.js +10 -7
- package/esm2015/lib/components/table/edit-session.js.map +1 -1
- package/esm2015/lib/components/table/edit-session.metadata.json +1 -1
- package/esm2015/lib/components/table/select-cell-renderer/select-cell-renderer.component.js +1 -12
- package/esm2015/lib/components/table/select-cell-renderer/select-cell-renderer.component.js.map +1 -1
- package/esm2015/lib/components/table/select-cell-renderer/select-cell-renderer.component.metadata.json +1 -1
- package/esm2015/lib/components/table/select-header-cell-renderer/select-header-cell-renderer.component.js +6 -8
- package/esm2015/lib/components/table/select-header-cell-renderer/select-header-cell-renderer.component.js.map +1 -1
- package/esm2015/lib/components/table/select-header-cell-renderer/select-header-cell-renderer.component.metadata.json +1 -1
- package/esm2015/lib/components/table/table-cell-renderer/table-cell-renderer.component.js +43 -19
- 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 +12 -8
- 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 +15 -4
- 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/components/table/table.component.js +8 -0
- package/esm2015/lib/components/table/table.component.js.map +1 -1
- package/esm2015/lib/components/table/table.component.metadata.json +1 -1
- package/esm5/coolon-angular-ui-powerups.js +56 -53
- package/esm5/coolon-angular-ui-powerups.js.map +1 -1
- package/esm5/lib/angular-ui-powerups.module.ngfactory.js.map +1 -1
- package/esm5/lib/components/card-container/card-container.component.js +1 -1
- package/esm5/lib/components/components.module.js +9 -2
- package/esm5/lib/components/components.module.js.map +1 -1
- package/esm5/lib/components/components.module.ngfactory.js.map +1 -1
- package/esm5/lib/components/forms/abstract-input.component.js +10 -15
- package/esm5/lib/components/forms/abstract-input.component.js.map +1 -1
- package/esm5/lib/components/forms/abstract-list-input.component.js +30 -0
- package/esm5/lib/components/forms/abstract-list-input.component.js.map +1 -0
- package/esm5/lib/components/forms/abstract-list-input.component.ngfactory.js.map +1 -0
- package/esm5/lib/components/forms/abstract-value-input.component.js +30 -0
- package/esm5/lib/components/forms/abstract-value-input.component.js.map +1 -0
- package/esm5/lib/components/forms/abstract-value-input.component.ngfactory.js.map +1 -0
- package/esm5/lib/components/forms/checkbox-input/checkbox-input.component.js +3 -3
- package/esm5/lib/components/forms/checkbox-input/checkbox-input.component.js.map +1 -1
- package/esm5/lib/components/forms/multiple-select-input/multiple-select-input.component.js +57 -0
- package/esm5/lib/components/forms/multiple-select-input/multiple-select-input.component.js.map +1 -0
- package/esm5/lib/components/forms/multiple-select-input/multiple-select-input.component.ngfactory.js.map +1 -0
- package/esm5/lib/components/forms/multiple-select-input/multiple-select-input.component.scss.shim.ngstyle.js.map +1 -0
- package/esm5/lib/components/forms/number-input/number-input.component.js +4 -4
- package/esm5/lib/components/forms/number-input/number-input.component.js.map +1 -1
- package/esm5/lib/components/forms/password-input/password-input.component.js +4 -4
- package/esm5/lib/components/forms/password-input/password-input.component.js.map +1 -1
- package/esm5/lib/components/forms/select-input/select-input.component.js +4 -4
- package/esm5/lib/components/forms/select-input/select-input.component.js.map +1 -1
- package/esm5/lib/components/forms/string-input/string-input.component.js +4 -4
- package/esm5/lib/components/forms/string-input/string-input.component.js.map +1 -1
- package/esm5/lib/components/forms/text-input/text-input.component.js +4 -4
- package/esm5/lib/components/forms/text-input/text-input.component.js.map +1 -1
- package/esm5/lib/components/index.js +3 -0
- package/esm5/lib/components/index.js.map +1 -1
- package/esm5/lib/components/table/cell-editors.js +1 -0
- package/esm5/lib/components/table/cell-editors.js.map +1 -0
- package/esm5/lib/components/table/column-model.js +243 -80
- package/esm5/lib/components/table/column-model.js.map +1 -1
- package/esm5/lib/components/table/column-template/column-template.directive.js +26 -1
- package/esm5/lib/components/table/column-template/column-template.directive.js.map +1 -1
- package/esm5/lib/components/table/edit-session.js +10 -7
- package/esm5/lib/components/table/edit-session.js.map +1 -1
- package/esm5/lib/components/table/select-cell-renderer/select-cell-renderer.component.js +1 -16
- package/esm5/lib/components/table/select-cell-renderer/select-cell-renderer.component.js.map +1 -1
- package/esm5/lib/components/table/select-header-cell-renderer/select-header-cell-renderer.component.js +6 -8
- package/esm5/lib/components/table/select-header-cell-renderer/select-header-cell-renderer.component.js.map +1 -1
- package/esm5/lib/components/table/table-cell-renderer/table-cell-renderer.component.js +43 -19
- 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 +12 -8
- 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 +15 -4
- package/esm5/lib/components/table/table-model.js.map +1 -1
- package/esm5/lib/components/table/table.component.js +8 -0
- package/esm5/lib/components/table/table.component.js.map +1 -1
- package/fesm2015/coolon-angular-ui-powerups.js +576 -288
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/fesm5/coolon-angular-ui-powerups.js +670 -362
- package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
- package/lib/components/forms/abstract-input.component.d.ts +10 -12
- package/lib/components/forms/abstract-list-input.component.d.ts +16 -0
- package/lib/components/forms/abstract-value-input.component.d.ts +16 -0
- package/lib/components/forms/checkbox-input/checkbox-input.component.d.ts +4 -4
- package/lib/components/forms/multiple-select-input/multiple-select-input.component.d.ts +15 -0
- package/lib/components/forms/number-input/number-input.component.d.ts +4 -4
- package/lib/components/forms/password-input/password-input.component.d.ts +4 -4
- package/lib/components/forms/select-input/select-input.component.d.ts +4 -4
- package/lib/components/forms/string-input/string-input.component.d.ts +4 -4
- package/lib/components/forms/text-input/text-input.component.d.ts +4 -4
- package/lib/components/index.d.ts +4 -1
- package/lib/components/table/cell-editors.d.ts +9 -0
- package/lib/components/table/column-model.d.ts +85 -33
- package/lib/components/table/column-template/column-template.directive.d.ts +8 -2
- package/lib/components/table/edit-session.d.ts +4 -4
- package/lib/components/table/select-cell-renderer/select-cell-renderer.component.d.ts +1 -3
- package/lib/components/table/table-cell-renderer/table-cell-renderer.component.d.ts +13 -6
- package/lib/components/table/table-header-cell-renderer/table-header-cell-renderer.component.d.ts +8 -4
- package/lib/components/table/table-model.d.ts +5 -1
- package/lib/components/table/table.component.d.ts +3 -1
- package/package.json +1 -1
- package/esm2015/lib/components/table/cell-editor.component.js +0 -1
- package/esm2015/lib/components/table/cell-editor.component.js.map +0 -1
- package/esm2015/lib/components/table/cell-editor.component.metadata.json +0 -1
- package/esm5/lib/components/table/cell-editor.component.js +0 -1
- package/esm5/lib/components/table/cell-editor.component.js.map +0 -1
- package/lib/components/table/cell-editor.component.d.ts +0 -5
|
@@ -1,13 +1,114 @@
|
|
|
1
1
|
import { __decorate, __metadata } from "tslib";
|
|
2
|
-
import { ComponentPortal } from '@angular/cdk/portal';
|
|
3
|
-
import { MultipleSelectionModel } from '@coolon/pectin';
|
|
2
|
+
import { ComponentPortal, TemplatePortal } from '@angular/cdk/portal';
|
|
3
|
+
import { MultipleSelectionModel, Trace } from '@coolon/pectin';
|
|
4
|
+
import { assert } from '@coolon/typescript-utilities';
|
|
4
5
|
import { Memoize } from '@typescript-plus/fast-memoize-decorator/dist/src';
|
|
6
|
+
import _ from 'lodash';
|
|
5
7
|
import { DefaultCellRendererComponent } from './default-cell-renderer/default-cell-renderer.component';
|
|
6
8
|
import { DefaultHeaderCellRendererComponent } from './default-header-cell-renderer/default-header-cell-renderer.component';
|
|
7
9
|
import { EditRowControls } from './edit-row-controls/edit-row-controls.component';
|
|
8
10
|
import { SelectCellRendererComponent } from './select-cell-renderer/select-cell-renderer.component';
|
|
9
11
|
import { SelectHeaderCellRendererComponent } from './select-header-cell-renderer/select-header-cell-renderer.component';
|
|
10
|
-
import {
|
|
12
|
+
import { TableCellRendererComponent } from './table-cell-renderer/table-cell-renderer.component';
|
|
13
|
+
export const HEADER_CELL_RENDERER_PORTAL = Symbol('aup-cell-header-renderer-component-ref');
|
|
14
|
+
export const CELL_RENDERER_PORTAL = Symbol('aup-cell-renderer-component-ref');
|
|
15
|
+
export const CELL_EDITOR_PORTAL = Symbol('aup-cell-editor-component-ref');
|
|
16
|
+
export const PORTAL_RENDERER_COMPONENT = Symbol('aup-cell-renderer-portal-component');
|
|
17
|
+
export const PORTAL_EDITOR_COMPONENT = Symbol('aup-cell-editor-portal-component');
|
|
18
|
+
const noop = () => {
|
|
19
|
+
};
|
|
20
|
+
const ɵ0 = noop;
|
|
21
|
+
export class CellPortalRef {
|
|
22
|
+
constructor() {
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export class CellHeaderPortalRef extends CellPortalRef {
|
|
26
|
+
constructor(componentType, initialiseHeader) {
|
|
27
|
+
super();
|
|
28
|
+
this.componentType = componentType;
|
|
29
|
+
this.initialiseHeader = initialiseHeader;
|
|
30
|
+
}
|
|
31
|
+
initialiseHost(host, columnModel) {
|
|
32
|
+
assert.isTruthy(host);
|
|
33
|
+
host[HEADER_CELL_RENDERER_PORTAL] = new ComponentPortal(this.componentType);
|
|
34
|
+
}
|
|
35
|
+
onPortalAttached(host, portalComponent) {
|
|
36
|
+
this.initialiseHeader(portalComponent, host.column);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
export class CellRendererPortalRef extends CellPortalRef {
|
|
40
|
+
}
|
|
41
|
+
export class ComponentCellRendererPortalRef extends CellRendererPortalRef {
|
|
42
|
+
constructor(componentType, updateComponent) {
|
|
43
|
+
super();
|
|
44
|
+
this.componentType = componentType;
|
|
45
|
+
this.updateComponent = updateComponent;
|
|
46
|
+
}
|
|
47
|
+
initialiseHost(host, columnModel) {
|
|
48
|
+
host[CELL_RENDERER_PORTAL] = new ComponentPortal(this.componentType);
|
|
49
|
+
}
|
|
50
|
+
onPortalAttached(host, portalComponent) {
|
|
51
|
+
host[PORTAL_RENDERER_COMPONENT] = portalComponent;
|
|
52
|
+
this.updateComponent(portalComponent, host.getRowData());
|
|
53
|
+
}
|
|
54
|
+
pushState(host) {
|
|
55
|
+
if (host[PORTAL_RENDERER_COMPONENT]) {
|
|
56
|
+
this.updateComponent(host[PORTAL_RENDERER_COMPONENT], host.getRowData());
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
export class CellEditorPortalRef extends CellPortalRef {
|
|
61
|
+
constructor(componentType, initialiseEditorSession) {
|
|
62
|
+
super();
|
|
63
|
+
this.componentType = componentType;
|
|
64
|
+
this.initialiseEditorSession = initialiseEditorSession;
|
|
65
|
+
}
|
|
66
|
+
initialiseHost(host, columnModel) {
|
|
67
|
+
assert.isTruthy(host);
|
|
68
|
+
host[CELL_EDITOR_PORTAL] = new ComponentPortal(this.componentType);
|
|
69
|
+
}
|
|
70
|
+
onPortalAttached(host, portalComponent) {
|
|
71
|
+
host[PORTAL_EDITOR_COMPONENT] = portalComponent;
|
|
72
|
+
this.initialiseEditorSession(portalComponent, host.editSession);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
__decorate([
|
|
76
|
+
Trace(),
|
|
77
|
+
__metadata("design:type", Function),
|
|
78
|
+
__metadata("design:paramtypes", [TableCellRendererComponent, Object]),
|
|
79
|
+
__metadata("design:returntype", void 0)
|
|
80
|
+
], CellEditorPortalRef.prototype, "onPortalAttached", null);
|
|
81
|
+
export class TemplateCellRendererPortalRef extends CellRendererPortalRef {
|
|
82
|
+
constructor() {
|
|
83
|
+
super();
|
|
84
|
+
}
|
|
85
|
+
registerPortal(templateRef, viewContainer, fillCell, padChild) {
|
|
86
|
+
this.templateRef = templateRef;
|
|
87
|
+
this.viewContainer = viewContainer;
|
|
88
|
+
this.fillCell = fillCell;
|
|
89
|
+
this.padChild = padChild;
|
|
90
|
+
}
|
|
91
|
+
initialiseHost(host, columnModel) {
|
|
92
|
+
assert.isTruthy(host);
|
|
93
|
+
}
|
|
94
|
+
onPortalAttached(host, portalComponent) {
|
|
95
|
+
// don't care
|
|
96
|
+
}
|
|
97
|
+
pushState(host) {
|
|
98
|
+
host[CELL_RENDERER_PORTAL] = this.createPortal(host.getRowData());
|
|
99
|
+
host.fillCell = this.fillCell;
|
|
100
|
+
host.padChild = this.padChild;
|
|
101
|
+
}
|
|
102
|
+
createPortal(data) {
|
|
103
|
+
return new TemplatePortal(this.templateRef, this.viewContainer, Object.assign(Object.assign({}, (data)), { $implicit: data.row }));
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
__decorate([
|
|
107
|
+
Trace(),
|
|
108
|
+
__metadata("design:type", Function),
|
|
109
|
+
__metadata("design:paramtypes", [TableCellRendererComponent, void 0]),
|
|
110
|
+
__metadata("design:returntype", void 0)
|
|
111
|
+
], TemplateCellRendererPortalRef.prototype, "onPortalAttached", null);
|
|
11
112
|
export class ColumnModel {
|
|
12
113
|
constructor(columnId, defaults) {
|
|
13
114
|
this.columnId = columnId;
|
|
@@ -30,43 +131,42 @@ export class ColumnModel {
|
|
|
30
131
|
this._columnTextProperties = columnTextProperties;
|
|
31
132
|
return this;
|
|
32
133
|
}
|
|
33
|
-
|
|
34
|
-
this.
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
cellHeaderRenderer(cellRenderer, initialiser) {
|
|
40
|
-
this._columnHeaderConfig = {
|
|
41
|
-
portal: new ComponentPortal(cellRenderer),
|
|
42
|
-
initialiseComponent: initialiser
|
|
43
|
-
};
|
|
44
|
-
return this;
|
|
134
|
+
configureHeaderRenderer(config) {
|
|
135
|
+
this._columnHeaderPortalRef = config;
|
|
136
|
+
}
|
|
137
|
+
configureCellRenderer(config) {
|
|
138
|
+
this._cellRendererPortalRef = config;
|
|
45
139
|
}
|
|
46
|
-
|
|
47
|
-
this.
|
|
140
|
+
configureCellEditor(cellEditor) {
|
|
141
|
+
this._cellEditorPortalRef = cellEditor;
|
|
48
142
|
}
|
|
49
|
-
|
|
50
|
-
|
|
143
|
+
cellHeaderRenderer(componentType, initialiser) {
|
|
144
|
+
this.configureHeaderRenderer(new CellHeaderPortalRef(componentType, initialiser));
|
|
145
|
+
return this;
|
|
51
146
|
}
|
|
52
|
-
|
|
53
|
-
return this.
|
|
147
|
+
hasEditorPortal() {
|
|
148
|
+
return !!this._cellEditorPortalRef;
|
|
54
149
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
150
|
+
attachHeaderCell(host) {
|
|
151
|
+
this._columnHeaderPortalRef.initialiseHost(host, this);
|
|
152
|
+
}
|
|
153
|
+
attachCell(host) {
|
|
154
|
+
this._cellRendererPortalRef.initialiseHost(host, this);
|
|
155
|
+
if (this.hasEditorPortal()) {
|
|
156
|
+
this._cellEditorPortalRef.initialiseHost(host, this);
|
|
157
|
+
}
|
|
58
158
|
}
|
|
59
|
-
|
|
60
|
-
|
|
159
|
+
onHeaderAttached(host, component) {
|
|
160
|
+
this._columnHeaderPortalRef.onPortalAttached(host, component);
|
|
61
161
|
}
|
|
62
|
-
|
|
63
|
-
this.
|
|
162
|
+
onRendererAttached(host, component) {
|
|
163
|
+
this._cellRendererPortalRef.onPortalAttached(host, component);
|
|
64
164
|
}
|
|
65
|
-
|
|
66
|
-
this.
|
|
165
|
+
onEditorAttached(host, component) {
|
|
166
|
+
this._cellEditorPortalRef.onPortalAttached(host, component);
|
|
67
167
|
}
|
|
68
|
-
|
|
69
|
-
this.
|
|
168
|
+
updatePortalContent(host) {
|
|
169
|
+
this._cellRendererPortalRef.pushState(host);
|
|
70
170
|
}
|
|
71
171
|
}
|
|
72
172
|
__decorate([
|
|
@@ -81,6 +181,12 @@ __decorate([
|
|
|
81
181
|
__metadata("design:paramtypes", []),
|
|
82
182
|
__metadata("design:returntype", Object)
|
|
83
183
|
], ColumnModel.prototype, "getColumnTextProperties", null);
|
|
184
|
+
__decorate([
|
|
185
|
+
Trace(),
|
|
186
|
+
__metadata("design:type", Function),
|
|
187
|
+
__metadata("design:paramtypes", [TableCellRendererComponent, Object]),
|
|
188
|
+
__metadata("design:returntype", void 0)
|
|
189
|
+
], ColumnModel.prototype, "onEditorAttached", null);
|
|
84
190
|
export class PropertyColumnModel extends ColumnModel {
|
|
85
191
|
constructor(property, defaults) {
|
|
86
192
|
super(property.toString(), defaults);
|
|
@@ -89,25 +195,58 @@ export class PropertyColumnModel extends ColumnModel {
|
|
|
89
195
|
this.cellRenderer(DefaultCellRendererComponent);
|
|
90
196
|
}
|
|
91
197
|
cellRenderer(componentType) {
|
|
92
|
-
this.
|
|
93
|
-
component.value = this._format(row[this.property]);
|
|
94
|
-
});
|
|
198
|
+
this.configureCellRenderer(new ComponentCellRendererPortalRef(componentType, (component, rowData) => {
|
|
199
|
+
component.value = this._format(rowData.row[this.property]);
|
|
200
|
+
}));
|
|
95
201
|
return this;
|
|
96
202
|
}
|
|
97
|
-
cellEditor(editor,
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
component.valueModel = formValueModel;
|
|
106
|
-
if (options === null || options === void 0 ? void 0 : options.initialiseComponent) {
|
|
107
|
-
options.initialiseComponent(component);
|
|
108
|
-
}
|
|
203
|
+
cellEditor(editor, validatorsOrInitialiser, initialiseComponent) {
|
|
204
|
+
const validators = Array.isArray(validatorsOrInitialiser) ? validatorsOrInitialiser : undefined;
|
|
205
|
+
const initialiser = _.isFunction(validatorsOrInitialiser) ? validatorsOrInitialiser : initialiseComponent;
|
|
206
|
+
this.configureCellEditor(new CellEditorPortalRef(editor, (component, editSession) => {
|
|
207
|
+
const formValueModel = editSession.form.pluck(this.property);
|
|
208
|
+
if (validators) {
|
|
209
|
+
formValueModel.validateUsing(validators);
|
|
109
210
|
}
|
|
110
|
-
|
|
211
|
+
component.valueModel = formValueModel;
|
|
212
|
+
if (initialiser) {
|
|
213
|
+
initialiser(component);
|
|
214
|
+
}
|
|
215
|
+
}));
|
|
216
|
+
return this;
|
|
217
|
+
}
|
|
218
|
+
format(formatter) {
|
|
219
|
+
assert.isFunction(formatter);
|
|
220
|
+
this._format = formatter;
|
|
221
|
+
return this;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
export class ListPropertyColumnModel extends ColumnModel {
|
|
225
|
+
constructor(property, defaults) {
|
|
226
|
+
super(property.toString(), defaults);
|
|
227
|
+
this.property = property;
|
|
228
|
+
this._format = (value) => value.map(v => v === null || v === void 0 ? void 0 : v.toString()).join(', ');
|
|
229
|
+
this.cellRenderer(DefaultCellRendererComponent);
|
|
230
|
+
}
|
|
231
|
+
cellRenderer(componentType) {
|
|
232
|
+
this.configureCellRenderer(new ComponentCellRendererPortalRef(componentType, (component, rowData) => {
|
|
233
|
+
component.value = this._format(rowData.row[this.property]);
|
|
234
|
+
}));
|
|
235
|
+
return this;
|
|
236
|
+
}
|
|
237
|
+
cellEditor(editor, validatorsOrInitialiser, initialiseComponent) {
|
|
238
|
+
const validators = Array.isArray(validatorsOrInitialiser) ? validatorsOrInitialiser : undefined;
|
|
239
|
+
const initialiser = _.isFunction(validatorsOrInitialiser) ? validatorsOrInitialiser : initialiseComponent;
|
|
240
|
+
this.configureCellEditor(new CellEditorPortalRef(editor, (component, editSession) => {
|
|
241
|
+
const formListModel = editSession.form.pluckList(this.property);
|
|
242
|
+
if (validators) {
|
|
243
|
+
formListModel.validateUsing(validators);
|
|
244
|
+
}
|
|
245
|
+
component.listModel = formListModel;
|
|
246
|
+
if (initialiser) {
|
|
247
|
+
initialiser(component);
|
|
248
|
+
}
|
|
249
|
+
}));
|
|
111
250
|
return this;
|
|
112
251
|
}
|
|
113
252
|
format(formatter) {
|
|
@@ -123,9 +262,9 @@ export class CustomValueColumnModel extends ColumnModel {
|
|
|
123
262
|
this.cellRenderer(DefaultCellRendererComponent);
|
|
124
263
|
}
|
|
125
264
|
cellRenderer(componentType) {
|
|
126
|
-
this.
|
|
127
|
-
component.value = this.getValue(row);
|
|
128
|
-
});
|
|
265
|
+
this.configureCellRenderer(new ComponentCellRendererPortalRef(componentType, (component, rowData) => {
|
|
266
|
+
component.value = this.getValue(rowData.row);
|
|
267
|
+
}));
|
|
129
268
|
return this;
|
|
130
269
|
}
|
|
131
270
|
}
|
|
@@ -135,11 +274,11 @@ export class EditorControlColumnModel extends ColumnModel {
|
|
|
135
274
|
this.cellRenderer(EditRowControls);
|
|
136
275
|
}
|
|
137
276
|
cellRenderer(componentType) {
|
|
138
|
-
this.
|
|
139
|
-
component.row = row;
|
|
140
|
-
component.editSession = editSession;
|
|
141
|
-
component.editRowCommand = editRowCommand;
|
|
142
|
-
});
|
|
277
|
+
this.configureCellRenderer(new ComponentCellRendererPortalRef(componentType, (component, rowData) => {
|
|
278
|
+
component.row = rowData.row;
|
|
279
|
+
component.editSession = rowData.editSession;
|
|
280
|
+
component.editRowCommand = rowData.editRowCommand;
|
|
281
|
+
}));
|
|
143
282
|
return this;
|
|
144
283
|
}
|
|
145
284
|
getDefaultHeaderText() {
|
|
@@ -147,8 +286,13 @@ export class EditorControlColumnModel extends ColumnModel {
|
|
|
147
286
|
}
|
|
148
287
|
}
|
|
149
288
|
export class CustomTemplateColumnModel extends ColumnModel {
|
|
150
|
-
constructor(columnId, defaults
|
|
289
|
+
constructor(columnId, defaults) {
|
|
151
290
|
super(columnId, defaults);
|
|
291
|
+
this.config = new TemplateCellRendererPortalRef();
|
|
292
|
+
this.configureCellRenderer(this.config);
|
|
293
|
+
}
|
|
294
|
+
setTemplate(templateRef, viewContainer, fillCell, padChild) {
|
|
295
|
+
this.config.registerPortal(templateRef, viewContainer, fillCell, padChild);
|
|
152
296
|
}
|
|
153
297
|
}
|
|
154
298
|
export class SelectionColumnModel extends ColumnModel {
|
|
@@ -159,13 +303,14 @@ export class SelectionColumnModel extends ColumnModel {
|
|
|
159
303
|
component.selectionModel = selectionModel;
|
|
160
304
|
});
|
|
161
305
|
}
|
|
162
|
-
this.
|
|
163
|
-
component.row = row;
|
|
306
|
+
this.configureCellRenderer(new ComponentCellRendererPortalRef(SelectCellRendererComponent, (component, rowData) => {
|
|
307
|
+
component.row = rowData.row;
|
|
164
308
|
component.selectionModel = selectionModel;
|
|
165
|
-
});
|
|
309
|
+
}));
|
|
166
310
|
}
|
|
167
311
|
getDefaultHeaderText() {
|
|
168
312
|
return '';
|
|
169
313
|
}
|
|
170
314
|
}
|
|
315
|
+
export { ɵ0 };
|
|
171
316
|
//# sourceMappingURL=column-model.js.map
|
|
@@ -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,EAAU,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAiB,sBAAsB,EAAkD,MAAM,gBAAgB,CAAC;AACvH,OAAO,EAAE,OAAO,EAAE,MAAM,kDAAkD,CAAC;AAI3E,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;AACxH,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAmBtD,MAAM,OAAO,WAAW;IAQtB,YAAqB,QAAgB,EAAU,QAA8B;QAAxD,aAAQ,GAAR,QA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,cAAc,GAAG,cAAc,CAAC;QAC5C,CAAC,CAAC,CAAC;IACL,CAAC;IAES,oBAAoB;QAC5B,OAAO,EAAE,CAAC;IACZ,CAAC;CACF","sourcesContent":["import { ComponentType } from '@angular/cdk/overlay';\nimport { ComponentPortal, Portal } from '@angular/cdk/portal';\nimport { Command, Form, MultipleSelectionModel, SelectionModel, Types, UnaryCommand, Validator } from '@coolon/pectin';\nimport { Memoize } from '@typescript-plus/fast-memoize-decorator/dist/src';\nimport { AbstractInputComponent } from '../forms/abstract-input.component';\nimport { CellEditorComponent } from './cell-editor.component';\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 { assert } from '@coolon/typescript-utilities';\n\n\nexport interface ColumnHeaderConfig<Row, C extends any> {\n portal: Portal<C>;\n initialiseComponent?: (component: C, column: ColumnModel<Row>) => void;\n}\n\nexport interface CellRendererConfig<Row, C extends any> {\n portal: Portal<C>;\n pushState?: (component: C, row: Row, editRowCommand: Command<void>, editSession: EditSession<Row>) => void;\n}\n\nexport interface CellEditorConfig<Row, V, C extends AbstractInputComponent<V>> {\n portal: Portal<C>;\n initialiseComponent?: (component: C, editSession: EditSession<Row>) => void;\n}\n\n\nexport class ColumnModel<Row> {\n\n private _columnTextProperties: ColumnTextProperties;\n\n private _columnHeaderConfig: ColumnHeaderConfig<Row, any>;\n private _cellRendererConfig: CellRendererConfig<any, any>;\n private _cellEditorConfig: CellEditorConfig<any, any, 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 setCellRenderer<C>(cellRenderer: ComponentType<C>, initialiser: (component: C, row: Row, editRowCommand: Command<void>, editSession: EditSession<Row>) => void): void {\n this._cellRendererConfig = {\n portal: new ComponentPortal<C>(cellRenderer),\n pushState: initialiser\n };\n }\n\n cellHeaderRenderer<C>(cellRenderer: ComponentType<C>, initialiser: (component: C, column: ColumnModel<Row>) => void): this {\n this._columnHeaderConfig = {\n portal: new ComponentPortal<C>(cellRenderer),\n initialiseComponent: initialiser\n };\n return this;\n }\n\n protected setCellEditor<E extends AbstractInputComponent<any>>(cellEditor: CellEditorConfig<any, any, any>): void {\n this._cellEditorConfig = cellEditor;\n }\n\n get cellRendererPortal() {\n return this._cellRendererConfig.portal;\n }\n\n get columnHeaderCellRendererPortal() {\n return this._columnHeaderConfig.portal;\n }\n\n get cellEditorPortal() {\n return this._cellEditorConfig?.portal;\n }\n\n hasEditor() {\n return !!this._cellEditorConfig;\n }\n\n updateCellRenderer(component: any, row: Row, editRowCommand: Command<void>, editSession: EditSession<Row>) {\n this._cellRendererConfig.pushState(component, row, editRowCommand, editSession);\n }\n\n initialiseHeader(component: any) {\n this._columnHeaderConfig.initialiseComponent(component, this);\n }\n\n initialiseEditor(component: any, editSession: EditSession<Row>) {\n this._cellEditorConfig.initialiseComponent(component, editSession);\n }\n}\n\nexport namespace ColumnModel {\n export interface Defaults {\n getColumnTextProperties(columnModel: ColumnModel<any>): ColumnTextProperties;\n }\n}\n\nexport interface CellEditorOptions<V, E extends CellEditorComponent<V>> { //extends CellRendererOptions<E> {\n validators?: Validator<V>[];\n\n initialiseComponent?(component: E);\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.setCellRenderer(componentType, (component, row) => {\n component.value = this._format(row[this.property]);\n });\n return this;\n }\n\n cellEditor<E extends CellEditorComponent<Row[P]>>(editor: ComponentType<E>, options?: CellEditorOptions<Row[P], E>): this {\n this.setCellEditor({\n portal: new ComponentPortal<E>(editor),\n initialiseComponent: (component: E, editSession: EditSession<Row>) => {\n const formValueModel = editSession.form.pluck(this.property);\n if (options?.validators) {\n formValueModel.validateUsing(options.validators);\n }\n component.valueModel = formValueModel;\n if (options?.initialiseComponent) {\n options.initialiseComponent(component);\n }\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 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.setCellRenderer(componentType, (component, row) => {\n component.value = this.getValue(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.setCellRenderer(componentType, (component, row, editRowCommand, editSession) => {\n component.row = row;\n component.editSession = editSession;\n component.editRowCommand = editRowCommand;\n });\n return this;\n }\n\n protected getDefaultHeaderText(): string {\n return '';\n }\n}\n\nexport class CustomTemplateColumnModel<Row> extends ColumnModel<Row> {\n constructor(columnId: string, defaults: ColumnModel.Defaults, component: ComponentType<{ editCommand: Command<void>, saveCommand: Command<void>, cancelCommand: Command<void> }>) {\n super(columnId, defaults);\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.setCellRenderer(SelectCellRendererComponent, (component, row, editRowCommand, editSession) => {\n component.row = 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":";AACA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAEtE,OAAO,EAGL,sBAAsB,EAEtB,KAAK,EAIN,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;AACxH,OAAO,EAAE,0BAA0B,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CAAC,CAAC;QAHX,WAAM,GAAG,IAAI,6BAA6B,EAAO,CAAC;QAIjE,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC1C,CAAC;IAED,WAAW,CAAC,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;CACF;AAED,MAAM,OAAO,oBAA0B,SAAQ,WAAgB;IAC7D,YAAY,QAAgB,EAAE,QAA8B,EAAE,cAAmC;QAC/F,KAAK,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAC1B,IAAI,cAAc,YAAY,sBAAsB,EAAE;YACpD,IAAI,CAAC,kBAAkB,CAAC,iCAAiC,EAAE,CAAC,SAAS,EAAE,EAAE;gBACvE,SAAS,CAAC,cAAc,GAAG,cAAc,CAAC;YAC5C,CAAC,CAAC,CAAC;SACJ;QACD,IAAI,CAAC,qBAAqB,CAAC,IAAI,8BAA8B,CAAC,2BAA2B,EAAE,CAAC,SAAS,EAAE,OAAqB,EAAE,EAAE;YAC9H,SAAS,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;YAC5B,SAAS,CAAC,cAAc,GAAG,cAAc,CAAC;QAC5C,CAAC,CAAC,CAAC,CAAC;IACN,CAAC;IAES,oBAAoB;QAC5B,OAAO,EAAE,CAAC;IACZ,CAAC;CACF","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';\nimport fill = doc.builders.fill;\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 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"HEADER_CELL_RENDERER_PORTAL":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"Symbol"},"arguments":["aup-cell-header-renderer-component-ref"]},"CELL_RENDERER_PORTAL":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"Symbol"},"arguments":["aup-cell-renderer-component-ref"]},"CELL_EDITOR_PORTAL":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"Symbol"},"arguments":["aup-cell-editor-component-ref"]},"PORTAL_RENDERER_COMPONENT":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"Symbol"},"arguments":["aup-cell-renderer-portal-component"]},"PORTAL_EDITOR_COMPONENT":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"Symbol"},"arguments":["aup-cell-editor-portal-component"]},"ɵ0":{"__symbolic":"error","message":"Lambda not supported","line":36,"character":13},"RowData":{"__symbolic":"interface"},"CellPortalRef":{"__symbolic":"class","arity":3,"members":{"__ctor__":[{"__symbolic":"constructor"}],"initialiseHost":[{"__symbolic":"method"}],"onPortalAttached":[{"__symbolic":"method"}]}},"CellHeaderPortalRef":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"CellPortalRef"},"arity":2,"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/cdk/overlay","name":"ComponentType","line":55,"character":38,"arguments":[{"__symbolic":"error","message":"Could not resolve type","line":100,"character":52,"context":{"typeName":"Portal"}}]},{"__symbolic":"error","message":"Expression form not supported","line":55,"character":83}]}],"initialiseHost":[{"__symbolic":"method"}],"onPortalAttached":[{"__symbolic":"method"}]}},"CellRendererPortalRef":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"CellPortalRef"},"arity":2,"members":{"pushState":[{"__symbolic":"method"}]}},"ComponentCellRendererPortalRef":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"CellRendererPortalRef"},"arity":2,"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/cdk/overlay","name":"ComponentType","line":55,"character":38,"arguments":[{"__symbolic":"error","message":"Could not resolve type","line":100,"character":52,"context":{"typeName":"Portal"}}]},{"__symbolic":"error","message":"Expression form not supported","line":77,"character":87}]}],"initialiseHost":[{"__symbolic":"method"}],"onPortalAttached":[{"__symbolic":"method"}],"pushState":[{"__symbolic":"method"}]}},"CellEditorPortalRef":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"CellPortalRef"},"arity":2,"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/cdk/overlay","name":"ComponentType","line":55,"character":38,"arguments":[{"__symbolic":"error","message":"Could not resolve type","line":100,"character":52,"context":{"typeName":"Portal"}}]},{"__symbolic":"error","message":"Expression form not supported","line":100,"character":95}]}],"initialiseHost":[{"__symbolic":"method"}],"onPortalAttached":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@coolon/pectin","name":"Trace","line":109,"character":3}}]}]}},"TemplateCellRendererPortalRef":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"CellRendererPortalRef"},"arity":1,"members":{"__ctor__":[{"__symbolic":"constructor"}],"registerPortal":[{"__symbolic":"method"}],"initialiseHost":[{"__symbolic":"method"}],"onPortalAttached":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@coolon/pectin","name":"Trace","line":139,"character":3}}]}],"pushState":[{"__symbolic":"method"}],"createPortal":[{"__symbolic":"method"}]}},"ColumnModel":{"__symbolic":"class","arity":1,"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"string"},{"__symbolic":"select","expression":{"__symbolic":"reference","name":"ColumnModel"},"member":"Defaults"}]}],"getHeaderText":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@typescript-plus/fast-memoize-decorator/dist/src","name":"Memoize","line":170,"character":3}}]}],"getDefaultHeaderText":[{"__symbolic":"method"}],"getColumnTextProperties":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@typescript-plus/fast-memoize-decorator/dist/src","name":"Memoize","line":179,"character":3}}]}],"textProperties":[{"__symbolic":"method"}],"configureHeaderRenderer":[{"__symbolic":"method"}],"configureCellRenderer":[{"__symbolic":"method"}],"configureCellEditor":[{"__symbolic":"method"}],"cellHeaderRenderer":[{"__symbolic":"method"}],"hasEditorPortal":[{"__symbolic":"method"}],"attachHeaderCell":[{"__symbolic":"method"}],"attachCell":[{"__symbolic":"method"}],"onHeaderAttached":[{"__symbolic":"method"}],"onRendererAttached":[{"__symbolic":"method"}],"onEditorAttached":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@coolon/pectin","name":"Trace","line":229,"character":3}}]}],"updatePortalContent":[{"__symbolic":"method"}]}},"CellEditorOptions":{"__symbolic":"interface"},"PropertyColumnModel":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"ColumnModel"},"arity":2,"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Could not resolve type","line":256,"character":33,"context":{"typeName":"P"}},{"__symbolic":"select","expression":{"__symbolic":"reference","name":"ColumnModel"},"member":"Defaults"}]}],"cellRenderer":[{"__symbolic":"method"}],"cellEditor":[{"__symbolic":"method"},{"__symbolic":"method"},{"__symbolic":"method"}],"format":[{"__symbolic":"method"}]}},"ListPropertyColumnModel":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"ColumnModel"},"arity":2,"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Could not resolve type","line":297,"character":33,"context":{"typeName":"P"}},{"__symbolic":"select","expression":{"__symbolic":"reference","name":"ColumnModel"},"member":"Defaults"}]}],"cellRenderer":[{"__symbolic":"method"}],"cellEditor":[{"__symbolic":"method"},{"__symbolic":"method"},{"__symbolic":"method"}],"format":[{"__symbolic":"method"}]}},"CustomValueColumnModel":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"ColumnModel"},"arity":2,"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"string"},{"__symbolic":"select","expression":{"__symbolic":"reference","name":"ColumnModel"},"member":"Defaults"},{"__symbolic":"error","message":"Expression form not supported","line":336,"character":82}]}],"cellRenderer":[{"__symbolic":"method"}]}},"EditorControlColumnModel":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"ColumnModel"},"arity":1,"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","module":"@coolon/pectin","name":"UnaryCommand","line":351,"character":45,"arguments":[{"__symbolic":"reference","module":"@coolon/pectin","name":"Form","line":351,"character":58,"arguments":[{"__symbolic":"error","message":"Could not resolve type","line":351,"character":63,"context":{"typeName":"Row"}}]},{"__symbolic":"reference","name":"boolean"}]},{"__symbolic":"select","expression":{"__symbolic":"reference","name":"ColumnModel"},"member":"Defaults"}]}],"cellRenderer":[{"__symbolic":"method"}],"getDefaultHeaderText":[{"__symbolic":"method"}]}},"CustomTemplateColumnModel":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"ColumnModel"},"arity":1,"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"string"},{"__symbolic":"select","expression":{"__symbolic":"reference","name":"ColumnModel"},"member":"Defaults"}]}],"setTemplate":[{"__symbolic":"method"}]}},"SelectionColumnModel":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"ColumnModel"},"arity":1,"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"string"},{"__symbolic":"select","expression":{"__symbolic":"reference","name":"ColumnModel"},"member":"Defaults"},{"__symbolic":"reference","module":"@coolon/pectin","name":"SelectionModel","line":384,"character":80,"arguments":[{"__symbolic":"error","message":"Could not resolve type","line":384,"character":95,"context":{"typeName":"Row"}}]}]}],"getDefaultHeaderText":[{"__symbolic":"method"}]}}}}]
|
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import { __decorate, __metadata } from "tslib";
|
|
2
|
-
import { Directive, TemplateRef, ViewContainerRef } from '@angular/core';
|
|
2
|
+
import { Directive, Input, OnInit, TemplateRef, ViewContainerRef } from '@angular/core';
|
|
3
|
+
import { assert } from '@coolon/pectin';
|
|
3
4
|
import { TableComponent } from '../table.component';
|
|
4
5
|
let ColumnTemplateDirective = class ColumnTemplateDirective {
|
|
5
6
|
constructor(host, templateRef, viewContainer) {
|
|
7
|
+
this.host = host;
|
|
6
8
|
this.templateRef = templateRef;
|
|
7
9
|
this.viewContainer = viewContainer;
|
|
10
|
+
this.aupColumnTemplateFillCell = false;
|
|
11
|
+
this.aupColumnTemplateAutoPadChild = undefined;
|
|
12
|
+
}
|
|
13
|
+
ngOnInit() {
|
|
14
|
+
var _a;
|
|
15
|
+
assert.isTruthy(this.aupColumnTemplateColumnId);
|
|
16
|
+
this.host.registerColumnTemplate(this.aupColumnTemplateColumnId, this.templateRef, this.viewContainer, this.aupColumnTemplateFillCell, (_a = this.aupColumnTemplateAutoPadChild) !== null && _a !== void 0 ? _a : this.aupColumnTemplateFillCell);
|
|
8
17
|
}
|
|
9
18
|
};
|
|
10
19
|
ColumnTemplateDirective.ctorParameters = () => [
|
|
@@ -12,6 +21,22 @@ ColumnTemplateDirective.ctorParameters = () => [
|
|
|
12
21
|
{ type: TemplateRef },
|
|
13
22
|
{ type: ViewContainerRef }
|
|
14
23
|
];
|
|
24
|
+
__decorate([
|
|
25
|
+
Input(),
|
|
26
|
+
__metadata("design:type", String)
|
|
27
|
+
], ColumnTemplateDirective.prototype, "aupColumnTemplate", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
Input(),
|
|
30
|
+
__metadata("design:type", String)
|
|
31
|
+
], ColumnTemplateDirective.prototype, "aupColumnTemplateColumnId", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
Input(),
|
|
34
|
+
__metadata("design:type", Object)
|
|
35
|
+
], ColumnTemplateDirective.prototype, "aupColumnTemplateFillCell", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
Input(),
|
|
38
|
+
__metadata("design:type", Object)
|
|
39
|
+
], ColumnTemplateDirective.prototype, "aupColumnTemplateAutoPadChild", void 0);
|
|
15
40
|
ColumnTemplateDirective = __decorate([
|
|
16
41
|
Directive({
|
|
17
42
|
selector: '[aupColumnTemplate]'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"column-template.directive.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/components/table/column-template/column-template.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"column-template.directive.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/components/table/column-template/column-template.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACxF,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAKpD,IAAa,uBAAuB,GAApC,MAAa,uBAAuB;IAclC,YAAqB,IAAyB,EAC1B,WAA6B,EAC7B,aAA+B;QAF9B,SAAI,GAAJ,IAAI,CAAqB;QAC1B,gBAAW,GAAX,WAAW,CAAkB;QAC7B,kBAAa,GAAb,aAAa,CAAkB;QAPnD,8BAAyB,GAAG,KAAK,CAAC;QAGlC,kCAA6B,GAAG,SAAS,CAAC;IAK1C,CAAC;IAED,QAAQ;;QACN,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;QAChD,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,yBAAyB,EAC7D,IAAI,CAAC,WAAW,EAChB,IAAI,CAAC,aAAa,EAClB,IAAI,CAAC,yBAAyB,QAC9B,IAAI,CAAC,6BAA6B,mCAAI,IAAI,CAAC,yBAAyB,CAAC,CAAC;IAC1E,CAAC;CAEF,CAAA;;YAd4B,cAAc;YACR,WAAW;YACT,gBAAgB;;AAbnD;IADC,KAAK,EAAE;;kEACkB;AAG1B;IADC,KAAK,EAAE;;0EAC0B;AAGlC;IADC,KAAK,EAAE;;0EAC0B;AAGlC;IADC,KAAK,EAAE;;8EACkC;AAZ/B,uBAAuB;IAHnC,SAAS,CAAC;QACT,QAAQ,EAAE,qBAAqB;KAChC,CAAC;qCAe2B,cAAc;QACR,WAAW;QACT,gBAAgB;GAhBxC,uBAAuB,CA4BnC;SA5BY,uBAAuB","sourcesContent":["import { Directive, Input, OnInit, TemplateRef, ViewContainerRef } from '@angular/core';\nimport { assert } from '@coolon/pectin';\nimport { TableComponent } from '../table.component';\n\n@Directive({\n selector: '[aupColumnTemplate]'\n})\nexport class ColumnTemplateDirective implements OnInit {\n\n @Input()\n aupColumnTemplate: string;\n\n @Input()\n aupColumnTemplateColumnId: string;\n\n @Input()\n aupColumnTemplateFillCell = false;\n\n @Input()\n aupColumnTemplateAutoPadChild = undefined;\n\n constructor(readonly host: TableComponent<any>,\n private templateRef: TemplateRef<any>,\n private viewContainer: ViewContainerRef) {\n }\n\n ngOnInit() {\n assert.isTruthy(this.aupColumnTemplateColumnId);\n this.host.registerColumnTemplate(this.aupColumnTemplateColumnId,\n this.templateRef,\n this.viewContainer,\n this.aupColumnTemplateFillCell,\n this.aupColumnTemplateAutoPadChild ?? this.aupColumnTemplateFillCell);\n }\n\n}\n"]}
|
package/esm2015/lib/components/table/column-template/column-template.directive.metadata.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"ColumnTemplateDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"ColumnTemplateDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":4,"character":1},"arguments":[{"selector":"[aupColumnTemplate]"}]}],"members":{"aupColumnTemplate":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":9,"character":3}}]}],"aupColumnTemplateColumnId":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":12,"character":3}}]}],"aupColumnTemplateFillCell":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":15,"character":3}}]}],"aupColumnTemplateAutoPadChild":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":18,"character":3}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"../table.component","name":"TableComponent","line":21,"character":29,"arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","module":"@angular/core","name":"TemplateRef","line":22,"character":35,"arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","module":"@angular/core","name":"ViewContainerRef","line":23,"character":37}]}],"ngOnInit":[{"__symbolic":"method"}]}}}}]
|
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GarbageCollector, MutableValueModel } from '@coolon/pectin';
|
|
2
2
|
import produce from 'immer';
|
|
3
3
|
export class EditSession extends GarbageCollector {
|
|
4
|
-
constructor(rowId, row, saveCommand) {
|
|
4
|
+
constructor(rowId, row, form, saveCommand) {
|
|
5
5
|
super();
|
|
6
6
|
this.rowId = rowId;
|
|
7
|
+
this.form = form;
|
|
7
8
|
this.saveCommand = saveCommand;
|
|
8
|
-
this.
|
|
9
|
-
this.
|
|
10
|
-
this.form = new Form();
|
|
9
|
+
this._liveRowValue = new MutableValueModel();
|
|
10
|
+
this.liveRowValue = this._liveRowValue.readonly;
|
|
11
11
|
this.form.load(row);
|
|
12
|
-
this.
|
|
12
|
+
this._liveRowValue.value = row;
|
|
13
13
|
this.form.onEdit(() => {
|
|
14
|
-
|
|
14
|
+
// if (!this._liveRowValue.value[immerable]) {
|
|
15
|
+
// console.warn()
|
|
16
|
+
// }
|
|
17
|
+
this._liveRowValue.value = produce(this._liveRowValue.value, draft => {
|
|
15
18
|
this.form.writeDirtyStateTo(draft);
|
|
16
19
|
});
|
|
17
20
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edit-session.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/components/table/edit-session.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"edit-session.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/components/table/edit-session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,gBAAgB,EAAE,iBAAiB,EAAgB,MAAM,gBAAgB,CAAC;AAEzF,OAAO,OAAsB,MAAM,OAAO,CAAC;AAE3C,MAAM,OAAO,WAAiB,SAAQ,gBAAgB;IAIpD,YAAqB,KAAU,EAAE,GAAQ,EAAW,IAAe,EAAW,WAA6C;QACzH,KAAK,EAAE,CAAC;QADW,UAAK,GAAL,KAAK,CAAK;QAAqB,SAAI,GAAJ,IAAI,CAAW;QAAW,gBAAW,GAAX,WAAW,CAAkC;QAHnH,kBAAa,GAAG,IAAI,iBAAiB,EAAO,CAAC;QAC5C,iBAAY,GAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC;QAIlD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACpB,IAAI,CAAC,aAAa,CAAC,KAAK,GAAG,GAAG,CAAC;QAC/B,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE;YACpB,8CAA8C;YAC9C,mBAAmB;YACnB,IAAI;YACJ,IAAI,CAAC,aAAa,CAAC,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE;gBACnE,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,KAAyB,CAAC,CAAC;YACzD,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { Form, GarbageCollector, MutableValueModel, UnaryCommand } from '@coolon/pectin';\nimport { PickMutable } from '@coolon/typescript-utilities';\nimport produce, { immerable } from 'immer';\n\nexport class EditSession<Row> extends GarbageCollector {\n private _liveRowValue = new MutableValueModel<Row>();\n readonly liveRowValue = this._liveRowValue.readonly;\n\n constructor(readonly rowId: any, row: Row, readonly form: Form<Row>, readonly saveCommand: UnaryCommand<Form<Row>, boolean>) {\n super();\n this.form.load(row);\n this._liveRowValue.value = row;\n this.form.onEdit(() => {\n // if (!this._liveRowValue.value[immerable]) {\n // console.warn()\n // }\n this._liveRowValue.value = produce(this._liveRowValue.value, draft => {\n this.form.writeDirtyStateTo(draft as PickMutable<Row>);\n });\n });\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"EditSession":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"@coolon/pectin","name":"GarbageCollector","line":4,"character":38},"arity":1,"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"any"},{"__symbolic":"error","message":"Could not resolve type","line":
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"EditSession":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"@coolon/pectin","name":"GarbageCollector","line":4,"character":38},"arity":1,"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"any"},{"__symbolic":"error","message":"Could not resolve type","line":8,"character":40,"context":{"typeName":"Row"}},{"__symbolic":"reference","module":"@coolon/pectin","name":"Form","line":8,"character":60,"arguments":[{"__symbolic":"error","message":"Could not resolve type","line":8,"character":111,"context":{"typeName":"Row"}}]},{"__symbolic":"reference","module":"@coolon/pectin","name":"UnaryCommand","line":8,"character":93,"arguments":[{"__symbolic":"reference","module":"@coolon/pectin","name":"Form","line":8,"character":60,"arguments":[{"__symbolic":"error","message":"Could not resolve type","line":8,"character":111,"context":{"typeName":"Row"}}]},{"__symbolic":"reference","name":"boolean"}]}]}]}}}}]
|