jsuites 5.0.26 → 5.0.28

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.
package/dist/jsuites.css CHANGED
@@ -5,10 +5,11 @@
5
5
  --safe-area-bottom: env(safe-area-inset-bottom);
6
6
  }
7
7
 
8
- [data-visible="false"] {
8
+ [data-visible="false"], .row[data-visible="false"] {
9
9
  display: none;
10
10
  }
11
11
 
12
+
12
13
  div[data-before]:before {
13
14
  content: attr(data-before);
14
15
  }
@@ -944,7 +945,8 @@ div[data-before]:before {
944
945
  }
945
946
 
946
947
  .jcontextmenu > div span {
947
- margin-right:10px;
948
+ margin-right: 10px;
949
+ font-size: 0.9em;
948
950
  }
949
951
 
950
952
  .jcontextmenu .jcontextmenu-disabled a {
package/dist/jsuites.js CHANGED
@@ -598,11 +598,9 @@ function HelpersDate() {
598
598
  jsDate = new Date(jsDate + ' GMT+0');
599
599
  }
600
600
  var jsDateInMilliseconds = jsDate.getTime();
601
-
602
601
  if (jsDateInMilliseconds >= excelLeapYearBug) {
603
602
  jsDateInMilliseconds += millisecondsPerDay;
604
603
  }
605
-
606
604
  jsDateInMilliseconds -= excelInitialTime;
607
605
 
608
606
  return jsDateInMilliseconds / millisecondsPerDay;
@@ -615,7 +613,6 @@ function HelpersDate() {
615
613
  */
616
614
  Component.numToDate = function (excelSerialNumber) {
617
615
  var jsDateInMilliseconds = excelInitialTime + excelSerialNumber * millisecondsPerDay;
618
-
619
616
  if (jsDateInMilliseconds >= excelLeapYearBug) {
620
617
  jsDateInMilliseconds -= millisecondsPerDay;
621
618
  }
@@ -2590,7 +2587,7 @@ function Mask() {
2590
2587
  o.number = Extract.call(o, v);
2591
2588
  // Keep the raw data as a property of the tag
2592
2589
  if (o.type == 'percentage' && v.indexOf('%') !== -1) {
2593
- label = o.number / 100;
2590
+ label = obj.adjustPrecision(o.number / 100);
2594
2591
  } else {
2595
2592
  label = o.number;
2596
2593
  }
@@ -2617,6 +2614,37 @@ function Mask() {
2617
2614
  }
2618
2615
  }
2619
2616
 
2617
+ obj.adjustPrecision = function(num) {
2618
+ if (typeof num === 'number' && !Number.isInteger(num)) {
2619
+ const v = num.toString().split('.');
2620
+
2621
+ if (v[1] && v[1].length > 10) {
2622
+ let t0 = 0;
2623
+ const t1 = v[1][v[1].length - 2];
2624
+
2625
+ if (t1 == 0 || t1 == 9) {
2626
+ for (let i = v[1].length - 2; i > 0; i--) {
2627
+ if (t0 >= 0 && v[1][i] == t1) {
2628
+ t0++;
2629
+ if (t0 > 6) {
2630
+ break;
2631
+ }
2632
+ } else {
2633
+ t0 = 0;
2634
+ break;
2635
+ }
2636
+ }
2637
+
2638
+ if (t0) {
2639
+ return parseFloat(parseFloat(num).toFixed(v[1].length - 1));
2640
+ }
2641
+ }
2642
+ }
2643
+ }
2644
+
2645
+ return num;
2646
+ }
2647
+
2620
2648
  // Get the type of the mask
2621
2649
  obj.getType = getType;
2622
2650
 
@@ -2789,8 +2817,8 @@ function Mask() {
2789
2817
  }
2790
2818
  } else {
2791
2819
  // Percentage
2792
- if (type == 'percentage') {
2793
- value *= 100;
2820
+ if (type === 'percentage') {
2821
+ value = obj.adjustPrecision(value*100);
2794
2822
  }
2795
2823
  // Number of decimal places
2796
2824
  if (typeof(value) === 'number') {
@@ -4552,7 +4580,7 @@ function Tabs(el, options) {
4552
4580
  }
4553
4581
  }
4554
4582
 
4555
- obj.appendElement = function(title, cb) {
4583
+ obj.appendElement = function(title, cb, openTab) {
4556
4584
  if (! title) {
4557
4585
  var title = prompt('Title?', '');
4558
4586
  }
@@ -4572,8 +4600,12 @@ function Tabs(el, options) {
4572
4600
  if (obj.options.allowChangePosition) {
4573
4601
  h.setAttribute('draggable', 'true');
4574
4602
  }
4603
+
4575
4604
  // Open new tab
4576
- obj.selectIndex(h);
4605
+ if (openTab !== false) {
4606
+ // Open new tab
4607
+ obj.selectIndex(h);
4608
+ }
4577
4609
 
4578
4610
  // Callback
4579
4611
  if (typeof(cb) == 'function') {
@@ -9815,7 +9847,7 @@ function Validations() {
9815
9847
  return null;
9816
9848
  }
9817
9849
 
9818
- component.url = function() {
9850
+ component.url = function(data) {
9819
9851
  var pattern = new RegExp(/(((https?:\/\/)|(www\.))[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|]+)/ig);
9820
9852
  return pattern.test(data) ? true : false;
9821
9853
  }
@@ -9826,7 +9858,7 @@ function Validations() {
9826
9858
  }
9827
9859
 
9828
9860
  component.required = function(data) {
9829
- return data.trim() ? true : false;
9861
+ return data && data.trim() ? true : false;
9830
9862
  }
9831
9863
 
9832
9864
  component.exist = function(data, options) {
@@ -12655,7 +12687,7 @@ var jSuites = {
12655
12687
  ...dictionary,
12656
12688
  ...helpers,
12657
12689
  /** Current version */
12658
- version: '5.0.26',
12690
+ version: '5.0.27',
12659
12691
  /** Bind new extensions to Jsuites */
12660
12692
  setExtensions: function(o) {
12661
12693
  if (typeof(o) == 'object') {
@@ -67,13 +67,13 @@ export type Tabs = (el: HTMLElement, options: Options) => {
67
67
  /** Delete tab element */
68
68
  deleteElement: () => void;
69
69
  /** Append tab element */
70
- appendElement: () => void;
70
+ appendElement: (title?: string, callback?: Function, openTab?: boolean) => void;
71
71
  /** Get the active tab index */
72
72
  getActive: () => number;
73
73
  /** Update the content of a tab */
74
74
  updateContent: (index: number, newContent: string) => void;
75
75
  /** Update tab position */
76
- updatePosition: (from: number, to: number) => void;
76
+ updatePosition: (from: number, to: number, ignoreEvents?: boolean) => void;
77
77
  /** Update DOM position */
78
- move: (from: number, to: number) => void;
78
+ move: (from: number, to: number, ignoreEvents?: boolean) => void;
79
79
  }
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.26",
28
+ "version": "5.0.28",
29
29
  "bugs": "https://github.com/jsuites/jsuites/issues",
30
30
  "homepage": "https://github.com/jsuites/jsuites",
31
31
  "docs": "https://jsuites.net",