@panneau/field-upload 4.0.62 → 4.0.64
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.d.ts +15 -65
- package/dist/index.js +454 -546
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,106 +1,56 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { MediaType, Label } from '@panneau/core';
|
|
2
|
+
import { Media, MediaType, Label } from '@panneau/core';
|
|
3
|
+
import { UseUppyOptions } from '@panneau/uppy';
|
|
3
4
|
|
|
4
5
|
type MediaSource = 'webcam' | 'facebook' | 'instagram' | 'dropbox' | 'google-drive';
|
|
5
|
-
interface Media$1 {
|
|
6
|
-
filename?: string;
|
|
7
|
-
size?: number;
|
|
8
|
-
url?: string;
|
|
9
|
-
id?: string | number;
|
|
10
|
-
[key: string]: unknown;
|
|
11
|
-
}
|
|
12
|
-
interface UppyProps {
|
|
13
|
-
withUUID?: boolean;
|
|
14
|
-
[key: string]: unknown;
|
|
15
|
-
}
|
|
16
6
|
interface UploadFieldProps {
|
|
17
|
-
|
|
18
|
-
value?: Media$1 | Media$1[] | null;
|
|
7
|
+
value?: Media | Media[] | null;
|
|
19
8
|
name?: string | null;
|
|
20
9
|
types?: MediaType[] | null;
|
|
21
10
|
fileTypes?: string[] | null;
|
|
22
11
|
sources?: MediaSource[];
|
|
23
12
|
withButton?: boolean;
|
|
24
|
-
withFind?: boolean;
|
|
25
13
|
withClearButton?: boolean;
|
|
26
14
|
withoutMedia?: boolean;
|
|
27
15
|
addButtonLabel?: Label | null;
|
|
28
|
-
findButtonLabel?: Label | null;
|
|
29
16
|
clearButtonLabel?: Label | null;
|
|
30
|
-
|
|
17
|
+
multiple?: boolean;
|
|
31
18
|
closeAfterFinish?: boolean;
|
|
32
19
|
maxNumberOfFiles?: number;
|
|
33
20
|
namePath?: string;
|
|
34
21
|
thumbnailPath?: string;
|
|
35
22
|
sizePath?: string;
|
|
36
23
|
linkPath?: string | null;
|
|
37
|
-
|
|
24
|
+
uppyConfig?: UseUppyOptions | null;
|
|
38
25
|
width?: number | null;
|
|
39
26
|
height?: number | null;
|
|
40
27
|
disabled?: boolean;
|
|
41
28
|
uploadDisabled?: boolean;
|
|
42
29
|
outline?: boolean;
|
|
43
30
|
loading?: boolean;
|
|
44
|
-
onChange?: ((value: Media
|
|
31
|
+
onChange?: ((value: Media | Media[] | null) => void) | null;
|
|
45
32
|
onClear?: (() => void) | null;
|
|
46
33
|
onClickAdd?: (() => void) | null;
|
|
47
|
-
|
|
48
|
-
onClose?: ((value: Media$1 | Media$1[] | null) => void) | null;
|
|
34
|
+
onClose?: ((value: Media | Media[] | null) => void) | null;
|
|
49
35
|
className?: string | null;
|
|
50
36
|
}
|
|
51
|
-
declare function UploadField({
|
|
37
|
+
declare function UploadField({ value, types, fileTypes, sources, withButton, withClearButton, withoutMedia, addButtonLabel: initialAddButtonLabel, clearButtonLabel: initialCleanButtonLabel, multiple, closeAfterFinish, maxNumberOfFiles, namePath, thumbnailPath, sizePath, linkPath, uppyConfig, width, height, disabled, uploadDisabled, outline, loading: parentLoading, onChange, onClear, onClickAdd, className, }: UploadFieldProps): react.JSX.Element;
|
|
52
38
|
|
|
53
39
|
declare const _default: {
|
|
54
40
|
id: string;
|
|
55
41
|
component: string;
|
|
56
42
|
}[];
|
|
57
43
|
|
|
58
|
-
|
|
59
|
-
[key: string]: unknown;
|
|
60
|
-
}
|
|
61
|
-
declare function AudioField(props: AudioFieldProps): react.JSX.Element;
|
|
62
|
-
|
|
63
|
-
interface ImageFieldProps {
|
|
64
|
-
[key: string]: unknown;
|
|
65
|
-
}
|
|
66
|
-
declare function ImageField(props: ImageFieldProps): react.JSX.Element;
|
|
44
|
+
declare function AudioUploadField(props: UploadFieldProps): react.JSX.Element;
|
|
67
45
|
|
|
68
|
-
|
|
69
|
-
[key: string]: unknown;
|
|
70
|
-
}
|
|
71
|
-
declare function ImagesField(props: ImagesFieldProps): react.JSX.Element;
|
|
46
|
+
declare function ImageUploadField(props: UploadFieldProps): react.JSX.Element;
|
|
72
47
|
|
|
73
|
-
|
|
74
|
-
[key: string]: unknown;
|
|
75
|
-
}
|
|
76
|
-
declare function VideoField(props: VideoFieldProps): react.JSX.Element;
|
|
48
|
+
declare function ImagesUploadField(props: UploadFieldProps): react.JSX.Element;
|
|
77
49
|
|
|
78
|
-
|
|
79
|
-
[key: string]: unknown;
|
|
80
|
-
}
|
|
81
|
-
declare function DocumentField(props: DocumentFieldProps): react.JSX.Element;
|
|
50
|
+
declare function VideoUploadField(props: UploadFieldProps): react.JSX.Element;
|
|
82
51
|
|
|
83
|
-
|
|
84
|
-
[key: string]: unknown;
|
|
85
|
-
}
|
|
86
|
-
declare function FontField(props: FontFieldProps): react.JSX.Element;
|
|
52
|
+
declare function DocumentUploadField(props: UploadFieldProps): react.JSX.Element;
|
|
87
53
|
|
|
88
|
-
|
|
89
|
-
id?: string | number;
|
|
90
|
-
type?: string;
|
|
91
|
-
published?: boolean;
|
|
92
|
-
featured?: boolean;
|
|
93
|
-
created_at?: string;
|
|
94
|
-
updated_at?: string;
|
|
95
|
-
[key: string]: unknown;
|
|
96
|
-
}
|
|
97
|
-
interface UpdateFileFieldProps {
|
|
98
|
-
value?: Media | null;
|
|
99
|
-
onChange?: ((value: Media | null) => void) | null;
|
|
100
|
-
types?: string[] | null;
|
|
101
|
-
fileTypes?: string[] | null;
|
|
102
|
-
[key: string]: unknown;
|
|
103
|
-
}
|
|
104
|
-
declare function UpdateFileField({ value, onChange, ...props }: UpdateFileFieldProps): react.JSX.Element;
|
|
54
|
+
declare function FontUploadField(props: UploadFieldProps): react.JSX.Element;
|
|
105
55
|
|
|
106
|
-
export { AudioField, DocumentField, FontField, ImageField, ImagesField,
|
|
56
|
+
export { AudioUploadField as AudioField, DocumentUploadField as DocumentField, FontUploadField as FontField, ImageUploadField as ImageField, ImagesUploadField as ImagesField, VideoUploadField as VideoField, UploadField as default, _default as definition };
|
package/dist/index.js
CHANGED
|
@@ -1,321 +1,425 @@
|
|
|
1
|
+
import { c } from 'react/compiler-runtime';
|
|
1
2
|
import { UppyContextProvider } from '@uppy/react';
|
|
2
3
|
import Dashboard from '@uppy/react/dashboard';
|
|
3
4
|
import DashboardModal from '@uppy/react/dashboard-modal';
|
|
4
5
|
import classNames from 'classnames';
|
|
5
6
|
import isArray from 'lodash-es/isArray';
|
|
6
7
|
import isObject from 'lodash-es/isObject';
|
|
7
|
-
import {
|
|
8
|
+
import { useState, useRef, useEffect } from 'react';
|
|
8
9
|
import { FormattedMessage } from 'react-intl';
|
|
9
|
-
import { useQuery } from '@panneau/core/hooks';
|
|
10
10
|
import Button from '@panneau/element-button';
|
|
11
11
|
import Label from '@panneau/element-label';
|
|
12
|
-
import
|
|
13
|
-
import ModalResourceItems from '@panneau/modal-resource-items';
|
|
12
|
+
import { MediaCards } from '@panneau/element-media-card';
|
|
14
13
|
import { useUppy } from '@panneau/uppy';
|
|
15
14
|
import '@uppy/core/css/style.css';
|
|
16
15
|
import '@uppy/dashboard/css/style.css';
|
|
17
|
-
import { jsxs, jsx
|
|
18
|
-
import { c } from 'react/compiler-runtime';
|
|
16
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
19
17
|
|
|
20
18
|
var styles = {"dashboard":"panneau-field-upload-dashboard","dashboardModal":"panneau-field-upload-dashboardModal"};
|
|
21
19
|
|
|
22
|
-
// import classNames from 'classnames';
|
|
23
20
|
const DEFAULT_TYPES = ['audio', 'image', 'video'];
|
|
24
21
|
const DEFAULT_SOURCES = ['webcam', 'facebook', 'instagram', 'dropbox', 'google-drive'];
|
|
25
|
-
function UploadField({
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
22
|
+
function UploadField(t0) {
|
|
23
|
+
const $ = c(86);
|
|
24
|
+
const {
|
|
25
|
+
value: t1,
|
|
26
|
+
types: t2,
|
|
27
|
+
fileTypes: t3,
|
|
28
|
+
sources: t4,
|
|
29
|
+
withButton: t5,
|
|
30
|
+
withClearButton: t6,
|
|
31
|
+
withoutMedia: t7,
|
|
32
|
+
addButtonLabel: t8,
|
|
33
|
+
clearButtonLabel: t9,
|
|
34
|
+
multiple: t10,
|
|
35
|
+
closeAfterFinish: t11,
|
|
36
|
+
maxNumberOfFiles: t12,
|
|
37
|
+
namePath: t13,
|
|
38
|
+
thumbnailPath: t14,
|
|
39
|
+
sizePath: t15,
|
|
40
|
+
linkPath: t16,
|
|
41
|
+
uppyConfig: t17,
|
|
42
|
+
width: t18,
|
|
43
|
+
height: t19,
|
|
44
|
+
disabled: t20,
|
|
45
|
+
uploadDisabled: t21,
|
|
46
|
+
outline: t22,
|
|
47
|
+
loading: t23,
|
|
48
|
+
onChange: t24,
|
|
49
|
+
onClear: t25,
|
|
50
|
+
onClickAdd: t26,
|
|
51
|
+
className: t27
|
|
52
|
+
} = t0;
|
|
53
|
+
const value = t1 === undefined ? null : t1;
|
|
54
|
+
const types = t2 === undefined ? DEFAULT_TYPES : t2;
|
|
55
|
+
const fileTypes = t3 === undefined ? null : t3;
|
|
56
|
+
const sources = t4 === undefined ? DEFAULT_SOURCES : t4;
|
|
57
|
+
const withButton = t5 === undefined ? false : t5;
|
|
58
|
+
const withClearButton = t6 === undefined ? false : t6;
|
|
59
|
+
const withoutMedia = t7 === undefined ? false : t7;
|
|
60
|
+
const initialAddButtonLabel = t8 === undefined ? null : t8;
|
|
61
|
+
const initialCleanButtonLabel = t9 === undefined ? null : t9;
|
|
62
|
+
const multiple = t10 === undefined ? false : t10;
|
|
63
|
+
const closeAfterFinish = t11 === undefined ? true : t11;
|
|
64
|
+
const maxNumberOfFiles = t12 === undefined ? 1 : t12;
|
|
65
|
+
const namePath = t13 === undefined ? "name" : t13;
|
|
66
|
+
const thumbnailPath = t14 === undefined ? "thumbnail_url" : t14;
|
|
67
|
+
const sizePath = t15 === undefined ? "metadata.size" : t15;
|
|
68
|
+
const linkPath = t16 === undefined ? null : t16;
|
|
69
|
+
const uppyConfig = t17 === undefined ? null : t17;
|
|
70
|
+
const width = t18 === undefined ? null : t18;
|
|
71
|
+
const height = t19 === undefined ? 300 : t19;
|
|
72
|
+
const disabled = t20 === undefined ? false : t20;
|
|
73
|
+
const uploadDisabled = t21 === undefined ? false : t21;
|
|
74
|
+
const outline = t22 === undefined ? true : t22;
|
|
75
|
+
const parentLoading = t23 === undefined ? false : t23;
|
|
76
|
+
const onChange = t24 === undefined ? null : t24;
|
|
77
|
+
const onClear = t25 === undefined ? null : t25;
|
|
78
|
+
const onClickAdd = t26 === undefined ? null : t26;
|
|
79
|
+
const className = t27 === undefined ? null : t27;
|
|
80
|
+
let t28;
|
|
81
|
+
if ($[0] !== initialAddButtonLabel) {
|
|
82
|
+
t28 = initialAddButtonLabel || /*#__PURE__*/jsx(FormattedMessage, {
|
|
83
|
+
id: "BeKVq6"
|
|
84
|
+
});
|
|
85
|
+
$[0] = initialAddButtonLabel;
|
|
86
|
+
$[1] = t28;
|
|
87
|
+
} else {
|
|
88
|
+
t28 = $[1];
|
|
89
|
+
}
|
|
90
|
+
const addButtonLabel = t28;
|
|
91
|
+
let t29;
|
|
92
|
+
if ($[2] !== initialCleanButtonLabel) {
|
|
93
|
+
t29 = initialCleanButtonLabel || /*#__PURE__*/jsx(FormattedMessage, {
|
|
94
|
+
id: "odaCUe"
|
|
95
|
+
});
|
|
96
|
+
$[2] = initialCleanButtonLabel;
|
|
97
|
+
$[3] = t29;
|
|
98
|
+
} else {
|
|
99
|
+
t29 = $[3];
|
|
100
|
+
}
|
|
101
|
+
const clearButtonLabel = t29;
|
|
102
|
+
const mergeData = _temp;
|
|
103
|
+
let t30;
|
|
104
|
+
if ($[4] !== multiple || $[5] !== onChange) {
|
|
105
|
+
t30 = response => {
|
|
106
|
+
let newValue_0 = null;
|
|
107
|
+
if (isArray(response)) {
|
|
108
|
+
if (multiple) {
|
|
109
|
+
newValue_0 = response;
|
|
110
|
+
} else {
|
|
111
|
+
const [first] = response;
|
|
112
|
+
newValue_0 = first;
|
|
113
|
+
}
|
|
83
114
|
} else {
|
|
84
|
-
|
|
85
|
-
|
|
115
|
+
if (response && response.successful) {
|
|
116
|
+
newValue_0 = response.successful.length > 0 ? response.successful[0].response.body : null;
|
|
117
|
+
}
|
|
86
118
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
119
|
+
if (isArray(newValue_0)) {
|
|
120
|
+
newValue_0 = newValue_0.map(val => mergeData(val));
|
|
121
|
+
} else {
|
|
122
|
+
if (newValue_0 !== null) {
|
|
123
|
+
newValue_0 = mergeData(newValue_0);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if (onChange !== null) {
|
|
127
|
+
onChange(newValue_0);
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
$[4] = multiple;
|
|
131
|
+
$[5] = onChange;
|
|
132
|
+
$[6] = t30;
|
|
133
|
+
} else {
|
|
134
|
+
t30 = $[6];
|
|
135
|
+
}
|
|
136
|
+
const onComplete = t30;
|
|
137
|
+
let t31;
|
|
138
|
+
if ($[7] !== types) {
|
|
139
|
+
t31 = types !== null ? types.join(".") : ["audio", "image", "video"].join(".");
|
|
140
|
+
$[7] = types;
|
|
141
|
+
$[8] = t31;
|
|
142
|
+
} else {
|
|
143
|
+
t31 = $[8];
|
|
144
|
+
}
|
|
145
|
+
const typesString = t31;
|
|
146
|
+
let t32;
|
|
147
|
+
bb0: {
|
|
101
148
|
if (fileTypes !== null) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
return typesString.split('.').map(type => `${type}/*`);
|
|
105
|
-
}, [typesString, fileTypes]);
|
|
106
|
-
const uppyFinalProps = useMemo(() => ({
|
|
107
|
-
maxNumberOfFiles: allowMultipleUploads && maxNumberOfFiles === 1 ? 50 : maxNumberOfFiles,
|
|
108
|
-
allowedFileTypes,
|
|
109
|
-
sources,
|
|
110
|
-
...uppyProps,
|
|
111
|
-
allowMultipleUploads,
|
|
112
|
-
autoProceed: true,
|
|
113
|
-
onComplete
|
|
114
|
-
}), [uppyProps, allowedFileTypes, allowMultipleUploads, maxNumberOfFiles, sources, onComplete]);
|
|
115
|
-
const uppy = useUppy(uppyFinalProps);
|
|
116
|
-
const [modalOpened, setModalOpened] = useState(false);
|
|
117
|
-
const openModal = useCallback(() => {
|
|
118
|
-
setModalOpened(!modalOpened);
|
|
119
|
-
}, [modalOpened, setModalOpened]);
|
|
120
|
-
const closeModal = useCallback(() => {
|
|
121
|
-
setModalOpened(false);
|
|
122
|
-
if (uppy !== null) {
|
|
123
|
-
uppy.cancelAll({
|
|
124
|
-
reason: 'user'
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
}, [uppy, setModalOpened]);
|
|
128
|
-
const onClickClear = useCallback(() => {
|
|
129
|
-
if (onClear !== null) {
|
|
130
|
-
onClear();
|
|
131
|
-
}
|
|
132
|
-
if (onChange !== null) {
|
|
133
|
-
onChange(null);
|
|
134
|
-
}
|
|
135
|
-
if (uppy !== null) {
|
|
136
|
-
uppy.cancelAll({
|
|
137
|
-
reason: 'user'
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
}, [uppy, onClear]);
|
|
141
|
-
const onClickRemove = useCallback(idx => {
|
|
142
|
-
if (onChange !== null && isArray(value) && value.length > 1) {
|
|
143
|
-
onChange(value.filter((v, i) => i !== idx));
|
|
144
|
-
} else if (onChange !== null) {
|
|
145
|
-
onChange(null);
|
|
146
|
-
}
|
|
147
|
-
}, [value, onChange]);
|
|
148
|
-
const values = useMemo(() => {
|
|
149
|
-
if (isArray(value)) {
|
|
150
|
-
return value;
|
|
149
|
+
t32 = fileTypes;
|
|
150
|
+
break bb0;
|
|
151
151
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
const [resourceModalOpen, setResourceModalOpen] = useState(false);
|
|
158
|
-
const showResourceModal = resource !== null && withFind && resourceModalOpen;
|
|
159
|
-
const openResourceModal = useCallback(() => {
|
|
160
|
-
setResourceModalOpen(true);
|
|
161
|
-
}, [resourceModalOpen, setResourceModalOpen]);
|
|
162
|
-
const [modalItems, setModalItems] = useState([]);
|
|
163
|
-
const closeResourceModal = useCallback(() => {
|
|
164
|
-
setResourceModalOpen(false);
|
|
165
|
-
setModalItems([]);
|
|
166
|
-
}, [resourceModalOpen, setResourceModalOpen, setModalItems]);
|
|
167
|
-
const finalOnClickFind = useCallback(() => {
|
|
168
|
-
if (onClickFind !== null) {
|
|
169
|
-
onClickFind();
|
|
152
|
+
let t33;
|
|
153
|
+
if ($[9] !== typesString) {
|
|
154
|
+
t33 = typesString.split(".").map(_temp2);
|
|
155
|
+
$[9] = typesString;
|
|
156
|
+
$[10] = t33;
|
|
170
157
|
} else {
|
|
171
|
-
|
|
158
|
+
t33 = $[10];
|
|
172
159
|
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
160
|
+
t32 = t33;
|
|
161
|
+
}
|
|
162
|
+
const allowedFileTypes = t32;
|
|
163
|
+
const t33 = multiple && maxNumberOfFiles === 1 ? 50 : maxNumberOfFiles;
|
|
164
|
+
let t34;
|
|
165
|
+
if ($[11] !== allowedFileTypes || $[12] !== multiple || $[13] !== onComplete || $[14] !== sources || $[15] !== t33 || $[16] !== uppyConfig) {
|
|
166
|
+
t34 = {
|
|
167
|
+
maxNumberOfFiles: t33,
|
|
168
|
+
allowedFileTypes,
|
|
169
|
+
sources,
|
|
170
|
+
...uppyConfig,
|
|
171
|
+
allowMultipleUploads: multiple,
|
|
172
|
+
autoProceed: true,
|
|
173
|
+
onComplete
|
|
174
|
+
};
|
|
175
|
+
$[11] = allowedFileTypes;
|
|
176
|
+
$[12] = multiple;
|
|
177
|
+
$[13] = onComplete;
|
|
178
|
+
$[14] = sources;
|
|
179
|
+
$[15] = t33;
|
|
180
|
+
$[16] = uppyConfig;
|
|
181
|
+
$[17] = t34;
|
|
182
|
+
} else {
|
|
183
|
+
t34 = $[17];
|
|
184
|
+
}
|
|
185
|
+
const uppyFinalProps = t34;
|
|
186
|
+
const uppy = useUppy(uppyFinalProps);
|
|
187
|
+
const [modalOpened, setModalOpened] = useState(false);
|
|
188
|
+
let t35;
|
|
189
|
+
if ($[18] !== modalOpened) {
|
|
190
|
+
t35 = () => {
|
|
191
|
+
setModalOpened(!modalOpened);
|
|
192
|
+
};
|
|
193
|
+
$[18] = modalOpened;
|
|
194
|
+
$[19] = t35;
|
|
195
|
+
} else {
|
|
196
|
+
t35 = $[19];
|
|
197
|
+
}
|
|
198
|
+
const openModal = t35;
|
|
199
|
+
let t36;
|
|
200
|
+
if ($[20] !== uppy) {
|
|
201
|
+
t36 = () => {
|
|
202
|
+
setModalOpened(false);
|
|
203
|
+
if (uppy !== null) {
|
|
204
|
+
uppy.cancelAll();
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
$[20] = uppy;
|
|
208
|
+
$[21] = t36;
|
|
209
|
+
} else {
|
|
210
|
+
t36 = $[21];
|
|
211
|
+
}
|
|
212
|
+
const closeModal = t36;
|
|
213
|
+
let t37;
|
|
214
|
+
if ($[22] !== onChange || $[23] !== onClear || $[24] !== uppy) {
|
|
215
|
+
t37 = () => {
|
|
216
|
+
if (onClear !== null) {
|
|
217
|
+
onClear();
|
|
218
|
+
}
|
|
219
|
+
if (onChange !== null) {
|
|
220
|
+
onChange(null);
|
|
221
|
+
}
|
|
222
|
+
if (uppy !== null) {
|
|
223
|
+
uppy.cancelAll();
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
$[22] = onChange;
|
|
227
|
+
$[23] = onClear;
|
|
228
|
+
$[24] = uppy;
|
|
229
|
+
$[25] = t37;
|
|
230
|
+
} else {
|
|
231
|
+
t37 = $[25];
|
|
232
|
+
}
|
|
233
|
+
const onClickClear = t37;
|
|
234
|
+
let t38;
|
|
235
|
+
if ($[26] !== onChange || $[27] !== value) {
|
|
236
|
+
t38 = idx => {
|
|
237
|
+
if (onChange !== null && isArray(value) && value.length > 1) {
|
|
238
|
+
onChange(value.filter((v, i) => i !== idx));
|
|
239
|
+
} else {
|
|
240
|
+
if (onChange !== null) {
|
|
241
|
+
onChange(null);
|
|
191
242
|
}
|
|
192
|
-
} else if (newValue_1 !== null && isArray(newValue_1)) {
|
|
193
|
-
setModalItems(newValue_1);
|
|
194
243
|
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
setModalItems([]);
|
|
205
|
-
}
|
|
206
|
-
}, [onChange, setResourceModalOpen, modalItems, allowMultipleUploads, setModalItems]);
|
|
207
|
-
const initialQuery = useMemo(() => ({
|
|
208
|
-
types
|
|
209
|
-
}), [types]);
|
|
210
|
-
const {
|
|
211
|
-
query: listQuery,
|
|
212
|
-
onPageChange: onListPageChange,
|
|
213
|
-
onQueryChange: onListQueryChange,
|
|
214
|
-
onQueryReset: onListQueryReset
|
|
215
|
-
} = useQuery(initialQuery, true);
|
|
216
|
-
const finalOnPageChange = useCallback((e, pageNumber = null) => {
|
|
217
|
-
e.preventDefault();
|
|
218
|
-
e.stopPropagation();
|
|
219
|
-
onListPageChange(pageNumber);
|
|
220
|
-
}, [onListPageChange]);
|
|
221
|
-
const finalOnQueryChange = useCallback(newQuery => {
|
|
222
|
-
onListQueryChange(newQuery);
|
|
223
|
-
}, [onListQueryChange]);
|
|
244
|
+
};
|
|
245
|
+
$[26] = onChange;
|
|
246
|
+
$[27] = value;
|
|
247
|
+
$[28] = t38;
|
|
248
|
+
} else {
|
|
249
|
+
t38 = $[28];
|
|
250
|
+
}
|
|
251
|
+
const onClickRemove = t38;
|
|
252
|
+
const hasMedia = isArray(value) ? value.length > 0 : value !== null;
|
|
224
253
|
const containerRef = useRef(null);
|
|
225
|
-
|
|
226
|
-
// Keep this stable, uppy doesnt like changes
|
|
227
254
|
const [finalUppy, setFinalUppy] = useState(null);
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
255
|
+
let t39;
|
|
256
|
+
let t40;
|
|
257
|
+
if ($[29] !== finalUppy || $[30] !== uppy) {
|
|
258
|
+
t39 = () => {
|
|
259
|
+
if (uppy !== null && finalUppy === null) {
|
|
260
|
+
setFinalUppy(uppy);
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
t40 = [uppy, finalUppy];
|
|
264
|
+
$[29] = finalUppy;
|
|
265
|
+
$[30] = uppy;
|
|
266
|
+
$[31] = t39;
|
|
267
|
+
$[32] = t40;
|
|
268
|
+
} else {
|
|
269
|
+
t39 = $[31];
|
|
270
|
+
t40 = $[32];
|
|
271
|
+
}
|
|
272
|
+
useEffect(t39, t40);
|
|
235
273
|
const [loading, setLoading] = useState(false);
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
274
|
+
let t41;
|
|
275
|
+
if ($[33] === Symbol.for("react.memo_cache_sentinel")) {
|
|
276
|
+
t41 = () => {
|
|
277
|
+
setLoading(true);
|
|
278
|
+
};
|
|
279
|
+
$[33] = t41;
|
|
280
|
+
} else {
|
|
281
|
+
t41 = $[33];
|
|
282
|
+
}
|
|
283
|
+
const startLoading = t41;
|
|
284
|
+
let t42;
|
|
285
|
+
if ($[34] === Symbol.for("react.memo_cache_sentinel")) {
|
|
286
|
+
t42 = () => {
|
|
287
|
+
setLoading(false);
|
|
288
|
+
};
|
|
289
|
+
$[34] = t42;
|
|
290
|
+
} else {
|
|
291
|
+
t42 = $[34];
|
|
292
|
+
}
|
|
293
|
+
const endLoading = t42;
|
|
294
|
+
let t43;
|
|
295
|
+
let t44;
|
|
296
|
+
if ($[35] !== uppy) {
|
|
297
|
+
t43 = () => {
|
|
251
298
|
if (uppy !== null) {
|
|
252
|
-
uppy.
|
|
253
|
-
uppy.
|
|
254
|
-
uppy.
|
|
255
|
-
uppy.
|
|
256
|
-
uppy.off('cancell-all', endLoading);
|
|
299
|
+
uppy.on("upload", startLoading);
|
|
300
|
+
uppy.on("complete", endLoading);
|
|
301
|
+
uppy.on("upload-error", endLoading);
|
|
302
|
+
uppy.on("error", endLoading);
|
|
257
303
|
}
|
|
304
|
+
return () => {
|
|
305
|
+
if (uppy !== null) {
|
|
306
|
+
uppy.off("upload", startLoading);
|
|
307
|
+
uppy.off("complete", endLoading);
|
|
308
|
+
uppy.off("upload-error", endLoading);
|
|
309
|
+
uppy.off("error", endLoading);
|
|
310
|
+
}
|
|
311
|
+
};
|
|
258
312
|
};
|
|
259
|
-
|
|
313
|
+
t44 = [uppy, startLoading, endLoading];
|
|
314
|
+
$[35] = uppy;
|
|
315
|
+
$[36] = t43;
|
|
316
|
+
$[37] = t44;
|
|
317
|
+
} else {
|
|
318
|
+
t43 = $[36];
|
|
319
|
+
t44 = $[37];
|
|
320
|
+
}
|
|
321
|
+
useEffect(t43, t44);
|
|
260
322
|
const finalLoading = loading || parentLoading;
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
value: values,
|
|
323
|
+
let t45;
|
|
324
|
+
if ($[38] !== disabled || $[39] !== hasMedia || $[40] !== linkPath || $[41] !== namePath || $[42] !== onClickRemove || $[43] !== sizePath || $[44] !== thumbnailPath || $[45] !== value || $[46] !== withoutMedia) {
|
|
325
|
+
t45 = !withoutMedia && hasMedia ? /*#__PURE__*/jsx(MediaCards, {
|
|
326
|
+
value: value,
|
|
266
327
|
namePath: namePath,
|
|
267
328
|
thumbnailPath: thumbnailPath,
|
|
268
329
|
sizePath: sizePath,
|
|
269
330
|
linkPath: linkPath,
|
|
270
331
|
disabled: disabled,
|
|
271
332
|
onClickRemove: onClickRemove
|
|
272
|
-
}) : null
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
333
|
+
}) : null;
|
|
334
|
+
$[38] = disabled;
|
|
335
|
+
$[39] = hasMedia;
|
|
336
|
+
$[40] = linkPath;
|
|
337
|
+
$[41] = namePath;
|
|
338
|
+
$[42] = onClickRemove;
|
|
339
|
+
$[43] = sizePath;
|
|
340
|
+
$[44] = thumbnailPath;
|
|
341
|
+
$[45] = value;
|
|
342
|
+
$[46] = withoutMedia;
|
|
343
|
+
$[47] = t45;
|
|
344
|
+
} else {
|
|
345
|
+
t45 = $[47];
|
|
346
|
+
}
|
|
347
|
+
let t46;
|
|
348
|
+
if ($[48] === Symbol.for("react.memo_cache_sentinel")) {
|
|
349
|
+
t46 = classNames("d-flex");
|
|
350
|
+
$[48] = t46;
|
|
351
|
+
} else {
|
|
352
|
+
t46 = $[48];
|
|
353
|
+
}
|
|
354
|
+
let t47;
|
|
355
|
+
if ($[49] !== clearButtonLabel || $[50] !== hasMedia || $[51] !== onClickClear || $[52] !== withClearButton || $[53] !== withoutMedia) {
|
|
356
|
+
t47 = withClearButton && !withoutMedia && hasMedia ? /*#__PURE__*/jsx(Button, {
|
|
357
|
+
type: "button",
|
|
358
|
+
theme: "primary",
|
|
359
|
+
onClick: onClickClear,
|
|
360
|
+
children: /*#__PURE__*/jsx(Label, {
|
|
361
|
+
children: clearButtonLabel
|
|
362
|
+
})
|
|
363
|
+
}) : null;
|
|
364
|
+
$[49] = clearButtonLabel;
|
|
365
|
+
$[50] = hasMedia;
|
|
366
|
+
$[51] = onClickClear;
|
|
367
|
+
$[52] = withClearButton;
|
|
368
|
+
$[53] = withoutMedia;
|
|
369
|
+
$[54] = t47;
|
|
370
|
+
} else {
|
|
371
|
+
t47 = $[54];
|
|
372
|
+
}
|
|
373
|
+
let t48;
|
|
374
|
+
if ($[55] !== addButtonLabel || $[56] !== disabled || $[57] !== finalLoading || $[58] !== hasMedia || $[59] !== multiple || $[60] !== onClickAdd || $[61] !== openModal || $[62] !== outline || $[63] !== withButton || $[64] !== withoutMedia) {
|
|
375
|
+
t48 = withButton && (withoutMedia || !hasMedia || multiple) ? /*#__PURE__*/jsx(Button, {
|
|
376
|
+
type: "button",
|
|
377
|
+
theme: "primary",
|
|
378
|
+
icon: finalLoading ? "loading" : "upload",
|
|
379
|
+
iconPosition: "right",
|
|
380
|
+
onClick: onClickAdd || openModal,
|
|
381
|
+
disabled: finalLoading || disabled,
|
|
382
|
+
outline: outline,
|
|
383
|
+
children: /*#__PURE__*/jsx(Label, {
|
|
384
|
+
children: finalLoading ? /*#__PURE__*/jsx(FormattedMessage, {
|
|
385
|
+
id: "NozDYd"
|
|
386
|
+
}) : addButtonLabel
|
|
387
|
+
})
|
|
388
|
+
}) : null;
|
|
389
|
+
$[55] = addButtonLabel;
|
|
390
|
+
$[56] = disabled;
|
|
391
|
+
$[57] = finalLoading;
|
|
392
|
+
$[58] = hasMedia;
|
|
393
|
+
$[59] = multiple;
|
|
394
|
+
$[60] = onClickAdd;
|
|
395
|
+
$[61] = openModal;
|
|
396
|
+
$[62] = outline;
|
|
397
|
+
$[63] = withButton;
|
|
398
|
+
$[64] = withoutMedia;
|
|
399
|
+
$[65] = t48;
|
|
400
|
+
} else {
|
|
401
|
+
t48 = $[65];
|
|
402
|
+
}
|
|
403
|
+
let t49;
|
|
404
|
+
if ($[66] !== t47 || $[67] !== t48) {
|
|
405
|
+
t49 = /*#__PURE__*/jsxs("div", {
|
|
406
|
+
className: t46,
|
|
407
|
+
children: [t47, t48]
|
|
408
|
+
});
|
|
409
|
+
$[66] = t47;
|
|
410
|
+
$[67] = t48;
|
|
411
|
+
$[68] = t49;
|
|
412
|
+
} else {
|
|
413
|
+
t49 = $[68];
|
|
414
|
+
}
|
|
415
|
+
let t50;
|
|
416
|
+
if ($[69] !== closeAfterFinish || $[70] !== closeModal || $[71] !== disabled || $[72] !== finalUppy || $[73] !== hasMedia || $[74] !== height || $[75] !== modalOpened || $[76] !== sources || $[77] !== uploadDisabled || $[78] !== width || $[79] !== withButton) {
|
|
417
|
+
t50 = finalUppy !== null ? /*#__PURE__*/jsxs(UppyContextProvider, {
|
|
310
418
|
uppy: finalUppy,
|
|
311
419
|
children: [!uploadDisabled && !hasMedia && !withButton && finalUppy !== null ? /*#__PURE__*/jsx("div", {
|
|
312
420
|
className: styles.dashboard,
|
|
313
421
|
children: /*#__PURE__*/jsx(Dashboard, {
|
|
314
|
-
uppy: finalUppy
|
|
315
|
-
// {...(containerWidth !== null && height !== null
|
|
316
|
-
// ? { width: containerWidth }
|
|
317
|
-
// : null)}
|
|
318
|
-
,
|
|
422
|
+
uppy: finalUppy,
|
|
319
423
|
...(width !== null ? {
|
|
320
424
|
width
|
|
321
425
|
} : null),
|
|
@@ -324,12 +428,9 @@ function UploadField({
|
|
|
324
428
|
} : null),
|
|
325
429
|
disabled: disabled,
|
|
326
430
|
plugins: sources,
|
|
327
|
-
inline: true,
|
|
328
|
-
showProgressDetails: true,
|
|
329
|
-
areInsidesReadyToBeVisible: true,
|
|
330
431
|
proudlyDisplayPoweredByUppy: false
|
|
331
432
|
})
|
|
332
|
-
}) : null, !
|
|
433
|
+
}) : null, !uploadDisabled && withButton && finalUppy !== null && modalOpened ? /*#__PURE__*/jsx(DashboardModal, {
|
|
333
434
|
uppy: finalUppy,
|
|
334
435
|
className: styles.dashboardModal,
|
|
335
436
|
plugins: sources,
|
|
@@ -338,80 +439,79 @@ function UploadField({
|
|
|
338
439
|
onRequestClose: closeModal,
|
|
339
440
|
proudlyDisplayPoweredByUppy: false,
|
|
340
441
|
closeModalOnClickOutside: true,
|
|
341
|
-
areInsidesReadyToBeVisible: true,
|
|
342
|
-
isDashboardVisible: true,
|
|
343
|
-
showProgressDetails: true,
|
|
344
|
-
showAddFilesPanel: true,
|
|
345
442
|
doneButtonHandler: closeModal,
|
|
346
443
|
closeAfterFinish: closeAfterFinish
|
|
347
444
|
}) : null]
|
|
348
|
-
}) : null
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
445
|
+
}) : null;
|
|
446
|
+
$[69] = closeAfterFinish;
|
|
447
|
+
$[70] = closeModal;
|
|
448
|
+
$[71] = disabled;
|
|
449
|
+
$[72] = finalUppy;
|
|
450
|
+
$[73] = hasMedia;
|
|
451
|
+
$[74] = height;
|
|
452
|
+
$[75] = modalOpened;
|
|
453
|
+
$[76] = sources;
|
|
454
|
+
$[77] = uploadDisabled;
|
|
455
|
+
$[78] = width;
|
|
456
|
+
$[79] = withButton;
|
|
457
|
+
$[80] = t50;
|
|
458
|
+
} else {
|
|
459
|
+
t50 = $[80];
|
|
460
|
+
}
|
|
461
|
+
let t51;
|
|
462
|
+
if ($[81] !== className || $[82] !== t45 || $[83] !== t49 || $[84] !== t50) {
|
|
463
|
+
t51 = /*#__PURE__*/jsxs("div", {
|
|
464
|
+
className: className,
|
|
465
|
+
ref: containerRef,
|
|
466
|
+
children: [t45, t49, t50]
|
|
467
|
+
});
|
|
468
|
+
$[81] = className;
|
|
469
|
+
$[82] = t45;
|
|
470
|
+
$[83] = t49;
|
|
471
|
+
$[84] = t50;
|
|
472
|
+
$[85] = t51;
|
|
473
|
+
} else {
|
|
474
|
+
t51 = $[85];
|
|
475
|
+
}
|
|
476
|
+
return t51;
|
|
477
|
+
}
|
|
478
|
+
function _temp2(type) {
|
|
479
|
+
return `${type}/*`;
|
|
480
|
+
}
|
|
481
|
+
function _temp(newValue) {
|
|
482
|
+
if (isObject(newValue) && isObject(newValue.response) && newValue.response.status === 200 && newValue.response.body !== null) {
|
|
483
|
+
return {
|
|
484
|
+
...newValue,
|
|
485
|
+
...(newValue.response.body || null)
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
return newValue;
|
|
392
489
|
}
|
|
393
490
|
|
|
394
491
|
var definition = [{
|
|
395
492
|
id: 'upload',
|
|
396
493
|
component: 'Upload'
|
|
397
494
|
}, {
|
|
398
|
-
id: 'audio',
|
|
399
|
-
component: '
|
|
495
|
+
id: 'audio-upload',
|
|
496
|
+
component: 'AudioUpload'
|
|
497
|
+
}, {
|
|
498
|
+
id: 'image-upload',
|
|
499
|
+
component: 'ImageUpload'
|
|
400
500
|
}, {
|
|
401
|
-
id: '
|
|
402
|
-
component: '
|
|
501
|
+
id: 'images-upload',
|
|
502
|
+
component: 'ImagesUpload'
|
|
403
503
|
}, {
|
|
404
|
-
id: 'video',
|
|
405
|
-
component: '
|
|
504
|
+
id: 'video-upload',
|
|
505
|
+
component: 'VideoUpload'
|
|
406
506
|
}, {
|
|
407
|
-
id: 'document',
|
|
408
|
-
component: '
|
|
507
|
+
id: 'document-upload',
|
|
508
|
+
component: 'DocumentUpload'
|
|
409
509
|
}, {
|
|
410
|
-
id: 'font',
|
|
411
|
-
component: '
|
|
510
|
+
id: 'font-upload',
|
|
511
|
+
component: 'FontUpload'
|
|
412
512
|
}];
|
|
413
513
|
|
|
414
|
-
function
|
|
514
|
+
function AudioUploadField(props) {
|
|
415
515
|
const $ = c(3);
|
|
416
516
|
let t0;
|
|
417
517
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
@@ -420,12 +520,11 @@ function AudioField(props) {
|
|
|
420
520
|
} else {
|
|
421
521
|
t0 = $[0];
|
|
422
522
|
}
|
|
423
|
-
const types = t0;
|
|
424
523
|
let t1;
|
|
425
524
|
if ($[1] !== props) {
|
|
426
525
|
t1 = /*#__PURE__*/jsx(UploadField, {
|
|
427
526
|
...props,
|
|
428
|
-
types:
|
|
527
|
+
types: t0
|
|
429
528
|
});
|
|
430
529
|
$[1] = props;
|
|
431
530
|
$[2] = t1;
|
|
@@ -435,7 +534,7 @@ function AudioField(props) {
|
|
|
435
534
|
return t1;
|
|
436
535
|
}
|
|
437
536
|
|
|
438
|
-
function
|
|
537
|
+
function ImageUploadField(props) {
|
|
439
538
|
const $ = c(3);
|
|
440
539
|
let t0;
|
|
441
540
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
@@ -444,12 +543,11 @@ function ImageField(props) {
|
|
|
444
543
|
} else {
|
|
445
544
|
t0 = $[0];
|
|
446
545
|
}
|
|
447
|
-
const types = t0;
|
|
448
546
|
let t1;
|
|
449
547
|
if ($[1] !== props) {
|
|
450
548
|
t1 = /*#__PURE__*/jsx(UploadField, {
|
|
451
549
|
...props,
|
|
452
|
-
types:
|
|
550
|
+
types: t0
|
|
453
551
|
});
|
|
454
552
|
$[1] = props;
|
|
455
553
|
$[2] = t1;
|
|
@@ -459,7 +557,7 @@ function ImageField(props) {
|
|
|
459
557
|
return t1;
|
|
460
558
|
}
|
|
461
559
|
|
|
462
|
-
function
|
|
560
|
+
function ImagesUploadField(props) {
|
|
463
561
|
const $ = c(3);
|
|
464
562
|
let t0;
|
|
465
563
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
@@ -468,13 +566,12 @@ function ImagesField(props) {
|
|
|
468
566
|
} else {
|
|
469
567
|
t0 = $[0];
|
|
470
568
|
}
|
|
471
|
-
const types = t0;
|
|
472
569
|
let t1;
|
|
473
570
|
if ($[1] !== props) {
|
|
474
571
|
t1 = /*#__PURE__*/jsx(UploadField, {
|
|
475
572
|
...props,
|
|
476
|
-
types:
|
|
477
|
-
|
|
573
|
+
types: t0,
|
|
574
|
+
multiple: true
|
|
478
575
|
});
|
|
479
576
|
$[1] = props;
|
|
480
577
|
$[2] = t1;
|
|
@@ -484,7 +581,7 @@ function ImagesField(props) {
|
|
|
484
581
|
return t1;
|
|
485
582
|
}
|
|
486
583
|
|
|
487
|
-
function
|
|
584
|
+
function VideoUploadField(props) {
|
|
488
585
|
const $ = c(3);
|
|
489
586
|
let t0;
|
|
490
587
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
@@ -493,12 +590,11 @@ function VideoField(props) {
|
|
|
493
590
|
} else {
|
|
494
591
|
t0 = $[0];
|
|
495
592
|
}
|
|
496
|
-
const types = t0;
|
|
497
593
|
let t1;
|
|
498
594
|
if ($[1] !== props) {
|
|
499
595
|
t1 = /*#__PURE__*/jsx(UploadField, {
|
|
500
596
|
...props,
|
|
501
|
-
types:
|
|
597
|
+
types: t0
|
|
502
598
|
});
|
|
503
599
|
$[1] = props;
|
|
504
600
|
$[2] = t1;
|
|
@@ -508,7 +604,7 @@ function VideoField(props) {
|
|
|
508
604
|
return t1;
|
|
509
605
|
}
|
|
510
606
|
|
|
511
|
-
function
|
|
607
|
+
function DocumentUploadField(props) {
|
|
512
608
|
const $ = c(4);
|
|
513
609
|
let t0;
|
|
514
610
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
@@ -517,7 +613,6 @@ function DocumentField(props) {
|
|
|
517
613
|
} else {
|
|
518
614
|
t0 = $[0];
|
|
519
615
|
}
|
|
520
|
-
const fileTypes = t0;
|
|
521
616
|
let t1;
|
|
522
617
|
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
523
618
|
t1 = ["document"];
|
|
@@ -525,13 +620,12 @@ function DocumentField(props) {
|
|
|
525
620
|
} else {
|
|
526
621
|
t1 = $[1];
|
|
527
622
|
}
|
|
528
|
-
const types = t1;
|
|
529
623
|
let t2;
|
|
530
624
|
if ($[2] !== props) {
|
|
531
625
|
t2 = /*#__PURE__*/jsx(UploadField, {
|
|
626
|
+
fileTypes: t0,
|
|
532
627
|
...props,
|
|
533
|
-
|
|
534
|
-
types: types
|
|
628
|
+
types: t1
|
|
535
629
|
});
|
|
536
630
|
$[2] = props;
|
|
537
631
|
$[3] = t2;
|
|
@@ -541,7 +635,7 @@ function DocumentField(props) {
|
|
|
541
635
|
return t2;
|
|
542
636
|
}
|
|
543
637
|
|
|
544
|
-
function
|
|
638
|
+
function FontUploadField(props) {
|
|
545
639
|
const $ = c(3);
|
|
546
640
|
let t0;
|
|
547
641
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
@@ -550,12 +644,11 @@ function FontField(props) {
|
|
|
550
644
|
} else {
|
|
551
645
|
t0 = $[0];
|
|
552
646
|
}
|
|
553
|
-
const fileTypes = t0;
|
|
554
647
|
let t1;
|
|
555
648
|
if ($[1] !== props) {
|
|
556
649
|
t1 = /*#__PURE__*/jsx(UploadField, {
|
|
557
|
-
|
|
558
|
-
|
|
650
|
+
fileTypes: t0,
|
|
651
|
+
...props
|
|
559
652
|
});
|
|
560
653
|
$[1] = props;
|
|
561
654
|
$[2] = t1;
|
|
@@ -565,189 +658,4 @@ function FontField(props) {
|
|
|
565
658
|
return t1;
|
|
566
659
|
}
|
|
567
660
|
|
|
568
|
-
|
|
569
|
-
const $ = c(24);
|
|
570
|
-
let props;
|
|
571
|
-
let t1;
|
|
572
|
-
let t2;
|
|
573
|
-
if ($[0] !== t0) {
|
|
574
|
-
({
|
|
575
|
-
value: t1,
|
|
576
|
-
onChange: t2,
|
|
577
|
-
...props
|
|
578
|
-
} = t0);
|
|
579
|
-
$[0] = t0;
|
|
580
|
-
$[1] = props;
|
|
581
|
-
$[2] = t1;
|
|
582
|
-
$[3] = t2;
|
|
583
|
-
} else {
|
|
584
|
-
props = $[1];
|
|
585
|
-
t1 = $[2];
|
|
586
|
-
t2 = $[3];
|
|
587
|
-
}
|
|
588
|
-
const value = t1 === undefined ? null : t1;
|
|
589
|
-
const [newValue, setNewValue] = useState(null);
|
|
590
|
-
const [visibleFile, setVisibleFile] = useState(null);
|
|
591
|
-
let t3;
|
|
592
|
-
if ($[4] !== value) {
|
|
593
|
-
t3 = value || {};
|
|
594
|
-
$[4] = value;
|
|
595
|
-
$[5] = t3;
|
|
596
|
-
} else {
|
|
597
|
-
t3 = $[5];
|
|
598
|
-
}
|
|
599
|
-
const {
|
|
600
|
-
id: previousId,
|
|
601
|
-
type: t4
|
|
602
|
-
} = t3;
|
|
603
|
-
const type = t4 === undefined ? null : t4;
|
|
604
|
-
let t5;
|
|
605
|
-
if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
|
|
606
|
-
t5 = t6 => {
|
|
607
|
-
const uploadedFile = t6 === undefined ? null : t6;
|
|
608
|
-
if (uploadedFile !== null) {
|
|
609
|
-
setVisibleFile(uploadedFile);
|
|
610
|
-
}
|
|
611
|
-
setNewValue(uploadedFile);
|
|
612
|
-
};
|
|
613
|
-
$[6] = t5;
|
|
614
|
-
} else {
|
|
615
|
-
t5 = $[6];
|
|
616
|
-
}
|
|
617
|
-
const onUploadChange = t5;
|
|
618
|
-
let t6;
|
|
619
|
-
if ($[7] !== previousId) {
|
|
620
|
-
t6 = {
|
|
621
|
-
meta: {
|
|
622
|
-
previousId
|
|
623
|
-
}
|
|
624
|
-
};
|
|
625
|
-
$[7] = previousId;
|
|
626
|
-
$[8] = t6;
|
|
627
|
-
} else {
|
|
628
|
-
t6 = $[8];
|
|
629
|
-
}
|
|
630
|
-
const uppyProps = t6;
|
|
631
|
-
let t7;
|
|
632
|
-
bb0: {
|
|
633
|
-
if (type === "image") {
|
|
634
|
-
let t8;
|
|
635
|
-
if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
|
|
636
|
-
t8 = {
|
|
637
|
-
types: ["image"]
|
|
638
|
-
};
|
|
639
|
-
$[9] = t8;
|
|
640
|
-
} else {
|
|
641
|
-
t8 = $[9];
|
|
642
|
-
}
|
|
643
|
-
t7 = t8;
|
|
644
|
-
break bb0;
|
|
645
|
-
}
|
|
646
|
-
if (type === "audio") {
|
|
647
|
-
let t8;
|
|
648
|
-
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
|
649
|
-
t8 = {
|
|
650
|
-
types: ["audio"]
|
|
651
|
-
};
|
|
652
|
-
$[10] = t8;
|
|
653
|
-
} else {
|
|
654
|
-
t8 = $[10];
|
|
655
|
-
}
|
|
656
|
-
t7 = t8;
|
|
657
|
-
break bb0;
|
|
658
|
-
}
|
|
659
|
-
if (type === "video") {
|
|
660
|
-
let t8;
|
|
661
|
-
if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
|
|
662
|
-
t8 = {
|
|
663
|
-
types: ["video"]
|
|
664
|
-
};
|
|
665
|
-
$[11] = t8;
|
|
666
|
-
} else {
|
|
667
|
-
t8 = $[11];
|
|
668
|
-
}
|
|
669
|
-
t7 = t8;
|
|
670
|
-
break bb0;
|
|
671
|
-
}
|
|
672
|
-
if (type === "document") {
|
|
673
|
-
let t8;
|
|
674
|
-
if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
|
|
675
|
-
t8 = {
|
|
676
|
-
types: [],
|
|
677
|
-
fileTypes: [".pdf"]
|
|
678
|
-
};
|
|
679
|
-
$[12] = t8;
|
|
680
|
-
} else {
|
|
681
|
-
t8 = $[12];
|
|
682
|
-
}
|
|
683
|
-
t7 = t8;
|
|
684
|
-
break bb0;
|
|
685
|
-
}
|
|
686
|
-
t7 = null;
|
|
687
|
-
}
|
|
688
|
-
const uploadProps = t7;
|
|
689
|
-
const t8 = visibleFile || value;
|
|
690
|
-
let t9;
|
|
691
|
-
if ($[13] !== t8) {
|
|
692
|
-
t9 = /*#__PURE__*/jsx("div", {
|
|
693
|
-
className: "mb-3",
|
|
694
|
-
children: /*#__PURE__*/jsx(MediaCard, {
|
|
695
|
-
value: t8,
|
|
696
|
-
withoutDescription: true
|
|
697
|
-
})
|
|
698
|
-
});
|
|
699
|
-
$[13] = t8;
|
|
700
|
-
$[14] = t9;
|
|
701
|
-
} else {
|
|
702
|
-
t9 = $[14];
|
|
703
|
-
}
|
|
704
|
-
let t10;
|
|
705
|
-
if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
|
|
706
|
-
t10 = /*#__PURE__*/jsx(FormattedMessage, {
|
|
707
|
-
id: "daHjZg"
|
|
708
|
-
});
|
|
709
|
-
$[15] = t10;
|
|
710
|
-
} else {
|
|
711
|
-
t10 = $[15];
|
|
712
|
-
}
|
|
713
|
-
let t11;
|
|
714
|
-
if ($[16] !== newValue || $[17] !== props || $[18] !== uploadProps || $[19] !== uppyProps) {
|
|
715
|
-
t11 = /*#__PURE__*/jsx("div", {
|
|
716
|
-
className: "mb-3",
|
|
717
|
-
children: /*#__PURE__*/jsx(UploadField, {
|
|
718
|
-
...props,
|
|
719
|
-
...uploadProps,
|
|
720
|
-
addButtonLabel: t10,
|
|
721
|
-
allowMultipleUploads: false,
|
|
722
|
-
linkPath: "panneauUrl",
|
|
723
|
-
onChange: onUploadChange,
|
|
724
|
-
onClose: onUploadChange,
|
|
725
|
-
maxNumberOfFiles: 1,
|
|
726
|
-
value: newValue,
|
|
727
|
-
withButton: true,
|
|
728
|
-
uppyProps: uppyProps
|
|
729
|
-
})
|
|
730
|
-
});
|
|
731
|
-
$[16] = newValue;
|
|
732
|
-
$[17] = props;
|
|
733
|
-
$[18] = uploadProps;
|
|
734
|
-
$[19] = uppyProps;
|
|
735
|
-
$[20] = t11;
|
|
736
|
-
} else {
|
|
737
|
-
t11 = $[20];
|
|
738
|
-
}
|
|
739
|
-
let t12;
|
|
740
|
-
if ($[21] !== t11 || $[22] !== t9) {
|
|
741
|
-
t12 = /*#__PURE__*/jsxs(Fragment, {
|
|
742
|
-
children: [t9, t11]
|
|
743
|
-
});
|
|
744
|
-
$[21] = t11;
|
|
745
|
-
$[22] = t9;
|
|
746
|
-
$[23] = t12;
|
|
747
|
-
} else {
|
|
748
|
-
t12 = $[23];
|
|
749
|
-
}
|
|
750
|
-
return t12;
|
|
751
|
-
}
|
|
752
|
-
|
|
753
|
-
export { AudioField, DocumentField, FontField, ImageField, ImagesField, UpdateFileField, VideoField, UploadField as default, definition };
|
|
661
|
+
export { AudioUploadField as AudioField, DocumentUploadField as DocumentField, FontUploadField as FontField, ImageUploadField as ImageField, ImagesUploadField as ImagesField, VideoUploadField as VideoField, UploadField as default, definition };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@panneau/field-upload",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.64",
|
|
4
4
|
"description": "An Upload field",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -65,10 +65,10 @@
|
|
|
65
65
|
"@panneau/core": "^4.0.58",
|
|
66
66
|
"@panneau/element-button": "^4.0.62",
|
|
67
67
|
"@panneau/element-label": "^4.0.58",
|
|
68
|
-
"@panneau/element-media-card": "^4.0.
|
|
69
|
-
"@panneau/modal-resource-items": "^4.0.
|
|
68
|
+
"@panneau/element-media-card": "^4.0.63",
|
|
69
|
+
"@panneau/modal-resource-items": "^4.0.64",
|
|
70
70
|
"@panneau/themes": "^4.0.58",
|
|
71
|
-
"@panneau/uppy": "^4.0.
|
|
71
|
+
"@panneau/uppy": "^4.0.63",
|
|
72
72
|
"@uppy/core": "^5.1.1",
|
|
73
73
|
"@uppy/dashboard": "^5.0.4",
|
|
74
74
|
"@uppy/react": "^5.1.1",
|
|
@@ -89,5 +89,5 @@
|
|
|
89
89
|
"publishConfig": {
|
|
90
90
|
"access": "public"
|
|
91
91
|
},
|
|
92
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "989601b7dc15b368b6b5f12970aaa60f8e1aa132"
|
|
93
93
|
}
|