@ruc-lib/multi-file-upload 2.0.8 → 3.1.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 +3 -182
- 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/ruc-lib-multi-file-upload-2.0.8.tgz +0 -0
package/README.md
CHANGED
|
@@ -1,186 +1,7 @@
|
|
|
1
1
|
# ruclib-multi-file-upload
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This library was generated with [Nx](https://nx.dev).
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
When you submit the file you will get a progressbar view which represents the size of the file and the percentage of the file getting submitted so for this individually each file can be submitted to the api given via the input of the selectors.
|
|
5
|
+
## Running unit tests
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
If there is a delete api, then it will delete file from there and if there is no any delete api then it will delete the file from the list.
|
|
10
|
-
|
|
11
|
-
# Installation guide
|
|
12
|
-
|
|
13
|
-
# Install complete library
|
|
14
|
-
|
|
15
|
-
`npm install @uxpractice/ruc-lib`
|
|
16
|
-
|
|
17
|
-
# Install individual component
|
|
18
|
-
|
|
19
|
-
If users only need the multi file upload component, they can install it separately
|
|
20
|
-
`npm install @ruc-lib/multi-file-upload`
|
|
21
|
-
|
|
22
|
-
# Usage
|
|
23
|
-
|
|
24
|
-
# import required modules
|
|
25
|
-
|
|
26
|
-
for library
|
|
27
|
-
`import { RuclibMultiFileUploadModule } from '@uxpractice/ruc-lib/multi-file-upload'`
|
|
28
|
-
|
|
29
|
-
for seperate package
|
|
30
|
-
`import { RuclibMultiFileUploadModule } from '@ruc-lib/multi-file-upload'`
|
|
31
|
-
|
|
32
|
-
# use component selector
|
|
33
|
-
|
|
34
|
-
```
|
|
35
|
-
<uxp-ruclib-multi-file-upload [rucInputData]="inputObjectDataMultiFileUpload"
|
|
36
|
-
[customTheme]="customTheme" (rucEvent)="passEvent($event)"></uxp-ruclib-multi-file-upload>
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
# Input and Output
|
|
40
|
-
|
|
41
|
-
# Inputs
|
|
42
|
-
rucInputData -> It is the configuration to be passed in the multi-file upload component.
|
|
43
|
-
|
|
44
|
-
customTheme -> It is the name of the theme.
|
|
45
|
-
|
|
46
|
-
# Output
|
|
47
|
-
|
|
48
|
-
rucEvent -> is the event which will be fired when file is uploaded or deleted.
|
|
49
|
-
|
|
50
|
-
# rucInputData (sample object)
|
|
51
|
-
|
|
52
|
-
# Detail definition of the each property can be found in type definition file.
|
|
53
|
-
|
|
54
|
-
```
|
|
55
|
-
inputObjectDataMultiFileUpload = {
|
|
56
|
-
multifileSelection: true,
|
|
57
|
-
displayThumbnail: true,
|
|
58
|
-
label: 'Choose File',
|
|
59
|
-
uploadUrl: '/api/upload',
|
|
60
|
-
deleteUrl: '/api/delete',
|
|
61
|
-
};
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
# Contribution
|
|
66
|
-
Contributions are welcome! Feel free to open issues or pull requests for any enhancements or fixes.
|
|
67
|
-
|
|
68
|
-
# Acknowledgements
|
|
69
|
-
Thank you for choosing the Multi file upload Component Library. If you have any feedback or suggestions, please let us know!
|
|
70
|
-
|
|
71
|
-
# ruclib-multi-file-upload
|
|
72
|
-
|
|
73
|
-
A powerful and intuitive multi-file upload component for Angular applications. It allows users to select multiple files, view thumbnails for images, and manage uploads with features like individual submission, deletion, and progress tracking.
|
|
74
|
-
|
|
75
|
-
## Installation Guide
|
|
76
|
-
|
|
77
|
-
To use the Multi-File Upload component, you can install the entire RUC library or just this specific component.
|
|
78
|
-
|
|
79
|
-
### Install the Entire Library
|
|
80
|
-
```bash
|
|
81
|
-
npm install @uxpractice/ruc-lib
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
### Install Individual Component
|
|
85
|
-
If you only need the Multi-File Upload component:
|
|
86
|
-
```bash
|
|
87
|
-
npm install @ruc-lib/multi-file-upload
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
## Usage
|
|
91
|
-
|
|
92
|
-
### 1. Import the Module
|
|
93
|
-
In your Angular module file (e.g., `app.module.ts`), import the `RuclibMultiFileUploadModule`:
|
|
94
|
-
|
|
95
|
-
```typescript
|
|
96
|
-
import { RuclibMultiFileUploadModule } from '@ruc-lib/multi-file-upload';
|
|
97
|
-
import { AppComponent } from './app.component';
|
|
98
|
-
import { NgModule } from '@angular/core';
|
|
99
|
-
import { BrowserModule } from '@angular/platform-browser';
|
|
100
|
-
import { HttpClientModule } from '@angular/common/http';
|
|
101
|
-
|
|
102
|
-
@NgModule({
|
|
103
|
-
declarations: [AppComponent],
|
|
104
|
-
imports: [
|
|
105
|
-
BrowserModule,
|
|
106
|
-
HttpClientModule,
|
|
107
|
-
RuclibMultiFileUploadModule
|
|
108
|
-
],
|
|
109
|
-
providers: [],
|
|
110
|
-
bootstrap: [AppComponent]
|
|
111
|
-
})
|
|
112
|
-
export class AppModule {}
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
### 2. Use the Component
|
|
116
|
-
In your component's template, use the `<uxp-ruclib-multi-file-upload>` selector and pass the configuration object to the `rucInputData` input.
|
|
117
|
-
|
|
118
|
-
```html
|
|
119
|
-
<uxp-ruclib-multi-file-upload
|
|
120
|
-
[rucInputData]="inputObjectDataMultiFileUpload"
|
|
121
|
-
[customTheme]="'custom-theme'"
|
|
122
|
-
(rucEvent)="handleEvent($event)">
|
|
123
|
-
</uxp-ruclib-multi-file-upload>
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
## API Reference
|
|
127
|
-
|
|
128
|
-
### Component Inputs
|
|
129
|
-
|
|
130
|
-
| Input | Type | Description |
|
|
131
|
-
|----------------|--------------------------|--------------------------------------------------|
|
|
132
|
-
| `rucInputData` | `MultifiledefaultConfig` | The main configuration object for the component. |
|
|
133
|
-
| `customTheme` | `string` | An optional CSS class for custom theming. |
|
|
134
|
-
|
|
135
|
-
### Component Outputs
|
|
136
|
-
|
|
137
|
-
| Output | Type | Description |
|
|
138
|
-
|------------|--------------------|--------------------------------------------------------------------------------------------------|
|
|
139
|
-
| `rucEvent` | `EventEmitter<any>` | Emits an event when a file is selected, uploaded, or deleted. The event object contains `eventName` and `eventOutput`. |
|
|
140
|
-
|
|
141
|
-
### `MultifiledefaultConfig`
|
|
142
|
-
This is the main configuration object for the multi-file-upload component.
|
|
143
|
-
|
|
144
|
-
| Property | Type | Description |
|
|
145
|
-
|--------------------|-----------|---------------------------------------------------------------------------------------------------------|
|
|
146
|
-
| `multifileSelection` | `boolean` | If `true`, allows multiple files to be selected at once. |
|
|
147
|
-
| `displayThumbnail` | `boolean` | If `true`, displays a thumbnail preview for image files (PNG format). |
|
|
148
|
-
| `label` | `string` | The label for the file selection button. |
|
|
149
|
-
| `uploadUrl` | `string` | The URL endpoint for uploading files. |
|
|
150
|
-
| `deleteUrl` | `string` | An optional URL endpoint for deleting files. If not provided, files are only removed from the list. |
|
|
151
|
-
|
|
152
|
-
## Example Configuration
|
|
153
|
-
|
|
154
|
-
Here's an example of how to configure the Multi-File Upload component in your component's TypeScript file.
|
|
155
|
-
|
|
156
|
-
```typescript
|
|
157
|
-
import { Component } from '@angular/core';
|
|
158
|
-
import { MultifiledefaultConfig } from '@ruc-lib/multi-file-upload';
|
|
159
|
-
|
|
160
|
-
@Component({
|
|
161
|
-
selector: 'app-root',
|
|
162
|
-
templateUrl: './app.component.html',
|
|
163
|
-
})
|
|
164
|
-
export class AppComponent {
|
|
165
|
-
|
|
166
|
-
inputObjectDataMultiFileUpload: MultifiledefaultConfig = {
|
|
167
|
-
multifileSelection: true,
|
|
168
|
-
displayThumbnail: true,
|
|
169
|
-
label: 'Choose File',
|
|
170
|
-
uploadUrl: '/api/upload',
|
|
171
|
-
deleteUrl: '/api/delete',
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
handleEvent(event: any) {
|
|
175
|
-
console.log(event.eventName, event.eventOutput);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
## Contribution
|
|
181
|
-
|
|
182
|
-
Contributions are welcome! Feel free to open issues or pull requests for any enhancements or fixes.
|
|
183
|
-
|
|
184
|
-
## Acknowledgements
|
|
185
|
-
|
|
186
|
-
Thank you for choosing the Multi-File Upload Component. If you have any feedback or suggestions, please let us know!
|
|
7
|
+
Run `nx test ruclib-multi-file-upload` to execute the unit tests.
|
|
@@ -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,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|
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": "3.1.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
|