Skip to content

EspoCRM – Open Source CRM Application

TS migration

Yurii98a5b62376fd
diff --git a/client/src/views/fields/attachment-multiple.ts b/client/src/views/fields/attachment-multiple.ts
index 6bc0497d1b..093f17725a 100644
--- a/client/src/views/fields/attachment-multiple.ts
+++ b/client/src/views/fields/attachment-multiple.ts
@@ -32,6 +32,7 @@ import AttachmentInsertSourceFromHelper from 'helpers/misc/attachment-insert-fro
import Utils from 'utils';
import View from 'view';
import Model from 'model';
+import {PreviewSize} from 'views/fields/file';
export interface AttachmentMultipleParams extends BaseParams {
/**
@@ -71,8 +72,6 @@ export interface AttachmentMultipleOptions extends BaseOptions {
previewSize?: PreviewSize
}
-type PreviewSize = 'x-small' | 'small' | 'medium' | 'large';
-
/**
* An attachment-multiple field.
*/
diff --git a/client/src/views/fields/file.ts b/client/src/views/fields/file.ts
index 9b4be37ed4..2364f612cd 100644
--- a/client/src/views/fields/file.ts
+++ b/client/src/views/fields/file.ts
@@ -32,9 +32,8 @@ import AttachmentInsertSourceFromHelper from 'helpers/misc/attachment-insert-fro
import {BaseViewSchema, FieldValidator} from 'views/fields/base';
import View from 'view';
import Model from 'model';
-import {fa} from 'cronstrue/dist/i18n/locales/fa';
-interface FileParams extends LinkParams {
+export interface FileParams extends LinkParams {
/**
* Required.
*/
@@ -72,7 +71,7 @@ export interface FileOptions extends LinkOptions {
previewSize?: PreviewSize
}
-type PreviewSize = 'x-small' | 'small' | 'medium' | 'large';
+export type PreviewSize = 'x-small' | 'small' | 'medium' | 'large';
/**
* A file field.
diff --git a/client/src/views/fields/image.js b/client/src/views/fields/image.ts
similarity index 72%
rename from client/src/views/fields/image.js
rename to client/src/views/fields/image.ts
index efdbae8d72..ba33c10fe0 100644
--- a/client/src/views/fields/image.js
+++ b/client/src/views/fields/image.ts
@@ -26,16 +26,24 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
-import FileFieldView from 'views/fields/file';
+import FileFieldView, {FileOptions, FileParams, PreviewSize} from 'views/fields/file';
+import {BaseViewSchema} from 'views/fields/base';
-class ImageFieldView extends FileFieldView {
+class ImageFieldView<
+ S extends BaseViewSchema = BaseViewSchema,
+ O extends FileOptions = FileOptions,
+ P extends FileParams = FileParams
+> extends FileFieldView<S, O, P> {
- type = 'image'
+ readonly type: string = 'image'
- showPreview = true
- accept = ['image/*']
- defaultType = 'image/jpeg'
- previewSize = 'small'
+ protected showPreview: boolean = true
+
+ protected accept = ['image/*']
+
+ protected defaultType = 'image/jpeg'
+
+ protected previewSize: PreviewSize = 'small'
}
export default ImageFieldView;