@hw-component/form 0.0.1-bate
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/.babelrc +23 -0
- package/.eslintrc.js +8 -0
- package/.husky/pre-commit +4 -0
- package/.stylelintrc.js +5 -0
- package/LICENSE +201 -0
- package/es/CheckboxGroup/CheckBox/index.d.ts +4 -0
- package/es/CheckboxGroup/CheckBox/index.js +40 -0
- package/es/CheckboxGroup/hooks.d.ts +5 -0
- package/es/CheckboxGroup/hooks.js +123 -0
- package/es/CheckboxGroup/index.d.ts +3 -0
- package/es/CheckboxGroup/index.js +89 -0
- package/es/CheckboxGroup/modal.d.ts +13 -0
- package/es/Form/Context/FormConfigProvider.d.ts +5 -0
- package/es/Form/Context/FormConfigProvider.js +47 -0
- package/es/Form/Context/index.d.ts +5 -0
- package/es/Form/Context/index.js +11 -0
- package/es/Form/FormItem/BasicItem.d.ts +4 -0
- package/es/Form/FormItem/BasicItem.js +73 -0
- package/es/Form/FormItem/Helper.d.ts +7 -0
- package/es/Form/FormItem/Helper.js +24 -0
- package/es/Form/FormItem/RegularFormItem.d.ts +4 -0
- package/es/Form/FormItem/RegularFormItem.js +15 -0
- package/es/Form/FormItem/UpFormItem.d.ts +4 -0
- package/es/Form/FormItem/UpFormItem.js +31 -0
- package/es/Form/FormItem/hooks.d.ts +10 -0
- package/es/Form/FormItem/hooks.js +38 -0
- package/es/Form/FormItem/index.d.ts +4 -0
- package/es/Form/FormItem/index.js +11 -0
- package/es/Form/HFormConnect.d.ts +6 -0
- package/es/Form/HFormConnect.js +54 -0
- package/es/Form/InitSet.d.ts +6 -0
- package/es/Form/InitSet.js +16 -0
- package/es/Form/Label.d.ts +10 -0
- package/es/Form/Label.js +46 -0
- package/es/Form/config.d.ts +28 -0
- package/es/Form/config.js +43 -0
- package/es/Form/hooks/index.d.ts +12 -0
- package/es/Form/hooks/index.js +77 -0
- package/es/Form/hooks/useHForm.d.ts +3 -0
- package/es/Form/hooks/useHForm.js +111 -0
- package/es/Form/hooks/useInitConfigData.d.ts +4 -0
- package/es/Form/hooks/useInitConfigData.js +124 -0
- package/es/Form/index.d.ts +4 -0
- package/es/Form/index.js +73 -0
- package/es/Form/modal.d.ts +92 -0
- package/es/Input/ButtonInput.d.ts +4 -0
- package/es/Input/ButtonInput.js +80 -0
- package/es/Input/InputNumber.d.ts +4 -0
- package/es/Input/InputNumber.js +20 -0
- package/es/Input/SelectInput.d.ts +9 -0
- package/es/Input/SelectInput.js +94 -0
- package/es/Input/defaultConfig.d.ts +7 -0
- package/es/Input/defaultConfig.js +11 -0
- package/es/Input/index.d.ts +4 -0
- package/es/Input/index.js +13 -0
- package/es/Input/modal.d.ts +25 -0
- package/es/PageHandler/ErrorComponent.d.ts +4 -0
- package/es/PageHandler/ErrorComponent.js +33 -0
- package/es/PageHandler/LoadingComponent.d.ts +3 -0
- package/es/PageHandler/LoadingComponent.js +18 -0
- package/es/PageHandler/index.d.ts +4 -0
- package/es/PageHandler/index.js +24 -0
- package/es/PageHandler/modal.d.ts +6 -0
- package/es/RadioGroup/index.d.ts +9 -0
- package/es/RadioGroup/index.js +48 -0
- package/es/Select/components/AllSelect.d.ts +7 -0
- package/es/Select/components/AllSelect.js +50 -0
- package/es/Select/components/CheckBoxOption.d.ts +7 -0
- package/es/Select/components/CheckBoxOption.js +14 -0
- package/es/Select/components/DropdownComponent.d.ts +9 -0
- package/es/Select/components/DropdownComponent.js +39 -0
- package/es/Select/components/NoFindItem.d.ts +6 -0
- package/es/Select/components/NoFindItem.js +13 -0
- package/es/Select/components/NotFoundContent.d.ts +7 -0
- package/es/Select/components/NotFoundContent.js +38 -0
- package/es/Select/defaultConfig.d.ts +6 -0
- package/es/Select/defaultConfig.js +33 -0
- package/es/Select/hooks/changeHooks.d.ts +5 -0
- package/es/Select/hooks/changeHooks.js +194 -0
- package/es/Select/hooks/norHooks.d.ts +10 -0
- package/es/Select/hooks/norHooks.js +85 -0
- package/es/Select/index.d.ts +4 -0
- package/es/Select/index.js +128 -0
- package/es/Select/modal.d.ts +30 -0
- package/es/Select/utils.d.ts +2 -0
- package/es/Select/utils.js +39 -0
- package/es/Submit/index.d.ts +8 -0
- package/es/Submit/index.js +28 -0
- package/es/Switch/index.d.ts +11 -0
- package/es/Switch/index.js +45 -0
- package/es/TDPicker/RangePicker.d.ts +8 -0
- package/es/TDPicker/RangePicker.js +116 -0
- package/es/TDPicker/TimePicker.d.ts +4 -0
- package/es/TDPicker/TimePicker.js +31 -0
- package/es/TDPicker/hooks.d.ts +33 -0
- package/es/TDPicker/hooks.js +132 -0
- package/es/TDPicker/index.d.ts +4 -0
- package/es/TDPicker/index.js +33 -0
- package/es/TDPicker/modal.d.ts +28 -0
- package/es/TextArea/index.d.ts +3 -0
- package/es/Upload/Btn.d.ts +4 -0
- package/es/Upload/Btn.js +31 -0
- package/es/Upload/MediaTypeEle/TypeEle.d.ts +10 -0
- package/es/Upload/MediaTypeEle/TypeEle.js +40 -0
- package/es/Upload/MediaTypeEle/index.d.ts +4 -0
- package/es/Upload/MediaTypeEle/index.js +36 -0
- package/es/Upload/Preview/index.d.ts +6 -0
- package/es/Upload/Preview/index.js +21 -0
- package/es/Upload/UrlUpload/index.d.ts +4 -0
- package/es/Upload/UrlUpload/index.js +119 -0
- package/es/Upload/enums.d.ts +5 -0
- package/es/Upload/enums.js +10 -0
- package/es/Upload/hooks/change.d.ts +3 -0
- package/es/Upload/hooks/change.js +109 -0
- package/es/Upload/hooks/customRequest.d.ts +3 -0
- package/es/Upload/hooks/customRequest.js +69 -0
- package/es/Upload/hooks/propsMaker.d.ts +2 -0
- package/es/Upload/hooks/propsMaker.js +37 -0
- package/es/Upload/index.d.ts +4 -0
- package/es/Upload/index.js +106 -0
- package/es/Upload/modal.d.ts +28 -0
- package/es/Upload/util.d.ts +5 -0
- package/es/Upload/util.js +34 -0
- package/es/config.d.ts +2 -0
- package/es/config.js +64 -0
- package/es/hooks/index.d.ts +13 -0
- package/es/hooks/index.js +75 -0
- package/es/index.css +35 -0
- package/es/index.d.ts +20 -0
- package/es/index.js +25 -0
- package/es/modal.d.ts +15 -0
- package/lib/CheckboxGroup/CheckBox/index.d.ts +4 -0
- package/lib/CheckboxGroup/CheckBox/index.js +43 -0
- package/lib/CheckboxGroup/hooks.d.ts +5 -0
- package/lib/CheckboxGroup/hooks.js +124 -0
- package/lib/CheckboxGroup/index.d.ts +3 -0
- package/lib/CheckboxGroup/index.js +92 -0
- package/lib/CheckboxGroup/modal.d.ts +13 -0
- package/lib/Form/Context/FormConfigProvider.d.ts +5 -0
- package/lib/Form/Context/FormConfigProvider.js +51 -0
- package/lib/Form/Context/index.d.ts +5 -0
- package/lib/Form/Context/index.js +14 -0
- package/lib/Form/FormItem/BasicItem.d.ts +4 -0
- package/lib/Form/FormItem/BasicItem.js +76 -0
- package/lib/Form/FormItem/Helper.d.ts +7 -0
- package/lib/Form/FormItem/Helper.js +27 -0
- package/lib/Form/FormItem/RegularFormItem.d.ts +4 -0
- package/lib/Form/FormItem/RegularFormItem.js +18 -0
- package/lib/Form/FormItem/UpFormItem.d.ts +4 -0
- package/lib/Form/FormItem/UpFormItem.js +34 -0
- package/lib/Form/FormItem/hooks.d.ts +10 -0
- package/lib/Form/FormItem/hooks.js +41 -0
- package/lib/Form/FormItem/index.d.ts +4 -0
- package/lib/Form/FormItem/index.js +14 -0
- package/lib/Form/HFormConnect.d.ts +6 -0
- package/lib/Form/HFormConnect.js +57 -0
- package/lib/Form/InitSet.d.ts +6 -0
- package/lib/Form/InitSet.js +19 -0
- package/lib/Form/Label.d.ts +10 -0
- package/lib/Form/Label.js +49 -0
- package/lib/Form/config.d.ts +28 -0
- package/lib/Form/config.js +47 -0
- package/lib/Form/hooks/index.d.ts +12 -0
- package/lib/Form/hooks/index.js +80 -0
- package/lib/Form/hooks/useHForm.d.ts +3 -0
- package/lib/Form/hooks/useHForm.js +114 -0
- package/lib/Form/hooks/useInitConfigData.d.ts +4 -0
- package/lib/Form/hooks/useInitConfigData.js +127 -0
- package/lib/Form/index.d.ts +4 -0
- package/lib/Form/index.js +76 -0
- package/lib/Form/modal.d.ts +92 -0
- package/lib/Input/ButtonInput.d.ts +4 -0
- package/lib/Input/ButtonInput.js +83 -0
- package/lib/Input/InputNumber.d.ts +4 -0
- package/lib/Input/InputNumber.js +23 -0
- package/lib/Input/SelectInput.d.ts +9 -0
- package/lib/Input/SelectInput.js +98 -0
- package/lib/Input/defaultConfig.d.ts +7 -0
- package/lib/Input/defaultConfig.js +13 -0
- package/lib/Input/index.d.ts +4 -0
- package/lib/Input/index.js +16 -0
- package/lib/Input/modal.d.ts +25 -0
- package/lib/PageHandler/ErrorComponent.d.ts +4 -0
- package/lib/PageHandler/ErrorComponent.js +36 -0
- package/lib/PageHandler/LoadingComponent.d.ts +3 -0
- package/lib/PageHandler/LoadingComponent.js +21 -0
- package/lib/PageHandler/index.d.ts +4 -0
- package/lib/PageHandler/index.js +27 -0
- package/lib/PageHandler/modal.d.ts +6 -0
- package/lib/RadioGroup/index.d.ts +9 -0
- package/lib/RadioGroup/index.js +51 -0
- package/lib/Select/components/AllSelect.d.ts +7 -0
- package/lib/Select/components/AllSelect.js +53 -0
- package/lib/Select/components/CheckBoxOption.d.ts +7 -0
- package/lib/Select/components/CheckBoxOption.js +17 -0
- package/lib/Select/components/DropdownComponent.d.ts +9 -0
- package/lib/Select/components/DropdownComponent.js +42 -0
- package/lib/Select/components/NoFindItem.d.ts +6 -0
- package/lib/Select/components/NoFindItem.js +16 -0
- package/lib/Select/components/NotFoundContent.d.ts +7 -0
- package/lib/Select/components/NotFoundContent.js +41 -0
- package/lib/Select/defaultConfig.d.ts +6 -0
- package/lib/Select/defaultConfig.js +35 -0
- package/lib/Select/hooks/changeHooks.d.ts +5 -0
- package/lib/Select/hooks/changeHooks.js +195 -0
- package/lib/Select/hooks/norHooks.d.ts +10 -0
- package/lib/Select/hooks/norHooks.js +87 -0
- package/lib/Select/index.d.ts +4 -0
- package/lib/Select/index.js +131 -0
- package/lib/Select/modal.d.ts +30 -0
- package/lib/Select/utils.d.ts +2 -0
- package/lib/Select/utils.js +41 -0
- package/lib/Submit/index.d.ts +8 -0
- package/lib/Submit/index.js +31 -0
- package/lib/Switch/index.d.ts +11 -0
- package/lib/Switch/index.js +48 -0
- package/lib/TDPicker/RangePicker.d.ts +8 -0
- package/lib/TDPicker/RangePicker.js +119 -0
- package/lib/TDPicker/TimePicker.d.ts +4 -0
- package/lib/TDPicker/TimePicker.js +34 -0
- package/lib/TDPicker/hooks.d.ts +33 -0
- package/lib/TDPicker/hooks.js +139 -0
- package/lib/TDPicker/index.d.ts +4 -0
- package/lib/TDPicker/index.js +36 -0
- package/lib/TDPicker/modal.d.ts +28 -0
- package/lib/TextArea/index.d.ts +3 -0
- package/lib/Upload/Btn.d.ts +4 -0
- package/lib/Upload/Btn.js +34 -0
- package/lib/Upload/MediaTypeEle/TypeEle.d.ts +10 -0
- package/lib/Upload/MediaTypeEle/TypeEle.js +43 -0
- package/lib/Upload/MediaTypeEle/index.d.ts +4 -0
- package/lib/Upload/MediaTypeEle/index.js +39 -0
- package/lib/Upload/Preview/index.d.ts +6 -0
- package/lib/Upload/Preview/index.js +24 -0
- package/lib/Upload/UrlUpload/index.d.ts +4 -0
- package/lib/Upload/UrlUpload/index.js +122 -0
- package/lib/Upload/enums.d.ts +5 -0
- package/lib/Upload/enums.js +9 -0
- package/lib/Upload/hooks/change.d.ts +3 -0
- package/lib/Upload/hooks/change.js +110 -0
- package/lib/Upload/hooks/customRequest.d.ts +3 -0
- package/lib/Upload/hooks/customRequest.js +70 -0
- package/lib/Upload/hooks/propsMaker.d.ts +2 -0
- package/lib/Upload/hooks/propsMaker.js +38 -0
- package/lib/Upload/index.d.ts +4 -0
- package/lib/Upload/index.js +109 -0
- package/lib/Upload/modal.d.ts +28 -0
- package/lib/Upload/util.d.ts +5 -0
- package/lib/Upload/util.js +38 -0
- package/lib/config.d.ts +2 -0
- package/lib/config.js +65 -0
- package/lib/hooks/index.d.ts +13 -0
- package/lib/hooks/index.js +78 -0
- package/lib/index.css +35 -0
- package/lib/index.d.ts +20 -0
- package/lib/index.js +43 -0
- package/lib/modal.d.ts +15 -0
- package/package.json +81 -0
- package/public/index.html +19 -0
- package/scripts/rollup.config.js +75 -0
- package/scripts/webpack.config.js +76 -0
- package/src/Layout.tsx +61 -0
- package/src/app.tsx +33 -0
- package/src/components/CheckboxGroup/CheckBox/index.tsx +38 -0
- package/src/components/CheckboxGroup/hooks.ts +102 -0
- package/src/components/CheckboxGroup/index.tsx +79 -0
- package/src/components/CheckboxGroup/modal.ts +15 -0
- package/src/components/Form/Context/FormConfigProvider.tsx +38 -0
- package/src/components/Form/Context/index.tsx +14 -0
- package/src/components/Form/FormItem/BasicItem.tsx +70 -0
- package/src/components/Form/FormItem/Helper.tsx +26 -0
- package/src/components/Form/FormItem/RegularFormItem.tsx +7 -0
- package/src/components/Form/FormItem/UpFormItem.tsx +20 -0
- package/src/components/Form/FormItem/hooks.tsx +44 -0
- package/src/components/Form/FormItem/index.tsx +8 -0
- package/src/components/Form/HFormConnect.tsx +49 -0
- package/src/components/Form/InitSet.tsx +12 -0
- package/src/components/Form/Label.tsx +50 -0
- package/src/components/Form/config.ts +40 -0
- package/src/components/Form/hooks/index.ts +42 -0
- package/src/components/Form/hooks/useHForm.ts +89 -0
- package/src/components/Form/hooks/useInitConfigData.tsx +100 -0
- package/src/components/Form/index.less +22 -0
- package/src/components/Form/index.tsx +61 -0
- package/src/components/Form/modal.ts +142 -0
- package/src/components/Input/ButtonInput.tsx +41 -0
- package/src/components/Input/InputNumber.tsx +5 -0
- package/src/components/Input/SelectInput.tsx +74 -0
- package/src/components/Input/defaultConfig.ts +8 -0
- package/src/components/Input/index.tsx +6 -0
- package/src/components/Input/modal.ts +31 -0
- package/src/components/PageHandler/ErrorComponent.tsx +20 -0
- package/src/components/PageHandler/LoadingComponent.tsx +9 -0
- package/src/components/PageHandler/index.tsx +14 -0
- package/src/components/PageHandler/modal.ts +6 -0
- package/src/components/RadioGroup/index.tsx +45 -0
- package/src/components/Select/components/AllSelect.tsx +54 -0
- package/src/components/Select/components/CheckBoxOption.tsx +14 -0
- package/src/components/Select/components/DropdownComponent.tsx +36 -0
- package/src/components/Select/components/NoFindItem.tsx +7 -0
- package/src/components/Select/components/NotFoundContent.tsx +25 -0
- package/src/components/Select/defaultConfig.tsx +23 -0
- package/src/components/Select/hooks/changeHooks.tsx +151 -0
- package/src/components/Select/hooks/norHooks.ts +63 -0
- package/src/components/Select/index.less +22 -0
- package/src/components/Select/index.tsx +120 -0
- package/src/components/Select/modal.ts +30 -0
- package/src/components/Select/utils.ts +18 -0
- package/src/components/Submit/index.tsx +28 -0
- package/src/components/Switch/index.tsx +52 -0
- package/src/components/TDPicker/RangePicker.tsx +103 -0
- package/src/components/TDPicker/TimePicker.tsx +15 -0
- package/src/components/TDPicker/hooks.ts +150 -0
- package/src/components/TDPicker/index.tsx +22 -0
- package/src/components/TDPicker/modal.ts +30 -0
- package/src/components/TextArea/index.tsx +8 -0
- package/src/components/Upload/Btn.tsx +24 -0
- package/src/components/Upload/MediaTypeEle/TypeEle.tsx +26 -0
- package/src/components/Upload/MediaTypeEle/index.tsx +34 -0
- package/src/components/Upload/Preview/index.tsx +14 -0
- package/src/components/Upload/UrlUpload/index.tsx +91 -0
- package/src/components/Upload/enums.ts +5 -0
- package/src/components/Upload/hooks/change.ts +79 -0
- package/src/components/Upload/hooks/customRequest.ts +44 -0
- package/src/components/Upload/hooks/propsMaker.ts +20 -0
- package/src/components/Upload/index.tsx +85 -0
- package/src/components/Upload/modal.ts +31 -0
- package/src/components/Upload/util.ts +27 -0
- package/src/components/config.ts +40 -0
- package/src/components/hooks/index.ts +53 -0
- package/src/components/index.tsx +21 -0
- package/src/components/modal.ts +15 -0
- package/src/components/styles/index.less +2 -0
- package/src/components/styles/local.less +1 -0
- package/src/components/typings.d.ts +11 -0
- package/src/index.less +20 -0
- package/src/index.tsx +12 -0
- package/src/pages/Checkbox/index.tsx +15 -0
- package/src/pages/DatePicker/index.tsx +33 -0
- package/src/pages/Form/index.tsx +146 -0
- package/src/pages/Input/index.tsx +22 -0
- package/src/pages/Radio/index.tsx +18 -0
- package/src/pages/Select/index.tsx +57 -0
- package/src/pages/Switch/index.tsx +18 -0
- package/src/pages/Upload/index.tsx +14 -0
- package/src/routes.tsx +68 -0
- package/tsconfig.json +29 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import _asyncToGenerator from '@babel/runtime-corejs3/helpers/asyncToGenerator';
|
|
3
|
+
import _slicedToArray from '@babel/runtime-corejs3/helpers/slicedToArray';
|
|
4
|
+
import _regeneratorRuntime from '@babel/runtime-corejs3/regenerator';
|
|
5
|
+
import _Promise from '@babel/runtime-corejs3/core-js/promise';
|
|
6
|
+
import { useState } from 'react';
|
|
7
|
+
import { useRequest } from 'ahooks';
|
|
8
|
+
|
|
9
|
+
var useOptionReq = function useOptionReq(_ref) {
|
|
10
|
+
var manual = _ref.manual,
|
|
11
|
+
request = _ref.request,
|
|
12
|
+
options = _ref.options,
|
|
13
|
+
serviceSearch = _ref.serviceSearch,
|
|
14
|
+
showSearch = _ref.showSearch,
|
|
15
|
+
propsOnSearch = _ref.onSearch;
|
|
16
|
+
var _useState = useState(),
|
|
17
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
18
|
+
data = _useState2[0],
|
|
19
|
+
setData = _useState2[1];
|
|
20
|
+
var _useRequest = useRequest( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
21
|
+
var params,
|
|
22
|
+
type,
|
|
23
|
+
_args = arguments;
|
|
24
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
25
|
+
while (1) switch (_context.prev = _context.next) {
|
|
26
|
+
case 0:
|
|
27
|
+
params = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
|
|
28
|
+
type = _args.length > 1 && _args[1] !== undefined ? _args[1] : "init";
|
|
29
|
+
if (type === "init") {
|
|
30
|
+
setData(undefined);
|
|
31
|
+
}
|
|
32
|
+
if (!request) {
|
|
33
|
+
_context.next = 5;
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
return _context.abrupt("return", request(params));
|
|
37
|
+
case 5:
|
|
38
|
+
return _context.abrupt("return", _Promise.resolve(options));
|
|
39
|
+
case 6:
|
|
40
|
+
case "end":
|
|
41
|
+
return _context.stop();
|
|
42
|
+
}
|
|
43
|
+
}, _callee);
|
|
44
|
+
})), {
|
|
45
|
+
manual: manual,
|
|
46
|
+
debounceInterval: 300,
|
|
47
|
+
onSuccess: function onSuccess(resultData) {
|
|
48
|
+
setData(resultData);
|
|
49
|
+
}
|
|
50
|
+
}),
|
|
51
|
+
run = _useRequest.run,
|
|
52
|
+
loading = _useRequest.loading,
|
|
53
|
+
error = _useRequest.error;
|
|
54
|
+
var onSearch = function onSearch(inputValue) {
|
|
55
|
+
if (!serviceSearch) {
|
|
56
|
+
propsOnSearch === null || propsOnSearch === void 0 ? void 0 : propsOnSearch(inputValue);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
run({
|
|
60
|
+
inputValue: inputValue
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
var mathShowSearch = showSearch || serviceSearch;
|
|
64
|
+
return {
|
|
65
|
+
run: run,
|
|
66
|
+
loading: loading,
|
|
67
|
+
error: error,
|
|
68
|
+
data: data,
|
|
69
|
+
onSearch: mathShowSearch ? onSearch : propsOnSearch,
|
|
70
|
+
mathShowSearch: showSearch || serviceSearch
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
var useFilterOption = function useFilterOption(_ref3) {
|
|
74
|
+
var filterOption = _ref3.filterOption,
|
|
75
|
+
serviceSearch = _ref3.serviceSearch;
|
|
76
|
+
if (serviceSearch) {
|
|
77
|
+
return function () {
|
|
78
|
+
return true;
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
return filterOption;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export { useFilterOption, useOptionReq };
|
|
85
|
+
// powered by hdj
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { HSelectProps } from "./modal";
|
|
3
|
+
declare const _default: ({ style, mode, options, modeConfig, value, onChange, fieldNames: propsFieldNames, request, manual, optionLabelProp, filterProvider, optionFilterProp, serviceSearch, onSearch: propsOnSearch, filterOption, showSearch, labelInValue, noMatchItemRender, allSelect, ...props }: HSelectProps) => JSX.Element;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import _extends from '@babel/runtime-corejs3/helpers/extends';
|
|
3
|
+
import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
|
|
4
|
+
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
|
|
5
|
+
import _mapInstanceProperty from '@babel/runtime-corejs3/core-js/instance/map';
|
|
6
|
+
import { Select } from 'antd';
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { useFilterOption, useOptionReq } from './hooks/norHooks.js';
|
|
9
|
+
import { useValueChange } from './hooks/changeHooks.js';
|
|
10
|
+
import { defaultModeConfig, defaultSelectConfig } from './defaultConfig.js';
|
|
11
|
+
import Index from './components/DropdownComponent.js';
|
|
12
|
+
import Index$1 from './components/AllSelect.js';
|
|
13
|
+
import { useMatchConfigProps, useChangeOptions } from '../hooks/index.js';
|
|
14
|
+
|
|
15
|
+
var _excluded = ["style", "mode", "options", "modeConfig", "value", "onChange", "fieldNames", "request", "manual", "optionLabelProp", "filterProvider", "optionFilterProp", "serviceSearch", "onSearch", "filterOption", "showSearch", "labelInValue", "noMatchItemRender", "allSelect"];
|
|
16
|
+
var Option = Select.Option;
|
|
17
|
+
var HSelect = (function (_ref) {
|
|
18
|
+
var _ref$style = _ref.style,
|
|
19
|
+
style = _ref$style === void 0 ? {
|
|
20
|
+
width: "100%"
|
|
21
|
+
} : _ref$style,
|
|
22
|
+
mode = _ref.mode,
|
|
23
|
+
options = _ref.options,
|
|
24
|
+
_ref$modeConfig = _ref.modeConfig,
|
|
25
|
+
modeConfig = _ref$modeConfig === void 0 ? defaultModeConfig : _ref$modeConfig,
|
|
26
|
+
value = _ref.value,
|
|
27
|
+
onChange = _ref.onChange,
|
|
28
|
+
propsFieldNames = _ref.fieldNames,
|
|
29
|
+
request = _ref.request,
|
|
30
|
+
manual = _ref.manual,
|
|
31
|
+
_ref$optionLabelProp = _ref.optionLabelProp,
|
|
32
|
+
optionLabelProp = _ref$optionLabelProp === void 0 ? "label" : _ref$optionLabelProp,
|
|
33
|
+
filterProvider = _ref.filterProvider,
|
|
34
|
+
_ref$optionFilterProp = _ref.optionFilterProp,
|
|
35
|
+
optionFilterProp = _ref$optionFilterProp === void 0 ? "filterLabel" : _ref$optionFilterProp,
|
|
36
|
+
serviceSearch = _ref.serviceSearch,
|
|
37
|
+
propsOnSearch = _ref.onSearch,
|
|
38
|
+
filterOption = _ref.filterOption,
|
|
39
|
+
showSearch = _ref.showSearch,
|
|
40
|
+
labelInValue = _ref.labelInValue,
|
|
41
|
+
_ref$noMatchItemRende = _ref.noMatchItemRender,
|
|
42
|
+
noMatchItemRender = _ref$noMatchItemRende === void 0 ? defaultSelectConfig.noMatchItemRender : _ref$noMatchItemRende,
|
|
43
|
+
allSelect = _ref.allSelect,
|
|
44
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
45
|
+
var _ref2 = (modeConfig === null || modeConfig === void 0 ? void 0 : modeConfig[mode || ""]) || {},
|
|
46
|
+
icon = _ref2.icon,
|
|
47
|
+
render = _ref2.render;
|
|
48
|
+
var _useMatchConfigProps = useMatchConfigProps({
|
|
49
|
+
fieldNames: propsFieldNames
|
|
50
|
+
}),
|
|
51
|
+
fieldNames = _useMatchConfigProps.fieldNames;
|
|
52
|
+
var selfFilterOption = useFilterOption({
|
|
53
|
+
filterOption: filterOption,
|
|
54
|
+
serviceSearch: serviceSearch
|
|
55
|
+
});
|
|
56
|
+
var _useOptionReq = useOptionReq({
|
|
57
|
+
options: options,
|
|
58
|
+
manual: manual,
|
|
59
|
+
fieldNames: fieldNames,
|
|
60
|
+
request: request,
|
|
61
|
+
serviceSearch: serviceSearch,
|
|
62
|
+
showSearch: showSearch,
|
|
63
|
+
onSearch: propsOnSearch
|
|
64
|
+
}),
|
|
65
|
+
run = _useOptionReq.run,
|
|
66
|
+
loading = _useOptionReq.loading,
|
|
67
|
+
resultData = _useOptionReq.data,
|
|
68
|
+
error = _useOptionReq.error,
|
|
69
|
+
onSearch = _useOptionReq.onSearch,
|
|
70
|
+
mathShowSearch = _useOptionReq.mathShowSearch;
|
|
71
|
+
var data = useChangeOptions({
|
|
72
|
+
options: resultData,
|
|
73
|
+
fieldNames: fieldNames
|
|
74
|
+
});
|
|
75
|
+
var _useValueChange = useValueChange({
|
|
76
|
+
labelInValue: labelInValue,
|
|
77
|
+
onChange: onChange,
|
|
78
|
+
value: value,
|
|
79
|
+
options: data,
|
|
80
|
+
mode: mode,
|
|
81
|
+
noMatchItemRender: noMatchItemRender,
|
|
82
|
+
fieldNames: fieldNames
|
|
83
|
+
}),
|
|
84
|
+
val = _useValueChange.val,
|
|
85
|
+
change = _useValueChange.change;
|
|
86
|
+
return /*#__PURE__*/React.createElement(Select, _extends({
|
|
87
|
+
style: style,
|
|
88
|
+
mode: mode,
|
|
89
|
+
loading: loading,
|
|
90
|
+
value: val,
|
|
91
|
+
onSearch: onSearch,
|
|
92
|
+
onChange: change,
|
|
93
|
+
dropdownRender: function dropdownRender(node) {
|
|
94
|
+
return /*#__PURE__*/React.createElement(Index, {
|
|
95
|
+
loading: loading,
|
|
96
|
+
reload: run,
|
|
97
|
+
error: error,
|
|
98
|
+
options: data
|
|
99
|
+
}, /*#__PURE__*/React.createElement(Index$1, {
|
|
100
|
+
allSelect: allSelect,
|
|
101
|
+
options: data,
|
|
102
|
+
mode: mode,
|
|
103
|
+
value: val,
|
|
104
|
+
onChange: change
|
|
105
|
+
}, node));
|
|
106
|
+
},
|
|
107
|
+
optionLabelProp: optionLabelProp,
|
|
108
|
+
menuItemSelectedIcon: icon,
|
|
109
|
+
optionFilterProp: optionFilterProp,
|
|
110
|
+
filterOption: selfFilterOption,
|
|
111
|
+
showSearch: mathShowSearch,
|
|
112
|
+
labelInValue: true
|
|
113
|
+
}, props), data === null || data === void 0 ? void 0 : _mapInstanceProperty(data).call(data, function (item) {
|
|
114
|
+
var optionValue = item.value,
|
|
115
|
+
label = item.label;
|
|
116
|
+
var result = (filterProvider === null || filterProvider === void 0 ? void 0 : filterProvider(item)) || label;
|
|
117
|
+
var filter = _defineProperty({}, optionFilterProp, result);
|
|
118
|
+
return /*#__PURE__*/React.createElement(Option, _extends({
|
|
119
|
+
value: optionValue,
|
|
120
|
+
key: optionValue,
|
|
121
|
+
label: label,
|
|
122
|
+
mode: mode
|
|
123
|
+
}, filter), render ? render(item, val) : label);
|
|
124
|
+
}));
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
export { HSelect as default };
|
|
128
|
+
// powered by hdj
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { SelectProps } from "antd";
|
|
2
|
+
import type React from "react";
|
|
3
|
+
import type { PromiseFnResult } from "../modal";
|
|
4
|
+
export type OptionType = Record<string, any>;
|
|
5
|
+
export type PartialHSelectProps = Partial<HSelectProps>;
|
|
6
|
+
export type RenderFn = (data: OptionType) => React.ReactNode;
|
|
7
|
+
interface ModeConfigItem {
|
|
8
|
+
icon?: React.ReactNode | null;
|
|
9
|
+
render?: (item: OptionType, value: any[]) => React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export interface ModeConfig {
|
|
12
|
+
multiple?: ModeConfigItem;
|
|
13
|
+
tags?: ModeConfigItem;
|
|
14
|
+
}
|
|
15
|
+
export interface HSelectProps extends Omit<SelectProps, "options"> {
|
|
16
|
+
style?: React.CSSProperties;
|
|
17
|
+
request?: PromiseFnResult<any, OptionType[]>;
|
|
18
|
+
manual?: boolean;
|
|
19
|
+
modeConfig?: ModeConfig;
|
|
20
|
+
filterProvider?: (item: any) => string;
|
|
21
|
+
serviceSearch?: boolean;
|
|
22
|
+
options?: OptionType[];
|
|
23
|
+
noMatchItemRender?: RenderFn;
|
|
24
|
+
allSelect?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface FilterDataModal {
|
|
27
|
+
value: any;
|
|
28
|
+
index: number;
|
|
29
|
+
}
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import _Object$keys from '@babel/runtime-corejs3/core-js/object/keys';
|
|
3
|
+
import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js/object/get-own-property-symbols';
|
|
4
|
+
import _filterInstanceProperty from '@babel/runtime-corejs3/core-js/instance/filter';
|
|
5
|
+
import _Object$getOwnPropertyDescriptor from '@babel/runtime-corejs3/core-js/object/get-own-property-descriptor';
|
|
6
|
+
import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js/instance/for-each';
|
|
7
|
+
import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js/object/get-own-property-descriptors';
|
|
8
|
+
import _Object$defineProperties from '@babel/runtime-corejs3/core-js/object/define-properties';
|
|
9
|
+
import _Object$defineProperty from '@babel/runtime-corejs3/core-js/object/define-property';
|
|
10
|
+
import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
|
|
11
|
+
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
|
|
12
|
+
import _Array$isArray from '@babel/runtime-corejs3/core-js/array/is-array';
|
|
13
|
+
import _mapInstanceProperty from '@babel/runtime-corejs3/core-js/instance/map';
|
|
14
|
+
|
|
15
|
+
var _excluded = ["label", "value"];
|
|
16
|
+
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
17
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
18
|
+
var itemOpMaker = function itemOpMaker(itemOp, fieldNames) {
|
|
19
|
+
var _objectSpread2;
|
|
20
|
+
var label = itemOp.label,
|
|
21
|
+
itemVal = itemOp.value,
|
|
22
|
+
oItemOp = _objectWithoutProperties(itemOp, _excluded);
|
|
23
|
+
var _fieldNames$label = fieldNames.label,
|
|
24
|
+
labelKey = _fieldNames$label === void 0 ? "" : _fieldNames$label,
|
|
25
|
+
_fieldNames$value = fieldNames.value,
|
|
26
|
+
valKey = _fieldNames$value === void 0 ? "" : _fieldNames$value;
|
|
27
|
+
return _objectSpread((_objectSpread2 = {}, _defineProperty(_objectSpread2, labelKey, label), _defineProperty(_objectSpread2, valKey, itemVal), _objectSpread2), oItemOp);
|
|
28
|
+
};
|
|
29
|
+
var itemOpProvider = function itemOpProvider(itemOps, fieldNames) {
|
|
30
|
+
if (_Array$isArray(itemOps)) {
|
|
31
|
+
return _mapInstanceProperty(itemOps).call(itemOps, function (item) {
|
|
32
|
+
return itemOpMaker(item, fieldNames);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
return itemOpMaker(itemOps, fieldNames);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export { itemOpMaker, itemOpProvider };
|
|
39
|
+
// powered by hdj
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { ButtonProps, FormInstance } from "antd/es";
|
|
3
|
+
export interface ISubmitProps extends Omit<ButtonProps, "form"> {
|
|
4
|
+
text?: string;
|
|
5
|
+
form: FormInstance;
|
|
6
|
+
}
|
|
7
|
+
declare const _default: ({ text, type, form, loading, ...props }: ISubmitProps) => JSX.Element;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import _extends from '@babel/runtime-corejs3/helpers/extends';
|
|
3
|
+
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
|
|
4
|
+
import { Button } from 'antd';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { useFormContext } from '../Form/Context/index.js';
|
|
7
|
+
|
|
8
|
+
var _excluded = ["text", "type", "form", "loading"];
|
|
9
|
+
var HSubmit = (function (_ref) {
|
|
10
|
+
var _ref$text = _ref.text,
|
|
11
|
+
text = _ref$text === void 0 ? "提交" : _ref$text,
|
|
12
|
+
_ref$type = _ref.type,
|
|
13
|
+
type = _ref$type === void 0 ? "primary" : _ref$type,
|
|
14
|
+
form = _ref.form,
|
|
15
|
+
loading = _ref.loading,
|
|
16
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
17
|
+
var _useFormContext = useFormContext(),
|
|
18
|
+
_useFormContext$loadi = _useFormContext.loading,
|
|
19
|
+
formSubLoading = _useFormContext$loadi === void 0 ? loading : _useFormContext$loadi;
|
|
20
|
+
return /*#__PURE__*/React.createElement(Button, _extends({}, props, {
|
|
21
|
+
type: type,
|
|
22
|
+
onClick: form.submit,
|
|
23
|
+
loading: formSubLoading
|
|
24
|
+
}), text);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export { HSubmit as default };
|
|
28
|
+
// powered by hdj
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SwitchProps } from "antd";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import type { ValueSwitchMapModal } from "../modal";
|
|
4
|
+
export interface HSwitchProps extends Omit<SwitchProps, "onChange"> {
|
|
5
|
+
valueMap?: ValueSwitchMapModal;
|
|
6
|
+
value?: any;
|
|
7
|
+
onChange?: (val: any) => void;
|
|
8
|
+
beforeText?: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
declare const Index: React.FC<HSwitchProps>;
|
|
11
|
+
export default Index;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import _extends from '@babel/runtime-corejs3/helpers/extends';
|
|
3
|
+
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
|
|
4
|
+
import { Space, Switch } from 'antd';
|
|
5
|
+
import React, { useMemo } from 'react';
|
|
6
|
+
import { useMatchConfigProps } from '../hooks/index.js';
|
|
7
|
+
|
|
8
|
+
var _excluded = ["value", "onChange", "valueMap", "children", "unCheckedChildren", "checkedChildren", "beforeText"];
|
|
9
|
+
var Index = function Index(_ref) {
|
|
10
|
+
var value = _ref.value,
|
|
11
|
+
onChange = _ref.onChange,
|
|
12
|
+
propsValueSwitchMap = _ref.valueMap,
|
|
13
|
+
children = _ref.children,
|
|
14
|
+
_ref$unCheckedChildre = _ref.unCheckedChildren,
|
|
15
|
+
unCheckedChildren = _ref$unCheckedChildre === void 0 ? "关闭" : _ref$unCheckedChildre,
|
|
16
|
+
_ref$checkedChildren = _ref.checkedChildren,
|
|
17
|
+
checkedChildren = _ref$checkedChildren === void 0 ? "开启" : _ref$checkedChildren,
|
|
18
|
+
beforeText = _ref.beforeText,
|
|
19
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
20
|
+
var _useMatchConfigProps = useMatchConfigProps({
|
|
21
|
+
valueSwitchMap: propsValueSwitchMap
|
|
22
|
+
}),
|
|
23
|
+
_useMatchConfigProps$ = _useMatchConfigProps.valueSwitchMap,
|
|
24
|
+
valueSwitchMap = _useMatchConfigProps$ === void 0 ? {} : _useMatchConfigProps$;
|
|
25
|
+
var swChecked = useMemo(function () {
|
|
26
|
+
var open = valueSwitchMap.open;
|
|
27
|
+
return value === open;
|
|
28
|
+
}, [value]);
|
|
29
|
+
var change = function change(checked) {
|
|
30
|
+
var subVal = valueSwitchMap.close;
|
|
31
|
+
if (checked) {
|
|
32
|
+
subVal = valueSwitchMap.open;
|
|
33
|
+
}
|
|
34
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(subVal);
|
|
35
|
+
};
|
|
36
|
+
return /*#__PURE__*/React.createElement(Space, null, beforeText, /*#__PURE__*/React.createElement(Switch, _extends({
|
|
37
|
+
checked: swChecked,
|
|
38
|
+
checkedChildren: checkedChildren,
|
|
39
|
+
unCheckedChildren: unCheckedChildren,
|
|
40
|
+
onChange: change
|
|
41
|
+
}, props)), /*#__PURE__*/React.createElement("span", null, children));
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export { Index as default };
|
|
45
|
+
// powered by hdj
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { HItemProps } from "../Form/modal";
|
|
3
|
+
declare const _default: {
|
|
4
|
+
Component: (props: import("../Form/modal").HFormItemProps) => React.ReactElement<import("../Form/modal").ConnectResultProps, string | React.JSXElementConstructor<any>>;
|
|
5
|
+
placeholder: ({ label }: HItemProps) => string[];
|
|
6
|
+
requiredErrMsg: ({ label }: HItemProps) => string;
|
|
7
|
+
};
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import _Object$keys from '@babel/runtime-corejs3/core-js/object/keys';
|
|
3
|
+
import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js/object/get-own-property-symbols';
|
|
4
|
+
import _filterInstanceProperty from '@babel/runtime-corejs3/core-js/instance/filter';
|
|
5
|
+
import _Object$getOwnPropertyDescriptor from '@babel/runtime-corejs3/core-js/object/get-own-property-descriptor';
|
|
6
|
+
import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js/object/get-own-property-descriptors';
|
|
7
|
+
import _Object$defineProperties from '@babel/runtime-corejs3/core-js/object/define-properties';
|
|
8
|
+
import _Object$defineProperty from '@babel/runtime-corejs3/core-js/object/define-property';
|
|
9
|
+
import _extends from '@babel/runtime-corejs3/helpers/extends';
|
|
10
|
+
import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
|
|
11
|
+
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
|
|
12
|
+
import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js/instance/for-each';
|
|
13
|
+
import _Object$values from '@babel/runtime-corejs3/core-js/object/values';
|
|
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';
|
|
20
|
+
|
|
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; }
|
|
24
|
+
var RangePicker = DatePicker.RangePicker;
|
|
25
|
+
var HRangePicker = function HRangePicker(_ref) {
|
|
26
|
+
var value = _ref.value,
|
|
27
|
+
onChange = _ref.onChange,
|
|
28
|
+
_ref$showTime = _ref.showTime,
|
|
29
|
+
showTime = _ref$showTime === void 0 ? true : _ref$showTime,
|
|
30
|
+
_ref$format = _ref.format,
|
|
31
|
+
format = _ref$format === void 0 ? "X" : _ref$format,
|
|
32
|
+
valueMap = _ref.valueMap,
|
|
33
|
+
_ref$ranges = _ref.ranges,
|
|
34
|
+
ranges = _ref$ranges === void 0 ? true : _ref$ranges,
|
|
35
|
+
name = _ref.name,
|
|
36
|
+
addFormat = _ref.addFormat,
|
|
37
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
38
|
+
var _useMatchConfigProps = useMatchConfigProps({
|
|
39
|
+
valueRangePickerValueMap: valueMap,
|
|
40
|
+
dateRanges: undefined
|
|
41
|
+
}),
|
|
42
|
+
_useMatchConfigProps$ = _useMatchConfigProps.valueRangePickerValueMap,
|
|
43
|
+
valueRangePickerValueMap = _useMatchConfigProps$ === void 0 ? {} : _useMatchConfigProps$,
|
|
44
|
+
dateRanges = _useMatchConfigProps.dateRanges;
|
|
45
|
+
var dateMapKeys = useGetTimeKey({
|
|
46
|
+
valueMap: valueRangePickerValueMap,
|
|
47
|
+
name: name
|
|
48
|
+
});
|
|
49
|
+
var paramsProvider = useRangeValueProvider({
|
|
50
|
+
valueMap: dateMapKeys
|
|
51
|
+
});
|
|
52
|
+
var timeVal = useRangePickerTimeVal({
|
|
53
|
+
value: value,
|
|
54
|
+
format: format,
|
|
55
|
+
valueMap: dateMapKeys
|
|
56
|
+
});
|
|
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 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);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
var change = function change(val) {
|
|
86
|
+
if (!format || !val) {
|
|
87
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(val);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
var subVal = _mapInstanceProperty(val).call(val, function (item) {
|
|
91
|
+
return item === null || item === void 0 ? void 0 : item.format(format);
|
|
92
|
+
});
|
|
93
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(paramsProvider(subVal));
|
|
94
|
+
};
|
|
95
|
+
return /*#__PURE__*/React.createElement(RangePicker, _extends({
|
|
96
|
+
value: timeVal,
|
|
97
|
+
onChange: change,
|
|
98
|
+
showTime: showTime,
|
|
99
|
+
ranges: defaultRanges
|
|
100
|
+
}, props));
|
|
101
|
+
};
|
|
102
|
+
var Index = HFormConnect(HRangePicker);
|
|
103
|
+
var HRangePicker$1 = {
|
|
104
|
+
Component: Index,
|
|
105
|
+
placeholder: function placeholder(_ref3) {
|
|
106
|
+
var label = _ref3.label;
|
|
107
|
+
return ["\u8BF7\u9009\u62E9\u5F00\u59CB".concat(label), "\u8BF7\u9009\u62E9\u7ED3\u675F".concat(label)];
|
|
108
|
+
},
|
|
109
|
+
requiredErrMsg: function requiredErrMsg(_ref4) {
|
|
110
|
+
var label = _ref4.label;
|
|
111
|
+
return "\u8BF7\u9009\u62E9".concat(label);
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export { HRangePicker$1 as default };
|
|
116
|
+
// powered by hdj
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
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
|
+
|
|
8
|
+
var _excluded = ["value", "format", "onChange"];
|
|
9
|
+
var HTimePicker = (function (_ref) {
|
|
10
|
+
var value = _ref.value,
|
|
11
|
+
_ref$format = _ref.format,
|
|
12
|
+
format = _ref$format === void 0 ? "X" : _ref$format,
|
|
13
|
+
onChange = _ref.onChange,
|
|
14
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
15
|
+
var timeVal = useTimePickerValue({
|
|
16
|
+
value: value,
|
|
17
|
+
format: format
|
|
18
|
+
});
|
|
19
|
+
var change = useTimePickerChange({
|
|
20
|
+
value: value,
|
|
21
|
+
format: format,
|
|
22
|
+
onChange: onChange
|
|
23
|
+
});
|
|
24
|
+
return /*#__PURE__*/React.createElement(TimePicker, _extends({
|
|
25
|
+
value: timeVal,
|
|
26
|
+
onChange: change
|
|
27
|
+
}, props));
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export { HTimePicker as default };
|
|
31
|
+
// powered by hdj
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Moment, DurationInputArg2 } from "moment";
|
|
2
|
+
import type { HRangePickerProps } from "./modal";
|
|
3
|
+
import type { DateRangePickerValueMapModal } from "../modal";
|
|
4
|
+
interface UseTimeValParams {
|
|
5
|
+
value?: any | [any, any];
|
|
6
|
+
format?: string;
|
|
7
|
+
valueMap?: DateRangePickerValueMapModal;
|
|
8
|
+
}
|
|
9
|
+
interface UseTimePickerValParams {
|
|
10
|
+
value?: any;
|
|
11
|
+
format?: string | DurationInputArg2;
|
|
12
|
+
}
|
|
13
|
+
interface UseTimeChangeParams {
|
|
14
|
+
format?: string;
|
|
15
|
+
onChange?: (time?: Moment | string | number) => void;
|
|
16
|
+
value?: any;
|
|
17
|
+
}
|
|
18
|
+
export declare const useTimeVal: ({ value, format }: 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;
|
|
33
|
+
export {};
|