@ruc-lib/multi-file-upload 3.2.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +110 -23
- package/fesm2022/ruc-lib-multi-file-upload.mjs +152 -0
- package/fesm2022/ruc-lib-multi-file-upload.mjs.map +1 -0
- package/index.d.ts +84 -3
- package/package.json +11 -22
- package/esm2020/index.mjs +0 -4
- package/esm2020/lib/interfaces/multiFileUploadDefault.mjs +0 -2
- package/esm2020/lib/ruclib-multi-file-upload/ruclib-multi-file-upload.component.mjs +0 -112
- package/esm2020/lib/ruclib-multi-file-upload.module.mjs +0 -48
- package/esm2020/lib/services/ruclib-multi-file-upload.service.mjs +0 -24
- package/esm2020/ruc-lib-multi-file-upload.mjs +0 -5
- package/fesm2015/ruc-lib-multi-file-upload.mjs +0 -184
- package/fesm2015/ruc-lib-multi-file-upload.mjs.map +0 -1
- package/fesm2020/ruc-lib-multi-file-upload.mjs +0 -181
- package/fesm2020/ruc-lib-multi-file-upload.mjs.map +0 -1
- package/lib/interfaces/multiFileUploadDefault.d.ts +0 -27
- package/lib/ruclib-multi-file-upload/ruclib-multi-file-upload.component.d.ts +0 -43
- package/lib/ruclib-multi-file-upload.module.d.ts +0 -14
- package/lib/services/ruclib-multi-file-upload.service.d.ts +0 -11
package/README.md
CHANGED
|
@@ -17,17 +17,51 @@ Then second option is delete in which if :
|
|
|
17
17
|
# Install individual component
|
|
18
18
|
|
|
19
19
|
If users only need the multi file upload component, they can install it separately
|
|
20
|
-
`npm install @ruc-lib/multi-file-upload`
|
|
21
20
|
|
|
21
|
+
**For Angular 15:**
|
|
22
|
+
```bash
|
|
23
|
+
npm install @ruc-lib/multi-file-upload@3.2.0 @angular/material@^15.0.0 @angular/cdk@^15.0.0
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**For Angular 16:**
|
|
27
|
+
```bash
|
|
28
|
+
npm install @ruc-lib/multi-file-upload@3.2.0 @angular/material@^16.0.0 @angular/cdk@^16.0.0
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**For Angular 17:**
|
|
32
|
+
```bash
|
|
33
|
+
npm install @ruc-lib/multi-file-upload@4.0.0 @angular/material@^17.0.0 @angular/cdk@^17.0.0
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**For Angular 18:**
|
|
37
|
+
```bash
|
|
38
|
+
npm install @ruc-lib/multi-file-upload@4.0.0 @angular/material@^18.0.0 @angular/cdk@^18.0.0
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
**For Angular 19:**
|
|
42
|
+
```bash
|
|
43
|
+
npm install @ruc-lib/multi-file-upload@4.0.0 @angular/material@^19.0.0 @angular/cdk@^19.0.0
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**For Angular 20:**
|
|
47
|
+
```bash
|
|
48
|
+
npm install @ruc-lib/multi-file-upload@4.0.0
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
> **Note:** When installing in Angular 15-19 apps, you must specify the matching `@angular/material` and `@angular/cdk` versions to avoid peer dependency conflicts. Angular 20 will automatically use the correct versions.
|
|
22
52
|
|
|
23
53
|
# Version Compatibility
|
|
24
54
|
|
|
25
55
|
Please ensure you install the correct version of `@ruc-lib/multi-file-upload` based on your Angular version.
|
|
26
|
-
|
|
56
|
+
|
|
27
57
|
| Angular Version | Compatible `@ruc-lib/multi-file-upload` Version |
|
|
28
58
|
|--------------------|-----------------------------------------------------|
|
|
29
59
|
| 15.x.x | `npm install @ruc-lib/multi-file-upload@^3.2.0` |
|
|
30
60
|
| 16.x.x | `npm install @ruc-lib/multi-file-upload@^3.2.0` |
|
|
61
|
+
| 17.x.x | `npm install @ruc-lib/multi-file-upload@^4.0.0` |
|
|
62
|
+
| 18.x.x | `npm install @ruc-lib/multi-file-upload@^4.0.0` |
|
|
63
|
+
| 19.x.x | `npm install @ruc-lib/multi-file-upload@^4.0.0` |
|
|
64
|
+
| 20.x.x | `npm install @ruc-lib/multi-file-upload@^4.0.0` |
|
|
31
65
|
|
|
32
66
|
|
|
33
67
|
# Usage
|
|
@@ -93,34 +127,87 @@ npm install @uxpractice/ruc-lib
|
|
|
93
127
|
```
|
|
94
128
|
|
|
95
129
|
### Install Individual Component
|
|
96
|
-
|
|
130
|
+
|
|
131
|
+
If you only need the MultiFileUpload component:
|
|
132
|
+
|
|
133
|
+
**For Angular 15:**
|
|
134
|
+
```bash
|
|
135
|
+
npm install @ruc-lib/multi-file-upload@3.1.0 @angular/material@^15.0.0 @angular/cdk@^15.0.0
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
**For Angular 16:**
|
|
139
|
+
```bash
|
|
140
|
+
npm install @ruc-lib/multi-file-upload@3.1.0 @angular/material@^16.0.0 @angular/cdk@^16.0.0
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
**For Angular 17:**
|
|
144
|
+
```bash
|
|
145
|
+
npm install @ruc-lib/multi-file-upload@3.1.0 @angular/material@^17.0.0 @angular/cdk@^17.0.0
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
**For Angular 18:**
|
|
149
|
+
```bash
|
|
150
|
+
npm install @ruc-lib/multi-file-upload@3.1.0 @angular/material@^18.0.0 @angular/cdk@^18.0.0
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
**For Angular 19:**
|
|
97
154
|
```bash
|
|
98
|
-
npm install @ruc-lib/multi-file-upload
|
|
155
|
+
npm install @ruc-lib/multi-file-upload@3.1.0 @angular/material@^19.0.0 @angular/cdk@^19.0.0
|
|
99
156
|
```
|
|
100
157
|
|
|
158
|
+
**For Angular 20:**
|
|
159
|
+
```bash
|
|
160
|
+
npm install @ruc-lib/multi-file-upload@3.1.0
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
> **Note:** When installing in Angular 15-19 apps, you must specify the matching `@angular/material` and `@angular/cdk` versions to avoid peer dependency conflicts. Angular 20 will automatically use the correct versions.
|
|
164
|
+
|
|
165
|
+
### 📦 Version Compatibility
|
|
166
|
+
|
|
167
|
+
| Angular Version | Compatible Version | Installation Command |
|
|
168
|
+
|-----------------|-------------------|----------------------|
|
|
169
|
+
| 15.x.x | 3.1.0 | See installation instructions above |
|
|
170
|
+
| 16.x.x | 3.1.0 | See installation instructions above |
|
|
171
|
+
| 17.x.x | 3.1.0 | See installation instructions above |
|
|
172
|
+
| 18.x.x | 3.1.0 | See installation instructions above |
|
|
173
|
+
| 19.x.x | 3.1.0 | See installation instructions above |
|
|
174
|
+
| 20.x.x | 3.1.0 | See installation instructions above |
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
### 📦 Version Compatibility
|
|
178
|
+
|
|
179
|
+
| Angular Version | Compatible Version | Installation Command |
|
|
180
|
+
|-----------------|-------------------|----------------------|
|
|
181
|
+
| 15.x.x | 3.1.0 | See installation instructions above |
|
|
182
|
+
| 16.x.x | 3.1.0 | See installation instructions above |
|
|
183
|
+
| 17.x.x | 3.1.0 | See installation instructions above |
|
|
184
|
+
| 18.x.x | 3.1.0 | See installation instructions above |
|
|
185
|
+
| 19.x.x | 3.1.0 | See installation instructions above |
|
|
186
|
+
| 20.x.x | 3.1.0 | See installation instructions above |
|
|
187
|
+
|
|
188
|
+
|
|
101
189
|
## Usage
|
|
102
190
|
|
|
103
|
-
### 1. Import the
|
|
104
|
-
In your Angular
|
|
191
|
+
### 1. Import the Component
|
|
192
|
+
In your Angular component file (e.g., `app.component.ts`), import the `RuclibMultiFileUploadComponent`:
|
|
105
193
|
|
|
106
194
|
```typescript
|
|
107
|
-
import {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
import {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
@
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
],
|
|
120
|
-
providers: [],
|
|
121
|
-
bootstrap: [AppComponent]
|
|
195
|
+
import { Component } from '@angular/core';
|
|
196
|
+
|
|
197
|
+
// For Complete Library
|
|
198
|
+
import { RuclibMultiFileUploadComponent } from '@uxpractice/ruc-lib/multi-file-upload';
|
|
199
|
+
|
|
200
|
+
// For Individual Package
|
|
201
|
+
import { RuclibMultiFileUploadComponent } from '@ruc-lib/multi-file-upload';
|
|
202
|
+
|
|
203
|
+
@Component({
|
|
204
|
+
selector: 'app-root',
|
|
205
|
+
imports: [RuclibMultiFileUploadComponent],
|
|
206
|
+
templateUrl: './app.component.html',
|
|
122
207
|
})
|
|
123
|
-
export class
|
|
208
|
+
export class AppComponent {
|
|
209
|
+
// Component code here
|
|
210
|
+
}
|
|
124
211
|
```
|
|
125
212
|
|
|
126
213
|
### 2. Use the Component
|
|
@@ -211,4 +298,4 @@ Contributions are welcome! Feel free to open issues or pull requests for any enh
|
|
|
211
298
|
|
|
212
299
|
## Acknowledgements
|
|
213
300
|
|
|
214
|
-
Thank you for choosing the Multi-File Upload Component. If you have any feedback or suggestions, please let us know!
|
|
301
|
+
Thank you for choosing the Multi-File Upload Component. If you have any feedback or suggestions, please let us know!
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Injectable, EventEmitter, inject, Output, Input, Component } from '@angular/core';
|
|
3
|
+
import * as i1$1 from '@angular/common';
|
|
4
|
+
import { CommonModule } from '@angular/common';
|
|
5
|
+
import * as i1 from '@angular/common/http';
|
|
6
|
+
import { HttpEventType, HttpResponse } from '@angular/common/http';
|
|
7
|
+
import * as i2 from '@angular/material/progress-bar';
|
|
8
|
+
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
|
9
|
+
import * as i3 from '@angular/material/card';
|
|
10
|
+
import { MatCardModule } from '@angular/material/card';
|
|
11
|
+
import * as i4 from '@angular/material/icon';
|
|
12
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
13
|
+
import * as i5 from '@angular/material/button';
|
|
14
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
15
|
+
import * as i6 from '@angular/material/form-field';
|
|
16
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
17
|
+
|
|
18
|
+
class RuclibMultiFileUploadService {
|
|
19
|
+
constructor(http) {
|
|
20
|
+
this.http = http;
|
|
21
|
+
}
|
|
22
|
+
uploadFile(formData, api) {
|
|
23
|
+
return this.http.post(api, formData, {
|
|
24
|
+
reportProgress: true,
|
|
25
|
+
observe: 'events',
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
deleteFile(id, deleteApi) {
|
|
29
|
+
return this.http.delete(deleteApi + '/' + id);
|
|
30
|
+
}
|
|
31
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: RuclibMultiFileUploadService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
32
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: RuclibMultiFileUploadService }); }
|
|
33
|
+
}
|
|
34
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: RuclibMultiFileUploadService, decorators: [{
|
|
35
|
+
type: Injectable
|
|
36
|
+
}], ctorParameters: () => [{ type: i1.HttpClient }] });
|
|
37
|
+
|
|
38
|
+
class RuclibMultiFileUploadComponent {
|
|
39
|
+
constructor() {
|
|
40
|
+
this.rucEvent = new EventEmitter();
|
|
41
|
+
this.service = inject(RuclibMultiFileUploadService);
|
|
42
|
+
this.selectedFileData = [];
|
|
43
|
+
this.files = [];
|
|
44
|
+
}
|
|
45
|
+
// constructor(public service: RuclibMultiFileUploadService) {}
|
|
46
|
+
ngOnInit() {
|
|
47
|
+
this.progress = 0; //initial value for the progress bar
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* To get the url
|
|
51
|
+
* of the thumbnail
|
|
52
|
+
* for png file type
|
|
53
|
+
*/
|
|
54
|
+
getUrlFromFile(file) {
|
|
55
|
+
return new Promise((resolve, reject) => {
|
|
56
|
+
const reader = new FileReader();
|
|
57
|
+
reader.readAsDataURL(file);
|
|
58
|
+
reader.onerror = (error) => {
|
|
59
|
+
reject(error);
|
|
60
|
+
};
|
|
61
|
+
reader.onloadend = () => {
|
|
62
|
+
try {
|
|
63
|
+
file['url'] = reader.result;
|
|
64
|
+
resolve(file);
|
|
65
|
+
}
|
|
66
|
+
catch (err) {
|
|
67
|
+
reject(err);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* To choose the file
|
|
74
|
+
* and get the thumbnail
|
|
75
|
+
*/
|
|
76
|
+
async chooseFile(event) {
|
|
77
|
+
const filePromises = Array.from(event.target.files).map((file) => {
|
|
78
|
+
const selectedFile = file;
|
|
79
|
+
selectedFile['disableUploadFile'] = false;
|
|
80
|
+
if (selectedFile.type !== 'image/png') {
|
|
81
|
+
return selectedFile;
|
|
82
|
+
}
|
|
83
|
+
return this.getUrlFromFile(selectedFile);
|
|
84
|
+
});
|
|
85
|
+
const fileInfos = await Promise.all(filePromises);
|
|
86
|
+
if (fileInfos[0]) {
|
|
87
|
+
this.selectedFileData.push(fileInfos[0]);
|
|
88
|
+
}
|
|
89
|
+
this.rucEvent.emit({
|
|
90
|
+
eventName: 'onFileSelection',
|
|
91
|
+
eventOutput: fileInfos,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* To delete the selected file
|
|
96
|
+
*/
|
|
97
|
+
removeSelectedFile(index, selected) {
|
|
98
|
+
if (this.rucInputData.deleteUrl) {
|
|
99
|
+
this.service.deleteFile(index, this.rucInputData.deleteUrl).subscribe();
|
|
100
|
+
this.selectedFileData.splice(index, 1);
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
this.selectedFileData.splice(index, 1);
|
|
104
|
+
}
|
|
105
|
+
this.rucEvent.emit({ eventName: 'onDeleting', eventOutput: selected });
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* To upload the file
|
|
109
|
+
* and see progress bar
|
|
110
|
+
*/
|
|
111
|
+
uploadSelectedFile(fileOne) {
|
|
112
|
+
this.rucEvent.emit({ eventName: 'onUploading', eventOutput: fileOne });
|
|
113
|
+
fileOne['disableUploadFile'] = true;
|
|
114
|
+
const formData = new FormData();
|
|
115
|
+
this.service
|
|
116
|
+
.uploadFile(formData, this.rucInputData.uploadUrl)
|
|
117
|
+
.subscribe((event) => {
|
|
118
|
+
if (event.type === HttpEventType.UploadProgress) {
|
|
119
|
+
this.progress = Math.round(((event.loaded || 1) / (event.total || 1)) * 100);
|
|
120
|
+
}
|
|
121
|
+
else if (event instanceof HttpResponse) {
|
|
122
|
+
this.progress = 0;
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: RuclibMultiFileUploadComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
127
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.9", type: RuclibMultiFileUploadComponent, isStandalone: true, selector: "uxp-ruclib-multi-file-upload", inputs: { rucInputData: "rucInputData", customTheme: "customTheme" }, outputs: { rucEvent: "rucEvent" }, providers: [RuclibMultiFileUploadService], ngImport: i0, template: "<p>ruclib-multi-file-upload works!</p>\r\n<div class=\"{{ customTheme }}\">\r\n <div class=\"colorcustomoverride\">\r\n @if (rucInputData) {\r\n <mat-card class=\"container\">\r\n <!--Label For Selecting File Starts-->\r\n <mat-card-title>\r\n <div>\r\n <mat-card class=\"matCard\">\r\n <input\r\n #attachments\r\n type=\"file\"\r\n (change)=\"chooseFile($event)\"\r\n #fileInput\r\n [multiple]=\"rucInputData.multifileSelection\"\r\n name=\"files\"\r\n id=\"img\"\r\n class=\"isDisplay\"\r\n />\r\n <label for=\"img\" class=\"containerlabel\"\r\n >{{ rucInputData.label }}\r\n <mat-icon class=\"attachfile\">attach_file</mat-icon></label\r\n >\r\n </mat-card>\r\n </div>\r\n </mat-card-title>\r\n <!--Label For Selecting File Starts-->\r\n <mat-card-content class=\"marCardTable\">\r\n @for (selected of selectedFileData; track selected; let index = $index) {\r\n <div\r\n class=\"row\"\r\n class=\"selectedFileList\"\r\n >\r\n <!--Thumbnail previewing of Image Starts-->\r\n @if (selected.type === 'image/png') {\r\n <div\r\n [ngClass]=\"rucInputData.displayThumbnail ? '' : 'isDisplay'\"\r\n >\r\n <img [src]=\"selected.url\" width=\"50px\" />\r\n </div>\r\n }\r\n <!--Thumbnail previewing of Image Ends-->\r\n <!--Name of Selected File Starts-->\r\n <mat-label class=\"selectedFileName\">{{ selected.name }}</mat-label>\r\n <!--Name of Selected File Ends-->\r\n <!--Button Starts-->\r\n <div class=\"floatRight\">\r\n <mat-icon\r\n (click)=\"removeSelectedFile(index, selected)\"\r\n class=\"deletebutton\"\r\n color=\"warn\"\r\n >delete_outline</mat-icon\r\n >\r\n </div>\r\n <div class=\"floatRightSubmit\">\r\n <button\r\n mat-raised-button\r\n color=\"primary\"\r\n class=\"uploadButton\"\r\n type=\"submit\"\r\n (click)=\"uploadSelectedFile(selected)\"\r\n [disabled]=\"selected.disableUploadFile\"\r\n >\r\n Submit\r\n </button>\r\n </div>\r\n <!--Button Ends-->\r\n <!--Progress Bar with Label Starts-->\r\n @if (selected.disableUploadFile) {\r\n <div class=\"progressbar\">\r\n <mat-label class=\"fileSize\"\r\n >{{ (selected.size / 1000).toFixed(2) }} KB</mat-label\r\n >\r\n <mat-label class=\"filePercentage\"> {{ progress }}% </mat-label>\r\n <mat-progress-bar\r\n mode=\"determinate\"\r\n [value]=\"progress\"\r\n class=\"displayInline\"\r\n ></mat-progress-bar>\r\n </div>\r\n }\r\n <!--Progress Bar with Label Ends-->\r\n </div>\r\n }\r\n </mat-card-content>\r\n </mat-card>\r\n }\r\n </div>\r\n </div>\r\n", styles: [".isDisplay{display:none}.colorcustomoverride mat-mdc-card{background-color:#fff!important;color:#000!important}.colorcustomoverride mat-mdc-card-content{padding-bottom:33px}.container{width:90%;padding:33px}.floatRight{float:right}.displayInline{display:inline-block}.uploadButton{margin-right:26px;display:inline-block}.matCard{border:2px solid #3f51b5}.marCardTable{max-height:300px;overflow:auto}.attachfile{float:right;cursor:pointer}.selectedFileList{padding-top:56px}.progressbar{width:76%}.fileSize{float:left;padding:10px}.filePercentage{float:right;padding:10px}.deletebutton{margin-top:4px;display:inline-block;cursor:pointer}.floatRightSubmit{float:right}.selectedFileName{display:inline-block;line-break:auto}@media (max-width: 800px){.fileSize{margin-top:31px;float:left}.filePercentage{padding:0;margin-top:41px}.floatRightSubmit{margin-right:-6px;float:right}.deletebutton{margin-right:-22px;cursor:pointer}.progressbar{width:100%}.attachfile{float:right;cursor:pointer;margin-top:-4px}.containerlabel{font-size:18px}.container{height:auto;overflow:scroll}.selectedFileName{margin-bottom:14px;line-break:auto;width:85px;margin-left:-17px}}@media only screen and (max-width: 740px) and (min-width: 360px){.floatRightSubmit{margin-right:-12px}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: MatProgressBarModule }, { kind: "component", type: i2.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "ngmodule", type: MatCardModule }, { kind: "component", type: i3.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: i3.MatCardContent, selector: "mat-card-content" }, { kind: "directive", type: i3.MatCardTitle, selector: "mat-card-title, [mat-card-title], [matCardTitle]" }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i4.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i5.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "directive", type: i6.MatLabel, selector: "mat-label" }] }); }
|
|
128
|
+
}
|
|
129
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: RuclibMultiFileUploadComponent, decorators: [{
|
|
130
|
+
type: Component,
|
|
131
|
+
args: [{ selector: 'uxp-ruclib-multi-file-upload', imports: [
|
|
132
|
+
CommonModule,
|
|
133
|
+
MatProgressBarModule,
|
|
134
|
+
MatCardModule,
|
|
135
|
+
MatIconModule,
|
|
136
|
+
MatButtonModule,
|
|
137
|
+
MatFormFieldModule,
|
|
138
|
+
], providers: [RuclibMultiFileUploadService], template: "<p>ruclib-multi-file-upload works!</p>\r\n<div class=\"{{ customTheme }}\">\r\n <div class=\"colorcustomoverride\">\r\n @if (rucInputData) {\r\n <mat-card class=\"container\">\r\n <!--Label For Selecting File Starts-->\r\n <mat-card-title>\r\n <div>\r\n <mat-card class=\"matCard\">\r\n <input\r\n #attachments\r\n type=\"file\"\r\n (change)=\"chooseFile($event)\"\r\n #fileInput\r\n [multiple]=\"rucInputData.multifileSelection\"\r\n name=\"files\"\r\n id=\"img\"\r\n class=\"isDisplay\"\r\n />\r\n <label for=\"img\" class=\"containerlabel\"\r\n >{{ rucInputData.label }}\r\n <mat-icon class=\"attachfile\">attach_file</mat-icon></label\r\n >\r\n </mat-card>\r\n </div>\r\n </mat-card-title>\r\n <!--Label For Selecting File Starts-->\r\n <mat-card-content class=\"marCardTable\">\r\n @for (selected of selectedFileData; track selected; let index = $index) {\r\n <div\r\n class=\"row\"\r\n class=\"selectedFileList\"\r\n >\r\n <!--Thumbnail previewing of Image Starts-->\r\n @if (selected.type === 'image/png') {\r\n <div\r\n [ngClass]=\"rucInputData.displayThumbnail ? '' : 'isDisplay'\"\r\n >\r\n <img [src]=\"selected.url\" width=\"50px\" />\r\n </div>\r\n }\r\n <!--Thumbnail previewing of Image Ends-->\r\n <!--Name of Selected File Starts-->\r\n <mat-label class=\"selectedFileName\">{{ selected.name }}</mat-label>\r\n <!--Name of Selected File Ends-->\r\n <!--Button Starts-->\r\n <div class=\"floatRight\">\r\n <mat-icon\r\n (click)=\"removeSelectedFile(index, selected)\"\r\n class=\"deletebutton\"\r\n color=\"warn\"\r\n >delete_outline</mat-icon\r\n >\r\n </div>\r\n <div class=\"floatRightSubmit\">\r\n <button\r\n mat-raised-button\r\n color=\"primary\"\r\n class=\"uploadButton\"\r\n type=\"submit\"\r\n (click)=\"uploadSelectedFile(selected)\"\r\n [disabled]=\"selected.disableUploadFile\"\r\n >\r\n Submit\r\n </button>\r\n </div>\r\n <!--Button Ends-->\r\n <!--Progress Bar with Label Starts-->\r\n @if (selected.disableUploadFile) {\r\n <div class=\"progressbar\">\r\n <mat-label class=\"fileSize\"\r\n >{{ (selected.size / 1000).toFixed(2) }} KB</mat-label\r\n >\r\n <mat-label class=\"filePercentage\"> {{ progress }}% </mat-label>\r\n <mat-progress-bar\r\n mode=\"determinate\"\r\n [value]=\"progress\"\r\n class=\"displayInline\"\r\n ></mat-progress-bar>\r\n </div>\r\n }\r\n <!--Progress Bar with Label Ends-->\r\n </div>\r\n }\r\n </mat-card-content>\r\n </mat-card>\r\n }\r\n </div>\r\n </div>\r\n", styles: [".isDisplay{display:none}.colorcustomoverride mat-mdc-card{background-color:#fff!important;color:#000!important}.colorcustomoverride mat-mdc-card-content{padding-bottom:33px}.container{width:90%;padding:33px}.floatRight{float:right}.displayInline{display:inline-block}.uploadButton{margin-right:26px;display:inline-block}.matCard{border:2px solid #3f51b5}.marCardTable{max-height:300px;overflow:auto}.attachfile{float:right;cursor:pointer}.selectedFileList{padding-top:56px}.progressbar{width:76%}.fileSize{float:left;padding:10px}.filePercentage{float:right;padding:10px}.deletebutton{margin-top:4px;display:inline-block;cursor:pointer}.floatRightSubmit{float:right}.selectedFileName{display:inline-block;line-break:auto}@media (max-width: 800px){.fileSize{margin-top:31px;float:left}.filePercentage{padding:0;margin-top:41px}.floatRightSubmit{margin-right:-6px;float:right}.deletebutton{margin-right:-22px;cursor:pointer}.progressbar{width:100%}.attachfile{float:right;cursor:pointer;margin-top:-4px}.containerlabel{font-size:18px}.container{height:auto;overflow:scroll}.selectedFileName{margin-bottom:14px;line-break:auto;width:85px;margin-left:-17px}}@media only screen and (max-width: 740px) and (min-width: 360px){.floatRightSubmit{margin-right:-12px}}\n"] }]
|
|
139
|
+
}], propDecorators: { rucInputData: [{
|
|
140
|
+
type: Input
|
|
141
|
+
}], customTheme: [{
|
|
142
|
+
type: Input
|
|
143
|
+
}], rucEvent: [{
|
|
144
|
+
type: Output
|
|
145
|
+
}] } });
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Generated bundle index. Do not edit.
|
|
149
|
+
*/
|
|
150
|
+
|
|
151
|
+
export { RuclibMultiFileUploadComponent, RuclibMultiFileUploadService };
|
|
152
|
+
//# sourceMappingURL=ruc-lib-multi-file-upload.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ruc-lib-multi-file-upload.mjs","sources":["../../src/lib/services/ruclib-multi-file-upload.service.ts","../../src/lib/ruclib-multi-file-upload/ruclib-multi-file-upload.component.ts","../../src/lib/ruclib-multi-file-upload/ruclib-multi-file-upload.component.html","../../src/ruc-lib-multi-file-upload.ts"],"sourcesContent":["import { HttpClient } from '@angular/common/http';\r\nimport { Injectable } from '@angular/core';\r\n\r\n@Injectable()\r\nexport class RuclibMultiFileUploadService {\r\n progress: any;\r\n\r\n constructor(private http: HttpClient) {}\r\n\r\n uploadFile(formData: any, api: string) {\r\n return this.http.post(api, formData, {\r\n reportProgress: true,\r\n observe: 'events',\r\n });\r\n }\r\n deleteFile(id: number, deleteApi: string) {\r\n return this.http.delete(deleteApi + '/' + id);\r\n }\r\n}\r\n","import { Component, EventEmitter, inject, Input, Output } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { MultifiledefaultConfig } from '../interfaces/multiFileUploadDefault';\r\nimport { RuclibMultiFileUploadService } from '../services/ruclib-multi-file-upload.service';\r\nimport { MatProgressBarModule } from '@angular/material/progress-bar';\r\nimport { MatCardModule } from '@angular/material/card';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { MatButtonModule } from '@angular/material/button';\r\nimport { MatFormFieldModule } from '@angular/material/form-field';\r\nimport { HttpEventType, HttpResponse } from '@angular/common/http';\r\n\r\n@Component({\r\n selector: 'uxp-ruclib-multi-file-upload',\r\n imports: [\r\n CommonModule,\r\n MatProgressBarModule,\r\n MatCardModule,\r\n MatIconModule,\r\n MatButtonModule,\r\n MatFormFieldModule,\r\n ],\r\n templateUrl: './ruclib-multi-file-upload.component.html',\r\n styleUrl: './ruclib-multi-file-upload.component.scss',\r\n providers: [RuclibMultiFileUploadService]\r\n})\r\nexport class RuclibMultiFileUploadComponent {\r\n @Input() rucInputData!: MultifiledefaultConfig; // Input Json\r\n @Input() customTheme!: string;\r\n @Output() rucEvent = new EventEmitter<any>();\r\n public service = inject(RuclibMultiFileUploadService);\r\n index: any;\r\n result!: string; //used for url purpose\r\n selectedFileData: any[] = [];\r\n progress!: number; //initial value for the progress bar\r\n files: Array<{ name: string; url: string }> = [];\r\n uploadUrl!: string;\r\n\r\n // constructor(public service: RuclibMultiFileUploadService) {}\r\n\r\n ngOnInit() {\r\n this.progress = 0; //initial value for the progress bar\r\n }\r\n\r\n /**\r\n * To get the url\r\n * of the thumbnail\r\n * for png file type\r\n */\r\n getUrlFromFile(file: any): Promise<any> {\r\n return new Promise<any>((resolve, reject) => {\r\n const reader = new FileReader();\r\n reader.readAsDataURL(file);\r\n\r\n reader.onerror = (error) => {\r\n reject(error);\r\n };\r\n\r\n reader.onloadend = () => {\r\n try {\r\n file['url'] = reader.result;\r\n resolve(file);\r\n } catch (err) {\r\n reject(err);\r\n }\r\n };\r\n });\r\n }\r\n\r\n /**\r\n * To choose the file\r\n * and get the thumbnail\r\n */\r\n async chooseFile(event: any) {\r\n const filePromises = Array.from(event.target.files).map((file: any) => {\r\n const selectedFile = file;\r\n selectedFile['disableUploadFile'] = false;\r\n\r\n if (selectedFile.type !== 'image/png') {\r\n return selectedFile;\r\n }\r\n\r\n return this.getUrlFromFile(selectedFile);\r\n });\r\n const fileInfos = await Promise.all(filePromises);\r\n if (fileInfos[0]) {\r\n this.selectedFileData.push(fileInfos[0]);\r\n }\r\n this.rucEvent.emit({\r\n eventName: 'onFileSelection',\r\n eventOutput: fileInfos,\r\n });\r\n }\r\n\r\n /**\r\n * To delete the selected file\r\n */\r\n removeSelectedFile(index: number, selected: any) {\r\n if (this.rucInputData.deleteUrl) {\r\n this.service.deleteFile(index, this.rucInputData.deleteUrl).subscribe();\r\n this.selectedFileData.splice(index, 1);\r\n } else {\r\n this.selectedFileData.splice(index, 1);\r\n }\r\n this.rucEvent.emit({ eventName: 'onDeleting', eventOutput: selected });\r\n }\r\n\r\n /**\r\n * To upload the file\r\n * and see progress bar\r\n */\r\n uploadSelectedFile(fileOne: any) {\r\n this.rucEvent.emit({ eventName: 'onUploading', eventOutput: fileOne });\r\n fileOne['disableUploadFile'] = true;\r\n const formData = new FormData();\r\n this.service\r\n .uploadFile(formData, this.rucInputData.uploadUrl)\r\n .subscribe((event) => {\r\n if (event.type === HttpEventType.UploadProgress) {\r\n this.progress = Math.round(\r\n ((event.loaded || 1) / (event.total || 1)) * 100\r\n );\r\n } else if (event instanceof HttpResponse) {\r\n this.progress = 0;\r\n }\r\n });\r\n }\r\n}\r\n","<p>ruclib-multi-file-upload works!</p>\r\n<div class=\"{{ customTheme }}\">\r\n <div class=\"colorcustomoverride\">\r\n @if (rucInputData) {\r\n <mat-card class=\"container\">\r\n <!--Label For Selecting File Starts-->\r\n <mat-card-title>\r\n <div>\r\n <mat-card class=\"matCard\">\r\n <input\r\n #attachments\r\n type=\"file\"\r\n (change)=\"chooseFile($event)\"\r\n #fileInput\r\n [multiple]=\"rucInputData.multifileSelection\"\r\n name=\"files\"\r\n id=\"img\"\r\n class=\"isDisplay\"\r\n />\r\n <label for=\"img\" class=\"containerlabel\"\r\n >{{ rucInputData.label }}\r\n <mat-icon class=\"attachfile\">attach_file</mat-icon></label\r\n >\r\n </mat-card>\r\n </div>\r\n </mat-card-title>\r\n <!--Label For Selecting File Starts-->\r\n <mat-card-content class=\"marCardTable\">\r\n @for (selected of selectedFileData; track selected; let index = $index) {\r\n <div\r\n class=\"row\"\r\n class=\"selectedFileList\"\r\n >\r\n <!--Thumbnail previewing of Image Starts-->\r\n @if (selected.type === 'image/png') {\r\n <div\r\n [ngClass]=\"rucInputData.displayThumbnail ? '' : 'isDisplay'\"\r\n >\r\n <img [src]=\"selected.url\" width=\"50px\" />\r\n </div>\r\n }\r\n <!--Thumbnail previewing of Image Ends-->\r\n <!--Name of Selected File Starts-->\r\n <mat-label class=\"selectedFileName\">{{ selected.name }}</mat-label>\r\n <!--Name of Selected File Ends-->\r\n <!--Button Starts-->\r\n <div class=\"floatRight\">\r\n <mat-icon\r\n (click)=\"removeSelectedFile(index, selected)\"\r\n class=\"deletebutton\"\r\n color=\"warn\"\r\n >delete_outline</mat-icon\r\n >\r\n </div>\r\n <div class=\"floatRightSubmit\">\r\n <button\r\n mat-raised-button\r\n color=\"primary\"\r\n class=\"uploadButton\"\r\n type=\"submit\"\r\n (click)=\"uploadSelectedFile(selected)\"\r\n [disabled]=\"selected.disableUploadFile\"\r\n >\r\n Submit\r\n </button>\r\n </div>\r\n <!--Button Ends-->\r\n <!--Progress Bar with Label Starts-->\r\n @if (selected.disableUploadFile) {\r\n <div class=\"progressbar\">\r\n <mat-label class=\"fileSize\"\r\n >{{ (selected.size / 1000).toFixed(2) }} KB</mat-label\r\n >\r\n <mat-label class=\"filePercentage\"> {{ progress }}% </mat-label>\r\n <mat-progress-bar\r\n mode=\"determinate\"\r\n [value]=\"progress\"\r\n class=\"displayInline\"\r\n ></mat-progress-bar>\r\n </div>\r\n }\r\n <!--Progress Bar with Label Ends-->\r\n </div>\r\n }\r\n </mat-card-content>\r\n </mat-card>\r\n }\r\n </div>\r\n </div>\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1"],"mappings":";;;;;;;;;;;;;;;;;MAIa,4BAA4B,CAAA;AAGvC,IAAA,WAAA,CAAoB,IAAgB,EAAA;QAAhB,IAAA,CAAA,IAAI,GAAJ,IAAI;IAAe;IAEvC,UAAU,CAAC,QAAa,EAAE,GAAW,EAAA;QACnC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE;AACnC,YAAA,cAAc,EAAE,IAAI;AACpB,YAAA,OAAO,EAAE,QAAQ;AAClB,SAAA,CAAC;IACJ;IACA,UAAU,CAAC,EAAU,EAAE,SAAiB,EAAA;AACtC,QAAA,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,GAAG,GAAG,GAAG,EAAE,CAAC;IAC/C;8GAbW,4BAA4B,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,EAAA,CAAA,UAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAA5B,4BAA4B,EAAA,CAAA,CAAA;;2FAA5B,4BAA4B,EAAA,UAAA,EAAA,CAAA;kBADxC;;;MCsBY,8BAA8B,CAAA;AAd3C,IAAA,WAAA,GAAA;AAiBY,QAAA,IAAA,CAAA,QAAQ,GAAG,IAAI,YAAY,EAAO;AACrC,QAAA,IAAA,CAAA,OAAO,GAAG,MAAM,CAAC,4BAA4B,CAAC;QAGrD,IAAA,CAAA,gBAAgB,GAAU,EAAE;QAE5B,IAAA,CAAA,KAAK,GAAyC,EAAE;AA4FjD,IAAA;;IAvFC,QAAQ,GAAA;AACN,QAAA,IAAI,CAAC,Q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,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,OAAA,EAAA,QAAA,EAAA,UAAA,EAAA,MAAA,EAAA,CAAA,OAAA,EAAA,QAAA,EAAA,SAAA,EAAA,SAAA,EAAA,UAAA,CAAA,EAAA,QAAA,EAAA,CAAA,SAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EACb,eAAe,mXACf,kBAAkB,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,QAAA,EAAA,QAAA,EAAA,WAAA,EAAA,CAAA,EAAA,CAAA,CAAA;;2FAMb,8BAA8B,EAAA,UAAA,EAAA,CAAA;kBAd1C,SAAS;AACI,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,8BAA8B,EAAA,OAAA,EAC/B;wBACL,YAAY;wBACZ,oBAAoB;wBACpB,aAAa;wBACb,aAAa;wBACb,eAAe;wBACf,kBAAkB;qBACrB,EAAA,SAAA,EAGU,CAAC,4BAA4B,CAAC,EAAA,QAAA,EAAA,42HAAA,EAAA,MAAA,EAAA,CAAA,6uCAAA,CAAA,EAAA;;sBAG1C;;sBACA;;sBACA;;;AE5BH;;AAEG;;;;"}
|
package/index.d.ts
CHANGED
|
@@ -1,3 +1,84 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { EventEmitter } from '@angular/core';
|
|
3
|
+
import * as rxjs from 'rxjs';
|
|
4
|
+
import * as _angular_common_http from '@angular/common/http';
|
|
5
|
+
import { HttpClient } from '@angular/common/http';
|
|
6
|
+
|
|
7
|
+
interface MultifiledefaultConfig {
|
|
8
|
+
/**
|
|
9
|
+
* Mandatory
|
|
10
|
+
* Values:true,false
|
|
11
|
+
*/
|
|
12
|
+
multifileSelection: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Mandatory,
|
|
15
|
+
* Values:true,false
|
|
16
|
+
*/
|
|
17
|
+
displayThumbnail: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Mandatory,
|
|
20
|
+
* Values:string
|
|
21
|
+
*/
|
|
22
|
+
label: string;
|
|
23
|
+
/**
|
|
24
|
+
* Mandatory,
|
|
25
|
+
* Values:string
|
|
26
|
+
*/
|
|
27
|
+
uploadUrl: string;
|
|
28
|
+
/**
|
|
29
|
+
* Optional
|
|
30
|
+
* Values:string
|
|
31
|
+
*/
|
|
32
|
+
deleteUrl?: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
declare class RuclibMultiFileUploadService {
|
|
36
|
+
private http;
|
|
37
|
+
progress: any;
|
|
38
|
+
constructor(http: HttpClient);
|
|
39
|
+
uploadFile(formData: any, api: string): rxjs.Observable<_angular_common_http.HttpEvent<Object>>;
|
|
40
|
+
deleteFile(id: number, deleteApi: string): rxjs.Observable<Object>;
|
|
41
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<RuclibMultiFileUploadService, never>;
|
|
42
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<RuclibMultiFileUploadService>;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
declare class RuclibMultiFileUploadComponent {
|
|
46
|
+
rucInputData: MultifiledefaultConfig;
|
|
47
|
+
customTheme: string;
|
|
48
|
+
rucEvent: EventEmitter<any>;
|
|
49
|
+
service: RuclibMultiFileUploadService;
|
|
50
|
+
index: any;
|
|
51
|
+
result: string;
|
|
52
|
+
selectedFileData: any[];
|
|
53
|
+
progress: number;
|
|
54
|
+
files: Array<{
|
|
55
|
+
name: string;
|
|
56
|
+
url: string;
|
|
57
|
+
}>;
|
|
58
|
+
uploadUrl: string;
|
|
59
|
+
ngOnInit(): void;
|
|
60
|
+
/**
|
|
61
|
+
* To get the url
|
|
62
|
+
* of the thumbnail
|
|
63
|
+
* for png file type
|
|
64
|
+
*/
|
|
65
|
+
getUrlFromFile(file: any): Promise<any>;
|
|
66
|
+
/**
|
|
67
|
+
* To choose the file
|
|
68
|
+
* and get the thumbnail
|
|
69
|
+
*/
|
|
70
|
+
chooseFile(event: any): Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* To delete the selected file
|
|
73
|
+
*/
|
|
74
|
+
removeSelectedFile(index: number, selected: any): void;
|
|
75
|
+
/**
|
|
76
|
+
* To upload the file
|
|
77
|
+
* and see progress bar
|
|
78
|
+
*/
|
|
79
|
+
uploadSelectedFile(fileOne: any): void;
|
|
80
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<RuclibMultiFileUploadComponent, never>;
|
|
81
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<RuclibMultiFileUploadComponent, "uxp-ruclib-multi-file-upload", never, { "rucInputData": { "alias": "rucInputData"; "required": false; }; "customTheme": { "alias": "customTheme"; "required": false; }; }, { "rucEvent": "rucEvent"; }, never, never, true, never>;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export { RuclibMultiFileUploadComponent, RuclibMultiFileUploadService };
|
package/package.json
CHANGED
|
@@ -1,28 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ruc-lib/multi-file-upload",
|
|
3
|
-
"version": "
|
|
4
|
-
"license": "MIT",
|
|
3
|
+
"version": "4.0.0",
|
|
5
4
|
"peerDependencies": {
|
|
6
|
-
"@angular/
|
|
7
|
-
"@angular/
|
|
8
|
-
"@angular/material": "^15.
|
|
9
|
-
"@angular/
|
|
10
|
-
"@angular/
|
|
11
|
-
"
|
|
12
|
-
"
|
|
5
|
+
"@angular/common": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0",
|
|
6
|
+
"@angular/core": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0",
|
|
7
|
+
"@angular/material": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0",
|
|
8
|
+
"@angular/platform-browser": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0",
|
|
9
|
+
"@angular/animations": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0",
|
|
10
|
+
"@angular/forms": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0",
|
|
11
|
+
"rxjs": ">=7.5.0 <8.0.0",
|
|
12
|
+
"zone.js": "^0.13.0 || ^0.14.0"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"tslib": "^2.3.0"
|
|
16
16
|
},
|
|
17
|
-
"publishConfig": {
|
|
18
|
-
"access": "public"
|
|
19
|
-
},
|
|
20
17
|
"sideEffects": false,
|
|
21
|
-
"module": "
|
|
22
|
-
"es2020": "fesm2020/ruc-lib-multi-file-upload.mjs",
|
|
23
|
-
"esm2020": "esm2020/ruc-lib-multi-file-upload.mjs",
|
|
24
|
-
"fesm2020": "fesm2020/ruc-lib-multi-file-upload.mjs",
|
|
25
|
-
"fesm2015": "fesm2015/ruc-lib-multi-file-upload.mjs",
|
|
18
|
+
"module": "fesm2022/ruc-lib-multi-file-upload.mjs",
|
|
26
19
|
"typings": "index.d.ts",
|
|
27
20
|
"exports": {
|
|
28
21
|
"./package.json": {
|
|
@@ -30,11 +23,7 @@
|
|
|
30
23
|
},
|
|
31
24
|
".": {
|
|
32
25
|
"types": "./index.d.ts",
|
|
33
|
-
"
|
|
34
|
-
"es2020": "./fesm2020/ruc-lib-multi-file-upload.mjs",
|
|
35
|
-
"es2015": "./fesm2015/ruc-lib-multi-file-upload.mjs",
|
|
36
|
-
"node": "./fesm2015/ruc-lib-multi-file-upload.mjs",
|
|
37
|
-
"default": "./fesm2020/ruc-lib-multi-file-upload.mjs"
|
|
26
|
+
"default": "./fesm2022/ruc-lib-multi-file-upload.mjs"
|
|
38
27
|
}
|
|
39
28
|
}
|
|
40
29
|
}
|
package/esm2020/index.mjs
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export * from './lib/ruclib-multi-file-upload.module';
|
|
2
|
-
export * from './lib/ruclib-multi-file-upload/ruclib-multi-file-upload.component';
|
|
3
|
-
export * from './lib/services/ruclib-multi-file-upload.service';
|
|
4
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYyx1Q0FBdUMsQ0FBQztBQUN0RCxjQUFjLG1FQUFtRSxDQUFDO0FBQ2xGLGNBQWMsaURBQWlELENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgKiBmcm9tICcuL2xpYi9ydWNsaWItbXVsdGktZmlsZS11cGxvYWQubW9kdWxlJztcclxuZXhwb3J0ICogZnJvbSAnLi9saWIvcnVjbGliLW11bHRpLWZpbGUtdXBsb2FkL3J1Y2xpYi1tdWx0aS1maWxlLXVwbG9hZC5jb21wb25lbnQnO1xyXG5leHBvcnQgKiBmcm9tICcuL2xpYi9zZXJ2aWNlcy9ydWNsaWItbXVsdGktZmlsZS11cGxvYWQuc2VydmljZSc7Il19
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export {};
|
|
2
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibXVsdGlGaWxlVXBsb2FkRGVmYXVsdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9saWIvaW50ZXJmYWNlcy9tdWx0aUZpbGVVcGxvYWREZWZhdWx0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgaW50ZXJmYWNlIE11bHRpZmlsZWRlZmF1bHRDb25maWcge1xyXG4gICAgLyoqXHJcbiAgICAgKiBNYW5kYXRvcnlcclxuICAgICAqIFZhbHVlczp0cnVlLGZhbHNlXHJcbiAgICAgKi9cclxuICAgIG11bHRpZmlsZVNlbGVjdGlvbjogYm9vbGVhbjtcclxuXHJcbiAgICAvKipcclxuICAgICAqIE1hbmRhdG9yeSwgXHJcbiAgICAgKiBWYWx1ZXM6dHJ1ZSxmYWxzZVxyXG4gICAgICovXHJcbiAgICBkaXNwbGF5VGh1bWJuYWlsOiBib29sZWFuO1xyXG5cclxuICAgIC8qKlxyXG4gICAgICogTWFuZGF0b3J5LCBcclxuICAgICAqIFZhbHVlczpzdHJpbmdcclxuICAgICAqL1xyXG4gICAgbGFiZWw6IHN0cmluZztcclxuXHJcbiAgICAvKipcclxuICAgICAqIE1hbmRhdG9yeSwgXHJcbiAgICAgKiBWYWx1ZXM6c3RyaW5nXHJcbiAgICAgKi9cclxuICAgIHVwbG9hZFVybDogc3RyaW5nO1xyXG5cclxuICAgIC8qKlxyXG4gICAgICogT3B0aW9uYWwgXHJcbiAgICAgKiBWYWx1ZXM6c3RyaW5nXHJcbiAgICAgKi9cclxuICAgIGRlbGV0ZVVybD86IHN0cmluZztcclxuXHJcbn1cclxuIl19
|