-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #872 from finos/fix-typings
Improve `@finos/perspective-viewer` typings
- Loading branch information
Showing
5 changed files
with
60 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,48 @@ | ||
import {Table, TableData, TableOptions, Schema, View, ViewConfig} from '@finos/perspective'; | ||
import React from "react"; | ||
import {Table, TableData, TableOptions, Schema} from "@finos/perspective"; | ||
|
||
declare module '@finos/perspective-viewer' { | ||
export interface PerspectiveViewer extends PerspectiveViewerOptions, HTMLElement { | ||
load(data: TableData | Table, options?: TableOptions): void; | ||
load(schema: Schema, options?: TableOptions): void; | ||
update(data: TableData): void; | ||
notifyResize(): void; | ||
delete(delete_table: boolean): Promise<void>; | ||
clear() : void; | ||
replace(data: TableData) : void; | ||
flush(): Promise<void>; | ||
toggleConfig(): void; | ||
save(): PerspectiveViewerOptions; | ||
reset(): void; | ||
restore(x: any): Promise<void>; | ||
restyleElement(): void; | ||
readonly table?: Table; | ||
} | ||
export interface HTMLPerspectiveViewerElement extends PerspectiveViewerOptions, HTMLElement { | ||
load(data: TableData | Table, options?: TableOptions): void; | ||
load(schema: Schema, options?: TableOptions): void; | ||
update(data: TableData): void; | ||
notifyResize(): void; | ||
delete(delete_table: boolean): Promise<void>; | ||
clear(): void; | ||
replace(data: TableData): void; | ||
flush(): Promise<void>; | ||
toggleConfig(): void; | ||
save(): PerspectiveViewerOptions; | ||
reset(): void; | ||
restore(x: any): Promise<void>; | ||
restyleElement(): void; | ||
readonly table?: Table; | ||
} | ||
|
||
export interface PerspectiveViewerOptions { | ||
aggregates?: {[column_name: string]: string}; | ||
editable?: boolean; | ||
plugin?: string; | ||
columns?: string[]; | ||
"computed-columns"?: {[column_name: string]: string}[]; | ||
"row-pivots"?: string[]; | ||
"column-pivots"?: string[]; | ||
filters?: Array<Array<string>>; | ||
sort?: string[][]; | ||
selectable?: boolean; | ||
} | ||
|
||
export interface PerspectiveViewerOptions extends Omit<ViewConfig, "row_pivots"|"column_pivots"|"filter" > { | ||
aggregates?: { [column_name:string]: string}; | ||
editable? : boolean; | ||
plugin? : string; | ||
columns? : string[]; | ||
"computed-columns"? : { [column_name:string]: string}[]; | ||
"row-pivots"? : string[]; | ||
"column-pivots"? : string[]; | ||
filters?: Array<Array<string>>; | ||
sort?: string[][]; | ||
selectable? : boolean; | ||
interface PerspectiveViewerHTMLAttributes<T> extends PerspectiveViewerOptions, React.HTMLAttributes<T> {} | ||
|
||
type PerspectiveElement = React.DetailedHTMLProps<PerspectiveViewerHTMLAttributes<HTMLPerspectiveViewerElement>, HTMLPerspectiveViewerElement>; | ||
|
||
declare global { | ||
namespace JSX { | ||
interface IntrinsicElements { | ||
"perspective-viewer": PerspectiveElement; | ||
} | ||
} | ||
|
||
|
||
interface Document { | ||
createElement(tagName: "perspective-viewer", options?: ElementCreationOptions): HTMLPerspectiveViewerElement; | ||
} | ||
} | ||
|
||
export default PerspectiveViewer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters