@mintplayer/ng-bootstrap 15.25.0 → 15.25.3
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.
- package/dock/src/dock/dock.component.d.ts +4 -1
- package/dock/src/dock-panel-header/dock-panel-header.component.d.ts +5 -4
- package/dock/src/index.d.ts +1 -0
- package/dock/src/panes/content-pane.d.ts +1 -0
- package/dock/src/panes/dock-pane.d.ts +1 -0
- package/dock/src/panes/document-host-pane.d.ts +1 -0
- package/dock/src/panes/floating-pane.d.ts +2 -1
- package/dock/src/panes/split-pane.d.ts +1 -0
- package/dock/src/panes/tab-group-pane.d.ts +1 -0
- package/dock/src/services/dock/dock.service.d.ts +14 -0
- package/dock/src/services/index.d.ts +1 -0
- package/esm2020/dock/src/dock/dock.component.mjs +14 -2
- package/esm2020/dock/src/dock-panel-header/dock-panel-header.component.mjs +202 -96
- package/esm2020/dock/src/index.mjs +2 -1
- package/esm2020/dock/src/panes/content-pane.mjs +4 -1
- package/esm2020/dock/src/panes/dock-pane.mjs +1 -1
- package/esm2020/dock/src/panes/document-host-pane.mjs +4 -1
- package/esm2020/dock/src/panes/floating-pane.mjs +7 -2
- package/esm2020/dock/src/panes/split-pane.mjs +4 -1
- package/esm2020/dock/src/panes/tab-group-pane.mjs +4 -1
- package/esm2020/dock/src/services/dock/dock.service.mjs +56 -0
- package/esm2020/dock/src/services/index.mjs +2 -0
- package/esm2020/resizable/src/resize-glyph/resize-glyph.directive.mjs +1 -1
- package/fesm2015/mintplayer-ng-bootstrap-dock.mjs +291 -111
- package/fesm2015/mintplayer-ng-bootstrap-dock.mjs.map +1 -1
- package/fesm2015/mintplayer-ng-bootstrap-resizable.mjs.map +1 -1
- package/fesm2020/mintplayer-ng-bootstrap-dock.mjs +289 -111
- package/fesm2020/mintplayer-ng-bootstrap-dock.mjs.map +1 -1
- package/fesm2020/mintplayer-ng-bootstrap-resizable.mjs.map +1 -1
- package/package.json +2 -2
- package/resizable/src/resize-glyph/resize-glyph.directive.d.ts +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Component, ViewChild, Input, ContentChildren, ViewChildren, HostBinding, HostListener, NgModule } from '@angular/core';
|
|
2
|
+
import { Component, ViewChild, Input, ContentChildren, ViewChildren, HostBinding, Injectable, HostListener, NgModule } from '@angular/core';
|
|
3
3
|
import * as i2 from '@angular/common';
|
|
4
4
|
import { CommonModule } from '@angular/common';
|
|
5
5
|
import * as i3 from '@angular/cdk/portal';
|
|
@@ -13,7 +13,8 @@ import * as i6 from '@mintplayer/ng-bootstrap/tab-control';
|
|
|
13
13
|
import { BsTabControlModule } from '@mintplayer/ng-bootstrap/tab-control';
|
|
14
14
|
import * as i4 from '@mintplayer/ng-bootstrap/instance-of';
|
|
15
15
|
import { BsInstanceOfModule } from '@mintplayer/ng-bootstrap/instance-of';
|
|
16
|
-
import { BehaviorSubject, Subject, takeUntil, take } from 'rxjs';
|
|
16
|
+
import { BehaviorSubject, Subject, takeUntil, map, take } from 'rxjs';
|
|
17
|
+
import { deepClone } from '@mintplayer/parentify';
|
|
17
18
|
import * as i1 from '@angular/cdk/overlay';
|
|
18
19
|
|
|
19
20
|
class BsDockPanelComponent {
|
|
@@ -49,6 +50,9 @@ class BsTabGroupPane extends BsDockPane {
|
|
|
49
50
|
this.panes = [];
|
|
50
51
|
Object.assign(this, data);
|
|
51
52
|
}
|
|
53
|
+
get isEmpty() {
|
|
54
|
+
return this.panes.length === 0;
|
|
55
|
+
}
|
|
52
56
|
}
|
|
53
57
|
|
|
54
58
|
class BsDocumentHost extends BsDockPane {
|
|
@@ -56,38 +60,51 @@ class BsDocumentHost extends BsDockPane {
|
|
|
56
60
|
super();
|
|
57
61
|
Object.assign(this, data);
|
|
58
62
|
}
|
|
63
|
+
get isEmpty() {
|
|
64
|
+
return this.rootPane?.isEmpty ?? true;
|
|
65
|
+
}
|
|
59
66
|
}
|
|
60
67
|
|
|
61
|
-
|
|
62
|
-
(function (EPaneType) {
|
|
63
|
-
EPaneType[EPaneType["documentHost"] = 1] = "documentHost";
|
|
64
|
-
EPaneType[EPaneType["splitPane"] = 2] = "splitPane";
|
|
65
|
-
EPaneType[EPaneType["contentPane"] = 3] = "contentPane";
|
|
66
|
-
EPaneType[EPaneType["tabGroupPane"] = 4] = "tabGroupPane";
|
|
67
|
-
})(EPaneType || (EPaneType = {}));
|
|
68
|
-
|
|
69
|
-
class BsSplitPane extends BsDockPane {
|
|
68
|
+
class BsContentPane extends BsDockPane {
|
|
70
69
|
constructor(data) {
|
|
71
70
|
super();
|
|
72
|
-
this.orientation = 'horizontal';
|
|
73
|
-
this.panes = [];
|
|
74
71
|
Object.assign(this, data);
|
|
75
72
|
}
|
|
73
|
+
get isEmpty() {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
class
|
|
78
|
+
class BsFloatingPane extends BsDockPane {
|
|
79
79
|
constructor(data) {
|
|
80
80
|
super();
|
|
81
81
|
Object.assign(this, data);
|
|
82
82
|
}
|
|
83
|
+
get isEmpty() {
|
|
84
|
+
return this.pane?.isEmpty ?? true;
|
|
85
|
+
}
|
|
83
86
|
}
|
|
84
87
|
|
|
85
|
-
class
|
|
88
|
+
class BsSplitPane extends BsDockPane {
|
|
86
89
|
constructor(data) {
|
|
90
|
+
super();
|
|
91
|
+
this.orientation = 'horizontal';
|
|
92
|
+
this.panes = [];
|
|
87
93
|
Object.assign(this, data);
|
|
88
94
|
}
|
|
95
|
+
get isEmpty() {
|
|
96
|
+
return this.panes.length === 0;
|
|
97
|
+
}
|
|
89
98
|
}
|
|
90
99
|
|
|
100
|
+
var EPaneType;
|
|
101
|
+
(function (EPaneType) {
|
|
102
|
+
EPaneType[EPaneType["documentHost"] = 1] = "documentHost";
|
|
103
|
+
EPaneType[EPaneType["splitPane"] = 2] = "splitPane";
|
|
104
|
+
EPaneType[EPaneType["contentPane"] = 3] = "contentPane";
|
|
105
|
+
EPaneType[EPaneType["tabGroupPane"] = 4] = "tabGroupPane";
|
|
106
|
+
})(EPaneType || (EPaneType = {}));
|
|
107
|
+
|
|
91
108
|
class BsDockPaneRendererComponent {
|
|
92
109
|
constructor(overlay, element) {
|
|
93
110
|
this.overlay = overlay;
|
|
@@ -154,6 +171,14 @@ class BsDockComponent {
|
|
|
154
171
|
.subscribe((floating) => {
|
|
155
172
|
floating.forEach((panel) => panel.moveToOverlay());
|
|
156
173
|
});
|
|
174
|
+
this.parentifiedLayout$ = this.layout$.pipe(map(layout => {
|
|
175
|
+
const clone = deepClone(layout, true,
|
|
176
|
+
// []
|
|
177
|
+
[BsContentPane, BsDocumentHost, BsFloatingPane, BsSplitPane, BsTabGroupPane], true, this.paneCache);
|
|
178
|
+
this.paneCache = clone.cache;
|
|
179
|
+
return clone.result;
|
|
180
|
+
}));
|
|
181
|
+
this.parentifiedLayout$.pipe(takeUntil(this.destroyed$)).subscribe(console.log);
|
|
157
182
|
}
|
|
158
183
|
set panels(value) {
|
|
159
184
|
this.panels$.next(value.toArray());
|
|
@@ -202,13 +227,63 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
|
|
|
202
227
|
args: ['style.right']
|
|
203
228
|
}] } });
|
|
204
229
|
|
|
230
|
+
class BsDockService {
|
|
231
|
+
buildTraces(layout) {
|
|
232
|
+
const result = [layout.rootPane, ...layout.floatingPanes].map(pane => this.buildTracesPrivate([pane]));
|
|
233
|
+
// const result = this.buildTracesPrivate([layout.rootPane]);
|
|
234
|
+
return result.flatMap(traceGroup => traceGroup);
|
|
235
|
+
}
|
|
236
|
+
buildTracesPrivate(currentSequence) {
|
|
237
|
+
const children = this.getChildPanes(currentSequence[currentSequence.length - 1]);
|
|
238
|
+
if (children.length === 0) {
|
|
239
|
+
return [{
|
|
240
|
+
finished: true,
|
|
241
|
+
trace: currentSequence
|
|
242
|
+
}];
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
const result = children.map(child => this.buildTracesPrivate([...currentSequence, child]));
|
|
246
|
+
return result.flatMap(r => r);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
getChildPanes(pane) {
|
|
250
|
+
if (pane instanceof BsContentPane) {
|
|
251
|
+
return [];
|
|
252
|
+
}
|
|
253
|
+
else if (pane instanceof BsTabGroupPane) {
|
|
254
|
+
return pane.panes;
|
|
255
|
+
}
|
|
256
|
+
else if (pane instanceof BsSplitPane) {
|
|
257
|
+
return pane.panes;
|
|
258
|
+
}
|
|
259
|
+
else if (pane instanceof BsFloatingPane) {
|
|
260
|
+
return pane.pane ? [pane.pane] : [];
|
|
261
|
+
}
|
|
262
|
+
else if (pane instanceof BsDocumentHost) {
|
|
263
|
+
return pane.rootPane ? [pane.rootPane] : [];
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
return [];
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
BsDockService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: BsDockService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
271
|
+
BsDockService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: BsDockService, providedIn: 'root' });
|
|
272
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: BsDockService, decorators: [{
|
|
273
|
+
type: Injectable,
|
|
274
|
+
args: [{
|
|
275
|
+
providedIn: 'root'
|
|
276
|
+
}]
|
|
277
|
+
}] });
|
|
278
|
+
|
|
205
279
|
class BsDockPanelHeaderComponent {
|
|
206
|
-
constructor(dockPanel, dock, element) {
|
|
280
|
+
constructor(dockPanel, dock, dockService, element) {
|
|
207
281
|
this.dockPanel = dockPanel;
|
|
208
282
|
this.dock = dock;
|
|
283
|
+
this.dockService = dockService;
|
|
209
284
|
this.element = element;
|
|
210
285
|
this.isMouseDown = false;
|
|
211
|
-
this.
|
|
286
|
+
this.isDragging = false;
|
|
212
287
|
this.dBlock = true;
|
|
213
288
|
}
|
|
214
289
|
onMouseDown(ev) {
|
|
@@ -217,130 +292,233 @@ class BsDockPanelHeaderComponent {
|
|
|
217
292
|
}
|
|
218
293
|
onMouseMove(ev) {
|
|
219
294
|
if (this.isMouseDown) {
|
|
220
|
-
if (!this.
|
|
221
|
-
this.
|
|
222
|
-
this.dock.
|
|
223
|
-
|
|
224
|
-
|
|
295
|
+
if (!this.isDragging) {
|
|
296
|
+
this.isDragging = true;
|
|
297
|
+
this.dock.parentifiedLayout$.pipe(take(1)).subscribe((layout) => {
|
|
298
|
+
// this.dock.layout$.pipe(take(1)).subscribe((layout) => {
|
|
299
|
+
const traces = this.dockService.buildTraces(layout);
|
|
300
|
+
console.log('traces', { layout, traces });
|
|
301
|
+
const matching = traces.filter(t => {
|
|
302
|
+
const lastPane = t.trace[t.trace.length - 1];
|
|
303
|
+
// return (lastPane instanceof BsContentPane) && (lastPane.dockPanel === this.dockPanel);
|
|
304
|
+
return (lastPane instanceof BsContentPane) && (lastPane.dockPanel === this.dockPanel);
|
|
305
|
+
});
|
|
306
|
+
console.log('matching', matching);
|
|
307
|
+
if (matching.length !== 1) {
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
// const tabs = matching[0].trace.filter(pane => pane instanceof BsTabGroupPane);
|
|
311
|
+
// const lastTabGroup = tabs[tabs.length - 1];
|
|
312
|
+
// // console.log('last tabgroup', lastTabGroup);
|
|
313
|
+
let tabControlEl = this.element.nativeElement;
|
|
225
314
|
do {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
315
|
+
if (tabControlEl.parentElement) {
|
|
316
|
+
tabControlEl = tabControlEl.parentElement;
|
|
317
|
+
}
|
|
318
|
+
else {
|
|
319
|
+
throw 'No more parents';
|
|
320
|
+
}
|
|
321
|
+
} while (tabControlEl.tagName.toUpperCase() !== 'BS-TAB-CONTROL');
|
|
322
|
+
const coords = {
|
|
323
|
+
width: tabControlEl.clientWidth,
|
|
324
|
+
height: tabControlEl.clientHeight,
|
|
325
|
+
left: ev.clientX - ev.offsetX,
|
|
326
|
+
top: ev.clientY - ev.offsetY,
|
|
327
|
+
};
|
|
328
|
+
// this.dockPanel.headerPortal?.isAttached && this.dockPanel.headerPortal?.detach();
|
|
329
|
+
// this.dockPanel.contentPortal?.isAttached && this.dockPanel.contentPortal?.detach();
|
|
330
|
+
// this.removeFromPane(layout.rootPane, this.dockPanel);
|
|
331
|
+
const trace = [...matching[0].trace];
|
|
332
|
+
this.dockPanel.headerPortal?.isAttached && this.dockPanel.headerPortal?.detach();
|
|
333
|
+
this.dockPanel.contentPortal?.isAttached && this.dockPanel.contentPortal?.detach();
|
|
334
|
+
for (let index = trace.length - 1; index >= 0; index--) {
|
|
335
|
+
if (index > 0) {
|
|
336
|
+
this.removeFromPaneBis(trace[index - 1], trace[index]);
|
|
337
|
+
if (!trace[index - 1].isEmpty)
|
|
338
|
+
break;
|
|
339
|
+
}
|
|
340
|
+
else {
|
|
341
|
+
const floatingIndex = layout.floatingPanes.indexOf(trace[0]);
|
|
342
|
+
if (trace[0].isEmpty && (floatingIndex > -1)) {
|
|
343
|
+
layout.floatingPanes.splice(floatingIndex, 1);
|
|
255
344
|
}
|
|
256
|
-
}
|
|
257
|
-
this.dragOperation = {
|
|
258
|
-
offsetX: ev.offsetX,
|
|
259
|
-
offsetY: ev.offsetY,
|
|
260
|
-
floatingPane
|
|
261
|
-
};
|
|
262
|
-
layout.floatingPanes.push(floatingPane);
|
|
263
|
-
this.dock.layout$.next(layout);
|
|
345
|
+
}
|
|
264
346
|
}
|
|
347
|
+
// this.removeFromPane((<any>matching[0].trace[0])['$original'], this.dockPanel);
|
|
348
|
+
const floatingPane = new BsFloatingPane({
|
|
349
|
+
pane: new BsTabGroupPane({
|
|
350
|
+
panes: [
|
|
351
|
+
new BsContentPane({
|
|
352
|
+
dockPanel: this.dockPanel
|
|
353
|
+
})
|
|
354
|
+
]
|
|
355
|
+
}),
|
|
356
|
+
size: {
|
|
357
|
+
width: coords.width,
|
|
358
|
+
height: coords.height,
|
|
359
|
+
},
|
|
360
|
+
location: {
|
|
361
|
+
x: coords.left,
|
|
362
|
+
y: coords.top,
|
|
363
|
+
}
|
|
364
|
+
});
|
|
365
|
+
this.dragOperation = {
|
|
366
|
+
offsetX: ev.offsetX,
|
|
367
|
+
offsetY: ev.offsetY,
|
|
368
|
+
floatingPane
|
|
369
|
+
};
|
|
370
|
+
layout.floatingPanes.push(floatingPane);
|
|
371
|
+
setTimeout(() => this.dock.layout$.next(layout), 5);
|
|
372
|
+
// console.log('traces', { traces, matching, dockPanel: this.dockPanel, equals: traces[2].trace[3] });
|
|
373
|
+
// let element: HTMLElement | null = this.element.nativeElement;
|
|
374
|
+
// let tree: HTMLElement[] = [];
|
|
375
|
+
// do {
|
|
376
|
+
// tree.push(element!);
|
|
377
|
+
// element = element!.parentElement;
|
|
378
|
+
// } while (element);
|
|
379
|
+
// const tabControls = tree.filter(el => el.tagName.toUpperCase() === 'BS-TAB-CONTROL');
|
|
380
|
+
// if (tabControls.length > 0) {
|
|
381
|
+
// const coords = {
|
|
382
|
+
// width: tabControls[0].clientWidth,
|
|
383
|
+
// height: tabControls[0].clientHeight,
|
|
384
|
+
// left: ev.clientX - ev.offsetX,
|
|
385
|
+
// top: ev.clientY - ev.offsetY,
|
|
386
|
+
// };
|
|
387
|
+
// this.dockPanel.headerPortal?.isAttached && this.dockPanel.headerPortal?.detach();
|
|
388
|
+
// this.dockPanel.contentPortal?.isAttached && this.dockPanel.contentPortal?.detach();
|
|
389
|
+
// this.removeFromPane(layout.rootPane, this.dockPanel);
|
|
390
|
+
// const floatingPane = new BsFloatingPane({
|
|
391
|
+
// pane: new BsTabGroupPane({
|
|
392
|
+
// panes: [
|
|
393
|
+
// new BsContentPane({
|
|
394
|
+
// dockPanel: this.dockPanel
|
|
395
|
+
// })
|
|
396
|
+
// ]
|
|
397
|
+
// }),
|
|
398
|
+
// size: {
|
|
399
|
+
// width: coords.width,
|
|
400
|
+
// height: coords.height,
|
|
401
|
+
// },
|
|
402
|
+
// location: {
|
|
403
|
+
// x: coords.left,
|
|
404
|
+
// y: coords.top,
|
|
405
|
+
// }
|
|
406
|
+
// });
|
|
407
|
+
// this.dragOperation = {
|
|
408
|
+
// offsetX: ev.offsetX,
|
|
409
|
+
// offsetY: ev.offsetY,
|
|
410
|
+
// floatingPane
|
|
411
|
+
// };
|
|
412
|
+
// layout.floatingPanes.push(floatingPane);
|
|
413
|
+
// this.dock.layout$.next(layout);
|
|
414
|
+
// }
|
|
265
415
|
});
|
|
266
416
|
}
|
|
267
|
-
else
|
|
268
|
-
if (this.dragOperation
|
|
269
|
-
this.dragOperation.floatingPane.location
|
|
270
|
-
|
|
417
|
+
else {
|
|
418
|
+
if (this.dragOperation) {
|
|
419
|
+
if (this.dragOperation.floatingPane.location) {
|
|
420
|
+
this.dragOperation.floatingPane.location.x = ev.clientX - this.dragOperation.offsetX;
|
|
421
|
+
this.dragOperation.floatingPane.location.y = ev.clientY - this.dragOperation.offsetY;
|
|
422
|
+
}
|
|
423
|
+
// } else {
|
|
424
|
+
// const traces = this.dockService.buildTraces(this.dock.layout);
|
|
425
|
+
// const matchingTrace = traces.filter(trace => {
|
|
426
|
+
// const pane = trace.trace[trace.trace.length - 1];
|
|
427
|
+
// return (pane instanceof BsContentPane) && (pane.dockPanel === this.dockPanel);
|
|
428
|
+
// });
|
|
429
|
+
// console.log('matching', { traces, matchingTrace });
|
|
430
|
+
// // this.dragOperation = {
|
|
431
|
+
// // }
|
|
271
432
|
}
|
|
272
433
|
}
|
|
273
434
|
}
|
|
274
435
|
}
|
|
275
|
-
|
|
436
|
+
removeFromPaneBis(host, pane) {
|
|
276
437
|
if (host instanceof BsContentPane) {
|
|
277
|
-
return { paneRemoved: false, hostIsEmpty: false };
|
|
278
438
|
}
|
|
279
439
|
else if (host instanceof BsDocumentHost) {
|
|
280
440
|
// Actually documentHost should never be removed
|
|
281
|
-
if (!host.rootPane) {
|
|
282
|
-
return { paneRemoved: false, hostIsEmpty: true };
|
|
283
|
-
}
|
|
284
|
-
const result = this.removeFromPane(host.rootPane, panel);
|
|
285
|
-
return { paneRemoved: result.paneRemoved, hostIsEmpty: result.hostIsEmpty };
|
|
286
441
|
}
|
|
287
442
|
else if (host instanceof BsTabGroupPane) {
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
host.panes.splice(
|
|
291
|
-
return { paneRemoved: true, hostIsEmpty: host.panes.length === 0 };
|
|
292
|
-
}
|
|
293
|
-
else {
|
|
294
|
-
// ATM. all panes are ContentPanes anyway.
|
|
295
|
-
// So unless you'd want to have splitters inside the tabs,
|
|
296
|
-
// This code will not be hit.
|
|
297
|
-
// const result = host.panes
|
|
298
|
-
// .map(parentPane => this.removeFromPane(parentPane, panel))
|
|
299
|
-
// .filter(r => r.paneRemoved);
|
|
300
|
-
//
|
|
301
|
-
// if (result.length > 0) {
|
|
302
|
-
// return { paneRemoved: true, hostIsEmpty: }
|
|
303
|
-
// }
|
|
304
|
-
return { paneRemoved: false, hostIsEmpty: host.panes.length === 0 };
|
|
443
|
+
if (pane instanceof BsContentPane) {
|
|
444
|
+
const index = host.panes.indexOf(pane);
|
|
445
|
+
host.panes.splice(index, 1);
|
|
305
446
|
}
|
|
306
447
|
}
|
|
307
448
|
else if (host instanceof BsSplitPane) {
|
|
308
|
-
const
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
if (matching.length > 0) {
|
|
313
|
-
host.panes.splice(host.panes.findIndex(p => (p instanceof BsContentPane) && matching.includes(p)), 1);
|
|
314
|
-
// TODO: Remove splitter if only 1 pane left?
|
|
315
|
-
return { paneRemoved: true, hostIsEmpty: host.panes.length === 0 };
|
|
316
|
-
}
|
|
317
|
-
else {
|
|
318
|
-
for (let splitPane of host.panes) {
|
|
319
|
-
const result = this.removeFromPane(splitPane, panel);
|
|
320
|
-
if (result.paneRemoved && result.hostIsEmpty) {
|
|
321
|
-
// splitPane is empty now, so we can remove it from this splitter
|
|
322
|
-
host.panes.splice(host.panes.indexOf(splitPane), 1);
|
|
323
|
-
return { paneRemoved: true, hostIsEmpty: host.panes.length === 0 };
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
return { paneRemoved: false, hostIsEmpty: host.panes.length === 0 };
|
|
449
|
+
const index = host.panes.indexOf(pane);
|
|
450
|
+
host.panes.splice(index, 1);
|
|
451
|
+
}
|
|
452
|
+
else if (host instanceof BsFloatingPane) {
|
|
328
453
|
}
|
|
329
454
|
else {
|
|
330
|
-
throw '
|
|
455
|
+
throw 'Unknown pane type';
|
|
331
456
|
}
|
|
332
457
|
}
|
|
458
|
+
// removeFromPane(host: BsDockPane, panel: BsDockPanelComponent /*, parents: BsDockPane[] */): RemoveFromPaneResult {
|
|
459
|
+
// if (host instanceof BsContentPane) {
|
|
460
|
+
// return { paneRemoved: false, hostIsEmpty: false };
|
|
461
|
+
// } else if (host instanceof BsDocumentHost) {
|
|
462
|
+
// // Actually documentHost should never be removed
|
|
463
|
+
// if (!host.rootPane) {
|
|
464
|
+
// return { paneRemoved: false, hostIsEmpty: true };
|
|
465
|
+
// }
|
|
466
|
+
// const result = this.removeFromPane(host.rootPane, panel);
|
|
467
|
+
// return { paneRemoved: result.paneRemoved, hostIsEmpty: result.hostIsEmpty };
|
|
468
|
+
// } else if (host instanceof BsTabGroupPane) {
|
|
469
|
+
// const matching = host.panes.filter(p => p.dockPanel === panel);
|
|
470
|
+
// if (matching.length > 0) {
|
|
471
|
+
// host.panes.splice(host.panes.findIndex(p => p.dockPanel === panel), 1);
|
|
472
|
+
// return { paneRemoved: true, hostIsEmpty: host.panes.length === 0 };
|
|
473
|
+
// } else {
|
|
474
|
+
// // ATM. all panes are ContentPanes anyway.
|
|
475
|
+
// // So unless you'd want to have splitters inside the tabs,
|
|
476
|
+
// // This code will not be hit.
|
|
477
|
+
// // const result = host.panes
|
|
478
|
+
// // .map(parentPane => this.removeFromPane(parentPane, panel))
|
|
479
|
+
// // .filter(r => r.paneRemoved);
|
|
480
|
+
// //
|
|
481
|
+
// // if (result.length > 0) {
|
|
482
|
+
// // return { paneRemoved: true, hostIsEmpty: }
|
|
483
|
+
// // }
|
|
484
|
+
// return { paneRemoved: false, hostIsEmpty: host.panes.length === 0 };
|
|
485
|
+
// }
|
|
486
|
+
// } else if (host instanceof BsSplitPane) {
|
|
487
|
+
// const matching = host.panes
|
|
488
|
+
// .filter(p => p instanceof BsContentPane)
|
|
489
|
+
// .map(p => <BsContentPane>p)
|
|
490
|
+
// .filter(p => p.dockPanel === panel);
|
|
491
|
+
// if (matching.length > 0) {
|
|
492
|
+
// host.panes.splice(host.panes.findIndex(p => (p instanceof BsContentPane) && matching.includes(p)), 1);
|
|
493
|
+
// // TODO: Remove splitter if only 1 pane left?
|
|
494
|
+
// return { paneRemoved: true, hostIsEmpty: host.panes.length === 0 };
|
|
495
|
+
// } else {
|
|
496
|
+
// for (let splitPane of host.panes) {
|
|
497
|
+
// const result = this.removeFromPane(splitPane, panel);
|
|
498
|
+
// if (result.paneRemoved && result.hostIsEmpty) {
|
|
499
|
+
// // splitPane is empty now, so we can remove it from this splitter
|
|
500
|
+
// host.panes.splice(host.panes.indexOf(splitPane), 1);
|
|
501
|
+
// return { paneRemoved: true, hostIsEmpty: host.panes.length === 0 };
|
|
502
|
+
// }
|
|
503
|
+
// }
|
|
504
|
+
// }
|
|
505
|
+
// return { paneRemoved: false, hostIsEmpty: host.panes.length === 0 };
|
|
506
|
+
// } else {
|
|
507
|
+
// throw 'unknown host type';
|
|
508
|
+
// }
|
|
509
|
+
// }
|
|
333
510
|
onMouseUp(ev) {
|
|
334
511
|
this.isMouseDown = false;
|
|
512
|
+
this.isDragging = false;
|
|
335
513
|
this.dragOperation = undefined;
|
|
336
514
|
}
|
|
337
515
|
}
|
|
338
|
-
BsDockPanelHeaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: BsDockPanelHeaderComponent, deps: [{ token: BsDockPanelComponent }, { token: BsDockComponent }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
516
|
+
BsDockPanelHeaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: BsDockPanelHeaderComponent, deps: [{ token: BsDockPanelComponent }, { token: BsDockComponent }, { token: BsDockService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
339
517
|
BsDockPanelHeaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: BsDockPanelHeaderComponent, selector: "bs-dock-panel-header", host: { listeners: { "mousedown": "onMouseDown($event)", "document:mousemove": "onMouseMove($event)", "document:mouseup": "onMouseUp($event)" }, properties: { "class.d-block": "this.dBlock" } }, ngImport: i0, template: "<ng-content></ng-content>", styles: [":host{padding:var(--bs-nav-link-padding-y) var(--bs-nav-link-padding-x);margin:calc(-1 * var(--bs-nav-link-padding-y)) calc(-1 * var(--bs-nav-link-padding-x))}\n"] });
|
|
340
518
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: BsDockPanelHeaderComponent, decorators: [{
|
|
341
519
|
type: Component,
|
|
342
520
|
args: [{ selector: 'bs-dock-panel-header', template: "<ng-content></ng-content>", styles: [":host{padding:var(--bs-nav-link-padding-y) var(--bs-nav-link-padding-x);margin:calc(-1 * var(--bs-nav-link-padding-y)) calc(-1 * var(--bs-nav-link-padding-x))}\n"] }]
|
|
343
|
-
}], ctorParameters: function () { return [{ type: BsDockPanelComponent }, { type: BsDockComponent }, { type: i0.ElementRef }]; }, propDecorators: { onMouseDown: [{
|
|
521
|
+
}], ctorParameters: function () { return [{ type: BsDockPanelComponent }, { type: BsDockComponent }, { type: BsDockService }, { type: i0.ElementRef }]; }, propDecorators: { onMouseDown: [{
|
|
344
522
|
type: HostListener,
|
|
345
523
|
args: ['mousedown', ['$event']]
|
|
346
524
|
}], onMouseMove: [{
|
|
@@ -408,5 +586,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
|
|
|
408
586
|
* Generated bundle index. Do not edit.
|
|
409
587
|
*/
|
|
410
588
|
|
|
411
|
-
export { BsContentPane, BsDockComponent, BsDockModule, BsDockPane, BsDockPaneRendererComponent, BsDockPanelComponent, BsDockPanelHeaderComponent, BsDocumentHost, BsFloatingPane, BsSplitPane, BsTabGroupPane, EPaneType };
|
|
589
|
+
export { BsContentPane, BsDockComponent, BsDockModule, BsDockPane, BsDockPaneRendererComponent, BsDockPanelComponent, BsDockPanelHeaderComponent, BsDockService, BsDocumentHost, BsFloatingPane, BsSplitPane, BsTabGroupPane, EPaneType };
|
|
412
590
|
//# sourceMappingURL=mintplayer-ng-bootstrap-dock.mjs.map
|