@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/TDPicker/hooks.js
CHANGED
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
2
|
|
|
3
|
-
var _defineProperty = require(
|
|
4
|
-
var _Array$isArray = require(
|
|
5
|
-
var _mapInstanceProperty = require(
|
|
6
|
-
var React = require(
|
|
7
|
-
var moment = require(
|
|
3
|
+
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
4
|
+
var _Array$isArray = require('@babel/runtime-corejs3/core-js/array/is-array');
|
|
5
|
+
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/map');
|
|
6
|
+
var React = require('react');
|
|
7
|
+
var moment = require('moment');
|
|
8
8
|
|
|
9
9
|
var useTimeVal = function useTimeVal(_ref) {
|
|
10
10
|
var value = _ref.value,
|
|
11
11
|
format = _ref.format;
|
|
12
|
-
return React.useMemo(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
},
|
|
19
|
-
[value, format]
|
|
20
|
-
);
|
|
12
|
+
return React.useMemo(function () {
|
|
13
|
+
if (!value || !format) {
|
|
14
|
+
return value;
|
|
15
|
+
}
|
|
16
|
+
return moment(value, format);
|
|
17
|
+
}, [value, format]);
|
|
21
18
|
};
|
|
22
19
|
var useGetTimeKey = function useGetTimeKey(_ref2) {
|
|
23
20
|
var _ref2$valueMap = _ref2.valueMap,
|
|
@@ -33,72 +30,57 @@ var useGetTimeKey = function useGetTimeKey(_ref2) {
|
|
|
33
30
|
var endKey = typeof end === "string" ? end : end(name);
|
|
34
31
|
return {
|
|
35
32
|
start: startKey,
|
|
36
|
-
end: endKey
|
|
33
|
+
end: endKey
|
|
37
34
|
};
|
|
38
35
|
};
|
|
39
36
|
var useTimeChange = function useTimeChange(_ref3) {
|
|
40
37
|
var format = _ref3.format,
|
|
41
38
|
onChange = _ref3.onChange;
|
|
42
|
-
return React.useCallback(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(subVal);
|
|
51
|
-
},
|
|
52
|
-
[format, onChange]
|
|
53
|
-
);
|
|
39
|
+
return React.useCallback(function (value) {
|
|
40
|
+
if (!format) {
|
|
41
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(value);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
var subVal = value === null || value === void 0 ? void 0 : value.format(format);
|
|
45
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(subVal);
|
|
46
|
+
}, [format, onChange]);
|
|
54
47
|
};
|
|
55
48
|
var formatMap = {
|
|
56
49
|
X: "s",
|
|
57
|
-
x: "ms"
|
|
50
|
+
x: "ms"
|
|
58
51
|
};
|
|
59
52
|
var useTimePickerValue = function useTimePickerValue(_ref4) {
|
|
60
53
|
var value = _ref4.value,
|
|
61
54
|
format = _ref4.format;
|
|
62
|
-
return React.useMemo(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
return moment(timeStr, "HH:mm:ss");
|
|
73
|
-
}
|
|
74
|
-
return moment(value, format);
|
|
75
|
-
},
|
|
76
|
-
[value, format]
|
|
77
|
-
);
|
|
55
|
+
return React.useMemo(function () {
|
|
56
|
+
if (!value || !format) {
|
|
57
|
+
return value;
|
|
58
|
+
}
|
|
59
|
+
if (formatMap[format]) {
|
|
60
|
+
var timeStr = moment().startOf("days").add(value, formatMap[format]).format("HH:mm:ss");
|
|
61
|
+
return moment(timeStr, "HH:mm:ss");
|
|
62
|
+
}
|
|
63
|
+
return moment(value, format);
|
|
64
|
+
}, [value, format]);
|
|
78
65
|
};
|
|
79
66
|
var useTimePickerChange = function useTimePickerChange(_ref5) {
|
|
80
67
|
var value = _ref5.value,
|
|
81
68
|
format = _ref5.format,
|
|
82
69
|
onChange = _ref5.onChange;
|
|
83
|
-
return React.useCallback(
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
var subVal = val === null || val === void 0 ? void 0 : val.format(format);
|
|
98
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(subVal);
|
|
99
|
-
},
|
|
100
|
-
[format, onChange, value]
|
|
101
|
-
);
|
|
70
|
+
return React.useCallback(function (val) {
|
|
71
|
+
if (!format || !val) {
|
|
72
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(val);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
if (formatMap[format]) {
|
|
76
|
+
var startTime = moment().startOf("days").format(format);
|
|
77
|
+
var nowTime = val.format(format);
|
|
78
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(nowTime - startTime);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
var subVal = val === null || val === void 0 ? void 0 : val.format(format);
|
|
82
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(subVal);
|
|
83
|
+
}, [format, onChange, value]);
|
|
102
84
|
};
|
|
103
85
|
var useRangeValueProvider = function useRangeValueProvider(_ref6) {
|
|
104
86
|
var _ref6$valueMap = _ref6.valueMap,
|
|
@@ -110,12 +92,7 @@ var useRangeValueProvider = function useRangeValueProvider(_ref6) {
|
|
|
110
92
|
if (!start || !end) {
|
|
111
93
|
return val;
|
|
112
94
|
}
|
|
113
|
-
return (
|
|
114
|
-
(_ref7 = {}),
|
|
115
|
-
_defineProperty(_ref7, start, val[0]),
|
|
116
|
-
_defineProperty(_ref7, end, val[1]),
|
|
117
|
-
_ref7
|
|
118
|
-
);
|
|
95
|
+
return _ref7 = {}, _defineProperty(_ref7, start, val[0]), _defineProperty(_ref7, end, val[1]), _ref7;
|
|
119
96
|
};
|
|
120
97
|
};
|
|
121
98
|
var useRangePickerTimeVal = function useRangePickerTimeVal(_ref8) {
|
|
@@ -123,36 +100,33 @@ var useRangePickerTimeVal = function useRangePickerTimeVal(_ref8) {
|
|
|
123
100
|
format = _ref8.format,
|
|
124
101
|
_ref8$valueMap = _ref8.valueMap,
|
|
125
102
|
valueMap = _ref8$valueMap === void 0 ? {} : _ref8$valueMap;
|
|
126
|
-
return React.useMemo(
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
103
|
+
return React.useMemo(function () {
|
|
104
|
+
if (!value || !format) {
|
|
105
|
+
return value;
|
|
106
|
+
}
|
|
107
|
+
if (!_Array$isArray(value)) {
|
|
108
|
+
var start = valueMap.start,
|
|
109
|
+
end = valueMap.end;
|
|
110
|
+
if (!start || !end) {
|
|
111
|
+
console.error("日期value格式错误!");
|
|
112
|
+
return;
|
|
130
113
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
var startMoment = moment(startTime, format);
|
|
144
|
-
var endMoment = moment(endTime, format);
|
|
145
|
-
return [startMoment, endMoment];
|
|
114
|
+
var startTime = value[start],
|
|
115
|
+
endTime = value[end];
|
|
116
|
+
if (!startTime && !endTime) {
|
|
117
|
+
return [];
|
|
118
|
+
}
|
|
119
|
+
var startMoment = moment(startTime, format);
|
|
120
|
+
var endMoment = moment(endTime, format);
|
|
121
|
+
return [startMoment, endMoment];
|
|
122
|
+
}
|
|
123
|
+
return _mapInstanceProperty(value).call(value, function (item) {
|
|
124
|
+
if (!item) {
|
|
125
|
+
return item;
|
|
146
126
|
}
|
|
147
|
-
return
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
151
|
-
return moment(item, format);
|
|
152
|
-
});
|
|
153
|
-
},
|
|
154
|
-
[value, format, valueMap]
|
|
155
|
-
);
|
|
127
|
+
return moment(item, format);
|
|
128
|
+
});
|
|
129
|
+
}, [value, format, valueMap]);
|
|
156
130
|
};
|
|
157
131
|
|
|
158
132
|
exports.useGetTimeKey = useGetTimeKey;
|
package/lib/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;
|
package/lib/TDPicker/index.js
CHANGED
|
@@ -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", "onChange", "showTime", "format"];
|
|
12
|
-
var HDatePicker = function (_ref) {
|
|
12
|
+
var HDatePicker = (function (_ref) {
|
|
13
13
|
var value = _ref.value,
|
|
14
14
|
onChange = _ref.onChange,
|
|
15
15
|
_ref$showTime = _ref.showTime,
|
|
@@ -19,24 +19,18 @@ var HDatePicker = function (_ref) {
|
|
|
19
19
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
20
20
|
var timeVal = hooks.useTimeVal({
|
|
21
21
|
value: value,
|
|
22
|
-
format: format
|
|
22
|
+
format: format
|
|
23
23
|
});
|
|
24
24
|
var change = hooks.useTimeChange({
|
|
25
25
|
format: format,
|
|
26
|
-
onChange: onChange
|
|
26
|
+
onChange: onChange
|
|
27
27
|
});
|
|
28
|
-
return /*#__PURE__*/
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
showTime: showTime,
|
|
35
|
-
},
|
|
36
|
-
props
|
|
37
|
-
)
|
|
38
|
-
);
|
|
39
|
-
};
|
|
28
|
+
return /*#__PURE__*/React.createElement(antd.DatePicker, _extends({
|
|
29
|
+
value: timeVal,
|
|
30
|
+
onChange: change,
|
|
31
|
+
showTime: showTime
|
|
32
|
+
}, props));
|
|
33
|
+
});
|
|
40
34
|
|
|
41
35
|
exports.default = HDatePicker;
|
|
42
36
|
// powered by h
|
package/lib/TDPicker/modal.d.ts
CHANGED
|
@@ -6,28 +6,23 @@ import type { TimePickerProps } from "antd";
|
|
|
6
6
|
import type { DurationInputArg2 } from "moment";
|
|
7
7
|
import type { DateRangePickerValueMapModal } from "../modal";
|
|
8
8
|
import type { addFormatItemModal } from "@/components/Form/modal";
|
|
9
|
-
export interface HDatePickerProps
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
showTime?: boolean | SharedTimeProps<Moment>;
|
|
9
|
+
export interface HDatePickerProps extends Omit<DatePickerProps, "onChange" | "format" | "ranges"> {
|
|
10
|
+
onChange?: (time?: Moment | string | number) => void;
|
|
11
|
+
format?: string;
|
|
12
|
+
showTime?: boolean | SharedTimeProps<Moment>;
|
|
14
13
|
}
|
|
15
|
-
export interface HRangePickerProps
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
showTime?:
|
|
20
|
-
| boolean
|
|
21
|
-
| {
|
|
14
|
+
export interface HRangePickerProps extends Omit<RangePickerProps, "onChange" | "format" | "ranges" | "value"> {
|
|
15
|
+
value?: [any, any] | Record<string, any>;
|
|
16
|
+
onChange?: (val: any) => void;
|
|
17
|
+
showTime?: boolean | {
|
|
22
18
|
defaultValue?: Moment[];
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
19
|
+
};
|
|
20
|
+
format?: string;
|
|
21
|
+
valueMap?: DateRangePickerValueMapModal;
|
|
22
|
+
ranges?: RangePickerProps["ranges"] | boolean;
|
|
23
|
+
addFormat?: (config: Record<string, addFormatItemModal>) => void;
|
|
28
24
|
}
|
|
29
|
-
export interface HTimePickerProps
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
format?: DurationInputArg2 | string;
|
|
25
|
+
export interface HTimePickerProps extends Omit<TimePickerProps, "onChange" | "format" | "ranges"> {
|
|
26
|
+
onChange?: (time?: Moment | string | number) => void;
|
|
27
|
+
format?: DurationInputArg2 | string;
|
|
33
28
|
}
|
package/lib/TextArea/index.d.ts
CHANGED
package/lib/Upload/Btn.d.ts
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { IUpLoadProps } from "./modal";
|
|
3
|
-
declare const _default: ({
|
|
4
|
-
value,
|
|
5
|
-
maxCount,
|
|
6
|
-
listType,
|
|
7
|
-
}: IUpLoadProps) => JSX.Element;
|
|
3
|
+
declare const _default: ({ value, maxCount, listType }: IUpLoadProps) => JSX.Element;
|
|
8
4
|
export default _default;
|
package/lib/Upload/Btn.js
CHANGED
|
@@ -1,50 +1,34 @@
|
|
|
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 icons = require(
|
|
7
|
-
var antd = require(
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var icons = require('@ant-design/icons');
|
|
7
|
+
var antd = require('antd');
|
|
8
8
|
|
|
9
|
-
var Btn = function (_ref) {
|
|
9
|
+
var Btn = (function (_ref) {
|
|
10
10
|
var value = _ref.value,
|
|
11
11
|
_ref$maxCount = _ref.maxCount,
|
|
12
12
|
maxCount = _ref$maxCount === void 0 ? 1 : _ref$maxCount,
|
|
13
13
|
listType = _ref.listType;
|
|
14
14
|
var len = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
15
|
-
var text = React.useMemo(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
},
|
|
22
|
-
[len, maxCount]
|
|
23
|
-
);
|
|
15
|
+
var text = React.useMemo(function () {
|
|
16
|
+
if (len === maxCount) {
|
|
17
|
+
return "更新";
|
|
18
|
+
}
|
|
19
|
+
return "上传";
|
|
20
|
+
}, [len, maxCount]);
|
|
24
21
|
if (listType === "picture-card") {
|
|
25
|
-
return /*#__PURE__*/ React.createElement(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"div",
|
|
31
|
-
{
|
|
32
|
-
style: {
|
|
33
|
-
marginTop: 8,
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
text
|
|
37
|
-
)
|
|
38
|
-
);
|
|
22
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(icons.PlusOutlined, null), /*#__PURE__*/React.createElement("div", {
|
|
23
|
+
style: {
|
|
24
|
+
marginTop: 8
|
|
25
|
+
}
|
|
26
|
+
}, text));
|
|
39
27
|
}
|
|
40
|
-
return /*#__PURE__*/
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
},
|
|
45
|
-
text
|
|
46
|
-
);
|
|
47
|
-
};
|
|
28
|
+
return /*#__PURE__*/React.createElement(antd.Button, {
|
|
29
|
+
icon: /*#__PURE__*/React.createElement(icons.UploadOutlined, null)
|
|
30
|
+
}, text);
|
|
31
|
+
});
|
|
48
32
|
|
|
49
33
|
exports.default = Btn;
|
|
50
34
|
// powered by h
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { MediaTypeEnum } from "../enums";
|
|
3
3
|
interface TypeEleProps {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
mediaType?: MediaTypeEnum;
|
|
5
|
+
url?: string;
|
|
6
|
+
onReady?: VoidFunction;
|
|
7
|
+
onError?: VoidFunction;
|
|
8
8
|
}
|
|
9
|
-
declare const _default: ({
|
|
10
|
-
mediaType,
|
|
11
|
-
url,
|
|
12
|
-
onReady,
|
|
13
|
-
onError,
|
|
14
|
-
}: TypeEleProps) => JSX.Element;
|
|
9
|
+
declare const _default: ({ mediaType, url, onReady, onError }: TypeEleProps) => JSX.Element;
|
|
15
10
|
export default _default;
|
|
@@ -1,51 +1,43 @@
|
|
|
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 enums = require(
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var enums = require('../enums.js');
|
|
7
7
|
|
|
8
|
-
var TypeEle = function (_ref) {
|
|
8
|
+
var TypeEle = (function (_ref) {
|
|
9
9
|
var mediaType = _ref.mediaType,
|
|
10
10
|
url = _ref.url,
|
|
11
11
|
onReady = _ref.onReady,
|
|
12
12
|
onError = _ref.onError;
|
|
13
13
|
if (mediaType === enums.MediaTypeEnum.video) {
|
|
14
|
-
return /*#__PURE__*/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
/*#__PURE__*/ React.createElement("source", {
|
|
24
|
-
src: url,
|
|
25
|
-
})
|
|
26
|
-
);
|
|
14
|
+
return /*#__PURE__*/React.createElement("video", {
|
|
15
|
+
autoPlay: true,
|
|
16
|
+
width: "100%",
|
|
17
|
+
controls: true,
|
|
18
|
+
onPlay: onReady,
|
|
19
|
+
onError: onError
|
|
20
|
+
}, /*#__PURE__*/React.createElement("source", {
|
|
21
|
+
src: url
|
|
22
|
+
}));
|
|
27
23
|
}
|
|
28
24
|
if (mediaType === enums.MediaTypeEnum.audio) {
|
|
29
|
-
return /*#__PURE__*/
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
/*#__PURE__*/ React.createElement("source", {
|
|
38
|
-
src: url,
|
|
39
|
-
})
|
|
40
|
-
);
|
|
25
|
+
return /*#__PURE__*/React.createElement("audio", {
|
|
26
|
+
autoPlay: true,
|
|
27
|
+
controls: true,
|
|
28
|
+
onPlay: onReady,
|
|
29
|
+
onError: onError
|
|
30
|
+
}, /*#__PURE__*/React.createElement("source", {
|
|
31
|
+
src: url
|
|
32
|
+
}));
|
|
41
33
|
}
|
|
42
|
-
return /*#__PURE__*/
|
|
34
|
+
return /*#__PURE__*/React.createElement("img", {
|
|
43
35
|
src: url,
|
|
44
36
|
width: "100%",
|
|
45
37
|
onLoad: onReady,
|
|
46
|
-
onError: onError
|
|
38
|
+
onError: onError
|
|
47
39
|
});
|
|
48
|
-
};
|
|
40
|
+
});
|
|
49
41
|
|
|
50
42
|
exports.default = TypeEle;
|
|
51
43
|
// powered by h
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { IMediaTypeEleProps } from "../modal";
|
|
3
|
-
declare const _default: ({
|
|
4
|
-
file,
|
|
5
|
-
onReady,
|
|
6
|
-
onError,
|
|
7
|
-
}: IMediaTypeEleProps) => JSX.Element | null;
|
|
3
|
+
declare const _default: ({ file, onReady, onError }: IMediaTypeEleProps) => JSX.Element | null;
|
|
8
4
|
export default _default;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports,
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var React = require(
|
|
6
|
-
var _indexOfInstanceProperty = require(
|
|
7
|
-
var util = require(
|
|
8
|
-
var TypeEle = require(
|
|
9
|
-
var enums = require(
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var _indexOfInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/index-of');
|
|
7
|
+
var util = require('../util.js');
|
|
8
|
+
var TypeEle = require('./TypeEle.js');
|
|
9
|
+
var enums = require('../enums.js');
|
|
10
10
|
|
|
11
11
|
var videoType = ["MP4"];
|
|
12
12
|
var audioType = ["MP3"];
|
|
13
|
-
var MediaTypeEle = function (_ref) {
|
|
13
|
+
var MediaTypeEle = (function (_ref) {
|
|
14
14
|
var file = _ref.file,
|
|
15
15
|
onReady = _ref.onReady,
|
|
16
16
|
onError = _ref.onError;
|
|
@@ -18,25 +18,22 @@ var MediaTypeEle = function (_ref) {
|
|
|
18
18
|
return null;
|
|
19
19
|
}
|
|
20
20
|
var name = util.getFileExt(file);
|
|
21
|
-
var mediaType = React.useMemo(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
[name]
|
|
32
|
-
);
|
|
33
|
-
return /*#__PURE__*/ React.createElement(TypeEle.default, {
|
|
21
|
+
var mediaType = React.useMemo(function () {
|
|
22
|
+
if (_indexOfInstanceProperty(videoType).call(videoType, name) !== -1) {
|
|
23
|
+
return enums.MediaTypeEnum.video;
|
|
24
|
+
}
|
|
25
|
+
if (_indexOfInstanceProperty(audioType).call(audioType, name) !== -1) {
|
|
26
|
+
return enums.MediaTypeEnum.audio;
|
|
27
|
+
}
|
|
28
|
+
return enums.MediaTypeEnum.img;
|
|
29
|
+
}, [name]);
|
|
30
|
+
return /*#__PURE__*/React.createElement(TypeEle.default, {
|
|
34
31
|
onError: onError,
|
|
35
32
|
onReady: onReady,
|
|
36
33
|
mediaType: mediaType,
|
|
37
|
-
url: file.response.url
|
|
34
|
+
url: file.response.url
|
|
38
35
|
});
|
|
39
|
-
};
|
|
36
|
+
});
|
|
40
37
|
|
|
41
38
|
exports.default = MediaTypeEle;
|
|
42
39
|
// powered by h
|
|
@@ -2,9 +2,5 @@
|
|
|
2
2
|
import type { ModalProps } from "antd";
|
|
3
3
|
import type { IMediaTypeEleProps } from "../modal";
|
|
4
4
|
export type IPreviewProps = IMediaTypeEleProps & ModalProps;
|
|
5
|
-
declare const _default: ({
|
|
6
|
-
visible,
|
|
7
|
-
file,
|
|
8
|
-
onCancel,
|
|
9
|
-
}: IPreviewProps) => JSX.Element;
|
|
5
|
+
declare const _default: ({ visible, file, onCancel }: IPreviewProps) => JSX.Element;
|
|
10
6
|
export default _default;
|
|
@@ -1,28 +1,24 @@
|
|
|
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 antd = require(
|
|
7
|
-
var index = require(
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var antd = require('antd');
|
|
7
|
+
var index = require('../MediaTypeEle/index.js');
|
|
8
8
|
|
|
9
|
-
var Preview = function (_ref) {
|
|
9
|
+
var Preview = (function (_ref) {
|
|
10
10
|
var visible = _ref.visible,
|
|
11
11
|
file = _ref.file,
|
|
12
12
|
onCancel = _ref.onCancel;
|
|
13
|
-
return /*#__PURE__*/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
file: file,
|
|
23
|
-
})
|
|
24
|
-
);
|
|
25
|
-
};
|
|
13
|
+
return /*#__PURE__*/React.createElement(antd.Modal, {
|
|
14
|
+
footer: null,
|
|
15
|
+
visible: visible,
|
|
16
|
+
title: "\u9884\u89C8",
|
|
17
|
+
onCancel: onCancel
|
|
18
|
+
}, /*#__PURE__*/React.createElement(index.default, {
|
|
19
|
+
file: file
|
|
20
|
+
}));
|
|
21
|
+
});
|
|
26
22
|
|
|
27
23
|
exports.default = Preview;
|
|
28
24
|
// powered by h
|