!2016 优化:模板界面UI显示

pull/2031/MERGE
黄诗津 2 years ago committed by ChenX
parent b1698ef1c2
commit 2bc2b2f56b

@ -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)
{

@ -12,13 +12,49 @@
}
& > div:last-child {
position: relative;
height: calc(~"100% - 50px");
display: flex;
justify-content: space-between;
padding: 0;
.img-tree {
.navigation-left {
position: relative;
display: flex;
width: 25%;
.com-tag {
width: 50%;
.tag-name-list {
list-style: none;
text-align: left;
padding: 0;
max-height: 100%;
overflow: auto;
border-right: 1px solid #ccc;
padding-right: 5px;
width: 100%;
li {
border-bottom: 1px solid #ccc;
padding: 5px;
cursor: pointer;
}
li:hover {
background-color: #ccc;
}
li.active {
background-color: rgba(19, 124, 189);
color: #fff;
}
}
}
.img-tree {
flex: 1;
padding: 0;
overflow: auto;
@ -40,8 +76,19 @@
}
}
.seekBar {
cursor: col-resize;
position: absolute;
z-index: 10;
right: -3px;
padding: 0 3px;
height: 100%;
}
}
.img-lib {
width : 75%;
// width: 75%;
flex: 1;
padding: 0 10px;
overflow: visible;
position: relative;
@ -113,7 +160,7 @@
padding: 0;
margin: 0;
white-space: nowrap;
text-overflow: ellipsis
text-overflow: ellipsis;
}
& > .bp3-control {
@ -176,8 +223,6 @@
user-select: none;
}
& > li {
text-align: center;
@ -212,7 +257,6 @@
}
}
}
}
}
@ -299,7 +343,7 @@
z-index: 25;
label.bp3-label {
margin-bottom: 0
margin-bottom: 0;
}
}
@ -402,7 +446,7 @@
li:hover {
background-color: #ccc;
color : #fff
color: #fff;
}
}

@ -10,7 +10,7 @@
#commonModal .template,
#commonModal .template-select {
max-width : 1300px;
max-width: 1500px;
width: 90vw;
height: 850px;
@ -99,7 +99,6 @@
}
}
}
}
}
@ -206,34 +205,6 @@
opacity: 0.5;
}
}
.tag-name-list {
list-style : none;
width : 100px;
text-align : left;
padding : 0;
max-height : 100%;
overflow : auto;
border-right : 1px solid #ccc;
padding-right: 5px;
width : 20%;
li {
border-bottom: 1px solid #ccc;
padding : 5px;
cursor : pointer;
}
li:hover {
background-color: #ccc;
}
li.active {
background-color: rgba(19, 124, 189);
color : #fff;
}
}
}
#commonModal .template-detail {
@ -335,7 +306,6 @@
}
.buttons {
& > button {
margin-right: 3px;
margin-bottom: 3px;
@ -353,10 +323,7 @@
}
}
@boxShadow: rgba(19, 124, 189, 0) 0px 0px 0px 0px,
rgba(19, 124, 189, 0) 0px 0px 0px 0px,
rgba(16, 22, 26, 0.15) 0px 0px 0px 1px inset,
rgba(16, 22, 26, 0.2) 0px 1px 1px inset;
@boxShadow: rgba(19, 124, 189, 0) 0px 0px 0px 0px, rgba(19, 124, 189, 0) 0px 0px 0px 0px, rgba(16, 22, 26, 0.15) 0px 0px 0px 1px inset, rgba(16, 22, 26, 0.2) 0px 1px 1px inset;
.params-list {
list-style: none;
@ -411,9 +378,7 @@
z-index: 35;
display: flex;
flex-direction: column;
box-shadow : 0 0 0 1px rgba(16, 22, 26, 0.15),
0 0 0 rgba(16, 22, 26, 0),
0 0 0 rgba(16, 22, 26, 0);
box-shadow: 0 0 0 1px rgba(16, 22, 26, 0.15), 0 0 0 rgba(16, 22, 26, 0), 0 0 0 rgba(16, 22, 26, 0);
h4 {
font-size: 14px;

@ -885,25 +885,23 @@ export class TemplateManage extends React.Component<ITemplateManage, {}> {
title={title}
close={() => app.Editor.ModalManage.Destory()}
/>
<div
className={Classes.DIALOG_BODY}
>
<div className={Classes.DIALOG_BODY}>
{
this.renderBody()
}
</div>
<div className={Classes.DIALOG_FOOTER} >
{
!this.props.R2bReplace &&
!this.props.R2bReplace ?
<>
<GetRoomCabName
option={this.option}
needBoardName
/>
}
{!this.props.R2bReplace && <AutoCutCheckbox isFlex={false} autoCutOption={this.autoCutOption} />}
<AutoCutCheckbox isFlex={false} autoCutOption={this.autoCutOption} />
<div className={Classes.DIALOG_FOOTER_ACTIONS}>
{
!this.props.R2bReplace && <Button
<Button
className={Classes.INTENT_SUCCESS}
text={<span><i>(I)</i></span>}
disabled={!this.currentTemplateInfo.id}
@ -911,7 +909,7 @@ export class TemplateManage extends React.Component<ITemplateManage, {}> {
/>
}
{
!this.props.R2bReplace && <Button
<Button
className={Classes.INTENT_DANGER}
text={<span><i>(S)</i></span>}
onClick={() => this.handleInsert(false)}
@ -919,7 +917,7 @@ export class TemplateManage extends React.Component<ITemplateManage, {}> {
/>
}
{
this.currentTemplateInfo.id && (this.currentTemplateInfo.isHandle || this.currentTemplateInfo.isHinge) && !this.props.R2bReplace &&
this.currentTemplateInfo.id && (this.currentTemplateInfo.isHandle || this.currentTemplateInfo.isHinge) &&
<Button
className={Classes.INTENT_DANGER}
text="拾取板件"
@ -928,7 +926,7 @@ export class TemplateManage extends React.Component<ITemplateManage, {}> {
/>
}
{
!this.props.R2bReplace && <Button
<Button
className={Classes.INTENT_PRIMARY}
text={<span><i>(T)</i></span>}
onClick={this.handleReplace}
@ -936,8 +934,9 @@ export class TemplateManage extends React.Component<ITemplateManage, {}> {
/>
}
</div>
{
this.props.R2bReplace && <Button
</>
:
<Button
className={Classes.INTENT_PRIMARY}
text="确定"
onClick={this.handleR2bRepalce}

@ -4,7 +4,6 @@
& > li {
outline: 1px solid #ccc;
}
& > li.selected {
@ -38,8 +37,6 @@
& > li {
display: flex;
flex-direction: column;
}
& > li {
@ -64,20 +61,12 @@
display: flex;
padding: 5px 0;
:nth-child(1) {
flex: 1;
}
:nth-child(2) {
width: 160px;
}
:nth-child(3) {
width: 100px;
:nth-child(-n + 2) {
flex: 3 3 0%;
}
:nth-child(4) {
width: 100px;
:nth-child(n + 3) {
flex: 2 2 0%;
}
}
@ -85,26 +74,16 @@
height: 100%;
.data-list-info {
& > li {
display: flex;
align-items: center;
:nth-child(1) {
flex: 1;
}
:nth-child(2) {
width: 160px;
}
:nth-child(3) {
width: 100px;
:nth-child(-n + 2) {
flex: 3 3 0%;
}
:nth-child(4) {
width: 100px;
:nth-child(n + 3) {
flex: 2 2 0%;
}
// &>div {
@ -125,7 +104,6 @@
vertical-align: middle;
}
}
}
.apply-img-hint {

Loading…
Cancel
Save