From b1b81c9e1c10c2c14a5cb0661d2503259ece1a1b Mon Sep 17 00:00:00 2001 From: Hannah Date: Thu, 24 Oct 2024 15:03:10 +0100 Subject: [PATCH] Hide option to add row/col when count is fixed in dataframe (#9649) * * hide add row or col if count is fixed * restore selected cell outline * add changeset * * fix selected cell border * close cell menu on window resize * tweak * fix test * add changeset --------- Co-authored-by: gradio-pr-bot Co-authored-by: Abubakar Abid --- .changeset/small-suns-accept.md | 6 ++++ js/dataframe/shared/CellMenu.svelte | 24 ++++++++------ js/dataframe/shared/Table.svelte | 45 ++++++++++++++------------- js/spa/test/blocks_flashcards.spec.ts | 2 +- 4 files changed, 45 insertions(+), 32 deletions(-) create mode 100644 .changeset/small-suns-accept.md diff --git a/.changeset/small-suns-accept.md b/.changeset/small-suns-accept.md new file mode 100644 index 0000000000000..e1735ef6aa325 --- /dev/null +++ b/.changeset/small-suns-accept.md @@ -0,0 +1,6 @@ +--- +"@gradio/dataframe": patch +"gradio": patch +--- + +feat:Hide option to add row/col when count is fixed in dataframe diff --git a/js/dataframe/shared/CellMenu.svelte b/js/dataframe/shared/CellMenu.svelte index 9ba1aaa3093fb..53f9fdea9fa0e 100644 --- a/js/dataframe/shared/CellMenu.svelte +++ b/js/dataframe/shared/CellMenu.svelte @@ -10,11 +10,15 @@ export let on_add_column_left: () => void; export let on_add_column_right: () => void; export let row: number; + export let col_count: [number, "fixed" | "dynamic"]; + export let row_count: [number, "fixed" | "dynamic"]; export let i18n: I18nFormatter; let menu_element: HTMLDivElement; $: is_header = row === -1; + $: can_add_rows = row_count[1] === "dynamic"; + $: can_add_columns = col_count[1] === "dynamic"; onMount(() => { position_menu(); @@ -44,7 +48,7 @@
- {#if !is_header} + {#if !is_header && can_add_rows} {/if} - - + {#if can_add_columns} + + + {/if}