jsuites 6.1.1 → 6.1.3
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 +124 -61
- package/package.json +5 -5
package/dist/jsuites.js
CHANGED
|
@@ -298,7 +298,7 @@ var jSuites;
|
|
|
298
298
|
// Number
|
|
299
299
|
fraction: [ '#{0,1}.*?\\?+\\/[0-9?]+' ],
|
|
300
300
|
// Currency tokens
|
|
301
|
-
currency: [ '#(.{1})##0?(.{1}0+)?( ?;(.*)?)?' ],
|
|
301
|
+
currency: [ '#(.{1})##0?(.{1}[0#]+)?( ?;(.*)?)?' ],
|
|
302
302
|
// Scientific
|
|
303
303
|
scientific: [ '[0#]+([.,]{1}0*#*)?E{1}\\+0+' ],
|
|
304
304
|
// Percentage
|
|
@@ -1749,7 +1749,7 @@ var jSuites;
|
|
|
1749
1749
|
this.values[this.index] = '';
|
|
1750
1750
|
}
|
|
1751
1751
|
},
|
|
1752
|
-
'#(.{1})##0?(.{1}0+)?( ?;(.*)?)?': function(v) {
|
|
1752
|
+
'#(.{1})##0?(.{1}[0#]+)?( ?;(.*)?)?': function(v) {
|
|
1753
1753
|
// Process first the number
|
|
1754
1754
|
parseMethods['[0#]+([.,]{1}0*#*)?'].call(this, v, true);
|
|
1755
1755
|
// Create the separators
|
|
@@ -2382,77 +2382,89 @@ var jSuites;
|
|
|
2382
2382
|
const adjustNumberOfDecimalPlaces = function(config, value) {
|
|
2383
2383
|
let temp = value;
|
|
2384
2384
|
let mask = config.mask;
|
|
2385
|
-
let expo;
|
|
2386
2385
|
|
|
2387
2386
|
if (config.type === 'scientific') {
|
|
2387
|
+
// Scientific notation handling
|
|
2388
2388
|
mask = config.mask.toUpperCase().split('E')[0];
|
|
2389
2389
|
|
|
2390
2390
|
let numOfDecimalPlaces = mask.split(config.decimal);
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
temp = Number(expo[0]);
|
|
2396
|
-
}
|
|
2397
|
-
|
|
2398
|
-
if (mask.indexOf(config.decimal) === -1) {
|
|
2399
|
-
// No decimal places
|
|
2400
|
-
if (! Number.isInteger(temp)) {
|
|
2401
|
-
temp = temp.toFixed(0);
|
|
2402
|
-
}
|
|
2403
|
-
} else {
|
|
2404
|
-
// Length of the decimal
|
|
2405
|
-
let mandatoryDecimalPlaces = mask.split(config.decimal);
|
|
2406
|
-
mandatoryDecimalPlaces = mandatoryDecimalPlaces[1].match(/0+/g);
|
|
2407
|
-
if (mandatoryDecimalPlaces) {
|
|
2408
|
-
mandatoryDecimalPlaces = mandatoryDecimalPlaces[0].length;
|
|
2409
|
-
} else {
|
|
2410
|
-
mandatoryDecimalPlaces = 0;
|
|
2411
|
-
}
|
|
2412
|
-
// Amount of decimal
|
|
2413
|
-
let numOfDecimalPlaces = temp.toString().split(config.decimal)
|
|
2414
|
-
numOfDecimalPlaces = numOfDecimalPlaces[1]?.length ?? 0;
|
|
2415
|
-
// Necessary adjustment
|
|
2416
|
-
let necessaryAdjustment = 0;
|
|
2417
|
-
if (numOfDecimalPlaces < mandatoryDecimalPlaces) {
|
|
2418
|
-
necessaryAdjustment = mandatoryDecimalPlaces;
|
|
2391
|
+
// Handle masks without decimal (e.g., '0E+00')
|
|
2392
|
+
if (numOfDecimalPlaces[1]) {
|
|
2393
|
+
numOfDecimalPlaces = numOfDecimalPlaces[1].match(/[0#]+/g);
|
|
2394
|
+
numOfDecimalPlaces = numOfDecimalPlaces[0]?.length ?? 0;
|
|
2419
2395
|
} else {
|
|
2420
|
-
|
|
2421
|
-
let optionalDecimalPlaces = mask.split(config.decimal);
|
|
2422
|
-
optionalDecimalPlaces = optionalDecimalPlaces[1].match(/[0#]+/g);
|
|
2423
|
-
if (optionalDecimalPlaces) {
|
|
2424
|
-
optionalDecimalPlaces = optionalDecimalPlaces[0].length;
|
|
2425
|
-
if (numOfDecimalPlaces > optionalDecimalPlaces) {
|
|
2426
|
-
necessaryAdjustment = optionalDecimalPlaces;
|
|
2427
|
-
}
|
|
2428
|
-
}
|
|
2396
|
+
numOfDecimalPlaces = 0;
|
|
2429
2397
|
}
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
if (fraction && fraction.length > necessaryAdjustment && fraction[fraction.length - 1] === '5') {
|
|
2436
|
-
t = parseFloat(n[0] + '.' + fraction + '1').toFixed(necessaryAdjustment);
|
|
2437
|
-
}
|
|
2438
|
-
temp = t;
|
|
2439
|
-
}
|
|
2440
|
-
}
|
|
2398
|
+
temp = temp.toExponential(numOfDecimalPlaces);
|
|
2399
|
+
// Split by 'e' to handle both positive (e+) and negative (e-) exponents
|
|
2400
|
+
let expo = temp.toString().split('e');
|
|
2401
|
+
// Keep coefficient as string to preserve decimal places (e.g., '1.00' not 1)
|
|
2402
|
+
temp = expo[0];
|
|
2441
2403
|
|
|
2442
|
-
|
|
2404
|
+
// Process padding zeros for coefficient
|
|
2443
2405
|
let ret = processPaddingZeros(mask, temp, config.decimal);
|
|
2444
2406
|
if (ret) {
|
|
2445
2407
|
temp = ret;
|
|
2446
2408
|
}
|
|
2447
2409
|
expo[0] = temp;
|
|
2448
2410
|
|
|
2449
|
-
|
|
2450
|
-
|
|
2411
|
+
// Handle both E+ and E- in mask for exponent
|
|
2412
|
+
mask = config.mask.toUpperCase().split(/E[+-]?/)[1];
|
|
2413
|
+
ret = processPaddingZeros(mask, expo[1]?.replace(/^[+-]/, ''), config.decimal);
|
|
2451
2414
|
if (ret) {
|
|
2452
|
-
|
|
2415
|
+
// Preserve the sign from the original exponent
|
|
2416
|
+
let sign = expo[1]?.charAt(0);
|
|
2417
|
+
expo[1] = (sign === '-' ? '-' : '+') + ret;
|
|
2453
2418
|
}
|
|
2454
2419
|
|
|
2455
|
-
temp = expo.join('e
|
|
2420
|
+
temp = expo.join('e');
|
|
2421
|
+
} else {
|
|
2422
|
+
// Non-scientific decimal adjustment
|
|
2423
|
+
if (mask.indexOf(config.decimal) === -1) {
|
|
2424
|
+
// No decimal places
|
|
2425
|
+
if (! Number.isInteger(temp)) {
|
|
2426
|
+
temp = temp.toFixed(0);
|
|
2427
|
+
}
|
|
2428
|
+
} else {
|
|
2429
|
+
// Length of the decimal
|
|
2430
|
+
let mandatoryDecimalPlaces = mask.split(config.decimal);
|
|
2431
|
+
mandatoryDecimalPlaces = mandatoryDecimalPlaces[1].match(/0+/g);
|
|
2432
|
+
if (mandatoryDecimalPlaces) {
|
|
2433
|
+
mandatoryDecimalPlaces = mandatoryDecimalPlaces[0].length;
|
|
2434
|
+
} else {
|
|
2435
|
+
mandatoryDecimalPlaces = 0;
|
|
2436
|
+
}
|
|
2437
|
+
|
|
2438
|
+
// Amount of decimal (use original value to check decimal separator)
|
|
2439
|
+
let valueStr = value.toString();
|
|
2440
|
+
let numOfDecimalPlaces = valueStr.split(valueStr.includes('.') ? '.' : (config.decimal || '.'))
|
|
2441
|
+
numOfDecimalPlaces = numOfDecimalPlaces[1]?.length ?? 0;
|
|
2442
|
+
// Necessary adjustment
|
|
2443
|
+
let necessaryAdjustment = 0;
|
|
2444
|
+
if (numOfDecimalPlaces < mandatoryDecimalPlaces) {
|
|
2445
|
+
necessaryAdjustment = mandatoryDecimalPlaces;
|
|
2446
|
+
} else {
|
|
2447
|
+
// Optional
|
|
2448
|
+
let optionalDecimalPlaces = mask.split(config.decimal);
|
|
2449
|
+
optionalDecimalPlaces = optionalDecimalPlaces[1].match(/[0#]+/g);
|
|
2450
|
+
if (optionalDecimalPlaces) {
|
|
2451
|
+
optionalDecimalPlaces = optionalDecimalPlaces[0].length;
|
|
2452
|
+
if (numOfDecimalPlaces > optionalDecimalPlaces) {
|
|
2453
|
+
necessaryAdjustment = optionalDecimalPlaces;
|
|
2454
|
+
}
|
|
2455
|
+
}
|
|
2456
|
+
}
|
|
2457
|
+
// Adjust decimal numbers if applicable
|
|
2458
|
+
if (necessaryAdjustment) {
|
|
2459
|
+
let t = temp.toFixed(necessaryAdjustment);
|
|
2460
|
+
let n = temp.toString().split('.');
|
|
2461
|
+
let fraction = n[1];
|
|
2462
|
+
if (fraction && fraction.length > necessaryAdjustment && fraction[fraction.length - 1] === '5') {
|
|
2463
|
+
t = parseFloat(n[0] + '.' + fraction + '1').toFixed(necessaryAdjustment);
|
|
2464
|
+
}
|
|
2465
|
+
temp = t;
|
|
2466
|
+
}
|
|
2467
|
+
}
|
|
2456
2468
|
}
|
|
2457
2469
|
|
|
2458
2470
|
return temp;
|
|
@@ -3598,12 +3610,15 @@ var jSuites;
|
|
|
3598
3610
|
return value;
|
|
3599
3611
|
};
|
|
3600
3612
|
|
|
3601
|
-
Component.render = function(value, options, fullMask) {
|
|
3613
|
+
Component.render = function(value, options, fullMask, strict) {
|
|
3602
3614
|
// Nothing to render
|
|
3603
3615
|
if (value === '' || value === undefined || value === null) {
|
|
3604
3616
|
return '';
|
|
3605
3617
|
}
|
|
3606
3618
|
|
|
3619
|
+
// Store original value for strict mode
|
|
3620
|
+
const originalValue = value;
|
|
3621
|
+
|
|
3607
3622
|
// Config
|
|
3608
3623
|
const config = getConfig(options, value);
|
|
3609
3624
|
|
|
@@ -3624,6 +3639,11 @@ var jSuites;
|
|
|
3624
3639
|
value = value.toString();
|
|
3625
3640
|
}
|
|
3626
3641
|
} else {
|
|
3642
|
+
// Strict mode: for numeric masks, if string input is not a valid number,
|
|
3643
|
+
// return original value unchanged (Excel-like behavior)
|
|
3644
|
+
if (strict && typeof(originalValue) === 'string' && !isNumber(originalValue)) {
|
|
3645
|
+
return originalValue;
|
|
3646
|
+
}
|
|
3627
3647
|
if (config.type === 'percentage') {
|
|
3628
3648
|
if (typeof (value) === 'string' && value.indexOf('%') !== -1) {
|
|
3629
3649
|
value = value.replace('%', '');
|
|
@@ -5965,6 +5985,20 @@ if (! Modal && "function" === 'function') {
|
|
|
5965
5985
|
return self.modals[0].modal.closed === true;
|
|
5966
5986
|
}
|
|
5967
5987
|
|
|
5988
|
+
self.openAt = function(a, b) {
|
|
5989
|
+
let x, y;
|
|
5990
|
+
if (a instanceof Event || (a && a.clientX !== undefined)) {
|
|
5991
|
+
// openAt(event)
|
|
5992
|
+
x = a.clientX;
|
|
5993
|
+
y = a.clientY;
|
|
5994
|
+
} else {
|
|
5995
|
+
// openAt(x, y)
|
|
5996
|
+
x = a;
|
|
5997
|
+
y = b;
|
|
5998
|
+
}
|
|
5999
|
+
self.open(self.options, x, y, true);
|
|
6000
|
+
};
|
|
6001
|
+
|
|
5968
6002
|
self.open = function(options, x, y, adjust) {
|
|
5969
6003
|
// Get the main modal
|
|
5970
6004
|
let menu = self.modals[0];
|
|
@@ -6913,7 +6947,7 @@ if (!Modal && "function" === 'function') {
|
|
|
6913
6947
|
if (! self.isClosed() && self.autocomplete) {
|
|
6914
6948
|
|
|
6915
6949
|
// Remote or normal search
|
|
6916
|
-
if (self.remote === true) {
|
|
6950
|
+
if (self.remote === true && self.url) {
|
|
6917
6951
|
// Clear existing timeout
|
|
6918
6952
|
if (searchTimeout) {
|
|
6919
6953
|
clearTimeout(searchTimeout);
|
|
@@ -7345,8 +7379,35 @@ if (!Modal && "function" === 'function') {
|
|
|
7345
7379
|
if (prop === 'value') {
|
|
7346
7380
|
setValue(self.value);
|
|
7347
7381
|
} else if (prop === 'data') {
|
|
7382
|
+
// Store current value before resetting data
|
|
7383
|
+
let currentValue = self.value;
|
|
7348
7384
|
setData();
|
|
7349
|
-
|
|
7385
|
+
|
|
7386
|
+
// Only reset value if it's not in the new data
|
|
7387
|
+
if (currentValue !== null && currentValue !== undefined && currentValue !== '') {
|
|
7388
|
+
let valuesToCheck = Array.isArray(currentValue) ? currentValue : [currentValue];
|
|
7389
|
+
|
|
7390
|
+
// Filter to keep only values that exist in the new data
|
|
7391
|
+
let validValues = valuesToCheck.filter(v => {
|
|
7392
|
+
return self.data.some(item => {
|
|
7393
|
+
if (v === '' || item.value === '') {
|
|
7394
|
+
return v === item.value;
|
|
7395
|
+
}
|
|
7396
|
+
return v == item.value;
|
|
7397
|
+
});
|
|
7398
|
+
});
|
|
7399
|
+
|
|
7400
|
+
if (validValues.length === 0) {
|
|
7401
|
+
// No valid values remain, reset to null
|
|
7402
|
+
self.value = null;
|
|
7403
|
+
} else if (self.multiple) {
|
|
7404
|
+
// Multi-select: keep only valid values
|
|
7405
|
+
self.value = validValues;
|
|
7406
|
+
} else {
|
|
7407
|
+
// Single select: re-apply the value
|
|
7408
|
+
self.value = validValues[0];
|
|
7409
|
+
}
|
|
7410
|
+
}
|
|
7350
7411
|
}
|
|
7351
7412
|
|
|
7352
7413
|
if (typeof (lazyloading) === 'function') {
|
|
@@ -14841,7 +14902,9 @@ function Tabs(el, options) {
|
|
|
14841
14902
|
}
|
|
14842
14903
|
|
|
14843
14904
|
// Update controls
|
|
14844
|
-
|
|
14905
|
+
setTimeout(() => {
|
|
14906
|
+
updateControls(0);
|
|
14907
|
+
})
|
|
14845
14908
|
|
|
14846
14909
|
if (obj.options.allowChangePosition == true) {
|
|
14847
14910
|
Sorting(obj.headers, {
|
|
@@ -23022,7 +23085,7 @@ var jSuites = {
|
|
|
23022
23085
|
...dictionary,
|
|
23023
23086
|
...helpers,
|
|
23024
23087
|
/** Current version */
|
|
23025
|
-
version: '6.1.
|
|
23088
|
+
version: '6.1.2',
|
|
23026
23089
|
/** Bind new extensions to Jsuites */
|
|
23027
23090
|
setExtensions: function(o) {
|
|
23028
23091
|
if (typeof(o) == 'object') {
|
package/package.json
CHANGED
|
@@ -26,18 +26,18 @@
|
|
|
26
26
|
},
|
|
27
27
|
"main": "dist/jsuites.js",
|
|
28
28
|
"types": "dist/jsuites.d.ts",
|
|
29
|
-
"version": "6.1.
|
|
29
|
+
"version": "6.1.3",
|
|
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.
|
|
35
|
+
"@jsuites/utils": "^6.0.4",
|
|
36
36
|
"@lemonadejs/calendar": "^5.8.3",
|
|
37
37
|
"@lemonadejs/color": "^5.8.0",
|
|
38
|
-
"@lemonadejs/contextmenu": "^5.8.
|
|
39
|
-
"@lemonadejs/dropdown": "^5.8.
|
|
40
|
-
"@lemonadejs/modal": "^5.8.
|
|
38
|
+
"@lemonadejs/contextmenu": "^5.8.1",
|
|
39
|
+
"@lemonadejs/dropdown": "^5.8.2",
|
|
40
|
+
"@lemonadejs/modal": "^5.8.2",
|
|
41
41
|
"@lemonadejs/rating": "^5.8.1",
|
|
42
42
|
"@lemonadejs/switch": "^5.8.0",
|
|
43
43
|
"@lemonadejs/tabs": "^5.8.0",
|