@panneau/field-upload 2.0.62 → 2.0.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/index.js +13 -18
- package/lib/index.js +13 -18
- package/package.json +2 -2
package/es/index.js
CHANGED
|
@@ -14,7 +14,6 @@ import React, { useState, useCallback, useMemo } from 'react';
|
|
|
14
14
|
import { FormattedMessage } from 'react-intl';
|
|
15
15
|
import { PropTypes as PropTypes$1 } from '@panneau/core';
|
|
16
16
|
import { useUppy } from '@panneau/core/contexts';
|
|
17
|
-
import { useResizeObserver } from '@panneau/core/hooks';
|
|
18
17
|
import Button from '@panneau/element-button';
|
|
19
18
|
import Label from '@panneau/element-label';
|
|
20
19
|
import '@uppy/core/dist/style.min.css';
|
|
@@ -96,15 +95,10 @@ var UploadField = function UploadField(_ref) {
|
|
|
96
95
|
disabled = _ref.disabled,
|
|
97
96
|
onChange = _ref.onChange,
|
|
98
97
|
className = _ref.className;
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
var _ref2 = entry || {},
|
|
104
|
-
contentRect = _ref2.contentRect;
|
|
105
|
-
var _ref3 = contentRect || {},
|
|
106
|
-
_ref3$width = _ref3.width,
|
|
107
|
-
containerWidth = _ref3$width === void 0 ? null : _ref3$width;
|
|
98
|
+
// const { ref: containerRef, entry = null } = useResizeObserver();
|
|
99
|
+
// const { contentRect } = entry || {};
|
|
100
|
+
// const { width: containerWidth = null } = contentRect || {};
|
|
101
|
+
|
|
108
102
|
var _useState = useState(false),
|
|
109
103
|
_useState2 = _slicedToArray(_useState, 2),
|
|
110
104
|
mediaModalOpen = _useState2[0],
|
|
@@ -181,8 +175,8 @@ var UploadField = function UploadField(_ref) {
|
|
|
181
175
|
}, [value]);
|
|
182
176
|
var hasMedia = values !== null && values.length > 0;
|
|
183
177
|
return /*#__PURE__*/React.createElement("div", {
|
|
184
|
-
className: classNames([styles.container, _defineProperty({}, className, className !== null)])
|
|
185
|
-
ref
|
|
178
|
+
className: classNames([styles.container, _defineProperty({}, className, className !== null)])
|
|
179
|
+
// ref={containerRef}
|
|
186
180
|
}, values !== null ? values.map(function (media, idx) {
|
|
187
181
|
var _media$id = media.id,
|
|
188
182
|
id = _media$id === void 0 ? null : _media$id,
|
|
@@ -197,9 +191,9 @@ var UploadField = function UploadField(_ref) {
|
|
|
197
191
|
_media$data = media.data,
|
|
198
192
|
data = _media$data === void 0 ? {} : _media$data,
|
|
199
193
|
type = media.type;
|
|
200
|
-
var
|
|
201
|
-
|
|
202
|
-
file =
|
|
194
|
+
var _ref3 = data || {},
|
|
195
|
+
_ref3$file = _ref3.file,
|
|
196
|
+
file = _ref3$file === void 0 ? null : _ref3$file;
|
|
203
197
|
var faIcon = null;
|
|
204
198
|
switch (type) {
|
|
205
199
|
case 'audio':
|
|
@@ -289,9 +283,10 @@ var UploadField = function UploadField(_ref) {
|
|
|
289
283
|
className: styles.dashboard
|
|
290
284
|
}, /*#__PURE__*/React.createElement(Dashboard, Object.assign({
|
|
291
285
|
uppy: uppy
|
|
292
|
-
|
|
293
|
-
width: containerWidth
|
|
294
|
-
|
|
286
|
+
// {...(containerWidth !== null && height !== null
|
|
287
|
+
// ? { width: containerWidth }
|
|
288
|
+
// : null)}
|
|
289
|
+
}, width !== null ? {
|
|
295
290
|
width: width
|
|
296
291
|
} : null, height !== null ? {
|
|
297
292
|
height: height
|
package/lib/index.js
CHANGED
|
@@ -18,7 +18,6 @@ var React = require('react');
|
|
|
18
18
|
var reactIntl = require('react-intl');
|
|
19
19
|
var core = require('@panneau/core');
|
|
20
20
|
var contexts = require('@panneau/core/contexts');
|
|
21
|
-
var hooks = require('@panneau/core/hooks');
|
|
22
21
|
var Button = require('@panneau/element-button');
|
|
23
22
|
var Label = require('@panneau/element-label');
|
|
24
23
|
require('@uppy/core/dist/style.min.css');
|
|
@@ -115,15 +114,10 @@ var UploadField = function UploadField(_ref) {
|
|
|
115
114
|
disabled = _ref.disabled,
|
|
116
115
|
onChange = _ref.onChange,
|
|
117
116
|
className = _ref.className;
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
var _ref2 = entry || {},
|
|
123
|
-
contentRect = _ref2.contentRect;
|
|
124
|
-
var _ref3 = contentRect || {},
|
|
125
|
-
_ref3$width = _ref3.width,
|
|
126
|
-
containerWidth = _ref3$width === void 0 ? null : _ref3$width;
|
|
117
|
+
// const { ref: containerRef, entry = null } = useResizeObserver();
|
|
118
|
+
// const { contentRect } = entry || {};
|
|
119
|
+
// const { width: containerWidth = null } = contentRect || {};
|
|
120
|
+
|
|
127
121
|
var _useState = React.useState(false),
|
|
128
122
|
_useState2 = _slicedToArray__default["default"](_useState, 2),
|
|
129
123
|
mediaModalOpen = _useState2[0],
|
|
@@ -200,8 +194,8 @@ var UploadField = function UploadField(_ref) {
|
|
|
200
194
|
}, [value]);
|
|
201
195
|
var hasMedia = values !== null && values.length > 0;
|
|
202
196
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
203
|
-
className: classNames__default["default"]([styles.container, _defineProperty__default["default"]({}, className, className !== null)])
|
|
204
|
-
ref
|
|
197
|
+
className: classNames__default["default"]([styles.container, _defineProperty__default["default"]({}, className, className !== null)])
|
|
198
|
+
// ref={containerRef}
|
|
205
199
|
}, values !== null ? values.map(function (media, idx) {
|
|
206
200
|
var _media$id = media.id,
|
|
207
201
|
id = _media$id === void 0 ? null : _media$id,
|
|
@@ -216,9 +210,9 @@ var UploadField = function UploadField(_ref) {
|
|
|
216
210
|
_media$data = media.data,
|
|
217
211
|
data = _media$data === void 0 ? {} : _media$data,
|
|
218
212
|
type = media.type;
|
|
219
|
-
var
|
|
220
|
-
|
|
221
|
-
file =
|
|
213
|
+
var _ref3 = data || {},
|
|
214
|
+
_ref3$file = _ref3.file,
|
|
215
|
+
file = _ref3$file === void 0 ? null : _ref3$file;
|
|
222
216
|
var faIcon = null;
|
|
223
217
|
switch (type) {
|
|
224
218
|
case 'audio':
|
|
@@ -308,9 +302,10 @@ var UploadField = function UploadField(_ref) {
|
|
|
308
302
|
className: styles.dashboard
|
|
309
303
|
}, /*#__PURE__*/React__default["default"].createElement(react.Dashboard, Object.assign({
|
|
310
304
|
uppy: uppy
|
|
311
|
-
|
|
312
|
-
width: containerWidth
|
|
313
|
-
|
|
305
|
+
// {...(containerWidth !== null && height !== null
|
|
306
|
+
// ? { width: containerWidth }
|
|
307
|
+
// : null)}
|
|
308
|
+
}, width !== null ? {
|
|
314
309
|
width: width
|
|
315
310
|
} : null, height !== null ? {
|
|
316
311
|
height: height
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@panneau/field-upload",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.64",
|
|
4
4
|
"description": "An Upload field",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"publishConfig": {
|
|
79
79
|
"access": "public"
|
|
80
80
|
},
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "10acd524fa622688b6d6598c3258b21abd375b36"
|
|
82
82
|
}
|