|
|
@ -1,10 +1,12 @@ |
|
|
|
<script lang="ts" setup> |
|
|
|
<script lang="ts" setup> |
|
|
|
import { ViewTypes } from 'nocodb-sdk' |
|
|
|
import { ViewTypes } from 'nocodb-sdk' |
|
|
|
import { isString } from '@vueuse/core' |
|
|
|
import { isString } from '@vueuse/core' |
|
|
|
|
|
|
|
import tinycolor from 'tinycolor2' |
|
|
|
import { |
|
|
|
import { |
|
|
|
computed, |
|
|
|
computed, |
|
|
|
extractSdkResponseErrorMsg, |
|
|
|
extractSdkResponseErrorMsg, |
|
|
|
message, |
|
|
|
message, |
|
|
|
|
|
|
|
projectThemeColors, |
|
|
|
ref, |
|
|
|
ref, |
|
|
|
useCopy, |
|
|
|
useCopy, |
|
|
|
useDashboard, |
|
|
|
useDashboard, |
|
|
@ -12,14 +14,11 @@ import { |
|
|
|
useNuxtApp, |
|
|
|
useNuxtApp, |
|
|
|
useProject, |
|
|
|
useProject, |
|
|
|
useSmartsheetStoreOrThrow, |
|
|
|
useSmartsheetStoreOrThrow, |
|
|
|
useTheme, |
|
|
|
|
|
|
|
useUIPermission, |
|
|
|
useUIPermission, |
|
|
|
watch, |
|
|
|
watch, |
|
|
|
} from '#imports' |
|
|
|
} from '#imports' |
|
|
|
import type { SharedView } from '~/lib' |
|
|
|
import type { SharedView } from '~/lib' |
|
|
|
|
|
|
|
|
|
|
|
const { theme } = useTheme() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { t } = useI18n() |
|
|
|
const { t } = useI18n() |
|
|
|
|
|
|
|
|
|
|
|
const { view, $api } = useSmartsheetStoreOrThrow() |
|
|
|
const { view, $api } = useSmartsheetStoreOrThrow() |
|
|
@ -57,11 +56,11 @@ const surveyMode = computed({ |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
const viewTheme = computed({ |
|
|
|
const viewTheme = computed({ |
|
|
|
get: () => !!shared.value.meta.theme, |
|
|
|
get: () => !!shared.value.meta.withTheme, |
|
|
|
set: (hasTheme) => { |
|
|
|
set: (withTheme) => { |
|
|
|
shared.value.meta = { |
|
|
|
shared.value.meta = { |
|
|
|
...shared.value.meta, |
|
|
|
...shared.value.meta, |
|
|
|
theme: hasTheme ? { ...theme.value } : undefined, |
|
|
|
withTheme, |
|
|
|
} |
|
|
|
} |
|
|
|
saveTheme() |
|
|
|
saveTheme() |
|
|
|
}, |
|
|
|
}, |
|
|
@ -143,6 +142,20 @@ const saveShareLinkPassword = async () => { |
|
|
|
$e('a:view:share:enable-pwd') |
|
|
|
$e('a:view:share:enable-pwd') |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function onChangeTheme(color: string) { |
|
|
|
|
|
|
|
const tcolor = tinycolor(color) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (tcolor.isValid()) { |
|
|
|
|
|
|
|
const complement = tcolor.complement() |
|
|
|
|
|
|
|
shared.value.meta.theme = { |
|
|
|
|
|
|
|
primaryColor: color, |
|
|
|
|
|
|
|
accentColor: complement.toHex8String(), |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
saveTheme() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const copyLink = async () => { |
|
|
|
const copyLink = async () => { |
|
|
|
if (sharedViewUrl.value) { |
|
|
|
if (sharedViewUrl.value) { |
|
|
|
await copy(sharedViewUrl.value) |
|
|
|
await copy(sharedViewUrl.value) |
|
|
@ -210,6 +223,16 @@ watch(passwordProtected, (value) => { |
|
|
|
<div> |
|
|
|
<div> |
|
|
|
<!-- todo: i18n --> |
|
|
|
<!-- todo: i18n --> |
|
|
|
<a-checkbox v-model:checked="viewTheme" class="!text-xs"> Use Theme </a-checkbox> |
|
|
|
<a-checkbox v-model:checked="viewTheme" class="!text-xs"> Use Theme </a-checkbox> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div v-if="viewTheme" class="flex pl-2"> |
|
|
|
|
|
|
|
<LazyGeneralColorPicker |
|
|
|
|
|
|
|
:model-value="shared.meta.theme?.primaryColor" |
|
|
|
|
|
|
|
:colors="projectThemeColors" |
|
|
|
|
|
|
|
:row-size="9" |
|
|
|
|
|
|
|
:advanced="false" |
|
|
|
|
|
|
|
@input="onChangeTheme" |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div> |
|
|
|
<div> |
|
|
|