|
|
|
@ -1,30 +1,25 @@
|
|
|
|
|
<script setup lang="ts"> |
|
|
|
|
import type { ColumnType } from 'nocodb-sdk' |
|
|
|
|
import { provide } from 'vue' |
|
|
|
|
import { computed, useColumn } from '#imports' |
|
|
|
|
import { useColumn, useVModel } from '#imports' |
|
|
|
|
import { ColumnInj } from '~/context' |
|
|
|
|
|
|
|
|
|
interface Props { |
|
|
|
|
column: ColumnType |
|
|
|
|
modelValue: any |
|
|
|
|
editEnabled: boolean |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const { column, modelValue: value, editEnabled } = defineProps<Props>() |
|
|
|
|
interface Emits { |
|
|
|
|
(event: 'update:modelValue', value: any): void |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const emit = defineEmits(['update:modelValue']) |
|
|
|
|
const { column, ...rest } = defineProps<Props>() |
|
|
|
|
|
|
|
|
|
provide(ColumnInj, column) |
|
|
|
|
const emit = defineEmits<Emits>() |
|
|
|
|
|
|
|
|
|
provide( |
|
|
|
|
'editEnabled', |
|
|
|
|
computed(() => editEnabled), |
|
|
|
|
) |
|
|
|
|
provide(ColumnInj, column) |
|
|
|
|
|
|
|
|
|
const localState = computed({ |
|
|
|
|
get: () => value, |
|
|
|
|
set: (val) => emit('update:modelValue', val), |
|
|
|
|
}) |
|
|
|
|
const vModel = useVModel(rest, 'modelValue', emit) |
|
|
|
|
|
|
|
|
|
const { |
|
|
|
|
isURL, |
|
|
|
@ -53,155 +48,27 @@ const {
|
|
|
|
|
|
|
|
|
|
<template> |
|
|
|
|
<div class="nc-cell" @keydown.stop.left @keydown.stop.right @keydown.stop.up @keydown.stop.down> |
|
|
|
|
<!-- |
|
|
|
|
todo : |
|
|
|
|
JSONCell |
|
|
|
|
--> |
|
|
|
|
|
|
|
|
|
<!-- <RatingCell --> |
|
|
|
|
<!-- v-if="isRating" --> |
|
|
|
|
<!-- /> --> |
|
|
|
|
<!-- v-model="localState" |
|
|
|
|
:active="active" |
|
|
|
|
:is-form="isForm" |
|
|
|
|
:column="column" |
|
|
|
|
:is-public-grid="isPublic && !isForm" |
|
|
|
|
:is-public-form="isPublic && isForm" |
|
|
|
|
:is-locked="isLocked" |
|
|
|
|
v-on="$listeners" |
|
|
|
|
/> --> |
|
|
|
|
|
|
|
|
|
<!-- <DurationCell --> |
|
|
|
|
<!-- v-else-if="isDuration" --> |
|
|
|
|
<!-- /> --> |
|
|
|
|
<!-- <!– v-model="localState" --> |
|
|
|
|
<!-- :active="active" --> |
|
|
|
|
<!-- :is-form="isForm" --> |
|
|
|
|
<!-- :column="column" --> |
|
|
|
|
<!-- :is-locked="isLocked" --> |
|
|
|
|
<!-- v-on="parentListeners" --> |
|
|
|
|
<!-- />–> --> |
|
|
|
|
|
|
|
|
|
<!-- <DatePickerCell --> |
|
|
|
|
<!-- v-else-if="isDate" --> |
|
|
|
|
<!-- /> --> |
|
|
|
|
<!-- <!– v-model="localState" --> |
|
|
|
|
<!-- v-on="parentListeners" --> |
|
|
|
|
<!-- />–> --> |
|
|
|
|
|
|
|
|
|
<!-- <TimePickerCell --> |
|
|
|
|
<!-- v-else-if="isTime" --> |
|
|
|
|
<!-- /> --> |
|
|
|
|
<!-- <!– v-model="localState" --> |
|
|
|
|
<!-- v-on="parentListeners" --> |
|
|
|
|
<!-- @save="$emit('save')" --> |
|
|
|
|
<!-- />–> --> |
|
|
|
|
|
|
|
|
|
<!-- <DateTimePickerCell --> |
|
|
|
|
<!-- v-else-if="isDateTime" --> |
|
|
|
|
<!-- /> --> |
|
|
|
|
<!-- <!– v-model="localState" --> |
|
|
|
|
<!-- ignore-focus --> |
|
|
|
|
<!-- v-on="parentListeners" --> |
|
|
|
|
<!-- />–> --> |
|
|
|
|
|
|
|
|
|
<!-- <EnumCell --> |
|
|
|
|
<!-- v-else-if="isEnum && ((!isForm && !active) || isLocked || (isPublic && !isForm))" --> |
|
|
|
|
<!-- /> --> |
|
|
|
|
<!-- <!– v-model="localState" --> |
|
|
|
|
<!-- :column="column" --> |
|
|
|
|
<!-- v-on="parentListeners" --> |
|
|
|
|
<!-- />–> --> |
|
|
|
|
<!-- <EnumListCell --> |
|
|
|
|
<!-- v-else-if="isEnum" --> |
|
|
|
|
<!-- /> --> |
|
|
|
|
<!-- <!– v-model="localState"–> --> |
|
|
|
|
<!-- <!– :is-form="isForm"–> --> |
|
|
|
|
<!-- <!– :column="column"–> --> |
|
|
|
|
<!-- <!– v-on="parentListeners"–> --> |
|
|
|
|
<!-- <!– />–> --> |
|
|
|
|
|
|
|
|
|
<!-- <JsonEditableCell --> |
|
|
|
|
<!-- v-else-if="isJSON" --> |
|
|
|
|
<!-- /> --> |
|
|
|
|
<!-- <!– v-model="localState" --> |
|
|
|
|
<!-- :is-form="isForm" --> |
|
|
|
|
<!-- v-on="parentListeners" --> |
|
|
|
|
<!-- @input="$emit('save')" --> |
|
|
|
|
<!-- />–> --> |
|
|
|
|
|
|
|
|
|
<!-- <SetListEditableCell --> |
|
|
|
|
<!-- v-else-if="isSet && (active || isForm) && !isLocked && !(isPublic && !isForm)" --> |
|
|
|
|
<!-- /> --> |
|
|
|
|
<!-- <!– v-model="localState" --> |
|
|
|
|
<!-- :column="column" --> |
|
|
|
|
<!-- v-on="parentListeners" --> |
|
|
|
|
<!-- />–> --> |
|
|
|
|
<!-- <SetListCell --> |
|
|
|
|
<!-- v-else-if="isSet" --> |
|
|
|
|
<!-- /> --> |
|
|
|
|
<!-- <!– v-model="localState" --> |
|
|
|
|
<!-- :column="column" --> |
|
|
|
|
<!-- v-on="parentListeners" --> |
|
|
|
|
<!-- />–> --> |
|
|
|
|
|
|
|
|
|
<!-- <UrlCell v-else-if="isURL" --> |
|
|
|
|
<!-- /> --> |
|
|
|
|
<!-- <!– v-model="localState" v-on="parentListeners" –> --> |
|
|
|
|
<!-- <!– />–> --> |
|
|
|
|
|
|
|
|
|
<CellTextArea v-if="isTextArea" v-model="localState" /> |
|
|
|
|
<!-- v-model="localState" |
|
|
|
|
:is-form="isForm" |
|
|
|
|
v-on="parentListeners" |
|
|
|
|
/> --> |
|
|
|
|
<CellCheckbox v-else-if="isBoolean" v-model="localState" /> |
|
|
|
|
<!-- <!– v-model="localState" --> |
|
|
|
|
<!-- :column="column" --> |
|
|
|
|
<!-- :is-form="isForm" --> |
|
|
|
|
<!-- v-on="parentListeners" --> |
|
|
|
|
<!-- />–> --> |
|
|
|
|
|
|
|
|
|
<CellAttachment v-else-if="isAttachment" v-model="localState" /> |
|
|
|
|
<CellSingleSelect v-else-if="isSingleSelect" v-model="localState" /> |
|
|
|
|
<CellMultiSelect v-else-if="isMultiSelect" v-model="localState" /> |
|
|
|
|
<CellDatePicker v-else-if="isDate" v-model="localState" /> |
|
|
|
|
<CellYearPicker v-else-if="isYear" v-model="localState" /> |
|
|
|
|
<CellDateTimePicker v-else-if="isDateTime" v-model="localState" /> |
|
|
|
|
<CellTimePicker v-else-if="isTime" v-model="localState" /> |
|
|
|
|
<CellRating v-else-if="isRating" v-model="localState" /> |
|
|
|
|
<!-- v-model="localState" |
|
|
|
|
:active="active" |
|
|
|
|
:db-alias="dbAlias" |
|
|
|
|
:meta="meta" |
|
|
|
|
:is-form="isForm" |
|
|
|
|
:column="column" |
|
|
|
|
:is-public-grid="isPublic && !isForm" |
|
|
|
|
:is-public-form="isPublic && isForm" |
|
|
|
|
:view-id="viewId" |
|
|
|
|
:is-locked="isLocked" |
|
|
|
|
v-on="$listeners" |
|
|
|
|
/> --> |
|
|
|
|
<CellDuration v-else-if="isDuration" v-model="localState" /> |
|
|
|
|
<CellEmail v-else-if="isEmail" v-model="localState" /> |
|
|
|
|
<CellUrl v-else-if="isURL" v-model="localState" /> |
|
|
|
|
<CellPhoneNumber v-else-if="isPhoneNumber" v-model="localState" /> |
|
|
|
|
<!-- v-on="parentListeners" |
|
|
|
|
/> |
|
|
|
|
--> |
|
|
|
|
<CellCurrency v-else-if="isCurrency" v-model="localState" /> |
|
|
|
|
<CellDecimal v-else-if="isDecimal" v-model="localState" /> |
|
|
|
|
<CellInteger v-else-if="isInt" v-model="localState" /> |
|
|
|
|
<CellFloat v-else-if="isFloat" v-model="localState" /> |
|
|
|
|
<CellText v-else-if="isString" v-model="localState" /> |
|
|
|
|
<!-- v-on="parentListeners" |
|
|
|
|
/> |
|
|
|
|
--> |
|
|
|
|
<CellPercent v-else-if="isPercent" v-model="localState" /> |
|
|
|
|
<CellText v-else v-model="localState" /> |
|
|
|
|
<!-- v-on="$listeners" <span v-if="hint" class="nc-hint">{{ hint }}</span> --> |
|
|
|
|
|
|
|
|
|
<!-- <div v-if="(isLocked || (isPublic && !isForm)) && !isAttachment" class="nc-locked-overlay" /> --> |
|
|
|
|
<CellTextArea v-if="isTextArea" v-model="vModel" /> |
|
|
|
|
<CellCheckbox v-else-if="isBoolean" v-model="vModel" /> |
|
|
|
|
<CellAttachment v-else-if="isAttachment" v-model="vModel" /> |
|
|
|
|
<CellSingleSelect v-else-if="isSingleSelect" v-model="vModel" /> |
|
|
|
|
<CellMultiSelect v-else-if="isMultiSelect" v-model="vModel" /> |
|
|
|
|
<CellDatePicker v-else-if="isDate" v-model="vModel" /> |
|
|
|
|
<CellYearPicker v-else-if="isYear" v-model="vModel" /> |
|
|
|
|
<CellDateTimePicker v-else-if="isDateTime" v-model="vModel" /> |
|
|
|
|
<CellTimePicker v-else-if="isTime" v-model="vModel" /> |
|
|
|
|
<CellRating v-else-if="isRating" v-model="vModel" /> |
|
|
|
|
<CellDuration v-else-if="isDuration" v-model="vModel" /> |
|
|
|
|
<CellEmail v-else-if="isEmail" v-model="vModel" /> |
|
|
|
|
<CellUrl v-else-if="isURL" v-model="vModel" /> |
|
|
|
|
<CellPhoneNumber v-else-if="isPhoneNumber" v-model="vModel" /> |
|
|
|
|
<CellCurrency v-else-if="isCurrency" v-model="vModel" /> |
|
|
|
|
<CellDecimal v-else-if="isDecimal" v-model="vModel" /> |
|
|
|
|
<CellInteger v-else-if="isInt" v-model="vModel" /> |
|
|
|
|
<CellFloat v-else-if="isFloat" v-model="vModel" /> |
|
|
|
|
<CellText v-else-if="isString" v-model="vModel" /> |
|
|
|
|
<CellPercent v-else-if="isPercent" v-model="vModel" /> |
|
|
|
|
<CellText v-else v-model="vModel" /> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|