Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
(SubPrev, schema) => {
if(schema.type == 'string' && [ 'time', 'date', 'date-time', 'datetime' ].indexOf(schema.format) > -1) {
const dtf = app.load_dict('config').date_format || {}
const format = schema.dateFormat || { time: dtf.time || 'LT', date: dtf.date || 'LL',
'date-time': dtf.datetime || 'LLL', 'datetime': dtf.datetime || 'LLL' }[schema.format]
return ({ value, wrap: WrapComponent }) => {
if(!_.isNil(value)) {
const time = moment(value)
return {time.format(format)}
} else {
return <span>-</span>
}
}
} else if(schema.type == 'string' && schema.enum && schema.enum_title) {
return ({ value, wrap: WrapComponent }) => {
let result = null
let index = schema.enum.indexOf(value)
if(_.isArray(schema.enum_title) && index > -1) {
result = schema.enum_title[index]
export default ({ input, label, meta, field, option, group }) => {
let renderItems = field.itemsRender || defaultItemsRender
if(typeof renderItems === 'string') {
renderItems = app.load_dict('array_render')[renderItems]
}
const { items } = field
const fieldsBuilder = (name, index, removeBtn, itemLable) => {
const itemLabel = itemLable || (<div>{removeBtn ? removeBtn : ''}</div>)
const itemFields = items.fields ?
(items.fields.map(f => prefixFieldKey(f, name + '.'))) :
[ { ...items, key: name, name: name, label: itemLabel } ]
return objectBuilder(itemFields, items.render, option)
}
return (
)
}