@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
|
@@ -1,77 +1,26 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
|
-
import _Object$getOwnPropertySymbols from
|
|
3
|
-
import _filterInstanceProperty from
|
|
4
|
-
import _Object$getOwnPropertyDescriptor from
|
|
5
|
-
import _Object$getOwnPropertyDescriptors from
|
|
6
|
-
import _Object$defineProperties from
|
|
7
|
-
import _Object$defineProperty from
|
|
8
|
-
import _extends from
|
|
9
|
-
import _defineProperty from
|
|
10
|
-
import _objectWithoutProperties from
|
|
11
|
-
import _forEachInstanceProperty from
|
|
12
|
-
import _Object$values from
|
|
13
|
-
import _Object$keys from
|
|
14
|
-
import _mapInstanceProperty from
|
|
15
|
-
import { DatePicker } from
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
} from "./hooks.js";
|
|
21
|
-
import React, { useMemo } from "react";
|
|
22
|
-
import { useMatchConfigProps } from "../hooks/index.js";
|
|
23
|
-
import HFormConnect from "../Form/HFormConnect.js";
|
|
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 { useGetTimeKey, useRangeValueProvider, useRangePickerTimeVal } from './hooks.js';
|
|
17
|
+
import React, { useMemo } from 'react';
|
|
18
|
+
import { useMatchConfigProps } from '../hooks/index.js';
|
|
19
|
+
import HFormConnect from '../Form/HFormConnect.js';
|
|
24
20
|
|
|
25
|
-
var _excluded = [
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
}
|
|
21
|
+
var _excluded = ["value", "onChange", "showTime", "format", "valueMap", "ranges", "name", "addFormat"];
|
|
22
|
+
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; }
|
|
23
|
+
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; }
|
|
75
24
|
var RangePicker = DatePicker.RangePicker;
|
|
76
25
|
var HRangePicker = function HRangePicker(_ref) {
|
|
77
26
|
var value = _ref.value,
|
|
@@ -88,65 +37,56 @@ var HRangePicker = function HRangePicker(_ref) {
|
|
|
88
37
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
89
38
|
var _useMatchConfigProps = useMatchConfigProps({
|
|
90
39
|
valueRangePickerValueMap: valueMap,
|
|
91
|
-
dateRanges: undefined
|
|
40
|
+
dateRanges: undefined
|
|
92
41
|
}),
|
|
93
42
|
_useMatchConfigProps$ = _useMatchConfigProps.valueRangePickerValueMap,
|
|
94
|
-
valueRangePickerValueMap =
|
|
95
|
-
_useMatchConfigProps$ === void 0 ? {} : _useMatchConfigProps$,
|
|
43
|
+
valueRangePickerValueMap = _useMatchConfigProps$ === void 0 ? {} : _useMatchConfigProps$,
|
|
96
44
|
dateRanges = _useMatchConfigProps.dateRanges;
|
|
97
45
|
var dateMapKeys = useGetTimeKey({
|
|
98
46
|
valueMap: valueRangePickerValueMap,
|
|
99
|
-
name: name
|
|
47
|
+
name: name
|
|
100
48
|
});
|
|
101
49
|
var paramsProvider = useRangeValueProvider({
|
|
102
|
-
valueMap: dateMapKeys
|
|
50
|
+
valueMap: dateMapKeys
|
|
103
51
|
});
|
|
104
52
|
var timeVal = useRangePickerTimeVal({
|
|
105
53
|
value: value,
|
|
106
54
|
format: format,
|
|
107
|
-
valueMap: dateMapKeys
|
|
55
|
+
valueMap: dateMapKeys
|
|
108
56
|
});
|
|
109
|
-
var defaultRanges = useMemo(
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
57
|
+
var defaultRanges = useMemo(function () {
|
|
58
|
+
if (!ranges) {
|
|
59
|
+
return null;
|
|
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 _item$name = item.name,
|
|
71
|
+
valueName = _item$name === void 0 ? "" : _item$name;
|
|
72
|
+
var resultObj = {};
|
|
73
|
+
_forEachInstanceProperty(_context = _Object$values(dateMapKeys)).call(_context, function (key) {
|
|
74
|
+
if (initValue[key]) {
|
|
75
|
+
resultObj[key] = initValue[key];
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
var hasKeys = _Object$keys(resultObj).length !== 0;
|
|
79
|
+
return _defineProperty({}, valueName, hasKeys ? resultObj : null);
|
|
80
|
+
},
|
|
81
|
+
outputValue: function outputValue(item, _outputValue) {
|
|
82
|
+
var _item$name2 = item.name,
|
|
83
|
+
valueName = _item$name2 === void 0 ? "" : _item$name2;
|
|
84
|
+
var _outputValue$valueNam = _outputValue[valueName],
|
|
85
|
+
itemVal = _outputValue$valueNam === void 0 ? {} : _outputValue$valueNam;
|
|
86
|
+
return _objectSpread({}, itemVal);
|
|
116
87
|
}
|
|
117
|
-
|
|
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
|
-
});
|
|
88
|
+
}
|
|
89
|
+
});
|
|
150
90
|
var change = function change(val) {
|
|
151
91
|
if (!format || !val) {
|
|
152
92
|
onChange === null || onChange === void 0 ? void 0 : onChange(val);
|
|
@@ -155,37 +95,26 @@ var HRangePicker = function HRangePicker(_ref) {
|
|
|
155
95
|
var subVal = _mapInstanceProperty(val).call(val, function (item) {
|
|
156
96
|
return item === null || item === void 0 ? void 0 : item.format(format);
|
|
157
97
|
});
|
|
158
|
-
onChange === null || onChange === void 0
|
|
159
|
-
? void 0
|
|
160
|
-
: onChange(paramsProvider(subVal));
|
|
98
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(paramsProvider(subVal));
|
|
161
99
|
};
|
|
162
|
-
return /*#__PURE__*/
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
showTime: showTime,
|
|
169
|
-
ranges: defaultRanges,
|
|
170
|
-
},
|
|
171
|
-
props
|
|
172
|
-
)
|
|
173
|
-
);
|
|
100
|
+
return /*#__PURE__*/React.createElement(RangePicker, _extends({
|
|
101
|
+
value: timeVal,
|
|
102
|
+
onChange: change,
|
|
103
|
+
showTime: showTime,
|
|
104
|
+
ranges: defaultRanges
|
|
105
|
+
}, props));
|
|
174
106
|
};
|
|
175
107
|
var Index = HFormConnect(HRangePicker);
|
|
176
108
|
var HRangePicker$1 = {
|
|
177
109
|
Component: Index,
|
|
178
110
|
placeholder: function placeholder(_ref3) {
|
|
179
111
|
var label = _ref3.label;
|
|
180
|
-
return [
|
|
181
|
-
"\u8BF7\u9009\u62E9\u5F00\u59CB".concat(label),
|
|
182
|
-
"\u8BF7\u9009\u62E9\u7ED3\u675F".concat(label),
|
|
183
|
-
];
|
|
112
|
+
return ["\u8BF7\u9009\u62E9\u5F00\u59CB".concat(label), "\u8BF7\u9009\u62E9\u7ED3\u675F".concat(label)];
|
|
184
113
|
},
|
|
185
114
|
requiredErrMsg: function requiredErrMsg(_ref4) {
|
|
186
115
|
var label = _ref4.label;
|
|
187
116
|
return "\u8BF7\u9009\u62E9".concat(label);
|
|
188
|
-
}
|
|
117
|
+
}
|
|
189
118
|
};
|
|
190
119
|
|
|
191
120
|
export { HRangePicker$1 as default };
|
|
@@ -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,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 = function (_ref) {
|
|
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,24 +14,18 @@ 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__*/
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
onChange: change,
|
|
30
|
-
},
|
|
31
|
-
props
|
|
32
|
-
)
|
|
33
|
-
);
|
|
34
|
-
};
|
|
24
|
+
return /*#__PURE__*/React.createElement(TimePicker, _extends({
|
|
25
|
+
value: timeVal,
|
|
26
|
+
onChange: change
|
|
27
|
+
}, props));
|
|
28
|
+
});
|
|
35
29
|
|
|
36
30
|
export { HTimePicker as default };
|
|
37
31
|
// powered by hdj
|
package/es/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 {};
|
package/es/TDPicker/hooks.js
CHANGED
|
@@ -1,22 +1,19 @@
|
|
|
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
|
-
|
|
17
|
-
},
|
|
18
|
-
[value, format]
|
|
19
|
-
);
|
|
11
|
+
return useMemo(function () {
|
|
12
|
+
if (!value || !format) {
|
|
13
|
+
return value;
|
|
14
|
+
}
|
|
15
|
+
return moment(value, format);
|
|
16
|
+
}, [value, format]);
|
|
20
17
|
};
|
|
21
18
|
var useGetTimeKey = function useGetTimeKey(_ref2) {
|
|
22
19
|
var _ref2$valueMap = _ref2.valueMap,
|
|
@@ -32,72 +29,57 @@ var useGetTimeKey = function useGetTimeKey(_ref2) {
|
|
|
32
29
|
var endKey = typeof end === "string" ? end : end(name);
|
|
33
30
|
return {
|
|
34
31
|
start: startKey,
|
|
35
|
-
end: endKey
|
|
32
|
+
end: endKey
|
|
36
33
|
};
|
|
37
34
|
};
|
|
38
35
|
var useTimeChange = function useTimeChange(_ref3) {
|
|
39
36
|
var format = _ref3.format,
|
|
40
37
|
onChange = _ref3.onChange;
|
|
41
|
-
return useCallback(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(subVal);
|
|
50
|
-
},
|
|
51
|
-
[format, onChange]
|
|
52
|
-
);
|
|
38
|
+
return useCallback(function (value) {
|
|
39
|
+
if (!format) {
|
|
40
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(value);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
var subVal = value === null || value === void 0 ? void 0 : value.format(format);
|
|
44
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(subVal);
|
|
45
|
+
}, [format, onChange]);
|
|
53
46
|
};
|
|
54
47
|
var formatMap = {
|
|
55
48
|
X: "s",
|
|
56
|
-
x: "ms"
|
|
49
|
+
x: "ms"
|
|
57
50
|
};
|
|
58
51
|
var useTimePickerValue = function useTimePickerValue(_ref4) {
|
|
59
52
|
var value = _ref4.value,
|
|
60
53
|
format = _ref4.format;
|
|
61
|
-
return useMemo(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
return moment(timeStr, "HH:mm:ss");
|
|
72
|
-
}
|
|
73
|
-
return moment(value, format);
|
|
74
|
-
},
|
|
75
|
-
[value, format]
|
|
76
|
-
);
|
|
54
|
+
return useMemo(function () {
|
|
55
|
+
if (!value || !format) {
|
|
56
|
+
return value;
|
|
57
|
+
}
|
|
58
|
+
if (formatMap[format]) {
|
|
59
|
+
var timeStr = moment().startOf("days").add(value, formatMap[format]).format("HH:mm:ss");
|
|
60
|
+
return moment(timeStr, "HH:mm:ss");
|
|
61
|
+
}
|
|
62
|
+
return moment(value, format);
|
|
63
|
+
}, [value, format]);
|
|
77
64
|
};
|
|
78
65
|
var useTimePickerChange = function useTimePickerChange(_ref5) {
|
|
79
66
|
var value = _ref5.value,
|
|
80
67
|
format = _ref5.format,
|
|
81
68
|
onChange = _ref5.onChange;
|
|
82
|
-
return useCallback(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
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
|
-
);
|
|
69
|
+
return useCallback(function (val) {
|
|
70
|
+
if (!format || !val) {
|
|
71
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(val);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (formatMap[format]) {
|
|
75
|
+
var startTime = moment().startOf("days").format(format);
|
|
76
|
+
var nowTime = val.format(format);
|
|
77
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(nowTime - startTime);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
var subVal = val === null || val === void 0 ? void 0 : val.format(format);
|
|
81
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(subVal);
|
|
82
|
+
}, [format, onChange, value]);
|
|
101
83
|
};
|
|
102
84
|
var useRangeValueProvider = function useRangeValueProvider(_ref6) {
|
|
103
85
|
var _ref6$valueMap = _ref6.valueMap,
|
|
@@ -109,12 +91,7 @@ var useRangeValueProvider = function useRangeValueProvider(_ref6) {
|
|
|
109
91
|
if (!start || !end) {
|
|
110
92
|
return val;
|
|
111
93
|
}
|
|
112
|
-
return (
|
|
113
|
-
(_ref7 = {}),
|
|
114
|
-
_defineProperty(_ref7, start, val[0]),
|
|
115
|
-
_defineProperty(_ref7, end, val[1]),
|
|
116
|
-
_ref7
|
|
117
|
-
);
|
|
94
|
+
return _ref7 = {}, _defineProperty(_ref7, start, val[0]), _defineProperty(_ref7, end, val[1]), _ref7;
|
|
118
95
|
};
|
|
119
96
|
};
|
|
120
97
|
var useRangePickerTimeVal = function useRangePickerTimeVal(_ref8) {
|
|
@@ -122,45 +99,34 @@ var useRangePickerTimeVal = function useRangePickerTimeVal(_ref8) {
|
|
|
122
99
|
format = _ref8.format,
|
|
123
100
|
_ref8$valueMap = _ref8.valueMap,
|
|
124
101
|
valueMap = _ref8$valueMap === void 0 ? {} : _ref8$valueMap;
|
|
125
|
-
return useMemo(
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
102
|
+
return useMemo(function () {
|
|
103
|
+
if (!value || !format) {
|
|
104
|
+
return value;
|
|
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;
|
|
129
112
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
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];
|
|
113
|
+
var startTime = value[start],
|
|
114
|
+
endTime = value[end];
|
|
115
|
+
if (!startTime && !endTime) {
|
|
116
|
+
return [];
|
|
145
117
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
118
|
+
var startMoment = moment(startTime, format);
|
|
119
|
+
var endMoment = moment(endTime, format);
|
|
120
|
+
return [startMoment, endMoment];
|
|
121
|
+
}
|
|
122
|
+
return _mapInstanceProperty(value).call(value, function (item) {
|
|
123
|
+
if (!item) {
|
|
124
|
+
return item;
|
|
125
|
+
}
|
|
126
|
+
return moment(item, format);
|
|
127
|
+
});
|
|
128
|
+
}, [value, format, valueMap]);
|
|
155
129
|
};
|
|
156
130
|
|
|
157
|
-
export {
|
|
158
|
-
useGetTimeKey,
|
|
159
|
-
useRangePickerTimeVal,
|
|
160
|
-
useRangeValueProvider,
|
|
161
|
-
useTimeChange,
|
|
162
|
-
useTimePickerChange,
|
|
163
|
-
useTimePickerValue,
|
|
164
|
-
useTimeVal,
|
|
165
|
-
};
|
|
131
|
+
export { useGetTimeKey, useRangePickerTimeVal, useRangeValueProvider, useTimeChange, useTimePickerChange, useTimePickerValue, useTimeVal };
|
|
166
132
|
// powered by hdj
|
package/es/TDPicker/index.d.ts
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { HDatePickerProps } from "./modal";
|
|
3
|
-
declare const _default: ({
|
|
4
|
-
value,
|
|
5
|
-
onChange,
|
|
6
|
-
showTime,
|
|
7
|
-
format,
|
|
8
|
-
...props
|
|
9
|
-
}: HDatePickerProps) => JSX.Element;
|
|
3
|
+
declare const _default: ({ value, onChange, showTime, format, ...props }: HDatePickerProps) => JSX.Element;
|
|
10
4
|
export default _default;
|