a-calc 3.0.0-beta.20260124.3 → 3.0.0-beta.20260128.1
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/a-calc.versions.js +3 -3
- package/browser/index.js +2 -2
- package/calc.d.ts +20 -10
- package/cjs/index.js +2 -2
- package/es/index.js +2 -2
- package/mcp-server/src/index.js +3 -3
- package/package.json +1 -1
package/calc.d.ts
CHANGED
|
@@ -78,7 +78,7 @@ type CalcRuntimeOptions<Fmt extends string, Err> =
|
|
|
78
78
|
_debug?: boolean;
|
|
79
79
|
_on_debug?: (info: any) => void;
|
|
80
80
|
_angle_unit?: 'deg' | 'rad';
|
|
81
|
-
|
|
81
|
+
_compact_symbols?: string[];
|
|
82
82
|
_compact_step?: number | number[];
|
|
83
83
|
_thousands?: Record<string, ThousandsPreset>;
|
|
84
84
|
/** 多路取值时视为空值的值数组(仅运行时选项) */
|
|
@@ -121,8 +121,8 @@ export type CalcSum = <const Expr extends string | number, const Fmt extends str
|
|
|
121
121
|
export interface FmtOptions {
|
|
122
122
|
_error?: any;
|
|
123
123
|
_fmt?: string;
|
|
124
|
-
/**
|
|
125
|
-
|
|
124
|
+
/** 紧凑格式符号数组(仅选项,临时覆盖) */
|
|
125
|
+
_compact_symbols?: string[];
|
|
126
126
|
/** 紧凑格式阶梯值(仅选项,临时覆盖) */
|
|
127
127
|
_compact_step?: number | number[];
|
|
128
128
|
/** 紧凑格式预设配置(仅选项) */
|
|
@@ -441,7 +441,7 @@ export type UnitConvertRule =
|
|
|
441
441
|
fn?: (value: number, input_unit: string, output_unit: string) => number;
|
|
442
442
|
_position?: 'before' | 'after' | 'middle';
|
|
443
443
|
_thousands?: string;
|
|
444
|
-
|
|
444
|
+
_compact?: string;
|
|
445
445
|
};
|
|
446
446
|
|
|
447
447
|
/**
|
|
@@ -450,7 +450,7 @@ export type UnitConvertRule =
|
|
|
450
450
|
export type UnitConvertOut = Record<string, Record<string, UnitConvertRule> & {
|
|
451
451
|
_position?: 'before' | 'after' | 'middle';
|
|
452
452
|
_thousands?: string;
|
|
453
|
-
|
|
453
|
+
_compact?: string;
|
|
454
454
|
}>;
|
|
455
455
|
|
|
456
456
|
/**
|
|
@@ -460,7 +460,7 @@ export type UnitConvertIn = Record<string, Record<string, UnitConvertRule>>;
|
|
|
460
460
|
|
|
461
461
|
/**
|
|
462
462
|
* 千分位预设名称(系统内置)
|
|
463
|
-
* -
|
|
463
|
+
* - en: 英文/国际标准 (1,234,567.89)
|
|
464
464
|
* - eu: 欧洲大陆格式 (1.234.567,89)
|
|
465
465
|
* - swiss: 瑞士格式 (1'234'567.89)
|
|
466
466
|
* - space: 空格分隔/ISO标准 (1 234 567.89)
|
|
@@ -468,7 +468,17 @@ export type UnitConvertIn = Record<string, Record<string, UnitConvertRule>>;
|
|
|
468
468
|
* - indian: 印度格式 (12,34,567.89)
|
|
469
469
|
* - wan: 万进制/东亚格式 (123,4567.89)
|
|
470
470
|
*/
|
|
471
|
-
export type ThousandsPresetName = '
|
|
471
|
+
export type ThousandsPresetName = 'en' | 'eu' | 'swiss' | 'space' | 'fr' | 'indian' | 'wan';
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* 紧凑格式预设名称(系统内置)
|
|
475
|
+
* - en: 英文/国际通用 (1.23K, 1.23M, 1.23B, 1.23T)
|
|
476
|
+
* - cn: 中文千进制 (1.23千, 1.23百万, 1.23十亿, 1.23万亿)
|
|
477
|
+
* - wan: 万进制 (1.23万, 1.23亿, 1.23万亿)
|
|
478
|
+
* - storage: 存储单位 (1KB, 1MB, 1GB, 1TB - 1024进制)
|
|
479
|
+
* - indian: 印度格式 (1.23K, 1.23L, 1.23Cr - 阶梯[1000,100,100])
|
|
480
|
+
*/
|
|
481
|
+
export type CompactPresetName = 'en' | 'cn' | 'wan' | 'storage' | 'indian';
|
|
472
482
|
|
|
473
483
|
/**
|
|
474
484
|
* 千分位预设配置类型
|
|
@@ -492,9 +502,9 @@ export interface ThousandsPreset {
|
|
|
492
502
|
* 紧凑格式预设配置类型
|
|
493
503
|
*/
|
|
494
504
|
export type CompactPreset =
|
|
495
|
-
| string[] //
|
|
496
|
-
| { // 完整形式:包含
|
|
497
|
-
|
|
505
|
+
| string[] // 简写形式:只有符号数组,step 默认 1000
|
|
506
|
+
| { // 完整形式:包含 symbols 和 step
|
|
507
|
+
symbols: string[];
|
|
498
508
|
step?: number | number[];
|
|
499
509
|
}
|
|
500
510
|
| ((num_str: string, context: { // 自定义函数形式
|