@coolon/angular-ui-powerups 1.11.4 → 1.13.0
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 +767 -423
- 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 +10 -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 +213 -57
- 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 +16 -5
- 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 +18 -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 +254 -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 +16 -5
- 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 +580 -279
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/fesm5/coolon-angular-ui-powerups.js +680 -355
- 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 +90 -36
- 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,12 +1,137 @@
|
|
|
1
|
-
import { __decorate, __extends, __metadata } from "tslib";
|
|
2
|
-
import { ComponentPortal } from '@angular/cdk/portal';
|
|
3
|
-
import { MultipleSelectionModel } from '@coolon/pectin';
|
|
1
|
+
import { __assign, __decorate, __extends, __metadata } from "tslib";
|
|
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';
|
|
12
|
+
import { TableCellRendererComponent } from './table-cell-renderer/table-cell-renderer.component';
|
|
13
|
+
export var HEADER_CELL_RENDERER_PORTAL = Symbol('aup-cell-header-renderer-component-ref');
|
|
14
|
+
export var CELL_RENDERER_PORTAL = Symbol('aup-cell-renderer-component-ref');
|
|
15
|
+
export var CELL_EDITOR_PORTAL = Symbol('aup-cell-editor-component-ref');
|
|
16
|
+
export var PORTAL_RENDERER_COMPONENT = Symbol('aup-cell-renderer-portal-component');
|
|
17
|
+
export var PORTAL_EDITOR_COMPONENT = Symbol('aup-cell-editor-portal-component');
|
|
18
|
+
var noop = function () {
|
|
19
|
+
};
|
|
20
|
+
var ɵ0 = noop;
|
|
21
|
+
var CellPortalRef = /** @class */ (function () {
|
|
22
|
+
function CellPortalRef() {
|
|
23
|
+
}
|
|
24
|
+
return CellPortalRef;
|
|
25
|
+
}());
|
|
26
|
+
export { CellPortalRef };
|
|
27
|
+
var CellHeaderPortalRef = /** @class */ (function (_super) {
|
|
28
|
+
__extends(CellHeaderPortalRef, _super);
|
|
29
|
+
function CellHeaderPortalRef(componentType, initialiseHeader) {
|
|
30
|
+
var _this = _super.call(this) || this;
|
|
31
|
+
_this.componentType = componentType;
|
|
32
|
+
_this.initialiseHeader = initialiseHeader;
|
|
33
|
+
return _this;
|
|
34
|
+
}
|
|
35
|
+
CellHeaderPortalRef.prototype.initialiseHost = function (host, columnModel) {
|
|
36
|
+
assert.isTruthy(host);
|
|
37
|
+
host[HEADER_CELL_RENDERER_PORTAL] = new ComponentPortal(this.componentType);
|
|
38
|
+
};
|
|
39
|
+
CellHeaderPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
|
|
40
|
+
this.initialiseHeader(portalComponent, host.column);
|
|
41
|
+
};
|
|
42
|
+
return CellHeaderPortalRef;
|
|
43
|
+
}(CellPortalRef));
|
|
44
|
+
export { CellHeaderPortalRef };
|
|
45
|
+
var CellRendererPortalRef = /** @class */ (function (_super) {
|
|
46
|
+
__extends(CellRendererPortalRef, _super);
|
|
47
|
+
function CellRendererPortalRef() {
|
|
48
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
49
|
+
}
|
|
50
|
+
return CellRendererPortalRef;
|
|
51
|
+
}(CellPortalRef));
|
|
52
|
+
export { CellRendererPortalRef };
|
|
53
|
+
var ComponentCellRendererPortalRef = /** @class */ (function (_super) {
|
|
54
|
+
__extends(ComponentCellRendererPortalRef, _super);
|
|
55
|
+
function ComponentCellRendererPortalRef(componentType, updateComponent) {
|
|
56
|
+
var _this = _super.call(this) || this;
|
|
57
|
+
_this.componentType = componentType;
|
|
58
|
+
_this.updateComponent = updateComponent;
|
|
59
|
+
return _this;
|
|
60
|
+
}
|
|
61
|
+
ComponentCellRendererPortalRef.prototype.initialiseHost = function (host, columnModel) {
|
|
62
|
+
host[CELL_RENDERER_PORTAL] = new ComponentPortal(this.componentType);
|
|
63
|
+
};
|
|
64
|
+
ComponentCellRendererPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
|
|
65
|
+
host[PORTAL_RENDERER_COMPONENT] = portalComponent;
|
|
66
|
+
this.updateComponent(portalComponent, host.getRowData());
|
|
67
|
+
};
|
|
68
|
+
ComponentCellRendererPortalRef.prototype.pushState = function (host) {
|
|
69
|
+
if (host[PORTAL_RENDERER_COMPONENT]) {
|
|
70
|
+
this.updateComponent(host[PORTAL_RENDERER_COMPONENT], host.getRowData());
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
return ComponentCellRendererPortalRef;
|
|
74
|
+
}(CellRendererPortalRef));
|
|
75
|
+
export { ComponentCellRendererPortalRef };
|
|
76
|
+
var CellEditorPortalRef = /** @class */ (function (_super) {
|
|
77
|
+
__extends(CellEditorPortalRef, _super);
|
|
78
|
+
function CellEditorPortalRef(componentType, initialiseEditorSession) {
|
|
79
|
+
var _this = _super.call(this) || this;
|
|
80
|
+
_this.componentType = componentType;
|
|
81
|
+
_this.initialiseEditorSession = initialiseEditorSession;
|
|
82
|
+
return _this;
|
|
83
|
+
}
|
|
84
|
+
CellEditorPortalRef.prototype.initialiseHost = function (host, columnModel) {
|
|
85
|
+
assert.isTruthy(host);
|
|
86
|
+
host[CELL_EDITOR_PORTAL] = new ComponentPortal(this.componentType);
|
|
87
|
+
};
|
|
88
|
+
CellEditorPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
|
|
89
|
+
host[PORTAL_EDITOR_COMPONENT] = portalComponent;
|
|
90
|
+
this.initialiseEditorSession(portalComponent, host.editSession);
|
|
91
|
+
};
|
|
92
|
+
__decorate([
|
|
93
|
+
Trace(),
|
|
94
|
+
__metadata("design:type", Function),
|
|
95
|
+
__metadata("design:paramtypes", [TableCellRendererComponent, Object]),
|
|
96
|
+
__metadata("design:returntype", void 0)
|
|
97
|
+
], CellEditorPortalRef.prototype, "onPortalAttached", null);
|
|
98
|
+
return CellEditorPortalRef;
|
|
99
|
+
}(CellPortalRef));
|
|
100
|
+
export { CellEditorPortalRef };
|
|
101
|
+
var TemplateCellRendererPortalRef = /** @class */ (function (_super) {
|
|
102
|
+
__extends(TemplateCellRendererPortalRef, _super);
|
|
103
|
+
function TemplateCellRendererPortalRef() {
|
|
104
|
+
return _super.call(this) || this;
|
|
105
|
+
}
|
|
106
|
+
TemplateCellRendererPortalRef.prototype.registerPortal = function (templateRef, viewContainer, fillCell, padChild) {
|
|
107
|
+
this.templateRef = templateRef;
|
|
108
|
+
this.viewContainer = viewContainer;
|
|
109
|
+
this.fillCell = fillCell;
|
|
110
|
+
this.padChild = padChild;
|
|
111
|
+
};
|
|
112
|
+
TemplateCellRendererPortalRef.prototype.initialiseHost = function (host, columnModel) {
|
|
113
|
+
assert.isTruthy(host);
|
|
114
|
+
};
|
|
115
|
+
TemplateCellRendererPortalRef.prototype.onPortalAttached = function (host, portalComponent) {
|
|
116
|
+
// don't care
|
|
117
|
+
};
|
|
118
|
+
TemplateCellRendererPortalRef.prototype.pushState = function (host) {
|
|
119
|
+
host[CELL_RENDERER_PORTAL] = this.createPortal(host.getRowData());
|
|
120
|
+
host.fillCell = this.fillCell;
|
|
121
|
+
host.padChild = this.padChild;
|
|
122
|
+
};
|
|
123
|
+
TemplateCellRendererPortalRef.prototype.createPortal = function (data) {
|
|
124
|
+
return new TemplatePortal(this.templateRef, this.viewContainer, __assign(__assign({}, (data)), { $implicit: data.row }));
|
|
125
|
+
};
|
|
126
|
+
__decorate([
|
|
127
|
+
Trace(),
|
|
128
|
+
__metadata("design:type", Function),
|
|
129
|
+
__metadata("design:paramtypes", [TableCellRendererComponent, void 0]),
|
|
130
|
+
__metadata("design:returntype", void 0)
|
|
131
|
+
], TemplateCellRendererPortalRef.prototype, "onPortalAttached", null);
|
|
132
|
+
return TemplateCellRendererPortalRef;
|
|
133
|
+
}(CellRendererPortalRef));
|
|
134
|
+
export { TemplateCellRendererPortalRef };
|
|
10
135
|
var ColumnModel = /** @class */ (function () {
|
|
11
136
|
function ColumnModel(columnId, defaults) {
|
|
12
137
|
this.columnId = columnId;
|
|
@@ -29,54 +154,42 @@ var ColumnModel = /** @class */ (function () {
|
|
|
29
154
|
this._columnTextProperties = columnTextProperties;
|
|
30
155
|
return this;
|
|
31
156
|
};
|
|
32
|
-
ColumnModel.prototype.
|
|
33
|
-
this.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
};
|
|
38
|
-
ColumnModel.prototype.
|
|
39
|
-
this.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
});
|
|
69
|
-
ColumnModel.prototype.hasEditor = function () {
|
|
70
|
-
return !!this._cellEditorConfig;
|
|
71
|
-
};
|
|
72
|
-
ColumnModel.prototype.updateCellRenderer = function (component, row, editRowCommand, editSession) {
|
|
73
|
-
this._cellRendererConfig.pushState(component, row, editRowCommand, editSession);
|
|
74
|
-
};
|
|
75
|
-
ColumnModel.prototype.initialiseHeader = function (component) {
|
|
76
|
-
this._columnHeaderConfig.initialiseComponent(component, this);
|
|
77
|
-
};
|
|
78
|
-
ColumnModel.prototype.initialiseEditor = function (component, editSession) {
|
|
79
|
-
this._cellEditorConfig.initialiseComponent(component, editSession);
|
|
157
|
+
ColumnModel.prototype.configureHeaderRenderer = function (config) {
|
|
158
|
+
this._columnHeaderPortalRef = config;
|
|
159
|
+
};
|
|
160
|
+
ColumnModel.prototype.configureCellRenderer = function (config) {
|
|
161
|
+
this._cellRendererPortalRef = config;
|
|
162
|
+
};
|
|
163
|
+
ColumnModel.prototype.configureCellEditor = function (cellEditor) {
|
|
164
|
+
this._cellEditorPortalRef = cellEditor;
|
|
165
|
+
};
|
|
166
|
+
ColumnModel.prototype.cellHeaderRenderer = function (componentType, initialiser) {
|
|
167
|
+
this.configureHeaderRenderer(new CellHeaderPortalRef(componentType, initialiser));
|
|
168
|
+
return this;
|
|
169
|
+
};
|
|
170
|
+
ColumnModel.prototype.hasEditorPortal = function () {
|
|
171
|
+
return !!this._cellEditorPortalRef;
|
|
172
|
+
};
|
|
173
|
+
ColumnModel.prototype.attachHeaderCell = function (host) {
|
|
174
|
+
this._columnHeaderPortalRef.initialiseHost(host, this);
|
|
175
|
+
};
|
|
176
|
+
ColumnModel.prototype.attachCell = function (host) {
|
|
177
|
+
this._cellRendererPortalRef.initialiseHost(host, this);
|
|
178
|
+
if (this.hasEditorPortal()) {
|
|
179
|
+
this._cellEditorPortalRef.initialiseHost(host, this);
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
ColumnModel.prototype.onHeaderAttached = function (host, component) {
|
|
183
|
+
this._columnHeaderPortalRef.onPortalAttached(host, component);
|
|
184
|
+
};
|
|
185
|
+
ColumnModel.prototype.onRendererAttached = function (host, component) {
|
|
186
|
+
this._cellRendererPortalRef.onPortalAttached(host, component);
|
|
187
|
+
};
|
|
188
|
+
ColumnModel.prototype.onEditorAttached = function (host, component) {
|
|
189
|
+
this._cellEditorPortalRef.onPortalAttached(host, component);
|
|
190
|
+
};
|
|
191
|
+
ColumnModel.prototype.updatePortalContent = function (host) {
|
|
192
|
+
this._cellRendererPortalRef.pushState(host);
|
|
80
193
|
};
|
|
81
194
|
__decorate([
|
|
82
195
|
Memoize(),
|
|
@@ -90,6 +203,12 @@ var ColumnModel = /** @class */ (function () {
|
|
|
90
203
|
__metadata("design:paramtypes", []),
|
|
91
204
|
__metadata("design:returntype", Object)
|
|
92
205
|
], ColumnModel.prototype, "getColumnTextProperties", null);
|
|
206
|
+
__decorate([
|
|
207
|
+
Trace(),
|
|
208
|
+
__metadata("design:type", Function),
|
|
209
|
+
__metadata("design:paramtypes", [TableCellRendererComponent, Object]),
|
|
210
|
+
__metadata("design:returntype", void 0)
|
|
211
|
+
], ColumnModel.prototype, "onEditorAttached", null);
|
|
93
212
|
return ColumnModel;
|
|
94
213
|
}());
|
|
95
214
|
export { ColumnModel };
|
|
@@ -98,35 +217,81 @@ var PropertyColumnModel = /** @class */ (function (_super) {
|
|
|
98
217
|
function PropertyColumnModel(property, defaults) {
|
|
99
218
|
var _this = _super.call(this, property.toString(), defaults) || this;
|
|
100
219
|
_this.property = property;
|
|
220
|
+
_this._format = function (value) { return value; };
|
|
101
221
|
_this.cellRenderer(DefaultCellRendererComponent);
|
|
102
222
|
return _this;
|
|
103
223
|
}
|
|
104
224
|
PropertyColumnModel.prototype.cellRenderer = function (componentType) {
|
|
105
225
|
var _this = this;
|
|
106
|
-
this.
|
|
107
|
-
component.value = row[_this.property];
|
|
108
|
-
});
|
|
226
|
+
this.configureCellRenderer(new ComponentCellRendererPortalRef(componentType, function (component, rowData) {
|
|
227
|
+
component.value = _this._format(rowData.row[_this.property]);
|
|
228
|
+
}));
|
|
229
|
+
return this;
|
|
109
230
|
};
|
|
110
|
-
PropertyColumnModel.prototype.cellEditor = function (editor,
|
|
231
|
+
PropertyColumnModel.prototype.cellEditor = function (editor, validatorsOrInitialiser, initialiseComponent) {
|
|
111
232
|
var _this = this;
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
119
|
-
component.valueModel = formValueModel;
|
|
120
|
-
if (options === null || options === void 0 ? void 0 : options.initialiseComponent) {
|
|
121
|
-
options.initialiseComponent(component);
|
|
122
|
-
}
|
|
233
|
+
var validators = Array.isArray(validatorsOrInitialiser) ? validatorsOrInitialiser : undefined;
|
|
234
|
+
var initialiser = _.isFunction(validatorsOrInitialiser) ? validatorsOrInitialiser : initialiseComponent;
|
|
235
|
+
this.configureCellEditor(new CellEditorPortalRef(editor, function (component, editSession) {
|
|
236
|
+
var formValueModel = editSession.form.pluck(_this.property);
|
|
237
|
+
if (validators) {
|
|
238
|
+
formValueModel.validateUsing(validators);
|
|
123
239
|
}
|
|
124
|
-
|
|
240
|
+
component.valueModel = formValueModel;
|
|
241
|
+
if (initialiser) {
|
|
242
|
+
initialiser(component);
|
|
243
|
+
}
|
|
244
|
+
}));
|
|
245
|
+
return this;
|
|
246
|
+
};
|
|
247
|
+
PropertyColumnModel.prototype.format = function (formatter) {
|
|
248
|
+
assert.isFunction(formatter);
|
|
249
|
+
this._format = formatter;
|
|
125
250
|
return this;
|
|
126
251
|
};
|
|
127
252
|
return PropertyColumnModel;
|
|
128
253
|
}(ColumnModel));
|
|
129
254
|
export { PropertyColumnModel };
|
|
255
|
+
var ListPropertyColumnModel = /** @class */ (function (_super) {
|
|
256
|
+
__extends(ListPropertyColumnModel, _super);
|
|
257
|
+
function ListPropertyColumnModel(property, defaults) {
|
|
258
|
+
var _this = _super.call(this, property.toString(), defaults) || this;
|
|
259
|
+
_this.property = property;
|
|
260
|
+
_this._format = function (value) { return value.map(function (v) { return v === null || v === void 0 ? void 0 : v.toString(); }).join(', '); };
|
|
261
|
+
_this.cellRenderer(DefaultCellRendererComponent);
|
|
262
|
+
return _this;
|
|
263
|
+
}
|
|
264
|
+
ListPropertyColumnModel.prototype.cellRenderer = function (componentType) {
|
|
265
|
+
var _this = this;
|
|
266
|
+
this.configureCellRenderer(new ComponentCellRendererPortalRef(componentType, function (component, rowData) {
|
|
267
|
+
component.value = _this._format(rowData.row[_this.property]);
|
|
268
|
+
}));
|
|
269
|
+
return this;
|
|
270
|
+
};
|
|
271
|
+
ListPropertyColumnModel.prototype.cellEditor = function (editor, validatorsOrInitialiser, initialiseComponent) {
|
|
272
|
+
var _this = this;
|
|
273
|
+
var validators = Array.isArray(validatorsOrInitialiser) ? validatorsOrInitialiser : undefined;
|
|
274
|
+
var initialiser = _.isFunction(validatorsOrInitialiser) ? validatorsOrInitialiser : initialiseComponent;
|
|
275
|
+
this.configureCellEditor(new CellEditorPortalRef(editor, function (component, editSession) {
|
|
276
|
+
var formListModel = editSession.form.pluckList(_this.property);
|
|
277
|
+
if (validators) {
|
|
278
|
+
formListModel.validateUsing(validators);
|
|
279
|
+
}
|
|
280
|
+
component.listModel = formListModel;
|
|
281
|
+
if (initialiser) {
|
|
282
|
+
initialiser(component);
|
|
283
|
+
}
|
|
284
|
+
}));
|
|
285
|
+
return this;
|
|
286
|
+
};
|
|
287
|
+
ListPropertyColumnModel.prototype.format = function (formatter) {
|
|
288
|
+
assert.isFunction(formatter);
|
|
289
|
+
this._format = formatter;
|
|
290
|
+
return this;
|
|
291
|
+
};
|
|
292
|
+
return ListPropertyColumnModel;
|
|
293
|
+
}(ColumnModel));
|
|
294
|
+
export { ListPropertyColumnModel };
|
|
130
295
|
var CustomValueColumnModel = /** @class */ (function (_super) {
|
|
131
296
|
__extends(CustomValueColumnModel, _super);
|
|
132
297
|
function CustomValueColumnModel(columnId, defaults, getValue) {
|
|
@@ -137,9 +302,10 @@ var CustomValueColumnModel = /** @class */ (function (_super) {
|
|
|
137
302
|
}
|
|
138
303
|
CustomValueColumnModel.prototype.cellRenderer = function (componentType) {
|
|
139
304
|
var _this = this;
|
|
140
|
-
this.
|
|
141
|
-
component.value = _this.getValue(row);
|
|
142
|
-
});
|
|
305
|
+
this.configureCellRenderer(new ComponentCellRendererPortalRef(componentType, function (component, rowData) {
|
|
306
|
+
component.value = _this.getValue(rowData.row);
|
|
307
|
+
}));
|
|
308
|
+
return this;
|
|
143
309
|
};
|
|
144
310
|
return CustomValueColumnModel;
|
|
145
311
|
}(ColumnModel));
|
|
@@ -152,11 +318,12 @@ var EditorControlColumnModel = /** @class */ (function (_super) {
|
|
|
152
318
|
return _this;
|
|
153
319
|
}
|
|
154
320
|
EditorControlColumnModel.prototype.cellRenderer = function (componentType) {
|
|
155
|
-
this.
|
|
156
|
-
component.row = row;
|
|
157
|
-
component.editSession = editSession;
|
|
158
|
-
component.editRowCommand = editRowCommand;
|
|
159
|
-
});
|
|
321
|
+
this.configureCellRenderer(new ComponentCellRendererPortalRef(componentType, function (component, rowData) {
|
|
322
|
+
component.row = rowData.row;
|
|
323
|
+
component.editSession = rowData.editSession;
|
|
324
|
+
component.editRowCommand = rowData.editRowCommand;
|
|
325
|
+
}));
|
|
326
|
+
return this;
|
|
160
327
|
};
|
|
161
328
|
EditorControlColumnModel.prototype.getDefaultHeaderText = function () {
|
|
162
329
|
return '';
|
|
@@ -166,9 +333,15 @@ var EditorControlColumnModel = /** @class */ (function (_super) {
|
|
|
166
333
|
export { EditorControlColumnModel };
|
|
167
334
|
var CustomTemplateColumnModel = /** @class */ (function (_super) {
|
|
168
335
|
__extends(CustomTemplateColumnModel, _super);
|
|
169
|
-
function CustomTemplateColumnModel(columnId, defaults
|
|
170
|
-
|
|
336
|
+
function CustomTemplateColumnModel(columnId, defaults) {
|
|
337
|
+
var _this = _super.call(this, columnId, defaults) || this;
|
|
338
|
+
_this.config = new TemplateCellRendererPortalRef();
|
|
339
|
+
_this.configureCellRenderer(_this.config);
|
|
340
|
+
return _this;
|
|
171
341
|
}
|
|
342
|
+
CustomTemplateColumnModel.prototype.setTemplate = function (templateRef, viewContainer, fillCell, padChild) {
|
|
343
|
+
this.config.registerPortal(templateRef, viewContainer, fillCell, padChild);
|
|
344
|
+
};
|
|
172
345
|
return CustomTemplateColumnModel;
|
|
173
346
|
}(ColumnModel));
|
|
174
347
|
export { CustomTemplateColumnModel };
|
|
@@ -181,10 +354,10 @@ var SelectionColumnModel = /** @class */ (function (_super) {
|
|
|
181
354
|
component.selectionModel = selectionModel;
|
|
182
355
|
});
|
|
183
356
|
}
|
|
184
|
-
_this.
|
|
185
|
-
component.row = row;
|
|
357
|
+
_this.configureCellRenderer(new ComponentCellRendererPortalRef(SelectCellRendererComponent, function (component, rowData) {
|
|
358
|
+
component.row = rowData.row;
|
|
186
359
|
component.selectionModel = selectionModel;
|
|
187
|
-
});
|
|
360
|
+
}));
|
|
188
361
|
return _this;
|
|
189
362
|
}
|
|
190
363
|
SelectionColumnModel.prototype.getDefaultHeaderText = function () {
|
|
@@ -193,4 +366,5 @@ var SelectionColumnModel = /** @class */ (function (_super) {
|
|
|
193
366
|
return SelectionColumnModel;
|
|
194
367
|
}(ColumnModel));
|
|
195
368
|
export { SelectionColumnModel };
|
|
369
|
+
export { ɵ0 };
|
|
196
370
|
//# 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":[],"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CAAgB;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,eAAe,CAAC,2BAA2B,EAAE,UAAC,SAAS,EAAE,GAAG,EAAE,cAAc,EAAE,WAAW;YAC5F,SAAS,CAAC,GAAG,GAAG,GAAG,CAAC;YACpB,SAAS,CAAC,cAAc,GAAG,cAAc,CAAC;QAC5C,CAAC,CAAC,CAAC;;IACL,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, 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';\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): void {\n this._columnHeaderConfig = {\n portal: new ComponentPortal<C>(cellRenderer),\n initialiseComponent: initialiser\n };\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 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] }>) {\n this.setCellRenderer(componentType, (component, row) => {\n component.value = row[this.property];\n });\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\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 }>) {\n this.setCellRenderer(componentType, (component, row) => {\n component.value = this.getValue(row);\n });\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> }>) {\n this.setCellRenderer(componentType, (component, row, editRowCommand, editSession) => {\n component.row = row;\n component.editSession = editSession;\n component.editRowCommand = editRowCommand;\n });\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,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;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';\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,16 +1,41 @@
|
|
|
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
|
var ColumnTemplateDirective = /** @class */ (function () {
|
|
5
6
|
function ColumnTemplateDirective(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;
|
|
8
12
|
}
|
|
13
|
+
ColumnTemplateDirective.prototype.ngOnInit = function () {
|
|
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);
|
|
17
|
+
};
|
|
9
18
|
ColumnTemplateDirective.ctorParameters = function () { return [
|
|
10
19
|
{ type: TableComponent },
|
|
11
20
|
{ type: TemplateRef },
|
|
12
21
|
{ type: ViewContainerRef }
|
|
13
22
|
]; };
|
|
23
|
+
__decorate([
|
|
24
|
+
Input(),
|
|
25
|
+
__metadata("design:type", String)
|
|
26
|
+
], ColumnTemplateDirective.prototype, "aupColumnTemplate", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
Input(),
|
|
29
|
+
__metadata("design:type", String)
|
|
30
|
+
], ColumnTemplateDirective.prototype, "aupColumnTemplateColumnId", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
Input(),
|
|
33
|
+
__metadata("design:type", Object)
|
|
34
|
+
], ColumnTemplateDirective.prototype, "aupColumnTemplateFillCell", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
Input(),
|
|
37
|
+
__metadata("design:type", Object)
|
|
38
|
+
], ColumnTemplateDirective.prototype, "aupColumnTemplateAutoPadChild", void 0);
|
|
14
39
|
ColumnTemplateDirective = __decorate([
|
|
15
40
|
Directive({
|
|
16
41
|
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;IAcE,iCAAqB,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,0CAAQ,GAAR;;QACE,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;;gBAZ0B,cAAc;gBACR,WAAW;gBACT,gBAAgB;;IAbnD;QADC,KAAK,EAAE;;sEACkB;IAG1B;QADC,KAAK,EAAE;;8EAC0B;IAGlC;QADC,KAAK,EAAE;;8EAC0B;IAGlC;QADC,KAAK,EAAE;;kFACkC;IAZ/B,uBAAuB;QAHnC,SAAS,CAAC;YACT,QAAQ,EAAE,qBAAqB;SAChC,CAAC;yCAe2B,cAAc;YACR,WAAW;YACT,gBAAgB;OAhBxC,uBAAuB,CA4BnC;IAAD,8BAAC;CAAA,AA5BD,IA4BC;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"]}
|
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
import { __extends } from "tslib";
|
|
2
|
-
import {
|
|
2
|
+
import { GarbageCollector, MutableValueModel } from '@coolon/pectin';
|
|
3
3
|
import produce from 'immer';
|
|
4
4
|
var EditSession = /** @class */ (function (_super) {
|
|
5
5
|
__extends(EditSession, _super);
|
|
6
|
-
function EditSession(rowId, row, saveCommand) {
|
|
6
|
+
function EditSession(rowId, row, form, saveCommand) {
|
|
7
7
|
var _this = _super.call(this) || this;
|
|
8
8
|
_this.rowId = rowId;
|
|
9
|
+
_this.form = form;
|
|
9
10
|
_this.saveCommand = saveCommand;
|
|
10
|
-
_this.
|
|
11
|
-
_this.
|
|
12
|
-
_this.form = new Form();
|
|
11
|
+
_this._liveRowValue = new MutableValueModel();
|
|
12
|
+
_this.liveRowValue = _this._liveRowValue.readonly;
|
|
13
13
|
_this.form.load(row);
|
|
14
|
-
_this.
|
|
14
|
+
_this._liveRowValue.value = row;
|
|
15
15
|
_this.form.onEdit(function () {
|
|
16
|
-
|
|
16
|
+
// if (!this._liveRowValue.value[immerable]) {
|
|
17
|
+
// console.warn()
|
|
18
|
+
// }
|
|
19
|
+
_this._liveRowValue.value = produce(_this._liveRowValue.value, function (draft) {
|
|
17
20
|
_this.form.writeDirtyStateTo(draft);
|
|
18
21
|
});
|
|
19
22
|
});
|
|
@@ -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;IAAsC,+BAAgB;IAIpD,qBAAqB,KAAU,EAAE,GAAQ,EAAW,IAAe,EAAW,WAA6C;QAA3H,YACE,iBAAO,SAWR;QAZoB,WAAK,GAAL,KAAK,CAAK;QAAqB,UAAI,GAAJ,IAAI,CAAW;QAAW,iBAAW,GAAX,WAAW,CAAkC;QAHnH,mBAAa,GAAG,IAAI,iBAAiB,EAAO,CAAC;QAC5C,kBAAY,GAAG,KAAI,CAAC,aAAa,CAAC,QAAQ,CAAC;QAIlD,KAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACpB,KAAI,CAAC,aAAa,CAAC,KAAK,GAAG,GAAG,CAAC;QAC/B,KAAI,CAAC,IAAI,CAAC,MAAM,CAAC;YACf,8CAA8C;YAC9C,mBAAmB;YACnB,IAAI;YACJ,KAAI,CAAC,aAAa,CAAC,KAAK,GAAG,OAAO,CAAC,KAAI,CAAC,aAAa,CAAC,KAAK,EAAE,UAAA,KAAK;gBAChE,KAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,KAAyB,CAAC,CAAC;YACzD,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;;IACL,CAAC;IACH,kBAAC;AAAD,CAAC,AAjBD,CAAsC,gBAAgB,GAiBrD","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"]}
|
|
@@ -11,28 +11,13 @@ var SelectCellRendererComponent = /** @class */ (function (_super) {
|
|
|
11
11
|
});
|
|
12
12
|
return _this;
|
|
13
13
|
}
|
|
14
|
-
Object.defineProperty(SelectCellRendererComponent.prototype, "row", {
|
|
15
|
-
get: function () {
|
|
16
|
-
return this._row;
|
|
17
|
-
},
|
|
18
|
-
set: function (value) {
|
|
19
|
-
this._row = value;
|
|
20
|
-
},
|
|
21
|
-
enumerable: true,
|
|
22
|
-
configurable: true
|
|
23
|
-
});
|
|
24
14
|
SelectCellRendererComponent.prototype.isSelected = function () {
|
|
25
15
|
return this.selectionModel.isSelected(this.row);
|
|
26
16
|
};
|
|
27
|
-
__decorate([
|
|
28
|
-
Input(),
|
|
29
|
-
__metadata("design:type", Object),
|
|
30
|
-
__metadata("design:paramtypes", [Object])
|
|
31
|
-
], SelectCellRendererComponent.prototype, "row", null);
|
|
32
17
|
__decorate([
|
|
33
18
|
Input(),
|
|
34
19
|
__metadata("design:type", Object)
|
|
35
|
-
], SelectCellRendererComponent.prototype, "
|
|
20
|
+
], SelectCellRendererComponent.prototype, "row", void 0);
|
|
36
21
|
SelectCellRendererComponent = __decorate([
|
|
37
22
|
Component({
|
|
38
23
|
selector: 'aup-select-cell-renderer',
|