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

refactor: form #1118

Merged
merged 12 commits into from
Jun 14, 2023
Merged

refactor: form #1118

merged 12 commits into from
Jun 14, 2023

Conversation

oasis-cloud
Copy link
Collaborator

🤔 这个变动的性质是?

  • 新特性提交

🔗 相关 Issue

💡 需求背景和解决方案

☑️ 请求合并前的自查清单

⚠️ 请自检并全部勾选全部选项⚠️

  • 文档已补充
  • 代码演示已提供
  • TypeScript 定义已补充或无须补充
  • fock仓库代码是否为最新避免文件冲突

@codecov
Copy link

codecov bot commented Jun 12, 2023

Codecov Report

Merging #1118 (16d3e9b) into next (36e0d14) will increase coverage by 0.46%.
The diff coverage is 81.48%.

@@            Coverage Diff             @@
##             next    #1118      +/-   ##
==========================================
+ Coverage   70.27%   70.74%   +0.46%     
==========================================
  Files         187      194       +7     
  Lines        7579     7796     +217     
  Branches     2184     2231      +47     
==========================================
+ Hits         5326     5515     +189     
- Misses       2043     2069      +26     
- Partials      210      212       +2     
Impacted Files Coverage Δ
src/packages/button/button.tsx 73.52% <ø> (ø)
src/packages/form/index.ts 100.00% <ø> (ø)
src/packages/picker/picker.tsx 91.39% <72.72%> (-2.00%) ⬇️
src/packages/formitem/formitem.tsx 86.48% <80.76%> (ø)
src/packages/form/form.tsx 82.92% <83.33%> (ø)
src/packages/form/useform.ts 90.54% <84.84%> (ø)
src/utils/is-forward-ref-component.ts 85.71% <85.71%> (ø)
src/packages/form/context.ts 100.00% <100.00%> (ø)
src/packages/popup/popup.tsx 85.55% <100.00%> (+0.16%) ⬆️

... and 6 files with indirect coverage changes

Copy link
Collaborator

@xiaoyatong xiaoyatong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. from v1 文档更新
  2. formitem config.json 中更新到2.0.0,及支持 taro
  3. demo 支持多语言
  4. demo 联系电话的placeholder 可改为 请输入电话号码
  5. demo picker 可以给一下> 箭头标识,使其看起来可点击
  6. demo 保持多语言一致性
  7. demo 基础用法,点击提交,无反馈
  8. demo 表单类型模块,可以直接提交,且能通过校验;删除uploader 的图片,点击重置,无法重置;

Copy link
Collaborator

@xiaoyatong xiaoyatong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

组件内console 注意移除。

@@ -442,14 +442,14 @@
"author": "dsj"
},
{
"version": "1.0.0",
"version": "2.0.0",
"name": "Form",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FormItem 需要处理

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix

:::

### Top Align
### form validation
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

大写

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix

### Props

| Property | Description | Type | Default |
|----------------|--------------|-----------|---|
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

数据类型 ``

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix

| form | 经 Form.useForm() 创建的 form 控制实例,不提供时会自动创建 | `FormInstance` | `-` |
| footer | 表单底部区域,一般放置确认和重置按钮 | `ReactNode` | `null` |
| initialValues | 表单初始值 | `any` | `-` |
| name | 表单名称 | `any` | `\` |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\ 改为 -?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix

| max | 必须设置 type:string 类型为字符串最大长度;number 类型时为最大值;array 类型时为数组最大长度 | `number` |
| min | 必须设置 type:string 类型为字符串最小长度;number 类型时为最小值;array 类型时为数组最小长度 | `number` |
| pattern | 正则表达式匹配 | `number` |
| pattern | 正则表达式匹配 | `RegExp` |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这两个什么区别?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

复制错了,已删除

| 属性 | 说明 | 类型 |
|----------------| --- | --- |
| getFieldValue | 获取对应字段名的值 | (name: NamePath) => any |
| setFieldsValue | 设置表单的值 | (values) => void |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get 和 set 是不是要成对,可都支持单个和多个。

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

之后版本逐步扩充功能


| 属性 | 说明 | 类型 |
|----------------| --- | --- |
| getFieldValue | 获取对应字段名的值 | (name: NamePath) => any |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

类型需 ``

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix

@@ -46,94 +68,85 @@ class FormStore {
...this.store,
...newStore,
}

console.log('setFieldsValue', this.store)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

移除注释

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix


this.fieldEntities.forEach((enetity: FieldEntity) => {
enetity.onStoreChange()
console.log('resetFields', this.store, this.initialValues)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

移除注释

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix

submit: this.submit,
store: this.store,
errList: this.errList,
errList: this.errors,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个为什么不能叫 errors?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix

@oasis-cloud
Copy link
Collaborator Author

uploader 组件的 filelist 变化后,需要有相应的 change 触发。目前 uploader 组件内部没有触发 change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants