This commit is contained in:
Yuri Kuznetsov
2022-08-20 17:51:20 +03:00
parent ad4e7c0beb
commit ca89fd021d
16 changed files with 57 additions and 80 deletions
@@ -26,7 +26,7 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
define('views/admin/dynamic-logic/conditions-string/group-base', 'view', function (Dep) {
define('views/admin/dynamic-logic/conditions-string/group-base', ['view'], function (Dep) {
return Dep.extend({
@@ -38,6 +38,7 @@ define('views/admin/dynamic-logic/conditions-string/group-base', 'view', functio
isEmpty: true
};
}
return {
viewDataList: this.viewDataList,
operator: this.operator,
@@ -26,7 +26,8 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/admin/dynamic-logic/conditions-string/group-not', 'views/admin/dynamic-logic/conditions-string/group-base', function (Dep) {
define('views/admin/dynamic-logic/conditions-string/group-not',
['views/admin/dynamic-logic/conditions-string/group-base'], function (Dep) {
return Dep.extend({
@@ -49,15 +50,12 @@ Espo.define('views/admin/dynamic-logic/conditions-string/group-not', 'views/admi
this.itemData = this.options.itemData || {};
this.viewList = [];
var i = 0;
var key = 'view-' + this.level.toString() + '-' + this.number.toString() + '-' + i.toString();
this.createItemView(i, key, this.itemData.value);
this.viewKey = key;
}
},
});
});
@@ -26,7 +26,7 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/admin/dynamic-logic/conditions-string/item-base', 'view', function (Dep) {
define('views/admin/dynamic-logic/conditions-string/item-base', ['view'], function (Dep) {
return Dep.extend({
@@ -84,7 +84,8 @@ Espo.define('views/admin/dynamic-logic/conditions-string/item-base', 'view', fun
var key = this.getValueViewKey();
var fieldType = this.getMetadata().get(['entityDefs', this.scope, 'fields', this.field, 'type']) || 'base';
var viewName = this.getMetadata().get(['entityDefs', this.scope, 'fields', this.field, 'view']) || this.getFieldManager().getViewName(fieldType);
var viewName = this.getMetadata().get(['entityDefs', this.scope, 'fields', this.field, 'view']) ||
this.getFieldManager().getViewName(fieldType);
this.createView('value', viewName, {
model: this.model,
@@ -92,8 +93,6 @@ Espo.define('views/admin/dynamic-logic/conditions-string/item-base', 'view', fun
el: this.getSelector() + ' [data-view-key="'+key+'"]'
});
},
});
});
@@ -26,13 +26,12 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/admin/dynamic-logic/conditions-string/item-in-future', 'views/admin/dynamic-logic/conditions-string/item-operator-only-date', function (Dep) {
define('views/admin/dynamic-logic/conditions-string/item-in-future',
['views/admin/dynamic-logic/conditions-string/item-operator-only-date'], function (Dep) {
return Dep.extend({
dateValue: 'future'
dateValue: 'future',
});
});
@@ -26,13 +26,11 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/admin/dynamic-logic/conditions-string/item-in-past', 'views/admin/dynamic-logic/conditions-string/item-operator-only-date', function (Dep) {
define('views/admin/dynamic-logic/conditions-string/item-in-past',
['views/admin/dynamic-logic/conditions-string/item-operator-only-date'], function (Dep) {
return Dep.extend({
dateValue: 'past'
dateValue: 'past',
});
});
@@ -26,13 +26,12 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/admin/dynamic-logic/conditions-string/item-is-today', 'views/admin/dynamic-logic/conditions-string/item-operator-only-date', function (Dep) {
define('views/admin/dynamic-logic/conditions-string/item-is-today',
['views/admin/dynamic-logic/conditions-string/item-operator-only-date'], function (Dep) {
return Dep.extend({
dateValue: 'today'
dateValue: 'today',
});
});
@@ -26,7 +26,8 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/admin/dynamic-logic/conditions-string/item-multiple-values-base', 'views/admin/dynamic-logic/conditions-string/item-base', function (Dep) {
define('views/admin/dynamic-logic/conditions-string/item-multiple-values-base',
['views/admin/dynamic-logic/conditions-string/item-base'], function (Dep) {
return Dep.extend({
@@ -38,14 +39,13 @@ Espo.define('views/admin/dynamic-logic/conditions-string/item-multiple-values-ba
scope: this.scope,
operator: this.operator,
operatorString: this.operatorString,
field: this.field
field: this.field,
};
},
populateValues: function () {
},
getValueViewKey: function (i) {
return 'view-' + this.level.toString() + '-' + this.number.toString() + '-' + i.toString();
},
@@ -54,14 +54,17 @@ Espo.define('views/admin/dynamic-logic/conditions-string/item-multiple-values-ba
var valueList = this.itemData.value || [];
var fieldType = this.getMetadata().get(['entityDefs', this.scope, 'fields', this.field, 'type']) || 'base';
var viewName = this.getMetadata().get(['entityDefs', this.scope, 'fields', this.field, 'view']) || this.getFieldManager().getViewName(fieldType);
var viewName = this.getMetadata().get(['entityDefs', this.scope, 'fields', this.field, 'view']) ||
this.getFieldManager().getViewName(fieldType);
this.valueViewDataList = [];
valueList.forEach(function (value, i) {
var model = this.model.clone();
model.set(this.itemData.attribute, value);
var key = this.getValueViewKey(i);
this.valueViewDataList.push({
key: key,
isEnd: i === valueList.length - 1
@@ -74,8 +77,5 @@ Espo.define('views/admin/dynamic-logic/conditions-string/item-multiple-values-ba
});
}, this);
},
});
});
@@ -26,16 +26,14 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/admin/dynamic-logic/conditions-string/item-operator-only-base', 'views/admin/dynamic-logic/conditions-string/item-base', function (Dep) {
define('views/admin/dynamic-logic/conditions-string/item-operator-only-base',
['views/admin/dynamic-logic/conditions-string/item-base'], function (Dep) {
return Dep.extend({
template: 'admin/dynamic-logic/conditions-string/item-operator-only-base',
createValueFieldView: function () {
},
createValueFieldView: function () {},
});
});
@@ -26,7 +26,8 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/admin/dynamic-logic/conditions-string/item-operator-only-date', 'views/admin/dynamic-logic/conditions-string/item-operator-only-base', function (Dep) {
define('views/admin/dynamic-logic/conditions-string/item-operator-only-date',
['views/admin/dynamic-logic/conditions-string/item-operator-only-base'], function (Dep) {
return Dep.extend({
@@ -37,8 +38,5 @@ Espo.define('views/admin/dynamic-logic/conditions-string/item-operator-only-date
data.dateValue = this.dateValue;
return data;
},
});
});
@@ -26,10 +26,8 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
define(
'views/admin/dynamic-logic/conditions-string/item-value-enum',
'views/admin/dynamic-logic/conditions-string/item-base',
function (Dep) {
define('views/admin/dynamic-logic/conditions-string/item-value-enum',
['views/admin/dynamic-logic/conditions-string/item-base'], function (Dep) {
return Dep.extend({
@@ -50,7 +48,5 @@ define(
}
});
},
});
});
@@ -26,26 +26,25 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/admin/dynamic-logic/conditions-string/item-value-link', 'views/admin/dynamic-logic/conditions-string/item-base', function (Dep) {
define('views/admin/dynamic-logic/conditions-string/item-value-link',
['views/admin/dynamic-logic/conditions-string/item-base'], function (Dep) {
return Dep.extend({
template: 'admin/dynamic-logic/conditions-string/item-base',
createValueFieldView: function () {
var key = this.getValueViewKey();
var viewName = 'views/fields/link';
this.createView('value', viewName, {
model: this.model,
name: 'link',
el: '[data-view-key="'+key+'"]',
foreignScope: this.getMetadata().get(['entityDefs', this.scope, 'fields', this.field, 'entity']) || this.getMetadata().get(['entityDefs', this.scope, 'links', this.field, 'entity'])
foreignScope: this.getMetadata().get(['entityDefs', this.scope, 'fields', this.field, 'entity']) ||
this.getMetadata().get(['entityDefs', this.scope, 'links', this.field, 'entity'])
});
},
});
});
@@ -26,10 +26,8 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
define(
'views/admin/dynamic-logic/conditions-string/item-value-varchar',
'views/admin/dynamic-logic/conditions-string/item-base',
function (Dep) {
define('views/admin/dynamic-logic/conditions-string/item-value-varchar',
['views/admin/dynamic-logic/conditions-string/item-base'], function (Dep) {
return Dep.extend({
@@ -46,7 +44,5 @@ define(
el: this.getSelector() + '[data-view-key="'+key+'"]',
});
},
});
});
@@ -26,38 +26,38 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/admin/dynamic-logic/fields/field', 'views/fields/multi-enum', function (Dep) {
define('views/admin/dynamic-logic/fields/field', ['views/fields/multi-enum'], function (Dep) {
return Dep.extend({
getFieldList: function () {
var fields = this.getMetadata().get('entityDefs.' + this.options.scope + '.fields');
var filterList = Object.keys(fields).filter(function (field) {
var filterList = Object.keys(fields).filter(field => {
var fieldType = fields[field].type || null;
if (fields[field].disabled) return;
if (!fieldType) return;
if (!this.getMetadata().get(['clientDefs', 'DynamicLogic', 'fieldTypes', fieldType])) return;
return true;
}, this);
});
filterList.push('id');
filterList.sort(function (v1, v2) {
return this.translate(v1, 'fields', this.options.scope).localeCompare(this.translate(v2, 'fields', this.options.scope));
}.bind(this));
filterList.sort((v1, v2) => {
return this.translate(v1, 'fields', this.options.scope)
.localeCompare(this.translate(v2, 'fields', this.options.scope));
});
return filterList;
},
setupTranslatedOptions: function () {
this.translatedOptions = {};
this.params.options.forEach(function (item) {
var field = item;
this.translatedOptions[item] = this.translate(field, 'fields', this.options.scope);
}, this);
this.params.options.forEach(item => {
this.translatedOptions[item] = this.translate(item, 'fields', this.options.scope);
});
},
setupOptions: function () {
@@ -69,12 +69,11 @@ Espo.define('views/admin/dynamic-logic/fields/field', 'views/fields/multi-enum',
afterRender: function () {
Dep.prototype.afterRender.call(this);
if (this.$element && this.$element[0] && this.$element[0].selectize) {
this.$element[0].selectize.focus();
}
}
},
});
});
@@ -26,7 +26,7 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/admin/dynamic-logic/modals/add-field', ['views/modal', 'model'], function (Dep, Model) {
define('views/admin/dynamic-logic/modals/add-field', ['views/modal', 'model'], function (Dep, Model) {
return Dep.extend({
@@ -60,8 +60,6 @@ Espo.define('views/admin/dynamic-logic/modals/add-field', ['views/modal', 'model
this.trigger('add-field', list[0]);
}, this);
});
}
},
});
});
@@ -26,7 +26,7 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
define('views/admin/dynamic-logic/modals/edit', 'views/modal', function (Dep) {
define('views/admin/dynamic-logic/modals/edit', ['views/modal'], function (Dep) {
return Dep.extend({
@@ -26,7 +26,7 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/admin/entity-manager/record/edit-formula', 'views/record/base', function (Dep) {
define('views/admin/entity-manager/record/edit-formula', ['views/record/base'], function (Dep) {
return Dep.extend({
@@ -34,12 +34,11 @@ Espo.define('views/admin/entity-manager/record/edit-formula', 'views/record/base
setup: function () {
Dep.prototype.setup.call(this);
this.createField('beforeSaveCustomScript', 'views/fields/formula', {
targetEntityType: this.options.targetEntityType,
height: 500
}, 'edit');
}
},
});
});