dockview-react 1.16.0 → 1.17.0

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.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * dockview-react
3
- * @version 1.16.0
3
+ * @version 1.17.0
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -555,6 +555,42 @@
555
555
  },
556
556
  };
557
557
  }
558
+ function getDockviewTheme(element) {
559
+ function toClassList(element) {
560
+ const list = [];
561
+ for (let i = 0; i < element.classList.length; i++) {
562
+ list.push(element.classList.item(i));
563
+ }
564
+ return list;
565
+ }
566
+ let theme = undefined;
567
+ let parent = element;
568
+ while (parent !== null) {
569
+ theme = toClassList(parent).find((cls) => cls.startsWith('dockview-theme-'));
570
+ if (typeof theme === 'string') {
571
+ break;
572
+ }
573
+ parent = parent.parentElement;
574
+ }
575
+ return theme;
576
+ }
577
+ class Classnames {
578
+ constructor(element) {
579
+ this.element = element;
580
+ this._classNames = [];
581
+ }
582
+ setClassNames(classNames) {
583
+ for (const className of this._classNames) {
584
+ toggleClass(this.element, className, false);
585
+ }
586
+ this._classNames = classNames
587
+ .split(' ')
588
+ .filter((v) => v.trim().length > 0);
589
+ for (const className of this._classNames) {
590
+ toggleClass(this.element, className, true);
591
+ }
592
+ }
593
+ }
558
594
 
559
595
  function tail(arr) {
560
596
  if (arr.length === 0) {
@@ -2674,7 +2710,8 @@
2674
2710
  set locked(value) {
2675
2711
  this.gridview.locked = value;
2676
2712
  }
2677
- constructor(options) {
2713
+ constructor(parentElement, options) {
2714
+ var _a;
2678
2715
  super(document.createElement('div'), options.disableAutoResizing);
2679
2716
  this._id = nextLayoutId$1.next();
2680
2717
  this._groups = new Map();
@@ -2690,10 +2727,9 @@
2690
2727
  this.onDidViewVisibilityChangeMicroTaskQueue = this._onDidViewVisibilityChangeMicroTaskQueue.onEvent;
2691
2728
  this.element.style.height = '100%';
2692
2729
  this.element.style.width = '100%';
2693
- if (typeof options.className === 'string') {
2694
- this.element.classList.add(options.className);
2695
- }
2696
- options.parentElement.appendChild(this.element);
2730
+ this._classNames = new Classnames(this.element);
2731
+ this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
2732
+ parentElement.appendChild(this.element);
2697
2733
  this.gridview = new Gridview(!!options.proportionalLayout, options.styles, options.orientation, options.locked, options.margin);
2698
2734
  this.gridview.locked = !!options.locked;
2699
2735
  this.element.appendChild(this.gridview.element);
@@ -2716,6 +2752,25 @@
2716
2752
  isVisible(panel) {
2717
2753
  return this.gridview.isViewVisible(getGridLocation(panel.element));
2718
2754
  }
2755
+ updateOptions(options) {
2756
+ var _a, _b, _c, _d;
2757
+ if (typeof options.proportionalLayout === 'boolean') ;
2758
+ if (options.orientation) {
2759
+ this.gridview.orientation = options.orientation;
2760
+ }
2761
+ if ('disableResizing' in options) {
2762
+ this.disableResizing = (_a = options.disableAutoResizing) !== null && _a !== void 0 ? _a : false;
2763
+ }
2764
+ if ('locked' in options) {
2765
+ this.locked = (_b = options.locked) !== null && _b !== void 0 ? _b : false;
2766
+ }
2767
+ if ('margin' in options) {
2768
+ this.gridview.margin = (_c = options.margin) !== null && _c !== void 0 ? _c : 0;
2769
+ }
2770
+ if ('className' in options) {
2771
+ this._classNames.setClassNames((_d = options.className) !== null && _d !== void 0 ? _d : '');
2772
+ }
2773
+ }
2719
2774
  maximizeGroup(panel) {
2720
2775
  this.gridview.maximizeView(panel);
2721
2776
  this.doSetGroupActive(panel);
@@ -4639,7 +4694,7 @@
4639
4694
  this.onWillShowOverlay = this.dropTarget.onWillShowOverlay;
4640
4695
  this.addDisposables(this._onChanged, this._onDropped, this._onDragStart, dragHandler.onDragStart((event) => {
4641
4696
  this._onDragStart.fire(event);
4642
- }), dragHandler, addDisposableListener(this._element, 'mousedown', (event) => {
4697
+ }), dragHandler, addDisposableListener(this._element, 'pointerdown', (event) => {
4643
4698
  if (event.defaultPrevented) {
4644
4699
  return;
4645
4700
  }
@@ -4681,7 +4736,7 @@
4681
4736
  this.accessor = accessor;
4682
4737
  this.group = group;
4683
4738
  this.panelTransfer = LocalSelectionTransfer.getInstance();
4684
- this.addDisposables(addDisposableListener(element, 'mousedown', (e) => {
4739
+ this.addDisposables(addDisposableListener(element, 'pointerdown', (e) => {
4685
4740
  if (e.shiftKey) {
4686
4741
  /**
4687
4742
  * You cannot call e.preventDefault() because that will prevent drag events from firing
@@ -4900,7 +4955,7 @@
4900
4955
  group: this.group,
4901
4956
  getData: getPanelData,
4902
4957
  }));
4903
- }), addDisposableListener(this.voidContainer.element, 'mousedown', (event) => {
4958
+ }), addDisposableListener(this.voidContainer.element, 'pointerdown', (event) => {
4904
4959
  const isFloatingGroupsEnabled = !this.accessor.options.disableFloatingGroups;
4905
4960
  if (isFloatingGroupsEnabled &&
4906
4961
  event.shiftKey &&
@@ -4914,7 +4969,7 @@
4914
4969
  inDragMode: true,
4915
4970
  });
4916
4971
  }
4917
- }), addDisposableListener(this.tabContainer, 'mousedown', (event) => {
4972
+ }), addDisposableListener(this.tabContainer, 'pointerdown', (event) => {
4918
4973
  if (event.defaultPrevented) {
4919
4974
  return;
4920
4975
  }
@@ -5619,7 +5674,6 @@
5619
5674
  });
5620
5675
  this.tabsContainer.hide();
5621
5676
  this.contentContainer.element.appendChild(this.watermark.element);
5622
- this.watermark.updateParentGroup(this.groupPanel, true);
5623
5677
  }
5624
5678
  if (!this.isEmpty && this.watermark) {
5625
5679
  this.watermark.element.remove();
@@ -5982,6 +6036,34 @@
5982
6036
  const MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH = 100;
5983
6037
  const MINIMUM_DOCKVIEW_GROUP_PANEL_HEIGHT = 100;
5984
6038
  class DockviewGroupPanel extends GridviewPanel {
6039
+ get minimumWidth() {
6040
+ var _a;
6041
+ const activePanelMinimumWidth = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.minimumWidth;
6042
+ return typeof activePanelMinimumWidth === 'number'
6043
+ ? activePanelMinimumWidth
6044
+ : MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH;
6045
+ }
6046
+ get minimumHeight() {
6047
+ var _a;
6048
+ const activePanelMinimumHeight = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.minimumHeight;
6049
+ return typeof activePanelMinimumHeight === 'number'
6050
+ ? activePanelMinimumHeight
6051
+ : MINIMUM_DOCKVIEW_GROUP_PANEL_HEIGHT;
6052
+ }
6053
+ get maximumWidth() {
6054
+ var _a;
6055
+ const activePanelMaximumWidth = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.maximumWidth;
6056
+ return typeof activePanelMaximumWidth === 'number'
6057
+ ? activePanelMaximumWidth
6058
+ : Number.MAX_SAFE_INTEGER;
6059
+ }
6060
+ get maximumHeight() {
6061
+ var _a;
6062
+ const activePanelMaximumHeight = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.maximumHeight;
6063
+ return typeof activePanelMaximumHeight === 'number'
6064
+ ? activePanelMaximumHeight
6065
+ : Number.MAX_SAFE_INTEGER;
6066
+ }
5985
6067
  get panels() {
5986
6068
  return this._model.panels;
5987
6069
  }
@@ -6004,9 +6086,12 @@
6004
6086
  return this._model.header;
6005
6087
  }
6006
6088
  constructor(accessor, id, options) {
6089
+ var _a, _b, _c, _d, _e, _f;
6007
6090
  super(id, 'groupview_default', {
6008
- minimumHeight: MINIMUM_DOCKVIEW_GROUP_PANEL_HEIGHT,
6009
- minimumWidth: MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH,
6091
+ minimumHeight: (_b = (_a = options.constraints) === null || _a === void 0 ? void 0 : _a.minimumHeight) !== null && _b !== void 0 ? _b : MINIMUM_DOCKVIEW_GROUP_PANEL_HEIGHT,
6092
+ minimumWidth: (_d = (_c = options.constraints) === null || _c === void 0 ? void 0 : _c.maximumHeight) !== null && _d !== void 0 ? _d : MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH,
6093
+ maximumHeight: (_e = options.constraints) === null || _e === void 0 ? void 0 : _e.maximumHeight,
6094
+ maximumWidth: (_f = options.constraints) === null || _f === void 0 ? void 0 : _f.maximumWidth,
6010
6095
  }, new DockviewGroupPanelApiImpl(id, accessor));
6011
6096
  this.api.initialize(this); // cannot use 'this' after after 'super' call
6012
6097
  this._model = new DockviewGroupPanelModel(this.element, accessor, id, options, this);
@@ -6162,6 +6247,18 @@
6162
6247
  var _a;
6163
6248
  return (_a = this._renderer) !== null && _a !== void 0 ? _a : this.accessor.renderer;
6164
6249
  }
6250
+ get minimumWidth() {
6251
+ return this._minimumWidth;
6252
+ }
6253
+ get minimumHeight() {
6254
+ return this._minimumHeight;
6255
+ }
6256
+ get maximumWidth() {
6257
+ return this._maximumWidth;
6258
+ }
6259
+ get maximumHeight() {
6260
+ return this._maximumHeight;
6261
+ }
6165
6262
  constructor(id, component, tabComponent, accessor, containerApi, group, view, options) {
6166
6263
  super();
6167
6264
  this.id = id;
@@ -6170,6 +6267,10 @@
6170
6267
  this.view = view;
6171
6268
  this._renderer = options.renderer;
6172
6269
  this._group = group;
6270
+ this._minimumWidth = options.minimumWidth;
6271
+ this._minimumHeight = options.minimumHeight;
6272
+ this._maximumWidth = options.maximumWidth;
6273
+ this._maximumHeight = options.maximumHeight;
6173
6274
  this.api = new DockviewPanelApiImpl(this, this._group, accessor, component, tabComponent);
6174
6275
  this.addDisposables(this.api.onActiveChange(() => {
6175
6276
  accessor.setActivePanel(this);
@@ -6206,6 +6307,10 @@
6206
6307
  : undefined,
6207
6308
  title: this.title,
6208
6309
  renderer: this._renderer,
6310
+ minimumHeight: this._minimumHeight,
6311
+ maximumHeight: this._maximumHeight,
6312
+ minimumWidth: this._minimumWidth,
6313
+ maximumWidth: this._maximumWidth,
6209
6314
  };
6210
6315
  }
6211
6316
  setTitle(title) {
@@ -6335,7 +6440,7 @@
6335
6440
  this.action.appendChild(createCloseButton());
6336
6441
  this._element.appendChild(this._content);
6337
6442
  this._element.appendChild(this.action);
6338
- this.addDisposables(addDisposableListener(this.action, 'mousedown', (ev) => {
6443
+ this.addDisposables(addDisposableListener(this.action, 'pointerdown', (ev) => {
6339
6444
  ev.preventDefault();
6340
6445
  }));
6341
6446
  this.render();
@@ -6345,7 +6450,7 @@
6345
6450
  this.addDisposables(params.api.onDidTitleChange((event) => {
6346
6451
  this._title = event.title;
6347
6452
  this.render();
6348
- }), addDisposableListener(this.action, 'mousedown', (ev) => {
6453
+ }), addDisposableListener(this.action, 'pointerdown', (ev) => {
6349
6454
  ev.preventDefault();
6350
6455
  }), addDisposableListener(this.action, 'click', (ev) => {
6351
6456
  if (ev.defaultPrevented) {
@@ -6446,6 +6551,10 @@
6446
6551
  const view = new DockviewPanelModel(this.accessor, panelId, contentComponent, tabComponent);
6447
6552
  const panel = new DockviewPanel(panelId, contentComponent, tabComponent, this.accessor, new DockviewApi(this.accessor), group, view, {
6448
6553
  renderer: panelData.renderer,
6554
+ minimumWidth: panelData.minimumWidth,
6555
+ minimumHeight: panelData.minimumHeight,
6556
+ maximumWidth: panelData.maximumWidth,
6557
+ maximumHeight: panelData.maximumHeight,
6449
6558
  });
6450
6559
  panel.init({
6451
6560
  title: title !== null && title !== void 0 ? title : panelId,
@@ -6479,34 +6588,19 @@
6479
6588
  actionsContainer.appendChild(closeAnchor);
6480
6589
  title.appendChild(emptySpace);
6481
6590
  title.appendChild(actionsContainer);
6482
- this.addDisposables(addDisposableListener(closeAnchor, 'click', (ev) => {
6591
+ this.addDisposables(addDisposableListener(closeAnchor, 'click', (event) => {
6483
6592
  var _a;
6484
- ev.preventDefault();
6593
+ event.preventDefault();
6485
6594
  if (this._group) {
6486
6595
  (_a = this._api) === null || _a === void 0 ? void 0 : _a.removeGroup(this._group);
6487
6596
  }
6488
6597
  }));
6489
6598
  }
6490
- update(_event) {
6491
- // noop
6492
- }
6493
- focus() {
6494
- // noop
6495
- }
6496
- layout(_width, _height) {
6497
- // noop
6498
- }
6499
6599
  init(_params) {
6500
6600
  this._api = _params.containerApi;
6601
+ this._group = _params.group;
6501
6602
  this.render();
6502
6603
  }
6503
- updateParentGroup(group, _visible) {
6504
- this._group = group;
6505
- this.render();
6506
- }
6507
- dispose() {
6508
- super.dispose();
6509
- }
6510
6604
  render() {
6511
6605
  const isOneGroup = !!(this._api && this._api.size <= 1);
6512
6606
  toggleClass(this.element, 'has-actions', isOneGroup);
@@ -6665,7 +6759,7 @@
6665
6759
  dispose: () => {
6666
6760
  iframes.release();
6667
6761
  },
6668
- }, addDisposableWindowListener(window, 'mousemove', (e) => {
6762
+ }, addDisposableWindowListener(window, 'pointermove', (e) => {
6669
6763
  const containerRect = this.options.container.getBoundingClientRect();
6670
6764
  const x = e.clientX - containerRect.left;
6671
6765
  const y = e.clientY - containerRect.top;
@@ -6708,7 +6802,7 @@
6708
6802
  this._onDidChangeEnd.fire();
6709
6803
  }));
6710
6804
  };
6711
- this.addDisposables(move, addDisposableListener(dragTarget, 'mousedown', (event) => {
6805
+ this.addDisposables(move, addDisposableListener(dragTarget, 'pointerdown', (event) => {
6712
6806
  if (event.defaultPrevented) {
6713
6807
  event.preventDefault();
6714
6808
  return;
@@ -6719,7 +6813,7 @@
6719
6813
  return;
6720
6814
  }
6721
6815
  track();
6722
- }), addDisposableListener(this.options.content, 'mousedown', (event) => {
6816
+ }), addDisposableListener(this.options.content, 'pointerdown', (event) => {
6723
6817
  if (event.defaultPrevented) {
6724
6818
  return;
6725
6819
  }
@@ -6731,7 +6825,7 @@
6731
6825
  if (event.shiftKey) {
6732
6826
  track();
6733
6827
  }
6734
- }), addDisposableListener(this.options.content, 'mousedown', () => {
6828
+ }), addDisposableListener(this.options.content, 'pointerdown', () => {
6735
6829
  arialLevelTracker.push(this._element);
6736
6830
  }, true));
6737
6831
  if (options.inDragMode) {
@@ -6743,11 +6837,11 @@
6743
6837
  resizeHandleElement.className = `dv-resize-handle-${direction}`;
6744
6838
  this._element.appendChild(resizeHandleElement);
6745
6839
  const move = new MutableDisposable();
6746
- this.addDisposables(move, addDisposableListener(resizeHandleElement, 'mousedown', (e) => {
6840
+ this.addDisposables(move, addDisposableListener(resizeHandleElement, 'pointerdown', (e) => {
6747
6841
  e.preventDefault();
6748
6842
  let startPosition = null;
6749
6843
  const iframes = disableIframePointEvents();
6750
- move.value = new CompositeDisposable(addDisposableWindowListener(window, 'mousemove', (e) => {
6844
+ move.value = new CompositeDisposable(addDisposableWindowListener(window, 'pointermove', (e) => {
6751
6845
  const containerRect = this.options.container.getBoundingClientRect();
6752
6846
  const overlayRect = this._element.getBoundingClientRect();
6753
6847
  const y = e.clientY - containerRect.top;
@@ -7229,25 +7323,6 @@
7229
7323
  });
7230
7324
  });
7231
7325
  }
7232
- function getDockviewTheme(element) {
7233
- function toClassList(element) {
7234
- const list = [];
7235
- for (let i = 0; i < element.classList.length; i++) {
7236
- list.push(element.classList.item(i));
7237
- }
7238
- return list;
7239
- }
7240
- let theme = undefined;
7241
- let parent = element;
7242
- while (parent !== null) {
7243
- theme = toClassList(parent).find((cls) => cls.startsWith('dockview-theme-'));
7244
- if (typeof theme === 'string') {
7245
- break;
7246
- }
7247
- parent = parent.parentElement;
7248
- }
7249
- return theme;
7250
- }
7251
7326
  class DockviewComponent extends BaseGrid {
7252
7327
  get orientation() {
7253
7328
  return this.gridview.orientation;
@@ -7283,13 +7358,12 @@
7283
7358
  }
7284
7359
  constructor(parentElement, options) {
7285
7360
  var _a;
7286
- super({
7361
+ super(parentElement, {
7287
7362
  proportionalLayout: true,
7288
7363
  orientation: exports.Orientation.HORIZONTAL,
7289
7364
  styles: options.hideBorders
7290
7365
  ? { separatorBorder: 'transparent' }
7291
7366
  : undefined,
7292
- parentElement: parentElement,
7293
7367
  disableAutoResizing: options.disableAutoResizing,
7294
7368
  locked: options.locked,
7295
7369
  margin: options.gap,
@@ -7329,9 +7403,6 @@
7329
7403
  this._onDidActiveGroupChange = new Emitter();
7330
7404
  this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
7331
7405
  this._moving = false;
7332
- // const gready = document.createElement('div');
7333
- // gready.className = 'dv-overlay-render-container';
7334
- // this.gridview.element.appendChild(gready);
7335
7406
  this.overlayRenderContainer = new OverlayRenderContainer(this.gridview.element, this);
7336
7407
  toggleClass(this.gridview.element, 'dv-dockview', true);
7337
7408
  toggleClass(this.element, 'dv-debug', !!options.debug);
@@ -7780,15 +7851,11 @@
7780
7851
  }
7781
7852
  }
7782
7853
  updateOptions(options) {
7783
- var _a, _b;
7784
- const changed_floatingGroupBounds = 'floatingGroupBounds' in options &&
7785
- options.floatingGroupBounds !== this.options.floatingGroupBounds;
7786
- const changed_rootOverlayOptions = 'rootOverlayModel' in options &&
7787
- options.rootOverlayModel !== this.options.rootOverlayModel;
7788
- this._options = Object.assign(Object.assign({}, this.options), options);
7789
- if (changed_floatingGroupBounds) {
7854
+ var _a, _b, _c, _d;
7855
+ super.updateOptions(options);
7856
+ if ('floatingGroupBounds' in options) {
7790
7857
  for (const group of this._floatingGroups) {
7791
- switch (this.options.floatingGroupBounds) {
7858
+ switch (options.floatingGroupBounds) {
7792
7859
  case 'boundedWithinViewport':
7793
7860
  group.overlay.minimumInViewportHeight = undefined;
7794
7861
  group.overlay.minimumInViewportWidth = undefined;
@@ -7801,25 +7868,20 @@
7801
7868
  break;
7802
7869
  default:
7803
7870
  group.overlay.minimumInViewportHeight =
7804
- (_a = this.options.floatingGroupBounds) === null || _a === void 0 ? void 0 : _a.minimumHeightWithinViewport;
7871
+ (_a = options.floatingGroupBounds) === null || _a === void 0 ? void 0 : _a.minimumHeightWithinViewport;
7805
7872
  group.overlay.minimumInViewportWidth =
7806
- (_b = this.options.floatingGroupBounds) === null || _b === void 0 ? void 0 : _b.minimumWidthWithinViewport;
7873
+ (_b = options.floatingGroupBounds) === null || _b === void 0 ? void 0 : _b.minimumWidthWithinViewport;
7807
7874
  }
7808
7875
  group.overlay.setBounds();
7809
7876
  }
7810
7877
  }
7811
- if (changed_rootOverlayOptions) {
7812
- this._rootDropTarget.setOverlayModel(options.rootOverlayModel);
7878
+ if ('rootOverlayModel' in options) {
7879
+ this._rootDropTarget.setOverlayModel((_c = options.rootOverlayModel) !== null && _c !== void 0 ? _c : DEFAULT_ROOT_OVERLAY_MODEL);
7813
7880
  }
7814
- if (
7815
- // if explicitly set as `undefined`
7816
- 'gap' in options &&
7817
- options.gap === undefined) {
7818
- this.gridview.margin = 0;
7819
- }
7820
- if (typeof options.gap === 'number') {
7821
- this.gridview.margin = options.gap;
7881
+ if ('gap' in options) {
7882
+ this.gridview.margin = (_d = options.gap) !== null && _d !== void 0 ? _d : 0;
7822
7883
  }
7884
+ this._options = Object.assign(Object.assign({}, this.options), options);
7823
7885
  this.layout(this.gridview.width, this.gridview.height, true);
7824
7886
  }
7825
7887
  layout(width, height, forceResize) {
@@ -8076,6 +8138,10 @@
8076
8138
  if (options.position && options.floating) {
8077
8139
  throw new Error('you can only provide one of: position, floating as arguments to .addPanel(...)');
8078
8140
  }
8141
+ const initial = {
8142
+ width: options.initialWidth,
8143
+ height: options.initialHeight,
8144
+ };
8079
8145
  if (options.position) {
8080
8146
  if (isPanelOptionsWithPanel(options.position)) {
8081
8147
  const referencePanel = typeof options.position.referencePanel === 'string'
@@ -8105,6 +8171,10 @@
8105
8171
  if (!options.inactive) {
8106
8172
  this.doSetGroupAndPanelActive(group);
8107
8173
  }
8174
+ group.api.setSize({
8175
+ height: initial === null || initial === void 0 ? void 0 : initial.height,
8176
+ width: initial === null || initial === void 0 ? void 0 : initial.width,
8177
+ });
8108
8178
  return panel;
8109
8179
  }
8110
8180
  }
@@ -8135,6 +8205,10 @@
8135
8205
  skipSetActive: options.inactive,
8136
8206
  skipSetGroupActive: options.inactive,
8137
8207
  });
8208
+ referenceGroup.api.setSize({
8209
+ width: initial === null || initial === void 0 ? void 0 : initial.width,
8210
+ height: initial === null || initial === void 0 ? void 0 : initial.height,
8211
+ });
8138
8212
  if (!options.inactive) {
8139
8213
  this.doSetGroupAndPanelActive(referenceGroup);
8140
8214
  }
@@ -8142,7 +8216,10 @@
8142
8216
  else {
8143
8217
  const location = getGridLocation(referenceGroup.element);
8144
8218
  const relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
8145
- const group = this.createGroupAtLocation(relativeLocation);
8219
+ const group = this.createGroupAtLocation(relativeLocation, this.orientationAtLocation(relativeLocation) ===
8220
+ exports.Orientation.VERTICAL
8221
+ ? initial === null || initial === void 0 ? void 0 : initial.height
8222
+ : initial === null || initial === void 0 ? void 0 : initial.width);
8146
8223
  panel = this.createPanel(options, group);
8147
8224
  group.model.openPanel(panel, {
8148
8225
  skipSetActive: options.inactive,
@@ -8168,7 +8245,9 @@
8168
8245
  });
8169
8246
  }
8170
8247
  else {
8171
- const group = this.createGroupAtLocation();
8248
+ const group = this.createGroupAtLocation([0], this.gridview.orientation === exports.Orientation.VERTICAL
8249
+ ? initial === null || initial === void 0 ? void 0 : initial.height
8250
+ : initial === null || initial === void 0 ? void 0 : initial.width);
8172
8251
  panel = this.createPanel(options, group);
8173
8252
  group.model.openPanel(panel, {
8174
8253
  skipSetActive: options.inactive,
@@ -8262,7 +8341,11 @@
8262
8341
  const location = getGridLocation(referenceGroup.element);
8263
8342
  const relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
8264
8343
  const group = this.createGroup(options);
8265
- this.doAddGroup(group, relativeLocation);
8344
+ const size = this.getLocationOrientation(relativeLocation) ===
8345
+ exports.Orientation.VERTICAL
8346
+ ? options.initialHeight
8347
+ : options.initialWidth;
8348
+ this.doAddGroup(group, relativeLocation, size);
8266
8349
  if (!options.skipSetActive) {
8267
8350
  this.doSetGroupAndPanelActive(group);
8268
8351
  }
@@ -8275,6 +8358,12 @@
8275
8358
  return group;
8276
8359
  }
8277
8360
  }
8361
+ getLocationOrientation(location) {
8362
+ return location.length % 2 == 0 &&
8363
+ this.gridview.orientation === exports.Orientation.HORIZONTAL
8364
+ ? exports.Orientation.HORIZONTAL
8365
+ : exports.Orientation.VERTICAL;
8366
+ }
8278
8367
  removeGroup(group, options) {
8279
8368
  this.doRemoveGroup(group, options);
8280
8369
  }
@@ -8546,7 +8635,22 @@
8546
8635
  }
8547
8636
  const referenceLocation = getGridLocation(to.element);
8548
8637
  const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
8549
- this.gridview.addView(from, exports.Sizing.Distribute, dropLocation);
8638
+ let size;
8639
+ switch (this.gridview.orientation) {
8640
+ case exports.Orientation.VERTICAL:
8641
+ size =
8642
+ referenceLocation.length % 2 == 0
8643
+ ? from.api.width
8644
+ : from.api.height;
8645
+ break;
8646
+ case exports.Orientation.HORIZONTAL:
8647
+ size =
8648
+ referenceLocation.length % 2 == 0
8649
+ ? from.api.height
8650
+ : from.api.width;
8651
+ break;
8652
+ }
8653
+ this.gridview.addView(from, size, dropLocation);
8550
8654
  }
8551
8655
  from.panels.forEach((panel) => {
8552
8656
  this._onDidMovePanel.fire({ panel, from });
@@ -8658,22 +8762,34 @@
8658
8762
  const contentComponent = options.component;
8659
8763
  const tabComponent = (_a = options.tabComponent) !== null && _a !== void 0 ? _a : this.options.defaultTabComponent;
8660
8764
  const view = new DockviewPanelModel(this, options.id, contentComponent, tabComponent);
8661
- const panel = new DockviewPanel(options.id, contentComponent, tabComponent, this, this._api, group, view, { renderer: options.renderer });
8765
+ const panel = new DockviewPanel(options.id, contentComponent, tabComponent, this, this._api, group, view, {
8766
+ renderer: options.renderer,
8767
+ minimumWidth: options.minimumWidth,
8768
+ minimumHeight: options.minimumHeight,
8769
+ maximumWidth: options.maximumWidth,
8770
+ maximumHeight: options.maximumHeight,
8771
+ });
8662
8772
  panel.init({
8663
8773
  title: (_b = options.title) !== null && _b !== void 0 ? _b : options.id,
8664
8774
  params: (_c = options === null || options === void 0 ? void 0 : options.params) !== null && _c !== void 0 ? _c : {},
8665
8775
  });
8666
8776
  return panel;
8667
8777
  }
8668
- createGroupAtLocation(location = [0]) {
8778
+ createGroupAtLocation(location, size) {
8669
8779
  const group = this.createGroup();
8670
- this.doAddGroup(group, location);
8780
+ this.doAddGroup(group, location, size);
8671
8781
  return group;
8672
8782
  }
8673
8783
  findGroup(panel) {
8674
8784
  var _a;
8675
8785
  return (_a = Array.from(this._groups.values()).find((group) => group.value.model.containsPanel(panel))) === null || _a === void 0 ? void 0 : _a.value;
8676
8786
  }
8787
+ orientationAtLocation(location) {
8788
+ const rootOrientation = this.gridview.orientation;
8789
+ return location.length % 2 == 1
8790
+ ? rootOrientation
8791
+ : orthogonal(rootOrientation);
8792
+ }
8677
8793
  }
8678
8794
 
8679
8795
  class GridviewComponent extends BaseGrid {
@@ -8693,8 +8809,7 @@
8693
8809
  this._deserializer = value;
8694
8810
  }
8695
8811
  constructor(parentElement, options) {
8696
- super({
8697
- parentElement: parentElement,
8812
+ super(parentElement, {
8698
8813
  proportionalLayout: options.proportionalLayout,
8699
8814
  orientation: options.orientation,
8700
8815
  styles: options.styles,
@@ -8725,6 +8840,7 @@
8725
8840
  }
8726
8841
  }
8727
8842
  updateOptions(options) {
8843
+ super.updateOptions(options);
8728
8844
  const hasOrientationChanged = typeof options.orientation === 'string' &&
8729
8845
  this.gridview.orientation !== options.orientation;
8730
8846
  this._options = Object.assign(Object.assign({}, this.options), options);
@@ -8992,6 +9108,7 @@
8992
9108
  : this.splitview.orthogonalSize;
8993
9109
  }
8994
9110
  constructor(parentElement, options) {
9111
+ var _a;
8995
9112
  super(parentElement, options.disableAutoResizing);
8996
9113
  this._splitviewChangeDisposable = new MutableDisposable();
8997
9114
  this._panels = new Map();
@@ -9003,9 +9120,8 @@
9003
9120
  this.onDidRemoveView = this._onDidRemoveView.event;
9004
9121
  this._onDidLayoutChange = new Emitter();
9005
9122
  this.onDidLayoutChange = this._onDidLayoutChange.event;
9006
- if (typeof options.className === 'string') {
9007
- this.element.classList.add(options.className);
9008
- }
9123
+ this._classNames = new Classnames(this.element);
9124
+ this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
9009
9125
  this._options = options;
9010
9126
  if (!options.components) {
9011
9127
  options.components = {};
@@ -9017,12 +9133,17 @@
9017
9133
  this.addDisposables(this._onDidAddView, this._onDidLayoutfromJSON, this._onDidRemoveView, this._onDidLayoutChange);
9018
9134
  }
9019
9135
  updateOptions(options) {
9020
- const hasOrientationChanged = typeof options.orientation === 'string' &&
9021
- this.options.orientation !== options.orientation;
9022
- this._options = Object.assign(Object.assign({}, this.options), options);
9023
- if (hasOrientationChanged) {
9136
+ var _a, _b;
9137
+ if ('className' in options) {
9138
+ this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
9139
+ }
9140
+ if ('disableResizing' in options) {
9141
+ this.disableResizing = (_b = options.disableAutoResizing) !== null && _b !== void 0 ? _b : false;
9142
+ }
9143
+ if (typeof options.orientation === 'string') {
9024
9144
  this.splitview.orientation = options.orientation;
9025
9145
  }
9146
+ this._options = Object.assign(Object.assign({}, this.options), options);
9026
9147
  this.splitview.layout(this.splitview.size, this.splitview.orthogonalSize);
9027
9148
  }
9028
9149
  focus() {
@@ -9319,6 +9440,7 @@
9319
9440
  return this._options;
9320
9441
  }
9321
9442
  constructor(parentElement, options) {
9443
+ var _a;
9322
9444
  super(parentElement, options.disableAutoResizing);
9323
9445
  this._id = nextLayoutId.next();
9324
9446
  this._disposable = new MutableDisposable();
@@ -9333,10 +9455,9 @@
9333
9455
  this.onDidAddView = this._onDidAddView.event;
9334
9456
  this._onDidRemoveView = new Emitter();
9335
9457
  this.onDidRemoveView = this._onDidRemoveView.event;
9336
- if (typeof options.className === 'string') {
9337
- this.element.classList.add(options.className);
9338
- }
9339
9458
  this.addDisposables(this._onDidLayoutChange, this._onDidLayoutfromJSON, this._onDidDrop, this._onDidAddView, this._onDidRemoveView);
9459
+ this._classNames = new Classnames(this.element);
9460
+ this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
9340
9461
  this._options = options;
9341
9462
  if (!options.components) {
9342
9463
  options.components = {};
@@ -9358,6 +9479,13 @@
9358
9479
  //noop
9359
9480
  }
9360
9481
  updateOptions(options) {
9482
+ var _a, _b;
9483
+ if ('className' in options) {
9484
+ this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
9485
+ }
9486
+ if ('disableResizing' in options) {
9487
+ this.disableResizing = (_b = options.disableAutoResizing) !== null && _b !== void 0 ? _b : false;
9488
+ }
9361
9489
  this._options = Object.assign(Object.assign({}, this.options), options);
9362
9490
  }
9363
9491
  addPanel(options) {
@@ -9906,9 +10034,6 @@
9906
10034
  layout(_width, _height) {
9907
10035
  // noop - retrieval from api
9908
10036
  }
9909
- updateParentGroup(_group, _isPanelVisible) {
9910
- // noop
9911
- }
9912
10037
  dispose() {
9913
10038
  var _a;
9914
10039
  (_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();
@@ -10221,7 +10346,7 @@
10221
10346
  api.close();
10222
10347
  }
10223
10348
  }, [api, closeActionOverride]);
10224
- const onMouseDown = React.useCallback((e) => {
10349
+ const onPointerDown = React.useCallback((e) => {
10225
10350
  e.preventDefault();
10226
10351
  }, []);
10227
10352
  const onClick = React.useCallback((event) => {
@@ -10235,7 +10360,7 @@
10235
10360
  }, [api, rest.onClick]);
10236
10361
  return (React.createElement("div", Object.assign({ "data-testid": "dockview-dv-default-tab" }, rest, { onClick: onClick, className: "dv-default-tab" }),
10237
10362
  React.createElement("span", { className: "dv-default-tab-content" }, title),
10238
- !hideClose && (React.createElement("div", { className: "dv-default-tab-action", onMouseDown: onMouseDown, onClick: onClose },
10363
+ !hideClose && (React.createElement("div", { className: "dv-default-tab-action", onPointerDown: onPointerDown, onClick: onClose },
10239
10364
  React.createElement(CloseButton, null)))));
10240
10365
  };
10241
10366