Skip to content

Commit

Permalink
fix(generator): change the default values for part of the property co…
Browse files Browse the repository at this point in the history
…nfiguration (#212)
  • Loading branch information
mengshang918 committed May 27, 2022
1 parent 23cf581 commit cdf5389
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/drip-form-theme-antd/src/SelectField/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const config = {
fieldKey: 'multiple',
type: 'boolean',
title: '是否可以多选',
default: true,
default: false,
ui: {
type: 'switch',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @Author: jiangxiaowei
* @Date: 2021-08-16 11:32:22
* @Last Modified by: jiangxiaowei
* @Last Modified time: 2022-03-13 18:53:18
* @Last Modified time: 2022-05-27 13:54:52
*/
import React, { useMemo, memo, useCallback } from 'react'
import {
Expand Down Expand Up @@ -162,7 +162,7 @@ const CheckConfig = (): JSX.Element => {
fieldKey: 'validateTime',
type: 'string',
title: '校验时机',
default: 'change',
default: 'submit',
ui: {
type: 'select',
options: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,17 @@ const PropertyConfig = () => {
// 当前修改的字段处理为为可映射到渲染区schema的路径
let key = changeKey
let data = get(key).data
const keyArr = key.split('.')
keyArr.pop()
const parentKey = keyArr.join('.')
// 父元素是数组的,需要考虑数组的删除。所以修改父级数据
if (parentKey) {
const parentType = get(parentKey).dataSchema.type
if (parentType === 'array') {
key = parentKey
data = get(parentKey).data
}
}
// 是否设置formData,默认不设置
let setFormData = false
// 需要设置的表单数据
Expand Down Expand Up @@ -192,10 +203,6 @@ const PropertyConfig = () => {
}
}

if (changeKey.startsWith('ui.options.')) {
data = get('ui.options').data
key = 'ui.options'
}
if (changeKey === 'containerStyle.width') {
// 更改全局布局宽度时,如果选用多列并且未设置padding,则自动设置
if (type === 'root' && data !== 100 && !get().data.padding) {
Expand Down

0 comments on commit cdf5389

Please sign in to comment.