Skip to content

Commit

Permalink
chore(code):format
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
siyi98 authored Mar 22, 2022
2 parents e49d933 + 5797742 commit 09009a7
Show file tree
Hide file tree
Showing 187 changed files with 915 additions and 851 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,6 @@ node_modules
# custom
old-doc
test.json
/docs/guide/.test
/docs/guide/.test

/coverage
3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
"files": ".prettierrc",
"options": { "parser": "json" }
}
]
],
"plugins": ["prettier-plugin-packagejson", "./scripts/prettier-plugin"]
}
6 changes: 3 additions & 3 deletions docs/form-render/.test/1.4.0.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
* transform: true
* defaultShowCode: true
*/
import React, { useState, useEffect } from 'react';
import { Button, Space, message } from 'antd';
import { Button, message, Space } from 'antd';
import FormRender, { useForm } from 'form-render';
import { fakeApi, delay } from './advanced/utils';
import React, { useEffect, useState } from 'react';
import RichTextEditor from '../../widgets/RichText/src';
import { fakeApi } from './advanced/utils';

const Demo = () => {
const form = useForm();
Expand Down
6 changes: 3 additions & 3 deletions docs/form-render/.test/complex-bind-demo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
* transform: true
* defaultShowCode: true
*/
import React, { useState, useEffect } from 'react';
import { Button, Space, message, Tag } from 'antd';
import { Button, message, Space, Tag } from 'antd';
import FormRender, { useForm } from 'form-render';
import { fakeApi, delay } from './advanced/utils';
import React, { useEffect, useState } from 'react';
import RichTextEditor from '../../widgets/RichText/src';
import { fakeApi } from './advanced/utils';

const SelectableTag = ({ value, onChange, options }) => {
const handleChange = newValue => {
Expand Down
6 changes: 3 additions & 3 deletions docs/form-render/.test/deep-structure-validation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
* transform: true
* defaultShowCode: true
*/
import React, { useState, useEffect } from 'react';
import { Button, Space, message } from 'antd';
import { Button, message, Space } from 'antd';
import FormRender, { useForm } from 'form-render';
import { fakeApi, delay } from './advanced/utils';
import React from 'react';
import RichTextEditor from '../../widgets/RichText/src';
import { fakeApi } from './advanced/utils';

const Demo = () => {
const form = useForm();
Expand Down
6 changes: 3 additions & 3 deletions docs/form-render/.test/hidden-validate.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
* transform: true
* defaultShowCode: true
*/
import React, { useState, useEffect } from 'react';
import { Button, Space, message } from 'antd';
import { Button, message, Space } from 'antd';
import FormRender, { useForm } from 'form-render';
import { fakeApi, delay } from './advanced/utils';
import React, { useEffect, useState } from 'react';
import RichTextEditor from '../../widgets/RichText/src';
import { fakeApi } from './advanced/utils';

const Demo = () => {
const form = useForm();
Expand Down
6 changes: 3 additions & 3 deletions docs/form-render/.test/simple-migrate.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
* transform: true
* defaultShowCode: true
*/
import React, { useState, useEffect } from 'react';
import { Button, Space, message } from 'antd';
import { Button, Space } from 'antd';
import FormRender, { useForm } from 'form-render';
import { fakeApi, delay } from './advanced/utils';
import React, { useEffect, useState } from 'react';
import RichTextEditor from '../../widgets/RichText/src';
import { fakeApi } from './advanced/utils';

const Demo = () => {
const [schema, setSchema] = useState({});
Expand Down
6 changes: 3 additions & 3 deletions docs/form-render/.test/simple.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
* transform: true
* defaultShowCode: true
*/
import React, { useState, useEffect } from 'react';
import { Button, Space, message } from 'antd';
import { Button, message, Space } from 'antd';
import FormRender, { useForm } from 'form-render';
import { fakeApi, delay } from './advanced/utils';
import React, { useEffect, useState } from 'react';
import { fakeApi } from './advanced/utils';

const Demo = () => {
const form = useForm();
Expand Down
6 changes: 3 additions & 3 deletions docs/form-render/.test/simple2.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
* transform: true
* defaultShowCode: true
*/
import React, { useState, useEffect } from 'react';
import { Button, Space, message } from 'antd';
import { Button, message, Space } from 'antd';
import FormRender, { useForm } from 'form-render';
import { fakeApi, delay } from './advanced/utils';
import React, { useEffect, useState } from 'react';
import RichTextEditor from '../../widgets/RichText/src';
import { fakeApi } from './advanced/utils';

const Demo = () => {
const form = useForm();
Expand Down
2 changes: 1 addition & 1 deletion docs/form-render/.test/test-1.2.0.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { Button } from 'antd';
import FormRender, { useForm } from 'form-render';
import React from 'react';

const schema = {
type: 'object',
Expand Down
4 changes: 2 additions & 2 deletions docs/form-render/.test/test-allCollapsed.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
* transform: true
* defaultShowCode: true
*/
import React, { useState, useEffect } from 'react';
import { Button, Space, message } from 'antd';
import { Button, message, Space } from 'antd';
import FormRender, { useForm } from 'form-render';
import React, { useEffect, useState } from 'react';
import { fakeApi } from './advanced/utils';

const Demo = () => {
Expand Down
6 changes: 3 additions & 3 deletions docs/form-render/.test/test-bind-setvalue.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
* transform: true
* defaultShowCode: true
*/
import React, { useState, useEffect } from 'react';
import { Button, Space, message } from 'antd';
import { Button, message, Space } from 'antd';
import FormRender, { useForm } from 'form-render';
import { fakeApi, delay } from './advanced/utils';
import React, { useEffect, useState } from 'react';
import RichTextEditor from '../../widgets/RichText/src';
import { fakeApi } from './advanced/utils';

const Demo = () => {
const form = useForm();
Expand Down
2 changes: 1 addition & 1 deletion docs/form-render/.test/test-list-1.4.0.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { Button } from 'antd';
import FormRender, { useForm } from 'form-render';
import React from 'react';

const Ha = props => {
console.log(props, '');
Expand Down
2 changes: 1 addition & 1 deletion docs/form-render/.test/test-list.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { Button } from 'antd';
import FormRender, { useForm } from 'form-render';
import React from 'react';

const schema = {
type: 'object',
Expand Down
4 changes: 2 additions & 2 deletions docs/form-render/.test/test-setError.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { Button, Select } from 'antd';
import { Button } from 'antd';
import Form, { useForm } from 'form-render';
import React from 'react';

const schema = {
type: 'object',
Expand Down
6 changes: 3 additions & 3 deletions docs/form-render/.test/tester.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
* transform: true
* defaultShowCode: true
*/
import React, { useState, useEffect } from 'react';
import { Button, Space, message } from 'antd';
import { Button, message, Space } from 'antd';
import FormRender, { useForm } from 'form-render';
import { fakeApi, delay } from './advanced/utils';
import React, { useEffect, useState } from 'react';
import RichTextEditor from '../../widgets/RichText/src';
import { fakeApi } from './advanced/utils';

const Demo = () => {
const form = useForm();
Expand Down
6 changes: 3 additions & 3 deletions docs/form-render/.test/testing-validation-array.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
* transform: true
* defaultShowCode: true
*/
import React, { useState, useEffect } from 'react';
import { Button, Space, message } from 'antd';
import { Button, Space } from 'antd';
import FormRender, { useForm } from 'form-render';
import { fakeApi, delay } from './advanced/utils';
import React, { useEffect, useState } from 'react';
import RichTextEditor from '../../widgets/RichText/src';
import { fakeApi } from './advanced/utils';

const Demo = () => {
const form = useForm();
Expand Down
2 changes: 1 addition & 1 deletion docs/form-render/.test/very-complex-form.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { Button } from 'antd';
import Form, { useForm } from 'form-render';
import React from 'react';
const numberRule = [
{
pattern: '^(([1-9]{1}\\d*)|(0{1}))(\\.\\d{1,2})?$',
Expand Down
4 changes: 2 additions & 2 deletions docs/form-render/advanced/listDisplay.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const schema = {
type: 'string',
enum: ['a', 'b', 'c'],
enumNames: ['', '', ''],
default: 'a'
default: 'a',
},
obj: {
title: '对象',
Expand All @@ -47,7 +47,7 @@ const schema = {
title: '简单输入框',
type: 'string',
required: true,
default: '卡片列表'
default: '卡片列表',
},
select1: {
title: '单选',
Expand Down
2 changes: 1 addition & 1 deletion docs/form-render/demo/FR.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import FormRender, { useForm } from 'form-render';
import React from 'react';

const Demo = ({ schema }) => {
const form = useForm();
Expand Down
2 changes: 1 addition & 1 deletion docs/form-render/demo/bind-example.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import FormRender, { useForm } from 'form-render';
import React from 'react';

const delay = ms => new Promise(res => setTimeout(res, ms));

Expand Down
2 changes: 1 addition & 1 deletion docs/form-render/demo/display.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import FormRender, { useForm } from 'form-render';
import React from 'react';

const Demo = props => {
const form = useForm();
Expand Down
2 changes: 1 addition & 1 deletion docs/form-render/demo/index.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState } from 'react';
import FormRender, { useForm } from 'form-render';
import React, { useState } from 'react';
import schema from './basic.js';
import Percent from './otherWidgets/Percent';
// import schema1 from './basic1.json';
Expand Down
4 changes: 2 additions & 2 deletions docs/form-render/demo/otherWidgets/Percent.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useEffect } from 'react';
import { Progress, Button } from 'antd';
import { MinusOutlined, PlusOutlined } from '@ant-design/icons';
import { Button, Progress } from 'antd';
import React from 'react';

const App = ({ percent = 0, onPress = () => {} }) => {
const increase = () => {
Expand Down
2 changes: 1 addition & 1 deletion docs/form-render/demo/simple.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import FormRender, { useForm } from 'form-render';
import React from 'react';

const delay = ms => new Promise(res => setTimeout(res, ms));

Expand Down
2 changes: 1 addition & 1 deletion docs/form-render/demo/simple1.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState } from 'react';
import { Button } from 'antd';
import FormRender, { useForm } from 'form-render';
import React, { useState } from 'react';
import testSchema from './testJson.json';

const schema = {
Expand Down
4 changes: 2 additions & 2 deletions docs/form-render/demos/customMessage.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState, useEffect } from 'react';
import { Button, Input } from 'antd';
import { Button } from 'antd';
import FormRender, { useForm } from 'form-render';
import React from 'react';

const Demo = () => {
const form = useForm();
Expand Down
4 changes: 2 additions & 2 deletions docs/form-render/demos/dependencies.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { Button, message, Input } from 'antd';
import { Button, Input, message } from 'antd';
import FormRender, { useForm } from 'form-render';
import React from 'react';

const { TextArea } = Input;

Expand Down
2 changes: 1 addition & 1 deletion docs/form-render/demos/doubleBind.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState, useEffect } from 'react';
import { Button, Checkbox } from 'antd';
import FormRender, { useForm } from 'form-render';
import React from 'react';

const MyCheckbox = ({ addons }) => {
const { dependValues, setValueByPath } = addons;
Expand Down
4 changes: 2 additions & 2 deletions docs/form-render/demos/listExpression.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState, useEffect } from 'react';
import { Button, Input } from 'antd';
import { Button } from 'antd';
import FormRender, { useForm } from 'form-render';
import React from 'react';

const Demo = () => {
const form = useForm();
Expand Down
4 changes: 2 additions & 2 deletions docs/form-render/demos/rightPath.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState, useEffect } from 'react';
import { Button, Input } from 'antd';
import { Button } from 'antd';
import FormRender, { useForm } from 'form-render';
import React from 'react';

const Demo = () => {
const form = useForm();
Expand Down
4 changes: 2 additions & 2 deletions docs/form-render/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -305,11 +305,11 @@ export default connectForm(Demo);
**form 方法**

| 参数 | 描述 | 类型 |
| ---------------- | --------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| ---------------- | --------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ----------------- |
| submit | 触发提交流程,一般在提交按钮上使用 | `() => void` |
| resetFields | 清空表单(也会清空一些内置状态,例如校验) | `({formData?: any, submitData?: any, errorFields?: Error[], touchedKeys?: any[], allTouched?: boolean}) => void` |
| errorFields | 表单校验错误的数组 | `array,[{name, error: []}]` |
| setErrorFields | 外部手动修改 errorFields 校验信息,用于外部校验回填 | `(error: Error | Error[]) => void` |
| setErrorFields | 外部手动修改 errorFields 校验信息,用于外部校验回填 | `(error: Error | Error[]) => void` |
| setValues | 外部手动修改 formData,用于已填写的表单的数据回填 | `(formData: any) => void` |
| setValueByPath | 外部修改指定单个 field 的数据(原名 onItemChange) | `(path: string, value: any) => void` |
| setSchemaByPath | 指定路径修改 schema | `(path: string, value: any) => void` |
Expand Down
2 changes: 1 addition & 1 deletion docs/generator/demo/layout.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import Generator from 'fr-generator';
import React from 'react';
import './index.less';

const { Provider, Sidebar, Canvas, Settings } = Generator;
Expand Down
4 changes: 2 additions & 2 deletions docs/generator/demo/modal.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState, useRef } from 'react';
import { Button, Input, Modal } from 'antd';
import Generator from 'fr-generator';
import { Button, Modal, Input } from 'antd';
import React, { useRef, useState } from 'react';
const { TextArea } = Input;

const defaultValue = {
Expand Down
7 changes: 3 additions & 4 deletions docs/generator/demo/playground.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import React, { useState, useRef, useEffect } from 'react';
import { useHistory } from 'umi';
import Generator from 'fr-generator';
import React, { useEffect, useRef } from 'react';
import './index.less';

const Demo = () => {
const ref = useRef();

useEffect(() => {
window.onbeforeunload = function(e) {
window.onbeforeunload = function (e) {
e = e || window.event;
// 兼容IE8和Firefox 4之前的版本
if (e) {
Expand Down
4 changes: 2 additions & 2 deletions docs/generator/demo/settings.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react';
import Generator, {
defaultSettings,
defaultCommonSettings,
defaultGlobalSettings,
defaultSettings,
} from 'fr-generator';
import React from 'react';

const NewWidget = ({ value = 0, onChange }) => (
<button onClick={() => onChange(value + 1)}>{value}</button>
Expand Down
Loading

0 comments on commit 09009a7

Please sign in to comment.