feat: 合并多选功能,解决冲突,升级版本到2.0.4

This commit is contained in:
奔跑的面条
2022-08-19 10:44:44 +08:00
55 changed files with 1746 additions and 641 deletions
@@ -1,21 +1,8 @@
<template>
<div class="go-flex-items-center">
<n-popover
class="edit-history-popover"
:show="showDropdownRef"
:show-arrow="false"
size="small"
trigger="click"
placement="top-start"
>
<n-popover class="edit-history-popover" :show-arrow="false" size="small" trigger="click" placement="top-start">
<template #trigger>
<n-button
class="go-mr-1"
secondary
size="small"
:disabled="options.length === 0"
@click="handleClick"
>
<n-button class="mr-10" secondary size="small" :disabled="options.length === 0">
<span class="btn-text">历史记录</span>
</n-button>
</template>
@@ -24,16 +11,11 @@
<n-scrollbar style="max-height: 500px">
<div
class="list-item go-flex-items-center go-ellipsis-1"
v-for="item in options"
:key="item.key"
v-for="(item, index) in options"
:key="index"
:title="item.label"
>
<n-icon
class="item-icon"
size="16"
:depth="2"
:component="item.icon"
/>
<n-icon class="item-icon" size="16" :depth="2" :component="item.icon" />
<n-text depth="2">{{ item.label }}</n-text>
</div>
</n-scrollbar>
@@ -55,7 +37,6 @@
<script setup lang="ts">
import { ref, computed } from 'vue'
import { icon } from '@/plugins'
import { renderIcon } from '@/utils'
import { useChartHistoryStore } from '@/store/modules/chartHistoryStore/chartHistoryStore'
import { historyActionTypeName } from '@/store/modules/chartHistoryStore/chartHistoryDefine'
import { CreateComponentType } from '@/packages/index.d'
@@ -64,20 +45,12 @@ import reverse from 'lodash/reverse'
import {
HistoryItemType,
HistoryTargetTypeEnum,
HistoryActionTypeEnum,
HistoryActionTypeEnum
} from '@/store/modules/chartHistoryStore/chartHistoryStore.d'
const {
DesktopOutlineIcon,
PencilIcon,
TrashIcon,
CopyIcon,
LayersIcon,
DuplicateIcon,
HelpOutlineIcon,
} = icon.ionicons5
const { StackedMoveIcon } = icon.carbon
const showDropdownRef = ref(false)
const { DesktopOutlineIcon, PencilIcon, TrashIcon, CopyIcon, LayersIcon, DuplicateIcon, HelpOutlineIcon } =
icon.ionicons5
const { StackedMoveIcon, Carbon3DCursorIcon, Carbon3DSoftwareIcon } = icon.carbon
const chartHistoryStoreStore = useChartHistoryStore()
@@ -106,6 +79,10 @@ const iconHandle = (e: HistoryItemType) => {
return StackedMoveIcon
case HistoryActionTypeEnum.ADD:
return DuplicateIcon
case HistoryActionTypeEnum.GROUP:
return Carbon3DCursorIcon
case HistoryActionTypeEnum.UN_GROUP:
return Carbon3DSoftwareIcon
default:
return PencilIcon
}
@@ -116,10 +93,11 @@ const labelHandle = (e: HistoryItemType) => {
// 画布编辑
if (e.targetType === HistoryTargetTypeEnum.CANVAS) {
return historyActionTypeName[HistoryTargetTypeEnum.CANVAS]
} else if (e.actionType === HistoryActionTypeEnum.GROUP || e.actionType === HistoryActionTypeEnum.UN_GROUP) {
return `${historyActionTypeName[e.actionType]}`
} else if (e.historyData.length) {
return `${historyActionTypeName[e.actionType]} - ${(e.historyData[0] as CreateComponentType).chartConfig.title}`
}
return `${historyActionTypeName[e.actionType]} - ${
(e.historyData as CreateComponentType).chartConfig.title
}`
}
const options = computed(() => {
@@ -127,16 +105,14 @@ const options = computed(() => {
const options = backStack.map((e: HistoryItemType) => {
return {
label: labelHandle(e),
key: e.id,
icon: iconHandle(e),
icon: iconHandle(e)
}
})
return reverse(options)
})
const handleClick = () => {
showDropdownRef.value = !showDropdownRef.value
}
return reverse(options.filter(item => {
return item.label
}))
})
</script>
<style lang="scss" scoped>