@carto/ps-react-ui 4.7.1 → 4.9.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/{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-l4fNHLEg.js +213 -0
- package/dist/range-l4fNHLEg.js.map +1 -0
- package/dist/resolve-theme-color-BdojIw0K.js +47 -0
- package/dist/resolve-theme-color-BdojIw0K.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-CQCAnDLb.js +388 -0
- package/dist/table-CQCAnDLb.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 +46 -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 +53 -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 +43 -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 +51 -0
- package/dist/types/widgets-v2/index.d.ts +108 -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 +57 -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 +27 -0
- package/dist/types/widgets-v2/range/range.d.ts +24 -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 +54 -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 +40 -0
- package/dist/types/widgets-v2/table/table-ui.d.ts +44 -0
- package/dist/types/widgets-v2/table/table.d.ts +50 -0
- package/dist/types/widgets-v2/table/types.d.ts +48 -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 +60 -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/types.d.ts +25 -0
- package/dist/types/widgets-v2/utils/data-zoom-layout.d.ts +11 -0
- package/dist/types/widgets-v2/utils/index.d.ts +3 -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/utils/resolve-theme-color.d.ts +18 -0
- package/dist/types/widgets-v2/utils/resolve-theme-color.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/bar.js +14 -13
- package/dist/widgets/bar.js.map +1 -1
- package/dist/widgets/histogram.js +8 -7
- 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 +330 -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 +353 -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 +387 -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 +411 -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 +358 -0
- package/dist/widgets-v2/timeseries.js.map +1 -0
- package/dist/widgets-v2/utils.js +8 -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 +71 -3
- 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-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/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 +334 -0
- package/src/widgets-v2/bar/options.ts +332 -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 +51 -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 +59 -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 +48 -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 +318 -0
- package/src/widgets-v2/histogram/options.ts +338 -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 +55 -0
- package/src/widgets-v2/index.ts +204 -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 +601 -0
- package/src/widgets-v2/pie/options.ts +513 -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 +62 -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 +136 -0
- package/src/widgets-v2/range/range-ui.tsx +278 -0
- package/src/widgets-v2/range/range.test.tsx +68 -0
- package/src/widgets-v2/range/range.tsx +52 -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 +411 -0
- package/src/widgets-v2/scatterplot/options.ts +425 -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 +59 -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 +43 -0
- package/src/widgets-v2/table/table-ui.test.tsx +200 -0
- package/src/widgets-v2/table/table-ui.tsx +364 -0
- package/src/widgets-v2/table/table.test.tsx +119 -0
- package/src/widgets-v2/table/table.tsx +179 -0
- package/src/widgets-v2/table/types.ts +55 -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 +394 -0
- package/src/widgets-v2/timeseries/options.ts +348 -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 +65 -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/types.ts +25 -0
- package/src/widgets-v2/utils/data-zoom-layout.ts +26 -0
- package/src/widgets-v2/utils/index.ts +3 -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/utils/resolve-theme-color.test.ts +43 -0
- package/src/widgets-v2/utils/resolve-theme-color.ts +34 -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,154 @@
|
|
|
1
|
+
import { useEffect, type ComponentType } from 'react'
|
|
2
|
+
import { IconButton, type SvgIconProps } from '@mui/material'
|
|
3
|
+
import HighlightAltIcon from '@mui/icons-material/HighlightAlt'
|
|
4
|
+
import { Tooltip } from '../../../components'
|
|
5
|
+
import {
|
|
6
|
+
useEchartInstance,
|
|
7
|
+
useSingleTransform,
|
|
8
|
+
useWidgetId,
|
|
9
|
+
} from '../../stores'
|
|
10
|
+
import { addBrush } from './transforms'
|
|
11
|
+
import { DEFAULT_BRUSH_TOGGLE_LABELS, type BrushToggleLabels } from './labels'
|
|
12
|
+
import { styles } from './style'
|
|
13
|
+
|
|
14
|
+
const BRUSH_DESCRIPTOR = {
|
|
15
|
+
id: 'brush-toggle',
|
|
16
|
+
type: 'config' as const,
|
|
17
|
+
order: 25,
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface BrushToggleProps {
|
|
21
|
+
initialEnabled?: boolean
|
|
22
|
+
/**
|
|
23
|
+
* ECharts brush type. `'lineX'` (default) selects a range on the
|
|
24
|
+
* x-axis — appropriate for bar / histogram / timeseries. `'rect'`
|
|
25
|
+
* selects a 2-D rectangle — use for scatterplot. Other ECharts
|
|
26
|
+
* brush types (`'lineY'`, `'polygon'`) are also accepted.
|
|
27
|
+
*/
|
|
28
|
+
brushType?: 'lineX' | 'lineY' | 'rect' | 'polygon'
|
|
29
|
+
/**
|
|
30
|
+
* `'multiple'` (default) lets the user draw additional brushes on
|
|
31
|
+
* top of existing ones. `'single'` replaces the previous brush on
|
|
32
|
+
* each new draw.
|
|
33
|
+
*/
|
|
34
|
+
brushMode?: 'multiple' | 'single'
|
|
35
|
+
/**
|
|
36
|
+
* Optional view of the consumer-owned selection. When provided and
|
|
37
|
+
* the array is empty (`[]`), any brush rectangles currently drawn on
|
|
38
|
+
* the chart are wiped — keeps the UI in sync when the parent clears
|
|
39
|
+
* the selection externally (e.g. via `Widget.SelectionSummary`'s
|
|
40
|
+
* `onClear`). Pass the same array that drives `useChartSelection` /
|
|
41
|
+
* the option factory's `selection` input.
|
|
42
|
+
*
|
|
43
|
+
* Leave `undefined` to opt out — the sync effect becomes a no-op.
|
|
44
|
+
*/
|
|
45
|
+
selection?: readonly unknown[] | null
|
|
46
|
+
labels?: Partial<BrushToggleLabels>
|
|
47
|
+
icon?: ComponentType<SvgIconProps>
|
|
48
|
+
iconProps?: SvgIconProps
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Toggle ECharts' brush selection mode. Two-part wiring:
|
|
53
|
+
*
|
|
54
|
+
* 1. The config transform (`addBrush`) installs the `brush`
|
|
55
|
+
* component on the option so brushed items get the
|
|
56
|
+
* `outOfBrush` dim treatment.
|
|
57
|
+
* 2. ECharts only enters "brush cursor" mode when something
|
|
58
|
+
* dispatches `takeGlobalCursor({ key: 'brush', ... })`. This
|
|
59
|
+
* component drives that dispatch via {@link useEchartInstance},
|
|
60
|
+
* reacting when the chart instance becomes available (the
|
|
61
|
+
* `BrushToggle` mounts before `Widget.Echart` in tree order, so
|
|
62
|
+
* on first mount the chart isn't ready yet).
|
|
63
|
+
*
|
|
64
|
+
* 3. ECharts clears the global cursor on every `setOption`, so we
|
|
65
|
+
* re-dispatch on each `'finished'` event — required for
|
|
66
|
+
* `brushMode: 'multiple'` to keep working across selection-driven
|
|
67
|
+
* re-renders, RelativeData toggles, etc.
|
|
68
|
+
*
|
|
69
|
+
* Selection events (`brushSelected` / `brushEnd`) flow through the
|
|
70
|
+
* existing `useChartSelection` wiring at the consumer level — no extra
|
|
71
|
+
* plumbing here.
|
|
72
|
+
*/
|
|
73
|
+
export function BrushToggle({
|
|
74
|
+
initialEnabled = false,
|
|
75
|
+
brushType = 'lineX',
|
|
76
|
+
brushMode = 'multiple',
|
|
77
|
+
selection,
|
|
78
|
+
labels,
|
|
79
|
+
icon: Icon = HighlightAltIcon,
|
|
80
|
+
iconProps,
|
|
81
|
+
}: BrushToggleProps) {
|
|
82
|
+
const id = useWidgetId()
|
|
83
|
+
const _labels = { ...DEFAULT_BRUSH_TOGGLE_LABELS, ...labels }
|
|
84
|
+
const { enabled, toggle } = useSingleTransform(
|
|
85
|
+
id,
|
|
86
|
+
BRUSH_DESCRIPTOR,
|
|
87
|
+
addBrush,
|
|
88
|
+
{ initialEnabled },
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
// Reactive read of the live instance — the effect below re-runs when
|
|
92
|
+
// the chart arrives, departs, or re-inits, instead of polling.
|
|
93
|
+
const chart = useEchartInstance(id)
|
|
94
|
+
|
|
95
|
+
useEffect(() => {
|
|
96
|
+
if (!chart) return undefined
|
|
97
|
+
if (!enabled) {
|
|
98
|
+
// Disabled: exit brush cursor and wipe any drawn rectangles.
|
|
99
|
+
chart.dispatchAction({ type: 'takeGlobalCursor' })
|
|
100
|
+
chart.dispatchAction({ type: 'brush', areas: [] })
|
|
101
|
+
return undefined
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const enterBrush = (): void => {
|
|
105
|
+
chart.dispatchAction({
|
|
106
|
+
type: 'takeGlobalCursor',
|
|
107
|
+
key: 'brush',
|
|
108
|
+
brushOption: { brushType, brushMode },
|
|
109
|
+
})
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Every `setOption` clears the global cursor. Re-dispatch after
|
|
113
|
+
// each chart render so `brushMode: 'multiple'` stays usable across
|
|
114
|
+
// selection-driven re-renders, RelativeData toggles, etc.
|
|
115
|
+
const onFinished = (): void => enterBrush()
|
|
116
|
+
chart.on('finished', onFinished)
|
|
117
|
+
enterBrush()
|
|
118
|
+
|
|
119
|
+
return () => {
|
|
120
|
+
chart.off('finished', onFinished)
|
|
121
|
+
}
|
|
122
|
+
}, [chart, enabled, brushType, brushMode])
|
|
123
|
+
|
|
124
|
+
// Sync the drawn rectangles with the external selection. When the
|
|
125
|
+
// parent flips `selection` to `[]` (e.g. SelectionSummary's "Clear"
|
|
126
|
+
// button), wipe the brush areas so the chart UI matches the data.
|
|
127
|
+
// Dispatching with an empty `areas` array when nothing is drawn is a
|
|
128
|
+
// safe no-op on ECharts, so no extra "previous value" bookkeeping is
|
|
129
|
+
// needed. Kept as a separate effect so a parent selection change
|
|
130
|
+
// doesn't tear down / re-attach the `'finished'` listener above.
|
|
131
|
+
useEffect(() => {
|
|
132
|
+
if (!chart || !enabled) return
|
|
133
|
+
if (selection?.length === 0) {
|
|
134
|
+
chart.dispatchAction({ type: 'brush', areas: [] })
|
|
135
|
+
}
|
|
136
|
+
}, [chart, enabled, selection])
|
|
137
|
+
|
|
138
|
+
const tooltip = enabled ? _labels.on : _labels.off
|
|
139
|
+
|
|
140
|
+
return (
|
|
141
|
+
<Tooltip title={tooltip}>
|
|
142
|
+
<IconButton
|
|
143
|
+
size='small'
|
|
144
|
+
aria-label={tooltip}
|
|
145
|
+
aria-pressed={enabled}
|
|
146
|
+
onClick={toggle}
|
|
147
|
+
className={enabled ? 'active' : undefined}
|
|
148
|
+
sx={{ ...styles.toggle, ...(enabled && styles.toggleActive) }}
|
|
149
|
+
>
|
|
150
|
+
<Icon fontSize='small' {...iconProps} />
|
|
151
|
+
</IconButton>
|
|
152
|
+
</Tooltip>
|
|
153
|
+
)
|
|
154
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SxProps, Theme } from '@mui/material'
|
|
2
|
+
|
|
3
|
+
export const styles = {
|
|
4
|
+
toggle: {
|
|
5
|
+
p: 0.5,
|
|
6
|
+
'& .MuiSvgIcon-root': { fontSize: 20 },
|
|
7
|
+
},
|
|
8
|
+
toggleActive: {
|
|
9
|
+
background: (theme: Theme) => theme.palette.primary.relatedLight,
|
|
10
|
+
},
|
|
11
|
+
} satisfies Record<string, SxProps<Theme>>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest'
|
|
2
|
+
import { addBrush } from './transforms'
|
|
3
|
+
|
|
4
|
+
describe('addBrush', () => {
|
|
5
|
+
it('adds a brush block with rect/clear toolbox', () => {
|
|
6
|
+
const out = addBrush({}) as {
|
|
7
|
+
brush: { toolbox: string[]; xAxisIndex: string }
|
|
8
|
+
}
|
|
9
|
+
expect(out.brush.toolbox).toEqual(['rect', 'clear'])
|
|
10
|
+
expect(out.brush.xAxisIndex).toBe('all')
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
it('configures outOfBrush dim alpha at 0.15 (matches v1)', () => {
|
|
14
|
+
const out = addBrush({}) as {
|
|
15
|
+
brush: { outOfBrush: { colorAlpha: number } }
|
|
16
|
+
}
|
|
17
|
+
expect(out.brush.outOfBrush.colorAlpha).toBe(0.15)
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
it('adds the toolbox.feature.brush so the user gets the brush UI', () => {
|
|
21
|
+
const out = addBrush({}) as {
|
|
22
|
+
toolbox: { feature: { brush: { type: string[] } } }
|
|
23
|
+
}
|
|
24
|
+
expect(out.toolbox.feature.brush.type).toEqual(['rect', 'clear'])
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
it('preserves an existing toolbox config and adds the brush feature on top', () => {
|
|
28
|
+
const seeded = {
|
|
29
|
+
toolbox: { right: 8, feature: { saveAsImage: {} } },
|
|
30
|
+
}
|
|
31
|
+
const out = addBrush(seeded) as {
|
|
32
|
+
toolbox: {
|
|
33
|
+
right: number
|
|
34
|
+
feature: { saveAsImage: object; brush: object }
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
expect(out.toolbox.right).toBe(8)
|
|
38
|
+
expect(out.toolbox.feature.saveAsImage).toEqual({})
|
|
39
|
+
expect(out.toolbox.feature.brush).toBeDefined()
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
it('returns the input unchanged when not an object', () => {
|
|
43
|
+
expect(addBrush(null)).toBe(null)
|
|
44
|
+
expect(addBrush(undefined)).toBe(undefined)
|
|
45
|
+
expect(addBrush(42)).toBe(42)
|
|
46
|
+
})
|
|
47
|
+
})
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Brush config transform: enables ECharts' brush component on the option
|
|
3
|
+
* object. Module-level constant — identity stable across renders.
|
|
4
|
+
*
|
|
5
|
+
* Pairs with `replaceMergeKeys: ['brush']` so the pipeline replaces (not
|
|
6
|
+
* merges) the brush config on every config-pipeline run. v1 needed a
|
|
7
|
+
* mousemove re-dispatch hack to keep the brush state across data updates;
|
|
8
|
+
* v2 keeps brush state continuous via `notMerge: false` + dynamic
|
|
9
|
+
* replaceMerge in the EchartUI layer (D6) — no hack required.
|
|
10
|
+
*/
|
|
11
|
+
export const addBrush = (option: unknown): unknown => {
|
|
12
|
+
if (option == null || typeof option !== 'object') return option
|
|
13
|
+
const cfg = option as Record<string, unknown>
|
|
14
|
+
return {
|
|
15
|
+
...cfg,
|
|
16
|
+
brush: {
|
|
17
|
+
toolbox: ['rect', 'clear'],
|
|
18
|
+
xAxisIndex: 'all',
|
|
19
|
+
brushLink: 'all',
|
|
20
|
+
outOfBrush: { colorAlpha: 0.15 },
|
|
21
|
+
},
|
|
22
|
+
toolbox: {
|
|
23
|
+
...((cfg.toolbox as object | undefined) ?? {}),
|
|
24
|
+
show: false,
|
|
25
|
+
feature: {
|
|
26
|
+
...((cfg.toolbox as { feature?: object } | undefined)?.feature ?? {}),
|
|
27
|
+
brush: { type: ['rect', 'clear'] },
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SvgIcon, type SvgIconProps } from '@mui/material'
|
|
2
|
+
|
|
3
|
+
export function ChangeColumnIcon(props: SvgIconProps) {
|
|
4
|
+
return (
|
|
5
|
+
<SvgIcon viewBox='0 0 18 18' {...props}>
|
|
6
|
+
<path
|
|
7
|
+
fill='currentColor'
|
|
8
|
+
fillRule='evenodd'
|
|
9
|
+
d='M14.25 2.25H3.75c-.825 0-1.5.675-1.5 1.5v10.5c0 .825.675 1.5 1.5 1.5h10.5c.825 0 1.5-.675 1.5-1.5V3.75c0-.825-.675-1.5-1.5-1.5m-3.75 12h-3V3.75h3zM3.75 3.75H6v10.5H3.75zM12 14.25V3.75h2.25v10.5z'
|
|
10
|
+
clipRule='evenodd'
|
|
11
|
+
/>
|
|
12
|
+
</SvgIcon>
|
|
13
|
+
)
|
|
14
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { describe, it, expect, beforeEach, afterEach } from 'vitest'
|
|
2
|
+
import { fireEvent, render, screen } from '@testing-library/react'
|
|
3
|
+
import { Provider } from '../../provider/widget-provider'
|
|
4
|
+
import { clearAllWidgetStores, getWidgetStore } from '../../stores'
|
|
5
|
+
import { ChangeColumn } from './change-column'
|
|
6
|
+
import type { ChangeColumnWidgetState } from './types'
|
|
7
|
+
|
|
8
|
+
beforeEach(() => clearAllWidgetStores())
|
|
9
|
+
afterEach(() => clearAllWidgetStores())
|
|
10
|
+
|
|
11
|
+
const ITEMS = [
|
|
12
|
+
{ id: 'a', label: 'Alpha' },
|
|
13
|
+
{ id: 'b', label: 'Beta' },
|
|
14
|
+
{ id: 'c', label: 'Gamma' },
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
describe('<ChangeColumn>', () => {
|
|
18
|
+
it('renders nothing when fewer than two columns are provided', () => {
|
|
19
|
+
const { container } = render(
|
|
20
|
+
<Provider id='cc1' data={[]}>
|
|
21
|
+
<ChangeColumn columns={[ITEMS[0]!]} />
|
|
22
|
+
</Provider>,
|
|
23
|
+
)
|
|
24
|
+
expect(container.querySelector('button')).toBeNull()
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
it('renders the trigger and opens the menu listing every column in order', () => {
|
|
28
|
+
render(
|
|
29
|
+
<Provider id='cc2' data={[]}>
|
|
30
|
+
<ChangeColumn columns={ITEMS} labels={{ trigger: 'Reorder' }} />
|
|
31
|
+
</Provider>,
|
|
32
|
+
)
|
|
33
|
+
fireEvent.click(screen.getByLabelText('Reorder'))
|
|
34
|
+
const items = screen.getAllByRole('menuitem')
|
|
35
|
+
expect(items.map((el) => el.textContent)).toEqual([
|
|
36
|
+
'Alpha',
|
|
37
|
+
'Beta',
|
|
38
|
+
'Gamma',
|
|
39
|
+
])
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
it('uses columnOrder from the store when present', () => {
|
|
43
|
+
render(
|
|
44
|
+
<Provider id='cc3' data={[]}>
|
|
45
|
+
<ChangeColumn columns={ITEMS} labels={{ trigger: 'Reorder' }} />
|
|
46
|
+
</Provider>,
|
|
47
|
+
)
|
|
48
|
+
getWidgetStore('cc3').setState({
|
|
49
|
+
columnOrder: ['c', 'a', 'b'],
|
|
50
|
+
} as Partial<ChangeColumnWidgetState>)
|
|
51
|
+
fireEvent.click(screen.getByLabelText('Reorder'))
|
|
52
|
+
const items = screen.getAllByRole('menuitem')
|
|
53
|
+
expect(items.map((el) => el.textContent)).toEqual([
|
|
54
|
+
'Gamma',
|
|
55
|
+
'Alpha',
|
|
56
|
+
'Beta',
|
|
57
|
+
])
|
|
58
|
+
})
|
|
59
|
+
})
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { useCallback, useMemo, useState, type ComponentType } from 'react'
|
|
2
|
+
import {
|
|
3
|
+
DndContext,
|
|
4
|
+
KeyboardSensor,
|
|
5
|
+
PointerSensor,
|
|
6
|
+
closestCenter,
|
|
7
|
+
useSensor,
|
|
8
|
+
useSensors,
|
|
9
|
+
type DragEndEvent,
|
|
10
|
+
} from '@dnd-kit/core'
|
|
11
|
+
import {
|
|
12
|
+
SortableContext,
|
|
13
|
+
arrayMove,
|
|
14
|
+
sortableKeyboardCoordinates,
|
|
15
|
+
verticalListSortingStrategy,
|
|
16
|
+
} from '@dnd-kit/sortable'
|
|
17
|
+
import { IconButton, Menu, type SvgIconProps } from '@mui/material'
|
|
18
|
+
import { Tooltip } from '../../../components'
|
|
19
|
+
import { getWidgetStore, useWidget, useWidgetId } from '../../stores'
|
|
20
|
+
import { ChangeColumnIcon } from './change-column-icon'
|
|
21
|
+
import { DEFAULT_CHANGE_COLUMN_LABELS, type ChangeColumnLabels } from './labels'
|
|
22
|
+
import { SortableColumnItem } from './sortable-column-item'
|
|
23
|
+
import { styles } from './style'
|
|
24
|
+
import type { ChangeColumnWidgetState } from './types'
|
|
25
|
+
import type { ReactNode } from 'react'
|
|
26
|
+
|
|
27
|
+
export interface ChangeColumnItem {
|
|
28
|
+
id: string
|
|
29
|
+
label: ReactNode
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface ChangeColumnProps {
|
|
33
|
+
/**
|
|
34
|
+
* Master list of columns (id + label) in their default order. The current
|
|
35
|
+
* effective order is derived by combining this list with the widget's
|
|
36
|
+
* `columnOrder` extension state.
|
|
37
|
+
*/
|
|
38
|
+
columns: readonly ChangeColumnItem[]
|
|
39
|
+
labels?: Partial<ChangeColumnLabels>
|
|
40
|
+
icon?: ComponentType<SvgIconProps>
|
|
41
|
+
iconProps?: SvgIconProps
|
|
42
|
+
dragHandleIcon?: ComponentType<SvgIconProps>
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Action that lets users reorder columns via drag-and-drop. The new order is
|
|
47
|
+
* persisted on the widget store as `columnOrder` (an array of ids) on the
|
|
48
|
+
* {@link ChangeColumnWidgetState} extension. `<Table>` (and other column-aware
|
|
49
|
+
* bridges) merge that order with their own `columns` prop via
|
|
50
|
+
* `resolveColumns()` from the table primitives.
|
|
51
|
+
*
|
|
52
|
+
* Returns `null` when there are fewer than two columns to reorder.
|
|
53
|
+
*/
|
|
54
|
+
export function ChangeColumn({
|
|
55
|
+
columns,
|
|
56
|
+
labels,
|
|
57
|
+
icon: Icon = ChangeColumnIcon,
|
|
58
|
+
iconProps,
|
|
59
|
+
dragHandleIcon,
|
|
60
|
+
}: ChangeColumnProps) {
|
|
61
|
+
const id = useWidgetId()
|
|
62
|
+
const _labels = { ...DEFAULT_CHANGE_COLUMN_LABELS, ...labels }
|
|
63
|
+
const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null)
|
|
64
|
+
|
|
65
|
+
const columnOrder = useWidget<
|
|
66
|
+
readonly string[] | undefined,
|
|
67
|
+
ChangeColumnWidgetState
|
|
68
|
+
>(id, (s) => s.columnOrder)
|
|
69
|
+
|
|
70
|
+
const orderedIds = useMemo(() => {
|
|
71
|
+
const masterIds = columns.map((c) => c.id)
|
|
72
|
+
if (!columnOrder || columnOrder.length === 0) return masterIds
|
|
73
|
+
// Set lookup so membership tests stay O(1) regardless of column count.
|
|
74
|
+
const masterIdSet = new Set(masterIds)
|
|
75
|
+
const seen = new Set<string>()
|
|
76
|
+
const out: string[] = []
|
|
77
|
+
for (const cid of columnOrder) {
|
|
78
|
+
if (masterIdSet.has(cid) && !seen.has(cid)) {
|
|
79
|
+
out.push(cid)
|
|
80
|
+
seen.add(cid)
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
for (const cid of masterIds) {
|
|
84
|
+
if (!seen.has(cid)) out.push(cid)
|
|
85
|
+
}
|
|
86
|
+
return out
|
|
87
|
+
}, [columnOrder, columns])
|
|
88
|
+
|
|
89
|
+
const orderedColumns = useMemo(() => {
|
|
90
|
+
const byId = new Map(columns.map((c) => [c.id, c]))
|
|
91
|
+
// Single pass instead of map().filter() — skips unknown ids inline.
|
|
92
|
+
const out: ChangeColumnItem[] = []
|
|
93
|
+
for (const cid of orderedIds) {
|
|
94
|
+
const c = byId.get(cid)
|
|
95
|
+
if (c != null) out.push(c)
|
|
96
|
+
}
|
|
97
|
+
return out
|
|
98
|
+
}, [orderedIds, columns])
|
|
99
|
+
|
|
100
|
+
const sensors = useSensors(
|
|
101
|
+
useSensor(PointerSensor),
|
|
102
|
+
useSensor(KeyboardSensor, {
|
|
103
|
+
coordinateGetter: sortableKeyboardCoordinates,
|
|
104
|
+
}),
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
const handleOpen = useCallback((e: React.MouseEvent<HTMLElement>) => {
|
|
108
|
+
e.stopPropagation()
|
|
109
|
+
setAnchorEl(e.currentTarget)
|
|
110
|
+
}, [])
|
|
111
|
+
const handleClose = useCallback(() => setAnchorEl(null), [])
|
|
112
|
+
|
|
113
|
+
const handleDragEnd = useCallback(
|
|
114
|
+
(event: DragEndEvent) => {
|
|
115
|
+
const { active, over } = event
|
|
116
|
+
if (!over || active.id === over.id) return
|
|
117
|
+
const oldIndex = orderedIds.indexOf(String(active.id))
|
|
118
|
+
const newIndex = orderedIds.indexOf(String(over.id))
|
|
119
|
+
if (oldIndex === -1 || newIndex === -1) return
|
|
120
|
+
const next = arrayMove([...orderedIds], oldIndex, newIndex)
|
|
121
|
+
getWidgetStore(id).setState({
|
|
122
|
+
columnOrder: next,
|
|
123
|
+
} as Partial<ChangeColumnWidgetState>)
|
|
124
|
+
},
|
|
125
|
+
[id, orderedIds],
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
if (columns.length < 2) return null
|
|
129
|
+
|
|
130
|
+
const isOpen = Boolean(anchorEl)
|
|
131
|
+
|
|
132
|
+
return (
|
|
133
|
+
<>
|
|
134
|
+
<Tooltip title={_labels.trigger}>
|
|
135
|
+
<IconButton
|
|
136
|
+
size='small'
|
|
137
|
+
aria-label={_labels.trigger}
|
|
138
|
+
aria-pressed={isOpen}
|
|
139
|
+
aria-haspopup='true'
|
|
140
|
+
aria-controls={isOpen ? 'change-column-menu' : undefined}
|
|
141
|
+
aria-expanded={isOpen ? 'true' : undefined}
|
|
142
|
+
onClick={handleOpen}
|
|
143
|
+
className={isOpen ? 'active' : undefined}
|
|
144
|
+
sx={{ ...styles.toggle, ...(isOpen && styles.toggleActive) }}
|
|
145
|
+
>
|
|
146
|
+
<Icon fontSize='small' {...iconProps} />
|
|
147
|
+
</IconButton>
|
|
148
|
+
</Tooltip>
|
|
149
|
+
<DndContext
|
|
150
|
+
sensors={sensors}
|
|
151
|
+
collisionDetection={closestCenter}
|
|
152
|
+
onDragEnd={handleDragEnd}
|
|
153
|
+
>
|
|
154
|
+
<Menu
|
|
155
|
+
id='change-column-menu'
|
|
156
|
+
anchorEl={anchorEl}
|
|
157
|
+
open={isOpen}
|
|
158
|
+
onClose={handleClose}
|
|
159
|
+
anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }}
|
|
160
|
+
transformOrigin={{ vertical: 'top', horizontal: 'right' }}
|
|
161
|
+
slotProps={{ paper: { sx: styles.menuPaper } }}
|
|
162
|
+
>
|
|
163
|
+
<SortableContext
|
|
164
|
+
items={orderedIds}
|
|
165
|
+
strategy={verticalListSortingStrategy}
|
|
166
|
+
>
|
|
167
|
+
{orderedColumns.map((column) => (
|
|
168
|
+
<SortableColumnItem
|
|
169
|
+
key={column.id}
|
|
170
|
+
id={column.id}
|
|
171
|
+
label={column.label}
|
|
172
|
+
dragHandleIcon={dragHandleIcon}
|
|
173
|
+
/>
|
|
174
|
+
))}
|
|
175
|
+
</SortableContext>
|
|
176
|
+
</Menu>
|
|
177
|
+
</DndContext>
|
|
178
|
+
</>
|
|
179
|
+
)
|
|
180
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { useSortable } from '@dnd-kit/sortable'
|
|
2
|
+
import { CSS } from '@dnd-kit/utilities'
|
|
3
|
+
import { ListItemText, MenuItem } from '@mui/material'
|
|
4
|
+
import DragIndicatorIcon from '@mui/icons-material/DragIndicator'
|
|
5
|
+
import type { ComponentType, ReactNode } from 'react'
|
|
6
|
+
import type { SvgIconProps } from '@mui/material'
|
|
7
|
+
import { styles } from './style'
|
|
8
|
+
|
|
9
|
+
export interface SortableColumnItemProps {
|
|
10
|
+
id: string
|
|
11
|
+
label: ReactNode
|
|
12
|
+
dragHandleIcon?: ComponentType<SvgIconProps>
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Draggable menu item used inside ChangeColumn's `<DndContext>`. Wraps a
|
|
17
|
+
* MUI `<MenuItem>` so it inherits keyboard / theming behavior, and exposes
|
|
18
|
+
* the dnd-kit listeners on the whole row so the user can grab anywhere on
|
|
19
|
+
* the row to reorder.
|
|
20
|
+
*/
|
|
21
|
+
export function SortableColumnItem({
|
|
22
|
+
id,
|
|
23
|
+
label,
|
|
24
|
+
dragHandleIcon: HandleIcon = DragIndicatorIcon,
|
|
25
|
+
}: SortableColumnItemProps) {
|
|
26
|
+
const {
|
|
27
|
+
attributes,
|
|
28
|
+
listeners,
|
|
29
|
+
setNodeRef,
|
|
30
|
+
transform,
|
|
31
|
+
transition,
|
|
32
|
+
isDragging,
|
|
33
|
+
} = useSortable({ id })
|
|
34
|
+
|
|
35
|
+
const transformStyle = {
|
|
36
|
+
transform: CSS.Transform.toString(
|
|
37
|
+
transform ? { ...transform, x: 0 } : null,
|
|
38
|
+
),
|
|
39
|
+
transition,
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<MenuItem
|
|
44
|
+
ref={setNodeRef}
|
|
45
|
+
style={transformStyle}
|
|
46
|
+
{...attributes}
|
|
47
|
+
{...listeners}
|
|
48
|
+
role='menuitem'
|
|
49
|
+
tabIndex={0}
|
|
50
|
+
sx={{ ...styles.item, ...(isDragging && styles.itemDragging) }}
|
|
51
|
+
>
|
|
52
|
+
<HandleIcon sx={styles.dragHandle} />
|
|
53
|
+
<ListItemText>{label}</ListItemText>
|
|
54
|
+
</MenuItem>
|
|
55
|
+
)
|
|
56
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { SxProps, Theme } from '@mui/material'
|
|
2
|
+
|
|
3
|
+
export const styles = {
|
|
4
|
+
toggle: {
|
|
5
|
+
p: 0.5,
|
|
6
|
+
'& .MuiSvgIcon-root': { fontSize: 20 },
|
|
7
|
+
},
|
|
8
|
+
toggleActive: {
|
|
9
|
+
background: (theme: Theme) => theme.palette.primary.relatedLight,
|
|
10
|
+
},
|
|
11
|
+
menuPaper: {
|
|
12
|
+
overflow: 'hidden',
|
|
13
|
+
minWidth: 220,
|
|
14
|
+
},
|
|
15
|
+
item: {
|
|
16
|
+
cursor: 'grab',
|
|
17
|
+
'&:focus-visible': {
|
|
18
|
+
outline: '2px solid',
|
|
19
|
+
outlineColor: 'primary.main',
|
|
20
|
+
outlineOffset: -2,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
itemDragging: {
|
|
24
|
+
opacity: 0.5,
|
|
25
|
+
cursor: 'grabbing',
|
|
26
|
+
},
|
|
27
|
+
dragHandle: {
|
|
28
|
+
color: 'text.secondary',
|
|
29
|
+
mr: 1,
|
|
30
|
+
fontSize: 18,
|
|
31
|
+
},
|
|
32
|
+
} satisfies Record<string, SxProps<Theme>>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { WidgetState } from '../../stores'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* State extension owned by the ChangeColumn action. Stored on the per-widget
|
|
5
|
+
* Zustand store; read by `<Table>` (and any other column-aware bridge) to
|
|
6
|
+
* resolve the effective column order.
|
|
7
|
+
*/
|
|
8
|
+
export interface ChangeColumnWidgetState extends WidgetState {
|
|
9
|
+
/** Ordered list of column ids. Empty / unset means "use props order". */
|
|
10
|
+
columnOrder?: readonly string[]
|
|
11
|
+
}
|