adjust form builder

pull/150/merge
Pete Matsyburka 2 years ago
parent c303349666
commit 4f6142f9c0

@ -79,6 +79,8 @@ window.customElements.define('template-builder', class extends HTMLElement {
connectedCallback () { connectedCallback () {
this.appElem = document.createElement('div') this.appElem = document.createElement('div')
this.appElem.classList.add('md:h-screen')
this.app = createApp(TemplateBuilder, { this.app = createApp(TemplateBuilder, {
template: reactive(JSON.parse(this.dataset.template)), template: reactive(JSON.parse(this.dataset.template)),
backgroundColor: '#faf7f5', backgroundColor: '#faf7f5',

@ -4,6 +4,7 @@
class="mx-auto pl-3 md:pl-4 h-full" class="mx-auto pl-3 md:pl-4 h-full"
> >
<div <div
v-if="$slots.buttons || withTitle"
class="flex justify-between py-1.5 items-center pr-4 sticky top-0 z-10" class="flex justify-between py-1.5 items-center pr-4 sticky top-0 z-10"
:style="{ backgroundColor }" :style="{ backgroundColor }"
> >
@ -15,6 +16,7 @@
<Logo /> <Logo />
</a> </a>
<Contenteditable <Contenteditable
v-if="withTitle"
:model-value="template.name" :model-value="template.name"
:editable="editable" :editable="editable"
class="text-3xl font-semibold focus:text-clip" class="text-3xl font-semibold focus:text-clip"
@ -64,7 +66,10 @@
</template> </template>
</div> </div>
</div> </div>
<div class="flex md:max-h-[calc(100vh-60px)]"> <div
class="flex"
:class="$slots.buttons || withTitle ? 'md:max-h-[calc(100%_-_60px)]' : 'md:max-h-[100%]'"
>
<div <div
ref="previews" ref="previews"
:style="{ 'display': isBreakpointLg ? 'none' : 'initial' }" :style="{ 'display': isBreakpointLg ? 'none' : 'initial' }"
@ -90,7 +95,7 @@
/> />
<div <div
class="sticky bottom-0 py-2" class="sticky bottom-0 py-2"
:class="{ 'bg-base-100': withStickySubmitters }" :style="withStickySubmitters ? { backgroundColor } : {}"
> >
<Upload <Upload
v-if="sortedDocuments.length && editable && withUploadButton" v-if="sortedDocuments.length && editable && withUploadButton"
@ -200,7 +205,8 @@
> >
<div <div
v-if="drawField" v-if="drawField"
class="sticky inset-0 bg-base-100 h-full" class="sticky inset-0 h-full"
:style="{ backgroundColor }"
> >
<div class="bg-base-300 rounded-lg p-5 text-center space-y-4"> <div class="bg-base-300 rounded-lg p-5 text-center space-y-4">
<p> <p>
@ -336,6 +342,11 @@ export default {
required: false, required: false,
default: true default: true
}, },
withTitle: {
type: Boolean,
required: false,
default: true
},
withPhone: { withPhone: {
type: Boolean, type: Boolean,
required: false, required: false,

@ -24,11 +24,10 @@
* *
</span> </span>
<IconPencil <IconPencil
v-if="editable"
class="cursor-pointer flex-none opacity-0 group-hover/contenteditable-container:opacity-100 group-hover/contenteditable:opacity-100 align-middle peer-focus:hidden" class="cursor-pointer flex-none opacity-0 group-hover/contenteditable-container:opacity-100 group-hover/contenteditable:opacity-100 align-middle peer-focus:hidden"
:style="iconInline ? {} : { right: -(1.1 * iconWidth) + 'px' }" :style="iconInline ? {} : { right: -(1.1 * iconWidth) + 'px' }"
title="Edit" title="Edit"
:class="{ 'ml-1': !withRequired, 'absolute': !iconInline, 'inline align-bottom': iconInline }" :class="{ invisible: !editable, 'ml-1': !withRequired, 'absolute': !iconInline, 'inline align-bottom': iconInline }"
:width="iconWidth" :width="iconWidth"
:stroke-width="iconStrokeWidth" :stroke-width="iconStrokeWidth"
@click="[focusContenteditable(), selectOnEditClick && selectContent()]" @click="[focusContenteditable(), selectOnEditClick && selectContent()]"

Loading…
Cancel
Save