@elderbyte/ngx-starter 15.7.0 → 15.7.2

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.
@@ -2,7 +2,7 @@ import { HttpClient } from '@angular/common/http';
2
2
  import { HttpDataTransfer } from '../transfer/http-data-transfer';
3
3
  import { ElderDataTransferService } from '../../../components/data-transfer/elder-data-transfer.service';
4
4
  export interface IFileUploadClient {
5
- uploadFiles(files: Set<File>): Map<File, HttpDataTransfer>;
5
+ uploadFiles(files: File[]): Map<File, HttpDataTransfer>;
6
6
  uploadFile(file: File): HttpDataTransfer;
7
7
  }
8
8
  export declare class FileUploadClient implements IFileUploadClient {
@@ -27,7 +27,7 @@ export declare class FileUploadClient implements IFileUploadClient {
27
27
  * Public API *
28
28
  * *
29
29
  **************************************************************************/
30
- uploadFiles(files: Set<File>): Map<File, HttpDataTransfer>;
30
+ uploadFiles(files: File[]): Map<File, HttpDataTransfer>;
31
31
  uploadFile(file: File): HttpDataTransfer;
32
32
  /***************************************************************************
33
33
  * *
@@ -1,4 +1,6 @@
1
1
  import { ElementRef, EventEmitter, OnDestroy, OnInit, Renderer2 } from '@angular/core';
2
+ import { BooleanInput } from '@angular/cdk/coercion';
3
+ import { FileEntry } from './listing/file-entry';
2
4
  import * as i0 from "@angular/core";
3
5
  export declare class ElderFileSelectDirective implements OnInit, OnDestroy {
4
6
  private el;
@@ -11,9 +13,10 @@ export declare class ElderFileSelectDirective implements OnInit, OnDestroy {
11
13
  private readonly logger;
12
14
  private _fileInput;
13
15
  private _unlisten;
14
- readonly elderFileSelectChange: EventEmitter<Set<File>>;
16
+ readonly elderFileSelectChange: EventEmitter<FileEntry[]>;
15
17
  readonly elderSingleFileSelectChange: EventEmitter<File>;
16
18
  private _multiple;
19
+ private _directory;
17
20
  private _accept;
18
21
  /***************************************************************************
19
22
  * *
@@ -34,7 +37,13 @@ export declare class ElderFileSelectDirective implements OnInit, OnDestroy {
34
37
  * *
35
38
  **************************************************************************/
36
39
  set elderFileSelect(value: string);
37
- set elderFileSelectMultiple(value: boolean);
40
+ set elderFileSelectMultiple(value: BooleanInput);
41
+ /**
42
+ * Allow the user to select a directory. All files that are recursively contained are selected.
43
+ * However, the user will no longer be able to select individual files if this is enabled.
44
+ * @param value
45
+ */
46
+ set elderFileSelectDirectory(value: BooleanInput);
38
47
  /***************************************************************************
39
48
  * *
40
49
  * Public API *
@@ -60,7 +69,7 @@ export declare class ElderFileSelectDirective implements OnInit, OnDestroy {
60
69
  private fileInputChanged;
61
70
  private clearFileList;
62
71
  private emitFileList;
63
- private toSet;
72
+ private toFileEntries;
64
73
  static ɵfac: i0.ɵɵFactoryDeclaration<ElderFileSelectDirective, never>;
65
- static ɵdir: i0.ɵɵDirectiveDeclaration<ElderFileSelectDirective, "[elderFileSelect]", never, { "elderFileSelect": "elderFileSelect"; "elderFileSelectMultiple": "elderFileSelectMultiple"; }, { "elderFileSelectChange": "elderFileSelectChange"; "elderSingleFileSelectChange": "elderSingleFileSelectChange"; }, never, never, false, never>;
74
+ static ɵdir: i0.ɵɵDirectiveDeclaration<ElderFileSelectDirective, "[elderFileSelect]", never, { "elderFileSelect": "elderFileSelect"; "elderFileSelectMultiple": "elderFileSelectMultiple"; "elderFileSelectDirectory": "elderFileSelectDirectory"; }, { "elderFileSelectChange": "elderFileSelectChange"; "elderSingleFileSelectChange": "elderSingleFileSelectChange"; }, never, never, false, never>;
66
75
  }
@@ -16,7 +16,6 @@ export { ElderFileSelectDirective } from './elder-file-select.directive';
16
16
  export { ElderFileDropZoneDirective } from './elder-file-drop-zone.directive';
17
17
  export { ElderBlobViewerComponent } from './blob-viewer/elder-blob-viewer.component';
18
18
  export * from './blob-url';
19
- export * from './file-proxy';
20
19
  export * from './listing/file-entry';
21
20
  export * from './listing/file-listing-rx';
22
21
  export declare class ElderFileModule {
@@ -1,4 +1,6 @@
1
1
  import { EventEmitter, OnInit } from '@angular/core';
2
+ import { FileEntry } from '../listing/file-entry';
3
+ import { ThemePalette } from '@angular/material/core';
2
4
  import * as i0 from "@angular/core";
3
5
  export declare class ElderFileSelectComponent implements OnInit {
4
6
  /***************************************************************************
@@ -9,8 +11,8 @@ export declare class ElderFileSelectComponent implements OnInit {
9
11
  multiple: boolean;
10
12
  accept: string;
11
13
  icon: string;
12
- color: string;
13
- readonly filesChange: EventEmitter<Set<File>>;
14
+ color: ThemePalette;
15
+ readonly filesChange: EventEmitter<FileEntry[]>;
14
16
  /***************************************************************************
15
17
  * *
16
18
  * Constructor *
@@ -28,7 +30,7 @@ export declare class ElderFileSelectComponent implements OnInit {
28
30
  * Public API *
29
31
  * *
30
32
  **************************************************************************/
31
- fileInputChanged(files: Set<File>): void;
33
+ fileInputChanged(files: FileEntry[]): void;
32
34
  static ɵfac: i0.ɵɵFactoryDeclaration<ElderFileSelectComponent, never>;
33
35
  static ɵcmp: i0.ɵɵComponentDeclaration<ElderFileSelectComponent, "elder-file-select", never, { "multiple": "multiple"; "accept": "accept"; "icon": "icon"; "color": "color"; }, { "filesChange": "filesChange"; }, never, never, false, never>;
34
36
  }
@@ -1,15 +1,15 @@
1
- import { OnInit } from '@angular/core';
2
1
  import { Observable } from 'rxjs';
3
2
  import { IFileUploadClient } from '../../../common/http/upload/file-upload-client';
4
3
  import { HttpDataTransfer } from '../../../common/http/transfer/http-data-transfer';
4
+ import { FileEntry } from '../listing/file-entry';
5
5
  import * as i0 from "@angular/core";
6
- export declare class ElderFileUploadComponent implements OnInit {
6
+ export declare class ElderFileUploadComponent {
7
7
  /***************************************************************************
8
8
  * *
9
9
  * Fields *
10
10
  * *
11
11
  **************************************************************************/
12
- files: Set<File>;
12
+ files: FileEntry[];
13
13
  uploadProgress: Map<File, HttpDataTransfer>;
14
14
  totalProgress: Observable<any>;
15
15
  multiple: boolean;
@@ -21,12 +21,6 @@ export declare class ElderFileUploadComponent implements OnInit {
21
21
  * *
22
22
  **************************************************************************/
23
23
  constructor();
24
- /***************************************************************************
25
- * *
26
- * Life Cycle *
27
- * *
28
- **************************************************************************/
29
- ngOnInit(): void;
30
24
  /***************************************************************************
31
25
  * *
32
26
  * Public API *
@@ -1,22 +1,51 @@
1
- import { FileProxy } from '../file-proxy';
2
- export declare class FileEntry extends FileProxy {
1
+ /**
2
+ * Represents a file and the relative path where the user has selected it.
3
+ * This is useful if the user has selected a folder and files
4
+ * are listed recursively.
5
+ */
6
+ export declare class FileEntry {
7
+ readonly file: File;
3
8
  /**
4
9
  * Contains the relative path from the selected folder
5
10
  * to this file. Only relevant if the user has selected a folder.
6
11
  */
7
12
  readonly relativeParent: string | null;
8
- constructor(file: File,
9
13
  /**
10
- * Contains the relative path from the selected folder
11
- * to this file. Only relevant if the user has selected a folder.
14
+ * Creates a file Entry without an explicit relative parent.
15
+ *
16
+ * However, depending how the file was selected, some browsers
17
+ * encode the relative parent path in the property 'webkitRelativePath'
18
+ * which is also supported by this method.
19
+ */
20
+ static ofFile(file: File): FileEntry;
21
+ /**
22
+ * Creates a file Entry with a relative parent path
12
23
  */
13
- relativeParent: string | null);
24
+ static relativeFile(file: File, relativeParent: string | null): FileEntry;
25
+ static toFileMap(entries: FileEntry[]): Map<File, FileEntry>;
26
+ static toFileArray(entries: FileEntry[]): File[];
27
+ /***************************************************************************
28
+ * *
29
+ * Fields *
30
+ * *
31
+ **************************************************************************/
14
32
  /**
15
33
  * Returns a string which specifies the file's path relative to the directory selected by the user.
16
34
  */
17
- get relativePath(): string;
35
+ readonly relativePath: string;
36
+ /***************************************************************************
37
+ * *
38
+ * Constructor *
39
+ * *
40
+ **************************************************************************/
41
+ private constructor();
42
+ /***************************************************************************
43
+ * *
44
+ * Private methods *
45
+ * *
46
+ **************************************************************************/
18
47
  /**
19
48
  * Returns a string which specifies the file's path relative to the directory selected by the user.
20
49
  */
21
- get webkitRelativePath(): string;
50
+ private static buildRelativePath;
22
51
  }
@@ -15,6 +15,7 @@ export declare class FileListingRx {
15
15
  **************************************************************************/
16
16
  private listFilesRecursiveAsync;
17
17
  private observableFile;
18
+ private trimStaringSlash;
18
19
  private readEntries;
19
20
  private consumeReaderToCompletion;
20
21
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elderbyte/ngx-starter",
3
- "version": "15.7.0",
3
+ "version": "15.7.2",
4
4
  "peerDependencies": {
5
5
  "@angular/core": "^15.0.0 || ^16.0.0",
6
6
  "@angular/common": "^15.0.0 || ^16.0.0",
@@ -1,41 +0,0 @@
1
- /**
2
- * Proxy the File API to an inner file instance,
3
- * allowing subclasses of the file proxy
4
- * to easily override selected behaviour.
5
- */
6
- export class FileProxy {
7
- constructor(inner) {
8
- this.inner = inner;
9
- }
10
- get lastModified() {
11
- return this.inner.lastModified;
12
- }
13
- get name() {
14
- return this.inner.name;
15
- }
16
- get size() {
17
- return this.inner.size;
18
- }
19
- get type() {
20
- return this.inner.type;
21
- }
22
- /**
23
- * Returns a string which specifies the file's path relative to the directory selected by the user
24
- */
25
- get webkitRelativePath() {
26
- return this.inner.webkitRelativePath;
27
- }
28
- arrayBuffer() {
29
- return this.inner.arrayBuffer();
30
- }
31
- slice(start, end, contentType) {
32
- return this.inner.slice(start, end, contentType);
33
- }
34
- stream() {
35
- return this.inner.stream();
36
- }
37
- text() {
38
- return this.inner.text();
39
- }
40
- }
41
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmlsZS1wcm94eS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL2VsZGVyYnl0ZS9uZ3gtc3RhcnRlci9zcmMvbGliL2NvbXBvbmVudHMvZmlsZXMvZmlsZS1wcm94eS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7OztHQUlHO0FBQ0gsTUFBTSxPQUFnQixTQUFTO0lBRTdCLFlBQ21CLEtBQVc7UUFBWCxVQUFLLEdBQUwsS0FBSyxDQUFNO0lBQzNCLENBQUM7SUFFS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bGljZShzdGFydCwgZW5kLCBjb250ZW50VHlwZSk7XG4gIH1cblxuICBzdHJlYW0oKTogUmVhZGFibGVTdHJlYW08VWludDhBcnJheT4ge1xuICAgIHJldHVybiB0aGlzLmlubmVyLnN0cmVhbSgpO1xuICB9XG5cbiAgdGV4dCgpOiBQcm9taXNlPHN0cmluZz4ge1xuICAgIHJldHVybiB0aGlzLmlubmVyLnRleHQoKTtcbiAgfVxufVxuIl19
@@ -1,21 +0,0 @@
1
- /**
2
- * Proxy the File API to an inner file instance,
3
- * allowing subclasses of the file proxy
4
- * to easily override selected behaviour.
5
- */
6
- export declare abstract class FileProxy implements File {
7
- private readonly inner;
8
- protected constructor(inner: File);
9
- get lastModified(): number;
10
- get name(): string;
11
- get size(): number;
12
- get type(): string;
13
- /**
14
- * Returns a string which specifies the file's path relative to the directory selected by the user
15
- */
16
- get webkitRelativePath(): string;
17
- arrayBuffer(): Promise<ArrayBuffer>;
18
- slice(start?: number, end?: number, contentType?: string): Blob;
19
- stream(): ReadableStream<Uint8Array>;
20
- text(): Promise<string>;
21
- }