diff --git a/client/src/views/fields/currency-converted.js b/client/src/views/fields/currency-converted.js
index 48f57545e6..3ca5c271b1 100644
--- a/client/src/views/fields/currency-converted.js
+++ b/client/src/views/fields/currency-converted.js
@@ -26,23 +26,20 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
-import Dep from 'views/fields/currency';
+import CurrencyFieldView from 'views/fields/currency';
-/**
- * @class Class
- * @extends module:views/fields/currency
- */
-export default Dep.extend(/** @lends Class# */{
+class CurrencyConvertedFieldView extends CurrencyFieldView {
- data: function () {
- let currencyValue = this.getConfig().get('defaultCurrency');
+ data() {
+ let data = super.data();
- let data = Dep.prototype.data.call(this);
+ const currencyValue = this.getConfig().get('defaultCurrency');
data.currencyValue = currencyValue;
- data.currencySymbol = this.getMetadata()
- .get(['app', 'currency', 'symbolMap', currencyValue]) || '';
+ data.currencySymbol = this.getMetadata().get(['app', 'currency', 'symbolMap', currencyValue]) || '';
return data;
- },
-});
+ }
+}
+
+export default CurrencyConvertedFieldView;
diff --git a/client/src/views/fields/foreign-array.js b/client/src/views/fields/foreign-array.js
index d7d689de22..2c4980995a 100644
--- a/client/src/views/fields/foreign-array.js
+++ b/client/src/views/fields/foreign-array.js
@@ -26,50 +26,51 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
-define('views/fields/foreign-array', ['views/fields/array'], function (Dep) {
+import ArrayFieldView from 'views/fields/array';
- return Dep.extend({
+class ForeignArrayFieldView extends ArrayFieldView {
- type: 'foreign',
+ type = 'foreign'
- setupOptions: function () {
- this.params.options = [];
+ setupOptions() {
+ this.params.options = [];
- let field = this.params.field;
- let link = this.params.link;
+ let field = this.params.field;
+ let link = this.params.link;
- if (!field || !link) {
- return;
- }
+ if (!field || !link) {
+ return;
+ }
- let scope = this.getMetadata().get(['entityDefs', this.model.entityType, 'links', link, 'entity']);
+ let scope = this.getMetadata().get(['entityDefs', this.model.entityType, 'links', link, 'entity']);
- if (!scope) {
- return;
- }
+ if (!scope) {
+ return;
+ }
- let {
- optionsPath,
- translation,
- options,
- isSorted,
- displayAsLabel,
- style,
- } = this.getMetadata()
- .get(['entityDefs', scope, 'fields', field]);
+ let {
+ optionsPath,
+ translation,
+ options,
+ isSorted,
+ displayAsLabel,
+ style,
+ } = this.getMetadata()
+ .get(['entityDefs', scope, 'fields', field]);
- options = optionsPath ? this.getMetadata().get(optionsPath) : options;
+ options = optionsPath ? this.getMetadata().get(optionsPath) : options;
- this.params.options = Espo.Utils.clone(options) || [];
- this.params.translation = translation;
- this.params.isSorted = isSorted || false;
- this.params.displayAsLabel = displayAsLabel || false;
- this.styleMap = style || {};
+ this.params.options = Espo.Utils.clone(options) || [];
+ this.params.translation = translation;
+ this.params.isSorted = isSorted || false;
+ this.params.displayAsLabel = displayAsLabel || false;
+ this.styleMap = style || {};
- this.translatedOptions = Object.fromEntries(
- this.params.options
- .map(item => [item, this.getLanguage().translateOption(item, field, scope)])
- );
- },
- });
-});
+ this.translatedOptions = Object.fromEntries(
+ this.params.options
+ .map(item => [item, this.getLanguage().translateOption(item, field, scope)])
+ );
+ }
+}
+
+export default ForeignArrayFieldView;
diff --git a/client/src/views/fields/foreign-bool.js b/client/src/views/fields/foreign-bool.js
index b1504d0059..1dbab99a0a 100644
--- a/client/src/views/fields/foreign-bool.js
+++ b/client/src/views/fields/foreign-bool.js
@@ -26,23 +26,24 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
-define('views/fields/foreign-bool', ['views/fields/bool', 'helpers/misc/foreign-field'], function (Dep, Helper) {
+import BoolFieldView from 'views/fields/bool';
+import Helper from 'helpers/misc/foreign-field';
- return Dep.extend({
+class ForeignBoolFieldView extends BoolFieldView {
- type: 'foreign',
+ type = 'foreign'
- setup: function () {
- Dep.prototype.setup.call(this);
+ setup() {
+ super.setup();
- /** @var {module:helpers/misc/foreign-field} */
- let helper = new Helper(this);
+ let helper = new Helper(this);
- let foreignParams = helper.getForeignParams();
+ let foreignParams = helper.getForeignParams();
- for (let param in foreignParams) {
- this.params[param] = foreignParams[param];
- }
- },
- });
-});
+ for (let param in foreignParams) {
+ this.params[param] = foreignParams[param];
+ }
+ }
+}
+
+export default ForeignBoolFieldView;
diff --git a/client/src/views/fields/foreign-checklist.js b/client/src/views/fields/foreign-checklist.js
index 9fb08649cd..3a2528b292 100644
--- a/client/src/views/fields/foreign-checklist.js
+++ b/client/src/views/fields/foreign-checklist.js
@@ -26,38 +26,39 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
-define('views/fields/foreign-checklist', ['views/fields/checklist'], function (Dep) {
+import ChecklistFieldView from 'views/fields/checklist';
- return Dep.extend({
+class ForeignChecklistFieldView extends ChecklistFieldView {
- type: 'foreign',
+ type = 'foreign'
- setupOptions: function () {
- this.params.options = [];
+ setupOptions() {
+ this.params.options = [];
- if (!this.params.field || !this.params.link) {
- return;
- }
+ if (!this.params.field || !this.params.link) {
+ return;
+ }
- var scope = this.getMetadata()
- .get(['entityDefs', this.model.entityType, 'links', this.params.link, 'entity']);
+ const scope = this.getMetadata()
+ .get(['entityDefs', this.model.entityType, 'links', this.params.link, 'entity']);
- if (!scope) {
- return;
- }
+ if (!scope) {
+ return;
+ }
- this.params.isSorted = this.getMetadata()
- .get(['entityDefs', scope, 'fields', this.params.field, 'isSorted']) || false;
+ this.params.isSorted = this.getMetadata()
+ .get(['entityDefs', scope, 'fields', this.params.field, 'isSorted']) || false;
- this.params.options = this.getMetadata()
- .get(['entityDefs', scope, 'fields', this.params.field, 'options']) || [];
+ this.params.options = this.getMetadata()
+ .get(['entityDefs', scope, 'fields', this.params.field, 'options']) || [];
- this.translatedOptions = {};
+ this.translatedOptions = {};
- this.params.options.forEach(item => {
- this.translatedOptions[item] = this.getLanguage()
- .translateOption(item, this.params.field, scope);
- });
- },
- });
-});
+ this.params.options.forEach(item => {
+ this.translatedOptions[item] = this.getLanguage()
+ .translateOption(item, this.params.field, scope);
+ });
+ }
+}
+
+export default ForeignChecklistFieldView;
diff --git a/client/src/views/fields/foreign-currency-converted.js b/client/src/views/fields/foreign-currency-converted.js
index 071cb922cb..01a800ec2e 100644
--- a/client/src/views/fields/foreign-currency-converted.js
+++ b/client/src/views/fields/foreign-currency-converted.js
@@ -26,10 +26,11 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
-define('views/fields/foreign-currency-converted', ['views/fields/currency-converted'], function (Dep) {
+import CurrencyConvertedFieldView from 'views/fields/currency-converted';
- return Dep.extend({
+class ForeignCurrencyConvertedFieldView extends CurrencyConvertedFieldView {
- type: 'foreign',
- });
-});
+ type = 'foreign'
+}
+
+export default ForeignCurrencyConvertedFieldView;
diff --git a/client/src/views/fields/foreign-date.js b/client/src/views/fields/foreign-date.js
index 6a9f9ef746..8a3a0a4202 100644
--- a/client/src/views/fields/foreign-date.js
+++ b/client/src/views/fields/foreign-date.js
@@ -26,24 +26,24 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
-define('views/fields/foreign-date', ['views/fields/date', 'helpers/misc/foreign-field'], function (Dep, Helper) {
+import DateFieldView from 'views/fields/date';
+import Helper from 'helpers/misc/foreign-field';
- return Dep.extend({
+class ForeignDateFieldView extends DateFieldView {
- type: 'foreign',
+ type = 'foreign'
- setup: function () {
- Dep.prototype.setup.call(this);
+ setup() {
+ super.setup();
- /** @var {module:helpers/misc/foreign-field} */
- let helper = new Helper(this);
+ const helper = new Helper(this);
- let foreignParams = helper.getForeignParams();
+ const foreignParams = helper.getForeignParams();
- for (let param in foreignParams) {
- this.params[param] = foreignParams[param];
- }
- },
- });
-});
+ for (let param in foreignParams) {
+ this.params[param] = foreignParams[param];
+ }
+ }
+}
+export default ForeignDateFieldView;
diff --git a/client/src/views/fields/foreign-datetime.js b/client/src/views/fields/foreign-datetime.js
index 6085b077e7..2466e75d2c 100644
--- a/client/src/views/fields/foreign-datetime.js
+++ b/client/src/views/fields/foreign-datetime.js
@@ -26,25 +26,24 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
-define('views/fields/foreign-datetime', ['views/fields/datetime', 'helpers/misc/foreign-field'],
-function (Dep, Helper) {
+import DatetimeFieldView from 'views/fields/datetime';
+import Helper from 'helpers/misc/foreign-field';
- return Dep.extend({
+class ForeignDatetimeFieldView extends DatetimeFieldView {
- type: 'foreign',
+ type = 'foreign'
- setup: function () {
- Dep.prototype.setup.call(this);
+ setup() {
+ super.setup();
- /** @var {module:helpers/misc/foreign-field} */
- let helper = new Helper(this);
+ const helper = new Helper(this);
- let foreignParams = helper.getForeignParams();
+ const foreignParams = helper.getForeignParams();
- for (let param in foreignParams) {
- this.params[param] = foreignParams[param];
- }
- },
- });
-});
+ for (let param in foreignParams) {
+ this.params[param] = foreignParams[param];
+ }
+ }
+}
+export default ForeignDatetimeFieldView;
diff --git a/client/src/views/fields/foreign-email.js b/client/src/views/fields/foreign-email.js
index 35befa95eb..9338d0160c 100644
--- a/client/src/views/fields/foreign-email.js
+++ b/client/src/views/fields/foreign-email.js
@@ -26,12 +26,12 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
-define('views/fields/foreign-email', ['views/fields/email'], function (Dep) {
+import EmailFieldView from 'views/fields/email';
- return Dep.extend({
+class ForeignEmailFieldView extends EmailFieldView {
- type: 'foreign',
+ type = 'foreign'
+ readOnly = true
+}
- readOnly: true,
- });
-});
+export default ForeignEmailFieldView;
diff --git a/client/src/views/fields/foreign-enum.js b/client/src/views/fields/foreign-enum.js
index da96d2132f..99e8af879a 100644
--- a/client/src/views/fields/foreign-enum.js
+++ b/client/src/views/fields/foreign-enum.js
@@ -26,50 +26,50 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
-define('views/fields/foreign-enum', ['views/fields/enum'], function (Dep) {
+import EnumFieldView from 'views/fields/enum';
- return Dep.extend({
+class ForeignEnumFieldView extends EnumFieldView {
- type: 'foreign',
+ type = 'foreign'
- setupOptions: function () {
- this.params.options = [];
+ setupOptions() {
+ this.params.options = [];
- let field = this.params.field;
- let link = this.params.link;
+ let field = this.params.field;
+ let link = this.params.link;
- if (!field || !link) {
- return;
- }
+ if (!field || !link) {
+ return;
+ }
- let scope = this.getMetadata().get(['entityDefs', this.model.entityType, 'links', link, 'entity']);
+ let scope = this.getMetadata().get(['entityDefs', this.model.entityType, 'links', link, 'entity']);
- if (!scope) {
- return;
- }
+ if (!scope) {
+ return;
+ }
- let {
- optionsPath,
- translation,
- options,
- isSorted,
- displayAsLabel,
- style,
- } = this.getMetadata()
- .get(['entityDefs', scope, 'fields', field]);
+ let {
+ optionsPath,
+ translation,
+ options,
+ isSorted,
+ displayAsLabel,
+ style,
+ } = this.getMetadata().get(['entityDefs', scope, 'fields', field]);
- options = optionsPath ? this.getMetadata().get(optionsPath) : options;
+ options = optionsPath ? this.getMetadata().get(optionsPath) : options;
- this.params.options = Espo.Utils.clone(options) || [];
- this.params.translation = translation;
- this.params.isSorted = isSorted || false;
- this.params.displayAsLabel = displayAsLabel || false;
- this.styleMap = style || {};
+ this.params.options = Espo.Utils.clone(options) || [];
+ this.params.translation = translation;
+ this.params.isSorted = isSorted || false;
+ this.params.displayAsLabel = displayAsLabel || false;
+ this.styleMap = style || {};
- this.translatedOptions = Object.fromEntries(
- this.params.options
- .map(item => [item, this.getLanguage().translateOption(item, field, scope)])
- );
- },
- });
-});
+ this.translatedOptions = Object.fromEntries(
+ this.params.options
+ .map(item => [item, this.getLanguage().translateOption(item, field, scope)])
+ );
+ }
+}
+
+export default ForeignEnumFieldView;
diff --git a/client/src/views/fields/foreign-float.js b/client/src/views/fields/foreign-float.js
index 7bdecbfa77..deadeb68df 100644
--- a/client/src/views/fields/foreign-float.js
+++ b/client/src/views/fields/foreign-float.js
@@ -26,23 +26,24 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
-define('views/fields/foreign-float', ['views/fields/float', 'helpers/misc/foreign-field'], function (Dep, Helper) {
+import FloatFieldView from 'views/fields/float';
+import Helper from 'helpers/misc/foreign-field';
- return Dep.extend({
+class ForeignFloatFieldView extends FloatFieldView {
- type: 'foreign',
+ type = 'foreign'
- setup: function () {
- Dep.prototype.setup.call(this);
+ setup() {
+ super.setup();
- /** @var {module:helpers/misc/foreign-field} */
- let helper = new Helper(this);
+ const helper = new Helper(this);
- let foreignParams = helper.getForeignParams();
+ const foreignParams = helper.getForeignParams();
- for (let param in foreignParams) {
- this.params[param] = foreignParams[param];
- }
- },
- });
-});
+ for (let param in foreignParams) {
+ this.params[param] = foreignParams[param];
+ }
+ }
+}
+
+export default ForeignFloatFieldView;
diff --git a/client/src/views/fields/foreign-int.js b/client/src/views/fields/foreign-int.js
index 0149134ac2..f1f3f57e09 100644
--- a/client/src/views/fields/foreign-int.js
+++ b/client/src/views/fields/foreign-int.js
@@ -26,27 +26,27 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
-define('views/fields/foreign-int',
-['views/fields/int', 'helpers/misc/foreign-field'], function (Dep, Helper) {
+import IntFieldView from 'views/fields/int';
+import Helper from 'helpers/misc/foreign-field';
- return Dep.extend({
+class ForeignIntFieldView extends IntFieldView {
- type: 'foreign',
+ type = 'foreign'
- setup: function () {
- Dep.prototype.setup.call(this);
+ setup() {
+ super.setup();
- /** @var {module:helpers/misc/foreign-field} */
- let helper = new Helper(this);
+ const helper = new Helper(this);
- let foreignParams = helper.getForeignParams();
+ const foreignParams = helper.getForeignParams();
- for (let param in foreignParams) {
- this.params[param] = foreignParams[param];
- }
+ for (let param in foreignParams) {
+ this.params[param] = foreignParams[param];
+ }
- this.disableFormatting = foreignParams.disableFormatting;
- },
- });
-});
+ this.disableFormatting = foreignParams.disableFormatting;
+ }
+}
+
+export default ForeignIntFieldView;
diff --git a/client/src/views/fields/foreign-multi-enum.js b/client/src/views/fields/foreign-multi-enum.js
index feb77235c5..739697b821 100644
--- a/client/src/views/fields/foreign-multi-enum.js
+++ b/client/src/views/fields/foreign-multi-enum.js
@@ -26,15 +26,16 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
-define('views/fields/foreign-multi-enum', ['views/fields/multi-enum', 'views/fields/foreign-array'],
-function (Dep, ForeignArray) {
+import MultiEnumFieldView from 'views/fields/multi-enum';
+import ForeignArrayFieldView from 'views/fields/foreign-array';
- return Dep.extend({
+class ForeignMultiEnumFieldView extends MultiEnumFieldView {
- type: 'foreign',
+ type = 'foreign'
- setupOptions: function () {
- ForeignArray.prototype.setupOptions.call(this);
- },
- });
-});
+ setupOptions() {
+ ForeignArrayFieldView.prototype.setupOptions.call(this);
+ }
+}
+
+export default ForeignMultiEnumFieldView;
diff --git a/client/src/views/fields/foreign-phone.js b/client/src/views/fields/foreign-phone.js
index bbf098be45..5b5dc6fc5e 100644
--- a/client/src/views/fields/foreign-phone.js
+++ b/client/src/views/fields/foreign-phone.js
@@ -26,12 +26,12 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
-define('views/fields/foreign-phone', ['views/fields/phone'], function (Dep) {
+import PhoneFieldView from 'views/fields/phone';
- return Dep.extend({
+class ForeignPhoneFieldView extends PhoneFieldView {
- type: 'foreign',
+ type = 'foreign'
+ readOnly = true
+}
- readOnly: true,
- });
-});
+export default ForeignPhoneFieldView;
diff --git a/client/src/views/fields/foreign-text.js b/client/src/views/fields/foreign-text.js
index ad3ca3a823..4f20d7a6ea 100644
--- a/client/src/views/fields/foreign-text.js
+++ b/client/src/views/fields/foreign-text.js
@@ -26,23 +26,24 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
-define('views/fields/foreign-text', ['views/fields/text', 'helpers/misc/foreign-field'], function (Dep, Helper) {
+import TextFieldView from 'views/fields/text';
+import Helper from 'helpers/misc/foreign-field';
- return Dep.extend({
+class ForeignTextFieldView extends TextFieldView {
- type: 'foreign',
+ type = 'foreign'
- setup: function () {
- Dep.prototype.setup.call(this);
+ setup() {
+ super.setup();
- /** @var {module:helpers/misc/foreign-field} */
- let helper = new Helper(this);
+ const helper = new Helper(this);
- let foreignParams = helper.getForeignParams();
+ const foreignParams = helper.getForeignParams();
- for (let param in foreignParams) {
- this.params[param] = foreignParams[param];
- }
- },
- });
-});
+ for (let param in foreignParams) {
+ this.params[param] = foreignParams[param];
+ }
+ }
+}
+
+export default ForeignTextFieldView;
diff --git a/client/src/views/fields/foreign-url-multiple.js b/client/src/views/fields/foreign-url-multiple.js
index 436abe0116..e45ea886f5 100644
--- a/client/src/views/fields/foreign-url-multiple.js
+++ b/client/src/views/fields/foreign-url-multiple.js
@@ -26,24 +26,25 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
-define('views/fields/foreign-url-multiple',
-['views/fields/url-multiple', 'helpers/misc/foreign-field'], function (Dep, Helper) {
+import UrlMultipleFieldView from 'views/fields/url-multiple';
+import Helper from 'helpers/misc/foreign-field';
- return Dep.extend({
+class ForeignUrlMultipleFieldView extends UrlMultipleFieldView {
- type: 'foreign',
+ type = 'foreign'
+ readOnly = true
- setup: function () {
- Dep.prototype.setup.call(this);
+ setup() {
+ super.setup();
- /** @var {module:helpers/misc/foreign-field} */
- let helper = new Helper(this);
+ const helper = new Helper(this);
- let foreignParams = helper.getForeignParams();
+ const foreignParams = helper.getForeignParams();
- for (let param in foreignParams) {
- this.params[param] = foreignParams[param];
- }
- },
- });
-});
+ for (let param in foreignParams) {
+ this.params[param] = foreignParams[param];
+ }
+ }
+}
+
+export default ForeignUrlMultipleFieldView;
diff --git a/client/src/views/fields/foreign-url.js b/client/src/views/fields/foreign-url.js
index 69780a3d46..b43ab8a026 100644
--- a/client/src/views/fields/foreign-url.js
+++ b/client/src/views/fields/foreign-url.js
@@ -26,25 +26,25 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
-define('views/fields/foreign-url', ['views/fields/url', 'helpers/misc/foreign-field'], function (Dep, Helper) {
+import UrlFieldView from 'views/fields/url';
+import Helper from 'helpers/misc/foreign-field';
- return Dep.extend({
+class ForeignUrlFieldView extends UrlFieldView {
- type: 'foreign',
+ type = 'foreign'
+ readOnly = true
- readOnly: true,
+ setup() {
+ super.setup();
- setup: function () {
- Dep.prototype.setup.call(this);
+ const helper = new Helper(this);
- /** @var {module:helpers/misc/foreign-field.Class} */
- let helper = new Helper(this);
+ const foreignParams = helper.getForeignParams();
- let foreignParams = helper.getForeignParams();
+ for (let param in foreignParams) {
+ this.params[param] = foreignParams[param];
+ }
+ }
+}
- for (let param in foreignParams) {
- this.params[param] = foreignParams[param];
- }
- },
- });
-});
+export default ForeignUrlFieldView;
diff --git a/client/src/views/fields/foreign-varchar.js b/client/src/views/fields/foreign-varchar.js
index f252d49ef9..ca766a55c7 100644
--- a/client/src/views/fields/foreign-varchar.js
+++ b/client/src/views/fields/foreign-varchar.js
@@ -26,23 +26,24 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
-define('views/fields/foreign-varchar', ['views/fields/varchar', 'helpers/misc/foreign-field'], function (Dep, Helper) {
+import VarcharFieldView from 'views/fields/varchar';
+import Helper from 'helpers/misc/foreign-field';
- return Dep.extend({
+class ForeignVarcharFieldView extends VarcharFieldView {
- type: 'foreign',
+ type = 'foreign'
- setup: function () {
- Dep.prototype.setup.call(this);
+ setup() {
+ super.setup();
- /** @var {module:helpers/misc/foreign-field.Class} */
- let helper = new Helper(this);
+ const helper = new Helper(this);
- let foreignParams = helper.getForeignParams();
+ const foreignParams = helper.getForeignParams();
- for (let param in foreignParams) {
- this.params[param] = foreignParams[param];
- }
- },
- });
-});
+ for (let param in foreignParams) {
+ this.params[param] = foreignParams[param];
+ }
+ }
+}
+
+export default ForeignVarcharFieldView;
diff --git a/client/src/views/fields/foreign.js b/client/src/views/fields/foreign.js
index a15405d19a..e8628ce451 100644
--- a/client/src/views/fields/foreign.js
+++ b/client/src/views/fields/foreign.js
@@ -29,6 +29,7 @@
import BaseFieldView from 'views/fields/base';
class ForeignFieldView extends BaseFieldView {
+
type = 'foreign'
}
diff --git a/client/src/views/fields/json-object.js b/client/src/views/fields/json-object.js
index cc237e3576..d8746a82cc 100644
--- a/client/src/views/fields/json-object.js
+++ b/client/src/views/fields/json-object.js
@@ -26,39 +26,35 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
-define('views/fields/json-object', ['views/fields/base'], function (Dep) {
+import BaseFieldView from 'views/fields/base';
- return Dep.extend({
+class JsonObjectFieldView extends BaseFieldView {
- type: 'jsonObject',
+ type = 'jsonObject'
- listTemplate: 'fields/json-object/detail',
+ listTemplate = 'fields/json-object/detail'
+ detailTemplate = 'fields/json-object/detail'
- detailTemplate: 'fields/json-object/detail',
+ data() {
+ const data = super.setup();
- data: function () {
- var data = Dep.prototype.data.call(this);
+ data.valueIsSet = this.model.has(this.name);
+ data.isNotEmpty = !!this.model.get(this.name);
- data.valueIsSet = this.model.has(this.name);
- data.isNotEmpty = !!this.model.get(this.name);
+ return data;
+ }
- return data;
- },
+ getValueForDisplay() {
+ const value = this.model.get(this.name);
- getValueForDisplay: function () {
- if (!this.model.get(this.name)) {
- return null;
- }
+ if (!value) {
+ return null;
+ }
- var text = JSON.stringify(this.model.get(this.name), false, 2)
- .replace(/(\r\n|\n|\r)/gm, '
').replace(/\s/g, ' ');
+ return JSON.stringify(value, null, 2)
+ .replace(/(\r\n|\n|\r)/gm, '
').replace(/\s/g, ' ');
+ }
+}
- return text;
- },
-
- afterRender: function () {
- Dep.prototype.afterRender.call(this);
- },
- });
-});
+export default JsonObjectFieldView;
diff --git a/client/src/views/fields/link-category-tree.js b/client/src/views/fields/link-category-tree.js
index e64564aa22..cea9535126 100644
--- a/client/src/views/fields/link-category-tree.js
+++ b/client/src/views/fields/link-category-tree.js
@@ -26,37 +26,38 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
-define('views/fields/link-category-tree', ['views/fields/link'], function (Dep) {
+import LinkFieldView from 'views/fields/link';
- return Dep.extend({
+class LinkCategoryTreeFieldView extends LinkFieldView {
- selectRecordsView: 'views/modals/select-category-tree-records',
+ selectRecordsView = 'views/modals/select-category-tree-records'
+ autocompleteDisabled = false
- autocompleteDisabled: false,
-
- fetchSearch: function () {
- var data = Dep.prototype.fetchSearch.call(this);
-
- if (!data) {
- return data;
- }
-
- if (data.typeFront === 'is') {
- data.field = this.name;
- data.type = 'inCategory';
- }
+ fetchSearch() {
+ const data = super.fetchSearch();
+ if (!data) {
return data;
- },
+ }
- getUrl: function () {
- let id = this.model.get(this.idName);
+ if (data.typeFront === 'is') {
+ data.field = this.name;
+ data.type = 'inCategory';
+ }
- if (!id) {
- return null;
- }
+ return data;
+ }
- return '#' + this.entityType + '/list/categoryId=' + id;
- },
- });
-});
+ getUrl() {
+ const id = this.model.get(this.idName);
+
+ if (!id) {
+ return null;
+ }
+
+ return '#' + this.entityType + '/list/categoryId=' + id;
+ }
+}
+
+// noinspection JSUnusedGlobalSymbols
+export default LinkCategoryTreeFieldView;
diff --git a/client/src/views/fields/link-multiple-category-tree.js b/client/src/views/fields/link-multiple-category-tree.js
index 004c57208b..d5ce65d65c 100644
--- a/client/src/views/fields/link-multiple-category-tree.js
+++ b/client/src/views/fields/link-multiple-category-tree.js
@@ -26,29 +26,30 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
-define('views/fields/link-multiple-category-tree', ['views/fields/link-multiple'], function (Dep) {
+import LinkMultipleFieldView from 'views/fields/link-multiple';
- return Dep.extend({
+class LinkMultipleCategoryTreeFieldView extends LinkMultipleFieldView {
- selectRecordsView: 'views/modals/select-category-tree-records',
+ selectRecordsView = 'views/modals/select-category-tree-records'
+ autocompleteDisabled = false
- autocompleteDisabled: false,
+ getUrl(id) {
+ return '#' + this.entityType + '/list/categoryId=' + id;
+ }
- getUrl: function (id) {
- return '#' + this.entityType + '/list/categoryId=' + id;
- },
-
- fetchSearch: function () {
- var data = Dep.prototype.fetchSearch.call(this);
-
- if (!data) {
- return data;
- }
-
- data.type = 'inCategory';
+ fetchSearch() {
+ const data = super.fetchSearch();
+ if (!data) {
return data;
- },
- });
-});
+ }
+
+ data.type = 'inCategory';
+
+ return data;
+ }
+}
+
+// noinspection JSUnusedGlobalSymbols
+export default LinkMultipleCategoryTreeFieldView;
diff --git a/client/src/views/fields/link-multiple-with-columns-with-primary.js b/client/src/views/fields/link-multiple-with-columns-with-primary.js
index f25db8e85a..aadb36a21f 100644
--- a/client/src/views/fields/link-multiple-with-columns-with-primary.js
+++ b/client/src/views/fields/link-multiple-with-columns-with-primary.js
@@ -26,186 +26,178 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
-define(
- 'views/fields/link-multiple-with-columns-with-primary',
- ['views/fields/link-multiple-with-columns', 'views/fields/link-multiple-with-primary'],
- function (Dep, LinkMultipleWithPrimary) {
+import LinkMultipleWithColumnsFieldView from 'views/fields/link-multiple-with-columns';
+import LinkMultipleWithPrimaryFieldView from 'views/fields/link-multiple-with-primary';
+
+/**
+ * A link-multiple field with columns and a primary.
+ */
+class LinkMultipleWithColumnsWithPrimaryFieldView extends LinkMultipleWithColumnsFieldView {
/**
- * A link-multiple field with columns and a primary.
- *
- * @class
- * @name Class
- * @extends module:link-multiple-with-columns.Class
- * @memberOf module:link-multiple-with-columns-with-primary
+ * @protected
+ * @type {string}
*/
- return Dep.extend(/** @lends module:link-multiple-with-columns-with-primary.Class# */{
+ primaryLink
- /**
- * @protected
- * @type {?string}
- */
- primaryLink: null,
+ getAttributeList() {
+ let list = super.getAttributeList();
- getAttributeList: function () {
- let list = Dep.prototype.getAttributeList.call(this);
+ list.push(this.primaryIdAttribute);
+ list.push(this.primaryNameAttribute);
- list.push(this.primaryIdAttribute);
- list.push(this.primaryNameAttribute);
+ return list;
+ }
- return list;
- },
+ setup() {
+ this.primaryLink = this.primaryLink || this.model.getFieldParam(this.name, 'primaryLink');
- setup: function () {
- this.primaryLink = this.primaryLink || this.model.getFieldParam(this.name, 'primaryLink');
+ this.primaryIdAttribute = this.primaryLink + 'Id';
+ this.primaryNameAttribute = this.primaryLink + 'Name';
- this.primaryIdAttribute = this.primaryLink + 'Id';
- this.primaryNameAttribute = this.primaryLink + 'Name';
+ super.setup();
- Dep.prototype.setup.call(this);
+ this.events['click [data-action="switchPrimary"]'] = e => {
+ let $target = $(e.currentTarget);
+ let id = $target.data('id');
- this.events['click [data-action="switchPrimary"]'] = e => {
- let $target = $(e.currentTarget);
- let id = $target.data('id');
+ LinkMultipleWithPrimaryFieldView.prototype.switchPrimary.call(this, id);
+ };
- LinkMultipleWithPrimary.prototype.switchPrimary.call(this, id);
- };
+ this.primaryId = this.model.get(this.primaryIdAttribute);
+ this.primaryName = this.model.get(this.primaryNameAttribute);
+ this.listenTo(this.model, 'change:' + this.primaryIdAttribute, () => {
this.primaryId = this.model.get(this.primaryIdAttribute);
this.primaryName = this.model.get(this.primaryNameAttribute);
+ });
+ }
- this.listenTo(this.model, 'change:' + this.primaryIdAttribute, () => {
- this.primaryId = this.model.get(this.primaryIdAttribute);
- this.primaryName = this.model.get(this.primaryNameAttribute);
- });
- },
+ setPrimaryId(id) {
+ this.primaryId = id;
- setPrimaryId: function (id) {
- this.primaryId = id;
+ this.primaryName = id ?
+ this.nameHash[id] : null;
- if (id) {
- this.primaryName = this.nameHash[id];
- } else {
- this.primaryName = null;
+ this.trigger('change');
+ }
+
+ renderLinks() {
+ if (this.primaryId) {
+ this.addLinkHtml(this.primaryId, this.primaryName);
+ }
+
+ this.ids.forEach(id => {
+ if (id !== this.primaryId) {
+ this.addLinkHtml(id, this.nameHash[id]);
}
+ });
+ }
- this.trigger('change');
- },
+ getValueForDisplay() {
+ if (this.isDetailMode() || this.isListMode()) {
+ let itemList = [];
- renderLinks: function () {
if (this.primaryId) {
- this.addLinkHtml(this.primaryId, this.primaryName);
+ itemList.push(
+ this.getDetailLinkHtml(this.primaryId, this.primaryName)
+ );
}
- this.ids.forEach(id => {
+ if (!this.ids.length) {
+ return;
+ }
+
+ this.ids.forEach(id =>{
if (id !== this.primaryId) {
- this.addLinkHtml(id, this.nameHash[id]);
- }
- });
- },
-
- getValueForDisplay: function () {
- if (this.isDetailMode() || this.isListMode()) {
- let itemList = [];
-
- if (this.primaryId) {
itemList.push(
- this.getDetailLinkHtml(this.primaryId, this.primaryName)
+ this.getDetailLinkHtml(id)
);
}
+ });
- if (!this.ids.length) {
- return;
- }
+ return itemList
+ .map(item => $('