ywana-core8 0.0.326 → 0.0.329
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 +30 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +30 -13
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +30 -12
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/html/icon.js +5 -3
- package/src/site/dialog.js +5 -3
- package/src/widgets/upload/Upload.test.js +1 -1
- package/src/widgets/upload/UploadArea.js +7 -4
- package/src/widgets/upload/UploadDialog.js +1 -1
- package/src/widgets/upload/Uploader.js +2 -2
package/package.json
CHANGED
package/src/html/icon.js
CHANGED
@@ -4,11 +4,13 @@ import './icon.css'
|
|
4
4
|
/**
|
5
5
|
* Icon
|
6
6
|
*/
|
7
|
-
export const Icon = ({ icon, size = "normal", clickable = false, action }) => {
|
7
|
+
export const Icon = ({ icon, size = "normal", clickable = false, action, eventPropagation = false }) => {
|
8
8
|
|
9
9
|
function click (event) {
|
10
|
-
|
11
|
-
|
10
|
+
if (!eventPropagation) {
|
11
|
+
event.stopPropagation()
|
12
|
+
event.preventDefault();
|
13
|
+
}
|
12
14
|
if (action) action(event)
|
13
15
|
}
|
14
16
|
|
package/src/site/dialog.js
CHANGED
@@ -10,15 +10,17 @@ import './dialog.css'
|
|
10
10
|
*/
|
11
11
|
export const Dialog = (props) => {
|
12
12
|
const site = useContext(SiteContext)
|
13
|
-
const { icon, title = "Dialog", children, onAction, actions, className } = props
|
13
|
+
const { icon, title = "Dialog", children, onAction, actions, className, eventPropagation = false } = props
|
14
14
|
|
15
15
|
function close() {
|
16
16
|
site.closeDialog()
|
17
17
|
}
|
18
18
|
|
19
19
|
function prevent(e) {
|
20
|
-
|
21
|
-
|
20
|
+
if (!eventPropagation) {
|
21
|
+
e.preventDefault()
|
22
|
+
e.stopPropagation()
|
23
|
+
}
|
22
24
|
}
|
23
25
|
|
24
26
|
return (
|
@@ -26,7 +26,7 @@ const UploadProgressTest = (prop) => {
|
|
26
26
|
const UploaderTest = (prop) => {
|
27
27
|
return (
|
28
28
|
<div style={{ padding: "1rem" }}>
|
29
|
-
<Uploader target="https://maso.developxp.com/kiosk/api/upload" />
|
29
|
+
<Uploader icon="cloud_upload" target="https://maso.developxp.com/kiosk/api/upload" />
|
30
30
|
</div>
|
31
31
|
)
|
32
32
|
}
|
@@ -12,7 +12,10 @@ export const UploadArea = (props) => {
|
|
12
12
|
|
13
13
|
useEffect(() => {
|
14
14
|
const { resumable } = props
|
15
|
-
if (resumable && areaElement)
|
15
|
+
if (resumable && areaElement) {
|
16
|
+
resumable.assignDrop(areaElement.current)
|
17
|
+
resumable.assignBrowse(areaElement.current)
|
18
|
+
}
|
16
19
|
}, [])
|
17
20
|
|
18
21
|
const onDragOver = () => {
|
@@ -31,7 +34,7 @@ export const UploadArea = (props) => {
|
|
31
34
|
onDragLeave={onDragLeave}
|
32
35
|
ref={areaElement}
|
33
36
|
>
|
34
|
-
<
|
37
|
+
<Icon icon={icon} clickable eventPropagation={false}/>
|
35
38
|
<label>{label}</label>
|
36
39
|
</div>
|
37
40
|
)
|
@@ -40,14 +43,14 @@ export const UploadArea = (props) => {
|
|
40
43
|
/**
|
41
44
|
* Upload Icon
|
42
45
|
*/
|
43
|
-
const UploadIcon = ({ icon = "folder_open", resumable }) => {
|
46
|
+
export const UploadIcon = ({ icon = "folder_open", resumable }) => {
|
44
47
|
|
45
48
|
const iconElement = useRef()
|
46
49
|
|
47
50
|
useEffect(() => {
|
48
51
|
if (resumable && iconElement.current) {
|
49
|
-
console.log('UploadIcon.effect', resumable, iconElement.current)
|
50
52
|
resumable.assignBrowse(iconElement.current)
|
53
|
+
console.log('uploadicon')
|
51
54
|
}
|
52
55
|
}, [iconElement])
|
53
56
|
|
@@ -29,7 +29,7 @@ export const UploadDialog = ({ label, target, accept, onSuccess, onClose }) => {
|
|
29
29
|
|
30
30
|
const title = <Text use="headline6">{label}</Text>
|
31
31
|
return (
|
32
|
-
<Dialog title={title} open={true} onAction={onAction} actions={actions}>
|
32
|
+
<Dialog title={title} open={true} onAction={onAction} actions={actions} eventPropagation={true}>
|
33
33
|
<Uploader label={label} accept={accept} target={target} onComplete={onComplete} />
|
34
34
|
</Dialog>
|
35
35
|
)
|
@@ -9,7 +9,7 @@ import './Uploader.css'
|
|
9
9
|
/**
|
10
10
|
* Uploader
|
11
11
|
*/
|
12
|
-
export const Uploader = ({ label, target, accept, simultaneousUploads = 1, className, onProgress, onSuccess, onError, onComplete }) => {
|
12
|
+
export const Uploader = ({ icon, label, target, accept, simultaneousUploads = 1, className, onProgress, onSuccess, onError, onComplete }) => {
|
13
13
|
|
14
14
|
const resumable = useMemo(() => {
|
15
15
|
const config = {
|
@@ -65,7 +65,7 @@ export const Uploader = ({ label, target, accept, simultaneousUploads = 1, class
|
|
65
65
|
|
66
66
|
return (
|
67
67
|
<div className={`uploader ${className}`}>
|
68
|
-
{state === UPLOAD_STATES.IDLE ? <UploadArea resumable={resumable} label={label} /> : <UploadProgress files={files} /> }
|
68
|
+
{state === UPLOAD_STATES.IDLE ? <UploadArea resumable={resumable} icon={icon} label={label} /> : <UploadProgress files={files} /> }
|
69
69
|
</div>
|
70
70
|
)
|
71
71
|
}
|