@rxap/material-table-system 12.4.1 → 12.5.3
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/bundles/rxap-material-table-system.umd.js +99 -12
- package/bundles/rxap-material-table-system.umd.js.map +1 -1
- package/esm2015/index.js +1 -0
- package/esm2015/index.js.map +1 -1
- package/esm2015/lib/persistent-paginator.directive.js +63 -0
- package/esm2015/lib/persistent-paginator.directive.js.map +1 -0
- package/esm2015/lib/table-filter/filter-header-row.directive.js +4 -4
- package/esm2015/lib/table-filter/filter-header-row.directive.js.map +1 -1
- package/esm2015/lib/table-filter/table-filter.service.js +5 -0
- package/esm2015/lib/table-filter/table-filter.service.js.map +1 -1
- package/esm2015/lib/table-row-actions/table-row-action.directive.js +21 -6
- package/esm2015/lib/table-row-actions/table-row-action.directive.js.map +1 -1
- package/fesm2015/rxap-material-table-system.js +88 -9
- package/fesm2015/rxap-material-table-system.js.map +1 -1
- package/index.d.ts +1 -0
- package/lib/persistent-paginator.directive.d.ts +23 -0
- package/lib/table-filter/table-filter.service.d.ts +1 -0
- package/lib/table-row-actions/table-row-action.directive.d.ts +16 -0
- package/package.json +6 -6
package/esm2015/index.js
CHANGED
|
@@ -17,6 +17,7 @@ export * from './lib/select-row/tokens';
|
|
|
17
17
|
export * from './lib/row-animation';
|
|
18
18
|
export * from './lib/table-data-source.directive';
|
|
19
19
|
export * from './lib/table-row-metadata';
|
|
20
|
+
export * from './lib/persistent-paginator.directive';
|
|
20
21
|
// region table filter
|
|
21
22
|
export * from './lib/table-filter/filter-header-row.directive';
|
|
22
23
|
export * from './lib/table-filter/table-filter.module';
|
package/esm2015/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/material/table-system/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAC;AACnD,cAAc,sEAAsE,CAAC;AACrF,cAAc,oEAAoE,CAAC;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,cAAc,qEAAqE,CAAC;AACpF,cAAc,4EAA4E,CAAC;AAE3F,YAAY;AAEZ,mBAAmB;AAEnB,cAAc,2CAA2C,CAAC;AAC1D,cAAc,kDAAkD,CAAC;AAEjE,YAAY;AAEZ,mBAAmB;AAEnB,cAAc,2CAA2C,CAAC;AAC1D,cAAc,kDAAkD,CAAC;AAEjE,YAAY;AAEZ,mBAAmB;AAEnB,cAAc,2CAA2C,CAAC;AAC1D,cAAc,kDAAkD,CAAC;AAEjE,YAAY;AAEZ,sBAAsB;AAEtB,cAAc,iDAAiD,CAAC;AAChE,cAAc,wDAAwD,CAAC;AAEvE,YAAY;AAEZ,sBAAsB;AAEtB,cAAc,iDAAiD,CAAC;AAChE,cAAc,wDAAwD,CAAC;AAEvE,YAAY;AAEZ,2BAA2B;AAE3B,cAAc,oCAAoC,CAAC;AACnD,cAAc,oDAAoD,CAAC;AACnE,cAAc,iDAAiD,CAAC;AAChE,cAAc,8DAA8D,CAAC;AAC7E,cAAc,iDAAiD,CAAC;AAChE,cAAc,kDAAkD,CAAC;AACjE,cAAc,2DAA2D,CAAC;AAC1E,cAAc,gCAAgC,CAAC;AAE/C,YAAY;AAEZ,YAAY","sourcesContent":["export * from './lib/expand-row/expand-row.module';\nexport * from './lib/expand-row/expand-row-container/expand-row-container.component';\nexport * from './lib/expand-row/expand-row-container/expand-row-content.directive';\nexport * from './lib/expand-row/expand-row-container/expand-row-container.component.module';\nexport * from './lib/expand-row/expand-controls-cell/expand-controls-cell.component';\nexport * from './lib/expand-row/expand-controls-cell/expand-controls-cell.component.module';\nexport * from './lib/expand-row/expand-row.service';\nexport * from './lib/expand-row/expand-row.directive';\n\nexport * from './lib/select-row/select-row.module';\nexport * from './lib/select-row/checkbox-cell/checkbox-cell.component';\nexport * from './lib/select-row/checkbox-cell/checkbox-cell.component.module';\nexport * from './lib/select-row/checkbox-header-cell/checkbox-header-cell.component';\nexport * from './lib/select-row/checkbox-header-cell/checkbox-header-cell.component.module';\nexport * from './lib/select-row/select-row.service';\nexport * from './lib/select-row/selected-rows.directive';\nexport * from './lib/select-row/tokens';\nexport * from './lib/row-animation';\nexport * from './lib/table-data-source.directive';\nexport * from './lib/table-row-metadata';\n\n// region table filter\n\nexport * from './lib/table-filter/filter-header-row.directive';\nexport * from './lib/table-filter/table-filter.module';\nexport * from './lib/table-filter/table-filter.service';\nexport * from './lib/table-filter/to-filter-column-names.pipe';\nexport * from './lib/table-filter/tokens';\n\n// endregion\n\n// region table column menu\n\nexport * from './lib/table-column-menu/table-column-menu.component';\nexport * from './lib/table-column-menu/table-column-menu.component.module';\nexport * from './lib/table-column-menu/table-show-archived-slide/table-show-archived-slide.component';\nexport * from './lib/table-column-menu/table-show-archived-slide/table-show-archived-slide.component.module';\nexport * from './lib/table-column-menu/table-column-option/table-column-option.component';\n\n// endregion\n\n// region table create button\n\nexport * from './lib/table-create-button/table-create-button.directive';\nexport * from './lib/table-create-button/tokens';\n\n// endregion\n\n// region table row controls\n\nexport * from './lib/table-row-controls/table-row-controls.module';\nexport * from './lib/table-row-controls/row-controls-cell/row-controls-cell.component';\nexport * from './lib/table-row-controls/row-controls-cell/row-controls-cell.component.module';\nexport * from './lib/table-row-controls/row-controls-header-cell/row-controls-header-cell.component';\nexport * from './lib/table-row-controls/row-controls-header-cell/row-controls-header-cell.component.module';\nexport * from './lib/table-row-controls/tokens';\n\n// endregion\n\n// region table select controls\n\nexport * from './lib/table-select-controls/table-select-controls.component';\nexport * from './lib/table-select-controls/table-select-controls.component.module';\n\n// endregion\n\n// region cells\n\n// region image\n\nexport * from './lib/cells/image-cell/image-cell.component';\nexport * from './lib/cells/image-cell/image-cell.component.module';\n\n// endregion\n\n// region copy-to-clipboard cell\n\nexport * from './lib/cells/copy-to-clipboard-cell/copy-to-clipboard-cell.component';\nexport * from './lib/cells/copy-to-clipboard-cell/copy-to-clipboard-cell.component.module';\n\n// endregion\n\n// region icon cell\n\nexport * from './lib/cells/icon-cell/icon-cell.component';\nexport * from './lib/cells/icon-cell/icon-cell.component.module';\n\n// endregion\n\n// region date cell\n\nexport * from './lib/cells/date-cell/date-cell.component';\nexport * from './lib/cells/date-cell/date-cell.component.module';\n\n// endregion\n\n// region link cell\n\nexport * from './lib/cells/link-cell/link-cell.component';\nexport * from './lib/cells/link-cell/link-cell.component.module';\n\n// endregion\n\n// region options cell\n\nexport * from './lib/cells/options-cell/options-cell.component';\nexport * from './lib/cells/options-cell/options-cell.component.module';\n\n// endregion\n\n// region boolean cell\n\nexport * from './lib/cells/boolean-cell/boolean-cell.component';\nexport * from './lib/cells/boolean-cell/boolean-cell.component.module';\n\n// endregion\n\n// region table-row-actions\n\nexport * from './lib/table-row-actions/decorators';\nexport * from './lib/table-row-actions/table-row-action.directive';\nexport * from './lib/table-row-actions/table-row-action.method';\nexport * from './lib/table-row-actions/table-row-action-executing.directive';\nexport * from './lib/table-row-actions/table-row-action-status';\nexport * from './lib/table-row-actions/table-row-actions.module';\nexport * from './lib/table-row-actions/table-row-header-action.directive';\nexport * from './lib/table-row-actions/tokens';\n\n// endregion\n\n// endregion\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/material/table-system/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAC;AACnD,cAAc,sEAAsE,CAAC;AACrF,cAAc,oEAAoE,CAAC;AACnF,cAAc,6EAA6E,CAAC;AAC5F,cAAc,sEAAsE,CAAC;AACrF,cAAc,6EAA6E,CAAC;AAC5F,cAAc,qCAAqC,CAAC;AACpD,cAAc,uCAAuC,CAAC;AAEtD,cAAc,oCAAoC,CAAC;AACnD,cAAc,wDAAwD,CAAC;AACvE,cAAc,+DAA+D,CAAC;AAC9E,cAAc,sEAAsE,CAAC;AACrF,cAAc,6EAA6E,CAAC;AAC5F,cAAc,qCAAqC,CAAC;AACpD,cAAc,0CAA0C,CAAC;AACzD,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mCAAmC,CAAC;A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CAAC;AAEvE,YAAY;AAEZ,sBAAsB;AAEtB,cAAc,iDAAiD,CAAC;AAChE,cAAc,wDAAwD,CAAC;AAEvE,YAAY;AAEZ,2BAA2B;AAE3B,cAAc,oCAAoC,CAAC;AACnD,cAAc,oDAAoD,CAAC;AACnE,cAAc,iDAAiD,CAAC;AAChE,cAAc,8DAA8D,CAAC;AAC7E,cAAc,iDAAiD,CAAC;AAChE,cAAc,kDAAkD,CAAC;AACjE,cAAc,2DAA2D,CAAC;AAC1E,cAAc,gCAAgC,CAAC;AAE/C,YAAY;AAEZ,YAAY","sourcesContent":["export * from './lib/expand-row/expand-row.module';\nexport * from './lib/expand-row/expand-row-container/expand-row-container.component';\nexport * from './lib/expand-row/expand-row-container/expand-row-content.directive';\nexport * from './lib/expand-row/expand-row-container/expand-row-container.component.module';\nexport * from './lib/expand-row/expand-controls-cell/expand-controls-cell.component';\nexport * from './lib/expand-row/expand-controls-cell/expand-controls-cell.component.module';\nexport * from './lib/expand-row/expand-row.service';\nexport * from './lib/expand-row/expand-row.directive';\n\nexport * from './lib/select-row/select-row.module';\nexport * from './lib/select-row/checkbox-cell/checkbox-cell.component';\nexport * from './lib/select-row/checkbox-cell/checkbox-cell.component.module';\nexport * from './lib/select-row/checkbox-header-cell/checkbox-header-cell.component';\nexport * from './lib/select-row/checkbox-header-cell/checkbox-header-cell.component.module';\nexport * from './lib/select-row/select-row.service';\nexport * from './lib/select-row/selected-rows.directive';\nexport * from './lib/select-row/tokens';\nexport * from './lib/row-animation';\nexport * from './lib/table-data-source.directive';\nexport * from './lib/table-row-metadata';\n\nexport * from './lib/persistent-paginator.directive';\n\n// region table filter\n\nexport * from './lib/table-filter/filter-header-row.directive';\nexport * from './lib/table-filter/table-filter.module';\nexport * from './lib/table-filter/table-filter.service';\nexport * from './lib/table-filter/to-filter-column-names.pipe';\nexport * from './lib/table-filter/tokens';\n\n// endregion\n\n// region table column menu\n\nexport * from './lib/table-column-menu/table-column-menu.component';\nexport * from './lib/table-column-menu/table-column-menu.component.module';\nexport * from './lib/table-column-menu/table-show-archived-slide/table-show-archived-slide.component';\nexport * from './lib/table-column-menu/table-show-archived-slide/table-show-archived-slide.component.module';\nexport * from './lib/table-column-menu/table-column-option/table-column-option.component';\n\n// endregion\n\n// region table create button\n\nexport * from './lib/table-create-button/table-create-button.directive';\nexport * from './lib/table-create-button/tokens';\n\n// endregion\n\n// region table row controls\n\nexport * from './lib/table-row-controls/table-row-controls.module';\nexport * from './lib/table-row-controls/row-controls-cell/row-controls-cell.component';\nexport * from './lib/table-row-controls/row-controls-cell/row-controls-cell.component.module';\nexport * from './lib/table-row-controls/row-controls-header-cell/row-controls-header-cell.component';\nexport * from './lib/table-row-controls/row-controls-header-cell/row-controls-header-cell.component.module';\nexport * from './lib/table-row-controls/tokens';\n\n// endregion\n\n// region table select controls\n\nexport * from './lib/table-select-controls/table-select-controls.component';\nexport * from './lib/table-select-controls/table-select-controls.component.module';\n\n// endregion\n\n// region cells\n\n// region image\n\nexport * from './lib/cells/image-cell/image-cell.component';\nexport * from './lib/cells/image-cell/image-cell.component.module';\n\n// endregion\n\n// region copy-to-clipboard cell\n\nexport * from './lib/cells/copy-to-clipboard-cell/copy-to-clipboard-cell.component';\nexport * from './lib/cells/copy-to-clipboard-cell/copy-to-clipboard-cell.component.module';\n\n// endregion\n\n// region icon cell\n\nexport * from './lib/cells/icon-cell/icon-cell.component';\nexport * from './lib/cells/icon-cell/icon-cell.component.module';\n\n// endregion\n\n// region date cell\n\nexport * from './lib/cells/date-cell/date-cell.component';\nexport * from './lib/cells/date-cell/date-cell.component.module';\n\n// endregion\n\n// region link cell\n\nexport * from './lib/cells/link-cell/link-cell.component';\nexport * from './lib/cells/link-cell/link-cell.component.module';\n\n// endregion\n\n// region options cell\n\nexport * from './lib/cells/options-cell/options-cell.component';\nexport * from './lib/cells/options-cell/options-cell.component.module';\n\n// endregion\n\n// region boolean cell\n\nexport * from './lib/cells/boolean-cell/boolean-cell.component';\nexport * from './lib/cells/boolean-cell/boolean-cell.component.module';\n\n// endregion\n\n// region table-row-actions\n\nexport * from './lib/table-row-actions/decorators';\nexport * from './lib/table-row-actions/table-row-action.directive';\nexport * from './lib/table-row-actions/table-row-action.method';\nexport * from './lib/table-row-actions/table-row-action-executing.directive';\nexport * from './lib/table-row-actions/table-row-action-status';\nexport * from './lib/table-row-actions/table-row-actions.module';\nexport * from './lib/table-row-actions/table-row-header-action.directive';\nexport * from './lib/table-row-actions/tokens';\n\n// endregion\n\n// endregion\n"]}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Directive, NgModule, Input } from '@angular/core';
|
|
2
|
+
import { MatPaginator } from '@angular/material/paginator';
|
|
3
|
+
import { tap } from 'rxjs/operators';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
import * as i1 from "@angular/material/paginator";
|
|
6
|
+
export class PersistentPaginatorDirective {
|
|
7
|
+
constructor(matPaginator) {
|
|
8
|
+
this.matPaginator = matPaginator;
|
|
9
|
+
}
|
|
10
|
+
ngOnInit() {
|
|
11
|
+
const config = this.restoreConfig();
|
|
12
|
+
if (config) {
|
|
13
|
+
this.matPaginator.pageSize = config.pageSize;
|
|
14
|
+
}
|
|
15
|
+
this._subscription = this.matPaginator.page.pipe(tap(() => this.storeConfig())).subscribe();
|
|
16
|
+
}
|
|
17
|
+
ngOnDestroy() {
|
|
18
|
+
var _a;
|
|
19
|
+
(_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
20
|
+
}
|
|
21
|
+
getKey() {
|
|
22
|
+
return 'rxap_mat-paginator-persistent' + this.id;
|
|
23
|
+
}
|
|
24
|
+
storeConfig() {
|
|
25
|
+
const pageSize = this.matPaginator.pageSize;
|
|
26
|
+
localStorage.setItem(this.getKey(), JSON.stringify({ pageSize }));
|
|
27
|
+
}
|
|
28
|
+
restoreConfig() {
|
|
29
|
+
const configStorage = localStorage.getItem(this.getKey());
|
|
30
|
+
if (configStorage) {
|
|
31
|
+
try {
|
|
32
|
+
return JSON.parse(configStorage);
|
|
33
|
+
}
|
|
34
|
+
catch (e) {
|
|
35
|
+
console.warn(`Could not parse mat paginator persistent config: ${e.message}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
PersistentPaginatorDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: PersistentPaginatorDirective, deps: [{ token: i1.MatPaginator }], target: i0.ɵɵFactoryTarget.Directive });
|
|
42
|
+
PersistentPaginatorDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.0.1", type: PersistentPaginatorDirective, selector: "mat-paginator[rxapPersistent]", inputs: { id: "id" }, ngImport: i0 });
|
|
43
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: PersistentPaginatorDirective, decorators: [{
|
|
44
|
+
type: Directive,
|
|
45
|
+
args: [{
|
|
46
|
+
selector: 'mat-paginator[rxapPersistent]'
|
|
47
|
+
}]
|
|
48
|
+
}], ctorParameters: function () { return [{ type: i1.MatPaginator }]; }, propDecorators: { id: [{
|
|
49
|
+
type: Input
|
|
50
|
+
}] } });
|
|
51
|
+
export class PersistentPaginatorDirectiveModule {
|
|
52
|
+
}
|
|
53
|
+
PersistentPaginatorDirectiveModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: PersistentPaginatorDirectiveModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
54
|
+
PersistentPaginatorDirectiveModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: PersistentPaginatorDirectiveModule, declarations: [PersistentPaginatorDirective], exports: [PersistentPaginatorDirective] });
|
|
55
|
+
PersistentPaginatorDirectiveModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: PersistentPaginatorDirectiveModule });
|
|
56
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: PersistentPaginatorDirectiveModule, decorators: [{
|
|
57
|
+
type: NgModule,
|
|
58
|
+
args: [{
|
|
59
|
+
exports: [PersistentPaginatorDirective],
|
|
60
|
+
declarations: [PersistentPaginatorDirective]
|
|
61
|
+
}]
|
|
62
|
+
}] });
|
|
63
|
+
//# sourceMappingURL=persistent-paginator.directive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"persistent-paginator.directive.js","sourceRoot":"","sources":["../../../../../../libs/material/table-system/src/lib/persistent-paginator.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,QAAQ,EACR,KAAK,EAGN,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;;;AAKrC,MAAM,OAAO,4BAA4B;IAOvC,YACmB,YAA0B;QAA1B,iBAAY,GAAZ,YAAY,CAAc;IAC1C,CAAC;IAEG,QAAQ;QACb,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;QACpC,IAAI,MAAM,EAAE;YACV,IAAI,CAAC,YAAY,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;SAC9C;QACD,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAC9C,GAAG,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAC9B,CAAC,SAAS,EAAE,CAAA;IACf,CAAC;IAEM,WAAW;;QAChB,MAAA,IAAI,CAAC,aAAa,0CAAE,WAAW,EAAE,CAAC;IACpC,CAAC;IAEM,MAAM;QACX,OAAO,+BAA+B,GAAG,IAAI,CAAC,EAAE,CAAC;IACnD,CAAC;IAEM,WAAW;QAChB,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC;QAC5C,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;IACpE,CAAC;IAEM,aAAa;QAClB,MAAM,aAAa,GAAG,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;QAC1D,IAAI,aAAa,EAAE;YACjB,IAAI;gBACF,OAAO,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;aAClC;YAAC,OAAO,CAAC,EAAE;gBACV,OAAO,CAAC,IAAI,CAAC,oDAAoD,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;aAC/E;SACF;QACD,OAAO,IAAI,CAAC;IACd,CAAC;;yHA5CU,4BAA4B;6GAA5B,4BAA4B;2FAA5B,4BAA4B;kBAHxC,SAAS;mBAAC;oBACT,QAAQ,EAAE,+BAA+B;iBAC1C;mGAIQ,EAAE;sBADR,KAAK;;AAkDR,MAAM,OAAO,kCAAkC;;+HAAlC,kCAAkC;gIAAlC,kCAAkC,iBApDlC,4BAA4B,aAA5B,4BAA4B;gIAoD5B,kCAAkC;2FAAlC,kCAAkC;kBAJ9C,QAAQ;mBAAC;oBACR,OAAO,EAAE,CAAE,4BAA4B,CAAE;oBACzC,YAAY,EAAE,CAAE,4BAA4B,CAAE;iBAC/C","sourcesContent":["import {\n Directive,\n NgModule,\n Input,\n OnDestroy,\n OnInit\n} from '@angular/core';\nimport { MatPaginator } from '@angular/material/paginator';\nimport { Subscription } from 'rxjs';\nimport { tap } from 'rxjs/operators';\n\n@Directive({\n selector: 'mat-paginator[rxapPersistent]'\n})\nexport class PersistentPaginatorDirective implements OnInit, OnDestroy {\n\n @Input()\n public id?: string;\n\n private _subscription?: Subscription;\n\n constructor(\n private readonly matPaginator: MatPaginator,\n ) {}\n\n public ngOnInit() {\n const config = this.restoreConfig();\n if (config) {\n this.matPaginator.pageSize = config.pageSize;\n }\n this._subscription = this.matPaginator.page.pipe(\n tap(() => this.storeConfig())\n ).subscribe()\n }\n\n public ngOnDestroy() {\n this._subscription?.unsubscribe();\n }\n\n public getKey() {\n return 'rxap_mat-paginator-persistent' + this.id;\n }\n\n public storeConfig() {\n const pageSize = this.matPaginator.pageSize;\n localStorage.setItem(this.getKey(), JSON.stringify({ pageSize }));\n }\n\n public restoreConfig(): { pageSize: number } | null {\n const configStorage = localStorage.getItem(this.getKey());\n if (configStorage) {\n try {\n return JSON.parse(configStorage);\n } catch (e) {\n console.warn(`Could not parse mat paginator persistent config: ${e.message}`);\n }\n }\n return null;\n }\n\n}\n\n@NgModule({\n exports: [ PersistentPaginatorDirective ],\n declarations: [ PersistentPaginatorDirective ]\n})\nexport class PersistentPaginatorDirectiveModule {}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FormDirective } from '@rxap/forms';
|
|
2
|
-
import { ChangeDetectorRef, Directive, forwardRef, Inject, Optional
|
|
2
|
+
import { ChangeDetectorRef, Directive, forwardRef, Inject, Optional } from '@angular/core';
|
|
3
3
|
import { TableFilterService } from './table-filter.service';
|
|
4
|
-
import { debounceTime, distinctUntilChanged, map } from 'rxjs/operators';
|
|
4
|
+
import { debounceTime, distinctUntilChanged, map, tap } from 'rxjs/operators';
|
|
5
5
|
import { RXAP_TABLE_FILTER_FORM_DEFINITION } from './tokens';
|
|
6
6
|
import { ControlContainer } from '@angular/forms';
|
|
7
7
|
import { equals } from '@rxap/utilities';
|
|
@@ -17,8 +17,8 @@ export class FilterHeaderRowDirective extends FormDirective {
|
|
|
17
17
|
this._subscription = this.form.value$
|
|
18
18
|
.pipe(debounceTime(1000), map((values) => Object.entries(values)
|
|
19
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)))
|
|
21
|
-
.subscribe(
|
|
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
22
|
}
|
|
23
23
|
ngOnDestroy() {
|
|
24
24
|
var _a;
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,CAAoB;IAOlD,CAAC;IAEM,QAAQ;QACb,KAAK,CAAC,QAAQ,EAAE,CAAC;QACjB,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM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AiC","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"]}
|
|
@@ -7,6 +7,11 @@ export class TableFilterService {
|
|
|
7
7
|
this.current = {};
|
|
8
8
|
this._subscription = this.change.subscribe(current => this.current = current);
|
|
9
9
|
}
|
|
10
|
+
setMap(map) {
|
|
11
|
+
const current = this.current;
|
|
12
|
+
const next = Object.assign(current, map);
|
|
13
|
+
this.change.next(next);
|
|
14
|
+
}
|
|
10
15
|
set(key, value) {
|
|
11
16
|
const current = this.current;
|
|
12
17
|
current[key] = value;
|
|
@@ -1 +1 @@
|
|
|
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,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;;+
|
|
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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playSubject,\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"]}
|
|
@@ -21,6 +21,7 @@ export class TableRowActionDirective {
|
|
|
21
21
|
this.matButton = matButton;
|
|
22
22
|
this._hasConfirmDirective = false;
|
|
23
23
|
this._currentStatus = TableRowActionStatus.DONE;
|
|
24
|
+
this._actionDisabled = false;
|
|
24
25
|
this.actionMethodList = coerceArray(actionMethodList);
|
|
25
26
|
}
|
|
26
27
|
set hasConfirmDirective(value) {
|
|
@@ -43,6 +44,9 @@ export class TableRowActionDirective {
|
|
|
43
44
|
}
|
|
44
45
|
execute() {
|
|
45
46
|
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
if (this._actionDisabled) {
|
|
48
|
+
return Promise.resolve();
|
|
49
|
+
}
|
|
46
50
|
this.setStatus(TableRowActionStatus.EXECUTING);
|
|
47
51
|
try {
|
|
48
52
|
yield Promise.all(this.getElementList().map((element) => {
|
|
@@ -78,15 +82,26 @@ export class TableRowActionDirective {
|
|
|
78
82
|
findTypedActionMethod() {
|
|
79
83
|
return this.actionMethodList.filter(IsTableRowActionTypeMethod(this.type));
|
|
80
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
|
+
*/
|
|
81
92
|
setButtonDisabled() {
|
|
82
|
-
|
|
83
|
-
this.matButton.disabled = true;
|
|
84
|
-
}
|
|
93
|
+
this._actionDisabled = true;
|
|
85
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
|
+
*/
|
|
86
103
|
setButtonEnabled() {
|
|
87
|
-
|
|
88
|
-
this.matButton.disabled = false;
|
|
89
|
-
}
|
|
104
|
+
this._actionDisabled = false;
|
|
90
105
|
}
|
|
91
106
|
setStatus(status) {
|
|
92
107
|
var _a, _b;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-row-action.directive.js","sourceRoot":"","sources":["../../../../../../../libs/material/table-system/src/lib/table-row-actions/table-row-action.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,MAAM,EACN,KAAK,EACL,SAAS,EACT,QAAQ,EACR,gBAAgB,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EACL,WAAW,EACX,aAAa,EACb,QAAQ,EACT,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,gCAAgC,EAAE,MAAM,wCAAwC,CAAC;AAC1F,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EACL,0BAA0B,EAC1B,gCAAgC,EAIjC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,4BAA4B,EAAE,MA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AwB,aAExB,WAAW,aAGX,SAAS;wGA/CR,uBAAuB,4ZA2BpB,gCAAgC;AAjB9C;IADC,QAAQ;;wDACa;AAGtB;IADC,QAAQ;;qDACY;2FAbV,uBAAuB;kBAHnC,SAAS;mBAAC;oBACT,QAAQ,EAAE,4BAA4B;iBACvC;;0BAmCI,MAAM;2BAAC,4BAA4B;;0BAInC,MAAM;2BAAC,iBAAiB;;0BAExB,MAAM;2BAAC,gBAAgB;;0BAEvB,MAAM;2BAAC,wBAAwB;;0BAE/B,MAAM;2BAAC,WAAW;;0BAElB,QAAQ;;0BACR,MAAM;2BAAC,SAAS;4CA3CR,mBAAmB;sBAD7B,KAAK;uBAAC,aAAa;gBAOb,OAAO;sBAFb,KAAK;gBAKC,IAAI;sBAFV,KAAK;uBAAC,oBAAoB;gBAKpB,YAAY;sBADlB,KAAK;gBAIC,cAAc;sBADpB,KAAK;gBAOC,OAAO;sBADb,KAAK;gBAIW,kBAAkB;sBADlC,YAAY;uBAAC,gCAAgC;gBA2BvC,WAAW;sBADjB,YAAY;uBAAC,WAAW;gBAMlB,OAAO;sBADb,YAAY;uBAAC,OAAO,EAAE,CAAE,QAAQ,CAAE","sourcesContent":["import {\n ChangeDetectorRef,\n ContentChild,\n Directive,\n HostListener,\n Inject,\n Input,\n isDevMode,\n Optional,\n ViewContainerRef\n} from '@angular/core';\nimport { MatButton } from '@angular/material/button';\nimport { MatSnackBar } from '@angular/material/snack-bar';\nimport {\n coerceArray,\n coerceBoolean,\n Required\n} from '@rxap/utilities';\nimport { TableRowActionExecutingDirective } from './table-row-action-executing.directive';\nimport { TableRowActionStatus } from './table-row-action-status';\nimport {\n IsTableRowActionTypeMethod,\n IsTableRowActionTypeSwitchMethod,\n TableRowActionMethod,\n TableRowActionTypeMethod,\n TableRowActionTypeSwitchMethod\n} from './table-row-action.method';\nimport { RXAP_TABLE_ROW_ACTION_METHOD } from './tokens';\nimport { TableDataSourceDirective } from '../table-data-source.directive';\n\n@Directive({\n selector: 'button[rxapTableRowAction]'\n})\nexport class TableRowActionDirective<Data extends Record<string, any>> {\n private _hasConfirmDirective = false;\n\n @Input('rxapConfirm')\n public set hasConfirmDirective(value: any) {\n this._hasConfirmDirective = coerceBoolean(value);\n }\n\n @Input()\n @Required\n public element!: Data;\n @Input('rxapTableRowAction')\n @Required\n public type!: string;\n\n @Input()\n public errorMessage?: string;\n\n @Input()\n public successMessage?: string;\n\n /**\n * true - after the action is executed the table datasource is refreshed\n */\n @Input()\n public refresh?: boolean;\n\n @ContentChild(TableRowActionExecutingDirective)\n private readonly executingDirective?: TableRowActionExecutingDirective;\n private _currentStatus: TableRowActionStatus = TableRowActionStatus.DONE;\n\n private readonly actionMethodList: Array<TableRowActionMethod<Data>>;\n\n constructor(\n @Inject(RXAP_TABLE_ROW_ACTION_METHOD)\n actionMethodList:\n | Array<TableRowActionMethod<Data>>\n | TableRowActionMethod<Data>,\n @Inject(ChangeDetectorRef)\n protected readonly cdr: ChangeDetectorRef,\n @Inject(ViewContainerRef)\n private readonly vcr: ViewContainerRef,\n @Inject(TableDataSourceDirective)\n private readonly tableDataSourceDirective: TableDataSourceDirective,\n @Inject(MatSnackBar)\n private readonly snackBar: MatSnackBar,\n @Optional()\n @Inject(MatButton)\n private readonly matButton: MatButton | null\n ) {\n this.actionMethodList = coerceArray(actionMethodList);\n }\n\n @HostListener('confirmed')\n public onConfirmed() {\n return this.execute();\n }\n\n @HostListener('click', [ '$event' ])\n public onClick($event: Event) {\n $event.stopPropagation();\n if (!this._hasConfirmDirective) {\n return this.execute();\n } else {\n if (isDevMode()) {\n console.debug('skip remote method call. Wait for confirmation.');\n }\n }\n return Promise.resolve();\n }\n\n public async execute(): Promise<void> {\n this.setStatus(TableRowActionStatus.EXECUTING);\n try {\n await Promise.all(\n this.getElementList().map((element) => {\n return Promise.all([\n Promise.all(\n this.findUntypedActionMethod().map((am) =>\n am.call({ element, type: this.type })\n )\n ),\n Promise.all(\n this.findTypedActionMethod().map((am) => am.call(element))\n )\n ]);\n })\n );\n this.setStatus(TableRowActionStatus.SUCCESS);\n } catch (e) {\n console.error(`Failed to execute row action: ${e.message}`);\n this.setStatus(TableRowActionStatus.ERROR);\n }\n }\n\n protected getElementList(): Data[] {\n return [ this.element ];\n }\n\n /**\n * find all method instance in the actionMethodList member that\n * do not have a @TableActionMethod decorators\n * @private\n */\n private findUntypedActionMethod(): Array<TableRowActionTypeSwitchMethod<Data>> {\n return this.actionMethodList.filter(IsTableRowActionTypeSwitchMethod);\n }\n\n /**\n * find all method instance in the actionMethodList member that\n * do have a @TableActionMethod decorators with the current type\n * @private\n */\n private findTypedActionMethod(): Array<TableRowActionTypeMethod<Data>> {\n return this.actionMethodList.filter(IsTableRowActionTypeMethod(this.type));\n }\n\n protected setButtonDisabled() {\n if (this.matButton) {\n this.matButton.disabled = true;\n }\n }\n\n protected setButtonEnabled() {\n if (this.matButton) {\n this.matButton.disabled = false;\n }\n }\n\n private setStatus(status: TableRowActionStatus) {\n if (this._currentStatus === status) {\n return;\n }\n this._currentStatus = status;\n switch (status) {\n case TableRowActionStatus.EXECUTING:\n this.setButtonDisabled();\n this.executingDirective?.show();\n break;\n case TableRowActionStatus.SUCCESS:\n if (this.refresh) {\n this.tableDataSourceDirective.refresh();\n }\n if (this.successMessage) {\n this.snackBar.open(this.successMessage, 'ok', { duration: 2560 });\n }\n this.setStatus(TableRowActionStatus.DONE);\n break;\n case TableRowActionStatus.ERROR:\n this.setStatus(TableRowActionStatus.DONE);\n if (this.errorMessage) {\n this.snackBar.open(this.errorMessage, 'ok', { duration: 5120 });\n }\n break;\n case TableRowActionStatus.DONE:\n this.setButtonEnabled();\n this.executingDirective?.hide();\n break;\n }\n this.cdr.detectChanges();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"table-row-action.directive.js","sourceRoot":"","sources":["../../../../../../../libs/material/table-system/src/lib/table-row-actions/table-row-action.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,SAAS,EAC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CAAE,QAAQ,CAAE","sourcesContent":["import {\n ChangeDetectorRef,\n ContentChild,\n Directive,\n HostListener,\n Inject,\n Input,\n isDevMode,\n Optional,\n ViewContainerRef\n} from '@angular/core';\nimport { MatButton } from '@angular/material/button';\nimport { MatSnackBar } from '@angular/material/snack-bar';\nimport {\n coerceArray,\n coerceBoolean,\n Required\n} from '@rxap/utilities';\nimport { TableRowActionExecutingDirective } from './table-row-action-executing.directive';\nimport { TableRowActionStatus } from './table-row-action-status';\nimport {\n IsTableRowActionTypeMethod,\n IsTableRowActionTypeSwitchMethod,\n TableRowActionMethod,\n TableRowActionTypeMethod,\n TableRowActionTypeSwitchMethod\n} from './table-row-action.method';\nimport { RXAP_TABLE_ROW_ACTION_METHOD } from './tokens';\nimport { TableDataSourceDirective } from '../table-data-source.directive';\n\n@Directive({\n selector: 'button[rxapTableRowAction]'\n})\nexport class TableRowActionDirective<Data extends Record<string, any>> {\n private _hasConfirmDirective = false;\n\n @Input('rxapConfirm')\n public set hasConfirmDirective(value: any) {\n this._hasConfirmDirective = coerceBoolean(value);\n }\n\n @Input()\n @Required\n public element!: Data;\n @Input('rxapTableRowAction')\n @Required\n public type!: string;\n\n @Input()\n public errorMessage?: string;\n\n @Input()\n public successMessage?: string;\n\n /**\n * true - after the action is executed the table datasource is refreshed\n */\n @Input()\n public refresh?: boolean;\n\n @ContentChild(TableRowActionExecutingDirective)\n private readonly executingDirective?: TableRowActionExecutingDirective;\n private _currentStatus: TableRowActionStatus = TableRowActionStatus.DONE;\n\n private readonly actionMethodList: Array<TableRowActionMethod<Data>>;\n\n private _actionDisabled = false;\n\n constructor(\n @Inject(RXAP_TABLE_ROW_ACTION_METHOD)\n actionMethodList:\n | Array<TableRowActionMethod<Data>>\n | TableRowActionMethod<Data>,\n @Inject(ChangeDetectorRef)\n protected readonly cdr: ChangeDetectorRef,\n @Inject(ViewContainerRef)\n private readonly vcr: ViewContainerRef,\n @Inject(TableDataSourceDirective)\n private readonly tableDataSourceDirective: TableDataSourceDirective,\n @Inject(MatSnackBar)\n private readonly snackBar: MatSnackBar,\n @Optional()\n @Inject(MatButton)\n private readonly matButton: MatButton | null\n ) {\n this.actionMethodList = coerceArray(actionMethodList);\n }\n\n @HostListener('confirmed')\n public onConfirmed() {\n return this.execute();\n }\n\n @HostListener('click', [ '$event' ])\n public onClick($event: Event) {\n $event.stopPropagation();\n if (!this._hasConfirmDirective) {\n return this.execute();\n } else {\n if (isDevMode()) {\n console.debug('skip remote method call. Wait for confirmation.');\n }\n }\n return Promise.resolve();\n }\n\n public async execute(): Promise<void> {\n if (this._actionDisabled) {\n return Promise.resolve();\n }\n this.setStatus(TableRowActionStatus.EXECUTING);\n try {\n await Promise.all(\n this.getElementList().map((element) => {\n return Promise.all([\n Promise.all(\n this.findUntypedActionMethod().map((am) =>\n am.call({ element, type: this.type })\n )\n ),\n Promise.all(\n this.findTypedActionMethod().map((am) => am.call(element))\n )\n ]);\n })\n );\n this.setStatus(TableRowActionStatus.SUCCESS);\n } catch (e) {\n console.error(`Failed to execute row action: ${e.message}`);\n this.setStatus(TableRowActionStatus.ERROR);\n }\n }\n\n protected getElementList(): Data[] {\n return [ this.element ];\n }\n\n /**\n * find all method instance in the actionMethodList member that\n * do not have a @TableActionMethod decorators\n * @private\n */\n private findUntypedActionMethod(): Array<TableRowActionTypeSwitchMethod<Data>> {\n return this.actionMethodList.filter(IsTableRowActionTypeSwitchMethod);\n }\n\n /**\n * find all method instance in the actionMethodList member that\n * do have a @TableActionMethod decorators with the current type\n * @private\n */\n private findTypedActionMethod(): Array<TableRowActionTypeMethod<Data>> {\n return this.actionMethodList.filter(IsTableRowActionTypeMethod(this.type));\n }\n\n /**\n * Disables the action. If the button is pressed the action is NOT executed\n *\n * Hint: the button is set to disabled = true to prevent any conflict with\n * extern button enable features linke : rxapHasEnablePermission\n * @protected\n */\n protected setButtonDisabled() {\n this._actionDisabled = true;\n }\n\n /**\n * Enables the action. If the button is pressed the action is executed\n *\n * TODO : find a way to communicate the disabled state between the features\n * Hint: the button is set to disabled = false to prevent any conflict with\n * extern button enable features linke : rxapHasEnablePermission\n * @protected\n */\n protected setButtonEnabled() {\n this._actionDisabled = false;\n }\n\n private setStatus(status: TableRowActionStatus) {\n if (this._currentStatus === status) {\n return;\n }\n this._currentStatus = status;\n switch (status) {\n case TableRowActionStatus.EXECUTING:\n this.setButtonDisabled();\n this.executingDirective?.show();\n break;\n case TableRowActionStatus.SUCCESS:\n if (this.refresh) {\n this.tableDataSourceDirective.refresh();\n }\n if (this.successMessage) {\n this.snackBar.open(this.successMessage, 'ok', { duration: 2560 });\n }\n this.setStatus(TableRowActionStatus.DONE);\n break;\n case TableRowActionStatus.ERROR:\n this.setStatus(TableRowActionStatus.DONE);\n if (this.errorMessage) {\n this.snackBar.open(this.errorMessage, 'ok', { duration: 5120 });\n }\n break;\n case TableRowActionStatus.DONE:\n this.setButtonEnabled();\n this.executingDirective?.hide();\n break;\n }\n this.cdr.detectChanges();\n }\n}\n"]}
|
|
@@ -23,6 +23,7 @@ import { MatSort } from '@angular/material/sort';
|
|
|
23
23
|
import { DynamicTableDataSource } from '@rxap/data-source/table';
|
|
24
24
|
import { ToggleSubject } from '@rxap/utilities/rxjs';
|
|
25
25
|
import { pipeDataSource } from '@rxap/data-source';
|
|
26
|
+
import * as i1$3 from '@angular/material/paginator';
|
|
26
27
|
import { FormDirective } from '@rxap/forms';
|
|
27
28
|
import { ControlContainer } from '@angular/forms';
|
|
28
29
|
import * as i3 from '@angular/material/menu';
|
|
@@ -524,6 +525,11 @@ class TableFilterService {
|
|
|
524
525
|
this.current = {};
|
|
525
526
|
this._subscription = this.change.subscribe(current => this.current = current);
|
|
526
527
|
}
|
|
528
|
+
setMap(map) {
|
|
529
|
+
const current = this.current;
|
|
530
|
+
const next = Object.assign(current, map);
|
|
531
|
+
this.change.next(next);
|
|
532
|
+
}
|
|
527
533
|
set(key, value) {
|
|
528
534
|
const current = this.current;
|
|
529
535
|
current[key] = value;
|
|
@@ -703,6 +709,64 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImpor
|
|
|
703
709
|
}]
|
|
704
710
|
}] });
|
|
705
711
|
|
|
712
|
+
class PersistentPaginatorDirective {
|
|
713
|
+
constructor(matPaginator) {
|
|
714
|
+
this.matPaginator = matPaginator;
|
|
715
|
+
}
|
|
716
|
+
ngOnInit() {
|
|
717
|
+
const config = this.restoreConfig();
|
|
718
|
+
if (config) {
|
|
719
|
+
this.matPaginator.pageSize = config.pageSize;
|
|
720
|
+
}
|
|
721
|
+
this._subscription = this.matPaginator.page.pipe(tap(() => this.storeConfig())).subscribe();
|
|
722
|
+
}
|
|
723
|
+
ngOnDestroy() {
|
|
724
|
+
var _a;
|
|
725
|
+
(_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
726
|
+
}
|
|
727
|
+
getKey() {
|
|
728
|
+
return 'rxap_mat-paginator-persistent' + this.id;
|
|
729
|
+
}
|
|
730
|
+
storeConfig() {
|
|
731
|
+
const pageSize = this.matPaginator.pageSize;
|
|
732
|
+
localStorage.setItem(this.getKey(), JSON.stringify({ pageSize }));
|
|
733
|
+
}
|
|
734
|
+
restoreConfig() {
|
|
735
|
+
const configStorage = localStorage.getItem(this.getKey());
|
|
736
|
+
if (configStorage) {
|
|
737
|
+
try {
|
|
738
|
+
return JSON.parse(configStorage);
|
|
739
|
+
}
|
|
740
|
+
catch (e) {
|
|
741
|
+
console.warn(`Could not parse mat paginator persistent config: ${e.message}`);
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
return null;
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
PersistentPaginatorDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: PersistentPaginatorDirective, deps: [{ token: i1$3.MatPaginator }], target: i0.ɵɵFactoryTarget.Directive });
|
|
748
|
+
PersistentPaginatorDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.0.1", type: PersistentPaginatorDirective, selector: "mat-paginator[rxapPersistent]", inputs: { id: "id" }, ngImport: i0 });
|
|
749
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: PersistentPaginatorDirective, decorators: [{
|
|
750
|
+
type: Directive,
|
|
751
|
+
args: [{
|
|
752
|
+
selector: 'mat-paginator[rxapPersistent]'
|
|
753
|
+
}]
|
|
754
|
+
}], ctorParameters: function () { return [{ type: i1$3.MatPaginator }]; }, propDecorators: { id: [{
|
|
755
|
+
type: Input
|
|
756
|
+
}] } });
|
|
757
|
+
class PersistentPaginatorDirectiveModule {
|
|
758
|
+
}
|
|
759
|
+
PersistentPaginatorDirectiveModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: PersistentPaginatorDirectiveModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
760
|
+
PersistentPaginatorDirectiveModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: PersistentPaginatorDirectiveModule, declarations: [PersistentPaginatorDirective], exports: [PersistentPaginatorDirective] });
|
|
761
|
+
PersistentPaginatorDirectiveModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: PersistentPaginatorDirectiveModule });
|
|
762
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: PersistentPaginatorDirectiveModule, decorators: [{
|
|
763
|
+
type: NgModule,
|
|
764
|
+
args: [{
|
|
765
|
+
exports: [PersistentPaginatorDirective],
|
|
766
|
+
declarations: [PersistentPaginatorDirective]
|
|
767
|
+
}]
|
|
768
|
+
}] });
|
|
769
|
+
|
|
706
770
|
const RXAP_TABLE_FILTER_FORM_DEFINITION = new InjectionToken('rxap/form-table-system/filter-form-definition');
|
|
707
771
|
|
|
708
772
|
class FilterHeaderRowDirective extends FormDirective {
|
|
@@ -715,8 +779,8 @@ class FilterHeaderRowDirective extends FormDirective {
|
|
|
715
779
|
this._subscription = this.form.value$
|
|
716
780
|
.pipe(debounceTime(1000), map((values) => Object.entries(values)
|
|
717
781
|
.filter(([key, value]) => value !== null && value !== undefined && value !== '')
|
|
718
|
-
.reduce((obj, [key, value]) => (Object.assign(Object.assign({}, obj), { [key]: value })), {})), distinctUntilChanged((a, b) => equals(a, b)))
|
|
719
|
-
.subscribe(
|
|
782
|
+
.reduce((obj, [key, value]) => (Object.assign(Object.assign({}, obj), { [key]: value })), {})), distinctUntilChanged((a, b) => equals(a, b)), tap(values => this.tableFilter.setMap(values)))
|
|
783
|
+
.subscribe();
|
|
720
784
|
}
|
|
721
785
|
ngOnDestroy() {
|
|
722
786
|
var _a;
|
|
@@ -1807,6 +1871,7 @@ class TableRowActionDirective {
|
|
|
1807
1871
|
this.matButton = matButton;
|
|
1808
1872
|
this._hasConfirmDirective = false;
|
|
1809
1873
|
this._currentStatus = TableRowActionStatus.DONE;
|
|
1874
|
+
this._actionDisabled = false;
|
|
1810
1875
|
this.actionMethodList = coerceArray(actionMethodList);
|
|
1811
1876
|
}
|
|
1812
1877
|
set hasConfirmDirective(value) {
|
|
@@ -1829,6 +1894,9 @@ class TableRowActionDirective {
|
|
|
1829
1894
|
}
|
|
1830
1895
|
execute() {
|
|
1831
1896
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1897
|
+
if (this._actionDisabled) {
|
|
1898
|
+
return Promise.resolve();
|
|
1899
|
+
}
|
|
1832
1900
|
this.setStatus(TableRowActionStatus.EXECUTING);
|
|
1833
1901
|
try {
|
|
1834
1902
|
yield Promise.all(this.getElementList().map((element) => {
|
|
@@ -1864,15 +1932,26 @@ class TableRowActionDirective {
|
|
|
1864
1932
|
findTypedActionMethod() {
|
|
1865
1933
|
return this.actionMethodList.filter(IsTableRowActionTypeMethod(this.type));
|
|
1866
1934
|
}
|
|
1935
|
+
/**
|
|
1936
|
+
* Disables the action. If the button is pressed the action is NOT executed
|
|
1937
|
+
*
|
|
1938
|
+
* Hint: the button is set to disabled = true to prevent any conflict with
|
|
1939
|
+
* extern button enable features linke : rxapHasEnablePermission
|
|
1940
|
+
* @protected
|
|
1941
|
+
*/
|
|
1867
1942
|
setButtonDisabled() {
|
|
1868
|
-
|
|
1869
|
-
this.matButton.disabled = true;
|
|
1870
|
-
}
|
|
1943
|
+
this._actionDisabled = true;
|
|
1871
1944
|
}
|
|
1945
|
+
/**
|
|
1946
|
+
* Enables the action. If the button is pressed the action is executed
|
|
1947
|
+
*
|
|
1948
|
+
* TODO : find a way to communicate the disabled state between the features
|
|
1949
|
+
* Hint: the button is set to disabled = false to prevent any conflict with
|
|
1950
|
+
* extern button enable features linke : rxapHasEnablePermission
|
|
1951
|
+
* @protected
|
|
1952
|
+
*/
|
|
1872
1953
|
setButtonEnabled() {
|
|
1873
|
-
|
|
1874
|
-
this.matButton.disabled = false;
|
|
1875
|
-
}
|
|
1954
|
+
this._actionDisabled = false;
|
|
1876
1955
|
}
|
|
1877
1956
|
setStatus(status) {
|
|
1878
1957
|
var _a, _b;
|
|
@@ -2090,5 +2169,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImpor
|
|
|
2090
2169
|
* Generated bundle index. Do not edit.
|
|
2091
2170
|
*/
|
|
2092
2171
|
|
|
2093
|
-
export { BooleanCellComponent, BooleanCellComponentModule, CheckboxCellComponent, CheckboxCellComponentModule, CheckboxHeaderCellComponent, CheckboxHeaderCellComponentModule, CopyToClipboardCellComponent, CopyToClipboardCellComponentModule, DateCellComponent, DateCellComponentModule, ExpandControlsCellComponent, ExpandControlsCellComponentModule, ExpandRowContainerComponent, ExpandRowContainerComponentModule, ExpandRowContentDirective, ExpandRowDirective, ExpandRowModule, ExpandRowService, FilterHeaderRowDirective, IconCellComponent, IconCellComponentModule, ImageCellComponent, ImageCellComponentModule, IsTableRowActionTypeMethod, IsTableRowActionTypeSwitchMethod, LinkCellComponent, LinkCellComponentModule, OptionsCellComponent, OptionsCellComponentModule, ROW_ARCHIVE_METHOD, ROW_DELETE_METHOD, ROW_EDIT_LOADER_METHOD, ROW_EDIT_METHOD, ROW_LINK_METHOD, ROW_RESTORE_METHOD, ROW_VIEW_METHOD, RXAP_MATERIAL_TABLE_SYSTEM_SELECT_ROW_OPTIONS, RXAP_TABLE_ACTION_METHOD_TYPE_METADATA, RXAP_TABLE_FILTER, RXAP_TABLE_FILTER_FORM_DEFINITION, RXAP_TABLE_METHOD, RXAP_TABLE_ROW_ACTION_METHOD, RowAnimation, RowControlsCellComponent, RowControlsCellComponentModule, RowControlsHeaderCellComponent, RowControlsHeaderCellComponentModule, SelectRowModule, SelectRowService, SelectedRowsDirective, TABLE_CREATE_REMOTE_METHOD, TABLE_DATA_SOURCE, TABLE_REMOTE_METHOD, TABLE_REMOTE_METHOD_ADAPTER_FACTORY, TableActionMethod, TableColumnMenuComponent, TableColumnMenuComponentModule, TableColumnOptionComponent, TableCreateButtonDirective, TableCreateButtonDirectiveModule, TableDataSourceDirective, TableDataSourceModule, TableFilterModule, TableFilterService, TableRowActionDirective, TableRowActionExecutingDirective, TableRowActionStatus, TableRowActionsModule, TableRowControlsModule, TableRowHeaderActionDirective, TableSelectControlsComponent, TableSelectControlsComponentModule, TableShowArchivedSlideComponent, TableShowArchivedSlideComponentModule, ToFilterColumnNamesPipe };
|
|
2172
|
+
export { BooleanCellComponent, BooleanCellComponentModule, CheckboxCellComponent, CheckboxCellComponentModule, CheckboxHeaderCellComponent, CheckboxHeaderCellComponentModule, CopyToClipboardCellComponent, CopyToClipboardCellComponentModule, DateCellComponent, DateCellComponentModule, ExpandControlsCellComponent, ExpandControlsCellComponentModule, ExpandRowContainerComponent, ExpandRowContainerComponentModule, ExpandRowContentDirective, ExpandRowDirective, ExpandRowModule, ExpandRowService, FilterHeaderRowDirective, IconCellComponent, IconCellComponentModule, ImageCellComponent, ImageCellComponentModule, IsTableRowActionTypeMethod, IsTableRowActionTypeSwitchMethod, LinkCellComponent, LinkCellComponentModule, OptionsCellComponent, OptionsCellComponentModule, PersistentPaginatorDirective, PersistentPaginatorDirectiveModule, ROW_ARCHIVE_METHOD, ROW_DELETE_METHOD, ROW_EDIT_LOADER_METHOD, ROW_EDIT_METHOD, ROW_LINK_METHOD, ROW_RESTORE_METHOD, ROW_VIEW_METHOD, RXAP_MATERIAL_TABLE_SYSTEM_SELECT_ROW_OPTIONS, RXAP_TABLE_ACTION_METHOD_TYPE_METADATA, RXAP_TABLE_FILTER, RXAP_TABLE_FILTER_FORM_DEFINITION, RXAP_TABLE_METHOD, RXAP_TABLE_ROW_ACTION_METHOD, RowAnimation, RowControlsCellComponent, RowControlsCellComponentModule, RowControlsHeaderCellComponent, RowControlsHeaderCellComponentModule, SelectRowModule, SelectRowService, SelectedRowsDirective, TABLE_CREATE_REMOTE_METHOD, TABLE_DATA_SOURCE, TABLE_REMOTE_METHOD, TABLE_REMOTE_METHOD_ADAPTER_FACTORY, TableActionMethod, TableColumnMenuComponent, TableColumnMenuComponentModule, TableColumnOptionComponent, TableCreateButtonDirective, TableCreateButtonDirectiveModule, TableDataSourceDirective, TableDataSourceModule, TableFilterModule, TableFilterService, TableRowActionDirective, TableRowActionExecutingDirective, TableRowActionStatus, TableRowActionsModule, TableRowControlsModule, TableRowHeaderActionDirective, TableSelectControlsComponent, TableSelectControlsComponentModule, TableShowArchivedSlideComponent, TableShowArchivedSlideComponentModule, ToFilterColumnNamesPipe };
|
|
2094
2173
|
//# sourceMappingURL=rxap-material-table-system.js.map
|