@asteby/metacore-runtime-react 28.0.2 → 28.0.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/CHANGELOG.md +9 -0
- package/dist/dynamic-columns.d.ts.map +1 -1
- package/dist/dynamic-columns.js +26 -3
- package/package.json +3 -3
- package/src/dynamic-columns.tsx +39 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @asteby/metacore-runtime-react
|
|
2
2
|
|
|
3
|
+
## 28.0.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 6c99099: DynamicTable: columnas currency con moneda POR FILA — `display_config.currency_field`
|
|
8
|
+
nombra la columna hermana que trae el código ISO del monto de esa fila (tablas
|
|
9
|
+
multi-moneda: un pago en Bs ya no se renderiza como USD de la org). Código no-ISO
|
|
10
|
+
se prefija verbatim en vez de reventar el Intl.NumberFormat.
|
|
11
|
+
|
|
3
12
|
## 28.0.2
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-columns.d.ts","sourceRoot":"","sources":["../src/dynamic-columns.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAU,KAAK,MAAM,EAAE,MAAM,UAAU,CAAA;AAwC9C,OAAO,KAAK,EAAiB,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAE9D,OAAO,KAAK,EAER,iBAAiB,EACpB,MAAM,wBAAwB,CAAA;AAE/B,qEAAqE;AACrE,MAAM,WAAW,qBAAqB;IAClC;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAA;IACtC;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;CACtB;AA0BD;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAI,KAAK,gBAAgB,EAAE,cAAc,MAAM,KAAG,MACzB,CAAA;A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|| value === undefined || isNaN(num))
|
|
645
645
|
return (_jsx("div", { className: "text-right", children: _jsx(EmptyCell, {}) }));
|
|
646
646
|
const decimals = styleCfg(col, 'decimals') ?? 2;
|
|
647
|
-
|
|
647
|
+
// Per-row currency: `display_config.currency_field`
|
|
648
|
+
// names a sibling column carrying the ISO code of
|
|
649
|
+
// THIS row's amount (multi-currency tables: a Bs
|
|
650
|
+
// tender must not render as the org's USD). Falls
|
|
651
|
+
// back to the column/org currency; if the code is
|
|
652
|
+
// not a valid ISO 4217 code, prefix it verbatim.
|
|
653
|
+
const currencyField = styleCfg(col, 'currency_field');
|
|
654
|
+
const rowCode = typeof currencyField === 'string' && currencyField
|
|
655
|
+
? String(getNestedValue(row.original, currencyField) ?? '').trim()
|
|
656
|
+
: '';
|
|
657
|
+
const activeCode = rowCode || resolveCurrency(col, currency);
|
|
658
|
+
let formatted;
|
|
659
|
+
try {
|
|
660
|
+
formatted = formatNumber(num, {
|
|
648
661
|
style: 'currency',
|
|
649
|
-
currency:
|
|
662
|
+
currency: activeCode,
|
|
650
663
|
minimumFractionDigits: decimals,
|
|
651
664
|
maximumFractionDigits: decimals,
|
|
652
|
-
}, currentLanguage)
|
|
665
|
+
}, currentLanguage);
|
|
666
|
+
}
|
|
667
|
+
catch {
|
|
668
|
+
// Non-ISO code (e.g. a custom tender label):
|
|
669
|
+
// render "<code> 1,234.56" instead of crashing.
|
|
670
|
+
formatted = `${activeCode} ${formatNumber(num, {
|
|
671
|
+
minimumFractionDigits: decimals,
|
|
672
|
+
maximumFractionDigits: decimals,
|
|
673
|
+
}, currentLanguage)}`;
|
|
674
|
+
}
|
|
675
|
+
return (_jsx("span", { className: "block text-right font-medium tabular-nums", children: formatted }));
|
|
653
676
|
}
|
|
654
677
|
case 'number': {
|
|
655
678
|
const num = typeof value === 'number' ? value : Number(value);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asteby/metacore-runtime-react",
|
|
3
|
-
"version": "28.0.
|
|
3
|
+
"version": "28.0.3",
|
|
4
4
|
"description": "React runtime for metacore hosts — renders addon contributions dynamically",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -67,8 +67,8 @@
|
|
|
67
67
|
"typescript": "^6.0.0",
|
|
68
68
|
"vitest": "^4.0.0",
|
|
69
69
|
"zustand": "^5.0.0",
|
|
70
|
-
"@asteby/metacore-
|
|
71
|
-
"@asteby/metacore-
|
|
70
|
+
"@asteby/metacore-sdk": "3.4.0",
|
|
71
|
+
"@asteby/metacore-ui": "2.12.1"
|
|
72
72
|
},
|
|
73
73
|
"scripts": {
|
|
74
74
|
"build": "tsc -p tsconfig.json",
|
package/src/dynamic-columns.tsx
CHANGED
|
@@ -940,18 +940,47 @@ export function makeDefaultGetDynamicColumns(
|
|
|
940
940
|
</div>
|
|
941
941
|
)
|
|
942
942
|
const decimals = styleCfg(col, 'decimals') ?? 2
|
|
943
|
+
// Per-row currency: `display_config.currency_field`
|
|
944
|
+
// names a sibling column carrying the ISO code of
|
|
945
|
+
// THIS row's amount (multi-currency tables: a Bs
|
|
946
|
+
// tender must not render as the org's USD). Falls
|
|
947
|
+
// back to the column/org currency; if the code is
|
|
948
|
+
// not a valid ISO 4217 code, prefix it verbatim.
|
|
949
|
+
const currencyField = styleCfg(col, 'currency_field')
|
|
950
|
+
const rowCode =
|
|
951
|
+
typeof currencyField === 'string' && currencyField
|
|
952
|
+
? String(
|
|
953
|
+
getNestedValue(row.original, currencyField) ?? '',
|
|
954
|
+
).trim()
|
|
955
|
+
: ''
|
|
956
|
+
const activeCode = rowCode || resolveCurrency(col, currency)
|
|
957
|
+
let formatted: string
|
|
958
|
+
try {
|
|
959
|
+
formatted = formatNumber(
|
|
960
|
+
num,
|
|
961
|
+
{
|
|
962
|
+
style: 'currency',
|
|
963
|
+
currency: activeCode,
|
|
964
|
+
minimumFractionDigits: decimals,
|
|
965
|
+
maximumFractionDigits: decimals,
|
|
966
|
+
},
|
|
967
|
+
currentLanguage,
|
|
968
|
+
)
|
|
969
|
+
} catch {
|
|
970
|
+
// Non-ISO code (e.g. a custom tender label):
|
|
971
|
+
// render "<code> 1,234.56" instead of crashing.
|
|
972
|
+
formatted = `${activeCode} ${formatNumber(
|
|
973
|
+
num,
|
|
974
|
+
{
|
|
975
|
+
minimumFractionDigits: decimals,
|
|
976
|
+
maximumFractionDigits: decimals,
|
|
977
|
+
},
|
|
978
|
+
currentLanguage,
|
|
979
|
+
)}`
|
|
980
|
+
}
|
|
943
981
|
return (
|
|
944
982
|
<span className="block text-right font-medium tabular-nums">
|
|
945
|
-
{
|
|
946
|
-
num,
|
|
947
|
-
{
|
|
948
|
-
style: 'currency',
|
|
949
|
-
currency: resolveCurrency(col, currency),
|
|
950
|
-
minimumFractionDigits: decimals,
|
|
951
|
-
maximumFractionDigits: decimals,
|
|
952
|
-
},
|
|
953
|
-
currentLanguage,
|
|
954
|
-
)}
|
|
983
|
+
{formatted}
|
|
955
984
|
</span>
|
|
956
985
|
)
|
|
957
986
|
}
|