Skip to content

Commit

Permalink
optimization: 禁用画布工具栏点击展开节点菜单侧栏&&画布选中态样式调整
Browse files Browse the repository at this point in the history
  • Loading branch information
ywywZhou committed Oct 17, 2023
1 parent 0d014ba commit 5c58034
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@
const divInputDom = this.$el.querySelector('.div-input')
if (divInputDom) {
divInputDom.innerHTML = this.value
if (this.render) {
if (this.render && this.value) {
this.handleInputBlur()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,9 @@
mounted () {
const divInputDom = this.$el.querySelector('.div-input')
if (divInputDom) {
divInputDom.innerText = typeof this.value === 'string' ? this.value : JSON.stringify(this.value)
if (this.render) {
const value = typeof this.value === 'string' ? this.value : JSON.stringify(this.value)
divInputDom.innerText = value
if (this.render && value) {
this.handleInputBlur()
// 把用户手动换行变成div标签
divInputDom.innerHTML = divInputDom.innerHTML.replace(/<br>/g, '<div><br></div>')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
'branch-gateway',
{ 'fail-skip': node.status === 'FINISHED' && node.skip },
{ 'ready': node.ready },
{ 'actived': node.isActived },
node.status ? node.status.toLowerCase() : ''
]">
<div class="node-type-icon common-icon-node-branchgateway"></div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
'branch-gateway',
{ 'fail-skip': node.status === 'FINISHED' && node.skip },
{ 'ready': node.ready },
{ 'actived': node.isActived },
node.status ? node.status.toLowerCase() : ''
]">
<div class="node-type-icon common-icon-node-conditionalparallelgateway"></div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,15 @@
* specific language governing permissions and limitations under the License.
*/
<template>
<div :class="['gateway-node', 'converge-gateway', node.status ? node.status.toLowerCase() : '', { 'ready': node.ready }]">
<div :class="[
'gateway-node',
'converge-gateway',
node.status ? node.status.toLowerCase() : '',
{
'ready': node.ready,
'actived': node.isActived
}
]">
<div class="node-type-icon common-icon-node-convergegateway"></div>
</div>
</template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,15 @@
* specific language governing permissions and limitations under the License.
*/
<template>
<div :class="['gateway-node', 'parallel-gateway', node.status ? node.status.toLowerCase() : '', { 'ready': node.ready }]">
<div :class="[
'gateway-node',
'parallel-gateway',
node.status ? node.status.toLowerCase() : '',
{
'ready': node.ready,
'actived': node.isActived
}
]">
<div class="node-type-icon common-icon-node-parallelgateway"></div>
</div>
</template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@
<div :class="`node-type-icon common-icon-node-endpoint-${langSuffix}`"></div>
</div>
<div
:class="['palette-item', 'entry-item', 'palette-with-menu', { actived: menuType === 'plugin' }]"
:class="['palette-item', 'entry-item', 'palette-with-menu']"
data-type="tasknode"
@mousedown="onNodeMouseDown('plugin', $event)">
<div class="node-type-icon common-icon-node-tasknode"></div>
</div>
<div
:class="['palette-item','entry-item', 'palette-with-menu', { actived: menuType === 'subflow' }]"
:class="['palette-item','entry-item', 'palette-with-menu']"
data-type="subflow"
@mousedown="onNodeMouseDown('subflow', $event)">
<div class="node-type-icon common-icon-node-subflow"></div>
Expand All @@ -57,29 +57,14 @@
<div class="node-type-icon common-icon-node-conditionalparallelgateway"></div>
</div>
</div>
<transition name="slideLeft">
<node-menu
v-if="menuType !== ''"
:menu-type="menuType"
:template-labels="templateLabels"
:built-in-plugins="atomTypeList.tasknode"
:common="common"
@change="menuType = $event === 'tasknode' ? 'plugin' : 'subflow'"
@close="menuType = ''">
</node-menu>
</transition>
</div>
</template>
<script>
import i18n from '@/config/i18n/index.js'
import NodeMenu from './NodeMenu/NodeMenu.vue'
import Guide from '@/utils/guide.js'
export default {
name: 'PalattePanel',
components: {
NodeMenu
},
props: {
templateLabels: Array,
atomTypeList: {
Expand All @@ -104,12 +89,6 @@
},
data () {
return {
menuType: '',
nodeMouse: {
type: '',
startX: null,
startY: null
},
moveFlag: {
x: 0,
y: 0
Expand All @@ -132,30 +111,6 @@
y: e.pageY
}
},
onOpenNodeMenu () {
this.menuType = this.nodeMouse.type
},
/**
* 节点点击,区分是 展开菜单 还是 拖拽
* @param {String} type -node type
* @param {Object} e -event
*/
onNodeMouseDown (type, e) {
this.nodeMouse.startX = e.pageX
this.nodeMouse.startY = e.pageY
this.nodeMouse.type = type
document.addEventListener('mouseup', this.mouseUpHandler)
},
mouseUpHandler (e) {
const endX = e.pageX
const endY = e.pageY
const max = Math.max(endX - this.nodeMouse.startX, endY - this.nodeMouse.startY)
// 移动距离小于 3 像素,认为是点击事件
if (max < 3) {
this.menuType = this.nodeMouse.type
}
document.removeEventListener('mouseup', this.mouseUpHandler)
},
renderGuide () {
const nodesGuide = [
{
Expand Down
4 changes: 2 additions & 2 deletions frontend/desktop/src/pages/task/TaskExecute/ExecuteInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1590,12 +1590,12 @@
height: 320px;
margin: 0 25px 8px 15px;
position: relative;
background: #f5f7fb;
background: #f5f7fa;
.sub-flow {
height: 100%;
border: 0;
/deep/.canvas-wrapper {
background: #f5f7fb;
background: #f5f7fa;
}
/deep/.canvas-flow {
.active {
Expand Down
18 changes: 17 additions & 1 deletion frontend/desktop/src/pages/task/TaskExecute/TaskOperation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2406,7 +2406,7 @@
document.addEventListener('mouseup', this.handleMouseUp)
},
handleMouseMove (event) {
const maxWidth = window.innerWidth - 340
const maxWidth = window.innerWidth - 400
let width = window.innerWidth - event.clientX
width = width < 960 ? 960 : width
width = width > maxWidth ? maxWidth : width
Expand Down Expand Up @@ -2486,6 +2486,22 @@
.jtk-endpoint {
z-index: 2 !important;
}
.actived {
box-shadow: none;
&::after {
content: '';
display: block;
height: calc(100% + 16px);
width: calc(100% + 16px);
position: absolute;
top: -9px;
left: -9px;
z-index: -1;
background: #e1ecff;
border: 1px solid #1768ef;
border-radius: 2px;
}
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1654,7 +1654,7 @@
document.addEventListener('mouseup', this.handleMouseUp)
},
handleMouseMove (event) {
const maxWidth = window.innerWidth - 300
const maxWidth = window.innerWidth - 400
let width = window.innerWidth - event.clientX
width = width < 800 ? 800 : width
width = width > maxWidth ? maxWidth : width
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@
document.addEventListener('mouseup', this.handleMouseUp)
},
handleMouseMove (event) {
const maxWidth = window.innerWidth - 300
const maxWidth = window.innerWidth - 400
let width = window.innerWidth - event.clientX
width = width < 800 ? 800 : width
width = width > maxWidth ? maxWidth : width
Expand Down

0 comments on commit 5c58034

Please sign in to comment.