Fix/input file types (#2021)

* fix: lion-selected-filelist, restored composed: true and bubbles: true for 'file-remove-requested' event, otherwise removing files for subclassers won't work

* chore: exported correct types for lion-input-file

* fix: fixed type errors
This commit is contained in:
Danny Moerkerke 2023-06-22 10:48:49 +02:00 committed by GitHub
parent 91b582d8c9
commit 0745ce8526
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 9 deletions

View file

@ -427,13 +427,15 @@ export class LionInputFile extends ScopedElementsMixin(LocalizeMixin(LionField))
// eslint-disable-next-line no-param-reassign
file.validationFeedback = [
{
type: response.errorMessage?.length > 0 ? 'error' : 'success',
message: response.errorMessage,
type:
typeof response.errorMessage === 'string' && response.errorMessage?.length > 0
? 'error'
: 'success',
message: response.errorMessage ?? '',
},
];
}
});
// this._selectedFilesMetaData = [...this._selectedFilesMetaData];
}
});
}

View file

@ -1,6 +1,6 @@
import { FeedbackMessage } from "../../form-core/types/validate/ValidateMixinTypes.js";
type FileBasics = {
export type FileBasics = {
name: string;
/** size in bytes */
size: number;
@ -10,7 +10,7 @@ type FileBasics = {
export type InputFile = {
downloadUrl?: string;
errorMessage?: FeedbackMessage.message;
errorMessage?: FeedbackMessage["message"];
failedProp?: Array<string|number>;
response?: UploadResponse;
systemFile: Partial<SystemFile>;
@ -19,7 +19,7 @@ export type InputFile = {
export type SystemFile = {
downloadUrl?: string;
errorMessage?: FeedbackMessage.message;
errorMessage?: FeedbackMessage["message"];
failedProp?: Array<string|number>;
response?: UploadResponse;
} & FileBasics & Partial<File>;
@ -27,6 +27,6 @@ export type SystemFile = {
export type UploadResponse = {
downloadUrl?: string;
errorMessage?: FeedbackMessage.message;
errorMessage?: FeedbackMessage["message"];
id?: string;
} & Partial<FileBasics>;

View file

@ -14,5 +14,4 @@ export { FormRegistrarHost } from '../../components/form-core/types/registration
export { ElementWithParentFormGroup } from '../../components/form-core/types/registration/FormRegistrarMixinTypes.js';
export { FormRegistrarPortalHost } from '../../components/form-core/types/registration/FormRegistrarPortalMixinTypes.js';
export { SyncUpdatableHost } from '../../components/form-core/types/utils/SyncUpdatableMixinTypes.js';
export { ValidateHost } from '../../components/form-core/types/validate/ValidateMixinTypes.js';
export { ValidationType } from '../../components/form-core/types/validate/ValidateMixinTypes.js';
export { ValidateHost, ValidationType, FeedbackMessage } from '../../components/form-core/types/validate/ValidateMixinTypes.js';

View file

@ -0,0 +1 @@
export { InputFile, SystemFile } from '../../components/input-file/types/input-file.js'