From 9286b70bd41c7884b628bd68672f6f4b781f9a68 Mon Sep 17 00:00:00 2001 From: nichenqin Date: Thu, 21 Nov 2024 15:02:10 +0800 Subject: [PATCH] fix: fix calendar view share data --- .../calendar-view-month-records.svelte | 21 ++++++++++++++++--- .../calendar-view-toolbar.svelte | 5 ++++- .../blocks/calendar-view/calendar-view.svelte | 2 +- .../filters-editor/filters-editor.svelte | 2 +- .../grid-view/editable-cell/date-cell.svelte | 4 +++- 5 files changed, 27 insertions(+), 7 deletions(-) diff --git a/apps/frontend/src/lib/components/blocks/calendar-view/calendar-view-month-records.svelte b/apps/frontend/src/lib/components/blocks/calendar-view/calendar-view-month-records.svelte index b53cdb26d..f48372419 100644 --- a/apps/frontend/src/lib/components/blocks/calendar-view/calendar-view-month-records.svelte +++ b/apps/frontend/src/lib/components/blocks/calendar-view/calendar-view-month-records.svelte @@ -108,8 +108,22 @@ .otherwise(() => undefined) return { queryKey: ["records", $table?.id.value, $viewId, scope, dateString, $search], - queryFn: ({ pageParam = 1 }) => - trpc.record.list.query({ + queryFn: ({ pageParam = 1 }) => { + if (shareId) { + return trpc.shareData.records.query({ + shareId, + tableId: $table?.id.value, + viewId: $viewId, + filters: merged, + ignoreView: true, + q: $search, + pagination: { + page: pageParam, + limit: 20, + }, + }) + } + return trpc.record.list.query({ tableId: $table?.id.value, viewId: $viewId, filters: merged, @@ -119,7 +133,8 @@ page: pageParam, limit: 20, }, - }), + }) + }, initialPageParam: 1, getNextPageParam: (lastPage, pages) => { const current = pages.reduce((acc, cur) => acc + cur.records.length, 0) diff --git a/apps/frontend/src/lib/components/blocks/calendar-view/calendar-view-toolbar.svelte b/apps/frontend/src/lib/components/blocks/calendar-view/calendar-view-toolbar.svelte index 6deef4622..168601228 100644 --- a/apps/frontend/src/lib/components/blocks/calendar-view/calendar-view-toolbar.svelte +++ b/apps/frontend/src/lib/components/blocks/calendar-view/calendar-view-toolbar.svelte @@ -17,6 +17,7 @@ export let viewId: Readable export let view: CalendarView export let readonly = false + export let shareId: string | undefined
@@ -24,7 +25,9 @@ - + {#if !shareId} + + {/if}
diff --git a/apps/frontend/src/lib/components/blocks/calendar-view/calendar-view.svelte b/apps/frontend/src/lib/components/blocks/calendar-view/calendar-view.svelte index 50aa178cf..e6e9c6880 100644 --- a/apps/frontend/src/lib/components/blocks/calendar-view/calendar-view.svelte +++ b/apps/frontend/src/lib/components/blocks/calendar-view/calendar-view.svelte @@ -33,7 +33,7 @@ {#key $table.id.value} - + {#if view.type === "calendar"} {#if field} {#if timeScale === "month"} diff --git a/apps/frontend/src/lib/components/blocks/filters-editor/filters-editor.svelte b/apps/frontend/src/lib/components/blocks/filters-editor/filters-editor.svelte index 60c605147..40a696f84 100644 --- a/apps/frontend/src/lib/components/blocks/filters-editor/filters-editor.svelte +++ b/apps/frontend/src/lib/components/blocks/filters-editor/filters-editor.svelte @@ -139,7 +139,7 @@ /> Today + {includeTime ? "Now" : "Today"} + {#if !field.required}