Socket
Socket
Sign inDemoInstall

react-file-input-previews-base64

Package Overview
Dependencies
0
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.3 to 1.0.4

17

lib/index.js

@@ -99,6 +99,6 @@ 'use strict';

),
this.props.imagePreview && this.state.image_objs_array.length !== 0 && _react2.default.createElement(
this.props.imagePreview && (this.state.image_objs_array.length !== 0 || this.props.defaultFiles.length !== 0) && _react2.default.createElement(
'div',
{ style: this.props.imageContainerStyle },
this.state.image_objs_array.map(function (img_obj) {
this.state.image_objs_array.length !== 0 && this.state.image_objs_array.map(function (img_obj) {
if (img_obj.type.split("/")[0] === "image") {

@@ -109,2 +109,5 @@ return _react2.default.createElement('img', { alt: img_obj.name, src: img_obj.base64, key: img_obj.name, style: _this3.props.imageStyle });

}
}),
this.state.image_objs_array.length === 0 && this.props.defaultFiles.map(function (img_url, index) {
_react2.default.createElement('img', { src: img_url, key: index, style: _this3.props.imageStyle });
})

@@ -128,3 +131,3 @@ ),

},
value: this.state.image_objs_array.length === 1 ? this.state.image_objs_array[0].name : this.state.image_objs_array.length === 0 ? "No file selected" : this.state.image_objs_array.length + " files selected"
value: this.state.image_objs_array.length === 1 ? this.state.image_objs_array[0].name : this.state.image_objs_array.length > 1 ? this.state.image_objs_array.length + " files selected" : this.props.defaultFiles.length === 0 ? "No files selected" : "Leave empty to keep previous selection"
} : {

@@ -134,3 +137,3 @@ onClick: function onClick() {

},
value: this.state.image_objs_array.length === 1 ? this.state.image_objs_array[0].name : this.state.image_objs_array.length === 0 ? "No file selected" : this.state.image_objs_array.length + " files selected"
value: this.state.image_objs_array.length === 1 ? this.state.image_objs_array[0].name : this.state.image_objs_array.length > 1 ? this.state.image_objs_array.length + " files selected" : this.props.defaultFiles.length === 0 ? "No files selected" : "Leave empty to keep previous selection"
}),

@@ -188,3 +191,4 @@ _react2.default.cloneElement(this.props.buttonComponent, this.props.useTapEventPlugin ? { onTouchTap: function onTouchTap() {

nonPreviewComponent: _react2.default.createElement(_nonPreviewDefaultComponent2.default, null),
textFieldComponent: _react2.default.createElement('input', { type: 'text' })
textFieldComponent: _react2.default.createElement('input', { type: 'text' }),
defaultFiles: []
};

@@ -208,3 +212,4 @@

nonPreviewComponent: _react2.default.PropTypes.element,
textFieldComponent: _react2.default.PropTypes.element
textFieldComponent: _react2.default.PropTypes.element,
defaultFiles: _react2.default.PropTypes.array
};
{
"name": "react-file-input-previews-base64",
"version": "1.0.3",
"version": "1.0.4",
"description": "This package provides an easy to use, ready to go and customizable wrapper around file input, with option for image previews and returning file as base64 string.",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -48,2 +48,3 @@ # react-file-input-previews-base64

| inputName | string | String passed to name prop of input, if not present, using this component as part of form will not work. | none |
| defaultFiles | array | Array consisting of urls of files to show as pre-selections, useful for edit forms, currently only supports urls to image files | [] |

@@ -50,0 +51,0 @@ ## Note

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc