From 2d543d93c8446a84db9230a4f7b5c4880f368ebe Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Fri, 12 May 2023 08:58:14 +0100 Subject: [PATCH] Pass tableType --- .../src/components/backend/DataTable/DataTable.svelte | 9 +++++---- .../backend/DataTable/buttons/ImportButton.svelte | 5 +++-- .../DataTable/buttons/grid/GridImportButton.svelte | 3 ++- .../frontend-core/src/components/grid/layout/Grid.svelte | 8 +++++--- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/packages/builder/src/components/backend/DataTable/DataTable.svelte b/packages/builder/src/components/backend/DataTable/DataTable.svelte index 2c8f8fd6da0..83e115ebf25 100644 --- a/packages/builder/src/components/backend/DataTable/DataTable.svelte +++ b/packages/builder/src/components/backend/DataTable/DataTable.svelte @@ -23,15 +23,16 @@ status: { name: "Status", disabled: true }, } - $: table = $tables.selected - $: isUsersTable = table?._id === TableNames.USERS - $: isInternal = table?.type !== "external" + $: id = $tables.selected?._id + $: isUsersTable = id === TableNames.USERS + $: isInternal = $tables.selected?.type !== "external"
- + diff --git a/packages/builder/src/components/backend/DataTable/buttons/grid/GridImportButton.svelte b/packages/builder/src/components/backend/DataTable/buttons/grid/GridImportButton.svelte index 5aa530b0284..5b89d92438b 100644 --- a/packages/builder/src/components/backend/DataTable/buttons/grid/GridImportButton.svelte +++ b/packages/builder/src/components/backend/DataTable/buttons/grid/GridImportButton.svelte @@ -4,11 +4,12 @@ export let disabled = false - const { rows, tableId } = getContext("grid") + const { rows, tableId, tableType } = getContext("grid") diff --git a/packages/frontend-core/src/components/grid/layout/Grid.svelte b/packages/frontend-core/src/components/grid/layout/Grid.svelte index 541493c81a3..cb02263be32 100644 --- a/packages/frontend-core/src/components/grid/layout/Grid.svelte +++ b/packages/frontend-core/src/components/grid/layout/Grid.svelte @@ -32,7 +32,8 @@ } from "../lib/constants" export let API = null - export let table = null + export let tableId = null + export let tableType = null export let schemaOverrides = null export let allowAddRows = true export let allowAddColumns = true @@ -45,7 +46,7 @@ const rand = Math.random() // State stores - const tableIdStore = writable(table?._id) + const tableIdStore = writable(tableId) const schemaOverridesStore = writable(schemaOverrides) const config = writable({ allowAddRows, @@ -62,6 +63,7 @@ rand, config, tableId: tableIdStore, + tableType, schemaOverrides: schemaOverridesStore, } context = { ...context, ...createEventManagers() } @@ -79,7 +81,7 @@ } = context // Keep stores up to date - $: tableIdStore.set(table?._id) + $: tableIdStore.set(tableId) $: schemaOverridesStore.set(schemaOverrides) $: config.set({ allowAddRows,