diff --git a/README.md b/README.md index 5a184f1..03dd95a 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,14 @@ -# ng-file-uploader +# ngx-uploader-directive Angular 9 File Uploader. This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 7.3.8. ## Installation -Add `ng-file-uploader` module as dependency to your project. +Add `ngx-uploader-directive` module as dependency to your project. ```console -npm install ng-file-uploader --save +npm install ngx-uploader-directive --save ``` ## Usage @@ -19,7 +19,7 @@ npm install ng-file-uploader --save // app.module.ts import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; -import { NgFileUploaderModule } from 'ng-file-uploader'; +import { NgFileUploaderModule } from 'ngx-uploader-directive'; import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; @@ -45,7 +45,7 @@ export class AppModule { } // shared.module.ts import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; -import { NgFileUploaderModule } from 'ng-file-uploader'; +import { NgFileUploaderModule } from 'ngx-uploader-directive'; @NgModule({ imports: [ @@ -106,7 +106,7 @@ export interface IUploadProgress { } /** - * Upload Input events that can be emit to ng-file-uploader. + * Upload Input events that can be emit to ngx-uploader-directive. */ export interface IUploadInput { type: 'uploadAll' | 'uploadFile' | 'cancel' | 'cancelAll' | 'remove' | 'removeAll'; // Input event type. @@ -122,7 +122,7 @@ export interface IUploadInput { } /** - * File Upload Output Events that emitted by ng-file-uploader. + * File Upload Output Events that emitted by ngx-uploader-directive. */ export interface IUploadOutput { type: 'init' | 'addedToQueue' | 'allAddedToQueue' | 'uploading' | 'done' | 'start' | 'cancelled' | 'dragOver' | 'dragOut' | 'drop' | 'removed' | 'removedAll' | 'rejected' | 'error'; // Output events. @@ -142,7 +142,7 @@ export interface IUploadOutput { ```ts // tslint:disable: max-line-length import { Component, EventEmitter } from '@angular/core'; -import { IUploadOptions, ISelectedFile, IUploadInput, IUploadOutput } from 'ng-file-uploader'; +import { IUploadOptions, ISelectedFile, IUploadInput, IUploadOutput } from 'ngx-uploader-directive'; @Component({ selector: 'app-root', @@ -151,7 +151,7 @@ import { IUploadOptions, ISelectedFile, IUploadInput, IUploadOutput } from 'ng-f }) export class AppComponent { - title = 'ng-file-uploader'; + title = 'ngx-uploader-directive'; options: IUploadOptions; formData: FormData; files: Array; @@ -269,4 +269,4 @@ npm start ### LICENCE -[MIT](https://github.com/jayprajapati857/ng-file-uploader/blob/master/LICENSE) +[MIT](https://github.com/jayprajapati857/ngx-uploader-directive/blob/master/LICENSE) diff --git a/angular.json b/angular.json index 501b98e..7dbb85b 100644 --- a/angular.json +++ b/angular.json @@ -3,7 +3,7 @@ "version": 1, "newProjectRoot": "projects", "projects": { - "ng-file-uploader": { + "ngx-uploader-directive": { "root": "", "sourceRoot": "src", "projectType": "application", @@ -17,7 +17,7 @@ "build": { "builder": "@angular-devkit/build-angular:browser", "options": { - "outputPath": "dist/ng-file-uploader", + "outputPath": "dist/ngx-uploader-directive", "index": "src/index.html", "main": "src/main.ts", "polyfills": "src/polyfills.ts", @@ -62,18 +62,18 @@ "serve": { "builder": "@angular-devkit/build-angular:dev-server", "options": { - "browserTarget": "ng-file-uploader:build" + "browserTarget": "ngx-uploader-directive:build" }, "configurations": { "production": { - "browserTarget": "ng-file-uploader:build:production" + "browserTarget": "ngx-uploader-directive:build:production" } } }, "extract-i18n": { "builder": "@angular-devkit/build-angular:extract-i18n", "options": { - "browserTarget": "ng-file-uploader:build" + "browserTarget": "ngx-uploader-directive:build" } }, "test": { @@ -107,7 +107,7 @@ } } }, - "ng-file-uploader-e2e": { + "ngx-uploader-directive-e2e": { "root": "e2e/", "projectType": "application", "prefix": "", @@ -116,11 +116,11 @@ "builder": "@angular-devkit/build-angular:protractor", "options": { "protractorConfig": "e2e/protractor.conf.js", - "devServerTarget": "ng-file-uploader:serve" + "devServerTarget": "ngx-uploader-directive:serve" }, "configurations": { "production": { - "devServerTarget": "ng-file-uploader:serve:production" + "devServerTarget": "ngx-uploader-directive:serve:production" } } }, @@ -135,33 +135,33 @@ } } }, - "ng-file-uploader-lib": { - "root": "projects/ng-file-uploader", - "sourceRoot": "projects/ng-file-uploader/src", + "ngx-uploader-directive-lib": { + "root": "projects/ngx-uploader-directive", + "sourceRoot": "projects/ngx-uploader-directive/src", "projectType": "library", "prefix": "ng", "architect": { "build": { "builder": "@angular-devkit/build-ng-packagr:build", "options": { - "tsConfig": "projects/ng-file-uploader/tsconfig.lib.json", - "project": "projects/ng-file-uploader/ng-package.json" + "tsConfig": "projects/ngx-uploader-directive/tsconfig.lib.json", + "project": "projects/ngx-uploader-directive/ng-package.json" } }, "test": { "builder": "@angular-devkit/build-angular:karma", "options": { - "main": "projects/ng-file-uploader/src/test.ts", - "tsConfig": "projects/ng-file-uploader/tsconfig.spec.json", - "karmaConfig": "projects/ng-file-uploader/karma.conf.js" + "main": "projects/ngx-uploader-directive/src/test.ts", + "tsConfig": "projects/ngx-uploader-directive/tsconfig.spec.json", + "karmaConfig": "projects/ngx-uploader-directive/karma.conf.js" } }, "lint": { "builder": "@angular-devkit/build-angular:tslint", "options": { "tsConfig": [ - "projects/ng-file-uploader/tsconfig.lib.json", - "projects/ng-file-uploader/tsconfig.spec.json" + "projects/ngx-uploader-directive/tsconfig.lib.json", + "projects/ngx-uploader-directive/tsconfig.spec.json" ], "exclude": [ "**/node_modules/**" @@ -171,5 +171,5 @@ } } }, - "defaultProject": "ng-file-uploader" + "defaultProject": "ngx-uploader-directive" } \ No newline at end of file diff --git a/e2e/src/app.e2e-spec.ts b/e2e/src/app.e2e-spec.ts index 74c05f3..682ed4e 100644 --- a/e2e/src/app.e2e-spec.ts +++ b/e2e/src/app.e2e-spec.ts @@ -10,7 +10,7 @@ describe('workspace-project App', () => { it('should display welcome message', () => { page.navigateTo(); - expect(page.getTitleText()).toEqual('Welcome to ng-file-uploader!'); + expect(page.getTitleText()).toEqual('Welcome to ngx-uploader-directive!'); }); afterEach(async () => { diff --git a/package-lock.json b/package-lock.json index 79d413a..7f61531 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "ng-file-uploader", + "name": "ngx-uploader-directive", "version": "1.0.0", "lockfileVersion": 1, "requires": true, diff --git a/package.json b/package.json index 1012efb..e39e63d 100644 --- a/package.json +++ b/package.json @@ -1,24 +1,24 @@ { - "name": "ng-file-uploader", + "name": "ngx-uploader-directive", "version": "1.0.0", "description": "Angular file uploader.", "repository": { "type": "git", - "url": "https://github.com/jayprajapati857/ng-file-uploader.git" + "url": "https://github.com/jayprajapati857/ngx-uploader-directive.git" }, "authors": [ "Jay Prajapati " ], "license": "MIT", "bugs": { - "url": "https://github.com/jayprajapati857/ng-file-uploader/issues" + "url": "https://github.com/jayprajapati857/ngx-uploader-directive/issues" }, - "homepage": "https://github.com/jayprajapati857/ng-file-uploader", + "homepage": "https://github.com/jayprajapati857/ngx-uploader-directive", "keywords": [ "angular", "directive", "typescript", - "ng-file-uploader", + "ngx-uploader-directive", "file upload directive", "angular-file-uploader", "angular file uploader" @@ -26,16 +26,16 @@ "licenses": [ { "type": "MIT", - "url": "https://github.com/jayprajapati857/ng-file-uploader/blob/master/LICENSE" + "url": "https://github.com/jayprajapati857/ngx-uploader-directive/blob/master/LICENSE" } ], "scripts": { "ng": "ng", - "start": "ng build ng-file-uploader-lib && npm install && ng serve --open", - "dev": "ng build ng-file-uploader-lib && ng serve", + "start": "ng build ngx-uploader-directive-lib && npm install && ng serve --open", + "dev": "ng build ngx-uploader-directive-lib && ng serve", "build": "ng build", - "build:lib": "ng build ng-file-uploader-lib", - "build:prod": "ng build ng-file-uploader-lib", + "build:lib": "ng build ngx-uploader-directive-lib", + "build:prod": "ng build ngx-uploader-directive-lib", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e" @@ -80,4 +80,4 @@ "tslint": "~5.11.0", "typescript": "~3.2.2" } -} \ No newline at end of file +} diff --git a/projects/ng-file-uploader/src/lib/ng-file-uploader.module.ts b/projects/ng-file-uploader/src/lib/ng-file-uploader.module.ts deleted file mode 100644 index d8aad71..0000000 --- a/projects/ng-file-uploader/src/lib/ng-file-uploader.module.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { NgModule } from '@angular/core'; -import { NgFileDropDirective } from './directives/ng-file-drop.directive'; -import { NgFileSelectDirective } from './directives/ng-file-select.directive'; -import { HttpClientModule } from '@angular/common/http'; - -@NgModule({ - declarations: [NgFileDropDirective, NgFileSelectDirective], - imports: [ - ], - exports: [ - NgFileDropDirective, - NgFileSelectDirective, - HttpClientModule - ] -}) -export class NgFileUploaderModule { } diff --git a/projects/ng-file-uploader/src/public-api.ts b/projects/ng-file-uploader/src/public-api.ts deleted file mode 100644 index 17063a2..0000000 --- a/projects/ng-file-uploader/src/public-api.ts +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Public API Surface of lib-file-uploader - */ - -export * from './lib/models/ng-file-uploader-models'; -export * from './lib/directives/ng-file-drop.directive'; -export * from './lib/directives/ng-file-select.directive'; -export * from './lib/ng-file-uploader.service'; -export * from './lib/ng-file-uploader.module'; diff --git a/projects/ng-file-uploader/LICENSE b/projects/ngx-uploader-directive/LICENSE similarity index 100% rename from projects/ng-file-uploader/LICENSE rename to projects/ngx-uploader-directive/LICENSE diff --git a/projects/ng-file-uploader/README.md b/projects/ngx-uploader-directive/README.md similarity index 86% rename from projects/ng-file-uploader/README.md rename to projects/ngx-uploader-directive/README.md index 5a184f1..211653e 100644 --- a/projects/ng-file-uploader/README.md +++ b/projects/ngx-uploader-directive/README.md @@ -1,25 +1,25 @@ -# ng-file-uploader +# ngx-uploader-directive Angular 9 File Uploader. This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 7.3.8. ## Installation -Add `ng-file-uploader` module as dependency to your project. +Add `ngx-uploader-directive` module as dependency to your project. ```console -npm install ng-file-uploader --save +npm install ngx-uploader-directive --save ``` ## Usage -1. Import `NgFileUploaderModule` into your AppModule or in module where you will use it. +1. Import `NgxUploaderDirectiveModule` into your AppModule or in module where you will use it. ```ts // app.module.ts import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; -import { NgFileUploaderModule } from 'ng-file-uploader'; +import { NgxUploaderDirectiveModule } from 'ngx-uploader-directive'; import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; @@ -31,7 +31,7 @@ import { AppComponent } from './app.component'; imports: [ BrowserModule, AppRoutingModule, - NgFileUploaderModule + NgxUploaderDirectiveModule ], providers: [], bootstrap: [AppComponent] @@ -39,19 +39,19 @@ import { AppComponent } from './app.component'; export class AppModule { } ``` -**or** Import `NgFileUploaderModule` into your SharedModule. This could be usefull if your project has nested Modules. +**or** Import `NgxUploaderDirectiveModule` into your SharedModule. This could be usefull if your project has nested Modules. ```ts // shared.module.ts import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; -import { NgFileUploaderModule } from 'ng-file-uploader'; +import { NgxUploaderDirectiveModule } from 'ngx-uploader-directive'; @NgModule({ imports: [ BrowserModule, AppRoutingModule, - NgFileUploaderModule + NgxUploaderDirectiveModule ], providers: [], bootstrap: [AppComponent] @@ -106,7 +106,7 @@ export interface IUploadProgress { } /** - * Upload Input events that can be emit to ng-file-uploader. + * Upload Input events that can be emit to ngx-uploader-directive. */ export interface IUploadInput { type: 'uploadAll' | 'uploadFile' | 'cancel' | 'cancelAll' | 'remove' | 'removeAll'; // Input event type. @@ -122,7 +122,7 @@ export interface IUploadInput { } /** - * File Upload Output Events that emitted by ng-file-uploader. + * File Upload Output Events that emitted by ngx-uploader-directive. */ export interface IUploadOutput { type: 'init' | 'addedToQueue' | 'allAddedToQueue' | 'uploading' | 'done' | 'start' | 'cancelled' | 'dragOver' | 'dragOut' | 'drop' | 'removed' | 'removedAll' | 'rejected' | 'error'; // Output events. @@ -142,7 +142,7 @@ export interface IUploadOutput { ```ts // tslint:disable: max-line-length import { Component, EventEmitter } from '@angular/core'; -import { IUploadOptions, ISelectedFile, IUploadInput, IUploadOutput } from 'ng-file-uploader'; +import { IUploadOptions, ISelectedFile, IUploadInput, IUploadOutput } from 'ngx-uploader-directive'; @Component({ selector: 'app-root', @@ -151,13 +151,13 @@ import { IUploadOptions, ISelectedFile, IUploadInput, IUploadOutput } from 'ng-f }) export class AppComponent { - title = 'ng-file-uploader'; + title = 'ngx-uploader-directive'; options: IUploadOptions; formData: FormData; files: Array; uploadInput: EventEmitter; dragOver: boolean; - uploadUrl = 'http://192.168.0.224:8099/api/blocklists/uploadblockednumberfile'; + uploadUrl = 'upload url'; /** @@ -236,18 +236,19 @@ export class AppComponent { this.uploadInput.emit({ type: 'removeAll' }); } } + ``` **Html code** ```html -

Drag & Drop

@@ -260,13 +261,11 @@ export class AppComponent { ## Running demo on local machine ```console - npm install npm start - ``` ### LICENCE -[MIT](https://github.com/jayprajapati857/ng-file-uploader/blob/master/LICENSE) +[MIT](https://github.com/jayprajapati857/ngx-uploader-directive/blob/master/LICENSE) diff --git a/projects/ng-file-uploader/karma.conf.js b/projects/ngx-uploader-directive/karma.conf.js similarity index 91% rename from projects/ng-file-uploader/karma.conf.js rename to projects/ngx-uploader-directive/karma.conf.js index c7b7ac5..f918b42 100644 --- a/projects/ng-file-uploader/karma.conf.js +++ b/projects/ngx-uploader-directive/karma.conf.js @@ -16,7 +16,7 @@ module.exports = function (config) { clearContext: false // leave Jasmine Spec Runner output visible in browser }, coverageIstanbulReporter: { - dir: require('path').join(__dirname, '../../coverage/ng-file-uploader'), + dir: require('path').join(__dirname, '../../coverage/ngx-uploader-directive'), reports: ['html', 'lcovonly'], fixWebpackSourcePaths: true }, diff --git a/projects/ng-file-uploader/ng-package.json b/projects/ngx-uploader-directive/ng-package.json similarity index 72% rename from projects/ng-file-uploader/ng-package.json rename to projects/ngx-uploader-directive/ng-package.json index 538e4e2..ac4177e 100644 --- a/projects/ng-file-uploader/ng-package.json +++ b/projects/ngx-uploader-directive/ng-package.json @@ -1,6 +1,6 @@ { "$schema": "../../node_modules/ng-packagr/ng-package.schema.json", - "dest": "../../dist/ng-file-uploader", + "dest": "../../dist/ngx-uploader-directive", "lib": { "entryFile": "src/public-api.ts" } diff --git a/projects/ng-file-uploader/package.json b/projects/ngx-uploader-directive/package.json similarity index 57% rename from projects/ng-file-uploader/package.json rename to projects/ngx-uploader-directive/package.json index bd8196b..521b475 100644 --- a/projects/ng-file-uploader/package.json +++ b/projects/ngx-uploader-directive/package.json @@ -1,24 +1,24 @@ { - "name": "ng-file-uploader", + "name": "ngx-uploader-directive", "version": "1.0.0", "description": "Angular file uploader.", "repository": { "type": "git", - "url": "https://github.com/jayprajapati857/ng-file-uploader.git" + "url": "https://github.com/jayprajapati857/ngx-uploader-directive.git" }, "authors": [ "Jay Prajapati " ], "license": "MIT", "bugs": { - "url": "https://github.com/jayprajapati857/ng-file-uploader/issues" + "url": "https://github.com/jayprajapati857/ngx-uploader-directive/issues" }, - "homepage": "https://github.com/jayprajapati857/ng-file-uploader", + "homepage": "https://github.com/jayprajapati857/ngx-uploader-directive", "keywords": [ "angular", "directive", "typescript", - "ng-file-uploader", + "ngx-uploader-directive", "file upload directive", "angular-file-uploader", "angular file uploader" @@ -26,7 +26,7 @@ "licenses": [ { "type": "MIT", - "url": "https://github.com/jayprajapati857/ng-file-uploader/blob/master/LICENSE" + "url": "https://github.com/jayprajapati857/ngx-uploader-directive/blob/master/LICENSE" } ], "peerDependencies": { diff --git a/projects/ng-file-uploader/src/lib/directives/ng-file-drop.directive.ts b/projects/ngx-uploader-directive/src/lib/directives/ngx-uploader-drop.directive.ts similarity index 90% rename from projects/ng-file-uploader/src/lib/directives/ng-file-drop.directive.ts rename to projects/ngx-uploader-directive/src/lib/directives/ngx-uploader-drop.directive.ts index 34283d7..9da959e 100644 --- a/projects/ng-file-uploader/src/lib/directives/ng-file-drop.directive.ts +++ b/projects/ngx-uploader-directive/src/lib/directives/ngx-uploader-drop.directive.ts @@ -23,23 +23,23 @@ // tslint:disable: max-line-length import { Directive, Input, EventEmitter, Output, ElementRef, HostListener } from '@angular/core'; -import { IUploadOptions, IUploadInput, IUploadOutput } from '../models/ng-file-uploader-models'; +import { IUploadOptions, IUploadInput, IUploadOutput } from '../models/ngx-uploader-directive-models'; import { Subscription } from 'rxjs'; import { HttpClient } from '@angular/common/http'; -import { NgFileUploaderService } from '../ng-file-uploader.service'; +import { NgxUploaderDirectiveService } from '../ngx-uploader-directive.service'; @Directive({ // tslint:disable-next-line: directive-selector - selector: '[ngFileDrop]' + selector: '[ngxFileDrop]' }) -export class NgFileDropDirective { +export class NgxUploaderDropDirective { @Input() options: IUploadOptions; @Input() uploadInput: EventEmitter; @Output() uploadOutput: EventEmitter; - uploadService: NgFileUploaderService; + uploadService: NgxUploaderDirectiveService; element: HTMLInputElement; subscriptions: Array; @@ -58,7 +58,7 @@ export class NgFileDropDirective { const allowedFileTypes = this.options.allowedFileTypes; const maxFileUploads = this.options.maxFileUploads; const maxFileSize = this.options.maxFileSize; - this.uploadService = new NgFileUploaderService(concurrency, this.options.maxFilesToAddInSingleRequest, allowedFileTypes, maxFileUploads, maxFileSize, this.httpClient, this.options.logs); + this.uploadService = new NgxUploaderDirectiveService(concurrency, this.options.maxFilesToAddInSingleRequest, allowedFileTypes, maxFileUploads, maxFileSize, this.httpClient, this.options.logs); // file upload element this.element = this.elementRef.nativeElement; diff --git a/projects/ng-file-uploader/src/lib/directives/ng-file-select.directive.ts b/projects/ngx-uploader-directive/src/lib/directives/ngx-uploader-select.directive.ts similarity index 88% rename from projects/ng-file-uploader/src/lib/directives/ng-file-select.directive.ts rename to projects/ngx-uploader-directive/src/lib/directives/ngx-uploader-select.directive.ts index 5e70f6d..dce01b5 100644 --- a/projects/ng-file-uploader/src/lib/directives/ng-file-select.directive.ts +++ b/projects/ngx-uploader-directive/src/lib/directives/ngx-uploader-select.directive.ts @@ -22,23 +22,23 @@ */ import { Directive, Input, EventEmitter, Output, ElementRef } from '@angular/core'; -import { IUploadOptions, IUploadInput, IUploadOutput } from '../models/ng-file-uploader-models'; +import { IUploadOptions, IUploadInput, IUploadOutput } from '../models/ngx-uploader-directive-models'; import { Subscription } from 'rxjs'; import { HttpClient } from '@angular/common/http'; -import { NgFileUploaderService } from '../ng-file-uploader.service'; +import { NgxUploaderDirectiveService } from '../ngx-uploader-directive.service'; @Directive({ // tslint:disable-next-line: directive-selector - selector: '[ngFileSelect]' + selector: '[ngxFileSelect]' }) -export class NgFileSelectDirective { +export class NgxUploaderSelectDirective { @Input() options: IUploadOptions; @Input() uploadInput: EventEmitter; @Output() uploadOutput: EventEmitter; - uploadService: NgFileUploaderService; + uploadService: NgxUploaderDirectiveService; element: HTMLInputElement; subscriptions: Array; @@ -58,7 +58,7 @@ export class NgFileSelectDirective { const maxFileUploads = this.options.maxFileUploads; const maxFileSize = this.options.maxFileSize; // tslint:disable-next-line: max-line-length - this.uploadService = new NgFileUploaderService(concurrency, this.options.maxFilesToAddInSingleRequest, allowedFileTypes, maxFileUploads, maxFileSize, this.httpClient, this.options.logs); + this.uploadService = new NgxUploaderDirectiveService(concurrency, this.options.maxFilesToAddInSingleRequest, allowedFileTypes, maxFileUploads, maxFileSize, this.httpClient, this.options.logs); // file upload element this.element = this.elementRef.nativeElement; diff --git a/projects/ng-file-uploader/src/lib/models/ng-file-uploader-models.ts b/projects/ngx-uploader-directive/src/lib/models/ngx-uploader-directive-models.ts similarity index 96% rename from projects/ng-file-uploader/src/lib/models/ng-file-uploader-models.ts rename to projects/ngx-uploader-directive/src/lib/models/ngx-uploader-directive-models.ts index 82ee5f8..23830ff 100644 --- a/projects/ng-file-uploader/src/lib/models/ng-file-uploader-models.ts +++ b/projects/ngx-uploader-directive/src/lib/models/ngx-uploader-directive-models.ts @@ -64,7 +64,7 @@ export interface IUploadProgress { } /** - * Upload Input events that can be emit to ng-file-uploader. + * Upload Input events that can be emit to ngx-uploader-directive. */ export interface IUploadInput { type: 'uploadAll' | 'uploadFile' | 'cancel' | 'cancelAll' | 'remove' | 'removeAll'; // Input event type. @@ -80,7 +80,7 @@ export interface IUploadInput { } /** - * File Upload Output Events that emitted by ng-file-uploader. + * File Upload Output Events that emitted by ngx-uploader-directive. */ export interface IUploadOutput { type: 'init' | 'addedToQueue' | 'allAddedToQueue' | 'uploading' | 'done' | 'start' | 'cancelled' | 'dragOver' diff --git a/projects/ngx-uploader-directive/src/lib/ngx-uploader-directive.module.ts b/projects/ngx-uploader-directive/src/lib/ngx-uploader-directive.module.ts new file mode 100644 index 0000000..c0547bf --- /dev/null +++ b/projects/ngx-uploader-directive/src/lib/ngx-uploader-directive.module.ts @@ -0,0 +1,16 @@ +import { NgModule } from '@angular/core'; +import { NgxUploaderDropDirective } from './directives/ngx-uploader-drop.directive'; +import { NgxUploaderSelectDirective } from './directives/ngx-uploader-select.directive'; +import { HttpClientModule } from '@angular/common/http'; + +@NgModule({ + declarations: [NgxUploaderDropDirective, NgxUploaderSelectDirective], + imports: [ + ], + exports: [ + NgxUploaderDropDirective, + NgxUploaderSelectDirective, + HttpClientModule + ] +}) +export class NgxUploaderDirectiveModule { } diff --git a/projects/ng-file-uploader/src/lib/ng-file-uploader.service.ts b/projects/ngx-uploader-directive/src/lib/ngx-uploader-directive.service.ts similarity index 99% rename from projects/ng-file-uploader/src/lib/ng-file-uploader.service.ts rename to projects/ngx-uploader-directive/src/lib/ngx-uploader-directive.service.ts index 93a7484..d9e10af 100644 --- a/projects/ng-file-uploader/src/lib/ng-file-uploader.service.ts +++ b/projects/ngx-uploader-directive/src/lib/ngx-uploader-directive.service.ts @@ -23,7 +23,7 @@ // tslint:disable: no-console import { Injectable, EventEmitter } from '@angular/core'; -import { ISelectedFile, IUploadOutput, IUploadInput, IUploadProgress } from './models/ng-file-uploader-models'; +import { ISelectedFile, IUploadOutput, IUploadInput, IUploadProgress } from './models/ngx-uploader-directive-models'; import { Observable, Subscription } from 'rxjs'; import { finalize } from 'rxjs/operators'; import { HttpRequest, HttpClient, HttpEventType, HttpHandler } from '@angular/common/http'; @@ -32,7 +32,7 @@ import { HttpRequest, HttpClient, HttpEventType, HttpHandler } from '@angular/co // providedIn: 'root' // }) -export class NgFileUploaderService { +export class NgxUploaderDirectiveService { queue: Array; subscriptions: Array<{ id: string, sub: Subscription }>; diff --git a/projects/ngx-uploader-directive/src/public-api.ts b/projects/ngx-uploader-directive/src/public-api.ts new file mode 100644 index 0000000..dcfb0cc --- /dev/null +++ b/projects/ngx-uploader-directive/src/public-api.ts @@ -0,0 +1,9 @@ +/* + * Public API Surface of lib-file-uploader + */ + +export * from './lib/models/ngx-uploader-directive-models'; +export * from './lib/directives/ngx-uploader-drop.directive'; +export * from './lib/directives/ngx-uploader-select.directive'; +export * from './lib/ngx-uploader-directive.service'; +export * from './lib/ngx-uploader-directive.module'; diff --git a/projects/ng-file-uploader/src/test.ts b/projects/ngx-uploader-directive/src/test.ts similarity index 100% rename from projects/ng-file-uploader/src/test.ts rename to projects/ngx-uploader-directive/src/test.ts diff --git a/projects/ng-file-uploader/tsconfig.lib.json b/projects/ngx-uploader-directive/tsconfig.lib.json similarity index 100% rename from projects/ng-file-uploader/tsconfig.lib.json rename to projects/ngx-uploader-directive/tsconfig.lib.json diff --git a/projects/ng-file-uploader/tsconfig.spec.json b/projects/ngx-uploader-directive/tsconfig.spec.json similarity index 100% rename from projects/ng-file-uploader/tsconfig.spec.json rename to projects/ngx-uploader-directive/tsconfig.spec.json diff --git a/projects/ng-file-uploader/tslint.json b/projects/ngx-uploader-directive/tslint.json similarity index 100% rename from projects/ng-file-uploader/tslint.json rename to projects/ngx-uploader-directive/tslint.json diff --git a/src/app/app.component.html b/src/app/app.component.html index 83263a0..ea94872 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -19,13 +19,13 @@

Angular bl -

Drag & Drop

diff --git a/src/app/app.component.spec.ts b/src/app/app.component.spec.ts index e93af65..d513398 100644 --- a/src/app/app.component.spec.ts +++ b/src/app/app.component.spec.ts @@ -20,16 +20,16 @@ describe('AppComponent', () => { expect(app).toBeTruthy(); }); - it(`should have as title 'ng-file-uploader'`, () => { + it(`should have as title 'ngx-uploader-directive'`, () => { const fixture = TestBed.createComponent(AppComponent); const app = fixture.debugElement.componentInstance; - expect(app.title).toEqual('ng-file-uploader'); + expect(app.title).toEqual('ngx-uploader-directive'); }); it('should render title in a h1 tag', () => { const fixture = TestBed.createComponent(AppComponent); fixture.detectChanges(); const compiled = fixture.debugElement.nativeElement; - expect(compiled.querySelector('h1').textContent).toContain('Welcome to ng-file-uploader!'); + expect(compiled.querySelector('h1').textContent).toContain('Welcome to ngx-uploader-directive!'); }); }); diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 84dd772..d91651e 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,6 +1,6 @@ // tslint:disable: max-line-length import { Component, EventEmitter } from '@angular/core'; -import { IUploadOptions, ISelectedFile, IUploadInput, IUploadOutput } from 'ng-file-uploader'; +import { IUploadOptions, ISelectedFile, IUploadInput, IUploadOutput } from 'ngx-uploader-directive'; @Component({ selector: 'app-root', @@ -9,14 +9,13 @@ import { IUploadOptions, ISelectedFile, IUploadInput, IUploadOutput } from 'ng-f }) export class AppComponent { - title = 'ng-file-uploader'; + title = 'ngx-uploader-directive'; options: IUploadOptions; formData: FormData; files: Array; uploadInput: EventEmitter; dragOver: boolean; - uploadUrl = 'http://192.168.0.224:8099/api/blocklists/uploadblockednumberfile'; - + uploadUrl = 'upload url'; /** * Default Constructor diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 9c300f6..aebcb5f 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -1,6 +1,6 @@ import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; -import { NgFileUploaderModule } from 'ng-file-uploader'; +import { NgxUploaderDirectiveModule } from 'ngx-uploader-directive'; import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; @@ -12,7 +12,7 @@ import { AppComponent } from './app.component'; imports: [ BrowserModule, AppRoutingModule, - NgFileUploaderModule + NgxUploaderDirectiveModule ], providers: [], bootstrap: [AppComponent] diff --git a/src/karma.conf.js b/src/karma.conf.js index 8834054..3b66407 100644 --- a/src/karma.conf.js +++ b/src/karma.conf.js @@ -16,7 +16,7 @@ module.exports = function (config) { clearContext: false // leave Jasmine Spec Runner output visible in browser }, coverageIstanbulReporter: { - dir: require('path').join(__dirname, '../coverage/ng-file-uploader'), + dir: require('path').join(__dirname, '../coverage/ngx-uploader-directive'), reports: ['html', 'lcovonly', 'text-summary'], fixWebpackSourcePaths: true }, diff --git a/tsconfig.json b/tsconfig.json index a30a960..07e36f9 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -19,11 +19,11 @@ "dom" ], "paths": { - "ng-file-uploader": [ - "dist/ng-file-uploader" + "ngx-uploader-directive": [ + "dist/ngx-uploader-directive" ], - "ng-file-uploader/*": [ - "dist/ng-file-uploader/*" + "ngx-uploader-directive/*": [ + "dist/ngx-uploader-directive/*" ] } }