ywana-core8 0.0.874 → 0.0.876
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/dist/index.cjs +27 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +27 -6
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +27 -6
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/domain/CollectionPage.js +1 -0
- package/src/widgets/upload/Upload.test.js +1 -1
- package/src/widgets/upload/Uploader.js +13 -3
package/package.json
CHANGED
@@ -26,7 +26,7 @@ const UploadProgressTest = (prop) => {
|
|
26
26
|
const UploaderTest = (prop) => {
|
27
27
|
return (
|
28
28
|
<div style={{ padding: "1rem" }}>
|
29
|
-
<Uploader icon="cloud_upload" target="https://maso.developxp.com/kiosk/api/upload" />
|
29
|
+
<Uploader view="icon" icon="cloud_upload" target="https://maso.developxp.com/kiosk/api/upload" />
|
30
30
|
</div>
|
31
31
|
)
|
32
32
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React, { useState, useMemo } from 'react'
|
2
2
|
import ResumableJS from 'resumablejs'
|
3
|
-
import { UploadArea } from "./UploadArea";
|
3
|
+
import { UploadArea, UploadIcon } from "./UploadArea";
|
4
4
|
import { UploadProgress } from './UploadProgress';
|
5
5
|
import { UPLOAD_STATES } from './UploadStates';
|
6
6
|
import './Uploader.css'
|
@@ -9,7 +9,7 @@ import './Uploader.css'
|
|
9
9
|
/**
|
10
10
|
* Uploader
|
11
11
|
*/
|
12
|
-
export const Uploader = ({ icon, label, target, accept, simultaneousUploads = 1, className, onProgress, onSuccess, onError, onComplete }) => {
|
12
|
+
export const Uploader = ({ icon, label, view="area", target, accept, simultaneousUploads = 1, className, onProgress, onSuccess, onError, onComplete }) => {
|
13
13
|
|
14
14
|
const resumable = useMemo(() => {
|
15
15
|
const config = {
|
@@ -63,9 +63,19 @@ export const Uploader = ({ icon, label, target, accept, simultaneousUploads = 1,
|
|
63
63
|
if (onComplete) onComplete(files)
|
64
64
|
}
|
65
65
|
|
66
|
+
function renderView() {
|
67
|
+
switch (view) {
|
68
|
+
case "area": return <UploadArea resumable={resumable} icon={icon} label={label} />
|
69
|
+
case "icon": return <UploadIcon resumable={resumable} icon={icon} />
|
70
|
+
default: return <UploadArea resumable={resumable} icon={icon} label={label} />
|
71
|
+
}
|
72
|
+
}
|
73
|
+
|
66
74
|
return (
|
67
75
|
<div className={`uploader ${className}`}>
|
68
|
-
{state === UPLOAD_STATES.IDLE ?
|
76
|
+
{state === UPLOAD_STATES.IDLE ? renderView() : <UploadProgress files={files} /> }
|
69
77
|
</div>
|
70
78
|
)
|
71
79
|
}
|
80
|
+
|
81
|
+
|