forked from github/dataease
Merge pull request #4394 from dataease/pr@dev@refactor_panel-button
refactor(仪表板): 按钮组件禁止复制和移入Tab内
This commit is contained in:
commit
40f832df70
@ -1,5 +1,7 @@
|
||||
import store from '@/store'
|
||||
import eventBus from '@/components/canvas/utils/eventBus'
|
||||
import { $warning } from '@/utils/message'
|
||||
import i18n from '@/lang'
|
||||
|
||||
const ctrlKey = 17
|
||||
const commandKey = 91 // mac command
|
||||
@ -25,6 +27,8 @@ const enlargeKey = 190 // command + .
|
||||
|
||||
export const keycodes = [66, 67, 68, 69, 71, 76, 80, 83, 85, 86, 88, 89, 90]
|
||||
|
||||
const ignoreComponent = ['de-button', 'de-reset-button']
|
||||
|
||||
// 与组件状态无关的操作
|
||||
const basemap = {
|
||||
[vKey]: paste,
|
||||
@ -134,9 +138,13 @@ function decompose() {
|
||||
|
||||
function copyAndPast() {
|
||||
if (store.state.curComponent) {
|
||||
store.commit('copy')
|
||||
store.commit('paste', false)
|
||||
store.commit('recordSnapshot', 'copyAndPast')
|
||||
if (ignoreComponent.includes(store.state.curComponent.component)) {
|
||||
$warning(i18n.t('panel.forbidden_copy'))
|
||||
} else {
|
||||
store.commit('copy')
|
||||
store.commit('paste', false)
|
||||
store.commit('recordSnapshot', 'copyAndPast')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -455,7 +455,9 @@ export default {
|
||||
latestMoveY: 0,
|
||||
seriesIdMap: {
|
||||
id: ''
|
||||
}
|
||||
},
|
||||
// 禁止移入Tab中的组件
|
||||
ignoreTabMoveComponent: ['de-button', 'de-reset-button', 'de-tabs']
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@ -1966,7 +1968,7 @@ export default {
|
||||
const width = this.width
|
||||
const height = this.height
|
||||
// tab 移入检测开启 tab组件不能相互移入另一个tab组件
|
||||
if (this.isTabMoveCheck && this.element.type !== 'de-tabs') {
|
||||
if (this.isTabMoveCheck && !this.ignoreTabMoveComponent.includes(this.element.component)) {
|
||||
const nodes = this.$el.parentNode.childNodes // 获取当前父节点下所有子节点
|
||||
for (const item of nodes) {
|
||||
if (
|
||||
|
@ -1963,6 +1963,7 @@ export default {
|
||||
back_parent: 'Back to previous'
|
||||
},
|
||||
panel: {
|
||||
forbidden_copy: 'Forbidden copy',
|
||||
url_check_error: 'Jump error, Illegal URL',
|
||||
view_style: 'View Style',
|
||||
view_color_setting: 'View Color Setting',
|
||||
|
@ -1957,6 +1957,7 @@ export default {
|
||||
back_parent: '返回上一級'
|
||||
},
|
||||
panel: {
|
||||
forbidden_copy: '當前組件不允許復製',
|
||||
url_check_error: '跳轉錯誤,URL不合法',
|
||||
view_style: '視圖樣式',
|
||||
view_color_setting: '視圖配色',
|
||||
|
@ -1957,6 +1957,7 @@ export default {
|
||||
back_parent: '返回上一级'
|
||||
},
|
||||
panel: {
|
||||
forbidden_copy: '当前组件不允许复制',
|
||||
url_check_error: '跳转错误,URL不合法',
|
||||
view_style: '视图样式',
|
||||
view_color_setting: '视图配色',
|
||||
|
Loading…
Reference in New Issue
Block a user