refactor and clean up

This commit is contained in:
kevmodrome 2020-10-09 11:35:52 +02:00
parent 4f3ebb29e9
commit 00d5857232
No known key found for this signature in database
GPG Key ID: E8F9CD141E63BF38
2 changed files with 6 additions and 10 deletions

View File

@ -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,
} }

View File

@ -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
} }