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

angular2-image-upload

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular2-image-upload - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

lib/file-drop.directive.metadata.json

7

lib/file-drop.directive.d.ts

@@ -0,7 +1,8 @@

import { EventEmitter } from '@angular/core';
export declare class FileDropDirective {
accept: string[];
private isFileOver;
private fileDrop;
isFileOver: EventEmitter<boolean>;
fileDrop: EventEmitter<FileList>;
onDragOver(event: any): void;
onDragLeave(event: any): void;
onDragLeave(): void;
onDrop(event: any): void;

@@ -8,0 +9,0 @@ private filterFiles(files);

"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var core_1 = require("@angular/core");
var FileDropDirective = FileDropDirective_1 = (function () {
var core_1 = require('@angular/core');
var FileDropDirective = (function () {
function FileDropDirective() {

@@ -18,4 +9,4 @@ this.isFileOver = new core_1.EventEmitter();

FileDropDirective.prototype.onDragOver = function (event) {
var dataTransfer = FileDropDirective_1.getDataTransfer(event);
if (!FileDropDirective_1.hasFiles(dataTransfer.types)) {
var dataTransfer = FileDropDirective.getDataTransfer(event);
if (!FileDropDirective.hasFiles(dataTransfer.types)) {
return;

@@ -27,8 +18,8 @@ }

};
FileDropDirective.prototype.onDragLeave = function (event) {
FileDropDirective.prototype.onDragLeave = function () {
this.isFileOver.emit(false);
};
FileDropDirective.prototype.onDrop = function (event) {
var dataTransfer = FileDropDirective_1.getDataTransfer(event);
if (!FileDropDirective_1.hasFiles(dataTransfer.types)) {
var dataTransfer = FileDropDirective.getDataTransfer(event);
if (!FileDropDirective.hasFiles(dataTransfer.types)) {
return;

@@ -49,3 +40,3 @@ }

for (var j = 0; j < this.accept.length; j++) {
if (FileDropDirective_1.matchRule(this.accept[j], files[i].type)) {
if (FileDropDirective.matchRule(this.accept[j], files[i].type)) {
acceptedFiles.push(files[i]);

@@ -76,41 +67,19 @@ break;

};
FileDropDirective.decorators = [
{ type: core_1.Directive, args: [{
selector: '[fileDrop]'
},] },
];
FileDropDirective.ctorParameters = function () { return []; };
FileDropDirective.propDecorators = {
'accept': [{ type: core_1.Input },],
'isFileOver': [{ type: core_1.Output },],
'fileDrop': [{ type: core_1.Output },],
'onDragOver': [{ type: core_1.HostListener, args: ['dragover', ['$event'],] },],
'onDragLeave': [{ type: core_1.HostListener, args: ['dragleave', ['$event'],] },],
'onDrop': [{ type: core_1.HostListener, args: ['drop', ['$event'],] },],
};
return FileDropDirective;
}());
__decorate([
core_1.Input(),
__metadata("design:type", Array)
], FileDropDirective.prototype, "accept", void 0);
__decorate([
core_1.Output(),
__metadata("design:type", core_1.EventEmitter)
], FileDropDirective.prototype, "isFileOver", void 0);
__decorate([
core_1.Output(),
__metadata("design:type", core_1.EventEmitter)
], FileDropDirective.prototype, "fileDrop", void 0);
__decorate([
core_1.HostListener('dragover', ['$event']),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", void 0)
], FileDropDirective.prototype, "onDragOver", null);
__decorate([
core_1.HostListener('dragleave', ['$event']),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", void 0)
], FileDropDirective.prototype, "onDragLeave", null);
__decorate([
core_1.HostListener('drop', ['$event']),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", void 0)
], FileDropDirective.prototype, "onDrop", null);
FileDropDirective = FileDropDirective_1 = __decorate([
core_1.Directive({
selector: '[fileDrop]'
})
], FileDropDirective);
exports.FileDropDirective = FileDropDirective;
var FileDropDirective_1;
//# sourceMappingURL=file-drop.directive.js.map
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var core_1 = require("@angular/core");

@@ -13,3 +7,3 @@ var image_upload_component_1 = require("./image-upload/image-upload.component");

var image_service_1 = require("./image.service");
var ImageUploadModule = ImageUploadModule_1 = (function () {
var ImageUploadModule = (function () {
function ImageUploadModule() {

@@ -19,20 +13,20 @@ }

return {
ngModule: ImageUploadModule_1,
ngModule: ImageUploadModule,
providers: [image_service_1.ImageService]
};
};
ImageUploadModule.decorators = [
{ type: core_1.NgModule, args: [{
imports: [common_1.CommonModule],
declarations: [
image_upload_component_1.ImageUploadComponent,
file_drop_directive_1.FileDropDirective
],
exports: [image_upload_component_1.ImageUploadComponent]
},] },
];
ImageUploadModule.ctorParameters = function () { return []; };
return ImageUploadModule;
}());
ImageUploadModule = ImageUploadModule_1 = __decorate([
core_1.NgModule({
imports: [common_1.CommonModule],
declarations: [
image_upload_component_1.ImageUploadComponent,
file_drop_directive_1.FileDropDirective
],
exports: [image_upload_component_1.ImageUploadComponent]
})
], ImageUploadModule);
exports.ImageUploadModule = ImageUploadModule;
var ImageUploadModule_1;
//# sourceMappingURL=image-upload.module.js.map

@@ -0,2 +1,10 @@

import { EventEmitter } from '@angular/core';
import { ImageService, Header } from "../image.service";
export declare class FileHolder {
src: string;
file: File;
serverResponse: any;
pending: boolean;
constructor(src: string, file: File);
}
export declare class ImageUploadComponent {

@@ -8,5 +16,5 @@ private imageService;

preview: boolean;
private isPending;
private onFileUploadFinish;
private onRemove;
isPending: EventEmitter<boolean>;
onFileUploadFinish: EventEmitter<FileHolder>;
onRemove: EventEmitter<FileHolder>;
private files;

@@ -16,4 +24,4 @@ private fileCounter;

private isFileOver;
private buttonCaption;
private dropBoxMessage;
buttonCaption: string;
dropBoxMessage: string;
constructor(imageService: ImageService);

@@ -27,3 +35,2 @@ ngOnInit(): void;

private countRemainingSlots();
readonly value: any[];
}
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var core_1 = require("@angular/core");
var core_1 = require('@angular/core');
var image_service_1 = require("../image.service");

@@ -21,2 +12,3 @@ var FileHolder = (function () {

}());
exports.FileHolder = FileHolder;
var ImageUploadComponent = (function () {

@@ -51,3 +43,3 @@ function ImageUploadComponent(imageService) {

var _this = this;
var _loop_1 = function (i) {
var _loop_1 = function(i) {
var file = files[i];

@@ -99,58 +91,28 @@ var img = document.createElement('img');

};
Object.defineProperty(ImageUploadComponent.prototype, "value", {
get: function () {
return this.files;
},
enumerable: true,
configurable: true
});
ImageUploadComponent.decorators = [
{ type: core_1.Component, args: [{
selector: 'image-upload',
template: "\n<div class=\"image-upload\"\n fileDrop\n [accept]=\"['image/*']\"\n (isFileOver)=\"fileOver($event)\"\n (fileDrop)=\"fileChange($event)\"\n [ngClass]=\"{'file-is-over': isFileOver}\"\n>\n <div class=\"file-upload hr-inline-group\">\n <label class=\"upload-button\">\n <span>{{buttonCaption}}</span>\n <input\n type=\"file\"\n accept=\"image/*\"\n multiple (change)=\"fileChange(input.files)\"\n #input>\n </label>\n\n <div class=\"drag-box-message\">{{dropBoxMessage}}</div>\n </div>\n\n <div *ngIf=\"preview\" class=\"image-container hr-inline-group\">\n <div\n class=\"image\"\n *ngFor=\"let file of files\"\n [ngStyle]=\"{'background-image': 'url('+ file.src +')'}\"\n >\n <div *ngIf=\"file.pending\" class=\"loading-overlay\">\n <div class=\"spinningCircle\"></div>\n </div>\n <div *ngIf=\"!file.pending\" class=\"x-mark\" (click)=\"deleteFile(file)\">\n <span class=\"close\"></span>\n </div>\n </div>\n </div>\n</div>\n",
styles: [
"\n.image-upload {\n --common-radius: 3px;\n --active-color: #33CC99;\n position: relative;\n border-radius: var(--common-radius);\n border: #d0d0d0 dashed 1px;\n font-family: sans-serif;\n}\n\n.file-is-over {\n border-color: var(--active-color);\n border-style: solid;\n}\n\n.hr-inline-group:after {\n display: table;\n clear: both;\n content: \"\";\n}\n\n.file-upload {\n padding: 16px;\n background-color: #f8f8f8;\n}\n\n.drag-box-message {\n float: left;\n display: inline-block;\n margin-left: 12px;\n padding-top: 14px;\n color: #9b9b9b;\n font-weight: 600;\n}\n\nlabel.upload-button input[type=file] {\n display: none;\n position: fixed;\n top: -99999px;\n}\n\n.upload-button {\n cursor: pointer;\n background-color: var(--active-color);\n padding: 10px;\n color: white;\n font-size: 1.25em;\n font-weight: 500;\n text-transform: uppercase;\n display: inline-block;\n float: left;\n \n -webkit-box-shadow: 2px 2px 4px 0px rgba(148,148,148,0.6);\n -moz-box-shadow: 2px 2px 4px 0px rgba(148,148,148,0.6);\n box-shadow: 2px 2px 4px 0px rgba(148,148,148,0.6);\n}\n\n.upload-button:active span{\n position: relative;\n display: block;\n top: 1px;\n}\n\n.image-container {\n background-color: #fdfdfd;\n padding: 0 10px 0 10px;\n}\n\n.image {\n float: left;\n display: inline-block;\n margin: 6px;\n width: 86px;\n height: 86px;\n background: center center no-repeat;\n background-size: contain;\n position: relative;\n}\n\n.x-mark {\n width: 20px;\n height: 20px;\n text-align: center;\n cursor: pointer;\n border-radius: 2px;\n float: right;\n background-color: black;\n opacity: .7;\n color: white;\n margin: 2px;\n}\n\n.close {\n width: 20px;\n height: 20px;\n opacity: .7;\n position: relative;\n padding-right: 3px;\n}\n.x-mark:hover .close {\n opacity: 1;\n}\n.close:before, .close:after {\n border-radius: 2px;\n position: absolute;\n content: '';\n height: 16px;\n width: 2px;\n top: 2px;\n background-color: #FFFFFF;\n}\n\n.close:before {\n transform: rotate(45deg);\n}\n\n.close:after {\n transform: rotate(-45deg);\n}\n\n.loading-overlay {\n position: absolute;\n top: 0; left: 0; bottom: 0; right: 0;\n background-color: black;\n opacity: .7;\n}\n\n.spinningCircle {\n height: 30px;\n width: 30px;\n margin: auto;\n position: absolute;\n top: 0; left: 0; bottom: 0; right: 0;\n border-radius: 50%;\n border: 3px solid rgba(255, 255, 255, 0);\n border-top: 3px solid white;\n border-right: 3px solid white;\n -webkit-animation: spinner 2s infinite cubic-bezier(0.085, 0.625, 0.855, 0.360);\n animation: spinner 2s infinite cubic-bezier(0.085, 0.625, 0.855, 0.360);\n}\n\n@-webkit-keyframes spinner {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n\n@keyframes spinner {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n\n }\n}\n"
]
},] },
];
ImageUploadComponent.ctorParameters = function () { return [
{ type: image_service_1.ImageService, },
]; };
ImageUploadComponent.propDecorators = {
'max': [{ type: core_1.Input },],
'url': [{ type: core_1.Input },],
'headers': [{ type: core_1.Input },],
'preview': [{ type: core_1.Input },],
'isPending': [{ type: core_1.Output },],
'onFileUploadFinish': [{ type: core_1.Output },],
'onRemove': [{ type: core_1.Output },],
'buttonCaption': [{ type: core_1.Input },],
'dropBoxMessage': [{ type: core_1.Input },],
};
return ImageUploadComponent;
}());
__decorate([
core_1.Input(),
__metadata("design:type", Number)
], ImageUploadComponent.prototype, "max", void 0);
__decorate([
core_1.Input(),
__metadata("design:type", String)
], ImageUploadComponent.prototype, "url", void 0);
__decorate([
core_1.Input(),
__metadata("design:type", Array)
], ImageUploadComponent.prototype, "headers", void 0);
__decorate([
core_1.Input(),
__metadata("design:type", Boolean)
], ImageUploadComponent.prototype, "preview", void 0);
__decorate([
core_1.Output(),
__metadata("design:type", core_1.EventEmitter)
], ImageUploadComponent.prototype, "isPending", void 0);
__decorate([
core_1.Output(),
__metadata("design:type", core_1.EventEmitter)
], ImageUploadComponent.prototype, "onFileUploadFinish", void 0);
__decorate([
core_1.Output(),
__metadata("design:type", core_1.EventEmitter)
], ImageUploadComponent.prototype, "onRemove", void 0);
__decorate([
core_1.Input(),
__metadata("design:type", String)
], ImageUploadComponent.prototype, "buttonCaption", void 0);
__decorate([
core_1.Input(),
__metadata("design:type", String)
], ImageUploadComponent.prototype, "dropBoxMessage", void 0);
ImageUploadComponent = __decorate([
core_1.Component({
selector: 'image-upload',
template: "\n<div class=\"image-upload\"\n fileDrop\n [accept]=\"['image/*']\"\n (isFileOver)=\"fileOver($event)\"\n (fileDrop)=\"fileChange($event)\"\n [ngClass]=\"{'file-is-over': isFileOver}\"\n>\n <div class=\"file-upload hr-inline-group\">\n <label class=\"upload-button\">\n <span>{{buttonCaption}}</span>\n <input\n type=\"file\"\n accept=\"image/*\"\n multiple (change)=\"fileChange(input.files)\"\n #input>\n </label>\n\n <div class=\"drag-box-message\">{{dropBoxMessage}}</div>\n </div>\n\n <div *ngIf=\"preview\" class=\"image-container hr-inline-group\">\n <div\n class=\"image\"\n *ngFor=\"let file of files\"\n [ngStyle]=\"{'background-image': 'url('+ file.src +')'}\"\n >\n <div *ngIf=\"file.pending\" class=\"loading-overlay\">\n <div class=\"spinningCircle\"></div>\n </div>\n <div *ngIf=\"!file.pending\" class=\"x-mark\" (click)=\"deleteFile(file)\">\n <span class=\"close\"></span>\n </div>\n </div>\n </div>\n</div>\n",
styles: [
"\n.image-upload {\n --common-radius: 3px;\n --active-color: #33CC99;\n position: relative;\n border-radius: var(--common-radius);\n border: #d0d0d0 dashed 1px;\n font-family: sans-serif;\n}\n\n.file-is-over {\n border-color: var(--active-color);\n border-style: solid;\n}\n\n.hr-inline-group:after {\n display: table;\n clear: both;\n content: \"\";\n}\n\n.file-upload {\n padding: 16px;\n background-color: #f8f8f8;\n}\n\n.drag-box-message {\n float: left;\n display: inline-block;\n margin-left: 12px;\n padding-top: 14px;\n color: #9b9b9b;\n font-weight: 600;\n}\n\nlabel.upload-button input[type=file] {\n display: none;\n position: fixed;\n top: -99999px;\n}\n\n.upload-button {\n cursor: pointer;\n background-color: var(--active-color);\n padding: 10px;\n color: white;\n font-size: 1.25em;\n font-weight: 500;\n text-transform: uppercase;\n display: inline-block;\n float: left;\n \n -webkit-box-shadow: 2px 2px 4px 0px rgba(148,148,148,0.6);\n -moz-box-shadow: 2px 2px 4px 0px rgba(148,148,148,0.6);\n box-shadow: 2px 2px 4px 0px rgba(148,148,148,0.6);\n}\n\n.upload-button:active span{\n position: relative;\n display: block;\n top: 1px;\n}\n\n.image-container {\n background-color: #fdfdfd;\n padding: 0 10px 0 10px;\n}\n\n.image {\n float: left;\n display: inline-block;\n margin: 6px;\n width: 86px;\n height: 86px;\n background: center center no-repeat;\n background-size: contain;\n position: relative;\n}\n\n.x-mark {\n width: 20px;\n height: 20px;\n text-align: center;\n cursor: pointer;\n border-radius: 2px;\n float: right;\n background-color: black;\n opacity: .7;\n color: white;\n margin: 2px;\n}\n\n.close {\n width: 20px;\n height: 20px;\n opacity: .7;\n position: relative;\n padding-right: 3px;\n}\n.x-mark:hover .close {\n opacity: 1;\n}\n.close:before, .close:after {\n border-radius: 2px;\n position: absolute;\n content: '';\n height: 16px;\n width: 2px;\n top: 2px;\n background-color: #FFFFFF;\n}\n\n.close:before {\n transform: rotate(45deg);\n}\n\n.close:after {\n transform: rotate(-45deg);\n}\n\n.loading-overlay {\n position: absolute;\n top: 0; left: 0; bottom: 0; right: 0;\n background-color: black;\n opacity: .7;\n}\n\n.spinningCircle {\n height: 30px;\n width: 30px;\n margin: auto;\n position: absolute;\n top: 0; left: 0; bottom: 0; right: 0;\n border-radius: 50%;\n border: 3px solid rgba(255, 255, 255, 0);\n border-top: 3px solid white;\n border-right: 3px solid white;\n -webkit-animation: spinner 2s infinite cubic-bezier(0.085, 0.625, 0.855, 0.360);\n animation: spinner 2s infinite cubic-bezier(0.085, 0.625, 0.855, 0.360);\n}\n\n@-webkit-keyframes spinner {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n\n@keyframes spinner {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n\n }\n}\n"
],
}),
__metadata("design:paramtypes", [image_service_1.ImageService])
], ImageUploadComponent);
exports.ImageUploadComponent = ImageUploadComponent;
//# sourceMappingURL=image-upload.component.js.map
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var core_1 = require("@angular/core");

@@ -48,8 +42,9 @@ var Observable_1 = require("rxjs/Observable");

};
ImageService.decorators = [
{ type: core_1.Injectable },
];
ImageService.ctorParameters = function () { return []; };
return ImageService;
}());
ImageService = __decorate([
core_1.Injectable()
], ImageService);
exports.ImageService = ImageService;
//# sourceMappingURL=image.service.js.map
{
"name": "angular2-image-upload",
"version": "0.4.0",
"version": "0.4.1",
"description": "An angular component that uploads images using native browser upload or drag-n-drop.",

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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