@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.
Files changed (229) hide show
  1. package/es/CheckboxGroup/CheckBox/index.js +24 -16
  2. package/es/CheckboxGroup/hooks.d.ts +9 -3
  3. package/es/CheckboxGroup/hooks.js +115 -64
  4. package/es/CheckboxGroup/index.d.ts +6 -1
  5. package/es/CheckboxGroup/index.js +117 -56
  6. package/es/CheckboxGroup/modal.d.ts +9 -8
  7. package/es/Form/Context/FormConfigProvider.js +64 -19
  8. package/es/Form/Context/index.d.ts +4 -1
  9. package/es/Form/Context/index.js +3 -3
  10. package/es/Form/FormItem/BasicItem.js +80 -42
  11. package/es/Form/FormItem/Helper.d.ts +1 -1
  12. package/es/Form/FormItem/Helper.js +17 -9
  13. package/es/Form/FormItem/RegularFormItem.js +11 -8
  14. package/es/Form/FormItem/UpFormItem.d.ts +6 -1
  15. package/es/Form/FormItem/UpFormItem.js +27 -17
  16. package/es/Form/FormItem/hooks.d.ts +21 -4
  17. package/es/Form/FormItem/hooks.js +12 -9
  18. package/es/Form/FormItem/index.js +5 -5
  19. package/es/Form/HFormConnect.d.ts +9 -1
  20. package/es/Form/HFormConnect.js +94 -26
  21. package/es/Form/InitSet.d.ts +1 -1
  22. package/es/Form/InitSet.js +5 -5
  23. package/es/Form/Label.d.ts +4 -4
  24. package/es/Form/Label.js +36 -19
  25. package/es/Form/config.d.ts +100 -22
  26. package/es/Form/config.js +19 -19
  27. package/es/Form/hooks/index.d.ts +12 -5
  28. package/es/Form/hooks/index.js +65 -49
  29. package/es/Form/hooks/useHForm.js +233 -95
  30. package/es/Form/hooks/useInitConfigData.d.ts +4 -1
  31. package/es/Form/hooks/useInitConfigData.js +143 -61
  32. package/es/Form/index.d.ts +11 -1
  33. package/es/Form/index.js +71 -40
  34. package/es/Form/modal.d.ts +92 -51
  35. package/es/Input/ButtonInput.js +73 -51
  36. package/es/Input/InputNumber.js +21 -12
  37. package/es/Input/SelectInput.d.ts +16 -4
  38. package/es/Input/SelectInput.js +113 -56
  39. package/es/Input/defaultConfig.d.ts +3 -3
  40. package/es/Input/defaultConfig.js +2 -2
  41. package/es/Input/index.js +7 -7
  42. package/es/Input/modal.d.ts +15 -11
  43. package/es/PageHandler/ErrorComponent.js +47 -25
  44. package/es/PageHandler/LoadingComponent.js +17 -13
  45. package/es/PageHandler/index.js +7 -7
  46. package/es/PageHandler/modal.d.ts +4 -4
  47. package/es/RadioGroup/index.d.ts +12 -5
  48. package/es/RadioGroup/index.js +46 -33
  49. package/es/Select/components/AllSelect.d.ts +1 -1
  50. package/es/Select/components/AllSelect.js +40 -18
  51. package/es/Select/components/CheckBoxOption.d.ts +6 -3
  52. package/es/Select/components/CheckBoxOption.js +12 -7
  53. package/es/Select/components/DropdownComponent.d.ts +4 -4
  54. package/es/Select/components/DropdownComponent.js +30 -17
  55. package/es/Select/components/NoFindItem.d.ts +1 -1
  56. package/es/Select/components/NoFindItem.js +11 -7
  57. package/es/Select/components/NotFoundContent.d.ts +2 -2
  58. package/es/Select/components/NotFoundContent.js +49 -27
  59. package/es/Select/defaultConfig.d.ts +1 -1
  60. package/es/Select/defaultConfig.js +20 -16
  61. package/es/Select/hooks/changeHooks.d.ts +2 -2
  62. package/es/Select/hooks/changeHooks.js +147 -71
  63. package/es/Select/hooks/norHooks.d.ts +27 -9
  64. package/es/Select/hooks/norHooks.js +51 -39
  65. package/es/Select/index.d.ts +22 -1
  66. package/es/Select/index.js +124 -65
  67. package/es/Select/modal.d.ts +15 -15
  68. package/es/Select/utils.js +60 -15
  69. package/es/Submit/index.d.ts +9 -3
  70. package/es/Submit/index.js +18 -13
  71. package/es/Switch/index.d.ts +4 -4
  72. package/es/Switch/index.js +46 -20
  73. package/es/TDPicker/RangePicker.d.ts +8 -3
  74. package/es/TDPicker/RangePicker.js +138 -62
  75. package/es/TDPicker/TimePicker.d.ts +6 -1
  76. package/es/TDPicker/TimePicker.js +19 -13
  77. package/es/TDPicker/hooks.d.ts +42 -22
  78. package/es/TDPicker/hooks.js +106 -72
  79. package/es/TDPicker/index.d.ts +7 -1
  80. package/es/TDPicker/index.js +20 -14
  81. package/es/TDPicker/modal.d.ts +21 -16
  82. package/es/Upload/Btn.d.ts +5 -1
  83. package/es/Upload/Btn.js +35 -19
  84. package/es/Upload/MediaTypeEle/TypeEle.d.ts +10 -5
  85. package/es/Upload/MediaTypeEle/TypeEle.js +31 -23
  86. package/es/Upload/MediaTypeEle/index.d.ts +5 -1
  87. package/es/Upload/MediaTypeEle/index.js +21 -18
  88. package/es/Upload/Preview/index.d.ts +5 -1
  89. package/es/Upload/Preview/index.js +17 -13
  90. package/es/Upload/UrlUpload/index.d.ts +7 -1
  91. package/es/Upload/UrlUpload/index.js +72 -51
  92. package/es/Upload/enums.d.ts +3 -3
  93. package/es/Upload/enums.js +3 -3
  94. package/es/Upload/hooks/change.d.ts +8 -1
  95. package/es/Upload/hooks/change.js +115 -58
  96. package/es/Upload/hooks/customRequest.d.ts +5 -1
  97. package/es/Upload/hooks/customRequest.js +63 -46
  98. package/es/Upload/hooks/propsMaker.d.ts +5 -1
  99. package/es/Upload/hooks/propsMaker.js +52 -13
  100. package/es/Upload/index.d.ts +3 -1
  101. package/es/Upload/index.js +131 -61
  102. package/es/Upload/modal.d.ts +17 -15
  103. package/es/Upload/util.d.ts +8 -2
  104. package/es/Upload/util.js +15 -7
  105. package/es/config.js +34 -31
  106. package/es/hooks/index.d.ts +14 -7
  107. package/es/hooks/index.js +124 -49
  108. package/es/index.d.ts +98 -16
  109. package/es/index.js +22 -5
  110. package/es/modal.d.ts +6 -6
  111. package/lib/CheckboxGroup/CheckBox/index.js +26 -18
  112. package/lib/CheckboxGroup/hooks.d.ts +9 -3
  113. package/lib/CheckboxGroup/hooks.js +116 -65
  114. package/lib/CheckboxGroup/index.d.ts +6 -1
  115. package/lib/CheckboxGroup/index.js +119 -58
  116. package/lib/CheckboxGroup/modal.d.ts +9 -8
  117. package/lib/Form/Context/FormConfigProvider.js +66 -21
  118. package/lib/Form/Context/index.d.ts +4 -1
  119. package/lib/Form/Context/index.js +4 -4
  120. package/lib/Form/FormItem/BasicItem.js +82 -44
  121. package/lib/Form/FormItem/Helper.d.ts +1 -1
  122. package/lib/Form/FormItem/Helper.js +19 -11
  123. package/lib/Form/FormItem/RegularFormItem.js +13 -10
  124. package/lib/Form/FormItem/UpFormItem.d.ts +6 -1
  125. package/lib/Form/FormItem/UpFormItem.js +29 -19
  126. package/lib/Form/FormItem/hooks.d.ts +21 -4
  127. package/lib/Form/FormItem/hooks.js +13 -10
  128. package/lib/Form/FormItem/index.js +7 -7
  129. package/lib/Form/HFormConnect.d.ts +9 -1
  130. package/lib/Form/HFormConnect.js +96 -28
  131. package/lib/Form/InitSet.d.ts +1 -1
  132. package/lib/Form/InitSet.js +7 -7
  133. package/lib/Form/Label.d.ts +4 -4
  134. package/lib/Form/Label.js +41 -21
  135. package/lib/Form/config.d.ts +100 -22
  136. package/lib/Form/config.js +21 -21
  137. package/lib/Form/hooks/index.d.ts +12 -5
  138. package/lib/Form/hooks/index.js +66 -50
  139. package/lib/Form/hooks/useHForm.js +235 -97
  140. package/lib/Form/hooks/useInitConfigData.d.ts +4 -1
  141. package/lib/Form/hooks/useInitConfigData.js +144 -63
  142. package/lib/Form/index.d.ts +11 -1
  143. package/lib/Form/index.js +73 -42
  144. package/lib/Form/modal.d.ts +92 -51
  145. package/lib/Input/ButtonInput.js +75 -53
  146. package/lib/Input/InputNumber.js +23 -14
  147. package/lib/Input/SelectInput.d.ts +16 -4
  148. package/lib/Input/SelectInput.js +125 -60
  149. package/lib/Input/defaultConfig.d.ts +3 -3
  150. package/lib/Input/defaultConfig.js +3 -3
  151. package/lib/Input/index.js +9 -9
  152. package/lib/Input/modal.d.ts +15 -11
  153. package/lib/PageHandler/ErrorComponent.js +49 -27
  154. package/lib/PageHandler/LoadingComponent.js +19 -15
  155. package/lib/PageHandler/index.js +9 -9
  156. package/lib/PageHandler/modal.d.ts +4 -4
  157. package/lib/RadioGroup/index.d.ts +12 -5
  158. package/lib/RadioGroup/index.js +48 -35
  159. package/lib/Select/components/AllSelect.d.ts +1 -1
  160. package/lib/Select/components/AllSelect.js +42 -20
  161. package/lib/Select/components/CheckBoxOption.d.ts +6 -3
  162. package/lib/Select/components/CheckBoxOption.js +14 -9
  163. package/lib/Select/components/DropdownComponent.d.ts +4 -4
  164. package/lib/Select/components/DropdownComponent.js +32 -19
  165. package/lib/Select/components/NoFindItem.d.ts +1 -1
  166. package/lib/Select/components/NoFindItem.js +13 -9
  167. package/lib/Select/components/NotFoundContent.d.ts +2 -2
  168. package/lib/Select/components/NotFoundContent.js +51 -29
  169. package/lib/Select/defaultConfig.d.ts +1 -1
  170. package/lib/Select/defaultConfig.js +21 -17
  171. package/lib/Select/hooks/changeHooks.d.ts +2 -2
  172. package/lib/Select/hooks/changeHooks.js +148 -72
  173. package/lib/Select/hooks/norHooks.d.ts +27 -9
  174. package/lib/Select/hooks/norHooks.js +52 -40
  175. package/lib/Select/index.d.ts +22 -1
  176. package/lib/Select/index.js +128 -67
  177. package/lib/Select/modal.d.ts +15 -15
  178. package/lib/Select/utils.js +61 -16
  179. package/lib/Submit/index.d.ts +9 -3
  180. package/lib/Submit/index.js +20 -15
  181. package/lib/Switch/index.d.ts +4 -4
  182. package/lib/Switch/index.js +48 -22
  183. package/lib/TDPicker/RangePicker.d.ts +8 -3
  184. package/lib/TDPicker/RangePicker.js +136 -64
  185. package/lib/TDPicker/TimePicker.d.ts +6 -1
  186. package/lib/TDPicker/TimePicker.js +21 -15
  187. package/lib/TDPicker/hooks.d.ts +42 -22
  188. package/lib/TDPicker/hooks.js +98 -72
  189. package/lib/TDPicker/index.d.ts +7 -1
  190. package/lib/TDPicker/index.js +22 -16
  191. package/lib/TDPicker/modal.d.ts +21 -16
  192. package/lib/Upload/Btn.d.ts +5 -1
  193. package/lib/Upload/Btn.js +37 -21
  194. package/lib/Upload/MediaTypeEle/TypeEle.d.ts +10 -5
  195. package/lib/Upload/MediaTypeEle/TypeEle.js +33 -25
  196. package/lib/Upload/MediaTypeEle/index.d.ts +5 -1
  197. package/lib/Upload/MediaTypeEle/index.js +23 -20
  198. package/lib/Upload/Preview/index.d.ts +5 -1
  199. package/lib/Upload/Preview/index.js +19 -15
  200. package/lib/Upload/UrlUpload/index.d.ts +7 -1
  201. package/lib/Upload/UrlUpload/index.js +74 -53
  202. package/lib/Upload/enums.d.ts +3 -3
  203. package/lib/Upload/enums.js +4 -4
  204. package/lib/Upload/hooks/change.d.ts +8 -1
  205. package/lib/Upload/hooks/change.js +116 -59
  206. package/lib/Upload/hooks/customRequest.d.ts +5 -1
  207. package/lib/Upload/hooks/customRequest.js +64 -47
  208. package/lib/Upload/hooks/propsMaker.d.ts +5 -1
  209. package/lib/Upload/hooks/propsMaker.js +55 -15
  210. package/lib/Upload/index.d.ts +3 -1
  211. package/lib/Upload/index.js +133 -63
  212. package/lib/Upload/modal.d.ts +17 -15
  213. package/lib/Upload/util.d.ts +8 -2
  214. package/lib/Upload/util.js +16 -8
  215. package/lib/config.js +35 -32
  216. package/lib/hooks/index.d.ts +14 -7
  217. package/lib/hooks/index.js +125 -50
  218. package/lib/index.d.ts +98 -16
  219. package/lib/index.js +5 -5
  220. package/lib/modal.d.ts +6 -6
  221. package/package.json +2 -2
  222. package/src/components/CheckboxGroup/index.tsx +2 -2
  223. package/src/components/Form/FormItem/Helper.tsx +3 -4
  224. package/src/components/Form/HFormConnect.tsx +6 -2
  225. package/src/components/Form/hooks/useHForm.ts +59 -10
  226. package/src/components/Form/modal.ts +12 -8
  227. package/src/components/TDPicker/RangePicker.tsx +7 -5
  228. package/src/components/TDPicker/modal.ts +1 -0
  229. package/src/pages/Form/index.tsx +2 -2
@@ -1,12 +1,12 @@
1
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 { DatePicker } from 'antd';
6
- import { useTimeVal, useTimeChange } from './hooks.js';
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,18 +16,24 @@ 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__*/React.createElement(DatePicker, _extends({
26
- value: timeVal,
27
- onChange: change,
28
- showTime: showTime
29
- }, props));
30
- });
25
+ return /*#__PURE__*/ React.createElement(
26
+ DatePicker,
27
+ _extends(
28
+ {
29
+ value: timeVal,
30
+ onChange: change,
31
+ showTime: showTime,
32
+ },
33
+ props
34
+ )
35
+ );
36
+ };
31
37
 
32
38
  export { HDatePicker as default };
33
39
  // powered by hdj
@@ -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 extends Omit<DatePickerProps, "onChange" | "format" | "ranges"> {
10
- onChange?: (time?: Moment | string | number) => void;
11
- format?: string;
12
- showTime?: boolean | SharedTimeProps<Moment>;
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 extends Omit<RangePickerProps, "onChange" | "format" | "ranges" | "value"> {
15
- value?: [any, any] | Record<string, any>;
16
- onChange?: (val: any) => void;
17
- showTime?: boolean | {
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
- format?: string;
21
- valueMap?: DateRangePickerValueMapModal;
22
- ranges?: RangePickerProps["ranges"] | boolean;
23
- addFormat?: (config: Record<string, addFormatItemModal>) => void;
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 extends Omit<TimePickerProps, "onChange" | "format" | "ranges"> {
26
- onChange?: (time?: Moment | string | number) => void;
27
- format?: DurationInputArg2 | string;
29
+ export interface HTimePickerProps
30
+ extends Omit<TimePickerProps, "onChange" | "format" | "ranges"> {
31
+ onChange?: (time?: Moment | string | number) => void;
32
+ format?: DurationInputArg2 | string;
28
33
  }
@@ -1,4 +1,8 @@
1
1
  /// <reference types="react" />
2
2
  import type { IUpLoadProps } from "./modal";
3
- declare const _default: ({ value, maxCount, listType }: IUpLoadProps) => JSX.Element;
3
+ declare const _default: ({
4
+ value,
5
+ maxCount,
6
+ listType,
7
+ }: IUpLoadProps) => JSX.Element;
4
8
  export default _default;
package/es/Upload/Btn.js CHANGED
@@ -1,31 +1,47 @@
1
1
  // welcome to hoo hoo hoo
2
- import React, { useMemo } from 'react';
3
- import { PlusOutlined, UploadOutlined } from '@ant-design/icons';
4
- import { Button } from 'antd';
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(function () {
13
- if (len === maxCount) {
14
- return "更新";
15
- }
16
- return "上传";
17
- }, [len, maxCount]);
18
- if (listType === "picture-card") {
19
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("div", {
20
- style: {
21
- marginTop: 8
12
+ var text = useMemo(
13
+ function () {
14
+ if (len === maxCount) {
15
+ return "更新";
22
16
  }
23
- }, text));
17
+ return "上传";
18
+ },
19
+ [len, maxCount]
20
+ );
21
+ if (listType === "picture-card") {
22
+ return /*#__PURE__*/ React.createElement(
23
+ "div",
24
+ null,
25
+ /*#__PURE__*/ React.createElement(PlusOutlined, null),
26
+ /*#__PURE__*/ React.createElement(
27
+ "div",
28
+ {
29
+ style: {
30
+ marginTop: 8,
31
+ },
32
+ },
33
+ text
34
+ )
35
+ );
24
36
  }
25
- return /*#__PURE__*/React.createElement(Button, {
26
- icon: /*#__PURE__*/React.createElement(UploadOutlined, null)
27
- }, text);
28
- });
37
+ return /*#__PURE__*/ React.createElement(
38
+ Button,
39
+ {
40
+ icon: /*#__PURE__*/ React.createElement(UploadOutlined, null),
41
+ },
42
+ text
43
+ );
44
+ };
29
45
 
30
46
  export { Btn as default };
31
47
  // powered by hdj
@@ -1,10 +1,15 @@
1
1
  /// <reference types="react" />
2
2
  import { MediaTypeEnum } from "../enums";
3
3
  interface TypeEleProps {
4
- mediaType?: MediaTypeEnum;
5
- url?: string;
6
- onReady?: VoidFunction;
7
- onError?: VoidFunction;
4
+ mediaType?: MediaTypeEnum;
5
+ url?: string;
6
+ onReady?: VoidFunction;
7
+ onError?: VoidFunction;
8
8
  }
9
- declare const _default: ({ mediaType, url, onReady, onError }: TypeEleProps) => JSX.Element;
9
+ declare const _default: ({
10
+ mediaType,
11
+ url,
12
+ onReady,
13
+ onError,
14
+ }: TypeEleProps) => JSX.Element;
10
15
  export default _default;
@@ -1,40 +1,48 @@
1
1
  // welcome to hoo hoo hoo
2
- import React from 'react';
3
- import { MediaTypeEnum } from '../enums.js';
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__*/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
- }));
11
+ return /*#__PURE__*/ React.createElement(
12
+ "video",
13
+ {
14
+ autoPlay: true,
15
+ width: "100%",
16
+ controls: true,
17
+ onPlay: onReady,
18
+ onError: onError,
19
+ },
20
+ /*#__PURE__*/ React.createElement("source", {
21
+ src: url,
22
+ })
23
+ );
20
24
  }
21
25
  if (mediaType === MediaTypeEnum.audio) {
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
- }));
26
+ return /*#__PURE__*/ React.createElement(
27
+ "audio",
28
+ {
29
+ autoPlay: true,
30
+ controls: true,
31
+ onPlay: onReady,
32
+ onError: onError,
33
+ },
34
+ /*#__PURE__*/ React.createElement("source", {
35
+ src: url,
36
+ })
37
+ );
30
38
  }
31
- return /*#__PURE__*/React.createElement("img", {
39
+ return /*#__PURE__*/ React.createElement("img", {
32
40
  src: url,
33
41
  width: "100%",
34
42
  onLoad: onReady,
35
- onError: onError
43
+ onError: onError,
36
44
  });
37
- });
45
+ };
38
46
 
39
47
  export { TypeEle as default };
40
48
  // powered by hdj
@@ -1,4 +1,8 @@
1
1
  /// <reference types="react" />
2
2
  import type { IMediaTypeEleProps } from "../modal";
3
- declare const _default: ({ file, onReady, onError }: IMediaTypeEleProps) => JSX.Element | null;
3
+ declare const _default: ({
4
+ file,
5
+ onReady,
6
+ onError,
7
+ }: IMediaTypeEleProps) => JSX.Element | null;
4
8
  export default _default;
@@ -1,13 +1,13 @@
1
1
  // welcome to hoo hoo hoo
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';
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,22 +15,25 @@ var MediaTypeEle = (function (_ref) {
15
15
  return null;
16
16
  }
17
17
  var name = getFileExt(file);
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, {
18
+ var mediaType = useMemo(
19
+ function () {
20
+ if (_indexOfInstanceProperty(videoType).call(videoType, name) !== -1) {
21
+ return MediaTypeEnum.video;
22
+ }
23
+ if (_indexOfInstanceProperty(audioType).call(audioType, name) !== -1) {
24
+ return MediaTypeEnum.audio;
25
+ }
26
+ return MediaTypeEnum.img;
27
+ },
28
+ [name]
29
+ );
30
+ return /*#__PURE__*/ React.createElement(TypeEle, {
28
31
  onError: onError,
29
32
  onReady: onReady,
30
33
  mediaType: mediaType,
31
- url: file.response.url
34
+ url: file.response.url,
32
35
  });
33
- });
36
+ };
34
37
 
35
38
  export { MediaTypeEle as default };
36
39
  // powered by hdj
@@ -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: ({ visible, file, onCancel }: IPreviewProps) => JSX.Element;
5
+ declare const _default: ({
6
+ visible,
7
+ file,
8
+ onCancel,
9
+ }: IPreviewProps) => JSX.Element;
6
10
  export default _default;
@@ -1,21 +1,25 @@
1
1
  // welcome to hoo hoo hoo
2
- import React from 'react';
3
- import { Modal } from 'antd';
4
- import MediaTypeEle from '../MediaTypeEle/index.js';
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__*/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
- });
10
+ return /*#__PURE__*/ React.createElement(
11
+ Modal,
12
+ {
13
+ footer: null,
14
+ visible: visible,
15
+ title: "\u9884\u89C8",
16
+ onCancel: onCancel,
17
+ },
18
+ /*#__PURE__*/ React.createElement(MediaTypeEle, {
19
+ file: file,
20
+ })
21
+ );
22
+ };
19
23
 
20
24
  export { Preview as default };
21
25
  // powered by hdj
@@ -1,4 +1,10 @@
1
1
  /// <reference types="react" />
2
2
  import type { IUrlUploadProps } from "../modal";
3
- declare const _default: ({ placeholder, value, onChange, mediaType, ...props }: IUrlUploadProps) => JSX.Element;
3
+ declare const _default: ({
4
+ placeholder,
5
+ value,
6
+ onChange,
7
+ mediaType,
8
+ ...props
9
+ }: IUrlUploadProps) => JSX.Element;
4
10
  export default _default;
@@ -1,21 +1,22 @@
1
1
  // welcome to hoo hoo hoo
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';
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 = _ref$placeholder === void 0 ? "请输入文件地址" : _ref$placeholder,
18
+ placeholder =
19
+ _ref$placeholder === void 0 ? "请输入文件地址" : _ref$placeholder,
19
20
  _ref$value = _ref.value,
20
21
  value = _ref$value === void 0 ? [] : _ref$value,
21
22
  onChange = _ref.onChange,
@@ -39,8 +40,8 @@ var HUrlUpload = (function (_ref) {
39
40
  fileName: url,
40
41
  thumbUrl: url,
41
42
  response: {
42
- url: url
43
- }
43
+ url: url,
44
+ },
44
45
  });
45
46
  onChange === null || onChange === void 0 ? void 0 : onChange(newFileList);
46
47
  setUrl("");
@@ -53,7 +54,9 @@ var HUrlUpload = (function (_ref) {
53
54
  };
54
55
  var onBlur = function onBlur(e) {
55
56
  var _context;
56
- if (_trimInstanceProperty(_context = e.target.value).call(_context) === "") {
57
+ if (
58
+ _trimInstanceProperty((_context = e.target.value)).call(_context) === ""
59
+ ) {
57
60
  return;
58
61
  }
59
62
  setLoad(true);
@@ -65,7 +68,9 @@ var HUrlUpload = (function (_ref) {
65
68
  return;
66
69
  }
67
70
  e.preventDefault();
68
- var newFileList = _mapInstanceProperty(_context2 = _Array$from(files)).call(_context2, function (item) {
71
+ var newFileList = _mapInstanceProperty(
72
+ (_context2 = _Array$from(files))
73
+ ).call(_context2, function (item) {
69
74
  var name = item.name,
70
75
  size = item.size,
71
76
  type = item.type;
@@ -75,45 +80,61 @@ var HUrlUpload = (function (_ref) {
75
80
  status: "uploading",
76
81
  uid: new Date().valueOf().toString(),
77
82
  originFileObj: item,
78
- type: type
83
+ type: type,
79
84
  };
80
85
  });
81
- (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.change({
82
- fileList: newFileList,
83
- file: newFileList[0]
84
- });
86
+ (_ref$current = ref.current) === null || _ref$current === void 0
87
+ ? void 0
88
+ : _ref$current.change({
89
+ fileList: newFileList,
90
+ file: newFileList[0],
91
+ });
85
92
  setUrl("");
86
93
  setLoad(false);
87
94
  };
88
- return /*#__PURE__*/React.createElement(Space, {
89
- direction: "vertical",
90
- style: {
91
- width: "100%"
95
+ return /*#__PURE__*/ React.createElement(
96
+ Space,
97
+ {
98
+ direction: "vertical",
99
+ style: {
100
+ width: "100%",
101
+ },
102
+ size: "middle",
92
103
  },
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
- });
104
+ /*#__PURE__*/ React.createElement(Input, {
105
+ placeholder: placeholder,
106
+ onBlur: onBlur,
107
+ value: url,
108
+ onPaste: onPaste,
109
+ onChange: function onChange(e) {
110
+ setUrl(e.target.value);
111
+ },
112
+ }),
113
+ /*#__PURE__*/ React.createElement(
114
+ HUpload,
115
+ _extends({}, props, {
116
+ ref: ref,
117
+ value: value,
118
+ onChange: onChange,
119
+ })
120
+ ),
121
+ load &&
122
+ /*#__PURE__*/ React.createElement(
123
+ "div",
124
+ {
125
+ style: {
126
+ display: "none",
127
+ },
128
+ },
129
+ /*#__PURE__*/ React.createElement(TypeEle, {
130
+ url: url,
131
+ mediaType: mediaType,
132
+ onReady: onReady,
133
+ onError: onError,
134
+ })
135
+ )
136
+ );
137
+ };
117
138
 
118
139
  export { HUrlUpload as default };
119
140
  // powered by hdj
@@ -1,5 +1,5 @@
1
1
  export declare enum MediaTypeEnum {
2
- video = 0,
3
- audio = 1,
4
- img = 2
2
+ video = 0,
3
+ audio = 1,
4
+ img = 2,
5
5
  }
@@ -1,9 +1,9 @@
1
1
  // welcome to hoo hoo hoo
2
2
  var MediaTypeEnum;
3
3
  (function (MediaTypeEnum) {
4
- MediaTypeEnum[MediaTypeEnum["video"] = 0] = "video";
5
- MediaTypeEnum[MediaTypeEnum["audio"] = 1] = "audio";
6
- MediaTypeEnum[MediaTypeEnum["img"] = 2] = "img";
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,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: ({ value, onChange, maxCount, request, exFiles, maxSize, }: IUpLoadProps) => (info: UploadChangeParam<UploadFile>) => void;
3
+ export declare const useChange: ({
4
+ value,
5
+ onChange,
6
+ maxCount,
7
+ request,
8
+ exFiles,
9
+ maxSize,
10
+ }: IUpLoadProps) => (info: UploadChangeParam<UploadFile>) => void;