feat(Grid): support for field overrides and Autocomplete
This commit is contained in:
parent
4148640472
commit
d69b86bcaf
@ -271,6 +271,15 @@
|
||||
:disabled="Boolean(field.read_only)"
|
||||
@change="fieldChange(flt($event.target.value), field, row)"
|
||||
/>
|
||||
<Autocomplete
|
||||
v-else-if="field.fieldtype === 'Autocomplete'"
|
||||
class="text-sm text-ink-gray-8"
|
||||
v-model="row[field.fieldname]"
|
||||
@change="(s) => fieldChange(s.value, field, row)"
|
||||
:options="field.options"
|
||||
:placeholder="field.placeholder"
|
||||
:disabled="Boolean(field.read_only)"
|
||||
/>
|
||||
<FormControl
|
||||
v-else
|
||||
class="text-sm text-ink-gray-8"
|
||||
@ -360,6 +369,7 @@ import {
|
||||
DatePicker,
|
||||
Tooltip,
|
||||
dayjs,
|
||||
Autocomplete
|
||||
} from 'frappe-ui'
|
||||
import Draggable from 'vuedraggable'
|
||||
import { ref, reactive, computed, inject, provide } from 'vue'
|
||||
@ -381,6 +391,10 @@ const props = defineProps({
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
overrides: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
}
|
||||
})
|
||||
|
||||
const triggerOnChange = inject('triggerOnChange', () => {})
|
||||
@ -449,11 +463,18 @@ function getFieldObj(field) {
|
||||
})
|
||||
}
|
||||
|
||||
return {
|
||||
const fieldObjWithFilters ={
|
||||
...field,
|
||||
filters: field.link_filters && JSON.parse(field.link_filters),
|
||||
placeholder: field.placeholder || field.label,
|
||||
}
|
||||
|
||||
return {
|
||||
...fieldObjWithFilters,
|
||||
...props.overrides.fields?.find(
|
||||
(f) => f.fieldname === field.fieldname,
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
const gridTemplateColumns = computed(() => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user