@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.
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/cdk/portal'), require('@rxap/utilities'), require('@angular/animations'), require('rxjs'), require('rxjs/operators'), require('@angular/common'), require('@angular/material/button'), require('@angular/material/icon'), require('@angular/cdk/collections'), require('@angular/material/checkbox'), require('@angular/cdk/table'), require('@angular/material/sort'), require('@rxap/data-source/table'), require('@rxap/utilities/rxjs'), require('@rxap/data-source'), require('@rxap/forms'), require('@angular/forms'), require('@angular/material/menu'), require('@rxap/directives'), require('@angular/flex-layout/extended'), require('@angular/flex-layout'), require('@angular/material/slide-toggle'), require('@angular/flex-layout/flex'), require('@angular/material/tooltip'), require('@rxap/components'), require('@rxap/open-api/remote-method'), require('@rxap/window-system'), require('@rxap/material-directives/icon'), require('@angular/material/core'), require('@rxap/utilities/reflect-metadata'), require('@angular/material/snack-bar'), require('@angular/material/progress-bar')) :
3
- typeof define === 'function' && define.amd ? define('@rxap/material-table-system', ['exports', '@angular/core', '@angular/cdk/portal', '@rxap/utilities', '@angular/animations', 'rxjs', 'rxjs/operators', '@angular/common', '@angular/material/button', '@angular/material/icon', '@angular/cdk/collections', '@angular/material/checkbox', '@angular/cdk/table', '@angular/material/sort', '@rxap/data-source/table', '@rxap/utilities/rxjs', '@rxap/data-source', '@rxap/forms', '@angular/forms', '@angular/material/menu', '@rxap/directives', '@angular/flex-layout/extended', '@angular/flex-layout', '@angular/material/slide-toggle', '@angular/flex-layout/flex', '@angular/material/tooltip', '@rxap/components', '@rxap/open-api/remote-method', '@rxap/window-system', '@rxap/material-directives/icon', '@angular/material/core', '@rxap/utilities/reflect-metadata', '@angular/material/snack-bar', '@angular/material/progress-bar'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.rxap = global.rxap || {}, global.rxap['material-table-system'] = {}), global.ng.core, global.ng.cdk.portal, global.utilities, global.ng.animations, global.rxjs, global.rxjs.operators, global.ng.common, global.ng.material.button, global.ng.material.icon, global.ng.cdk.collections, global.ng.material.checkbox, global.ng.cdk.table, global.ng.material.sort, global.table, global.rxjs$1, global.dataSource, global.forms, global.ng.forms, global.ng.material.menu, global.i6, global.ng.flexLayout.extended, global.ng.flexLayout, global.ng.material.slideToggle, global.ng.flexLayout.flex, global.ng.material.tooltip, global.i7$1, global.i8, global.windowSystem, global.i3$2, global.ng.material.core, global.reflectMetadata, global.ng.material.snackBar, global.ng.material.progressBar));
5
- }(this, (function (exports, i0, i1, utilities, animations, rxjs, operators, i2, i2$1, i1$1, collections, i1$2, i4, i2$2, table, rxjs$1, dataSource, forms, forms$1, i3, i6, i7, flexLayout, i3$1, i4$1, i6$1, i7$1, i8, windowSystem, i3$2, core, reflectMetadata, i2$3, progressBar) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/cdk/portal'), require('@rxap/utilities'), require('@angular/animations'), require('rxjs'), require('rxjs/operators'), require('@angular/common'), require('@angular/material/button'), require('@angular/material/icon'), require('@angular/cdk/collections'), require('@angular/material/checkbox'), require('@angular/cdk/table'), require('@angular/material/sort'), require('@rxap/data-source/table'), require('@rxap/utilities/rxjs'), require('@rxap/data-source'), require('@angular/material/paginator'), require('@rxap/forms'), require('@angular/forms'), require('@angular/material/menu'), require('@rxap/directives'), require('@angular/flex-layout/extended'), require('@angular/flex-layout'), require('@angular/material/slide-toggle'), require('@angular/flex-layout/flex'), require('@angular/material/tooltip'), require('@rxap/components'), require('@rxap/open-api/remote-method'), require('@rxap/window-system'), require('@rxap/material-directives/icon'), require('@angular/material/core'), require('@rxap/utilities/reflect-metadata'), require('@angular/material/snack-bar'), require('@angular/material/progress-bar')) :
3
+ typeof define === 'function' && define.amd ? define('@rxap/material-table-system', ['exports', '@angular/core', '@angular/cdk/portal', '@rxap/utilities', '@angular/animations', 'rxjs', 'rxjs/operators', '@angular/common', '@angular/material/button', '@angular/material/icon', '@angular/cdk/collections', '@angular/material/checkbox', '@angular/cdk/table', '@angular/material/sort', '@rxap/data-source/table', '@rxap/utilities/rxjs', '@rxap/data-source', '@angular/material/paginator', '@rxap/forms', '@angular/forms', '@angular/material/menu', '@rxap/directives', '@angular/flex-layout/extended', '@angular/flex-layout', '@angular/material/slide-toggle', '@angular/flex-layout/flex', '@angular/material/tooltip', '@rxap/components', '@rxap/open-api/remote-method', '@rxap/window-system', '@rxap/material-directives/icon', '@angular/material/core', '@rxap/utilities/reflect-metadata', '@angular/material/snack-bar', '@angular/material/progress-bar'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.rxap = global.rxap || {}, global.rxap['material-table-system'] = {}), global.ng.core, global.ng.cdk.portal, global.utilities, global.ng.animations, global.rxjs, global.rxjs.operators, global.ng.common, global.ng.material.button, global.ng.material.icon, global.ng.cdk.collections, global.ng.material.checkbox, global.ng.cdk.table, global.ng.material.sort, global.table, global.rxjs$1, global.dataSource, global.ng.material.paginator, global.forms, global.ng.forms, global.ng.material.menu, global.i6, global.ng.flexLayout.extended, global.ng.flexLayout, global.ng.material.slideToggle, global.ng.flexLayout.flex, global.ng.material.tooltip, global.i7$1, global.i8, global.windowSystem, global.i3$2, global.ng.material.core, global.reflectMetadata, global.ng.material.snackBar, global.ng.material.progressBar));
5
+ }(this, (function (exports, i0, i1, utilities, animations, rxjs, operators, i2, i2$1, i1$1, collections, i1$2, i4, i2$2, table, rxjs$1, dataSource, i1$3, forms, forms$1, i3, i6, i7, flexLayout, i3$1, i4$1, i6$1, i7$1, i8, windowSystem, i3$2, core, reflectMetadata, i2$3, progressBar) { 'use strict';
6
6
 
7
7
  function _interopNamespace(e) {
8
8
  if (e && e.__esModule) return e;
@@ -32,6 +32,7 @@
32
32
  var i1__namespace$2 = /*#__PURE__*/_interopNamespace(i1$2);
33
33
  var i4__namespace = /*#__PURE__*/_interopNamespace(i4);
34
34
  var i2__namespace$2 = /*#__PURE__*/_interopNamespace(i2$2);
35
+ var i1__namespace$3 = /*#__PURE__*/_interopNamespace(i1$3);
35
36
  var i3__namespace = /*#__PURE__*/_interopNamespace(i3);
36
37
  var i6__namespace = /*#__PURE__*/_interopNamespace(i6);
37
38
  var i7__namespace = /*#__PURE__*/_interopNamespace(i7);
@@ -890,6 +891,11 @@
890
891
  this.current = {};
891
892
  this._subscription = this.change.subscribe(function (current) { return _this.current = current; });
892
893
  }
894
+ TableFilterService.prototype.setMap = function (map) {
895
+ var current = this.current;
896
+ var next = Object.assign(current, map);
897
+ this.change.next(next);
898
+ };
893
899
  TableFilterService.prototype.set = function (key, value) {
894
900
  var current = this.current;
895
901
  current[key] = value;
@@ -1089,6 +1095,69 @@
1089
1095
  }]
1090
1096
  }] });
1091
1097
 
1098
+ var PersistentPaginatorDirective = /** @class */ (function () {
1099
+ function PersistentPaginatorDirective(matPaginator) {
1100
+ this.matPaginator = matPaginator;
1101
+ }
1102
+ PersistentPaginatorDirective.prototype.ngOnInit = function () {
1103
+ var _this = this;
1104
+ var config = this.restoreConfig();
1105
+ if (config) {
1106
+ this.matPaginator.pageSize = config.pageSize;
1107
+ }
1108
+ this._subscription = this.matPaginator.page.pipe(operators.tap(function () { return _this.storeConfig(); })).subscribe();
1109
+ };
1110
+ PersistentPaginatorDirective.prototype.ngOnDestroy = function () {
1111
+ var _a;
1112
+ (_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
1113
+ };
1114
+ PersistentPaginatorDirective.prototype.getKey = function () {
1115
+ return 'rxap_mat-paginator-persistent' + this.id;
1116
+ };
1117
+ PersistentPaginatorDirective.prototype.storeConfig = function () {
1118
+ var pageSize = this.matPaginator.pageSize;
1119
+ localStorage.setItem(this.getKey(), JSON.stringify({ pageSize: pageSize }));
1120
+ };
1121
+ PersistentPaginatorDirective.prototype.restoreConfig = function () {
1122
+ var configStorage = localStorage.getItem(this.getKey());
1123
+ if (configStorage) {
1124
+ try {
1125
+ return JSON.parse(configStorage);
1126
+ }
1127
+ catch (e) {
1128
+ console.warn("Could not parse mat paginator persistent config: " + e.message);
1129
+ }
1130
+ }
1131
+ return null;
1132
+ };
1133
+ return PersistentPaginatorDirective;
1134
+ }());
1135
+ PersistentPaginatorDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: PersistentPaginatorDirective, deps: [{ token: i1__namespace$3.MatPaginator }], target: i0__namespace.ɵɵFactoryTarget.Directive });
1136
+ PersistentPaginatorDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.0.1", type: PersistentPaginatorDirective, selector: "mat-paginator[rxapPersistent]", inputs: { id: "id" }, ngImport: i0__namespace });
1137
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: PersistentPaginatorDirective, decorators: [{
1138
+ type: i0.Directive,
1139
+ args: [{
1140
+ selector: 'mat-paginator[rxapPersistent]'
1141
+ }]
1142
+ }], ctorParameters: function () { return [{ type: i1__namespace$3.MatPaginator }]; }, propDecorators: { id: [{
1143
+ type: i0.Input
1144
+ }] } });
1145
+ var PersistentPaginatorDirectiveModule = /** @class */ (function () {
1146
+ function PersistentPaginatorDirectiveModule() {
1147
+ }
1148
+ return PersistentPaginatorDirectiveModule;
1149
+ }());
1150
+ PersistentPaginatorDirectiveModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: PersistentPaginatorDirectiveModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1151
+ PersistentPaginatorDirectiveModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: PersistentPaginatorDirectiveModule, declarations: [PersistentPaginatorDirective], exports: [PersistentPaginatorDirective] });
1152
+ PersistentPaginatorDirectiveModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: PersistentPaginatorDirectiveModule });
1153
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: PersistentPaginatorDirectiveModule, decorators: [{
1154
+ type: i0.NgModule,
1155
+ args: [{
1156
+ exports: [PersistentPaginatorDirective],
1157
+ declarations: [PersistentPaginatorDirective]
1158
+ }]
1159
+ }] });
1160
+
1092
1161
  var RXAP_TABLE_FILTER_FORM_DEFINITION = new i0.InjectionToken('rxap/form-table-system/filter-form-definition');
1093
1162
 
1094
1163
  var FilterHeaderRowDirective = /** @class */ (function (_super) {
@@ -1099,6 +1168,7 @@
1099
1168
  return _this;
1100
1169
  }
1101
1170
  FilterHeaderRowDirective.prototype.ngOnInit = function () {
1171
+ var _this = this;
1102
1172
  _super.prototype.ngOnInit.call(this);
1103
1173
  this._subscription = this.form.value$
1104
1174
  .pipe(operators.debounceTime(1000), operators.map(function (values) { return Object.entries(values)
@@ -1110,8 +1180,8 @@
1110
1180
  var _c;
1111
1181
  var _d = __read(_b, 2), key = _d[0], value = _d[1];
1112
1182
  return (Object.assign(Object.assign({}, obj), (_c = {}, _c[key] = value, _c)));
1113
- }, {}); }), operators.distinctUntilChanged(function (a, b) { return utilities.equals(a, b); }))
1114
- .subscribe(this.tableFilter.change);
1183
+ }, {}); }), operators.distinctUntilChanged(function (a, b) { return utilities.equals(a, b); }), operators.tap(function (values) { return _this.tableFilter.setMap(values); }))
1184
+ .subscribe();
1115
1185
  };
1116
1186
  FilterHeaderRowDirective.prototype.ngOnDestroy = function () {
1117
1187
  var _a;
@@ -2416,6 +2486,7 @@
2416
2486
  this.matButton = matButton;
2417
2487
  this._hasConfirmDirective = false;
2418
2488
  this._currentStatus = exports.TableRowActionStatus.DONE;
2489
+ this._actionDisabled = false;
2419
2490
  this.actionMethodList = utilities.coerceArray(actionMethodList);
2420
2491
  }
2421
2492
  Object.defineProperty(TableRowActionDirective.prototype, "hasConfirmDirective", {
@@ -2447,6 +2518,9 @@
2447
2518
  return __generator(this, function (_c) {
2448
2519
  switch (_c.label) {
2449
2520
  case 0:
2521
+ if (this._actionDisabled) {
2522
+ return [2 /*return*/, Promise.resolve()];
2523
+ }
2450
2524
  this.setStatus(exports.TableRowActionStatus.EXECUTING);
2451
2525
  _c.label = 1;
2452
2526
  case 1:
@@ -2490,15 +2564,26 @@
2490
2564
  TableRowActionDirective.prototype.findTypedActionMethod = function () {
2491
2565
  return this.actionMethodList.filter(IsTableRowActionTypeMethod(this.type));
2492
2566
  };
2567
+ /**
2568
+ * Disables the action. If the button is pressed the action is NOT executed
2569
+ *
2570
+ * Hint: the button is set to disabled = true to prevent any conflict with
2571
+ * extern button enable features linke : rxapHasEnablePermission
2572
+ * @protected
2573
+ */
2493
2574
  TableRowActionDirective.prototype.setButtonDisabled = function () {
2494
- if (this.matButton) {
2495
- this.matButton.disabled = true;
2496
- }
2575
+ this._actionDisabled = true;
2497
2576
  };
2577
+ /**
2578
+ * Enables the action. If the button is pressed the action is executed
2579
+ *
2580
+ * TODO : find a way to communicate the disabled state between the features
2581
+ * Hint: the button is set to disabled = false to prevent any conflict with
2582
+ * extern button enable features linke : rxapHasEnablePermission
2583
+ * @protected
2584
+ */
2498
2585
  TableRowActionDirective.prototype.setButtonEnabled = function () {
2499
- if (this.matButton) {
2500
- this.matButton.disabled = false;
2501
- }
2586
+ this._actionDisabled = false;
2502
2587
  };
2503
2588
  TableRowActionDirective.prototype.setStatus = function (status) {
2504
2589
  var _a, _b;
@@ -2757,6 +2842,8 @@
2757
2842
  exports.LinkCellComponentModule = LinkCellComponentModule;
2758
2843
  exports.OptionsCellComponent = OptionsCellComponent;
2759
2844
  exports.OptionsCellComponentModule = OptionsCellComponentModule;
2845
+ exports.PersistentPaginatorDirective = PersistentPaginatorDirective;
2846
+ exports.PersistentPaginatorDirectiveModule = PersistentPaginatorDirectiveModule;
2760
2847
  exports.ROW_ARCHIVE_METHOD = ROW_ARCHIVE_METHOD;
2761
2848
  exports.ROW_DELETE_METHOD = ROW_DELETE_METHOD;
2762
2849
  exports.ROW_EDIT_LOADER_METHOD = ROW_EDIT_LOADER_METHOD;