@sumaris-net/ngx-components 1.6.16 → 1.6.19
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/sumaris-net.ngx-components.umd.js +142 -130
- package/bundles/sumaris-net.ngx-components.umd.js.map +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js +2 -2
- package/bundles/sumaris-net.ngx-components.umd.min.js.map +1 -1
- package/esm2015/src/app/core/table/table.class.js +34 -24
- package/esm2015/src/app/shared/material/autocomplete/material.autocomplete.js +2 -2
- package/esm2015/src/app/shared/material/badge/badge-icon.directive.js +18 -8
- package/fesm2015/sumaris-net.ngx-components.js +49 -30
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/sumaris-net.ngx-components.metadata.json +1 -1
|
@@ -1995,7 +1995,7 @@
|
|
|
1995
1995
|
{ type: i0.Component, args: [{
|
|
1996
1996
|
// eslint-disable-next-line @angular-eslint/component-selector
|
|
1997
1997
|
selector: 'mat-autocomplete-field',
|
|
1998
|
-
template: "<ion-grid class=\"ion-no-padding\">\n <ion-row>\n <ion-col class=\"ion-no-padding\">\n <!-- readonly -->\n <mat-form-field *ngIf=\"_readonly; else writable\"\n [floatLabel]=\"floatLabel\"\n [title]=\"displayValue\"\n class=\"mat-form-field-disabled\">\n\n <div matPrefix>\n <ng-container *ngTemplateOutlet=\"matPrefixTemplate\"></ng-container>\n </div>\n\n <input matInput hidden type=\"text\"\n [placeholder]=\"placeholder\"\n [formControl]=\"formControl\" readonly>\n <ion-text>{{displayWith(value)}}</ion-text>\n\n <div matSuffix>\n <ng-container *ngTemplateOutlet=\"matSuffixTemplate\"></ng-container>\n </div>\n\n </mat-form-field>\n\n <ng-template #writable>\n <mat-form-field [floatLabel]=\"floatLabel\"\n [class.mat-form-field-disabled]=\"disabled\"\n [title]=\"displayValue\">\n\n <div matPrefix>\n <ng-container *ngTemplateOutlet=\"matPrefixTemplate\"></ng-container>\n </div>\n\n <!-- Basic select -->\n <mat-select #matSelect\n *ngIf=\"!searchable; else searchableTemplate\"\n [placeholder]=\"placeholder\"\n [formControl]=\"formControl\"\n [tabindex]=\"_tabindex\"\n [panelClass]=\"classList\"\n [style.width]=\"panelWidth\"\n (focus)=\"filterMatSelectFocusEvent($event)\"\n (blur)=\"filterMatSelectBlurEvent($event)\"\n (keydown.escape)=\"keydownEscape.emit($event)\"\n (keyup.enter)=\"keyupEnter.emit($event)\"\n [compareWith]=\"equals\"\n [multiple]=\"multiple\"\n [required]=\"required\">\n <mat-select-trigger>{{ displayWith(value) }}</mat-select-trigger>\n\n <!-- header -->\n <ion-row class=\"mat-autocomplete-header ion-no-padding\">\n <ion-col *ngFor=\"let attr of displayAttributes; index as i; last as isLast\" [size]=\"displayColumnSizes[i]\">\n <ion-label [innerHTML]=\"displayColumnNames[i] | translate\"></ion-label>\n </ion-col>\n </ion-row>\n\n <!-- None option -->\n <mat-option *ngIf=\"!required\" class=\"ion-no-padding\">\n <ion-row class=\"ion-no-padding\">\n <ion-col class=\"ion-no-padding\">\n <ion-label><i translate>COMMON.EMPTY_OPTION</i></ion-label>\n </ion-col>\n </ion-row>\n </mat-option>\n\n <ng-container *ngIf=\"$filteredItems | async; let items\">\n <!-- No item option -->\n <mat-option *ngIf=\"items | isEmptyArray\" class=\"ion-padding text-italic\" disabled>\n <ion-label>{{noResultMessage | translate}}</ion-label>\n </mat-option>\n\n <!-- options -->\n <mat-option *ngFor=\"let item of items\" [value]=\"item\" class=\"ion-no-padding\">\n <ion-row [classList]=\"item.classList\">\n <ion-col *ngFor=\"let path of displayAttributes; index as i;\"\n [size]=\"displayColumnSizes[i]\">\n <ion-text>{{item | propertyGet: path }}</ion-text>\n </ion-col>\n </ion-row>\n </mat-option>\n\n <!-- More item -->\n <mat-option *ngIf=\"_moreItemsCount\" (ngInit)=\"_initMatSelectInfiniteScroll()\"\n class=\"ion-padding\" disabled>\n <ion-skeleton-text [animated]=\"true\" style=\"width: 100%\"></ion-skeleton-text>\n </mat-option>\n </ng-container>\n </mat-select>\n\n\n <!--\n NOTE :\n - \"selectInputContent($event) || onFocus.emit($event)\" : call onFocus only when to the input is empty (nothing to select)\n -->\n <ng-template #searchableTemplate>\n <input matInput #matInputText type=\"text\"\n [matAutocomplete]=\"autocomplete\"\n [matAutocompletePosition]=\"matAutocompletePosition\"\n [formControl]=\"formControl\"\n [placeholder]=\"placeholder\"\n [appAutofocus]=\"autofocus\"\n [tabindex]=\"_tabindex\"\n [required]=\"required\"\n (click)=\"clicked.emit($event)\"\n (focus)=\"filterInputTextFocusEvent($event)\"\n (blur)=\"filterInputTextBlurEvent($event)\"\n (keydown.escape)=\"keydownEscape.emit($event)\"\n (keyup.enter)=\"keyupEnter.emit($event)\"\n (keyup.arrowdown)=\"dropButtonClick.emit($event)\">\n\n <!-- autocomplete -->\n <mat-autocomplete #autocomplete=\"matAutocomplete\"\n autoActiveFirstOption\n [displayWith]=\"displayWith\"\n [class]=\"classList\"\n [panelWidth]=\"panelWidth\">\n\n <ion-row class=\"mat-autocomplete-header ion-no-padding\">\n <ion-col *ngFor=\"let attr of displayAttributes; index as i; last as last\" [size]=\"displayColumnSizes[i]\">\n <ion-label [innerHTML]=\"displayColumnNames[i] | translate\"></ion-label>\n <ion-text color=\"light\" *ngIf=\"last && itemCount; let count\" class=\"ion-float-end ion-padding-end\"><i>{{'COMMON.RESULT_COUNT'|translate: {count: count} }}</i></ion-text>\n </ion-col>\n </ion-row>\n\n <ng-container *ngIf=\"$filteredItems | async; else loadingTemplate; let items\">\n <!-- No item option -->\n <mat-option *ngIf=\"items | isEmptyArray\" class=\"ion-padding text-italic\" disabled>\n <ion-label><i>{{noResultMessage | translate}}</i></ion-label>\n </mat-option>\n\n <mat-option *ngFor=\"let item of items\" [value]=\"item\" class=\"ion-no-padding\">\n <ion-row [classList]=\"item.classList\">\n <ion-col *ngFor=\"let path of displayAttributes; index as i;\"\n [size]=\"displayColumnSizes[i]\">\n <ion-text [innerHTML]=\"item | propertyGet: path | highlight: { search: formControl.value, withAccent: highlightAccent }\"></ion-text>\n </ion-col>\n </ion-row>\n </mat-option>\n\n <!-- More item -->\n <mat-option *ngIf=\"_moreItemsCount\" (ngInit)=\"_initAutocompleteInfiniteScroll()\"\n class=\"ion-padding\" disabled>\n <ion-skeleton-text [animated]=\"true\" style=\"width: 100%\"></ion-skeleton-text>\n </mat-option>\n </ng-container>\n\n <!-- Loading spinner -->\n <ng-template #loadingTemplate>\n <mat-option *ngIf=\"(matInputText.value | strLength) >= suggestLengthThreshold; else waitMoreCharacterTemplate\"\n class=\"ion-padding\" disabled>\n <ion-skeleton-text [animated]=\"true\" style=\"width: 100%\"></ion-skeleton-text>\n </mat-option>\n </ng-template>\n\n <!-- Need more characters -->\n <ng-template #waitMoreCharacterTemplate>\n <mat-option class=\"ion-padding text-italic\" disabled>\n <ion-label>\n {{'INFO.PLEASE_TYPE_MORE_CHARACTERS'|translate:{minLength: suggestLengthThreshold} }}\n </ion-label>\n </mat-option>\n </ng-template>\n </mat-autocomplete>\n\n </ng-template>\n\n <div matSuffix>\n <ng-container *ngTemplateOutlet=\"matSuffixTemplate\"></ng-container>\n </div>\n\n <mat-error *ngIf=\"formControl.hasError('required')\" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf=\"formControl.hasError('entity')\" translate>ERROR.FIELD_INVALID</mat-error>\n <ng-content select=\"[matError]\"></ng-content>\n\n </mat-form-field>\n </ng-template>\n </ion-col>\n <ion-col size=\"auto\" class=\"ion-align-self-center\">\n <ng-content select=\"[matAfter]\"></ng-content>\n </ion-col>\n </ion-row>\n</ion-grid>\n\n<ng-template #matPrefixTemplate>\n <ng-content select=\"[matPrefix]\"></ng-content>\n</ng-template>\n\n\n<ng-template #matSuffixTemplate>\n <button matSuffix mat-icon-button tabindex=\"-1\"\n type=\"button\"\n *ngIf=\"searchable\"\n (click)=\"dropButtonClick.emit($event)\"\n [hidden]=\"disabled\">\n <mat-icon class=\"large select-arrow\">arrow_drop_down</mat-icon>\n </button>\n <button matSuffix type=\"button\" mat-icon-button tabindex=\"-1\"\n *ngIf=\"enabled && mobile && !searchable && !multiple\"\n [title]=\"'COMMON.BTN_SEARCH'|translate\"\n (click)=\"toggleSearch($event)\">\n <mat-icon>search</mat-icon>\n </button>\n <button matSuffix mat-icon-button tabindex=\"-1\"\n type=\"button\"\n *ngIf=\"clearable\"\n (click)=\"clearValue($event)\"\n [hidden]=\"disabled || !formControl.value\">\n <mat-icon>close</mat-icon>\n </button>\n\n <ng-content select=\"[matSuffix]\"></ng-content>\n</ng-template>\n",
|
|
1998
|
+
template: "<ion-grid class=\"ion-no-padding\">\n <ion-row>\n <ion-col class=\"ion-no-padding\">\n <!-- readonly -->\n <mat-form-field *ngIf=\"_readonly; else writable\"\n [floatLabel]=\"floatLabel\"\n [title]=\"displayValue\"\n class=\"mat-form-field-disabled\">\n\n <div matPrefix>\n <ng-container *ngTemplateOutlet=\"matPrefixTemplate\"></ng-container>\n </div>\n\n <input matInput hidden type=\"text\"\n [placeholder]=\"placeholder\"\n [formControl]=\"formControl\" readonly>\n <ion-text>{{displayWith(value)}}</ion-text>\n\n <div matSuffix>\n <ng-container *ngTemplateOutlet=\"matSuffixTemplate\"></ng-container>\n </div>\n\n </mat-form-field>\n\n <ng-template #writable>\n <mat-form-field [floatLabel]=\"floatLabel\"\n [class.mat-form-field-disabled]=\"disabled\"\n [title]=\"displayValue\">\n\n <div matPrefix>\n <ng-container *ngTemplateOutlet=\"matPrefixTemplate\"></ng-container>\n </div>\n\n <!-- Basic select -->\n <mat-select #matSelect\n *ngIf=\"!searchable; else searchableTemplate\"\n [placeholder]=\"placeholder\"\n [formControl]=\"formControl\"\n [tabindex]=\"_tabindex\"\n [panelClass]=\"classList\"\n [style.width]=\"panelWidth\"\n (focus)=\"filterMatSelectFocusEvent($event)\"\n (blur)=\"filterMatSelectBlurEvent($event)\"\n (keydown.escape)=\"keydownEscape.emit($event)\"\n (keyup.enter)=\"keyupEnter.emit($event)\"\n [compareWith]=\"equals\"\n [multiple]=\"multiple\"\n [required]=\"required\">\n <mat-select-trigger>{{ displayWith(value) }}</mat-select-trigger>\n\n <!-- header -->\n <ion-row class=\"mat-autocomplete-header ion-no-padding\">\n <ion-col *ngFor=\"let attr of displayAttributes; index as i; last as isLast\" [size]=\"displayColumnSizes[i]\">\n <ion-label [innerHTML]=\"displayColumnNames[i] | translate\"></ion-label>\n </ion-col>\n </ion-row>\n\n <!-- None option -->\n <mat-option *ngIf=\"!required\" class=\"ion-no-padding\">\n <ion-row class=\"ion-no-padding\">\n <ion-col class=\"ion-no-padding\">\n <ion-label><i translate>COMMON.EMPTY_OPTION</i></ion-label>\n </ion-col>\n </ion-row>\n </mat-option>\n\n <ng-container *ngIf=\"$filteredItems | async; let items\">\n <!-- No item option -->\n <mat-option *ngIf=\"items | isEmptyArray\" class=\"ion-padding text-italic\" disabled>\n <ion-label>{{noResultMessage | translate}}</ion-label>\n </mat-option>\n\n <!-- options -->\n <mat-option *ngFor=\"let item of items\" [value]=\"item\" class=\"ion-no-padding\">\n <ion-row [classList]=\"item.classList\">\n <ion-col *ngFor=\"let path of displayAttributes; index as i;\"\n [size]=\"displayColumnSizes[i]\">\n <ion-text>{{item | propertyGet: path }}</ion-text>\n </ion-col>\n </ion-row>\n </mat-option>\n\n <!-- More item -->\n <mat-option *ngIf=\"_moreItemsCount\" (ngInit)=\"_initMatSelectInfiniteScroll()\"\n class=\"ion-padding\" disabled>\n <ion-skeleton-text [animated]=\"true\" style=\"width: 100%\"></ion-skeleton-text>\n </mat-option>\n </ng-container>\n </mat-select>\n\n\n <!--\n NOTE :\n - \"selectInputContent($event) || onFocus.emit($event)\" : call onFocus only when to the input is empty (nothing to select)\n -->\n <ng-template #searchableTemplate>\n <input matInput #matInputText type=\"text\"\n [matAutocomplete]=\"autocomplete\"\n [matAutocompletePosition]=\"matAutocompletePosition\"\n [formControl]=\"formControl\"\n [placeholder]=\"placeholder\"\n [appAutofocus]=\"autofocus\"\n [tabindex]=\"_tabindex\"\n [required]=\"required\"\n (click)=\"clicked.emit($event)\"\n (focus)=\"filterInputTextFocusEvent($event)\"\n (blur)=\"filterInputTextBlurEvent($event)\"\n (keydown.escape)=\"keydownEscape.emit($event)\"\n (keyup.enter)=\"keyupEnter.emit($event)\"\n (keyup.arrowdown)=\"!autocomplete.showPanel && dropButtonClick.emit($event)\">\n\n <!-- autocomplete -->\n <mat-autocomplete #autocomplete=\"matAutocomplete\"\n autoActiveFirstOption\n [displayWith]=\"displayWith\"\n [class]=\"classList\"\n [panelWidth]=\"panelWidth\">\n\n <ion-row class=\"mat-autocomplete-header ion-no-padding\">\n <ion-col *ngFor=\"let attr of displayAttributes; index as i; last as last\" [size]=\"displayColumnSizes[i]\">\n <ion-label [innerHTML]=\"displayColumnNames[i] | translate\"></ion-label>\n <ion-text color=\"light\" *ngIf=\"last && itemCount; let count\" class=\"ion-float-end ion-padding-end\"><i>{{'COMMON.RESULT_COUNT'|translate: {count: count} }}</i></ion-text>\n </ion-col>\n </ion-row>\n\n <ng-container *ngIf=\"$filteredItems | async; else loadingTemplate; let items\">\n <!-- No item option -->\n <mat-option *ngIf=\"items | isEmptyArray\" class=\"ion-padding text-italic\" disabled>\n <ion-label><i>{{noResultMessage | translate}}</i></ion-label>\n </mat-option>\n\n <mat-option *ngFor=\"let item of items\" [value]=\"item\" class=\"ion-no-padding\">\n <ion-row [classList]=\"item.classList\">\n <ion-col *ngFor=\"let path of displayAttributes; index as i;\"\n [size]=\"displayColumnSizes[i]\">\n <ion-text [innerHTML]=\"item | propertyGet: path | highlight: { search: formControl.value, withAccent: highlightAccent }\"></ion-text>\n </ion-col>\n </ion-row>\n </mat-option>\n\n <!-- More item -->\n <mat-option *ngIf=\"_moreItemsCount\" (ngInit)=\"_initAutocompleteInfiniteScroll()\"\n class=\"ion-padding\" disabled>\n <ion-skeleton-text [animated]=\"true\" style=\"width: 100%\"></ion-skeleton-text>\n </mat-option>\n </ng-container>\n\n <!-- Loading spinner -->\n <ng-template #loadingTemplate>\n <mat-option *ngIf=\"(matInputText.value | strLength) >= suggestLengthThreshold; else waitMoreCharacterTemplate\"\n class=\"ion-padding\" disabled>\n <ion-skeleton-text [animated]=\"true\" style=\"width: 100%\"></ion-skeleton-text>\n </mat-option>\n </ng-template>\n\n <!-- Need more characters -->\n <ng-template #waitMoreCharacterTemplate>\n <mat-option class=\"ion-padding text-italic\" disabled>\n <ion-label>\n {{'INFO.PLEASE_TYPE_MORE_CHARACTERS'|translate:{minLength: suggestLengthThreshold} }}\n </ion-label>\n </mat-option>\n </ng-template>\n </mat-autocomplete>\n\n </ng-template>\n\n <div matSuffix>\n <ng-container *ngTemplateOutlet=\"matSuffixTemplate\"></ng-container>\n </div>\n\n <mat-error *ngIf=\"formControl.hasError('required')\" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf=\"formControl.hasError('entity')\" translate>ERROR.FIELD_INVALID</mat-error>\n <ng-content select=\"[matError]\"></ng-content>\n\n </mat-form-field>\n </ng-template>\n </ion-col>\n <ion-col size=\"auto\" class=\"ion-align-self-center\">\n <ng-content select=\"[matAfter]\"></ng-content>\n </ion-col>\n </ion-row>\n</ion-grid>\n\n<ng-template #matPrefixTemplate>\n <ng-content select=\"[matPrefix]\"></ng-content>\n</ng-template>\n\n\n<ng-template #matSuffixTemplate>\n <button matSuffix mat-icon-button tabindex=\"-1\"\n type=\"button\"\n *ngIf=\"searchable\"\n (click)=\"dropButtonClick.emit($event)\"\n [hidden]=\"disabled\">\n <mat-icon class=\"large select-arrow\">arrow_drop_down</mat-icon>\n </button>\n <button matSuffix type=\"button\" mat-icon-button tabindex=\"-1\"\n *ngIf=\"enabled && mobile && !searchable && !multiple\"\n [title]=\"'COMMON.BTN_SEARCH'|translate\"\n (click)=\"toggleSearch($event)\">\n <mat-icon>search</mat-icon>\n </button>\n <button matSuffix mat-icon-button tabindex=\"-1\"\n type=\"button\"\n *ngIf=\"clearable\"\n (click)=\"clearValue($event)\"\n [hidden]=\"disabled || !formControl.value\">\n <mat-icon>close</mat-icon>\n </button>\n\n <ng-content select=\"[matSuffix]\"></ng-content>\n</ng-template>\n",
|
|
1999
1999
|
providers: [{
|
|
2000
2000
|
provide: i1.NG_VALUE_ACCESSOR,
|
|
2001
2001
|
multi: true,
|
|
@@ -8433,20 +8433,26 @@
|
|
|
8433
8433
|
});
|
|
8434
8434
|
MatBadgeIconDirective.prototype.ngOnInit = function () {
|
|
8435
8435
|
var _this = this;
|
|
8436
|
+
// Default value
|
|
8436
8437
|
this._size = this._size || 'medium';
|
|
8437
8438
|
this._color = this._color || 'primary';
|
|
8438
8439
|
if (this._color === 'warn')
|
|
8439
8440
|
this._color = 'warning';
|
|
8440
|
-
this.updateView();
|
|
8441
|
+
this.updateView(true);
|
|
8441
8442
|
this._subscription = this._$update
|
|
8442
|
-
|
|
8443
|
-
.subscribe(function () { return _this.updateView(); });
|
|
8443
|
+
.pipe(operators.debounceTime(100))
|
|
8444
|
+
.subscribe(function () { return _this.updateView(true); });
|
|
8444
8445
|
};
|
|
8445
8446
|
MatBadgeIconDirective.prototype.ngOnDestroy = function () {
|
|
8446
8447
|
var _a;
|
|
8447
8448
|
(_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
8448
8449
|
};
|
|
8449
|
-
MatBadgeIconDirective.prototype.updateView = function () {
|
|
8450
|
+
MatBadgeIconDirective.prototype.updateView = function (immediate) {
|
|
8451
|
+
// Async by default
|
|
8452
|
+
if (!immediate) {
|
|
8453
|
+
this._$update.next();
|
|
8454
|
+
return;
|
|
8455
|
+
}
|
|
8450
8456
|
var badge = this.el.nativeElement.querySelector('.mat-badge-content');
|
|
8451
8457
|
if (!badge)
|
|
8452
8458
|
return;
|
|
@@ -8484,9 +8490,12 @@
|
|
|
8484
8490
|
badge.style.background = "var(--ion-color-" + this._color + ")";
|
|
8485
8491
|
badge.style.color = "var(--ion-color-" + this._color + "-contrast)";
|
|
8486
8492
|
}
|
|
8487
|
-
badge.style.
|
|
8488
|
-
|
|
8489
|
-
badge.style.
|
|
8493
|
+
if (badge.style.display !== 'inline-block')
|
|
8494
|
+
badge.style.display = 'inline-block';
|
|
8495
|
+
if (badge.style.alignItems !== 'center')
|
|
8496
|
+
badge.style.alignItems = 'center';
|
|
8497
|
+
if (badge.style.justifyContent !== 'center')
|
|
8498
|
+
badge.style.justifyContent = 'center';
|
|
8490
8499
|
};
|
|
8491
8500
|
return MatBadgeIconDirective;
|
|
8492
8501
|
}());
|
|
@@ -24985,7 +24994,7 @@
|
|
|
24985
24994
|
rxjs.merge(
|
|
24986
24995
|
// Listen sort events
|
|
24987
24996
|
this.sort && this.sort.sortChange
|
|
24988
|
-
.pipe(operators.mergeMap(function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (
|
|
24997
|
+
.pipe(operators.filter(function () { return !_this.sort.disabled; }), operators.mergeMap(function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_e) {
|
|
24989
24998
|
return [2 /*return*/, this.saveBeforeAction('sort')];
|
|
24990
24999
|
}); }); }), operators.filter(function (res) { return res === true; }),
|
|
24991
25000
|
// Save sort in settings
|
|
@@ -24996,7 +25005,7 @@
|
|
|
24996
25005
|
|| rxjs.EMPTY,
|
|
24997
25006
|
// Listen paginator events
|
|
24998
25007
|
this.paginator && this.paginator.page
|
|
24999
|
-
.pipe(operators.mergeMap(function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (
|
|
25008
|
+
.pipe(operators.mergeMap(function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_e) {
|
|
25000
25009
|
return [2 /*return*/, this.saveBeforeAction('sort')];
|
|
25001
25010
|
}); }); }), operators.filter(function (res) { return res === true; }),
|
|
25002
25011
|
// Save page size
|
|
@@ -25006,7 +25015,9 @@
|
|
|
25006
25015
|
});
|
|
25007
25016
|
// If the user changes the sort order, reset back to the first page.
|
|
25008
25017
|
if (this.sort && this.paginator) {
|
|
25009
|
-
this.registerSubscription(this.sort.sortChange
|
|
25018
|
+
this.registerSubscription(this.sort.sortChange
|
|
25019
|
+
.pipe(operators.filter(function () { return !_this.sort.disabled; }))
|
|
25020
|
+
.subscribe(function () { return _this.paginator.pageIndex = 0; }));
|
|
25010
25021
|
}
|
|
25011
25022
|
};
|
|
25012
25023
|
AppTable.prototype.ngOnDestroy = function () {
|
|
@@ -25039,7 +25050,7 @@
|
|
|
25039
25050
|
};
|
|
25040
25051
|
AppTable.prototype.updateView = function (res, opts) {
|
|
25041
25052
|
return __awaiter(this, void 0, void 0, function () {
|
|
25042
|
-
return __generator(this, function (
|
|
25053
|
+
return __generator(this, function (_e) {
|
|
25043
25054
|
if (!res)
|
|
25044
25055
|
return [2 /*return*/]; // Skip (e.g error)
|
|
25045
25056
|
if (res && res.data) {
|
|
@@ -25148,8 +25159,8 @@
|
|
|
25148
25159
|
AppTable.prototype.editRowById = function (event, id, opts) {
|
|
25149
25160
|
return __awaiter(this, void 0, void 0, function () {
|
|
25150
25161
|
var row;
|
|
25151
|
-
return __generator(this, function (
|
|
25152
|
-
switch (
|
|
25162
|
+
return __generator(this, function (_e) {
|
|
25163
|
+
switch (_e.label) {
|
|
25153
25164
|
case 0:
|
|
25154
25165
|
if (id < 0)
|
|
25155
25166
|
return [2 /*return*/];
|
|
@@ -25159,9 +25170,9 @@
|
|
|
25159
25170
|
return [3 /*break*/, 3];
|
|
25160
25171
|
case 1: return [4 /*yield*/, this.dataSource.getRow(id)];
|
|
25161
25172
|
case 2:
|
|
25162
|
-
row =
|
|
25173
|
+
row = _e.sent();
|
|
25163
25174
|
this.editRow(event, row, opts);
|
|
25164
|
-
|
|
25175
|
+
_e.label = 3;
|
|
25165
25176
|
case 3: return [2 /*return*/];
|
|
25166
25177
|
}
|
|
25167
25178
|
});
|
|
@@ -25246,11 +25257,11 @@
|
|
|
25246
25257
|
return true;
|
|
25247
25258
|
};
|
|
25248
25259
|
AppTable.prototype.save = function (opts) {
|
|
25249
|
-
var _a, _b;
|
|
25260
|
+
var _a, _b, _c, _d;
|
|
25250
25261
|
return __awaiter(this, void 0, void 0, function () {
|
|
25251
25262
|
var previouslyEditedData, isOK, err_1;
|
|
25252
|
-
return __generator(this, function (
|
|
25253
|
-
switch (
|
|
25263
|
+
return __generator(this, function (_e) {
|
|
25264
|
+
switch (_e.label) {
|
|
25254
25265
|
case 0:
|
|
25255
25266
|
opts = Object.assign({ keepEditing: this.keepEditedRowOnSave }, opts);
|
|
25256
25267
|
if (this.readOnly) {
|
|
@@ -25258,27 +25269,27 @@
|
|
|
25258
25269
|
}
|
|
25259
25270
|
this.resetError();
|
|
25260
25271
|
// Keep edited row id (should be done BEFORE confirmEditCreate() )
|
|
25261
|
-
this.previouslyEditedRowId = opts.keepEditing && ((_a = this.editedRow) === null || _a === void 0 ? void 0 : _a.editing) ? this.editedRow.id : undefined;
|
|
25262
|
-
previouslyEditedData = isNotNil(this.previouslyEditedRowId) && this.editedRow.currentData || ((
|
|
25272
|
+
this.previouslyEditedRowId = opts.keepEditing && ((((_a = this.editedRow) === null || _a === void 0 ? void 0 : _a.editing) ? this.editedRow.id : undefined) || ((_b = this.singleSelectedRow) === null || _b === void 0 ? void 0 : _b.id));
|
|
25273
|
+
previouslyEditedData = isNotNil(this.previouslyEditedRowId) && ((_c = this.editedRow) === null || _c === void 0 ? void 0 : _c.currentData) || ((_d = this.singleSelectedRow) === null || _d === void 0 ? void 0 : _d.currentData);
|
|
25263
25274
|
if (!this.confirmEditCreate()) {
|
|
25264
25275
|
throw { code: ErrorCodes$2.TABLE_INVALID_ROW_ERROR, message: 'ERROR.TABLE_INVALID_ROW_ERROR' };
|
|
25265
25276
|
}
|
|
25266
25277
|
// Mark as saving
|
|
25267
25278
|
this.markAsSaving();
|
|
25268
|
-
|
|
25279
|
+
_e.label = 1;
|
|
25269
25280
|
case 1:
|
|
25270
|
-
|
|
25281
|
+
_e.trys.push([1, 3, 4, 7]);
|
|
25271
25282
|
// Calling service save()
|
|
25272
25283
|
if (this.debug)
|
|
25273
25284
|
console.debug('[table] Calling dataSource.save()...');
|
|
25274
25285
|
return [4 /*yield*/, this._dataSource.save()];
|
|
25275
25286
|
case 2:
|
|
25276
|
-
isOK =
|
|
25287
|
+
isOK = _e.sent();
|
|
25277
25288
|
if (isOK)
|
|
25278
25289
|
this.markAsPristine();
|
|
25279
25290
|
return [2 /*return*/, isOK];
|
|
25280
25291
|
case 3:
|
|
25281
|
-
err_1 =
|
|
25292
|
+
err_1 = _e.sent();
|
|
25282
25293
|
this.setError(err_1 && err_1.message || err_1);
|
|
25283
25294
|
throw err_1;
|
|
25284
25295
|
case 4:
|
|
@@ -25286,8 +25297,8 @@
|
|
|
25286
25297
|
if (!isNotNil(this.previouslyEditedRowId)) return [3 /*break*/, 6];
|
|
25287
25298
|
return [4 /*yield*/, this.selectRowByIdOrData(this.previouslyEditedRowId, previouslyEditedData)];
|
|
25288
25299
|
case 5:
|
|
25289
|
-
|
|
25290
|
-
|
|
25300
|
+
_e.sent();
|
|
25301
|
+
_e.label = 6;
|
|
25291
25302
|
case 6: return [7 /*endfinally*/];
|
|
25292
25303
|
case 7: return [2 /*return*/];
|
|
25293
25304
|
}
|
|
@@ -25312,8 +25323,8 @@
|
|
|
25312
25323
|
var _a;
|
|
25313
25324
|
return __awaiter(this, void 0, void 0, function () {
|
|
25314
25325
|
var newRow, json, newData_1;
|
|
25315
|
-
return __generator(this, function (
|
|
25316
|
-
switch (
|
|
25326
|
+
return __generator(this, function (_e) {
|
|
25327
|
+
switch (_e.label) {
|
|
25317
25328
|
case 0:
|
|
25318
25329
|
event === null || event === void 0 ? void 0 : event.stopPropagation();
|
|
25319
25330
|
row = row || this.singleSelectedRow;
|
|
@@ -25322,7 +25333,7 @@
|
|
|
25322
25333
|
}
|
|
25323
25334
|
return [4 /*yield*/, this.addRowToTable(row.id + 1)];
|
|
25324
25335
|
case 1:
|
|
25325
|
-
newRow =
|
|
25336
|
+
newRow = _e.sent();
|
|
25326
25337
|
json = Object.assign(Object.assign({}, row.currentData), { id: null });
|
|
25327
25338
|
// Reset some properties (e.g. rankOrder, etc)
|
|
25328
25339
|
if (opts && opts.skipProperties) {
|
|
@@ -25361,8 +25372,8 @@
|
|
|
25361
25372
|
return __awaiter(this, void 0, void 0, function () {
|
|
25362
25373
|
var rows;
|
|
25363
25374
|
var _this = this;
|
|
25364
|
-
return __generator(this, function (
|
|
25365
|
-
switch (
|
|
25375
|
+
return __generator(this, function (_e) {
|
|
25376
|
+
switch (_e.label) {
|
|
25366
25377
|
case 0:
|
|
25367
25378
|
if (this.loading)
|
|
25368
25379
|
return [2 /*return*/];
|
|
@@ -25371,9 +25382,9 @@
|
|
|
25371
25382
|
return [3 /*break*/, 3];
|
|
25372
25383
|
case 1: return [4 /*yield*/, this._dataSource.getRows()];
|
|
25373
25384
|
case 2:
|
|
25374
|
-
rows =
|
|
25385
|
+
rows = _e.sent();
|
|
25375
25386
|
rows.forEach(function (row) { return _this.selection.select(row); });
|
|
25376
|
-
|
|
25387
|
+
_e.label = 3;
|
|
25377
25388
|
case 3: return [2 /*return*/];
|
|
25378
25389
|
}
|
|
25379
25390
|
});
|
|
@@ -25391,11 +25402,11 @@
|
|
|
25391
25402
|
AppTable.prototype.deleteRow = function (event, row, opts) {
|
|
25392
25403
|
return __awaiter(this, void 0, void 0, function () {
|
|
25393
25404
|
var deleteCount;
|
|
25394
|
-
return __generator(this, function (
|
|
25395
|
-
switch (
|
|
25405
|
+
return __generator(this, function (_e) {
|
|
25406
|
+
switch (_e.label) {
|
|
25396
25407
|
case 0: return [4 /*yield*/, this.deleteRows(event, [row], opts)];
|
|
25397
25408
|
case 1:
|
|
25398
|
-
deleteCount =
|
|
25409
|
+
deleteCount = _e.sent();
|
|
25399
25410
|
return [2 /*return*/, deleteCount === 1];
|
|
25400
25411
|
}
|
|
25401
25412
|
});
|
|
@@ -25410,10 +25421,10 @@
|
|
|
25410
25421
|
AppTable.prototype.deleteRows = function (event, rows, opts) {
|
|
25411
25422
|
var _a;
|
|
25412
25423
|
return __awaiter(this, void 0, void 0, function () {
|
|
25413
|
-
var confirmed, canDelete, saved,
|
|
25424
|
+
var confirmed, canDelete, saved, deleteCount, err_2;
|
|
25414
25425
|
var _this = this;
|
|
25415
|
-
return __generator(this, function (
|
|
25416
|
-
switch (
|
|
25426
|
+
return __generator(this, function (_e) {
|
|
25427
|
+
switch (_e.label) {
|
|
25417
25428
|
case 0:
|
|
25418
25429
|
if (this.readOnly) {
|
|
25419
25430
|
throw { code: ErrorCodes$2.TABLE_READ_ONLY, message: 'ERROR.TABLE_READ_ONLY' };
|
|
@@ -25433,7 +25444,7 @@
|
|
|
25433
25444
|
}
|
|
25434
25445
|
return [4 /*yield*/, this.canDeleteRows(rows, opts)];
|
|
25435
25446
|
case 1:
|
|
25436
|
-
canDelete =
|
|
25447
|
+
canDelete = _e.sent();
|
|
25437
25448
|
if (!canDelete)
|
|
25438
25449
|
return [2 /*return*/, 0]; // Cannot delete
|
|
25439
25450
|
if (!this.saveBeforeDelete) return [3 /*break*/, 3];
|
|
@@ -25451,31 +25462,31 @@
|
|
|
25451
25462
|
}
|
|
25452
25463
|
return res.concat(row);
|
|
25453
25464
|
}, []);
|
|
25454
|
-
if (
|
|
25455
|
-
return [2 /*return*/, 0];
|
|
25465
|
+
if (!isNotEmptyArray(rows)) return [3 /*break*/, 3];
|
|
25456
25466
|
return [4 /*yield*/, this.saveBeforeAction('delete')];
|
|
25457
25467
|
case 2:
|
|
25458
|
-
saved =
|
|
25468
|
+
saved = _e.sent();
|
|
25459
25469
|
if (!saved) {
|
|
25460
25470
|
// Stop if save cancelled or save failed
|
|
25461
25471
|
return [2 /*return*/];
|
|
25462
25472
|
}
|
|
25463
|
-
|
|
25473
|
+
_e.label = 3;
|
|
25464
25474
|
case 3:
|
|
25475
|
+
_e.trys.push([3, 6, , 7]);
|
|
25476
|
+
deleteCount = rows.length;
|
|
25477
|
+
if (!deleteCount) return [3 /*break*/, 5];
|
|
25465
25478
|
if (this.debug)
|
|
25466
|
-
console.debug('[table] Delete
|
|
25467
|
-
|
|
25468
|
-
|
|
25469
|
-
|
|
25470
|
-
|
|
25479
|
+
console.debug('[table] Delete selected rows...');
|
|
25480
|
+
// Reverse row order (on a copy)
|
|
25481
|
+
// This is a workaround, need because row.delete() has async execution
|
|
25482
|
+
// and index cache is updated with a delay
|
|
25483
|
+
rows = rows.slice()
|
|
25471
25484
|
.sort(function (a, b) { return a.id > b.id ? -1 : 1; });
|
|
25472
|
-
|
|
25485
|
+
return [4 /*yield*/, this._dataSource.deleteAll(rows)];
|
|
25473
25486
|
case 4:
|
|
25474
|
-
|
|
25475
|
-
|
|
25476
|
-
return [4 /*yield*/, this._dataSource.deleteAll(rowsToDelete)];
|
|
25487
|
+
_e.sent();
|
|
25488
|
+
_e.label = 5;
|
|
25477
25489
|
case 5:
|
|
25478
|
-
_d.sent();
|
|
25479
25490
|
// DO not update manually, because watchALl().subscribe() will update this count
|
|
25480
25491
|
//this.totalRowCount -= deleteCount;
|
|
25481
25492
|
//this.visibleRowCount -= deleteCount;
|
|
@@ -25483,10 +25494,11 @@
|
|
|
25483
25494
|
this.editedRow = undefined;
|
|
25484
25495
|
this.markAsDirty({ emitEvent: false /*markForCheck() is called just after*/ });
|
|
25485
25496
|
this.markForCheck();
|
|
25486
|
-
|
|
25497
|
+
if (deleteCount)
|
|
25498
|
+
this.onAfterDeletedRows.next(rows);
|
|
25487
25499
|
return [2 /*return*/, deleteCount];
|
|
25488
25500
|
case 6:
|
|
25489
|
-
err_2 =
|
|
25501
|
+
err_2 = _e.sent();
|
|
25490
25502
|
this.setError(err_2 && err_2.message || err_2);
|
|
25491
25503
|
throw err_2;
|
|
25492
25504
|
case 7: return [2 /*return*/];
|
|
@@ -25497,14 +25509,14 @@
|
|
|
25497
25509
|
AppTable.prototype.selectRowById = function (id) {
|
|
25498
25510
|
return __awaiter(this, void 0, void 0, function () {
|
|
25499
25511
|
var row;
|
|
25500
|
-
return __generator(this, function (
|
|
25501
|
-
switch (
|
|
25512
|
+
return __generator(this, function (_e) {
|
|
25513
|
+
switch (_e.label) {
|
|
25502
25514
|
case 0:
|
|
25503
25515
|
if (id === undefined)
|
|
25504
25516
|
return [2 /*return*/, false];
|
|
25505
25517
|
return [4 /*yield*/, this.waitIdle()];
|
|
25506
25518
|
case 1:
|
|
25507
|
-
|
|
25519
|
+
_e.sent();
|
|
25508
25520
|
row = this.dataSource.getRow(id);
|
|
25509
25521
|
return [2 /*return*/, this.clickRow(null, row)];
|
|
25510
25522
|
}
|
|
@@ -25519,17 +25531,17 @@
|
|
|
25519
25531
|
return __awaiter(this, void 0, void 0, function () {
|
|
25520
25532
|
var row;
|
|
25521
25533
|
var _this = this;
|
|
25522
|
-
return __generator(this, function (
|
|
25523
|
-
switch (
|
|
25534
|
+
return __generator(this, function (_e) {
|
|
25535
|
+
switch (_e.label) {
|
|
25524
25536
|
case 0:
|
|
25525
25537
|
if (data === undefined)
|
|
25526
25538
|
return [2 /*return*/, Promise.resolve(false)];
|
|
25527
25539
|
return [4 /*yield*/, this.waitIdle()];
|
|
25528
25540
|
case 1:
|
|
25529
|
-
|
|
25541
|
+
_e.sent();
|
|
25530
25542
|
return [4 /*yield*/, this.dataSource.getRows()];
|
|
25531
25543
|
case 2:
|
|
25532
|
-
row = ((
|
|
25544
|
+
row = ((_e.sent()) || [])
|
|
25533
25545
|
.find(function (row) { return _this.equals(row.currentData, data); });
|
|
25534
25546
|
return [2 /*return*/, row && this.clickRow(null, row)];
|
|
25535
25547
|
}
|
|
@@ -25571,11 +25583,11 @@
|
|
|
25571
25583
|
};
|
|
25572
25584
|
AppTable.prototype.ready = function () {
|
|
25573
25585
|
return __awaiter(this, void 0, void 0, function () {
|
|
25574
|
-
return __generator(this, function (
|
|
25575
|
-
switch (
|
|
25586
|
+
return __generator(this, function (_e) {
|
|
25587
|
+
switch (_e.label) {
|
|
25576
25588
|
case 0: return [4 /*yield*/, firstTruePromise(this.readySubject)];
|
|
25577
25589
|
case 1:
|
|
25578
|
-
|
|
25590
|
+
_e.sent();
|
|
25579
25591
|
return [2 /*return*/];
|
|
25580
25592
|
}
|
|
25581
25593
|
});
|
|
@@ -25583,11 +25595,11 @@
|
|
|
25583
25595
|
};
|
|
25584
25596
|
AppTable.prototype.waitIdle = function (opts) {
|
|
25585
25597
|
return __awaiter(this, void 0, void 0, function () {
|
|
25586
|
-
return __generator(this, function (
|
|
25587
|
-
switch (
|
|
25598
|
+
return __generator(this, function (_e) {
|
|
25599
|
+
switch (_e.label) {
|
|
25588
25600
|
case 0: return [4 /*yield*/, firstFalsePromise(this.loadingSubject)];
|
|
25589
25601
|
case 1:
|
|
25590
|
-
|
|
25602
|
+
_e.sent();
|
|
25591
25603
|
return [2 /*return*/];
|
|
25592
25604
|
}
|
|
25593
25605
|
});
|
|
@@ -25596,28 +25608,28 @@
|
|
|
25596
25608
|
AppTable.prototype.openSelectColumnsModal = function (event) {
|
|
25597
25609
|
return __awaiter(this, void 0, void 0, function () {
|
|
25598
25610
|
var columns, hasTopModal, modal, data, userColumns;
|
|
25599
|
-
return __generator(this, function (
|
|
25600
|
-
switch (
|
|
25611
|
+
return __generator(this, function (_e) {
|
|
25612
|
+
switch (_e.label) {
|
|
25601
25613
|
case 0:
|
|
25602
25614
|
columns = this.getCurrentColumns();
|
|
25603
25615
|
return [4 /*yield*/, this.modalCtrl.getTop()];
|
|
25604
25616
|
case 1:
|
|
25605
|
-
hasTopModal = !!(
|
|
25617
|
+
hasTopModal = !!(_e.sent());
|
|
25606
25618
|
return [4 /*yield*/, this.modalCtrl.create({
|
|
25607
25619
|
component: TableSelectColumnsComponent,
|
|
25608
25620
|
componentProps: { columns: columns },
|
|
25609
25621
|
cssClass: hasTopModal && 'stack-modal'
|
|
25610
25622
|
})];
|
|
25611
25623
|
case 2:
|
|
25612
|
-
modal =
|
|
25624
|
+
modal = _e.sent();
|
|
25613
25625
|
// Open the modal
|
|
25614
25626
|
return [4 /*yield*/, modal.present()];
|
|
25615
25627
|
case 3:
|
|
25616
25628
|
// Open the modal
|
|
25617
|
-
|
|
25629
|
+
_e.sent();
|
|
25618
25630
|
return [4 /*yield*/, modal.onDidDismiss()];
|
|
25619
25631
|
case 4:
|
|
25620
|
-
data = (
|
|
25632
|
+
data = (_e.sent()).data;
|
|
25621
25633
|
if (!data)
|
|
25622
25634
|
return [2 /*return*/]; // CANCELLED
|
|
25623
25635
|
userColumns = (data || []).filter(function (c) { return c.canHide === false || c.visible; }).map(function (c) { return c.name; }) || [];
|
|
@@ -25627,7 +25639,7 @@
|
|
|
25627
25639
|
return [4 /*yield*/, this.settings.savePageSetting(this.settingsId, userColumns, SETTINGS_DISPLAY_COLUMNS)];
|
|
25628
25640
|
case 5:
|
|
25629
25641
|
// Update user settings
|
|
25630
|
-
|
|
25642
|
+
_e.sent();
|
|
25631
25643
|
return [2 /*return*/];
|
|
25632
25644
|
}
|
|
25633
25645
|
});
|
|
@@ -25642,11 +25654,11 @@
|
|
|
25642
25654
|
// When target wait for a complete (e.g. IonRefresher)
|
|
25643
25655
|
if ((event === null || event === void 0 ? void 0 : event.target) && event.target.complete) {
|
|
25644
25656
|
setTimeout(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
25645
|
-
return __generator(this, function (
|
|
25646
|
-
switch (
|
|
25657
|
+
return __generator(this, function (_e) {
|
|
25658
|
+
switch (_e.label) {
|
|
25647
25659
|
case 0: return [4 /*yield*/, this.waitIdle()];
|
|
25648
25660
|
case 1:
|
|
25649
|
-
|
|
25661
|
+
_e.sent();
|
|
25650
25662
|
event.target.complete();
|
|
25651
25663
|
return [2 /*return*/];
|
|
25652
25664
|
}
|
|
@@ -25731,33 +25743,33 @@
|
|
|
25731
25743
|
AppTable.prototype.selectRowByIdOrData = function (id, data) {
|
|
25732
25744
|
return __awaiter(this, void 0, void 0, function () {
|
|
25733
25745
|
var done, err_3;
|
|
25734
|
-
return __generator(this, function (
|
|
25735
|
-
switch (
|
|
25746
|
+
return __generator(this, function (_e) {
|
|
25747
|
+
switch (_e.label) {
|
|
25736
25748
|
case 0:
|
|
25737
25749
|
done = false;
|
|
25738
|
-
|
|
25750
|
+
_e.label = 1;
|
|
25739
25751
|
case 1:
|
|
25740
|
-
|
|
25752
|
+
_e.trys.push([1, 6, , 7]);
|
|
25741
25753
|
if (!(isNotNil(id) || id !== -1)) return [3 /*break*/, 3];
|
|
25742
25754
|
return [4 /*yield*/, this.selectRowById(id)];
|
|
25743
25755
|
case 2:
|
|
25744
|
-
done =
|
|
25756
|
+
done = _e.sent();
|
|
25745
25757
|
if (done)
|
|
25746
25758
|
return [2 /*return*/, true];
|
|
25747
25759
|
console.warn('[app-table] Save: Cannot reselect row by row.id: ', id);
|
|
25748
|
-
|
|
25760
|
+
_e.label = 3;
|
|
25749
25761
|
case 3:
|
|
25750
25762
|
if (!data) return [3 /*break*/, 5];
|
|
25751
25763
|
return [4 /*yield*/, this.selectRowByData(data)];
|
|
25752
25764
|
case 4:
|
|
25753
|
-
done =
|
|
25765
|
+
done = _e.sent();
|
|
25754
25766
|
if (done)
|
|
25755
25767
|
return [2 /*return*/, true];
|
|
25756
25768
|
console.warn('[app-table] Save: Cannot reselect row by data: ', data);
|
|
25757
|
-
|
|
25769
|
+
_e.label = 5;
|
|
25758
25770
|
case 5: return [2 /*return*/, false];
|
|
25759
25771
|
case 6:
|
|
25760
|
-
err_3 =
|
|
25772
|
+
err_3 = _e.sent();
|
|
25761
25773
|
// Log, but continue
|
|
25762
25774
|
console.error(err_3 && err_3.message || err_3);
|
|
25763
25775
|
return [2 /*return*/, false];
|
|
@@ -25780,23 +25792,23 @@
|
|
|
25780
25792
|
AppTable.prototype.canDeleteRows = function (rows, opts) {
|
|
25781
25793
|
return __awaiter(this, void 0, void 0, function () {
|
|
25782
25794
|
var canDelete, err_4;
|
|
25783
|
-
return __generator(this, function (
|
|
25784
|
-
switch (
|
|
25795
|
+
return __generator(this, function (_e) {
|
|
25796
|
+
switch (_e.label) {
|
|
25785
25797
|
case 0:
|
|
25786
25798
|
if (!(this.onBeforeDeleteRows.observers.length > 0)) return [3 /*break*/, 4];
|
|
25787
|
-
|
|
25799
|
+
_e.label = 1;
|
|
25788
25800
|
case 1:
|
|
25789
|
-
|
|
25801
|
+
_e.trys.push([1, 3, , 4]);
|
|
25790
25802
|
return [4 /*yield*/, emitPromiseEvent(this.onBeforeDeleteRows, 'canDelete', {
|
|
25791
25803
|
detail: { rows: rows }
|
|
25792
25804
|
})];
|
|
25793
25805
|
case 2:
|
|
25794
|
-
canDelete =
|
|
25806
|
+
canDelete = _e.sent();
|
|
25795
25807
|
if (!canDelete)
|
|
25796
25808
|
return [2 /*return*/, false];
|
|
25797
25809
|
return [3 /*break*/, 4];
|
|
25798
25810
|
case 3:
|
|
25799
|
-
err_4 =
|
|
25811
|
+
err_4 = _e.sent();
|
|
25800
25812
|
if (err_4 === 'CANCELLED')
|
|
25801
25813
|
return [2 /*return*/, false]; // User cancel
|
|
25802
25814
|
console.error('Error while checking if can delete rows', err_4);
|
|
@@ -25813,35 +25825,35 @@
|
|
|
25813
25825
|
};
|
|
25814
25826
|
AppTable.prototype.canCancelRows = function (rows, opts) {
|
|
25815
25827
|
return __awaiter(this, void 0, void 0, function () {
|
|
25816
|
-
var
|
|
25817
|
-
return __generator(this, function (
|
|
25818
|
-
switch (
|
|
25828
|
+
var _e, isCancel, err_5;
|
|
25829
|
+
return __generator(this, function (_f) {
|
|
25830
|
+
switch (_f.label) {
|
|
25819
25831
|
case 0:
|
|
25820
|
-
|
|
25821
|
-
if (
|
|
25832
|
+
_e = rows;
|
|
25833
|
+
if (_e) return [3 /*break*/, 2];
|
|
25822
25834
|
return [4 /*yield*/, this.dataSource.getRows()];
|
|
25823
25835
|
case 1:
|
|
25824
|
-
|
|
25825
|
-
|
|
25836
|
+
_e = (_f.sent()).filter(function (row) { var _a; return (_a = row.validator) === null || _a === void 0 ? void 0 : _a.dirty; });
|
|
25837
|
+
_f.label = 2;
|
|
25826
25838
|
case 2:
|
|
25827
25839
|
// Get dirty rows
|
|
25828
|
-
rows =
|
|
25840
|
+
rows = _e;
|
|
25829
25841
|
if (isEmptyArray(rows))
|
|
25830
25842
|
return [2 /*return*/, true]; // No dirty: OK
|
|
25831
25843
|
if (!(this.onBeforeCancelRows.observers.length > 0)) return [3 /*break*/, 6];
|
|
25832
|
-
|
|
25844
|
+
_f.label = 3;
|
|
25833
25845
|
case 3:
|
|
25834
|
-
|
|
25846
|
+
_f.trys.push([3, 5, , 6]);
|
|
25835
25847
|
return [4 /*yield*/, emitPromiseEvent(this.onBeforeCancelRows, 'canCancel', {
|
|
25836
25848
|
detail: { rows: rows }
|
|
25837
25849
|
})];
|
|
25838
25850
|
case 4:
|
|
25839
|
-
isCancel =
|
|
25851
|
+
isCancel = _f.sent();
|
|
25840
25852
|
if (!isCancel)
|
|
25841
25853
|
return [2 /*return*/, false];
|
|
25842
25854
|
return [3 /*break*/, 6];
|
|
25843
25855
|
case 5:
|
|
25844
|
-
err_5 =
|
|
25856
|
+
err_5 = _f.sent();
|
|
25845
25857
|
if (err_5 === 'CANCELLED')
|
|
25846
25858
|
return [2 /*return*/, false]; // User cancel
|
|
25847
25859
|
console.error('Error while checking if can cancel rows', err_5);
|
|
@@ -25859,8 +25871,8 @@
|
|
|
25859
25871
|
AppTable.prototype.saveBeforeAction = function (saveAction) {
|
|
25860
25872
|
return __awaiter(this, void 0, void 0, function () {
|
|
25861
25873
|
var save, confirmed, res, err_6, saved;
|
|
25862
|
-
return __generator(this, function (
|
|
25863
|
-
switch (
|
|
25874
|
+
return __generator(this, function (_e) {
|
|
25875
|
+
switch (_e.label) {
|
|
25864
25876
|
case 0:
|
|
25865
25877
|
if (!this.dirty) {
|
|
25866
25878
|
// Continue without save
|
|
@@ -25882,19 +25894,19 @@
|
|
|
25882
25894
|
confirmed = true;
|
|
25883
25895
|
if (!save) return [3 /*break*/, 4];
|
|
25884
25896
|
if (!(this.onBeforeSave.observers.length > 0)) return [3 /*break*/, 4];
|
|
25885
|
-
|
|
25897
|
+
_e.label = 1;
|
|
25886
25898
|
case 1:
|
|
25887
|
-
|
|
25899
|
+
_e.trys.push([1, 3, , 4]);
|
|
25888
25900
|
return [4 /*yield*/, emitPromiseEvent(this.onBeforeSave, 'beforeSave', {
|
|
25889
25901
|
detail: { action: saveAction, valid: this.valid }
|
|
25890
25902
|
})];
|
|
25891
25903
|
case 2:
|
|
25892
|
-
res =
|
|
25904
|
+
res = _e.sent();
|
|
25893
25905
|
confirmed = res.confirmed;
|
|
25894
25906
|
save = res.save;
|
|
25895
25907
|
return [3 /*break*/, 4];
|
|
25896
25908
|
case 3:
|
|
25897
|
-
err_6 =
|
|
25909
|
+
err_6 = _e.sent();
|
|
25898
25910
|
if (err_6 === 'CANCELLED')
|
|
25899
25911
|
return [2 /*return*/, false]; // User cancel
|
|
25900
25912
|
console.error('Error while checking if can delete rows', err_6);
|
|
@@ -25904,7 +25916,7 @@
|
|
|
25904
25916
|
if (!save) return [3 /*break*/, 6];
|
|
25905
25917
|
return [4 /*yield*/, this.save()];
|
|
25906
25918
|
case 5:
|
|
25907
|
-
saved =
|
|
25919
|
+
saved = _e.sent();
|
|
25908
25920
|
this.markAsDirty(); // Restore dirty flag
|
|
25909
25921
|
return [2 /*return*/, saved];
|
|
25910
25922
|
case 6: return [2 /*return*/, true]; // No save but continue action
|
|
@@ -25922,8 +25934,8 @@
|
|
|
25922
25934
|
*/
|
|
25923
25935
|
AppTable.prototype.openRow = function (id, row) {
|
|
25924
25936
|
return __awaiter(this, void 0, void 0, function () {
|
|
25925
|
-
return __generator(this, function (
|
|
25926
|
-
switch (
|
|
25937
|
+
return __generator(this, function (_e) {
|
|
25938
|
+
switch (_e.label) {
|
|
25927
25939
|
case 0:
|
|
25928
25940
|
if (!this.allowRowDetail) return [3 /*break*/, 2];
|
|
25929
25941
|
if (this.debug && this.dirty) {
|
|
@@ -25942,7 +25954,7 @@
|
|
|
25942
25954
|
relativeTo: this.route,
|
|
25943
25955
|
queryParams: {}
|
|
25944
25956
|
})];
|
|
25945
|
-
case 1: return [2 /*return*/,
|
|
25957
|
+
case 1: return [2 /*return*/, _e.sent()];
|
|
25946
25958
|
case 2: return [2 /*return*/, false];
|
|
25947
25959
|
}
|
|
25948
25960
|
});
|
|
@@ -25950,8 +25962,8 @@
|
|
|
25950
25962
|
};
|
|
25951
25963
|
AppTable.prototype.openNewRowDetail = function (event) {
|
|
25952
25964
|
return __awaiter(this, void 0, void 0, function () {
|
|
25953
|
-
return __generator(this, function (
|
|
25954
|
-
switch (
|
|
25965
|
+
return __generator(this, function (_e) {
|
|
25966
|
+
switch (_e.label) {
|
|
25955
25967
|
case 0:
|
|
25956
25968
|
if (!this.allowRowDetail)
|
|
25957
25969
|
return [2 /*return*/, false];
|
|
@@ -25962,7 +25974,7 @@
|
|
|
25962
25974
|
return [4 /*yield*/, this.router.navigate(['new'], {
|
|
25963
25975
|
relativeTo: this.route
|
|
25964
25976
|
})];
|
|
25965
|
-
case 1: return [2 /*return*/,
|
|
25977
|
+
case 1: return [2 /*return*/, _e.sent()];
|
|
25966
25978
|
}
|
|
25967
25979
|
});
|
|
25968
25980
|
});
|
|
@@ -26040,13 +26052,13 @@
|
|
|
26040
26052
|
};
|
|
26041
26053
|
AppTable.prototype.addRowToTable = function (insertAt) {
|
|
26042
26054
|
return __awaiter(this, void 0, void 0, function () {
|
|
26043
|
-
return __generator(this, function (
|
|
26044
|
-
switch (
|
|
26055
|
+
return __generator(this, function (_e) {
|
|
26056
|
+
switch (_e.label) {
|
|
26045
26057
|
case 0:
|
|
26046
26058
|
this.focusFirstColumn = true;
|
|
26047
26059
|
return [4 /*yield*/, this._dataSource.asyncCreateNew(insertAt)];
|
|
26048
26060
|
case 1:
|
|
26049
|
-
|
|
26061
|
+
_e.sent();
|
|
26050
26062
|
this.editedRow = this._dataSource.getRow(-1);
|
|
26051
26063
|
// Emit start editing event
|
|
26052
26064
|
this.onStartEditingRow.emit(this.editedRow);
|
|
@@ -26110,7 +26122,7 @@
|
|
|
26110
26122
|
};
|
|
26111
26123
|
AppTable.prototype.askDeleteConfirmation = function (event, rows) {
|
|
26112
26124
|
return __awaiter(this, void 0, void 0, function () {
|
|
26113
|
-
return __generator(this, function (
|
|
26125
|
+
return __generator(this, function (_e) {
|
|
26114
26126
|
if (this.undoableDeletion) {
|
|
26115
26127
|
// Special message, for undoable deletion
|
|
26116
26128
|
return [2 /*return*/, Alerts.askConfirmation((rows === null || rows === void 0 ? void 0 : rows.length) === 1 ? 'CONFIRM.DELETE_ROW' : 'CONFIRM.DELETE_ROWS', this.alertCtrl, this.translate, event)];
|
|
@@ -26122,21 +26134,21 @@
|
|
|
26122
26134
|
};
|
|
26123
26135
|
AppTable.prototype.askCancelConfirmation = function (event, rows) {
|
|
26124
26136
|
return __awaiter(this, void 0, void 0, function () {
|
|
26125
|
-
return __generator(this, function (
|
|
26137
|
+
return __generator(this, function (_e) {
|
|
26126
26138
|
return [2 /*return*/, Alerts.askConfirmation((rows === null || rows === void 0 ? void 0 : rows.length) === 1 ? 'CONFIRM.CANCEL_ROW' : 'CONFIRM.CANCEL_ROWS', this.alertCtrl, this.translate, event)];
|
|
26127
26139
|
});
|
|
26128
26140
|
});
|
|
26129
26141
|
};
|
|
26130
26142
|
AppTable.prototype.askRestoreConfirmation = function (event) {
|
|
26131
26143
|
return __awaiter(this, void 0, void 0, function () {
|
|
26132
|
-
return __generator(this, function (
|
|
26144
|
+
return __generator(this, function (_e) {
|
|
26133
26145
|
return [2 /*return*/, Alerts.askActionConfirmation(this.alertCtrl, this.translate, false, event)];
|
|
26134
26146
|
});
|
|
26135
26147
|
});
|
|
26136
26148
|
};
|
|
26137
26149
|
AppTable.prototype.showToast = function (opts) {
|
|
26138
26150
|
return __awaiter(this, void 0, void 0, function () {
|
|
26139
|
-
return __generator(this, function (
|
|
26151
|
+
return __generator(this, function (_e) {
|
|
26140
26152
|
if (!this.toastController)
|
|
26141
26153
|
throw new Error('Missing toastController in component\'s constructor');
|
|
26142
26154
|
return [2 /*return*/, Toasts.show(this.toastController, this.translate, opts)];
|
|
@@ -26231,14 +26243,14 @@
|
|
|
26231
26243
|
AppTable.prototype.checkIfPristine = function (opts) {
|
|
26232
26244
|
return __awaiter(this, void 0, void 0, function () {
|
|
26233
26245
|
var rows, pristine;
|
|
26234
|
-
return __generator(this, function (
|
|
26235
|
-
switch (
|
|
26246
|
+
return __generator(this, function (_e) {
|
|
26247
|
+
switch (_e.label) {
|
|
26236
26248
|
case 0:
|
|
26237
26249
|
if (!this.dirty)
|
|
26238
26250
|
return [2 /*return*/]; // Already pristine
|
|
26239
26251
|
return [4 /*yield*/, this._dataSource.getRows()];
|
|
26240
26252
|
case 1:
|
|
26241
|
-
rows =
|
|
26253
|
+
rows = _e.sent();
|
|
26242
26254
|
pristine = (rows || []).findIndex(function (row) { var _a; return (_a = row.validator) === null || _a === void 0 ? void 0 : _a.dirty; }) === -1;
|
|
26243
26255
|
if (pristine)
|
|
26244
26256
|
this.markAsPristine(opts);
|