@yoozsoft/yoozsoft-ng 4.0.2 → 4.0.4
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/fesm2022/yoozsoft-yoozsoft-ng-file-upload.mjs +46 -22
- package/fesm2022/yoozsoft-yoozsoft-ng-file-upload.mjs.map +1 -1
- package/fesm2022/yoozsoft-yoozsoft-ng-tiff-viewer.mjs.map +1 -1
- package/file-upload/src/ys-file-upload/ys-file-upload.component.d.ts +28 -12
- package/package.json +13 -13
- package/tiff-viewer/src/ys-tiff-viewer/ys-tiff-viewer.component.d.ts +4 -4
|
@@ -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;;IA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-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';\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;IAClB,YAAY,GAAgB,IAAI;AAEvB,IAAA,UAAU;AACnB;;;AAGG;IACM,QAAQ,GAAY,KAAK;AAClC;;;AAGG;IACM,MAAM,GAAW,KAAK;AAC/B;;;AAGG;IACM,WAAW,GAAY,aAAa;;AAEpC,IAAA,gBAAgB;;IAEhB,eAAe,GAAW,iBAAiB;;IAG3C,QAAQ,GAAY,IAAI;;IAExB,eAAe,GAAW,aAAa;AAEhD;;;AAGG;IACM,YAAY,GAAY,KAAK;;IAG7B,aAAa,GAAW,gBAAgB;AAExC,IAAA,kBAAkB;;AAElB,IAAA,aAAa;;IAEb,gBAAgB,GAAW,GAAG;;IAE9B,QAAQ,GAAY,KAAK;;AAGxB,IAAA,OAAO,GAAgC,IAAI,YAAY,EAAE;;AAEzD,IAAA,MAAM,GAA8B,IAAI,YAAY,EAAE;;AAEtD,IAAA,MAAM,GAAuB,IAAI,YAAY,EAAE;;IAGhD,QAAQ,GAAY,KAAK;AAClC,IAAA,QAAQ,GAAQ,MAAK,GAAI;AACzB,IAAA,SAAS,GAAQ,MAAK,GAAI;AAE1B,IAAA,WAAA,GAAA;AAEA,IAAA,UAAU,CAAC,GAAQ,EAAA;QACjB,IAAI,CAAC,GAAG,EAAE;AACR,YAAA,IAAI,CAAC,KAAK,GAAG,EAAE;YACf;;QAGF,IAAI,CAA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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,ivEAAA,EAAA,MAAA,EAAA,CAAA,0BAAA,CAAA,EAAA;wDAQQ,UAAU,EAAA,CAAA;sBAAlB;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;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"yoozsoft-yoozsoft-ng-tiff-viewer.mjs","sources":["../../../../projects/yoozsoft/yoozsoft-ng/tiff-viewer/src/ys-tiff-viewer/ys-tiff-viewer.component.ts","../../../../projects/yoozsoft/yoozsoft-ng/tiff-viewer/src/ys-tiff-viewer/ys-tiff-viewer.component.html","../../../../projects/yoozsoft/yoozsoft-ng/tiff-viewer/public-api.ts","../../../../projects/yoozsoft/yoozsoft-ng/tiff-viewer/yoozsoft-yoozsoft-ng-tiff-viewer.ts"],"sourcesContent":["import { NgClass, NgIf } from '@angular/common';\r\nimport { Component, Input } from '@angular/core';\r\n\r\ndeclare var UTIF: any;\r\n\r\n@Component({\r\n selector: 'ys-tiff-viewer',\r\n imports: [NgIf, NgClass],\r\n templateUrl: './ys-tiff-viewer.component.html',\r\n styleUrl: './ys-tiff-viewer.component.scss'\r\n})\r\nexport class YsTiffViewerComponent {\r\n\r\n private canvas: any;\r\n private context: any;\r\n /**image file directories */\r\n private IFDs: any[] = [];\r\n private currentIFDIndex: number = 0;\r\n isDecoding: boolean = false;\r\n\r\n private _buffer?: ArrayBuffer | File | Blob;\r\n /**Uint8Array source */\r\n /**ArrayBuffer containing TIFF or EXIF data */\r\n @Input()\r\n get buffer(): ArrayBuffer | File | Blob | undefined { return this._buffer; }\r\n set buffer(value: ArrayBuffer | File | Blob | undefined) { this._buffer = value; this.convertSource(this._buffer); }\r\n\r\n _currentPageReportTemplate?: string = \"Page {current} of {total}\";\r\n /**Current page report template */\r\n @Input()\r\n get currentPageReportTemplate(): string | undefined {\r\n return this._currentPageReportTemplate?.\r\n replace('{current}', `<strong>${this.currentIFDIndex + 1}</strong>`).\r\n replace('{total}', `<strong>${this.IFDs.length}</strong>`);\r\n }\r\n set currentPageReportTemplate(value: string | undefined) { this._currentPageReportTemplate = value; }\r\n\r\n /**Canvas container style class */\r\n @Input() styleClass?: string;\r\n /**Message displayed before filling the input buffer */\r\n @Input() message?: string = \"No image file\";\r\n\r\n /**First button icon class */\r\n @Input() firstIconClass: string = 'fa fa-fast-backward';\r\n /**Previous button icon class */\r\n @Input() previousIconClass: string = 'fa fa-step-backward';\r\n /**Next button icon class */\r\n @Input() nextIconClass: string = 'fa fa-step-forward';\r\n /**Last button icon class */\r\n @Input() lastIconClass: string = 'fa fa-fast-forward';\r\n\r\n get isIFDs(): boolean { return this.IFDs.length > 0; }\r\n get isFirstImage(): boolean { return !this.isIFDs || (this.currentIFDIndex == 0); }\r\n get isLastImage(): boolean { return !this.isIFDs || (this.currentIFDIndex == this.IFDs.length - 1); }\r\n\r\n\r\n /**\r\n * Convert buffer to an array of \"IFDs\" (image file directories)\r\n * @param buffer ArrayBuffer containing TIFF or EXIF data\r\n * @returns \r\n */\r\n async convertSource(buffer: ArrayBuffer | File | Blob | undefined) {\r\n this.canvas = document.getElementById(\"tiffCanvas\");\r\n this.context = this.canvas.getContext(\"2d\");\r\n\r\n if (!buffer) {\r\n this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);\r\n return;\r\n }\r\n\r\n if (buffer instanceof File || buffer instanceof Blob) {\r\n buffer = await this.getAsByteArray(buffer);\r\n }\r\n\r\n this.isDecoding = true;\r\n\r\n this.IFDs = UTIF.decode(buffer);\r\n\r\n this.IFDs.forEach((ifd: any) => {\r\n UTIF.decodeImage(buffer, ifd);\r\n });\r\n\r\n this.currentIFDIndex = 0;\r\n this.putImage(this.currentIFDIndex);\r\n\r\n this.isDecoding = false;\r\n }\r\n\r\n putImage(index: number) {\r\n if (!this.IFDs.length) {\r\n this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);\r\n return;\r\n }\r\n\r\n const tiffImage = this.IFDs[index];\r\n const rgbaImage = UTIF.toRGBA8(tiffImage); // Uint8Array with RGBA pixels\r\n\r\n const data = new Uint8ClampedArray(rgbaImage);\r\n const imageData = new ImageData(data, tiffImage.width, tiffImage.height);\r\n\r\n this.context.canvas.width = tiffImage.width;\r\n this.context.canvas.height = tiffImage.height;\r\n // Draw image data to the canvas\r\n this.context.putImageData(imageData, 0, 0);\r\n }\r\n\r\n\r\n first() {\r\n this.currentIFDIndex = 0;\r\n this.putImage(this.currentIFDIndex);\r\n }\r\n previous() {\r\n this.currentIFDIndex -= 1;\r\n if (this.currentIFDIndex < 0) {\r\n this.currentIFDIndex = 0;\r\n return;\r\n }\r\n this.putImage(this.currentIFDIndex);\r\n }\r\n\r\n next() {\r\n this.currentIFDIndex += 1;\r\n if (this.currentIFDIndex > (this.IFDs.length - 1)) {\r\n this.currentIFDIndex = this.IFDs.length - 1;\r\n return;\r\n }\r\n this.putImage(this.currentIFDIndex);\r\n }\r\n last() {\r\n this.currentIFDIndex = this.IFDs.length - 1;\r\n this.putImage(this.currentIFDIndex);\r\n }\r\n\r\n async getAsByteArray(blob: Blob) {\r\n var res = new Uint8Array(await this.readFile(blob))\r\n return res;\r\n }\r\n\r\n async readFile(blob: Blob): Promise<ArrayBuffer> {\r\n return new Promise((resolve, reject) => {\r\n // Create file reader\r\n let reader = new FileReader()\r\n\r\n // Register event listeners\r\n reader.onload = () => resolve(reader.result as ArrayBuffer);\r\n reader.onerror = error => reject(error);\r\n\r\n // Read file\r\n reader.readAsArrayBuffer(blob);\r\n })\r\n }\r\n\r\n}\r\n","<div class=\"row\">\r\n <div class=\"col d-flex justify-content-between align-items-center mt-2\">\r\n <div>\r\n <button class=\"btn btn-outline-primary mb-0 me-2\" [ngClass]=\"{'ml-auto': isIFDs}\" type=\"button\"\r\n (click)=\"first()\" [disabled]=\"isFirstImage\">\r\n <i [ngClass]=\"firstIconClass\"></i>\r\n </button>\r\n <button class=\"btn btn-outline-primary mb-0\" type=\"button\" (click)=\"previous()\" [disabled]=\"isFirstImage\">\r\n <i [ngClass]=\"previousIconClass\"></i>\r\n </button>\r\n </div>\r\n\r\n <span *ngIf=\"isIFDs\" [innerHtml]=\"currentPageReportTemplate\">\r\n </span>\r\n\r\n <div>\r\n <button class=\"btn btn-outline-primary mb-0 me-2\" type=\"button\" (click)=\"next()\" [disabled]=\"isLastImage\">\r\n <i [ngClass]=\"nextIconClass\"></i>\r\n </button>\r\n <button class=\"btn btn-outline-primary mb-0\" [ngClass]=\"{'mr-auto': isIFDs}\" type=\"button\" (click)=\"last()\"\r\n [disabled]=\"isLastImage\">\r\n <i [ngClass]=\"lastIconClass\"></i>\r\n </button>\r\n </div>\r\n\r\n\r\n </div>\r\n</div>\r\n<div class=\"row\">\r\n <div class=\"col\">\r\n <div class=\"canvas-container card d-flex justify-content-center align-items-center mt-1 {{styleClass}}\">\r\n <span *ngIf=\"!isIFDs && message\">{{message}}</span>\r\n <canvas #tiffCanvas id=\"tiffCanvas\" class=\"canvas-image img-fluid\" [ngClass]=\"{'d-none': !isIFDs}\"></canvas>\r\n <div class=\"backdrop position-absolute w-100 h-100 d-flex justify-content-center align-items-center\"\r\n [ngClass]=\"{'d-none': !isDecoding}\">\r\n\r\n </div>\r\n <div class=\"spinner-border text-info position-absolute\" style=\"width: 3rem; height: 3rem;\" role=\"status\"\r\n [ngClass]=\"{'d-none': !isDecoding}\">\r\n <span class=\"visually-hidden\">Loading...</span>\r\n </div>\r\n </div>\r\n </div>\r\n</div>","/*\r\n * Public API Surface of ys-sidebar\r\n */\r\n\r\nexport * from './src/ys-tiff-viewer/ys-tiff-viewer.component';\r\n\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;MAWa,qBAAqB,CAAA;AAExB,IAAA,MAAM;AACN,IAAA,OAAO;;IAEP,IAAI,GAAU,EAAE;IAChB,eAAe,GAAW,CAAC;IACnC,UAAU,GAAY,KAAK;AAEnB,IAAA,OAAO;;;IAGf,IACI,MAAM,KAA4C,OAAO,IAAI,CAAC,OAAO,CAAC;IAC1E,IAAI,MAAM,CAAC,KAA4C,EAAA,EAAI,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAElH,0BAA0B,GAAY,2BAA2B;;AAEjE,IAAA,IACI,yBAAyB,GAAA;QAC3B,OAAO,IAAI,CAAC,0BAA0B;YACpC,OAAO,CAAC,WAAW,EAAE,CAAW,QAAA,EAAA,IAAI,CAAC,eAAe,GAAG,CAAC,CAAA,SAAA,CAAW,CAAC;YACpE,OAAO,CAAC,SAAS,EAAE,CAAW,QAAA,EAAA,IAAI,CAAC,IAAI,CAAC,MAAM,CAAW,SAAA,CAAA,CAAC;;IAE9D,IAAI,yBAAyB,CAAC,KAA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tiff-viewer.mjs","sources":["../../../../projects/yoozsoft/yoozsoft-ng/tiff-viewer/src/ys-tiff-viewer/ys-tiff-viewer.component.ts","../../../../projects/yoozsoft/yoozsoft-ng/tiff-viewer/src/ys-tiff-viewer/ys-tiff-viewer.component.html","../../../../projects/yoozsoft/yoozsoft-ng/tiff-viewer/public-api.ts","../../../../projects/yoozsoft/yoozsoft-ng/tiff-viewer/yoozsoft-yoozsoft-ng-tiff-viewer.ts"],"sourcesContent":["import { NgClass, NgIf } from '@angular/common';\r\nimport { Component, Input } from '@angular/core';\r\n\r\ndeclare var UTIF: any;\r\n\r\n@Component({\r\n selector: 'ys-tiff-viewer',\r\n imports: [NgIf, NgClass],\r\n templateUrl: './ys-tiff-viewer.component.html',\r\n styleUrl: './ys-tiff-viewer.component.scss'\r\n})\r\nexport class YsTiffViewerComponent {\r\n\r\n private canvas: any;\r\n private context: any;\r\n /**image file directories */\r\n private IFDs: any[] = [];\r\n private currentIFDIndex: number = 0;\r\n isDecoding: boolean = false;\r\n\r\n private _buffer: ArrayBuffer | File | Blob | null | undefined;\r\n /**Uint8Array source */\r\n /**ArrayBuffer containing TIFF or EXIF data */\r\n @Input()\r\n get buffer(): ArrayBuffer | File | Blob | null | undefined { return this._buffer; }\r\n set buffer(value: ArrayBuffer | File | Blob | null | undefined) { this._buffer = value; this.convertSource(this._buffer); }\r\n\r\n _currentPageReportTemplate?: string = \"Page {current} of {total}\";\r\n /**Current page report template */\r\n @Input()\r\n get currentPageReportTemplate(): string | undefined {\r\n return this._currentPageReportTemplate?.\r\n replace('{current}', `<strong>${this.currentIFDIndex + 1}</strong>`).\r\n replace('{total}', `<strong>${this.IFDs.length}</strong>`);\r\n }\r\n set currentPageReportTemplate(value: string | undefined) { this._currentPageReportTemplate = value; }\r\n\r\n /**Canvas container style class */\r\n @Input() styleClass?: string;\r\n /**Message displayed before filling the input buffer */\r\n @Input() message?: string = \"No image file\";\r\n\r\n /**First button icon class */\r\n @Input() firstIconClass: string = 'fa fa-fast-backward';\r\n /**Previous button icon class */\r\n @Input() previousIconClass: string = 'fa fa-step-backward';\r\n /**Next button icon class */\r\n @Input() nextIconClass: string = 'fa fa-step-forward';\r\n /**Last button icon class */\r\n @Input() lastIconClass: string = 'fa fa-fast-forward';\r\n\r\n get isIFDs(): boolean { return this.IFDs.length > 0; }\r\n get isFirstImage(): boolean { return !this.isIFDs || (this.currentIFDIndex == 0); }\r\n get isLastImage(): boolean { return !this.isIFDs || (this.currentIFDIndex == this.IFDs.length - 1); }\r\n\r\n\r\n /**\r\n * Convert buffer to an array of \"IFDs\" (image file directories)\r\n * @param buffer ArrayBuffer containing TIFF or EXIF data\r\n * @returns \r\n */\r\n async convertSource(buffer: ArrayBuffer | File | Blob | null | undefined) {\r\n this.canvas = document.getElementById(\"tiffCanvas\");\r\n this.context = this.canvas.getContext(\"2d\");\r\n\r\n if (!buffer) {\r\n this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);\r\n return;\r\n }\r\n\r\n if (buffer instanceof File || buffer instanceof Blob) {\r\n buffer = await this.getAsByteArray(buffer);\r\n }\r\n\r\n this.isDecoding = true;\r\n\r\n this.IFDs = UTIF.decode(buffer);\r\n\r\n this.IFDs.forEach((ifd: any) => {\r\n UTIF.decodeImage(buffer, ifd);\r\n });\r\n\r\n this.currentIFDIndex = 0;\r\n this.putImage(this.currentIFDIndex);\r\n\r\n this.isDecoding = false;\r\n }\r\n\r\n putImage(index: number) {\r\n if (!this.IFDs.length) {\r\n this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);\r\n return;\r\n }\r\n\r\n const tiffImage = this.IFDs[index];\r\n const rgbaImage = UTIF.toRGBA8(tiffImage); // Uint8Array with RGBA pixels\r\n\r\n const data = new Uint8ClampedArray(rgbaImage);\r\n const imageData = new ImageData(data, tiffImage.width, tiffImage.height);\r\n\r\n this.context.canvas.width = tiffImage.width;\r\n this.context.canvas.height = tiffImage.height;\r\n // Draw image data to the canvas\r\n this.context.putImageData(imageData, 0, 0);\r\n }\r\n\r\n\r\n first() {\r\n this.currentIFDIndex = 0;\r\n this.putImage(this.currentIFDIndex);\r\n }\r\n previous() {\r\n this.currentIFDIndex -= 1;\r\n if (this.currentIFDIndex < 0) {\r\n this.currentIFDIndex = 0;\r\n return;\r\n }\r\n this.putImage(this.currentIFDIndex);\r\n }\r\n\r\n next() {\r\n this.currentIFDIndex += 1;\r\n if (this.currentIFDIndex > (this.IFDs.length - 1)) {\r\n this.currentIFDIndex = this.IFDs.length - 1;\r\n return;\r\n }\r\n this.putImage(this.currentIFDIndex);\r\n }\r\n last() {\r\n this.currentIFDIndex = this.IFDs.length - 1;\r\n this.putImage(this.currentIFDIndex);\r\n }\r\n\r\n async getAsByteArray(blob: Blob) {\r\n var res = new Uint8Array(await this.readFile(blob))\r\n return res;\r\n }\r\n\r\n async readFile(blob: Blob): Promise<ArrayBuffer> {\r\n return new Promise((resolve, reject) => {\r\n // Create file reader\r\n let reader = new FileReader()\r\n\r\n // Register event listeners\r\n reader.onload = () => resolve(reader.result as ArrayBuffer);\r\n reader.onerror = error => reject(error);\r\n\r\n // Read file\r\n reader.readAsArrayBuffer(blob);\r\n })\r\n }\r\n\r\n}\r\n","<div class=\"row\">\r\n <div class=\"col d-flex justify-content-between align-items-center mt-2\">\r\n <div>\r\n <button class=\"btn btn-outline-primary mb-0 me-2\" [ngClass]=\"{'ml-auto': isIFDs}\" type=\"button\"\r\n (click)=\"first()\" [disabled]=\"isFirstImage\">\r\n <i [ngClass]=\"firstIconClass\"></i>\r\n </button>\r\n <button class=\"btn btn-outline-primary mb-0\" type=\"button\" (click)=\"previous()\" [disabled]=\"isFirstImage\">\r\n <i [ngClass]=\"previousIconClass\"></i>\r\n </button>\r\n </div>\r\n\r\n <span *ngIf=\"isIFDs\" [innerHtml]=\"currentPageReportTemplate\">\r\n </span>\r\n\r\n <div>\r\n <button class=\"btn btn-outline-primary mb-0 me-2\" type=\"button\" (click)=\"next()\" [disabled]=\"isLastImage\">\r\n <i [ngClass]=\"nextIconClass\"></i>\r\n </button>\r\n <button class=\"btn btn-outline-primary mb-0\" [ngClass]=\"{'mr-auto': isIFDs}\" type=\"button\" (click)=\"last()\"\r\n [disabled]=\"isLastImage\">\r\n <i [ngClass]=\"lastIconClass\"></i>\r\n </button>\r\n </div>\r\n\r\n\r\n </div>\r\n</div>\r\n<div class=\"row\">\r\n <div class=\"col\">\r\n <div class=\"canvas-container card d-flex justify-content-center align-items-center mt-1 {{styleClass}}\">\r\n <span *ngIf=\"!isIFDs && message\">{{message}}</span>\r\n <canvas #tiffCanvas id=\"tiffCanvas\" class=\"canvas-image img-fluid\" [ngClass]=\"{'d-none': !isIFDs}\"></canvas>\r\n <div class=\"backdrop position-absolute w-100 h-100 d-flex justify-content-center align-items-center\"\r\n [ngClass]=\"{'d-none': !isDecoding}\">\r\n\r\n </div>\r\n <div class=\"spinner-border text-info position-absolute\" style=\"width: 3rem; height: 3rem;\" role=\"status\"\r\n [ngClass]=\"{'d-none': !isDecoding}\">\r\n <span class=\"visually-hidden\">Loading...</span>\r\n </div>\r\n </div>\r\n </div>\r\n</div>","/*\r\n * Public API Surface of ys-sidebar\r\n */\r\n\r\nexport * from './src/ys-tiff-viewer/ys-tiff-viewer.component';\r\n\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;MAWa,qBAAqB,CAAA;AAExB,IAAA,MAAM;AACN,IAAA,OAAO;;IAEP,IAAI,GAAU,EAAE;IAChB,eAAe,GAAW,CAAC;IACnC,UAAU,GAAY,KAAK;AAEnB,IAAA,OAAO;;;IAGf,IACI,MAAM,KAAmD,OAAO,IAAI,CAAC,OAAO,CAAC;IACjF,IAAI,MAAM,CAAC,KAAmD,EAAA,EAAI,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAEzH,0BAA0B,GAAY,2BAA2B;;AAEjE,IAAA,IACI,yBAAyB,GAA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,CAAA;sBAAlB;gBAEQ,OAAO,EAAA,CAAA;sBAAf;gBAGQ,cAAc,EAAA,CAAA;sBAAtB;gBAEQ,iBAAiB,EAAA,CAAA;sBAAzB;gBAEQ,aAAa,EAAA,CAAA;sBAArB;gBAEQ,aAAa,EAAA,CAAA;sBAArB;;;AEjDH;;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.4",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@angular/common": "^19.0.0",
|
|
6
6
|
"@angular/core": "^19.0.0"
|
|
@@ -39,14 +39,18 @@
|
|
|
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
|
+
"./loading": {
|
|
47
|
+
"types": "./loading/index.d.ts",
|
|
48
|
+
"default": "./fesm2022/yoozsoft-yoozsoft-ng-loading.mjs"
|
|
49
|
+
},
|
|
50
|
+
"./file-upload": {
|
|
51
|
+
"types": "./file-upload/index.d.ts",
|
|
52
|
+
"default": "./fesm2022/yoozsoft-yoozsoft-ng-file-upload.mjs"
|
|
53
|
+
},
|
|
50
54
|
"./footer": {
|
|
51
55
|
"types": "./footer/index.d.ts",
|
|
52
56
|
"default": "./fesm2022/yoozsoft-yoozsoft-ng-footer.mjs"
|
|
@@ -55,10 +59,6 @@
|
|
|
55
59
|
"types": "./navbar/index.d.ts",
|
|
56
60
|
"default": "./fesm2022/yoozsoft-yoozsoft-ng-navbar.mjs"
|
|
57
61
|
},
|
|
58
|
-
"./loading": {
|
|
59
|
-
"types": "./loading/index.d.ts",
|
|
60
|
-
"default": "./fesm2022/yoozsoft-yoozsoft-ng-loading.mjs"
|
|
61
|
-
},
|
|
62
62
|
"./overlay": {
|
|
63
63
|
"types": "./overlay/index.d.ts",
|
|
64
64
|
"default": "./fesm2022/yoozsoft-yoozsoft-ng-overlay.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"
|
|
@@ -6,11 +6,11 @@ export declare class YsTiffViewerComponent {
|
|
|
6
6
|
private IFDs;
|
|
7
7
|
private currentIFDIndex;
|
|
8
8
|
isDecoding: boolean;
|
|
9
|
-
private _buffer
|
|
9
|
+
private _buffer;
|
|
10
10
|
/**Uint8Array source */
|
|
11
11
|
/**ArrayBuffer containing TIFF or EXIF data */
|
|
12
|
-
get buffer(): ArrayBuffer | File | Blob | undefined;
|
|
13
|
-
set buffer(value: ArrayBuffer | File | Blob | undefined);
|
|
12
|
+
get buffer(): ArrayBuffer | File | Blob | null | undefined;
|
|
13
|
+
set buffer(value: ArrayBuffer | File | Blob | null | undefined);
|
|
14
14
|
_currentPageReportTemplate?: string;
|
|
15
15
|
/**Current page report template */
|
|
16
16
|
get currentPageReportTemplate(): string | undefined;
|
|
@@ -35,7 +35,7 @@ export declare class YsTiffViewerComponent {
|
|
|
35
35
|
* @param buffer ArrayBuffer containing TIFF or EXIF data
|
|
36
36
|
* @returns
|
|
37
37
|
*/
|
|
38
|
-
convertSource(buffer: ArrayBuffer | File | Blob | undefined): Promise<void>;
|
|
38
|
+
convertSource(buffer: ArrayBuffer | File | Blob | null | undefined): Promise<void>;
|
|
39
39
|
putImage(index: number): void;
|
|
40
40
|
first(): void;
|
|
41
41
|
previous(): void;
|