@ktnpm_devops/react-component 0.12.1 → 0.13.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.
- package/README.md +39 -0
- package/dist/constants.d.ts +26 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/geo/GeoMapCard/GeoMapCard.d.ts +7 -0
- package/dist/geo/GeoMapCard/GeoMapCard.d.ts.map +1 -0
- package/dist/geo/GeoMapCard/GeoMapCard.types.d.ts +91 -0
- package/dist/geo/GeoMapCard/GeoMapCard.types.d.ts.map +1 -0
- package/dist/geo/GeoMapCard/MapLegend.d.ts +12 -0
- package/dist/geo/GeoMapCard/MapLegend.d.ts.map +1 -0
- package/dist/geo/GeoMapCard/MapViewport.d.ts +17 -0
- package/dist/geo/GeoMapCard/MapViewport.d.ts.map +1 -0
- package/dist/geo/GeoMapCard/PointListing.d.ts +14 -0
- package/dist/geo/GeoMapCard/PointListing.d.ts.map +1 -0
- package/dist/geo/GeoMapCard/buildMarkerStyle.d.ts +47 -0
- package/dist/geo/GeoMapCard/buildMarkerStyle.d.ts.map +1 -0
- package/dist/geo/GeoMapCard/buildMarkerStyle.test.d.ts +2 -0
- package/dist/geo/GeoMapCard/buildMarkerStyle.test.d.ts.map +1 -0
- package/dist/geo/GeoMapCard/index.d.ts +3 -0
- package/dist/geo/GeoMapCard/index.d.ts.map +1 -0
- package/dist/geo/GeoMapCard/normalizePoints.d.ts +26 -0
- package/dist/geo/GeoMapCard/normalizePoints.d.ts.map +1 -0
- package/dist/geo/GeoMapCard/normalizePoints.test.d.ts +2 -0
- package/dist/geo/GeoMapCard/normalizePoints.test.d.ts.map +1 -0
- package/dist/geo/GeoMapCard/warnMissingLeafletStylesheet.d.ts +13 -0
- package/dist/geo/GeoMapCard/warnMissingLeafletStylesheet.d.ts.map +1 -0
- package/dist/geo/GeoMapCard/warnMissingLeafletStylesheet.test.d.ts +2 -0
- package/dist/geo/GeoMapCard/warnMissingLeafletStylesheet.test.d.ts.map +1 -0
- package/dist/geo/index.d.ts +3 -0
- package/dist/geo/index.d.ts.map +1 -0
- package/dist/hooks/useThemeMode.d.ts +8 -0
- package/dist/hooks/useThemeMode.d.ts.map +1 -0
- package/dist/index.cjs +52 -48
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +52 -48
- package/dist/index.js.map +1 -1
- package/dist/index10.cjs +45 -14
- package/dist/index10.cjs.map +1 -1
- package/dist/index10.js +46 -15
- package/dist/index10.js.map +1 -1
- package/dist/index100.cjs +24 -6
- package/dist/index100.cjs.map +1 -1
- package/dist/index100.js +23 -5
- package/dist/index100.js.map +1 -1
- package/dist/index101.cjs +20 -16
- package/dist/index101.cjs.map +1 -1
- package/dist/index101.js +19 -15
- package/dist/index101.js.map +1 -1
- package/dist/index102.cjs +14 -22
- package/dist/index102.cjs.map +1 -1
- package/dist/index102.js +13 -21
- package/dist/index102.js.map +1 -1
- package/dist/index103.cjs +57 -36
- package/dist/index103.cjs.map +1 -1
- package/dist/index103.js +57 -36
- package/dist/index103.js.map +1 -1
- package/dist/index104.cjs +19 -16
- package/dist/index104.cjs.map +1 -1
- package/dist/index104.js +20 -17
- package/dist/index104.js.map +1 -1
- package/dist/index105.cjs +49 -19
- package/dist/index105.cjs.map +1 -1
- package/dist/index105.js +49 -19
- package/dist/index105.js.map +1 -1
- package/dist/index106.cjs +33 -0
- package/dist/index106.cjs.map +1 -0
- package/dist/index106.js +33 -0
- package/dist/index106.js.map +1 -0
- package/dist/index107.cjs +18 -0
- package/dist/index107.cjs.map +1 -0
- package/dist/index107.js +18 -0
- package/dist/index107.js.map +1 -0
- package/dist/index108.cjs +12 -0
- package/dist/index108.cjs.map +1 -0
- package/dist/index108.js +12 -0
- package/dist/index108.js.map +1 -0
- package/dist/index109.cjs +21 -0
- package/dist/index109.cjs.map +1 -0
- package/dist/index109.js +21 -0
- package/dist/index109.js.map +1 -0
- package/dist/index11.cjs +14 -15
- package/dist/index11.cjs.map +1 -1
- package/dist/index11.js +15 -16
- package/dist/index11.js.map +1 -1
- package/dist/index110.cjs +24 -0
- package/dist/index110.cjs.map +1 -0
- package/dist/index110.js +24 -0
- package/dist/index110.js.map +1 -0
- package/dist/index111.cjs +9 -0
- package/dist/index111.cjs.map +1 -0
- package/dist/index111.js +9 -0
- package/dist/index111.js.map +1 -0
- package/dist/index112.cjs +9 -0
- package/dist/index112.cjs.map +1 -0
- package/dist/index112.js +9 -0
- package/dist/index112.js.map +1 -0
- package/dist/index113.cjs +27 -0
- package/dist/index113.cjs.map +1 -0
- package/dist/index113.js +27 -0
- package/dist/index113.js.map +1 -0
- package/dist/index12.cjs +15 -4
- package/dist/index12.cjs.map +1 -1
- package/dist/index12.js +15 -4
- package/dist/index12.js.map +1 -1
- package/dist/index13.cjs +4 -16
- package/dist/index13.cjs.map +1 -1
- package/dist/index13.js +4 -16
- package/dist/index13.js.map +1 -1
- package/dist/index14.cjs +16 -10
- package/dist/index14.cjs.map +1 -1
- package/dist/index14.js +16 -10
- package/dist/index14.js.map +1 -1
- package/dist/index15.cjs +10 -100
- package/dist/index15.cjs.map +1 -1
- package/dist/index15.js +11 -101
- package/dist/index15.js.map +1 -1
- package/dist/index16.cjs +100 -20
- package/dist/index16.cjs.map +1 -1
- package/dist/index16.js +101 -21
- package/dist/index16.js.map +1 -1
- package/dist/index17.cjs +20 -54
- package/dist/index17.cjs.map +1 -1
- package/dist/index17.js +20 -54
- package/dist/index17.js.map +1 -1
- package/dist/index18.cjs +52 -16
- package/dist/index18.cjs.map +1 -1
- package/dist/index18.js +54 -18
- package/dist/index18.js.map +1 -1
- package/dist/index19.cjs +16 -24
- package/dist/index19.cjs.map +1 -1
- package/dist/index19.js +17 -25
- package/dist/index19.js.map +1 -1
- package/dist/index20.cjs +22 -39
- package/dist/index20.cjs.map +1 -1
- package/dist/index20.js +23 -40
- package/dist/index20.js.map +1 -1
- package/dist/index21.cjs +38 -85
- package/dist/index21.cjs.map +1 -1
- package/dist/index21.js +40 -87
- package/dist/index21.js.map +1 -1
- package/dist/index22.cjs +85 -153
- package/dist/index22.cjs.map +1 -1
- package/dist/index22.js +87 -155
- package/dist/index22.js.map +1 -1
- package/dist/index23.cjs +150 -128
- package/dist/index23.cjs.map +1 -1
- package/dist/index23.js +150 -128
- package/dist/index23.js.map +1 -1
- package/dist/index24.cjs +121 -106
- package/dist/index24.cjs.map +1 -1
- package/dist/index24.js +122 -107
- package/dist/index24.js.map +1 -1
- package/dist/index25.cjs +121 -17
- package/dist/index25.cjs.map +1 -1
- package/dist/index25.js +121 -17
- package/dist/index25.js.map +1 -1
- package/dist/index26.cjs +16 -163
- package/dist/index26.cjs.map +1 -1
- package/dist/index26.js +16 -163
- package/dist/index26.js.map +1 -1
- package/dist/index27.cjs +163 -21
- package/dist/index27.cjs.map +1 -1
- package/dist/index27.js +164 -22
- package/dist/index27.js.map +1 -1
- package/dist/index28.cjs +20 -129
- package/dist/index28.cjs.map +1 -1
- package/dist/index28.js +20 -129
- package/dist/index28.js.map +1 -1
- package/dist/index29.cjs +129 -75
- package/dist/index29.cjs.map +1 -1
- package/dist/index29.js +131 -77
- package/dist/index29.js.map +1 -1
- package/dist/index30.cjs +152 -7
- package/dist/index30.cjs.map +1 -1
- package/dist/index30.js +154 -9
- package/dist/index30.js.map +1 -1
- package/dist/index31.cjs +74 -128
- package/dist/index31.cjs.map +1 -1
- package/dist/index31.js +76 -130
- package/dist/index31.js.map +1 -1
- package/dist/index32.cjs +6 -54
- package/dist/index32.cjs.map +1 -1
- package/dist/index32.js +8 -56
- package/dist/index32.js.map +1 -1
- package/dist/index33.cjs +128 -35
- package/dist/index33.cjs.map +1 -1
- package/dist/index33.js +128 -35
- package/dist/index33.js.map +1 -1
- package/dist/index34.cjs +51 -221
- package/dist/index34.cjs.map +1 -1
- package/dist/index34.js +52 -222
- package/dist/index34.js.map +1 -1
- package/dist/index35.cjs +38 -34
- package/dist/index35.cjs.map +1 -1
- package/dist/index35.js +39 -35
- package/dist/index35.js.map +1 -1
- package/dist/index36.cjs +222 -106
- package/dist/index36.cjs.map +1 -1
- package/dist/index36.js +224 -108
- package/dist/index36.js.map +1 -1
- package/dist/index37.cjs +30 -64
- package/dist/index37.cjs.map +1 -1
- package/dist/index37.js +31 -65
- package/dist/index37.js.map +1 -1
- package/dist/index38.cjs +106 -74
- package/dist/index38.cjs.map +1 -1
- package/dist/index38.js +108 -76
- package/dist/index38.js.map +1 -1
- package/dist/index39.cjs +63 -54
- package/dist/index39.cjs.map +1 -1
- package/dist/index39.js +64 -55
- package/dist/index39.js.map +1 -1
- package/dist/index40.cjs +69 -144
- package/dist/index40.cjs.map +1 -1
- package/dist/index40.js +70 -145
- package/dist/index40.js.map +1 -1
- package/dist/index41.cjs +57 -96
- package/dist/index41.cjs.map +1 -1
- package/dist/index41.js +59 -98
- package/dist/index41.js.map +1 -1
- package/dist/index42.cjs +147 -66
- package/dist/index42.cjs.map +1 -1
- package/dist/index42.js +149 -68
- package/dist/index42.js.map +1 -1
- package/dist/index43.cjs +97 -7
- package/dist/index43.cjs.map +1 -1
- package/dist/index43.js +99 -9
- package/dist/index43.js.map +1 -1
- package/dist/index44.cjs +72 -17
- package/dist/index44.cjs.map +1 -1
- package/dist/index44.js +73 -18
- package/dist/index44.js.map +1 -1
- package/dist/index45.cjs +7 -76
- package/dist/index45.cjs.map +1 -1
- package/dist/index45.js +9 -78
- package/dist/index45.js.map +1 -1
- package/dist/index46.cjs +17 -143
- package/dist/index46.cjs.map +1 -1
- package/dist/index46.js +17 -143
- package/dist/index46.js.map +1 -1
- package/dist/index47.cjs +72 -59
- package/dist/index47.cjs.map +1 -1
- package/dist/index47.js +74 -61
- package/dist/index47.js.map +1 -1
- package/dist/index48.cjs +136 -98
- package/dist/index48.cjs.map +1 -1
- package/dist/index48.js +137 -99
- package/dist/index48.js.map +1 -1
- package/dist/index49.cjs +49 -32
- package/dist/index49.cjs.map +1 -1
- package/dist/index49.js +49 -32
- package/dist/index49.js.map +1 -1
- package/dist/index50.cjs +105 -6
- package/dist/index50.cjs.map +1 -1
- package/dist/index50.js +106 -7
- package/dist/index50.js.map +1 -1
- package/dist/index51.cjs +44 -144
- package/dist/index51.cjs.map +1 -1
- package/dist/index51.js +45 -145
- package/dist/index51.js.map +1 -1
- package/dist/index52.cjs +6 -8
- package/dist/index52.cjs.map +1 -1
- package/dist/index52.js +6 -8
- package/dist/index52.js.map +1 -1
- package/dist/index53.cjs +145 -15
- package/dist/index53.cjs.map +1 -1
- package/dist/index53.js +147 -17
- package/dist/index53.js.map +1 -1
- package/dist/index54.cjs +7 -65
- package/dist/index54.cjs.map +1 -1
- package/dist/index54.js +8 -66
- package/dist/index54.js.map +1 -1
- package/dist/index55.cjs +19 -16
- package/dist/index55.cjs.map +1 -1
- package/dist/index55.js +18 -15
- package/dist/index55.js.map +1 -1
- package/dist/index56.cjs +67 -24
- package/dist/index56.cjs.map +1 -1
- package/dist/index56.js +66 -23
- package/dist/index56.js.map +1 -1
- package/dist/index57.cjs +15 -69
- package/dist/index57.cjs.map +1 -1
- package/dist/index57.js +15 -69
- package/dist/index57.js.map +1 -1
- package/dist/index58.cjs +3 -15
- package/dist/index58.cjs.map +1 -1
- package/dist/index58.js +3 -15
- package/dist/index58.js.map +1 -1
- package/dist/index59.cjs +24 -89
- package/dist/index59.cjs.map +1 -1
- package/dist/index59.js +23 -88
- package/dist/index59.js.map +1 -1
- package/dist/index60.cjs +64 -16
- package/dist/index60.cjs.map +1 -1
- package/dist/index60.js +64 -16
- package/dist/index60.js.map +1 -1
- package/dist/index62.cjs +18 -9
- package/dist/index62.cjs.map +1 -1
- package/dist/index62.js +18 -9
- package/dist/index62.js.map +1 -1
- package/dist/index63.cjs +13 -16
- package/dist/index63.cjs.map +1 -1
- package/dist/index63.js +13 -16
- package/dist/index63.js.map +1 -1
- package/dist/index64.cjs +13 -13
- package/dist/index64.js +13 -13
- package/dist/index65.cjs +17 -2
- package/dist/index65.cjs.map +1 -1
- package/dist/index65.js +18 -3
- package/dist/index65.js.map +1 -1
- package/dist/index66.cjs +2 -20
- package/dist/index66.cjs.map +1 -1
- package/dist/index66.js +3 -21
- package/dist/index66.js.map +1 -1
- package/dist/index67.cjs +116 -28
- package/dist/index67.cjs.map +1 -1
- package/dist/index67.js +114 -26
- package/dist/index67.js.map +1 -1
- package/dist/index68.cjs +17 -17
- package/dist/index68.js +18 -18
- package/dist/index69.cjs +20 -5
- package/dist/index69.cjs.map +1 -1
- package/dist/index69.js +20 -5
- package/dist/index69.js.map +1 -1
- package/dist/index7.cjs +32 -64
- package/dist/index7.cjs.map +1 -1
- package/dist/index7.js +32 -64
- package/dist/index7.js.map +1 -1
- package/dist/index70.cjs +10 -16
- package/dist/index70.cjs.map +1 -1
- package/dist/index70.js +10 -16
- package/dist/index70.js.map +1 -1
- package/dist/index71.cjs +16 -28
- package/dist/index71.cjs.map +1 -1
- package/dist/index71.js +16 -28
- package/dist/index71.js.map +1 -1
- package/dist/index72.cjs +79 -19
- package/dist/index72.cjs.map +1 -1
- package/dist/index72.js +80 -20
- package/dist/index72.js.map +1 -1
- package/dist/index73.cjs +47 -2
- package/dist/index73.cjs.map +1 -1
- package/dist/index73.js +48 -3
- package/dist/index73.js.map +1 -1
- package/dist/index74.cjs +53 -2
- package/dist/index74.cjs.map +1 -1
- package/dist/index74.js +54 -3
- package/dist/index74.js.map +1 -1
- package/dist/index76.cjs +28 -13
- package/dist/index76.cjs.map +1 -1
- package/dist/index76.js +29 -14
- package/dist/index76.js.map +1 -1
- package/dist/index77.cjs +3 -30
- package/dist/index77.cjs.map +1 -1
- package/dist/index77.js +3 -30
- package/dist/index77.js.map +1 -1
- package/dist/index78.cjs +31 -7
- package/dist/index78.cjs.map +1 -1
- package/dist/index78.js +32 -8
- package/dist/index78.js.map +1 -1
- package/dist/index79.cjs +10 -34
- package/dist/index79.cjs.map +1 -1
- package/dist/index79.js +11 -35
- package/dist/index79.js.map +1 -1
- package/dist/index8.cjs +58 -75
- package/dist/index8.cjs.map +1 -1
- package/dist/index8.js +58 -75
- package/dist/index8.js.map +1 -1
- package/dist/index80.cjs +16 -10
- package/dist/index80.cjs.map +1 -1
- package/dist/index80.js +17 -11
- package/dist/index80.js.map +1 -1
- package/dist/index81.cjs +16 -4
- package/dist/index81.cjs.map +1 -1
- package/dist/index81.js +17 -5
- package/dist/index81.js.map +1 -1
- package/dist/index82.cjs +10 -134
- package/dist/index82.cjs.map +1 -1
- package/dist/index82.js +9 -133
- package/dist/index82.js.map +1 -1
- package/dist/index83.cjs +24 -36
- package/dist/index83.cjs.map +1 -1
- package/dist/index83.js +25 -37
- package/dist/index83.js.map +1 -1
- package/dist/index84.cjs +36 -81
- package/dist/index84.cjs.map +1 -1
- package/dist/index84.js +36 -81
- package/dist/index84.js.map +1 -1
- package/dist/index85.cjs +38 -2
- package/dist/index85.cjs.map +1 -1
- package/dist/index85.js +39 -3
- package/dist/index85.js.map +1 -1
- package/dist/index86.cjs +49 -43
- package/dist/index86.cjs.map +1 -1
- package/dist/index86.js +50 -44
- package/dist/index86.js.map +1 -1
- package/dist/index87.cjs +39 -57
- package/dist/index87.cjs.map +1 -1
- package/dist/index87.js +38 -56
- package/dist/index87.js.map +1 -1
- package/dist/index88.cjs +92 -42
- package/dist/index88.cjs.map +1 -1
- package/dist/index88.js +91 -41
- package/dist/index88.js.map +1 -1
- package/dist/index89.cjs +34 -16
- package/dist/index89.cjs.map +1 -1
- package/dist/index89.js +34 -16
- package/dist/index89.js.map +1 -1
- package/dist/index9.cjs +81 -45
- package/dist/index9.cjs.map +1 -1
- package/dist/index9.js +81 -45
- package/dist/index9.js.map +1 -1
- package/dist/index90.cjs +1 -1
- package/dist/index90.js +1 -1
- package/dist/index92.cjs +34 -34
- package/dist/index92.js +34 -34
- package/dist/index93.cjs +134 -34
- package/dist/index93.cjs.map +1 -1
- package/dist/index93.js +133 -33
- package/dist/index93.js.map +1 -1
- package/dist/index94.cjs +45 -39
- package/dist/index94.cjs.map +1 -1
- package/dist/index94.js +44 -38
- package/dist/index94.js.map +1 -1
- package/dist/index95.cjs +33 -92
- package/dist/index95.cjs.map +1 -1
- package/dist/index95.js +32 -91
- package/dist/index95.js.map +1 -1
- package/dist/index96.cjs +16 -34
- package/dist/index96.cjs.map +1 -1
- package/dist/index96.js +16 -34
- package/dist/index96.js.map +1 -1
- package/dist/index97.cjs +13 -49
- package/dist/index97.cjs.map +1 -1
- package/dist/index97.js +14 -50
- package/dist/index97.js.map +1 -1
- package/dist/index98.cjs +35 -30
- package/dist/index98.cjs.map +1 -1
- package/dist/index98.js +34 -29
- package/dist/index98.js.map +1 -1
- package/dist/index99.cjs +43 -57
- package/dist/index99.cjs.map +1 -1
- package/dist/index99.js +42 -56
- package/dist/index99.js.map +1 -1
- package/dist/style.css +207 -0
- package/dist/types/geo.types.d.ts +45 -0
- package/dist/types/geo.types.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +13 -2
package/dist/index9.js
CHANGED
|
@@ -1,49 +1,85 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
)
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
1
|
+
const ensureString = (value) => value === null || value === void 0 ? "" : String(value);
|
|
2
|
+
const toStringTable = (table) => table.map((row) => row.map((cell) => ensureString(cell)));
|
|
3
|
+
const sanitizeFilename = (value) => {
|
|
4
|
+
const normalized = value.normalize().replace(/[^\p{L}\p{N}]+/gu, "-").replace(/^-+|-+$/g, "").toLowerCase();
|
|
5
|
+
return normalized || "export";
|
|
6
|
+
};
|
|
7
|
+
const buildCsv = (table) => {
|
|
8
|
+
const rows = toStringTable(table);
|
|
9
|
+
return rows.map(
|
|
10
|
+
(row) => row.map((cell) => {
|
|
11
|
+
const escaped = cell.replace(/"/g, '""');
|
|
12
|
+
return /[",\n]/.test(escaped) ? `"${escaped}"` : escaped;
|
|
13
|
+
}).join(",")
|
|
14
|
+
).join("\r\n");
|
|
15
|
+
};
|
|
16
|
+
const triggerDownload = (blob, filename) => {
|
|
17
|
+
const link = document.createElement("a");
|
|
18
|
+
const url = URL.createObjectURL(blob);
|
|
19
|
+
link.href = url;
|
|
20
|
+
link.download = filename;
|
|
21
|
+
document.body.appendChild(link);
|
|
22
|
+
link.click();
|
|
23
|
+
document.body.removeChild(link);
|
|
24
|
+
URL.revokeObjectURL(url);
|
|
25
|
+
};
|
|
26
|
+
const exportTableToCsv = (table, filename) => {
|
|
27
|
+
if (table.length === 0) return;
|
|
28
|
+
const csv = buildCsv(table);
|
|
29
|
+
const blob = new Blob([csv], { type: "text/csv;charset=utf-8;" });
|
|
30
|
+
const finalName = filename.endsWith(".csv") ? filename : `${filename}.csv`;
|
|
31
|
+
triggerDownload(blob, finalName);
|
|
32
|
+
};
|
|
33
|
+
const getChartPngDataUrl = (chart) => chart.getDataURL({ type: "png", pixelRatio: 2, backgroundColor: "#ffffff" });
|
|
34
|
+
const downloadImageDataUrl = (dataUrl, filename) => {
|
|
35
|
+
const link = document.createElement("a");
|
|
36
|
+
link.href = dataUrl;
|
|
37
|
+
link.download = filename;
|
|
38
|
+
document.body.appendChild(link);
|
|
39
|
+
link.click();
|
|
40
|
+
document.body.removeChild(link);
|
|
41
|
+
};
|
|
42
|
+
const buildTableHtml = (table) => {
|
|
43
|
+
const rows = toStringTable(table);
|
|
44
|
+
if (rows.length === 0) return "";
|
|
45
|
+
const [header, ...body] = rows;
|
|
46
|
+
const thead = `<thead><tr>${header.map((c) => `<th>${c}</th>`).join("")}</tr></thead>`;
|
|
47
|
+
const tbody = body.map((r) => `<tr>${r.map((c) => `<td>${c}</td>`).join("")}</tr>`).join("");
|
|
48
|
+
return `<table>${thead}<tbody>${tbody}</tbody></table>`;
|
|
49
|
+
};
|
|
50
|
+
const openPrintWindowWithChart = (title, chartDataUrl, table) => {
|
|
51
|
+
const win = window.open("", "_blank");
|
|
52
|
+
if (!win) return;
|
|
53
|
+
const tableHtml = buildTableHtml(table);
|
|
54
|
+
win.document.write("<!DOCTYPE html>");
|
|
55
|
+
win.document.write(`<html><head><title>${title}</title>`);
|
|
56
|
+
win.document.write(
|
|
57
|
+
"<style>body{font-family:Arial,Helvetica,sans-serif;padding:24px;color:#1f2937;}h1{font-size:20px;margin-bottom:16px;}img{max-width:100%;height:auto;margin-bottom:16px;border:1px solid #e5e7eb;border-radius:12px;}table{border-collapse:collapse;width:100%;}th,td{border:1px solid #d1d5db;padding:8px;text-align:left;font-size:12px;}th{background:#f3f4f6;text-transform:uppercase;letter-spacing:0.05em;font-weight:600;}</style>"
|
|
58
|
+
);
|
|
59
|
+
win.document.write("</head><body>");
|
|
60
|
+
win.document.write(`<h1>${title}</h1>`);
|
|
61
|
+
win.document.write(`<img src="${chartDataUrl}" alt="${title}" />`);
|
|
62
|
+
win.document.write(tableHtml);
|
|
63
|
+
win.document.write("</body></html>");
|
|
64
|
+
win.document.close();
|
|
65
|
+
win.focus();
|
|
66
|
+
setTimeout(() => win.print(), 300);
|
|
67
|
+
};
|
|
68
|
+
const composeFilename = (title, suffix) => {
|
|
69
|
+
const base = sanitizeFilename(title);
|
|
70
|
+
if (suffix && suffix.trim().length > 0) {
|
|
71
|
+
const suffixSanitized = sanitizeFilename(suffix);
|
|
72
|
+
return `${base}-${suffixSanitized}`;
|
|
42
73
|
}
|
|
43
|
-
|
|
44
|
-
|
|
74
|
+
return base;
|
|
75
|
+
};
|
|
45
76
|
export {
|
|
46
|
-
|
|
47
|
-
|
|
77
|
+
composeFilename,
|
|
78
|
+
downloadImageDataUrl,
|
|
79
|
+
exportTableToCsv,
|
|
80
|
+
getChartPngDataUrl,
|
|
81
|
+
openPrintWindowWithChart,
|
|
82
|
+
sanitizeFilename,
|
|
83
|
+
toStringTable
|
|
48
84
|
};
|
|
49
85
|
//# sourceMappingURL=index9.js.map
|
package/dist/index9.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index9.js","sources":["../src/
|
|
1
|
+
{"version":3,"file":"index9.js","sources":["../src/utils/chartExport.ts"],"sourcesContent":["export type TableData = Array<Array<string | number>>;\n\nconst ensureString = (value: string | number): string =>\n value === null || value === undefined ? '' : String(value);\n\nexport const toStringTable = (table: TableData): string[][] =>\n table.map((row) => row.map((cell) => ensureString(cell)));\n\nexport const sanitizeFilename = (value: string): string => {\n const normalized = value\n .normalize()\n .replace(/[^\\p{L}\\p{N}]+/gu, '-')\n .replace(/^-+|-+$/g, '')\n .toLowerCase();\n return normalized || 'export';\n};\n\nconst buildCsv = (table: TableData): string => {\n const rows = toStringTable(table);\n return rows\n .map((row) =>\n row\n .map((cell) => {\n const escaped = cell.replace(/\"/g, '\"\"');\n return /[\",\\n]/.test(escaped) ? `\"${escaped}\"` : escaped;\n })\n .join(','),\n )\n .join('\\r\\n');\n};\n\nconst triggerDownload = (blob: Blob, filename: string) => {\n const link = document.createElement('a');\n const url = URL.createObjectURL(blob);\n link.href = url;\n link.download = filename;\n document.body.appendChild(link);\n link.click();\n document.body.removeChild(link);\n URL.revokeObjectURL(url);\n};\n\nexport const exportTableToCsv = (table: TableData, filename: string) => {\n if (table.length === 0) return;\n const csv = buildCsv(table);\n const blob = new Blob([csv], { type: 'text/csv;charset=utf-8;' });\n const finalName = filename.endsWith('.csv') ? filename : `${filename}.csv`;\n triggerDownload(blob, finalName);\n};\n\nexport const getChartPngDataUrl = (chart: { getDataURL: (opts: Record<string, unknown>) => string }): string =>\n chart.getDataURL({ type: 'png', pixelRatio: 2, backgroundColor: '#ffffff' });\n\nexport const downloadImageDataUrl = (dataUrl: string, filename: string) => {\n const link = document.createElement('a');\n link.href = dataUrl;\n link.download = filename;\n document.body.appendChild(link);\n link.click();\n document.body.removeChild(link);\n};\n\nconst buildTableHtml = (table: TableData): string => {\n const rows = toStringTable(table);\n if (rows.length === 0) return '';\n const [header, ...body] = rows;\n const thead = `<thead><tr>${header.map((c) => `<th>${c}</th>`).join('')}</tr></thead>`;\n const tbody = body.map((r) => `<tr>${r.map((c) => `<td>${c}</td>`).join('')}</tr>`).join('');\n return `<table>${thead}<tbody>${tbody}</tbody></table>`;\n};\n\nexport const openPrintWindowWithChart = (title: string, chartDataUrl: string, table: TableData) => {\n const win = window.open('', '_blank');\n if (!win) return;\n const tableHtml = buildTableHtml(table);\n win.document.write('<!DOCTYPE html>');\n win.document.write(`<html><head><title>${title}</title>`);\n win.document.write(\n '<style>body{font-family:Arial,Helvetica,sans-serif;padding:24px;color:#1f2937;}h1{font-size:20px;margin-bottom:16px;}img{max-width:100%;height:auto;margin-bottom:16px;border:1px solid #e5e7eb;border-radius:12px;}table{border-collapse:collapse;width:100%;}th,td{border:1px solid #d1d5db;padding:8px;text-align:left;font-size:12px;}th{background:#f3f4f6;text-transform:uppercase;letter-spacing:0.05em;font-weight:600;}</style>',\n );\n win.document.write('</head><body>');\n win.document.write(`<h1>${title}</h1>`);\n win.document.write(`<img src=\"${chartDataUrl}\" alt=\"${title}\" />`);\n win.document.write(tableHtml);\n win.document.write('</body></html>');\n win.document.close();\n win.focus();\n setTimeout(() => win.print(), 300);\n};\n\nexport const composeFilename = (title: string, suffix?: string) => {\n const base = sanitizeFilename(title);\n if (suffix && suffix.trim().length > 0) {\n const suffixSanitized = sanitizeFilename(suffix);\n return suffixSanitized ? `${base}-${suffixSanitized}` : base;\n }\n return base;\n};\n"],"names":[],"mappings":"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AAO,iBAAiB,KAAK;AACnC,MAAI,UAAU,OAAO,KAAA,EAAO,SAAS,GAAG;AACtC,UAAM,kBAAkB,iBAAiB,MAAM;AAC/C,WAAyB,GAAG,IAAI,IAAI,eAAe;AAAA,EACrD;AACA,SAAO;AACT;"}
|
package/dist/index90.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const constants = require("./
|
|
3
|
+
const constants = require("./index67.cjs");
|
|
4
4
|
function groupByCategory(data, limit, order = "total") {
|
|
5
5
|
const grouped = /* @__PURE__ */ new Map();
|
|
6
6
|
for (const point of data) {
|
package/dist/index90.js
CHANGED
package/dist/index92.cjs
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const root = "krc-root-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
3
|
+
const root = "krc-root-7cxYt";
|
|
4
|
+
const chip = "krc-chip-tgAQw";
|
|
5
|
+
const active = "krc-active-hboGd";
|
|
6
|
+
const summary = "krc-summary-E-FXy";
|
|
7
|
+
const popover = "krc-popover-IJFWK";
|
|
8
|
+
const popoverHeader = "krc-popoverHeader-mdeD8";
|
|
9
|
+
const fields = "krc-fields-h5R5w";
|
|
10
|
+
const field = "krc-field-u9yvp";
|
|
11
|
+
const error = "krc-error-jsFkv";
|
|
12
|
+
const actions = "krc-actions-prbFX";
|
|
13
|
+
const btnGhost = "krc-btnGhost-x8cbA";
|
|
14
|
+
const btnPrimary = "krc-btnPrimary-T0w2q";
|
|
15
15
|
const styles = {
|
|
16
16
|
root,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
17
|
+
chip,
|
|
18
|
+
active,
|
|
19
|
+
summary,
|
|
20
|
+
popover,
|
|
21
|
+
popoverHeader,
|
|
22
|
+
fields,
|
|
23
|
+
field,
|
|
24
|
+
error,
|
|
25
|
+
actions,
|
|
26
|
+
btnGhost,
|
|
27
|
+
btnPrimary
|
|
28
28
|
};
|
|
29
|
-
exports.
|
|
30
|
-
exports.
|
|
29
|
+
exports.actions = actions;
|
|
30
|
+
exports.active = active;
|
|
31
|
+
exports.btnGhost = btnGhost;
|
|
32
|
+
exports.btnPrimary = btnPrimary;
|
|
33
|
+
exports.chip = chip;
|
|
31
34
|
exports.default = styles;
|
|
32
|
-
exports.
|
|
33
|
-
exports.
|
|
35
|
+
exports.error = error;
|
|
36
|
+
exports.field = field;
|
|
37
|
+
exports.fields = fields;
|
|
38
|
+
exports.popover = popover;
|
|
39
|
+
exports.popoverHeader = popoverHeader;
|
|
34
40
|
exports.root = root;
|
|
35
|
-
exports.
|
|
36
|
-
exports.sectionChevron = sectionChevron;
|
|
37
|
-
exports.sectionChevronOpen = sectionChevronOpen;
|
|
38
|
-
exports.sectionItems = sectionItems;
|
|
39
|
-
exports.sectionTitle = sectionTitle;
|
|
40
|
-
exports.sectionToggle = sectionToggle;
|
|
41
|
-
exports.toggle = toggle;
|
|
41
|
+
exports.summary = summary;
|
|
42
42
|
//# sourceMappingURL=index92.cjs.map
|
package/dist/index92.js
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
const root = "krc-root-
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
1
|
+
const root = "krc-root-7cxYt";
|
|
2
|
+
const chip = "krc-chip-tgAQw";
|
|
3
|
+
const active = "krc-active-hboGd";
|
|
4
|
+
const summary = "krc-summary-E-FXy";
|
|
5
|
+
const popover = "krc-popover-IJFWK";
|
|
6
|
+
const popoverHeader = "krc-popoverHeader-mdeD8";
|
|
7
|
+
const fields = "krc-fields-h5R5w";
|
|
8
|
+
const field = "krc-field-u9yvp";
|
|
9
|
+
const error = "krc-error-jsFkv";
|
|
10
|
+
const actions = "krc-actions-prbFX";
|
|
11
|
+
const btnGhost = "krc-btnGhost-x8cbA";
|
|
12
|
+
const btnPrimary = "krc-btnPrimary-T0w2q";
|
|
13
13
|
const styles = {
|
|
14
14
|
root,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
15
|
+
chip,
|
|
16
|
+
active,
|
|
17
|
+
summary,
|
|
18
|
+
popover,
|
|
19
|
+
popoverHeader,
|
|
20
|
+
fields,
|
|
21
|
+
field,
|
|
22
|
+
error,
|
|
23
|
+
actions,
|
|
24
|
+
btnGhost,
|
|
25
|
+
btnPrimary
|
|
26
26
|
};
|
|
27
27
|
export {
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
actions,
|
|
29
|
+
active,
|
|
30
|
+
btnGhost,
|
|
31
|
+
btnPrimary,
|
|
32
|
+
chip,
|
|
30
33
|
styles as default,
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
error,
|
|
35
|
+
field,
|
|
36
|
+
fields,
|
|
37
|
+
popover,
|
|
38
|
+
popoverHeader,
|
|
33
39
|
root,
|
|
34
|
-
|
|
35
|
-
sectionChevron,
|
|
36
|
-
sectionChevronOpen,
|
|
37
|
-
sectionItems,
|
|
38
|
-
sectionTitle,
|
|
39
|
-
sectionToggle,
|
|
40
|
-
toggle
|
|
40
|
+
summary
|
|
41
41
|
};
|
|
42
42
|
//# sourceMappingURL=index92.js.map
|
package/dist/index93.cjs
CHANGED
|
@@ -1,36 +1,136 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const constants = require("./index67.cjs");
|
|
4
|
+
function aggregateData(data, maxCats, maxSubs, showOthers) {
|
|
5
|
+
const categoryMap = /* @__PURE__ */ new Map();
|
|
6
|
+
for (const point of data) {
|
|
7
|
+
const cat = point.category ?? "Unknown";
|
|
8
|
+
const sub = point.subCategory ?? "Default";
|
|
9
|
+
if (!categoryMap.has(cat)) {
|
|
10
|
+
categoryMap.set(cat, /* @__PURE__ */ new Map());
|
|
11
|
+
}
|
|
12
|
+
const subMap = categoryMap.get(cat);
|
|
13
|
+
subMap.set(sub, (subMap.get(sub) ?? 0) + point.value);
|
|
14
|
+
}
|
|
15
|
+
const sortedCategories = [...categoryMap.entries()].map(([cat, subMap]) => {
|
|
16
|
+
let total = 0;
|
|
17
|
+
for (const v of subMap.values()) total += v;
|
|
18
|
+
return { cat, subMap, total };
|
|
19
|
+
}).sort((a, b) => b.total - a.total);
|
|
20
|
+
const topCategories = sortedCategories.slice(0, maxCats);
|
|
21
|
+
const overflowCategories = sortedCategories.slice(maxCats);
|
|
22
|
+
if (showOthers && overflowCategories.length > 0) {
|
|
23
|
+
const othersMap = /* @__PURE__ */ new Map();
|
|
24
|
+
for (const { subMap } of overflowCategories) {
|
|
25
|
+
for (const [sub, val] of subMap) {
|
|
26
|
+
othersMap.set(sub, (othersMap.get(sub) ?? 0) + val);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
let othersTotal = 0;
|
|
30
|
+
for (const v of othersMap.values()) othersTotal += v;
|
|
31
|
+
topCategories.push({ cat: "Others", subMap: othersMap, total: othersTotal });
|
|
32
|
+
}
|
|
33
|
+
const allSubCategories = /* @__PURE__ */ new Set();
|
|
34
|
+
for (const { subMap } of topCategories) {
|
|
35
|
+
for (const sub of subMap.keys()) {
|
|
36
|
+
allSubCategories.add(sub);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
const sortedSubs = [...allSubCategories];
|
|
40
|
+
const limitedSubs = sortedSubs.slice(0, maxSubs);
|
|
41
|
+
const hasOverflowSubs = sortedSubs.length > maxSubs;
|
|
42
|
+
const categories = topCategories.map((entry) => entry.cat);
|
|
43
|
+
const series = limitedSubs.map((sub) => ({
|
|
44
|
+
name: sub,
|
|
45
|
+
values: topCategories.map((entry) => entry.subMap.get(sub) ?? 0)
|
|
46
|
+
}));
|
|
47
|
+
if (hasOverflowSubs && showOthers) {
|
|
48
|
+
const overflowSubs = sortedSubs.slice(maxSubs);
|
|
49
|
+
series.push({
|
|
50
|
+
name: "Other subcategories",
|
|
51
|
+
values: topCategories.map((entry) => {
|
|
52
|
+
let sum = 0;
|
|
53
|
+
for (const sub of overflowSubs) {
|
|
54
|
+
sum += entry.subMap.get(sub) ?? 0;
|
|
55
|
+
}
|
|
56
|
+
return sum;
|
|
57
|
+
})
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
return { categories, series };
|
|
61
|
+
}
|
|
62
|
+
function buildBarOption(categories, series, invertAxis, hideLegend, enableScroll) {
|
|
63
|
+
const categoryAxis = { type: "category", data: categories };
|
|
64
|
+
const valueAxis = { type: "value" };
|
|
65
|
+
const dataZoom = enableScroll ? [{ type: "slider", show: true, ...invertAxis ? { yAxisIndex: 0 } : { xAxisIndex: 0 } }] : [];
|
|
66
|
+
return {
|
|
67
|
+
tooltip: { trigger: "axis", axisPointer: { type: "shadow" } },
|
|
68
|
+
legend: { show: !hideLegend, bottom: 0, type: "scroll" },
|
|
69
|
+
grid: { left: "3%", right: "4%", top: "3%", bottom: hideLegend ? "3%" : "12%", containLabel: true },
|
|
70
|
+
xAxis: invertAxis ? valueAxis : categoryAxis,
|
|
71
|
+
yAxis: invertAxis ? categoryAxis : valueAxis,
|
|
72
|
+
dataZoom,
|
|
73
|
+
series: series.map((s, i) => ({
|
|
74
|
+
name: s.name,
|
|
75
|
+
type: "bar",
|
|
76
|
+
stack: "total",
|
|
77
|
+
emphasis: { focus: "series" },
|
|
78
|
+
data: s.values,
|
|
79
|
+
itemStyle: { color: constants.CHART_COLORS[i % constants.CHART_COLORS.length] }
|
|
80
|
+
}))
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
function buildPieOption(categories, series, hideLegend) {
|
|
84
|
+
const pieData = categories.map((cat, catIdx) => {
|
|
85
|
+
let total = 0;
|
|
86
|
+
for (const s of series) {
|
|
87
|
+
total += s.values[catIdx] ?? 0;
|
|
88
|
+
}
|
|
89
|
+
return { name: cat, value: total };
|
|
90
|
+
});
|
|
91
|
+
return {
|
|
92
|
+
tooltip: { trigger: "item" },
|
|
93
|
+
legend: { show: !hideLegend, bottom: 0, type: "scroll" },
|
|
94
|
+
series: [
|
|
95
|
+
{
|
|
96
|
+
type: "pie",
|
|
97
|
+
radius: ["30%", "65%"],
|
|
98
|
+
center: ["50%", "45%"],
|
|
99
|
+
data: pieData.map((d, i) => ({
|
|
100
|
+
...d,
|
|
101
|
+
itemStyle: { color: constants.CHART_COLORS[i % constants.CHART_COLORS.length] }
|
|
102
|
+
})),
|
|
103
|
+
emphasis: { itemStyle: { shadowBlur: 10, shadowOffsetX: 0, shadowColor: "rgba(0,0,0,0.3)" } },
|
|
104
|
+
label: { show: true, formatter: "{b}: {d}%" }
|
|
105
|
+
}
|
|
106
|
+
]
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
function buildSunburstOption(categories, series) {
|
|
110
|
+
const sunburstData = categories.map((cat, catIdx) => {
|
|
111
|
+
const children = series.map((s, sIdx) => ({
|
|
112
|
+
name: s.name,
|
|
113
|
+
value: s.values[catIdx] ?? 0,
|
|
114
|
+
itemStyle: { color: constants.CHART_COLORS[(catIdx * series.length + sIdx) % constants.CHART_COLORS.length] }
|
|
115
|
+
})).filter((child) => child.value > 0);
|
|
116
|
+
return { name: cat, children };
|
|
117
|
+
});
|
|
118
|
+
return {
|
|
119
|
+
tooltip: { trigger: "item" },
|
|
120
|
+
series: [
|
|
121
|
+
{
|
|
122
|
+
type: "sunburst",
|
|
123
|
+
data: sunburstData,
|
|
124
|
+
radius: ["15%", "80%"],
|
|
125
|
+
label: { rotate: "radial", fontSize: 10 },
|
|
126
|
+
itemStyle: { borderRadius: 4, borderWidth: 1 },
|
|
127
|
+
emphasis: { focus: "ancestor" }
|
|
128
|
+
}
|
|
129
|
+
]
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
exports.aggregateData = aggregateData;
|
|
133
|
+
exports.buildBarOption = buildBarOption;
|
|
134
|
+
exports.buildPieOption = buildPieOption;
|
|
135
|
+
exports.buildSunburstOption = buildSunburstOption;
|
|
36
136
|
//# sourceMappingURL=index93.cjs.map
|
package/dist/index93.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index93.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index93.cjs","sources":["../src/charts/StackedBarChartCard/buildChartOptions.ts"],"sourcesContent":["import type { ChartSeriesPoint } from '../../types/chart.types';\nimport { CHART_COLORS } from '../../constants';\n\n/** Aggregated series data for chart rendering. */\nexport interface AggregatedChartData {\n categories: string[];\n series: { name: string; values: number[] }[];\n}\n\n/** Aggregate data points by category and subCategory, applying limits. */\nexport function aggregateData(\n data: ChartSeriesPoint[],\n maxCats: number,\n maxSubs: number,\n showOthers: boolean,\n): AggregatedChartData {\n const categoryMap = new Map<string, Map<string, number>>();\n\n for (const point of data) {\n const cat = point.category ?? 'Unknown';\n const sub = point.subCategory ?? 'Default';\n if (!categoryMap.has(cat)) {\n categoryMap.set(cat, new Map());\n }\n const subMap = categoryMap.get(cat)!;\n subMap.set(sub, (subMap.get(sub) ?? 0) + point.value);\n }\n\n const sortedCategories = [...categoryMap.entries()]\n .map(([cat, subMap]) => {\n let total = 0;\n for (const v of subMap.values()) total += v;\n return { cat, subMap, total };\n })\n .sort((a, b) => b.total - a.total);\n\n const topCategories = sortedCategories.slice(0, maxCats);\n const overflowCategories = sortedCategories.slice(maxCats);\n\n if (showOthers && overflowCategories.length > 0) {\n const othersMap = new Map<string, number>();\n for (const { subMap } of overflowCategories) {\n for (const [sub, val] of subMap) {\n othersMap.set(sub, (othersMap.get(sub) ?? 0) + val);\n }\n }\n let othersTotal = 0;\n for (const v of othersMap.values()) othersTotal += v;\n topCategories.push({ cat: 'Others', subMap: othersMap, total: othersTotal });\n }\n\n const allSubCategories = new Set<string>();\n for (const { subMap } of topCategories) {\n for (const sub of subMap.keys()) {\n allSubCategories.add(sub);\n }\n }\n\n const sortedSubs = [...allSubCategories];\n const limitedSubs = sortedSubs.slice(0, maxSubs);\n const hasOverflowSubs = sortedSubs.length > maxSubs;\n\n const categories = topCategories.map((entry) => entry.cat);\n\n const series = limitedSubs.map((sub) => ({\n name: sub,\n values: topCategories.map((entry) => entry.subMap.get(sub) ?? 0),\n }));\n\n if (hasOverflowSubs && showOthers) {\n const overflowSubs = sortedSubs.slice(maxSubs);\n series.push({\n name: 'Other subcategories',\n values: topCategories.map((entry) => {\n let sum = 0;\n for (const sub of overflowSubs) {\n sum += entry.subMap.get(sub) ?? 0;\n }\n return sum;\n }),\n });\n }\n\n return { categories, series };\n}\n\n/** Build ECharts option for stacked bar chart. */\nexport function buildBarOption(\n categories: string[],\n series: { name: string; values: number[] }[],\n invertAxis: boolean,\n hideLegend: boolean,\n enableScroll: boolean,\n) {\n const categoryAxis = { type: 'category' as const, data: categories };\n const valueAxis = { type: 'value' as const };\n\n const dataZoom = enableScroll\n ? [{ type: 'slider' as const, show: true, ...(invertAxis ? { yAxisIndex: 0 } : { xAxisIndex: 0 }) }]\n : [];\n\n return {\n tooltip: { trigger: 'axis' as const, axisPointer: { type: 'shadow' as const } },\n legend: { show: !hideLegend, bottom: 0, type: 'scroll' as const },\n grid: { left: '3%', right: '4%', top: '3%', bottom: hideLegend ? '3%' : '12%', containLabel: true },\n xAxis: invertAxis ? valueAxis : categoryAxis,\n yAxis: invertAxis ? categoryAxis : valueAxis,\n dataZoom,\n series: series.map((s, i) => ({\n name: s.name,\n type: 'bar' as const,\n stack: 'total',\n emphasis: { focus: 'series' as const },\n data: s.values,\n itemStyle: { color: CHART_COLORS[i % CHART_COLORS.length] },\n })),\n };\n}\n\n/** Build ECharts option for pie chart. */\nexport function buildPieOption(\n categories: string[],\n series: { name: string; values: number[] }[],\n hideLegend: boolean,\n) {\n const pieData = categories.map((cat, catIdx) => {\n let total = 0;\n for (const s of series) {\n total += s.values[catIdx] ?? 0;\n }\n return { name: cat, value: total };\n });\n\n return {\n tooltip: { trigger: 'item' as const },\n legend: { show: !hideLegend, bottom: 0, type: 'scroll' as const },\n series: [\n {\n type: 'pie' as const,\n radius: ['30%', '65%'],\n center: ['50%', '45%'],\n data: pieData.map((d, i) => ({\n ...d,\n itemStyle: { color: CHART_COLORS[i % CHART_COLORS.length] },\n })),\n emphasis: { itemStyle: { shadowBlur: 10, shadowOffsetX: 0, shadowColor: 'rgba(0,0,0,0.3)' } },\n label: { show: true, formatter: '{b}: {d}%' },\n },\n ],\n };\n}\n\n/** Build ECharts option for sunburst chart. */\nexport function buildSunburstOption(\n categories: string[],\n series: { name: string; values: number[] }[],\n) {\n const sunburstData = categories.map((cat, catIdx) => {\n const children = series\n .map((s, sIdx) => ({\n name: s.name,\n value: s.values[catIdx] ?? 0,\n itemStyle: { color: CHART_COLORS[(catIdx * series.length + sIdx) % CHART_COLORS.length] },\n }))\n .filter((child) => child.value > 0);\n\n return { name: cat, children };\n });\n\n return {\n tooltip: { trigger: 'item' as const },\n series: [\n {\n type: 'sunburst' as const,\n data: sunburstData,\n radius: ['15%', '80%'],\n label: { rotate: 'radial' as const, fontSize: 10 },\n itemStyle: { borderRadius: 4, borderWidth: 1 },\n emphasis: { focus: 'ancestor' as const },\n },\n ],\n };\n}\n"],"names":["CHART_COLORS"],"mappings":";;;AAUO,SAAS,cACd,MACA,SACA,SACA,YACqB;AACrB,QAAM,kCAAkB,IAAA;AAExB,aAAW,SAAS,MAAM;AACxB,UAAM,MAAM,MAAM,YAAY;AAC9B,UAAM,MAAM,MAAM,eAAe;AACjC,QAAI,CAAC,YAAY,IAAI,GAAG,GAAG;AACzB,kBAAY,IAAI,KAAK,oBAAI,IAAA,CAAK;AAAA,IAChC;AACA,UAAM,SAAS,YAAY,IAAI,GAAG;AAClC,WAAO,IAAI,MAAM,OAAO,IAAI,GAAG,KAAK,KAAK,MAAM,KAAK;AAAA,EACtD;AAEA,QAAM,mBAAmB,CAAC,GAAG,YAAY,QAAA,CAAS,EAC/C,IAAI,CAAC,CAAC,KAAK,MAAM,MAAM;AACtB,QAAI,QAAQ;AACZ,eAAW,KAAK,OAAO,OAAA,EAAU,UAAS;AAC1C,WAAO,EAAE,KAAK,QAAQ,MAAA;AAAA,EACxB,CAAC,EACA,KAAK,CAAC,GAAG,MAAM,EAAE,QAAQ,EAAE,KAAK;AAEnC,QAAM,gBAAgB,iBAAiB,MAAM,GAAG,OAAO;AACvD,QAAM,qBAAqB,iBAAiB,MAAM,OAAO;AAEzD,MAAI,cAAc,mBAAmB,SAAS,GAAG;AAC/C,UAAM,gCAAgB,IAAA;AACtB,eAAW,EAAE,OAAA,KAAY,oBAAoB;AAC3C,iBAA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