@@ -92,6 +92,26 @@ export function lock(id, lock) {
9292 lockDock ( dock )
9393}
9494
95+ export function reset ( id , option , invoke ) {
96+ const dock = Data . get ( id )
97+ if ( dock ) {
98+ removeConfig ( option ) ;
99+
100+ const el = dock . el ;
101+ const components = getAllContentItems ( option . content ) ;
102+ components . forEach ( i => {
103+ const item = document . getElementById ( i . id ) ;
104+ if ( item ) {
105+ item . classList . add ( "d-none" ) ;
106+ el . append ( item ) ;
107+ }
108+ } )
109+ dispose ( id )
110+
111+ init ( id , option , invoke )
112+ }
113+ }
114+
95115export function dispose ( id ) {
96116 const dock = Data . get ( id )
97117 Data . remove ( id )
@@ -396,9 +416,13 @@ const removeContent = (content, item) => {
396416}
397417
398418const hackGoldenLayout = dock => {
419+ if ( goldenLayout . bb_docks === void 0 ) {
420+ goldenLayout . bb_docks = [ ] ;
421+ }
422+ goldenLayout . bb_docks . push ( dock ) ;
423+
399424 if ( ! goldenLayout . isHack ) {
400425 goldenLayout . isHack = true
401- const eventsData = dock . eventsData
402426
403427 // hack Tab
404428 goldenLayout . Tab . prototype . onCloseClick = function ( ) {
@@ -418,8 +442,19 @@ const hackGoldenLayout = dock => {
418442 }
419443 }
420444
445+ // hack RowOrColumn
446+ const originSplitterDragStop = goldenLayout . RowOrColumn . prototype . onSplitterDragStop
447+ goldenLayout . RowOrColumn . prototype . onSplitterDragStop = function ( splitter ) {
448+ originSplitterDragStop . call ( this , splitter )
449+ this . layoutManager . emit ( 'splitterDragStop' )
450+ }
451+
421452 // hack Header
422453 goldenLayout . Header . prototype . handleButtonPopoutEvent = function ( ) {
454+ // find own dock
455+ const dock = goldenLayout . bb_docks . find ( i => i . layout === this . layoutManager ) ;
456+ const eventsData = dock . eventsData
457+
423458 const stack = this . parent
424459 const lock = eventsData . has ( stack )
425460 if ( lock ) {
@@ -438,6 +473,10 @@ const hackGoldenLayout = dock => {
438473 originprocessTabDropdownActiveChanged . call ( this )
439474
440475 this . _closeButton . onClick = function ( ev ) {
476+ // find own dock
477+ const dock = goldenLayout . bb_docks . find ( i => i . layout === this . layoutManager ) ;
478+ const eventsData = dock . eventsData
479+
441480 const tabs = this . _header . tabs . map ( tab => {
442481 return { element : tab . componentItem . element , title : tab . componentItem . title }
443482 } )
@@ -453,12 +492,5 @@ const hackGoldenLayout = dock => {
453492 }
454493 }
455494 }
456-
457- // hack RowOrColumn
458- const originSplitterDragStop = goldenLayout . RowOrColumn . prototype . onSplitterDragStop
459- goldenLayout . RowOrColumn . prototype . onSplitterDragStop = function ( splitter ) {
460- originSplitterDragStop . call ( this , splitter )
461- this . layoutManager . emit ( 'splitterDragStop' )
462- }
463495 }
464496}
0 commit comments