Skip to content

Commit

Permalink
docs: add docs api
Browse files Browse the repository at this point in the history
  • Loading branch information
97vack committed Jul 9, 2024
1 parent 995dd7c commit d56d00a
Show file tree
Hide file tree
Showing 60 changed files with 454 additions and 108 deletions.
25 changes: 12 additions & 13 deletions docs/api/apiChildJSON/docs_api_apiDocs_apiEffect.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@
"description": "The current form item uid."
}
},
"setValue": {
"defaultValue": null,
"name": "setValue",
"type": {
"name": "(value?: any) => void"
},
"tags": {
"localKey": "API.formItem.setValue.desc",
"description": "Set the value of the form item for external calls"
}
},
"clearValidate": {
"defaultValue": null,
"name": "clearValidate",
Expand Down Expand Up @@ -57,18 +68,6 @@
"resetType": "(bindId?: string | string[]) => void"
}
},
"setValue": {
"defaultValue": null,
"name": "setValue",
"type": {
"name": "(bindId: any, value: any) => void"
},
"tags": {
"description": "Set form item value",
"localKey": "API.form.setValue.desc",
"param": "bindId"
}
},
"setError": {
"defaultValue": null,
"name": "setError",
Expand All @@ -86,7 +85,7 @@
"defaultValue": null,
"name": "validate",
"type": {
"name": "() => Promise<unknown>"
"name": "(bindId?: string | string[] | undefined) => Promise<unknown>"
},
"tags": {
"localKey": "API.form.share.validate.desc",
Expand Down
10 changes: 10 additions & 0 deletions docs/api/apiChildJSON/docs_api_apiDocs_contextProps.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
{
"model": {
"defaultValue": null,
"name": "model",
"type": {
"name": "Record<string, any>"
},
"tags": {
"description": "form model"
}
},
"mounted": {
"defaultValue": null,
"name": "mounted",
Expand Down
2 changes: 1 addition & 1 deletion docs/api/apiChildJSON/docs_api_apiDocs_renderConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@
"defaultValue": null,
"name": "contextProps",
"type": {
"name": "ContextProps"
"name": "ContextProps<Record<string, any>>"
},
"tags": {
"localKey": "API.form.global.props.form.share.contextProps",
Expand Down
9 changes: 9 additions & 0 deletions docs/api/apiDocs/useSubscribe.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* @order 10
* @name useSubscribe
* @pageTitle useSubscribe
* @toc false
* @groupOrder 10
* @embed /defaultContent/_useSubscribe.md
*/
export default function App(props: {}) {}
9 changes: 9 additions & 0 deletions docs/api/apiDocs/useWatch.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* @order 10
* @name useWatch
* @pageTitle useWatch
* @toc false
* @groupOrder 9
* @embed /defaultContent/_useWatch.md
*/
export default function App(props: {}) {}
1 change: 1 addition & 0 deletions docs/api/defaultContent/_useFormStart.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export default function App() {
setValues,
useSubscribe,
useWatch,
watch,
validate,
reset,
removeValidator,
Expand Down
8 changes: 8 additions & 0 deletions docs/api/defaultContent/_useSubscribe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
```jsx | pure
import { useForm, useSubscribe } from 'react-form-simple';

export default function App() {
const { contextProps } = useForm({ name: 'name' });
const subscribeName = useSubscribe(contextProps, ({ model }) => model.name);
}
```
13 changes: 13 additions & 0 deletions docs/api/defaultContent/_useWatch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
```jsx | pure
import { useForm, useWatch } from 'react-form-simple';

export default function App() {
const { model, contextProps } = useForm({ name: 'name' });

useWatch(
contextProps,
({ model }) => model.name,
(value, preValue) => {},
);
}
```
2 changes: 1 addition & 1 deletion docs/api/formItemProps.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ group:
### fullWidth
<APIWrap apiInstance="{&quot;defaultValue&quot;:{&quot;value&quot;:&quot;false&quot;},&quot;name&quot;:&quot;fullWidth&quot;,&quot;type&quot;:{&quot;name&quot;:&quot;boolean&quot;},&quot;tags&quot;:{&quot;localKey&quot;:&quot;API.form.global.props.form.share.fullWidth&quot;,&quot;description&quot;:&quot;Whether the width of the form item fills the entire row&quot;}}" ></APIWrap>
### contextProps
<APIWrap apiInstance="{&quot;defaultValue&quot;:null,&quot;name&quot;:&quot;contextProps&quot;,&quot;type&quot;:{&quot;name&quot;:&quot;ContextProps&quot;},&quot;tags&quot;:{&quot;localKey&quot;:&quot;API.form.global.props.form.share.contextProps&quot;,&quot;resetType&quot;:&quot;ContextProps&quot;,&quot;infoTitle&quot;:&quot;prop&quot;,&quot;infoPath&quot;:&quot;docs_api_apiDocs_contextProps&quot;,&quot;description&quot;:&quot;Form item option life cycle. Where dependencies are collected for the entire form&quot;}}" ></APIWrap>
<APIWrap apiInstance="{&quot;defaultValue&quot;:null,&quot;name&quot;:&quot;contextProps&quot;,&quot;type&quot;:{&quot;name&quot;:&quot;ContextProps<Record<string, any>>&quot;},&quot;tags&quot;:{&quot;localKey&quot;:&quot;API.form.global.props.form.share.contextProps&quot;,&quot;resetType&quot;:&quot;ContextProps&quot;,&quot;infoTitle&quot;:&quot;prop&quot;,&quot;infoPath&quot;:&quot;docs_api_apiDocs_contextProps&quot;,&quot;description&quot;:&quot;Form item option life cycle. Where dependencies are collected for the entire form&quot;}}" ></APIWrap>
### readOnly
<APIWrap apiInstance="{&quot;defaultValue&quot;:{&quot;value&quot;:&quot;false&quot;},&quot;name&quot;:&quot;readOnly&quot;,&quot;type&quot;:{&quot;name&quot;:&quot;boolean&quot;},&quot;tags&quot;:{&quot;localKey&quot;:&quot;API.form.global.props.form.share.readOnly&quot;,&quot;description&quot;:&quot;Whether the form item is read-only will pass this property to the form item's rendering control&quot;}}" ></APIWrap>
### readOnlyText
Expand Down
2 changes: 1 addition & 1 deletion docs/api/formItemProps.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ group:
### fullWidth
<APIWrap apiInstance="{&quot;defaultValue&quot;:{&quot;value&quot;:&quot;false&quot;},&quot;name&quot;:&quot;fullWidth&quot;,&quot;type&quot;:{&quot;name&quot;:&quot;boolean&quot;},&quot;tags&quot;:{&quot;localKey&quot;:&quot;API.form.global.props.form.share.fullWidth&quot;,&quot;description&quot;:&quot;Whether the width of the form item fills the entire row&quot;}}" ></APIWrap>
### contextProps
<APIWrap apiInstance="{&quot;defaultValue&quot;:null,&quot;name&quot;:&quot;contextProps&quot;,&quot;type&quot;:{&quot;name&quot;:&quot;ContextProps&quot;},&quot;tags&quot;:{&quot;localKey&quot;:&quot;API.form.global.props.form.share.contextProps&quot;,&quot;resetType&quot;:&quot;ContextProps&quot;,&quot;infoTitle&quot;:&quot;prop&quot;,&quot;infoPath&quot;:&quot;docs_api_apiDocs_contextProps&quot;,&quot;description&quot;:&quot;Form item option life cycle. Where dependencies are collected for the entire form&quot;}}" ></APIWrap>
<APIWrap apiInstance="{&quot;defaultValue&quot;:null,&quot;name&quot;:&quot;contextProps&quot;,&quot;type&quot;:{&quot;name&quot;:&quot;ContextProps<Record<string, any>>&quot;},&quot;tags&quot;:{&quot;localKey&quot;:&quot;API.form.global.props.form.share.contextProps&quot;,&quot;resetType&quot;:&quot;ContextProps&quot;,&quot;infoTitle&quot;:&quot;prop&quot;,&quot;infoPath&quot;:&quot;docs_api_apiDocs_contextProps&quot;,&quot;description&quot;:&quot;Form item option life cycle. Where dependencies are collected for the entire form&quot;}}" ></APIWrap>
### readOnly
<APIWrap apiInstance="{&quot;defaultValue&quot;:{&quot;value&quot;:&quot;false&quot;},&quot;name&quot;:&quot;readOnly&quot;,&quot;type&quot;:{&quot;name&quot;:&quot;boolean&quot;},&quot;tags&quot;:{&quot;localKey&quot;:&quot;API.form.global.props.form.share.readOnly&quot;,&quot;description&quot;:&quot;Whether the form item is read-only will pass this property to the form item's rendering control&quot;}}" ></APIWrap>
### readOnlyText
Expand Down
2 changes: 1 addition & 1 deletion docs/api/formMethods.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ group:
### setError
<APIWrap apiInstance="{&quot;defaultValue&quot;:null,&quot;name&quot;:&quot;setError&quot;,&quot;type&quot;:{&quot;name&quot;:&quot;(bindId: any, message?: ReactNode) => void&quot;},&quot;tags&quot;:{&quot;description&quot;:&quot;Manually calling to set the error message will not trigger the onError event&quot;,&quot;localKey&quot;:&quot;API.formItem.setError.desc&quot;,&quot;version&quot;:&quot;1.3.0&quot;,&quot;resetType&quot;:&quot;(bindId: string | string[], message?: React.ReactNode) => void&quot;}}" ></APIWrap>
### validate
<APIWrap apiInstance="{&quot;defaultValue&quot;:null,&quot;name&quot;:&quot;validate&quot;,&quot;type&quot;:{&quot;name&quot;:&quot;() => Promise<unknown>&quot;},&quot;tags&quot;:{&quot;localKey&quot;:&quot;API.form.share.validate.desc&quot;,&quot;description&quot;:&quot;Form validation.&quot;}}" ></APIWrap>
<APIWrap apiInstance="{&quot;defaultValue&quot;:null,&quot;name&quot;:&quot;validate&quot;,&quot;type&quot;:{&quot;name&quot;:&quot;(bindId?: string | string[] | undefined) => Promise<unknown>&quot;},&quot;tags&quot;:{&quot;localKey&quot;:&quot;API.form.share.validate.desc&quot;,&quot;description&quot;:&quot;Form validation.&quot;}}" ></APIWrap>
### reset
<APIWrap apiInstance="{&quot;defaultValue&quot;:null,&quot;name&quot;:&quot;reset&quot;,&quot;type&quot;:{&quot;name&quot;:&quot;() => void&quot;},&quot;tags&quot;:{&quot;description&quot;:&quot;Reset the form.&quot;,&quot;localKey&quot;:&quot;API.form.share.reset.desc&quot;}}" ></APIWrap>
2 changes: 1 addition & 1 deletion docs/api/formMethods.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ group:
### setError
<APIWrap apiInstance="{&quot;defaultValue&quot;:null,&quot;name&quot;:&quot;setError&quot;,&quot;type&quot;:{&quot;name&quot;:&quot;(bindId: any, message?: ReactNode) => void&quot;},&quot;tags&quot;:{&quot;description&quot;:&quot;Manually calling to set the error message will not trigger the onError event&quot;,&quot;localKey&quot;:&quot;API.formItem.setError.desc&quot;,&quot;version&quot;:&quot;1.3.0&quot;,&quot;resetType&quot;:&quot;(bindId: string | string[], message?: React.ReactNode) => void&quot;}}" ></APIWrap>
### validate
<APIWrap apiInstance="{&quot;defaultValue&quot;:null,&quot;name&quot;:&quot;validate&quot;,&quot;type&quot;:{&quot;name&quot;:&quot;() => Promise<unknown>&quot;},&quot;tags&quot;:{&quot;localKey&quot;:&quot;API.form.share.validate.desc&quot;,&quot;description&quot;:&quot;Form validation.&quot;}}" ></APIWrap>
<APIWrap apiInstance="{&quot;defaultValue&quot;:null,&quot;name&quot;:&quot;validate&quot;,&quot;type&quot;:{&quot;name&quot;:&quot;(bindId?: string | string[] | undefined) => Promise<unknown>&quot;},&quot;tags&quot;:{&quot;localKey&quot;:&quot;API.form.share.validate.desc&quot;,&quot;description&quot;:&quot;Form validation.&quot;}}" ></APIWrap>
### reset
<APIWrap apiInstance="{&quot;defaultValue&quot;:null,&quot;name&quot;:&quot;reset&quot;,&quot;type&quot;:{&quot;name&quot;:&quot;() => void&quot;},&quot;tags&quot;:{&quot;description&quot;:&quot;Reset the form.&quot;,&quot;localKey&quot;:&quot;API.form.share.reset.desc&quot;}}" ></APIWrap>
2 changes: 1 addition & 1 deletion docs/api/formProps.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ group:
### fullWidth
<APIWrap apiInstance="{&quot;defaultValue&quot;:{&quot;value&quot;:&quot;false&quot;},&quot;name&quot;:&quot;fullWidth&quot;,&quot;type&quot;:{&quot;name&quot;:&quot;boolean&quot;},&quot;tags&quot;:{&quot;localKey&quot;:&quot;API.form.global.props.form.share.fullWidth&quot;,&quot;description&quot;:&quot;Whether the width of the form item fills the entire row&quot;}}" ></APIWrap>
### contextProps
<APIWrap apiInstance="{&quot;defaultValue&quot;:null,&quot;name&quot;:&quot;contextProps&quot;,&quot;type&quot;:{&quot;name&quot;:&quot;ContextProps&quot;},&quot;tags&quot;:{&quot;localKey&quot;:&quot;API.form.global.props.form.share.contextProps&quot;,&quot;resetType&quot;:&quot;ContextProps&quot;,&quot;infoTitle&quot;:&quot;prop&quot;,&quot;infoPath&quot;:&quot;docs_api_apiDocs_contextProps&quot;,&quot;description&quot;:&quot;Form item option life cycle. Where dependencies are collected for the entire form&quot;}}" ></APIWrap>
<APIWrap apiInstance="{&quot;defaultValue&quot;:null,&quot;name&quot;:&quot;contextProps&quot;,&quot;type&quot;:{&quot;name&quot;:&quot;ContextProps<Record<string, any>>&quot;},&quot;tags&quot;:{&quot;localKey&quot;:&quot;API.form.global.props.form.share.contextProps&quot;,&quot;resetType&quot;:&quot;ContextProps&quot;,&quot;infoTitle&quot;:&quot;prop&quot;,&quot;infoPath&quot;:&quot;docs_api_apiDocs_contextProps&quot;,&quot;description&quot;:&quot;Form item option life cycle. Where dependencies are collected for the entire form&quot;}}" ></APIWrap>
### readOnly
<APIWrap apiInstance="{&quot;defaultValue&quot;:{&quot;value&quot;:&quot;false&quot;},&quot;name&quot;:&quot;readOnly&quot;,&quot;type&quot;:{&quot;name&quot;:&quot;boolean&quot;},&quot;tags&quot;:{&quot;localKey&quot;:&quot;API.form.global.props.form.share.readOnly&quot;,&quot;description&quot;:&quot;Whether the form item is read-only will pass this property to the form item's rendering control&quot;}}" ></APIWrap>
### readOnlyText
Expand Down
2 changes: 1 addition & 1 deletion docs/api/formProps.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ group:
### fullWidth
<APIWrap apiInstance="{&quot;defaultValue&quot;:{&quot;value&quot;:&quot;false&quot;},&quot;name&quot;:&quot;fullWidth&quot;,&quot;type&quot;:{&quot;name&quot;:&quot;boolean&quot;},&quot;tags&quot;:{&quot;localKey&quot;:&quot;API.form.global.props.form.share.fullWidth&quot;,&quot;description&quot;:&quot;Whether the width of the form item fills the entire row&quot;}}" ></APIWrap>
### contextProps
<APIWrap apiInstance="{&quot;defaultValue&quot;:null,&quot;name&quot;:&quot;contextProps&quot;,&quot;type&quot;:{&quot;name&quot;:&quot;ContextProps&quot;},&quot;tags&quot;:{&quot;localKey&quot;:&quot;API.form.global.props.form.share.contextProps&quot;,&quot;resetType&quot;:&quot;ContextProps&quot;,&quot;infoTitle&quot;:&quot;prop&quot;,&quot;infoPath&quot;:&quot;docs_api_apiDocs_contextProps&quot;,&quot;description&quot;:&quot;Form item option life cycle. Where dependencies are collected for the entire form&quot;}}" ></APIWrap>
<APIWrap apiInstance="{&quot;defaultValue&quot;:null,&quot;name&quot;:&quot;contextProps&quot;,&quot;type&quot;:{&quot;name&quot;:&quot;ContextProps<Record<string, any>>&quot;},&quot;tags&quot;:{&quot;localKey&quot;:&quot;API.form.global.props.form.share.contextProps&quot;,&quot;resetType&quot;:&quot;ContextProps&quot;,&quot;infoTitle&quot;:&quot;prop&quot;,&quot;infoPath&quot;:&quot;docs_api_apiDocs_contextProps&quot;,&quot;description&quot;:&quot;Form item option life cycle. Where dependencies are collected for the entire form&quot;}}" ></APIWrap>
### readOnly
<APIWrap apiInstance="{&quot;defaultValue&quot;:{&quot;value&quot;:&quot;false&quot;},&quot;name&quot;:&quot;readOnly&quot;,&quot;type&quot;:{&quot;name&quot;:&quot;boolean&quot;},&quot;tags&quot;:{&quot;localKey&quot;:&quot;API.form.global.props.form.share.readOnly&quot;,&quot;description&quot;:&quot;Whether the form item is read-only will pass this property to the form item's rendering control&quot;}}" ></APIWrap>
### readOnlyText
Expand Down
Loading

0 comments on commit d56d00a

Please sign in to comment.