@hw-component/form 0.0.1-bate → 0.0.1-beta
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 +24 -16
- package/es/CheckboxGroup/hooks.d.ts +9 -3
- package/es/CheckboxGroup/hooks.js +115 -64
- package/es/CheckboxGroup/index.d.ts +6 -1
- package/es/CheckboxGroup/index.js +117 -56
- package/es/CheckboxGroup/modal.d.ts +9 -8
- package/es/Form/Context/FormConfigProvider.js +64 -19
- package/es/Form/Context/index.d.ts +4 -1
- package/es/Form/Context/index.js +3 -3
- package/es/Form/FormItem/BasicItem.js +80 -42
- package/es/Form/FormItem/Helper.d.ts +1 -1
- package/es/Form/FormItem/Helper.js +17 -9
- package/es/Form/FormItem/RegularFormItem.js +11 -8
- package/es/Form/FormItem/UpFormItem.d.ts +6 -1
- package/es/Form/FormItem/UpFormItem.js +27 -17
- package/es/Form/FormItem/hooks.d.ts +21 -4
- package/es/Form/FormItem/hooks.js +12 -9
- package/es/Form/FormItem/index.js +5 -5
- package/es/Form/HFormConnect.d.ts +9 -1
- package/es/Form/HFormConnect.js +94 -26
- package/es/Form/InitSet.d.ts +1 -1
- package/es/Form/InitSet.js +5 -5
- package/es/Form/Label.d.ts +4 -4
- package/es/Form/Label.js +36 -19
- package/es/Form/config.d.ts +100 -22
- package/es/Form/config.js +19 -19
- package/es/Form/hooks/index.d.ts +12 -5
- package/es/Form/hooks/index.js +65 -49
- package/es/Form/hooks/useHForm.js +233 -95
- package/es/Form/hooks/useInitConfigData.d.ts +4 -1
- package/es/Form/hooks/useInitConfigData.js +143 -61
- package/es/Form/index.d.ts +11 -1
- package/es/Form/index.js +71 -40
- package/es/Form/modal.d.ts +92 -51
- package/es/Input/ButtonInput.js +73 -51
- package/es/Input/InputNumber.js +21 -12
- package/es/Input/SelectInput.d.ts +16 -4
- package/es/Input/SelectInput.js +113 -56
- 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 +15 -11
- package/es/PageHandler/ErrorComponent.js +47 -25
- package/es/PageHandler/LoadingComponent.js +17 -13
- package/es/PageHandler/index.js +7 -7
- package/es/PageHandler/modal.d.ts +4 -4
- package/es/RadioGroup/index.d.ts +12 -5
- package/es/RadioGroup/index.js +46 -33
- package/es/Select/components/AllSelect.d.ts +1 -1
- package/es/Select/components/AllSelect.js +40 -18
- package/es/Select/components/CheckBoxOption.d.ts +6 -3
- package/es/Select/components/CheckBoxOption.js +12 -7
- package/es/Select/components/DropdownComponent.d.ts +4 -4
- package/es/Select/components/DropdownComponent.js +30 -17
- package/es/Select/components/NoFindItem.d.ts +1 -1
- package/es/Select/components/NoFindItem.js +11 -7
- package/es/Select/components/NotFoundContent.d.ts +2 -2
- package/es/Select/components/NotFoundContent.js +49 -27
- package/es/Select/defaultConfig.d.ts +1 -1
- package/es/Select/defaultConfig.js +20 -16
- package/es/Select/hooks/changeHooks.d.ts +2 -2
- package/es/Select/hooks/changeHooks.js +147 -71
- package/es/Select/hooks/norHooks.d.ts +27 -9
- package/es/Select/hooks/norHooks.js +51 -39
- package/es/Select/index.d.ts +22 -1
- package/es/Select/index.js +124 -65
- package/es/Select/modal.d.ts +15 -15
- package/es/Select/utils.js +60 -15
- package/es/Submit/index.d.ts +9 -3
- package/es/Submit/index.js +18 -13
- package/es/Switch/index.d.ts +4 -4
- package/es/Switch/index.js +46 -20
- package/es/TDPicker/RangePicker.d.ts +8 -3
- package/es/TDPicker/RangePicker.js +138 -62
- package/es/TDPicker/TimePicker.d.ts +6 -1
- package/es/TDPicker/TimePicker.js +19 -13
- package/es/TDPicker/hooks.d.ts +42 -22
- package/es/TDPicker/hooks.js +106 -72
- package/es/TDPicker/index.d.ts +7 -1
- package/es/TDPicker/index.js +20 -14
- package/es/TDPicker/modal.d.ts +21 -16
- package/es/Upload/Btn.d.ts +5 -1
- package/es/Upload/Btn.js +35 -19
- package/es/Upload/MediaTypeEle/TypeEle.d.ts +10 -5
- package/es/Upload/MediaTypeEle/TypeEle.js +31 -23
- package/es/Upload/MediaTypeEle/index.d.ts +5 -1
- package/es/Upload/MediaTypeEle/index.js +21 -18
- package/es/Upload/Preview/index.d.ts +5 -1
- package/es/Upload/Preview/index.js +17 -13
- package/es/Upload/UrlUpload/index.d.ts +7 -1
- package/es/Upload/UrlUpload/index.js +72 -51
- package/es/Upload/enums.d.ts +3 -3
- package/es/Upload/enums.js +3 -3
- package/es/Upload/hooks/change.d.ts +8 -1
- package/es/Upload/hooks/change.js +115 -58
- package/es/Upload/hooks/customRequest.d.ts +5 -1
- package/es/Upload/hooks/customRequest.js +63 -46
- package/es/Upload/hooks/propsMaker.d.ts +5 -1
- package/es/Upload/hooks/propsMaker.js +52 -13
- package/es/Upload/index.d.ts +3 -1
- package/es/Upload/index.js +131 -61
- package/es/Upload/modal.d.ts +17 -15
- package/es/Upload/util.d.ts +8 -2
- package/es/Upload/util.js +15 -7
- package/es/config.js +34 -31
- package/es/hooks/index.d.ts +14 -7
- package/es/hooks/index.js +124 -49
- package/es/index.d.ts +98 -16
- package/es/index.js +22 -5
- package/es/modal.d.ts +6 -6
- package/lib/CheckboxGroup/CheckBox/index.js +26 -18
- package/lib/CheckboxGroup/hooks.d.ts +9 -3
- package/lib/CheckboxGroup/hooks.js +116 -65
- package/lib/CheckboxGroup/index.d.ts +6 -1
- package/lib/CheckboxGroup/index.js +119 -58
- package/lib/CheckboxGroup/modal.d.ts +9 -8
- package/lib/Form/Context/FormConfigProvider.js +66 -21
- package/lib/Form/Context/index.d.ts +4 -1
- package/lib/Form/Context/index.js +4 -4
- package/lib/Form/FormItem/BasicItem.js +82 -44
- package/lib/Form/FormItem/Helper.d.ts +1 -1
- package/lib/Form/FormItem/Helper.js +19 -11
- package/lib/Form/FormItem/RegularFormItem.js +13 -10
- package/lib/Form/FormItem/UpFormItem.d.ts +6 -1
- package/lib/Form/FormItem/UpFormItem.js +29 -19
- package/lib/Form/FormItem/hooks.d.ts +21 -4
- package/lib/Form/FormItem/hooks.js +13 -10
- package/lib/Form/FormItem/index.js +7 -7
- package/lib/Form/HFormConnect.d.ts +9 -1
- package/lib/Form/HFormConnect.js +96 -28
- package/lib/Form/InitSet.d.ts +1 -1
- package/lib/Form/InitSet.js +7 -7
- package/lib/Form/Label.d.ts +4 -4
- package/lib/Form/Label.js +41 -21
- package/lib/Form/config.d.ts +100 -22
- package/lib/Form/config.js +21 -21
- package/lib/Form/hooks/index.d.ts +12 -5
- package/lib/Form/hooks/index.js +66 -50
- package/lib/Form/hooks/useHForm.js +235 -97
- package/lib/Form/hooks/useInitConfigData.d.ts +4 -1
- package/lib/Form/hooks/useInitConfigData.js +144 -63
- package/lib/Form/index.d.ts +11 -1
- package/lib/Form/index.js +73 -42
- package/lib/Form/modal.d.ts +92 -51
- package/lib/Input/ButtonInput.js +75 -53
- package/lib/Input/InputNumber.js +23 -14
- package/lib/Input/SelectInput.d.ts +16 -4
- package/lib/Input/SelectInput.js +125 -60
- 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 +15 -11
- package/lib/PageHandler/ErrorComponent.js +49 -27
- package/lib/PageHandler/LoadingComponent.js +19 -15
- package/lib/PageHandler/index.js +9 -9
- package/lib/PageHandler/modal.d.ts +4 -4
- package/lib/RadioGroup/index.d.ts +12 -5
- package/lib/RadioGroup/index.js +48 -35
- package/lib/Select/components/AllSelect.d.ts +1 -1
- package/lib/Select/components/AllSelect.js +42 -20
- package/lib/Select/components/CheckBoxOption.d.ts +6 -3
- package/lib/Select/components/CheckBoxOption.js +14 -9
- package/lib/Select/components/DropdownComponent.d.ts +4 -4
- package/lib/Select/components/DropdownComponent.js +32 -19
- package/lib/Select/components/NoFindItem.d.ts +1 -1
- package/lib/Select/components/NoFindItem.js +13 -9
- package/lib/Select/components/NotFoundContent.d.ts +2 -2
- package/lib/Select/components/NotFoundContent.js +51 -29
- package/lib/Select/defaultConfig.d.ts +1 -1
- package/lib/Select/defaultConfig.js +21 -17
- package/lib/Select/hooks/changeHooks.d.ts +2 -2
- package/lib/Select/hooks/changeHooks.js +148 -72
- package/lib/Select/hooks/norHooks.d.ts +27 -9
- package/lib/Select/hooks/norHooks.js +52 -40
- package/lib/Select/index.d.ts +22 -1
- package/lib/Select/index.js +128 -67
- package/lib/Select/modal.d.ts +15 -15
- package/lib/Select/utils.js +61 -16
- package/lib/Submit/index.d.ts +9 -3
- package/lib/Submit/index.js +20 -15
- package/lib/Switch/index.d.ts +4 -4
- package/lib/Switch/index.js +48 -22
- package/lib/TDPicker/RangePicker.d.ts +8 -3
- package/lib/TDPicker/RangePicker.js +136 -64
- package/lib/TDPicker/TimePicker.d.ts +6 -1
- package/lib/TDPicker/TimePicker.js +21 -15
- package/lib/TDPicker/hooks.d.ts +42 -22
- package/lib/TDPicker/hooks.js +98 -72
- package/lib/TDPicker/index.d.ts +7 -1
- package/lib/TDPicker/index.js +22 -16
- package/lib/TDPicker/modal.d.ts +21 -16
- package/lib/Upload/Btn.d.ts +5 -1
- package/lib/Upload/Btn.js +37 -21
- package/lib/Upload/MediaTypeEle/TypeEle.d.ts +10 -5
- package/lib/Upload/MediaTypeEle/TypeEle.js +33 -25
- package/lib/Upload/MediaTypeEle/index.d.ts +5 -1
- package/lib/Upload/MediaTypeEle/index.js +23 -20
- package/lib/Upload/Preview/index.d.ts +5 -1
- package/lib/Upload/Preview/index.js +19 -15
- package/lib/Upload/UrlUpload/index.d.ts +7 -1
- package/lib/Upload/UrlUpload/index.js +74 -53
- package/lib/Upload/enums.d.ts +3 -3
- package/lib/Upload/enums.js +4 -4
- package/lib/Upload/hooks/change.d.ts +8 -1
- package/lib/Upload/hooks/change.js +116 -59
- package/lib/Upload/hooks/customRequest.d.ts +5 -1
- package/lib/Upload/hooks/customRequest.js +64 -47
- package/lib/Upload/hooks/propsMaker.d.ts +5 -1
- package/lib/Upload/hooks/propsMaker.js +55 -15
- package/lib/Upload/index.d.ts +3 -1
- package/lib/Upload/index.js +133 -63
- package/lib/Upload/modal.d.ts +17 -15
- package/lib/Upload/util.d.ts +8 -2
- package/lib/Upload/util.js +16 -8
- package/lib/config.js +35 -32
- package/lib/hooks/index.d.ts +14 -7
- package/lib/hooks/index.js +125 -50
- package/lib/index.d.ts +98 -16
- package/lib/index.js +5 -5
- package/lib/modal.d.ts +6 -6
- package/package.json +2 -2
- package/src/components/CheckboxGroup/index.tsx +2 -2
- package/src/components/Form/FormItem/Helper.tsx +3 -4
- package/src/components/Form/HFormConnect.tsx +6 -2
- package/src/components/Form/hooks/useHForm.ts +59 -10
- package/src/components/Form/modal.ts +12 -8
- package/src/components/TDPicker/RangePicker.tsx +7 -5
- package/src/components/TDPicker/modal.ts +1 -0
- package/src/pages/Form/index.tsx +2 -2
|
@@ -1,26 +1,77 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
|
-
import _Object$
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import _Object$
|
|
6
|
-
import _Object$
|
|
7
|
-
import _Object$
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import _Object$
|
|
14
|
-
import _mapInstanceProperty from
|
|
15
|
-
import { DatePicker } from
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
2
|
+
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js/object/get-own-property-symbols";
|
|
3
|
+
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js/instance/filter";
|
|
4
|
+
import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js/object/get-own-property-descriptor";
|
|
5
|
+
import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js/object/get-own-property-descriptors";
|
|
6
|
+
import _Object$defineProperties from "@babel/runtime-corejs3/core-js/object/define-properties";
|
|
7
|
+
import _Object$defineProperty from "@babel/runtime-corejs3/core-js/object/define-property";
|
|
8
|
+
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
9
|
+
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
10
|
+
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/objectWithoutProperties";
|
|
11
|
+
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js/instance/for-each";
|
|
12
|
+
import _Object$values from "@babel/runtime-corejs3/core-js/object/values";
|
|
13
|
+
import _Object$keys from "@babel/runtime-corejs3/core-js/object/keys";
|
|
14
|
+
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js/instance/map";
|
|
15
|
+
import { DatePicker } from "antd";
|
|
16
|
+
import {
|
|
17
|
+
useGetTimeKey,
|
|
18
|
+
useRangeValueProvider,
|
|
19
|
+
useRangePickerTimeVal,
|
|
20
|
+
} from "./hooks.js";
|
|
21
|
+
import React, { useMemo } from "react";
|
|
22
|
+
import { useMatchConfigProps } from "../hooks/index.js";
|
|
23
|
+
import HFormConnect from "../Form/HFormConnect.js";
|
|
20
24
|
|
|
21
|
-
var _excluded = [
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
var _excluded = [
|
|
26
|
+
"value",
|
|
27
|
+
"onChange",
|
|
28
|
+
"showTime",
|
|
29
|
+
"format",
|
|
30
|
+
"valueMap",
|
|
31
|
+
"ranges",
|
|
32
|
+
"name",
|
|
33
|
+
"addFormat",
|
|
34
|
+
];
|
|
35
|
+
function ownKeys(object, enumerableOnly) {
|
|
36
|
+
var keys = _Object$keys(object);
|
|
37
|
+
if (_Object$getOwnPropertySymbols) {
|
|
38
|
+
var symbols = _Object$getOwnPropertySymbols(object);
|
|
39
|
+
enumerableOnly &&
|
|
40
|
+
(symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) {
|
|
41
|
+
return _Object$getOwnPropertyDescriptor(object, sym).enumerable;
|
|
42
|
+
})),
|
|
43
|
+
keys.push.apply(keys, symbols);
|
|
44
|
+
}
|
|
45
|
+
return keys;
|
|
46
|
+
}
|
|
47
|
+
function _objectSpread(target) {
|
|
48
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
49
|
+
var _context2, _context3;
|
|
50
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
51
|
+
i % 2
|
|
52
|
+
? _forEachInstanceProperty(
|
|
53
|
+
(_context2 = ownKeys(Object(source), !0))
|
|
54
|
+
).call(_context2, function (key) {
|
|
55
|
+
_defineProperty(target, key, source[key]);
|
|
56
|
+
})
|
|
57
|
+
: _Object$getOwnPropertyDescriptors
|
|
58
|
+
? _Object$defineProperties(
|
|
59
|
+
target,
|
|
60
|
+
_Object$getOwnPropertyDescriptors(source)
|
|
61
|
+
)
|
|
62
|
+
: _forEachInstanceProperty((_context3 = ownKeys(Object(source)))).call(
|
|
63
|
+
_context3,
|
|
64
|
+
function (key) {
|
|
65
|
+
_Object$defineProperty(
|
|
66
|
+
target,
|
|
67
|
+
key,
|
|
68
|
+
_Object$getOwnPropertyDescriptor(source, key)
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
return target;
|
|
74
|
+
}
|
|
24
75
|
var RangePicker = DatePicker.RangePicker;
|
|
25
76
|
var HRangePicker = function HRangePicker(_ref) {
|
|
26
77
|
var value = _ref.value,
|
|
@@ -37,51 +88,65 @@ var HRangePicker = function HRangePicker(_ref) {
|
|
|
37
88
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
38
89
|
var _useMatchConfigProps = useMatchConfigProps({
|
|
39
90
|
valueRangePickerValueMap: valueMap,
|
|
40
|
-
dateRanges: undefined
|
|
91
|
+
dateRanges: undefined,
|
|
41
92
|
}),
|
|
42
93
|
_useMatchConfigProps$ = _useMatchConfigProps.valueRangePickerValueMap,
|
|
43
|
-
valueRangePickerValueMap =
|
|
94
|
+
valueRangePickerValueMap =
|
|
95
|
+
_useMatchConfigProps$ === void 0 ? {} : _useMatchConfigProps$,
|
|
44
96
|
dateRanges = _useMatchConfigProps.dateRanges;
|
|
45
97
|
var dateMapKeys = useGetTimeKey({
|
|
46
98
|
valueMap: valueRangePickerValueMap,
|
|
47
|
-
name: name
|
|
99
|
+
name: name,
|
|
48
100
|
});
|
|
49
101
|
var paramsProvider = useRangeValueProvider({
|
|
50
|
-
valueMap: dateMapKeys
|
|
102
|
+
valueMap: dateMapKeys,
|
|
51
103
|
});
|
|
52
104
|
var timeVal = useRangePickerTimeVal({
|
|
53
105
|
value: value,
|
|
54
106
|
format: format,
|
|
55
|
-
valueMap: dateMapKeys
|
|
107
|
+
valueMap: dateMapKeys,
|
|
56
108
|
});
|
|
57
|
-
var defaultRanges = useMemo(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if (ranges === true) {
|
|
62
|
-
return dateRanges;
|
|
63
|
-
}
|
|
64
|
-
return ranges;
|
|
65
|
-
}, [ranges]);
|
|
66
|
-
addFormat === null || addFormat === void 0 ? void 0 : addFormat({
|
|
67
|
-
"float": {
|
|
68
|
-
inputValue: function inputValue(item, initValue) {
|
|
69
|
-
var _context;
|
|
70
|
-
var valueName = item.name;
|
|
71
|
-
var resultObj = {};
|
|
72
|
-
_forEachInstanceProperty(_context = _Object$values(dateMapKeys)).call(_context, function (key) {
|
|
73
|
-
resultObj[key] = initValue[key];
|
|
74
|
-
});
|
|
75
|
-
return _defineProperty({}, valueName, resultObj);
|
|
76
|
-
},
|
|
77
|
-
outputValue: function outputValue(item, _outputValue) {
|
|
78
|
-
var valueName = item.name;
|
|
79
|
-
var _outputValue$valueNam = _outputValue[valueName],
|
|
80
|
-
itemVal = _outputValue$valueNam === void 0 ? {} : _outputValue$valueNam;
|
|
81
|
-
return _objectSpread({}, itemVal);
|
|
109
|
+
var defaultRanges = useMemo(
|
|
110
|
+
function () {
|
|
111
|
+
if (!ranges) {
|
|
112
|
+
return null;
|
|
82
113
|
}
|
|
83
|
-
|
|
84
|
-
|
|
114
|
+
if (ranges === true) {
|
|
115
|
+
return dateRanges;
|
|
116
|
+
}
|
|
117
|
+
return ranges;
|
|
118
|
+
},
|
|
119
|
+
[ranges]
|
|
120
|
+
);
|
|
121
|
+
addFormat === null || addFormat === void 0
|
|
122
|
+
? void 0
|
|
123
|
+
: addFormat({
|
|
124
|
+
float: {
|
|
125
|
+
inputValue: function inputValue(item, initValue) {
|
|
126
|
+
var _context;
|
|
127
|
+
var _item$name = item.name,
|
|
128
|
+
valueName = _item$name === void 0 ? "" : _item$name;
|
|
129
|
+
var resultObj = {};
|
|
130
|
+
_forEachInstanceProperty(
|
|
131
|
+
(_context = _Object$values(dateMapKeys))
|
|
132
|
+
).call(_context, function (key) {
|
|
133
|
+
if (initValue[key]) {
|
|
134
|
+
resultObj[key] = initValue[key];
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
var hasKeys = _Object$keys(resultObj).length !== 0;
|
|
138
|
+
return _defineProperty({}, valueName, hasKeys ? resultObj : null);
|
|
139
|
+
},
|
|
140
|
+
outputValue: function outputValue(item, _outputValue) {
|
|
141
|
+
var _item$name2 = item.name,
|
|
142
|
+
valueName = _item$name2 === void 0 ? "" : _item$name2;
|
|
143
|
+
var _outputValue$valueNam = _outputValue[valueName],
|
|
144
|
+
itemVal =
|
|
145
|
+
_outputValue$valueNam === void 0 ? {} : _outputValue$valueNam;
|
|
146
|
+
return _objectSpread({}, itemVal);
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
});
|
|
85
150
|
var change = function change(val) {
|
|
86
151
|
if (!format || !val) {
|
|
87
152
|
onChange === null || onChange === void 0 ? void 0 : onChange(val);
|
|
@@ -90,26 +155,37 @@ var HRangePicker = function HRangePicker(_ref) {
|
|
|
90
155
|
var subVal = _mapInstanceProperty(val).call(val, function (item) {
|
|
91
156
|
return item === null || item === void 0 ? void 0 : item.format(format);
|
|
92
157
|
});
|
|
93
|
-
onChange === null || onChange === void 0
|
|
158
|
+
onChange === null || onChange === void 0
|
|
159
|
+
? void 0
|
|
160
|
+
: onChange(paramsProvider(subVal));
|
|
94
161
|
};
|
|
95
|
-
return /*#__PURE__*/React.createElement(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
162
|
+
return /*#__PURE__*/ React.createElement(
|
|
163
|
+
RangePicker,
|
|
164
|
+
_extends(
|
|
165
|
+
{
|
|
166
|
+
value: timeVal,
|
|
167
|
+
onChange: change,
|
|
168
|
+
showTime: showTime,
|
|
169
|
+
ranges: defaultRanges,
|
|
170
|
+
},
|
|
171
|
+
props
|
|
172
|
+
)
|
|
173
|
+
);
|
|
101
174
|
};
|
|
102
175
|
var Index = HFormConnect(HRangePicker);
|
|
103
176
|
var HRangePicker$1 = {
|
|
104
177
|
Component: Index,
|
|
105
178
|
placeholder: function placeholder(_ref3) {
|
|
106
179
|
var label = _ref3.label;
|
|
107
|
-
return [
|
|
180
|
+
return [
|
|
181
|
+
"\u8BF7\u9009\u62E9\u5F00\u59CB".concat(label),
|
|
182
|
+
"\u8BF7\u9009\u62E9\u7ED3\u675F".concat(label),
|
|
183
|
+
];
|
|
108
184
|
},
|
|
109
185
|
requiredErrMsg: function requiredErrMsg(_ref4) {
|
|
110
186
|
var label = _ref4.label;
|
|
111
187
|
return "\u8BF7\u9009\u62E9".concat(label);
|
|
112
|
-
}
|
|
188
|
+
},
|
|
113
189
|
};
|
|
114
190
|
|
|
115
191
|
export { HRangePicker$1 as default };
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { HTimePickerProps } from "./modal";
|
|
3
|
-
declare const _default: ({
|
|
3
|
+
declare const _default: ({
|
|
4
|
+
value,
|
|
5
|
+
format,
|
|
6
|
+
onChange,
|
|
7
|
+
...props
|
|
8
|
+
}: HTimePickerProps) => JSX.Element;
|
|
4
9
|
export default _default;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
|
-
import React from
|
|
3
|
-
import _extends from
|
|
4
|
-
import _objectWithoutProperties from
|
|
5
|
-
import { TimePicker } from
|
|
6
|
-
import { useTimePickerValue, useTimePickerChange } from
|
|
2
|
+
import React from "react";
|
|
3
|
+
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
4
|
+
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/objectWithoutProperties";
|
|
5
|
+
import { TimePicker } from "antd";
|
|
6
|
+
import { useTimePickerValue, useTimePickerChange } from "./hooks.js";
|
|
7
7
|
|
|
8
8
|
var _excluded = ["value", "format", "onChange"];
|
|
9
|
-
var HTimePicker =
|
|
9
|
+
var HTimePicker = function (_ref) {
|
|
10
10
|
var value = _ref.value,
|
|
11
11
|
_ref$format = _ref.format,
|
|
12
12
|
format = _ref$format === void 0 ? "X" : _ref$format,
|
|
@@ -14,18 +14,24 @@ var HTimePicker = (function (_ref) {
|
|
|
14
14
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
15
15
|
var timeVal = useTimePickerValue({
|
|
16
16
|
value: value,
|
|
17
|
-
format: format
|
|
17
|
+
format: format,
|
|
18
18
|
});
|
|
19
19
|
var change = useTimePickerChange({
|
|
20
20
|
value: value,
|
|
21
21
|
format: format,
|
|
22
|
-
onChange: onChange
|
|
22
|
+
onChange: onChange,
|
|
23
23
|
});
|
|
24
|
-
return /*#__PURE__*/React.createElement(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
return /*#__PURE__*/ React.createElement(
|
|
25
|
+
TimePicker,
|
|
26
|
+
_extends(
|
|
27
|
+
{
|
|
28
|
+
value: timeVal,
|
|
29
|
+
onChange: change,
|
|
30
|
+
},
|
|
31
|
+
props
|
|
32
|
+
)
|
|
33
|
+
);
|
|
34
|
+
};
|
|
29
35
|
|
|
30
36
|
export { HTimePicker as default };
|
|
31
37
|
// powered by hdj
|
package/es/TDPicker/hooks.d.ts
CHANGED
|
@@ -2,32 +2,52 @@ 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
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
export declare const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
};
|
|
32
|
-
export declare const
|
|
19
|
+
export declare const useGetTimeKey: ({ valueMap, name }: HRangePickerProps) =>
|
|
20
|
+
| {
|
|
21
|
+
start?: undefined;
|
|
22
|
+
end?: undefined;
|
|
23
|
+
}
|
|
24
|
+
| {
|
|
25
|
+
start: string;
|
|
26
|
+
end: string;
|
|
27
|
+
};
|
|
28
|
+
export declare const useTimeChange: ({
|
|
29
|
+
format,
|
|
30
|
+
onChange,
|
|
31
|
+
}: UseTimeChangeParams) => (value: any) => void;
|
|
32
|
+
export declare const useTimePickerValue: ({
|
|
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;
|
|
33
53
|
export {};
|
package/es/TDPicker/hooks.js
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
|
-
import _defineProperty from
|
|
3
|
-
import _Array$isArray from
|
|
4
|
-
import _mapInstanceProperty from
|
|
5
|
-
import { useMemo, useCallback } from
|
|
6
|
-
import moment from
|
|
2
|
+
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
3
|
+
import _Array$isArray from "@babel/runtime-corejs3/core-js/array/is-array";
|
|
4
|
+
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js/instance/map";
|
|
5
|
+
import { useMemo, useCallback } from "react";
|
|
6
|
+
import moment from "moment";
|
|
7
7
|
|
|
8
8
|
var useTimeVal = function useTimeVal(_ref) {
|
|
9
9
|
var value = _ref.value,
|
|
10
10
|
format = _ref.format;
|
|
11
|
-
return useMemo(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
return useMemo(
|
|
12
|
+
function () {
|
|
13
|
+
if (!value || !format) {
|
|
14
|
+
return value;
|
|
15
|
+
}
|
|
16
|
+
return moment(value, format);
|
|
17
|
+
},
|
|
18
|
+
[value, format]
|
|
19
|
+
);
|
|
17
20
|
};
|
|
18
21
|
var useGetTimeKey = function useGetTimeKey(_ref2) {
|
|
19
22
|
var _ref2$valueMap = _ref2.valueMap,
|
|
@@ -29,57 +32,72 @@ var useGetTimeKey = function useGetTimeKey(_ref2) {
|
|
|
29
32
|
var endKey = typeof end === "string" ? end : end(name);
|
|
30
33
|
return {
|
|
31
34
|
start: startKey,
|
|
32
|
-
end: endKey
|
|
35
|
+
end: endKey,
|
|
33
36
|
};
|
|
34
37
|
};
|
|
35
38
|
var useTimeChange = function useTimeChange(_ref3) {
|
|
36
39
|
var format = _ref3.format,
|
|
37
40
|
onChange = _ref3.onChange;
|
|
38
|
-
return useCallback(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
return useCallback(
|
|
42
|
+
function (value) {
|
|
43
|
+
if (!format) {
|
|
44
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(value);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
var subVal =
|
|
48
|
+
value === null || value === void 0 ? void 0 : value.format(format);
|
|
49
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(subVal);
|
|
50
|
+
},
|
|
51
|
+
[format, onChange]
|
|
52
|
+
);
|
|
46
53
|
};
|
|
47
54
|
var formatMap = {
|
|
48
55
|
X: "s",
|
|
49
|
-
x: "ms"
|
|
56
|
+
x: "ms",
|
|
50
57
|
};
|
|
51
58
|
var useTimePickerValue = function useTimePickerValue(_ref4) {
|
|
52
59
|
var value = _ref4.value,
|
|
53
60
|
format = _ref4.format;
|
|
54
|
-
return useMemo(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
return useMemo(
|
|
62
|
+
function () {
|
|
63
|
+
if (!value || !format) {
|
|
64
|
+
return value;
|
|
65
|
+
}
|
|
66
|
+
if (formatMap[format]) {
|
|
67
|
+
var timeStr = moment()
|
|
68
|
+
.startOf("days")
|
|
69
|
+
.add(value, formatMap[format])
|
|
70
|
+
.format("HH:mm:ss");
|
|
71
|
+
return moment(timeStr, "HH:mm:ss");
|
|
72
|
+
}
|
|
73
|
+
return moment(value, format);
|
|
74
|
+
},
|
|
75
|
+
[value, format]
|
|
76
|
+
);
|
|
64
77
|
};
|
|
65
78
|
var useTimePickerChange = function useTimePickerChange(_ref5) {
|
|
66
79
|
var value = _ref5.value,
|
|
67
80
|
format = _ref5.format,
|
|
68
81
|
onChange = _ref5.onChange;
|
|
69
|
-
return useCallback(
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
82
|
+
return useCallback(
|
|
83
|
+
function (val) {
|
|
84
|
+
if (!format || !val) {
|
|
85
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(val);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (formatMap[format]) {
|
|
89
|
+
var startTime = moment().startOf("days").format(format);
|
|
90
|
+
var nowTime = val.format(format);
|
|
91
|
+
onChange === null || onChange === void 0
|
|
92
|
+
? void 0
|
|
93
|
+
: onChange(nowTime - startTime);
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
var subVal = val === null || val === void 0 ? void 0 : val.format(format);
|
|
97
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(subVal);
|
|
98
|
+
},
|
|
99
|
+
[format, onChange, value]
|
|
100
|
+
);
|
|
83
101
|
};
|
|
84
102
|
var useRangeValueProvider = function useRangeValueProvider(_ref6) {
|
|
85
103
|
var _ref6$valueMap = _ref6.valueMap,
|
|
@@ -91,7 +109,12 @@ var useRangeValueProvider = function useRangeValueProvider(_ref6) {
|
|
|
91
109
|
if (!start || !end) {
|
|
92
110
|
return val;
|
|
93
111
|
}
|
|
94
|
-
return
|
|
112
|
+
return (
|
|
113
|
+
(_ref7 = {}),
|
|
114
|
+
_defineProperty(_ref7, start, val[0]),
|
|
115
|
+
_defineProperty(_ref7, end, val[1]),
|
|
116
|
+
_ref7
|
|
117
|
+
);
|
|
95
118
|
};
|
|
96
119
|
};
|
|
97
120
|
var useRangePickerTimeVal = function useRangePickerTimeVal(_ref8) {
|
|
@@ -99,34 +122,45 @@ var useRangePickerTimeVal = function useRangePickerTimeVal(_ref8) {
|
|
|
99
122
|
format = _ref8.format,
|
|
100
123
|
_ref8$valueMap = _ref8.valueMap,
|
|
101
124
|
valueMap = _ref8$valueMap === void 0 ? {} : _ref8$valueMap;
|
|
102
|
-
return useMemo(
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
if (!_Array$isArray(value)) {
|
|
107
|
-
var start = valueMap.start,
|
|
108
|
-
end = valueMap.end;
|
|
109
|
-
if (!start || !end) {
|
|
110
|
-
console.error("日期value格式错误!");
|
|
111
|
-
return;
|
|
125
|
+
return useMemo(
|
|
126
|
+
function () {
|
|
127
|
+
if (!value || !format) {
|
|
128
|
+
return value;
|
|
112
129
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
130
|
+
if (!_Array$isArray(value)) {
|
|
131
|
+
var start = valueMap.start,
|
|
132
|
+
end = valueMap.end;
|
|
133
|
+
if (!start || !end) {
|
|
134
|
+
console.error("日期value格式错误!");
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
var startTime = value[start],
|
|
138
|
+
endTime = value[end];
|
|
139
|
+
if (!startTime && !endTime) {
|
|
140
|
+
return [];
|
|
141
|
+
}
|
|
142
|
+
var startMoment = moment(startTime, format);
|
|
143
|
+
var endMoment = moment(endTime, format);
|
|
144
|
+
return [startMoment, endMoment];
|
|
117
145
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
});
|
|
128
|
-
}, [value, format, valueMap]);
|
|
146
|
+
return _mapInstanceProperty(value).call(value, function (item) {
|
|
147
|
+
if (!item) {
|
|
148
|
+
return item;
|
|
149
|
+
}
|
|
150
|
+
return moment(item, format);
|
|
151
|
+
});
|
|
152
|
+
},
|
|
153
|
+
[value, format, valueMap]
|
|
154
|
+
);
|
|
129
155
|
};
|
|
130
156
|
|
|
131
|
-
export {
|
|
157
|
+
export {
|
|
158
|
+
useGetTimeKey,
|
|
159
|
+
useRangePickerTimeVal,
|
|
160
|
+
useRangeValueProvider,
|
|
161
|
+
useTimeChange,
|
|
162
|
+
useTimePickerChange,
|
|
163
|
+
useTimePickerValue,
|
|
164
|
+
useTimeVal,
|
|
165
|
+
};
|
|
132
166
|
// powered by hdj
|
package/es/TDPicker/index.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { HDatePickerProps } from "./modal";
|
|
3
|
-
declare const _default: ({
|
|
3
|
+
declare const _default: ({
|
|
4
|
+
value,
|
|
5
|
+
onChange,
|
|
6
|
+
showTime,
|
|
7
|
+
format,
|
|
8
|
+
...props
|
|
9
|
+
}: HDatePickerProps) => JSX.Element;
|
|
4
10
|
export default _default;
|