igniteui-dockmanager 2.0.2-alpha.3 → 2.1.0-RC.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.
@@ -9,7 +9,7 @@ import { property } from 'lit/decorators.js';
9
9
  import { registerComponent } from '../../../common/definitions/register.js';
10
10
  import { EventEmitterMixin } from '../../../common/mixins/event-emitter.js';
11
11
  import { partNameMap } from '../../../utils/utils.js';
12
- import { IGC_DEFAULT_PANE_SIZE, IGC_DEFAULT_UNPIN_PANE_SIZE, } from '../dockmanager.interfaces.js';
12
+ import { IGC_DEFAULT_PANE_SIZE, IGC_DEFAULT_UNPIN_PANE_SIZE, IGC_RESIZING_MIN_SIZE, } from '../dockmanager.interfaces.js';
13
13
  import { styles } from './content-pane-component.base.css.js';
14
14
  class IgcContentPaneComponent extends EventEmitterMixin(LitElement) {
15
15
  constructor() {
@@ -22,6 +22,8 @@ class IgcContentPaneComponent extends EventEmitterMixin(LitElement) {
22
22
  this._size = IGC_DEFAULT_PANE_SIZE;
23
23
  this._unpinnedSize = IGC_DEFAULT_UNPIN_PANE_SIZE;
24
24
  this.header = '';
25
+ this._minResizeWidth = IGC_RESIZING_MIN_SIZE;
26
+ this._minResizeHeight = IGC_RESIZING_MIN_SIZE;
25
27
  }
26
28
  static register() {
27
29
  registerComponent(IgcContentPaneComponent);
@@ -75,6 +77,20 @@ class IgcContentPaneComponent extends EventEmitterMixin(LitElement) {
75
77
  get unpinnedSize() {
76
78
  return this._unpinnedSize;
77
79
  }
80
+ set minResizeWidth(value) {
81
+ this._minResizeWidth =
82
+ value !== undefined && value > 0 ? value : IGC_RESIZING_MIN_SIZE;
83
+ }
84
+ get minResizeWidth() {
85
+ return this._minResizeWidth;
86
+ }
87
+ set minResizeHeight(value) {
88
+ this._minResizeHeight =
89
+ value !== undefined && value > 0 ? value : IGC_RESIZING_MIN_SIZE;
90
+ }
91
+ get minResizeHeight() {
92
+ return this._minResizeHeight;
93
+ }
78
94
  connectedCallback() {
79
95
  super.connectedCallback();
80
96
  this.setAttribute('role', 'group');
@@ -142,3 +158,9 @@ __decorate([
142
158
  __decorate([
143
159
  property({ type: Number, attribute: 'unpinned-size' })
144
160
  ], IgcContentPaneComponent.prototype, "unpinnedSize", null);
161
+ __decorate([
162
+ property({ type: Number, attribute: 'min-resize-width' })
163
+ ], IgcContentPaneComponent.prototype, "minResizeWidth", null);
164
+ __decorate([
165
+ property({ type: Number, attribute: 'min-resize-height' })
166
+ ], IgcContentPaneComponent.prototype, "minResizeHeight", null);
@@ -43,6 +43,24 @@ export default class IgcSplitPaneComponent extends IgcSplitPaneComponent_base {
43
43
  set parentUseFixedSize(value: boolean);
44
44
  get parentUseFixedSize(): boolean;
45
45
  size?: number;
46
+ private _minResizeWidth;
47
+ private _minResizeHeight;
48
+ /**
49
+ * The minimum width of child panes in pixels during resizing.
50
+ *
51
+ * @attr min-resize-width
52
+ * @default 42
53
+ */
54
+ set minResizeWidth(value: number | undefined);
55
+ get minResizeWidth(): number;
56
+ /**
57
+ * The minimum height of child panes in pixels during resizing.
58
+ *
59
+ * @attr min-resize-height
60
+ * @default 42
61
+ */
62
+ set minResizeHeight(value: number | undefined);
63
+ get minResizeHeight(): number;
46
64
  connectedCallback(): void;
47
65
  protected updated(): void;
48
66
  private _updateFlexStyle;
@@ -8,13 +8,15 @@ import { html, LitElement } from 'lit';
8
8
  import { property } from 'lit/decorators.js';
9
9
  import { registerComponent } from '../../../common/definitions/register.js';
10
10
  import { EventEmitterMixin } from '../../../common/mixins/event-emitter.js';
11
- import { IGC_DEFAULT_PANE_SIZE } from '../dockmanager.interfaces.js';
11
+ import { IGC_DEFAULT_PANE_SIZE, IGC_RESIZING_MIN_SIZE, } from '../dockmanager.interfaces.js';
12
12
  import { styles } from './split-pane-component.base.css.js';
13
13
  class IgcSplitPaneComponent extends EventEmitterMixin(LitElement) {
14
14
  constructor() {
15
15
  super(...arguments);
16
16
  this._parentUseFixedSize = false;
17
17
  this.useFixedSize = false;
18
+ this._minResizeWidth = IGC_RESIZING_MIN_SIZE;
19
+ this._minResizeHeight = IGC_RESIZING_MIN_SIZE;
18
20
  }
19
21
  static register() {
20
22
  registerComponent(IgcSplitPaneComponent);
@@ -33,6 +35,20 @@ class IgcSplitPaneComponent extends EventEmitterMixin(LitElement) {
33
35
  get parentUseFixedSize() {
34
36
  return this._parentUseFixedSize;
35
37
  }
38
+ set minResizeWidth(value) {
39
+ this._minResizeWidth =
40
+ value !== undefined && value > 0 ? value : IGC_RESIZING_MIN_SIZE;
41
+ }
42
+ get minResizeWidth() {
43
+ return this._minResizeWidth;
44
+ }
45
+ set minResizeHeight(value) {
46
+ this._minResizeHeight =
47
+ value !== undefined && value > 0 ? value : IGC_RESIZING_MIN_SIZE;
48
+ }
49
+ get minResizeHeight() {
50
+ return this._minResizeHeight;
51
+ }
36
52
  connectedCallback() {
37
53
  super.connectedCallback();
38
54
  this.setAttribute('part', 'split-pane');
@@ -42,8 +58,6 @@ class IgcSplitPaneComponent extends EventEmitterMixin(LitElement) {
42
58
  height: '100%',
43
59
  alignItems: 'stretch',
44
60
  boxSizing: 'border-box',
45
- minWidth: '0',
46
- minHeight: '0',
47
61
  overflow: 'auto',
48
62
  });
49
63
  }
@@ -83,3 +97,9 @@ __decorate([
83
97
  __decorate([
84
98
  property({ type: Number })
85
99
  ], IgcSplitPaneComponent.prototype, "size", void 0);
100
+ __decorate([
101
+ property({ type: Number, attribute: 'min-resize-width' })
102
+ ], IgcSplitPaneComponent.prototype, "minResizeWidth", null);
103
+ __decorate([
104
+ property({ type: Number, attribute: 'min-resize-height' })
105
+ ], IgcSplitPaneComponent.prototype, "minResizeHeight", null);
@@ -27,6 +27,7 @@ export default class IgcSplitterComponent extends IgcSplitterComponent_base {
27
27
  static styles: import("lit").CSSResult[];
28
28
  static register(): void;
29
29
  private _paneSizes;
30
+ private _paneMinSizes;
30
31
  private _flyoutMaxSize;
31
32
  private _dragService?;
32
33
  private resizeEndEmitted;
@@ -86,6 +87,7 @@ export default class IgcSplitterComponent extends IgcSplitterComponent_base {
86
87
  private _isArrowRight;
87
88
  private _isHorizontal;
88
89
  private _isVertical;
90
+ private _getMinSize;
89
91
  protected render(): import("lit-html").TemplateResult<1>;
90
92
  }
91
93
  declare global {
@@ -10,9 +10,9 @@ import { styleMap } from 'lit/directives/style-map.js';
10
10
  import { registerComponent } from '../../../common/definitions/register.js';
11
11
  import { EventEmitterMixin } from '../../../common/mixins/event-emitter.js';
12
12
  import { partNameMap } from '../../../common/util.js';
13
- import { closestElement, getDirection } from '../../../utils/utils.js';
13
+ import { calculatePaneMinSize, closestElement, getDirection, } from '../../../utils/utils.js';
14
14
  import { IgcDragService } from '../../drag-drop/drag.service.js';
15
- import { IGC_DEFAULT_RESIZE, IGC_RESIZING_MIN_SIZE, } from '../dockmanager.interfaces.js';
15
+ import { IGC_DEFAULT_RESIZE, IGC_DEFAULT_SPLITTER_SIZE, IGC_RESIZING_MIN_SIZE, } from '../dockmanager.interfaces.js';
16
16
  import { styles } from './splitter-component.css.js';
17
17
  const SCROLL_SPEED = 15;
18
18
  class IgcSplitterComponent extends EventEmitterMixin(LitElement) {
@@ -33,6 +33,7 @@ class IgcSplitterComponent extends EventEmitterMixin(LitElement) {
33
33
  constructor() {
34
34
  super();
35
35
  this._paneSizes = null;
36
+ this._paneMinSizes = null;
36
37
  this._flyoutMaxSize = 0;
37
38
  this.resizeEndEmitted = false;
38
39
  this._splitPaneOrientation = 'horizontal';
@@ -180,17 +181,30 @@ class IgcSplitterComponent extends EventEmitterMixin(LitElement) {
180
181
  const children = Array.from(parent.children);
181
182
  if (this.flyoutLocation) {
182
183
  const pane = children[0];
184
+ const rect = pane.getBoundingClientRect();
183
185
  this._paneSizes = [
184
- this._isHorizontal() ? pane.offsetWidth : pane.offsetHeight,
186
+ this._isHorizontal() ? Math.floor(rect.width) : Math.floor(rect.height),
185
187
  ];
188
+ const minSize = this._getMinSize(pane, this._isHorizontal() ? 'horizontal' : 'vertical');
189
+ this._paneMinSizes = [minSize];
190
+ const parentRect = parent.getBoundingClientRect();
191
+ const minMargin = 50;
186
192
  this._flyoutMaxSize = this._isHorizontal()
187
- ? parent.offsetWidth - IGC_RESIZING_MIN_SIZE
188
- : parent.offsetHeight - IGC_RESIZING_MIN_SIZE;
193
+ ? Math.floor(parentRect.width) - minMargin
194
+ : Math.floor(parentRect.height) - minMargin;
189
195
  }
190
196
  else {
191
197
  const index = children.indexOf(this);
192
198
  const panes = [children[index - 1], children[index + 1]];
193
- this._paneSizes = panes.map((p) => this._isHorizontal() ? p?.offsetWidth : p?.offsetHeight);
199
+ this._paneSizes = panes.map((p) => {
200
+ if (!p)
201
+ return 0;
202
+ const rect = p.getBoundingClientRect();
203
+ return this._isHorizontal()
204
+ ? Math.floor(rect.width)
205
+ : Math.floor(rect.height);
206
+ });
207
+ this._paneMinSizes = panes.map((p) => this._getMinSize(p, this._isHorizontal() ? 'horizontal' : 'vertical'));
194
208
  }
195
209
  }
196
210
  _dragEndHelper() {
@@ -198,6 +212,7 @@ class IgcSplitterComponent extends EventEmitterMixin(LitElement) {
198
212
  this.showDragGhost = false;
199
213
  this._dragOffset = 0;
200
214
  this._paneSizes = null;
215
+ this._paneMinSizes = null;
201
216
  this.emitEvent('igcResizeEnd', {
202
217
  detail: dragOffset,
203
218
  bubbles: true,
@@ -205,51 +220,70 @@ class IgcSplitterComponent extends EventEmitterMixin(LitElement) {
205
220
  this.resizeEndEmitted = true;
206
221
  }
207
222
  _constrainFlyoutResize() {
208
- if (!this._paneSizes)
223
+ if (!this._paneSizes || !this._paneMinSizes)
209
224
  return;
210
225
  const paneSize = this._paneSizes[0];
211
- const isStartLocation = this.flyoutLocation === 'left' || this.flyoutLocation === 'top';
226
+ const minSize = this._paneMinSizes[0];
227
+ const isRTL = this.isRTL;
228
+ const isHorizontal = this._isHorizontal();
229
+ let isStartLocation = this.flyoutLocation === 'left' || this.flyoutLocation === 'top';
230
+ if (isRTL && isHorizontal) {
231
+ if (this.flyoutLocation === 'left') {
232
+ isStartLocation = false;
233
+ }
234
+ else if (this.flyoutLocation === 'right') {
235
+ isStartLocation = true;
236
+ }
237
+ }
212
238
  const offset = isStartLocation ? this._dragOffset : -this._dragOffset;
213
- if (paneSize + offset < IGC_RESIZING_MIN_SIZE) {
214
- const minOffset = paneSize - IGC_RESIZING_MIN_SIZE;
215
- this._dragOffset = isStartLocation ? -minOffset : minOffset;
239
+ const newSize = paneSize + offset;
240
+ if (paneSize >= minSize) {
241
+ if (newSize < minSize) {
242
+ const minOffset = minSize - paneSize;
243
+ this._dragOffset = isStartLocation ? minOffset : -minOffset;
244
+ }
245
+ else if (newSize > this._flyoutMaxSize) {
246
+ const maxOffset = this._flyoutMaxSize - paneSize;
247
+ this._dragOffset = isStartLocation ? maxOffset : -maxOffset;
248
+ }
216
249
  }
217
- else if (paneSize + offset > this._flyoutMaxSize) {
250
+ else if (offset < 0) {
251
+ this._dragOffset = 0;
252
+ }
253
+ else if (newSize > this._flyoutMaxSize) {
218
254
  const maxOffset = this._flyoutMaxSize - paneSize;
219
255
  this._dragOffset = isStartLocation ? maxOffset : -maxOffset;
220
256
  }
221
257
  }
222
258
  _constrainSplitPaneResize() {
223
- if (!this._paneSizes)
259
+ if (!this._paneSizes || !this._paneMinSizes)
224
260
  return;
225
261
  const rtl = this.isRTL;
226
262
  const isVertical = this._isVertical();
227
263
  if (this._dragOffset < 0) {
228
264
  if (!isVertical && this.parentUseFixedSize && rtl)
229
265
  return;
230
- const referencePaneSize = !rtl || isVertical ? this._paneSizes[0] : this._paneSizes[1];
231
- if (referencePaneSize > IGC_RESIZING_MIN_SIZE) {
232
- if (referencePaneSize + this._dragOffset < IGC_RESIZING_MIN_SIZE) {
233
- this._dragOffset = -(referencePaneSize - IGC_RESIZING_MIN_SIZE);
234
- }
235
- }
236
- else {
237
- this._dragOffset = 0;
266
+ const shrinkingPaneIndex = !rtl || isVertical ? 0 : 1;
267
+ const shrinkingPaneSize = this._paneSizes[shrinkingPaneIndex];
268
+ const configuredMinSize = this._paneMinSizes[shrinkingPaneIndex];
269
+ const minSize = Math.min(shrinkingPaneSize, configuredMinSize);
270
+ const newSize = shrinkingPaneSize + this._dragOffset;
271
+ if (newSize < minSize) {
272
+ this._dragOffset = -(shrinkingPaneSize - minSize);
238
273
  }
239
274
  }
240
- else {
275
+ else if (this._dragOffset > 0) {
241
276
  if (this.parentUseFixedSize && (isVertical || (!isVertical && !rtl)))
242
277
  return;
243
- const referencePaneSize = !rtl || isVertical ? this._paneSizes[1] : this._paneSizes[0];
244
- if (referencePaneSize === 0)
278
+ const shrinkingPaneIndex = !rtl || isVertical ? 1 : 0;
279
+ const shrinkingPaneSize = this._paneSizes[shrinkingPaneIndex];
280
+ if (shrinkingPaneSize === 0)
245
281
  return;
246
- if (referencePaneSize > IGC_RESIZING_MIN_SIZE) {
247
- if (referencePaneSize - this._dragOffset < IGC_RESIZING_MIN_SIZE) {
248
- this._dragOffset = referencePaneSize - IGC_RESIZING_MIN_SIZE;
249
- }
250
- }
251
- else {
252
- this._dragOffset = 0;
282
+ const configuredMinSize = this._paneMinSizes[shrinkingPaneIndex];
283
+ const minSize = Math.min(shrinkingPaneSize, configuredMinSize);
284
+ const newSize = shrinkingPaneSize - this._dragOffset;
285
+ if (newSize < minSize) {
286
+ this._dragOffset = shrinkingPaneSize - minSize;
253
287
  }
254
288
  }
255
289
  }
@@ -284,6 +318,17 @@ class IgcSplitterComponent extends EventEmitterMixin(LitElement) {
284
318
  _isVertical() {
285
319
  return this.splitPaneOrientation === 'vertical';
286
320
  }
321
+ _getMinSize(pane, orientation) {
322
+ if (!pane)
323
+ return IGC_RESIZING_MIN_SIZE;
324
+ const layoutPane = pane._layoutPane;
325
+ if (!layoutPane) {
326
+ return IGC_RESIZING_MIN_SIZE;
327
+ }
328
+ const rawSplitterSize = Math.min(this.offsetWidth, this.offsetHeight);
329
+ const splitterSize = rawSplitterSize > 0 ? rawSplitterSize : IGC_DEFAULT_SPLITTER_SIZE;
330
+ return calculatePaneMinSize(layoutPane, orientation, splitterSize);
331
+ }
287
332
  render() {
288
333
  const splitterClasses = partNameMap({
289
334
  splitter: true,
@@ -41,6 +41,8 @@ export default class IgcTabsComponent extends IgcTabsComponent_base {
41
41
  private _selectionOrder;
42
42
  private _resizeObserver;
43
43
  private _tabHeadersDiv;
44
+ private _minResizeWidth?;
45
+ private _minResizeHeight?;
44
46
  private _hasHiddenTabs;
45
47
  private _hiddenTabsMenuMeta;
46
48
  /**
@@ -100,6 +102,16 @@ export default class IgcTabsComponent extends IgcTabsComponent_base {
100
102
  */
101
103
  set parentUseFixedSize(value: boolean);
102
104
  get parentUseFixedSize(): boolean;
105
+ /**
106
+ * The minimum width of the tab group in pixels during resizing.
107
+ */
108
+ set minResizeWidth(value: number | undefined);
109
+ get minResizeWidth(): number | undefined;
110
+ /**
111
+ * The minimum height of the tab group in pixels during resizing.
112
+ */
113
+ set minResizeHeight(value: number | undefined);
114
+ get minResizeHeight(): number | undefined;
103
115
  protected selectedIndexChanged(oldValue: number, newValue: number): void;
104
116
  connectedCallback(): void;
105
117
  protected firstUpdated(): void;
@@ -97,6 +97,18 @@ class IgcTabsComponent extends EventEmitterMixin(LitElement) {
97
97
  get parentUseFixedSize() {
98
98
  return this._parentUseFixedSize;
99
99
  }
100
+ set minResizeWidth(value) {
101
+ this._minResizeWidth = value;
102
+ }
103
+ get minResizeWidth() {
104
+ return this._minResizeWidth;
105
+ }
106
+ set minResizeHeight(value) {
107
+ this._minResizeHeight = value;
108
+ }
109
+ get minResizeHeight() {
110
+ return this._minResizeHeight;
111
+ }
100
112
  selectedIndexChanged(oldValue, newValue) {
101
113
  if (oldValue !== newValue) {
102
114
  this._handleSelectedIndexChanged(newValue);
@@ -436,6 +448,12 @@ __decorate([
436
448
  __decorate([
437
449
  property({ type: Boolean })
438
450
  ], IgcTabsComponent.prototype, "parentUseFixedSize", null);
451
+ __decorate([
452
+ property({ type: Number })
453
+ ], IgcTabsComponent.prototype, "minResizeWidth", null);
454
+ __decorate([
455
+ property({ type: Number })
456
+ ], IgcTabsComponent.prototype, "minResizeHeight", null);
439
457
  __decorate([
440
458
  watch('selectedIndex')
441
459
  ], IgcTabsComponent.prototype, "selectedIndexChanged", null);