@solar-taro/core 1.2.0 β†’ 1.2.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/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## 1.2.0 (2025-07-25)
2
+
3
+ ### πŸš€ Features
4
+
5
+ - **ui-vant/cascader:** add cascader component
6
+
7
+ ### ❀️ Thank You
8
+
9
+ - HyperLife1119
10
+
1
11
  ## 1.1.13 (2025-07-21)
2
12
 
3
13
  ### 🩹 Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solar-taro/core",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "sideEffects": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
package/pipes/number.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- export declare function number(value: number): string;
2
1
  /**
3
2
  * @deprecated {@link number}
4
3
  */
5
4
  export declare const amount: typeof number;
6
- export declare function fixed(value: number, fixed?: number): string;
7
- export declare function currency(value: number): string;
5
+ export declare function fixed(value: number, fractionDigits?: number): string;
6
+ export declare function number(value: number, fractionDigits?: number): string;
7
+ export declare function currency(value: number, fractionDigits?: number): string;
package/pipes/number.js CHANGED
@@ -1,19 +1,45 @@
1
1
  const FRACTION_DIGITS = 2;
2
- export function number(value) {
3
- const fixedValue = +(value || 0).toFixed(FRACTION_DIGITS);
4
- return fixedValue.toLocaleString('zh-CN', { minimumFractionDigits: FRACTION_DIGITS, maximumFractionDigits: FRACTION_DIGITS });
5
- }
6
- ;
7
2
  /**
8
3
  * @deprecated {@link number}
9
4
  */
10
5
  export const amount = number;
11
- export function fixed(value, fixed = FRACTION_DIGITS) {
12
- return (value || 0).toFixed(fixed);
6
+ export function fixed(value, fractionDigits = FRACTION_DIGITS) {
7
+ return (value || 0).toFixed(fractionDigits);
13
8
  }
14
9
  ;
15
- export function currency(value) {
16
- const fixedValue = +(value || 0).toFixed(FRACTION_DIGITS);
17
- return fixedValue.toLocaleString('zh-CN', { style: 'currency', currency: 'CNY', minimumFractionDigits: FRACTION_DIGITS, maximumFractionDigits: FRACTION_DIGITS });
10
+ // ε°η¨‹εΊδΈζ”―ζŒ toLocaleString
11
+ // export function number(value: number) {
12
+ // const fixedValue = +(value || 0).toFixed(FRACTION_DIGITS)
13
+ // return fixedValue
14
+ // .toLocaleString('zh-CN', { minimumFractionDigits: FRACTION_DIGITS, maximumFractionDigits: FRACTION_DIGITS });
15
+ // }
16
+ // export function currency(value: number) {
17
+ // const fixedValue = +(value || 0).toFixed(FRACTION_DIGITS)
18
+ // return fixedValue
19
+ // .toLocaleString('zh-CN', { style: 'currency', currency: 'CNY', minimumFractionDigits: FRACTION_DIGITS, maximumFractionDigits: FRACTION_DIGITS })
20
+ // }
21
+ export function number(value, fractionDigits = FRACTION_DIGITS) {
22
+ const num = value || 0;
23
+ const sign = +num.toFixed(fractionDigits) < 0 ? '-' : '';
24
+ const fixedValue = Math.abs(num).toFixed(fractionDigits);
25
+ let [integerPart, decimalPart] = fixedValue.split('.');
26
+ // ζ·»εŠ εƒδ½εˆ†ιš”η¬¦
27
+ const rgx = /(\d+)(\d{3})/;
28
+ while (rgx.test(integerPart)) {
29
+ integerPart = integerPart.replace(rgx, '$1' + ',' + '$2');
30
+ }
31
+ return `${sign}${integerPart}.${decimalPart}`;
32
+ }
33
+ export function currency(value, fractionDigits = FRACTION_DIGITS) {
34
+ const num = value || 0;
35
+ const sign = +num.toFixed(fractionDigits) < 0 ? '-' : '';
36
+ const fixedValue = Math.abs(num).toFixed(fractionDigits);
37
+ let [integerPart, decimalPart] = fixedValue.split('.');
38
+ // ζ·»εŠ εƒδ½εˆ†ιš”η¬¦
39
+ const rgx = /(\d+)(\d{3})/;
40
+ while (rgx.test(integerPart)) {
41
+ integerPart = integerPart.replace(rgx, '$1' + ',' + '$2');
42
+ }
43
+ return `${sign}Β₯${integerPart}.${decimalPart}`;
18
44
  }
19
45
  //# sourceMappingURL=number.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"number.js","sourceRoot":"","sources":["../../../../packages/core/src/pipes/number.ts"],"names":[],"mappings":"AAAA,MAAM,eAAe,GAAG,CAAC,CAAA;AAEzB,MAAM,UAAU,MAAM,CAAC,KAAa;IAClC,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,CAAA;IACzD,OAAO,UAAU,CAAC,cAAc,CAAC,OAAO,EAAE,EAAE,qBAAqB,EAAE,eAAe,EAAE,qBAAqB,EAAE,eAAe,EAAE,CAAC,CAAC;AAChI,CAAC;AAAA,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC;AAE7B,MAAM,UAAU,KAAK,CAAC,KAAa,EAAE,KAAK,GAAG,eAAe;IAC1D,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AACrC,CAAC;AAAA,CAAC;AAEF,MAAM,UAAU,QAAQ,CAAC,KAAa;IACpC,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,CAAA;IACzD,OAAO,UAAU,CAAC,cAAc,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,qBAAqB,EAAE,eAAe,EAAE,qBAAqB,EAAE,eAAe,EAAE,CAAC,CAAA;AACnK,CAAC"}
1
+ {"version":3,"file":"number.js","sourceRoot":"","sources":["../../../../packages/core/src/pipes/number.ts"],"names":[],"mappings":"AAAA,MAAM,eAAe,GAAG,CAAC,CAAA;AAEzB;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC;AAE7B,MAAM,UAAU,KAAK,CAAC,KAAa,EAAE,cAAc,GAAG,eAAe;IACnE,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO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