dockview 1.9.0 → 1.9.1
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/dockview/dockview.d.ts +2 -1
- package/dist/cjs/dockview/dockview.d.ts.map +1 -1
- package/dist/cjs/dockview/dockview.js +9 -0
- package/dist/cjs/dockview/dockview.js.map +1 -1
- package/dist/dockview.amd.js +80 -60
- package/dist/dockview.amd.js.map +1 -1
- package/dist/dockview.amd.min.js +2 -2
- package/dist/dockview.amd.min.js.map +1 -1
- package/dist/dockview.amd.min.noStyle.js +2 -2
- package/dist/dockview.amd.min.noStyle.js.map +1 -1
- package/dist/dockview.amd.noStyle.js +80 -60
- package/dist/dockview.amd.noStyle.js.map +1 -1
- package/dist/dockview.cjs.js +80 -60
- package/dist/dockview.cjs.js.map +1 -1
- package/dist/dockview.esm.js +80 -60
- package/dist/dockview.esm.js.map +1 -1
- package/dist/dockview.esm.min.js +2 -2
- package/dist/dockview.esm.min.js.map +1 -1
- package/dist/dockview.js +80 -60
- package/dist/dockview.js.map +1 -1
- package/dist/dockview.min.js +2 -2
- package/dist/dockview.min.js.map +1 -1
- package/dist/dockview.min.noStyle.js +2 -2
- package/dist/dockview.min.noStyle.js.map +1 -1
- package/dist/dockview.noStyle.js +80 -60
- package/dist/dockview.noStyle.js.map +1 -1
- package/dist/esm/dockview/dockview.d.ts +2 -1
- package/dist/esm/dockview/dockview.d.ts.map +1 -1
- package/dist/esm/dockview/dockview.js +9 -0
- package/dist/esm/dockview/dockview.js.map +1 -1
- package/package.json +2 -2
package/dist/dockview.noStyle.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dockview
|
|
3
|
-
* @version 1.9.
|
|
3
|
+
* @version 1.9.1
|
|
4
4
|
* @link https://github.com/mathuo/dockview
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
@@ -3102,9 +3102,6 @@
|
|
|
3102
3102
|
}
|
|
3103
3103
|
}
|
|
3104
3104
|
|
|
3105
|
-
function numberOrFallback(maybeNumber, fallback) {
|
|
3106
|
-
return typeof maybeNumber === 'number' ? maybeNumber : fallback;
|
|
3107
|
-
}
|
|
3108
3105
|
function directionToPosition(direction) {
|
|
3109
3106
|
switch (direction) {
|
|
3110
3107
|
case 'above':
|
|
@@ -3137,6 +3134,16 @@
|
|
|
3137
3134
|
throw new Error(`invalid position '${position}'`);
|
|
3138
3135
|
}
|
|
3139
3136
|
}
|
|
3137
|
+
const DEFAULT_ACTIVATION_SIZE = {
|
|
3138
|
+
value: 20,
|
|
3139
|
+
type: 'percentage',
|
|
3140
|
+
};
|
|
3141
|
+
const DEFAULT_SIZE = {
|
|
3142
|
+
value: 50,
|
|
3143
|
+
type: 'percentage',
|
|
3144
|
+
};
|
|
3145
|
+
const SMALL_WIDTH_BOUNDARY = 100;
|
|
3146
|
+
const SMALL_HEIGHT_BOUNDARY = 100;
|
|
3140
3147
|
class Droptarget extends CompositeDisposable {
|
|
3141
3148
|
get state() {
|
|
3142
3149
|
return this._state;
|
|
@@ -3197,7 +3204,7 @@
|
|
|
3197
3204
|
this.element.append(this.targetElement);
|
|
3198
3205
|
}
|
|
3199
3206
|
this.toggleClasses(quadrant, width, height);
|
|
3200
|
-
this.
|
|
3207
|
+
this._state = quadrant;
|
|
3201
3208
|
},
|
|
3202
3209
|
onDragLeave: () => {
|
|
3203
3210
|
this.removeDropTarget();
|
|
@@ -3222,6 +3229,9 @@
|
|
|
3222
3229
|
setTargetZones(acceptedTargetZones) {
|
|
3223
3230
|
this._acceptedTargetZonesSet = new Set(acceptedTargetZones);
|
|
3224
3231
|
}
|
|
3232
|
+
setOverlayModel(model) {
|
|
3233
|
+
this.options.overlayModel = model;
|
|
3234
|
+
}
|
|
3225
3235
|
dispose() {
|
|
3226
3236
|
this.removeDropTarget();
|
|
3227
3237
|
super.dispose();
|
|
@@ -3233,19 +3243,19 @@
|
|
|
3233
3243
|
event[Droptarget.USED_EVENT_ID] = true;
|
|
3234
3244
|
}
|
|
3235
3245
|
/**
|
|
3236
|
-
* Check is the event has already been used by another instance
|
|
3246
|
+
* Check is the event has already been used by another instance of DropTarget
|
|
3237
3247
|
*/
|
|
3238
3248
|
isAlreadyUsed(event) {
|
|
3239
3249
|
const value = event[Droptarget.USED_EVENT_ID];
|
|
3240
3250
|
return typeof value === 'boolean' && value;
|
|
3241
3251
|
}
|
|
3242
3252
|
toggleClasses(quadrant, width, height) {
|
|
3243
|
-
var _a, _b
|
|
3253
|
+
var _a, _b;
|
|
3244
3254
|
if (!this.overlayElement) {
|
|
3245
3255
|
return;
|
|
3246
3256
|
}
|
|
3247
|
-
const isSmallX = width <
|
|
3248
|
-
const isSmallY = height <
|
|
3257
|
+
const isSmallX = width < SMALL_WIDTH_BOUNDARY;
|
|
3258
|
+
const isSmallY = height < SMALL_HEIGHT_BOUNDARY;
|
|
3249
3259
|
const isLeft = quadrant === 'left';
|
|
3250
3260
|
const isRight = quadrant === 'right';
|
|
3251
3261
|
const isTop = quadrant === 'top';
|
|
@@ -3254,20 +3264,17 @@
|
|
|
3254
3264
|
const leftClass = !isSmallX && isLeft;
|
|
3255
3265
|
const topClass = !isSmallY && isTop;
|
|
3256
3266
|
const bottomClass = !isSmallY && isBottom;
|
|
3257
|
-
let size =
|
|
3258
|
-
|
|
3259
|
-
|
|
3267
|
+
let size = 1;
|
|
3268
|
+
const sizeOptions = (_b = (_a = this.options.overlayModel) === null || _a === void 0 ? void 0 : _a.size) !== null && _b !== void 0 ? _b : DEFAULT_SIZE;
|
|
3269
|
+
if (sizeOptions.type === 'percentage') {
|
|
3270
|
+
size = clamp(sizeOptions.value, 0, 100) / 100;
|
|
3260
3271
|
}
|
|
3261
|
-
|
|
3272
|
+
else {
|
|
3262
3273
|
if (rightClass || leftClass) {
|
|
3263
|
-
size =
|
|
3264
|
-
clamp(0, this.options.overlayModel.size.value, width) /
|
|
3265
|
-
width;
|
|
3274
|
+
size = clamp(0, sizeOptions.value, width) / width;
|
|
3266
3275
|
}
|
|
3267
3276
|
if (topClass || bottomClass) {
|
|
3268
|
-
size =
|
|
3269
|
-
clamp(0, this.options.overlayModel.size.value, height) /
|
|
3270
|
-
height;
|
|
3277
|
+
size = clamp(0, sizeOptions.value, height) / height;
|
|
3271
3278
|
}
|
|
3272
3279
|
}
|
|
3273
3280
|
const translate = (1 - size) / 2;
|
|
@@ -3289,39 +3296,22 @@
|
|
|
3289
3296
|
transform = '';
|
|
3290
3297
|
}
|
|
3291
3298
|
this.overlayElement.style.transform = transform;
|
|
3292
|
-
toggleClass(this.overlayElement, 'small-
|
|
3293
|
-
toggleClass(this.overlayElement, 'small-
|
|
3294
|
-
toggleClass(this.overlayElement, '
|
|
3295
|
-
toggleClass(this.overlayElement, '
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
case 'top':
|
|
3300
|
-
this._state = 'top';
|
|
3301
|
-
break;
|
|
3302
|
-
case 'left':
|
|
3303
|
-
this._state = 'left';
|
|
3304
|
-
break;
|
|
3305
|
-
case 'bottom':
|
|
3306
|
-
this._state = 'bottom';
|
|
3307
|
-
break;
|
|
3308
|
-
case 'right':
|
|
3309
|
-
this._state = 'right';
|
|
3310
|
-
break;
|
|
3311
|
-
case 'center':
|
|
3312
|
-
this._state = 'center';
|
|
3313
|
-
break;
|
|
3314
|
-
}
|
|
3299
|
+
toggleClass(this.overlayElement, 'dv-drop-target-small-vertical', isSmallY);
|
|
3300
|
+
toggleClass(this.overlayElement, 'dv-drop-target-small-horizontal', isSmallX);
|
|
3301
|
+
toggleClass(this.overlayElement, 'dv-drop-target-left', isLeft);
|
|
3302
|
+
toggleClass(this.overlayElement, 'dv-drop-target-right', isRight);
|
|
3303
|
+
toggleClass(this.overlayElement, 'dv-drop-target-top', isTop);
|
|
3304
|
+
toggleClass(this.overlayElement, 'dv-drop-target-bottom', isBottom);
|
|
3305
|
+
toggleClass(this.overlayElement, 'dv-drop-target-center', quadrant === 'center');
|
|
3315
3306
|
}
|
|
3316
3307
|
calculateQuadrant(overlayType, x, y, width, height) {
|
|
3317
|
-
var _a, _b
|
|
3318
|
-
const
|
|
3319
|
-
|
|
3320
|
-
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);
|
|
3308
|
+
var _a, _b;
|
|
3309
|
+
const activationSizeOptions = (_b = (_a = this.options.overlayModel) === null || _a === void 0 ? void 0 : _a.activationSize) !== null && _b !== void 0 ? _b : DEFAULT_ACTIVATION_SIZE;
|
|
3310
|
+
const isPercentage = activationSizeOptions.type === 'percentage';
|
|
3321
3311
|
if (isPercentage) {
|
|
3322
|
-
return calculateQuadrantAsPercentage(overlayType, x, y, width, height, value);
|
|
3312
|
+
return calculateQuadrantAsPercentage(overlayType, x, y, width, height, activationSizeOptions.value);
|
|
3323
3313
|
}
|
|
3324
|
-
return calculateQuadrantAsPixels(overlayType, x, y, width, height, value);
|
|
3314
|
+
return calculateQuadrantAsPixels(overlayType, x, y, width, height, activationSizeOptions.value);
|
|
3325
3315
|
}
|
|
3326
3316
|
removeDropTarget() {
|
|
3327
3317
|
if (this.targetElement) {
|
|
@@ -4513,6 +4503,21 @@
|
|
|
4513
4503
|
if (this.disableResizing) {
|
|
4514
4504
|
return;
|
|
4515
4505
|
}
|
|
4506
|
+
if (!this._element.offsetParent) {
|
|
4507
|
+
/**
|
|
4508
|
+
* offsetParent === null is equivalent to display: none being set on the element or one
|
|
4509
|
+
* of it's parents. In the display: none case the size will become (0, 0) which we do
|
|
4510
|
+
* not want to propagate.
|
|
4511
|
+
*
|
|
4512
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent
|
|
4513
|
+
*
|
|
4514
|
+
* You could use checkVisibility() but at the time of writing it's not supported across
|
|
4515
|
+
* all Browsers
|
|
4516
|
+
*
|
|
4517
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/checkVisibility
|
|
4518
|
+
*/
|
|
4519
|
+
return;
|
|
4520
|
+
}
|
|
4516
4521
|
if (!isInDocument(this._element)) {
|
|
4517
4522
|
/**
|
|
4518
4523
|
* since the event is dispatched through requestAnimationFrame there is a small chance
|
|
@@ -6521,6 +6526,10 @@
|
|
|
6521
6526
|
}
|
|
6522
6527
|
}
|
|
6523
6528
|
|
|
6529
|
+
const DEFAULT_ROOT_OVERLAY_MODEL = {
|
|
6530
|
+
activationSize: { type: 'pixels', value: 10 },
|
|
6531
|
+
size: { type: 'pixels', value: 20 },
|
|
6532
|
+
};
|
|
6524
6533
|
function getTheme(element) {
|
|
6525
6534
|
function toClassList(element) {
|
|
6526
6535
|
const list = [];
|
|
@@ -6565,7 +6574,7 @@
|
|
|
6565
6574
|
return (_a = this.options.defaultRenderer) !== null && _a !== void 0 ? _a : 'onlyWhenVisibile';
|
|
6566
6575
|
}
|
|
6567
6576
|
constructor(options) {
|
|
6568
|
-
var _a;
|
|
6577
|
+
var _a, _b;
|
|
6569
6578
|
super({
|
|
6570
6579
|
proportionalLayout: true,
|
|
6571
6580
|
orientation: (_a = options.orientation) !== null && _a !== void 0 ? _a : exports.Orientation.HORIZONTAL,
|
|
@@ -6629,7 +6638,7 @@
|
|
|
6629
6638
|
!this.options.watermarkFrameworkComponent) {
|
|
6630
6639
|
this.options.watermarkComponent = Watermark;
|
|
6631
6640
|
}
|
|
6632
|
-
|
|
6641
|
+
this._rootDropTarget = new Droptarget(this.element, {
|
|
6633
6642
|
canDisplayOverlay: (event, position) => {
|
|
6634
6643
|
const data = getPanelData();
|
|
6635
6644
|
if (data) {
|
|
@@ -6662,12 +6671,9 @@
|
|
|
6662
6671
|
return false;
|
|
6663
6672
|
},
|
|
6664
6673
|
acceptedTargetZones: ['top', 'bottom', 'left', 'right', 'center'],
|
|
6665
|
-
overlayModel:
|
|
6666
|
-
activationSize: { type: 'pixels', value: 10 },
|
|
6667
|
-
size: { type: 'pixels', value: 20 },
|
|
6668
|
-
},
|
|
6674
|
+
overlayModel: (_b = this.options.rootOverlayModel) !== null && _b !== void 0 ? _b : DEFAULT_ROOT_OVERLAY_MODEL,
|
|
6669
6675
|
});
|
|
6670
|
-
this.addDisposables(
|
|
6676
|
+
this.addDisposables(this._rootDropTarget.onDrop((event) => {
|
|
6671
6677
|
var _a;
|
|
6672
6678
|
const data = getPanelData();
|
|
6673
6679
|
if (data) {
|
|
@@ -6676,7 +6682,7 @@
|
|
|
6676
6682
|
else {
|
|
6677
6683
|
this._onDidDrop.fire(Object.assign(Object.assign({}, event), { api: this._api, group: null, getData: getPanelData }));
|
|
6678
6684
|
}
|
|
6679
|
-
}),
|
|
6685
|
+
}), this._rootDropTarget);
|
|
6680
6686
|
this._api = new DockviewApi(this);
|
|
6681
6687
|
this.updateWatermark();
|
|
6682
6688
|
}
|
|
@@ -6839,15 +6845,17 @@
|
|
|
6839
6845
|
}
|
|
6840
6846
|
updateOptions(options) {
|
|
6841
6847
|
var _a, _b;
|
|
6842
|
-
const
|
|
6848
|
+
const changed_orientation = typeof options.orientation === 'string' &&
|
|
6843
6849
|
this.gridview.orientation !== options.orientation;
|
|
6844
|
-
const
|
|
6850
|
+
const changed_floatingGroupBounds = options.floatingGroupBounds !== undefined &&
|
|
6845
6851
|
options.floatingGroupBounds !== this.options.floatingGroupBounds;
|
|
6852
|
+
const changed_rootOverlayOptions = options.rootOverlayModel !== undefined &&
|
|
6853
|
+
options.rootOverlayModel !== this.options.rootOverlayModel;
|
|
6846
6854
|
this._options = Object.assign(Object.assign({}, this.options), options);
|
|
6847
|
-
if (
|
|
6855
|
+
if (changed_orientation) {
|
|
6848
6856
|
this.gridview.orientation = options.orientation;
|
|
6849
6857
|
}
|
|
6850
|
-
if (
|
|
6858
|
+
if (changed_floatingGroupBounds) {
|
|
6851
6859
|
for (const group of this._floatingGroups) {
|
|
6852
6860
|
switch (this.options.floatingGroupBounds) {
|
|
6853
6861
|
case 'boundedWithinViewport':
|
|
@@ -6869,6 +6877,9 @@
|
|
|
6869
6877
|
group.overlay.setBounds({});
|
|
6870
6878
|
}
|
|
6871
6879
|
}
|
|
6880
|
+
if (changed_rootOverlayOptions) {
|
|
6881
|
+
this._rootDropTarget.setOverlayModel(options.rootOverlayModel);
|
|
6882
|
+
}
|
|
6872
6883
|
this.layout(this.gridview.width, this.gridview.height, true);
|
|
6873
6884
|
}
|
|
6874
6885
|
layout(width, height, forceResize) {
|
|
@@ -8844,6 +8855,7 @@
|
|
|
8844
8855
|
floatingGroupBounds: props.floatingGroupBounds,
|
|
8845
8856
|
defaultRenderer: props.defaultRenderer,
|
|
8846
8857
|
debug: props.debug,
|
|
8858
|
+
rootOverlayModel: props.rootOverlayModel,
|
|
8847
8859
|
});
|
|
8848
8860
|
const { clientWidth, clientHeight } = domRef.current;
|
|
8849
8861
|
dockview.layout(clientWidth, clientHeight);
|
|
@@ -8951,6 +8963,14 @@
|
|
|
8951
8963
|
createLeftHeaderActionsElement: createGroupControlElement(props.leftHeaderActionsComponent, { addPortal }),
|
|
8952
8964
|
});
|
|
8953
8965
|
}, [props.leftHeaderActionsComponent]);
|
|
8966
|
+
React__namespace.useEffect(() => {
|
|
8967
|
+
if (!dockviewRef.current) {
|
|
8968
|
+
return;
|
|
8969
|
+
}
|
|
8970
|
+
dockviewRef.current.updateOptions({
|
|
8971
|
+
rootOverlayModel: props.rootOverlayModel,
|
|
8972
|
+
});
|
|
8973
|
+
}, [props.rootOverlayModel]);
|
|
8954
8974
|
React__namespace.useEffect(() => {
|
|
8955
8975
|
if (!dockviewRef.current) {
|
|
8956
8976
|
return;
|