@sumaris-net/ngx-components 1.21.0 → 1.21.3
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 +143 -81
- 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 +3 -0
- package/esm2015/src/app/core/form/editor.class.js +62 -22
- package/esm2015/src/app/core/form/entity-editor-modal.class.js +14 -20
- package/esm2015/src/app/core/form/entity-editor.class.js +25 -22
- package/esm2015/src/app/core/form/form.class.js +7 -3
- package/esm2015/src/app/core/table/table.class.js +9 -5
- package/fesm2015/sumaris-net.ngx-components.js +107 -62
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/src/app/core/form/editor.class.d.ts +29 -12
- 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/form/form.class.d.ts +3 -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
|
|
@@ -20257,6 +20257,8 @@
|
|
|
20257
20257
|
* @param opts
|
|
20258
20258
|
*/
|
|
20259
20259
|
AppForm.prototype.ready = function (opts) {
|
|
20260
|
+
if (this.readySubject.value)
|
|
20261
|
+
return Promise.resolve();
|
|
20260
20262
|
return waitForTrue(this.readySubject, opts);
|
|
20261
20263
|
};
|
|
20262
20264
|
/**
|
|
@@ -20264,6 +20266,8 @@
|
|
|
20264
20266
|
* @param opts
|
|
20265
20267
|
*/
|
|
20266
20268
|
AppForm.prototype.waitIdle = function (opts) {
|
|
20269
|
+
if (!this.loadingSubject.value)
|
|
20270
|
+
return Promise.resolve();
|
|
20267
20271
|
return waitForFalse(this.loadingSubject, opts);
|
|
20268
20272
|
};
|
|
20269
20273
|
AppForm.prototype.updateValueAndValidity = function (opts) {
|
|
@@ -26153,6 +26157,9 @@
|
|
|
26153
26157
|
configurable: true
|
|
26154
26158
|
});
|
|
26155
26159
|
Object.defineProperty(AppTable.prototype, "loading$", {
|
|
26160
|
+
/**
|
|
26161
|
+
* @deprecated
|
|
26162
|
+
*/
|
|
26156
26163
|
get: function () {
|
|
26157
26164
|
return this.loadingSubject.asObservable();
|
|
26158
26165
|
},
|
|
@@ -26160,6 +26167,9 @@
|
|
|
26160
26167
|
configurable: true
|
|
26161
26168
|
});
|
|
26162
26169
|
Object.defineProperty(AppTable.prototype, "saving$", {
|
|
26170
|
+
/**
|
|
26171
|
+
* @deprecated
|
|
26172
|
+
*/
|
|
26163
26173
|
get: function () {
|
|
26164
26174
|
return this.savingSubject.asObservable();
|
|
26165
26175
|
},
|
|
@@ -26329,17 +26339,15 @@
|
|
|
26329
26339
|
if (this.savingSubject.value !== true) {
|
|
26330
26340
|
this.focusColumn = undefined; // unselect focus column
|
|
26331
26341
|
this.savingSubject.next(true);
|
|
26332
|
-
if (!opts || opts.emitEvent !== false)
|
|
26342
|
+
if (!opts || opts.emitEvent !== false)
|
|
26333
26343
|
this.markForCheck();
|
|
26334
|
-
}
|
|
26335
26344
|
}
|
|
26336
26345
|
};
|
|
26337
26346
|
AppTable.prototype.markAsSaved = function (opts) {
|
|
26338
26347
|
if (this.savingSubject.value !== false) {
|
|
26339
26348
|
this.savingSubject.next(false);
|
|
26340
|
-
if (!opts || opts.emitEvent !== false)
|
|
26349
|
+
if (!opts || opts.emitEvent !== false)
|
|
26341
26350
|
this.markForCheck();
|
|
26342
|
-
}
|
|
26343
26351
|
}
|
|
26344
26352
|
};
|
|
26345
26353
|
AppTable.prototype.markAsLoading = function (opts) {
|
|
@@ -27977,8 +27985,9 @@
|
|
|
27977
27985
|
this._subscription = new rxjs.Subscription();
|
|
27978
27986
|
this._enabled = false;
|
|
27979
27987
|
this._dirty = false;
|
|
27980
|
-
this.
|
|
27981
|
-
this.
|
|
27988
|
+
this.readySubject = new rxjs.BehaviorSubject(false);
|
|
27989
|
+
this.loadingSubject = new rxjs.BehaviorSubject(true);
|
|
27990
|
+
this.errorSubject = new rxjs.BehaviorSubject(undefined);
|
|
27982
27991
|
this.debug = false;
|
|
27983
27992
|
this.submitted = false;
|
|
27984
27993
|
this.toolbar = null;
|
|
@@ -27989,13 +27998,43 @@
|
|
|
27989
27998
|
* @deprecated
|
|
27990
27999
|
*/
|
|
27991
28000
|
get: function () {
|
|
27992
|
-
return this.
|
|
28001
|
+
return this.loadingSubject.value;
|
|
27993
28002
|
},
|
|
27994
28003
|
/**
|
|
27995
28004
|
* @deprecated
|
|
27996
28005
|
*/
|
|
27997
28006
|
set: function (value) {
|
|
27998
|
-
this.
|
|
28007
|
+
this.loadingSubject.next(value);
|
|
28008
|
+
},
|
|
28009
|
+
enumerable: false,
|
|
28010
|
+
configurable: true
|
|
28011
|
+
});
|
|
28012
|
+
Object.defineProperty(AppEditor.prototype, "_$ready", {
|
|
28013
|
+
/**
|
|
28014
|
+
* @deprecated
|
|
28015
|
+
*/
|
|
28016
|
+
get: function () {
|
|
28017
|
+
return this.readySubject;
|
|
28018
|
+
},
|
|
28019
|
+
enumerable: false,
|
|
28020
|
+
configurable: true
|
|
28021
|
+
});
|
|
28022
|
+
Object.defineProperty(AppEditor.prototype, "_$loading", {
|
|
28023
|
+
/**
|
|
28024
|
+
* @deprecated
|
|
28025
|
+
*/
|
|
28026
|
+
get: function () {
|
|
28027
|
+
return this.loadingSubject;
|
|
28028
|
+
},
|
|
28029
|
+
enumerable: false,
|
|
28030
|
+
configurable: true
|
|
28031
|
+
});
|
|
28032
|
+
Object.defineProperty(AppEditor.prototype, "error", {
|
|
28033
|
+
get: function () {
|
|
28034
|
+
return this.errorSubject.value;
|
|
28035
|
+
},
|
|
28036
|
+
set: function (error) {
|
|
28037
|
+
this.setError(error);
|
|
27999
28038
|
},
|
|
28000
28039
|
enumerable: false,
|
|
28001
28040
|
configurable: true
|
|
@@ -28052,7 +28091,7 @@
|
|
|
28052
28091
|
Object.defineProperty(AppEditor.prototype, "loading", {
|
|
28053
28092
|
get: function () {
|
|
28054
28093
|
var _a;
|
|
28055
|
-
return this.
|
|
28094
|
+
return this.loadingSubject.value || (((_a = this._children) === null || _a === void 0 ? void 0 : _a.findIndex(function (c) { return c.enabled && c.loading; })) !== -1) || false;
|
|
28056
28095
|
},
|
|
28057
28096
|
enumerable: false,
|
|
28058
28097
|
configurable: true
|
|
@@ -28096,10 +28135,9 @@
|
|
|
28096
28135
|
};
|
|
28097
28136
|
AppEditor.prototype.ngOnDestroy = function () {
|
|
28098
28137
|
this._subscription.unsubscribe();
|
|
28099
|
-
this.
|
|
28100
|
-
this.
|
|
28101
|
-
this.
|
|
28102
|
-
this._$loading.unsubscribe();
|
|
28138
|
+
this.readySubject.unsubscribe();
|
|
28139
|
+
this.loadingSubject.unsubscribe();
|
|
28140
|
+
this.errorSubject.unsubscribe();
|
|
28103
28141
|
};
|
|
28104
28142
|
AppEditor.prototype.addChildForm = function (form) {
|
|
28105
28143
|
if (!form)
|
|
@@ -28169,16 +28207,16 @@
|
|
|
28169
28207
|
this.markForCheck();
|
|
28170
28208
|
};
|
|
28171
28209
|
AppEditor.prototype.markAsLoading = function (opts) {
|
|
28172
|
-
if (!this.
|
|
28173
|
-
this.
|
|
28210
|
+
if (!this.loadingSubject.value) {
|
|
28211
|
+
this.loadingSubject.next(true);
|
|
28174
28212
|
if (!opts || opts.emitEvent !== false)
|
|
28175
28213
|
this.markForCheck();
|
|
28176
28214
|
}
|
|
28177
28215
|
};
|
|
28178
28216
|
AppEditor.prototype.markAsLoaded = function (opts) {
|
|
28179
28217
|
var _a;
|
|
28180
|
-
if (this.
|
|
28181
|
-
this.
|
|
28218
|
+
if (this.loadingSubject.value) {
|
|
28219
|
+
this.loadingSubject.next(false);
|
|
28182
28220
|
if (!opts || opts.onlySelf !== true) {
|
|
28183
28221
|
// Emit to children forms
|
|
28184
28222
|
// Tables should be changed by parent
|
|
@@ -28192,19 +28230,17 @@
|
|
|
28192
28230
|
AppEditor.prototype.markAsReady = function (opts) {
|
|
28193
28231
|
var _a;
|
|
28194
28232
|
(_a = this._children) === null || _a === void 0 ? void 0 : _a.forEach(function (c) { return c.markAsReady(opts); });
|
|
28195
|
-
this.
|
|
28233
|
+
this.readySubject.next(true);
|
|
28196
28234
|
};
|
|
28197
28235
|
AppEditor.prototype.ready = function (opts) {
|
|
28198
|
-
|
|
28199
|
-
return
|
|
28200
|
-
|
|
28201
|
-
return [2 /*return*/];
|
|
28202
|
-
return [2 /*return*/, waitForTrue(this._$ready, opts)];
|
|
28203
|
-
});
|
|
28204
|
-
});
|
|
28236
|
+
if (this.readySubject.value)
|
|
28237
|
+
return Promise.resolve();
|
|
28238
|
+
return waitForTrue(this.readySubject, opts);
|
|
28205
28239
|
};
|
|
28206
28240
|
AppEditor.prototype.waitIdle = function (opts) {
|
|
28207
|
-
|
|
28241
|
+
if (!this.loadingSubject.value)
|
|
28242
|
+
return Promise.resolve();
|
|
28243
|
+
return waitForFalse(this.loadingSubject, opts);
|
|
28208
28244
|
};
|
|
28209
28245
|
AppEditor.prototype.cancel = function (event) {
|
|
28210
28246
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -28460,6 +28496,16 @@
|
|
|
28460
28496
|
console.warn(prefix + " Unknown children sub-form: ", c);
|
|
28461
28497
|
}
|
|
28462
28498
|
};
|
|
28499
|
+
AppEditor.prototype.setError = function (value, opts) {
|
|
28500
|
+
if (this.errorSubject.value !== value) {
|
|
28501
|
+
this.errorSubject.next(value);
|
|
28502
|
+
if (!opts || opts.emitEvent !== false)
|
|
28503
|
+
this.markForCheck();
|
|
28504
|
+
}
|
|
28505
|
+
};
|
|
28506
|
+
AppEditor.prototype.resetError = function (opts) {
|
|
28507
|
+
this.setError(undefined, opts);
|
|
28508
|
+
};
|
|
28463
28509
|
AppEditor.prototype.markForCheck = function () {
|
|
28464
28510
|
// Should be override by subclasses, if change detection is Push
|
|
28465
28511
|
};
|
|
@@ -28532,6 +28578,8 @@
|
|
|
28532
28578
|
AppTabEditor.prototype.ngOnDestroy = function () {
|
|
28533
28579
|
_super_1.prototype.ngOnDestroy.call(this);
|
|
28534
28580
|
this.selectedTabIndexChange.complete();
|
|
28581
|
+
this.loadingSubject.unsubscribe();
|
|
28582
|
+
this.errorSubject.unsubscribe();
|
|
28535
28583
|
};
|
|
28536
28584
|
AppTabEditor.prototype.setSelectedTabIndex = function (value, opts) {
|
|
28537
28585
|
var _this = this;
|
|
@@ -28637,6 +28685,22 @@
|
|
|
28637
28685
|
});
|
|
28638
28686
|
});
|
|
28639
28687
|
};
|
|
28688
|
+
AppTabEditor.prototype.saveDirtyTables = function () {
|
|
28689
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
28690
|
+
var results, saved;
|
|
28691
|
+
return __generator(this, function (_b) {
|
|
28692
|
+
switch (_b.label) {
|
|
28693
|
+
case 0: return [4 /*yield*/, Promise.all((this.tables || [])
|
|
28694
|
+
.filter(function (c) { return c.dirty; })
|
|
28695
|
+
.map(function (c) { return c.save(); }))];
|
|
28696
|
+
case 1:
|
|
28697
|
+
results = _b.sent();
|
|
28698
|
+
saved = results.findIndex(function (result) { return result !== true; }) === -1;
|
|
28699
|
+
return [2 /*return*/, saved];
|
|
28700
|
+
}
|
|
28701
|
+
});
|
|
28702
|
+
});
|
|
28703
|
+
};
|
|
28640
28704
|
return AppTabEditor;
|
|
28641
28705
|
}(AppEditor));
|
|
28642
28706
|
AppTabEditor.decorators = [
|
|
@@ -28673,7 +28737,7 @@
|
|
|
28673
28737
|
_this = _super.call(this, injector.get(i3.ActivatedRoute), injector.get(i3.Router), injector.get(i1$5.AlertController), injector.get(i1$2.TranslateService), options) || this;
|
|
28674
28738
|
_this.dataType = dataType;
|
|
28675
28739
|
_this.dataService = dataService;
|
|
28676
|
-
_this.
|
|
28740
|
+
_this.savingSubject = new rxjs.BehaviorSubject(false);
|
|
28677
28741
|
_this.$title = new rxjs.Subject();
|
|
28678
28742
|
_this.onUpdateView = new i0.EventEmitter();
|
|
28679
28743
|
_this.environement = injector.get(ENVIRONMENT);
|
|
@@ -28731,7 +28795,14 @@
|
|
|
28731
28795
|
});
|
|
28732
28796
|
Object.defineProperty(AppEntityEditor.prototype, "loading", {
|
|
28733
28797
|
get: function () {
|
|
28734
|
-
return this.
|
|
28798
|
+
return this.loadingSubject.value;
|
|
28799
|
+
},
|
|
28800
|
+
enumerable: false,
|
|
28801
|
+
configurable: true
|
|
28802
|
+
});
|
|
28803
|
+
Object.defineProperty(AppEntityEditor.prototype, "saving", {
|
|
28804
|
+
get: function () {
|
|
28805
|
+
return this.savingSubject.value;
|
|
28735
28806
|
},
|
|
28736
28807
|
enumerable: false,
|
|
28737
28808
|
configurable: true
|
|
@@ -28744,15 +28815,15 @@
|
|
|
28744
28815
|
configurable: true
|
|
28745
28816
|
});
|
|
28746
28817
|
AppEntityEditor.prototype.markAsSaving = function (opts) {
|
|
28747
|
-
if (
|
|
28748
|
-
this.
|
|
28818
|
+
if (this.savingSubject.value !== true) {
|
|
28819
|
+
this.savingSubject.next(true);
|
|
28749
28820
|
if (!opts || opts.emitEvent !== false)
|
|
28750
28821
|
this.markForCheck();
|
|
28751
28822
|
}
|
|
28752
28823
|
};
|
|
28753
28824
|
AppEntityEditor.prototype.markAsSaved = function (opts) {
|
|
28754
|
-
if (this.
|
|
28755
|
-
this.
|
|
28825
|
+
if (this.savingSubject.value !== false) {
|
|
28826
|
+
this.savingSubject.next(false);
|
|
28756
28827
|
if (!opts || opts.emitEvent !== false)
|
|
28757
28828
|
this.markForCheck();
|
|
28758
28829
|
}
|
|
@@ -28782,12 +28853,12 @@
|
|
|
28782
28853
|
this.$title.unsubscribe();
|
|
28783
28854
|
this.onUpdateView.complete();
|
|
28784
28855
|
this.onUpdateView.unsubscribe();
|
|
28856
|
+
this.savingSubject.unsubscribe();
|
|
28785
28857
|
};
|
|
28786
28858
|
AppEntityEditor.prototype.waitIdle = function (opts) {
|
|
28787
|
-
var _this = this;
|
|
28788
28859
|
// Wait end of saving
|
|
28789
28860
|
if (this.saving)
|
|
28790
|
-
return
|
|
28861
|
+
return waitForFalse(this.savingSubject);
|
|
28791
28862
|
return _super.prototype.waitIdle.call(this, opts);
|
|
28792
28863
|
};
|
|
28793
28864
|
/**
|
|
@@ -29074,7 +29145,7 @@
|
|
|
29074
29145
|
*/
|
|
29075
29146
|
AppEntityEditor.prototype.save = function (event, opts) {
|
|
29076
29147
|
return __awaiter(this, void 0, void 0, function () {
|
|
29077
|
-
var nextTabIndex, data, updatedData, err_3;
|
|
29148
|
+
var nextTabIndex, saved, data, updatedData, err_3;
|
|
29078
29149
|
return __generator(this, function (_c) {
|
|
29079
29150
|
switch (_c.label) {
|
|
29080
29151
|
case 0:
|
|
@@ -29093,9 +29164,10 @@
|
|
|
29093
29164
|
_c.sent();
|
|
29094
29165
|
// If invalid
|
|
29095
29166
|
if (this.invalid) {
|
|
29096
|
-
this.markAllAsTouched();
|
|
29097
29167
|
this.logFormErrors();
|
|
29098
29168
|
this.openFirstInvalidTab();
|
|
29169
|
+
this.scrollToTop();
|
|
29170
|
+
this.markAllAsTouched();
|
|
29099
29171
|
this.submitted = true;
|
|
29100
29172
|
return [2 /*return*/, false];
|
|
29101
29173
|
}
|
|
@@ -29105,24 +29177,29 @@
|
|
|
29105
29177
|
console.debug('[data-editor] Saving data...');
|
|
29106
29178
|
_c.label = 2;
|
|
29107
29179
|
case 2:
|
|
29108
|
-
_c.trys.push([2,
|
|
29180
|
+
_c.trys.push([2, 8, 9, 10]);
|
|
29109
29181
|
nextTabIndex = this._autoOpenNextTab && isNil(this.previousDataId) && this.computeNextTabIndex();
|
|
29110
|
-
return [4 /*yield*/, this.
|
|
29182
|
+
return [4 /*yield*/, this.saveDirtyTables()];
|
|
29111
29183
|
case 3:
|
|
29184
|
+
saved = _c.sent();
|
|
29185
|
+
if (!saved)
|
|
29186
|
+
return [2 /*return*/, false];
|
|
29187
|
+
return [4 /*yield*/, this.getValue()];
|
|
29188
|
+
case 4:
|
|
29112
29189
|
data = _c.sent();
|
|
29113
29190
|
this.disable();
|
|
29114
29191
|
return [4 /*yield*/, this.dataService.save(data, opts)];
|
|
29115
|
-
case
|
|
29192
|
+
case 5:
|
|
29116
29193
|
updatedData = _c.sent();
|
|
29117
29194
|
return [4 /*yield*/, this.onEntitySaved(updatedData)];
|
|
29118
|
-
case
|
|
29195
|
+
case 6:
|
|
29119
29196
|
_c.sent();
|
|
29120
29197
|
// Update the view (e.g metadata)
|
|
29121
29198
|
return [4 /*yield*/, this.updateView(updatedData, Object.assign({
|
|
29122
29199
|
// Open next tab only if user has not changed it
|
|
29123
29200
|
openTabIndex: nextTabIndex > this._selectedTabIndex ? nextTabIndex : undefined
|
|
29124
29201
|
}, opts))];
|
|
29125
|
-
case
|
|
29202
|
+
case 7:
|
|
29126
29203
|
// Update the view (e.g metadata)
|
|
29127
29204
|
_c.sent();
|
|
29128
29205
|
// Subscribe to remote changes
|
|
@@ -29130,7 +29207,7 @@
|
|
|
29130
29207
|
this.startListenRemoteChanges();
|
|
29131
29208
|
this.submitted = false;
|
|
29132
29209
|
return [2 /*return*/, true];
|
|
29133
|
-
case
|
|
29210
|
+
case 8:
|
|
29134
29211
|
err_3 = _c.sent();
|
|
29135
29212
|
this.submitted = true;
|
|
29136
29213
|
this.setError(err_3);
|
|
@@ -29146,10 +29223,10 @@
|
|
|
29146
29223
|
});
|
|
29147
29224
|
}
|
|
29148
29225
|
return [2 /*return*/, false];
|
|
29149
|
-
case
|
|
29226
|
+
case 9:
|
|
29150
29227
|
this.markAsSaved();
|
|
29151
29228
|
return [7 /*endfinally*/];
|
|
29152
|
-
case
|
|
29229
|
+
case 10: return [2 /*return*/];
|
|
29153
29230
|
}
|
|
29154
29231
|
});
|
|
29155
29232
|
});
|
|
@@ -29268,7 +29345,7 @@
|
|
|
29268
29345
|
this.registerForms();
|
|
29269
29346
|
this._dirty = false;
|
|
29270
29347
|
this.data = null;
|
|
29271
|
-
this.
|
|
29348
|
+
this.savingSubject.next(false);
|
|
29272
29349
|
return [2 /*return*/];
|
|
29273
29350
|
});
|
|
29274
29351
|
});
|
|
@@ -29293,19 +29370,15 @@
|
|
|
29293
29370
|
});
|
|
29294
29371
|
};
|
|
29295
29372
|
AppEntityEditor.prototype.resetError = function (opts) {
|
|
29296
|
-
|
|
29297
|
-
this.error = null;
|
|
29298
|
-
if (!opts || opts.emitEvent !== false)
|
|
29299
|
-
this.markForCheck();
|
|
29300
|
-
}
|
|
29373
|
+
_super.prototype.resetError.call(this, opts);
|
|
29301
29374
|
};
|
|
29302
29375
|
AppEntityEditor.prototype.setError = function (err, opts) {
|
|
29303
29376
|
if (!err) {
|
|
29304
|
-
this
|
|
29377
|
+
_super.prototype.setError.call(this, undefined, opts);
|
|
29305
29378
|
}
|
|
29306
29379
|
else if (typeof err === 'string') {
|
|
29307
29380
|
console.error('[entity-editor] Error: ' + (err || ''));
|
|
29308
|
-
this
|
|
29381
|
+
_super.prototype.setError.call(this, err, opts);
|
|
29309
29382
|
}
|
|
29310
29383
|
else {
|
|
29311
29384
|
console.error('[entity-editor] Error: ' + err.message || '', err);
|
|
@@ -29320,10 +29393,8 @@
|
|
|
29320
29393
|
userMessage += detailMessage.length < 70 ? detailMessage : detailMessage.substring(0, 67) + '...';
|
|
29321
29394
|
userMessage += '</small>';
|
|
29322
29395
|
}
|
|
29323
|
-
this
|
|
29396
|
+
_super.prototype.setError.call(this, userMessage, opts);
|
|
29324
29397
|
}
|
|
29325
|
-
if (!opts || opts.emitEvent !== false)
|
|
29326
|
-
this.markForCheck();
|
|
29327
29398
|
};
|
|
29328
29399
|
/* -- protected methods -- */
|
|
29329
29400
|
/**
|
|
@@ -29531,7 +29602,7 @@
|
|
|
29531
29602
|
function AppEntityEditorModal(injector, dataType, options) {
|
|
29532
29603
|
var _this = _super_1.call(this, null, injector.get(i3.Router), injector.get(i1$5.AlertController), injector.get(i1$2.TranslateService), options) || this;
|
|
29533
29604
|
_this.dataType = dataType;
|
|
29534
|
-
_this.
|
|
29605
|
+
_this.savingSubject = new rxjs.BehaviorSubject(false);
|
|
29535
29606
|
_this.$title = new rxjs.Subject();
|
|
29536
29607
|
_this.i18nSuffix = null;
|
|
29537
29608
|
_this.environement = injector.get(ENVIRONMENT);
|
|
@@ -29581,16 +29652,23 @@
|
|
|
29581
29652
|
enumerable: false,
|
|
29582
29653
|
configurable: true
|
|
29583
29654
|
});
|
|
29655
|
+
Object.defineProperty(AppEntityEditorModal.prototype, "saving", {
|
|
29656
|
+
get: function () {
|
|
29657
|
+
return this.savingSubject.value;
|
|
29658
|
+
},
|
|
29659
|
+
enumerable: false,
|
|
29660
|
+
configurable: true
|
|
29661
|
+
});
|
|
29584
29662
|
AppEntityEditorModal.prototype.markAsSaving = function (opts) {
|
|
29585
|
-
if (
|
|
29586
|
-
this.
|
|
29663
|
+
if (this.savingSubject.value !== true) {
|
|
29664
|
+
this.savingSubject.next(true);
|
|
29587
29665
|
if (!opts || opts.emitEvent !== false)
|
|
29588
29666
|
this.markForCheck();
|
|
29589
29667
|
}
|
|
29590
29668
|
};
|
|
29591
29669
|
AppEntityEditorModal.prototype.markAsSaved = function (opts) {
|
|
29592
|
-
if (this.
|
|
29593
|
-
this.
|
|
29670
|
+
if (this.savingSubject.value !== false) {
|
|
29671
|
+
this.savingSubject.next(false);
|
|
29594
29672
|
if (!opts || opts.emitEvent !== false)
|
|
29595
29673
|
this.markForCheck();
|
|
29596
29674
|
}
|
|
@@ -29639,12 +29717,12 @@
|
|
|
29639
29717
|
_super_1.prototype.ngOnDestroy.call(this);
|
|
29640
29718
|
this.$title.complete();
|
|
29641
29719
|
this.$title.unsubscribe();
|
|
29720
|
+
this.savingSubject.unsubscribe();
|
|
29642
29721
|
};
|
|
29643
29722
|
AppEntityEditorModal.prototype.waitIdle = function (opts) {
|
|
29644
|
-
var _this = this;
|
|
29645
29723
|
// Wait end of saving
|
|
29646
29724
|
if (this.saving)
|
|
29647
|
-
return
|
|
29725
|
+
return waitForFalse(this.savingSubject);
|
|
29648
29726
|
return _super_1.prototype.waitIdle.call(this, opts);
|
|
29649
29727
|
};
|
|
29650
29728
|
AppEntityEditorModal.prototype.load = function () {
|
|
@@ -29794,9 +29872,9 @@
|
|
|
29794
29872
|
if (this.invalid) {
|
|
29795
29873
|
this.logFormErrors();
|
|
29796
29874
|
this.setError('COMMON.FORM.HAS_ERROR');
|
|
29797
|
-
this.markAllAsTouched();
|
|
29798
29875
|
this.openFirstInvalidTab();
|
|
29799
29876
|
this.scrollToTop();
|
|
29877
|
+
this.markAllAsTouched();
|
|
29800
29878
|
this.submitted = true;
|
|
29801
29879
|
return [2 /*return*/, false];
|
|
29802
29880
|
}
|
|
@@ -29957,22 +30035,6 @@
|
|
|
29957
30035
|
this.markForCheck();
|
|
29958
30036
|
};
|
|
29959
30037
|
/* -- protected methods -- */
|
|
29960
|
-
AppEntityEditorModal.prototype.saveDirtyTables = function () {
|
|
29961
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
29962
|
-
var results, saved;
|
|
29963
|
-
return __generator(this, function (_b) {
|
|
29964
|
-
switch (_b.label) {
|
|
29965
|
-
case 0: return [4 /*yield*/, Promise.all((this.tables || [])
|
|
29966
|
-
.filter(function (c) { return c.dirty; })
|
|
29967
|
-
.map(function (c) { return c.save(); }))];
|
|
29968
|
-
case 1:
|
|
29969
|
-
results = _b.sent();
|
|
29970
|
-
saved = results.findIndex(function (result) { return result !== true; }) === -1;
|
|
29971
|
-
return [2 /*return*/, saved];
|
|
29972
|
-
}
|
|
29973
|
-
});
|
|
29974
|
-
});
|
|
29975
|
-
};
|
|
29976
30038
|
AppEntityEditorModal.prototype.waitWhilePending = function (opts) {
|
|
29977
30039
|
return AppFormUtils.waitWhilePending(this, opts);
|
|
29978
30040
|
};
|