Skip to content

Commit

Permalink
fix(form): 解决有addonBefore或addBefore的情况下出现双重表单校验提示的问题 (#3611)
Browse files Browse the repository at this point in the history
* fix: ProColumns下的fieldProps属性类型增加placeholder

- 在ProTable中的ProColumns中支持在fieldProps设置文本框的placeholder属性,但类型定义中却未明确设置

* fix: ProColumns下的fieldProps增加支持类型描述

- 在ProTable中的ProColumns中支持在fieldProps设置文本框的placeholder属性,但类型定义中却未明确设置
- 在ProTable中的ProColumns中支持在fieldProps设置文本框的maxLength属性,但类型定义中却未明确设置

* feat: ProTable集成拖拽排序功能

- 以往的拖拽排序功能仍需要用户编写过多与业务无关代码,使用不是很方便,使用门槛较高。故将相关逻辑封装进入ProTable组件当中,用户需要使用拖拽排序时仅需额外配置有限的几个属性便可完成。
- 更新demo快照,主要修改拖动排序示例
- 执行lint进行格式修正

* feat: 更新yarn.lock源镜像

* feat: 拖拽排序逻辑抽离至自定义hooks

- 拖拽排序逻辑抽离至自定义hooks
- 增加拖拽排序测试用例

* feat: 拖拽排序遵循单向数据流原则,将原数据更新操作交还给调用者

* feat: 增加排序核心代码测试用例

Signed-off-by: Wenhui Tang <[email protected]>

* feat: 增加排序核心代码测试用例

Signed-off-by: Wenhui Tang <[email protected]>

* feat: 增加排序核心代码测试用例

Signed-off-by: 汤文辉(kinertang) <[email protected]>

* feat: run link prettier

Signed-off-by: 汤文辉(kinertang) <[email protected]>

* feat: 抽离dragSortTable

Signed-off-by: 汤文辉(kinertang) <[email protected]>

* feat: run lint

Signed-off-by: 汤文辉(kinertang) <[email protected]>

* feat: 修改基础依赖引入问题

Signed-off-by: 汤文辉(kinertang) <[email protected]>

* feat: 优化代码结构

Signed-off-by: 汤文辉(kinertang) <[email protected]>

* feat: 优化代码结构

Signed-off-by: 汤文辉(kinertang) <[email protected]>

* feat: prettier code

Signed-off-by: 汤文辉(kinertang) <[email protected]>

* prettier

* merge

* merge

* update snapshot

* fix(Form#3547): 当原先在url中存在的字段被删除时,应该讲params中的该字段设置为undefined,以便触发url同步删除

* feat: 增加react-sortable-hoc依赖

* feat: 删除重复引入的依赖

* fix: #3547 当原先在url中存在的字段被删除时,应该讲params中的该字段设置为undefined,以便触发url同步删除

* feat: 增加ProFormMoney组件

* feat: 删除日志打印

* feat: 增加注释

* feat: 更新ProFormMoney单元测试

* fix: #3601 解决有addonBefore或addBefore的情况下出现双重表单校验提示的问题

* feat: 更新快照

Co-authored-by: Wenhui Tang <[email protected]>
Co-authored-by: chenshuai2144 <[email protected]>
  • Loading branch information
3 people authored Sep 8, 2021
1 parent 61a4717 commit aceeb06
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/form/src/components/FormItem/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ const WarpFormItem: React.FC<FormItemProps & WarpFormItemProps> = ({
...props
}) => {
const formDom = useMemo(() => {
const { rules, ...rest } = props;
if (!addonAfter && !addonBefore) return <Form.Item {...props}>{children}</Form.Item>;
return (
<Form.Item {...props}>
Expand All @@ -104,7 +105,7 @@ const WarpFormItem: React.FC<FormItemProps & WarpFormItemProps> = ({
>
{addonBefore ? <div style={{ marginRight: 8 }}>{addonBefore}</div> : null}
<div style={{ flex: 1 }}>
<Form.Item {...props} noStyle>
<Form.Item {...rest} rules={rules?.map((item) => ({ ...item, message: '' }))} noStyle>
{children}
</Form.Item>
</div>
Expand Down
1 change: 1 addition & 0 deletions packages/form/src/demos/base.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export default () => {
label="签约客户名称"
tooltip="最长为 24 位"
placeholder="请输入名称"
rules={[{ required: true, message: '这是必填项' }]}
/>
<ProFormText width="md" name="company" label="我方公司名称" placeholder="请输入名称" />
</ProForm.Group>
Expand Down
2 changes: 1 addition & 1 deletion tests/form/__snapshots__/demo.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -24887,7 +24887,7 @@ exports[`form demos 📸 renders ./packages/form/src/demos/base.tsx correctly 1`
class="ant-col ant-form-item-label"
>
<label
class=""
class="ant-form-item-required"
for="name"
title="签约客户名称"
>
Expand Down

0 comments on commit aceeb06

Please sign in to comment.