@douyinfe/semi-foundation 2.99.3 → 2.100.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.
|
@@ -534,9 +534,20 @@ class InputNumberFoundation extends BaseFoundation<InputNumberAdapter> {
|
|
|
534
534
|
* @param {number} num
|
|
535
535
|
* @returns {number}
|
|
536
536
|
*/
|
|
537
|
-
|
|
537
|
+
_getPrecLen(num: string | number) {
|
|
538
538
|
if (typeof num !== 'string') {
|
|
539
|
-
|
|
539
|
+
const n = Number(num || '');
|
|
540
|
+
if (!isFinite(n) || n === 0) return 0;
|
|
541
|
+
const s = Math.abs(n).toString();
|
|
542
|
+
// Numbers with abs < 1e-6 are stringified in scientific notation by
|
|
543
|
+
// `Number.prototype.toString` per ECMAScript spec — e.g. (1e-8).toString() === "1e-8".
|
|
544
|
+
// Detect that explicitly so step values smaller than 1e-6 keep correct precision.
|
|
545
|
+
if (/e/i.test(s)) {
|
|
546
|
+
const [mantissa, exp] = s.split(/e/i);
|
|
547
|
+
const mantissaDecimals = (mantissa.split('.')[1] || '').length;
|
|
548
|
+
return Math.max(0, mantissaDecimals - parseInt(exp, 10));
|
|
549
|
+
}
|
|
550
|
+
num = s;
|
|
540
551
|
}
|
|
541
552
|
const idx = num.indexOf('.') + 1;
|
|
542
553
|
return idx ? num.length - idx : 0;
|
|
@@ -253,6 +253,6 @@ export default class MonthsGridFoundation extends BaseFoundation<MonthsGridAdapt
|
|
|
253
253
|
* - When yam open type is 'left' or 'right', weeks minHeight should be set
|
|
254
254
|
* If the minHeight is not set, the change of the number of weeks will cause the scrollList to be unstable
|
|
255
255
|
*/
|
|
256
|
-
getYAMOpenType(): "
|
|
256
|
+
getYAMOpenType(): "left" | "right" | "none" | "both";
|
|
257
257
|
}
|
|
258
258
|
export {};
|
|
@@ -465,7 +465,18 @@ class InputNumberFoundation extends _foundation.default {
|
|
|
465
465
|
*/
|
|
466
466
|
_getPrecLen(num) {
|
|
467
467
|
if (typeof num !== 'string') {
|
|
468
|
-
|
|
468
|
+
const n = Number(num || '');
|
|
469
|
+
if (!isFinite(n) || n === 0) return 0;
|
|
470
|
+
const s = Math.abs(n).toString();
|
|
471
|
+
// Numbers with abs < 1e-6 are stringified in scientific notation by
|
|
472
|
+
// `Number.prototype.toString` per ECMAScript spec — e.g. (1e-8).toString() === "1e-8".
|
|
473
|
+
// Detect that explicitly so step values smaller than 1e-6 keep correct precision.
|
|
474
|
+
if (/e/i.test(s)) {
|
|
475
|
+
const [mantissa, exp] = s.split(/e/i);
|
|
476
|
+
const mantissaDecimals = (mantissa.split('.')[1] || '').length;
|
|
477
|
+
return Math.max(0, mantissaDecimals - parseInt(exp, 10));
|
|
478
|
+
}
|
|
479
|
+
num = s;
|
|
469
480
|
}
|
|
470
481
|
const idx = num.indexOf('.') + 1;
|
|
471
482
|
return idx ? num.length - idx : 0;
|
|
@@ -253,6 +253,6 @@ export default class MonthsGridFoundation extends BaseFoundation<MonthsGridAdapt
|
|
|
253
253
|
* - When yam open type is 'left' or 'right', weeks minHeight should be set
|
|
254
254
|
* If the minHeight is not set, the change of the number of weeks will cause the scrollList to be unstable
|
|
255
255
|
*/
|
|
256
|
-
getYAMOpenType(): "
|
|
256
|
+
getYAMOpenType(): "left" | "right" | "none" | "both";
|
|
257
257
|
}
|
|
258
258
|
export {};
|
|
@@ -458,7 +458,18 @@ class InputNumberFoundation extends BaseFoundation {
|
|
|
458
458
|
*/
|
|
459
459
|
_getPrecLen(num) {
|
|
460
460
|
if (typeof num !== 'string') {
|
|
461
|
-
|
|
461
|
+
const n = Number(num || '');
|
|
462
|
+
if (!isFinite(n) || n === 0) return 0;
|
|
463
|
+
const s = Math.abs(n).toString();
|
|
464
|
+
// Numbers with abs < 1e-6 are stringified in scientific notation by
|
|
465
|
+
// `Number.prototype.toString` per ECMAScript spec — e.g. (1e-8).toString() === "1e-8".
|
|
466
|
+
// Detect that explicitly so step values smaller than 1e-6 keep correct precision.
|
|
467
|
+
if (/e/i.test(s)) {
|
|
468
|
+
const [mantissa, exp] = s.split(/e/i);
|
|
469
|
+
const mantissaDecimals = (mantissa.split('.')[1] || '').length;
|
|
470
|
+
return Math.max(0, mantissaDecimals - parseInt(exp, 10));
|
|
471
|
+
}
|
|
472
|
+
num = s;
|
|
462
473
|
}
|
|
463
474
|
const idx = num.indexOf('.') + 1;
|
|
464
475
|
return idx ? num.length - idx : 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-foundation",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.100.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"clean": "rimraf lib",
|
|
@@ -14225,8 +14225,8 @@
|
|
|
14225
14225
|
}
|
|
14226
14226
|
},
|
|
14227
14227
|
"dependencies": {
|
|
14228
|
-
"@douyinfe/semi-animation": "2.
|
|
14229
|
-
"@douyinfe/semi-json-viewer-core": "2.
|
|
14228
|
+
"@douyinfe/semi-animation": "2.100.0",
|
|
14229
|
+
"@douyinfe/semi-json-viewer-core": "2.100.0",
|
|
14230
14230
|
"@mdx-js/mdx": "^3.0.1",
|
|
14231
14231
|
"async-validator": "^3.5.0",
|
|
14232
14232
|
"classnames": "^2.2.6",
|
|
@@ -14247,7 +14247,7 @@
|
|
|
14247
14247
|
"*.scss",
|
|
14248
14248
|
"*.css"
|
|
14249
14249
|
],
|
|
14250
|
-
"gitHead": "
|
|
14250
|
+
"gitHead": "caf1c8f44a44b2309b9468f946dd5ee952640994",
|
|
14251
14251
|
"devDependencies": {
|
|
14252
14252
|
"@babel/plugin-transform-runtime": "^7.15.8",
|
|
14253
14253
|
"@babel/preset-env": "^7.15.8",
|