Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

fix(nc-gui): keep input readonly in mobile mode if field cell has picker like date time related fields

Ramesh Manefc75108d9d59
diff --git a/packages/nc-gui/components/cell/Date/Editor.vue b/packages/nc-gui/components/cell/Date/Editor.vue
index f20f99b29f..373baacf32 100644
--- a/packages/nc-gui/components/cell/Date/Editor.vue
+++ b/packages/nc-gui/components/cell/Date/Editor.vue
@@ -15,7 +15,7 @@ const emit = defineEmits(['update:modelValue', 'currentDate'])
const { t } = useI18n()
-const { showNull } = useGlobal()
+const { showNull, isMobileMode } = useGlobal()
const columnMeta = inject(ColumnInj, null)!
@@ -370,7 +370,7 @@ onMounted(() => {
:value="localState?.format(dateFormat) ?? ''"
:placeholder="placeholder"
class="nc-date-input border-none outline-none !text-current bg-transparent !focus:(border-none outline-none ring-transparent)"
- :readonly="readOnly"
+ :readonly="readOnly || !!isMobileMode"
@blur="onBlur"
@focus="onFocus"
@keydown="handleKeydown($event, open)"
diff --git a/packages/nc-gui/components/cell/DateTime/Editor.vue b/packages/nc-gui/components/cell/DateTime/Editor.vue
index 504df84cc9..da9dddb3ba 100644
--- a/packages/nc-gui/components/cell/DateTime/Editor.vue
+++ b/packages/nc-gui/components/cell/DateTime/Editor.vue
@@ -15,7 +15,7 @@ interface Props {
const { isXcdbBase } = useBase()
-const { showNull } = useGlobal()
+const { showNull, isMobileMode } = useGlobal()
const readOnly = inject(ReadonlyInj, ref(false))
@@ -523,7 +523,7 @@ const minimizeMaxWidth = computed(() => {
:value="localState?.format(dateFormat) ?? ''"
:placeholder="typeof placeholder === 'string' ? placeholder : placeholder?.date"
class="nc-date-input w-full !truncate border-transparent outline-none !text-current !bg-transparent !focus:(border-none ring-transparent)"
- :readonly="isColDisabled"
+ :readonly="isColDisabled || !!isMobileMode"
@focus="onFocus(true)"
@blur="onBlur($event, true)"
@keydown="handleKeydown($event, isOpen, true)"
@@ -553,7 +553,7 @@ const minimizeMaxWidth = computed(() => {
:value="cellValue"
:placeholder="typeof placeholder === 'string' ? placeholder : placeholder?.time"
class="nc-time-input w-full !truncate border-transparent outline-none !text-current !bg-transparent !focus:(border-none ring-transparent)"
- :readonly="isColDisabled"
+ :readonly="isColDisabled || !!isMobileMode"
@focus="onFocus(false)"
@blur="onBlur($event, false)"
@keydown="handleKeydown($event, open)"
diff --git a/packages/nc-gui/components/cell/Time/Editor.vue b/packages/nc-gui/components/cell/Time/Editor.vue
index 10df4aea01..61d185600e 100644
--- a/packages/nc-gui/components/cell/Time/Editor.vue
+++ b/packages/nc-gui/components/cell/Time/Editor.vue
@@ -13,7 +13,7 @@ const emit = defineEmits(['update:modelValue'])
const { isMysql } = useBase()
-const { showNull } = useGlobal()
+const { showNull, isMobileMode } = useGlobal()
const readOnly = inject(ReadonlyInj, ref(false))
@@ -368,7 +368,7 @@ onMounted(() => {
:value="cellValue"
:placeholder="placeholder"
class="nc-time-input border-none outline-none !text-current bg-transparent !focus:(border-none outline-none ring-transparent)"
- :readonly="readOnly"
+ :readonly="readOnly || !!isMobileMode"
@blur="onBlur"
@focus="onFocus"
@keydown="handleKeydown($event, isOpen)"
diff --git a/packages/nc-gui/components/cell/Year/Editor.vue b/packages/nc-gui/components/cell/Year/Editor.vue
index f65999f110..a3dd8cb0cb 100644
--- a/packages/nc-gui/components/cell/Year/Editor.vue
+++ b/packages/nc-gui/components/cell/Year/Editor.vue
@@ -13,7 +13,7 @@ const emit = defineEmits(['update:modelValue'])
const canvasSelectCell = inject(CanvasSelectCellInj, null)
-const { showNull } = useGlobal()
+const { showNull, isMobileMode } = useGlobal()
const column = inject(ColumnInj, null)!
@@ -318,7 +318,7 @@ onMounted(() => {
:value="localState?.format('YYYY') ?? ''"
:placeholder="placeholder"
class="nc-year-input border-none outline-none !text-current bg-transparent !focus:(border-none outline-none ring-transparent)"
- :readonly="readOnly"
+ :readonly="readOnly || !!isMobileMode"
@blur="onBlur"
@keydown="handleKeydown($event, open)"
@mouseup.stop