@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/Switch/index.js
CHANGED
|
@@ -1,48 +1,34 @@
|
|
|
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 _objectWithoutProperties = require(
|
|
7
|
-
var antd = require(
|
|
8
|
-
var React = require(
|
|
9
|
-
var index = require(
|
|
5
|
+
var _extends = require('@babel/runtime-corejs3/helpers/extends');
|
|
6
|
+
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
7
|
+
var antd = require('antd');
|
|
8
|
+
var React = require('react');
|
|
9
|
+
var index = require('../hooks/index.js');
|
|
10
10
|
|
|
11
|
-
var _excluded = [
|
|
12
|
-
"value",
|
|
13
|
-
"onChange",
|
|
14
|
-
"valueMap",
|
|
15
|
-
"children",
|
|
16
|
-
"unCheckedChildren",
|
|
17
|
-
"checkedChildren",
|
|
18
|
-
"beforeText",
|
|
19
|
-
];
|
|
11
|
+
var _excluded = ["value", "onChange", "valueMap", "children", "unCheckedChildren", "checkedChildren", "beforeText"];
|
|
20
12
|
var Index = function Index(_ref) {
|
|
21
13
|
var value = _ref.value,
|
|
22
14
|
onChange = _ref.onChange,
|
|
23
15
|
propsValueSwitchMap = _ref.valueMap,
|
|
24
16
|
children = _ref.children,
|
|
25
17
|
_ref$unCheckedChildre = _ref.unCheckedChildren,
|
|
26
|
-
unCheckedChildren =
|
|
27
|
-
_ref$unCheckedChildre === void 0 ? "关闭" : _ref$unCheckedChildre,
|
|
18
|
+
unCheckedChildren = _ref$unCheckedChildre === void 0 ? "关闭" : _ref$unCheckedChildre,
|
|
28
19
|
_ref$checkedChildren = _ref.checkedChildren,
|
|
29
|
-
checkedChildren =
|
|
30
|
-
_ref$checkedChildren === void 0 ? "开启" : _ref$checkedChildren,
|
|
20
|
+
checkedChildren = _ref$checkedChildren === void 0 ? "开启" : _ref$checkedChildren,
|
|
31
21
|
beforeText = _ref.beforeText,
|
|
32
22
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
33
23
|
var _useMatchConfigProps = index.useMatchConfigProps({
|
|
34
|
-
valueSwitchMap: propsValueSwitchMap
|
|
24
|
+
valueSwitchMap: propsValueSwitchMap
|
|
35
25
|
}),
|
|
36
26
|
_useMatchConfigProps$ = _useMatchConfigProps.valueSwitchMap,
|
|
37
|
-
valueSwitchMap =
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
return value === open;
|
|
43
|
-
},
|
|
44
|
-
[value]
|
|
45
|
-
);
|
|
27
|
+
valueSwitchMap = _useMatchConfigProps$ === void 0 ? {} : _useMatchConfigProps$;
|
|
28
|
+
var swChecked = React.useMemo(function () {
|
|
29
|
+
var open = valueSwitchMap.open;
|
|
30
|
+
return value === open;
|
|
31
|
+
}, [value]);
|
|
46
32
|
var change = function change(checked) {
|
|
47
33
|
var subVal = valueSwitchMap.close;
|
|
48
34
|
if (checked) {
|
|
@@ -50,24 +36,12 @@ var Index = function Index(_ref) {
|
|
|
50
36
|
}
|
|
51
37
|
onChange === null || onChange === void 0 ? void 0 : onChange(subVal);
|
|
52
38
|
};
|
|
53
|
-
return /*#__PURE__*/ React.createElement(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
_extends(
|
|
60
|
-
{
|
|
61
|
-
checked: swChecked,
|
|
62
|
-
checkedChildren: checkedChildren,
|
|
63
|
-
unCheckedChildren: unCheckedChildren,
|
|
64
|
-
onChange: change,
|
|
65
|
-
},
|
|
66
|
-
props
|
|
67
|
-
)
|
|
68
|
-
),
|
|
69
|
-
/*#__PURE__*/ React.createElement("span", null, children)
|
|
70
|
-
);
|
|
39
|
+
return /*#__PURE__*/React.createElement(antd.Space, null, beforeText, /*#__PURE__*/React.createElement(antd.Switch, _extends({
|
|
40
|
+
checked: swChecked,
|
|
41
|
+
checkedChildren: checkedChildren,
|
|
42
|
+
unCheckedChildren: unCheckedChildren,
|
|
43
|
+
onChange: change
|
|
44
|
+
}, props)), /*#__PURE__*/React.createElement("span", null, children));
|
|
71
45
|
};
|
|
72
46
|
|
|
73
47
|
exports.default = Index;
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { HItemProps } from "../Form/modal";
|
|
3
3
|
declare const _default: {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import("../Form/modal").ConnectResultProps,
|
|
8
|
-
string | React.JSXElementConstructor<any>
|
|
9
|
-
>;
|
|
10
|
-
placeholder: ({ label }: HItemProps) => string[];
|
|
11
|
-
requiredErrMsg: ({ label }: HItemProps) => string;
|
|
4
|
+
Component: (props: import("../Form/modal").HFormItemProps) => React.ReactElement<import("../Form/modal").ConnectResultProps, string | React.JSXElementConstructor<any>>;
|
|
5
|
+
placeholder: ({ label }: HItemProps) => string[];
|
|
6
|
+
requiredErrMsg: ({ label }: HItemProps) => string;
|
|
12
7
|
};
|
|
13
8
|
export default _default;
|
|
@@ -1,76 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports,
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var _Object$getOwnPropertySymbols = require(
|
|
6
|
-
var _filterInstanceProperty = require(
|
|
7
|
-
var _Object$getOwnPropertyDescriptor = require(
|
|
8
|
-
var _Object$getOwnPropertyDescriptors = require(
|
|
9
|
-
var _Object$defineProperties = require(
|
|
10
|
-
var _Object$defineProperty = require(
|
|
11
|
-
var _extends = require(
|
|
12
|
-
var _defineProperty = require(
|
|
13
|
-
var _objectWithoutProperties = require(
|
|
14
|
-
var _forEachInstanceProperty = require(
|
|
15
|
-
var _Object$values = require(
|
|
16
|
-
var _Object$keys = require(
|
|
17
|
-
var _mapInstanceProperty = require(
|
|
18
|
-
var antd = require(
|
|
19
|
-
var hooks = require(
|
|
20
|
-
var React = require(
|
|
21
|
-
var index = require(
|
|
22
|
-
var HFormConnect = require(
|
|
5
|
+
var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js/object/get-own-property-symbols');
|
|
6
|
+
var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/filter');
|
|
7
|
+
var _Object$getOwnPropertyDescriptor = require('@babel/runtime-corejs3/core-js/object/get-own-property-descriptor');
|
|
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 _extends = require('@babel/runtime-corejs3/helpers/extends');
|
|
12
|
+
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
13
|
+
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
14
|
+
var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/for-each');
|
|
15
|
+
var _Object$values = require('@babel/runtime-corejs3/core-js/object/values');
|
|
16
|
+
var _Object$keys = require('@babel/runtime-corejs3/core-js/object/keys');
|
|
17
|
+
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/map');
|
|
18
|
+
var antd = require('antd');
|
|
19
|
+
var hooks = require('./hooks.js');
|
|
20
|
+
var React = require('react');
|
|
21
|
+
var index = require('../hooks/index.js');
|
|
22
|
+
var HFormConnect = require('../Form/HFormConnect.js');
|
|
23
23
|
|
|
24
|
-
var _excluded = [
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"showTime",
|
|
28
|
-
"format",
|
|
29
|
-
"valueMap",
|
|
30
|
-
"ranges",
|
|
31
|
-
"name",
|
|
32
|
-
"addFormat",
|
|
33
|
-
];
|
|
34
|
-
function ownKeys(object, enumerableOnly) {
|
|
35
|
-
var keys = _Object$keys(object);
|
|
36
|
-
if (_Object$getOwnPropertySymbols) {
|
|
37
|
-
var symbols = _Object$getOwnPropertySymbols(object);
|
|
38
|
-
enumerableOnly &&
|
|
39
|
-
(symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) {
|
|
40
|
-
return _Object$getOwnPropertyDescriptor(object, sym).enumerable;
|
|
41
|
-
})),
|
|
42
|
-
keys.push.apply(keys, symbols);
|
|
43
|
-
}
|
|
44
|
-
return keys;
|
|
45
|
-
}
|
|
46
|
-
function _objectSpread(target) {
|
|
47
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
48
|
-
var _context2, _context3;
|
|
49
|
-
var source = null != arguments[i] ? arguments[i] : {};
|
|
50
|
-
i % 2
|
|
51
|
-
? _forEachInstanceProperty(
|
|
52
|
-
(_context2 = ownKeys(Object(source), !0))
|
|
53
|
-
).call(_context2, function (key) {
|
|
54
|
-
_defineProperty(target, key, source[key]);
|
|
55
|
-
})
|
|
56
|
-
: _Object$getOwnPropertyDescriptors
|
|
57
|
-
? _Object$defineProperties(
|
|
58
|
-
target,
|
|
59
|
-
_Object$getOwnPropertyDescriptors(source)
|
|
60
|
-
)
|
|
61
|
-
: _forEachInstanceProperty((_context3 = ownKeys(Object(source)))).call(
|
|
62
|
-
_context3,
|
|
63
|
-
function (key) {
|
|
64
|
-
_Object$defineProperty(
|
|
65
|
-
target,
|
|
66
|
-
key,
|
|
67
|
-
_Object$getOwnPropertyDescriptor(source, key)
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
return target;
|
|
73
|
-
}
|
|
24
|
+
var _excluded = ["value", "onChange", "showTime", "format", "valueMap", "ranges", "name", "addFormat"];
|
|
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; }
|
|
74
27
|
var RangePicker = antd.DatePicker.RangePicker;
|
|
75
28
|
var HRangePicker = function HRangePicker(_ref) {
|
|
76
29
|
var value = _ref.value,
|
|
@@ -87,65 +40,56 @@ var HRangePicker = function HRangePicker(_ref) {
|
|
|
87
40
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
88
41
|
var _useMatchConfigProps = index.useMatchConfigProps({
|
|
89
42
|
valueRangePickerValueMap: valueMap,
|
|
90
|
-
dateRanges: undefined
|
|
43
|
+
dateRanges: undefined
|
|
91
44
|
}),
|
|
92
45
|
_useMatchConfigProps$ = _useMatchConfigProps.valueRangePickerValueMap,
|
|
93
|
-
valueRangePickerValueMap =
|
|
94
|
-
_useMatchConfigProps$ === void 0 ? {} : _useMatchConfigProps$,
|
|
46
|
+
valueRangePickerValueMap = _useMatchConfigProps$ === void 0 ? {} : _useMatchConfigProps$,
|
|
95
47
|
dateRanges = _useMatchConfigProps.dateRanges;
|
|
96
48
|
var dateMapKeys = hooks.useGetTimeKey({
|
|
97
49
|
valueMap: valueRangePickerValueMap,
|
|
98
|
-
name: name
|
|
50
|
+
name: name
|
|
99
51
|
});
|
|
100
52
|
var paramsProvider = hooks.useRangeValueProvider({
|
|
101
|
-
valueMap: dateMapKeys
|
|
53
|
+
valueMap: dateMapKeys
|
|
102
54
|
});
|
|
103
55
|
var timeVal = hooks.useRangePickerTimeVal({
|
|
104
56
|
value: value,
|
|
105
57
|
format: format,
|
|
106
|
-
valueMap: dateMapKeys
|
|
58
|
+
valueMap: dateMapKeys
|
|
107
59
|
});
|
|
108
|
-
var defaultRanges = React.useMemo(
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
60
|
+
var defaultRanges = React.useMemo(function () {
|
|
61
|
+
if (!ranges) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
if (ranges === true) {
|
|
65
|
+
return dateRanges;
|
|
66
|
+
}
|
|
67
|
+
return ranges;
|
|
68
|
+
}, [ranges]);
|
|
69
|
+
addFormat === null || addFormat === void 0 ? void 0 : addFormat({
|
|
70
|
+
"float": {
|
|
71
|
+
inputValue: function inputValue(item, initValue) {
|
|
72
|
+
var _context;
|
|
73
|
+
var _item$name = item.name,
|
|
74
|
+
valueName = _item$name === void 0 ? "" : _item$name;
|
|
75
|
+
var resultObj = {};
|
|
76
|
+
_forEachInstanceProperty(_context = _Object$values(dateMapKeys)).call(_context, function (key) {
|
|
77
|
+
if (initValue[key]) {
|
|
78
|
+
resultObj[key] = initValue[key];
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
var hasKeys = _Object$keys(resultObj).length !== 0;
|
|
82
|
+
return _defineProperty({}, valueName, hasKeys ? resultObj : null);
|
|
83
|
+
},
|
|
84
|
+
outputValue: function outputValue(item, _outputValue) {
|
|
85
|
+
var _item$name2 = item.name,
|
|
86
|
+
valueName = _item$name2 === void 0 ? "" : _item$name2;
|
|
87
|
+
var _outputValue$valueNam = _outputValue[valueName],
|
|
88
|
+
itemVal = _outputValue$valueNam === void 0 ? {} : _outputValue$valueNam;
|
|
89
|
+
return _objectSpread({}, itemVal);
|
|
115
90
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
[ranges]
|
|
119
|
-
);
|
|
120
|
-
addFormat === null || addFormat === void 0
|
|
121
|
-
? void 0
|
|
122
|
-
: addFormat({
|
|
123
|
-
float: {
|
|
124
|
-
inputValue: function inputValue(item, initValue) {
|
|
125
|
-
var _context;
|
|
126
|
-
var _item$name = item.name,
|
|
127
|
-
valueName = _item$name === void 0 ? "" : _item$name;
|
|
128
|
-
var resultObj = {};
|
|
129
|
-
_forEachInstanceProperty(
|
|
130
|
-
(_context = _Object$values(dateMapKeys))
|
|
131
|
-
).call(_context, function (key) {
|
|
132
|
-
if (initValue[key]) {
|
|
133
|
-
resultObj[key] = initValue[key];
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
var hasKeys = _Object$keys(resultObj).length !== 0;
|
|
137
|
-
return _defineProperty({}, valueName, hasKeys ? resultObj : null);
|
|
138
|
-
},
|
|
139
|
-
outputValue: function outputValue(item, _outputValue) {
|
|
140
|
-
var _item$name2 = item.name,
|
|
141
|
-
valueName = _item$name2 === void 0 ? "" : _item$name2;
|
|
142
|
-
var _outputValue$valueNam = _outputValue[valueName],
|
|
143
|
-
itemVal =
|
|
144
|
-
_outputValue$valueNam === void 0 ? {} : _outputValue$valueNam;
|
|
145
|
-
return _objectSpread({}, itemVal);
|
|
146
|
-
},
|
|
147
|
-
},
|
|
148
|
-
});
|
|
91
|
+
}
|
|
92
|
+
});
|
|
149
93
|
var change = function change(val) {
|
|
150
94
|
if (!format || !val) {
|
|
151
95
|
onChange === null || onChange === void 0 ? void 0 : onChange(val);
|
|
@@ -154,37 +98,26 @@ var HRangePicker = function HRangePicker(_ref) {
|
|
|
154
98
|
var subVal = _mapInstanceProperty(val).call(val, function (item) {
|
|
155
99
|
return item === null || item === void 0 ? void 0 : item.format(format);
|
|
156
100
|
});
|
|
157
|
-
onChange === null || onChange === void 0
|
|
158
|
-
? void 0
|
|
159
|
-
: onChange(paramsProvider(subVal));
|
|
101
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(paramsProvider(subVal));
|
|
160
102
|
};
|
|
161
|
-
return /*#__PURE__*/
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
showTime: showTime,
|
|
168
|
-
ranges: defaultRanges,
|
|
169
|
-
},
|
|
170
|
-
props
|
|
171
|
-
)
|
|
172
|
-
);
|
|
103
|
+
return /*#__PURE__*/React.createElement(RangePicker, _extends({
|
|
104
|
+
value: timeVal,
|
|
105
|
+
onChange: change,
|
|
106
|
+
showTime: showTime,
|
|
107
|
+
ranges: defaultRanges
|
|
108
|
+
}, props));
|
|
173
109
|
};
|
|
174
110
|
var Index = HFormConnect.default(HRangePicker);
|
|
175
111
|
var HRangePicker$1 = {
|
|
176
112
|
Component: Index,
|
|
177
113
|
placeholder: function placeholder(_ref3) {
|
|
178
114
|
var label = _ref3.label;
|
|
179
|
-
return [
|
|
180
|
-
"\u8BF7\u9009\u62E9\u5F00\u59CB".concat(label),
|
|
181
|
-
"\u8BF7\u9009\u62E9\u7ED3\u675F".concat(label),
|
|
182
|
-
];
|
|
115
|
+
return ["\u8BF7\u9009\u62E9\u5F00\u59CB".concat(label), "\u8BF7\u9009\u62E9\u7ED3\u675F".concat(label)];
|
|
183
116
|
},
|
|
184
117
|
requiredErrMsg: function requiredErrMsg(_ref4) {
|
|
185
118
|
var label = _ref4.label;
|
|
186
119
|
return "\u8BF7\u9009\u62E9".concat(label);
|
|
187
|
-
}
|
|
120
|
+
}
|
|
188
121
|
};
|
|
189
122
|
|
|
190
123
|
exports.default = HRangePicker$1;
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { HTimePickerProps } from "./modal";
|
|
3
|
-
declare const _default: ({
|
|
4
|
-
value,
|
|
5
|
-
format,
|
|
6
|
-
onChange,
|
|
7
|
-
...props
|
|
8
|
-
}: HTimePickerProps) => JSX.Element;
|
|
3
|
+
declare const _default: ({ value, format, onChange, ...props }: HTimePickerProps) => JSX.Element;
|
|
9
4
|
export default _default;
|
|
@@ -1,15 +1,15 @@
|
|
|
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(
|
|
9
|
-
var hooks = 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
|
+
var hooks = require('./hooks.js');
|
|
10
10
|
|
|
11
11
|
var _excluded = ["value", "format", "onChange"];
|
|
12
|
-
var HTimePicker = function (_ref) {
|
|
12
|
+
var HTimePicker = (function (_ref) {
|
|
13
13
|
var value = _ref.value,
|
|
14
14
|
_ref$format = _ref.format,
|
|
15
15
|
format = _ref$format === void 0 ? "X" : _ref$format,
|
|
@@ -17,24 +17,18 @@ var HTimePicker = function (_ref) {
|
|
|
17
17
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
18
18
|
var timeVal = hooks.useTimePickerValue({
|
|
19
19
|
value: value,
|
|
20
|
-
format: format
|
|
20
|
+
format: format
|
|
21
21
|
});
|
|
22
22
|
var change = hooks.useTimePickerChange({
|
|
23
23
|
value: value,
|
|
24
24
|
format: format,
|
|
25
|
-
onChange: onChange
|
|
25
|
+
onChange: onChange
|
|
26
26
|
});
|
|
27
|
-
return /*#__PURE__*/
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
onChange: change,
|
|
33
|
-
},
|
|
34
|
-
props
|
|
35
|
-
)
|
|
36
|
-
);
|
|
37
|
-
};
|
|
27
|
+
return /*#__PURE__*/React.createElement(antd.TimePicker, _extends({
|
|
28
|
+
value: timeVal,
|
|
29
|
+
onChange: change
|
|
30
|
+
}, props));
|
|
31
|
+
});
|
|
38
32
|
|
|
39
33
|
exports.default = HTimePicker;
|
|
40
34
|
// powered by h
|
package/lib/TDPicker/hooks.d.ts
CHANGED
|
@@ -2,52 +2,32 @@ import type { Moment, DurationInputArg2 } from "moment";
|
|
|
2
2
|
import type { HRangePickerProps } from "./modal";
|
|
3
3
|
import type { DateRangePickerValueMapModal } from "../modal";
|
|
4
4
|
interface UseTimeValParams {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
value?: any | [any, any];
|
|
6
|
+
format?: string;
|
|
7
|
+
valueMap?: DateRangePickerValueMapModal;
|
|
8
8
|
}
|
|
9
9
|
interface UseTimePickerValParams {
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
value?: any;
|
|
11
|
+
format?: string | DurationInputArg2;
|
|
12
12
|
}
|
|
13
13
|
interface UseTimeChangeParams {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
format?: string;
|
|
15
|
+
onChange?: (time?: Moment | string | number) => void;
|
|
16
|
+
value?: any;
|
|
17
17
|
}
|
|
18
18
|
export declare const useTimeVal: ({ value, format }: UseTimeValParams) => any;
|
|
19
|
-
export declare const useGetTimeKey: ({ valueMap, name }: HRangePickerProps) =>
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
export declare const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
export declare const
|
|
33
|
-
value,
|
|
34
|
-
format,
|
|
35
|
-
}: UseTimePickerValParams) => any;
|
|
36
|
-
export declare const useTimePickerChange: ({
|
|
37
|
-
value,
|
|
38
|
-
format,
|
|
39
|
-
onChange,
|
|
40
|
-
}: UseTimeChangeParams) => (val: any) => void;
|
|
41
|
-
export declare const useRangeValueProvider: ({
|
|
42
|
-
valueMap,
|
|
43
|
-
}: HRangePickerProps) => (val: any[]) =>
|
|
44
|
-
| any[]
|
|
45
|
-
| {
|
|
46
|
-
[x: string]: any;
|
|
47
|
-
};
|
|
48
|
-
export declare const useRangePickerTimeVal: ({
|
|
49
|
-
value,
|
|
50
|
-
format,
|
|
51
|
-
valueMap,
|
|
52
|
-
}: UseTimeValParams) => any;
|
|
19
|
+
export declare const useGetTimeKey: ({ valueMap, name, }: HRangePickerProps) => {
|
|
20
|
+
start?: undefined;
|
|
21
|
+
end?: undefined;
|
|
22
|
+
} | {
|
|
23
|
+
start: string;
|
|
24
|
+
end: string;
|
|
25
|
+
};
|
|
26
|
+
export declare const useTimeChange: ({ format, onChange }: UseTimeChangeParams) => (value: any) => void;
|
|
27
|
+
export declare const useTimePickerValue: ({ value, format, }: UseTimePickerValParams) => any;
|
|
28
|
+
export declare const useTimePickerChange: ({ value, format, onChange, }: UseTimeChangeParams) => (val: any) => void;
|
|
29
|
+
export declare const useRangeValueProvider: ({ valueMap }: HRangePickerProps) => (val: any[]) => any[] | {
|
|
30
|
+
[x: string]: any;
|
|
31
|
+
};
|
|
32
|
+
export declare const useRangePickerTimeVal: ({ value, format, valueMap, }: UseTimeValParams) => any;
|
|
53
33
|
export {};
|