@marimo-team/frontend 0.25.2 → 0.25.3-dev12
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/{CellStatus-BP2mavAq.js → CellStatus-DVOHpdeJ.js} +1 -1
- package/dist/assets/{ConnectedDataExplorerComponent-t8fH_TNc.js → ConnectedDataExplorerComponent-TprnxZeJ.js} +1 -1
- package/dist/assets/{ErrorBoundary-Gl5nCA8C.js → ErrorBoundary-CM13wrd8.js} +2 -2
- package/dist/assets/JsonOutput-Cx1iyibB.js +11 -0
- package/dist/assets/{LazyAnyLanguageCodeMirror-CKcCbG2G.js → LazyAnyLanguageCodeMirror-B4fCknq1.js} +2 -2
- package/dist/assets/MarimoErrorOutput-s_5GOX8k.js +10 -0
- package/dist/assets/{RenderHTML-BbOqmHy3.js → RenderHTML-DX6i99Op.js} +1 -1
- package/dist/assets/{RunButton-CK3LhnP5.js → RunButton-BKoh0zYG.js} +1 -1
- package/dist/assets/{add-cell-with-ai-8UBC0xwR.js → add-cell-with-ai-BpD_790A.js} +11 -11
- package/dist/assets/{add-connection-dialog-DXQnd6eB.js → add-connection-dialog-B1BXCjex.js} +2 -2
- package/dist/assets/{agent-panel-D7kMZLG-.js → agent-panel-CDFUc1uu.js} +5 -5
- package/dist/assets/ai-model-dropdown-i1vfGeVi.js +13 -0
- package/dist/assets/{any-language-editor-BLCAD3yx.js → any-language-editor-BdTWdMCI.js} +1 -1
- package/dist/assets/{app-config-button-BKEG4x9u.js → app-config-button-AdV-QDD7.js} +1 -1
- package/dist/assets/{blob-D5nfNHOo.js → blob-BG8yoQmx.js} +1 -1
- package/dist/assets/{cell-editor-ADVfycpN.js → cell-editor-BKJ06H5F.js} +9 -9
- package/dist/assets/cell-link-8Auigi8P.js +1 -0
- package/dist/assets/{cells-BRkCaSsh.js → cells-C6YGYGdi.js} +56 -56
- package/dist/assets/{chat-display-Dnagy4Nv.js → chat-display-DhgI2MS9.js} +1 -1
- package/dist/assets/{chat-panel-DQ6HkWEF.js → chat-panel-Cau71Ygr.js} +2 -2
- package/dist/assets/{chat-ui-Df8Vcj6n.js → chat-ui-C5ql1Up-.js} +1 -1
- package/dist/assets/code-visibility-BJImdpDi.js +1 -0
- package/dist/assets/coerce-DWjFeXOY.js +1 -0
- package/dist/assets/{column-preview-Cm2D6vyX.js → column-preview-BZ_iNhtJ.js} +1 -1
- package/dist/assets/{command-palette-DTSQ7gOC.js → command-palette-DDC3kBet.js} +1 -1
- package/dist/assets/{common-Cu6CDbuw.js → common-Sl3uthjg.js} +1 -1
- package/dist/assets/{components-CGw16R_N.js → components-3cou6Mka.js} +1 -1
- package/dist/assets/{components-CP_UoFtT.js → components-CskjK6xZ.js} +1 -1
- package/dist/assets/{components-CXfO-F47.js → components-YBmtV0p6.js} +1 -1
- package/dist/assets/{config-VPSq73n8.js → config-CA1V-wjh.js} +1 -1
- package/dist/assets/config-DRIpOKqh.js +1 -0
- package/dist/assets/config-Dy28fDwn.js +1 -0
- package/dist/assets/{datasource-Cq6x_5ML.js → datasource-DfbNb83e.js} +1 -1
- package/dist/assets/{dates-BbFQ2oE4.js → dates-CfmdTL6B.js} +1 -1
- package/dist/assets/{dependency-graph-panel--Kgtktcw.js → dependency-graph-panel-L5cBE5sl.js} +1 -1
- package/dist/assets/{documentation-panel-BHmbeznw.js → documentation-panel-D7S8JIc2.js} +1 -1
- package/dist/assets/{download-DCJXy66H.js → download-C03FOElq.js} +1 -1
- package/dist/assets/edit-page-D_Rg0gQO.js +9 -0
- package/dist/assets/{error-banner-Cd69vvyX.js → error-banner-COZ7SfYV.js} +1 -1
- package/dist/assets/{error-entries-Dk3VZ-OK.js → error-entries-CLnPDv7b.js} +1 -1
- package/dist/assets/{error-panel-BPRYmC5J.js → error-panel-D2xrYLue.js} +1 -1
- package/dist/assets/{errors-DCrsa1nH.js → errors-CNsgAw6m.js} +1 -1
- package/dist/assets/{feedback-button-Bik2-e33.js → feedback-button-DzPunIqU.js} +2 -2
- package/dist/assets/feedback-button-Kla7i5RT.js +1 -0
- package/dist/assets/{file-explorer-panel-BEEK5lcl.js → file-explorer-panel-Uk4_QIJQ.js} +1 -1
- package/dist/assets/{file-name-input-Cdc-TVqO.js → file-name-input-B4fRaQkI.js} +1 -1
- package/dist/assets/{floating-outline-XD9FAV-f.js → floating-outline-B5MaM1JS.js} +1 -1
- package/dist/assets/{gallery-page-Dm6mGwBi.js → gallery-page-BefvdsM7.js} +1 -1
- package/dist/assets/{glide-data-editor-J9CAb70d.js → glide-data-editor-C3eaYlXg.js} +1 -1
- package/dist/assets/{home-page-DMHnsRxm.js → home-page-hmvKlc1w.js} +1 -1
- package/dist/assets/{hooks-93IwHd2u.js → hooks-DzML9nez.js} +1 -1
- package/dist/assets/index-6b4mf8Ai.css +2 -0
- package/dist/assets/index-ptK1gxmo.js +30 -0
- package/dist/assets/{layout-DmcNEu3P.js → layout-Ck1RoL1B.js} +5 -5
- package/dist/assets/{logs-panel-ABM16htT.js → logs-panel-BRytaWaO.js} +1 -1
- package/dist/assets/{markdown-renderer-BG3sp2rs.js → markdown-renderer-DX0Xrrfy.js} +1 -1
- package/dist/assets/{mermaid-a3xYymTy.js → mermaid-C4EiVqcd.js} +1 -1
- package/dist/assets/{name-cell-input-BgEBmqyL.js → name-cell-input-DlpTvPLa.js} +1 -1
- package/dist/assets/{outline-panel-DCXQ3_F6.js → outline-panel-B2WIpz-1.js} +1 -1
- package/dist/assets/{packages-panel-BMGOmZkR.js → packages-panel-CI5ff9b-.js} +1 -1
- package/dist/assets/{panel-accordion-state-C1sdPp0m.js → panel-accordion-state-BqSH5ttk.js} +1 -1
- package/dist/assets/panels-BCcZ_yLK.js +107 -0
- package/dist/assets/{process-output-D0KGq04R.js → process-output-f3C3PD0Z.js} +1 -1
- package/dist/assets/{readonly-code-display-Do50PHI8.js → readonly-code-display-MnMEoYW5.js} +1 -1
- package/dist/assets/{readonly-python-code-DCSMIsTX.js → readonly-python-code-ggs4hAzC.js} +1 -1
- package/dist/assets/{renderShortcut-BkVJQ_Zh.js → renderShortcut-C1JwYcqW.js} +1 -1
- package/dist/assets/{reveal-component-ltaepAqw.js → reveal-component-PiV1eQk9.js} +1 -1
- package/dist/assets/run-page-AfZhtEh1.js +1 -0
- package/dist/assets/{runtime-details-state-CSPobEdR.js → runtime-details-state-CoL-p0MC.js} +1 -1
- package/dist/assets/{schemas-Dv42wLFq.js → schemas-ChRqMOTL.js} +1 -1
- package/dist/assets/{scratchpad-panel-Dwd6W5PE.js → scratchpad-panel-D2rWg4k8.js} +1 -1
- package/dist/assets/{secrets-panel-Bctbtkrp.js → secrets-panel-D7KN4tVs.js} +1 -1
- package/dist/assets/session-panel-CnANhcTo.js +1 -0
- package/dist/assets/{snippets-panel-Bh1oTw4m.js → snippets-panel-ClGHtEKQ.js} +1 -1
- package/dist/assets/state-CbjBtkdd.js +3 -0
- package/dist/assets/{state-XsPO8hNi.js → state-DtGB7xeJ.js} +1 -1
- package/dist/assets/{terminal-Ck_vK-34.js → terminal-wnSHYT8N.js} +1 -1
- package/dist/assets/{tracing-Di6pUmX8.js → tracing-Dz2rYOFL.js} +1 -1
- package/dist/assets/{tracing-panel-PeRXHD8_.js → tracing-panel-DqQY9V91.js} +2 -2
- package/dist/assets/{tree-actions-GM5E_bUs.js → tree-actions-DnUokmva.js} +1 -1
- package/dist/assets/{useAddCell-GR7eEQrT.js → useAddCell-IN24thff.js} +1 -1
- package/dist/assets/{useBoolean-BDD6_xQQ.js → useBoolean-d0Tty94N.js} +1 -1
- package/dist/assets/{useCellActionButton-B-9eG5z_.js → useCellActionButton-DmaFZ4oF.js} +1 -1
- package/dist/assets/{useDeleteCell-2_bMClHd.js → useDeleteCell-fQlM46Y2.js} +1 -1
- package/dist/assets/{useDependencyPanelTab-k3C3M18S.js → useDependencyPanelTab-ImXYINm_.js} +1 -1
- package/dist/assets/{useInstallPackage-iX1eufdl.js → useInstallPackage-BW06eter.js} +1 -1
- package/dist/assets/{useNotebookActions-NHN6A-cN.js → useNotebookActions-DHt3s-ia.js} +1 -1
- package/dist/assets/{useRunCells-B2vUhREg.js → useRunCells-DSJPXE-j.js} +1 -1
- package/dist/assets/{useSplitCell-DEb03htp.js → useSplitCell-DQyMF5gd.js} +1 -1
- package/dist/assets/{useTheme-COhSHkCj.js → useTheme-n8Dj1zH7.js} +1 -1
- package/dist/assets/{vega-component-CnadTgoE.js → vega-component-IouMe13t.js} +1 -1
- package/dist/index.html +34 -35
- package/package.json +5 -2
- package/src/__tests__/fixtures/{pair-preview.ts → pair-config.ts} +3 -2
- package/src/__tests__/host-imports.test.ts +100 -0
- package/src/__tests__/mount.test.ts +28 -8
- package/src/components/data-table/__tests__/context-menu.test.ts +176 -0
- package/src/components/data-table/__tests__/date-filter-inputs.test.tsx +24 -1
- package/src/components/data-table/__tests__/export-actions.test.tsx +329 -6
- package/src/components/data-table/context-menu.tsx +125 -26
- package/src/components/data-table/date-filter-inputs.tsx +15 -42
- package/src/components/data-table/export-actions.tsx +192 -116
- package/src/components/data-table/schemas.ts +14 -36
- package/src/components/data-table/utils.ts +18 -0
- package/src/components/editor/Output.tsx +9 -2
- package/src/components/editor/actions/__tests__/pair-with-agent-commands.test.ts +80 -252
- package/src/components/editor/actions/__tests__/pair-with-agent-modal.test.tsx +186 -34
- package/src/components/editor/actions/pair-with-agent-commands.ts +42 -51
- package/src/components/editor/actions/pair-with-agent-modal.tsx +96 -36
- package/src/components/editor/chrome/panels/error-panel.tsx +1 -0
- package/src/components/editor/chrome/wrapper/__tests__/attachment-status.test.tsx +372 -0
- package/src/components/editor/chrome/wrapper/footer-item.tsx +32 -24
- package/src/components/editor/chrome/wrapper/footer-items/attachment-status.tsx +237 -0
- package/src/components/editor/chrome/wrapper/footer.tsx +2 -0
- package/src/components/editor/errors/__tests__/send-error-report-button.test.tsx +548 -0
- package/src/components/editor/errors/send-error-report-button.tsx +69 -0
- package/src/components/editor/output/MarimoErrorOutput.tsx +21 -5
- package/src/components/editor/output/MarimoTracebackOutput.tsx +35 -20
- package/src/components/editor/output/__tests__/ansi-reduce.test.ts +18 -0
- package/src/components/editor/output/ansi-reduce.ts +6 -0
- package/src/core/attachments/__tests__/toast.test.tsx +58 -0
- package/src/core/attachments/state.ts +21 -0
- package/src/core/attachments/toast.ts +15 -0
- package/src/core/cells/__tests__/cells.test.ts +52 -0
- package/src/core/cells/__tests__/error-report.test.ts +139 -0
- package/src/core/cells/__tests__/session.test.ts +50 -1
- package/src/core/cells/error-report.ts +63 -0
- package/src/core/cells/session.ts +28 -1
- package/src/core/config/pair.ts +5 -3
- package/src/core/edit-app.tsx +2 -2
- package/src/core/host/AGENTS.md +6 -0
- package/src/core/host/__tests__/events.test.ts +46 -0
- package/src/core/host/__tests__/notebook-client.test.ts +191 -0
- package/src/core/host/__tests__/protocol.test.ts +214 -0
- package/src/core/host/connection.ts +81 -0
- package/src/core/host/events.ts +60 -0
- package/src/core/host/notebook-client.ts +226 -0
- package/src/core/host/protocol.ts +1943 -0
- package/src/core/islands/__tests__/bootstrap.test.ts +26 -0
- package/src/core/islands/bootstrap.ts +1 -0
- package/src/core/run-app.tsx +2 -2
- package/src/core/runtime/__tests__/runtime.test.ts +55 -11
- package/src/core/runtime/runtime.ts +14 -1
- package/src/core/runtime/types.ts +2 -0
- package/src/core/websocket/__tests__/{useMarimoKernelConnection.test.ts → connection-state.test.ts} +15 -17
- package/src/core/websocket/__tests__/{useWebSocket.test.ts → createConnectionTransport.test.ts} +1 -1
- package/src/core/websocket/__tests__/useNotebookClient.hook.test.tsx +140 -0
- package/src/core/websocket/__tests__/{useMarimoKernelConnection.hook.test.tsx → useNotebookSession.hook.test.tsx} +352 -65
- package/src/core/websocket/connection-state.ts +70 -0
- package/src/core/websocket/transports/__tests__/sse.test.ts +1 -4
- package/src/core/websocket/transports/create.ts +31 -0
- package/src/core/websocket/transports/transport.ts +12 -23
- package/src/core/websocket/types.ts +9 -39
- package/src/core/websocket/useNotebookClient.ts +80 -0
- package/src/core/websocket/{useMarimoKernelConnection.tsx → useNotebookSession.tsx} +67 -225
- package/src/mount.tsx +7 -3
- package/src/plugins/impl/__tests__/DataTablePlugin.test.tsx +84 -0
- package/src/utils/__tests__/dates.test.ts +116 -0
- package/src/utils/dates.ts +94 -0
- package/dist/assets/JsonOutput-D6HIIsCb.js +0 -11
- package/dist/assets/MarimoErrorOutput-D60XkCny.js +0 -6
- package/dist/assets/ai-model-dropdown-B0z6-zhp.js +0 -5
- package/dist/assets/api-BeC_VSGv.js +0 -1
- package/dist/assets/cell-link-LSth_8hT.js +0 -1
- package/dist/assets/code-visibility-B-_GvwR5.js +0 -1
- package/dist/assets/coerce-CpE6kUdX.js +0 -1
- package/dist/assets/config-BOKzA3tF.js +0 -1
- package/dist/assets/config-DX8Y2WbJ.js +0 -1
- package/dist/assets/edit-page-ChcSgpke.js +0 -9
- package/dist/assets/feedback-button-B2gKC5cn.js +0 -1
- package/dist/assets/index-Bcdzex-3.css +0 -2
- package/dist/assets/index-s-M1OXjs.js +0 -29
- package/dist/assets/pair-CaQyK6En.js +0 -1
- package/dist/assets/panels-CxVG8-v2.js +0 -4
- package/dist/assets/run-page-DF3c5cDk.js +0 -1
- package/dist/assets/session-panel-VdDhEBa-.js +0 -1
- package/dist/assets/state-_Qai_QyX.js +0 -3
- package/src/core/websocket/useWebSocket.tsx +0 -88
|
@@ -54,6 +54,7 @@ function renderExportActions(
|
|
|
54
54
|
props: Partial<ExportActionProps> = {},
|
|
55
55
|
sizeLimit: { limitBytes: number; unavailableMessage: string } | null = null,
|
|
56
56
|
mode: AppMode = "edit",
|
|
57
|
+
strictMode = false,
|
|
57
58
|
) {
|
|
58
59
|
const store = createStore();
|
|
59
60
|
store.set(downloadSizeLimitAtom, sizeLimit);
|
|
@@ -66,7 +67,7 @@ function renderExportActions(
|
|
|
66
67
|
</TooltipProvider>
|
|
67
68
|
</Provider>
|
|
68
69
|
);
|
|
69
|
-
const result = render(view(props));
|
|
70
|
+
const result = render(view(props), { reactStrictMode: strictMode });
|
|
70
71
|
return {
|
|
71
72
|
...result,
|
|
72
73
|
rerenderExportActions: (nextProps: Partial<ExportActionProps>) =>
|
|
@@ -284,7 +285,7 @@ describe("ExportActions dialog", () => {
|
|
|
284
285
|
await waitFor(() => {
|
|
285
286
|
expect(downloadByURL).toHaveBeenCalled();
|
|
286
287
|
});
|
|
287
|
-
expect(getExportMetadata).toHaveBeenCalledTimes(
|
|
288
|
+
expect(getExportMetadata).toHaveBeenCalledTimes(3);
|
|
288
289
|
expect(
|
|
289
290
|
screen.queryByText("GeoParquet export requires pyarrow."),
|
|
290
291
|
).not.toBeInTheDocument();
|
|
@@ -310,10 +311,10 @@ describe("ExportActions dialog", () => {
|
|
|
310
311
|
mocks.handleInstallPackages.mock.calls[0][1]();
|
|
311
312
|
});
|
|
312
313
|
await waitFor(() => {
|
|
313
|
-
expect(getExportMetadata).toHaveBeenCalledTimes(
|
|
314
|
+
expect(getExportMetadata).toHaveBeenCalledTimes(3);
|
|
314
315
|
});
|
|
315
316
|
expect(
|
|
316
|
-
screen.
|
|
317
|
+
await screen.findByRole("button", { name: "Install pyarrow" }),
|
|
317
318
|
).toBeInTheDocument();
|
|
318
319
|
expect(
|
|
319
320
|
screen.getByRole("button", { name: "Download GeoParquet" }),
|
|
@@ -530,6 +531,328 @@ describe("ExportActions dialog", () => {
|
|
|
530
531
|
expect(downloadByURL).not.toHaveBeenCalled();
|
|
531
532
|
});
|
|
532
533
|
|
|
534
|
+
async function startGeoParquetInstall(strictMode = false) {
|
|
535
|
+
const getExportMetadata = vi.fn().mockResolvedValue(geometryMetadata);
|
|
536
|
+
downloadAs.mockResolvedValueOnce({
|
|
537
|
+
url: "",
|
|
538
|
+
filename: "",
|
|
539
|
+
error: "GeoParquet export requires pyarrow.",
|
|
540
|
+
missing_packages: ["pyarrow"],
|
|
541
|
+
});
|
|
542
|
+
const { rerenderExportActions, unmount } = renderExportActions(
|
|
543
|
+
{ getExportMetadata, metadataSource: "first" },
|
|
544
|
+
null,
|
|
545
|
+
"edit",
|
|
546
|
+
strictMode,
|
|
547
|
+
);
|
|
548
|
+
const dialog = await openDialog();
|
|
549
|
+
fireEvent.click(
|
|
550
|
+
await screen.findByRole("button", { name: "Download GeoParquet" }),
|
|
551
|
+
);
|
|
552
|
+
fireEvent.click(
|
|
553
|
+
await screen.findByRole("button", { name: "Install pyarrow" }),
|
|
554
|
+
);
|
|
555
|
+
return { dialog, getExportMetadata, rerenderExportActions, unmount };
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
it("does not retry with a geometry choice after the final geometry disappears", async () => {
|
|
559
|
+
const { getExportMetadata } = await startGeoParquetInstall();
|
|
560
|
+
getExportMetadata.mockResolvedValue({
|
|
561
|
+
geometry_columns: [],
|
|
562
|
+
primary_geometry_column: null,
|
|
563
|
+
default_geometry_column: null,
|
|
564
|
+
formats: {},
|
|
565
|
+
});
|
|
566
|
+
|
|
567
|
+
await act(async () => mocks.handleInstallPackages.mock.calls[0][1]());
|
|
568
|
+
|
|
569
|
+
expect(downloadAs).toHaveBeenCalledTimes(1);
|
|
570
|
+
expect(downloadByURL).not.toHaveBeenCalled();
|
|
571
|
+
expect(
|
|
572
|
+
await screen.findByText(
|
|
573
|
+
"The selected geometry is no longer available. Choose another geometry to export.",
|
|
574
|
+
),
|
|
575
|
+
).toBeInTheDocument();
|
|
576
|
+
fireEvent.click(screen.getByRole("button", { name: "Download Parquet" }));
|
|
577
|
+
await waitFor(() => expect(downloadByURL).toHaveBeenCalledTimes(1));
|
|
578
|
+
expect(downloadAs).toHaveBeenLastCalledWith({ format: "parquet" });
|
|
579
|
+
});
|
|
580
|
+
|
|
581
|
+
it("does not export when installation finishes after the widget unmounts", async () => {
|
|
582
|
+
const { getExportMetadata, unmount } = await startGeoParquetInstall();
|
|
583
|
+
unmount();
|
|
584
|
+
|
|
585
|
+
await act(async () => mocks.handleInstallPackages.mock.calls[0][1]());
|
|
586
|
+
|
|
587
|
+
expect(getExportMetadata).toHaveBeenCalledTimes(1);
|
|
588
|
+
expect(downloadAs).toHaveBeenCalledTimes(1);
|
|
589
|
+
expect(downloadByURL).not.toHaveBeenCalled();
|
|
590
|
+
});
|
|
591
|
+
|
|
592
|
+
it("does not export when post-install metadata resolves after unmount", async () => {
|
|
593
|
+
const { getExportMetadata, unmount } = await startGeoParquetInstall();
|
|
594
|
+
let resolveCheck: (value: ExportMetadata) => void = () => undefined;
|
|
595
|
+
getExportMetadata.mockImplementationOnce(
|
|
596
|
+
() =>
|
|
597
|
+
new Promise<ExportMetadata>((resolve) => {
|
|
598
|
+
resolveCheck = resolve;
|
|
599
|
+
}),
|
|
600
|
+
);
|
|
601
|
+
await act(async () => mocks.handleInstallPackages.mock.calls[0][1]());
|
|
602
|
+
expect(getExportMetadata).toHaveBeenCalledTimes(2);
|
|
603
|
+
unmount();
|
|
604
|
+
|
|
605
|
+
await act(async () => resolveCheck(geometryMetadata));
|
|
606
|
+
|
|
607
|
+
expect(downloadAs).toHaveBeenCalledTimes(1);
|
|
608
|
+
expect(downloadByURL).not.toHaveBeenCalled();
|
|
609
|
+
});
|
|
610
|
+
|
|
611
|
+
it("does not deliver a retried export that resolves after unmount", async () => {
|
|
612
|
+
const { unmount } = await startGeoParquetInstall();
|
|
613
|
+
let resolveDownload: (value: {
|
|
614
|
+
url: string;
|
|
615
|
+
filename: string;
|
|
616
|
+
}) => void = () => undefined;
|
|
617
|
+
downloadAs.mockImplementationOnce(
|
|
618
|
+
() =>
|
|
619
|
+
new Promise((resolve) => {
|
|
620
|
+
resolveDownload = resolve;
|
|
621
|
+
}),
|
|
622
|
+
);
|
|
623
|
+
await act(async () => mocks.handleInstallPackages.mock.calls[0][1]());
|
|
624
|
+
expect(downloadAs).toHaveBeenCalledTimes(2);
|
|
625
|
+
unmount();
|
|
626
|
+
|
|
627
|
+
await act(async () =>
|
|
628
|
+
resolveDownload({
|
|
629
|
+
url: "https://example.test/export",
|
|
630
|
+
filename: "table",
|
|
631
|
+
}),
|
|
632
|
+
);
|
|
633
|
+
|
|
634
|
+
expect(downloadByURL).not.toHaveBeenCalled();
|
|
635
|
+
});
|
|
636
|
+
|
|
637
|
+
it("retries after installation under StrictMode effect replay", async () => {
|
|
638
|
+
await startGeoParquetInstall(true);
|
|
639
|
+
|
|
640
|
+
await act(async () => mocks.handleInstallPackages.mock.calls[0][1]());
|
|
641
|
+
|
|
642
|
+
await waitFor(() => expect(downloadByURL).toHaveBeenCalledTimes(1));
|
|
643
|
+
expect(downloadAs).toHaveBeenLastCalledWith({
|
|
644
|
+
format: "parquet",
|
|
645
|
+
geometry_column: "location",
|
|
646
|
+
});
|
|
647
|
+
});
|
|
648
|
+
|
|
649
|
+
it("does not export when installation finishes after the dialog closes", async () => {
|
|
650
|
+
const { dialog, getExportMetadata } = await startGeoParquetInstall();
|
|
651
|
+
fireEvent.click(within(dialog).getByRole("button", { name: "Close" }));
|
|
652
|
+
await waitFor(() => {
|
|
653
|
+
expect(screen.queryByRole("dialog")).not.toBeInTheDocument();
|
|
654
|
+
});
|
|
655
|
+
|
|
656
|
+
await act(async () => mocks.handleInstallPackages.mock.calls[0][1]());
|
|
657
|
+
|
|
658
|
+
expect(getExportMetadata).toHaveBeenCalledTimes(1);
|
|
659
|
+
expect(downloadAs).toHaveBeenCalledTimes(1);
|
|
660
|
+
expect(downloadByURL).not.toHaveBeenCalled();
|
|
661
|
+
});
|
|
662
|
+
|
|
663
|
+
it("does not export when installation finishes after the source changes", async () => {
|
|
664
|
+
const { getExportMetadata, rerenderExportActions } =
|
|
665
|
+
await startGeoParquetInstall();
|
|
666
|
+
rerenderExportActions({ getExportMetadata, metadataSource: "second" });
|
|
667
|
+
await waitFor(() => {
|
|
668
|
+
expect(getExportMetadata).toHaveBeenCalledTimes(2);
|
|
669
|
+
});
|
|
670
|
+
|
|
671
|
+
await act(async () => mocks.handleInstallPackages.mock.calls[0][1]());
|
|
672
|
+
|
|
673
|
+
expect(getExportMetadata).toHaveBeenCalledTimes(2);
|
|
674
|
+
expect(downloadAs).toHaveBeenCalledTimes(1);
|
|
675
|
+
expect(downloadByURL).not.toHaveBeenCalled();
|
|
676
|
+
});
|
|
677
|
+
|
|
678
|
+
it("does not export a non-geographic retry after the dialog closes", async () => {
|
|
679
|
+
downloadAs.mockResolvedValueOnce({
|
|
680
|
+
url: "",
|
|
681
|
+
filename: "",
|
|
682
|
+
error: "Parquet export requires pyarrow.",
|
|
683
|
+
missing_packages: ["pyarrow"],
|
|
684
|
+
});
|
|
685
|
+
renderExportActions();
|
|
686
|
+
const dialog = await openDialog();
|
|
687
|
+
fireEvent.click(screen.getByRole("button", { name: "Download Parquet" }));
|
|
688
|
+
fireEvent.click(
|
|
689
|
+
await screen.findByRole("button", { name: "Install pyarrow" }),
|
|
690
|
+
);
|
|
691
|
+
fireEvent.click(within(dialog).getByRole("button", { name: "Close" }));
|
|
692
|
+
|
|
693
|
+
await act(async () => mocks.handleInstallPackages.mock.calls[0][1]());
|
|
694
|
+
|
|
695
|
+
expect(downloadAs).toHaveBeenCalledTimes(1);
|
|
696
|
+
expect(downloadByURL).not.toHaveBeenCalled();
|
|
697
|
+
});
|
|
698
|
+
|
|
699
|
+
it("retries after installation when an earlier export succeeded", async () => {
|
|
700
|
+
const getExportMetadata = vi.fn().mockResolvedValue({
|
|
701
|
+
...geometryMetadata,
|
|
702
|
+
formats: {
|
|
703
|
+
parquet: {
|
|
704
|
+
available: false,
|
|
705
|
+
reason: "GeoParquet export requires pyarrow.",
|
|
706
|
+
missing_packages: ["pyarrow"],
|
|
707
|
+
},
|
|
708
|
+
},
|
|
709
|
+
});
|
|
710
|
+
renderExportActions({ getExportMetadata });
|
|
711
|
+
await openDialog();
|
|
712
|
+
fireEvent.click(screen.getByRole("button", { name: "Download CSV" }));
|
|
713
|
+
await waitFor(() => expect(downloadByURL).toHaveBeenCalledTimes(1));
|
|
714
|
+
fireEvent.click(
|
|
715
|
+
await screen.findByRole("button", { name: "Install pyarrow" }),
|
|
716
|
+
);
|
|
717
|
+
getExportMetadata.mockResolvedValue(geometryMetadata);
|
|
718
|
+
|
|
719
|
+
await act(async () => mocks.handleInstallPackages.mock.calls[0][1]());
|
|
720
|
+
|
|
721
|
+
await waitFor(() => expect(downloadByURL).toHaveBeenCalledTimes(2));
|
|
722
|
+
expect(downloadAs).toHaveBeenLastCalledWith({
|
|
723
|
+
format: "parquet",
|
|
724
|
+
geometry_column: "location",
|
|
725
|
+
});
|
|
726
|
+
});
|
|
727
|
+
|
|
728
|
+
it("waits for the post-install metadata check before exporting", async () => {
|
|
729
|
+
let resolveCheck: (value: ExportMetadata) => void = () => undefined;
|
|
730
|
+
const getExportMetadata = vi.fn().mockResolvedValue({
|
|
731
|
+
...geometryMetadata,
|
|
732
|
+
formats: {
|
|
733
|
+
parquet: {
|
|
734
|
+
available: false,
|
|
735
|
+
reason: "GeoParquet export requires pyarrow.",
|
|
736
|
+
missing_packages: ["pyarrow"],
|
|
737
|
+
},
|
|
738
|
+
},
|
|
739
|
+
});
|
|
740
|
+
renderExportActions({ getExportMetadata });
|
|
741
|
+
await openDialog();
|
|
742
|
+
fireEvent.click(
|
|
743
|
+
await screen.findByRole("button", { name: "Install pyarrow" }),
|
|
744
|
+
);
|
|
745
|
+
getExportMetadata.mockImplementationOnce(
|
|
746
|
+
() =>
|
|
747
|
+
new Promise((resolve) => {
|
|
748
|
+
resolveCheck = resolve;
|
|
749
|
+
}),
|
|
750
|
+
);
|
|
751
|
+
|
|
752
|
+
await act(async () => mocks.handleInstallPackages.mock.calls[0][1]());
|
|
753
|
+
expect(downloadAs).not.toHaveBeenCalled();
|
|
754
|
+
|
|
755
|
+
getExportMetadata.mockResolvedValue(geometryMetadata);
|
|
756
|
+
await act(async () => resolveCheck(geometryMetadata));
|
|
757
|
+
await waitFor(() => expect(downloadByURL).toHaveBeenCalled());
|
|
758
|
+
expect(downloadAs).toHaveBeenCalledTimes(1);
|
|
759
|
+
});
|
|
760
|
+
|
|
761
|
+
it("uses the new source eligibility after a settled package failure", async () => {
|
|
762
|
+
const getExportMetadata = vi.fn().mockResolvedValue(geometryMetadata);
|
|
763
|
+
downloadAs.mockResolvedValueOnce({
|
|
764
|
+
url: "",
|
|
765
|
+
filename: "",
|
|
766
|
+
error: "GeoParquet export requires pyarrow.",
|
|
767
|
+
missing_packages: ["pyarrow"],
|
|
768
|
+
});
|
|
769
|
+
const { rerenderExportActions } = renderExportActions({
|
|
770
|
+
getExportMetadata,
|
|
771
|
+
metadataSource: "first",
|
|
772
|
+
});
|
|
773
|
+
await openDialog();
|
|
774
|
+
fireEvent.click(
|
|
775
|
+
await screen.findByRole("button", { name: "Download GeoParquet" }),
|
|
776
|
+
);
|
|
777
|
+
await screen.findByRole("button", { name: "Install pyarrow" });
|
|
778
|
+
|
|
779
|
+
rerenderExportActions({ getExportMetadata, metadataSource: "second" });
|
|
780
|
+
|
|
781
|
+
await waitFor(() =>
|
|
782
|
+
expect(
|
|
783
|
+
screen.getByRole("button", { name: "Download GeoParquet" }),
|
|
784
|
+
).toBeEnabled(),
|
|
785
|
+
);
|
|
786
|
+
expect(
|
|
787
|
+
screen.queryByRole("button", { name: "Install pyarrow" }),
|
|
788
|
+
).not.toBeInTheDocument();
|
|
789
|
+
});
|
|
790
|
+
|
|
791
|
+
it("ignores metadata for an earlier source that resolves late", async () => {
|
|
792
|
+
let resolveFirst: (value: ExportMetadata) => void = () => undefined;
|
|
793
|
+
const first = vi.fn(
|
|
794
|
+
() =>
|
|
795
|
+
new Promise<ExportMetadata>((resolve) => {
|
|
796
|
+
resolveFirst = resolve;
|
|
797
|
+
}),
|
|
798
|
+
);
|
|
799
|
+
const second = vi.fn().mockResolvedValue({
|
|
800
|
+
...geometryMetadata,
|
|
801
|
+
geometry_columns: [
|
|
802
|
+
{ name: "region", encoding: "objects", crs: "EPSG:3857" },
|
|
803
|
+
],
|
|
804
|
+
primary_geometry_column: "region",
|
|
805
|
+
default_geometry_column: "region",
|
|
806
|
+
});
|
|
807
|
+
const { rerenderExportActions } = renderExportActions({
|
|
808
|
+
getExportMetadata: first,
|
|
809
|
+
metadataSource: "first",
|
|
810
|
+
});
|
|
811
|
+
await openDialog();
|
|
812
|
+
rerenderExportActions({
|
|
813
|
+
getExportMetadata: second,
|
|
814
|
+
metadataSource: "second",
|
|
815
|
+
});
|
|
816
|
+
await waitFor(() =>
|
|
817
|
+
expect(screen.getByTestId("export-summary-parquet")).toHaveTextContent(
|
|
818
|
+
"region",
|
|
819
|
+
),
|
|
820
|
+
);
|
|
821
|
+
|
|
822
|
+
await act(async () => resolveFirst(geometryMetadata));
|
|
823
|
+
|
|
824
|
+
expect(screen.getByTestId("export-summary-parquet")).toHaveTextContent(
|
|
825
|
+
"region",
|
|
826
|
+
);
|
|
827
|
+
});
|
|
828
|
+
|
|
829
|
+
it("does not use earlier metadata when the new source request fails", async () => {
|
|
830
|
+
const getExportMetadata = vi.fn().mockResolvedValue(geometryMetadata);
|
|
831
|
+
const { rerenderExportActions } = renderExportActions({
|
|
832
|
+
getExportMetadata,
|
|
833
|
+
metadataSource: "first",
|
|
834
|
+
});
|
|
835
|
+
await openDialog();
|
|
836
|
+
await waitFor(() =>
|
|
837
|
+
expect(
|
|
838
|
+
screen.getByRole("button", { name: "Download GeoParquet" }),
|
|
839
|
+
).toBeEnabled(),
|
|
840
|
+
);
|
|
841
|
+
getExportMetadata.mockRejectedValueOnce(new Error("Connection lost"));
|
|
842
|
+
|
|
843
|
+
rerenderExportActions({ getExportMetadata, metadataSource: "second" });
|
|
844
|
+
|
|
845
|
+
expect(
|
|
846
|
+
await screen.findByText(
|
|
847
|
+
"Could not load geometry options: Connection lost",
|
|
848
|
+
),
|
|
849
|
+
).toBeInTheDocument();
|
|
850
|
+
expect(
|
|
851
|
+
screen.getByRole("button", { name: "Download Parquet" }),
|
|
852
|
+
).toBeDisabled();
|
|
853
|
+
expect(screen.getByRole("button", { name: "Download CSV" })).toBeEnabled();
|
|
854
|
+
});
|
|
855
|
+
|
|
533
856
|
it("shows formats in the approved order with an options toggle where supported", async () => {
|
|
534
857
|
renderExportActions();
|
|
535
858
|
const dialog = await openDialog();
|
|
@@ -1412,7 +1735,7 @@ describe("ExportActions GeoJSON", () => {
|
|
|
1412
1735
|
);
|
|
1413
1736
|
await act(async () => mocks.handleInstallPackages.mock.calls[0][1]());
|
|
1414
1737
|
await waitFor(() => expect(downloadByURL).toHaveBeenCalled());
|
|
1415
|
-
expect(getExportMetadata).toHaveBeenCalledTimes(
|
|
1738
|
+
expect(getExportMetadata).toHaveBeenCalledTimes(3);
|
|
1416
1739
|
expect(downloadAs).toHaveBeenLastCalledWith({
|
|
1417
1740
|
format: "geojson",
|
|
1418
1741
|
geometry_column: "boundary",
|
|
@@ -1685,7 +2008,7 @@ describe("ExportActions GeoJSON clipboard", () => {
|
|
|
1685
2008
|
format: "geojson",
|
|
1686
2009
|
geometry_column: "boundary",
|
|
1687
2010
|
});
|
|
1688
|
-
expect(getExportMetadata).toHaveBeenCalledTimes(
|
|
2011
|
+
expect(getExportMetadata).toHaveBeenCalledTimes(3);
|
|
1689
2012
|
expect(downloadByURL).not.toHaveBeenCalled();
|
|
1690
2013
|
});
|
|
1691
2014
|
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
2
|
|
|
3
|
+
import type { DataType } from "@/core/kernel/messages";
|
|
4
|
+
import { assertNever } from "@/utils/assertNever";
|
|
5
|
+
import { copyToClipboard } from "@/utils/copy";
|
|
6
|
+
import {
|
|
7
|
+
parseLocalISODate,
|
|
8
|
+
parseLocalISODateTime,
|
|
9
|
+
parseTimeToDate,
|
|
10
|
+
} from "@/utils/dates";
|
|
11
|
+
import { Logger } from "@/utils/Logger";
|
|
3
12
|
import type { Cell } from "@tanstack/react-table";
|
|
4
13
|
import { useAtomValue } from "jotai";
|
|
5
14
|
import { CopyIcon, FilterIcon, SquareStack } from "lucide-react";
|
|
6
15
|
import type { RefObject } from "react";
|
|
7
16
|
import useEvent from "react-use-event-hook";
|
|
8
|
-
import { copyToClipboard } from "@/utils/copy";
|
|
9
|
-
import { Logger } from "@/utils/Logger";
|
|
10
17
|
import {
|
|
11
18
|
ContextMenu,
|
|
12
19
|
ContextMenuContent,
|
|
@@ -16,13 +23,94 @@ import {
|
|
|
16
23
|
ContextMenuTrigger,
|
|
17
24
|
} from "../ui/context-menu";
|
|
18
25
|
import { DATA_CELL_ID } from "./cell-utils";
|
|
19
|
-
import {
|
|
20
|
-
Filter,
|
|
21
|
-
isMembershipFilterType,
|
|
22
|
-
type MembershipFilterType,
|
|
23
|
-
} from "./filters";
|
|
26
|
+
import { type FilterType, Filter } from "./filters";
|
|
24
27
|
import { selectedCellsAtom } from "./range-focus/atoms";
|
|
25
|
-
import { getClipboardContent, getRawValue } from "./utils";
|
|
28
|
+
import { getClipboardContent, getRawValue, isNullishSentinel } from "./utils";
|
|
29
|
+
|
|
30
|
+
type Comparison = "eq" | "neq";
|
|
31
|
+
|
|
32
|
+
const symbolOp = {
|
|
33
|
+
eq: "==",
|
|
34
|
+
neq: "!=",
|
|
35
|
+
} as const;
|
|
36
|
+
|
|
37
|
+
const textOp = {
|
|
38
|
+
eq: "equals",
|
|
39
|
+
neq: "does_not_equal",
|
|
40
|
+
} as const;
|
|
41
|
+
|
|
42
|
+
export function buildCellFilter({
|
|
43
|
+
type,
|
|
44
|
+
value,
|
|
45
|
+
comparison = "eq",
|
|
46
|
+
dataType,
|
|
47
|
+
dtype,
|
|
48
|
+
}: {
|
|
49
|
+
type: FilterType;
|
|
50
|
+
value: unknown;
|
|
51
|
+
comparison?: Comparison;
|
|
52
|
+
dataType?: DataType;
|
|
53
|
+
dtype?: string;
|
|
54
|
+
}) {
|
|
55
|
+
if (isNullishSentinel(value, dataType, dtype)) {
|
|
56
|
+
return { type, operator: comparison === "eq" ? "is_null" : "is_not_null" };
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
switch (type) {
|
|
60
|
+
case "number":
|
|
61
|
+
if (typeof value !== "number") {
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return Filter.number({
|
|
66
|
+
operator: symbolOp[comparison],
|
|
67
|
+
value,
|
|
68
|
+
});
|
|
69
|
+
case "text":
|
|
70
|
+
return Filter.text({
|
|
71
|
+
operator: textOp[comparison],
|
|
72
|
+
text: value as string,
|
|
73
|
+
});
|
|
74
|
+
case "date": {
|
|
75
|
+
const date = parseLocalISODate(value as string);
|
|
76
|
+
if (!date) {
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
return Filter.date({
|
|
80
|
+
operator: symbolOp[comparison],
|
|
81
|
+
value: date,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
case "datetime": {
|
|
85
|
+
const date = parseLocalISODateTime(value as string);
|
|
86
|
+
if (!date) {
|
|
87
|
+
return undefined;
|
|
88
|
+
}
|
|
89
|
+
return Filter.datetime({
|
|
90
|
+
operator: symbolOp[comparison],
|
|
91
|
+
value: date,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
case "time": {
|
|
95
|
+
const time = parseTimeToDate(value as string);
|
|
96
|
+
if (!time) {
|
|
97
|
+
return undefined;
|
|
98
|
+
}
|
|
99
|
+
return Filter.time({
|
|
100
|
+
operator: symbolOp[comparison],
|
|
101
|
+
value: time,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
case "boolean": {
|
|
105
|
+
const target = comparison === "eq" ? value : !(value as boolean);
|
|
106
|
+
return Filter.boolean({
|
|
107
|
+
operator: target ? "is_true" : "is_false",
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
default:
|
|
111
|
+
assertNever(type);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
26
114
|
|
|
27
115
|
export const DataTableContextMenu = <TData,>({
|
|
28
116
|
contextMenuRef,
|
|
@@ -102,19 +190,34 @@ export const CellContextMenu = <TData,>({
|
|
|
102
190
|
|
|
103
191
|
const column = cell.column;
|
|
104
192
|
const filterType = column.columnDef.meta?.filterType;
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
|
|
193
|
+
const dataType = column.columnDef.meta?.dataType;
|
|
194
|
+
const dtype = column.columnDef.meta?.dtype;
|
|
195
|
+
|
|
196
|
+
const canFilter = Boolean(filterType && column.getCanFilter());
|
|
197
|
+
const buildFilter = (comparison: Comparison) =>
|
|
198
|
+
canFilter
|
|
199
|
+
? buildCellFilter({
|
|
200
|
+
type: filterType as FilterType,
|
|
201
|
+
value: rawValue,
|
|
202
|
+
comparison,
|
|
203
|
+
dataType,
|
|
204
|
+
dtype,
|
|
205
|
+
})
|
|
108
206
|
: undefined;
|
|
207
|
+
const eqFilter = buildFilter("eq");
|
|
208
|
+
const canFilterByValue = eqFilter !== undefined;
|
|
209
|
+
|
|
210
|
+
const handleFilterCellByValue = (comparison: Comparison) => {
|
|
211
|
+
if (!filterType) {
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
const filter = comparison === "eq" ? eqFilter : buildFilter("neq");
|
|
216
|
+
|
|
217
|
+
if (!filter) {
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
109
220
|
|
|
110
|
-
const handleFilterCell = (
|
|
111
|
-
type: MembershipFilterType,
|
|
112
|
-
operator: "in" | "not_in",
|
|
113
|
-
) => {
|
|
114
|
-
const filter =
|
|
115
|
-
type === "number"
|
|
116
|
-
? Filter.number({ operator, values: [rawValue] })
|
|
117
|
-
: Filter.text({ operator, values: [rawValue] });
|
|
118
221
|
column.setFilterValue(filter);
|
|
119
222
|
};
|
|
120
223
|
|
|
@@ -130,18 +233,14 @@ export const CellContextMenu = <TData,>({
|
|
|
130
233
|
Copy selected cells
|
|
131
234
|
</ContextMenuItem>
|
|
132
235
|
)}
|
|
133
|
-
{
|
|
236
|
+
{canFilterByValue && (
|
|
134
237
|
<>
|
|
135
238
|
<ContextMenuSeparator />
|
|
136
|
-
<ContextMenuItem
|
|
137
|
-
onClick={() => handleFilterCell(membershipFilterType, "in")}
|
|
138
|
-
>
|
|
239
|
+
<ContextMenuItem onClick={() => handleFilterCellByValue("eq")}>
|
|
139
240
|
<FilterIcon className="mo-dropdown-icon h-3 w-3" />
|
|
140
241
|
Filter by this value
|
|
141
242
|
</ContextMenuItem>
|
|
142
|
-
<ContextMenuItem
|
|
143
|
-
onClick={() => handleFilterCell(membershipFilterType, "not_in")}
|
|
144
|
-
>
|
|
243
|
+
<ContextMenuItem onClick={() => handleFilterCellByValue("neq")}>
|
|
145
244
|
<FilterIcon className="mo-dropdown-icon h-3 w-3" />
|
|
146
245
|
Remove rows with this value
|
|
147
246
|
</ContextMenuItem>
|
|
@@ -14,6 +14,9 @@ import {
|
|
|
14
14
|
dateToLocalISODate,
|
|
15
15
|
dateToLocalISODateTime,
|
|
16
16
|
dateToLocalISOTime,
|
|
17
|
+
parseLocalISODate,
|
|
18
|
+
parseLocalISODateTime,
|
|
19
|
+
parseTimeToDate,
|
|
17
20
|
} from "@/utils/dates";
|
|
18
21
|
import type { FilterType } from "./filters";
|
|
19
22
|
|
|
@@ -72,53 +75,23 @@ export function parsePastedDate(
|
|
|
72
75
|
return undefined;
|
|
73
76
|
}
|
|
74
77
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
if (timeMatch) {
|
|
80
|
-
const [, hStr, mStr, sStr, ampm] = timeMatch;
|
|
81
|
-
let hour = Number.parseInt(hStr, 10);
|
|
82
|
-
const minute = Number.parseInt(mStr, 10);
|
|
83
|
-
const second = sStr ? Number.parseInt(sStr, 10) : 0;
|
|
84
|
-
if (ampm) {
|
|
85
|
-
const isPm = ampm.toLowerCase() === "pm";
|
|
86
|
-
if (hour === 12) {
|
|
87
|
-
hour = isPm ? 12 : 0;
|
|
88
|
-
} else if (isPm) {
|
|
89
|
-
hour += 12;
|
|
90
|
-
}
|
|
78
|
+
if (filterType === "time") {
|
|
79
|
+
const date = parseTimeToDate(trimmed);
|
|
80
|
+
if (date) {
|
|
81
|
+
return date;
|
|
91
82
|
}
|
|
92
|
-
return new Date(1970, 0, 1, hour, minute, second);
|
|
93
83
|
}
|
|
94
84
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
Number.parseInt(m, 10) - 1,
|
|
101
|
-
Number.parseInt(d, 10),
|
|
102
|
-
);
|
|
85
|
+
if (filterType === "date") {
|
|
86
|
+
const date = parseLocalISODate(trimmed);
|
|
87
|
+
if (date) {
|
|
88
|
+
return date;
|
|
89
|
+
}
|
|
103
90
|
}
|
|
104
91
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
// viewer's timezone.
|
|
109
|
-
const isoMatch = trimmed.match(
|
|
110
|
-
/^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?(?:Z|[+-]\d{2}:?\d{2})?$/,
|
|
111
|
-
);
|
|
112
|
-
if (isoMatch) {
|
|
113
|
-
const [, y, mo, d, h, mi, s] = isoMatch;
|
|
114
|
-
return new Date(
|
|
115
|
-
Number.parseInt(y, 10),
|
|
116
|
-
Number.parseInt(mo, 10) - 1,
|
|
117
|
-
Number.parseInt(d, 10),
|
|
118
|
-
Number.parseInt(h, 10),
|
|
119
|
-
Number.parseInt(mi, 10),
|
|
120
|
-
s ? Number.parseInt(s, 10) : 0,
|
|
121
|
-
);
|
|
92
|
+
const isoDateTime = parseLocalISODateTime(trimmed);
|
|
93
|
+
if (isoDateTime) {
|
|
94
|
+
return isoDateTime;
|
|
122
95
|
}
|
|
123
96
|
|
|
124
97
|
const parsed = new Date(trimmed);
|