@gradio/dataframe 0.20.2-dev.0 → 0.21.0-dev.3
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 +45 -0
- package/Example.svelte +17 -13
- package/Index.svelte +114 -108
- package/dist/Example.svelte +26 -20
- package/dist/Example.svelte.d.ts +21 -19
- package/dist/Index.svelte +121 -97
- package/dist/Index.svelte.d.ts +4 -164
- package/dist/shared/BooleanCell.svelte +12 -9
- package/dist/shared/BooleanCell.svelte.d.ts +20 -18
- package/dist/shared/CellMenu.svelte +82 -64
- package/dist/shared/CellMenu.svelte.d.ts +39 -37
- package/dist/shared/CellMenuButton.svelte +2 -1
- package/dist/shared/CellMenuButton.svelte.d.ts +18 -16
- package/dist/shared/CellMenuIcons.svelte +2 -1
- package/dist/shared/CellMenuIcons.svelte.d.ts +18 -16
- package/dist/shared/EditableCell.svelte +97 -56
- package/dist/shared/EditableCell.svelte.d.ts +50 -48
- package/dist/shared/EmptyRowButton.svelte +2 -1
- package/dist/shared/EmptyRowButton.svelte.d.ts +18 -16
- package/dist/shared/Example.svelte +2 -1
- package/dist/shared/Example.svelte.d.ts +18 -16
- package/dist/shared/FilterMenu.svelte +53 -39
- package/dist/shared/FilterMenu.svelte.d.ts +20 -18
- package/dist/shared/RowNumber.svelte +3 -2
- package/dist/shared/RowNumber.svelte.d.ts +19 -17
- package/dist/shared/Table.svelte +821 -620
- package/dist/shared/Table.svelte.d.ts +59 -56
- package/dist/shared/TableCell.svelte +95 -50
- package/dist/shared/TableCell.svelte.d.ts +61 -59
- package/dist/shared/TableHeader.svelte +86 -58
- package/dist/shared/TableHeader.svelte.d.ts +55 -53
- package/dist/shared/Toolbar.svelte +49 -39
- package/dist/shared/Toolbar.svelte.d.ts +27 -25
- package/dist/shared/VirtualTable.svelte +207 -154
- package/dist/shared/VirtualTable.svelte.d.ts +40 -37
- package/dist/shared/icons/FilterIcon.svelte +2 -1
- package/dist/shared/icons/FilterIcon.svelte.d.ts +16 -14
- package/dist/shared/icons/Padlock.svelte.d.ts +22 -21
- package/dist/shared/icons/SelectionButtons.svelte +15 -5
- package/dist/shared/icons/SelectionButtons.svelte.d.ts +20 -18
- package/dist/shared/icons/SortArrowDown.svelte +2 -1
- package/dist/shared/icons/SortArrowDown.svelte.d.ts +18 -16
- package/dist/shared/icons/SortArrowUp.svelte +2 -1
- package/dist/shared/icons/SortArrowUp.svelte.d.ts +18 -16
- package/dist/shared/icons/SortButtonDown.svelte.d.ts +22 -21
- package/dist/shared/icons/SortButtonUp.svelte.d.ts +22 -21
- package/dist/shared/icons/SortIcon.svelte +12 -8
- package/dist/shared/icons/SortIcon.svelte.d.ts +22 -20
- package/dist/shared/utils/data_processing.d.ts +1 -1
- package/dist/standalone/Index.svelte +103 -74
- package/dist/standalone/Index.svelte.d.ts +41 -39
- package/dist/standalone/stubs/Upload.svelte +5 -4
- package/dist/standalone/stubs/Upload.svelte.d.ts +35 -25
- package/package.json +15 -14
- package/shared/Table.svelte +4 -4
- package/shared/VirtualTable.svelte +1 -1
- package/standalone/Index.svelte +16 -15
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/** @typedef {typeof __propDef.slots} PadlockSlots */
|
|
4
|
-
export default class Padlock extends SvelteComponent<{
|
|
1
|
+
export default Padlock;
|
|
2
|
+
type Padlock = SvelteComponent<{
|
|
5
3
|
[x: string]: never;
|
|
6
4
|
}, {
|
|
7
5
|
[evt: string]: CustomEvent<any>;
|
|
8
|
-
}, {}> {
|
|
9
|
-
|
|
10
|
-
export type PadlockProps = typeof __propDef.props;
|
|
11
|
-
export type PadlockEvents = typeof __propDef.events;
|
|
12
|
-
export type PadlockSlots = typeof __propDef.slots;
|
|
13
|
-
import { SvelteComponent } from "svelte";
|
|
14
|
-
declare const __propDef: {
|
|
15
|
-
props: {
|
|
16
|
-
[x: string]: never;
|
|
17
|
-
};
|
|
18
|
-
events: {
|
|
19
|
-
[evt: string]: CustomEvent<any>;
|
|
20
|
-
};
|
|
21
|
-
slots: {};
|
|
22
|
-
exports?: undefined;
|
|
23
|
-
bindings?: undefined;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
24
8
|
};
|
|
25
|
-
|
|
9
|
+
declare const Padlock: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
+
[x: string]: never;
|
|
11
|
+
}, {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
}, {}, {}, string>;
|
|
14
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
15
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
16
|
+
$$bindings?: Bindings;
|
|
17
|
+
} & Exports;
|
|
18
|
+
(internal: unknown, props: {
|
|
19
|
+
$$events?: Events;
|
|
20
|
+
$$slots?: Slots;
|
|
21
|
+
}): Exports & {
|
|
22
|
+
$set?: any;
|
|
23
|
+
$on?: any;
|
|
24
|
+
};
|
|
25
|
+
z_$$bindings?: Bindings;
|
|
26
|
+
}
|
|
@@ -1,8 +1,18 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
export let
|
|
3
|
-
export let
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
export let position: "column" | "row";
|
|
3
|
+
export let coords: [number, number];
|
|
4
|
+
export let on_click: (() => void) | null = null;
|
|
5
|
+
|
|
6
|
+
$: is_first_position =
|
|
7
|
+
position === "column" ? coords[0] === 0 : coords[1] === 0;
|
|
8
|
+
$: direction =
|
|
9
|
+
position === "column"
|
|
10
|
+
? is_first_position
|
|
11
|
+
? "down"
|
|
12
|
+
: "up"
|
|
13
|
+
: is_first_position
|
|
14
|
+
? "right"
|
|
15
|
+
: "left";
|
|
6
16
|
</script>
|
|
7
17
|
|
|
8
18
|
<button
|
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
+
$$bindings?: Bindings;
|
|
4
|
+
} & Exports;
|
|
5
|
+
(internal: unknown, props: Props & {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
7
11
|
};
|
|
8
|
-
|
|
9
|
-
[evt: string]: CustomEvent<any>;
|
|
10
|
-
};
|
|
11
|
-
slots: {};
|
|
12
|
-
exports?: {} | undefined;
|
|
13
|
-
bindings?: string | undefined;
|
|
14
|
-
};
|
|
15
|
-
export type SelectionButtonsProps = typeof __propDef.props;
|
|
16
|
-
export type SelectionButtonsEvents = typeof __propDef.events;
|
|
17
|
-
export type SelectionButtonsSlots = typeof __propDef.slots;
|
|
18
|
-
export default class SelectionButtons extends SvelteComponent<SelectionButtonsProps, SelectionButtonsEvents, SelectionButtonsSlots> {
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
19
13
|
}
|
|
20
|
-
|
|
14
|
+
declare const SelectionButtons: $$__sveltets_2_IsomorphicComponent<{
|
|
15
|
+
position: "column" | "row";
|
|
16
|
+
coords: [number, number];
|
|
17
|
+
on_click?: (() => void) | null;
|
|
18
|
+
}, {
|
|
19
|
+
[evt: string]: CustomEvent<any>;
|
|
20
|
+
}, {}, {}, string>;
|
|
21
|
+
type SelectionButtons = InstanceType<typeof SelectionButtons>;
|
|
22
|
+
export default SelectionButtons;
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
+
$$bindings?: Bindings;
|
|
4
|
+
} & Exports;
|
|
5
|
+
(internal: unknown, props: Props & {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
5
11
|
};
|
|
6
|
-
|
|
7
|
-
[evt: string]: CustomEvent<any>;
|
|
8
|
-
};
|
|
9
|
-
slots: {};
|
|
10
|
-
exports?: {} | undefined;
|
|
11
|
-
bindings?: string | undefined;
|
|
12
|
-
};
|
|
13
|
-
export type SortArrowDownProps = typeof __propDef.props;
|
|
14
|
-
export type SortArrowDownEvents = typeof __propDef.events;
|
|
15
|
-
export type SortArrowDownSlots = typeof __propDef.slots;
|
|
16
|
-
export default class SortArrowDown extends SvelteComponent<SortArrowDownProps, SortArrowDownEvents, SortArrowDownSlots> {
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
17
13
|
}
|
|
18
|
-
|
|
14
|
+
declare const SortArrowDown: $$__sveltets_2_IsomorphicComponent<{
|
|
15
|
+
size?: number;
|
|
16
|
+
}, {
|
|
17
|
+
[evt: string]: CustomEvent<any>;
|
|
18
|
+
}, {}, {}, string>;
|
|
19
|
+
type SortArrowDown = InstanceType<typeof SortArrowDown>;
|
|
20
|
+
export default SortArrowDown;
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
+
$$bindings?: Bindings;
|
|
4
|
+
} & Exports;
|
|
5
|
+
(internal: unknown, props: Props & {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
5
11
|
};
|
|
6
|
-
|
|
7
|
-
[evt: string]: CustomEvent<any>;
|
|
8
|
-
};
|
|
9
|
-
slots: {};
|
|
10
|
-
exports?: {} | undefined;
|
|
11
|
-
bindings?: string | undefined;
|
|
12
|
-
};
|
|
13
|
-
export type SortArrowUpProps = typeof __propDef.props;
|
|
14
|
-
export type SortArrowUpEvents = typeof __propDef.events;
|
|
15
|
-
export type SortArrowUpSlots = typeof __propDef.slots;
|
|
16
|
-
export default class SortArrowUp extends SvelteComponent<SortArrowUpProps, SortArrowUpEvents, SortArrowUpSlots> {
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
17
13
|
}
|
|
18
|
-
|
|
14
|
+
declare const SortArrowUp: $$__sveltets_2_IsomorphicComponent<{
|
|
15
|
+
size?: number;
|
|
16
|
+
}, {
|
|
17
|
+
[evt: string]: CustomEvent<any>;
|
|
18
|
+
}, {}, {}, string>;
|
|
19
|
+
type SortArrowUp = InstanceType<typeof SortArrowUp>;
|
|
20
|
+
export default SortArrowUp;
|
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/** @typedef {typeof __propDef.slots} SortButtonDownSlots */
|
|
4
|
-
export default class SortButtonDown extends SvelteComponent<{
|
|
1
|
+
export default SortButtonDown;
|
|
2
|
+
type SortButtonDown = SvelteComponent<{
|
|
5
3
|
[x: string]: never;
|
|
6
4
|
}, {
|
|
7
5
|
[evt: string]: CustomEvent<any>;
|
|
8
|
-
}, {}> {
|
|
9
|
-
|
|
10
|
-
export type SortButtonDownProps = typeof __propDef.props;
|
|
11
|
-
export type SortButtonDownEvents = typeof __propDef.events;
|
|
12
|
-
export type SortButtonDownSlots = typeof __propDef.slots;
|
|
13
|
-
import { SvelteComponent } from "svelte";
|
|
14
|
-
declare const __propDef: {
|
|
15
|
-
props: {
|
|
16
|
-
[x: string]: never;
|
|
17
|
-
};
|
|
18
|
-
events: {
|
|
19
|
-
[evt: string]: CustomEvent<any>;
|
|
20
|
-
};
|
|
21
|
-
slots: {};
|
|
22
|
-
exports?: undefined;
|
|
23
|
-
bindings?: undefined;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
24
8
|
};
|
|
25
|
-
|
|
9
|
+
declare const SortButtonDown: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
+
[x: string]: never;
|
|
11
|
+
}, {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
}, {}, {}, string>;
|
|
14
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
15
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
16
|
+
$$bindings?: Bindings;
|
|
17
|
+
} & Exports;
|
|
18
|
+
(internal: unknown, props: {
|
|
19
|
+
$$events?: Events;
|
|
20
|
+
$$slots?: Slots;
|
|
21
|
+
}): Exports & {
|
|
22
|
+
$set?: any;
|
|
23
|
+
$on?: any;
|
|
24
|
+
};
|
|
25
|
+
z_$$bindings?: Bindings;
|
|
26
|
+
}
|
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/** @typedef {typeof __propDef.slots} SortButtonUpSlots */
|
|
4
|
-
export default class SortButtonUp extends SvelteComponent<{
|
|
1
|
+
export default SortButtonUp;
|
|
2
|
+
type SortButtonUp = SvelteComponent<{
|
|
5
3
|
[x: string]: never;
|
|
6
4
|
}, {
|
|
7
5
|
[evt: string]: CustomEvent<any>;
|
|
8
|
-
}, {}> {
|
|
9
|
-
|
|
10
|
-
export type SortButtonUpProps = typeof __propDef.props;
|
|
11
|
-
export type SortButtonUpEvents = typeof __propDef.events;
|
|
12
|
-
export type SortButtonUpSlots = typeof __propDef.slots;
|
|
13
|
-
import { SvelteComponent } from "svelte";
|
|
14
|
-
declare const __propDef: {
|
|
15
|
-
props: {
|
|
16
|
-
[x: string]: never;
|
|
17
|
-
};
|
|
18
|
-
events: {
|
|
19
|
-
[evt: string]: CustomEvent<any>;
|
|
20
|
-
};
|
|
21
|
-
slots: {};
|
|
22
|
-
exports?: undefined;
|
|
23
|
-
bindings?: undefined;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
24
8
|
};
|
|
25
|
-
|
|
9
|
+
declare const SortButtonUp: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
+
[x: string]: never;
|
|
11
|
+
}, {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
}, {}, {}, string>;
|
|
14
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
15
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
16
|
+
$$bindings?: Bindings;
|
|
17
|
+
} & Exports;
|
|
18
|
+
(internal: unknown, props: {
|
|
19
|
+
$$events?: Events;
|
|
20
|
+
$$slots?: Slots;
|
|
21
|
+
}): Exports & {
|
|
22
|
+
$set?: any;
|
|
23
|
+
$on?: any;
|
|
24
|
+
};
|
|
25
|
+
z_$$bindings?: Bindings;
|
|
26
|
+
}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { createEventDispatcher } from "svelte";
|
|
3
|
+
import type { I18nFormatter } from "@gradio/utils";
|
|
4
|
+
import SortButtonUp from "./SortButtonUp.svelte";
|
|
5
|
+
import SortButtonDown from "./SortButtonDown.svelte";
|
|
6
|
+
import { IconButton } from "@gradio/atoms";
|
|
7
|
+
type SortDirection = "asc" | "desc";
|
|
8
|
+
export let direction: SortDirection | null = null;
|
|
9
|
+
export let priority: number | null = null;
|
|
10
|
+
export let i18n: I18nFormatter;
|
|
11
|
+
|
|
12
|
+
const dispatch = createEventDispatcher<{ sort: SortDirection }>();
|
|
9
13
|
</script>
|
|
10
14
|
|
|
11
15
|
<div class="sort-icons" role="group" aria-label={i18n("dataframe.sort_column")}>
|
|
@@ -1,23 +1,25 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
1
|
import type { I18nFormatter } from "@gradio/utils";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: Props & {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports & {
|
|
10
|
+
$set?: any;
|
|
11
|
+
$on?: any;
|
|
8
12
|
};
|
|
9
|
-
|
|
10
|
-
sort: CustomEvent<"asc" | "desc">;
|
|
11
|
-
} & {
|
|
12
|
-
[evt: string]: CustomEvent<any>;
|
|
13
|
-
};
|
|
14
|
-
slots: {};
|
|
15
|
-
exports?: {} | undefined;
|
|
16
|
-
bindings?: string | undefined;
|
|
17
|
-
};
|
|
18
|
-
export type SortIconProps = typeof __propDef.props;
|
|
19
|
-
export type SortIconEvents = typeof __propDef.events;
|
|
20
|
-
export type SortIconSlots = typeof __propDef.slots;
|
|
21
|
-
export default class SortIcon extends SvelteComponent<SortIconProps, SortIconEvents, SortIconSlots> {
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
22
14
|
}
|
|
23
|
-
|
|
15
|
+
declare const SortIcon: $$__sveltets_2_IsomorphicComponent<{
|
|
16
|
+
direction?: ("asc" | "desc") | null;
|
|
17
|
+
priority?: number | null;
|
|
18
|
+
i18n: I18nFormatter;
|
|
19
|
+
}, {
|
|
20
|
+
sort: CustomEvent<"asc" | "desc">;
|
|
21
|
+
} & {
|
|
22
|
+
[evt: string]: CustomEvent<any>;
|
|
23
|
+
}, {}, {}, string>;
|
|
24
|
+
type SortIcon = InstanceType<typeof SortIcon>;
|
|
25
|
+
export default SortIcon;
|
|
@@ -7,7 +7,7 @@ export declare function make_headers(_head: Headers, col_count: [number, "fixed"
|
|
|
7
7
|
export declare function process_data(values: CellValue[][], els: Record<string, {
|
|
8
8
|
cell: null | HTMLTableCellElement;
|
|
9
9
|
input: null | HTMLTextAreaElement;
|
|
10
|
-
}>, data_binding: Record<string, any>, make_id: () => string, display_value:
|
|
10
|
+
}>, data_binding: Record<string, any>, make_id: () => string, display_value: string[][] | null | undefined, datatype: Datatype | Datatype[]): {
|
|
11
11
|
id: string;
|
|
12
12
|
value: CellValue;
|
|
13
13
|
display_value?: string;
|
|
@@ -1,62 +1,90 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export let
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
export let
|
|
23
|
-
export let
|
|
24
|
-
export let
|
|
25
|
-
export let
|
|
26
|
-
export let
|
|
27
|
-
export let
|
|
28
|
-
export let
|
|
29
|
-
export let
|
|
30
|
-
export let
|
|
31
|
-
export let
|
|
32
|
-
export let
|
|
33
|
-
export let
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { onMount } from "svelte";
|
|
3
|
+
import Table from "../shared/Table.svelte";
|
|
4
|
+
import type { Datatype, DataframeValue } from "../shared/utils/utils";
|
|
5
|
+
import type { I18nFormatter } from "@gradio/utils";
|
|
6
|
+
import { default_i18n } from "./default_i18n";
|
|
7
|
+
|
|
8
|
+
export let i18n: I18nFormatter | undefined = undefined;
|
|
9
|
+
const i18n_fn = (key: string | null | undefined): string => {
|
|
10
|
+
if (!key) return "";
|
|
11
|
+
if (typeof i18n === "function") return (i18n as any)(key);
|
|
12
|
+
if (i18n && typeof i18n === "object")
|
|
13
|
+
return (i18n as any)[key] ?? default_i18n[key] ?? key;
|
|
14
|
+
return default_i18n[key] ?? key;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export let value: DataframeValue = {
|
|
18
|
+
data: [["", "", ""]],
|
|
19
|
+
headers: ["1", "2", "3"],
|
|
20
|
+
metadata: null
|
|
21
|
+
};
|
|
22
|
+
export let datatype: Datatype | Datatype[] = "str";
|
|
23
|
+
export let interactive = true;
|
|
24
|
+
export let show_row_numbers = false;
|
|
25
|
+
export let max_height = 500;
|
|
26
|
+
export let show_search: "none" | "search" | "filter" = "none";
|
|
27
|
+
export let wrap = false;
|
|
28
|
+
export let line_breaks = true;
|
|
29
|
+
export let column_widths: string[] = [];
|
|
30
|
+
export let max_chars: number | undefined = undefined;
|
|
31
|
+
export let pinned_columns = 0;
|
|
32
|
+
export let static_columns: (string | number)[] = [];
|
|
33
|
+
export let fullscreen = false;
|
|
34
|
+
export let label: string | null = null;
|
|
35
|
+
export let show_label = true;
|
|
36
|
+
export let latex_delimiters: any[] = [];
|
|
37
|
+
export let col_count: [number, "fixed" | "dynamic"] | undefined = undefined;
|
|
38
|
+
export let row_count: [number, "fixed" | "dynamic"] | undefined = undefined;
|
|
39
|
+
|
|
40
|
+
// mirrors default row count and column count logic in dataframe.py
|
|
41
|
+
$: resolved_row_count = (() => {
|
|
42
|
+
if (
|
|
43
|
+
row_count &&
|
|
44
|
+
Array.isArray(row_count) &&
|
|
45
|
+
row_count.length === 2 &&
|
|
46
|
+
typeof row_count[0] === "number" &&
|
|
47
|
+
(row_count[1] === "fixed" || row_count[1] === "dynamic")
|
|
48
|
+
) {
|
|
49
|
+
return row_count as [number, "fixed" | "dynamic"];
|
|
50
|
+
}
|
|
51
|
+
return [1, "dynamic"] as [number, "fixed" | "dynamic"];
|
|
52
|
+
})();
|
|
53
|
+
$: resolved_col_count = (() => {
|
|
54
|
+
if (
|
|
55
|
+
col_count &&
|
|
56
|
+
Array.isArray(col_count) &&
|
|
57
|
+
col_count.length === 2 &&
|
|
58
|
+
typeof col_count[0] === "number" &&
|
|
59
|
+
(col_count[1] === "fixed" || col_count[1] === "dynamic")
|
|
60
|
+
) {
|
|
61
|
+
return col_count as [number, "fixed" | "dynamic"];
|
|
62
|
+
}
|
|
63
|
+
const headerLength =
|
|
64
|
+
value && value.headers && typeof value.headers.length === "number"
|
|
65
|
+
? value.headers.length
|
|
66
|
+
: 3;
|
|
67
|
+
return [headerLength, "dynamic"] as [number, "fixed" | "dynamic"];
|
|
68
|
+
})();
|
|
69
|
+
$: if (
|
|
70
|
+
static_columns &&
|
|
71
|
+
static_columns.length > 0 &&
|
|
72
|
+
resolved_col_count[1] !== "fixed"
|
|
73
|
+
) {
|
|
74
|
+
resolved_col_count = [resolved_col_count[0], "fixed"];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
let root = "";
|
|
78
|
+
|
|
79
|
+
onMount(() => {
|
|
80
|
+
const handler = (e: KeyboardEvent): void => {
|
|
81
|
+
if (e.key === "Escape") {
|
|
82
|
+
fullscreen = false;
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
window.addEventListener("keydown", handler);
|
|
86
|
+
return () => window.removeEventListener("keydown", handler);
|
|
87
|
+
});
|
|
60
88
|
</script>
|
|
61
89
|
|
|
62
90
|
<div class="gradio-dataframe-standalone" class:fullscreen>
|
|
@@ -273,8 +301,8 @@ onMount(() => {
|
|
|
273
301
|
--df-body-text-color-subdued: var(--df-neutral-400, #9ca3af);
|
|
274
302
|
--df-table-text-color: var(--df-body-text-color, #111827);
|
|
275
303
|
--df-shadow-drop: rgba(0, 0, 0, 0.05) 0px 1px 2px 0px;
|
|
276
|
-
--df-shadow-drop-lg:
|
|
277
|
-
0 1px 2px -1px rgb(0 0 0 / 0.1);
|
|
304
|
+
--df-shadow-drop-lg:
|
|
305
|
+
0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
|
|
278
306
|
--df-shadow-inset: rgba(0, 0, 0, 0.05) 0px 2px 4px 0px inset;
|
|
279
307
|
--df-shadow-spread: 3px;
|
|
280
308
|
|
|
@@ -282,8 +310,8 @@ onMount(() => {
|
|
|
282
310
|
--df-bw-svt-p-bottom: 0px;
|
|
283
311
|
|
|
284
312
|
--df-border-color-secondary: var(--df-border-color-accent, #fdba74);
|
|
285
|
-
--df-shadow-md:
|
|
286
|
-
0 4px 6px -2px rgba(0, 0, 0, 0.05);
|
|
313
|
+
--df-shadow-md:
|
|
314
|
+
0 12px 16px -4px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
|
|
287
315
|
|
|
288
316
|
--df-checkbox-border-radius: var(--df-radius-sm, 4px);
|
|
289
317
|
--df-checkbox-shadow: none;
|
|
@@ -325,8 +353,8 @@ onMount(() => {
|
|
|
325
353
|
--df-input-placeholder-color: var(--neutral-400, #9ca3af);
|
|
326
354
|
--df-input-radius: var(--df-radius-sm, 4px);
|
|
327
355
|
--df-input-shadow: none;
|
|
328
|
-
--df-input-shadow-focus:
|
|
329
|
-
|
|
356
|
+
--df-input-shadow-focus:
|
|
357
|
+
0 0 0 var(--shadow-spread, 3px) var(--secondary-50, #eff6ff),
|
|
330
358
|
var(--shadow-inset, rgba(0, 0, 0, 0.05) 0px 2px 4px 0px inset);
|
|
331
359
|
|
|
332
360
|
--table-radius: var(--gr-df-table-radius, var(--df-table-radius, 4px));
|
|
@@ -512,16 +540,17 @@ onMount(() => {
|
|
|
512
540
|
--line-md: var(--df-line-md, 1.5);
|
|
513
541
|
--line-lg: var(--df-line-lg, 1.75);
|
|
514
542
|
|
|
515
|
-
--shadow-xs:
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
543
|
+
--shadow-xs:
|
|
544
|
+
0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
|
|
545
|
+
--shadow-sm:
|
|
546
|
+
0 4px 6px -2px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.06);
|
|
547
|
+
--shadow-md:
|
|
548
|
+
0 12px 16px -4px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
|
|
549
|
+
--shadow-lg:
|
|
550
|
+
0 20px 24px -4px rgba(0, 0, 0, 0.1), 0 8px 8px -4px rgba(0, 0, 0, 0.04);
|
|
522
551
|
--shadow-drop: rgba(0, 0, 0, 0.05) 0px 1px 2px 0px;
|
|
523
|
-
--shadow-drop-lg:
|
|
524
|
-
0 1px 2px -1px rgb(0 0 0 / 0.1);
|
|
552
|
+
--shadow-drop-lg:
|
|
553
|
+
0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
|
|
525
554
|
--shadow-inset: rgba(0, 0, 0, 0.05) 0px 2px 4px 0px inset;
|
|
526
555
|
--shadow-spread: 3px;
|
|
527
556
|
}
|