@antv/gpt-vis 0.6.1 → 1.0.0-beta.2
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 +185 -114
- package/README.zh-CN.md +187 -112
- package/dist/cjs/gpt-vis/index.d.ts +115 -0
- package/dist/cjs/gpt-vis/index.js +196 -0
- package/dist/cjs/index.d.ts +57 -13
- package/dist/cjs/index.js +85 -35
- package/dist/cjs/syntax/index.d.ts +2 -0
- package/dist/cjs/{Text/mini-charts/hooks → syntax}/index.js +9 -7
- package/dist/cjs/syntax/parser.d.ts +82 -0
- package/dist/cjs/syntax/parser.js +348 -0
- package/dist/cjs/types/index.d.ts +33 -2
- package/dist/cjs/types/index.js +0 -6
- package/dist/cjs/util/container.d.ts +5 -0
- package/dist/cjs/{utils/map/util.js → util/container.js} +18 -13
- package/dist/cjs/util/theme.d.ts +26 -0
- package/dist/cjs/{theme.js → util/theme.js} +70 -14
- package/dist/cjs/vis/area/index.d.ts +60 -0
- package/dist/cjs/vis/area/index.js +152 -0
- package/dist/cjs/vis/bar/index.d.ts +60 -0
- package/dist/cjs/vis/bar/index.js +123 -0
- package/dist/cjs/vis/boxplot/index.d.ts +59 -0
- package/dist/cjs/vis/boxplot/index.js +111 -0
- package/dist/cjs/vis/column/index.d.ts +60 -0
- package/dist/cjs/vis/column/index.js +122 -0
- package/dist/cjs/vis/dual-axes/index.d.ts +64 -0
- package/dist/cjs/vis/dual-axes/index.js +148 -0
- package/dist/cjs/vis/fishbone-diagram/index.d.ts +35 -0
- package/dist/cjs/vis/fishbone-diagram/index.js +183 -0
- package/dist/cjs/vis/flow-diagram/index.d.ts +27 -0
- package/dist/cjs/vis/flow-diagram/index.js +271 -0
- package/dist/cjs/vis/funnel/index.d.ts +54 -0
- package/dist/cjs/vis/funnel/index.js +190 -0
- package/dist/cjs/vis/histogram/index.d.ts +47 -0
- package/dist/cjs/vis/histogram/index.js +108 -0
- package/dist/cjs/vis/indented-tree/index.d.ts +40 -0
- package/dist/cjs/vis/indented-tree/index.js +375 -0
- package/dist/cjs/vis/line/index.d.ts +59 -0
- package/dist/cjs/vis/line/index.js +105 -0
- package/dist/cjs/vis/liquid/index.d.ts +44 -0
- package/dist/cjs/vis/liquid/index.js +88 -0
- package/dist/cjs/vis/mindmap/index.d.ts +32 -0
- package/dist/cjs/vis/mindmap/index.js +214 -0
- package/dist/cjs/vis/network-graph/index.d.ts +59 -0
- package/dist/cjs/vis/network-graph/index.js +166 -0
- package/dist/cjs/vis/organization-chart/index.d.ts +64 -0
- package/dist/cjs/vis/organization-chart/index.js +191 -0
- package/dist/cjs/vis/pie/index.d.ts +55 -0
- package/dist/cjs/vis/pie/index.js +108 -0
- package/dist/cjs/vis/radar/index.d.ts +58 -0
- package/dist/cjs/vis/radar/index.js +153 -0
- package/dist/cjs/vis/sankey/index.d.ts +56 -0
- package/dist/cjs/vis/sankey/index.js +94 -0
- package/dist/cjs/vis/scatter/index.d.ts +54 -0
- package/dist/cjs/vis/scatter/index.js +95 -0
- package/dist/cjs/vis/summary/index.d.ts +41 -0
- package/dist/cjs/vis/summary/index.js +71 -0
- package/dist/cjs/vis/table/index.d.ts +50 -0
- package/dist/cjs/vis/table/index.js +209 -0
- package/dist/cjs/vis/treemap/index.d.ts +68 -0
- package/dist/cjs/vis/treemap/index.js +106 -0
- package/dist/cjs/vis/venn/index.d.ts +55 -0
- package/dist/cjs/vis/venn/index.js +115 -0
- package/dist/cjs/vis/violin/index.d.ts +59 -0
- package/dist/cjs/vis/violin/index.js +156 -0
- package/dist/cjs/vis/waterfall/index.d.ts +64 -0
- package/dist/cjs/vis/waterfall/index.js +195 -0
- package/dist/cjs/vis/word-cloud/index.d.ts +53 -0
- package/dist/cjs/vis/word-cloud/index.js +90 -0
- package/dist/cjs/vis-wrapper/icons.d.ts +8 -0
- package/dist/cjs/vis-wrapper/icons.js +63 -0
- package/dist/cjs/vis-wrapper/index.d.ts +25 -0
- package/dist/cjs/vis-wrapper/index.js +242 -0
- package/dist/cjs/vis-wrapper/styles.d.ts +8 -0
- package/dist/cjs/vis-wrapper/styles.js +221 -0
- package/dist/esm/gpt-vis/index.d.ts +115 -0
- package/dist/esm/gpt-vis/index.js +245 -0
- package/dist/esm/index.d.ts +57 -13
- package/dist/esm/index.js +28 -15
- package/dist/esm/syntax/index.d.ts +2 -0
- package/dist/esm/syntax/index.js +1 -0
- package/dist/esm/syntax/parser.d.ts +82 -0
- package/dist/esm/syntax/parser.js +559 -0
- package/dist/esm/types/index.d.ts +33 -2
- package/dist/esm/types/index.js +0 -1
- package/dist/esm/util/container.d.ts +5 -0
- package/dist/esm/util/container.js +20 -0
- package/dist/esm/util/theme.d.ts +26 -0
- package/dist/esm/util/theme.js +150 -0
- package/dist/esm/vis/area/index.d.ts +60 -0
- package/dist/esm/vis/area/index.js +231 -0
- package/dist/esm/vis/bar/index.d.ts +60 -0
- package/dist/esm/vis/bar/index.js +204 -0
- package/dist/esm/vis/boxplot/index.d.ts +59 -0
- package/dist/esm/vis/boxplot/index.js +177 -0
- package/dist/esm/vis/column/index.d.ts +60 -0
- package/dist/esm/vis/column/index.js +199 -0
- package/dist/esm/vis/dual-axes/index.d.ts +64 -0
- package/dist/esm/vis/dual-axes/index.js +235 -0
- package/dist/esm/vis/fishbone-diagram/index.d.ts +35 -0
- package/dist/esm/vis/fishbone-diagram/index.js +218 -0
- package/dist/esm/vis/flow-diagram/index.d.ts +27 -0
- package/dist/esm/vis/flow-diagram/index.js +342 -0
- package/dist/esm/vis/funnel/index.d.ts +54 -0
- package/dist/esm/vis/funnel/index.js +247 -0
- package/dist/esm/vis/histogram/index.d.ts +47 -0
- package/dist/esm/vis/histogram/index.js +147 -0
- package/dist/esm/vis/indented-tree/index.d.ts +40 -0
- package/dist/esm/vis/indented-tree/index.js +564 -0
- package/dist/esm/vis/line/index.d.ts +59 -0
- package/dist/esm/vis/line/index.js +173 -0
- package/dist/esm/vis/liquid/index.d.ts +44 -0
- package/dist/esm/vis/liquid/index.js +131 -0
- package/dist/esm/vis/mindmap/index.d.ts +32 -0
- package/dist/esm/vis/mindmap/index.js +315 -0
- package/dist/esm/vis/network-graph/index.d.ts +59 -0
- package/dist/esm/vis/network-graph/index.js +240 -0
- package/dist/esm/vis/organization-chart/index.d.ts +64 -0
- package/dist/esm/vis/organization-chart/index.js +269 -0
- package/dist/esm/vis/pie/index.d.ts +55 -0
- package/dist/esm/vis/pie/index.js +164 -0
- package/dist/esm/vis/radar/index.d.ts +58 -0
- package/dist/esm/vis/radar/index.js +238 -0
- package/dist/esm/vis/sankey/index.d.ts +56 -0
- package/dist/esm/vis/sankey/index.js +136 -0
- package/dist/esm/vis/scatter/index.d.ts +54 -0
- package/dist/esm/vis/scatter/index.js +159 -0
- package/dist/esm/vis/summary/index.d.ts +41 -0
- package/dist/esm/vis/summary/index.js +101 -0
- package/dist/esm/vis/table/index.d.ts +50 -0
- package/dist/esm/vis/table/index.js +167 -0
- package/dist/esm/vis/treemap/index.d.ts +68 -0
- package/dist/esm/vis/treemap/index.js +159 -0
- package/dist/esm/vis/venn/index.d.ts +55 -0
- package/dist/esm/vis/venn/index.js +167 -0
- package/dist/esm/vis/violin/index.d.ts +59 -0
- package/dist/esm/vis/violin/index.js +246 -0
- package/dist/esm/vis/waterfall/index.d.ts +64 -0
- package/dist/esm/vis/waterfall/index.js +263 -0
- package/dist/esm/vis/word-cloud/index.d.ts +53 -0
- package/dist/esm/vis/word-cloud/index.js +129 -0
- package/dist/esm/vis-wrapper/icons.d.ts +8 -0
- package/dist/esm/vis-wrapper/icons.js +29 -0
- package/dist/esm/vis-wrapper/index.d.ts +25 -0
- package/dist/esm/vis-wrapper/index.js +242 -0
- package/dist/esm/vis-wrapper/styles.d.ts +8 -0
- package/dist/esm/vis-wrapper/styles.js +21 -0
- package/dist/umd/index.min.js +1 -1
- package/package.json +18 -59
- package/README.ja-JP.md +0 -164
- package/dist/cjs/Area/index.d.ts +0 -11
- package/dist/cjs/Area/index.js +0 -105
- package/dist/cjs/Bar/index.d.ts +0 -14
- package/dist/cjs/Bar/index.js +0 -101
- package/dist/cjs/Boxplot/index.d.ts +0 -11
- package/dist/cjs/Boxplot/index.js +0 -88
- package/dist/cjs/ChartCodeRender/Loading.d.ts +0 -6
- package/dist/cjs/ChartCodeRender/Loading.js +0 -54
- package/dist/cjs/ChartCodeRender/VisChart.d.ts +0 -19
- package/dist/cjs/ChartCodeRender/VisChart.js +0 -338
- package/dist/cjs/ChartCodeRender/icon.d.ts +0 -10
- package/dist/cjs/ChartCodeRender/icon.js +0 -162
- package/dist/cjs/ChartCodeRender/index.d.ts +0 -8
- package/dist/cjs/ChartCodeRender/index.js +0 -113
- package/dist/cjs/ChartCodeRender/styles.d.ts +0 -19
- package/dist/cjs/ChartCodeRender/styles.js +0 -232
- package/dist/cjs/ChartCodeRender/type.d.ts +0 -176
- package/dist/cjs/ChartCodeRender/type.js +0 -17
- package/dist/cjs/ChartCodeRender/utils.d.ts +0 -1
- package/dist/cjs/ChartCodeRender/utils.js +0 -51
- package/dist/cjs/Column/index.d.ts +0 -14
- package/dist/cjs/Column/index.js +0 -102
- package/dist/cjs/ConfigProvider/context.d.ts +0 -3
- package/dist/cjs/ConfigProvider/context.js +0 -41
- package/dist/cjs/ConfigProvider/hooks/index.d.ts +0 -1
- package/dist/cjs/ConfigProvider/hooks/index.js +0 -23
- package/dist/cjs/ConfigProvider/hooks/useConfig.d.ts +0 -13
- package/dist/cjs/ConfigProvider/hooks/useConfig.js +0 -109
- package/dist/cjs/ConfigProvider/index.d.ts +0 -7
- package/dist/cjs/ConfigProvider/index.js +0 -43
- package/dist/cjs/DualAxes/index.d.ts +0 -20
- package/dist/cjs/DualAxes/index.js +0 -84
- package/dist/cjs/DualAxes/util.d.ts +0 -9
- package/dist/cjs/DualAxes/util.js +0 -77
- package/dist/cjs/FishboneDiagram/index.d.ts +0 -7
- package/dist/cjs/FishboneDiagram/index.js +0 -66
- package/dist/cjs/FlowDiagram/helper.d.ts +0 -7
- package/dist/cjs/FlowDiagram/helper.js +0 -83
- package/dist/cjs/FlowDiagram/index.d.ts +0 -6
- package/dist/cjs/FlowDiagram/index.js +0 -107
- package/dist/cjs/Funnel/index.d.ts +0 -12
- package/dist/cjs/Funnel/index.js +0 -173
- package/dist/cjs/GPTVis/Lite.d.ts +0 -19
- package/dist/cjs/GPTVis/Lite.js +0 -81
- package/dist/cjs/GPTVis/hooks/useContext.d.ts +0 -8
- package/dist/cjs/GPTVis/hooks/useContext.js +0 -49
- package/dist/cjs/GPTVis/hooks/useEvent.d.ts +0 -1
- package/dist/cjs/GPTVis/hooks/useEvent.js +0 -33
- package/dist/cjs/GPTVis/index.d.ts +0 -6
- package/dist/cjs/GPTVis/index.js +0 -42
- package/dist/cjs/HeatMap/index.d.ts +0 -12
- package/dist/cjs/HeatMap/index.js +0 -67
- package/dist/cjs/Histogram/index.d.ts +0 -8
- package/dist/cjs/Histogram/index.js +0 -79
- package/dist/cjs/IndentedTree/index.d.ts +0 -7
- package/dist/cjs/IndentedTree/index.js +0 -78
- package/dist/cjs/Line/index.d.ts +0 -11
- package/dist/cjs/Line/index.js +0 -94
- package/dist/cjs/Liquid/index.d.ts +0 -11
- package/dist/cjs/Liquid/index.js +0 -85
- package/dist/cjs/Map/Component/MapView.d.ts +0 -3
- package/dist/cjs/Map/Component/MapView.js +0 -40
- package/dist/cjs/Map/Component/Marker.d.ts +0 -3
- package/dist/cjs/Map/Component/Marker.js +0 -53
- package/dist/cjs/Map/Component/Polyline.d.ts +0 -3
- package/dist/cjs/Map/Component/Polyline.js +0 -50
- package/dist/cjs/Map/Component/index.d.ts +0 -4
- package/dist/cjs/Map/Component/index.js +0 -45
- package/dist/cjs/Map/data.json +0 -305
- package/dist/cjs/Map/index.d.ts +0 -5
- package/dist/cjs/Map/index.js +0 -61
- package/dist/cjs/MindMap/index.d.ts +0 -7
- package/dist/cjs/MindMap/index.js +0 -75
- package/dist/cjs/NetworkGraph/index.d.ts +0 -6
- package/dist/cjs/NetworkGraph/index.js +0 -75
- package/dist/cjs/OrganizationChart/index.d.ts +0 -6
- package/dist/cjs/OrganizationChart/index.js +0 -95
- package/dist/cjs/PathMap/index.d.ts +0 -6
- package/dist/cjs/PathMap/index.js +0 -58
- package/dist/cjs/Pie/index.d.ts +0 -23
- package/dist/cjs/Pie/index.js +0 -94
- package/dist/cjs/PinMap/index.d.ts +0 -6
- package/dist/cjs/PinMap/index.js +0 -44
- package/dist/cjs/PinMap/maker.svg +0 -1
- package/dist/cjs/Radar/index.d.ts +0 -13
- package/dist/cjs/Radar/index.js +0 -153
- package/dist/cjs/Sankey/index.d.ts +0 -14
- package/dist/cjs/Sankey/index.js +0 -110
- package/dist/cjs/Scatter/index.d.ts +0 -13
- package/dist/cjs/Scatter/index.js +0 -103
- package/dist/cjs/Spreadsheet/index.d.ts +0 -28
- package/dist/cjs/Spreadsheet/index.js +0 -113
- package/dist/cjs/Table/index.d.ts +0 -9
- package/dist/cjs/Table/index.js +0 -91
- package/dist/cjs/Text/VisText.d.ts +0 -4
- package/dist/cjs/Text/VisText.js +0 -82
- package/dist/cjs/Text/config.d.ts +0 -18
- package/dist/cjs/Text/config.js +0 -91
- package/dist/cjs/Text/custom-icons/index.d.ts +0 -3
- package/dist/cjs/Text/custom-icons/index.js +0 -66
- package/dist/cjs/Text/index.d.ts +0 -3
- package/dist/cjs/Text/index.js +0 -42
- package/dist/cjs/Text/mini-charts/hooks/getElementFontSize.d.ts +0 -1
- package/dist/cjs/Text/mini-charts/hooks/getElementFontSize.js +0 -65
- package/dist/cjs/Text/mini-charts/hooks/index.d.ts +0 -1
- package/dist/cjs/Text/mini-charts/hooks/useSvgWrapper.d.ts +0 -5
- package/dist/cjs/Text/mini-charts/hooks/useSvgWrapper.js +0 -65
- package/dist/cjs/Text/mini-charts/index.d.ts +0 -2
- package/dist/cjs/Text/mini-charts/index.js +0 -25
- package/dist/cjs/Text/mini-charts/line/SingleLineChart.d.ts +0 -3
- package/dist/cjs/Text/mini-charts/line/SingleLineChart.js +0 -63
- package/dist/cjs/Text/mini-charts/line/index.d.ts +0 -1
- package/dist/cjs/Text/mini-charts/line/index.js +0 -29
- package/dist/cjs/Text/mini-charts/line/scaleLinear.d.ts +0 -4
- package/dist/cjs/Text/mini-charts/line/scaleLinear.js +0 -35
- package/dist/cjs/Text/mini-charts/line/useLineCompute.d.ts +0 -6
- package/dist/cjs/Text/mini-charts/line/useLineCompute.js +0 -103
- package/dist/cjs/Text/mini-charts/proportion/getArcPath.d.ts +0 -1
- package/dist/cjs/Text/mini-charts/proportion/getArcPath.js +0 -51
- package/dist/cjs/Text/mini-charts/proportion/index.d.ts +0 -3
- package/dist/cjs/Text/mini-charts/proportion/index.js +0 -71
- package/dist/cjs/Text/theme.d.ts +0 -24
- package/dist/cjs/Text/theme.js +0 -52
- package/dist/cjs/Text/types.d.ts +0 -20
- package/dist/cjs/Text/types.js +0 -17
- package/dist/cjs/Text/utils/getThemeColor.d.ts +0 -11
- package/dist/cjs/Text/utils/getThemeColor.js +0 -46
- package/dist/cjs/Text/utils/index.d.ts +0 -2
- package/dist/cjs/Text/utils/index.js +0 -25
- package/dist/cjs/Text/utils/useAntdDarkAlgorithm.d.ts +0 -2
- package/dist/cjs/Text/utils/useAntdDarkAlgorithm.js +0 -40
- package/dist/cjs/Treemap/index.d.ts +0 -10
- package/dist/cjs/Treemap/index.js +0 -93
- package/dist/cjs/Venn/index.d.ts +0 -32
- package/dist/cjs/Venn/index.js +0 -87
- package/dist/cjs/Violin/index.d.ts +0 -10
- package/dist/cjs/Violin/index.js +0 -190
- package/dist/cjs/Waterfall/index.d.ts +0 -25
- package/dist/cjs/Waterfall/index.js +0 -184
- package/dist/cjs/WordCloud/index.d.ts +0 -9
- package/dist/cjs/WordCloud/index.js +0 -76
- package/dist/cjs/constants/index.d.ts +0 -2
- package/dist/cjs/constants/index.js +0 -35
- package/dist/cjs/export-map.browser.d.ts +0 -4
- package/dist/cjs/export-map.browser.js +0 -48
- package/dist/cjs/export-map.d.ts +0 -10
- package/dist/cjs/export-map.js +0 -41
- package/dist/cjs/export.d.ts +0 -76
- package/dist/cjs/export.js +0 -159
- package/dist/cjs/render.d.ts +0 -2
- package/dist/cjs/render.js +0 -67
- package/dist/cjs/theme.d.ts +0 -2
- package/dist/cjs/types/chart.d.ts +0 -88
- package/dist/cjs/types/chart.js +0 -61
- package/dist/cjs/types/config.d.ts +0 -25
- package/dist/cjs/types/config.js +0 -17
- package/dist/cjs/types/map.d.ts +0 -242
- package/dist/cjs/types/map.js +0 -17
- package/dist/cjs/utils/config.d.ts +0 -5
- package/dist/cjs/utils/config.js +0 -76
- package/dist/cjs/utils/graph.d.ts +0 -18
- package/dist/cjs/utils/graph.js +0 -64
- package/dist/cjs/utils/index.d.ts +0 -1
- package/dist/cjs/utils/index.js +0 -23
- package/dist/cjs/utils/map/context.d.ts +0 -3
- package/dist/cjs/utils/map/context.js +0 -45
- package/dist/cjs/utils/map/controls.d.ts +0 -0
- package/dist/cjs/utils/map/controls.js +0 -0
- package/dist/cjs/utils/map/index.d.ts +0 -6
- package/dist/cjs/utils/map/index.js +0 -33
- package/dist/cjs/utils/map/markers.d.ts +0 -2
- package/dist/cjs/utils/map/markers.js +0 -88
- package/dist/cjs/utils/map/polyline.d.ts +0 -2
- package/dist/cjs/utils/map/polyline.js +0 -52
- package/dist/cjs/utils/map/style.d.ts +0 -45
- package/dist/cjs/utils/map/style.js +0 -112
- package/dist/cjs/utils/map/util.d.ts +0 -1
- package/dist/cjs/utils/map/view.d.ts +0 -5
- package/dist/cjs/utils/map/view.js +0 -100
- package/dist/cjs/utils/palette.d.ts +0 -2
- package/dist/cjs/utils/palette.js +0 -54
- package/dist/cjs/utils/plot.d.ts +0 -5
- package/dist/cjs/utils/plot.js +0 -90
- package/dist/cjs/version.d.ts +0 -2
- package/dist/cjs/version.js +0 -25
- package/dist/esm/Area/index.d.ts +0 -11
- package/dist/esm/Area/index.js +0 -108
- package/dist/esm/Bar/index.d.ts +0 -14
- package/dist/esm/Bar/index.js +0 -92
- package/dist/esm/Boxplot/index.d.ts +0 -11
- package/dist/esm/Boxplot/index.js +0 -86
- package/dist/esm/ChartCodeRender/Loading.d.ts +0 -6
- package/dist/esm/ChartCodeRender/Loading.js +0 -21
- package/dist/esm/ChartCodeRender/VisChart.d.ts +0 -19
- package/dist/esm/ChartCodeRender/VisChart.js +0 -450
- package/dist/esm/ChartCodeRender/icon.d.ts +0 -10
- package/dist/esm/ChartCodeRender/icon.js +0 -103
- package/dist/esm/ChartCodeRender/index.d.ts +0 -8
- package/dist/esm/ChartCodeRender/index.js +0 -99
- package/dist/esm/ChartCodeRender/styles.d.ts +0 -19
- package/dist/esm/ChartCodeRender/styles.js +0 -61
- package/dist/esm/ChartCodeRender/type.d.ts +0 -176
- package/dist/esm/ChartCodeRender/type.js +0 -1
- package/dist/esm/ChartCodeRender/utils.d.ts +0 -1
- package/dist/esm/ChartCodeRender/utils.js +0 -37
- package/dist/esm/Column/index.d.ts +0 -14
- package/dist/esm/Column/index.js +0 -93
- package/dist/esm/ConfigProvider/context.d.ts +0 -3
- package/dist/esm/ConfigProvider/context.js +0 -3
- package/dist/esm/ConfigProvider/hooks/index.d.ts +0 -1
- package/dist/esm/ConfigProvider/hooks/index.js +0 -1
- package/dist/esm/ConfigProvider/hooks/useConfig.d.ts +0 -13
- package/dist/esm/ConfigProvider/hooks/useConfig.js +0 -71
- package/dist/esm/ConfigProvider/index.d.ts +0 -7
- package/dist/esm/ConfigProvider/index.js +0 -17
- package/dist/esm/DualAxes/index.d.ts +0 -20
- package/dist/esm/DualAxes/index.js +0 -77
- package/dist/esm/DualAxes/util.d.ts +0 -9
- package/dist/esm/DualAxes/util.js +0 -77
- package/dist/esm/FishboneDiagram/index.d.ts +0 -7
- package/dist/esm/FishboneDiagram/index.js +0 -43
- package/dist/esm/FlowDiagram/helper.d.ts +0 -7
- package/dist/esm/FlowDiagram/helper.js +0 -76
- package/dist/esm/FlowDiagram/index.d.ts +0 -6
- package/dist/esm/FlowDiagram/index.js +0 -72
- package/dist/esm/Funnel/index.d.ts +0 -12
- package/dist/esm/Funnel/index.js +0 -171
- package/dist/esm/GPTVis/Lite.d.ts +0 -19
- package/dist/esm/GPTVis/Lite.js +0 -57
- package/dist/esm/GPTVis/hooks/useContext.d.ts +0 -8
- package/dist/esm/GPTVis/hooks/useContext.js +0 -9
- package/dist/esm/GPTVis/hooks/useEvent.d.ts +0 -1
- package/dist/esm/GPTVis/hooks/useEvent.js +0 -6
- package/dist/esm/GPTVis/index.d.ts +0 -6
- package/dist/esm/GPTVis/index.js +0 -25
- package/dist/esm/HeatMap/index.d.ts +0 -12
- package/dist/esm/HeatMap/index.js +0 -45
- package/dist/esm/Histogram/index.d.ts +0 -8
- package/dist/esm/Histogram/index.js +0 -75
- package/dist/esm/IndentedTree/index.d.ts +0 -7
- package/dist/esm/IndentedTree/index.js +0 -68
- package/dist/esm/Line/index.d.ts +0 -11
- package/dist/esm/Line/index.js +0 -92
- package/dist/esm/Liquid/index.d.ts +0 -11
- package/dist/esm/Liquid/index.js +0 -100
- package/dist/esm/Map/Component/MapView.d.ts +0 -3
- package/dist/esm/Map/Component/MapView.js +0 -18
- package/dist/esm/Map/Component/Marker.d.ts +0 -3
- package/dist/esm/Map/Component/Marker.js +0 -40
- package/dist/esm/Map/Component/Polyline.d.ts +0 -3
- package/dist/esm/Map/Component/Polyline.js +0 -35
- package/dist/esm/Map/Component/index.d.ts +0 -4
- package/dist/esm/Map/Component/index.js +0 -4
- package/dist/esm/Map/data.json +0 -305
- package/dist/esm/Map/index.d.ts +0 -5
- package/dist/esm/Map/index.js +0 -50
- package/dist/esm/MindMap/index.d.ts +0 -7
- package/dist/esm/MindMap/index.js +0 -69
- package/dist/esm/NetworkGraph/index.d.ts +0 -6
- package/dist/esm/NetworkGraph/index.js +0 -64
- package/dist/esm/OrganizationChart/index.d.ts +0 -6
- package/dist/esm/OrganizationChart/index.js +0 -75
- package/dist/esm/PathMap/index.d.ts +0 -6
- package/dist/esm/PathMap/index.js +0 -41
- package/dist/esm/Pie/index.d.ts +0 -23
- package/dist/esm/Pie/index.js +0 -96
- package/dist/esm/PinMap/index.d.ts +0 -6
- package/dist/esm/PinMap/index.js +0 -22
- package/dist/esm/PinMap/maker.svg +0 -1
- package/dist/esm/Radar/index.d.ts +0 -13
- package/dist/esm/Radar/index.js +0 -150
- package/dist/esm/Sankey/index.d.ts +0 -14
- package/dist/esm/Sankey/index.js +0 -98
- package/dist/esm/Scatter/index.d.ts +0 -13
- package/dist/esm/Scatter/index.js +0 -95
- package/dist/esm/Spreadsheet/index.d.ts +0 -28
- package/dist/esm/Spreadsheet/index.js +0 -129
- package/dist/esm/Table/index.d.ts +0 -9
- package/dist/esm/Table/index.js +0 -30
- package/dist/esm/Text/VisText.d.ts +0 -4
- package/dist/esm/Text/VisText.js +0 -55
- package/dist/esm/Text/config.d.ts +0 -18
- package/dist/esm/Text/config.js +0 -82
- package/dist/esm/Text/custom-icons/index.d.ts +0 -3
- package/dist/esm/Text/custom-icons/index.js +0 -37
- package/dist/esm/Text/index.d.ts +0 -3
- package/dist/esm/Text/index.js +0 -2
- package/dist/esm/Text/mini-charts/hooks/getElementFontSize.d.ts +0 -1
- package/dist/esm/Text/mini-charts/hooks/getElementFontSize.js +0 -32
- package/dist/esm/Text/mini-charts/hooks/index.d.ts +0 -1
- package/dist/esm/Text/mini-charts/hooks/index.js +0 -1
- package/dist/esm/Text/mini-charts/hooks/useSvgWrapper.d.ts +0 -5
- package/dist/esm/Text/mini-charts/hooks/useSvgWrapper.js +0 -37
- package/dist/esm/Text/mini-charts/index.d.ts +0 -2
- package/dist/esm/Text/mini-charts/index.js +0 -2
- package/dist/esm/Text/mini-charts/line/SingleLineChart.d.ts +0 -3
- package/dist/esm/Text/mini-charts/line/SingleLineChart.js +0 -62
- package/dist/esm/Text/mini-charts/line/index.d.ts +0 -1
- package/dist/esm/Text/mini-charts/line/index.js +0 -1
- package/dist/esm/Text/mini-charts/line/scaleLinear.d.ts +0 -4
- package/dist/esm/Text/mini-charts/line/scaleLinear.js +0 -19
- package/dist/esm/Text/mini-charts/line/useLineCompute.d.ts +0 -6
- package/dist/esm/Text/mini-charts/line/useLineCompute.js +0 -118
- package/dist/esm/Text/mini-charts/proportion/getArcPath.d.ts +0 -1
- package/dist/esm/Text/mini-charts/proportion/getArcPath.js +0 -19
- package/dist/esm/Text/mini-charts/proportion/index.d.ts +0 -3
- package/dist/esm/Text/mini-charts/proportion/index.js +0 -64
- package/dist/esm/Text/theme.d.ts +0 -24
- package/dist/esm/Text/theme.js +0 -24
- package/dist/esm/Text/types.d.ts +0 -20
- package/dist/esm/Text/types.js +0 -1
- package/dist/esm/Text/utils/getThemeColor.d.ts +0 -11
- package/dist/esm/Text/utils/getThemeColor.js +0 -29
- package/dist/esm/Text/utils/index.d.ts +0 -2
- package/dist/esm/Text/utils/index.js +0 -2
- package/dist/esm/Text/utils/useAntdDarkAlgorithm.d.ts +0 -2
- package/dist/esm/Text/utils/useAntdDarkAlgorithm.js +0 -14
- package/dist/esm/Treemap/index.d.ts +0 -10
- package/dist/esm/Treemap/index.js +0 -88
- package/dist/esm/Venn/index.d.ts +0 -32
- package/dist/esm/Venn/index.js +0 -69
- package/dist/esm/Violin/index.d.ts +0 -10
- package/dist/esm/Violin/index.js +0 -199
- package/dist/esm/Waterfall/index.d.ts +0 -25
- package/dist/esm/Waterfall/index.js +0 -185
- package/dist/esm/WordCloud/index.d.ts +0 -9
- package/dist/esm/WordCloud/index.js +0 -59
- package/dist/esm/constants/index.d.ts +0 -2
- package/dist/esm/constants/index.js +0 -9
- package/dist/esm/export-map.browser.d.ts +0 -4
- package/dist/esm/export-map.browser.js +0 -5
- package/dist/esm/export-map.d.ts +0 -10
- package/dist/esm/export-map.js +0 -9
- package/dist/esm/export.d.ts +0 -76
- package/dist/esm/export.js +0 -51
- package/dist/esm/render.d.ts +0 -2
- package/dist/esm/render.js +0 -32
- package/dist/esm/theme.d.ts +0 -2
- package/dist/esm/theme.js +0 -103
- package/dist/esm/types/chart.d.ts +0 -88
- package/dist/esm/types/chart.js +0 -33
- package/dist/esm/types/config.d.ts +0 -25
- package/dist/esm/types/config.js +0 -1
- package/dist/esm/types/map.d.ts +0 -242
- package/dist/esm/types/map.js +0 -1
- package/dist/esm/utils/config.d.ts +0 -5
- package/dist/esm/utils/config.js +0 -53
- package/dist/esm/utils/graph.d.ts +0 -18
- package/dist/esm/utils/graph.js +0 -55
- package/dist/esm/utils/index.d.ts +0 -1
- package/dist/esm/utils/index.js +0 -1
- package/dist/esm/utils/map/context.d.ts +0 -3
- package/dist/esm/utils/map/context.js +0 -42
- package/dist/esm/utils/map/controls.d.ts +0 -0
- package/dist/esm/utils/map/controls.js +0 -0
- package/dist/esm/utils/map/index.d.ts +0 -6
- package/dist/esm/utils/map/index.js +0 -6
- package/dist/esm/utils/map/markers.d.ts +0 -2
- package/dist/esm/utils/map/markers.js +0 -69
- package/dist/esm/utils/map/polyline.d.ts +0 -2
- package/dist/esm/utils/map/polyline.js +0 -31
- package/dist/esm/utils/map/style.d.ts +0 -45
- package/dist/esm/utils/map/style.js +0 -80
- package/dist/esm/utils/map/util.d.ts +0 -1
- package/dist/esm/utils/map/util.js +0 -11
- package/dist/esm/utils/map/view.d.ts +0 -5
- package/dist/esm/utils/map/view.js +0 -83
- package/dist/esm/utils/palette.d.ts +0 -2
- package/dist/esm/utils/palette.js +0 -2
- package/dist/esm/utils/plot.d.ts +0 -5
- package/dist/esm/utils/plot.js +0 -86
- package/dist/esm/version.d.ts +0 -2
- package/dist/esm/version.js +0 -1
- package/dist/umd/376.async.js +0 -1
- package/dist/umd/index.min.css +0 -1
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { Text } from '@antv/t8';
|
|
2
|
+
import { getBackgroundColor } from "../../util/theme";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* SummaryConfig is a T8 Syntax string for narrative text visualization.
|
|
6
|
+
* Supports markdown-like syntax with special annotations for metrics.
|
|
7
|
+
* @example
|
|
8
|
+
* ```
|
|
9
|
+
* # Sales Report
|
|
10
|
+
* Total sales reached [¥1,234,567](metric_value, origin=1234567).
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* SummaryInstance represents a summary instance with render and destroy methods.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Summary component using @antv/t8 for narrative text visualization.
|
|
20
|
+
*
|
|
21
|
+
* This component provides a way to render data summaries with rich text formatting
|
|
22
|
+
* and inline data visualization using T8 syntax (markdown-like syntax).
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* const summary = Summary({
|
|
27
|
+
* container: '#container',
|
|
28
|
+
* theme: 'light',
|
|
29
|
+
* });
|
|
30
|
+
*
|
|
31
|
+
* summary.render(`
|
|
32
|
+
* # Sales Report
|
|
33
|
+
* Total sales reached [¥1,234,567](metric_value, origin=1234567).
|
|
34
|
+
* This represents a [15%](delta_value, status=increase) increase compared to last quarter.
|
|
35
|
+
* `);
|
|
36
|
+
*
|
|
37
|
+
* summary.destroy();
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export var Summary = function Summary(options) {
|
|
41
|
+
// T8 only supports 'light' and 'dark', so map 'academy'/'default' to 'light'
|
|
42
|
+
var _options$theme = options.theme,
|
|
43
|
+
theme = _options$theme === void 0 ? 'light' : _options$theme;
|
|
44
|
+
if (theme === 'academy' || theme === 'default') theme = 'light';
|
|
45
|
+
var container = typeof options.container === 'string' ? document.querySelector(options.container) : options.container;
|
|
46
|
+
if (!container) {
|
|
47
|
+
throw new Error('Container not found');
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Create a wrapper element for padding and theme background
|
|
51
|
+
var wrapper = document.createElement('div');
|
|
52
|
+
wrapper.className = 'gpt-vis-summary';
|
|
53
|
+
container.appendChild(wrapper);
|
|
54
|
+
var text = null;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Render the summary with the given T8 syntax string.
|
|
58
|
+
* Supports an optional `theme <value>` line in the syntax to override the theme.
|
|
59
|
+
*/
|
|
60
|
+
var render = function render(syntax) {
|
|
61
|
+
// Clean up previous instance if exists
|
|
62
|
+
if (text) {
|
|
63
|
+
text.unmount();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Extract optional `theme <value>` line from syntax
|
|
67
|
+
var activeTheme = theme;
|
|
68
|
+
var cleanedSyntax = syntax.replace(/^theme\s+(light|dark)\s*$/im, function (_, t) {
|
|
69
|
+
activeTheme = t;
|
|
70
|
+
return '';
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
// Create T8 Text instance
|
|
74
|
+
text = new Text(wrapper);
|
|
75
|
+
|
|
76
|
+
// Set background color and padding on the wrapper
|
|
77
|
+
wrapper.style.backgroundColor = activeTheme === 'dark' ? getBackgroundColor('dark') : '';
|
|
78
|
+
wrapper.style.padding = '16px';
|
|
79
|
+
|
|
80
|
+
// Set theme and render syntax
|
|
81
|
+
text.theme(activeTheme);
|
|
82
|
+
text.render(cleanedSyntax.trim());
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Destroy the summary instance and clean up resources.
|
|
87
|
+
*/
|
|
88
|
+
var destroy = function destroy() {
|
|
89
|
+
if (text) {
|
|
90
|
+
text.unmount();
|
|
91
|
+
text = null;
|
|
92
|
+
}
|
|
93
|
+
if (wrapper.parentNode) {
|
|
94
|
+
wrapper.parentNode.removeChild(wrapper);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
return {
|
|
98
|
+
render: render,
|
|
99
|
+
destroy: destroy
|
|
100
|
+
};
|
|
101
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { VisualizationOptions } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* TableConfig defines the configuration for rendering the table.
|
|
4
|
+
*/
|
|
5
|
+
export interface TableConfig {
|
|
6
|
+
type?: 'table';
|
|
7
|
+
data: Record<string, any>[];
|
|
8
|
+
title?: string;
|
|
9
|
+
theme?: 'default' | 'dark';
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* TableInstance represents a table instance with render and destroy methods.
|
|
13
|
+
*/
|
|
14
|
+
export interface TableInstance {
|
|
15
|
+
render: (config: TableConfig) => void;
|
|
16
|
+
destroy: () => void;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Calculate the minimum width needed for a table based on its data.
|
|
20
|
+
* This is a pure function that measures text width and returns the calculated min-width.
|
|
21
|
+
*
|
|
22
|
+
* @param data - Table data array
|
|
23
|
+
* @param columns - Column names array
|
|
24
|
+
* @returns Calculated minimum width in pixels
|
|
25
|
+
*/
|
|
26
|
+
export declare const calculateTableMinWidth: (data: Record<string, any>[], columns: string[]) => number;
|
|
27
|
+
/**
|
|
28
|
+
* Table component using pure JavaScript.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* const table = Table({
|
|
33
|
+
* container: '#container',
|
|
34
|
+
* width: 600,
|
|
35
|
+
* height: 400,
|
|
36
|
+
* });
|
|
37
|
+
*
|
|
38
|
+
* table.render({
|
|
39
|
+
* type: 'table',
|
|
40
|
+
* data: [
|
|
41
|
+
* { "Indicator": "经度(°)", "Mean": "104.15°", "Std": "±0.64°" },
|
|
42
|
+
* { "Indicator": "纬度(°)", "Mean": "31.60°", "Std": "±0.48°" },
|
|
43
|
+
* ],
|
|
44
|
+
* title: '一个文本标题',
|
|
45
|
+
* });
|
|
46
|
+
*
|
|
47
|
+
* table.destroy();
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export declare const Table: (options: VisualizationOptions) => TableInstance;
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { measureText } from 'measury';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* TableConfig defines the configuration for rendering the table.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* TableInstance represents a table instance with render and destroy methods.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
var SCOPE_ID = '__gpt-vis-table__';
|
|
12
|
+
var FONT_FAMILY = '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif';
|
|
13
|
+
var CELL_PADDING = 16; // 8px * 2
|
|
14
|
+
var MIN_WIDTH_MULTIPLIER = 1.1;
|
|
15
|
+
|
|
16
|
+
// CSS styles for the table component
|
|
17
|
+
var TABLE_STYLES = "\n .".concat(SCOPE_ID, " {\n font-family: ").concat(FONT_FAMILY, ";\n overflow: auto;\n height: 100%;\n padding: 16px;\n }\n\n .").concat(SCOPE_ID, " .table-title {\n font-size: 16px;\n font-weight: 500;\n margin-bottom: 12px;\n color: #1d2129;\n }\n\n .").concat(SCOPE_ID, " table {\n border-collapse: separate;\n border-spacing: 0;\n background: #fff;\n border-radius: 8px;\n overflow: hidden;\n }\n\n .").concat(SCOPE_ID, " th,\n .").concat(SCOPE_ID, " td {\n border-bottom: 1px solid #f0f0f0;\n padding: 8px;\n text-align: left;\n font-size: 14px;\n color: #333;\n white-space: nowrap;\n }\n\n .").concat(SCOPE_ID, " th {\n background: #f5f5f5;\n font-weight: 600;\n color: #000000e0;\n position: relative;\n }\n\n .").concat(SCOPE_ID, " th:not(:last-child)::after {\n content: '';\n position: absolute;\n top: 25%;\n right: 0;\n width: 1px;\n height: 50%;\n background: #e0e0e0;\n }\n\n .").concat(SCOPE_ID, " tr {\n transition: background 0.2s;\n }\n\n .").concat(SCOPE_ID, " tbody tr:hover {\n background: #f5f5f5;\n cursor: pointer;\n }\n\n .").concat(SCOPE_ID, "[data-theme=\"dark\"] {\n background: #000;\n }\n\n .").concat(SCOPE_ID, "[data-theme=\"dark\"] .table-title {\n color: #ffffffd9;\n }\n\n .").concat(SCOPE_ID, "[data-theme=\"dark\"] table {\n background: #141414;\n }\n\n .").concat(SCOPE_ID, "[data-theme=\"dark\"] th,\n .").concat(SCOPE_ID, "[data-theme=\"dark\"] td {\n border-bottom: 1px solid #303030;\n color: #ffffffd9;\n }\n\n .").concat(SCOPE_ID, "[data-theme=\"dark\"] th {\n background: #1f1f1f;\n color: #ffffffa6;\n }\n\n .").concat(SCOPE_ID, "[data-theme=\"dark\"] th:not(:last-child)::after {\n background: #303030;\n }\n\n .").concat(SCOPE_ID, "[data-theme=\"dark\"] tbody tr:hover {\n background: #1f1f1f;\n }\n");
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Calculate the minimum width needed for a table based on its data.
|
|
21
|
+
* This is a pure function that measures text width and returns the calculated min-width.
|
|
22
|
+
*
|
|
23
|
+
* @param data - Table data array
|
|
24
|
+
* @param columns - Column names array
|
|
25
|
+
* @returns Calculated minimum width in pixels
|
|
26
|
+
*/
|
|
27
|
+
export var calculateTableMinWidth = function calculateTableMinWidth(data, columns) {
|
|
28
|
+
var maxRowWidth = 0;
|
|
29
|
+
|
|
30
|
+
// Measure header row
|
|
31
|
+
var headerWidth = columns.reduce(function (total, col) {
|
|
32
|
+
var metrics = measureText(String(col), {
|
|
33
|
+
fontFamily: FONT_FAMILY,
|
|
34
|
+
fontSize: 14,
|
|
35
|
+
fontWeight: '600'
|
|
36
|
+
});
|
|
37
|
+
return total + metrics.width + CELL_PADDING;
|
|
38
|
+
}, 0);
|
|
39
|
+
maxRowWidth = Math.max(maxRowWidth, headerWidth);
|
|
40
|
+
|
|
41
|
+
// Measure each data row
|
|
42
|
+
data.forEach(function (row) {
|
|
43
|
+
var rowText = columns.map(function (col) {
|
|
44
|
+
return String(row[col] != null ? row[col] : '');
|
|
45
|
+
}).join('');
|
|
46
|
+
var metrics = measureText(rowText, {
|
|
47
|
+
fontFamily: FONT_FAMILY,
|
|
48
|
+
fontSize: 14
|
|
49
|
+
});
|
|
50
|
+
var rowWidth = metrics.width + columns.length * CELL_PADDING;
|
|
51
|
+
maxRowWidth = Math.max(maxRowWidth, rowWidth);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// Return min-width with 110% multiplier for optimal spacing
|
|
55
|
+
return maxRowWidth * MIN_WIDTH_MULTIPLIER;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// Inject CSS into the document head if not already present
|
|
59
|
+
var injectStyles = function injectStyles() {
|
|
60
|
+
if (document.querySelector("style[data-scope=\"".concat(SCOPE_ID, "\"]"))) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
var styleElement = document.createElement('style');
|
|
64
|
+
styleElement.setAttribute('data-scope', SCOPE_ID);
|
|
65
|
+
styleElement.textContent = TABLE_STYLES;
|
|
66
|
+
document.head.appendChild(styleElement);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Table component using pure JavaScript.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```ts
|
|
74
|
+
* const table = Table({
|
|
75
|
+
* container: '#container',
|
|
76
|
+
* width: 600,
|
|
77
|
+
* height: 400,
|
|
78
|
+
* });
|
|
79
|
+
*
|
|
80
|
+
* table.render({
|
|
81
|
+
* type: 'table',
|
|
82
|
+
* data: [
|
|
83
|
+
* { "Indicator": "经度(°)", "Mean": "104.15°", "Std": "±0.64°" },
|
|
84
|
+
* { "Indicator": "纬度(°)", "Mean": "31.60°", "Std": "±0.48°" },
|
|
85
|
+
* ],
|
|
86
|
+
* title: '一个文本标题',
|
|
87
|
+
* });
|
|
88
|
+
*
|
|
89
|
+
* table.destroy();
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
export var Table = function Table(options) {
|
|
93
|
+
var _options$theme = options.theme,
|
|
94
|
+
chartTheme = _options$theme === void 0 ? 'default' : _options$theme;
|
|
95
|
+
var container = typeof options.container === 'string' ? document.querySelector(options.container) : options.container;
|
|
96
|
+
if (!container) {
|
|
97
|
+
throw new Error('Container not found');
|
|
98
|
+
}
|
|
99
|
+
var tableWrapper = null;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Render the table with the given configuration.
|
|
103
|
+
*/
|
|
104
|
+
var render = function render(config) {
|
|
105
|
+
var _config$data = config.data,
|
|
106
|
+
data = _config$data === void 0 ? [] : _config$data,
|
|
107
|
+
title = config.title,
|
|
108
|
+
_config$theme = config.theme,
|
|
109
|
+
theme = _config$theme === void 0 ? chartTheme : _config$theme;
|
|
110
|
+
|
|
111
|
+
// Inject styles if not already present
|
|
112
|
+
injectStyles();
|
|
113
|
+
|
|
114
|
+
// Clean up previous render
|
|
115
|
+
if (tableWrapper) {
|
|
116
|
+
tableWrapper.remove();
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// Create wrapper element
|
|
120
|
+
tableWrapper = document.createElement('div');
|
|
121
|
+
tableWrapper.className = SCOPE_ID;
|
|
122
|
+
if (theme === 'dark') {
|
|
123
|
+
tableWrapper.setAttribute('data-theme', 'dark');
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Handle empty data case
|
|
127
|
+
if (data.length === 0) {
|
|
128
|
+
tableWrapper.innerHTML = "\n ".concat(title ? "<div class=\"table-title\">".concat(title, "</div>") : '', "\n <div style=\"padding: 20px; text-align: center; color: #999;\">No data available</div>\n ");
|
|
129
|
+
container.appendChild(tableWrapper);
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// Get columns from the first data item
|
|
134
|
+
var columns = Object.keys(data[0]);
|
|
135
|
+
|
|
136
|
+
// Calculate the minimum width needed for the table using pure function
|
|
137
|
+
var minWidth = calculateTableMinWidth(data, columns);
|
|
138
|
+
// Ensure a minimum width for columns
|
|
139
|
+
minWidth = Math.max(minWidth, columns.length * 100);
|
|
140
|
+
|
|
141
|
+
// Build table HTML using template strings
|
|
142
|
+
var headerHTML = columns.map(function (col) {
|
|
143
|
+
return "<th>".concat(col, "</th>");
|
|
144
|
+
}).join('');
|
|
145
|
+
var bodyHTML = data.map(function (row) {
|
|
146
|
+
return "<tr>".concat(columns.map(function (col) {
|
|
147
|
+
return "<td>".concat(row[col] != null ? row[col] : '', "</td>");
|
|
148
|
+
}).join(''), "</tr>");
|
|
149
|
+
}).join('');
|
|
150
|
+
tableWrapper.innerHTML = "\n ".concat(title ? "<div class=\"table-title\">".concat(title, "</div>") : '', "\n <table style=\"min-width: ").concat(minWidth, "px;\">\n <thead><tr>").concat(headerHTML, "</tr></thead>\n <tbody>").concat(bodyHTML, "</tbody>\n </table>\n ");
|
|
151
|
+
container.appendChild(tableWrapper);
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Destroy the table instance and clean up resources.
|
|
156
|
+
*/
|
|
157
|
+
var destroy = function destroy() {
|
|
158
|
+
if (tableWrapper) {
|
|
159
|
+
tableWrapper.remove();
|
|
160
|
+
tableWrapper = null;
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
return {
|
|
164
|
+
render: render,
|
|
165
|
+
destroy: destroy
|
|
166
|
+
};
|
|
167
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { VisualizationOptions } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* TreemapDataItem is the type for each data item in the treemap chart.
|
|
4
|
+
*/
|
|
5
|
+
export type TreemapDataItem = {
|
|
6
|
+
name: string;
|
|
7
|
+
value: number;
|
|
8
|
+
children?: TreemapDataItem[];
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* TreemapConfig defines the configuration for rendering the treemap chart.
|
|
12
|
+
*/
|
|
13
|
+
export interface TreemapConfig {
|
|
14
|
+
type?: 'treemap';
|
|
15
|
+
data: TreemapDataItem[];
|
|
16
|
+
theme?: 'default' | 'academy' | 'dark';
|
|
17
|
+
title?: string;
|
|
18
|
+
style?: {
|
|
19
|
+
backgroundColor?: string;
|
|
20
|
+
palette?: string[];
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* TreemapInstance represents a treemap chart instance with render and destroy methods.
|
|
25
|
+
*/
|
|
26
|
+
export interface TreemapInstance {
|
|
27
|
+
render: (config: TreemapConfig) => void;
|
|
28
|
+
destroy: () => void;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Treemap chart component using G2 5.0.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* const treemap = Treemap({
|
|
36
|
+
* container: '#container',
|
|
37
|
+
* width: 600,
|
|
38
|
+
* height: 400,
|
|
39
|
+
* });
|
|
40
|
+
*
|
|
41
|
+
* treemap.render({
|
|
42
|
+
* type: 'treemap',
|
|
43
|
+
* data: [
|
|
44
|
+
* {
|
|
45
|
+
* name: 'A',
|
|
46
|
+
* value: 100,
|
|
47
|
+
* children: [
|
|
48
|
+
* { name: 'A1', value: 40 },
|
|
49
|
+
* { name: 'A2', value: 30 },
|
|
50
|
+
* { name: 'A3', value: 30 },
|
|
51
|
+
* ],
|
|
52
|
+
* },
|
|
53
|
+
* {
|
|
54
|
+
* name: 'B',
|
|
55
|
+
* value: 80,
|
|
56
|
+
* children: [
|
|
57
|
+
* { name: 'B1', value: 50 },
|
|
58
|
+
* { name: 'B2', value: 30 },
|
|
59
|
+
* ],
|
|
60
|
+
* },
|
|
61
|
+
* ],
|
|
62
|
+
* theme: 'academy'
|
|
63
|
+
* });
|
|
64
|
+
*
|
|
65
|
+
* treemap.destroy();
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
export declare const Treemap: (options: VisualizationOptions) => TreemapInstance;
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
import { Chart } from '@antv/g2';
|
|
8
|
+
import { getBackgroundColor, getThemeObject, normalizePalette } from "../../util/theme";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* TreemapDataItem is the type for each data item in the treemap chart.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* TreemapConfig defines the configuration for rendering the treemap chart.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* TreemapInstance represents a treemap chart instance with render and destroy methods.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Treemap chart component using G2 5.0.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* const treemap = Treemap({
|
|
28
|
+
* container: '#container',
|
|
29
|
+
* width: 600,
|
|
30
|
+
* height: 400,
|
|
31
|
+
* });
|
|
32
|
+
*
|
|
33
|
+
* treemap.render({
|
|
34
|
+
* type: 'treemap',
|
|
35
|
+
* data: [
|
|
36
|
+
* {
|
|
37
|
+
* name: 'A',
|
|
38
|
+
* value: 100,
|
|
39
|
+
* children: [
|
|
40
|
+
* { name: 'A1', value: 40 },
|
|
41
|
+
* { name: 'A2', value: 30 },
|
|
42
|
+
* { name: 'A3', value: 30 },
|
|
43
|
+
* ],
|
|
44
|
+
* },
|
|
45
|
+
* {
|
|
46
|
+
* name: 'B',
|
|
47
|
+
* value: 80,
|
|
48
|
+
* children: [
|
|
49
|
+
* { name: 'B1', value: 50 },
|
|
50
|
+
* { name: 'B2', value: 30 },
|
|
51
|
+
* ],
|
|
52
|
+
* },
|
|
53
|
+
* ],
|
|
54
|
+
* theme: 'academy'
|
|
55
|
+
* });
|
|
56
|
+
*
|
|
57
|
+
* treemap.destroy();
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export var Treemap = function Treemap(options) {
|
|
61
|
+
var container = options.container,
|
|
62
|
+
width = options.width,
|
|
63
|
+
height = options.height,
|
|
64
|
+
_options$theme = options.theme,
|
|
65
|
+
chartTheme = _options$theme === void 0 ? 'default' : _options$theme;
|
|
66
|
+
var chart = null;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Render the treemap chart with the given configuration.
|
|
70
|
+
*/
|
|
71
|
+
var render = function render(config) {
|
|
72
|
+
var _config$data = config.data,
|
|
73
|
+
data = _config$data === void 0 ? [] : _config$data,
|
|
74
|
+
_config$theme = config.theme,
|
|
75
|
+
theme = _config$theme === void 0 ? chartTheme : _config$theme,
|
|
76
|
+
title = config.title,
|
|
77
|
+
_config$style = config.style,
|
|
78
|
+
style = _config$style === void 0 ? {} : _config$style;
|
|
79
|
+
|
|
80
|
+
// Clean up previous chart if exists
|
|
81
|
+
if (chart) {
|
|
82
|
+
chart.destroy();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Get colors from style.palette or theme defaults
|
|
86
|
+
var colors = normalizePalette(style.palette, theme);
|
|
87
|
+
var backgroundColor = style.backgroundColor || getBackgroundColor(theme);
|
|
88
|
+
|
|
89
|
+
// Create chart
|
|
90
|
+
chart = new Chart({
|
|
91
|
+
container: container,
|
|
92
|
+
width: width,
|
|
93
|
+
height: height,
|
|
94
|
+
autoFit: true
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
// Configure chart options
|
|
98
|
+
// Note: Using 'any' type due to G2's complex type system with transformations
|
|
99
|
+
// This is consistent with how G2 5.0 is used elsewhere in the codebase
|
|
100
|
+
var chartOptions = {
|
|
101
|
+
animate: false,
|
|
102
|
+
type: 'treemap',
|
|
103
|
+
data: {
|
|
104
|
+
type: 'inline',
|
|
105
|
+
value: {
|
|
106
|
+
name: 'root',
|
|
107
|
+
children: data
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
title: title !== null && title !== void 0 ? title : '',
|
|
111
|
+
layout: {
|
|
112
|
+
tile: 'treemapBinary',
|
|
113
|
+
paddingInner: 2
|
|
114
|
+
},
|
|
115
|
+
encode: {
|
|
116
|
+
value: 'value'
|
|
117
|
+
},
|
|
118
|
+
style: {
|
|
119
|
+
fillOpacity: 0.8,
|
|
120
|
+
labelFontSize: 10
|
|
121
|
+
},
|
|
122
|
+
legend: false,
|
|
123
|
+
tooltip: {
|
|
124
|
+
items: [function (d) {
|
|
125
|
+
var _d$data, _d$data2;
|
|
126
|
+
return {
|
|
127
|
+
name: ((_d$data = d.data) === null || _d$data === void 0 ? void 0 : _d$data.name) || d.name,
|
|
128
|
+
value: ((_d$data2 = d.data) === null || _d$data2 === void 0 ? void 0 : _d$data2.value) || d.value
|
|
129
|
+
};
|
|
130
|
+
}]
|
|
131
|
+
},
|
|
132
|
+
viewStyle: {
|
|
133
|
+
viewFill: backgroundColor
|
|
134
|
+
},
|
|
135
|
+
theme: getThemeObject(theme),
|
|
136
|
+
scale: _objectSpread({}, colors.length > 0 ? {
|
|
137
|
+
color: {
|
|
138
|
+
range: colors
|
|
139
|
+
}
|
|
140
|
+
} : {})
|
|
141
|
+
};
|
|
142
|
+
chart.options(chartOptions);
|
|
143
|
+
chart.render();
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Destroy the chart instance and clean up resources.
|
|
148
|
+
*/
|
|
149
|
+
var destroy = function destroy() {
|
|
150
|
+
if (chart) {
|
|
151
|
+
chart.destroy();
|
|
152
|
+
chart = null;
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
return {
|
|
156
|
+
render: render,
|
|
157
|
+
destroy: destroy
|
|
158
|
+
};
|
|
159
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { VisualizationOptions } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* VennDataItem is the type for each data item in the venn chart.
|
|
4
|
+
*/
|
|
5
|
+
export type VennDataItem = {
|
|
6
|
+
/** Parser / DSL often yields a comma-separated string; G2 venn transform expects string[]. */
|
|
7
|
+
sets: string[] | string;
|
|
8
|
+
value: number;
|
|
9
|
+
label?: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* VennConfig defines the configuration for rendering the venn chart.
|
|
13
|
+
*/
|
|
14
|
+
export interface VennConfig {
|
|
15
|
+
type?: 'venn';
|
|
16
|
+
data: VennDataItem[];
|
|
17
|
+
theme?: 'default' | 'academy' | 'dark';
|
|
18
|
+
title?: string;
|
|
19
|
+
style?: {
|
|
20
|
+
backgroundColor?: string;
|
|
21
|
+
palette?: string[];
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* VennInstance represents a venn chart instance with render and destroy methods.
|
|
26
|
+
*/
|
|
27
|
+
export interface VennInstance {
|
|
28
|
+
render: (config: VennConfig) => void;
|
|
29
|
+
destroy: () => void;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Venn chart component using G2 5.0.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* const venn = Venn({
|
|
37
|
+
* container: '#container',
|
|
38
|
+
* width: 600,
|
|
39
|
+
* height: 400,
|
|
40
|
+
* });
|
|
41
|
+
*
|
|
42
|
+
* venn.render({
|
|
43
|
+
* type: 'venn',
|
|
44
|
+
* data: [
|
|
45
|
+
* { sets: ['A'], value: 20, label: '集合A' },
|
|
46
|
+
* { sets: ['B'], value: 15, label: '集合B' },
|
|
47
|
+
* { sets: ['A', 'B'], value: 5, label: '交集AB' },
|
|
48
|
+
* ],
|
|
49
|
+
* theme: 'academy'
|
|
50
|
+
* });
|
|
51
|
+
*
|
|
52
|
+
* venn.destroy();
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export declare const Venn: (options: VisualizationOptions) => VennInstance;
|