@rxap/material-table-system 12.5.3 → 13.0.0-next.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/_theming.scss +1 -1
- package/esm2020/index.mjs +91 -0
- package/esm2020/lib/cells/boolean-cell/boolean-cell.component.mjs +19 -0
- package/esm2020/lib/cells/boolean-cell/boolean-cell.component.module.mjs +26 -0
- package/esm2020/lib/cells/copy-to-clipboard-cell/copy-to-clipboard-cell.component.mjs +16 -0
- package/esm2020/lib/cells/copy-to-clipboard-cell/copy-to-clipboard-cell.component.module.mjs +26 -0
- package/esm2020/lib/cells/date-cell/date-cell.component.mjs +21 -0
- package/esm2020/lib/cells/date-cell/date-cell.component.module.mjs +22 -0
- package/esm2020/lib/cells/icon-cell/icon-cell.component.mjs +17 -0
- package/esm2020/lib/cells/icon-cell/icon-cell.component.module.mjs +30 -0
- package/esm2020/lib/cells/image-cell/image-cell.component.mjs +31 -0
- package/esm2020/lib/cells/image-cell/image-cell.component.module.mjs +19 -0
- package/esm2020/lib/cells/link-cell/link-cell.component.mjs +26 -0
- package/esm2020/lib/cells/link-cell/link-cell.component.module.mjs +34 -0
- package/esm2020/lib/cells/options-cell/options-cell.component.mjs +56 -0
- package/esm2020/lib/cells/options-cell/options-cell.component.module.mjs +17 -0
- package/esm2020/lib/expand-row/expand-controls-cell/expand-controls-cell.component.mjs +30 -0
- package/esm2020/lib/expand-row/expand-controls-cell/expand-controls-cell.component.module.mjs +30 -0
- package/esm2020/lib/expand-row/expand-row-container/expand-row-container.component.mjs +65 -0
- package/esm2020/lib/expand-row/expand-row-container/expand-row-container.component.module.mjs +35 -0
- package/esm2020/lib/expand-row/expand-row-container/expand-row-content.directive.mjs +22 -0
- package/esm2020/lib/expand-row/expand-row.directive.mjs +41 -0
- package/esm2020/lib/expand-row/expand-row.module.mjs +31 -0
- package/esm2020/lib/expand-row/expand-row.service.mjs +29 -0
- package/esm2020/lib/persistent-paginator.directive.mjs +62 -0
- package/esm2020/lib/row-animation.mjs +25 -0
- package/esm2020/lib/select-row/checkbox-cell/checkbox-cell.component.mjs +28 -0
- package/esm2020/lib/select-row/checkbox-cell/checkbox-cell.component.module.mjs +26 -0
- package/esm2020/lib/select-row/checkbox-header-cell/checkbox-header-cell.component.mjs +45 -0
- package/esm2020/lib/select-row/checkbox-header-cell/checkbox-header-cell.component.module.mjs +26 -0
- package/esm2020/lib/select-row/select-row.module.mjs +25 -0
- package/esm2020/lib/select-row/select-row.options.mjs +2 -0
- package/esm2020/lib/select-row/select-row.service.mjs +29 -0
- package/esm2020/lib/select-row/selected-rows.directive.mjs +46 -0
- package/esm2020/lib/select-row/tokens.mjs +3 -0
- package/esm2020/lib/table-column-menu/table-column-menu.component.mjs +58 -0
- package/esm2020/lib/table-column-menu/table-column-menu.component.module.mjs +47 -0
- package/esm2020/lib/table-column-menu/table-column-option/table-column-option.component.mjs +63 -0
- package/esm2020/lib/table-column-menu/table-show-archived-slide/table-show-archived-slide.component.mjs +30 -0
- package/esm2020/lib/table-column-menu/table-show-archived-slide/table-show-archived-slide.component.module.mjs +26 -0
- package/esm2020/lib/table-create-button/table-create-button.directive.mjs +69 -0
- package/esm2020/lib/table-create-button/tokens.mjs +3 -0
- package/esm2020/lib/table-data-source.directive.mjs +169 -0
- package/esm2020/lib/table-filter/filter-header-row.directive.mjs +55 -0
- package/esm2020/lib/table-filter/table-filter.module.mjs +25 -0
- package/esm2020/lib/table-filter/table-filter.service.mjs +36 -0
- package/esm2020/lib/table-filter/to-filter-column-names.pipe.mjs +16 -0
- package/esm2020/lib/table-filter/tokens.mjs +3 -0
- package/esm2020/lib/table-row-actions/decorators.mjs +8 -0
- package/esm2020/lib/table-row-actions/table-row-action-executing.directive.mjs +23 -0
- package/esm2020/lib/table-row-actions/table-row-action-status.mjs +8 -0
- package/esm2020/lib/table-row-actions/table-row-action.directive.mjs +196 -0
- package/esm2020/lib/table-row-actions/table-row-action.method.mjs +11 -0
- package/esm2020/lib/table-row-actions/table-row-actions.module.mjs +53 -0
- package/esm2020/lib/table-row-actions/table-row-header-action.directive.mjs +86 -0
- package/esm2020/lib/table-row-actions/tokens.mjs +3 -0
- package/esm2020/lib/table-row-controls/row-controls-cell/row-controls-cell.component.mjs +116 -0
- package/esm2020/lib/table-row-controls/row-controls-cell/row-controls-cell.component.module.mjs +42 -0
- package/esm2020/lib/table-row-controls/row-controls-header-cell/row-controls-header-cell.component.mjs +94 -0
- package/esm2020/lib/table-row-controls/row-controls-header-cell/row-controls-header-cell.component.module.mjs +42 -0
- package/esm2020/lib/table-row-controls/table-row-controls.module.mjs +21 -0
- package/esm2020/lib/table-row-controls/tokens.mjs +9 -0
- package/esm2020/lib/table-row-metadata.mjs +2 -0
- package/esm2020/lib/table-select-controls/table-select-controls.component.mjs +32 -0
- package/esm2020/lib/table-select-controls/table-select-controls.component.module.mjs +30 -0
- package/esm2020/rxap-material-table-system.mjs +5 -0
- package/fesm2015/rxap-material-table-system.mjs +2102 -0
- package/fesm2015/rxap-material-table-system.mjs.map +1 -0
- package/{fesm2015/rxap-material-table-system.js → fesm2020/rxap-material-table-system.mjs} +322 -468
- package/fesm2020/rxap-material-table-system.mjs.map +1 -0
- package/package.json +51 -37
- package/src/schematics/ng-add/index.js +1 -1
- package/src/schematics/ng-add/index.js.map +1 -1
- package/bundles/rxap-material-table-system.umd.js +0 -2896
- package/bundles/rxap-material-table-system.umd.js.map +0 -1
- package/esm2015/index.js +0 -91
- package/esm2015/index.js.map +0 -1
- package/esm2015/lib/cells/boolean-cell/boolean-cell.component.js +0 -25
- package/esm2015/lib/cells/boolean-cell/boolean-cell.component.js.map +0 -1
- package/esm2015/lib/cells/boolean-cell/boolean-cell.component.module.js +0 -26
- package/esm2015/lib/cells/boolean-cell/boolean-cell.component.module.js.map +0 -1
- package/esm2015/lib/cells/copy-to-clipboard-cell/copy-to-clipboard-cell.component.js +0 -22
- package/esm2015/lib/cells/copy-to-clipboard-cell/copy-to-clipboard-cell.component.js.map +0 -1
- package/esm2015/lib/cells/copy-to-clipboard-cell/copy-to-clipboard-cell.component.module.js +0 -26
- package/esm2015/lib/cells/copy-to-clipboard-cell/copy-to-clipboard-cell.component.module.js.map +0 -1
- package/esm2015/lib/cells/date-cell/date-cell.component.js +0 -27
- package/esm2015/lib/cells/date-cell/date-cell.component.js.map +0 -1
- package/esm2015/lib/cells/date-cell/date-cell.component.module.js +0 -22
- package/esm2015/lib/cells/date-cell/date-cell.component.module.js.map +0 -1
- package/esm2015/lib/cells/icon-cell/icon-cell.component.js +0 -23
- package/esm2015/lib/cells/icon-cell/icon-cell.component.js.map +0 -1
- package/esm2015/lib/cells/icon-cell/icon-cell.component.module.js +0 -30
- package/esm2015/lib/cells/icon-cell/icon-cell.component.module.js.map +0 -1
- package/esm2015/lib/cells/image-cell/image-cell.component.js +0 -37
- package/esm2015/lib/cells/image-cell/image-cell.component.js.map +0 -1
- package/esm2015/lib/cells/image-cell/image-cell.component.module.js +0 -19
- package/esm2015/lib/cells/image-cell/image-cell.component.module.js.map +0 -1
- package/esm2015/lib/cells/link-cell/link-cell.component.js +0 -32
- package/esm2015/lib/cells/link-cell/link-cell.component.js.map +0 -1
- package/esm2015/lib/cells/link-cell/link-cell.component.module.js +0 -34
- package/esm2015/lib/cells/link-cell/link-cell.component.module.js.map +0 -1
- package/esm2015/lib/cells/options-cell/options-cell.component.js +0 -63
- package/esm2015/lib/cells/options-cell/options-cell.component.js.map +0 -1
- package/esm2015/lib/cells/options-cell/options-cell.component.module.js +0 -17
- package/esm2015/lib/cells/options-cell/options-cell.component.module.js.map +0 -1
- package/esm2015/lib/expand-row/expand-controls-cell/expand-controls-cell.component.js +0 -37
- package/esm2015/lib/expand-row/expand-controls-cell/expand-controls-cell.component.js.map +0 -1
- package/esm2015/lib/expand-row/expand-controls-cell/expand-controls-cell.component.module.js +0 -30
- package/esm2015/lib/expand-row/expand-controls-cell/expand-controls-cell.component.module.js.map +0 -1
- package/esm2015/lib/expand-row/expand-row-container/expand-row-container.component.js +0 -74
- package/esm2015/lib/expand-row/expand-row-container/expand-row-container.component.js.map +0 -1
- package/esm2015/lib/expand-row/expand-row-container/expand-row-container.component.module.js +0 -35
- package/esm2015/lib/expand-row/expand-row-container/expand-row-container.component.module.js.map +0 -1
- package/esm2015/lib/expand-row/expand-row-container/expand-row-content.directive.js +0 -22
- package/esm2015/lib/expand-row/expand-row-container/expand-row-content.directive.js.map +0 -1
- package/esm2015/lib/expand-row/expand-row.directive.js +0 -41
- package/esm2015/lib/expand-row/expand-row.directive.js.map +0 -1
- package/esm2015/lib/expand-row/expand-row.module.js +0 -31
- package/esm2015/lib/expand-row/expand-row.module.js.map +0 -1
- package/esm2015/lib/expand-row/expand-row.service.js +0 -29
- package/esm2015/lib/expand-row/expand-row.service.js.map +0 -1
- package/esm2015/lib/persistent-paginator.directive.js +0 -63
- package/esm2015/lib/persistent-paginator.directive.js.map +0 -1
- package/esm2015/lib/row-animation.js +0 -25
- package/esm2015/lib/row-animation.js.map +0 -1
- package/esm2015/lib/select-row/checkbox-cell/checkbox-cell.component.js +0 -34
- package/esm2015/lib/select-row/checkbox-cell/checkbox-cell.component.js.map +0 -1
- package/esm2015/lib/select-row/checkbox-cell/checkbox-cell.component.module.js +0 -26
- package/esm2015/lib/select-row/checkbox-cell/checkbox-cell.component.module.js.map +0 -1
- package/esm2015/lib/select-row/checkbox-header-cell/checkbox-header-cell.component.js +0 -51
- package/esm2015/lib/select-row/checkbox-header-cell/checkbox-header-cell.component.js.map +0 -1
- package/esm2015/lib/select-row/checkbox-header-cell/checkbox-header-cell.component.module.js +0 -26
- package/esm2015/lib/select-row/checkbox-header-cell/checkbox-header-cell.component.module.js.map +0 -1
- package/esm2015/lib/select-row/select-row.module.js +0 -25
- package/esm2015/lib/select-row/select-row.module.js.map +0 -1
- package/esm2015/lib/select-row/select-row.options.js +0 -2
- package/esm2015/lib/select-row/select-row.options.js.map +0 -1
- package/esm2015/lib/select-row/select-row.service.js +0 -29
- package/esm2015/lib/select-row/select-row.service.js.map +0 -1
- package/esm2015/lib/select-row/selected-rows.directive.js +0 -47
- package/esm2015/lib/select-row/selected-rows.directive.js.map +0 -1
- package/esm2015/lib/select-row/tokens.js +0 -3
- package/esm2015/lib/select-row/tokens.js.map +0 -1
- package/esm2015/lib/table-column-menu/table-column-menu.component.js +0 -63
- package/esm2015/lib/table-column-menu/table-column-menu.component.js.map +0 -1
- package/esm2015/lib/table-column-menu/table-column-menu.component.module.js +0 -47
- package/esm2015/lib/table-column-menu/table-column-menu.component.module.js.map +0 -1
- package/esm2015/lib/table-column-menu/table-column-option/table-column-option.component.js +0 -67
- package/esm2015/lib/table-column-menu/table-column-option/table-column-option.component.js.map +0 -1
- package/esm2015/lib/table-column-menu/table-show-archived-slide/table-show-archived-slide.component.js +0 -36
- package/esm2015/lib/table-column-menu/table-show-archived-slide/table-show-archived-slide.component.js.map +0 -1
- package/esm2015/lib/table-column-menu/table-show-archived-slide/table-show-archived-slide.component.module.js +0 -26
- package/esm2015/lib/table-column-menu/table-show-archived-slide/table-show-archived-slide.component.module.js.map +0 -1
- package/esm2015/lib/table-create-button/table-create-button.directive.js +0 -71
- package/esm2015/lib/table-create-button/table-create-button.directive.js.map +0 -1
- package/esm2015/lib/table-create-button/tokens.js +0 -3
- package/esm2015/lib/table-create-button/tokens.js.map +0 -1
- package/esm2015/lib/table-data-source.directive.js +0 -172
- package/esm2015/lib/table-data-source.directive.js.map +0 -1
- package/esm2015/lib/table-filter/filter-header-row.directive.js +0 -56
- package/esm2015/lib/table-filter/filter-header-row.directive.js.map +0 -1
- package/esm2015/lib/table-filter/table-filter.module.js +0 -25
- package/esm2015/lib/table-filter/table-filter.module.js.map +0 -1
- package/esm2015/lib/table-filter/table-filter.service.js +0 -36
- package/esm2015/lib/table-filter/table-filter.service.js.map +0 -1
- package/esm2015/lib/table-filter/to-filter-column-names.pipe.js +0 -16
- package/esm2015/lib/table-filter/to-filter-column-names.pipe.js.map +0 -1
- package/esm2015/lib/table-filter/tokens.js +0 -3
- package/esm2015/lib/table-filter/tokens.js.map +0 -1
- package/esm2015/lib/table-row-actions/decorators.js +0 -8
- package/esm2015/lib/table-row-actions/decorators.js.map +0 -1
- package/esm2015/lib/table-row-actions/table-row-action-executing.directive.js +0 -23
- package/esm2015/lib/table-row-actions/table-row-action-executing.directive.js.map +0 -1
- package/esm2015/lib/table-row-actions/table-row-action-status.js +0 -8
- package/esm2015/lib/table-row-actions/table-row-action-status.js.map +0 -1
- package/esm2015/lib/table-row-actions/table-row-action.directive.js +0 -199
- package/esm2015/lib/table-row-actions/table-row-action.directive.js.map +0 -1
- package/esm2015/lib/table-row-actions/table-row-action.method.js +0 -11
- package/esm2015/lib/table-row-actions/table-row-action.method.js.map +0 -1
- package/esm2015/lib/table-row-actions/table-row-actions.module.js +0 -53
- package/esm2015/lib/table-row-actions/table-row-actions.module.js.map +0 -1
- package/esm2015/lib/table-row-actions/table-row-header-action.directive.js +0 -88
- package/esm2015/lib/table-row-actions/table-row-header-action.directive.js.map +0 -1
- package/esm2015/lib/table-row-actions/tokens.js +0 -3
- package/esm2015/lib/table-row-actions/tokens.js.map +0 -1
- package/esm2015/lib/table-row-controls/row-controls-cell/row-controls-cell.component.js +0 -134
- package/esm2015/lib/table-row-controls/row-controls-cell/row-controls-cell.component.js.map +0 -1
- package/esm2015/lib/table-row-controls/row-controls-cell/row-controls-cell.component.module.js +0 -42
- package/esm2015/lib/table-row-controls/row-controls-cell/row-controls-cell.component.module.js.map +0 -1
- package/esm2015/lib/table-row-controls/row-controls-header-cell/row-controls-header-cell.component.js +0 -117
- package/esm2015/lib/table-row-controls/row-controls-header-cell/row-controls-header-cell.component.js.map +0 -1
- package/esm2015/lib/table-row-controls/row-controls-header-cell/row-controls-header-cell.component.module.js +0 -42
- package/esm2015/lib/table-row-controls/row-controls-header-cell/row-controls-header-cell.component.module.js.map +0 -1
- package/esm2015/lib/table-row-controls/table-row-controls.module.js +0 -21
- package/esm2015/lib/table-row-controls/table-row-controls.module.js.map +0 -1
- package/esm2015/lib/table-row-controls/tokens.js +0 -9
- package/esm2015/lib/table-row-controls/tokens.js.map +0 -1
- package/esm2015/lib/table-row-metadata.js +0 -2
- package/esm2015/lib/table-row-metadata.js.map +0 -1
- package/esm2015/lib/table-select-controls/table-select-controls.component.js +0 -39
- package/esm2015/lib/table-select-controls/table-select-controls.component.js.map +0 -1
- package/esm2015/lib/table-select-controls/table-select-controls.component.module.js +0 -30
- package/esm2015/lib/table-select-controls/table-select-controls.component.module.js.map +0 -1
- package/esm2015/rxap-material-table-system.js +0 -5
- package/esm2015/rxap-material-table-system.js.map +0 -1
- package/fesm2015/rxap-material-table-system.js.map +0 -1
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
import { __decorate, __metadata } from "tslib";
|
|
2
|
-
import { ChangeDetectorRef, Directive, Inject, InjectionToken, Input, NgModule, Optional } from '@angular/core';
|
|
3
|
-
import { Subscription } from 'rxjs';
|
|
4
|
-
import { MatSort } from '@angular/material/sort';
|
|
5
|
-
import { DynamicTableDataSource } from '@rxap/data-source/table';
|
|
6
|
-
import { CdkTable } from '@angular/cdk/table';
|
|
7
|
-
import { TableFilterService } from './table-filter/table-filter.service';
|
|
8
|
-
import { debounceTime, delay, filter, tap } from 'rxjs/operators';
|
|
9
|
-
import { Required } from '@rxap/utilities';
|
|
10
|
-
import { ToggleSubject } from '@rxap/utilities/rxjs';
|
|
11
|
-
import { pipeDataSource } from '@rxap/data-source';
|
|
12
|
-
import * as i0 from "@angular/core";
|
|
13
|
-
import * as i1 from "@angular/cdk/table";
|
|
14
|
-
import * as i2 from "@angular/material/sort";
|
|
15
|
-
import * as i3 from "./table-filter/table-filter.service";
|
|
16
|
-
// TODO : add migration schematic
|
|
17
|
-
export const RXAP_TABLE_METHOD = new InjectionToken('rxap/material/table-system/table-method');
|
|
18
|
-
/**
|
|
19
|
-
* @deprecated use TABLE_METHOD instead
|
|
20
|
-
*/
|
|
21
|
-
export const TABLE_REMOTE_METHOD = RXAP_TABLE_METHOD;
|
|
22
|
-
export const TABLE_REMOTE_METHOD_ADAPTER_FACTORY = new InjectionToken('table-remote-method-adapter-factory');
|
|
23
|
-
export const RXAP_TABLE_FILTER = new InjectionToken('rxap/material-table-system/table-filter');
|
|
24
|
-
export const TABLE_DATA_SOURCE = new InjectionToken('table-data-source');
|
|
25
|
-
export class TableDataSourceDirective {
|
|
26
|
-
constructor(matTable, cdr, sourceMethod, sourceDataSource, adapterFactory, matSort, tableFilter, _tableFilter) {
|
|
27
|
-
this.matTable = matTable;
|
|
28
|
-
this.cdr = cdr;
|
|
29
|
-
this.sourceMethod = sourceMethod;
|
|
30
|
-
this.sourceDataSource = sourceDataSource;
|
|
31
|
-
this.matSort = matSort;
|
|
32
|
-
this.tableFilter = tableFilter;
|
|
33
|
-
this._tableFilter = _tableFilter;
|
|
34
|
-
this.loading$ = new ToggleSubject(true);
|
|
35
|
-
this._subscription = new Subscription();
|
|
36
|
-
this.adapterFactory = null;
|
|
37
|
-
this.matTable.trackBy = this.trackBy;
|
|
38
|
-
this.adapterFactory = adapterFactory;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* @deprecated use dataSource instead
|
|
42
|
-
*/
|
|
43
|
-
set setDataSource(dataSource) {
|
|
44
|
-
if (typeof dataSource !== 'string') {
|
|
45
|
-
this.dataSource = dataSource;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* @deprecated use method instead
|
|
50
|
-
*/
|
|
51
|
-
get remoteMethod() {
|
|
52
|
-
return this.method;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* @deprecated use sourceMethod instead
|
|
56
|
-
*/
|
|
57
|
-
get sourceRemoteMethod() {
|
|
58
|
-
return this.sourceMethod;
|
|
59
|
-
}
|
|
60
|
-
trackBy(index, item) {
|
|
61
|
-
var _a;
|
|
62
|
-
return (_a = item.uuid) !== null && _a !== void 0 ? _a : index;
|
|
63
|
-
}
|
|
64
|
-
ngOnInit() {
|
|
65
|
-
var _a, _b, _c, _d;
|
|
66
|
-
const tableFilter = (_b = (_a = this._tableFilter) !== null && _a !== void 0 ? _a : this.tableFilter) !== null && _b !== void 0 ? _b : undefined;
|
|
67
|
-
if (this.sourceMethod) {
|
|
68
|
-
if (this.adapterFactory) {
|
|
69
|
-
this.method = this.adapterFactory(this.sourceMethod, this.paginator, this.matSort, tableFilter, this.parameters);
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
this.method = this.sourceMethod;
|
|
73
|
-
}
|
|
74
|
-
this.dataSource = new DynamicTableDataSource(this.method, this.paginator, this.matSort, tableFilter, this.parameters, (_c = this.method.metadata) !== null && _c !== void 0 ? _c : { id: this.id });
|
|
75
|
-
}
|
|
76
|
-
else if (this.sourceDataSource) {
|
|
77
|
-
this.dataSource = this.sourceDataSource;
|
|
78
|
-
}
|
|
79
|
-
else if (!this.dataSource) {
|
|
80
|
-
throw new Error('The TABLE_DATA_SOURCE and TABLE_METHOD token are not defined!');
|
|
81
|
-
}
|
|
82
|
-
this.dataSource.paginator = this.paginator;
|
|
83
|
-
this.dataSource.sort = (_d = this.matSort) !== null && _d !== void 0 ? _d : undefined;
|
|
84
|
-
this.dataSource.filter = tableFilter;
|
|
85
|
-
this.dataSource.parameters = this.parameters;
|
|
86
|
-
this._subscription.add(this.dataSource.loading$.pipe(tap(loading => this.loading$.next(!!loading))).subscribe());
|
|
87
|
-
this.matTable.dataSource = pipeDataSource(this.dataSource, tap(rowList => rowList.forEach((element) => {
|
|
88
|
-
element.__metadata__ = { loading$: new ToggleSubject() };
|
|
89
|
-
})));
|
|
90
|
-
// TODO : remove hack to trigger change detection after data source refresh (machine-definition -> physical unit)
|
|
91
|
-
this._subscription.add(this.loading$
|
|
92
|
-
.pipe(filter((loading) => !loading), debounceTime(2000), tap(() => this.cdr.detectChanges()), tap(() => this.cdr.markForCheck()), delay(500), tap(() => this.cdr.detectChanges()), tap(() => this.cdr.markForCheck()), delay(500), tap(() => this.cdr.detectChanges()), tap(() => this.cdr.markForCheck()), delay(500), tap(() => this.cdr.detectChanges()), tap(() => this.cdr.markForCheck()), delay(500), tap(() => this.cdr.detectChanges()), tap(() => this.cdr.markForCheck()), delay(500), tap(() => this.cdr.detectChanges()), tap(() => this.cdr.markForCheck()), delay(500))
|
|
93
|
-
.subscribe());
|
|
94
|
-
}
|
|
95
|
-
ngOnDestroy() {
|
|
96
|
-
this._subscription.unsubscribe();
|
|
97
|
-
}
|
|
98
|
-
refresh() {
|
|
99
|
-
var _a;
|
|
100
|
-
(_a = this.dataSource) === null || _a === void 0 ? void 0 : _a.refresh();
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
TableDataSourceDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: TableDataSourceDirective, deps: [{ token: CdkTable }, { token: i0.ChangeDetectorRef }, { token: RXAP_TABLE_METHOD, optional: true }, { token: TABLE_DATA_SOURCE, optional: true }, { token: TABLE_REMOTE_METHOD_ADAPTER_FACTORY, optional: true }, { token: MatSort, optional: true }, { token: TableFilterService, optional: true }, { token: RXAP_TABLE_FILTER, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
104
|
-
TableDataSourceDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.0.1", type: TableDataSourceDirective, selector: "table[mat-table][rxapTableDataSource],mat-table[rxapTableDataSource]", inputs: { setDataSource: ["rxapTableDataSource", "setDataSource"], paginator: "paginator", id: "id", parameters: "parameters", dataSource: "dataSource" }, exportAs: ["rxapTableDataSource"], ngImport: i0 });
|
|
105
|
-
__decorate([
|
|
106
|
-
Required,
|
|
107
|
-
__metadata("design:type", String)
|
|
108
|
-
], TableDataSourceDirective.prototype, "id", void 0);
|
|
109
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: TableDataSourceDirective, decorators: [{
|
|
110
|
-
type: Directive,
|
|
111
|
-
args: [{
|
|
112
|
-
selector: 'table[mat-table][rxapTableDataSource],mat-table[rxapTableDataSource]',
|
|
113
|
-
exportAs: 'rxapTableDataSource'
|
|
114
|
-
}]
|
|
115
|
-
}], ctorParameters: function () { return [{ type: i1.CdkTable, decorators: [{
|
|
116
|
-
type: Inject,
|
|
117
|
-
args: [CdkTable]
|
|
118
|
-
}] }, { type: i0.ChangeDetectorRef }, { type: undefined, decorators: [{
|
|
119
|
-
type: Optional
|
|
120
|
-
}, {
|
|
121
|
-
type: Inject,
|
|
122
|
-
args: [RXAP_TABLE_METHOD]
|
|
123
|
-
}] }, { type: undefined, decorators: [{
|
|
124
|
-
type: Optional
|
|
125
|
-
}, {
|
|
126
|
-
type: Inject,
|
|
127
|
-
args: [TABLE_DATA_SOURCE]
|
|
128
|
-
}] }, { type: undefined, decorators: [{
|
|
129
|
-
type: Optional
|
|
130
|
-
}, {
|
|
131
|
-
type: Inject,
|
|
132
|
-
args: [TABLE_REMOTE_METHOD_ADAPTER_FACTORY]
|
|
133
|
-
}] }, { type: i2.MatSort, decorators: [{
|
|
134
|
-
type: Optional
|
|
135
|
-
}, {
|
|
136
|
-
type: Inject,
|
|
137
|
-
args: [MatSort]
|
|
138
|
-
}] }, { type: i3.TableFilterService, decorators: [{
|
|
139
|
-
type: Optional
|
|
140
|
-
}, {
|
|
141
|
-
type: Inject,
|
|
142
|
-
args: [TableFilterService]
|
|
143
|
-
}] }, { type: undefined, decorators: [{
|
|
144
|
-
type: Optional
|
|
145
|
-
}, {
|
|
146
|
-
type: Inject,
|
|
147
|
-
args: [RXAP_TABLE_FILTER]
|
|
148
|
-
}] }]; }, propDecorators: { setDataSource: [{
|
|
149
|
-
type: Input,
|
|
150
|
-
args: ['rxapTableDataSource']
|
|
151
|
-
}], paginator: [{
|
|
152
|
-
type: Input
|
|
153
|
-
}], id: [{
|
|
154
|
-
type: Input
|
|
155
|
-
}], parameters: [{
|
|
156
|
-
type: Input
|
|
157
|
-
}], dataSource: [{
|
|
158
|
-
type: Input
|
|
159
|
-
}] } });
|
|
160
|
-
export class TableDataSourceModule {
|
|
161
|
-
}
|
|
162
|
-
TableDataSourceModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: TableDataSourceModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
163
|
-
TableDataSourceModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: TableDataSourceModule, declarations: [TableDataSourceDirective], exports: [TableDataSourceDirective] });
|
|
164
|
-
TableDataSourceModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: TableDataSourceModule });
|
|
165
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: TableDataSourceModule, decorators: [{
|
|
166
|
-
type: NgModule,
|
|
167
|
-
args: [{
|
|
168
|
-
exports: [TableDataSourceDirective],
|
|
169
|
-
declarations: [TableDataSourceDirective],
|
|
170
|
-
}]
|
|
171
|
-
}] });
|
|
172
|
-
//# sourceMappingURL=table-data-source.directive.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"table-data-source.directive.js","sourceRoot":"","sources":["../../../../../../libs/material/table-system/src/lib/table-data-source.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,iBAAiB,EACjB,SAAS,EACT,MAAM,EACN,cAAc,EACd,KAAK,EACL,QAAQ,EAGR,QAAQ,EACT,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAKjD,OAAO,EACL,sBAAsB,EAGvB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO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AGnC,OAAO,6BAGP,kBAAkB,6BAGlB,iBAAiB;yGAtEhB,wBAAwB;AAmBnC;IADC,QAAQ;;oDACU;2FAnBR,wBAAwB;kBALpC,SAAS;mBAAC;oBACT,QAAQ,EACE,sEAAsE;oBAChF,QAAQ,EAAE,qBAAqB;iBAChC;;0BAmDI,MAAM;2BAAC,QAAQ;;0BAGf,QAAQ;;0BACR,MAAM;2BAAC,iBAAiB;;0BAGxB,QAAQ;;0BACR,MAAM;2BAAC,iBAAiB;;0BAExB,QAAQ;;0BACR,MAAM;2BAAC,mCAAmC;;0BAE1C,QAAQ;;0BACR,MAAM;2BAAC,OAAO;;0BAEd,QAAQ;;0BACR,MAAM;2BAAC,kBAAkB;;0BAEzB,QAAQ;;0BACR,MAAM;2BAAC,iBAAiB;4CAhEhB,aAAa;sBADvB,KAAK;uBAAC,qBAAqB;gBAQrB,SAAS;sBADf,KAAK;gBAOC,EAAE;sBAFR,KAAK;gBAIC,UAAU;sBADhB,KAAK;gBAGC,UAAU;sBADhB,KAAK;;AA8IR,MAAM,OAAO,qBAAqB;;kHAArB,qBAAqB;mHAArB,qBAAqB,iBApKrB,wBAAwB,aAAxB,wBAAwB;mHAoKxB,qBAAqB;2FAArB,qBAAqB;kBAJjC,QAAQ;mBAAC;oBACR,OAAO,EAAE,CAAC,wBAAwB,CAAC;oBACnC,YAAY,EAAE,CAAC,wBAAwB,CAAC;iBACzC","sourcesContent":["import {\n ChangeDetectorRef,\n Directive,\n Inject,\n InjectionToken,\n Input,\n NgModule,\n OnDestroy,\n OnInit,\n Optional\n} from '@angular/core';\nimport type { MatPaginator } from '@angular/material/paginator';\nimport type { Observable } from 'rxjs';\nimport { Subscription } from 'rxjs';\nimport { MatSort } from '@angular/material/sort';\nimport type {\n AbstractTableDataSource,\n FilterLike\n} from '@rxap/data-source/table';\nimport {\n DynamicTableDataSource,\n TableEvent,\n SortLike\n} from '@rxap/data-source/table';\nimport { BaseRemoteMethod } from '@rxap/remote-method';\nimport { PaginatorLike } from '@rxap/data-source/pagination';\nimport { CdkTable } from '@angular/cdk/table';\nimport { TableFilterService } from './table-filter/table-filter.service';\nimport {\n debounceTime,\n delay,\n filter,\n tap\n} from 'rxjs/operators';\nimport { Required } from '@rxap/utilities';\nimport {\n Method,\n ToggleSubject\n} from '@rxap/utilities/rxjs';\nimport { pipeDataSource } from '@rxap/data-source';\n\n// TODO : add migration schematic\nexport const RXAP_TABLE_METHOD = new InjectionToken(\n 'rxap/material/table-system/table-method'\n);\n/**\n * @deprecated use TABLE_METHOD instead\n */\nexport const TABLE_REMOTE_METHOD = RXAP_TABLE_METHOD;\nexport const TABLE_REMOTE_METHOD_ADAPTER_FACTORY = new InjectionToken(\n 'table-remote-method-adapter-factory'\n);\nexport const RXAP_TABLE_FILTER = new InjectionToken('rxap/material-table-system/table-filter');\nexport const TABLE_DATA_SOURCE = new InjectionToken('table-data-source');\n\nexport type TableRemoteMethodAdapterFactory<\n Data extends Record<string, any> = Record<string, any>\n> = (\n method: Method,\n paginator?: PaginatorLike,\n sort?: SortLike | null,\n filter?: FilterLike | null,\n parameters?: Observable<Record<string, any>>\n) => BaseRemoteMethod<Data[], TableEvent>;\n\n@Directive({\n selector:\n 'table[mat-table][rxapTableDataSource],mat-table[rxapTableDataSource]',\n exportAs: 'rxapTableDataSource'\n})\nexport class TableDataSourceDirective<Data extends Record<string, any> = any>\n implements OnInit, OnDestroy {\n /**\n * @deprecated use dataSource instead\n */\n @Input('rxapTableDataSource')\n public set setDataSource(dataSource: AbstractTableDataSource<Data> | '') {\n if (typeof dataSource !== 'string') {\n this.dataSource = dataSource;\n }\n }\n\n @Input()\n public paginator?: MatPaginator;\n\n public readonly loading$ = new ToggleSubject(true);\n\n @Input()\n @Required\n public id!: string;\n @Input()\n public parameters?: Observable<Record<string, any>>;\n @Input()\n public dataSource?: AbstractTableDataSource<Data>;\n\n public method?: Method<Data[], TableEvent>;\n\n /**\n * @deprecated use method instead\n */\n public get remoteMethod(): Method<Data[], TableEvent> | undefined {\n return this.method;\n }\n\n /**\n * @deprecated use sourceMethod instead\n */\n public get sourceRemoteMethod(): Method<\n Data[] | any,\n TableEvent | any\n > | null {\n return this.sourceMethod;\n }\n\n protected _subscription = new Subscription();\n\n private readonly adapterFactory: TableRemoteMethodAdapterFactory<Data> | null =\n null;\n\n constructor(\n @Inject(CdkTable)\n private readonly matTable: CdkTable<Data>,\n protected readonly cdr: ChangeDetectorRef,\n @Optional()\n @Inject(RXAP_TABLE_METHOD)\n private readonly sourceMethod: Method<Data[] | any,\n TableEvent | any> | null,\n @Optional()\n @Inject(TABLE_DATA_SOURCE)\n private readonly sourceDataSource: AbstractTableDataSource<Data> | null,\n @Optional()\n @Inject(TABLE_REMOTE_METHOD_ADAPTER_FACTORY)\n adapterFactory: any,\n @Optional()\n @Inject(MatSort)\n private readonly matSort: MatSort | null,\n @Optional()\n @Inject(TableFilterService)\n private readonly tableFilter: TableFilterService | null,\n @Optional()\n @Inject(RXAP_TABLE_FILTER)\n private readonly _tableFilter: FilterLike | null\n ) {\n this.matTable.trackBy = this.trackBy;\n this.adapterFactory = adapterFactory;\n }\n\n private trackBy(index: number, item: Data): string | number {\n return item.uuid ?? index;\n }\n\n public ngOnInit() {\n const tableFilter = this._tableFilter ?? this.tableFilter ?? undefined;\n if (this.sourceMethod) {\n if (this.adapterFactory) {\n this.method = this.adapterFactory(\n this.sourceMethod,\n this.paginator,\n this.matSort,\n tableFilter,\n this.parameters\n );\n } else {\n this.method = this.sourceMethod;\n }\n this.dataSource = new DynamicTableDataSource<Data>(\n this.method,\n this.paginator,\n this.matSort,\n tableFilter,\n this.parameters,\n this.method.metadata ?? { id: this.id }\n );\n } else if (this.sourceDataSource) {\n this.dataSource = this.sourceDataSource;\n } else if (!this.dataSource) {\n throw new Error(\n 'The TABLE_DATA_SOURCE and TABLE_METHOD token are not defined!'\n );\n }\n this.dataSource.paginator = this.paginator;\n this.dataSource.sort = this.matSort ?? undefined;\n this.dataSource.filter = tableFilter;\n this.dataSource.parameters = this.parameters;\n this._subscription.add(\n this.dataSource.loading$.pipe(\n tap(loading => this.loading$.next(!!loading))\n ).subscribe()\n );\n this.matTable.dataSource = pipeDataSource(this.dataSource, tap(rowList => rowList.forEach((element: any) => {\n element.__metadata__ = { loading$: new ToggleSubject() };\n })));\n // TODO : remove hack to trigger change detection after data source refresh (machine-definition -> physical unit)\n this._subscription.add(\n this.loading$\n .pipe(\n filter((loading) => !loading),\n debounceTime(2000),\n tap(() => this.cdr.detectChanges()),\n tap(() => this.cdr.markForCheck()),\n delay(500),\n tap(() => this.cdr.detectChanges()),\n tap(() => this.cdr.markForCheck()),\n delay(500),\n tap(() => this.cdr.detectChanges()),\n tap(() => this.cdr.markForCheck()),\n delay(500),\n tap(() => this.cdr.detectChanges()),\n tap(() => this.cdr.markForCheck()),\n delay(500),\n tap(() => this.cdr.detectChanges()),\n tap(() => this.cdr.markForCheck()),\n delay(500),\n tap(() => this.cdr.detectChanges()),\n tap(() => this.cdr.markForCheck()),\n delay(500)\n )\n .subscribe()\n );\n }\n\n public ngOnDestroy() {\n this._subscription.unsubscribe();\n }\n\n public refresh() {\n this.dataSource?.refresh();\n }\n}\n\n@NgModule({\n exports: [TableDataSourceDirective],\n declarations: [TableDataSourceDirective],\n})\nexport class TableDataSourceModule {}\n"]}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { FormDirective } from '@rxap/forms';
|
|
2
|
-
import { ChangeDetectorRef, Directive, forwardRef, Inject, Optional } from '@angular/core';
|
|
3
|
-
import { TableFilterService } from './table-filter.service';
|
|
4
|
-
import { debounceTime, distinctUntilChanged, map, tap } from 'rxjs/operators';
|
|
5
|
-
import { RXAP_TABLE_FILTER_FORM_DEFINITION } from './tokens';
|
|
6
|
-
import { ControlContainer } from '@angular/forms';
|
|
7
|
-
import { equals } from '@rxap/utilities';
|
|
8
|
-
import * as i0 from "@angular/core";
|
|
9
|
-
import * as i1 from "./table-filter.service";
|
|
10
|
-
export class FilterHeaderRowDirective extends FormDirective {
|
|
11
|
-
constructor(tableFilter, cdr, formDefinition) {
|
|
12
|
-
super(cdr, formDefinition);
|
|
13
|
-
this.tableFilter = tableFilter;
|
|
14
|
-
}
|
|
15
|
-
ngOnInit() {
|
|
16
|
-
super.ngOnInit();
|
|
17
|
-
this._subscription = this.form.value$
|
|
18
|
-
.pipe(debounceTime(1000), map((values) => Object.entries(values)
|
|
19
|
-
.filter(([key, value]) => value !== null && value !== undefined && value !== '')
|
|
20
|
-
.reduce((obj, [key, value]) => (Object.assign(Object.assign({}, obj), { [key]: value })), {})), distinctUntilChanged((a, b) => equals(a, b)), tap(values => this.tableFilter.setMap(values)))
|
|
21
|
-
.subscribe();
|
|
22
|
-
}
|
|
23
|
-
ngOnDestroy() {
|
|
24
|
-
var _a;
|
|
25
|
-
super.ngOnDestroy();
|
|
26
|
-
(_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
FilterHeaderRowDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: FilterHeaderRowDirective, deps: [{ token: i1.TableFilterService }, { token: i0.ChangeDetectorRef }, { token: RXAP_TABLE_FILTER_FORM_DEFINITION, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
30
|
-
FilterHeaderRowDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.0.1", type: FilterHeaderRowDirective, selector: "table[rxap-filter-header-row]", providers: [
|
|
31
|
-
{
|
|
32
|
-
provide: ControlContainer,
|
|
33
|
-
// ignore coverage
|
|
34
|
-
useExisting: forwardRef(() => FilterHeaderRowDirective),
|
|
35
|
-
},
|
|
36
|
-
], usesInheritance: true, ngImport: i0 });
|
|
37
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: FilterHeaderRowDirective, decorators: [{
|
|
38
|
-
type: Directive,
|
|
39
|
-
args: [{
|
|
40
|
-
// tslint:disable-next-line:directive-selector
|
|
41
|
-
selector: 'table[rxap-filter-header-row]',
|
|
42
|
-
providers: [
|
|
43
|
-
{
|
|
44
|
-
provide: ControlContainer,
|
|
45
|
-
// ignore coverage
|
|
46
|
-
useExisting: forwardRef(() => FilterHeaderRowDirective),
|
|
47
|
-
},
|
|
48
|
-
],
|
|
49
|
-
}]
|
|
50
|
-
}], ctorParameters: function () { return [{ type: i1.TableFilterService }, { type: i0.ChangeDetectorRef }, { type: undefined, decorators: [{
|
|
51
|
-
type: Optional
|
|
52
|
-
}, {
|
|
53
|
-
type: Inject,
|
|
54
|
-
args: [RXAP_TABLE_FILTER_FORM_DEFINITION]
|
|
55
|
-
}] }]; } });
|
|
56
|
-
//# sourceMappingURL=filter-header-row.directive.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"filter-header-row.directive.js","sourceRoot":"","sources":["../../../../../../../libs/material/table-system/src/lib/table-filter/filter-header-row.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAEd,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,iBAAiB,EACjB,SAAS,EACT,UAAU,EACV,MAAM,EAGN,QAAQ,EACT,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D,OAAO,EACL,YAAY,EACZ,oBAAoB,EACpB,GAAG,EACH,GAAG,EACJ,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,iCAAiC,EAAE,MAAM,UAAU,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;;;AAazC,MAAM,OAAO,wBACX,SAAQ,aAAa;IAKrB,YACmB,WAA+B,EAChD,GAAsB,EAGtB,cAAqC;QAErC,KAAK,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;QANV,gBAAW,GAAX,WAAW,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zB,kBAAkB;4BAClB,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,yBAAyB,CAAC;yBACxD;qBACF;iBACF;;0BAUI,QAAQ;;0BACR,MAAM;2BAAC,iCAAiC","sourcesContent":["import {\n FormDirective,\n FormDefinition\n} from '@rxap/forms';\nimport {\n ChangeDetectorRef,\n Directive,\n forwardRef,\n Inject,\n OnDestroy,\n OnInit,\n Optional\n} from '@angular/core';\nimport { TableFilterService } from './table-filter.service';\nimport { Subscription } from 'rxjs';\nimport {\n debounceTime,\n distinctUntilChanged,\n map,\n tap\n} from 'rxjs/operators';\nimport { RXAP_TABLE_FILTER_FORM_DEFINITION } from './tokens';\nimport { ControlContainer } from '@angular/forms';\nimport { equals } from '@rxap/utilities';\n\n@Directive({\n // tslint:disable-next-line:directive-selector\n selector: 'table[rxap-filter-header-row]',\n providers: [\n {\n provide: ControlContainer,\n // ignore coverage\n useExisting: forwardRef(() => FilterHeaderRowDirective),\n },\n ],\n})\nexport class FilterHeaderRowDirective\n extends FormDirective\n implements OnInit, OnDestroy\n{\n private _subscription?: Subscription;\n\n constructor(\n private readonly tableFilter: TableFilterService,\n cdr: ChangeDetectorRef,\n @Optional()\n @Inject(RXAP_TABLE_FILTER_FORM_DEFINITION)\n formDefinition: FormDefinition | null\n ) {\n super(cdr, formDefinition);\n }\n\n public ngOnInit() {\n super.ngOnInit();\n this._subscription = this.form.value$\n .pipe(\n debounceTime(1000),\n map((values) =>\n Object.entries(values)\n .filter(\n ([key, value]) =>\n value !== null && value !== undefined && value !== ''\n )\n .reduce((obj, [key, value]) => ({ ...obj, [key]: value }), {})\n ),\n distinctUntilChanged((a, b) => equals(a, b)),\n tap(values => this.tableFilter.setMap(values))\n )\n .subscribe();\n }\n\n public ngOnDestroy() {\n super.ngOnDestroy();\n this._subscription?.unsubscribe();\n }\n}\n"]}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { NgModule } from '@angular/core';
|
|
2
|
-
import { ToFilterColumnNamesPipe } from './to-filter-column-names.pipe';
|
|
3
|
-
import { FilterHeaderRowDirective } from './filter-header-row.directive';
|
|
4
|
-
import * as i0 from "@angular/core";
|
|
5
|
-
export class TableFilterModule {
|
|
6
|
-
}
|
|
7
|
-
TableFilterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: TableFilterModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
8
|
-
TableFilterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: TableFilterModule, declarations: [ToFilterColumnNamesPipe,
|
|
9
|
-
FilterHeaderRowDirective], exports: [ToFilterColumnNamesPipe,
|
|
10
|
-
FilterHeaderRowDirective] });
|
|
11
|
-
TableFilterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: TableFilterModule });
|
|
12
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: TableFilterModule, decorators: [{
|
|
13
|
-
type: NgModule,
|
|
14
|
-
args: [{
|
|
15
|
-
exports: [
|
|
16
|
-
ToFilterColumnNamesPipe,
|
|
17
|
-
FilterHeaderRowDirective
|
|
18
|
-
],
|
|
19
|
-
declarations: [
|
|
20
|
-
ToFilterColumnNamesPipe,
|
|
21
|
-
FilterHeaderRowDirective
|
|
22
|
-
]
|
|
23
|
-
}]
|
|
24
|
-
}] });
|
|
25
|
-
//# sourceMappingURL=table-filter.module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"table-filter.module.js","sourceRoot":"","sources":["../../../../../../../libs/material/table-system/src/lib/table-filter/table-filter.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;;AAazE,MAAM,OAAO,iBAAiB;;8GAAjB,iBAAiB;+GAAjB,iBAAiB,iBAJ1B,uBAAuB;QACvB,wBAAwB,aALxB,uBAAuB;QACvB,wBAAwB;+GAOf,iBAAiB;2FAAjB,iBAAiB;kBAV7B,QAAQ;mBAAC;oBACR,OAAO,EAAO;wBACZ,uBAAuB;wBACvB,wBAAwB;qBACzB;oBACD,YAAY,EAAE;wBACZ,uBAAuB;wBACvB,wBAAwB;qBACzB;iBACF","sourcesContent":["import { NgModule } from '@angular/core';\nimport { ToFilterColumnNamesPipe } from './to-filter-column-names.pipe';\nimport { FilterHeaderRowDirective } from './filter-header-row.directive';\n\n\n@NgModule({\n exports: [\n ToFilterColumnNamesPipe,\n FilterHeaderRowDirective\n ],\n declarations: [\n ToFilterColumnNamesPipe,\n FilterHeaderRowDirective\n ]\n})\nexport class TableFilterModule {\n}\n"]}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '@angular/core';
|
|
2
|
-
import { ReplaySubject } from 'rxjs';
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
export class TableFilterService {
|
|
5
|
-
constructor() {
|
|
6
|
-
this.change = new ReplaySubject(1);
|
|
7
|
-
this.current = {};
|
|
8
|
-
this._subscription = this.change.subscribe(current => this.current = current);
|
|
9
|
-
}
|
|
10
|
-
setMap(map) {
|
|
11
|
-
const current = this.current;
|
|
12
|
-
const next = Object.assign(current, map);
|
|
13
|
-
this.change.next(next);
|
|
14
|
-
}
|
|
15
|
-
set(key, value) {
|
|
16
|
-
const current = this.current;
|
|
17
|
-
current[key] = value;
|
|
18
|
-
this.change.next(current);
|
|
19
|
-
}
|
|
20
|
-
remove(key) {
|
|
21
|
-
const current = this.current;
|
|
22
|
-
if (current.hasOwnProperty(key)) {
|
|
23
|
-
delete current[key];
|
|
24
|
-
}
|
|
25
|
-
this.change.next(current);
|
|
26
|
-
}
|
|
27
|
-
ngOnDestroy() {
|
|
28
|
-
this._subscription.unsubscribe();
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
TableFilterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: TableFilterService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
32
|
-
TableFilterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: TableFilterService });
|
|
33
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: TableFilterService, decorators: [{
|
|
34
|
-
type: Injectable
|
|
35
|
-
}], ctorParameters: function () { return []; } });
|
|
36
|
-
//# sourceMappingURL=table-filter.service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"table-filter.service.js","sourceRoot":"","sources":["../../../../../../../libs/material/table-system/src/lib/table-filter/table-filter.service.ts"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EAEX,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,aAAa,EAEd,MAAM,MAAM,CAAC;;AAGd,MAAM,OAAO,kBAAkB;IAQ7B;QANgB,WAAM,GAAG,IAAI,aAAa,CAAsB,CAAC,CAAC,CAAC;QAE5D,YAAO,GAAwB,EAAE,CAAC;QAKvC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,CAAC;IAChF,CAAC;IAEM,MAAM,CAAC,GAAwB;QACpC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC7B,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QACzC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;IAEM,GAAG,CAAC,GAAW,EAAE,KAAU;QAChC,MAAM,OAAO,GAAI,IAAI,CAAC,OAAO,CAAC;QAC9B,OAAO,CAAE,GAAG,CAAE,GAAG,KAAK,CAAC;QACvB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC;IAEM,MAAM,CAAC,GAAW;QACvB,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC7B,IAAI,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;YAC/B,OAAO,OAAO,CAAE,GAAG,CAAE,CAAC;SACvB;QACD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC;IAEM,WAAW;QAChB,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,CAAC;IACnC,CAAC;;+GAlCU,kBAAkB;mHAAlB,kBAAkB;2FAAlB,kBAAkB;kBAD9B,UAAU","sourcesContent":["import { FilterLike } from '@rxap/data-source/table';\nimport {\n Injectable,\n OnDestroy\n} from '@angular/core';\nimport {\n ReplaySubject,\n Subscription\n} from 'rxjs';\n\n@Injectable()\nexport class TableFilterService implements FilterLike, OnDestroy {\n\n public readonly change = new ReplaySubject<Record<string, any>>(1);\n\n public current: Record<string, any> = {};\n\n private _subscription: Subscription;\n\n constructor() {\n this._subscription = this.change.subscribe(current => this.current = current);\n }\n\n public setMap(map: Record<string, any>): void {\n const current = this.current;\n const next = Object.assign(current, map);\n this.change.next(next);\n }\n\n public set(key: string, value: any): void {\n const current = this.current;\n current[ key ] = value;\n this.change.next(current);\n }\n\n public remove(key: string): void {\n const current = this.current;\n if (current.hasOwnProperty(key)) {\n delete current[ key ];\n }\n this.change.next(current);\n }\n\n public ngOnDestroy() {\n this._subscription.unsubscribe();\n }\n\n}\n"]}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Pipe } from '@angular/core';
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
|
-
export class ToFilterColumnNamesPipe {
|
|
4
|
-
transform(columns) {
|
|
5
|
-
return columns.map(column => 'filter_' + column);
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
ToFilterColumnNamesPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: ToFilterColumnNamesPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
9
|
-
ToFilterColumnNamesPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: ToFilterColumnNamesPipe, name: "toFilterColumnNames" });
|
|
10
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: ToFilterColumnNamesPipe, decorators: [{
|
|
11
|
-
type: Pipe,
|
|
12
|
-
args: [{
|
|
13
|
-
name: 'toFilterColumnNames'
|
|
14
|
-
}]
|
|
15
|
-
}] });
|
|
16
|
-
//# sourceMappingURL=to-filter-column-names.pipe.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"to-filter-column-names.pipe.js","sourceRoot":"","sources":["../../../../../../../libs/material/table-system/src/lib/table-filter/to-filter-column-names.pipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,IAAI,EACL,MAAM,eAAe,CAAC;;AAKvB,MAAM,OAAO,uBAAuB;IAE3B,SAAS,CAAC,OAAiB;QAChC,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,SAAS,GAAG,MAAM,CAAC,CAAC;IACnD,CAAC;;oHAJU,uBAAuB;kHAAvB,uBAAuB;2FAAvB,uBAAuB;kBAHnC,IAAI;mBAAC;oBACJ,IAAI,EAAE,qBAAqB;iBAC5B","sourcesContent":["import {\n PipeTransform,\n Pipe\n} from '@angular/core';\n\n@Pipe({\n name: 'toFilterColumnNames'\n})\nexport class ToFilterColumnNamesPipe implements PipeTransform {\n\n public transform(columns: string[]): string[] {\n return columns.map(column => 'filter_' + column);\n }\n\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../../../../../../libs/material/table-system/src/lib/table-filter/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,MAAM,CAAC,MAAM,iCAAiC,GAAG,IAAI,cAAc,CAAC,+CAA+C,CAAC,CAAC","sourcesContent":["import { InjectionToken } from '@angular/core';\n\nexport const RXAP_TABLE_FILTER_FORM_DEFINITION = new InjectionToken('rxap/form-table-system/filter-form-definition');\n"]}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { setMetadata } from '@rxap/utilities/reflect-metadata';
|
|
2
|
-
export const RXAP_TABLE_ACTION_METHOD_TYPE_METADATA = 'rxap-table-action-method-type-metadata';
|
|
3
|
-
export function TableActionMethod(type) {
|
|
4
|
-
return function (target) {
|
|
5
|
-
setMetadata(RXAP_TABLE_ACTION_METHOD_TYPE_METADATA, type, target);
|
|
6
|
-
};
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=decorators.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../../../../../../libs/material/table-system/src/lib/table-row-actions/decorators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAE/D,MAAM,CAAC,MAAM,sCAAsC,GAAG,wCAAwC,CAAC;AAE/F,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,OAAO,UAAS,MAAW;QACzB,WAAW,CAAC,sCAAsC,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IACpE,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { setMetadata } from '@rxap/utilities/reflect-metadata';\n\nexport const RXAP_TABLE_ACTION_METHOD_TYPE_METADATA = 'rxap-table-action-method-type-metadata';\n\nexport function TableActionMethod(type: string) {\n return function(target: any) {\n setMetadata(RXAP_TABLE_ACTION_METHOD_TYPE_METADATA, type, target);\n };\n}\n"]}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Directive, TemplateRef, ViewContainerRef } from '@angular/core';
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
|
-
export class TableRowActionExecutingDirective {
|
|
4
|
-
constructor(templateRef, vcr) {
|
|
5
|
-
this.templateRef = templateRef;
|
|
6
|
-
this.vcr = vcr;
|
|
7
|
-
}
|
|
8
|
-
show() {
|
|
9
|
-
this.vcr.createEmbeddedView(this.templateRef);
|
|
10
|
-
}
|
|
11
|
-
hide() {
|
|
12
|
-
this.vcr.clear();
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
TableRowActionExecutingDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: TableRowActionExecutingDirective, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
16
|
-
TableRowActionExecutingDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.0.1", type: TableRowActionExecutingDirective, selector: "[rxapTableRowActionExecuting]", ngImport: i0 });
|
|
17
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: TableRowActionExecutingDirective, decorators: [{
|
|
18
|
-
type: Directive,
|
|
19
|
-
args: [{
|
|
20
|
-
selector: '[rxapTableRowActionExecuting]'
|
|
21
|
-
}]
|
|
22
|
-
}], ctorParameters: function () { return [{ type: i0.TemplateRef }, { type: i0.ViewContainerRef }]; } });
|
|
23
|
-
//# sourceMappingURL=table-row-action-executing.directive.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"table-row-action-executing.directive.js","sourceRoot":"","sources":["../../../../../../../libs/material/table-system/src/lib/table-row-actions/table-row-action-executing.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,WAAW,EACX,gBAAgB,EACjB,MAAM,eAAe,CAAC;;AAKvB,MAAM,OAAO,gCAAgC;IAC3C,YACkB,WAA8B,EAC7B,GAAqB;QADtB,gBAAW,GAAX,WAAW,CAAmB;QAC7B,QAAG,GAAH,GAAG,CAAkB;IACrC,CAAC;IAEG,IAAI;QACT,IAAI,CAAC,GAAG,CAAC,kBAAkB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAChD,CAAC;IAEM,IAAI;QACT,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;IACnB,CAAC;;6HAZU,gCAAgC;iHAAhC,gCAAgC;2FAAhC,gCAAgC;kBAH5C,SAAS;mBAAC;oBACT,QAAQ,EAAE,+BAA+B;iBAC1C","sourcesContent":["import {\n Directive,\n TemplateRef,\n ViewContainerRef\n} from '@angular/core';\n\n@Directive({\n selector: '[rxapTableRowActionExecuting]'\n})\nexport class TableRowActionExecutingDirective {\n constructor(\n public readonly templateRef: TemplateRef<void>,\n private readonly vcr: ViewContainerRef\n ) {}\n\n public show(): void {\n this.vcr.createEmbeddedView(this.templateRef);\n }\n\n public hide(): void {\n this.vcr.clear();\n }\n}\n"]}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export var TableRowActionStatus;
|
|
2
|
-
(function (TableRowActionStatus) {
|
|
3
|
-
TableRowActionStatus["EXECUTING"] = "executing";
|
|
4
|
-
TableRowActionStatus["DONE"] = "done";
|
|
5
|
-
TableRowActionStatus["ERROR"] = "error";
|
|
6
|
-
TableRowActionStatus["SUCCESS"] = "success";
|
|
7
|
-
})(TableRowActionStatus || (TableRowActionStatus = {}));
|
|
8
|
-
//# sourceMappingURL=table-row-action-status.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"table-row-action-status.js","sourceRoot":"","sources":["../../../../../../../libs/material/table-system/src/lib/table-row-actions/table-row-action-status.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,oBAKX;AALD,WAAY,oBAAoB;IAC9B,+CAAuB,CAAA;IACvB,qCAAkB,CAAA;IAClB,uCAAmB,CAAA;IACnB,2CAAqB,CAAA;AACvB,CAAC,EALW,oBAAoB,KAApB,oBAAoB,QAK/B","sourcesContent":["export enum TableRowActionStatus {\n EXECUTING = 'executing',\n DONE = 'done',\n ERROR = 'error',\n SUCCESS = 'success'\n}\n"]}
|
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
import { __awaiter, __decorate, __metadata } from "tslib";
|
|
2
|
-
import { ChangeDetectorRef, ContentChild, Directive, HostListener, Inject, Input, isDevMode, Optional, ViewContainerRef } from '@angular/core';
|
|
3
|
-
import { MatButton } from '@angular/material/button';
|
|
4
|
-
import { MatSnackBar } from '@angular/material/snack-bar';
|
|
5
|
-
import { coerceArray, coerceBoolean, Required } from '@rxap/utilities';
|
|
6
|
-
import { TableRowActionExecutingDirective } from './table-row-action-executing.directive';
|
|
7
|
-
import { TableRowActionStatus } from './table-row-action-status';
|
|
8
|
-
import { IsTableRowActionTypeMethod, IsTableRowActionTypeSwitchMethod } from './table-row-action.method';
|
|
9
|
-
import { RXAP_TABLE_ROW_ACTION_METHOD } from './tokens';
|
|
10
|
-
import { TableDataSourceDirective } from '../table-data-source.directive';
|
|
11
|
-
import * as i0 from "@angular/core";
|
|
12
|
-
import * as i1 from "../table-data-source.directive";
|
|
13
|
-
import * as i2 from "@angular/material/snack-bar";
|
|
14
|
-
import * as i3 from "@angular/material/button";
|
|
15
|
-
export class TableRowActionDirective {
|
|
16
|
-
constructor(actionMethodList, cdr, vcr, tableDataSourceDirective, snackBar, matButton) {
|
|
17
|
-
this.cdr = cdr;
|
|
18
|
-
this.vcr = vcr;
|
|
19
|
-
this.tableDataSourceDirective = tableDataSourceDirective;
|
|
20
|
-
this.snackBar = snackBar;
|
|
21
|
-
this.matButton = matButton;
|
|
22
|
-
this._hasConfirmDirective = false;
|
|
23
|
-
this._currentStatus = TableRowActionStatus.DONE;
|
|
24
|
-
this._actionDisabled = false;
|
|
25
|
-
this.actionMethodList = coerceArray(actionMethodList);
|
|
26
|
-
}
|
|
27
|
-
set hasConfirmDirective(value) {
|
|
28
|
-
this._hasConfirmDirective = coerceBoolean(value);
|
|
29
|
-
}
|
|
30
|
-
onConfirmed() {
|
|
31
|
-
return this.execute();
|
|
32
|
-
}
|
|
33
|
-
onClick($event) {
|
|
34
|
-
$event.stopPropagation();
|
|
35
|
-
if (!this._hasConfirmDirective) {
|
|
36
|
-
return this.execute();
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
if (isDevMode()) {
|
|
40
|
-
console.debug('skip remote method call. Wait for confirmation.');
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return Promise.resolve();
|
|
44
|
-
}
|
|
45
|
-
execute() {
|
|
46
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
-
if (this._actionDisabled) {
|
|
48
|
-
return Promise.resolve();
|
|
49
|
-
}
|
|
50
|
-
this.setStatus(TableRowActionStatus.EXECUTING);
|
|
51
|
-
try {
|
|
52
|
-
yield Promise.all(this.getElementList().map((element) => {
|
|
53
|
-
return Promise.all([
|
|
54
|
-
Promise.all(this.findUntypedActionMethod().map((am) => am.call({ element, type: this.type }))),
|
|
55
|
-
Promise.all(this.findTypedActionMethod().map((am) => am.call(element)))
|
|
56
|
-
]);
|
|
57
|
-
}));
|
|
58
|
-
this.setStatus(TableRowActionStatus.SUCCESS);
|
|
59
|
-
}
|
|
60
|
-
catch (e) {
|
|
61
|
-
console.error(`Failed to execute row action: ${e.message}`);
|
|
62
|
-
this.setStatus(TableRowActionStatus.ERROR);
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
getElementList() {
|
|
67
|
-
return [this.element];
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* find all method instance in the actionMethodList member that
|
|
71
|
-
* do not have a @TableActionMethod decorators
|
|
72
|
-
* @private
|
|
73
|
-
*/
|
|
74
|
-
findUntypedActionMethod() {
|
|
75
|
-
return this.actionMethodList.filter(IsTableRowActionTypeSwitchMethod);
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* find all method instance in the actionMethodList member that
|
|
79
|
-
* do have a @TableActionMethod decorators with the current type
|
|
80
|
-
* @private
|
|
81
|
-
*/
|
|
82
|
-
findTypedActionMethod() {
|
|
83
|
-
return this.actionMethodList.filter(IsTableRowActionTypeMethod(this.type));
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Disables the action. If the button is pressed the action is NOT executed
|
|
87
|
-
*
|
|
88
|
-
* Hint: the button is set to disabled = true to prevent any conflict with
|
|
89
|
-
* extern button enable features linke : rxapHasEnablePermission
|
|
90
|
-
* @protected
|
|
91
|
-
*/
|
|
92
|
-
setButtonDisabled() {
|
|
93
|
-
this._actionDisabled = true;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Enables the action. If the button is pressed the action is executed
|
|
97
|
-
*
|
|
98
|
-
* TODO : find a way to communicate the disabled state between the features
|
|
99
|
-
* Hint: the button is set to disabled = false to prevent any conflict with
|
|
100
|
-
* extern button enable features linke : rxapHasEnablePermission
|
|
101
|
-
* @protected
|
|
102
|
-
*/
|
|
103
|
-
setButtonEnabled() {
|
|
104
|
-
this._actionDisabled = false;
|
|
105
|
-
}
|
|
106
|
-
setStatus(status) {
|
|
107
|
-
var _a, _b;
|
|
108
|
-
if (this._currentStatus === status) {
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
this._currentStatus = status;
|
|
112
|
-
switch (status) {
|
|
113
|
-
case TableRowActionStatus.EXECUTING:
|
|
114
|
-
this.setButtonDisabled();
|
|
115
|
-
(_a = this.executingDirective) === null || _a === void 0 ? void 0 : _a.show();
|
|
116
|
-
break;
|
|
117
|
-
case TableRowActionStatus.SUCCESS:
|
|
118
|
-
if (this.refresh) {
|
|
119
|
-
this.tableDataSourceDirective.refresh();
|
|
120
|
-
}
|
|
121
|
-
if (this.successMessage) {
|
|
122
|
-
this.snackBar.open(this.successMessage, 'ok', { duration: 2560 });
|
|
123
|
-
}
|
|
124
|
-
this.setStatus(TableRowActionStatus.DONE);
|
|
125
|
-
break;
|
|
126
|
-
case TableRowActionStatus.ERROR:
|
|
127
|
-
this.setStatus(TableRowActionStatus.DONE);
|
|
128
|
-
if (this.errorMessage) {
|
|
129
|
-
this.snackBar.open(this.errorMessage, 'ok', { duration: 5120 });
|
|
130
|
-
}
|
|
131
|
-
break;
|
|
132
|
-
case TableRowActionStatus.DONE:
|
|
133
|
-
this.setButtonEnabled();
|
|
134
|
-
(_b = this.executingDirective) === null || _b === void 0 ? void 0 : _b.hide();
|
|
135
|
-
break;
|
|
136
|
-
}
|
|
137
|
-
this.cdr.detectChanges();
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
TableRowActionDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: TableRowActionDirective, deps: [{ token: RXAP_TABLE_ROW_ACTION_METHOD }, { token: ChangeDetectorRef }, { token: ViewContainerRef }, { token: TableDataSourceDirective }, { token: MatSnackBar }, { token: MatButton, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
141
|
-
TableRowActionDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.0.1", type: TableRowActionDirective, selector: "button[rxapTableRowAction]", inputs: { hasConfirmDirective: ["rxapConfirm", "hasConfirmDirective"], element: "element", type: ["rxapTableRowAction", "type"], errorMessage: "errorMessage", successMessage: "successMessage", refresh: "refresh" }, host: { listeners: { "confirmed": "onConfirmed()", "click": "onClick($event)" } }, queries: [{ propertyName: "executingDirective", first: true, predicate: TableRowActionExecutingDirective, descendants: true }], ngImport: i0 });
|
|
142
|
-
__decorate([
|
|
143
|
-
Required,
|
|
144
|
-
__metadata("design:type", Object)
|
|
145
|
-
], TableRowActionDirective.prototype, "element", void 0);
|
|
146
|
-
__decorate([
|
|
147
|
-
Required,
|
|
148
|
-
__metadata("design:type", String)
|
|
149
|
-
], TableRowActionDirective.prototype, "type", void 0);
|
|
150
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: TableRowActionDirective, decorators: [{
|
|
151
|
-
type: Directive,
|
|
152
|
-
args: [{
|
|
153
|
-
selector: 'button[rxapTableRowAction]'
|
|
154
|
-
}]
|
|
155
|
-
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
156
|
-
type: Inject,
|
|
157
|
-
args: [RXAP_TABLE_ROW_ACTION_METHOD]
|
|
158
|
-
}] }, { type: i0.ChangeDetectorRef, decorators: [{
|
|
159
|
-
type: Inject,
|
|
160
|
-
args: [ChangeDetectorRef]
|
|
161
|
-
}] }, { type: i0.ViewContainerRef, decorators: [{
|
|
162
|
-
type: Inject,
|
|
163
|
-
args: [ViewContainerRef]
|
|
164
|
-
}] }, { type: i1.TableDataSourceDirective, decorators: [{
|
|
165
|
-
type: Inject,
|
|
166
|
-
args: [TableDataSourceDirective]
|
|
167
|
-
}] }, { type: i2.MatSnackBar, decorators: [{
|
|
168
|
-
type: Inject,
|
|
169
|
-
args: [MatSnackBar]
|
|
170
|
-
}] }, { type: i3.MatButton, decorators: [{
|
|
171
|
-
type: Optional
|
|
172
|
-
}, {
|
|
173
|
-
type: Inject,
|
|
174
|
-
args: [MatButton]
|
|
175
|
-
}] }]; }, propDecorators: { hasConfirmDirective: [{
|
|
176
|
-
type: Input,
|
|
177
|
-
args: ['rxapConfirm']
|
|
178
|
-
}], element: [{
|
|
179
|
-
type: Input
|
|
180
|
-
}], type: [{
|
|
181
|
-
type: Input,
|
|
182
|
-
args: ['rxapTableRowAction']
|
|
183
|
-
}], errorMessage: [{
|
|
184
|
-
type: Input
|
|
185
|
-
}], successMessage: [{
|
|
186
|
-
type: Input
|
|
187
|
-
}], refresh: [{
|
|
188
|
-
type: Input
|
|
189
|
-
}], executingDirective: [{
|
|
190
|
-
type: ContentChild,
|
|
191
|
-
args: [TableRowActionExecutingDirective]
|
|
192
|
-
}], onConfirmed: [{
|
|
193
|
-
type: HostListener,
|
|
194
|
-
args: ['confirmed']
|
|
195
|
-
}], onClick: [{
|
|
196
|
-
type: HostListener,
|
|
197
|
-
args: ['click', ['$event']]
|
|
198
|
-
}] } });
|
|
199
|
-
//# sourceMappingURL=table-row-action.directive.js.map
|