@sumaris-net/ngx-components 0.27.7 → 0.27.11
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 +95 -30
- 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 +8 -0
- package/esm2015/src/app/core/form/editor.class.js +4 -2
- package/esm2015/src/app/core/form/entity-editor.class.js +6 -6
- package/esm2015/src/app/core/form/form.class.js +18 -6
- package/esm2015/src/app/core/form/form.utils.js +4 -1
- package/esm2015/src/app/core/table/table.class.js +12 -6
- package/esm2015/src/app/shared/observables.js +22 -19
- package/esm2015/src/app/shared/validator/validators.js +1 -2
- package/fesm2015/sumaris-net.ngx-components.js +57 -35
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/src/app/core/form/entity-editor.class.d.ts +1 -1
- package/src/app/core/form/form.class.d.ts +7 -4
- package/src/app/core/form/form.utils.d.ts +5 -3
- package/src/app/core/table/table.class.d.ts +3 -2
- package/src/app/shared/observables.d.ts +1 -1
- package/sumaris-net.ngx-components.metadata.json +1 -1
|
@@ -1046,24 +1046,35 @@
|
|
|
1046
1046
|
* @param opts
|
|
1047
1047
|
*/
|
|
1048
1048
|
function waitFor(predicate, opts) {
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1049
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1050
|
+
var period, dueTime, wait$, $timeout;
|
|
1051
|
+
return __generator(this, function (_a) {
|
|
1052
|
+
switch (_a.label) {
|
|
1053
|
+
case 0:
|
|
1054
|
+
if (predicate())
|
|
1055
|
+
return [2 /*return*/, Promise.resolve()];
|
|
1056
|
+
period = opts && opts.checkPeriod || 300;
|
|
1057
|
+
dueTime = opts && opts.dueTime || period;
|
|
1058
|
+
wait$ = rxjs.timer(dueTime, period)
|
|
1059
|
+
.pipe(
|
|
1060
|
+
// For DEBUG :
|
|
1061
|
+
//tap(() => console.debug("Waiting form idle...", form)),
|
|
1062
|
+
operators.filter(function (_) { return predicate(); }), operators.map(function (_) { return true; }));
|
|
1063
|
+
// Add timeout
|
|
1064
|
+
if (opts && opts.timeout) {
|
|
1065
|
+
$timeout = rxjs.timer(opts.timeout);
|
|
1066
|
+
wait$ = rxjs.merge(wait$.pipe(operators.takeUntil($timeout)), $timeout
|
|
1067
|
+
.pipe(operators.map(function () {
|
|
1068
|
+
throw new Error("Timeout waitIdle() - after " + opts.timeout + "ms");
|
|
1069
|
+
})));
|
|
1070
|
+
}
|
|
1071
|
+
return [4 /*yield*/, firstNotNilPromise(wait$)];
|
|
1072
|
+
case 1:
|
|
1073
|
+
_a.sent();
|
|
1074
|
+
return [2 /*return*/];
|
|
1075
|
+
}
|
|
1076
|
+
});
|
|
1077
|
+
});
|
|
1067
1078
|
}
|
|
1068
1079
|
|
|
1069
1080
|
function createPromiseEventEmitter() {
|
|
@@ -3134,7 +3145,6 @@
|
|
|
3134
3145
|
var endField = group.get(endDateField);
|
|
3135
3146
|
var endDate = fromDateISOString(endField.value);
|
|
3136
3147
|
if (isNotNil(startDate) && isNotNil(endDate) && Math.abs(startDate.diff(endDate, durationUnit)) > maxDuration) {
|
|
3137
|
-
console.log('TODO error !');
|
|
3138
3148
|
// Update end field
|
|
3139
3149
|
endField.markAsTouched({ onlySelf: true });
|
|
3140
3150
|
endField.markAsPending();
|
|
@@ -3471,6 +3481,9 @@
|
|
|
3471
3481
|
AppFormProvider.prototype.ready = function () {
|
|
3472
3482
|
return this.delegate.ready();
|
|
3473
3483
|
};
|
|
3484
|
+
AppFormProvider.prototype.waitIdle = function (opts) {
|
|
3485
|
+
return this.delegate.waitIdle();
|
|
3486
|
+
};
|
|
3474
3487
|
AppFormProvider.prototype.disable = function (opts) {
|
|
3475
3488
|
return this.delegate.disable(opts);
|
|
3476
3489
|
};
|
|
@@ -19041,6 +19054,7 @@
|
|
|
19041
19054
|
this.onSubmit = new i0.EventEmitter();
|
|
19042
19055
|
if (form)
|
|
19043
19056
|
this.setForm(form);
|
|
19057
|
+
this.translate = injector.get(i1$2.TranslateService);
|
|
19044
19058
|
this.settings = injector.get(LocalSettingsService);
|
|
19045
19059
|
this.errorTranslator = injector.get(FormErrorTranslator);
|
|
19046
19060
|
this.autocompleteHelper = new MatAutocompleteConfigHolder(this.settings && {
|
|
@@ -19048,6 +19062,13 @@
|
|
|
19048
19062
|
});
|
|
19049
19063
|
this.autocompleteFields = this.autocompleteHelper.fields;
|
|
19050
19064
|
}
|
|
19065
|
+
Object.defineProperty(AppForm.prototype, "_ready", {
|
|
19066
|
+
get: function () {
|
|
19067
|
+
return this._$ready.value == true;
|
|
19068
|
+
},
|
|
19069
|
+
enumerable: false,
|
|
19070
|
+
configurable: true
|
|
19071
|
+
});
|
|
19051
19072
|
Object.defineProperty(AppForm.prototype, "value", {
|
|
19052
19073
|
get: function () {
|
|
19053
19074
|
return this.form.value;
|
|
@@ -19259,14 +19280,27 @@
|
|
|
19259
19280
|
* @param opts
|
|
19260
19281
|
*/
|
|
19261
19282
|
AppForm.prototype.ready = function (opts) {
|
|
19262
|
-
return
|
|
19283
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
19284
|
+
return __generator(this, function (_b) {
|
|
19285
|
+
switch (_b.label) {
|
|
19286
|
+
case 0: return [4 /*yield*/, firstTruePromise(this._$ready)];
|
|
19287
|
+
case 1:
|
|
19288
|
+
_b.sent();
|
|
19289
|
+
return [2 /*return*/];
|
|
19290
|
+
}
|
|
19291
|
+
});
|
|
19292
|
+
});
|
|
19263
19293
|
};
|
|
19264
19294
|
/**
|
|
19265
19295
|
* Wait form is idle (not loading)
|
|
19266
19296
|
* @param opts
|
|
19267
19297
|
*/
|
|
19268
19298
|
AppForm.prototype.waitIdle = function (opts) {
|
|
19269
|
-
return
|
|
19299
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
19300
|
+
return __generator(this, function (_b) {
|
|
19301
|
+
return [2 /*return*/, AppFormUtils.waitIdle(this, opts)];
|
|
19302
|
+
});
|
|
19303
|
+
});
|
|
19270
19304
|
};
|
|
19271
19305
|
AppForm.prototype.updateValueAndValidity = function (opts) {
|
|
19272
19306
|
AppFormUtils.updateValueAndValidity(this.form, opts);
|
|
@@ -19274,7 +19308,9 @@
|
|
|
19274
19308
|
this.markForCheck();
|
|
19275
19309
|
};
|
|
19276
19310
|
AppForm.prototype.translateControlPath = function (path) {
|
|
19277
|
-
|
|
19311
|
+
var _a;
|
|
19312
|
+
var i18nFieldName = this.getI18nFieldName(path);
|
|
19313
|
+
return ((_a = this.translate) === null || _a === void 0 ? void 0 : _a.instant(i18nFieldName)) || i18nFieldName;
|
|
19278
19314
|
};
|
|
19279
19315
|
/* -- protected methods -- */
|
|
19280
19316
|
AppForm.prototype.getFormError = function (form, opts) {
|
|
@@ -19282,7 +19318,7 @@
|
|
|
19282
19318
|
return undefined;
|
|
19283
19319
|
return this.errorTranslator.translateErrors(this.form, Object.assign({ controlPathTranslator: this }, opts));
|
|
19284
19320
|
};
|
|
19285
|
-
AppForm.prototype.
|
|
19321
|
+
AppForm.prototype.getI18nFieldName = function (path) {
|
|
19286
19322
|
return (this.i18nFieldPrefix || '') + changeCaseToUnderscore(path).toUpperCase();
|
|
19287
19323
|
};
|
|
19288
19324
|
AppForm.prototype.registerSubscription = function (sub) {
|
|
@@ -19292,7 +19328,7 @@
|
|
|
19292
19328
|
return this.autocompleteHelper.add(fieldName, opts);
|
|
19293
19329
|
};
|
|
19294
19330
|
AppForm.prototype.markForCheck = function () {
|
|
19295
|
-
// Should be
|
|
19331
|
+
// Should be overwritten by subclasses
|
|
19296
19332
|
console.warn('markForCheck() has been called, but is not overwritten by component ' + this.constructor.name);
|
|
19297
19333
|
};
|
|
19298
19334
|
return AppForm;
|
|
@@ -23762,6 +23798,7 @@
|
|
|
23762
23798
|
};
|
|
23763
23799
|
AppTable.prototype.markAsSaving = function (opts) {
|
|
23764
23800
|
if (this.savingSubject.value !== true) {
|
|
23801
|
+
this.focusColumn = undefined; // unselect focus column
|
|
23765
23802
|
this.savingSubject.next(true);
|
|
23766
23803
|
if (!opts || opts.emitEvent !== false) {
|
|
23767
23804
|
this.markForCheck();
|
|
@@ -23792,8 +23829,9 @@
|
|
|
23792
23829
|
AppTable.prototype.markAsReady = function (opts) {
|
|
23793
23830
|
if (this.readySubject.value !== false) {
|
|
23794
23831
|
this.readySubject.next(false);
|
|
23795
|
-
|
|
23796
|
-
|
|
23832
|
+
// If subclasses implements OnReady
|
|
23833
|
+
if (typeof this['ngOnReady'] === 'function') {
|
|
23834
|
+
this.ngOnReady();
|
|
23797
23835
|
}
|
|
23798
23836
|
}
|
|
23799
23837
|
};
|
|
@@ -24512,10 +24550,28 @@
|
|
|
24512
24550
|
this.dataSource.move(id, direction);
|
|
24513
24551
|
};
|
|
24514
24552
|
AppTable.prototype.ready = function () {
|
|
24515
|
-
return
|
|
24553
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
24554
|
+
return __generator(this, function (_d) {
|
|
24555
|
+
switch (_d.label) {
|
|
24556
|
+
case 0: return [4 /*yield*/, firstTruePromise(this.readySubject)];
|
|
24557
|
+
case 1:
|
|
24558
|
+
_d.sent();
|
|
24559
|
+
return [2 /*return*/];
|
|
24560
|
+
}
|
|
24561
|
+
});
|
|
24562
|
+
});
|
|
24516
24563
|
};
|
|
24517
|
-
AppTable.prototype.waitIdle = function () {
|
|
24518
|
-
return
|
|
24564
|
+
AppTable.prototype.waitIdle = function (opts) {
|
|
24565
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
24566
|
+
return __generator(this, function (_d) {
|
|
24567
|
+
switch (_d.label) {
|
|
24568
|
+
case 0: return [4 /*yield*/, firstFalsePromise(this.loadingSubject)];
|
|
24569
|
+
case 1:
|
|
24570
|
+
_d.sent();
|
|
24571
|
+
return [2 /*return*/];
|
|
24572
|
+
}
|
|
24573
|
+
});
|
|
24574
|
+
});
|
|
24519
24575
|
};
|
|
24520
24576
|
AppTable.prototype.openSelectColumnsModal = function (event) {
|
|
24521
24577
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -25502,7 +25558,16 @@
|
|
|
25502
25558
|
this._$ready.next(true);
|
|
25503
25559
|
};
|
|
25504
25560
|
AppEditor.prototype.ready = function (opts) {
|
|
25505
|
-
return
|
|
25561
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
25562
|
+
return __generator(this, function (_b) {
|
|
25563
|
+
switch (_b.label) {
|
|
25564
|
+
case 0: return [4 /*yield*/, firstTruePromise(this._$ready)];
|
|
25565
|
+
case 1:
|
|
25566
|
+
_b.sent();
|
|
25567
|
+
return [2 /*return*/];
|
|
25568
|
+
}
|
|
25569
|
+
});
|
|
25570
|
+
});
|
|
25506
25571
|
};
|
|
25507
25572
|
AppEditor.prototype.waitIdle = function (opts) {
|
|
25508
25573
|
return AppFormUtils.waitIdle(this, opts);
|