@gradio/dataframe 0.20.1 → 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 +59 -0
- package/Dataframe.stories.svelte +0 -25
- package/Example.svelte +17 -13
- package/Index.svelte +114 -110
- package/dist/Example.svelte +26 -20
- package/dist/Example.svelte.d.ts +21 -19
- package/dist/Index.svelte +121 -99
- package/dist/Index.svelte.d.ts +4 -168
- 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 +826 -624
- package/dist/shared/Table.svelte.d.ts +59 -57
- 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 +104 -78
- package/dist/standalone/Index.svelte.d.ts +41 -41
- 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 +13 -11
- package/shared/VirtualTable.svelte +1 -1
- package/standalone/Index.svelte +17 -19
|
@@ -1,41 +1,43 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
1
|
import type { I18nFormatter } from "@gradio/utils";
|
|
3
2
|
import type { SortDirection, FilterDatatype } from "./context/dataframe_context";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
row_count: [number, "fixed" | "dynamic"];
|
|
15
|
-
on_delete_row: () => void;
|
|
16
|
-
on_delete_col: () => void;
|
|
17
|
-
can_delete_rows: boolean;
|
|
18
|
-
can_delete_cols: boolean;
|
|
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
|
-
i18n: I18nFormatter;
|
|
3
|
+
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> {
|
|
4
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
5
|
+
$$bindings?: Bindings;
|
|
6
|
+
} & Exports;
|
|
7
|
+
(internal: unknown, props: Props & {
|
|
8
|
+
$$events?: Events;
|
|
9
|
+
$$slots?: Slots;
|
|
10
|
+
}): Exports & {
|
|
11
|
+
$set?: any;
|
|
12
|
+
$on?: any;
|
|
28
13
|
};
|
|
29
|
-
|
|
30
|
-
[evt: string]: CustomEvent<any>;
|
|
31
|
-
};
|
|
32
|
-
slots: {};
|
|
33
|
-
exports?: {} | undefined;
|
|
34
|
-
bindings?: string | undefined;
|
|
35
|
-
};
|
|
36
|
-
export type CellMenuProps = typeof __propDef.props;
|
|
37
|
-
export type CellMenuEvents = typeof __propDef.events;
|
|
38
|
-
export type CellMenuSlots = typeof __propDef.slots;
|
|
39
|
-
export default class CellMenu extends SvelteComponent<CellMenuProps, CellMenuEvents, CellMenuSlots> {
|
|
14
|
+
z_$$bindings?: Bindings;
|
|
40
15
|
}
|
|
41
|
-
|
|
16
|
+
declare const CellMenu: $$__sveltets_2_IsomorphicComponent<{
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
on_add_row_above: () => void;
|
|
20
|
+
on_add_row_below: () => void;
|
|
21
|
+
on_add_column_left: () => void;
|
|
22
|
+
on_add_column_right: () => void;
|
|
23
|
+
row: number;
|
|
24
|
+
col_count: [number, "fixed" | "dynamic"];
|
|
25
|
+
row_count: [number, "fixed" | "dynamic"];
|
|
26
|
+
on_delete_row: () => void;
|
|
27
|
+
on_delete_col: () => void;
|
|
28
|
+
can_delete_rows: boolean;
|
|
29
|
+
can_delete_cols: boolean;
|
|
30
|
+
on_sort?: (direction: SortDirection) => void;
|
|
31
|
+
on_clear_sort?: () => void;
|
|
32
|
+
sort_direction?: SortDirection | null;
|
|
33
|
+
sort_priority?: number | null;
|
|
34
|
+
on_filter?: (datatype: FilterDatatype, selected_filter: string, value: string) => void;
|
|
35
|
+
on_clear_filter?: () => void;
|
|
36
|
+
filter_active?: boolean | null;
|
|
37
|
+
editable?: boolean;
|
|
38
|
+
i18n: I18nFormatter;
|
|
39
|
+
}, {
|
|
40
|
+
[evt: string]: CustomEvent<any>;
|
|
41
|
+
}, {}, {}, string>;
|
|
42
|
+
type CellMenu = InstanceType<typeof CellMenu>;
|
|
43
|
+
export default CellMenu;
|
|
@@ -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 CellMenuButtonProps = typeof __propDef.props;
|
|
14
|
-
export type CellMenuButtonEvents = typeof __propDef.events;
|
|
15
|
-
export type CellMenuButtonSlots = typeof __propDef.slots;
|
|
16
|
-
export default class CellMenuButton extends SvelteComponent<CellMenuButtonProps, CellMenuButtonEvents, CellMenuButtonSlots> {
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
17
13
|
}
|
|
18
|
-
|
|
14
|
+
declare const CellMenuButton: $$__sveltets_2_IsomorphicComponent<{
|
|
15
|
+
on_click: (event: MouseEvent) => void;
|
|
16
|
+
}, {
|
|
17
|
+
[evt: string]: CustomEvent<any>;
|
|
18
|
+
}, {}, {}, string>;
|
|
19
|
+
type CellMenuButton = InstanceType<typeof CellMenuButton>;
|
|
20
|
+
export default CellMenuButton;
|
|
@@ -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 CellMenuIconsProps = typeof __propDef.props;
|
|
14
|
-
export type CellMenuIconsEvents = typeof __propDef.events;
|
|
15
|
-
export type CellMenuIconsSlots = typeof __propDef.slots;
|
|
16
|
-
export default class CellMenuIcons extends SvelteComponent<CellMenuIconsProps, CellMenuIconsEvents, CellMenuIconsSlots> {
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
17
13
|
}
|
|
18
|
-
|
|
14
|
+
declare const CellMenuIcons: $$__sveltets_2_IsomorphicComponent<{
|
|
15
|
+
icon: string;
|
|
16
|
+
}, {
|
|
17
|
+
[evt: string]: CustomEvent<any>;
|
|
18
|
+
}, {}, {}, string>;
|
|
19
|
+
type CellMenuIcons = InstanceType<typeof CellMenuIcons>;
|
|
20
|
+
export default CellMenuIcons;
|
|
@@ -1,59 +1,100 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export let
|
|
10
|
-
export let
|
|
11
|
-
export let
|
|
12
|
-
export let
|
|
13
|
-
export let
|
|
14
|
-
export let
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
export let
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { createEventDispatcher } from "svelte";
|
|
3
|
+
import { MarkdownCode } from "@gradio/markdown-code";
|
|
4
|
+
import type { I18nFormatter } from "@gradio/utils";
|
|
5
|
+
import type { CellValue } from "./types";
|
|
6
|
+
import SelectionButtons from "./icons/SelectionButtons.svelte";
|
|
7
|
+
import BooleanCell from "./BooleanCell.svelte";
|
|
8
|
+
|
|
9
|
+
export let edit: boolean;
|
|
10
|
+
export let value: CellValue = "";
|
|
11
|
+
export let display_value: string | null = null;
|
|
12
|
+
export let styling = "";
|
|
13
|
+
export let header = false;
|
|
14
|
+
export let datatype:
|
|
15
|
+
| "str"
|
|
16
|
+
| "markdown"
|
|
17
|
+
| "html"
|
|
18
|
+
| "number"
|
|
19
|
+
| "bool"
|
|
20
|
+
| "date"
|
|
21
|
+
| "image" = "str";
|
|
22
|
+
export let latex_delimiters: {
|
|
23
|
+
left: string;
|
|
24
|
+
right: string;
|
|
25
|
+
display: boolean;
|
|
26
|
+
}[];
|
|
27
|
+
export let line_breaks = true;
|
|
28
|
+
export let editable = true;
|
|
29
|
+
export let is_static = false;
|
|
30
|
+
export let max_chars: number | null = null;
|
|
31
|
+
export let components: Record<string, any> = {};
|
|
32
|
+
export let i18n: I18nFormatter;
|
|
33
|
+
export let is_dragging = false;
|
|
34
|
+
export let wrap_text = false;
|
|
35
|
+
|
|
36
|
+
export let show_selection_buttons = false;
|
|
37
|
+
export let coords: [number, number];
|
|
38
|
+
export let on_select_column: ((col: number) => void) | null = null;
|
|
39
|
+
export let on_select_row: ((row: number) => void) | null = null;
|
|
40
|
+
export let el: HTMLTextAreaElement | null;
|
|
41
|
+
|
|
42
|
+
const dispatch = createEventDispatcher<{
|
|
43
|
+
blur: { blur_event: FocusEvent; coords: [number, number] };
|
|
44
|
+
keydown: KeyboardEvent;
|
|
45
|
+
}>();
|
|
46
|
+
|
|
47
|
+
function truncate_text(
|
|
48
|
+
text: CellValue,
|
|
49
|
+
max_length: number | null = null,
|
|
50
|
+
is_image = false
|
|
51
|
+
): string {
|
|
52
|
+
if (is_image) return String(text);
|
|
53
|
+
const str = String(text);
|
|
54
|
+
if (!max_length || max_length <= 0) return str;
|
|
55
|
+
if (str.length <= max_length) return str;
|
|
56
|
+
return str.slice(0, max_length) + "...";
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
$: should_truncate = !edit && max_chars !== null && max_chars > 0;
|
|
60
|
+
|
|
61
|
+
$: display_content = editable
|
|
62
|
+
? value
|
|
63
|
+
: display_value !== null
|
|
64
|
+
? display_value
|
|
65
|
+
: value;
|
|
66
|
+
|
|
67
|
+
$: display_text = should_truncate
|
|
68
|
+
? truncate_text(display_content, max_chars, datatype === "image")
|
|
69
|
+
: display_content;
|
|
70
|
+
|
|
71
|
+
function use_focus(node: HTMLTextAreaElement): any {
|
|
72
|
+
requestAnimationFrame(() => {
|
|
73
|
+
node.focus();
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
return {};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function handle_blur(event: FocusEvent): void {
|
|
80
|
+
dispatch("blur", {
|
|
81
|
+
blur_event: event,
|
|
82
|
+
coords: coords
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function handle_keydown(event: KeyboardEvent): void {
|
|
87
|
+
dispatch("keydown", event);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function commit_change(checked: boolean): void {
|
|
91
|
+
handle_blur({ target: { value } } as unknown as FocusEvent);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
$: if (!edit) {
|
|
95
|
+
// Shim blur on removal for Safari and Firefox
|
|
96
|
+
handle_blur({ target: { value } } as unknown as FocusEvent);
|
|
97
|
+
}
|
|
57
98
|
</script>
|
|
58
99
|
|
|
59
100
|
{#if edit && datatype !== "bool"}
|
|
@@ -1,52 +1,54 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
1
|
import type { I18nFormatter } from "@gradio/utils";
|
|
3
2
|
import type { CellValue } from "./types";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
right: string;
|
|
15
|
-
display: boolean;
|
|
16
|
-
}[];
|
|
17
|
-
line_breaks?: boolean;
|
|
18
|
-
editable?: boolean;
|
|
19
|
-
is_static?: boolean;
|
|
20
|
-
max_chars?: number | null;
|
|
21
|
-
components?: Record<string, any>;
|
|
22
|
-
i18n: I18nFormatter;
|
|
23
|
-
is_dragging?: boolean;
|
|
24
|
-
wrap_text?: boolean;
|
|
25
|
-
show_selection_buttons?: boolean;
|
|
26
|
-
coords: [number, number];
|
|
27
|
-
on_select_column?: ((col: number) => void) | null;
|
|
28
|
-
on_select_row?: ((row: number) => void) | null;
|
|
29
|
-
el: HTMLTextAreaElement | null;
|
|
30
|
-
};
|
|
31
|
-
events: {
|
|
32
|
-
mousedown: MouseEvent;
|
|
33
|
-
click: MouseEvent;
|
|
34
|
-
focus: FocusEvent;
|
|
35
|
-
blur: CustomEvent<{
|
|
36
|
-
blur_event: FocusEvent;
|
|
37
|
-
coords: [number, number];
|
|
38
|
-
}>;
|
|
39
|
-
keydown: CustomEvent<KeyboardEvent>;
|
|
40
|
-
} & {
|
|
41
|
-
[evt: string]: CustomEvent<any>;
|
|
3
|
+
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> {
|
|
4
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
5
|
+
$$bindings?: Bindings;
|
|
6
|
+
} & Exports;
|
|
7
|
+
(internal: unknown, props: Props & {
|
|
8
|
+
$$events?: Events;
|
|
9
|
+
$$slots?: Slots;
|
|
10
|
+
}): Exports & {
|
|
11
|
+
$set?: any;
|
|
12
|
+
$on?: any;
|
|
42
13
|
};
|
|
43
|
-
|
|
44
|
-
exports?: {} | undefined;
|
|
45
|
-
bindings?: string | undefined;
|
|
46
|
-
};
|
|
47
|
-
export type EditableCellProps = typeof __propDef.props;
|
|
48
|
-
export type EditableCellEvents = typeof __propDef.events;
|
|
49
|
-
export type EditableCellSlots = typeof __propDef.slots;
|
|
50
|
-
export default class EditableCell extends SvelteComponent<EditableCellProps, EditableCellEvents, EditableCellSlots> {
|
|
14
|
+
z_$$bindings?: Bindings;
|
|
51
15
|
}
|
|
52
|
-
|
|
16
|
+
declare const EditableCell: $$__sveltets_2_IsomorphicComponent<{
|
|
17
|
+
edit: boolean;
|
|
18
|
+
value?: CellValue;
|
|
19
|
+
display_value?: string | null;
|
|
20
|
+
styling?: string;
|
|
21
|
+
header?: boolean;
|
|
22
|
+
datatype?: "str" | "markdown" | "html" | "number" | "bool" | "date" | "image";
|
|
23
|
+
latex_delimiters: {
|
|
24
|
+
left: string;
|
|
25
|
+
right: string;
|
|
26
|
+
display: boolean;
|
|
27
|
+
}[];
|
|
28
|
+
line_breaks?: boolean;
|
|
29
|
+
editable?: boolean;
|
|
30
|
+
is_static?: boolean;
|
|
31
|
+
max_chars?: number | null;
|
|
32
|
+
components?: Record<string, any>;
|
|
33
|
+
i18n: I18nFormatter;
|
|
34
|
+
is_dragging?: boolean;
|
|
35
|
+
wrap_text?: boolean;
|
|
36
|
+
show_selection_buttons?: boolean;
|
|
37
|
+
coords: [number, number];
|
|
38
|
+
on_select_column?: ((col: number) => void) | null;
|
|
39
|
+
on_select_row?: ((row: number) => void) | null;
|
|
40
|
+
el: HTMLTextAreaElement | null;
|
|
41
|
+
}, {
|
|
42
|
+
mousedown: MouseEvent;
|
|
43
|
+
click: PointerEvent;
|
|
44
|
+
focus: FocusEvent;
|
|
45
|
+
blur: CustomEvent<{
|
|
46
|
+
blur_event: FocusEvent;
|
|
47
|
+
coords: [number, number];
|
|
48
|
+
}>;
|
|
49
|
+
keydown: CustomEvent<KeyboardEvent>;
|
|
50
|
+
} & {
|
|
51
|
+
[evt: string]: CustomEvent<any>;
|
|
52
|
+
}, {}, {}, string>;
|
|
53
|
+
type EditableCell = InstanceType<typeof EditableCell>;
|
|
54
|
+
export default EditableCell;
|
|
@@ -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 EmptyRowButtonProps = typeof __propDef.props;
|
|
14
|
-
export type EmptyRowButtonEvents = typeof __propDef.events;
|
|
15
|
-
export type EmptyRowButtonSlots = typeof __propDef.slots;
|
|
16
|
-
export default class EmptyRowButton extends SvelteComponent<EmptyRowButtonProps, EmptyRowButtonEvents, EmptyRowButtonSlots> {
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
17
13
|
}
|
|
18
|
-
|
|
14
|
+
declare const EmptyRowButton: $$__sveltets_2_IsomorphicComponent<{
|
|
15
|
+
on_click: () => void;
|
|
16
|
+
}, {
|
|
17
|
+
[evt: string]: CustomEvent<any>;
|
|
18
|
+
}, {}, {}, string>;
|
|
19
|
+
type EmptyRowButton = InstanceType<typeof EmptyRowButton>;
|
|
20
|
+
export default EmptyRowButton;
|
|
@@ -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 ExampleProps = typeof __propDef.props;
|
|
14
|
-
export type ExampleEvents = typeof __propDef.events;
|
|
15
|
-
export type ExampleSlots = typeof __propDef.slots;
|
|
16
|
-
export default class Example extends SvelteComponent<ExampleProps, ExampleEvents, ExampleSlots> {
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
17
13
|
}
|
|
18
|
-
|
|
14
|
+
declare const Example: $$__sveltets_2_IsomorphicComponent<{
|
|
15
|
+
value: (string | number)[][];
|
|
16
|
+
}, {
|
|
17
|
+
[evt: string]: CustomEvent<any>;
|
|
18
|
+
}, {}, {}, string>;
|
|
19
|
+
type Example = InstanceType<typeof Example>;
|
|
20
|
+
export default Example;
|
|
@@ -1,42 +1,56 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
let
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
function
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { onMount } from "svelte";
|
|
3
|
+
import { Check, DropdownArrow } from "@gradio/icons";
|
|
4
|
+
import type { FilterDatatype } from "./context/dataframe_context";
|
|
5
|
+
|
|
6
|
+
export let on_filter: (
|
|
7
|
+
datatype: FilterDatatype,
|
|
8
|
+
selected_filter: string,
|
|
9
|
+
value: string
|
|
10
|
+
) => void = () => {};
|
|
11
|
+
|
|
12
|
+
let menu_element: HTMLDivElement;
|
|
13
|
+
let datatype: "string" | "number" = "string";
|
|
14
|
+
let current_filter = "Contains";
|
|
15
|
+
let filter_dropdown_open = false;
|
|
16
|
+
let filter_input_value = "";
|
|
17
|
+
|
|
18
|
+
const filter_options = {
|
|
19
|
+
string: [
|
|
20
|
+
"Contains",
|
|
21
|
+
"Does not contain",
|
|
22
|
+
"Starts with",
|
|
23
|
+
"Ends with",
|
|
24
|
+
"Is",
|
|
25
|
+
"Is not",
|
|
26
|
+
"Is empty",
|
|
27
|
+
"Is not empty"
|
|
28
|
+
],
|
|
29
|
+
number: ["=", "≠", ">", "<", "≥", "≤", "Is empty", "Is not empty"]
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
onMount(() => {
|
|
33
|
+
position_menu();
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
function position_menu(): void {
|
|
37
|
+
if (!menu_element) return;
|
|
38
|
+
|
|
39
|
+
const viewport_width = window.innerWidth;
|
|
40
|
+
const viewport_height = window.innerHeight;
|
|
41
|
+
const menu_rect = menu_element.getBoundingClientRect();
|
|
42
|
+
|
|
43
|
+
const x = (viewport_width - menu_rect.width) / 2;
|
|
44
|
+
const y = (viewport_height - menu_rect.height) / 2;
|
|
45
|
+
|
|
46
|
+
menu_element.style.left = `${x}px`;
|
|
47
|
+
menu_element.style.top = `${y}px`;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function handle_filter_input(e: Event): void {
|
|
51
|
+
const target = e.target as HTMLInputElement;
|
|
52
|
+
filter_input_value = target.value;
|
|
53
|
+
}
|
|
40
54
|
</script>
|
|
41
55
|
|
|
42
56
|
<div>
|