Browse Source

fix(nc-gui): cell styles

pull/3563/head
Wing-Kam Wong 2 years ago
parent
commit
07f525b900
  1. 4
      packages/nc-gui/components/cell/Checkbox.vue
  2. 2
      packages/nc-gui/components/cell/Currency.vue
  3. 2
      packages/nc-gui/components/cell/DatePicker.vue
  4. 2
      packages/nc-gui/components/cell/DateTimePicker.vue
  5. 2
      packages/nc-gui/components/cell/Decimal.vue
  6. 10
      packages/nc-gui/components/cell/Duration.vue
  7. 2
      packages/nc-gui/components/cell/Email.vue
  8. 1
      packages/nc-gui/components/cell/MultiSelect.vue
  9. 9
      packages/nc-gui/components/cell/Percent.vue
  10. 8
      packages/nc-gui/components/cell/Rating.vue
  11. 3
      packages/nc-gui/components/cell/SingleSelect.vue
  12. 1
      packages/nc-gui/components/cell/Text.vue
  13. 3
      packages/nc-gui/components/cell/TextArea.vue
  14. 2
      packages/nc-gui/components/cell/TimePicker.vue
  15. 8
      packages/nc-gui/components/cell/Url.vue
  16. 2
      packages/nc-gui/components/cell/YearPicker.vue
  17. 5
      packages/nc-gui/components/smartsheet/Kanban.vue

4
packages/nc-gui/components/cell/Checkbox.vue

@ -48,14 +48,14 @@ function onClick() {
<div <div
class="flex" class="flex"
:class="{ :class="{
'justify-center': !isForm, 'justify-center': !isForm && !readOnly,
'w-full': isForm, 'w-full': isForm,
'nc-cell-hover-show': !vModel && !readOnly, 'nc-cell-hover-show': !vModel && !readOnly,
'opacity-0': readOnly && !vModel, 'opacity-0': readOnly && !vModel,
}" }"
@click="onClick" @click="onClick"
> >
<div class="px-1 pt-1 rounded-full items-center" :class="{ 'bg-gray-100': !vModel }"> <div class="px-1 pt-1 rounded-full items-center" :class="{ 'bg-gray-100': !vModel, '!ml-[-8px]': readOnly }">
<component <component
:is="getMdiIcon(vModel ? checkboxMeta.icon.checked : checkboxMeta.icon.unchecked)" :is="getMdiIcon(vModel ? checkboxMeta.icon.checked : checkboxMeta.icon.unchecked)"
:style="{ :style="{

2
packages/nc-gui/components/cell/Currency.vue

@ -45,7 +45,7 @@ const focus: VNodeRef = (el) => (el as HTMLInputElement)?.focus()
v-if="editEnabled" v-if="editEnabled"
:ref="focus" :ref="focus"
v-model="vModel" v-model="vModel"
class="w-full h-full border-none outline-none" class="w-full h-full border-none outline-none px-2"
@blur="editEnabled = false" @blur="editEnabled = false"
/> />

2
packages/nc-gui/components/cell/DatePicker.vue

@ -62,7 +62,7 @@ const placeholder = computed(() => (isDateInvalid ? 'Invalid date' : ''))
<a-date-picker <a-date-picker
v-model:value="localState" v-model:value="localState"
:bordered="false" :bordered="false"
class="!w-full px-1" class="!w-full !px-0 !border-none"
:format="dateFormat" :format="dateFormat"
:placeholder="placeholder" :placeholder="placeholder"
:allow-clear="!readOnly" :allow-clear="!readOnly"

2
packages/nc-gui/components/cell/DateTimePicker.vue

@ -62,7 +62,7 @@ watch(
v-model:value="localState" v-model:value="localState"
:show-time="true" :show-time="true"
:bordered="false" :bordered="false"
class="!w-full px-1" class="!w-full !px-0 !border-none"
format="YYYY-MM-DD HH:mm" format="YYYY-MM-DD HH:mm"
:placeholder="isDateInvalid ? 'Invalid date' : ''" :placeholder="isDateInvalid ? 'Invalid date' : ''"
:allow-clear="!readOnly" :allow-clear="!readOnly"

2
packages/nc-gui/components/cell/Decimal.vue

@ -26,7 +26,7 @@ const focus: VNodeRef = (el) => (el as HTMLInputElement)?.focus()
v-if="editEnabled" v-if="editEnabled"
:ref="focus" :ref="focus"
v-model="vModel" v-model="vModel"
class="outline-none p-0 border-none w-full h-full text-sm" class="outline-none px-2 border-none w-full h-full text-sm"
type="number" type="number"
step="0.1" step="0.1"
@blur="editEnabled = false" @blur="editEnabled = false"

10
packages/nc-gui/components/cell/Duration.vue

@ -75,6 +75,8 @@ const submitDuration = () => {
v-if="editEnabled" v-if="editEnabled"
ref="durationInput" ref="durationInput"
v-model="localState" v-model="localState"
class="w-full !border-none p-0"
:class="{ '!p-2': editEnabled }"
:placeholder="durationPlaceholder" :placeholder="durationPlaceholder"
@blur="submitDuration" @blur="submitDuration"
@keypress="checkDurationFormat($event)" @keypress="checkDurationFormat($event)"
@ -91,14 +93,8 @@ const submitDuration = () => {
</template> </template>
<style scoped> <style scoped>
.duration-cell-wrapper {
padding: 10px;
}
.duration-warning { .duration-warning {
text-align: left; @apply text-left mt-[10px] text-[#e65100];
margin-top: 10px;
color: #e65100;
} }
</style> </style>

2
packages/nc-gui/components/cell/Email.vue

@ -24,7 +24,7 @@ const focus: VNodeRef = (el) => (el as HTMLInputElement)?.focus()
</script> </script>
<template> <template>
<input v-if="editEnabled" :ref="focus" v-model="vModel" class="outline-none text-sm" @blur="editEnabled = false" /> <input v-if="editEnabled" :ref="focus" v-model="vModel" class="outline-none text-sm px-2" @blur="editEnabled = false" />
<a v-else-if="validEmail" class="text-sm underline hover:opacity-75" :href="`mailto:${vModel}`" target="_blank"> <a v-else-if="validEmail" class="text-sm underline hover:opacity-75" :href="`mailto:${vModel}`" target="_blank">
{{ vModel }} {{ vModel }}

1
packages/nc-gui/components/cell/MultiSelect.vue

@ -137,6 +137,7 @@ watch(isOpen, (n, _o) => {
:show-search="false" :show-search="false"
:open="isOpen" :open="isOpen"
:disabled="readOnly" :disabled="readOnly"
:class="{ '!ml-[-8px]': readOnly }"
dropdown-class-name="nc-dropdown-multi-select-cell" dropdown-class-name="nc-dropdown-multi-select-cell"
@keydown="handleKeys" @keydown="handleKeys"
@click="isOpen = !isOpen" @click="isOpen = !isOpen"

9
packages/nc-gui/components/cell/Percent.vue

@ -15,7 +15,12 @@ const vModel = useVModel(props, 'modelValue', emits)
</script> </script>
<template> <template>
<input v-if="editEnabled" v-model="vModel" type="number" /> <input
v-if="editEnabled"
v-model="vModel"
class="w-full !border-none text-base"
:class="{ '!p-2': editEnabled }"
type="number"
/>
<span v-else>{{ vModel }}</span> <span v-else>{{ vModel }}</span>
</template> </template>

8
packages/nc-gui/components/cell/Rating.vue

@ -32,7 +32,13 @@ const vModel = computed({
</script> </script>
<template> <template>
<a-rate v-model:value="vModel" :count="ratingMeta.max" :style="`color: ${ratingMeta.color}`" :disabled="!editEnabled"> <a-rate
v-model:value="vModel"
:count="ratingMeta.max"
:style="`color: ${ratingMeta.color}; padding: 0px 5px`"
:class="{ '!ml-[-8px]': !editEnabled }"
:disabled="!editEnabled"
>
<template #character> <template #character>
<MdiStar v-if="ratingMeta.icon.full === 'mdi-star'" class="text-sm" /> <MdiStar v-if="ratingMeta.icon.full === 'mdi-star'" class="text-sm" />
<MdiHeart v-if="ratingMeta.icon.full === 'mdi-heart'" class="text-sm" /> <MdiHeart v-if="ratingMeta.icon.full === 'mdi-heart'" class="text-sm" />

3
packages/nc-gui/components/cell/SingleSelect.vue

@ -69,12 +69,13 @@ watch(isOpen, (n, _o) => {
<a-select <a-select
ref="aselect" ref="aselect"
v-model:value="vModel" v-model:value="vModel"
class="w-full" class="w-full 2"
:allow-clear="!column.rqd && active" :allow-clear="!column.rqd && active"
:bordered="false" :bordered="false"
:open="isOpen" :open="isOpen"
:disabled="readOnly" :disabled="readOnly"
:show-arrow="!readOnly && (active || vModel === null)" :show-arrow="!readOnly && (active || vModel === null)"
:class="{ '!ml-[-12px]': readOnly }"
dropdown-class-name="nc-dropdown-single-select-cell" dropdown-class-name="nc-dropdown-single-select-cell"
@select="isOpen = false" @select="isOpen = false"
@keydown="handleKeys" @keydown="handleKeys"

1
packages/nc-gui/components/cell/Text.vue

@ -23,6 +23,7 @@ const focus: VNodeRef = (el) => (el as HTMLInputElement)?.focus()
:ref="focus" :ref="focus"
v-model="vModel" v-model="vModel"
class="h-full w-full outline-none bg-transparent" class="h-full w-full outline-none bg-transparent"
:class="{ '!p-2': editEnabled }"
@blur="editEnabled = false" @blur="editEnabled = false"
/> />

3
packages/nc-gui/components/cell/TextArea.vue

@ -21,7 +21,8 @@ const focus: VNodeRef = (el) => (el as HTMLTextAreaElement)?.focus()
:ref="focus" :ref="focus"
v-model="vModel" v-model="vModel"
rows="4" rows="4"
class="h-full w-full min-h-[60px] outline-none" class="h-full w-full min-h-[60px] outline-none border-none"
:class="{ 'p-2': editEnabled }"
@blur="editEnabled = false" @blur="editEnabled = false"
@keydown.alt.enter.stop @keydown.alt.enter.stop
@keydown.shift.enter.stop @keydown.shift.enter.stop

2
packages/nc-gui/components/cell/TimePicker.vue

@ -74,7 +74,7 @@ watch(
:bordered="false" :bordered="false"
use12-hours use12-hours
format="HH:mm" format="HH:mm"
class="!w-full px-1" class="!w-full !px-0 !border-none"
:placeholder="isTimeInvalid ? 'Invalid time' : ''" :placeholder="isTimeInvalid ? 'Invalid time' : ''"
:allow-clear="!readOnly" :allow-clear="!readOnly"
:input-read-only="true" :input-read-only="true"

8
packages/nc-gui/components/cell/Url.vue

@ -73,7 +73,13 @@ watch(
<template> <template>
<div class="flex flex-row items-center justify-between"> <div class="flex flex-row items-center justify-between">
<input v-if="editEnabled" :ref="focus" v-model="vModel" class="outline-none text-sm w-full" @blur="editEnabled = false" /> <input
v-if="editEnabled"
:ref="focus"
v-model="vModel"
class="outline-none text-sm w-full px-2"
@blur="editEnabled = false"
/>
<nuxt-link <nuxt-link
v-else-if="isValid && !cellUrlOptions?.overlay" v-else-if="isValid && !cellUrlOptions?.overlay"

2
packages/nc-gui/components/cell/YearPicker.vue

@ -61,7 +61,7 @@ const placeholder = computed(() => (isYearInvalid ? 'Invalid year' : ''))
v-model:value="localState" v-model:value="localState"
picker="year" picker="year"
:bordered="false" :bordered="false"
class="!w-full px-1" class="!w-full !px-0 !border-none"
:placeholder="placeholder" :placeholder="placeholder"
:allow-clear="!readOnly" :allow-clear="!readOnly"
:input-read-only="true" :input-read-only="true"

5
packages/nc-gui/components/smartsheet/Kanban.vue

@ -1,6 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import Draggable from 'vuedraggable' import Draggable from 'vuedraggable'
import { UITypes, isVirtualCol } from 'nocodb-sdk' import { isVirtualCol } from 'nocodb-sdk'
import { import {
ActiveViewInj, ActiveViewInj,
FieldsInj, FieldsInj,
@ -380,8 +380,7 @@ watch(
<!-- Smartsheet (Virtual) Cell --> <!-- Smartsheet (Virtual) Cell -->
<div <div
v-if="!isRowEmpty(record, col)" v-if="!isRowEmpty(record, col)"
class="flex flex-row w-full items-center justify-start" class="flex flex-row w-full items-center justify-start pl-[6px]"
:class="{ 'pt- pl-2': col.uidt !== UITypes.SingleSelect }"
> >
<LazySmartsheetVirtualCell <LazySmartsheetVirtualCell
v-if="isVirtualCol(col)" v-if="isVirtualCol(col)"

Loading…
Cancel
Save