-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow for perspective in ipywidgets layouts #702
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good in principle. Added some comments that might make it a little cleaner.
|
||
_setElement(el: HTMLElement) { | ||
if (this.el || el !== this.pWidget.node) { | ||
// Accordions don't allow setting the element beyond the initial creation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably shouldn't say "Accordions" ;)
@@ -119,98 +131,98 @@ class PerspectiveView extends DOMWidgetView { | |||
this.model.on('msg:custom', this._update, this); | |||
|
|||
this.displayed.then(()=> { | |||
this.psp._render(); | |||
(this.pWidget as PerspectiveWidget)._render(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be cleaner to override the declaration of pWidget
for this class:
pWidget: PerspectiveWidget;
@@ -44,6 +44,7 @@ export type PerspectiveWidgetOptions = { | |||
key?: string; | |||
wrap?: boolean; | |||
delete_?: boolean; | |||
view?: any; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that it is also possible to extend
PerspectiveWidget
adding the view
options similar to how JupyterPhosphorAccordionWidget
does this in @jupyter-widgets/controls
.
fixes #694 without breaking in normal view
top: perspective in
ipywidgets.HBox
bottom: normal