feat: 隐藏锁定操作,支持历史记录回退和前进

This commit is contained in:
tnt group
2022-09-28 18:43:55 +08:00
parent 2c834c1d62
commit c22d559195
4 changed files with 70 additions and 16 deletions
@@ -1,7 +1,4 @@
import {
HistoryTargetTypeEnum,
HistoryActionTypeEnum
} from './chartHistoryStore.d'
import { HistoryTargetTypeEnum, HistoryActionTypeEnum } from './chartHistoryStore.d'
export const historyActionTypeName = {
[HistoryActionTypeEnum.ADD]: '新增图表',
@@ -18,6 +15,10 @@ export const historyActionTypeName = {
[HistoryActionTypeEnum.GROUP]: '创建分组',
[HistoryActionTypeEnum.UN_GROUP]: '解除分组',
[HistoryActionTypeEnum.SELECT_HISTORY]: '选择记录',
[HistoryActionTypeEnum.LOCK]: '锁定',
[HistoryActionTypeEnum.UNLOCK]: '解除锁定',
[HistoryActionTypeEnum.HIDE]: '隐藏',
[HistoryActionTypeEnum.SHOW]: '显示',
[HistoryTargetTypeEnum.CANVAS]: '画布初始化'
}
@@ -153,10 +153,6 @@ export const useChartHistoryStore = defineStore({
| HistoryActionTypeEnum.DOWN
| HistoryActionTypeEnum.UP
| HistoryActionTypeEnum.BOTTOM
| HistoryActionTypeEnum.LOCK
| HistoryActionTypeEnum.UNLOCK
| HistoryActionTypeEnum.HIDE
| HistoryActionTypeEnum.SHOW
) {
this.createStackItem(item, type, HistoryTargetTypeEnum.CHART)
},
@@ -171,6 +167,20 @@ export const useChartHistoryStore = defineStore({
// * 解除分组
createUnGroupHistory(item: Array<CreateComponentType | CreateComponentGroupType>) {
this.createStackItem(item, HistoryActionTypeEnum.UN_GROUP, HistoryTargetTypeEnum.CHART)
},
// * 锁定记录
createLockHistory(
item: Array<CreateComponentType | CreateComponentGroupType>,
type: HistoryActionTypeEnum.LOCK | HistoryActionTypeEnum.UNLOCK
) {
this.createStackItem(item, type, HistoryTargetTypeEnum.CHART)
},
// * 隐藏记录
createHideHistory(
item: Array<CreateComponentType | CreateComponentGroupType>,
type: HistoryActionTypeEnum.HIDE | HistoryActionTypeEnum.SHOW
) {
this.createStackItem(item, type, HistoryTargetTypeEnum.CHART)
}
}
})