@elderbyte/ngx-starter 15.7.0 → 15.7.1
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/common/http/upload/file-upload-client.mjs +1 -1
- package/esm2020/lib/components/files/elder-file-select.directive.mjs +35 -13
- package/esm2020/lib/components/files/file-select/file-select.component.mjs +2 -2
- package/esm2020/lib/components/files/file-upload/file-upload.component.mjs +4 -11
- package/fesm2015/elderbyte-ngx-starter.mjs +37 -23
- package/fesm2015/elderbyte-ngx-starter.mjs.map +1 -1
- package/fesm2020/elderbyte-ngx-starter.mjs +37 -23
- package/fesm2020/elderbyte-ngx-starter.mjs.map +1 -1
- package/lib/common/http/upload/file-upload-client.d.ts +2 -2
- package/lib/components/files/elder-file-select.directive.d.ts +12 -4
- package/lib/components/files/file-select/file-select.component.d.ts +2 -2
- package/lib/components/files/file-upload/file-upload.component.d.ts +2 -9
- package/package.json +1 -1
|
@@ -9604,11 +9604,23 @@ class ElderFileSelectDirective {
|
|
|
9604
9604
|
}
|
|
9605
9605
|
}
|
|
9606
9606
|
set elderFileSelectMultiple(value) {
|
|
9607
|
-
this._multiple = value;
|
|
9607
|
+
this._multiple = coerceBooleanProperty(value);
|
|
9608
9608
|
if (this._fileInput) {
|
|
9609
9609
|
this.renderer.setProperty(this._fileInput, 'multiple', value);
|
|
9610
9610
|
}
|
|
9611
9611
|
}
|
|
9612
|
+
/**
|
|
9613
|
+
* Allow the user to select a directory. All files that are recursively contained are selected.
|
|
9614
|
+
* However, the user will no longer be able to select individual files if this is enabled.
|
|
9615
|
+
* @param value
|
|
9616
|
+
*/
|
|
9617
|
+
set elderFileSelectDirectory(value) {
|
|
9618
|
+
this._directory = coerceBooleanProperty(value);
|
|
9619
|
+
if (this._fileInput) {
|
|
9620
|
+
this.renderer.setAttribute(this._fileInput, 'webkitdirectory', 'true');
|
|
9621
|
+
this.renderer.setAttribute(this._fileInput, 'directory', 'true');
|
|
9622
|
+
}
|
|
9623
|
+
}
|
|
9612
9624
|
/***************************************************************************
|
|
9613
9625
|
* *
|
|
9614
9626
|
* Public API *
|
|
@@ -9644,6 +9656,10 @@ class ElderFileSelectDirective {
|
|
|
9644
9656
|
if (this._multiple) {
|
|
9645
9657
|
this.renderer.setProperty(this._fileInput, 'multiple', this._multiple);
|
|
9646
9658
|
}
|
|
9659
|
+
if (this._directory) {
|
|
9660
|
+
this.renderer.setAttribute(this._fileInput, 'webkitdirectory', 'true');
|
|
9661
|
+
this.renderer.setAttribute(this._fileInput, 'directory', 'true');
|
|
9662
|
+
}
|
|
9647
9663
|
this._unlisten = this.renderer.listen(this._fileInput, 'change', event => this.fileInputChanged(event));
|
|
9648
9664
|
}
|
|
9649
9665
|
removeFileSelect() {
|
|
@@ -9658,33 +9674,36 @@ class ElderFileSelectDirective {
|
|
|
9658
9674
|
}
|
|
9659
9675
|
fileInputChanged(event) {
|
|
9660
9676
|
const fileList = this._fileInput.files;
|
|
9661
|
-
this.
|
|
9677
|
+
const files = this.toArray(fileList);
|
|
9678
|
+
this.logger.debug('fileInputChanged, files:', files);
|
|
9679
|
+
this.emitFileList(files);
|
|
9662
9680
|
this.clearFileList();
|
|
9663
9681
|
}
|
|
9664
9682
|
clearFileList() {
|
|
9665
9683
|
// not nice but works
|
|
9666
9684
|
this._fileInput.value = null;
|
|
9667
9685
|
}
|
|
9668
|
-
emitFileList(
|
|
9669
|
-
if (
|
|
9670
|
-
this.elderFileSelectChange.next(
|
|
9671
|
-
|
|
9672
|
-
|
|
9673
|
-
|
|
9686
|
+
emitFileList(files) {
|
|
9687
|
+
if (files.length > 0) {
|
|
9688
|
+
this.elderFileSelectChange.next(files);
|
|
9689
|
+
this.elderSingleFileSelectChange.emit(files[0]);
|
|
9690
|
+
}
|
|
9691
|
+
else {
|
|
9692
|
+
this.logger.warn('User did not select any File or the Folder was empty.');
|
|
9674
9693
|
}
|
|
9675
9694
|
}
|
|
9676
|
-
|
|
9677
|
-
const files =
|
|
9695
|
+
toArray(fileList) {
|
|
9696
|
+
const files = [];
|
|
9678
9697
|
for (const key in fileList) {
|
|
9679
9698
|
if (!isNaN(parseInt(key, 0))) {
|
|
9680
|
-
files.
|
|
9699
|
+
files.push(fileList[key]);
|
|
9681
9700
|
}
|
|
9682
9701
|
}
|
|
9683
9702
|
return files;
|
|
9684
9703
|
}
|
|
9685
9704
|
}
|
|
9686
9705
|
ElderFileSelectDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: ElderFileSelectDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
|
|
9687
|
-
ElderFileSelectDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.0", type: ElderFileSelectDirective, selector: "[elderFileSelect]", inputs: { elderFileSelect: "elderFileSelect", elderFileSelectMultiple: "elderFileSelectMultiple" }, outputs: { elderFileSelectChange: "elderFileSelectChange", elderSingleFileSelectChange: "elderSingleFileSelectChange" }, host: { listeners: { "click": "onClick($event)" } }, ngImport: i0 });
|
|
9706
|
+
ElderFileSelectDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.0", type: ElderFileSelectDirective, selector: "[elderFileSelect]", inputs: { elderFileSelect: "elderFileSelect", elderFileSelectMultiple: "elderFileSelectMultiple", elderFileSelectDirectory: "elderFileSelectDirectory" }, outputs: { elderFileSelectChange: "elderFileSelectChange", elderSingleFileSelectChange: "elderSingleFileSelectChange" }, host: { listeners: { "click": "onClick($event)" } }, ngImport: i0 });
|
|
9688
9707
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: ElderFileSelectDirective, decorators: [{
|
|
9689
9708
|
type: Directive,
|
|
9690
9709
|
args: [{
|
|
@@ -9698,6 +9717,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.0", ngImpor
|
|
|
9698
9717
|
type: Input
|
|
9699
9718
|
}], elderFileSelectMultiple: [{
|
|
9700
9719
|
type: Input
|
|
9720
|
+
}], elderFileSelectDirectory: [{
|
|
9721
|
+
type: Input
|
|
9701
9722
|
}], onClick: [{
|
|
9702
9723
|
type: HostListener,
|
|
9703
9724
|
args: ['click', ['$event']]
|
|
@@ -9737,7 +9758,7 @@ class ElderFileSelectComponent {
|
|
|
9737
9758
|
}
|
|
9738
9759
|
}
|
|
9739
9760
|
ElderFileSelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: ElderFileSelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
9740
|
-
ElderFileSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.0", type: ElderFileSelectComponent, selector: "elder-file-select", inputs: { multiple: "multiple", accept: "accept", icon: "icon", color: "color" }, outputs: { filesChange: "filesChange" }, ngImport: i0, template: "\n\n<button mat-icon-button type=\"button\"\n [elderFileSelect]=\"accept\"\n [elderFileSelectMultiple]=\"multiple\"\n (elderFileSelectChange)=\"fileInputChanged($event)\"\n>\n <mat-icon [color]=\"color\">{{icon}}</mat-icon>\n</button>\n", styles: [""], dependencies: [{ kind: "component", type: i5$2.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i3$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: ElderFileSelectDirective, selector: "[elderFileSelect]", inputs: ["elderFileSelect", "elderFileSelectMultiple"], outputs: ["elderFileSelectChange", "elderSingleFileSelectChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
9761
|
+
ElderFileSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.0", type: ElderFileSelectComponent, selector: "elder-file-select", inputs: { multiple: "multiple", accept: "accept", icon: "icon", color: "color" }, outputs: { filesChange: "filesChange" }, ngImport: i0, template: "\n\n<button mat-icon-button type=\"button\"\n [elderFileSelect]=\"accept\"\n [elderFileSelectMultiple]=\"multiple\"\n (elderFileSelectChange)=\"fileInputChanged($event)\"\n>\n <mat-icon [color]=\"color\">{{icon}}</mat-icon>\n</button>\n", styles: [""], dependencies: [{ kind: "component", type: i5$2.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i3$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: ElderFileSelectDirective, selector: "[elderFileSelect]", inputs: ["elderFileSelect", "elderFileSelectMultiple", "elderFileSelectDirectory"], outputs: ["elderFileSelectChange", "elderSingleFileSelectChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
9741
9762
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: ElderFileSelectComponent, decorators: [{
|
|
9742
9763
|
type: Component,
|
|
9743
9764
|
args: [{ selector: 'elder-file-select', changeDetection: ChangeDetectionStrategy.OnPush, template: "\n\n<button mat-icon-button type=\"button\"\n [elderFileSelect]=\"accept\"\n [elderFileSelectMultiple]=\"multiple\"\n (elderFileSelectChange)=\"fileInputChanged($event)\"\n>\n <mat-icon [color]=\"color\">{{icon}}</mat-icon>\n</button>\n" }]
|
|
@@ -9765,17 +9786,10 @@ class ElderFileUploadComponent {
|
|
|
9765
9786
|
* Fields *
|
|
9766
9787
|
* *
|
|
9767
9788
|
**************************************************************************/
|
|
9768
|
-
this.files =
|
|
9789
|
+
this.files = [];
|
|
9769
9790
|
this.multiple = false;
|
|
9770
9791
|
this.accept = undefined;
|
|
9771
9792
|
}
|
|
9772
|
-
/***************************************************************************
|
|
9773
|
-
* *
|
|
9774
|
-
* Life Cycle *
|
|
9775
|
-
* *
|
|
9776
|
-
**************************************************************************/
|
|
9777
|
-
ngOnInit() {
|
|
9778
|
-
}
|
|
9779
9793
|
/***************************************************************************
|
|
9780
9794
|
* *
|
|
9781
9795
|
* Public API *
|
|
@@ -9801,10 +9815,10 @@ class ElderFileUploadComponent {
|
|
|
9801
9815
|
}
|
|
9802
9816
|
}
|
|
9803
9817
|
ElderFileUploadComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: ElderFileUploadComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
9804
|
-
ElderFileUploadComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.0", type: ElderFileUploadComponent, selector: "elder-file-upload", inputs: { files: "files", multiple: "multiple", accept: "accept", uploadClient: "uploadClient" }, ngImport: i0, template: "\n\n<div class=\"layout-col\">\n\n <div class=\"layout-row gap-md\">\n\n <button mat-icon-button type=\"button\" color=\"primary\"\n *ngIf=\"uploadClient\" (click)=\"startUpload($event)\" [disabled]=\"files.
|
|
9818
|
+
ElderFileUploadComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.0", type: ElderFileUploadComponent, selector: "elder-file-upload", inputs: { files: "files", multiple: "multiple", accept: "accept", uploadClient: "uploadClient" }, ngImport: i0, template: "\n\n<div class=\"layout-col\">\n\n <div class=\"layout-row gap-md\">\n\n <button mat-icon-button type=\"button\" color=\"primary\"\n *ngIf=\"uploadClient\" (click)=\"startUpload($event)\" [disabled]=\"files.length === 0\">\n <mat-icon>cloud_upload</mat-icon>\n </button>\n\n <elder-file-select\n [multiple]=\"multiple\"\n [accept]=\"accept\"\n (filesChange)=\"files = $event\"\n ></elder-file-select>\n\n </div>\n\n <mat-list>\n <h2 mat-subheader>Selected Files ({{files.length}})</h2>\n <mat-list-item *ngFor=\"let file of files\">\n <mat-icon mat-list-icon>attach_file</mat-icon>\n <h4 mat-line>{{file.name}}</h4>\n <p mat-line> {{file.size | bytes}} - {{file.lastModified | timeAgo}}</p>\n\n <mat-progress-bar *ngIf=\"(transferOf(file)?.state$ | async) as state\"\n [color]=\"(state.hasFailed ? 'warn' : undefined)\"\n mode=\"determinate\"\n [value]=\"state.progress.percentDone\">\n </mat-progress-bar>\n\n </mat-list-item>\n </mat-list>\n\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: i1$4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2$2.MatList, selector: "mat-list", exportAs: ["matList"] }, { kind: "component", type: i2$2.MatListItem, selector: "mat-list-item, a[mat-list-item], button[mat-list-item]", inputs: ["activated"], exportAs: ["matListItem"] }, { kind: "directive", type: i2$2.MatListSubheaderCssMatStyler, selector: "[mat-subheader], [matSubheader]" }, { kind: "component", type: i5$2.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i3$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i5$3.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "component", type: ElderFileSelectComponent, selector: "elder-file-select", inputs: ["multiple", "accept", "icon", "color"], outputs: ["filesChange"] }, { kind: "pipe", type: i1$4.AsyncPipe, name: "async" }, { kind: "pipe", type: BytesPipe, name: "bytes" }, { kind: "pipe", type: TimeAgoPipe, name: "timeAgo" }] });
|
|
9805
9819
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: ElderFileUploadComponent, decorators: [{
|
|
9806
9820
|
type: Component,
|
|
9807
|
-
args: [{ selector: 'elder-file-upload', template: "\n\n<div class=\"layout-col\">\n\n <div class=\"layout-row gap-md\">\n\n <button mat-icon-button type=\"button\" color=\"primary\"\n *ngIf=\"uploadClient\" (click)=\"startUpload($event)\" [disabled]=\"files.
|
|
9821
|
+
args: [{ selector: 'elder-file-upload', template: "\n\n<div class=\"layout-col\">\n\n <div class=\"layout-row gap-md\">\n\n <button mat-icon-button type=\"button\" color=\"primary\"\n *ngIf=\"uploadClient\" (click)=\"startUpload($event)\" [disabled]=\"files.length === 0\">\n <mat-icon>cloud_upload</mat-icon>\n </button>\n\n <elder-file-select\n [multiple]=\"multiple\"\n [accept]=\"accept\"\n (filesChange)=\"files = $event\"\n ></elder-file-select>\n\n </div>\n\n <mat-list>\n <h2 mat-subheader>Selected Files ({{files.length}})</h2>\n <mat-list-item *ngFor=\"let file of files\">\n <mat-icon mat-list-icon>attach_file</mat-icon>\n <h4 mat-line>{{file.name}}</h4>\n <p mat-line> {{file.size | bytes}} - {{file.lastModified | timeAgo}}</p>\n\n <mat-progress-bar *ngIf=\"(transferOf(file)?.state$ | async) as state\"\n [color]=\"(state.hasFailed ? 'warn' : undefined)\"\n mode=\"determinate\"\n [value]=\"state.progress.percentDone\">\n </mat-progress-bar>\n\n </mat-list-item>\n </mat-list>\n\n</div>\n" }]
|
|
9808
9822
|
}], ctorParameters: function () { return []; }, propDecorators: { files: [{
|
|
9809
9823
|
type: Input
|
|
9810
9824
|
}], multiple: [{
|