@coolon/angular-ui-powerups 1.9.0 → 1.11.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 +19 -0
- package/assets/styles.scss +7 -67
- package/bundles/coolon-angular-ui-powerups.umd.js +2623 -1581
- 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/activity-actions/activity-actions.component.js +2 -2
- package/esm2015/lib/interaction/components/activity-actions/activity-actions.component.js.map +1 -1
- package/esm2015/lib/interaction/components/activity-actions/activity-actions.component.metadata.json +1 -1
- package/esm2015/lib/interaction/components/activity-container/activity-container.component.js +22 -9
- package/esm2015/lib/interaction/components/activity-container/activity-container.component.js.map +1 -1
- package/esm2015/lib/interaction/components/activity-container/activity-container.component.metadata.json +1 -1
- package/esm2015/lib/interaction/components/activity-container/activity-outlet/activity-outlet.component.js.map +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 +16 -4
- 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/activity-actions/activity-actions.component.js +2 -2
- package/esm5/lib/interaction/components/activity-actions/activity-actions.component.js.map +1 -1
- package/esm5/lib/interaction/components/activity-container/activity-container.component.js +23 -9
- package/esm5/lib/interaction/components/activity-container/activity-container.component.js.map +1 -1
- package/esm5/lib/interaction/components/activity-container/activity-outlet/activity-outlet.component.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 +16 -4
- 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 +2291 -1368
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/fesm5/coolon-angular-ui-powerups.js +2536 -1526
- 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/activity-container/activity-container.component.d.ts +2 -1
- 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 +5 -4
|
@@ -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/ang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,IAoHC;SApHY,UAAU;AAsHvB,WAAiB,UAAU;IAGzB;QAAsC,+BAAgB;QAKpD,qBAAqB,KAAU,EAAE,GAAQ,EAAW,WAA6C;YAAjG,YACE,iBAAO,SASR;YAVoB,WAAK,GAAL,KAAK,CAAK;YAAqB,iBAAW,GAAX,WAAW,CAAkC;YAHzF,kBAAY,GAAG,IAAI,iBAAiB,EAAO,CAAC;YAC3C,mBAAa,GAAG,KAAI,CAAC,YAAY,CAAC,QAAQ,CAAC;YAIlD,KAAI,CAAC,IAAI,GAAG,IAAI,IAAI,EAAO,CAAC;YAC5B,KAAI,CAAC,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"]}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { __decorate, __extends, __metadata } from "tslib";
|
|
2
|
+
import { Component, Input } from '@angular/core';
|
|
3
|
+
import { Dsl, TrackExternal } from '@coolon/pectin';
|
|
4
|
+
import { DisposableComponent } from '../disposable-component';
|
|
5
|
+
import { TableModel } from './table-model';
|
|
6
|
+
/**
|
|
7
|
+
* Create your model:
|
|
8
|
+
* @example
|
|
9
|
+
* this.heroTableModel = TableModel.fromList(heroList, table => {
|
|
10
|
+
* table.pluck("firstName");
|
|
11
|
+
* table.pluck("lastName");
|
|
12
|
+
* table.addCustomColumn("fullName", hero => `${hero.firstName} ${hero.lastName}`);
|
|
13
|
+
* });
|
|
14
|
+
*
|
|
15
|
+
* Create your table
|
|
16
|
+
* @example
|
|
17
|
+
* <aup-table [tableModel]="heroTableModel"></aup-table>
|
|
18
|
+
*
|
|
19
|
+
* Styling
|
|
20
|
+
* @example
|
|
21
|
+
* aup-table {
|
|
22
|
+
* --column-gap: 10px; // defaults to 24px
|
|
23
|
+
* aup-table-cell-renderer {
|
|
24
|
+
* &:first-column {
|
|
25
|
+
* // do stuff
|
|
26
|
+
* }
|
|
27
|
+
* &:last-column {
|
|
28
|
+
* // do stuff
|
|
29
|
+
* }
|
|
30
|
+
* }
|
|
31
|
+
* }
|
|
32
|
+
*/
|
|
33
|
+
var TableComponent = /** @class */ (function (_super) {
|
|
34
|
+
__extends(TableComponent, _super);
|
|
35
|
+
function TableComponent() {
|
|
36
|
+
return _super.call(this) || this;
|
|
37
|
+
}
|
|
38
|
+
TableComponent.prototype.ngOnInit = function () {
|
|
39
|
+
var _a = Dsl.disposeWith(this), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
|
|
40
|
+
this.columns = chain(this.tableModel.columns);
|
|
41
|
+
this.columnIds = chain(this.columns).pluck('columnId');
|
|
42
|
+
};
|
|
43
|
+
TableComponent.prototype.isEditing = function (row) {
|
|
44
|
+
return !!this.tableModel.getEditSessionFor(row);
|
|
45
|
+
};
|
|
46
|
+
__decorate([
|
|
47
|
+
Input(),
|
|
48
|
+
TrackExternal(),
|
|
49
|
+
__metadata("design:type", TableModel)
|
|
50
|
+
], TableComponent.prototype, "tableModel", void 0);
|
|
51
|
+
TableComponent = __decorate([
|
|
52
|
+
Component({
|
|
53
|
+
selector: 'aup-table',
|
|
54
|
+
template: "<table mat-table [dataSource]=\"tableModel.dataSource.value\" [trackBy]=\"tableModel.getTrackByFunction()\">\n\n <ng-container *ngFor=\"let column of columns.value; index as index; first as first; last as last\" matColumnDef=\"{{column.columnId}}\">\n <th mat-header-cell *matHeaderCellDef>\n <aup-table-header-cell-renderer [column]=\"column\"\n [attr.column-index]=\"index\"\n [class.first-column]=\"first\"\n [class.last-column]=\"last\"\n ></aup-table-header-cell-renderer>\n </th>\n <td mat-cell *matCellDef=\"let row\">\n <aup-table-cell-renderer [column]=\"column\"\n [row]=\"row\"\n [tableModel]=\"tableModel\"\n [editSession]=\"tableModel.getEditSessionFor(row)\"\n [attr.column-index]=\"index\"\n [class.first-column]=\"first\"\n [class.last-column]=\"last\"\n ></aup-table-cell-renderer>\n </td>\n </ng-container>\n\n <tr mat-header-row *matHeaderRowDef=\"columnIds.value\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: columnIds.value;\"></tr>\n\n</table>\n",
|
|
55
|
+
styles: [":host{display:flex;flex-direction:column;align-items:stretch}:host table{flex:1}"]
|
|
56
|
+
}),
|
|
57
|
+
__metadata("design:paramtypes", [])
|
|
58
|
+
], TableComponent);
|
|
59
|
+
return TableComponent;
|
|
60
|
+
}(DisposableComponent));
|
|
61
|
+
export { TableComponent };
|
|
62
|
+
//# sourceMappingURL=table.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.component.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/components/table/table.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAU,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,GAAG,EAAkB,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAMH;IAAuC,kCAAmB;IASxD;eACE,iBAAO;IACT,CAAC;IAED,iCAAQ,GAAR;QACQ,IAAA,0BAAkF,EAAhF,gBAAK,EAAE,oBAAO,EAAE,kBAAM,EAAE,cAAI,EAAE,gBAAK,EAAE,oBAAO,EAAE,sBAAkC,CAAC;QACzF,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAC9C,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IACzD,CAAC;IAED,kCAAS,GAAT,UAAU,GAAM;QACd,OAAO,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC;IAClD,CAAC;IAjBD;QAFC,KAAK,EAAE;QACP,aAAa,EAAE;kCACJ,UAAU;sDAAI;IAJf,cAAc;QAL1B,SAAS,CAAC;YACT,QAAQ,EAAE,WAAW;YACrB,iyCAAqC;;SAEtC,CAAC;;OACW,cAAc,CAsB1B;IAAD,qBAAC;CAAA,AAtBD,CAAuC,mBAAmB,GAsBzD;SAtBY,cAAc","sourcesContent":["import { Component, Input, OnInit } from '@angular/core';\nimport { Dsl, ListModelChain, TrackExternal } from '@coolon/pectin';\nimport { DisposableComponent } from '../disposable-component';\nimport { ColumnModel } from './column-model';\nimport { TableModel } from './table-model';\n\n/**\n * Create your model:\n * @example\n * this.heroTableModel = TableModel.fromList(heroList, table => {\n * table.pluck(\"firstName\");\n * table.pluck(\"lastName\");\n * table.addCustomColumn(\"fullName\", hero => `${hero.firstName} ${hero.lastName}`);\n * });\n *\n * Create your table\n * @example\n * <aup-table [tableModel]=\"heroTableModel\"></aup-table>\n *\n * Styling\n * @example\n * aup-table {\n * --column-gap: 10px; // defaults to 24px\n * aup-table-cell-renderer {\n * &:first-column {\n * // do stuff\n * }\n * &:last-column {\n * // do stuff\n * }\n * }\n * }\n */\n@Component({\n selector: 'aup-table',\n templateUrl: './table.component.html',\n styleUrls: ['./table.component.scss']\n})\nexport class TableComponent<T> extends DisposableComponent implements OnInit {\n\n @Input()\n @TrackExternal()\n tableModel: TableModel<T>;\n\n columns: ListModelChain<ColumnModel<T>>;\n columnIds: ListModelChain<string>;\n\n constructor() {\n super();\n }\n\n ngOnInit(): void {\n const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);\n this.columns = chain(this.tableModel.columns);\n this.columnIds = chain(this.columns).pluck('columnId');\n }\n\n isEditing(row: T): boolean {\n return !!this.tableModel.getEditSessionFor(row);\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.component.ngfactory.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/components/table/table.component.ngfactory.ts"],"names":[],"mappings":"","sourcesContent":["import * as i0 from '@angular/core';\ni0.ComponentFactory;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.component.scss.shim.ngstyle.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/components/table/table.component.scss.shim.ngstyle.ts"],"names":[],"mappings":"","sourcesContent":["import * as i0 from '@angular/core';\ni0.ComponentFactory;\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { __extends } from "tslib";
|
|
2
|
-
import { InjectionToken } from '@angular/core';
|
|
1
|
+
import { __decorate, __extends, __metadata } from "tslib";
|
|
2
|
+
import { HostBinding, InjectionToken } from '@angular/core';
|
|
3
3
|
import { DelegatingValueModel } from '@coolon/pectin';
|
|
4
4
|
import { assert } from '@coolon/typescript-utilities';
|
|
5
5
|
import { DisposableComponent } from '../components/disposable-component';
|
|
@@ -9,6 +9,7 @@ var Activity = /** @class */ (function (_super) {
|
|
|
9
9
|
function Activity() {
|
|
10
10
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
11
11
|
_this._busyModel = new DelegatingValueModel().withDefault(false);
|
|
12
|
+
_this.class = 'aup-activity';
|
|
12
13
|
return _this;
|
|
13
14
|
}
|
|
14
15
|
Activity.prototype.initialise = function (nestedInteractionContext, activityContext) {
|
|
@@ -49,6 +50,10 @@ var Activity = /** @class */ (function (_super) {
|
|
|
49
50
|
Activity.prototype.isInitialised = function () {
|
|
50
51
|
return !!this._activityContext;
|
|
51
52
|
};
|
|
53
|
+
__decorate([
|
|
54
|
+
HostBinding('class'),
|
|
55
|
+
__metadata("design:type", Object)
|
|
56
|
+
], Activity.prototype, "class", void 0);
|
|
52
57
|
return Activity;
|
|
53
58
|
}(DisposableComponent));
|
|
54
59
|
export { Activity };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"activity.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/interaction/activity.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"activity.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/interaction/activity.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAuC,MAAM,gBAAgB,CAAC;AAC3F,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAGzE,MAAM,CAAC,IAAM,aAAa,GAAG,IAAI,cAAc,CAAM,yBAAyB,CAAC,CAAC;AAEhF;IAAsD,4BAAmB;IAAzE;QAAA,qEAiDC;QA/CkB,gBAAU,GAAG,IAAI,oBAAoB,EAAW,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAM/D,WAAK,GAAG,cAAc,CAAC;;IAyC/C,CAAC;IAvCC,6BAAU,GAAV,UAAW,wBAA4C,EAAE,eAAyC;QAChG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACpC,IAAI,CAAC,gBAAgB,GAAG,eAAe,CAAC;QACxC,IAAI,CAAC,mBAAmB,GAAG,wBAAwB,CAAC;IACtD,CAAC;IAED,sBAAI,wCAAkB;aAAtB;YACE,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC;YACtC,OAAO,IAAI,CAAC,mBAAmB,CAAC;QAClC,CAAC;;;OAAA;IAED,uBAAI,GAAJ,UAAK,MAAU;QACb,OAAO,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC;IAED,yBAAM,GAAN,UAAO,KAAS;QACd,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACxC,CAAC;IAED,WAAW;IACX,kCAAe,GAAf;IACA,CAAC;IAGD,sBAAI,0BAAI;aAAR;YACE,OAAO,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;QAClC,CAAC;;;OAAA;IAED,4BAAS,GAAT,UAAU,SAA8B;QACtC,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;IACzC,CAAC;IAED,yBAAM,GAAN;QACE,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;IAC/B,CAAC;IAED,gCAAa,GAAb;QACE,OAAO,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC;IACjC,CAAC;IAxCqB;QAArB,WAAW,CAAC,OAAO,CAAC;;2CAAwB;IAyC/C,eAAC;CAAA,AAjDD,CAAsD,mBAAmB,GAiDxE;SAjDqB,QAAQ","sourcesContent":["import { HostBinding, InjectionToken } from '@angular/core';\nimport { DelegatingValueModel, GarbageCollector, Trace, ValueModel } from '@coolon/pectin';\nimport { assert } from '@coolon/typescript-utilities';\nimport { DisposableComponent } from '../components/disposable-component';\nimport { InteractionContext } from './interaction-context';\n\nexport const ACTIVITY_DATA = new InjectionToken<any>('InteractionActivityData');\n\nexport abstract class Activity<D, R, E = any> extends DisposableComponent {\n\n private readonly _busyModel = new DelegatingValueModel<boolean>().withDefault(false);\n private _activityContext: Activity.Callbacks<R, E>;\n\n // @Trace()\n private _interactionContext: InteractionContext;\n\n @HostBinding('class') class = 'aup-activity';\n\n initialise(nestedInteractionContext: InteractionContext, activityContext: Activity.Callbacks<R, E>): void {\n assert.isNil(this._activityContext);\n this._activityContext = activityContext;\n this._interactionContext = nestedInteractionContext;\n }\n\n get interactionContext() {\n assert.isTruthy(this.isInitialised());\n return this._interactionContext;\n }\n\n done(result?: R): void {\n return this._activityContext.onDone(result);\n }\n\n cancel(error?: E): void {\n this._activityContext.onCancel(error);\n }\n\n // @Trace()\n onActivityReady() {\n }\n\n\n get busy(): ValueModel<boolean> {\n return this._busyModel.readonly;\n }\n\n busyWhile(busyModel: ValueModel<boolean>) {\n this._busyModel.setDelegate(busyModel);\n }\n\n isBusy() {\n return this._busyModel.value;\n }\n\n isInitialised() {\n return !!this._activityContext;\n }\n}\n\nexport namespace Activity {\n\n export interface Callbacks<R, E> {\n onDone: (result: R) => void,\n onCancel: (error: E) => void,\n }\n}\n"]}
|
|
@@ -48,8 +48,8 @@ var ActivityActionsComponent = /** @class */ (function (_super) {
|
|
|
48
48
|
ActivityActionsComponent = __decorate([
|
|
49
49
|
Component({
|
|
50
50
|
selector: 'aup-activity-actions',
|
|
51
|
-
template: "<button mat-icon-button [pectinCommand]=\"cancelCommand\"
|
|
52
|
-
styles: [":host{display:
|
|
51
|
+
template: "<button class=\"cancel\" mat-icon-button [pectinCommand]=\"cancelCommand\">\n <mat-icon>clear</mat-icon>\n</button>\n<button class=\"confirm\" *ngIf=\"!hasConfirmText()\" mat-icon-button [pectinCommand]=\"confirmCommand\">\n <mat-icon>done</mat-icon>\n</button>\n<button class=\"confirm\" *ngIf=\"hasConfirmText()\" mat-button [pectinCommand]=\"confirmCommand\">{{confirmText}}</button>\n<div class=\"content\">\n <ng-content></ng-content>\n</div>\n",
|
|
52
|
+
styles: [":host{display:-ms-grid;display:grid;grid-template-areas:\"cancel confirm content\";-ms-grid-columns:auto auto 1fr;grid-template-columns:auto auto 1fr;-ms-grid-rows:auto;grid-template-rows:auto;align-items:center;justify-content:end}:host.align-end{grid-template-areas:\"content cancel confirm\";-ms-grid-columns:1fr auto auto;grid-template-columns:1fr auto auto}.cancel{-ms-grid-row:1;-ms-grid-column:1;grid-area:cancel}:host.align-end>.cancel{-ms-grid-row:1;-ms-grid-column:2}.confirm{-ms-grid-row:1;-ms-grid-column:2;grid-area:confirm}:host.align-end>.confirm{-ms-grid-row:1;-ms-grid-column:3}.content{-ms-grid-row:1;-ms-grid-column:3;grid-area:content;text-align:left}:host.align-end>.content{-ms-grid-row:1;-ms-grid-column:1}"]
|
|
53
53
|
})
|
|
54
54
|
], ActivityActionsComponent);
|
|
55
55
|
return ActivityActionsComponent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"activity-actions.component.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/interaction/components/activity-actions/activity-actions.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,KAAK,EAAU,MAAM,eAAe,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,CAAC,MAAM,QAAQ,CAAC;AACvB,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAO1D;IAA8C,4CAAmB;IAAjE;QAAA,qEA4BC;QAdC,WAAK,GAAoB,OAAO,CAAC;;IAcnC,CAAC;IAXC,sBAAI,8CAAQ;aAAZ;YACE,OAAO,IAAI,CAAC,KAAK,KAAK,KAAK,CAAC;QAC9B,CAAC;;;OAAA;IAED,2CAAQ,GAAR;IACA,CAAC;IAED,iDAAc,GAAd;QACE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACtC,CAAC;IAtBD;QAFC,KAAK,EAAE;QACP,aAAa,EAAE;kCACA,OAAO;oEAAM;IAG7B;QADC,KAAK,EAAE;;iEACY;IAIpB;QAFC,KAAK,EAAE;QACP,aAAa,EAAE;kCACD,OAAO;mEAAM;IAG5B;QADC,KAAK,EAAE;;2DACyB;IAGjC;QADC,WAAW,CAAC,iBAAiB,CAAC;;;4DAG9B;IAnBU,wBAAwB;QALpC,SAAS,CAAC;YACT,QAAQ,EAAE,sBAAsB;YAChC,
|
|
1
|
+
{"version":3,"file":"activity-actions.component.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/interaction/components/activity-actions/activity-actions.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,KAAK,EAAU,MAAM,eAAe,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,CAAC,MAAM,QAAQ,CAAC;AACvB,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAO1D;IAA8C,4CAAmB;IAAjE;QAAA,qEA4BC;QAdC,WAAK,GAAoB,OAAO,CAAC;;IAcnC,CAAC;IAXC,sBAAI,8CAAQ;aAAZ;YACE,OAAO,IAAI,CAAC,KAAK,KAAK,KAAK,CAAC;QAC9B,CAAC;;;OAAA;IAED,2CAAQ,GAAR;IACA,CAAC;IAED,iDAAc,GAAd;QACE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACtC,CAAC;IAtBD;QAFC,KAAK,EAAE;QACP,aAAa,EAAE;kCACA,OAAO;oEAAM;IAG7B;QADC,KAAK,EAAE;;iEACY;IAIpB;QAFC,KAAK,EAAE;QACP,aAAa,EAAE;kCACD,OAAO;mEAAM;IAG5B;QADC,KAAK,EAAE;;2DACyB;IAGjC;QADC,WAAW,CAAC,iBAAiB,CAAC;;;4DAG9B;IAnBU,wBAAwB;QALpC,SAAS,CAAC;YACT,QAAQ,EAAE,sBAAsB;YAChC,gdAAgD;;SAEjD,CAAC;OACW,wBAAwB,CA4BpC;IAAD,+BAAC;CAAA,AA5BD,CAA8C,mBAAmB,GA4BhE;SA5BY,wBAAwB","sourcesContent":["import { Component, HostBinding, Input, OnInit } from '@angular/core';\nimport { Command, TrackExternal } from '@coolon/pectin';\nimport _ from 'lodash';\nimport { DisposableComponent } from '../../../components';\n\n@Component({\n selector: 'aup-activity-actions',\n templateUrl: './activity-actions.component.html',\n styleUrls: ['./activity-actions.component.scss']\n})\nexport class ActivityActionsComponent extends DisposableComponent implements OnInit {\n\n @Input()\n @TrackExternal()\n confirmCommand: Command<any>;\n\n @Input()\n confirmText: string;\n\n @Input()\n @TrackExternal()\n cancelCommand: Command<any>;\n\n @Input()\n align: 'start' | 'end' = 'start';\n\n @HostBinding('class.align-end')\n get alignEnd(): boolean {\n return this.align === 'end';\n }\n\n ngOnInit() {\n }\n\n hasConfirmText() {\n return !_.isEmpty(this.confirmText);\n }\n\n}\n"]}
|
|
@@ -21,6 +21,8 @@ var ActivityContainerComponent = /** @class */ (function (_super) {
|
|
|
21
21
|
ActivityContainerComponent.prototype.ngAfterViewInit = function () {
|
|
22
22
|
var _this = this;
|
|
23
23
|
var _a = Dsl.disposeWith(this), chain = _a.chain, observe = _a.observe;
|
|
24
|
+
// using the component directly rather than (animationDone)=.. allows us
|
|
25
|
+
// to keep our callback private.
|
|
24
26
|
observe.valuesFrom(this.tabs.animationDone).subscribe(function () { return _this.onAnimationFinished(); });
|
|
25
27
|
};
|
|
26
28
|
ActivityContainerComponent.prototype.initialise = function (identifier, api) {
|
|
@@ -127,6 +129,12 @@ var ActivityContainerComponent = /** @class */ (function (_super) {
|
|
|
127
129
|
ActivityContainerComponent.prototype.finishAndStartCleanup = function () {
|
|
128
130
|
var _this = this;
|
|
129
131
|
if (!this._deferredCleanUp) {
|
|
132
|
+
// Important:
|
|
133
|
+
// Clear our tabs so the next activity triggers a tab change.
|
|
134
|
+
// Without this our animation done wasn't called when a single
|
|
135
|
+
// new activity followed a single tab activity (since we're tracking
|
|
136
|
+
// by activity index)
|
|
137
|
+
this.activityTabs = [];
|
|
130
138
|
var promise = this.interactionServiceApi.notifyFinished(this);
|
|
131
139
|
this._deferredCleanUp = promise
|
|
132
140
|
.finally(function () {
|
|
@@ -138,26 +146,32 @@ var ActivityContainerComponent = /** @class */ (function (_super) {
|
|
|
138
146
|
ActivityContainerComponent.prototype.launchActivity = function (activityRef) {
|
|
139
147
|
var cleanedTabs = this.activityTabs.filter(function (tab) { return !tab.isComplete(); });
|
|
140
148
|
this.activityTabs = cleanedTabs.concat(activityRef);
|
|
141
|
-
this.
|
|
149
|
+
this.synchroniseSelectedTabIndex();
|
|
142
150
|
};
|
|
143
151
|
ActivityContainerComponent.prototype.activityIndex = function (index, activityRef) {
|
|
144
152
|
return index;
|
|
145
153
|
};
|
|
146
154
|
;
|
|
147
|
-
// @Trace()
|
|
148
155
|
ActivityContainerComponent.prototype.onAnimationFinished = function () {
|
|
149
|
-
this.
|
|
150
|
-
|
|
156
|
+
if (this.onAnimationFinishedJob) {
|
|
157
|
+
this.onAnimationFinishedJob();
|
|
158
|
+
this.onAnimationFinishedJob = undefined;
|
|
159
|
+
}
|
|
151
160
|
};
|
|
152
161
|
/**
|
|
153
|
-
* Synchronises the selected tab index.
|
|
162
|
+
* Synchronises the selected tab index.
|
|
154
163
|
*/
|
|
155
|
-
// @Trace()
|
|
156
164
|
ActivityContainerComponent.prototype.synchroniseSelectedTabIndex = function () {
|
|
165
|
+
var _this = this;
|
|
157
166
|
var previousIndex = this.tabs.selectedIndex;
|
|
158
167
|
var newIndex = this.getActiveActivityCount() - 1;
|
|
159
|
-
|
|
160
|
-
|
|
168
|
+
if (previousIndex !== newIndex) {
|
|
169
|
+
this.tabs.selectedIndex = newIndex;
|
|
170
|
+
this.onAnimationFinishedJob = function () {
|
|
171
|
+
_this.getSelectedOutlet().component.onActivityReady();
|
|
172
|
+
_this.activityTabs = _this.activityTabs.filter(function (tab) { return !tab.isComplete(); });
|
|
173
|
+
};
|
|
174
|
+
}
|
|
161
175
|
};
|
|
162
176
|
ActivityContainerComponent.prototype.getSelectedOutlet = function () {
|
|
163
177
|
return this.activityOutlets.toArray()[this.tabs.selectedIndex];
|
|
@@ -194,7 +208,7 @@ var ActivityContainerComponent = /** @class */ (function (_super) {
|
|
|
194
208
|
ActivityContainerComponent = __decorate([
|
|
195
209
|
Component({
|
|
196
210
|
selector: 'aup-activity-container',
|
|
197
|
-
template: "<mat-tab-group #tabs no-tab-header
|
|
211
|
+
template: "<mat-tab-group #tabs no-tab-header\n [dynamicHeight]=\"dynamicHeight\"\n [class.full-height-tabs]=\"!dynamicHeight\">\n <mat-tab *ngFor=\"let tab of activityTabs; trackBy: activityIndex\" >\n <aup-activity-outlet [nestedInteractionContext]=\"this\" [activityRef]=\"tab\"></aup-activity-outlet>\n </mat-tab>\n</mat-tab-group>\n",
|
|
198
212
|
styles: [":host{display:flex;flex-direction:column}mat-tab-group{flex:1}"]
|
|
199
213
|
}),
|
|
200
214
|
__metadata("design:paramtypes", [])
|
package/esm5/lib/interaction/components/activity-container/activity-container.component.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"activity-container.component.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/interaction/components/activity-container/activity-container.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAiB,SAAS,EAAE,KAAK,EAAU,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC5G,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,MAAM,EAA6B,GAAG,EAAE,gBAAgB,EAAE,KAAK,EAAc,MAAM,gBAAgB,CAAC;AAC7G,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACpD,OAAO,CAAC,MAAM,QAAQ,CAAC;AACvB,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAEhF,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AAOtF;IAAyD,8CAA0B;IAqBjF;QAAA,YACE,iBAAO,SACR;QApBD,mBAAa,GAAG,KAAK,CAAC;QAQtB,kBAAY,GAAiC,EAAE,CAAC;QAOxC,aAAO,GAAG,IAAI,gBAAgB,EAAE,CAAC;;IAKzC,CAAC;IAED,6CAAQ,GAAR;IACA,CAAC;IAED,oDAAe,GAAf;QAAA,iBAGC;QAFO,IAAA,0BAA0C,EAAxC,gBAAK,EAAE,oBAAiC,CAAC;QACjD,OAAO,CAAC,UAAU,CAAC,IAAI,C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C,CAAC;IACzE,CAAC;IAED;;OAEG;IACH,WAAW;IACH,gEAA2B,GAAnC;QACE,IAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC;QAC9C,IAAM,QAAQ,GAAG,IAAI,CAAC,sBAAsB,EAAE,GAAG,CAAC,CAAC;QACnD,IAAI,CAAC,IAAI,CAAC,aAAa,GAAG,QAAQ,CAAC;QACnC,OAAO,aAAa,KAAK,QAAQ,CAAC;IACpC,CAAC;IAEO,sDAAiB,GAAzB;QACE,OAAO,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IACjE,CAAC;IAED,WAAW;IACH,8DAAyB,GAAjC;QAAA,iBAQC;QAPC,IAAI,IAAI,CAAC,sBAAsB,EAAE;YAC/B,YAAY,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;SAC3C;QACD,IAAI,CAAC,sBAAsB,GAAG,UAAU,CAAC;YACvC,KAAI,CAAC,sBAAsB,GAAG,IAAI,CAAC;YACnC,KAAI,CAAC,2BAA2B,EAAE,CAAC;QACrC,CAAC,EAAE,EAAE,CAAC,CAAC;IACT,CAAC;IAnLD;QADC,KAAK,EAAE;;qEACc;IAGtB;QADC,SAAS,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;kCAC9B,WAAW;4DAAC;IAGlB;QADC,YAAY,CAAC,uBAAuB,CAAC;kCACrB,SAAS;uEAAyC;IAoDnE;QADC,KAAK,EAAE;;;;6DAMP;IAlEU,0BAA0B;QALtC,SAAS,CAAC;YACT,QAAQ,EAAE,wBAAwB;YAClC,mVAAkD;;SAEnD,CAAC;;OACW,0BAA0B,CAuLtC;IAAD,iCAAC;CAAA,AAvLD,CAAyD,0BAA0B,GAuLlF;SAvLY,0BAA0B","sourcesContent":["import { AfterViewInit, Component, Input, OnInit, QueryList, ViewChild, ViewChildren } from '@angular/core';\nimport { MatTabGroup } from '@angular/material/tabs';\nimport { assert, Constructable, Disposable, Dsl, GarbageCollector, Trace, ValueModel } from '@coolon/pectin';\nimport { lang } from '@coolon/typescript-utilities';\nimport _ from 'lodash';\nimport { AbstractInteractionContext } from '../../abstract-interaction-context';\nimport { Activity } from '../../activity';\nimport { ActivityRef } from '../../activity-ref';\nimport { InteractionService } from '../../services/interaction.service';\nimport { ActivityOutletComponent } from './activity-outlet/activity-outlet.component';\n\n@Component({\n selector: 'aup-activity-container',\n templateUrl: './activity-container.component.html',\n styleUrls: ['./activity-container.component.scss']\n})\nexport class ActivityContainerComponent<D, R, E> extends AbstractInteractionContext implements OnInit, AfterViewInit {\n\n @Input()\n dynamicHeight = false;\n\n @ViewChild('tabs', { static: true })\n tabs: MatTabGroup;\n\n @ViewChildren(ActivityOutletComponent)\n activityOutlets: QueryList<ActivityOutletComponent<any, any, any>>;\n\n activityTabs: ActivityRef<any, any, any>[] = [];\n\n private _identifier: string;\n private _deferredCleanUp: Promise<any>;\n\n private interactionServiceApi: InteractionService.Api;\n\n private garbage = new GarbageCollector();\n private syncSelectedTabTimeout: any;\n\n constructor() {\n super();\n }\n\n ngOnInit() {\n }\n\n ngAfterViewInit(): void {\n const { chain, observe } = Dsl.disposeWith(this);\n observe.valuesFrom(this.tabs.animationDone).subscribe(() => this.onAnimationFinished());\n }\n\n initialise(identifier: string, api: InteractionService.Api) {\n assert.isFalsey(this.isInitialised());\n assert.notNil(identifier);\n assert.notNil(api);\n this._identifier = identifier;\n this.interactionServiceApi = api;\n }\n\n get identifier() {\n return this._identifier;\n }\n\n isInitialised() {\n return !!this.identifier;\n }\n\n /**\n * Returns true if an activity is currently running.\n */\n isActive(): boolean {\n return this.getActiveActivityCount() > 0;\n }\n\n registerDisposable<T extends Disposable>(disposable: T): T {\n return this.garbage.registerDisposable(disposable);\n }\n\n @Trace()\n dispose(): void {\n // TODO: think about auto cancelling any outstanding activity on dispose.\n // See NavigationState.Navigating for a use-case.\n assert.isFalsey(this.isActive());\n this.garbage.dispose();\n }\n\n getActiveActivityRef(): ActivityRef<any, any, any> {\n if (!this.isActive()) {\n lang.illegalState('no activity in progress');\n }\n return _.findLast(this.activityTabs, tab => !tab.isComplete());\n }\n\n /**\n * Cancels the current activity and returns true the context is no longer active, false if\n * there is still another activity running.\n */\n // @Trace()\n async cancelActiveActivity(): Promise<boolean> {\n const activity = this.getActiveActivityRef();\n activity.cancel();\n if (this.isCleaningUp()) {\n return this.waitForInteractionContextCleanupToFinish();\n } else {\n return !this.isActive();\n }\n }\n\n // TODO: this handling of multiple nested activities is only used by the activity component and is not a general case.\n // @Trace()\n protected createAndLaunchActivity<D1, R1, E1>(activityType: Constructable<Activity<D1, R1, E1>>, data: D1, disableClose: boolean): Promise<R1> {\n assert.isTruthy(this.isInitialised()); // make sure we've been initialised\n const activityRef = new ActivityRef<D1, R1, E1>(activityType, data, () => {\n const activeActivityCount = this.getActiveActivityCount() > 0;\n if (activeActivityCount) {\n this.triggerTabSynchronisation();\n } else {\n this.finishAndStartCleanup();\n }\n });\n this.launchActivity(activityRef);\n // if this is the first activity let the interaction service know.\n if (this.activityTabs.length === 1) {\n // console.log('Now active!!!');\n this.interactionServiceApi.notifyActive(this);\n }\n return activityRef.activityResult;\n }\n\n private getActiveActivityCount(): number {\n return this.activityTabs.filter(ref => !ref.isComplete()).length;\n }\n\n /**\n * Checks if this interaction context has finished an is in the process of waiting\n * for all the infrastructure (including route updates) to be completed.\n */\n isCleaningUp(): boolean {\n return !!this._deferredCleanUp;\n }\n\n async waitForInteractionContextCleanupToFinish(): Promise<any> {\n return this._deferredCleanUp ?\n this._deferredCleanUp :\n true;\n }\n\n // @Trace()\n private finishAndStartCleanup(): void {\n if (!this._deferredCleanUp) {\n const promise = this.interactionServiceApi.notifyFinished(this);\n this._deferredCleanUp = promise\n .finally(() => {\n this._deferredCleanUp = null;\n });\n }\n }\n\n// @Trace()\n launchActivity<D1, R1, E1>(activityRef: ActivityRef<D1, R1, E1>) {\n const cleanedTabs = this.activityTabs.filter(tab => !tab.isComplete());\n this.activityTabs = cleanedTabs.concat(activityRef);\n this.tabs.selectedIndex = this.activityTabs.length;\n }\n\n activityIndex(index: number, activityRef: ActivityRef<any, any, any>) {\n return index;\n };\n\n\n // @Trace()\n private onAnimationFinished() {\n this.getSelectedOutlet().component.onActivityReady();\n this.activityTabs = this.activityTabs.filter(tab => !tab.isComplete());\n }\n\n /**\n * Synchronises the selected tab index. Returns true if there was no change to the selected index.\n */\n // @Trace()\n private synchroniseSelectedTabIndex(): boolean {\n const previousIndex = this.tabs.selectedIndex;\n const newIndex = this.getActiveActivityCount() - 1;\n this.tabs.selectedIndex = newIndex;\n return previousIndex === newIndex;\n }\n\n private getSelectedOutlet() {\n return this.activityOutlets.toArray()[this.tabs.selectedIndex];\n }\n\n // @Trace()\n private triggerTabSynchronisation() {\n if (this.syncSelectedTabTimeout) {\n clearTimeout(this.syncSelectedTabTimeout);\n }\n this.syncSelectedTabTimeout = setTimeout(() => {\n this.syncSelectedTabTimeout = null;\n this.synchroniseSelectedTabIndex();\n }, 75);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"activity-container.component.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/interaction/components/activity-container/activity-container.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAiB,SAAS,EAAE,KAAK,EAAU,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC5G,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,MAAM,EAA6B,GAAG,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACjG,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACpD,OAAO,CAAC,MAAM,QAAQ,CAAC;AACvB,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAEhF,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAE,uBA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sBAAsB,GAAG,UAAU,CAAC;YACvC,KAAI,CAAC,sBAAsB,GAAG,IAAI,CAAC;YACnC,KAAI,CAAC,2BAA2B,EAAE,CAAC;QACrC,CAAC,EAAE,EAAE,CAAC,CAAC;IACT,CAAC;IAhMD;QADC,KAAK,EAAE;;qEACc;IAGtB;QADC,SAAS,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;kCAC9B,WAAW;4DAAC;IAGlB;QADC,YAAY,CAAC,uBAAuB,CAAC;kCACrB,SAAS;uEAAyC;IAuDnE;QADC,KAAK,EAAE;;;;6DAMP;IArEU,0BAA0B;QALtC,SAAS,CAAC;YACT,QAAQ,EAAE,wBAAwB;YAClC,mXAAkD;;SAEnD,CAAC;;OACW,0BAA0B,CAoMtC;IAAD,iCAAC;CAAA,AApMD,CAAyD,0BAA0B,GAoMlF;SApMY,0BAA0B","sourcesContent":["import { AfterViewInit, Component, Input, OnInit, QueryList, ViewChild, ViewChildren } from '@angular/core';\nimport { MatTabGroup } from '@angular/material/tabs';\nimport { assert, Constructable, Disposable, Dsl, GarbageCollector, Trace } from '@coolon/pectin';\nimport { lang } from '@coolon/typescript-utilities';\nimport _ from 'lodash';\nimport { AbstractInteractionContext } from '../../abstract-interaction-context';\nimport { Activity } from '../../activity';\nimport { ActivityRef } from '../../activity-ref';\nimport { InteractionService } from '../../services/interaction.service';\nimport { ActivityOutletComponent } from './activity-outlet/activity-outlet.component';\n\n@Component({\n selector: 'aup-activity-container',\n templateUrl: './activity-container.component.html',\n styleUrls: ['./activity-container.component.scss']\n})\nexport class ActivityContainerComponent<D, R, E> extends AbstractInteractionContext implements OnInit, AfterViewInit {\n\n @Input()\n dynamicHeight = false;\n\n @ViewChild('tabs', { static: true })\n tabs: MatTabGroup;\n\n @ViewChildren(ActivityOutletComponent)\n activityOutlets: QueryList<ActivityOutletComponent<any, any, any>>;\n\n activityTabs: ActivityRef<any, any, any>[] = [];\n\n private _identifier: string;\n private _deferredCleanUp: Promise<any>;\n\n private interactionServiceApi: InteractionService.Api;\n\n private garbage = new GarbageCollector();\n private syncSelectedTabTimeout: any;\n private onAnimationFinishedJob: () => void;\n\n constructor() {\n super();\n }\n\n ngOnInit() {\n }\n\n ngAfterViewInit(): void {\n const { chain, observe } = Dsl.disposeWith(this);\n // using the component directly rather than (animationDone)=.. allows us\n // to keep our callback private.\n observe.valuesFrom(this.tabs.animationDone).subscribe(() => this.onAnimationFinished());\n }\n\n initialise(identifier: string, api: InteractionService.Api) {\n assert.isFalsey(this.isInitialised());\n assert.notNil(identifier);\n assert.notNil(api);\n this._identifier = identifier;\n this.interactionServiceApi = api;\n }\n\n get identifier() {\n return this._identifier;\n }\n\n isInitialised() {\n return !!this.identifier;\n }\n\n /**\n * Returns true if an activity is currently running.\n */\n isActive(): boolean {\n return this.getActiveActivityCount() > 0;\n }\n\n registerDisposable<T extends Disposable>(disposable: T): T {\n return this.garbage.registerDisposable(disposable);\n }\n\n @Trace()\n dispose(): void {\n // TODO: think about auto cancelling any outstanding activity on dispose.\n // See NavigationState.Navigating for a use-case.\n assert.isFalsey(this.isActive());\n this.garbage.dispose();\n }\n\n getActiveActivityRef(): ActivityRef<any, any, any> {\n if (!this.isActive()) {\n lang.illegalState('no activity in progress');\n }\n return _.findLast(this.activityTabs, tab => !tab.isComplete());\n }\n\n /**\n * Cancels the current activity and returns true the context is no longer active, false if\n * there is still another activity running.\n */\n // @Trace()\n async cancelActiveActivity(): Promise<boolean> {\n const activity = this.getActiveActivityRef();\n activity.cancel();\n if (this.isCleaningUp()) {\n return this.waitForInteractionContextCleanupToFinish();\n } else {\n return !this.isActive();\n }\n }\n\n // TODO: this handling of multiple nested activities is only used by the activity component and is not a general case.\n // @Trace()\n protected createAndLaunchActivity<D1, R1, E1>(activityType: Constructable<Activity<D1, R1, E1>>, data: D1, disableClose: boolean): Promise<R1> {\n assert.isTruthy(this.isInitialised()); // make sure we've been initialised\n const activityRef = new ActivityRef<D1, R1, E1>(activityType, data, () => {\n const activeActivityCount = this.getActiveActivityCount() > 0;\n if (activeActivityCount) {\n this.triggerTabSynchronisation();\n } else {\n this.finishAndStartCleanup();\n }\n });\n this.launchActivity(activityRef);\n // if this is the first activity let the interaction service know.\n if (this.activityTabs.length === 1) {\n // console.log('Now active!!!');\n this.interactionServiceApi.notifyActive(this);\n }\n return activityRef.activityResult;\n }\n\n private getActiveActivityCount(): number {\n return this.activityTabs.filter(ref => !ref.isComplete()).length;\n }\n\n /**\n * Checks if this interaction context has finished an is in the process of waiting\n * for all the infrastructure (including route updates) to be completed.\n */\n isCleaningUp(): boolean {\n return !!this._deferredCleanUp;\n }\n\n async waitForInteractionContextCleanupToFinish(): Promise<any> {\n return this._deferredCleanUp ?\n this._deferredCleanUp :\n true;\n }\n\n // @Trace()\n private finishAndStartCleanup(): void {\n if (!this._deferredCleanUp) {\n // Important:\n // Clear our tabs so the next activity triggers a tab change.\n // Without this our animation done wasn't called when a single\n // new activity followed a single tab activity (since we're tracking\n // by activity index)\n this.activityTabs = [];\n const promise = this.interactionServiceApi.notifyFinished(this);\n this._deferredCleanUp = promise\n .finally(() => {\n this._deferredCleanUp = null;\n });\n }\n }\n\n// @Trace()\n launchActivity<D1, R1, E1>(activityRef: ActivityRef<D1, R1, E1>) {\n const cleanedTabs = this.activityTabs.filter(tab => !tab.isComplete());\n this.activityTabs = cleanedTabs.concat(activityRef);\n this.synchroniseSelectedTabIndex();\n }\n\n activityIndex(index: number, activityRef: ActivityRef<any, any, any>) {\n return index;\n };\n\n private onAnimationFinished() {\n if (this.onAnimationFinishedJob) {\n this.onAnimationFinishedJob();\n this.onAnimationFinishedJob = undefined;\n }\n }\n\n /**\n * Synchronises the selected tab index.\n */\n private synchroniseSelectedTabIndex(): void {\n const previousIndex = this.tabs.selectedIndex;\n const newIndex = this.getActiveActivityCount() - 1;\n if (previousIndex !== newIndex) {\n this.tabs.selectedIndex = newIndex;\n this.onAnimationFinishedJob = () => {\n this.getSelectedOutlet().component.onActivityReady();\n this.activityTabs = this.activityTabs.filter(tab => !tab.isComplete());\n }\n }\n }\n\n private getSelectedOutlet() {\n return this.activityOutlets.toArray()[this.tabs.selectedIndex];\n }\n\n // @Trace()\n private triggerTabSynchronisation() {\n if (this.syncSelectedTabTimeout) {\n clearTimeout(this.syncSelectedTabTimeout);\n }\n this.syncSelectedTabTimeout = setTimeout(() => {\n this.syncSelectedTabTimeout = null;\n this.synchroniseSelectedTabIndex();\n }, 75);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"activity-outlet.component.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/interaction/components/activity-container/activity-outlet/activity-outlet.component.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,SAAS,EACT,wBAAwB,EACxB,YAAY,EACZ,QAAQ,EACR,KAAK,EACL,MAAM,EACN,gBAAgB,EACjB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACpD,OAAO,EAAY,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGpD;;;GAGG;AAMH;IAsBE,iCACU,wBAAkD,EAClD,gBAAkC,EAClC,QAAkB;QAFlB,6BAAwB,GAAxB,wBAAwB,CAA0B;QAClD,qBAAgB,GAAhB,gBAAgB,CAAkB;QAClC,aAAQ,GAAR,QAAQ,CAAU;IAE5B,CAAC;IAjBD,sBAAI,gDAAW;aAQf;YACE,OAAO,IAAI,CAAC,YAAY,CAAC;QAC3B,CAAC;aAVD,UAAgB,WAAiC;YAC/C,IAAI,IAAI,CAAC,WAAW,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE,EAAE;gBACtD,IAAI,CAAC,YAAY,CAAC,qDAAqD,CAAC,CAAA;aACzE;YACD,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;YAChC,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,CAA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input,\n OnInit,\n ViewContainerRef\n} from '@angular/core';\nimport { assert } from '@coolon/pectin';\nimport { lang } from '@coolon/typescript-utilities';\nimport { Activity, ACTIVITY_DATA } from '../../../activity';\nimport { ActivityRef } from '../../../activity-ref';\nimport { InteractionContext } from '../../../interaction-context';\n\n/**\n * ActivityOutletComponent creates and displays an activity and delegates the interaction context functionality to an\n * external service.\n */\n@Component({\n selector: 'aup-activity-outlet',\n template: '',\n styleUrls: ['./activity-outlet.component.scss']\n})\nexport class ActivityOutletComponent<D, R, E> implements OnInit {\n\n private activityComponentRef: ComponentRef<Activity<D, R, E>>;\n\n @Input()\n nestedInteractionContext: InteractionContext;\n\n private _activityRef: ActivityRef<D, R, E>;\n\n @Input()\n set activityRef(activityRef: ActivityRef<D, R, E>) {\n if (this.activityRef && !this.activityRef.isComplete()) {\n lang.illegalState(\"changing activity before previous one has completed\")\n }\n this._activityRef = activityRef;\n this.loadActivity(activityRef);\n };\n\n get activityRef(): ActivityRef<D, R, E> {\n return this._activityRef;\n }\n\n constructor(\n private componentFactoryResolver: ComponentFactoryResolver,\n private viewContainerRef: ViewContainerRef,\n private injector: Injector\n ) {\n }\n\n ngOnInit() {\n }\n\n loadActivity(activityRef: ActivityRef<D, R, E>) {\n const injector = Injector.create({\n providers: [\n { provide: ACTIVITY_DATA, useValue: activityRef.activityData }\n ],\n parent: this.injector\n });\n const componentFactory = this.componentFactoryResolver.resolveComponentFactory(activityRef.activityClass);\n this.viewContainerRef.clear();\n // console.log(`creating component -> ${activityRef.activityClass.name}`);\n this.activityComponentRef = this.viewContainerRef.createComponent(componentFactory, 0, injector);\n this.activityRef.notifyActivityCreated(this.activityComponentRef.instance, this.nestedInteractionContext);\n }\n\n get component(): Activity<D, R, E> {\n return this.activityComponentRef.instance;\n }\n\n}\n"]}
|
|
1
|
+
{"version":3,"file":"activity-outlet.component.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/interaction/components/activity-container/activity-outlet/activity-outlet.component.ts"],"names":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AAC,KAAK,EAAE,CAAC;QAC9B,0EAA0E;QAC1E,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC,gBAAgB,CAAC,eAAe,CAAC,gBAAgB,EAAE,CAAC,EAAE,QAAQ,CAAC,CAAC;QACjG,IAAI,CAAC,WAAW,CAAC,qBAAqB,CAAC,IAAI,CAAC,oBAAoB,CAAC,QAAQ,EAAE,IAAI,CAAC,wBAAwB,CAAC,CAAC;IAC5G,CAAC;IAED,sBAAI,8CAAS;aAAb;YACE,OAAO,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAC;QAC5C,CAAC;;;OAAA;;gBAzBmC,wBAAwB;gBAChC,gBAAgB;gBACxB,QAAQ;;IApB5B;QADC,KAAK,EAAE;;6EACqC;IAK7C;QADC,KAAK,EAAE;kCACqB,WAAW;yCAAX,WAAW;8DAMvC;IAhBU,uBAAuB;QALnC,SAAS,CAAC;YACT,QAAQ,EAAE,qBAAqB;YAC/B,QAAQ,EAAE,EAAE;;SAEb,CAAC;yCAwBoC,wBAAwB;YAChC,gBAAgB;YACxB,QAAQ;OAzBjB,uBAAuB,CAkDnC;IAAD,8BAAC;CAAA,AAlDD,IAkDC;SAlDY,uBAAuB","sourcesContent":["import {\n Component,\n ComponentFactoryResolver,\n ComponentRef,\n Injector,\n Input,\n OnInit,\n ViewContainerRef\n} from '@angular/core';\nimport { assert, Trace } from '@coolon/pectin';\nimport { lang } from '@coolon/typescript-utilities';\nimport { Activity, ACTIVITY_DATA } from '../../../activity';\nimport { ActivityRef } from '../../../activity-ref';\nimport { InteractionContext } from '../../../interaction-context';\n\n/**\n * ActivityOutletComponent creates and displays an activity and delegates the interaction context functionality to an\n * external service.\n */\n@Component({\n selector: 'aup-activity-outlet',\n template: '',\n styleUrls: ['./activity-outlet.component.scss']\n})\nexport class ActivityOutletComponent<D, R, E> implements OnInit {\n\n private activityComponentRef: ComponentRef<Activity<D, R, E>>;\n\n @Input()\n nestedInteractionContext: InteractionContext;\n\n private _activityRef: ActivityRef<D, R, E>;\n\n @Input()\n set activityRef(activityRef: ActivityRef<D, R, E>) {\n if (this.activityRef && !this.activityRef.isComplete()) {\n lang.illegalState(\"changing activity before previous one has completed\")\n }\n this._activityRef = activityRef;\n this.loadActivity(activityRef);\n };\n\n get activityRef(): ActivityRef<D, R, E> {\n return this._activityRef;\n }\n\n constructor(\n private componentFactoryResolver: ComponentFactoryResolver,\n private viewContainerRef: ViewContainerRef,\n private injector: Injector\n ) {\n }\n\n ngOnInit() {\n }\n\n loadActivity(activityRef: ActivityRef<D, R, E>) {\n const injector = Injector.create({\n providers: [\n { provide: ACTIVITY_DATA, useValue: activityRef.activityData }\n ],\n parent: this.injector\n });\n const componentFactory = this.componentFactoryResolver.resolveComponentFactory(activityRef.activityClass);\n this.viewContainerRef.clear();\n // console.log(`creating component -> ${activityRef.activityClass.name}`);\n this.activityComponentRef = this.viewContainerRef.createComponent(componentFactory, 0, injector);\n this.activityRef.notifyActivityCreated(this.activityComponentRef.instance, this.nestedInteractionContext);\n }\n\n get component(): Activity<D, R, E> {\n return this.activityComponentRef.instance;\n }\n\n}\n"]}
|