Skip to content

Commit

Permalink
Merge a9ff300 into 4f268bc
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonyrivas committed Jan 14, 2021
2 parents 4f268bc + a9ff300 commit 6d19a9d
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 51 deletions.
34 changes: 3 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,19 @@
[![Build Status](https://travis-ci.org/merlosy/ngx-material-file-input.svg?branch=master)](https://travis-ci.org/merlosy/ngx-material-file-input)
[![npm](https://img.shields.io/npm/dt/ngx-material-file-input.svg)](https://www.npmjs.com/package/ngx-material-file-input)
[![](http://img.badgesize.io/https://unpkg.com/ngx-material-file-input@latest/bundles/ngx-material-file-input.umd.min.js?label=full%20size%20as%20min.js&compression=gzip&style=square&color=02adff)](https://www.npmjs.com/package/ngx-material-file-input)
[![Coverage Status](https://coveralls.io/repos/github/merlosy/ngx-material-file-input/badge.svg)](https://coveralls.io/github/merlosy/ngx-material-file-input)
[![Known Vulnerabilities](https://snyk.io/test/github/merlosy/ngx-material-file-input/badge.svg)](https://snyk.io/test/github/merlosy/ngx-material-file-input)

# material-file-input

This project provides :

* `ngx-mat-file-input` component, to use inside Angular Material `mat-form-field`
* a `FileValidator` with `maxContentSize`, to limit the file size
* a `ByteFormatPipe` to format the file size in a human-readable format

For more code samples, have a look at the [DEMO SITE](https://merlosy.github.io/ngx-material-file-input)
This is a custom fork of the original ngx-material-file-input by merlosy. find the original here: https://www.npmjs.com/package/ngx-material-file-input

## Install

```
npm i ngx-material-file-input
npm i @kamikazebot/ngx-mat-file-input
```

## API reference

### MaterialFileInputModule

```ts
import { MaterialFileInputModule } from 'ngx-material-file-input';
import { MaterialFileInputModule } from '@kamikazebot/ngx-mat-file-input';

@NgModule({
imports: [
Expand Down Expand Up @@ -81,19 +69,3 @@ _Output:_ 100 MB
| Name | Description | Error structure |
| ---------------------------------------------- | ----------------------------------------------- | ----------------------------------------- |
| maxContentSize(value: `number`): `ValidatorFn` | Limit the total file(s) size to the given value | `{ actualSize: number, maxSize: number }` |

# About me

[@jereyleg](https://twitter.com/jereyleg)

☆ to show support :)

# Roadmap

* drop event to add files
* _ideas?_

# Kudos to

* https://github.com/dherges/ng-packagr
* Jason Aden - Packaging Angular Libraries https://www.youtube.com/watch?v=QfvwQEJVOig
18 changes: 9 additions & 9 deletions libs/material-file-input/package.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
{
"name": "ngx-material-file-input",
"version": "2.1.1",
"name": "@kamikazebot/ngx-material-file-input",
"version": "2.1.3",
"license": "MIT",
"author": {
"name": "Jeremy Legros"
},
"description": "File input management for Angular Material",
"homepage": "https://merlosy.github.io/ngx-material-file-input/",
"homepage": "https://anthonyrivas.dev/",
"keywords": ["angular", "material", "file", "input", "mat-form-field"],
"bugs": {
"url": "https://github.com/merlosy/ngx-material-file-input/issues"
"url": "https://github.com/anthonyrivas/ngx-material-file-input/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/merlosy/ngx-material-file-input"
"url": "https://github.com/anthonyrivas/ngx-material-file-input"
},
"dependencies": {},
"peerDependencies": {
"@angular/cdk": "^8.1.1 || ^9.0.0",
"@angular/common": "^8.1.3 || ^9.0.0",
"@angular/core": "^8.1.3 || ^9.0.0",
"@angular/material": "^8.1.1 || ^9.0.0"
"@angular/cdk": "^8.1.1 || ^9.0.0 || ^10.0.0",
"@angular/common": "^8.1.3 || ^9.0.0 || ^10.0.0",
"@angular/core": "^8.1.3 || ^9.0.0 || ^10.0.0",
"@angular/material": "^8.1.1 || ^9.0.0 || ^10.0.0"
},
"ngPackage": {
"lib": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@
}

input {
width: 0px;
height: 0px;
opacity: 0;
overflow: hidden;
position: absolute;
z-index: -1;
opacity: 0;
display: block;
height: 100%;
width: 100%;
}

.filename {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<input #input type="file" [attr.multiple]="multiple? '' : null" [attr.accept]="accept">
<span class="filename" [title]="fileNames">{{ fileNames }}</span>
<input #input type="file" [attr.multiple]="multiple? '' : null" [attr.accept]="accept" [disabled]="disabled">
<span class="filename">{{ fileNames }}</span>
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"name": "material-file-input",
"version": "2.1.1",
"name": "custom-material-file-input",
"version": "2.1.3",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "./node_modules/.bin/ng serve",
"clean": "rm -rf dist",
"build": "ng build",
"build:lib": "ng-packagr -p libs/material-file-input/package.json && cp README.md dist/material-file-input",
"prepare": "npm run build:lib",
"test": "ng test",
"test:once": "ng test material-file-input --watch=false",
"lint": "./node_modules/.bin/nx workspace-lint && ng lint",
Expand All @@ -17,7 +18,7 @@
"push:demo": "git subtree push --prefix dist/apps/demo-packaged origin gh-pages",
"erase:demo": "git push origin --delete gh-pages",
"deploy:demo": "npm run commit:demo && npm run push:demo",
"publish:lib": "npm publish dist/material-file-input",
"publish:lib": "npm publish --access public dist/material-file-input",
"affected:apps": "./node_modules/.bin/nx affected:apps",
"affected:build": "./node_modules/.bin/nx affected:build",
"affected:e2e": "./node_modules/.bin/nx affected:e2e",
Expand Down

0 comments on commit 6d19a9d

Please sign in to comment.