@thecb/components 3.3.9 → 3.4.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/index.cjs.js +780 -451
- package/package.json +3 -3
- package/src/components/atoms/button-with-action/ButtonWithAction.theme.js +20 -6
- package/src/components/molecules/obligation/icons/AccountBillIcon.js +2 -2
- package/src/components/molecules/obligation/icons/AccountConstructionIcon.js +2 -2
- package/src/components/molecules/obligation/icons/AccountDentalIcon.js +2 -2
- package/src/components/molecules/obligation/icons/AccountElectricIcon.js +2 -2
- package/src/components/molecules/obligation/icons/AccountGarbageIcon.js +2 -2
- package/src/components/molecules/obligation/icons/AccountGasIcon.js +2 -2
- package/src/components/molecules/obligation/icons/AccountGenericIcon.js +2 -2
- package/src/components/molecules/obligation/icons/AccountMedicalIcon.js +2 -2
- package/src/components/molecules/obligation/icons/AccountWaterIcon.js +2 -2
- package/src/components/molecules/obligation/icons/PropertyApartmentIcon.js +2 -2
- package/src/components/molecules/obligation/icons/PropertyBusinessIcon.js +2 -2
- package/src/components/molecules/obligation/icons/PropertyCarIcon.js +2 -2
- package/src/components/molecules/obligation/icons/PropertyCommercialVehicleIcon.js +2 -2
- package/src/components/molecules/obligation/icons/PropertyGarageIcon.js +2 -2
- package/src/components/molecules/obligation/icons/PropertyLandIcon.js +2 -2
- package/src/components/molecules/obligation/icons/PropertyMotorcycleIcon.js +2 -2
- package/src/components/molecules/obligation/icons/PropertyPersonalIcon.js +2 -2
- package/src/components/molecules/obligation/icons/PropertyStorefrontIcon.js +2 -2
- package/src/components/molecules/partial-amount-form/PartialAmountForm.js +6 -2
- package/src/components/molecules/partial-amount-form/PartialAmountForm.state.js +2 -2
- package/.tool-versions +0 -1
package/dist/index.cjs.js
CHANGED
|
@@ -215,6 +215,63 @@ function _nonIterableRest() {
|
|
|
215
215
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
+
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
219
|
+
var it;
|
|
220
|
+
|
|
221
|
+
if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
|
|
222
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
223
|
+
if (it) o = it;
|
|
224
|
+
var i = 0;
|
|
225
|
+
|
|
226
|
+
var F = function () {};
|
|
227
|
+
|
|
228
|
+
return {
|
|
229
|
+
s: F,
|
|
230
|
+
n: function () {
|
|
231
|
+
if (i >= o.length) return {
|
|
232
|
+
done: true
|
|
233
|
+
};
|
|
234
|
+
return {
|
|
235
|
+
done: false,
|
|
236
|
+
value: o[i++]
|
|
237
|
+
};
|
|
238
|
+
},
|
|
239
|
+
e: function (e) {
|
|
240
|
+
throw e;
|
|
241
|
+
},
|
|
242
|
+
f: F
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
var normalCompletion = true,
|
|
250
|
+
didErr = false,
|
|
251
|
+
err;
|
|
252
|
+
return {
|
|
253
|
+
s: function () {
|
|
254
|
+
it = o[Symbol.iterator]();
|
|
255
|
+
},
|
|
256
|
+
n: function () {
|
|
257
|
+
var step = it.next();
|
|
258
|
+
normalCompletion = step.done;
|
|
259
|
+
return step;
|
|
260
|
+
},
|
|
261
|
+
e: function (e) {
|
|
262
|
+
didErr = true;
|
|
263
|
+
err = e;
|
|
264
|
+
},
|
|
265
|
+
f: function () {
|
|
266
|
+
try {
|
|
267
|
+
if (!normalCompletion && it.return != null) it.return();
|
|
268
|
+
} finally {
|
|
269
|
+
if (didErr) throw err;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
|
|
218
275
|
/*! *****************************************************************************
|
|
219
276
|
Copyright (c) Microsoft Corporation.
|
|
220
277
|
|
|
@@ -12283,6 +12340,7 @@ var padding = {
|
|
|
12283
12340
|
smallPrimary: "0.75rem 1rem",
|
|
12284
12341
|
smallSecondary: "0.75rem 1rem",
|
|
12285
12342
|
smallGhost: "0",
|
|
12343
|
+
tertiary: "1rem 1.25rem",
|
|
12286
12344
|
ghost: "0.65rem 0",
|
|
12287
12345
|
danger: "1rem 1.25rem",
|
|
12288
12346
|
whiteSecondary: "0.75rem 2rem",
|
|
@@ -12296,6 +12354,7 @@ var color$1 = {
|
|
|
12296
12354
|
smallSecondary: "#15749D",
|
|
12297
12355
|
smallGhost: "#15749D",
|
|
12298
12356
|
ghost: "#15749D",
|
|
12357
|
+
tertiary: "#15749D",
|
|
12299
12358
|
danger: "#FFFFFF",
|
|
12300
12359
|
whiteSecondary: "#FFFFFF",
|
|
12301
12360
|
whitePrimary: "#FFFFFF"
|
|
@@ -12308,6 +12367,7 @@ var fontSizeVariant = {
|
|
|
12308
12367
|
smallSecondary: "pS",
|
|
12309
12368
|
smallGhost: "p",
|
|
12310
12369
|
ghost: "pL",
|
|
12370
|
+
tertiary: "pS",
|
|
12311
12371
|
danger: "pS",
|
|
12312
12372
|
whiteSecondary: "pS",
|
|
12313
12373
|
whitePrimary: "pS"
|
|
@@ -12320,6 +12380,7 @@ var fontWeight = {
|
|
|
12320
12380
|
smallSecondary: "600",
|
|
12321
12381
|
smallGhost: "400",
|
|
12322
12382
|
ghost: "600",
|
|
12383
|
+
tertiary: "600",
|
|
12323
12384
|
danger: "600",
|
|
12324
12385
|
whiteSecondary: "600",
|
|
12325
12386
|
whitePrimary: "600"
|
|
@@ -12332,6 +12393,7 @@ var height = {
|
|
|
12332
12393
|
smallSecondary: "2.5rem",
|
|
12333
12394
|
smallGhost: "1.5rem",
|
|
12334
12395
|
ghost: "3rem",
|
|
12396
|
+
tertiary: "3rem",
|
|
12335
12397
|
danger: "3rem",
|
|
12336
12398
|
whiteSecondary: "3rem",
|
|
12337
12399
|
whitePrimary: "auto"
|
|
@@ -12344,6 +12406,7 @@ var minWidth = {
|
|
|
12344
12406
|
smallSecondary: "100px",
|
|
12345
12407
|
smallGhost: "100px",
|
|
12346
12408
|
ghost: "130px",
|
|
12409
|
+
tertiary: "130px",
|
|
12347
12410
|
danger: "130px",
|
|
12348
12411
|
whiteSecondary: "160px",
|
|
12349
12412
|
whitePrimary: "130px"
|
|
@@ -12356,6 +12419,7 @@ var backgroundColor = {
|
|
|
12356
12419
|
smallSecondary: "transparent",
|
|
12357
12420
|
smallGhost: "transparent",
|
|
12358
12421
|
ghost: "transparent",
|
|
12422
|
+
tertiary: "transparent",
|
|
12359
12423
|
danger: "#ED125F",
|
|
12360
12424
|
whiteSecondary: "transparent",
|
|
12361
12425
|
whitePrimary: "transparent"
|
|
@@ -12368,6 +12432,7 @@ var border = {
|
|
|
12368
12432
|
smallSecondary: "2px solid #15749D",
|
|
12369
12433
|
smallGhost: "none",
|
|
12370
12434
|
ghost: "none",
|
|
12435
|
+
tertiary: "none",
|
|
12371
12436
|
danger: "2px solid #ED125F",
|
|
12372
12437
|
whiteSecondary: "2px solid white",
|
|
12373
12438
|
whitePrimary: "2px solid transparent"
|
|
@@ -12378,8 +12443,9 @@ var hoverBackgroundColor = {
|
|
|
12378
12443
|
back: "transparent",
|
|
12379
12444
|
smallPrimary: "#116285",
|
|
12380
12445
|
smallSecondary: "transparent",
|
|
12381
|
-
ghost: "transparent",
|
|
12382
12446
|
smallGhost: "transparent",
|
|
12447
|
+
ghost: "transparent",
|
|
12448
|
+
tertiary: "transparent",
|
|
12383
12449
|
danger: "#BA002C",
|
|
12384
12450
|
whiteSecondary: "transparent",
|
|
12385
12451
|
whitePrimary: "transparent"
|
|
@@ -12390,8 +12456,9 @@ var hoverBorderColor = {
|
|
|
12390
12456
|
back: "#DCEAF1",
|
|
12391
12457
|
smallPrimary: "#116285",
|
|
12392
12458
|
smallSecondary: "#DCEAF1",
|
|
12393
|
-
ghost: "transparent",
|
|
12394
12459
|
smallGhost: "transparent",
|
|
12460
|
+
ghost: "transparent",
|
|
12461
|
+
tertiary: "transparent",
|
|
12395
12462
|
danger: "#BA002C",
|
|
12396
12463
|
whiteSecondary: "2px solid transparent",
|
|
12397
12464
|
whitePrimary: "2px solid transparent"
|
|
@@ -12402,8 +12469,9 @@ var hoverColor = {
|
|
|
12402
12469
|
back: "#116285",
|
|
12403
12470
|
smallPrimary: "#FFFFFF",
|
|
12404
12471
|
smallSecondary: "#116285",
|
|
12405
|
-
ghost: "#116285",
|
|
12406
12472
|
smallGhost: "#116285",
|
|
12473
|
+
ghost: "#116285",
|
|
12474
|
+
tertiary: "#116285",
|
|
12407
12475
|
danger: "#FFFFFF",
|
|
12408
12476
|
whiteSecondary: "#FFFFFF",
|
|
12409
12477
|
whitePrimary: "#FFFFFF"
|
|
@@ -12414,8 +12482,9 @@ var activeBackgroundColor = {
|
|
|
12414
12482
|
back: "transparent",
|
|
12415
12483
|
smallPrimary: "#0E506D",
|
|
12416
12484
|
smallSecondary: "transparent",
|
|
12417
|
-
ghost: "transparent",
|
|
12418
12485
|
smallGhost: "transparent",
|
|
12486
|
+
ghost: "transparent",
|
|
12487
|
+
tertiary: "transparent",
|
|
12419
12488
|
danger: "#870000",
|
|
12420
12489
|
whiteSecondary: "transparent",
|
|
12421
12490
|
whitePrimary: "transparent"
|
|
@@ -12426,8 +12495,9 @@ var activeBorderColor = {
|
|
|
12426
12495
|
back: "#0E506D",
|
|
12427
12496
|
smallPrimary: "#0E506D",
|
|
12428
12497
|
smallSecondary: "#0E506D",
|
|
12429
|
-
ghost: "transparent",
|
|
12430
12498
|
smallGhost: "transparent",
|
|
12499
|
+
ghost: "transparent",
|
|
12500
|
+
tertiary: "transparent",
|
|
12431
12501
|
danger: "#870000",
|
|
12432
12502
|
whiteSecondary: "2px solid transparent",
|
|
12433
12503
|
whitePrimary: "2px solid transparent"
|
|
@@ -12438,8 +12508,9 @@ var activeColor = {
|
|
|
12438
12508
|
back: "#0E506D",
|
|
12439
12509
|
smallPrimary: "#FFFFFF",
|
|
12440
12510
|
smallSecondary: "#0E506D",
|
|
12441
|
-
ghost: "#0E506D",
|
|
12442
12511
|
smallGhost: "#0E506D",
|
|
12512
|
+
ghost: "#0E506D",
|
|
12513
|
+
tertiary: "#0E506D",
|
|
12443
12514
|
danger: "#FFFFFF",
|
|
12444
12515
|
whiteSecondary: "#FFFFFF",
|
|
12445
12516
|
whitePrimary: "#FFFFFF"
|
|
@@ -30359,345 +30430,401 @@ var ToggleSwitch = function ToggleSwitch(_ref6) {
|
|
|
30359
30430
|
|
|
30360
30431
|
var ToggleSwitch$1 = themeComponent(ToggleSwitch, "ToggleSwitch", fallbackValues$o);
|
|
30361
30432
|
|
|
30362
|
-
|
|
30363
|
-
value
|
|
30364
|
-
|
|
30365
|
-
|
|
30433
|
+
var validatorToPredicate = function validatorToPredicate(validatorFn, emptyCase) {
|
|
30434
|
+
return function (value) {
|
|
30435
|
+
for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
30436
|
+
rest[_key - 1] = arguments[_key];
|
|
30437
|
+
}
|
|
30366
30438
|
|
|
30439
|
+
return value === "" ? emptyCase : validatorFn.apply(void 0, [value].concat(rest));
|
|
30440
|
+
};
|
|
30441
|
+
};
|
|
30367
30442
|
/* eslint-disable no-unused-vars */
|
|
30368
30443
|
|
|
30369
|
-
|
|
30370
|
-
|
|
30444
|
+
|
|
30445
|
+
var createValidator = function createValidator(type, error) {
|
|
30446
|
+
var validator = function validator() {
|
|
30447
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
30448
|
+
args[_key2] = arguments[_key2];
|
|
30449
|
+
}
|
|
30450
|
+
|
|
30451
|
+
return {
|
|
30452
|
+
type: type,
|
|
30453
|
+
args: args,
|
|
30454
|
+
error: error
|
|
30455
|
+
};
|
|
30456
|
+
};
|
|
30457
|
+
|
|
30371
30458
|
validator.error = error;
|
|
30372
30459
|
return validator;
|
|
30373
30460
|
};
|
|
30374
30461
|
|
|
30375
|
-
|
|
30462
|
+
var validatorFns = {};
|
|
30463
|
+
var REQUIRED = "validator/REQUIRED";
|
|
30464
|
+
var REQUIRED_ERROR = "error/REQUIRED";
|
|
30465
|
+
var required = createValidator(REQUIRED, REQUIRED_ERROR);
|
|
30376
30466
|
|
|
30377
|
-
|
|
30378
|
-
|
|
30379
|
-
|
|
30380
|
-
validatorFns[REQUIRED] = (value, args, form) => value !== "";
|
|
30467
|
+
validatorFns[REQUIRED] = function (value, args, form) {
|
|
30468
|
+
return value !== "";
|
|
30469
|
+
};
|
|
30381
30470
|
|
|
30382
|
-
|
|
30383
|
-
|
|
30384
|
-
|
|
30385
|
-
validatorFns[ONLY_INTEGERS] = (value, args, form) => /^(-?\d+)?$/.test(value);
|
|
30471
|
+
var ONLY_INTEGERS = "validator/ONLY_INTEGERS";
|
|
30472
|
+
var ONLY_INTEGERS_ERROR = "error/ONLY_INTEGERS";
|
|
30473
|
+
var onlyIntegers = createValidator(ONLY_INTEGERS, ONLY_INTEGERS_ERROR);
|
|
30386
30474
|
|
|
30387
|
-
|
|
30388
|
-
|
|
30389
|
-
|
|
30390
|
-
validatorFns[ONLY_NATURALS] = (value, args, form) => /^(\d+)?$/.test(value);
|
|
30475
|
+
validatorFns[ONLY_INTEGERS] = function (value, args, form) {
|
|
30476
|
+
return /^(-?\d+)?$/.test(value);
|
|
30477
|
+
};
|
|
30391
30478
|
|
|
30392
|
-
|
|
30393
|
-
|
|
30394
|
-
|
|
30395
|
-
|
|
30396
|
-
|
|
30397
|
-
);
|
|
30398
|
-
|
|
30479
|
+
var ONLY_NATURALS = "validator/ONLY_NATURALS";
|
|
30480
|
+
var ONLY_NATURALS_ERROR = "error/ONLY_NATURALS";
|
|
30481
|
+
var onlyNaturals = createValidator(ONLY_NATURALS, ONLY_NATURALS_ERROR);
|
|
30482
|
+
|
|
30483
|
+
validatorFns[ONLY_NATURALS] = function (value, args, form) {
|
|
30484
|
+
return /^(\d+)?$/.test(value);
|
|
30485
|
+
};
|
|
30486
|
+
|
|
30487
|
+
var NUMBER_LESS_THAN = "validator/NUMBER_LESS_THAN";
|
|
30488
|
+
var NUMBER_LESS_THAN_ERROR = "error/NUMBER_LESS_THAN";
|
|
30489
|
+
var numberLessThan = createValidator(NUMBER_LESS_THAN, NUMBER_LESS_THAN_ERROR);
|
|
30490
|
+
|
|
30491
|
+
validatorFns[NUMBER_LESS_THAN] = function (value, args, form) {
|
|
30399
30492
|
if (value === "") {
|
|
30400
30493
|
return true;
|
|
30401
30494
|
}
|
|
30495
|
+
|
|
30402
30496
|
return Number(value) < args[0];
|
|
30403
30497
|
};
|
|
30404
30498
|
|
|
30405
|
-
|
|
30406
|
-
|
|
30407
|
-
|
|
30408
|
-
|
|
30409
|
-
|
|
30410
|
-
)
|
|
30411
|
-
|
|
30499
|
+
var NUMBER_LESS_THAN_OR_EQUAL_TO = "validator/NUMBER_LESS_THAN_OR_EQUAL_TO";
|
|
30500
|
+
var NUMBER_LESS_THAN_OR_EQUAL_TO_ERROR = "error/NUMBER_LESS_THAN_OR_EQUAL_TO";
|
|
30501
|
+
var numberLessThanOrEqualTo = createValidator(NUMBER_LESS_THAN_OR_EQUAL_TO, NUMBER_LESS_THAN_OR_EQUAL_TO_ERROR);
|
|
30502
|
+
|
|
30503
|
+
validatorFns[NUMBER_LESS_THAN_OR_EQUAL_TO] = function (value, args, form) {
|
|
30504
|
+
if (value === "") {
|
|
30505
|
+
return true;
|
|
30506
|
+
}
|
|
30507
|
+
|
|
30508
|
+
return Number(value) <= args[0];
|
|
30509
|
+
};
|
|
30510
|
+
|
|
30511
|
+
var NUMBER_GREATER_THAN = "validator/NUMBER_GREATER_THAN";
|
|
30512
|
+
var NUMBER_GREATER_THAN_ERROR = "error/NUMBER_GREATER_THAN";
|
|
30513
|
+
var numberGreaterThan = createValidator(NUMBER_GREATER_THAN, NUMBER_GREATER_THAN_ERROR);
|
|
30514
|
+
|
|
30515
|
+
validatorFns[NUMBER_GREATER_THAN] = function (value, args, form) {
|
|
30412
30516
|
if (value === "") {
|
|
30413
30517
|
return true;
|
|
30414
30518
|
}
|
|
30519
|
+
|
|
30415
30520
|
return Number(value) > args[0];
|
|
30416
30521
|
};
|
|
30417
30522
|
|
|
30418
|
-
|
|
30419
|
-
|
|
30420
|
-
|
|
30421
|
-
|
|
30523
|
+
var NUMBER_GREATER_THAN_OR_EQUAL_TO = "validator/NUMBER_GREATER_THAN_OR_EQUAL_TO";
|
|
30524
|
+
var NUMBER_GREATER_THAN_OR_EQUAL_TO_ERROR = "error/NUMBER_GREATER_THAN_OR_EQUAL_TO";
|
|
30525
|
+
var numberGreaterThanOrEqualTo = createValidator(NUMBER_GREATER_THAN_OR_EQUAL_TO, NUMBER_GREATER_THAN_OR_EQUAL_TO_ERROR);
|
|
30526
|
+
|
|
30527
|
+
validatorFns[NUMBER_GREATER_THAN_OR_EQUAL_TO] = function (value, args, form) {
|
|
30422
30528
|
if (value === "") {
|
|
30423
30529
|
return true;
|
|
30424
30530
|
}
|
|
30531
|
+
|
|
30532
|
+
return Number(value) >= args[0];
|
|
30533
|
+
};
|
|
30534
|
+
|
|
30535
|
+
var MATCHES_FIELD = "validator/MATCHES_FIELD";
|
|
30536
|
+
var MATCHES_FIELD_ERROR$1 = "error/MATCHES_FIELD";
|
|
30537
|
+
var matchesField = createValidator(MATCHES_FIELD, MATCHES_FIELD_ERROR$1);
|
|
30538
|
+
|
|
30539
|
+
validatorFns[MATCHES_FIELD] = function (value, args, form) {
|
|
30540
|
+
if (value === "") {
|
|
30541
|
+
return true;
|
|
30542
|
+
}
|
|
30543
|
+
|
|
30425
30544
|
if (form[args[0]] === undefined) {
|
|
30426
|
-
throw new Error(
|
|
30427
|
-
`${args[0]} was passed to matchesField, but that field does not exist in the form`
|
|
30428
|
-
);
|
|
30545
|
+
throw new Error("".concat(args[0], " was passed to matchesField, but that field does not exist in the form"));
|
|
30429
30546
|
}
|
|
30547
|
+
|
|
30430
30548
|
return value === form[args[0]].rawValue;
|
|
30431
30549
|
};
|
|
30432
30550
|
|
|
30433
|
-
|
|
30434
|
-
|
|
30435
|
-
|
|
30436
|
-
|
|
30437
|
-
|
|
30438
|
-
|
|
30439
|
-
|
|
30440
|
-
|
|
30441
|
-
|
|
30442
|
-
|
|
30443
|
-
|
|
30444
|
-
|
|
30445
|
-
|
|
30446
|
-
|
|
30447
|
-
|
|
30448
|
-
type: VALIDATE_WHEN,
|
|
30449
|
-
args: [dependentValidator, primaryValidator, optionalFieldName],
|
|
30450
|
-
error: dependentValidator.error
|
|
30451
|
-
});
|
|
30551
|
+
var validateWhenErrorMessage = function validateWhenErrorMessage(type) {
|
|
30552
|
+
return "".concat(type, " was passed to validateWhen, but that validator type does not exist.\n Please check that you are only calling validator creator functions exported from\n redux-freeform in your form config and that you didn't forget to\n invoke the validator creator (you cannot pass the functions themselves to\n createFormState). Also make sure you aren't passing validateWhen() to validateWhen\n as the primary validator.");
|
|
30553
|
+
};
|
|
30554
|
+
|
|
30555
|
+
var VALIDATE_WHEN = "validator/VALIDATE_WHEN";
|
|
30556
|
+
var VALIDATE_WHEN_ERROR = "error/VALIDATE_WHEN";
|
|
30557
|
+
|
|
30558
|
+
var validateWhen = function validateWhen(dependentValidator, primaryValidator, optionalFieldName) {
|
|
30559
|
+
return {
|
|
30560
|
+
type: VALIDATE_WHEN,
|
|
30561
|
+
args: [dependentValidator, primaryValidator, optionalFieldName],
|
|
30562
|
+
error: dependentValidator.error
|
|
30563
|
+
};
|
|
30564
|
+
};
|
|
30565
|
+
|
|
30452
30566
|
validateWhen.error = VALIDATE_WHEN_ERROR;
|
|
30453
|
-
validatorFns[VALIDATE_WHEN] = (value, args, form) => {
|
|
30454
|
-
const [dependentValidator, primaryValidator, optionalFieldName] = args;
|
|
30455
|
-
const dependsOnOtherField = typeof optionalFieldName === "string";
|
|
30456
30567
|
|
|
30457
|
-
|
|
30458
|
-
|
|
30459
|
-
|
|
30460
|
-
|
|
30568
|
+
validatorFns[VALIDATE_WHEN] = function (value, args, form) {
|
|
30569
|
+
var _args = _slicedToArray(args, 3),
|
|
30570
|
+
dependentValidator = _args[0],
|
|
30571
|
+
primaryValidator = _args[1],
|
|
30572
|
+
optionalFieldName = _args[2];
|
|
30573
|
+
|
|
30574
|
+
var dependsOnOtherField = typeof optionalFieldName === "string";
|
|
30575
|
+
|
|
30576
|
+
if (primaryValidator.type === undefined || typeof validatorFns[primaryValidator.type] !== "function") {
|
|
30461
30577
|
throw new Error(validateWhenErrorMessage(primaryValidator.type));
|
|
30462
30578
|
}
|
|
30579
|
+
|
|
30463
30580
|
if (dependsOnOtherField && form[optionalFieldName] === undefined) {
|
|
30464
|
-
throw new Error(
|
|
30465
|
-
`${args[2]} was passed to matchesField, but that field does not exist in the form`
|
|
30466
|
-
);
|
|
30581
|
+
throw new Error("".concat(args[2], " was passed to matchesField, but that field does not exist in the form"));
|
|
30467
30582
|
}
|
|
30468
30583
|
|
|
30469
|
-
|
|
30470
|
-
|
|
30471
|
-
|
|
30472
|
-
);
|
|
30473
|
-
|
|
30474
|
-
|
|
30475
|
-
|
|
30476
|
-
|
|
30477
|
-
|
|
30478
|
-
|
|
30479
|
-
|
|
30480
|
-
|
|
30584
|
+
var primaryPredicate = validatorToPredicate(validatorFns[primaryValidator.type], false);
|
|
30585
|
+
var primaryValue = dependsOnOtherField ? form[optionalFieldName].rawValue : value;
|
|
30586
|
+
var primaryPredicatePassed = primaryPredicate(primaryValue, primaryValidator.args, form);
|
|
30587
|
+
return primaryPredicatePassed ? validatorFns[dependentValidator.type](value, dependentValidator.args, form) : true;
|
|
30588
|
+
};
|
|
30589
|
+
|
|
30590
|
+
var validateSumErrorMessage = function validateSumErrorMessage(type) {
|
|
30591
|
+
return "".concat(type, " was passed to validateSum, but that validator type does not exist.\n Please check that you are only calling validator creator functions exported from\n redux-freeform in your form config and that you didn't forget to\n invoke the validator creator (you cannot pass the functions themselves to\n createFormState).");
|
|
30592
|
+
};
|
|
30593
|
+
|
|
30594
|
+
var VALIDATE_SUM = "validator/VALIDATE_SUM";
|
|
30595
|
+
var VALIDATE_SUM_ERROR = "error/VALIDATE_SUM";
|
|
30596
|
+
|
|
30597
|
+
var validateSum = function validateSum(validator, fieldNamesArray) {
|
|
30598
|
+
return {
|
|
30599
|
+
type: VALIDATE_SUM,
|
|
30600
|
+
args: [validator, fieldNamesArray],
|
|
30601
|
+
error: validator.error
|
|
30602
|
+
};
|
|
30603
|
+
};
|
|
30481
30604
|
|
|
30482
|
-
return primaryPredicatePassed
|
|
30483
|
-
? validatorFns[dependentValidator.type](
|
|
30484
|
-
value,
|
|
30485
|
-
dependentValidator.args,
|
|
30486
|
-
form
|
|
30487
|
-
)
|
|
30488
|
-
: true;
|
|
30489
|
-
};
|
|
30490
|
-
|
|
30491
|
-
const validateSumErrorMessage = type =>
|
|
30492
|
-
`${type} was passed to validateSum, but that validator type does not exist.
|
|
30493
|
-
Please check that you are only calling validator creator functions exported from
|
|
30494
|
-
redux-freeform in your form config and that you didn't forget to
|
|
30495
|
-
invoke the validator creator (you cannot pass the functions themselves to
|
|
30496
|
-
createFormState).`;
|
|
30497
|
-
const VALIDATE_SUM = "validator/VALIDATE_SUM";
|
|
30498
|
-
const VALIDATE_SUM_ERROR = "error/VALIDATE_SUM";
|
|
30499
|
-
const validateSum = (validator, fieldNamesArray) => ({
|
|
30500
|
-
type: VALIDATE_SUM,
|
|
30501
|
-
args: [validator, fieldNamesArray],
|
|
30502
|
-
error: validator.error
|
|
30503
|
-
});
|
|
30504
30605
|
validateSum.error = VALIDATE_SUM_ERROR;
|
|
30505
|
-
validatorFns[VALIDATE_SUM] = (value, args, form) => {
|
|
30506
|
-
const [validator, fieldNamesArray] = args;
|
|
30507
30606
|
|
|
30508
|
-
|
|
30509
|
-
|
|
30510
|
-
|
|
30511
|
-
|
|
30607
|
+
validatorFns[VALIDATE_SUM] = function (value, args, form) {
|
|
30608
|
+
var _args2 = _slicedToArray(args, 2),
|
|
30609
|
+
validator = _args2[0],
|
|
30610
|
+
fieldNamesArray = _args2[1];
|
|
30611
|
+
|
|
30612
|
+
if (validator.type === undefined || typeof validatorFns[validator.type] !== "function") {
|
|
30512
30613
|
throw new Error(validateSumErrorMessage(validator.type));
|
|
30513
30614
|
}
|
|
30514
30615
|
|
|
30515
|
-
|
|
30516
|
-
|
|
30517
|
-
|
|
30518
|
-
|
|
30519
|
-
|
|
30616
|
+
var _iterator = _createForOfIteratorHelper(fieldNamesArray),
|
|
30617
|
+
_step;
|
|
30618
|
+
|
|
30619
|
+
try {
|
|
30620
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
30621
|
+
var fieldName = _step.value;
|
|
30622
|
+
|
|
30623
|
+
if (form[fieldName] === undefined) {
|
|
30624
|
+
throw new Error("".concat(fieldName, " was passed to matchesField, but that field does not exist in the form"));
|
|
30625
|
+
}
|
|
30520
30626
|
}
|
|
30627
|
+
} catch (err) {
|
|
30628
|
+
_iterator.e(err);
|
|
30629
|
+
} finally {
|
|
30630
|
+
_iterator.f();
|
|
30521
30631
|
}
|
|
30522
30632
|
|
|
30523
|
-
|
|
30524
|
-
|
|
30525
|
-
|
|
30526
|
-
);
|
|
30527
|
-
|
|
30633
|
+
var sum = fieldNamesArray.reduce(function (acc, curr) {
|
|
30634
|
+
return acc + Number(form[curr].rawValue);
|
|
30635
|
+
}, Number(value));
|
|
30528
30636
|
return validatorFns[validator.type](sum, validator.args, form);
|
|
30529
30637
|
};
|
|
30530
30638
|
|
|
30531
|
-
|
|
30532
|
-
|
|
30533
|
-
|
|
30534
|
-
|
|
30639
|
+
var HAS_LENGTH = "validator/HAS_LENGTH";
|
|
30640
|
+
var HAS_LENGTH_ERROR = "error/HAS_LENGTH";
|
|
30641
|
+
var hasLength = createValidator(HAS_LENGTH, HAS_LENGTH_ERROR);
|
|
30642
|
+
|
|
30643
|
+
validatorFns[HAS_LENGTH] = function (value, args, form) {
|
|
30535
30644
|
if (value === "") {
|
|
30536
30645
|
return true;
|
|
30537
30646
|
}
|
|
30538
|
-
|
|
30539
|
-
|
|
30647
|
+
|
|
30648
|
+
var min = args[0];
|
|
30649
|
+
var max = args[1];
|
|
30650
|
+
|
|
30540
30651
|
if (max == undefined || min == undefined) {
|
|
30541
|
-
throw new Error(
|
|
30542
|
-
"Max and min need to be defined for hasLength, both or one of them is undefined"
|
|
30543
|
-
);
|
|
30652
|
+
throw new Error("Max and min need to be defined for hasLength, both or one of them is undefined");
|
|
30544
30653
|
}
|
|
30654
|
+
|
|
30545
30655
|
if (max < min) {
|
|
30546
|
-
throw new Error(
|
|
30547
|
-
"hasLength validator was passed a min greater than the max"
|
|
30548
|
-
);
|
|
30656
|
+
throw new Error("hasLength validator was passed a min greater than the max");
|
|
30549
30657
|
}
|
|
30550
|
-
|
|
30658
|
+
|
|
30659
|
+
var valueLength = value.length;
|
|
30551
30660
|
return max >= valueLength && valueLength >= min;
|
|
30552
30661
|
};
|
|
30553
30662
|
|
|
30554
|
-
|
|
30555
|
-
|
|
30556
|
-
|
|
30557
|
-
|
|
30663
|
+
var MATCHES_REGEX = "validator/MATCHES_REGEX";
|
|
30664
|
+
var MATCHES_REGEX_ERROR = "error/MATCHES_REGEX";
|
|
30665
|
+
var matchesRegex = createValidator(MATCHES_REGEX, MATCHES_REGEX_ERROR);
|
|
30666
|
+
|
|
30667
|
+
validatorFns[MATCHES_REGEX] = function (value, args, form) {
|
|
30558
30668
|
if (value === "") {
|
|
30559
30669
|
return true;
|
|
30560
30670
|
}
|
|
30671
|
+
|
|
30561
30672
|
return new RegExp(args[0]).test(value); // new RexExp never throws an error, no matter the input
|
|
30562
|
-
};
|
|
30673
|
+
}; // based on http://www.brainjar.com/js/validation/
|
|
30563
30674
|
|
|
30564
|
-
|
|
30565
|
-
|
|
30566
|
-
|
|
30567
|
-
|
|
30568
|
-
|
|
30569
|
-
|
|
30570
|
-
);
|
|
30571
|
-
validatorFns[IS_ROUTING_NUMBER] = (value, args, form) => {
|
|
30675
|
+
|
|
30676
|
+
var IS_ROUTING_NUMBER = "validator/IS_ROUTING_NUMBER";
|
|
30677
|
+
var IS_ROUTING_NUMBER_ERROR = "error/IS_ROUTING_NUMBER";
|
|
30678
|
+
var isRoutingNumber = createValidator(IS_ROUTING_NUMBER, IS_ROUTING_NUMBER_ERROR);
|
|
30679
|
+
|
|
30680
|
+
validatorFns[IS_ROUTING_NUMBER] = function (value, args, form) {
|
|
30572
30681
|
if (value === "") {
|
|
30573
30682
|
return true;
|
|
30574
30683
|
}
|
|
30684
|
+
|
|
30575
30685
|
if (value.length != 9) {
|
|
30576
30686
|
return false;
|
|
30577
30687
|
}
|
|
30578
|
-
|
|
30579
|
-
|
|
30580
|
-
|
|
30581
|
-
|
|
30582
|
-
|
|
30583
|
-
|
|
30584
|
-
|
|
30585
|
-
|
|
30586
|
-
|
|
30587
|
-
|
|
30588
|
-
|
|
30589
|
-
|
|
30590
|
-
|
|
30688
|
+
|
|
30689
|
+
var sum = value.split("").map(function (ch) {
|
|
30690
|
+
return parseInt(ch);
|
|
30691
|
+
}).reduce(function (acc, cur, idx) {
|
|
30692
|
+
switch (idx % 3) {
|
|
30693
|
+
case 0:
|
|
30694
|
+
return acc + 3 * cur;
|
|
30695
|
+
|
|
30696
|
+
case 1:
|
|
30697
|
+
return acc + 7 * cur;
|
|
30698
|
+
|
|
30699
|
+
case 2:
|
|
30700
|
+
return acc + 1 * cur;
|
|
30701
|
+
}
|
|
30702
|
+
}, 0);
|
|
30591
30703
|
return sum != 0 && sum % 10 == 0;
|
|
30592
30704
|
};
|
|
30593
30705
|
|
|
30594
|
-
|
|
30595
|
-
|
|
30596
|
-
|
|
30597
|
-
|
|
30706
|
+
var HAS_NUMBER = "validator/HAS_NUMBER";
|
|
30707
|
+
var HAS_NUMBER_ERROR$1 = "error/HAS_NUMBER";
|
|
30708
|
+
var hasNumber = createValidator(HAS_NUMBER, HAS_NUMBER_ERROR$1);
|
|
30709
|
+
|
|
30710
|
+
validatorFns[HAS_NUMBER] = function (value, args, form) {
|
|
30598
30711
|
if (value === "") {
|
|
30599
30712
|
return true;
|
|
30600
30713
|
}
|
|
30714
|
+
|
|
30601
30715
|
return new RegExp(/[0-9]/).test(value);
|
|
30602
30716
|
};
|
|
30603
30717
|
|
|
30604
|
-
|
|
30605
|
-
|
|
30606
|
-
|
|
30607
|
-
|
|
30608
|
-
|
|
30609
|
-
);
|
|
30610
|
-
validatorFns[HAS_LOWERCASE_LETTER] = (value, args, form) => {
|
|
30718
|
+
var HAS_LOWERCASE_LETTER = "validator/HAS_LOWERCASE_LETTER";
|
|
30719
|
+
var HAS_LOWERCASE_LETTER_ERROR$1 = "error/HAS_LOWERCASE_LETTER";
|
|
30720
|
+
var hasLowercaseLetter = createValidator(HAS_LOWERCASE_LETTER, HAS_LOWERCASE_LETTER_ERROR$1);
|
|
30721
|
+
|
|
30722
|
+
validatorFns[HAS_LOWERCASE_LETTER] = function (value, args, form) {
|
|
30611
30723
|
if (value === "") {
|
|
30612
30724
|
return true;
|
|
30613
30725
|
}
|
|
30726
|
+
|
|
30614
30727
|
return new RegExp(/[a-z]/).test(value);
|
|
30615
30728
|
};
|
|
30616
30729
|
|
|
30617
|
-
|
|
30618
|
-
|
|
30619
|
-
|
|
30620
|
-
|
|
30621
|
-
|
|
30622
|
-
);
|
|
30623
|
-
validatorFns[HAS_UPPERCASE_LETTER] = (value, args, form) => {
|
|
30730
|
+
var HAS_UPPERCASE_LETTER = "validator/HAS_UPPERCASE_LETTER";
|
|
30731
|
+
var HAS_UPPERCASE_LETTER_ERROR$1 = "error/HAS_UPPERCASE_LETTER";
|
|
30732
|
+
var hasUppercaseLetter = createValidator(HAS_UPPERCASE_LETTER, HAS_UPPERCASE_LETTER_ERROR$1);
|
|
30733
|
+
|
|
30734
|
+
validatorFns[HAS_UPPERCASE_LETTER] = function (value, args, form) {
|
|
30624
30735
|
if (value === "") {
|
|
30625
30736
|
return true;
|
|
30626
30737
|
}
|
|
30738
|
+
|
|
30627
30739
|
return new RegExp(/[A-Z]/).test(value);
|
|
30628
30740
|
};
|
|
30629
30741
|
|
|
30630
|
-
|
|
30631
|
-
|
|
30632
|
-
|
|
30633
|
-
|
|
30634
|
-
|
|
30635
|
-
);
|
|
30636
|
-
validatorFns[HAS_SPECIAL_CHARACTER] = (value, args, form) => {
|
|
30742
|
+
var HAS_SPECIAL_CHARACTER = "validator/HAS_SPECIAL_CHARACTER";
|
|
30743
|
+
var HAS_SPECIAL_CHARACTER_ERROR$1 = "error/HAS_SPECIAL_CHARACTER";
|
|
30744
|
+
var hasSpecialCharacter = createValidator(HAS_SPECIAL_CHARACTER, HAS_SPECIAL_CHARACTER_ERROR$1);
|
|
30745
|
+
|
|
30746
|
+
validatorFns[HAS_SPECIAL_CHARACTER] = function (value, args, form) {
|
|
30637
30747
|
if (value === "") {
|
|
30638
30748
|
return true;
|
|
30639
30749
|
}
|
|
30750
|
+
|
|
30640
30751
|
return new RegExp(/[!@#$%^&*.?]/).test(value);
|
|
30641
30752
|
};
|
|
30642
30753
|
|
|
30643
|
-
|
|
30644
|
-
|
|
30645
|
-
|
|
30646
|
-
|
|
30647
|
-
|
|
30648
|
-
);
|
|
30649
|
-
validatorFns[IS_PROBABLY_EMAIL] = (value, args, form) => {
|
|
30754
|
+
var IS_PROBABLY_EMAIL = "validator/IS_PROBABLY_EMAIL";
|
|
30755
|
+
var IS_PROBABLY_EMAIL_ERROR = "error/IS_PROBABLY_EMAIL";
|
|
30756
|
+
var isProbablyEmail = createValidator(IS_PROBABLY_EMAIL, IS_PROBABLY_EMAIL_ERROR);
|
|
30757
|
+
|
|
30758
|
+
validatorFns[IS_PROBABLY_EMAIL] = function (value, args, form) {
|
|
30650
30759
|
if (value === "") {
|
|
30651
30760
|
return true;
|
|
30652
30761
|
}
|
|
30762
|
+
|
|
30653
30763
|
return new RegExp(/^\S+@\S+\.\S+$/).test(value);
|
|
30654
30764
|
};
|
|
30655
30765
|
|
|
30656
|
-
|
|
30657
|
-
|
|
30658
|
-
|
|
30659
|
-
|
|
30660
|
-
|
|
30661
|
-
|
|
30766
|
+
var runValidatorErrorMessage = function runValidatorErrorMessage(type) {
|
|
30767
|
+
return "".concat(type, " was passed to runValidator, but that validator type does not exist. \n Please check that you are only calling validator creator functions exported from \n redux-freeform in your form config and that you didn't forget to \n invoke the validator creator (you cannot pass the functions themselves to \n createFormState)");
|
|
30768
|
+
};
|
|
30769
|
+
|
|
30770
|
+
var runValidator = function runValidator(validator, value, form) {
|
|
30771
|
+
var validatorFn = validatorFns[validator.type];
|
|
30662
30772
|
|
|
30663
|
-
const runValidator = (validator, value, form) => {
|
|
30664
|
-
const validatorFn = validatorFns[validator.type];
|
|
30665
30773
|
if (validatorFn === undefined) {
|
|
30666
30774
|
throw new Error(runValidatorErrorMessage(validator.type));
|
|
30667
30775
|
}
|
|
30776
|
+
|
|
30668
30777
|
return validatorFn(value, validator.args, form) ? null : validator.error;
|
|
30669
30778
|
};
|
|
30670
30779
|
|
|
30671
|
-
|
|
30672
|
-
return validators
|
|
30673
|
-
|
|
30674
|
-
|
|
30780
|
+
var _computeErrors = function _computeErrors(fieldName, form, validators) {
|
|
30781
|
+
return validators.map(function (v) {
|
|
30782
|
+
return runValidator(v, form[fieldName].rawValue, form);
|
|
30783
|
+
}).filter(function (x) {
|
|
30784
|
+
return x !== null;
|
|
30785
|
+
});
|
|
30675
30786
|
};
|
|
30676
30787
|
|
|
30677
|
-
|
|
30678
|
-
|
|
30788
|
+
var computeConstraints = function computeConstraints(fieldName, form) {
|
|
30789
|
+
var constraints = form[fieldName].constraints;
|
|
30679
30790
|
return _computeErrors(fieldName, form, constraints);
|
|
30680
30791
|
};
|
|
30681
30792
|
|
|
30682
|
-
|
|
30683
|
-
|
|
30793
|
+
var computeErrors = function computeErrors(fieldName, form) {
|
|
30794
|
+
var validators = form[fieldName].validators;
|
|
30684
30795
|
return _computeErrors(fieldName, form, validators);
|
|
30685
30796
|
};
|
|
30686
30797
|
|
|
30687
30798
|
var obj;
|
|
30688
|
-
var NOTHING = typeof Symbol !== "undefined" ? Symbol("immer-nothing") : (
|
|
30689
|
-
var DRAFTABLE = typeof Symbol !== "undefined" && Symbol
|
|
30690
|
-
var DRAFT_STATE = typeof Symbol !== "undefined" && Symbol
|
|
30799
|
+
var NOTHING = typeof Symbol !== "undefined" ? Symbol("immer-nothing") : (obj = {}, obj["immer-nothing"] = true, obj);
|
|
30800
|
+
var DRAFTABLE = typeof Symbol !== "undefined" && Symbol["for"] ? Symbol["for"]("immer-draftable") : "__$immer_draftable";
|
|
30801
|
+
var DRAFT_STATE = typeof Symbol !== "undefined" && Symbol["for"] ? Symbol["for"]("immer-state") : "__$immer_state";
|
|
30802
|
+
|
|
30691
30803
|
function isDraft(value) {
|
|
30692
30804
|
return !!value && !!value[DRAFT_STATE];
|
|
30693
30805
|
}
|
|
30806
|
+
|
|
30694
30807
|
function isDraftable(value) {
|
|
30695
|
-
if (!value
|
|
30696
|
-
|
|
30808
|
+
if (!value) {
|
|
30809
|
+
return false;
|
|
30810
|
+
}
|
|
30811
|
+
|
|
30812
|
+
return isPlainObject(value) || !!value[DRAFTABLE] || !!value.constructor[DRAFTABLE];
|
|
30813
|
+
}
|
|
30814
|
+
|
|
30815
|
+
function isPlainObject(value) {
|
|
30816
|
+
if (!value || _typeof(value) !== "object") {
|
|
30817
|
+
return false;
|
|
30818
|
+
}
|
|
30819
|
+
|
|
30820
|
+
if (Array.isArray(value)) {
|
|
30821
|
+
return true;
|
|
30822
|
+
}
|
|
30823
|
+
|
|
30697
30824
|
var proto = Object.getPrototypeOf(value);
|
|
30698
|
-
|
|
30699
|
-
return !!value[DRAFTABLE] || !!value.constructor[DRAFTABLE];
|
|
30825
|
+
return !proto || proto === Object.prototype;
|
|
30700
30826
|
}
|
|
30827
|
+
|
|
30701
30828
|
var assign = Object.assign || function assign(target, value) {
|
|
30702
30829
|
for (var key in value) {
|
|
30703
30830
|
if (has(value, key)) {
|
|
@@ -30707,11 +30834,18 @@ var assign = Object.assign || function assign(target, value) {
|
|
|
30707
30834
|
|
|
30708
30835
|
return target;
|
|
30709
30836
|
};
|
|
30710
|
-
|
|
30837
|
+
|
|
30838
|
+
var ownKeys$1 = typeof Reflect !== "undefined" && Reflect.ownKeys ? Reflect.ownKeys : typeof Object.getOwnPropertySymbols !== "undefined" ? function (obj) {
|
|
30839
|
+
return Object.getOwnPropertyNames(obj).concat(Object.getOwnPropertySymbols(obj));
|
|
30840
|
+
} : Object.getOwnPropertyNames;
|
|
30841
|
+
|
|
30711
30842
|
function shallowCopy(base, invokeGetters) {
|
|
30712
|
-
if (
|
|
30843
|
+
if (invokeGetters === void 0) invokeGetters = false;
|
|
30844
|
+
|
|
30845
|
+
if (Array.isArray(base)) {
|
|
30846
|
+
return base.slice();
|
|
30847
|
+
}
|
|
30713
30848
|
|
|
30714
|
-
if (Array.isArray(base)) { return base.slice(); }
|
|
30715
30849
|
var clone = Object.create(Object.getPrototypeOf(base));
|
|
30716
30850
|
ownKeys$1(base).forEach(function (key) {
|
|
30717
30851
|
if (key === DRAFT_STATE) {
|
|
@@ -30741,20 +30875,28 @@ function shallowCopy(base, invokeGetters) {
|
|
|
30741
30875
|
});
|
|
30742
30876
|
return clone;
|
|
30743
30877
|
}
|
|
30878
|
+
|
|
30744
30879
|
function each(value, cb) {
|
|
30745
30880
|
if (Array.isArray(value)) {
|
|
30746
|
-
for (var i = 0; i < value.length; i++) {
|
|
30881
|
+
for (var i = 0; i < value.length; i++) {
|
|
30882
|
+
cb(i, value[i], value);
|
|
30883
|
+
}
|
|
30747
30884
|
} else {
|
|
30748
|
-
ownKeys$1(value).forEach(function (key) {
|
|
30885
|
+
ownKeys$1(value).forEach(function (key) {
|
|
30886
|
+
return cb(key, value[key], value);
|
|
30887
|
+
});
|
|
30749
30888
|
}
|
|
30750
30889
|
}
|
|
30890
|
+
|
|
30751
30891
|
function isEnumerable(base, prop) {
|
|
30752
30892
|
var desc = Object.getOwnPropertyDescriptor(base, prop);
|
|
30753
30893
|
return !!desc && desc.enumerable;
|
|
30754
30894
|
}
|
|
30895
|
+
|
|
30755
30896
|
function has(thing, prop) {
|
|
30756
30897
|
return Object.prototype.hasOwnProperty.call(thing, prop);
|
|
30757
30898
|
}
|
|
30899
|
+
|
|
30758
30900
|
function is(x, y) {
|
|
30759
30901
|
// From: https://github.com/facebook/fbjs/blob/c69904a511b900266935168223063dd8772dfc40/packages/fbjs/src/core/shallowEqual.js
|
|
30760
30902
|
if (x === y) {
|
|
@@ -30764,8 +30906,26 @@ function is(x, y) {
|
|
|
30764
30906
|
}
|
|
30765
30907
|
}
|
|
30766
30908
|
|
|
30909
|
+
function clone(obj) {
|
|
30910
|
+
if (!isDraftable(obj)) {
|
|
30911
|
+
return obj;
|
|
30912
|
+
}
|
|
30913
|
+
|
|
30914
|
+
if (Array.isArray(obj)) {
|
|
30915
|
+
return obj.map(clone);
|
|
30916
|
+
}
|
|
30917
|
+
|
|
30918
|
+
var cloned = Object.create(Object.getPrototypeOf(obj));
|
|
30919
|
+
|
|
30920
|
+
for (var key in obj) {
|
|
30921
|
+
cloned[key] = clone(obj[key]);
|
|
30922
|
+
}
|
|
30923
|
+
|
|
30924
|
+
return cloned;
|
|
30925
|
+
}
|
|
30767
30926
|
/** Each scope represents a `produce` call. */
|
|
30768
30927
|
|
|
30928
|
+
|
|
30769
30929
|
var ImmerScope = function ImmerScope(parent) {
|
|
30770
30930
|
this.drafts = [];
|
|
30771
30931
|
this.parent = parent; // Whenever the modified draft contains a draft from another scope, we
|
|
@@ -30776,7 +30936,7 @@ var ImmerScope = function ImmerScope(parent) {
|
|
|
30776
30936
|
this.patches = null;
|
|
30777
30937
|
};
|
|
30778
30938
|
|
|
30779
|
-
ImmerScope.prototype.usePatches = function usePatches
|
|
30939
|
+
ImmerScope.prototype.usePatches = function usePatches(patchListener) {
|
|
30780
30940
|
if (patchListener) {
|
|
30781
30941
|
this.patches = [];
|
|
30782
30942
|
this.inversePatches = [];
|
|
@@ -30784,17 +30944,18 @@ ImmerScope.prototype.usePatches = function usePatches (patchListener) {
|
|
|
30784
30944
|
}
|
|
30785
30945
|
};
|
|
30786
30946
|
|
|
30787
|
-
ImmerScope.prototype.revoke = function revoke$1
|
|
30947
|
+
ImmerScope.prototype.revoke = function revoke$1() {
|
|
30788
30948
|
this.leave();
|
|
30789
30949
|
this.drafts.forEach(revoke);
|
|
30790
30950
|
this.drafts = null; // Make draft-related methods throw.
|
|
30791
30951
|
};
|
|
30792
30952
|
|
|
30793
|
-
ImmerScope.prototype.leave = function leave
|
|
30953
|
+
ImmerScope.prototype.leave = function leave() {
|
|
30794
30954
|
if (this === ImmerScope.current) {
|
|
30795
30955
|
ImmerScope.current = this.parent;
|
|
30796
30956
|
}
|
|
30797
30957
|
};
|
|
30958
|
+
|
|
30798
30959
|
ImmerScope.current = null;
|
|
30799
30960
|
|
|
30800
30961
|
ImmerScope.enter = function () {
|
|
@@ -30803,11 +30964,11 @@ ImmerScope.enter = function () {
|
|
|
30803
30964
|
|
|
30804
30965
|
function revoke(draft) {
|
|
30805
30966
|
draft[DRAFT_STATE].revoke();
|
|
30806
|
-
}
|
|
30967
|
+
} // but share them all instead
|
|
30807
30968
|
|
|
30808
|
-
// but share them all instead
|
|
30809
30969
|
|
|
30810
30970
|
var descriptors = {};
|
|
30971
|
+
|
|
30811
30972
|
function willFinalize(scope, result, isReplaced) {
|
|
30812
30973
|
scope.drafts.forEach(function (draft) {
|
|
30813
30974
|
draft[DRAFT_STATE].finalizing = true;
|
|
@@ -30825,6 +30986,7 @@ function willFinalize(scope, result, isReplaced) {
|
|
|
30825
30986
|
markChangesSweep(scope.drafts);
|
|
30826
30987
|
}
|
|
30827
30988
|
}
|
|
30989
|
+
|
|
30828
30990
|
function createProxy(base, parent) {
|
|
30829
30991
|
var isArray = Array.isArray(base);
|
|
30830
30992
|
var draft = clonePotentialDraft(base);
|
|
@@ -30878,7 +31040,11 @@ function peek(draft, prop) {
|
|
|
30878
31040
|
function get(state, prop) {
|
|
30879
31041
|
assertUnrevoked(state);
|
|
30880
31042
|
var value = peek(source(state), prop);
|
|
30881
|
-
|
|
31043
|
+
|
|
31044
|
+
if (state.finalizing) {
|
|
31045
|
+
return value;
|
|
31046
|
+
} // Create a draft if the value is unmodified.
|
|
31047
|
+
|
|
30882
31048
|
|
|
30883
31049
|
if (value === peek(state.base, prop) && isDraftable(value)) {
|
|
30884
31050
|
prepareCopy(state);
|
|
@@ -30893,7 +31059,10 @@ function set(state, prop, value) {
|
|
|
30893
31059
|
state.assigned[prop] = true;
|
|
30894
31060
|
|
|
30895
31061
|
if (!state.modified) {
|
|
30896
|
-
if (is(value, peek(source(state), prop))) {
|
|
31062
|
+
if (is(value, peek(source(state), prop))) {
|
|
31063
|
+
return;
|
|
31064
|
+
}
|
|
31065
|
+
|
|
30897
31066
|
markChanged(state);
|
|
30898
31067
|
prepareCopy(state);
|
|
30899
31068
|
}
|
|
@@ -30904,12 +31073,17 @@ function set(state, prop, value) {
|
|
|
30904
31073
|
function markChanged(state) {
|
|
30905
31074
|
if (!state.modified) {
|
|
30906
31075
|
state.modified = true;
|
|
30907
|
-
|
|
31076
|
+
|
|
31077
|
+
if (state.parent) {
|
|
31078
|
+
markChanged(state.parent);
|
|
31079
|
+
}
|
|
30908
31080
|
}
|
|
30909
31081
|
}
|
|
30910
31082
|
|
|
30911
31083
|
function prepareCopy(state) {
|
|
30912
|
-
if (!state.copy) {
|
|
31084
|
+
if (!state.copy) {
|
|
31085
|
+
state.copy = clonePotentialDraft(state.base);
|
|
31086
|
+
}
|
|
30913
31087
|
}
|
|
30914
31088
|
|
|
30915
31089
|
function clonePotentialDraft(base) {
|
|
@@ -30934,15 +31108,12 @@ function proxyProperty(draft, prop, enumerable) {
|
|
|
30934
31108
|
descriptors[prop] = desc = {
|
|
30935
31109
|
configurable: true,
|
|
30936
31110
|
enumerable: enumerable,
|
|
30937
|
-
|
|
30938
31111
|
get: function get$1() {
|
|
30939
31112
|
return get(this[DRAFT_STATE], prop);
|
|
30940
31113
|
},
|
|
30941
|
-
|
|
30942
31114
|
set: function set$1(value) {
|
|
30943
31115
|
set(this[DRAFT_STATE], prop, value);
|
|
30944
31116
|
}
|
|
30945
|
-
|
|
30946
31117
|
};
|
|
30947
31118
|
}
|
|
30948
31119
|
|
|
@@ -30950,7 +31121,9 @@ function proxyProperty(draft, prop, enumerable) {
|
|
|
30950
31121
|
}
|
|
30951
31122
|
|
|
30952
31123
|
function assertUnrevoked(state) {
|
|
30953
|
-
if (state.revoked === true) {
|
|
31124
|
+
if (state.revoked === true) {
|
|
31125
|
+
throw new Error("Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + JSON.stringify(source(state)));
|
|
31126
|
+
}
|
|
30954
31127
|
} // This looks expensive, but only proxies are visited, and only objects without known changes are scanned.
|
|
30955
31128
|
|
|
30956
31129
|
|
|
@@ -30964,16 +31137,27 @@ function markChangesSweep(drafts) {
|
|
|
30964
31137
|
|
|
30965
31138
|
if (!state.modified) {
|
|
30966
31139
|
if (Array.isArray(state.base)) {
|
|
30967
|
-
if (hasArrayChanges(state)) {
|
|
30968
|
-
|
|
31140
|
+
if (hasArrayChanges(state)) {
|
|
31141
|
+
markChanged(state);
|
|
31142
|
+
}
|
|
31143
|
+
} else if (hasObjectChanges(state)) {
|
|
31144
|
+
markChanged(state);
|
|
31145
|
+
}
|
|
30969
31146
|
}
|
|
30970
31147
|
}
|
|
30971
31148
|
}
|
|
30972
31149
|
|
|
30973
31150
|
function markChangesRecursively(object) {
|
|
30974
|
-
if (!object ||
|
|
31151
|
+
if (!object || _typeof(object) !== "object") {
|
|
31152
|
+
return;
|
|
31153
|
+
}
|
|
31154
|
+
|
|
30975
31155
|
var state = object[DRAFT_STATE];
|
|
30976
|
-
|
|
31156
|
+
|
|
31157
|
+
if (!state) {
|
|
31158
|
+
return;
|
|
31159
|
+
}
|
|
31160
|
+
|
|
30977
31161
|
var base = state.base;
|
|
30978
31162
|
var draft = state.draft;
|
|
30979
31163
|
var assigned = state.assigned;
|
|
@@ -31003,14 +31187,20 @@ function markChangesRecursively(object) {
|
|
|
31003
31187
|
assigned.length = true;
|
|
31004
31188
|
|
|
31005
31189
|
if (draft.length < base.length) {
|
|
31006
|
-
for (var i = draft.length; i < base.length; i++) {
|
|
31190
|
+
for (var i = draft.length; i < base.length; i++) {
|
|
31191
|
+
assigned[i] = false;
|
|
31192
|
+
}
|
|
31007
31193
|
} else {
|
|
31008
|
-
for (var i$1 = base.length; i$1 < draft.length; i$1++) {
|
|
31194
|
+
for (var i$1 = base.length; i$1 < draft.length; i$1++) {
|
|
31195
|
+
assigned[i$1] = true;
|
|
31196
|
+
}
|
|
31009
31197
|
}
|
|
31010
31198
|
|
|
31011
31199
|
for (var i$2 = 0; i$2 < draft.length; i$2++) {
|
|
31012
31200
|
// Only untouched indices trigger recursion.
|
|
31013
|
-
if (assigned[i$2] === undefined) {
|
|
31201
|
+
if (assigned[i$2] === undefined) {
|
|
31202
|
+
markChangesRecursively(draft[i$2]);
|
|
31203
|
+
}
|
|
31014
31204
|
}
|
|
31015
31205
|
}
|
|
31016
31206
|
}
|
|
@@ -31047,7 +31237,10 @@ function hasObjectChanges(state) {
|
|
|
31047
31237
|
|
|
31048
31238
|
function hasArrayChanges(state) {
|
|
31049
31239
|
var draft = state.draft;
|
|
31050
|
-
|
|
31240
|
+
|
|
31241
|
+
if (draft.length !== state.base.length) {
|
|
31242
|
+
return true;
|
|
31243
|
+
} // See #116
|
|
31051
31244
|
// If we first shorten the length, our array interceptors will be removed.
|
|
31052
31245
|
// If after that new items are added, result in the same original length,
|
|
31053
31246
|
// those last items will have no intercepting property.
|
|
@@ -31055,9 +31248,13 @@ function hasArrayChanges(state) {
|
|
|
31055
31248
|
// N.B.: splice, unshift, etc only shift values around, but not prop descriptors, so we only have to check
|
|
31056
31249
|
// the last one
|
|
31057
31250
|
|
|
31251
|
+
|
|
31058
31252
|
var descriptor = Object.getOwnPropertyDescriptor(draft, draft.length - 1); // descriptor can be null, but only for newly created sparse arrays, eg. new Array(10)
|
|
31059
31253
|
|
|
31060
|
-
if (descriptor && !descriptor.get) {
|
|
31254
|
+
if (descriptor && !descriptor.get) {
|
|
31255
|
+
return true;
|
|
31256
|
+
} // For all other cases, we don't have to compare, as they would have been picked up by the index setters
|
|
31257
|
+
|
|
31061
31258
|
|
|
31062
31259
|
return false;
|
|
31063
31260
|
}
|
|
@@ -31071,11 +31268,12 @@ function createHiddenProperty(target, prop, value) {
|
|
|
31071
31268
|
}
|
|
31072
31269
|
|
|
31073
31270
|
var legacyProxy = /*#__PURE__*/Object.freeze({
|
|
31074
|
-
|
|
31075
|
-
|
|
31271
|
+
willFinalize: willFinalize,
|
|
31272
|
+
createProxy: createProxy
|
|
31076
31273
|
});
|
|
31077
31274
|
|
|
31078
31275
|
function willFinalize$1() {}
|
|
31276
|
+
|
|
31079
31277
|
function createProxy$1(base, parent) {
|
|
31080
31278
|
var scope = parent ? parent.scope : ImmerScope.current;
|
|
31081
31279
|
var state = {
|
|
@@ -31110,33 +31308,27 @@ function createProxy$1(base, parent) {
|
|
|
31110
31308
|
scope.drafts.push(proxy);
|
|
31111
31309
|
return proxy;
|
|
31112
31310
|
}
|
|
31311
|
+
|
|
31113
31312
|
var objectTraps = {
|
|
31114
31313
|
get: get$1,
|
|
31115
|
-
|
|
31116
31314
|
has: function has(target, prop) {
|
|
31117
31315
|
return prop in source$1(target);
|
|
31118
31316
|
},
|
|
31119
|
-
|
|
31120
31317
|
ownKeys: function ownKeys(target) {
|
|
31121
31318
|
return Reflect.ownKeys(source$1(target));
|
|
31122
31319
|
},
|
|
31123
|
-
|
|
31124
31320
|
set: set$1,
|
|
31125
31321
|
deleteProperty: deleteProperty,
|
|
31126
31322
|
getOwnPropertyDescriptor: getOwnPropertyDescriptor,
|
|
31127
|
-
|
|
31128
31323
|
defineProperty: function defineProperty() {
|
|
31129
31324
|
throw new Error("Object.defineProperty() cannot be used on an Immer draft"); // prettier-ignore
|
|
31130
31325
|
},
|
|
31131
|
-
|
|
31132
31326
|
getPrototypeOf: function getPrototypeOf(target) {
|
|
31133
31327
|
return Object.getPrototypeOf(target.base);
|
|
31134
31328
|
},
|
|
31135
|
-
|
|
31136
31329
|
setPrototypeOf: function setPrototypeOf() {
|
|
31137
31330
|
throw new Error("Object.setPrototypeOf() cannot be used on an Immer draft"); // prettier-ignore
|
|
31138
31331
|
}
|
|
31139
|
-
|
|
31140
31332
|
};
|
|
31141
31333
|
var arrayTraps = {};
|
|
31142
31334
|
each(objectTraps, function (key, fn) {
|
|
@@ -31175,7 +31367,10 @@ function peek$1(draft, prop) {
|
|
|
31175
31367
|
}
|
|
31176
31368
|
|
|
31177
31369
|
function get$1(state, prop) {
|
|
31178
|
-
if (prop === DRAFT_STATE) {
|
|
31370
|
+
if (prop === DRAFT_STATE) {
|
|
31371
|
+
return state;
|
|
31372
|
+
}
|
|
31373
|
+
|
|
31179
31374
|
var drafts = state.drafts; // Check for existing draft in unmodified state.
|
|
31180
31375
|
|
|
31181
31376
|
if (!state.modified && has(drafts, prop)) {
|
|
@@ -31191,7 +31386,10 @@ function get$1(state, prop) {
|
|
|
31191
31386
|
|
|
31192
31387
|
if (state.modified) {
|
|
31193
31388
|
// Assigned values are never drafted. This catches any drafts we created, too.
|
|
31194
|
-
if (value !== peek$1(state.base, prop)) {
|
|
31389
|
+
if (value !== peek$1(state.base, prop)) {
|
|
31390
|
+
return value;
|
|
31391
|
+
} // Store drafts on the copy (when one exists).
|
|
31392
|
+
|
|
31195
31393
|
|
|
31196
31394
|
drafts = state.copy;
|
|
31197
31395
|
}
|
|
@@ -31206,7 +31404,11 @@ function set$1(state, prop, value) {
|
|
|
31206
31404
|
// values may be drafts, but falsy values are never drafts.
|
|
31207
31405
|
|
|
31208
31406
|
var isUnchanged = value ? is(baseValue, value) || value === state.drafts[prop] : is(baseValue, value) && prop in state.base;
|
|
31209
|
-
|
|
31407
|
+
|
|
31408
|
+
if (isUnchanged) {
|
|
31409
|
+
return true;
|
|
31410
|
+
}
|
|
31411
|
+
|
|
31210
31412
|
markChanged$1(state);
|
|
31211
31413
|
}
|
|
31212
31414
|
|
|
@@ -31220,9 +31422,15 @@ function deleteProperty(state, prop) {
|
|
|
31220
31422
|
if (peek$1(state.base, prop) !== undefined || prop in state.base) {
|
|
31221
31423
|
state.assigned[prop] = false;
|
|
31222
31424
|
markChanged$1(state);
|
|
31425
|
+
} else if (state.assigned[prop]) {
|
|
31426
|
+
// if an originally not assigned property was deleted
|
|
31427
|
+
delete state.assigned[prop];
|
|
31428
|
+
}
|
|
31429
|
+
|
|
31430
|
+
if (state.copy) {
|
|
31431
|
+
delete state.copy[prop];
|
|
31223
31432
|
}
|
|
31224
31433
|
|
|
31225
|
-
if (state.copy) { delete state.copy[prop]; }
|
|
31226
31434
|
return true;
|
|
31227
31435
|
} // Note: We never coerce `desc.value` into an Immer draft, because we can't make
|
|
31228
31436
|
// the same guarantee in ES5 mode.
|
|
@@ -31245,13 +31453,16 @@ function markChanged$1(state) {
|
|
|
31245
31453
|
state.modified = true;
|
|
31246
31454
|
state.copy = assign(shallowCopy(state.base), state.drafts);
|
|
31247
31455
|
state.drafts = null;
|
|
31248
|
-
|
|
31456
|
+
|
|
31457
|
+
if (state.parent) {
|
|
31458
|
+
markChanged$1(state.parent);
|
|
31459
|
+
}
|
|
31249
31460
|
}
|
|
31250
31461
|
}
|
|
31251
31462
|
|
|
31252
31463
|
var modernProxy = /*#__PURE__*/Object.freeze({
|
|
31253
|
-
|
|
31254
|
-
|
|
31464
|
+
willFinalize: willFinalize$1,
|
|
31465
|
+
createProxy: createProxy$1
|
|
31255
31466
|
});
|
|
31256
31467
|
|
|
31257
31468
|
function generatePatches(state, basePath, patches, inversePatches) {
|
|
@@ -31260,14 +31471,13 @@ function generatePatches(state, basePath, patches, inversePatches) {
|
|
|
31260
31471
|
|
|
31261
31472
|
function generateArrayPatches(state, basePath, patches, inversePatches) {
|
|
31262
31473
|
var assign, assign$1;
|
|
31263
|
-
|
|
31264
31474
|
var base = state.base;
|
|
31265
31475
|
var copy = state.copy;
|
|
31266
31476
|
var assigned = state.assigned; // Reduce complexity by ensuring `base` is never longer.
|
|
31267
31477
|
|
|
31268
31478
|
if (copy.length < base.length) {
|
|
31269
|
-
|
|
31270
|
-
|
|
31479
|
+
assign = [copy, base], base = assign[0], copy = assign[1];
|
|
31480
|
+
assign$1 = [inversePatches, patches], patches = assign$1[0], inversePatches = assign$1[1];
|
|
31271
31481
|
}
|
|
31272
31482
|
|
|
31273
31483
|
var delta = copy.length - base.length; // Find the first replaced index.
|
|
@@ -31302,7 +31512,6 @@ function generateArrayPatches(state, basePath, patches, inversePatches) {
|
|
|
31302
31512
|
}
|
|
31303
31513
|
}
|
|
31304
31514
|
|
|
31305
|
-
var useRemove = end != base.length;
|
|
31306
31515
|
var replaceCount = patches.length; // Process added indices.
|
|
31307
31516
|
|
|
31308
31517
|
for (var i$1 = end + delta - 1; i$1 >= end; --i$1) {
|
|
@@ -31312,21 +31521,9 @@ function generateArrayPatches(state, basePath, patches, inversePatches) {
|
|
|
31312
31521
|
path: path$1,
|
|
31313
31522
|
value: copy[i$1]
|
|
31314
31523
|
};
|
|
31315
|
-
|
|
31316
|
-
if (useRemove) {
|
|
31317
|
-
inversePatches.push({
|
|
31318
|
-
op: "remove",
|
|
31319
|
-
path: path$1
|
|
31320
|
-
});
|
|
31321
|
-
}
|
|
31322
|
-
} // One "replace" patch reverses all non-splicing "add" patches.
|
|
31323
|
-
|
|
31324
|
-
|
|
31325
|
-
if (!useRemove) {
|
|
31326
31524
|
inversePatches.push({
|
|
31327
|
-
op: "
|
|
31328
|
-
path:
|
|
31329
|
-
value: base.length
|
|
31525
|
+
op: "remove",
|
|
31526
|
+
path: path$1
|
|
31330
31527
|
});
|
|
31331
31528
|
}
|
|
31332
31529
|
}
|
|
@@ -31338,7 +31535,11 @@ function generateObjectPatches(state, basePath, patches, inversePatches) {
|
|
|
31338
31535
|
var origValue = base[key];
|
|
31339
31536
|
var value = copy[key];
|
|
31340
31537
|
var op = !assignedValue ? "remove" : key in base ? "replace" : "add";
|
|
31341
|
-
|
|
31538
|
+
|
|
31539
|
+
if (origValue === value && op === "replace") {
|
|
31540
|
+
return;
|
|
31541
|
+
}
|
|
31542
|
+
|
|
31342
31543
|
var path = basePath.concat(key);
|
|
31343
31544
|
patches.push(op === "remove" ? {
|
|
31344
31545
|
op: op,
|
|
@@ -31363,55 +31564,64 @@ function generateObjectPatches(state, basePath, patches, inversePatches) {
|
|
|
31363
31564
|
});
|
|
31364
31565
|
}
|
|
31365
31566
|
|
|
31366
|
-
function applyPatches(draft, patches) {
|
|
31367
|
-
for (var i = 0; i <
|
|
31368
|
-
var patch =
|
|
31567
|
+
var applyPatches = function applyPatches(draft, patches) {
|
|
31568
|
+
for (var i$1 = 0, list = patches; i$1 < list.length; i$1 += 1) {
|
|
31569
|
+
var patch = list[i$1];
|
|
31369
31570
|
var path = patch.path;
|
|
31571
|
+
var op = patch.op;
|
|
31572
|
+
var value = clone(patch.value); // used to clone patch to ensure original patch is not modified, see #411
|
|
31370
31573
|
|
|
31371
|
-
if (path.length
|
|
31372
|
-
|
|
31373
|
-
}
|
|
31374
|
-
var base = draft;
|
|
31574
|
+
if (!path.length) {
|
|
31575
|
+
throw new Error("Illegal state");
|
|
31576
|
+
}
|
|
31375
31577
|
|
|
31376
|
-
|
|
31377
|
-
base = base[path[i$1]];
|
|
31378
|
-
if (!base || typeof base !== "object") { throw new Error("Cannot apply patch, path doesn't resolve: " + path.join("/")); } // prettier-ignore
|
|
31379
|
-
}
|
|
31578
|
+
var base = draft;
|
|
31380
31579
|
|
|
31381
|
-
|
|
31580
|
+
for (var i = 0; i < path.length - 1; i++) {
|
|
31581
|
+
base = base[path[i]];
|
|
31382
31582
|
|
|
31383
|
-
|
|
31384
|
-
|
|
31385
|
-
|
|
31386
|
-
break;
|
|
31583
|
+
if (!base || _typeof(base) !== "object") {
|
|
31584
|
+
throw new Error("Cannot apply patch, path doesn't resolve: " + path.join("/"));
|
|
31585
|
+
} // prettier-ignore
|
|
31387
31586
|
|
|
31388
|
-
|
|
31389
|
-
if (Array.isArray(base)) {
|
|
31390
|
-
// TODO: support "foo/-" paths for appending to an array
|
|
31391
|
-
base.splice(key, 0, patch.value);
|
|
31392
|
-
} else {
|
|
31393
|
-
base[key] = patch.value;
|
|
31394
|
-
}
|
|
31587
|
+
}
|
|
31395
31588
|
|
|
31396
|
-
|
|
31589
|
+
var key = path[path.length - 1];
|
|
31397
31590
|
|
|
31398
|
-
|
|
31399
|
-
|
|
31400
|
-
|
|
31401
|
-
|
|
31402
|
-
|
|
31403
|
-
|
|
31591
|
+
switch (op) {
|
|
31592
|
+
case "replace":
|
|
31593
|
+
// if value is an object, then it's assigned by reference
|
|
31594
|
+
// in the following add or remove ops, the value field inside the patch will also be modifyed
|
|
31595
|
+
// so we use value from the cloned patch
|
|
31596
|
+
base[key] = value;
|
|
31597
|
+
break;
|
|
31598
|
+
|
|
31599
|
+
case "add":
|
|
31600
|
+
if (Array.isArray(base)) {
|
|
31601
|
+
// TODO: support "foo/-" paths for appending to an array
|
|
31602
|
+
base.splice(key, 0, value);
|
|
31603
|
+
} else {
|
|
31604
|
+
base[key] = value;
|
|
31605
|
+
}
|
|
31404
31606
|
|
|
31405
|
-
|
|
31607
|
+
break;
|
|
31406
31608
|
|
|
31407
|
-
|
|
31408
|
-
|
|
31409
|
-
|
|
31609
|
+
case "remove":
|
|
31610
|
+
if (Array.isArray(base)) {
|
|
31611
|
+
base.splice(key, 1);
|
|
31612
|
+
} else {
|
|
31613
|
+
delete base[key];
|
|
31614
|
+
}
|
|
31615
|
+
|
|
31616
|
+
break;
|
|
31617
|
+
|
|
31618
|
+
default:
|
|
31619
|
+
throw new Error("Unsupported patch operation: " + op);
|
|
31410
31620
|
}
|
|
31411
31621
|
}
|
|
31412
31622
|
|
|
31413
31623
|
return draft;
|
|
31414
|
-
}
|
|
31624
|
+
};
|
|
31415
31625
|
|
|
31416
31626
|
function verifyMinified() {}
|
|
31417
31627
|
|
|
@@ -31422,27 +31632,33 @@ var configDefaults = {
|
|
|
31422
31632
|
onDelete: null,
|
|
31423
31633
|
onCopy: null
|
|
31424
31634
|
};
|
|
31635
|
+
|
|
31425
31636
|
var Immer = function Immer(config) {
|
|
31426
31637
|
assign(this, configDefaults, config);
|
|
31427
31638
|
this.setUseProxies(this.useProxies);
|
|
31428
31639
|
this.produce = this.produce.bind(this);
|
|
31429
31640
|
};
|
|
31430
31641
|
|
|
31431
|
-
Immer.prototype.produce = function produce
|
|
31432
|
-
|
|
31642
|
+
Immer.prototype.produce = function produce(base, recipe, patchListener) {
|
|
31643
|
+
var this$1 = this; // curried invocation
|
|
31433
31644
|
|
|
31434
|
-
// curried invocation
|
|
31435
31645
|
if (typeof base === "function" && typeof recipe !== "function") {
|
|
31436
31646
|
var defaultBase = recipe;
|
|
31437
31647
|
recipe = base;
|
|
31438
31648
|
var self = this;
|
|
31439
31649
|
return function curriedProduce(base) {
|
|
31440
|
-
|
|
31441
|
-
|
|
31442
|
-
|
|
31443
|
-
|
|
31650
|
+
var this$1 = this;
|
|
31651
|
+
if (base === void 0) base = defaultBase;
|
|
31652
|
+
var args = [],
|
|
31653
|
+
len = arguments.length - 1;
|
|
31654
|
+
|
|
31655
|
+
while (len-- > 0) {
|
|
31656
|
+
args[len] = arguments[len + 1];
|
|
31657
|
+
}
|
|
31444
31658
|
|
|
31445
|
-
return self.produce(base, function (draft) {
|
|
31659
|
+
return self.produce(base, function (draft) {
|
|
31660
|
+
return recipe.call.apply(recipe, [this$1, draft].concat(args));
|
|
31661
|
+
}); // prettier-ignore
|
|
31446
31662
|
};
|
|
31447
31663
|
} // prettier-ignore
|
|
31448
31664
|
|
|
@@ -31468,7 +31684,11 @@ Immer.prototype.produce = function produce (base, recipe, patchListener) {
|
|
|
31468
31684
|
hasError = false;
|
|
31469
31685
|
} finally {
|
|
31470
31686
|
// finally instead of catch + rethrow better preserves original stack
|
|
31471
|
-
if (hasError) {
|
|
31687
|
+
if (hasError) {
|
|
31688
|
+
scope.revoke();
|
|
31689
|
+
} else {
|
|
31690
|
+
scope.leave();
|
|
31691
|
+
}
|
|
31472
31692
|
}
|
|
31473
31693
|
|
|
31474
31694
|
if (result instanceof Promise) {
|
|
@@ -31485,12 +31705,47 @@ Immer.prototype.produce = function produce (base, recipe, patchListener) {
|
|
|
31485
31705
|
return this.processResult(result, scope);
|
|
31486
31706
|
} else {
|
|
31487
31707
|
result = recipe(base);
|
|
31488
|
-
|
|
31708
|
+
|
|
31709
|
+
if (result === undefined) {
|
|
31710
|
+
return base;
|
|
31711
|
+
}
|
|
31712
|
+
|
|
31489
31713
|
return result !== NOTHING ? result : undefined;
|
|
31490
31714
|
}
|
|
31491
31715
|
};
|
|
31492
31716
|
|
|
31493
|
-
Immer.prototype.
|
|
31717
|
+
Immer.prototype.produceWithPatches = function produceWithPatches(arg1, arg2, arg3) {
|
|
31718
|
+
var this$1 = this;
|
|
31719
|
+
|
|
31720
|
+
if (typeof arg1 === "function") {
|
|
31721
|
+
return function (state) {
|
|
31722
|
+
var args = [],
|
|
31723
|
+
len = arguments.length - 1;
|
|
31724
|
+
|
|
31725
|
+
while (len-- > 0) {
|
|
31726
|
+
args[len] = arguments[len + 1];
|
|
31727
|
+
}
|
|
31728
|
+
|
|
31729
|
+
return this$1.produceWithPatches(state, function (draft) {
|
|
31730
|
+
return arg1.apply(void 0, [draft].concat(args));
|
|
31731
|
+
});
|
|
31732
|
+
};
|
|
31733
|
+
} // non-curried form
|
|
31734
|
+
|
|
31735
|
+
|
|
31736
|
+
if (arg3) {
|
|
31737
|
+
throw new Error("A patch listener cannot be passed to produceWithPatches");
|
|
31738
|
+
}
|
|
31739
|
+
|
|
31740
|
+
var patches, inversePatches;
|
|
31741
|
+
var nextState = this.produce(arg1, arg2, function (p, ip) {
|
|
31742
|
+
patches = p;
|
|
31743
|
+
inversePatches = ip;
|
|
31744
|
+
});
|
|
31745
|
+
return [nextState, patches, inversePatches];
|
|
31746
|
+
};
|
|
31747
|
+
|
|
31748
|
+
Immer.prototype.createDraft = function createDraft(base) {
|
|
31494
31749
|
if (!isDraftable(base)) {
|
|
31495
31750
|
throw new Error("First argument to `createDraft` must be a plain object, an array, or an immerable object"); // prettier-ignore
|
|
31496
31751
|
}
|
|
@@ -31502,7 +31757,7 @@ Immer.prototype.createDraft = function createDraft (base) {
|
|
|
31502
31757
|
return proxy;
|
|
31503
31758
|
};
|
|
31504
31759
|
|
|
31505
|
-
Immer.prototype.finishDraft = function finishDraft
|
|
31760
|
+
Immer.prototype.finishDraft = function finishDraft(draft, patchListener) {
|
|
31506
31761
|
var state = draft && draft[DRAFT_STATE];
|
|
31507
31762
|
|
|
31508
31763
|
if (!state || !state.isManual) {
|
|
@@ -31518,28 +31773,43 @@ Immer.prototype.finishDraft = function finishDraft (draft, patchListener) {
|
|
|
31518
31773
|
return this.processResult(undefined, scope);
|
|
31519
31774
|
};
|
|
31520
31775
|
|
|
31521
|
-
Immer.prototype.setAutoFreeze = function setAutoFreeze
|
|
31776
|
+
Immer.prototype.setAutoFreeze = function setAutoFreeze(value) {
|
|
31522
31777
|
this.autoFreeze = value;
|
|
31523
31778
|
};
|
|
31524
31779
|
|
|
31525
|
-
Immer.prototype.setUseProxies = function setUseProxies
|
|
31780
|
+
Immer.prototype.setUseProxies = function setUseProxies(value) {
|
|
31526
31781
|
this.useProxies = value;
|
|
31527
31782
|
assign(this, value ? modernProxy : legacyProxy);
|
|
31528
31783
|
};
|
|
31529
31784
|
|
|
31530
|
-
Immer.prototype.applyPatches = function applyPatches$1
|
|
31531
|
-
//
|
|
31785
|
+
Immer.prototype.applyPatches = function applyPatches$1(base, patches) {
|
|
31786
|
+
// If a patch replaces the entire state, take that replacement as base
|
|
31787
|
+
// before applying patches
|
|
31788
|
+
var i;
|
|
31789
|
+
|
|
31790
|
+
for (i = patches.length - 1; i >= 0; i--) {
|
|
31791
|
+
var patch = patches[i];
|
|
31792
|
+
|
|
31793
|
+
if (patch.path.length === 0 && patch.op === "replace") {
|
|
31794
|
+
base = patch.value;
|
|
31795
|
+
break;
|
|
31796
|
+
}
|
|
31797
|
+
}
|
|
31798
|
+
|
|
31532
31799
|
if (isDraft(base)) {
|
|
31800
|
+
// N.B: never hits if some patch a replacement, patches are never drafts
|
|
31533
31801
|
return applyPatches(base, patches);
|
|
31534
31802
|
} // Otherwise, produce a copy of the base state.
|
|
31535
31803
|
|
|
31536
31804
|
|
|
31537
|
-
return this.produce(base, function (draft) {
|
|
31805
|
+
return this.produce(base, function (draft) {
|
|
31806
|
+
return applyPatches(draft, patches.slice(i + 1));
|
|
31807
|
+
});
|
|
31538
31808
|
};
|
|
31539
31809
|
/** @internal */
|
|
31540
31810
|
|
|
31541
31811
|
|
|
31542
|
-
Immer.prototype.processResult = function processResult
|
|
31812
|
+
Immer.prototype.processResult = function processResult(result, scope) {
|
|
31543
31813
|
var baseDraft = scope.drafts[0];
|
|
31544
31814
|
var isReplaced = result !== undefined && result !== baseDraft;
|
|
31545
31815
|
this.willFinalize(scope, result, isReplaced);
|
|
@@ -31587,13 +31857,15 @@ Immer.prototype.processResult = function processResult (result, scope) {
|
|
|
31587
31857
|
*/
|
|
31588
31858
|
|
|
31589
31859
|
|
|
31590
|
-
Immer.prototype.finalize = function finalize
|
|
31591
|
-
|
|
31592
|
-
|
|
31860
|
+
Immer.prototype.finalize = function finalize(draft, path, scope) {
|
|
31861
|
+
var this$1 = this;
|
|
31593
31862
|
var state = draft[DRAFT_STATE];
|
|
31594
31863
|
|
|
31595
31864
|
if (!state) {
|
|
31596
|
-
if (Object.isFrozen(draft)) {
|
|
31865
|
+
if (Object.isFrozen(draft)) {
|
|
31866
|
+
return draft;
|
|
31867
|
+
}
|
|
31868
|
+
|
|
31597
31869
|
return this.finalizeTree(draft, null, scope);
|
|
31598
31870
|
} // Never finalize drafts owned by another scope.
|
|
31599
31871
|
|
|
@@ -31616,13 +31888,17 @@ Immer.prototype.finalize = function finalize (draft, path, scope) {
|
|
|
31616
31888
|
var assigned = state.assigned;
|
|
31617
31889
|
|
|
31618
31890
|
for (var prop in assigned) {
|
|
31619
|
-
if (!assigned[prop]) {
|
|
31891
|
+
if (!assigned[prop]) {
|
|
31892
|
+
this.onDelete(state, prop);
|
|
31893
|
+
}
|
|
31620
31894
|
}
|
|
31621
31895
|
} else {
|
|
31622
31896
|
var base = state.base;
|
|
31623
|
-
|
|
31897
|
+
var copy = state.copy;
|
|
31624
31898
|
each(base, function (prop) {
|
|
31625
|
-
if (!has(copy, prop)) {
|
|
31899
|
+
if (!has(copy, prop)) {
|
|
31900
|
+
this$1.onDelete(state, prop);
|
|
31901
|
+
}
|
|
31626
31902
|
});
|
|
31627
31903
|
}
|
|
31628
31904
|
}
|
|
@@ -31650,9 +31926,8 @@ Immer.prototype.finalize = function finalize (draft, path, scope) {
|
|
|
31650
31926
|
*/
|
|
31651
31927
|
|
|
31652
31928
|
|
|
31653
|
-
Immer.prototype.finalizeTree = function finalizeTree
|
|
31654
|
-
|
|
31655
|
-
|
|
31929
|
+
Immer.prototype.finalizeTree = function finalizeTree(root, rootPath, scope) {
|
|
31930
|
+
var this$1 = this;
|
|
31656
31931
|
var state = root[DRAFT_STATE];
|
|
31657
31932
|
|
|
31658
31933
|
if (state) {
|
|
@@ -31666,7 +31941,7 @@ Immer.prototype.finalizeTree = function finalizeTree (root, rootPath, scope) {
|
|
|
31666
31941
|
|
|
31667
31942
|
var needPatches = !!rootPath && !!scope.patches;
|
|
31668
31943
|
|
|
31669
|
-
var finalizeProperty = function (prop, value, parent) {
|
|
31944
|
+
var finalizeProperty = function finalizeProperty(prop, value, parent) {
|
|
31670
31945
|
if (value === parent) {
|
|
31671
31946
|
throw Error("Immer forbids circular references");
|
|
31672
31947
|
} // In the `finalizeTree` method, only the `root` object may be a draft.
|
|
@@ -31693,7 +31968,9 @@ Immer.prototype.finalizeTree = function finalizeTree (root, rootPath, scope) {
|
|
|
31693
31968
|
} // Unchanged drafts are never passed to the `onAssign` hook.
|
|
31694
31969
|
|
|
31695
31970
|
|
|
31696
|
-
if (isDraftProp && value === state.base[prop]) {
|
|
31971
|
+
if (isDraftProp && value === state.base[prop]) {
|
|
31972
|
+
return;
|
|
31973
|
+
}
|
|
31697
31974
|
} // Unchanged draft properties are ignored.
|
|
31698
31975
|
else if (isDraftProp && is(value, state.base[prop])) {
|
|
31699
31976
|
return;
|
|
@@ -31733,6 +32010,12 @@ var immer = new Immer();
|
|
|
31733
32010
|
*/
|
|
31734
32011
|
|
|
31735
32012
|
var produce = immer.produce;
|
|
32013
|
+
/**
|
|
32014
|
+
* Like `produce`, but `produceWithPatches` always returns a tuple
|
|
32015
|
+
* [nextState, patches, inversePatches] (instead of just the next state)
|
|
32016
|
+
*/
|
|
32017
|
+
|
|
32018
|
+
var produceWithPatches = immer.produceWithPatches.bind(immer);
|
|
31736
32019
|
/**
|
|
31737
32020
|
* Pass true to automatically freeze all copies created by Immer.
|
|
31738
32021
|
*
|
|
@@ -31772,103 +32055,149 @@ var createDraft = immer.createDraft.bind(immer);
|
|
|
31772
32055
|
|
|
31773
32056
|
var finishDraft = immer.finishDraft.bind(immer);
|
|
31774
32057
|
|
|
31775
|
-
|
|
31776
|
-
|
|
31777
|
-
|
|
31778
|
-
|
|
32058
|
+
var createInitialState = function createInitialState(formConfig) {
|
|
32059
|
+
var initialForm = {};
|
|
32060
|
+
var formConfigKeys = Object.keys(formConfig);
|
|
32061
|
+
|
|
32062
|
+
for (var _i = 0, _formConfigKeys = formConfigKeys; _i < _formConfigKeys.length; _i++) {
|
|
32063
|
+
var formKey = _formConfigKeys[_i];
|
|
31779
32064
|
initialForm[formKey] = {
|
|
31780
32065
|
dirty: false,
|
|
31781
32066
|
rawValue: formConfig[formKey].defaultValue || "",
|
|
31782
32067
|
validators: formConfig[formKey].validators || [],
|
|
31783
32068
|
constraints: formConfig[formKey].constraints || []
|
|
31784
32069
|
};
|
|
31785
|
-
}
|
|
31786
|
-
// Because validators require the entire form we have to do a
|
|
32070
|
+
} // Because validators require the entire form we have to do a
|
|
31787
32071
|
// second pass to add errors once the initial form has been
|
|
31788
32072
|
// constructed
|
|
31789
|
-
|
|
31790
|
-
|
|
31791
|
-
|
|
31792
|
-
|
|
32073
|
+
|
|
32074
|
+
|
|
32075
|
+
for (var _i2 = 0, _formConfigKeys2 = formConfigKeys; _i2 < _formConfigKeys2.length; _i2++) {
|
|
32076
|
+
var _formKey = _formConfigKeys2[_i2];
|
|
32077
|
+
var errors = computeErrors(_formKey, initialForm);
|
|
32078
|
+
initialForm[_formKey].errors = errors;
|
|
32079
|
+
initialForm[_formKey].hasErrors = errors.length > 0;
|
|
31793
32080
|
}
|
|
32081
|
+
|
|
31794
32082
|
return initialForm;
|
|
31795
32083
|
};
|
|
31796
32084
|
|
|
31797
|
-
|
|
31798
|
-
const set$2 = fieldName => value => ({
|
|
31799
|
-
type: SET,
|
|
31800
|
-
payload: { fieldName, value }
|
|
31801
|
-
});
|
|
32085
|
+
var SET = "field/SET";
|
|
31802
32086
|
|
|
31803
|
-
|
|
31804
|
-
|
|
31805
|
-
|
|
31806
|
-
|
|
31807
|
-
|
|
31808
|
-
|
|
31809
|
-
|
|
31810
|
-
|
|
31811
|
-
|
|
31812
|
-
|
|
31813
|
-
|
|
31814
|
-
|
|
31815
|
-
return produce(state, draftState => {
|
|
31816
|
-
let originalValue = draftState[changedFieldName].rawValue;
|
|
31817
|
-
draftState[changedFieldName].rawValue = newRawValue;
|
|
31818
|
-
if (computeConstraints(changedFieldName, draftState).length > 0) {
|
|
31819
|
-
// If the change violates constraints, revert the change
|
|
31820
|
-
draftState[changedFieldName].rawValue = originalValue;
|
|
31821
|
-
return draftState;
|
|
31822
|
-
}
|
|
32087
|
+
var set$2 = function set$2(fieldName) {
|
|
32088
|
+
return function (value) {
|
|
32089
|
+
return {
|
|
32090
|
+
type: SET,
|
|
32091
|
+
payload: {
|
|
32092
|
+
fieldName: fieldName,
|
|
32093
|
+
value: value
|
|
32094
|
+
}
|
|
32095
|
+
};
|
|
32096
|
+
};
|
|
32097
|
+
};
|
|
31823
32098
|
|
|
31824
|
-
|
|
31825
|
-
|
|
31826
|
-
|
|
31827
|
-
|
|
31828
|
-
|
|
31829
|
-
|
|
31830
|
-
|
|
31831
|
-
|
|
31832
|
-
|
|
31833
|
-
|
|
31834
|
-
|
|
31835
|
-
|
|
31836
|
-
|
|
31837
|
-
|
|
31838
|
-
|
|
31839
|
-
|
|
32099
|
+
var CLEAR = "form/CLEAR";
|
|
32100
|
+
|
|
32101
|
+
var _clear = function clear() {
|
|
32102
|
+
return {
|
|
32103
|
+
type: CLEAR
|
|
32104
|
+
};
|
|
32105
|
+
};
|
|
32106
|
+
|
|
32107
|
+
var createFormReducer = function createFormReducer(formConfig) {
|
|
32108
|
+
return function () {
|
|
32109
|
+
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : createInitialState(formConfig);
|
|
32110
|
+
var action = arguments.length > 1 ? arguments[1] : undefined;
|
|
32111
|
+
|
|
32112
|
+
switch (action.type) {
|
|
32113
|
+
case SET:
|
|
32114
|
+
var changedFieldName = action.payload.fieldName;
|
|
32115
|
+
var newRawValue = action.payload.value;
|
|
32116
|
+
return produce(state, function (draftState) {
|
|
32117
|
+
var originalValue = draftState[changedFieldName].rawValue;
|
|
32118
|
+
draftState[changedFieldName].rawValue = newRawValue;
|
|
32119
|
+
|
|
32120
|
+
if (computeConstraints(changedFieldName, draftState).length > 0) {
|
|
32121
|
+
// If the change violates constraints, revert the change
|
|
32122
|
+
draftState[changedFieldName].rawValue = originalValue;
|
|
32123
|
+
return draftState;
|
|
32124
|
+
}
|
|
32125
|
+
|
|
32126
|
+
var fields = Object.entries(draftState);
|
|
32127
|
+
|
|
32128
|
+
for (var _i3 = 0, _fields = fields; _i3 < _fields.length; _i3++) {
|
|
32129
|
+
var entry = _fields[_i3];
|
|
32130
|
+
var fieldName = entry[0];
|
|
32131
|
+
var field = entry[1];
|
|
32132
|
+
var errors = computeErrors(fieldName, draftState);
|
|
32133
|
+
var dirty = fieldName === changedFieldName ? true : field.dirty;
|
|
32134
|
+
draftState[fieldName].errors = errors;
|
|
32135
|
+
draftState[fieldName].dirty = dirty;
|
|
32136
|
+
draftState[fieldName].hasErrors = errors.length > 0;
|
|
32137
|
+
}
|
|
32138
|
+
});
|
|
32139
|
+
|
|
32140
|
+
case CLEAR:
|
|
32141
|
+
return createInitialState(formConfig);
|
|
32142
|
+
|
|
32143
|
+
default:
|
|
32144
|
+
return state;
|
|
32145
|
+
}
|
|
32146
|
+
};
|
|
31840
32147
|
};
|
|
31841
32148
|
|
|
31842
|
-
|
|
32149
|
+
var createMapDispatchToProps = function createMapDispatchToProps(formConfig) {
|
|
31843
32150
|
// Do memo-ization
|
|
31844
|
-
|
|
31845
|
-
|
|
31846
|
-
return dispatch
|
|
32151
|
+
var cachedDispatch;
|
|
32152
|
+
var cacheValue;
|
|
32153
|
+
return function (dispatch) {
|
|
31847
32154
|
if (dispatch == cachedDispatch) {
|
|
31848
32155
|
return cacheValue;
|
|
31849
32156
|
}
|
|
31850
|
-
|
|
32157
|
+
|
|
32158
|
+
var dispatchObj = {};
|
|
31851
32159
|
dispatchObj.fields = {};
|
|
31852
|
-
|
|
31853
|
-
|
|
32160
|
+
var keys = Object.keys(formConfig);
|
|
32161
|
+
|
|
32162
|
+
var _loop = function _loop() {
|
|
32163
|
+
var fieldName = _keys[_i4];
|
|
31854
32164
|
dispatchObj.fields[fieldName] = {
|
|
31855
|
-
set:
|
|
32165
|
+
set: function set(value) {
|
|
32166
|
+
return dispatch(set$2(fieldName)(value));
|
|
32167
|
+
}
|
|
31856
32168
|
};
|
|
32169
|
+
};
|
|
32170
|
+
|
|
32171
|
+
for (var _i4 = 0, _keys = keys; _i4 < _keys.length; _i4++) {
|
|
32172
|
+
_loop();
|
|
31857
32173
|
}
|
|
31858
|
-
|
|
32174
|
+
|
|
32175
|
+
dispatchObj.form = {
|
|
32176
|
+
clear: function clear() {
|
|
32177
|
+
return dispatch(_clear());
|
|
32178
|
+
}
|
|
32179
|
+
};
|
|
31859
32180
|
cachedDispatch = dispatch;
|
|
31860
|
-
cacheValue = {
|
|
32181
|
+
cacheValue = {
|
|
32182
|
+
actions: dispatchObj
|
|
32183
|
+
};
|
|
31861
32184
|
return cacheValue;
|
|
31862
32185
|
};
|
|
31863
32186
|
};
|
|
31864
32187
|
|
|
31865
|
-
|
|
32188
|
+
var mapStateToProps = function mapStateToProps(state) {
|
|
32189
|
+
return {
|
|
32190
|
+
fields: state
|
|
32191
|
+
};
|
|
32192
|
+
};
|
|
31866
32193
|
|
|
31867
|
-
|
|
31868
|
-
|
|
31869
|
-
|
|
31870
|
-
|
|
31871
|
-
|
|
32194
|
+
var createFormState = function createFormState(formConfig) {
|
|
32195
|
+
return {
|
|
32196
|
+
reducer: createFormReducer(formConfig),
|
|
32197
|
+
mapDispatchToProps: createMapDispatchToProps(formConfig),
|
|
32198
|
+
mapStateToProps: mapStateToProps
|
|
32199
|
+
};
|
|
32200
|
+
};
|
|
31872
32201
|
|
|
31873
32202
|
var formatDelimiter = "_";
|
|
31874
32203
|
var phoneFormats = ["", "_", "__", "(___) ", "(___) _", "(___) __", "(___) ___-", "(___) ___-_", "(___) ___-__", "(___) ___-___", "(___) ___-____"];
|
|
@@ -34261,8 +34590,8 @@ var NavMenuMobile$1 = themeComponent(NavMenuMobile, "NavMenu", fallbackValues$s)
|
|
|
34261
34590
|
|
|
34262
34591
|
var AccountBillIcon = function AccountBillIcon() {
|
|
34263
34592
|
return /*#__PURE__*/React__default.createElement("svg", {
|
|
34264
|
-
width: "
|
|
34265
|
-
height: "
|
|
34593
|
+
width: "51px",
|
|
34594
|
+
height: "51px",
|
|
34266
34595
|
viewBox: "0 0 81 81",
|
|
34267
34596
|
version: "1.1",
|
|
34268
34597
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -34337,8 +34666,8 @@ var AccountBillIcon = function AccountBillIcon() {
|
|
|
34337
34666
|
|
|
34338
34667
|
var AccountGenericIcon = function AccountGenericIcon() {
|
|
34339
34668
|
return /*#__PURE__*/React__default.createElement("svg", {
|
|
34340
|
-
width: "
|
|
34341
|
-
height: "
|
|
34669
|
+
width: "51px",
|
|
34670
|
+
height: "51px",
|
|
34342
34671
|
viewBox: "0 0 81 81",
|
|
34343
34672
|
version: "1.1",
|
|
34344
34673
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -34413,8 +34742,8 @@ var AccountGenericIcon = function AccountGenericIcon() {
|
|
|
34413
34742
|
|
|
34414
34743
|
var AccountConstructionIcon = function AccountConstructionIcon() {
|
|
34415
34744
|
return /*#__PURE__*/React__default.createElement("svg", {
|
|
34416
|
-
width: "
|
|
34417
|
-
height: "
|
|
34745
|
+
width: "51px",
|
|
34746
|
+
height: "51px",
|
|
34418
34747
|
viewBox: "0 0 81 81",
|
|
34419
34748
|
version: "1.1",
|
|
34420
34749
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -34492,8 +34821,8 @@ var AccountConstructionIcon = function AccountConstructionIcon() {
|
|
|
34492
34821
|
|
|
34493
34822
|
var AccountDentalIcon = function AccountDentalIcon() {
|
|
34494
34823
|
return /*#__PURE__*/React__default.createElement("svg", {
|
|
34495
|
-
width: "
|
|
34496
|
-
height: "
|
|
34824
|
+
width: "51px",
|
|
34825
|
+
height: "51px",
|
|
34497
34826
|
viewBox: "0 0 81 81",
|
|
34498
34827
|
version: "1.1",
|
|
34499
34828
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -34571,8 +34900,8 @@ var AccountDentalIcon = function AccountDentalIcon() {
|
|
|
34571
34900
|
|
|
34572
34901
|
var AccountElectricIcon = function AccountElectricIcon() {
|
|
34573
34902
|
return /*#__PURE__*/React__default.createElement("svg", {
|
|
34574
|
-
width: "
|
|
34575
|
-
height: "
|
|
34903
|
+
width: "51px",
|
|
34904
|
+
height: "51px",
|
|
34576
34905
|
viewBox: "0 0 81 81",
|
|
34577
34906
|
version: "1.1",
|
|
34578
34907
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -34650,8 +34979,8 @@ var AccountElectricIcon = function AccountElectricIcon() {
|
|
|
34650
34979
|
|
|
34651
34980
|
var AccountGarbageIcon = function AccountGarbageIcon() {
|
|
34652
34981
|
return /*#__PURE__*/React__default.createElement("svg", {
|
|
34653
|
-
width: "
|
|
34654
|
-
height: "
|
|
34982
|
+
width: "51px",
|
|
34983
|
+
height: "51px",
|
|
34655
34984
|
viewBox: "0 0 81 81",
|
|
34656
34985
|
version: "1.1",
|
|
34657
34986
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -34729,8 +35058,8 @@ var AccountGarbageIcon = function AccountGarbageIcon() {
|
|
|
34729
35058
|
|
|
34730
35059
|
var AccountGasIcon = function AccountGasIcon() {
|
|
34731
35060
|
return /*#__PURE__*/React__default.createElement("svg", {
|
|
34732
|
-
width: "
|
|
34733
|
-
height: "
|
|
35061
|
+
width: "51px",
|
|
35062
|
+
height: "51px",
|
|
34734
35063
|
viewBox: "0 0 81 81",
|
|
34735
35064
|
version: "1.1",
|
|
34736
35065
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -34808,8 +35137,8 @@ var AccountGasIcon = function AccountGasIcon() {
|
|
|
34808
35137
|
|
|
34809
35138
|
var AccountMedicalIcon = function AccountMedicalIcon() {
|
|
34810
35139
|
return /*#__PURE__*/React__default.createElement("svg", {
|
|
34811
|
-
width: "
|
|
34812
|
-
height: "
|
|
35140
|
+
width: "51px",
|
|
35141
|
+
height: "51px",
|
|
34813
35142
|
viewBox: "0 0 81 81",
|
|
34814
35143
|
version: "1.1",
|
|
34815
35144
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -34887,8 +35216,8 @@ var AccountMedicalIcon = function AccountMedicalIcon() {
|
|
|
34887
35216
|
|
|
34888
35217
|
var AccountWaterIcon = function AccountWaterIcon() {
|
|
34889
35218
|
return /*#__PURE__*/React__default.createElement("svg", {
|
|
34890
|
-
width: "
|
|
34891
|
-
height: "
|
|
35219
|
+
width: "51px",
|
|
35220
|
+
height: "51px",
|
|
34892
35221
|
viewBox: "0 0 81 81",
|
|
34893
35222
|
version: "1.1",
|
|
34894
35223
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -34966,8 +35295,8 @@ var AccountWaterIcon = function AccountWaterIcon() {
|
|
|
34966
35295
|
|
|
34967
35296
|
var PropertyApartmentIcon = function PropertyApartmentIcon() {
|
|
34968
35297
|
return /*#__PURE__*/React__default.createElement("svg", {
|
|
34969
|
-
width: "
|
|
34970
|
-
height: "
|
|
35298
|
+
width: "51px",
|
|
35299
|
+
height: "51px",
|
|
34971
35300
|
viewBox: "0 0 81 81",
|
|
34972
35301
|
version: "1.1",
|
|
34973
35302
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -35048,8 +35377,8 @@ var PropertyApartmentIcon = function PropertyApartmentIcon() {
|
|
|
35048
35377
|
|
|
35049
35378
|
var PropertyBusinessIcon = function PropertyBusinessIcon() {
|
|
35050
35379
|
return /*#__PURE__*/React__default.createElement("svg", {
|
|
35051
|
-
width: "
|
|
35052
|
-
height: "
|
|
35380
|
+
width: "51px",
|
|
35381
|
+
height: "51px",
|
|
35053
35382
|
viewBox: "0 0 81 81",
|
|
35054
35383
|
version: "1.1",
|
|
35055
35384
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -35124,8 +35453,8 @@ var PropertyBusinessIcon = function PropertyBusinessIcon() {
|
|
|
35124
35453
|
|
|
35125
35454
|
var PropertyCarIcon = function PropertyCarIcon() {
|
|
35126
35455
|
return /*#__PURE__*/React__default.createElement("svg", {
|
|
35127
|
-
width: "
|
|
35128
|
-
height: "
|
|
35456
|
+
width: "51px",
|
|
35457
|
+
height: "51px",
|
|
35129
35458
|
viewBox: "0 0 81 81",
|
|
35130
35459
|
version: "1.1",
|
|
35131
35460
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -35206,8 +35535,8 @@ var PropertyCarIcon = function PropertyCarIcon() {
|
|
|
35206
35535
|
|
|
35207
35536
|
var PropertyCommercialVehicleIcon = function PropertyCommercialVehicleIcon() {
|
|
35208
35537
|
return /*#__PURE__*/React__default.createElement("svg", {
|
|
35209
|
-
width: "
|
|
35210
|
-
height: "
|
|
35538
|
+
width: "51px",
|
|
35539
|
+
height: "51px",
|
|
35211
35540
|
viewBox: "0 0 81 81",
|
|
35212
35541
|
version: "1.1",
|
|
35213
35542
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -35288,8 +35617,8 @@ var PropertyCommercialVehicleIcon = function PropertyCommercialVehicleIcon() {
|
|
|
35288
35617
|
|
|
35289
35618
|
var PropertyGarageIcon = function PropertyGarageIcon() {
|
|
35290
35619
|
return /*#__PURE__*/React__default.createElement("svg", {
|
|
35291
|
-
width: "
|
|
35292
|
-
height: "
|
|
35620
|
+
width: "51px",
|
|
35621
|
+
height: "51px",
|
|
35293
35622
|
viewBox: "0 0 81 81",
|
|
35294
35623
|
version: "1.1",
|
|
35295
35624
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -35369,8 +35698,8 @@ var PropertyGarageIcon = function PropertyGarageIcon() {
|
|
|
35369
35698
|
|
|
35370
35699
|
var PropertyLandIcon = function PropertyLandIcon() {
|
|
35371
35700
|
return /*#__PURE__*/React__default.createElement("svg", {
|
|
35372
|
-
width: "
|
|
35373
|
-
height: "
|
|
35701
|
+
width: "51px",
|
|
35702
|
+
height: "51px",
|
|
35374
35703
|
viewBox: "0 0 81 81",
|
|
35375
35704
|
version: "1.1",
|
|
35376
35705
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -35451,8 +35780,8 @@ var PropertyLandIcon = function PropertyLandIcon() {
|
|
|
35451
35780
|
|
|
35452
35781
|
var PropertyMotorcycleIcon = function PropertyMotorcycleIcon() {
|
|
35453
35782
|
return /*#__PURE__*/React__default.createElement("svg", {
|
|
35454
|
-
width: "
|
|
35455
|
-
height: "
|
|
35783
|
+
width: "51px",
|
|
35784
|
+
height: "51px",
|
|
35456
35785
|
viewBox: "0 0 81 81",
|
|
35457
35786
|
version: "1.1",
|
|
35458
35787
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -35533,8 +35862,8 @@ var PropertyMotorcycleIcon = function PropertyMotorcycleIcon() {
|
|
|
35533
35862
|
|
|
35534
35863
|
var PropertyStorefrontIcon = function PropertyStorefrontIcon() {
|
|
35535
35864
|
return /*#__PURE__*/React__default.createElement("svg", {
|
|
35536
|
-
width: "
|
|
35537
|
-
height: "
|
|
35865
|
+
width: "51px",
|
|
35866
|
+
height: "51px",
|
|
35538
35867
|
viewBox: "0 0 81 81",
|
|
35539
35868
|
version: "1.1",
|
|
35540
35869
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -35615,8 +35944,8 @@ var PropertyStorefrontIcon = function PropertyStorefrontIcon() {
|
|
|
35615
35944
|
|
|
35616
35945
|
var PropertyPersonalIcon = function PropertyPersonalIcon() {
|
|
35617
35946
|
return /*#__PURE__*/React__default.createElement("svg", {
|
|
35618
|
-
width: "
|
|
35619
|
-
height: "
|
|
35947
|
+
width: "51px",
|
|
35948
|
+
height: "51px",
|
|
35620
35949
|
viewBox: "0 0 81 81",
|
|
35621
35950
|
version: "1.1",
|
|
35622
35951
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -35916,7 +36245,7 @@ var PartialAmountForm = function PartialAmountForm(_ref) {
|
|
|
35916
36245
|
}, []);
|
|
35917
36246
|
}
|
|
35918
36247
|
|
|
35919
|
-
var amountErrors = (_amountErrors = {}, _defineProperty(_amountErrors, required.error, "Amount is required"), _defineProperty(_amountErrors, numberGreaterThan.error, "Your total payment must be greater than ".concat(displayCurrency(minimum))), _defineProperty(_amountErrors,
|
|
36248
|
+
var amountErrors = (_amountErrors = {}, _defineProperty(_amountErrors, required.error, "Amount is required"), _defineProperty(_amountErrors, numberGreaterThan.error, "Your total payment must be greater than ".concat(displayCurrency(minimum))), _defineProperty(_amountErrors, numberLessThanOrEqualTo.error, "Your total payment must be less than ".concat(displayCurrency(maximum))), _amountErrors);
|
|
35920
36249
|
var lineItemsNew = Array.isArray(lineItems) ? lineItems : [];
|
|
35921
36250
|
return /*#__PURE__*/React__default.createElement(FormContainer$1, {
|
|
35922
36251
|
variant: variant,
|
|
@@ -35961,7 +36290,7 @@ var createPartialAmountFormState = function createPartialAmountFormState(lineIte
|
|
|
35961
36290
|
}, []))];
|
|
35962
36291
|
|
|
35963
36292
|
if (!!maximum) {
|
|
35964
|
-
validators.push(validateSum(
|
|
36293
|
+
validators.push(validateSum(numberLessThanOrEqualTo(maximum), lineItems.filter(function (lineItem) {
|
|
35965
36294
|
return lineItem != item;
|
|
35966
36295
|
}).reduce(function (acc, curr) {
|
|
35967
36296
|
return [].concat(_toConsumableArray(acc), [curr.id]);
|