From 47c98d1faf8857ebb39353b6fa97189e736d070f Mon Sep 17 00:00:00 2001 From: Yurii Date: Mon, 18 May 2026 18:08:13 +0300 Subject: [PATCH] Image capture parameter --- application/Espo/Resources/i18n/en_US/Admin.json | 5 +++++ .../Espo/Resources/i18n/en_US/FieldManager.json | 1 + application/Espo/Resources/metadata/fields/image.json | 10 ++++++++++ client/res/templates/fields/file/edit.tpl | 1 + client/src/views/fields/file.ts | 7 +++++++ 5 files changed, 24 insertions(+) diff --git a/application/Espo/Resources/i18n/en_US/Admin.json b/application/Espo/Resources/i18n/en_US/Admin.json index 3445e2b05d..3673891783 100644 --- a/application/Espo/Resources/i18n/en_US/Admin.json +++ b/application/Espo/Resources/i18n/en_US/Admin.json @@ -215,6 +215,7 @@ "preview": "Preview", "attachmentField": "Attachment Field", "maxFileSize": "Max File Size (Mb)", + "capture": "Capture", "isPersonalData": "Is Personal Data", "useIframe": "Use Iframe", "useNumericFormat": "Use Numeric Format", @@ -359,6 +360,10 @@ "labelType": { "state": "State", "regular": "Regular" + }, + "capture": { + "user": "User", + "environment": "Environment" } }, "logicalOperators": { diff --git a/application/Espo/Resources/i18n/en_US/FieldManager.json b/application/Espo/Resources/i18n/en_US/FieldManager.json index f64fbc458a..ffea314d14 100644 --- a/application/Espo/Resources/i18n/en_US/FieldManager.json +++ b/application/Espo/Resources/i18n/en_US/FieldManager.json @@ -82,6 +82,7 @@ } }, "tooltips": { + "imageCapture": "Specifies which camera to use for capture of image data.", "optionsReference": "Re-use options from another field.", "currencyDecimal": "Use the Decimal DB type. In the app, values will be represented as strings. Check this parameter if precision is required.", "cutHeight": "A text higher then a specified value will be cut with a 'show more' button displayed.", diff --git a/application/Espo/Resources/metadata/fields/image.json b/application/Espo/Resources/metadata/fields/image.json index 68709fe0d7..787476535a 100644 --- a/application/Espo/Resources/metadata/fields/image.json +++ b/application/Espo/Resources/metadata/fields/image.json @@ -32,6 +32,16 @@ "tooltip": true, "min": 0 }, + { + "name": "capture", + "type": "enum", + "options": [ + "", + "user", + "environment" + ], + "tooltip": "imageCapture" + }, { "name": "readOnly", "type": "bool" diff --git a/client/res/templates/fields/file/edit.tpl b/client/res/templates/fields/file/edit.tpl index a29befabef..272254689e 100644 --- a/client/res/templates/fields/file/edit.tpl +++ b/client/res/templates/fields/file/edit.tpl @@ -7,6 +7,7 @@ type="file" class="file pull-right" {{#if acceptAttribute}}accept="{{acceptAttribute}}"{{/if}} + {{#if capture}} capture="{{capture}}" {{/if}} tabindex="-1" > diff --git a/client/src/views/fields/file.ts b/client/src/views/fields/file.ts index 2364f612cd..b8c6565f80 100644 --- a/client/src/views/fields/file.ts +++ b/client/src/views/fields/file.ts @@ -62,6 +62,12 @@ export interface FileParams extends LinkParams { * A max file size (in Mb). */ maxFileSize?: number; + /** + * Specifies which camera to use for capture of image data. + * + * @since 10.0.0 + */ + capture?: null | 'user' | 'environment'; } export interface FileOptions extends LinkOptions { @@ -128,6 +134,7 @@ class FileFieldView< ...super.data(), id: this.model.get(this.idName), acceptAttribute: this.acceptAttribute, + capture: this.params.capture, } as any; if (this.mode === this.MODE_EDIT) {