|
|
|
@ -1,6 +1,8 @@
|
|
|
|
|
<script lang="ts" setup> |
|
|
|
|
import type { Form } from 'ant-design-vue' |
|
|
|
|
import { message } from 'ant-design-vue' |
|
|
|
|
import type { ProjectType } from 'nocodb-sdk' |
|
|
|
|
import tinycolor from 'tinycolor2' |
|
|
|
|
import { |
|
|
|
|
extractSdkResponseErrorMsg, |
|
|
|
|
navigateTo, |
|
|
|
@ -34,11 +36,13 @@ const nameValidationRules = [
|
|
|
|
|
|
|
|
|
|
const form = ref<typeof Form>() |
|
|
|
|
|
|
|
|
|
const formState = reactive({ |
|
|
|
|
const formState = reactive<Partial<ProjectType>>({ |
|
|
|
|
title: '', |
|
|
|
|
color: '#FFFFFF00', |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
const renameProject = async () => { |
|
|
|
|
formState.color = formState.color === '#FFFFFF00' ? '' : formState.color |
|
|
|
|
try { |
|
|
|
|
await updateProject(formState) |
|
|
|
|
|
|
|
|
@ -51,6 +55,7 @@ const renameProject = async () => {
|
|
|
|
|
// select and focus title field on load |
|
|
|
|
onMounted(async () => { |
|
|
|
|
formState.title = project.value.title as string |
|
|
|
|
formState.color = project.value.color && tinycolor(project.value.color).isValid() ? project.value.color : '#FFFFFF00' |
|
|
|
|
await nextTick(() => { |
|
|
|
|
// todo: replace setTimeout and follow better approach |
|
|
|
|
setTimeout(() => { |
|
|
|
@ -93,6 +98,27 @@ onMounted(async () => {
|
|
|
|
|
<a-input v-model:value="formState.title" name="title" class="nc-metadb-project-name" /> |
|
|
|
|
</a-form-item> |
|
|
|
|
|
|
|
|
|
<div class="flex items-center"> |
|
|
|
|
<span>Project color: </span> |
|
|
|
|
<a-menu class="!border-0 !m-0 !p-0"> |
|
|
|
|
<a-sub-menu key="project-color"> |
|
|
|
|
<template #title> |
|
|
|
|
<button type="button" class="color-selector" :style="{ 'background-color': formState.color }"> |
|
|
|
|
<MdiNull v-if="formState.color === '#FFFFFF00'" /> |
|
|
|
|
</button> |
|
|
|
|
</template> |
|
|
|
|
<template #expandIcon></template> |
|
|
|
|
<GeneralColorPicker v-model="formState.color" name="color" class="nc-metadb-project-color" /> |
|
|
|
|
</a-sub-menu> |
|
|
|
|
</a-menu> |
|
|
|
|
<MdiClose |
|
|
|
|
v-show="formState.color !== '#FFFFFF00'" |
|
|
|
|
class="cursor-pointer" |
|
|
|
|
:style="{ color: 'red' }" |
|
|
|
|
@click="formState.color = '#FFFFFF00'" |
|
|
|
|
/> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<div class="text-center"> |
|
|
|
|
<button type="submit" class="submit"> |
|
|
|
|
<span class="flex items-center gap-2"> |
|
|
|
@ -105,7 +131,7 @@ onMounted(async () => {
|
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<style lang="scss"> |
|
|
|
|
<style lang="scss" scoped> |
|
|
|
|
.update-project { |
|
|
|
|
.ant-input-affix-wrapper, |
|
|
|
|
.ant-input { |
|
|
|
@ -130,4 +156,23 @@ onMounted(async () => {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
:deep(.ant-menu-submenu-title) { |
|
|
|
|
@apply !p-0 !mx-2; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.color-selector { |
|
|
|
|
position: relative; |
|
|
|
|
height: 32px; |
|
|
|
|
width: 32px; |
|
|
|
|
border-radius: 5px; |
|
|
|
|
-webkit-text-stroke-width: 1px; |
|
|
|
|
-webkit-text-stroke-color: white; |
|
|
|
|
@apply flex text-gray-500 border-4 items-center justify-center; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.color-selector:hover { |
|
|
|
|
filter: brightness(90%); |
|
|
|
|
-webkit-filter: brightness(90%); |
|
|
|
|
} |
|
|
|
|
</style> |
|
|
|
|