Browse Source

fix(nc-gui): updated color picker

pull/7664/head
Ramesh Mane 9 months ago
parent
commit
4eaa8d32a5
  1. 24
      packages/nc-gui/components/general/ColorPicker.vue
  2. 26
      packages/nc-gui/components/smartsheet/Form.vue

24
packages/nc-gui/components/general/ColorPicker.vue

@ -7,6 +7,8 @@ interface Props {
rowSize?: number rowSize?: number
advanced?: boolean advanced?: boolean
pickButton?: boolean pickButton?: boolean
borders?: string[]
isNewDesign?: boolean
} }
const props = withDefaults(defineProps<Props>(), { const props = withDefaults(defineProps<Props>(), {
@ -15,6 +17,7 @@ const props = withDefaults(defineProps<Props>(), {
rowSize: 10, rowSize: 10,
advanced: true, advanced: true,
pickButton: false, pickButton: false,
isNewDesign: false,
}) })
const emit = defineEmits(['input', 'closeModal']) const emit = defineEmits(['input', 'closeModal'])
@ -52,11 +55,14 @@ watch(picked, (n, _o) => {
v-for="(color, i) of colors.slice((colId - 1) * rowSize, colId * rowSize)" v-for="(color, i) of colors.slice((colId - 1) * rowSize, colId * rowSize)"
:key="`color-${colId}-${i}`" :key="`color-${colId}-${i}`"
class="color-selector" class="color-selector"
:class="compare(picked, color) ? 'selected' : ''" :class="{ 'selected': compare(picked, color), 'new-design': isNewDesign }"
:style="{ 'background-color': `${color}` }" :style="{
'background-color': `${color}`,
'border': borders?.length && borders[i] ? `1px solid ${borders[i]}` : undefined,
}"
@click="selectColor(color, true)" @click="selectColor(color, true)"
> >
{{ compare(picked, color) ? '&#10003;' : '' }} {{ compare(picked, color) && !isNewDesign ? '&#10003;' : '' }}
</button> </button>
<button class="h-6 w-6 mt-2.7 ml-1 border-1 border-[grey] rounded-md" @click="isPickerOn = !isPickerOn"> <button class="h-6 w-6 mt-2.7 ml-1 border-1 border-[grey] rounded-md" @click="isPickerOn = !isPickerOn">
<GeneralTooltip> <GeneralTooltip>
@ -98,14 +104,22 @@ watch(picked, (n, _o) => {
-webkit-text-stroke-width: 1px; -webkit-text-stroke-width: 1px;
-webkit-text-stroke-color: white; -webkit-text-stroke-color: white;
} }
.color-selector:hover { .color-selector:not(.new-design):hover {
filter: brightness(90%); filter: brightness(90%);
-webkit-filter: brightness(90%); -webkit-filter: brightness(90%);
} }
.color-selector.selected {
.color-selector.new-design:hover {
box-shadow: 0px 0px 0px 2px #fff, 0px 0px 0px 4px #3069fe;
}
.color-selector.selected:not(.new-design) {
filter: brightness(90%); filter: brightness(90%);
-webkit-filter: brightness(90%); -webkit-filter: brightness(90%);
} }
.color-selector.selected.new-design {
box-shadow: 0px 0px 0px 2px #fff, 0px 0px 0px 4px #3069fe;
}
:deep(.vc-chrome-toggle-icon) { :deep(.vc-chrome-toggle-icon) {
@apply ml-3!important; @apply ml-3!important;
} }

26
packages/nc-gui/components/smartsheet/Form.vue

@ -942,11 +942,33 @@ const onFormItemClick = (element: any) => {
<div class="text-base font-bold text-gray-900">Appearance Settings</div> <div class="text-base font-bold text-gray-900">Appearance Settings</div>
<div> <div>
<div class="text-gray-800 mb-2">Form Theme</div> <div class="text-gray-800">Form Theme</div>
<div class="flex justify-start"> <div class="flex justify-start">
<LazyGeneralColorPicker <LazyGeneralColorPicker
v-model="(formViewData.meta as Record<string,any>).theme_color" v-model="(formViewData.meta as Record<string,any>).theme_color"
:colors="['#FFFFF', '#FFDBD9', '#FEE6D6', '#FFF0D1', '#D4F7E0', '#D7F2FF', '#FFCFE6', '#E5D4F5']" :colors="[
'#FFFFFF',
'#FFDBD9',
'#FEE6D6',
'#FFF0D1',
'#D4F7E0',
'#D7F2FF',
'#FED8F4',
'#E5D4F5',
'#FFCFE6',
]"
:borders="[
'#6A7184',
'#FF4A3F',
'#FA8231',
'#FCBE3A',
'#27D665',
'#36BFFF',
'#FC3AC6',
'#7D26CD',
'#B33771',
]"
:is-new-design="true"
class="nc-form-theme-color-picker !p-0 !-ml-1" class="nc-form-theme-color-picker !p-0 !-ml-1"
@input="(el:string)=>{ @input="(el:string)=>{
(formViewData?.meta as Record<string,any>).theme_color = el (formViewData?.meta as Record<string,any>).theme_color = el

Loading…
Cancel
Save