@panneau/field-upload 1.0.0-alpha.170 → 1.0.0-alpha.189
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 +9 -2
- package/lib/index.js +9 -2
- package/package.json +7 -7
package/es/index.js
CHANGED
|
@@ -23,6 +23,7 @@ var propTypes = {
|
|
|
23
23
|
url: PropTypes.string
|
|
24
24
|
})]),
|
|
25
25
|
types: PropTypes.arrayOf(PropTypes.oneOf(['audio', 'image', 'video'])),
|
|
26
|
+
fileTypes: PropTypes.arrayOf(PropTypes.string),
|
|
26
27
|
sources: PropTypes.arrayOf(PropTypes.oneOf(['webcam', 'facebook', 'instagram', 'dropbox', 'google-drive'])),
|
|
27
28
|
withButton: PropTypes.bool,
|
|
28
29
|
addButtonLabel: PropTypes$1.label,
|
|
@@ -33,6 +34,7 @@ var propTypes = {
|
|
|
33
34
|
var defaultProps = {
|
|
34
35
|
value: null,
|
|
35
36
|
types: ['audio', 'image', 'video'],
|
|
37
|
+
fileTypes: null,
|
|
36
38
|
sources: ['webcam', 'facebook', 'instagram', 'dropbox', 'google-drive'],
|
|
37
39
|
withButton: false,
|
|
38
40
|
addButtonLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
@@ -50,6 +52,7 @@ var defaultProps = {
|
|
|
50
52
|
var UploadField = function UploadField(_ref) {
|
|
51
53
|
var value = _ref.value,
|
|
52
54
|
types = _ref.types,
|
|
55
|
+
fileTypes = _ref.fileTypes,
|
|
53
56
|
sources = _ref.sources,
|
|
54
57
|
withButton = _ref.withButton,
|
|
55
58
|
addButtonLabel = _ref.addButtonLabel,
|
|
@@ -87,10 +90,14 @@ var UploadField = function UploadField(_ref) {
|
|
|
87
90
|
}, [onChange, allowMultipleUploads]);
|
|
88
91
|
var typesString = types.join('.');
|
|
89
92
|
var allowedFileTypes = useMemo(function () {
|
|
93
|
+
if (fileTypes !== null) {
|
|
94
|
+
return fileTypes;
|
|
95
|
+
}
|
|
96
|
+
|
|
90
97
|
return typesString.split('.').map(function (type) {
|
|
91
98
|
return "".concat(type, "/*");
|
|
92
99
|
});
|
|
93
|
-
}, [typesString]);
|
|
100
|
+
}, [typesString, fileTypes]);
|
|
94
101
|
var uppy = useUppy({
|
|
95
102
|
allowedFileTypes: allowedFileTypes,
|
|
96
103
|
allowMultipleUploads: allowMultipleUploads,
|
|
@@ -169,7 +176,7 @@ var UploadField = function UploadField(_ref) {
|
|
|
169
176
|
className: "d-flex align-items-center justify-content-between my-1",
|
|
170
177
|
key: "file-".concat(id, "-").concat(filename, "-").concat(idx + 1)
|
|
171
178
|
}, /*#__PURE__*/React.createElement("div", {
|
|
172
|
-
className: "d-flex align-items-center mx-2"
|
|
179
|
+
className: "d-flex align-items-center mx-2 text-truncate"
|
|
173
180
|
}, !hasPreview && faIcon !== null ? /*#__PURE__*/React.createElement(FontAwesomeIcon, {
|
|
174
181
|
icon: faIcon,
|
|
175
182
|
className: "me-2"
|
package/lib/index.js
CHANGED
|
@@ -39,6 +39,7 @@ var propTypes = {
|
|
|
39
39
|
url: PropTypes__default['default'].string
|
|
40
40
|
})]),
|
|
41
41
|
types: PropTypes__default['default'].arrayOf(PropTypes__default['default'].oneOf(['audio', 'image', 'video'])),
|
|
42
|
+
fileTypes: PropTypes__default['default'].arrayOf(PropTypes__default['default'].string),
|
|
42
43
|
sources: PropTypes__default['default'].arrayOf(PropTypes__default['default'].oneOf(['webcam', 'facebook', 'instagram', 'dropbox', 'google-drive'])),
|
|
43
44
|
withButton: PropTypes__default['default'].bool,
|
|
44
45
|
addButtonLabel: core.PropTypes.label,
|
|
@@ -49,6 +50,7 @@ var propTypes = {
|
|
|
49
50
|
var defaultProps = {
|
|
50
51
|
value: null,
|
|
51
52
|
types: ['audio', 'image', 'video'],
|
|
53
|
+
fileTypes: null,
|
|
52
54
|
sources: ['webcam', 'facebook', 'instagram', 'dropbox', 'google-drive'],
|
|
53
55
|
withButton: false,
|
|
54
56
|
addButtonLabel: /*#__PURE__*/React__default['default'].createElement(reactIntl.FormattedMessage, {
|
|
@@ -66,6 +68,7 @@ var defaultProps = {
|
|
|
66
68
|
var UploadField = function UploadField(_ref) {
|
|
67
69
|
var value = _ref.value,
|
|
68
70
|
types = _ref.types,
|
|
71
|
+
fileTypes = _ref.fileTypes,
|
|
69
72
|
sources = _ref.sources,
|
|
70
73
|
withButton = _ref.withButton,
|
|
71
74
|
addButtonLabel = _ref.addButtonLabel,
|
|
@@ -103,10 +106,14 @@ var UploadField = function UploadField(_ref) {
|
|
|
103
106
|
}, [onChange, allowMultipleUploads]);
|
|
104
107
|
var typesString = types.join('.');
|
|
105
108
|
var allowedFileTypes = React.useMemo(function () {
|
|
109
|
+
if (fileTypes !== null) {
|
|
110
|
+
return fileTypes;
|
|
111
|
+
}
|
|
112
|
+
|
|
106
113
|
return typesString.split('.').map(function (type) {
|
|
107
114
|
return "".concat(type, "/*");
|
|
108
115
|
});
|
|
109
|
-
}, [typesString]);
|
|
116
|
+
}, [typesString, fileTypes]);
|
|
110
117
|
var uppy = contexts.useUppy({
|
|
111
118
|
allowedFileTypes: allowedFileTypes,
|
|
112
119
|
allowMultipleUploads: allowMultipleUploads,
|
|
@@ -185,7 +192,7 @@ var UploadField = function UploadField(_ref) {
|
|
|
185
192
|
className: "d-flex align-items-center justify-content-between my-1",
|
|
186
193
|
key: "file-".concat(id, "-").concat(filename, "-").concat(idx + 1)
|
|
187
194
|
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
188
|
-
className: "d-flex align-items-center mx-2"
|
|
195
|
+
className: "d-flex align-items-center mx-2 text-truncate"
|
|
189
196
|
}, !hasPreview && faIcon !== null ? /*#__PURE__*/React__default['default'].createElement(reactFontawesome.FontAwesomeIcon, {
|
|
190
197
|
icon: faIcon,
|
|
191
198
|
className: "me-2"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@panneau/field-upload",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.189",
|
|
4
4
|
"description": "An Upload field",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -56,11 +56,11 @@
|
|
|
56
56
|
"@fortawesome/fontawesome-svg-core": "^1.2.35",
|
|
57
57
|
"@fortawesome/free-solid-svg-icons": "^5.15.3",
|
|
58
58
|
"@fortawesome/react-fontawesome": "^0.1.14",
|
|
59
|
-
"@panneau/core": "^1.0.0-alpha.
|
|
60
|
-
"@panneau/element-button": "^1.0.0-alpha.
|
|
61
|
-
"@panneau/element-card": "^1.0.0-alpha.
|
|
62
|
-
"@panneau/element-label": "^1.0.0-alpha.
|
|
63
|
-
"@panneau/themes": "^1.0.0-alpha.
|
|
59
|
+
"@panneau/core": "^1.0.0-alpha.180",
|
|
60
|
+
"@panneau/element-button": "^1.0.0-alpha.180",
|
|
61
|
+
"@panneau/element-card": "^1.0.0-alpha.180",
|
|
62
|
+
"@panneau/element-label": "^1.0.0-alpha.180",
|
|
63
|
+
"@panneau/themes": "^1.0.0-alpha.180",
|
|
64
64
|
"@uppy/core": "^1.16.2",
|
|
65
65
|
"@uppy/dashboard": "^1.13.0",
|
|
66
66
|
"@uppy/react": "^1.11.5",
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
"publishConfig": {
|
|
74
74
|
"access": "public"
|
|
75
75
|
},
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "d032085ed5b97b2beeeeb771db09b475cb8345ce"
|
|
77
77
|
}
|