@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
|
@@ -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) {
|
|
@@ -27977,8 +27981,9 @@
|
|
|
27977
27981
|
this._subscription = new rxjs.Subscription();
|
|
27978
27982
|
this._enabled = false;
|
|
27979
27983
|
this._dirty = false;
|
|
27980
|
-
this.
|
|
27981
|
-
this.
|
|
27984
|
+
this.readySubject = new rxjs.BehaviorSubject(false);
|
|
27985
|
+
this.loadingSubject = new rxjs.BehaviorSubject(true);
|
|
27986
|
+
this.errorSubject = new rxjs.BehaviorSubject(undefined);
|
|
27982
27987
|
this.debug = false;
|
|
27983
27988
|
this.submitted = false;
|
|
27984
27989
|
this.toolbar = null;
|
|
@@ -27989,13 +27994,43 @@
|
|
|
27989
27994
|
* @deprecated
|
|
27990
27995
|
*/
|
|
27991
27996
|
get: function () {
|
|
27992
|
-
return this.
|
|
27997
|
+
return this.loadingSubject.value;
|
|
27993
27998
|
},
|
|
27994
27999
|
/**
|
|
27995
28000
|
* @deprecated
|
|
27996
28001
|
*/
|
|
27997
28002
|
set: function (value) {
|
|
27998
|
-
this.
|
|
28003
|
+
this.readySubject.next(value);
|
|
28004
|
+
},
|
|
28005
|
+
enumerable: false,
|
|
28006
|
+
configurable: true
|
|
28007
|
+
});
|
|
28008
|
+
Object.defineProperty(AppEditor.prototype, "_$ready", {
|
|
28009
|
+
/**
|
|
28010
|
+
* @deprecated
|
|
28011
|
+
*/
|
|
28012
|
+
get: function () {
|
|
28013
|
+
return this.readySubject;
|
|
28014
|
+
},
|
|
28015
|
+
enumerable: false,
|
|
28016
|
+
configurable: true
|
|
28017
|
+
});
|
|
28018
|
+
Object.defineProperty(AppEditor.prototype, "_$loading", {
|
|
28019
|
+
/**
|
|
28020
|
+
* @deprecated
|
|
28021
|
+
*/
|
|
28022
|
+
get: function () {
|
|
28023
|
+
return this.loadingSubject;
|
|
28024
|
+
},
|
|
28025
|
+
enumerable: false,
|
|
28026
|
+
configurable: true
|
|
28027
|
+
});
|
|
28028
|
+
Object.defineProperty(AppEditor.prototype, "error", {
|
|
28029
|
+
get: function () {
|
|
28030
|
+
return this.errorSubject.value;
|
|
28031
|
+
},
|
|
28032
|
+
set: function (error) {
|
|
28033
|
+
this.setError(error);
|
|
27999
28034
|
},
|
|
28000
28035
|
enumerable: false,
|
|
28001
28036
|
configurable: true
|
|
@@ -28052,7 +28087,7 @@
|
|
|
28052
28087
|
Object.defineProperty(AppEditor.prototype, "loading", {
|
|
28053
28088
|
get: function () {
|
|
28054
28089
|
var _a;
|
|
28055
|
-
return this.
|
|
28090
|
+
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
28091
|
},
|
|
28057
28092
|
enumerable: false,
|
|
28058
28093
|
configurable: true
|
|
@@ -28096,10 +28131,9 @@
|
|
|
28096
28131
|
};
|
|
28097
28132
|
AppEditor.prototype.ngOnDestroy = function () {
|
|
28098
28133
|
this._subscription.unsubscribe();
|
|
28099
|
-
this.
|
|
28100
|
-
this.
|
|
28101
|
-
this.
|
|
28102
|
-
this._$loading.unsubscribe();
|
|
28134
|
+
this.readySubject.unsubscribe();
|
|
28135
|
+
this.loadingSubject.unsubscribe();
|
|
28136
|
+
this.errorSubject.unsubscribe();
|
|
28103
28137
|
};
|
|
28104
28138
|
AppEditor.prototype.addChildForm = function (form) {
|
|
28105
28139
|
if (!form)
|
|
@@ -28169,16 +28203,16 @@
|
|
|
28169
28203
|
this.markForCheck();
|
|
28170
28204
|
};
|
|
28171
28205
|
AppEditor.prototype.markAsLoading = function (opts) {
|
|
28172
|
-
if (!this.
|
|
28173
|
-
this.
|
|
28206
|
+
if (!this.loadingSubject.value) {
|
|
28207
|
+
this.loadingSubject.next(true);
|
|
28174
28208
|
if (!opts || opts.emitEvent !== false)
|
|
28175
28209
|
this.markForCheck();
|
|
28176
28210
|
}
|
|
28177
28211
|
};
|
|
28178
28212
|
AppEditor.prototype.markAsLoaded = function (opts) {
|
|
28179
28213
|
var _a;
|
|
28180
|
-
if (this.
|
|
28181
|
-
this.
|
|
28214
|
+
if (this.loadingSubject.value) {
|
|
28215
|
+
this.loadingSubject.next(false);
|
|
28182
28216
|
if (!opts || opts.onlySelf !== true) {
|
|
28183
28217
|
// Emit to children forms
|
|
28184
28218
|
// Tables should be changed by parent
|
|
@@ -28192,19 +28226,17 @@
|
|
|
28192
28226
|
AppEditor.prototype.markAsReady = function (opts) {
|
|
28193
28227
|
var _a;
|
|
28194
28228
|
(_a = this._children) === null || _a === void 0 ? void 0 : _a.forEach(function (c) { return c.markAsReady(opts); });
|
|
28195
|
-
this.
|
|
28229
|
+
this.readySubject.next(true);
|
|
28196
28230
|
};
|
|
28197
28231
|
AppEditor.prototype.ready = function (opts) {
|
|
28198
|
-
|
|
28199
|
-
return
|
|
28200
|
-
|
|
28201
|
-
return [2 /*return*/];
|
|
28202
|
-
return [2 /*return*/, waitForTrue(this._$ready, opts)];
|
|
28203
|
-
});
|
|
28204
|
-
});
|
|
28232
|
+
if (this.readySubject.value)
|
|
28233
|
+
return Promise.resolve();
|
|
28234
|
+
return waitForTrue(this.readySubject, opts);
|
|
28205
28235
|
};
|
|
28206
28236
|
AppEditor.prototype.waitIdle = function (opts) {
|
|
28207
|
-
|
|
28237
|
+
if (!this.loadingSubject.value)
|
|
28238
|
+
return Promise.resolve();
|
|
28239
|
+
return waitForFalse(this.loadingSubject, opts);
|
|
28208
28240
|
};
|
|
28209
28241
|
AppEditor.prototype.cancel = function (event) {
|
|
28210
28242
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -28460,6 +28492,14 @@
|
|
|
28460
28492
|
console.warn(prefix + " Unknown children sub-form: ", c);
|
|
28461
28493
|
}
|
|
28462
28494
|
};
|
|
28495
|
+
AppEditor.prototype.setError = function (value, opts) {
|
|
28496
|
+
if (this.errorSubject.value !== value) {
|
|
28497
|
+
this.errorSubject.next(value);
|
|
28498
|
+
if (!opts || opts.emitEvent !== false) {
|
|
28499
|
+
this.markForCheck();
|
|
28500
|
+
}
|
|
28501
|
+
}
|
|
28502
|
+
};
|
|
28463
28503
|
AppEditor.prototype.markForCheck = function () {
|
|
28464
28504
|
// Should be override by subclasses, if change detection is Push
|
|
28465
28505
|
};
|