1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | import React from "react";
|
11 | import {Table, TableData, TableOptions, Schema} from "@finos/perspective";
|
12 |
|
13 | export interface HTMLPerspectiveViewerElement extends PerspectiveViewerOptions, HTMLElement {
|
14 | load(data: TableData | Table, options?: TableOptions): void;
|
15 | load(schema: Schema, options?: TableOptions): void;
|
16 | update(data: TableData): void;
|
17 | notifyResize(): void;
|
18 | delete(delete_table: boolean): Promise<void>;
|
19 | clear(): void;
|
20 | replace(data: TableData): void;
|
21 | flush(): Promise<void>;
|
22 | toggleConfig(): void;
|
23 | save(): PerspectiveViewerOptions;
|
24 | reset(): void;
|
25 | restore(x: any): Promise<void>;
|
26 | restyleElement(): void;
|
27 | readonly table?: Table;
|
28 | }
|
29 | interface ComputedColumn {
|
30 | name: string;
|
31 | inputs: string[];
|
32 | func: string;
|
33 | }
|
34 |
|
35 | export type Filters = Array<[string, string, string]>;
|
36 | export type Sort = Array<[string, string] | string>;
|
37 | export type ComputedColumns = ComputedColumn[];
|
38 | export type Aggregates = {[column_name: string]: string};
|
39 | export type Pivots = string[];
|
40 | export type Columns = string[];
|
41 |
|
42 | export interface PerspectiveViewerOptions {
|
43 | aggregates?: Aggregates;
|
44 | editable?: boolean;
|
45 | plugin?: string;
|
46 | columns?: Columns;
|
47 | "computed-columns"?: ComputedColumns;
|
48 | "row-pivots"?: Pivots;
|
49 | "column-pivots"?: Pivots;
|
50 | filters?: Filters;
|
51 | sort?: Sort;
|
52 | selectable?: boolean;
|
53 | }
|
54 |
|
55 | interface PerspectiveViewerHTMLAttributes extends Pick<PerspectiveViewerOptions, "editable" | "plugin" | "selectable"> {
|
56 | aggregates?: string;
|
57 | "computed-columns"?: string;
|
58 | "row-pivots"?: string;
|
59 | "column-pivots"?: string;
|
60 | filters?: string;
|
61 | sort?: string;
|
62 | columns?: string;
|
63 | }
|
64 |
|
65 | interface ReactPerspectiveViewerHTMLAttributes<T> extends PerspectiveViewerHTMLAttributes, React.HTMLAttributes<T> {}
|
66 |
|
67 | type PerspectiveElement = {class?: string} & React.DetailedHTMLProps<ReactPerspectiveViewerHTMLAttributes<HTMLPerspectiveViewerElement>, HTMLPerspectiveViewerElement>;
|
68 |
|
69 | declare global {
|
70 | namespace JSX {
|
71 | interface IntrinsicElements {
|
72 | "perspective-viewer": PerspectiveElement;
|
73 | }
|
74 | }
|
75 |
|
76 | interface Document {
|
77 | createElement(tagName: "perspective-viewer", options?: ElementCreationOptions): HTMLPerspectiveViewerElement;
|
78 | }
|
79 | }
|