@coolon/angular-ui-powerups 1.10.0 → 1.11.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 +14 -0
- package/assets/styles.scss +7 -67
- package/bundles/coolon-angular-ui-powerups.umd.js +2649 -1623
- 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 +57 -44
- package/coolon-angular-ui-powerups.metadata.json +1 -1
- package/esm2015/coolon-angular-ui-powerups.js +55 -42
- 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 +37 -6
- 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-activity.js +47 -0
- package/esm2015/lib/components/forms/abstract-input-activity.js.map +1 -0
- package/esm2015/lib/components/forms/abstract-input-activity.metadata.json +1 -0
- package/esm2015/lib/components/forms/abstract-input-activity.ngfactory.js.map +1 -0
- package/esm2015/lib/components/forms/abstract-input.component.js +6 -1
- 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/number-input/number-input.component.js +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 +1 -1
- package/esm2015/lib/components/forms/password-input/password-input.component.metadata.json +1 -1
- package/esm2015/lib/components/forms/string-input/string-input-activity.js +22 -0
- package/esm2015/lib/components/forms/string-input/string-input-activity.js.map +1 -0
- package/esm2015/lib/components/forms/string-input/string-input-activity.metadata.json +1 -0
- package/esm2015/lib/components/forms/string-input/string-input-activity.ngfactory.js.map +1 -0
- package/esm2015/lib/components/forms/string-input/string-input.component.js +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 +1 -1
- package/esm2015/lib/components/forms/text-input/text-input.component.metadata.json +1 -1
- package/esm2015/lib/components/index.js +13 -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-editor.component.js +1 -0
- package/esm2015/lib/components/table/cell-editor.component.js.map +1 -0
- package/esm2015/lib/components/table/cell-editor.component.metadata.json +1 -0
- package/esm2015/lib/components/table/cell-renderer.js +1 -0
- package/esm2015/lib/components/table/cell-renderer.js.map +1 -0
- package/esm2015/lib/components/table/cell-renderer.metadata.json +1 -0
- package/esm2015/lib/components/table/column-model.js +160 -0
- package/esm2015/lib/components/table/column-model.js.map +1 -0
- package/esm2015/lib/components/table/column-model.metadata.json +1 -0
- package/esm2015/lib/components/table/column-template/column-template.directive.js +24 -0
- package/esm2015/lib/components/table/column-template/column-template.directive.js.map +1 -0
- package/esm2015/lib/components/table/column-template/column-template.directive.metadata.json +1 -0
- package/esm2015/lib/components/table/column-template/column-template.directive.ngfactory.js.map +1 -0
- package/esm2015/lib/components/table/column-text-properties.js +1 -0
- package/esm2015/lib/components/table/column-text-properties.js.map +1 -0
- package/esm2015/lib/components/table/column-text-properties.metadata.json +1 -0
- package/esm2015/lib/components/table/default-cell-renderer/default-cell-renderer.component.js +27 -0
- package/esm2015/lib/components/table/default-cell-renderer/default-cell-renderer.component.js.map +1 -0
- package/esm2015/lib/components/table/default-cell-renderer/default-cell-renderer.component.metadata.json +1 -0
- package/esm2015/lib/components/table/default-cell-renderer/default-cell-renderer.component.ngfactory.js.map +1 -0
- package/esm2015/lib/components/table/default-cell-renderer/default-cell-renderer.component.scss.shim.ngstyle.js.map +1 -0
- package/esm2015/lib/components/table/default-header-cell-renderer/default-header-cell-renderer.component.js +21 -0
- package/esm2015/lib/components/table/default-header-cell-renderer/default-header-cell-renderer.component.js.map +1 -0
- package/esm2015/lib/components/table/default-header-cell-renderer/default-header-cell-renderer.component.metadata.json +1 -0
- package/esm2015/lib/components/table/default-header-cell-renderer/default-header-cell-renderer.component.ngfactory.js.map +1 -0
- package/esm2015/lib/components/table/default-header-cell-renderer/default-header-cell-renderer.component.scss.shim.ngstyle.js.map +1 -0
- package/esm2015/lib/components/table/edit-row-controls/edit-row-controls.component.js +50 -0
- package/esm2015/lib/components/table/edit-row-controls/edit-row-controls.component.js.map +1 -0
- package/esm2015/lib/components/table/edit-row-controls/edit-row-controls.component.metadata.json +1 -0
- package/esm2015/lib/components/table/edit-row-controls/edit-row-controls.component.ngfactory.js.map +1 -0
- package/esm2015/lib/components/table/edit-row-controls/edit-row-controls.component.scss.shim.ngstyle.js.map +1 -0
- package/esm2015/lib/components/table/select-cell-renderer/select-cell-renderer.component.js +40 -0
- package/esm2015/lib/components/table/select-cell-renderer/select-cell-renderer.component.js.map +1 -0
- package/esm2015/lib/components/table/select-cell-renderer/select-cell-renderer.component.metadata.json +1 -0
- package/esm2015/lib/components/table/select-cell-renderer/select-cell-renderer.component.ngfactory.js.map +1 -0
- package/esm2015/lib/components/table/select-cell-renderer/select-cell-renderer.component.scss.shim.ngstyle.js.map +1 -0
- package/esm2015/lib/components/table/select-header-cell-renderer/select-header-cell-renderer.component.js +32 -0
- package/esm2015/lib/components/table/select-header-cell-renderer/select-header-cell-renderer.component.js.map +1 -0
- package/esm2015/lib/components/table/select-header-cell-renderer/select-header-cell-renderer.component.metadata.json +1 -0
- package/esm2015/lib/components/table/select-header-cell-renderer/select-header-cell-renderer.component.ngfactory.js.map +1 -0
- package/esm2015/lib/components/table/select-header-cell-renderer/select-header-cell-renderer.component.scss.shim.ngstyle.js.map +1 -0
- package/esm2015/lib/components/table/table-cell-renderer/table-cell-renderer.component.js +64 -0
- package/esm2015/lib/components/table/table-cell-renderer/table-cell-renderer.component.js.map +1 -0
- package/esm2015/lib/components/table/table-cell-renderer/table-cell-renderer.component.metadata.json +1 -0
- package/esm2015/lib/components/table/table-cell-renderer/table-cell-renderer.component.ngfactory.js.map +1 -0
- package/esm2015/lib/components/table/table-cell-renderer/table-cell-renderer.component.scss.shim.ngstyle.js.map +1 -0
- package/esm2015/lib/components/table/table-def.js +1 -0
- package/esm2015/lib/components/table/table-def.js.map +1 -0
- package/esm2015/lib/components/table/table-def.metadata.json +1 -0
- package/esm2015/lib/components/table/table-header-cell-renderer/table-header-cell-renderer.component.js +32 -0
- package/esm2015/lib/components/table/table-header-cell-renderer/table-header-cell-renderer.component.js.map +1 -0
- package/esm2015/lib/components/table/table-header-cell-renderer/table-header-cell-renderer.component.metadata.json +1 -0
- package/esm2015/lib/components/table/table-header-cell-renderer/table-header-cell-renderer.component.ngfactory.js.map +1 -0
- package/esm2015/lib/components/table/table-header-cell-renderer/table-header-cell-renderer.component.scss.shim.ngstyle.js.map +1 -0
- package/esm2015/lib/components/table/table-model.js +197 -0
- package/esm2015/lib/components/table/table-model.js.map +1 -0
- package/esm2015/lib/components/table/table-model.metadata.json +1 -0
- package/esm2015/lib/components/table/table.component.js +60 -0
- package/esm2015/lib/components/table/table.component.js.map +1 -0
- package/esm2015/lib/components/table/table.component.metadata.json +1 -0
- package/esm2015/lib/components/table/table.component.ngfactory.js.map +1 -0
- package/esm2015/lib/components/table/table.component.scss.shim.ngstyle.js.map +1 -0
- package/esm2015/lib/interaction/activity.js +7 -1
- package/esm2015/lib/interaction/activity.js.map +1 -1
- package/esm2015/lib/interaction/activity.metadata.json +1 -1
- package/esm2015/lib/interaction/components/popup-interaction-context/popup-interaction-context.component.js +87 -0
- package/esm2015/lib/interaction/components/popup-interaction-context/popup-interaction-context.component.js.map +1 -0
- package/esm2015/lib/interaction/components/popup-interaction-context/popup-interaction-context.component.metadata.json +1 -0
- package/esm2015/lib/interaction/components/popup-interaction-context/popup-interaction-context.component.ngfactory.js.map +1 -0
- package/esm2015/lib/interaction/components/popup-interaction-context/popup-interaction-context.component.scss.shim.ngstyle.js.map +1 -0
- package/esm2015/lib/interaction/directives/interaction-context-trigger-for.directive.js +86 -0
- package/esm2015/lib/interaction/directives/interaction-context-trigger-for.directive.js.map +1 -0
- package/esm2015/lib/interaction/directives/interaction-context-trigger-for.directive.metadata.json +1 -0
- package/esm2015/lib/interaction/directives/interaction-context-trigger-for.directive.ngfactory.js.map +1 -0
- package/esm2015/lib/interaction/index.js +2 -0
- package/esm2015/lib/interaction/index.js.map +1 -1
- package/esm2015/lib/interaction/index.metadata.json +1 -1
- package/esm2015/lib/interaction/interaction.module.js +12 -3
- package/esm2015/lib/interaction/interaction.module.js.map +1 -1
- package/esm2015/lib/interaction/interaction.module.metadata.json +1 -1
- package/esm2015/lib/interaction/interaction.module.ngfactory.js.map +1 -1
- package/esm5/coolon-angular-ui-powerups.js +55 -42
- 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 +37 -6
- 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-activity.js +50 -0
- package/esm5/lib/components/forms/abstract-input-activity.js.map +1 -0
- package/esm5/lib/components/forms/abstract-input-activity.ngfactory.js.map +1 -0
- package/esm5/lib/components/forms/abstract-input.component.js +6 -1
- package/esm5/lib/components/forms/abstract-input.component.js.map +1 -1
- package/esm5/lib/components/forms/number-input/number-input.component.js +1 -1
- package/esm5/lib/components/forms/password-input/password-input.component.js +1 -1
- package/esm5/lib/components/forms/string-input/string-input-activity.js +18 -0
- package/esm5/lib/components/forms/string-input/string-input-activity.js.map +1 -0
- package/esm5/lib/components/forms/string-input/string-input-activity.ngfactory.js.map +1 -0
- package/esm5/lib/components/forms/string-input/string-input.component.js +1 -1
- package/esm5/lib/components/forms/text-input/text-input.component.js +1 -1
- package/esm5/lib/components/index.js +13 -0
- package/esm5/lib/components/index.js.map +1 -1
- package/esm5/lib/components/table/cell-editor.component.js +1 -0
- package/esm5/lib/components/table/cell-editor.component.js.map +1 -0
- package/esm5/lib/components/table/cell-renderer.js +1 -0
- package/esm5/lib/components/table/cell-renderer.js.map +1 -0
- package/esm5/lib/components/table/column-model.js +196 -0
- package/esm5/lib/components/table/column-model.js.map +1 -0
- package/esm5/lib/components/table/column-template/column-template.directive.js +25 -0
- package/esm5/lib/components/table/column-template/column-template.directive.js.map +1 -0
- package/esm5/lib/components/table/column-template/column-template.directive.ngfactory.js.map +1 -0
- package/esm5/lib/components/table/column-text-properties.js +1 -0
- package/esm5/lib/components/table/column-text-properties.js.map +1 -0
- package/esm5/lib/components/table/default-cell-renderer/default-cell-renderer.component.js +32 -0
- package/esm5/lib/components/table/default-cell-renderer/default-cell-renderer.component.js.map +1 -0
- package/esm5/lib/components/table/default-cell-renderer/default-cell-renderer.component.ngfactory.js.map +1 -0
- package/esm5/lib/components/table/default-cell-renderer/default-cell-renderer.component.scss.shim.ngstyle.js.map +1 -0
- package/esm5/lib/components/table/default-header-cell-renderer/default-header-cell-renderer.component.js +22 -0
- package/esm5/lib/components/table/default-header-cell-renderer/default-header-cell-renderer.component.js.map +1 -0
- package/esm5/lib/components/table/default-header-cell-renderer/default-header-cell-renderer.component.ngfactory.js.map +1 -0
- package/esm5/lib/components/table/default-header-cell-renderer/default-header-cell-renderer.component.scss.shim.ngstyle.js.map +1 -0
- package/esm5/lib/components/table/edit-row-controls/edit-row-controls.component.js +57 -0
- package/esm5/lib/components/table/edit-row-controls/edit-row-controls.component.js.map +1 -0
- package/esm5/lib/components/table/edit-row-controls/edit-row-controls.component.ngfactory.js.map +1 -0
- package/esm5/lib/components/table/edit-row-controls/edit-row-controls.component.scss.shim.ngstyle.js.map +1 -0
- package/esm5/lib/components/table/select-cell-renderer/select-cell-renderer.component.js +47 -0
- package/esm5/lib/components/table/select-cell-renderer/select-cell-renderer.component.js.map +1 -0
- package/esm5/lib/components/table/select-cell-renderer/select-cell-renderer.component.ngfactory.js.map +1 -0
- package/esm5/lib/components/table/select-cell-renderer/select-cell-renderer.component.scss.shim.ngstyle.js.map +1 -0
- package/esm5/lib/components/table/select-header-cell-renderer/select-header-cell-renderer.component.js +35 -0
- package/esm5/lib/components/table/select-header-cell-renderer/select-header-cell-renderer.component.js.map +1 -0
- package/esm5/lib/components/table/select-header-cell-renderer/select-header-cell-renderer.component.ngfactory.js.map +1 -0
- package/esm5/lib/components/table/select-header-cell-renderer/select-header-cell-renderer.component.scss.shim.ngstyle.js.map +1 -0
- package/esm5/lib/components/table/table-cell-renderer/table-cell-renderer.component.js +66 -0
- package/esm5/lib/components/table/table-cell-renderer/table-cell-renderer.component.js.map +1 -0
- package/esm5/lib/components/table/table-cell-renderer/table-cell-renderer.component.ngfactory.js.map +1 -0
- package/esm5/lib/components/table/table-cell-renderer/table-cell-renderer.component.scss.shim.ngstyle.js.map +1 -0
- package/esm5/lib/components/table/table-def.js +1 -0
- package/esm5/lib/components/table/table-def.js.map +1 -0
- package/esm5/lib/components/table/table-header-cell-renderer/table-header-cell-renderer.component.js +33 -0
- package/esm5/lib/components/table/table-header-cell-renderer/table-header-cell-renderer.component.js.map +1 -0
- package/esm5/lib/components/table/table-header-cell-renderer/table-header-cell-renderer.component.ngfactory.js.map +1 -0
- package/esm5/lib/components/table/table-header-cell-renderer/table-header-cell-renderer.component.scss.shim.ngstyle.js.map +1 -0
- package/esm5/lib/components/table/table-model.js +213 -0
- package/esm5/lib/components/table/table-model.js.map +1 -0
- package/esm5/lib/components/table/table.component.js +62 -0
- package/esm5/lib/components/table/table.component.js.map +1 -0
- package/esm5/lib/components/table/table.component.ngfactory.js.map +1 -0
- package/esm5/lib/components/table/table.component.scss.shim.ngstyle.js.map +1 -0
- package/esm5/lib/interaction/activity.js +7 -2
- package/esm5/lib/interaction/activity.js.map +1 -1
- package/esm5/lib/interaction/components/popup-interaction-context/popup-interaction-context.component.js +95 -0
- package/esm5/lib/interaction/components/popup-interaction-context/popup-interaction-context.component.js.map +1 -0
- package/esm5/lib/interaction/components/popup-interaction-context/popup-interaction-context.component.ngfactory.js.map +1 -0
- package/esm5/lib/interaction/components/popup-interaction-context/popup-interaction-context.component.scss.shim.ngstyle.js.map +1 -0
- package/esm5/lib/interaction/directives/interaction-context-trigger-for.directive.js +90 -0
- package/esm5/lib/interaction/directives/interaction-context-trigger-for.directive.js.map +1 -0
- package/esm5/lib/interaction/directives/interaction-context-trigger-for.directive.ngfactory.js.map +1 -0
- package/esm5/lib/interaction/index.js +2 -0
- package/esm5/lib/interaction/index.js.map +1 -1
- package/esm5/lib/interaction/interaction.module.js +12 -3
- package/esm5/lib/interaction/interaction.module.js.map +1 -1
- package/esm5/lib/interaction/interaction.module.ngfactory.js.map +1 -1
- package/fesm2015/coolon-angular-ui-powerups.js +2280 -1372
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/fesm5/coolon-angular-ui-powerups.js +2561 -1567
- package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
- package/lib/components/forms/abstract-input-activity.d.ts +18 -0
- package/lib/components/forms/abstract-input.component.d.ts +1 -0
- package/lib/components/forms/string-input/string-input-activity.d.ts +3 -0
- package/lib/components/index.d.ts +17 -0
- package/lib/components/table/cell-editor.component.d.ts +5 -0
- package/lib/components/table/cell-renderer.d.ts +3 -0
- package/lib/components/table/column-model.d.ts +84 -0
- package/lib/components/table/column-template/column-template.directive.d.ts +7 -0
- package/lib/components/table/column-text-properties.d.ts +3 -0
- package/lib/components/table/default-cell-renderer/default-cell-renderer.component.d.ts +6 -0
- package/lib/components/table/default-header-cell-renderer/default-header-cell-renderer.component.d.ts +5 -0
- package/lib/components/table/edit-row-controls/edit-row-controls.component.d.ts +14 -0
- package/lib/components/table/select-cell-renderer/select-cell-renderer.component.d.ts +11 -0
- package/lib/components/table/select-header-cell-renderer/select-header-cell-renderer.component.d.ts +9 -0
- package/lib/components/table/table-cell-renderer/table-cell-renderer.component.d.ts +18 -0
- package/lib/components/table/table-def.d.ts +7 -0
- package/lib/components/table/table-header-cell-renderer/table-header-cell-renderer.component.d.ts +8 -0
- package/lib/components/table/table-model.d.ts +114 -0
- package/lib/components/table/table.component.d.ts +40 -0
- package/lib/interaction/activity.d.ts +1 -0
- package/lib/interaction/components/popup-interaction-context/popup-interaction-context.component.d.ts +21 -0
- package/lib/interaction/directives/interaction-context-trigger-for.directive.d.ts +17 -0
- package/lib/interaction/index.d.ts +2 -0
- package/package.json +3 -2
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { __decorate, __extends, __metadata } from "tslib";
|
|
2
|
+
import { Component, Input } from '@angular/core';
|
|
3
|
+
import { Command, TrackExternal } from '@coolon/pectin';
|
|
4
|
+
import { DisposableComponent } from '../../disposable-component';
|
|
5
|
+
import { TableModel } from '../table-model';
|
|
6
|
+
var EditRowControls = /** @class */ (function (_super) {
|
|
7
|
+
__extends(EditRowControls, _super);
|
|
8
|
+
function EditRowControls() {
|
|
9
|
+
var _this = _super.call(this) || this;
|
|
10
|
+
_this.saveCommand = Command.create(function () {
|
|
11
|
+
_this.editSession.saveCommand.execute(_this.editSession.form)
|
|
12
|
+
.then(function (finished) {
|
|
13
|
+
if (finished) {
|
|
14
|
+
_this.editSession.dispose();
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
_this.cancelCommand = Command.create(function () {
|
|
19
|
+
_this.editSession.dispose();
|
|
20
|
+
});
|
|
21
|
+
return _this;
|
|
22
|
+
}
|
|
23
|
+
EditRowControls.prototype.ngOnInit = function () {
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(EditRowControls.prototype, "form", {
|
|
26
|
+
get: function () {
|
|
27
|
+
var _a;
|
|
28
|
+
return (_a = this.editSession) === null || _a === void 0 ? void 0 : _a.form;
|
|
29
|
+
},
|
|
30
|
+
enumerable: true,
|
|
31
|
+
configurable: true
|
|
32
|
+
});
|
|
33
|
+
__decorate([
|
|
34
|
+
Input(),
|
|
35
|
+
__metadata("design:type", Object)
|
|
36
|
+
], EditRowControls.prototype, "row", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
Input(),
|
|
39
|
+
TrackExternal(),
|
|
40
|
+
__metadata("design:type", Command)
|
|
41
|
+
], EditRowControls.prototype, "editRowCommand", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
Input(),
|
|
44
|
+
__metadata("design:type", TableModel.EditSession)
|
|
45
|
+
], EditRowControls.prototype, "editSession", void 0);
|
|
46
|
+
EditRowControls = __decorate([
|
|
47
|
+
Component({
|
|
48
|
+
selector: 'aup-row-editor-controls',
|
|
49
|
+
template: "<button *ngIf=\"!editSession\" mat-icon-button [pectinCommand]=\"editRowCommand\" class=\"edit-button\"><mat-icon>edit</mat-icon></button>\n<button *ngIf=\"editSession\" mat-icon-button [pectinCommand]=\"saveCommand\"><mat-icon>done</mat-icon></button>\n<button *ngIf=\"editSession\" mat-icon-button [pectinCommand]=\"cancelCommand\"><mat-icon>clear</mat-icon></button>\n",
|
|
50
|
+
styles: [":host{display:block;width:80px}.edit-button{visibility:hidden}:host-context(tr:hover) .edit-button{visibility:visible}"]
|
|
51
|
+
}),
|
|
52
|
+
__metadata("design:paramtypes", [])
|
|
53
|
+
], EditRowControls);
|
|
54
|
+
return EditRowControls;
|
|
55
|
+
}(DisposableComponent));
|
|
56
|
+
export { EditRowControls };
|
|
57
|
+
//# sourceMappingURL=edit-row-controls.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edit-row-controls.component.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/components/table/edit-row-controls/edit-row-controls.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAoC,MAAM,eAAe,CAAC;AACnF,OAAO,EAAE,OAAO,EAAe,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAO5C;IAA0C,mCAAmB;IAe3D;QAAA,YACE,iBAAO,SAYR;QAXC,KAAI,CAAC,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC;YAChC,KAAI,CAAC,WAAW,CAAC,WAAW,CAAC,OAAO,CAAC,KAAI,CAAC,WAAW,CAAC,IAAI,CAAC;iBACxD,IAAI,CAAC,UAAC,QAAQ;gBACb,IAAI,QAAQ,EAAE;oBACZ,KAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;iBAC5B;YACH,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;QACH,KAAI,CAAC,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC;YAClC,KAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;QAC7B,CAAC,CAAC,CAAC;;IACL,CAAC;IAED,kCAAQ,GAAR;IACA,CAAC;IAED,sBAAI,iCAAI;aAAR;;YACE,aAAO,IAAI,CAAC,WAAW,0CAAE,IAAI,CAAC;QAChC,CAAC;;;OAAA;IAhCD;QADC,KAAK,EAAE;;gDACA;IAIR;QAFC,KAAK,EAAE;QACP,aAAa,EAAE;kCACA,OAAO;2DAAM;IAG7B;QADC,KAAK,EAAE;kCACK,UAAU,CAAC,WAAW;wDAAM;IAV9B,eAAe;QAL3B,SAAS,CAAC;YACT,QAAQ,EAAE,yBAAyB;YACnC,+XAAiD;;SAElD,CAAC;;OACW,eAAe,CAqC3B;IAAD,sBAAC;CAAA,AArCD,CAA0C,mBAAmB,GAqC5D;SArCY,eAAe","sourcesContent":["import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core';\nimport { Command, Form, Trace, TrackExternal } from '@coolon/pectin';\nimport { DisposableComponent } from '../../disposable-component';\nimport { TableModel } from '../table-model';\n\n@Component({\n selector: 'aup-row-editor-controls',\n templateUrl: './edit-row-controls.component.html',\n styleUrls: ['./edit-row-controls.component.scss']\n})\nexport class EditRowControls<Row> extends DisposableComponent implements OnInit {\n\n @Input()\n row: Row\n\n @Input()\n @TrackExternal()\n editRowCommand: Command<void>\n\n @Input()\n editSession: TableModel.EditSession<Row>;\n\n readonly saveCommand: Command<void>;\n readonly cancelCommand: Command<void>;\n\n constructor() {\n super();\n this.saveCommand = Command.create(() => {\n this.editSession.saveCommand.execute(this.editSession.form)\n .then((finished) => {\n if (finished) {\n this.editSession.dispose();\n }\n });\n });\n this.cancelCommand = Command.create(() => {\n this.editSession.dispose();\n });\n }\n\n ngOnInit(): void {\n }\n\n get form(): Form<Row> {\n return this.editSession?.form;\n }\n\n}\n"]}
|
package/esm5/lib/components/table/edit-row-controls/edit-row-controls.component.ngfactory.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edit-row-controls.component.ngfactory.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/components/table/edit-row-controls/edit-row-controls.component.ngfactory.ts"],"names":[],"mappings":"","sourcesContent":["import * as i0 from '@angular/core';\ni0.ComponentFactory;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edit-row-controls.component.scss.shim.ngstyle.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/components/table/edit-row-controls/edit-row-controls.component.scss.shim.ngstyle.ts"],"names":[],"mappings":"","sourcesContent":["import * as i0 from '@angular/core';\ni0.ComponentFactory;\n"]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { __decorate, __extends, __metadata } from "tslib";
|
|
2
|
+
import { Component, Input } from '@angular/core';
|
|
3
|
+
import { Command } from '@coolon/pectin';
|
|
4
|
+
import { DisposableComponent } from '../../disposable-component';
|
|
5
|
+
var SelectCellRendererComponent = /** @class */ (function (_super) {
|
|
6
|
+
__extends(SelectCellRendererComponent, _super);
|
|
7
|
+
function SelectCellRendererComponent() {
|
|
8
|
+
var _this = _super.call(this) || this;
|
|
9
|
+
_this.selectCommand = Command.create(function () {
|
|
10
|
+
_this.selectionModel.selectCommand.execute(_this.row);
|
|
11
|
+
});
|
|
12
|
+
return _this;
|
|
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
|
+
SelectCellRendererComponent.prototype.isSelected = function () {
|
|
25
|
+
return this.selectionModel.isSelected(this.row);
|
|
26
|
+
};
|
|
27
|
+
__decorate([
|
|
28
|
+
Input(),
|
|
29
|
+
__metadata("design:type", Object),
|
|
30
|
+
__metadata("design:paramtypes", [Object])
|
|
31
|
+
], SelectCellRendererComponent.prototype, "row", null);
|
|
32
|
+
__decorate([
|
|
33
|
+
Input(),
|
|
34
|
+
__metadata("design:type", Object)
|
|
35
|
+
], SelectCellRendererComponent.prototype, "selectionModel", void 0);
|
|
36
|
+
SelectCellRendererComponent = __decorate([
|
|
37
|
+
Component({
|
|
38
|
+
selector: 'aup-select-cell-renderer',
|
|
39
|
+
template: "<mat-checkbox [pectinCommand]=\"selectCommand\" [checked]=\"isSelected()\"></mat-checkbox>\n",
|
|
40
|
+
styles: [""]
|
|
41
|
+
}),
|
|
42
|
+
__metadata("design:paramtypes", [])
|
|
43
|
+
], SelectCellRendererComponent);
|
|
44
|
+
return SelectCellRendererComponent;
|
|
45
|
+
}(DisposableComponent));
|
|
46
|
+
export { SelectCellRendererComponent };
|
|
47
|
+
//# sourceMappingURL=select-cell-renderer.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select-cell-renderer.component.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/components/table/select-cell-renderer/select-cell-renderer.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAE,OAAO,EAAkB,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAOjE;IAAsD,+CAAmB;IAgBvE;QAAA,YACE,iBAAO,SAIR;QAHC,KAAI,CAAC,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC;YAClC,KAAI,CAAC,cAAc,CAAC,aAAa,CAAC,OAAO,CAAC,KAAI,CAAC,GAAG,CAAC,CAAC;QACtD,CAAC,CAAC,CAAC;;IACL,CAAC;IAhBD,sBAAI,4CAAG;aAIP;YACE,OAAO,IAAI,CAAC,IAAI,CAAC;QACnB,CAAC;aAND,UAAQ,KAAU;YAChB,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;QACpB,CAAC;;;OAAA;IAgBD,gDAAU,GAAV;QACE,OAAO,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAClD,CAAC;IApBD;QADC,KAAK,EAAE;;;0DAGP;IAOD;QADC,KAAK,EAAE;;uEAC4B;IAdzB,2BAA2B;QALvC,SAAS,CAAC;YACT,QAAQ,EAAE,0BAA0B;YACpC,wGAAoD;;SAErD,CAAC;;OACW,2BAA2B,CA0BvC;IAAD,kCAAC;CAAA,AA1BD,CAAsD,mBAAmB,GA0BxE;SA1BY,2BAA2B","sourcesContent":["import { Component, Input } from '@angular/core';\n\nimport { Command, SelectionModel } from '@coolon/pectin';\nimport { DisposableComponent } from '../../disposable-component';\n\n@Component({\n selector: 'aup-select-cell-renderer',\n templateUrl: './select-cell-renderer.component.html',\n styleUrls: ['./select-cell-renderer.component.scss']\n})\nexport class SelectCellRendererComponent<Row> extends DisposableComponent {\n private _row: Row;\n readonly selectCommand: Command<void>;\n\n @Input()\n set row(value: Row) {\n this._row = value;\n }\n\n get row(): Row {\n return this._row;\n }\n\n @Input()\n selectionModel: SelectionModel<Row>;\n\n constructor() {\n super();\n this.selectCommand = Command.create(() => {\n this.selectionModel.selectCommand.execute(this.row);\n });\n }\n\n isSelected(): boolean {\n return this.selectionModel.isSelected(this.row);\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select-cell-renderer.component.ngfactory.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/components/table/select-cell-renderer/select-cell-renderer.component.ngfactory.ts"],"names":[],"mappings":"","sourcesContent":["import * as i0 from '@angular/core';\ni0.ComponentFactory;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select-cell-renderer.component.scss.shim.ngstyle.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/components/table/select-cell-renderer/select-cell-renderer.component.scss.shim.ngstyle.ts"],"names":[],"mappings":"","sourcesContent":["import * as i0 from '@angular/core';\ni0.ComponentFactory;\n"]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { __decorate, __extends, __metadata } from "tslib";
|
|
2
|
+
import { Component, Input } from '@angular/core';
|
|
3
|
+
import { Command, MultipleSelectionModel } from '@coolon/pectin';
|
|
4
|
+
import { DisposableComponent } from '../../disposable-component';
|
|
5
|
+
var SelectHeaderCellRendererComponent = /** @class */ (function (_super) {
|
|
6
|
+
__extends(SelectHeaderCellRendererComponent, _super);
|
|
7
|
+
function SelectHeaderCellRendererComponent() {
|
|
8
|
+
var _this = _super.call(this) || this;
|
|
9
|
+
_this.selectCommand = Command.create(function () {
|
|
10
|
+
_this.selectionModel.toggleAllCommand.execute();
|
|
11
|
+
});
|
|
12
|
+
return _this;
|
|
13
|
+
}
|
|
14
|
+
SelectHeaderCellRendererComponent.prototype.isSelected = function () {
|
|
15
|
+
return this.selectionModel.allSelected.value;
|
|
16
|
+
};
|
|
17
|
+
SelectHeaderCellRendererComponent.prototype.isIntermediate = function () {
|
|
18
|
+
return this.selectionModel.someSelected.value;
|
|
19
|
+
};
|
|
20
|
+
__decorate([
|
|
21
|
+
Input(),
|
|
22
|
+
__metadata("design:type", MultipleSelectionModel)
|
|
23
|
+
], SelectHeaderCellRendererComponent.prototype, "selectionModel", void 0);
|
|
24
|
+
SelectHeaderCellRendererComponent = __decorate([
|
|
25
|
+
Component({
|
|
26
|
+
selector: 'aup-select-header-cell-renderer',
|
|
27
|
+
template: "<mat-checkbox [pectinCommand]=\"selectCommand\" [checked]=\"isSelected()\" [indeterminate]=\"this.isIntermediate()\"></mat-checkbox>\n",
|
|
28
|
+
styles: [""]
|
|
29
|
+
}),
|
|
30
|
+
__metadata("design:paramtypes", [])
|
|
31
|
+
], SelectHeaderCellRendererComponent);
|
|
32
|
+
return SelectHeaderCellRendererComponent;
|
|
33
|
+
}(DisposableComponent));
|
|
34
|
+
export { SelectHeaderCellRendererComponent };
|
|
35
|
+
//# sourceMappingURL=select-header-cell-renderer.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select-header-cell-renderer.component.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/components/table/select-header-cell-renderer/select-header-cell-renderer.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAE,OAAO,EAAE,sBAAsB,EAAkB,MAAM,gBAAgB,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAOjE;IAA4D,qDAAmB;IAM7E;QAAA,YACE,iBAAO,SAIR;QAHC,KAAI,CAAC,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC;YAClC,KAAI,CAAC,cAAc,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC;QACjD,CAAC,CAAC,CAAC;;IACL,CAAC;IAED,sDAAU,GAAV;QACE,OAAO,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,KAAK,CAAA;IAC9C,CAAC;IAED,0DAAc,GAAd;QACE,OAAO,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,KAAK,CAAC;IAChD,CAAC;IAfD;QADC,KAAK,EAAE;kCACQ,sBAAsB;6EAAW;IAJtC,iCAAiC;QAL7C,SAAS,CAAC;YACT,QAAQ,EAAE,iCAAiC;YAC3C,kJAA2D;;SAE5D,CAAC;;OACW,iCAAiC,CAoB7C;IAAD,wCAAC;CAAA,AApBD,CAA4D,mBAAmB,GAoB9E;SApBY,iCAAiC","sourcesContent":["import { Component, Input } from '@angular/core';\n\nimport { Command, MultipleSelectionModel, SelectionModel } from '@coolon/pectin';\nimport { DisposableComponent } from '../../disposable-component';\n\n@Component({\n selector: 'aup-select-header-cell-renderer',\n templateUrl: './select-header-cell-renderer.component.html',\n styleUrls: ['./select-header-cell-renderer.component.scss']\n})\nexport class SelectHeaderCellRendererComponent<Row> extends DisposableComponent {\n readonly selectCommand: Command<void>;\n\n @Input()\n selectionModel: MultipleSelectionModel<Row, any>;\n\n constructor() {\n super();\n this.selectCommand = Command.create(() => {\n this.selectionModel.toggleAllCommand.execute();\n });\n }\n\n isSelected(): boolean {\n return this.selectionModel.allSelected.value\n }\n\n isIntermediate() {\n return this.selectionModel.someSelected.value;\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select-header-cell-renderer.component.ngfactory.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/components/table/select-header-cell-renderer/select-header-cell-renderer.component.ngfactory.ts"],"names":[],"mappings":"","sourcesContent":["import * as i0 from '@angular/core';\ni0.ComponentFactory;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select-header-cell-renderer.component.scss.shim.ngstyle.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/components/table/select-header-cell-renderer/select-header-cell-renderer.component.scss.shim.ngstyle.ts"],"names":[],"mappings":"","sourcesContent":["import * as i0 from '@angular/core';\ni0.ComponentFactory;\n"]}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import { Component, HostBinding, Input } from '@angular/core';
|
|
3
|
+
import { Command } from '@coolon/pectin';
|
|
4
|
+
import { ColumnModel } from '../column-model';
|
|
5
|
+
import { TableModel } from '../table-model';
|
|
6
|
+
var TableCellRendererComponent = /** @class */ (function () {
|
|
7
|
+
function TableCellRendererComponent() {
|
|
8
|
+
var _this = this;
|
|
9
|
+
this.defaultClassNames = "aup-header-cell-renderer";
|
|
10
|
+
this.editRowCommand = Command.create(function () {
|
|
11
|
+
_this.tableModel.startEditSession(_this.row);
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
TableCellRendererComponent.prototype.initialiseRenderer = function (instance) {
|
|
15
|
+
if (this.renderer !== instance) {
|
|
16
|
+
this.renderer = instance;
|
|
17
|
+
this.column.updateCellRenderer(this.renderer, this.row, this.editRowCommand, this.editSession);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
TableCellRendererComponent.prototype.initialiseEditor = function (instance) {
|
|
21
|
+
if (this.editor !== instance) {
|
|
22
|
+
this.editor = instance;
|
|
23
|
+
this.column.initialiseEditor(this.editor, this.editSession);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
TableCellRendererComponent.prototype.ngOnChanges = function (changes) {
|
|
27
|
+
if (this.renderer) {
|
|
28
|
+
this.column.updateCellRenderer(this.renderer, this.row, this.editRowCommand, this.editSession);
|
|
29
|
+
this.renderer.editSession = this.editSession;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
TableCellRendererComponent.prototype.hasActiveEditor = function () {
|
|
33
|
+
return this.editSession && this.column.hasEditor();
|
|
34
|
+
};
|
|
35
|
+
__decorate([
|
|
36
|
+
Input(),
|
|
37
|
+
__metadata("design:type", Object)
|
|
38
|
+
], TableCellRendererComponent.prototype, "row", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
Input(),
|
|
41
|
+
__metadata("design:type", ColumnModel)
|
|
42
|
+
], TableCellRendererComponent.prototype, "column", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
Input(),
|
|
45
|
+
__metadata("design:type", TableModel.EditSession)
|
|
46
|
+
], TableCellRendererComponent.prototype, "editSession", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
Input(),
|
|
49
|
+
__metadata("design:type", TableModel)
|
|
50
|
+
], TableCellRendererComponent.prototype, "tableModel", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
HostBinding('class'),
|
|
53
|
+
__metadata("design:type", Object)
|
|
54
|
+
], TableCellRendererComponent.prototype, "defaultClassNames", void 0);
|
|
55
|
+
TableCellRendererComponent = __decorate([
|
|
56
|
+
Component({
|
|
57
|
+
selector: 'aup-table-cell-renderer',
|
|
58
|
+
template: "<ng-container *ngIf=\"!hasActiveEditor()\" [cdkPortalOutlet]=\"column.cellRendererPortal\" (attached)=\"initialiseRenderer($event.instance)\"></ng-container>\n<ng-container *ngIf=\"hasActiveEditor()\" [cdkPortalOutlet]=\"column.cellEditorPortal\" (attached)=\"initialiseEditor($event.instance)\"></ng-container>\n",
|
|
59
|
+
styles: [":host{display:flex;flex-direction:column;align-items:stretch}"]
|
|
60
|
+
}),
|
|
61
|
+
__metadata("design:paramtypes", [])
|
|
62
|
+
], TableCellRendererComponent);
|
|
63
|
+
return TableCellRendererComponent;
|
|
64
|
+
}());
|
|
65
|
+
export { TableCellRendererComponent };
|
|
66
|
+
//# sourceMappingURL=table-cell-renderer.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-cell-renderer.component.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/components/table/table-cell-renderer/table-cell-renderer.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,KAAK,EAA+C,MAAM,eAAe,CAAC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oDAAe,GAAf;QACE,OAAO,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;IACrD,CAAC;IAhDD;QADC,KAAK,EAAE;;2DACC;IAGT;QADC,KAAK,EAAE;kCACA,WAAW;8DAAM;IAGzB;QADC,KAAK,EAAE;kCACK,UAAU,CAAC,WAAW;mEAAM;IAGzC;QADC,KAAK,EAAE;kCACI,UAAU;kEAAM;IAQ5B;QADC,WAAW,CAAC,OAAO,CAAC;;yEACyB;IApBnC,0BAA0B;QALtC,SAAS,CAAC;YACT,QAAQ,EAAE,yBAAyB;YACnC,qUAAmD;;SAEpD,CAAC;;OACW,0BAA0B,CAoDtC;IAAD,iCAAC;CAAA,AApDD,IAoDC;SApDY,0BAA0B","sourcesContent":["import { Component, HostBinding, Input, OnChanges, SimpleChanges, ViewEncapsulation } from '@angular/core';\nimport { Command } from '@coolon/pectin';\nimport { ColumnModel } from '../column-model';\nimport { TableModel } from '../table-model';\n\n@Component({\n selector: 'aup-table-cell-renderer',\n templateUrl: './table-cell-renderer.component.html',\n styleUrls: ['./table-cell-renderer.component.scss']\n})\nexport class TableCellRendererComponent<Row> implements OnChanges {\n\n @Input()\n row: Row;\n\n @Input()\n column: ColumnModel<Row>;\n\n @Input()\n editSession: TableModel.EditSession<Row>;\n\n @Input()\n tableModel: TableModel<Row>;\n\n private renderer: any;\n private editor: any;\n\n private editRowCommand: Command<void>;\n\n @HostBinding('class')\n defaultClassNames = \"aup-header-cell-renderer\"\n\n constructor() {\n this.editRowCommand = Command.create(() => {\n this.tableModel.startEditSession(this.row);\n });\n }\n\n initialiseRenderer(instance: any) {\n if (this.renderer !== instance) {\n this.renderer = instance;\n this.column.updateCellRenderer(this.renderer, this.row, this.editRowCommand, this.editSession);\n }\n }\n\n initialiseEditor(instance: any) {\n if (this.editor !== instance) {\n this.editor = instance;\n this.column.initialiseEditor(this.editor, this.editSession);\n }\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (this.renderer) {\n this.column.updateCellRenderer(this.renderer, this.row, this.editRowCommand, this.editSession);\n this.renderer.editSession = this.editSession;\n }\n }\n\n hasActiveEditor() {\n return this.editSession && this.column.hasEditor();\n }\n}\n"]}
|
package/esm5/lib/components/table/table-cell-renderer/table-cell-renderer.component.ngfactory.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-cell-renderer.component.ngfactory.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/components/table/table-cell-renderer/table-cell-renderer.component.ngfactory.ts"],"names":[],"mappings":"","sourcesContent":["import * as i0 from '@angular/core';\ni0.ComponentFactory;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-cell-renderer.component.scss.shim.ngstyle.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/components/table/table-cell-renderer/table-cell-renderer.component.scss.shim.ngstyle.ts"],"names":[],"mappings":"","sourcesContent":["import * as i0 from '@angular/core';\ni0.ComponentFactory;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=table-def.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-def.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/components/table/table-def.ts"],"names":[],"mappings":"","sourcesContent":["import { Form } from '@coolon/pectin';\n\nexport interface TableDef<T> {\n // createRowForm?(item: T): Form<T>; // Optional, if not specified the columns can be used to inject validators\n // save(form: Form<T>)\n}\n\n// RowEditorFactory?\nexport interface EditableTableDef<T> extends TableDef<T> {\n createRowForm?(item: T): Form<T>; // Optional, if not specified the columns can be used to inject validators\n save(form: Form<T>)\n}\n"]}
|
package/esm5/lib/components/table/table-header-cell-renderer/table-header-cell-renderer.component.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import { Component, HostBinding, Input } from '@angular/core';
|
|
3
|
+
import { ColumnModel } from '../column-model';
|
|
4
|
+
var TableHeaderCellRendererComponent = /** @class */ (function () {
|
|
5
|
+
function TableHeaderCellRendererComponent() {
|
|
6
|
+
this.defaultClassNames = "aup-header-cell-renderer";
|
|
7
|
+
}
|
|
8
|
+
TableHeaderCellRendererComponent.prototype.initialiseHeader = function (instance) {
|
|
9
|
+
if (this.renderer !== instance) {
|
|
10
|
+
this.renderer = instance;
|
|
11
|
+
this.column.initialiseHeader(this.renderer);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
__decorate([
|
|
15
|
+
Input(),
|
|
16
|
+
__metadata("design:type", ColumnModel)
|
|
17
|
+
], TableHeaderCellRendererComponent.prototype, "column", void 0);
|
|
18
|
+
__decorate([
|
|
19
|
+
HostBinding('class'),
|
|
20
|
+
__metadata("design:type", Object)
|
|
21
|
+
], TableHeaderCellRendererComponent.prototype, "defaultClassNames", void 0);
|
|
22
|
+
TableHeaderCellRendererComponent = __decorate([
|
|
23
|
+
Component({
|
|
24
|
+
selector: 'aup-table-header-cell-renderer',
|
|
25
|
+
template: "<ng-container [cdkPortalOutlet]=\"column.columnHeaderCellRendererPortal\" (attached)=\"initialiseHeader($event.instance)\"></ng-container>\n",
|
|
26
|
+
styles: [":host{display:flex;flex-direction:column;align-items:stretch}"]
|
|
27
|
+
}),
|
|
28
|
+
__metadata("design:paramtypes", [])
|
|
29
|
+
], TableHeaderCellRendererComponent);
|
|
30
|
+
return TableHeaderCellRendererComponent;
|
|
31
|
+
}());
|
|
32
|
+
export { TableHeaderCellRendererComponent };
|
|
33
|
+
//# sourceMappingURL=table-header-cell-renderer.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-header-cell-renderer.component.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/components/table/table-header-cell-renderer/table-header-cell-renderer.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,KAAK,EAA+C,MAAM,eAAe,CAAC;AAE3G,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAQ9C;IAUE;QAFA,sBAAiB,GAAG,0BAA0B,CAAA;IAG9C,CAAC;IAED,2DAAgB,GAAhB,UAAiB,QAAa;QAC5B,IAAI,IAAI,CAAC,QAAQ,KAAK,QAAQ,EAAE;YAC9B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;YACzB,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SAC7C;IACH,CAAC;IAfD;QADC,KAAK,EAAE;kCACA,WAAW;oEAAM;IAKzB;QADC,WAAW,CAAC,OAAO,CAAC;;+EACyB;IARnC,gCAAgC;QAL5C,SAAS,CAAC;YACT,QAAQ,EAAE,gCAAgC;YAC1C,wJAA0D;;SAE3D,CAAC;;OACW,gCAAgC,CAmB5C;IAAD,uCAAC;CAAA,AAnBD,IAmBC;SAnBY,gCAAgC","sourcesContent":["import { Component, HostBinding, Input, OnChanges, SimpleChanges, ViewEncapsulation } from '@angular/core';\nimport { Command } from '@coolon/pectin';\nimport { ColumnModel } from '../column-model';\nimport { TableModel } from '../table-model';\n\n@Component({\n selector: 'aup-table-header-cell-renderer',\n templateUrl: './table-header-cell-renderer.component.html',\n styleUrls: ['./table-header-cell-renderer.component.scss']\n})\nexport class TableHeaderCellRendererComponent<Row> {\n\n @Input()\n column: ColumnModel<Row>;\n\n private renderer: any;\n\n @HostBinding('class')\n defaultClassNames = \"aup-header-cell-renderer\"\n\n constructor() {\n }\n\n initialiseHeader(instance: any) {\n if (this.renderer !== instance) {\n this.renderer = instance;\n this.column.initialiseHeader(this.renderer);\n }\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-header-cell-renderer.component.ngfactory.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/components/table/table-header-cell-renderer/table-header-cell-renderer.component.ngfactory.ts"],"names":[],"mappings":"","sourcesContent":["import * as i0 from '@angular/core';\ni0.ComponentFactory;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-header-cell-renderer.component.scss.shim.ngstyle.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/components/table/table-header-cell-renderer/table-header-cell-renderer.component.scss.shim.ngstyle.ts"],"names":[],"mappings":"","sourcesContent":["import * as i0 from '@angular/core';\ni0.ComponentFactory;\n"]}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { __decorate, __extends, __metadata } from "tslib";
|
|
2
|
+
import { BooleanValueModelChain, CanIdentify, Dsl, Form, GarbageCollector, lang, ListModel, ListModelChain, MapModelChain, MutableListModel, MutableValueModel, SelectionModel, TrackExternal, Types, UnaryCommand } from '@coolon/pectin';
|
|
3
|
+
import produce from 'immer';
|
|
4
|
+
import { CustomValueColumnModel, EditorControlColumnModel, PropertyColumnModel, SelectionColumnModel } from './column-model';
|
|
5
|
+
// export type StringPropertiesOf<T> = { [K in keyof T]: T[K] extends string ? K : never }[keyof T];
|
|
6
|
+
// export type NumberPropertiesOf<T> = { [K in keyof T]: T[K] extends number ? K : never }[keyof T];
|
|
7
|
+
/**
|
|
8
|
+
* Example:
|
|
9
|
+
* @example
|
|
10
|
+
* const model = TableModel.fromList(heroList, table => {
|
|
11
|
+
* table.pluck("firstName");
|
|
12
|
+
* table.pluck("lastName");
|
|
13
|
+
* table.addCustomColumn("fullName", hero => `${hero.firstName} ${hero.lastName}`);
|
|
14
|
+
* });
|
|
15
|
+
*
|
|
16
|
+
* Editable tables
|
|
17
|
+
* @example
|
|
18
|
+
* const saveCommand = UnaryCommand.create((form: Form<Hero>) => {
|
|
19
|
+
* if (form.validate()) {
|
|
20
|
+
* // normal form save stuff
|
|
21
|
+
* return true; // finish editing
|
|
22
|
+
* }
|
|
23
|
+
* return false; // continue editiing
|
|
24
|
+
* }
|
|
25
|
+
* const colorsNames: ListModel<string> = ...;
|
|
26
|
+
* const model = TableModel.fromList(heroList, table => {
|
|
27
|
+
* table.pluck("firstName").cellEditor(StringInputComponent); <-- interface CellEditor { valueModel: FormValueModel<string> | ValueModel<string>; }
|
|
28
|
+
* table.pluck("lastName").cellEditor(StringInputComponent, {
|
|
29
|
+
* validators: [Validator.present("We need a last name")]
|
|
30
|
+
* });
|
|
31
|
+
* table.pluck("age").cellEditor(NumberInputComponent);
|
|
32
|
+
* table.pluck("favoriteColor").cellEditor(SelectInputComponent, {
|
|
33
|
+
* initialiseComponent(component: SelectInputComponent) {
|
|
34
|
+
* selectInput.optionsModel = colorsNames; // <- initialise our component
|
|
35
|
+
* }
|
|
36
|
+
* });
|
|
37
|
+
* table.addEditControls(saveCommand); // <- required to enable editing
|
|
38
|
+
* });
|
|
39
|
+
*
|
|
40
|
+
* Selection models
|
|
41
|
+
* @example
|
|
42
|
+
* const model = TableModel.fromList(heroList, table => {
|
|
43
|
+
* table.addSelectionColumn(selectionModel); // <- can be single or multiple selection model
|
|
44
|
+
* table.pluck("firstName");
|
|
45
|
+
* table.pluck("lastName");
|
|
46
|
+
* });
|
|
47
|
+
*
|
|
48
|
+
* Custom cell renderers and editors
|
|
49
|
+
* @example
|
|
50
|
+
* const model = TableModel.fromList(heroList, table => {
|
|
51
|
+
* table.pluck("favoriteColor")
|
|
52
|
+
* .cellHeaderRenderer(CellHeaderRendererComponent, (component, column) => {
|
|
53
|
+
* // configure your component with what ever you need.
|
|
54
|
+
* });
|
|
55
|
+
* .cellRenderer(CellRendererComponent) // <-- interface CellEditor { value: string; }
|
|
56
|
+
* .cellEditor(CellEditorComponent.); // <-- interface CellEditor { valueModel: FormValueModel<string> | ValueModel<string>; }
|
|
57
|
+
* table.addCustomColumn("fullName", hero => `${hero.firstName} ${hero.lastName}`);
|
|
58
|
+
* });
|
|
59
|
+
*
|
|
60
|
+
* I18n
|
|
61
|
+
* @example
|
|
62
|
+
* [table.yml]
|
|
63
|
+
* table:
|
|
64
|
+
* columns(ColumnTextProperties[]):
|
|
65
|
+
* firstName:
|
|
66
|
+
* headerText: "First Name"
|
|
67
|
+
* fullName:
|
|
68
|
+
* headerText: "Full Name"
|
|
69
|
+
*
|
|
70
|
+
* const model = TableModel.fromList(heroList, table => {
|
|
71
|
+
* table.pluck("favoriteColor").cellRenderer(...).cellEditor(...);
|
|
72
|
+
* table.addCustomColumn("fullName", hero => `${hero.firstName} ${hero.lastName}`);
|
|
73
|
+
*
|
|
74
|
+
* table.columnTextProperties(I18n.table.columns); // <- configures all columns
|
|
75
|
+
* });
|
|
76
|
+
*/
|
|
77
|
+
var TableModel = /** @class */ (function () {
|
|
78
|
+
function TableModel(sourceOfTruth) {
|
|
79
|
+
this.sourceOfTruth = sourceOfTruth;
|
|
80
|
+
this._garbage = new GarbageCollector();
|
|
81
|
+
this._columns = new MutableListModel();
|
|
82
|
+
this._editorSessions = new MutableListModel();
|
|
83
|
+
this.identityOf = sourceOfTruth.identityOf;
|
|
84
|
+
var _a = Dsl.disposeWith(this._garbage), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
|
|
85
|
+
this._columnsById = chain(this._columns).indexBy('columnId');
|
|
86
|
+
this._rowsBeingEdited = new MutableListModel([], {
|
|
87
|
+
identifiedWith: this.identityOf
|
|
88
|
+
});
|
|
89
|
+
this._editorSessionByRowId = chain(this._editorSessions).indexBy('rowId');
|
|
90
|
+
this.editing = chain(this._editorSessions).count().isGreaterThan(0);
|
|
91
|
+
this.dataSource = chain(this.sourceOfTruth).replaceAll(this.rowsBeingEdited);
|
|
92
|
+
}
|
|
93
|
+
TableModel_1 = TableModel;
|
|
94
|
+
TableModel.fromList = function (sourceOfTruth, builder) {
|
|
95
|
+
var model = new TableModel_1(sourceOfTruth);
|
|
96
|
+
builder(model);
|
|
97
|
+
return model;
|
|
98
|
+
};
|
|
99
|
+
Object.defineProperty(TableModel.prototype, "rowsBeingEdited", {
|
|
100
|
+
get: function () {
|
|
101
|
+
return this._rowsBeingEdited.readonly;
|
|
102
|
+
},
|
|
103
|
+
enumerable: true,
|
|
104
|
+
configurable: true
|
|
105
|
+
});
|
|
106
|
+
TableModel.prototype.getTrackByFunction = function () {
|
|
107
|
+
var _this = this;
|
|
108
|
+
return function (index, item) {
|
|
109
|
+
return _this.identityOf ? _this.identityOf(item) : index;
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
Object.defineProperty(TableModel.prototype, "columns", {
|
|
113
|
+
get: function () {
|
|
114
|
+
return this._columns.readonly;
|
|
115
|
+
},
|
|
116
|
+
enumerable: true,
|
|
117
|
+
configurable: true
|
|
118
|
+
});
|
|
119
|
+
TableModel.prototype.pluck = function (property) {
|
|
120
|
+
return this.addColumn(new PropertyColumnModel(property, this));
|
|
121
|
+
};
|
|
122
|
+
TableModel.prototype.addSelectionColumn = function (selectionModel) {
|
|
123
|
+
return this.addColumn(new SelectionColumnModel('selection', this, selectionModel));
|
|
124
|
+
};
|
|
125
|
+
TableModel.prototype.addEditControls = function (saveCommand) {
|
|
126
|
+
this.saveCommand = saveCommand;
|
|
127
|
+
return this.addColumn(new EditorControlColumnModel('editControls', saveCommand, this));
|
|
128
|
+
};
|
|
129
|
+
TableModel.prototype.addCustomColumn = function (columnId, dataAccessor) {
|
|
130
|
+
return this.addColumn(new CustomValueColumnModel(columnId, this, dataAccessor));
|
|
131
|
+
};
|
|
132
|
+
TableModel.prototype.addColumn = function (column) {
|
|
133
|
+
if (this._columnsById.get(column.columnId)) {
|
|
134
|
+
lang.illegalState("Column with id=" + column.columnId + " already exists");
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
this._columns.push(column);
|
|
138
|
+
}
|
|
139
|
+
return column;
|
|
140
|
+
};
|
|
141
|
+
TableModel.prototype.columnTextProperties = function (columnTextProperties) {
|
|
142
|
+
this._columnTextPropertiesLookup = columnTextProperties;
|
|
143
|
+
};
|
|
144
|
+
TableModel.prototype.getColumnTextProperties = function (column) {
|
|
145
|
+
var factory = this._columnTextPropertiesLookup[column.columnId];
|
|
146
|
+
return factory ? factory() : undefined;
|
|
147
|
+
};
|
|
148
|
+
TableModel.prototype.startEditSession = function (row) {
|
|
149
|
+
var _this = this;
|
|
150
|
+
var rowId = this.identityOf(row);
|
|
151
|
+
if (this._rowsBeingEdited.query().indexOf(row) > -1) {
|
|
152
|
+
return lang.illegalState("Row with id=" + rowId + " already being edited");
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
var editSession_1 = new TableModel_1.EditSession(rowId, row, this.saveCommand);
|
|
156
|
+
var when = Dsl.disposeWith(editSession_1).when;
|
|
157
|
+
when.valueOf(editSession_1.rowValueModel).changes(function (editedValue) {
|
|
158
|
+
_this._rowsBeingEdited.replaceOrPush(editedValue);
|
|
159
|
+
}, { initialValue: 'triggerChangeUnlessNil' });
|
|
160
|
+
this._editorSessions.push(editSession_1);
|
|
161
|
+
editSession_1.onDispose(function () {
|
|
162
|
+
_this._rowsBeingEdited.remove(editSession_1.rowValueModel.value);
|
|
163
|
+
_this._editorSessions.remove(editSession_1);
|
|
164
|
+
});
|
|
165
|
+
return editSession_1;
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
TableModel.prototype.getEditSessionFor = function (row) {
|
|
169
|
+
return this._editorSessionByRowId.get(this.identityOf(row));
|
|
170
|
+
};
|
|
171
|
+
TableModel.prototype.cancelAllEditorSessions = function () {
|
|
172
|
+
var _this = this;
|
|
173
|
+
this._editorSessions.runInTransaction(function (draft) {
|
|
174
|
+
_this._rowsBeingEdited.runInTransaction(function () {
|
|
175
|
+
draft.value.forEach(function (session) { return session.dispose(); });
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
};
|
|
179
|
+
var TableModel_1;
|
|
180
|
+
TableModel.ctorParameters = function () { return [
|
|
181
|
+
{ type: ListModel }
|
|
182
|
+
]; };
|
|
183
|
+
TableModel = TableModel_1 = __decorate([
|
|
184
|
+
TrackExternal.Strategy(new TrackExternal.OneTimeBinding()),
|
|
185
|
+
__metadata("design:paramtypes", [ListModel])
|
|
186
|
+
], TableModel);
|
|
187
|
+
return TableModel;
|
|
188
|
+
}());
|
|
189
|
+
export { TableModel };
|
|
190
|
+
(function (TableModel) {
|
|
191
|
+
var EditSession = /** @class */ (function (_super) {
|
|
192
|
+
__extends(EditSession, _super);
|
|
193
|
+
function EditSession(rowId, row, saveCommand) {
|
|
194
|
+
var _this = _super.call(this) || this;
|
|
195
|
+
_this.rowId = rowId;
|
|
196
|
+
_this.saveCommand = saveCommand;
|
|
197
|
+
_this._editorValue = new MutableValueModel();
|
|
198
|
+
_this.rowValueModel = _this._editorValue.readonly;
|
|
199
|
+
_this.form = new Form();
|
|
200
|
+
_this.form.load(row);
|
|
201
|
+
_this._editorValue.value = row;
|
|
202
|
+
_this.form.onEdit(function () {
|
|
203
|
+
_this._editorValue.value = produce(_this._editorValue.value, function (draft) {
|
|
204
|
+
_this.form.writeDirtyStateTo(draft);
|
|
205
|
+
});
|
|
206
|
+
});
|
|
207
|
+
return _this;
|
|
208
|
+
}
|
|
209
|
+
return EditSession;
|
|
210
|
+
}(GarbageCollector));
|
|
211
|
+
TableModel.EditSession = EditSession;
|
|
212
|
+
})(TableModel || (TableModel = {}));
|
|
213
|
+
//# sourceMappingURL=table-model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-model.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/components/table/table-model.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,sBAAsB,EACtB,WAAW,EACX,GAAG,EACH,IAAI,EACJ,gBAAgB,EAChB,IAAI,EACJ,SAAS,EACT,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,KAAK,EACL,YAAY,EACb,MAAM,gBAAgB,CAAC;AAExB,OAAO,OAAO,MAAM,OAAO,CAAC;AAC5B,OAAO,EAEL,sBAAsB,EACtB,wBAAwB,EACxB,mBAAmB,EACnB,oBAAoB,EACrB,M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C,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACpB,KAAI,CAAC,YAAY,CAAC,KAAK,GAAG,GAAG,CAAC;YAC9B,KAAI,CAAC,IAAI,CAAC,MAAM,CAAC;gBACf,KAAI,CAAC,YAAY,CAAC,KAAK,GAAG,OAAO,CAAC,KAAI,CAAC,YAAY,CAAC,KAAK,EAAE,UAAA,KAAK;oBAC9D,KAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,KAAyB,CAAC,CAAC;gBACzD,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;;QACL,CAAC;QACH,kBAAC;IAAD,CAAC,AAhBD,CAAsC,gBAAgB,GAgBrD;IAhBY,sBAAW,cAgBvB,CAAA;AACH,CAAC,EApBgB,UAAU,KAAV,UAAU,QAoB1B","sourcesContent":["import {\n BooleanValueModelChain,\n CanIdentify,\n Dsl,\n Form,\n GarbageCollector,\n lang,\n ListModel,\n ListModelChain,\n MapModelChain,\n MutableListModel,\n MutableValueModel,\n SelectionModel,\n TrackExternal,\n Types,\n UnaryCommand\n} from '@coolon/pectin';\nimport { PickMutable } from '@coolon/typescript-utilities';\nimport produce from 'immer';\nimport {\n ColumnModel,\n CustomValueColumnModel,\n EditorControlColumnModel,\n PropertyColumnModel,\n SelectionColumnModel\n} from './column-model';\nimport { ColumnTextProperties } from './column-text-properties';\n\n// export type StringPropertiesOf<T> = { [K in keyof T]: T[K] extends string ? K : never }[keyof T];\n// export type NumberPropertiesOf<T> = { [K in keyof T]: T[K] extends number ? K : never }[keyof T];\n\n\n/**\n * Example:\n * @example\n * const model = TableModel.fromList(heroList, table => {\n * table.pluck(\"firstName\");\n * table.pluck(\"lastName\");\n * table.addCustomColumn(\"fullName\", hero => `${hero.firstName} ${hero.lastName}`);\n * });\n *\n * Editable tables\n * @example\n * const saveCommand = UnaryCommand.create((form: Form<Hero>) => {\n * if (form.validate()) {\n * // normal form save stuff\n * return true; // finish editing\n * }\n * return false; // continue editiing\n * }\n * const colorsNames: ListModel<string> = ...;\n * const model = TableModel.fromList(heroList, table => {\n * table.pluck(\"firstName\").cellEditor(StringInputComponent); <-- interface CellEditor { valueModel: FormValueModel<string> | ValueModel<string>; }\n * table.pluck(\"lastName\").cellEditor(StringInputComponent, {\n * validators: [Validator.present(\"We need a last name\")]\n * });\n * table.pluck(\"age\").cellEditor(NumberInputComponent);\n * table.pluck(\"favoriteColor\").cellEditor(SelectInputComponent, {\n * initialiseComponent(component: SelectInputComponent) {\n * selectInput.optionsModel = colorsNames; // <- initialise our component\n * }\n * });\n * table.addEditControls(saveCommand); // <- required to enable editing\n * });\n *\n * Selection models\n * @example\n * const model = TableModel.fromList(heroList, table => {\n * table.addSelectionColumn(selectionModel); // <- can be single or multiple selection model\n * table.pluck(\"firstName\");\n * table.pluck(\"lastName\");\n * });\n *\n * Custom cell renderers and editors\n * @example\n * const model = TableModel.fromList(heroList, table => {\n * table.pluck(\"favoriteColor\")\n * .cellHeaderRenderer(CellHeaderRendererComponent, (component, column) => {\n * // configure your component with what ever you need.\n * });\n * .cellRenderer(CellRendererComponent) // <-- interface CellEditor { value: string; }\n * .cellEditor(CellEditorComponent.); // <-- interface CellEditor { valueModel: FormValueModel<string> | ValueModel<string>; }\n * table.addCustomColumn(\"fullName\", hero => `${hero.firstName} ${hero.lastName}`);\n * });\n *\n * I18n\n * @example\n * [table.yml]\n * table:\n * columns(ColumnTextProperties[]):\n * firstName:\n * headerText: \"First Name\"\n * fullName:\n * headerText: \"Full Name\"\n *\n * const model = TableModel.fromList(heroList, table => {\n * table.pluck(\"favoriteColor\").cellRenderer(...).cellEditor(...);\n * table.addCustomColumn(\"fullName\", hero => `${hero.firstName} ${hero.lastName}`);\n *\n * table.columnTextProperties(I18n.table.columns); // <- configures all columns\n * });\n */\n@TrackExternal.Strategy(new TrackExternal.OneTimeBinding())\nexport class TableModel<Row> {\n\n private readonly _garbage = new GarbageCollector();\n\n private readonly _columns = new MutableListModel<ColumnModel<Row>>();\n private _columnsById: MapModelChain<string, ColumnModel<Row>>;\n private _editorSessions = new MutableListModel<TableModel.EditSession<Row>>();\n private readonly _rowsBeingEdited: MutableListModel<Row>;\n\n private _columnTextPropertiesLookup: { [columnName: string]: () => ColumnTextProperties };\n\n readonly identityOf: CanIdentify<Row>['identityOf'];\n private saveCommand: UnaryCommand<Form<Row>, boolean>;\n private _editorSessionByRowId: MapModelChain<any, TableModel.EditSession<Row>>;\n\n readonly editing: BooleanValueModelChain;\n readonly dataSource: ListModelChain<Row>;\n\n static fromList<Row>(sourceOfTruth: ListModel<Row>, builder?: (tableModel: TableModel<Row>) => void): TableModel<Row> {\n const model = new TableModel<Row>(sourceOfTruth);\n builder(model);\n return model;\n }\n\n protected constructor(private sourceOfTruth: ListModel<Row>) {\n this.identityOf = sourceOfTruth.identityOf;\n const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this._garbage);\n this._columnsById = chain(this._columns).indexBy('columnId');\n this._rowsBeingEdited = new MutableListModel<Row>([], {\n identifiedWith: this.identityOf\n });\n this._editorSessionByRowId = chain(this._editorSessions).indexBy('rowId');\n this.editing = chain(this._editorSessions).count().isGreaterThan(0);\n this.dataSource = chain(this.sourceOfTruth).replaceAll(this.rowsBeingEdited);\n }\n\n get rowsBeingEdited(): ListModel<Row> {\n return this._rowsBeingEdited.readonly;\n }\n\n getTrackByFunction() {\n return (index: number, item: Row) => {\n return this.identityOf ? this.identityOf(item) : index;\n };\n }\n\n get columns(): ListModel<ColumnModel<Row>> {\n return this._columns.readonly;\n }\n\n pluck<P extends Types.ValuePropertiesOf<Row>>(property: P): PropertyColumnModel<Row, P> {\n return this.addColumn(new PropertyColumnModel<Row, P>(property, this));\n }\n\n addSelectionColumn(selectionModel: SelectionModel<Row>): SelectionColumnModel<Row> {\n return this.addColumn(new SelectionColumnModel<Row>('selection', this, selectionModel));\n }\n\n addEditControls(saveCommand: UnaryCommand<Form<Row>, boolean>):EditorControlColumnModel<Row> {\n this.saveCommand = saveCommand;\n return this.addColumn(new EditorControlColumnModel<Row>('editControls', saveCommand, this));\n }\n\n addCustomColumn<V>(columnId: string, dataAccessor: (row: Row) => V): CustomValueColumnModel<Row, V> {\n return this.addColumn(new CustomValueColumnModel<Row, V>(columnId, this, dataAccessor));\n }\n\n protected addColumn<C extends ColumnModel<Row>>(column: C): C {\n if (this._columnsById.get(column.columnId)) {\n lang.illegalState(`Column with id=${column.columnId} already exists`);\n } else {\n this._columns.push(column);\n }\n return column;\n }\n\n columnTextProperties(columnTextProperties: { [columnName: string]: () => ColumnTextProperties }) {\n this._columnTextPropertiesLookup = columnTextProperties;\n }\n\n getColumnTextProperties(column: ColumnModel<Row>): ColumnTextProperties {\n const factory = this._columnTextPropertiesLookup[column.columnId];\n return factory ? factory() : undefined;\n }\n\n startEditSession(row: Row): TableModel.EditSession<Row> {\n const rowId = this.identityOf(row);\n if (this._rowsBeingEdited.query().indexOf(row) > -1) {\n return lang.illegalState(`Row with id=${rowId} already being edited`);\n } else {\n const editSession = new TableModel.EditSession<Row>(rowId, row, this.saveCommand);\n const { when } = Dsl.disposeWith(editSession);\n when.valueOf(editSession.rowValueModel).changes((editedValue) => {\n this._rowsBeingEdited.replaceOrPush(editedValue);\n }, { initialValue: 'triggerChangeUnlessNil' });\n\n this._editorSessions.push(editSession);\n editSession.onDispose(() => {\n this._rowsBeingEdited.remove(editSession.rowValueModel.value);\n this._editorSessions.remove(editSession);\n });\n return editSession;\n }\n }\n\n getEditSessionFor(row: Row): TableModel.EditSession<Row> {\n return this._editorSessionByRowId.get(this.identityOf(row));\n }\n\n cancelAllEditorSessions() {\n this._editorSessions.runInTransaction((draft) => {\n this._rowsBeingEdited.runInTransaction(() => {\n draft.value.forEach(session => session.dispose());\n });\n });\n }\n}\n\nexport namespace TableModel {\n\n\n export class EditSession<Row> extends GarbageCollector {\n readonly form: Form<Row>;\n private _editorValue = new MutableValueModel<Row>();\n readonly rowValueModel = this._editorValue.readonly;\n\n constructor(readonly rowId: any, row: Row, readonly saveCommand: UnaryCommand<Form<Row>, boolean>) {\n super();\n this.form = new Form<Row>();\n this.form.load(row);\n this._editorValue.value = row;\n this.form.onEdit(() => {\n this._editorValue.value = produce(this._editorValue.value, draft => {\n this.form.writeDirtyStateTo(draft as PickMutable<Row>);\n });\n });\n }\n }\n}\n"]}
|