diff --git a/src/views/Editor/Toolbar/ElementStylePanel/ChartStylePanel/ThemeColorsSetting.vue b/src/views/Editor/Toolbar/ElementStylePanel/ChartStylePanel/ThemeColorsSetting.vue
new file mode 100644
index 00000000..41e97e8c
--- /dev/null
+++ b/src/views/Editor/Toolbar/ElementStylePanel/ChartStylePanel/ThemeColorsSetting.vue
@@ -0,0 +1,108 @@
+
+
+
图表主题配色
+
+
+
+
主题配色{{ index + 1 }}:
+
+
+ themeColors[index] = value"
+ />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/Editor/Toolbar/ElementStylePanel/ChartStylePanel/index.vue b/src/views/Editor/Toolbar/ElementStylePanel/ChartStylePanel/index.vue
index a52a683e..de5258a5 100644
--- a/src/views/Editor/Toolbar/ElementStylePanel/ChartStylePanel/index.vue
+++ b/src/views/Editor/Toolbar/ElementStylePanel/ChartStylePanel/index.vue
@@ -49,52 +49,40 @@
-
-
-
-
{{index === 0 ? '主题配色:' : ''}}
-
+
+
主题配色:
+
- updateTheme(value, index)"
- />
-
-
-
-
-
-
-
-
-
-
+
+
预置图表主题:
+
+
幻灯片主题:
+
+
+
-
+
-
-
+
@@ -111,6 +99,14 @@
@save="value => updateData(value)"
/>
+
+
+ setThemeColors(colors)" />
+
@@ -125,13 +121,14 @@ import { CHART_PRESET_THEMES } from '@/configs/chart'
import ElementOutline from '../../common/ElementOutline.vue'
import ChartDataEditor from './ChartDataEditor.vue'
+import ThemeColorsSetting from './ThemeColorsSetting.vue'
import ColorButton from '@/components/ColorButton.vue'
+import ColorListButton from '@/components/ColorListButton.vue'
import ColorPicker from '@/components/ColorPicker/index.vue'
import Modal from '@/components/Modal.vue'
import Divider from '@/components/Divider.vue'
import Checkbox from '@/components/Checkbox.vue'
import Button from '@/components/Button.vue'
-import ButtonGroup from '@/components/ButtonGroup.vue'
import Popover from '@/components/Popover.vue'
const mainStore = useMainStore()
@@ -142,8 +139,8 @@ const { theme } = storeToRefs(slidesStore)
const handleChartElement = handleElement as Ref
const chartDataEditorVisible = ref(false)
-const presetThemesVisible = ref(false)
-const presetThemeColorHoverIndex = ref<[number, number]>([-1, -1])
+const themesVisible = ref(false)
+const themeColorsSettingVisible = ref(false)
const { addHistorySnapshot } = useHistorySnapshot()
@@ -202,35 +199,11 @@ const updateOptions = (optionProps: ChartOptions) => {
updateElement({ options: newOptions })
}
-// 设置主题色
-const updateTheme = (color: string, index: number) => {
- const props = {
- themeColors: themeColors.value.map((c, i) => i === index ? color : c),
- }
- updateElement(props)
-}
-
-// 添加主题色
-const addThemeColor = () => {
- const props = {
- themeColors: [...themeColors.value, theme.value.themeColors[0]],
- }
- updateElement(props)
-}
-
// 使用预置主题配色
-const applyPresetTheme = (colors: string[], index: number) => {
- const themeColors = colors.slice(0, index + 1)
- updateElement({ themeColors })
- presetThemesVisible.value = false
-}
-
-// 删除主题色
-const deleteThemeColor = (index: number) => {
- const props = {
- themeColors: themeColors.value.filter((c, i) => i !== index),
- }
- updateElement(props)
+const setThemeColors = (colors: string[]) => {
+ updateElement({ themeColors: colors })
+ themesVisible.value = false
+ themeColorsSettingVisible.value = false
}
// 设置文字颜色
@@ -262,41 +235,31 @@ onUnmounted(() => {
.btn-icon {
margin-right: 3px;
}
-.color-btn-wrap {
- position: relative;
-}
-.delete-color-btn {
- position: absolute;
- width: 30px;
- right: 2px;
- top: 2px;
- bottom: 2px;
- display: flex;
- justify-content: center;
- align-items: center;
- background-color: #fff;
- cursor: pointer;
+.label {
+ font-size: 12px;
+ margin-bottom: 4px;
}
.preset-themes {
width: 250px;
display: flex;
- margin-bottom: -10px;
@include flex-grid-layout();
}
.preset-theme {
display: flex;
cursor: pointer;
-
+ border: 1px solid #ccc;
+ padding: 2px;
+ border-radius: $borderRadius;
@include flex-grid-layout-children(2, 48%);
-}
-.preset-theme-color {
- width: 20px;
- height: 20px;
- &.select {
- transform: scale(1.2);
- transition: transform $transitionDelayFast;
+ &:hover {
+ border-color: $themeColor;
+ transition: border-color $transitionDelayFast;
}
}
+.preset-theme-color {
+ height: 20px;
+ flex: 1;
+}
\ No newline at end of file