@sumaris-net/ngx-components 1.8.2-rc1 → 1.8.2-rc2
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 +109 -109
- package/bundles/sumaris-net.ngx-components.umd.js.map +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js.map +1 -1
- package/esm2015/src/app/core/table/table.class.js +3 -3
- package/fesm2015/sumaris-net.ngx-components.js +2 -2
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
|
@@ -25017,7 +25017,7 @@
|
|
|
25017
25017
|
rxjs.merge(
|
|
25018
25018
|
// Listen sort events
|
|
25019
25019
|
this.sort && this.sort.sortChange
|
|
25020
|
-
.pipe(operators.filter(function () { return !_this.sort.disabled; }), operators.mergeMap(function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (
|
|
25020
|
+
.pipe(operators.filter(function () { return !_this.sort.disabled; }), operators.mergeMap(function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_e) {
|
|
25021
25021
|
return [2 /*return*/, this.saveBeforeAction('sort')];
|
|
25022
25022
|
}); }); }), operators.filter(function (res) { return res === true; }),
|
|
25023
25023
|
// Save sort in settings
|
|
@@ -25028,7 +25028,7 @@
|
|
|
25028
25028
|
|| rxjs.EMPTY,
|
|
25029
25029
|
// Listen paginator events
|
|
25030
25030
|
this.paginator && this.paginator.page
|
|
25031
|
-
.pipe(operators.mergeMap(function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (
|
|
25031
|
+
.pipe(operators.mergeMap(function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_e) {
|
|
25032
25032
|
return [2 /*return*/, this.saveBeforeAction('sort')];
|
|
25033
25033
|
}); }); }), operators.filter(function (res) { return res === true; }),
|
|
25034
25034
|
// Save page size
|
|
@@ -25073,7 +25073,7 @@
|
|
|
25073
25073
|
};
|
|
25074
25074
|
AppTable.prototype.updateView = function (res, opts) {
|
|
25075
25075
|
return __awaiter(this, void 0, void 0, function () {
|
|
25076
|
-
return __generator(this, function (
|
|
25076
|
+
return __generator(this, function (_e) {
|
|
25077
25077
|
if (!res)
|
|
25078
25078
|
return [2 /*return*/]; // Skip (e.g error)
|
|
25079
25079
|
if (res && res.data) {
|
|
@@ -25182,8 +25182,8 @@
|
|
|
25182
25182
|
AppTable.prototype.editRowById = function (event, id, opts) {
|
|
25183
25183
|
return __awaiter(this, void 0, void 0, function () {
|
|
25184
25184
|
var row;
|
|
25185
|
-
return __generator(this, function (
|
|
25186
|
-
switch (
|
|
25185
|
+
return __generator(this, function (_e) {
|
|
25186
|
+
switch (_e.label) {
|
|
25187
25187
|
case 0:
|
|
25188
25188
|
if (id < 0)
|
|
25189
25189
|
return [2 /*return*/];
|
|
@@ -25193,9 +25193,9 @@
|
|
|
25193
25193
|
return [3 /*break*/, 3];
|
|
25194
25194
|
case 1: return [4 /*yield*/, this.dataSource.getRow(id)];
|
|
25195
25195
|
case 2:
|
|
25196
|
-
row =
|
|
25196
|
+
row = _e.sent();
|
|
25197
25197
|
this.editRow(event, row, opts);
|
|
25198
|
-
|
|
25198
|
+
_e.label = 3;
|
|
25199
25199
|
case 3: return [2 /*return*/];
|
|
25200
25200
|
}
|
|
25201
25201
|
});
|
|
@@ -25280,11 +25280,11 @@
|
|
|
25280
25280
|
return true;
|
|
25281
25281
|
};
|
|
25282
25282
|
AppTable.prototype.save = function (opts) {
|
|
25283
|
-
var _a, _b, _c;
|
|
25283
|
+
var _a, _b, _c, _d;
|
|
25284
25284
|
return __awaiter(this, void 0, void 0, function () {
|
|
25285
25285
|
var previouslyEditedData, isOK, err_1;
|
|
25286
|
-
return __generator(this, function (
|
|
25287
|
-
switch (
|
|
25286
|
+
return __generator(this, function (_e) {
|
|
25287
|
+
switch (_e.label) {
|
|
25288
25288
|
case 0:
|
|
25289
25289
|
opts = Object.assign({ keepEditing: this.keepEditedRowOnSave }, opts);
|
|
25290
25290
|
if (this.readOnly) {
|
|
@@ -25293,26 +25293,26 @@
|
|
|
25293
25293
|
this.resetError();
|
|
25294
25294
|
// Keep edited row id (should be done BEFORE confirmEditCreate() )
|
|
25295
25295
|
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));
|
|
25296
|
-
previouslyEditedData = isNotNil(this.previouslyEditedRowId) && this.editedRow.currentData || ((
|
|
25296
|
+
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);
|
|
25297
25297
|
if (!this.confirmEditCreate()) {
|
|
25298
25298
|
throw { code: ErrorCodes.TABLE_INVALID_ROW_ERROR, message: 'ERROR.TABLE_INVALID_ROW_ERROR' };
|
|
25299
25299
|
}
|
|
25300
25300
|
// Mark as saving
|
|
25301
25301
|
this.markAsSaving();
|
|
25302
|
-
|
|
25302
|
+
_e.label = 1;
|
|
25303
25303
|
case 1:
|
|
25304
|
-
|
|
25304
|
+
_e.trys.push([1, 3, 4, 7]);
|
|
25305
25305
|
// Calling service save()
|
|
25306
25306
|
if (this.debug)
|
|
25307
25307
|
console.debug('[table] Calling dataSource.save()...');
|
|
25308
25308
|
return [4 /*yield*/, this._dataSource.save()];
|
|
25309
25309
|
case 2:
|
|
25310
|
-
isOK =
|
|
25310
|
+
isOK = _e.sent();
|
|
25311
25311
|
if (isOK)
|
|
25312
25312
|
this.markAsPristine();
|
|
25313
25313
|
return [2 /*return*/, isOK];
|
|
25314
25314
|
case 3:
|
|
25315
|
-
err_1 =
|
|
25315
|
+
err_1 = _e.sent();
|
|
25316
25316
|
this.setError(err_1 && err_1.message || err_1);
|
|
25317
25317
|
throw err_1;
|
|
25318
25318
|
case 4:
|
|
@@ -25320,8 +25320,8 @@
|
|
|
25320
25320
|
if (!isNotNil(this.previouslyEditedRowId)) return [3 /*break*/, 6];
|
|
25321
25321
|
return [4 /*yield*/, this.selectRowByIdOrData(this.previouslyEditedRowId, previouslyEditedData)];
|
|
25322
25322
|
case 5:
|
|
25323
|
-
|
|
25324
|
-
|
|
25323
|
+
_e.sent();
|
|
25324
|
+
_e.label = 6;
|
|
25325
25325
|
case 6: return [7 /*endfinally*/];
|
|
25326
25326
|
case 7: return [2 /*return*/];
|
|
25327
25327
|
}
|
|
@@ -25346,8 +25346,8 @@
|
|
|
25346
25346
|
var _a;
|
|
25347
25347
|
return __awaiter(this, void 0, void 0, function () {
|
|
25348
25348
|
var newRow, json, newData_1;
|
|
25349
|
-
return __generator(this, function (
|
|
25350
|
-
switch (
|
|
25349
|
+
return __generator(this, function (_e) {
|
|
25350
|
+
switch (_e.label) {
|
|
25351
25351
|
case 0:
|
|
25352
25352
|
event === null || event === void 0 ? void 0 : event.stopPropagation();
|
|
25353
25353
|
row = row || this.singleSelectedRow;
|
|
@@ -25356,7 +25356,7 @@
|
|
|
25356
25356
|
}
|
|
25357
25357
|
return [4 /*yield*/, this.addRowToTable(row.id + 1)];
|
|
25358
25358
|
case 1:
|
|
25359
|
-
newRow =
|
|
25359
|
+
newRow = _e.sent();
|
|
25360
25360
|
json = Object.assign(Object.assign({}, row.currentData), { id: null });
|
|
25361
25361
|
// Reset some properties (e.g. rankOrder, etc)
|
|
25362
25362
|
if (opts && opts.skipProperties) {
|
|
@@ -25395,8 +25395,8 @@
|
|
|
25395
25395
|
return __awaiter(this, void 0, void 0, function () {
|
|
25396
25396
|
var rows;
|
|
25397
25397
|
var _this = this;
|
|
25398
|
-
return __generator(this, function (
|
|
25399
|
-
switch (
|
|
25398
|
+
return __generator(this, function (_e) {
|
|
25399
|
+
switch (_e.label) {
|
|
25400
25400
|
case 0:
|
|
25401
25401
|
if (this.loading)
|
|
25402
25402
|
return [2 /*return*/];
|
|
@@ -25405,9 +25405,9 @@
|
|
|
25405
25405
|
return [3 /*break*/, 3];
|
|
25406
25406
|
case 1: return [4 /*yield*/, this._dataSource.getRows()];
|
|
25407
25407
|
case 2:
|
|
25408
|
-
rows =
|
|
25408
|
+
rows = _e.sent();
|
|
25409
25409
|
rows.forEach(function (row) { return _this.selection.select(row); });
|
|
25410
|
-
|
|
25410
|
+
_e.label = 3;
|
|
25411
25411
|
case 3: return [2 /*return*/];
|
|
25412
25412
|
}
|
|
25413
25413
|
});
|
|
@@ -25425,11 +25425,11 @@
|
|
|
25425
25425
|
AppTable.prototype.deleteRow = function (event, row, opts) {
|
|
25426
25426
|
return __awaiter(this, void 0, void 0, function () {
|
|
25427
25427
|
var deleteCount;
|
|
25428
|
-
return __generator(this, function (
|
|
25429
|
-
switch (
|
|
25428
|
+
return __generator(this, function (_e) {
|
|
25429
|
+
switch (_e.label) {
|
|
25430
25430
|
case 0: return [4 /*yield*/, this.deleteRows(event, [row], opts)];
|
|
25431
25431
|
case 1:
|
|
25432
|
-
deleteCount =
|
|
25432
|
+
deleteCount = _e.sent();
|
|
25433
25433
|
return [2 /*return*/, deleteCount === 1];
|
|
25434
25434
|
}
|
|
25435
25435
|
});
|
|
@@ -25446,8 +25446,8 @@
|
|
|
25446
25446
|
return __awaiter(this, void 0, void 0, function () {
|
|
25447
25447
|
var confirmed, canDelete, saved, rowsToDelete, deleteCount, err_2;
|
|
25448
25448
|
var _this = this;
|
|
25449
|
-
return __generator(this, function (
|
|
25450
|
-
switch (
|
|
25449
|
+
return __generator(this, function (_e) {
|
|
25450
|
+
switch (_e.label) {
|
|
25451
25451
|
case 0:
|
|
25452
25452
|
if (this.readOnly) {
|
|
25453
25453
|
throw { code: ErrorCodes.TABLE_READ_ONLY, message: 'ERROR.TABLE_READ_ONLY' };
|
|
@@ -25467,7 +25467,7 @@
|
|
|
25467
25467
|
}
|
|
25468
25468
|
return [4 /*yield*/, this.canDeleteRows(rows, opts)];
|
|
25469
25469
|
case 1:
|
|
25470
|
-
canDelete =
|
|
25470
|
+
canDelete = _e.sent();
|
|
25471
25471
|
if (!canDelete)
|
|
25472
25472
|
return [2 /*return*/, 0]; // Cannot delete
|
|
25473
25473
|
if (!this.saveBeforeDelete) return [3 /*break*/, 3];
|
|
@@ -25489,12 +25489,12 @@
|
|
|
25489
25489
|
return [2 /*return*/, 0];
|
|
25490
25490
|
return [4 /*yield*/, this.saveBeforeAction('delete')];
|
|
25491
25491
|
case 2:
|
|
25492
|
-
saved =
|
|
25492
|
+
saved = _e.sent();
|
|
25493
25493
|
if (!saved) {
|
|
25494
25494
|
// Stop if save cancelled or save failed
|
|
25495
25495
|
return [2 /*return*/];
|
|
25496
25496
|
}
|
|
25497
|
-
|
|
25497
|
+
_e.label = 3;
|
|
25498
25498
|
case 3:
|
|
25499
25499
|
if (this.debug)
|
|
25500
25500
|
console.debug('[table] Delete selection...');
|
|
@@ -25503,13 +25503,13 @@
|
|
|
25503
25503
|
// This is a workaround, need because row.delete() has async execution
|
|
25504
25504
|
// and index cache is updated with a delay)
|
|
25505
25505
|
.sort(function (a, b) { return a.id > b.id ? -1 : 1; });
|
|
25506
|
-
|
|
25506
|
+
_e.label = 4;
|
|
25507
25507
|
case 4:
|
|
25508
|
-
|
|
25508
|
+
_e.trys.push([4, 6, , 7]);
|
|
25509
25509
|
deleteCount = rowsToDelete.length;
|
|
25510
25510
|
return [4 /*yield*/, this._dataSource.deleteAll(rowsToDelete)];
|
|
25511
25511
|
case 5:
|
|
25512
|
-
|
|
25512
|
+
_e.sent();
|
|
25513
25513
|
// DO not update manually, because watchALl().subscribe() will update this count
|
|
25514
25514
|
//this.totalRowCount -= deleteCount;
|
|
25515
25515
|
//this.visibleRowCount -= deleteCount;
|
|
@@ -25520,7 +25520,7 @@
|
|
|
25520
25520
|
this.onAfterDeletedRows.next(rowsToDelete);
|
|
25521
25521
|
return [2 /*return*/, deleteCount];
|
|
25522
25522
|
case 6:
|
|
25523
|
-
err_2 =
|
|
25523
|
+
err_2 = _e.sent();
|
|
25524
25524
|
this.setError(err_2 && err_2.message || err_2);
|
|
25525
25525
|
throw err_2;
|
|
25526
25526
|
case 7: return [2 /*return*/];
|
|
@@ -25531,14 +25531,14 @@
|
|
|
25531
25531
|
AppTable.prototype.selectRowById = function (id) {
|
|
25532
25532
|
return __awaiter(this, void 0, void 0, function () {
|
|
25533
25533
|
var row;
|
|
25534
|
-
return __generator(this, function (
|
|
25535
|
-
switch (
|
|
25534
|
+
return __generator(this, function (_e) {
|
|
25535
|
+
switch (_e.label) {
|
|
25536
25536
|
case 0:
|
|
25537
25537
|
if (id === undefined)
|
|
25538
25538
|
return [2 /*return*/, false];
|
|
25539
25539
|
return [4 /*yield*/, this.waitIdle()];
|
|
25540
25540
|
case 1:
|
|
25541
|
-
|
|
25541
|
+
_e.sent();
|
|
25542
25542
|
row = this.dataSource.getRow(id);
|
|
25543
25543
|
return [2 /*return*/, this.clickRow(null, row)];
|
|
25544
25544
|
}
|
|
@@ -25553,17 +25553,17 @@
|
|
|
25553
25553
|
return __awaiter(this, void 0, void 0, function () {
|
|
25554
25554
|
var row;
|
|
25555
25555
|
var _this = this;
|
|
25556
|
-
return __generator(this, function (
|
|
25557
|
-
switch (
|
|
25556
|
+
return __generator(this, function (_e) {
|
|
25557
|
+
switch (_e.label) {
|
|
25558
25558
|
case 0:
|
|
25559
25559
|
if (data === undefined)
|
|
25560
25560
|
return [2 /*return*/, Promise.resolve(false)];
|
|
25561
25561
|
return [4 /*yield*/, this.waitIdle()];
|
|
25562
25562
|
case 1:
|
|
25563
|
-
|
|
25563
|
+
_e.sent();
|
|
25564
25564
|
return [4 /*yield*/, this.dataSource.getRows()];
|
|
25565
25565
|
case 2:
|
|
25566
|
-
row = ((
|
|
25566
|
+
row = ((_e.sent()) || [])
|
|
25567
25567
|
.find(function (row) { return _this.equals(row.currentData, data); });
|
|
25568
25568
|
return [2 /*return*/, row && this.clickRow(null, row)];
|
|
25569
25569
|
}
|
|
@@ -25605,11 +25605,11 @@
|
|
|
25605
25605
|
};
|
|
25606
25606
|
AppTable.prototype.ready = function () {
|
|
25607
25607
|
return __awaiter(this, void 0, void 0, function () {
|
|
25608
|
-
return __generator(this, function (
|
|
25609
|
-
switch (
|
|
25608
|
+
return __generator(this, function (_e) {
|
|
25609
|
+
switch (_e.label) {
|
|
25610
25610
|
case 0: return [4 /*yield*/, firstTruePromise(this.readySubject)];
|
|
25611
25611
|
case 1:
|
|
25612
|
-
|
|
25612
|
+
_e.sent();
|
|
25613
25613
|
return [2 /*return*/];
|
|
25614
25614
|
}
|
|
25615
25615
|
});
|
|
@@ -25617,11 +25617,11 @@
|
|
|
25617
25617
|
};
|
|
25618
25618
|
AppTable.prototype.waitIdle = function (opts) {
|
|
25619
25619
|
return __awaiter(this, void 0, void 0, function () {
|
|
25620
|
-
return __generator(this, function (
|
|
25621
|
-
switch (
|
|
25620
|
+
return __generator(this, function (_e) {
|
|
25621
|
+
switch (_e.label) {
|
|
25622
25622
|
case 0: return [4 /*yield*/, firstFalsePromise(this.loadingSubject)];
|
|
25623
25623
|
case 1:
|
|
25624
|
-
|
|
25624
|
+
_e.sent();
|
|
25625
25625
|
return [2 /*return*/];
|
|
25626
25626
|
}
|
|
25627
25627
|
});
|
|
@@ -25630,28 +25630,28 @@
|
|
|
25630
25630
|
AppTable.prototype.openSelectColumnsModal = function (event) {
|
|
25631
25631
|
return __awaiter(this, void 0, void 0, function () {
|
|
25632
25632
|
var columns, hasTopModal, modal, data, userColumns;
|
|
25633
|
-
return __generator(this, function (
|
|
25634
|
-
switch (
|
|
25633
|
+
return __generator(this, function (_e) {
|
|
25634
|
+
switch (_e.label) {
|
|
25635
25635
|
case 0:
|
|
25636
25636
|
columns = this.getCurrentColumns();
|
|
25637
25637
|
return [4 /*yield*/, this.modalCtrl.getTop()];
|
|
25638
25638
|
case 1:
|
|
25639
|
-
hasTopModal = !!(
|
|
25639
|
+
hasTopModal = !!(_e.sent());
|
|
25640
25640
|
return [4 /*yield*/, this.modalCtrl.create({
|
|
25641
25641
|
component: TableSelectColumnsComponent,
|
|
25642
25642
|
componentProps: { columns: columns },
|
|
25643
25643
|
cssClass: hasTopModal && 'stack-modal'
|
|
25644
25644
|
})];
|
|
25645
25645
|
case 2:
|
|
25646
|
-
modal =
|
|
25646
|
+
modal = _e.sent();
|
|
25647
25647
|
// Open the modal
|
|
25648
25648
|
return [4 /*yield*/, modal.present()];
|
|
25649
25649
|
case 3:
|
|
25650
25650
|
// Open the modal
|
|
25651
|
-
|
|
25651
|
+
_e.sent();
|
|
25652
25652
|
return [4 /*yield*/, modal.onDidDismiss()];
|
|
25653
25653
|
case 4:
|
|
25654
|
-
data = (
|
|
25654
|
+
data = (_e.sent()).data;
|
|
25655
25655
|
if (!data)
|
|
25656
25656
|
return [2 /*return*/]; // CANCELLED
|
|
25657
25657
|
userColumns = (data || []).filter(function (c) { return c.canHide === false || c.visible; }).map(function (c) { return c.name; }) || [];
|
|
@@ -25661,7 +25661,7 @@
|
|
|
25661
25661
|
return [4 /*yield*/, this.settings.savePageSetting(this.settingsId, userColumns, SETTINGS_DISPLAY_COLUMNS)];
|
|
25662
25662
|
case 5:
|
|
25663
25663
|
// Update user settings
|
|
25664
|
-
|
|
25664
|
+
_e.sent();
|
|
25665
25665
|
return [2 /*return*/];
|
|
25666
25666
|
}
|
|
25667
25667
|
});
|
|
@@ -25676,11 +25676,11 @@
|
|
|
25676
25676
|
// When target wait for a complete (e.g. IonRefresher)
|
|
25677
25677
|
if ((event === null || event === void 0 ? void 0 : event.target) && event.target.complete) {
|
|
25678
25678
|
setTimeout(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
25679
|
-
return __generator(this, function (
|
|
25680
|
-
switch (
|
|
25679
|
+
return __generator(this, function (_e) {
|
|
25680
|
+
switch (_e.label) {
|
|
25681
25681
|
case 0: return [4 /*yield*/, this.waitIdle()];
|
|
25682
25682
|
case 1:
|
|
25683
|
-
|
|
25683
|
+
_e.sent();
|
|
25684
25684
|
event.target.complete();
|
|
25685
25685
|
return [2 /*return*/];
|
|
25686
25686
|
}
|
|
@@ -25765,33 +25765,33 @@
|
|
|
25765
25765
|
AppTable.prototype.selectRowByIdOrData = function (id, data) {
|
|
25766
25766
|
return __awaiter(this, void 0, void 0, function () {
|
|
25767
25767
|
var done, err_3;
|
|
25768
|
-
return __generator(this, function (
|
|
25769
|
-
switch (
|
|
25768
|
+
return __generator(this, function (_e) {
|
|
25769
|
+
switch (_e.label) {
|
|
25770
25770
|
case 0:
|
|
25771
25771
|
done = false;
|
|
25772
|
-
|
|
25772
|
+
_e.label = 1;
|
|
25773
25773
|
case 1:
|
|
25774
|
-
|
|
25774
|
+
_e.trys.push([1, 6, , 7]);
|
|
25775
25775
|
if (!(isNotNil(id) || id !== -1)) return [3 /*break*/, 3];
|
|
25776
25776
|
return [4 /*yield*/, this.selectRowById(id)];
|
|
25777
25777
|
case 2:
|
|
25778
|
-
done =
|
|
25778
|
+
done = _e.sent();
|
|
25779
25779
|
if (done)
|
|
25780
25780
|
return [2 /*return*/, true];
|
|
25781
25781
|
console.warn('[app-table] Save: Cannot reselect row by row.id: ', id);
|
|
25782
|
-
|
|
25782
|
+
_e.label = 3;
|
|
25783
25783
|
case 3:
|
|
25784
25784
|
if (!data) return [3 /*break*/, 5];
|
|
25785
25785
|
return [4 /*yield*/, this.selectRowByData(data)];
|
|
25786
25786
|
case 4:
|
|
25787
|
-
done =
|
|
25787
|
+
done = _e.sent();
|
|
25788
25788
|
if (done)
|
|
25789
25789
|
return [2 /*return*/, true];
|
|
25790
25790
|
console.warn('[app-table] Save: Cannot reselect row by data: ', data);
|
|
25791
|
-
|
|
25791
|
+
_e.label = 5;
|
|
25792
25792
|
case 5: return [2 /*return*/, false];
|
|
25793
25793
|
case 6:
|
|
25794
|
-
err_3 =
|
|
25794
|
+
err_3 = _e.sent();
|
|
25795
25795
|
// Log, but continue
|
|
25796
25796
|
console.error(err_3 && err_3.message || err_3);
|
|
25797
25797
|
return [2 /*return*/, false];
|
|
@@ -25814,23 +25814,23 @@
|
|
|
25814
25814
|
AppTable.prototype.canDeleteRows = function (rows, opts) {
|
|
25815
25815
|
return __awaiter(this, void 0, void 0, function () {
|
|
25816
25816
|
var canDelete, err_4;
|
|
25817
|
-
return __generator(this, function (
|
|
25818
|
-
switch (
|
|
25817
|
+
return __generator(this, function (_e) {
|
|
25818
|
+
switch (_e.label) {
|
|
25819
25819
|
case 0:
|
|
25820
25820
|
if (!(this.onBeforeDeleteRows.observers.length > 0)) return [3 /*break*/, 4];
|
|
25821
|
-
|
|
25821
|
+
_e.label = 1;
|
|
25822
25822
|
case 1:
|
|
25823
|
-
|
|
25823
|
+
_e.trys.push([1, 3, , 4]);
|
|
25824
25824
|
return [4 /*yield*/, emitPromiseEvent(this.onBeforeDeleteRows, 'canDelete', {
|
|
25825
25825
|
detail: { rows: rows }
|
|
25826
25826
|
})];
|
|
25827
25827
|
case 2:
|
|
25828
|
-
canDelete =
|
|
25828
|
+
canDelete = _e.sent();
|
|
25829
25829
|
if (!canDelete)
|
|
25830
25830
|
return [2 /*return*/, false];
|
|
25831
25831
|
return [3 /*break*/, 4];
|
|
25832
25832
|
case 3:
|
|
25833
|
-
err_4 =
|
|
25833
|
+
err_4 = _e.sent();
|
|
25834
25834
|
if (err_4 === 'CANCELLED')
|
|
25835
25835
|
return [2 /*return*/, false]; // User cancel
|
|
25836
25836
|
console.error('Error while checking if can delete rows', err_4);
|
|
@@ -25847,35 +25847,35 @@
|
|
|
25847
25847
|
};
|
|
25848
25848
|
AppTable.prototype.canCancelRows = function (rows, opts) {
|
|
25849
25849
|
return __awaiter(this, void 0, void 0, function () {
|
|
25850
|
-
var
|
|
25851
|
-
return __generator(this, function (
|
|
25852
|
-
switch (
|
|
25850
|
+
var _e, isCancel, err_5;
|
|
25851
|
+
return __generator(this, function (_f) {
|
|
25852
|
+
switch (_f.label) {
|
|
25853
25853
|
case 0:
|
|
25854
|
-
|
|
25855
|
-
if (
|
|
25854
|
+
_e = rows;
|
|
25855
|
+
if (_e) return [3 /*break*/, 2];
|
|
25856
25856
|
return [4 /*yield*/, this.dataSource.getRows()];
|
|
25857
25857
|
case 1:
|
|
25858
|
-
|
|
25859
|
-
|
|
25858
|
+
_e = (_f.sent()).filter(function (row) { var _a; return (_a = row.validator) === null || _a === void 0 ? void 0 : _a.dirty; });
|
|
25859
|
+
_f.label = 2;
|
|
25860
25860
|
case 2:
|
|
25861
25861
|
// Get dirty rows
|
|
25862
|
-
rows =
|
|
25862
|
+
rows = _e;
|
|
25863
25863
|
if (isEmptyArray(rows))
|
|
25864
25864
|
return [2 /*return*/, true]; // No dirty: OK
|
|
25865
25865
|
if (!(this.onBeforeCancelRows.observers.length > 0)) return [3 /*break*/, 6];
|
|
25866
|
-
|
|
25866
|
+
_f.label = 3;
|
|
25867
25867
|
case 3:
|
|
25868
|
-
|
|
25868
|
+
_f.trys.push([3, 5, , 6]);
|
|
25869
25869
|
return [4 /*yield*/, emitPromiseEvent(this.onBeforeCancelRows, 'canCancel', {
|
|
25870
25870
|
detail: { rows: rows }
|
|
25871
25871
|
})];
|
|
25872
25872
|
case 4:
|
|
25873
|
-
isCancel =
|
|
25873
|
+
isCancel = _f.sent();
|
|
25874
25874
|
if (!isCancel)
|
|
25875
25875
|
return [2 /*return*/, false];
|
|
25876
25876
|
return [3 /*break*/, 6];
|
|
25877
25877
|
case 5:
|
|
25878
|
-
err_5 =
|
|
25878
|
+
err_5 = _f.sent();
|
|
25879
25879
|
if (err_5 === 'CANCELLED')
|
|
25880
25880
|
return [2 /*return*/, false]; // User cancel
|
|
25881
25881
|
console.error('Error while checking if can cancel rows', err_5);
|
|
@@ -25893,8 +25893,8 @@
|
|
|
25893
25893
|
AppTable.prototype.saveBeforeAction = function (saveAction) {
|
|
25894
25894
|
return __awaiter(this, void 0, void 0, function () {
|
|
25895
25895
|
var save, confirmed, res, err_6, saved;
|
|
25896
|
-
return __generator(this, function (
|
|
25897
|
-
switch (
|
|
25896
|
+
return __generator(this, function (_e) {
|
|
25897
|
+
switch (_e.label) {
|
|
25898
25898
|
case 0:
|
|
25899
25899
|
if (!this.dirty) {
|
|
25900
25900
|
// Continue without save
|
|
@@ -25916,19 +25916,19 @@
|
|
|
25916
25916
|
confirmed = true;
|
|
25917
25917
|
if (!save) return [3 /*break*/, 4];
|
|
25918
25918
|
if (!(this.onBeforeSave.observers.length > 0)) return [3 /*break*/, 4];
|
|
25919
|
-
|
|
25919
|
+
_e.label = 1;
|
|
25920
25920
|
case 1:
|
|
25921
|
-
|
|
25921
|
+
_e.trys.push([1, 3, , 4]);
|
|
25922
25922
|
return [4 /*yield*/, emitPromiseEvent(this.onBeforeSave, 'beforeSave', {
|
|
25923
25923
|
detail: { action: saveAction, valid: this.valid }
|
|
25924
25924
|
})];
|
|
25925
25925
|
case 2:
|
|
25926
|
-
res =
|
|
25926
|
+
res = _e.sent();
|
|
25927
25927
|
confirmed = res.confirmed;
|
|
25928
25928
|
save = res.save;
|
|
25929
25929
|
return [3 /*break*/, 4];
|
|
25930
25930
|
case 3:
|
|
25931
|
-
err_6 =
|
|
25931
|
+
err_6 = _e.sent();
|
|
25932
25932
|
if (err_6 === 'CANCELLED')
|
|
25933
25933
|
return [2 /*return*/, false]; // User cancel
|
|
25934
25934
|
console.error('Error while checking if can delete rows', err_6);
|
|
@@ -25938,7 +25938,7 @@
|
|
|
25938
25938
|
if (!save) return [3 /*break*/, 6];
|
|
25939
25939
|
return [4 /*yield*/, this.save()];
|
|
25940
25940
|
case 5:
|
|
25941
|
-
saved =
|
|
25941
|
+
saved = _e.sent();
|
|
25942
25942
|
this.markAsDirty(); // Restore dirty flag
|
|
25943
25943
|
return [2 /*return*/, saved];
|
|
25944
25944
|
case 6: return [2 /*return*/, true]; // No save but continue action
|
|
@@ -25956,8 +25956,8 @@
|
|
|
25956
25956
|
*/
|
|
25957
25957
|
AppTable.prototype.openRow = function (id, row) {
|
|
25958
25958
|
return __awaiter(this, void 0, void 0, function () {
|
|
25959
|
-
return __generator(this, function (
|
|
25960
|
-
switch (
|
|
25959
|
+
return __generator(this, function (_e) {
|
|
25960
|
+
switch (_e.label) {
|
|
25961
25961
|
case 0:
|
|
25962
25962
|
if (!this.allowRowDetail) return [3 /*break*/, 2];
|
|
25963
25963
|
if (this.debug && this.dirty) {
|
|
@@ -25976,7 +25976,7 @@
|
|
|
25976
25976
|
relativeTo: this.route,
|
|
25977
25977
|
queryParams: {}
|
|
25978
25978
|
})];
|
|
25979
|
-
case 1: return [2 /*return*/,
|
|
25979
|
+
case 1: return [2 /*return*/, _e.sent()];
|
|
25980
25980
|
case 2: return [2 /*return*/, false];
|
|
25981
25981
|
}
|
|
25982
25982
|
});
|
|
@@ -25984,8 +25984,8 @@
|
|
|
25984
25984
|
};
|
|
25985
25985
|
AppTable.prototype.openNewRowDetail = function (event) {
|
|
25986
25986
|
return __awaiter(this, void 0, void 0, function () {
|
|
25987
|
-
return __generator(this, function (
|
|
25988
|
-
switch (
|
|
25987
|
+
return __generator(this, function (_e) {
|
|
25988
|
+
switch (_e.label) {
|
|
25989
25989
|
case 0:
|
|
25990
25990
|
if (!this.allowRowDetail)
|
|
25991
25991
|
return [2 /*return*/, false];
|
|
@@ -25996,7 +25996,7 @@
|
|
|
25996
25996
|
return [4 /*yield*/, this.router.navigate(['new'], {
|
|
25997
25997
|
relativeTo: this.route
|
|
25998
25998
|
})];
|
|
25999
|
-
case 1: return [2 /*return*/,
|
|
25999
|
+
case 1: return [2 /*return*/, _e.sent()];
|
|
26000
26000
|
}
|
|
26001
26001
|
});
|
|
26002
26002
|
});
|
|
@@ -26074,13 +26074,13 @@
|
|
|
26074
26074
|
};
|
|
26075
26075
|
AppTable.prototype.addRowToTable = function (insertAt) {
|
|
26076
26076
|
return __awaiter(this, void 0, void 0, function () {
|
|
26077
|
-
return __generator(this, function (
|
|
26078
|
-
switch (
|
|
26077
|
+
return __generator(this, function (_e) {
|
|
26078
|
+
switch (_e.label) {
|
|
26079
26079
|
case 0:
|
|
26080
26080
|
this.focusFirstColumn = true;
|
|
26081
26081
|
return [4 /*yield*/, this._dataSource.asyncCreateNew(insertAt)];
|
|
26082
26082
|
case 1:
|
|
26083
|
-
|
|
26083
|
+
_e.sent();
|
|
26084
26084
|
this.editedRow = this._dataSource.getRow(-1);
|
|
26085
26085
|
// Emit start editing event
|
|
26086
26086
|
this.onStartEditingRow.emit(this.editedRow);
|
|
@@ -26144,7 +26144,7 @@
|
|
|
26144
26144
|
};
|
|
26145
26145
|
AppTable.prototype.askDeleteConfirmation = function (event, rows) {
|
|
26146
26146
|
return __awaiter(this, void 0, void 0, function () {
|
|
26147
|
-
return __generator(this, function (
|
|
26147
|
+
return __generator(this, function (_e) {
|
|
26148
26148
|
if (this.undoableDeletion) {
|
|
26149
26149
|
// Special message, for undoable deletion
|
|
26150
26150
|
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)];
|
|
@@ -26156,21 +26156,21 @@
|
|
|
26156
26156
|
};
|
|
26157
26157
|
AppTable.prototype.askCancelConfirmation = function (event, rows) {
|
|
26158
26158
|
return __awaiter(this, void 0, void 0, function () {
|
|
26159
|
-
return __generator(this, function (
|
|
26159
|
+
return __generator(this, function (_e) {
|
|
26160
26160
|
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)];
|
|
26161
26161
|
});
|
|
26162
26162
|
});
|
|
26163
26163
|
};
|
|
26164
26164
|
AppTable.prototype.askRestoreConfirmation = function (event) {
|
|
26165
26165
|
return __awaiter(this, void 0, void 0, function () {
|
|
26166
|
-
return __generator(this, function (
|
|
26166
|
+
return __generator(this, function (_e) {
|
|
26167
26167
|
return [2 /*return*/, Alerts.askActionConfirmation(this.alertCtrl, this.translate, false, event)];
|
|
26168
26168
|
});
|
|
26169
26169
|
});
|
|
26170
26170
|
};
|
|
26171
26171
|
AppTable.prototype.showToast = function (opts) {
|
|
26172
26172
|
return __awaiter(this, void 0, void 0, function () {
|
|
26173
|
-
return __generator(this, function (
|
|
26173
|
+
return __generator(this, function (_e) {
|
|
26174
26174
|
if (!this.toastController)
|
|
26175
26175
|
throw new Error('Missing toastController in component\'s constructor');
|
|
26176
26176
|
return [2 /*return*/, Toasts.show(this.toastController, this.translate, opts)];
|
|
@@ -26265,14 +26265,14 @@
|
|
|
26265
26265
|
AppTable.prototype.checkIfPristine = function (opts) {
|
|
26266
26266
|
return __awaiter(this, void 0, void 0, function () {
|
|
26267
26267
|
var rows, pristine;
|
|
26268
|
-
return __generator(this, function (
|
|
26269
|
-
switch (
|
|
26268
|
+
return __generator(this, function (_e) {
|
|
26269
|
+
switch (_e.label) {
|
|
26270
26270
|
case 0:
|
|
26271
26271
|
if (!this.dirty)
|
|
26272
26272
|
return [2 /*return*/]; // Already pristine
|
|
26273
26273
|
return [4 /*yield*/, this._dataSource.getRows()];
|
|
26274
26274
|
case 1:
|
|
26275
|
-
rows =
|
|
26275
|
+
rows = _e.sent();
|
|
26276
26276
|
pristine = (rows || []).findIndex(function (row) { var _a; return (_a = row.validator) === null || _a === void 0 ? void 0 : _a.dirty; }) === -1;
|
|
26277
26277
|
if (pristine)
|
|
26278
26278
|
this.markAsPristine(opts);
|