Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-images-uploading

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-images-uploading - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

8

dist/index.d.ts

@@ -10,4 +10,4 @@ import * as React from "react";

export declare type ImageListType = Array<ImageType>;
interface UploadProps {
children: (props: ExportInterface) => React.ReactNode;
export interface ImageUploadingPropsType {
children?: (props: ExportInterface) => React.ReactNode;
defaultValue?: ImageListType;

@@ -18,3 +18,3 @@ onChange?: (value: ImageListType) => void;

}
interface ExportInterface {
export interface ExportInterface {
imageList: ImageListType;

@@ -24,3 +24,3 @@ onImageUpload: () => void;

}
declare const ImageUploading: React.FC<UploadProps>;
declare const ImageUploading: React.FC<ImageUploadingPropsType>;
export default ImageUploading;

@@ -66,2 +66,10 @@ import { useRef, useState, useEffect, createElement, Fragment } from 'react';

function __spreadArrays() {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
}
var getBase64 = function (file) {

@@ -75,3 +83,2 @@ var reader = new FileReader();

var _this = undefined;
var useRef$1 = useRef, useState$1 = useState, useEffect$1 = useEffect;

@@ -141,3 +148,3 @@ var ImageUploading = function (_a) {

};
var onInputChange = function (e) { return __awaiter(_this, void 0, void 0, function () {
var onInputChange = function (e) { return __awaiter(void 0, void 0, void 0, function () {
var files, fileList_1, updatedFileList;

@@ -164,3 +171,3 @@ return __generator(this, function (_a) {

if (mode === "multiple") {
updatedFileList = imageList.concat(fileList_1);
updatedFileList = __spreadArrays(imageList, fileList_1);
if (maxNumber && updatedFileList.length > maxNumber) {

@@ -187,3 +194,4 @@ updatedFileList = imageList;

createElement("input", { type: "file", accept: "image/*", ref: inputRef, multiple: mode === "multiple" && !keyUpdate, onChange: onInputChange, style: { display: " none" } }),
children({ imageList: imageList, onImageUpload: onImageUpload, onImageRemoveAll: onImageRemoveAll })));
children &&
children({ imageList: imageList, onImageUpload: onImageUpload, onImageRemoveAll: onImageRemoveAll })));
};

@@ -190,0 +198,0 @@ ImageUploading.defaultProps = {

@@ -70,2 +70,10 @@ 'use strict';

function __spreadArrays() {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
}
var getBase64 = function (file) {

@@ -79,3 +87,2 @@ var reader = new FileReader();

var _this = undefined;
var useRef = React.useRef, useState = React.useState, useEffect = React.useEffect;

@@ -145,3 +152,3 @@ var ImageUploading = function (_a) {

};
var onInputChange = function (e) { return __awaiter(_this, void 0, void 0, function () {
var onInputChange = function (e) { return __awaiter(void 0, void 0, void 0, function () {
var files, fileList_1, updatedFileList;

@@ -168,3 +175,3 @@ return __generator(this, function (_a) {

if (mode === "multiple") {
updatedFileList = imageList.concat(fileList_1);
updatedFileList = __spreadArrays(imageList, fileList_1);
if (maxNumber && updatedFileList.length > maxNumber) {

@@ -191,3 +198,4 @@ updatedFileList = imageList;

React.createElement("input", { type: "file", accept: "image/*", ref: inputRef, multiple: mode === "multiple" && !keyUpdate, onChange: onInputChange, style: { display: " none" } }),
children({ imageList: imageList, onImageUpload: onImageUpload, onImageRemoveAll: onImageRemoveAll })));
children &&
children({ imageList: imageList, onImageUpload: onImageUpload, onImageRemoveAll: onImageRemoveAll })));
};

@@ -194,0 +202,0 @@ ImageUploading.defaultProps = {

{
"name": "react-images-uploading",
"version": "1.0.1",
"version": "1.0.2",
"description": ">",

@@ -9,4 +9,5 @@ "author": "imvutoan",

"type": "git",
"url": "/react-images-uploading"
"url": "https://github.com/vutoan266/React-images-uploading"
},
"homepage": "https://github.com/vutoan266/React-images-uploading/blob/master/README.md",
"main": "dist/index.js",

@@ -50,7 +51,16 @@ "module": "dist/index.es.js",

"rollup-plugin-url": "^1.4.0",
"typescript": "^2.8.3"
"typescript": "3.7.3"
},
"files": [
"dist"
],
"keywords": [
"image",
"images",
"upload",
"uploader",
"uploading",
"react image upload",
"react images uploading"
]
}

@@ -23,3 +23,3 @@ # react-images-uploading

import ImageUploading from "react-images-uploading";
// { ImageListType, ImageType } is type for typescript
// { ImageUploadingPropsType, ImageListType, ImageType } is type for typescript

@@ -61,14 +61,18 @@ const mode = "single";

| ------------ | -------- | ---------------------- | -------- | ----------------------------------------------------- |
| mode | string | single | multiple | single | Select just one or multiple images |
| mode | string | single | multiple | Select just one or multiple images |
| maxNumber | number | | 100 | Number of images user can select if mode = "multiple" |
| onChange | function | | | Called every update |
| defaultValue | array | [{dataURL: ... }, ...] | | |
| defaultValue | array | [{dataURL: ... }, ...] | | Init data |
## Exported options
| parameter | type | description |
| ---------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| imageList | array | List of images for render. Each item in imageList has some options: - key : generate filename - dataURL : url image or base64 - onUpdate : call function for replace a new image on current position - onRemove : call function for remove current image |
| onImageUpload | function | Call for upload new image(s) |
| onImageRemoveAll | function | Call for remove all image(s) |
| parameter | type | description |
| ------------------------- | -------- | ------------------------------------------------------------------------- |
| imageList | array | List of images for render. Each item in imageList has some options below. |
| imageList[index].key | string | Generate filename |
| imageList[index].dataURL | string | Url image or base64 |
| imageList[index].onUpdate | function | Call function for replace a new image on current position |
| imageList[index].onRemove | function | Call function for remove current image |
| onImageUpload | function | Call for upload new image(s) |
| onImageRemoveAll | function | Call for remove all image(s) |

@@ -75,0 +79,0 @@ ## License

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc