Skip to content

EspoCRM – Open Source CRM Application

style from options reference

Yuri Kuznetsov62c7af7b3873
diff --git a/client/res/templates/fields/enum/edit.tpl b/client/res/templates/fields/enum/edit.tpl
index 091fc201f2..5b1b2e4511 100644
--- a/client/res/templates/fields/enum/edit.tpl
+++ b/client/res/templates/fields/enum/edit.tpl
@@ -5,6 +5,6 @@
field=name
translatedOptions=translatedOptions
includeMissingOption=true
- styleMap=params.style
+ styleMap=styleMap
}}
</select>
diff --git a/client/src/views/fields/array.js b/client/src/views/fields/array.js
index 9dc8e544ae..5d05937739 100644
--- a/client/src/views/fields/array.js
+++ b/client/src/views/fields/array.js
@@ -176,6 +176,8 @@ class ArrayFieldView extends BaseFieldView {
this.selected = [];
}
+ this.styleMap = this.params.style || {};
+
let optionsPath = this.params.optionsPath;
/** @type {?string} */
const optionsReference = this.params.optionsReference;
@@ -184,14 +186,16 @@ class ArrayFieldView extends BaseFieldView {
const [refEntityType, refField] = optionsReference.split('.');
optionsPath = `entityDefs.${refEntityType}.fields.${refField}.options`;
+
+ if (Object.keys(this.styleMap).length === 0) {
+ this.styleMap = this.getMetadata().get(`entityDefs.${refEntityType}.fields.${refField}.style`) || {};
+ }
}
if (optionsPath) {
this.params.options = Espo.Utils.clone(this.getMetadata().get(optionsPath)) || [];
}
- this.styleMap = this.params.style || {};
-
this.setupOptions();
if ('translatedOptions' in this.options) {
diff --git a/client/src/views/fields/enum.js b/client/src/views/fields/enum.js
index 5892c07ce8..1537ffa87d 100644
--- a/client/src/views/fields/enum.js
+++ b/client/src/views/fields/enum.js
@@ -110,6 +110,8 @@ class EnumFieldView extends BaseFieldView {
data.style = this.styleMap[value || ''] || 'default';
}
+ data.styleMap = this.styleMap;
+
if (this.isReadMode()) {
if (!this.params.displayAsLabel) {
data.class = 'text';
@@ -160,6 +162,8 @@ class EnumFieldView extends BaseFieldView {
}
}
+ this.styleMap = this.params.style || this.model.getFieldParam(this.name, 'style') || {};
+
let optionsPath = this.params.optionsPath;
/** @type {?string} */
const optionsReference = this.params.optionsReference;
@@ -168,14 +172,16 @@ class EnumFieldView extends BaseFieldView {
const [refEntityType, refField] = optionsReference.split('.');
optionsPath = `entityDefs.${refEntityType}.fields.${refField}.options`;
+
+ if (Object.keys(this.styleMap).length === 0) {
+ this.styleMap = this.getMetadata().get(`entityDefs.${refEntityType}.fields.${refField}.style`) || {};
+ }
}
if (optionsPath) {
this.params.options = Espo.Utils.clone(this.getMetadata().get(optionsPath)) || [];
}
- this.styleMap = this.params.style || this.model.getFieldParam(this.name, 'style') || {};
-
this.setupOptions();
if ('translatedOptions' in this.options) {