jsuites 5.0.20 → 5.0.21

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 +21 -17
  2. package/package.json +1 -1
package/dist/jsuites.js CHANGED
@@ -1467,12 +1467,14 @@ function Mask() {
1467
1467
  }
1468
1468
 
1469
1469
  var isFormula = function(value) {
1470
- return (''+value).chartAt(0) == '=';
1470
+ var v = (''+value)[0];
1471
+ return v == '=' ? true : false;
1471
1472
  }
1472
1473
 
1473
1474
  var isNumeric = function(t) {
1474
1475
  return t === 'currency' || t === 'percentage' || t === 'numeric' ? true : false;
1475
1476
  }
1477
+
1476
1478
  /**
1477
1479
  * Get the decimal defined in the mask configuration
1478
1480
  */
@@ -1572,7 +1574,7 @@ function Mask() {
1572
1574
  }
1573
1575
 
1574
1576
  var FormatValue = function(v, event) {
1575
- if (v == '') {
1577
+ if (v === '') {
1576
1578
  return '';
1577
1579
  }
1578
1580
  // Get decimal
@@ -1581,25 +1583,33 @@ function Mask() {
1581
1583
  var o = this.options;
1582
1584
  // Parse value
1583
1585
  v = ParseValue.call(this, v);
1584
- if (v == '') {
1586
+ if (v === '') {
1585
1587
  return '';
1586
1588
  }
1589
+ var t = null;
1587
1590
  // Temporary value
1588
1591
  if (v[0]) {
1589
- var t = parseFloat(v[0] + '.1');
1590
- if (o.style == 'percent') {
1591
- t /= 100;
1592
+ if (o.style === 'percent') {
1593
+ t = parseFloat(v[0]) / 100;
1594
+ } else {
1595
+ t = parseFloat(v[0] + '.1');
1592
1596
  }
1593
- } else {
1594
- var t = null;
1595
1597
  }
1596
1598
 
1597
- if ((v[0] == '-' || v[0] == '-00') && ! v[1] && (event && event.inputType == "deleteContentBackward")) {
1599
+ if ((v[0] === '-' || v[0] === '-00') && ! v[1] && (event && event.inputType == "deleteContentBackward")) {
1598
1600
  return '';
1599
1601
  }
1600
1602
 
1601
1603
  var n = new Intl.NumberFormat(this.locale, o).format(t);
1602
1604
  n = n.split(d);
1605
+
1606
+ if (o.style === 'percent') {
1607
+ if (n[0].indexOf('%') !== -1) {
1608
+ n[0] = n[0].replace('%', '');
1609
+ n[2] = '%';
1610
+ }
1611
+ }
1612
+
1603
1613
  if (typeof(n[1]) !== 'undefined') {
1604
1614
  var s = n[1].replace(/[0-9]*/g, '');
1605
1615
  if (s) {
@@ -1623,7 +1633,6 @@ function Mask() {
1623
1633
  }
1624
1634
 
1625
1635
  // Get decimal
1626
- var d = getDecimal.call(this);
1627
1636
  var n = FormatValue.call(this, v, event);
1628
1637
  var t = (n.length) - v.length;
1629
1638
  var index = Caret.call(e) + t;
@@ -1673,7 +1682,7 @@ function Mask() {
1673
1682
  if (adjustNumeric) {
1674
1683
  var p = null;
1675
1684
  for (var i = 0; i < n.length; i++) {
1676
- if (n[i].match(/[\-0-9]/g) || n[i] == '.' || n[i] == ',') {
1685
+ if (n[i].match(/[\-0-9]/g) || n[i] === '.' || n[i] === ',') {
1677
1686
  p = i;
1678
1687
  }
1679
1688
  }
@@ -2358,11 +2367,6 @@ function Mask() {
2358
2367
  }
2359
2368
  }
2360
2369
 
2361
- var isFormula = function(value) {
2362
- var v = (''+value)[0];
2363
- return v == '=' ? true : false;
2364
- }
2365
-
2366
2370
  var toPlainString = function(num) {
2367
2371
  return (''+ +num).replace(/(-?)(\d*)\.?(\d*)e([+-]\d+)/,
2368
2372
  function(a,b,c,d,e) {
@@ -12584,7 +12588,7 @@ var jSuites = {
12584
12588
  ...dictionary,
12585
12589
  ...helpers,
12586
12590
  /** Current version */
12587
- version: '5.0.20',
12591
+ version: '5.0.21',
12588
12592
  /** Bind new extensions to Jsuites */
12589
12593
  setExtensions: function(o) {
12590
12594
  if (typeof(o) == 'object') {
package/package.json CHANGED
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "main": "dist/jsuites.js",
27
27
  "types": "dist/jsuites.d.ts",
28
- "version": "5.0.20",
28
+ "version": "5.0.21",
29
29
  "bugs": "https://github.com/jsuites/jsuites/issues",
30
30
  "homepage": "https://github.com/jsuites/jsuites",
31
31
  "docs": "https://jsuites.net",