dockview-core 1.8.3 → 1.8.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (357) hide show
  1. package/README.md +51 -51
  2. package/dist/cjs/api/component.api.d.ts +455 -152
  3. package/dist/cjs/api/component.api.d.ts.map +1 -1
  4. package/dist/cjs/api/component.api.js +895 -592
  5. package/dist/cjs/api/component.api.js.map +1 -1
  6. package/dist/cjs/api/dockviewGroupPanelApi.d.ts +29 -29
  7. package/dist/cjs/api/dockviewGroupPanelApi.js +53 -53
  8. package/dist/cjs/api/dockviewPanelApi.d.ts +47 -47
  9. package/dist/cjs/api/dockviewPanelApi.js +88 -88
  10. package/dist/cjs/api/gridviewPanelApi.d.ts +37 -37
  11. package/dist/cjs/api/gridviewPanelApi.js +47 -47
  12. package/dist/cjs/api/panelApi.d.ts +88 -88
  13. package/dist/cjs/api/panelApi.js +135 -135
  14. package/dist/cjs/api/paneviewPanelApi.d.ts +26 -26
  15. package/dist/cjs/api/paneviewPanelApi.js +57 -57
  16. package/dist/cjs/api/splitviewPanelApi.d.ts +32 -32
  17. package/dist/cjs/api/splitviewPanelApi.js +47 -47
  18. package/dist/cjs/array.d.ts +13 -13
  19. package/dist/cjs/array.js +67 -67
  20. package/dist/cjs/dnd/abstractDragHandler.d.ts +12 -12
  21. package/dist/cjs/dnd/abstractDragHandler.js +141 -141
  22. package/dist/cjs/dnd/dataTransfer.d.ts +30 -31
  23. package/dist/cjs/dnd/dataTransfer.d.ts.map +1 -1
  24. package/dist/cjs/dnd/dataTransfer.js +99 -100
  25. package/dist/cjs/dnd/dataTransfer.js.map +1 -1
  26. package/dist/cjs/dnd/dnd.d.ts +27 -27
  27. package/dist/cjs/dnd/dnd.js +59 -59
  28. package/dist/cjs/dnd/droptarget.d.ts +53 -53
  29. package/dist/cjs/dnd/droptarget.js +304 -304
  30. package/dist/cjs/dnd/droptarget.js.map +1 -1
  31. package/dist/cjs/dnd/ghost.d.ts +1 -1
  32. package/dist/cjs/dnd/ghost.js +15 -15
  33. package/dist/cjs/dnd/groupDragHandler.d.ts +12 -12
  34. package/dist/cjs/dnd/groupDragHandler.js +77 -77
  35. package/dist/cjs/dnd/overlay.d.ts +43 -43
  36. package/dist/cjs/dnd/overlay.d.ts.map +1 -1
  37. package/dist/cjs/dnd/overlay.js +412 -412
  38. package/dist/cjs/dnd/overlay.js.map +1 -1
  39. package/dist/cjs/dockview/components/panel/content.d.ts +30 -30
  40. package/dist/cjs/dockview/components/panel/content.js +100 -100
  41. package/dist/cjs/dockview/components/tab/defaultTab.d.ts +21 -21
  42. package/dist/cjs/dockview/components/tab/defaultTab.js +105 -105
  43. package/dist/cjs/dockview/components/tab/tab.d.ts +34 -34
  44. package/dist/cjs/dockview/components/tab/tab.js +120 -120
  45. package/dist/cjs/dockview/components/titlebar/tabsContainer.d.ts +81 -77
  46. package/dist/cjs/dockview/components/titlebar/tabsContainer.d.ts.map +1 -1
  47. package/dist/cjs/dockview/components/titlebar/tabsContainer.js +325 -309
  48. package/dist/cjs/dockview/components/titlebar/tabsContainer.js.map +1 -1
  49. package/dist/cjs/dockview/components/titlebar/voidContainer.d.ts +17 -17
  50. package/dist/cjs/dockview/components/titlebar/voidContainer.js +77 -77
  51. package/dist/cjs/dockview/components/watermark/watermark.d.ts +18 -18
  52. package/dist/cjs/dockview/components/watermark/watermark.js +87 -87
  53. package/dist/cjs/dockview/deserializer.d.ts +12 -12
  54. package/dist/cjs/dockview/deserializer.js +33 -33
  55. package/dist/cjs/dockview/deserializer.js.map +1 -1
  56. package/dist/cjs/dockview/dockviewComponent.d.ts +159 -159
  57. package/dist/cjs/dockview/dockviewComponent.d.ts.map +1 -1
  58. package/dist/cjs/dockview/dockviewComponent.js +1170 -1002
  59. package/dist/cjs/dockview/dockviewComponent.js.map +1 -1
  60. package/dist/cjs/dockview/dockviewFloatingGroupPanel.d.ts +23 -23
  61. package/dist/cjs/dockview/dockviewFloatingGroupPanel.js +34 -34
  62. package/dist/cjs/dockview/dockviewGroupPanel.d.ts +30 -30
  63. package/dist/cjs/dockview/dockviewGroupPanel.js +97 -97
  64. package/dist/cjs/dockview/dockviewGroupPanelModel.d.ts +185 -184
  65. package/dist/cjs/dockview/dockviewGroupPanelModel.d.ts.map +1 -1
  66. package/dist/cjs/dockview/dockviewGroupPanelModel.js +632 -621
  67. package/dist/cjs/dockview/dockviewGroupPanelModel.js.map +1 -1
  68. package/dist/cjs/dockview/dockviewPanel.d.ts +41 -41
  69. package/dist/cjs/dockview/dockviewPanel.js +172 -171
  70. package/dist/cjs/dockview/dockviewPanel.js.map +1 -1
  71. package/dist/cjs/dockview/dockviewPanelModel.d.ts +35 -35
  72. package/dist/cjs/dockview/dockviewPanelModel.js +98 -98
  73. package/dist/cjs/dockview/dockviewPanelModel.js.map +1 -1
  74. package/dist/cjs/dockview/options.d.ts +133 -135
  75. package/dist/cjs/dockview/options.d.ts.map +1 -1
  76. package/dist/cjs/dockview/options.js +31 -31
  77. package/dist/cjs/dockview/options.js.map +1 -1
  78. package/dist/cjs/dockview/types.d.ts +63 -63
  79. package/dist/cjs/dockview/types.js +10 -10
  80. package/dist/cjs/dockview/types.js.map +1 -1
  81. package/dist/cjs/dom.d.ts +16 -16
  82. package/dist/cjs/dom.js +197 -197
  83. package/dist/cjs/events.d.ts +47 -47
  84. package/dist/cjs/events.js +216 -216
  85. package/dist/cjs/events.js.map +1 -1
  86. package/dist/cjs/gridview/baseComponentGridview.d.ts +88 -87
  87. package/dist/cjs/gridview/baseComponentGridview.d.ts.map +1 -1
  88. package/dist/cjs/gridview/baseComponentGridview.js +270 -270
  89. package/dist/cjs/gridview/baseComponentGridview.js.map +1 -1
  90. package/dist/cjs/gridview/basePanelView.d.ts +40 -40
  91. package/dist/cjs/gridview/basePanelView.js +156 -156
  92. package/dist/cjs/gridview/branchNode.d.ts +49 -49
  93. package/dist/cjs/gridview/branchNode.d.ts.map +1 -1
  94. package/dist/cjs/gridview/branchNode.js +343 -342
  95. package/dist/cjs/gridview/branchNode.js.map +1 -1
  96. package/dist/cjs/gridview/gridview.d.ts +133 -133
  97. package/dist/cjs/gridview/gridview.d.ts.map +1 -1
  98. package/dist/cjs/gridview/gridview.js +547 -539
  99. package/dist/cjs/gridview/gridview.js.map +1 -1
  100. package/dist/cjs/gridview/gridviewComponent.d.ts +80 -80
  101. package/dist/cjs/gridview/gridviewComponent.d.ts.map +1 -1
  102. package/dist/cjs/gridview/gridviewComponent.js +362 -328
  103. package/dist/cjs/gridview/gridviewComponent.js.map +1 -1
  104. package/dist/cjs/gridview/gridviewPanel.d.ts +65 -65
  105. package/dist/cjs/gridview/gridviewPanel.js +214 -214
  106. package/dist/cjs/gridview/leafNode.d.ts +34 -34
  107. package/dist/cjs/gridview/leafNode.js +170 -170
  108. package/dist/cjs/gridview/leafNode.js.map +1 -1
  109. package/dist/cjs/gridview/options.d.ts +17 -18
  110. package/dist/cjs/gridview/options.d.ts.map +1 -1
  111. package/dist/cjs/gridview/options.js +2 -2
  112. package/dist/cjs/gridview/types.d.ts +3 -3
  113. package/dist/cjs/gridview/types.js +2 -2
  114. package/dist/cjs/index.d.ts +42 -41
  115. package/dist/cjs/index.d.ts.map +1 -1
  116. package/dist/cjs/index.js +61 -61
  117. package/dist/cjs/index.js.map +1 -1
  118. package/dist/cjs/lifecycle.d.ts +23 -23
  119. package/dist/cjs/lifecycle.js +65 -65
  120. package/dist/cjs/lifecycle.js.map +1 -1
  121. package/dist/cjs/math.d.ts +5 -5
  122. package/dist/cjs/math.js +34 -34
  123. package/dist/cjs/panel/componentFactory.d.ts +11 -10
  124. package/dist/cjs/panel/componentFactory.d.ts.map +1 -1
  125. package/dist/cjs/panel/componentFactory.js +30 -30
  126. package/dist/cjs/panel/componentFactory.js.map +1 -1
  127. package/dist/cjs/panel/types.d.ts +33 -33
  128. package/dist/cjs/panel/types.js +2 -2
  129. package/dist/cjs/paneview/defaultPaneviewHeader.d.ts +21 -21
  130. package/dist/cjs/paneview/defaultPaneviewHeader.js +90 -90
  131. package/dist/cjs/paneview/draggablePaneviewPanel.d.ts +21 -21
  132. package/dist/cjs/paneview/draggablePaneviewPanel.js +131 -131
  133. package/dist/cjs/paneview/options.d.ts +25 -28
  134. package/dist/cjs/paneview/options.d.ts.map +1 -1
  135. package/dist/cjs/paneview/options.js +2 -2
  136. package/dist/cjs/paneview/paneview.d.ts +40 -40
  137. package/dist/cjs/paneview/paneview.d.ts.map +1 -1
  138. package/dist/cjs/paneview/paneview.js +200 -201
  139. package/dist/cjs/paneview/paneview.js.map +1 -1
  140. package/dist/cjs/paneview/paneviewComponent.d.ts +128 -128
  141. package/dist/cjs/paneview/paneviewComponent.js +400 -397
  142. package/dist/cjs/paneview/paneviewComponent.js.map +1 -1
  143. package/dist/cjs/paneview/paneviewPanel.d.ts +92 -92
  144. package/dist/cjs/paneview/paneviewPanel.d.ts.map +1 -1
  145. package/dist/cjs/paneview/paneviewPanel.js +275 -275
  146. package/dist/cjs/resizable.d.ts +10 -7
  147. package/dist/cjs/resizable.d.ts.map +1 -1
  148. package/dist/cjs/resizable.js +79 -56
  149. package/dist/cjs/resizable.js.map +1 -1
  150. package/dist/cjs/splitview/options.d.ts +26 -27
  151. package/dist/cjs/splitview/options.d.ts.map +1 -1
  152. package/dist/cjs/splitview/options.js +2 -2
  153. package/dist/cjs/splitview/splitview.d.ts +128 -128
  154. package/dist/cjs/splitview/splitview.d.ts.map +1 -1
  155. package/dist/cjs/splitview/splitview.js +936 -926
  156. package/dist/cjs/splitview/splitview.js.map +1 -1
  157. package/dist/cjs/splitview/splitviewComponent.d.ts +101 -101
  158. package/dist/cjs/splitview/splitviewComponent.js +395 -392
  159. package/dist/cjs/splitview/splitviewComponent.js.map +1 -1
  160. package/dist/cjs/splitview/splitviewPanel.d.ts +45 -45
  161. package/dist/cjs/splitview/splitviewPanel.d.ts.map +1 -1
  162. package/dist/cjs/splitview/splitviewPanel.js +179 -179
  163. package/dist/cjs/splitview/splitviewPanel.js.map +1 -1
  164. package/dist/cjs/splitview/viewItem.d.ts +25 -25
  165. package/dist/cjs/splitview/viewItem.js +119 -119
  166. package/dist/cjs/svg.d.ts +3 -3
  167. package/dist/cjs/svg.js +43 -43
  168. package/dist/cjs/types.d.ts +2 -2
  169. package/dist/cjs/types.js +2 -2
  170. package/dist/dockview-core.amd.js +7650 -7188
  171. package/dist/dockview-core.amd.js.map +1 -1
  172. package/dist/dockview-core.amd.min.js +2 -2
  173. package/dist/dockview-core.amd.min.js.map +1 -1
  174. package/dist/dockview-core.amd.min.noStyle.js +2 -2
  175. package/dist/dockview-core.amd.min.noStyle.js.map +1 -1
  176. package/dist/dockview-core.amd.noStyle.js +7601 -7139
  177. package/dist/dockview-core.amd.noStyle.js.map +1 -1
  178. package/dist/dockview-core.cjs.js +7650 -7188
  179. package/dist/dockview-core.cjs.js.map +1 -1
  180. package/dist/dockview-core.esm.js +7650 -7188
  181. package/dist/dockview-core.esm.js.map +1 -1
  182. package/dist/dockview-core.esm.min.js +2 -2
  183. package/dist/dockview-core.esm.min.js.map +1 -1
  184. package/dist/dockview-core.js +7650 -7188
  185. package/dist/dockview-core.js.map +1 -1
  186. package/dist/dockview-core.min.js +2 -2
  187. package/dist/dockview-core.min.js.map +1 -1
  188. package/dist/dockview-core.min.noStyle.js +2 -2
  189. package/dist/dockview-core.min.noStyle.js.map +1 -1
  190. package/dist/dockview-core.noStyle.js +7601 -7139
  191. package/dist/dockview-core.noStyle.js.map +1 -1
  192. package/dist/esm/api/component.api.d.ts +455 -152
  193. package/dist/esm/api/component.api.d.ts.map +1 -1
  194. package/dist/esm/api/component.api.js +638 -335
  195. package/dist/esm/api/component.api.js.map +1 -1
  196. package/dist/esm/api/dockviewGroupPanelApi.d.ts +29 -29
  197. package/dist/esm/api/dockviewGroupPanelApi.js +27 -27
  198. package/dist/esm/api/dockviewPanelApi.d.ts +47 -47
  199. package/dist/esm/api/dockviewPanelApi.js +53 -53
  200. package/dist/esm/api/gridviewPanelApi.d.ts +37 -37
  201. package/dist/esm/api/gridviewPanelApi.js +25 -25
  202. package/dist/esm/api/panelApi.d.ts +88 -88
  203. package/dist/esm/api/panelApi.js +93 -93
  204. package/dist/esm/api/paneviewPanelApi.d.ts +26 -26
  205. package/dist/esm/api/paneviewPanelApi.js +27 -27
  206. package/dist/esm/api/splitviewPanelApi.d.ts +32 -32
  207. package/dist/esm/api/splitviewPanelApi.js +25 -25
  208. package/dist/esm/array.d.ts +13 -13
  209. package/dist/esm/array.js +57 -57
  210. package/dist/esm/dnd/abstractDragHandler.d.ts +12 -12
  211. package/dist/esm/dnd/abstractDragHandler.js +63 -63
  212. package/dist/esm/dnd/dataTransfer.d.ts +30 -31
  213. package/dist/esm/dnd/dataTransfer.d.ts.map +1 -1
  214. package/dist/esm/dnd/dataTransfer.js +66 -69
  215. package/dist/esm/dnd/dataTransfer.js.map +1 -1
  216. package/dist/esm/dnd/dnd.d.ts +27 -27
  217. package/dist/esm/dnd/dnd.js +36 -36
  218. package/dist/esm/dnd/droptarget.d.ts +53 -53
  219. package/dist/esm/dnd/droptarget.js +274 -274
  220. package/dist/esm/dnd/droptarget.js.map +1 -1
  221. package/dist/esm/dnd/ghost.d.ts +1 -1
  222. package/dist/esm/dnd/ghost.js +11 -11
  223. package/dist/esm/dnd/groupDragHandler.d.ts +12 -12
  224. package/dist/esm/dnd/groupDragHandler.js +54 -54
  225. package/dist/esm/dnd/overlay.d.ts +43 -43
  226. package/dist/esm/dnd/overlay.d.ts.map +1 -1
  227. package/dist/esm/dnd/overlay.js +304 -304
  228. package/dist/esm/dnd/overlay.js.map +1 -1
  229. package/dist/esm/dockview/components/panel/content.d.ts +30 -30
  230. package/dist/esm/dockview/components/panel/content.js +73 -73
  231. package/dist/esm/dockview/components/tab/defaultTab.d.ts +21 -21
  232. package/dist/esm/dockview/components/tab/defaultTab.js +67 -67
  233. package/dist/esm/dockview/components/tab/tab.d.ts +34 -34
  234. package/dist/esm/dockview/components/tab/tab.js +90 -90
  235. package/dist/esm/dockview/components/titlebar/tabsContainer.d.ts +81 -77
  236. package/dist/esm/dockview/components/titlebar/tabsContainer.d.ts.map +1 -1
  237. package/dist/esm/dockview/components/titlebar/tabsContainer.js +239 -223
  238. package/dist/esm/dockview/components/titlebar/tabsContainer.js.map +1 -1
  239. package/dist/esm/dockview/components/titlebar/voidContainer.d.ts +17 -17
  240. package/dist/esm/dockview/components/titlebar/voidContainer.js +51 -51
  241. package/dist/esm/dockview/components/watermark/watermark.d.ts +18 -18
  242. package/dist/esm/dockview/components/watermark/watermark.js +61 -61
  243. package/dist/esm/dockview/deserializer.d.ts +12 -12
  244. package/dist/esm/dockview/deserializer.js +28 -28
  245. package/dist/esm/dockview/deserializer.js.map +1 -1
  246. package/dist/esm/dockview/dockviewComponent.d.ts +159 -159
  247. package/dist/esm/dockview/dockviewComponent.d.ts.map +1 -1
  248. package/dist/esm/dockview/dockviewComponent.js +932 -804
  249. package/dist/esm/dockview/dockviewComponent.js.map +1 -1
  250. package/dist/esm/dockview/dockviewFloatingGroupPanel.d.ts +23 -23
  251. package/dist/esm/dockview/dockviewFloatingGroupPanel.js +12 -12
  252. package/dist/esm/dockview/dockviewGroupPanel.d.ts +30 -30
  253. package/dist/esm/dockview/dockviewGroupPanel.js +51 -51
  254. package/dist/esm/dockview/dockviewGroupPanelModel.d.ts +185 -184
  255. package/dist/esm/dockview/dockviewGroupPanelModel.d.ts.map +1 -1
  256. package/dist/esm/dockview/dockviewGroupPanelModel.js +499 -488
  257. package/dist/esm/dockview/dockviewGroupPanelModel.js.map +1 -1
  258. package/dist/esm/dockview/dockviewPanel.d.ts +41 -41
  259. package/dist/esm/dockview/dockviewPanel.js +105 -104
  260. package/dist/esm/dockview/dockviewPanel.js.map +1 -1
  261. package/dist/esm/dockview/dockviewPanelModel.d.ts +35 -35
  262. package/dist/esm/dockview/dockviewPanelModel.js +74 -74
  263. package/dist/esm/dockview/dockviewPanelModel.js.map +1 -1
  264. package/dist/esm/dockview/options.d.ts +133 -135
  265. package/dist/esm/dockview/options.d.ts.map +1 -1
  266. package/dist/esm/dockview/options.js +24 -24
  267. package/dist/esm/dockview/options.js.map +1 -1
  268. package/dist/esm/dockview/types.d.ts +63 -63
  269. package/dist/esm/dockview/types.js +7 -7
  270. package/dist/esm/dom.d.ts +16 -16
  271. package/dist/esm/dom.js +126 -126
  272. package/dist/esm/events.d.ts +47 -47
  273. package/dist/esm/events.js +156 -156
  274. package/dist/esm/events.js.map +1 -1
  275. package/dist/esm/gridview/baseComponentGridview.d.ts +88 -87
  276. package/dist/esm/gridview/baseComponentGridview.d.ts.map +1 -1
  277. package/dist/esm/gridview/baseComponentGridview.js +184 -184
  278. package/dist/esm/gridview/baseComponentGridview.js.map +1 -1
  279. package/dist/esm/gridview/basePanelView.d.ts +40 -40
  280. package/dist/esm/gridview/basePanelView.js +85 -85
  281. package/dist/esm/gridview/branchNode.d.ts +49 -49
  282. package/dist/esm/gridview/branchNode.d.ts.map +1 -1
  283. package/dist/esm/gridview/branchNode.js +219 -218
  284. package/dist/esm/gridview/branchNode.js.map +1 -1
  285. package/dist/esm/gridview/gridview.d.ts +133 -133
  286. package/dist/esm/gridview/gridview.d.ts.map +1 -1
  287. package/dist/esm/gridview/gridview.js +461 -453
  288. package/dist/esm/gridview/gridview.js.map +1 -1
  289. package/dist/esm/gridview/gridviewComponent.d.ts +80 -80
  290. package/dist/esm/gridview/gridviewComponent.d.ts.map +1 -1
  291. package/dist/esm/gridview/gridviewComponent.js +264 -241
  292. package/dist/esm/gridview/gridviewComponent.js.map +1 -1
  293. package/dist/esm/gridview/gridviewPanel.d.ts +65 -65
  294. package/dist/esm/gridview/gridviewPanel.js +151 -151
  295. package/dist/esm/gridview/leafNode.d.ts +34 -34
  296. package/dist/esm/gridview/leafNode.js +103 -103
  297. package/dist/esm/gridview/options.d.ts +17 -18
  298. package/dist/esm/gridview/options.d.ts.map +1 -1
  299. package/dist/esm/gridview/options.js +1 -1
  300. package/dist/esm/gridview/types.d.ts +3 -3
  301. package/dist/esm/gridview/types.js +1 -1
  302. package/dist/esm/index.d.ts +42 -41
  303. package/dist/esm/index.d.ts.map +1 -1
  304. package/dist/esm/index.js +34 -34
  305. package/dist/esm/index.js.map +1 -1
  306. package/dist/esm/lifecycle.d.ts +23 -23
  307. package/dist/esm/lifecycle.js +41 -41
  308. package/dist/esm/math.d.ts +5 -5
  309. package/dist/esm/math.js +28 -28
  310. package/dist/esm/panel/componentFactory.d.ts +11 -10
  311. package/dist/esm/panel/componentFactory.d.ts.map +1 -1
  312. package/dist/esm/panel/componentFactory.js +24 -24
  313. package/dist/esm/panel/componentFactory.js.map +1 -1
  314. package/dist/esm/panel/types.d.ts +33 -33
  315. package/dist/esm/panel/types.js +1 -1
  316. package/dist/esm/paneview/defaultPaneviewHeader.d.ts +21 -21
  317. package/dist/esm/paneview/defaultPaneviewHeader.js +63 -63
  318. package/dist/esm/paneview/draggablePaneviewPanel.d.ts +21 -21
  319. package/dist/esm/paneview/draggablePaneviewPanel.js +92 -92
  320. package/dist/esm/paneview/options.d.ts +25 -28
  321. package/dist/esm/paneview/options.d.ts.map +1 -1
  322. package/dist/esm/paneview/options.js +1 -1
  323. package/dist/esm/paneview/paneview.d.ts +40 -40
  324. package/dist/esm/paneview/paneview.d.ts.map +1 -1
  325. package/dist/esm/paneview/paneview.js +145 -145
  326. package/dist/esm/paneview/paneviewComponent.d.ts +128 -128
  327. package/dist/esm/paneview/paneviewComponent.js +276 -273
  328. package/dist/esm/paneview/paneviewComponent.js.map +1 -1
  329. package/dist/esm/paneview/paneviewPanel.d.ts +92 -92
  330. package/dist/esm/paneview/paneviewPanel.d.ts.map +1 -1
  331. package/dist/esm/paneview/paneviewPanel.js +192 -192
  332. package/dist/esm/resizable.d.ts +10 -7
  333. package/dist/esm/resizable.d.ts.map +1 -1
  334. package/dist/esm/resizable.js +48 -30
  335. package/dist/esm/resizable.js.map +1 -1
  336. package/dist/esm/splitview/options.d.ts +26 -27
  337. package/dist/esm/splitview/options.d.ts.map +1 -1
  338. package/dist/esm/splitview/options.js +1 -1
  339. package/dist/esm/splitview/splitview.d.ts +128 -128
  340. package/dist/esm/splitview/splitview.d.ts.map +1 -1
  341. package/dist/esm/splitview/splitview.js +704 -694
  342. package/dist/esm/splitview/splitview.js.map +1 -1
  343. package/dist/esm/splitview/splitviewComponent.d.ts +101 -101
  344. package/dist/esm/splitview/splitviewComponent.js +261 -258
  345. package/dist/esm/splitview/splitviewComponent.js.map +1 -1
  346. package/dist/esm/splitview/splitviewPanel.d.ts +45 -45
  347. package/dist/esm/splitview/splitviewPanel.d.ts.map +1 -1
  348. package/dist/esm/splitview/splitviewPanel.js +108 -108
  349. package/dist/esm/splitview/splitviewPanel.js.map +1 -1
  350. package/dist/esm/splitview/viewItem.d.ts +25 -25
  351. package/dist/esm/splitview/viewItem.js +74 -74
  352. package/dist/esm/svg.d.ts +3 -3
  353. package/dist/esm/svg.js +31 -31
  354. package/dist/esm/types.d.ts +2 -2
  355. package/dist/esm/types.js +1 -1
  356. package/package.json +30 -43
  357. package/LICENSE +0 -21
@@ -1,622 +1,633 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- var __read = (this && this.__read) || function (o, n) {
18
- var m = typeof Symbol === "function" && o[Symbol.iterator];
19
- if (!m) return o;
20
- var i = m.call(o), r, ar = [], e;
21
- try {
22
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
23
- }
24
- catch (error) { e = { error: error }; }
25
- finally {
26
- try {
27
- if (r && !r.done && (m = i["return"])) m.call(i);
28
- }
29
- finally { if (e) throw e.error; }
30
- }
31
- return ar;
32
- };
33
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
34
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
35
- if (ar || !(i in from)) {
36
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
37
- ar[i] = from[i];
38
- }
39
- }
40
- return to.concat(ar || Array.prototype.slice.call(from));
41
- };
42
- var __values = (this && this.__values) || function(o) {
43
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
44
- if (m) return m.call(o);
45
- if (o && typeof o.length === "number") return {
46
- next: function () {
47
- if (o && i >= o.length) o = void 0;
48
- return { value: o && o[i++], done: !o };
49
- }
50
- };
51
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
52
- };
53
- Object.defineProperty(exports, "__esModule", { value: true });
54
- exports.DockviewGroupPanelModel = void 0;
55
- var component_api_1 = require("../api/component.api");
56
- var dataTransfer_1 = require("../dnd/dataTransfer");
57
- var droptarget_1 = require("../dnd/droptarget");
58
- var dom_1 = require("../dom");
59
- var events_1 = require("../events");
60
- var lifecycle_1 = require("../lifecycle");
61
- var content_1 = require("./components/panel/content");
62
- var tabsContainer_1 = require("./components/titlebar/tabsContainer");
63
- var types_1 = require("./types");
64
- var DockviewGroupPanelModel = /** @class */ (function (_super) {
65
- __extends(DockviewGroupPanelModel, _super);
66
- function DockviewGroupPanelModel(container, accessor, id, options, groupPanel) {
67
- var _this = _super.call(this) || this;
68
- _this.container = container;
69
- _this.accessor = accessor;
70
- _this.id = id;
71
- _this.options = options;
72
- _this.groupPanel = groupPanel;
73
- _this._isGroupActive = false;
74
- _this._locked = false;
75
- _this._isFloating = false;
76
- _this.mostRecentlyUsed = [];
77
- _this._onDidChange = new events_1.Emitter();
78
- _this.onDidChange = _this._onDidChange.event;
79
- _this._width = 0;
80
- _this._height = 0;
81
- _this._panels = [];
82
- _this._onMove = new events_1.Emitter();
83
- _this.onMove = _this._onMove.event;
84
- _this._onDidDrop = new events_1.Emitter();
85
- _this.onDidDrop = _this._onDidDrop.event;
86
- _this._onTabDragStart = new events_1.Emitter();
87
- _this.onTabDragStart = _this._onTabDragStart.event;
88
- _this._onGroupDragStart = new events_1.Emitter();
89
- _this.onGroupDragStart = _this._onGroupDragStart.event;
90
- _this._onDidAddPanel = new events_1.Emitter();
91
- _this.onDidAddPanel = _this._onDidAddPanel.event;
92
- _this._onDidRemovePanel = new events_1.Emitter();
93
- _this.onDidRemovePanel = _this._onDidRemovePanel.event;
94
- _this._onDidActivePanelChange = new events_1.Emitter();
95
- _this.onDidActivePanelChange = _this._onDidActivePanelChange.event;
96
- (0, dom_1.toggleClass)(_this.container, 'groupview', true);
97
- _this.tabsContainer = new tabsContainer_1.TabsContainer(_this.accessor, _this.groupPanel);
98
- _this.contentContainer = new content_1.ContentContainer();
99
- _this.dropTarget = new droptarget_1.Droptarget(_this.contentContainer.element, {
100
- acceptedTargetZones: ['top', 'bottom', 'left', 'right', 'center'],
101
- canDisplayOverlay: function (event, position) {
102
- if (_this.locked === 'no-drop-target' ||
103
- (_this.locked && position === 'center')) {
104
- return false;
105
- }
106
- var data = (0, dataTransfer_1.getPanelData)();
107
- if (!data && event.shiftKey && !_this.isFloating) {
108
- return false;
109
- }
110
- if (data && data.viewId === _this.accessor.id) {
111
- if (data.groupId === _this.id) {
112
- if (position === 'center') {
113
- // don't allow to drop on self for center position
114
- return false;
115
- }
116
- if (data.panelId === null) {
117
- // don't allow group move to drop anywhere on self
118
- return false;
119
- }
120
- }
121
- var groupHasOnePanelAndIsActiveDragElement = _this._panels.length === 1 && data.groupId === _this.id;
122
- return !groupHasOnePanelAndIsActiveDragElement;
123
- }
124
- return _this.canDisplayOverlay(event, position, types_1.DockviewDropTargets.Panel);
125
- },
126
- });
127
- container.append(_this.tabsContainer.element, _this.contentContainer.element);
128
- _this.header.hidden = !!options.hideHeader;
129
- _this.locked = options.locked || false;
130
- _this.addDisposables(_this._onTabDragStart, _this._onGroupDragStart, _this.tabsContainer.onTabDragStart(function (event) {
131
- _this._onTabDragStart.fire(event);
132
- }), _this.tabsContainer.onGroupDragStart(function (event) {
133
- _this._onGroupDragStart.fire(event);
134
- }), _this.tabsContainer.onDrop(function (event) {
135
- _this.handleDropEvent(event.event, 'center', event.index);
136
- }), _this.contentContainer.onDidFocus(function () {
137
- _this.accessor.doSetGroupActive(_this.groupPanel, true);
138
- }), _this.contentContainer.onDidBlur(function () {
139
- // noop
140
- }), _this.dropTarget.onDrop(function (event) {
141
- _this.handleDropEvent(event.nativeEvent, event.position);
142
- }), _this._onMove, _this._onDidChange, _this._onDidDrop, _this._onDidAddPanel, _this._onDidRemovePanel, _this._onDidActivePanelChange);
143
- return _this;
144
- }
145
- Object.defineProperty(DockviewGroupPanelModel.prototype, "element", {
146
- get: function () {
147
- throw new Error('not supported');
148
- },
149
- enumerable: false,
150
- configurable: true
151
- });
152
- Object.defineProperty(DockviewGroupPanelModel.prototype, "activePanel", {
153
- get: function () {
154
- return this._activePanel;
155
- },
156
- enumerable: false,
157
- configurable: true
158
- });
159
- Object.defineProperty(DockviewGroupPanelModel.prototype, "locked", {
160
- get: function () {
161
- return this._locked;
162
- },
163
- set: function (value) {
164
- this._locked = value;
165
- (0, dom_1.toggleClass)(this.container, 'locked-groupview', value === 'no-drop-target' || value);
166
- },
167
- enumerable: false,
168
- configurable: true
169
- });
170
- Object.defineProperty(DockviewGroupPanelModel.prototype, "isActive", {
171
- get: function () {
172
- return this._isGroupActive;
173
- },
174
- enumerable: false,
175
- configurable: true
176
- });
177
- Object.defineProperty(DockviewGroupPanelModel.prototype, "panels", {
178
- get: function () {
179
- return this._panels;
180
- },
181
- enumerable: false,
182
- configurable: true
183
- });
184
- Object.defineProperty(DockviewGroupPanelModel.prototype, "size", {
185
- get: function () {
186
- return this._panels.length;
187
- },
188
- enumerable: false,
189
- configurable: true
190
- });
191
- Object.defineProperty(DockviewGroupPanelModel.prototype, "isEmpty", {
192
- get: function () {
193
- return this._panels.length === 0;
194
- },
195
- enumerable: false,
196
- configurable: true
197
- });
198
- Object.defineProperty(DockviewGroupPanelModel.prototype, "hasWatermark", {
199
- get: function () {
200
- return !!(this.watermark && this.container.contains(this.watermark.element));
201
- },
202
- enumerable: false,
203
- configurable: true
204
- });
205
- Object.defineProperty(DockviewGroupPanelModel.prototype, "header", {
206
- get: function () {
207
- return this.tabsContainer;
208
- },
209
- enumerable: false,
210
- configurable: true
211
- });
212
- Object.defineProperty(DockviewGroupPanelModel.prototype, "isContentFocused", {
213
- get: function () {
214
- if (!document.activeElement) {
215
- return false;
216
- }
217
- return (0, dom_1.isAncestor)(document.activeElement, this.contentContainer.element);
218
- },
219
- enumerable: false,
220
- configurable: true
221
- });
222
- Object.defineProperty(DockviewGroupPanelModel.prototype, "isFloating", {
223
- get: function () {
224
- return this._isFloating;
225
- },
226
- set: function (value) {
227
- this._isFloating = value;
228
- this.dropTarget.setTargetZones(value ? ['center'] : ['top', 'bottom', 'left', 'right', 'center']);
229
- (0, dom_1.toggleClass)(this.container, 'dv-groupview-floating', value);
230
- this.groupPanel.api._onDidFloatingStateChange.fire({
231
- isFloating: this.isFloating,
232
- });
233
- },
234
- enumerable: false,
235
- configurable: true
236
- });
237
- DockviewGroupPanelModel.prototype.initialize = function () {
238
- var _this = this;
239
- var _a, _b;
240
- if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.panels) {
241
- this.options.panels.forEach(function (panel) {
242
- _this.doAddPanel(panel);
243
- });
244
- }
245
- if ((_b = this.options) === null || _b === void 0 ? void 0 : _b.activePanel) {
246
- this.openPanel(this.options.activePanel);
247
- }
248
- // must be run after the constructor otherwise this.parent may not be
249
- // correctly initialized
250
- this.setActive(this.isActive, true, true);
251
- this.updateContainer();
252
- if (this.accessor.options.createRightHeaderActionsElement) {
253
- this._rightHeaderActions =
254
- this.accessor.options.createRightHeaderActionsElement(this.groupPanel);
255
- this.addDisposables(this._rightHeaderActions);
256
- this._rightHeaderActions.init({
257
- containerApi: new component_api_1.DockviewApi(this.accessor),
258
- api: this.groupPanel.api,
259
- });
260
- this.tabsContainer.setRightActionsElement(this._rightHeaderActions.element);
261
- }
262
- if (this.accessor.options.createLeftHeaderActionsElement) {
263
- this._leftHeaderActions =
264
- this.accessor.options.createLeftHeaderActionsElement(this.groupPanel);
265
- this.addDisposables(this._leftHeaderActions);
266
- this._leftHeaderActions.init({
267
- containerApi: new component_api_1.DockviewApi(this.accessor),
268
- api: this.groupPanel.api,
269
- });
270
- this.tabsContainer.setLeftActionsElement(this._leftHeaderActions.element);
271
- }
272
- };
273
- DockviewGroupPanelModel.prototype.indexOf = function (panel) {
274
- return this.tabsContainer.indexOf(panel.id);
275
- };
276
- DockviewGroupPanelModel.prototype.toJSON = function () {
277
- var _a;
278
- var result = {
279
- views: this.tabsContainer.panels,
280
- activeView: (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.id,
281
- id: this.id,
282
- };
283
- if (this.locked !== false) {
284
- result.locked = this.locked;
285
- }
286
- if (this.header.hidden) {
287
- result.hideHeader = true;
288
- }
289
- return result;
290
- };
291
- DockviewGroupPanelModel.prototype.moveToNext = function (options) {
292
- if (!options) {
293
- options = {};
294
- }
295
- if (!options.panel) {
296
- options.panel = this.activePanel;
297
- }
298
- var index = options.panel ? this.panels.indexOf(options.panel) : -1;
299
- var normalizedIndex;
300
- if (index < this.panels.length - 1) {
301
- normalizedIndex = index + 1;
302
- }
303
- else if (!options.suppressRoll) {
304
- normalizedIndex = 0;
305
- }
306
- else {
307
- return;
308
- }
309
- this.openPanel(this.panels[normalizedIndex]);
310
- };
311
- DockviewGroupPanelModel.prototype.moveToPrevious = function (options) {
312
- if (!options) {
313
- options = {};
314
- }
315
- if (!options.panel) {
316
- options.panel = this.activePanel;
317
- }
318
- if (!options.panel) {
319
- return;
320
- }
321
- var index = this.panels.indexOf(options.panel);
322
- var normalizedIndex;
323
- if (index > 0) {
324
- normalizedIndex = index - 1;
325
- }
326
- else if (!options.suppressRoll) {
327
- normalizedIndex = this.panels.length - 1;
328
- }
329
- else {
330
- return;
331
- }
332
- this.openPanel(this.panels[normalizedIndex]);
333
- };
334
- DockviewGroupPanelModel.prototype.containsPanel = function (panel) {
335
- return this.panels.includes(panel);
336
- };
337
- DockviewGroupPanelModel.prototype.init = function (_params) {
338
- //noop
339
- };
340
- DockviewGroupPanelModel.prototype.update = function (_params) {
341
- //noop
342
- };
343
- DockviewGroupPanelModel.prototype.focus = function () {
344
- var _a, _b;
345
- (_b = (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.focus) === null || _b === void 0 ? void 0 : _b.call(_a);
346
- };
347
- DockviewGroupPanelModel.prototype.openPanel = function (panel, options) {
348
- if (options === void 0) { options = {}; }
349
- if (typeof options.index !== 'number' ||
350
- options.index > this.panels.length) {
351
- options.index = this.panels.length;
352
- }
353
- var skipSetPanelActive = !!options.skipSetPanelActive;
354
- var skipSetGroupActive = !!options.skipSetGroupActive;
355
- // ensure the group is updated before we fire any events
356
- panel.updateParentGroup(this.groupPanel, true);
357
- if (this._activePanel === panel) {
358
- if (!skipSetGroupActive) {
359
- this.accessor.doSetGroupActive(this.groupPanel);
360
- }
361
- return;
362
- }
363
- this.doAddPanel(panel, options.index, skipSetPanelActive);
364
- if (!skipSetPanelActive) {
365
- this.doSetActivePanel(panel);
366
- }
367
- if (!skipSetGroupActive) {
368
- this.accessor.doSetGroupActive(this.groupPanel, !!options.skipFocus);
369
- }
370
- this.updateContainer();
371
- };
372
- DockviewGroupPanelModel.prototype.removePanel = function (groupItemOrId) {
373
- var id = typeof groupItemOrId === 'string'
374
- ? groupItemOrId
375
- : groupItemOrId.id;
376
- var panelToRemove = this._panels.find(function (panel) { return panel.id === id; });
377
- if (!panelToRemove) {
378
- throw new Error('invalid operation');
379
- }
380
- return this._removePanel(panelToRemove);
381
- };
382
- DockviewGroupPanelModel.prototype.closeAllPanels = function () {
383
- var e_1, _a;
384
- if (this.panels.length > 0) {
385
- // take a copy since we will be edting the array as we iterate through
386
- var arrPanelCpy = __spreadArray([], __read(this.panels), false);
387
- try {
388
- for (var arrPanelCpy_1 = __values(arrPanelCpy), arrPanelCpy_1_1 = arrPanelCpy_1.next(); !arrPanelCpy_1_1.done; arrPanelCpy_1_1 = arrPanelCpy_1.next()) {
389
- var panel = arrPanelCpy_1_1.value;
390
- this.doClose(panel);
391
- }
392
- }
393
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
394
- finally {
395
- try {
396
- if (arrPanelCpy_1_1 && !arrPanelCpy_1_1.done && (_a = arrPanelCpy_1.return)) _a.call(arrPanelCpy_1);
397
- }
398
- finally { if (e_1) throw e_1.error; }
399
- }
400
- }
401
- else {
402
- this.accessor.removeGroup(this.groupPanel);
403
- }
404
- };
405
- DockviewGroupPanelModel.prototype.closePanel = function (panel) {
406
- this.doClose(panel);
407
- };
408
- DockviewGroupPanelModel.prototype.doClose = function (panel) {
409
- this.accessor.removePanel(panel);
410
- };
411
- DockviewGroupPanelModel.prototype.isPanelActive = function (panel) {
412
- return this._activePanel === panel;
413
- };
414
- DockviewGroupPanelModel.prototype.updateActions = function (element) {
415
- this.tabsContainer.setRightActionsElement(element);
416
- };
417
- DockviewGroupPanelModel.prototype.setActive = function (isGroupActive, skipFocus, force) {
418
- var _a, _b, _c, _d;
419
- if (skipFocus === void 0) { skipFocus = false; }
420
- if (force === void 0) { force = false; }
421
- if (!force && this.isActive === isGroupActive) {
422
- if (!skipFocus) {
423
- (_b = (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.focus) === null || _b === void 0 ? void 0 : _b.call(_a);
424
- }
425
- return;
426
- }
427
- this._isGroupActive = isGroupActive;
428
- (0, dom_1.toggleClass)(this.container, 'active-group', isGroupActive);
429
- (0, dom_1.toggleClass)(this.container, 'inactive-group', !isGroupActive);
430
- this.tabsContainer.setActive(this.isActive);
431
- if (!this._activePanel && this.panels.length > 0) {
432
- this.doSetActivePanel(this.panels[0]);
433
- }
434
- this.updateContainer();
435
- if (isGroupActive) {
436
- if (!skipFocus) {
437
- (_d = (_c = this._activePanel) === null || _c === void 0 ? void 0 : _c.focus) === null || _d === void 0 ? void 0 : _d.call(_c);
438
- }
439
- }
440
- };
441
- DockviewGroupPanelModel.prototype.layout = function (width, height) {
442
- var _a;
443
- this._width = width;
444
- this._height = height;
445
- this.contentContainer.layout(this._width, this._height);
446
- if ((_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.layout) {
447
- this._activePanel.layout(this._width, this._height);
448
- }
449
- };
450
- DockviewGroupPanelModel.prototype._removePanel = function (panel) {
451
- var isActivePanel = this._activePanel === panel;
452
- this.doRemovePanel(panel);
453
- if (isActivePanel && this.panels.length > 0) {
454
- var nextPanel = this.mostRecentlyUsed[0];
455
- this.openPanel(nextPanel);
456
- }
457
- if (this._activePanel && this.panels.length === 0) {
458
- this.doSetActivePanel(undefined);
459
- }
460
- this.updateContainer();
461
- return panel;
462
- };
463
- DockviewGroupPanelModel.prototype.doRemovePanel = function (panel) {
464
- var index = this.panels.indexOf(panel);
465
- if (this._activePanel === panel) {
466
- this.contentContainer.closePanel();
467
- }
468
- this.tabsContainer.delete(panel.id);
469
- this._panels.splice(index, 1);
470
- if (this.mostRecentlyUsed.includes(panel)) {
471
- this.mostRecentlyUsed.splice(this.mostRecentlyUsed.indexOf(panel), 1);
472
- }
473
- this._onDidRemovePanel.fire({ panel: panel });
474
- };
475
- DockviewGroupPanelModel.prototype.doAddPanel = function (panel, index, skipSetActive) {
476
- if (index === void 0) { index = this.panels.length; }
477
- if (skipSetActive === void 0) { skipSetActive = false; }
478
- var existingPanel = this._panels.indexOf(panel);
479
- var hasExistingPanel = existingPanel > -1;
480
- this.tabsContainer.openPanel(panel, index);
481
- if (!skipSetActive) {
482
- this.contentContainer.openPanel(panel);
483
- }
484
- this.tabsContainer.show();
485
- this.contentContainer.show();
486
- if (hasExistingPanel) {
487
- // TODO - need to ensure ordering hasn't changed and if it has need to re-order this.panels
488
- return;
489
- }
490
- this.updateMru(panel);
491
- this.panels.splice(index, 0, panel);
492
- this._onDidAddPanel.fire({ panel: panel });
493
- };
494
- DockviewGroupPanelModel.prototype.doSetActivePanel = function (panel) {
495
- this._activePanel = panel;
496
- if (panel) {
497
- this.tabsContainer.setActivePanel(panel);
498
- panel.layout(this._width, this._height);
499
- this.updateMru(panel);
500
- this._onDidActivePanelChange.fire({ panel: panel });
501
- }
502
- };
503
- DockviewGroupPanelModel.prototype.updateMru = function (panel) {
504
- if (this.mostRecentlyUsed.includes(panel)) {
505
- this.mostRecentlyUsed.splice(this.mostRecentlyUsed.indexOf(panel), 1);
506
- }
507
- this.mostRecentlyUsed = __spreadArray([panel], __read(this.mostRecentlyUsed), false);
508
- };
509
- DockviewGroupPanelModel.prototype.updateContainer = function () {
510
- var _this = this;
511
- var _a, _b;
512
- (0, dom_1.toggleClass)(this.container, 'empty', this.isEmpty);
513
- this.panels.forEach(function (panel) {
514
- return panel.updateParentGroup(_this.groupPanel, _this.isActive);
515
- });
516
- if (this.isEmpty && !this.watermark) {
517
- var watermark = this.accessor.createWatermarkComponent();
518
- watermark.init({
519
- containerApi: new component_api_1.DockviewApi(this.accessor),
520
- group: this.groupPanel,
521
- });
522
- this.watermark = watermark;
523
- (0, events_1.addDisposableListener)(this.watermark.element, 'click', function () {
524
- if (!_this.isActive) {
525
- _this.accessor.doSetGroupActive(_this.groupPanel);
526
- }
527
- });
528
- this.tabsContainer.hide();
529
- this.contentContainer.element.appendChild(this.watermark.element);
530
- this.watermark.updateParentGroup(this.groupPanel, true);
531
- }
532
- if (!this.isEmpty && this.watermark) {
533
- this.watermark.element.remove();
534
- (_b = (_a = this.watermark).dispose) === null || _b === void 0 ? void 0 : _b.call(_a);
535
- this.watermark = undefined;
536
- this.tabsContainer.show();
537
- }
538
- };
539
- DockviewGroupPanelModel.prototype.canDisplayOverlay = function (event, position, target) {
540
- // custom overlay handler
541
- if (this.accessor.options.showDndOverlay) {
542
- return this.accessor.options.showDndOverlay({
543
- nativeEvent: event,
544
- target: target,
545
- group: this.accessor.getPanel(this.id),
546
- position: position,
547
- getData: dataTransfer_1.getPanelData,
548
- });
549
- }
550
- return false;
551
- };
552
- DockviewGroupPanelModel.prototype.handleDropEvent = function (event, position, index) {
553
- if (this.locked === 'no-drop-target') {
554
- return;
555
- }
556
- var data = (0, dataTransfer_1.getPanelData)();
557
- if (data && data.viewId === this.accessor.id) {
558
- if (data.panelId === null) {
559
- // this is a group move dnd event
560
- var groupId_1 = data.groupId;
561
- this._onMove.fire({
562
- target: position,
563
- groupId: groupId_1,
564
- index: index,
565
- });
566
- return;
567
- }
568
- var fromSameGroup = this.tabsContainer.indexOf(data.panelId) !== -1;
569
- if (fromSameGroup && this.tabsContainer.size === 1) {
570
- return;
571
- }
572
- var groupId = data.groupId, panelId = data.panelId;
573
- var isSameGroup = this.id === groupId;
574
- if (isSameGroup && !position) {
575
- var oldIndex = this.tabsContainer.indexOf(panelId);
576
- if (oldIndex === index) {
577
- return;
578
- }
579
- }
580
- this._onMove.fire({
581
- target: position,
582
- groupId: data.groupId,
583
- itemId: data.panelId,
584
- index: index,
585
- });
586
- }
587
- else {
588
- this._onDidDrop.fire({
589
- nativeEvent: event,
590
- position: position,
591
- index: index,
592
- getData: function () { return (0, dataTransfer_1.getPanelData)(); },
593
- });
594
- }
595
- };
596
- DockviewGroupPanelModel.prototype.dispose = function () {
597
- var e_2, _a;
598
- var _b, _c, _d;
599
- _super.prototype.dispose.call(this);
600
- (_b = this.watermark) === null || _b === void 0 ? void 0 : _b.element.remove();
601
- (_d = (_c = this.watermark) === null || _c === void 0 ? void 0 : _c.dispose) === null || _d === void 0 ? void 0 : _d.call(_c);
602
- try {
603
- for (var _e = __values(this.panels), _f = _e.next(); !_f.done; _f = _e.next()) {
604
- var panel = _f.value;
605
- panel.dispose();
606
- }
607
- }
608
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
609
- finally {
610
- try {
611
- if (_f && !_f.done && (_a = _e.return)) _a.call(_e);
612
- }
613
- finally { if (e_2) throw e_2.error; }
614
- }
615
- this.dropTarget.dispose();
616
- this.tabsContainer.dispose();
617
- this.contentContainer.dispose();
618
- };
619
- return DockviewGroupPanelModel;
620
- }(lifecycle_1.CompositeDisposable));
621
- exports.DockviewGroupPanelModel = DockviewGroupPanelModel;
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __read = (this && this.__read) || function (o, n) {
18
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
19
+ if (!m) return o;
20
+ var i = m.call(o), r, ar = [], e;
21
+ try {
22
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
23
+ }
24
+ catch (error) { e = { error: error }; }
25
+ finally {
26
+ try {
27
+ if (r && !r.done && (m = i["return"])) m.call(i);
28
+ }
29
+ finally { if (e) throw e.error; }
30
+ }
31
+ return ar;
32
+ };
33
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
34
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
35
+ if (ar || !(i in from)) {
36
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
37
+ ar[i] = from[i];
38
+ }
39
+ }
40
+ return to.concat(ar || Array.prototype.slice.call(from));
41
+ };
42
+ var __values = (this && this.__values) || function(o) {
43
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
44
+ if (m) return m.call(o);
45
+ if (o && typeof o.length === "number") return {
46
+ next: function () {
47
+ if (o && i >= o.length) o = void 0;
48
+ return { value: o && o[i++], done: !o };
49
+ }
50
+ };
51
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
52
+ };
53
+ Object.defineProperty(exports, "__esModule", { value: true });
54
+ exports.DockviewGroupPanelModel = void 0;
55
+ var component_api_1 = require("../api/component.api");
56
+ var dataTransfer_1 = require("../dnd/dataTransfer");
57
+ var droptarget_1 = require("../dnd/droptarget");
58
+ var dom_1 = require("../dom");
59
+ var events_1 = require("../events");
60
+ var lifecycle_1 = require("../lifecycle");
61
+ var content_1 = require("./components/panel/content");
62
+ var tabsContainer_1 = require("./components/titlebar/tabsContainer");
63
+ var types_1 = require("./types");
64
+ var DockviewGroupPanelModel = /** @class */ (function (_super) {
65
+ __extends(DockviewGroupPanelModel, _super);
66
+ function DockviewGroupPanelModel(container, accessor, id, options, groupPanel) {
67
+ var _a;
68
+ var _this = _super.call(this) || this;
69
+ _this.container = container;
70
+ _this.accessor = accessor;
71
+ _this.id = id;
72
+ _this.options = options;
73
+ _this.groupPanel = groupPanel;
74
+ _this._isGroupActive = false;
75
+ _this._locked = false;
76
+ _this._isFloating = false;
77
+ _this.mostRecentlyUsed = [];
78
+ _this._onDidChange = new events_1.Emitter();
79
+ _this.onDidChange = _this._onDidChange.event;
80
+ _this._width = 0;
81
+ _this._height = 0;
82
+ _this._panels = [];
83
+ _this._onMove = new events_1.Emitter();
84
+ _this.onMove = _this._onMove.event;
85
+ _this._onDidDrop = new events_1.Emitter();
86
+ _this.onDidDrop = _this._onDidDrop.event;
87
+ _this._onTabDragStart = new events_1.Emitter();
88
+ _this.onTabDragStart = _this._onTabDragStart.event;
89
+ _this._onGroupDragStart = new events_1.Emitter();
90
+ _this.onGroupDragStart = _this._onGroupDragStart.event;
91
+ _this._onDidAddPanel = new events_1.Emitter();
92
+ _this.onDidAddPanel = _this._onDidAddPanel.event;
93
+ _this._onDidRemovePanel = new events_1.Emitter();
94
+ _this.onDidRemovePanel = _this._onDidRemovePanel.event;
95
+ _this._onDidActivePanelChange = new events_1.Emitter();
96
+ _this.onDidActivePanelChange = _this._onDidActivePanelChange.event;
97
+ (0, dom_1.toggleClass)(_this.container, 'groupview', true);
98
+ _this.tabsContainer = new tabsContainer_1.TabsContainer(_this.accessor, _this.groupPanel);
99
+ _this.contentContainer = new content_1.ContentContainer();
100
+ _this.dropTarget = new droptarget_1.Droptarget(_this.contentContainer.element, {
101
+ acceptedTargetZones: ['top', 'bottom', 'left', 'right', 'center'],
102
+ canDisplayOverlay: function (event, position) {
103
+ if (_this.locked === 'no-drop-target' ||
104
+ (_this.locked && position === 'center')) {
105
+ return false;
106
+ }
107
+ var data = (0, dataTransfer_1.getPanelData)();
108
+ if (!data && event.shiftKey && !_this.isFloating) {
109
+ return false;
110
+ }
111
+ if (data && data.viewId === _this.accessor.id) {
112
+ if (data.groupId === _this.id) {
113
+ if (position === 'center') {
114
+ // don't allow to drop on self for center position
115
+ return false;
116
+ }
117
+ if (data.panelId === null) {
118
+ // don't allow group move to drop anywhere on self
119
+ return false;
120
+ }
121
+ }
122
+ var groupHasOnePanelAndIsActiveDragElement = _this._panels.length === 1 && data.groupId === _this.id;
123
+ return !groupHasOnePanelAndIsActiveDragElement;
124
+ }
125
+ return _this.canDisplayOverlay(event, position, types_1.DockviewDropTargets.Panel);
126
+ },
127
+ });
128
+ container.append(_this.tabsContainer.element, _this.contentContainer.element);
129
+ _this.header.hidden = !!options.hideHeader;
130
+ _this.locked = (_a = options.locked) !== null && _a !== void 0 ? _a : false;
131
+ _this.addDisposables(_this._onTabDragStart, _this._onGroupDragStart, _this.tabsContainer.onTabDragStart(function (event) {
132
+ _this._onTabDragStart.fire(event);
133
+ }), _this.tabsContainer.onGroupDragStart(function (event) {
134
+ _this._onGroupDragStart.fire(event);
135
+ }), _this.tabsContainer.onDrop(function (event) {
136
+ _this.handleDropEvent(event.event, 'center', event.index);
137
+ }), _this.contentContainer.onDidFocus(function () {
138
+ _this.accessor.doSetGroupActive(_this.groupPanel, true);
139
+ }), _this.contentContainer.onDidBlur(function () {
140
+ // noop
141
+ }), _this.dropTarget.onDrop(function (event) {
142
+ _this.handleDropEvent(event.nativeEvent, event.position);
143
+ }), _this._onMove, _this._onDidChange, _this._onDidDrop, _this._onDidAddPanel, _this._onDidRemovePanel, _this._onDidActivePanelChange);
144
+ return _this;
145
+ }
146
+ Object.defineProperty(DockviewGroupPanelModel.prototype, "element", {
147
+ get: function () {
148
+ throw new Error('not supported');
149
+ },
150
+ enumerable: false,
151
+ configurable: true
152
+ });
153
+ Object.defineProperty(DockviewGroupPanelModel.prototype, "activePanel", {
154
+ get: function () {
155
+ return this._activePanel;
156
+ },
157
+ enumerable: false,
158
+ configurable: true
159
+ });
160
+ Object.defineProperty(DockviewGroupPanelModel.prototype, "locked", {
161
+ get: function () {
162
+ return this._locked;
163
+ },
164
+ set: function (value) {
165
+ this._locked = value;
166
+ (0, dom_1.toggleClass)(this.container, 'locked-groupview', value === 'no-drop-target' || value);
167
+ },
168
+ enumerable: false,
169
+ configurable: true
170
+ });
171
+ Object.defineProperty(DockviewGroupPanelModel.prototype, "isActive", {
172
+ get: function () {
173
+ return this._isGroupActive;
174
+ },
175
+ enumerable: false,
176
+ configurable: true
177
+ });
178
+ Object.defineProperty(DockviewGroupPanelModel.prototype, "panels", {
179
+ get: function () {
180
+ return this._panels;
181
+ },
182
+ enumerable: false,
183
+ configurable: true
184
+ });
185
+ Object.defineProperty(DockviewGroupPanelModel.prototype, "size", {
186
+ get: function () {
187
+ return this._panels.length;
188
+ },
189
+ enumerable: false,
190
+ configurable: true
191
+ });
192
+ Object.defineProperty(DockviewGroupPanelModel.prototype, "isEmpty", {
193
+ get: function () {
194
+ return this._panels.length === 0;
195
+ },
196
+ enumerable: false,
197
+ configurable: true
198
+ });
199
+ Object.defineProperty(DockviewGroupPanelModel.prototype, "hasWatermark", {
200
+ get: function () {
201
+ return !!(this.watermark && this.container.contains(this.watermark.element));
202
+ },
203
+ enumerable: false,
204
+ configurable: true
205
+ });
206
+ Object.defineProperty(DockviewGroupPanelModel.prototype, "header", {
207
+ get: function () {
208
+ return this.tabsContainer;
209
+ },
210
+ enumerable: false,
211
+ configurable: true
212
+ });
213
+ Object.defineProperty(DockviewGroupPanelModel.prototype, "isContentFocused", {
214
+ get: function () {
215
+ if (!document.activeElement) {
216
+ return false;
217
+ }
218
+ return (0, dom_1.isAncestor)(document.activeElement, this.contentContainer.element);
219
+ },
220
+ enumerable: false,
221
+ configurable: true
222
+ });
223
+ Object.defineProperty(DockviewGroupPanelModel.prototype, "isFloating", {
224
+ get: function () {
225
+ return this._isFloating;
226
+ },
227
+ set: function (value) {
228
+ this._isFloating = value;
229
+ this.dropTarget.setTargetZones(value ? ['center'] : ['top', 'bottom', 'left', 'right', 'center']);
230
+ (0, dom_1.toggleClass)(this.container, 'dv-groupview-floating', value);
231
+ this.groupPanel.api._onDidFloatingStateChange.fire({
232
+ isFloating: this.isFloating,
233
+ });
234
+ },
235
+ enumerable: false,
236
+ configurable: true
237
+ });
238
+ DockviewGroupPanelModel.prototype.initialize = function () {
239
+ var _this = this;
240
+ var _a, _b;
241
+ if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.panels) {
242
+ this.options.panels.forEach(function (panel) {
243
+ _this.doAddPanel(panel);
244
+ });
245
+ }
246
+ if ((_b = this.options) === null || _b === void 0 ? void 0 : _b.activePanel) {
247
+ this.openPanel(this.options.activePanel);
248
+ }
249
+ // must be run after the constructor otherwise this.parent may not be
250
+ // correctly initialized
251
+ this.setActive(this.isActive, true, true);
252
+ this.updateContainer();
253
+ if (this.accessor.options.createRightHeaderActionsElement) {
254
+ this._rightHeaderActions =
255
+ this.accessor.options.createRightHeaderActionsElement(this.groupPanel);
256
+ this.addDisposables(this._rightHeaderActions);
257
+ this._rightHeaderActions.init({
258
+ containerApi: new component_api_1.DockviewApi(this.accessor),
259
+ api: this.groupPanel.api,
260
+ });
261
+ this.tabsContainer.setRightActionsElement(this._rightHeaderActions.element);
262
+ }
263
+ if (this.accessor.options.createLeftHeaderActionsElement) {
264
+ this._leftHeaderActions =
265
+ this.accessor.options.createLeftHeaderActionsElement(this.groupPanel);
266
+ this.addDisposables(this._leftHeaderActions);
267
+ this._leftHeaderActions.init({
268
+ containerApi: new component_api_1.DockviewApi(this.accessor),
269
+ api: this.groupPanel.api,
270
+ });
271
+ this.tabsContainer.setLeftActionsElement(this._leftHeaderActions.element);
272
+ }
273
+ if (this.accessor.options.createPrefixHeaderActionsElement) {
274
+ this._prefixHeaderActions =
275
+ this.accessor.options.createPrefixHeaderActionsElement(this.groupPanel);
276
+ this.addDisposables(this._prefixHeaderActions);
277
+ this._prefixHeaderActions.init({
278
+ containerApi: new component_api_1.DockviewApi(this.accessor),
279
+ api: this.groupPanel.api,
280
+ });
281
+ this.tabsContainer.setPrefixActionsElement(this._prefixHeaderActions.element);
282
+ }
283
+ };
284
+ DockviewGroupPanelModel.prototype.indexOf = function (panel) {
285
+ return this.tabsContainer.indexOf(panel.id);
286
+ };
287
+ DockviewGroupPanelModel.prototype.toJSON = function () {
288
+ var _a;
289
+ var result = {
290
+ views: this.tabsContainer.panels,
291
+ activeView: (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.id,
292
+ id: this.id,
293
+ };
294
+ if (this.locked !== false) {
295
+ result.locked = this.locked;
296
+ }
297
+ if (this.header.hidden) {
298
+ result.hideHeader = true;
299
+ }
300
+ return result;
301
+ };
302
+ DockviewGroupPanelModel.prototype.moveToNext = function (options) {
303
+ if (!options) {
304
+ options = {};
305
+ }
306
+ if (!options.panel) {
307
+ options.panel = this.activePanel;
308
+ }
309
+ var index = options.panel ? this.panels.indexOf(options.panel) : -1;
310
+ var normalizedIndex;
311
+ if (index < this.panels.length - 1) {
312
+ normalizedIndex = index + 1;
313
+ }
314
+ else if (!options.suppressRoll) {
315
+ normalizedIndex = 0;
316
+ }
317
+ else {
318
+ return;
319
+ }
320
+ this.openPanel(this.panels[normalizedIndex]);
321
+ };
322
+ DockviewGroupPanelModel.prototype.moveToPrevious = function (options) {
323
+ if (!options) {
324
+ options = {};
325
+ }
326
+ if (!options.panel) {
327
+ options.panel = this.activePanel;
328
+ }
329
+ if (!options.panel) {
330
+ return;
331
+ }
332
+ var index = this.panels.indexOf(options.panel);
333
+ var normalizedIndex;
334
+ if (index > 0) {
335
+ normalizedIndex = index - 1;
336
+ }
337
+ else if (!options.suppressRoll) {
338
+ normalizedIndex = this.panels.length - 1;
339
+ }
340
+ else {
341
+ return;
342
+ }
343
+ this.openPanel(this.panels[normalizedIndex]);
344
+ };
345
+ DockviewGroupPanelModel.prototype.containsPanel = function (panel) {
346
+ return this.panels.includes(panel);
347
+ };
348
+ DockviewGroupPanelModel.prototype.init = function (_params) {
349
+ //noop
350
+ };
351
+ DockviewGroupPanelModel.prototype.update = function (_params) {
352
+ //noop
353
+ };
354
+ DockviewGroupPanelModel.prototype.focus = function () {
355
+ var _a, _b;
356
+ (_b = (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.focus) === null || _b === void 0 ? void 0 : _b.call(_a);
357
+ };
358
+ DockviewGroupPanelModel.prototype.openPanel = function (panel, options) {
359
+ if (options === void 0) { options = {}; }
360
+ if (typeof options.index !== 'number' ||
361
+ options.index > this.panels.length) {
362
+ options.index = this.panels.length;
363
+ }
364
+ var skipSetPanelActive = !!options.skipSetPanelActive;
365
+ var skipSetGroupActive = !!options.skipSetGroupActive;
366
+ // ensure the group is updated before we fire any events
367
+ panel.updateParentGroup(this.groupPanel, true);
368
+ if (this._activePanel === panel) {
369
+ if (!skipSetGroupActive) {
370
+ this.accessor.doSetGroupActive(this.groupPanel);
371
+ }
372
+ return;
373
+ }
374
+ this.doAddPanel(panel, options.index, skipSetPanelActive);
375
+ if (!skipSetPanelActive) {
376
+ this.doSetActivePanel(panel);
377
+ }
378
+ if (!skipSetGroupActive) {
379
+ this.accessor.doSetGroupActive(this.groupPanel, !!options.skipFocus);
380
+ }
381
+ this.updateContainer();
382
+ };
383
+ DockviewGroupPanelModel.prototype.removePanel = function (groupItemOrId) {
384
+ var id = typeof groupItemOrId === 'string'
385
+ ? groupItemOrId
386
+ : groupItemOrId.id;
387
+ var panelToRemove = this._panels.find(function (panel) { return panel.id === id; });
388
+ if (!panelToRemove) {
389
+ throw new Error('invalid operation');
390
+ }
391
+ return this._removePanel(panelToRemove);
392
+ };
393
+ DockviewGroupPanelModel.prototype.closeAllPanels = function () {
394
+ var e_1, _a;
395
+ if (this.panels.length > 0) {
396
+ // take a copy since we will be edting the array as we iterate through
397
+ var arrPanelCpy = __spreadArray([], __read(this.panels), false);
398
+ try {
399
+ for (var arrPanelCpy_1 = __values(arrPanelCpy), arrPanelCpy_1_1 = arrPanelCpy_1.next(); !arrPanelCpy_1_1.done; arrPanelCpy_1_1 = arrPanelCpy_1.next()) {
400
+ var panel = arrPanelCpy_1_1.value;
401
+ this.doClose(panel);
402
+ }
403
+ }
404
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
405
+ finally {
406
+ try {
407
+ if (arrPanelCpy_1_1 && !arrPanelCpy_1_1.done && (_a = arrPanelCpy_1.return)) _a.call(arrPanelCpy_1);
408
+ }
409
+ finally { if (e_1) throw e_1.error; }
410
+ }
411
+ }
412
+ else {
413
+ this.accessor.removeGroup(this.groupPanel);
414
+ }
415
+ };
416
+ DockviewGroupPanelModel.prototype.closePanel = function (panel) {
417
+ this.doClose(panel);
418
+ };
419
+ DockviewGroupPanelModel.prototype.doClose = function (panel) {
420
+ this.accessor.removePanel(panel);
421
+ };
422
+ DockviewGroupPanelModel.prototype.isPanelActive = function (panel) {
423
+ return this._activePanel === panel;
424
+ };
425
+ DockviewGroupPanelModel.prototype.updateActions = function (element) {
426
+ this.tabsContainer.setRightActionsElement(element);
427
+ };
428
+ DockviewGroupPanelModel.prototype.setActive = function (isGroupActive, skipFocus, force) {
429
+ var _a, _b, _c, _d;
430
+ if (skipFocus === void 0) { skipFocus = false; }
431
+ if (force === void 0) { force = false; }
432
+ if (!force && this.isActive === isGroupActive) {
433
+ if (!skipFocus) {
434
+ (_b = (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.focus) === null || _b === void 0 ? void 0 : _b.call(_a);
435
+ }
436
+ return;
437
+ }
438
+ this._isGroupActive = isGroupActive;
439
+ (0, dom_1.toggleClass)(this.container, 'active-group', isGroupActive);
440
+ (0, dom_1.toggleClass)(this.container, 'inactive-group', !isGroupActive);
441
+ this.tabsContainer.setActive(this.isActive);
442
+ if (!this._activePanel && this.panels.length > 0) {
443
+ this.doSetActivePanel(this.panels[0]);
444
+ }
445
+ this.updateContainer();
446
+ if (isGroupActive) {
447
+ if (!skipFocus) {
448
+ (_d = (_c = this._activePanel) === null || _c === void 0 ? void 0 : _c.focus) === null || _d === void 0 ? void 0 : _d.call(_c);
449
+ }
450
+ }
451
+ };
452
+ DockviewGroupPanelModel.prototype.layout = function (width, height) {
453
+ var _a;
454
+ this._width = width;
455
+ this._height = height;
456
+ this.contentContainer.layout(this._width, this._height);
457
+ if ((_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.layout) {
458
+ this._activePanel.layout(this._width, this._height);
459
+ }
460
+ };
461
+ DockviewGroupPanelModel.prototype._removePanel = function (panel) {
462
+ var isActivePanel = this._activePanel === panel;
463
+ this.doRemovePanel(panel);
464
+ if (isActivePanel && this.panels.length > 0) {
465
+ var nextPanel = this.mostRecentlyUsed[0];
466
+ this.openPanel(nextPanel);
467
+ }
468
+ if (this._activePanel && this.panels.length === 0) {
469
+ this.doSetActivePanel(undefined);
470
+ }
471
+ this.updateContainer();
472
+ return panel;
473
+ };
474
+ DockviewGroupPanelModel.prototype.doRemovePanel = function (panel) {
475
+ var index = this.panels.indexOf(panel);
476
+ if (this._activePanel === panel) {
477
+ this.contentContainer.closePanel();
478
+ }
479
+ this.tabsContainer.delete(panel.id);
480
+ this._panels.splice(index, 1);
481
+ if (this.mostRecentlyUsed.includes(panel)) {
482
+ this.mostRecentlyUsed.splice(this.mostRecentlyUsed.indexOf(panel), 1);
483
+ }
484
+ this._onDidRemovePanel.fire({ panel: panel });
485
+ };
486
+ DockviewGroupPanelModel.prototype.doAddPanel = function (panel, index, skipSetActive) {
487
+ if (index === void 0) { index = this.panels.length; }
488
+ if (skipSetActive === void 0) { skipSetActive = false; }
489
+ var existingPanel = this._panels.indexOf(panel);
490
+ var hasExistingPanel = existingPanel > -1;
491
+ this.tabsContainer.openPanel(panel, index);
492
+ if (!skipSetActive) {
493
+ this.contentContainer.openPanel(panel);
494
+ }
495
+ this.tabsContainer.show();
496
+ this.contentContainer.show();
497
+ if (hasExistingPanel) {
498
+ // TODO - need to ensure ordering hasn't changed and if it has need to re-order this.panels
499
+ return;
500
+ }
501
+ this.updateMru(panel);
502
+ this.panels.splice(index, 0, panel);
503
+ this._onDidAddPanel.fire({ panel: panel });
504
+ };
505
+ DockviewGroupPanelModel.prototype.doSetActivePanel = function (panel) {
506
+ this._activePanel = panel;
507
+ if (panel) {
508
+ this.tabsContainer.setActivePanel(panel);
509
+ panel.layout(this._width, this._height);
510
+ this.updateMru(panel);
511
+ this._onDidActivePanelChange.fire({ panel: panel });
512
+ }
513
+ };
514
+ DockviewGroupPanelModel.prototype.updateMru = function (panel) {
515
+ if (this.mostRecentlyUsed.includes(panel)) {
516
+ this.mostRecentlyUsed.splice(this.mostRecentlyUsed.indexOf(panel), 1);
517
+ }
518
+ this.mostRecentlyUsed = __spreadArray([panel], __read(this.mostRecentlyUsed), false);
519
+ };
520
+ DockviewGroupPanelModel.prototype.updateContainer = function () {
521
+ var _this = this;
522
+ var _a, _b;
523
+ (0, dom_1.toggleClass)(this.container, 'empty', this.isEmpty);
524
+ this.panels.forEach(function (panel) {
525
+ return panel.updateParentGroup(_this.groupPanel, _this.isActive);
526
+ });
527
+ if (this.isEmpty && !this.watermark) {
528
+ var watermark = this.accessor.createWatermarkComponent();
529
+ watermark.init({
530
+ containerApi: new component_api_1.DockviewApi(this.accessor),
531
+ group: this.groupPanel,
532
+ });
533
+ this.watermark = watermark;
534
+ (0, events_1.addDisposableListener)(this.watermark.element, 'click', function () {
535
+ if (!_this.isActive) {
536
+ _this.accessor.doSetGroupActive(_this.groupPanel);
537
+ }
538
+ });
539
+ this.tabsContainer.hide();
540
+ this.contentContainer.element.appendChild(this.watermark.element);
541
+ this.watermark.updateParentGroup(this.groupPanel, true);
542
+ }
543
+ if (!this.isEmpty && this.watermark) {
544
+ this.watermark.element.remove();
545
+ (_b = (_a = this.watermark).dispose) === null || _b === void 0 ? void 0 : _b.call(_a);
546
+ this.watermark = undefined;
547
+ this.tabsContainer.show();
548
+ }
549
+ };
550
+ DockviewGroupPanelModel.prototype.canDisplayOverlay = function (event, position, target) {
551
+ // custom overlay handler
552
+ if (this.accessor.options.showDndOverlay) {
553
+ return this.accessor.options.showDndOverlay({
554
+ nativeEvent: event,
555
+ target: target,
556
+ group: this.accessor.getPanel(this.id),
557
+ position: position,
558
+ getData: dataTransfer_1.getPanelData,
559
+ });
560
+ }
561
+ return false;
562
+ };
563
+ DockviewGroupPanelModel.prototype.handleDropEvent = function (event, position, index) {
564
+ if (this.locked === 'no-drop-target') {
565
+ return;
566
+ }
567
+ var data = (0, dataTransfer_1.getPanelData)();
568
+ if (data && data.viewId === this.accessor.id) {
569
+ if (data.panelId === null) {
570
+ // this is a group move dnd event
571
+ var groupId_1 = data.groupId;
572
+ this._onMove.fire({
573
+ target: position,
574
+ groupId: groupId_1,
575
+ index: index,
576
+ });
577
+ return;
578
+ }
579
+ var fromSameGroup = this.tabsContainer.indexOf(data.panelId) !== -1;
580
+ if (fromSameGroup && this.tabsContainer.size === 1) {
581
+ return;
582
+ }
583
+ var groupId = data.groupId, panelId = data.panelId;
584
+ var isSameGroup = this.id === groupId;
585
+ if (isSameGroup && !position) {
586
+ var oldIndex = this.tabsContainer.indexOf(panelId);
587
+ if (oldIndex === index) {
588
+ return;
589
+ }
590
+ }
591
+ this._onMove.fire({
592
+ target: position,
593
+ groupId: data.groupId,
594
+ itemId: data.panelId,
595
+ index: index,
596
+ });
597
+ }
598
+ else {
599
+ this._onDidDrop.fire({
600
+ nativeEvent: event,
601
+ position: position,
602
+ index: index,
603
+ getData: function () { return (0, dataTransfer_1.getPanelData)(); },
604
+ });
605
+ }
606
+ };
607
+ DockviewGroupPanelModel.prototype.dispose = function () {
608
+ var e_2, _a;
609
+ var _b, _c, _d;
610
+ _super.prototype.dispose.call(this);
611
+ (_b = this.watermark) === null || _b === void 0 ? void 0 : _b.element.remove();
612
+ (_d = (_c = this.watermark) === null || _c === void 0 ? void 0 : _c.dispose) === null || _d === void 0 ? void 0 : _d.call(_c);
613
+ try {
614
+ for (var _e = __values(this.panels), _f = _e.next(); !_f.done; _f = _e.next()) {
615
+ var panel = _f.value;
616
+ panel.dispose();
617
+ }
618
+ }
619
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
620
+ finally {
621
+ try {
622
+ if (_f && !_f.done && (_a = _e.return)) _a.call(_e);
623
+ }
624
+ finally { if (e_2) throw e_2.error; }
625
+ }
626
+ this.dropTarget.dispose();
627
+ this.tabsContainer.dispose();
628
+ this.contentContainer.dispose();
629
+ };
630
+ return DockviewGroupPanelModel;
631
+ }(lifecycle_1.CompositeDisposable));
632
+ exports.DockviewGroupPanelModel = DockviewGroupPanelModel;
622
633
  //# sourceMappingURL=dockviewGroupPanelModel.js.map