jsuites 4.12.4 → 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.4';
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) {
@@ -7061,6 +7061,8 @@ jSuites.loading = (function() {
7061
7061
  jSuites.mask = (function() {
7062
7062
  // Currency
7063
7063
  var tokens = {
7064
+ // Text
7065
+ text: [ '@' ],
7064
7066
  // Currency tokens
7065
7067
  currency: [ '#(.{1})##0?(.{1}0+)?( ?;(.*)?)?', '#' ],
7066
7068
  // Percentage
@@ -7290,7 +7292,7 @@ jSuites.mask = (function() {
7290
7292
  if (adjustNumeric) {
7291
7293
  var p = null;
7292
7294
  for (var i = 0; i < n.length; i++) {
7293
- if (n[i].match(/[\-0-9]/g) || n[i] == '.' || n[i] == ',') {
7295
+ if (n[i].match(/[\-0-9]/g) || n[i] == '.' || n[i] == ',') {
7294
7296
  p = i;
7295
7297
  }
7296
7298
  }
@@ -7335,7 +7337,11 @@ jSuites.mask = (function() {
7335
7337
  var Value = function(v, updateCaret, adjustNumeric) {
7336
7338
  if (this.tagName == 'DIV') {
7337
7339
  if (v === undefined) {
7338
- 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;
7339
7345
  } else {
7340
7346
  if (this.innerText !== v) {
7341
7347
  this.innerText = v;
@@ -7818,6 +7824,12 @@ jSuites.mask = (function() {
7818
7824
  },
7819
7825
  '.': function(v) {
7820
7826
  parser['[0-9a-zA-Z$]+'].call(this, v);
7827
+ },
7828
+ '@': function(v) {
7829
+ if (isBlank(this.values[this.index])) {
7830
+ this.values[this.index] = '';
7831
+ }
7832
+ this.values[this.index] += v;
7821
7833
  }
7822
7834
  }
7823
7835
 
@@ -7828,7 +7840,7 @@ jSuites.mask = (function() {
7828
7840
  if (this.type == 'general') {
7829
7841
  var t = [].concat(tokens.general);
7830
7842
  } else {
7831
- var t = [].concat(tokens.currency, tokens.datetime, tokens.percentage, tokens.numeric, tokens.general);
7843
+ var t = [].concat(tokens.currency, tokens.datetime, tokens.percentage, tokens.numeric, tokens.text, tokens.general);
7832
7844
  }
7833
7845
  // Expression to extract all tokens from the string
7834
7846
  var e = new RegExp(t.join('|'), 'gi');
@@ -7842,6 +7854,8 @@ jSuites.mask = (function() {
7842
7854
  var getMethod = function(str) {
7843
7855
  if (! this.type) {
7844
7856
  var types = Object.keys(tokens);
7857
+ } else if (this.type == 'text') {
7858
+ var types = [ 'text' ];
7845
7859
  } else if (this.type == 'general') {
7846
7860
  var types = [ 'general' ];
7847
7861
  } else if (this.type == 'datetime') {
@@ -8057,20 +8071,24 @@ jSuites.mask = (function() {
8057
8071
 
8058
8072
  // Mask detected start the process
8059
8073
  if (! isFormula(o.value) && (o.mask || o.locale)) {
8060
- // Compatibility ixes
8074
+ // Compatibility fixes
8061
8075
  if (o.mask) {
8062
- // Legacy
8063
- o.mask = o.mask.replace('[-]', '');
8076
+ // Remove []
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
+ }
8064
8082
  // Excel mask TODO: Improve
8065
8083
  if (o.mask.indexOf('##') !== -1) {
8066
8084
  var d = o.mask.split(';');
8067
8085
  if (d[0]) {
8068
8086
  d[0] = d[0].replace('*', '\t');
8069
8087
  d[0] = d[0].replace(new RegExp(/_-/g), ' ');
8088
+ d[0] = d[0].replace(new RegExp(/_/g), '');
8070
8089
  d[0] = d[0].replace('##0.###','##0.000');
8071
8090
  d[0] = d[0].replace('##0.##','##0.00');
8072
8091
  d[0] = d[0].replace('##0.#','##0.0');
8073
- d[0] = d[0].replace(new RegExp(/\[.*?\]/),'');
8074
8092
  }
8075
8093
  o.mask = d[0];
8076
8094
  }
@@ -8216,6 +8234,15 @@ jSuites.mask = (function() {
8216
8234
  options.mask = options.format;
8217
8235
  }
8218
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
+
8219
8246
  // Get decimal
8220
8247
  getDecimal.call(options, options.mask);
8221
8248
 
@@ -8289,6 +8316,15 @@ jSuites.mask = (function() {
8289
8316
  options.mask = options.format;
8290
8317
  }
8291
8318
 
8319
+ // Remove []
8320
+ if (options.mask) {
8321
+ if (options.mask.indexOf(';') !== -1) {
8322
+ var t = options.mask.split(';');
8323
+ options.mask = t[0];
8324
+ }
8325
+ options.mask = options.mask.replace(new RegExp(/\[.*?\]/),'');
8326
+ }
8327
+
8292
8328
  var type = null;
8293
8329
  if (options.type == 'percent' || options.options.style == 'percent') {
8294
8330
  type = 'percentage';
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.4';
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) {
@@ -7486,6 +7486,8 @@ jSuites.loading = (function() {
7486
7486
  jSuites.mask = (function() {
7487
7487
  // Currency
7488
7488
  var tokens = {
7489
+ // Text
7490
+ text: [ '@' ],
7489
7491
  // Currency tokens
7490
7492
  currency: [ '#(.{1})##0?(.{1}0+)?( ?;(.*)?)?', '#' ],
7491
7493
  // Percentage
@@ -7715,7 +7717,7 @@ jSuites.mask = (function() {
7715
7717
  if (adjustNumeric) {
7716
7718
  var p = null;
7717
7719
  for (var i = 0; i < n.length; i++) {
7718
- if (n[i].match(/[\-0-9]/g) || n[i] == '.' || n[i] == ',') {
7720
+ if (n[i].match(/[\-0-9]/g) || n[i] == '.' || n[i] == ',') {
7719
7721
  p = i;
7720
7722
  }
7721
7723
  }
@@ -7760,7 +7762,11 @@ jSuites.mask = (function() {
7760
7762
  var Value = function(v, updateCaret, adjustNumeric) {
7761
7763
  if (this.tagName == 'DIV') {
7762
7764
  if (v === undefined) {
7763
- 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;
7764
7770
  } else {
7765
7771
  if (this.innerText !== v) {
7766
7772
  this.innerText = v;
@@ -8243,6 +8249,12 @@ jSuites.mask = (function() {
8243
8249
  },
8244
8250
  '.': function(v) {
8245
8251
  parser['[0-9a-zA-Z$]+'].call(this, v);
8252
+ },
8253
+ '@': function(v) {
8254
+ if (isBlank(this.values[this.index])) {
8255
+ this.values[this.index] = '';
8256
+ }
8257
+ this.values[this.index] += v;
8246
8258
  }
8247
8259
  }
8248
8260
 
@@ -8253,7 +8265,7 @@ jSuites.mask = (function() {
8253
8265
  if (this.type == 'general') {
8254
8266
  var t = [].concat(tokens.general);
8255
8267
  } else {
8256
- var t = [].concat(tokens.currency, tokens.datetime, tokens.percentage, tokens.numeric, tokens.general);
8268
+ var t = [].concat(tokens.currency, tokens.datetime, tokens.percentage, tokens.numeric, tokens.text, tokens.general);
8257
8269
  }
8258
8270
  // Expression to extract all tokens from the string
8259
8271
  var e = new RegExp(t.join('|'), 'gi');
@@ -8267,6 +8279,8 @@ jSuites.mask = (function() {
8267
8279
  var getMethod = function(str) {
8268
8280
  if (! this.type) {
8269
8281
  var types = Object.keys(tokens);
8282
+ } else if (this.type == 'text') {
8283
+ var types = [ 'text' ];
8270
8284
  } else if (this.type == 'general') {
8271
8285
  var types = [ 'general' ];
8272
8286
  } else if (this.type == 'datetime') {
@@ -8482,20 +8496,24 @@ jSuites.mask = (function() {
8482
8496
 
8483
8497
  // Mask detected start the process
8484
8498
  if (! isFormula(o.value) && (o.mask || o.locale)) {
8485
- // Compatibility ixes
8499
+ // Compatibility fixes
8486
8500
  if (o.mask) {
8487
- // Legacy
8488
- o.mask = o.mask.replace('[-]', '');
8501
+ // Remove []
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
+ }
8489
8507
  // Excel mask TODO: Improve
8490
8508
  if (o.mask.indexOf('##') !== -1) {
8491
8509
  var d = o.mask.split(';');
8492
8510
  if (d[0]) {
8493
8511
  d[0] = d[0].replace('*', '\t');
8494
8512
  d[0] = d[0].replace(new RegExp(/_-/g), ' ');
8513
+ d[0] = d[0].replace(new RegExp(/_/g), '');
8495
8514
  d[0] = d[0].replace('##0.###','##0.000');
8496
8515
  d[0] = d[0].replace('##0.##','##0.00');
8497
8516
  d[0] = d[0].replace('##0.#','##0.0');
8498
- d[0] = d[0].replace(new RegExp(/\[.*?\]/),'');
8499
8517
  }
8500
8518
  o.mask = d[0];
8501
8519
  }
@@ -8641,6 +8659,15 @@ jSuites.mask = (function() {
8641
8659
  options.mask = options.format;
8642
8660
  }
8643
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
+
8644
8671
  // Get decimal
8645
8672
  getDecimal.call(options, options.mask);
8646
8673
 
@@ -8714,6 +8741,15 @@ jSuites.mask = (function() {
8714
8741
  options.mask = options.format;
8715
8742
  }
8716
8743
 
8744
+ // Remove []
8745
+ if (options.mask) {
8746
+ if (options.mask.indexOf(';') !== -1) {
8747
+ var t = options.mask.split(';');
8748
+ options.mask = t[0];
8749
+ }
8750
+ options.mask = options.mask.replace(new RegExp(/\[.*?\]/),'');
8751
+ }
8752
+
8717
8753
  var type = null;
8718
8754
  if (options.type == 'percent' || options.options.style == 'percent') {
8719
8755
  type = 'percentage';
@@ -11987,10 +12023,10 @@ jSuites.validations = (function() {
11987
12023
  return value >= range[0];
11988
12024
  },
11989
12025
  '=': function(value, range) {
11990
- return value === range[0];
12026
+ return value == range[0];
11991
12027
  },
11992
12028
  '!=': function(value, range) {
11993
- return value !== range[0];
12029
+ return value != range[0];
11994
12030
  },
11995
12031
  }
11996
12032
 
@@ -12028,6 +12064,12 @@ jSuites.validations = (function() {
12028
12064
  'not contains': function(value, range) {
12029
12065
  return !value.includes(range[0]);
12030
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
+ },
12031
12073
  '=': function(value, range) {
12032
12074
  return value === range[0];
12033
12075
  },
@@ -12068,7 +12110,15 @@ jSuites.validations = (function() {
12068
12110
  component.required = function(data) {
12069
12111
  return data.trim() ? true : false;
12070
12112
  }
12071
-
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
+
12072
12122
  component.number = function(data, options) {
12073
12123
  if (! isNumeric(data)) {
12074
12124
  return false;
@@ -12100,7 +12150,7 @@ jSuites.validations = (function() {
12100
12150
  return false;
12101
12151
  }
12102
12152
 
12103
- var validOption = options.value[0].split(',').findIndex(function name(item) {
12153
+ var validOption = options.value[0].findIndex(function name(item) {
12104
12154
  return item == data;
12105
12155
  });
12106
12156
 
@@ -12143,6 +12193,12 @@ jSuites.validations = (function() {
12143
12193
  return textCriterias[options.criteria](data, options.value);
12144
12194
  }
12145
12195
 
12196
+ component.textLength = function(data, options) {
12197
+ data = data.toString();
12198
+
12199
+ return component.number(data.length, options);
12200
+ }
12201
+
12146
12202
  return component;
12147
12203
  })();
12148
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.4",
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",
@@ -1,5 +0,0 @@
1
- FROM php:7.3-fpm
2
-
3
- WORKDIR /var/www/html
4
-
5
- ENTRYPOINT php /var/www/html/compile.php