assui 2.0.2 → 2.0.6
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/button-drawer/index.d.ts +10 -0
- package/es/button-drawer/index.js +116 -0
- package/es/button-drawer/style/index.d.ts +1 -0
- package/es/button-drawer/style/index.js +1 -0
- package/es/button-modal/index.d.ts +14 -0
- package/es/button-modal/index.js +131 -0
- package/es/button-modal/style/index.d.ts +1 -0
- package/es/button-modal/style/index.js +1 -0
- package/es/condition-input/index.d.ts +15 -0
- package/es/condition-input/index.js +108 -0
- package/es/condition-input/parse2RegexOption.d.ts +13 -0
- package/es/condition-input/parse2RegexOption.js +57 -0
- package/es/condition-input/style/index.d.ts +1 -0
- package/es/condition-input/style/index.js +1 -0
- package/es/copy-to-clipboard/index.d.ts +22 -0
- package/es/copy-to-clipboard/index.js +95 -0
- package/es/copy-to-clipboard/style/index.css +249 -0
- package/es/copy-to-clipboard/style/index.d.ts +1 -0
- package/es/copy-to-clipboard/style/index.js +1 -0
- package/es/copy-to-clipboard/style/index.less +1 -0
- package/es/highlight-textarea/HighlighedContents.d.ts +7 -0
- package/es/highlight-textarea/HighlighedContents.js +15 -0
- package/es/highlight-textarea/extractSpansOfClasses.d.ts +15 -0
- package/es/highlight-textarea/extractSpansOfClasses.js +159 -0
- package/es/highlight-textarea/getRanges.d.ts +2 -0
- package/es/highlight-textarea/getRanges.js +142 -0
- package/es/highlight-textarea/getType.d.ts +2 -0
- package/es/highlight-textarea/getType.js +29 -0
- package/es/highlight-textarea/index.d.ts +12 -0
- package/es/highlight-textarea/index.js +132 -0
- package/es/highlight-textarea/style/index.css +38 -0
- package/es/highlight-textarea/style/index.d.ts +2 -0
- package/es/highlight-textarea/style/index.js +2 -0
- package/es/highlight-textarea/style/index.less +42 -0
- package/es/highlight-textarea/types.d.ts +16 -0
- package/es/highlight-textarea/types.js +0 -0
- package/es/highlight-words/index.d.ts +3 -0
- package/es/highlight-words/index.js +2 -0
- package/es/highlight-words/style/index.d.ts +1 -0
- package/es/highlight-words/style/index.js +0 -0
- package/es/icon/demo/svg/check-circle-filled.svg +6 -0
- package/es/icon/demo/svg/coin-circle.svg +9 -0
- package/es/icon/index.d.ts +27 -0
- package/es/icon/index.js +95 -0
- package/es/icon/style/index.d.ts +1 -0
- package/es/icon/style/index.js +0 -0
- package/es/icon/utils.d.ts +6 -0
- package/es/icon/utils.js +22 -0
- package/es/img-crop/EasyCrop.d.ts +6 -0
- package/es/img-crop/EasyCrop.js +113 -0
- package/es/img-crop/getCroppedImg.d.ts +6 -0
- package/es/img-crop/getCroppedImg.js +199 -0
- package/es/img-crop/index.d.ts +53 -0
- package/es/img-crop/index.js +531 -0
- package/es/img-crop/style/index.css +52 -0
- package/es/img-crop/style/index.d.ts +3 -0
- package/es/img-crop/style/index.js +3 -0
- package/es/img-crop/style/index.less +54 -0
- package/es/index.d.ts +34 -2
- package/es/index.js +18 -2
- package/es/keep-tab/demo/index.modules.less +66 -0
- package/es/keep-tab/index.d.ts +29 -0
- package/es/keep-tab/index.js +129 -0
- package/es/keep-tab/style/index.css +1129 -0
- package/es/keep-tab/style/index.d.ts +2 -0
- package/es/keep-tab/style/index.js +2 -0
- package/es/keep-tab/style/index.less +2 -0
- package/es/number-input/index.d.ts +22 -7
- package/es/number-input/index.js +22 -11
- package/es/number-input/style/index.d.ts +1 -1
- package/es/number-input/style/index.js +1 -1
- package/es/number-input/utils.d.ts +10 -11
- package/es/number-input/utils.js +7 -7
- package/es/rc-echart/core.d.ts +32 -0
- package/es/rc-echart/core.js +136 -0
- package/es/rc-echart/index.d.ts +21 -0
- package/es/rc-echart/index.js +27 -0
- package/es/rc-echart/style/index.d.ts +1 -0
- package/es/rc-echart/style/index.js +0 -0
- package/es/rc-motion/demo/CSSMotion.less +91 -0
- package/es/rc-motion/index.d.ts +2 -0
- package/es/rc-motion/index.js +2 -0
- package/es/rc-motion/style/index.d.ts +1 -0
- package/es/rc-motion/style/index.js +0 -0
- package/es/rc-qrcode/index.d.ts +20 -0
- package/es/rc-qrcode/index.js +57 -0
- package/es/rc-qrcode/style/index.d.ts +1 -0
- package/es/rc-qrcode/style/index.js +0 -0
- package/es/rc-qrcode/useQrcode.d.ts +4 -0
- package/es/rc-qrcode/useQrcode.js +50 -0
- package/es/rc-transition-group/index.d.ts +2 -0
- package/es/rc-transition-group/index.js +2 -0
- package/es/rc-transition-group/style/index.d.ts +1 -0
- package/es/rc-transition-group/style/index.js +0 -0
- package/es/single-img-upload/index.d.ts +19 -0
- package/es/single-img-upload/index.js +199 -0
- package/es/single-img-upload/style/index.css +74 -0
- package/es/single-img-upload/style/index.d.ts +3 -0
- package/es/single-img-upload/style/index.js +3 -0
- package/es/single-img-upload/style/index.less +85 -0
- package/es/sortable-hoc/demo/VerticalListBase/index.modules.less +63 -0
- package/es/sortable-hoc/demo/index.modules.less +248 -0
- package/es/sortable-hoc/index.d.ts +2 -0
- package/es/sortable-hoc/index.js +2 -0
- package/es/sortable-hoc/style/index.d.ts +1 -0
- package/es/sortable-hoc/style/index.js +0 -0
- package/es/split-pane/index.d.ts +59 -0
- package/es/split-pane/index.js +21 -0
- package/es/split-pane/style/index.css +41 -0
- package/es/split-pane/style/index.d.ts +1 -0
- package/es/split-pane/style/index.js +1 -0
- package/es/split-pane/style/index.less +49 -0
- package/es/text-area/index.d.ts +12 -0
- package/es/text-area/index.js +96 -0
- package/es/text-area/style/index.d.ts +1 -0
- package/es/text-area/style/index.js +1 -0
- package/es/text-input/index.d.ts +5 -0
- package/es/text-input/index.js +85 -0
- package/es/{number-input → text-input}/style/index.css +0 -3
- package/es/text-input/style/index.d.ts +1 -0
- package/es/text-input/style/index.js +1 -0
- package/es/{number-input → text-input}/style/index.less +0 -4
- package/lib/button-drawer/index.d.ts +10 -0
- package/lib/button-drawer/index.js +164 -0
- package/lib/button-drawer/style/index.d.ts +1 -0
- package/lib/button-drawer/style/index.js +7 -0
- package/lib/button-modal/index.d.ts +14 -0
- package/lib/button-modal/index.js +178 -0
- package/lib/button-modal/style/index.d.ts +1 -0
- package/lib/button-modal/style/index.js +7 -0
- package/lib/condition-input/index.d.ts +15 -0
- package/lib/condition-input/index.js +158 -0
- package/lib/condition-input/parse2RegexOption.d.ts +13 -0
- package/lib/condition-input/parse2RegexOption.js +72 -0
- package/lib/condition-input/style/index.d.ts +1 -0
- package/lib/condition-input/style/index.js +7 -0
- package/lib/copy-to-clipboard/index.d.ts +22 -0
- package/lib/copy-to-clipboard/index.js +143 -0
- package/lib/copy-to-clipboard/style/index.css +249 -0
- package/lib/copy-to-clipboard/style/index.d.ts +1 -0
- package/lib/copy-to-clipboard/style/index.js +7 -0
- package/lib/copy-to-clipboard/style/index.less +1 -0
- package/lib/highlight-textarea/HighlighedContents.d.ts +7 -0
- package/lib/highlight-textarea/HighlighedContents.js +29 -0
- package/lib/highlight-textarea/extractSpansOfClasses.d.ts +15 -0
- package/lib/highlight-textarea/extractSpansOfClasses.js +173 -0
- package/lib/highlight-textarea/getRanges.d.ts +2 -0
- package/lib/highlight-textarea/getRanges.js +156 -0
- package/lib/highlight-textarea/getType.d.ts +2 -0
- package/lib/highlight-textarea/getType.js +37 -0
- package/lib/highlight-textarea/index.d.ts +12 -0
- package/lib/highlight-textarea/index.js +183 -0
- package/lib/highlight-textarea/style/index.css +38 -0
- package/lib/highlight-textarea/style/index.d.ts +2 -0
- package/lib/highlight-textarea/style/index.js +9 -0
- package/lib/highlight-textarea/style/index.less +42 -0
- package/lib/highlight-textarea/types.d.ts +16 -0
- package/lib/highlight-textarea/types.js +5 -0
- package/lib/highlight-words/index.d.ts +3 -0
- package/lib/highlight-words/index.js +15 -0
- package/lib/highlight-words/style/index.d.ts +1 -0
- package/lib/highlight-words/style/index.js +0 -0
- package/lib/icon/demo/svg/check-circle-filled.svg +6 -0
- package/lib/icon/demo/svg/coin-circle.svg +9 -0
- package/lib/icon/index.d.ts +27 -0
- package/lib/icon/index.js +143 -0
- package/lib/icon/style/index.d.ts +1 -0
- package/lib/icon/style/index.js +0 -0
- package/lib/icon/utils.d.ts +6 -0
- package/lib/icon/utils.js +32 -0
- package/lib/img-crop/EasyCrop.d.ts +6 -0
- package/lib/img-crop/EasyCrop.js +160 -0
- package/lib/img-crop/getCroppedImg.d.ts +6 -0
- package/lib/img-crop/getCroppedImg.js +205 -0
- package/lib/img-crop/index.d.ts +53 -0
- package/lib/img-crop/index.js +582 -0
- package/lib/img-crop/style/index.css +52 -0
- package/lib/img-crop/style/index.d.ts +3 -0
- package/lib/img-crop/style/index.js +11 -0
- package/lib/img-crop/style/index.less +54 -0
- package/lib/index.d.ts +34 -2
- package/lib/index.js +160 -9
- package/lib/keep-tab/demo/index.modules.less +66 -0
- package/lib/keep-tab/index.d.ts +29 -0
- package/lib/keep-tab/index.js +181 -0
- package/lib/keep-tab/style/index.css +1129 -0
- package/lib/keep-tab/style/index.d.ts +2 -0
- package/lib/keep-tab/style/index.js +9 -0
- package/lib/keep-tab/style/index.less +2 -0
- package/lib/number-input/index.d.ts +22 -7
- package/lib/number-input/index.js +22 -11
- package/lib/number-input/style/index.d.ts +1 -1
- package/lib/number-input/style/index.js +1 -1
- package/lib/number-input/utils.d.ts +10 -11
- package/lib/number-input/utils.js +8 -8
- package/lib/rc-echart/core.d.ts +32 -0
- package/lib/rc-echart/core.js +185 -0
- package/lib/rc-echart/index.d.ts +21 -0
- package/lib/rc-echart/index.js +75 -0
- package/lib/rc-echart/style/index.d.ts +1 -0
- package/lib/rc-echart/style/index.js +0 -0
- package/lib/rc-motion/demo/CSSMotion.less +91 -0
- package/lib/rc-motion/index.d.ts +2 -0
- package/lib/rc-motion/index.js +43 -0
- package/lib/rc-motion/style/index.d.ts +1 -0
- package/lib/rc-motion/style/index.js +0 -0
- package/lib/rc-qrcode/index.d.ts +20 -0
- package/lib/rc-qrcode/index.js +108 -0
- package/lib/rc-qrcode/style/index.d.ts +1 -0
- package/lib/rc-qrcode/style/index.js +0 -0
- package/lib/rc-qrcode/useQrcode.d.ts +4 -0
- package/lib/rc-qrcode/useQrcode.js +66 -0
- package/lib/rc-transition-group/index.d.ts +2 -0
- package/lib/rc-transition-group/index.js +43 -0
- package/lib/rc-transition-group/style/index.d.ts +1 -0
- package/lib/rc-transition-group/style/index.js +0 -0
- package/lib/single-img-upload/index.d.ts +19 -0
- package/lib/single-img-upload/index.js +250 -0
- package/lib/single-img-upload/style/index.css +74 -0
- package/lib/single-img-upload/style/index.d.ts +3 -0
- package/lib/single-img-upload/style/index.js +11 -0
- package/lib/single-img-upload/style/index.less +85 -0
- package/lib/sortable-hoc/demo/VerticalListBase/index.modules.less +63 -0
- package/lib/sortable-hoc/demo/index.modules.less +248 -0
- package/lib/sortable-hoc/index.d.ts +2 -0
- package/lib/sortable-hoc/index.js +43 -0
- package/lib/sortable-hoc/style/index.d.ts +1 -0
- package/lib/sortable-hoc/style/index.js +0 -0
- package/lib/split-pane/index.d.ts +59 -0
- package/lib/split-pane/index.js +69 -0
- package/lib/split-pane/style/index.css +41 -0
- package/lib/split-pane/style/index.d.ts +1 -0
- package/lib/split-pane/style/index.js +7 -0
- package/lib/split-pane/style/index.less +49 -0
- package/lib/text-area/index.d.ts +12 -0
- package/lib/text-area/index.js +144 -0
- package/lib/text-area/style/index.d.ts +1 -0
- package/lib/text-area/style/index.js +7 -0
- package/lib/text-input/index.d.ts +5 -0
- package/lib/text-input/index.js +99 -0
- package/lib/{number-input → text-input}/style/index.css +0 -3
- package/lib/text-input/style/index.d.ts +1 -0
- package/lib/text-input/style/index.js +7 -0
- package/lib/{number-input → text-input}/style/index.less +0 -4
- package/package.json +20 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
File without changes
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { UploadProps } from 'rc-upload';
|
|
2
|
+
export interface RcFile extends File {
|
|
3
|
+
uid: string;
|
|
4
|
+
}
|
|
5
|
+
export interface UploadProgressEvent extends ProgressEvent {
|
|
6
|
+
percent: number;
|
|
7
|
+
}
|
|
8
|
+
export interface SingleImgUploadProps extends UploadProps {
|
|
9
|
+
value?: string;
|
|
10
|
+
wrapperClassName?: string;
|
|
11
|
+
onDeleteUpload?: () => void;
|
|
12
|
+
}
|
|
13
|
+
declare const SingleImgUpload: {
|
|
14
|
+
(props: SingleImgUploadProps): JSX.Element;
|
|
15
|
+
defaultProps: {
|
|
16
|
+
beforeUpload(): boolean;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export default SingleImgUpload;
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __assign = this && this.__assign || function () {
|
|
4
|
+
__assign = Object.assign || function (t) {
|
|
5
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
|
+
s = arguments[i];
|
|
7
|
+
|
|
8
|
+
for (var p in s) {
|
|
9
|
+
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return t;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
return __assign.apply(this, arguments);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
20
|
+
if (k2 === undefined) k2 = k;
|
|
21
|
+
Object.defineProperty(o, k2, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function get() {
|
|
24
|
+
return m[k];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
} : function (o, m, k, k2) {
|
|
28
|
+
if (k2 === undefined) k2 = k;
|
|
29
|
+
o[k2] = m[k];
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
|
|
33
|
+
Object.defineProperty(o, "default", {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
value: v
|
|
36
|
+
});
|
|
37
|
+
} : function (o, v) {
|
|
38
|
+
o["default"] = v;
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
var __importStar = this && this.__importStar || function (mod) {
|
|
42
|
+
if (mod && mod.__esModule) return mod;
|
|
43
|
+
var result = {};
|
|
44
|
+
if (mod != null) for (var k in mod) {
|
|
45
|
+
if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
__setModuleDefault(result, mod);
|
|
49
|
+
|
|
50
|
+
return result;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
54
|
+
var t = {};
|
|
55
|
+
|
|
56
|
+
for (var p in s) {
|
|
57
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
61
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
62
|
+
}
|
|
63
|
+
return t;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
var __read = this && this.__read || function (o, n) {
|
|
67
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
68
|
+
if (!m) return o;
|
|
69
|
+
var i = m.call(o),
|
|
70
|
+
r,
|
|
71
|
+
ar = [],
|
|
72
|
+
e;
|
|
73
|
+
|
|
74
|
+
try {
|
|
75
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
|
|
76
|
+
ar.push(r.value);
|
|
77
|
+
}
|
|
78
|
+
} catch (error) {
|
|
79
|
+
e = {
|
|
80
|
+
error: error
|
|
81
|
+
};
|
|
82
|
+
} finally {
|
|
83
|
+
try {
|
|
84
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
85
|
+
} finally {
|
|
86
|
+
if (e) throw e.error;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return ar;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
var __importDefault = this && this.__importDefault || function (mod) {
|
|
94
|
+
return mod && mod.__esModule ? mod : {
|
|
95
|
+
"default": mod
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
Object.defineProperty(exports, "__esModule", {
|
|
100
|
+
value: true
|
|
101
|
+
});
|
|
102
|
+
/* eslint-disable @typescript-eslint/no-unused-expressions */
|
|
103
|
+
|
|
104
|
+
var React = __importStar(require("react"));
|
|
105
|
+
|
|
106
|
+
var rc_upload_1 = __importDefault(require("rc-upload"));
|
|
107
|
+
|
|
108
|
+
var progress_1 = __importDefault(require("antd/lib/progress"));
|
|
109
|
+
|
|
110
|
+
var image_1 = __importDefault(require("antd/lib/image"));
|
|
111
|
+
|
|
112
|
+
var classnames_1 = __importDefault(require("classnames"));
|
|
113
|
+
|
|
114
|
+
var useUpdateEffect_1 = __importDefault(require("ahooks/lib/useUpdateEffect"));
|
|
115
|
+
|
|
116
|
+
var CloseOutlined_1 = __importDefault(require("a-icons/lib/CloseOutlined"));
|
|
117
|
+
|
|
118
|
+
var getLocalImgURL = function getLocalImgURL(file) {
|
|
119
|
+
var URL = window.URL || window.webkitURL;
|
|
120
|
+
var imgURL = URL.createObjectURL(file);
|
|
121
|
+
return imgURL;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
var SingleImgUpload = function SingleImgUpload(props) {
|
|
125
|
+
var className = props.className,
|
|
126
|
+
wrapperClassName = props.wrapperClassName,
|
|
127
|
+
children = props.children,
|
|
128
|
+
value = props.value,
|
|
129
|
+
onStart = props.onStart,
|
|
130
|
+
onDeleteUpload = props.onDeleteUpload,
|
|
131
|
+
onSuccess = props.onSuccess,
|
|
132
|
+
onError = props.onError,
|
|
133
|
+
restProps = __rest(props, ["className", "wrapperClassName", "children", "value", "onStart", "onDeleteUpload", "onSuccess", "onError"]);
|
|
134
|
+
|
|
135
|
+
var uploadInstanceRef = React.useRef();
|
|
136
|
+
var fileRef = React.useRef();
|
|
137
|
+
|
|
138
|
+
var _a = __read(React.useState(value ? 'done' : 'init'), 2),
|
|
139
|
+
uploadStatus = _a[0],
|
|
140
|
+
setUploadStatus = _a[1];
|
|
141
|
+
|
|
142
|
+
var _b = __read(React.useState(value), 2),
|
|
143
|
+
fileUrl = _b[0],
|
|
144
|
+
setFileUrl = _b[1];
|
|
145
|
+
|
|
146
|
+
var _c = __read(React.useState(0), 2),
|
|
147
|
+
uploadPercent = _c[0],
|
|
148
|
+
setUploadPercent = _c[1];
|
|
149
|
+
|
|
150
|
+
useUpdateEffect_1["default"](function () {
|
|
151
|
+
setFileUrl(value);
|
|
152
|
+
|
|
153
|
+
if (value) {
|
|
154
|
+
setUploadStatus('done');
|
|
155
|
+
} else {
|
|
156
|
+
setUploadStatus('init');
|
|
157
|
+
}
|
|
158
|
+
}, [value]);
|
|
159
|
+
|
|
160
|
+
var handleStart = function handleStart(file) {
|
|
161
|
+
fileRef.current = file;
|
|
162
|
+
setUploadPercent(0);
|
|
163
|
+
setFileUrl(getLocalImgURL(file));
|
|
164
|
+
setUploadStatus('uploading');
|
|
165
|
+
onStart && onStart(file);
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
var handleProgress = function handleProgress(e) {
|
|
169
|
+
var percent = e.percent;
|
|
170
|
+
setUploadPercent(parseInt("" + percent, 10));
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
var handleError = function handleError(error, ret, file) {
|
|
174
|
+
setUploadStatus('init');
|
|
175
|
+
onError && onError(error, ret, file);
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
var handleSuccess = function handleSuccess(res, file, xhr) {
|
|
179
|
+
onSuccess && onSuccess(res, file, xhr);
|
|
180
|
+
setUploadStatus('done');
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
var uploadCls = classnames_1["default"](className, {
|
|
184
|
+
'not-upload-init': uploadStatus !== 'init'
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
var handleDeleteUpload = function handleDeleteUpload() {
|
|
188
|
+
setUploadStatus('init');
|
|
189
|
+
onDeleteUpload && onDeleteUpload();
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
var cancelUpload = function cancelUpload() {
|
|
193
|
+
var _a;
|
|
194
|
+
|
|
195
|
+
if (fileRef.current) {
|
|
196
|
+
(_a = uploadInstanceRef.current) === null || _a === void 0 ? void 0 : _a.abort(fileRef.current);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
setUploadStatus('init');
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
var cls = classnames_1["default"]('as-img-upload', wrapperClassName);
|
|
203
|
+
return React.createElement("div", {
|
|
204
|
+
className: cls
|
|
205
|
+
}, uploadStatus === 'uploading' && React.createElement("div", {
|
|
206
|
+
className: "as-img-upload-content"
|
|
207
|
+
}, React.createElement("img", {
|
|
208
|
+
className: "preview-img",
|
|
209
|
+
src: fileUrl,
|
|
210
|
+
alt: ""
|
|
211
|
+
}), React.createElement("div", {
|
|
212
|
+
className: "dark"
|
|
213
|
+
}), React.createElement(progress_1["default"], {
|
|
214
|
+
className: "as-img-upload-upload-progress",
|
|
215
|
+
percent: uploadPercent,
|
|
216
|
+
size: "small",
|
|
217
|
+
status: "active"
|
|
218
|
+
}), React.createElement("div", {
|
|
219
|
+
className: "as-img-upload-close-button",
|
|
220
|
+
onClick: cancelUpload
|
|
221
|
+
}, React.createElement(CloseOutlined_1["default"], null))), uploadStatus === 'done' && React.createElement("div", {
|
|
222
|
+
className: "as-img-upload-content"
|
|
223
|
+
}, React.createElement(image_1["default"], {
|
|
224
|
+
wrapperClassName: "as-img-upload-preview",
|
|
225
|
+
src: fileUrl,
|
|
226
|
+
preview: true
|
|
227
|
+
}), React.createElement("div", {
|
|
228
|
+
className: "as-img-upload-close-button",
|
|
229
|
+
onClick: handleDeleteUpload
|
|
230
|
+
}, React.createElement(CloseOutlined_1["default"], null))), React.createElement(rc_upload_1["default"], __assign({
|
|
231
|
+
ref: function ref(uploader) {
|
|
232
|
+
uploadInstanceRef.current = uploader;
|
|
233
|
+
},
|
|
234
|
+
name: "file",
|
|
235
|
+
className: uploadCls,
|
|
236
|
+
onStart: handleStart,
|
|
237
|
+
onProgress: handleProgress,
|
|
238
|
+
onError: handleError,
|
|
239
|
+
onSuccess: handleSuccess
|
|
240
|
+
}, restProps), uploadStatus === 'init' && React.createElement("div", {
|
|
241
|
+
className: "as-img-upload-button"
|
|
242
|
+
}, children)));
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
SingleImgUpload.defaultProps = {
|
|
246
|
+
beforeUpload: function beforeUpload() {
|
|
247
|
+
return true;
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
exports["default"] = SingleImgUpload;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/* stylelint-disable at-rule-empty-line-before,at-rule-name-space-after,at-rule-no-unknown */
|
|
2
|
+
/* stylelint-disable no-duplicate-selectors */
|
|
3
|
+
/* stylelint-disable */
|
|
4
|
+
/* stylelint-disable declaration-bang-space-before,no-duplicate-selectors,string-no-newline */
|
|
5
|
+
.as-img-upload {
|
|
6
|
+
width: 335px;
|
|
7
|
+
height: 140px;
|
|
8
|
+
border: 1px solid #cacaca;
|
|
9
|
+
border-radius: 4px;
|
|
10
|
+
}
|
|
11
|
+
.as-img-upload:hover {
|
|
12
|
+
border: 1px solid #1890ff;
|
|
13
|
+
}
|
|
14
|
+
.as-img-upload .rc-upload,
|
|
15
|
+
.as-img-upload:focus {
|
|
16
|
+
outline: none;
|
|
17
|
+
}
|
|
18
|
+
.as-img-upload-button {
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
align-items: center;
|
|
22
|
+
justify-content: center;
|
|
23
|
+
width: 100%;
|
|
24
|
+
height: 100%;
|
|
25
|
+
overflow: hidden;
|
|
26
|
+
cursor: pointer;
|
|
27
|
+
}
|
|
28
|
+
.as-img-upload-button:focus {
|
|
29
|
+
outline: none;
|
|
30
|
+
}
|
|
31
|
+
.as-img-upload-content {
|
|
32
|
+
position: relative;
|
|
33
|
+
z-index: 1010;
|
|
34
|
+
width: 100%;
|
|
35
|
+
height: 100%;
|
|
36
|
+
overflow: hidden;
|
|
37
|
+
background-color: #fff;
|
|
38
|
+
}
|
|
39
|
+
.as-img-upload-close-button {
|
|
40
|
+
position: absolute;
|
|
41
|
+
top: 0;
|
|
42
|
+
right: 0;
|
|
43
|
+
z-index: 10;
|
|
44
|
+
width: 20px;
|
|
45
|
+
height: 20px;
|
|
46
|
+
text-align: center;
|
|
47
|
+
background-color: #000;
|
|
48
|
+
cursor: pointer;
|
|
49
|
+
opacity: 0.6;
|
|
50
|
+
}
|
|
51
|
+
.as-img-upload-close-button .spotecicon {
|
|
52
|
+
width: 15px;
|
|
53
|
+
height: 15px;
|
|
54
|
+
color: #fff;
|
|
55
|
+
}
|
|
56
|
+
.as-img-upload-preview {
|
|
57
|
+
height: 100%;
|
|
58
|
+
}
|
|
59
|
+
.as-img-upload-upload-progress {
|
|
60
|
+
position: absolute;
|
|
61
|
+
top: 50%;
|
|
62
|
+
left: 0;
|
|
63
|
+
z-index: 2;
|
|
64
|
+
transform: translateY(-34%);
|
|
65
|
+
}
|
|
66
|
+
.as-img-upload-upload-progress .ant-progress-outer {
|
|
67
|
+
padding: 0 20px;
|
|
68
|
+
}
|
|
69
|
+
.as-img-upload-upload-progress .ant-progress-text {
|
|
70
|
+
display: block;
|
|
71
|
+
width: 100%;
|
|
72
|
+
color: #fff;
|
|
73
|
+
text-align: center;
|
|
74
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
@import '~antd/es/style/themes/index';
|
|
2
|
+
|
|
3
|
+
@progress-prefix-cls: ~'@{ant-prefix}';
|
|
4
|
+
|
|
5
|
+
.as-img-upload {
|
|
6
|
+
width: 335px;
|
|
7
|
+
height: 140px;
|
|
8
|
+
border: 1px solid #cacaca;
|
|
9
|
+
border-radius: 4px;
|
|
10
|
+
|
|
11
|
+
&:hover {
|
|
12
|
+
border: 1px solid #1890ff;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.rc-upload,
|
|
16
|
+
&:focus {
|
|
17
|
+
outline: none;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&-button {
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
align-items: center;
|
|
24
|
+
justify-content: center;
|
|
25
|
+
width: 100%;
|
|
26
|
+
height: 100%;
|
|
27
|
+
overflow: hidden;
|
|
28
|
+
cursor: pointer;
|
|
29
|
+
|
|
30
|
+
&:focus {
|
|
31
|
+
outline: none;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&-content {
|
|
36
|
+
position: relative;
|
|
37
|
+
z-index: 1010;
|
|
38
|
+
width: 100%;
|
|
39
|
+
height: 100%;
|
|
40
|
+
overflow: hidden;
|
|
41
|
+
background-color: #fff;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&-close-button {
|
|
45
|
+
position: absolute;
|
|
46
|
+
top: 0;
|
|
47
|
+
right: 0;
|
|
48
|
+
z-index: 10;
|
|
49
|
+
width: 20px;
|
|
50
|
+
height: 20px;
|
|
51
|
+
text-align: center;
|
|
52
|
+
background-color: #000;
|
|
53
|
+
cursor: pointer;
|
|
54
|
+
opacity: 0.6;
|
|
55
|
+
|
|
56
|
+
.spotecicon {
|
|
57
|
+
width: 15px;
|
|
58
|
+
height: 15px;
|
|
59
|
+
color: #fff;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&-preview {
|
|
64
|
+
height: 100%;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
&-upload-progress {
|
|
68
|
+
position: absolute;
|
|
69
|
+
top: 50%;
|
|
70
|
+
left: 0;
|
|
71
|
+
z-index: 2;
|
|
72
|
+
transform: translateY(-34%);
|
|
73
|
+
|
|
74
|
+
.@{ant-prefix}-progress-outer {
|
|
75
|
+
padding: 0 20px;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.@{ant-prefix}-progress-text {
|
|
79
|
+
display: block;
|
|
80
|
+
width: 100%;
|
|
81
|
+
color: #fff;
|
|
82
|
+
text-align: center;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|