@hw-component/form 0.0.8-beta-v6 → 0.0.8-beta-v8
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/DialogForm/DrawerForm/index.d.ts +1 -1
- package/es/DialogForm/DrawerForm/index.js +42 -40
- package/es/DialogForm/ModalForm.d.ts +1 -1
- package/es/DialogForm/ModalForm.js +41 -39
- package/es/DialogForm/modal.d.ts +2 -0
- package/es/Form/config.d.ts +6 -4
- package/es/Form/config.js +11 -7
- package/es/Input/TrimInput.d.ts +3 -0
- package/es/Input/TrimInput.js +43 -0
- package/es/Input/VerificationCodeInput.d.ts +3 -3
- package/es/Input/VerificationCodeInput.js +2 -2
- package/es/Input/modal.d.ts +1 -0
- package/es/Switch/index.d.ts +4 -2
- package/es/Switch/index.js +28 -4
- package/es/TextArea/TrimTextArea.d.ts +3 -0
- package/es/TextArea/TrimTextArea.js +43 -0
- package/es/index.d.ts +8 -6
- package/es/index.js +3 -1
- package/lib/DialogForm/DrawerForm/index.d.ts +1 -1
- package/lib/DialogForm/DrawerForm/index.js +42 -40
- package/lib/DialogForm/ModalForm.d.ts +1 -1
- package/lib/DialogForm/ModalForm.js +41 -39
- package/lib/DialogForm/modal.d.ts +2 -0
- package/lib/Form/config.d.ts +6 -4
- package/lib/Form/config.js +6 -2
- package/lib/Input/TrimInput.d.ts +3 -0
- package/lib/Input/TrimInput.js +46 -0
- package/lib/Input/VerificationCodeInput.d.ts +3 -3
- package/lib/Input/VerificationCodeInput.js +2 -2
- package/lib/Input/modal.d.ts +1 -0
- package/lib/Switch/index.d.ts +4 -2
- package/lib/Switch/index.js +28 -4
- package/lib/TextArea/TrimTextArea.d.ts +3 -0
- package/lib/TextArea/TrimTextArea.js +46 -0
- package/lib/index.d.ts +8 -6
- package/lib/index.js +4 -0
- package/package.json +1 -1
- package/src/components/DialogForm/DrawerForm/index.tsx +22 -18
- package/src/components/DialogForm/ModalForm.tsx +21 -17
- package/src/components/DialogForm/modal.ts +5 -0
- package/src/components/Form/config.ts +8 -3
- package/src/components/Input/TrimInput.tsx +26 -0
- package/src/components/Input/VerificationCodeInput.tsx +4 -4
- package/src/components/Input/modal.ts +1 -0
- package/src/components/Switch/index.tsx +27 -1
- package/src/components/TextArea/TrimTextArea.tsx +30 -0
- package/src/components/index.tsx +5 -0
- package/src/pages/Form/index.tsx +20 -0
- package/src/pages/ModalForm/index.tsx +8 -0
|
@@ -21,7 +21,7 @@ var Title = require('./Title.js');
|
|
|
21
21
|
var Footer = require('./Footer.js');
|
|
22
22
|
var FormConfigProvider = require('../../Form/Context/FormConfigProvider.js');
|
|
23
23
|
|
|
24
|
-
var _excluded = ["visible", "title", "onCancel", "configData", "infoRequest", "request", "afterClose", "dialogForm", "closable", "initialValues", "labelWidth", "onOk", "onFinish", "size", "form", "footer", "params", "onValuesChange", "autoClear"];
|
|
24
|
+
var _excluded = ["visible", "title", "onCancel", "configData", "infoRequest", "request", "afterClose", "dialogForm", "closable", "initialValues", "labelWidth", "onOk", "onFinish", "size", "form", "footer", "params", "onValuesChange", "autoClear", "contentRender"];
|
|
25
25
|
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; }
|
|
26
26
|
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; }
|
|
27
27
|
var DrawerForm = (function (_ref) {
|
|
@@ -46,6 +46,7 @@ var DrawerForm = (function (_ref) {
|
|
|
46
46
|
onValuesChange = _ref.onValuesChange,
|
|
47
47
|
_ref$autoClear = _ref.autoClear,
|
|
48
48
|
autoClear = _ref$autoClear === void 0 ? true : _ref$autoClear,
|
|
49
|
+
contentRender = _ref.contentRender,
|
|
49
50
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
50
51
|
var currentForm = hooks.useCurrentForm(dialogForm);
|
|
51
52
|
var providerConfig = FormConfigProvider.useFormConfigContext();
|
|
@@ -89,6 +90,45 @@ var DrawerForm = (function (_ref) {
|
|
|
89
90
|
confirmLoading: loading
|
|
90
91
|
});
|
|
91
92
|
};
|
|
93
|
+
var node = jsxRuntime.jsx(index.default, _objectSpread(_objectSpread({
|
|
94
|
+
configData: modalFormData,
|
|
95
|
+
initialValues: initValue,
|
|
96
|
+
onValuesChange: onValuesChange
|
|
97
|
+
}, props), {}, {
|
|
98
|
+
form: currentForm,
|
|
99
|
+
params: formParams,
|
|
100
|
+
onFinish: function () {
|
|
101
|
+
var _onFinish = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(values, subParams) {
|
|
102
|
+
var result, close;
|
|
103
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
104
|
+
while (1) switch (_context.prev = _context.next) {
|
|
105
|
+
case 0:
|
|
106
|
+
_context.next = 2;
|
|
107
|
+
return run(values, subParams);
|
|
108
|
+
case 2:
|
|
109
|
+
result = _context.sent;
|
|
110
|
+
close = onOk === null || onOk === void 0 ? void 0 : onOk(result, subParams);
|
|
111
|
+
if (!(close === false)) {
|
|
112
|
+
_context.next = 6;
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
return _context.abrupt("return");
|
|
116
|
+
case 6:
|
|
117
|
+
cancel();
|
|
118
|
+
case 7:
|
|
119
|
+
case "end":
|
|
120
|
+
return _context.stop();
|
|
121
|
+
}
|
|
122
|
+
}, _callee);
|
|
123
|
+
}));
|
|
124
|
+
function onFinish(_x, _x2) {
|
|
125
|
+
return _onFinish.apply(this, arguments);
|
|
126
|
+
}
|
|
127
|
+
return onFinish;
|
|
128
|
+
}(),
|
|
129
|
+
infoRequest: infoRequest,
|
|
130
|
+
labelWidth: labelWidth
|
|
131
|
+
}));
|
|
92
132
|
return jsxRuntime.jsx(antd.Drawer, _objectSpread(_objectSpread({
|
|
93
133
|
visible: modalVisible,
|
|
94
134
|
title: jsxRuntime.jsx(Title.default, {
|
|
@@ -102,45 +142,7 @@ var DrawerForm = (function (_ref) {
|
|
|
102
142
|
destroyOnClose: true,
|
|
103
143
|
footer: footerComponent(),
|
|
104
144
|
children: jsxRuntime.jsx(FormConfigProvider.default, _objectSpread(_objectSpread({}, providerConfig), {}, {
|
|
105
|
-
children:
|
|
106
|
-
configData: modalFormData,
|
|
107
|
-
initialValues: initValue,
|
|
108
|
-
onValuesChange: onValuesChange
|
|
109
|
-
}, props), {}, {
|
|
110
|
-
form: currentForm,
|
|
111
|
-
params: formParams,
|
|
112
|
-
onFinish: function () {
|
|
113
|
-
var _onFinish = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(values, subParams) {
|
|
114
|
-
var result, close;
|
|
115
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
116
|
-
while (1) switch (_context.prev = _context.next) {
|
|
117
|
-
case 0:
|
|
118
|
-
_context.next = 2;
|
|
119
|
-
return run(values, subParams);
|
|
120
|
-
case 2:
|
|
121
|
-
result = _context.sent;
|
|
122
|
-
close = onOk === null || onOk === void 0 ? void 0 : onOk(result, subParams);
|
|
123
|
-
if (!(close === false)) {
|
|
124
|
-
_context.next = 6;
|
|
125
|
-
break;
|
|
126
|
-
}
|
|
127
|
-
return _context.abrupt("return");
|
|
128
|
-
case 6:
|
|
129
|
-
cancel();
|
|
130
|
-
case 7:
|
|
131
|
-
case "end":
|
|
132
|
-
return _context.stop();
|
|
133
|
-
}
|
|
134
|
-
}, _callee);
|
|
135
|
-
}));
|
|
136
|
-
function onFinish(_x, _x2) {
|
|
137
|
-
return _onFinish.apply(this, arguments);
|
|
138
|
-
}
|
|
139
|
-
return onFinish;
|
|
140
|
-
}(),
|
|
141
|
-
infoRequest: infoRequest,
|
|
142
|
-
labelWidth: labelWidth
|
|
143
|
-
}))
|
|
145
|
+
children: contentRender ? contentRender(node, currentForm) : node
|
|
144
146
|
}))
|
|
145
147
|
}));
|
|
146
148
|
});
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { DialogFormProps } from "./modal";
|
|
2
|
-
declare const _default: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, initialValues, onFinish, params, onOk, onValuesChange, autoClear, ...props }: DialogFormProps) => JSX.Element;
|
|
2
|
+
declare const _default: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, initialValues, onFinish, params, onOk, onValuesChange, autoClear, contentRender, ...props }: DialogFormProps) => JSX.Element;
|
|
3
3
|
export default _default;
|
|
@@ -19,7 +19,7 @@ var index = require('../Form/index.js');
|
|
|
19
19
|
var FormConfigProvider = require('../Form/Context/FormConfigProvider.js');
|
|
20
20
|
var hooks = require('./hooks.js');
|
|
21
21
|
|
|
22
|
-
var _excluded = ["visible", "title", "onCancel", "configData", "infoRequest", "request", "afterClose", "dialogForm", "initialValues", "onFinish", "params", "onOk", "onValuesChange", "autoClear"];
|
|
22
|
+
var _excluded = ["visible", "title", "onCancel", "configData", "infoRequest", "request", "afterClose", "dialogForm", "initialValues", "onFinish", "params", "onOk", "onValuesChange", "autoClear", "contentRender"];
|
|
23
23
|
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; }
|
|
24
24
|
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; }
|
|
25
25
|
var ModalForm = (function (_ref) {
|
|
@@ -38,6 +38,7 @@ var ModalForm = (function (_ref) {
|
|
|
38
38
|
onValuesChange = _ref.onValuesChange,
|
|
39
39
|
_ref$autoClear = _ref.autoClear,
|
|
40
40
|
autoClear = _ref$autoClear === void 0 ? true : _ref$autoClear,
|
|
41
|
+
contentRender = _ref.contentRender,
|
|
41
42
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
42
43
|
var currentForm = hooks.useCurrentForm(dialogForm);
|
|
43
44
|
var providerConfig = FormConfigProvider.useFormConfigContext();
|
|
@@ -68,6 +69,44 @@ var ModalForm = (function (_ref) {
|
|
|
68
69
|
}),
|
|
69
70
|
loading = _useSub.loading,
|
|
70
71
|
run = _useSub.run;
|
|
72
|
+
var node = jsxRuntime.jsx(index.default, _objectSpread(_objectSpread({
|
|
73
|
+
configData: modalFormData,
|
|
74
|
+
initialValues: initValue,
|
|
75
|
+
onValuesChange: onValuesChange,
|
|
76
|
+
onFinish: function () {
|
|
77
|
+
var _onFinish = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(values, outParams) {
|
|
78
|
+
var result, close;
|
|
79
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
80
|
+
while (1) switch (_context.prev = _context.next) {
|
|
81
|
+
case 0:
|
|
82
|
+
_context.next = 2;
|
|
83
|
+
return run(values, outParams);
|
|
84
|
+
case 2:
|
|
85
|
+
result = _context.sent;
|
|
86
|
+
close = onOk === null || onOk === void 0 ? void 0 : onOk(result, outParams);
|
|
87
|
+
if (!(close === false)) {
|
|
88
|
+
_context.next = 6;
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
return _context.abrupt("return");
|
|
92
|
+
case 6:
|
|
93
|
+
cancel();
|
|
94
|
+
case 7:
|
|
95
|
+
case "end":
|
|
96
|
+
return _context.stop();
|
|
97
|
+
}
|
|
98
|
+
}, _callee);
|
|
99
|
+
}));
|
|
100
|
+
function onFinish(_x, _x2) {
|
|
101
|
+
return _onFinish.apply(this, arguments);
|
|
102
|
+
}
|
|
103
|
+
return onFinish;
|
|
104
|
+
}()
|
|
105
|
+
}, props), {}, {
|
|
106
|
+
params: formParams,
|
|
107
|
+
form: currentForm,
|
|
108
|
+
infoRequest: infoRequest
|
|
109
|
+
}));
|
|
71
110
|
return jsxRuntime.jsx(antd.Modal, _objectSpread(_objectSpread({
|
|
72
111
|
title: modalTitle,
|
|
73
112
|
visible: modalVisible,
|
|
@@ -83,44 +122,7 @@ var ModalForm = (function (_ref) {
|
|
|
83
122
|
onOk: currentForm.submit,
|
|
84
123
|
destroyOnClose: true,
|
|
85
124
|
children: jsxRuntime.jsx(FormConfigProvider.default, _objectSpread(_objectSpread({}, providerConfig), {}, {
|
|
86
|
-
children:
|
|
87
|
-
configData: modalFormData,
|
|
88
|
-
initialValues: initValue,
|
|
89
|
-
onValuesChange: onValuesChange,
|
|
90
|
-
onFinish: function () {
|
|
91
|
-
var _onFinish = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(values, outParams) {
|
|
92
|
-
var result, close;
|
|
93
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
94
|
-
while (1) switch (_context.prev = _context.next) {
|
|
95
|
-
case 0:
|
|
96
|
-
_context.next = 2;
|
|
97
|
-
return run(values, outParams);
|
|
98
|
-
case 2:
|
|
99
|
-
result = _context.sent;
|
|
100
|
-
close = onOk === null || onOk === void 0 ? void 0 : onOk(result, outParams);
|
|
101
|
-
if (!(close === false)) {
|
|
102
|
-
_context.next = 6;
|
|
103
|
-
break;
|
|
104
|
-
}
|
|
105
|
-
return _context.abrupt("return");
|
|
106
|
-
case 6:
|
|
107
|
-
cancel();
|
|
108
|
-
case 7:
|
|
109
|
-
case "end":
|
|
110
|
-
return _context.stop();
|
|
111
|
-
}
|
|
112
|
-
}, _callee);
|
|
113
|
-
}));
|
|
114
|
-
function onFinish(_x, _x2) {
|
|
115
|
-
return _onFinish.apply(this, arguments);
|
|
116
|
-
}
|
|
117
|
-
return onFinish;
|
|
118
|
-
}()
|
|
119
|
-
}, props), {}, {
|
|
120
|
-
params: formParams,
|
|
121
|
-
form: currentForm,
|
|
122
|
-
infoRequest: infoRequest
|
|
123
|
-
}))
|
|
125
|
+
children: contentRender ? contentRender === null || contentRender === void 0 ? void 0 : contentRender(node, currentForm) : node
|
|
124
126
|
}))
|
|
125
127
|
}));
|
|
126
128
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ModalProps } from "antd";
|
|
2
2
|
import type { HFormInstance, HItemProps, HFormProps } from "../Form/modal";
|
|
3
3
|
import type { PromiseFnResult } from "../modal";
|
|
4
|
+
import type React from "react";
|
|
4
5
|
type RootProps = HFormProps & ModalProps;
|
|
5
6
|
export interface ModifyPropsModal<P = any> {
|
|
6
7
|
configData: HItemProps[];
|
|
@@ -32,5 +33,6 @@ export interface DialogFormProps<P = any, T = any> extends Omit<RootProps, "onFi
|
|
|
32
33
|
onOk?: (data: T, params: P) => boolean | void;
|
|
33
34
|
infoRequest?: (params: P) => Promise<T>;
|
|
34
35
|
autoClear?: boolean;
|
|
36
|
+
contentRender?: (dom: React.ReactNode, form: HDialogFormInstance) => React.ReactNode;
|
|
35
37
|
}
|
|
36
38
|
export {};
|
package/lib/Form/config.d.ts
CHANGED
|
@@ -11,14 +11,14 @@ declare const componentConfig: {
|
|
|
11
11
|
checkboxGroup: import("react").ForwardRefExoticComponent<import("./modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
12
12
|
checkBox: import("react").FC<import("../CheckboxGroup/modal").HCheckboxProps>;
|
|
13
13
|
radioGroup: ({ value, options, onChange, fieldNames: propsFieldNames, ...props }: import("../RadioGroup").HRadioGroupProps) => JSX.Element;
|
|
14
|
-
switch: import("react").
|
|
15
|
-
datePicker: import("react").
|
|
14
|
+
switch: import("react").ForwardRefExoticComponent<import("./modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
15
|
+
datePicker: import("react").ForwardRefExoticComponent<import("./modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
16
16
|
rangePicker: {
|
|
17
17
|
Component: import("react").ForwardRefExoticComponent<import("./modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
18
18
|
placeholder: ({ label }: import("./modal").HItemProps) => string[];
|
|
19
19
|
requiredErrMsg: ({ label }: import("./modal").HItemProps) => string;
|
|
20
20
|
};
|
|
21
|
-
timePicker: (
|
|
21
|
+
timePicker: import("react").ForwardRefExoticComponent<import("./modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
22
22
|
input: ({ copy, value, addonAfter, ...props }: import("../Input/modal").HInputProps<any>) => JSX.Element;
|
|
23
23
|
upload: import("react").ForwardRefExoticComponent<import("./modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
24
24
|
urlUpload: ({ placeholder, value, onChange, mediaType, ...props }: import("../Upload/modal").IUrlUploadProps) => JSX.Element;
|
|
@@ -26,6 +26,8 @@ declare const componentConfig: {
|
|
|
26
26
|
textArea: ({ autoSize, ...props }: import("antd/es/input").TextAreaProps) => JSX.Element;
|
|
27
27
|
colorInput: ({ value, onChange, defaultColor, ...props }: import("../Input/modal").HInputProps<any>) => JSX.Element;
|
|
28
28
|
cascader: ({ request, options, fieldNames: propsFieldNames, ...props }: import("../Cascader").HCascaderProps) => JSX.Element;
|
|
29
|
-
verificationCodeInput: () => JSX.Element;
|
|
29
|
+
verificationCodeInput: ({ value, request, form, onChange, ...props }: import("../Input/VerificationCodeInput").HVerificationCodeInputProps) => JSX.Element;
|
|
30
|
+
trimInput: import("react").ForwardRefExoticComponent<import("./modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
31
|
+
trimTextArea: import("react").ForwardRefExoticComponent<import("./modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
30
32
|
};
|
|
31
33
|
export default componentConfig;
|
package/lib/Form/config.js
CHANGED
|
@@ -21,9 +21,11 @@ var index$a = require('../TextArea/index.js');
|
|
|
21
21
|
var index$b = require('../Input/ColorInput/index.js');
|
|
22
22
|
var index$c = require('../Cascader/index.js');
|
|
23
23
|
var VerificationCodeInput = require('../Input/VerificationCodeInput.js');
|
|
24
|
+
var TrimInput = require('../Input/TrimInput.js');
|
|
25
|
+
var TrimTextArea = require('../TextArea/TrimTextArea.js');
|
|
24
26
|
|
|
25
27
|
var placeholderConfig = {
|
|
26
|
-
inputType: ["input", "inputNumber", "selectInput", "buttonInput", "verificationCodeInput"],
|
|
28
|
+
inputType: ["input", "inputNumber", "selectInput", "buttonInput", "verificationCodeInput", "trimInput", ""],
|
|
27
29
|
selectType: ["select", "datePicker", "timePicker", "colorInput"]
|
|
28
30
|
};
|
|
29
31
|
var componentConfig = {
|
|
@@ -45,7 +47,9 @@ var componentConfig = {
|
|
|
45
47
|
textArea: index$a.default,
|
|
46
48
|
colorInput: index$b.default,
|
|
47
49
|
cascader: index$c.default,
|
|
48
|
-
verificationCodeInput: VerificationCodeInput.default
|
|
50
|
+
verificationCodeInput: VerificationCodeInput.default,
|
|
51
|
+
trimInput: TrimInput.default,
|
|
52
|
+
trimTextArea: TrimTextArea.default
|
|
49
53
|
};
|
|
50
54
|
|
|
51
55
|
exports.default = componentConfig;
|
|
@@ -0,0 +1,46 @@
|
|
|
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
|
+
require('core-js/modules/es.function.name.js');
|
|
8
|
+
require('core-js/modules/es.string.trim.js');
|
|
9
|
+
require('core-js/modules/es.object.keys.js');
|
|
10
|
+
require('core-js/modules/es.symbol.js');
|
|
11
|
+
require('core-js/modules/es.array.filter.js');
|
|
12
|
+
require('core-js/modules/es.object.to-string.js');
|
|
13
|
+
require('core-js/modules/es.object.get-own-property-descriptor.js');
|
|
14
|
+
require('core-js/modules/web.dom-collections.for-each.js');
|
|
15
|
+
require('core-js/modules/es.object.get-own-property-descriptors.js');
|
|
16
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
17
|
+
var index = require('./index.js');
|
|
18
|
+
var HFormConnect = require('../Form/HFormConnect.js');
|
|
19
|
+
|
|
20
|
+
var _excluded = ["addFormat"];
|
|
21
|
+
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; }
|
|
22
|
+
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; }
|
|
23
|
+
var Index = function Index(_ref) {
|
|
24
|
+
var addFormat = _ref.addFormat,
|
|
25
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
26
|
+
addFormat === null || addFormat === void 0 || addFormat({
|
|
27
|
+
float: {
|
|
28
|
+
inputValue: function inputValue(item, initValue) {
|
|
29
|
+
var _item$name = item.name,
|
|
30
|
+
valueName = _item$name === void 0 ? "" : _item$name;
|
|
31
|
+
return _defineProperty({}, valueName, initValue[valueName]);
|
|
32
|
+
},
|
|
33
|
+
outputValue: function outputValue(item, _outputValue) {
|
|
34
|
+
var _item$name2 = item.name,
|
|
35
|
+
name = _item$name2 === void 0 ? "" : _item$name2;
|
|
36
|
+
var itemVal = _outputValue[name];
|
|
37
|
+
return _defineProperty({}, name, itemVal === null || itemVal === void 0 ? void 0 : itemVal.trim());
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
return jsxRuntime.jsx(index.default, _objectSpread({}, props));
|
|
42
|
+
};
|
|
43
|
+
var TrimInput = HFormConnect.default(Index);
|
|
44
|
+
|
|
45
|
+
exports.default = TrimInput;
|
|
46
|
+
// powered by h
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { HFormInstance } from "
|
|
1
|
+
import type { HFormInstance } from "../Form/modal";
|
|
2
2
|
import type { InputProps } from "antd";
|
|
3
|
-
interface
|
|
3
|
+
export interface HVerificationCodeInputProps extends Omit<InputProps, "form"> {
|
|
4
4
|
request?: (value: any) => Promise<any>;
|
|
5
5
|
form?: HFormInstance;
|
|
6
6
|
}
|
|
7
|
-
declare const _default: ({ value, request, form, onChange, ...props }:
|
|
7
|
+
declare const _default: ({ value, request, form, onChange, ...props }: HVerificationCodeInputProps) => JSX.Element;
|
|
8
8
|
export default _default;
|
|
@@ -23,7 +23,7 @@ var ahooks = require('ahooks');
|
|
|
23
23
|
var _excluded = ["value", "request", "form", "onChange"];
|
|
24
24
|
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; }
|
|
25
25
|
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; }
|
|
26
|
-
var
|
|
26
|
+
var VerificationCodeInput = (function (_ref) {
|
|
27
27
|
var value = _ref.value,
|
|
28
28
|
request = _ref.request,
|
|
29
29
|
form = _ref.form,
|
|
@@ -109,5 +109,5 @@ var HVerificationCodeInput = (function (_ref) {
|
|
|
109
109
|
}));
|
|
110
110
|
});
|
|
111
111
|
|
|
112
|
-
exports.default =
|
|
112
|
+
exports.default = VerificationCodeInput;
|
|
113
113
|
// powered by h
|
package/lib/Input/modal.d.ts
CHANGED
package/lib/Switch/index.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { SwitchProps } from "antd";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import type { ValueSwitchMapModal } from "../modal";
|
|
4
|
+
import type { addFormatItemModal } from "../Form/modal";
|
|
4
5
|
export interface HSwitchProps extends Omit<SwitchProps, "onChange"> {
|
|
5
6
|
valueMap?: ValueSwitchMapModal;
|
|
6
7
|
value?: any;
|
|
7
8
|
onChange?: (val: any) => void;
|
|
8
9
|
beforeText?: React.ReactNode;
|
|
10
|
+
addFormat?: (format: Record<string, addFormatItemModal>) => void;
|
|
9
11
|
}
|
|
10
|
-
declare const
|
|
11
|
-
export default
|
|
12
|
+
declare const _default: React.ForwardRefExoticComponent<import("../Form/modal").HFormItemProps & React.RefAttributes<any>>;
|
|
13
|
+
export default _default;
|
package/lib/Switch/index.js
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
6
|
+
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
7
|
+
require('core-js/modules/es.function.name.js');
|
|
5
8
|
require('core-js/modules/es.object.keys.js');
|
|
6
9
|
require('core-js/modules/es.symbol.js');
|
|
7
10
|
require('core-js/modules/es.array.filter.js');
|
|
@@ -9,14 +12,13 @@ require('core-js/modules/es.object.to-string.js');
|
|
|
9
12
|
require('core-js/modules/es.object.get-own-property-descriptor.js');
|
|
10
13
|
require('core-js/modules/web.dom-collections.for-each.js');
|
|
11
14
|
require('core-js/modules/es.object.get-own-property-descriptors.js');
|
|
12
|
-
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
13
|
-
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
14
15
|
var jsxRuntime = require('react/jsx-runtime');
|
|
15
16
|
var antd = require('antd');
|
|
16
17
|
var React = require('react');
|
|
17
18
|
var index = require('../hooks/index.js');
|
|
19
|
+
var HFormConnect = require('../Form/HFormConnect.js');
|
|
18
20
|
|
|
19
|
-
var _excluded = ["value", "onChange", "valueMap", "children", "unCheckedChildren", "checkedChildren", "beforeText"];
|
|
21
|
+
var _excluded = ["value", "onChange", "valueMap", "children", "unCheckedChildren", "checkedChildren", "beforeText", "addFormat"];
|
|
20
22
|
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
23
|
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
24
|
var Index = function Index(_ref) {
|
|
@@ -29,6 +31,7 @@ var Index = function Index(_ref) {
|
|
|
29
31
|
_ref$checkedChildren = _ref.checkedChildren,
|
|
30
32
|
checkedChildren = _ref$checkedChildren === void 0 ? "开启" : _ref$checkedChildren,
|
|
31
33
|
beforeText = _ref.beforeText,
|
|
34
|
+
addFormat = _ref.addFormat,
|
|
32
35
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
33
36
|
var _useMatchConfigProps = index.useMatchConfigProps({
|
|
34
37
|
valueSwitchMap: propsValueSwitchMap
|
|
@@ -46,6 +49,26 @@ var Index = function Index(_ref) {
|
|
|
46
49
|
}
|
|
47
50
|
onChange === null || onChange === void 0 || onChange(subVal);
|
|
48
51
|
};
|
|
52
|
+
addFormat === null || addFormat === void 0 || addFormat({
|
|
53
|
+
float: {
|
|
54
|
+
inputValue: function inputValue(item, initValue) {
|
|
55
|
+
var close = valueSwitchMap.close;
|
|
56
|
+
var _item$name = item.name,
|
|
57
|
+
valueName = _item$name === void 0 ? "" : _item$name;
|
|
58
|
+
var val = initValue[valueName];
|
|
59
|
+
if (typeof val === "undefined" || val === null) {
|
|
60
|
+
val = close;
|
|
61
|
+
}
|
|
62
|
+
console.log(val, "");
|
|
63
|
+
return _defineProperty({}, valueName, val);
|
|
64
|
+
},
|
|
65
|
+
outputValue: function outputValue(item, _outputValue) {
|
|
66
|
+
var _item$name2 = item.name,
|
|
67
|
+
name = _item$name2 === void 0 ? "" : _item$name2;
|
|
68
|
+
return _defineProperty({}, name, _outputValue[name]);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
});
|
|
49
72
|
return jsxRuntime.jsxs(antd.Space, {
|
|
50
73
|
children: [beforeText, jsxRuntime.jsx(antd.Switch, _objectSpread({
|
|
51
74
|
checked: swChecked,
|
|
@@ -57,6 +80,7 @@ var Index = function Index(_ref) {
|
|
|
57
80
|
})]
|
|
58
81
|
});
|
|
59
82
|
};
|
|
83
|
+
var HSwitch = HFormConnect.default(Index);
|
|
60
84
|
|
|
61
|
-
exports.default =
|
|
85
|
+
exports.default = HSwitch;
|
|
62
86
|
// powered by h
|
|
@@ -0,0 +1,46 @@
|
|
|
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
|
+
require('core-js/modules/es.function.name.js');
|
|
8
|
+
require('core-js/modules/es.string.trim.js');
|
|
9
|
+
require('core-js/modules/es.object.keys.js');
|
|
10
|
+
require('core-js/modules/es.symbol.js');
|
|
11
|
+
require('core-js/modules/es.array.filter.js');
|
|
12
|
+
require('core-js/modules/es.object.to-string.js');
|
|
13
|
+
require('core-js/modules/es.object.get-own-property-descriptor.js');
|
|
14
|
+
require('core-js/modules/web.dom-collections.for-each.js');
|
|
15
|
+
require('core-js/modules/es.object.get-own-property-descriptors.js');
|
|
16
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
17
|
+
var index = require('./index.js');
|
|
18
|
+
var HFormConnect = require('../Form/HFormConnect.js');
|
|
19
|
+
|
|
20
|
+
var _excluded = ["addFormat"];
|
|
21
|
+
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; }
|
|
22
|
+
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; }
|
|
23
|
+
var Index = function Index(_ref) {
|
|
24
|
+
var addFormat = _ref.addFormat,
|
|
25
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
26
|
+
addFormat === null || addFormat === void 0 || addFormat({
|
|
27
|
+
float: {
|
|
28
|
+
inputValue: function inputValue(item, initValue) {
|
|
29
|
+
var _item$name = item.name,
|
|
30
|
+
valueName = _item$name === void 0 ? "" : _item$name;
|
|
31
|
+
return _defineProperty({}, valueName, initValue[valueName]);
|
|
32
|
+
},
|
|
33
|
+
outputValue: function outputValue(item, _outputValue) {
|
|
34
|
+
var _item$name2 = item.name,
|
|
35
|
+
name = _item$name2 === void 0 ? "" : _item$name2;
|
|
36
|
+
var itemVal = _outputValue[name];
|
|
37
|
+
return _defineProperty({}, name, itemVal === null || itemVal === void 0 ? void 0 : itemVal.trim());
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
return jsxRuntime.jsx(index.default, _objectSpread({}, props));
|
|
42
|
+
};
|
|
43
|
+
var TrimTextArea = HFormConnect.default(Index);
|
|
44
|
+
|
|
45
|
+
exports.default = TrimTextArea;
|
|
46
|
+
// powered by h
|
package/lib/index.d.ts
CHANGED
|
@@ -12,17 +12,19 @@ export declare const HUpload: import("react").ForwardRefExoticComponent<import("
|
|
|
12
12
|
export declare const HUrlUpload: ({ placeholder, value, onChange, mediaType, ...props }: import("./Upload/modal").IUrlUploadProps) => JSX.Element;
|
|
13
13
|
export declare const HButtonInput: import("react").FC<import("./Input/modal").HButtonInputProps>;
|
|
14
14
|
export declare const HCheckBox: import("react").FC<import("./CheckboxGroup/modal").HCheckboxProps>;
|
|
15
|
-
export declare const HSwitch: import("react").
|
|
15
|
+
export declare const HSwitch: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
16
16
|
export declare const HCheckboxGroup: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
17
|
-
export declare const HDatePicker: import("react").
|
|
17
|
+
export declare const HDatePicker: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
18
18
|
export declare const HRangePicker: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
19
19
|
export declare const HRadioGroup: ({ value, options, onChange, fieldNames: propsFieldNames, ...props }: import("./RadioGroup").HRadioGroupProps) => JSX.Element;
|
|
20
|
-
export declare const HTimePicker: (
|
|
20
|
+
export declare const HTimePicker: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
21
21
|
export declare const HInputNumber: ({ style, ...props }: import("antd").InputNumberProps<string | number>) => JSX.Element;
|
|
22
22
|
export declare const HPageHandler: import("react").FC<import("./PageHandler/modal").IHPageHandler<any>>;
|
|
23
23
|
export declare const HTextArea: ({ autoSize, ...props }: import("antd/es/input").TextAreaProps) => JSX.Element;
|
|
24
24
|
export declare const HColorInput: ({ value, onChange, defaultColor, ...props }: import("./Input/modal").HInputProps<any>) => JSX.Element;
|
|
25
|
-
export declare const HModalForm: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, initialValues, onFinish, params, onOk, onValuesChange, ...props }: import("./DialogForm/modal").DialogFormProps<any, any>) => JSX.Element;
|
|
26
|
-
export declare const HDrawerForm: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, closable, initialValues, labelWidth, onOk, onFinish, size, form, footer, params, onValuesChange, ...props }: import("./DialogForm/modal").DialogFormProps<any, any>) => JSX.Element;
|
|
25
|
+
export declare const HModalForm: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, initialValues, onFinish, params, onOk, onValuesChange, autoClear, contentRender, ...props }: import("./DialogForm/modal").DialogFormProps<any, any>) => JSX.Element;
|
|
26
|
+
export declare const HDrawerForm: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, closable, initialValues, labelWidth, onOk, onFinish, size, form, footer, params, onValuesChange, autoClear, contentRender, ...props }: import("./DialogForm/modal").DialogFormProps<any, any>) => JSX.Element;
|
|
27
27
|
export declare const HCascader: ({ request, options, fieldNames: propsFieldNames, ...props }: import("./Cascader").HCascaderProps) => JSX.Element;
|
|
28
|
-
export declare const HVerificationCodeInput: () => JSX.Element;
|
|
28
|
+
export declare const HVerificationCodeInput: ({ value, request, form, onChange, ...props }: import("./Input/VerificationCodeInput").HVerificationCodeInputProps) => JSX.Element;
|
|
29
|
+
export declare const HTrimInput: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
30
|
+
export declare const HTrimTextArea: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
|
package/lib/index.js
CHANGED
|
@@ -31,6 +31,8 @@ var HModalForm = ModalForm.default;
|
|
|
31
31
|
var HDrawerForm = index$2.default;
|
|
32
32
|
var HCascader = config.default.cascader;
|
|
33
33
|
var HVerificationCodeInput = config.default.verificationCodeInput;
|
|
34
|
+
var HTrimInput = config.default.trimInput;
|
|
35
|
+
var HTrimTextArea = config.default.trimTextArea;
|
|
34
36
|
|
|
35
37
|
exports.HForm = index.default;
|
|
36
38
|
exports.useHForm = useHForm.default;
|
|
@@ -55,6 +57,8 @@ exports.HSelectInput = HSelectInput;
|
|
|
55
57
|
exports.HSwitch = HSwitch;
|
|
56
58
|
exports.HTextArea = HTextArea;
|
|
57
59
|
exports.HTimePicker = HTimePicker;
|
|
60
|
+
exports.HTrimInput = HTrimInput;
|
|
61
|
+
exports.HTrimTextArea = HTrimTextArea;
|
|
58
62
|
exports.HUpload = HUpload;
|
|
59
63
|
exports.HUrlUpload = HUrlUpload;
|
|
60
64
|
exports.HVerificationCodeInput = HVerificationCodeInput;
|
package/package.json
CHANGED
|
@@ -27,6 +27,7 @@ export default ({
|
|
|
27
27
|
params,
|
|
28
28
|
onValuesChange,
|
|
29
29
|
autoClear = true,
|
|
30
|
+
contentRender,
|
|
30
31
|
...props
|
|
31
32
|
}: DialogFormProps) => {
|
|
32
33
|
const currentForm = useCurrentForm(dialogForm);
|
|
@@ -71,6 +72,26 @@ export default ({
|
|
|
71
72
|
)
|
|
72
73
|
);
|
|
73
74
|
};
|
|
75
|
+
const node = (
|
|
76
|
+
<HForm
|
|
77
|
+
configData={modalFormData}
|
|
78
|
+
initialValues={initValue}
|
|
79
|
+
onValuesChange={onValuesChange}
|
|
80
|
+
{...props}
|
|
81
|
+
form={currentForm}
|
|
82
|
+
params={formParams}
|
|
83
|
+
onFinish={async (values, subParams) => {
|
|
84
|
+
const result = await run(values, subParams);
|
|
85
|
+
const close = onOk?.(result, subParams);
|
|
86
|
+
if (close === false) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
cancel();
|
|
90
|
+
}}
|
|
91
|
+
infoRequest={infoRequest}
|
|
92
|
+
labelWidth={labelWidth}
|
|
93
|
+
/>
|
|
94
|
+
);
|
|
74
95
|
return (
|
|
75
96
|
<Drawer
|
|
76
97
|
visible={modalVisible}
|
|
@@ -82,24 +103,7 @@ export default ({
|
|
|
82
103
|
footer={footerComponent()}
|
|
83
104
|
>
|
|
84
105
|
<FormConfigProvider {...providerConfig}>
|
|
85
|
-
|
|
86
|
-
configData={modalFormData}
|
|
87
|
-
initialValues={initValue}
|
|
88
|
-
onValuesChange={onValuesChange}
|
|
89
|
-
{...props}
|
|
90
|
-
form={currentForm}
|
|
91
|
-
params={formParams}
|
|
92
|
-
onFinish={async (values, subParams) => {
|
|
93
|
-
const result = await run(values, subParams);
|
|
94
|
-
const close = onOk?.(result, subParams);
|
|
95
|
-
if (close === false) {
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
cancel();
|
|
99
|
-
}}
|
|
100
|
-
infoRequest={infoRequest}
|
|
101
|
-
labelWidth={labelWidth}
|
|
102
|
-
/>
|
|
106
|
+
{contentRender ? contentRender(node, currentForm) : node}
|
|
103
107
|
</FormConfigProvider>
|
|
104
108
|
</Drawer>
|
|
105
109
|
);
|