@hw-component/form 0.0.1-beta → 0.0.1-beta-v2
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/CheckboxGroup/CheckBox/index.js +16 -24
- package/es/CheckboxGroup/hooks.d.ts +3 -9
- package/es/CheckboxGroup/hooks.js +64 -115
- package/es/CheckboxGroup/index.d.ts +1 -6
- package/es/CheckboxGroup/index.js +58 -117
- package/es/CheckboxGroup/modal.d.ts +8 -9
- package/es/Form/Context/FormConfigProvider.js +19 -64
- package/es/Form/Context/index.d.ts +1 -4
- package/es/Form/Context/index.js +3 -3
- package/es/Form/FormItem/BasicItem.js +42 -80
- package/es/Form/FormItem/Helper.d.ts +1 -1
- package/es/Form/FormItem/Helper.js +9 -17
- package/es/Form/FormItem/RegularFormItem.js +8 -11
- package/es/Form/FormItem/UpFormItem.d.ts +1 -6
- package/es/Form/FormItem/UpFormItem.js +17 -27
- package/es/Form/FormItem/hooks.d.ts +4 -21
- package/es/Form/FormItem/hooks.js +9 -12
- package/es/Form/FormItem/index.js +5 -5
- package/es/Form/HFormConnect.d.ts +1 -9
- package/es/Form/HFormConnect.js +30 -90
- package/es/Form/InitSet.d.ts +1 -4
- package/es/Form/InitSet.js +6 -7
- package/es/Form/Label.d.ts +4 -4
- package/es/Form/Label.js +19 -36
- package/es/Form/config.d.ts +22 -100
- package/es/Form/config.js +19 -19
- package/es/Form/hooks/index.d.ts +1 -14
- package/es/Form/hooks/index.js +32 -80
- package/es/Form/hooks/useHForm.js +143 -224
- package/es/Form/hooks/useInitConfigData.d.ts +1 -4
- package/es/Form/hooks/useInitConfigData.js +61 -143
- package/es/Form/index.d.ts +1 -11
- package/es/Form/index.js +79 -79
- package/es/Form/modal.d.ts +54 -89
- package/es/Input/ButtonInput.js +51 -73
- package/es/Input/InputNumber.js +12 -21
- package/es/Input/SelectInput.d.ts +4 -16
- package/es/Input/SelectInput.js +62 -116
- package/es/Input/defaultConfig.d.ts +3 -3
- package/es/Input/defaultConfig.js +2 -2
- package/es/Input/index.js +7 -7
- package/es/Input/modal.d.ts +13 -15
- package/es/ModalForm/hooks.d.ts +12 -0
- package/es/ModalForm/hooks.js +63 -0
- package/es/ModalForm/index.d.ts +4 -0
- package/es/ModalForm/index.js +72 -0
- package/es/ModalForm/modal.d.ts +20 -0
- package/es/PageHandler/ErrorComponent.js +25 -47
- package/es/PageHandler/LoadingComponent.js +13 -17
- package/es/PageHandler/index.js +7 -7
- package/es/PageHandler/modal.d.ts +4 -4
- package/es/RadioGroup/index.d.ts +5 -12
- package/es/RadioGroup/index.js +33 -46
- package/es/Select/components/AllSelect.d.ts +1 -1
- package/es/Select/components/AllSelect.js +18 -40
- package/es/Select/components/CheckBoxOption.d.ts +3 -6
- package/es/Select/components/CheckBoxOption.js +7 -12
- package/es/Select/components/DropdownComponent.d.ts +4 -4
- package/es/Select/components/DropdownComponent.js +17 -30
- package/es/Select/components/NoFindItem.d.ts +1 -1
- package/es/Select/components/NoFindItem.js +7 -11
- package/es/Select/components/NotFoundContent.d.ts +2 -2
- package/es/Select/components/NotFoundContent.js +27 -49
- package/es/Select/defaultConfig.d.ts +1 -1
- package/es/Select/defaultConfig.js +16 -20
- package/es/Select/hooks/changeHooks.d.ts +2 -2
- package/es/Select/hooks/changeHooks.js +71 -147
- package/es/Select/hooks/norHooks.d.ts +9 -27
- package/es/Select/hooks/norHooks.js +39 -51
- package/es/Select/index.d.ts +1 -22
- package/es/Select/index.js +65 -124
- package/es/Select/modal.d.ts +15 -15
- package/es/Select/utils.js +15 -60
- package/es/Submit/index.d.ts +3 -9
- package/es/Submit/index.js +13 -18
- package/es/Switch/index.d.ts +4 -4
- package/es/Switch/index.js +20 -46
- package/es/TDPicker/RangePicker.d.ts +3 -8
- package/es/TDPicker/RangePicker.js +67 -138
- package/es/TDPicker/TimePicker.d.ts +1 -6
- package/es/TDPicker/TimePicker.js +13 -19
- package/es/TDPicker/hooks.d.ts +22 -42
- package/es/TDPicker/hooks.js +72 -106
- package/es/TDPicker/index.d.ts +1 -7
- package/es/TDPicker/index.js +14 -20
- package/es/TDPicker/modal.d.ts +16 -21
- package/es/TextArea/index.d.ts +1 -0
- package/es/Upload/Btn.d.ts +1 -5
- package/es/Upload/Btn.js +19 -35
- package/es/Upload/MediaTypeEle/TypeEle.d.ts +5 -10
- package/es/Upload/MediaTypeEle/TypeEle.js +23 -31
- package/es/Upload/MediaTypeEle/index.d.ts +1 -5
- package/es/Upload/MediaTypeEle/index.js +18 -21
- package/es/Upload/Preview/index.d.ts +1 -5
- package/es/Upload/Preview/index.js +13 -17
- package/es/Upload/UrlUpload/index.d.ts +1 -7
- package/es/Upload/UrlUpload/index.js +51 -72
- package/es/Upload/enums.d.ts +3 -3
- package/es/Upload/enums.js +3 -3
- package/es/Upload/hooks/change.d.ts +1 -8
- package/es/Upload/hooks/change.js +58 -115
- package/es/Upload/hooks/customRequest.d.ts +1 -5
- package/es/Upload/hooks/customRequest.js +46 -63
- package/es/Upload/hooks/propsMaker.d.ts +1 -5
- package/es/Upload/hooks/propsMaker.js +13 -52
- package/es/Upload/index.d.ts +1 -3
- package/es/Upload/index.js +61 -131
- package/es/Upload/modal.d.ts +15 -17
- package/es/Upload/util.d.ts +2 -8
- package/es/Upload/util.js +7 -15
- package/es/config.js +31 -34
- package/es/hooks/index.d.ts +7 -14
- package/es/hooks/index.js +49 -124
- package/es/index.d.ts +18 -98
- package/es/index.js +8 -22
- package/es/modal.d.ts +6 -6
- package/lib/CheckboxGroup/CheckBox/index.js +18 -26
- package/lib/CheckboxGroup/hooks.d.ts +3 -9
- package/lib/CheckboxGroup/hooks.js +65 -116
- package/lib/CheckboxGroup/index.d.ts +1 -6
- package/lib/CheckboxGroup/index.js +60 -119
- package/lib/CheckboxGroup/modal.d.ts +8 -9
- package/lib/Form/Context/FormConfigProvider.js +21 -66
- package/lib/Form/Context/index.d.ts +1 -4
- package/lib/Form/Context/index.js +4 -4
- package/lib/Form/FormItem/BasicItem.js +44 -82
- package/lib/Form/FormItem/Helper.d.ts +1 -1
- package/lib/Form/FormItem/Helper.js +11 -19
- package/lib/Form/FormItem/RegularFormItem.js +10 -13
- package/lib/Form/FormItem/UpFormItem.d.ts +1 -6
- package/lib/Form/FormItem/UpFormItem.js +19 -29
- package/lib/Form/FormItem/hooks.d.ts +4 -21
- package/lib/Form/FormItem/hooks.js +10 -13
- package/lib/Form/FormItem/index.js +7 -7
- package/lib/Form/HFormConnect.d.ts +1 -9
- package/lib/Form/HFormConnect.js +32 -92
- package/lib/Form/InitSet.d.ts +1 -4
- package/lib/Form/InitSet.js +8 -9
- package/lib/Form/Label.d.ts +4 -4
- package/lib/Form/Label.js +21 -41
- package/lib/Form/config.d.ts +22 -100
- package/lib/Form/config.js +21 -21
- package/lib/Form/hooks/index.d.ts +1 -14
- package/lib/Form/hooks/index.js +32 -81
- package/lib/Form/hooks/useHForm.js +145 -226
- package/lib/Form/hooks/useInitConfigData.d.ts +1 -4
- package/lib/Form/hooks/useInitConfigData.js +63 -144
- package/lib/Form/index.d.ts +1 -11
- package/lib/Form/index.js +83 -83
- package/lib/Form/modal.d.ts +54 -89
- package/lib/Input/ButtonInput.js +53 -75
- package/lib/Input/InputNumber.js +14 -23
- package/lib/Input/SelectInput.d.ts +4 -16
- package/lib/Input/SelectInput.js +66 -128
- package/lib/Input/defaultConfig.d.ts +3 -3
- package/lib/Input/defaultConfig.js +3 -3
- package/lib/Input/index.js +9 -9
- package/lib/Input/modal.d.ts +13 -15
- package/lib/ModalForm/hooks.d.ts +12 -0
- package/lib/ModalForm/hooks.js +66 -0
- package/lib/ModalForm/index.d.ts +4 -0
- package/lib/ModalForm/index.js +75 -0
- package/lib/ModalForm/modal.d.ts +20 -0
- package/lib/PageHandler/ErrorComponent.js +27 -49
- package/lib/PageHandler/LoadingComponent.js +15 -19
- package/lib/PageHandler/index.js +9 -9
- package/lib/PageHandler/modal.d.ts +4 -4
- package/lib/RadioGroup/index.d.ts +5 -12
- package/lib/RadioGroup/index.js +35 -48
- package/lib/Select/components/AllSelect.d.ts +1 -1
- package/lib/Select/components/AllSelect.js +20 -42
- package/lib/Select/components/CheckBoxOption.d.ts +3 -6
- package/lib/Select/components/CheckBoxOption.js +9 -14
- package/lib/Select/components/DropdownComponent.d.ts +4 -4
- package/lib/Select/components/DropdownComponent.js +19 -32
- package/lib/Select/components/NoFindItem.d.ts +1 -1
- package/lib/Select/components/NoFindItem.js +9 -13
- package/lib/Select/components/NotFoundContent.d.ts +2 -2
- package/lib/Select/components/NotFoundContent.js +29 -51
- package/lib/Select/defaultConfig.d.ts +1 -1
- package/lib/Select/defaultConfig.js +17 -21
- package/lib/Select/hooks/changeHooks.d.ts +2 -2
- package/lib/Select/hooks/changeHooks.js +72 -148
- package/lib/Select/hooks/norHooks.d.ts +9 -27
- package/lib/Select/hooks/norHooks.js +40 -52
- package/lib/Select/index.d.ts +1 -22
- package/lib/Select/index.js +67 -128
- package/lib/Select/modal.d.ts +15 -15
- package/lib/Select/utils.js +16 -61
- package/lib/Submit/index.d.ts +3 -9
- package/lib/Submit/index.js +15 -20
- package/lib/Switch/index.d.ts +4 -4
- package/lib/Switch/index.js +22 -48
- package/lib/TDPicker/RangePicker.d.ts +3 -8
- package/lib/TDPicker/RangePicker.js +69 -136
- package/lib/TDPicker/TimePicker.d.ts +1 -6
- package/lib/TDPicker/TimePicker.js +15 -21
- package/lib/TDPicker/hooks.d.ts +22 -42
- package/lib/TDPicker/hooks.js +72 -98
- package/lib/TDPicker/index.d.ts +1 -7
- package/lib/TDPicker/index.js +16 -22
- package/lib/TDPicker/modal.d.ts +16 -21
- package/lib/TextArea/index.d.ts +1 -0
- package/lib/Upload/Btn.d.ts +1 -5
- package/lib/Upload/Btn.js +21 -37
- package/lib/Upload/MediaTypeEle/TypeEle.d.ts +5 -10
- package/lib/Upload/MediaTypeEle/TypeEle.js +25 -33
- package/lib/Upload/MediaTypeEle/index.d.ts +1 -5
- package/lib/Upload/MediaTypeEle/index.js +20 -23
- package/lib/Upload/Preview/index.d.ts +1 -5
- package/lib/Upload/Preview/index.js +15 -19
- package/lib/Upload/UrlUpload/index.d.ts +1 -7
- package/lib/Upload/UrlUpload/index.js +53 -74
- package/lib/Upload/enums.d.ts +3 -3
- package/lib/Upload/enums.js +4 -4
- package/lib/Upload/hooks/change.d.ts +1 -8
- package/lib/Upload/hooks/change.js +59 -116
- package/lib/Upload/hooks/customRequest.d.ts +1 -5
- package/lib/Upload/hooks/customRequest.js +47 -64
- package/lib/Upload/hooks/propsMaker.d.ts +1 -5
- package/lib/Upload/hooks/propsMaker.js +15 -55
- package/lib/Upload/index.d.ts +1 -3
- package/lib/Upload/index.js +63 -133
- package/lib/Upload/modal.d.ts +15 -17
- package/lib/Upload/util.d.ts +2 -8
- package/lib/Upload/util.js +8 -16
- package/lib/config.js +32 -35
- package/lib/hooks/index.d.ts +7 -14
- package/lib/hooks/index.js +50 -125
- package/lib/index.d.ts +18 -98
- package/lib/index.js +10 -5
- package/lib/modal.d.ts +6 -6
- package/package.json +1 -1
- package/src/components/Form/InitSet.tsx +3 -5
- package/src/components/Form/hooks/index.ts +0 -20
- package/src/components/Form/hooks/useHForm.ts +8 -4
- package/src/components/Form/index.tsx +25 -7
- package/src/components/Form/modal.ts +4 -2
- package/src/components/Input/SelectInput.tsx +3 -2
- package/src/components/Input/modal.ts +2 -0
- package/src/components/ModalForm/hooks.ts +45 -0
- package/src/components/ModalForm/index.tsx +69 -0
- package/src/components/ModalForm/modal.ts +22 -0
- package/src/components/index.tsx +4 -0
- package/src/pages/ModalForm/index.tsx +127 -0
- package/src/routes.tsx +6 -1
package/lib/Input/ButtonInput.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports,
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var _extends = require(
|
|
6
|
-
var _asyncToGenerator = require(
|
|
7
|
-
var _objectWithoutProperties = require(
|
|
8
|
-
var _regeneratorRuntime = require(
|
|
9
|
-
var antd = require(
|
|
10
|
-
var React = require(
|
|
11
|
-
var ahooks = require(
|
|
5
|
+
var _extends = require('@babel/runtime-corejs3/helpers/extends');
|
|
6
|
+
var _asyncToGenerator = require('@babel/runtime-corejs3/helpers/asyncToGenerator');
|
|
7
|
+
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
8
|
+
var _regeneratorRuntime = require('@babel/runtime-corejs3/regenerator');
|
|
9
|
+
var antd = require('antd');
|
|
10
|
+
var React = require('react');
|
|
11
|
+
var ahooks = require('ahooks');
|
|
12
12
|
|
|
13
13
|
var _excluded = ["buttonProps", "value", "onChange", "children", "request"],
|
|
14
14
|
_excluded2 = ["onClick", "type"];
|
|
@@ -24,81 +24,59 @@ var Index = function Index(_ref) {
|
|
|
24
24
|
_buttonProps$type = buttonProps.type,
|
|
25
25
|
type = _buttonProps$type === void 0 ? "primary" : _buttonProps$type,
|
|
26
26
|
oProps = _objectWithoutProperties(buttonProps, _excluded2);
|
|
27
|
-
var _useRequest = ahooks.useRequest(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
manual: true,
|
|
33
|
-
}
|
|
34
|
-
),
|
|
27
|
+
var _useRequest = ahooks.useRequest(function (val) {
|
|
28
|
+
return request === null || request === void 0 ? void 0 : request(val);
|
|
29
|
+
}, {
|
|
30
|
+
manual: true
|
|
31
|
+
}),
|
|
35
32
|
run = _useRequest.run,
|
|
36
33
|
loading = _useRequest.loading;
|
|
37
34
|
var change = function change(e) {
|
|
38
|
-
onChange === null || onChange === void 0
|
|
39
|
-
? void 0
|
|
40
|
-
: onChange(e.target.value);
|
|
35
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(e.target.value);
|
|
41
36
|
};
|
|
42
|
-
var click = /*#__PURE__*/
|
|
43
|
-
var _ref2 = _asyncToGenerator(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
_context.next = 5;
|
|
53
|
-
break;
|
|
54
|
-
}
|
|
55
|
-
_context.next = 4;
|
|
56
|
-
return run(value);
|
|
57
|
-
case 4:
|
|
58
|
-
result = _context.sent;
|
|
59
|
-
case 5:
|
|
60
|
-
onClick === null || onClick === void 0
|
|
61
|
-
? void 0
|
|
62
|
-
: onClick(result, e);
|
|
63
|
-
case 6:
|
|
64
|
-
case "end":
|
|
65
|
-
return _context.stop();
|
|
37
|
+
var click = /*#__PURE__*/function () {
|
|
38
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(e) {
|
|
39
|
+
var result;
|
|
40
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
41
|
+
while (1) switch (_context.prev = _context.next) {
|
|
42
|
+
case 0:
|
|
43
|
+
result = value;
|
|
44
|
+
if (!request) {
|
|
45
|
+
_context.next = 5;
|
|
46
|
+
break;
|
|
66
47
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
48
|
+
_context.next = 4;
|
|
49
|
+
return run(value);
|
|
50
|
+
case 4:
|
|
51
|
+
result = _context.sent;
|
|
52
|
+
case 5:
|
|
53
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(result, e);
|
|
54
|
+
case 6:
|
|
55
|
+
case "end":
|
|
56
|
+
return _context.stop();
|
|
57
|
+
}
|
|
58
|
+
}, _callee);
|
|
59
|
+
}));
|
|
70
60
|
return function click(_x) {
|
|
71
61
|
return _ref2.apply(this, arguments);
|
|
72
62
|
};
|
|
73
|
-
}
|
|
74
|
-
return /*#__PURE__*/
|
|
75
|
-
|
|
76
|
-
{
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
63
|
+
}();
|
|
64
|
+
return /*#__PURE__*/React.createElement(antd.Input.Group, {
|
|
65
|
+
compact: true,
|
|
66
|
+
style: {
|
|
67
|
+
display: "flex"
|
|
68
|
+
}
|
|
69
|
+
}, /*#__PURE__*/React.createElement(antd.Input, _extends({}, props, {
|
|
70
|
+
style: {
|
|
71
|
+
flex: 1
|
|
81
72
|
},
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
onChange: change,
|
|
90
|
-
})
|
|
91
|
-
),
|
|
92
|
-
/*#__PURE__*/ React.createElement(
|
|
93
|
-
antd.Button,
|
|
94
|
-
_extends({}, oProps, {
|
|
95
|
-
type: type,
|
|
96
|
-
onClick: click,
|
|
97
|
-
loading: loading,
|
|
98
|
-
}),
|
|
99
|
-
children
|
|
100
|
-
)
|
|
101
|
-
);
|
|
73
|
+
value: value,
|
|
74
|
+
onChange: change
|
|
75
|
+
})), /*#__PURE__*/React.createElement(antd.Button, _extends({}, oProps, {
|
|
76
|
+
type: type,
|
|
77
|
+
onClick: click,
|
|
78
|
+
loading: loading
|
|
79
|
+
}), children));
|
|
102
80
|
};
|
|
103
81
|
|
|
104
82
|
exports.default = Index;
|
package/lib/Input/InputNumber.js
CHANGED
|
@@ -1,32 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports,
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var React = require(
|
|
6
|
-
var _extends = require(
|
|
7
|
-
var _objectWithoutProperties = require(
|
|
8
|
-
var antd = require(
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var _extends = require('@babel/runtime-corejs3/helpers/extends');
|
|
7
|
+
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
8
|
+
var antd = require('antd');
|
|
9
9
|
|
|
10
10
|
var _excluded = ["style"];
|
|
11
|
-
var HInputNumber = function (_ref) {
|
|
11
|
+
var HInputNumber = (function (_ref) {
|
|
12
12
|
var _ref$style = _ref.style,
|
|
13
|
-
style =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
width: "100%",
|
|
17
|
-
}
|
|
18
|
-
: _ref$style,
|
|
13
|
+
style = _ref$style === void 0 ? {
|
|
14
|
+
width: "100%"
|
|
15
|
+
} : _ref$style,
|
|
19
16
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
20
|
-
return /*#__PURE__*/
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
style: style,
|
|
25
|
-
},
|
|
26
|
-
props
|
|
27
|
-
)
|
|
28
|
-
);
|
|
29
|
-
};
|
|
17
|
+
return /*#__PURE__*/React.createElement(antd.InputNumber, _extends({
|
|
18
|
+
style: style
|
|
19
|
+
}, props));
|
|
20
|
+
});
|
|
30
21
|
|
|
31
22
|
exports.default = HInputNumber;
|
|
32
23
|
// powered by h
|
|
@@ -1,21 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { HSelectInputProps } from "./modal";
|
|
3
3
|
export declare enum SelectInputType {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
input = 0,
|
|
5
|
+
select = 1
|
|
6
6
|
}
|
|
7
|
-
export declare const Index: ({
|
|
8
|
-
|
|
9
|
-
value,
|
|
10
|
-
onChange,
|
|
11
|
-
valueName,
|
|
12
|
-
addFormat,
|
|
13
|
-
...props
|
|
14
|
-
}: HSelectInputProps) => JSX.Element;
|
|
15
|
-
declare const _default: (
|
|
16
|
-
props: import("../Form/modal").HFormItemProps
|
|
17
|
-
) => import("react").ReactElement<
|
|
18
|
-
import("../Form/modal").ConnectResultProps,
|
|
19
|
-
string | import("react").JSXElementConstructor<any>
|
|
20
|
-
>;
|
|
7
|
+
export declare const Index: ({ selectProps, value, onChange, valueName, addFormat, addDispatchListener, ...props }: HSelectInputProps) => JSX.Element;
|
|
8
|
+
declare const _default: (props: import("../Form/modal").HFormItemProps) => import("react").ReactElement<import("../Form/modal").ConnectResultProps, string | import("react").JSXElementConstructor<any>>;
|
|
21
9
|
export default _default;
|
package/lib/Input/SelectInput.js
CHANGED
|
@@ -1,71 +1,33 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports,
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var React = require(
|
|
6
|
-
var _Object$keys = require(
|
|
7
|
-
var _Object$getOwnPropertySymbols = require(
|
|
8
|
-
var _filterInstanceProperty = require(
|
|
9
|
-
var _Object$getOwnPropertyDescriptor = require(
|
|
10
|
-
var _Object$getOwnPropertyDescriptors = require(
|
|
11
|
-
var _Object$defineProperties = require(
|
|
12
|
-
var _Object$defineProperty = require(
|
|
13
|
-
var _extends = require(
|
|
14
|
-
var _defineProperty = require(
|
|
15
|
-
var _objectWithoutProperties = require(
|
|
16
|
-
var _forEachInstanceProperty = require(
|
|
17
|
-
var _Object$values = require(
|
|
18
|
-
var antd = require(
|
|
19
|
-
var index = require(
|
|
20
|
-
var defaultConfig = require(
|
|
21
|
-
var HFormConnect = require(
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var _Object$keys = require('@babel/runtime-corejs3/core-js/object/keys');
|
|
7
|
+
var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js/object/get-own-property-symbols');
|
|
8
|
+
var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/filter');
|
|
9
|
+
var _Object$getOwnPropertyDescriptor = require('@babel/runtime-corejs3/core-js/object/get-own-property-descriptor');
|
|
10
|
+
var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js/object/get-own-property-descriptors');
|
|
11
|
+
var _Object$defineProperties = require('@babel/runtime-corejs3/core-js/object/define-properties');
|
|
12
|
+
var _Object$defineProperty = require('@babel/runtime-corejs3/core-js/object/define-property');
|
|
13
|
+
var _extends = require('@babel/runtime-corejs3/helpers/extends');
|
|
14
|
+
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
15
|
+
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
16
|
+
var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/for-each');
|
|
17
|
+
var _Object$values = require('@babel/runtime-corejs3/core-js/object/values');
|
|
18
|
+
var antd = require('antd');
|
|
19
|
+
var index = require('../Select/index.js');
|
|
20
|
+
var defaultConfig = require('./defaultConfig.js');
|
|
21
|
+
var HFormConnect = require('../Form/HFormConnect.js');
|
|
22
22
|
|
|
23
|
-
var _excluded = ["selectProps", "value", "onChange", "valueName", "addFormat"],
|
|
23
|
+
var _excluded = ["selectProps", "value", "onChange", "valueName", "addFormat", "addDispatchListener"],
|
|
24
24
|
_excluded2 = ["style", "placeholder"];
|
|
25
|
-
function ownKeys(object, enumerableOnly) {
|
|
26
|
-
|
|
27
|
-
if (_Object$getOwnPropertySymbols) {
|
|
28
|
-
var symbols = _Object$getOwnPropertySymbols(object);
|
|
29
|
-
enumerableOnly &&
|
|
30
|
-
(symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) {
|
|
31
|
-
return _Object$getOwnPropertyDescriptor(object, sym).enumerable;
|
|
32
|
-
})),
|
|
33
|
-
keys.push.apply(keys, symbols);
|
|
34
|
-
}
|
|
35
|
-
return keys;
|
|
36
|
-
}
|
|
37
|
-
function _objectSpread(target) {
|
|
38
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
39
|
-
var _context2, _context3;
|
|
40
|
-
var source = null != arguments[i] ? arguments[i] : {};
|
|
41
|
-
i % 2
|
|
42
|
-
? _forEachInstanceProperty(
|
|
43
|
-
(_context2 = ownKeys(Object(source), !0))
|
|
44
|
-
).call(_context2, function (key) {
|
|
45
|
-
_defineProperty(target, key, source[key]);
|
|
46
|
-
})
|
|
47
|
-
: _Object$getOwnPropertyDescriptors
|
|
48
|
-
? _Object$defineProperties(
|
|
49
|
-
target,
|
|
50
|
-
_Object$getOwnPropertyDescriptors(source)
|
|
51
|
-
)
|
|
52
|
-
: _forEachInstanceProperty((_context3 = ownKeys(Object(source)))).call(
|
|
53
|
-
_context3,
|
|
54
|
-
function (key) {
|
|
55
|
-
_Object$defineProperty(
|
|
56
|
-
target,
|
|
57
|
-
key,
|
|
58
|
-
_Object$getOwnPropertyDescriptor(source, key)
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
return target;
|
|
64
|
-
}
|
|
25
|
+
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
26
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context2, _context3; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context2 = ownKeys(Object(source), !0)).call(_context2, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context3 = ownKeys(Object(source))).call(_context3, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
65
27
|
exports.SelectInputType = void 0;
|
|
66
28
|
(function (SelectInputType) {
|
|
67
|
-
SelectInputType[
|
|
68
|
-
SelectInputType[
|
|
29
|
+
SelectInputType[SelectInputType["input"] = 0] = "input";
|
|
30
|
+
SelectInputType[SelectInputType["select"] = 1] = "select";
|
|
69
31
|
})(exports.SelectInputType || (exports.SelectInputType = {}));
|
|
70
32
|
var Index = function Index(_ref) {
|
|
71
33
|
var _ref$selectProps = _ref.selectProps,
|
|
@@ -74,12 +36,10 @@ var Index = function Index(_ref) {
|
|
|
74
36
|
value = _ref$value === void 0 ? {} : _ref$value,
|
|
75
37
|
onChange = _ref.onChange,
|
|
76
38
|
_ref$valueName = _ref.valueName,
|
|
77
|
-
valueName =
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
addFormat = _ref.addFormat,
|
|
82
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
39
|
+
valueName = _ref$valueName === void 0 ? defaultConfig.defaultValueName : _ref$valueName,
|
|
40
|
+
addFormat = _ref.addFormat;
|
|
41
|
+
_ref.addDispatchListener;
|
|
42
|
+
var props = _objectWithoutProperties(_ref, _excluded);
|
|
83
43
|
var _valueName$input = valueName.input,
|
|
84
44
|
input = _valueName$input === void 0 ? "" : _valueName$input,
|
|
85
45
|
_valueName$select = valueName.select,
|
|
@@ -87,74 +47,52 @@ var Index = function Index(_ref) {
|
|
|
87
47
|
var inputVal = value[input],
|
|
88
48
|
selectVal = value[select];
|
|
89
49
|
var _selectProps$style = selectProps.style,
|
|
90
|
-
style =
|
|
91
|
-
_selectProps$style === void 0
|
|
92
|
-
? defaultConfig.defaultSelectStyle
|
|
93
|
-
: _selectProps$style,
|
|
50
|
+
style = _selectProps$style === void 0 ? defaultConfig.defaultSelectStyle : _selectProps$style,
|
|
94
51
|
_selectProps$placehol = selectProps.placeholder,
|
|
95
|
-
placeholder =
|
|
96
|
-
_selectProps$placehol === void 0 ? "请选择" : _selectProps$placehol,
|
|
52
|
+
placeholder = _selectProps$placehol === void 0 ? "请选择" : _selectProps$placehol,
|
|
97
53
|
sProps = _objectWithoutProperties(selectProps, _excluded2);
|
|
98
54
|
var change = function change(val, key) {
|
|
99
55
|
var newVal = _objectSpread({}, value);
|
|
100
56
|
newVal[key] = val;
|
|
101
|
-
var type =
|
|
102
|
-
key === input
|
|
103
|
-
? exports.SelectInputType.input
|
|
104
|
-
: exports.SelectInputType.select;
|
|
57
|
+
var type = key === input ? exports.SelectInputType.input : exports.SelectInputType.select;
|
|
105
58
|
onChange === null || onChange === void 0 ? void 0 : onChange(newVal, type);
|
|
106
59
|
};
|
|
107
|
-
addFormat === null || addFormat === void 0
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
resultObj[key] = initValue[key];
|
|
119
|
-
});
|
|
120
|
-
return _defineProperty({}, name, resultObj);
|
|
121
|
-
},
|
|
122
|
-
outputValue: function outputValue(item, _outputValue) {
|
|
123
|
-
var name = item.name;
|
|
124
|
-
var _outputValue$name = _outputValue[name],
|
|
125
|
-
itemVal = _outputValue$name === void 0 ? {} : _outputValue$name;
|
|
126
|
-
var newItemVal = _defineProperty(
|
|
127
|
-
{},
|
|
128
|
-
itemVal[select],
|
|
129
|
-
itemVal[input]
|
|
130
|
-
);
|
|
131
|
-
return _objectSpread({}, newItemVal);
|
|
132
|
-
},
|
|
133
|
-
},
|
|
134
|
-
});
|
|
135
|
-
return /*#__PURE__*/ React.createElement(
|
|
136
|
-
antd.Input,
|
|
137
|
-
_extends(
|
|
138
|
-
{
|
|
139
|
-
value: inputVal,
|
|
140
|
-
onChange: function onChange(e) {
|
|
141
|
-
change(e.target.value, input);
|
|
142
|
-
},
|
|
143
|
-
addonBefore: /*#__PURE__*/ React.createElement(
|
|
144
|
-
index.default,
|
|
145
|
-
_extends({}, sProps, {
|
|
146
|
-
style: style,
|
|
147
|
-
placeholder: placeholder,
|
|
148
|
-
value: selectVal,
|
|
149
|
-
onChange: function onChange(val) {
|
|
150
|
-
change(val, select);
|
|
151
|
-
},
|
|
152
|
-
})
|
|
153
|
-
),
|
|
60
|
+
addFormat === null || addFormat === void 0 ? void 0 : addFormat({
|
|
61
|
+
"float": {
|
|
62
|
+
inputValue: function inputValue(item, initValue) {
|
|
63
|
+
var _context;
|
|
64
|
+
var _item$name = item.name,
|
|
65
|
+
name = _item$name === void 0 ? "" : _item$name;
|
|
66
|
+
var resultObj = {};
|
|
67
|
+
_forEachInstanceProperty(_context = _Object$values(valueName)).call(_context, function (key) {
|
|
68
|
+
resultObj[key] = initValue[key];
|
|
69
|
+
});
|
|
70
|
+
return _defineProperty({}, name, resultObj);
|
|
154
71
|
},
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
72
|
+
outputValue: function outputValue(item, _outputValue) {
|
|
73
|
+
var _item$name2 = item.name,
|
|
74
|
+
name = _item$name2 === void 0 ? "" : _item$name2;
|
|
75
|
+
var _outputValue$name = _outputValue[name],
|
|
76
|
+
itemVal = _outputValue$name === void 0 ? {} : _outputValue$name;
|
|
77
|
+
var newItemVal = _defineProperty({}, itemVal[select], itemVal[input]);
|
|
78
|
+
return _objectSpread({}, newItemVal);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
return /*#__PURE__*/React.createElement(antd.Input, _extends({
|
|
83
|
+
value: inputVal,
|
|
84
|
+
onChange: function onChange(e) {
|
|
85
|
+
change(e.target.value, input);
|
|
86
|
+
},
|
|
87
|
+
addonBefore: /*#__PURE__*/React.createElement(index.default, _extends({}, sProps, {
|
|
88
|
+
style: style,
|
|
89
|
+
placeholder: placeholder,
|
|
90
|
+
value: selectVal,
|
|
91
|
+
onChange: function onChange(val) {
|
|
92
|
+
change(val, select);
|
|
93
|
+
}
|
|
94
|
+
}))
|
|
95
|
+
}, props));
|
|
158
96
|
};
|
|
159
97
|
var HSelectInput = HFormConnect.default(Index);
|
|
160
98
|
|
package/lib/Input/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports,
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var React = require(
|
|
6
|
-
var _objectDestructuringEmpty = require(
|
|
7
|
-
var _extends = require(
|
|
8
|
-
var antd = require(
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var _objectDestructuringEmpty = require('@babel/runtime-corejs3/helpers/objectDestructuringEmpty');
|
|
7
|
+
var _extends = require('@babel/runtime-corejs3/helpers/extends');
|
|
8
|
+
var antd = require('antd');
|
|
9
9
|
|
|
10
|
-
var HInput = function (_ref) {
|
|
10
|
+
var HInput = (function (_ref) {
|
|
11
11
|
var props = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
|
|
12
|
-
return /*#__PURE__*/
|
|
13
|
-
};
|
|
12
|
+
return /*#__PURE__*/React.createElement(antd.Input, props);
|
|
13
|
+
});
|
|
14
14
|
|
|
15
15
|
exports.default = HInput;
|
|
16
16
|
// powered by h
|
package/lib/Input/modal.d.ts
CHANGED
|
@@ -3,27 +3,25 @@ import type { HSelectProps } from "../Select/modal";
|
|
|
3
3
|
import type { SelectInputType } from "./SelectInput";
|
|
4
4
|
import type { PromiseFnResult } from "../modal";
|
|
5
5
|
import type { addFormatItemModal } from "../Form/modal";
|
|
6
|
+
import type { AddDispatchListenerFn } from "../Form/modal";
|
|
6
7
|
export type HInputProps = InputProps;
|
|
7
8
|
interface ValueNameModal {
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
input?: string;
|
|
10
|
+
select?: string;
|
|
10
11
|
}
|
|
11
|
-
export interface HSelectInputProps
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
export interface HSelectInputProps extends Omit<HInputProps, "value" | "onChange"> {
|
|
13
|
+
selectProps?: HSelectProps;
|
|
14
|
+
value?: Record<string, any>;
|
|
15
|
+
onChange?: (value: Record<string, any>, type: SelectInputType) => void;
|
|
16
|
+
valueName?: ValueNameModal;
|
|
17
|
+
addFormat?: (config: Record<string, addFormatItemModal>) => void;
|
|
18
|
+
addDispatchListener?: AddDispatchListenerFn;
|
|
18
19
|
}
|
|
19
20
|
export interface HButtonProps extends Omit<ButtonProps, "onClick"> {
|
|
20
|
-
|
|
21
|
-
value: string | readonly string[] | number | undefined,
|
|
22
|
-
e: HTMLElement
|
|
23
|
-
) => void;
|
|
21
|
+
onClick: (value: string | readonly string[] | number | undefined, e: HTMLElement) => void;
|
|
24
22
|
}
|
|
25
23
|
export interface HButtonInputProps extends HInputProps {
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
buttonProps?: HButtonProps;
|
|
25
|
+
request?: PromiseFnResult;
|
|
28
26
|
}
|
|
29
27
|
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { HModalFormInstance, ModifyPropsModal } from "@/components/ModalForm/modal";
|
|
3
|
+
export declare const useModifyProps: ({ visible, configData, initialValues, }: ModifyPropsModal) => {
|
|
4
|
+
modalFormData: import("../Form/modal").HItemProps[];
|
|
5
|
+
modalVisible: boolean | undefined;
|
|
6
|
+
setModalVisible: import("react").Dispatch<import("react").SetStateAction<boolean | undefined>>;
|
|
7
|
+
setModalFormData: import("react").Dispatch<import("react").SetStateAction<import("../Form/modal").HItemProps[]>>;
|
|
8
|
+
initValue: Record<string, any> | undefined;
|
|
9
|
+
setInitValue: import("react").Dispatch<import("react").SetStateAction<Record<string, any> | undefined>>;
|
|
10
|
+
};
|
|
11
|
+
export declare const useHModalForm: () => HModalFormInstance;
|
|
12
|
+
export declare const useCurrentForm: (hModalForm?: HModalFormInstance) => HModalFormInstance;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _Object$keys = require('@babel/runtime-corejs3/core-js/object/keys');
|
|
4
|
+
var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js/object/get-own-property-symbols');
|
|
5
|
+
var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/filter');
|
|
6
|
+
var _Object$getOwnPropertyDescriptor = require('@babel/runtime-corejs3/core-js/object/get-own-property-descriptor');
|
|
7
|
+
var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/for-each');
|
|
8
|
+
var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js/object/get-own-property-descriptors');
|
|
9
|
+
var _Object$defineProperties = require('@babel/runtime-corejs3/core-js/object/define-properties');
|
|
10
|
+
var _Object$defineProperty = require('@babel/runtime-corejs3/core-js/object/define-property');
|
|
11
|
+
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
12
|
+
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
13
|
+
var React = require('react');
|
|
14
|
+
var useHForm = require('../Form/hooks/useHForm.js');
|
|
15
|
+
|
|
16
|
+
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
17
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
18
|
+
var useModifyProps = function useModifyProps(_ref) {
|
|
19
|
+
var visible = _ref.visible,
|
|
20
|
+
configData = _ref.configData,
|
|
21
|
+
initialValues = _ref.initialValues;
|
|
22
|
+
var _useState = React.useState(visible),
|
|
23
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
24
|
+
modalVisible = _useState2[0],
|
|
25
|
+
setModalVisible = _useState2[1];
|
|
26
|
+
var _useState3 = React.useState(configData),
|
|
27
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
28
|
+
modalFormData = _useState4[0],
|
|
29
|
+
setModalFormData = _useState4[1];
|
|
30
|
+
var _useState5 = React.useState(initialValues),
|
|
31
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
32
|
+
initValue = _useState6[0],
|
|
33
|
+
setInitValue = _useState6[1];
|
|
34
|
+
React.useEffect(function () {
|
|
35
|
+
setModalVisible(visible);
|
|
36
|
+
}, [visible]);
|
|
37
|
+
React.useEffect(function () {
|
|
38
|
+
setModalFormData(configData);
|
|
39
|
+
}, [configData]);
|
|
40
|
+
return {
|
|
41
|
+
modalFormData: modalFormData,
|
|
42
|
+
modalVisible: modalVisible,
|
|
43
|
+
setModalVisible: setModalVisible,
|
|
44
|
+
setModalFormData: setModalFormData,
|
|
45
|
+
initValue: initValue,
|
|
46
|
+
setInitValue: setInitValue
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
var useHModalForm = function useHModalForm() {
|
|
50
|
+
var hForm = useHForm.default();
|
|
51
|
+
return React.useMemo(function () {
|
|
52
|
+
return _objectSpread(_objectSpread({}, hForm), {}, {
|
|
53
|
+
show: function show(params) {},
|
|
54
|
+
hide: function hide() {}
|
|
55
|
+
});
|
|
56
|
+
}, []);
|
|
57
|
+
};
|
|
58
|
+
var useCurrentForm = function useCurrentForm(hModalForm) {
|
|
59
|
+
var defaultHModalForm = useHModalForm();
|
|
60
|
+
return hModalForm || defaultHModalForm;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
exports.useCurrentForm = useCurrentForm;
|
|
64
|
+
exports.useHModalForm = useHModalForm;
|
|
65
|
+
exports.useModifyProps = useModifyProps;
|
|
66
|
+
// powered by h
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { ModalFormProps } from "@/components/ModalForm/modal";
|
|
3
|
+
declare const _default: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, modalForm, initialValues, ...props }: ModalFormProps) => JSX.Element;
|
|
4
|
+
export default _default;
|