当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript widgets.Panel类代码示例

本文整理汇总了TypeScript中@phosphor/widgets.Panel的典型用法代码示例。如果您正苦于以下问题:TypeScript Panel类的具体用法?TypeScript Panel怎么用?TypeScript Panel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Panel类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: constructor

  /**
   * Create a dialog panel instance.
   *
   * @param options - The dialog setup options.
   */
  constructor(options: Dialog.IOptions={}) {
    super();
    this.addClass('jp-Dialog');
    options = Private.handleOptions(options);
    let renderer = options.renderer;

    this._host = options.host;
    this._defaultButton = options.defaultButton;
    this._buttons = options.buttons;
    this._buttonNodes = toArray(map(this._buttons, button => {
      return renderer.createButtonNode(button);
    }));
    this._primary = (
      options.primaryElement || this._buttonNodes[this._defaultButton]
    );

    let layout = this.layout = new PanelLayout();
    let content = new Panel();
    content.addClass('jp-Dialog-content');
    layout.addWidget(content);

    let header = renderer.createHeader(options.title);
    let body = renderer.createBody(options.body);
    let footer = renderer.createFooter(this._buttonNodes);
    content.addWidget(header);
    content.addWidget(body);
    content.addWidget(footer);
  }
开发者ID:charnpreetsingh185,项目名称:jupyterlab,代码行数:33,代码来源:dialog.ts

示例2: showDiff

/**
 * Show the diff as represented by the base notebook and a list of diff entries
 */
function showDiff(data: {base: nbformat.INotebookContent, diff: IDiffEntry[]}): Promise<void> {


  let rendermime = new RenderMimeRegistry({
    initialFactories: rendererFactories,
    sanitizer: defaultSanitizer,
  });

  let nbdModel = new NotebookDiffModel(data.base, data.diff);
  let nbdWidget = new NotebookDiffWidget(nbdModel, rendermime);

  let root = document.getElementById('nbdime-root');
  if (!root) {
    throw new Error('Missing root element "nbidme-root"');
  }
  root.innerHTML = '';
  let panel = new Panel();
  panel.id = 'main';
  Widget.attach(panel, root);
  panel.addWidget(nbdWidget);
  let work = nbdWidget.init();
  work.then(() => {
    window.onresize = () => { panel.update(); };
  });
  diffWidget = nbdWidget;
  return work;
}
开发者ID:vidartf,项目名称:nbdime,代码行数:30,代码来源:diff.ts

示例3: it

 it('should insert a widget at the specified index', () => {
   let panel = new Panel();
   let widget = new Widget();
   panel.addWidget(new Widget());
   panel.insertWidget(0, widget);
   expect(panel.widgets[0]).to.equal(widget);
 });
开发者ID:afshin,项目名称:phosphor,代码行数:7,代码来源:panel.spec.ts

示例4: constructor

  constructor(inner: Widget, headerTitle?: string, collapsed?: boolean) {
    super();
    this.addClass(COLLAPSIBLE_CLASS);
    this.inner = inner;
    let constructor = this.constructor as typeof CollapsiblePanel;
    let header = constructor.createHeader(headerTitle);
    this.header = header;
    this.button = header.node.getElementsByClassName(
      COLLAPSIBLE_HEADER_ICON)[0] as HTMLElement;
    header.node.onclick = this.toggleCollapsed.bind(this);
    this.addWidget(header);
    this.container = new Panel();
    this.container.addClass(COLLAPSIBLE_CONTAINER);
    this.slider = new Panel();
    this.slider.addClass(COLLAPSIBLE_SLIDER);
    this.slider.addWidget(inner);
    this.container.addWidget(this.slider);
    this.addWidget(this.container);

    this.slider.addClass(
      collapsed === true ?
      COLLAPSIBLE_CLOSED :
      COLLAPSIBLE_OPEN);
    this.button.classList.add(
      collapsed === true ?
      COLLAPSIBLE_HEADER_ICON_CLOSED :
      COLLAPSIBLE_HEADER_ICON_OPEN);
  }
开发者ID:vidartf,项目名称:nbdime,代码行数:28,代码来源:collapsiblepanel.ts

示例5: CellDiffWidget

 return new Promise<void>(resolve => {
   if (chunk.length === 1 && !(chunk[0].added || chunk[0].deleted)) {
     this.addWidget(new CellDiffWidget(
       chunk[0], rendermime, model.mimetype));
   } else {
     let chunkPanel = new Panel();
     chunkPanel.addClass(CHUNK_PANEL_CLASS);
     let addedPanel = new Panel();
     addedPanel.addClass(ADDED_CHUNK_PANEL_CLASS);
     let removedPanel = new Panel();
     removedPanel.addClass(REMOVED_CHUNK_PANEL_CLASS);
     for (let cell of chunk) {
       let target = cell.deleted ? removedPanel : addedPanel;
       target.addWidget(new CellDiffWidget(cell, rendermime, model.mimetype));
     }
     chunkPanel.addWidget(addedPanel);
     chunkPanel.addWidget(removedPanel);
     this.addWidget(chunkPanel);
   }
   // This limits us to drawing 60 cells per second, which shouldn't
   // be a problem...
   requestAnimationFrame(() => {
     resolve();
   });
 });
开发者ID:vidartf,项目名称:nbdime,代码行数:25,代码来源:notebook.ts

示例6: createHeader

  static createHeader(headerTitle?: string): Panel {
    let header = new Panel();
    header.addClass(COLLAPSIBLE_HEADER);
    if (headerTitle) {
      // let title = document.createElement('span');
      header.node.innerText = headerTitle;
      // header.appendChild(title);
    }
    let button = document.createElement('button');
    button.className = COLLAPSIBLE_HEADER_ICON;
    header.node.appendChild(button);

    return header;
  }
开发者ID:vidartf,项目名称:nbdime,代码行数:14,代码来源:collapsiblepanel.ts

示例7: dispose

 dispose() {
   super.dispose();
   this.content.dispose();
   this.labelContent.dispose();
   this.label.dispose();
   this.previewContainer && this.previewContainer.dispose();
 }
开发者ID:twosigma,项目名称:beaker-notebook,代码行数:7,代码来源:Foldout.ts

示例8: render

 render() {
     const manager = this.model.widget_manager
     const rendermime = manager.renderMime;
     this._outputView = new OutputArea({
         rendermime: rendermime,
         model: this.model.outputs
     })
     this.pWidget.insertWidget(0, this._outputView);
     this.pWidget.addClass('jupyter-widgets');
     this.pWidget.addClass('widget-output');
     this.update();
 }
开发者ID:SylvainCorlay,项目名称:ipywidgets,代码行数:12,代码来源:output.ts


注:本文中的@phosphor/widgets.Panel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。