mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
125 lines
3.2 KiB
125 lines
3.2 KiB
2 years ago
|
<script lang="ts" setup>
|
||
2 years ago
|
import { computed } from '@vue/reactivity'
|
||
|
import type { ColumnType } from 'nocodb-sdk'
|
||
|
import { Ref, inject } from 'vue'
|
||
|
const { modelValue } = defineProps<{ modelValue: any }>()
|
||
|
const emit = defineEmits(['update:modelValue'])
|
||
|
// import {enumColor}from "~/utils/colorsUtils";
|
||
2 years ago
|
|
||
2 years ago
|
const column = inject<ColumnType>('column')
|
||
|
const isForm = inject<boolean>('isForm')
|
||
|
const editEnabled = inject<boolean>('editEnabled')
|
||
2 years ago
|
|
||
|
const localState = computed({
|
||
|
get() {
|
||
2 years ago
|
return modelValue?.replace(/\\'/g, "'").replace(/^'|'$/g, '')
|
||
2 years ago
|
},
|
||
|
set(val) {
|
||
2 years ago
|
emit('update:modelValue', val)
|
||
|
},
|
||
|
})
|
||
2 years ago
|
|
||
|
const options = computed<string[]>(() => {
|
||
2 years ago
|
return column?.dtxp?.split(',').map((v) => v.replace(/\\'/g, "'").replace(/^'|'$/g, '')) || []
|
||
|
})
|
||
2 years ago
|
|
||
2 years ago
|
/* import colors from '@/mixins/colors'
|
||
2 years ago
|
|
||
|
export default {
|
||
|
name: 'EnumListEditableCell',
|
||
|
mixins: [colors],
|
||
|
|
||
|
props: {
|
||
|
value: String,
|
||
|
column: Object,
|
||
2 years ago
|
isForm: Boolean,
|
||
2 years ago
|
},
|
||
|
computed: {
|
||
|
parentListeners() {
|
||
|
const $listeners = {}
|
||
|
|
||
|
if (this.$listeners.blur) {
|
||
|
$listeners.blur = this.$listeners.blur
|
||
|
}
|
||
|
if (this.$listeners.focus) {
|
||
|
$listeners.focus = this.$listeners.focus
|
||
|
}
|
||
|
|
||
|
return $listeners
|
||
2 years ago
|
},
|
||
2 years ago
|
},
|
||
2 years ago
|
} */
|
||
2 years ago
|
</script>
|
||
|
|
||
2 years ago
|
<template>
|
||
2 years ago
|
<v-select v-model="localState" :items="options" hide-details :clearable="!column.rqd" variation="outlined">
|
||
|
<!-- v-on="parentListeners"
|
||
2 years ago
|
<template #selection="{ item }">
|
||
|
<div
|
||
|
class="d-100"
|
||
|
:class="{
|
||
|
'text-center': !isForm,
|
||
|
}"
|
||
|
>
|
||
2 years ago
|
<v-chip small :color="enumColor.light[options.indexOf(item) % enumColor.light.length]" class="ma-1">
|
||
|
{{ item.text }}
|
||
2 years ago
|
</v-chip>
|
||
|
</div>
|
||
|
</template>
|
||
|
<template #item="{ item }">
|
||
2 years ago
|
<v-chip small :color="enumColor.light[options.indexOf(item) % enumColor.light.length]">
|
||
2 years ago
|
{{ item }}
|
||
|
</v-chip>
|
||
|
</template>
|
||
|
<template #append>
|
||
2 years ago
|
<v-icon small class="mt-1"> mdi-menu-down</v-icon>
|
||
2 years ago
|
</template> -->
|
||
2 years ago
|
</v-select>
|
||
|
</template>
|
||
|
|
||
2 years ago
|
<style scoped lang="scss">
|
||
2 years ago
|
/*:deep {
|
||
2 years ago
|
.v-select {
|
||
|
min-width: 150px;
|
||
|
}
|
||
2 years ago
|
|
||
2 years ago
|
.v-input__slot {
|
||
2 years ago
|
padding-right: 0 !important;
|
||
|
padding-left: 35px !important;
|
||
|
}
|
||
2 years ago
|
|
||
2 years ago
|
.v-input__icon.v-input__icon--clear {
|
||
|
width: 15px !important;
|
||
|
min-width: 13px !important;
|
||
|
|
||
|
.v-icon {
|
||
|
font-size: 13px !important;
|
||
|
}
|
||
|
}
|
||
2 years ago
|
}*/
|
||
2 years ago
|
</style>
|
||
|
<!--
|
||
|
/**
|
||
|
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
|
||
|
*
|
||
|
* @author Naveen MR <oof1lab@gmail.com>
|
||
|
* @author Pranav C Balan <pranavxc@gmail.com>
|
||
|
*
|
||
|
* @license GNU AGPL version 3 or any later version
|
||
|
*
|
||
|
* This program is free software: you can redistribute it and/or modify
|
||
|
* it under the terms of the GNU Affero General Public License as
|
||
|
* published by the Free Software Foundation, either version 3 of the
|
||
|
* License, or (at your option) any later version.
|
||
|
*
|
||
|
* This program is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
* GNU Affero General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU Affero General Public License
|
||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
|
*
|
||
|
*/
|
||
|
-->
|