1- import { getIcons , getIcon } from "./dockview-icon.js"
1+ import { getIcons , getIcon } from "./dockview-icon.js"
22import { deletePanel , findContentFromPanels , moveAlwaysRenderPanel } from "./dockview-panel.js"
33import { saveConfig } from "./dockview-config.js"
44import { observeGroup } from "./dockview-utils.js"
@@ -41,18 +41,6 @@ const addPanelWidthGroupId = (dockview, panel, index) => {
4141 let { rect = { } , packup, floatType, drawer, direction = 'left' } = panel . params || { }
4242 if ( ! group ) {
4343 group = dockview . createGroup ( { id : panel . groupId } )
44- // const floatingGroupPosition = isMaximized ? {
45- // x: 0, y: 0,
46- // width: dockview.width,
47- // height: dockview.height
48- // } : {
49- // x: currentPosition?.left || 0,
50- // y: currentPosition?.top || 0,
51- // width: currentPosition?.width,
52- // height: currentPosition?.height
53- // }
54- // dockview.addFloatingGroup(group, floatingGroupPosition, { skipRemoveGroup: true })
55- // createGroupActions(group);
5644 const width = dockview . width > 500 ? 500 : ( dockview . width - 10 )
5745 const height = dockview . height > 460 ? 460 : ( dockview . height - 10 )
5846 const left = ( dockview . width - width ) / 2
@@ -74,23 +62,16 @@ const addPanelWidthGroupId = (dockview, panel, index) => {
7462 if ( floatType == 'drawer' ) {
7563 setTimeout ( ( ) => createDrawerHandle ( group , direction == 'right' ) , 0 ) ;
7664 }
77- // const floatingGroup = createFloatingGroup(group, floatingGroupRect)
78- const autoHideBtn = group . header . rightActionsContainer . querySelector ( '.bb-dockview-control-icon-autohide' )
79- if ( autoHideBtn ) {
80- // autoHideBtn.style.display = 'none'
81- }
82-
83- // saveConfig(dockview)
8465 }
8566 else {
8667 if ( group . api . location . type === 'grid' ) {
8768 let isVisible = dockview . isVisible ( group )
8869 if ( isVisible === false ) {
8970 dockview . setVisible ( group , true )
90- // isMaximized && group.api.maximize();
9171 }
9272 }
9373 }
74+
9475 dockview . addPanel ( {
9576 id : panel . id ,
9677 title : panel . title ,
@@ -99,11 +80,10 @@ const addPanelWidthGroupId = (dockview, panel, index) => {
9980 position : { referenceGroup : group , index : index || 0 } ,
10081 params : { ...panel . params , rect, packup, visible : true }
10182 } )
102- dockview . isUpdating !== true && dockview . _panelVisibleChanged ?. fire ( { key : panel . params . key , status : true } ) ;
10383}
10484
10585const addPanelWidthCreatGroup = ( dockview , panel , panels ) => {
106- let { position = { } , currentPosition , packupHeight, isPackup, isMaximized } = panel . params || { }
86+ let { position = { } , packupHeight, isPackup, isMaximized } = panel . params || { }
10787 let brothers = panels . filter ( p => p . params . parentId == panel . params . parentId && p . id != panel . id )
10888 let group , direction
10989 if ( brothers . length > 0 && brothers [ 0 ] . params . parentType == 'group' ) {
@@ -138,7 +118,6 @@ const addPanelWidthCreatGroup = (dockview, panel, panels) => {
138118 }
139119 if ( direction ) option . position . direction = direction
140120 dockview . addPanel ( option ) ;
141- dockview . isUpdating !== true && dockview . _panelVisibleChanged ?. fire ( { key : panel . params . key , status : true } ) ;
142121}
143122
144123const getOrientation = function ( child , group ) {
@@ -178,37 +157,6 @@ const createGroupActions = (group, groupType) => {
178157 } , 0 )
179158 addActionEvent ( group , actionContainer ) ;
180159}
181- const observeDisplayChange = ( icon , group ) => {
182- const dockview = group . api . accessor
183- const element = icon . querySelector ( '.dropdown-menu' )
184- const mutationObserver = new MutationObserver ( ( mutations ) => {
185- mutations . forEach ( mutation => {
186- if ( mutation . attributeName == 'class' ) {
187- if ( mutation . target . classList . contains ( 'show' ) ) {
188- const currentPanelEle = group . activePanel . view . content . element . parentElement
189- const childEle = currentPanelEle . children [ 0 ]
190- group . element . querySelector ( '&>.dv-content-container' ) . append ( childEle )
191- currentPanelEle . style . zIndex = - 1
192- childEle . wrapperEle = currentPanelEle
193- }
194- else {
195- const panelEleList = [ ...group . element . querySelector ( '&>.dv-content-container' ) . children ] . map ( item => {
196- const wrapperEle = item . wrapperEle
197- delete item . wrapperEle
198- wrapperEle . append ( item )
199- return wrapperEle
200- } )
201- group . element . parentElement . parentElement . append ( ...panelEleList )
202- }
203- }
204- } )
205- } ) ;
206- group . mutationObserver = mutationObserver
207- mutationObserver . observe ( element , {
208- attributes : true ,
209- attributeFilter : [ "class" ] ,
210- } ) ;
211- }
212160
213161const disposeGroup = group => {
214162 const { observer } = group . api . accessor . params ;
0 commit comments