Merge branch 'dev'

This commit is contained in:
奔跑的面条 2023-05-08 20:37:17 +08:00
commit 0f9d202fd0
7 changed files with 34 additions and 49 deletions

View File

@ -2,7 +2,7 @@
<collapse-item name="信息" :expanded="true">
<setting-item-box name="文字" :alone="true">
<setting-item>
<n-input v-model:value="optionData.dataset" size="small"></n-input>
<n-input v-model:value="optionData.dataset" type="textarea" size="small"></n-input>
</setting-item>
</setting-item-box>
<setting-item-box name="链接" :alone="true">
@ -30,11 +30,7 @@
<n-input-number v-model:value="optionData.fontSize" size="small" placeholder="字体大小"></n-input-number>
</setting-item>
<setting-item name="字体粗细">
<n-select
v-model:value="optionData.fontWeight"
size="small"
:options="fontWeightOptions"
/>
<n-select v-model:value="optionData.fontWeight" size="small" :options="fontWeightOptions" />
</setting-item>
<setting-item name="X轴内边距">
<n-input-number v-model:value="optionData.paddingX" size="small" placeholder="输入内边距"></n-input-number>
@ -87,9 +83,7 @@
<script setup lang="ts">
import { PropType } from 'vue'
import { option, WritingModeEnum, WritingModeObject,
FontWeightEnum,
FontWeightObject, } from './config'
import { option, WritingModeEnum, WritingModeObject, FontWeightEnum, FontWeightObject } from './config'
import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
const props = defineProps({
optionData: {
@ -117,13 +111,13 @@ const verticalOptions = [
const fontWeightOptions = [
{
label: FontWeightEnum.NORMAL,
value: FontWeightObject[FontWeightEnum.NORMAL],
value: FontWeightObject[FontWeightEnum.NORMAL]
},
{
label: FontWeightEnum.BOLD,
value: FontWeightObject[FontWeightEnum.BOLD],
},
];
value: FontWeightObject[FontWeightEnum.BOLD]
}
]
const handleLinkClick = () => {
window.open(props.optionData.linkHead + props.optionData.link)
}

View File

@ -1,8 +1,8 @@
<template>
<div class="go-text-box">
<div class="content">
<span style="cursor: pointer" v-if="link" @click="click">{{ option.dataset }}</span>
<span v-else>{{ option.dataset }}</span>
<span style="cursor: pointer; white-space: pre-wrap" v-if="link" @click="click"></span>
<span style="white-space: pre-wrap" v-else>{{ option.dataset }}</span>
</div>
</div>
</template>

View File

@ -23,6 +23,8 @@
<script setup lang="ts">
import { computed, PropType } from 'vue'
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
import { EditCanvasTypeEnum } from '@/store/modules/chartEditStore/chartEditStore.d'
import { useDesignStore } from '@/store/modules/designStore/designStore'
import { CreateComponentType, CreateComponentGroupType } from '@/packages/index.d'
import { useSizeStyle, usePointStyle } from '../../hooks/useStyle.hook'
@ -55,6 +57,9 @@ const themeColor = computed(() => {
//
const hover = computed(() => {
const isDrag = chartEditStore.getEditCanvas[EditCanvasTypeEnum.IS_DRAG]
if (isDrag) return false
if (props.item.status.lock) return false
return props.item.id === chartEditStore.getTargetChart.hoverId
})

View File

@ -5,8 +5,9 @@ import { EditCanvasTypeEnum } from '@/store/modules/chartEditStore/chartEditStor
const chartEditStore = useChartEditStore()
// 布局处理
export const useLayout = () => {
onMounted(() => {
export const useLayout = (fn: () => Promise<void>) => {
let removeScale: Function = () => { }
onMounted(async () => {
// 设置 Dom 值(ref 不生效先用 document)
chartEditStore.setEditCanvas(
EditCanvasTypeEnum.EDIT_LAYOUT_DOM,
@ -17,13 +18,16 @@ export const useLayout = () => {
document.getElementById('go-chart-edit-content')
)
// 获取数据
await fn()
// 监听初始化
const removeScale = chartEditStore.listenerScale()
removeScale = chartEditStore.listenerScale()
})
onUnmounted(() => {
chartEditStore.setEditCanvas(EditCanvasTypeEnum.EDIT_LAYOUT_DOM, null)
chartEditStore.setEditCanvas(EditCanvasTypeEnum.EDIT_CONTENT_DOM, null)
removeScale()
})
})
}

View File

@ -109,10 +109,10 @@ const chartEditStore = useChartEditStore()
const { handleContextMenu } = useContextMenu()
// scale
provide(SCALE_KEY, null);
provide(SCALE_KEY, null)
//
useLayout()
useLayout(async () => {})
//
const { mouseenterHandle, mouseleaveHandle, mousedownHandle, mouseClickHandle } = useMouseHandle()

View File

@ -185,6 +185,11 @@ export const useSync = () => {
} else {
await create(comItem as CreateComponentType)
}
if (percentage === 100) {
// 清除历史记录
chartHistoryStore.clearBackStack()
chartHistoryStore.clearForwardStack()
}
}
} else {
// 非组件(顺便排除脏数据)

View File

@ -131,20 +131,6 @@ const selectOptions = ref([
key: 'preview',
icon: renderIcon(BrowsersOutlineIcon)
},
{
label: renderLang('global.r_copy'),
key: 'copy',
icon: renderIcon(CopyIcon)
},
{
label: renderLang('global.r_rename'),
key: 'rename',
icon: renderIcon(PencilIcon)
},
{
type: 'divider',
key: 'd1'
},
{
label: props.cardData?.release
? renderLang('global.r_unpublish')
@ -152,15 +138,6 @@ const selectOptions = ref([
key: 'send',
icon: renderIcon(SendIcon)
},
{
label: renderLang('global.r_download'),
key: 'download',
icon: renderIcon(DownloadIcon)
},
{
type: 'divider',
key: 'd2'
},
{
label: renderLang('global.r_delete'),
key: 'delete',