Skip to content

Commit 46a537e

Browse files
authored
Merge pull request #205 from codebdy/add-yup-validation
Add yup validation
2 parents aa73036 + da67ca5 commit 46a537e

File tree

180 files changed

+1215
-568
lines changed

Some content is hidden

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

180 files changed

+1215
-568
lines changed

apps/example-antd5/package.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,14 @@
2828
"@rxdrag/shared": "workspace:*",
2929
"@rxdrag/minions-runtime-react": "workspace:*",
3030
"@rxdrag/controller-editor-antd5": "workspace:*",
31+
"@rxdrag/react-antd-shell-inline": "workspace:*",
32+
"example-common": "workspace:*",
33+
"controller-editor-example": "workspace:*",
34+
"logicflow-editor-example": "workspace:*",
35+
"inline-editor-example": "workspace:*",
3136
"antd": "^5.6.2",
3237
"axios": "^1.4.0",
38+
"styled-components": "^5.3.9",
3339
"classnames": "^2.3.2",
3440
"mockjs": "^1.1.0",
3541
"react": "^18.2.0",
@@ -45,8 +51,9 @@
4551
"@types/react-dom": "^18.0.11",
4652
"@vitejs/plugin-react": "^3.1.0",
4753
"@types/lodash": "^4.14.191",
54+
"@types/styled-components": "^5.1.26",
4855
"typescript": "^4.9.3",
4956
"vite": "^4.2.0",
5057
"vite-plugin-require-transform": "^1.0.9"
5158
}
52-
}
59+
}

apps/example-antd5/src/App.tsx

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@ import { Routes, Route } from 'react-router-dom';
22
import './App.css';
33
import { IFrameCanvasRender } from '@rxdrag/react-core';
44
import { IFramePreviewRender } from "@rxdrag/react-antd-shell"
5-
import { usePredefinedComponents } from './hooks/usePredefinedComponents';
6-
import { Antd5Example } from './Antd5Example';
5+
import { Antd5Example } from './normal/Antd5Example';
76
import { useMemo } from 'react';
8-
import { controllerDefines } from 'controller/defines';
97
import { ControllerFactories } from '@rxdrag/react-runner';
8+
import { controllerDefines } from 'normal/controller/defines';
9+
import { usePredefinedComponents } from 'normal/hooks/usePredefinedComponents';
10+
import { routes } from 'example-common';
11+
import { InlineEditorExample } from "inline-editor-example";
12+
import { LogicflowEditorExample } from "logicflow-editor-example";
13+
import { ControllerEditorExample } from "controller-editor-example";
1014

1115
function App() {
1216
const { designers, components } = usePredefinedComponents()
@@ -22,15 +26,21 @@ function App() {
2226

2327
return (
2428
<Routes>
25-
<Route path={'/'} element={<Antd5Example />}>
29+
<Route path={routes.index} element={<Antd5Example />}>
30+
</Route>
31+
<Route path={routes.inline} element={<InlineEditorExample />}>
32+
</Route>
33+
<Route path={routes.controller} element={<ControllerEditorExample />}>
34+
</Route>
35+
<Route path={routes.logicflow} element={<LogicflowEditorExample />}>
2636
</Route>
2737
<Route path={'/canvas-render'} element={<IFrameCanvasRender designers={designers} />}>
2838
</Route>
2939
<Route path={'/preview-render'} element={<IFramePreviewRender components={components} controllerFactories={controllerFactories} />}>
3040
</Route>
3141
</Routes>
3242

33-
);
43+
);//
3444
}
3545

3646
export default App;

apps/example-antd5/src/Antd5Example.tsx renamed to apps/example-antd5/src/normal/Antd5Example.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@ import {
1313
historyIcon,
1414
outlineIcon,
1515
} from "@rxdrag/react-antd-shell"
16-
import { toolsLocales } from "./locales"
16+
import { toolsLocales } from "../locales"
1717
import { ResourceWidget } from "./ResourceWidget"
1818
import { SaveButton } from "./widgets/SaveButton"
1919
import { PagesWidget } from "./PagesWidget"
2020
import { pages } from "./data"
21-
import { minionsLocales } from "controller/locales"
22-
import { minionsMaterialCategories } from "controller/materials"
23-
import { controllerDefines } from "controller/defines"
21+
import { minionsLocales } from "normal/controller/locales"
22+
import { minionsMaterialCategories } from "normal/controller/materials"
23+
import { controllerDefines } from "normal/controller/defines"
24+
import { MenuButton } from "example-common"
2425

2526
export enum LeftNavType {
2627
pages = "pages",
@@ -69,7 +70,9 @@ export const Antd5Example = memo(() => {
6970
}
7071
topBar={
7172
<>
72-
<Logo />
73+
<Space>
74+
<Logo />
75+
</Space>
7376
<Space>
7477
<ThemeButton />
7578
<LangButtons />
@@ -79,6 +82,7 @@ export const Antd5Example = memo(() => {
7982
icon={<GithubFilled />}
8083
> Github</Button>
8184
<SaveButton />
85+
<MenuButton />
8286
</Space>
8387
</>
8488
}
Lines changed: 1 addition & 0 deletions

apps/example-antd5/src/ResourceWidget/index.tsx renamed to apps/example-antd5/src/normal/ResourceWidget/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ComponentResourceWidget, PaneContainer, TemplateResourceWidget } from "@rxdrag/react-antd-shell"
22
import { useSettersTranslate, useRegisterComponentMaterial } from "@rxdrag/react-core"
3-
import { materials, fields } from "materials"
3+
import { materials, fields } from "normal/materials"
44
import { memo, useEffect } from "react"
55
import { FieldMaterial } from "@rxdrag/react-antd-materials"
66
import { ResourceCollapsePanel } from "./ResourceCollapsePanel"

apps/example-antd5/src/controller/defines/ShortcutControllerSetter.tsx renamed to apps/example-antd5/src/normal/controller/defines/ShortcutControllerSetter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useSettersTranslate } from "@rxdrag/react-core"
22
import { Form, Input, Select } from "antd"
3-
import { ActionType, IShortcutControllerMeta } from "controller/shortcuts/IShortcutControllerMeta"
3+
import { ActionType, IShortcutControllerMeta } from "normal/controller/shortcuts/IShortcutControllerMeta"
44
import { memo, useCallback } from "react"
55

66
export const ShortcutControllerSetter = memo((props: {

apps/example-antd5/src/controller/defines/index.tsx renamed to apps/example-antd5/src/normal/controller/defines/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { logicFlowLocales } from "./locales/logicflow";
44
import { scriptLocales } from "./locales/script";
55
import { ShortcutControllerSetter } from "./ShortcutControllerSetter";
66
import { LogicFlowControllerSetter, ScriptControllerSetter } from "@rxdrag/react-antd-shell";
7-
import { ShortcutControllerFactory } from "controller/shortcuts";
87
import { IControllerDefine } from "@rxdrag/react-antd-shell";
8+
import { ShortcutControllerFactory } from "../shortcuts";
99

1010
export const controllerDefines: IControllerDefine[] = [
1111
{

apps/example-antd5/src/data/form-validation.json renamed to apps/example-antd5/src/normal/data/form-validation.json

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,15 @@
142142
},
143143
"x-field": {
144144
"type": "normal",
145-
"name": "age"
145+
"name": "age",
146+
"validateRules": {
147+
"rules": {
148+
"required": {
149+
"value": true
150+
}
151+
},
152+
"required": true
153+
}
146154
},
147155
"slots": {},
148156
"children": [
@@ -163,7 +171,18 @@
163171
},
164172
"x-field": {
165173
"type": "normal",
166-
"name": "name"
174+
"name": "name",
175+
"validateRules": {
176+
"rules": {
177+
"required": {
178+
"value": true
179+
}
180+
},
181+
"type": {
182+
"value": "email"
183+
},
184+
"required": true
185+
}
167186
},
168187
"slots": {},
169188
"children": [

apps/example-antd5/src/materials/business/News/index.ts renamed to apps/example-antd5/src/normal/materials/business/News/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { IComponentMaterial } from "@rxdrag/react-core";
2-
import { News } from "components/business/News";
2+
import { News } from "normal/components/business/News";
33
import { newsIcon } from "./icon";
44
import { newsLocales, newsResourceLocales } from "./locales";
55
import { newsSchema } from "./schema";

apps/example-antd5/src/materials/business/Notices/index.ts renamed to apps/example-antd5/src/normal/materials/business/Notices/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { IComponentMaterial } from "@rxdrag/react-core";
2-
import { Notices } from "components/business/Notices";
32
import { noticesIcon } from "./icon";
43
import { noticesLocales, noticesResourceLocales } from "./locales";
54
import { noticesSchema } from "./schema";
5+
import { Notices } from "normal/components/business/Notices";
66

77
const name = "Notices"
88
export const NoticesMaterial: IComponentMaterial = {

apps/example-antd5/src/materials/business/RightAd/index.ts renamed to apps/example-antd5/src/normal/materials/business/RightAd/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { IComponentMaterial } from "@rxdrag/react-core";
2-
import { RightAd } from "components/business/RightAd";
2+
import { RightAd } from "normal/components/business/RightAd";
33
import { rightAdIcon } from "./icon";
44
import { rightAdLocales, rightAdResourceLocales } from "./locales";
55
import { rightAdSchema } from "./schema";

apps/example-antd5/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@
1919
//"target": "ES5",
2020
"experimentalDecorators": true
2121
},
22-
"include": ["src"],
22+
"include": ["src", "../../examples/example-common/src/index.ts"],
2323
"references": [{ "path": "./tsconfig.node.json" }]
2424
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"root": true,
3+
"extends": ["@rxdrag/eslint-config-custom"]
4+
}

examples/controller-editor-example/index.html

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './src';
Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,37 @@
11
{
22
"name": "controller-editor-example",
3+
"version": "0.3.0",
34
"private": true,
4-
"version": "0.2.3",
5-
"type": "module",
5+
"module": "index.ts",
6+
"files": [
7+
"dist"
8+
],
9+
"publishConfig": {
10+
"module": "dist/index.mjs",
11+
"typings": "dist/index.d.ts",
12+
"access": "public"
13+
},
614
"scripts": {
7-
"dev": "vite",
8-
"build": "tsc && vite build",
9-
"preview": "vite preview"
15+
"lint": "eslint . --ext .ts,tsx",
16+
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist",
17+
"build": "vite build"
18+
},
19+
"devDependencies": {
20+
"@types/react": "^18.0.28",
21+
"@types/react-dom": "^18.0.11",
22+
"react": "^18.2.0",
23+
"react-dom": "^18.2.0",
24+
"eslint": "^7.32.0",
25+
"@rxdrag/eslint-config-custom": "workspace:*",
26+
"@rxdrag/tsconfig": "workspace:*",
27+
"@types/styled-components": "^5.1.26",
28+
"vite-tsconfig-paths": "^4.0.7",
29+
"web-vitals": "^3.3.0"
30+
},
31+
"peerDependencies": {
32+
"react": "^18.2.0",
33+
"react-dom": "^18.2.0",
34+
"react-router-dom": "^6.8.1"
1035
},
1136
"dependencies": {
1237
"@ant-design/icons": "^4.8.0",
@@ -18,22 +43,12 @@
1843
"@rxdrag/minions-react-materials": "workspace:*",
1944
"@rxdrag/minions-schema": "workspace:*",
2045
"@rxdrag/react-fieldy": "workspace:*",
46+
"example-common": "workspace:*",
2147
"antd": "^5.6.2",
2248
"classnames": "^2.3.2",
2349
"react": "^18.2.0",
2450
"react-dom": "^18.2.0",
2551
"react-router-dom": "^6.9.0",
26-
"styled-components": "^5.3.9",
27-
"vite-tsconfig-paths": "^4.0.7",
28-
"web-vitals": "^3.3.0"
29-
},
30-
"devDependencies": {
31-
"@rxdrag/tsconfig": "workspace:*",
32-
"@types/react": "^18.0.28",
33-
"@types/react-dom": "^18.0.11",
34-
"@vitejs/plugin-react": "^3.1.0",
35-
"typescript": "^4.9.3",
36-
"vite": "^4.2.0",
37-
"vite-plugin-require-transform": "^1.0.9"
52+
"styled-components": "^5.3.9"
3853
}
39-
}
54+
}

examples/controller-editor-example/public/1.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.
Binary file not shown.
Binary file not shown.
Binary file not shown.

examples/controller-editor-example/public/logo.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.
Binary file not shown.
Binary file not shown.
Binary file not shown.

examples/controller-editor-example/public/robots.txt

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

examples/controller-editor-example/public/vite.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

examples/controller-editor-example/src/App.css

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

examples/controller-editor-example/src/App.test.tsx

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

examples/controller-editor-example/src/App.tsx

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

0 commit comments

Comments
 (0)