react-antd-xform 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,9 @@
1
+ import { ComponentType } from 'react';
2
+ type FormSubmitProps<T extends object = {}> = {
3
+ /** 必须传入的按钮组件 */
4
+ ButtonComponent: ComponentType<T>;
5
+ /** 按钮内容 */
6
+ children: React.ReactNode;
7
+ } & T;
8
+ export declare function FormReset<T extends object = {}>({ ButtonComponent, children, ...props }: FormSubmitProps<T>): import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1,25 @@
1
+ import { j as jsxRuntimeExports } from "../../node_modules/.pnpm/react@18.3.1/node_modules/react/jsx-runtime.js";
2
+ import { action } from "mobx";
3
+ import { modelUtils } from "../model-utils.js";
4
+ import { useModel } from "../context/modelContext.js";
5
+ import { useFormEnv } from "../context/formEnvContext.js";
6
+ function FormReset({
7
+ ButtonComponent,
8
+ children = "提交",
9
+ ...props
10
+ }) {
11
+ const model = useModel();
12
+ const formEnv = useFormEnv();
13
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
14
+ ButtonComponent,
15
+ {
16
+ ...props,
17
+ onClick: action(() => modelUtils.reset(model, formEnv)),
18
+ children,
19
+ ...props
20
+ }
21
+ );
22
+ }
23
+ export {
24
+ FormReset
25
+ };
@@ -29,4 +29,5 @@ export declare namespace Form {
29
29
  var ModelConsumer: (({ children }: React.ConsumerProps<FormModel<any>>) => React.ReactElement) & {
30
30
  displayName: string;
31
31
  };
32
+ var FormReset: typeof import("./extend/form-reset").FormReset;
32
33
  }
@@ -7,6 +7,7 @@ import { FormEnvProvider } from "./context/formEnvContext.js";
7
7
  import { useHtmlIdPrefix, composeValue } from "./common-utils.js";
8
8
  import { FormArray } from "./extend/form-array.js";
9
9
  import { FormCheck } from "./extend/form-check.js";
10
+ import { FormReset } from "./extend/form-reset.js";
10
11
  import { FormLayout } from "./extend/form-layout.js";
11
12
  import { FormSubmit } from "./extend/form-submit.js";
12
13
  import { FormEffect } from "./extend/form-effect.js";
@@ -37,6 +38,7 @@ Form.Layout = FormLayout;
37
38
  Form.ItemView = FormItemView;
38
39
  Form.ModelProvider = ModelProvider;
39
40
  Form.ModelConsumer = FormModelConsumer;
41
+ Form.FormReset = FormReset;
40
42
  export {
41
43
  Form
42
44
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-antd-xform",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "基于mobx的form解决方案",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -10,7 +10,13 @@
10
10
  "files": [
11
11
  "dist"
12
12
  ],
13
- "keywords": [],
13
+ "keywords": [
14
+ "form",
15
+ "antd",
16
+ "react",
17
+ "mobx",
18
+ "react-antd-xform"
19
+ ],
14
20
  "author": "",
15
21
  "license": "MIT",
16
22
  "dependencies": {