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