Browse Source

fix(nc-gui): checkbox styles preventing action

pull/4100/head
braks 2 years ago
parent
commit
acb5820abe
  1. 16
      packages/nc-gui/components/cell/Checkbox.vue
  2. 52
      packages/nc-gui/pages/[projectType]/form/[viewId]/index.vue
  3. 8
      packages/nc-gui/pages/[projectType]/form/[viewId]/index/index.vue
  4. 41
      packages/nc-gui/pages/[projectType]/form/[viewId]/index/survey.vue

16
packages/nc-gui/components/cell/Checkbox.vue

@ -46,7 +46,7 @@ function onClick() {
<template> <template>
<div <div
class="flex" class="flex cursor-pointer"
:class="{ :class="{
'justify-center': !isForm && !readOnly, 'justify-center': !isForm && !readOnly,
'w-full': isForm, 'w-full': isForm,
@ -56,12 +56,14 @@ function onClick() {
@click="onClick" @click="onClick"
> >
<div class="px-1 pt-1 rounded-full items-center" :class="{ 'bg-gray-100': !vModel, '!ml-[-8px]': readOnly }"> <div class="px-1 pt-1 rounded-full items-center" :class="{ 'bg-gray-100': !vModel, '!ml-[-8px]': readOnly }">
<component <Transition name="layout" mode="out-in" :duration="100">
:is="getMdiIcon(vModel ? checkboxMeta.icon.checked : checkboxMeta.icon.unchecked)" <component
:style="{ :is="getMdiIcon(vModel ? checkboxMeta.icon.checked : checkboxMeta.icon.unchecked)"
color: checkboxMeta.color, :style="{
}" color: checkboxMeta.color,
/> }"
/>
</Transition>
</div> </div>
</div> </div>
</template> </template>

52
packages/nc-gui/pages/[projectType]/form/[viewId]/index.vue

@ -68,30 +68,48 @@ p {
} }
.nc-form-view { .nc-form-view {
.nc-input { .nc-cell {
@apply w-full rounded p-2 min-h-[40px] flex items-center border-solid border-1 border-gray-300 dark:border-slate-200; &.nc-cell-checkbox {
@apply color-transition !border-0;
input, .nc-icon {
&.nc-virtual-cell, @apply !text-2xl;
> div {
@apply bg-white dark:(bg-slate-500 text-white);
.ant-btn {
@apply dark:(bg-slate-300);
} }
.chip { .nc-cell-hover-show {
@apply dark:(bg-slate-700 text-white); opacity: 100 !important;
div {
background-color: transparent !important;
}
} }
} }
}
}
.nc-cell { &:not(.nc-cell-checkbox) {
@apply bg-white dark:bg-slate-500; @apply bg-white dark:bg-slate-500;
&.nc-input {
@apply w-full rounded p-2 min-h-[40px] flex items-center border-solid border-1 border-gray-300 dark:border-slate-200;
input,
&.nc-virtual-cell,
> div {
@apply bg-white dark:(bg-slate-500 text-white);
.nc-attachment-cell > div { .ant-btn {
@apply dark:(bg-slate-100); @apply dark:(bg-slate-300);
}
.chip {
@apply dark:(bg-slate-700 text-white);
}
}
}
.nc-attachment-cell > div {
@apply dark:(bg-slate-100);
}
}
} }
} }

8
packages/nc-gui/pages/[projectType]/form/[viewId]/index/index.vue

@ -20,9 +20,9 @@ function isRequired(_columnObj: Record<string, any>, required = false) {
</script> </script>
<template> <template>
<div> <div class="h-full flex flex-col items-center">
<div <div
class="color-transition relative flex flex-col justify-center gap-2 w-full max-w-[max(33%,600px)] m-auto py-4 pb-8 px-16 md:(bg-white dark:bg-slate-700 rounded-lg border-1 border-gray-200 shadow-xl) mt-12" class="color-transition relative flex flex-col justify-center gap-2 w-full max-w-[max(33%,600px)] m-auto py-4 pb-8 px-16 md:(bg-white dark:bg-slate-700 rounded-lg border-1 border-gray-200 shadow-xl)"
> >
<template v-if="sharedFormView"> <template v-if="sharedFormView">
<h1 class="prose-2xl font-bold self-center my-4">{{ sharedFormView.heading }}</h1> <h1 class="prose-2xl font-bold self-center my-4">{{ sharedFormView.heading }}</h1>
@ -120,6 +120,8 @@ function isRequired(_columnObj: Record<string, any>, required = false) {
</template> </template>
</div> </div>
<GeneralPoweredBy /> <div class="flex items-end">
<GeneralPoweredBy />
</div>
</div> </div>
</template> </template>

41
packages/nc-gui/pages/[projectType]/form/[viewId]/index/survey.vue

@ -195,7 +195,7 @@ onMounted(() => {
</script> </script>
<template> <template>
<div ref="el" class="pt-8 md:p-0 w-full h-full flex flex-col"> <div ref="el" class="survey pt-8 md:p-0 w-full h-full flex flex-col">
<div <div
v-if="sharedFormView" v-if="sharedFormView"
style="height: max(40vh, 225px); min-height: 225px" style="height: max(40vh, 225px); min-height: 225px"
@ -232,6 +232,7 @@ onMounted(() => {
<LazySmartsheetHeaderCell <LazySmartsheetHeaderCell
v-else v-else
:class="field.uidt === UITypes.Checkbox ? 'nc-form-column-label__checkbox' : ''"
:column="{ ...field, title: field.label || field.title }" :column="{ ...field, title: field.label || field.title }"
:required="isRequired(field, field.required)" :required="isRequired(field, field.required)"
:hide-menu="true" :hide-menu="true"
@ -260,7 +261,11 @@ onMounted(() => {
{{ error.$message }} {{ error.$message }}
</div> </div>
<div class="block text-[14px]" data-cy="nc-survey-form__field-description"> <div
class="block text-[14px]"
:class="field.uidt === UITypes.Checkbox ? 'text-center' : ''"
data-cy="nc-survey-form__field-description"
>
{{ field.description }} {{ field.description }}
</div> </div>
@ -425,21 +430,33 @@ onMounted(() => {
@apply overscroll-x-none; @apply overscroll-x-none;
} }
.nc-form-column-label { .survey {
> * { .nc-form-column-label {
@apply !prose-lg; > * {
@apply !prose-lg;
}
.nc-icon {
@apply mr-2;
}
} }
.nc-icon { .nc-form-column-label__checkbox {
@apply mr-2; @apply flex items-center justify-center gap-2 text-left;
} }
}
.nc-input { .nc-input {
@apply appearance-none w-full rounded px-2 py-2 my-2 border-solid border-1 border-primary border-opacity-50; @apply appearance-none w-full rounded px-2 py-2 my-2 border-solid border-1 border-primary border-opacity-50;
&.nc-cell-checkbox {
> * {
@apply justify-center flex items-center;
}
}
input { input {
@apply !py-1 !px-1; @apply !py-1 !px-1;
}
} }
} }
</style> </style>

Loading…
Cancel
Save