Skip to content

Commit

Permalink
PhosphorPanelWidget shim
Browse files Browse the repository at this point in the history
Signed-off-by: Itay Dafna <i.b.dafna@gmail.com>
  • Loading branch information
ibdafna committed Sep 11, 2022
1 parent ab38671 commit b836c99
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions js/datagrid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,21 @@ import { CellRenderer } from '@lumino/datagrid';

import { JSONExt } from '@lumino/coreutils';

import { MessageLoop, Message } from '@lumino/messaging';
import { Message, MessageLoop } from '@lumino/messaging';

import { Widget } from '@lumino/widgets';

import {
DOMWidgetModel,
DOMWidgetView,
JupyterLuminoPanelWidget,
ICallbacks,
ISerializers,
JupyterLuminoPanelWidget,
//@ts-ignore needed for ipywidgetx 7.x compatibility
JupyterPhosphorPanelWidget,
resolvePromisesDict,
unpack_models,
WidgetModel,
ICallbacks,
WidgetModel
} from '@jupyter-widgets/base';

import { ViewBasedJSONModel } from './core/viewbasedjsonmodel';
Expand Down Expand Up @@ -340,7 +342,8 @@ function unpack_data(

export class DataGridView extends DOMWidgetView {
_createElement(tagName: string) {
this.luminoWidget = new JupyterLuminoPanelWidget({ view: this });
const panelWidget = Private.getWidgetPanel();
this.luminoWidget = new panelWidget({ view: this });
this._initializeTheme();
return this.luminoWidget.node;
}
Expand Down Expand Up @@ -723,16 +726,15 @@ export class DataGridView extends DOMWidgetView {
}

export {
TextRendererModel,
TextRendererView,
BarRendererModel,
BarRendererView,
HyperlinkRendererModel,
HyperlinkRendererView,
HyperlinkRendererView, TextRendererModel,
TextRendererView
} from './cellrenderer';

export { VegaExprModel, VegaExprView } from './vegaexpr';


export namespace DataGridModel {
/**
* An options object for initializing the data model.
Expand All @@ -758,6 +760,16 @@ export namespace DataGridModel {
* The namespace for the module implementation details.
*/
namespace Private {
export function getLuminoWidget(ipywidget: DOMWidgetView): any {
return ipywidget.pWidget ?? ipywidget.luminoWidget;
}

export function getWidgetPanel(): any {
//@ts-ignore needed for ipywidget 7.x compatibility
return JupyterLuminoPanelWidget ?? JupyterPhosphorPanelWidget;
}


/**
* Creates a valid JSON Table Schema from the schema provided by pandas.
*
Expand Down

0 comments on commit b836c99

Please sign in to comment.