refactor and clean up
This commit is contained in:
parent
4f3ebb29e9
commit
00d5857232
|
@ -42,7 +42,7 @@
|
||||||
editable: isEditable(schema[key].type),
|
editable: isEditable(schema[key].type),
|
||||||
cellRenderer: getRenderer(
|
cellRenderer: getRenderer(
|
||||||
schema[key].type, // type
|
schema[key].type, // type
|
||||||
schema[key].constraints.inclusion // options
|
schema[key].constraints // options
|
||||||
),
|
),
|
||||||
autoHeight: true,
|
autoHeight: true,
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ function dateRenderer(options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function optionsRenderer(options) {
|
function optionsRenderer({ inclusion }) {
|
||||||
return params => {
|
return params => {
|
||||||
const container = document.createElement("div")
|
const container = document.createElement("div")
|
||||||
const change = (e) => {
|
const change = (e) => {
|
||||||
|
@ -72,7 +72,7 @@ function optionsRenderer(options) {
|
||||||
target: container,
|
target: container,
|
||||||
props: {
|
props: {
|
||||||
value: params.value,
|
value: params.value,
|
||||||
options
|
options: inclusion
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -83,13 +83,9 @@ function optionsRenderer(options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getRenderer(type, options) {
|
export function getRenderer(type, options) {
|
||||||
// Complicated thing to set options for renderers
|
if (renderers.get(type)) {
|
||||||
let customRenderer
|
return renderers.get(type)(options)
|
||||||
if (type === "options" || type === 'datetime') {
|
|
||||||
customRenderer = renderers.get(type)(options)
|
|
||||||
} else {
|
} else {
|
||||||
let rendererGenerator = renderers.get(type)
|
return false
|
||||||
customRenderer = rendererGenerator ? rendererGenerator() : false
|
|
||||||
}
|
}
|
||||||
return customRenderer
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue