@acorex/components 6.5.9 → 6.5.10
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/esm2020/lib/upload-file/upload-file.component.mjs +40 -5
- package/fesm2015/acorex-components.mjs +39 -4
- package/fesm2015/acorex-components.mjs.map +1 -1
- package/fesm2020/acorex-components.mjs +39 -4
- package/fesm2020/acorex-components.mjs.map +1 -1
- package/lib/upload-file/upload-file.component.d.ts +4 -1
- package/package.json +1 -1
|
@@ -15637,11 +15637,38 @@ class AXUploadFileComponent extends AXBaseComponent {
|
|
|
15637
15637
|
this.injectionService = injectionService;
|
|
15638
15638
|
this.rendrer = rendrer;
|
|
15639
15639
|
this.cdr = cdr;
|
|
15640
|
+
this.contentType = 'image';
|
|
15640
15641
|
this.size = "md";
|
|
15641
15642
|
this.type = 'inline';
|
|
15642
15643
|
this.disabled = false;
|
|
15643
15644
|
this.onLoad = new EventEmitter();
|
|
15644
15645
|
this.onProgress = new EventEmitter();
|
|
15646
|
+
this.fileTypes = [
|
|
15647
|
+
{
|
|
15648
|
+
type: 'image',
|
|
15649
|
+
accept: ['image/gif', 'image/jpeg', 'image/png'],
|
|
15650
|
+
},
|
|
15651
|
+
{
|
|
15652
|
+
type: 'audio',
|
|
15653
|
+
accept: ['audio/mp3'],
|
|
15654
|
+
},
|
|
15655
|
+
{
|
|
15656
|
+
type: 'ebook',
|
|
15657
|
+
accept: ['application/pdf'],
|
|
15658
|
+
},
|
|
15659
|
+
{
|
|
15660
|
+
type: 'excel',
|
|
15661
|
+
accept: ['application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'],
|
|
15662
|
+
},
|
|
15663
|
+
{
|
|
15664
|
+
type: 'video',
|
|
15665
|
+
accept: ['video/*'],
|
|
15666
|
+
},
|
|
15667
|
+
{
|
|
15668
|
+
type: 'video/image',
|
|
15669
|
+
accept: ['image/gif', 'image/jpeg', 'image/png', 'video/*'],
|
|
15670
|
+
},
|
|
15671
|
+
];
|
|
15645
15672
|
this.files = [];
|
|
15646
15673
|
this.fileName = '';
|
|
15647
15674
|
}
|
|
@@ -15655,10 +15682,13 @@ class AXUploadFileComponent extends AXBaseComponent {
|
|
|
15655
15682
|
this.fileInput.nativeElement.value = null;
|
|
15656
15683
|
}
|
|
15657
15684
|
open() {
|
|
15658
|
-
this.fileInput.nativeElement.click();
|
|
15685
|
+
this.fileInput.nativeElement.click({ accept: this.accessTypes });
|
|
15659
15686
|
}
|
|
15660
15687
|
remove() {
|
|
15688
|
+
this.fileInput.nativeElement.value = '';
|
|
15661
15689
|
this.files = [];
|
|
15690
|
+
this.fileName = null;
|
|
15691
|
+
this.cdr.detectChanges();
|
|
15662
15692
|
}
|
|
15663
15693
|
ngAfterViewInit() {
|
|
15664
15694
|
if (this.dropRef != null) {
|
|
@@ -15761,13 +15791,18 @@ class AXUploadFileComponent extends AXBaseComponent {
|
|
|
15761
15791
|
reader.readAsDataURL(file);
|
|
15762
15792
|
this.files.push(file);
|
|
15763
15793
|
}
|
|
15794
|
+
get accessTypes() {
|
|
15795
|
+
return this.fileTypes.find((item) => item.type == this.contentType).accept;
|
|
15796
|
+
}
|
|
15764
15797
|
}
|
|
15765
15798
|
AXUploadFileComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXUploadFileComponent, deps: [{ token: i0.ElementRef }, { token: i1$2.AXRenderService }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
15766
|
-
AXUploadFileComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: AXUploadFileComponent, selector: "ax-upload-file", inputs: { dropRef: "dropRef", progressRef: "progressRef", label: "label", size: "size", type: "type", template: "template", disabled: "disabled" }, outputs: { onLoad: "onLoad", onProgress: "onProgress" }, host: { styleAttribute: "display: block; width:100%; position: relative" }, viewQueries: [{ propertyName: "fileInput", first: true, predicate: ["fileInput"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<input #fileInput type=\"file\" accept=\"
|
|
15799
|
+
AXUploadFileComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: AXUploadFileComponent, selector: "ax-upload-file", inputs: { contentType: "contentType", dropRef: "dropRef", progressRef: "progressRef", label: "label", size: "size", type: "type", template: "template", disabled: "disabled" }, outputs: { onLoad: "onLoad", onProgress: "onProgress" }, host: { styleAttribute: "display: block; width:100%; position: relative" }, viewQueries: [{ propertyName: "fileInput", first: true, predicate: ["fileInput"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<input #fileInput type=\"file\" [accept]=\"accessTypes.join(',')\" style=\"display: none;\" (change)=\"onFileChange($event)\" />\r\n\r\n<ng-container *ngIf=\"type == 'inline'; else elseTemplate\">\r\n <ax-form-group size=\"{{size}}\">\r\n <ax-text-box [value]=\"fileName\" readonly=\"true\" [disabled]=\"disabled\"></ax-text-box>\r\n <ax-button type=\"blank light\" icon=\"far fa-times\" (click)=\"remove()\" *ngIf=\"fileName\" [tabIndex]=\"-1\">\r\n </ax-button>\r\n <ax-button type=\"primary blank\" icon=\"far fa-upload\" (click)=\"open()\" [disabled]=\"disabled\" [tabIndex]=\"-1\">\r\n </ax-button>\r\n </ax-form-group>\r\n</ng-container>\r\n\r\n<ng-template #elseTemplate>\r\n <div class=\"ax upload-file-box\" (click)=\"open()\" #dropRef>\r\n </div>\r\n</ng-template>\r\n", components: [{ type: AXFormGroupComponent, selector: "ax-form-group", inputs: ["size"] }, { type: AXTextBoxComponent, selector: "ax-text-box", inputs: ["mask", "type", "showMask", "maxLength", "maskGuid", "maskPlaceholder", "maskKeepCharPositions"] }, { type: AXButtonComponent, selector: "ax-button", inputs: ["type", "icon", "submitBehavior", "cancelBehavior", "block", "loading", "selected"] }], directives: [{ type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], encapsulation: i0.ViewEncapsulation.None });
|
|
15767
15800
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXUploadFileComponent, decorators: [{
|
|
15768
15801
|
type: Component,
|
|
15769
|
-
args: [{ selector: 'ax-upload-file', encapsulation: ViewEncapsulation.None, host: { style: 'display: block; width:100%; position: relative' }, template: "<input #fileInput type=\"file\" accept=\"
|
|
15770
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1$2.AXRenderService }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }]; }, propDecorators: {
|
|
15802
|
+
args: [{ selector: 'ax-upload-file', encapsulation: ViewEncapsulation.None, host: { style: 'display: block; width:100%; position: relative' }, template: "<input #fileInput type=\"file\" [accept]=\"accessTypes.join(',')\" style=\"display: none;\" (change)=\"onFileChange($event)\" />\r\n\r\n<ng-container *ngIf=\"type == 'inline'; else elseTemplate\">\r\n <ax-form-group size=\"{{size}}\">\r\n <ax-text-box [value]=\"fileName\" readonly=\"true\" [disabled]=\"disabled\"></ax-text-box>\r\n <ax-button type=\"blank light\" icon=\"far fa-times\" (click)=\"remove()\" *ngIf=\"fileName\" [tabIndex]=\"-1\">\r\n </ax-button>\r\n <ax-button type=\"primary blank\" icon=\"far fa-upload\" (click)=\"open()\" [disabled]=\"disabled\" [tabIndex]=\"-1\">\r\n </ax-button>\r\n </ax-form-group>\r\n</ng-container>\r\n\r\n<ng-template #elseTemplate>\r\n <div class=\"ax upload-file-box\" (click)=\"open()\" #dropRef>\r\n </div>\r\n</ng-template>\r\n" }]
|
|
15803
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1$2.AXRenderService }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { contentType: [{
|
|
15804
|
+
type: Input
|
|
15805
|
+
}], dropRef: [{
|
|
15771
15806
|
type: Input
|
|
15772
15807
|
}], progressRef: [{
|
|
15773
15808
|
type: Input
|