@ecodev/natural 38.0.1 → 38.1.0
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/ecodev-natural.umd.js +28 -0
- package/bundles/ecodev-natural.umd.js.map +1 -1
- package/ecodev-natural.metadata.json +1 -1
- package/esm2015/lib/classes/rxjs.js +13 -2
- package/esm2015/lib/classes/validators.js +15 -1
- package/fesm2015/ecodev-natural.js +27 -2
- package/fesm2015/ecodev-natural.js.map +1 -1
- package/lib/classes/rxjs.d.ts +6 -1
- package/lib/classes/validators.d.ts +7 -0
- package/package.json +1 -1
|
@@ -2384,6 +2384,21 @@
|
|
|
2384
2384
|
return rxjs.timer(500).pipe(operators.switchMap(function () { return modelService.count(qvm).pipe(operators.map(function (count) { return (count > 0 ? { duplicateValue: count } : null); })); }));
|
|
2385
2385
|
};
|
|
2386
2386
|
}
|
|
2387
|
+
/**
|
|
2388
|
+
* Returns an async validator function that checks that the form control value is available
|
|
2389
|
+
*
|
|
2390
|
+
* Similar to `unique` validator, but allows to use a custom query for when the client does
|
|
2391
|
+
* not have permissions for `modelService.count()`.
|
|
2392
|
+
*/
|
|
2393
|
+
function available(getAvailableQuery, excludedId) {
|
|
2394
|
+
if (excludedId === void 0) { excludedId = null; }
|
|
2395
|
+
return function (control) {
|
|
2396
|
+
if (!control.value || !control.dirty) {
|
|
2397
|
+
return rxjs.of(null);
|
|
2398
|
+
}
|
|
2399
|
+
return rxjs.timer(500).pipe(operators.switchMap(function () { return getAvailableQuery(control.value, excludedId).pipe(operators.map(function (isAvailable) { return (isAvailable ? null : { available: true }); })); }));
|
|
2400
|
+
};
|
|
2401
|
+
}
|
|
2387
2402
|
/**
|
|
2388
2403
|
* Return all errors recursively for the given Form or control
|
|
2389
2404
|
*/
|
|
@@ -3953,6 +3968,17 @@
|
|
|
3953
3968
|
return;
|
|
3954
3969
|
}));
|
|
3955
3970
|
}
|
|
3971
|
+
/**
|
|
3972
|
+
* For debugging purpose only, will dump in console everything that happen to
|
|
3973
|
+
* the observable
|
|
3974
|
+
*/
|
|
3975
|
+
function debug(debugName) {
|
|
3976
|
+
return operators.tap({
|
|
3977
|
+
next: function (value) { return console.log('NEXT', debugName, value); },
|
|
3978
|
+
error: function (error) { return console.log('ERROR', debugName, error); },
|
|
3979
|
+
complete: function () { return console.log('COMPLETE', debugName); },
|
|
3980
|
+
});
|
|
3981
|
+
}
|
|
3956
3982
|
|
|
3957
3983
|
var NaturalAbstractModelService = /** @class */ (function () {
|
|
3958
3984
|
function NaturalAbstractModelService(apollo, name, oneQuery, allQuery, createMutation, updateMutation, deleteMutation) {
|
|
@@ -11196,9 +11222,11 @@
|
|
|
11196
11222
|
exports.TypeNumberComponent = TypeNumberComponent;
|
|
11197
11223
|
exports.TypeSelectComponent = TypeSelectComponent;
|
|
11198
11224
|
exports.TypeTextComponent = TypeTextComponent;
|
|
11225
|
+
exports.available = available;
|
|
11199
11226
|
exports.cancellableTimeout = cancellableTimeout;
|
|
11200
11227
|
exports.cleanSameValues = cleanSameValues;
|
|
11201
11228
|
exports.collectErrors = collectErrors;
|
|
11229
|
+
exports.debug = debug;
|
|
11202
11230
|
exports.decimal = decimal;
|
|
11203
11231
|
exports.deliverableEmail = deliverableEmail;
|
|
11204
11232
|
exports.ensureHttpPrefix = ensureHttpPrefix;
|