@hw-component/form 0.0.6-beta-v5 → 0.0.6-beta-v6
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.js +42 -38
- package/es/DialogForm/ModalForm.js +41 -37
- package/lib/DialogForm/DrawerForm/index.js +42 -38
- package/lib/DialogForm/ModalForm.js +41 -37
- 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/hooks.ts +2 -2
- package/src/components/Form/hooks/useHForm.ts +3 -3
- package/src/components/Upload/UrlUpload/index.tsx +14 -15
- package/src/pages/DrawerForm/index.tsx +4 -5
- package/src/pages/Form/index.tsx +6 -6
- package/src/pages/ModalForm/index.tsx +29 -20
|
@@ -16,6 +16,7 @@ import { useCurrentForm, useModifyProps, useSub } from '../hooks.js';
|
|
|
16
16
|
import HForm from '../../Form/index.js';
|
|
17
17
|
import Title from './Title.js';
|
|
18
18
|
import Footer from './Footer.js';
|
|
19
|
+
import Index, { useFormConfigContext } from '../../Form/Context/FormConfigProvider.js';
|
|
19
20
|
|
|
20
21
|
var _excluded = ["visible", "title", "onCancel", "configData", "infoRequest", "request", "afterClose", "dialogForm", "closable", "initialValues", "labelWidth", "onOk", "onFinish", "size", "form", "footer", "params", "onValuesChange"];
|
|
21
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; }
|
|
@@ -43,6 +44,7 @@ var DrawerForm = (function (_ref) {
|
|
|
43
44
|
onValuesChange = _ref.onValuesChange,
|
|
44
45
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
45
46
|
var currentForm = useCurrentForm(dialogForm);
|
|
47
|
+
var providerConfig = useFormConfigContext();
|
|
46
48
|
var _useModifyProps = useModifyProps({
|
|
47
49
|
configData: configData,
|
|
48
50
|
visible: visible,
|
|
@@ -91,44 +93,46 @@ var DrawerForm = (function (_ref) {
|
|
|
91
93
|
closable: false,
|
|
92
94
|
destroyOnClose: true,
|
|
93
95
|
footer: footerComponent(),
|
|
94
|
-
children: jsx(
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
var
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
96
|
+
children: jsx(Index, _objectSpread(_objectSpread({}, providerConfig), {}, {
|
|
97
|
+
children: jsx(HForm, _objectSpread(_objectSpread({
|
|
98
|
+
configData: modalFormData,
|
|
99
|
+
initialValues: initValue,
|
|
100
|
+
onValuesChange: onValuesChange
|
|
101
|
+
}, props), {}, {
|
|
102
|
+
form: currentForm,
|
|
103
|
+
params: formParams,
|
|
104
|
+
onFinish: function () {
|
|
105
|
+
var _onFinish = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(values, subParams) {
|
|
106
|
+
var result, close;
|
|
107
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
108
|
+
while (1) switch (_context.prev = _context.next) {
|
|
109
|
+
case 0:
|
|
110
|
+
_context.next = 2;
|
|
111
|
+
return run(values, subParams);
|
|
112
|
+
case 2:
|
|
113
|
+
result = _context.sent;
|
|
114
|
+
close = onOk === null || onOk === void 0 ? void 0 : onOk(result, subParams);
|
|
115
|
+
if (!(close === false)) {
|
|
116
|
+
_context.next = 6;
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
return _context.abrupt("return");
|
|
120
|
+
case 6:
|
|
121
|
+
cancel();
|
|
122
|
+
case 7:
|
|
123
|
+
case "end":
|
|
124
|
+
return _context.stop();
|
|
125
|
+
}
|
|
126
|
+
}, _callee);
|
|
127
|
+
}));
|
|
128
|
+
function onFinish(_x, _x2) {
|
|
129
|
+
return _onFinish.apply(this, arguments);
|
|
130
|
+
}
|
|
131
|
+
return onFinish;
|
|
132
|
+
}(),
|
|
133
|
+
infoRequest: infoRequest,
|
|
134
|
+
labelWidth: labelWidth
|
|
135
|
+
}))
|
|
132
136
|
}))
|
|
133
137
|
}));
|
|
134
138
|
});
|
|
@@ -13,6 +13,7 @@ import _regeneratorRuntime from '@babel/runtime-corejs3/regenerator';
|
|
|
13
13
|
import { jsx } from 'react/jsx-runtime';
|
|
14
14
|
import { Modal } from 'antd';
|
|
15
15
|
import HForm from '../Form/index.js';
|
|
16
|
+
import Index, { useFormConfigContext } from '../Form/Context/FormConfigProvider.js';
|
|
16
17
|
import { useCurrentForm, useModifyProps, useSub } from './hooks.js';
|
|
17
18
|
|
|
18
19
|
var _excluded = ["visible", "title", "onCancel", "configData", "infoRequest", "request", "afterClose", "dialogForm", "initialValues", "onFinish", "params", "onOk", "onValuesChange"];
|
|
@@ -35,6 +36,7 @@ var ModalForm = (function (_ref) {
|
|
|
35
36
|
onValuesChange = _ref.onValuesChange,
|
|
36
37
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
37
38
|
var currentForm = useCurrentForm(dialogForm);
|
|
39
|
+
var providerConfig = useFormConfigContext();
|
|
38
40
|
var _useModifyProps = useModifyProps({
|
|
39
41
|
configData: configData,
|
|
40
42
|
visible: visible,
|
|
@@ -73,43 +75,45 @@ var ModalForm = (function (_ref) {
|
|
|
73
75
|
}, props), {}, {
|
|
74
76
|
onOk: currentForm.submit,
|
|
75
77
|
destroyOnClose: true,
|
|
76
|
-
children: jsx(
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
var
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
78
|
+
children: jsx(Index, _objectSpread(_objectSpread({}, providerConfig), {}, {
|
|
79
|
+
children: jsx(HForm, _objectSpread(_objectSpread({
|
|
80
|
+
configData: modalFormData,
|
|
81
|
+
initialValues: initValue,
|
|
82
|
+
onValuesChange: onValuesChange,
|
|
83
|
+
onFinish: function () {
|
|
84
|
+
var _onFinish = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(values, outParams) {
|
|
85
|
+
var result, close;
|
|
86
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
87
|
+
while (1) switch (_context.prev = _context.next) {
|
|
88
|
+
case 0:
|
|
89
|
+
_context.next = 2;
|
|
90
|
+
return run(values, outParams);
|
|
91
|
+
case 2:
|
|
92
|
+
result = _context.sent;
|
|
93
|
+
close = onOk === null || onOk === void 0 ? void 0 : onOk(result, outParams);
|
|
94
|
+
if (!(close === false)) {
|
|
95
|
+
_context.next = 6;
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
return _context.abrupt("return");
|
|
99
|
+
case 6:
|
|
100
|
+
cancel();
|
|
101
|
+
case 7:
|
|
102
|
+
case "end":
|
|
103
|
+
return _context.stop();
|
|
104
|
+
}
|
|
105
|
+
}, _callee);
|
|
106
|
+
}));
|
|
107
|
+
function onFinish(_x, _x2) {
|
|
108
|
+
return _onFinish.apply(this, arguments);
|
|
109
|
+
}
|
|
110
|
+
return onFinish;
|
|
111
|
+
}()
|
|
112
|
+
}, props), {}, {
|
|
113
|
+
params: formParams,
|
|
114
|
+
form: currentForm,
|
|
115
|
+
infoRequest: infoRequest
|
|
116
|
+
}))
|
|
113
117
|
}))
|
|
114
118
|
}));
|
|
115
119
|
});
|
|
@@ -19,6 +19,7 @@ var hooks = require('../hooks.js');
|
|
|
19
19
|
var index = require('../../Form/index.js');
|
|
20
20
|
var Title = require('./Title.js');
|
|
21
21
|
var Footer = require('./Footer.js');
|
|
22
|
+
var FormConfigProvider = require('../../Form/Context/FormConfigProvider.js');
|
|
22
23
|
|
|
23
24
|
var _excluded = ["visible", "title", "onCancel", "configData", "infoRequest", "request", "afterClose", "dialogForm", "closable", "initialValues", "labelWidth", "onOk", "onFinish", "size", "form", "footer", "params", "onValuesChange"];
|
|
24
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; }
|
|
@@ -46,6 +47,7 @@ var DrawerForm = (function (_ref) {
|
|
|
46
47
|
onValuesChange = _ref.onValuesChange,
|
|
47
48
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
48
49
|
var currentForm = hooks.useCurrentForm(dialogForm);
|
|
50
|
+
var providerConfig = FormConfigProvider.useFormConfigContext();
|
|
49
51
|
var _useModifyProps = hooks.useModifyProps({
|
|
50
52
|
configData: configData,
|
|
51
53
|
visible: visible,
|
|
@@ -94,44 +96,46 @@ var DrawerForm = (function (_ref) {
|
|
|
94
96
|
closable: false,
|
|
95
97
|
destroyOnClose: true,
|
|
96
98
|
footer: footerComponent(),
|
|
97
|
-
children: jsxRuntime.jsx(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
var
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
99
|
+
children: jsxRuntime.jsx(FormConfigProvider.default, _objectSpread(_objectSpread({}, providerConfig), {}, {
|
|
100
|
+
children: jsxRuntime.jsx(index.default, _objectSpread(_objectSpread({
|
|
101
|
+
configData: modalFormData,
|
|
102
|
+
initialValues: initValue,
|
|
103
|
+
onValuesChange: onValuesChange
|
|
104
|
+
}, props), {}, {
|
|
105
|
+
form: currentForm,
|
|
106
|
+
params: formParams,
|
|
107
|
+
onFinish: function () {
|
|
108
|
+
var _onFinish = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(values, subParams) {
|
|
109
|
+
var result, close;
|
|
110
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
111
|
+
while (1) switch (_context.prev = _context.next) {
|
|
112
|
+
case 0:
|
|
113
|
+
_context.next = 2;
|
|
114
|
+
return run(values, subParams);
|
|
115
|
+
case 2:
|
|
116
|
+
result = _context.sent;
|
|
117
|
+
close = onOk === null || onOk === void 0 ? void 0 : onOk(result, subParams);
|
|
118
|
+
if (!(close === false)) {
|
|
119
|
+
_context.next = 6;
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
return _context.abrupt("return");
|
|
123
|
+
case 6:
|
|
124
|
+
cancel();
|
|
125
|
+
case 7:
|
|
126
|
+
case "end":
|
|
127
|
+
return _context.stop();
|
|
128
|
+
}
|
|
129
|
+
}, _callee);
|
|
130
|
+
}));
|
|
131
|
+
function onFinish(_x, _x2) {
|
|
132
|
+
return _onFinish.apply(this, arguments);
|
|
133
|
+
}
|
|
134
|
+
return onFinish;
|
|
135
|
+
}(),
|
|
136
|
+
infoRequest: infoRequest,
|
|
137
|
+
labelWidth: labelWidth
|
|
138
|
+
}))
|
|
135
139
|
}))
|
|
136
140
|
}));
|
|
137
141
|
});
|
|
@@ -16,6 +16,7 @@ var _regeneratorRuntime = require('@babel/runtime-corejs3/regenerator');
|
|
|
16
16
|
var jsxRuntime = require('react/jsx-runtime');
|
|
17
17
|
var antd = require('antd');
|
|
18
18
|
var index = require('../Form/index.js');
|
|
19
|
+
var FormConfigProvider = require('../Form/Context/FormConfigProvider.js');
|
|
19
20
|
var hooks = require('./hooks.js');
|
|
20
21
|
|
|
21
22
|
var _excluded = ["visible", "title", "onCancel", "configData", "infoRequest", "request", "afterClose", "dialogForm", "initialValues", "onFinish", "params", "onOk", "onValuesChange"];
|
|
@@ -38,6 +39,7 @@ var ModalForm = (function (_ref) {
|
|
|
38
39
|
onValuesChange = _ref.onValuesChange,
|
|
39
40
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
40
41
|
var currentForm = hooks.useCurrentForm(dialogForm);
|
|
42
|
+
var providerConfig = FormConfigProvider.useFormConfigContext();
|
|
41
43
|
var _useModifyProps = hooks.useModifyProps({
|
|
42
44
|
configData: configData,
|
|
43
45
|
visible: visible,
|
|
@@ -76,43 +78,45 @@ var ModalForm = (function (_ref) {
|
|
|
76
78
|
}, props), {}, {
|
|
77
79
|
onOk: currentForm.submit,
|
|
78
80
|
destroyOnClose: true,
|
|
79
|
-
children: jsxRuntime.jsx(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
var
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
81
|
+
children: jsxRuntime.jsx(FormConfigProvider.default, _objectSpread(_objectSpread({}, providerConfig), {}, {
|
|
82
|
+
children: jsxRuntime.jsx(index.default, _objectSpread(_objectSpread({
|
|
83
|
+
configData: modalFormData,
|
|
84
|
+
initialValues: initValue,
|
|
85
|
+
onValuesChange: onValuesChange,
|
|
86
|
+
onFinish: function () {
|
|
87
|
+
var _onFinish = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(values, outParams) {
|
|
88
|
+
var result, close;
|
|
89
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
90
|
+
while (1) switch (_context.prev = _context.next) {
|
|
91
|
+
case 0:
|
|
92
|
+
_context.next = 2;
|
|
93
|
+
return run(values, outParams);
|
|
94
|
+
case 2:
|
|
95
|
+
result = _context.sent;
|
|
96
|
+
close = onOk === null || onOk === void 0 ? void 0 : onOk(result, outParams);
|
|
97
|
+
if (!(close === false)) {
|
|
98
|
+
_context.next = 6;
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
return _context.abrupt("return");
|
|
102
|
+
case 6:
|
|
103
|
+
cancel();
|
|
104
|
+
case 7:
|
|
105
|
+
case "end":
|
|
106
|
+
return _context.stop();
|
|
107
|
+
}
|
|
108
|
+
}, _callee);
|
|
109
|
+
}));
|
|
110
|
+
function onFinish(_x, _x2) {
|
|
111
|
+
return _onFinish.apply(this, arguments);
|
|
112
|
+
}
|
|
113
|
+
return onFinish;
|
|
114
|
+
}()
|
|
115
|
+
}, props), {}, {
|
|
116
|
+
params: formParams,
|
|
117
|
+
form: currentForm,
|
|
118
|
+
infoRequest: infoRequest
|
|
119
|
+
}))
|
|
116
120
|
}))
|
|
117
121
|
}));
|
|
118
122
|
});
|
package/package.json
CHANGED
|
@@ -4,6 +4,7 @@ import { useCurrentForm, useModifyProps, useSub } from "../hooks";
|
|
|
4
4
|
import HForm from "../../Form";
|
|
5
5
|
import Title from "./Title";
|
|
6
6
|
import Footer from "./Footer";
|
|
7
|
+
import FormConfigProvider,{useFormConfigContext} from "../../Form/Context/FormConfigProvider";
|
|
7
8
|
export default ({
|
|
8
9
|
visible,
|
|
9
10
|
title,
|
|
@@ -26,6 +27,7 @@ export default ({
|
|
|
26
27
|
...props
|
|
27
28
|
}: DialogFormProps) => {
|
|
28
29
|
const currentForm = useCurrentForm(dialogForm);
|
|
30
|
+
const providerConfig=useFormConfigContext();
|
|
29
31
|
const {
|
|
30
32
|
modalVisible,
|
|
31
33
|
modalFormData,
|
|
@@ -72,24 +74,26 @@ export default ({
|
|
|
72
74
|
destroyOnClose={true}
|
|
73
75
|
footer={footerComponent()}
|
|
74
76
|
>
|
|
75
|
-
<
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
77
|
+
<FormConfigProvider {...providerConfig}>
|
|
78
|
+
<HForm
|
|
79
|
+
configData={modalFormData}
|
|
80
|
+
initialValues={initValue}
|
|
81
|
+
onValuesChange={onValuesChange}
|
|
82
|
+
{...props}
|
|
83
|
+
form={currentForm}
|
|
84
|
+
params={formParams}
|
|
85
|
+
onFinish={async (values, subParams) => {
|
|
86
|
+
const result = await run(values, subParams);
|
|
87
|
+
const close = onOk?.(result, subParams);
|
|
88
|
+
if (close === false) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
cancel();
|
|
92
|
+
}}
|
|
93
|
+
infoRequest={infoRequest}
|
|
94
|
+
labelWidth={labelWidth}
|
|
95
|
+
/>
|
|
96
|
+
</FormConfigProvider>
|
|
93
97
|
</Drawer>
|
|
94
98
|
);
|
|
95
99
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Modal } from "antd";
|
|
2
2
|
import type { DialogFormProps } from "./modal";
|
|
3
3
|
import HForm from "../Form";
|
|
4
|
+
import FormConfigProvider, {useFormConfigContext} from '../Form/Context/FormConfigProvider'
|
|
4
5
|
import { useCurrentForm, useModifyProps, useSub } from "./hooks";
|
|
5
6
|
export default ({
|
|
6
7
|
visible,
|
|
@@ -19,6 +20,7 @@ export default ({
|
|
|
19
20
|
...props
|
|
20
21
|
}: DialogFormProps) => {
|
|
21
22
|
const currentForm = useCurrentForm(dialogForm);
|
|
23
|
+
const providerConfig=useFormConfigContext();
|
|
22
24
|
const {
|
|
23
25
|
modalVisible,
|
|
24
26
|
modalFormData,
|
|
@@ -55,23 +57,25 @@ export default ({
|
|
|
55
57
|
onOk={currentForm.submit}
|
|
56
58
|
destroyOnClose={true}
|
|
57
59
|
>
|
|
58
|
-
<
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
60
|
+
<FormConfigProvider {...providerConfig}>
|
|
61
|
+
<HForm
|
|
62
|
+
configData={modalFormData}
|
|
63
|
+
initialValues={initValue}
|
|
64
|
+
onValuesChange={onValuesChange}
|
|
65
|
+
onFinish={async (values, outParams) => {
|
|
66
|
+
const result = await run(values, outParams);
|
|
67
|
+
const close = onOk?.(result, outParams);
|
|
68
|
+
if (close === false) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
cancel();
|
|
72
|
+
}}
|
|
73
|
+
{...props}
|
|
74
|
+
params={formParams}
|
|
75
|
+
form={currentForm}
|
|
76
|
+
infoRequest={infoRequest}
|
|
77
|
+
/>
|
|
78
|
+
</FormConfigProvider>
|
|
75
79
|
</Modal>
|
|
76
80
|
);
|
|
77
81
|
};
|
|
@@ -45,8 +45,8 @@ export const useModifyProps = ({
|
|
|
45
45
|
dialogForm.show = (showParams = {}) => {
|
|
46
46
|
const {
|
|
47
47
|
configData: changeConfigData,
|
|
48
|
-
initialValues: changeInitialValues={},
|
|
49
|
-
params: changeParams={},
|
|
48
|
+
initialValues: changeInitialValues = {},
|
|
49
|
+
params: changeParams = {},
|
|
50
50
|
title: changeTitle,
|
|
51
51
|
} = showParams;
|
|
52
52
|
if (!!changeConfigData) {
|
|
@@ -6,13 +6,13 @@ import TypeEle from "../MediaTypeEle/TypeEle";
|
|
|
6
6
|
import { useRef, useState } from "react";
|
|
7
7
|
import type { RcFile, UploadFile } from "antd/es/upload/interface";
|
|
8
8
|
|
|
9
|
-
const mkSubFileList=(fileList: UploadFile[],maxCount=1)=>{
|
|
10
|
-
const len=fileList.length;
|
|
11
|
-
if (len>maxCount){
|
|
12
|
-
|
|
9
|
+
const mkSubFileList = (fileList: UploadFile[], maxCount = 1) => {
|
|
10
|
+
const len = fileList.length;
|
|
11
|
+
if (len > maxCount) {
|
|
12
|
+
return fileList.slice(len - maxCount);
|
|
13
13
|
}
|
|
14
|
-
return
|
|
15
|
-
}
|
|
14
|
+
return fileList;
|
|
15
|
+
};
|
|
16
16
|
|
|
17
17
|
const Index = ({
|
|
18
18
|
placeholder = "请输入文件地址",
|
|
@@ -21,12 +21,12 @@ const Index = ({
|
|
|
21
21
|
mediaType,
|
|
22
22
|
...props
|
|
23
23
|
}: IUrlUploadProps) => {
|
|
24
|
-
const {maxCount}=props;
|
|
24
|
+
const { maxCount } = props;
|
|
25
25
|
const [url, setUrl] = useState("");
|
|
26
26
|
const [load, setLoad] = useState<boolean>(false);
|
|
27
27
|
const ref = useRef<IUploadRefModal | null>(null);
|
|
28
28
|
const onReady = () => {
|
|
29
|
-
|
|
29
|
+
const newFileList = [...value];
|
|
30
30
|
newFileList.push({
|
|
31
31
|
url,
|
|
32
32
|
uid: new Date().valueOf().toString(),
|
|
@@ -37,7 +37,7 @@ const Index = ({
|
|
|
37
37
|
url,
|
|
38
38
|
},
|
|
39
39
|
});
|
|
40
|
-
onChange?.(mkSubFileList(newFileList,maxCount));
|
|
40
|
+
onChange?.(mkSubFileList(newFileList, maxCount));
|
|
41
41
|
setUrl("");
|
|
42
42
|
setLoad(false);
|
|
43
43
|
};
|
|
@@ -69,7 +69,10 @@ const Index = ({
|
|
|
69
69
|
type,
|
|
70
70
|
};
|
|
71
71
|
});
|
|
72
|
-
ref.current?.change({
|
|
72
|
+
ref.current?.change({
|
|
73
|
+
fileList: mkSubFileList([...value, ...newFileList], maxCount),
|
|
74
|
+
file: newFileList[0],
|
|
75
|
+
});
|
|
73
76
|
setUrl("");
|
|
74
77
|
setLoad(false);
|
|
75
78
|
};
|
|
@@ -84,11 +87,7 @@ const Index = ({
|
|
|
84
87
|
setUrl(e.target.value);
|
|
85
88
|
}}
|
|
86
89
|
/>
|
|
87
|
-
<Upload {...props}
|
|
88
|
-
ref={ref}
|
|
89
|
-
value={value}
|
|
90
|
-
onChange={onChange}
|
|
91
|
-
/>
|
|
90
|
+
<Upload {...props} ref={ref} value={value} onChange={onChange} />
|
|
92
91
|
{load && (
|
|
93
92
|
<div style={{ display: "none" }}>
|
|
94
93
|
<TypeEle
|
|
@@ -117,14 +117,13 @@ export default () => {
|
|
|
117
117
|
显示
|
|
118
118
|
</Button>
|
|
119
119
|
<Button
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
120
|
+
onClick={() => {
|
|
121
|
+
modalForm.show();
|
|
122
|
+
}}
|
|
123
123
|
>
|
|
124
|
-
|
|
124
|
+
打开
|
|
125
125
|
</Button>
|
|
126
126
|
<HDrawerForm
|
|
127
|
-
|
|
128
127
|
configData={data}
|
|
129
128
|
labelWidth={88}
|
|
130
129
|
dialogForm={modalForm}
|
package/src/pages/Form/index.tsx
CHANGED
|
@@ -115,7 +115,7 @@ const formData = (options) => {
|
|
|
115
115
|
name: "urlUpload",
|
|
116
116
|
type: "urlUpload",
|
|
117
117
|
itemProps: {
|
|
118
|
-
maxCount:3
|
|
118
|
+
maxCount: 3,
|
|
119
119
|
},
|
|
120
120
|
rules: [{ required: true }],
|
|
121
121
|
},
|
|
@@ -154,7 +154,7 @@ export default () => {
|
|
|
154
154
|
labelWidth={200}
|
|
155
155
|
form={form}
|
|
156
156
|
initialValues={{
|
|
157
|
-
name:
|
|
157
|
+
name: "fff",
|
|
158
158
|
}}
|
|
159
159
|
onFinish={(value) => {
|
|
160
160
|
console.log(value);
|
|
@@ -187,15 +187,15 @@ export default () => {
|
|
|
187
187
|
</HFormConfigProvider>
|
|
188
188
|
<div
|
|
189
189
|
onClick={() => {
|
|
190
|
-
form.setFieldsValue({name:"123"})
|
|
190
|
+
form.setFieldsValue({ name: "123" });
|
|
191
191
|
}}
|
|
192
192
|
>
|
|
193
193
|
点我
|
|
194
194
|
</div>
|
|
195
195
|
<div
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
196
|
+
onClick={() => {
|
|
197
|
+
form.resetFields();
|
|
198
|
+
}}
|
|
199
199
|
>
|
|
200
200
|
重置
|
|
201
201
|
</div>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Button } from "antd";
|
|
2
|
-
import { HModalForm, useHDialogForm } from "../../components";
|
|
2
|
+
import { HModalForm, useHDialogForm ,HFormConfigProvider} from "../../components";
|
|
3
3
|
const data = [
|
|
4
4
|
{
|
|
5
5
|
label: "输入框",
|
|
@@ -133,28 +133,37 @@ export default () => {
|
|
|
133
133
|
打开
|
|
134
134
|
</Button>
|
|
135
135
|
<Button
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
136
|
+
onClick={() => {
|
|
137
|
+
modalForm.show({
|
|
138
|
+
params: {
|
|
139
|
+
name: num,
|
|
140
|
+
},
|
|
141
|
+
initialValues: {
|
|
142
|
+
name: "name",
|
|
143
|
+
},
|
|
144
|
+
});
|
|
145
|
+
}}
|
|
146
146
|
>
|
|
147
147
|
宣誓
|
|
148
148
|
</Button>
|
|
149
|
-
<
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
149
|
+
<HFormConfigProvider
|
|
150
|
+
uploadProps={{
|
|
151
|
+
request:()=>{
|
|
152
|
+
console.log("request,request,request,request")
|
|
153
|
+
return Promise.resolve({url:"https://gw.alicdn.com/imgextra/i2/O1CN01MYuwJQ1GXVBWryCFJ_!!6000000000632-2-tps-1125-570.png_468x468q75.jpg_.webp"});
|
|
154
|
+
}
|
|
155
|
+
}}
|
|
156
|
+
>
|
|
157
|
+
<HModalForm
|
|
158
|
+
configData={data}
|
|
159
|
+
labelWidth={88}
|
|
160
|
+
request={(val, params) => {
|
|
161
|
+
console.log(val, params);
|
|
162
|
+
}}
|
|
163
|
+
dialogForm={modalForm}
|
|
164
|
+
title="测试"
|
|
165
|
+
/>
|
|
166
|
+
</HFormConfigProvider>
|
|
158
167
|
</>
|
|
159
168
|
);
|
|
160
169
|
};
|