Skip to content

Commit

Permalink
version 3.2.13
Browse files Browse the repository at this point in the history
  • Loading branch information
rinick committed Oct 22, 2022
1 parent ddd581a commit 36b9823
Show file tree
Hide file tree
Showing 28 changed files with 357 additions and 149 deletions.
2 changes: 1 addition & 1 deletion es/Algorithm.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export function addTabToPanel(layout, source, panel, idx = -1) {
if (tabs.length) {
let newPanel = clone(panel);
newPanel.tabs.splice(idx, 0, ...tabs);
newPanel.activeId = tabs[tabs.length - 1].id;
newPanel.activeId = tabs.at(-1).id;
for (let tab of tabs) {
tab.parent = newPanel;
}
Expand Down
2 changes: 1 addition & 1 deletion es/Divider.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export class Divider extends React.PureComponent {
return;
}
let d = isVertical ? dy : dx;
let leftChild = beforeDivider[beforeDivider.length - 1];
let leftChild = beforeDivider.at(-1);
let rightCild = afterDivider[0];
let leftSize = leftChild.size + d;
let rightSize = rightCild.size - d;
Expand Down
4 changes: 2 additions & 2 deletions es/DockData.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,9 @@ export interface DockContext {
* @param makeActive whether to make the tab the active child of parent panel
* @returns returns false if the tab is not found
*/
updateTab(id: string, newTab: TabData, makeActive: boolean): boolean;
updateTab(id: string, newTab: TabData | null, makeActive?: boolean): boolean;
/**
* Move focus to a dockpanel near by
* Move focus to a dockpanel nearby
* @param fromElement
* @param direction
*/
Expand Down
2 changes: 1 addition & 1 deletion es/DockDropEdge.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export class DockDropEdge extends React.PureComponent {
while (targetBox && lastDepth < depth) {
if (targetBox.mode === mode) {
if (afterPanel) {
if (targetBox.children[targetBox.children.length - 1] !== previousTarget) {
if (targetBox.children.at(-1) !== previousTarget) {
// dont go deeper if current target is on different side of the box
break;
}
Expand Down
5 changes: 2 additions & 3 deletions es/DockLayout.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as React from "react";
import { CSSProperties } from "react";
import { BoxData, DockContext, DropDirection, LayoutBase, LayoutData, PanelBase, PanelData, TabBase, TabData, TabGroup, TabPaneCache } from "./DockData";
import * as Algorithm from "./Algorithm";
export interface LayoutProps {
Expand Down Expand Up @@ -57,7 +56,7 @@ export interface LayoutProps {
* - if tabs is empty, but still remaining in layout because of panelLock, make sure also set the group if it's not null
*/
afterPanelLoaded?(savedPanel: PanelBase, loadedPanel: PanelData): void;
style?: CSSProperties;
style?: React.CSSProperties;
/**
* when specified, docklayout will create a react portal for the maximized panel
* use dom element as the value, or use the element's id
Expand Down Expand Up @@ -124,7 +123,7 @@ export declare class DockLayout extends DockPortalManager implements DockContext
height: number;
};
/** @inheritDoc */
updateTab(id: string, newTab: TabData, makeActive?: boolean): boolean;
updateTab(id: string, newTab: TabData | null, makeActive?: boolean): boolean;
/** @inheritDoc */
navigateToPanel(fromElement?: HTMLElement, direction?: string): void;
constructor(props: LayoutProps);
Expand Down
2 changes: 1 addition & 1 deletion lib/Algorithm.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ function addTabToPanel(layout, source, panel, idx = -1) {
if (tabs.length) {
let newPanel = clone(panel);
newPanel.tabs.splice(idx, 0, ...tabs);
newPanel.activeId = tabs[tabs.length - 1].id;
newPanel.activeId = tabs.at(-1).id;
for (let tab of tabs) {
tab.parent = newPanel;
}
Expand Down
28 changes: 22 additions & 6 deletions lib/Divider.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Divider = void 0;
const react_1 = __importDefault(require("react"));
const React = __importStar(require("react"));
const DragDropDiv_1 = require("./dragdrop/DragDropDiv");
class BoxDataCache {
constructor(data) {
Expand Down Expand Up @@ -53,7 +69,7 @@ function spiltSize(newSize, oldSize, children) {
}
return sizes;
}
class Divider extends react_1.default.PureComponent {
class Divider extends React.PureComponent {
constructor() {
super(...arguments);
this.startDrag = (e) => {
Expand Down Expand Up @@ -84,7 +100,7 @@ class Divider extends react_1.default.PureComponent {
return;
}
let d = isVertical ? dy : dx;
let leftChild = beforeDivider[beforeDivider.length - 1];
let leftChild = beforeDivider.at(-1);
let rightCild = afterDivider[0];
let leftSize = leftChild.size + d;
let rightSize = rightCild.size - d;
Expand Down Expand Up @@ -128,7 +144,7 @@ class Divider extends react_1.default.PureComponent {
if (!className) {
className = 'dock-divider';
}
return (react_1.default.createElement(DragDropDiv_1.DragDropDiv, { className: className, onDragStartT: this.startDrag, onDragMoveT: this.dragMove, onDragEndT: this.dragEnd }));
return (React.createElement(DragDropDiv_1.DragDropDiv, { className: className, onDragStartT: this.startDrag, onDragMoveT: this.dragMove, onDragEndT: this.dragEnd }));
}
}
exports.Divider = Divider;
30 changes: 23 additions & 7 deletions lib/DividerBox.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,23 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
Expand All @@ -10,15 +29,12 @@ var __rest = (this && this.__rest) || function (s, e) {
}
return t;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.DividerBox = void 0;
const react_1 = __importDefault(require("react"));
const React = __importStar(require("react"));
const DockData_1 = require("./DockData");
const Divider_1 = require("./Divider");
class DividerBox extends react_1.default.PureComponent {
class DividerBox extends React.PureComponent {
constructor() {
super(...arguments);
this.getRef = (r) => {
Expand Down Expand Up @@ -74,7 +90,7 @@ class DividerBox extends react_1.default.PureComponent {
if (Array.isArray((children))) {
for (let i = 0; i < children.length; ++i) {
if (i > 0) {
childrenRender.push(react_1.default.createElement(Divider_1.Divider, { idx: i, key: i, isVertical: isVertical, getDividerData: this.getDividerData, changeSizes: this.changeSizes }));
childrenRender.push(React.createElement(Divider_1.Divider, { idx: i, key: i, isVertical: isVertical, getDividerData: this.getDividerData, changeSizes: this.changeSizes }));
}
childrenRender.push(children[i]);
}
Expand All @@ -92,7 +108,7 @@ class DividerBox extends react_1.default.PureComponent {
if (className) {
cls = `${cls} ${className}`;
}
return (react_1.default.createElement("div", Object.assign({ ref: this.getRef, className: cls }, others), childrenRender));
return (React.createElement("div", Object.assign({ ref: this.getRef, className: cls }, others), childrenRender));
}
}
exports.DividerBox = DividerBox;
Expand Down
32 changes: 24 additions & 8 deletions lib/DockBox.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,30 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.DockBox = void 0;
const react_1 = __importDefault(require("react"));
const React = __importStar(require("react"));
const DockData_1 = require("./DockData");
const Divider_1 = require("./Divider");
const DockPanel_1 = require("./DockPanel");
class DockBox extends react_1.default.PureComponent {
class DockBox extends React.PureComponent {
constructor() {
super(...arguments);
this.getRef = (r) => {
Expand Down Expand Up @@ -57,15 +73,15 @@ class DockBox extends react_1.default.PureComponent {
let childrenRender = [];
for (let i = 0; i < children.length; ++i) {
if (i > 0) {
childrenRender.push(react_1.default.createElement(Divider_1.Divider, { idx: i, key: i, isVertical: isVertical, onDragEnd: this.onDragEnd, getDividerData: this.getDividerData, changeSizes: this.changeSizes }));
childrenRender.push(React.createElement(Divider_1.Divider, { idx: i, key: i, isVertical: isVertical, onDragEnd: this.onDragEnd, getDividerData: this.getDividerData, changeSizes: this.changeSizes }));
}
let child = children[i];
if ('tabs' in child) {
childrenRender.push(react_1.default.createElement(DockPanel_1.DockPanel, { size: child.size, panelData: child, key: child.id }));
childrenRender.push(React.createElement(DockPanel_1.DockPanel, { size: child.size, panelData: child, key: child.id }));
// render DockPanel
}
else if ('children' in child) {
childrenRender.push(react_1.default.createElement(DockBox, { size: child.size, boxData: child, key: child.id }));
childrenRender.push(React.createElement(DockBox, { size: child.size, boxData: child, key: child.id }));
}
}
let cls;
Expand All @@ -88,7 +104,7 @@ class DockBox extends react_1.default.PureComponent {
if (flexShrink < 1) {
flexShrink = 1;
}
return (react_1.default.createElement("div", { ref: this.getRef, className: cls, "data-dockid": id, style: { minWidth, minHeight, flex: `${flexGrow} ${flexShrink} ${size}px` } }, childrenRender));
return (React.createElement("div", { ref: this.getRef, className: cls, "data-dockid": id, style: { minWidth, minHeight, flex: `${flexGrow} ${flexShrink} ${size}px` } }, childrenRender));
}
}
exports.DockBox = DockBox;
Expand Down
4 changes: 2 additions & 2 deletions lib/DockData.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,9 @@ export interface DockContext {
* @param makeActive whether to make the tab the active child of parent panel
* @returns returns false if the tab is not found
*/
updateTab(id: string, newTab: TabData, makeActive: boolean): boolean;
updateTab(id: string, newTab: TabData | null, makeActive?: boolean): boolean;
/**
* Move focus to a dockpanel near by
* Move focus to a dockpanel nearby
* @param fromElement
* @param direction
*/
Expand Down
24 changes: 20 additions & 4 deletions lib/DockData.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.DockContextConsumer = exports.DockContextProvider = exports.DockContextType = exports.placeHolderGroup = exports.maximePlaceHolderId = exports.placeHolderStyle = exports.defaultGroup = void 0;
const react_1 = __importDefault(require("react"));
const React = __importStar(require("react"));
/** @ignore */
exports.defaultGroup = {
floatable: true,
Expand All @@ -19,7 +35,7 @@ exports.placeHolderGroup = {
floatable: false,
};
/** @ignore */
exports.DockContextType = react_1.default.createContext(null);
exports.DockContextType = React.createContext(null);
/** @ignore */
exports.DockContextProvider = exports.DockContextType.Provider;
/** @ignore */
Expand Down
28 changes: 22 additions & 6 deletions lib/DockDropEdge.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,30 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.DockDropEdge = void 0;
const react_1 = __importDefault(require("react"));
const React = __importStar(require("react"));
const DockData_1 = require("./DockData");
const DragDropDiv_1 = require("./dragdrop/DragDropDiv");
const DragManager_1 = require("./dragdrop/DragManager");
class DockDropEdge extends react_1.default.PureComponent {
class DockDropEdge extends React.PureComponent {
constructor() {
super(...arguments);
this.getRef = (r) => {
Expand Down Expand Up @@ -134,7 +150,7 @@ class DockDropEdge extends react_1.default.PureComponent {
while (targetBox && lastDepth < depth) {
if (targetBox.mode === mode) {
if (afterPanel) {
if (targetBox.children[targetBox.children.length - 1] !== previousTarget) {
if (targetBox.children.at(-1) !== previousTarget) {
// dont go deeper if current target is on different side of the box
break;
}
Expand All @@ -156,7 +172,7 @@ class DockDropEdge extends react_1.default.PureComponent {
return depth;
}
render() {
return (react_1.default.createElement(DragDropDiv_1.DragDropDiv, { getRef: this.getRef, className: "dock-drop-edge", onDragOverT: this.onDragOver, onDragLeaveT: this.onDragLeave, onDropT: this.onDrop }));
return (React.createElement(DragDropDiv_1.DragDropDiv, { getRef: this.getRef, className: "dock-drop-edge", onDragOverT: this.onDragOver, onDragLeaveT: this.onDragLeave, onDropT: this.onDrop }));
}
componentWillUnmount() {
this.context.setDropRect(null, 'remove', this);
Expand Down
Loading

0 comments on commit 36b9823

Please sign in to comment.