@sumaris-net/ngx-components 1.6.18 → 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 +144 -142
- 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/latlong/material.latlong.js +19 -20
- package/fesm2015/sumaris-net.ngx-components.js +51 -42
- 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,
|
|
@@ -4720,25 +4720,24 @@
|
|
|
4720
4720
|
this.pattern = 'DDMM';
|
|
4721
4721
|
this.mask = MASKS[this.type][this.pattern];
|
|
4722
4722
|
}
|
|
4723
|
-
if (
|
|
4724
|
-
this.maxDecimals
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
this.
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
this.
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
this.maxDecimals
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
this.maxDecimals = DEFAULT_MAX_DECIMALS;
|
|
4723
|
+
if (this.maxDecimals) {
|
|
4724
|
+
if (this.maxDecimals < 0) {
|
|
4725
|
+
console.error('Invalid attribute \'maxDecimals\'. Must a positive value.');
|
|
4726
|
+
this.maxDecimals = DEFAULT_MAX_DECIMALS;
|
|
4727
|
+
}
|
|
4728
|
+
// Remove max decimals in the DDMMSS format
|
|
4729
|
+
else if (this.pattern === 'DD') {
|
|
4730
|
+
console.warn("Invalid attribute 'maxDecimals' - Must be '0' when using the 'DDMMSS' pattern.");
|
|
4731
|
+
this.maxDecimals = 7;
|
|
4732
|
+
}
|
|
4733
|
+
else if (this.pattern === 'DDMMSS') {
|
|
4734
|
+
console.warn("Invalid attribute 'maxDecimals' - Must be '0' when using the 'DDMMSS' pattern.");
|
|
4735
|
+
this.maxDecimals = 0;
|
|
4736
|
+
}
|
|
4737
|
+
else if (this.maxDecimals !== DEFAULT_MAX_DECIMALS) {
|
|
4738
|
+
console.warn("Invalid attribute 'maxDecimals' - Expected value: " + DEFAULT_MAX_DECIMALS + ". Other value not implemented.");
|
|
4739
|
+
this.maxDecimals = DEFAULT_MAX_DECIMALS;
|
|
4740
|
+
}
|
|
4742
4741
|
}
|
|
4743
4742
|
this.showSignControl = this.pattern !== 'DD';
|
|
4744
4743
|
this.formatFn = this.type === 'latitude' ? formatLatitude : formatLongitude;
|
|
@@ -24995,7 +24994,7 @@
|
|
|
24995
24994
|
rxjs.merge(
|
|
24996
24995
|
// Listen sort events
|
|
24997
24996
|
this.sort && this.sort.sortChange
|
|
24998
|
-
.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) {
|
|
24999
24998
|
return [2 /*return*/, this.saveBeforeAction('sort')];
|
|
25000
24999
|
}); }); }), operators.filter(function (res) { return res === true; }),
|
|
25001
25000
|
// Save sort in settings
|
|
@@ -25006,7 +25005,7 @@
|
|
|
25006
25005
|
|| rxjs.EMPTY,
|
|
25007
25006
|
// Listen paginator events
|
|
25008
25007
|
this.paginator && this.paginator.page
|
|
25009
|
-
.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) {
|
|
25010
25009
|
return [2 /*return*/, this.saveBeforeAction('sort')];
|
|
25011
25010
|
}); }); }), operators.filter(function (res) { return res === true; }),
|
|
25012
25011
|
// Save page size
|
|
@@ -25016,7 +25015,9 @@
|
|
|
25016
25015
|
});
|
|
25017
25016
|
// If the user changes the sort order, reset back to the first page.
|
|
25018
25017
|
if (this.sort && this.paginator) {
|
|
25019
|
-
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; }));
|
|
25020
25021
|
}
|
|
25021
25022
|
};
|
|
25022
25023
|
AppTable.prototype.ngOnDestroy = function () {
|
|
@@ -25049,7 +25050,7 @@
|
|
|
25049
25050
|
};
|
|
25050
25051
|
AppTable.prototype.updateView = function (res, opts) {
|
|
25051
25052
|
return __awaiter(this, void 0, void 0, function () {
|
|
25052
|
-
return __generator(this, function (
|
|
25053
|
+
return __generator(this, function (_e) {
|
|
25053
25054
|
if (!res)
|
|
25054
25055
|
return [2 /*return*/]; // Skip (e.g error)
|
|
25055
25056
|
if (res && res.data) {
|
|
@@ -25158,8 +25159,8 @@
|
|
|
25158
25159
|
AppTable.prototype.editRowById = function (event, id, opts) {
|
|
25159
25160
|
return __awaiter(this, void 0, void 0, function () {
|
|
25160
25161
|
var row;
|
|
25161
|
-
return __generator(this, function (
|
|
25162
|
-
switch (
|
|
25162
|
+
return __generator(this, function (_e) {
|
|
25163
|
+
switch (_e.label) {
|
|
25163
25164
|
case 0:
|
|
25164
25165
|
if (id < 0)
|
|
25165
25166
|
return [2 /*return*/];
|
|
@@ -25169,9 +25170,9 @@
|
|
|
25169
25170
|
return [3 /*break*/, 3];
|
|
25170
25171
|
case 1: return [4 /*yield*/, this.dataSource.getRow(id)];
|
|
25171
25172
|
case 2:
|
|
25172
|
-
row =
|
|
25173
|
+
row = _e.sent();
|
|
25173
25174
|
this.editRow(event, row, opts);
|
|
25174
|
-
|
|
25175
|
+
_e.label = 3;
|
|
25175
25176
|
case 3: return [2 /*return*/];
|
|
25176
25177
|
}
|
|
25177
25178
|
});
|
|
@@ -25256,11 +25257,11 @@
|
|
|
25256
25257
|
return true;
|
|
25257
25258
|
};
|
|
25258
25259
|
AppTable.prototype.save = function (opts) {
|
|
25259
|
-
var _a, _b;
|
|
25260
|
+
var _a, _b, _c, _d;
|
|
25260
25261
|
return __awaiter(this, void 0, void 0, function () {
|
|
25261
25262
|
var previouslyEditedData, isOK, err_1;
|
|
25262
|
-
return __generator(this, function (
|
|
25263
|
-
switch (
|
|
25263
|
+
return __generator(this, function (_e) {
|
|
25264
|
+
switch (_e.label) {
|
|
25264
25265
|
case 0:
|
|
25265
25266
|
opts = Object.assign({ keepEditing: this.keepEditedRowOnSave }, opts);
|
|
25266
25267
|
if (this.readOnly) {
|
|
@@ -25268,27 +25269,27 @@
|
|
|
25268
25269
|
}
|
|
25269
25270
|
this.resetError();
|
|
25270
25271
|
// Keep edited row id (should be done BEFORE confirmEditCreate() )
|
|
25271
|
-
this.previouslyEditedRowId = opts.keepEditing && ((_a = this.editedRow) === null || _a === void 0 ? void 0 : _a.editing) ? this.editedRow.id : undefined;
|
|
25272
|
-
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);
|
|
25273
25274
|
if (!this.confirmEditCreate()) {
|
|
25274
25275
|
throw { code: ErrorCodes$2.TABLE_INVALID_ROW_ERROR, message: 'ERROR.TABLE_INVALID_ROW_ERROR' };
|
|
25275
25276
|
}
|
|
25276
25277
|
// Mark as saving
|
|
25277
25278
|
this.markAsSaving();
|
|
25278
|
-
|
|
25279
|
+
_e.label = 1;
|
|
25279
25280
|
case 1:
|
|
25280
|
-
|
|
25281
|
+
_e.trys.push([1, 3, 4, 7]);
|
|
25281
25282
|
// Calling service save()
|
|
25282
25283
|
if (this.debug)
|
|
25283
25284
|
console.debug('[table] Calling dataSource.save()...');
|
|
25284
25285
|
return [4 /*yield*/, this._dataSource.save()];
|
|
25285
25286
|
case 2:
|
|
25286
|
-
isOK =
|
|
25287
|
+
isOK = _e.sent();
|
|
25287
25288
|
if (isOK)
|
|
25288
25289
|
this.markAsPristine();
|
|
25289
25290
|
return [2 /*return*/, isOK];
|
|
25290
25291
|
case 3:
|
|
25291
|
-
err_1 =
|
|
25292
|
+
err_1 = _e.sent();
|
|
25292
25293
|
this.setError(err_1 && err_1.message || err_1);
|
|
25293
25294
|
throw err_1;
|
|
25294
25295
|
case 4:
|
|
@@ -25296,8 +25297,8 @@
|
|
|
25296
25297
|
if (!isNotNil(this.previouslyEditedRowId)) return [3 /*break*/, 6];
|
|
25297
25298
|
return [4 /*yield*/, this.selectRowByIdOrData(this.previouslyEditedRowId, previouslyEditedData)];
|
|
25298
25299
|
case 5:
|
|
25299
|
-
|
|
25300
|
-
|
|
25300
|
+
_e.sent();
|
|
25301
|
+
_e.label = 6;
|
|
25301
25302
|
case 6: return [7 /*endfinally*/];
|
|
25302
25303
|
case 7: return [2 /*return*/];
|
|
25303
25304
|
}
|
|
@@ -25322,8 +25323,8 @@
|
|
|
25322
25323
|
var _a;
|
|
25323
25324
|
return __awaiter(this, void 0, void 0, function () {
|
|
25324
25325
|
var newRow, json, newData_1;
|
|
25325
|
-
return __generator(this, function (
|
|
25326
|
-
switch (
|
|
25326
|
+
return __generator(this, function (_e) {
|
|
25327
|
+
switch (_e.label) {
|
|
25327
25328
|
case 0:
|
|
25328
25329
|
event === null || event === void 0 ? void 0 : event.stopPropagation();
|
|
25329
25330
|
row = row || this.singleSelectedRow;
|
|
@@ -25332,7 +25333,7 @@
|
|
|
25332
25333
|
}
|
|
25333
25334
|
return [4 /*yield*/, this.addRowToTable(row.id + 1)];
|
|
25334
25335
|
case 1:
|
|
25335
|
-
newRow =
|
|
25336
|
+
newRow = _e.sent();
|
|
25336
25337
|
json = Object.assign(Object.assign({}, row.currentData), { id: null });
|
|
25337
25338
|
// Reset some properties (e.g. rankOrder, etc)
|
|
25338
25339
|
if (opts && opts.skipProperties) {
|
|
@@ -25371,8 +25372,8 @@
|
|
|
25371
25372
|
return __awaiter(this, void 0, void 0, function () {
|
|
25372
25373
|
var rows;
|
|
25373
25374
|
var _this = this;
|
|
25374
|
-
return __generator(this, function (
|
|
25375
|
-
switch (
|
|
25375
|
+
return __generator(this, function (_e) {
|
|
25376
|
+
switch (_e.label) {
|
|
25376
25377
|
case 0:
|
|
25377
25378
|
if (this.loading)
|
|
25378
25379
|
return [2 /*return*/];
|
|
@@ -25381,9 +25382,9 @@
|
|
|
25381
25382
|
return [3 /*break*/, 3];
|
|
25382
25383
|
case 1: return [4 /*yield*/, this._dataSource.getRows()];
|
|
25383
25384
|
case 2:
|
|
25384
|
-
rows =
|
|
25385
|
+
rows = _e.sent();
|
|
25385
25386
|
rows.forEach(function (row) { return _this.selection.select(row); });
|
|
25386
|
-
|
|
25387
|
+
_e.label = 3;
|
|
25387
25388
|
case 3: return [2 /*return*/];
|
|
25388
25389
|
}
|
|
25389
25390
|
});
|
|
@@ -25401,11 +25402,11 @@
|
|
|
25401
25402
|
AppTable.prototype.deleteRow = function (event, row, opts) {
|
|
25402
25403
|
return __awaiter(this, void 0, void 0, function () {
|
|
25403
25404
|
var deleteCount;
|
|
25404
|
-
return __generator(this, function (
|
|
25405
|
-
switch (
|
|
25405
|
+
return __generator(this, function (_e) {
|
|
25406
|
+
switch (_e.label) {
|
|
25406
25407
|
case 0: return [4 /*yield*/, this.deleteRows(event, [row], opts)];
|
|
25407
25408
|
case 1:
|
|
25408
|
-
deleteCount =
|
|
25409
|
+
deleteCount = _e.sent();
|
|
25409
25410
|
return [2 /*return*/, deleteCount === 1];
|
|
25410
25411
|
}
|
|
25411
25412
|
});
|
|
@@ -25420,10 +25421,10 @@
|
|
|
25420
25421
|
AppTable.prototype.deleteRows = function (event, rows, opts) {
|
|
25421
25422
|
var _a;
|
|
25422
25423
|
return __awaiter(this, void 0, void 0, function () {
|
|
25423
|
-
var confirmed, canDelete, saved,
|
|
25424
|
+
var confirmed, canDelete, saved, deleteCount, err_2;
|
|
25424
25425
|
var _this = this;
|
|
25425
|
-
return __generator(this, function (
|
|
25426
|
-
switch (
|
|
25426
|
+
return __generator(this, function (_e) {
|
|
25427
|
+
switch (_e.label) {
|
|
25427
25428
|
case 0:
|
|
25428
25429
|
if (this.readOnly) {
|
|
25429
25430
|
throw { code: ErrorCodes$2.TABLE_READ_ONLY, message: 'ERROR.TABLE_READ_ONLY' };
|
|
@@ -25443,7 +25444,7 @@
|
|
|
25443
25444
|
}
|
|
25444
25445
|
return [4 /*yield*/, this.canDeleteRows(rows, opts)];
|
|
25445
25446
|
case 1:
|
|
25446
|
-
canDelete =
|
|
25447
|
+
canDelete = _e.sent();
|
|
25447
25448
|
if (!canDelete)
|
|
25448
25449
|
return [2 /*return*/, 0]; // Cannot delete
|
|
25449
25450
|
if (!this.saveBeforeDelete) return [3 /*break*/, 3];
|
|
@@ -25461,31 +25462,31 @@
|
|
|
25461
25462
|
}
|
|
25462
25463
|
return res.concat(row);
|
|
25463
25464
|
}, []);
|
|
25464
|
-
if (
|
|
25465
|
-
return [2 /*return*/, 0];
|
|
25465
|
+
if (!isNotEmptyArray(rows)) return [3 /*break*/, 3];
|
|
25466
25466
|
return [4 /*yield*/, this.saveBeforeAction('delete')];
|
|
25467
25467
|
case 2:
|
|
25468
|
-
saved =
|
|
25468
|
+
saved = _e.sent();
|
|
25469
25469
|
if (!saved) {
|
|
25470
25470
|
// Stop if save cancelled or save failed
|
|
25471
25471
|
return [2 /*return*/];
|
|
25472
25472
|
}
|
|
25473
|
-
|
|
25473
|
+
_e.label = 3;
|
|
25474
25474
|
case 3:
|
|
25475
|
+
_e.trys.push([3, 6, , 7]);
|
|
25476
|
+
deleteCount = rows.length;
|
|
25477
|
+
if (!deleteCount) return [3 /*break*/, 5];
|
|
25475
25478
|
if (this.debug)
|
|
25476
|
-
console.debug('[table] Delete
|
|
25477
|
-
|
|
25478
|
-
|
|
25479
|
-
|
|
25480
|
-
|
|
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()
|
|
25481
25484
|
.sort(function (a, b) { return a.id > b.id ? -1 : 1; });
|
|
25482
|
-
|
|
25485
|
+
return [4 /*yield*/, this._dataSource.deleteAll(rows)];
|
|
25483
25486
|
case 4:
|
|
25484
|
-
|
|
25485
|
-
|
|
25486
|
-
return [4 /*yield*/, this._dataSource.deleteAll(rowsToDelete)];
|
|
25487
|
+
_e.sent();
|
|
25488
|
+
_e.label = 5;
|
|
25487
25489
|
case 5:
|
|
25488
|
-
_d.sent();
|
|
25489
25490
|
// DO not update manually, because watchALl().subscribe() will update this count
|
|
25490
25491
|
//this.totalRowCount -= deleteCount;
|
|
25491
25492
|
//this.visibleRowCount -= deleteCount;
|
|
@@ -25493,10 +25494,11 @@
|
|
|
25493
25494
|
this.editedRow = undefined;
|
|
25494
25495
|
this.markAsDirty({ emitEvent: false /*markForCheck() is called just after*/ });
|
|
25495
25496
|
this.markForCheck();
|
|
25496
|
-
|
|
25497
|
+
if (deleteCount)
|
|
25498
|
+
this.onAfterDeletedRows.next(rows);
|
|
25497
25499
|
return [2 /*return*/, deleteCount];
|
|
25498
25500
|
case 6:
|
|
25499
|
-
err_2 =
|
|
25501
|
+
err_2 = _e.sent();
|
|
25500
25502
|
this.setError(err_2 && err_2.message || err_2);
|
|
25501
25503
|
throw err_2;
|
|
25502
25504
|
case 7: return [2 /*return*/];
|
|
@@ -25507,14 +25509,14 @@
|
|
|
25507
25509
|
AppTable.prototype.selectRowById = function (id) {
|
|
25508
25510
|
return __awaiter(this, void 0, void 0, function () {
|
|
25509
25511
|
var row;
|
|
25510
|
-
return __generator(this, function (
|
|
25511
|
-
switch (
|
|
25512
|
+
return __generator(this, function (_e) {
|
|
25513
|
+
switch (_e.label) {
|
|
25512
25514
|
case 0:
|
|
25513
25515
|
if (id === undefined)
|
|
25514
25516
|
return [2 /*return*/, false];
|
|
25515
25517
|
return [4 /*yield*/, this.waitIdle()];
|
|
25516
25518
|
case 1:
|
|
25517
|
-
|
|
25519
|
+
_e.sent();
|
|
25518
25520
|
row = this.dataSource.getRow(id);
|
|
25519
25521
|
return [2 /*return*/, this.clickRow(null, row)];
|
|
25520
25522
|
}
|
|
@@ -25529,17 +25531,17 @@
|
|
|
25529
25531
|
return __awaiter(this, void 0, void 0, function () {
|
|
25530
25532
|
var row;
|
|
25531
25533
|
var _this = this;
|
|
25532
|
-
return __generator(this, function (
|
|
25533
|
-
switch (
|
|
25534
|
+
return __generator(this, function (_e) {
|
|
25535
|
+
switch (_e.label) {
|
|
25534
25536
|
case 0:
|
|
25535
25537
|
if (data === undefined)
|
|
25536
25538
|
return [2 /*return*/, Promise.resolve(false)];
|
|
25537
25539
|
return [4 /*yield*/, this.waitIdle()];
|
|
25538
25540
|
case 1:
|
|
25539
|
-
|
|
25541
|
+
_e.sent();
|
|
25540
25542
|
return [4 /*yield*/, this.dataSource.getRows()];
|
|
25541
25543
|
case 2:
|
|
25542
|
-
row = ((
|
|
25544
|
+
row = ((_e.sent()) || [])
|
|
25543
25545
|
.find(function (row) { return _this.equals(row.currentData, data); });
|
|
25544
25546
|
return [2 /*return*/, row && this.clickRow(null, row)];
|
|
25545
25547
|
}
|
|
@@ -25581,11 +25583,11 @@
|
|
|
25581
25583
|
};
|
|
25582
25584
|
AppTable.prototype.ready = function () {
|
|
25583
25585
|
return __awaiter(this, void 0, void 0, function () {
|
|
25584
|
-
return __generator(this, function (
|
|
25585
|
-
switch (
|
|
25586
|
+
return __generator(this, function (_e) {
|
|
25587
|
+
switch (_e.label) {
|
|
25586
25588
|
case 0: return [4 /*yield*/, firstTruePromise(this.readySubject)];
|
|
25587
25589
|
case 1:
|
|
25588
|
-
|
|
25590
|
+
_e.sent();
|
|
25589
25591
|
return [2 /*return*/];
|
|
25590
25592
|
}
|
|
25591
25593
|
});
|
|
@@ -25593,11 +25595,11 @@
|
|
|
25593
25595
|
};
|
|
25594
25596
|
AppTable.prototype.waitIdle = function (opts) {
|
|
25595
25597
|
return __awaiter(this, void 0, void 0, function () {
|
|
25596
|
-
return __generator(this, function (
|
|
25597
|
-
switch (
|
|
25598
|
+
return __generator(this, function (_e) {
|
|
25599
|
+
switch (_e.label) {
|
|
25598
25600
|
case 0: return [4 /*yield*/, firstFalsePromise(this.loadingSubject)];
|
|
25599
25601
|
case 1:
|
|
25600
|
-
|
|
25602
|
+
_e.sent();
|
|
25601
25603
|
return [2 /*return*/];
|
|
25602
25604
|
}
|
|
25603
25605
|
});
|
|
@@ -25606,28 +25608,28 @@
|
|
|
25606
25608
|
AppTable.prototype.openSelectColumnsModal = function (event) {
|
|
25607
25609
|
return __awaiter(this, void 0, void 0, function () {
|
|
25608
25610
|
var columns, hasTopModal, modal, data, userColumns;
|
|
25609
|
-
return __generator(this, function (
|
|
25610
|
-
switch (
|
|
25611
|
+
return __generator(this, function (_e) {
|
|
25612
|
+
switch (_e.label) {
|
|
25611
25613
|
case 0:
|
|
25612
25614
|
columns = this.getCurrentColumns();
|
|
25613
25615
|
return [4 /*yield*/, this.modalCtrl.getTop()];
|
|
25614
25616
|
case 1:
|
|
25615
|
-
hasTopModal = !!(
|
|
25617
|
+
hasTopModal = !!(_e.sent());
|
|
25616
25618
|
return [4 /*yield*/, this.modalCtrl.create({
|
|
25617
25619
|
component: TableSelectColumnsComponent,
|
|
25618
25620
|
componentProps: { columns: columns },
|
|
25619
25621
|
cssClass: hasTopModal && 'stack-modal'
|
|
25620
25622
|
})];
|
|
25621
25623
|
case 2:
|
|
25622
|
-
modal =
|
|
25624
|
+
modal = _e.sent();
|
|
25623
25625
|
// Open the modal
|
|
25624
25626
|
return [4 /*yield*/, modal.present()];
|
|
25625
25627
|
case 3:
|
|
25626
25628
|
// Open the modal
|
|
25627
|
-
|
|
25629
|
+
_e.sent();
|
|
25628
25630
|
return [4 /*yield*/, modal.onDidDismiss()];
|
|
25629
25631
|
case 4:
|
|
25630
|
-
data = (
|
|
25632
|
+
data = (_e.sent()).data;
|
|
25631
25633
|
if (!data)
|
|
25632
25634
|
return [2 /*return*/]; // CANCELLED
|
|
25633
25635
|
userColumns = (data || []).filter(function (c) { return c.canHide === false || c.visible; }).map(function (c) { return c.name; }) || [];
|
|
@@ -25637,7 +25639,7 @@
|
|
|
25637
25639
|
return [4 /*yield*/, this.settings.savePageSetting(this.settingsId, userColumns, SETTINGS_DISPLAY_COLUMNS)];
|
|
25638
25640
|
case 5:
|
|
25639
25641
|
// Update user settings
|
|
25640
|
-
|
|
25642
|
+
_e.sent();
|
|
25641
25643
|
return [2 /*return*/];
|
|
25642
25644
|
}
|
|
25643
25645
|
});
|
|
@@ -25652,11 +25654,11 @@
|
|
|
25652
25654
|
// When target wait for a complete (e.g. IonRefresher)
|
|
25653
25655
|
if ((event === null || event === void 0 ? void 0 : event.target) && event.target.complete) {
|
|
25654
25656
|
setTimeout(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
25655
|
-
return __generator(this, function (
|
|
25656
|
-
switch (
|
|
25657
|
+
return __generator(this, function (_e) {
|
|
25658
|
+
switch (_e.label) {
|
|
25657
25659
|
case 0: return [4 /*yield*/, this.waitIdle()];
|
|
25658
25660
|
case 1:
|
|
25659
|
-
|
|
25661
|
+
_e.sent();
|
|
25660
25662
|
event.target.complete();
|
|
25661
25663
|
return [2 /*return*/];
|
|
25662
25664
|
}
|
|
@@ -25741,33 +25743,33 @@
|
|
|
25741
25743
|
AppTable.prototype.selectRowByIdOrData = function (id, data) {
|
|
25742
25744
|
return __awaiter(this, void 0, void 0, function () {
|
|
25743
25745
|
var done, err_3;
|
|
25744
|
-
return __generator(this, function (
|
|
25745
|
-
switch (
|
|
25746
|
+
return __generator(this, function (_e) {
|
|
25747
|
+
switch (_e.label) {
|
|
25746
25748
|
case 0:
|
|
25747
25749
|
done = false;
|
|
25748
|
-
|
|
25750
|
+
_e.label = 1;
|
|
25749
25751
|
case 1:
|
|
25750
|
-
|
|
25752
|
+
_e.trys.push([1, 6, , 7]);
|
|
25751
25753
|
if (!(isNotNil(id) || id !== -1)) return [3 /*break*/, 3];
|
|
25752
25754
|
return [4 /*yield*/, this.selectRowById(id)];
|
|
25753
25755
|
case 2:
|
|
25754
|
-
done =
|
|
25756
|
+
done = _e.sent();
|
|
25755
25757
|
if (done)
|
|
25756
25758
|
return [2 /*return*/, true];
|
|
25757
25759
|
console.warn('[app-table] Save: Cannot reselect row by row.id: ', id);
|
|
25758
|
-
|
|
25760
|
+
_e.label = 3;
|
|
25759
25761
|
case 3:
|
|
25760
25762
|
if (!data) return [3 /*break*/, 5];
|
|
25761
25763
|
return [4 /*yield*/, this.selectRowByData(data)];
|
|
25762
25764
|
case 4:
|
|
25763
|
-
done =
|
|
25765
|
+
done = _e.sent();
|
|
25764
25766
|
if (done)
|
|
25765
25767
|
return [2 /*return*/, true];
|
|
25766
25768
|
console.warn('[app-table] Save: Cannot reselect row by data: ', data);
|
|
25767
|
-
|
|
25769
|
+
_e.label = 5;
|
|
25768
25770
|
case 5: return [2 /*return*/, false];
|
|
25769
25771
|
case 6:
|
|
25770
|
-
err_3 =
|
|
25772
|
+
err_3 = _e.sent();
|
|
25771
25773
|
// Log, but continue
|
|
25772
25774
|
console.error(err_3 && err_3.message || err_3);
|
|
25773
25775
|
return [2 /*return*/, false];
|
|
@@ -25790,23 +25792,23 @@
|
|
|
25790
25792
|
AppTable.prototype.canDeleteRows = function (rows, opts) {
|
|
25791
25793
|
return __awaiter(this, void 0, void 0, function () {
|
|
25792
25794
|
var canDelete, err_4;
|
|
25793
|
-
return __generator(this, function (
|
|
25794
|
-
switch (
|
|
25795
|
+
return __generator(this, function (_e) {
|
|
25796
|
+
switch (_e.label) {
|
|
25795
25797
|
case 0:
|
|
25796
25798
|
if (!(this.onBeforeDeleteRows.observers.length > 0)) return [3 /*break*/, 4];
|
|
25797
|
-
|
|
25799
|
+
_e.label = 1;
|
|
25798
25800
|
case 1:
|
|
25799
|
-
|
|
25801
|
+
_e.trys.push([1, 3, , 4]);
|
|
25800
25802
|
return [4 /*yield*/, emitPromiseEvent(this.onBeforeDeleteRows, 'canDelete', {
|
|
25801
25803
|
detail: { rows: rows }
|
|
25802
25804
|
})];
|
|
25803
25805
|
case 2:
|
|
25804
|
-
canDelete =
|
|
25806
|
+
canDelete = _e.sent();
|
|
25805
25807
|
if (!canDelete)
|
|
25806
25808
|
return [2 /*return*/, false];
|
|
25807
25809
|
return [3 /*break*/, 4];
|
|
25808
25810
|
case 3:
|
|
25809
|
-
err_4 =
|
|
25811
|
+
err_4 = _e.sent();
|
|
25810
25812
|
if (err_4 === 'CANCELLED')
|
|
25811
25813
|
return [2 /*return*/, false]; // User cancel
|
|
25812
25814
|
console.error('Error while checking if can delete rows', err_4);
|
|
@@ -25823,35 +25825,35 @@
|
|
|
25823
25825
|
};
|
|
25824
25826
|
AppTable.prototype.canCancelRows = function (rows, opts) {
|
|
25825
25827
|
return __awaiter(this, void 0, void 0, function () {
|
|
25826
|
-
var
|
|
25827
|
-
return __generator(this, function (
|
|
25828
|
-
switch (
|
|
25828
|
+
var _e, isCancel, err_5;
|
|
25829
|
+
return __generator(this, function (_f) {
|
|
25830
|
+
switch (_f.label) {
|
|
25829
25831
|
case 0:
|
|
25830
|
-
|
|
25831
|
-
if (
|
|
25832
|
+
_e = rows;
|
|
25833
|
+
if (_e) return [3 /*break*/, 2];
|
|
25832
25834
|
return [4 /*yield*/, this.dataSource.getRows()];
|
|
25833
25835
|
case 1:
|
|
25834
|
-
|
|
25835
|
-
|
|
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;
|
|
25836
25838
|
case 2:
|
|
25837
25839
|
// Get dirty rows
|
|
25838
|
-
rows =
|
|
25840
|
+
rows = _e;
|
|
25839
25841
|
if (isEmptyArray(rows))
|
|
25840
25842
|
return [2 /*return*/, true]; // No dirty: OK
|
|
25841
25843
|
if (!(this.onBeforeCancelRows.observers.length > 0)) return [3 /*break*/, 6];
|
|
25842
|
-
|
|
25844
|
+
_f.label = 3;
|
|
25843
25845
|
case 3:
|
|
25844
|
-
|
|
25846
|
+
_f.trys.push([3, 5, , 6]);
|
|
25845
25847
|
return [4 /*yield*/, emitPromiseEvent(this.onBeforeCancelRows, 'canCancel', {
|
|
25846
25848
|
detail: { rows: rows }
|
|
25847
25849
|
})];
|
|
25848
25850
|
case 4:
|
|
25849
|
-
isCancel =
|
|
25851
|
+
isCancel = _f.sent();
|
|
25850
25852
|
if (!isCancel)
|
|
25851
25853
|
return [2 /*return*/, false];
|
|
25852
25854
|
return [3 /*break*/, 6];
|
|
25853
25855
|
case 5:
|
|
25854
|
-
err_5 =
|
|
25856
|
+
err_5 = _f.sent();
|
|
25855
25857
|
if (err_5 === 'CANCELLED')
|
|
25856
25858
|
return [2 /*return*/, false]; // User cancel
|
|
25857
25859
|
console.error('Error while checking if can cancel rows', err_5);
|
|
@@ -25869,8 +25871,8 @@
|
|
|
25869
25871
|
AppTable.prototype.saveBeforeAction = function (saveAction) {
|
|
25870
25872
|
return __awaiter(this, void 0, void 0, function () {
|
|
25871
25873
|
var save, confirmed, res, err_6, saved;
|
|
25872
|
-
return __generator(this, function (
|
|
25873
|
-
switch (
|
|
25874
|
+
return __generator(this, function (_e) {
|
|
25875
|
+
switch (_e.label) {
|
|
25874
25876
|
case 0:
|
|
25875
25877
|
if (!this.dirty) {
|
|
25876
25878
|
// Continue without save
|
|
@@ -25892,19 +25894,19 @@
|
|
|
25892
25894
|
confirmed = true;
|
|
25893
25895
|
if (!save) return [3 /*break*/, 4];
|
|
25894
25896
|
if (!(this.onBeforeSave.observers.length > 0)) return [3 /*break*/, 4];
|
|
25895
|
-
|
|
25897
|
+
_e.label = 1;
|
|
25896
25898
|
case 1:
|
|
25897
|
-
|
|
25899
|
+
_e.trys.push([1, 3, , 4]);
|
|
25898
25900
|
return [4 /*yield*/, emitPromiseEvent(this.onBeforeSave, 'beforeSave', {
|
|
25899
25901
|
detail: { action: saveAction, valid: this.valid }
|
|
25900
25902
|
})];
|
|
25901
25903
|
case 2:
|
|
25902
|
-
res =
|
|
25904
|
+
res = _e.sent();
|
|
25903
25905
|
confirmed = res.confirmed;
|
|
25904
25906
|
save = res.save;
|
|
25905
25907
|
return [3 /*break*/, 4];
|
|
25906
25908
|
case 3:
|
|
25907
|
-
err_6 =
|
|
25909
|
+
err_6 = _e.sent();
|
|
25908
25910
|
if (err_6 === 'CANCELLED')
|
|
25909
25911
|
return [2 /*return*/, false]; // User cancel
|
|
25910
25912
|
console.error('Error while checking if can delete rows', err_6);
|
|
@@ -25914,7 +25916,7 @@
|
|
|
25914
25916
|
if (!save) return [3 /*break*/, 6];
|
|
25915
25917
|
return [4 /*yield*/, this.save()];
|
|
25916
25918
|
case 5:
|
|
25917
|
-
saved =
|
|
25919
|
+
saved = _e.sent();
|
|
25918
25920
|
this.markAsDirty(); // Restore dirty flag
|
|
25919
25921
|
return [2 /*return*/, saved];
|
|
25920
25922
|
case 6: return [2 /*return*/, true]; // No save but continue action
|
|
@@ -25932,8 +25934,8 @@
|
|
|
25932
25934
|
*/
|
|
25933
25935
|
AppTable.prototype.openRow = function (id, row) {
|
|
25934
25936
|
return __awaiter(this, void 0, void 0, function () {
|
|
25935
|
-
return __generator(this, function (
|
|
25936
|
-
switch (
|
|
25937
|
+
return __generator(this, function (_e) {
|
|
25938
|
+
switch (_e.label) {
|
|
25937
25939
|
case 0:
|
|
25938
25940
|
if (!this.allowRowDetail) return [3 /*break*/, 2];
|
|
25939
25941
|
if (this.debug && this.dirty) {
|
|
@@ -25952,7 +25954,7 @@
|
|
|
25952
25954
|
relativeTo: this.route,
|
|
25953
25955
|
queryParams: {}
|
|
25954
25956
|
})];
|
|
25955
|
-
case 1: return [2 /*return*/,
|
|
25957
|
+
case 1: return [2 /*return*/, _e.sent()];
|
|
25956
25958
|
case 2: return [2 /*return*/, false];
|
|
25957
25959
|
}
|
|
25958
25960
|
});
|
|
@@ -25960,8 +25962,8 @@
|
|
|
25960
25962
|
};
|
|
25961
25963
|
AppTable.prototype.openNewRowDetail = function (event) {
|
|
25962
25964
|
return __awaiter(this, void 0, void 0, function () {
|
|
25963
|
-
return __generator(this, function (
|
|
25964
|
-
switch (
|
|
25965
|
+
return __generator(this, function (_e) {
|
|
25966
|
+
switch (_e.label) {
|
|
25965
25967
|
case 0:
|
|
25966
25968
|
if (!this.allowRowDetail)
|
|
25967
25969
|
return [2 /*return*/, false];
|
|
@@ -25972,7 +25974,7 @@
|
|
|
25972
25974
|
return [4 /*yield*/, this.router.navigate(['new'], {
|
|
25973
25975
|
relativeTo: this.route
|
|
25974
25976
|
})];
|
|
25975
|
-
case 1: return [2 /*return*/,
|
|
25977
|
+
case 1: return [2 /*return*/, _e.sent()];
|
|
25976
25978
|
}
|
|
25977
25979
|
});
|
|
25978
25980
|
});
|
|
@@ -26050,13 +26052,13 @@
|
|
|
26050
26052
|
};
|
|
26051
26053
|
AppTable.prototype.addRowToTable = function (insertAt) {
|
|
26052
26054
|
return __awaiter(this, void 0, void 0, function () {
|
|
26053
|
-
return __generator(this, function (
|
|
26054
|
-
switch (
|
|
26055
|
+
return __generator(this, function (_e) {
|
|
26056
|
+
switch (_e.label) {
|
|
26055
26057
|
case 0:
|
|
26056
26058
|
this.focusFirstColumn = true;
|
|
26057
26059
|
return [4 /*yield*/, this._dataSource.asyncCreateNew(insertAt)];
|
|
26058
26060
|
case 1:
|
|
26059
|
-
|
|
26061
|
+
_e.sent();
|
|
26060
26062
|
this.editedRow = this._dataSource.getRow(-1);
|
|
26061
26063
|
// Emit start editing event
|
|
26062
26064
|
this.onStartEditingRow.emit(this.editedRow);
|
|
@@ -26120,7 +26122,7 @@
|
|
|
26120
26122
|
};
|
|
26121
26123
|
AppTable.prototype.askDeleteConfirmation = function (event, rows) {
|
|
26122
26124
|
return __awaiter(this, void 0, void 0, function () {
|
|
26123
|
-
return __generator(this, function (
|
|
26125
|
+
return __generator(this, function (_e) {
|
|
26124
26126
|
if (this.undoableDeletion) {
|
|
26125
26127
|
// Special message, for undoable deletion
|
|
26126
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)];
|
|
@@ -26132,21 +26134,21 @@
|
|
|
26132
26134
|
};
|
|
26133
26135
|
AppTable.prototype.askCancelConfirmation = function (event, rows) {
|
|
26134
26136
|
return __awaiter(this, void 0, void 0, function () {
|
|
26135
|
-
return __generator(this, function (
|
|
26137
|
+
return __generator(this, function (_e) {
|
|
26136
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)];
|
|
26137
26139
|
});
|
|
26138
26140
|
});
|
|
26139
26141
|
};
|
|
26140
26142
|
AppTable.prototype.askRestoreConfirmation = function (event) {
|
|
26141
26143
|
return __awaiter(this, void 0, void 0, function () {
|
|
26142
|
-
return __generator(this, function (
|
|
26144
|
+
return __generator(this, function (_e) {
|
|
26143
26145
|
return [2 /*return*/, Alerts.askActionConfirmation(this.alertCtrl, this.translate, false, event)];
|
|
26144
26146
|
});
|
|
26145
26147
|
});
|
|
26146
26148
|
};
|
|
26147
26149
|
AppTable.prototype.showToast = function (opts) {
|
|
26148
26150
|
return __awaiter(this, void 0, void 0, function () {
|
|
26149
|
-
return __generator(this, function (
|
|
26151
|
+
return __generator(this, function (_e) {
|
|
26150
26152
|
if (!this.toastController)
|
|
26151
26153
|
throw new Error('Missing toastController in component\'s constructor');
|
|
26152
26154
|
return [2 /*return*/, Toasts.show(this.toastController, this.translate, opts)];
|
|
@@ -26241,14 +26243,14 @@
|
|
|
26241
26243
|
AppTable.prototype.checkIfPristine = function (opts) {
|
|
26242
26244
|
return __awaiter(this, void 0, void 0, function () {
|
|
26243
26245
|
var rows, pristine;
|
|
26244
|
-
return __generator(this, function (
|
|
26245
|
-
switch (
|
|
26246
|
+
return __generator(this, function (_e) {
|
|
26247
|
+
switch (_e.label) {
|
|
26246
26248
|
case 0:
|
|
26247
26249
|
if (!this.dirty)
|
|
26248
26250
|
return [2 /*return*/]; // Already pristine
|
|
26249
26251
|
return [4 /*yield*/, this._dataSource.getRows()];
|
|
26250
26252
|
case 1:
|
|
26251
|
-
rows =
|
|
26253
|
+
rows = _e.sent();
|
|
26252
26254
|
pristine = (rows || []).findIndex(function (row) { var _a; return (_a = row.validator) === null || _a === void 0 ? void 0 : _a.dirty; }) === -1;
|
|
26253
26255
|
if (pristine)
|
|
26254
26256
|
this.markAsPristine(opts);
|