jsuites 5.0.26 → 5.0.27
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.js +41 -6
- package/dist/types/tabs.d.ts +3 -3
- package/package.json +1 -1
package/dist/jsuites.js
CHANGED
|
@@ -2590,7 +2590,7 @@ function Mask() {
|
|
|
2590
2590
|
o.number = Extract.call(o, v);
|
|
2591
2591
|
// Keep the raw data as a property of the tag
|
|
2592
2592
|
if (o.type == 'percentage' && v.indexOf('%') !== -1) {
|
|
2593
|
-
label = o.number / 100;
|
|
2593
|
+
label = obj.adjustPrecision(o.number / 100);
|
|
2594
2594
|
} else {
|
|
2595
2595
|
label = o.number;
|
|
2596
2596
|
}
|
|
@@ -2617,6 +2617,37 @@ function Mask() {
|
|
|
2617
2617
|
}
|
|
2618
2618
|
}
|
|
2619
2619
|
|
|
2620
|
+
obj.adjustPrecision = function(num) {
|
|
2621
|
+
if (typeof num === 'number' && !Number.isInteger(num)) {
|
|
2622
|
+
const v = num.toString().split('.');
|
|
2623
|
+
|
|
2624
|
+
if (v[1] && v[1].length > 10) {
|
|
2625
|
+
let t0 = 0;
|
|
2626
|
+
const t1 = v[1][v[1].length - 2];
|
|
2627
|
+
|
|
2628
|
+
if (t1 == 0 || t1 == 9) {
|
|
2629
|
+
for (let i = v[1].length - 2; i > 0; i--) {
|
|
2630
|
+
if (t0 >= 0 && v[1][i] == t1) {
|
|
2631
|
+
t0++;
|
|
2632
|
+
if (t0 > 6) {
|
|
2633
|
+
break;
|
|
2634
|
+
}
|
|
2635
|
+
} else {
|
|
2636
|
+
t0 = 0;
|
|
2637
|
+
break;
|
|
2638
|
+
}
|
|
2639
|
+
}
|
|
2640
|
+
|
|
2641
|
+
if (t0) {
|
|
2642
|
+
return parseFloat(parseFloat(num).toFixed(v[1].length - 1));
|
|
2643
|
+
}
|
|
2644
|
+
}
|
|
2645
|
+
}
|
|
2646
|
+
}
|
|
2647
|
+
|
|
2648
|
+
return num;
|
|
2649
|
+
}
|
|
2650
|
+
|
|
2620
2651
|
// Get the type of the mask
|
|
2621
2652
|
obj.getType = getType;
|
|
2622
2653
|
|
|
@@ -2789,8 +2820,8 @@ function Mask() {
|
|
|
2789
2820
|
}
|
|
2790
2821
|
} else {
|
|
2791
2822
|
// Percentage
|
|
2792
|
-
if (type
|
|
2793
|
-
value
|
|
2823
|
+
if (type === 'percentage') {
|
|
2824
|
+
value = obj.adjustPrecision(value*100);
|
|
2794
2825
|
}
|
|
2795
2826
|
// Number of decimal places
|
|
2796
2827
|
if (typeof(value) === 'number') {
|
|
@@ -4552,7 +4583,7 @@ function Tabs(el, options) {
|
|
|
4552
4583
|
}
|
|
4553
4584
|
}
|
|
4554
4585
|
|
|
4555
|
-
obj.appendElement = function(title, cb) {
|
|
4586
|
+
obj.appendElement = function(title, cb, openTab) {
|
|
4556
4587
|
if (! title) {
|
|
4557
4588
|
var title = prompt('Title?', '');
|
|
4558
4589
|
}
|
|
@@ -4572,8 +4603,12 @@ function Tabs(el, options) {
|
|
|
4572
4603
|
if (obj.options.allowChangePosition) {
|
|
4573
4604
|
h.setAttribute('draggable', 'true');
|
|
4574
4605
|
}
|
|
4606
|
+
|
|
4575
4607
|
// Open new tab
|
|
4576
|
-
|
|
4608
|
+
if (openTab !== false) {
|
|
4609
|
+
// Open new tab
|
|
4610
|
+
obj.selectIndex(h);
|
|
4611
|
+
}
|
|
4577
4612
|
|
|
4578
4613
|
// Callback
|
|
4579
4614
|
if (typeof(cb) == 'function') {
|
|
@@ -12655,7 +12690,7 @@ var jSuites = {
|
|
|
12655
12690
|
...dictionary,
|
|
12656
12691
|
...helpers,
|
|
12657
12692
|
/** Current version */
|
|
12658
|
-
version: '5.0.
|
|
12693
|
+
version: '5.0.27',
|
|
12659
12694
|
/** Bind new extensions to Jsuites */
|
|
12660
12695
|
setExtensions: function(o) {
|
|
12661
12696
|
if (typeof(o) == 'object') {
|
package/dist/types/tabs.d.ts
CHANGED
|
@@ -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