@@ -9,7 +9,6 @@ import { Message, MessageLoop } from '@lumino/messaging';
99import  {  PromiseDelegate  }  from  '@lumino/coreutils' ; 
1010import  {  ArrayExt  }  from  '@lumino/algorithm' ; 
1111
12- 
1312/** 
1413 * The class name for confirmation box 
1514 */ 
@@ -23,40 +22,39 @@ const CONFIRM_CLASS = 'jp-confirm';
2322 * @returns  A promise that resolves with whether the dialog was accepted. 
2423 */ 
2524export  function  showMessage < T > ( 
26-    options : Partial < ConfirmMessage . IOptions < T > >  =  { } 
27-   ) : Promise < void >  { 
28-    console . log ( options ) ; 
29-    const  confirmMessage  =  new  ConfirmMessage ( options ) ; 
30-    return  confirmMessage . launch ( ) ; 
31-   } 
25+  options : Partial < ConfirmMessage . IOptions < T > >  =  { } 
26+ ) : Promise < void >  { 
27+  console . log ( options ) ; 
28+  const  confirmMessage  =  new  ConfirmMessage ( options ) ; 
29+  return  confirmMessage . launch ( ) ; 
30+ } 
3231
3332/** 
3433 * A widget used to show confirmation message. 
3534 */ 
3635export  class  ConfirmMessage < T >  extends  Widget  { 
37- 
38-  constructor ( options : Partial < ConfirmMessage . IOptions < T > >  =  { } ) { 
39-  super ( ) ; 
40-  this . addClass ( CONFIRM_CLASS ) ; 
41-  const  renderer  =  ConfirmMessage . defaultRenderer ;  
42- 
43-  this . _host  =  options . host  ||  document . body ; 
44-  const  layout  =  ( this . layout  =  new  PanelLayout ( ) ) ; 
45-  const  content  =  new  Panel ( ) ; 
46-  content . addClass ( 'jp-Message-content' ) ; 
47-  layout . addWidget ( content ) ; 
48- 
49-  const  body  =  renderer . createBody ( options . body  ||  '' ) ; 
50-  // body.addClass('jp-Message-body'); 
51-  // const icon = renderer.createIcon(); 
52-  // content.addWidget(icon); 
53-  content . addWidget ( body ) ; 
54- 
55-  console . log ( content ) ; 
56- 
57-  void  ConfirmMessage . tracker . add ( this ) ; 
58-  } 
59-  /** 
36+  constructor ( options : Partial < ConfirmMessage . IOptions < T > >  =  { } )  { 
37+  super ( ) ; 
38+  this . addClass ( CONFIRM_CLASS ) ; 
39+  const  renderer  =  ConfirmMessage . defaultRenderer ; 
40+ 
41+  this . _host  =  options . host  ||  document . body ; 
42+  const  layout  =  ( this . layout  =  new  PanelLayout ( ) ) ; 
43+  const  content  =  new  Panel ( ) ; 
44+  content . addClass ( 'jp-Message-content' ) ; 
45+  layout . addWidget ( content ) ; 
46+ 
47+  const  body  =  renderer . createBody ( options . body  ||  '' ) ; 
48+  // body.addClass('jp-Message-body'); 
49+  // const icon = renderer.createIcon(); 
50+  // content.addWidget(icon); 
51+  content . addWidget ( body ) ; 
52+ 
53+  console . log ( content ) ; 
54+ 
55+  void  ConfirmMessage . tracker . add ( this ) ; 
56+  } 
57+  /** 
6058 * Launch the dialog as a modal window. 
6159 * 
6260 * @returns  a promise that resolves with the result of the dialog. 
@@ -102,7 +100,7 @@ export class ConfirmMessage<T> extends Widget {
102100 } 
103101 } 
104102
105-    /** 
103+  /** 
106104 * Handle the `'click'` event for a dialog button. 
107105 * 
108106 * @param  event - The DOM event sent to the widget 
@@ -240,11 +238,11 @@ export class ConfirmMessage<T> extends Widget {
240238} 
241239
242240export  namespace  ConfirmMessage  { 
243-    /** 
241+  /** 
244242 * The body input types. 
245243 */ 
246-    export  type  Body < T >  =  IBodyWidget < T >  |  React . ReactElement < any >  |  string ; 
247- /** 
244+  export  type  Body < T >  =  IBodyWidget < T >  |  React . ReactElement < any >  |  string ; 
245+   /** 
248246 * The options used to create a dialog. 
249247 */ 
250248 /** 
@@ -290,7 +288,7 @@ export namespace ConfirmMessage {
290288 } 
291289
292290 export  interface  IRenderer  { 
293-    /** 
291+  /** 
294292 * Create the body of the dialog. 
295293 * 
296294 * @param  value - The input value for the body. 
@@ -310,24 +308,24 @@ export namespace ConfirmMessage {
310308 * @returns  A widget for the body. 
311309 */ 
312310 createBody ( value : Body < any > ) : Widget  { 
313-    let  body : Widget ; 
314-    if  ( typeof  value  ===  'string' )  { 
315-    body  =  new  Widget ( {  node : document . createElement ( 'span' )  } ) ; 
316-    body . node . textContent  =  value ; 
317-    }  else  if  ( value  instanceof  Widget )  { 
318-    body  =  value ; 
319-    }  else  { 
320-    body  =  ReactWidget . create ( value ) ; 
321-    // Immediately update the body even though it has not yet attached in 
322-    // order to trigger a render of the DOM nodes from the React element. 
323-    MessageLoop . sendMessage ( body ,  Widget . Msg . UpdateRequest ) ; 
324-    } 
325-    // const iconNode = new Widget({ node: document.createElement('div') }); 
326-    // iconNode.title.icon = checkIcon; 
327-    // body. 
328-    body . addClass ( 'jp-Message-body' ) ; 
329-    // Styling.styleNode(body.node); 
330-    return  body ; 
311+  let  body : Widget ; 
312+  if  ( typeof  value  ===  'string' )  { 
313+  body  =  new  Widget ( {  node : document . createElement ( 'span' )  } ) ; 
314+  body . node . textContent  =  value ; 
315+  }  else  if  ( value  instanceof  Widget )  { 
316+  body  =  value ; 
317+  }  else  { 
318+  body  =  ReactWidget . create ( value ) ; 
319+  // Immediately update the body even though it has not yet attached in 
320+  // order to trigger a render of the DOM nodes from the React element. 
321+  MessageLoop . sendMessage ( body ,  Widget . Msg . UpdateRequest ) ; 
322+  } 
323+  // const iconNode = new Widget({ node: document.createElement('div') }); 
324+  // iconNode.title.icon = checkIcon; 
325+  // body. 
326+  body . addClass ( 'jp-Message-body' ) ; 
327+  // Styling.styleNode(body.node); 
328+  return  body ; 
331329 } 
332330
333331 // createIcon(): Widget { 
@@ -344,7 +342,7 @@ export namespace ConfirmMessage {
344342 // return iconWidget 
345343 // } 
346344 } 
347-    /** 
345+  /** 
348346 * The default renderer instance. 
349347 */ 
350348 export  const  defaultRenderer  =  new  Renderer ( ) ; 
@@ -353,7 +351,7 @@ export namespace ConfirmMessage {
353351 * The dialog widget tracker. 
354352 */ 
355353 export  const  tracker  =  new  WidgetTracker < ConfirmMessage < any > > ( { 
356-    namespace : '@jupyterlab/code_snippet:ConfirmWidget' 
354+  namespace : '@jupyterlab/code_snippet:ConfirmWidget' 
357355 } ) ; 
358356} 
359357
@@ -365,4 +363,4 @@ namespace Private {
365363 * The queue for launching dialogs. 
366364 */ 
367365 export  const  launchQueue : Promise < void > [ ]  =  [ ] ; 
368- } 
366+ } 
0 commit comments