dockview-core 1.9.0 → 1.9.2
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/dist/cjs/dnd/droptarget.d.ts +11 -12
- package/dist/cjs/dnd/droptarget.d.ts.map +1 -1
- package/dist/cjs/dnd/droptarget.js +37 -47
- package/dist/cjs/dnd/droptarget.js.map +1 -1
- package/dist/cjs/dockview/components/panel/content.js +2 -2
- package/dist/cjs/dockview/components/panel/content.js.map +1 -1
- package/dist/cjs/dockview/dockviewComponent.d.ts +2 -1
- package/dist/cjs/dockview/dockviewComponent.d.ts.map +1 -1
- package/dist/cjs/dockview/dockviewComponent.js +19 -13
- package/dist/cjs/dockview/dockviewComponent.js.map +1 -1
- package/dist/cjs/dockview/dockviewGroupPanelModel.d.ts.map +1 -1
- package/dist/cjs/dockview/dockviewGroupPanelModel.js +1 -0
- package/dist/cjs/dockview/dockviewGroupPanelModel.js.map +1 -1
- package/dist/cjs/dockview/options.d.ts +4 -2
- package/dist/cjs/dockview/options.d.ts.map +1 -1
- package/dist/cjs/dockview/options.js.map +1 -1
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/resizable.d.ts.map +1 -1
- package/dist/cjs/resizable.js +15 -0
- package/dist/cjs/resizable.js.map +1 -1
- package/dist/dockview-core.amd.js +76 -64
- package/dist/dockview-core.amd.js.map +1 -1
- package/dist/dockview-core.amd.min.js +2 -2
- package/dist/dockview-core.amd.min.js.map +1 -1
- package/dist/dockview-core.amd.min.noStyle.js +2 -2
- package/dist/dockview-core.amd.min.noStyle.js.map +1 -1
- package/dist/dockview-core.amd.noStyle.js +75 -63
- package/dist/dockview-core.amd.noStyle.js.map +1 -1
- package/dist/dockview-core.cjs.js +76 -64
- package/dist/dockview-core.cjs.js.map +1 -1
- package/dist/dockview-core.esm.js +76 -64
- package/dist/dockview-core.esm.js.map +1 -1
- package/dist/dockview-core.esm.min.js +2 -2
- package/dist/dockview-core.esm.min.js.map +1 -1
- package/dist/dockview-core.js +76 -64
- package/dist/dockview-core.js.map +1 -1
- package/dist/dockview-core.min.js +2 -2
- package/dist/dockview-core.min.js.map +1 -1
- package/dist/dockview-core.min.noStyle.js +2 -2
- package/dist/dockview-core.min.noStyle.js.map +1 -1
- package/dist/dockview-core.noStyle.js +75 -63
- package/dist/dockview-core.noStyle.js.map +1 -1
- package/dist/esm/dnd/droptarget.d.ts +11 -12
- package/dist/esm/dnd/droptarget.d.ts.map +1 -1
- package/dist/esm/dnd/droptarget.js +37 -47
- package/dist/esm/dnd/droptarget.js.map +1 -1
- package/dist/esm/dockview/components/panel/content.js +2 -2
- package/dist/esm/dockview/components/panel/content.js.map +1 -1
- package/dist/esm/dockview/dockviewComponent.d.ts +2 -1
- package/dist/esm/dockview/dockviewComponent.d.ts.map +1 -1
- package/dist/esm/dockview/dockviewComponent.js +20 -14
- package/dist/esm/dockview/dockviewComponent.js.map +1 -1
- package/dist/esm/dockview/dockviewGroupPanelModel.d.ts.map +1 -1
- package/dist/esm/dockview/dockviewGroupPanelModel.js +1 -0
- package/dist/esm/dockview/dockviewGroupPanelModel.js.map +1 -1
- package/dist/esm/dockview/options.d.ts +4 -2
- package/dist/esm/dockview/options.d.ts.map +1 -1
- package/dist/esm/dockview/options.js.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/resizable.d.ts.map +1 -1
- package/dist/esm/resizable.js +15 -0
- package/dist/esm/resizable.js.map +1 -1
- package/dist/styles/dockview.css +5 -5
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dockview-core
|
|
3
|
-
* @version 1.9.
|
|
3
|
+
* @version 1.9.2
|
|
4
4
|
* @link https://github.com/mathuo/dockview
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
@@ -3078,9 +3078,6 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3078
3078
|
}
|
|
3079
3079
|
}
|
|
3080
3080
|
|
|
3081
|
-
function numberOrFallback(maybeNumber, fallback) {
|
|
3082
|
-
return typeof maybeNumber === 'number' ? maybeNumber : fallback;
|
|
3083
|
-
}
|
|
3084
3081
|
function directionToPosition(direction) {
|
|
3085
3082
|
switch (direction) {
|
|
3086
3083
|
case 'above':
|
|
@@ -3113,6 +3110,16 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3113
3110
|
throw new Error(`invalid position '${position}'`);
|
|
3114
3111
|
}
|
|
3115
3112
|
}
|
|
3113
|
+
const DEFAULT_ACTIVATION_SIZE = {
|
|
3114
|
+
value: 20,
|
|
3115
|
+
type: 'percentage',
|
|
3116
|
+
};
|
|
3117
|
+
const DEFAULT_SIZE = {
|
|
3118
|
+
value: 50,
|
|
3119
|
+
type: 'percentage',
|
|
3120
|
+
};
|
|
3121
|
+
const SMALL_WIDTH_BOUNDARY = 100;
|
|
3122
|
+
const SMALL_HEIGHT_BOUNDARY = 100;
|
|
3116
3123
|
class Droptarget extends CompositeDisposable {
|
|
3117
3124
|
get state() {
|
|
3118
3125
|
return this._state;
|
|
@@ -3173,7 +3180,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3173
3180
|
this.element.append(this.targetElement);
|
|
3174
3181
|
}
|
|
3175
3182
|
this.toggleClasses(quadrant, width, height);
|
|
3176
|
-
this.
|
|
3183
|
+
this._state = quadrant;
|
|
3177
3184
|
},
|
|
3178
3185
|
onDragLeave: () => {
|
|
3179
3186
|
this.removeDropTarget();
|
|
@@ -3198,6 +3205,9 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3198
3205
|
setTargetZones(acceptedTargetZones) {
|
|
3199
3206
|
this._acceptedTargetZonesSet = new Set(acceptedTargetZones);
|
|
3200
3207
|
}
|
|
3208
|
+
setOverlayModel(model) {
|
|
3209
|
+
this.options.overlayModel = model;
|
|
3210
|
+
}
|
|
3201
3211
|
dispose() {
|
|
3202
3212
|
this.removeDropTarget();
|
|
3203
3213
|
super.dispose();
|
|
@@ -3209,19 +3219,19 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3209
3219
|
event[Droptarget.USED_EVENT_ID] = true;
|
|
3210
3220
|
}
|
|
3211
3221
|
/**
|
|
3212
|
-
* Check is the event has already been used by another instance
|
|
3222
|
+
* Check is the event has already been used by another instance of DropTarget
|
|
3213
3223
|
*/
|
|
3214
3224
|
isAlreadyUsed(event) {
|
|
3215
3225
|
const value = event[Droptarget.USED_EVENT_ID];
|
|
3216
3226
|
return typeof value === 'boolean' && value;
|
|
3217
3227
|
}
|
|
3218
3228
|
toggleClasses(quadrant, width, height) {
|
|
3219
|
-
var _a, _b
|
|
3229
|
+
var _a, _b;
|
|
3220
3230
|
if (!this.overlayElement) {
|
|
3221
3231
|
return;
|
|
3222
3232
|
}
|
|
3223
|
-
const isSmallX = width <
|
|
3224
|
-
const isSmallY = height <
|
|
3233
|
+
const isSmallX = width < SMALL_WIDTH_BOUNDARY;
|
|
3234
|
+
const isSmallY = height < SMALL_HEIGHT_BOUNDARY;
|
|
3225
3235
|
const isLeft = quadrant === 'left';
|
|
3226
3236
|
const isRight = quadrant === 'right';
|
|
3227
3237
|
const isTop = quadrant === 'top';
|
|
@@ -3230,20 +3240,17 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3230
3240
|
const leftClass = !isSmallX && isLeft;
|
|
3231
3241
|
const topClass = !isSmallY && isTop;
|
|
3232
3242
|
const bottomClass = !isSmallY && isBottom;
|
|
3233
|
-
let size =
|
|
3234
|
-
|
|
3235
|
-
|
|
3243
|
+
let size = 1;
|
|
3244
|
+
const sizeOptions = (_b = (_a = this.options.overlayModel) === null || _a === void 0 ? void 0 : _a.size) !== null && _b !== void 0 ? _b : DEFAULT_SIZE;
|
|
3245
|
+
if (sizeOptions.type === 'percentage') {
|
|
3246
|
+
size = clamp(sizeOptions.value, 0, 100) / 100;
|
|
3236
3247
|
}
|
|
3237
|
-
|
|
3248
|
+
else {
|
|
3238
3249
|
if (rightClass || leftClass) {
|
|
3239
|
-
size =
|
|
3240
|
-
clamp(0, this.options.overlayModel.size.value, width) /
|
|
3241
|
-
width;
|
|
3250
|
+
size = clamp(0, sizeOptions.value, width) / width;
|
|
3242
3251
|
}
|
|
3243
3252
|
if (topClass || bottomClass) {
|
|
3244
|
-
size =
|
|
3245
|
-
clamp(0, this.options.overlayModel.size.value, height) /
|
|
3246
|
-
height;
|
|
3253
|
+
size = clamp(0, sizeOptions.value, height) / height;
|
|
3247
3254
|
}
|
|
3248
3255
|
}
|
|
3249
3256
|
const translate = (1 - size) / 2;
|
|
@@ -3265,39 +3272,22 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3265
3272
|
transform = '';
|
|
3266
3273
|
}
|
|
3267
3274
|
this.overlayElement.style.transform = transform;
|
|
3268
|
-
toggleClass(this.overlayElement, 'small-
|
|
3269
|
-
toggleClass(this.overlayElement, 'small-
|
|
3270
|
-
toggleClass(this.overlayElement, '
|
|
3271
|
-
toggleClass(this.overlayElement, '
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
case 'top':
|
|
3276
|
-
this._state = 'top';
|
|
3277
|
-
break;
|
|
3278
|
-
case 'left':
|
|
3279
|
-
this._state = 'left';
|
|
3280
|
-
break;
|
|
3281
|
-
case 'bottom':
|
|
3282
|
-
this._state = 'bottom';
|
|
3283
|
-
break;
|
|
3284
|
-
case 'right':
|
|
3285
|
-
this._state = 'right';
|
|
3286
|
-
break;
|
|
3287
|
-
case 'center':
|
|
3288
|
-
this._state = 'center';
|
|
3289
|
-
break;
|
|
3290
|
-
}
|
|
3275
|
+
toggleClass(this.overlayElement, 'dv-drop-target-small-vertical', isSmallY);
|
|
3276
|
+
toggleClass(this.overlayElement, 'dv-drop-target-small-horizontal', isSmallX);
|
|
3277
|
+
toggleClass(this.overlayElement, 'dv-drop-target-left', isLeft);
|
|
3278
|
+
toggleClass(this.overlayElement, 'dv-drop-target-right', isRight);
|
|
3279
|
+
toggleClass(this.overlayElement, 'dv-drop-target-top', isTop);
|
|
3280
|
+
toggleClass(this.overlayElement, 'dv-drop-target-bottom', isBottom);
|
|
3281
|
+
toggleClass(this.overlayElement, 'dv-drop-target-center', quadrant === 'center');
|
|
3291
3282
|
}
|
|
3292
3283
|
calculateQuadrant(overlayType, x, y, width, height) {
|
|
3293
|
-
var _a, _b
|
|
3294
|
-
const
|
|
3295
|
-
|
|
3296
|
-
const value = numberOrFallback((_f = (_e = (_d = this.options) === null || _d === void 0 ? void 0 : _d.overlayModel) === null || _e === void 0 ? void 0 : _e.activationSize) === null || _f === void 0 ? void 0 : _f.value, 20);
|
|
3284
|
+
var _a, _b;
|
|
3285
|
+
const activationSizeOptions = (_b = (_a = this.options.overlayModel) === null || _a === void 0 ? void 0 : _a.activationSize) !== null && _b !== void 0 ? _b : DEFAULT_ACTIVATION_SIZE;
|
|
3286
|
+
const isPercentage = activationSizeOptions.type === 'percentage';
|
|
3297
3287
|
if (isPercentage) {
|
|
3298
|
-
return calculateQuadrantAsPercentage(overlayType, x, y, width, height, value);
|
|
3288
|
+
return calculateQuadrantAsPercentage(overlayType, x, y, width, height, activationSizeOptions.value);
|
|
3299
3289
|
}
|
|
3300
|
-
return calculateQuadrantAsPixels(overlayType, x, y, width, height, value);
|
|
3290
|
+
return calculateQuadrantAsPixels(overlayType, x, y, width, height, activationSizeOptions.value);
|
|
3301
3291
|
}
|
|
3302
3292
|
removeDropTarget() {
|
|
3303
3293
|
if (this.targetElement) {
|
|
@@ -3471,11 +3461,11 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3471
3461
|
}
|
|
3472
3462
|
closePanel() {
|
|
3473
3463
|
if (this.panel) {
|
|
3474
|
-
if (this.
|
|
3464
|
+
if (this.panel.api.renderer === 'onlyWhenVisibile') {
|
|
3475
3465
|
this._element.removeChild(this.panel.view.content.element);
|
|
3476
3466
|
}
|
|
3477
|
-
this.panel = undefined;
|
|
3478
3467
|
}
|
|
3468
|
+
this.panel = undefined;
|
|
3479
3469
|
}
|
|
3480
3470
|
dispose() {
|
|
3481
3471
|
this.disposable.dispose();
|
|
@@ -4226,6 +4216,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4226
4216
|
if (!skipSetGroupActive) {
|
|
4227
4217
|
this.accessor.doSetGroupActive(this.groupPanel);
|
|
4228
4218
|
}
|
|
4219
|
+
this.contentContainer.renderPanel(panel, { asActive: true });
|
|
4229
4220
|
return;
|
|
4230
4221
|
}
|
|
4231
4222
|
this.doAddPanel(panel, options.index, skipSetPanelActive);
|
|
@@ -4489,6 +4480,21 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4489
4480
|
if (this.disableResizing) {
|
|
4490
4481
|
return;
|
|
4491
4482
|
}
|
|
4483
|
+
if (!this._element.offsetParent) {
|
|
4484
|
+
/**
|
|
4485
|
+
* offsetParent === null is equivalent to display: none being set on the element or one
|
|
4486
|
+
* of it's parents. In the display: none case the size will become (0, 0) which we do
|
|
4487
|
+
* not want to propagate.
|
|
4488
|
+
*
|
|
4489
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent
|
|
4490
|
+
*
|
|
4491
|
+
* You could use checkVisibility() but at the time of writing it's not supported across
|
|
4492
|
+
* all Browsers
|
|
4493
|
+
*
|
|
4494
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/checkVisibility
|
|
4495
|
+
*/
|
|
4496
|
+
return;
|
|
4497
|
+
}
|
|
4492
4498
|
if (!isInDocument(this._element)) {
|
|
4493
4499
|
/**
|
|
4494
4500
|
* since the event is dispatched through requestAnimationFrame there is a small chance
|
|
@@ -6497,6 +6503,10 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6497
6503
|
}
|
|
6498
6504
|
}
|
|
6499
6505
|
|
|
6506
|
+
const DEFAULT_ROOT_OVERLAY_MODEL = {
|
|
6507
|
+
activationSize: { type: 'pixels', value: 10 },
|
|
6508
|
+
size: { type: 'pixels', value: 20 },
|
|
6509
|
+
};
|
|
6500
6510
|
function getTheme(element) {
|
|
6501
6511
|
function toClassList(element) {
|
|
6502
6512
|
const list = [];
|
|
@@ -6541,7 +6551,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6541
6551
|
return (_a = this.options.defaultRenderer) !== null && _a !== void 0 ? _a : 'onlyWhenVisibile';
|
|
6542
6552
|
}
|
|
6543
6553
|
constructor(options) {
|
|
6544
|
-
var _a;
|
|
6554
|
+
var _a, _b;
|
|
6545
6555
|
super({
|
|
6546
6556
|
proportionalLayout: true,
|
|
6547
6557
|
orientation: (_a = options.orientation) !== null && _a !== void 0 ? _a : exports.Orientation.HORIZONTAL,
|
|
@@ -6605,7 +6615,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6605
6615
|
!this.options.watermarkFrameworkComponent) {
|
|
6606
6616
|
this.options.watermarkComponent = Watermark;
|
|
6607
6617
|
}
|
|
6608
|
-
|
|
6618
|
+
this._rootDropTarget = new Droptarget(this.element, {
|
|
6609
6619
|
canDisplayOverlay: (event, position) => {
|
|
6610
6620
|
const data = getPanelData();
|
|
6611
6621
|
if (data) {
|
|
@@ -6638,12 +6648,9 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6638
6648
|
return false;
|
|
6639
6649
|
},
|
|
6640
6650
|
acceptedTargetZones: ['top', 'bottom', 'left', 'right', 'center'],
|
|
6641
|
-
overlayModel:
|
|
6642
|
-
activationSize: { type: 'pixels', value: 10 },
|
|
6643
|
-
size: { type: 'pixels', value: 20 },
|
|
6644
|
-
},
|
|
6651
|
+
overlayModel: (_b = this.options.rootOverlayModel) !== null && _b !== void 0 ? _b : DEFAULT_ROOT_OVERLAY_MODEL,
|
|
6645
6652
|
});
|
|
6646
|
-
this.addDisposables(
|
|
6653
|
+
this.addDisposables(this._rootDropTarget.onDrop((event) => {
|
|
6647
6654
|
var _a;
|
|
6648
6655
|
const data = getPanelData();
|
|
6649
6656
|
if (data) {
|
|
@@ -6652,7 +6659,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6652
6659
|
else {
|
|
6653
6660
|
this._onDidDrop.fire(Object.assign(Object.assign({}, event), { api: this._api, group: null, getData: getPanelData }));
|
|
6654
6661
|
}
|
|
6655
|
-
}),
|
|
6662
|
+
}), this._rootDropTarget);
|
|
6656
6663
|
this._api = new DockviewApi(this);
|
|
6657
6664
|
this.updateWatermark();
|
|
6658
6665
|
}
|
|
@@ -6815,15 +6822,17 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6815
6822
|
}
|
|
6816
6823
|
updateOptions(options) {
|
|
6817
6824
|
var _a, _b;
|
|
6818
|
-
const
|
|
6825
|
+
const changed_orientation = typeof options.orientation === 'string' &&
|
|
6819
6826
|
this.gridview.orientation !== options.orientation;
|
|
6820
|
-
const
|
|
6827
|
+
const changed_floatingGroupBounds = options.floatingGroupBounds !== undefined &&
|
|
6821
6828
|
options.floatingGroupBounds !== this.options.floatingGroupBounds;
|
|
6829
|
+
const changed_rootOverlayOptions = options.rootOverlayModel !== undefined &&
|
|
6830
|
+
options.rootOverlayModel !== this.options.rootOverlayModel;
|
|
6822
6831
|
this._options = Object.assign(Object.assign({}, this.options), options);
|
|
6823
|
-
if (
|
|
6832
|
+
if (changed_orientation) {
|
|
6824
6833
|
this.gridview.orientation = options.orientation;
|
|
6825
6834
|
}
|
|
6826
|
-
if (
|
|
6835
|
+
if (changed_floatingGroupBounds) {
|
|
6827
6836
|
for (const group of this._floatingGroups) {
|
|
6828
6837
|
switch (this.options.floatingGroupBounds) {
|
|
6829
6838
|
case 'boundedWithinViewport':
|
|
@@ -6845,6 +6854,9 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6845
6854
|
group.overlay.setBounds({});
|
|
6846
6855
|
}
|
|
6847
6856
|
}
|
|
6857
|
+
if (changed_rootOverlayOptions) {
|
|
6858
|
+
this._rootDropTarget.setOverlayModel(options.rootOverlayModel);
|
|
6859
|
+
}
|
|
6848
6860
|
this.layout(this.gridview.width, this.gridview.height, true);
|
|
6849
6861
|
}
|
|
6850
6862
|
layout(width, height, forceResize) {
|
|
@@ -7226,7 +7238,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7226
7238
|
}
|
|
7227
7239
|
addGroup(options) {
|
|
7228
7240
|
var _a;
|
|
7229
|
-
const group = this.createGroup();
|
|
7241
|
+
const group = this.createGroup(options);
|
|
7230
7242
|
if (options) {
|
|
7231
7243
|
let referenceGroup;
|
|
7232
7244
|
if (isGroupOptionsWithPanel(options)) {
|