@panneau/field-upload 3.0.181 → 3.0.186
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/es/index.js +83 -117
- package/lib/index.js +83 -117
- package/package.json +9 -12
package/es/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
-
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
3
2
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
4
3
|
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
5
4
|
import { Dashboard, DashboardModal } from '@uppy/react';
|
|
@@ -10,11 +9,9 @@ import PropTypes from 'prop-types';
|
|
|
10
9
|
import React, { useCallback, useMemo, useState, useRef, useEffect } from 'react';
|
|
11
10
|
import { FormattedMessage } from 'react-intl';
|
|
12
11
|
import { PropTypes as PropTypes$1 } from '@panneau/core';
|
|
13
|
-
import { useModal } from '@panneau/core/contexts';
|
|
14
12
|
import Button from '@panneau/element-button';
|
|
15
13
|
import Label from '@panneau/element-label';
|
|
16
14
|
import MediaCard, { MediaCards } from '@panneau/element-media-card';
|
|
17
|
-
import ModalPicker from '@panneau/modal-medias-picker';
|
|
18
15
|
import { useUppy } from '@panneau/uppy';
|
|
19
16
|
import '@uppy/core/dist/style.css';
|
|
20
17
|
import '@uppy/dashboard/dist/style.css';
|
|
@@ -109,19 +106,19 @@ var defaultProps$1 = {
|
|
|
109
106
|
className: null
|
|
110
107
|
};
|
|
111
108
|
var UploadField = function UploadField(_ref) {
|
|
112
|
-
|
|
113
|
-
value = _ref.value
|
|
114
|
-
|
|
115
|
-
types = _ref.types,
|
|
109
|
+
_ref.resource;
|
|
110
|
+
var value = _ref.value;
|
|
111
|
+
_ref.name;
|
|
112
|
+
var types = _ref.types,
|
|
116
113
|
fileTypes = _ref.fileTypes,
|
|
117
114
|
sources = _ref.sources,
|
|
118
|
-
withButton = _ref.withButton
|
|
119
|
-
|
|
120
|
-
withClearButton = _ref.withClearButton,
|
|
115
|
+
withButton = _ref.withButton;
|
|
116
|
+
_ref.withFind;
|
|
117
|
+
var withClearButton = _ref.withClearButton,
|
|
121
118
|
withoutMedia = _ref.withoutMedia,
|
|
122
|
-
addButtonLabel = _ref.addButtonLabel
|
|
123
|
-
|
|
124
|
-
clearButtonLabel = _ref.clearButtonLabel,
|
|
119
|
+
addButtonLabel = _ref.addButtonLabel;
|
|
120
|
+
_ref.findButtonLabel;
|
|
121
|
+
var clearButtonLabel = _ref.clearButtonLabel,
|
|
125
122
|
allowMultipleUploads = _ref.allowMultipleUploads,
|
|
126
123
|
maxNumberOfFiles = _ref.maxNumberOfFiles,
|
|
127
124
|
namePath = _ref.namePath,
|
|
@@ -134,9 +131,9 @@ var UploadField = function UploadField(_ref) {
|
|
|
134
131
|
disabled = _ref.disabled,
|
|
135
132
|
onChange = _ref.onChange,
|
|
136
133
|
onClear = _ref.onClear,
|
|
137
|
-
onClickAdd = _ref.onClickAdd
|
|
138
|
-
|
|
139
|
-
className = _ref.className;
|
|
134
|
+
onClickAdd = _ref.onClickAdd;
|
|
135
|
+
_ref.onClickFind;
|
|
136
|
+
var className = _ref.className;
|
|
140
137
|
var mergeData = useCallback(function (newValue) {
|
|
141
138
|
// Merge the response from our back-end
|
|
142
139
|
if (isObject(newValue) && isObject(newValue.response) && newValue.response.status === 200 && newValue.response.body !== null) {
|
|
@@ -238,83 +235,77 @@ var UploadField = function UploadField(_ref) {
|
|
|
238
235
|
var hasMedia = values !== null && values.length > 0;
|
|
239
236
|
|
|
240
237
|
// Resource-modal-picker
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
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
|
-
var onConfirmSelection = useCallback(function () {
|
|
306
|
-
if (onChange !== null) {
|
|
307
|
-
onChange(modalItems);
|
|
308
|
-
unregister(modalKey);
|
|
309
|
-
}
|
|
310
|
-
}, [onChange, modalItems, unregister, modalKey, allowMultipleUploads]);
|
|
238
|
+
// const { register, unregister, modalIsOpen } = useModal();
|
|
239
|
+
// const modalKey = `upload-field-${name}`;
|
|
240
|
+
// const resourceModalOpen = modalIsOpen(modalKey);
|
|
241
|
+
// const showResourceModal = withFind && resourceModalOpen;
|
|
242
|
+
|
|
243
|
+
// const toggleResourceModal = useCallback(() => {
|
|
244
|
+
// if (resourceModalOpen) {
|
|
245
|
+
// unregister(modalKey);
|
|
246
|
+
// } else {
|
|
247
|
+
// register(modalKey);
|
|
248
|
+
// }
|
|
249
|
+
// }, [resourceModalOpen, register, unregister, modalKey]);
|
|
250
|
+
|
|
251
|
+
// const [modalItems, setModalItems] = useState([]);
|
|
252
|
+
// const closeResourceModal = useCallback(() => {
|
|
253
|
+
// unregister(modalKey);
|
|
254
|
+
// setModalItems(null);
|
|
255
|
+
// }, [resourceModalOpen, unregister, modalKey, setModalItems]);
|
|
256
|
+
|
|
257
|
+
// const openModalInResource = useCallback(() => {
|
|
258
|
+
// unregister(modalKey);
|
|
259
|
+
// setModalItems(null);
|
|
260
|
+
// setModalOpened(true);
|
|
261
|
+
// }, [modalOpened, unregister, modalKey, setModalOpened]);
|
|
262
|
+
|
|
263
|
+
// const onChangeSelection = useCallback(
|
|
264
|
+
// (newValue) => {
|
|
265
|
+
// if (allowMultipleUploads) {
|
|
266
|
+
// if (newValue !== null && !isArray(newValue)) {
|
|
267
|
+
// const { id = null } = newValue || {};
|
|
268
|
+
// if (id !== null) {
|
|
269
|
+
// const previous = (modalItems || []).find(
|
|
270
|
+
// ({ id: itemId = null } = {}) => id === itemId,
|
|
271
|
+
// );
|
|
272
|
+
// if (previous) {
|
|
273
|
+
// setModalItems(
|
|
274
|
+
// (modalItems || []).filter(
|
|
275
|
+
// ({ id: itemId = null } = {}) => id !== itemId,
|
|
276
|
+
// ),
|
|
277
|
+
// );
|
|
278
|
+
// } else {
|
|
279
|
+
// setModalItems([...(modalItems || []), newValue]);
|
|
280
|
+
// }
|
|
281
|
+
// }
|
|
282
|
+
// } else if (newValue !== null && isArray(newValue)) {
|
|
283
|
+
// setModalItems(newValue);
|
|
284
|
+
// }
|
|
285
|
+
// } else if (onChange !== null) {
|
|
286
|
+
// // Single value onchange
|
|
287
|
+
// const [finalValue = null] = isArray(newValue) ? newValue : [newValue];
|
|
288
|
+
// onChange(finalValue);
|
|
289
|
+
// unregister(modalKey);
|
|
290
|
+
// }
|
|
291
|
+
// },
|
|
292
|
+
// [onChange, unregister, modalKey, allowMultipleUploads, modalItems, setModalItems],
|
|
293
|
+
// );
|
|
294
|
+
|
|
295
|
+
// const onConfirmSelection = useCallback(() => {
|
|
296
|
+
// if (onChange !== null) {
|
|
297
|
+
// onChange(modalItems);
|
|
298
|
+
// unregister(modalKey);
|
|
299
|
+
// }
|
|
300
|
+
// }, [onChange, modalItems, unregister, modalKey, allowMultipleUploads]);
|
|
301
|
+
|
|
311
302
|
var containerRef = useRef(null);
|
|
312
303
|
|
|
313
304
|
// Keep this stable, uppy doesnt like
|
|
314
|
-
var
|
|
315
|
-
|
|
316
|
-
finalUppy =
|
|
317
|
-
setFinalUppy =
|
|
305
|
+
var _useState3 = useState(null),
|
|
306
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
307
|
+
finalUppy = _useState4[0],
|
|
308
|
+
setFinalUppy = _useState4[1];
|
|
318
309
|
useEffect(function () {
|
|
319
310
|
if (uppy !== null && finalUppy === null) {
|
|
320
311
|
setFinalUppy(uppy);
|
|
@@ -351,15 +342,7 @@ var UploadField = function UploadField(_ref) {
|
|
|
351
342
|
onClick: onClickAdd || openModal,
|
|
352
343
|
disabled: disabled,
|
|
353
344
|
outline: true
|
|
354
|
-
}, /*#__PURE__*/React.createElement(Label, null, addButtonLabel))),
|
|
355
|
-
className: "col-auto ps-0"
|
|
356
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
357
|
-
type: "button",
|
|
358
|
-
theme: "primary",
|
|
359
|
-
onClick: onClickFind || toggleResourceModal,
|
|
360
|
-
disabled: disabled,
|
|
361
|
-
outline: true
|
|
362
|
-
}, /*#__PURE__*/React.createElement(Label, null, findButtonLabel))) : null) : null, !showResourceModal && !disabled && !hasMedia && !withButton && finalUppy !== null ? /*#__PURE__*/React.createElement("div", {
|
|
345
|
+
}, /*#__PURE__*/React.createElement(Label, null, addButtonLabel)))) : null, !disabled && !hasMedia && !withButton && finalUppy !== null ? /*#__PURE__*/React.createElement("div", {
|
|
363
346
|
className: styles.dashboard
|
|
364
347
|
}, /*#__PURE__*/React.createElement(Dashboard, Object.assign({
|
|
365
348
|
uppy: finalUppy
|
|
@@ -376,7 +359,7 @@ var UploadField = function UploadField(_ref) {
|
|
|
376
359
|
showProgressDetails: true,
|
|
377
360
|
areInsidesReadyToBeVisible: true,
|
|
378
361
|
proudlyDisplayPoweredByUppy: false
|
|
379
|
-
}))) : null, !
|
|
362
|
+
}))) : null, !disabled && withButton && finalUppy !== null && modalOpened ? /*#__PURE__*/React.createElement(DashboardModal, {
|
|
380
363
|
uppy: finalUppy,
|
|
381
364
|
className: styles.dashboardModal,
|
|
382
365
|
plugins: sources,
|
|
@@ -389,23 +372,6 @@ var UploadField = function UploadField(_ref) {
|
|
|
389
372
|
showProgressDetails: true,
|
|
390
373
|
showAddFilesPanel: true,
|
|
391
374
|
doneButtonHandler: closeModal
|
|
392
|
-
}) : null, showResourceModal ? /*#__PURE__*/React.createElement(ModalPicker, {
|
|
393
|
-
id: modalKey,
|
|
394
|
-
value: value,
|
|
395
|
-
resource: resource,
|
|
396
|
-
types: types,
|
|
397
|
-
selectable: true,
|
|
398
|
-
onChange: onChangeSelection,
|
|
399
|
-
onConfirm: onConfirmSelection,
|
|
400
|
-
onClose: closeResourceModal,
|
|
401
|
-
buttons: [{
|
|
402
|
-
id: 'upload',
|
|
403
|
-
label: addButtonLabel,
|
|
404
|
-
theme: 'primary',
|
|
405
|
-
onClick: openModalInResource
|
|
406
|
-
}],
|
|
407
|
-
buttonsClassName: "ms-xl-auto",
|
|
408
|
-
multiple: allowMultipleUploads
|
|
409
375
|
}) : null);
|
|
410
376
|
};
|
|
411
377
|
UploadField.propTypes = propTypes$1;
|
package/lib/index.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
|
-
var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
|
|
7
6
|
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
8
7
|
var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
|
|
9
8
|
var react = require('@uppy/react');
|
|
@@ -14,11 +13,9 @@ var PropTypes = require('prop-types');
|
|
|
14
13
|
var React = require('react');
|
|
15
14
|
var reactIntl = require('react-intl');
|
|
16
15
|
var core = require('@panneau/core');
|
|
17
|
-
var contexts = require('@panneau/core/contexts');
|
|
18
16
|
var Button = require('@panneau/element-button');
|
|
19
17
|
var Label = require('@panneau/element-label');
|
|
20
18
|
var MediaCard = require('@panneau/element-media-card');
|
|
21
|
-
var ModalPicker = require('@panneau/modal-medias-picker');
|
|
22
19
|
var uppy = require('@panneau/uppy');
|
|
23
20
|
require('@uppy/core/dist/style.css');
|
|
24
21
|
require('@uppy/dashboard/dist/style.css');
|
|
@@ -113,19 +110,19 @@ var defaultProps$1 = {
|
|
|
113
110
|
className: null
|
|
114
111
|
};
|
|
115
112
|
var UploadField = function UploadField(_ref) {
|
|
116
|
-
|
|
117
|
-
value = _ref.value
|
|
118
|
-
|
|
119
|
-
types = _ref.types,
|
|
113
|
+
_ref.resource;
|
|
114
|
+
var value = _ref.value;
|
|
115
|
+
_ref.name;
|
|
116
|
+
var types = _ref.types,
|
|
120
117
|
fileTypes = _ref.fileTypes,
|
|
121
118
|
sources = _ref.sources,
|
|
122
|
-
withButton = _ref.withButton
|
|
123
|
-
|
|
124
|
-
withClearButton = _ref.withClearButton,
|
|
119
|
+
withButton = _ref.withButton;
|
|
120
|
+
_ref.withFind;
|
|
121
|
+
var withClearButton = _ref.withClearButton,
|
|
125
122
|
withoutMedia = _ref.withoutMedia,
|
|
126
|
-
addButtonLabel = _ref.addButtonLabel
|
|
127
|
-
|
|
128
|
-
clearButtonLabel = _ref.clearButtonLabel,
|
|
123
|
+
addButtonLabel = _ref.addButtonLabel;
|
|
124
|
+
_ref.findButtonLabel;
|
|
125
|
+
var clearButtonLabel = _ref.clearButtonLabel,
|
|
129
126
|
allowMultipleUploads = _ref.allowMultipleUploads,
|
|
130
127
|
maxNumberOfFiles = _ref.maxNumberOfFiles,
|
|
131
128
|
namePath = _ref.namePath,
|
|
@@ -138,9 +135,9 @@ var UploadField = function UploadField(_ref) {
|
|
|
138
135
|
disabled = _ref.disabled,
|
|
139
136
|
onChange = _ref.onChange,
|
|
140
137
|
onClear = _ref.onClear,
|
|
141
|
-
onClickAdd = _ref.onClickAdd
|
|
142
|
-
|
|
143
|
-
className = _ref.className;
|
|
138
|
+
onClickAdd = _ref.onClickAdd;
|
|
139
|
+
_ref.onClickFind;
|
|
140
|
+
var className = _ref.className;
|
|
144
141
|
var mergeData = React.useCallback(function (newValue) {
|
|
145
142
|
// Merge the response from our back-end
|
|
146
143
|
if (isObject(newValue) && isObject(newValue.response) && newValue.response.status === 200 && newValue.response.body !== null) {
|
|
@@ -242,83 +239,77 @@ var UploadField = function UploadField(_ref) {
|
|
|
242
239
|
var hasMedia = values !== null && values.length > 0;
|
|
243
240
|
|
|
244
241
|
// Resource-modal-picker
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
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
|
-
var onConfirmSelection = React.useCallback(function () {
|
|
310
|
-
if (onChange !== null) {
|
|
311
|
-
onChange(modalItems);
|
|
312
|
-
unregister(modalKey);
|
|
313
|
-
}
|
|
314
|
-
}, [onChange, modalItems, unregister, modalKey, allowMultipleUploads]);
|
|
242
|
+
// const { register, unregister, modalIsOpen } = useModal();
|
|
243
|
+
// const modalKey = `upload-field-${name}`;
|
|
244
|
+
// const resourceModalOpen = modalIsOpen(modalKey);
|
|
245
|
+
// const showResourceModal = withFind && resourceModalOpen;
|
|
246
|
+
|
|
247
|
+
// const toggleResourceModal = useCallback(() => {
|
|
248
|
+
// if (resourceModalOpen) {
|
|
249
|
+
// unregister(modalKey);
|
|
250
|
+
// } else {
|
|
251
|
+
// register(modalKey);
|
|
252
|
+
// }
|
|
253
|
+
// }, [resourceModalOpen, register, unregister, modalKey]);
|
|
254
|
+
|
|
255
|
+
// const [modalItems, setModalItems] = useState([]);
|
|
256
|
+
// const closeResourceModal = useCallback(() => {
|
|
257
|
+
// unregister(modalKey);
|
|
258
|
+
// setModalItems(null);
|
|
259
|
+
// }, [resourceModalOpen, unregister, modalKey, setModalItems]);
|
|
260
|
+
|
|
261
|
+
// const openModalInResource = useCallback(() => {
|
|
262
|
+
// unregister(modalKey);
|
|
263
|
+
// setModalItems(null);
|
|
264
|
+
// setModalOpened(true);
|
|
265
|
+
// }, [modalOpened, unregister, modalKey, setModalOpened]);
|
|
266
|
+
|
|
267
|
+
// const onChangeSelection = useCallback(
|
|
268
|
+
// (newValue) => {
|
|
269
|
+
// if (allowMultipleUploads) {
|
|
270
|
+
// if (newValue !== null && !isArray(newValue)) {
|
|
271
|
+
// const { id = null } = newValue || {};
|
|
272
|
+
// if (id !== null) {
|
|
273
|
+
// const previous = (modalItems || []).find(
|
|
274
|
+
// ({ id: itemId = null } = {}) => id === itemId,
|
|
275
|
+
// );
|
|
276
|
+
// if (previous) {
|
|
277
|
+
// setModalItems(
|
|
278
|
+
// (modalItems || []).filter(
|
|
279
|
+
// ({ id: itemId = null } = {}) => id !== itemId,
|
|
280
|
+
// ),
|
|
281
|
+
// );
|
|
282
|
+
// } else {
|
|
283
|
+
// setModalItems([...(modalItems || []), newValue]);
|
|
284
|
+
// }
|
|
285
|
+
// }
|
|
286
|
+
// } else if (newValue !== null && isArray(newValue)) {
|
|
287
|
+
// setModalItems(newValue);
|
|
288
|
+
// }
|
|
289
|
+
// } else if (onChange !== null) {
|
|
290
|
+
// // Single value onchange
|
|
291
|
+
// const [finalValue = null] = isArray(newValue) ? newValue : [newValue];
|
|
292
|
+
// onChange(finalValue);
|
|
293
|
+
// unregister(modalKey);
|
|
294
|
+
// }
|
|
295
|
+
// },
|
|
296
|
+
// [onChange, unregister, modalKey, allowMultipleUploads, modalItems, setModalItems],
|
|
297
|
+
// );
|
|
298
|
+
|
|
299
|
+
// const onConfirmSelection = useCallback(() => {
|
|
300
|
+
// if (onChange !== null) {
|
|
301
|
+
// onChange(modalItems);
|
|
302
|
+
// unregister(modalKey);
|
|
303
|
+
// }
|
|
304
|
+
// }, [onChange, modalItems, unregister, modalKey, allowMultipleUploads]);
|
|
305
|
+
|
|
315
306
|
var containerRef = React.useRef(null);
|
|
316
307
|
|
|
317
308
|
// Keep this stable, uppy doesnt like
|
|
318
|
-
var
|
|
319
|
-
|
|
320
|
-
finalUppy =
|
|
321
|
-
setFinalUppy =
|
|
309
|
+
var _useState3 = React.useState(null),
|
|
310
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
311
|
+
finalUppy = _useState4[0],
|
|
312
|
+
setFinalUppy = _useState4[1];
|
|
322
313
|
React.useEffect(function () {
|
|
323
314
|
if (uppy$1 !== null && finalUppy === null) {
|
|
324
315
|
setFinalUppy(uppy$1);
|
|
@@ -355,15 +346,7 @@ var UploadField = function UploadField(_ref) {
|
|
|
355
346
|
onClick: onClickAdd || openModal,
|
|
356
347
|
disabled: disabled,
|
|
357
348
|
outline: true
|
|
358
|
-
}, /*#__PURE__*/React.createElement(Label, null, addButtonLabel))),
|
|
359
|
-
className: "col-auto ps-0"
|
|
360
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
361
|
-
type: "button",
|
|
362
|
-
theme: "primary",
|
|
363
|
-
onClick: onClickFind || toggleResourceModal,
|
|
364
|
-
disabled: disabled,
|
|
365
|
-
outline: true
|
|
366
|
-
}, /*#__PURE__*/React.createElement(Label, null, findButtonLabel))) : null) : null, !showResourceModal && !disabled && !hasMedia && !withButton && finalUppy !== null ? /*#__PURE__*/React.createElement("div", {
|
|
349
|
+
}, /*#__PURE__*/React.createElement(Label, null, addButtonLabel)))) : null, !disabled && !hasMedia && !withButton && finalUppy !== null ? /*#__PURE__*/React.createElement("div", {
|
|
367
350
|
className: styles.dashboard
|
|
368
351
|
}, /*#__PURE__*/React.createElement(react.Dashboard, Object.assign({
|
|
369
352
|
uppy: finalUppy
|
|
@@ -380,7 +363,7 @@ var UploadField = function UploadField(_ref) {
|
|
|
380
363
|
showProgressDetails: true,
|
|
381
364
|
areInsidesReadyToBeVisible: true,
|
|
382
365
|
proudlyDisplayPoweredByUppy: false
|
|
383
|
-
}))) : null, !
|
|
366
|
+
}))) : null, !disabled && withButton && finalUppy !== null && modalOpened ? /*#__PURE__*/React.createElement(react.DashboardModal, {
|
|
384
367
|
uppy: finalUppy,
|
|
385
368
|
className: styles.dashboardModal,
|
|
386
369
|
plugins: sources,
|
|
@@ -393,23 +376,6 @@ var UploadField = function UploadField(_ref) {
|
|
|
393
376
|
showProgressDetails: true,
|
|
394
377
|
showAddFilesPanel: true,
|
|
395
378
|
doneButtonHandler: closeModal
|
|
396
|
-
}) : null, showResourceModal ? /*#__PURE__*/React.createElement(ModalPicker, {
|
|
397
|
-
id: modalKey,
|
|
398
|
-
value: value,
|
|
399
|
-
resource: resource,
|
|
400
|
-
types: types,
|
|
401
|
-
selectable: true,
|
|
402
|
-
onChange: onChangeSelection,
|
|
403
|
-
onConfirm: onConfirmSelection,
|
|
404
|
-
onClose: closeResourceModal,
|
|
405
|
-
buttons: [{
|
|
406
|
-
id: 'upload',
|
|
407
|
-
label: addButtonLabel,
|
|
408
|
-
theme: 'primary',
|
|
409
|
-
onClick: openModalInResource
|
|
410
|
-
}],
|
|
411
|
-
buttonsClassName: "ms-xl-auto",
|
|
412
|
-
multiple: allowMultipleUploads
|
|
413
379
|
}) : null);
|
|
414
380
|
};
|
|
415
381
|
UploadField.propTypes = propTypes$1;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@panneau/field-upload",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.186",
|
|
4
4
|
"description": "An Upload field",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -57,16 +57,13 @@
|
|
|
57
57
|
"@fortawesome/fontawesome-svg-core": "^6.5.1",
|
|
58
58
|
"@fortawesome/free-solid-svg-icons": "^6.5.1",
|
|
59
59
|
"@fortawesome/react-fontawesome": "^0.2.0",
|
|
60
|
-
"@panneau/core": "^3.0.
|
|
61
|
-
"@panneau/element-button": "^3.0.
|
|
62
|
-
"@panneau/element-label": "^3.0.
|
|
63
|
-
"@panneau/element-media-card": "^3.0.
|
|
64
|
-
"@panneau/list-resource-items": "^3.0.
|
|
65
|
-
"@panneau/
|
|
66
|
-
"@panneau/
|
|
67
|
-
"@panneau/modal-upload": "^3.0.177",
|
|
68
|
-
"@panneau/themes": "^3.0.177",
|
|
69
|
-
"@panneau/uppy": "^3.0.176",
|
|
60
|
+
"@panneau/core": "^3.0.182",
|
|
61
|
+
"@panneau/element-button": "^3.0.182",
|
|
62
|
+
"@panneau/element-label": "^3.0.182",
|
|
63
|
+
"@panneau/element-media-card": "^3.0.182",
|
|
64
|
+
"@panneau/list-resource-items": "^3.0.186",
|
|
65
|
+
"@panneau/themes": "^3.0.182",
|
|
66
|
+
"@panneau/uppy": "^3.0.182",
|
|
70
67
|
"@uppy/core": "^3.9.1",
|
|
71
68
|
"@uppy/dashboard": "^3.7.3",
|
|
72
69
|
"@uppy/drag-drop": "^3.0.3",
|
|
@@ -83,5 +80,5 @@
|
|
|
83
80
|
"publishConfig": {
|
|
84
81
|
"access": "public"
|
|
85
82
|
},
|
|
86
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "28e6bd3e2185ae5ad5f0962f9883d1777d6a25aa"
|
|
87
84
|
}
|