Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add generator configuration for antd theme #156

Merged
merged 1 commit into from
Mar 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 0 additions & 102 deletions examples/form-generator/src/App/schema.js
Original file line number Diff line number Diff line change
@@ -1,108 +1,6 @@
// export default {
// validateTime: 'submit',
// type: 'object',
// ui: {
// title: {
// verticalAlign: 'top',
// width: 150,
// },
// footer: {
// justifyContent: 'right',
// margin: 10,
// onOk: {
// text: '保存',
// type: 'primary',
// size: 'middle',
// shape: 'squash',
// },
// onCancel: {
// text: '重置',
// type: 'default',
// size: 'middle',
// shape: 'squash',
// },
// },
// },
// theme: 'antd',
// schema: [
// {
// type: 'array',
// title: '数组容器',
// ui: {
// type: 'array',
// mode: 'normal',
// },
// items: [
// {
// validateTime: 'submit',
// type: 'object',
// title: '对象容器',
// ui: {
// type: 'object',
// },
// schema: [
// {
// validateTime: 'submit',
// type: 'string',
// title: '输入框',
// ui: {
// type: 'text',
// },
// },
// {
// validateTime: 'submit',
// type: 'string',
// title: '输入框',
// ui: {
// type: 'text',
// },
// },
// ],
// },
// ],
// fieldKey: 'array_dk_fFn',
// },
// {
// validateTime: 'submit',
// type: 'object',
// title: '上传组件',
// ui: {
// type: 'uploader',
// listType: 'picture',
// canDrag: false,
// action: 'https://www.mocky.io/v2/5cc8019d300000980a055e76',
// dimension: {
// width: 516,
// height: 238,
// },
// },
// fieldKey: 'uploader_Ux8m6P',
// },
// ],
// }

export default {
validateTime: 'change',
requiredMode: 'default',
type: 'object',
ui: {},
theme: 'antd',
schema: [
{
type: 'string',
title: '日期选择框',
ui: {
type: 'datePicker',
},
fieldKey: 'datePicker_rNWNDU',
},
{
type: 'string',
title: '时间选择框',
ui: {
type: 'timePicker',
},
fieldKey: 'timePicker_DhrlL-',
},
],
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { Field } from '../types'

/**
* 级联选择器配置
*/
const config: Field = {
const config = {
icon: 'iconfont icon-cascader',
title: '级联选择',
unitedSchema: {
Expand Down
2 changes: 2 additions & 0 deletions packages/drip-form-theme-antd/src/CascaderField/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,5 @@ const CascaderField = ({
}

export const cascader = memo(CascaderField)

export { default as config } from './config'
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { Field } from '../types'

/**
* 多选框配置
*/
const config: Field = {
const config = {
icon: 'iconfont icon-checked-box',
title: '多选框',
unitedSchema: {
Expand Down
1 change: 1 addition & 0 deletions packages/drip-form-theme-antd/src/CheckboxField/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,4 @@ const CheckboxField = ({
}

export const checkbox = memo(CheckboxField)
export { default as config } from './config'
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { Field } from '../types'

/**
* 颜色选择器配置
*/
const config: Field = {
const config = {
icon: 'iconfont icon-colorpicker',
title: '颜色选择框',
unitedSchema: {
Expand Down
3 changes: 2 additions & 1 deletion packages/drip-form-theme-antd/src/ColorPickerField/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @Author: jiangxiaowei
* @Date: 2020-05-14 13:33:14
* @Last Modified by: jiangxiaowei
* @Last Modified time: 2022-01-21 11:25:34
* @Last Modified time: 2022-03-13 12:28:56
*/
import React, { memo, useState } from 'react'
// import PropTypes from 'prop-types'
Expand Down Expand Up @@ -111,3 +111,4 @@ const ColorPickerField = ({
}

export const colorPicker = memo(ColorPickerField)
export { default as config } from './config'
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { Field } from '../types'
import type { OnChange } from '@jdfed/utils'

const formatList = {
Expand Down Expand Up @@ -89,7 +88,7 @@ const changePicker: OnChange = ({ dispatch, getKey, val }) => {
/**
* 日期选择器
*/
const config: Field = {
const config = {
icon: 'iconfont icon-datepicker',
title: '日期选择框',
unitedSchema: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,4 @@ const DatePickerField = ({
}

export const datePicker = memo(DatePickerField)
export { default as config } from './config'
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { Field } from '../types'

/**
* 纯文本组件
*/
const config: Field = {
const config = {
icon: 'iconfont icon-sort-alphabetically',
title: '文本',
unitedSchema: {
Expand Down
3 changes: 2 additions & 1 deletion packages/drip-form-theme-antd/src/NullField/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @Author: jiangxiaowei
* @Date: 2020-05-14 13:33:14
* @Last Modified by: jiangxiaowei
* @Last Modified time: 2021-04-14 12:19:56
* @Last Modified time: 2022-03-13 12:29:08
*/
import React, { memo } from 'react'

Expand All @@ -16,3 +16,4 @@ const NullField = ({ style, text }: NullFieldProps) => {
}

export const nullField = memo(NullField)
export { default as config } from './config'
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { Field } from '../types'

/**
* 数组输入框
*/
const config: Field = {
const config = {
icon: 'iconfont icon-number',
title: '数字输入框',
unitedSchema: {
Expand Down
3 changes: 2 additions & 1 deletion packages/drip-form-theme-antd/src/NumberField/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @Author: jiangxiaowei
* @Date: 2020-05-20 20:18:36
* @Last Modified by: jiangxiaowei
* @Last Modified time: 2022-01-12 15:40:45
* @Last Modified time: 2022-03-13 12:29:10
*/
import React, { memo } from 'react'
import { InputNumber } from 'antd'
Expand Down Expand Up @@ -38,3 +38,4 @@ const NumberField = ({
}

export const numberField = memo(NumberField)
export { default as config } from './config'
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { Field } from '../types'

/**
* 单选框
*/
const config: Field = {
const config = {
icon: 'iconfont icon-radio',
title: '单选',
unitedSchema: {
Expand Down
1 change: 1 addition & 0 deletions packages/drip-form-theme-antd/src/RadioField/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,4 @@ const RadioField = ({
}

export const radio = memo(RadioField)
export { default as config } from './config'
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { Field } from '../types'

/**
* 下拉选择器
*/
const config: Field = {
const config = {
icon: 'iconfont icon-select',
title: '选择器',
unitedSchema: {
Expand Down
3 changes: 2 additions & 1 deletion packages/drip-form-theme-antd/src/SelectField/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @Author: jiangxiaowei
* @Date: 2020-05-20 22:17:44
* @Last Modified by: jiangxiaowei
* @Last Modified time: 2022-01-12 15:41:03
* @Last Modified time: 2022-03-13 12:29:22
*/
import React, { memo, FC } from 'react'
import { Select } from 'antd'
Expand Down Expand Up @@ -82,3 +82,4 @@ const SelectField: FC<SelectFieldProps> = ({
}

export const select = memo(SelectField)
export { default as config } from './config'
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { Field } from '../types'

/**
* 滑动输入条
*/
const config: Field = {
const config = {
icon: 'iconfont icon-sliders',
title: '滑动输入条',
unitedSchema: {
Expand Down
3 changes: 2 additions & 1 deletion packages/drip-form-theme-antd/src/SliderField/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @Author: jiangxiaowei
* @Date: 2020-05-14 13:33:14
* @Last Modified by: jiangxiaowei
* @Last Modified time: 2021-08-11 14:44:05
* @Last Modified time: 2022-03-13 12:29:33
*/
import React, { memo, FC, useMemo } from 'react'
import { Slider, InputNumber } from 'antd'
Expand Down Expand Up @@ -86,3 +86,4 @@ const SliderField: FC<SliderFieldProps> = ({
}

export const slider = memo(SliderField)
export { default as config } from './config'
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { Field } from '../types'

/**
* 开关
*/
const config: Field = {
const config = {
icon: 'iconfont icon-switch',
title: '开关',
unitedSchema: {
Expand Down
3 changes: 2 additions & 1 deletion packages/drip-form-theme-antd/src/SwitchField/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @Author: jiangxiaowei
* @Date: 2020-05-14 13:33:14
* @Last Modified by: jiangxiaowei
* @Last Modified time: 2021-08-11 14:44:22
* @Last Modified time: 2022-03-13 12:29:35
*/
import React, { memo, FC } from 'react'
import { Switch } from 'antd'
Expand Down Expand Up @@ -36,3 +36,4 @@ const SwitchField: FC<CommonProps> = ({
}

export const switchField = memo(SwitchField)
export { default as config } from './config'
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { Field } from '../types'

/**
* 输入框
*/
const config: Field = {
const config = {
icon: 'iconfont icon-input',
title: '输入框',
unitedSchema: {
Expand Down
4 changes: 3 additions & 1 deletion packages/drip-form-theme-antd/src/TextField/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @Author: jiangxiaowei
* @Date: 2020-05-14 13:33:14
* @Last Modified by: jiangxiaowei
* @Last Modified time: 2022-01-12 15:41:44
* @Last Modified time: 2022-03-13 12:21:55
*/
import React, { memo, FC } from 'react'
import { Input } from 'antd'
Expand Down Expand Up @@ -61,3 +61,5 @@ const TextField: FC<TextFieldProps> = ({
}

export const text = memo(TextField)

export { default as config } from './config'
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { Field } from '../types'
import { OnChange } from '@jdfed/utils'

const changeUse12Hours: OnChange = ({ dispatch, val, getKey }) => {
Expand Down Expand Up @@ -44,7 +43,7 @@ const changeUse12Hours: OnChange = ({ dispatch, val, getKey }) => {
/**
* 时间选择器
*/
const config: Field = {
const config = {
icon: 'iconfont icon-clock',
title: '时间选择器',
unitedSchema: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,4 @@ const TimePickerField: FC<TimePickerFieldProps> = ({
}

export const timePicker = memo(TimePickerField)
export { default as config } from './config'
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { Field } from '../types'

/**
* 树形选择器
*/
const config: Field = {
const config = {
icon: 'iconfont icon-treeselect',
title: '树选择',
unitedSchema: {
Expand Down
3 changes: 2 additions & 1 deletion packages/drip-form-theme-antd/src/TreeSelectField/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @Author: jiangxiaowei
* @Date: 2020-05-20 22:17:44
* @Last Modified by: jiangxiaowei
* @Last Modified time: 2022-01-28 14:46:06
* @Last Modified time: 2022-03-13 12:29:48
*/
import React, { memo, FC, useEffect } from 'react'
import { TreeSelect } from 'antd'
Expand Down Expand Up @@ -143,3 +143,4 @@ export const TreeSelectField: FC<TreeSelectFieldProps> = memo(
)

TreeSelectField.displayName = 'TreeSelectField'
export { default as config } from './config'
Loading