|
|
@ -1,9 +1,9 @@ |
|
|
|
<script setup lang="ts"> |
|
|
|
<script setup lang="ts"> |
|
|
|
import { UITypes } from 'nocodb-sdk' |
|
|
|
import { UITypes } from 'nocodb-sdk' |
|
|
|
import type { ColumnType } from 'nocodb-sdk' |
|
|
|
import type { ColumnType } from 'nocodb-sdk' |
|
|
|
import { provide } from 'vue' |
|
|
|
import { provide, toRef } from 'vue' |
|
|
|
import { computed, useColumn, useDebounceFn, useVModel } from '#imports' |
|
|
|
import { computed, useColumn, useDebounceFn, useVModel } from '#imports' |
|
|
|
import { ColumnInj } from '~/context' |
|
|
|
import { ColumnInj, EditModeInj } from '~/context' |
|
|
|
|
|
|
|
|
|
|
|
interface Props { |
|
|
|
interface Props { |
|
|
|
column: ColumnType |
|
|
|
column: ColumnType |
|
|
@ -15,19 +15,18 @@ interface Emits { |
|
|
|
(event: 'update:modelValue', value: any): void |
|
|
|
(event: 'update:modelValue', value: any): void |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const { column, editEnabled, ...rest } = defineProps<Props>() |
|
|
|
const { column, ...props } = defineProps<Props>() |
|
|
|
|
|
|
|
|
|
|
|
const emit = defineEmits(['update:modelValue', 'save']) |
|
|
|
const emit = defineEmits(['update:modelValue', 'save']) |
|
|
|
|
|
|
|
|
|
|
|
provide(ColumnInj, column) |
|
|
|
provide(ColumnInj, column) |
|
|
|
|
|
|
|
|
|
|
|
provide( |
|
|
|
|
|
|
|
'editEnabled', |
|
|
|
provide(EditModeInj, toRef(props, 'editEnabled')) |
|
|
|
computed(() => editEnabled), |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let changed = $ref(false) |
|
|
|
let changed = $ref(false) |
|
|
|
const syncValue = useDebounceFn(function () { |
|
|
|
const syncValue = useDebounceFn(function() { |
|
|
|
emit('save') |
|
|
|
emit('save') |
|
|
|
}, 1000) |
|
|
|
}, 1000) |
|
|
|
|
|
|
|
|
|
|
@ -53,9 +52,9 @@ const isManualSaved = $computed(() => { |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
const vModel = computed({ |
|
|
|
const vModel = computed({ |
|
|
|
get: () => rest.modelValue, |
|
|
|
get: () => props.modelValue, |
|
|
|
set: (val) => { |
|
|
|
set: (val) => { |
|
|
|
if (val !== rest.modelValue) { |
|
|
|
if (val !== props.modelValue) { |
|
|
|
changed = true |
|
|
|
changed = true |
|
|
|
emit('update:modelValue', val) |
|
|
|
emit('update:modelValue', val) |
|
|
|
if (isAutoSaved) { |
|
|
|
if (isAutoSaved) { |
|
|
|