@sumaris-net/ngx-components 1.23.24 → 1.23.25
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 +91 -72
- 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/form/editor.class.js +58 -16
- package/esm2015/src/app/core/form/entity-editor.class.js +9 -29
- package/fesm2015/sumaris-net.ngx-components.js +64 -42
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/src/app/core/form/editor.class.d.ts +11 -3
- package/src/app/core/form/entity-editor.class.d.ts +4 -11
- package/sumaris-net.ngx-components.metadata.json +1 -1
|
@@ -28430,11 +28430,12 @@
|
|
|
28430
28430
|
this.translate = translate;
|
|
28431
28431
|
this._subscription = new rxjs.Subscription();
|
|
28432
28432
|
this._enabled = false;
|
|
28433
|
-
this._dirty = false;
|
|
28434
28433
|
this.destroySubject = new rxjs.Subject();
|
|
28435
28434
|
this.readySubject = new rxjs.BehaviorSubject(false);
|
|
28435
|
+
this.dirtySubject = new rxjs.BehaviorSubject(false);
|
|
28436
28436
|
this.loadingSubject = new rxjs.BehaviorSubject(true);
|
|
28437
28437
|
this.errorSubject = new rxjs.BehaviorSubject(undefined);
|
|
28438
|
+
this.savingSubject = new rxjs.BehaviorSubject(false);
|
|
28438
28439
|
this.debug = false;
|
|
28439
28440
|
this.submitted = false;
|
|
28440
28441
|
this.toolbar = null;
|
|
@@ -28486,6 +28487,14 @@
|
|
|
28486
28487
|
enumerable: false,
|
|
28487
28488
|
configurable: true
|
|
28488
28489
|
});
|
|
28490
|
+
Object.defineProperty(AppEditor.prototype, "saving", {
|
|
28491
|
+
get: function () {
|
|
28492
|
+
var _a;
|
|
28493
|
+
return this.savingSubject.value || ((_a = this.editors) === null || _a === void 0 ? void 0 : _a.some(function (e) { return e.saving; }));
|
|
28494
|
+
},
|
|
28495
|
+
enumerable: false,
|
|
28496
|
+
configurable: true
|
|
28497
|
+
});
|
|
28489
28498
|
Object.defineProperty(AppEditor.prototype, "tables", {
|
|
28490
28499
|
get: function () {
|
|
28491
28500
|
return this._children && this._children.filter(function (c) { return c instanceof AppTable; });
|
|
@@ -28509,7 +28518,7 @@
|
|
|
28509
28518
|
});
|
|
28510
28519
|
Object.defineProperty(AppEditor.prototype, "dirty", {
|
|
28511
28520
|
get: function () {
|
|
28512
|
-
return this.
|
|
28521
|
+
return this.dirtySubject.value || (this._children && this._children.findIndex(function (c) { return c.enabled && c.dirty; }) !== -1) || false;
|
|
28513
28522
|
},
|
|
28514
28523
|
enumerable: false,
|
|
28515
28524
|
configurable: true
|
|
@@ -28569,7 +28578,7 @@
|
|
|
28569
28578
|
});
|
|
28570
28579
|
Object.defineProperty(AppEditor.prototype, "empty", {
|
|
28571
28580
|
get: function () {
|
|
28572
|
-
return this._enabled;
|
|
28581
|
+
return !this._enabled;
|
|
28573
28582
|
},
|
|
28574
28583
|
enumerable: false,
|
|
28575
28584
|
configurable: true
|
|
@@ -28634,7 +28643,9 @@
|
|
|
28634
28643
|
var _a;
|
|
28635
28644
|
this.error = null;
|
|
28636
28645
|
this.submitted = false;
|
|
28637
|
-
this.
|
|
28646
|
+
if (this.dirtySubject.value !== false) {
|
|
28647
|
+
this.dirtySubject.next(false);
|
|
28648
|
+
}
|
|
28638
28649
|
(_a = this._children) === null || _a === void 0 ? void 0 : _a.forEach(function (c) { return c.markAsPristine(opts); });
|
|
28639
28650
|
if (!this.loading && (!opts || opts.emitEvent !== false))
|
|
28640
28651
|
this.markForCheck();
|
|
@@ -28662,9 +28673,11 @@
|
|
|
28662
28673
|
this.markForCheck();
|
|
28663
28674
|
};
|
|
28664
28675
|
AppEditor.prototype.markAsDirty = function (opts) {
|
|
28665
|
-
this.
|
|
28666
|
-
|
|
28667
|
-
this.
|
|
28676
|
+
if (!this.dirtySubject.value) {
|
|
28677
|
+
this.dirtySubject.next(true);
|
|
28678
|
+
if (!this.loading && (!opts || opts.emitEvent !== false))
|
|
28679
|
+
this.markForCheck();
|
|
28680
|
+
}
|
|
28668
28681
|
};
|
|
28669
28682
|
AppEditor.prototype.markAsLoading = function (opts) {
|
|
28670
28683
|
if (!this.loadingSubject.value) {
|
|
@@ -28703,6 +28716,20 @@
|
|
|
28703
28716
|
return Promise.resolve();
|
|
28704
28717
|
return waitForFalse(this.loadingSubject, opts);
|
|
28705
28718
|
};
|
|
28719
|
+
AppEditor.prototype.markAsSaving = function (opts) {
|
|
28720
|
+
if (this.savingSubject.value !== true) {
|
|
28721
|
+
this.savingSubject.next(true);
|
|
28722
|
+
if (!opts || opts.emitEvent !== false)
|
|
28723
|
+
this.markForCheck();
|
|
28724
|
+
}
|
|
28725
|
+
};
|
|
28726
|
+
AppEditor.prototype.markAsSaved = function (opts) {
|
|
28727
|
+
if (this.savingSubject.value !== false) {
|
|
28728
|
+
this.savingSubject.next(false);
|
|
28729
|
+
if (!opts || opts.emitEvent !== false)
|
|
28730
|
+
this.markForCheck();
|
|
28731
|
+
}
|
|
28732
|
+
};
|
|
28706
28733
|
AppEditor.prototype.cancel = function (event) {
|
|
28707
28734
|
return __awaiter(this, void 0, void 0, function () {
|
|
28708
28735
|
return __generator(this, function (_c) {
|
|
@@ -28733,7 +28760,7 @@
|
|
|
28733
28760
|
var _a;
|
|
28734
28761
|
return __awaiter(this, void 0, void 0, function () {
|
|
28735
28762
|
return __generator(this, function (_c) {
|
|
28736
|
-
console.debug('[
|
|
28763
|
+
console.debug('[editor] Unloading data...');
|
|
28737
28764
|
this.markAsLoading();
|
|
28738
28765
|
(_a = this._children) === null || _a === void 0 ? void 0 : _a.forEach(function (f) {
|
|
28739
28766
|
if (f instanceof AppForm) {
|
|
@@ -28742,7 +28769,12 @@
|
|
|
28742
28769
|
else if (f instanceof AppTable) {
|
|
28743
28770
|
f.dataSource.disconnect();
|
|
28744
28771
|
}
|
|
28772
|
+
else if (f instanceof AppEditor) {
|
|
28773
|
+
f.unload(opts);
|
|
28774
|
+
}
|
|
28745
28775
|
});
|
|
28776
|
+
this.markAsPristine(opts);
|
|
28777
|
+
this.markAsSaved(opts);
|
|
28746
28778
|
return [2 /*return*/];
|
|
28747
28779
|
});
|
|
28748
28780
|
});
|
|
@@ -28811,12 +28843,12 @@
|
|
|
28811
28843
|
});
|
|
28812
28844
|
});
|
|
28813
28845
|
};
|
|
28814
|
-
AppEditor.prototype.logFormErrors = function () {
|
|
28846
|
+
AppEditor.prototype.logFormErrors = function (prefix) {
|
|
28815
28847
|
var _this = this;
|
|
28816
28848
|
var _a;
|
|
28817
28849
|
if (this.debug)
|
|
28818
|
-
console.debug('[
|
|
28819
|
-
(_a = this._children) === null || _a === void 0 ? void 0 : _a.forEach(function (c) { return _this.
|
|
28850
|
+
console.debug('[editor] Editor not valid. Checking where (forms, tables)...');
|
|
28851
|
+
(_a = this._children) === null || _a === void 0 ? void 0 : _a.forEach(function (c) { return _this.logChildrenErrors(c, prefix); });
|
|
28820
28852
|
};
|
|
28821
28853
|
/* -- protected methods -- */
|
|
28822
28854
|
AppEditor.prototype.scrollToTop = function (duration) {
|
|
@@ -28918,7 +28950,7 @@
|
|
|
28918
28950
|
});
|
|
28919
28951
|
});
|
|
28920
28952
|
};
|
|
28921
|
-
AppEditor.prototype.
|
|
28953
|
+
AppEditor.prototype.logChildrenErrors = function (c, prefix, path) {
|
|
28922
28954
|
var _this = this;
|
|
28923
28955
|
prefix = prefix || '[app-tab-editor] ';
|
|
28924
28956
|
// If editor
|
|
@@ -28932,7 +28964,7 @@
|
|
|
28932
28964
|
// If form provider: get delegate
|
|
28933
28965
|
else if (c instanceof AppFormProvider) {
|
|
28934
28966
|
if (!c.empty && !c.valid) {
|
|
28935
|
-
c.waitDelegate({ timeout: 1000 }).then(function (delegate) { return _this.
|
|
28967
|
+
c.waitDelegate({ timeout: 1000 }).then(function (delegate) { return _this.logChildrenErrors(delegate, prefix, 'provider'); });
|
|
28936
28968
|
}
|
|
28937
28969
|
}
|
|
28938
28970
|
// If table
|
|
@@ -28942,20 +28974,34 @@
|
|
|
28942
28974
|
AppFormUtils.logFormErrors(c.editedRow.validator, prefix, path_1);
|
|
28943
28975
|
}
|
|
28944
28976
|
}
|
|
28945
|
-
// If
|
|
28977
|
+
// If form
|
|
28946
28978
|
else if (c instanceof AppForm) {
|
|
28947
28979
|
if (!c.empty && !c.valid) {
|
|
28948
28980
|
if (c.pending) {
|
|
28949
28981
|
var path_2 = c.constructor.name.toLowerCase();
|
|
28950
28982
|
console.warn(prefix + " -> " + path_2 + ": waiting while pending...");
|
|
28951
28983
|
AppFormUtils.waitWhilePending(c, { timeout: 1000 })
|
|
28952
|
-
.then(function () { return _this.
|
|
28984
|
+
.then(function () { return _this.logChildrenErrors(c.form, prefix, path_2); });
|
|
28953
28985
|
}
|
|
28954
28986
|
else {
|
|
28955
28987
|
AppFormUtils.logFormErrors(c.form, prefix);
|
|
28956
28988
|
}
|
|
28957
28989
|
}
|
|
28958
28990
|
}
|
|
28991
|
+
// If editor
|
|
28992
|
+
else if (c instanceof AppEditor) {
|
|
28993
|
+
if (!c.empty && !c.valid) {
|
|
28994
|
+
if (c.pending) {
|
|
28995
|
+
var path_3 = c.constructor.name.toLowerCase();
|
|
28996
|
+
console.warn(prefix + " -> " + path_3 + ": waiting while pending...");
|
|
28997
|
+
AppFormUtils.waitWhilePending(c, { timeout: 1000 })
|
|
28998
|
+
.then(function () { return c.logFormErrors(prefix); });
|
|
28999
|
+
}
|
|
29000
|
+
else {
|
|
29001
|
+
c.logFormErrors(prefix);
|
|
29002
|
+
}
|
|
29003
|
+
}
|
|
29004
|
+
}
|
|
28959
29005
|
else {
|
|
28960
29006
|
console.warn(prefix + " Unknown children sub-form: ", c);
|
|
28961
29007
|
}
|
|
@@ -29182,24 +29228,23 @@
|
|
|
29182
29228
|
tabGroup: [{ type: i0.ViewChild, args: ['tabGroup', { static: true },] }]
|
|
29183
29229
|
};
|
|
29184
29230
|
|
|
29185
|
-
var AppEditorOptions = /** @class */ (function (
|
|
29186
|
-
__extends(AppEditorOptions,
|
|
29231
|
+
var AppEditorOptions = /** @class */ (function (_super_1) {
|
|
29232
|
+
__extends(AppEditorOptions, _super_1);
|
|
29187
29233
|
function AppEditorOptions() {
|
|
29188
|
-
return
|
|
29234
|
+
return _super_1 !== null && _super_1.apply(this, arguments) || this;
|
|
29189
29235
|
}
|
|
29190
29236
|
return AppEditorOptions;
|
|
29191
29237
|
}(AppTabEditorOptions));
|
|
29192
29238
|
// @dynamic
|
|
29193
29239
|
// eslint-disable-next-line @angular-eslint/directive-class-suffix
|
|
29194
|
-
var AppEntityEditor = /** @class */ (function (
|
|
29195
|
-
__extends(AppEntityEditor,
|
|
29240
|
+
var AppEntityEditor = /** @class */ (function (_super_1) {
|
|
29241
|
+
__extends(AppEntityEditor, _super_1);
|
|
29196
29242
|
function AppEntityEditor(injector, dataType, dataService, options) {
|
|
29197
29243
|
var _this = this;
|
|
29198
29244
|
var _a, _b;
|
|
29199
|
-
_this =
|
|
29245
|
+
_this = _super_1.call(this, injector.get(i3.ActivatedRoute), injector.get(i3.Router), injector.get(i1$5.AlertController), injector.get(i1$2.TranslateService), options) || this;
|
|
29200
29246
|
_this.dataType = dataType;
|
|
29201
29247
|
_this.dataService = dataService;
|
|
29202
|
-
_this.savingSubject = new rxjs.BehaviorSubject(false);
|
|
29203
29248
|
_this.$title = new rxjs.Subject();
|
|
29204
29249
|
_this.onUpdateView = new i0.EventEmitter();
|
|
29205
29250
|
_this.environment = injector.get(ENVIRONMENT);
|
|
@@ -29255,20 +29300,6 @@
|
|
|
29255
29300
|
enumerable: false,
|
|
29256
29301
|
configurable: true
|
|
29257
29302
|
});
|
|
29258
|
-
Object.defineProperty(AppEntityEditor.prototype, "loading", {
|
|
29259
|
-
get: function () {
|
|
29260
|
-
return this.loadingSubject.value;
|
|
29261
|
-
},
|
|
29262
|
-
enumerable: false,
|
|
29263
|
-
configurable: true
|
|
29264
|
-
});
|
|
29265
|
-
Object.defineProperty(AppEntityEditor.prototype, "saving", {
|
|
29266
|
-
get: function () {
|
|
29267
|
-
return this.savingSubject.value;
|
|
29268
|
-
},
|
|
29269
|
-
enumerable: false,
|
|
29270
|
-
configurable: true
|
|
29271
|
-
});
|
|
29272
29303
|
Object.defineProperty(AppEntityEditor.prototype, "service", {
|
|
29273
29304
|
get: function () {
|
|
29274
29305
|
return this.dataService;
|
|
@@ -29276,22 +29307,8 @@
|
|
|
29276
29307
|
enumerable: false,
|
|
29277
29308
|
configurable: true
|
|
29278
29309
|
});
|
|
29279
|
-
AppEntityEditor.prototype.markAsSaving = function (opts) {
|
|
29280
|
-
if (this.savingSubject.value !== true) {
|
|
29281
|
-
this.savingSubject.next(true);
|
|
29282
|
-
if (!opts || opts.emitEvent !== false)
|
|
29283
|
-
this.markForCheck();
|
|
29284
|
-
}
|
|
29285
|
-
};
|
|
29286
|
-
AppEntityEditor.prototype.markAsSaved = function (opts) {
|
|
29287
|
-
if (this.savingSubject.value !== false) {
|
|
29288
|
-
this.savingSubject.next(false);
|
|
29289
|
-
if (!opts || opts.emitEvent !== false)
|
|
29290
|
-
this.markForCheck();
|
|
29291
|
-
}
|
|
29292
|
-
};
|
|
29293
29310
|
AppEntityEditor.prototype.ngOnInit = function () {
|
|
29294
|
-
|
|
29311
|
+
_super_1.prototype.ngOnInit.call(this);
|
|
29295
29312
|
// Defaults
|
|
29296
29313
|
this._autoOpenNextTab = toBoolean(this._autoOpenNextTab, !this.isOnFieldMode);
|
|
29297
29314
|
this.historyIcon = this.historyIcon || { icon: 'list' };
|
|
@@ -29302,14 +29319,14 @@
|
|
|
29302
29319
|
};
|
|
29303
29320
|
AppEntityEditor.prototype.ngAfterViewInit = function () {
|
|
29304
29321
|
var _this = this;
|
|
29305
|
-
|
|
29322
|
+
_super_1.prototype.ngAfterViewInit.call(this);
|
|
29306
29323
|
// Load data
|
|
29307
29324
|
if (this._autoLoad) {
|
|
29308
29325
|
setTimeout(function () { return _this.loadFromRoute(); }, this._autoLoadDelay);
|
|
29309
29326
|
}
|
|
29310
29327
|
};
|
|
29311
29328
|
AppEntityEditor.prototype.ngOnDestroy = function () {
|
|
29312
|
-
|
|
29329
|
+
_super_1.prototype.ngOnDestroy.call(this);
|
|
29313
29330
|
this._listenChangesSubscription = null; // already unsubscribe in the super function
|
|
29314
29331
|
this.$title.complete();
|
|
29315
29332
|
this.$title.unsubscribe();
|
|
@@ -29321,7 +29338,7 @@
|
|
|
29321
29338
|
// Wait end of saving
|
|
29322
29339
|
if (this.saving)
|
|
29323
29340
|
return waitForFalse(this.savingSubject);
|
|
29324
|
-
return
|
|
29341
|
+
return _super_1.prototype.waitIdle.call(this, opts);
|
|
29325
29342
|
};
|
|
29326
29343
|
/**
|
|
29327
29344
|
* Load data from the snapshot route
|
|
@@ -29456,7 +29473,7 @@
|
|
|
29456
29473
|
};
|
|
29457
29474
|
AppEntityEditor.prototype.updateView = function (data, opts) {
|
|
29458
29475
|
return __awaiter(this, void 0, void 0, function () {
|
|
29459
|
-
var idChanged
|
|
29476
|
+
var idChanged;
|
|
29460
29477
|
var _this = this;
|
|
29461
29478
|
return __generator(this, function (_c) {
|
|
29462
29479
|
switch (_c.label) {
|
|
@@ -29470,13 +29487,9 @@
|
|
|
29470
29487
|
return [4 /*yield*/, this.ready()];
|
|
29471
29488
|
case 1:
|
|
29472
29489
|
_c.sent();
|
|
29473
|
-
|
|
29474
|
-
if (!promiseOrVoid) return [3 /*break*/, 3];
|
|
29475
|
-
return [4 /*yield*/, promiseOrVoid];
|
|
29490
|
+
return [4 /*yield*/, this.setValue(data)];
|
|
29476
29491
|
case 2:
|
|
29477
29492
|
_c.sent();
|
|
29478
|
-
_c.label = 3;
|
|
29479
|
-
case 3:
|
|
29480
29493
|
if (!opts || opts.emitEvent !== false) {
|
|
29481
29494
|
this.markAsPristine();
|
|
29482
29495
|
this.markAsUntouched();
|
|
@@ -29800,16 +29813,22 @@
|
|
|
29800
29813
|
});
|
|
29801
29814
|
});
|
|
29802
29815
|
};
|
|
29803
|
-
AppEntityEditor.prototype.unload = function () {
|
|
29816
|
+
AppEntityEditor.prototype.unload = function (opts) {
|
|
29817
|
+
var _super = Object.create(null, {
|
|
29818
|
+
unload: { get: function () { return _super_1.prototype.unload; } }
|
|
29819
|
+
});
|
|
29804
29820
|
return __awaiter(this, void 0, void 0, function () {
|
|
29805
29821
|
return __generator(this, function (_c) {
|
|
29806
|
-
|
|
29807
|
-
|
|
29808
|
-
|
|
29809
|
-
|
|
29810
|
-
|
|
29811
|
-
|
|
29812
|
-
|
|
29822
|
+
switch (_c.label) {
|
|
29823
|
+
case 0: return [4 /*yield*/, _super.unload.call(this, opts)];
|
|
29824
|
+
case 1:
|
|
29825
|
+
_c.sent();
|
|
29826
|
+
this.stopListenRemoteChanges();
|
|
29827
|
+
this.form.reset();
|
|
29828
|
+
this.registerForms();
|
|
29829
|
+
this.data = null;
|
|
29830
|
+
return [2 /*return*/];
|
|
29831
|
+
}
|
|
29813
29832
|
});
|
|
29814
29833
|
});
|
|
29815
29834
|
};
|
|
@@ -29833,15 +29852,15 @@
|
|
|
29833
29852
|
});
|
|
29834
29853
|
};
|
|
29835
29854
|
AppEntityEditor.prototype.resetError = function (opts) {
|
|
29836
|
-
|
|
29855
|
+
_super_1.prototype.resetError.call(this, opts);
|
|
29837
29856
|
};
|
|
29838
29857
|
AppEntityEditor.prototype.setError = function (err, opts) {
|
|
29839
29858
|
if (!err) {
|
|
29840
|
-
|
|
29859
|
+
_super_1.prototype.setError.call(this, undefined, opts);
|
|
29841
29860
|
}
|
|
29842
29861
|
else if (typeof err === 'string') {
|
|
29843
29862
|
console.error('[entity-editor] Error: ' + (err || ''));
|
|
29844
|
-
|
|
29863
|
+
_super_1.prototype.setError.call(this, err, opts);
|
|
29845
29864
|
}
|
|
29846
29865
|
else {
|
|
29847
29866
|
console.error('[entity-editor] Error: ' + err.message || '', err);
|
|
@@ -29856,7 +29875,7 @@
|
|
|
29856
29875
|
userMessage += detailMessage.length < 70 ? detailMessage : detailMessage.substring(0, 67) + '...';
|
|
29857
29876
|
userMessage += '</small>';
|
|
29858
29877
|
}
|
|
29859
|
-
|
|
29878
|
+
_super_1.prototype.setError.call(this, userMessage, opts);
|
|
29860
29879
|
}
|
|
29861
29880
|
};
|
|
29862
29881
|
/* -- protected methods -- */
|