@hw-component/form 1.9.89 → 1.9.91
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/hooks/useHForm.js +3 -0
- package/es/Form/modal.d.ts +1 -0
- package/es/InputGroup/index.js +17 -2
- package/es/index.css +11 -0
- package/lib/Form/hooks/useHForm.js +3 -0
- package/lib/Form/modal.d.ts +1 -0
- package/lib/InputGroup/index.js +16 -1
- package/lib/index.css +11 -0
- package/package.json +1 -1
- package/src/components/Form/hooks/useHForm.ts +3 -0
- package/src/components/Form/modal.ts +1 -0
- package/src/components/Input/index.less +0 -1
- package/src/components/InputGroup/index.less +19 -0
- package/src/components/InputGroup/index.tsx +17 -2
- package/src/components/styles/local.less +1 -0
- package/src/pages/InputNumberGroup/index.tsx +1 -0
|
@@ -177,6 +177,9 @@ var useHForm = (function () {
|
|
|
177
177
|
var newValue = formatValuesFn(values);
|
|
178
178
|
form.setFieldsValue(newValue);
|
|
179
179
|
},
|
|
180
|
+
setSourceFieldsValue: function setSourceFieldsValue(values) {
|
|
181
|
+
form.setFieldsValue(values);
|
|
182
|
+
},
|
|
180
183
|
validateFields: function validateFields(nameList) {
|
|
181
184
|
return new Promise(function (resolve, reject) {
|
|
182
185
|
form.validateFields(nameList).then(function (value) {
|
package/es/Form/modal.d.ts
CHANGED
|
@@ -153,6 +153,7 @@ export interface HFormInstance extends FormInstance {
|
|
|
153
153
|
clearFormat: (name: string) => void;
|
|
154
154
|
inited: boolean;
|
|
155
155
|
resetFormStatus: VoidFunction;
|
|
156
|
+
setSourceFieldsValue: (values: Record<string, any>) => void;
|
|
156
157
|
}
|
|
157
158
|
export interface ConnectConfigModal {
|
|
158
159
|
format?: Record<string, addFormatItemModal>;
|
package/es/InputGroup/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
|
|
3
3
|
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
|
|
4
4
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
5
|
-
import React from 'react';
|
|
5
|
+
import React, { useMemo } from 'react';
|
|
6
6
|
import { useClassName } from '../hooks/index.js';
|
|
7
7
|
import { Input } from 'antd';
|
|
8
8
|
|
|
@@ -42,6 +42,21 @@ var Index = function Index(_ref2) {
|
|
|
42
42
|
props = _objectWithoutProperties(_ref2, _excluded);
|
|
43
43
|
var contentClassname = useClassName(["hw-input-group"]);
|
|
44
44
|
var bodyClassname = useClassName(["hw-input-group-body"]);
|
|
45
|
+
var beforeBodyClassname = useClassName(["hw-input-group-before-body"]);
|
|
46
|
+
var beforeAfterClassname = useClassName(["hw-input-group-after-body"]);
|
|
47
|
+
var noAddonClassname = useClassName(["hw-input-group-no-addon"]);
|
|
48
|
+
var cuBodyClassName = useMemo(function () {
|
|
49
|
+
if (addonBefore && !addonAfter) {
|
|
50
|
+
return beforeBodyClassname;
|
|
51
|
+
}
|
|
52
|
+
if (addonAfter && !addonBefore) {
|
|
53
|
+
return beforeAfterClassname;
|
|
54
|
+
}
|
|
55
|
+
if (!addonBefore && !addonAfter) {
|
|
56
|
+
return noAddonClassname;
|
|
57
|
+
}
|
|
58
|
+
return "";
|
|
59
|
+
}, [addonAfter, addonBefore]);
|
|
45
60
|
return jsxs(Input.Group, {
|
|
46
61
|
compact: true,
|
|
47
62
|
className: "".concat(contentClassname, " ").concat(className),
|
|
@@ -50,7 +65,7 @@ var Index = function Index(_ref2) {
|
|
|
50
65
|
onChange: onChange,
|
|
51
66
|
children: addonBefore
|
|
52
67
|
}), jsx("div", {
|
|
53
|
-
className: bodyClassname,
|
|
68
|
+
className: "".concat(bodyClassname, " ").concat(cuBodyClassName),
|
|
54
69
|
children: /*#__PURE__*/React.cloneElement(children, _objectSpread({
|
|
55
70
|
value: value,
|
|
56
71
|
onChange: onChange
|
package/es/index.css
CHANGED
|
@@ -302,6 +302,17 @@
|
|
|
302
302
|
.ant-form-item-has-error .ant-hw-input-group-body {
|
|
303
303
|
border-color: #ff4d4f !important;
|
|
304
304
|
}
|
|
305
|
+
.ant-hw-input-group-before-body .ant-hw-input-group-number-body {
|
|
306
|
+
border-top-right-radius: 4px;
|
|
307
|
+
border-bottom-right-radius: 4px;
|
|
308
|
+
}
|
|
309
|
+
.ant-hw-input-group-after-body .ant-hw-input-group-number-body {
|
|
310
|
+
border-top-left-radius: 4px;
|
|
311
|
+
border-bottom-left-radius: 4px;
|
|
312
|
+
}
|
|
313
|
+
.ant-hw-input-group-no-addon .ant-hw-input-group-number-body {
|
|
314
|
+
border-radius: 4px;
|
|
315
|
+
}
|
|
305
316
|
.ant-hw-rich-editor {
|
|
306
317
|
box-sizing: border-box;
|
|
307
318
|
width: 100%;
|
|
@@ -180,6 +180,9 @@ var useHForm = (function () {
|
|
|
180
180
|
var newValue = formatValuesFn(values);
|
|
181
181
|
form.setFieldsValue(newValue);
|
|
182
182
|
},
|
|
183
|
+
setSourceFieldsValue: function setSourceFieldsValue(values) {
|
|
184
|
+
form.setFieldsValue(values);
|
|
185
|
+
},
|
|
183
186
|
validateFields: function validateFields(nameList) {
|
|
184
187
|
return new Promise(function (resolve, reject) {
|
|
185
188
|
form.validateFields(nameList).then(function (value) {
|
package/lib/Form/modal.d.ts
CHANGED
|
@@ -153,6 +153,7 @@ export interface HFormInstance extends FormInstance {
|
|
|
153
153
|
clearFormat: (name: string) => void;
|
|
154
154
|
inited: boolean;
|
|
155
155
|
resetFormStatus: VoidFunction;
|
|
156
|
+
setSourceFieldsValue: (values: Record<string, any>) => void;
|
|
156
157
|
}
|
|
157
158
|
export interface ConnectConfigModal {
|
|
158
159
|
format?: Record<string, addFormatItemModal>;
|
package/lib/InputGroup/index.js
CHANGED
|
@@ -45,6 +45,21 @@ var Index = function Index(_ref2) {
|
|
|
45
45
|
props = _objectWithoutProperties(_ref2, _excluded);
|
|
46
46
|
var contentClassname = index.useClassName(["hw-input-group"]);
|
|
47
47
|
var bodyClassname = index.useClassName(["hw-input-group-body"]);
|
|
48
|
+
var beforeBodyClassname = index.useClassName(["hw-input-group-before-body"]);
|
|
49
|
+
var beforeAfterClassname = index.useClassName(["hw-input-group-after-body"]);
|
|
50
|
+
var noAddonClassname = index.useClassName(["hw-input-group-no-addon"]);
|
|
51
|
+
var cuBodyClassName = React.useMemo(function () {
|
|
52
|
+
if (addonBefore && !addonAfter) {
|
|
53
|
+
return beforeBodyClassname;
|
|
54
|
+
}
|
|
55
|
+
if (addonAfter && !addonBefore) {
|
|
56
|
+
return beforeAfterClassname;
|
|
57
|
+
}
|
|
58
|
+
if (!addonBefore && !addonAfter) {
|
|
59
|
+
return noAddonClassname;
|
|
60
|
+
}
|
|
61
|
+
return "";
|
|
62
|
+
}, [addonAfter, addonBefore]);
|
|
48
63
|
return jsxRuntime.jsxs(antd.Input.Group, {
|
|
49
64
|
compact: true,
|
|
50
65
|
className: "".concat(contentClassname, " ").concat(className),
|
|
@@ -53,7 +68,7 @@ var Index = function Index(_ref2) {
|
|
|
53
68
|
onChange: onChange,
|
|
54
69
|
children: addonBefore
|
|
55
70
|
}), jsxRuntime.jsx("div", {
|
|
56
|
-
className: bodyClassname,
|
|
71
|
+
className: "".concat(bodyClassname, " ").concat(cuBodyClassName),
|
|
57
72
|
children: /*#__PURE__*/React.cloneElement(children, _objectSpread({
|
|
58
73
|
value: value,
|
|
59
74
|
onChange: onChange
|
package/lib/index.css
CHANGED
|
@@ -302,6 +302,17 @@
|
|
|
302
302
|
.ant-form-item-has-error .ant-hw-input-group-body {
|
|
303
303
|
border-color: #ff4d4f !important;
|
|
304
304
|
}
|
|
305
|
+
.ant-hw-input-group-before-body .ant-hw-input-group-number-body {
|
|
306
|
+
border-top-right-radius: 4px;
|
|
307
|
+
border-bottom-right-radius: 4px;
|
|
308
|
+
}
|
|
309
|
+
.ant-hw-input-group-after-body .ant-hw-input-group-number-body {
|
|
310
|
+
border-top-left-radius: 4px;
|
|
311
|
+
border-bottom-left-radius: 4px;
|
|
312
|
+
}
|
|
313
|
+
.ant-hw-input-group-no-addon .ant-hw-input-group-number-body {
|
|
314
|
+
border-radius: 4px;
|
|
315
|
+
}
|
|
305
316
|
.ant-hw-rich-editor {
|
|
306
317
|
box-sizing: border-box;
|
|
307
318
|
width: 100%;
|
package/package.json
CHANGED
|
@@ -160,6 +160,9 @@ export default () => {
|
|
|
160
160
|
const newValue = formatValuesFn(values);
|
|
161
161
|
form.setFieldsValue(newValue);
|
|
162
162
|
},
|
|
163
|
+
setSourceFieldsValue(values){
|
|
164
|
+
form.setFieldsValue(values);
|
|
165
|
+
},
|
|
163
166
|
validateFields(nameList) {
|
|
164
167
|
return new Promise((resolve, reject) => {
|
|
165
168
|
form
|
|
@@ -212,6 +212,7 @@ export interface HFormInstance extends FormInstance {
|
|
|
212
212
|
clearFormat: (name: string) => void;
|
|
213
213
|
inited: boolean;
|
|
214
214
|
resetFormStatus: VoidFunction;
|
|
215
|
+
setSourceFieldsValue:( values: Record<string, any>)=>void;
|
|
215
216
|
}
|
|
216
217
|
|
|
217
218
|
export interface ConnectConfigModal {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
@import "../styles/local.less";
|
|
2
|
+
|
|
2
3
|
@all-input-group: ~"@{ant-prefix}-hw-input-group";
|
|
3
4
|
|
|
4
5
|
.@{all-input-group} {
|
|
@@ -24,3 +25,21 @@
|
|
|
24
25
|
border-color: #ff4d4f !important;
|
|
25
26
|
}
|
|
26
27
|
}
|
|
28
|
+
.@{all-input-group}-before-body{
|
|
29
|
+
.@{all-input-group}-number-body{
|
|
30
|
+
border-top-right-radius:@border-radius-base;
|
|
31
|
+
border-bottom-right-radius:@border-radius-base;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
.@{all-input-group}-after-body{
|
|
35
|
+
.@{all-input-group}-number-body{
|
|
36
|
+
border-top-left-radius:@border-radius-base;
|
|
37
|
+
border-bottom-left-radius:@border-radius-base;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.@{all-input-group}-no-addon{
|
|
42
|
+
.@{all-input-group}-number-body{
|
|
43
|
+
border-radius: @border-radius-base;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, {useMemo} from "react";
|
|
2
2
|
import { useClassName } from "../hooks";
|
|
3
3
|
import { Input } from "antd";
|
|
4
4
|
interface HInputGroupProps<T = any> {
|
|
@@ -34,13 +34,28 @@ const Index: React.FC<HInputGroupProps> = ({
|
|
|
34
34
|
}) => {
|
|
35
35
|
const contentClassname = useClassName(["hw-input-group"]);
|
|
36
36
|
const bodyClassname = useClassName(["hw-input-group-body"]);
|
|
37
|
+
const beforeBodyClassname = useClassName(["hw-input-group-before-body"]);
|
|
38
|
+
const beforeAfterClassname = useClassName(["hw-input-group-after-body"]);
|
|
39
|
+
const noAddonClassname = useClassName(["hw-input-group-no-addon"]);
|
|
37
40
|
|
|
41
|
+
const cuBodyClassName=useMemo(()=>{
|
|
42
|
+
if (addonBefore&&!addonAfter){
|
|
43
|
+
return beforeBodyClassname;
|
|
44
|
+
}
|
|
45
|
+
if (addonAfter&&!addonBefore){
|
|
46
|
+
return beforeAfterClassname;
|
|
47
|
+
}
|
|
48
|
+
if (!addonBefore&&!addonAfter){
|
|
49
|
+
return noAddonClassname;
|
|
50
|
+
}
|
|
51
|
+
return ""
|
|
52
|
+
},[addonAfter,addonBefore]);
|
|
38
53
|
return (
|
|
39
54
|
<Input.Group compact className={`${contentClassname} ${className}`}>
|
|
40
55
|
<Addon value={value} onChange={onChange}>
|
|
41
56
|
{addonBefore}
|
|
42
57
|
</Addon>
|
|
43
|
-
<div className={bodyClassname}>
|
|
58
|
+
<div className={`${bodyClassname} ${cuBodyClassName}`}>
|
|
44
59
|
{React.cloneElement(children as any, { value, onChange, ...props })}
|
|
45
60
|
</div>
|
|
46
61
|
<Addon value={value} onChange={onChange}>
|