@sumaris-net/ngx-components 1.21.0 → 1.21.1
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 +62 -22
- 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 +48 -22
- package/esm2015/src/app/core/form/form.class.js +5 -1
- package/fesm2015/sumaris-net.ngx-components.js +50 -20
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/src/app/core/form/editor.class.d.ts +24 -11
- package/src/app/core/form/form.class.d.ts +3 -3
- package/sumaris-net.ngx-components.metadata.json +1 -1
|
@@ -17666,6 +17666,8 @@ class AppForm {
|
|
|
17666
17666
|
* @param opts
|
|
17667
17667
|
*/
|
|
17668
17668
|
ready(opts) {
|
|
17669
|
+
if (this.readySubject.value)
|
|
17670
|
+
return Promise.resolve();
|
|
17669
17671
|
return waitForTrue(this.readySubject, opts);
|
|
17670
17672
|
}
|
|
17671
17673
|
/**
|
|
@@ -17673,6 +17675,8 @@ class AppForm {
|
|
|
17673
17675
|
* @param opts
|
|
17674
17676
|
*/
|
|
17675
17677
|
waitIdle(opts) {
|
|
17678
|
+
if (!this.loadingSubject.value)
|
|
17679
|
+
return Promise.resolve();
|
|
17676
17680
|
return waitForFalse(this.loadingSubject, opts);
|
|
17677
17681
|
}
|
|
17678
17682
|
updateValueAndValidity(opts) {
|
|
@@ -24173,8 +24177,9 @@ class AppEditor {
|
|
|
24173
24177
|
this._subscription = new Subscription();
|
|
24174
24178
|
this._enabled = false;
|
|
24175
24179
|
this._dirty = false;
|
|
24176
|
-
this.
|
|
24177
|
-
this.
|
|
24180
|
+
this.readySubject = new BehaviorSubject(false);
|
|
24181
|
+
this.loadingSubject = new BehaviorSubject(true);
|
|
24182
|
+
this.errorSubject = new BehaviorSubject(undefined);
|
|
24178
24183
|
this.debug = false;
|
|
24179
24184
|
this.submitted = false;
|
|
24180
24185
|
this.toolbar = null;
|
|
@@ -24184,13 +24189,31 @@ class AppEditor {
|
|
|
24184
24189
|
* @deprecated
|
|
24185
24190
|
*/
|
|
24186
24191
|
set _loading(value) {
|
|
24187
|
-
this.
|
|
24192
|
+
this.readySubject.next(value);
|
|
24188
24193
|
}
|
|
24189
24194
|
/**
|
|
24190
24195
|
* @deprecated
|
|
24191
24196
|
*/
|
|
24192
24197
|
get _loading() {
|
|
24193
|
-
return this.
|
|
24198
|
+
return this.loadingSubject.value;
|
|
24199
|
+
}
|
|
24200
|
+
/**
|
|
24201
|
+
* @deprecated
|
|
24202
|
+
*/
|
|
24203
|
+
get _$ready() {
|
|
24204
|
+
return this.readySubject;
|
|
24205
|
+
}
|
|
24206
|
+
/**
|
|
24207
|
+
* @deprecated
|
|
24208
|
+
*/
|
|
24209
|
+
get _$loading() {
|
|
24210
|
+
return this.loadingSubject;
|
|
24211
|
+
}
|
|
24212
|
+
get error() {
|
|
24213
|
+
return this.errorSubject.value;
|
|
24214
|
+
}
|
|
24215
|
+
set error(error) {
|
|
24216
|
+
this.setError(error);
|
|
24194
24217
|
}
|
|
24195
24218
|
get tables() {
|
|
24196
24219
|
return this._children && this._children.filter(c => c instanceof AppTable);
|
|
@@ -24219,7 +24242,7 @@ class AppEditor {
|
|
|
24219
24242
|
}
|
|
24220
24243
|
get loading() {
|
|
24221
24244
|
var _a;
|
|
24222
|
-
return this.
|
|
24245
|
+
return this.loadingSubject.value || (((_a = this._children) === null || _a === void 0 ? void 0 : _a.findIndex(c => c.enabled && c.loading)) !== -1) || false;
|
|
24223
24246
|
}
|
|
24224
24247
|
get enabled() {
|
|
24225
24248
|
return this._enabled;
|
|
@@ -24243,10 +24266,9 @@ class AppEditor {
|
|
|
24243
24266
|
}
|
|
24244
24267
|
ngOnDestroy() {
|
|
24245
24268
|
this._subscription.unsubscribe();
|
|
24246
|
-
this.
|
|
24247
|
-
this.
|
|
24248
|
-
this.
|
|
24249
|
-
this._$loading.unsubscribe();
|
|
24269
|
+
this.readySubject.unsubscribe();
|
|
24270
|
+
this.loadingSubject.unsubscribe();
|
|
24271
|
+
this.errorSubject.unsubscribe();
|
|
24250
24272
|
}
|
|
24251
24273
|
addChildForm(form) {
|
|
24252
24274
|
if (!form)
|
|
@@ -24315,16 +24337,16 @@ class AppEditor {
|
|
|
24315
24337
|
this.markForCheck();
|
|
24316
24338
|
}
|
|
24317
24339
|
markAsLoading(opts) {
|
|
24318
|
-
if (!this.
|
|
24319
|
-
this.
|
|
24340
|
+
if (!this.loadingSubject.value) {
|
|
24341
|
+
this.loadingSubject.next(true);
|
|
24320
24342
|
if (!opts || opts.emitEvent !== false)
|
|
24321
24343
|
this.markForCheck();
|
|
24322
24344
|
}
|
|
24323
24345
|
}
|
|
24324
24346
|
markAsLoaded(opts) {
|
|
24325
24347
|
var _a;
|
|
24326
|
-
if (this.
|
|
24327
|
-
this.
|
|
24348
|
+
if (this.loadingSubject.value) {
|
|
24349
|
+
this.loadingSubject.next(false);
|
|
24328
24350
|
if (!opts || opts.onlySelf !== true) {
|
|
24329
24351
|
// Emit to children forms
|
|
24330
24352
|
// Tables should be changed by parent
|
|
@@ -24338,17 +24360,17 @@ class AppEditor {
|
|
|
24338
24360
|
markAsReady(opts) {
|
|
24339
24361
|
var _a;
|
|
24340
24362
|
(_a = this._children) === null || _a === void 0 ? void 0 : _a.forEach(c => c.markAsReady(opts));
|
|
24341
|
-
this.
|
|
24363
|
+
this.readySubject.next(true);
|
|
24342
24364
|
}
|
|
24343
24365
|
ready(opts) {
|
|
24344
|
-
|
|
24345
|
-
|
|
24346
|
-
|
|
24347
|
-
return waitForTrue(this._$ready, opts);
|
|
24348
|
-
});
|
|
24366
|
+
if (this.readySubject.value)
|
|
24367
|
+
return Promise.resolve();
|
|
24368
|
+
return waitForTrue(this.readySubject, opts);
|
|
24349
24369
|
}
|
|
24350
24370
|
waitIdle(opts) {
|
|
24351
|
-
|
|
24371
|
+
if (!this.loadingSubject.value)
|
|
24372
|
+
return Promise.resolve();
|
|
24373
|
+
return waitForFalse(this.loadingSubject, opts);
|
|
24352
24374
|
}
|
|
24353
24375
|
cancel(event) {
|
|
24354
24376
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -24551,6 +24573,14 @@ class AppEditor {
|
|
|
24551
24573
|
console.warn(`${prefix} Unknown children sub-form: `, c);
|
|
24552
24574
|
}
|
|
24553
24575
|
}
|
|
24576
|
+
setError(value, opts) {
|
|
24577
|
+
if (this.errorSubject.value !== value) {
|
|
24578
|
+
this.errorSubject.next(value);
|
|
24579
|
+
if (!opts || opts.emitEvent !== false) {
|
|
24580
|
+
this.markForCheck();
|
|
24581
|
+
}
|
|
24582
|
+
}
|
|
24583
|
+
}
|
|
24554
24584
|
markForCheck() {
|
|
24555
24585
|
// Should be override by subclasses, if change detection is Push
|
|
24556
24586
|
}
|