@panneau/field-upload 4.0.39 → 4.0.40-alpha.1
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.js +924 -443
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
3
|
-
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
4
|
-
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
1
|
+
import { c } from 'react/compiler-runtime';
|
|
5
2
|
import { UppyContextProvider } from '@uppy/react';
|
|
6
3
|
import Dashboard from '@uppy/react/dashboard';
|
|
7
4
|
import DashboardModal from '@uppy/react/dashboard-modal';
|
|
8
5
|
import classNames from 'classnames';
|
|
9
6
|
import isArray from 'lodash/isArray';
|
|
10
7
|
import isObject from 'lodash/isObject';
|
|
11
|
-
import {
|
|
8
|
+
import { useState, useRef, useEffect } from 'react';
|
|
12
9
|
import { FormattedMessage } from 'react-intl';
|
|
13
10
|
import { useQuery } from '@panneau/core/hooks';
|
|
14
11
|
import Button from '@panneau/element-button';
|
|
@@ -19,323 +16,516 @@ import { useUppy } from '@panneau/uppy';
|
|
|
19
16
|
import '@uppy/core/css/style.css';
|
|
20
17
|
import '@uppy/dashboard/css/style.css';
|
|
21
18
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
22
|
-
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
23
19
|
|
|
24
20
|
var styles = {"container":"panneau-field-upload-container","dashboard":"panneau-field-upload-dashboard","dashboardModal":"panneau-field-upload-dashboardModal"};
|
|
25
21
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
function UploadField(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
value
|
|
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
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
"
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
22
|
+
const DEFAULT_TYPES = ['audio', 'image', 'video'];
|
|
23
|
+
const DEFAULT_SOURCES = ['webcam', 'facebook', 'instagram', 'dropbox', 'google-drive'];
|
|
24
|
+
function UploadField(t0) {
|
|
25
|
+
const $ = c(123);
|
|
26
|
+
const {
|
|
27
|
+
resource: t1,
|
|
28
|
+
value: t2,
|
|
29
|
+
name: t3,
|
|
30
|
+
types: t4,
|
|
31
|
+
fileTypes: t5,
|
|
32
|
+
sources: t6,
|
|
33
|
+
withButton: t7,
|
|
34
|
+
withFind: t8,
|
|
35
|
+
withClearButton: t9,
|
|
36
|
+
withoutMedia: t10,
|
|
37
|
+
addButtonLabel: t11,
|
|
38
|
+
findButtonLabel: t12,
|
|
39
|
+
clearButtonLabel: t13,
|
|
40
|
+
allowMultipleUploads: t14,
|
|
41
|
+
closeAfterFinish: t15,
|
|
42
|
+
maxNumberOfFiles: t16,
|
|
43
|
+
namePath: t17,
|
|
44
|
+
thumbnailPath: t18,
|
|
45
|
+
sizePath: t19,
|
|
46
|
+
linkPath: t20,
|
|
47
|
+
uppyProps: t21,
|
|
48
|
+
width: t22,
|
|
49
|
+
height: t23,
|
|
50
|
+
disabled: t24,
|
|
51
|
+
uploadDisabled: t25,
|
|
52
|
+
outline: t26,
|
|
53
|
+
loading: t27,
|
|
54
|
+
onChange: t28,
|
|
55
|
+
onClear: t29,
|
|
56
|
+
onClickAdd: t30,
|
|
57
|
+
onClickFind: t31,
|
|
58
|
+
className: t32
|
|
59
|
+
} = t0;
|
|
60
|
+
const resource = t1 === undefined ? "medias" : t1;
|
|
61
|
+
const value = t2 === undefined ? null : t2;
|
|
62
|
+
const name = t3 === undefined ? null : t3;
|
|
63
|
+
const types = t4 === undefined ? DEFAULT_TYPES : t4;
|
|
64
|
+
const fileTypes = t5 === undefined ? null : t5;
|
|
65
|
+
const sources = t6 === undefined ? DEFAULT_SOURCES : t6;
|
|
66
|
+
const withButton = t7 === undefined ? false : t7;
|
|
67
|
+
const withFind = t8 === undefined ? false : t8;
|
|
68
|
+
const withClearButton = t9 === undefined ? false : t9;
|
|
69
|
+
const withoutMedia = t10 === undefined ? false : t10;
|
|
70
|
+
const initialAddButtonLabel = t11 === undefined ? null : t11;
|
|
71
|
+
const initialFindButtonLabel = t12 === undefined ? null : t12;
|
|
72
|
+
const initialCleanButtonLabel = t13 === undefined ? null : t13;
|
|
73
|
+
const allowMultipleUploads = t14 === undefined ? false : t14;
|
|
74
|
+
const closeAfterFinish = t15 === undefined ? true : t15;
|
|
75
|
+
const maxNumberOfFiles = t16 === undefined ? 1 : t16;
|
|
76
|
+
const namePath = t17 === undefined ? "name" : t17;
|
|
77
|
+
const thumbnailPath = t18 === undefined ? "thumbnail_url" : t18;
|
|
78
|
+
const sizePath = t19 === undefined ? "metadata.size" : t19;
|
|
79
|
+
const linkPath = t20 === undefined ? null : t20;
|
|
80
|
+
const uppyProps = t21 === undefined ? null : t21;
|
|
81
|
+
const width = t22 === undefined ? null : t22;
|
|
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));
|
|
126
144
|
} else {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
145
|
+
if (newValue_0 !== null) {
|
|
146
|
+
newValue_0 = mergeData(newValue_0);
|
|
147
|
+
}
|
|
130
148
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
+
if (onChange !== null) {
|
|
150
|
+
onChange(newValue_0);
|
|
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: {
|
|
149
171
|
if (fileTypes !== null) {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
return typesString.split('.').map(function (type) {
|
|
153
|
-
return "".concat(type, "/*");
|
|
154
|
-
});
|
|
155
|
-
}, [typesString, fileTypes]);
|
|
156
|
-
var uppyFinalProps = useMemo(function () {
|
|
157
|
-
return _objectSpread(_objectSpread({
|
|
158
|
-
maxNumberOfFiles: allowMultipleUploads && maxNumberOfFiles === 1 ? 50 : maxNumberOfFiles,
|
|
159
|
-
allowedFileTypes: allowedFileTypes,
|
|
160
|
-
sources: sources
|
|
161
|
-
}, uppyProps), {}, {
|
|
162
|
-
allowMultipleUploads: allowMultipleUploads,
|
|
163
|
-
autoProceed: true,
|
|
164
|
-
onComplete: onComplete
|
|
165
|
-
});
|
|
166
|
-
}, [uppyProps, allowedFileTypes, allowMultipleUploads, maxNumberOfFiles, sources, onComplete]);
|
|
167
|
-
var uppy = useUppy(uppyFinalProps);
|
|
168
|
-
var _useState = useState(false),
|
|
169
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
170
|
-
modalOpened = _useState2[0],
|
|
171
|
-
setModalOpened = _useState2[1];
|
|
172
|
-
var openModal = useCallback(function () {
|
|
173
|
-
setModalOpened(!modalOpened);
|
|
174
|
-
}, [modalOpened, setModalOpened]);
|
|
175
|
-
var closeModal = useCallback(function () {
|
|
176
|
-
setModalOpened(false);
|
|
177
|
-
if (uppy !== null) {
|
|
178
|
-
uppy.cancelAll({
|
|
179
|
-
reason: 'user'
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
}, [uppy, setModalOpened]);
|
|
183
|
-
var onClickClear = useCallback(function () {
|
|
184
|
-
if (onClear !== null) {
|
|
185
|
-
onClear();
|
|
186
|
-
}
|
|
187
|
-
if (uppy !== null) {
|
|
188
|
-
uppy.cancelAll({
|
|
189
|
-
reason: 'user'
|
|
190
|
-
});
|
|
172
|
+
t38 = fileTypes;
|
|
173
|
+
break bb0;
|
|
191
174
|
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}));
|
|
198
|
-
} else if (onChange !== null) {
|
|
199
|
-
onChange(null);
|
|
200
|
-
}
|
|
201
|
-
}, [value, onChange]);
|
|
202
|
-
var values = useMemo(function () {
|
|
203
|
-
if (isArray(value)) {
|
|
204
|
-
return value;
|
|
205
|
-
}
|
|
206
|
-
return value !== null ? [value] : null;
|
|
207
|
-
}, [value]);
|
|
208
|
-
|
|
209
|
-
// Resource-modal-picker
|
|
210
|
-
var hasMedia = values !== null && values.length > 0;
|
|
211
|
-
var _useState3 = useState(false),
|
|
212
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
213
|
-
resourceModalOpen = _useState4[0],
|
|
214
|
-
setResourceModalOpen = _useState4[1];
|
|
215
|
-
var showResourceModal = resource !== null && withFind && resourceModalOpen;
|
|
216
|
-
var openResourceModal = useCallback(function () {
|
|
217
|
-
setResourceModalOpen(true);
|
|
218
|
-
}, [resourceModalOpen, setResourceModalOpen]);
|
|
219
|
-
var _useState5 = useState([]),
|
|
220
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
221
|
-
modalItems = _useState6[0],
|
|
222
|
-
setModalItems = _useState6[1];
|
|
223
|
-
var closeResourceModal = useCallback(function () {
|
|
224
|
-
setResourceModalOpen(false);
|
|
225
|
-
setModalItems([]);
|
|
226
|
-
}, [resourceModalOpen, setResourceModalOpen, setModalItems]);
|
|
227
|
-
var finalOnClickFind = useCallback(function () {
|
|
228
|
-
if (onClickFind !== null) {
|
|
229
|
-
onClickFind();
|
|
175
|
+
let t39;
|
|
176
|
+
if ($[11] !== typesString) {
|
|
177
|
+
t39 = typesString.split(".").map(_temp2);
|
|
178
|
+
$[11] = typesString;
|
|
179
|
+
$[12] = t39;
|
|
230
180
|
} else {
|
|
231
|
-
|
|
181
|
+
t39 = $[12];
|
|
232
182
|
}
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
183
|
+
t38 = t39;
|
|
184
|
+
}
|
|
185
|
+
const allowedFileTypes = t38;
|
|
186
|
+
const t39 = allowMultipleUploads && maxNumberOfFiles === 1 ? 50 : maxNumberOfFiles;
|
|
187
|
+
let t40;
|
|
188
|
+
if ($[13] !== allowMultipleUploads || $[14] !== allowedFileTypes || $[15] !== onComplete || $[16] !== sources || $[17] !== t39 || $[18] !== uppyProps) {
|
|
189
|
+
t40 = {
|
|
190
|
+
maxNumberOfFiles: t39,
|
|
191
|
+
allowedFileTypes,
|
|
192
|
+
sources,
|
|
193
|
+
...uppyProps,
|
|
194
|
+
allowMultipleUploads,
|
|
195
|
+
autoProceed: true,
|
|
196
|
+
onComplete
|
|
197
|
+
};
|
|
198
|
+
$[13] = allowMultipleUploads;
|
|
199
|
+
$[14] = allowedFileTypes;
|
|
200
|
+
$[15] = onComplete;
|
|
201
|
+
$[16] = sources;
|
|
202
|
+
$[17] = t39;
|
|
203
|
+
$[18] = uppyProps;
|
|
204
|
+
$[19] = t40;
|
|
205
|
+
} else {
|
|
206
|
+
t40 = $[19];
|
|
207
|
+
}
|
|
208
|
+
const uppyFinalProps = t40;
|
|
209
|
+
const uppy = useUppy(uppyFinalProps);
|
|
210
|
+
const [modalOpened, setModalOpened] = useState(false);
|
|
211
|
+
let t41;
|
|
212
|
+
if ($[20] !== modalOpened) {
|
|
213
|
+
t41 = () => {
|
|
214
|
+
setModalOpened(!modalOpened);
|
|
215
|
+
};
|
|
216
|
+
$[20] = modalOpened;
|
|
217
|
+
$[21] = t41;
|
|
218
|
+
} else {
|
|
219
|
+
t41 = $[21];
|
|
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);
|
|
257
265
|
}
|
|
258
|
-
} else if (newValue !== null && isArray(newValue)) {
|
|
259
|
-
setModalItems(newValue);
|
|
260
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;
|
|
280
|
+
}
|
|
281
|
+
let t46;
|
|
282
|
+
if ($[30] !== value) {
|
|
283
|
+
t46 = value !== null ? [value] : null;
|
|
284
|
+
$[30] = value;
|
|
285
|
+
$[31] = t46;
|
|
261
286
|
} else {
|
|
262
|
-
|
|
287
|
+
t46 = $[31];
|
|
263
288
|
}
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
289
|
+
t45 = t46;
|
|
290
|
+
}
|
|
291
|
+
const values = t45;
|
|
292
|
+
const hasMedia = values !== null && values.length > 0;
|
|
293
|
+
const [resourceModalOpen, setResourceModalOpen] = useState(false);
|
|
294
|
+
const showResourceModal = resource !== null && withFind && resourceModalOpen;
|
|
295
|
+
let t46;
|
|
296
|
+
if ($[32] === Symbol.for("react.memo_cache_sentinel")) {
|
|
297
|
+
t46 = () => {
|
|
298
|
+
setResourceModalOpen(true);
|
|
299
|
+
};
|
|
300
|
+
$[32] = t46;
|
|
301
|
+
} else {
|
|
302
|
+
t46 = $[32];
|
|
303
|
+
}
|
|
304
|
+
const openResourceModal = t46;
|
|
305
|
+
let t47;
|
|
306
|
+
if ($[33] === Symbol.for("react.memo_cache_sentinel")) {
|
|
307
|
+
t47 = [];
|
|
308
|
+
$[33] = t47;
|
|
309
|
+
} else {
|
|
310
|
+
t47 = $[33];
|
|
311
|
+
}
|
|
312
|
+
const [modalItems, setModalItems] = useState(t47);
|
|
313
|
+
let t48;
|
|
314
|
+
if ($[34] === Symbol.for("react.memo_cache_sentinel")) {
|
|
315
|
+
t48 = () => {
|
|
269
316
|
setResourceModalOpen(false);
|
|
270
317
|
setModalItems([]);
|
|
271
|
-
}
|
|
272
|
-
}, [onChange, setResourceModalOpen, modalItems, allowMultipleUploads, setModalItems]);
|
|
273
|
-
var initialQuery = useMemo(function () {
|
|
274
|
-
return {
|
|
275
|
-
types: types
|
|
276
318
|
};
|
|
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
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
319
|
+
$[34] = t48;
|
|
320
|
+
} else {
|
|
321
|
+
t48 = $[34];
|
|
322
|
+
}
|
|
323
|
+
const closeResourceModal = t48;
|
|
324
|
+
let t49;
|
|
325
|
+
if ($[35] !== onClickFind) {
|
|
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);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
} else {
|
|
374
|
+
setModalItems(newValue_1);
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
$[37] = allowMultipleUploads;
|
|
378
|
+
$[38] = modalItems;
|
|
379
|
+
$[39] = t50;
|
|
380
|
+
} else {
|
|
381
|
+
t50 = $[39];
|
|
382
|
+
}
|
|
383
|
+
const onSelectionChange = t50;
|
|
384
|
+
let t51;
|
|
385
|
+
if ($[40] !== modalItems || $[41] !== onChange) {
|
|
386
|
+
t51 = () => {
|
|
387
|
+
if (onChange !== null) {
|
|
388
|
+
onChange(modalItems);
|
|
389
|
+
setResourceModalOpen(false);
|
|
390
|
+
setModalItems([]);
|
|
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;
|
|
411
|
+
const {
|
|
412
|
+
query: listQuery,
|
|
413
|
+
onPageChange: onListPageChange,
|
|
414
|
+
onQueryChange: onListQueryChange,
|
|
415
|
+
onQueryReset: onListQueryReset
|
|
416
|
+
} = useQuery(initialQuery, true);
|
|
417
|
+
let t53;
|
|
418
|
+
if ($[45] !== onListPageChange) {
|
|
419
|
+
t53 = (e, t54) => {
|
|
420
|
+
const pageNumber = t54 === undefined ? null : t54;
|
|
421
|
+
e.preventDefault();
|
|
422
|
+
e.stopPropagation();
|
|
423
|
+
onListPageChange(pageNumber);
|
|
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;
|
|
442
|
+
const containerRef = useRef(null);
|
|
443
|
+
const [finalUppy, setFinalUppy] = useState(null);
|
|
444
|
+
let t55;
|
|
445
|
+
let t56;
|
|
446
|
+
if ($[49] !== finalUppy || $[50] !== uppy) {
|
|
447
|
+
t55 = () => {
|
|
448
|
+
if (uppy !== null && finalUppy === null) {
|
|
449
|
+
setFinalUppy(uppy);
|
|
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);
|
|
462
|
+
const [loading, setLoading] = useState(false);
|
|
463
|
+
let t57;
|
|
464
|
+
if ($[53] === Symbol.for("react.memo_cache_sentinel")) {
|
|
465
|
+
t57 = () => {
|
|
466
|
+
setLoading(true);
|
|
467
|
+
};
|
|
468
|
+
$[53] = t57;
|
|
469
|
+
} else {
|
|
470
|
+
t57 = $[53];
|
|
471
|
+
}
|
|
472
|
+
const startLoading = t57;
|
|
473
|
+
let t58;
|
|
474
|
+
if ($[54] === Symbol.for("react.memo_cache_sentinel")) {
|
|
475
|
+
t58 = () => {
|
|
476
|
+
setLoading(false);
|
|
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 = () => {
|
|
325
487
|
if (uppy !== null) {
|
|
326
|
-
uppy.
|
|
327
|
-
uppy.
|
|
328
|
-
uppy.
|
|
329
|
-
uppy.
|
|
330
|
-
uppy.
|
|
488
|
+
uppy.on("upload", startLoading);
|
|
489
|
+
uppy.on("complete", endLoading);
|
|
490
|
+
uppy.on("upload-error", endLoading);
|
|
491
|
+
uppy.on("error", endLoading);
|
|
492
|
+
uppy.on("cancell-all", endLoading);
|
|
331
493
|
}
|
|
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
|
+
};
|
|
332
503
|
};
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
504
|
+
t60 = [uppy, startLoading, endLoading];
|
|
505
|
+
$[55] = uppy;
|
|
506
|
+
$[56] = t59;
|
|
507
|
+
$[57] = t60;
|
|
508
|
+
} else {
|
|
509
|
+
t59 = $[56];
|
|
510
|
+
t60 = $[57];
|
|
511
|
+
}
|
|
512
|
+
useEffect(t59, t60);
|
|
513
|
+
const finalLoading = loading || parentLoading;
|
|
514
|
+
const t61 = className !== null;
|
|
515
|
+
let t62;
|
|
516
|
+
if ($[58] !== className || $[59] !== t61) {
|
|
517
|
+
t62 = classNames([styles.container, {
|
|
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, {
|
|
339
529
|
value: values,
|
|
340
530
|
namePath: namePath,
|
|
341
531
|
thumbnailPath: thumbnailPath,
|
|
@@ -343,7 +533,23 @@ function UploadField(_ref) {
|
|
|
343
533
|
linkPath: linkPath,
|
|
344
534
|
disabled: disabled,
|
|
345
535
|
onClickRemove: onClickRemove
|
|
346
|
-
}) : null
|
|
536
|
+
}) : null;
|
|
537
|
+
$[61] = disabled;
|
|
538
|
+
$[62] = hasMedia;
|
|
539
|
+
$[63] = linkPath;
|
|
540
|
+
$[64] = namePath;
|
|
541
|
+
$[65] = onClickRemove;
|
|
542
|
+
$[66] = sizePath;
|
|
543
|
+
$[67] = thumbnailPath;
|
|
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", {
|
|
347
553
|
className: "row mt-2",
|
|
348
554
|
children: /*#__PURE__*/jsx("div", {
|
|
349
555
|
className: "col-auto",
|
|
@@ -356,26 +562,36 @@ function UploadField(_ref) {
|
|
|
356
562
|
})
|
|
357
563
|
})
|
|
358
564
|
})
|
|
359
|
-
}) : null
|
|
565
|
+
}) : null;
|
|
566
|
+
$[71] = clearButtonLabel;
|
|
567
|
+
$[72] = hasMedia;
|
|
568
|
+
$[73] = onClickClear;
|
|
569
|
+
$[74] = withClearButton;
|
|
570
|
+
$[75] = withoutMedia;
|
|
571
|
+
$[76] = t64;
|
|
572
|
+
} else {
|
|
573
|
+
t64 = $[76];
|
|
574
|
+
}
|
|
575
|
+
let t65;
|
|
576
|
+
if ($[77] !== closeAfterFinish || $[78] !== closeModal || $[79] !== finalUppy || $[80] !== hasMedia || $[81] !== height || $[82] !== modalOpened || $[83] !== showResourceModal || $[84] !== sources || $[85] !== uploadDisabled || $[86] !== width || $[87] !== withButton) {
|
|
577
|
+
t65 = finalUppy !== null ? /*#__PURE__*/jsxs(UppyContextProvider, {
|
|
360
578
|
uppy: finalUppy,
|
|
361
579
|
children: [!uploadDisabled && !hasMedia && !withButton && finalUppy !== null ? /*#__PURE__*/jsx("div", {
|
|
362
580
|
className: styles.dashboard,
|
|
363
|
-
children: /*#__PURE__*/jsx(Dashboard,
|
|
364
|
-
uppy: finalUppy
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
height: height
|
|
372
|
-
} : null), {}, {
|
|
581
|
+
children: /*#__PURE__*/jsx(Dashboard, {
|
|
582
|
+
uppy: finalUppy,
|
|
583
|
+
...(width !== null ? {
|
|
584
|
+
width
|
|
585
|
+
} : null),
|
|
586
|
+
...(height !== null ? {
|
|
587
|
+
height
|
|
588
|
+
} : null),
|
|
373
589
|
plugins: sources,
|
|
374
590
|
inline: true,
|
|
375
591
|
showProgressDetails: true,
|
|
376
592
|
areInsidesReadyToBeVisible: true,
|
|
377
593
|
proudlyDisplayPoweredByUppy: false
|
|
378
|
-
})
|
|
594
|
+
})
|
|
379
595
|
}) : null, !showResourceModal && !uploadDisabled && withButton && finalUppy !== null && modalOpened ? /*#__PURE__*/jsx(DashboardModal, {
|
|
380
596
|
uppy: finalUppy,
|
|
381
597
|
className: styles.dashboardModal,
|
|
@@ -391,7 +607,25 @@ function UploadField(_ref) {
|
|
|
391
607
|
doneButtonHandler: closeModal,
|
|
392
608
|
closeAfterFinish: closeAfterFinish
|
|
393
609
|
}) : null]
|
|
394
|
-
}) : 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", {
|
|
395
629
|
className: "row",
|
|
396
630
|
children: [withButton ? /*#__PURE__*/jsx("div", {
|
|
397
631
|
className: "col-auto mb-2 pe-0",
|
|
@@ -399,18 +633,14 @@ function UploadField(_ref) {
|
|
|
399
633
|
id: "trigger-uppy",
|
|
400
634
|
type: "button",
|
|
401
635
|
theme: "primary",
|
|
402
|
-
icon: finalLoading ?
|
|
636
|
+
icon: finalLoading ? "loading" : "upload",
|
|
403
637
|
iconPosition: "right",
|
|
404
638
|
onClick: onClickAdd || openModal,
|
|
405
639
|
disabled: finalLoading || disabled,
|
|
406
640
|
outline: outline,
|
|
407
641
|
children: /*#__PURE__*/jsx(Label, {
|
|
408
642
|
children: finalLoading ? /*#__PURE__*/jsx(FormattedMessage, {
|
|
409
|
-
id: "NozDYd"
|
|
410
|
-
defaultMessage: [{
|
|
411
|
-
"type": 0,
|
|
412
|
-
"value": "Uploading"
|
|
413
|
-
}]
|
|
643
|
+
id: "NozDYd"
|
|
414
644
|
}) : addButtonLabel
|
|
415
645
|
})
|
|
416
646
|
})
|
|
@@ -429,8 +659,28 @@ function UploadField(_ref) {
|
|
|
429
659
|
})
|
|
430
660
|
})
|
|
431
661
|
}) : null]
|
|
432
|
-
}) : null
|
|
433
|
-
|
|
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, {
|
|
683
|
+
id: `upload-${name}`,
|
|
434
684
|
resource: resource,
|
|
435
685
|
query: listQuery,
|
|
436
686
|
onPageChange: finalOnPageChange,
|
|
@@ -442,7 +692,7 @@ function UploadField(_ref) {
|
|
|
442
692
|
selectedItems: modalItems,
|
|
443
693
|
onSelectionChange: onSelectionChange,
|
|
444
694
|
multipleSelection: allowMultipleUploads,
|
|
445
|
-
|
|
695
|
+
onClosed: closeResourceModal,
|
|
446
696
|
children: /*#__PURE__*/jsxs("div", {
|
|
447
697
|
className: "d-flex mt-4 justify-content-between",
|
|
448
698
|
children: [modalItems !== null && modalItems.length > 0 ? /*#__PURE__*/jsxs("span", {
|
|
@@ -457,11 +707,7 @@ function UploadField(_ref) {
|
|
|
457
707
|
disabled: disabled,
|
|
458
708
|
className: "d-block me-2",
|
|
459
709
|
children: /*#__PURE__*/jsx(FormattedMessage, {
|
|
460
|
-
id: "PyxZY2"
|
|
461
|
-
defaultMessage: [{
|
|
462
|
-
"type": 0,
|
|
463
|
-
"value": "Cancel"
|
|
464
|
-
}]
|
|
710
|
+
id: "PyxZY2"
|
|
465
711
|
})
|
|
466
712
|
}), /*#__PURE__*/jsx(Button, {
|
|
467
713
|
type: "button",
|
|
@@ -470,17 +716,58 @@ function UploadField(_ref) {
|
|
|
470
716
|
disabled: disabled || modalItems !== null && modalItems.length === 0,
|
|
471
717
|
className: "d-block",
|
|
472
718
|
children: /*#__PURE__*/jsx(FormattedMessage, {
|
|
473
|
-
id: "rvOVCV"
|
|
474
|
-
defaultMessage: [{
|
|
475
|
-
"type": 0,
|
|
476
|
-
"value": "Confirm selection"
|
|
477
|
-
}]
|
|
719
|
+
id: "rvOVCV"
|
|
478
720
|
})
|
|
479
721
|
})]
|
|
480
722
|
})]
|
|
481
723
|
})
|
|
482
|
-
}) : null
|
|
483
|
-
|
|
724
|
+
}) : null;
|
|
725
|
+
$[103] = allowMultipleUploads;
|
|
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;
|
|
484
771
|
}
|
|
485
772
|
|
|
486
773
|
var definition = [{
|
|
@@ -504,137 +791,312 @@ var definition = [{
|
|
|
504
791
|
}];
|
|
505
792
|
|
|
506
793
|
function AudioField(props) {
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
}
|
|
794
|
+
const $ = c(3);
|
|
795
|
+
let t0;
|
|
796
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
797
|
+
t0 = ["audio"];
|
|
798
|
+
$[0] = t0;
|
|
799
|
+
} else {
|
|
800
|
+
t0 = $[0];
|
|
801
|
+
}
|
|
802
|
+
const types = t0;
|
|
803
|
+
let t1;
|
|
804
|
+
if ($[1] !== props) {
|
|
805
|
+
t1 = /*#__PURE__*/jsx(UploadField, {
|
|
806
|
+
...props,
|
|
807
|
+
types: types
|
|
808
|
+
});
|
|
809
|
+
$[1] = props;
|
|
810
|
+
$[2] = t1;
|
|
811
|
+
} else {
|
|
812
|
+
t1 = $[2];
|
|
813
|
+
}
|
|
814
|
+
return t1;
|
|
513
815
|
}
|
|
514
816
|
|
|
515
817
|
function ImageField(props) {
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
}
|
|
818
|
+
const $ = c(3);
|
|
819
|
+
let t0;
|
|
820
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
821
|
+
t0 = ["image"];
|
|
822
|
+
$[0] = t0;
|
|
823
|
+
} else {
|
|
824
|
+
t0 = $[0];
|
|
825
|
+
}
|
|
826
|
+
const types = t0;
|
|
827
|
+
let t1;
|
|
828
|
+
if ($[1] !== props) {
|
|
829
|
+
t1 = /*#__PURE__*/jsx(UploadField, {
|
|
830
|
+
...props,
|
|
831
|
+
types: types
|
|
832
|
+
});
|
|
833
|
+
$[1] = props;
|
|
834
|
+
$[2] = t1;
|
|
835
|
+
} else {
|
|
836
|
+
t1 = $[2];
|
|
837
|
+
}
|
|
838
|
+
return t1;
|
|
522
839
|
}
|
|
523
840
|
|
|
524
841
|
function ImagesField(props) {
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
842
|
+
const $ = c(3);
|
|
843
|
+
let t0;
|
|
844
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
845
|
+
t0 = ["image"];
|
|
846
|
+
$[0] = t0;
|
|
847
|
+
} else {
|
|
848
|
+
t0 = $[0];
|
|
849
|
+
}
|
|
850
|
+
const types = t0;
|
|
851
|
+
let t1;
|
|
852
|
+
if ($[1] !== props) {
|
|
853
|
+
t1 = /*#__PURE__*/jsx(UploadField, {
|
|
854
|
+
...props,
|
|
855
|
+
types: types,
|
|
856
|
+
allowMultipleUploads: true
|
|
857
|
+
});
|
|
858
|
+
$[1] = props;
|
|
859
|
+
$[2] = t1;
|
|
860
|
+
} else {
|
|
861
|
+
t1 = $[2];
|
|
862
|
+
}
|
|
863
|
+
return t1;
|
|
532
864
|
}
|
|
533
865
|
|
|
534
866
|
function VideoField(props) {
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
}
|
|
867
|
+
const $ = c(3);
|
|
868
|
+
let t0;
|
|
869
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
870
|
+
t0 = ["video"];
|
|
871
|
+
$[0] = t0;
|
|
872
|
+
} else {
|
|
873
|
+
t0 = $[0];
|
|
874
|
+
}
|
|
875
|
+
const types = t0;
|
|
876
|
+
let t1;
|
|
877
|
+
if ($[1] !== props) {
|
|
878
|
+
t1 = /*#__PURE__*/jsx(UploadField, {
|
|
879
|
+
...props,
|
|
880
|
+
types: types
|
|
881
|
+
});
|
|
882
|
+
$[1] = props;
|
|
883
|
+
$[2] = t1;
|
|
884
|
+
} else {
|
|
885
|
+
t1 = $[2];
|
|
886
|
+
}
|
|
887
|
+
return t1;
|
|
541
888
|
}
|
|
542
889
|
|
|
543
890
|
function DocumentField(props) {
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
}
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
891
|
+
const $ = c(4);
|
|
892
|
+
let t0;
|
|
893
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
894
|
+
t0 = [".pdf"];
|
|
895
|
+
$[0] = t0;
|
|
896
|
+
} else {
|
|
897
|
+
t0 = $[0];
|
|
898
|
+
}
|
|
899
|
+
const fileTypes = t0;
|
|
900
|
+
let t1;
|
|
901
|
+
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
902
|
+
t1 = ["document"];
|
|
903
|
+
$[1] = t1;
|
|
904
|
+
} else {
|
|
905
|
+
t1 = $[1];
|
|
906
|
+
}
|
|
907
|
+
const types = t1;
|
|
908
|
+
let t2;
|
|
909
|
+
if ($[2] !== props) {
|
|
910
|
+
t2 = /*#__PURE__*/jsx(UploadField, {
|
|
911
|
+
...props,
|
|
912
|
+
fileTypes: fileTypes,
|
|
913
|
+
types: types
|
|
914
|
+
});
|
|
915
|
+
$[2] = props;
|
|
916
|
+
$[3] = t2;
|
|
917
|
+
} else {
|
|
918
|
+
t2 = $[3];
|
|
919
|
+
}
|
|
920
|
+
return t2;
|
|
554
921
|
}
|
|
555
922
|
|
|
556
923
|
function FontField(props) {
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
}
|
|
924
|
+
const $ = c(3);
|
|
925
|
+
let t0;
|
|
926
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
927
|
+
t0 = [".ttf", ".otf"];
|
|
928
|
+
$[0] = t0;
|
|
929
|
+
} else {
|
|
930
|
+
t0 = $[0];
|
|
931
|
+
}
|
|
932
|
+
const fileTypes = t0;
|
|
933
|
+
let t1;
|
|
934
|
+
if ($[1] !== props) {
|
|
935
|
+
t1 = /*#__PURE__*/jsx(UploadField, {
|
|
936
|
+
...props,
|
|
937
|
+
fileTypes: fileTypes
|
|
938
|
+
});
|
|
939
|
+
$[1] = props;
|
|
940
|
+
$[2] = t1;
|
|
941
|
+
} else {
|
|
942
|
+
t1 = $[2];
|
|
943
|
+
}
|
|
944
|
+
return t1;
|
|
563
945
|
}
|
|
564
946
|
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
947
|
+
function UpdateFileField(t0) {
|
|
948
|
+
const $ = c(24);
|
|
949
|
+
let props;
|
|
950
|
+
let t1;
|
|
951
|
+
let t2;
|
|
952
|
+
if ($[0] !== t0) {
|
|
953
|
+
({
|
|
954
|
+
value: t1,
|
|
955
|
+
onChange: t2,
|
|
956
|
+
...props
|
|
957
|
+
} = t0);
|
|
958
|
+
$[0] = t0;
|
|
959
|
+
$[1] = props;
|
|
960
|
+
$[2] = t1;
|
|
961
|
+
$[3] = t2;
|
|
962
|
+
} else {
|
|
963
|
+
props = $[1];
|
|
964
|
+
t1 = $[2];
|
|
965
|
+
t2 = $[3];
|
|
966
|
+
}
|
|
967
|
+
const value = t1 === undefined ? null : t1;
|
|
968
|
+
const [newValue, setNewValue] = useState(null);
|
|
969
|
+
const [visibleFile, setVisibleFile] = useState(null);
|
|
970
|
+
let t3;
|
|
971
|
+
if ($[4] !== value) {
|
|
972
|
+
t3 = value || {};
|
|
973
|
+
$[4] = value;
|
|
974
|
+
$[5] = t3;
|
|
975
|
+
} else {
|
|
976
|
+
t3 = $[5];
|
|
977
|
+
}
|
|
978
|
+
const {
|
|
979
|
+
id: previousId,
|
|
980
|
+
type: t4
|
|
981
|
+
} = t3;
|
|
982
|
+
const type = t4 === undefined ? null : t4;
|
|
983
|
+
let t5;
|
|
984
|
+
if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
|
|
985
|
+
t5 = t6 => {
|
|
986
|
+
const uploadedFile = t6 === undefined ? null : t6;
|
|
987
|
+
if (uploadedFile !== null) {
|
|
988
|
+
setVisibleFile(uploadedFile);
|
|
989
|
+
}
|
|
990
|
+
setNewValue(uploadedFile);
|
|
991
|
+
};
|
|
992
|
+
$[6] = t5;
|
|
993
|
+
} else {
|
|
994
|
+
t5 = $[6];
|
|
995
|
+
}
|
|
996
|
+
const onUploadChange = t5;
|
|
997
|
+
let t6;
|
|
998
|
+
if ($[7] !== previousId) {
|
|
999
|
+
t6 = {
|
|
592
1000
|
meta: {
|
|
593
|
-
previousId
|
|
1001
|
+
previousId
|
|
594
1002
|
}
|
|
595
1003
|
};
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
1004
|
+
$[7] = previousId;
|
|
1005
|
+
$[8] = t6;
|
|
1006
|
+
} else {
|
|
1007
|
+
t6 = $[8];
|
|
1008
|
+
}
|
|
1009
|
+
const uppyProps = t6;
|
|
1010
|
+
let t7;
|
|
1011
|
+
bb0: {
|
|
1012
|
+
if (type === "image") {
|
|
1013
|
+
let t8;
|
|
1014
|
+
if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1015
|
+
t8 = {
|
|
1016
|
+
types: ["image"]
|
|
1017
|
+
};
|
|
1018
|
+
$[9] = t8;
|
|
1019
|
+
} else {
|
|
1020
|
+
t8 = $[9];
|
|
1021
|
+
}
|
|
1022
|
+
t7 = t8;
|
|
1023
|
+
break bb0;
|
|
602
1024
|
}
|
|
603
|
-
if (type ===
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
1025
|
+
if (type === "audio") {
|
|
1026
|
+
let t8;
|
|
1027
|
+
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1028
|
+
t8 = {
|
|
1029
|
+
types: ["audio"]
|
|
1030
|
+
};
|
|
1031
|
+
$[10] = t8;
|
|
1032
|
+
} else {
|
|
1033
|
+
t8 = $[10];
|
|
1034
|
+
}
|
|
1035
|
+
t7 = t8;
|
|
1036
|
+
break bb0;
|
|
607
1037
|
}
|
|
608
|
-
if (type ===
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
1038
|
+
if (type === "video") {
|
|
1039
|
+
let t8;
|
|
1040
|
+
if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1041
|
+
t8 = {
|
|
1042
|
+
types: ["video"]
|
|
1043
|
+
};
|
|
1044
|
+
$[11] = t8;
|
|
1045
|
+
} else {
|
|
1046
|
+
t8 = $[11];
|
|
1047
|
+
}
|
|
1048
|
+
t7 = t8;
|
|
1049
|
+
break bb0;
|
|
612
1050
|
}
|
|
613
|
-
if (type ===
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
1051
|
+
if (type === "document") {
|
|
1052
|
+
let t8;
|
|
1053
|
+
if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1054
|
+
t8 = {
|
|
1055
|
+
types: [],
|
|
1056
|
+
fileTypes: [".pdf"]
|
|
1057
|
+
};
|
|
1058
|
+
$[12] = t8;
|
|
1059
|
+
} else {
|
|
1060
|
+
t8 = $[12];
|
|
1061
|
+
}
|
|
1062
|
+
t7 = t8;
|
|
1063
|
+
break bb0;
|
|
618
1064
|
}
|
|
619
|
-
|
|
620
|
-
}
|
|
621
|
-
|
|
622
|
-
|
|
1065
|
+
t7 = null;
|
|
1066
|
+
}
|
|
1067
|
+
const uploadProps = t7;
|
|
1068
|
+
const t8 = visibleFile || value;
|
|
1069
|
+
let t9;
|
|
1070
|
+
if ($[13] !== t8) {
|
|
1071
|
+
t9 = /*#__PURE__*/jsx("div", {
|
|
623
1072
|
className: "mb-3",
|
|
624
1073
|
children: /*#__PURE__*/jsx(MediaCard, {
|
|
625
|
-
value:
|
|
1074
|
+
value: t8,
|
|
626
1075
|
withoutDescription: true
|
|
627
1076
|
})
|
|
628
|
-
})
|
|
1077
|
+
});
|
|
1078
|
+
$[13] = t8;
|
|
1079
|
+
$[14] = t9;
|
|
1080
|
+
} else {
|
|
1081
|
+
t9 = $[14];
|
|
1082
|
+
}
|
|
1083
|
+
let t10;
|
|
1084
|
+
if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1085
|
+
t10 = /*#__PURE__*/jsx(FormattedMessage, {
|
|
1086
|
+
id: "daHjZg"
|
|
1087
|
+
});
|
|
1088
|
+
$[15] = t10;
|
|
1089
|
+
} else {
|
|
1090
|
+
t10 = $[15];
|
|
1091
|
+
}
|
|
1092
|
+
let t11;
|
|
1093
|
+
if ($[16] !== newValue || $[17] !== props || $[18] !== uploadProps || $[19] !== uppyProps) {
|
|
1094
|
+
t11 = /*#__PURE__*/jsx("div", {
|
|
629
1095
|
className: "mb-3",
|
|
630
|
-
children: /*#__PURE__*/jsx(UploadField,
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
"type": 0,
|
|
635
|
-
"value": "Edit file"
|
|
636
|
-
}]
|
|
637
|
-
}),
|
|
1096
|
+
children: /*#__PURE__*/jsx(UploadField, {
|
|
1097
|
+
...props,
|
|
1098
|
+
...uploadProps,
|
|
1099
|
+
addButtonLabel: t10,
|
|
638
1100
|
allowMultipleUploads: false,
|
|
639
1101
|
linkPath: "panneauUrl",
|
|
640
1102
|
onChange: onUploadChange,
|
|
@@ -643,9 +1105,28 @@ function UpdateFileField(_ref) {
|
|
|
643
1105
|
value: newValue,
|
|
644
1106
|
withButton: true,
|
|
645
1107
|
uppyProps: uppyProps
|
|
646
|
-
})
|
|
647
|
-
})
|
|
648
|
-
|
|
1108
|
+
})
|
|
1109
|
+
});
|
|
1110
|
+
$[16] = newValue;
|
|
1111
|
+
$[17] = props;
|
|
1112
|
+
$[18] = uploadProps;
|
|
1113
|
+
$[19] = uppyProps;
|
|
1114
|
+
$[20] = t11;
|
|
1115
|
+
} else {
|
|
1116
|
+
t11 = $[20];
|
|
1117
|
+
}
|
|
1118
|
+
let t12;
|
|
1119
|
+
if ($[21] !== t11 || $[22] !== t9) {
|
|
1120
|
+
t12 = /*#__PURE__*/jsxs(Fragment, {
|
|
1121
|
+
children: [t9, t11]
|
|
1122
|
+
});
|
|
1123
|
+
$[21] = t11;
|
|
1124
|
+
$[22] = t9;
|
|
1125
|
+
$[23] = t12;
|
|
1126
|
+
} else {
|
|
1127
|
+
t12 = $[23];
|
|
1128
|
+
}
|
|
1129
|
+
return t12;
|
|
649
1130
|
}
|
|
650
1131
|
|
|
651
1132
|
export { AudioField, DocumentField, FontField, ImageField, ImagesField, UpdateFileField, VideoField, UploadField as default, definition };
|