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">
|
<div class="col" v-for="(column, j) in section.columns" :key="j">
|
||||||
<frappe-control
|
<frappe-control
|
||||||
v-for="fieldname in column.fields"
|
v-for="fieldname in column.fields"
|
||||||
|
v-if="fieldIsNotHidden(fieldname)"
|
||||||
:key="fieldname"
|
:key="fieldname"
|
||||||
:docfield="getDocField(fieldname)"
|
:docfield="getDocField(fieldname)"
|
||||||
:value="$data[fieldname]"
|
:value="$data[fieldname]"
|
||||||
@ -58,6 +59,9 @@ export default {
|
|||||||
getDocField(fieldname) {
|
getDocField(fieldname) {
|
||||||
return this.fields.find(df => df.fieldname === fieldname);
|
return this.fields.find(df => df.fieldname === fieldname);
|
||||||
},
|
},
|
||||||
|
fieldIsNotHidden(fieldname) {
|
||||||
|
return !Boolean(this.getDocField(fieldname).hidden);
|
||||||
|
},
|
||||||
updateDoc(fieldname, value) {
|
updateDoc(fieldname, value) {
|
||||||
this.doc.set(fieldname, value);
|
this.doc.set(fieldname, value);
|
||||||
},
|
},
|
||||||
|
@ -70,7 +70,8 @@ export default {
|
|||||||
type: 'text',
|
type: 'text',
|
||||||
placeholder: '',
|
placeholder: '',
|
||||||
value: this.value,
|
value: this.value,
|
||||||
required: this.docfield.required
|
required: this.docfield.required,
|
||||||
|
disabled: this.docfield.disabled
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getInputListeners() {
|
getInputListeners() {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<component :is="component"
|
<component
|
||||||
|
:is="component"
|
||||||
:docfield="docfield"
|
:docfield="docfield"
|
||||||
:value="value"
|
:value="value"
|
||||||
:onlyInput="onlyInput"
|
:onlyInput="onlyInput"
|
||||||
@ -7,6 +8,7 @@
|
|||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
import Base from './Base';
|
||||||
import Autocomplete from './Autocomplete';
|
import Autocomplete from './Autocomplete';
|
||||||
import Check from './Check';
|
import Check from './Check';
|
||||||
import Code from './Code';
|
import Code from './Code';
|
||||||
@ -27,6 +29,16 @@ export default {
|
|||||||
props: ['docfield', 'value', 'onlyInput'],
|
props: ['docfield', 'value', 'onlyInput'],
|
||||||
computed: {
|
computed: {
|
||||||
component() {
|
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 {
|
return {
|
||||||
Autocomplete,
|
Autocomplete,
|
||||||
Check,
|
Check,
|
||||||
|
Loading…
Reference in New Issue
Block a user