@anglr/common 22.2.0-beta.20250331102048 → 22.2.0
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/changelog.md +8 -0
- package/es2022/src/modules/file/components/file/file.component.js +9 -2
- package/es2022/src/modules/file/components/file/file.component.js.map +1 -1
- package/package.json +1 -1
- package/src/modules/file/components/file/file.component.d.ts +9 -1
- package/src/modules/file/components/file/file.component.d.ts.map +1 -1
- package/src/modules/file/components/file/file.component.html +2 -1
- package/version.bak +1 -1
package/changelog.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## Version 22.2.0 (2025-03-31)
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
- updated `FileComponent` component
|
|
8
|
+
- **new inputs**
|
|
9
|
+
- `supportedExtensions` array of supported file extensions in form of '.extension'
|
|
10
|
+
|
|
3
11
|
## Version 22.1.0 (2025-03-04)
|
|
4
12
|
|
|
5
13
|
### Bug Fixes
|
|
@@ -55,6 +55,10 @@ export class FileComponent {
|
|
|
55
55
|
* Text encoding of read string file content
|
|
56
56
|
*/
|
|
57
57
|
this.textEncoding = input();
|
|
58
|
+
/**
|
|
59
|
+
* Array of supported file extensions in form of '.extension'
|
|
60
|
+
*/
|
|
61
|
+
this.supportedExtensions = input();
|
|
58
62
|
//######################### public properties - outputs #########################
|
|
59
63
|
/**
|
|
60
64
|
* Occurs when file changes and `binaryContent` is not set and `readContent` is set
|
|
@@ -80,6 +84,9 @@ export class FileComponent {
|
|
|
80
84
|
* Occurs when selected files changes, occurs only when `multiple` is set, contains names of selected files
|
|
81
85
|
*/
|
|
82
86
|
this.filesNames = output();
|
|
87
|
+
this.acceptValue = computed(() => {
|
|
88
|
+
return this.supportedExtensions()?.join(',');
|
|
89
|
+
});
|
|
83
90
|
effect(() => {
|
|
84
91
|
const fileVisual = this.fileVisual();
|
|
85
92
|
if (fileVisual) {
|
|
@@ -109,7 +116,7 @@ export class FileComponent {
|
|
|
109
116
|
});
|
|
110
117
|
}
|
|
111
118
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: FileComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
112
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.1.0", type: FileComponent, isStandalone: true, selector: "file", inputs: { multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, readContent: { classPropertyName: "readContent", publicName: "readContent", isSignal: true, isRequired: false, transformFunction: null }, binaryContent: { classPropertyName: "binaryContent", publicName: "binaryContent", isSignal: true, isRequired: false, transformFunction: null }, textEncoding: { classPropertyName: "textEncoding", publicName: "textEncoding", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { stringContentChange: "stringContentChange", arrayBufferContentChange: "arrayBufferContentChange", fileChange: "fileChange", filesChange: "filesChange", fileName: "fileName", filesNames: "filesNames" }, host: { listeners: { "click": "fileInput().openFileBrowser()" } }, queries: [{ propertyName: "fileTemplate", first: true, predicate: FileTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "fileVisual", first: true, predicate: FILE_VISUAL, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "fileInput", first: true, predicate: FileInputDirective, descendants: true, isSignal: true }], ngImport: i0, template: "<ng-container *ngTemplateOutlet=\"fileTemplate(); context: templateContext()\"/>\n\n<input type=\"file\"\n class=\"input-file\"\n (fileChange)=\"file.set($event); fileChange.emit($event)\"\n (filesChange)=\"files.set($event); filesChange.emit($event)\"\n (fileName)=\"name.set($event); fileName.emit($event)\"\n (filesNames)=\"names.set($event); filesNames.emit($event)\"\n (stringContentChange)=\"stringContentChange.emit($event)\"\n (arrayBufferContentChange)=\"arrayBufferContentChange.emit($event)\"\n [multiple]=\"multiple()\"\n [binaryContent]=\"binaryContent()\"\n [readContent]=\"readContent()\"\n [textEncoding]=\"textEncoding()\">", styles: [":host\n{\n display: block;\n position: relative;\n}\n\n.input-file\n{\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n cursor: pointer;\n opacity: 0;\n pointer-events: none;\n}"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: FileInputDirective, selector: "input[type=file]", inputs: ["multiple", "readContent", "binaryContent", "textEncoding"], outputs: ["stringContentChange", "arrayBufferContentChange", "fileChange", "filesChange", "fileName", "filesNames"], exportAs: ["file"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
119
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.1.0", type: FileComponent, isStandalone: true, selector: "file", inputs: { multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, readContent: { classPropertyName: "readContent", publicName: "readContent", isSignal: true, isRequired: false, transformFunction: null }, binaryContent: { classPropertyName: "binaryContent", publicName: "binaryContent", isSignal: true, isRequired: false, transformFunction: null }, textEncoding: { classPropertyName: "textEncoding", publicName: "textEncoding", isSignal: true, isRequired: false, transformFunction: null }, supportedExtensions: { classPropertyName: "supportedExtensions", publicName: "supportedExtensions", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { stringContentChange: "stringContentChange", arrayBufferContentChange: "arrayBufferContentChange", fileChange: "fileChange", filesChange: "filesChange", fileName: "fileName", filesNames: "filesNames" }, host: { listeners: { "click": "fileInput().openFileBrowser()" } }, queries: [{ propertyName: "fileTemplate", first: true, predicate: FileTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "fileVisual", first: true, predicate: FILE_VISUAL, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "fileInput", first: true, predicate: FileInputDirective, descendants: true, isSignal: true }], ngImport: i0, template: "<ng-container *ngTemplateOutlet=\"fileTemplate(); context: templateContext()\"/>\n\n<input type=\"file\"\n class=\"input-file\"\n (fileChange)=\"file.set($event); fileChange.emit($event)\"\n (filesChange)=\"files.set($event); filesChange.emit($event)\"\n (fileName)=\"name.set($event); fileName.emit($event)\"\n (filesNames)=\"names.set($event); filesNames.emit($event)\"\n (stringContentChange)=\"stringContentChange.emit($event)\"\n (arrayBufferContentChange)=\"arrayBufferContentChange.emit($event)\"\n [multiple]=\"multiple()\"\n [binaryContent]=\"binaryContent()\"\n [readContent]=\"readContent()\"\n [textEncoding]=\"textEncoding()\"\n [accept]=\"acceptValue()\">", styles: [":host\n{\n display: block;\n position: relative;\n}\n\n.input-file\n{\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n cursor: pointer;\n opacity: 0;\n pointer-events: none;\n}"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: FileInputDirective, selector: "input[type=file]", inputs: ["multiple", "readContent", "binaryContent", "textEncoding"], outputs: ["stringContentChange", "arrayBufferContentChange", "fileChange", "filesChange", "fileName", "filesNames"], exportAs: ["file"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
113
120
|
}
|
|
114
121
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: FileComponent, decorators: [{
|
|
115
122
|
type: Component,
|
|
@@ -118,6 +125,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImpor
|
|
|
118
125
|
}, imports: [
|
|
119
126
|
NgTemplateOutlet,
|
|
120
127
|
FileInputDirective,
|
|
121
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngTemplateOutlet=\"fileTemplate(); context: templateContext()\"/>\n\n<input type=\"file\"\n class=\"input-file\"\n (fileChange)=\"file.set($event); fileChange.emit($event)\"\n (filesChange)=\"files.set($event); filesChange.emit($event)\"\n (fileName)=\"name.set($event); fileName.emit($event)\"\n (filesNames)=\"names.set($event); filesNames.emit($event)\"\n (stringContentChange)=\"stringContentChange.emit($event)\"\n (arrayBufferContentChange)=\"arrayBufferContentChange.emit($event)\"\n [multiple]=\"multiple()\"\n [binaryContent]=\"binaryContent()\"\n [readContent]=\"readContent()\"\n [textEncoding]=\"textEncoding()\">", styles: [":host\n{\n display: block;\n position: relative;\n}\n\n.input-file\n{\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n cursor: pointer;\n opacity: 0;\n pointer-events: none;\n}"] }]
|
|
128
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngTemplateOutlet=\"fileTemplate(); context: templateContext()\"/>\n\n<input type=\"file\"\n class=\"input-file\"\n (fileChange)=\"file.set($event); fileChange.emit($event)\"\n (filesChange)=\"files.set($event); filesChange.emit($event)\"\n (fileName)=\"name.set($event); fileName.emit($event)\"\n (filesNames)=\"names.set($event); filesNames.emit($event)\"\n (stringContentChange)=\"stringContentChange.emit($event)\"\n (arrayBufferContentChange)=\"arrayBufferContentChange.emit($event)\"\n [multiple]=\"multiple()\"\n [binaryContent]=\"binaryContent()\"\n [readContent]=\"readContent()\"\n [textEncoding]=\"textEncoding()\"\n [accept]=\"acceptValue()\">", styles: [":host\n{\n display: block;\n position: relative;\n}\n\n.input-file\n{\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n cursor: pointer;\n opacity: 0;\n pointer-events: none;\n}"] }]
|
|
122
129
|
}], ctorParameters: () => [] });
|
|
123
130
|
//# sourceMappingURL=file.component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file.component.js","sourceRoot":"","sources":["../../../../../../src/modules/file/components/file/file.component.ts","../../../../../../src/modules/file/components/file/file.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,YAAY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9B,eAAe,EAAE,SAAS,CAAC,eAAe;gBAC1C,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE;gBACrB,UAAU,EAAE,IAAI,CAAC,KAAK,EAAE;gBACxB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE;aAC5B,CAAC;QACN,CAAC,CAAC,CAAC;IACP,CAAC;8GA1IQ,aAAa;kGAAb,aAAa,s7BAkCmE,qBAAqB,2BAAS,WAAW,0EAU3D,WAAW,2GALb,kBAAkB,gECjE3F,osBAauC,mSDQ/B,gBAAgB,oJAChB,kBAAkB;;2FAIb,aAAa;kBAhBzB,SAAS;+BAEI,MAAM,QAIhB;wBACI,SAAS,EAAE,+BAA+B;qBAC7C,WAED;wBACI,gBAAgB;wBAChB,kBAAkB;qBACrB,mBACgB,uBAAuB,CAAC,MAAM","sourcesContent":["import {Component, ChangeDetectionStrategy, contentChild, Signal, TemplateRef, viewChild, computed, WritableSignal, signal, InputSignalWithTransform, input, booleanAttribute, InputSignal, OutputEmitterRef, output, effect} from '@angular/core';\nimport {NgTemplateOutlet} from '@angular/common';\n\nimport {FileInputDirective, FileTemplateContext, FileTemplateDirective} from '../../directive';\nimport {FILE_VISUAL} from '../../misc/tokens';\nimport {FileVisual} from '../../interfaces';\n\n/**\n * Component used for obtaining file contents from disk\n */\n@Component(\n{\n selector: 'file',\n templateUrl: 'file.component.html',\n styleUrl: 'file.component.css',\n host:\n {\n '(click)': 'fileInput().openFileBrowser()',\n },\n imports:\n [\n NgTemplateOutlet,\n FileInputDirective,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class FileComponent\n{\n //######################### protected properties - template bindings #########################\n\n /**\n * Instance of context for file template\n */\n protected templateContext: Signal<FileTemplateContext>;\n\n /**\n * Holds current value of file for file input\n */\n protected file: WritableSignal<File|null|undefined> = signal(null);\n\n /**\n * Holds current value of files for file input\n */\n protected files: WritableSignal<File[]|null|undefined> = signal(null);\n\n /**\n * Holds current value of file name for file input\n */\n protected name: WritableSignal<string|null|undefined> = signal(null);\n\n /**\n * Holds current value of files names for file input\n */\n protected names: WritableSignal<string[]|null|undefined> = signal(null);\n\n //######################### protected properties - children #########################\n\n /**\n * Instance template to be displayed as file input\n */\n protected fileTemplate: Signal<TemplateRef<FileTemplateContext>> = contentChild.required(FileTemplateDirective, {read: TemplateRef<FileTemplateContext>});\n\n /**\n * Contains file input directive instance\n */\n protected fileInput: Signal<FileInputDirective> = viewChild.required(FileInputDirective);\n\n /**\n * Instance of file visual implementation if available\n */\n protected fileVisual: Signal<FileVisual|undefined|null> = contentChild(FILE_VISUAL);\n\n //######################### public properties - inputs #########################\n\n /**\n * Indication whether is multiple files selection enabled\n */\n public multiple: InputSignalWithTransform<boolean, string|boolean> = input<boolean, boolean|string>(false, {transform: booleanAttribute});\n\n /**\n * Indication whether read file content, working only when `multiple` is not set (for single file)\n */\n public readContent: InputSignalWithTransform<boolean, string|boolean> = input<boolean, boolean|string>(false, {transform: booleanAttribute});\n\n /**\n * Indication whether content of file is binary and it will be read as ArrayBuffer instead of string\n */\n public binaryContent: InputSignalWithTransform<boolean, string|boolean> = input<boolean, boolean|string>(false, {transform: booleanAttribute});\n\n /**\n * Text encoding of read string file content\n */\n public textEncoding: InputSignal<string|undefined> = input();\n\n //######################### public properties - outputs #########################\n\n /**\n * Occurs when file changes and `binaryContent` is not set and `readContent` is set\n */\n public stringContentChange: OutputEmitterRef<string|undefined|null> = output<string|undefined|null>();\n\n /**\n * Occurs when file changes and `binaryContent` is set and `readContent` is set\n */\n public arrayBufferContentChange: OutputEmitterRef<ArrayBuffer|undefined|null> = output<ArrayBuffer|undefined|null>();\n\n /**\n * Occurs when selected file changes, occurs only when `multiple` is not set\n */\n public fileChange: OutputEmitterRef<File|null|undefined> = output<File|undefined|null>();\n\n /**\n * Occurs when selected files changes, occurs only when `multiple` is set\n */\n public filesChange: OutputEmitterRef<File[]|null|undefined> = output<File[]|undefined|null>();\n\n /**\n * Occurs when selected file changes, occurs only when `multiple` is not set, contains name of selected file\n */\n public fileName: OutputEmitterRef<string|null|undefined> = output<string|undefined|null>();\n\n /**\n * Occurs when selected files changes, occurs only when `multiple` is set, contains names of selected files\n */\n public filesNames: OutputEmitterRef<string[]|null|undefined> = output<string[]|undefined|null>();\n\n //######################### constructor #########################\n constructor()\n {\n effect(() =>\n {\n const fileVisual = this.fileVisual();\n\n if(fileVisual)\n {\n const fileInput = this.fileInput();\n\n fileVisual.fileTemplateContext.set(\n {\n file: this.file(),\n files: this.files(),\n clearFile: fileInput.clearFile,\n openFileBrowser: fileInput.openFileBrowser,\n fileName: this.name(),\n filesNames: this.names(),\n multiple: this.multiple(),\n });\n }\n }, {allowSignalWrites: true});\n\n this.templateContext = computed(() =>\n {\n const fileInput = this.fileInput();\n\n return {\n file: this.file(),\n files: this.files(),\n clearFile: fileInput.clearFile,\n openFileBrowser: fileInput.openFileBrowser,\n fileName: this.name(),\n filesNames: this.names(),\n multiple: this.multiple(),\n };\n });\n }\n}\n","<ng-container *ngTemplateOutlet=\"fileTemplate(); context: templateContext()\"/>\n\n<input type=\"file\"\n class=\"input-file\"\n (fileChange)=\"file.set($event); fileChange.emit($event)\"\n (filesChange)=\"files.set($event); filesChange.emit($event)\"\n (fileName)=\"name.set($event); fileName.emit($event)\"\n (filesNames)=\"names.set($event); filesNames.emit($event)\"\n (stringContentChange)=\"stringContentChange.emit($event)\"\n (arrayBufferContentChange)=\"arrayBufferContentChange.emit($event)\"\n [multiple]=\"multiple()\"\n [binaryContent]=\"binaryContent()\"\n [readContent]=\"readContent()\"\n [textEncoding]=\"textEncoding()\">"]}
|
|
1
|
+
{"version":3,"file":"file.component.js","sourceRoot":"","sources":["../../../../../../src/modules/file/components/file/file.component.ts","../../../../../../src/modules/file/components/file/file.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,YAAY,EAAU,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAkB,MAAM,EAA4B,KAAK,EAAE,gBAAgB,EAAiC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H,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE;gBACjB,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE;gBACnB,SAAS,EAAE,SAAS,CAAC,SAAS;gBAC9B,eAAe,EAAE,SAAS,CAAC,eAAe;gBAC1C,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE;gBACrB,UAAU,EAAE,IAAI,CAAC,KAAK,EAAE;gBACxB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE;aAC5B,CAAC;QACN,CAAC,CAAC,CAAC;IACP,CAAC;8GAzJQ,aAAa;kGAAb,aAAa,wlCAuCmE,qBAAqB,2BAAS,WAAW,0EAU3D,WAAW,2GALb,kBAAkB,gECtE3F,uuBAcgC,mSDOxB,gBAAgB,oJAChB,kBAAkB;;2FAIb,aAAa;kBAhBzB,SAAS;+BAEI,MAAM,QAIhB;wBACI,SAAS,EAAE,+BAA+B;qBAC7C,WAED;wBACI,gBAAgB;wBAChB,kBAAkB;qBACrB,mBACgB,uBAAuB,CAAC,MAAM","sourcesContent":["import {Component, ChangeDetectionStrategy, contentChild, Signal, TemplateRef, viewChild, computed, WritableSignal, signal, InputSignalWithTransform, input, booleanAttribute, InputSignal, OutputEmitterRef, output, effect} from '@angular/core';\nimport {NgTemplateOutlet} from '@angular/common';\n\nimport {FileInputDirective, FileTemplateContext, FileTemplateDirective} from '../../directive';\nimport {FILE_VISUAL} from '../../misc/tokens';\nimport {FileVisual} from '../../interfaces';\n\n/**\n * Component used for obtaining file contents from disk\n */\n@Component(\n{\n selector: 'file',\n templateUrl: 'file.component.html',\n styleUrl: 'file.component.css',\n host:\n {\n '(click)': 'fileInput().openFileBrowser()',\n },\n imports:\n [\n NgTemplateOutlet,\n FileInputDirective,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class FileComponent\n{\n //######################### protected properties - template bindings #########################\n\n /**\n * Instance of context for file template\n */\n protected templateContext: Signal<FileTemplateContext>;\n\n /**\n * Holds current value of file for file input\n */\n protected file: WritableSignal<File|null|undefined> = signal(null);\n\n /**\n * Holds current value of files for file input\n */\n protected files: WritableSignal<File[]|null|undefined> = signal(null);\n\n /**\n * Holds current value of file name for file input\n */\n protected name: WritableSignal<string|null|undefined> = signal(null);\n\n /**\n * Holds current value of files names for file input\n */\n protected names: WritableSignal<string[]|null|undefined> = signal(null);\n\n /**\n * Computed accept value\n */\n protected acceptValue: Signal<string|null|undefined>;\n\n //######################### protected properties - children #########################\n\n /**\n * Instance template to be displayed as file input\n */\n protected fileTemplate: Signal<TemplateRef<FileTemplateContext>> = contentChild.required(FileTemplateDirective, {read: TemplateRef<FileTemplateContext>});\n\n /**\n * Contains file input directive instance\n */\n protected fileInput: Signal<FileInputDirective> = viewChild.required(FileInputDirective);\n\n /**\n * Instance of file visual implementation if available\n */\n protected fileVisual: Signal<FileVisual|undefined|null> = contentChild(FILE_VISUAL);\n\n //######################### public properties - inputs #########################\n\n /**\n * Indication whether is multiple files selection enabled\n */\n public multiple: InputSignalWithTransform<boolean, string|boolean> = input<boolean, boolean|string>(false, {transform: booleanAttribute});\n\n /**\n * Indication whether read file content, working only when `multiple` is not set (for single file)\n */\n public readContent: InputSignalWithTransform<boolean, string|boolean> = input<boolean, boolean|string>(false, {transform: booleanAttribute});\n\n /**\n * Indication whether content of file is binary and it will be read as ArrayBuffer instead of string\n */\n public binaryContent: InputSignalWithTransform<boolean, string|boolean> = input<boolean, boolean|string>(false, {transform: booleanAttribute});\n\n /**\n * Text encoding of read string file content\n */\n public textEncoding: InputSignal<string|undefined> = input();\n\n /**\n * Array of supported file extensions in form of '.extension'\n */\n public supportedExtensions: InputSignal<string[]|undefined|null> = input();\n\n //######################### public properties - outputs #########################\n\n /**\n * Occurs when file changes and `binaryContent` is not set and `readContent` is set\n */\n public stringContentChange: OutputEmitterRef<string|undefined|null> = output<string|undefined|null>();\n\n /**\n * Occurs when file changes and `binaryContent` is set and `readContent` is set\n */\n public arrayBufferContentChange: OutputEmitterRef<ArrayBuffer|undefined|null> = output<ArrayBuffer|undefined|null>();\n\n /**\n * Occurs when selected file changes, occurs only when `multiple` is not set\n */\n public fileChange: OutputEmitterRef<File|null|undefined> = output<File|undefined|null>();\n\n /**\n * Occurs when selected files changes, occurs only when `multiple` is set\n */\n public filesChange: OutputEmitterRef<File[]|null|undefined> = output<File[]|undefined|null>();\n\n /**\n * Occurs when selected file changes, occurs only when `multiple` is not set, contains name of selected file\n */\n public fileName: OutputEmitterRef<string|null|undefined> = output<string|undefined|null>();\n\n /**\n * Occurs when selected files changes, occurs only when `multiple` is set, contains names of selected files\n */\n public filesNames: OutputEmitterRef<string[]|null|undefined> = output<string[]|undefined|null>();\n\n //######################### constructor #########################\n constructor()\n {\n this.acceptValue = computed(() =>\n {\n return this.supportedExtensions()?.join(',');\n });\n\n effect(() =>\n {\n const fileVisual = this.fileVisual();\n\n if(fileVisual)\n {\n const fileInput = this.fileInput();\n\n fileVisual.fileTemplateContext.set(\n {\n file: this.file(),\n files: this.files(),\n clearFile: fileInput.clearFile,\n openFileBrowser: fileInput.openFileBrowser,\n fileName: this.name(),\n filesNames: this.names(),\n multiple: this.multiple(),\n });\n }\n }, {allowSignalWrites: true});\n\n this.templateContext = computed(() =>\n {\n const fileInput = this.fileInput();\n\n return {\n file: this.file(),\n files: this.files(),\n clearFile: fileInput.clearFile,\n openFileBrowser: fileInput.openFileBrowser,\n fileName: this.name(),\n filesNames: this.names(),\n multiple: this.multiple(),\n };\n });\n }\n}\n","<ng-container *ngTemplateOutlet=\"fileTemplate(); context: templateContext()\"/>\n\n<input type=\"file\"\n class=\"input-file\"\n (fileChange)=\"file.set($event); fileChange.emit($event)\"\n (filesChange)=\"files.set($event); filesChange.emit($event)\"\n (fileName)=\"name.set($event); fileName.emit($event)\"\n (filesNames)=\"names.set($event); filesNames.emit($event)\"\n (stringContentChange)=\"stringContentChange.emit($event)\"\n (arrayBufferContentChange)=\"arrayBufferContentChange.emit($event)\"\n [multiple]=\"multiple()\"\n [binaryContent]=\"binaryContent()\"\n [readContent]=\"readContent()\"\n [textEncoding]=\"textEncoding()\"\n [accept]=\"acceptValue()\">"]}
|
package/package.json
CHANGED
|
@@ -26,6 +26,10 @@ export declare class FileComponent {
|
|
|
26
26
|
* Holds current value of files names for file input
|
|
27
27
|
*/
|
|
28
28
|
protected names: WritableSignal<string[] | null | undefined>;
|
|
29
|
+
/**
|
|
30
|
+
* Computed accept value
|
|
31
|
+
*/
|
|
32
|
+
protected acceptValue: Signal<string | null | undefined>;
|
|
29
33
|
/**
|
|
30
34
|
* Instance template to be displayed as file input
|
|
31
35
|
*/
|
|
@@ -54,6 +58,10 @@ export declare class FileComponent {
|
|
|
54
58
|
* Text encoding of read string file content
|
|
55
59
|
*/
|
|
56
60
|
textEncoding: InputSignal<string | undefined>;
|
|
61
|
+
/**
|
|
62
|
+
* Array of supported file extensions in form of '.extension'
|
|
63
|
+
*/
|
|
64
|
+
supportedExtensions: InputSignal<string[] | undefined | null>;
|
|
57
65
|
/**
|
|
58
66
|
* Occurs when file changes and `binaryContent` is not set and `readContent` is set
|
|
59
67
|
*/
|
|
@@ -80,6 +88,6 @@ export declare class FileComponent {
|
|
|
80
88
|
filesNames: OutputEmitterRef<string[] | null | undefined>;
|
|
81
89
|
constructor();
|
|
82
90
|
static ɵfac: i0.ɵɵFactoryDeclaration<FileComponent, never>;
|
|
83
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<FileComponent, "file", never, { "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; "readContent": { "alias": "readContent"; "required": false; "isSignal": true; }; "binaryContent": { "alias": "binaryContent"; "required": false; "isSignal": true; }; "textEncoding": { "alias": "textEncoding"; "required": false; "isSignal": true; }; }, { "stringContentChange": "stringContentChange"; "arrayBufferContentChange": "arrayBufferContentChange"; "fileChange": "fileChange"; "filesChange": "filesChange"; "fileName": "fileName"; "filesNames": "filesNames"; }, ["fileTemplate", "fileVisual"], never, true, never>;
|
|
91
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<FileComponent, "file", never, { "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; "readContent": { "alias": "readContent"; "required": false; "isSignal": true; }; "binaryContent": { "alias": "binaryContent"; "required": false; "isSignal": true; }; "textEncoding": { "alias": "textEncoding"; "required": false; "isSignal": true; }; "supportedExtensions": { "alias": "supportedExtensions"; "required": false; "isSignal": true; }; }, { "stringContentChange": "stringContentChange"; "arrayBufferContentChange": "arrayBufferContentChange"; "fileChange": "fileChange"; "filesChange": "filesChange"; "fileName": "fileName"; "filesNames": "filesNames"; }, ["fileTemplate", "fileVisual"], never, true, never>;
|
|
84
92
|
}
|
|
85
93
|
//# sourceMappingURL=file.component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file.component.d.ts","sourceRoot":"","sources":["file.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmD,MAAM,EAAE,WAAW,EAAuB,cAAc,EAAU,wBAAwB,EAA2B,WAAW,EAAE,gBAAgB,EAAiB,MAAM,eAAe,CAAC;AAGnP,OAAO,EAAC,kBAAkB,EAAE,mBAAmB,EAAwB,MAAM,iBAAiB,CAAC;AAE/F,OAAO,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;;AAE5C;;GAEG;AACH,qBAgBa,aAAa;IAItB;;OAEG;IACH,SAAS,CAAC,eAAe,EAAE,MAAM,CAAC,mBAAmB,CAAC,CAAC;IAEvD;;OAEG;IACH,SAAS,CAAC,IAAI,EAAE,cAAc,CAAC,IAAI,GAAC,IAAI,GAAC,SAAS,CAAC,CAAgB;IAEnE;;OAEG;IACH,SAAS,CAAC,KAAK,EAAE,cAAc,CAAC,IAAI,EAAE,GAAC,IAAI,GAAC,SAAS,CAAC,CAAgB;IAEtE;;OAEG;IACH,SAAS,CAAC,IAAI,EAAE,cAAc,CAAC,MAAM,GAAC,IAAI,GAAC,SAAS,CAAC,CAAgB;IAErE;;OAEG;IACH,SAAS,CAAC,KAAK,EAAE,cAAc,CAAC,MAAM,EAAE,GAAC,IAAI,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