|
|
|
@ -101,6 +101,7 @@ export class CommonPanelEventBus
|
|
|
|
|
export class CommonPanel extends React.Component<ICommonPanelProps, ICommonPanelState>
|
|
|
|
|
{
|
|
|
|
|
private tree: HTMLElement; //目录数元素
|
|
|
|
|
private ColResizeEl = React.createRef<HTMLDivElement>();
|
|
|
|
|
startHandleDir = observable.box(false); //开始操作目录,重命名or新建
|
|
|
|
|
private timeId = null; //搜索时的定时器
|
|
|
|
|
dataList = observable([]);
|
|
|
|
@ -132,6 +133,7 @@ export class CommonPanel extends React.Component<ICommonPanelProps, ICommonPanel
|
|
|
|
|
private event: Function[] = [];
|
|
|
|
|
private copyIds = new Set();
|
|
|
|
|
@observable searchedDirs: IDirectoryProps[] = [];
|
|
|
|
|
private isDragging: boolean = false; //防止两种拖拽事件冲突
|
|
|
|
|
|
|
|
|
|
constructor(props)
|
|
|
|
|
{
|
|
|
|
@ -365,13 +367,18 @@ export class CommonPanel extends React.Component<ICommonPanelProps, ICommonPanel
|
|
|
|
|
}
|
|
|
|
|
</Navbar.Group>
|
|
|
|
|
</Navbar>
|
|
|
|
|
<Card style={{ position: "relative" }}>
|
|
|
|
|
<Card>
|
|
|
|
|
<div
|
|
|
|
|
className='navigation-left'
|
|
|
|
|
ref={this.ColResizeEl}>
|
|
|
|
|
{
|
|
|
|
|
this.props.isTemplateTag &&
|
|
|
|
|
<div className='com-tag'>
|
|
|
|
|
<TemplateTag
|
|
|
|
|
FindNode={this.FindNode}
|
|
|
|
|
currentTag={this.props.currentTag}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
<div
|
|
|
|
|
className="bp3-card img-tree"
|
|
|
|
@ -392,6 +399,15 @@ export class CommonPanel extends React.Component<ICommonPanelProps, ICommonPanel
|
|
|
|
|
className={Classes.ELEVATION_0}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
{
|
|
|
|
|
//模板添加拽托条,改变目宽度大小
|
|
|
|
|
this.props.isTemplateTag &&
|
|
|
|
|
<div
|
|
|
|
|
className='seekBar'
|
|
|
|
|
onPointerDown={(e) => { this.handleResize(e); }}
|
|
|
|
|
></div>
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
<div
|
|
|
|
|
className="bp3-card img-lib"
|
|
|
|
|
onDragStart={this.handleDragStart}
|
|
|
|
@ -448,6 +464,31 @@ export class CommonPanel extends React.Component<ICommonPanelProps, ICommonPanel
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//拖拽调整模板目录宽度大小
|
|
|
|
|
private handleResize = (e: React.PointerEvent<HTMLDivElement>) =>
|
|
|
|
|
{
|
|
|
|
|
this.isDragging = true;
|
|
|
|
|
const target = e.target as HTMLDivElement;
|
|
|
|
|
target.setPointerCapture(e.pointerId);
|
|
|
|
|
const clientX = e.clientX;
|
|
|
|
|
const originalWidth = this.ColResizeEl.current.offsetWidth;
|
|
|
|
|
|
|
|
|
|
target.onmousemove = (ev) =>
|
|
|
|
|
{
|
|
|
|
|
let currentWidth = ev.clientX - clientX + originalWidth;
|
|
|
|
|
if (currentWidth > 200 && currentWidth < 500)
|
|
|
|
|
this.ColResizeEl.current.style.width = currentWidth + "px";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
target.onmouseup = () =>
|
|
|
|
|
{
|
|
|
|
|
target.releasePointerCapture(e.pointerId);
|
|
|
|
|
target.onmousemove = null;
|
|
|
|
|
target.onmouseup = null;
|
|
|
|
|
this.isDragging = false;
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
private handleSelectAll = (e: React.FormEvent<HTMLInputElement>) =>
|
|
|
|
|
{
|
|
|
|
|
this.setState({ isSelectAll: e.currentTarget.checked });
|
|
|
|
@ -498,7 +539,8 @@ export class CommonPanel extends React.Component<ICommonPanelProps, ICommonPanel
|
|
|
|
|
//查找标签对应的节点
|
|
|
|
|
FindNode = async (IDir: string) =>
|
|
|
|
|
{
|
|
|
|
|
if (!IDir) return;
|
|
|
|
|
//没有节点树就不查找
|
|
|
|
|
if (!IDir || !this.tree) return;
|
|
|
|
|
await new Promise(res =>
|
|
|
|
|
{
|
|
|
|
|
let timer = setInterval(() =>
|
|
|
|
@ -1139,6 +1181,12 @@ export class CommonPanel extends React.Component<ICommonPanelProps, ICommonPanel
|
|
|
|
|
private _moveElement: HTMLElement;
|
|
|
|
|
private handleDirDragStart = (e: React.DragEvent<Element>) =>
|
|
|
|
|
{
|
|
|
|
|
if (this.isDragging)
|
|
|
|
|
{
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let el = e.target as HTMLElement;
|
|
|
|
|
while (true)
|
|
|
|
|
{
|
|
|
|
|