@hw-component/form 0.0.1-bate → 0.0.1-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/CheckboxGroup/CheckBox/index.js +24 -16
- package/es/CheckboxGroup/hooks.d.ts +9 -3
- package/es/CheckboxGroup/hooks.js +115 -64
- package/es/CheckboxGroup/index.d.ts +6 -1
- package/es/CheckboxGroup/index.js +117 -56
- package/es/CheckboxGroup/modal.d.ts +9 -8
- package/es/Form/Context/FormConfigProvider.js +64 -19
- package/es/Form/Context/index.d.ts +4 -1
- package/es/Form/Context/index.js +3 -3
- package/es/Form/FormItem/BasicItem.js +80 -42
- package/es/Form/FormItem/Helper.d.ts +1 -1
- package/es/Form/FormItem/Helper.js +17 -9
- package/es/Form/FormItem/RegularFormItem.js +11 -8
- package/es/Form/FormItem/UpFormItem.d.ts +6 -1
- package/es/Form/FormItem/UpFormItem.js +27 -17
- package/es/Form/FormItem/hooks.d.ts +21 -4
- package/es/Form/FormItem/hooks.js +12 -9
- package/es/Form/FormItem/index.js +5 -5
- package/es/Form/HFormConnect.d.ts +9 -1
- package/es/Form/HFormConnect.js +94 -26
- package/es/Form/InitSet.d.ts +1 -1
- package/es/Form/InitSet.js +5 -5
- package/es/Form/Label.d.ts +4 -4
- package/es/Form/Label.js +36 -19
- package/es/Form/config.d.ts +100 -22
- package/es/Form/config.js +19 -19
- package/es/Form/hooks/index.d.ts +12 -5
- package/es/Form/hooks/index.js +65 -49
- package/es/Form/hooks/useHForm.js +233 -95
- package/es/Form/hooks/useInitConfigData.d.ts +4 -1
- package/es/Form/hooks/useInitConfigData.js +143 -61
- package/es/Form/index.d.ts +11 -1
- package/es/Form/index.js +71 -40
- package/es/Form/modal.d.ts +92 -51
- package/es/Input/ButtonInput.js +73 -51
- package/es/Input/InputNumber.js +21 -12
- package/es/Input/SelectInput.d.ts +16 -4
- package/es/Input/SelectInput.js +113 -56
- package/es/Input/defaultConfig.d.ts +3 -3
- package/es/Input/defaultConfig.js +2 -2
- package/es/Input/index.js +7 -7
- package/es/Input/modal.d.ts +15 -11
- package/es/PageHandler/ErrorComponent.js +47 -25
- package/es/PageHandler/LoadingComponent.js +17 -13
- package/es/PageHandler/index.js +7 -7
- package/es/PageHandler/modal.d.ts +4 -4
- package/es/RadioGroup/index.d.ts +12 -5
- package/es/RadioGroup/index.js +46 -33
- package/es/Select/components/AllSelect.d.ts +1 -1
- package/es/Select/components/AllSelect.js +40 -18
- package/es/Select/components/CheckBoxOption.d.ts +6 -3
- package/es/Select/components/CheckBoxOption.js +12 -7
- package/es/Select/components/DropdownComponent.d.ts +4 -4
- package/es/Select/components/DropdownComponent.js +30 -17
- package/es/Select/components/NoFindItem.d.ts +1 -1
- package/es/Select/components/NoFindItem.js +11 -7
- package/es/Select/components/NotFoundContent.d.ts +2 -2
- package/es/Select/components/NotFoundContent.js +49 -27
- package/es/Select/defaultConfig.d.ts +1 -1
- package/es/Select/defaultConfig.js +20 -16
- package/es/Select/hooks/changeHooks.d.ts +2 -2
- package/es/Select/hooks/changeHooks.js +147 -71
- package/es/Select/hooks/norHooks.d.ts +27 -9
- package/es/Select/hooks/norHooks.js +51 -39
- package/es/Select/index.d.ts +22 -1
- package/es/Select/index.js +124 -65
- package/es/Select/modal.d.ts +15 -15
- package/es/Select/utils.js +60 -15
- package/es/Submit/index.d.ts +9 -3
- package/es/Submit/index.js +18 -13
- package/es/Switch/index.d.ts +4 -4
- package/es/Switch/index.js +46 -20
- package/es/TDPicker/RangePicker.d.ts +8 -3
- package/es/TDPicker/RangePicker.js +138 -62
- package/es/TDPicker/TimePicker.d.ts +6 -1
- package/es/TDPicker/TimePicker.js +19 -13
- package/es/TDPicker/hooks.d.ts +42 -22
- package/es/TDPicker/hooks.js +106 -72
- package/es/TDPicker/index.d.ts +7 -1
- package/es/TDPicker/index.js +20 -14
- package/es/TDPicker/modal.d.ts +21 -16
- package/es/Upload/Btn.d.ts +5 -1
- package/es/Upload/Btn.js +35 -19
- package/es/Upload/MediaTypeEle/TypeEle.d.ts +10 -5
- package/es/Upload/MediaTypeEle/TypeEle.js +31 -23
- package/es/Upload/MediaTypeEle/index.d.ts +5 -1
- package/es/Upload/MediaTypeEle/index.js +21 -18
- package/es/Upload/Preview/index.d.ts +5 -1
- package/es/Upload/Preview/index.js +17 -13
- package/es/Upload/UrlUpload/index.d.ts +7 -1
- package/es/Upload/UrlUpload/index.js +72 -51
- package/es/Upload/enums.d.ts +3 -3
- package/es/Upload/enums.js +3 -3
- package/es/Upload/hooks/change.d.ts +8 -1
- package/es/Upload/hooks/change.js +115 -58
- package/es/Upload/hooks/customRequest.d.ts +5 -1
- package/es/Upload/hooks/customRequest.js +63 -46
- package/es/Upload/hooks/propsMaker.d.ts +5 -1
- package/es/Upload/hooks/propsMaker.js +52 -13
- package/es/Upload/index.d.ts +3 -1
- package/es/Upload/index.js +131 -61
- package/es/Upload/modal.d.ts +17 -15
- package/es/Upload/util.d.ts +8 -2
- package/es/Upload/util.js +15 -7
- package/es/config.js +34 -31
- package/es/hooks/index.d.ts +14 -7
- package/es/hooks/index.js +124 -49
- package/es/index.d.ts +98 -16
- package/es/index.js +22 -5
- package/es/modal.d.ts +6 -6
- package/lib/CheckboxGroup/CheckBox/index.js +26 -18
- package/lib/CheckboxGroup/hooks.d.ts +9 -3
- package/lib/CheckboxGroup/hooks.js +116 -65
- package/lib/CheckboxGroup/index.d.ts +6 -1
- package/lib/CheckboxGroup/index.js +119 -58
- package/lib/CheckboxGroup/modal.d.ts +9 -8
- package/lib/Form/Context/FormConfigProvider.js +66 -21
- package/lib/Form/Context/index.d.ts +4 -1
- package/lib/Form/Context/index.js +4 -4
- package/lib/Form/FormItem/BasicItem.js +82 -44
- package/lib/Form/FormItem/Helper.d.ts +1 -1
- package/lib/Form/FormItem/Helper.js +19 -11
- package/lib/Form/FormItem/RegularFormItem.js +13 -10
- package/lib/Form/FormItem/UpFormItem.d.ts +6 -1
- package/lib/Form/FormItem/UpFormItem.js +29 -19
- package/lib/Form/FormItem/hooks.d.ts +21 -4
- package/lib/Form/FormItem/hooks.js +13 -10
- package/lib/Form/FormItem/index.js +7 -7
- package/lib/Form/HFormConnect.d.ts +9 -1
- package/lib/Form/HFormConnect.js +96 -28
- package/lib/Form/InitSet.d.ts +1 -1
- package/lib/Form/InitSet.js +7 -7
- package/lib/Form/Label.d.ts +4 -4
- package/lib/Form/Label.js +41 -21
- package/lib/Form/config.d.ts +100 -22
- package/lib/Form/config.js +21 -21
- package/lib/Form/hooks/index.d.ts +12 -5
- package/lib/Form/hooks/index.js +66 -50
- package/lib/Form/hooks/useHForm.js +235 -97
- package/lib/Form/hooks/useInitConfigData.d.ts +4 -1
- package/lib/Form/hooks/useInitConfigData.js +144 -63
- package/lib/Form/index.d.ts +11 -1
- package/lib/Form/index.js +73 -42
- package/lib/Form/modal.d.ts +92 -51
- package/lib/Input/ButtonInput.js +75 -53
- package/lib/Input/InputNumber.js +23 -14
- package/lib/Input/SelectInput.d.ts +16 -4
- package/lib/Input/SelectInput.js +125 -60
- package/lib/Input/defaultConfig.d.ts +3 -3
- package/lib/Input/defaultConfig.js +3 -3
- package/lib/Input/index.js +9 -9
- package/lib/Input/modal.d.ts +15 -11
- package/lib/PageHandler/ErrorComponent.js +49 -27
- package/lib/PageHandler/LoadingComponent.js +19 -15
- package/lib/PageHandler/index.js +9 -9
- package/lib/PageHandler/modal.d.ts +4 -4
- package/lib/RadioGroup/index.d.ts +12 -5
- package/lib/RadioGroup/index.js +48 -35
- package/lib/Select/components/AllSelect.d.ts +1 -1
- package/lib/Select/components/AllSelect.js +42 -20
- package/lib/Select/components/CheckBoxOption.d.ts +6 -3
- package/lib/Select/components/CheckBoxOption.js +14 -9
- package/lib/Select/components/DropdownComponent.d.ts +4 -4
- package/lib/Select/components/DropdownComponent.js +32 -19
- package/lib/Select/components/NoFindItem.d.ts +1 -1
- package/lib/Select/components/NoFindItem.js +13 -9
- package/lib/Select/components/NotFoundContent.d.ts +2 -2
- package/lib/Select/components/NotFoundContent.js +51 -29
- package/lib/Select/defaultConfig.d.ts +1 -1
- package/lib/Select/defaultConfig.js +21 -17
- package/lib/Select/hooks/changeHooks.d.ts +2 -2
- package/lib/Select/hooks/changeHooks.js +148 -72
- package/lib/Select/hooks/norHooks.d.ts +27 -9
- package/lib/Select/hooks/norHooks.js +52 -40
- package/lib/Select/index.d.ts +22 -1
- package/lib/Select/index.js +128 -67
- package/lib/Select/modal.d.ts +15 -15
- package/lib/Select/utils.js +61 -16
- package/lib/Submit/index.d.ts +9 -3
- package/lib/Submit/index.js +20 -15
- package/lib/Switch/index.d.ts +4 -4
- package/lib/Switch/index.js +48 -22
- package/lib/TDPicker/RangePicker.d.ts +8 -3
- package/lib/TDPicker/RangePicker.js +136 -64
- package/lib/TDPicker/TimePicker.d.ts +6 -1
- package/lib/TDPicker/TimePicker.js +21 -15
- package/lib/TDPicker/hooks.d.ts +42 -22
- package/lib/TDPicker/hooks.js +98 -72
- package/lib/TDPicker/index.d.ts +7 -1
- package/lib/TDPicker/index.js +22 -16
- package/lib/TDPicker/modal.d.ts +21 -16
- package/lib/Upload/Btn.d.ts +5 -1
- package/lib/Upload/Btn.js +37 -21
- package/lib/Upload/MediaTypeEle/TypeEle.d.ts +10 -5
- package/lib/Upload/MediaTypeEle/TypeEle.js +33 -25
- package/lib/Upload/MediaTypeEle/index.d.ts +5 -1
- package/lib/Upload/MediaTypeEle/index.js +23 -20
- package/lib/Upload/Preview/index.d.ts +5 -1
- package/lib/Upload/Preview/index.js +19 -15
- package/lib/Upload/UrlUpload/index.d.ts +7 -1
- package/lib/Upload/UrlUpload/index.js +74 -53
- package/lib/Upload/enums.d.ts +3 -3
- package/lib/Upload/enums.js +4 -4
- package/lib/Upload/hooks/change.d.ts +8 -1
- package/lib/Upload/hooks/change.js +116 -59
- package/lib/Upload/hooks/customRequest.d.ts +5 -1
- package/lib/Upload/hooks/customRequest.js +64 -47
- package/lib/Upload/hooks/propsMaker.d.ts +5 -1
- package/lib/Upload/hooks/propsMaker.js +55 -15
- package/lib/Upload/index.d.ts +3 -1
- package/lib/Upload/index.js +133 -63
- package/lib/Upload/modal.d.ts +17 -15
- package/lib/Upload/util.d.ts +8 -2
- package/lib/Upload/util.js +16 -8
- package/lib/config.js +35 -32
- package/lib/hooks/index.d.ts +14 -7
- package/lib/hooks/index.js +125 -50
- package/lib/index.d.ts +98 -16
- package/lib/index.js +5 -5
- package/lib/modal.d.ts +6 -6
- package/package.json +2 -2
- package/src/components/CheckboxGroup/index.tsx +2 -2
- package/src/components/Form/FormItem/Helper.tsx +3 -4
- package/src/components/Form/HFormConnect.tsx +6 -2
- package/src/components/Form/hooks/useHForm.ts +59 -10
- package/src/components/Form/modal.ts +12 -8
- package/src/components/TDPicker/RangePicker.tsx +7 -5
- package/src/components/TDPicker/modal.ts +1 -0
- package/src/pages/Form/index.tsx +2 -2
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 =
|
|
12
|
+
var HDatePicker = function (_ref) {
|
|
13
13
|
var value = _ref.value,
|
|
14
14
|
onChange = _ref.onChange,
|
|
15
15
|
_ref$showTime = _ref.showTime,
|
|
@@ -19,18 +19,24 @@ 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__*/React.createElement(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
return /*#__PURE__*/ React.createElement(
|
|
29
|
+
antd.DatePicker,
|
|
30
|
+
_extends(
|
|
31
|
+
{
|
|
32
|
+
value: timeVal,
|
|
33
|
+
onChange: change,
|
|
34
|
+
showTime: showTime,
|
|
35
|
+
},
|
|
36
|
+
props
|
|
37
|
+
)
|
|
38
|
+
);
|
|
39
|
+
};
|
|
34
40
|
|
|
35
41
|
exports.default = HDatePicker;
|
|
36
42
|
// powered by h
|
package/lib/TDPicker/modal.d.ts
CHANGED
|
@@ -6,23 +6,28 @@ 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
|
-
|
|
9
|
+
export interface HDatePickerProps
|
|
10
|
+
extends Omit<DatePickerProps, "onChange" | "format" | "ranges"> {
|
|
11
|
+
onChange?: (time?: Moment | string | number) => void;
|
|
12
|
+
format?: string;
|
|
13
|
+
showTime?: boolean | SharedTimeProps<Moment>;
|
|
13
14
|
}
|
|
14
|
-
export interface HRangePickerProps
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
export interface HRangePickerProps
|
|
16
|
+
extends Omit<RangePickerProps, "onChange" | "format" | "ranges" | "value"> {
|
|
17
|
+
value?: [any, any] | Record<string, any>;
|
|
18
|
+
onChange?: (val: any) => void;
|
|
19
|
+
showTime?:
|
|
20
|
+
| boolean
|
|
21
|
+
| {
|
|
18
22
|
defaultValue?: Moment[];
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
};
|
|
24
|
+
format?: string;
|
|
25
|
+
valueMap?: DateRangePickerValueMapModal;
|
|
26
|
+
ranges?: RangePickerProps["ranges"] | boolean;
|
|
27
|
+
addFormat?: (config: Record<string, addFormatItemModal>) => void;
|
|
24
28
|
}
|
|
25
|
-
export interface HTimePickerProps
|
|
26
|
-
|
|
27
|
-
|
|
29
|
+
export interface HTimePickerProps
|
|
30
|
+
extends Omit<TimePickerProps, "onChange" | "format" | "ranges"> {
|
|
31
|
+
onChange?: (time?: Moment | string | number) => void;
|
|
32
|
+
format?: DurationInputArg2 | string;
|
|
28
33
|
}
|
package/lib/Upload/Btn.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { IUpLoadProps } from "./modal";
|
|
3
|
-
declare const _default: ({
|
|
3
|
+
declare const _default: ({
|
|
4
|
+
value,
|
|
5
|
+
maxCount,
|
|
6
|
+
listType,
|
|
7
|
+
}: IUpLoadProps) => JSX.Element;
|
|
4
8
|
export default _default;
|
package/lib/Upload/Btn.js
CHANGED
|
@@ -1,34 +1,50 @@
|
|
|
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 =
|
|
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
|
-
return "上传";
|
|
20
|
-
}, [len, maxCount]);
|
|
21
|
-
if (listType === "picture-card") {
|
|
22
|
-
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(icons.PlusOutlined, null), /*#__PURE__*/React.createElement("div", {
|
|
23
|
-
style: {
|
|
24
|
-
marginTop: 8
|
|
15
|
+
var text = React.useMemo(
|
|
16
|
+
function () {
|
|
17
|
+
if (len === maxCount) {
|
|
18
|
+
return "更新";
|
|
25
19
|
}
|
|
26
|
-
|
|
20
|
+
return "上传";
|
|
21
|
+
},
|
|
22
|
+
[len, maxCount]
|
|
23
|
+
);
|
|
24
|
+
if (listType === "picture-card") {
|
|
25
|
+
return /*#__PURE__*/ React.createElement(
|
|
26
|
+
"div",
|
|
27
|
+
null,
|
|
28
|
+
/*#__PURE__*/ React.createElement(icons.PlusOutlined, null),
|
|
29
|
+
/*#__PURE__*/ React.createElement(
|
|
30
|
+
"div",
|
|
31
|
+
{
|
|
32
|
+
style: {
|
|
33
|
+
marginTop: 8,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
text
|
|
37
|
+
)
|
|
38
|
+
);
|
|
27
39
|
}
|
|
28
|
-
return /*#__PURE__*/React.createElement(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
40
|
+
return /*#__PURE__*/ React.createElement(
|
|
41
|
+
antd.Button,
|
|
42
|
+
{
|
|
43
|
+
icon: /*#__PURE__*/ React.createElement(icons.UploadOutlined, null),
|
|
44
|
+
},
|
|
45
|
+
text
|
|
46
|
+
);
|
|
47
|
+
};
|
|
32
48
|
|
|
33
49
|
exports.default = Btn;
|
|
34
50
|
// powered by h
|
|
@@ -1,10 +1,15 @@
|
|
|
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: ({
|
|
9
|
+
declare const _default: ({
|
|
10
|
+
mediaType,
|
|
11
|
+
url,
|
|
12
|
+
onReady,
|
|
13
|
+
onError,
|
|
14
|
+
}: TypeEleProps) => JSX.Element;
|
|
10
15
|
export default _default;
|
|
@@ -1,43 +1,51 @@
|
|
|
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 =
|
|
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__*/React.createElement(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
14
|
+
return /*#__PURE__*/ React.createElement(
|
|
15
|
+
"video",
|
|
16
|
+
{
|
|
17
|
+
autoPlay: true,
|
|
18
|
+
width: "100%",
|
|
19
|
+
controls: true,
|
|
20
|
+
onPlay: onReady,
|
|
21
|
+
onError: onError,
|
|
22
|
+
},
|
|
23
|
+
/*#__PURE__*/ React.createElement("source", {
|
|
24
|
+
src: url,
|
|
25
|
+
})
|
|
26
|
+
);
|
|
23
27
|
}
|
|
24
28
|
if (mediaType === enums.MediaTypeEnum.audio) {
|
|
25
|
-
return /*#__PURE__*/React.createElement(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
return /*#__PURE__*/ React.createElement(
|
|
30
|
+
"audio",
|
|
31
|
+
{
|
|
32
|
+
autoPlay: true,
|
|
33
|
+
controls: true,
|
|
34
|
+
onPlay: onReady,
|
|
35
|
+
onError: onError,
|
|
36
|
+
},
|
|
37
|
+
/*#__PURE__*/ React.createElement("source", {
|
|
38
|
+
src: url,
|
|
39
|
+
})
|
|
40
|
+
);
|
|
33
41
|
}
|
|
34
|
-
return /*#__PURE__*/React.createElement("img", {
|
|
42
|
+
return /*#__PURE__*/ React.createElement("img", {
|
|
35
43
|
src: url,
|
|
36
44
|
width: "100%",
|
|
37
45
|
onLoad: onReady,
|
|
38
|
-
onError: onError
|
|
46
|
+
onError: onError,
|
|
39
47
|
});
|
|
40
|
-
}
|
|
48
|
+
};
|
|
41
49
|
|
|
42
50
|
exports.default = TypeEle;
|
|
43
51
|
// powered by h
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { IMediaTypeEleProps } from "../modal";
|
|
3
|
-
declare const _default: ({
|
|
3
|
+
declare const _default: ({
|
|
4
|
+
file,
|
|
5
|
+
onReady,
|
|
6
|
+
onError,
|
|
7
|
+
}: IMediaTypeEleProps) => JSX.Element | null;
|
|
4
8
|
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 =
|
|
13
|
+
var MediaTypeEle = function (_ref) {
|
|
14
14
|
var file = _ref.file,
|
|
15
15
|
onReady = _ref.onReady,
|
|
16
16
|
onError = _ref.onError;
|
|
@@ -18,22 +18,25 @@ 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
|
-
|
|
21
|
+
var mediaType = React.useMemo(
|
|
22
|
+
function () {
|
|
23
|
+
if (_indexOfInstanceProperty(videoType).call(videoType, name) !== -1) {
|
|
24
|
+
return enums.MediaTypeEnum.video;
|
|
25
|
+
}
|
|
26
|
+
if (_indexOfInstanceProperty(audioType).call(audioType, name) !== -1) {
|
|
27
|
+
return enums.MediaTypeEnum.audio;
|
|
28
|
+
}
|
|
29
|
+
return enums.MediaTypeEnum.img;
|
|
30
|
+
},
|
|
31
|
+
[name]
|
|
32
|
+
);
|
|
33
|
+
return /*#__PURE__*/ React.createElement(TypeEle.default, {
|
|
31
34
|
onError: onError,
|
|
32
35
|
onReady: onReady,
|
|
33
36
|
mediaType: mediaType,
|
|
34
|
-
url: file.response.url
|
|
37
|
+
url: file.response.url,
|
|
35
38
|
});
|
|
36
|
-
}
|
|
39
|
+
};
|
|
37
40
|
|
|
38
41
|
exports.default = MediaTypeEle;
|
|
39
42
|
// powered by h
|
|
@@ -2,5 +2,9 @@
|
|
|
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: ({
|
|
5
|
+
declare const _default: ({
|
|
6
|
+
visible,
|
|
7
|
+
file,
|
|
8
|
+
onCancel,
|
|
9
|
+
}: IPreviewProps) => JSX.Element;
|
|
6
10
|
export default _default;
|
|
@@ -1,24 +1,28 @@
|
|
|
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 =
|
|
9
|
+
var Preview = function (_ref) {
|
|
10
10
|
var visible = _ref.visible,
|
|
11
11
|
file = _ref.file,
|
|
12
12
|
onCancel = _ref.onCancel;
|
|
13
|
-
return /*#__PURE__*/React.createElement(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
return /*#__PURE__*/ React.createElement(
|
|
14
|
+
antd.Modal,
|
|
15
|
+
{
|
|
16
|
+
footer: null,
|
|
17
|
+
visible: visible,
|
|
18
|
+
title: "\u9884\u89C8",
|
|
19
|
+
onCancel: onCancel,
|
|
20
|
+
},
|
|
21
|
+
/*#__PURE__*/ React.createElement(index.default, {
|
|
22
|
+
file: file,
|
|
23
|
+
})
|
|
24
|
+
);
|
|
25
|
+
};
|
|
22
26
|
|
|
23
27
|
exports.default = Preview;
|
|
24
28
|
// powered by h
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { IUrlUploadProps } from "../modal";
|
|
3
|
-
declare const _default: ({
|
|
3
|
+
declare const _default: ({
|
|
4
|
+
placeholder,
|
|
5
|
+
value,
|
|
6
|
+
onChange,
|
|
7
|
+
mediaType,
|
|
8
|
+
...props
|
|
9
|
+
}: IUrlUploadProps) => JSX.Element;
|
|
4
10
|
export default _default;
|
|
@@ -1,24 +1,25 @@
|
|
|
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 _toConsumableArray = require(
|
|
8
|
-
var _slicedToArray = require(
|
|
9
|
-
var _objectWithoutProperties = require(
|
|
10
|
-
var _trimInstanceProperty = require(
|
|
11
|
-
var _mapInstanceProperty = require(
|
|
12
|
-
var _Array$from = require(
|
|
13
|
-
var antd = require(
|
|
14
|
-
var Input = require(
|
|
15
|
-
var index = require(
|
|
16
|
-
var TypeEle = require(
|
|
5
|
+
var React = require("react");
|
|
6
|
+
var _extends = require("@babel/runtime-corejs3/helpers/extends");
|
|
7
|
+
var _toConsumableArray = require("@babel/runtime-corejs3/helpers/toConsumableArray");
|
|
8
|
+
var _slicedToArray = require("@babel/runtime-corejs3/helpers/slicedToArray");
|
|
9
|
+
var _objectWithoutProperties = require("@babel/runtime-corejs3/helpers/objectWithoutProperties");
|
|
10
|
+
var _trimInstanceProperty = require("@babel/runtime-corejs3/core-js/instance/trim");
|
|
11
|
+
var _mapInstanceProperty = require("@babel/runtime-corejs3/core-js/instance/map");
|
|
12
|
+
var _Array$from = require("@babel/runtime-corejs3/core-js/array/from");
|
|
13
|
+
var antd = require("antd");
|
|
14
|
+
var Input = require("antd/es/input/Input");
|
|
15
|
+
var index = require("../index.js");
|
|
16
|
+
var TypeEle = require("../MediaTypeEle/TypeEle.js");
|
|
17
17
|
|
|
18
18
|
var _excluded = ["placeholder", "value", "onChange", "mediaType"];
|
|
19
|
-
var HUrlUpload =
|
|
19
|
+
var HUrlUpload = function (_ref) {
|
|
20
20
|
var _ref$placeholder = _ref.placeholder,
|
|
21
|
-
placeholder =
|
|
21
|
+
placeholder =
|
|
22
|
+
_ref$placeholder === void 0 ? "请输入文件地址" : _ref$placeholder,
|
|
22
23
|
_ref$value = _ref.value,
|
|
23
24
|
value = _ref$value === void 0 ? [] : _ref$value,
|
|
24
25
|
onChange = _ref.onChange,
|
|
@@ -42,8 +43,8 @@ var HUrlUpload = (function (_ref) {
|
|
|
42
43
|
fileName: url,
|
|
43
44
|
thumbUrl: url,
|
|
44
45
|
response: {
|
|
45
|
-
url: url
|
|
46
|
-
}
|
|
46
|
+
url: url,
|
|
47
|
+
},
|
|
47
48
|
});
|
|
48
49
|
onChange === null || onChange === void 0 ? void 0 : onChange(newFileList);
|
|
49
50
|
setUrl("");
|
|
@@ -56,7 +57,9 @@ var HUrlUpload = (function (_ref) {
|
|
|
56
57
|
};
|
|
57
58
|
var onBlur = function onBlur(e) {
|
|
58
59
|
var _context;
|
|
59
|
-
if (
|
|
60
|
+
if (
|
|
61
|
+
_trimInstanceProperty((_context = e.target.value)).call(_context) === ""
|
|
62
|
+
) {
|
|
60
63
|
return;
|
|
61
64
|
}
|
|
62
65
|
setLoad(true);
|
|
@@ -68,7 +71,9 @@ var HUrlUpload = (function (_ref) {
|
|
|
68
71
|
return;
|
|
69
72
|
}
|
|
70
73
|
e.preventDefault();
|
|
71
|
-
var newFileList = _mapInstanceProperty(
|
|
74
|
+
var newFileList = _mapInstanceProperty(
|
|
75
|
+
(_context2 = _Array$from(files))
|
|
76
|
+
).call(_context2, function (item) {
|
|
72
77
|
var name = item.name,
|
|
73
78
|
size = item.size,
|
|
74
79
|
type = item.type;
|
|
@@ -78,45 +83,61 @@ var HUrlUpload = (function (_ref) {
|
|
|
78
83
|
status: "uploading",
|
|
79
84
|
uid: new Date().valueOf().toString(),
|
|
80
85
|
originFileObj: item,
|
|
81
|
-
type: type
|
|
86
|
+
type: type,
|
|
82
87
|
};
|
|
83
88
|
});
|
|
84
|
-
(_ref$current = ref.current) === null || _ref$current === void 0
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
89
|
+
(_ref$current = ref.current) === null || _ref$current === void 0
|
|
90
|
+
? void 0
|
|
91
|
+
: _ref$current.change({
|
|
92
|
+
fileList: newFileList,
|
|
93
|
+
file: newFileList[0],
|
|
94
|
+
});
|
|
88
95
|
setUrl("");
|
|
89
96
|
setLoad(false);
|
|
90
97
|
};
|
|
91
|
-
return /*#__PURE__*/React.createElement(
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
98
|
+
return /*#__PURE__*/ React.createElement(
|
|
99
|
+
antd.Space,
|
|
100
|
+
{
|
|
101
|
+
direction: "vertical",
|
|
102
|
+
style: {
|
|
103
|
+
width: "100%",
|
|
104
|
+
},
|
|
105
|
+
size: "middle",
|
|
95
106
|
},
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}
|
|
107
|
+
/*#__PURE__*/ React.createElement(Input, {
|
|
108
|
+
placeholder: placeholder,
|
|
109
|
+
onBlur: onBlur,
|
|
110
|
+
value: url,
|
|
111
|
+
onPaste: onPaste,
|
|
112
|
+
onChange: function onChange(e) {
|
|
113
|
+
setUrl(e.target.value);
|
|
114
|
+
},
|
|
115
|
+
}),
|
|
116
|
+
/*#__PURE__*/ React.createElement(
|
|
117
|
+
index.default,
|
|
118
|
+
_extends({}, props, {
|
|
119
|
+
ref: ref,
|
|
120
|
+
value: value,
|
|
121
|
+
onChange: onChange,
|
|
122
|
+
})
|
|
123
|
+
),
|
|
124
|
+
load &&
|
|
125
|
+
/*#__PURE__*/ React.createElement(
|
|
126
|
+
"div",
|
|
127
|
+
{
|
|
128
|
+
style: {
|
|
129
|
+
display: "none",
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
/*#__PURE__*/ React.createElement(TypeEle.default, {
|
|
133
|
+
url: url,
|
|
134
|
+
mediaType: mediaType,
|
|
135
|
+
onReady: onReady,
|
|
136
|
+
onError: onError,
|
|
137
|
+
})
|
|
138
|
+
)
|
|
139
|
+
);
|
|
140
|
+
};
|
|
120
141
|
|
|
121
142
|
exports.default = HUrlUpload;
|
|
122
143
|
// powered by h
|
package/lib/Upload/enums.d.ts
CHANGED
package/lib/Upload/enums.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.MediaTypeEnum = void 0;
|
|
4
4
|
(function (MediaTypeEnum) {
|
|
5
|
-
MediaTypeEnum[MediaTypeEnum["video"] = 0] = "video";
|
|
6
|
-
MediaTypeEnum[MediaTypeEnum["audio"] = 1] = "audio";
|
|
7
|
-
MediaTypeEnum[MediaTypeEnum["img"] = 2] = "img";
|
|
5
|
+
MediaTypeEnum[(MediaTypeEnum["video"] = 0)] = "video";
|
|
6
|
+
MediaTypeEnum[(MediaTypeEnum["audio"] = 1)] = "audio";
|
|
7
|
+
MediaTypeEnum[(MediaTypeEnum["img"] = 2)] = "img";
|
|
8
8
|
})(exports.MediaTypeEnum || (exports.MediaTypeEnum = {}));
|
|
9
9
|
// powered by h
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import type { IUpLoadProps } from "../modal";
|
|
2
2
|
import type { UploadChangeParam, UploadFile } from "antd/lib/upload/interface";
|
|
3
|
-
export declare const useChange: ({
|
|
3
|
+
export declare const useChange: ({
|
|
4
|
+
value,
|
|
5
|
+
onChange,
|
|
6
|
+
maxCount,
|
|
7
|
+
request,
|
|
8
|
+
exFiles,
|
|
9
|
+
maxSize,
|
|
10
|
+
}: IUpLoadProps) => (info: UploadChangeParam<UploadFile>) => void;
|