@hw-component/form 1.9.74 → 1.9.75

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.
package/es/Btn.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ import type { ButtonProps } from "antd";
2
+ export interface BtnProps<R = any> extends ButtonProps {
3
+ request?: () => Promise<any>;
4
+ onSuccess?: (data: R) => void;
5
+ }
6
+ declare const _default: ({ loading, request, children, onClick, style, type, onSuccess, ...props }: BtnProps) => JSX.Element;
7
+ export default _default;
package/es/Btn.js ADDED
@@ -0,0 +1,47 @@
1
+ // welcome to hoo hoo hoo
2
+ import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
3
+ import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
4
+ import { jsx } from 'react/jsx-runtime';
5
+ import { Button } from 'antd';
6
+ import { useRequest } from 'ahooks';
7
+
8
+ var _excluded = ["loading", "request", "children", "onClick", "style", "type", "onSuccess"];
9
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
10
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
11
+ var Btn = (function (_ref) {
12
+ var loading = _ref.loading,
13
+ request = _ref.request,
14
+ children = _ref.children,
15
+ onClick = _ref.onClick,
16
+ style = _ref.style,
17
+ type = _ref.type,
18
+ onSuccess = _ref.onSuccess,
19
+ props = _objectWithoutProperties(_ref, _excluded);
20
+ var _useRequest = useRequest(function () {
21
+ return request === null || request === void 0 ? void 0 : request();
22
+ }, {
23
+ manual: true,
24
+ onSuccess: onSuccess
25
+ }),
26
+ run = _useRequest.run,
27
+ reqLoading = _useRequest.loading;
28
+ var click = function click(e) {
29
+ if (request) {
30
+ run();
31
+ return;
32
+ }
33
+ onClick === null || onClick === void 0 || onClick(e);
34
+ };
35
+ return jsx(Button, _objectSpread(_objectSpread({}, props), {}, {
36
+ type: type,
37
+ style: _objectSpread({
38
+ borderRadius: 4
39
+ }, style),
40
+ onClick: click,
41
+ loading: loading || reqLoading,
42
+ children: children
43
+ }));
44
+ });
45
+
46
+ export { Btn as default };
47
+ // powered by hdj
@@ -1,7 +1,7 @@
1
1
  // welcome to hoo hoo hoo
2
2
  import { jsx, jsxs } from 'react/jsx-runtime';
3
3
  import { Row, Space } from 'antd';
4
- import { HJBtn } from '@hw-component/hj';
4
+ import Btn from '../../Btn.js';
5
5
 
6
6
  var Footer = (function (_ref) {
7
7
  var onCancel = _ref.onCancel,
@@ -11,10 +11,10 @@ var Footer = (function (_ref) {
11
11
  justify: "end",
12
12
  children: jsxs(Space, {
13
13
  size: "small",
14
- children: [jsx(HJBtn, {
14
+ children: [jsx(Btn, {
15
15
  onClick: onCancel,
16
16
  children: "\u5173\u95ED"
17
- }), jsx(HJBtn, {
17
+ }), jsx(Btn, {
18
18
  type: "primary",
19
19
  onClick: onOk,
20
20
  loading: confirmLoading,
@@ -189,7 +189,7 @@ var useHForm = (function () {
189
189
  },
190
190
  resetFieldsInitValue: function resetFieldsInitValue() {
191
191
  var values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
192
- var oldValue = form.getFieldsValue();
192
+ var oldValue = form.getFieldsValue(true);
193
193
  var keys = Object.keys(oldValue);
194
194
  var newVale = {};
195
195
  keys.forEach(function (key) {
@@ -6,7 +6,7 @@ import _regeneratorRuntime from '@babel/runtime-corejs3/regenerator';
6
6
  import { jsx, jsxs } from 'react/jsx-runtime';
7
7
  import { Input } from 'antd';
8
8
  import { useRequest } from 'ahooks';
9
- import { HJBtn } from '@hw-component/hj';
9
+ import Btn from '../Btn.js';
10
10
 
11
11
  var _excluded = ["buttonProps", "value", "onChange", "children", "request", "layType"],
12
12
  _excluded2 = ["onClick", "type", "ghost", "loading"];
@@ -69,7 +69,7 @@ var Index = function Index(_ref) {
69
69
  }();
70
70
  if (layType === "text") {
71
71
  return jsx(Input, _objectSpread(_objectSpread({}, props), {}, {
72
- suffix: jsx(HJBtn, _objectSpread(_objectSpread({
72
+ suffix: jsx(Btn, _objectSpread(_objectSpread({
73
73
  type: btnType,
74
74
  onClick: click,
75
75
  size: "small",
@@ -91,7 +91,7 @@ var Index = function Index(_ref) {
91
91
  },
92
92
  value: value,
93
93
  onChange: change
94
- })), jsx(HJBtn, _objectSpread(_objectSpread({
94
+ })), jsx(Btn, _objectSpread(_objectSpread({
95
95
  type: btnType,
96
96
  onClick: click,
97
97
  loading: loading || btnLoading,
@@ -2,7 +2,7 @@
2
2
  import { jsx, jsxs } from 'react/jsx-runtime';
3
3
  import { Typography, Row, Space } from 'antd';
4
4
  import { ExclamationCircleOutlined } from '@ant-design/icons';
5
- import { HJBtn } from '@hw-component/hj';
5
+ import Btn from '../Btn.js';
6
6
 
7
7
  var Text = Typography.Text;
8
8
  var ErrorComponent = (function (_ref) {
@@ -25,7 +25,7 @@ var ErrorComponent = (function (_ref) {
25
25
  }), jsx(Text, {
26
26
  type: "danger",
27
27
  children: error === null || error === void 0 ? void 0 : error.message
28
- }), jsx(HJBtn, {
28
+ }), jsx(Btn, {
29
29
  type: "primary",
30
30
  size: "small",
31
31
  onClick: reload,
@@ -2,7 +2,7 @@
2
2
  import { jsx, jsxs } from 'react/jsx-runtime';
3
3
  import { Typography, Row, Space, Empty } from 'antd';
4
4
  import { ExclamationCircleOutlined } from '@ant-design/icons';
5
- import { HJBtn } from '@hw-component/hj';
5
+ import Btn from '../../Btn.js';
6
6
 
7
7
  var Text = Typography.Text;
8
8
  var NotFoundContent = (function (_ref) {
@@ -26,7 +26,7 @@ var NotFoundContent = (function (_ref) {
26
26
  }), jsx(Text, {
27
27
  type: "danger",
28
28
  children: error.message
29
- }), jsx(HJBtn, {
29
+ }), jsx(Btn, {
30
30
  type: "primary",
31
31
  size: "small",
32
32
  onClick: reload,
@@ -4,7 +4,7 @@ import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWitho
4
4
  import { jsx, Fragment } from 'react/jsx-runtime';
5
5
  import { useFormContext } from '../Form/Context/index.js';
6
6
  import React from 'react';
7
- import { HJBtn } from '@hw-component/hj';
7
+ import Btn from '../Btn.js';
8
8
 
9
9
  var _excluded = ["form", "style"],
10
10
  _excluded2 = ["type", "form", "text", "loading", "style"],
@@ -18,7 +18,7 @@ function ResetBtn(_ref) {
18
18
  borderRadius: 4
19
19
  } : _ref$style,
20
20
  props = _objectWithoutProperties(_ref, _excluded);
21
- return jsx(HJBtn, _objectSpread(_objectSpread({}, props), {}, {
21
+ return jsx(Btn, _objectSpread(_objectSpread({}, props), {}, {
22
22
  style: style,
23
23
  onClick: function onClick() {
24
24
  form.resetFields();
@@ -41,7 +41,7 @@ function SubBtn(_ref2) {
41
41
  var _useFormContext = useFormContext(),
42
42
  _useFormContext$loadi = _useFormContext.loading,
43
43
  formSubLoading = _useFormContext$loadi === void 0 ? loading : _useFormContext$loadi;
44
- return jsx(HJBtn, _objectSpread(_objectSpread({}, props), {}, {
44
+ return jsx(Btn, _objectSpread(_objectSpread({}, props), {}, {
45
45
  type: type,
46
46
  onClick: form.submit,
47
47
  loading: formSubLoading,
package/lib/Btn.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ import type { ButtonProps } from "antd";
2
+ export interface BtnProps<R = any> extends ButtonProps {
3
+ request?: () => Promise<any>;
4
+ onSuccess?: (data: R) => void;
5
+ }
6
+ declare const _default: ({ loading, request, children, onClick, style, type, onSuccess, ...props }: BtnProps) => JSX.Element;
7
+ export default _default;
package/lib/Btn.js ADDED
@@ -0,0 +1,50 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
6
+ var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
7
+ var jsxRuntime = require('react/jsx-runtime');
8
+ var antd = require('antd');
9
+ var ahooks = require('ahooks');
10
+
11
+ var _excluded = ["loading", "request", "children", "onClick", "style", "type", "onSuccess"];
12
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
13
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
14
+ var Btn = (function (_ref) {
15
+ var loading = _ref.loading,
16
+ request = _ref.request,
17
+ children = _ref.children,
18
+ onClick = _ref.onClick,
19
+ style = _ref.style,
20
+ type = _ref.type,
21
+ onSuccess = _ref.onSuccess,
22
+ props = _objectWithoutProperties(_ref, _excluded);
23
+ var _useRequest = ahooks.useRequest(function () {
24
+ return request === null || request === void 0 ? void 0 : request();
25
+ }, {
26
+ manual: true,
27
+ onSuccess: onSuccess
28
+ }),
29
+ run = _useRequest.run,
30
+ reqLoading = _useRequest.loading;
31
+ var click = function click(e) {
32
+ if (request) {
33
+ run();
34
+ return;
35
+ }
36
+ onClick === null || onClick === void 0 || onClick(e);
37
+ };
38
+ return jsxRuntime.jsx(antd.Button, _objectSpread(_objectSpread({}, props), {}, {
39
+ type: type,
40
+ style: _objectSpread({
41
+ borderRadius: 4
42
+ }, style),
43
+ onClick: click,
44
+ loading: loading || reqLoading,
45
+ children: children
46
+ }));
47
+ });
48
+
49
+ exports.default = Btn;
50
+ // powered by h
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
6
  var antd = require('antd');
7
- var hj = require('@hw-component/hj');
7
+ var Btn = require('../../Btn.js');
8
8
 
9
9
  var Footer = (function (_ref) {
10
10
  var onCancel = _ref.onCancel,
@@ -14,10 +14,10 @@ var Footer = (function (_ref) {
14
14
  justify: "end",
15
15
  children: jsxRuntime.jsxs(antd.Space, {
16
16
  size: "small",
17
- children: [jsxRuntime.jsx(hj.HJBtn, {
17
+ children: [jsxRuntime.jsx(Btn.default, {
18
18
  onClick: onCancel,
19
19
  children: "\u5173\u95ED"
20
- }), jsxRuntime.jsx(hj.HJBtn, {
20
+ }), jsxRuntime.jsx(Btn.default, {
21
21
  type: "primary",
22
22
  onClick: onOk,
23
23
  loading: confirmLoading,
@@ -192,7 +192,7 @@ var useHForm = (function () {
192
192
  },
193
193
  resetFieldsInitValue: function resetFieldsInitValue() {
194
194
  var values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
195
- var oldValue = form.getFieldsValue();
195
+ var oldValue = form.getFieldsValue(true);
196
196
  var keys = Object.keys(oldValue);
197
197
  var newVale = {};
198
198
  keys.forEach(function (key) {
@@ -9,7 +9,7 @@ var _regeneratorRuntime = require('@babel/runtime-corejs3/regenerator');
9
9
  var jsxRuntime = require('react/jsx-runtime');
10
10
  var antd = require('antd');
11
11
  var ahooks = require('ahooks');
12
- var hj = require('@hw-component/hj');
12
+ var Btn = require('../Btn.js');
13
13
 
14
14
  var _excluded = ["buttonProps", "value", "onChange", "children", "request", "layType"],
15
15
  _excluded2 = ["onClick", "type", "ghost", "loading"];
@@ -72,7 +72,7 @@ var Index = function Index(_ref) {
72
72
  }();
73
73
  if (layType === "text") {
74
74
  return jsxRuntime.jsx(antd.Input, _objectSpread(_objectSpread({}, props), {}, {
75
- suffix: jsxRuntime.jsx(hj.HJBtn, _objectSpread(_objectSpread({
75
+ suffix: jsxRuntime.jsx(Btn.default, _objectSpread(_objectSpread({
76
76
  type: btnType,
77
77
  onClick: click,
78
78
  size: "small",
@@ -94,7 +94,7 @@ var Index = function Index(_ref) {
94
94
  },
95
95
  value: value,
96
96
  onChange: change
97
- })), jsxRuntime.jsx(hj.HJBtn, _objectSpread(_objectSpread({
97
+ })), jsxRuntime.jsx(Btn.default, _objectSpread(_objectSpread({
98
98
  type: btnType,
99
99
  onClick: click,
100
100
  loading: loading || btnLoading,
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
6
  var antd = require('antd');
7
7
  var icons = require('@ant-design/icons');
8
- var hj = require('@hw-component/hj');
8
+ var Btn = require('../Btn.js');
9
9
 
10
10
  var Text = antd.Typography.Text;
11
11
  var ErrorComponent = (function (_ref) {
@@ -28,7 +28,7 @@ var ErrorComponent = (function (_ref) {
28
28
  }), jsxRuntime.jsx(Text, {
29
29
  type: "danger",
30
30
  children: error === null || error === void 0 ? void 0 : error.message
31
- }), jsxRuntime.jsx(hj.HJBtn, {
31
+ }), jsxRuntime.jsx(Btn.default, {
32
32
  type: "primary",
33
33
  size: "small",
34
34
  onClick: reload,
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
6
  var antd = require('antd');
7
7
  var icons = require('@ant-design/icons');
8
- var hj = require('@hw-component/hj');
8
+ var Btn = require('../../Btn.js');
9
9
 
10
10
  var Text = antd.Typography.Text;
11
11
  var NotFoundContent = (function (_ref) {
@@ -29,7 +29,7 @@ var NotFoundContent = (function (_ref) {
29
29
  }), jsxRuntime.jsx(Text, {
30
30
  type: "danger",
31
31
  children: error.message
32
- }), jsxRuntime.jsx(hj.HJBtn, {
32
+ }), jsxRuntime.jsx(Btn.default, {
33
33
  type: "primary",
34
34
  size: "small",
35
35
  onClick: reload,
@@ -5,7 +5,7 @@ var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWit
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
6
  var index = require('../Form/Context/index.js');
7
7
  var React = require('react');
8
- var hj = require('@hw-component/hj');
8
+ var Btn = require('../Btn.js');
9
9
 
10
10
  var _excluded = ["form", "style"],
11
11
  _excluded2 = ["type", "form", "text", "loading", "style"],
@@ -19,7 +19,7 @@ function ResetBtn(_ref) {
19
19
  borderRadius: 4
20
20
  } : _ref$style,
21
21
  props = _objectWithoutProperties(_ref, _excluded);
22
- return jsxRuntime.jsx(hj.HJBtn, _objectSpread(_objectSpread({}, props), {}, {
22
+ return jsxRuntime.jsx(Btn.default, _objectSpread(_objectSpread({}, props), {}, {
23
23
  style: style,
24
24
  onClick: function onClick() {
25
25
  form.resetFields();
@@ -42,7 +42,7 @@ function SubBtn(_ref2) {
42
42
  var _useFormContext = index.useFormContext(),
43
43
  _useFormContext$loadi = _useFormContext.loading,
44
44
  formSubLoading = _useFormContext$loadi === void 0 ? loading : _useFormContext$loadi;
45
- return jsxRuntime.jsx(hj.HJBtn, _objectSpread(_objectSpread({}, props), {}, {
45
+ return jsxRuntime.jsx(Btn.default, _objectSpread(_objectSpread({}, props), {}, {
46
46
  type: type,
47
47
  onClick: form.submit,
48
48
  loading: formSubLoading,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hw-component/form",
3
- "version": "1.9.74",
3
+ "version": "1.9.75",
4
4
  "description": "基于antd二次开发",
5
5
  "repository": {
6
6
  "type": "git",
@@ -47,7 +47,6 @@
47
47
  "@babel/preset-env": "^7.23.2",
48
48
  "@babel/preset-react": "^7.18.6",
49
49
  "@babel/preset-typescript": "^7.21.5",
50
- "@hw-component/hj": "0.9.0",
51
50
  "@rollup/plugin-babel": "^6.0.3",
52
51
  "@rollup/plugin-commonjs": "^25.0.0",
53
52
  "@rollup/plugin-inject": "^5.0.3",
@@ -91,7 +90,6 @@
91
90
  },
92
91
  "peerDependencies": {
93
92
  "@ant-design/icons": "4.6.2",
94
- "@hw-component/hj": "0.9.0",
95
93
  "antd": "4.20.7",
96
94
  "react": "17.0.0",
97
95
  "react-dom": "17.0.2"
@@ -0,0 +1,44 @@
1
+ import type { ButtonProps } from "antd";
2
+ import { Button } from "antd";
3
+ import React from "react";
4
+ import { useRequest } from "ahooks";
5
+
6
+ export interface BtnProps<R = any> extends ButtonProps {
7
+ request?: () => Promise<any>;
8
+ onSuccess?: (data: R) => void;
9
+ }
10
+ export default ({
11
+ loading,
12
+ request,
13
+ children,
14
+ onClick,
15
+ style,
16
+ type,
17
+ onSuccess,
18
+ ...props
19
+ }:BtnProps) => {
20
+ const { run, loading: reqLoading } = useRequest(
21
+ () => {
22
+ return request?.();
23
+ },
24
+ { manual: true, onSuccess }
25
+ );
26
+ const click = (e) => {
27
+ if (request) {
28
+ run();
29
+ return;
30
+ }
31
+ onClick?.(e);
32
+ };
33
+ return (
34
+ <Button
35
+ {...props}
36
+ type={type}
37
+ style={{ borderRadius: 4, ...style }}
38
+ onClick={click}
39
+ loading={loading || reqLoading}
40
+ >
41
+ {children}
42
+ </Button>
43
+ );
44
+ };
@@ -1,5 +1,5 @@
1
1
  import { Row, Space } from "antd";
2
- import { HJBtn } from "@hw-component/hj";
2
+ import Btn from "../../Btn";
3
3
 
4
4
  interface IProps {
5
5
  onOk?: VoidFunction;
@@ -11,10 +11,10 @@ export default ({ onCancel, onOk, confirmLoading }: IProps) => {
11
11
  return (
12
12
  <Row justify={"end"}>
13
13
  <Space size={"small"}>
14
- <HJBtn onClick={onCancel}>关闭</HJBtn>
15
- <HJBtn type={"primary"} onClick={onOk} loading={confirmLoading}>
14
+ <Btn onClick={onCancel}>关闭</Btn>
15
+ <Btn type={"primary"} onClick={onOk} loading={confirmLoading}>
16
16
  确定
17
- </HJBtn>
17
+ </Btn>
18
18
  </Space>
19
19
  </Row>
20
20
  );
@@ -174,7 +174,7 @@ export default () => {
174
174
  });
175
175
  },
176
176
  resetFieldsInitValue: (values = {}) => {
177
- const oldValue = form.getFieldsValue();
177
+ const oldValue = form.getFieldsValue(true);
178
178
  const keys = Object.keys(oldValue);
179
179
  const newVale = {};
180
180
  keys.forEach((key) => {
@@ -2,7 +2,7 @@ import { Input } from "antd";
2
2
  import React from "react";
3
3
  import { useRequest } from "ahooks";
4
4
  import type { HButtonInputProps } from "./modal";
5
- import { HJBtn } from "@hw-component/hj";
5
+ import Btn from "../Btn";
6
6
  const Index: React.FC<HButtonInputProps> = ({
7
7
  buttonProps = {},
8
8
  value,
@@ -42,7 +42,7 @@ const Index: React.FC<HButtonInputProps> = ({
42
42
  <Input
43
43
  {...props}
44
44
  suffix={
45
- <HJBtn
45
+ <Btn
46
46
  type={btnType}
47
47
  onClick={click}
48
48
  size={"small"}
@@ -51,7 +51,7 @@ const Index: React.FC<HButtonInputProps> = ({
51
51
  {...oProps}
52
52
  >
53
53
  {children}
54
- </HJBtn>
54
+ </Btn>
55
55
  }
56
56
  />
57
57
  );
@@ -59,7 +59,7 @@ const Index: React.FC<HButtonInputProps> = ({
59
59
  return (
60
60
  <Input.Group compact style={{ display: "flex" }}>
61
61
  <Input {...props} style={{ flex: 1 }} value={value} onChange={change} />
62
- <HJBtn
62
+ <Btn
63
63
  type={btnType}
64
64
  onClick={click}
65
65
  loading={loading || btnLoading}
@@ -68,7 +68,7 @@ const Index: React.FC<HButtonInputProps> = ({
68
68
  {...oProps}
69
69
  >
70
70
  {children}
71
- </HJBtn>
71
+ </Btn>
72
72
  </Input.Group>
73
73
  );
74
74
  };
@@ -1,7 +1,7 @@
1
1
  import { Row, Space, Typography } from "antd";
2
2
  import { ExclamationCircleOutlined } from "@ant-design/icons";
3
3
  import type { IHPageHandler } from "./modal";
4
- import { HJBtn } from "@hw-component/hj";
4
+ import Btn from "../Btn";
5
5
 
6
6
  const { Text } = Typography;
7
7
  export default ({ error, reload }: IHPageHandler) => {
@@ -12,9 +12,9 @@ export default ({ error, reload }: IHPageHandler) => {
12
12
  <ExclamationCircleOutlined size={24} />
13
13
  </Text>
14
14
  <Text type={"danger"}>{error?.message}</Text>
15
- <HJBtn type="primary" size={"small"} onClick={reload}>
15
+ <Btn type="primary" size={"small"} onClick={reload}>
16
16
  重新加载
17
- </HJBtn>
17
+ </Btn>
18
18
  </Space>
19
19
  </Row>
20
20
  );
@@ -1,6 +1,6 @@
1
1
  import { Empty, Row, Space, Typography } from "antd";
2
2
  import { ExclamationCircleOutlined } from "@ant-design/icons";
3
- import { HJBtn } from "@hw-component/hj";
3
+ import Btn from "../../Btn";
4
4
  const { Text } = Typography;
5
5
  interface IProps {
6
6
  error?: Error;
@@ -15,9 +15,9 @@ export default ({ error, reload }: IProps) => {
15
15
  <ExclamationCircleOutlined size={24} />
16
16
  </Text>
17
17
  <Text type={"danger"}>{error.message}</Text>
18
- <HJBtn type="primary" size={"small"} onClick={reload}>
18
+ <Btn type="primary" size={"small"} onClick={reload}>
19
19
  重新加载
20
- </HJBtn>
20
+ </Btn>
21
21
  </Space>
22
22
  </Row>
23
23
  );
@@ -4,7 +4,7 @@ import type {
4
4
  ISubmitProps,
5
5
  SubmitBarExtraType,
6
6
  } from "@/components/Submit/index";
7
- import { HJBtn } from "@hw-component/hj";
7
+ import Btn from "../Btn";
8
8
  interface ControlFooterProps extends ISubmitProps {
9
9
  action: SubmitBarExtraType;
10
10
  style?: React.CSSProperties;
@@ -15,7 +15,7 @@ function ResetBtn({
15
15
  ...props
16
16
  }: Omit<ControlFooterProps, "action">) {
17
17
  return (
18
- <HJBtn
18
+ <Btn
19
19
  {...props}
20
20
  style={style}
21
21
  onClick={() => {
@@ -23,7 +23,7 @@ function ResetBtn({
23
23
  }}
24
24
  >
25
25
  重置
26
- </HJBtn>
26
+ </Btn>
27
27
  );
28
28
  }
29
29
 
@@ -38,7 +38,7 @@ function SubBtn({
38
38
  const { loading: formSubLoading = loading } = useFormContext();
39
39
 
40
40
  return (
41
- <HJBtn
41
+ <Btn
42
42
  {...props}
43
43
  type={type as any}
44
44
  onClick={form.submit}
@@ -46,7 +46,7 @@ function SubBtn({
46
46
  style={style}
47
47
  >
48
48
  {text}
49
- </HJBtn>
49
+ </Btn>
50
50
  );
51
51
  }
52
52
 
package/src/index.less CHANGED
@@ -1,4 +1,3 @@
1
- @import "~@hw-component/hj/src/components/styles/index.less";
2
1
  .layout {
3
2
  position: fixed;
4
3
  top: 0;
@@ -75,6 +75,19 @@ export default () => {
75
75
  <div style={{ width: 1000 }}>
76
76
  <HForm
77
77
  configData={[
78
+ {
79
+ label: "inputSelect",
80
+ type: "richEditor",
81
+ name: "richEditor",
82
+ rules: [
83
+ {
84
+ validator: (rule, value, callback) => {
85
+ console.log(value);
86
+ return Promise.resolve();
87
+ },
88
+ },
89
+ ],
90
+ },
78
91
  {
79
92
  label: "富文本",
80
93
  type: "richEditor",
@@ -224,6 +237,13 @@ export default () => {
224
237
  >
225
238
  点我
226
239
  </div>
240
+ <div
241
+ onClick={() => {
242
+ form.resetFieldsInitValue();
243
+ }}
244
+ >
245
+ 重置
246
+ </div>
227
247
  <div
228
248
  onClick={() => {
229
249
  form.submit();