dockview-react 8.4.0 → 8.5.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.
- package/dist/cjs/react.d.ts +13 -0
- package/dist/dockview-react.js +314 -166
- package/dist/dockview-react.min.js +3 -3
- package/dist/package/main.cjs.js +127 -57
- package/dist/package/main.cjs.min.js +2 -2
- package/dist/package/main.esm.min.mjs +2 -2
- package/dist/package/main.esm.mjs +126 -58
- package/package.json +2 -2
package/dist/dockview-react.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dockview-react
|
|
3
|
-
* @version 8.
|
|
3
|
+
* @version 8.5.0
|
|
4
4
|
* @link https://github.com/dockview/dockview
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
@@ -51,7 +51,7 @@ react_dom = __toESM(react_dom);
|
|
|
51
51
|
//#region ../dockview-core/dist/package/main.esm.mjs
|
|
52
52
|
/**
|
|
53
53
|
* dockview-core
|
|
54
|
-
* @version 8.
|
|
54
|
+
* @version 8.5.0
|
|
55
55
|
* @link https://github.com/dockview/dockview
|
|
56
56
|
* @license MIT
|
|
57
57
|
*/
|
|
@@ -372,21 +372,29 @@ react_dom = __toESM(react_dom);
|
|
|
372
372
|
}
|
|
373
373
|
};
|
|
374
374
|
function watchElementResize(element, cb) {
|
|
375
|
+
const pendingFrames = /* @__PURE__ */ new Set();
|
|
375
376
|
const observer = new ResizeObserver((entires) => {
|
|
376
377
|
/**
|
|
377
378
|
* Fast browser window resize produces Error: ResizeObserver loop limit exceeded.
|
|
378
379
|
* The error isn't visible in browser console, doesn't affect functionality, but degrades performance.
|
|
379
380
|
* See https://stackoverflow.com/questions/49384120/resizeobserver-loop-limit-exceeded/58701523#58701523
|
|
380
381
|
*/
|
|
381
|
-
|
|
382
|
+
let ran = false;
|
|
383
|
+
let frame;
|
|
384
|
+
frame = requestAnimationFrame(() => {
|
|
385
|
+
ran = true;
|
|
386
|
+
if (frame !== void 0) pendingFrames.delete(frame);
|
|
382
387
|
const firstEntry = entires[0];
|
|
383
388
|
cb(firstEntry);
|
|
384
389
|
});
|
|
390
|
+
if (!ran) pendingFrames.add(frame);
|
|
385
391
|
});
|
|
386
392
|
observer.observe(element);
|
|
387
393
|
return { dispose: () => {
|
|
388
394
|
observer.unobserve(element);
|
|
389
395
|
observer.disconnect();
|
|
396
|
+
for (const frame of pendingFrames) cancelAnimationFrame(frame);
|
|
397
|
+
pendingFrames.clear();
|
|
390
398
|
} };
|
|
391
399
|
}
|
|
392
400
|
const removeClasses = (element, ...classes) => {
|
|
@@ -5988,24 +5996,25 @@ react_dom = __toESM(react_dom);
|
|
|
5988
5996
|
else this._element.removeAttribute("aria-labelledby");
|
|
5989
5997
|
}
|
|
5990
5998
|
renderPanel(panel, options) {
|
|
5991
|
-
var _options$asActive
|
|
5992
|
-
const doRender = ((_options$asActive = options === null || options === void 0 ? void 0 : options.asActive) !== null && _options$asActive !== void 0 ? _options$asActive : true) || this.
|
|
5993
|
-
if (
|
|
5994
|
-
var _this$panel
|
|
5995
|
-
this.panel.view.content.element.
|
|
5996
|
-
|
|
5999
|
+
var _options$asActive;
|
|
6000
|
+
const doRender = ((_options$asActive = options === null || options === void 0 ? void 0 : options.asActive) !== null && _options$asActive !== void 0 ? _options$asActive : true) || this.group.isPanelActive(panel);
|
|
6001
|
+
if (doRender || this.panel === panel) {
|
|
6002
|
+
var _this$panel;
|
|
6003
|
+
if (((_this$panel = this.panel) === null || _this$panel === void 0 ? void 0 : _this$panel.view.content.element.parentElement) === this._element) {
|
|
6004
|
+
var _this$panel$view$cont, _this$panel$view$cont2;
|
|
6005
|
+
this.panel.view.content.element.remove();
|
|
6006
|
+
(_this$panel$view$cont = (_this$panel$view$cont2 = this.panel.view.content).onHide) === null || _this$panel$view$cont === void 0 || _this$panel$view$cont.call(_this$panel$view$cont2);
|
|
6007
|
+
}
|
|
6008
|
+
this.panel = panel;
|
|
5997
6009
|
}
|
|
5998
|
-
this.panel = panel;
|
|
5999
6010
|
let container;
|
|
6000
6011
|
switch (panel.api.renderer) {
|
|
6001
6012
|
case "onlyWhenVisible":
|
|
6002
6013
|
this.group.renderContainer.detatch(panel);
|
|
6003
|
-
if (
|
|
6004
|
-
|
|
6005
|
-
|
|
6006
|
-
|
|
6007
|
-
(_this$panel$view$cont3 = (_this$panel$view$cont4 = this.panel.view.content).onShow) === null || _this$panel$view$cont3 === void 0 || _this$panel$view$cont3.call(_this$panel$view$cont4);
|
|
6008
|
-
}
|
|
6014
|
+
if (doRender) {
|
|
6015
|
+
var _panel$view$content$o, _panel$view$content;
|
|
6016
|
+
this._element.appendChild(panel.view.content.element);
|
|
6017
|
+
(_panel$view$content$o = (_panel$view$content = panel.view.content).onShow) === null || _panel$view$content$o === void 0 || _panel$view$content$o.call(_panel$view$content);
|
|
6009
6018
|
}
|
|
6010
6019
|
container = this._element;
|
|
6011
6020
|
break;
|
|
@@ -6034,9 +6043,9 @@ react_dom = __toESM(react_dom);
|
|
|
6034
6043
|
closePanel() {
|
|
6035
6044
|
if (this.panel) {
|
|
6036
6045
|
if (this.panel.api.renderer === "onlyWhenVisible") {
|
|
6037
|
-
var _this$panel$view$
|
|
6046
|
+
var _this$panel$view$cont3, _this$panel$view$cont4;
|
|
6038
6047
|
this.panel.view.content.element.remove();
|
|
6039
|
-
(_this$panel$view$
|
|
6048
|
+
(_this$panel$view$cont3 = (_this$panel$view$cont4 = this.panel.view.content).onHide) === null || _this$panel$view$cont3 === void 0 || _this$panel$view$cont3.call(_this$panel$view$cont4);
|
|
6040
6049
|
}
|
|
6041
6050
|
}
|
|
6042
6051
|
this.panel = void 0;
|
|
@@ -10089,16 +10098,21 @@ react_dom = __toESM(react_dom);
|
|
|
10089
10098
|
y: event.clientY,
|
|
10090
10099
|
zIndex: (relativeParent === null || relativeParent === void 0 ? void 0 : relativeParent.style.zIndex) ? `calc(${relativeParent.style.zIndex} * 2)` : void 0
|
|
10091
10100
|
};
|
|
10092
|
-
const context = this.createOverflowRenderContext(root, anchor);
|
|
10101
|
+
const { context, rowRenderers } = this.createOverflowRenderContext(root, anchor);
|
|
10093
10102
|
const advancedOverflow = this.accessor.advancedOverflowService;
|
|
10094
|
-
|
|
10095
|
-
|
|
10096
|
-
|
|
10097
|
-
|
|
10098
|
-
|
|
10099
|
-
|
|
10100
|
-
|
|
10101
|
-
|
|
10103
|
+
try {
|
|
10104
|
+
if (advancedOverflow) advancedOverflow.renderOverflow({
|
|
10105
|
+
group: this.group,
|
|
10106
|
+
overflowTabs: [...this._overflowTabs],
|
|
10107
|
+
overflowTabGroups: [...this._overflowTabGroups],
|
|
10108
|
+
pinnedOverflowTabs: [...this._overflowPinnedTabs],
|
|
10109
|
+
context
|
|
10110
|
+
});
|
|
10111
|
+
else context.open(this.renderFreeOverflowList(context));
|
|
10112
|
+
} catch (err) {
|
|
10113
|
+
rowRenderers.dispose();
|
|
10114
|
+
throw err;
|
|
10115
|
+
}
|
|
10102
10116
|
}));
|
|
10103
10117
|
}
|
|
10104
10118
|
/**
|
|
@@ -10119,6 +10133,7 @@ react_dom = __toESM(react_dom);
|
|
|
10119
10133
|
if (overflowGroupSet.has(tg.id)) for (const pid of tg.panelIds) panelToGroup.set(pid, tg);
|
|
10120
10134
|
}
|
|
10121
10135
|
const popup = () => this.accessor.getPopupServiceForGroup(this.group);
|
|
10136
|
+
const rowRenderers = new CompositeDisposable();
|
|
10122
10137
|
const buildGroupHeader = (tg) => {
|
|
10123
10138
|
const groupHeader = document.createElement("div");
|
|
10124
10139
|
groupHeader.className = "dv-tabs-overflow-group-header";
|
|
@@ -10148,69 +10163,87 @@ react_dom = __toESM(react_dom);
|
|
|
10148
10163
|
return groupHeader;
|
|
10149
10164
|
};
|
|
10150
10165
|
return {
|
|
10151
|
-
|
|
10152
|
-
|
|
10153
|
-
|
|
10154
|
-
|
|
10155
|
-
|
|
10156
|
-
|
|
10157
|
-
|
|
10158
|
-
|
|
10159
|
-
|
|
10160
|
-
|
|
10161
|
-
|
|
10162
|
-
|
|
10163
|
-
|
|
10164
|
-
|
|
10165
|
-
|
|
10166
|
-
|
|
10167
|
-
|
|
10168
|
-
|
|
10169
|
-
|
|
10170
|
-
|
|
10171
|
-
|
|
10172
|
-
|
|
10173
|
-
|
|
10174
|
-
|
|
10175
|
-
|
|
10176
|
-
|
|
10177
|
-
|
|
10178
|
-
|
|
10179
|
-
|
|
10180
|
-
|
|
10181
|
-
|
|
10182
|
-
|
|
10183
|
-
|
|
10184
|
-
|
|
10185
|
-
|
|
10186
|
-
block: "nearest",
|
|
10187
|
-
inline: "nearest"
|
|
10166
|
+
context: {
|
|
10167
|
+
overflowGroupIdForPanel: (panelId) => {
|
|
10168
|
+
var _panelToGroup$get;
|
|
10169
|
+
return (_panelToGroup$get = panelToGroup.get(panelId)) === null || _panelToGroup$get === void 0 ? void 0 : _panelToGroup$get.id;
|
|
10170
|
+
},
|
|
10171
|
+
buildGroupHeader: (tabGroupId) => {
|
|
10172
|
+
const tg = groupById.get(tabGroupId);
|
|
10173
|
+
if (!tg || !overflowGroupSet.has(tg.id)) return;
|
|
10174
|
+
return buildGroupHeader(tg);
|
|
10175
|
+
},
|
|
10176
|
+
buildPinnedHeader: () => {
|
|
10177
|
+
const header = document.createElement("div");
|
|
10178
|
+
header.className = "dv-tabs-overflow-group-header dv-tabs-overflow-pinned-header";
|
|
10179
|
+
const glyph = createPinButton();
|
|
10180
|
+
glyph.classList.add("dv-tabs-overflow-pinned-icon");
|
|
10181
|
+
header.appendChild(glyph);
|
|
10182
|
+
const labelSpan = document.createElement("span");
|
|
10183
|
+
labelSpan.className = "dv-tabs-overflow-group-label";
|
|
10184
|
+
labelSpan.textContent = "Pinned";
|
|
10185
|
+
header.appendChild(labelSpan);
|
|
10186
|
+
return header;
|
|
10187
|
+
},
|
|
10188
|
+
buildRow: (panelId) => {
|
|
10189
|
+
const panel = this.group.panels.find((p) => p.id === panelId);
|
|
10190
|
+
if (!panel) return;
|
|
10191
|
+
const tab = this.tabs.tabs.find((t) => t.panel.id === panelId);
|
|
10192
|
+
const tg = panelToGroup.get(panelId);
|
|
10193
|
+
const tabComponent = panel.view.createTabRenderer("headerOverflow");
|
|
10194
|
+
let rowDisposed = false;
|
|
10195
|
+
const disposeRow = Disposable.from(() => {
|
|
10196
|
+
if (!rowDisposed) {
|
|
10197
|
+
var _tabComponent$dispose;
|
|
10198
|
+
rowDisposed = true;
|
|
10199
|
+
(_tabComponent$dispose = tabComponent.dispose) === null || _tabComponent$dispose === void 0 || _tabComponent$dispose.call(tabComponent);
|
|
10200
|
+
}
|
|
10188
10201
|
});
|
|
10189
|
-
|
|
10190
|
-
|
|
10191
|
-
|
|
10192
|
-
|
|
10193
|
-
|
|
10194
|
-
|
|
10195
|
-
|
|
10196
|
-
|
|
10197
|
-
|
|
10198
|
-
|
|
10199
|
-
|
|
10200
|
-
|
|
10202
|
+
if (rowRenderers.isDisposed) disposeRow.dispose();
|
|
10203
|
+
else rowRenderers.addDisposables(disposeRow);
|
|
10204
|
+
const child = tabComponent.element;
|
|
10205
|
+
const wrapper = document.createElement("div");
|
|
10206
|
+
toggleClass(wrapper, "dv-tab", true);
|
|
10207
|
+
toggleClass(wrapper, "dv-active-tab", panel.api.isActive);
|
|
10208
|
+
toggleClass(wrapper, "dv-inactive-tab", !panel.api.isActive);
|
|
10209
|
+
if (tg) toggleClass(wrapper, "dv-tab--grouped", true);
|
|
10210
|
+
const doActivate = () => {
|
|
10211
|
+
if (tg === null || tg === void 0 ? void 0 : tg.collapsed) tg.expand();
|
|
10212
|
+
tab === null || tab === void 0 || tab.element.scrollIntoView({
|
|
10213
|
+
block: "nearest",
|
|
10214
|
+
inline: "nearest"
|
|
10215
|
+
});
|
|
10216
|
+
this.accessor.withOrigin("user", () => panel.api.setActive());
|
|
10217
|
+
};
|
|
10218
|
+
wrapper.addEventListener("click", (event) => {
|
|
10201
10219
|
popup().close();
|
|
10220
|
+
if (event.defaultPrevented) return;
|
|
10202
10221
|
doActivate();
|
|
10203
|
-
}
|
|
10204
|
-
|
|
10205
|
-
|
|
10206
|
-
|
|
10207
|
-
|
|
10222
|
+
});
|
|
10223
|
+
wrapper.appendChild(child);
|
|
10224
|
+
return {
|
|
10225
|
+
element: wrapper,
|
|
10226
|
+
panel,
|
|
10227
|
+
activate: () => {
|
|
10228
|
+
popup().close();
|
|
10229
|
+
doActivate();
|
|
10230
|
+
},
|
|
10231
|
+
dispose: () => {
|
|
10232
|
+
rowRenderers.removeDisposable(disposeRow);
|
|
10233
|
+
disposeRow.dispose();
|
|
10234
|
+
}
|
|
10235
|
+
};
|
|
10236
|
+
},
|
|
10237
|
+
open: (body) => {
|
|
10238
|
+
popup().openPopover(body, anchor, { onClose: () => rowRenderers.dispose() });
|
|
10239
|
+
},
|
|
10240
|
+
close: () => popup().close(),
|
|
10241
|
+
focusTrigger: () => {
|
|
10242
|
+
root.tabIndex = -1;
|
|
10243
|
+
root.focus();
|
|
10244
|
+
}
|
|
10208
10245
|
},
|
|
10209
|
-
|
|
10210
|
-
focusTrigger: () => {
|
|
10211
|
-
root.tabIndex = -1;
|
|
10212
|
-
root.focus();
|
|
10213
|
-
}
|
|
10246
|
+
rowRenderers
|
|
10214
10247
|
};
|
|
10215
10248
|
}
|
|
10216
10249
|
/**
|
|
@@ -10987,7 +11020,6 @@ react_dom = __toESM(react_dom);
|
|
|
10987
11020
|
this.rerender(panel);
|
|
10988
11021
|
});
|
|
10989
11022
|
if (this._activePanel) {
|
|
10990
|
-
this.contentContainer.renderPanel(this._activePanel, { asActive: true });
|
|
10991
11023
|
const { width, height } = this.contentDimensions();
|
|
10992
11024
|
this._activePanel.layout(width, height);
|
|
10993
11025
|
}
|
|
@@ -11121,6 +11153,7 @@ react_dom = __toESM(react_dom);
|
|
|
11121
11153
|
this.tabsContainer.setRightActionsElement(element);
|
|
11122
11154
|
}
|
|
11123
11155
|
setActive(isGroupActive, force = false) {
|
|
11156
|
+
if (this.isDisposed) return;
|
|
11124
11157
|
if (!force && this.isActive === isGroupActive) return;
|
|
11125
11158
|
this._isGroupActive = isGroupActive;
|
|
11126
11159
|
toggleClass(this.container, "dv-active-group", isGroupActive);
|
|
@@ -14084,13 +14117,14 @@ react_dom = __toESM(react_dom);
|
|
|
14084
14117
|
* menu passes the `tabGroup`. No-op when no renderer could be created (no
|
|
14085
14118
|
* factory configured, or the factory declined the component).
|
|
14086
14119
|
*/
|
|
14087
|
-
appendComponentItem(menuEl, item, identity, group, close) {
|
|
14120
|
+
appendComponentItem(menuEl, item, identity, group, close, renderers) {
|
|
14088
14121
|
var _this$accessor$option4, _this$accessor$option5;
|
|
14089
14122
|
const renderer = (_this$accessor$option4 = (_this$accessor$option5 = this.accessor.options).createContextMenuItemComponent) === null || _this$accessor$option4 === void 0 ? void 0 : _this$accessor$option4.call(_this$accessor$option5, {
|
|
14090
14123
|
id: nextContextMenuItemId(),
|
|
14091
14124
|
component: item.component
|
|
14092
14125
|
});
|
|
14093
14126
|
if (!renderer) return;
|
|
14127
|
+
renderers.addDisposables(renderer);
|
|
14094
14128
|
renderer.init(_objectSpread2$1(_objectSpread2$1({}, identity), {}, {
|
|
14095
14129
|
group,
|
|
14096
14130
|
api: this.accessor.api,
|
|
@@ -14141,9 +14175,9 @@ react_dom = __toESM(react_dom);
|
|
|
14141
14175
|
* default row; an item carrying none of the three renders nothing. Shared
|
|
14142
14176
|
* by both menus, which differ only in `identity`.
|
|
14143
14177
|
*/
|
|
14144
|
-
appendConfigItem(menuEl, item, identity, group, close) {
|
|
14178
|
+
appendConfigItem(menuEl, item, identity, group, close, renderers) {
|
|
14145
14179
|
if (item.element) menuEl.appendChild(item.element);
|
|
14146
|
-
else if (item.component) this.appendComponentItem(menuEl, item, identity, group, close);
|
|
14180
|
+
else if (item.component) this.appendComponentItem(menuEl, item, identity, group, close, renderers);
|
|
14147
14181
|
else if (item.label) menuEl.appendChild(buildItem(item.label, close, () => {
|
|
14148
14182
|
var _item$action;
|
|
14149
14183
|
return (_item$action = item.action) === null || _item$action === void 0 ? void 0 : _item$action.call(item);
|
|
@@ -14155,22 +14189,28 @@ react_dom = __toESM(react_dom);
|
|
|
14155
14189
|
event.preventDefault();
|
|
14156
14190
|
const popupService = this.accessor.getPopupServiceForGroup(group);
|
|
14157
14191
|
const close = () => popupService.close();
|
|
14192
|
+
const renderers = new CompositeDisposable();
|
|
14158
14193
|
const menuEl = document.createElement("div");
|
|
14159
14194
|
menuEl.className = "dv-context-menu";
|
|
14160
14195
|
menuEl.setAttribute("role", "menu");
|
|
14161
|
-
|
|
14162
|
-
|
|
14163
|
-
|
|
14164
|
-
|
|
14196
|
+
try {
|
|
14197
|
+
for (const item of items) {
|
|
14198
|
+
if (isItemConfig(item)) {
|
|
14199
|
+
this.appendConfigItem(menuEl, item, { panel }, group, close, renderers);
|
|
14200
|
+
continue;
|
|
14201
|
+
}
|
|
14202
|
+
const el = this.buildBuiltInTabItem(item, panel, group, close);
|
|
14203
|
+
if (el) menuEl.appendChild(el);
|
|
14165
14204
|
}
|
|
14166
|
-
|
|
14167
|
-
|
|
14205
|
+
} catch (err) {
|
|
14206
|
+
renderers.dispose();
|
|
14207
|
+
throw err;
|
|
14168
14208
|
}
|
|
14169
14209
|
popupService.openPopover(menuEl, {
|
|
14170
14210
|
x: event.clientX,
|
|
14171
14211
|
y: event.clientY,
|
|
14172
14212
|
zIndex: popoverZIndexFor(event.target, group)
|
|
14173
|
-
});
|
|
14213
|
+
}, { onClose: () => renderers.dispose() });
|
|
14174
14214
|
}
|
|
14175
14215
|
showForChip(tabGroup, group, event) {
|
|
14176
14216
|
if (!this.accessor.options.getTabGroupChipContextMenuItems) return;
|
|
@@ -14184,22 +14224,28 @@ react_dom = __toESM(react_dom);
|
|
|
14184
14224
|
event.preventDefault();
|
|
14185
14225
|
const popupService = this.accessor.getPopupServiceForGroup(group);
|
|
14186
14226
|
const close = () => popupService.close();
|
|
14227
|
+
const renderers = new CompositeDisposable();
|
|
14187
14228
|
const menuEl = document.createElement("div");
|
|
14188
14229
|
menuEl.className = "dv-context-menu";
|
|
14189
14230
|
menuEl.setAttribute("role", "menu");
|
|
14190
|
-
|
|
14191
|
-
|
|
14192
|
-
|
|
14193
|
-
|
|
14194
|
-
|
|
14195
|
-
|
|
14196
|
-
|
|
14197
|
-
|
|
14231
|
+
try {
|
|
14232
|
+
for (const item of items) if (item === "separator") menuEl.appendChild(buildSeparator());
|
|
14233
|
+
else if (item === "rename") menuEl.appendChild(buildRenameInput(tabGroup));
|
|
14234
|
+
else if (item === "colorPicker") menuEl.appendChild(buildColorPicker(tabGroup, this.accessor.tabGroupColorPalette));
|
|
14235
|
+
else if (item === "collapse") menuEl.appendChild(this.buildCollapseItem(tabGroup, close));
|
|
14236
|
+
else if (item === "close") menuEl.appendChild(buildItem("Close All", close, () => {
|
|
14237
|
+
group.panels.filter((p) => tabGroup.containsPanel(p.id)).forEach((p) => p.api.close());
|
|
14238
|
+
}));
|
|
14239
|
+
else if (isItemConfig(item)) this.appendConfigItem(menuEl, item, { tabGroup }, group, close, renderers);
|
|
14240
|
+
} catch (err) {
|
|
14241
|
+
renderers.dispose();
|
|
14242
|
+
throw err;
|
|
14243
|
+
}
|
|
14198
14244
|
popupService.openPopover(menuEl, {
|
|
14199
14245
|
x: event.clientX,
|
|
14200
14246
|
y: event.clientY,
|
|
14201
14247
|
zIndex: popoverZIndexFor(event.target, group)
|
|
14202
|
-
});
|
|
14248
|
+
}, { onClose: () => renderers.dispose() });
|
|
14203
14249
|
}
|
|
14204
14250
|
};
|
|
14205
14251
|
const ContextMenuModule = defineModule({
|
|
@@ -14483,6 +14529,7 @@ react_dom = __toESM(react_dom);
|
|
|
14483
14529
|
const observerDisposable = new MutableDisposable();
|
|
14484
14530
|
const correctLayerPosition = () => {
|
|
14485
14531
|
if (panel.api.location.type === "floating") queueMicrotask(() => {
|
|
14532
|
+
if (disposable.isDisposed) return;
|
|
14486
14533
|
const floatingGroup = this.accessor.getFloatingWindowForGroup(panel.api.group);
|
|
14487
14534
|
if (!floatingGroup) return;
|
|
14488
14535
|
const element = floatingGroup.overlay.element;
|
|
@@ -14708,7 +14755,7 @@ react_dom = __toESM(react_dom);
|
|
|
14708
14755
|
newRoot.prepend(this._element);
|
|
14709
14756
|
this._root = newRoot;
|
|
14710
14757
|
}
|
|
14711
|
-
openPopover(element, position) {
|
|
14758
|
+
openPopover(element, position, options) {
|
|
14712
14759
|
var _position$zIndex;
|
|
14713
14760
|
this.close();
|
|
14714
14761
|
const wrapper = this._window.document.createElement("div");
|
|
@@ -14723,14 +14770,14 @@ react_dom = __toESM(react_dom);
|
|
|
14723
14770
|
this._element.appendChild(wrapper);
|
|
14724
14771
|
this._active = wrapper;
|
|
14725
14772
|
const POINTERDOWN_GRACE_MS = 200;
|
|
14726
|
-
this._activeDisposable.value = createDismissableLayer({
|
|
14773
|
+
this._activeDisposable.value = new CompositeDisposable(createDismissableLayer({
|
|
14727
14774
|
window: this._window,
|
|
14728
14775
|
onDismiss: () => this.close(),
|
|
14729
14776
|
elements: () => this._active ? [this._active] : [],
|
|
14730
14777
|
keys: ["Enter"],
|
|
14731
14778
|
pointerDownGraceMs: POINTERDOWN_GRACE_MS,
|
|
14732
14779
|
resize: true
|
|
14733
|
-
});
|
|
14780
|
+
}), (options === null || options === void 0 ? void 0 : options.onClose) ? Disposable.from(options.onClose) : Disposable.NONE);
|
|
14734
14781
|
this._window.requestAnimationFrame(() => {
|
|
14735
14782
|
shiftAbsoluteElementIntoView(wrapper, this._root);
|
|
14736
14783
|
});
|
|
@@ -16033,7 +16080,9 @@ react_dom = __toESM(react_dom);
|
|
|
16033
16080
|
this._onWillDrop = new Emitter();
|
|
16034
16081
|
this.onWillDrop = this._onWillDrop.event;
|
|
16035
16082
|
this._mutationDepth = 0;
|
|
16083
|
+
this._syncMutationDepth = 0;
|
|
16036
16084
|
this._pendingLocationChanges = /* @__PURE__ */ new Map();
|
|
16085
|
+
this._openingPopoutWindows = /* @__PURE__ */ new Set();
|
|
16037
16086
|
this._origin = "user";
|
|
16038
16087
|
this._originDepth = 0;
|
|
16039
16088
|
this._onWillMutateLayout = new Emitter();
|
|
@@ -16117,6 +16166,10 @@ react_dom = __toESM(react_dom);
|
|
|
16117
16166
|
});
|
|
16118
16167
|
}));
|
|
16119
16168
|
this.popupService = new PopupService(this.element);
|
|
16169
|
+
this.addDisposables(this.popupService, Disposable.from(() => {
|
|
16170
|
+
for (const opening of this._openingPopoutWindows) opening.dispose();
|
|
16171
|
+
this._openingPopoutWindows.clear();
|
|
16172
|
+
}));
|
|
16120
16173
|
this._api = new DockviewApi(this);
|
|
16121
16174
|
this.disableResizing = true;
|
|
16122
16175
|
this.element.remove();
|
|
@@ -16265,9 +16318,15 @@ react_dom = __toESM(react_dom);
|
|
|
16265
16318
|
const popoutWindowDisposable = new CompositeDisposable(_window, _window.onDidClose(() => {
|
|
16266
16319
|
popoutWindowDisposable.dispose();
|
|
16267
16320
|
}));
|
|
16321
|
+
this._openingPopoutWindows.add(popoutWindowDisposable);
|
|
16268
16322
|
const openError = getPopoutUrlError(popoutUrl);
|
|
16269
16323
|
return (openError ? Promise.resolve(null) : _window.open()).then((popoutContainer) => {
|
|
16270
16324
|
var _options$referenceGro, _options$overridePopo4;
|
|
16325
|
+
this._openingPopoutWindows.delete(popoutWindowDisposable);
|
|
16326
|
+
if (this.isDisposed) {
|
|
16327
|
+
popoutWindowDisposable.dispose();
|
|
16328
|
+
return false;
|
|
16329
|
+
}
|
|
16271
16330
|
if (_window.isDisposed) {
|
|
16272
16331
|
const failure = _window.failure;
|
|
16273
16332
|
if (failure && !this.isDisposed) {
|
|
@@ -16461,6 +16520,7 @@ react_dom = __toESM(react_dom);
|
|
|
16461
16520
|
for (const { panel, from } of movedPanels) this.fireDidMovePanel(panel, from);
|
|
16462
16521
|
return true;
|
|
16463
16522
|
}).catch((err) => {
|
|
16523
|
+
this._openingPopoutWindows.delete(popoutWindowDisposable);
|
|
16464
16524
|
console.error("dockview: failed to create popout.", err);
|
|
16465
16525
|
return false;
|
|
16466
16526
|
});
|
|
@@ -17000,6 +17060,7 @@ react_dom = __toESM(react_dom);
|
|
|
17000
17060
|
group.dispose();
|
|
17001
17061
|
this._groups.delete(group.id);
|
|
17002
17062
|
this._onDidRemoveGroup.fire(group);
|
|
17063
|
+
this.activateFallbackGroupIfRemoved(group);
|
|
17003
17064
|
});
|
|
17004
17065
|
}
|
|
17005
17066
|
setEdgeGroupCollapsed(group, collapsed) {
|
|
@@ -17196,6 +17257,7 @@ react_dom = __toESM(react_dom);
|
|
|
17196
17257
|
const record = this._groups.get(temporaryGroup.api.id);
|
|
17197
17258
|
this._groups.delete(temporaryGroup.api.id);
|
|
17198
17259
|
temporaryGroupDisposables.push(Disposable.from(() => {
|
|
17260
|
+
var _this$headerActionsSe2;
|
|
17199
17261
|
/**
|
|
17200
17262
|
* Reclaim the group's own resources, never its panels.
|
|
17201
17263
|
* Staging is driven by the ids in `data.panels` while
|
|
@@ -17213,6 +17275,7 @@ react_dom = __toESM(react_dom);
|
|
|
17213
17275
|
for (const panel of temporaryGroup.panels.slice()) temporaryGroup.model.removePanel(panel);
|
|
17214
17276
|
});
|
|
17215
17277
|
record === null || record === void 0 || record.disposable.dispose();
|
|
17278
|
+
(_this$headerActionsSe2 = this.headerActionsService) === null || _this$headerActionsSe2 === void 0 || _this$headerActionsSe2.disposeGroup(temporaryGroup);
|
|
17216
17279
|
temporaryGroup.dispose();
|
|
17217
17280
|
}));
|
|
17218
17281
|
return temporaryGroup;
|
|
@@ -17877,9 +17940,12 @@ react_dom = __toESM(react_dom);
|
|
|
17877
17940
|
*/
|
|
17878
17941
|
mutation(kind, func) {
|
|
17879
17942
|
const close = this.openMutation(kind);
|
|
17943
|
+
this._syncMutationDepth++;
|
|
17880
17944
|
try {
|
|
17881
17945
|
return func();
|
|
17882
17946
|
} finally {
|
|
17947
|
+
this._syncMutationDepth--;
|
|
17948
|
+
if (this._syncMutationDepth === 0) this.releaseDisposedActiveGroup();
|
|
17883
17949
|
close();
|
|
17884
17950
|
}
|
|
17885
17951
|
}
|
|
@@ -17926,6 +17992,7 @@ react_dom = __toESM(react_dom);
|
|
|
17926
17992
|
return () => {
|
|
17927
17993
|
this._mutationDepth--;
|
|
17928
17994
|
if (this._mutationDepth === 0) {
|
|
17995
|
+
this.releaseDisposedActiveGroup();
|
|
17929
17996
|
this.flushLocationChanges();
|
|
17930
17997
|
this._onDidMutateLayout.fire({
|
|
17931
17998
|
kind,
|
|
@@ -17934,6 +18001,11 @@ react_dom = __toESM(react_dom);
|
|
|
17934
18001
|
}
|
|
17935
18002
|
};
|
|
17936
18003
|
}
|
|
18004
|
+
/** Covers removals with `skipActive` that disposed the active group. */
|
|
18005
|
+
releaseDisposedActiveGroup() {
|
|
18006
|
+
var _this$_activeGroup;
|
|
18007
|
+
if (!this.isDisposed && ((_this$_activeGroup = this._activeGroup) === null || _this$_activeGroup === void 0 ? void 0 : _this$_activeGroup.model.isDisposed)) this.activateFallbackGroupIfRemoved(this._activeGroup);
|
|
18008
|
+
}
|
|
17937
18009
|
/**
|
|
17938
18010
|
* Coalesce a panel's `onDidLocationChange` to the end of the enclosing
|
|
17939
18011
|
* transaction, or fire it immediately when no transaction is in flight.
|
|
@@ -18071,7 +18143,7 @@ react_dom = __toESM(react_dom);
|
|
|
18071
18143
|
skipSetActiveGroup: true
|
|
18072
18144
|
}));
|
|
18073
18145
|
if (!removedPanel) throw new Error(`dockview: No panel with id ${sourceItemId}`);
|
|
18074
|
-
if (!options.keepEmptyGroups && sourceGroup.model.size === 0) this.doRemoveGroup(sourceGroup, { skipActive: true });
|
|
18146
|
+
if (!options.keepEmptyGroups && sourceGroup.model.size === 0 && sourceGroup !== destinationGroup) this.doRemoveGroup(sourceGroup, { skipActive: true });
|
|
18075
18147
|
const isDestinationGroupEmpty = destinationGroup.model.size === 0;
|
|
18076
18148
|
this.movingLock(() => {
|
|
18077
18149
|
var _options$skipSetActiv;
|
|
@@ -18236,6 +18308,7 @@ react_dom = __toESM(react_dom);
|
|
|
18236
18308
|
const from = options.from.group;
|
|
18237
18309
|
const to = options.to.group;
|
|
18238
18310
|
const target = options.to.position;
|
|
18311
|
+
if (target === "center" && from === to) return;
|
|
18239
18312
|
let source = from;
|
|
18240
18313
|
let mergedPanels;
|
|
18241
18314
|
if (target === "center") {
|
|
@@ -19255,6 +19328,7 @@ react_dom = __toESM(react_dom);
|
|
|
19255
19328
|
const queue = [];
|
|
19256
19329
|
const width = this.width;
|
|
19257
19330
|
const height = this.height;
|
|
19331
|
+
this.paneview.dispose();
|
|
19258
19332
|
this.paneview = new Paneview(this.element, {
|
|
19259
19333
|
orientation: "VERTICAL",
|
|
19260
19334
|
descriptor: {
|
|
@@ -19318,7 +19392,11 @@ react_dom = __toESM(react_dom);
|
|
|
19318
19392
|
clear() {
|
|
19319
19393
|
for (const [_, value] of this._viewDisposables.entries()) value.dispose();
|
|
19320
19394
|
this._viewDisposables.clear();
|
|
19395
|
+
const width = this.width;
|
|
19396
|
+
const height = this.height;
|
|
19321
19397
|
this.paneview.dispose();
|
|
19398
|
+
this.paneview = new Paneview(this.element, { orientation: "VERTICAL" });
|
|
19399
|
+
this.layout(width, height);
|
|
19322
19400
|
}
|
|
19323
19401
|
doAddPanel(panel) {
|
|
19324
19402
|
const disposable = new CompositeDisposable(panel.onDidDrop((event) => {
|
|
@@ -19622,6 +19700,87 @@ react_dom = __toESM(react_dom);
|
|
|
19622
19700
|
*/
|
|
19623
19701
|
return typeof component === "function" || !!(component === null || component === void 0 ? void 0 : component.$$typeof);
|
|
19624
19702
|
}
|
|
19703
|
+
/**
|
|
19704
|
+
* Calls `onRemoved` once `element` leaves the document. Only its ancestors are
|
|
19705
|
+
* observed, since any removal above it is a child-list change on one of them.
|
|
19706
|
+
*/
|
|
19707
|
+
function watchForRemoval(element, onRemoved) {
|
|
19708
|
+
const parentOf = (node) => node instanceof ShadowRoot ? node.host : node.parentNode;
|
|
19709
|
+
const ancestors = /* @__PURE__ */ new Set();
|
|
19710
|
+
const observer = new MutationObserver((records) => {
|
|
19711
|
+
if (!element.isConnected) {
|
|
19712
|
+
observer.disconnect();
|
|
19713
|
+
onRemoved();
|
|
19714
|
+
return;
|
|
19715
|
+
}
|
|
19716
|
+
for (const record of records) for (const node of record.removedNodes) if (ancestors.has(node)) {
|
|
19717
|
+
observeAncestors();
|
|
19718
|
+
return;
|
|
19719
|
+
}
|
|
19720
|
+
});
|
|
19721
|
+
const observeAncestors = () => {
|
|
19722
|
+
observer.disconnect();
|
|
19723
|
+
ancestors.clear();
|
|
19724
|
+
for (let node = parentOf(element); node; node = parentOf(node)) {
|
|
19725
|
+
ancestors.add(node);
|
|
19726
|
+
observer.observe(node, { childList: true });
|
|
19727
|
+
}
|
|
19728
|
+
};
|
|
19729
|
+
observeAncestors();
|
|
19730
|
+
return Disposable.from(() => observer.disconnect());
|
|
19731
|
+
}
|
|
19732
|
+
const canHideWithoutUnmount = Number.parseInt(react.default.version, 10) >= 18;
|
|
19733
|
+
/**
|
|
19734
|
+
* Creates the instance once and keeps it across effect cleanups that are not
|
|
19735
|
+
* unmounts (`<Activity mode="hidden">`, StrictMode). A real unmount removes the
|
|
19736
|
+
* host before cleanup, so a still-connected host means hidden; the instance is
|
|
19737
|
+
* then disposed only if the host later leaves the document.
|
|
19738
|
+
*/
|
|
19739
|
+
function useKeptInstance(domRef, instanceRef, create) {
|
|
19740
|
+
const removalWatcher = react.default.useRef(void 0);
|
|
19741
|
+
react.default.useEffect(() => {
|
|
19742
|
+
var _removalWatcher$curre, _instanceRef$current;
|
|
19743
|
+
const element = domRef.current;
|
|
19744
|
+
if (!element) return;
|
|
19745
|
+
(_removalWatcher$curre = removalWatcher.current) === null || _removalWatcher$curre === void 0 || _removalWatcher$curre.dispose();
|
|
19746
|
+
removalWatcher.current = void 0;
|
|
19747
|
+
const instance = (_instanceRef$current = instanceRef.current) !== null && _instanceRef$current !== void 0 ? _instanceRef$current : create(element);
|
|
19748
|
+
instanceRef.current = instance;
|
|
19749
|
+
return () => {
|
|
19750
|
+
const dispose = () => {
|
|
19751
|
+
removalWatcher.current = void 0;
|
|
19752
|
+
instanceRef.current = void 0;
|
|
19753
|
+
instance.dispose();
|
|
19754
|
+
};
|
|
19755
|
+
if (canHideWithoutUnmount && element.isConnected && typeof MutationObserver !== "undefined") removalWatcher.current = watchForRemoval(element, dispose);
|
|
19756
|
+
else dispose();
|
|
19757
|
+
};
|
|
19758
|
+
}, []);
|
|
19759
|
+
}
|
|
19760
|
+
/**
|
|
19761
|
+
* Returns a check for option effects: true when the instance already holds the
|
|
19762
|
+
* given values. The first values seen count as applied, since the instance was
|
|
19763
|
+
* created from them, so effect replays skip redundant `updateOptions` calls.
|
|
19764
|
+
*/
|
|
19765
|
+
function useAppliedOptions(instanceRef) {
|
|
19766
|
+
const applied = react.default.useRef({
|
|
19767
|
+
instance: void 0,
|
|
19768
|
+
values: /* @__PURE__ */ new Map()
|
|
19769
|
+
});
|
|
19770
|
+
return react.default.useCallback((values) => {
|
|
19771
|
+
if (applied.current.instance !== instanceRef.current) applied.current = {
|
|
19772
|
+
instance: instanceRef.current,
|
|
19773
|
+
values: /* @__PURE__ */ new Map()
|
|
19774
|
+
};
|
|
19775
|
+
const known = applied.current.values;
|
|
19776
|
+
let unchanged = true;
|
|
19777
|
+
for (const [key, value] of Object.entries(values)) {
|
|
19778
|
+
if (known.has(key) && known.get(key) !== value) unchanged = false;
|
|
19779
|
+
known.set(key, value);
|
|
19780
|
+
}
|
|
19781
|
+
return unchanged;
|
|
19782
|
+
}, [instanceRef]);
|
|
19783
|
+
}
|
|
19625
19784
|
|
|
19626
19785
|
//#endregion
|
|
19627
19786
|
//#region src/dockview/reactContentPart.ts
|
|
@@ -19893,6 +20052,7 @@ react_dom = __toESM(react_dom);
|
|
|
19893
20052
|
const domRef = react.default.useRef(null);
|
|
19894
20053
|
const dockviewRef = react.default.useRef(void 0);
|
|
19895
20054
|
const [portals, addPortal] = usePortalsLifecycle();
|
|
20055
|
+
const isApplied = useAppliedOptions(dockviewRef);
|
|
19896
20056
|
react.default.useImperativeHandle(ref, () => domRef.current, []);
|
|
19897
20057
|
const prevProps = react.default.useRef({});
|
|
19898
20058
|
react.default.useEffect(() => {
|
|
@@ -19902,11 +20062,10 @@ react_dom = __toESM(react_dom);
|
|
|
19902
20062
|
const propValue = props[key];
|
|
19903
20063
|
if (key in props && propValue !== prevProps.current[key]) changes[key] = propValue;
|
|
19904
20064
|
});
|
|
19905
|
-
if (dockviewRef.current) dockviewRef.current.updateOptions(changes);
|
|
20065
|
+
if (dockviewRef.current && Object.keys(changes).length > 0) dockviewRef.current.updateOptions(changes);
|
|
19906
20066
|
prevProps.current = props;
|
|
19907
20067
|
}, PROPERTY_KEYS_DOCKVIEW.map((key) => props[key]));
|
|
19908
|
-
|
|
19909
|
-
if (!domRef.current) return;
|
|
20068
|
+
useKeptInstance(domRef, dockviewRef, (element) => {
|
|
19910
20069
|
const frameworkTabComponents = _objectSpread2({}, props.tabComponents);
|
|
19911
20070
|
if (props.defaultTabComponent) frameworkTabComponents[DEFAULT_REACT_TAB] = props.defaultTabComponent;
|
|
19912
20071
|
const frameworkOptions = {
|
|
@@ -19941,16 +20100,12 @@ react_dom = __toESM(react_dom);
|
|
|
19941
20100
|
return new ReactGroupDragGhostPart(ghostComponent, { addPortal });
|
|
19942
20101
|
};
|
|
19943
20102
|
}
|
|
19944
|
-
const api = createDockview(
|
|
19945
|
-
const { clientWidth, clientHeight } =
|
|
20103
|
+
const api = createDockview(element, _objectSpread2(_objectSpread2({}, coreOptions), frameworkOptions));
|
|
20104
|
+
const { clientWidth, clientHeight } = element;
|
|
19946
20105
|
api.layout(clientWidth, clientHeight);
|
|
19947
20106
|
if (props.onReady) props.onReady({ api });
|
|
19948
|
-
|
|
19949
|
-
|
|
19950
|
-
dockviewRef.current = void 0;
|
|
19951
|
-
api.dispose();
|
|
19952
|
-
};
|
|
19953
|
-
}, []);
|
|
20107
|
+
return api;
|
|
20108
|
+
});
|
|
19954
20109
|
react.default.useEffect(() => {
|
|
19955
20110
|
if (!dockviewRef.current) return () => {};
|
|
19956
20111
|
const disposable = dockviewRef.current.onDidDrop((event) => {
|
|
@@ -19970,25 +20125,28 @@ react_dom = __toESM(react_dom);
|
|
|
19970
20125
|
};
|
|
19971
20126
|
}, [props.onWillDrop]);
|
|
19972
20127
|
react.default.useEffect(() => {
|
|
19973
|
-
if (!dockviewRef.current) return;
|
|
20128
|
+
if (!dockviewRef.current || isApplied({ tabGroupChipComponent: props.tabGroupChipComponent })) return;
|
|
19974
20129
|
dockviewRef.current.updateOptions({ createTabGroupChipComponent: props.tabGroupChipComponent ? () => {
|
|
19975
20130
|
return new ReactTabGroupChipPart(props.tabGroupChipComponent, { addPortal });
|
|
19976
20131
|
} : void 0 });
|
|
19977
20132
|
}, [props.tabGroupChipComponent]);
|
|
19978
20133
|
react.default.useEffect(() => {
|
|
19979
|
-
if (!dockviewRef.current) return;
|
|
20134
|
+
if (!dockviewRef.current || isApplied({ groupDragGhostComponent: props.groupDragGhostComponent })) return;
|
|
19980
20135
|
dockviewRef.current.updateOptions({ createGroupDragGhostComponent: props.groupDragGhostComponent ? () => {
|
|
19981
20136
|
return new ReactGroupDragGhostPart(props.groupDragGhostComponent, { addPortal });
|
|
19982
20137
|
} : void 0 });
|
|
19983
20138
|
}, [props.groupDragGhostComponent]);
|
|
19984
20139
|
react.default.useEffect(() => {
|
|
19985
|
-
if (!dockviewRef.current) return;
|
|
20140
|
+
if (!dockviewRef.current || isApplied({ components: props.components })) return;
|
|
19986
20141
|
dockviewRef.current.updateOptions({ createComponent: (options) => {
|
|
19987
20142
|
return new ReactPanelContentPart(options.id, props.components[options.name], { addPortal });
|
|
19988
20143
|
} });
|
|
19989
20144
|
}, [props.components]);
|
|
19990
20145
|
react.default.useEffect(() => {
|
|
19991
|
-
if (!dockviewRef.current
|
|
20146
|
+
if (!dockviewRef.current || isApplied({
|
|
20147
|
+
tabComponents: props.tabComponents,
|
|
20148
|
+
defaultTabComponent: props.defaultTabComponent
|
|
20149
|
+
})) return;
|
|
19992
20150
|
const frameworkTabComponents = _objectSpread2({}, props.tabComponents);
|
|
19993
20151
|
if (props.defaultTabComponent) frameworkTabComponents[DEFAULT_REACT_TAB] = props.defaultTabComponent;
|
|
19994
20152
|
dockviewRef.current.updateOptions({
|
|
@@ -19999,21 +20157,21 @@ react_dom = __toESM(react_dom);
|
|
|
19999
20157
|
});
|
|
20000
20158
|
}, [props.tabComponents, props.defaultTabComponent]);
|
|
20001
20159
|
react.default.useEffect(() => {
|
|
20002
|
-
if (!dockviewRef.current) return;
|
|
20160
|
+
if (!dockviewRef.current || isApplied({ watermarkComponent: props.watermarkComponent })) return;
|
|
20003
20161
|
dockviewRef.current.updateOptions({ createWatermarkComponent: props.watermarkComponent ? () => {
|
|
20004
20162
|
return new ReactWatermarkPart("watermark", props.watermarkComponent, { addPortal });
|
|
20005
20163
|
} : void 0 });
|
|
20006
20164
|
}, [props.watermarkComponent]);
|
|
20007
20165
|
react.default.useEffect(() => {
|
|
20008
|
-
if (!dockviewRef.current) return;
|
|
20166
|
+
if (!dockviewRef.current || isApplied({ rightHeaderActionsComponent: props.rightHeaderActionsComponent })) return;
|
|
20009
20167
|
dockviewRef.current.updateOptions({ createRightHeaderActionComponent: createGroupControlElement(props.rightHeaderActionsComponent, { addPortal }) });
|
|
20010
20168
|
}, [props.rightHeaderActionsComponent]);
|
|
20011
20169
|
react.default.useEffect(() => {
|
|
20012
|
-
if (!dockviewRef.current) return;
|
|
20170
|
+
if (!dockviewRef.current || isApplied({ leftHeaderActionsComponent: props.leftHeaderActionsComponent })) return;
|
|
20013
20171
|
dockviewRef.current.updateOptions({ createLeftHeaderActionComponent: createGroupControlElement(props.leftHeaderActionsComponent, { addPortal }) });
|
|
20014
20172
|
}, [props.leftHeaderActionsComponent]);
|
|
20015
20173
|
react.default.useEffect(() => {
|
|
20016
|
-
if (!dockviewRef.current) return;
|
|
20174
|
+
if (!dockviewRef.current || isApplied({ prefixHeaderActionsComponent: props.prefixHeaderActionsComponent })) return;
|
|
20017
20175
|
dockviewRef.current.updateOptions({ createPrefixHeaderActionComponent: createGroupControlElement(props.prefixHeaderActionsComponent, { addPortal }) });
|
|
20018
20176
|
}, [props.prefixHeaderActionsComponent]);
|
|
20019
20177
|
return /* @__PURE__ */ react.default.createElement("div", {
|
|
@@ -20184,6 +20342,7 @@ react_dom = __toESM(react_dom);
|
|
|
20184
20342
|
const domRef = react.default.useRef(null);
|
|
20185
20343
|
const splitviewRef = react.default.useRef(void 0);
|
|
20186
20344
|
const [portals, addPortal] = usePortalsLifecycle();
|
|
20345
|
+
const isApplied = useAppliedOptions(splitviewRef);
|
|
20187
20346
|
react.default.useImperativeHandle(ref, () => domRef.current, []);
|
|
20188
20347
|
const prevProps = react.default.useRef({});
|
|
20189
20348
|
react.default.useEffect(() => {
|
|
@@ -20193,25 +20352,20 @@ react_dom = __toESM(react_dom);
|
|
|
20193
20352
|
const propValue = props[key];
|
|
20194
20353
|
if (key in props && propValue !== prevProps.current[key]) changes[key] = propValue;
|
|
20195
20354
|
});
|
|
20196
|
-
if (splitviewRef.current) splitviewRef.current.updateOptions(changes);
|
|
20355
|
+
if (splitviewRef.current && Object.keys(changes).length > 0) splitviewRef.current.updateOptions(changes);
|
|
20197
20356
|
prevProps.current = props;
|
|
20198
20357
|
}, PROPERTY_KEYS_SPLITVIEW.map((key) => props[key]));
|
|
20199
|
-
|
|
20200
|
-
|
|
20201
|
-
const api = createSplitview(domRef.current, _objectSpread2(_objectSpread2({}, extractCoreOptions$2(props)), { createComponent: (options) => {
|
|
20358
|
+
useKeptInstance(domRef, splitviewRef, (element) => {
|
|
20359
|
+
const api = createSplitview(element, _objectSpread2(_objectSpread2({}, extractCoreOptions$2(props)), { createComponent: (options) => {
|
|
20202
20360
|
return new ReactPanelView(options.id, options.name, props.components[options.name], { addPortal });
|
|
20203
20361
|
} }));
|
|
20204
|
-
const { clientWidth, clientHeight } =
|
|
20362
|
+
const { clientWidth, clientHeight } = element;
|
|
20205
20363
|
api.layout(clientWidth, clientHeight);
|
|
20206
20364
|
if (props.onReady) props.onReady({ api });
|
|
20207
|
-
|
|
20208
|
-
|
|
20209
|
-
splitviewRef.current = void 0;
|
|
20210
|
-
api.dispose();
|
|
20211
|
-
};
|
|
20212
|
-
}, []);
|
|
20365
|
+
return api;
|
|
20366
|
+
});
|
|
20213
20367
|
react.default.useEffect(() => {
|
|
20214
|
-
if (!splitviewRef.current) return;
|
|
20368
|
+
if (!splitviewRef.current || isApplied({ components: props.components })) return;
|
|
20215
20369
|
splitviewRef.current.updateOptions({ createComponent: (options) => {
|
|
20216
20370
|
return new ReactPanelView(options.id, options.name, props.components[options.name], { addPortal });
|
|
20217
20371
|
} });
|
|
@@ -20256,6 +20410,7 @@ react_dom = __toESM(react_dom);
|
|
|
20256
20410
|
const domRef = react.default.useRef(null);
|
|
20257
20411
|
const gridviewRef = react.default.useRef(void 0);
|
|
20258
20412
|
const [portals, addPortal] = usePortalsLifecycle();
|
|
20413
|
+
const isApplied = useAppliedOptions(gridviewRef);
|
|
20259
20414
|
react.default.useImperativeHandle(ref, () => domRef.current, []);
|
|
20260
20415
|
const prevProps = react.default.useRef({});
|
|
20261
20416
|
react.default.useEffect(() => {
|
|
@@ -20265,25 +20420,20 @@ react_dom = __toESM(react_dom);
|
|
|
20265
20420
|
const propValue = props[key];
|
|
20266
20421
|
if (key in props && propValue !== prevProps.current[key]) changes[key] = propValue;
|
|
20267
20422
|
});
|
|
20268
|
-
if (gridviewRef.current) gridviewRef.current.updateOptions(changes);
|
|
20423
|
+
if (gridviewRef.current && Object.keys(changes).length > 0) gridviewRef.current.updateOptions(changes);
|
|
20269
20424
|
prevProps.current = props;
|
|
20270
20425
|
}, PROPERTY_KEYS_GRIDVIEW.map((key) => props[key]));
|
|
20271
|
-
|
|
20272
|
-
|
|
20273
|
-
const api = createGridview(domRef.current, _objectSpread2(_objectSpread2({}, extractCoreOptions$1(props)), { createComponent: (options) => {
|
|
20426
|
+
useKeptInstance(domRef, gridviewRef, (element) => {
|
|
20427
|
+
const api = createGridview(element, _objectSpread2(_objectSpread2({}, extractCoreOptions$1(props)), { createComponent: (options) => {
|
|
20274
20428
|
return new ReactGridPanelView(options.id, options.name, props.components[options.name], { addPortal });
|
|
20275
20429
|
} }));
|
|
20276
|
-
const { clientWidth, clientHeight } =
|
|
20430
|
+
const { clientWidth, clientHeight } = element;
|
|
20277
20431
|
api.layout(clientWidth, clientHeight);
|
|
20278
20432
|
if (props.onReady) props.onReady({ api });
|
|
20279
|
-
|
|
20280
|
-
|
|
20281
|
-
gridviewRef.current = void 0;
|
|
20282
|
-
api.dispose();
|
|
20283
|
-
};
|
|
20284
|
-
}, []);
|
|
20433
|
+
return api;
|
|
20434
|
+
});
|
|
20285
20435
|
react.default.useEffect(() => {
|
|
20286
|
-
if (!gridviewRef.current) return;
|
|
20436
|
+
if (!gridviewRef.current || isApplied({ components: props.components })) return;
|
|
20287
20437
|
gridviewRef.current.updateOptions({ createComponent: (options) => {
|
|
20288
20438
|
return new ReactGridPanelView(options.id, options.name, props.components[options.name], { addPortal });
|
|
20289
20439
|
} });
|
|
@@ -20345,6 +20495,7 @@ react_dom = __toESM(react_dom);
|
|
|
20345
20495
|
const domRef = react.default.useRef(null);
|
|
20346
20496
|
const paneviewRef = react.default.useRef(void 0);
|
|
20347
20497
|
const [portals, addPortal] = usePortalsLifecycle();
|
|
20498
|
+
const isApplied = useAppliedOptions(paneviewRef);
|
|
20348
20499
|
react.default.useImperativeHandle(ref, () => domRef.current, []);
|
|
20349
20500
|
const prevProps = react.default.useRef({});
|
|
20350
20501
|
react.default.useEffect(() => {
|
|
@@ -20354,14 +20505,13 @@ react_dom = __toESM(react_dom);
|
|
|
20354
20505
|
const propValue = props[key];
|
|
20355
20506
|
if (key in props && propValue !== prevProps.current[key]) changes[key] = propValue;
|
|
20356
20507
|
});
|
|
20357
|
-
if (paneviewRef.current) paneviewRef.current.updateOptions(changes);
|
|
20508
|
+
if (paneviewRef.current && Object.keys(changes).length > 0) paneviewRef.current.updateOptions(changes);
|
|
20358
20509
|
prevProps.current = props;
|
|
20359
20510
|
}, PROPERTY_KEYS_PANEVIEW.map((key) => props[key]));
|
|
20360
|
-
|
|
20511
|
+
useKeptInstance(domRef, paneviewRef, (element) => {
|
|
20361
20512
|
var _props$headerComponen;
|
|
20362
|
-
if (!domRef.current) return () => {};
|
|
20363
20513
|
const headerComponents = (_props$headerComponen = props.headerComponents) !== null && _props$headerComponen !== void 0 ? _props$headerComponen : {};
|
|
20364
|
-
const api = createPaneview(
|
|
20514
|
+
const api = createPaneview(element, _objectSpread2(_objectSpread2({}, extractCoreOptions(props)), {
|
|
20365
20515
|
createComponent: (options) => {
|
|
20366
20516
|
return new PanePanelSection(options.id, props.components[options.name], { addPortal });
|
|
20367
20517
|
},
|
|
@@ -20369,24 +20519,20 @@ react_dom = __toESM(react_dom);
|
|
|
20369
20519
|
return new PanePanelSection(options.id, headerComponents[options.name], { addPortal });
|
|
20370
20520
|
}
|
|
20371
20521
|
}));
|
|
20372
|
-
const { clientWidth, clientHeight } =
|
|
20522
|
+
const { clientWidth, clientHeight } = element;
|
|
20373
20523
|
api.layout(clientWidth, clientHeight);
|
|
20374
20524
|
if (props.onReady) props.onReady({ api });
|
|
20375
|
-
|
|
20376
|
-
|
|
20377
|
-
paneviewRef.current = void 0;
|
|
20378
|
-
api.dispose();
|
|
20379
|
-
};
|
|
20380
|
-
}, []);
|
|
20525
|
+
return api;
|
|
20526
|
+
});
|
|
20381
20527
|
react.default.useEffect(() => {
|
|
20382
|
-
if (!paneviewRef.current) return;
|
|
20528
|
+
if (!paneviewRef.current || isApplied({ components: props.components })) return;
|
|
20383
20529
|
paneviewRef.current.updateOptions({ createComponent: (options) => {
|
|
20384
20530
|
return new PanePanelSection(options.id, props.components[options.name], { addPortal });
|
|
20385
20531
|
} });
|
|
20386
20532
|
}, [props.components]);
|
|
20387
20533
|
react.default.useEffect(() => {
|
|
20388
20534
|
var _props$headerComponen2;
|
|
20389
|
-
if (!paneviewRef.current) return;
|
|
20535
|
+
if (!paneviewRef.current || isApplied({ headerComponents: props.headerComponents })) return;
|
|
20390
20536
|
const headerComponents = (_props$headerComponen2 = props.headerComponents) !== null && _props$headerComponen2 !== void 0 ? _props$headerComponen2 : {};
|
|
20391
20537
|
paneviewRef.current.updateOptions({ createHeaderComponent: (options) => {
|
|
20392
20538
|
return new PanePanelSection(options.id, headerComponents[options.name], { addPortal });
|
|
@@ -20550,5 +20696,7 @@ exports.themeSolarizedLight = themeSolarizedLight;
|
|
|
20550
20696
|
exports.themeSolarizedLightSpaced = themeSolarizedLightSpaced;
|
|
20551
20697
|
exports.themeVisualStudio = themeVisualStudio;
|
|
20552
20698
|
exports.toTarget = toTarget;
|
|
20699
|
+
exports.useAppliedOptions = useAppliedOptions;
|
|
20700
|
+
exports.useKeptInstance = useKeptInstance;
|
|
20553
20701
|
exports.usePortalsLifecycle = usePortalsLifecycle;
|
|
20554
20702
|
});
|