UNPKG

@form-create/arco-design

Version:

ArcoDesign版本低代码表单|FormCreate 是一个可以通过 JSON 生成具有动态渲染、数据收集、验证和提交功能的低代码表单生成组件。支持6个UI框架,适配移动端,并且支持生成任何 Vue 组件。内置20种常用表单组件和自定义组件,再复杂的表单都可以轻松搞定。

36 lines (31 loc) 1.08 kB
import {creatorFactory} from '@form-create/core/src/index'; const FORMAT_TYPE = { date: 'YYYY-MM-DD', month: 'YYYY-MM', week: 'YYYY-wo', year: 'YYYY', quarter: 'YYYY-Q', }; const name = 'datePicker'; export default { name, maker: (function () { return ['date', 'month', 'week', 'year', 'quarter'].reduce((initial, mode) => { initial[mode] = creatorFactory(name, {mode}); return initial }, { dateRange: creatorFactory(name, {range: true}), datetimeRange: creatorFactory(name, m => m.props({range: true, showTime: true})) }) }()), mergeProp(ctx) { const props = ctx.prop.props; const type = props.mode; if (!props.valueFormat) { props.valueFormat = (FORMAT_TYPE[type] || FORMAT_TYPE['date']) + ((props.showTime && (!type || type === 'date')) ? ' HH:mm:ss' : ''); } }, render(children, ctx) { return ctx.$render.vNode[(ctx.prop.props.range === true ? 'range' : 'date') + 'Picker'](ctx.prop, children); } }