File tree Expand file tree Collapse file tree
dashboard-core-plugins/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { PluginType , type WidgetPlugin } from '@deephaven/plugin' ;
22import { dhTable } from '@deephaven/icons' ;
3+ import { Table } from '@deephaven/jsapi-types' ;
34import { GridWidgetPlugin } from './GridWidgetPlugin' ;
45import { GridPanelPlugin } from './GridPanelPlugin' ;
56
6- const GridPluginConfig : WidgetPlugin = {
7+ const GridPluginConfig : WidgetPlugin < Table > = {
78 name : 'IrisGridPanel' ,
89 title : 'Table' ,
910 type : PluginType . WIDGET_PLUGIN ,
Original file line number Diff line number Diff line change 99} from '@deephaven/iris-grid' ;
1010
1111export function GridWidgetPlugin (
12- props : WidgetComponentProps
12+ props : WidgetComponentProps < Table >
1313) : JSX . Element | null {
1414 const dh = useApi ( ) ;
1515 const [ model , setModel ] = useState < IrisGridModel > ( ) ;
@@ -19,7 +19,7 @@ export function GridWidgetPlugin(
1919 useEffect ( ( ) => {
2020 let cancelled = false ;
2121 async function init ( ) {
22- const table = ( await fetch ( ) ) as unknown as Table ;
22+ const table = await fetch ( ) ;
2323 const newModel = await IrisGridModelFactory . makeModel ( dh , table ) ;
2424 if ( ! cancelled ) {
2525 setModel ( newModel ) ;
Original file line number Diff line number Diff line change @@ -105,8 +105,8 @@ export function isDashboardPlugin(
105105 return 'type' in plugin && plugin . type === PluginType . DASHBOARD_PLUGIN ;
106106}
107107
108- export interface WidgetComponentProps {
109- fetch : ( ) => Promise < unknown > ;
108+ export interface WidgetComponentProps < T = unknown > {
109+ fetch : ( ) => Promise < T > ;
110110}
111111
112112export interface WidgetPanelProps extends WidgetComponentProps {
@@ -120,7 +120,7 @@ export interface WidgetPanelProps extends WidgetComponentProps {
120120 glEventHub : EventEmitter ;
121121}
122122
123- export interface WidgetPlugin extends Plugin {
123+ export interface WidgetPlugin < T = unknown > extends Plugin {
124124 type : typeof PluginType . WIDGET_PLUGIN ;
125125 /**
126126 * The component that can render the widget types the plugin supports.
@@ -129,7 +129,7 @@ export interface WidgetPlugin extends Plugin {
129129 * then `panelComponent` will be used instead.
130130 * The component will be wrapped in a default panel if `panelComponent` is not provided.
131131 */
132- component : React . ComponentType < WidgetComponentProps > ;
132+ component : React . ComponentType < WidgetComponentProps < T > > ;
133133
134134 /**
135135 * The server widget types that this plugin will handle.
You can’t perform that action at this time.
0 commit comments