@gradio/dataframe 0.18.8 → 0.19.0

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.
Files changed (74) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/Example.svelte +8 -8
  3. package/Index.svelte +1 -1
  4. package/README.md +232 -37
  5. package/dist/Example.svelte +8 -8
  6. package/dist/Example.svelte.d.ts +3 -1
  7. package/dist/Index.svelte.d.ts +20 -18
  8. package/dist/shared/BooleanCell.svelte +1 -2
  9. package/dist/shared/BooleanCell.svelte.d.ts +4 -2
  10. package/dist/shared/CellMenu.svelte +4 -8
  11. package/dist/shared/CellMenu.svelte.d.ts +11 -9
  12. package/dist/shared/CellMenuButton.svelte.d.ts +2 -0
  13. package/dist/shared/CellMenuIcons.svelte.d.ts +2 -0
  14. package/dist/shared/EditableCell.svelte +6 -12
  15. package/dist/shared/EditableCell.svelte.d.ts +17 -15
  16. package/dist/shared/EmptyRowButton.svelte.d.ts +2 -0
  17. package/dist/shared/Example.svelte.d.ts +2 -0
  18. package/dist/shared/FilterMenu.svelte +2 -4
  19. package/dist/shared/FilterMenu.svelte.d.ts +3 -1
  20. package/dist/shared/RowNumber.svelte.d.ts +4 -2
  21. package/dist/shared/Table.svelte +127 -157
  22. package/dist/shared/Table.svelte.d.ts +24 -22
  23. package/dist/shared/TableCell.svelte +7 -13
  24. package/dist/shared/TableCell.svelte.d.ts +6 -4
  25. package/dist/shared/TableHeader.svelte +5 -10
  26. package/dist/shared/TableHeader.svelte.d.ts +4 -2
  27. package/dist/shared/Toolbar.svelte +3 -4
  28. package/dist/shared/Toolbar.svelte.d.ts +7 -5
  29. package/dist/shared/VirtualTable.svelte +19 -16
  30. package/dist/shared/VirtualTable.svelte.d.ts +9 -6
  31. package/dist/shared/context/dataframe_context.d.ts +1 -1
  32. package/dist/shared/context/dataframe_context.js +1 -1
  33. package/dist/shared/icons/FilterIcon.svelte.d.ts +3 -3
  34. package/dist/shared/icons/Padlock.svelte.d.ts +2 -0
  35. package/dist/shared/icons/SelectionButtons.svelte +2 -4
  36. package/dist/shared/icons/SelectionButtons.svelte.d.ts +3 -1
  37. package/dist/shared/icons/SortArrowDown.svelte.d.ts +3 -1
  38. package/dist/shared/icons/SortArrowUp.svelte.d.ts +3 -1
  39. package/dist/shared/icons/SortButtonDown.svelte.d.ts +2 -0
  40. package/dist/shared/icons/SortButtonUp.svelte.d.ts +2 -0
  41. package/dist/shared/icons/SortIcon.svelte.d.ts +4 -2
  42. package/dist/shared/utils/data_processing.d.ts +1 -1
  43. package/dist/shared/utils/drag_utils.js +1 -1
  44. package/dist/shared/utils/keyboard_utils.js +5 -3
  45. package/dist/shared/{selection_utils.d.ts → utils/selection_utils.d.ts} +1 -1
  46. package/dist/shared/{utils.d.ts → utils/utils.d.ts} +2 -2
  47. package/dist/standalone/Index.svelte +660 -0
  48. package/dist/standalone/Index.svelte.d.ts +45 -0
  49. package/dist/standalone/default_i18n.d.ts +1 -0
  50. package/dist/standalone/default_i18n.js +32 -0
  51. package/dist/standalone/stubs/Upload.svelte +18 -0
  52. package/dist/standalone/stubs/Upload.svelte.d.ts +27 -0
  53. package/dist/standalone/stubs/upload.d.ts +1 -0
  54. package/dist/standalone/stubs/upload.js +1 -0
  55. package/package.json +8 -11
  56. package/shared/CellMenu.svelte +1 -1
  57. package/shared/FilterMenu.svelte +1 -2
  58. package/shared/Table.svelte +9 -7
  59. package/shared/TableCell.svelte +2 -2
  60. package/shared/Toolbar.svelte +1 -0
  61. package/shared/VirtualTable.svelte +11 -2
  62. package/shared/context/dataframe_context.ts +1 -1
  63. package/shared/utils/data_processing.ts +1 -1
  64. package/shared/utils/drag_utils.ts +1 -1
  65. package/shared/utils/keyboard_utils.ts +5 -5
  66. package/shared/{selection_utils.ts → utils/selection_utils.ts} +1 -1
  67. package/shared/{utils.ts → utils/utils.ts} +11 -2
  68. package/standalone/Index.svelte +688 -0
  69. package/standalone/default_i18n.ts +32 -0
  70. package/standalone/stubs/Upload.svelte +19 -0
  71. package/standalone/stubs/upload.ts +1 -0
  72. package/test/table_utils.test.ts +1 -1
  73. /package/dist/shared/{selection_utils.js → utils/selection_utils.js} +0 -0
  74. /package/dist/shared/{utils.js → utils/utils.js} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @gradio/dataframe
2
2
 
3
+ ## 0.19.0
4
+
5
+ ### Features
6
+
7
+ - [#11766](https://github.com/gradio-app/gradio/pull/11766) [`dfc0e03`](https://github.com/gradio-app/gradio/commit/dfc0e0305068dbd16ce905afc73d139e1e51eb46) - Add JS Dataframe documentation to docs. Thanks @pngwn!
8
+ - [#11712](https://github.com/gradio-app/gradio/pull/11712) [`0025e1a`](https://github.com/gradio-app/gradio/commit/0025e1a157edef57def99e4bf24a3686ff38eaca) - Publish gr.Dataframe as standalone library. Thanks @hannahblair!
9
+
10
+ ### Dependency updates
11
+
12
+ - @gradio/icons@0.13.1
13
+ - @gradio/upload@0.16.16
14
+
3
15
  ## 0.18.8
4
16
 
5
17
  ### Dependency updates
package/Example.svelte CHANGED
@@ -39,15 +39,15 @@
39
39
  {/if}
40
40
  </tr>
41
41
  {/each}
42
- {#if value.length > 3}
43
- <div
44
- class="overlay"
45
- class:odd={index % 2 != 0}
46
- class:even={index % 2 == 0}
47
- class:button={type === "gallery"}
48
- />
49
- {/if}
50
42
  </table>
43
+ {#if value.length > 3}
44
+ <div
45
+ class="overlay"
46
+ class:odd={index % 2 != 0}
47
+ class:even={index % 2 == 0}
48
+ class:button={type === "gallery"}
49
+ ></div>
50
+ {/if}
51
51
  {/if}
52
52
  </div>
53
53
  {/if}
package/Index.svelte CHANGED
@@ -11,7 +11,7 @@
11
11
  import Table from "./shared/Table.svelte";
12
12
  import { StatusTracker } from "@gradio/statustracker";
13
13
  import type { LoadingStatus } from "@gradio/statustracker";
14
- import type { Headers, Datatype, DataframeValue } from "./shared/utils";
14
+ import type { Datatype, DataframeValue } from "./shared/utils/utils";
15
15
  import Image from "@gradio/image";
16
16
 
17
17
  export let elem_id = "";
package/README.md CHANGED
@@ -1,41 +1,236 @@
1
- # `@gradio/dataframe`
1
+ # @gradio/dataframe
2
2
 
3
- ```html
4
- <script>
5
- import { BaseDataFrame, BaseExample } from "@gradio/dataframe";
3
+ Standalone Svelte component that brings Gradio's Dataframe UI to any Svelte/SvelteKit project.
4
+
5
+ This component is lightweight, virtualized for efficient rendering of large datasets, and offers features like column freezing, and customizable styling via CSS variables. Use this component when you need a highly interactive, accessible, and easily themeable table for user-facing applications, especially where seamless Svelte/SvelteKit integration is important.
6
+
7
+ ## Install
8
+
9
+ With `npm`:
10
+
11
+ ```shell
12
+ npm i @gradio/dataframe
13
+ ```
14
+
15
+ With `pnpm`:
16
+
17
+ ```shell
18
+ pnpm add @gradio/dataframe
19
+ ```
20
+
21
+ **[View on npm](https://www.npmjs.com/package/@gradio/dataframe)**
22
+
23
+ ## Usage (Svelte/SvelteKit)
24
+
25
+ ```svelte
26
+ <script lang="ts">
27
+ import Dataframe from "@gradio/dataframe";
28
+
29
+ let value = {
30
+ data: [
31
+ ["Alice", 25, true],
32
+ ["Bob", 30, false]
33
+ ],
34
+ headers: ["Name", "Age", "Active"],
35
+ };
36
+
37
+ function handle_change(e: any) {
38
+ console.log("changed", e.detail);
39
+ }
40
+
41
+ function handle_select(e: any) {
42
+ console.log("selected", e.detail);
43
+ }
44
+
45
+ function handle_input(e: any) {
46
+ console.log("input", e.detail);
47
+ }
6
48
  </script>
49
+
50
+ <Dataframe
51
+ bind:value
52
+ {datatype}
53
+ show_search="search"
54
+ show_row_numbers={true}
55
+ show_copy_button={true}
56
+ show_fullscreen_button={true}
57
+ editable={true}
58
+ on:change={handle_change}
59
+ on:select={handle_select}
60
+ on:input={handle_input}
61
+ />
62
+ ```
63
+
64
+ ## Props
65
+
66
+ ```typescript
67
+ interface DataframeProps {
68
+
69
+ /**
70
+ * The value object containing the table data, headers, and optional metadata.
71
+ * Example: { data: [...], headers: [...], metadata?: any }
72
+ * Default: { data: [[]], headers: [] }
73
+ */
74
+ value: {
75
+ data: (string | number | boolean)[][];
76
+ headers: string[];
77
+ metadata?: any;
78
+ };
79
+
80
+ /**
81
+ * Array of data types per column. Supported: "str", "number", "bool", "date", "markdown", "html".
82
+ * Default: []
83
+ */
84
+ datatype?: string[];
85
+
86
+ /**
87
+ * Enable or disable cell editing.
88
+ * Default: true
89
+ */
90
+ editable?: boolean;
91
+
92
+ /**
93
+ * Show or hide the row number column.
94
+ * Default: true
95
+ */
96
+ show_row_numbers?: boolean;
97
+
98
+ /**
99
+ * Show search input. Can be "search", "filter", or "none.
100
+ * Default: "none"
101
+ */
102
+ show_search?: "none" | "search" | "filter" | boolean;
103
+
104
+ /**
105
+ * Show or hide the copy to clipboard button.
106
+ * Default: true
107
+ */
108
+ show_copy_button?: boolean;
109
+
110
+ /**
111
+ * Show or hide the fullscreen toggle button.
112
+ * Default: true
113
+ */
114
+ show_fullscreen_button?: boolean;
115
+
116
+ /**
117
+ * Accessible caption for the table.
118
+ * Default: null
119
+ */
120
+ label?: string | null;
121
+
122
+ /**
123
+ * Show or hide the dataframe label.
124
+ * Default: true
125
+ */
126
+ show_label?: boolean;
127
+
128
+ /**
129
+ * (Optional) Set column widths in CSS units (e.g. ["100px", "20%", ...]).
130
+ */
131
+ column_widths?: string[];
132
+
133
+ /**
134
+ * (Optional) Set the maximum height of the table in pixels.
135
+ * Default: 500
136
+ */
137
+ max_height?: number;
138
+
139
+ /**
140
+ * (Optional) Set the maximum number of characters per cell.
141
+ */
142
+ max_chars?: number;
143
+
144
+ /**
145
+ * (Optional) Enable or disable line breaks in cells.
146
+ * Default: true
147
+ */
148
+ line_breaks?: boolean;
149
+
150
+ /**
151
+ * (Optional) Enable or disable text wrapping in cells.
152
+ * Default: false
153
+ */
154
+ wrap?: boolean;
155
+ }
156
+ ```
157
+
158
+ ## Events
159
+
160
+ The component emits the following events:
161
+
162
+ ```ts
163
+ // Fired when table data changes
164
+ on:change={(e: CustomEvent<{ data: (string | number | boolean)[][]; headers: string[]; metadata: any }>) => void}
165
+
166
+ // Fired when a cell is selected
167
+ on:select={(e: CustomEvent<{ index: number[]; value: any; selected: boolean }>) => void}
168
+
169
+ // Fired on user input (search/filter)
170
+ on:input={(e: CustomEvent<string | null>) => void}
171
+ ```
172
+
173
+ Example:
174
+
175
+ ```svelte
176
+ <Dataframe
177
+ on:change={(e) => console.log('data', e.detail)}
178
+ on:input={(e) => console.log('input', e.detail)}
179
+ on:select={(e) => console.log('select', e.detail)}
180
+ />
181
+ ```
182
+
183
+ ## TypeScript
184
+
185
+ The package publishes `types.d.ts` with `DataframeProps` module declarations.
186
+
187
+ ## Custom Styling
188
+
189
+ The standalone package exposes a small set of public CSS variables you can use to theme the Dataframe. These variables are namespaced with `--gr-df-*` and are the recommended way to override the default styling.
190
+
191
+ **Color Variables**
192
+ - `--gr-df-table-bg-even` — background for even rows
193
+ - `--gr-df-table-bg-odd` — background for odd rows
194
+ - `--gr-df-copied-cell-color` - background for copied cells
195
+ - `--gr-df-table-border` — table border color
196
+ - `--gr-df-table-text` — table text color
197
+ - `--gr-df-accent` — primary accent color
198
+ - `--gr-df-accent-soft` — soft/pale accent color
199
+
200
+ **Font Variables**
201
+ - `--gr-df-font-size` — table body font-size
202
+ - `--gr-df-font-mono` — monospace font family
203
+ - `--gr-df-font-sans` — sans serif font family
204
+
205
+ **Border/Radius Variables**
206
+ - `--gr-df-table-radius` — table corner radius
207
+
208
+ Example:
209
+
210
+ ```svelte
211
+ <div class="df-theme">
212
+ <Dataframe ... />
213
+ </div>
214
+
215
+ <style>
216
+ .df-theme {
217
+ --gr-df-accent: #7c3aed;
218
+ }
219
+ </style>
7
220
  ```
8
221
 
9
- BaseDataFrame
10
- ```javascript
11
- export let datatype: Datatype | Datatype[];
12
- export let label: string | null = null;
13
- export let headers: Headers = [];
14
- let values: (string | number)[][];
15
- export let value: { data: Data; headers: Headers; metadata: Metadata } | null;
16
- export let col_count: [number, "fixed" | "dynamic"];
17
- export let row_count: [number, "fixed" | "dynamic"];
18
- export let latex_delimiters: {
19
- left: string;
20
- right: string;
21
- display: boolean;
22
- }[];
23
-
24
- export let editable = true;
25
- export let wrap = false;
26
- export let root: string;
27
- export let i18n: I18nFormatter;
28
-
29
- export let height = 500;
30
- export let line_breaks = true;
31
- export let column_widths: string[] = [];
32
- ```
33
-
34
- BaseExample
35
- ```javascript
36
- export let gradio: Gradio;
37
- export let value: (string | number)[][] | string;
38
- export let type: "gallery" | "table";
39
- export let selected = false;
40
- export let index: number;
41
- ```
222
+ Alternatively, you can target internal classes within the Dataframe using a global override.
223
+
224
+ ```css
225
+ .df-theme :global(.cell-wrap) {
226
+ background-color: #7c3aed ;
227
+ }
228
+ ```
229
+
230
+ **Note:** This standalone component does **not** currently support the file upload functionality (e.g. drag-and-dropping to populate the dataframe) that is available in the Gradio Dataframe component.
231
+
232
+
233
+ ## License
234
+
235
+ MIT
236
+
@@ -37,15 +37,15 @@ let is_empty = loaded && (value.length === 0 || value[0].length === 0);
37
37
  {/if}
38
38
  </tr>
39
39
  {/each}
40
- {#if value.length > 3}
41
- <div
42
- class="overlay"
43
- class:odd={index % 2 != 0}
44
- class:even={index % 2 == 0}
45
- class:button={type === "gallery"}
46
- />
47
- {/if}
48
40
  </table>
41
+ {#if value.length > 3}
42
+ <div
43
+ class="overlay"
44
+ class:odd={index % 2 != 0}
45
+ class:even={index % 2 == 0}
46
+ class:button={type === "gallery"}
47
+ ></div>
48
+ {/if}
49
49
  {/if}
50
50
  </div>
51
51
  {/if}
@@ -3,13 +3,15 @@ declare const __propDef: {
3
3
  props: {
4
4
  value: (string | number)[][] | string;
5
5
  type: "gallery" | "table";
6
- selected?: boolean | undefined;
6
+ selected?: boolean;
7
7
  index: number;
8
8
  };
9
9
  events: {
10
10
  [evt: string]: CustomEvent<any>;
11
11
  };
12
12
  slots: {};
13
+ exports?: {} | undefined;
14
+ bindings?: string | undefined;
13
15
  };
14
16
  export type ExampleProps = typeof __propDef.props;
15
17
  export type ExampleEvents = typeof __propDef.events;
@@ -3,25 +3,25 @@ export { default as BaseDataFrame } from "./shared/Table.svelte";
3
3
  export { default as BaseExample } from "./Example.svelte";
4
4
  import type { Gradio, SelectData } from "@gradio/utils";
5
5
  import type { LoadingStatus } from "@gradio/statustracker";
6
- import type { Datatype, DataframeValue } from "./shared/utils";
6
+ import type { Datatype, DataframeValue } from "./shared/utils/utils";
7
7
  declare const __propDef: {
8
8
  props: {
9
- elem_id?: string | undefined;
10
- elem_classes?: string[] | undefined;
11
- visible?: boolean | undefined;
12
- value?: DataframeValue | undefined;
13
- value_is_output?: boolean | undefined;
9
+ elem_id?: string;
10
+ elem_classes?: string[];
11
+ visible?: boolean;
12
+ value?: DataframeValue;
13
+ value_is_output?: boolean;
14
14
  col_count: [number, "fixed" | "dynamic"];
15
15
  row_count: [number, "fixed" | "dynamic"];
16
- label?: (string | null) | undefined;
17
- show_label?: boolean | undefined;
16
+ label?: string | null;
17
+ show_label?: boolean;
18
18
  wrap: boolean;
19
19
  datatype: Datatype | Datatype[];
20
- scale?: (number | null) | undefined;
20
+ scale?: number | null;
21
21
  min_width?: number | undefined;
22
22
  root: string;
23
- line_breaks?: boolean | undefined;
24
- column_widths?: string[] | undefined;
23
+ line_breaks?: boolean;
24
+ column_widths?: string[];
25
25
  gradio: Gradio<{
26
26
  change: never;
27
27
  select: SelectData;
@@ -37,19 +37,21 @@ declare const __propDef: {
37
37
  max_height?: number | undefined;
38
38
  loading_status: LoadingStatus;
39
39
  interactive: boolean;
40
- show_fullscreen_button?: boolean | undefined;
40
+ show_fullscreen_button?: boolean;
41
41
  max_chars?: number | undefined;
42
- show_copy_button?: boolean | undefined;
43
- show_row_numbers?: boolean | undefined;
44
- show_search?: ("none" | "search" | "filter") | undefined;
45
- pinned_columns?: number | undefined;
46
- static_columns?: (string | number)[] | undefined;
47
- fullscreen?: boolean | undefined;
42
+ show_copy_button?: boolean;
43
+ show_row_numbers?: boolean;
44
+ show_search?: "none" | "search" | "filter";
45
+ pinned_columns?: number;
46
+ static_columns?: (string | number)[];
47
+ fullscreen?: boolean;
48
48
  };
49
49
  events: {
50
50
  [evt: string]: CustomEvent<any>;
51
51
  };
52
52
  slots: {};
53
+ exports?: {} | undefined;
54
+ bindings?: string | undefined;
53
55
  };
54
56
  export type IndexProps = typeof __propDef.props;
55
57
  export type IndexEvents = typeof __propDef.events;
@@ -2,8 +2,7 @@
2
2
  export let value = false;
3
3
  export let editable = true;
4
4
  export let on_change;
5
- $:
6
- bool_value = typeof value === "string" ? value.toLowerCase() === "true" : !!value;
5
+ $: bool_value = typeof value === "string" ? value.toLowerCase() === "true" : !!value;
7
6
  function handle_change(event) {
8
7
  if (editable) {
9
8
  on_change(event.detail);
@@ -1,14 +1,16 @@
1
1
  import { SvelteComponent } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
- value?: (boolean | string) | undefined;
5
- editable?: boolean | undefined;
4
+ value?: boolean | string;
5
+ editable?: boolean;
6
6
  on_change: (value: boolean) => void;
7
7
  };
8
8
  events: {
9
9
  [evt: string]: CustomEvent<any>;
10
10
  };
11
11
  slots: {};
12
+ exports?: {} | undefined;
13
+ bindings?: string | undefined;
12
14
  };
13
15
  export type BooleanCellProps = typeof __propDef.props;
14
16
  export type BooleanCellEvents = typeof __propDef.events;
@@ -29,18 +29,14 @@ export let editable = true;
29
29
  export let i18n;
30
30
  let menu_element;
31
31
  let active_filter_menu = null;
32
- $:
33
- is_header = row === -1;
34
- $:
35
- can_add_rows = editable && row_count[1] === "dynamic";
36
- $:
37
- can_add_columns = editable && col_count[1] === "dynamic";
32
+ $: is_header = row === -1;
33
+ $: can_add_rows = editable && row_count[1] === "dynamic";
34
+ $: can_add_columns = editable && col_count[1] === "dynamic";
38
35
  onMount(() => {
39
36
  position_menu();
40
37
  });
41
38
  function position_menu() {
42
- if (!menu_element)
43
- return;
39
+ if (!menu_element) return;
44
40
  const viewport_width = window.innerWidth;
45
41
  const viewport_height = window.innerHeight;
46
42
  const menu_rect = menu_element.getBoundingClientRect();
@@ -1,5 +1,5 @@
1
1
  import { SvelteComponent } from "svelte";
2
- import type { I18nFormatter } from "js/utils/src";
2
+ import type { I18nFormatter } from "@gradio/utils";
3
3
  import type { SortDirection, FilterDatatype } from "./context/dataframe_context";
4
4
  declare const __propDef: {
5
5
  props: {
@@ -16,20 +16,22 @@ declare const __propDef: {
16
16
  on_delete_col: () => void;
17
17
  can_delete_rows: boolean;
18
18
  can_delete_cols: boolean;
19
- on_sort?: ((direction: SortDirection) => void) | undefined;
20
- on_clear_sort?: (() => void) | undefined;
21
- sort_direction?: (SortDirection | null) | undefined;
22
- sort_priority?: (number | null) | undefined;
23
- on_filter?: ((datatype: FilterDatatype, selected_filter: string, value: string) => void) | undefined;
24
- on_clear_filter?: (() => void) | undefined;
25
- filter_active?: (boolean | null) | undefined;
26
- editable?: boolean | undefined;
19
+ on_sort?: (direction: SortDirection) => void;
20
+ on_clear_sort?: () => void;
21
+ sort_direction?: SortDirection | null;
22
+ sort_priority?: number | null;
23
+ on_filter?: (datatype: FilterDatatype, selected_filter: string, value: string) => void;
24
+ on_clear_filter?: () => void;
25
+ filter_active?: boolean | null;
26
+ editable?: boolean;
27
27
  i18n: I18nFormatter;
28
28
  };
29
29
  events: {
30
30
  [evt: string]: CustomEvent<any>;
31
31
  };
32
32
  slots: {};
33
+ exports?: {} | undefined;
34
+ bindings?: string | undefined;
33
35
  };
34
36
  export type CellMenuProps = typeof __propDef.props;
35
37
  export type CellMenuEvents = typeof __propDef.events;
@@ -7,6 +7,8 @@ declare const __propDef: {
7
7
  [evt: string]: CustomEvent<any>;
8
8
  };
9
9
  slots: {};
10
+ exports?: {} | undefined;
11
+ bindings?: string | undefined;
10
12
  };
11
13
  export type CellMenuButtonProps = typeof __propDef.props;
12
14
  export type CellMenuButtonEvents = typeof __propDef.events;
@@ -7,6 +7,8 @@ declare const __propDef: {
7
7
  [evt: string]: CustomEvent<any>;
8
8
  };
9
9
  slots: {};
10
+ exports?: {} | undefined;
11
+ bindings?: string | undefined;
10
12
  };
11
13
  export type CellMenuIconsProps = typeof __propDef.props;
12
14
  export type CellMenuIconsEvents = typeof __propDef.events;
@@ -24,21 +24,15 @@ export let on_select_row = null;
24
24
  export let el;
25
25
  const dispatch = createEventDispatcher();
26
26
  function truncate_text(text, max_length = null, is_image = false) {
27
- if (is_image)
28
- return String(text);
27
+ if (is_image) return String(text);
29
28
  const str = String(text);
30
- if (!max_length || max_length <= 0)
31
- return str;
32
- if (str.length <= max_length)
33
- return str;
29
+ if (!max_length || max_length <= 0) return str;
30
+ if (str.length <= max_length) return str;
34
31
  return str.slice(0, max_length) + "...";
35
32
  }
36
- $:
37
- should_truncate = !edit && max_chars !== null && max_chars > 0;
38
- $:
39
- display_content = editable ? value : display_value !== null ? display_value : value;
40
- $:
41
- display_text = should_truncate ? truncate_text(display_content, max_chars, datatype === "image") : display_content;
33
+ $: should_truncate = !edit && max_chars !== null && max_chars > 0;
34
+ $: display_content = editable ? value : display_value !== null ? display_value : value;
35
+ $: display_text = should_truncate ? truncate_text(display_content, max_chars, datatype === "image") : display_content;
42
36
  function use_focus(node) {
43
37
  requestAnimationFrame(() => {
44
38
  node.focus();
@@ -3,28 +3,28 @@ import type { I18nFormatter } from "@gradio/utils";
3
3
  declare const __propDef: {
4
4
  props: {
5
5
  edit: boolean;
6
- value?: (string | number) | undefined;
7
- display_value?: (string | null) | undefined;
8
- styling?: string | undefined;
9
- header?: boolean | undefined;
10
- datatype?: ("str" | "markdown" | "html" | "number" | "bool" | "date" | "image") | undefined;
6
+ value?: string | number;
7
+ display_value?: string | null;
8
+ styling?: string;
9
+ header?: boolean;
10
+ datatype?: "str" | "markdown" | "html" | "number" | "bool" | "date" | "image";
11
11
  latex_delimiters: {
12
12
  left: string;
13
13
  right: string;
14
14
  display: boolean;
15
15
  }[];
16
- line_breaks?: boolean | undefined;
17
- editable?: boolean | undefined;
18
- is_static?: boolean | undefined;
19
- max_chars?: (number | null) | undefined;
20
- components?: Record<string, any> | undefined;
16
+ line_breaks?: boolean;
17
+ editable?: boolean;
18
+ is_static?: boolean;
19
+ max_chars?: number | null;
20
+ components?: Record<string, any>;
21
21
  i18n: I18nFormatter;
22
- is_dragging?: boolean | undefined;
23
- wrap_text?: boolean | undefined;
24
- show_selection_buttons?: boolean | undefined;
22
+ is_dragging?: boolean;
23
+ wrap_text?: boolean;
24
+ show_selection_buttons?: boolean;
25
25
  coords: [number, number];
26
- on_select_column?: (((col: number) => void) | null) | undefined;
27
- on_select_row?: (((row: number) => void) | null) | undefined;
26
+ on_select_column?: ((col: number) => void) | null;
27
+ on_select_row?: ((row: number) => void) | null;
28
28
  el: HTMLTextAreaElement | null;
29
29
  };
30
30
  events: {
@@ -40,6 +40,8 @@ declare const __propDef: {
40
40
  [evt: string]: CustomEvent<any>;
41
41
  };
42
42
  slots: {};
43
+ exports?: {} | undefined;
44
+ bindings?: string | undefined;
43
45
  };
44
46
  export type EditableCellProps = typeof __propDef.props;
45
47
  export type EditableCellEvents = typeof __propDef.events;
@@ -7,6 +7,8 @@ declare const __propDef: {
7
7
  [evt: string]: CustomEvent<any>;
8
8
  };
9
9
  slots: {};
10
+ exports?: {} | undefined;
11
+ bindings?: string | undefined;
10
12
  };
11
13
  export type EmptyRowButtonProps = typeof __propDef.props;
12
14
  export type EmptyRowButtonEvents = typeof __propDef.events;
@@ -7,6 +7,8 @@ declare const __propDef: {
7
7
  [evt: string]: CustomEvent<any>;
8
8
  };
9
9
  slots: {};
10
+ exports?: {} | undefined;
11
+ bindings?: string | undefined;
10
12
  };
11
13
  export type ExampleProps = typeof __propDef.props;
12
14
  export type ExampleEvents = typeof __propDef.events;
@@ -1,6 +1,5 @@
1
1
  <script>import { onMount } from "svelte";
2
- import { Check } from "@gradio/icons";
3
- import DropdownArrow from "../../icons/src/DropdownArrow.svelte";
2
+ import { Check, DropdownArrow } from "@gradio/icons";
4
3
  export let on_filter = () => {
5
4
  };
6
5
  let menu_element;
@@ -25,8 +24,7 @@ onMount(() => {
25
24
  position_menu();
26
25
  });
27
26
  function position_menu() {
28
- if (!menu_element)
29
- return;
27
+ if (!menu_element) return;
30
28
  const viewport_width = window.innerWidth;
31
29
  const viewport_height = window.innerHeight;
32
30
  const menu_rect = menu_element.getBoundingClientRect();