Comparing version 3.0.3 to 3.0.4
@@ -1,7 +0,4 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getFloatPanelSize = exports.fixLayoutData = exports.fixFloatPanelPos = exports.maximize = exports.moveToFront = exports.removeFromLayout = exports.panelToWindow = exports.floatPanel = exports.dockPanelToBox = exports.dockPanelToPanel = exports.converToPanel = exports.addTabToPanel = exports.addNextToTab = exports.find = exports.Filter = exports.nextZIndex = exports.nextId = exports.getUpdatedObject = void 0; | ||
const DockData_1 = require("./DockData"); | ||
import { maximePlaceHolderId, placeHolderStyle } from "./DockData"; | ||
let _watchObjectChange = new WeakMap(); | ||
function getUpdatedObject(obj) { | ||
export function getUpdatedObject(obj) { | ||
let result = _watchObjectChange.get(obj); | ||
@@ -13,3 +10,2 @@ if (result) { | ||
} | ||
exports.getUpdatedObject = getUpdatedObject; | ||
function clearObjectCache() { | ||
@@ -30,9 +26,8 @@ _watchObjectChange = new WeakMap(); | ||
let _idCount = 0; | ||
function nextId() { | ||
export function nextId() { | ||
++_idCount; | ||
return `+${_idCount}`; | ||
} | ||
exports.nextId = nextId; | ||
let _zCount = 0; | ||
function nextZIndex(current) { | ||
export function nextZIndex(current) { | ||
if (current === _zCount) { | ||
@@ -44,3 +39,2 @@ // already the top | ||
} | ||
exports.nextZIndex = nextZIndex; | ||
function findInPanel(panel, id, filter) { | ||
@@ -75,3 +69,3 @@ if (panel.id === id && (filter & Filter.Panel)) { | ||
} | ||
var Filter; | ||
export var Filter; | ||
(function (Filter) { | ||
@@ -88,4 +82,4 @@ Filter[Filter["Tab"] = 1] = "Tab"; | ||
Filter[Filter["All"] = 63] = "All"; | ||
})(Filter = exports.Filter || (exports.Filter = {})); | ||
function find(layout, id, filter = Filter.All) { | ||
})(Filter || (Filter = {})); | ||
export function find(layout, id, filter = Filter.All) { | ||
let result; | ||
@@ -112,4 +106,3 @@ if (filter & Filter.Docked) { | ||
} | ||
exports.find = find; | ||
function addNextToTab(layout, source, target, direction) { | ||
export function addNextToTab(layout, source, target, direction) { | ||
let pos = target.parent.tabs.indexOf(target); | ||
@@ -124,4 +117,3 @@ if (pos >= 0) { | ||
} | ||
exports.addNextToTab = addNextToTab; | ||
function addTabToPanel(layout, source, panel, idx = -1) { | ||
export function addTabToPanel(layout, source, panel, idx = -1) { | ||
if (idx === -1) { | ||
@@ -155,4 +147,3 @@ idx = panel.tabs.length; | ||
} | ||
exports.addTabToPanel = addTabToPanel; | ||
function converToPanel(source) { | ||
export function converToPanel(source) { | ||
if ('tabs' in source) { | ||
@@ -168,4 +159,3 @@ // source is already PanelData | ||
} | ||
exports.converToPanel = converToPanel; | ||
function dockPanelToPanel(layout, newPanel, panel, direction) { | ||
export function dockPanelToPanel(layout, newPanel, panel, direction) { | ||
let box = panel.parent; | ||
@@ -205,4 +195,3 @@ let dockMode = (direction === 'left' || direction === 'right') ? 'horizontal' : 'vertical'; | ||
} | ||
exports.dockPanelToPanel = dockPanelToPanel; | ||
function dockPanelToBox(layout, newPanel, box, direction) { | ||
export function dockPanelToBox(layout, newPanel, box, direction) { | ||
let parentBox = box.parent; | ||
@@ -275,4 +264,3 @@ let dockMode = (direction === 'left' || direction === 'right') ? 'horizontal' : 'vertical'; | ||
} | ||
exports.dockPanelToBox = dockPanelToBox; | ||
function floatPanel(layout, newPanel, rect) { | ||
export function floatPanel(layout, newPanel, rect) { | ||
let newBox = clone(layout.floatbox); | ||
@@ -288,4 +276,3 @@ if (rect) { | ||
} | ||
exports.floatPanel = floatPanel; | ||
function panelToWindow(layout, newPanel) { | ||
export function panelToWindow(layout, newPanel) { | ||
let newBox = clone(layout.windowbox); | ||
@@ -295,4 +282,3 @@ newBox.children.push(newPanel); | ||
} | ||
exports.panelToWindow = panelToWindow; | ||
function removeFromLayout(layout, source) { | ||
export function removeFromLayout(layout, source) { | ||
if (source) { | ||
@@ -312,3 +298,3 @@ let panelData; | ||
// max panel is gone, remove the place holder | ||
let placeHolder = find(layout, DockData_1.maximePlaceHolderId); | ||
let placeHolder = find(layout, maximePlaceHolderId); | ||
if (placeHolder) { | ||
@@ -322,3 +308,2 @@ return removePanel(layout, placeHolder); | ||
} | ||
exports.removeFromLayout = removeFromLayout; | ||
function removePanel(layout, panel) { | ||
@@ -357,3 +342,3 @@ let box = panel.parent; | ||
} | ||
function moveToFront(layout, source) { | ||
export function moveToFront(layout, source) { | ||
if (source) { | ||
@@ -388,5 +373,4 @@ let panelData; | ||
} | ||
exports.moveToFront = moveToFront; | ||
// maximize or restore the panel | ||
function maximize(layout, source) { | ||
export function maximize(layout, source) { | ||
if (source) { | ||
@@ -407,3 +391,2 @@ if ('tabs' in source) { | ||
} | ||
exports.maximize = maximize; | ||
function maximizePanel(layout, panel) { | ||
@@ -415,3 +398,3 @@ let maxbox = layout.maxbox; | ||
} | ||
let placeHodlerPanel = Object.assign(Object.assign({}, panel), { id: DockData_1.maximePlaceHolderId, tabs: [], panelLock: {} }); | ||
let placeHodlerPanel = Object.assign(Object.assign({}, panel), { id: maximePlaceHolderId, tabs: [], panelLock: {} }); | ||
layout = replacePanel(layout, panel, placeHodlerPanel); | ||
@@ -423,3 +406,3 @@ layout = dockPanelToBox(layout, panel, layout.maxbox, 'middle'); | ||
layout = removePanel(layout, panel); | ||
let placeHolder = find(layout, DockData_1.maximePlaceHolderId); | ||
let placeHolder = find(layout, maximePlaceHolderId); | ||
if (placeHolder) { | ||
@@ -439,3 +422,3 @@ let { x, y, z, w, h } = placeHolder; | ||
// move float panel into the screen | ||
function fixFloatPanelPos(layout, layoutWidth, layoutHeight) { | ||
export function fixFloatPanelPos(layout, layoutWidth, layoutHeight) { | ||
let layoutChanged = false; | ||
@@ -478,4 +461,3 @@ if (layout && layout.floatbox && layoutWidth > 200 && layoutHeight > 200) { | ||
} | ||
exports.fixFloatPanelPos = fixFloatPanelPos; | ||
function fixLayoutData(layout, loadTab) { | ||
export function fixLayoutData(layout, loadTab) { | ||
function fixpanelOrBox(d) { | ||
@@ -586,3 +568,3 @@ if (d.id == null) { | ||
} | ||
else if (child.group === DockData_1.placeHolderStyle && (box.children.length > 1 || box.parent)) { | ||
else if (child.group === placeHolderStyle && (box.children.length > 1 || box.parent)) { | ||
// remove placeHolder Group | ||
@@ -647,3 +629,3 @@ box.children.splice(i, 1); | ||
// add place holder panel when root box is empty | ||
let newPanel = { id: '+0', group: DockData_1.placeHolderStyle, panelLock: {}, size: 200, tabs: [] }; | ||
let newPanel = { id: '+0', group: placeHolderStyle, panelLock: {}, size: 200, tabs: [] }; | ||
newPanel.parent = layout.dockbox; | ||
@@ -669,3 +651,2 @@ layout.dockbox.children.push(newPanel); | ||
} | ||
exports.fixLayoutData = fixLayoutData; | ||
function replacePanel(layout, panel, newPanel) { | ||
@@ -715,3 +696,3 @@ for (let tab of newPanel.tabs) { | ||
} | ||
function getFloatPanelSize(panel, tabGroup) { | ||
export function getFloatPanelSize(panel, tabGroup) { | ||
if (!panel) { | ||
@@ -738,2 +719,1 @@ return [300, 300]; | ||
} | ||
exports.getFloatPanelSize = getFloatPanelSize; |
@@ -1,9 +0,3 @@ | ||
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Divider = void 0; | ||
const react_1 = __importDefault(require("react")); | ||
const DragDropDiv_1 = require("./dragdrop/DragDropDiv"); | ||
import React from 'react'; | ||
import { DragDropDiv } from "./dragdrop/DragDropDiv"; | ||
class BoxDataCache { | ||
@@ -56,3 +50,3 @@ constructor(data) { | ||
} | ||
class Divider extends react_1.default.PureComponent { | ||
export class Divider extends React.PureComponent { | ||
constructor() { | ||
@@ -132,5 +126,4 @@ super(...arguments); | ||
} | ||
return (react_1.default.createElement(DragDropDiv_1.DragDropDiv, { className: className, onDragStartT: this.startDrag, onDragMoveT: this.dragMove, onDragEndT: this.dragEnd })); | ||
return (React.createElement(DragDropDiv, { className: className, onDragStartT: this.startDrag, onDragMoveT: this.dragMove, onDragEndT: this.dragEnd })); | ||
} | ||
} | ||
exports.Divider = Divider; |
@@ -1,2 +0,1 @@ | ||
"use strict"; | ||
var __rest = (this && this.__rest) || function (s, e) { | ||
@@ -13,11 +12,6 @@ var 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 DockData_1 = require("./DockData"); | ||
const Divider_1 = require("./Divider"); | ||
class DividerBox extends react_1.default.PureComponent { | ||
import React from "react"; | ||
import { DockContextType } from "./DockData"; | ||
import { Divider } from "./Divider"; | ||
export class DividerBox extends React.PureComponent { | ||
constructor() { | ||
@@ -78,3 +72,3 @@ super(...arguments); | ||
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, { idx: i, key: i, isVertical: isVertical, getDividerData: this.getDividerData, changeSizes: this.changeSizes })); | ||
} | ||
@@ -97,6 +91,5 @@ childrenRender.push(children[i]); | ||
} | ||
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; | ||
DividerBox.contextType = DockData_1.DockContextType; | ||
DividerBox.contextType = DockContextType; |
@@ -1,12 +0,6 @@ | ||
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DockBox = void 0; | ||
const react_1 = __importDefault(require("react")); | ||
const DockData_1 = require("./DockData"); | ||
const Divider_1 = require("./Divider"); | ||
const DockPanel_1 = require("./DockPanel"); | ||
class DockBox extends react_1.default.PureComponent { | ||
import React from "react"; | ||
import { DockContextType } from "./DockData"; | ||
import { Divider } from "./Divider"; | ||
import { DockPanel } from "./DockPanel"; | ||
export class DockBox extends React.PureComponent { | ||
constructor() { | ||
@@ -60,11 +54,11 @@ super(...arguments); | ||
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, { 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, { 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 })); | ||
} | ||
@@ -79,6 +73,5 @@ } | ||
} | ||
return (react_1.default.createElement("div", { ref: this.getRef, className: cls, "data-dockid": id, style: { minWidth, minHeight, flex: `${size} 1 ${size}px` } }, childrenRender)); | ||
return (React.createElement("div", { ref: this.getRef, className: cls, "data-dockid": id, style: { minWidth, minHeight, flex: `${size} 1 ${size}px` } }, childrenRender)); | ||
} | ||
} | ||
exports.DockBox = DockBox; | ||
DockBox.contextType = DockData_1.DockContextType; | ||
DockBox.contextType = DockContextType; |
@@ -1,10 +0,4 @@ | ||
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
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")); | ||
import React from 'react'; | ||
/** @ignore */ | ||
exports.defaultGroup = { | ||
export const defaultGroup = { | ||
floatable: true, | ||
@@ -14,14 +8,14 @@ maximizable: true, | ||
/** @ignore */ | ||
exports.placeHolderStyle = 'place-holder'; | ||
export const placeHolderStyle = 'place-holder'; | ||
/** @ignore */ | ||
exports.maximePlaceHolderId = '-maximized-placeholder-'; | ||
export const maximePlaceHolderId = '-maximized-placeholder-'; | ||
/** @ignore */ | ||
exports.placeHolderGroup = { | ||
export const placeHolderGroup = { | ||
floatable: false, | ||
}; | ||
/** @ignore */ | ||
exports.DockContextType = react_1.default.createContext(null); | ||
export const DockContextType = React.createContext(null); | ||
/** @ignore */ | ||
exports.DockContextProvider = exports.DockContextType.Provider; | ||
export const DockContextProvider = DockContextType.Provider; | ||
/** @ignore */ | ||
exports.DockContextConsumer = exports.DockContextType.Consumer; | ||
export const DockContextConsumer = DockContextType.Consumer; |
@@ -1,12 +0,6 @@ | ||
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DockDropEdge = void 0; | ||
const react_1 = __importDefault(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 { | ||
import React from "react"; | ||
import { DockContextType } from "./DockData"; | ||
import { DragDropDiv } from "./dragdrop/DragDropDiv"; | ||
import { DragState } from "./dragdrop/DragManager"; | ||
export class DockDropEdge extends React.PureComponent { | ||
constructor() { | ||
@@ -20,3 +14,3 @@ super(...arguments); | ||
let dockId = this.context.getDockId(); | ||
let draggingPanel = DragManager_1.DragState.getData('panel', dockId); | ||
let draggingPanel = DragState.getData('panel', dockId); | ||
let fromGroup = this.context.getGroup(dropFromPanel.group); | ||
@@ -37,3 +31,3 @@ if (draggingPanel && draggingPanel.parent.mode === 'float') { | ||
} | ||
let panelSize = DragManager_1.DragState.getData('panelSize', dockId); | ||
let panelSize = DragState.getData('panelSize', dockId); | ||
this.context.setDropRect(targetElement, direction, this, e, panelSize); | ||
@@ -49,4 +43,4 @@ e.accept(''); | ||
let fromGroup = this.context.getGroup(dropFromPanel.group); | ||
let source = DragManager_1.DragState.getData('tab', dockId); | ||
let draggingPanel = DragManager_1.DragState.getData('panel', dockId); | ||
let source = DragState.getData('tab', dockId); | ||
let draggingPanel = DragState.getData('panel', dockId); | ||
if (!source) { | ||
@@ -152,3 +146,3 @@ source = draggingPanel; | ||
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, { getRef: this.getRef, className: 'dock-drop-edge', onDragOverT: this.onDragOver, onDragLeaveT: this.onDragLeave, onDropT: this.onDrop })); | ||
} | ||
@@ -159,3 +153,2 @@ componentWillUnmount() { | ||
} | ||
exports.DockDropEdge = DockDropEdge; | ||
DockDropEdge.contextType = DockData_1.DockContextType; | ||
DockDropEdge.contextType = DockContextType; |
@@ -1,12 +0,6 @@ | ||
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DockDropLayer = exports.DockDropSquare = void 0; | ||
const react_1 = __importDefault(require("react")); | ||
const DockData_1 = require("./DockData"); | ||
const DragDropDiv_1 = require("./dragdrop/DragDropDiv"); | ||
const DragManager_1 = require("./dragdrop/DragManager"); | ||
class DockDropSquare extends react_1.default.PureComponent { | ||
import React from "react"; | ||
import { DockContextType, placeHolderStyle } from "./DockData"; | ||
import { DragDropDiv } from "./dragdrop/DragDropDiv"; | ||
import { DragState } from "./dragdrop/DragManager"; | ||
export class DockDropSquare extends React.PureComponent { | ||
constructor() { | ||
@@ -21,3 +15,3 @@ super(...arguments); | ||
} | ||
if (panelData.group === DockData_1.placeHolderStyle && direction !== 'float') { | ||
if (panelData.group === placeHolderStyle && direction !== 'float') { | ||
// place holder panel should always have full size drop rect | ||
@@ -28,3 +22,3 @@ this.context.setDropRect(targetElement, 'middle', this, e); | ||
let dockId = this.context.getDockId(); | ||
let panelSize = DragManager_1.DragState.getData('panelSize', dockId); | ||
let panelSize = DragState.getData('panelSize', dockId); | ||
this.context.setDropRect(targetElement, direction, this, e, panelSize); | ||
@@ -41,5 +35,5 @@ } | ||
let dockId = this.context.getDockId(); | ||
let source = DragManager_1.DragState.getData('tab', dockId); | ||
let source = DragState.getData('tab', dockId); | ||
if (!source) { | ||
source = DragManager_1.DragState.getData('panel', dockId); | ||
source = DragState.getData('panel', dockId); | ||
} | ||
@@ -67,4 +61,4 @@ if (source) { | ||
} | ||
return (react_1.default.createElement(DragDropDiv_1.DragDropDiv, { className: classes.join(' '), onDragOverT: this.onDragOver, onDragLeaveT: this.onDragLeave, onDropT: this.onDrop }, | ||
react_1.default.createElement("div", { className: 'dock-drop-square-box' }))); | ||
return (React.createElement(DragDropDiv, { className: classes.join(' '), onDragOverT: this.onDragOver, onDragLeaveT: this.onDragLeave, onDropT: this.onDrop }, | ||
React.createElement("div", { className: 'dock-drop-square-box' }))); | ||
} | ||
@@ -75,13 +69,12 @@ componentWillUnmount() { | ||
} | ||
exports.DockDropSquare = DockDropSquare; | ||
DockDropSquare.contextType = DockData_1.DockContextType; | ||
class DockDropLayer extends react_1.default.PureComponent { | ||
DockDropSquare.contextType = DockContextType; | ||
export class DockDropLayer extends React.PureComponent { | ||
static addDepthSquare(children, mode, panelData, panelElement, depth) { | ||
if (mode === 'horizontal') { | ||
children.push(react_1.default.createElement(DockDropSquare, { key: `top${depth}`, direction: 'top', depth: depth, panelData: panelData, panelElement: panelElement })); | ||
children.push(react_1.default.createElement(DockDropSquare, { key: `bottom${depth}`, direction: 'bottom', depth: depth, panelData: panelData, panelElement: panelElement })); | ||
children.push(React.createElement(DockDropSquare, { key: `top${depth}`, direction: 'top', depth: depth, panelData: panelData, panelElement: panelElement })); | ||
children.push(React.createElement(DockDropSquare, { key: `bottom${depth}`, direction: 'bottom', depth: depth, panelData: panelData, panelElement: panelElement })); | ||
} | ||
else { | ||
children.push(react_1.default.createElement(DockDropSquare, { key: `left${depth}`, direction: 'left', depth: depth, panelData: panelData, panelElement: panelElement })); | ||
children.push(react_1.default.createElement(DockDropSquare, { key: `right${depth}`, direction: 'right', depth: depth, panelData: panelData, panelElement: panelElement })); | ||
children.push(React.createElement(DockDropSquare, { key: `left${depth}`, direction: 'left', depth: depth, panelData: panelData, panelElement: panelElement })); | ||
children.push(React.createElement(DockDropSquare, { key: `right${depth}`, direction: 'right', depth: depth, panelData: panelData, panelElement: panelElement })); | ||
} | ||
@@ -94,3 +87,3 @@ } | ||
// check if it's whole panel dragging | ||
let draggingPanel = DragManager_1.DragState.getData('panel', dockId); | ||
let draggingPanel = DragState.getData('panel', dockId); | ||
let fromGroup = this.context.getGroup(dropFromPanel.group); | ||
@@ -100,3 +93,3 @@ if (fromGroup.floatable !== false && | ||
(!draggingPanel.panelLock && draggingPanel.parent.mode !== 'float'))) { | ||
children.push(react_1.default.createElement(DockDropSquare, { key: 'float', direction: 'float', panelData: panelData, panelElement: panelElement })); | ||
children.push(React.createElement(DockDropSquare, { key: 'float', direction: 'float', panelData: panelData, panelElement: panelElement })); | ||
} | ||
@@ -109,3 +102,3 @@ if (draggingPanel !== panelData && !fromGroup.disableDock) { // don't drop panel to itself | ||
// dock to tabs | ||
children.push(react_1.default.createElement(DockDropSquare, { key: 'middle', direction: 'middle', panelData: panelData, panelElement: panelElement })); | ||
children.push(React.createElement(DockDropSquare, { key: 'middle', direction: 'middle', panelData: panelData, panelElement: panelElement })); | ||
} | ||
@@ -121,6 +114,5 @@ let box = panelData.parent; | ||
} | ||
return (react_1.default.createElement("div", { className: 'dock-drop-layer' }, children)); | ||
return (React.createElement("div", { className: 'dock-drop-layer' }, children)); | ||
} | ||
} | ||
exports.DockDropLayer = DockDropLayer; | ||
DockDropLayer.contextType = DockData_1.DockContextType; | ||
DockDropLayer.contextType = DockContextType; |
@@ -1,21 +0,1 @@ | ||
"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) { | ||
@@ -32,20 +12,15 @@ var t = {}; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DockLayout = void 0; | ||
const react_1 = __importDefault(require("react")); | ||
const react_dom_1 = __importDefault(require("react-dom")); | ||
const debounce_1 = __importDefault(require("lodash/debounce")); | ||
const DockData_1 = require("./DockData"); | ||
const DockBox_1 = require("./DockBox"); | ||
const FloatBox_1 = require("./FloatBox"); | ||
const DockPanel_1 = require("./DockPanel"); | ||
const Algorithm = __importStar(require("./Algorithm")); | ||
const Serializer = __importStar(require("./Serializer")); | ||
const DragManager = __importStar(require("./dragdrop/DragManager")); | ||
const MaxBox_1 = require("./MaxBox"); | ||
const WindowBox_1 = require("./WindowBox"); | ||
class DockPortalManager extends react_1.default.PureComponent { | ||
import React from "react"; | ||
import ReactDOM from "react-dom"; | ||
import debounce from 'lodash/debounce'; | ||
import { defaultGroup, DockContextProvider, placeHolderGroup, placeHolderStyle } from "./DockData"; | ||
import { DockBox } from "./DockBox"; | ||
import { FloatBox } from "./FloatBox"; | ||
import { DockPanel } from "./DockPanel"; | ||
import * as Algorithm from "./Algorithm"; | ||
import * as Serializer from "./Serializer"; | ||
import * as DragManager from "./dragdrop/DragManager"; | ||
import { MaxBox } from "./MaxBox"; | ||
import { WindowBox } from "./WindowBox"; | ||
class DockPortalManager extends React.PureComponent { | ||
constructor() { | ||
@@ -98,3 +73,3 @@ super(...arguments); | ||
if (cache) { | ||
cache.portal = react_dom_1.default.createPortal(children, cache.div, cache.id); | ||
cache.portal = ReactDOM.createPortal(children, cache.div, cache.id); | ||
this.forceUpdate(); | ||
@@ -104,3 +79,3 @@ } | ||
} | ||
class DockLayout extends DockPortalManager { | ||
export class DockLayout extends DockPortalManager { | ||
constructor(props) { | ||
@@ -115,3 +90,3 @@ super(props); | ||
if (draggingScope == null) { | ||
DockPanel_1.DockPanel.droppingPanel = null; | ||
DockPanel.droppingPanel = null; | ||
if (this.state.dropRect) { | ||
@@ -122,3 +97,3 @@ this.setState({ dropRect: null }); | ||
}; | ||
this._onWindowResize = debounce_1.default(() => { | ||
this._onWindowResize = debounce(() => { | ||
let layout = this.tempLayout || this.state.layout; | ||
@@ -178,7 +153,7 @@ if (this._ref) { | ||
} | ||
if (name === DockData_1.placeHolderStyle) { | ||
return DockData_1.placeHolderGroup; | ||
if (name === placeHolderStyle) { | ||
return placeHolderGroup; | ||
} | ||
} | ||
return DockData_1.defaultGroup; | ||
return defaultGroup; | ||
} | ||
@@ -381,6 +356,6 @@ /** | ||
} | ||
maximize = react_dom_1.default.createPortal(react_1.default.createElement(MaxBox_1.MaxBox, { boxData: layout.maxbox }), maximizeTo); | ||
maximize = ReactDOM.createPortal(React.createElement(MaxBox, { boxData: layout.maxbox }), maximizeTo); | ||
} | ||
else { | ||
maximize = react_1.default.createElement(MaxBox_1.MaxBox, { boxData: layout.maxbox }); | ||
maximize = React.createElement(MaxBox, { boxData: layout.maxbox }); | ||
} | ||
@@ -394,10 +369,10 @@ // } | ||
} | ||
return (react_1.default.createElement("div", { ref: this.getRef, className: 'dock-layout', style: style }, | ||
react_1.default.createElement(DockData_1.DockContextProvider, { value: this }, | ||
react_1.default.createElement(DockBox_1.DockBox, { size: 1, boxData: layout.dockbox }), | ||
react_1.default.createElement(FloatBox_1.FloatBox, { boxData: layout.floatbox }), | ||
react_1.default.createElement(WindowBox_1.WindowBox, { boxData: layout.windowbox }), | ||
return (React.createElement("div", { ref: this.getRef, className: 'dock-layout', style: style }, | ||
React.createElement(DockContextProvider, { value: this }, | ||
React.createElement(DockBox, { size: 1, boxData: layout.dockbox }), | ||
React.createElement(FloatBox, { boxData: layout.floatbox }), | ||
React.createElement(WindowBox, { boxData: layout.windowbox }), | ||
maximize, | ||
portals), | ||
react_1.default.createElement("div", { className: 'dock-drop-indicator', style: dropRectStyle }))); | ||
React.createElement("div", { className: 'dock-drop-indicator', style: dropRectStyle }))); | ||
} | ||
@@ -473,2 +448,1 @@ /** @ignore */ | ||
} | ||
exports.DockLayout = DockLayout; |
@@ -1,16 +0,10 @@ | ||
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DockPanel = void 0; | ||
const react_1 = __importDefault(require("react")); | ||
const DockData_1 = require("./DockData"); | ||
const DockTabs_1 = require("./DockTabs"); | ||
const DragDropDiv_1 = require("./dragdrop/DragDropDiv"); | ||
const DragManager_1 = require("./dragdrop/DragManager"); | ||
const DockDropLayer_1 = require("./DockDropLayer"); | ||
const Algorithm_1 = require("./Algorithm"); | ||
const DockDropEdge_1 = require("./DockDropEdge"); | ||
class DockPanel extends react_1.default.PureComponent { | ||
import React from "react"; | ||
import { DockContextType } from "./DockData"; | ||
import { DockTabs } from "./DockTabs"; | ||
import { DragDropDiv } from "./dragdrop/DragDropDiv"; | ||
import { DragState } from "./dragdrop/DragManager"; | ||
import { DockDropLayer } from "./DockDropLayer"; | ||
import { getFloatPanelSize, nextZIndex } from "./Algorithm"; | ||
import { DockDropEdge } from "./DockDropEdge"; | ||
export class DockPanel extends React.PureComponent { | ||
constructor() { | ||
@@ -28,4 +22,4 @@ super(...arguments); | ||
let dockId = this.context.getDockId(); | ||
let tab = DragManager_1.DragState.getData('tab', dockId); | ||
let panel = DragManager_1.DragState.getData('panel', dockId); | ||
let tab = DragState.getData('tab', dockId); | ||
let panel = DragState.getData('panel', dockId); | ||
if (tab || panel) { | ||
@@ -62,3 +56,3 @@ DockPanel.droppingPanel = this; | ||
let tabGroup = this.context.getGroup(panelData.group); | ||
let [panelWidth, panelHeight] = Algorithm_1.getFloatPanelSize(this._ref, tabGroup); | ||
let [panelWidth, panelHeight] = getFloatPanelSize(this._ref, tabGroup); | ||
event.setData({ panel: panelData, panelSize: [panelWidth, panelHeight] }, dockId); | ||
@@ -155,3 +149,3 @@ event.startDrag(null); | ||
let { z } = panelData; | ||
let newZ = Algorithm_1.nextZIndex(z); | ||
let newZ = nextZIndex(z); | ||
if (newZ !== z) { | ||
@@ -229,16 +223,16 @@ panelData.z = newZ; | ||
let dockId = this.context.getDockId(); | ||
if (!tabGroup.tabLocked || DragManager_1.DragState.getData('tab', dockId) == null) { | ||
if (!tabGroup.tabLocked || DragState.getData('tab', dockId) == null) { | ||
// not allowed locked tab to create new panel | ||
let DockDropClass = this.context.useEdgeDrop() ? DockDropEdge_1.DockDropEdge : DockDropLayer_1.DockDropLayer; | ||
droppingLayer = react_1.default.createElement(DockDropClass, { panelData: panelData, panelElement: this._ref, dropFromPanel: dropFromPanel }); | ||
let DockDropClass = this.context.useEdgeDrop() ? DockDropEdge : DockDropLayer; | ||
droppingLayer = React.createElement(DockDropClass, { panelData: panelData, panelElement: this._ref, dropFromPanel: dropFromPanel }); | ||
} | ||
} | ||
return (react_1.default.createElement(DragDropDiv_1.DragDropDiv, { getRef: this.getRef, className: cls, style: style, "data-dockid": id, onMouseDownCapture: pointerDownCallback, onTouchStartCapture: pointerDownCallback, onDragOverT: isFloat ? null : this.onDragOver }, | ||
react_1.default.createElement(DockTabs_1.DockTabs, { panelData: panelData, onPanelDragStart: onPanelHeaderDragStart, onPanelDragMove: this.onPanelHeaderDragMove, onPanelDragEnd: this.onPanelHeaderDragEnd }), | ||
return (React.createElement(DragDropDiv, { getRef: this.getRef, className: cls, style: style, "data-dockid": id, onMouseDownCapture: pointerDownCallback, onTouchStartCapture: pointerDownCallback, onDragOverT: isFloat ? null : this.onDragOver }, | ||
React.createElement(DockTabs, { panelData: panelData, onPanelDragStart: onPanelHeaderDragStart, onPanelDragMove: this.onPanelHeaderDragMove, onPanelDragEnd: this.onPanelHeaderDragEnd }), | ||
isFloat ? | ||
[ | ||
react_1.default.createElement(DragDropDiv_1.DragDropDiv, { key: 'drag-size-t-l', className: 'dock-panel-drag-size dock-panel-drag-size-t-l', onDragStartT: this.onPanelCornerDragTL, onDragMoveT: this.onPanelCornerDragMove, onDragEndT: this.onPanelCornerDragEnd }), | ||
react_1.default.createElement(DragDropDiv_1.DragDropDiv, { key: 'drag-size-t-r', className: 'dock-panel-drag-size dock-panel-drag-size-t-r', onDragStartT: this.onPanelCornerDragTR, onDragMoveT: this.onPanelCornerDragMove, onDragEndT: this.onPanelCornerDragEnd }), | ||
react_1.default.createElement(DragDropDiv_1.DragDropDiv, { key: 'drag-size-b-l', className: 'dock-panel-drag-size dock-panel-drag-size-b-l', onDragStartT: this.onPanelCornerDragBL, onDragMoveT: this.onPanelCornerDragMove, onDragEndT: this.onPanelCornerDragEnd }), | ||
react_1.default.createElement(DragDropDiv_1.DragDropDiv, { key: 'drag-size-b-r', className: 'dock-panel-drag-size dock-panel-drag-size-b-r', onDragStartT: this.onPanelCornerDragBR, onDragMoveT: this.onPanelCornerDragMove, onDragEndT: this.onPanelCornerDragEnd }) | ||
React.createElement(DragDropDiv, { key: 'drag-size-t-l', className: 'dock-panel-drag-size dock-panel-drag-size-t-l', onDragStartT: this.onPanelCornerDragTL, onDragMoveT: this.onPanelCornerDragMove, onDragEndT: this.onPanelCornerDragEnd }), | ||
React.createElement(DragDropDiv, { key: 'drag-size-t-r', className: 'dock-panel-drag-size dock-panel-drag-size-t-r', onDragStartT: this.onPanelCornerDragTR, onDragMoveT: this.onPanelCornerDragMove, onDragEndT: this.onPanelCornerDragEnd }), | ||
React.createElement(DragDropDiv, { key: 'drag-size-b-l', className: 'dock-panel-drag-size dock-panel-drag-size-b-l', onDragStartT: this.onPanelCornerDragBL, onDragMoveT: this.onPanelCornerDragMove, onDragEndT: this.onPanelCornerDragEnd }), | ||
React.createElement(DragDropDiv, { key: 'drag-size-b-r', className: 'dock-panel-drag-size dock-panel-drag-size-b-r', onDragStartT: this.onPanelCornerDragBR, onDragMoveT: this.onPanelCornerDragMove, onDragEndT: this.onPanelCornerDragEnd }) | ||
] | ||
@@ -255,3 +249,2 @@ : null, | ||
} | ||
exports.DockPanel = DockPanel; | ||
DockPanel.contextType = DockData_1.DockContextType; | ||
DockPanel.contextType = DockContextType; |
@@ -1,2 +0,1 @@ | ||
"use strict"; | ||
var __rest = (this && this.__rest) || function (s, e) { | ||
@@ -13,14 +12,8 @@ var t = {}; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DockTabBar = void 0; | ||
const react_1 = __importDefault(require("react")); | ||
const DragDropDiv_1 = require("./dragdrop/DragDropDiv"); | ||
function DockTabBar(props) { | ||
import React from "react"; | ||
import { DragDropDiv } from "./dragdrop/DragDropDiv"; | ||
export function DockTabBar(props) { | ||
const { onDragStart, onDragMove, onDragEnd, TabNavList } = props, restProps = __rest(props, ["onDragStart", "onDragMove", "onDragEnd", "TabNavList"]); | ||
return (react_1.default.createElement(DragDropDiv_1.DragDropDiv, { onDragStartT: onDragStart, onDragMoveT: onDragMove, onDragEndT: onDragEnd, role: "tablist", className: 'dock-bar', tabIndex: 0 }, | ||
react_1.default.createElement(TabNavList, Object.assign({}, restProps)))); | ||
return (React.createElement(DragDropDiv, { onDragStartT: onDragStart, onDragMoveT: onDragMove, onDragEndT: onDragEnd, role: "tablist", className: 'dock-bar', tabIndex: 0 }, | ||
React.createElement(TabNavList, Object.assign({}, restProps)))); | ||
} | ||
exports.DockTabBar = DockTabBar; |
@@ -1,10 +0,5 @@ | ||
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const react_1 = __importDefault(require("react")); | ||
const classnames_1 = __importDefault(require("classnames")); | ||
const DockData_1 = require("./DockData"); | ||
class DockTabPane extends react_1.default.PureComponent { | ||
import React from 'react'; | ||
import classNames from 'classnames'; | ||
import { DockContextType } from "./DockData"; | ||
export default class DockTabPane extends React.PureComponent { | ||
constructor() { | ||
@@ -60,3 +55,3 @@ super(...arguments); | ||
let getRef = cached ? this.getRef : null; | ||
return (react_1.default.createElement("div", { ref: getRef, id: cacheId, role: "tabpanel", tabIndex: active ? 0 : -1, "aria-labelledby": id && `${id}-tab-${tabKey}`, "aria-hidden": !active, style: Object.assign(Object.assign({}, mergedStyle), style), className: classnames_1.default(`${prefixCls}-tabpane`, active && `${prefixCls}-tabpane-active`, className) }, (active || this.visited || forceRender) && renderChildren)); | ||
return (React.createElement("div", { ref: getRef, id: cacheId, role: "tabpanel", tabIndex: active ? 0 : -1, "aria-labelledby": id && `${id}-tab-${tabKey}`, "aria-hidden": !active, style: Object.assign(Object.assign({}, mergedStyle), style), className: classNames(`${prefixCls}-tabpane`, active && `${prefixCls}-tabpane-active`, className) }, (active || this.visited || forceRender) && renderChildren)); | ||
} | ||
@@ -75,3 +70,2 @@ componentDidMount() { | ||
} | ||
exports.default = DockTabPane; | ||
DockTabPane.contextType = DockData_1.DockContextType; | ||
DockTabPane.contextType = DockContextType; |
@@ -1,37 +0,12 @@ | ||
"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 __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DockTabs = exports.TabCache = void 0; | ||
const react_1 = __importDefault(require("react")); | ||
const DockData_1 = require("./DockData"); | ||
const rc_tabs_1 = __importDefault(require("rc-tabs")); | ||
const rc_menu_1 = __importStar(require("rc-menu")); | ||
const rc_dropdown_1 = __importDefault(require("rc-dropdown")); | ||
const DragManager = __importStar(require("./dragdrop/DragManager")); | ||
const DragDropDiv_1 = require("./dragdrop/DragDropDiv"); | ||
const DockTabBar_1 = require("./DockTabBar"); | ||
const DockTabPane_1 = __importDefault(require("./DockTabPane")); | ||
const Algorithm_1 = require("./Algorithm"); | ||
const WindowBox_1 = require("./WindowBox"); | ||
import React from "react"; | ||
import { DockContextType } from "./DockData"; | ||
import Tabs from 'rc-tabs'; | ||
import Menu, { MenuItem } from 'rc-menu'; | ||
import Dropdown from 'rc-dropdown'; | ||
import * as DragManager from "./dragdrop/DragManager"; | ||
import { DragDropDiv } from "./dragdrop/DragDropDiv"; | ||
import { DockTabBar } from "./DockTabBar"; | ||
import DockTabPane from "./DockTabPane"; | ||
import { getFloatPanelSize } from "./Algorithm"; | ||
import { WindowBox } from "./WindowBox"; | ||
function findParentPanel(element) { | ||
@@ -53,3 +28,3 @@ for (let i = 0; i < 10; ++i) { | ||
} | ||
class TabCache { | ||
export class TabCache { | ||
constructor(context) { | ||
@@ -82,3 +57,3 @@ this.getRef = (r) => { | ||
let tabGroup = this.context.getGroup(this.data.group); | ||
let [panelWidth, panelHeight] = Algorithm_1.getFloatPanelSize(panel, tabGroup); | ||
let [panelWidth, panelHeight] = getFloatPanelSize(panel, tabGroup); | ||
e.setData({ tab: this.data, panelSize: [panelWidth, panelHeight] }, this.context.getDockId()); | ||
@@ -161,8 +136,8 @@ e.startDrag(this._ref.parentElement, this._ref.parentElement); | ||
} | ||
let tab = (react_1.default.createElement("div", { ref: this.getRef }, | ||
let tab = (React.createElement("div", { ref: this.getRef }, | ||
title, | ||
react_1.default.createElement(DragDropDiv_1.DragDropDiv, { className: 'dock-tab-hit-area', getRef: this.getHitAreaRef, onDragStartT: onDragStart, onDragOverT: onDragOver, onDropT: onDrop, onDragLeaveT: onDragLeave }, closable ? | ||
react_1.default.createElement("div", { className: 'dock-tab-close-btn', onClick: this.onCloseClick, onKeyDown: this.onKeyDownCloseBtn, tabIndex: 0 }) | ||
React.createElement(DragDropDiv, { className: 'dock-tab-hit-area', getRef: this.getHitAreaRef, onDragStartT: onDragStart, onDragOverT: onDragOver, onDropT: onDrop, onDragLeaveT: onDragLeave }, closable ? | ||
React.createElement("div", { className: 'dock-tab-close-btn', onClick: this.onCloseClick, onKeyDown: this.onKeyDownCloseBtn, tabIndex: 0 }) | ||
: null))); | ||
return (react_1.default.createElement(DockTabPane_1.default, { key: id, cacheId: id, cached: cached, tab: tab }, content)); | ||
return (React.createElement(DockTabPane, { key: id, cacheId: id, cached: cached, tab: tab }, content)); | ||
} | ||
@@ -173,4 +148,3 @@ destroy() { | ||
} | ||
exports.TabCache = TabCache; | ||
class DockTabs extends react_1.default.PureComponent { | ||
export class DockTabs extends React.PureComponent { | ||
constructor() { | ||
@@ -209,3 +183,3 @@ super(...arguments); | ||
} | ||
let showNewWindowButton = group.newWindow && WindowBox_1.WindowBox.enabled && panelData.parent.mode === 'float'; | ||
let showNewWindowButton = group.newWindow && WindowBox.enabled && panelData.parent.mode === 'float'; | ||
let panelExtraContent; | ||
@@ -216,3 +190,3 @@ if (panelExtra) { | ||
else if (maximizable || showNewWindowButton) { | ||
panelExtraContent = react_1.default.createElement("div", { className: 'dock-panel-max-btn', onClick: maximizable ? this.onMaximizeClick : null, onKeyDown: maximizable ? this.onKeyDownMaximizeBtn : null, tabIndex: 0 }); | ||
panelExtraContent = React.createElement("div", { className: 'dock-panel-max-btn', onClick: maximizable ? this.onMaximizeClick : null, onKeyDown: maximizable ? this.onKeyDownMaximizeBtn : null, tabIndex: 0 }); | ||
if (showNewWindowButton) { | ||
@@ -222,3 +196,3 @@ panelExtraContent = this.addNewWindowMenu(panelExtraContent, !maximizable); | ||
} | ||
return (react_1.default.createElement(DockTabBar_1.DockTabBar, Object.assign({ onDragStart: onPanelDragStart, onDragMove: onPanelDragMove, onDragEnd: onPanelDragEnd, TabNavList: TabNavList }, props, { extra: panelExtraContent }))); | ||
return (React.createElement(DockTabBar, Object.assign({ onDragStart: onPanelDragStart, onDragMove: onPanelDragMove, onDragEnd: onPanelDragEnd, TabNavList: TabNavList }, props, { extra: panelExtraContent }))); | ||
}; | ||
@@ -262,6 +236,6 @@ this.onTabChange = (activeId) => { | ||
addNewWindowMenu(element, showWithLeftClick) { | ||
const nativeMenu = (react_1.default.createElement(rc_menu_1.default, { onClick: this.onNewWindowClick }, | ||
react_1.default.createElement(rc_menu_1.MenuItem, null, "New Window"))); | ||
const nativeMenu = (React.createElement(Menu, { onClick: this.onNewWindowClick }, | ||
React.createElement(MenuItem, null, "New Window"))); | ||
let trigger = showWithLeftClick ? ['contextMenu', 'click'] : ['contextMenu']; | ||
return (react_1.default.createElement(rc_dropdown_1.default, { prefixCls: "dock-dropdown", overlay: nativeMenu, trigger: trigger, mouseEnterDelay: 0.1, mouseLeaveDelay: 0.1 }, element)); | ||
return (React.createElement(Dropdown, { prefixCls: "dock-dropdown", overlay: nativeMenu, trigger: trigger, mouseEnterDelay: 0.1, mouseLeaveDelay: 0.1 }, element)); | ||
} | ||
@@ -280,7 +254,6 @@ render() { | ||
} | ||
return (react_1.default.createElement(rc_tabs_1.default, { prefixCls: 'dock', moreIcon: '...', animated: animated, renderTabBar: this.renderTabBar, activeKey: activeId, onChange: this.onTabChange }, children)); | ||
return (React.createElement(Tabs, { prefixCls: 'dock', moreIcon: '...', animated: animated, renderTabBar: this.renderTabBar, activeKey: activeId, onChange: this.onTabChange }, children)); | ||
} | ||
} | ||
exports.DockTabs = DockTabs; | ||
DockTabs.contextType = DockData_1.DockContextType; | ||
DockTabs.contextType = DockContextType; | ||
DockTabs.propKeys = ['group', 'tabs', 'activeId', 'onTabChange']; |
@@ -1,21 +0,1 @@ | ||
"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) { | ||
@@ -32,11 +12,6 @@ var t = {}; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DragDropDiv = void 0; | ||
const react_1 = __importDefault(require("react")); | ||
const DragManager = __importStar(require("./DragManager")); | ||
const GestureManager_1 = require("./GestureManager"); | ||
class DragDropDiv extends react_1.default.PureComponent { | ||
import React from "react"; | ||
import * as DragManager from "./DragManager"; | ||
import { GestureState } from "./GestureManager"; | ||
export class DragDropDiv extends React.PureComponent { | ||
constructor() { | ||
@@ -148,3 +123,3 @@ super(...arguments); | ||
let { onGestureMoveT, gestureSensitivity } = this.props; | ||
let state = new GestureManager_1.GestureState(e, this); | ||
let state = new GestureState(e, this); | ||
if (this.waitingMove) { | ||
@@ -262,3 +237,3 @@ if (!(gestureSensitivity > 0)) { | ||
this.baseAng = Math.atan2(this.baseY2 - this.baseY, this.baseX2 - this.baseX); | ||
let state = new GestureManager_1.GestureState(event, this, true); | ||
let state = new GestureState(event, this, true); | ||
if (onGestureStartT(state)) { | ||
@@ -320,3 +295,3 @@ this.addGestureListeners(event); | ||
} | ||
return (react_1.default.createElement("div", Object.assign({ ref: this._getRef, className: className }, others, { onMouseDown: onMouseDown, onTouchStart: onTouchDown }), children)); | ||
return (React.createElement("div", Object.assign({ ref: this._getRef, className: className }, others, { onMouseDown: onMouseDown, onTouchStart: onTouchDown }), children)); | ||
} | ||
@@ -345,2 +320,1 @@ componentDidUpdate(prevProps) { | ||
} | ||
exports.DragDropDiv = DragDropDiv; |
@@ -1,5 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.checkPointerDownEvent = exports.removeDragStateListener = exports.addDragStateListener = exports.destroyDraggingElement = exports.removeHandlers = exports.addHandlers = exports.isDragging = exports.DragState = void 0; | ||
class DragState { | ||
export class DragState { | ||
constructor(event, component, init = false) { | ||
@@ -113,3 +110,2 @@ this.pageX = 0; | ||
} | ||
exports.DragState = DragState; | ||
function preventDefault(e) { | ||
@@ -135,11 +131,9 @@ e.preventDefault(); | ||
let _dragListeners = new WeakMap(); | ||
function isDragging() { | ||
export function isDragging() { | ||
return _draggingState != null; | ||
} | ||
exports.isDragging = isDragging; | ||
function addHandlers(element, handlers) { | ||
export function addHandlers(element, handlers) { | ||
_dragListeners.set(element, handlers); | ||
} | ||
exports.addHandlers = addHandlers; | ||
function removeHandlers(element) { | ||
export function removeHandlers(element) { | ||
let handlers = _dragListeners.get(element); | ||
@@ -151,3 +145,2 @@ if (handlers === _droppingHandlers) { | ||
} | ||
exports.removeHandlers = removeHandlers; | ||
let _draggingDiv; | ||
@@ -219,3 +212,3 @@ let _draggingIcon; | ||
} | ||
function destroyDraggingElement(e) { | ||
export function destroyDraggingElement(e) { | ||
if (_refElement) { | ||
@@ -237,14 +230,11 @@ _refElement.classList.remove('dragging'); | ||
} | ||
exports.destroyDraggingElement = destroyDraggingElement; | ||
let _dragStateListener = new Set(); | ||
function addDragStateListener(callback) { | ||
export function addDragStateListener(callback) { | ||
_dragStateListener.add(callback); | ||
} | ||
exports.addDragStateListener = addDragStateListener; | ||
function removeDragStateListener(callback) { | ||
export function removeDragStateListener(callback) { | ||
_dragStateListener.delete(callback); | ||
} | ||
exports.removeDragStateListener = removeDragStateListener; | ||
let _lastPointerDownEvent; | ||
function checkPointerDownEvent(e) { | ||
export function checkPointerDownEvent(e) { | ||
if (e instanceof MouseEvent && e.button !== 0 && e.button !== 2) { | ||
@@ -261,3 +251,2 @@ // only allows left right button drag | ||
} | ||
exports.checkPointerDownEvent = checkPointerDownEvent; | ||
// work around for drag scroll issue on IOS | ||
@@ -264,0 +253,0 @@ if (typeof window !== 'undefined' && window.navigator && window.navigator.platform && /iP(ad|hone|od)/.test(window.navigator.platform)) { |
@@ -1,5 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.GestureState = void 0; | ||
class GestureState { | ||
export class GestureState { | ||
constructor(event, component, init = false) { | ||
@@ -56,2 +53,1 @@ this.dx1 = 0; | ||
} | ||
exports.GestureState = GestureState; |
@@ -1,10 +0,4 @@ | ||
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.FloatBox = void 0; | ||
const react_1 = __importDefault(require("react")); | ||
const DockPanel_1 = require("./DockPanel"); | ||
class FloatBox extends react_1.default.PureComponent { | ||
import React from "react"; | ||
import { DockPanel } from "./DockPanel"; | ||
export class FloatBox extends React.PureComponent { | ||
render() { | ||
@@ -15,8 +9,7 @@ let { children } = this.props.boxData; | ||
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, { size: child.size, panelData: child, key: child.id })); | ||
} | ||
} | ||
return (react_1.default.createElement("div", { className: 'dock-box dock-fbox' }, childrenRender)); | ||
return (React.createElement("div", { className: 'dock-box dock-fbox' }, childrenRender)); | ||
} | ||
} | ||
exports.FloatBox = FloatBox; |
@@ -1,24 +0,12 @@ | ||
"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 __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./DockTabs"), exports); | ||
__exportStar(require("./DockData"), exports); | ||
__exportStar(require("./DockPanel"), exports); | ||
__exportStar(require("./DockBox"), exports); | ||
__exportStar(require("./DockLayout"), exports); | ||
__exportStar(require("./dragdrop/DragManager"), exports); | ||
__exportStar(require("./dragdrop/GestureManager"), exports); | ||
__exportStar(require("./dragdrop/DragDropDiv"), exports); | ||
__exportStar(require("./Divider"), exports); | ||
__exportStar(require("./DividerBox"), exports); | ||
const DockLayout_1 = require("./DockLayout"); | ||
exports.default = DockLayout_1.DockLayout; | ||
export * from "./DockTabs"; | ||
export * from "./DockData"; | ||
export * from "./DockPanel"; | ||
export * from "./DockBox"; | ||
export * from "./DockLayout"; | ||
export * from "./dragdrop/DragManager"; | ||
export * from "./dragdrop/GestureManager"; | ||
export * from "./dragdrop/DragDropDiv"; | ||
export * from './Divider'; | ||
export * from './DividerBox'; | ||
import { DockLayout } from './DockLayout'; | ||
export default DockLayout; |
@@ -1,10 +0,4 @@ | ||
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.MaxBox = void 0; | ||
const react_1 = __importDefault(require("react")); | ||
const DockPanel_1 = require("./DockPanel"); | ||
class MaxBox extends react_1.default.PureComponent { | ||
import React from "react"; | ||
import { DockPanel } from "./DockPanel"; | ||
export class MaxBox extends React.PureComponent { | ||
render() { | ||
@@ -14,4 +8,4 @@ let panelData = this.props.boxData.children[0]; | ||
this.hidePanelData = Object.assign(Object.assign({}, panelData), { tabs: [] }); | ||
return (react_1.default.createElement("div", { className: 'dock-box dock-mbox dock-mbox-show' }, | ||
react_1.default.createElement(DockPanel_1.DockPanel, { size: 100, panelData: panelData }))); | ||
return (React.createElement("div", { className: 'dock-box dock-mbox dock-mbox-show' }, | ||
React.createElement(DockPanel, { size: 100, panelData: panelData }))); | ||
} | ||
@@ -22,10 +16,9 @@ else if (this.hidePanelData) { | ||
this.hidePanelData = null; | ||
return (react_1.default.createElement("div", { className: 'dock-box dock-mbox dock-mbox-hide' }, | ||
react_1.default.createElement(DockPanel_1.DockPanel, { size: 100, panelData: hidePanelData }))); | ||
return (React.createElement("div", { className: 'dock-box dock-mbox dock-mbox-hide' }, | ||
React.createElement(DockPanel, { size: 100, panelData: hidePanelData }))); | ||
} | ||
else { | ||
return (react_1.default.createElement("div", { className: 'dock-box dock-mbox dock-mbox-hide' })); | ||
return (React.createElement("div", { className: 'dock-box dock-mbox dock-mbox-hide' })); | ||
} | ||
} | ||
} | ||
exports.MaxBox = MaxBox; |
@@ -1,5 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.loadLayoutData = exports.saveLayoutData = exports.createLayoutCache = void 0; | ||
const DockData_1 = require("./DockData"); | ||
import { maximePlaceHolderId } from "./DockData"; | ||
function addPanelToCache(panelData, cache) { | ||
@@ -21,3 +18,3 @@ cache.panels.set(panelData.id, panelData); | ||
} | ||
function createLayoutCache(defaultLayout) { | ||
export function createLayoutCache(defaultLayout) { | ||
let cache = { | ||
@@ -44,4 +41,3 @@ panels: new Map(), | ||
} | ||
exports.createLayoutCache = createLayoutCache; | ||
function saveLayoutData(layout, saveTab, afterPanelSaved) { | ||
export function saveLayoutData(layout, saveTab, afterPanelSaved) { | ||
function saveTabData(tabData) { | ||
@@ -95,4 +91,3 @@ if (saveTab) { | ||
} | ||
exports.saveLayoutData = saveLayoutData; | ||
function loadLayoutData(savedLayout, defaultLayout, loadTab, afterPanelLoaded) { | ||
export function loadLayoutData(savedLayout, defaultLayout, loadTab, afterPanelLoaded) { | ||
if (!savedLayout.floatbox) { | ||
@@ -131,3 +126,3 @@ savedLayout.floatbox = { mode: 'float', children: [], size: 0 }; | ||
} | ||
if (savedPanel.id === DockData_1.maximePlaceHolderId) { | ||
if (savedPanel.id === maximePlaceHolderId) { | ||
panelData.panelLock = {}; | ||
@@ -166,2 +161,1 @@ } | ||
} | ||
exports.loadLayoutData = loadLayoutData; |
@@ -1,5 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.compareArray = exports.compareKeys = void 0; | ||
function compareKeys(a, b, keys) { | ||
export function compareKeys(a, b, keys) { | ||
if (a === b) { | ||
@@ -18,5 +15,4 @@ return true; | ||
} | ||
exports.compareKeys = compareKeys; | ||
const isArray = Array.isArray; | ||
function compareArray(a, b) { | ||
export function compareArray(a, b) { | ||
if (a === b) { | ||
@@ -39,2 +35,1 @@ return true; | ||
} | ||
exports.compareArray = compareArray; |
@@ -1,10 +0,4 @@ | ||
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.WindowBox = void 0; | ||
const react_1 = __importDefault(require("react")); | ||
const WindowPanel_1 = require("./WindowPanel"); | ||
class WindowBox extends react_1.default.PureComponent { | ||
import React from "react"; | ||
import { WindowPanel } from "./WindowPanel"; | ||
export class WindowBox extends React.PureComponent { | ||
render() { | ||
@@ -15,9 +9,8 @@ let { children } = this.props.boxData; | ||
if ('tabs' in child) { | ||
childrenRender.push(react_1.default.createElement(WindowPanel_1.WindowPanel, { key: child.id, panelData: child })); | ||
childrenRender.push(React.createElement(WindowPanel, { key: child.id, panelData: child })); | ||
} | ||
} | ||
return (react_1.default.createElement(react_1.default.Fragment, null, childrenRender)); | ||
return (React.createElement(React.Fragment, null, childrenRender)); | ||
} | ||
} | ||
exports.WindowBox = WindowBox; | ||
WindowBox.enabled = window.navigator.platform === 'Win32' || window.navigator.platform === 'MacIntel'; |
@@ -1,13 +0,7 @@ | ||
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.WindowPanel = void 0; | ||
const react_1 = __importDefault(require("react")); | ||
const rc_new_window_1 = __importDefault(require("rc-new-window")); | ||
const DockData_1 = require("./DockData"); | ||
const DockPanel_1 = require("./DockPanel"); | ||
const ScreenPosition_1 = require("rc-new-window/lib/ScreenPosition"); | ||
class WindowPanel extends react_1.default.PureComponent { | ||
import React from "react"; | ||
import NewWindow from "rc-new-window"; | ||
import { DockContextType } from "./DockData"; | ||
import { DockPanel } from "./DockPanel"; | ||
import { mapElementToScreenRect, mapWindowToElement } from "rc-new-window/lib/ScreenPosition"; | ||
export class WindowPanel extends React.PureComponent { | ||
constructor() { | ||
@@ -23,3 +17,3 @@ super(...arguments); | ||
let layoutRoot = this.context.getRootElement(); | ||
const rect = ScreenPosition_1.mapWindowToElement(layoutRoot, this._window); | ||
const rect = mapWindowToElement(layoutRoot, this._window); | ||
if (rect.width > 0 && rect.height > 0) { | ||
@@ -35,3 +29,3 @@ panelData.x = rect.left; | ||
let { panelData } = this.props; | ||
return ScreenPosition_1.mapElementToScreenRect(this.context.getRootElement(), { | ||
return mapElementToScreenRect(this.context.getRootElement(), { | ||
left: panelData.x, | ||
@@ -47,8 +41,7 @@ top: panelData.y, | ||
let { x, y, w, h } = panelData; | ||
return react_1.default.createElement(rc_new_window_1.default, { copyStyles: true, onOpen: this.onOpen, onClose: this.onUnload, onBlock: this.onUnload, initPopupInnerRect: this.initPopupInnerRect, width: w, height: h }, | ||
react_1.default.createElement("div", { className: 'dock-wbox' }, | ||
react_1.default.createElement(DockPanel_1.DockPanel, { size: panelData.size, panelData: panelData, key: panelData.id }))); | ||
return React.createElement(NewWindow, { copyStyles: true, onOpen: this.onOpen, onClose: this.onUnload, onBlock: this.onUnload, initPopupInnerRect: this.initPopupInnerRect, width: w, height: h }, | ||
React.createElement("div", { className: 'dock-wbox' }, | ||
React.createElement(DockPanel, { size: panelData.size, panelData: panelData, key: panelData.id }))); | ||
} | ||
} | ||
exports.WindowPanel = WindowPanel; | ||
WindowPanel.contextType = DockData_1.DockContextType; | ||
WindowPanel.contextType = DockContextType; |
{ | ||
"name": "rc-dock", | ||
"version": "3.0.3", | ||
"version": "3.0.4", | ||
"description": "dock layout for react component", | ||
@@ -35,3 +35,3 @@ "repository": { | ||
"rc-menu": "^8.10.5", | ||
"rc-new-window": "^0.1.5", | ||
"rc-new-window": "^0.1.6", | ||
"rc-tabs": "^11.7.3" | ||
@@ -38,0 +38,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
0
497105
126
13386
Updatedrc-new-window@^0.1.6