@sumaris-net/ngx-components 1.21.1 → 1.21.2
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 +76 -50
- 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/form/editor.class.js +14 -2
- package/esm2015/src/app/core/form/entity-editor-modal.class.js +14 -20
- package/esm2015/src/app/core/form/entity-editor.class.js +21 -12
- package/esm2015/src/app/core/form/form.class.js +3 -3
- package/esm2015/src/app/core/table/table.class.js +9 -5
- package/fesm2015/sumaris-net.ngx-components.js +52 -33
- 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/entity-editor-modal.class.d.ts +4 -4
- package/src/app/core/form/entity-editor.class.d.ts +4 -3
- package/src/app/core/table/table.class.d.ts +6 -0
- package/sumaris-net.ngx-components.metadata.json +1 -1
|
@@ -19962,13 +19962,13 @@
|
|
|
19962
19962
|
* @deprecated
|
|
19963
19963
|
*/
|
|
19964
19964
|
get: function () {
|
|
19965
|
-
return this.
|
|
19965
|
+
return this.loadingSubject.value;
|
|
19966
19966
|
},
|
|
19967
19967
|
/**
|
|
19968
19968
|
* @deprecated
|
|
19969
19969
|
*/
|
|
19970
19970
|
set: function (value) {
|
|
19971
|
-
this.
|
|
19971
|
+
this.loadingSubject.next(value);
|
|
19972
19972
|
},
|
|
19973
19973
|
enumerable: false,
|
|
19974
19974
|
configurable: true
|
|
@@ -26157,6 +26157,9 @@
|
|
|
26157
26157
|
configurable: true
|
|
26158
26158
|
});
|
|
26159
26159
|
Object.defineProperty(AppTable.prototype, "loading$", {
|
|
26160
|
+
/**
|
|
26161
|
+
* @deprecated
|
|
26162
|
+
*/
|
|
26160
26163
|
get: function () {
|
|
26161
26164
|
return this.loadingSubject.asObservable();
|
|
26162
26165
|
},
|
|
@@ -26164,6 +26167,9 @@
|
|
|
26164
26167
|
configurable: true
|
|
26165
26168
|
});
|
|
26166
26169
|
Object.defineProperty(AppTable.prototype, "saving$", {
|
|
26170
|
+
/**
|
|
26171
|
+
* @deprecated
|
|
26172
|
+
*/
|
|
26167
26173
|
get: function () {
|
|
26168
26174
|
return this.savingSubject.asObservable();
|
|
26169
26175
|
},
|
|
@@ -26333,17 +26339,15 @@
|
|
|
26333
26339
|
if (this.savingSubject.value !== true) {
|
|
26334
26340
|
this.focusColumn = undefined; // unselect focus column
|
|
26335
26341
|
this.savingSubject.next(true);
|
|
26336
|
-
if (!opts || opts.emitEvent !== false)
|
|
26342
|
+
if (!opts || opts.emitEvent !== false)
|
|
26337
26343
|
this.markForCheck();
|
|
26338
|
-
}
|
|
26339
26344
|
}
|
|
26340
26345
|
};
|
|
26341
26346
|
AppTable.prototype.markAsSaved = function (opts) {
|
|
26342
26347
|
if (this.savingSubject.value !== false) {
|
|
26343
26348
|
this.savingSubject.next(false);
|
|
26344
|
-
if (!opts || opts.emitEvent !== false)
|
|
26349
|
+
if (!opts || opts.emitEvent !== false)
|
|
26345
26350
|
this.markForCheck();
|
|
26346
|
-
}
|
|
26347
26351
|
}
|
|
26348
26352
|
};
|
|
26349
26353
|
AppTable.prototype.markAsLoading = function (opts) {
|
|
@@ -28000,7 +28004,7 @@
|
|
|
28000
28004
|
* @deprecated
|
|
28001
28005
|
*/
|
|
28002
28006
|
set: function (value) {
|
|
28003
|
-
this.
|
|
28007
|
+
this.loadingSubject.next(value);
|
|
28004
28008
|
},
|
|
28005
28009
|
enumerable: false,
|
|
28006
28010
|
configurable: true
|
|
@@ -28572,6 +28576,8 @@
|
|
|
28572
28576
|
AppTabEditor.prototype.ngOnDestroy = function () {
|
|
28573
28577
|
_super_1.prototype.ngOnDestroy.call(this);
|
|
28574
28578
|
this.selectedTabIndexChange.complete();
|
|
28579
|
+
this.loadingSubject.unsubscribe();
|
|
28580
|
+
this.errorSubject.unsubscribe();
|
|
28575
28581
|
};
|
|
28576
28582
|
AppTabEditor.prototype.setSelectedTabIndex = function (value, opts) {
|
|
28577
28583
|
var _this = this;
|
|
@@ -28677,6 +28683,22 @@
|
|
|
28677
28683
|
});
|
|
28678
28684
|
});
|
|
28679
28685
|
};
|
|
28686
|
+
AppTabEditor.prototype.saveDirtyTables = function () {
|
|
28687
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
28688
|
+
var results, saved;
|
|
28689
|
+
return __generator(this, function (_b) {
|
|
28690
|
+
switch (_b.label) {
|
|
28691
|
+
case 0: return [4 /*yield*/, Promise.all((this.tables || [])
|
|
28692
|
+
.filter(function (c) { return c.dirty; })
|
|
28693
|
+
.map(function (c) { return c.save(); }))];
|
|
28694
|
+
case 1:
|
|
28695
|
+
results = _b.sent();
|
|
28696
|
+
saved = results.findIndex(function (result) { return result !== true; }) === -1;
|
|
28697
|
+
return [2 /*return*/, saved];
|
|
28698
|
+
}
|
|
28699
|
+
});
|
|
28700
|
+
});
|
|
28701
|
+
};
|
|
28680
28702
|
return AppTabEditor;
|
|
28681
28703
|
}(AppEditor));
|
|
28682
28704
|
AppTabEditor.decorators = [
|
|
@@ -28713,7 +28735,7 @@
|
|
|
28713
28735
|
_this = _super.call(this, injector.get(i3.ActivatedRoute), injector.get(i3.Router), injector.get(i1$5.AlertController), injector.get(i1$2.TranslateService), options) || this;
|
|
28714
28736
|
_this.dataType = dataType;
|
|
28715
28737
|
_this.dataService = dataService;
|
|
28716
|
-
_this.
|
|
28738
|
+
_this.savingSubject = new rxjs.BehaviorSubject(false);
|
|
28717
28739
|
_this.$title = new rxjs.Subject();
|
|
28718
28740
|
_this.onUpdateView = new i0.EventEmitter();
|
|
28719
28741
|
_this.environement = injector.get(ENVIRONMENT);
|
|
@@ -28771,7 +28793,14 @@
|
|
|
28771
28793
|
});
|
|
28772
28794
|
Object.defineProperty(AppEntityEditor.prototype, "loading", {
|
|
28773
28795
|
get: function () {
|
|
28774
|
-
return this.
|
|
28796
|
+
return this.loadingSubject.value;
|
|
28797
|
+
},
|
|
28798
|
+
enumerable: false,
|
|
28799
|
+
configurable: true
|
|
28800
|
+
});
|
|
28801
|
+
Object.defineProperty(AppEntityEditor.prototype, "saving", {
|
|
28802
|
+
get: function () {
|
|
28803
|
+
return this.savingSubject.value;
|
|
28775
28804
|
},
|
|
28776
28805
|
enumerable: false,
|
|
28777
28806
|
configurable: true
|
|
@@ -28784,15 +28813,15 @@
|
|
|
28784
28813
|
configurable: true
|
|
28785
28814
|
});
|
|
28786
28815
|
AppEntityEditor.prototype.markAsSaving = function (opts) {
|
|
28787
|
-
if (
|
|
28788
|
-
this.
|
|
28816
|
+
if (this.savingSubject.value !== true) {
|
|
28817
|
+
this.savingSubject.next(true);
|
|
28789
28818
|
if (!opts || opts.emitEvent !== false)
|
|
28790
28819
|
this.markForCheck();
|
|
28791
28820
|
}
|
|
28792
28821
|
};
|
|
28793
28822
|
AppEntityEditor.prototype.markAsSaved = function (opts) {
|
|
28794
|
-
if (this.
|
|
28795
|
-
this.
|
|
28823
|
+
if (this.savingSubject.value !== false) {
|
|
28824
|
+
this.savingSubject.next(false);
|
|
28796
28825
|
if (!opts || opts.emitEvent !== false)
|
|
28797
28826
|
this.markForCheck();
|
|
28798
28827
|
}
|
|
@@ -28822,12 +28851,12 @@
|
|
|
28822
28851
|
this.$title.unsubscribe();
|
|
28823
28852
|
this.onUpdateView.complete();
|
|
28824
28853
|
this.onUpdateView.unsubscribe();
|
|
28854
|
+
this.savingSubject.unsubscribe();
|
|
28825
28855
|
};
|
|
28826
28856
|
AppEntityEditor.prototype.waitIdle = function (opts) {
|
|
28827
|
-
var _this = this;
|
|
28828
28857
|
// Wait end of saving
|
|
28829
28858
|
if (this.saving)
|
|
28830
|
-
return
|
|
28859
|
+
return waitForFalse(this.savingSubject);
|
|
28831
28860
|
return _super.prototype.waitIdle.call(this, opts);
|
|
28832
28861
|
};
|
|
28833
28862
|
/**
|
|
@@ -29114,7 +29143,7 @@
|
|
|
29114
29143
|
*/
|
|
29115
29144
|
AppEntityEditor.prototype.save = function (event, opts) {
|
|
29116
29145
|
return __awaiter(this, void 0, void 0, function () {
|
|
29117
|
-
var nextTabIndex, data, updatedData, err_3;
|
|
29146
|
+
var nextTabIndex, saved, data, updatedData, err_3;
|
|
29118
29147
|
return __generator(this, function (_c) {
|
|
29119
29148
|
switch (_c.label) {
|
|
29120
29149
|
case 0:
|
|
@@ -29133,9 +29162,10 @@
|
|
|
29133
29162
|
_c.sent();
|
|
29134
29163
|
// If invalid
|
|
29135
29164
|
if (this.invalid) {
|
|
29136
|
-
this.markAllAsTouched();
|
|
29137
29165
|
this.logFormErrors();
|
|
29138
29166
|
this.openFirstInvalidTab();
|
|
29167
|
+
this.scrollToTop();
|
|
29168
|
+
this.markAllAsTouched();
|
|
29139
29169
|
this.submitted = true;
|
|
29140
29170
|
return [2 /*return*/, false];
|
|
29141
29171
|
}
|
|
@@ -29145,24 +29175,29 @@
|
|
|
29145
29175
|
console.debug('[data-editor] Saving data...');
|
|
29146
29176
|
_c.label = 2;
|
|
29147
29177
|
case 2:
|
|
29148
|
-
_c.trys.push([2,
|
|
29178
|
+
_c.trys.push([2, 8, 9, 10]);
|
|
29149
29179
|
nextTabIndex = this._autoOpenNextTab && isNil(this.previousDataId) && this.computeNextTabIndex();
|
|
29150
|
-
return [4 /*yield*/, this.
|
|
29180
|
+
return [4 /*yield*/, this.saveDirtyTables()];
|
|
29151
29181
|
case 3:
|
|
29182
|
+
saved = _c.sent();
|
|
29183
|
+
if (!saved)
|
|
29184
|
+
return [2 /*return*/, false];
|
|
29185
|
+
return [4 /*yield*/, this.getValue()];
|
|
29186
|
+
case 4:
|
|
29152
29187
|
data = _c.sent();
|
|
29153
29188
|
this.disable();
|
|
29154
29189
|
return [4 /*yield*/, this.dataService.save(data, opts)];
|
|
29155
|
-
case
|
|
29190
|
+
case 5:
|
|
29156
29191
|
updatedData = _c.sent();
|
|
29157
29192
|
return [4 /*yield*/, this.onEntitySaved(updatedData)];
|
|
29158
|
-
case
|
|
29193
|
+
case 6:
|
|
29159
29194
|
_c.sent();
|
|
29160
29195
|
// Update the view (e.g metadata)
|
|
29161
29196
|
return [4 /*yield*/, this.updateView(updatedData, Object.assign({
|
|
29162
29197
|
// Open next tab only if user has not changed it
|
|
29163
29198
|
openTabIndex: nextTabIndex > this._selectedTabIndex ? nextTabIndex : undefined
|
|
29164
29199
|
}, opts))];
|
|
29165
|
-
case
|
|
29200
|
+
case 7:
|
|
29166
29201
|
// Update the view (e.g metadata)
|
|
29167
29202
|
_c.sent();
|
|
29168
29203
|
// Subscribe to remote changes
|
|
@@ -29170,7 +29205,7 @@
|
|
|
29170
29205
|
this.startListenRemoteChanges();
|
|
29171
29206
|
this.submitted = false;
|
|
29172
29207
|
return [2 /*return*/, true];
|
|
29173
|
-
case
|
|
29208
|
+
case 8:
|
|
29174
29209
|
err_3 = _c.sent();
|
|
29175
29210
|
this.submitted = true;
|
|
29176
29211
|
this.setError(err_3);
|
|
@@ -29186,10 +29221,10 @@
|
|
|
29186
29221
|
});
|
|
29187
29222
|
}
|
|
29188
29223
|
return [2 /*return*/, false];
|
|
29189
|
-
case
|
|
29224
|
+
case 9:
|
|
29190
29225
|
this.markAsSaved();
|
|
29191
29226
|
return [7 /*endfinally*/];
|
|
29192
|
-
case
|
|
29227
|
+
case 10: return [2 /*return*/];
|
|
29193
29228
|
}
|
|
29194
29229
|
});
|
|
29195
29230
|
});
|
|
@@ -29308,7 +29343,7 @@
|
|
|
29308
29343
|
this.registerForms();
|
|
29309
29344
|
this._dirty = false;
|
|
29310
29345
|
this.data = null;
|
|
29311
|
-
this.
|
|
29346
|
+
this.savingSubject.next(false);
|
|
29312
29347
|
return [2 /*return*/];
|
|
29313
29348
|
});
|
|
29314
29349
|
});
|
|
@@ -29571,7 +29606,7 @@
|
|
|
29571
29606
|
function AppEntityEditorModal(injector, dataType, options) {
|
|
29572
29607
|
var _this = _super_1.call(this, null, injector.get(i3.Router), injector.get(i1$5.AlertController), injector.get(i1$2.TranslateService), options) || this;
|
|
29573
29608
|
_this.dataType = dataType;
|
|
29574
|
-
_this.
|
|
29609
|
+
_this.savingSubject = new rxjs.BehaviorSubject(false);
|
|
29575
29610
|
_this.$title = new rxjs.Subject();
|
|
29576
29611
|
_this.i18nSuffix = null;
|
|
29577
29612
|
_this.environement = injector.get(ENVIRONMENT);
|
|
@@ -29621,16 +29656,23 @@
|
|
|
29621
29656
|
enumerable: false,
|
|
29622
29657
|
configurable: true
|
|
29623
29658
|
});
|
|
29659
|
+
Object.defineProperty(AppEntityEditorModal.prototype, "saving", {
|
|
29660
|
+
get: function () {
|
|
29661
|
+
return this.savingSubject.value;
|
|
29662
|
+
},
|
|
29663
|
+
enumerable: false,
|
|
29664
|
+
configurable: true
|
|
29665
|
+
});
|
|
29624
29666
|
AppEntityEditorModal.prototype.markAsSaving = function (opts) {
|
|
29625
|
-
if (
|
|
29626
|
-
this.
|
|
29667
|
+
if (this.savingSubject.value !== true) {
|
|
29668
|
+
this.savingSubject.next(true);
|
|
29627
29669
|
if (!opts || opts.emitEvent !== false)
|
|
29628
29670
|
this.markForCheck();
|
|
29629
29671
|
}
|
|
29630
29672
|
};
|
|
29631
29673
|
AppEntityEditorModal.prototype.markAsSaved = function (opts) {
|
|
29632
|
-
if (this.
|
|
29633
|
-
this.
|
|
29674
|
+
if (this.savingSubject.value !== false) {
|
|
29675
|
+
this.savingSubject.next(false);
|
|
29634
29676
|
if (!opts || opts.emitEvent !== false)
|
|
29635
29677
|
this.markForCheck();
|
|
29636
29678
|
}
|
|
@@ -29679,12 +29721,12 @@
|
|
|
29679
29721
|
_super_1.prototype.ngOnDestroy.call(this);
|
|
29680
29722
|
this.$title.complete();
|
|
29681
29723
|
this.$title.unsubscribe();
|
|
29724
|
+
this.savingSubject.unsubscribe();
|
|
29682
29725
|
};
|
|
29683
29726
|
AppEntityEditorModal.prototype.waitIdle = function (opts) {
|
|
29684
|
-
var _this = this;
|
|
29685
29727
|
// Wait end of saving
|
|
29686
29728
|
if (this.saving)
|
|
29687
|
-
return
|
|
29729
|
+
return waitForFalse(this.savingSubject);
|
|
29688
29730
|
return _super_1.prototype.waitIdle.call(this, opts);
|
|
29689
29731
|
};
|
|
29690
29732
|
AppEntityEditorModal.prototype.load = function () {
|
|
@@ -29834,9 +29876,9 @@
|
|
|
29834
29876
|
if (this.invalid) {
|
|
29835
29877
|
this.logFormErrors();
|
|
29836
29878
|
this.setError('COMMON.FORM.HAS_ERROR');
|
|
29837
|
-
this.markAllAsTouched();
|
|
29838
29879
|
this.openFirstInvalidTab();
|
|
29839
29880
|
this.scrollToTop();
|
|
29881
|
+
this.markAllAsTouched();
|
|
29840
29882
|
this.submitted = true;
|
|
29841
29883
|
return [2 /*return*/, false];
|
|
29842
29884
|
}
|
|
@@ -29997,22 +30039,6 @@
|
|
|
29997
30039
|
this.markForCheck();
|
|
29998
30040
|
};
|
|
29999
30041
|
/* -- protected methods -- */
|
|
30000
|
-
AppEntityEditorModal.prototype.saveDirtyTables = function () {
|
|
30001
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
30002
|
-
var results, saved;
|
|
30003
|
-
return __generator(this, function (_b) {
|
|
30004
|
-
switch (_b.label) {
|
|
30005
|
-
case 0: return [4 /*yield*/, Promise.all((this.tables || [])
|
|
30006
|
-
.filter(function (c) { return c.dirty; })
|
|
30007
|
-
.map(function (c) { return c.save(); }))];
|
|
30008
|
-
case 1:
|
|
30009
|
-
results = _b.sent();
|
|
30010
|
-
saved = results.findIndex(function (result) { return result !== true; }) === -1;
|
|
30011
|
-
return [2 /*return*/, saved];
|
|
30012
|
-
}
|
|
30013
|
-
});
|
|
30014
|
-
});
|
|
30015
|
-
};
|
|
30016
30042
|
AppEntityEditorModal.prototype.waitWhilePending = function (opts) {
|
|
30017
30043
|
return AppFormUtils.waitWhilePending(this, opts);
|
|
30018
30044
|
};
|