@hw-component/form 1.5.4 → 1.5.6
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/Form/modal.d.ts +1 -1
- package/es/Submit/components.d.ts +2 -0
- package/es/Submit/components.js +12 -2
- package/lib/Form/modal.d.ts +1 -1
- package/lib/Submit/components.d.ts +2 -0
- package/lib/Submit/components.js +12 -2
- package/package.json +1 -1
- package/src/components/Form/modal.ts +1 -1
- package/src/components/Submit/components.tsx +5 -1
- package/src/pages/Form/index.tsx +3 -5
package/es/Form/modal.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ export interface HItemProps extends Omit<FormItemProps, "name" | "labelAlign" |
|
|
|
38
38
|
type?: string;
|
|
39
39
|
itemProps?: ItemPropsType;
|
|
40
40
|
render?: RenderFun;
|
|
41
|
-
helper?: HelperModal |
|
|
41
|
+
helper?: HelperModal | React.ReactNode;
|
|
42
42
|
hover?: string | HoverModal;
|
|
43
43
|
labelWidth?: number;
|
|
44
44
|
hide?: boolean | HideModal;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import type { ISubmitProps, SubmitBarExtraType } from "@/components/Submit/index";
|
|
2
3
|
interface ControlFooterProps extends ISubmitProps {
|
|
3
4
|
action: SubmitBarExtraType;
|
|
5
|
+
style?: React.CSSProperties;
|
|
4
6
|
}
|
|
5
7
|
export declare const ControlFooter: ({ action, ...props }: ControlFooterProps) => JSX.Element;
|
|
6
8
|
export {};
|
package/es/Submit/components.js
CHANGED
|
@@ -13,15 +13,20 @@ import { Button } from 'antd';
|
|
|
13
13
|
import { useFormContext } from '../Form/Context/index.js';
|
|
14
14
|
import React from 'react';
|
|
15
15
|
|
|
16
|
-
var _excluded = ["form"],
|
|
17
|
-
_excluded2 = ["type", "form", "text", "loading"],
|
|
16
|
+
var _excluded = ["form", "style"],
|
|
17
|
+
_excluded2 = ["type", "form", "text", "loading", "style"],
|
|
18
18
|
_excluded3 = ["action"];
|
|
19
19
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
20
20
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
21
21
|
function ResetBtn(_ref) {
|
|
22
22
|
var form = _ref.form,
|
|
23
|
+
_ref$style = _ref.style,
|
|
24
|
+
style = _ref$style === void 0 ? {
|
|
25
|
+
borderRadius: 4
|
|
26
|
+
} : _ref$style,
|
|
23
27
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
24
28
|
return jsx(Button, _objectSpread(_objectSpread({}, props), {}, {
|
|
29
|
+
style: style,
|
|
25
30
|
onClick: function onClick() {
|
|
26
31
|
form.resetFields();
|
|
27
32
|
},
|
|
@@ -35,6 +40,10 @@ function SubBtn(_ref2) {
|
|
|
35
40
|
_ref2$text = _ref2.text,
|
|
36
41
|
text = _ref2$text === void 0 ? "提交" : _ref2$text,
|
|
37
42
|
loading = _ref2.loading,
|
|
43
|
+
_ref2$style = _ref2.style,
|
|
44
|
+
style = _ref2$style === void 0 ? {
|
|
45
|
+
borderRadius: 4
|
|
46
|
+
} : _ref2$style,
|
|
38
47
|
props = _objectWithoutProperties(_ref2, _excluded2);
|
|
39
48
|
var _useFormContext = useFormContext(),
|
|
40
49
|
_useFormContext$loadi = _useFormContext.loading,
|
|
@@ -43,6 +52,7 @@ function SubBtn(_ref2) {
|
|
|
43
52
|
type: type,
|
|
44
53
|
onClick: form.submit,
|
|
45
54
|
loading: formSubLoading,
|
|
55
|
+
style: style,
|
|
46
56
|
children: text
|
|
47
57
|
}));
|
|
48
58
|
}
|
package/lib/Form/modal.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ export interface HItemProps extends Omit<FormItemProps, "name" | "labelAlign" |
|
|
|
38
38
|
type?: string;
|
|
39
39
|
itemProps?: ItemPropsType;
|
|
40
40
|
render?: RenderFun;
|
|
41
|
-
helper?: HelperModal |
|
|
41
|
+
helper?: HelperModal | React.ReactNode;
|
|
42
42
|
hover?: string | HoverModal;
|
|
43
43
|
labelWidth?: number;
|
|
44
44
|
hide?: boolean | HideModal;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import type { ISubmitProps, SubmitBarExtraType } from "@/components/Submit/index";
|
|
2
3
|
interface ControlFooterProps extends ISubmitProps {
|
|
3
4
|
action: SubmitBarExtraType;
|
|
5
|
+
style?: React.CSSProperties;
|
|
4
6
|
}
|
|
5
7
|
export declare const ControlFooter: ({ action, ...props }: ControlFooterProps) => JSX.Element;
|
|
6
8
|
export {};
|
package/lib/Submit/components.js
CHANGED
|
@@ -14,15 +14,20 @@ var antd = require('antd');
|
|
|
14
14
|
var index = require('../Form/Context/index.js');
|
|
15
15
|
var React = require('react');
|
|
16
16
|
|
|
17
|
-
var _excluded = ["form"],
|
|
18
|
-
_excluded2 = ["type", "form", "text", "loading"],
|
|
17
|
+
var _excluded = ["form", "style"],
|
|
18
|
+
_excluded2 = ["type", "form", "text", "loading", "style"],
|
|
19
19
|
_excluded3 = ["action"];
|
|
20
20
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
21
21
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
22
22
|
function ResetBtn(_ref) {
|
|
23
23
|
var form = _ref.form,
|
|
24
|
+
_ref$style = _ref.style,
|
|
25
|
+
style = _ref$style === void 0 ? {
|
|
26
|
+
borderRadius: 4
|
|
27
|
+
} : _ref$style,
|
|
24
28
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
25
29
|
return jsxRuntime.jsx(antd.Button, _objectSpread(_objectSpread({}, props), {}, {
|
|
30
|
+
style: style,
|
|
26
31
|
onClick: function onClick() {
|
|
27
32
|
form.resetFields();
|
|
28
33
|
},
|
|
@@ -36,6 +41,10 @@ function SubBtn(_ref2) {
|
|
|
36
41
|
_ref2$text = _ref2.text,
|
|
37
42
|
text = _ref2$text === void 0 ? "提交" : _ref2$text,
|
|
38
43
|
loading = _ref2.loading,
|
|
44
|
+
_ref2$style = _ref2.style,
|
|
45
|
+
style = _ref2$style === void 0 ? {
|
|
46
|
+
borderRadius: 4
|
|
47
|
+
} : _ref2$style,
|
|
39
48
|
props = _objectWithoutProperties(_ref2, _excluded2);
|
|
40
49
|
var _useFormContext = index.useFormContext(),
|
|
41
50
|
_useFormContext$loadi = _useFormContext.loading,
|
|
@@ -44,6 +53,7 @@ function SubBtn(_ref2) {
|
|
|
44
53
|
type: type,
|
|
45
54
|
onClick: form.submit,
|
|
46
55
|
loading: formSubLoading,
|
|
56
|
+
style: style,
|
|
47
57
|
children: text
|
|
48
58
|
}));
|
|
49
59
|
}
|
package/package.json
CHANGED
|
@@ -84,7 +84,7 @@ export interface HItemProps
|
|
|
84
84
|
type?: string;
|
|
85
85
|
itemProps?: ItemPropsType;
|
|
86
86
|
render?: RenderFun;
|
|
87
|
-
helper?: HelperModal |
|
|
87
|
+
helper?: HelperModal | React.ReactNode;
|
|
88
88
|
hover?: string | HoverModal;
|
|
89
89
|
// formItems?: HItemProps[]; 保留感觉没必要
|
|
90
90
|
labelWidth?: number;
|
|
@@ -7,11 +7,13 @@ import type {
|
|
|
7
7
|
} from "@/components/Submit/index";
|
|
8
8
|
interface ControlFooterProps extends ISubmitProps {
|
|
9
9
|
action: SubmitBarExtraType;
|
|
10
|
+
style?:React.CSSProperties
|
|
10
11
|
}
|
|
11
|
-
function ResetBtn({ form,
|
|
12
|
+
function ResetBtn({ form, style={borderRadius:4},...props }:Omit<ControlFooterProps, 'action'>) {
|
|
12
13
|
return (
|
|
13
14
|
<Button
|
|
14
15
|
{...props}
|
|
16
|
+
style={style}
|
|
15
17
|
onClick={() => {
|
|
16
18
|
form.resetFields();
|
|
17
19
|
}}
|
|
@@ -26,6 +28,7 @@ function SubBtn({
|
|
|
26
28
|
form,
|
|
27
29
|
text = "提交",
|
|
28
30
|
loading,
|
|
31
|
+
style={borderRadius:4},
|
|
29
32
|
...props
|
|
30
33
|
}: ISubmitProps) {
|
|
31
34
|
const { loading: formSubLoading = loading } = useFormContext();
|
|
@@ -36,6 +39,7 @@ function SubBtn({
|
|
|
36
39
|
type={type as any}
|
|
37
40
|
onClick={form.submit}
|
|
38
41
|
loading={formSubLoading}
|
|
42
|
+
style={style}
|
|
39
43
|
>
|
|
40
44
|
{text}
|
|
41
45
|
</Button>
|
package/src/pages/Form/index.tsx
CHANGED
|
@@ -65,6 +65,9 @@ const formData = (options) => {
|
|
|
65
65
|
className: "hdjd",
|
|
66
66
|
name: "test123",
|
|
67
67
|
},
|
|
68
|
+
{
|
|
69
|
+
type: "submit"
|
|
70
|
+
},
|
|
68
71
|
];
|
|
69
72
|
};
|
|
70
73
|
function Ttta({ form }) {
|
|
@@ -99,11 +102,6 @@ export default () => {
|
|
|
99
102
|
defaultComponent={{
|
|
100
103
|
test: Test,
|
|
101
104
|
}}
|
|
102
|
-
itemProps={{
|
|
103
|
-
style: {
|
|
104
|
-
borderRadius: 10,
|
|
105
|
-
},
|
|
106
|
-
}}
|
|
107
105
|
fieldNames={{
|
|
108
106
|
label: "value",
|
|
109
107
|
value: "key",
|