mirror of
https://github.com/frappe/books.git
synced 2025-02-02 12:08:27 +00:00
fix(ui): quick edit form title display
This commit is contained in:
parent
92b8f61e03
commit
b74ca580cc
@ -50,27 +50,35 @@
|
|||||||
|
|
||||||
<!-- Name and image -->
|
<!-- Name and image -->
|
||||||
<div
|
<div
|
||||||
class="px-4 flex-center flex flex-col items-center gap-1.5"
|
class="items-center"
|
||||||
style="height: calc(var(--h-row-mid) * 2 + 1px)"
|
:class="imageField ? 'grid' : 'flex justify-center'"
|
||||||
v-if="doc && showName"
|
:style="{
|
||||||
|
height: `calc(var(--h-row-mid) * ${!!imageField ? '2 + 1px' : '1'})`,
|
||||||
|
gridTemplateColumns: `minmax(0, 1.1fr) minmax(0, 2fr)`,
|
||||||
|
}"
|
||||||
|
v-if="doc && showName && (titleField || imageField)"
|
||||||
>
|
>
|
||||||
<FormControl
|
<FormControl
|
||||||
v-if="imageField"
|
v-if="imageField"
|
||||||
|
class="ml-4"
|
||||||
:df="imageField"
|
:df="imageField"
|
||||||
:value="doc[imageField.fieldname]"
|
:value="doc[imageField.fieldname]"
|
||||||
@change="(value) => valueChange(imageField, value)"
|
@change="(value) => valueChange(imageField, value)"
|
||||||
size="small"
|
|
||||||
:letter-placeholder="doc[titleField.fieldname]?.[0] ?? ''"
|
:letter-placeholder="doc[titleField.fieldname]?.[0] ?? ''"
|
||||||
/>
|
/>
|
||||||
<FormControl
|
<FormControl
|
||||||
input-class="text-center h-8 bg-transparent"
|
|
||||||
ref="titleControl"
|
|
||||||
v-if="titleField"
|
v-if="titleField"
|
||||||
|
:class="!!imageField ? 'mr-4' : ''"
|
||||||
|
:input-class="[
|
||||||
|
'font-semibold text-xl',
|
||||||
|
!!imageField ? '' : 'text-center',
|
||||||
|
]"
|
||||||
|
ref="titleControl"
|
||||||
|
size="small"
|
||||||
:df="titleField"
|
:df="titleField"
|
||||||
:value="doc[titleField.fieldname]"
|
:value="doc[titleField.fieldname]"
|
||||||
:read-only="doc.inserted"
|
:read-only="doc.inserted || doc.schema.naming !== 'manual'"
|
||||||
@change="(value) => valueChange(titleField, value)"
|
@change="(value) => valueChange(titleField, value)"
|
||||||
@input="setTitleSize"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -224,9 +232,6 @@ export default {
|
|||||||
if (this.values) {
|
if (this.values) {
|
||||||
this.doc?.set(this.values);
|
this.doc?.set(this.values);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set title size
|
|
||||||
this.setTitleSize();
|
|
||||||
},
|
},
|
||||||
setTitleField() {
|
setTitleField() {
|
||||||
const { fieldname, readOnly } = this.titleField;
|
const { fieldname, readOnly } = this.titleField;
|
||||||
@ -318,16 +323,6 @@ export default {
|
|||||||
this.$emit('close');
|
this.$emit('close');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setTitleSize() {
|
|
||||||
if (!this.$refs.titleControl) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const input = this.$refs.titleControl.getInput();
|
|
||||||
const value = input.value;
|
|
||||||
const valueLength = (value || '').length + 1;
|
|
||||||
input.size = Math.max(valueLength, 15);
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user