@gradio/dataframe 0.23.0 → 0.23.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @gradio/dataframe
2
2
 
3
+ ## 0.23.1
4
+
5
+ ### Dependency updates
6
+
7
+ - @gradio/atoms@0.23.1
8
+ - @gradio/statustracker@0.14.0
9
+ - @gradio/client@2.2.0
10
+ - @gradio/markdown-code@0.7.0
11
+ - @gradio/checkbox@0.6.7
12
+
3
13
  ## 0.23.0
4
14
 
5
15
  ### Features
package/Dataframe.test.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { test, describe, afterEach, expect } from "vitest";
2
- import { cleanup, render, fireEvent } from "@self/tootils/render";
2
+ import { cleanup, render, fireEvent, waitFor } from "@self/tootils/render";
3
3
  import { tick } from "svelte";
4
4
 
5
5
  import Dataframe from "./Index.svelte";
@@ -284,6 +284,85 @@ describe("Cell selection", () => {
284
284
  expect(get_cell(container, 1, 0)!.className).toContain("cell-selected");
285
285
  expect(get_cell(container, 1, 1)!.className).toContain("cell-selected");
286
286
  });
287
+
288
+ // Regression: pressing Ctrl between mousedown and mouseup must not call
289
+ // handle_cell_click a second time via the click event. If it did, the
290
+ // Ctrl+click path would toggle the already-selected cell back off,
291
+ // producing conflicting state updates that froze the interface.
292
+ test("pressing Ctrl between mousedown and mouseup keeps cell selected", async () => {
293
+ const { container } = await render(Dataframe, default_props);
294
+ await wait();
295
+
296
+ const cell = get_cell(container, 0, 0)!;
297
+
298
+ // mousedown (no ctrl) selects the cell
299
+ await fireEvent.mouseDown(cell);
300
+ await wait();
301
+ expect(cell.className).toContain("cell-selected");
302
+
303
+ // The browser fires a click event when the user releases the mouse button.
304
+ // If the user pressed Ctrl before releasing, that click carries ctrlKey:true.
305
+ // A second call to handle_cell_click with ctrlKey would toggle the cell
306
+ // back off (deselect it). Verify that the click event has no effect.
307
+ await fireEvent.click(cell, { ctrlKey: true });
308
+ await wait();
309
+
310
+ expect(cell.className).toContain("cell-selected");
311
+ });
312
+ });
313
+
314
+ describe("Header overflow", () => {
315
+ let wrapper: HTMLDivElement;
316
+
317
+ afterEach(async () => {
318
+ cleanup();
319
+ wrapper?.remove();
320
+ });
321
+
322
+ // Headers must expand to fit their text (no ellipsis truncation).
323
+ // When headers are wider than the scroll container, later columns are
324
+ // hidden by the container's overflow — not by cutting off the text.
325
+ test("long headers are not truncated in the DOM and the 3rd header is hidden by scroll overflow", async () => {
326
+ // Narrow container makes overflow predictable regardless of viewport size.
327
+ wrapper = document.createElement("div");
328
+ wrapper.style.width = "300px";
329
+ document.body.appendChild(wrapper);
330
+
331
+ // Capital W is one of the widest glyphs — 60 of them easily exceeds 300 px.
332
+ const long_header = "W".repeat(60);
333
+
334
+ const { getAllByRole } = await render(
335
+ Dataframe,
336
+ {
337
+ ...default_props,
338
+ value: {
339
+ data: [["a", "b", "c"]],
340
+ headers: [long_header + " A", long_header + " B", long_header + " C"],
341
+ metadata: null
342
+ },
343
+ col_count: [3, "fixed"] as [number, "fixed" | "dynamic"],
344
+ row_count: [1, "fixed"] as [number, "fixed" | "dynamic"]
345
+ },
346
+ { container: wrapper }
347
+ );
348
+
349
+ await wait();
350
+
351
+ const headers = getAllByRole("columnheader");
352
+ expect(headers).toHaveLength(3);
353
+
354
+ // Full text must be present in the DOM — no in-cell truncation.
355
+ expect(headers[2].textContent?.trim()).toContain(long_header + " C");
356
+
357
+ // The 3rd header's left edge must be beyond the scroll container's right
358
+ // edge, meaning it is completely outside the visible area.
359
+ const viewport = wrapper.querySelector(
360
+ ".virtual-table-viewport"
361
+ ) as HTMLElement;
362
+ const viewport_rect = viewport.getBoundingClientRect();
363
+ const third_rect = headers[2].getBoundingClientRect();
364
+ expect(third_rect.left).toBeGreaterThanOrEqual(viewport_rect.right);
365
+ });
287
366
  });
288
367
 
289
368
  describe("Sorting", () => {
@@ -701,9 +780,11 @@ describe("Copy", () => {
701
780
 
702
781
  const table_wrap = get_table_wrap(container)!;
703
782
  await fireEvent.keyDown(table_wrap, { key: "c", metaKey: true });
704
- await wait(100);
705
783
 
706
- const clipboard = await navigator.clipboard.readText();
707
- expect(clipboard).toBe("Alice");
784
+ // handle_copy() is async but called without await in the keydown handler,
785
+ // so the clipboard write may not be complete immediately. Poll until it settles.
786
+ await waitFor(async () => {
787
+ expect(await navigator.clipboard.readText()).toBe("Alice");
788
+ });
708
789
  });
709
790
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradio/dataframe",
3
- "version": "0.23.0",
3
+ "version": "0.23.1",
4
4
  "description": "Gradio UI packages",
5
5
  "type": "module",
6
6
  "author": "",
@@ -15,15 +15,15 @@
15
15
  "dequal": "^2.0.3",
16
16
  "@tanstack/table-core": "^8.21.3",
17
17
  "@tanstack/virtual-core": "^3.13.6",
18
- "@gradio/atoms": "^0.23.0",
19
- "@gradio/button": "^0.6.6",
20
- "@gradio/checkbox": "^0.6.6",
21
- "@gradio/client": "^2.1.0",
18
+ "@gradio/atoms": "^0.23.1",
19
+ "@gradio/checkbox": "^0.6.7",
20
+ "@gradio/client": "^2.2.0",
22
21
  "@gradio/icons": "^0.15.1",
23
- "@gradio/statustracker": "^0.13.1",
22
+ "@gradio/button": "^0.6.6",
23
+ "@gradio/markdown-code": "^0.7.0",
24
+ "@gradio/statustracker": "^0.14.0",
24
25
  "@gradio/upload": "^0.17.8",
25
- "@gradio/utils": "^0.12.2",
26
- "@gradio/markdown-code": "^0.6.1"
26
+ "@gradio/utils": "^0.12.2"
27
27
  },
28
28
  "exports": {
29
29
  ".": {