jsuites 5.9.1 → 5.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/jsuites.js +69 -17
  2. package/package.json +1 -1
package/dist/jsuites.js CHANGED
@@ -2033,27 +2033,46 @@ function Mask() {
2033
2033
  parser['DDDD'].call(this, v);
2034
2034
  },
2035
2035
  'HH12': function(v, two) {
2036
- if (isBlank(this.values[this.index])) {
2037
- if (parseInt(v) > 1 && parseInt(v) < 10) {
2038
- if (two) {
2039
- v = 0 + v;
2036
+ var test = false;
2037
+ if (parseInt(v) >= 0 && parseInt(v) < 10) {
2038
+ if (isBlank(this.values[this.index])) {
2039
+ if (parseInt(v) > 1 && parseInt(v) < 10) {
2040
+ if (two) {
2041
+ v = 0 + v;
2042
+ }
2043
+ this.date[3] = this.values[this.index] = v;
2044
+ this.index++;
2045
+ } else if (parseInt(v) < 10) {
2046
+ this.values[this.index] = v;
2047
+ }
2048
+ } else {
2049
+ if (this.values[this.index] == 1 && parseInt(v) < 3) {
2050
+ this.date[3] = this.values[this.index] += v;
2051
+ this.index++;
2052
+ } else if (this.values[this.index] < 1 && parseInt(v) < 10) {
2053
+ this.date[3] = this.values[this.index] += v;
2054
+ this.index++;
2055
+ } else {
2056
+ var test = true;
2040
2057
  }
2041
- this.date[3] = this.values[this.index] = v;
2042
- this.index++;
2043
- } else if (parseInt(v) < 10) {
2044
- this.values[this.index] = v;
2045
2058
  }
2046
2059
  } else {
2047
- if (this.values[this.index] == 1 && parseInt(v) < 3) {
2048
- this.date[3] = this.values[this.index] += v;
2049
- this.index++;
2050
- } else if (this.values[this.index] < 1 && parseInt(v) < 10) {
2051
- this.date[3] = this.values[this.index] += v;
2060
+ var test = true;
2061
+ }
2062
+
2063
+ // Re-test
2064
+ if (test == true) {
2065
+ var t = parseInt(this.values[this.index]);
2066
+ if (t >= 0 && t <= 12) {
2067
+ this.date[3] = this.values[this.index];
2052
2068
  this.index++;
2069
+ // Repeat the character
2070
+ this.position--;
2053
2071
  }
2054
2072
  }
2055
2073
  },
2056
2074
  'HH24': function(v, two) {
2075
+ var test = false;
2057
2076
  if (parseInt(v) >= 0 && parseInt(v) < 10) {
2058
2077
  if (this.values[this.index] == null || this.values[this.index] == '') {
2059
2078
  if (parseInt(v) > 2 && parseInt(v) < 10) {
@@ -2078,8 +2097,23 @@ function Mask() {
2078
2097
  }
2079
2098
  this.date[3] = this.values[this.index] += v;
2080
2099
  this.index++;
2100
+ } else {
2101
+ var test = true;
2081
2102
  }
2082
2103
  }
2104
+ } else {
2105
+ var test = true;
2106
+ }
2107
+
2108
+ // Re-test
2109
+ if (test == true) {
2110
+ var t = parseInt(this.values[this.index]);
2111
+ if (t >= 0 && t < 24) {
2112
+ this.date[3] = this.values[this.index];
2113
+ this.index++;
2114
+ // Repeat the character
2115
+ this.position--;
2116
+ }
2083
2117
  }
2084
2118
  },
2085
2119
  'HH': function(v) {
@@ -2924,9 +2958,7 @@ function Mask() {
2924
2958
  t = parseFloat(n[0] + '.' + fraction + '1').toFixed(d);
2925
2959
  }
2926
2960
  } else {
2927
- if (value.toString().indexOf(d) !== -1) {
2928
- t = value.toFixed(0);
2929
- }
2961
+ t = value.toFixed(0);
2930
2962
  }
2931
2963
 
2932
2964
  // Handle scientific notation
@@ -10233,6 +10265,26 @@ function Validations() {
10233
10265
  return component.number(textLength, options);
10234
10266
  }
10235
10267
 
10268
+ component.time = function(data, options) {
10269
+ if (! isNumeric(data)) {
10270
+ return false;
10271
+ }
10272
+
10273
+ if (!options || !options.criteria) {
10274
+ return true;
10275
+ }
10276
+
10277
+ if (!numberCriterias[options.criteria]) {
10278
+ return false;
10279
+ }
10280
+
10281
+ let values = options.value.map(function(num) {
10282
+ return parseInt(parseFloat(num) * 10**17) / 10**17;
10283
+ })
10284
+
10285
+ return numberCriterias[options.criteria](parseInt(parseFloat(data) * 10**17) / 10**17, values);
10286
+ };
10287
+
10236
10288
  return component;
10237
10289
  }
10238
10290
 
@@ -12905,7 +12957,7 @@ var jsuites_jSuites = {
12905
12957
  ...dictionary,
12906
12958
  ...helpers,
12907
12959
  /** Current version */
12908
- version: '5.8.5',
12960
+ version: '5.9.3',
12909
12961
  /** Bind new extensions to Jsuites */
12910
12962
  setExtensions: function(o) {
12911
12963
  if (typeof(o) == 'object') {
package/package.json CHANGED
@@ -26,7 +26,7 @@
26
26
  },
27
27
  "main": "dist/jsuites.js",
28
28
  "types": "dist/jsuites.d.ts",
29
- "version": "5.9.1",
29
+ "version": "5.10.0",
30
30
  "bugs": "https://github.com/jsuites/jsuites/issues",
31
31
  "homepage": "https://github.com/jsuites/jsuites",
32
32
  "docs": "https://jsuites.net",