mirror of
https://github.com/frappe/books.git
synced 2024-11-10 15:50:56 +00:00
Form
- Dont render hidden fields - Render Fields with Custom Template - Disabled fields
This commit is contained in:
parent
180845aa0c
commit
c8422eca39
@ -7,6 +7,7 @@
|
||||
<div class="col" v-for="(column, j) in section.columns" :key="j">
|
||||
<frappe-control
|
||||
v-for="fieldname in column.fields"
|
||||
v-if="fieldIsNotHidden(fieldname)"
|
||||
:key="fieldname"
|
||||
:docfield="getDocField(fieldname)"
|
||||
:value="$data[fieldname]"
|
||||
@ -58,6 +59,9 @@ export default {
|
||||
getDocField(fieldname) {
|
||||
return this.fields.find(df => df.fieldname === fieldname);
|
||||
},
|
||||
fieldIsNotHidden(fieldname) {
|
||||
return !Boolean(this.getDocField(fieldname).hidden);
|
||||
},
|
||||
updateDoc(fieldname, value) {
|
||||
this.doc.set(fieldname, value);
|
||||
},
|
||||
|
@ -70,7 +70,8 @@ export default {
|
||||
type: 'text',
|
||||
placeholder: '',
|
||||
value: this.value,
|
||||
required: this.docfield.required
|
||||
required: this.docfield.required,
|
||||
disabled: this.docfield.disabled
|
||||
}
|
||||
},
|
||||
getInputListeners() {
|
||||
|
@ -1,5 +1,6 @@
|
||||
<template>
|
||||
<component :is="component"
|
||||
<component
|
||||
:is="component"
|
||||
:docfield="docfield"
|
||||
:value="value"
|
||||
:onlyInput="onlyInput"
|
||||
@ -7,6 +8,7 @@
|
||||
/>
|
||||
</template>
|
||||
<script>
|
||||
import Base from './Base';
|
||||
import Autocomplete from './Autocomplete';
|
||||
import Check from './Check';
|
||||
import Code from './Code';
|
||||
@ -27,6 +29,16 @@ export default {
|
||||
props: ['docfield', 'value', 'onlyInput'],
|
||||
computed: {
|
||||
component() {
|
||||
if (this.docfield.template) {
|
||||
// for controls with their own template
|
||||
// create a vue object for it
|
||||
return {
|
||||
extends: Base,
|
||||
render: null,
|
||||
template: this.docfield.template()
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
Autocomplete,
|
||||
Check,
|
||||
|
Loading…
Reference in New Issue
Block a user