Skip to content

Commit 3534e8b

Browse files
committed
add packages
1 parent c344e2e commit 3534e8b

50 files changed

Lines changed: 1184 additions & 119 deletions

Some content is hidden

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

apps/app-mobile/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@
99
"preview": "rsbuild preview"
1010
},
1111
"dependencies": {
12+
"@coding-form/form-antd-mobile": "workspace:*",
13+
"antd-mobile": "^5.42.3",
1214
"react": "^18.3.1",
1315
"react-dom": "^18.3.1"
1416
},
1517
"devDependencies": {
18+
"@coding-form/form-types": "workspace:*",
1619
"@rsbuild/core": "^1.7.1",
1720
"@rsbuild/plugin-react": "^1.4.2",
1821
"@types/react": "^18.3.18",

apps/app-mobile/src/App.css

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,5 @@
11
body {
2-
margin: 0;
3-
color: #fff;
4-
font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
5-
background-image: linear-gradient(to bottom, #020917, #101725);
2+
margin: 0 !important;
3+
padding: 0 !important;
64
}
75

8-
.content {
9-
display: flex;
10-
min-height: 100vh;
11-
line-height: 1.1;
12-
text-align: center;
13-
flex-direction: column;
14-
justify-content: center;
15-
}
16-
17-
.content h1 {
18-
font-size: 3.6rem;
19-
font-weight: 700;
20-
}
21-
22-
.content p {
23-
font-size: 1.2rem;
24-
font-weight: 400;
25-
opacity: 0.5;
26-
}

apps/app-mobile/src/App.tsx

Lines changed: 66 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,71 @@
1-
import './App.css';
1+
import {createAntdForm, FormAntdView} from "@coding-form/form-antd-mobile";
2+
import type {FormMeta} from "@coding-form/form-types";
3+
import {Button, Space} from "antd-mobile";
24

35
const App = () => {
4-
return (
5-
<div className="content">
6-
<h1>Rsbuild with React</h1>
7-
<p>Start building amazing things with Rsbuild.</p>
8-
</div>
9-
);
6+
7+
const meta: FormMeta = {
8+
name: "请假单",
9+
code: "leave",
10+
fields: [
11+
{
12+
id: "1",
13+
name: '姓名',
14+
code: 'name',
15+
type: "string",
16+
dataType: 'STRING',
17+
hidden: false,
18+
required: true,
19+
}
20+
],
21+
subForms: []
22+
}
23+
24+
const form = createAntdForm();
25+
26+
return (
27+
<div>
28+
<FormAntdView
29+
meta={meta}
30+
form={form}
31+
/>
32+
33+
<Space>
34+
<Button
35+
onClick={() => {
36+
form.submit();
37+
}}
38+
>submit</Button>
39+
40+
<Button
41+
onClick={() => {
42+
const values = form.getFieldsValue();
43+
console.log(values);
44+
}}
45+
>getValues</Button>
46+
47+
<Button
48+
onClick={() => {
49+
form.setFieldsValue({
50+
name: "123"
51+
});
52+
}}
53+
>setValues</Button>
54+
55+
<Button
56+
onClick={() => {
57+
form.hiddenFields(['name']);
58+
}}
59+
>hidden</Button>
60+
61+
<Button
62+
onClick={() => {
63+
form.showFields(['name']);
64+
}}
65+
>show</Button>
66+
</Space>
67+
</div>
68+
);
1069
};
1170

1271
export default App;

apps/app-pc/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@
1010
},
1111
"dependencies": {
1212
"@coding-form/form-antd": "workspace:*",
13+
"antd": "^6.2.1",
1314
"react": "^18.3.1",
1415
"react-dom": "^18.3.1"
1516
},
1617
"devDependencies": {
18+
"@coding-form/form-types": "workspace:*",
1719
"@rsbuild/core": "^1.7.1",
1820
"@rsbuild/plugin-react": "^1.4.2",
1921
"@types/react": "^18.3.18",

apps/app-pc/src/App.css

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,6 @@
11
body {
2-
margin: 0;
3-
color: #fff;
4-
font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
5-
background-image: linear-gradient(to bottom, #020917, #101725);
2+
margin: 0 !important;
3+
padding: 0 !important;
64
}
75

8-
.content {
9-
display: flex;
10-
min-height: 100vh;
11-
line-height: 1.1;
12-
text-align: center;
13-
flex-direction: column;
14-
justify-content: center;
15-
}
16-
17-
.content h1 {
18-
font-size: 3.6rem;
19-
font-weight: 700;
20-
}
216

22-
.content p {
23-
font-size: 1.2rem;
24-
font-weight: 400;
25-
opacity: 0.5;
26-
}

apps/app-pc/src/App.tsx

Lines changed: 66 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,71 @@
1-
import './App.css';
2-
import {FormAntdView} from "@coding-form/form-antd";
1+
import {createAntdForm, FormAntdView} from "@coding-form/form-antd";
2+
import type {FormMeta} from "@coding-form/form-types";
3+
import {Button, Space} from "antd";
34

45
const App = () => {
5-
return (
6-
<div className="content">
7-
<h1>Rsbuild with React</h1>
8-
<p>Start building amazing things with Rsbuild.</p>
9-
10-
<FormAntdView/>
11-
</div>
12-
);
6+
7+
const meta: FormMeta = {
8+
name: "请假单",
9+
code: "leave",
10+
fields: [
11+
{
12+
id: "1",
13+
name: '姓名',
14+
code: 'name',
15+
type: "string",
16+
dataType: 'STRING',
17+
hidden: false,
18+
required: true,
19+
}
20+
],
21+
subForms: []
22+
}
23+
24+
const form = createAntdForm();
25+
26+
return (
27+
<div>
28+
<FormAntdView
29+
meta={meta}
30+
form={form}
31+
/>
32+
33+
<Space>
34+
<Button
35+
onClick={() => {
36+
form.submit();
37+
}}
38+
>submit</Button>
39+
40+
<Button
41+
onClick={() => {
42+
const values = form.getFieldsValue();
43+
console.log(values);
44+
}}
45+
>getValues</Button>
46+
47+
<Button
48+
onClick={() => {
49+
form.setFieldsValue({
50+
name: "123"
51+
});
52+
}}
53+
>setValues</Button>
54+
55+
<Button
56+
onClick={() => {
57+
form.hiddenFields(['name']);
58+
}}
59+
>hidden</Button>
60+
61+
<Button
62+
onClick={() => {
63+
form.showFields(['name']);
64+
}}
65+
>show</Button>
66+
</Space>
67+
</div>
68+
);
1369
};
1470

1571
export default App;

package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@
44
"description": "",
55
"main": "index.js",
66
"scripts": {
7-
"build:form-antd": "pnpm -F @coding-form/form-antd build",
87
"build:form-types": "pnpm -F @coding-form/form-types build",
9-
"build": "pnpm run build:form-types && pnpm run build:form-antd",
8+
"build:form-presenter": "pnpm -F @coding-form/form-presenter build",
9+
"build:form-antd": "pnpm -F @coding-form/form-antd build",
10+
"build:form-antd-mobile": "pnpm -F @coding-form/form-antd-mobile build",
11+
"build": "pnpm run build:form-types && pnpm run build:form-presenter && pnpm run build:form-antd && pnpm run build:form-antd-mobile",
12+
"watch:form-presenter": "pnpm -F @coding-form/form-presenter dev",
1013
"watch:form-antd": "pnpm -F @coding-form/form-antd dev",
14+
"watch:form-antd-mobile": "pnpm -F @coding-form/form-antd-mobile dev",
1115
"dev:app-pc": "pnpm -F @form-example/app-pc dev",
1216
"dev:app-mobile": "pnpm -F @form-example/app-mobile dev",
1317
"clean": "pnpm cleaninstall-node"
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Local
2+
.DS_Store
3+
*.local
4+
*.log*
5+
6+
# Dist
7+
node_modules
8+
dist/
9+
storybook-static
10+
doc_build/
11+
12+
# IDE
13+
.vscode/*
14+
!.vscode/extensions.json
15+
.idea
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# AGENTS.md
2+
3+
You are an expert in JavaScript, Rspack, Rsbuild, Rslib, and library development. You write maintainable, performant, and accessible code.
4+
5+
## Commands
6+
7+
- `pnpm run build` - Build the library for production
8+
- `pnpm run dev` - Turn on watch mode, watch for changes and rebuild the library
9+
10+
## Docs
11+
12+
- Rslib: https://rslib.rs/llms.txt
13+
- Rsbuild: https://rsbuild.rs/llms.txt
14+
- Rspack: https://rspack.rs/llms.txt
15+
- Rstest: https://rstest.rs/llms.txt
16+
17+
## Tools
18+
19+
### Rstest
20+
21+
- Run `pnpm run test` to run tests
22+
- Run `pnpm run test:watch` to run tests in watch mode
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Rslib project
2+
3+
## Setup
4+
5+
Install the dependencies:
6+
7+
```bash
8+
pnpm install
9+
```
10+
11+
## Get started
12+
13+
Build the library:
14+
15+
```bash
16+
pnpm run build
17+
```
18+
19+
Build the library in watch mode:
20+
21+
```bash
22+
pnpm run dev
23+
```

0 commit comments

Comments
 (0)