@carto/ps-react-ui 4.7.0 → 4.8.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/dist/category-DwaeYjpX.js +656 -0
- package/dist/category-DwaeYjpX.js.map +1 -0
- package/dist/change-column-Cidl_M-4.js +1110 -0
- package/dist/change-column-Cidl_M-4.js.map +1 -0
- package/dist/data-zoom-layout-BH0LPwSy.js +28 -0
- package/dist/data-zoom-layout-BH0LPwSy.js.map +1 -0
- package/dist/echart-CU0KmClP.js +176 -0
- package/dist/echart-CU0KmClP.js.map +1 -0
- package/dist/exports-Cx-f6m6U.js +63 -0
- package/dist/exports-Cx-f6m6U.js.map +1 -0
- package/dist/formula-DuC0NQLH.js +79 -0
- package/dist/formula-DuC0NQLH.js.map +1 -0
- package/dist/markdown-BD1jcknS.js +8326 -0
- package/dist/markdown-BD1jcknS.js.map +1 -0
- package/dist/merge-options-DCkkHZIf.js +34 -0
- package/dist/merge-options-DCkkHZIf.js.map +1 -0
- package/dist/{styles-BYTyKQFP.js → option-builders-F-c9ELi1.js} +25 -45
- package/dist/option-builders-F-c9ELi1.js.map +1 -0
- package/dist/png-item-CS4z1iSH.js +45 -0
- package/dist/png-item-CS4z1iSH.js.map +1 -0
- package/dist/range-DsqTjSpg.js +186 -0
- package/dist/range-DsqTjSpg.js.map +1 -0
- package/dist/spread-CTuIXZSM.js +67 -0
- package/dist/spread-CTuIXZSM.js.map +1 -0
- package/dist/style-DVnT6HC1.js +131 -0
- package/dist/style-DVnT6HC1.js.map +1 -0
- package/dist/styles-cohnxh9F.js +23 -0
- package/dist/styles-cohnxh9F.js.map +1 -0
- package/dist/table-HIpXuq4G.js +390 -0
- package/dist/table-HIpXuq4G.js.map +1 -0
- package/dist/transforms-Cdx4fkU5.js +106 -0
- package/dist/transforms-Cdx4fkU5.js.map +1 -0
- package/dist/types/widgets/echart/utils.test.d.ts +1 -0
- package/dist/types/widgets/formula/config.test.d.ts +1 -0
- package/dist/types/widgets/stores/widget-store-branches.test.d.ts +1 -0
- package/dist/types/widgets/table/config.test.d.ts +1 -0
- package/dist/types/widgets-v2/actions/brush-toggle/brush-toggle.d.ts +56 -0
- package/dist/types/widgets-v2/actions/brush-toggle/index.d.ts +3 -0
- package/dist/types/widgets-v2/actions/brush-toggle/labels.d.ts +5 -0
- package/dist/types/widgets-v2/actions/brush-toggle/style.d.ts +12 -0
- package/dist/types/widgets-v2/actions/brush-toggle/transforms.d.ts +11 -0
- package/dist/types/widgets-v2/actions/brush-toggle/transforms.test.d.ts +1 -0
- package/dist/types/widgets-v2/actions/change-column/change-column-icon.d.ts +2 -0
- package/dist/types/widgets-v2/actions/change-column/change-column.d.ts +29 -0
- package/dist/types/widgets-v2/actions/change-column/index.d.ts +3 -0
- package/dist/types/widgets-v2/actions/change-column/labels.d.ts +5 -0
- package/dist/types/widgets-v2/actions/change-column/sortable-column-item.d.ts +14 -0
- package/dist/types/widgets-v2/actions/change-column/style.d.ts +33 -0
- package/dist/types/widgets-v2/actions/change-column/types.d.ts +10 -0
- package/dist/types/widgets-v2/actions/download/download.d.ts +18 -0
- package/dist/types/widgets-v2/actions/download/exports.d.ts +37 -0
- package/dist/types/widgets-v2/actions/download/icons.d.ts +12 -0
- package/dist/types/widgets-v2/actions/download/index.d.ts +6 -0
- package/dist/types/widgets-v2/actions/download/labels.d.ts +11 -0
- package/dist/types/widgets-v2/actions/download/png-item.d.ts +24 -0
- package/dist/types/widgets-v2/actions/download/style.d.ts +1 -0
- package/dist/types/widgets-v2/actions/download/types.d.ts +35 -0
- package/dist/types/widgets-v2/actions/fullscreen/fullscreen.d.ts +59 -0
- package/dist/types/widgets-v2/actions/fullscreen/index.d.ts +3 -0
- package/dist/types/widgets-v2/actions/fullscreen/labels.d.ts +5 -0
- package/dist/types/widgets-v2/actions/fullscreen/style.d.ts +48 -0
- package/dist/types/widgets-v2/actions/fullscreen/types.d.ts +14 -0
- package/dist/types/widgets-v2/actions/index.d.ts +9 -0
- package/dist/types/widgets-v2/actions/lock-selection/index.d.ts +3 -0
- package/dist/types/widgets-v2/actions/lock-selection/labels.d.ts +6 -0
- package/dist/types/widgets-v2/actions/lock-selection/lock-selection.d.ts +36 -0
- package/dist/types/widgets-v2/actions/lock-selection/style.d.ts +12 -0
- package/dist/types/widgets-v2/actions/lock-selection/transforms.d.ts +6 -0
- package/dist/types/widgets-v2/actions/relative-data/index.d.ts +3 -0
- package/dist/types/widgets-v2/actions/relative-data/labels.d.ts +5 -0
- package/dist/types/widgets-v2/actions/relative-data/relative-data.d.ts +39 -0
- package/dist/types/widgets-v2/actions/relative-data/style.d.ts +12 -0
- package/dist/types/widgets-v2/actions/relative-data/transforms.d.ts +30 -0
- package/dist/types/widgets-v2/actions/relative-data/transforms.test.d.ts +1 -0
- package/dist/types/widgets-v2/actions/searcher/filter.d.ts +6 -0
- package/dist/types/widgets-v2/actions/searcher/index.d.ts +4 -0
- package/dist/types/widgets-v2/actions/searcher/labels.d.ts +7 -0
- package/dist/types/widgets-v2/actions/searcher/searcher-toggle.d.ts +23 -0
- package/dist/types/widgets-v2/actions/searcher/searcher.d.ts +11 -0
- package/dist/types/widgets-v2/actions/searcher/style.d.ts +16 -0
- package/dist/types/widgets-v2/actions/stack-toggle/index.d.ts +3 -0
- package/dist/types/widgets-v2/actions/stack-toggle/labels.d.ts +5 -0
- package/dist/types/widgets-v2/actions/stack-toggle/stack-toggle.d.ts +10 -0
- package/dist/types/widgets-v2/actions/stack-toggle/style.d.ts +12 -0
- package/dist/types/widgets-v2/actions/stack-toggle/transforms.d.ts +13 -0
- package/dist/types/widgets-v2/actions/stack-toggle/transforms.test.d.ts +1 -0
- package/dist/types/widgets-v2/actions/zoom-toggle/index.d.ts +3 -0
- package/dist/types/widgets-v2/actions/zoom-toggle/labels.d.ts +5 -0
- package/dist/types/widgets-v2/actions/zoom-toggle/style.d.ts +12 -0
- package/dist/types/widgets-v2/actions/zoom-toggle/transforms.d.ts +51 -0
- package/dist/types/widgets-v2/actions/zoom-toggle/transforms.test.d.ts +1 -0
- package/dist/types/widgets-v2/actions/zoom-toggle/zoom-toggle.d.ts +35 -0
- package/dist/types/widgets-v2/bar/download.d.ts +24 -0
- package/dist/types/widgets-v2/bar/index.d.ts +4 -0
- package/dist/types/widgets-v2/bar/options.d.ts +43 -0
- package/dist/types/widgets-v2/bar/options.test.d.ts +1 -0
- package/dist/types/widgets-v2/bar/skeleton.d.ts +6 -0
- package/dist/types/widgets-v2/bar/types.d.ts +41 -0
- package/dist/types/widgets-v2/category/category-ui.d.ts +81 -0
- package/dist/types/widgets-v2/category/category.d.ts +48 -0
- package/dist/types/widgets-v2/category/components/category-bar-stacked.d.ts +28 -0
- package/dist/types/widgets-v2/category/components/category-bar.d.ts +23 -0
- package/dist/types/widgets-v2/category/components/category-legend.d.ts +18 -0
- package/dist/types/widgets-v2/category/components/category-row-multi.d.ts +31 -0
- package/dist/types/widgets-v2/category/components/category-row-other.d.ts +13 -0
- package/dist/types/widgets-v2/category/components/category-row-single.d.ts +28 -0
- package/dist/types/widgets-v2/category/components/category-row-stacked.d.ts +38 -0
- package/dist/types/widgets-v2/category/download.d.ts +16 -0
- package/dist/types/widgets-v2/category/download.test.d.ts +1 -0
- package/dist/types/widgets-v2/category/index.d.ts +10 -0
- package/dist/types/widgets-v2/category/skeleton.d.ts +11 -0
- package/dist/types/widgets-v2/category/style.d.ts +166 -0
- package/dist/types/widgets-v2/category/types.d.ts +49 -0
- package/dist/types/widgets-v2/echart/echart-ui.d.ts +44 -0
- package/dist/types/widgets-v2/echart/echart.d.ts +75 -0
- package/dist/types/widgets-v2/echart/index.d.ts +4 -0
- package/dist/types/widgets-v2/echart/shared-resize-observer.d.ts +5 -0
- package/dist/types/widgets-v2/echart/shared-resize-observer.test.d.ts +1 -0
- package/dist/types/widgets-v2/echart/style.d.ts +6 -0
- package/dist/types/widgets-v2/echart/use-chart-selection.d.ts +51 -0
- package/dist/types/widgets-v2/formula/delta.d.ts +22 -0
- package/dist/types/widgets-v2/formula/download.d.ts +20 -0
- package/dist/types/widgets-v2/formula/formula-ui.d.ts +20 -0
- package/dist/types/widgets-v2/formula/formula.d.ts +8 -0
- package/dist/types/widgets-v2/formula/index.d.ts +11 -0
- package/dist/types/widgets-v2/formula/note.d.ts +11 -0
- package/dist/types/widgets-v2/formula/prefix.d.ts +12 -0
- package/dist/types/widgets-v2/formula/series.d.ts +16 -0
- package/dist/types/widgets-v2/formula/skeleton.d.ts +4 -0
- package/dist/types/widgets-v2/formula/style.d.ts +29 -0
- package/dist/types/widgets-v2/formula/suffix.d.ts +12 -0
- package/dist/types/widgets-v2/formula/types.d.ts +40 -0
- package/dist/types/widgets-v2/formula/value.d.ts +14 -0
- package/dist/types/widgets-v2/histogram/download.d.ts +17 -0
- package/dist/types/widgets-v2/histogram/download.test.d.ts +1 -0
- package/dist/types/widgets-v2/histogram/index.d.ts +5 -0
- package/dist/types/widgets-v2/histogram/options.d.ts +42 -0
- package/dist/types/widgets-v2/histogram/options.test.d.ts +1 -0
- package/dist/types/widgets-v2/histogram/skeleton.d.ts +9 -0
- package/dist/types/widgets-v2/histogram/transforms.d.ts +17 -0
- package/dist/types/widgets-v2/histogram/transforms.test.d.ts +1 -0
- package/dist/types/widgets-v2/histogram/types.d.ts +47 -0
- package/dist/types/widgets-v2/index.d.ts +107 -0
- package/dist/types/widgets-v2/markdown/download.d.ts +16 -0
- package/dist/types/widgets-v2/markdown/download.test.d.ts +1 -0
- package/dist/types/widgets-v2/markdown/index.d.ts +6 -0
- package/dist/types/widgets-v2/markdown/markdown-content.d.ts +34 -0
- package/dist/types/widgets-v2/markdown/markdown-ui.d.ts +12 -0
- package/dist/types/widgets-v2/markdown/markdown.d.ts +6 -0
- package/dist/types/widgets-v2/markdown/skeleton.d.ts +4 -0
- package/dist/types/widgets-v2/markdown/style.d.ts +61 -0
- package/dist/types/widgets-v2/markdown/types.d.ts +4 -0
- package/dist/types/widgets-v2/note/labels.d.ts +5 -0
- package/dist/types/widgets-v2/note/style.d.ts +26 -0
- package/dist/types/widgets-v2/note/widget-note.d.ts +46 -0
- package/dist/types/widgets-v2/pie/download.d.ts +17 -0
- package/dist/types/widgets-v2/pie/download.test.d.ts +1 -0
- package/dist/types/widgets-v2/pie/index.d.ts +4 -0
- package/dist/types/widgets-v2/pie/options.d.ts +35 -0
- package/dist/types/widgets-v2/pie/options.test.d.ts +1 -0
- package/dist/types/widgets-v2/pie/skeleton.d.ts +4 -0
- package/dist/types/widgets-v2/pie/types.d.ts +50 -0
- package/dist/types/widgets-v2/provider/widget-provider.d.ts +32 -0
- package/dist/types/widgets-v2/range/index.d.ts +4 -0
- package/dist/types/widgets-v2/range/range-ui.d.ts +19 -0
- package/dist/types/widgets-v2/range/range.d.ts +19 -0
- package/dist/types/widgets-v2/range/skeleton.d.ts +9 -0
- package/dist/types/widgets-v2/range/style.d.ts +40 -0
- package/dist/types/widgets-v2/range/types.d.ts +37 -0
- package/dist/types/widgets-v2/scatterplot/download.d.ts +16 -0
- package/dist/types/widgets-v2/scatterplot/download.test.d.ts +1 -0
- package/dist/types/widgets-v2/scatterplot/index.d.ts +5 -0
- package/dist/types/widgets-v2/scatterplot/options.d.ts +42 -0
- package/dist/types/widgets-v2/scatterplot/options.test.d.ts +1 -0
- package/dist/types/widgets-v2/scatterplot/skeleton.d.ts +12 -0
- package/dist/types/widgets-v2/scatterplot/transforms.d.ts +17 -0
- package/dist/types/widgets-v2/scatterplot/transforms.test.d.ts +1 -0
- package/dist/types/widgets-v2/scatterplot/types.d.ts +50 -0
- package/dist/types/widgets-v2/selection-summary/labels.d.ts +6 -0
- package/dist/types/widgets-v2/selection-summary/selection-summary.d.ts +22 -0
- package/dist/types/widgets-v2/selection-summary/style.d.ts +23 -0
- package/dist/types/widgets-v2/spread/download.d.ts +15 -0
- package/dist/types/widgets-v2/spread/download.test.d.ts +1 -0
- package/dist/types/widgets-v2/spread/index.d.ts +6 -0
- package/dist/types/widgets-v2/spread/separator.d.ts +7 -0
- package/dist/types/widgets-v2/spread/skeleton.d.ts +9 -0
- package/dist/types/widgets-v2/spread/spread-ui.d.ts +18 -0
- package/dist/types/widgets-v2/spread/spread.d.ts +5 -0
- package/dist/types/widgets-v2/spread/types.d.ts +25 -0
- package/dist/types/widgets-v2/state/labels.d.ts +7 -0
- package/dist/types/widgets-v2/state/labels.test.d.ts +1 -0
- package/dist/types/widgets-v2/state/style.d.ts +19 -0
- package/dist/types/widgets-v2/state/widget-state.d.ts +19 -0
- package/dist/types/widgets-v2/stores/index.d.ts +8 -0
- package/dist/types/widgets-v2/stores/pipeline-middleware.d.ts +5 -0
- package/dist/types/widgets-v2/stores/pipeline-middleware.test.d.ts +1 -0
- package/dist/types/widgets-v2/stores/transforms.d.ts +4 -0
- package/dist/types/widgets-v2/stores/transforms.test.d.ts +1 -0
- package/dist/types/widgets-v2/stores/types.d.ts +55 -0
- package/dist/types/widgets-v2/stores/use-echart-instance.d.ts +15 -0
- package/dist/types/widgets-v2/stores/use-transform-enabled.d.ts +17 -0
- package/dist/types/widgets-v2/stores/use-transform.d.ts +12 -0
- package/dist/types/widgets-v2/stores/widget-context.d.ts +2 -0
- package/dist/types/widgets-v2/stores/widget-store-registry.d.ts +74 -0
- package/dist/types/widgets-v2/stores/widget-store-registry.test.d.ts +1 -0
- package/dist/types/widgets-v2/subheader/style.d.ts +10 -0
- package/dist/types/widgets-v2/subheader/subheader.d.ts +11 -0
- package/dist/types/widgets-v2/table/download.d.ts +18 -0
- package/dist/types/widgets-v2/table/download.test.d.ts +1 -0
- package/dist/types/widgets-v2/table/helpers.d.ts +32 -0
- package/dist/types/widgets-v2/table/helpers.test.d.ts +1 -0
- package/dist/types/widgets-v2/table/index.d.ts +7 -0
- package/dist/types/widgets-v2/table/labels.d.ts +22 -0
- package/dist/types/widgets-v2/table/skeleton.d.ts +22 -0
- package/dist/types/widgets-v2/table/style.d.ts +44 -0
- package/dist/types/widgets-v2/table/table-ui.d.ts +38 -0
- package/dist/types/widgets-v2/table/table.d.ts +50 -0
- package/dist/types/widgets-v2/table/types.d.ts +37 -0
- package/dist/types/widgets-v2/test-utils.d.ts +52 -0
- package/dist/types/widgets-v2/timeseries/download.d.ts +17 -0
- package/dist/types/widgets-v2/timeseries/download.test.d.ts +1 -0
- package/dist/types/widgets-v2/timeseries/index.d.ts +4 -0
- package/dist/types/widgets-v2/timeseries/options.d.ts +39 -0
- package/dist/types/widgets-v2/timeseries/options.test.d.ts +1 -0
- package/dist/types/widgets-v2/timeseries/skeleton.d.ts +8 -0
- package/dist/types/widgets-v2/timeseries/types.d.ts +56 -0
- package/dist/types/widgets-v2/toolbox/labels.d.ts +5 -0
- package/dist/types/widgets-v2/toolbox/style.d.ts +30 -0
- package/dist/types/widgets-v2/toolbox/toolbox.d.ts +49 -0
- package/dist/types/widgets-v2/utils/data-zoom-layout.d.ts +11 -0
- package/dist/types/widgets-v2/utils/index.d.ts +2 -0
- package/dist/types/widgets-v2/utils/merge-options.d.ts +12 -0
- package/dist/types/widgets-v2/utils/merge-options.test.d.ts +1 -0
- package/dist/types/widgets-v2/wrapper/index.d.ts +4 -0
- package/dist/types/widgets-v2/wrapper/labels.d.ts +6 -0
- package/dist/types/widgets-v2/wrapper/style.d.ts +111 -0
- package/dist/types/widgets-v2/wrapper/widget-actions.d.ts +22 -0
- package/dist/types/widgets-v2/wrapper/widget-content.d.ts +12 -0
- package/dist/types/widgets-v2/wrapper/widget-wrapper.d.ts +51 -0
- package/dist/use-transform-DXPN3nY7.js +110 -0
- package/dist/use-transform-DXPN3nY7.js.map +1 -0
- package/dist/widget-context-DTGO0Yta.js +13 -0
- package/dist/widget-context-DTGO0Yta.js.map +1 -0
- package/dist/widget-store-registry-_W4Z4xp-.js +178 -0
- package/dist/widget-store-registry-_W4Z4xp-.js.map +1 -0
- package/dist/widgets/actions.js +688 -668
- package/dist/widgets/actions.js.map +1 -1
- package/dist/widgets/bar.js +14 -13
- package/dist/widgets/bar.js.map +1 -1
- package/dist/widgets/histogram.js +38 -37
- package/dist/widgets/histogram.js.map +1 -1
- package/dist/widgets/pie.js +19 -18
- package/dist/widgets/pie.js.map +1 -1
- package/dist/widgets/scatterplot.js +8 -7
- package/dist/widgets/scatterplot.js.map +1 -1
- package/dist/widgets/timeseries.js +11 -10
- package/dist/widgets/timeseries.js.map +1 -1
- package/dist/widgets/utils.js +8 -7
- package/dist/widgets/utils.js.map +1 -1
- package/dist/widgets-v2/actions.js +43 -0
- package/dist/widgets-v2/actions.js.map +1 -0
- package/dist/widgets-v2/bar.js +327 -0
- package/dist/widgets-v2/bar.js.map +1 -0
- package/dist/widgets-v2/category.js +104 -0
- package/dist/widgets-v2/category.js.map +1 -0
- package/dist/widgets-v2/echart.js +57 -0
- package/dist/widgets-v2/echart.js.map +1 -0
- package/dist/widgets-v2/formula.js +74 -0
- package/dist/widgets-v2/formula.js.map +1 -0
- package/dist/widgets-v2/histogram.js +350 -0
- package/dist/widgets-v2/histogram.js.map +1 -0
- package/dist/widgets-v2/markdown.js +68 -0
- package/dist/widgets-v2/markdown.js.map +1 -0
- package/dist/widgets-v2/pie.js +381 -0
- package/dist/widgets-v2/pie.js.map +1 -0
- package/dist/widgets-v2/range.js +52 -0
- package/dist/widgets-v2/range.js.map +1 -0
- package/dist/widgets-v2/scatterplot.js +405 -0
- package/dist/widgets-v2/scatterplot.js.map +1 -0
- package/dist/widgets-v2/spread.js +72 -0
- package/dist/widgets-v2/spread.js.map +1 -0
- package/dist/widgets-v2/stores.js +42 -0
- package/dist/widgets-v2/stores.js.map +1 -0
- package/dist/widgets-v2/table.js +78 -0
- package/dist/widgets-v2/table.js.map +1 -0
- package/dist/widgets-v2/timeseries.js +352 -0
- package/dist/widgets-v2/timeseries.js.map +1 -0
- package/dist/widgets-v2/utils.js +7 -0
- package/dist/widgets-v2/utils.js.map +1 -0
- package/dist/widgets-v2.js +953 -0
- package/dist/widgets-v2.js.map +1 -0
- package/package.json +73 -5
- package/src/components/lasso-tool/chip.test.tsx +176 -0
- package/src/components/lasso-tool/lasso-tool-inline.test.tsx +171 -0
- package/src/components/lasso-tool/lasso-tool.test.tsx +198 -0
- package/src/components/list-data/list-data.test.tsx +73 -0
- package/src/components/no-data-alert/no-data-alert.test.tsx +38 -0
- package/src/components/responsive-drawer/responsive-drawer.test.tsx +68 -0
- package/src/widgets/actions/brush-toggle/brush-overlay.test.tsx +465 -0
- package/src/widgets/actions/brush-toggle/brush-overlay.tsx +24 -2
- package/src/widgets/actions/brush-toggle/brush-toggle.test.tsx +208 -0
- package/src/widgets/actions/change-column/change-column-dnd.test.tsx +193 -0
- package/src/widgets/actions/change-column/sortable-column-item.test.tsx +124 -0
- package/src/widgets/actions/zoom-toggle/zoom-toggle.test.tsx +322 -0
- package/src/widgets/category/components/category-rows.test.tsx +213 -0
- package/src/widgets/echart/utils.test.ts +277 -0
- package/src/widgets/formula/config.test.ts +37 -0
- package/src/widgets/histogram/config.ts +1 -3
- package/src/widgets/range/components/range-item.test.tsx +243 -0
- package/src/widgets/stores/widget-store-branches.test.ts +275 -0
- package/src/widgets/table/config.test.ts +65 -0
- package/src/widgets/utils/chart-config/option-builders.test.ts +188 -0
- package/src/widgets-v2/PERFORMANCE.md +189 -0
- package/src/widgets-v2/actions/brush-toggle/brush-toggle.test.tsx +180 -0
- package/src/widgets-v2/actions/brush-toggle/brush-toggle.tsx +154 -0
- package/src/widgets-v2/actions/brush-toggle/index.ts +3 -0
- package/src/widgets-v2/actions/brush-toggle/labels.ts +9 -0
- package/src/widgets-v2/actions/brush-toggle/style.ts +11 -0
- package/src/widgets-v2/actions/brush-toggle/transforms.test.ts +47 -0
- package/src/widgets-v2/actions/brush-toggle/transforms.ts +31 -0
- package/src/widgets-v2/actions/change-column/change-column-icon.tsx +14 -0
- package/src/widgets-v2/actions/change-column/change-column.test.tsx +59 -0
- package/src/widgets-v2/actions/change-column/change-column.tsx +180 -0
- package/src/widgets-v2/actions/change-column/index.ts +7 -0
- package/src/widgets-v2/actions/change-column/labels.ts +9 -0
- package/src/widgets-v2/actions/change-column/sortable-column-item.tsx +56 -0
- package/src/widgets-v2/actions/change-column/style.ts +32 -0
- package/src/widgets-v2/actions/change-column/types.ts +11 -0
- package/src/widgets-v2/actions/download/download.test.tsx +327 -0
- package/src/widgets-v2/actions/download/download.tsx +144 -0
- package/src/widgets-v2/actions/download/exports.test.tsx +198 -0
- package/src/widgets-v2/actions/download/exports.ts +115 -0
- package/src/widgets-v2/actions/download/icons.tsx +26 -0
- package/src/widgets-v2/actions/download/index.ts +13 -0
- package/src/widgets-v2/actions/download/labels.ts +16 -0
- package/src/widgets-v2/actions/download/png-item.test.tsx +72 -0
- package/src/widgets-v2/actions/download/png-item.tsx +52 -0
- package/src/widgets-v2/actions/download/style.ts +3 -0
- package/src/widgets-v2/actions/download/types.ts +32 -0
- package/src/widgets-v2/actions/fullscreen/fullscreen.test.tsx +150 -0
- package/src/widgets-v2/actions/fullscreen/fullscreen.tsx +230 -0
- package/src/widgets-v2/actions/fullscreen/index.ts +7 -0
- package/src/widgets-v2/actions/fullscreen/labels.ts +9 -0
- package/src/widgets-v2/actions/fullscreen/style.ts +59 -0
- package/src/widgets-v2/actions/fullscreen/types.ts +15 -0
- package/src/widgets-v2/actions/index.ts +82 -0
- package/src/widgets-v2/actions/lock-selection/index.ts +10 -0
- package/src/widgets-v2/actions/lock-selection/labels.ts +11 -0
- package/src/widgets-v2/actions/lock-selection/lock-selection.test.tsx +187 -0
- package/src/widgets-v2/actions/lock-selection/lock-selection.tsx +130 -0
- package/src/widgets-v2/actions/lock-selection/style.ts +11 -0
- package/src/widgets-v2/actions/lock-selection/transforms.ts +27 -0
- package/src/widgets-v2/actions/relative-data/index.ts +3 -0
- package/src/widgets-v2/actions/relative-data/labels.ts +9 -0
- package/src/widgets-v2/actions/relative-data/relative-data.test.tsx +71 -0
- package/src/widgets-v2/actions/relative-data/relative-data.tsx +107 -0
- package/src/widgets-v2/actions/relative-data/style.ts +11 -0
- package/src/widgets-v2/actions/relative-data/transforms.test.ts +151 -0
- package/src/widgets-v2/actions/relative-data/transforms.ts +70 -0
- package/src/widgets-v2/actions/searcher/filter.ts +28 -0
- package/src/widgets-v2/actions/searcher/index.ts +8 -0
- package/src/widgets-v2/actions/searcher/labels.ts +13 -0
- package/src/widgets-v2/actions/searcher/searcher-toggle.tsx +91 -0
- package/src/widgets-v2/actions/searcher/searcher.test.tsx +92 -0
- package/src/widgets-v2/actions/searcher/searcher.tsx +112 -0
- package/src/widgets-v2/actions/searcher/style.ts +15 -0
- package/src/widgets-v2/actions/stack-toggle/index.ts +3 -0
- package/src/widgets-v2/actions/stack-toggle/labels.ts +9 -0
- package/src/widgets-v2/actions/stack-toggle/stack-toggle.test.tsx +61 -0
- package/src/widgets-v2/actions/stack-toggle/stack-toggle.tsx +54 -0
- package/src/widgets-v2/actions/stack-toggle/style.ts +11 -0
- package/src/widgets-v2/actions/stack-toggle/transforms.test.ts +43 -0
- package/src/widgets-v2/actions/stack-toggle/transforms.ts +25 -0
- package/src/widgets-v2/actions/zoom-toggle/index.ts +9 -0
- package/src/widgets-v2/actions/zoom-toggle/labels.ts +9 -0
- package/src/widgets-v2/actions/zoom-toggle/style.ts +11 -0
- package/src/widgets-v2/actions/zoom-toggle/transforms.test.ts +148 -0
- package/src/widgets-v2/actions/zoom-toggle/transforms.ts +171 -0
- package/src/widgets-v2/actions/zoom-toggle/zoom-toggle.test.tsx +107 -0
- package/src/widgets-v2/actions/zoom-toggle/zoom-toggle.tsx +106 -0
- package/src/widgets-v2/bar/download.test.tsx +91 -0
- package/src/widgets-v2/bar/download.tsx +66 -0
- package/src/widgets-v2/bar/index.ts +10 -0
- package/src/widgets-v2/bar/options.test.ts +317 -0
- package/src/widgets-v2/bar/options.ts +326 -0
- package/src/widgets-v2/bar/skeleton.test.tsx +19 -0
- package/src/widgets-v2/bar/skeleton.tsx +69 -0
- package/src/widgets-v2/bar/types.ts +46 -0
- package/src/widgets-v2/category/category-ui.test.tsx +746 -0
- package/src/widgets-v2/category/category-ui.tsx +389 -0
- package/src/widgets-v2/category/category.relative-data.test.tsx +107 -0
- package/src/widgets-v2/category/category.stack-toggle.test.tsx +85 -0
- package/src/widgets-v2/category/category.test.tsx +305 -0
- package/src/widgets-v2/category/category.tsx +121 -0
- package/src/widgets-v2/category/components/category-bar-stacked.test.tsx +121 -0
- package/src/widgets-v2/category/components/category-bar-stacked.tsx +73 -0
- package/src/widgets-v2/category/components/category-bar.test.tsx +64 -0
- package/src/widgets-v2/category/components/category-bar.tsx +49 -0
- package/src/widgets-v2/category/components/category-legend.test.tsx +51 -0
- package/src/widgets-v2/category/components/category-legend.tsx +39 -0
- package/src/widgets-v2/category/components/category-row-multi.tsx +86 -0
- package/src/widgets-v2/category/components/category-row-other.test.tsx +28 -0
- package/src/widgets-v2/category/components/category-row-other.tsx +33 -0
- package/src/widgets-v2/category/components/category-row-single.tsx +76 -0
- package/src/widgets-v2/category/components/category-row-stacked.test.tsx +244 -0
- package/src/widgets-v2/category/components/category-row-stacked.tsx +99 -0
- package/src/widgets-v2/category/download.test.ts +71 -0
- package/src/widgets-v2/category/download.ts +54 -0
- package/src/widgets-v2/category/index.ts +32 -0
- package/src/widgets-v2/category/skeleton.test.tsx +26 -0
- package/src/widgets-v2/category/skeleton.tsx +74 -0
- package/src/widgets-v2/category/style.ts +290 -0
- package/src/widgets-v2/category/types.ts +54 -0
- package/src/widgets-v2/echart/echart-ui.test.tsx +232 -0
- package/src/widgets-v2/echart/echart-ui.tsx +184 -0
- package/src/widgets-v2/echart/echart.test.tsx +229 -0
- package/src/widgets-v2/echart/echart.tsx +199 -0
- package/src/widgets-v2/echart/index.ts +22 -0
- package/src/widgets-v2/echart/shared-resize-observer.test.ts +91 -0
- package/src/widgets-v2/echart/shared-resize-observer.ts +56 -0
- package/src/widgets-v2/echart/style.ts +8 -0
- package/src/widgets-v2/echart/use-chart-selection.test.tsx +118 -0
- package/src/widgets-v2/echart/use-chart-selection.ts +115 -0
- package/src/widgets-v2/formula/delta.tsx +61 -0
- package/src/widgets-v2/formula/download.test.tsx +65 -0
- package/src/widgets-v2/formula/download.tsx +69 -0
- package/src/widgets-v2/formula/formula-ui.test.tsx +91 -0
- package/src/widgets-v2/formula/formula-ui.tsx +66 -0
- package/src/widgets-v2/formula/formula.test.tsx +50 -0
- package/src/widgets-v2/formula/formula.tsx +34 -0
- package/src/widgets-v2/formula/index.ts +17 -0
- package/src/widgets-v2/formula/note.tsx +25 -0
- package/src/widgets-v2/formula/prefix.tsx +25 -0
- package/src/widgets-v2/formula/series.tsx +67 -0
- package/src/widgets-v2/formula/skeleton.test.tsx +21 -0
- package/src/widgets-v2/formula/skeleton.tsx +27 -0
- package/src/widgets-v2/formula/style.ts +31 -0
- package/src/widgets-v2/formula/subcomponents.test.tsx +107 -0
- package/src/widgets-v2/formula/suffix.tsx +25 -0
- package/src/widgets-v2/formula/types.ts +44 -0
- package/src/widgets-v2/formula/value.tsx +31 -0
- package/src/widgets-v2/histogram/download.test.ts +94 -0
- package/src/widgets-v2/histogram/download.ts +60 -0
- package/src/widgets-v2/histogram/index.ts +10 -0
- package/src/widgets-v2/histogram/options.test.ts +304 -0
- package/src/widgets-v2/histogram/options.ts +337 -0
- package/src/widgets-v2/histogram/skeleton.test.tsx +16 -0
- package/src/widgets-v2/histogram/skeleton.tsx +70 -0
- package/src/widgets-v2/histogram/transforms.test.ts +46 -0
- package/src/widgets-v2/histogram/transforms.ts +30 -0
- package/src/widgets-v2/histogram/types.ts +51 -0
- package/src/widgets-v2/index.ts +201 -0
- package/src/widgets-v2/markdown/download.test.ts +66 -0
- package/src/widgets-v2/markdown/download.ts +53 -0
- package/src/widgets-v2/markdown/index.ts +6 -0
- package/src/widgets-v2/markdown/markdown-content.test.tsx +155 -0
- package/src/widgets-v2/markdown/markdown-content.tsx +72 -0
- package/src/widgets-v2/markdown/markdown-ui.test.tsx +75 -0
- package/src/widgets-v2/markdown/markdown-ui.tsx +55 -0
- package/src/widgets-v2/markdown/markdown.test.tsx +39 -0
- package/src/widgets-v2/markdown/markdown.tsx +17 -0
- package/src/widgets-v2/markdown/skeleton.test.tsx +15 -0
- package/src/widgets-v2/markdown/skeleton.tsx +32 -0
- package/src/widgets-v2/markdown/style.ts +53 -0
- package/src/widgets-v2/markdown/types.ts +4 -0
- package/src/widgets-v2/note/labels.ts +9 -0
- package/src/widgets-v2/note/style.ts +26 -0
- package/src/widgets-v2/note/widget-note.test.tsx +158 -0
- package/src/widgets-v2/note/widget-note.tsx +172 -0
- package/src/widgets-v2/pie/download.test.ts +78 -0
- package/src/widgets-v2/pie/download.ts +55 -0
- package/src/widgets-v2/pie/index.ts +10 -0
- package/src/widgets-v2/pie/options.test.ts +585 -0
- package/src/widgets-v2/pie/options.ts +509 -0
- package/src/widgets-v2/pie/skeleton.test.tsx +17 -0
- package/src/widgets-v2/pie/skeleton.tsx +32 -0
- package/src/widgets-v2/pie/types.ts +55 -0
- package/src/widgets-v2/provider/widget-provider.test.tsx +119 -0
- package/src/widgets-v2/provider/widget-provider.tsx +111 -0
- package/src/widgets-v2/range/index.ts +4 -0
- package/src/widgets-v2/range/range-ui.test.tsx +130 -0
- package/src/widgets-v2/range/range-ui.tsx +211 -0
- package/src/widgets-v2/range/range.test.tsx +68 -0
- package/src/widgets-v2/range/range.tsx +46 -0
- package/src/widgets-v2/range/skeleton.test.tsx +17 -0
- package/src/widgets-v2/range/skeleton.tsx +47 -0
- package/src/widgets-v2/range/style.ts +41 -0
- package/src/widgets-v2/range/types.ts +37 -0
- package/src/widgets-v2/scatterplot/download.test.ts +71 -0
- package/src/widgets-v2/scatterplot/download.ts +54 -0
- package/src/widgets-v2/scatterplot/index.ts +11 -0
- package/src/widgets-v2/scatterplot/options.test.ts +399 -0
- package/src/widgets-v2/scatterplot/options.ts +421 -0
- package/src/widgets-v2/scatterplot/skeleton.test.tsx +17 -0
- package/src/widgets-v2/scatterplot/skeleton.tsx +84 -0
- package/src/widgets-v2/scatterplot/transforms.test.ts +97 -0
- package/src/widgets-v2/scatterplot/transforms.ts +38 -0
- package/src/widgets-v2/scatterplot/types.ts +55 -0
- package/src/widgets-v2/selection-summary/labels.ts +11 -0
- package/src/widgets-v2/selection-summary/selection-summary.test.tsx +53 -0
- package/src/widgets-v2/selection-summary/selection-summary.tsx +62 -0
- package/src/widgets-v2/selection-summary/style.ts +23 -0
- package/src/widgets-v2/spread/download.test.ts +64 -0
- package/src/widgets-v2/spread/download.ts +59 -0
- package/src/widgets-v2/spread/index.ts +6 -0
- package/src/widgets-v2/spread/separator.tsx +11 -0
- package/src/widgets-v2/spread/skeleton.test.tsx +17 -0
- package/src/widgets-v2/spread/skeleton.tsx +38 -0
- package/src/widgets-v2/spread/spread-ui.test.tsx +108 -0
- package/src/widgets-v2/spread/spread-ui.tsx +52 -0
- package/src/widgets-v2/spread/spread.test.tsx +50 -0
- package/src/widgets-v2/spread/spread.tsx +31 -0
- package/src/widgets-v2/spread/types.ts +27 -0
- package/src/widgets-v2/state/labels.test.ts +33 -0
- package/src/widgets-v2/state/labels.ts +20 -0
- package/src/widgets-v2/state/style.ts +25 -0
- package/src/widgets-v2/state/widget-state.test.tsx +294 -0
- package/src/widgets-v2/state/widget-state.tsx +184 -0
- package/src/widgets-v2/stores/index.ts +49 -0
- package/src/widgets-v2/stores/pipeline-middleware.test.ts +187 -0
- package/src/widgets-v2/stores/pipeline-middleware.ts +91 -0
- package/src/widgets-v2/stores/transforms.test.ts +162 -0
- package/src/widgets-v2/stores/transforms.ts +70 -0
- package/src/widgets-v2/stores/types.ts +64 -0
- package/src/widgets-v2/stores/use-echart-instance.test.tsx +91 -0
- package/src/widgets-v2/stores/use-echart-instance.ts +29 -0
- package/src/widgets-v2/stores/use-transform-enabled.test.tsx +127 -0
- package/src/widgets-v2/stores/use-transform-enabled.ts +25 -0
- package/src/widgets-v2/stores/use-transform.test.tsx +262 -0
- package/src/widgets-v2/stores/use-transform.ts +158 -0
- package/src/widgets-v2/stores/widget-context.test.tsx +58 -0
- package/src/widgets-v2/stores/widget-context.ts +15 -0
- package/src/widgets-v2/stores/widget-store-registry.test.ts +292 -0
- package/src/widgets-v2/stores/widget-store-registry.ts +248 -0
- package/src/widgets-v2/subheader/style.ts +12 -0
- package/src/widgets-v2/subheader/subheader.test.tsx +30 -0
- package/src/widgets-v2/subheader/subheader.tsx +16 -0
- package/src/widgets-v2/table/download.test.ts +75 -0
- package/src/widgets-v2/table/download.ts +47 -0
- package/src/widgets-v2/table/helpers.test.ts +214 -0
- package/src/widgets-v2/table/helpers.ts +136 -0
- package/src/widgets-v2/table/index.ts +23 -0
- package/src/widgets-v2/table/labels.tsx +41 -0
- package/src/widgets-v2/table/skeleton.test.tsx +26 -0
- package/src/widgets-v2/table/skeleton.tsx +65 -0
- package/src/widgets-v2/table/style.ts +46 -0
- package/src/widgets-v2/table/table-ui.test.tsx +200 -0
- package/src/widgets-v2/table/table-ui.tsx +331 -0
- package/src/widgets-v2/table/table.test.tsx +119 -0
- package/src/widgets-v2/table/table.tsx +174 -0
- package/src/widgets-v2/table/types.ts +44 -0
- package/src/widgets-v2/test-utils.ts +107 -0
- package/src/widgets-v2/timeseries/download.test.ts +95 -0
- package/src/widgets-v2/timeseries/download.ts +86 -0
- package/src/widgets-v2/timeseries/index.ts +10 -0
- package/src/widgets-v2/timeseries/options.test.ts +379 -0
- package/src/widgets-v2/timeseries/options.ts +341 -0
- package/src/widgets-v2/timeseries/skeleton.test.tsx +13 -0
- package/src/widgets-v2/timeseries/skeleton.tsx +76 -0
- package/src/widgets-v2/timeseries/types.ts +61 -0
- package/src/widgets-v2/toolbox/labels.ts +9 -0
- package/src/widgets-v2/toolbox/style.ts +33 -0
- package/src/widgets-v2/toolbox/toolbox.test.tsx +200 -0
- package/src/widgets-v2/toolbox/toolbox.tsx +309 -0
- package/src/widgets-v2/utils/data-zoom-layout.ts +26 -0
- package/src/widgets-v2/utils/index.ts +2 -0
- package/src/widgets-v2/utils/merge-options.test.ts +52 -0
- package/src/widgets-v2/utils/merge-options.ts +50 -0
- package/src/widgets-v2/wrapper/index.ts +14 -0
- package/src/widgets-v2/wrapper/labels.ts +11 -0
- package/src/widgets-v2/wrapper/style.ts +134 -0
- package/src/widgets-v2/wrapper/widget-actions.test.tsx +52 -0
- package/src/widgets-v2/wrapper/widget-actions.tsx +43 -0
- package/src/widgets-v2/wrapper/widget-content.test.tsx +27 -0
- package/src/widgets-v2/wrapper/widget-content.tsx +29 -0
- package/src/widgets-v2/wrapper/widget-wrapper.test.tsx +159 -0
- package/src/widgets-v2/wrapper/widget-wrapper.tsx +178 -0
- package/dist/styles-BYTyKQFP.js.map +0 -1
|
@@ -0,0 +1,509 @@
|
|
|
1
|
+
import type { Theme } from '@mui/material'
|
|
2
|
+
import type { EChartsOption } from 'echarts'
|
|
3
|
+
import * as echarts from 'echarts'
|
|
4
|
+
import type { CallbackDataParams } from 'echarts/types/dist/shared'
|
|
5
|
+
import {
|
|
6
|
+
buildGridConfig,
|
|
7
|
+
buildLegendConfig,
|
|
8
|
+
buildSeriesLabelConfig,
|
|
9
|
+
createTooltipFormatter,
|
|
10
|
+
createTooltipPositioner,
|
|
11
|
+
niceNum,
|
|
12
|
+
} from '../../widgets/utils/chart-config'
|
|
13
|
+
import type { OptionFactory, OptionFactoryContext } from '../echart'
|
|
14
|
+
import { mergeOptions } from '../utils'
|
|
15
|
+
import type {
|
|
16
|
+
PieEChartsOption,
|
|
17
|
+
PieOptionFactoryInput,
|
|
18
|
+
PieOptionsInput,
|
|
19
|
+
PieWidgetData,
|
|
20
|
+
} from './types'
|
|
21
|
+
|
|
22
|
+
const DEFAULT_RADIUS: readonly [string, string] = ['58%', '74%']
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Builds the **structural** ECharts option for a pie / donut widget.
|
|
26
|
+
* Mirrors v1's pie look-and-feel: themed legend (`buildLegendConfig`),
|
|
27
|
+
* themed tooltip via `createTooltipPositioner` / `createTooltipFormatter`,
|
|
28
|
+
* `qualitative.bold` color palette, slice borders against the paper
|
|
29
|
+
* background, hover-emphasis disabled, and a centered rich-text label.
|
|
30
|
+
*
|
|
31
|
+
* Layered like Bar / Histogram:
|
|
32
|
+
* - **Theme-aware bits** live here on a series template (slice border,
|
|
33
|
+
* center-label rich style sizes, emphasis-disabled).
|
|
34
|
+
* - **Reactive bits** (tooltip value formatter, center-label text,
|
|
35
|
+
* selection-driven dim) are re-emitted by
|
|
36
|
+
* {@link createPieOptionFactory} at fusion time so RelativeData's
|
|
37
|
+
* percent override flows through.
|
|
38
|
+
*/
|
|
39
|
+
export function pieOptions({
|
|
40
|
+
theme,
|
|
41
|
+
formatter,
|
|
42
|
+
labelFormatter,
|
|
43
|
+
}: PieOptionsInput): PieEChartsOption {
|
|
44
|
+
return {
|
|
45
|
+
legend: {
|
|
46
|
+
...buildLegendConfig({ hasLegend: true, labelFormatter }),
|
|
47
|
+
// Pie reads better with a centered legend (the donut is radially
|
|
48
|
+
// symmetric — left-aligning the legend below it visually unbalances
|
|
49
|
+
// the chart). Override `buildLegendConfig`'s `type: 'scroll'` with
|
|
50
|
+
// `'plain'` so long category lists wrap to multiple rows instead
|
|
51
|
+
// of clipping the last visible item against the chart container.
|
|
52
|
+
// The wider `itemGap` gives chips breathing room in the typical
|
|
53
|
+
// 3–6 category case.
|
|
54
|
+
left: 'center',
|
|
55
|
+
type: 'scroll',
|
|
56
|
+
itemGap: 16,
|
|
57
|
+
},
|
|
58
|
+
tooltip: {
|
|
59
|
+
// Pie uses item-trigger (no axis); the rest of the styling mirrors
|
|
60
|
+
// bar/histogram so the dashboard reads consistently — dark
|
|
61
|
+
// grey[900] bg, white caption-font text, padded, with the shared
|
|
62
|
+
// overflow-aware positioner.
|
|
63
|
+
trigger: 'item',
|
|
64
|
+
backgroundColor: theme.palette.grey[900],
|
|
65
|
+
borderWidth: 0,
|
|
66
|
+
padding: [parseInt(theme.spacing(1)), parseInt(theme.spacing(1))],
|
|
67
|
+
textStyle: {
|
|
68
|
+
color: theme.palette.common.white,
|
|
69
|
+
fontSize: 11,
|
|
70
|
+
fontFamily: theme.typography.caption.fontFamily,
|
|
71
|
+
},
|
|
72
|
+
position: createTooltipPositioner(theme),
|
|
73
|
+
formatter: buildPieTooltipFormatter(formatter, labelFormatter),
|
|
74
|
+
},
|
|
75
|
+
// V1 used `qualitative.bold` only (no `secondary.main` prefix) because
|
|
76
|
+
// pie slices are categorical — each slice deserves a distinct palette
|
|
77
|
+
// entry from the start, not a primary highlight.
|
|
78
|
+
color: Object.values(
|
|
79
|
+
(theme.palette as { qualitative?: { bold?: Record<string, string> } })
|
|
80
|
+
.qualitative?.bold ?? {},
|
|
81
|
+
),
|
|
82
|
+
// Pie template. The merger spreads this into each per-data series it
|
|
83
|
+
// emits — borderColor / borderWidth / emphasis-disabled / label rich
|
|
84
|
+
// sizes all survive through.
|
|
85
|
+
series: [
|
|
86
|
+
{
|
|
87
|
+
type: 'pie',
|
|
88
|
+
colorBy: 'data',
|
|
89
|
+
avoidLabelOverlap: true,
|
|
90
|
+
selectedOffset: 0,
|
|
91
|
+
emphasis: { disabled: true },
|
|
92
|
+
itemStyle: {
|
|
93
|
+
borderColor: theme.palette.background.paper,
|
|
94
|
+
borderWidth: 1,
|
|
95
|
+
},
|
|
96
|
+
label: {
|
|
97
|
+
show: true,
|
|
98
|
+
position: 'center',
|
|
99
|
+
rich: {
|
|
100
|
+
b: { fontSize: 16, fontWeight: 'normal', lineHeight: 20 },
|
|
101
|
+
c: { fontSize: 28, fontWeight: 'bold', lineHeight: 27 },
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Returns the pie widget's {@link OptionFactory} — one closure that owns
|
|
111
|
+
* BOTH phases of option construction:
|
|
112
|
+
*
|
|
113
|
+
* - **Structural phase** (`option == null`) — builds the theme-aware
|
|
114
|
+
* structural option via {@link pieOptions}, optionally merging the
|
|
115
|
+
* consumer-supplied `optionsOverride` on top. Called once by Provider
|
|
116
|
+
* to seed `rawOptions` in the store.
|
|
117
|
+
* - **Merge phase** (`option != null`) — fuses post-pipeline `state.data`
|
|
118
|
+
* (`PieWidgetData`) into the option via the dataset API. Single-series
|
|
119
|
+
* → donut (one dataset, `series[i].encode = { itemName: 'name', value: 'value' }`).
|
|
120
|
+
* Multi-series → horizontal-bar fallback (mirrors v1 pie). Reactive
|
|
121
|
+
* formatters from `ctx` drive the tooltip + center label at fusion
|
|
122
|
+
* time so RelativeData's percent formatter flows through without a
|
|
123
|
+
* structural rebuild.
|
|
124
|
+
*/
|
|
125
|
+
export function createPieOptionFactory(
|
|
126
|
+
options: PieOptionFactoryInput,
|
|
127
|
+
): OptionFactory {
|
|
128
|
+
const { theme, formatter, labelFormatter, optionsOverride, seriesNames } =
|
|
129
|
+
options
|
|
130
|
+
const radius = options.radius ?? DEFAULT_RADIUS
|
|
131
|
+
const selection = options.selection
|
|
132
|
+
const selectionSet =
|
|
133
|
+
selection && selection.length > 0
|
|
134
|
+
? new Set<string | number>(selection)
|
|
135
|
+
: null
|
|
136
|
+
return (option, data, ctx) => {
|
|
137
|
+
if (option == null) {
|
|
138
|
+
const structural = pieOptions({ theme, formatter, labelFormatter })
|
|
139
|
+
return optionsOverride
|
|
140
|
+
? (mergeOptions(
|
|
141
|
+
structural as unknown as Record<string, unknown>,
|
|
142
|
+
optionsOverride as Partial<Record<string, unknown>>,
|
|
143
|
+
) as EChartsOption)
|
|
144
|
+
: structural
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const seriesArr = Array.isArray(data) ? (data as PieWidgetData) : []
|
|
148
|
+
if (seriesArr.length === 0) {
|
|
149
|
+
return { ...option, dataset: [], series: [] }
|
|
150
|
+
}
|
|
151
|
+
if (seriesArr.length > 1) {
|
|
152
|
+
return buildMultiSeriesBarFusion(
|
|
153
|
+
option,
|
|
154
|
+
seriesArr,
|
|
155
|
+
theme,
|
|
156
|
+
seriesNames,
|
|
157
|
+
ctx,
|
|
158
|
+
selectionSet,
|
|
159
|
+
)
|
|
160
|
+
}
|
|
161
|
+
return buildSingleSeriesPieFusion(
|
|
162
|
+
option,
|
|
163
|
+
seriesArr,
|
|
164
|
+
radius,
|
|
165
|
+
seriesNames,
|
|
166
|
+
ctx,
|
|
167
|
+
selectionSet,
|
|
168
|
+
)
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Single-series donut fusion. Spreads the structural pie series template
|
|
174
|
+
* into per-data series with center/radius/encoding, wires the reactive
|
|
175
|
+
* center-label / tooltip formatters and the per-data palette-aware
|
|
176
|
+
* selection-dim callback.
|
|
177
|
+
*/
|
|
178
|
+
function buildSingleSeriesPieFusion(
|
|
179
|
+
option: EChartsOption,
|
|
180
|
+
seriesArr: PieWidgetData,
|
|
181
|
+
radius: readonly [string, string],
|
|
182
|
+
seriesNames: readonly string[] | undefined,
|
|
183
|
+
ctx: OptionFactoryContext | undefined,
|
|
184
|
+
selectionSet: Set<string | number> | null,
|
|
185
|
+
): EChartsOption {
|
|
186
|
+
const seriesTemplates = Array.isArray(option.series) ? option.series : []
|
|
187
|
+
const broadcastTemplate = seriesTemplates[0] ?? {}
|
|
188
|
+
const baseTooltip =
|
|
189
|
+
typeof option.tooltip === 'object' && !Array.isArray(option.tooltip)
|
|
190
|
+
? option.tooltip
|
|
191
|
+
: {}
|
|
192
|
+
const baseLegend =
|
|
193
|
+
typeof option.legend === 'object' && !Array.isArray(option.legend)
|
|
194
|
+
? option.legend
|
|
195
|
+
: {}
|
|
196
|
+
const formatter = ctx?.formatter
|
|
197
|
+
const labelFormatter = ctx?.labelFormatter
|
|
198
|
+
|
|
199
|
+
// Pie wants `colorBy: 'data'` — each slice draws from the option's
|
|
200
|
+
// `color` palette by data index. But installing an `itemStyle.color`
|
|
201
|
+
// callback disables ECharts' automatic per-data cycling, and
|
|
202
|
+
// `params.color` collapses to the series color (so every slice goes
|
|
203
|
+
// the same color). We re-implement the per-data palette resolution
|
|
204
|
+
// here so the multicolor look survives selection-driven dimming.
|
|
205
|
+
const palette = Array.isArray(option.color)
|
|
206
|
+
? (option.color as readonly (string | undefined)[])
|
|
207
|
+
: []
|
|
208
|
+
const resolvePaletteColor = (params: CallbackDataParams): string => {
|
|
209
|
+
const swatch =
|
|
210
|
+
palette.length > 0
|
|
211
|
+
? palette[params.dataIndex % palette.length]
|
|
212
|
+
: undefined
|
|
213
|
+
return swatch ?? (params.color as string)
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// Always emit `itemStyle.color` (passthrough when nothing is selected),
|
|
217
|
+
// not conditionally — same anti-stale-callback rationale as bar /
|
|
218
|
+
// histogram. The slice border + width come from the structural
|
|
219
|
+
// template's `itemStyle` and survive via the spread below.
|
|
220
|
+
const colorFn = (params: CallbackDataParams): string => {
|
|
221
|
+
const base = resolvePaletteColor(params)
|
|
222
|
+
if (!selectionSet) return base
|
|
223
|
+
const datum = params.value as { name?: string | number } | undefined
|
|
224
|
+
const name = datum?.name ?? params.name
|
|
225
|
+
return name != null && selectionSet.has(name)
|
|
226
|
+
? base
|
|
227
|
+
: echarts.color.modifyAlpha(base, 0.15)
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// Center label formatter — lives in the merger because it reads
|
|
231
|
+
// reactive `formatter` / `labelFormatter` from ctx. The rich tags
|
|
232
|
+
// `{c|…}` and `{b|…}` reference the rich styles baked into the
|
|
233
|
+
// structural label template.
|
|
234
|
+
const labelTextFormatter = (params: CallbackDataParams): string => {
|
|
235
|
+
const { name } = params
|
|
236
|
+
const encodeIndex = params.encode?.value?.[0]
|
|
237
|
+
if (encodeIndex === undefined) return ''
|
|
238
|
+
const value = (Object.values(params.data ?? {}) as unknown[]).at(
|
|
239
|
+
encodeIndex,
|
|
240
|
+
)
|
|
241
|
+
// `value` here is the resolved dataset cell — for pie data it's a
|
|
242
|
+
// `string | number` primitive. Anything else is a misuse we won't
|
|
243
|
+
// dress up with `String(...)` (would render "[object Object]").
|
|
244
|
+
const formattedValue =
|
|
245
|
+
typeof value === 'number'
|
|
246
|
+
? formatter
|
|
247
|
+
? formatter(value)
|
|
248
|
+
: String(value)
|
|
249
|
+
: typeof value === 'string'
|
|
250
|
+
? value
|
|
251
|
+
: ''
|
|
252
|
+
const formattedName = labelFormatter
|
|
253
|
+
? String(labelFormatter(name ?? ''))
|
|
254
|
+
: String(name ?? '')
|
|
255
|
+
return `{c|${formattedValue}}\n\n{b|${formattedName}}`
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
return {
|
|
259
|
+
...option,
|
|
260
|
+
dataset: seriesArr.map((s) => ({ source: s as readonly object[] })),
|
|
261
|
+
series: seriesArr.map((_, i) => {
|
|
262
|
+
const template =
|
|
263
|
+
(seriesTemplates[i] as object | undefined) ??
|
|
264
|
+
(broadcastTemplate as object)
|
|
265
|
+
const templateObj = typeof template === 'object' ? template : {}
|
|
266
|
+
const templateLabel = (templateObj as { label?: object }).label ?? {}
|
|
267
|
+
const templateItemStyle =
|
|
268
|
+
(templateObj as { itemStyle?: object }).itemStyle ?? {}
|
|
269
|
+
return {
|
|
270
|
+
...templateObj,
|
|
271
|
+
type: 'pie' as const,
|
|
272
|
+
datasetIndex: i,
|
|
273
|
+
name: seriesNames?.[i] ?? `Series ${i + 1}`,
|
|
274
|
+
radius: [...radius],
|
|
275
|
+
// Lift the donut up so the bottom-anchored legend has the
|
|
276
|
+
// vertical real estate to wrap to multiple rows for long
|
|
277
|
+
// category lists — at exactly `50%` the bottom slices crowd
|
|
278
|
+
// the chips and `type: 'plain'` legends can't expand upward
|
|
279
|
+
// without overlapping the donut.
|
|
280
|
+
center: ['50%', '38%'] as [string, string],
|
|
281
|
+
encode: { itemName: 'name', value: 'value' },
|
|
282
|
+
label: {
|
|
283
|
+
...templateLabel,
|
|
284
|
+
formatter: labelTextFormatter,
|
|
285
|
+
},
|
|
286
|
+
itemStyle: {
|
|
287
|
+
...templateItemStyle,
|
|
288
|
+
color: colorFn,
|
|
289
|
+
},
|
|
290
|
+
}
|
|
291
|
+
}),
|
|
292
|
+
// Legend always shows for pie (mirrors v1) — slice names drive the
|
|
293
|
+
// entries, so even a single donut benefits from a category list.
|
|
294
|
+
legend: { ...baseLegend, show: true },
|
|
295
|
+
tooltip: {
|
|
296
|
+
...baseTooltip,
|
|
297
|
+
formatter: buildPieTooltipFormatter(formatter, labelFormatter),
|
|
298
|
+
},
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Multi-series horizontal-bar fusion. Mirrors v1 pie's "pie data with
|
|
304
|
+
* >1 series collapses into a horizontal bar chart" behavior — side-by-
|
|
305
|
+
* side donuts don't read well when you're comparing the same categories
|
|
306
|
+
* across cohorts, so swap to a value-on-x / category-on-y bar layout.
|
|
307
|
+
*
|
|
308
|
+
* Pie data shape is identical to bar's (`{ name, value }[][]`), so the
|
|
309
|
+
* same dataset feeds either layout without transformation.
|
|
310
|
+
*/
|
|
311
|
+
function buildMultiSeriesBarFusion(
|
|
312
|
+
option: EChartsOption,
|
|
313
|
+
seriesArr: PieWidgetData,
|
|
314
|
+
theme: Theme,
|
|
315
|
+
seriesNames: readonly string[] | undefined,
|
|
316
|
+
ctx: OptionFactoryContext | undefined,
|
|
317
|
+
selectionSet: Set<string | number> | null,
|
|
318
|
+
): EChartsOption {
|
|
319
|
+
const baseTooltip =
|
|
320
|
+
typeof option.tooltip === 'object' && !Array.isArray(option.tooltip)
|
|
321
|
+
? option.tooltip
|
|
322
|
+
: {}
|
|
323
|
+
const baseLegend =
|
|
324
|
+
typeof option.legend === 'object' && !Array.isArray(option.legend)
|
|
325
|
+
? option.legend
|
|
326
|
+
: {}
|
|
327
|
+
const baseGrid =
|
|
328
|
+
typeof option.grid === 'object' && !Array.isArray(option.grid)
|
|
329
|
+
? option.grid
|
|
330
|
+
: {}
|
|
331
|
+
const formatter = ctx?.formatter
|
|
332
|
+
const labelFormatter = ctx?.labelFormatter
|
|
333
|
+
|
|
334
|
+
const { niceMinVal, niceMaxVal } = computeNiceBounds(seriesArr)
|
|
335
|
+
|
|
336
|
+
// Per-series palette — multi-series bars take one color per series
|
|
337
|
+
// (not per-data, unlike donut slices). Same anti-stale-callback rule:
|
|
338
|
+
// always emit the callback so a transition to/from a selection
|
|
339
|
+
// replaces the previous closure cleanly.
|
|
340
|
+
const palette = Array.isArray(option.color)
|
|
341
|
+
? (option.color as readonly (string | undefined)[])
|
|
342
|
+
: []
|
|
343
|
+
const barColorFn = (params: CallbackDataParams): string => {
|
|
344
|
+
const seriesIdx = params.seriesIndex ?? 0
|
|
345
|
+
const seriesSwatch =
|
|
346
|
+
palette.length > 0 ? palette[seriesIdx % palette.length] : undefined
|
|
347
|
+
const base = (seriesSwatch ?? params.color) as string
|
|
348
|
+
if (!selectionSet) return base
|
|
349
|
+
const datum = params.value as { name?: string | number } | undefined
|
|
350
|
+
const name = datum?.name ?? params.name
|
|
351
|
+
return name != null && selectionSet.has(name)
|
|
352
|
+
? base
|
|
353
|
+
: echarts.color.modifyAlpha(base, 0.15)
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
return {
|
|
357
|
+
...option,
|
|
358
|
+
dataset: seriesArr.map((s) => ({ source: s as readonly object[] })),
|
|
359
|
+
grid: {
|
|
360
|
+
...baseGrid,
|
|
361
|
+
...buildGridConfig(true, theme),
|
|
362
|
+
right: parseInt(theme.spacing(4)),
|
|
363
|
+
containLabel: true,
|
|
364
|
+
},
|
|
365
|
+
// Drop pie-specific structural keys that shouldn't render in the
|
|
366
|
+
// bar fallback. ECharts ignores undefined keys, so this is a clean
|
|
367
|
+
// override.
|
|
368
|
+
series: seriesArr.map((_, i) => ({
|
|
369
|
+
datasetIndex: i,
|
|
370
|
+
type: 'bar' as const,
|
|
371
|
+
name: seriesNames?.[i] ?? `Series ${i + 1}`,
|
|
372
|
+
barMaxWidth: 100,
|
|
373
|
+
emphasis: { focus: 'series' },
|
|
374
|
+
...buildSeriesLabelConfig(formatter, 'x'),
|
|
375
|
+
itemStyle: { color: barColorFn },
|
|
376
|
+
})),
|
|
377
|
+
xAxis: {
|
|
378
|
+
type: 'value',
|
|
379
|
+
// Closures over the pre-computed nice bounds — ECharts calls them
|
|
380
|
+
// once per render to resolve the axis extents.
|
|
381
|
+
min: () => niceMinVal,
|
|
382
|
+
max: () => niceMaxVal,
|
|
383
|
+
axisLine: { show: false },
|
|
384
|
+
axisTick: { show: false },
|
|
385
|
+
splitLine: {
|
|
386
|
+
show: true,
|
|
387
|
+
lineStyle: { color: theme.palette.black?.[4] ?? theme.palette.divider },
|
|
388
|
+
},
|
|
389
|
+
// Value labels render BELOW the axis line (default placement),
|
|
390
|
+
// NOT inside the plot. Bar/histogram use `inside: true` +
|
|
391
|
+
// `verticalAlign: 'bottom'` for their *vertical* y-axis where the
|
|
392
|
+
// axis is the left wall — labels inside read like grid annotations.
|
|
393
|
+
// A horizontal bar chart's value axis is the x-axis, and `inside`
|
|
394
|
+
// there pushes the max label *behind* the bar (it visually
|
|
395
|
+
// disappears once a bar reaches the right edge). Use the default
|
|
396
|
+
// below-the-axis placement so the rounded extents stay readable.
|
|
397
|
+
axisLabel: {
|
|
398
|
+
fontSize: theme.typography.overlineDelicate?.fontSize,
|
|
399
|
+
fontFamily: theme.typography.overlineDelicate?.fontFamily,
|
|
400
|
+
margin: parseInt(theme.spacing(1)),
|
|
401
|
+
showMaxLabel: true,
|
|
402
|
+
showMinLabel: true,
|
|
403
|
+
formatter: (value: number) => {
|
|
404
|
+
if (value !== niceMaxVal && value !== niceMinVal) return ''
|
|
405
|
+
if (value === 0) return ''
|
|
406
|
+
return formatter ? formatter(value) : String(value)
|
|
407
|
+
},
|
|
408
|
+
},
|
|
409
|
+
},
|
|
410
|
+
yAxis: {
|
|
411
|
+
type: 'category',
|
|
412
|
+
axisLine: { show: false },
|
|
413
|
+
axisTick: { show: false },
|
|
414
|
+
axisLabel: {
|
|
415
|
+
padding: [parseInt(theme.spacing(0.5)), 0, 0, 0],
|
|
416
|
+
...(labelFormatter && {
|
|
417
|
+
formatter: (value: string | number) => String(labelFormatter(value)),
|
|
418
|
+
}),
|
|
419
|
+
},
|
|
420
|
+
},
|
|
421
|
+
legend: { ...baseLegend, show: true },
|
|
422
|
+
tooltip: {
|
|
423
|
+
...baseTooltip,
|
|
424
|
+
trigger: 'axis',
|
|
425
|
+
formatter: buildHorizontalBarTooltipFormatter(formatter, labelFormatter),
|
|
426
|
+
},
|
|
427
|
+
} as EChartsOption
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* Tooltip formatter for the horizontal-bar fallback. Reads the value by
|
|
432
|
+
* `encode.x` dimension index (v1 parity) so it stays robust to
|
|
433
|
+
* downstream changes that rename dataset columns.
|
|
434
|
+
*/
|
|
435
|
+
function buildHorizontalBarTooltipFormatter(
|
|
436
|
+
formatter: ((value: number) => string) | undefined,
|
|
437
|
+
labelFormatter: ((value: string | number) => string | number) | undefined,
|
|
438
|
+
) {
|
|
439
|
+
return createTooltipFormatter((item) => {
|
|
440
|
+
const encodeIndex = item.encode?.x?.at(0)
|
|
441
|
+
const dimName =
|
|
442
|
+
encodeIndex !== undefined ? item.dimensionNames?.[encodeIndex] : undefined
|
|
443
|
+
const row =
|
|
444
|
+
item.value && typeof item.value === 'object' && !Array.isArray(item.value)
|
|
445
|
+
? (item.value as Record<string, string | number>)
|
|
446
|
+
: undefined
|
|
447
|
+
const raw = dimName && row ? row[dimName] : undefined
|
|
448
|
+
const formattedValue =
|
|
449
|
+
typeof raw === 'number' && formatter ? formatter(raw) : (raw ?? '')
|
|
450
|
+
const marker = typeof item.marker === 'string' ? item.marker : ''
|
|
451
|
+
const seriesName = item.seriesName ? `${item.seriesName}: ` : ''
|
|
452
|
+
const name = labelFormatter
|
|
453
|
+
? String(labelFormatter(item.name ?? ''))
|
|
454
|
+
: String(item.name ?? '')
|
|
455
|
+
return { name, seriesName, marker, value: formattedValue }
|
|
456
|
+
})
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
/**
|
|
460
|
+
* Min/max bounds over every datum's `.value` across all series. Used by
|
|
461
|
+
* the horizontal-bar fallback's x-axis label formatter so we only render
|
|
462
|
+
* labels at the rounded extents (matches v1 + bar / histogram).
|
|
463
|
+
*/
|
|
464
|
+
function computeNiceBounds(seriesArr: PieWidgetData): {
|
|
465
|
+
niceMinVal: number
|
|
466
|
+
niceMaxVal: number
|
|
467
|
+
} {
|
|
468
|
+
let min = 0
|
|
469
|
+
let max = -Infinity
|
|
470
|
+
for (const series of seriesArr) {
|
|
471
|
+
for (const d of series) {
|
|
472
|
+
if (typeof d?.value !== 'number' || !Number.isFinite(d.value)) continue
|
|
473
|
+
if (d.value < min) min = d.value
|
|
474
|
+
if (d.value > max) max = d.value
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
return {
|
|
478
|
+
niceMinVal: min < 0 ? niceNum(min) : 0,
|
|
479
|
+
niceMaxVal: max <= 0 ? 1 : niceNum(max),
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* Tooltip formatter for pie slices. `item.value` is the dataset row
|
|
485
|
+
* object (e.g. `{ name: 'A', value: 10 }`); we pull the value by
|
|
486
|
+
* `encode.value`'s dimension index, formatted via the reactive `formatter`
|
|
487
|
+
* if present. Slice name passes through `labelFormatter`.
|
|
488
|
+
*/
|
|
489
|
+
function buildPieTooltipFormatter(
|
|
490
|
+
formatter: ((value: number) => string) | undefined,
|
|
491
|
+
labelFormatter: ((value: string | number) => string | number) | undefined,
|
|
492
|
+
) {
|
|
493
|
+
return createTooltipFormatter((item) => {
|
|
494
|
+
const encodeIndex = item.encode?.value?.at(0) ?? 1
|
|
495
|
+
const values =
|
|
496
|
+
item.value && typeof item.value === 'object' && !Array.isArray(item.value)
|
|
497
|
+
? (Object.values(item.value) as (string | number)[])
|
|
498
|
+
: []
|
|
499
|
+
const raw = values[encodeIndex]
|
|
500
|
+
const formattedValue =
|
|
501
|
+
typeof raw === 'number' && formatter ? formatter(raw) : (raw ?? '')
|
|
502
|
+
const marker = typeof item.marker === 'string' ? item.marker : ''
|
|
503
|
+
const seriesName = item.seriesName ? `${item.seriesName}: ` : ''
|
|
504
|
+
const name = labelFormatter
|
|
505
|
+
? String(labelFormatter(item.name ?? ''))
|
|
506
|
+
: String(item.name ?? '')
|
|
507
|
+
return { name, seriesName, marker, value: formattedValue }
|
|
508
|
+
})
|
|
509
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest'
|
|
2
|
+
import { render } from '@testing-library/react'
|
|
3
|
+
import { PieSkeleton } from './skeleton'
|
|
4
|
+
|
|
5
|
+
describe('<PieSkeleton>', () => {
|
|
6
|
+
it('renders the default single-donut skeleton', () => {
|
|
7
|
+
const { container } = render(<PieSkeleton />)
|
|
8
|
+
expect(
|
|
9
|
+
container.querySelectorAll('.MuiSkeleton-root').length,
|
|
10
|
+
).toBeGreaterThan(0)
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
it('scales with count', () => {
|
|
14
|
+
const { container } = render(<PieSkeleton count={3} />)
|
|
15
|
+
expect(container.firstChild).not.toBeNull()
|
|
16
|
+
})
|
|
17
|
+
})
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Box, Skeleton } from '@mui/material'
|
|
2
|
+
import type { SxProps, Theme } from '@mui/material'
|
|
3
|
+
|
|
4
|
+
const styles = {
|
|
5
|
+
root: {
|
|
6
|
+
display: 'flex',
|
|
7
|
+
alignItems: 'center',
|
|
8
|
+
justifyContent: 'center',
|
|
9
|
+
minHeight: 200,
|
|
10
|
+
py: 1,
|
|
11
|
+
gap: 2,
|
|
12
|
+
},
|
|
13
|
+
donut: {
|
|
14
|
+
width: 160,
|
|
15
|
+
height: 160,
|
|
16
|
+
borderRadius: '50%',
|
|
17
|
+
},
|
|
18
|
+
} satisfies Record<string, SxProps<Theme>>
|
|
19
|
+
|
|
20
|
+
export interface PieSkeletonProps {
|
|
21
|
+
count?: number
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function PieSkeleton({ count = 1 }: PieSkeletonProps) {
|
|
25
|
+
return (
|
|
26
|
+
<Box sx={styles.root}>
|
|
27
|
+
{Array.from({ length: count }).map((_, i) => (
|
|
28
|
+
<Skeleton key={`donut-${i}`} variant='circular' sx={styles.donut} />
|
|
29
|
+
))}
|
|
30
|
+
</Box>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { Theme } from '@mui/material'
|
|
2
|
+
import type { EChartsOption } from 'echarts'
|
|
3
|
+
|
|
4
|
+
/** A single slice of a pie series. */
|
|
5
|
+
export interface PieDatum {
|
|
6
|
+
name: string | number
|
|
7
|
+
value: number
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/** Pie widget data — one slice array per series (rendered as side-by-side donuts). */
|
|
11
|
+
export type PieWidgetData = readonly (readonly PieDatum[])[]
|
|
12
|
+
|
|
13
|
+
/** Inputs to the structural-only {@link pieOptions} builder. */
|
|
14
|
+
export interface PieOptionsInput {
|
|
15
|
+
theme: Theme
|
|
16
|
+
/** Numeric value formatter — drives the tooltip value and center label. */
|
|
17
|
+
formatter?: (value: number) => string
|
|
18
|
+
/** Optional slice-name formatter — also forwarded to the legend. */
|
|
19
|
+
labelFormatter?: (value: string | number) => string | number
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Combined inputs for the pie option factory creator. Carries everything
|
|
24
|
+
* the widget needs across BOTH phases — the structural-build (`theme`,
|
|
25
|
+
* `formatter`, `labelFormatter`, `optionsOverride`) AND the data merge
|
|
26
|
+
* (`seriesNames`, `radius`, `selection`). The merger emits different
|
|
27
|
+
* chart shapes by series count: single → donut, multi → horizontal-bar
|
|
28
|
+
* fallback (mirrors v1 pie); both branches read `theme` for styling.
|
|
29
|
+
*/
|
|
30
|
+
export interface PieOptionFactoryInput {
|
|
31
|
+
theme: Theme
|
|
32
|
+
formatter?: (value: number) => string
|
|
33
|
+
labelFormatter?: (value: string | number) => string | number
|
|
34
|
+
/** Series names — drives the legend and series.name. */
|
|
35
|
+
seriesNames?: readonly string[]
|
|
36
|
+
/**
|
|
37
|
+
* Inner/outer radius (percent). Default `['58%', '74%']` produces a
|
|
38
|
+
* donut sized to leave room for the wrappable bottom legend. Set
|
|
39
|
+
* inner to `'0%'` for a solid pie.
|
|
40
|
+
*/
|
|
41
|
+
radius?: readonly [string, string]
|
|
42
|
+
/**
|
|
43
|
+
* Selected slice names. Slices not in this list render dimmed
|
|
44
|
+
* (`itemStyle.opacity: 0.15`). `null`/empty means no selection.
|
|
45
|
+
*/
|
|
46
|
+
selection?: readonly (string | number)[] | null
|
|
47
|
+
/**
|
|
48
|
+
* Consumer-supplied partial option merged into the structural option at
|
|
49
|
+
* structural-build time. Lets stories override pieces of the theme-aware
|
|
50
|
+
* base without forking the structural builder.
|
|
51
|
+
*/
|
|
52
|
+
optionsOverride?: Partial<EChartsOption>
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export type PieEChartsOption = EChartsOption
|