vee-validate 3.4.5 → 3.4.9

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.
@@ -1,6 +1,6 @@
1
1
  /**
2
- * vee-validate v3.4.5
3
- * (c) 2020 Abdelrahman Awad
2
+ * vee-validate v3.4.9
3
+ * (c) 2021 Abdelrahman Awad
4
4
  * @license MIT
5
5
  */
6
6
  import Vue from 'vue';
@@ -34,7 +34,7 @@ var messages = {
34
34
  size: "The {_field_} field size must be less than {size}KB",
35
35
  double: "The {_field_} field must be a valid decimal"
36
36
  };
37
- var en = {
37
+ var en$1 = {
38
38
  code: code,
39
39
  messages: messages
40
40
  };
@@ -44,7 +44,7 @@ var en = {
44
44
  * https://github.com/chriso/validator.js/blob/master/src/lib/alpha.js
45
45
  */
46
46
  /* eslint-disable no-misleading-character-class */
47
- var alpha = {
47
+ var alpha$1 = {
48
48
  en: /^[A-Z]*$/i,
49
49
  cs: /^[A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]*$/i,
50
50
  da: /^[A-ZÆØÅ]*$/i,
@@ -67,7 +67,8 @@ var alpha = {
67
67
  uk: /^[А-ЩЬЮЯЄІЇҐ]*$/i,
68
68
  ar: /^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]*$/,
69
69
  az: /^[A-ZÇƏĞİıÖŞÜ]*$/i,
70
- el: /^[Α-ώ]*$/i
70
+ el: /^[Α-ώ]*$/i,
71
+ ja: /[\u3000-\u303F]|[\u3040-\u309F]|[\u30A0-\u30FF]|[\uFF00-\uFFEF]|[\u4E00-\u9FAF]/g
71
72
  };
72
73
  var alphaSpaces = {
73
74
  en: /^[A-Z\s]*$/i,
@@ -92,7 +93,8 @@ var alphaSpaces = {
92
93
  uk: /^[А-ЩЬЮЯЄІЇҐ\s]*$/i,
93
94
  ar: /^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ\s]*$/,
94
95
  az: /^[A-ZÇƏĞİıÖŞÜ\s]*$/i,
95
- el: /^[Α-ώ\s]*$/i
96
+ el: /^[Α-ώ\s]*$/i,
97
+ ja: /[\u3000-\u303F]|[\u3040-\u309F]|[\u30A0-\u30FF]|[\uFF00-\uFFEF]|[\u4E00-\u9FAF]/g
96
98
  };
97
99
  var alphanumeric = {
98
100
  en: /^[0-9A-Z]*$/i,
@@ -117,7 +119,8 @@ var alphanumeric = {
117
119
  uk: /^[0-9А-ЩЬЮЯЄІЇҐ]*$/i,
118
120
  ar: /^[٠١٢٣٤٥٦٧٨٩0-9ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]*$/,
119
121
  az: /^[0-9A-ZÇƏĞİıÖŞÜ]*$/i,
120
- el: /^[0-9Α-ώ]*$/i
122
+ el: /^[0-9Α-ώ]*$/i,
123
+ ja: /[\u3000-\u303F]|[\u3040-\u309F]|[\u30A0-\u30FF]|[\uFF00-\uFFEF]|[\u4E00-\u9FAF]/g
121
124
  };
122
125
  var alphaDash = {
123
126
  en: /^[0-9A-Z_-]*$/i,
@@ -142,34 +145,35 @@ var alphaDash = {
142
145
  uk: /^[0-9А-ЩЬЮЯЄІЇҐ_-]*$/i,
143
146
  ar: /^[٠١٢٣٤٥٦٧٨٩0-9ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ_-]*$/,
144
147
  az: /^[0-9A-ZÇƏĞİıÖŞÜ_-]*$/i,
145
- el: /^[0-9Α-ώ_-]*$/i
148
+ el: /^[0-9Α-ώ_-]*$/i,
149
+ ja: /[\u3000-\u303F]|[\u3040-\u309F]|[\u30A0-\u30FF]|[\uFF00-\uFFEF]|[\u4E00-\u9FAF]/g
146
150
  };
147
151
 
148
- var validate = function (value, _a) {
152
+ var validate$s = function (value, _a) {
149
153
  var _b = (_a === void 0 ? {} : _a).locale, locale = _b === void 0 ? '' : _b;
150
154
  if (Array.isArray(value)) {
151
- return value.every(function (val) { return validate(val, { locale: locale }); });
155
+ return value.every(function (val) { return validate$s(val, { locale: locale }); });
152
156
  }
153
157
  // Match at least one locale.
154
158
  if (!locale) {
155
- return Object.keys(alpha).some(function (loc) { return alpha[loc].test(value); });
159
+ return Object.keys(alpha$1).some(function (loc) { return alpha$1[loc].test(value); });
156
160
  }
157
- return (alpha[locale] || alpha.en).test(value);
161
+ return (alpha$1[locale] || alpha$1.en).test(value);
158
162
  };
159
- var params = [
163
+ var params$k = [
160
164
  {
161
165
  name: 'locale'
162
166
  }
163
167
  ];
164
- var alpha$1 = {
165
- validate: validate,
166
- params: params
168
+ var alpha = {
169
+ validate: validate$s,
170
+ params: params$k
167
171
  };
168
172
 
169
- var validate$1 = function (value, _a) {
173
+ var validate$r = function (value, _a) {
170
174
  var _b = (_a === void 0 ? {} : _a).locale, locale = _b === void 0 ? '' : _b;
171
175
  if (Array.isArray(value)) {
172
- return value.every(function (val) { return validate$1(val, { locale: locale }); });
176
+ return value.every(function (val) { return validate$r(val, { locale: locale }); });
173
177
  }
174
178
  // Match at least one locale.
175
179
  if (!locale) {
@@ -177,20 +181,20 @@ var validate$1 = function (value, _a) {
177
181
  }
178
182
  return (alphaDash[locale] || alphaDash.en).test(value);
179
183
  };
180
- var params$1 = [
184
+ var params$j = [
181
185
  {
182
186
  name: 'locale'
183
187
  }
184
188
  ];
185
189
  var alpha_dash = {
186
- validate: validate$1,
187
- params: params$1
190
+ validate: validate$r,
191
+ params: params$j
188
192
  };
189
193
 
190
- var validate$2 = function (value, _a) {
194
+ var validate$q = function (value, _a) {
191
195
  var _b = (_a === void 0 ? {} : _a).locale, locale = _b === void 0 ? '' : _b;
192
196
  if (Array.isArray(value)) {
193
- return value.every(function (val) { return validate$2(val, { locale: locale }); });
197
+ return value.every(function (val) { return validate$q(val, { locale: locale }); });
194
198
  }
195
199
  // Match at least one locale.
196
200
  if (!locale) {
@@ -198,20 +202,20 @@ var validate$2 = function (value, _a) {
198
202
  }
199
203
  return (alphanumeric[locale] || alphanumeric.en).test(value);
200
204
  };
201
- var params$2 = [
205
+ var params$i = [
202
206
  {
203
207
  name: 'locale'
204
208
  }
205
209
  ];
206
210
  var alpha_num = {
207
- validate: validate$2,
208
- params: params$2
211
+ validate: validate$q,
212
+ params: params$i
209
213
  };
210
214
 
211
- var validate$3 = function (value, _a) {
215
+ var validate$p = function (value, _a) {
212
216
  var _b = (_a === void 0 ? {} : _a).locale, locale = _b === void 0 ? '' : _b;
213
217
  if (Array.isArray(value)) {
214
- return value.every(function (val) { return validate$3(val, { locale: locale }); });
218
+ return value.every(function (val) { return validate$p(val, { locale: locale }); });
215
219
  }
216
220
  // Match at least one locale.
217
221
  if (!locale) {
@@ -219,24 +223,24 @@ var validate$3 = function (value, _a) {
219
223
  }
220
224
  return (alphaSpaces[locale] || alphaSpaces.en).test(value);
221
225
  };
222
- var params$3 = [
226
+ var params$h = [
223
227
  {
224
228
  name: 'locale'
225
229
  }
226
230
  ];
227
231
  var alpha_spaces = {
228
- validate: validate$3,
229
- params: params$3
232
+ validate: validate$p,
233
+ params: params$h
230
234
  };
231
235
 
232
- var validate$4 = function (value, _a) {
236
+ var validate$o = function (value, _a) {
233
237
  var _b = _a === void 0 ? {} : _a, min = _b.min, max = _b.max;
234
238
  if (Array.isArray(value)) {
235
- return value.every(function (val) { return !!validate$4(val, { min: min, max: max }); });
239
+ return value.every(function (val) { return !!validate$o(val, { min: min, max: max }); });
236
240
  }
237
241
  return Number(min) <= value && Number(max) >= value;
238
242
  };
239
- var params$4 = [
243
+ var params$g = [
240
244
  {
241
245
  name: 'min'
242
246
  },
@@ -245,34 +249,34 @@ var params$4 = [
245
249
  }
246
250
  ];
247
251
  var between = {
248
- validate: validate$4,
249
- params: params$4
252
+ validate: validate$o,
253
+ params: params$g
250
254
  };
251
255
 
252
- var validate$5 = function (value, _a) {
256
+ var validate$n = function (value, _a) {
253
257
  var target = _a.target;
254
258
  return String(value) === String(target);
255
259
  };
256
- var params$5 = [
260
+ var params$f = [
257
261
  {
258
262
  name: 'target',
259
263
  isTarget: true
260
264
  }
261
265
  ];
262
266
  var confirmed = {
263
- validate: validate$5,
264
- params: params$5
267
+ validate: validate$n,
268
+ params: params$f
265
269
  };
266
270
 
267
- var validate$6 = function (value, _a) {
271
+ var validate$m = function (value, _a) {
268
272
  var length = _a.length;
269
273
  if (Array.isArray(value)) {
270
- return value.every(function (val) { return validate$6(val, { length: length }); });
274
+ return value.every(function (val) { return validate$m(val, { length: length }); });
271
275
  }
272
276
  var strVal = String(value);
273
277
  return /^[0-9]*$/.test(strVal) && strVal.length === length;
274
278
  };
275
- var params$6 = [
279
+ var params$e = [
276
280
  {
277
281
  name: 'length',
278
282
  cast: function (value) {
@@ -281,8 +285,8 @@ var params$6 = [
281
285
  }
282
286
  ];
283
287
  var digits = {
284
- validate: validate$6,
285
- params: params$6
288
+ validate: validate$m,
289
+ params: params$e
286
290
  };
287
291
 
288
292
  var validateImage = function (file, width, height) {
@@ -294,7 +298,7 @@ var validateImage = function (file, width, height) {
294
298
  image.src = URL.createObjectURL(file);
295
299
  });
296
300
  };
297
- var validate$7 = function (files, _a) {
301
+ var validate$l = function (files, _a) {
298
302
  var width = _a.width, height = _a.height;
299
303
  var list = [];
300
304
  files = Array.isArray(files) ? files : [files];
@@ -309,7 +313,7 @@ var validate$7 = function (files, _a) {
309
313
  return values.every(function (v) { return v; });
310
314
  });
311
315
  };
312
- var params$7 = [
316
+ var params$d = [
313
317
  {
314
318
  name: 'width',
315
319
  cast: function (value) {
@@ -324,11 +328,11 @@ var params$7 = [
324
328
  }
325
329
  ];
326
330
  var dimensions = {
327
- validate: validate$7,
328
- params: params$7
331
+ validate: validate$l,
332
+ params: params$d
329
333
  };
330
334
 
331
- var validate$8 = function (value, _a) {
335
+ var validate$k = function (value, _a) {
332
336
  var multiple = (_a === void 0 ? {} : _a).multiple;
333
337
  // eslint-disable-next-line
334
338
  var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
@@ -342,15 +346,15 @@ var validate$8 = function (value, _a) {
342
346
  }
343
347
  return re.test(String(value));
344
348
  };
345
- var params$8 = [
349
+ var params$c = [
346
350
  {
347
351
  name: 'multiple',
348
352
  default: false
349
353
  }
350
354
  ];
351
355
  var email = {
352
- validate: validate$8,
353
- params: params$8
356
+ validate: validate$k,
357
+ params: params$c
354
358
  };
355
359
 
356
360
  function isNaN$1(value) {
@@ -376,34 +380,6 @@ function isRefEqual(lhs, rhs) {
376
380
  }
377
381
  return lhs === rhs;
378
382
  }
379
- /**
380
- * Shallow object comparison.
381
- */
382
- function isEqual(lhs, rhs) {
383
- if (lhs instanceof RegExp && rhs instanceof RegExp) {
384
- return isEqual(lhs.source, rhs.source) && isEqual(lhs.flags, rhs.flags);
385
- }
386
- if (Array.isArray(lhs) && Array.isArray(rhs)) {
387
- if (lhs.length !== rhs.length)
388
- return false;
389
- for (var i = 0; i < lhs.length; i++) {
390
- if (!isEqual(lhs[i], rhs[i])) {
391
- return false;
392
- }
393
- }
394
- return true;
395
- }
396
- // if both are objects, compare each key recursively.
397
- if (isObject(lhs) && isObject(rhs)) {
398
- return (Object.keys(lhs).every(function (key) {
399
- return isEqual(lhs[key], rhs[key]);
400
- }) &&
401
- Object.keys(rhs).every(function (key) {
402
- return isEqual(lhs[key], rhs[key]);
403
- }));
404
- }
405
- return isRefEqual(lhs, rhs);
406
- }
407
383
  // Checks if a given value is not an empty string or null or undefined.
408
384
  function isSpecified(val) {
409
385
  if (val === '') {
@@ -411,6 +387,7 @@ function isSpecified(val) {
411
387
  }
412
388
  return !isNullOrUndefined(val);
413
389
  }
390
+ // eslint-disable-next-line @typescript-eslint/ban-types
414
391
  function isCallable(fn) {
415
392
  return typeof fn === 'function';
416
393
  }
@@ -543,9 +520,9 @@ function interpolate(template, values) {
543
520
  });
544
521
  }
545
522
 
546
- var validate$9 = function (value, options) {
523
+ var validate$j = function (value, options) {
547
524
  if (Array.isArray(value)) {
548
- return value.every(function (val) { return validate$9(val, options); });
525
+ return value.every(function (val) { return validate$j(val, options); });
549
526
  }
550
527
  return toArray(options).some(function (item) {
551
528
  // eslint-disable-next-line
@@ -553,17 +530,17 @@ var validate$9 = function (value, options) {
553
530
  });
554
531
  };
555
532
  var oneOf = {
556
- validate: validate$9
533
+ validate: validate$j
557
534
  };
558
535
 
559
- var validate$a = function (value, args) {
560
- return !validate$9(value, args);
536
+ var validate$i = function (value, args) {
537
+ return !validate$j(value, args);
561
538
  };
562
539
  var excluded = {
563
- validate: validate$a
540
+ validate: validate$i
564
541
  };
565
542
 
566
- var validate$b = function (files, extensions) {
543
+ var validate$h = function (files, extensions) {
567
544
  var regex = new RegExp(".(" + extensions.join('|') + ")$", 'i');
568
545
  if (Array.isArray(files)) {
569
546
  return files.every(function (file) { return regex.test(file.name); });
@@ -571,10 +548,10 @@ var validate$b = function (files, extensions) {
571
548
  return regex.test(files.name);
572
549
  };
573
550
  var ext = {
574
- validate: validate$b
551
+ validate: validate$h
575
552
  };
576
553
 
577
- var validate$c = function (files) {
554
+ var validate$g = function (files) {
578
555
  var regex = /\.(jpg|svg|jpeg|png|bmp|gif|webp)$/i;
579
556
  if (Array.isArray(files)) {
580
557
  return files.every(function (file) { return regex.test(file.name); });
@@ -582,34 +559,34 @@ var validate$c = function (files) {
582
559
  return regex.test(files.name);
583
560
  };
584
561
  var image = {
585
- validate: validate$c
562
+ validate: validate$g
586
563
  };
587
564
 
588
- var validate$d = function (value) {
565
+ var validate$f = function (value) {
589
566
  if (Array.isArray(value)) {
590
567
  return value.every(function (val) { return /^-?[0-9]+$/.test(String(val)); });
591
568
  }
592
569
  return /^-?[0-9]+$/.test(String(value));
593
570
  };
594
571
  var integer = {
595
- validate: validate$d
572
+ validate: validate$f
596
573
  };
597
574
 
598
575
  var validate$e = function (value, _a) {
599
576
  var other = _a.other;
600
577
  return value === other;
601
578
  };
602
- var params$9 = [
579
+ var params$b = [
603
580
  {
604
581
  name: 'other'
605
582
  }
606
583
  ];
607
584
  var is = {
608
585
  validate: validate$e,
609
- params: params$9
586
+ params: params$b
610
587
  };
611
588
 
612
- var validate$f = function (value, _a) {
589
+ var validate$d = function (value, _a) {
613
590
  var other = _a.other;
614
591
  return value !== other;
615
592
  };
@@ -619,11 +596,11 @@ var params$a = [
619
596
  }
620
597
  ];
621
598
  var is_not = {
622
- validate: validate$f,
599
+ validate: validate$d,
623
600
  params: params$a
624
601
  };
625
602
 
626
- var validate$g = function (value, _a) {
603
+ var validate$c = function (value, _a) {
627
604
  var length = _a.length;
628
605
  if (isNullOrUndefined(value)) {
629
606
  return false;
@@ -639,28 +616,28 @@ var validate$g = function (value, _a) {
639
616
  }
640
617
  return value.length === length;
641
618
  };
642
- var params$b = [
619
+ var params$9 = [
643
620
  {
644
621
  name: 'length',
645
622
  cast: function (value) { return Number(value); }
646
623
  }
647
624
  ];
648
625
  var length = {
649
- validate: validate$g,
650
- params: params$b
626
+ validate: validate$c,
627
+ params: params$9
651
628
  };
652
629
 
653
- var validate$h = function (value, _a) {
630
+ var validate$b = function (value, _a) {
654
631
  var length = _a.length;
655
632
  if (isNullOrUndefined(value)) {
656
633
  return length >= 0;
657
634
  }
658
635
  if (Array.isArray(value)) {
659
- return value.every(function (val) { return validate$h(val, { length: length }); });
636
+ return value.every(function (val) { return validate$b(val, { length: length }); });
660
637
  }
661
638
  return String(value).length <= length;
662
639
  };
663
- var params$c = [
640
+ var params$8 = [
664
641
  {
665
642
  name: 'length',
666
643
  cast: function (value) {
@@ -669,21 +646,21 @@ var params$c = [
669
646
  }
670
647
  ];
671
648
  var max = {
672
- validate: validate$h,
673
- params: params$c
649
+ validate: validate$b,
650
+ params: params$8
674
651
  };
675
652
 
676
- var validate$i = function (value, _a) {
653
+ var validate$a = function (value, _a) {
677
654
  var max = _a.max;
678
655
  if (isNullOrUndefined(value) || value === '') {
679
656
  return false;
680
657
  }
681
658
  if (Array.isArray(value)) {
682
- return value.length > 0 && value.every(function (val) { return validate$i(val, { max: max }); });
659
+ return value.length > 0 && value.every(function (val) { return validate$a(val, { max: max }); });
683
660
  }
684
661
  return Number(value) <= max;
685
662
  };
686
- var params$d = [
663
+ var params$7 = [
687
664
  {
688
665
  name: 'max',
689
666
  cast: function (value) {
@@ -692,11 +669,11 @@ var params$d = [
692
669
  }
693
670
  ];
694
671
  var max_value = {
695
- validate: validate$i,
696
- params: params$d
672
+ validate: validate$a,
673
+ params: params$7
697
674
  };
698
675
 
699
- var validate$j = function (files, mimes) {
676
+ var validate$9 = function (files, mimes) {
700
677
  var regex = new RegExp(mimes.join('|').replace('*', '.+') + "$", 'i');
701
678
  if (Array.isArray(files)) {
702
679
  return files.every(function (file) { return regex.test(file.type); });
@@ -704,20 +681,20 @@ var validate$j = function (files, mimes) {
704
681
  return regex.test(files.type);
705
682
  };
706
683
  var mimes = {
707
- validate: validate$j
684
+ validate: validate$9
708
685
  };
709
686
 
710
- var validate$k = function (value, _a) {
687
+ var validate$8 = function (value, _a) {
711
688
  var length = _a.length;
712
689
  if (isNullOrUndefined(value)) {
713
690
  return false;
714
691
  }
715
692
  if (Array.isArray(value)) {
716
- return value.every(function (val) { return validate$k(val, { length: length }); });
693
+ return value.every(function (val) { return validate$8(val, { length: length }); });
717
694
  }
718
695
  return String(value).length >= length;
719
696
  };
720
- var params$e = [
697
+ var params$6 = [
721
698
  {
722
699
  name: 'length',
723
700
  cast: function (value) {
@@ -726,21 +703,21 @@ var params$e = [
726
703
  }
727
704
  ];
728
705
  var min = {
729
- validate: validate$k,
730
- params: params$e
706
+ validate: validate$8,
707
+ params: params$6
731
708
  };
732
709
 
733
- var validate$l = function (value, _a) {
710
+ var validate$7 = function (value, _a) {
734
711
  var min = _a.min;
735
712
  if (isNullOrUndefined(value) || value === '') {
736
713
  return false;
737
714
  }
738
715
  if (Array.isArray(value)) {
739
- return value.length > 0 && value.every(function (val) { return validate$l(val, { min: min }); });
716
+ return value.length > 0 && value.every(function (val) { return validate$7(val, { min: min }); });
740
717
  }
741
718
  return Number(value) >= min;
742
719
  };
743
- var params$f = [
720
+ var params$5 = [
744
721
  {
745
722
  name: 'min',
746
723
  cast: function (value) {
@@ -749,16 +726,16 @@ var params$f = [
749
726
  }
750
727
  ];
751
728
  var min_value = {
752
- validate: validate$l,
753
- params: params$f
729
+ validate: validate$7,
730
+ params: params$5
754
731
  };
755
732
 
756
733
  var ar = /^[٠١٢٣٤٥٦٧٨٩]+$/;
757
- var en$1 = /^[0-9]+$/;
758
- var validate$m = function (value) {
734
+ var en = /^[0-9]+$/;
735
+ var validate$6 = function (value) {
759
736
  var testValue = function (val) {
760
737
  var strValue = String(val);
761
- return en$1.test(strValue) || ar.test(strValue);
738
+ return en.test(strValue) || ar.test(strValue);
762
739
  };
763
740
  if (Array.isArray(value)) {
764
741
  return value.every(testValue);
@@ -766,17 +743,17 @@ var validate$m = function (value) {
766
743
  return testValue(value);
767
744
  };
768
745
  var numeric = {
769
- validate: validate$m
746
+ validate: validate$6
770
747
  };
771
748
 
772
- var validate$n = function (value, _a) {
749
+ var validate$5 = function (value, _a) {
773
750
  var regex = _a.regex;
774
751
  if (Array.isArray(value)) {
775
- return value.every(function (val) { return validate$n(val, { regex: regex }); });
752
+ return value.every(function (val) { return validate$5(val, { regex: regex }); });
776
753
  }
777
754
  return regex.test(String(value));
778
755
  };
779
- var params$g = [
756
+ var params$4 = [
780
757
  {
781
758
  name: 'regex',
782
759
  cast: function (value) {
@@ -788,11 +765,11 @@ var params$g = [
788
765
  }
789
766
  ];
790
767
  var regex = {
791
- validate: validate$n,
792
- params: params$g
768
+ validate: validate$5,
769
+ params: params$4
793
770
  };
794
771
 
795
- var validate$o = function (value, _a) {
772
+ var validate$4 = function (value, _a) {
796
773
  var allowFalse = (_a === void 0 ? { allowFalse: true } : _a).allowFalse;
797
774
  var result = {
798
775
  valid: false,
@@ -808,23 +785,23 @@ var validate$o = function (value, _a) {
808
785
  result.valid = !!String(value).trim().length;
809
786
  return result;
810
787
  };
811
- var computesRequired = true;
812
- var params$h = [
788
+ var computesRequired$1 = true;
789
+ var params$3 = [
813
790
  {
814
791
  name: 'allowFalse',
815
792
  default: true
816
793
  }
817
794
  ];
818
795
  var required = {
819
- validate: validate$o,
820
- params: params$h,
821
- computesRequired: computesRequired
796
+ validate: validate$4,
797
+ params: params$3,
798
+ computesRequired: computesRequired$1
822
799
  };
823
800
 
824
801
  var testEmpty = function (value) {
825
802
  return isEmptyArray(value) || includes([false, null, undefined], value) || !String(value).trim().length;
826
803
  };
827
- var validate$p = function (value, _a) {
804
+ var validate$3 = function (value, _a) {
828
805
  var target = _a.target, values = _a.values;
829
806
  var required;
830
807
  if (values && values.length) {
@@ -848,7 +825,7 @@ var validate$p = function (value, _a) {
848
825
  required: required
849
826
  };
850
827
  };
851
- var params$i = [
828
+ var params$2 = [
852
829
  {
853
830
  name: 'target',
854
831
  isTarget: true
@@ -857,14 +834,14 @@ var params$i = [
857
834
  name: 'values'
858
835
  }
859
836
  ];
860
- var computesRequired$1 = true;
837
+ var computesRequired = true;
861
838
  var required_if = {
862
- validate: validate$p,
863
- params: params$i,
864
- computesRequired: computesRequired$1
839
+ validate: validate$3,
840
+ params: params$2,
841
+ computesRequired: computesRequired
865
842
  };
866
843
 
867
- var validate$q = function (files, _a) {
844
+ var validate$2 = function (files, _a) {
868
845
  var size = _a.size;
869
846
  if (isNaN(size)) {
870
847
  return false;
@@ -880,7 +857,7 @@ var validate$q = function (files, _a) {
880
857
  }
881
858
  return true;
882
859
  };
883
- var params$j = [
860
+ var params$1 = [
884
861
  {
885
862
  name: 'size',
886
863
  cast: function (value) {
@@ -889,11 +866,11 @@ var params$j = [
889
866
  }
890
867
  ];
891
868
  var size = {
892
- validate: validate$q,
893
- params: params$j
869
+ validate: validate$2,
870
+ params: params$1
894
871
  };
895
872
 
896
- var validate$r = function (value, params) {
873
+ var validate$1 = function (value, params) {
897
874
  var _a = params || {}, _b = _a.decimals, decimals = _b === void 0 ? 0 : _b, _c = _a.separator, separator = _c === void 0 ? 'dot' : _c;
898
875
  var separators = {
899
876
  dot: '.',
@@ -903,7 +880,7 @@ var validate$r = function (value, params) {
903
880
  var regex = new RegExp("^-?\\d+\\" + (separators[separator] || '.') + "\\d" + regexPart + "$");
904
881
  return Array.isArray(value) ? value.every(function (val) { return regex.test(String(val)); }) : regex.test(String(value));
905
882
  };
906
- var params$k = [
883
+ var params = [
907
884
  {
908
885
  name: 'decimals',
909
886
  default: 0
@@ -914,8 +891,8 @@ var params$k = [
914
891
  }
915
892
  ];
916
893
  var double = {
917
- validate: validate$r,
918
- params: params$k
894
+ validate: validate$1,
895
+ params: params
919
896
  };
920
897
 
921
898
  /* eslint-disable camelcase */
@@ -925,7 +902,7 @@ var Rules = /*#__PURE__*/Object.freeze({
925
902
  alpha_dash: alpha_dash,
926
903
  alpha_num: alpha_num,
927
904
  alpha_spaces: alpha_spaces,
928
- alpha: alpha$1,
905
+ alpha: alpha,
929
906
  between: between,
930
907
  confirmed: confirmed,
931
908
  digits: digits,
@@ -1378,7 +1355,7 @@ function extractLocators(params) {
1378
1355
  /**
1379
1356
  * Validates a value against the rules.
1380
1357
  */
1381
- function validate$s(value, rules, options) {
1358
+ function validate(value, rules, options) {
1382
1359
  if (options === void 0) { options = {}; }
1383
1360
  return __awaiter(this, void 0, void 0, function () {
1384
1361
  var shouldBail, skipIfEmpty, field, result, errors, failedRules, regenerateMap;
@@ -1411,6 +1388,7 @@ function validate$s(value, rules, options) {
1411
1388
  });
1412
1389
  return [2 /*return*/, {
1413
1390
  valid: result.valid,
1391
+ required: result.required,
1414
1392
  errors: errors,
1415
1393
  failedRules: failedRules,
1416
1394
  regenerateMap: regenerateMap
@@ -1425,15 +1403,16 @@ function validate$s(value, rules, options) {
1425
1403
  function _validate(field, value, _a) {
1426
1404
  var _b = (_a === void 0 ? {} : _a).isInitial, isInitial = _b === void 0 ? false : _b;
1427
1405
  return __awaiter(this, void 0, void 0, function () {
1428
- var _c, shouldSkip, errors, rules, length, i, rule, result;
1406
+ var _c, shouldSkip, required, errors, rules, length, i, rule, result;
1429
1407
  return __generator(this, function (_d) {
1430
1408
  switch (_d.label) {
1431
1409
  case 0: return [4 /*yield*/, _shouldSkip(field, value)];
1432
1410
  case 1:
1433
- _c = _d.sent(), shouldSkip = _c.shouldSkip, errors = _c.errors;
1411
+ _c = _d.sent(), shouldSkip = _c.shouldSkip, required = _c.required, errors = _c.errors;
1434
1412
  if (shouldSkip) {
1435
1413
  return [2 /*return*/, {
1436
1414
  valid: !errors.length,
1415
+ required: required,
1437
1416
  errors: errors
1438
1417
  }];
1439
1418
  }
@@ -1458,6 +1437,7 @@ function _validate(field, value, _a) {
1458
1437
  if (field.bails) {
1459
1438
  return [2 /*return*/, {
1460
1439
  valid: false,
1440
+ required: required,
1461
1441
  errors: errors
1462
1442
  }];
1463
1443
  }
@@ -1468,6 +1448,7 @@ function _validate(field, value, _a) {
1468
1448
  return [3 /*break*/, 2];
1469
1449
  case 5: return [2 /*return*/, {
1470
1450
  valid: !errors.length,
1451
+ required: required,
1471
1452
  errors: errors
1472
1453
  }];
1473
1454
  }
@@ -1485,7 +1466,6 @@ function _shouldSkip(field, value) {
1485
1466
  errors = [];
1486
1467
  isEmpty = isNullOrUndefined(value) || value === '' || isEmptyArray(value);
1487
1468
  isEmptyAndOptional = isEmpty && field.skipIfEmpty;
1488
- isRequired = false;
1489
1469
  i = 0;
1490
1470
  _a.label = 1;
1491
1471
  case 1:
@@ -1500,8 +1480,8 @@ function _shouldSkip(field, value) {
1500
1480
  if (!isObject(result)) {
1501
1481
  throw new Error('Require rules has to return an object (see docs)');
1502
1482
  }
1503
- if (result.required) {
1504
- isRequired = true;
1483
+ if (result.required !== undefined) {
1484
+ isRequired = result.required;
1505
1485
  }
1506
1486
  if (!result.valid && result.error) {
1507
1487
  errors.push(result.error);
@@ -1509,6 +1489,7 @@ function _shouldSkip(field, value) {
1509
1489
  if (field.bails) {
1510
1490
  return [2 /*return*/, {
1511
1491
  shouldSkip: true,
1492
+ required: result.required,
1512
1493
  errors: errors
1513
1494
  }];
1514
1495
  }
@@ -1521,6 +1502,7 @@ function _shouldSkip(field, value) {
1521
1502
  if (isEmpty && !isRequired && !field.skipIfEmpty) {
1522
1503
  return [2 /*return*/, {
1523
1504
  shouldSkip: false,
1505
+ required: isRequired,
1524
1506
  errors: errors
1525
1507
  }];
1526
1508
  }
@@ -1528,12 +1510,14 @@ function _shouldSkip(field, value) {
1528
1510
  if (!field.bails && !isEmptyAndOptional) {
1529
1511
  return [2 /*return*/, {
1530
1512
  shouldSkip: false,
1513
+ required: isRequired,
1531
1514
  errors: errors
1532
1515
  }];
1533
1516
  }
1534
1517
  // skip if the field is not required and has an empty value.
1535
1518
  return [2 /*return*/, {
1536
1519
  shouldSkip: !isRequired && isEmpty,
1520
+ required: isRequired,
1537
1521
  errors: errors
1538
1522
  }];
1539
1523
  }
@@ -1679,6 +1663,51 @@ function fillTargetValues(params, crossTable) {
1679
1663
  return values;
1680
1664
  }
1681
1665
 
1666
+ // do not edit .js files directly - edit src/index.jst
1667
+
1668
+
1669
+
1670
+ var fastDeepEqual = function equal(a, b) {
1671
+ if (a === b) return true;
1672
+
1673
+ if (a && b && typeof a == 'object' && typeof b == 'object') {
1674
+ if (a.constructor !== b.constructor) return false;
1675
+
1676
+ var length, i, keys;
1677
+ if (Array.isArray(a)) {
1678
+ length = a.length;
1679
+ if (length != b.length) return false;
1680
+ for (i = length; i-- !== 0;)
1681
+ if (!equal(a[i], b[i])) return false;
1682
+ return true;
1683
+ }
1684
+
1685
+
1686
+
1687
+ if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
1688
+ if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
1689
+ if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
1690
+
1691
+ keys = Object.keys(a);
1692
+ length = keys.length;
1693
+ if (length !== Object.keys(b).length) return false;
1694
+
1695
+ for (i = length; i-- !== 0;)
1696
+ if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
1697
+
1698
+ for (i = length; i-- !== 0;) {
1699
+ var key = keys[i];
1700
+
1701
+ if (!equal(a[key], b[key])) return false;
1702
+ }
1703
+
1704
+ return true;
1705
+ }
1706
+
1707
+ // true if both NaN, false otherwise
1708
+ return a!==a && b!==b;
1709
+ };
1710
+
1682
1711
  var isEvent = function (evt) {
1683
1712
  if (!evt) {
1684
1713
  return false;
@@ -2073,7 +2102,7 @@ function addListeners(vm, node) {
2073
2102
  }
2074
2103
 
2075
2104
  var PROVIDER_COUNTER = 0;
2076
- function data() {
2105
+ function data$1() {
2077
2106
  var errors = [];
2078
2107
  var fieldName = '';
2079
2108
  var defaultValues = {
@@ -2090,6 +2119,7 @@ function data() {
2090
2119
  return defaultValues;
2091
2120
  }
2092
2121
  var ValidationProvider = Vue.extend({
2122
+ name: 'ValidationProvider',
2093
2123
  inject: {
2094
2124
  $_veeObserver: {
2095
2125
  from: '$_veeObserver',
@@ -2163,11 +2193,11 @@ var ValidationProvider = Vue.extend({
2163
2193
  rules: {
2164
2194
  deep: true,
2165
2195
  handler: function (val, oldVal) {
2166
- this._needsValidation = !isEqual(val, oldVal);
2196
+ this._needsValidation = !fastDeepEqual(val, oldVal);
2167
2197
  }
2168
2198
  }
2169
2199
  },
2170
- data: data,
2200
+ data: data$1,
2171
2201
  computed: {
2172
2202
  fieldDeps: function () {
2173
2203
  var _this = this;
@@ -2247,7 +2277,7 @@ var ValidationProvider = Vue.extend({
2247
2277
  return;
2248
2278
  }
2249
2279
  var resolved = getConfig().useConstraintAttrs ? resolveRules(input) : {};
2250
- if (!isEqual(_this._resolvedRules, resolved)) {
2280
+ if (!fastDeepEqual(_this._resolvedRules, resolved)) {
2251
2281
  _this._needsValidation = true;
2252
2282
  }
2253
2283
  if (isHTMLNode(input)) {
@@ -2280,7 +2310,7 @@ var ValidationProvider = Vue.extend({
2280
2310
  syncValue: function (v) {
2281
2311
  var value = normalizeEventValue(v);
2282
2312
  this.value = value;
2283
- this.flags.changed = this.initialValue !== value;
2313
+ this.flags.changed = !fastDeepEqual(this.initialValue, value);
2284
2314
  },
2285
2315
  reset: function () {
2286
2316
  var _this = this;
@@ -2325,7 +2355,7 @@ var ValidationProvider = Vue.extend({
2325
2355
  enumerable: false,
2326
2356
  configurable: false
2327
2357
  });
2328
- return [4 /*yield*/, validate$s(this.value, rules, __assign(__assign({ name: this.name || this.fieldName }, createLookup(this)), { bails: this.bails, skipIfEmpty: this.skipIfEmpty, isInitial: !this.initialized, customMessages: this.customMessages }))];
2358
+ return [4 /*yield*/, validate(this.value, rules, __assign(__assign({ name: this.name || this.fieldName }, createLookup(this)), { bails: this.bails, skipIfEmpty: this.skipIfEmpty, isInitial: !this.initialized, customMessages: this.customMessages }))];
2329
2359
  case 1:
2330
2360
  result = _a.sent();
2331
2361
  this.setFlags({
@@ -2333,6 +2363,11 @@ var ValidationProvider = Vue.extend({
2333
2363
  valid: result.valid,
2334
2364
  invalid: !result.valid
2335
2365
  });
2366
+ if (result.required !== undefined) {
2367
+ this.setFlags({
2368
+ required: result.required
2369
+ });
2370
+ }
2336
2371
  return [2 /*return*/, result];
2337
2372
  }
2338
2373
  });
@@ -2352,11 +2387,16 @@ var ValidationProvider = Vue.extend({
2352
2387
  invalid: !!errors.length,
2353
2388
  failed: !!errors.length,
2354
2389
  validated: true,
2355
- changed: this.value !== this.initialValue
2390
+ changed: !fastDeepEqual(this.value, this.initialValue)
2356
2391
  });
2357
2392
  },
2358
2393
  registerField: function () {
2359
2394
  updateRenderingContextRefs(this);
2395
+ },
2396
+ checkComputesRequiredState: function () {
2397
+ var rules = __assign(__assign({}, this._resolvedRules), this.normalizedRules);
2398
+ var isRequired = Object.keys(rules).some(RuleContainer.isRequireRule);
2399
+ return isRequired;
2360
2400
  }
2361
2401
  }
2362
2402
  });
@@ -2457,10 +2497,15 @@ function watchCrossFieldDep(ctx, depName, withHooks) {
2457
2497
  }
2458
2498
  if (!isCallable(ctx._veeWatchers[depName]) && providers[depName]) {
2459
2499
  ctx._veeWatchers[depName] = providers[depName].$watch('value', function () {
2500
+ var isComputesRequired = ctx.checkComputesRequiredState();
2460
2501
  if (ctx.flags.validated) {
2461
2502
  ctx._needsValidation = true;
2462
2503
  ctx.validate();
2463
2504
  }
2505
+ // Validate dependent field silently if it has rules with computesRequired
2506
+ if (isComputesRequired && !ctx.flags.validated) {
2507
+ ctx.validateSilent();
2508
+ }
2464
2509
  });
2465
2510
  }
2466
2511
  }
@@ -2479,7 +2524,7 @@ var FLAGS_STRATEGIES = [
2479
2524
  ['failed', 'some']
2480
2525
  ];
2481
2526
  var OBSERVER_COUNTER = 0;
2482
- function data$1() {
2527
+ function data() {
2483
2528
  var refs = {};
2484
2529
  var errors = {};
2485
2530
  var flags = createObserverFlags();
@@ -2534,7 +2579,7 @@ var ValidationObserver = Vue.extend({
2534
2579
  default: false
2535
2580
  }
2536
2581
  },
2537
- data: data$1,
2582
+ data: data,
2538
2583
  created: function () {
2539
2584
  var _this = this;
2540
2585
  this.id = this.vid;
@@ -2746,7 +2791,7 @@ function withValidation(component, mapProps) {
2746
2791
  return hoc;
2747
2792
  }
2748
2793
 
2749
- var version = '3.4.5';
2794
+ var version = '3.4.9';
2750
2795
  // Install all rules.
2751
2796
  var RulesAsList = Object.keys(Rules).map(function (key) { return ({ schema: Rules[key], name: key }); });
2752
2797
  RulesAsList.forEach(function (_a) {
@@ -2754,6 +2799,6 @@ RulesAsList.forEach(function (_a) {
2754
2799
  extend(name, schema);
2755
2800
  });
2756
2801
  // Install locale
2757
- localize('en', en);
2802
+ localize('en', en$1);
2758
2803
 
2759
- export { Rules, ValidationObserver, ValidationProvider, configure, extend, localeChanged, localize, normalizeRules, setInteractionMode, validate$s as validate, version, withValidation };
2804
+ export { Rules, ValidationObserver, ValidationProvider, configure, extend, localeChanged, localize, normalizeRules, setInteractionMode, validate, version, withValidation };