jsuites 4.12.6 → 4.12.7

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.
@@ -17,7 +17,7 @@
17
17
 
18
18
  var jSuites = function(options) {
19
19
  var obj = {}
20
- var version = '4.12.6';
20
+ var version = '4.12.7';
21
21
 
22
22
  var find = function(DOMElement, component) {
23
23
  if (DOMElement[component.type] && DOMElement[component.type] == component) {
@@ -7292,7 +7292,7 @@ jSuites.mask = (function() {
7292
7292
  if (adjustNumeric) {
7293
7293
  var p = null;
7294
7294
  for (var i = 0; i < n.length; i++) {
7295
- if (n[i].match(/[\-0-9]/g) || n[i] == '.' || n[i] == ',') {
7295
+ if (n[i].match(/[\-0-9]/g) || n[i] == '.' || n[i] == ',') {
7296
7296
  p = i;
7297
7297
  }
7298
7298
  }
@@ -7337,7 +7337,11 @@ jSuites.mask = (function() {
7337
7337
  var Value = function(v, updateCaret, adjustNumeric) {
7338
7338
  if (this.tagName == 'DIV') {
7339
7339
  if (v === undefined) {
7340
- return this.innerText;
7340
+ var v = this.innerText;
7341
+ if (this.value && this.value.length > v.length) {
7342
+ v = this.value;
7343
+ }
7344
+ return v;
7341
7345
  } else {
7342
7346
  if (this.innerText !== v) {
7343
7347
  this.innerText = v;
@@ -8067,10 +8071,14 @@ jSuites.mask = (function() {
8067
8071
 
8068
8072
  // Mask detected start the process
8069
8073
  if (! isFormula(o.value) && (o.mask || o.locale)) {
8070
- // Compatibility ixes
8074
+ // Compatibility fixes
8071
8075
  if (o.mask) {
8072
8076
  // Remove []
8073
8077
  o.mask = o.mask.replace(new RegExp(/\[.*?\]/),'');
8078
+ if (o.mask.indexOf(';') !== -1) {
8079
+ var t = o.mask.split(';');
8080
+ o.mask = t[0];
8081
+ }
8074
8082
  // Excel mask TODO: Improve
8075
8083
  if (o.mask.indexOf('##') !== -1) {
8076
8084
  var d = o.mask.split(';');
@@ -8226,6 +8234,15 @@ jSuites.mask = (function() {
8226
8234
  options.mask = options.format;
8227
8235
  }
8228
8236
 
8237
+ // Remove []
8238
+ if (options.mask) {
8239
+ if (options.mask.indexOf(';') !== -1) {
8240
+ var t = options.mask.split(';');
8241
+ options.mask = t[0];
8242
+ }
8243
+ options.mask = options.mask.replace(new RegExp(/\[.*?\]/),'');
8244
+ }
8245
+
8229
8246
  // Get decimal
8230
8247
  getDecimal.call(options, options.mask);
8231
8248
 
@@ -8301,6 +8318,10 @@ jSuites.mask = (function() {
8301
8318
 
8302
8319
  // Remove []
8303
8320
  if (options.mask) {
8321
+ if (options.mask.indexOf(';') !== -1) {
8322
+ var t = options.mask.split(';');
8323
+ options.mask = t[0];
8324
+ }
8304
8325
  options.mask = options.mask.replace(new RegExp(/\[.*?\]/),'');
8305
8326
  }
8306
8327
 
package/dist/jsuites.js CHANGED
@@ -17,7 +17,7 @@
17
17
 
18
18
  var jSuites = function(options) {
19
19
  var obj = {}
20
- var version = '4.12.6';
20
+ var version = '4.12.7';
21
21
 
22
22
  var find = function(DOMElement, component) {
23
23
  if (DOMElement[component.type] && DOMElement[component.type] == component) {
@@ -7717,7 +7717,7 @@ jSuites.mask = (function() {
7717
7717
  if (adjustNumeric) {
7718
7718
  var p = null;
7719
7719
  for (var i = 0; i < n.length; i++) {
7720
- if (n[i].match(/[\-0-9]/g) || n[i] == '.' || n[i] == ',') {
7720
+ if (n[i].match(/[\-0-9]/g) || n[i] == '.' || n[i] == ',') {
7721
7721
  p = i;
7722
7722
  }
7723
7723
  }
@@ -7762,7 +7762,11 @@ jSuites.mask = (function() {
7762
7762
  var Value = function(v, updateCaret, adjustNumeric) {
7763
7763
  if (this.tagName == 'DIV') {
7764
7764
  if (v === undefined) {
7765
- return this.innerText;
7765
+ var v = this.innerText;
7766
+ if (this.value && this.value.length > v.length) {
7767
+ v = this.value;
7768
+ }
7769
+ return v;
7766
7770
  } else {
7767
7771
  if (this.innerText !== v) {
7768
7772
  this.innerText = v;
@@ -8492,10 +8496,14 @@ jSuites.mask = (function() {
8492
8496
 
8493
8497
  // Mask detected start the process
8494
8498
  if (! isFormula(o.value) && (o.mask || o.locale)) {
8495
- // Compatibility ixes
8499
+ // Compatibility fixes
8496
8500
  if (o.mask) {
8497
8501
  // Remove []
8498
8502
  o.mask = o.mask.replace(new RegExp(/\[.*?\]/),'');
8503
+ if (o.mask.indexOf(';') !== -1) {
8504
+ var t = o.mask.split(';');
8505
+ o.mask = t[0];
8506
+ }
8499
8507
  // Excel mask TODO: Improve
8500
8508
  if (o.mask.indexOf('##') !== -1) {
8501
8509
  var d = o.mask.split(';');
@@ -8651,6 +8659,15 @@ jSuites.mask = (function() {
8651
8659
  options.mask = options.format;
8652
8660
  }
8653
8661
 
8662
+ // Remove []
8663
+ if (options.mask) {
8664
+ if (options.mask.indexOf(';') !== -1) {
8665
+ var t = options.mask.split(';');
8666
+ options.mask = t[0];
8667
+ }
8668
+ options.mask = options.mask.replace(new RegExp(/\[.*?\]/),'');
8669
+ }
8670
+
8654
8671
  // Get decimal
8655
8672
  getDecimal.call(options, options.mask);
8656
8673
 
@@ -8726,6 +8743,10 @@ jSuites.mask = (function() {
8726
8743
 
8727
8744
  // Remove []
8728
8745
  if (options.mask) {
8746
+ if (options.mask.indexOf(';') !== -1) {
8747
+ var t = options.mask.split(';');
8748
+ options.mask = t[0];
8749
+ }
8729
8750
  options.mask = options.mask.replace(new RegExp(/\[.*?\]/),'');
8730
8751
  }
8731
8752
 
@@ -12002,10 +12023,10 @@ jSuites.validations = (function() {
12002
12023
  return value >= range[0];
12003
12024
  },
12004
12025
  '=': function(value, range) {
12005
- return value === range[0];
12026
+ return value == range[0];
12006
12027
  },
12007
12028
  '!=': function(value, range) {
12008
- return value !== range[0];
12029
+ return value != range[0];
12009
12030
  },
12010
12031
  }
12011
12032
 
@@ -12043,6 +12064,12 @@ jSuites.validations = (function() {
12043
12064
  'not contains': function(value, range) {
12044
12065
  return !value.includes(range[0]);
12045
12066
  },
12067
+ 'begins with': function(value, range) {
12068
+ return value.startsWith(range[0]);
12069
+ },
12070
+ 'ends with': function(value, range) {
12071
+ return value.endsWith(range[0]);
12072
+ },
12046
12073
  '=': function(value, range) {
12047
12074
  return value === range[0];
12048
12075
  },
@@ -12083,7 +12110,15 @@ jSuites.validations = (function() {
12083
12110
  component.required = function(data) {
12084
12111
  return data.trim() ? true : false;
12085
12112
  }
12086
-
12113
+
12114
+ component.exist = function(data, options) {
12115
+ return !!data.toString();
12116
+ }
12117
+
12118
+ component['not exist'] = function(data, options) {
12119
+ return !data.toString();
12120
+ }
12121
+
12087
12122
  component.number = function(data, options) {
12088
12123
  if (! isNumeric(data)) {
12089
12124
  return false;
@@ -12115,7 +12150,7 @@ jSuites.validations = (function() {
12115
12150
  return false;
12116
12151
  }
12117
12152
 
12118
- var validOption = options.value[0].split(',').findIndex(function name(item) {
12153
+ var validOption = options.value[0].findIndex(function name(item) {
12119
12154
  return item == data;
12120
12155
  });
12121
12156
 
@@ -12158,6 +12193,12 @@ jSuites.validations = (function() {
12158
12193
  return textCriterias[options.criteria](data, options.value);
12159
12194
  }
12160
12195
 
12196
+ component.textLength = function(data, options) {
12197
+ data = data.toString();
12198
+
12199
+ return component.number(data.length, options);
12200
+ }
12201
+
12161
12202
  return component;
12162
12203
  })();
12163
12204
 
package/package.json CHANGED
@@ -19,7 +19,7 @@
19
19
  "javascript plugins"
20
20
  ],
21
21
  "main": "dist/jsuites.js",
22
- "version": "4.12.6",
22
+ "version": "4.12.7",
23
23
  "bugs": "https://github.com/jsuites/jsuites/issues",
24
24
  "homepage": "https://github.com/jsuites/jsuites",
25
25
  "docs": "https://jsuites.net",