Browse Source

fix(gui-v2): disable primary value color on lookup

Signed-off-by: mertmit <mertmit99@gmail.com>
pull/3213/head
mertmit 2 years ago
parent
commit
d95d935391
  1. 10
      packages/nc-gui-v2/components/smartsheet/Cell.vue
  2. 2
      packages/nc-gui-v2/components/virtual-cell/Lookup.vue
  3. 4
      packages/nc-gui-v2/composables/useColumn.ts

10
packages/nc-gui-v2/components/smartsheet/Cell.vue

@ -10,6 +10,7 @@ interface Props {
editEnabled: boolean editEnabled: boolean
rowIndex?: number rowIndex?: number
active?: boolean active?: boolean
virtual?: boolean
} }
const props = defineProps<Props>() const props = defineProps<Props>()
@ -20,6 +21,8 @@ const column = toRef(props, 'column')
const active = toRef(props, 'active', false) const active = toRef(props, 'active', false)
const virtual = toRef(props, 'virtual', false)
provide(ColumnInj, column) provide(ColumnInj, column)
provide(EditModeInj, useVModel(props, 'editEnabled', emit)) provide(EditModeInj, useVModel(props, 'editEnabled', emit))
@ -54,10 +57,6 @@ const isManualSaved = $computed(() => {
return [UITypes.Currency, UITypes.Duration].includes(column?.value?.uidt as UITypes) return [UITypes.Currency, UITypes.Duration].includes(column?.value?.uidt as UITypes)
}) })
const isPrimary = computed(() => {
return column?.value?.pv
})
const vModel = computed({ const vModel = computed({
get: () => props.modelValue, get: () => props.modelValue,
set: (val) => { set: (val) => {
@ -75,6 +74,7 @@ const vModel = computed({
}) })
const { const {
isPrimary,
isURL, isURL,
isEmail, isEmail,
isJSON, isJSON,
@ -112,7 +112,7 @@ const syncAndNavigate = (dir: NavigateDir) => {
<template> <template>
<div <div
class="nc-cell w-full h-full" class="nc-cell w-full h-full"
:class="{ 'text-blue-600': isPrimary }" :class="{ 'text-blue-600': isPrimary && !virtual }"
@keydown.stop.left @keydown.stop.left
@keydown.stop.right @keydown.stop.right
@keydown.stop.up @keydown.stop.up

2
packages/nc-gui-v2/components/virtual-cell/Lookup.vue

@ -64,7 +64,7 @@ const lookupColumnMetaProps = useColumn(lookupColumn)
:key="i" :key="i"
:class="{ 'bg-gray-100 px-2 rounded-full': !lookupColumnMetaProps.isAttachment }" :class="{ 'bg-gray-100 px-2 rounded-full': !lookupColumnMetaProps.isAttachment }"
> >
<SmartsheetCell :model-value="v" :column="lookupColumn" :edit-enabled="false" /> <SmartsheetCell :model-value="v" :column="lookupColumn" :edit-enabled="false" :virtual="true" />
</div> </div>
</template> </template>
</template> </template>

4
packages/nc-gui-v2/composables/useColumn.ts

@ -56,10 +56,14 @@ export function useColumn(column: Ref<ColumnType>) {
const isManualSaved = computed(() => const isManualSaved = computed(() =>
[UITypes.Currency, UITypes.Year, UITypes.Time, UITypes.Duration].includes(uiDatatype.value), [UITypes.Currency, UITypes.Year, UITypes.Time, UITypes.Duration].includes(uiDatatype.value),
) )
const isPrimary = computed(() => {
return column?.value?.pv
})
return { return {
abstractType, abstractType,
dataTypeLow, dataTypeLow,
isPrimary,
isBoolean, isBoolean,
isString, isString,
isTextArea, isTextArea,

Loading…
Cancel
Save