Skip to content

Commit 79ba3e7

Browse files
authored
Merge branch 'master' into master
2 parents 83b0852 + 5971749 commit 79ba3e7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+2031
-957
lines changed

.dumirc.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { defineConfig } from 'dumi';
2+
import path from 'path';
3+
4+
const isProdSite =
5+
// 不是预览模式 同时是生产环境
6+
process.env.PREVIEW !== 'true' && process.env.NODE_ENV === 'production';
7+
8+
const name = 'field-form';
9+
10+
export default defineConfig({
11+
alias: {
12+
'rc-field-form$': path.resolve('src'),
13+
'rc-field-form/es': path.resolve('src'),
14+
},
15+
mfsu: false,
16+
favicons: ['https://avatars0.githubusercontent.com/u/9441414?s=200&v=4'],
17+
themeConfig: {
18+
name: 'FieldForm',
19+
logo: 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4',
20+
},
21+
base: isProdSite ? `/${name}/` : '/',
22+
publicPath: isProdSite ? `/${name}/` : '/',
23+
});

.fatherrc.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
export default {
2-
cjs: 'babel',
3-
esm: { type: 'babel', importLibToEs: true },
4-
runtimeHelpers: true,
5-
preCommit: {
6-
eslint: true,
7-
prettier: true,
8-
},
9-
};
1+
import { defineConfig } from 'father';
2+
3+
export default defineConfig({
4+
plugins: ['@rc-component/father-plugin'],
5+
});

.github/FUNDING.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# These are supported funding model platforms
2+
3+
github: ant-design # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4+
patreon: # Replace with a single Patreon username
5+
open_collective: ant-design # Replace with a single Open Collective username
6+
ko_fi: # Replace with a single Ko-fi username
7+
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9+
liberapay: # Replace with a single Liberapay username
10+
issuehunt: # Replace with a single IssueHunt username
11+
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
12+
polar: # Replace with a single Polar username
13+
buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
14+
thanks_dev: # Replace with a single thanks.dev username
15+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

.github/dependabot.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
version: 2
22
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "daily"
37
- package-ecosystem: npm
48
directory: "/"
59
schedule:

.github/workflows/main.yml

Lines changed: 5 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -1,113 +1,6 @@
1-
name: CI
2-
3-
on:
4-
push:
5-
branches: [master]
6-
pull_request:
7-
branches: [master]
8-
1+
name: ✅ test
2+
on: [push, pull_request]
93
jobs:
10-
setup:
11-
runs-on: ubuntu-latest
12-
steps:
13-
- name: checkout
14-
uses: actions/checkout@master
15-
16-
- uses: actions/setup-node@v1
17-
with:
18-
node-version: '12'
19-
20-
- name: cache package-lock.json
21-
uses: actions/cache@v2
22-
with:
23-
path: package-temp-dir
24-
key: lock-${{ github.sha }}
25-
26-
- name: create package-lock.json
27-
run: npm i --package-lock-only
28-
29-
- name: hack for singe file
30-
run: |
31-
if [ ! -d "package-temp-dir" ]; then
32-
mkdir package-temp-dir
33-
fi
34-
cp package-lock.json package-temp-dir
35-
- name: cache node_modules
36-
id: node_modules_cache_id
37-
uses: actions/cache@v2
38-
with:
39-
path: node_modules
40-
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
41-
42-
- name: install
43-
if: steps.node_modules_cache_id.outputs.cache-hit != 'true'
44-
run: npm ci
45-
46-
lint:
47-
runs-on: ubuntu-latest
48-
steps:
49-
- name: checkout
50-
uses: actions/checkout@master
51-
52-
- name: restore cache from package-lock.json
53-
uses: actions/cache@v2
54-
with:
55-
path: package-temp-dir
56-
key: lock-${{ github.sha }}
57-
58-
- name: restore cache from node_modules
59-
uses: actions/cache@v2
60-
with:
61-
path: node_modules
62-
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
63-
64-
- name: lint
65-
run: npm run lint
66-
67-
needs: setup
68-
69-
compile:
70-
runs-on: ubuntu-latest
71-
steps:
72-
- name: checkout
73-
uses: actions/checkout@master
74-
75-
- name: restore cache from package-lock.json
76-
uses: actions/cache@v2
77-
with:
78-
path: package-temp-dir
79-
key: lock-${{ github.sha }}
80-
81-
- name: restore cache from node_modules
82-
uses: actions/cache@v2
83-
with:
84-
path: node_modules
85-
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
86-
87-
- name: compile
88-
run: npm run compile
89-
90-
needs: setup
91-
92-
coverage:
93-
runs-on: ubuntu-latest
94-
steps:
95-
- name: checkout
96-
uses: actions/checkout@master
97-
98-
- name: restore cache from package-lock.json
99-
uses: actions/cache@v2
100-
with:
101-
path: package-temp-dir
102-
key: lock-${{ github.sha }}
103-
104-
- name: restore cache from node_modules
105-
uses: actions/cache@v2
106-
with:
107-
path: node_modules
108-
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
109-
110-
- name: coverage
111-
run: npm test -- --coverage && bash <(curl -s https://codecov.io/bash)
112-
113-
needs: setup
4+
test:
5+
uses: react-component/rc-test/.github/workflows/test.yml@main
6+
secrets: inherit

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,14 @@
1919
.DS_Store
2020
.vscode
2121
.idea
22+
~*
2223

2324
# umi
2425
.umi
2526
.umi-production
2627
.umi-test
2728
.env.local
29+
.dumi/
30+
package-lock.json
31+
32+
bun.lockb

.umirc.ts

Lines changed: 0 additions & 19 deletions
This file was deleted.

README.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ open http://localhost:8000
2424
## Feature
2525

2626
- Support react.js and even react-native
27-
- Validate fields with [async-validator](https://github.com/yiminghe/async-validator/)
27+
- Validate fields with [@rc-component/async-validator](https://github.com/react-component/async-validator/)
2828

2929
## Install
3030

@@ -35,13 +35,13 @@ open http://localhost:8000
3535
```js | pure
3636
import Form, { Field } from 'rc-field-form';
3737

38-
const Input = ({ value = "", ...props }) => <input value={value} {...props} />;
38+
const Input = ({ value = '', ...props }) => <input value={value} {...props} />;
3939

4040
const Demo = () => {
4141
return (
4242
<Form
43-
onFinish={(values) => {
44-
console.log("Finish:", values);
43+
onFinish={values => {
44+
console.log('Finish:', values);
4545
}}
4646
>
4747
<Field name="username">
@@ -81,20 +81,20 @@ We use typescript to create the Type definition. You can view directly in IDE. B
8181

8282
### Field
8383

84-
| Prop | Description | Type | Default |
85-
| ----------------- | ----------------------------------------------------------------------------- | ------------------------------------------- | -------- |
86-
| dependencies | Will re-render if dependencies changed | [NamePath](#namepath)[] | - |
87-
| getValueFromEvent | Specify how to get value from event | (..args: any[]) => any | - |
88-
| getValueProps | Customize additional props with value. This prop will disable `valuePropName` | (value) => any | - |
89-
| initialValue | Field initial value | any | - |
90-
| name | Field name path | [NamePath](#namepath) | - |
91-
| normalize | Normalize value before update | (value, prevValue, prevValues) => any | - |
92-
| preserve | Preserve value when field removed | boolean | false |
93-
| rules | Validate rules | [Rule](#rule)[] | - |
84+
| Prop | Description | Type | Default |
85+
| ----------------- | ----------------------------------------------------------------------------- | ---------------------------------------------- | -------- |
86+
| dependencies | Will re-render if dependencies changed | [NamePath](#namepath)[] | - |
87+
| getValueFromEvent | Specify how to get value from event | (..args: any[]) => any | - |
88+
| getValueProps | Customize additional props with value. This prop will disable `valuePropName` | (value) => any | - |
89+
| initialValue | Field initial value | any | - |
90+
| name | Field name path | [NamePath](#namepath) | - |
91+
| normalize | Normalize value before update | (value, prevValue, prevValues) => any | - |
92+
| preserve | Preserve value when field removed | boolean | false |
93+
| rules | Validate rules | [Rule](#rule)[] | - |
9494
| shouldUpdate | Check if Field should update | boolean \| (prevValues, nextValues) => boolean | - |
95-
| trigger | Collect value update by event trigger | string | onChange |
96-
| validateTrigger | Config trigger point with rule validate | string \| string[] | onChange |
97-
| valuePropName | Config value mapping prop with element | string | value |
95+
| trigger | Collect value update by event trigger | string | onChange |
96+
| validateTrigger | Config trigger point with rule validate | string \| string[] | onChange |
97+
| valuePropName | Config value mapping prop with element | string | value |
9898

9999
### List
100100

bunfig.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[install]
2+
peer = false

docs/demo/basic.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
## basic
22

33

4-
<code src="../examples/basic.tsx" />
4+
<code src="../examples/basic.tsx"></code>

0 commit comments

Comments
 (0)