Demo:删除侧边栏节点样式配置部分的激活节点配置
This commit is contained in:
parent
217d66f692
commit
5997c98b8f
@ -5,10 +5,6 @@
|
|||||||
:class="{ isDark: isDark }"
|
:class="{ isDark: isDark }"
|
||||||
v-if="activeNodes.length > 0"
|
v-if="activeNodes.length > 0"
|
||||||
>
|
>
|
||||||
<el-tabs class="tab" v-model="activeTab" @tab-click="handleTabClick">
|
|
||||||
<el-tab-pane :label="$t('style.normal')" name="normal"></el-tab-pane>
|
|
||||||
<el-tab-pane :label="$t('style.active')" name="active"></el-tab-pane>
|
|
||||||
</el-tabs>
|
|
||||||
<div class="sidebarContent" v-if="activeNodes.length > 0">
|
<div class="sidebarContent" v-if="activeNodes.length > 0">
|
||||||
<!-- 文字 -->
|
<!-- 文字 -->
|
||||||
<div class="title noTop">{{ $t('style.text') }}</div>
|
<div class="title noTop">{{ $t('style.text') }}</div>
|
||||||
@ -19,7 +15,6 @@
|
|||||||
size="mini"
|
size="mini"
|
||||||
v-model="style.fontFamily"
|
v-model="style.fontFamily"
|
||||||
placeholder=""
|
placeholder=""
|
||||||
:disabled="checkDisabled('fontFamily')"
|
|
||||||
@change="update('fontFamily')"
|
@change="update('fontFamily')"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
@ -41,7 +36,6 @@
|
|||||||
style="width: 80px"
|
style="width: 80px"
|
||||||
v-model="style.fontSize"
|
v-model="style.fontSize"
|
||||||
placeholder=""
|
placeholder=""
|
||||||
:disabled="checkDisabled('fontSize')"
|
|
||||||
@change="update('fontSize')"
|
@change="update('fontSize')"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
@ -61,7 +55,6 @@
|
|||||||
style="width: 80px"
|
style="width: 80px"
|
||||||
v-model="style.lineHeight"
|
v-model="style.lineHeight"
|
||||||
placeholder=""
|
placeholder=""
|
||||||
:disabled="checkDisabled('lineHeight')"
|
|
||||||
@change="update('lineHeight')"
|
@change="update('lineHeight')"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
@ -77,11 +70,7 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="btnGroup">
|
<div class="btnGroup">
|
||||||
<el-tooltip :content="$t('style.color')" placement="bottom">
|
<el-tooltip :content="$t('style.color')" placement="bottom">
|
||||||
<div
|
<div class="styleBtn" v-popover:popover>
|
||||||
class="styleBtn"
|
|
||||||
v-popover:popover
|
|
||||||
:class="{ disabled: checkDisabled('color') }"
|
|
||||||
>
|
|
||||||
A
|
A
|
||||||
<span
|
<span
|
||||||
class="colorShow"
|
class="colorShow"
|
||||||
@ -93,8 +82,7 @@
|
|||||||
<div
|
<div
|
||||||
class="styleBtn"
|
class="styleBtn"
|
||||||
:class="{
|
:class="{
|
||||||
actived: style.fontWeight === 'bold',
|
actived: style.fontWeight === 'bold'
|
||||||
disabled: checkDisabled('fontWeight')
|
|
||||||
}"
|
}"
|
||||||
@click="toggleFontWeight"
|
@click="toggleFontWeight"
|
||||||
>
|
>
|
||||||
@ -105,8 +93,7 @@
|
|||||||
<div
|
<div
|
||||||
class="styleBtn i"
|
class="styleBtn i"
|
||||||
:class="{
|
:class="{
|
||||||
actived: style.fontStyle === 'italic',
|
actived: style.fontStyle === 'italic'
|
||||||
disabled: checkDisabled('fontStyle')
|
|
||||||
}"
|
}"
|
||||||
@click="toggleFontStyle"
|
@click="toggleFontStyle"
|
||||||
>
|
>
|
||||||
@ -120,27 +107,16 @@
|
|||||||
<div
|
<div
|
||||||
class="styleBtn u"
|
class="styleBtn u"
|
||||||
:style="{ textDecoration: style.textDecoration || 'none' }"
|
:style="{ textDecoration: style.textDecoration || 'none' }"
|
||||||
:class="{ disabled: checkDisabled('textDecoration') }"
|
|
||||||
v-popover:popover2
|
v-popover:popover2
|
||||||
>
|
>
|
||||||
U
|
U
|
||||||
</div>
|
</div>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</div>
|
</div>
|
||||||
<el-popover
|
<el-popover ref="popover" placement="bottom" trigger="hover">
|
||||||
ref="popover"
|
|
||||||
placement="bottom"
|
|
||||||
trigger="hover"
|
|
||||||
:disabled="checkDisabled('color')"
|
|
||||||
>
|
|
||||||
<Color :color="style.color" @change="changeFontColor"></Color>
|
<Color :color="style.color" @change="changeFontColor"></Color>
|
||||||
</el-popover>
|
</el-popover>
|
||||||
<el-popover
|
<el-popover ref="popover2" placement="bottom" trigger="hover">
|
||||||
ref="popover2"
|
|
||||||
placement="bottom"
|
|
||||||
trigger="hover"
|
|
||||||
:disabled="checkDisabled('textDecoration')"
|
|
||||||
>
|
|
||||||
<el-radio-group
|
<el-radio-group
|
||||||
size="mini"
|
size="mini"
|
||||||
v-model="style.textDecoration"
|
v-model="style.textDecoration"
|
||||||
@ -170,14 +146,8 @@
|
|||||||
class="block"
|
class="block"
|
||||||
v-popover:popover3
|
v-popover:popover3
|
||||||
:style="{ width: '80px', backgroundColor: style.borderColor }"
|
:style="{ width: '80px', backgroundColor: style.borderColor }"
|
||||||
:class="{ disabled: checkDisabled('borderColor') }"
|
|
||||||
></span>
|
></span>
|
||||||
<el-popover
|
<el-popover ref="popover3" placement="bottom" trigger="hover">
|
||||||
ref="popover3"
|
|
||||||
placement="bottom"
|
|
||||||
trigger="hover"
|
|
||||||
:disabled="checkDisabled('borderColor')"
|
|
||||||
>
|
|
||||||
<Color
|
<Color
|
||||||
:color="style.borderColor"
|
:color="style.borderColor"
|
||||||
@change="changeBorderColor"
|
@change="changeBorderColor"
|
||||||
@ -191,7 +161,6 @@
|
|||||||
style="width: 80px"
|
style="width: 80px"
|
||||||
v-model="style.borderDasharray"
|
v-model="style.borderDasharray"
|
||||||
placeholder=""
|
placeholder=""
|
||||||
:disabled="checkDisabled('borderDasharray')"
|
|
||||||
@change="update('borderDasharray')"
|
@change="update('borderDasharray')"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
@ -207,7 +176,13 @@
|
|||||||
x2="110"
|
x2="110"
|
||||||
y2="17"
|
y2="17"
|
||||||
stroke-width="2"
|
stroke-width="2"
|
||||||
:stroke="style.borderDasharray === item.value ? '#409eff' : isDark ? '#fff' : '#000'"
|
:stroke="
|
||||||
|
style.borderDasharray === item.value
|
||||||
|
? '#409eff'
|
||||||
|
: isDark
|
||||||
|
? '#fff'
|
||||||
|
: '#000'
|
||||||
|
"
|
||||||
:stroke-dasharray="item.value"
|
:stroke-dasharray="item.value"
|
||||||
></line>
|
></line>
|
||||||
</svg>
|
</svg>
|
||||||
@ -223,7 +198,6 @@
|
|||||||
style="width: 80px"
|
style="width: 80px"
|
||||||
v-model="style.borderWidth"
|
v-model="style.borderWidth"
|
||||||
placeholder=""
|
placeholder=""
|
||||||
:disabled="checkDisabled('borderWidth')"
|
|
||||||
@change="update('borderWidth')"
|
@change="update('borderWidth')"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
@ -241,14 +215,13 @@
|
|||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</div>
|
</div>
|
||||||
<div class="rowItem">
|
<div class="rowItem" v-show="style.shape === 'rectangle'">
|
||||||
<span class="name">{{ $t('style.borderRadius') }}</span>
|
<span class="name">{{ $t('style.borderRadius') }}</span>
|
||||||
<el-select
|
<el-select
|
||||||
size="mini"
|
size="mini"
|
||||||
style="width: 80px"
|
style="width: 80px"
|
||||||
v-model="style.borderRadius"
|
v-model="style.borderRadius"
|
||||||
placeholder=""
|
placeholder=""
|
||||||
:disabled="checkDisabled('borderRadius')"
|
|
||||||
@change="update('borderRadius')"
|
@change="update('borderRadius')"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
@ -270,14 +243,8 @@
|
|||||||
class="block"
|
class="block"
|
||||||
v-popover:popover4
|
v-popover:popover4
|
||||||
:style="{ backgroundColor: style.fillColor }"
|
:style="{ backgroundColor: style.fillColor }"
|
||||||
:class="{ disabled: checkDisabled('fillColor') }"
|
|
||||||
></span>
|
></span>
|
||||||
<el-popover
|
<el-popover ref="popover4" placement="bottom" trigger="hover">
|
||||||
ref="popover4"
|
|
||||||
placement="bottom"
|
|
||||||
trigger="hover"
|
|
||||||
:disabled="checkDisabled('fillColor')"
|
|
||||||
>
|
|
||||||
<Color :color="style.fillColor" @change="changeFillColor"></Color>
|
<Color :color="style.fillColor" @change="changeFillColor"></Color>
|
||||||
</el-popover>
|
</el-popover>
|
||||||
</div>
|
</div>
|
||||||
@ -292,7 +259,6 @@
|
|||||||
style="width: 120px"
|
style="width: 120px"
|
||||||
v-model="style.shape"
|
v-model="style.shape"
|
||||||
placeholder=""
|
placeholder=""
|
||||||
:disabled="checkDisabled('shape')"
|
|
||||||
@change="update('shape')"
|
@change="update('shape')"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
@ -305,7 +271,13 @@
|
|||||||
<path
|
<path
|
||||||
:d="shapeListMap[item.value]"
|
:d="shapeListMap[item.value]"
|
||||||
fill="none"
|
fill="none"
|
||||||
:stroke="style.shape === item.value ? '#409eff' : isDark ? '#fff' : '#000'"
|
:stroke="
|
||||||
|
style.shape === item.value
|
||||||
|
? '#409eff'
|
||||||
|
: isDark
|
||||||
|
? '#fff'
|
||||||
|
: '#000'
|
||||||
|
"
|
||||||
stroke-width="2"
|
stroke-width="2"
|
||||||
></path>
|
></path>
|
||||||
</svg>
|
</svg>
|
||||||
@ -322,14 +294,8 @@
|
|||||||
class="block"
|
class="block"
|
||||||
v-popover:popover5
|
v-popover:popover5
|
||||||
:style="{ width: '80px', backgroundColor: style.lineColor }"
|
:style="{ width: '80px', backgroundColor: style.lineColor }"
|
||||||
:class="{ disabled: checkDisabled('lineColor') }"
|
|
||||||
></span>
|
></span>
|
||||||
<el-popover
|
<el-popover ref="popover5" placement="bottom" trigger="hover">
|
||||||
ref="popover5"
|
|
||||||
placement="bottom"
|
|
||||||
trigger="hover"
|
|
||||||
:disabled="checkDisabled('lineColor')"
|
|
||||||
>
|
|
||||||
<Color :color="style.lineColor" @change="changeLineColor"></Color>
|
<Color :color="style.lineColor" @change="changeLineColor"></Color>
|
||||||
</el-popover>
|
</el-popover>
|
||||||
</div>
|
</div>
|
||||||
@ -340,7 +306,6 @@
|
|||||||
style="width: 80px"
|
style="width: 80px"
|
||||||
v-model="style.lineDasharray"
|
v-model="style.lineDasharray"
|
||||||
placeholder=""
|
placeholder=""
|
||||||
:disabled="checkDisabled('lineDasharray')"
|
|
||||||
@change="update('lineDasharray')"
|
@change="update('lineDasharray')"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
@ -356,7 +321,13 @@
|
|||||||
x2="110"
|
x2="110"
|
||||||
y2="17"
|
y2="17"
|
||||||
stroke-width="2"
|
stroke-width="2"
|
||||||
:stroke="style.lineDasharray === item.value ? '#409eff' : isDark ? '#fff' : '#000'"
|
:stroke="
|
||||||
|
style.lineDasharray === item.value
|
||||||
|
? '#409eff'
|
||||||
|
: isDark
|
||||||
|
? '#fff'
|
||||||
|
: '#000'
|
||||||
|
"
|
||||||
:stroke-dasharray="item.value"
|
:stroke-dasharray="item.value"
|
||||||
></line>
|
></line>
|
||||||
</svg>
|
</svg>
|
||||||
@ -372,7 +343,6 @@
|
|||||||
style="width: 80px"
|
style="width: 80px"
|
||||||
v-model="style.lineWidth"
|
v-model="style.lineWidth"
|
||||||
placeholder=""
|
placeholder=""
|
||||||
:disabled="checkDisabled('lineWidth')"
|
|
||||||
@change="update('lineWidth')"
|
@change="update('lineWidth')"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
@ -399,7 +369,6 @@
|
|||||||
<el-slider
|
<el-slider
|
||||||
style="width: 200px"
|
style="width: 200px"
|
||||||
v-model="style.paddingX"
|
v-model="style.paddingX"
|
||||||
:disabled="checkDisabled('paddingX')"
|
|
||||||
@change="update('paddingX')"
|
@change="update('paddingX')"
|
||||||
></el-slider>
|
></el-slider>
|
||||||
</div>
|
</div>
|
||||||
@ -410,7 +379,6 @@
|
|||||||
<el-slider
|
<el-slider
|
||||||
style="width: 200px"
|
style="width: 200px"
|
||||||
v-model="style.paddingY"
|
v-model="style.paddingY"
|
||||||
:disabled="checkDisabled('paddingY')"
|
|
||||||
@change="update('paddingY')"
|
@change="update('paddingY')"
|
||||||
></el-slider>
|
></el-slider>
|
||||||
</div>
|
</div>
|
||||||
@ -437,7 +405,6 @@ import {
|
|||||||
shapeList,
|
shapeList,
|
||||||
shapeListMap
|
shapeListMap
|
||||||
} from '@/config'
|
} from '@/config'
|
||||||
import { supportActiveStyle } from 'simple-mind-map/src/themes/default'
|
|
||||||
import { mapState } from 'vuex'
|
import { mapState } from 'vuex'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -453,13 +420,11 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
supportActiveStyle,
|
|
||||||
fontSizeList,
|
fontSizeList,
|
||||||
borderWidthList,
|
borderWidthList,
|
||||||
borderRadiusList,
|
borderRadiusList,
|
||||||
lineHeightList,
|
lineHeightList,
|
||||||
activeNodes: [],
|
activeNodes: [],
|
||||||
activeTab: 'normal',
|
|
||||||
style: {
|
style: {
|
||||||
shape: '',
|
shape: '',
|
||||||
paddingX: 0,
|
paddingX: 0,
|
||||||
@ -496,7 +461,7 @@ export default {
|
|||||||
},
|
},
|
||||||
shapeListMap() {
|
shapeListMap() {
|
||||||
return shapeListMap[this.$i18n.locale] || shapeListMap.zh
|
return shapeListMap[this.$i18n.locale] || shapeListMap.zh
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
activeSidebar(val) {
|
activeSidebar(val) {
|
||||||
@ -521,32 +486,11 @@ export default {
|
|||||||
*/
|
*/
|
||||||
onNodeActive(...args) {
|
onNodeActive(...args) {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.activeTab = 'normal'
|
|
||||||
this.activeNodes = args[1]
|
this.activeNodes = args[1]
|
||||||
this.initNodeStyle()
|
this.initNodeStyle()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author: 王林
|
|
||||||
* @Date: 2021-05-05 11:42:32
|
|
||||||
* @Desc: tab切换
|
|
||||||
*/
|
|
||||||
handleTabClick() {
|
|
||||||
this.initNodeStyle()
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author: 王林
|
|
||||||
* @Date: 2022-09-12 22:16:56
|
|
||||||
* @Desc: 检查是否禁用
|
|
||||||
*/
|
|
||||||
checkDisabled(prop) {
|
|
||||||
return (
|
|
||||||
this.activeTab === 'active' && !this.supportActiveStyle.includes(prop)
|
|
||||||
)
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: 王林
|
* @Author: 王林
|
||||||
* @Date: 2021-05-05 09:48:52
|
* @Date: 2021-05-05 09:48:52
|
||||||
@ -554,7 +498,6 @@ export default {
|
|||||||
*/
|
*/
|
||||||
initNodeStyle() {
|
initNodeStyle() {
|
||||||
if (this.activeNodes.length <= 0) {
|
if (this.activeNodes.length <= 0) {
|
||||||
this.activeTab = 'normal'
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
;[
|
;[
|
||||||
@ -577,11 +520,7 @@ export default {
|
|||||||
'lineDasharray',
|
'lineDasharray',
|
||||||
'lineWidth'
|
'lineWidth'
|
||||||
].forEach(item => {
|
].forEach(item => {
|
||||||
this.style[item] = this.activeNodes[0].getStyle(
|
this.style[item] = this.activeNodes[0].getStyle(item, false)
|
||||||
item,
|
|
||||||
false,
|
|
||||||
this.activeTab === 'active'
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -592,7 +531,7 @@ export default {
|
|||||||
*/
|
*/
|
||||||
update(prop) {
|
update(prop) {
|
||||||
this.activeNodes.forEach(node => {
|
this.activeNodes.forEach(node => {
|
||||||
node.setStyle(prop, this.style[prop], this.activeTab === 'active')
|
node.setStyle(prop, this.style[prop])
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user