Browse Source

feat: CustomSelectOptions error messages

Signed-off-by: mertmit <mertmit99@gmail.com>
feat/select-column
mertmit 2 years ago
parent
commit
08adb9a2d3
  1. 32
      packages/nc-gui/components/project/spreadsheet/components/editColumn/CustomSelectOptions.vue

32
packages/nc-gui/components/project/spreadsheet/components/editColumn/CustomSelectOptions.vue

@ -1,7 +1,12 @@
<template> <template>
<v-form v-model="isValid">
<v-container fluid class="wrapper"> <v-container fluid class="wrapper">
<draggable v-model="options" handle=".nc-child-draggable-icon"> <draggable v-model="options" handle=".nc-child-draggable-icon">
<div v-for="(op,i) in options" :key="`${op.color}-${i}`" class="d-flex py-1"> <div
v-for="(op,i) in options"
:key="`${op.color}-${i}`"
class="d-flex py-1"
>
<v-icon <v-icon
small small
class="nc-child-draggable-icon handle" class="nc-child-draggable-icon handle"
@ -27,6 +32,11 @@
</template> </template>
<color-picker v-model="op.color" @input="colorMenus[i] = false;" /> <color-picker v-model="op.color" @input="colorMenus[i] = false;" />
</v-menu> </v-menu>
<div
class="input-wrapper"
@mouseover="disabledError = (op.id && isMigrated)"
@mouseleave="disabledError = false"
>
<v-text-field <v-text-field
v-model="op.title" v-model="op.title"
:autofocus="true" :autofocus="true"
@ -34,8 +44,10 @@
:rules="[enumNotNull, enumNoDuplicate]" :rules="[enumNotNull, enumNoDuplicate]"
dense dense
outlined outlined
hide-details
:disabled="op.id && isMigrated" :disabled="op.id && isMigrated"
/> />
</div>
<v-icon class="ml-2" color="error lighten-2" size="13" @click="removeOption(op, i)"> <v-icon class="ml-2" color="error lighten-2" size="13" @click="removeOption(op, i)">
mdi-close mdi-close
</v-icon> </v-icon>
@ -54,7 +66,14 @@
Add option Add option
</v-btn> </v-btn>
</draggable> </draggable>
<div v-if="!isValid" class="pt-3 text-center caption error--text">
Migrated options can't have duplicates or null
</div>
<div v-if="disabledError" class="pt-3 text-center caption error--text">
Edits not allowed for migrated options
</div>
</v-container> </v-container>
</v-form>
</template> </template>
<script> <script>
@ -72,7 +91,9 @@ export default {
data: () => ({ data: () => ({
options: [], options: [],
colorMenus: {}, colorMenus: {},
colors: enumColor.light colors: enumColor.light,
isValid: true,
disabledError: false
}), }),
computed: { computed: {
alias() { alias() {
@ -182,9 +203,8 @@ export default {
cursor: pointer; cursor: pointer;
} }
/deep/ .v-text-field__details { .input-wrapper {
position: absolute; width: 100%;
margin-top: 10px; height: auto;
margin-left: 25px;
} }
</style> </style>

Loading…
Cancel
Save