|
@@ -43,21 +43,33 @@
|
|
<h2 class="wider">{{ $t('rightPanel.backgroundColor') }}</h2>
|
|
<h2 class="wider">{{ $t('rightPanel.backgroundColor') }}</h2>
|
|
<div class="colors-container">
|
|
<div class="colors-container">
|
|
<span class="cell-container">
|
|
<span class="cell-container">
|
|
- <span class="cell-outer" :class="{ active: property.backgroundColor === '#FBBDBF' }" @click="setActiveToolColor('backgroundColor', '#FBBDBF')">
|
|
|
|
|
|
+ <span class="cell-outer" :class="{ active: areColorsSimilar(property.backgroundColor, 'rgb(251, 189, 191)') }" @click="setActiveToolColor('backgroundColor', 'rgb(251, 189, 191)')">
|
|
<span class="cell light-red"></span></span>
|
|
<span class="cell light-red"></span></span>
|
|
</span>
|
|
</span>
|
|
<span class="cell-container">
|
|
<span class="cell-container">
|
|
- <span class="cell-outer" :class="{ active: property.backgroundColor === '#FFFFFF' }" @click="setActiveToolColor('backgroundColor', '#FFFFFF')">
|
|
|
|
|
|
+ <span class="cell-outer" :class="{ active: areColorsSimilar(property.backgroundColor, 'rgb(255, 255, 255)') }" @click="setActiveToolColor('backgroundColor', 'rgb(255, 255, 255)')">
|
|
<span class="cell white"></span></span>
|
|
<span class="cell white"></span></span>
|
|
</span>
|
|
</span>
|
|
<span class="cell-container">
|
|
<span class="cell-container">
|
|
- <span class="cell-outer" :class="{ active: property.backgroundColor === '#FDF4B2' || property.backgroundColor === '#FDF4B1' }" @click="setActiveToolColor('backgroundColor', '#FDF4B2')">
|
|
|
|
|
|
+ <span class="cell-outer" :class="{ active: areColorsSimilar(property.backgroundColor, 'rgb(253, 244, 178)') || areColorsSimilar(property.backgroundColor, 'rgb(253, 244, 177)') }" @click="setActiveToolColor('backgroundColor', 'rgb(253, 244, 178)')">
|
|
<span class="cell light-yellow"></span></span>
|
|
<span class="cell light-yellow"></span></span>
|
|
</span>
|
|
</span>
|
|
<span class="cell-container">
|
|
<span class="cell-container">
|
|
- <span class="cell-outer" :class="{ active: property.backgroundColor === '#DDE9FF' }" @click="setActiveToolColor('backgroundColor', '#DDE9FF')">
|
|
|
|
|
|
+ <span class="cell-outer" :class="{ active: areColorsSimilar(property.backgroundColor, 'rgb(221, 233, 255)') }" @click="setActiveToolColor('backgroundColor', 'rgb(221, 233, 255)')">
|
|
<span class="cell light-blue"></span></span>
|
|
<span class="cell light-blue"></span></span>
|
|
</span>
|
|
</span>
|
|
|
|
+ <div class="color-picker">
|
|
|
|
+ <div class="preview" :style="{ backgroundColor: backgroundColorPicker }"></div>
|
|
|
|
+ <n-color-picker
|
|
|
|
+ to=".right-panel"
|
|
|
|
+ @complete="(newColor) => onColorPickerComplete(newColor, 'backgroundColor')"
|
|
|
|
+ @update:value="(newColor) => onColorPickerUpdate(newColor, 'backgroundColor')"
|
|
|
|
+ :value="backgroundColorPicker"
|
|
|
|
+ :show-alpha="false"
|
|
|
|
+ >
|
|
|
|
+ <template #label><Colorful /></template>
|
|
|
|
+ </n-color-picker>
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- 字体 -->
|
|
<!-- 字体 -->
|
|
@@ -66,17 +78,29 @@
|
|
<h2 class="wider">{{ $t('font') }}</h2>
|
|
<h2 class="wider">{{ $t('font') }}</h2>
|
|
<div class="colors-container">
|
|
<div class="colors-container">
|
|
<span class="cell-container">
|
|
<span class="cell-container">
|
|
- <span class="cell-outer" :class="{ active: property.color === '#FF0000' }" @click="setActiveToolColor('color', '#FF0000')">
|
|
|
|
|
|
+ <span class="cell-outer" :class="{ active: areColorsSimilar(property.color, 'rgb(255, 0, 0)') }" @click="setActiveToolColor('color', 'rgb(255, 0, 0)')">
|
|
<span class="cell red"></span></span>
|
|
<span class="cell red"></span></span>
|
|
</span>
|
|
</span>
|
|
<span class="cell-container">
|
|
<span class="cell-container">
|
|
- <span class="cell-outer" :class="{ active: property.color === '#000000' }" @click="setActiveToolColor('color', '#000000')">
|
|
|
|
|
|
+ <span class="cell-outer" :class="{ active: areColorsSimilar(property.color, 'rgb(0, 0, 0)') }" @click="setActiveToolColor('color', 'rgb(0, 0, 0)')">
|
|
<span class="cell black"></span></span>
|
|
<span class="cell black"></span></span>
|
|
</span>
|
|
</span>
|
|
<span class="cell-container">
|
|
<span class="cell-container">
|
|
- <span class="cell-outer" :class="{ active: property.color === '#2D77FA' || property.color === '#2D77F9' }" @click="setActiveToolColor('color', '#2D77FA')">
|
|
|
|
|
|
+ <span class="cell-outer" :class="{ active: areColorsSimilar(property.color, 'rgb(45, 119, 250)') || areColorsSimilar(property.color, 'rgb(45, 119, 249)') }" @click="setActiveToolColor('color', 'rgb(45, 119, 250)')">
|
|
<span class="cell blue"></span></span>
|
|
<span class="cell blue"></span></span>
|
|
</span>
|
|
</span>
|
|
|
|
+ <div class="color-picker">
|
|
|
|
+ <div class="preview" :style="{ backgroundColor: fontColorPicker }"></div>
|
|
|
|
+ <n-color-picker
|
|
|
|
+ to=".right-panel"
|
|
|
|
+ @complete="(newColor) => onColorPickerComplete(newColor, 'color')"
|
|
|
|
+ @update:value="(newColor) => onColorPickerUpdate(newColor, 'color')"
|
|
|
|
+ :value="fontColorPicker"
|
|
|
|
+ :show-alpha="false"
|
|
|
|
+ >
|
|
|
|
+ <template #label><Colorful /></template>
|
|
|
|
+ </n-color-picker>
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="content-block">
|
|
<div class="content-block">
|
|
@@ -213,7 +237,9 @@
|
|
import { computed, reactive, watch, ref, getCurrentInstance } from 'vue'
|
|
import { computed, reactive, watch, ref, getCurrentInstance } from 'vue'
|
|
import { useViewerStore } from '@/stores/modules/viewer'
|
|
import { useViewerStore } from '@/stores/modules/viewer'
|
|
import { useDocumentStore } from '@/stores/modules/document'
|
|
import { useDocumentStore } from '@/stores/modules/document'
|
|
|
|
+ import { NColorPicker } from 'naive-ui'
|
|
import core from '@/core'
|
|
import core from '@/core'
|
|
|
|
+ import { areColorsSimilar } from '@/helpers/utils'
|
|
|
|
|
|
const useViewer = useViewerStore()
|
|
const useViewer = useViewerStore()
|
|
const useDocument = useDocumentStore()
|
|
const useDocument = useDocumentStore()
|
|
@@ -248,13 +274,15 @@
|
|
let property = reactive(useDocument.propertyPanel)
|
|
let property = reactive(useDocument.propertyPanel)
|
|
let oldDestPage = property.destPage
|
|
let oldDestPage = property.destPage
|
|
let oldUrl = property.url
|
|
let oldUrl = property.url
|
|
- let fontFamily = ref('Helvetica')
|
|
|
|
|
|
+ const fontFamily = ref('Helvetica')
|
|
const isOneRadioBtn = ref(false)
|
|
const isOneRadioBtn = ref(false)
|
|
const selectedElement = ref(null)
|
|
const selectedElement = ref(null)
|
|
- let editItem = ref(null)
|
|
|
|
- let selectedItemIndex = ref(null)
|
|
|
|
- let items = ref([])
|
|
|
|
- let isOneCheckbox = ref(true)
|
|
|
|
|
|
+ const editItem = ref(null)
|
|
|
|
+ const selectedItemIndex = ref(null)
|
|
|
|
+ const items = ref([])
|
|
|
|
+ const isOneCheckbox = ref(true)
|
|
|
|
+ const backgroundColorPicker = ref('rgb(0, 0, 0)')
|
|
|
|
+ const fontColorPicker = ref('rgb(0, 0, 0)')
|
|
|
|
|
|
const handleProperty = (key) => {
|
|
const handleProperty = (key) => {
|
|
if (key === 'fieldName') {
|
|
if (key === 'fieldName') {
|
|
@@ -371,6 +399,7 @@
|
|
if (selectedElement.value === 'listbox' || selectedElement.value === 'combobox' || selectedElement.value === 'pushbutton') {
|
|
if (selectedElement.value === 'listbox' || selectedElement.value === 'combobox' || selectedElement.value === 'pushbutton') {
|
|
useViewer.setActiveElementTab('rightPanelTab', 'PREFERENCE')
|
|
useViewer.setActiveElementTab('rightPanelTab', 'PREFERENCE')
|
|
}
|
|
}
|
|
|
|
+ selectedElement.value !== 'checkbox' && (isOneCheckbox.value = true)
|
|
}
|
|
}
|
|
|
|
|
|
for (const item in props) {
|
|
for (const item in props) {
|
|
@@ -474,6 +503,18 @@
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ // 颜色选择器颜色改变事件
|
|
|
|
+ const onColorPickerUpdate = (newColor, key) => {
|
|
|
|
+ key === 'backgroundColor' && (backgroundColorPicker.value = newColor)
|
|
|
|
+ key === 'color' && (fontColorPicker.value = newColor)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 颜色选择器选中颜色事件
|
|
|
|
+ const onColorPickerComplete = (newColor, key) => {
|
|
|
|
+ if (areColorsSimilar(newColor, property[key])) return
|
|
|
|
+ setActiveToolColor(key, newColor)
|
|
|
|
+ }
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|
|
<style lang="scss">
|
|
@@ -484,7 +525,6 @@
|
|
display: flex;
|
|
display: flex;
|
|
flex-direction: column;
|
|
flex-direction: column;
|
|
height: calc(100% - 88px);
|
|
height: calc(100% - 88px);
|
|
- overflow: hidden;
|
|
|
|
transition: transform .3s ease-in-out;
|
|
transition: transform .3s ease-in-out;
|
|
background-color: var(--c-side-bg);
|
|
background-color: var(--c-side-bg);
|
|
border-left: 1px solid var(--c-side-header-border);
|
|
border-left: 1px solid var(--c-side-header-border);
|