@yoozsoft/yoozsoft-ng 4.0.2 → 4.0.3
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.
|
@@ -6,32 +6,48 @@ import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
|
6
6
|
class YsFileUploadComponent {
|
|
7
7
|
fileList;
|
|
8
8
|
files = [];
|
|
9
|
-
selectedFile;
|
|
9
|
+
selectedFile = null;
|
|
10
|
+
styleClass;
|
|
11
|
+
/**
|
|
12
|
+
* Allowing upload multiple files
|
|
13
|
+
* Default is false
|
|
14
|
+
*/
|
|
10
15
|
multiple = false;
|
|
16
|
+
/**
|
|
17
|
+
* Acceptable type of files
|
|
18
|
+
* Default is all file type
|
|
19
|
+
*/
|
|
11
20
|
accept = '*/*';
|
|
12
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Upload button label
|
|
23
|
+
* Default is Choose File
|
|
24
|
+
*/
|
|
13
25
|
uploadLabel = 'Choose File';
|
|
14
26
|
/**Style class of upload button */
|
|
15
27
|
uploadStyleClass;
|
|
16
28
|
/**Icon class of upload button */
|
|
17
29
|
uploadIconClass = 'fa fa-paperclip';
|
|
30
|
+
/**Display choosed file remove button */
|
|
31
|
+
isRemove = true;
|
|
18
32
|
/**Icon of remove item button */
|
|
19
33
|
removeIconClass = 'fa fa-times';
|
|
20
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
* Files list display direction
|
|
36
|
+
* Default is vertical (false)
|
|
37
|
+
*/
|
|
21
38
|
isHorizontal = false;
|
|
22
|
-
/**
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
message = "No file chosen";
|
|
39
|
+
/**Message displayed before choosing file */
|
|
40
|
+
noFileMessage = "No file chosen";
|
|
41
|
+
progressStyleClass;
|
|
26
42
|
/**Value of progress element */
|
|
27
43
|
progressValue;
|
|
28
44
|
/**Max value of progress element */
|
|
29
45
|
progressValueMax = 100;
|
|
30
46
|
/**Display cancel upload button */
|
|
31
47
|
isCancel = false;
|
|
32
|
-
/**Event to get files */
|
|
33
|
-
|
|
34
|
-
/**Event of selected file */
|
|
48
|
+
/**Event to get choosed files */
|
|
49
|
+
choosed = new EventEmitter();
|
|
50
|
+
/**Event of selected file in the list of choosed file*/
|
|
35
51
|
select = new EventEmitter();
|
|
36
52
|
/**Event of cancel upload button */
|
|
37
53
|
cancel = new EventEmitter();
|
|
@@ -45,6 +61,10 @@ class YsFileUploadComponent {
|
|
|
45
61
|
this.files = [];
|
|
46
62
|
return;
|
|
47
63
|
}
|
|
64
|
+
if (!Array.isArray(obj)) {
|
|
65
|
+
this.files = [obj];
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
48
68
|
this.files = obj;
|
|
49
69
|
}
|
|
50
70
|
registerOnChange(fn) {
|
|
@@ -73,18 +93,18 @@ class YsFileUploadComponent {
|
|
|
73
93
|
}
|
|
74
94
|
this.onChange(this.files);
|
|
75
95
|
this.onTouched(this.files);
|
|
76
|
-
this.
|
|
96
|
+
this.choosed.emit(this.multiple ? this.files : this.files[0]);
|
|
77
97
|
event.target.value = null;
|
|
78
98
|
}
|
|
79
99
|
removeFile(file) {
|
|
80
100
|
const index = this.files.indexOf(file);
|
|
81
101
|
this.files.splice(index, 1);
|
|
82
|
-
this.onChange(this.files);
|
|
102
|
+
this.onChange(this.multiple ? this.files : this.files[0]);
|
|
83
103
|
this.onTouched(this.files);
|
|
84
|
-
this.
|
|
104
|
+
this.choosed.emit(this.files);
|
|
85
105
|
if (this.selectedFile == file) {
|
|
86
|
-
this.selectedFile =
|
|
87
|
-
this.select.emit(
|
|
106
|
+
this.selectedFile = null;
|
|
107
|
+
this.select.emit(null);
|
|
88
108
|
}
|
|
89
109
|
}
|
|
90
110
|
onSelectFile(file) {
|
|
@@ -95,13 +115,13 @@ class YsFileUploadComponent {
|
|
|
95
115
|
this.cancel.emit();
|
|
96
116
|
}
|
|
97
117
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: YsFileUploadComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
98
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.3", type: YsFileUploadComponent, isStandalone: true, selector: "ys-file-upload", inputs: { multiple: "multiple", accept: "accept", uploadLabel: "uploadLabel", uploadStyleClass: "uploadStyleClass", uploadIconClass: "uploadIconClass", removeIconClass: "removeIconClass", isHorizontal: "isHorizontal",
|
|
118
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.3", type: YsFileUploadComponent, isStandalone: true, selector: "ys-file-upload", inputs: { styleClass: "styleClass", multiple: "multiple", accept: "accept", uploadLabel: "uploadLabel", uploadStyleClass: "uploadStyleClass", uploadIconClass: "uploadIconClass", isRemove: "isRemove", removeIconClass: "removeIconClass", isHorizontal: "isHorizontal", noFileMessage: "noFileMessage", progressStyleClass: "progressStyleClass", progressValue: "progressValue", progressValueMax: "progressValueMax", isCancel: "isCancel", disabled: "disabled" }, outputs: { choosed: "choosed", select: "select", cancel: "cancel" }, providers: [
|
|
99
119
|
{
|
|
100
120
|
provide: NG_VALUE_ACCESSOR,
|
|
101
121
|
useExisting: forwardRef(() => YsFileUploadComponent),
|
|
102
122
|
multi: true
|
|
103
123
|
}
|
|
104
|
-
], ngImport: i0, template: "<input class=\"form-control d-none file-upload\" type=\"file\" id=\"ysFileUpload\" #ysFileUpload [multiple]=\"multiple\"\r\n [accept]=\"accept\" [disabled]=\"disabled\" (change)=\"onChangeFiles($event)\">\r\n\r\n<div class=\"file-upload\">\r\n <div class=\"row\">\r\n <div class=\"col\">\r\n <button class=\"btn btn-primary btn-upload {{uploadStyleClass}}\" (click)=\"ysFileUpload.click()\"\r\n [disabled]=\"disabled\">\r\n <i [ngClass]=\"uploadIconClass\"></i>\r\n <span class=\"ms-2\" *ngIf=\"uploadLabel\">{{uploadLabel}}</span>\r\n </button>\r\n\r\n <span class=\"ms-2\">{{files.length ? '' :
|
|
124
|
+
], ngImport: i0, template: "<input class=\"form-control d-none file-upload\" type=\"file\" id=\"ysFileUpload\" #ysFileUpload [multiple]=\"multiple\"\r\n [accept]=\"accept\" [disabled]=\"disabled\" (change)=\"onChangeFiles($event)\">\r\n\r\n<div class=\"file-upload\" [ngClass]=\"styleClass\">\r\n <div class=\"row\">\r\n <div class=\"col\">\r\n <button class=\"btn btn-primary btn-upload {{uploadStyleClass}}\" (click)=\"ysFileUpload.click()\"\r\n [disabled]=\"disabled\">\r\n <i [ngClass]=\"uploadIconClass\"></i>\r\n <span class=\"ms-2\" *ngIf=\"uploadLabel\">{{uploadLabel}}</span>\r\n </button>\r\n\r\n <span class=\"ms-2\" *ngIf=\"noFileMessage\">{{files.length ? '' : noFileMessage}}</span>\r\n\r\n <ul *ngIf=\"files.length\" class=\"file-upload-list list-group mt-2\"\r\n [ngClass]=\"{'list-group-horizontal overflow-auto': isHorizontal}\">\r\n <a class=\"file-upload-item list-group-item d-flex align-items-center\" role=\"button\"\r\n *ngFor=\"let file of files\" (click)=\"onSelectFile(file)\"\r\n [ngClass]=\"{'active': file == selectedFile, 'disabled': disabled}\">\r\n <span class=\"me-2\">{{file.name}}</span>\r\n <button *ngIf=\"isRemove\" class=\"btn btn-outline-danger btn-sm ms-auto\" type=\"button\"\r\n id=\"removeFileButton\" (click)=\"removeFile(file); $event.stopPropagation();\"\r\n [disabled]=\"disabled\">\r\n <i [ngClass]=\"removeIconClass\"></i>\r\n </button>\r\n </a>\r\n </ul>\r\n\r\n </div>\r\n </div>\r\n</div>\r\n\r\n<div class=\"progress mt-2\" [ngClass]=\"progressStyleClass\" *ngIf=\"progressValue\">\r\n <div class=\"progress-bar\" role=\"progressbar\" [style.width.%]=\"progressValue\" [attr.aria-valuenow]=\"progressValue\"\r\n aria-valuemin=\"0\" [attr.aria-valuemax]=\"progressValueMax\"></div>\r\n\r\n <button *ngIf=\"isCancel && progressValue < progressValueMax\" class=\"btn btn-danger btn-sm btn-upload-cancel d-flex\"\r\n (click)=\"cancelUpload()\">\r\n <i class=\"fa fa-times\"></i>\r\n </button>\r\n</div>", styles: [".progress{height:20px}\n"], dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
|
|
105
125
|
}
|
|
106
126
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: YsFileUploadComponent, decorators: [{
|
|
107
127
|
type: Component,
|
|
@@ -111,8 +131,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImpor
|
|
|
111
131
|
useExisting: forwardRef(() => YsFileUploadComponent),
|
|
112
132
|
multi: true
|
|
113
133
|
}
|
|
114
|
-
], template: "<input class=\"form-control d-none file-upload\" type=\"file\" id=\"ysFileUpload\" #ysFileUpload [multiple]=\"multiple\"\r\n [accept]=\"accept\" [disabled]=\"disabled\" (change)=\"onChangeFiles($event)\">\r\n\r\n<div class=\"file-upload\">\r\n <div class=\"row\">\r\n <div class=\"col\">\r\n <button class=\"btn btn-primary btn-upload {{uploadStyleClass}}\" (click)=\"ysFileUpload.click()\"\r\n [disabled]=\"disabled\">\r\n <i [ngClass]=\"uploadIconClass\"></i>\r\n <span class=\"ms-2\" *ngIf=\"uploadLabel\">{{uploadLabel}}</span>\r\n </button>\r\n\r\n <span class=\"ms-2\">{{files.length ? '' :
|
|
115
|
-
}], ctorParameters: () => [], propDecorators: {
|
|
134
|
+
], template: "<input class=\"form-control d-none file-upload\" type=\"file\" id=\"ysFileUpload\" #ysFileUpload [multiple]=\"multiple\"\r\n [accept]=\"accept\" [disabled]=\"disabled\" (change)=\"onChangeFiles($event)\">\r\n\r\n<div class=\"file-upload\" [ngClass]=\"styleClass\">\r\n <div class=\"row\">\r\n <div class=\"col\">\r\n <button class=\"btn btn-primary btn-upload {{uploadStyleClass}}\" (click)=\"ysFileUpload.click()\"\r\n [disabled]=\"disabled\">\r\n <i [ngClass]=\"uploadIconClass\"></i>\r\n <span class=\"ms-2\" *ngIf=\"uploadLabel\">{{uploadLabel}}</span>\r\n </button>\r\n\r\n <span class=\"ms-2\" *ngIf=\"noFileMessage\">{{files.length ? '' : noFileMessage}}</span>\r\n\r\n <ul *ngIf=\"files.length\" class=\"file-upload-list list-group mt-2\"\r\n [ngClass]=\"{'list-group-horizontal overflow-auto': isHorizontal}\">\r\n <a class=\"file-upload-item list-group-item d-flex align-items-center\" role=\"button\"\r\n *ngFor=\"let file of files\" (click)=\"onSelectFile(file)\"\r\n [ngClass]=\"{'active': file == selectedFile, 'disabled': disabled}\">\r\n <span class=\"me-2\">{{file.name}}</span>\r\n <button *ngIf=\"isRemove\" class=\"btn btn-outline-danger btn-sm ms-auto\" type=\"button\"\r\n id=\"removeFileButton\" (click)=\"removeFile(file); $event.stopPropagation();\"\r\n [disabled]=\"disabled\">\r\n <i [ngClass]=\"removeIconClass\"></i>\r\n </button>\r\n </a>\r\n </ul>\r\n\r\n </div>\r\n </div>\r\n</div>\r\n\r\n<div class=\"progress mt-2\" [ngClass]=\"progressStyleClass\" *ngIf=\"progressValue\">\r\n <div class=\"progress-bar\" role=\"progressbar\" [style.width.%]=\"progressValue\" [attr.aria-valuenow]=\"progressValue\"\r\n aria-valuemin=\"0\" [attr.aria-valuemax]=\"progressValueMax\"></div>\r\n\r\n <button *ngIf=\"isCancel && progressValue < progressValueMax\" class=\"btn btn-danger btn-sm btn-upload-cancel d-flex\"\r\n (click)=\"cancelUpload()\">\r\n <i class=\"fa fa-times\"></i>\r\n </button>\r\n</div>", styles: [".progress{height:20px}\n"] }]
|
|
135
|
+
}], ctorParameters: () => [], propDecorators: { styleClass: [{
|
|
136
|
+
type: Input
|
|
137
|
+
}], multiple: [{
|
|
116
138
|
type: Input
|
|
117
139
|
}], accept: [{
|
|
118
140
|
type: Input
|
|
@@ -122,13 +144,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImpor
|
|
|
122
144
|
type: Input
|
|
123
145
|
}], uploadIconClass: [{
|
|
124
146
|
type: Input
|
|
147
|
+
}], isRemove: [{
|
|
148
|
+
type: Input
|
|
125
149
|
}], removeIconClass: [{
|
|
126
150
|
type: Input
|
|
127
151
|
}], isHorizontal: [{
|
|
128
152
|
type: Input
|
|
129
|
-
}],
|
|
153
|
+
}], noFileMessage: [{
|
|
130
154
|
type: Input
|
|
131
|
-
}],
|
|
155
|
+
}], progressStyleClass: [{
|
|
132
156
|
type: Input
|
|
133
157
|
}], progressValue: [{
|
|
134
158
|
type: Input
|
|
@@ -136,7 +160,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImpor
|
|
|
136
160
|
type: Input
|
|
137
161
|
}], isCancel: [{
|
|
138
162
|
type: Input
|
|
139
|
-
}],
|
|
163
|
+
}], choosed: [{
|
|
140
164
|
type: Output
|
|
141
165
|
}], select: [{
|
|
142
166
|
type: Output
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"yoozsoft-yoozsoft-ng-file-upload.mjs","sources":["../../../../projects/yoozsoft/yoozsoft-ng/file-upload/src/ys-file-upload/ys-file-upload.component.ts","../../../../projects/yoozsoft/yoozsoft-ng/file-upload/src/ys-file-upload/ys-file-upload.component.html","../../../../projects/yoozsoft/yoozsoft-ng/file-upload/public-api.ts","../../../../projects/yoozsoft/yoozsoft-ng/file-upload/yoozsoft-yoozsoft-ng-file-upload.ts"],"sourcesContent":["import { NgClass, NgFor, NgIf } from '@angular/common';\r\nimport { Component, EventEmitter, forwardRef, Input, Output } from '@angular/core';\r\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\r\n\r\n@Component({\r\n selector: 'ys-file-upload',\r\n imports: [NgIf, NgFor, NgClass],\r\n templateUrl: './ys-file-upload.component.html',\r\n styleUrl: './ys-file-upload.component.scss',\r\n providers: [\r\n {\r\n provide: NG_VALUE_ACCESSOR,\r\n useExisting: forwardRef(() => YsFileUploadComponent),\r\n multi: true\r\n }\r\n ]\r\n})\r\nexport class YsFileUploadComponent implements ControlValueAccessor {\r\n\r\n private fileList?: FileList;\r\n files: File[] = [];\r\n selectedFile?: File;\r\n\r\n @Input() multiple: boolean = false;\r\n @Input() accept: string = '*/*';\r\n /**Label of upload button */\r\n @Input() uploadLabel?: string = 'Choose File';\r\n /**Style class of upload button */\r\n @Input() uploadStyleClass?: string;\r\n /**Icon class of upload button */\r\n @Input() uploadIconClass: string = 'fa fa-paperclip';\r\n /**Icon of remove item button */\r\n @Input() removeIconClass: string = 'fa fa-times';\r\n /**Files display style */\r\n @Input() isHorizontal: boolean = false;\r\n /**Display remove button */\r\n @Input() isRemove: boolean = true;\r\n\r\n /**Message displayed before choosen file */\r\n @Input() message: string = \"No file chosen\";\r\n\r\n /**Value of progress element */\r\n @Input() progressValue?: number;\r\n /**Max value of progress element */\r\n @Input() progressValueMax: number = 100;\r\n /**Display cancel upload button */\r\n @Input() isCancel: boolean = false;\r\n\r\n /**Event to get files */\r\n @Output() change: EventEmitter<File[]> = new EventEmitter();\r\n /**Event of selected file */\r\n @Output() select: EventEmitter<File | undefined> = new EventEmitter();\r\n /**Event of cancel upload button */\r\n @Output() cancel: EventEmitter<void> = new EventEmitter();\r\n\r\n /**Disable elements */\r\n @Input() disabled: boolean = false;\r\n onChange: any = () => { }\r\n onTouched: any = () => { }\r\n\r\n constructor() { }\r\n\r\n writeValue(obj: any): void {\r\n if (!obj) {\r\n this.files = [];\r\n return;\r\n }\r\n\r\n this.files = obj;\r\n }\r\n registerOnChange(fn: any): void {\r\n this.onChange = fn;\r\n }\r\n registerOnTouched(fn: any): void {\r\n this.onTouched = fn;\r\n }\r\n setDisabledState?(isDisabled: boolean): void {\r\n this.disabled = isDisabled;\r\n }\r\n\r\n onChangeFiles(event: any) {\r\n this.fileList = event.target.files;\r\n\r\n if (this.fileList?.length) {\r\n\r\n if (!this.multiple) {\r\n this.files = [];\r\n }\r\n\r\n for (let i = 0; i < this.fileList.length; i++) {\r\n const file: File = this.fileList.item(i)!;\r\n this.files.push(file);\r\n }\r\n\r\n this.files.sort((a, b) => a.name > b.name ? -1 : 1);\r\n\r\n } else {\r\n this.files = [];\r\n }\r\n\r\n this.onChange(this.files);\r\n this.onTouched(this.files);\r\n\r\n this.change.emit(this.files);\r\n\r\n event.target.value = null;\r\n\r\n }\r\n\r\n removeFile(file: File) {\r\n const index = this.files.indexOf(file);\r\n this.files.splice(index, 1);\r\n\r\n this.onChange(this.files);\r\n this.onTouched(this.files);\r\n\r\n this.change.emit(this.files);\r\n\r\n if (this.selectedFile == file) {\r\n this.selectedFile = undefined;\r\n this.select.emit(undefined);\r\n }\r\n }\r\n\r\n onSelectFile(file: File) {\r\n this.selectedFile = file;\r\n this.select.emit(this.selectedFile);\r\n }\r\n\r\n cancelUpload() {\r\n this.cancel.emit();\r\n }\r\n\r\n}\r\n","<input class=\"form-control d-none file-upload\" type=\"file\" id=\"ysFileUpload\" #ysFileUpload [multiple]=\"multiple\"\r\n [accept]=\"accept\" [disabled]=\"disabled\" (change)=\"onChangeFiles($event)\">\r\n\r\n<div class=\"file-upload\">\r\n <div class=\"row\">\r\n <div class=\"col\">\r\n <button class=\"btn btn-primary btn-upload {{uploadStyleClass}}\" (click)=\"ysFileUpload.click()\"\r\n [disabled]=\"disabled\">\r\n <i [ngClass]=\"uploadIconClass\"></i>\r\n <span class=\"ms-2\" *ngIf=\"uploadLabel\">{{uploadLabel}}</span>\r\n </button>\r\n\r\n <span class=\"ms-2\">{{files.length ? '' : message}}</span>\r\n\r\n <ul *ngIf=\"files.length\" class=\"file-upload-list list-group mt-2\"\r\n [ngClass]=\"{'list-group-horizontal': isHorizontal}\">\r\n <a class=\"file-upload-item list-group-item d-flex align-items-center\" role=\"button\"\r\n *ngFor=\"let file of files\" (click)=\"onSelectFile(file)\"\r\n [ngClass]=\"{'active': file == selectedFile, 'disabled': disabled}\">\r\n <span class=\"me-2\">{{file.name}}</span>\r\n <button *ngIf=\"isRemove\" class=\"btn btn-outline-danger btn-sm ms-auto\" type=\"button\"\r\n id=\"removeFileButton\" (click)=\"removeFile(file); $event.stopPropagation();\"\r\n [disabled]=\"disabled\">\r\n <i [ngClass]=\"removeIconClass\"></i>\r\n </button>\r\n </a>\r\n </ul>\r\n\r\n </div>\r\n </div>\r\n</div>\r\n\r\n<div class=\"progress mt-2\" style=\"height: 20px;\" *ngIf=\"progressValue\">\r\n <div class=\"progress-bar\" role=\"progressbar\" [style.width.%]=\"progressValue\" [attr.aria-valuenow]=\"progressValue\"\r\n aria-valuemin=\"0\" [attr.aria-valuemax]=\"progressValueMax\"></div>\r\n\r\n <button *ngIf=\"isCancel && progressValue < progressValueMax\" class=\"btn btn-danger btn-sm btn-upload-cancel d-flex\"\r\n (click)=\"cancelUpload()\">\r\n <i class=\"fa fa-times\" (click)=\"cancelUpload()\"></i>\r\n </button>\r\n</div>","/*\r\n * Public API Surface of ys-select\r\n */\r\n\r\nexport * from './src/ys-file-upload/ys-file-upload.component';\r\n\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;MAiBa,qBAAqB,CAAA;AAExB,IAAA,QAAQ;IAChB,KAAK,GAAW,EAAE;AAClB,IAAA,YAAY;IAEH,QAAQ,GAAY,KAAK;IACzB,MAAM,GAAW,KAAK;;IAEtB,WAAW,GAAY,aAAa;;AAEpC,IAAA,gBAAgB;;IAEhB,eAAe,GAAW,iBAAiB;;IAE3C,eAAe,GAAW,aAAa;;IAEvC,YAAY,GAAY,KAAK;;IAE7B,QAAQ,GAAY,IAAI;;IAGxB,OAAO,GAAW,gBAAgB;;AAGlC,IAAA,aAAa;;IAEb,gBAAgB,GAAW,GAAG;;IAE9B,QAAQ,GAAY,KAAK;;AAGxB,I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A,CAAA;kBAbjC,SAAS;+BACE,gBAAgB,EAAA,OAAA,EACjB,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,EAGpB,SAAA,EAAA;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,iBAAiB;AAC1B,4BAAA,WAAW,EAAE,UAAU,CAAC,2BAA2B,CAAC;AACpD,4BAAA,KAAK,EAAE;AACR;AACF,qBAAA,EAAA,QAAA,EAAA,8rEAAA,EAAA;wDAQQ,QAAQ,EAAA,CAAA;sBAAhB;gBACQ,MAAM,EAAA,CAAA;sBAAd;gBAEQ,WAAW,EAAA,CAAA;sBAAnB;gBAEQ,gBAAgB,EAAA,CAAA;sBAAxB;gBAEQ,eAAe,EAAA,CAAA;sBAAvB;gBAEQ,eAAe,EAAA,CAAA;sBAAvB;gBAEQ,YAAY,EAAA,CAAA;sBAApB;gBAEQ,QAAQ,EAAA,CAAA;sBAAhB;gBAGQ,OAAO,EAAA,CAAA;sBAAf;gBAGQ,aAAa,EAAA,CAAA;sBAArB;gBAEQ,gBAAgB,EAAA,CAAA;sBAAxB;gBAEQ,QAAQ,EAAA,CAAA;sBAAhB;gBAGS,MAAM,EAAA,CAAA;sBAAf;gBAES,MAAM,EAAA,CAAA;sBAAf;gBAES,MAAM,EAAA,CAAA;sBAAf;gBAGQ,QAAQ,EAAA,CAAA;sBAAhB;;;AExDH;;AAEG;;ACFH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"yoozsoft-yoozsoft-ng-file-upload.mjs","sources":["../../../../projects/yoozsoft/yoozsoft-ng/file-upload/src/ys-file-upload/ys-file-upload.component.ts","../../../../projects/yoozsoft/yoozsoft-ng/file-upload/src/ys-file-upload/ys-file-upload.component.html","../../../../projects/yoozsoft/yoozsoft-ng/file-upload/public-api.ts","../../../../projects/yoozsoft/yoozsoft-ng/file-upload/yoozsoft-yoozsoft-ng-file-upload.ts"],"sourcesContent":["import { NgClass, NgFor, NgIf } from '@angular/common';\r\nimport { Component, EventEmitter, forwardRef, Input, Output } from '@angular/core';\r\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\r\n\r\n@Component({\r\n selector: 'ys-file-upload',\r\n imports: [NgIf, NgFor, NgClass],\r\n templateUrl: './ys-file-upload.component.html',\r\n styleUrl: './ys-file-upload.component.scss',\r\n providers: [\r\n {\r\n provide: NG_VALUE_ACCESSOR,\r\n useExisting: forwardRef(() => YsFileUploadComponent),\r\n multi: true\r\n }\r\n ]\r\n})\r\nexport class YsFileUploadComponent implements ControlValueAccessor {\r\n\r\n private fileList?: FileList;\r\n files: File[] = [];\r\n selectedFile: File | null = null;\r\n\r\n @Input() styleClass?: string;\r\n /**\r\n * Allowing upload multiple files\r\n * Default is false\r\n */\r\n @Input() multiple: boolean = false;\r\n /**\r\n * Acceptable type of files\r\n * Default is all file type\r\n */\r\n @Input() accept: string = '*/*';\r\n /**\r\n * Upload button label\r\n * Default is Choose File\r\n */\r\n @Input() uploadLabel?: string = 'Choose File';\r\n /**Style class of upload button */\r\n @Input() uploadStyleClass?: string;\r\n /**Icon class of upload button */\r\n @Input() uploadIconClass: string = 'fa fa-paperclip';\r\n\r\n /**Display choosed file remove button */\r\n @Input() isRemove: boolean = true;\r\n /**Icon of remove item button */\r\n @Input() removeIconClass: string = 'fa fa-times';\r\n\r\n /**\r\n * Files list display direction\r\n * Default is vertical (false)\r\n */\r\n @Input() isHorizontal: boolean = false;\r\n\r\n /**Message displayed before choosing file */\r\n @Input() noFileMessage: string = \"No file chosen\";\r\n\r\n @Input() progressStyleClass?: string;\r\n /**Value of progress element */\r\n @Input() progressValue?: number;\r\n /**Max value of progress element */\r\n @Input() progressValueMax: number = 100;\r\n /**Display cancel upload button */\r\n @Input() isCancel: boolean = false;\r\n\r\n /**Event to get choosed files */\r\n @Output() choosed: EventEmitter<File | File[]> = new EventEmitter();\r\n /**Event of selected file in the list of choosed file*/\r\n @Output() select: EventEmitter<File | null> = new EventEmitter();\r\n /**Event of cancel upload button */\r\n @Output() cancel: EventEmitter<void> = new EventEmitter();\r\n\r\n /**Disable elements */\r\n @Input() disabled: boolean = false;\r\n onChange: any = () => { }\r\n onTouched: any = () => { }\r\n\r\n constructor() { }\r\n\r\n writeValue(obj: any): void {\r\n if (!obj) {\r\n this.files = [];\r\n return;\r\n }\r\n\r\n if (!Array.isArray(obj)) {\r\n this.files = [obj];\r\n return;\r\n }\r\n\r\n this.files = obj;\r\n }\r\n registerOnChange(fn: any): void {\r\n this.onChange = fn;\r\n }\r\n registerOnTouched(fn: any): void {\r\n this.onTouched = fn;\r\n }\r\n setDisabledState?(isDisabled: boolean): void {\r\n this.disabled = isDisabled;\r\n }\r\n\r\n onChangeFiles(event: any) {\r\n this.fileList = event.target.files;\r\n\r\n if (this.fileList?.length) {\r\n\r\n if (!this.multiple) {\r\n this.files = [];\r\n }\r\n\r\n for (let i = 0; i < this.fileList.length; i++) {\r\n const file: File = this.fileList.item(i)!;\r\n this.files.push(file);\r\n }\r\n\r\n this.files.sort((a, b) => a.name > b.name ? -1 : 1);\r\n\r\n } else {\r\n this.files = [];\r\n }\r\n\r\n this.onChange(this.files);\r\n this.onTouched(this.files);\r\n\r\n this.choosed.emit(this.multiple ? this.files : this.files[0]);\r\n\r\n event.target.value = null;\r\n\r\n }\r\n\r\n removeFile(file: File) {\r\n const index = this.files.indexOf(file);\r\n this.files.splice(index, 1);\r\n\r\n this.onChange(this.multiple ? this.files : this.files[0]);\r\n this.onTouched(this.files);\r\n\r\n this.choosed.emit(this.files);\r\n\r\n if (this.selectedFile == file) {\r\n this.selectedFile = null;\r\n this.select.emit(null);\r\n }\r\n }\r\n\r\n onSelectFile(file: File) {\r\n this.selectedFile = file;\r\n this.select.emit(this.selectedFile);\r\n }\r\n\r\n cancelUpload() {\r\n this.cancel.emit();\r\n }\r\n\r\n}\r\n","<input class=\"form-control d-none file-upload\" type=\"file\" id=\"ysFileUpload\" #ysFileUpload [multiple]=\"multiple\"\r\n [accept]=\"accept\" [disabled]=\"disabled\" (change)=\"onChangeFiles($event)\">\r\n\r\n<div class=\"file-upload\" [ngClass]=\"styleClass\">\r\n <div class=\"row\">\r\n <div class=\"col\">\r\n <button class=\"btn btn-primary btn-upload {{uploadStyleClass}}\" (click)=\"ysFileUpload.click()\"\r\n [disabled]=\"disabled\">\r\n <i [ngClass]=\"uploadIconClass\"></i>\r\n <span class=\"ms-2\" *ngIf=\"uploadLabel\">{{uploadLabel}}</span>\r\n </button>\r\n\r\n <span class=\"ms-2\" *ngIf=\"noFileMessage\">{{files.length ? '' : noFileMessage}}</span>\r\n\r\n <ul *ngIf=\"files.length\" class=\"file-upload-list list-group mt-2\"\r\n [ngClass]=\"{'list-group-horizontal overflow-auto': isHorizontal}\">\r\n <a class=\"file-upload-item list-group-item d-flex align-items-center\" role=\"button\"\r\n *ngFor=\"let file of files\" (click)=\"onSelectFile(file)\"\r\n [ngClass]=\"{'active': file == selectedFile, 'disabled': disabled}\">\r\n <span class=\"me-2\">{{file.name}}</span>\r\n <button *ngIf=\"isRemove\" class=\"btn btn-outline-danger btn-sm ms-auto\" type=\"button\"\r\n id=\"removeFileButton\" (click)=\"removeFile(file); $event.stopPropagation();\"\r\n [disabled]=\"disabled\">\r\n <i [ngClass]=\"removeIconClass\"></i>\r\n </button>\r\n </a>\r\n </ul>\r\n\r\n </div>\r\n </div>\r\n</div>\r\n\r\n<div class=\"progress mt-2\" [ngClass]=\"progressStyleClass\" *ngIf=\"progressValue\">\r\n <div class=\"progress-bar\" role=\"progressbar\" [style.width.%]=\"progressValue\" [attr.aria-valuenow]=\"progressValue\"\r\n aria-valuemin=\"0\" [attr.aria-valuemax]=\"progressValueMax\"></div>\r\n\r\n <button *ngIf=\"isCancel && progressValue < progressValueMax\" class=\"btn btn-danger btn-sm btn-upload-cancel d-flex\"\r\n (click)=\"cancelUpload()\">\r\n <i class=\"fa fa-times\"></i>\r\n </button>\r\n</div>","/*\r\n * Public API Surface of ys-select\r\n */\r\n\r\nexport * from './src/ys-file-upload/ys-file-upload.component';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AAlB;gBAKQ,QAAQ,EAAA,CAAA;sBAAhB;gBAKQ,MAAM,EAAA,CAAA;sBAAd;gBAKQ,WAAW,EAAA,CAAA;sBAAnB;gBAEQ,gBAAgB,EAAA,CAAA;sBAAxB;gBAEQ,eAAe,EAAA,CAAA;sBAAvB;gBAGQ,QAAQ,EAAA,CAAA;sBAAhB;gBAEQ,eAAe,EAAA,CAAA;sBAAvB;gBAMQ,YAAY,EAAA,CAAA;sBAApB;gBAGQ,aAAa,EAAA,CAAA;sBAArB;gBAEQ,kBAAkB,EAAA,CAAA;sBAA1B;gBAEQ,aAAa,EAAA,CAAA;sBAArB;gBAEQ,gBAAgB,EAAA,CAAA;sBAAxB;gBAEQ,QAAQ,EAAA,CAAA;sBAAhB;gBAGS,OAAO,EAAA,CAAA;sBAAhB;gBAES,MAAM,EAAA,CAAA;sBAAf;gBAES,MAAM,EAAA,CAAA;sBAAf;gBAGQ,QAAQ,EAAA,CAAA;sBAAhB;;;AE1EH;;AAEG;;ACFH;;AAEG;;;;"}
|
|
@@ -4,33 +4,49 @@ import * as i0 from "@angular/core";
|
|
|
4
4
|
export declare class YsFileUploadComponent implements ControlValueAccessor {
|
|
5
5
|
private fileList?;
|
|
6
6
|
files: File[];
|
|
7
|
-
selectedFile
|
|
7
|
+
selectedFile: File | null;
|
|
8
|
+
styleClass?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Allowing upload multiple files
|
|
11
|
+
* Default is false
|
|
12
|
+
*/
|
|
8
13
|
multiple: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Acceptable type of files
|
|
16
|
+
* Default is all file type
|
|
17
|
+
*/
|
|
9
18
|
accept: string;
|
|
10
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* Upload button label
|
|
21
|
+
* Default is Choose File
|
|
22
|
+
*/
|
|
11
23
|
uploadLabel?: string;
|
|
12
24
|
/**Style class of upload button */
|
|
13
25
|
uploadStyleClass?: string;
|
|
14
26
|
/**Icon class of upload button */
|
|
15
27
|
uploadIconClass: string;
|
|
28
|
+
/**Display choosed file remove button */
|
|
29
|
+
isRemove: boolean;
|
|
16
30
|
/**Icon of remove item button */
|
|
17
31
|
removeIconClass: string;
|
|
18
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* Files list display direction
|
|
34
|
+
* Default is vertical (false)
|
|
35
|
+
*/
|
|
19
36
|
isHorizontal: boolean;
|
|
20
|
-
/**
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
message: string;
|
|
37
|
+
/**Message displayed before choosing file */
|
|
38
|
+
noFileMessage: string;
|
|
39
|
+
progressStyleClass?: string;
|
|
24
40
|
/**Value of progress element */
|
|
25
41
|
progressValue?: number;
|
|
26
42
|
/**Max value of progress element */
|
|
27
43
|
progressValueMax: number;
|
|
28
44
|
/**Display cancel upload button */
|
|
29
45
|
isCancel: boolean;
|
|
30
|
-
/**Event to get files */
|
|
31
|
-
|
|
32
|
-
/**Event of selected file */
|
|
33
|
-
select: EventEmitter<File |
|
|
46
|
+
/**Event to get choosed files */
|
|
47
|
+
choosed: EventEmitter<File | File[]>;
|
|
48
|
+
/**Event of selected file in the list of choosed file*/
|
|
49
|
+
select: EventEmitter<File | null>;
|
|
34
50
|
/**Event of cancel upload button */
|
|
35
51
|
cancel: EventEmitter<void>;
|
|
36
52
|
/**Disable elements */
|
|
@@ -47,5 +63,5 @@ export declare class YsFileUploadComponent implements ControlValueAccessor {
|
|
|
47
63
|
onSelectFile(file: File): void;
|
|
48
64
|
cancelUpload(): void;
|
|
49
65
|
static ɵfac: i0.ɵɵFactoryDeclaration<YsFileUploadComponent, never>;
|
|
50
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<YsFileUploadComponent, "ys-file-upload", never, { "multiple": { "alias": "multiple"; "required": false; }; "accept": { "alias": "accept"; "required": false; }; "uploadLabel": { "alias": "uploadLabel"; "required": false; }; "uploadStyleClass": { "alias": "uploadStyleClass"; "required": false; }; "uploadIconClass": { "alias": "uploadIconClass"; "required": false; }; "removeIconClass": { "alias": "removeIconClass"; "required": false; }; "isHorizontal": { "alias": "isHorizontal"; "required": false; }; "
|
|
66
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<YsFileUploadComponent, "ys-file-upload", never, { "styleClass": { "alias": "styleClass"; "required": false; }; "multiple": { "alias": "multiple"; "required": false; }; "accept": { "alias": "accept"; "required": false; }; "uploadLabel": { "alias": "uploadLabel"; "required": false; }; "uploadStyleClass": { "alias": "uploadStyleClass"; "required": false; }; "uploadIconClass": { "alias": "uploadIconClass"; "required": false; }; "isRemove": { "alias": "isRemove"; "required": false; }; "removeIconClass": { "alias": "removeIconClass"; "required": false; }; "isHorizontal": { "alias": "isHorizontal"; "required": false; }; "noFileMessage": { "alias": "noFileMessage"; "required": false; }; "progressStyleClass": { "alias": "progressStyleClass"; "required": false; }; "progressValue": { "alias": "progressValue"; "required": false; }; "progressValueMax": { "alias": "progressValueMax"; "required": false; }; "isCancel": { "alias": "isCancel"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; }, { "choosed": "choosed"; "select": "select"; "cancel": "cancel"; }, never, never, true, never>;
|
|
51
67
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yoozsoft/yoozsoft-ng",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.3",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@angular/common": "^19.0.0",
|
|
6
6
|
"@angular/core": "^19.0.0"
|
|
@@ -39,14 +39,14 @@
|
|
|
39
39
|
"types": "./datepicker/index.d.ts",
|
|
40
40
|
"default": "./fesm2022/yoozsoft-yoozsoft-ng-datepicker.mjs"
|
|
41
41
|
},
|
|
42
|
-
"./file-upload": {
|
|
43
|
-
"types": "./file-upload/index.d.ts",
|
|
44
|
-
"default": "./fesm2022/yoozsoft-yoozsoft-ng-file-upload.mjs"
|
|
45
|
-
},
|
|
46
42
|
"./directives": {
|
|
47
43
|
"types": "./directives/index.d.ts",
|
|
48
44
|
"default": "./fesm2022/yoozsoft-yoozsoft-ng-directives.mjs"
|
|
49
45
|
},
|
|
46
|
+
"./file-upload": {
|
|
47
|
+
"types": "./file-upload/index.d.ts",
|
|
48
|
+
"default": "./fesm2022/yoozsoft-yoozsoft-ng-file-upload.mjs"
|
|
49
|
+
},
|
|
50
50
|
"./footer": {
|
|
51
51
|
"types": "./footer/index.d.ts",
|
|
52
52
|
"default": "./fesm2022/yoozsoft-yoozsoft-ng-footer.mjs"
|
|
@@ -67,14 +67,14 @@
|
|
|
67
67
|
"types": "./password-strength/index.d.ts",
|
|
68
68
|
"default": "./fesm2022/yoozsoft-yoozsoft-ng-password-strength.mjs"
|
|
69
69
|
},
|
|
70
|
-
"./progress": {
|
|
71
|
-
"types": "./progress/index.d.ts",
|
|
72
|
-
"default": "./fesm2022/yoozsoft-yoozsoft-ng-progress.mjs"
|
|
73
|
-
},
|
|
74
70
|
"./select": {
|
|
75
71
|
"types": "./select/index.d.ts",
|
|
76
72
|
"default": "./fesm2022/yoozsoft-yoozsoft-ng-select.mjs"
|
|
77
73
|
},
|
|
74
|
+
"./progress": {
|
|
75
|
+
"types": "./progress/index.d.ts",
|
|
76
|
+
"default": "./fesm2022/yoozsoft-yoozsoft-ng-progress.mjs"
|
|
77
|
+
},
|
|
78
78
|
"./sidebar": {
|
|
79
79
|
"types": "./sidebar/index.d.ts",
|
|
80
80
|
"default": "./fesm2022/yoozsoft-yoozsoft-ng-sidebar.mjs"
|