@marimo-team/frontend 0.15.5 → 0.16.0-dev96986
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/assets/ConnectedDataExplorerComponent-CNLoZkWr.js +19 -0
- package/dist/assets/{ImageComparisonComponent-CEXMKKA4.js → ImageComparisonComponent-SX7fDaTK.js} +1 -1
- package/dist/assets/{VegaLite-Bt14Ds9k.js → VegaLite-MJUW3b7C.js} +6 -6
- package/dist/assets/_baseEach-9_logFrf.js +1 -0
- package/dist/assets/_baseMap-NzEbKt5c.js +1 -0
- package/dist/assets/_baseUniq-C5LFcyNC.js +1 -0
- package/dist/assets/_createAggregator-ZRm2b6Zm.js +1 -0
- package/dist/assets/agent-panel-BBd11wNX.js +287 -0
- package/dist/assets/agent-panel-D92Mfy1i.css +1 -0
- package/dist/assets/{any-language-editor-DiwNT6zp.js → any-language-editor-DwAaEQfS.js} +1 -1
- package/dist/assets/architectureDiagram-W76B3OCA-BJmVXUoW.js +36 -0
- package/dist/assets/{between-horizontal-start-FyewyCGn.js → between-horizontal-start-KiwU-a3C.js} +1 -1
- package/dist/assets/{blockDiagram-QIGZ2CNN-BrOkAf_c.js → blockDiagram-QIGZ2CNN-DzxZjE7B.js} +1 -1
- package/dist/assets/{c4Diagram-FPNF74CW-BHPzDxE2.js → c4Diagram-FPNF74CW-DjmldG_J.js} +5 -5
- package/dist/assets/channel-DHcKBVM4.js +1 -0
- package/dist/assets/chat-panel-DgJZr0eS.js +3 -0
- package/dist/assets/{chunk-4BX2VUAB-DLxaCNYh.js → chunk-4BX2VUAB-EUTQThiZ.js} +1 -1
- package/dist/assets/{chunk-55IACEB6-DdzvO3HR.js → chunk-55IACEB6-DZAiDJxy.js} +1 -1
- package/dist/assets/{chunk-FMBD7UC4-R5o-nSiG.js → chunk-FMBD7UC4-Bd0Czs-J.js} +1 -1
- package/dist/assets/{chunk-K7UQS3LO-DxaMrGgG.js → chunk-K7UQS3LO-DEKMIknX.js} +1 -1
- package/dist/assets/{chunk-QN33PNHL-DqS9-FYm.js → chunk-QN33PNHL-E0jwHU_n.js} +1 -1
- package/dist/assets/{chunk-QZHKN3VN-BZ-TzajS.js → chunk-QZHKN3VN-BzaIHJbq.js} +1 -1
- package/dist/assets/{chunk-TVAH2DTR-BsgP2dyv.js → chunk-TVAH2DTR-CZFYvqnm.js} +1 -1
- package/dist/assets/{chunk-TZMSLE5B-D-h3ahXI.js → chunk-TZMSLE5B-BNqnFjtv.js} +1 -1
- package/dist/assets/{circle-play-CQtRZ-rT.js → circle-play-D3J_mYrF.js} +1 -1
- package/dist/assets/classDiagram-KNZD7YFC-D-xwLnlX.js +1 -0
- package/dist/assets/classDiagram-v2-RKCZMP56-D-xwLnlX.js +1 -0
- package/dist/assets/{clear-button-BY6Z_ViL.js → clear-button-ifzRuAR3.js} +1 -1
- package/dist/assets/clone-CSxIll62.js +1 -0
- package/dist/assets/command-palette-D2fdVSET.js +1 -0
- package/dist/assets/common-Ku-cF_2J.js +1 -0
- package/dist/assets/{compile-Ct_jzdKr.js → compile-BgZlHW1c.js} +1 -1
- package/dist/assets/cose-bilkent-S5V4N54A-CVM83SqK.js +1 -0
- package/dist/assets/dagre-5GWH7T2D-ouQPkxT3.js +4 -0
- package/dist/assets/{data-grid-overlay-editor-BN_wulc3.js → data-grid-overlay-editor-B47j5GJJ.js} +1 -1
- package/dist/assets/datasources-panel-Bt41Zir-.js +1 -0
- package/dist/assets/{dependency-graph-panel-BOmSCZf7.js → dependency-graph-panel-CZC_B7pK.js} +4 -4
- package/dist/assets/diagram-N5W7TBWH-CQ817ZdR.js +24 -0
- package/dist/assets/diagram-QEK2KX5R-DOK_psUO.js +43 -0
- package/dist/assets/diagram-S2PKOQOG-CVljmOW8.js +24 -0
- package/dist/assets/{documentation-panel-BxjJO_Gw.js → documentation-panel-C7yIvGg1.js} +1 -1
- package/dist/assets/edit-page-CyTMQV2u.js +129 -0
- package/dist/assets/{ellipsis-vertical-UHbmjI2n.js → ellipsis-vertical-C7FjlUsY.js} +1 -1
- package/dist/assets/{empty-state-BIBXzY_0.js → empty-state-DIOGM_CU.js} +1 -1
- package/dist/assets/{erDiagram-AWTI2OKA-E84mAle_.js → erDiagram-AWTI2OKA-DYu8cEdc.js} +1 -1
- package/dist/assets/{error-panel-MEvQ6K7h.js → error-panel-Ddb8RkFG.js} +1 -1
- package/dist/assets/file-explorer-panel-Oy9DbyFP.js +1 -0
- package/dist/assets/{flowDiagram-PVAE7QVJ-DfbIRSAW.js → flowDiagram-PVAE7QVJ-CmvW5iTb.js} +1 -1
- package/dist/assets/{ganttDiagram-OWAHRB6G-DR4HZ1z_.js → ganttDiagram-OWAHRB6G-BaKQlCaT.js} +4 -4
- package/dist/assets/gitGraphDiagram-NY62KEGX-CWO24eP6.js +65 -0
- package/dist/assets/{glide-data-editor-nNmo1lPq.js → glide-data-editor-CNDLEJ9a.js} +11 -11
- package/dist/assets/graph-BZKTtxsc.js +1 -0
- package/dist/assets/home-page-Bvwppn9N.js +9 -0
- package/dist/assets/{index-VPWqq2Pg.js → index-0XOUPdwT.js} +1 -1
- package/dist/assets/{index-uacyUula.js → index-BH7f3aiU.js} +1 -1
- package/dist/assets/{index-Dt9UWeWn.js → index-BJVyzkx5.js} +1 -1
- package/dist/assets/{index-BAH034Ue.js → index-B_d_JZGI.js} +1 -1
- package/dist/assets/{index-CB2pnVQG.js → index-BgXbBA39.js} +1 -1
- package/dist/assets/{index-B8llrTSo.js → index-Brf2DwUM.js} +1 -1
- package/dist/assets/{index-BLu5CX6z.js → index-CXrWwFX6.js} +1 -1
- package/dist/assets/{index-DyLSuOH1.js → index-CZaurnA9.js} +1 -1
- package/dist/assets/{index-BFSnz7iM.js → index-CerjupfZ.js} +1 -1
- package/dist/assets/{index-B7yXbrLa.js → index-D-tZfElD.js} +1 -1
- package/dist/assets/{index-c6If577Q.js → index-D3PqGupX.js} +1 -1
- package/dist/assets/{index-CSgxTUzD.js → index-DCkzth56.js} +1 -1
- package/dist/assets/{index-DWOaniGT.js → index-DFrGFNW1.js} +1 -1
- package/dist/assets/{index-CPN7TRA1.js → index-DZhOPkOB.js} +1 -1
- package/dist/assets/index-DadI618h.css +1 -0
- package/dist/assets/{index-DqzMPAC8.js → index-DkntzpX4.js} +2 -2
- package/dist/assets/{index-B1_GXGaP.js → index-DmgwT3sx.js} +1 -1
- package/dist/assets/index-PmY0x4Zd.js +578 -0
- package/dist/assets/{index-Bq516OmX.js → index-WXJFkQHg.js} +1 -1
- package/dist/assets/{index-DSU75csX.js → index-qE8lHQ-N.js} +1 -1
- package/dist/assets/{index-DMomwMcN.js → index-zrSUQXha.js} +1 -1
- package/dist/assets/infoDiagram-STP46IZ2-CAuVVehw.js +2 -0
- package/dist/assets/isEmpty-D1t7Gran.js +1 -0
- package/dist/assets/{journeyDiagram-BIP6EPQ6-BBiFyygf.js → journeyDiagram-BIP6EPQ6-D4Rp6H_h.js} +1 -1
- package/dist/assets/{kanban-definition-6OIFK2YF-DhgA6Nt6.js → kanban-definition-6OIFK2YF-DFt9DftA.js} +4 -4
- package/dist/assets/layout-D8WXi2_g.js +1 -0
- package/dist/assets/linear-BwY8e5hA.js +1 -0
- package/dist/assets/links-4B6ldZ5P.js +7 -0
- package/dist/assets/{logs-panel-B9SmTZAW.js → logs-panel-Dxiyt7dO.js} +1 -1
- package/dist/assets/{agent-panel-DpQ6muj-.css → markdown-renderer-ClyzDMmG.css} +1 -1
- package/dist/assets/markdown-renderer-VDu-NBKB.js +263 -0
- package/dist/assets/mermaid-B-O-Puyi.js +1 -0
- package/dist/assets/{mermaid.core-4nVOEVX3.js → mermaid.core-BFFCqfOn.js} +41 -41
- package/dist/assets/min-DtVSfYKl.js +1 -0
- package/dist/assets/{mindmap-definition-Q6HEUPPD-CVLQNn1q.js → mindmap-definition-Q6HEUPPD-kyvIY8Dg.js} +2 -2
- package/dist/assets/{number-overlay-editor-CzRzXLcd.js → number-overlay-editor-GjLB2UK4.js} +1 -1
- package/dist/assets/outline-panel-CMJjOoN7.js +1 -0
- package/dist/assets/packages-panel-nfXB-bKW.js +1 -0
- package/dist/assets/{pieDiagram-ADFJNKIX-C5IQ5DBZ.js → pieDiagram-ADFJNKIX-D8JFQcWR.js} +3 -3
- package/dist/assets/{quadrantDiagram-LMRXKWRM-CFXFnQxx.js → quadrantDiagram-LMRXKWRM-Nf8GzxXG.js} +1 -1
- package/dist/assets/{react-plotly-mzdv02_Y.js → react-plotly-CnW9p7ZA.js} +1 -1
- package/dist/assets/{requirementDiagram-4UW4RH46-D9bPC89T.js → requirementDiagram-4UW4RH46-CCUxF8BZ.js} +1 -1
- package/dist/assets/run-page-Bl4p3AbZ.js +1 -0
- package/dist/assets/sankeyDiagram-GR3RE2ED-Sr8kDwP1.js +10 -0
- package/dist/assets/scratchpad-panel-Ja1Mu-W3.js +1 -0
- package/dist/assets/secrets-panel-B-3fcSyP.js +1 -0
- package/dist/assets/{sequenceDiagram-C3RYC4MD-6N7_hY4k.js → sequenceDiagram-C3RYC4MD-CBJ152Q3.js} +4 -4
- package/dist/assets/{slides-component-DMjQomc3.css → slides-component-C-LoGC1U.css} +1 -1
- package/dist/assets/{slides-component-EcjC8sDK.js → slides-component-DGtsVP5o.js} +1 -1
- package/dist/assets/snippets-panel-ClNnwKBM.js +1 -0
- package/dist/assets/sortBy-D47H6Vyl.js +1 -0
- package/dist/assets/state-B_RCHTH5.js +1 -0
- package/dist/assets/stateDiagram-KXAO66HF-BlBFSAZr.js +1 -0
- package/dist/assets/stateDiagram-v2-UMBNRL4Z-DbA-iToo.js +1 -0
- package/dist/assets/storage-BNcWOH3-.js +26 -0
- package/dist/assets/terminal-CATzv5Hd.js +10 -0
- package/dist/assets/time-CsYqILfB.js +1 -0
- package/dist/assets/{timeline-definition-XQNQX7LJ-BEaynAiY.js → timeline-definition-XQNQX7LJ-CGrhjuAs.js} +1 -1
- package/dist/assets/tracing-DUbJtOyq.js +2 -0
- package/dist/assets/{tracing-panel-BmuHLPrY.js → tracing-panel-DmzqPUtc.js} +2 -2
- package/dist/assets/{trash-UBqfK4mR.js → trash-rxdjLzkf.js} +1 -1
- package/dist/assets/{tree-XiEycetl.js → tree-C2Ul1h1C.js} +1 -1
- package/dist/assets/{treemap-75Q7IDZK-CnuVFbBG.js → treemap-75Q7IDZK-N9hyUpyj.js} +20 -20
- package/dist/assets/{ts-tags-CloPe9IY.js → ts-tags-DxCDHihD.js} +1 -1
- package/dist/assets/variable-panel-BbgupOdG.js +1 -0
- package/dist/assets/{vega-component-DsTH4tuX.js → vega-component-CR_MHOBT.js} +1 -1
- package/dist/assets/worker-fHbtoWvT.js +1 -0
- package/dist/assets/{xychartDiagram-6GGTOJPD-Dcz3O-A3.js → xychartDiagram-6GGTOJPD-jdLZsMb2.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +10 -5
- package/src/__tests__/mocks.ts +43 -0
- package/src/components/app-config/user-config-form.tsx +78 -1
- package/src/components/chat/acp/__tests__/__snapshots__/prompt.test.ts.snap +116 -65
- package/src/components/chat/acp/__tests__/atoms.test.ts +1 -1
- package/src/components/chat/acp/__tests__/context-utils.test.ts +222 -0
- package/src/components/chat/acp/__tests__/prompt.test.ts +1 -1
- package/src/components/chat/acp/__tests__/state.test.ts +38 -42
- package/src/components/chat/acp/agent-docs.tsx +33 -6
- package/src/components/chat/acp/agent-panel.css +0 -18
- package/src/components/chat/acp/agent-panel.tsx +394 -72
- package/src/components/chat/acp/agent-selector.tsx +7 -1
- package/src/components/chat/acp/blocks.tsx +40 -10
- package/src/components/chat/acp/common.tsx +10 -2
- package/src/components/chat/acp/context-utils.ts +127 -0
- package/src/components/chat/acp/prompt.ts +96 -53
- package/src/components/chat/acp/state.ts +1 -1
- package/src/components/chat/acp/types.ts +8 -0
- package/src/components/chat/chat-panel.tsx +28 -89
- package/src/components/chat/chat-utils.ts +127 -1
- package/src/components/chat/markdown-renderer.css +39 -0
- package/src/components/chat/markdown-renderer.tsx +12 -47
- package/src/components/chat/tool-call-accordion.tsx +148 -26
- package/src/components/data-table/SearchBar.tsx +8 -7
- package/src/components/data-table/__tests__/column_formatting.test.ts +50 -35
- package/src/components/data-table/__tests__/data-table.test.tsx +39 -1
- package/src/components/data-table/cell-hover-template/feature.ts +14 -0
- package/src/components/data-table/cell-hover-template/types.ts +11 -0
- package/src/components/data-table/charts/components/form-fields.tsx +41 -37
- package/src/components/data-table/charts/forms/common-chart.tsx +2 -2
- package/src/components/data-table/column-explorer-panel/column-explorer.tsx +5 -2
- package/src/components/data-table/column-formatting/feature.ts +62 -29
- package/src/components/data-table/column-formatting/types.ts +1 -0
- package/src/components/data-table/column-header.tsx +3 -1
- package/src/components/data-table/column-summary/chart-spec-model.tsx +24 -7
- package/src/components/data-table/column-summary/column-summary.tsx +18 -9
- package/src/components/data-table/columns.tsx +42 -18
- package/src/components/data-table/data-table.tsx +10 -2
- package/src/components/data-table/date-popover.tsx +85 -75
- package/src/components/data-table/filter-pills.tsx +14 -9
- package/src/components/data-table/header-items.tsx +5 -1
- package/src/components/data-table/pagination.tsx +20 -13
- package/src/components/data-table/renderers.tsx +28 -0
- package/src/components/data-table/row-viewer-panel/row-viewer.tsx +10 -8
- package/src/components/datasources/column-preview.tsx +6 -2
- package/src/components/datasources/datasources.tsx +8 -12
- package/src/components/editor/Cell.tsx +6 -0
- package/src/components/editor/actions/name-cell-input.tsx +6 -1
- package/src/components/editor/actions/useCellActionButton.tsx +3 -1
- package/src/components/editor/ai/__tests__/completion-utils.test.ts +178 -1
- package/src/components/editor/ai/add-cell-with-ai.tsx +68 -66
- package/src/components/editor/ai/ai-completion-editor.tsx +29 -26
- package/src/components/editor/ai/completion-handlers.tsx +44 -6
- package/src/components/editor/ai/completion-utils.ts +92 -0
- package/src/components/editor/ai/transport/chat-transport.tsx +39 -0
- package/src/components/editor/cell/CellStatus.tsx +23 -20
- package/src/components/editor/cell/CreateCellButton.tsx +3 -4
- package/src/components/editor/cell/StagedAICell.tsx +51 -0
- package/src/components/editor/cell/cell-actions.tsx +2 -1
- package/src/components/editor/cell/code/language-toggle.tsx +3 -4
- package/src/components/editor/chrome/wrapper/footer-items/machine-stats.tsx +39 -28
- package/src/components/editor/controls/notebook-menu-dropdown.tsx +4 -2
- package/src/components/editor/file-tree/requesting-tree.tsx +14 -8
- package/src/components/editor/renderers/CellArray.tsx +3 -4
- package/src/components/editor/renderers/slides-layout/slides-layout.tsx +3 -3
- package/src/components/editor/renderers/slides-layout/types.ts +1 -0
- package/src/components/pages/home-page.tsx +4 -1
- package/src/components/slides/slides-component.tsx +1 -1
- package/src/components/slides/slides.css +6 -0
- package/src/components/terminal/__tests__/state.test.ts +207 -0
- package/src/components/terminal/hooks.ts +41 -0
- package/src/components/terminal/state.ts +75 -0
- package/src/components/terminal/terminal.tsx +334 -13
- package/src/components/terminal/theme.tsx +57 -0
- package/src/components/tracing/tracing-spec.ts +5 -4
- package/src/components/ui/range-slider.tsx +4 -2
- package/src/components/ui/slider.tsx +3 -1
- package/src/components/variables/variables-table.tsx +3 -0
- package/src/core/MarimoApp.tsx +9 -6
- package/src/core/ai/__tests__/staged-cells.test.ts +356 -0
- package/src/core/ai/context/__tests__/registry.test.ts +6 -4
- package/src/core/ai/context/providers/cell-output.ts +3 -2
- package/src/core/ai/context/providers/error.ts +3 -1
- package/src/core/ai/context/providers/file.ts +7 -2
- package/src/core/ai/context/providers/tables.ts +3 -2
- package/src/core/ai/context/providers/variable.ts +6 -4
- package/src/core/ai/staged-cells.ts +208 -0
- package/src/core/cells/cells.ts +1 -1
- package/src/core/cells/logs.ts +1 -1
- package/src/core/codemirror/find-replace/search-highlight.ts +3 -1
- package/src/core/codemirror/language/LanguageAdapters.ts +9 -3
- package/src/core/codemirror/lsp/federated-lsp.ts +1 -1
- package/src/core/codemirror/lsp/notebook-lsp.ts +8 -2
- package/src/core/codemirror/readonly/__tests__/extension.test.ts +1 -1
- package/src/core/codemirror/rtc/loro/awareness.ts +52 -17
- package/src/core/codemirror/rtc/loro/sync.ts +12 -4
- package/src/core/config/config-schema.ts +1 -0
- package/src/core/config/config.ts +4 -0
- package/src/core/hotkeys/hotkeys.ts +8 -4
- package/src/core/i18n/__tests__/locale-provider.test.tsx +176 -0
- package/src/core/i18n/locale-provider.tsx +35 -0
- package/src/core/i18n/with-locale.tsx +12 -0
- package/src/core/islands/components/web-components.tsx +13 -10
- package/src/core/islands/main.ts +2 -2
- package/src/core/kernel/RuntimeState.ts +4 -1
- package/src/core/kernel/messages.ts +8 -12
- package/src/core/network/DeferredRequestRegistry.ts +16 -4
- package/src/core/runtime/runtime.ts +5 -4
- package/src/core/saving/__tests__/filename.test.ts +37 -0
- package/src/core/static/__tests__/download-html.test.ts +43 -1
- package/src/core/wasm/bridge.ts +5 -1
- package/src/core/wasm/store.ts +4 -1
- package/src/core/wasm/worker/message-buffer.ts +3 -2
- package/src/core/websocket/types.ts +22 -16
- package/src/core/websocket/useMarimoWebSocket.tsx +2 -2
- package/src/css/app/Cell.css +11 -0
- package/src/hooks/useFormatting.ts +97 -0
- package/src/hooks/useTimer.ts +8 -5
- package/src/plugins/core/RenderHTML.tsx +36 -2
- package/src/plugins/core/__test__/RenderHTML.test.ts +72 -0
- package/src/plugins/core/registerReactComponent.tsx +44 -10
- package/src/plugins/impl/DataTablePlugin.tsx +4 -0
- package/src/plugins/impl/FileBrowserPlugin.tsx +8 -2
- package/src/plugins/impl/RangeSliderPlugin.tsx +5 -3
- package/src/plugins/impl/SliderPlugin.tsx +3 -1
- package/src/plugins/impl/anywidget/model.ts +16 -5
- package/src/plugins/impl/data-editor/types.ts +7 -5
- package/src/plugins/impl/data-explorer/components/column-summary.tsx +20 -13
- package/src/plugins/impl/panel/utils.ts +6 -4
- package/src/plugins/layout/OutlinePlugin.tsx +69 -0
- package/src/plugins/layout/StatPlugin.tsx +4 -1
- package/src/plugins/plugins.ts +2 -0
- package/src/stories/cell.stories.tsx +1 -1
- package/src/stories/layout/vertical/one-column.stories.tsx +1 -1
- package/src/utils/__tests__/cell-urls.test.ts +29 -0
- package/src/utils/__tests__/dates.test.ts +45 -24
- package/src/utils/__tests__/filenames.test.ts +18 -0
- package/src/utils/__tests__/numbers.test.ts +42 -30
- package/src/utils/__tests__/once.test.ts +187 -0
- package/src/utils/__tests__/path.test.ts +38 -0
- package/src/utils/__tests__/urls.test.ts +56 -1
- package/src/utils/dates.ts +15 -10
- package/src/utils/edit-distance.ts +8 -6
- package/src/utils/errors.ts +9 -0
- package/src/utils/id-tree.tsx +21 -10
- package/src/utils/localStorage.ts +13 -4
- package/src/utils/numbers.ts +11 -11
- package/src/utils/once.ts +32 -0
- package/src/utils/paths.ts +4 -1
- package/src/utils/pluralize.ts +12 -5
- package/src/utils/python-poet/poet.ts +30 -15
- package/src/utils/time.ts +5 -1
- package/dist/assets/ConnectedDataExplorerComponent-Cn5-l2X1.js +0 -19
- package/dist/assets/_baseEach-C1FLm7WW.js +0 -1
- package/dist/assets/_baseMap-DBVArUYD.js +0 -1
- package/dist/assets/_baseUniq-Dk7ZPJ3N.js +0 -1
- package/dist/assets/_createAggregator-Bn38fDd3.js +0 -1
- package/dist/assets/agent-panel-COUYnuIK.js +0 -475
- package/dist/assets/architectureDiagram-W76B3OCA-DBzWQKKu.js +0 -36
- package/dist/assets/channel-CjhbjOv4.js +0 -1
- package/dist/assets/chat-panel-BPXKoTnZ.js +0 -7
- package/dist/assets/chat-panel-Brrs_eeH.css +0 -1
- package/dist/assets/classDiagram-KNZD7YFC-DHs5cFzy.js +0 -1
- package/dist/assets/classDiagram-v2-RKCZMP56-DHs5cFzy.js +0 -1
- package/dist/assets/clone-DM1YNjEn.js +0 -1
- package/dist/assets/command-palette-S0bzQp7v.js +0 -1
- package/dist/assets/common-B8U9k2Ly.js +0 -1
- package/dist/assets/cose-bilkent-S5V4N54A-wz1Sfx7j.js +0 -1
- package/dist/assets/dagre-5GWH7T2D-BfpcVBgq.js +0 -4
- package/dist/assets/datasources-panel-DfuURLJw.js +0 -1
- package/dist/assets/diagram-N5W7TBWH-Bf0oqqQh.js +0 -24
- package/dist/assets/diagram-QEK2KX5R-ZTc3qikh.js +0 -43
- package/dist/assets/diagram-S2PKOQOG-tLScBy7Z.js +0 -24
- package/dist/assets/edit-page-DJ8kJZ9w.js +0 -129
- package/dist/assets/file-explorer-panel-CzNUJ63G.js +0 -1
- package/dist/assets/gitGraphDiagram-NY62KEGX-C1t6QtVa.js +0 -65
- package/dist/assets/graph-CssCVWIq.js +0 -1
- package/dist/assets/home-page-9eW6qida.js +0 -9
- package/dist/assets/index-CknhX2Vy.css +0 -1
- package/dist/assets/index-DcCIe7np.js +0 -28
- package/dist/assets/index-OC46250R.js +0 -570
- package/dist/assets/infoDiagram-STP46IZ2-CwiAoz9f.js +0 -2
- package/dist/assets/layout-DpQrxGW-.js +0 -1
- package/dist/assets/linear-NsreOeBF.js +0 -1
- package/dist/assets/links-CbvGxbsJ.js +0 -7
- package/dist/assets/mermaid-DSt0r6IQ.js +0 -1
- package/dist/assets/min-D259kI3t.js +0 -1
- package/dist/assets/outline-panel-uvsS-YEQ.js +0 -1
- package/dist/assets/packages-panel-xMz9W2hW.js +0 -1
- package/dist/assets/run-page-Bb68qdhQ.js +0 -1
- package/dist/assets/sankeyDiagram-GR3RE2ED-BSJOau8E.js +0 -10
- package/dist/assets/scratchpad-panel-BF4BO-U4.js +0 -1
- package/dist/assets/secrets-panel-CdIX44dQ.js +0 -1
- package/dist/assets/snippets-panel-Dco9h0rb.js +0 -1
- package/dist/assets/sortBy-aLGA-PGK.js +0 -1
- package/dist/assets/stateDiagram-KXAO66HF-Bd68WT3b.js +0 -1
- package/dist/assets/stateDiagram-v2-UMBNRL4Z-BXz_GSwb.js +0 -1
- package/dist/assets/storage-CGlP4lCF.js +0 -26
- package/dist/assets/terminal-CxkHubcu.js +0 -9
- package/dist/assets/time-D2nr1UgQ.js +0 -1
- package/dist/assets/tracing-kTqHxa7q.js +0 -2
- package/dist/assets/variable-panel-noTnH-AQ.js +0 -1
- package/dist/assets/worker-X5rxzQGQ.js +0 -1
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
prettyNumber,
|
|
17
17
|
prettyScientificNumber,
|
|
18
18
|
} from "@/utils/numbers";
|
|
19
|
+
import { memoizeLastValue } from "@/utils/once";
|
|
19
20
|
import type {
|
|
20
21
|
ColumnFormattingOptions,
|
|
21
22
|
ColumnFormattingState,
|
|
@@ -39,6 +40,7 @@ export const ColumnFormattingFeature: TableFeature = {
|
|
|
39
40
|
return {
|
|
40
41
|
enableColumnFormatting: true,
|
|
41
42
|
onColumnFormattingChange: makeStateUpdater("columnFormatting", table),
|
|
43
|
+
locale: navigator.language,
|
|
42
44
|
} as ColumnFormattingOptions;
|
|
43
45
|
},
|
|
44
46
|
|
|
@@ -74,36 +76,50 @@ export const ColumnFormattingFeature: TableFeature = {
|
|
|
74
76
|
const dataType = column.columnDef.meta?.dataType;
|
|
75
77
|
const format = column.getColumnFormatting?.();
|
|
76
78
|
if (format) {
|
|
77
|
-
return applyFormat(value, {
|
|
79
|
+
return applyFormat(value, {
|
|
80
|
+
format,
|
|
81
|
+
dataType,
|
|
82
|
+
locale: table.options.locale,
|
|
83
|
+
});
|
|
78
84
|
}
|
|
79
85
|
return value;
|
|
80
86
|
};
|
|
81
87
|
},
|
|
82
88
|
};
|
|
83
89
|
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
90
|
+
export const getFormatters = memoizeLastValue((locale: string) => {
|
|
91
|
+
const percentFormatter = new Intl.NumberFormat(locale, {
|
|
92
|
+
style: "percent",
|
|
93
|
+
minimumFractionDigits: 0,
|
|
94
|
+
maximumFractionDigits: 2,
|
|
95
|
+
});
|
|
89
96
|
|
|
90
|
-
const dateFormatter = new Intl.DateTimeFormat(
|
|
91
|
-
|
|
92
|
-
});
|
|
97
|
+
const dateFormatter = new Intl.DateTimeFormat(locale, {
|
|
98
|
+
dateStyle: "short", // 3/4/2024
|
|
99
|
+
});
|
|
93
100
|
|
|
94
|
-
const dateTimeFormatter = new Intl.DateTimeFormat(
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
});
|
|
101
|
+
const dateTimeFormatter = new Intl.DateTimeFormat(locale, {
|
|
102
|
+
dateStyle: "short", // 3/4/2024
|
|
103
|
+
timeStyle: "long", // 3:04:05 PM
|
|
104
|
+
timeZone: "UTC",
|
|
105
|
+
});
|
|
99
106
|
|
|
100
|
-
const timeFormatter = new Intl.DateTimeFormat(
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
});
|
|
107
|
+
const timeFormatter = new Intl.DateTimeFormat(locale, {
|
|
108
|
+
timeStyle: "long", // 3:04:05 PM
|
|
109
|
+
timeZone: "UTC",
|
|
110
|
+
});
|
|
104
111
|
|
|
105
|
-
const integerFormatter = new Intl.NumberFormat(
|
|
106
|
-
|
|
112
|
+
const integerFormatter = new Intl.NumberFormat(locale, {
|
|
113
|
+
maximumFractionDigits: 0, // 1,000,000
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
return {
|
|
117
|
+
percentFormatter,
|
|
118
|
+
dateFormatter,
|
|
119
|
+
dateTimeFormatter,
|
|
120
|
+
timeFormatter,
|
|
121
|
+
integerFormatter,
|
|
122
|
+
};
|
|
107
123
|
});
|
|
108
124
|
|
|
109
125
|
// Apply formatting to a value given a format and data type
|
|
@@ -112,9 +128,18 @@ export const applyFormat = (
|
|
|
112
128
|
options: {
|
|
113
129
|
format: FormatOption;
|
|
114
130
|
dataType: DataType | undefined;
|
|
131
|
+
locale: string;
|
|
115
132
|
},
|
|
116
133
|
) => {
|
|
117
|
-
const { format, dataType } = options;
|
|
134
|
+
const { format, dataType, locale } = options;
|
|
135
|
+
const {
|
|
136
|
+
percentFormatter,
|
|
137
|
+
dateFormatter,
|
|
138
|
+
dateTimeFormatter,
|
|
139
|
+
timeFormatter,
|
|
140
|
+
integerFormatter,
|
|
141
|
+
} = getFormatters(locale);
|
|
142
|
+
|
|
118
143
|
// If the value is null, return an empty string
|
|
119
144
|
if (value === null || value === undefined || value === "") {
|
|
120
145
|
return "";
|
|
@@ -143,13 +168,13 @@ export const applyFormat = (
|
|
|
143
168
|
const num = Number.parseFloat(value as string);
|
|
144
169
|
switch (format) {
|
|
145
170
|
case "Auto":
|
|
146
|
-
return prettyNumber(num);
|
|
171
|
+
return prettyNumber(num, locale);
|
|
147
172
|
case "Percent":
|
|
148
173
|
return percentFormatter.format(num);
|
|
149
174
|
case "Scientific":
|
|
150
|
-
return prettyScientificNumber(num, { shouldRound: true });
|
|
175
|
+
return prettyScientificNumber(num, { shouldRound: true, locale });
|
|
151
176
|
case "Engineering":
|
|
152
|
-
return prettyEngineeringNumber(num);
|
|
177
|
+
return prettyEngineeringNumber(num, locale);
|
|
153
178
|
case "Integer":
|
|
154
179
|
return integerFormatter.format(num);
|
|
155
180
|
default:
|
|
@@ -198,32 +223,35 @@ export const applyFormat = (
|
|
|
198
223
|
|
|
199
224
|
export function formattingExample(
|
|
200
225
|
format: FormatOption,
|
|
226
|
+
locale: string,
|
|
201
227
|
): string | number | undefined | null {
|
|
202
228
|
switch (format) {
|
|
203
229
|
case "Date":
|
|
204
230
|
return String(
|
|
205
|
-
applyFormat(new Date(), { format: "Date", dataType: "date" }),
|
|
231
|
+
applyFormat(new Date(), { format: "Date", dataType: "date", locale }),
|
|
206
232
|
);
|
|
207
233
|
case "Datetime":
|
|
208
234
|
return String(
|
|
209
235
|
applyFormat(new Date(), {
|
|
210
236
|
format: "Datetime",
|
|
211
237
|
dataType: "date",
|
|
238
|
+
locale,
|
|
212
239
|
}),
|
|
213
240
|
);
|
|
214
241
|
case "Time":
|
|
215
242
|
return String(
|
|
216
|
-
applyFormat(new Date(), { format: "Time", dataType: "date" }),
|
|
243
|
+
applyFormat(new Date(), { format: "Time", dataType: "date", locale }),
|
|
217
244
|
);
|
|
218
245
|
case "Percent":
|
|
219
246
|
return String(
|
|
220
|
-
applyFormat(0.1234, { format: "Percent", dataType: "number" }),
|
|
247
|
+
applyFormat(0.1234, { format: "Percent", dataType: "number", locale }),
|
|
221
248
|
);
|
|
222
249
|
case "Scientific":
|
|
223
250
|
return String(
|
|
224
251
|
applyFormat(12_345_678_910, {
|
|
225
252
|
format: "Scientific",
|
|
226
253
|
dataType: "number",
|
|
254
|
+
locale,
|
|
227
255
|
}),
|
|
228
256
|
);
|
|
229
257
|
case "Engineering":
|
|
@@ -231,15 +259,20 @@ export function formattingExample(
|
|
|
231
259
|
applyFormat(12_345_678_910, {
|
|
232
260
|
format: "Engineering",
|
|
233
261
|
dataType: "number",
|
|
262
|
+
locale,
|
|
234
263
|
}),
|
|
235
264
|
);
|
|
236
265
|
case "Integer":
|
|
237
266
|
return String(
|
|
238
|
-
applyFormat(1234.567, {
|
|
267
|
+
applyFormat(1234.567, {
|
|
268
|
+
format: "Integer",
|
|
269
|
+
dataType: "number",
|
|
270
|
+
locale,
|
|
271
|
+
}),
|
|
239
272
|
);
|
|
240
273
|
case "Auto":
|
|
241
274
|
return String(
|
|
242
|
-
applyFormat(1234.567, { format: "Auto", dataType: "number" }),
|
|
275
|
+
applyFormat(1234.567, { format: "Auto", dataType: "number", locale }),
|
|
243
276
|
);
|
|
244
277
|
default:
|
|
245
278
|
return null;
|
|
@@ -28,6 +28,7 @@ export interface ColumnFormattingTableState {
|
|
|
28
28
|
|
|
29
29
|
// define types for column formatting's table options
|
|
30
30
|
export interface ColumnFormattingOptions {
|
|
31
|
+
locale: string;
|
|
31
32
|
enableColumnFormatting?: boolean;
|
|
32
33
|
onColumnFormattingChange?: OnChangeFn<ColumnFormattingState>;
|
|
33
34
|
}
|
|
@@ -5,6 +5,7 @@ import type { Column } from "@tanstack/react-table";
|
|
|
5
5
|
import { capitalize } from "lodash-es";
|
|
6
6
|
import { FilterIcon, MinusIcon, TextIcon, XIcon } from "lucide-react";
|
|
7
7
|
import { useMemo, useRef, useState } from "react";
|
|
8
|
+
import { useLocale } from "react-aria";
|
|
8
9
|
import {
|
|
9
10
|
DropdownMenu,
|
|
10
11
|
DropdownMenuContent,
|
|
@@ -76,6 +77,7 @@ export const DataTableColumnHeader = <TData, TValue>({
|
|
|
76
77
|
calculateTopKRows,
|
|
77
78
|
}: DataTableColumnHeaderProps<TData, TValue>) => {
|
|
78
79
|
const [isFilterValueOpen, setIsFilterValueOpen] = useState(false);
|
|
80
|
+
const { locale } = useLocale();
|
|
79
81
|
|
|
80
82
|
// No header
|
|
81
83
|
if (!header) {
|
|
@@ -119,7 +121,7 @@ export const DataTableColumnHeader = <TData, TValue>({
|
|
|
119
121
|
{renderCopyColumn(column)}
|
|
120
122
|
{renderColumnPinning(column)}
|
|
121
123
|
{renderColumnWrapping(column)}
|
|
122
|
-
{renderFormatOptions(column)}
|
|
124
|
+
{renderFormatOptions(column, locale)}
|
|
123
125
|
<DropdownMenuSeparator />
|
|
124
126
|
{renderMenuItemFilter(column)}
|
|
125
127
|
{renderFilterByValues(column, setIsFilterValueOpen)}
|
|
@@ -64,17 +64,34 @@ export class ColumnChartSpecModel<T> {
|
|
|
64
64
|
private dataSpec: TopLevelSpec["data"];
|
|
65
65
|
private sourceName: "data_0" | "source_0";
|
|
66
66
|
|
|
67
|
+
private readonly data: T[] | string;
|
|
68
|
+
private readonly fieldTypes: FieldTypes;
|
|
69
|
+
readonly stats: Record<ColumnName, Partial<ColumnHeaderStats>>;
|
|
70
|
+
readonly binValues: Record<ColumnName, BinValues>;
|
|
71
|
+
readonly valueCounts: Record<ColumnName, ValueCounts>;
|
|
72
|
+
private readonly opts: {
|
|
73
|
+
includeCharts: boolean;
|
|
74
|
+
usePreComputedValues?: boolean;
|
|
75
|
+
};
|
|
76
|
+
|
|
67
77
|
constructor(
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
78
|
+
data: T[] | string,
|
|
79
|
+
fieldTypes: FieldTypes,
|
|
80
|
+
stats: Record<ColumnName, Partial<ColumnHeaderStats>>,
|
|
81
|
+
binValues: Record<ColumnName, BinValues>,
|
|
82
|
+
valueCounts: Record<ColumnName, ValueCounts>,
|
|
83
|
+
opts: {
|
|
74
84
|
includeCharts: boolean;
|
|
75
85
|
usePreComputedValues?: boolean;
|
|
76
86
|
},
|
|
77
87
|
) {
|
|
88
|
+
this.data = data;
|
|
89
|
+
this.fieldTypes = fieldTypes;
|
|
90
|
+
this.stats = stats;
|
|
91
|
+
this.binValues = binValues;
|
|
92
|
+
this.valueCounts = valueCounts;
|
|
93
|
+
this.opts = opts;
|
|
94
|
+
|
|
78
95
|
// Data may come in from a few different sources:
|
|
79
96
|
// - A URL
|
|
80
97
|
// - A CSV data URI (e.g. "data:text/csv;base64,...")
|
|
@@ -93,9 +110,9 @@ export class ColumnChartSpecModel<T> {
|
|
|
93
110
|
const decoded = typedAtob(base64);
|
|
94
111
|
|
|
95
112
|
if (decoded.startsWith(ARROW_MAGIC_NUMBER)) {
|
|
113
|
+
// @ts-expect-error vega-typings does not include arrow format
|
|
96
114
|
this.dataSpec = {
|
|
97
115
|
values: byteStringToBinary(decoded),
|
|
98
|
-
// @ts-expect-error vega-typings does not include arrow format
|
|
99
116
|
format: { type: "arrow" },
|
|
100
117
|
};
|
|
101
118
|
} else {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* Copyright 2024 Marimo. All rights reserved. */
|
|
2
2
|
import React, { Suspense } from "react";
|
|
3
|
+
import { useLocale } from "react-aria";
|
|
3
4
|
import { createBatchedLoader } from "@/plugins/impl/vega/batched";
|
|
4
5
|
import { useTheme } from "@/theme/useTheme";
|
|
5
6
|
import { logNever } from "@/utils/assertNever";
|
|
@@ -29,6 +30,8 @@ const batchedLoader = createBatchedLoader();
|
|
|
29
30
|
export const TableColumnSummary = <TData, TValue>({
|
|
30
31
|
columnId,
|
|
31
32
|
}: Props<TData, TValue>) => {
|
|
33
|
+
const { locale } = useLocale();
|
|
34
|
+
|
|
32
35
|
const chartSpecModel = React.use(ColumnChartContext);
|
|
33
36
|
const { theme } = useTheme();
|
|
34
37
|
const { spec, type, stats } = chartSpecModel.getHeaderSummary(columnId);
|
|
@@ -65,7 +68,7 @@ export const TableColumnSummary = <TData, TValue>({
|
|
|
65
68
|
) => {
|
|
66
69
|
return (
|
|
67
70
|
<DatePopover date={date} type={type}>
|
|
68
|
-
{prettyDate(date, type)}
|
|
71
|
+
{prettyDate(date, type, locale)}
|
|
69
72
|
</DatePopover>
|
|
70
73
|
);
|
|
71
74
|
};
|
|
@@ -84,7 +87,7 @@ export const TableColumnSummary = <TData, TValue>({
|
|
|
84
87
|
<div className="flex flex-col whitespace-pre">
|
|
85
88
|
<span>min: {renderDate(stats.min, type)}</span>
|
|
86
89
|
<span>max: {renderDate(stats.max, type)}</span>
|
|
87
|
-
<span>unique: {prettyNumber(stats.unique)}</span>
|
|
90
|
+
<span>unique: {prettyNumber(stats.unique, locale)}</span>
|
|
88
91
|
</div>
|
|
89
92
|
);
|
|
90
93
|
}
|
|
@@ -106,16 +109,22 @@ export const TableColumnSummary = <TData, TValue>({
|
|
|
106
109
|
<span>
|
|
107
110
|
min:{" "}
|
|
108
111
|
{typeof stats.min === "number"
|
|
109
|
-
? prettyScientificNumber(stats.min, {
|
|
112
|
+
? prettyScientificNumber(stats.min, {
|
|
113
|
+
shouldRound: true,
|
|
114
|
+
locale,
|
|
115
|
+
})
|
|
110
116
|
: stats.min}
|
|
111
117
|
</span>
|
|
112
118
|
<span>
|
|
113
119
|
max:{" "}
|
|
114
120
|
{typeof stats.max === "number"
|
|
115
|
-
? prettyScientificNumber(stats.max, {
|
|
121
|
+
? prettyScientificNumber(stats.max, {
|
|
122
|
+
shouldRound: true,
|
|
123
|
+
locale,
|
|
124
|
+
})
|
|
116
125
|
: stats.max}
|
|
117
126
|
</span>
|
|
118
|
-
<span>unique: {prettyNumber(stats.unique)}</span>
|
|
127
|
+
<span>unique: {prettyNumber(stats.unique, locale)}</span>
|
|
119
128
|
</div>
|
|
120
129
|
);
|
|
121
130
|
}
|
|
@@ -127,8 +136,8 @@ export const TableColumnSummary = <TData, TValue>({
|
|
|
127
136
|
if (!spec) {
|
|
128
137
|
return (
|
|
129
138
|
<div className="flex flex-col whitespace-pre">
|
|
130
|
-
<span>true: {prettyNumber(stats.true)}</span>
|
|
131
|
-
<span>false: {prettyNumber(stats.false)}</span>
|
|
139
|
+
<span>true: {prettyNumber(stats.true, locale)}</span>
|
|
140
|
+
<span>false: {prettyNumber(stats.false, locale)}</span>
|
|
132
141
|
</div>
|
|
133
142
|
);
|
|
134
143
|
}
|
|
@@ -140,7 +149,7 @@ export const TableColumnSummary = <TData, TValue>({
|
|
|
140
149
|
if (!spec) {
|
|
141
150
|
return (
|
|
142
151
|
<div className="flex flex-col whitespace-pre">
|
|
143
|
-
<span>unique: {prettyNumber(stats.unique)}</span>
|
|
152
|
+
<span>unique: {prettyNumber(stats.unique, locale)}</span>
|
|
144
153
|
</div>
|
|
145
154
|
);
|
|
146
155
|
}
|
|
@@ -148,7 +157,7 @@ export const TableColumnSummary = <TData, TValue>({
|
|
|
148
157
|
case "unknown":
|
|
149
158
|
return (
|
|
150
159
|
<div className="flex flex-col whitespace-pre">
|
|
151
|
-
<span>nulls: {prettyNumber(stats.nulls)}</span>
|
|
160
|
+
<span>nulls: {prettyNumber(stats.nulls, locale)}</span>
|
|
152
161
|
</div>
|
|
153
162
|
);
|
|
154
163
|
default:
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { PopoverClose } from "@radix-ui/react-popover";
|
|
5
5
|
import type { Column, ColumnDef } from "@tanstack/react-table";
|
|
6
6
|
import { formatDate } from "date-fns";
|
|
7
|
+
import { WithLocale } from "@/core/i18n/with-locale";
|
|
7
8
|
import type { DataType } from "@/core/kernel/messages";
|
|
8
9
|
import type { CalculateTopKRows } from "@/plugins/impl/DataTablePlugin";
|
|
9
10
|
import { cn } from "@/utils/cn";
|
|
@@ -227,13 +228,13 @@ export function generateColumns<T>({
|
|
|
227
228
|
isCellSelected,
|
|
228
229
|
);
|
|
229
230
|
|
|
230
|
-
const renderedCell = renderCellValue(
|
|
231
|
+
const renderedCell = renderCellValue({
|
|
231
232
|
column,
|
|
232
233
|
renderValue,
|
|
233
234
|
getValue,
|
|
234
235
|
selectCell,
|
|
235
236
|
cellStyles,
|
|
236
|
-
);
|
|
237
|
+
});
|
|
237
238
|
|
|
238
239
|
// Row headers are bold
|
|
239
240
|
if (rowHeadersSet.has(key)) {
|
|
@@ -403,18 +404,25 @@ function renderAny(value: unknown): string {
|
|
|
403
404
|
}
|
|
404
405
|
}
|
|
405
406
|
|
|
406
|
-
function renderDate(
|
|
407
|
-
value
|
|
408
|
-
dataType
|
|
409
|
-
dtype
|
|
410
|
-
format
|
|
411
|
-
|
|
407
|
+
function renderDate({
|
|
408
|
+
value,
|
|
409
|
+
dataType,
|
|
410
|
+
dtype,
|
|
411
|
+
format,
|
|
412
|
+
locale,
|
|
413
|
+
}: {
|
|
414
|
+
value: Date;
|
|
415
|
+
dataType?: DataType;
|
|
416
|
+
dtype?: string;
|
|
417
|
+
format?: DateFormat | null;
|
|
418
|
+
locale: string;
|
|
419
|
+
}): React.ReactNode {
|
|
412
420
|
const type = dataType === "date" ? "date" : "datetime";
|
|
413
421
|
const timezone = extractTimezone(dtype);
|
|
414
422
|
|
|
415
423
|
const exactValue = format
|
|
416
424
|
? formatDate(value, format)
|
|
417
|
-
: exactDateTime(value, timezone);
|
|
425
|
+
: exactDateTime(value, timezone, locale);
|
|
418
426
|
|
|
419
427
|
return (
|
|
420
428
|
<DatePopover date={value} type={type}>
|
|
@@ -423,13 +431,19 @@ function renderDate(
|
|
|
423
431
|
);
|
|
424
432
|
}
|
|
425
433
|
|
|
426
|
-
export function renderCellValue<TData, TValue>(
|
|
427
|
-
column
|
|
428
|
-
renderValue
|
|
429
|
-
getValue
|
|
430
|
-
selectCell
|
|
431
|
-
cellStyles
|
|
432
|
-
|
|
434
|
+
export function renderCellValue<TData, TValue>({
|
|
435
|
+
column,
|
|
436
|
+
renderValue,
|
|
437
|
+
getValue,
|
|
438
|
+
selectCell,
|
|
439
|
+
cellStyles,
|
|
440
|
+
}: {
|
|
441
|
+
column: Column<TData, TValue>;
|
|
442
|
+
renderValue: () => TValue | null;
|
|
443
|
+
getValue: () => TValue;
|
|
444
|
+
selectCell?: () => void;
|
|
445
|
+
cellStyles?: string;
|
|
446
|
+
}) {
|
|
433
447
|
const value = getValue();
|
|
434
448
|
const format = column.getColumnFormatting?.();
|
|
435
449
|
|
|
@@ -440,7 +454,13 @@ export function renderCellValue<TData, TValue>(
|
|
|
440
454
|
try {
|
|
441
455
|
const date = new Date(value);
|
|
442
456
|
const format = getDateFormat(value);
|
|
443
|
-
return
|
|
457
|
+
return (
|
|
458
|
+
<WithLocale>
|
|
459
|
+
{(locale) =>
|
|
460
|
+
renderDate({ value: date, dataType, dtype, format, locale })
|
|
461
|
+
}
|
|
462
|
+
</WithLocale>
|
|
463
|
+
);
|
|
444
464
|
} catch (error) {
|
|
445
465
|
Logger.error("Error parsing datetime, fallback to string", error);
|
|
446
466
|
}
|
|
@@ -448,7 +468,11 @@ export function renderCellValue<TData, TValue>(
|
|
|
448
468
|
|
|
449
469
|
if (value instanceof Date) {
|
|
450
470
|
// e.g. 2010-10-07 17:15:00
|
|
451
|
-
return
|
|
471
|
+
return (
|
|
472
|
+
<WithLocale>
|
|
473
|
+
{(locale) => renderDate({ value, dataType, dtype, locale })}
|
|
474
|
+
</WithLocale>
|
|
475
|
+
);
|
|
452
476
|
}
|
|
453
477
|
|
|
454
478
|
if (typeof value === "string") {
|
|
@@ -19,11 +19,13 @@ import {
|
|
|
19
19
|
useReactTable,
|
|
20
20
|
} from "@tanstack/react-table";
|
|
21
21
|
import React, { memo } from "react";
|
|
22
|
+
import { useLocale } from "react-aria";
|
|
22
23
|
|
|
23
24
|
import { Table } from "@/components/ui/table";
|
|
24
25
|
import type { GetRowIds } from "@/plugins/impl/DataTablePlugin";
|
|
25
26
|
import { cn } from "@/utils/cn";
|
|
26
27
|
import type { PanelType } from "../editor/chrome/panels/context-aware-panel/context-aware-panel";
|
|
28
|
+
import { CellHoverTemplateFeature } from "./cell-hover-template/feature";
|
|
27
29
|
import { CellSelectionFeature } from "./cell-selection/feature";
|
|
28
30
|
import type { CellSelectionState } from "./cell-selection/types";
|
|
29
31
|
import { CellStylingFeature } from "./cell-styling/feature";
|
|
@@ -63,6 +65,7 @@ interface DataTableProps<TData> extends Partial<DownloadActionProps> {
|
|
|
63
65
|
rowSelection?: RowSelectionState;
|
|
64
66
|
cellSelection?: CellSelectionState;
|
|
65
67
|
cellStyling?: CellStyleState | null;
|
|
68
|
+
hoverTemplate?: string | null;
|
|
66
69
|
onRowSelectionChange?: OnChangeFn<RowSelectionState>;
|
|
67
70
|
onCellSelectionChange?: OnChangeFn<CellSelectionState>;
|
|
68
71
|
getRowIds?: GetRowIds;
|
|
@@ -103,6 +106,7 @@ const DataTableInternal = <TData,>({
|
|
|
103
106
|
rowSelection,
|
|
104
107
|
cellSelection,
|
|
105
108
|
cellStyling,
|
|
109
|
+
hoverTemplate,
|
|
106
110
|
paginationState,
|
|
107
111
|
setPaginationState,
|
|
108
112
|
downloadAs,
|
|
@@ -131,6 +135,7 @@ const DataTableInternal = <TData,>({
|
|
|
131
135
|
}: DataTableProps<TData>) => {
|
|
132
136
|
const [isSearchEnabled, setIsSearchEnabled] = React.useState<boolean>(false);
|
|
133
137
|
const [showLoadingBar, setShowLoadingBar] = React.useState<boolean>(false);
|
|
138
|
+
const { locale } = useLocale();
|
|
134
139
|
|
|
135
140
|
const { columnPinning, setColumnPinning } = useColumnPinning(
|
|
136
141
|
freezeColumnsLeft,
|
|
@@ -176,6 +181,7 @@ const DataTableInternal = <TData,>({
|
|
|
176
181
|
ColumnFormattingFeature,
|
|
177
182
|
CellSelectionFeature,
|
|
178
183
|
CellStylingFeature,
|
|
184
|
+
CellHoverTemplateFeature,
|
|
179
185
|
CopyColumnFeature,
|
|
180
186
|
FocusRowFeature,
|
|
181
187
|
],
|
|
@@ -199,6 +205,7 @@ const DataTableInternal = <TData,>({
|
|
|
199
205
|
},
|
|
200
206
|
}
|
|
201
207
|
: {}),
|
|
208
|
+
locale: locale,
|
|
202
209
|
manualPagination: manualPagination,
|
|
203
210
|
getPaginationRowModel: getPaginationRowModel(),
|
|
204
211
|
// sorting
|
|
@@ -233,10 +240,11 @@ const DataTableInternal = <TData,>({
|
|
|
233
240
|
? {}
|
|
234
241
|
: // No pagination, show all rows
|
|
235
242
|
{ pagination: { pageIndex: 0, pageSize: data.length } }),
|
|
236
|
-
rowSelection,
|
|
237
|
-
cellSelection,
|
|
243
|
+
rowSelection: rowSelection ?? {},
|
|
244
|
+
cellSelection: cellSelection ?? [],
|
|
238
245
|
cellStyling,
|
|
239
246
|
columnPinning: columnPinning,
|
|
247
|
+
cellHoverTemplate: hoverTemplate,
|
|
240
248
|
},
|
|
241
249
|
});
|
|
242
250
|
|