@ntlab/ntjs-assets 1.1.0 → 1.1.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.
Files changed (165) hide show
  1. package/assets/js/jquery/jquery.js +118 -109
  2. package/assets/js/jquery/jquery.min.js +2 -2
  3. package/assets/js/jquery/jquery.min.map +1 -1
  4. package/assets/js/semantic-ui/components/accordion.css +1 -1
  5. package/assets/js/semantic-ui/components/accordion.js +1 -1
  6. package/assets/js/semantic-ui/components/accordion.min.css +1 -1
  7. package/assets/js/semantic-ui/components/accordion.min.js +3 -3
  8. package/assets/js/semantic-ui/components/ad.css +1 -1
  9. package/assets/js/semantic-ui/components/ad.min.css +1 -1
  10. package/assets/js/semantic-ui/components/api.js +1 -1
  11. package/assets/js/semantic-ui/components/api.min.js +3 -3
  12. package/assets/js/semantic-ui/components/breadcrumb.css +1 -1
  13. package/assets/js/semantic-ui/components/breadcrumb.min.css +1 -1
  14. package/assets/js/semantic-ui/components/button.css +29 -2
  15. package/assets/js/semantic-ui/components/button.min.css +2 -2
  16. package/assets/js/semantic-ui/components/calendar.css +3 -3
  17. package/assets/js/semantic-ui/components/calendar.js +10 -12
  18. package/assets/js/semantic-ui/components/calendar.min.css +2 -2
  19. package/assets/js/semantic-ui/components/calendar.min.js +4 -4
  20. package/assets/js/semantic-ui/components/card.css +74 -2
  21. package/assets/js/semantic-ui/components/card.min.css +2 -2
  22. package/assets/js/semantic-ui/components/checkbox.css +46 -4
  23. package/assets/js/semantic-ui/components/checkbox.js +1 -1
  24. package/assets/js/semantic-ui/components/checkbox.min.css +2 -2
  25. package/assets/js/semantic-ui/components/checkbox.min.js +3 -3
  26. package/assets/js/semantic-ui/components/comment.css +1 -1
  27. package/assets/js/semantic-ui/components/comment.min.css +1 -1
  28. package/assets/js/semantic-ui/components/container.css +3 -4
  29. package/assets/js/semantic-ui/components/container.min.css +2 -2
  30. package/assets/js/semantic-ui/components/dimmer.css +1 -1
  31. package/assets/js/semantic-ui/components/dimmer.js +9 -12
  32. package/assets/js/semantic-ui/components/dimmer.min.css +1 -1
  33. package/assets/js/semantic-ui/components/dimmer.min.js +4 -4
  34. package/assets/js/semantic-ui/components/divider.css +1 -1
  35. package/assets/js/semantic-ui/components/divider.min.css +1 -1
  36. package/assets/js/semantic-ui/components/dropdown.css +72 -3
  37. package/assets/js/semantic-ui/components/dropdown.js +193 -101
  38. package/assets/js/semantic-ui/components/dropdown.min.css +2 -2
  39. package/assets/js/semantic-ui/components/dropdown.min.js +4 -4
  40. package/assets/js/semantic-ui/components/embed.css +1 -1
  41. package/assets/js/semantic-ui/components/embed.js +1 -1
  42. package/assets/js/semantic-ui/components/embed.min.css +1 -1
  43. package/assets/js/semantic-ui/components/embed.min.js +3 -3
  44. package/assets/js/semantic-ui/components/feed.css +1 -1
  45. package/assets/js/semantic-ui/components/feed.min.css +1 -1
  46. package/assets/js/semantic-ui/components/flag.css +1 -1
  47. package/assets/js/semantic-ui/components/flag.min.css +1 -1
  48. package/assets/js/semantic-ui/components/form.css +46 -5
  49. package/assets/js/semantic-ui/components/form.js +99 -61
  50. package/assets/js/semantic-ui/components/form.min.css +2 -2
  51. package/assets/js/semantic-ui/components/form.min.js +4 -4
  52. package/assets/js/semantic-ui/components/grid.css +14 -7
  53. package/assets/js/semantic-ui/components/grid.min.css +2 -2
  54. package/assets/js/semantic-ui/components/header.css +10 -5
  55. package/assets/js/semantic-ui/components/header.min.css +2 -2
  56. package/assets/js/semantic-ui/components/icon.css +237 -65
  57. package/assets/js/semantic-ui/components/icon.min.css +2 -2
  58. package/assets/js/semantic-ui/components/image.css +1 -1
  59. package/assets/js/semantic-ui/components/image.min.css +1 -1
  60. package/assets/js/semantic-ui/components/input.css +2 -1
  61. package/assets/js/semantic-ui/components/input.min.css +2 -2
  62. package/assets/js/semantic-ui/components/item.css +1 -1
  63. package/assets/js/semantic-ui/components/item.min.css +1 -1
  64. package/assets/js/semantic-ui/components/label.css +1 -1
  65. package/assets/js/semantic-ui/components/label.min.css +1 -1
  66. package/assets/js/semantic-ui/components/list.css +1 -1
  67. package/assets/js/semantic-ui/components/list.min.css +1 -1
  68. package/assets/js/semantic-ui/components/loader.css +41 -37
  69. package/assets/js/semantic-ui/components/loader.min.css +2 -2
  70. package/assets/js/semantic-ui/components/menu.css +8 -6
  71. package/assets/js/semantic-ui/components/menu.min.css +1 -1
  72. package/assets/js/semantic-ui/components/message.css +50 -3
  73. package/assets/js/semantic-ui/components/message.min.css +2 -2
  74. package/assets/js/semantic-ui/components/modal.css +19 -8
  75. package/assets/js/semantic-ui/components/modal.js +260 -17
  76. package/assets/js/semantic-ui/components/modal.min.css +2 -2
  77. package/assets/js/semantic-ui/components/modal.min.js +4 -4
  78. package/assets/js/semantic-ui/components/nag.css +168 -16
  79. package/assets/js/semantic-ui/components/nag.js +131 -65
  80. package/assets/js/semantic-ui/components/nag.min.css +2 -2
  81. package/assets/js/semantic-ui/components/nag.min.js +4 -4
  82. package/assets/js/semantic-ui/components/placeholder.css +1 -1
  83. package/assets/js/semantic-ui/components/placeholder.min.css +1 -1
  84. package/assets/js/semantic-ui/components/popup.css +4 -2
  85. package/assets/js/semantic-ui/components/popup.js +5 -5
  86. package/assets/js/semantic-ui/components/popup.min.css +2 -2
  87. package/assets/js/semantic-ui/components/popup.min.js +4 -4
  88. package/assets/js/semantic-ui/components/progress.css +18 -10
  89. package/assets/js/semantic-ui/components/progress.js +9 -11
  90. package/assets/js/semantic-ui/components/progress.min.css +2 -2
  91. package/assets/js/semantic-ui/components/progress.min.js +4 -4
  92. package/assets/js/semantic-ui/components/rail.css +1 -1
  93. package/assets/js/semantic-ui/components/rail.min.css +1 -1
  94. package/assets/js/semantic-ui/components/rating.css +18 -33
  95. package/assets/js/semantic-ui/components/rating.js +1 -1
  96. package/assets/js/semantic-ui/components/rating.min.css +2 -2
  97. package/assets/js/semantic-ui/components/rating.min.js +3 -3
  98. package/assets/js/semantic-ui/components/reset.css +2 -3
  99. package/assets/js/semantic-ui/components/reset.min.css +2 -2
  100. package/assets/js/semantic-ui/components/reveal.css +1 -1
  101. package/assets/js/semantic-ui/components/reveal.min.css +1 -1
  102. package/assets/js/semantic-ui/components/search.css +1 -1
  103. package/assets/js/semantic-ui/components/search.js +15 -13
  104. package/assets/js/semantic-ui/components/search.min.css +1 -1
  105. package/assets/js/semantic-ui/components/search.min.js +4 -4
  106. package/assets/js/semantic-ui/components/segment.css +34 -2
  107. package/assets/js/semantic-ui/components/segment.min.css +2 -2
  108. package/assets/js/semantic-ui/components/shape.css +1 -1
  109. package/assets/js/semantic-ui/components/shape.js +1 -1
  110. package/assets/js/semantic-ui/components/shape.min.css +1 -1
  111. package/assets/js/semantic-ui/components/shape.min.js +3 -3
  112. package/assets/js/semantic-ui/components/sidebar.css +1 -1
  113. package/assets/js/semantic-ui/components/sidebar.js +1 -1
  114. package/assets/js/semantic-ui/components/sidebar.min.css +1 -1
  115. package/assets/js/semantic-ui/components/sidebar.min.js +3 -3
  116. package/assets/js/semantic-ui/components/site.css +2 -2
  117. package/assets/js/semantic-ui/components/site.js +1 -1
  118. package/assets/js/semantic-ui/components/site.min.css +2 -2
  119. package/assets/js/semantic-ui/components/site.min.js +3 -3
  120. package/assets/js/semantic-ui/components/slider.css +3 -1
  121. package/assets/js/semantic-ui/components/slider.js +56 -32
  122. package/assets/js/semantic-ui/components/slider.min.css +1 -1
  123. package/assets/js/semantic-ui/components/slider.min.js +4 -4
  124. package/assets/js/semantic-ui/components/state.js +1 -1
  125. package/assets/js/semantic-ui/components/state.min.js +3 -3
  126. package/assets/js/semantic-ui/components/statistic.css +1 -1
  127. package/assets/js/semantic-ui/components/statistic.min.css +1 -1
  128. package/assets/js/semantic-ui/components/step.css +1 -1
  129. package/assets/js/semantic-ui/components/step.min.css +1 -1
  130. package/assets/js/semantic-ui/components/sticky.css +1 -2
  131. package/assets/js/semantic-ui/components/sticky.js +1 -1
  132. package/assets/js/semantic-ui/components/sticky.min.css +2 -2
  133. package/assets/js/semantic-ui/components/sticky.min.js +3 -3
  134. package/assets/js/semantic-ui/components/tab.css +1 -1
  135. package/assets/js/semantic-ui/components/tab.js +1 -1
  136. package/assets/js/semantic-ui/components/tab.min.css +1 -1
  137. package/assets/js/semantic-ui/components/tab.min.js +3 -3
  138. package/assets/js/semantic-ui/components/table.css +6 -2
  139. package/assets/js/semantic-ui/components/table.min.css +2 -2
  140. package/assets/js/semantic-ui/components/text.css +1 -1
  141. package/assets/js/semantic-ui/components/text.min.css +1 -1
  142. package/assets/js/semantic-ui/components/toast.css +97 -10
  143. package/assets/js/semantic-ui/components/toast.js +27 -7
  144. package/assets/js/semantic-ui/components/toast.min.css +2 -2
  145. package/assets/js/semantic-ui/components/toast.min.js +4 -4
  146. package/assets/js/semantic-ui/components/transition.css +1 -1
  147. package/assets/js/semantic-ui/components/transition.js +2 -2
  148. package/assets/js/semantic-ui/components/transition.min.css +1 -1
  149. package/assets/js/semantic-ui/components/transition.min.js +3 -3
  150. package/assets/js/semantic-ui/components/visibility.js +2 -2
  151. package/assets/js/semantic-ui/components/visibility.min.js +3 -3
  152. package/assets/js/semantic-ui/semantic.css +1151 -247
  153. package/assets/js/semantic-ui/semantic.js +835 -357
  154. package/assets/js/semantic-ui/semantic.min.css +4 -397
  155. package/assets/js/semantic-ui/semantic.min.js +4 -4
  156. package/assets/js/socket.io/socket.io.esm.min.js +7 -0
  157. package/assets/js/socket.io/socket.io.esm.min.js.map +1 -0
  158. package/assets/js/socket.io/socket.io.js +4440 -6084
  159. package/assets/js/socket.io/socket.io.js.map +1 -1
  160. package/assets/js/socket.io/socket.io.min.js +7 -7
  161. package/assets/js/socket.io/socket.io.min.js.map +1 -1
  162. package/assets/js/socket.io/socket.io.msgpack.min.js +7 -7
  163. package/assets/js/socket.io/socket.io.msgpack.min.js.map +1 -1
  164. package/cdn.json +4 -4
  165. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * # Fomantic-UI - Form
2
+ * # Fomantic-UI 2.8.8 - Form
3
3
  * http://github.com/fomantic/Fomantic-UI/
4
4
  *
5
5
  *
@@ -372,6 +372,7 @@
372
372
  }
373
373
  .ui.form ::-moz-placeholder {
374
374
  color: rgba(191, 191, 191, 0.87);
375
+ opacity: 1;
375
376
  }
376
377
  .ui.form :focus::-webkit-input-placeholder {
377
378
  color: rgba(115, 115, 115, 0.87);
@@ -480,11 +481,17 @@
480
481
  display: flex;
481
482
  }
482
483
  .ui.ui.form .fields.error .field label,
484
+ .ui.ui.form .fields.error .field .ui.label:not(.corner),
483
485
  .ui.ui.form .field.error label,
486
+ .ui.ui.form .field.error .ui.label:not(.corner),
484
487
  .ui.ui.form .fields.error .field .input,
485
488
  .ui.ui.form .field.error .input {
486
489
  color: #9F3A38;
487
490
  }
491
+ .ui.form .fields.error .field .ui.label,
492
+ .ui.form .field.error .ui.label {
493
+ background-color: #ecd1d1;
494
+ }
488
495
  .ui.form .fields.error .field .corner.label,
489
496
  .ui.form .field.error .corner.label {
490
497
  border-color: #9F3A38;
@@ -599,7 +606,7 @@
599
606
  .ui.form .fields.error .field .ui.dropdown,
600
607
  .ui.form .fields.error .field .ui.dropdown .item,
601
608
  .ui.form .field.error .ui.dropdown,
602
- .ui.form .field.error .ui.dropdown .text,
609
+ .ui.form .field.error .ui.dropdown > .text,
603
610
  .ui.form .field.error .ui.dropdown .item {
604
611
  background: #FFF6F6;
605
612
  color: #9F3A38;
@@ -663,6 +670,10 @@
663
670
  .ui.form .field.error .checkbox .box:after {
664
671
  color: #9F3A38;
665
672
  }
673
+ .ui.inverted.form .fields.error .field label,
674
+ .ui.inverted.form .error.field label {
675
+ color: #ecd1d1;
676
+ }
666
677
 
667
678
  /* On Form */
668
679
  .ui.form.info .info.message:not(:empty) {
@@ -693,11 +704,17 @@
693
704
  display: flex;
694
705
  }
695
706
  .ui.ui.form .fields.info .field label,
707
+ .ui.ui.form .fields.info .field .ui.label:not(.corner),
696
708
  .ui.ui.form .field.info label,
709
+ .ui.ui.form .field.info .ui.label:not(.corner),
697
710
  .ui.ui.form .fields.info .field .input,
698
711
  .ui.ui.form .field.info .input {
699
712
  color: #276F86;
700
713
  }
714
+ .ui.form .fields.info .field .ui.label,
715
+ .ui.form .field.info .ui.label {
716
+ background-color: #c6e3e9;
717
+ }
701
718
  .ui.form .fields.info .field .corner.label,
702
719
  .ui.form .field.info .corner.label {
703
720
  border-color: #276F86;
@@ -812,7 +829,7 @@
812
829
  .ui.form .fields.info .field .ui.dropdown,
813
830
  .ui.form .fields.info .field .ui.dropdown .item,
814
831
  .ui.form .field.info .ui.dropdown,
815
- .ui.form .field.info .ui.dropdown .text,
832
+ .ui.form .field.info .ui.dropdown > .text,
816
833
  .ui.form .field.info .ui.dropdown .item {
817
834
  background: #F8FFFF;
818
835
  color: #276F86;
@@ -876,6 +893,10 @@
876
893
  .ui.form .field.info .checkbox .box:after {
877
894
  color: #276F86;
878
895
  }
896
+ .ui.inverted.form .fields.info .field label,
897
+ .ui.inverted.form .info.field label {
898
+ color: #c6e3e9;
899
+ }
879
900
 
880
901
  /* On Form */
881
902
  .ui.form.success .success.message:not(:empty) {
@@ -906,11 +927,17 @@
906
927
  display: flex;
907
928
  }
908
929
  .ui.ui.form .fields.success .field label,
930
+ .ui.ui.form .fields.success .field .ui.label:not(.corner),
909
931
  .ui.ui.form .field.success label,
932
+ .ui.ui.form .field.success .ui.label:not(.corner),
910
933
  .ui.ui.form .fields.success .field .input,
911
934
  .ui.ui.form .field.success .input {
912
935
  color: #2C662D;
913
936
  }
937
+ .ui.form .fields.success .field .ui.label,
938
+ .ui.form .field.success .ui.label {
939
+ background-color: #b9d1ad;
940
+ }
914
941
  .ui.form .fields.success .field .corner.label,
915
942
  .ui.form .field.success .corner.label {
916
943
  border-color: #2C662D;
@@ -1025,7 +1052,7 @@
1025
1052
  .ui.form .fields.success .field .ui.dropdown,
1026
1053
  .ui.form .fields.success .field .ui.dropdown .item,
1027
1054
  .ui.form .field.success .ui.dropdown,
1028
- .ui.form .field.success .ui.dropdown .text,
1055
+ .ui.form .field.success .ui.dropdown > .text,
1029
1056
  .ui.form .field.success .ui.dropdown .item {
1030
1057
  background: #FCFFF5;
1031
1058
  color: #2C662D;
@@ -1089,6 +1116,10 @@
1089
1116
  .ui.form .field.success .checkbox .box:after {
1090
1117
  color: #2C662D;
1091
1118
  }
1119
+ .ui.inverted.form .fields.success .field label,
1120
+ .ui.inverted.form .success.field label {
1121
+ color: #b9d1ad;
1122
+ }
1092
1123
 
1093
1124
  /* On Form */
1094
1125
  .ui.form.warning .warning.message:not(:empty) {
@@ -1119,11 +1150,17 @@
1119
1150
  display: flex;
1120
1151
  }
1121
1152
  .ui.ui.form .fields.warning .field label,
1153
+ .ui.ui.form .fields.warning .field .ui.label:not(.corner),
1122
1154
  .ui.ui.form .field.warning label,
1155
+ .ui.ui.form .field.warning .ui.label:not(.corner),
1123
1156
  .ui.ui.form .fields.warning .field .input,
1124
1157
  .ui.ui.form .field.warning .input {
1125
1158
  color: #573A08;
1126
1159
  }
1160
+ .ui.form .fields.warning .field .ui.label,
1161
+ .ui.form .field.warning .ui.label {
1162
+ background-color: #d7ccb5;
1163
+ }
1127
1164
  .ui.form .fields.warning .field .corner.label,
1128
1165
  .ui.form .field.warning .corner.label {
1129
1166
  border-color: #573A08;
@@ -1238,7 +1275,7 @@
1238
1275
  .ui.form .fields.warning .field .ui.dropdown,
1239
1276
  .ui.form .fields.warning .field .ui.dropdown .item,
1240
1277
  .ui.form .field.warning .ui.dropdown,
1241
- .ui.form .field.warning .ui.dropdown .text,
1278
+ .ui.form .field.warning .ui.dropdown > .text,
1242
1279
  .ui.form .field.warning .ui.dropdown .item {
1243
1280
  background: #FFFAF3;
1244
1281
  color: #573A08;
@@ -1302,6 +1339,10 @@
1302
1339
  .ui.form .field.warning .checkbox .box:after {
1303
1340
  color: #573A08;
1304
1341
  }
1342
+ .ui.inverted.form .fields.warning .field label,
1343
+ .ui.inverted.form .warning.field label {
1344
+ color: #d7ccb5;
1345
+ }
1305
1346
 
1306
1347
  /*--------------------
1307
1348
  Disabled
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * # Fomantic-UI - Form Validation
2
+ * # Fomantic-UI 2.8.8 - Form Validation
3
3
  * http://github.com/fomantic/Fomantic-UI/
4
4
  *
5
5
  *
@@ -91,6 +91,7 @@ $.fn.form = function(parameters) {
91
91
  else {
92
92
  if(instance !== undefined) {
93
93
  instance.invoke('destroy');
94
+ module.refresh();
94
95
  }
95
96
  module.verbose('Initializing form validation', $module, settings);
96
97
  module.bindEvents();
@@ -171,11 +172,9 @@ $.fn.form = function(parameters) {
171
172
  }
172
173
 
173
174
  $field.on('change click keyup keydown blur', function(e) {
174
- $(this).triggerHandler(e.type + ".dirty");
175
+ module.determine.isDirty();
175
176
  });
176
177
 
177
- $field.on('change.dirty click.dirty keyup.dirty keydown.dirty blur.dirty', module.determine.isDirty);
178
-
179
178
  $module.on('dirty' + eventNamespace, function(e) {
180
179
  settings.onDirty.call();
181
180
  });
@@ -302,10 +301,6 @@ $.fn.form = function(parameters) {
302
301
  module.set.clean();
303
302
  }
304
303
 
305
- if (e && e.namespace === 'dirty') {
306
- e.stopImmediatePropagation();
307
- e.preventDefault();
308
- }
309
304
  }
310
305
  },
311
306
 
@@ -313,13 +308,6 @@ $.fn.form = function(parameters) {
313
308
  bracketedRule: function(rule) {
314
309
  return (rule.type && rule.type.match(settings.regExp.bracket));
315
310
  },
316
- shorthandFields: function(fields) {
317
- var
318
- fieldKeys = Object.keys(fields),
319
- firstRule = fields[fieldKeys[0]]
320
- ;
321
- return module.is.shorthandRules(firstRule);
322
- },
323
311
  // duck type rule test
324
312
  shorthandRules: function(rules) {
325
313
  return (typeof rules == 'string' || Array.isArray(rules));
@@ -422,7 +410,7 @@ $.fn.form = function(parameters) {
422
410
  ;
423
411
  if( key == keyCode.escape) {
424
412
  module.verbose('Escape key pressed blurring field');
425
- $field
413
+ $field[0]
426
414
  .blur()
427
415
  ;
428
416
  }
@@ -444,15 +432,11 @@ $.fn.form = function(parameters) {
444
432
  $fieldGroup = $field.closest($group),
445
433
  validationRules = module.get.validation($field)
446
434
  ;
447
- if( $fieldGroup.hasClass(className.error) ) {
435
+ if(validationRules && (settings.on == 'blur' || ( $fieldGroup.hasClass(className.error) && settings.revalidate) )) {
448
436
  module.debug('Revalidating field', $field, validationRules);
449
- if(validationRules) {
450
- module.validate.field( validationRules );
451
- }
452
- }
453
- else if(settings.on == 'blur') {
454
- if(validationRules) {
455
- module.validate.field( validationRules );
437
+ module.validate.field( validationRules );
438
+ if(!settings.inline) {
439
+ module.validate.form(false,true);
456
440
  }
457
441
  }
458
442
  },
@@ -465,7 +449,7 @@ $.fn.form = function(parameters) {
465
449
  if(validationRules && (settings.on == 'change' || ( $fieldGroup.hasClass(className.error) && settings.revalidate) )) {
466
450
  clearTimeout(module.timer);
467
451
  module.timer = setTimeout(function() {
468
- module.debug('Revalidating field', $field, module.get.validation($field));
452
+ module.debug('Revalidating field', $field, validationRules);
469
453
  module.validate.field( validationRules );
470
454
  if(!settings.inline) {
471
455
  module.validate.form(false,true);
@@ -527,15 +511,19 @@ $.fn.form = function(parameters) {
527
511
  fullFields = {}
528
512
  ;
529
513
  $.each(fields, function(name, rules) {
530
- if(typeof rules == 'string') {
531
- rules = [rules];
514
+ if (!Array.isArray(rules) && typeof rules === 'object') {
515
+ fullFields[name] = rules;
516
+ } else {
517
+ if (typeof rules == 'string') {
518
+ rules = [rules];
519
+ }
520
+ fullFields[name] = {
521
+ rules: []
522
+ };
523
+ $.each(rules, function (index, rule) {
524
+ fullFields[name].rules.push({type: rule});
525
+ });
532
526
  }
533
- fullFields[name] = {
534
- rules: []
535
- };
536
- $.each(rules, function(index, rule) {
537
- fullFields[name].rules.push({ type: rule });
538
- });
539
527
  });
540
528
  return fullFields;
541
529
  },
@@ -551,8 +539,23 @@ $.fn.form = function(parameters) {
551
539
  requiresValue = (prompt.search('{value}') !== -1),
552
540
  requiresName = (prompt.search('{name}') !== -1),
553
541
  $label,
554
- name
542
+ name,
543
+ parts,
544
+ suffixPrompt
555
545
  ;
546
+ if(ancillary && ancillary.indexOf('..') >= 0) {
547
+ parts = ancillary.split('..', 2);
548
+ if(!rule.prompt) {
549
+ suffixPrompt = (
550
+ parts[0] === '' ? settings.prompt.maxValue.replace(/\{ruleValue\}/g,'{max}') :
551
+ parts[1] === '' ? settings.prompt.minValue.replace(/\{ruleValue\}/g,'{min}') :
552
+ settings.prompt.range
553
+ );
554
+ prompt += suffixPrompt.replace(/\{name\}/g, ' ' + settings.text.and);
555
+ }
556
+ prompt = prompt.replace(/\{min\}/g, parts[0]);
557
+ prompt = prompt.replace(/\{max\}/g, parts[1]);
558
+ }
556
559
  if(requiresValue) {
557
560
  prompt = prompt.replace(/\{value\}/g, $field.val());
558
561
  }
@@ -588,7 +591,7 @@ $.fn.form = function(parameters) {
588
591
  }
589
592
  else {
590
593
  // 2.x
591
- if(parameters.fields && module.is.shorthandFields(parameters.fields)) {
594
+ if(parameters.fields) {
592
595
  parameters.fields = module.get.fieldsFromShorthand(parameters.fields);
593
596
  }
594
597
  settings = $.extend(true, {}, $.fn.form.settings, parameters);
@@ -616,7 +619,7 @@ $.fn.form = function(parameters) {
616
619
  instance = $module.data(moduleNamespace);
617
620
 
618
621
  // refresh selector cache
619
- module.refresh();
622
+ (instance || module).refresh();
620
623
  },
621
624
  field: function(identifier) {
622
625
  module.verbose('Finding field with identifier', identifier);
@@ -862,16 +865,7 @@ $.fn.form = function(parameters) {
862
865
  module.debug('Adding rules', newValidation.rules, validation);
863
866
  },
864
867
  fields: function(fields) {
865
- var
866
- newValidation
867
- ;
868
- if(fields && module.is.shorthandFields(fields)) {
869
- newValidation = module.get.fieldsFromShorthand(fields);
870
- }
871
- else {
872
- newValidation = fields;
873
- }
874
- validation = $.extend({}, validation, newValidation);
868
+ validation = $.extend({}, validation, module.get.fieldsFromShorthand(fields));
875
869
  },
876
870
  prompt: function(identifier, errors, internal) {
877
871
  var
@@ -1165,6 +1159,14 @@ $.fn.form = function(parameters) {
1165
1159
  }
1166
1160
  }
1167
1161
  });
1162
+ },
1163
+ optional: function(identifier, bool) {
1164
+ bool = (bool !== false);
1165
+ $.each(validation, function(fieldName, field) {
1166
+ if (identifier == fieldName || identifier == field.identifier) {
1167
+ field.optional = bool;
1168
+ }
1169
+ });
1168
1170
  }
1169
1171
  },
1170
1172
 
@@ -1201,6 +1203,24 @@ $.fn.form = function(parameters) {
1201
1203
  if(event && $module.data('moduleApi') !== undefined) {
1202
1204
  event.stopImmediatePropagation();
1203
1205
  }
1206
+ if(settings.errorFocus) {
1207
+ var focusElement, hasTabIndex = true;
1208
+ if (typeof settings.errorFocus === 'string') {
1209
+ focusElement = $(settings.errorFocus);
1210
+ hasTabIndex = focusElement.is('[tabindex]');
1211
+ // to be able to focus/scroll into non input elements we need a tabindex
1212
+ if (!hasTabIndex) {
1213
+ focusElement.attr('tabindex',-1);
1214
+ }
1215
+ } else {
1216
+ focusElement = $group.filter('.' + className.error).first().find(selector.field);
1217
+ }
1218
+ focusElement.focus();
1219
+ // only remove tabindex if it was dynamically created above
1220
+ if (!hasTabIndex){
1221
+ focusElement.removeAttr('tabindex');
1222
+ }
1223
+ }
1204
1224
  if(ignoreCallbacks !== true) {
1205
1225
  return settings.onFailure.call(element, formErrors, values);
1206
1226
  }
@@ -1290,7 +1310,7 @@ $.fn.form = function(parameters) {
1290
1310
  // cast to string avoiding encoding special values
1291
1311
  value = (value === undefined || value === '' || value === null)
1292
1312
  ? ''
1293
- : (settings.shouldTrim) ? String(value + '').trim() : String(value + '')
1313
+ : (settings.shouldTrim && rule.shouldTrim !== false) || rule.shouldTrim ? String(value + '').trim() : String(value + '')
1294
1314
  ;
1295
1315
  return ruleFunction.call(field, value, ancillary, $module);
1296
1316
  }
@@ -1506,6 +1526,7 @@ $.fn.form.settings = {
1506
1526
 
1507
1527
  autoCheckRequired : false,
1508
1528
  preventLeaving : false,
1529
+ errorFocus : false,
1509
1530
  dateHandling : 'date', // 'date', 'input', 'formatter'
1510
1531
 
1511
1532
  onValid : function() {},
@@ -1534,12 +1555,16 @@ $.fn.form.settings = {
1534
1555
  },
1535
1556
 
1536
1557
  text: {
1558
+ and : 'and',
1537
1559
  unspecifiedRule : 'Please enter a valid value',
1538
1560
  unspecifiedField : 'This field',
1539
1561
  leavingMessage : 'There are unsaved changes on this page which will be discarded if you continue.'
1540
1562
  },
1541
1563
 
1542
1564
  prompt: {
1565
+ range : '{name} must be in a range from {min} to {max}',
1566
+ maxValue : '{name} must have a maximum value of {ruleValue}',
1567
+ minValue : '{name} must have a minimum value of {ruleValue}',
1543
1568
  empty : '{name} must have a value',
1544
1569
  checked : '{name} must be checked',
1545
1570
  email : '{name} must be a valid e-mail',
@@ -1571,9 +1596,9 @@ $.fn.form.settings = {
1571
1596
  selector : {
1572
1597
  checkbox : 'input[type="checkbox"], input[type="radio"]',
1573
1598
  clear : '.clear',
1574
- field : 'input:not(.search), textarea, select',
1599
+ field : 'input:not(.search):not([type="file"]), textarea, select',
1575
1600
  group : '.field',
1576
- input : 'input',
1601
+ input : 'input:not([type="file"])',
1577
1602
  message : '.error.message',
1578
1603
  prompt : '.prompt.label',
1579
1604
  radio : 'input[type="radio"]',
@@ -1702,11 +1727,24 @@ $.fn.form.settings = {
1702
1727
  }
1703
1728
  return value.match( new RegExp(regExp, flags) );
1704
1729
  },
1705
-
1730
+ minValue: function(value, range) {
1731
+ return $.fn.form.settings.rules.range(value, range+'..', 'number');
1732
+ },
1733
+ maxValue: function(value, range) {
1734
+ return $.fn.form.settings.rules.range(value, '..'+range, 'number');
1735
+ },
1706
1736
  // is valid integer or matches range
1707
1737
  integer: function(value, range) {
1738
+ return $.fn.form.settings.rules.range(value, range, 'integer');
1739
+ },
1740
+ range: function(value, range, regExp) {
1741
+ if(typeof regExp == "string") {
1742
+ regExp = $.fn.form.settings.regExp[regExp];
1743
+ }
1744
+ if(!(regExp instanceof RegExp)) {
1745
+ regExp = $.fn.form.settings.regExp.integer;
1746
+ }
1708
1747
  var
1709
- intRegExp = $.fn.form.settings.regExp.integer,
1710
1748
  min,
1711
1749
  max,
1712
1750
  parts
@@ -1715,34 +1753,34 @@ $.fn.form.settings = {
1715
1753
  // do nothing
1716
1754
  }
1717
1755
  else if(range.indexOf('..') == -1) {
1718
- if(intRegExp.test(range)) {
1756
+ if(regExp.test(range)) {
1719
1757
  min = max = range - 0;
1720
1758
  }
1721
1759
  }
1722
1760
  else {
1723
1761
  parts = range.split('..', 2);
1724
- if(intRegExp.test(parts[0])) {
1762
+ if(regExp.test(parts[0])) {
1725
1763
  min = parts[0] - 0;
1726
1764
  }
1727
- if(intRegExp.test(parts[1])) {
1765
+ if(regExp.test(parts[1])) {
1728
1766
  max = parts[1] - 0;
1729
1767
  }
1730
1768
  }
1731
1769
  return (
1732
- intRegExp.test(value) &&
1770
+ regExp.test(value) &&
1733
1771
  (min === undefined || value >= min) &&
1734
1772
  (max === undefined || value <= max)
1735
1773
  );
1736
1774
  },
1737
1775
 
1738
1776
  // is valid number (with decimal)
1739
- decimal: function(value) {
1740
- return $.fn.form.settings.regExp.decimal.test(value);
1777
+ decimal: function(value, range) {
1778
+ return $.fn.form.settings.rules.range(value, range, 'decimal');
1741
1779
  },
1742
1780
 
1743
1781
  // is valid number
1744
- number: function(value) {
1745
- return $.fn.form.settings.regExp.number.test(value);
1782
+ number: function(value, range) {
1783
+ return $.fn.form.settings.rules.range(value, range, 'number');
1746
1784
  },
1747
1785
 
1748
1786
  // is value (case insensitive)
@@ -1947,8 +1985,8 @@ $.fn.form.settings = {
1947
1985
  return;
1948
1986
  }
1949
1987
 
1950
- // allow dashes in card
1951
- cardNumber = cardNumber.replace(/[\-]/g, '');
1988
+ // allow dashes and spaces in card
1989
+ cardNumber = cardNumber.replace(/[\s\-]/g, '');
1952
1990
 
1953
1991
  // verify card types
1954
1992
  if(requiredTypes) {