@marimo-team/frontend 0.16.0-dev96986 → 0.16.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/assets/ConnectedDataExplorerComponent-BErMbWvG.js +19 -0
- package/dist/assets/{ImageComparisonComponent-SX7fDaTK.js → ImageComparisonComponent-fTHv1Ih0.js} +1 -1
- package/dist/assets/{VegaLite-MJUW3b7C.js → VegaLite-Bdi-TyfY.js} +1 -1
- package/dist/assets/_baseEach-CNBxBxvS.js +1 -0
- package/dist/assets/_baseMap-D1WHjKrd.js +1 -0
- package/dist/assets/_baseUniq-CCgDNtZb.js +1 -0
- package/dist/assets/{_createAggregator-ZRm2b6Zm.js → _createAggregator-DcD0kTA5.js} +1 -1
- package/dist/assets/{agent-panel-BBd11wNX.js → agent-panel-Crv430aI.js} +57 -76
- package/dist/assets/{any-language-editor-DwAaEQfS.js → any-language-editor-CQh552Wu.js} +1 -1
- package/dist/assets/{architectureDiagram-W76B3OCA-BJmVXUoW.js → architectureDiagram-W76B3OCA-BAJeBxzt.js} +1 -1
- package/dist/assets/{between-horizontal-start-KiwU-a3C.js → between-horizontal-start-Boxgxbt_.js} +1 -1
- package/dist/assets/{blockDiagram-QIGZ2CNN-DzxZjE7B.js → blockDiagram-QIGZ2CNN-CL-1svEK.js} +1 -1
- package/dist/assets/{c4Diagram-FPNF74CW-DjmldG_J.js → c4Diagram-FPNF74CW-BbEqbCTl.js} +1 -1
- package/dist/assets/channel-_2eNSz0n.js +1 -0
- package/dist/assets/chat-panel-CXh5Wl6C.js +3 -0
- package/dist/assets/{chunk-4BX2VUAB-EUTQThiZ.js → chunk-4BX2VUAB-C--8TXeE.js} +1 -1
- package/dist/assets/{chunk-55IACEB6-DZAiDJxy.js → chunk-55IACEB6-Bj00HDqq.js} +1 -1
- package/dist/assets/{chunk-FMBD7UC4-Bd0Czs-J.js → chunk-FMBD7UC4-C-lhB6hN.js} +1 -1
- package/dist/assets/{chunk-K7UQS3LO-DEKMIknX.js → chunk-K7UQS3LO-B-pGTXPt.js} +1 -1
- package/dist/assets/{chunk-QN33PNHL-E0jwHU_n.js → chunk-QN33PNHL-DqUzGhvm.js} +1 -1
- package/dist/assets/{chunk-QZHKN3VN-BzaIHJbq.js → chunk-QZHKN3VN-TntJHfSk.js} +1 -1
- package/dist/assets/{chunk-TVAH2DTR-CZFYvqnm.js → chunk-TVAH2DTR-HUJb1psV.js} +1 -1
- package/dist/assets/{chunk-TZMSLE5B-BNqnFjtv.js → chunk-TZMSLE5B-BK3C__t3.js} +1 -1
- package/dist/assets/{circle-play-D3J_mYrF.js → circle-play-DBLOv1Yu.js} +1 -1
- package/dist/assets/classDiagram-KNZD7YFC-BGmh9POF.js +1 -0
- package/dist/assets/classDiagram-v2-RKCZMP56-BGmh9POF.js +1 -0
- package/dist/assets/{clear-button-ifzRuAR3.js → clear-button-BeoFbEKH.js} +1 -1
- package/dist/assets/clone-BFDSPAj3.js +1 -0
- package/dist/assets/{command-palette-D2fdVSET.js → command-palette-CXZiSv0I.js} +1 -1
- package/dist/assets/{common-Ku-cF_2J.js → common-C7oJcmCT.js} +1 -1
- package/dist/assets/{compile-BgZlHW1c.js → compile-7L0MwhyI.js} +1 -1
- package/dist/assets/{cose-bilkent-S5V4N54A-CVM83SqK.js → cose-bilkent-S5V4N54A-BMkGLcVC.js} +1 -1
- package/dist/assets/{dagre-5GWH7T2D-ouQPkxT3.js → dagre-5GWH7T2D-BJtRienS.js} +1 -1
- package/dist/assets/{data-grid-overlay-editor-B47j5GJJ.js → data-grid-overlay-editor-DBkmGtNs.js} +1 -1
- package/dist/assets/datasources-panel-B7FbYLiy.js +1 -0
- package/dist/assets/{dependency-graph-panel-CZC_B7pK.js → dependency-graph-panel-DEdOxp2X.js} +1 -1
- package/dist/assets/{diagram-N5W7TBWH-CQ817ZdR.js → diagram-N5W7TBWH-CmECY3nb.js} +1 -1
- package/dist/assets/{diagram-QEK2KX5R-DOK_psUO.js → diagram-QEK2KX5R-DMOVSNKD.js} +1 -1
- package/dist/assets/{diagram-S2PKOQOG-CVljmOW8.js → diagram-S2PKOQOG-BiJ96PNQ.js} +1 -1
- package/dist/assets/{documentation-panel-C7yIvGg1.js → documentation-panel-xULhaEv3.js} +1 -1
- package/dist/assets/edit-page-BrYda9VE.js +129 -0
- package/dist/assets/{ellipsis-vertical-C7FjlUsY.js → ellipsis-vertical-BBqXIlc2.js} +1 -1
- package/dist/assets/{empty-state-DIOGM_CU.js → empty-state-B3dA3G5P.js} +1 -1
- package/dist/assets/{erDiagram-AWTI2OKA-DYu8cEdc.js → erDiagram-AWTI2OKA-MP1DiFRo.js} +1 -1
- package/dist/assets/{error-panel-Ddb8RkFG.js → error-panel-Cc1sv-Ag.js} +1 -1
- package/dist/assets/file-explorer-panel-Bw59Kva1.js +1 -0
- package/dist/assets/{flowDiagram-PVAE7QVJ-CmvW5iTb.js → flowDiagram-PVAE7QVJ-BX7caPp7.js} +1 -1
- package/dist/assets/{ganttDiagram-OWAHRB6G-BaKQlCaT.js → ganttDiagram-OWAHRB6G-B462g4Yf.js} +4 -4
- package/dist/assets/{gitGraphDiagram-NY62KEGX-CWO24eP6.js → gitGraphDiagram-NY62KEGX-CGgvZ9-9.js} +1 -1
- package/dist/assets/{glide-data-editor-CNDLEJ9a.js → glide-data-editor-C0gUFZON.js} +11 -11
- package/dist/assets/{graph-BZKTtxsc.js → graph-CHRVBzY5.js} +1 -1
- package/dist/assets/home-page-Fb2osjys.js +9 -0
- package/dist/assets/{index-zrSUQXha.js → index-BVgAenPd.js} +1 -1
- package/dist/assets/{index-Brf2DwUM.js → index-BY93Ejhl.js} +1 -1
- package/dist/assets/{index-CerjupfZ.js → index-C-8WADat.js} +1 -1
- package/dist/assets/{index-DZhOPkOB.js → index-C-GhZ7ti.js} +1 -1
- package/dist/assets/{index-CZaurnA9.js → index-C1v_Z9et.js} +1 -1
- package/dist/assets/{index-0XOUPdwT.js → index-C4Tn5NvJ.js} +1 -1
- package/dist/assets/{index-B_d_JZGI.js → index-C77h_TXN.js} +1 -1
- package/dist/assets/{index-BJVyzkx5.js → index-CQDrxQ0j.js} +1 -1
- package/dist/assets/{index-DFrGFNW1.js → index-CWMgowgL.js} +1 -1
- package/dist/assets/{index-DmgwT3sx.js → index-Clbi_Yaq.js} +1 -1
- package/dist/assets/{index-D-tZfElD.js → index-CpTPJo4k.js} +1 -1
- package/dist/assets/index-Cx0bsY1w.css +1 -0
- package/dist/assets/{index-DkntzpX4.js → index-D1vmG6DS.js} +1 -1
- package/dist/assets/{index-D3PqGupX.js → index-D9UKkrr2.js} +1 -1
- package/dist/assets/{index-BgXbBA39.js → index-DEQvTChO.js} +1 -1
- package/dist/assets/index-DKEudB02.js +578 -0
- package/dist/assets/{index-DCkzth56.js → index-DRMm6SNo.js} +1 -1
- package/dist/assets/{index-WXJFkQHg.js → index-DoRmcrKM.js} +1 -1
- package/dist/assets/{index-qE8lHQ-N.js → index-lYa_leQE.js} +1 -1
- package/dist/assets/{index-CXrWwFX6.js → index-vmICa5KN.js} +1 -1
- package/dist/assets/{index-BH7f3aiU.js → index-z9bohSQJ.js} +1 -1
- package/dist/assets/infoDiagram-STP46IZ2-CVyrdLc8.js +2 -0
- package/dist/assets/{isEmpty-D1t7Gran.js → isEmpty-DU_ogP_D.js} +1 -1
- package/dist/assets/{journeyDiagram-BIP6EPQ6-D4Rp6H_h.js → journeyDiagram-BIP6EPQ6-C6EgLP_Q.js} +1 -1
- package/dist/assets/{kanban-definition-6OIFK2YF-DFt9DftA.js → kanban-definition-6OIFK2YF-BXzYO1yj.js} +1 -1
- package/dist/assets/{layout-D8WXi2_g.js → layout-jihVw5-i.js} +1 -1
- package/dist/assets/{linear-BwY8e5hA.js → linear-C4blANlC.js} +1 -1
- package/dist/assets/links-D59GIweI.js +7 -0
- package/dist/assets/{logs-panel-Dxiyt7dO.js → logs-panel-D401qzZh.js} +1 -1
- package/dist/assets/{markdown-renderer-VDu-NBKB.js → markdown-renderer-Cd9eYyaL.js} +20 -20
- package/dist/assets/{mermaid-B-O-Puyi.js → mermaid-BEVuRz_O.js} +1 -1
- package/dist/assets/{mermaid.core-BFFCqfOn.js → mermaid.core-CaSnaLH0.js} +4 -4
- package/dist/assets/min-DUMu_zeK.js +1 -0
- package/dist/assets/{mindmap-definition-Q6HEUPPD-kyvIY8Dg.js → mindmap-definition-Q6HEUPPD-BXUM5MT2.js} +1 -1
- package/dist/assets/{number-overlay-editor-GjLB2UK4.js → number-overlay-editor-4uWXGlPG.js} +1 -1
- package/dist/assets/outline-panel-DIzkvm2I.js +1 -0
- package/dist/assets/{packages-panel-nfXB-bKW.js → packages-panel-CJL0MVlj.js} +1 -1
- package/dist/assets/{pieDiagram-ADFJNKIX-D8JFQcWR.js → pieDiagram-ADFJNKIX-Dxt5PVNo.js} +1 -1
- package/dist/assets/{quadrantDiagram-LMRXKWRM-Nf8GzxXG.js → quadrantDiagram-LMRXKWRM-D4pUaA31.js} +1 -1
- package/dist/assets/{react-plotly-CnW9p7ZA.js → react-plotly-cJZ0VWBq.js} +1 -1
- package/dist/assets/{requirementDiagram-4UW4RH46-CCUxF8BZ.js → requirementDiagram-4UW4RH46-DVRTjgas.js} +1 -1
- package/dist/assets/{run-page-Bl4p3AbZ.js → run-page-BUEnMC9w.js} +1 -1
- package/dist/assets/{sankeyDiagram-GR3RE2ED-Sr8kDwP1.js → sankeyDiagram-GR3RE2ED-CVFnD9C-.js} +1 -1
- package/dist/assets/{scratchpad-panel-Ja1Mu-W3.js → scratchpad-panel-BIgRENkI.js} +1 -1
- package/dist/assets/{secrets-panel-B-3fcSyP.js → secrets-panel-xY5-V_BD.js} +1 -1
- package/dist/assets/{sequenceDiagram-C3RYC4MD-CBJ152Q3.js → sequenceDiagram-C3RYC4MD-_lY4ZN_S.js} +1 -1
- package/dist/assets/{slides-component-C-LoGC1U.css → slides-component-DMjQomc3.css} +1 -1
- package/dist/assets/{slides-component-DGtsVP5o.js → slides-component-Xjymwj7X.js} +1 -1
- package/dist/assets/snippets-panel-CTPYW41n.js +1 -0
- package/dist/assets/sortBy-BNZKwiq_.js +1 -0
- package/dist/assets/{state-B_RCHTH5.js → state-C4NiC9tO.js} +1 -1
- package/dist/assets/{stateDiagram-KXAO66HF-BlBFSAZr.js → stateDiagram-KXAO66HF-Da0JQWCn.js} +1 -1
- package/dist/assets/stateDiagram-v2-UMBNRL4Z-D5lYZOOt.js +1 -0
- package/dist/assets/storage-CMdLzB_c.js +26 -0
- package/dist/assets/{terminal-CATzv5Hd.js → terminal-BPwTkXae.js} +1 -1
- package/dist/assets/{time-CsYqILfB.js → time-Dv5_Ouz_.js} +1 -1
- package/dist/assets/{timeline-definition-XQNQX7LJ-CGrhjuAs.js → timeline-definition-XQNQX7LJ-Dxh5Zu2e.js} +1 -1
- package/dist/assets/tracing-BCIurUfa.js +2 -0
- package/dist/assets/{tracing-panel-DmzqPUtc.js → tracing-panel-DAzrzNmm.js} +2 -2
- package/dist/assets/{trash-rxdjLzkf.js → trash-Dc6DSjz_.js} +1 -1
- package/dist/assets/{tree-C2Ul1h1C.js → tree-jheoerAX.js} +1 -1
- package/dist/assets/{treemap-75Q7IDZK-N9hyUpyj.js → treemap-75Q7IDZK-IgpxeGaf.js} +27 -27
- package/dist/assets/variable-panel-DYAiLBmF.js +1 -0
- package/dist/assets/{vega-component-CR_MHOBT.js → vega-component-BpfpiPKI.js} +1 -1
- package/dist/assets/worker-X5rxzQGQ.js +1 -0
- package/dist/assets/{xychartDiagram-6GGTOJPD-jdLZsMb2.js → xychartDiagram-6GGTOJPD-CmNigJ31.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +2 -3
- package/src/components/app-config/user-config-form.tsx +1 -46
- package/src/components/chat/acp/__tests__/__snapshots__/prompt.test.ts.snap +43 -62
- package/src/components/chat/acp/__tests__/atoms.test.ts +1 -1
- package/src/components/chat/acp/__tests__/state.test.ts +36 -36
- package/src/components/chat/acp/agent-panel.tsx +27 -24
- package/src/components/chat/acp/blocks.tsx +6 -6
- package/src/components/chat/acp/prompt.ts +43 -62
- package/src/components/chat/chat-panel.tsx +1 -5
- package/src/components/chat/markdown-renderer.tsx +10 -6
- package/src/components/chat/tool-call-accordion.tsx +20 -52
- package/src/components/data-table/SearchBar.tsx +7 -8
- package/src/components/data-table/__tests__/column_formatting.test.ts +35 -50
- package/src/components/data-table/__tests__/data-table.test.tsx +1 -39
- package/src/components/data-table/charts/components/form-fields.tsx +37 -41
- package/src/components/data-table/charts/forms/common-chart.tsx +2 -2
- package/src/components/data-table/column-explorer-panel/column-explorer.tsx +2 -5
- package/src/components/data-table/column-formatting/feature.ts +29 -62
- package/src/components/data-table/column-formatting/types.ts +0 -1
- package/src/components/data-table/column-header.tsx +1 -3
- package/src/components/data-table/column-summary/chart-spec-model.tsx +7 -24
- package/src/components/data-table/column-summary/column-summary.tsx +9 -18
- package/src/components/data-table/columns.tsx +18 -42
- package/src/components/data-table/data-table.tsx +2 -10
- package/src/components/data-table/date-popover.tsx +75 -85
- package/src/components/data-table/filter-pills.tsx +9 -14
- package/src/components/data-table/header-items.tsx +1 -5
- package/src/components/data-table/pagination.tsx +13 -20
- package/src/components/data-table/renderers.tsx +0 -28
- package/src/components/data-table/row-viewer-panel/row-viewer.tsx +8 -10
- package/src/components/datasources/column-preview.tsx +2 -6
- package/src/components/datasources/datasources.tsx +12 -8
- package/src/components/editor/ai/transport/chat-transport.tsx +1 -4
- package/src/components/editor/cell/CellStatus.tsx +20 -23
- package/src/components/editor/cell/CreateCellButton.tsx +4 -3
- package/src/components/editor/cell/code/language-toggle.tsx +4 -3
- package/src/components/editor/chrome/wrapper/footer-items/machine-stats.tsx +28 -39
- package/src/components/editor/controls/notebook-menu-dropdown.tsx +2 -4
- package/src/components/editor/file-tree/requesting-tree.tsx +8 -14
- package/src/components/editor/renderers/CellArray.tsx +4 -3
- package/src/components/editor/renderers/slides-layout/slides-layout.tsx +3 -3
- package/src/components/editor/renderers/slides-layout/types.ts +0 -1
- package/src/components/pages/home-page.tsx +1 -4
- package/src/components/slides/slides-component.tsx +1 -1
- package/src/components/slides/slides.css +0 -6
- package/src/components/terminal/theme.tsx +0 -1
- package/src/components/tracing/tracing-spec.ts +4 -5
- package/src/components/ui/range-slider.tsx +2 -4
- package/src/components/ui/slider.tsx +1 -3
- package/src/components/variables/variables-table.tsx +0 -3
- package/src/core/MarimoApp.tsx +6 -9
- package/src/core/ai/context/__tests__/registry.test.ts +4 -6
- package/src/core/ai/context/providers/cell-output.ts +2 -3
- package/src/core/ai/context/providers/error.ts +1 -3
- package/src/core/ai/context/providers/file.ts +2 -7
- package/src/core/ai/context/providers/tables.ts +2 -3
- package/src/core/ai/context/providers/variable.ts +4 -6
- package/src/core/cells/logs.ts +1 -1
- package/src/core/codemirror/find-replace/search-highlight.ts +1 -3
- package/src/core/codemirror/language/LanguageAdapters.ts +3 -9
- package/src/core/codemirror/lsp/notebook-lsp.ts +2 -8
- package/src/core/codemirror/readonly/__tests__/extension.test.ts +1 -1
- package/src/core/codemirror/rtc/loro/awareness.ts +17 -52
- package/src/core/codemirror/rtc/loro/sync.ts +4 -12
- package/src/core/config/config-schema.ts +0 -1
- package/src/core/config/config.ts +0 -4
- package/src/core/hotkeys/hotkeys.ts +4 -8
- package/src/core/islands/components/web-components.tsx +10 -13
- package/src/core/kernel/RuntimeState.ts +1 -4
- package/src/core/kernel/messages.ts +2 -2
- package/src/core/network/DeferredRequestRegistry.ts +4 -16
- package/src/core/runtime/runtime.ts +4 -5
- package/src/core/wasm/bridge.ts +1 -5
- package/src/core/wasm/store.ts +1 -4
- package/src/core/wasm/worker/message-buffer.ts +2 -3
- package/src/core/websocket/types.ts +16 -22
- package/src/hooks/useTimer.ts +5 -8
- package/src/plugins/core/registerReactComponent.tsx +10 -16
- package/src/plugins/impl/DataTablePlugin.tsx +0 -4
- package/src/plugins/impl/RangeSliderPlugin.tsx +3 -5
- package/src/plugins/impl/SliderPlugin.tsx +1 -3
- package/src/plugins/impl/anywidget/model.ts +5 -16
- package/src/plugins/impl/data-editor/types.ts +5 -7
- package/src/plugins/impl/data-explorer/components/column-summary.tsx +13 -20
- package/src/plugins/impl/panel/utils.ts +4 -6
- package/src/plugins/layout/StatPlugin.tsx +1 -4
- package/src/plugins/plugins.ts +0 -2
- package/src/utils/__tests__/dates.test.ts +24 -45
- package/src/utils/__tests__/numbers.test.ts +30 -42
- package/src/utils/dates.ts +10 -15
- package/src/utils/edit-distance.ts +6 -8
- package/src/utils/errors.ts +1 -1
- package/src/utils/id-tree.tsx +10 -21
- package/src/utils/localStorage.ts +4 -13
- package/src/utils/numbers.ts +11 -11
- package/src/utils/once.ts +0 -32
- package/src/utils/paths.ts +1 -4
- package/src/utils/pluralize.ts +5 -12
- package/src/utils/python-poet/poet.ts +15 -30
- package/src/utils/time.ts +1 -5
- package/dist/assets/ConnectedDataExplorerComponent-CNLoZkWr.js +0 -19
- package/dist/assets/_baseEach-9_logFrf.js +0 -1
- package/dist/assets/_baseMap-NzEbKt5c.js +0 -1
- package/dist/assets/_baseUniq-C5LFcyNC.js +0 -1
- package/dist/assets/channel-DHcKBVM4.js +0 -1
- package/dist/assets/chat-panel-DgJZr0eS.js +0 -3
- package/dist/assets/classDiagram-KNZD7YFC-D-xwLnlX.js +0 -1
- package/dist/assets/classDiagram-v2-RKCZMP56-D-xwLnlX.js +0 -1
- package/dist/assets/clone-CSxIll62.js +0 -1
- package/dist/assets/datasources-panel-Bt41Zir-.js +0 -1
- package/dist/assets/edit-page-CyTMQV2u.js +0 -129
- package/dist/assets/file-explorer-panel-Oy9DbyFP.js +0 -1
- package/dist/assets/home-page-Bvwppn9N.js +0 -9
- package/dist/assets/index-DadI618h.css +0 -1
- package/dist/assets/index-PmY0x4Zd.js +0 -578
- package/dist/assets/infoDiagram-STP46IZ2-CAuVVehw.js +0 -2
- package/dist/assets/links-4B6ldZ5P.js +0 -7
- package/dist/assets/min-DtVSfYKl.js +0 -1
- package/dist/assets/outline-panel-CMJjOoN7.js +0 -1
- package/dist/assets/snippets-panel-ClNnwKBM.js +0 -1
- package/dist/assets/sortBy-D47H6Vyl.js +0 -1
- package/dist/assets/stateDiagram-v2-UMBNRL4Z-DbA-iToo.js +0 -1
- package/dist/assets/storage-BNcWOH3-.js +0 -26
- package/dist/assets/tracing-DUbJtOyq.js +0 -2
- package/dist/assets/variable-panel-BbgupOdG.js +0 -1
- package/dist/assets/worker-fHbtoWvT.js +0 -1
- package/src/components/data-table/cell-hover-template/feature.ts +0 -14
- package/src/components/data-table/cell-hover-template/types.ts +0 -11
- package/src/core/i18n/__tests__/locale-provider.test.tsx +0 -176
- package/src/core/i18n/locale-provider.tsx +0 -35
- package/src/core/i18n/with-locale.tsx +0 -12
- package/src/hooks/useFormatting.ts +0 -97
- package/src/plugins/layout/OutlinePlugin.tsx +0 -69
- package/src/utils/__tests__/once.test.ts +0 -187
|
@@ -342,7 +342,7 @@ interface SliderFieldProps {
|
|
|
342
342
|
fieldName: FieldName;
|
|
343
343
|
label: string;
|
|
344
344
|
className?: string;
|
|
345
|
-
|
|
345
|
+
value: number;
|
|
346
346
|
start: number;
|
|
347
347
|
stop: number;
|
|
348
348
|
step?: number;
|
|
@@ -351,57 +351,53 @@ interface SliderFieldProps {
|
|
|
351
351
|
export const SliderField = ({
|
|
352
352
|
fieldName,
|
|
353
353
|
label,
|
|
354
|
-
|
|
354
|
+
value,
|
|
355
355
|
start,
|
|
356
356
|
stop,
|
|
357
357
|
step,
|
|
358
358
|
className,
|
|
359
359
|
}: SliderFieldProps) => {
|
|
360
|
+
const [internalValue, setInternalValue] = React.useState(value);
|
|
360
361
|
const form = useFormContext();
|
|
361
362
|
|
|
363
|
+
// Update internal value on prop change
|
|
364
|
+
React.useEffect(() => {
|
|
365
|
+
setInternalValue(value);
|
|
366
|
+
}, [value]);
|
|
367
|
+
|
|
362
368
|
return (
|
|
363
369
|
<FormField
|
|
364
370
|
control={form.control}
|
|
365
371
|
name={fieldName}
|
|
366
|
-
render={({ field }) =>
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
// Triggered on mouse up
|
|
396
|
-
onValueCommit={([nextValue]) => {
|
|
397
|
-
saveValue(nextValue);
|
|
398
|
-
}}
|
|
399
|
-
valueMap={(value) => value}
|
|
400
|
-
/>
|
|
401
|
-
</FormControl>
|
|
402
|
-
</FormItem>
|
|
403
|
-
);
|
|
404
|
-
}}
|
|
372
|
+
render={({ field }) => (
|
|
373
|
+
<FormItem
|
|
374
|
+
className={cn("flex flex-row items-center gap-2 w-1/2", className)}
|
|
375
|
+
>
|
|
376
|
+
<FormLabel>{label}</FormLabel>
|
|
377
|
+
<FormControl>
|
|
378
|
+
<Slider
|
|
379
|
+
{...field}
|
|
380
|
+
id={fieldName}
|
|
381
|
+
className="relative flex items-center select-none"
|
|
382
|
+
value={[internalValue]}
|
|
383
|
+
min={start}
|
|
384
|
+
max={stop}
|
|
385
|
+
step={step}
|
|
386
|
+
// Triggered on slider drag
|
|
387
|
+
onValueChange={([nextValue]) => {
|
|
388
|
+
setInternalValue(nextValue);
|
|
389
|
+
field.onChange(nextValue);
|
|
390
|
+
}}
|
|
391
|
+
// Triggered on mouse up
|
|
392
|
+
onValueCommit={([nextValue]) => {
|
|
393
|
+
field.onChange(nextValue);
|
|
394
|
+
form.setValue(fieldName, nextValue);
|
|
395
|
+
}}
|
|
396
|
+
valueMap={(value) => value}
|
|
397
|
+
/>
|
|
398
|
+
</FormControl>
|
|
399
|
+
</FormItem>
|
|
400
|
+
)}
|
|
405
401
|
/>
|
|
406
402
|
);
|
|
407
403
|
};
|
|
@@ -102,7 +102,7 @@ export const StyleForm: React.FC = () => {
|
|
|
102
102
|
<SliderField
|
|
103
103
|
fieldName="xAxis.width"
|
|
104
104
|
label="Width"
|
|
105
|
-
|
|
105
|
+
value={400}
|
|
106
106
|
start={200}
|
|
107
107
|
stop={800}
|
|
108
108
|
/>
|
|
@@ -118,7 +118,7 @@ export const StyleForm: React.FC = () => {
|
|
|
118
118
|
<SliderField
|
|
119
119
|
fieldName="yAxis.height"
|
|
120
120
|
label="Height"
|
|
121
|
-
|
|
121
|
+
value={300}
|
|
122
122
|
start={150}
|
|
123
123
|
stop={600}
|
|
124
124
|
/>
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/* Copyright 2024 Marimo. All rights reserved. */
|
|
2
2
|
|
|
3
3
|
import { useState } from "react";
|
|
4
|
-
import { useLocale } from "react-aria";
|
|
5
4
|
import {
|
|
6
5
|
AddDataframeChart,
|
|
7
6
|
renderChart,
|
|
@@ -54,7 +53,6 @@ export const ColumnExplorerPanel = ({
|
|
|
54
53
|
tableId,
|
|
55
54
|
}: ColumnExplorerPanelProps) => {
|
|
56
55
|
const [searchValue, setSearchValue] = useState("");
|
|
57
|
-
const { locale } = useLocale();
|
|
58
56
|
const columns = fieldTypes?.filter(([columnName]) => {
|
|
59
57
|
if (
|
|
60
58
|
columnName === SELECT_COLUMN_ID ||
|
|
@@ -73,7 +71,7 @@ export const ColumnExplorerPanel = ({
|
|
|
73
71
|
return (
|
|
74
72
|
<div className="mt-5 mb-3">
|
|
75
73
|
<span className="text-xs font-semibold ml-2 flex">
|
|
76
|
-
{prettifyRowColumnCount(totalRows, totalColumns
|
|
74
|
+
{prettifyRowColumnCount(totalRows, totalColumns)}
|
|
77
75
|
<CopyClipboardIcon
|
|
78
76
|
tooltip="Copy column names"
|
|
79
77
|
value={columns?.map(([columnName]) => columnName).join(",\n") || ""}
|
|
@@ -171,7 +169,6 @@ const ColumnPreview = ({
|
|
|
171
169
|
dataType: DataType;
|
|
172
170
|
}) => {
|
|
173
171
|
const { theme } = useTheme();
|
|
174
|
-
const { locale } = useLocale();
|
|
175
172
|
|
|
176
173
|
const {
|
|
177
174
|
data,
|
|
@@ -211,7 +208,7 @@ const ColumnPreview = ({
|
|
|
211
208
|
refetchPreview,
|
|
212
209
|
});
|
|
213
210
|
|
|
214
|
-
const previewStats = stats && renderStats(stats, dataType
|
|
211
|
+
const previewStats = stats && renderStats(stats, dataType);
|
|
215
212
|
|
|
216
213
|
const chart = chart_spec && renderChart(chart_spec, theme);
|
|
217
214
|
|
|
@@ -16,7 +16,6 @@ import {
|
|
|
16
16
|
prettyNumber,
|
|
17
17
|
prettyScientificNumber,
|
|
18
18
|
} from "@/utils/numbers";
|
|
19
|
-
import { memoizeLastValue } from "@/utils/once";
|
|
20
19
|
import type {
|
|
21
20
|
ColumnFormattingOptions,
|
|
22
21
|
ColumnFormattingState,
|
|
@@ -40,7 +39,6 @@ export const ColumnFormattingFeature: TableFeature = {
|
|
|
40
39
|
return {
|
|
41
40
|
enableColumnFormatting: true,
|
|
42
41
|
onColumnFormattingChange: makeStateUpdater("columnFormatting", table),
|
|
43
|
-
locale: navigator.language,
|
|
44
42
|
} as ColumnFormattingOptions;
|
|
45
43
|
},
|
|
46
44
|
|
|
@@ -76,50 +74,36 @@ export const ColumnFormattingFeature: TableFeature = {
|
|
|
76
74
|
const dataType = column.columnDef.meta?.dataType;
|
|
77
75
|
const format = column.getColumnFormatting?.();
|
|
78
76
|
if (format) {
|
|
79
|
-
return applyFormat(value, {
|
|
80
|
-
format,
|
|
81
|
-
dataType,
|
|
82
|
-
locale: table.options.locale,
|
|
83
|
-
});
|
|
77
|
+
return applyFormat(value, { format, dataType });
|
|
84
78
|
}
|
|
85
79
|
return value;
|
|
86
80
|
};
|
|
87
81
|
},
|
|
88
82
|
};
|
|
89
83
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
const dateFormatter = new Intl.DateTimeFormat(locale, {
|
|
98
|
-
dateStyle: "short", // 3/4/2024
|
|
99
|
-
});
|
|
84
|
+
const percentFormatter = new Intl.NumberFormat(undefined, {
|
|
85
|
+
style: "percent",
|
|
86
|
+
minimumFractionDigits: 0,
|
|
87
|
+
maximumFractionDigits: 2,
|
|
88
|
+
});
|
|
100
89
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
timeZone: "UTC",
|
|
105
|
-
});
|
|
90
|
+
const dateFormatter = new Intl.DateTimeFormat(undefined, {
|
|
91
|
+
dateStyle: "short", // 3/4/2024
|
|
92
|
+
});
|
|
106
93
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
94
|
+
const dateTimeFormatter = new Intl.DateTimeFormat(undefined, {
|
|
95
|
+
dateStyle: "short", // 3/4/2024
|
|
96
|
+
timeStyle: "long", // 3:04:05 PM
|
|
97
|
+
timeZone: "UTC",
|
|
98
|
+
});
|
|
111
99
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
100
|
+
const timeFormatter = new Intl.DateTimeFormat(undefined, {
|
|
101
|
+
timeStyle: "long", // 3:04:05 PM
|
|
102
|
+
timeZone: "UTC",
|
|
103
|
+
});
|
|
115
104
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
dateFormatter,
|
|
119
|
-
dateTimeFormatter,
|
|
120
|
-
timeFormatter,
|
|
121
|
-
integerFormatter,
|
|
122
|
-
};
|
|
105
|
+
const integerFormatter = new Intl.NumberFormat(undefined, {
|
|
106
|
+
maximumFractionDigits: 0, // 1,000,000
|
|
123
107
|
});
|
|
124
108
|
|
|
125
109
|
// Apply formatting to a value given a format and data type
|
|
@@ -128,18 +112,9 @@ export const applyFormat = (
|
|
|
128
112
|
options: {
|
|
129
113
|
format: FormatOption;
|
|
130
114
|
dataType: DataType | undefined;
|
|
131
|
-
locale: string;
|
|
132
115
|
},
|
|
133
116
|
) => {
|
|
134
|
-
const { format, dataType
|
|
135
|
-
const {
|
|
136
|
-
percentFormatter,
|
|
137
|
-
dateFormatter,
|
|
138
|
-
dateTimeFormatter,
|
|
139
|
-
timeFormatter,
|
|
140
|
-
integerFormatter,
|
|
141
|
-
} = getFormatters(locale);
|
|
142
|
-
|
|
117
|
+
const { format, dataType } = options;
|
|
143
118
|
// If the value is null, return an empty string
|
|
144
119
|
if (value === null || value === undefined || value === "") {
|
|
145
120
|
return "";
|
|
@@ -168,13 +143,13 @@ export const applyFormat = (
|
|
|
168
143
|
const num = Number.parseFloat(value as string);
|
|
169
144
|
switch (format) {
|
|
170
145
|
case "Auto":
|
|
171
|
-
return prettyNumber(num
|
|
146
|
+
return prettyNumber(num);
|
|
172
147
|
case "Percent":
|
|
173
148
|
return percentFormatter.format(num);
|
|
174
149
|
case "Scientific":
|
|
175
|
-
return prettyScientificNumber(num, { shouldRound: true
|
|
150
|
+
return prettyScientificNumber(num, { shouldRound: true });
|
|
176
151
|
case "Engineering":
|
|
177
|
-
return prettyEngineeringNumber(num
|
|
152
|
+
return prettyEngineeringNumber(num);
|
|
178
153
|
case "Integer":
|
|
179
154
|
return integerFormatter.format(num);
|
|
180
155
|
default:
|
|
@@ -223,35 +198,32 @@ export const applyFormat = (
|
|
|
223
198
|
|
|
224
199
|
export function formattingExample(
|
|
225
200
|
format: FormatOption,
|
|
226
|
-
locale: string,
|
|
227
201
|
): string | number | undefined | null {
|
|
228
202
|
switch (format) {
|
|
229
203
|
case "Date":
|
|
230
204
|
return String(
|
|
231
|
-
applyFormat(new Date(), { format: "Date", dataType: "date"
|
|
205
|
+
applyFormat(new Date(), { format: "Date", dataType: "date" }),
|
|
232
206
|
);
|
|
233
207
|
case "Datetime":
|
|
234
208
|
return String(
|
|
235
209
|
applyFormat(new Date(), {
|
|
236
210
|
format: "Datetime",
|
|
237
211
|
dataType: "date",
|
|
238
|
-
locale,
|
|
239
212
|
}),
|
|
240
213
|
);
|
|
241
214
|
case "Time":
|
|
242
215
|
return String(
|
|
243
|
-
applyFormat(new Date(), { format: "Time", dataType: "date"
|
|
216
|
+
applyFormat(new Date(), { format: "Time", dataType: "date" }),
|
|
244
217
|
);
|
|
245
218
|
case "Percent":
|
|
246
219
|
return String(
|
|
247
|
-
applyFormat(0.1234, { format: "Percent", dataType: "number"
|
|
220
|
+
applyFormat(0.1234, { format: "Percent", dataType: "number" }),
|
|
248
221
|
);
|
|
249
222
|
case "Scientific":
|
|
250
223
|
return String(
|
|
251
224
|
applyFormat(12_345_678_910, {
|
|
252
225
|
format: "Scientific",
|
|
253
226
|
dataType: "number",
|
|
254
|
-
locale,
|
|
255
227
|
}),
|
|
256
228
|
);
|
|
257
229
|
case "Engineering":
|
|
@@ -259,20 +231,15 @@ export function formattingExample(
|
|
|
259
231
|
applyFormat(12_345_678_910, {
|
|
260
232
|
format: "Engineering",
|
|
261
233
|
dataType: "number",
|
|
262
|
-
locale,
|
|
263
234
|
}),
|
|
264
235
|
);
|
|
265
236
|
case "Integer":
|
|
266
237
|
return String(
|
|
267
|
-
applyFormat(1234.567, {
|
|
268
|
-
format: "Integer",
|
|
269
|
-
dataType: "number",
|
|
270
|
-
locale,
|
|
271
|
-
}),
|
|
238
|
+
applyFormat(1234.567, { format: "Integer", dataType: "number" }),
|
|
272
239
|
);
|
|
273
240
|
case "Auto":
|
|
274
241
|
return String(
|
|
275
|
-
applyFormat(1234.567, { format: "Auto", dataType: "number"
|
|
242
|
+
applyFormat(1234.567, { format: "Auto", dataType: "number" }),
|
|
276
243
|
);
|
|
277
244
|
default:
|
|
278
245
|
return null;
|
|
@@ -28,7 +28,6 @@ export interface ColumnFormattingTableState {
|
|
|
28
28
|
|
|
29
29
|
// define types for column formatting's table options
|
|
30
30
|
export interface ColumnFormattingOptions {
|
|
31
|
-
locale: string;
|
|
32
31
|
enableColumnFormatting?: boolean;
|
|
33
32
|
onColumnFormattingChange?: OnChangeFn<ColumnFormattingState>;
|
|
34
33
|
}
|
|
@@ -5,7 +5,6 @@ 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";
|
|
9
8
|
import {
|
|
10
9
|
DropdownMenu,
|
|
11
10
|
DropdownMenuContent,
|
|
@@ -77,7 +76,6 @@ export const DataTableColumnHeader = <TData, TValue>({
|
|
|
77
76
|
calculateTopKRows,
|
|
78
77
|
}: DataTableColumnHeaderProps<TData, TValue>) => {
|
|
79
78
|
const [isFilterValueOpen, setIsFilterValueOpen] = useState(false);
|
|
80
|
-
const { locale } = useLocale();
|
|
81
79
|
|
|
82
80
|
// No header
|
|
83
81
|
if (!header) {
|
|
@@ -121,7 +119,7 @@ export const DataTableColumnHeader = <TData, TValue>({
|
|
|
121
119
|
{renderCopyColumn(column)}
|
|
122
120
|
{renderColumnPinning(column)}
|
|
123
121
|
{renderColumnWrapping(column)}
|
|
124
|
-
{renderFormatOptions(column
|
|
122
|
+
{renderFormatOptions(column)}
|
|
125
123
|
<DropdownMenuSeparator />
|
|
126
124
|
{renderMenuItemFilter(column)}
|
|
127
125
|
{renderFilterByValues(column, setIsFilterValueOpen)}
|
|
@@ -64,34 +64,17 @@ 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
|
-
|
|
77
67
|
constructor(
|
|
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: {
|
|
68
|
+
private readonly data: T[] | string,
|
|
69
|
+
private readonly fieldTypes: FieldTypes,
|
|
70
|
+
readonly stats: Record<ColumnName, Partial<ColumnHeaderStats>>,
|
|
71
|
+
readonly binValues: Record<ColumnName, BinValues>,
|
|
72
|
+
readonly valueCounts: Record<ColumnName, ValueCounts>,
|
|
73
|
+
private readonly opts: {
|
|
84
74
|
includeCharts: boolean;
|
|
85
75
|
usePreComputedValues?: boolean;
|
|
86
76
|
},
|
|
87
77
|
) {
|
|
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
|
-
|
|
95
78
|
// Data may come in from a few different sources:
|
|
96
79
|
// - A URL
|
|
97
80
|
// - A CSV data URI (e.g. "data:text/csv;base64,...")
|
|
@@ -110,9 +93,9 @@ export class ColumnChartSpecModel<T> {
|
|
|
110
93
|
const decoded = typedAtob(base64);
|
|
111
94
|
|
|
112
95
|
if (decoded.startsWith(ARROW_MAGIC_NUMBER)) {
|
|
113
|
-
// @ts-expect-error vega-typings does not include arrow format
|
|
114
96
|
this.dataSpec = {
|
|
115
97
|
values: byteStringToBinary(decoded),
|
|
98
|
+
// @ts-expect-error vega-typings does not include arrow format
|
|
116
99
|
format: { type: "arrow" },
|
|
117
100
|
};
|
|
118
101
|
} else {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/* Copyright 2024 Marimo. All rights reserved. */
|
|
2
2
|
import React, { Suspense } from "react";
|
|
3
|
-
import { useLocale } from "react-aria";
|
|
4
3
|
import { createBatchedLoader } from "@/plugins/impl/vega/batched";
|
|
5
4
|
import { useTheme } from "@/theme/useTheme";
|
|
6
5
|
import { logNever } from "@/utils/assertNever";
|
|
@@ -30,8 +29,6 @@ const batchedLoader = createBatchedLoader();
|
|
|
30
29
|
export const TableColumnSummary = <TData, TValue>({
|
|
31
30
|
columnId,
|
|
32
31
|
}: Props<TData, TValue>) => {
|
|
33
|
-
const { locale } = useLocale();
|
|
34
|
-
|
|
35
32
|
const chartSpecModel = React.use(ColumnChartContext);
|
|
36
33
|
const { theme } = useTheme();
|
|
37
34
|
const { spec, type, stats } = chartSpecModel.getHeaderSummary(columnId);
|
|
@@ -68,7 +65,7 @@ export const TableColumnSummary = <TData, TValue>({
|
|
|
68
65
|
) => {
|
|
69
66
|
return (
|
|
70
67
|
<DatePopover date={date} type={type}>
|
|
71
|
-
{prettyDate(date, type
|
|
68
|
+
{prettyDate(date, type)}
|
|
72
69
|
</DatePopover>
|
|
73
70
|
);
|
|
74
71
|
};
|
|
@@ -87,7 +84,7 @@ export const TableColumnSummary = <TData, TValue>({
|
|
|
87
84
|
<div className="flex flex-col whitespace-pre">
|
|
88
85
|
<span>min: {renderDate(stats.min, type)}</span>
|
|
89
86
|
<span>max: {renderDate(stats.max, type)}</span>
|
|
90
|
-
<span>unique: {prettyNumber(stats.unique
|
|
87
|
+
<span>unique: {prettyNumber(stats.unique)}</span>
|
|
91
88
|
</div>
|
|
92
89
|
);
|
|
93
90
|
}
|
|
@@ -109,22 +106,16 @@ export const TableColumnSummary = <TData, TValue>({
|
|
|
109
106
|
<span>
|
|
110
107
|
min:{" "}
|
|
111
108
|
{typeof stats.min === "number"
|
|
112
|
-
? prettyScientificNumber(stats.min, {
|
|
113
|
-
shouldRound: true,
|
|
114
|
-
locale,
|
|
115
|
-
})
|
|
109
|
+
? prettyScientificNumber(stats.min, { shouldRound: true })
|
|
116
110
|
: stats.min}
|
|
117
111
|
</span>
|
|
118
112
|
<span>
|
|
119
113
|
max:{" "}
|
|
120
114
|
{typeof stats.max === "number"
|
|
121
|
-
? prettyScientificNumber(stats.max, {
|
|
122
|
-
shouldRound: true,
|
|
123
|
-
locale,
|
|
124
|
-
})
|
|
115
|
+
? prettyScientificNumber(stats.max, { shouldRound: true })
|
|
125
116
|
: stats.max}
|
|
126
117
|
</span>
|
|
127
|
-
<span>unique: {prettyNumber(stats.unique
|
|
118
|
+
<span>unique: {prettyNumber(stats.unique)}</span>
|
|
128
119
|
</div>
|
|
129
120
|
);
|
|
130
121
|
}
|
|
@@ -136,8 +127,8 @@ export const TableColumnSummary = <TData, TValue>({
|
|
|
136
127
|
if (!spec) {
|
|
137
128
|
return (
|
|
138
129
|
<div className="flex flex-col whitespace-pre">
|
|
139
|
-
<span>true: {prettyNumber(stats.true
|
|
140
|
-
<span>false: {prettyNumber(stats.false
|
|
130
|
+
<span>true: {prettyNumber(stats.true)}</span>
|
|
131
|
+
<span>false: {prettyNumber(stats.false)}</span>
|
|
141
132
|
</div>
|
|
142
133
|
);
|
|
143
134
|
}
|
|
@@ -149,7 +140,7 @@ export const TableColumnSummary = <TData, TValue>({
|
|
|
149
140
|
if (!spec) {
|
|
150
141
|
return (
|
|
151
142
|
<div className="flex flex-col whitespace-pre">
|
|
152
|
-
<span>unique: {prettyNumber(stats.unique
|
|
143
|
+
<span>unique: {prettyNumber(stats.unique)}</span>
|
|
153
144
|
</div>
|
|
154
145
|
);
|
|
155
146
|
}
|
|
@@ -157,7 +148,7 @@ export const TableColumnSummary = <TData, TValue>({
|
|
|
157
148
|
case "unknown":
|
|
158
149
|
return (
|
|
159
150
|
<div className="flex flex-col whitespace-pre">
|
|
160
|
-
<span>nulls: {prettyNumber(stats.nulls
|
|
151
|
+
<span>nulls: {prettyNumber(stats.nulls)}</span>
|
|
161
152
|
</div>
|
|
162
153
|
);
|
|
163
154
|
default:
|
|
@@ -4,7 +4,6 @@
|
|
|
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";
|
|
8
7
|
import type { DataType } from "@/core/kernel/messages";
|
|
9
8
|
import type { CalculateTopKRows } from "@/plugins/impl/DataTablePlugin";
|
|
10
9
|
import { cn } from "@/utils/cn";
|
|
@@ -228,13 +227,13 @@ export function generateColumns<T>({
|
|
|
228
227
|
isCellSelected,
|
|
229
228
|
);
|
|
230
229
|
|
|
231
|
-
const renderedCell = renderCellValue(
|
|
230
|
+
const renderedCell = renderCellValue(
|
|
232
231
|
column,
|
|
233
232
|
renderValue,
|
|
234
233
|
getValue,
|
|
235
234
|
selectCell,
|
|
236
235
|
cellStyles,
|
|
237
|
-
|
|
236
|
+
);
|
|
238
237
|
|
|
239
238
|
// Row headers are bold
|
|
240
239
|
if (rowHeadersSet.has(key)) {
|
|
@@ -404,25 +403,18 @@ function renderAny(value: unknown): string {
|
|
|
404
403
|
}
|
|
405
404
|
}
|
|
406
405
|
|
|
407
|
-
function renderDate(
|
|
408
|
-
value,
|
|
409
|
-
dataType,
|
|
410
|
-
dtype,
|
|
411
|
-
format,
|
|
412
|
-
|
|
413
|
-
}: {
|
|
414
|
-
value: Date;
|
|
415
|
-
dataType?: DataType;
|
|
416
|
-
dtype?: string;
|
|
417
|
-
format?: DateFormat | null;
|
|
418
|
-
locale: string;
|
|
419
|
-
}): React.ReactNode {
|
|
406
|
+
function renderDate(
|
|
407
|
+
value: Date,
|
|
408
|
+
dataType?: DataType,
|
|
409
|
+
dtype?: string,
|
|
410
|
+
format?: DateFormat | null,
|
|
411
|
+
): React.ReactNode {
|
|
420
412
|
const type = dataType === "date" ? "date" : "datetime";
|
|
421
413
|
const timezone = extractTimezone(dtype);
|
|
422
414
|
|
|
423
415
|
const exactValue = format
|
|
424
416
|
? formatDate(value, format)
|
|
425
|
-
: exactDateTime(value, timezone
|
|
417
|
+
: exactDateTime(value, timezone);
|
|
426
418
|
|
|
427
419
|
return (
|
|
428
420
|
<DatePopover date={value} type={type}>
|
|
@@ -431,19 +423,13 @@ function renderDate({
|
|
|
431
423
|
);
|
|
432
424
|
}
|
|
433
425
|
|
|
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
|
-
}) {
|
|
426
|
+
export function renderCellValue<TData, TValue>(
|
|
427
|
+
column: Column<TData, TValue>,
|
|
428
|
+
renderValue: () => TValue | null,
|
|
429
|
+
getValue: () => TValue,
|
|
430
|
+
selectCell?: () => void,
|
|
431
|
+
cellStyles?: string,
|
|
432
|
+
) {
|
|
447
433
|
const value = getValue();
|
|
448
434
|
const format = column.getColumnFormatting?.();
|
|
449
435
|
|
|
@@ -454,13 +440,7 @@ export function renderCellValue<TData, TValue>({
|
|
|
454
440
|
try {
|
|
455
441
|
const date = new Date(value);
|
|
456
442
|
const format = getDateFormat(value);
|
|
457
|
-
return (
|
|
458
|
-
<WithLocale>
|
|
459
|
-
{(locale) =>
|
|
460
|
-
renderDate({ value: date, dataType, dtype, format, locale })
|
|
461
|
-
}
|
|
462
|
-
</WithLocale>
|
|
463
|
-
);
|
|
443
|
+
return renderDate(date, dataType, dtype, format);
|
|
464
444
|
} catch (error) {
|
|
465
445
|
Logger.error("Error parsing datetime, fallback to string", error);
|
|
466
446
|
}
|
|
@@ -468,11 +448,7 @@ export function renderCellValue<TData, TValue>({
|
|
|
468
448
|
|
|
469
449
|
if (value instanceof Date) {
|
|
470
450
|
// e.g. 2010-10-07 17:15:00
|
|
471
|
-
return (
|
|
472
|
-
<WithLocale>
|
|
473
|
-
{(locale) => renderDate({ value, dataType, dtype, locale })}
|
|
474
|
-
</WithLocale>
|
|
475
|
-
);
|
|
451
|
+
return renderDate(value, dataType, dtype);
|
|
476
452
|
}
|
|
477
453
|
|
|
478
454
|
if (typeof value === "string") {
|