Browse Source

fix(nc-gui): remove optional chaining from base color picker

pull/7807/head
Ramesh Mane 10 months ago
parent
commit
e196756381
  1. 24
      packages/nc-gui/components/general/BaseColorPicker.vue

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

@ -53,7 +53,7 @@ const onClick = (e: Event) => {
watch(
isOpenHuePicker,
() => {
if (!isOpenHuePicker.value && colorRef.value?.h !== hue) {
if (!isOpenHuePicker.value && colorRef.value.h !== hue) {
if (hue !== 0 && !hue) {
colorRef.value.h = defaultHueValue
} else {
@ -81,7 +81,7 @@ watch(
}"
@click.stop="onClick"
>
<template v-if="hue !== 0 && !hue">
<template v-if="hue !== 0 && !hue && colorRef.h === defaultHueValue">
<slot name="default" />
</template>
<template v-else>
@ -104,11 +104,11 @@ watch(
d="M638.951 291.265L936.342 462.949C966.129 480.145 980.256 502.958 978.723 525.482V774.266C980.256 796.789 966.129 819.602 936.342 836.798L638.951 1008.48C582.292 1041.19 490.431 1041.19 433.773 1008.48L136.381 836.798C106.595 819.602 92.4675 796.789 93.9999 774.266L93.9999 525.482C92.4675 502.957 106.595 480.145 136.381 462.949L433.773 291.265C490.431 258.556 582.292 258.556 638.951 291.265Z"
:fill="
tinycolor(
preDefinedHueData && preDefinedHueData[`_${colorRef?.h}`]
? `hsv(${preDefinedHueData[`_${colorRef?.h}`].shade.h},${preDefinedHueData[`_${colorRef?.h}`].shade.s}%, ${
preDefinedHueData[`_${colorRef?.h}`].shade.v
preDefinedHueData && preDefinedHueData[`_${colorRef.h}`]
? `hsv(${preDefinedHueData[`_${colorRef.h}`].shade.h},${preDefinedHueData[`_${colorRef.h}`].shade.s}%, ${
preDefinedHueData[`_${colorRef.h}`].shade.v
}%)`
: `hsv(${colorRef?.h ?? defaultHueValue}, 100%, 30%)`,
: `hsv(${colorRef.h ?? defaultHueValue}, 100%, 30%)`,
).toHexString()
"
/>
@ -118,11 +118,11 @@ watch(
d="M638.951 65.0055L936.342 236.69C966.129 253.886 980.256 276.699 978.723 299.222V548.006C980.256 570.529 966.129 593.343 936.342 610.538L638.951 782.223C582.292 814.931 490.431 814.931 433.773 782.223L136.381 610.538C106.595 593.343 92.4675 570.529 93.9999 548.006L93.9999 299.222C92.4675 276.699 106.595 253.886 136.381 236.69L433.773 65.0055C490.431 32.2968 582.292 32.2968 638.951 65.0055Z"
:fill="
tinycolor(
preDefinedHueData && preDefinedHueData[`_${colorRef?.h}`]
? `hsv(${preDefinedHueData[`_${colorRef?.h}`].tint.h},${preDefinedHueData[`_${colorRef?.h}`].tint.s}%, ${
preDefinedHueData[`_${colorRef?.h}`].tint.v
preDefinedHueData && preDefinedHueData[`_${colorRef.h}`]
? `hsv(${preDefinedHueData[`_${colorRef.h}`].tint.h},${preDefinedHueData[`_${colorRef.h}`].tint.s}%, ${
preDefinedHueData[`_${colorRef.h}`].tint.v
}%)`
: `hsv(${colorRef?.h ?? defaultHueValue}, 30%, 100%)`,
: `hsv(${colorRef.h ?? defaultHueValue}, 30%, 100%)`,
).toHexString()
"
/>
@ -187,7 +187,7 @@ watch(
class="nc-hue-color-picker"
:style="{
['--nc-hue-slider-pointer-color']: tinycolor(
`hsv(${colorRef?.h ?? defaultHueValue}, 100%, 100%)`,
`hsv(${colorRef.h ?? defaultHueValue}, 100%, 100%)`,
).toHexString(),
}"
@update:model-value="
@ -200,7 +200,7 @@ watch(
/>
<div class="flex items-center justify-end">
<NcButton type="secondary" size="small" @click="selectColor(colorRef?.h ?? defaultHueValue)">
<NcButton type="secondary" size="small" @click="selectColor(colorRef.h ?? defaultHueValue)">
{{ $t('general.apply') }}
</NcButton>
</div>

Loading…
Cancel
Save