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

View File

@ -1,8 +1,8 @@
<template> <template>
<div class="go-text-box"> <div class="go-text-box">
<div class="content"> <div class="content">
<span style="cursor: pointer" v-if="link" @click="click">{{ option.dataset }}</span> <span style="cursor: pointer; white-space: pre-wrap" v-if="link" @click="click"></span>
<span v-else>{{ option.dataset }}</span> <span style="white-space: pre-wrap" v-else>{{ option.dataset }}</span>
</div> </div>
</div> </div>
</template> </template>
@ -82,7 +82,7 @@ const click = () => {
border-width: v-bind('borderWidth + "px"'); border-width: v-bind('borderWidth + "px"');
border-radius: v-bind('borderRadius + "px"'); border-radius: v-bind('borderRadius + "px"');
border-color: v-bind('borderColor'); border-color: v-bind('borderColor');
background-color: v-bind('backgroundColor'); background-color: v-bind('backgroundColor');
} }
} }

View File

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

View File

@ -5,8 +5,9 @@ import { EditCanvasTypeEnum } from '@/store/modules/chartEditStore/chartEditStor
const chartEditStore = useChartEditStore() const chartEditStore = useChartEditStore()
// 布局处理 // 布局处理
export const useLayout = () => { export const useLayout = (fn: () => Promise<void>) => {
onMounted(() => { let removeScale: Function = () => { }
onMounted(async () => {
// 设置 Dom 值(ref 不生效先用 document) // 设置 Dom 值(ref 不生效先用 document)
chartEditStore.setEditCanvas( chartEditStore.setEditCanvas(
EditCanvasTypeEnum.EDIT_LAYOUT_DOM, EditCanvasTypeEnum.EDIT_LAYOUT_DOM,
@ -17,13 +18,16 @@ export const useLayout = () => {
document.getElementById('go-chart-edit-content') 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) onUnmounted(() => {
removeScale() 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() const { handleContextMenu } = useContextMenu()
// scale // scale
provide(SCALE_KEY, null); provide(SCALE_KEY, null)
// //
useLayout() useLayout(async () => {})
// //
const { mouseenterHandle, mouseleaveHandle, mousedownHandle, mouseClickHandle } = useMouseHandle() const { mouseenterHandle, mouseleaveHandle, mousedownHandle, mouseClickHandle } = useMouseHandle()

View File

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

View File

@ -131,20 +131,6 @@ const selectOptions = ref([
key: 'preview', key: 'preview',
icon: renderIcon(BrowsersOutlineIcon) 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 label: props.cardData?.release
? renderLang('global.r_unpublish') ? renderLang('global.r_unpublish')
@ -152,15 +138,6 @@ const selectOptions = ref([
key: 'send', key: 'send',
icon: renderIcon(SendIcon) icon: renderIcon(SendIcon)
}, },
{
label: renderLang('global.r_download'),
key: 'download',
icon: renderIcon(DownloadIcon)
},
{
type: 'divider',
key: 'd2'
},
{ {
label: renderLang('global.r_delete'), label: renderLang('global.r_delete'),
key: 'delete', key: 'delete',