All files / lib/dynamic-form-input/dynamic-form-file dynamic-form-file.ts

100% Statements 5/5
100% Branches 0/0
100% Functions 5/5
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31          19x   18x 9x 16x   3x                                      
import { DynamicFormActionDefinition } from '../../dynamic-form-action/dynamic-form-action-definition';
import { DynamicFormControlTemplate } from '../../dynamic-form-control/dynamic-form-control-template';
import { DynamicFormInput, DynamicFormInputControl, DynamicFormInputDefinition } from '../dynamic-form-input';
 
export class DynamicFormFileUpload {
  constructor(readonly file: File) {}
 
  get name(): string { return this.file.name; }
  get type(): string { return this.file.type; }
  get size(): number { return this.file.size; }
 
  toJSON(): any { return { name: this.name, type: this.type, size: this.size }; }
}
 
export type DynamicFormFileValue = DynamicFormFileUpload | DynamicFormFileUpload[];
 
export interface DynamicFormFile extends DynamicFormInput<DynamicFormFileValue> {
  type: 'file';
  accept?: string;
  multiple?: boolean;
  maxFileSize?: number;
}
 
export type DynamicFormFileTemplate = DynamicFormControlTemplate<DynamicFormFileValue, DynamicFormFile>;
 
export interface DynamicFormFileDefinition extends DynamicFormInputDefinition<DynamicFormFile> {
  uploadActionDefinition?: DynamicFormActionDefinition;
}
 
export class DynamicFormFileControl extends DynamicFormInputControl<DynamicFormFile> {}