@hw-component/form 0.0.1-beta → 0.0.1-beta-v3
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 +78 -0
- package/es/ModalForm/index.d.ts +4 -0
- package/es/ModalForm/index.js +59 -0
- package/es/ModalForm/modal.d.ts +23 -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 +81 -0
- package/lib/ModalForm/index.d.ts +4 -0
- package/lib/ModalForm/index.js +62 -0
- package/lib/ModalForm/modal.d.ts +23 -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 +61 -0
- package/src/components/ModalForm/index.tsx +52 -0
- package/src/components/ModalForm/modal.ts +25 -0
- package/src/components/index.tsx +4 -0
- package/src/pages/ModalForm/index.tsx +127 -0
- package/src/routes.tsx +6 -1
package/es/TDPicker/index.js
CHANGED
|
@@ -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 { DatePicker } from
|
|
6
|
-
import { useTimeVal, useTimeChange } 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 { DatePicker } from 'antd';
|
|
6
|
+
import { useTimeVal, useTimeChange } from './hooks.js';
|
|
7
7
|
|
|
8
8
|
var _excluded = ["value", "onChange", "showTime", "format"];
|
|
9
|
-
var HDatePicker = function (_ref) {
|
|
9
|
+
var HDatePicker = (function (_ref) {
|
|
10
10
|
var value = _ref.value,
|
|
11
11
|
onChange = _ref.onChange,
|
|
12
12
|
_ref$showTime = _ref.showTime,
|
|
@@ -16,24 +16,18 @@ var HDatePicker = function (_ref) {
|
|
|
16
16
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
17
17
|
var timeVal = useTimeVal({
|
|
18
18
|
value: value,
|
|
19
|
-
format: format
|
|
19
|
+
format: format
|
|
20
20
|
});
|
|
21
21
|
var change = useTimeChange({
|
|
22
22
|
format: format,
|
|
23
|
-
onChange: onChange
|
|
23
|
+
onChange: onChange
|
|
24
24
|
});
|
|
25
|
-
return /*#__PURE__*/
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
showTime: showTime,
|
|
32
|
-
},
|
|
33
|
-
props
|
|
34
|
-
)
|
|
35
|
-
);
|
|
36
|
-
};
|
|
25
|
+
return /*#__PURE__*/React.createElement(DatePicker, _extends({
|
|
26
|
+
value: timeVal,
|
|
27
|
+
onChange: change,
|
|
28
|
+
showTime: showTime
|
|
29
|
+
}, props));
|
|
30
|
+
});
|
|
37
31
|
|
|
38
32
|
export { HDatePicker as default };
|
|
39
33
|
// powered by hdj
|
package/es/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/es/TextArea/index.d.ts
CHANGED
package/es/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/es/Upload/Btn.js
CHANGED
|
@@ -1,47 +1,31 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
|
-
import React, { useMemo } from
|
|
3
|
-
import { PlusOutlined, UploadOutlined } from
|
|
4
|
-
import { Button } from
|
|
2
|
+
import React, { useMemo } from 'react';
|
|
3
|
+
import { PlusOutlined, UploadOutlined } from '@ant-design/icons';
|
|
4
|
+
import { Button } from 'antd';
|
|
5
5
|
|
|
6
|
-
var Btn = function (_ref) {
|
|
6
|
+
var Btn = (function (_ref) {
|
|
7
7
|
var value = _ref.value,
|
|
8
8
|
_ref$maxCount = _ref.maxCount,
|
|
9
9
|
maxCount = _ref$maxCount === void 0 ? 1 : _ref$maxCount,
|
|
10
10
|
listType = _ref.listType;
|
|
11
11
|
var len = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
12
|
-
var text = useMemo(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
},
|
|
19
|
-
[len, maxCount]
|
|
20
|
-
);
|
|
12
|
+
var text = useMemo(function () {
|
|
13
|
+
if (len === maxCount) {
|
|
14
|
+
return "更新";
|
|
15
|
+
}
|
|
16
|
+
return "上传";
|
|
17
|
+
}, [len, maxCount]);
|
|
21
18
|
if (listType === "picture-card") {
|
|
22
|
-
return /*#__PURE__*/ React.createElement(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"div",
|
|
28
|
-
{
|
|
29
|
-
style: {
|
|
30
|
-
marginTop: 8,
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
text
|
|
34
|
-
)
|
|
35
|
-
);
|
|
19
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("div", {
|
|
20
|
+
style: {
|
|
21
|
+
marginTop: 8
|
|
22
|
+
}
|
|
23
|
+
}, text));
|
|
36
24
|
}
|
|
37
|
-
return /*#__PURE__*/
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
},
|
|
42
|
-
text
|
|
43
|
-
);
|
|
44
|
-
};
|
|
25
|
+
return /*#__PURE__*/React.createElement(Button, {
|
|
26
|
+
icon: /*#__PURE__*/React.createElement(UploadOutlined, null)
|
|
27
|
+
}, text);
|
|
28
|
+
});
|
|
45
29
|
|
|
46
30
|
export { Btn as default };
|
|
47
31
|
// powered by hdj
|
|
@@ -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,48 +1,40 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
|
-
import React from
|
|
3
|
-
import { MediaTypeEnum } from
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { MediaTypeEnum } from '../enums.js';
|
|
4
4
|
|
|
5
|
-
var TypeEle = function (_ref) {
|
|
5
|
+
var TypeEle = (function (_ref) {
|
|
6
6
|
var mediaType = _ref.mediaType,
|
|
7
7
|
url = _ref.url,
|
|
8
8
|
onReady = _ref.onReady,
|
|
9
9
|
onError = _ref.onError;
|
|
10
10
|
if (mediaType === MediaTypeEnum.video) {
|
|
11
|
-
return /*#__PURE__*/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
/*#__PURE__*/ React.createElement("source", {
|
|
21
|
-
src: url,
|
|
22
|
-
})
|
|
23
|
-
);
|
|
11
|
+
return /*#__PURE__*/React.createElement("video", {
|
|
12
|
+
autoPlay: true,
|
|
13
|
+
width: "100%",
|
|
14
|
+
controls: true,
|
|
15
|
+
onPlay: onReady,
|
|
16
|
+
onError: onError
|
|
17
|
+
}, /*#__PURE__*/React.createElement("source", {
|
|
18
|
+
src: url
|
|
19
|
+
}));
|
|
24
20
|
}
|
|
25
21
|
if (mediaType === MediaTypeEnum.audio) {
|
|
26
|
-
return /*#__PURE__*/
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
/*#__PURE__*/ React.createElement("source", {
|
|
35
|
-
src: url,
|
|
36
|
-
})
|
|
37
|
-
);
|
|
22
|
+
return /*#__PURE__*/React.createElement("audio", {
|
|
23
|
+
autoPlay: true,
|
|
24
|
+
controls: true,
|
|
25
|
+
onPlay: onReady,
|
|
26
|
+
onError: onError
|
|
27
|
+
}, /*#__PURE__*/React.createElement("source", {
|
|
28
|
+
src: url
|
|
29
|
+
}));
|
|
38
30
|
}
|
|
39
|
-
return /*#__PURE__*/
|
|
31
|
+
return /*#__PURE__*/React.createElement("img", {
|
|
40
32
|
src: url,
|
|
41
33
|
width: "100%",
|
|
42
34
|
onLoad: onReady,
|
|
43
|
-
onError: onError
|
|
35
|
+
onError: onError
|
|
44
36
|
});
|
|
45
|
-
};
|
|
37
|
+
});
|
|
46
38
|
|
|
47
39
|
export { TypeEle as default };
|
|
48
40
|
// powered by hdj
|
|
@@ -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,13 +1,13 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
|
-
import React, { useMemo } from
|
|
3
|
-
import _indexOfInstanceProperty from
|
|
4
|
-
import { getFileExt } from
|
|
5
|
-
import TypeEle from
|
|
6
|
-
import { MediaTypeEnum } from
|
|
2
|
+
import React, { useMemo } from 'react';
|
|
3
|
+
import _indexOfInstanceProperty from '@babel/runtime-corejs3/core-js/instance/index-of';
|
|
4
|
+
import { getFileExt } from '../util.js';
|
|
5
|
+
import TypeEle from './TypeEle.js';
|
|
6
|
+
import { MediaTypeEnum } from '../enums.js';
|
|
7
7
|
|
|
8
8
|
var videoType = ["MP4"];
|
|
9
9
|
var audioType = ["MP3"];
|
|
10
|
-
var MediaTypeEle = function (_ref) {
|
|
10
|
+
var MediaTypeEle = (function (_ref) {
|
|
11
11
|
var file = _ref.file,
|
|
12
12
|
onReady = _ref.onReady,
|
|
13
13
|
onError = _ref.onError;
|
|
@@ -15,25 +15,22 @@ var MediaTypeEle = function (_ref) {
|
|
|
15
15
|
return null;
|
|
16
16
|
}
|
|
17
17
|
var name = getFileExt(file);
|
|
18
|
-
var mediaType = useMemo(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
[name]
|
|
29
|
-
);
|
|
30
|
-
return /*#__PURE__*/ React.createElement(TypeEle, {
|
|
18
|
+
var mediaType = useMemo(function () {
|
|
19
|
+
if (_indexOfInstanceProperty(videoType).call(videoType, name) !== -1) {
|
|
20
|
+
return MediaTypeEnum.video;
|
|
21
|
+
}
|
|
22
|
+
if (_indexOfInstanceProperty(audioType).call(audioType, name) !== -1) {
|
|
23
|
+
return MediaTypeEnum.audio;
|
|
24
|
+
}
|
|
25
|
+
return MediaTypeEnum.img;
|
|
26
|
+
}, [name]);
|
|
27
|
+
return /*#__PURE__*/React.createElement(TypeEle, {
|
|
31
28
|
onError: onError,
|
|
32
29
|
onReady: onReady,
|
|
33
30
|
mediaType: mediaType,
|
|
34
|
-
url: file.response.url
|
|
31
|
+
url: file.response.url
|
|
35
32
|
});
|
|
36
|
-
};
|
|
33
|
+
});
|
|
37
34
|
|
|
38
35
|
export { MediaTypeEle as default };
|
|
39
36
|
// powered by hdj
|
|
@@ -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,25 +1,21 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
|
-
import React from
|
|
3
|
-
import { Modal } from
|
|
4
|
-
import MediaTypeEle from
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Modal } from 'antd';
|
|
4
|
+
import MediaTypeEle from '../MediaTypeEle/index.js';
|
|
5
5
|
|
|
6
|
-
var Preview = function (_ref) {
|
|
6
|
+
var Preview = (function (_ref) {
|
|
7
7
|
var visible = _ref.visible,
|
|
8
8
|
file = _ref.file,
|
|
9
9
|
onCancel = _ref.onCancel;
|
|
10
|
-
return /*#__PURE__*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
file: file,
|
|
20
|
-
})
|
|
21
|
-
);
|
|
22
|
-
};
|
|
10
|
+
return /*#__PURE__*/React.createElement(Modal, {
|
|
11
|
+
footer: null,
|
|
12
|
+
visible: visible,
|
|
13
|
+
title: "\u9884\u89C8",
|
|
14
|
+
onCancel: onCancel
|
|
15
|
+
}, /*#__PURE__*/React.createElement(MediaTypeEle, {
|
|
16
|
+
file: file
|
|
17
|
+
}));
|
|
18
|
+
});
|
|
23
19
|
|
|
24
20
|
export { Preview as default };
|
|
25
21
|
// powered by hdj
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { IUrlUploadProps } from "../modal";
|
|
3
|
-
declare const _default: ({
|
|
4
|
-
placeholder,
|
|
5
|
-
value,
|
|
6
|
-
onChange,
|
|
7
|
-
mediaType,
|
|
8
|
-
...props
|
|
9
|
-
}: IUrlUploadProps) => JSX.Element;
|
|
3
|
+
declare const _default: ({ placeholder, value, onChange, mediaType, ...props }: IUrlUploadProps) => JSX.Element;
|
|
10
4
|
export default _default;
|
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
|
-
import React, { useState, useRef } from
|
|
3
|
-
import _extends from
|
|
4
|
-
import _toConsumableArray from
|
|
5
|
-
import _slicedToArray from
|
|
6
|
-
import _objectWithoutProperties from
|
|
7
|
-
import _trimInstanceProperty from
|
|
8
|
-
import _mapInstanceProperty from
|
|
9
|
-
import _Array$from from
|
|
10
|
-
import { Space, message } from
|
|
11
|
-
import Input from
|
|
12
|
-
import HUpload from
|
|
13
|
-
import TypeEle from
|
|
2
|
+
import React, { useState, useRef } from 'react';
|
|
3
|
+
import _extends from '@babel/runtime-corejs3/helpers/extends';
|
|
4
|
+
import _toConsumableArray from '@babel/runtime-corejs3/helpers/toConsumableArray';
|
|
5
|
+
import _slicedToArray from '@babel/runtime-corejs3/helpers/slicedToArray';
|
|
6
|
+
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
|
|
7
|
+
import _trimInstanceProperty from '@babel/runtime-corejs3/core-js/instance/trim';
|
|
8
|
+
import _mapInstanceProperty from '@babel/runtime-corejs3/core-js/instance/map';
|
|
9
|
+
import _Array$from from '@babel/runtime-corejs3/core-js/array/from';
|
|
10
|
+
import { Space, message } from 'antd';
|
|
11
|
+
import Input from 'antd/es/input/Input';
|
|
12
|
+
import HUpload from '../index.js';
|
|
13
|
+
import TypeEle from '../MediaTypeEle/TypeEle.js';
|
|
14
14
|
|
|
15
15
|
var _excluded = ["placeholder", "value", "onChange", "mediaType"];
|
|
16
|
-
var HUrlUpload = function (_ref) {
|
|
16
|
+
var HUrlUpload = (function (_ref) {
|
|
17
17
|
var _ref$placeholder = _ref.placeholder,
|
|
18
|
-
placeholder =
|
|
19
|
-
_ref$placeholder === void 0 ? "请输入文件地址" : _ref$placeholder,
|
|
18
|
+
placeholder = _ref$placeholder === void 0 ? "请输入文件地址" : _ref$placeholder,
|
|
20
19
|
_ref$value = _ref.value,
|
|
21
20
|
value = _ref$value === void 0 ? [] : _ref$value,
|
|
22
21
|
onChange = _ref.onChange,
|
|
@@ -40,8 +39,8 @@ var HUrlUpload = function (_ref) {
|
|
|
40
39
|
fileName: url,
|
|
41
40
|
thumbUrl: url,
|
|
42
41
|
response: {
|
|
43
|
-
url: url
|
|
44
|
-
}
|
|
42
|
+
url: url
|
|
43
|
+
}
|
|
45
44
|
});
|
|
46
45
|
onChange === null || onChange === void 0 ? void 0 : onChange(newFileList);
|
|
47
46
|
setUrl("");
|
|
@@ -54,9 +53,7 @@ var HUrlUpload = function (_ref) {
|
|
|
54
53
|
};
|
|
55
54
|
var onBlur = function onBlur(e) {
|
|
56
55
|
var _context;
|
|
57
|
-
if (
|
|
58
|
-
_trimInstanceProperty((_context = e.target.value)).call(_context) === ""
|
|
59
|
-
) {
|
|
56
|
+
if (_trimInstanceProperty(_context = e.target.value).call(_context) === "") {
|
|
60
57
|
return;
|
|
61
58
|
}
|
|
62
59
|
setLoad(true);
|
|
@@ -68,9 +65,7 @@ var HUrlUpload = function (_ref) {
|
|
|
68
65
|
return;
|
|
69
66
|
}
|
|
70
67
|
e.preventDefault();
|
|
71
|
-
var newFileList = _mapInstanceProperty(
|
|
72
|
-
(_context2 = _Array$from(files))
|
|
73
|
-
).call(_context2, function (item) {
|
|
68
|
+
var newFileList = _mapInstanceProperty(_context2 = _Array$from(files)).call(_context2, function (item) {
|
|
74
69
|
var name = item.name,
|
|
75
70
|
size = item.size,
|
|
76
71
|
type = item.type;
|
|
@@ -80,61 +75,45 @@ var HUrlUpload = function (_ref) {
|
|
|
80
75
|
status: "uploading",
|
|
81
76
|
uid: new Date().valueOf().toString(),
|
|
82
77
|
originFileObj: item,
|
|
83
|
-
type: type
|
|
78
|
+
type: type
|
|
84
79
|
};
|
|
85
80
|
});
|
|
86
|
-
(_ref$current = ref.current) === null || _ref$current === void 0
|
|
87
|
-
|
|
88
|
-
:
|
|
89
|
-
|
|
90
|
-
file: newFileList[0],
|
|
91
|
-
});
|
|
81
|
+
(_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.change({
|
|
82
|
+
fileList: newFileList,
|
|
83
|
+
file: newFileList[0]
|
|
84
|
+
});
|
|
92
85
|
setUrl("");
|
|
93
86
|
setLoad(false);
|
|
94
87
|
};
|
|
95
|
-
return /*#__PURE__*/
|
|
96
|
-
|
|
97
|
-
{
|
|
98
|
-
|
|
99
|
-
style: {
|
|
100
|
-
width: "100%",
|
|
101
|
-
},
|
|
102
|
-
size: "middle",
|
|
88
|
+
return /*#__PURE__*/React.createElement(Space, {
|
|
89
|
+
direction: "vertical",
|
|
90
|
+
style: {
|
|
91
|
+
width: "100%"
|
|
103
92
|
},
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
},
|
|
129
|
-
/*#__PURE__*/ React.createElement(TypeEle, {
|
|
130
|
-
url: url,
|
|
131
|
-
mediaType: mediaType,
|
|
132
|
-
onReady: onReady,
|
|
133
|
-
onError: onError,
|
|
134
|
-
})
|
|
135
|
-
)
|
|
136
|
-
);
|
|
137
|
-
};
|
|
93
|
+
size: "middle"
|
|
94
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
95
|
+
placeholder: placeholder,
|
|
96
|
+
onBlur: onBlur,
|
|
97
|
+
value: url,
|
|
98
|
+
onPaste: onPaste,
|
|
99
|
+
onChange: function onChange(e) {
|
|
100
|
+
setUrl(e.target.value);
|
|
101
|
+
}
|
|
102
|
+
}), /*#__PURE__*/React.createElement(HUpload, _extends({}, props, {
|
|
103
|
+
ref: ref,
|
|
104
|
+
value: value,
|
|
105
|
+
onChange: onChange
|
|
106
|
+
})), load && /*#__PURE__*/React.createElement("div", {
|
|
107
|
+
style: {
|
|
108
|
+
display: "none"
|
|
109
|
+
}
|
|
110
|
+
}, /*#__PURE__*/React.createElement(TypeEle, {
|
|
111
|
+
url: url,
|
|
112
|
+
mediaType: mediaType,
|
|
113
|
+
onReady: onReady,
|
|
114
|
+
onError: onError
|
|
115
|
+
})));
|
|
116
|
+
});
|
|
138
117
|
|
|
139
118
|
export { HUrlUpload as default };
|
|
140
119
|
// powered by hdj
|
package/es/Upload/enums.d.ts
CHANGED
package/es/Upload/enums.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
2
|
var MediaTypeEnum;
|
|
3
3
|
(function (MediaTypeEnum) {
|
|
4
|
-
MediaTypeEnum[
|
|
5
|
-
MediaTypeEnum[
|
|
6
|
-
MediaTypeEnum[
|
|
4
|
+
MediaTypeEnum[MediaTypeEnum["video"] = 0] = "video";
|
|
5
|
+
MediaTypeEnum[MediaTypeEnum["audio"] = 1] = "audio";
|
|
6
|
+
MediaTypeEnum[MediaTypeEnum["img"] = 2] = "img";
|
|
7
7
|
})(MediaTypeEnum || (MediaTypeEnum = {}));
|
|
8
8
|
|
|
9
9
|
export { MediaTypeEnum };
|
|
@@ -1,10 +1,3 @@
|
|
|
1
1
|
import type { IUpLoadProps } from "../modal";
|
|
2
2
|
import type { UploadChangeParam, UploadFile } from "antd/lib/upload/interface";
|
|
3
|
-
export declare const useChange: ({
|
|
4
|
-
value,
|
|
5
|
-
onChange,
|
|
6
|
-
maxCount,
|
|
7
|
-
request,
|
|
8
|
-
exFiles,
|
|
9
|
-
maxSize,
|
|
10
|
-
}: IUpLoadProps) => (info: UploadChangeParam<UploadFile>) => void;
|
|
3
|
+
export declare const useChange: ({ value, onChange, maxCount, request, exFiles, maxSize, }: IUpLoadProps) => (info: UploadChangeParam<UploadFile>) => void;
|