@sumaris-net/ngx-components 1.23.4 → 1.23.7
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 +28 -24
- 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/doc/changelog.md +5 -0
- package/esm2015/src/app/core/form/editor.class.js +6 -3
- package/esm2015/src/app/core/form/form.class.js +5 -2
- package/esm2015/src/app/core/table/entities-table-datasource.class.js +5 -5
- package/esm2015/src/app/core/table/table.class.js +19 -18
- package/fesm2015/sumaris-net.ngx-components.js +28 -21
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/src/app/core/form/editor.class.d.ts +2 -1
- package/src/app/core/form/form.class.d.ts +2 -1
- package/src/app/core/table/table.class.d.ts +1 -1
- package/sumaris-net.ngx-components.metadata.json +1 -1
|
@@ -20036,6 +20036,7 @@
|
|
|
20036
20036
|
this._subscription = new rxjs.Subscription();
|
|
20037
20037
|
this._enable = false;
|
|
20038
20038
|
this.i18nFieldPrefix = null;
|
|
20039
|
+
this.destroySubject = new rxjs.Subject();
|
|
20039
20040
|
this.readySubject = new rxjs.BehaviorSubject(false);
|
|
20040
20041
|
this.loadingSubject = new rxjs.BehaviorSubject(true);
|
|
20041
20042
|
this.errorSubject = new rxjs.BehaviorSubject(undefined);
|
|
@@ -20221,6 +20222,8 @@
|
|
|
20221
20222
|
this.errorSubject.unsubscribe();
|
|
20222
20223
|
this.onCancel.unsubscribe();
|
|
20223
20224
|
this.onSubmit.unsubscribe();
|
|
20225
|
+
this.destroySubject.next();
|
|
20226
|
+
this.destroySubject.unsubscribe();
|
|
20224
20227
|
};
|
|
20225
20228
|
AppForm.prototype.cancel = function () {
|
|
20226
20229
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -26102,11 +26105,11 @@
|
|
|
26102
26105
|
case 2:
|
|
26103
26106
|
// Call service deletion
|
|
26104
26107
|
_b.sent();
|
|
26105
|
-
rowNotDeleted = this.getRows().filter(rows.includes);
|
|
26108
|
+
rowNotDeleted = this.getRows().filter(function (row) { return rows.includes(row); });
|
|
26106
26109
|
if (isNotEmptyArray(rowNotDeleted)) {
|
|
26107
|
-
console.warn("[table-datasource] Force deletion of " + rowNotDeleted.length + " rows
|
|
26110
|
+
console.warn("[table-datasource] Force deletion of " + rowNotDeleted.length + " rows! Please check that data service update the cache, after deletion");
|
|
26108
26111
|
rowNotDeleted
|
|
26109
|
-
// Start
|
|
26112
|
+
// Start at the end
|
|
26110
26113
|
.sort(function (a, b) { return a.id > b.id ? -1 : 1; })
|
|
26111
26114
|
.forEach(function (r) { return _super.delete.call(_this, r.id); });
|
|
26112
26115
|
}
|
|
@@ -26264,8 +26267,8 @@
|
|
|
26264
26267
|
this._subscription = new rxjs.Subscription();
|
|
26265
26268
|
this._cellValueChangesDefs = {};
|
|
26266
26269
|
this._enabled = true;
|
|
26267
|
-
this._destroy$ = new rxjs.Subject();
|
|
26268
26270
|
this.allowRowDetail = true;
|
|
26271
|
+
this.destroySubject = new rxjs.Subject();
|
|
26269
26272
|
this.excludesColumns = [];
|
|
26270
26273
|
this.totalRowCount = null;
|
|
26271
26274
|
this.readySubject = new rxjs.BehaviorSubject(false);
|
|
@@ -26649,7 +26652,7 @@
|
|
|
26649
26652
|
// Stop if next another row, or destroying
|
|
26650
26653
|
rxjs.combineLatest([
|
|
26651
26654
|
_this.onStartEditingRow,
|
|
26652
|
-
_this.
|
|
26655
|
+
_this.destroySubject
|
|
26653
26656
|
])
|
|
26654
26657
|
// DEBUG
|
|
26655
26658
|
//.pipe(
|
|
@@ -26752,8 +26755,8 @@
|
|
|
26752
26755
|
this.onSort.unsubscribe();
|
|
26753
26756
|
this.onDirty.unsubscribe();
|
|
26754
26757
|
this.onError.unsubscribe();
|
|
26755
|
-
this.
|
|
26756
|
-
this.
|
|
26758
|
+
this.destroySubject.next();
|
|
26759
|
+
this.destroySubject.unsubscribe();
|
|
26757
26760
|
(_a = this._dataSource) === null || _a === void 0 ? void 0 : _a.ngOnDestroy();
|
|
26758
26761
|
};
|
|
26759
26762
|
AppTable.prototype.updateView = function (res, opts) {
|
|
@@ -26904,7 +26907,6 @@
|
|
|
26904
26907
|
// Stop event
|
|
26905
26908
|
event === null || event === void 0 ? void 0 : event.stopPropagation();
|
|
26906
26909
|
// Confirmation edition or creation
|
|
26907
|
-
//const confirmed = this.dataSource.confirmEditCreate(row);
|
|
26908
26910
|
var confirmed = row.confirmEditCreate();
|
|
26909
26911
|
if (confirmed) {
|
|
26910
26912
|
// If edit finished, forget edited row
|
|
@@ -27141,7 +27143,7 @@
|
|
|
27141
27143
|
AppTable.prototype.deleteRows = function (event, rows, opts) {
|
|
27142
27144
|
var _a;
|
|
27143
27145
|
return __awaiter(this, void 0, void 0, function () {
|
|
27144
|
-
var confirmed, canDelete,
|
|
27146
|
+
var confirmed, canDelete, tempRows, deletedRows, saved, err_2;
|
|
27145
27147
|
var _this = this;
|
|
27146
27148
|
return __generator(this, function (_e) {
|
|
27147
27149
|
switch (_e.label) {
|
|
@@ -27169,20 +27171,21 @@
|
|
|
27169
27171
|
canDelete = _e.sent();
|
|
27170
27172
|
if (!canDelete)
|
|
27171
27173
|
return [2 /*return*/, 0]; // Cannot delete
|
|
27172
|
-
|
|
27173
|
-
// This is a workaround, need because row.delete() has async execution
|
|
27174
|
-
// and index cache is updated with a delay
|
|
27175
|
-
rows = rows.slice()
|
|
27174
|
+
tempRows = rows.slice()
|
|
27176
27175
|
.sort(function (a, b) { return a.id > b.id ? -1 : 1; });
|
|
27176
|
+
deletedRows = [];
|
|
27177
27177
|
if (!this.saveBeforeDelete) return [3 /*break*/, 3];
|
|
27178
27178
|
// Exclude invalid rows (because of save() will fail, when exists some invalid rows)
|
|
27179
|
-
|
|
27179
|
+
tempRows = tempRows.filter(function (row) {
|
|
27180
27180
|
// Delete the row, if newly created row (id = -1), or if invalid and not editing (= not cancellable)
|
|
27181
27181
|
if (row.id === -1 || (!row.valid && !row.editing)) {
|
|
27182
|
+
if (_this.debug)
|
|
27183
|
+
console.debug("[table] Delete row #" + row.id);
|
|
27182
27184
|
row.delete();
|
|
27183
27185
|
_this.visibleRowCount--;
|
|
27184
27186
|
_this.totalRowCount--;
|
|
27185
|
-
|
|
27187
|
+
deletedRows.push(row);
|
|
27188
|
+
return false; // Exclude from the list to delete using the service
|
|
27186
27189
|
}
|
|
27187
27190
|
// Cancel the row (and mark as pristine), when not valid but in edition
|
|
27188
27191
|
else if (!row.valid && row.editing) {
|
|
@@ -27193,7 +27196,7 @@
|
|
|
27193
27196
|
}
|
|
27194
27197
|
return true;
|
|
27195
27198
|
});
|
|
27196
|
-
if (!
|
|
27199
|
+
if (!(deletedRows.length || tempRows.length)) return [3 /*break*/, 3];
|
|
27197
27200
|
return [4 /*yield*/, this.saveBeforeAction('delete')];
|
|
27198
27201
|
case 2:
|
|
27199
27202
|
saved = _e.sent();
|
|
@@ -27204,11 +27207,10 @@
|
|
|
27204
27207
|
_e.label = 3;
|
|
27205
27208
|
case 3:
|
|
27206
27209
|
_e.trys.push([3, 6, , 7]);
|
|
27207
|
-
|
|
27208
|
-
if (!deleteCount) return [3 /*break*/, 5];
|
|
27210
|
+
if (!tempRows.length) return [3 /*break*/, 5];
|
|
27209
27211
|
if (this.debug)
|
|
27210
|
-
console.debug(
|
|
27211
|
-
return [4 /*yield*/, this._dataSource.deleteAll(
|
|
27212
|
+
console.debug("[table] Delete " + tempRows.length + " rows...");
|
|
27213
|
+
return [4 /*yield*/, this._dataSource.deleteAll(tempRows)];
|
|
27212
27214
|
case 4:
|
|
27213
27215
|
_e.sent();
|
|
27214
27216
|
_e.label = 5;
|
|
@@ -27220,9 +27222,8 @@
|
|
|
27220
27222
|
this.editedRow = undefined;
|
|
27221
27223
|
this.markAsDirty({ emitEvent: false /*markForCheck() is called just after*/ });
|
|
27222
27224
|
this.markForCheck();
|
|
27223
|
-
|
|
27224
|
-
|
|
27225
|
-
return [2 /*return*/, deleteCount];
|
|
27225
|
+
this.onAfterDeletedRows.next(rows);
|
|
27226
|
+
return [2 /*return*/, rows.length];
|
|
27226
27227
|
case 6:
|
|
27227
27228
|
err_2 = _e.sent();
|
|
27228
27229
|
this.setError(err_2 && err_2.message || err_2);
|
|
@@ -28163,6 +28164,7 @@
|
|
|
28163
28164
|
this._subscription = new rxjs.Subscription();
|
|
28164
28165
|
this._enabled = false;
|
|
28165
28166
|
this._dirty = false;
|
|
28167
|
+
this.destroySubject = new rxjs.Subject();
|
|
28166
28168
|
this.readySubject = new rxjs.BehaviorSubject(false);
|
|
28167
28169
|
this.loadingSubject = new rxjs.BehaviorSubject(true);
|
|
28168
28170
|
this.errorSubject = new rxjs.BehaviorSubject(undefined);
|
|
@@ -28312,13 +28314,15 @@
|
|
|
28312
28314
|
}
|
|
28313
28315
|
};
|
|
28314
28316
|
AppEditor.prototype.ngAfterViewInit = function () {
|
|
28315
|
-
// Can be
|
|
28317
|
+
// Can be overridden by subclasses
|
|
28316
28318
|
};
|
|
28317
28319
|
AppEditor.prototype.ngOnDestroy = function () {
|
|
28318
28320
|
this._subscription.unsubscribe();
|
|
28319
28321
|
this.readySubject.unsubscribe();
|
|
28320
28322
|
this.loadingSubject.unsubscribe();
|
|
28321
28323
|
this.errorSubject.unsubscribe();
|
|
28324
|
+
this.destroySubject.next();
|
|
28325
|
+
this.destroySubject.unsubscribe();
|
|
28322
28326
|
};
|
|
28323
28327
|
AppEditor.prototype.addChildForm = function (form) {
|
|
28324
28328
|
if (!form)
|