@rolster/react-forms 18.0.0 → 18.0.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/dist/cjs/index.js +2 -772
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/index.js +1 -771
- package/dist/es/index.js.map +1 -1
- package/package.json +2 -1
package/dist/cjs/index.js
CHANGED
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var react = require('react');
|
|
6
6
|
var uuid = require('uuid');
|
|
7
|
+
var rxjs = require('rxjs');
|
|
7
8
|
|
|
8
9
|
const FALSY_VALUE = ['false', 'undefined', '0', 0];
|
|
9
10
|
const toBoolean = (value) => {
|
|
@@ -235,777 +236,6 @@ function useFormArray(props) {
|
|
|
235
236
|
return formArray;
|
|
236
237
|
}
|
|
237
238
|
|
|
238
|
-
/******************************************************************************
|
|
239
|
-
Copyright (c) Microsoft Corporation.
|
|
240
|
-
|
|
241
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
242
|
-
purpose with or without fee is hereby granted.
|
|
243
|
-
|
|
244
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
245
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
246
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
247
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
248
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
249
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
250
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
251
|
-
***************************************************************************** */
|
|
252
|
-
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
253
|
-
|
|
254
|
-
var extendStatics = function(d, b) {
|
|
255
|
-
extendStatics = Object.setPrototypeOf ||
|
|
256
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
257
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
258
|
-
return extendStatics(d, b);
|
|
259
|
-
};
|
|
260
|
-
|
|
261
|
-
function __extends(d, b) {
|
|
262
|
-
if (typeof b !== "function" && b !== null)
|
|
263
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
264
|
-
extendStatics(d, b);
|
|
265
|
-
function __() { this.constructor = d; }
|
|
266
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
function __values(o) {
|
|
270
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
271
|
-
if (m) return m.call(o);
|
|
272
|
-
if (o && typeof o.length === "number") return {
|
|
273
|
-
next: function () {
|
|
274
|
-
if (o && i >= o.length) o = void 0;
|
|
275
|
-
return { value: o && o[i++], done: !o };
|
|
276
|
-
}
|
|
277
|
-
};
|
|
278
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
function __read(o, n) {
|
|
282
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
283
|
-
if (!m) return o;
|
|
284
|
-
var i = m.call(o), r, ar = [], e;
|
|
285
|
-
try {
|
|
286
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
287
|
-
}
|
|
288
|
-
catch (error) { e = { error: error }; }
|
|
289
|
-
finally {
|
|
290
|
-
try {
|
|
291
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
292
|
-
}
|
|
293
|
-
finally { if (e) throw e.error; }
|
|
294
|
-
}
|
|
295
|
-
return ar;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
function __spreadArray(to, from, pack) {
|
|
299
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
300
|
-
if (ar || !(i in from)) {
|
|
301
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
302
|
-
ar[i] = from[i];
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
309
|
-
var e = new Error(message);
|
|
310
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
311
|
-
};
|
|
312
|
-
|
|
313
|
-
function isFunction(value) {
|
|
314
|
-
return typeof value === 'function';
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
function createErrorClass(createImpl) {
|
|
318
|
-
var _super = function (instance) {
|
|
319
|
-
Error.call(instance);
|
|
320
|
-
instance.stack = new Error().stack;
|
|
321
|
-
};
|
|
322
|
-
var ctorFunc = createImpl(_super);
|
|
323
|
-
ctorFunc.prototype = Object.create(Error.prototype);
|
|
324
|
-
ctorFunc.prototype.constructor = ctorFunc;
|
|
325
|
-
return ctorFunc;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
var UnsubscriptionError = createErrorClass(function (_super) {
|
|
329
|
-
return function UnsubscriptionErrorImpl(errors) {
|
|
330
|
-
_super(this);
|
|
331
|
-
this.message = errors
|
|
332
|
-
? errors.length + " errors occurred during unsubscription:\n" + errors.map(function (err, i) { return i + 1 + ") " + err.toString(); }).join('\n ')
|
|
333
|
-
: '';
|
|
334
|
-
this.name = 'UnsubscriptionError';
|
|
335
|
-
this.errors = errors;
|
|
336
|
-
};
|
|
337
|
-
});
|
|
338
|
-
|
|
339
|
-
function arrRemove(arr, item) {
|
|
340
|
-
if (arr) {
|
|
341
|
-
var index = arr.indexOf(item);
|
|
342
|
-
0 <= index && arr.splice(index, 1);
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
var Subscription = (function () {
|
|
347
|
-
function Subscription(initialTeardown) {
|
|
348
|
-
this.initialTeardown = initialTeardown;
|
|
349
|
-
this.closed = false;
|
|
350
|
-
this._parentage = null;
|
|
351
|
-
this._finalizers = null;
|
|
352
|
-
}
|
|
353
|
-
Subscription.prototype.unsubscribe = function () {
|
|
354
|
-
var e_1, _a, e_2, _b;
|
|
355
|
-
var errors;
|
|
356
|
-
if (!this.closed) {
|
|
357
|
-
this.closed = true;
|
|
358
|
-
var _parentage = this._parentage;
|
|
359
|
-
if (_parentage) {
|
|
360
|
-
this._parentage = null;
|
|
361
|
-
if (Array.isArray(_parentage)) {
|
|
362
|
-
try {
|
|
363
|
-
for (var _parentage_1 = __values(_parentage), _parentage_1_1 = _parentage_1.next(); !_parentage_1_1.done; _parentage_1_1 = _parentage_1.next()) {
|
|
364
|
-
var parent_1 = _parentage_1_1.value;
|
|
365
|
-
parent_1.remove(this);
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
369
|
-
finally {
|
|
370
|
-
try {
|
|
371
|
-
if (_parentage_1_1 && !_parentage_1_1.done && (_a = _parentage_1.return)) _a.call(_parentage_1);
|
|
372
|
-
}
|
|
373
|
-
finally { if (e_1) throw e_1.error; }
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
else {
|
|
377
|
-
_parentage.remove(this);
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
var initialFinalizer = this.initialTeardown;
|
|
381
|
-
if (isFunction(initialFinalizer)) {
|
|
382
|
-
try {
|
|
383
|
-
initialFinalizer();
|
|
384
|
-
}
|
|
385
|
-
catch (e) {
|
|
386
|
-
errors = e instanceof UnsubscriptionError ? e.errors : [e];
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
var _finalizers = this._finalizers;
|
|
390
|
-
if (_finalizers) {
|
|
391
|
-
this._finalizers = null;
|
|
392
|
-
try {
|
|
393
|
-
for (var _finalizers_1 = __values(_finalizers), _finalizers_1_1 = _finalizers_1.next(); !_finalizers_1_1.done; _finalizers_1_1 = _finalizers_1.next()) {
|
|
394
|
-
var finalizer = _finalizers_1_1.value;
|
|
395
|
-
try {
|
|
396
|
-
execFinalizer(finalizer);
|
|
397
|
-
}
|
|
398
|
-
catch (err) {
|
|
399
|
-
errors = errors !== null && errors !== void 0 ? errors : [];
|
|
400
|
-
if (err instanceof UnsubscriptionError) {
|
|
401
|
-
errors = __spreadArray(__spreadArray([], __read(errors)), __read(err.errors));
|
|
402
|
-
}
|
|
403
|
-
else {
|
|
404
|
-
errors.push(err);
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
410
|
-
finally {
|
|
411
|
-
try {
|
|
412
|
-
if (_finalizers_1_1 && !_finalizers_1_1.done && (_b = _finalizers_1.return)) _b.call(_finalizers_1);
|
|
413
|
-
}
|
|
414
|
-
finally { if (e_2) throw e_2.error; }
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
if (errors) {
|
|
418
|
-
throw new UnsubscriptionError(errors);
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
};
|
|
422
|
-
Subscription.prototype.add = function (teardown) {
|
|
423
|
-
var _a;
|
|
424
|
-
if (teardown && teardown !== this) {
|
|
425
|
-
if (this.closed) {
|
|
426
|
-
execFinalizer(teardown);
|
|
427
|
-
}
|
|
428
|
-
else {
|
|
429
|
-
if (teardown instanceof Subscription) {
|
|
430
|
-
if (teardown.closed || teardown._hasParent(this)) {
|
|
431
|
-
return;
|
|
432
|
-
}
|
|
433
|
-
teardown._addParent(this);
|
|
434
|
-
}
|
|
435
|
-
(this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown);
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
};
|
|
439
|
-
Subscription.prototype._hasParent = function (parent) {
|
|
440
|
-
var _parentage = this._parentage;
|
|
441
|
-
return _parentage === parent || (Array.isArray(_parentage) && _parentage.includes(parent));
|
|
442
|
-
};
|
|
443
|
-
Subscription.prototype._addParent = function (parent) {
|
|
444
|
-
var _parentage = this._parentage;
|
|
445
|
-
this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;
|
|
446
|
-
};
|
|
447
|
-
Subscription.prototype._removeParent = function (parent) {
|
|
448
|
-
var _parentage = this._parentage;
|
|
449
|
-
if (_parentage === parent) {
|
|
450
|
-
this._parentage = null;
|
|
451
|
-
}
|
|
452
|
-
else if (Array.isArray(_parentage)) {
|
|
453
|
-
arrRemove(_parentage, parent);
|
|
454
|
-
}
|
|
455
|
-
};
|
|
456
|
-
Subscription.prototype.remove = function (teardown) {
|
|
457
|
-
var _finalizers = this._finalizers;
|
|
458
|
-
_finalizers && arrRemove(_finalizers, teardown);
|
|
459
|
-
if (teardown instanceof Subscription) {
|
|
460
|
-
teardown._removeParent(this);
|
|
461
|
-
}
|
|
462
|
-
};
|
|
463
|
-
Subscription.EMPTY = (function () {
|
|
464
|
-
var empty = new Subscription();
|
|
465
|
-
empty.closed = true;
|
|
466
|
-
return empty;
|
|
467
|
-
})();
|
|
468
|
-
return Subscription;
|
|
469
|
-
}());
|
|
470
|
-
var EMPTY_SUBSCRIPTION = Subscription.EMPTY;
|
|
471
|
-
function isSubscription(value) {
|
|
472
|
-
return (value instanceof Subscription ||
|
|
473
|
-
(value && 'closed' in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe)));
|
|
474
|
-
}
|
|
475
|
-
function execFinalizer(finalizer) {
|
|
476
|
-
if (isFunction(finalizer)) {
|
|
477
|
-
finalizer();
|
|
478
|
-
}
|
|
479
|
-
else {
|
|
480
|
-
finalizer.unsubscribe();
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
var config = {
|
|
485
|
-
onUnhandledError: null,
|
|
486
|
-
onStoppedNotification: null,
|
|
487
|
-
Promise: undefined,
|
|
488
|
-
useDeprecatedSynchronousErrorHandling: false,
|
|
489
|
-
useDeprecatedNextContext: false,
|
|
490
|
-
};
|
|
491
|
-
|
|
492
|
-
var timeoutProvider = {
|
|
493
|
-
setTimeout: function (handler, timeout) {
|
|
494
|
-
var args = [];
|
|
495
|
-
for (var _i = 2; _i < arguments.length; _i++) {
|
|
496
|
-
args[_i - 2] = arguments[_i];
|
|
497
|
-
}
|
|
498
|
-
var delegate = timeoutProvider.delegate;
|
|
499
|
-
if (delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) {
|
|
500
|
-
return delegate.setTimeout.apply(delegate, __spreadArray([handler, timeout], __read(args)));
|
|
501
|
-
}
|
|
502
|
-
return setTimeout.apply(void 0, __spreadArray([handler, timeout], __read(args)));
|
|
503
|
-
},
|
|
504
|
-
clearTimeout: function (handle) {
|
|
505
|
-
var delegate = timeoutProvider.delegate;
|
|
506
|
-
return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearTimeout) || clearTimeout)(handle);
|
|
507
|
-
},
|
|
508
|
-
delegate: undefined,
|
|
509
|
-
};
|
|
510
|
-
|
|
511
|
-
function reportUnhandledError(err) {
|
|
512
|
-
timeoutProvider.setTimeout(function () {
|
|
513
|
-
{
|
|
514
|
-
throw err;
|
|
515
|
-
}
|
|
516
|
-
});
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
function noop() { }
|
|
520
|
-
|
|
521
|
-
var context = null;
|
|
522
|
-
function errorContext(cb) {
|
|
523
|
-
if (config.useDeprecatedSynchronousErrorHandling) {
|
|
524
|
-
var isRoot = !context;
|
|
525
|
-
if (isRoot) {
|
|
526
|
-
context = { errorThrown: false, error: null };
|
|
527
|
-
}
|
|
528
|
-
cb();
|
|
529
|
-
if (isRoot) {
|
|
530
|
-
var _a = context, errorThrown = _a.errorThrown, error = _a.error;
|
|
531
|
-
context = null;
|
|
532
|
-
if (errorThrown) {
|
|
533
|
-
throw error;
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
else {
|
|
538
|
-
cb();
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
var Subscriber = (function (_super) {
|
|
543
|
-
__extends(Subscriber, _super);
|
|
544
|
-
function Subscriber(destination) {
|
|
545
|
-
var _this = _super.call(this) || this;
|
|
546
|
-
_this.isStopped = false;
|
|
547
|
-
if (destination) {
|
|
548
|
-
_this.destination = destination;
|
|
549
|
-
if (isSubscription(destination)) {
|
|
550
|
-
destination.add(_this);
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
|
-
else {
|
|
554
|
-
_this.destination = EMPTY_OBSERVER;
|
|
555
|
-
}
|
|
556
|
-
return _this;
|
|
557
|
-
}
|
|
558
|
-
Subscriber.create = function (next, error, complete) {
|
|
559
|
-
return new SafeSubscriber(next, error, complete);
|
|
560
|
-
};
|
|
561
|
-
Subscriber.prototype.next = function (value) {
|
|
562
|
-
if (this.isStopped) ;
|
|
563
|
-
else {
|
|
564
|
-
this._next(value);
|
|
565
|
-
}
|
|
566
|
-
};
|
|
567
|
-
Subscriber.prototype.error = function (err) {
|
|
568
|
-
if (this.isStopped) ;
|
|
569
|
-
else {
|
|
570
|
-
this.isStopped = true;
|
|
571
|
-
this._error(err);
|
|
572
|
-
}
|
|
573
|
-
};
|
|
574
|
-
Subscriber.prototype.complete = function () {
|
|
575
|
-
if (this.isStopped) ;
|
|
576
|
-
else {
|
|
577
|
-
this.isStopped = true;
|
|
578
|
-
this._complete();
|
|
579
|
-
}
|
|
580
|
-
};
|
|
581
|
-
Subscriber.prototype.unsubscribe = function () {
|
|
582
|
-
if (!this.closed) {
|
|
583
|
-
this.isStopped = true;
|
|
584
|
-
_super.prototype.unsubscribe.call(this);
|
|
585
|
-
this.destination = null;
|
|
586
|
-
}
|
|
587
|
-
};
|
|
588
|
-
Subscriber.prototype._next = function (value) {
|
|
589
|
-
this.destination.next(value);
|
|
590
|
-
};
|
|
591
|
-
Subscriber.prototype._error = function (err) {
|
|
592
|
-
try {
|
|
593
|
-
this.destination.error(err);
|
|
594
|
-
}
|
|
595
|
-
finally {
|
|
596
|
-
this.unsubscribe();
|
|
597
|
-
}
|
|
598
|
-
};
|
|
599
|
-
Subscriber.prototype._complete = function () {
|
|
600
|
-
try {
|
|
601
|
-
this.destination.complete();
|
|
602
|
-
}
|
|
603
|
-
finally {
|
|
604
|
-
this.unsubscribe();
|
|
605
|
-
}
|
|
606
|
-
};
|
|
607
|
-
return Subscriber;
|
|
608
|
-
}(Subscription));
|
|
609
|
-
var _bind = Function.prototype.bind;
|
|
610
|
-
function bind(fn, thisArg) {
|
|
611
|
-
return _bind.call(fn, thisArg);
|
|
612
|
-
}
|
|
613
|
-
var ConsumerObserver = (function () {
|
|
614
|
-
function ConsumerObserver(partialObserver) {
|
|
615
|
-
this.partialObserver = partialObserver;
|
|
616
|
-
}
|
|
617
|
-
ConsumerObserver.prototype.next = function (value) {
|
|
618
|
-
var partialObserver = this.partialObserver;
|
|
619
|
-
if (partialObserver.next) {
|
|
620
|
-
try {
|
|
621
|
-
partialObserver.next(value);
|
|
622
|
-
}
|
|
623
|
-
catch (error) {
|
|
624
|
-
handleUnhandledError(error);
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
};
|
|
628
|
-
ConsumerObserver.prototype.error = function (err) {
|
|
629
|
-
var partialObserver = this.partialObserver;
|
|
630
|
-
if (partialObserver.error) {
|
|
631
|
-
try {
|
|
632
|
-
partialObserver.error(err);
|
|
633
|
-
}
|
|
634
|
-
catch (error) {
|
|
635
|
-
handleUnhandledError(error);
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
else {
|
|
639
|
-
handleUnhandledError(err);
|
|
640
|
-
}
|
|
641
|
-
};
|
|
642
|
-
ConsumerObserver.prototype.complete = function () {
|
|
643
|
-
var partialObserver = this.partialObserver;
|
|
644
|
-
if (partialObserver.complete) {
|
|
645
|
-
try {
|
|
646
|
-
partialObserver.complete();
|
|
647
|
-
}
|
|
648
|
-
catch (error) {
|
|
649
|
-
handleUnhandledError(error);
|
|
650
|
-
}
|
|
651
|
-
}
|
|
652
|
-
};
|
|
653
|
-
return ConsumerObserver;
|
|
654
|
-
}());
|
|
655
|
-
var SafeSubscriber = (function (_super) {
|
|
656
|
-
__extends(SafeSubscriber, _super);
|
|
657
|
-
function SafeSubscriber(observerOrNext, error, complete) {
|
|
658
|
-
var _this = _super.call(this) || this;
|
|
659
|
-
var partialObserver;
|
|
660
|
-
if (isFunction(observerOrNext) || !observerOrNext) {
|
|
661
|
-
partialObserver = {
|
|
662
|
-
next: (observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined),
|
|
663
|
-
error: error !== null && error !== void 0 ? error : undefined,
|
|
664
|
-
complete: complete !== null && complete !== void 0 ? complete : undefined,
|
|
665
|
-
};
|
|
666
|
-
}
|
|
667
|
-
else {
|
|
668
|
-
var context_1;
|
|
669
|
-
if (_this && config.useDeprecatedNextContext) {
|
|
670
|
-
context_1 = Object.create(observerOrNext);
|
|
671
|
-
context_1.unsubscribe = function () { return _this.unsubscribe(); };
|
|
672
|
-
partialObserver = {
|
|
673
|
-
next: observerOrNext.next && bind(observerOrNext.next, context_1),
|
|
674
|
-
error: observerOrNext.error && bind(observerOrNext.error, context_1),
|
|
675
|
-
complete: observerOrNext.complete && bind(observerOrNext.complete, context_1),
|
|
676
|
-
};
|
|
677
|
-
}
|
|
678
|
-
else {
|
|
679
|
-
partialObserver = observerOrNext;
|
|
680
|
-
}
|
|
681
|
-
}
|
|
682
|
-
_this.destination = new ConsumerObserver(partialObserver);
|
|
683
|
-
return _this;
|
|
684
|
-
}
|
|
685
|
-
return SafeSubscriber;
|
|
686
|
-
}(Subscriber));
|
|
687
|
-
function handleUnhandledError(error) {
|
|
688
|
-
{
|
|
689
|
-
reportUnhandledError(error);
|
|
690
|
-
}
|
|
691
|
-
}
|
|
692
|
-
function defaultErrorHandler(err) {
|
|
693
|
-
throw err;
|
|
694
|
-
}
|
|
695
|
-
var EMPTY_OBSERVER = {
|
|
696
|
-
closed: true,
|
|
697
|
-
next: noop,
|
|
698
|
-
error: defaultErrorHandler,
|
|
699
|
-
complete: noop,
|
|
700
|
-
};
|
|
701
|
-
|
|
702
|
-
var observable = (function () { return (typeof Symbol === 'function' && Symbol.observable) || '@@observable'; })();
|
|
703
|
-
|
|
704
|
-
function identity(x) {
|
|
705
|
-
return x;
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
function pipeFromArray(fns) {
|
|
709
|
-
if (fns.length === 0) {
|
|
710
|
-
return identity;
|
|
711
|
-
}
|
|
712
|
-
if (fns.length === 1) {
|
|
713
|
-
return fns[0];
|
|
714
|
-
}
|
|
715
|
-
return function piped(input) {
|
|
716
|
-
return fns.reduce(function (prev, fn) { return fn(prev); }, input);
|
|
717
|
-
};
|
|
718
|
-
}
|
|
719
|
-
|
|
720
|
-
var Observable = (function () {
|
|
721
|
-
function Observable(subscribe) {
|
|
722
|
-
if (subscribe) {
|
|
723
|
-
this._subscribe = subscribe;
|
|
724
|
-
}
|
|
725
|
-
}
|
|
726
|
-
Observable.prototype.lift = function (operator) {
|
|
727
|
-
var observable = new Observable();
|
|
728
|
-
observable.source = this;
|
|
729
|
-
observable.operator = operator;
|
|
730
|
-
return observable;
|
|
731
|
-
};
|
|
732
|
-
Observable.prototype.subscribe = function (observerOrNext, error, complete) {
|
|
733
|
-
var _this = this;
|
|
734
|
-
var subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete);
|
|
735
|
-
errorContext(function () {
|
|
736
|
-
var _a = _this, operator = _a.operator, source = _a.source;
|
|
737
|
-
subscriber.add(operator
|
|
738
|
-
?
|
|
739
|
-
operator.call(subscriber, source)
|
|
740
|
-
: source
|
|
741
|
-
?
|
|
742
|
-
_this._subscribe(subscriber)
|
|
743
|
-
:
|
|
744
|
-
_this._trySubscribe(subscriber));
|
|
745
|
-
});
|
|
746
|
-
return subscriber;
|
|
747
|
-
};
|
|
748
|
-
Observable.prototype._trySubscribe = function (sink) {
|
|
749
|
-
try {
|
|
750
|
-
return this._subscribe(sink);
|
|
751
|
-
}
|
|
752
|
-
catch (err) {
|
|
753
|
-
sink.error(err);
|
|
754
|
-
}
|
|
755
|
-
};
|
|
756
|
-
Observable.prototype.forEach = function (next, promiseCtor) {
|
|
757
|
-
var _this = this;
|
|
758
|
-
promiseCtor = getPromiseCtor(promiseCtor);
|
|
759
|
-
return new promiseCtor(function (resolve, reject) {
|
|
760
|
-
var subscriber = new SafeSubscriber({
|
|
761
|
-
next: function (value) {
|
|
762
|
-
try {
|
|
763
|
-
next(value);
|
|
764
|
-
}
|
|
765
|
-
catch (err) {
|
|
766
|
-
reject(err);
|
|
767
|
-
subscriber.unsubscribe();
|
|
768
|
-
}
|
|
769
|
-
},
|
|
770
|
-
error: reject,
|
|
771
|
-
complete: resolve,
|
|
772
|
-
});
|
|
773
|
-
_this.subscribe(subscriber);
|
|
774
|
-
});
|
|
775
|
-
};
|
|
776
|
-
Observable.prototype._subscribe = function (subscriber) {
|
|
777
|
-
var _a;
|
|
778
|
-
return (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber);
|
|
779
|
-
};
|
|
780
|
-
Observable.prototype[observable] = function () {
|
|
781
|
-
return this;
|
|
782
|
-
};
|
|
783
|
-
Observable.prototype.pipe = function () {
|
|
784
|
-
var operations = [];
|
|
785
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
786
|
-
operations[_i] = arguments[_i];
|
|
787
|
-
}
|
|
788
|
-
return pipeFromArray(operations)(this);
|
|
789
|
-
};
|
|
790
|
-
Observable.prototype.toPromise = function (promiseCtor) {
|
|
791
|
-
var _this = this;
|
|
792
|
-
promiseCtor = getPromiseCtor(promiseCtor);
|
|
793
|
-
return new promiseCtor(function (resolve, reject) {
|
|
794
|
-
var value;
|
|
795
|
-
_this.subscribe(function (x) { return (value = x); }, function (err) { return reject(err); }, function () { return resolve(value); });
|
|
796
|
-
});
|
|
797
|
-
};
|
|
798
|
-
Observable.create = function (subscribe) {
|
|
799
|
-
return new Observable(subscribe);
|
|
800
|
-
};
|
|
801
|
-
return Observable;
|
|
802
|
-
}());
|
|
803
|
-
function getPromiseCtor(promiseCtor) {
|
|
804
|
-
var _a;
|
|
805
|
-
return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config.Promise) !== null && _a !== void 0 ? _a : Promise;
|
|
806
|
-
}
|
|
807
|
-
function isObserver(value) {
|
|
808
|
-
return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete);
|
|
809
|
-
}
|
|
810
|
-
function isSubscriber(value) {
|
|
811
|
-
return (value && value instanceof Subscriber) || (isObserver(value) && isSubscription(value));
|
|
812
|
-
}
|
|
813
|
-
|
|
814
|
-
var ObjectUnsubscribedError = createErrorClass(function (_super) {
|
|
815
|
-
return function ObjectUnsubscribedErrorImpl() {
|
|
816
|
-
_super(this);
|
|
817
|
-
this.name = 'ObjectUnsubscribedError';
|
|
818
|
-
this.message = 'object unsubscribed';
|
|
819
|
-
};
|
|
820
|
-
});
|
|
821
|
-
|
|
822
|
-
var Subject = (function (_super) {
|
|
823
|
-
__extends(Subject, _super);
|
|
824
|
-
function Subject() {
|
|
825
|
-
var _this = _super.call(this) || this;
|
|
826
|
-
_this.closed = false;
|
|
827
|
-
_this.currentObservers = null;
|
|
828
|
-
_this.observers = [];
|
|
829
|
-
_this.isStopped = false;
|
|
830
|
-
_this.hasError = false;
|
|
831
|
-
_this.thrownError = null;
|
|
832
|
-
return _this;
|
|
833
|
-
}
|
|
834
|
-
Subject.prototype.lift = function (operator) {
|
|
835
|
-
var subject = new AnonymousSubject(this, this);
|
|
836
|
-
subject.operator = operator;
|
|
837
|
-
return subject;
|
|
838
|
-
};
|
|
839
|
-
Subject.prototype._throwIfClosed = function () {
|
|
840
|
-
if (this.closed) {
|
|
841
|
-
throw new ObjectUnsubscribedError();
|
|
842
|
-
}
|
|
843
|
-
};
|
|
844
|
-
Subject.prototype.next = function (value) {
|
|
845
|
-
var _this = this;
|
|
846
|
-
errorContext(function () {
|
|
847
|
-
var e_1, _a;
|
|
848
|
-
_this._throwIfClosed();
|
|
849
|
-
if (!_this.isStopped) {
|
|
850
|
-
if (!_this.currentObservers) {
|
|
851
|
-
_this.currentObservers = Array.from(_this.observers);
|
|
852
|
-
}
|
|
853
|
-
try {
|
|
854
|
-
for (var _b = __values(_this.currentObservers), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
855
|
-
var observer = _c.value;
|
|
856
|
-
observer.next(value);
|
|
857
|
-
}
|
|
858
|
-
}
|
|
859
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
860
|
-
finally {
|
|
861
|
-
try {
|
|
862
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
863
|
-
}
|
|
864
|
-
finally { if (e_1) throw e_1.error; }
|
|
865
|
-
}
|
|
866
|
-
}
|
|
867
|
-
});
|
|
868
|
-
};
|
|
869
|
-
Subject.prototype.error = function (err) {
|
|
870
|
-
var _this = this;
|
|
871
|
-
errorContext(function () {
|
|
872
|
-
_this._throwIfClosed();
|
|
873
|
-
if (!_this.isStopped) {
|
|
874
|
-
_this.hasError = _this.isStopped = true;
|
|
875
|
-
_this.thrownError = err;
|
|
876
|
-
var observers = _this.observers;
|
|
877
|
-
while (observers.length) {
|
|
878
|
-
observers.shift().error(err);
|
|
879
|
-
}
|
|
880
|
-
}
|
|
881
|
-
});
|
|
882
|
-
};
|
|
883
|
-
Subject.prototype.complete = function () {
|
|
884
|
-
var _this = this;
|
|
885
|
-
errorContext(function () {
|
|
886
|
-
_this._throwIfClosed();
|
|
887
|
-
if (!_this.isStopped) {
|
|
888
|
-
_this.isStopped = true;
|
|
889
|
-
var observers = _this.observers;
|
|
890
|
-
while (observers.length) {
|
|
891
|
-
observers.shift().complete();
|
|
892
|
-
}
|
|
893
|
-
}
|
|
894
|
-
});
|
|
895
|
-
};
|
|
896
|
-
Subject.prototype.unsubscribe = function () {
|
|
897
|
-
this.isStopped = this.closed = true;
|
|
898
|
-
this.observers = this.currentObservers = null;
|
|
899
|
-
};
|
|
900
|
-
Object.defineProperty(Subject.prototype, "observed", {
|
|
901
|
-
get: function () {
|
|
902
|
-
var _a;
|
|
903
|
-
return ((_a = this.observers) === null || _a === void 0 ? void 0 : _a.length) > 0;
|
|
904
|
-
},
|
|
905
|
-
enumerable: false,
|
|
906
|
-
configurable: true
|
|
907
|
-
});
|
|
908
|
-
Subject.prototype._trySubscribe = function (subscriber) {
|
|
909
|
-
this._throwIfClosed();
|
|
910
|
-
return _super.prototype._trySubscribe.call(this, subscriber);
|
|
911
|
-
};
|
|
912
|
-
Subject.prototype._subscribe = function (subscriber) {
|
|
913
|
-
this._throwIfClosed();
|
|
914
|
-
this._checkFinalizedStatuses(subscriber);
|
|
915
|
-
return this._innerSubscribe(subscriber);
|
|
916
|
-
};
|
|
917
|
-
Subject.prototype._innerSubscribe = function (subscriber) {
|
|
918
|
-
var _this = this;
|
|
919
|
-
var _a = this, hasError = _a.hasError, isStopped = _a.isStopped, observers = _a.observers;
|
|
920
|
-
if (hasError || isStopped) {
|
|
921
|
-
return EMPTY_SUBSCRIPTION;
|
|
922
|
-
}
|
|
923
|
-
this.currentObservers = null;
|
|
924
|
-
observers.push(subscriber);
|
|
925
|
-
return new Subscription(function () {
|
|
926
|
-
_this.currentObservers = null;
|
|
927
|
-
arrRemove(observers, subscriber);
|
|
928
|
-
});
|
|
929
|
-
};
|
|
930
|
-
Subject.prototype._checkFinalizedStatuses = function (subscriber) {
|
|
931
|
-
var _a = this, hasError = _a.hasError, thrownError = _a.thrownError, isStopped = _a.isStopped;
|
|
932
|
-
if (hasError) {
|
|
933
|
-
subscriber.error(thrownError);
|
|
934
|
-
}
|
|
935
|
-
else if (isStopped) {
|
|
936
|
-
subscriber.complete();
|
|
937
|
-
}
|
|
938
|
-
};
|
|
939
|
-
Subject.prototype.asObservable = function () {
|
|
940
|
-
var observable = new Observable();
|
|
941
|
-
observable.source = this;
|
|
942
|
-
return observable;
|
|
943
|
-
};
|
|
944
|
-
Subject.create = function (destination, source) {
|
|
945
|
-
return new AnonymousSubject(destination, source);
|
|
946
|
-
};
|
|
947
|
-
return Subject;
|
|
948
|
-
}(Observable));
|
|
949
|
-
var AnonymousSubject = (function (_super) {
|
|
950
|
-
__extends(AnonymousSubject, _super);
|
|
951
|
-
function AnonymousSubject(destination, source) {
|
|
952
|
-
var _this = _super.call(this) || this;
|
|
953
|
-
_this.destination = destination;
|
|
954
|
-
_this.source = source;
|
|
955
|
-
return _this;
|
|
956
|
-
}
|
|
957
|
-
AnonymousSubject.prototype.next = function (value) {
|
|
958
|
-
var _a, _b;
|
|
959
|
-
(_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.next) === null || _b === void 0 ? void 0 : _b.call(_a, value);
|
|
960
|
-
};
|
|
961
|
-
AnonymousSubject.prototype.error = function (err) {
|
|
962
|
-
var _a, _b;
|
|
963
|
-
(_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.call(_a, err);
|
|
964
|
-
};
|
|
965
|
-
AnonymousSubject.prototype.complete = function () {
|
|
966
|
-
var _a, _b;
|
|
967
|
-
(_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.complete) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
968
|
-
};
|
|
969
|
-
AnonymousSubject.prototype._subscribe = function (subscriber) {
|
|
970
|
-
var _a, _b;
|
|
971
|
-
return (_b = (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber)) !== null && _b !== void 0 ? _b : EMPTY_SUBSCRIPTION;
|
|
972
|
-
};
|
|
973
|
-
return AnonymousSubject;
|
|
974
|
-
}(Subject));
|
|
975
|
-
|
|
976
|
-
var BehaviorSubject = (function (_super) {
|
|
977
|
-
__extends(BehaviorSubject, _super);
|
|
978
|
-
function BehaviorSubject(_value) {
|
|
979
|
-
var _this = _super.call(this) || this;
|
|
980
|
-
_this._value = _value;
|
|
981
|
-
return _this;
|
|
982
|
-
}
|
|
983
|
-
Object.defineProperty(BehaviorSubject.prototype, "value", {
|
|
984
|
-
get: function () {
|
|
985
|
-
return this.getValue();
|
|
986
|
-
},
|
|
987
|
-
enumerable: false,
|
|
988
|
-
configurable: true
|
|
989
|
-
});
|
|
990
|
-
BehaviorSubject.prototype._subscribe = function (subscriber) {
|
|
991
|
-
var subscription = _super.prototype._subscribe.call(this, subscriber);
|
|
992
|
-
!subscription.closed && subscriber.next(this._value);
|
|
993
|
-
return subscription;
|
|
994
|
-
};
|
|
995
|
-
BehaviorSubject.prototype.getValue = function () {
|
|
996
|
-
var _a = this, hasError = _a.hasError, thrownError = _a.thrownError, _value = _a._value;
|
|
997
|
-
if (hasError) {
|
|
998
|
-
throw thrownError;
|
|
999
|
-
}
|
|
1000
|
-
this._throwIfClosed();
|
|
1001
|
-
return _value;
|
|
1002
|
-
};
|
|
1003
|
-
BehaviorSubject.prototype.next = function (value) {
|
|
1004
|
-
_super.prototype.next.call(this, (this._value = value));
|
|
1005
|
-
};
|
|
1006
|
-
return BehaviorSubject;
|
|
1007
|
-
}(Subject));
|
|
1008
|
-
|
|
1009
239
|
function useReactControl(props = {}) {
|
|
1010
240
|
const [state, setCurrentState] = react.useState(props.state);
|
|
1011
241
|
const [value, setValue] = react.useState(props.state);
|
|
@@ -1015,7 +245,7 @@ function useReactControl(props = {}) {
|
|
|
1015
245
|
const [disabled, setDisabled] = react.useState(false);
|
|
1016
246
|
const [initialValue] = react.useState(props.state);
|
|
1017
247
|
const [validators, setValidators] = react.useState(props.validators);
|
|
1018
|
-
const [subscribers] = react.useState(new BehaviorSubject(props.state));
|
|
248
|
+
const [subscribers] = react.useState(new rxjs.BehaviorSubject(props.state));
|
|
1019
249
|
const elementRef = react.useRef(null);
|
|
1020
250
|
const errors = (() => validators ? controlIsValid({ state, validators }) : [])();
|
|
1021
251
|
const error = (() => errors[0])();
|