|
|
|
@ -2,7 +2,7 @@ import { Alignment, Button, Card, Checkbox, Classes, ContextMenu, Intent, ITreeN
|
|
|
|
|
import { observable, toJS } from 'mobx';
|
|
|
|
|
import { observer } from 'mobx-react';
|
|
|
|
|
import * as React from 'react';
|
|
|
|
|
import { DirUrl, FileUrls } from '../../../Common/HostUrl';
|
|
|
|
|
import { DirUrl, FileUrls, TemplateUrls, MaterialUrls, ToplineUrls } from '../../../Common/HostUrl';
|
|
|
|
|
import { MouseKey } from '../../../Common/KeyEnum';
|
|
|
|
|
import { DirectoryId, PostJson, RequestStatus } from '../../../Common/Request';
|
|
|
|
|
import { AppToaster } from '../Toaster';
|
|
|
|
@ -71,6 +71,7 @@ export class CommonPanel extends React.Component<ICommonPanelProps, ICommonPanel
|
|
|
|
|
currentPage: 1,
|
|
|
|
|
pageCount: 20
|
|
|
|
|
}
|
|
|
|
|
private _dragId = "";
|
|
|
|
|
private nodeEls: HTMLElement[];
|
|
|
|
|
constructor(props)
|
|
|
|
|
{
|
|
|
|
@ -103,6 +104,7 @@ export class CommonPanel extends React.Component<ICommonPanelProps, ICommonPanel
|
|
|
|
|
private handleSelectData = (e: React.FormEvent<HTMLInputElement>, data) =>
|
|
|
|
|
{
|
|
|
|
|
data.isChecked = e.currentTarget.checked;
|
|
|
|
|
|
|
|
|
|
if (e.currentTarget.checked)
|
|
|
|
|
this.needDeleteData.add(data);
|
|
|
|
|
else
|
|
|
|
@ -551,6 +553,8 @@ export class CommonPanel extends React.Component<ICommonPanelProps, ICommonPanel
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
let dataIds = this.getSelectDataIds();
|
|
|
|
|
if (dataIds.length === 0 && this._dragId)
|
|
|
|
|
dataIds.push(this._dragId);
|
|
|
|
|
if (targetId && !isNaN(Number(targetId)) && dataIds.length > 0)
|
|
|
|
|
{
|
|
|
|
|
let url = "";
|
|
|
|
@ -562,15 +566,15 @@ export class CommonPanel extends React.Component<ICommonPanelProps, ICommonPanel
|
|
|
|
|
query.file_ids = dataIds;
|
|
|
|
|
break;
|
|
|
|
|
case DirectoryId.MaterialDir:
|
|
|
|
|
url = FileUrls.move;
|
|
|
|
|
url = MaterialUrls.move;
|
|
|
|
|
query.material_ids = dataIds;
|
|
|
|
|
break;
|
|
|
|
|
case DirectoryId.ToplineDir:
|
|
|
|
|
url = FileUrls.move;
|
|
|
|
|
url = ToplineUrls.move;
|
|
|
|
|
query.topline_ids = dataIds;
|
|
|
|
|
break;
|
|
|
|
|
case DirectoryId.TemplateDir:
|
|
|
|
|
url = FileUrls.move;
|
|
|
|
|
url = TemplateUrls.move;
|
|
|
|
|
query.module_ids = dataIds;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
@ -654,6 +658,25 @@ export class CommonPanel extends React.Component<ICommonPanelProps, ICommonPanel
|
|
|
|
|
{
|
|
|
|
|
this.nodeEls = Array.from(this.tree.querySelectorAll(".bp3-tree-node-content"));
|
|
|
|
|
}
|
|
|
|
|
private handleDragStart = (e: React.DragEvent<Element>) =>
|
|
|
|
|
{
|
|
|
|
|
this._dragId = "";
|
|
|
|
|
let el = e.target as Element;
|
|
|
|
|
while (el)
|
|
|
|
|
{
|
|
|
|
|
if (el.hasAttribute("data-id"))
|
|
|
|
|
{
|
|
|
|
|
this._dragId = el.getAttribute("data-id");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (el.classList.contains("img-lib"))
|
|
|
|
|
break;
|
|
|
|
|
el = el.parentElement;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.needDeleteData.size === 0 && !this._dragId)
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
}
|
|
|
|
|
private handleDragEnd = () =>
|
|
|
|
|
{
|
|
|
|
|
for (let node of this.nodeEls)
|
|
|
|
@ -788,10 +811,7 @@ export class CommonPanel extends React.Component<ICommonPanelProps, ICommonPanel
|
|
|
|
|
</div>
|
|
|
|
|
<Card
|
|
|
|
|
className="img-lib"
|
|
|
|
|
onDragStart={e =>
|
|
|
|
|
{
|
|
|
|
|
if (this.needDeleteData.size === 0) e.preventDefault();
|
|
|
|
|
}}>
|
|
|
|
|
onDragStart={this.handleDragStart}>
|
|
|
|
|
{
|
|
|
|
|
React.Children.map(this.props.children, child =>
|
|
|
|
|
child && React.cloneElement(child as React.DetailedReactHTMLElement<any, any>,
|
|
|
|
|