@malloydata/render 0.0.331 → 0.0.333
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/module/component/cell-utils.d.ts +40 -0
- package/dist/module/component/render-numeric-field.d.ts +18 -6
- package/dist/module/html/data_styles.d.ts +8 -0
- package/dist/module/index.mjs +19975 -19738
- package/dist/module/index.umd.js +282 -282
- package/dist/module/util.d.ts +55 -0
- package/package.json +17 -17
package/dist/module/util.d.ts
CHANGED
|
@@ -29,4 +29,59 @@ export declare function valueToMalloy(value: Cell): string;
|
|
|
29
29
|
export declare function walkFields(e: NestField, cb: (f: Field) => void): void;
|
|
30
30
|
export declare function notUndefined<T>(x: T | undefined): x is T;
|
|
31
31
|
export declare function formatBigNumber(value: number): string;
|
|
32
|
+
export type ScaleKey = 'k' | 'm' | 'b' | 't' | 'q';
|
|
33
|
+
export type SuffixFormatKey = 'letter' | 'lower' | 'word' | 'short' | 'finance' | 'scientific' | 'none';
|
|
34
|
+
export interface FormatScaledNumberOptions {
|
|
35
|
+
scale?: ScaleKey | 'auto';
|
|
36
|
+
decimals?: number;
|
|
37
|
+
suffix?: SuffixFormatKey;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Formats a number with scaling and suffix options.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* formatScaledNumber(1234567, { scale: 'm', decimals: 1 }) // "1.2m"
|
|
44
|
+
* formatScaledNumber(1234567, { scale: 'auto' }) // "1.2m"
|
|
45
|
+
* formatScaledNumber(1234567, { scale: 'm', suffix: 'word' }) // "1.2 Million"
|
|
46
|
+
*/
|
|
47
|
+
export declare function formatScaledNumber(value: number, options?: FormatScaledNumberOptions): string;
|
|
48
|
+
export interface ParsedNumberFormat {
|
|
49
|
+
decimals?: number;
|
|
50
|
+
scale?: ScaleKey | 'auto';
|
|
51
|
+
isId?: boolean;
|
|
52
|
+
}
|
|
53
|
+
export interface ParsedCurrencyFormat extends ParsedNumberFormat {
|
|
54
|
+
currency: string;
|
|
55
|
+
symbol: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Parses a number shorthand format string.
|
|
59
|
+
* Pattern: {decimals}{scale} or "auto" or "id"
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* parseNumberShorthand("1k") // { decimals: 1, scale: 'k' }
|
|
63
|
+
* parseNumberShorthand("0m") // { decimals: 0, scale: 'm' }
|
|
64
|
+
* parseNumberShorthand("2") // { decimals: 2 }
|
|
65
|
+
* parseNumberShorthand("auto") // { scale: 'auto' }
|
|
66
|
+
* parseNumberShorthand("id") // { isId: true }
|
|
67
|
+
*
|
|
68
|
+
* Note: "big" is NOT handled here - it's a legacy format handled separately
|
|
69
|
+
* in renderNumberField to preserve backward compatibility with formatBigNumber.
|
|
70
|
+
*/
|
|
71
|
+
export declare function parseNumberShorthand(format: string): ParsedNumberFormat | null;
|
|
72
|
+
/**
|
|
73
|
+
* Parses a currency shorthand format string.
|
|
74
|
+
* Pattern: {currency}{decimals}{scale} e.g., "usd2m", "eur0k", "gbp1b"
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* parseCurrencyShorthand("usd2m") // { currency: 'usd', symbol: '$', decimals: 2, scale: 'm' }
|
|
78
|
+
* parseCurrencyShorthand("eur0k") // { currency: 'eur', symbol: '€', decimals: 0, scale: 'k' }
|
|
79
|
+
* parseCurrencyShorthand("usd") // { currency: 'usd', symbol: '$' }
|
|
80
|
+
*/
|
|
81
|
+
export declare function parseCurrencyShorthand(format: string): ParsedCurrencyFormat | null;
|
|
82
|
+
/**
|
|
83
|
+
* Normalizes a scale value to a ScaleKey.
|
|
84
|
+
* Supports single-letter scales: k, m, b, t, q, auto.
|
|
85
|
+
*/
|
|
86
|
+
export declare function normalizeScale(scale: string | undefined): ScaleKey | 'auto' | undefined;
|
|
32
87
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@malloydata/render",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.333",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/module/index.umd.js",
|
|
6
6
|
"types": "dist/module/index.d.ts",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"generate-flow": "ts-node ../../scripts/gen-flow.ts"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@malloydata/malloy": "0.0.
|
|
33
|
-
"@malloydata/malloy-interfaces": "0.0.
|
|
34
|
-
"@malloydata/malloy-tag": "0.0.
|
|
32
|
+
"@malloydata/malloy": "0.0.333",
|
|
33
|
+
"@malloydata/malloy-interfaces": "0.0.333",
|
|
34
|
+
"@malloydata/malloy-tag": "0.0.333",
|
|
35
35
|
"@tanstack/solid-virtual": "^3.10.4",
|
|
36
36
|
"lodash": "^4.17.20",
|
|
37
37
|
"luxon": "^3.5.0",
|
|
@@ -43,21 +43,21 @@
|
|
|
43
43
|
"vega-lite": "^5.2.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@malloydata/db-duckdb": "0.0.
|
|
47
|
-
"@storybook/addon-essentials": "^8.
|
|
48
|
-
"@storybook/addon-interactions": "^8.
|
|
49
|
-
"@storybook/addon-links": "^8.
|
|
50
|
-
"@storybook/blocks": "^8.
|
|
51
|
-
"@storybook/builder-vite": "^8.
|
|
52
|
-
"@storybook/html": "^8.
|
|
53
|
-
"@storybook/html-vite": "^8.
|
|
54
|
-
"@storybook/manager-api": "^8.
|
|
55
|
-
"@storybook/test": "^8.
|
|
56
|
-
"@storybook/theming": "^8.
|
|
57
|
-
"@storybook/types": "^8.
|
|
46
|
+
"@malloydata/db-duckdb": "0.0.333",
|
|
47
|
+
"@storybook/addon-essentials": "^8.6.15",
|
|
48
|
+
"@storybook/addon-interactions": "^8.6.15",
|
|
49
|
+
"@storybook/addon-links": "^8.6.15",
|
|
50
|
+
"@storybook/blocks": "^8.6.15",
|
|
51
|
+
"@storybook/builder-vite": "^8.6.15",
|
|
52
|
+
"@storybook/html": "^8.6.15",
|
|
53
|
+
"@storybook/html-vite": "^8.6.15",
|
|
54
|
+
"@storybook/manager-api": "^8.6.15",
|
|
55
|
+
"@storybook/test": "^8.6.15",
|
|
56
|
+
"@storybook/theming": "^8.6.15",
|
|
57
|
+
"@storybook/types": "^8.6.15",
|
|
58
58
|
"@types/luxon": "^3.5.0",
|
|
59
59
|
"esbuild": "0.25.0",
|
|
60
|
-
"storybook": "^8.
|
|
60
|
+
"storybook": "^8.6.15",
|
|
61
61
|
"vite": "^5.1.5",
|
|
62
62
|
"vite-plugin-dts": "^4.5.4",
|
|
63
63
|
"vite-plugin-solid": "^2.10.1",
|