jsuites 6.4.2 → 6.5.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 +30 -9
  2. package/package.json +4 -4
package/dist/jsuites.js CHANGED
@@ -2320,6 +2320,10 @@ var jSuites;
2320
2320
  mask = d[3];
2321
2321
  }
2322
2322
  }
2323
+
2324
+ // Section chosen for this value, so a later pass over its
2325
+ // rendered string does not choose again
2326
+ control.section = mask;
2323
2327
  }
2324
2328
 
2325
2329
  // Transform Excel locale patterns (e.g., [$$-409]#,##0.00) - only if pattern exists
@@ -2682,6 +2686,14 @@ var jSuites;
2682
2686
  let index = control.caret.index;
2683
2687
  let position = control.caret.position;
2684
2688
  let value = String(control.values[index] ?? '');
2689
+ // Percent masks bake '%' into the same value slot as the number.
2690
+ // If the captured caret landed after the trailing '%', move it
2691
+ // before so it sits right after the digit — matching how text-
2692
+ // suffix masks like '0 liters' position the cursor.
2693
+ if (control.methods[index] && control.methods[index].type === 'percentage'
2694
+ && position > 0 && value.charAt(position - 1) === '%') {
2695
+ position--;
2696
+ }
2685
2697
  // Re-apply the caret to the original position
2686
2698
  control.values[index] = value.substring(0, position) + hiddenCaret + value.substring(position);
2687
2699
  }
@@ -3694,8 +3706,13 @@ var jSuites;
3694
3706
  }
3695
3707
  }
3696
3708
 
3697
- // Process mask
3698
- let control = Component(value, options, true);
3709
+ // Process mask. The section of a multi-section mask was chosen
3710
+ // from the original value above: the localized string keeps it
3711
+ let sectionOptions = options;
3712
+ if (typeof(config.section) !== 'undefined') {
3713
+ sectionOptions = typeof(options) === 'string' ? config.section : Object.assign({}, options, { mask: config.section });
3714
+ }
3715
+ let control = Component(value, sectionOptions, true);
3699
3716
  // Complement render
3700
3717
  if (fullMask) {
3701
3718
  processNumOfPaddingZeros(control);
@@ -20527,24 +20544,28 @@ function Validations() {
20527
20544
  },
20528
20545
  }
20529
20546
 
20547
+ const toLowerCase = function(value) {
20548
+ return typeof value === 'string' ? value.toLowerCase() : value;
20549
+ }
20550
+
20530
20551
  const textCriterias = {
20531
20552
  'contains': function(value, range) {
20532
- return value.includes(range[0]);
20553
+ return toLowerCase(value).includes(toLowerCase(range[0]));
20533
20554
  },
20534
20555
  'not contains': function(value, range) {
20535
- return !value.includes(range[0]);
20556
+ return !toLowerCase(value).includes(toLowerCase(range[0]));
20536
20557
  },
20537
20558
  'begins with': function(value, range) {
20538
- return value.startsWith(range[0]);
20559
+ return toLowerCase(value).startsWith(toLowerCase(range[0]));
20539
20560
  },
20540
20561
  'ends with': function(value, range) {
20541
- return value.endsWith(range[0]);
20562
+ return toLowerCase(value).endsWith(toLowerCase(range[0]));
20542
20563
  },
20543
20564
  '=': function(value, range) {
20544
- return value === range[0];
20565
+ return toLowerCase(value) === toLowerCase(range[0]);
20545
20566
  },
20546
20567
  '!=': function(value, range) {
20547
- return value !== range[0];
20568
+ return toLowerCase(value) !== toLowerCase(range[0]);
20548
20569
  },
20549
20570
  'valid email': function(value) {
20550
20571
  var pattern = new RegExp(/^[^\s@]+@[^\s@]+\.[^\s@]+$/);
@@ -23498,7 +23519,7 @@ var jSuites = {
23498
23519
  ...dictionary,
23499
23520
  ...helpers,
23500
23521
  /** Current version */
23501
- version: '6.4.2',
23522
+ version: '6.5.0',
23502
23523
  /** Bind new extensions to Jsuites */
23503
23524
  setExtensions: function(o) {
23504
23525
  if (typeof(o) == 'object') {
package/package.json CHANGED
@@ -26,17 +26,17 @@
26
26
  },
27
27
  "main": "dist/jsuites.js",
28
28
  "types": "dist/jsuites.d.ts",
29
- "version": "6.4.2",
29
+ "version": "6.5.0",
30
30
  "bugs": "https://github.com/jsuites/jsuites/issues",
31
31
  "homepage": "https://github.com/jsuites/jsuites",
32
32
  "docs": "https://jsuites.net",
33
33
  "download": "https://github.com/jsuites/jsuites/archive/master.zip",
34
34
  "dependencies": {
35
- "@jsuites/utils": "^6.0.6",
35
+ "@jsuites/utils": "^6.1.0",
36
36
  "@lemonadejs/calendar": "^5.9.3",
37
37
  "@lemonadejs/color": "^5.8.0",
38
- "@lemonadejs/contextmenu": "^5.8.5",
39
- "@lemonadejs/dropdown": "^5.8.4",
38
+ "@lemonadejs/contextmenu": "^5.8.4",
39
+ "@lemonadejs/dropdown": "^5.8.3",
40
40
  "@lemonadejs/modal": "^5.8.3",
41
41
  "@lemonadejs/rating": "^5.8.1",
42
42
  "@lemonadejs/switch": "^5.8.0",