Merge pull request #4394 from dataease/pr@dev@refactor_panel-button

refactor(仪表板): 按钮组件禁止复制和移入Tab内
This commit is contained in:
王嘉豪 2023-01-17 12:20:53 +08:00 committed by GitHub
commit 40f832df70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 5 deletions

View File

@ -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')
}
}
}

View File

@ -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 tabtab
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 (

View File

@ -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',

View File

@ -1957,6 +1957,7 @@ export default {
back_parent: '返回上一級'
},
panel: {
forbidden_copy: '當前組件不允許復製',
url_check_error: '跳轉錯誤URL不合法',
view_style: '視圖樣式',
view_color_setting: '視圖配色',

View File

@ -1957,6 +1957,7 @@ export default {
back_parent: '返回上一级'
},
panel: {
forbidden_copy: '当前组件不允许复制',
url_check_error: '跳转错误URL不合法',
view_style: '视图样式',
view_color_setting: '视图配色',