jsdoc
This commit is contained in:
@@ -88,7 +88,7 @@ define('views/fields/email', ['views/fields/varchar'], function (Dep) {
|
||||
|
||||
validateRequired: function () {
|
||||
if (this.isRequired()) {
|
||||
if (!this.model.get(this.name) || !this.model.get(this.name) === '') {
|
||||
if (!this.model.get(this.name)) {
|
||||
var msg = this.translate('fieldIsRequired', 'messages')
|
||||
.replace('{field}', this.getLabelText());
|
||||
|
||||
@@ -102,7 +102,7 @@ define('views/fields/email', ['views/fields/varchar'], function (Dep) {
|
||||
data: function () {
|
||||
var emailAddressData;
|
||||
|
||||
if (this.mode == 'edit') {
|
||||
if (this.mode === 'edit') {
|
||||
emailAddressData = Espo.Utils.clone(this.model.get(this.dataFieldName));
|
||||
|
||||
if (this.model.isNew() || !this.model.get(this.name)) {
|
||||
|
||||
@@ -36,13 +36,14 @@ define('views/fields/enum-column', ['views/fields/enum'], function (Dep) {
|
||||
var type = this.fetchSearchType();
|
||||
|
||||
var list = this.$element.val().split(':,:');
|
||||
|
||||
if (list.length === 1 && list[0] === '') {
|
||||
list = [];
|
||||
}
|
||||
|
||||
list.forEach(function (item, i) {
|
||||
list.forEach((item, i) => {
|
||||
list[i] = this.parseItemForSearch(item);
|
||||
}, this);
|
||||
});
|
||||
|
||||
if (type === 'anyOf') {
|
||||
if (list.length === 0) {
|
||||
@@ -53,6 +54,7 @@ define('views/fields/enum-column', ['views/fields/enum'], function (Dep) {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'columnIn',
|
||||
value: list,
|
||||
@@ -61,7 +63,8 @@ define('views/fields/enum-column', ['views/fields/enum'], function (Dep) {
|
||||
valueList: list
|
||||
}
|
||||
};
|
||||
} else if (type === 'noneOf') {
|
||||
}
|
||||
else if (type === 'noneOf') {
|
||||
if (list.length === 0) {
|
||||
return {
|
||||
data: {
|
||||
@@ -70,6 +73,7 @@ define('views/fields/enum-column', ['views/fields/enum'], function (Dep) {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'or',
|
||||
value: [
|
||||
|
||||
@@ -45,7 +45,9 @@ define('views/fields/enum-int', ['views/fields/enum'], function (Dep) {
|
||||
fetch: function () {
|
||||
var value = parseInt(this.$element.val());
|
||||
var data = {};
|
||||
|
||||
data[this.name] = value;
|
||||
|
||||
return data;
|
||||
},
|
||||
|
||||
|
||||
@@ -28,7 +28,5 @@
|
||||
|
||||
define('views/fields/enum-styled', ['views/fields/enum'], function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
});
|
||||
return Dep.extend({});
|
||||
});
|
||||
|
||||
@@ -660,7 +660,8 @@ define('views/fields/file', ['views/fields/link', 'helpers/file-upload'], functi
|
||||
|
||||
insertFromSource: function (source) {
|
||||
var viewName =
|
||||
this.getMetadata().get(['clientDefs', 'Attachment', 'sourceDefs', source, 'insertModalView']) ||
|
||||
this.getMetadata()
|
||||
.get(['clientDefs', 'Attachment', 'sourceDefs', source, 'insertModalView']) ||
|
||||
this.getMetadata().get(['clientDefs', source, 'modalViews', 'select']) ||
|
||||
'views/modals/select-records';
|
||||
|
||||
@@ -674,7 +675,8 @@ define('views/fields/file', ['views/fields/link', 'helpers/file-upload'], functi
|
||||
|
||||
if (this.model.get('parentId') && this.model.get('parentType') === 'Account') {
|
||||
if (
|
||||
this.getMetadata().get(['entityDefs', source, 'fields', 'account', 'type']) === 'link'
|
||||
this.getMetadata()
|
||||
.get(['entityDefs', source, 'fields', 'account', 'type']) === 'link'
|
||||
) {
|
||||
filters = {
|
||||
account: {
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
Espo.define('views/fields/number', 'views/fields/varchar', function (Dep) {
|
||||
define('views/fields/number', ['views/fields/varchar'], function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
Espo.define('views/fields/password', 'views/fields/base', function (Dep) {
|
||||
define('views/fields/password', ['views/fields/base'], function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
@@ -41,7 +41,7 @@ Espo.define('views/fields/password', 'views/fields/base', function (Dep) {
|
||||
events: {
|
||||
'click [data-action="change"]': function (e) {
|
||||
this.changePassword();
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
changePassword: function () {
|
||||
@@ -59,8 +59,11 @@ Espo.define('views/fields/password', 'views/fields/base', function (Dep) {
|
||||
validateConfirm: function () {
|
||||
if (this.model.has(this.name + 'Confirm')) {
|
||||
if (this.model.get(this.name) != this.model.get(this.name + 'Confirm')) {
|
||||
var msg = this.translate('fieldBadPasswordConfirm', 'messages').replace('{field}', this.getLabelText());
|
||||
var msg = this.translate('fieldBadPasswordConfirm', 'messages')
|
||||
.replace('{field}', this.getLabelText());
|
||||
|
||||
this.showValidationMessage(msg);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -84,5 +87,3 @@ Espo.define('views/fields/password', 'views/fields/base', function (Dep) {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
define('views/fields/person-name', 'views/fields/varchar', function (Dep) {
|
||||
define('views/fields/person-name', ['views/fields/varchar'], function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
@@ -44,6 +44,7 @@ define('views/fields/person-name', 'views/fields/varchar', function (Dep) {
|
||||
|
||||
data: function () {
|
||||
var data = Dep.prototype.data.call(this);
|
||||
|
||||
data.ucName = Espo.Utils.upperCaseFirst(this.name);
|
||||
data.salutationValue = this.model.get(this.salutationField);
|
||||
data.firstValue = this.model.get(this.firstField);
|
||||
@@ -60,12 +61,17 @@ define('views/fields/person-name', 'views/fields/varchar', function (Dep) {
|
||||
data.valueIsSet = this.model.has(this.firstField) || this.model.has(this.lastField);
|
||||
|
||||
if (this.mode === 'detail') {
|
||||
data.isNotEmpty = !!data.firstValue || !!data.lastValue || !!data.salutationValue || !!data.middleValue;
|
||||
} else if (this.mode === 'list' || this.mode === 'listLink') {
|
||||
data.isNotEmpty = !!data.firstValue || !!data.lastValue ||
|
||||
!!data.salutationValue || !!data.middleValue;
|
||||
}
|
||||
else if (this.mode === 'list' || this.mode === 'listLink') {
|
||||
data.isNotEmpty = !!data.firstValue || !!data.lastValue || !!data.middleValue;
|
||||
}
|
||||
|
||||
if (data.isNotEmpty && this.mode == 'detail' || this.mode == 'list' || this.mode === 'listLink') {
|
||||
if (
|
||||
data.isNotEmpty && this.mode == 'detail' ||
|
||||
this.mode == 'list' || this.mode === 'listLink'
|
||||
) {
|
||||
data.formattedValue = this.getFormattedValue();
|
||||
}
|
||||
|
||||
@@ -74,6 +80,7 @@ define('views/fields/person-name', 'views/fields/varchar', function (Dep) {
|
||||
|
||||
setup: function () {
|
||||
Dep.prototype.setup.call(this);
|
||||
|
||||
var ucName = Espo.Utils.upperCaseFirst(this.name)
|
||||
this.salutationField = 'salutation' + ucName;
|
||||
this.firstField = 'first' + ucName;
|
||||
@@ -83,6 +90,7 @@ define('views/fields/person-name', 'views/fields/varchar', function (Dep) {
|
||||
|
||||
afterRender: function () {
|
||||
Dep.prototype.afterRender.call(this);
|
||||
|
||||
if (this.mode == 'edit') {
|
||||
this.$salutation = this.$el.find('[data-name="' + this.salutationField + '"]');
|
||||
this.$first = this.$el.find('[data-name="' + this.firstField + '"]');
|
||||
@@ -92,15 +100,17 @@ define('views/fields/person-name', 'views/fields/varchar', function (Dep) {
|
||||
this.$middle = this.$el.find('[data-name="' + this.middleField + '"]');
|
||||
}
|
||||
|
||||
this.$salutation.on('change', function () {
|
||||
this.$salutation.on('change', () => {
|
||||
this.trigger('change');
|
||||
}.bind(this));
|
||||
this.$first.on('change', function () {
|
||||
});
|
||||
|
||||
this.$first.on('change', () => {
|
||||
this.trigger('change');
|
||||
}.bind(this));
|
||||
this.$last.on('change', function () {
|
||||
});
|
||||
|
||||
this.$last.on('change', () => {
|
||||
this.trigger('change');
|
||||
}.bind(this));
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@@ -111,7 +121,8 @@ define('views/fields/person-name', 'views/fields/varchar', function (Dep) {
|
||||
var middle = this.model.get(this.middleField);
|
||||
|
||||
if (salutation) {
|
||||
salutation = this.getLanguage().translateOption(salutation, 'salutationName', this.model.entityType);
|
||||
salutation = this.getLanguage()
|
||||
.translateOption(salutation, 'salutationName', this.model.entityType);
|
||||
}
|
||||
|
||||
var value = '';
|
||||
@@ -120,33 +131,78 @@ define('views/fields/person-name', 'views/fields/varchar', function (Dep) {
|
||||
|
||||
switch (format) {
|
||||
case 'lastFirst':
|
||||
if (salutation) value += salutation;
|
||||
if (last) value += ' ' + last;
|
||||
if (first) value += ' ' + first;
|
||||
if (salutation) {
|
||||
value += salutation;
|
||||
}
|
||||
|
||||
if (last) {
|
||||
value += ' ' + last;
|
||||
}
|
||||
|
||||
if (first) {
|
||||
value += ' ' + first;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'lastFirstMiddle':
|
||||
var arr = [];
|
||||
if (salutation) arr.push(salutation);
|
||||
if (last) arr.push(last);
|
||||
if (first) arr.push(first);
|
||||
if (middle) arr.push(middle);
|
||||
|
||||
if (salutation) {
|
||||
arr.push(salutation);
|
||||
}
|
||||
|
||||
if (last) {
|
||||
arr.push(last);
|
||||
}
|
||||
|
||||
if (first) {
|
||||
arr.push(first);
|
||||
}
|
||||
|
||||
if (middle) {
|
||||
arr.push(middle);
|
||||
}
|
||||
|
||||
value = arr.join(' ');
|
||||
|
||||
break;
|
||||
|
||||
case 'firstMiddleLast':
|
||||
var arr = [];
|
||||
if (salutation) arr.push(salutation);
|
||||
if (first) arr.push(first);
|
||||
if (middle) arr.push(middle);
|
||||
if (last) arr.push(last);
|
||||
|
||||
if (salutation) {
|
||||
arr.push(salutation);
|
||||
}
|
||||
|
||||
if (first) {
|
||||
arr.push(first);
|
||||
}
|
||||
|
||||
if (middle) {
|
||||
arr.push(middle);
|
||||
}
|
||||
|
||||
if (last) {
|
||||
arr.push(last);
|
||||
}
|
||||
|
||||
value = arr.join(' ');
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
if (salutation) value += salutation;
|
||||
if (first) value += ' ' + first;
|
||||
if (last) value += ' ' + last;
|
||||
if (salutation) {
|
||||
value += salutation;
|
||||
}
|
||||
|
||||
if (first) {
|
||||
value += ' ' + first;
|
||||
}
|
||||
|
||||
if (last) {
|
||||
value += ' ' + last;
|
||||
}
|
||||
}
|
||||
|
||||
value = value.trim();
|
||||
@@ -157,10 +213,12 @@ define('views/fields/person-name', 'views/fields/varchar', function (Dep) {
|
||||
_getTemplateName: function () {
|
||||
if (this.mode == 'edit') {
|
||||
var prop = 'editTemplate' + Espo.Utils.upperCaseFirst(this.getFormat().toString());
|
||||
|
||||
if (prop in this) {
|
||||
return this[prop];
|
||||
}
|
||||
}
|
||||
|
||||
return Dep.prototype._getTemplateName.call(this);
|
||||
},
|
||||
|
||||
@@ -179,34 +237,44 @@ define('views/fields/person-name', 'views/fields/varchar', function (Dep) {
|
||||
validateRequired: function () {
|
||||
var isRequired = this.isRequired();
|
||||
|
||||
var validate = function (name) {
|
||||
var validate = (name) => {
|
||||
if (this.model.isRequired(name)) {
|
||||
if (!this.model.get(name)) {
|
||||
var msg = this.translate('fieldIsRequired', 'messages').replace('{field}', this.translate(name, 'fields', this.model.name));
|
||||
var msg = this.translate('fieldIsRequired', 'messages')
|
||||
.replace('{field}', this.translate(name, 'fields', this.model.name));
|
||||
this.showValidationMessage(msg, '[data-name="'+name+'"]');
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}.bind(this);
|
||||
};
|
||||
|
||||
if (isRequired) {
|
||||
if (!this.model.get(this.firstField) && !this.model.get(this.lastField)) {
|
||||
var msg = this.translate('fieldIsRequired', 'messages').replace('{field}', this.getLabelText());
|
||||
var msg = this.translate('fieldIsRequired', 'messages')
|
||||
.replace('{field}', this.getLabelText());
|
||||
|
||||
this.showValidationMessage(msg, '[data-name="'+this.lastField+'"]');
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
var result = false;
|
||||
|
||||
result = validate(this.salutationField) || result;
|
||||
result = validate(this.firstField) || result;
|
||||
result = validate(this.lastField) || result;
|
||||
result = validate(this.middleField) || result;
|
||||
|
||||
return result;
|
||||
},
|
||||
|
||||
hasRequiredMarker: function () {
|
||||
if (this.isRequired()) return true;
|
||||
if (this.isRequired()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return this.model.getFieldParam(this.salutationField, 'required') ||
|
||||
this.model.getFieldParam(this.firstField, 'required') ||
|
||||
this.model.getFieldParam(this.middleField, 'required') ||
|
||||
@@ -215,6 +283,7 @@ define('views/fields/person-name', 'views/fields/varchar', function (Dep) {
|
||||
|
||||
fetch: function (form) {
|
||||
var data = {};
|
||||
|
||||
data[this.salutationField] = this.$salutation.val() || null;
|
||||
data[this.firstField] = this.$first.val().trim() || null;
|
||||
data[this.lastField] = this.$last.val().trim() || null;
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
define('views/fields/phone', 'views/fields/varchar', function (Dep) {
|
||||
define('views/fields/phone', ['views/fields/varchar'], function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
@@ -42,9 +42,12 @@ define('views/fields/phone', 'views/fields/varchar', function (Dep) {
|
||||
|
||||
validateRequired: function () {
|
||||
if (this.isRequired()) {
|
||||
if (!this.model.get(this.name) || !this.model.get(this.name) === '') {
|
||||
var msg = this.translate('fieldIsRequired', 'messages').replace('{field}', this.getLabelText());
|
||||
if (!this.model.get(this.name)) {
|
||||
var msg = this.translate('fieldIsRequired', 'messages')
|
||||
.replace('{field}', this.getLabelText());
|
||||
|
||||
this.showValidationMessage(msg, 'div.phone-number-block:nth-child(1) input');
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -52,23 +55,33 @@ define('views/fields/phone', 'views/fields/varchar', function (Dep) {
|
||||
|
||||
validatePhoneData: function () {
|
||||
var data = this.model.get(this.dataFieldName);
|
||||
if (!data || !data.length) return;
|
||||
|
||||
if (!data || !data.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
var numberList = [];
|
||||
|
||||
var notValid = false;
|
||||
data.forEach(function (row, i) {
|
||||
|
||||
data.forEach((row, i) => {
|
||||
var number = row.phoneNumber;
|
||||
var numberClean = String(number).replace(/[\s\+]/g, '');
|
||||
|
||||
if (~numberList.indexOf(numberClean)) {
|
||||
var msg = this.translate('fieldValueDuplicate', 'messages').replace('{field}', this.getLabelText());
|
||||
this.showValidationMessage(msg, 'div.phone-number-block:nth-child(' + (i + 1).toString() + ') input');
|
||||
var msg = this.translate('fieldValueDuplicate', 'messages')
|
||||
.replace('{field}', this.getLabelText());
|
||||
|
||||
this.showValidationMessage(msg, 'div.phone-number-block:nth-child(' + (i + 1)
|
||||
.toString() + ') input');
|
||||
|
||||
notValid = true;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
numberList.push(numberClean);
|
||||
}, this);
|
||||
});
|
||||
|
||||
if (notValid) {
|
||||
return true;
|
||||
}
|
||||
@@ -76,23 +89,26 @@ define('views/fields/phone', 'views/fields/varchar', function (Dep) {
|
||||
|
||||
data: function () {
|
||||
var phoneNumberData;
|
||||
if (this.mode == 'edit') {
|
||||
|
||||
if (this.mode === 'edit') {
|
||||
phoneNumberData = Espo.Utils.cloneDeep(this.model.get(this.dataFieldName));
|
||||
|
||||
if (this.model.isNew() || !this.model.get(this.name)) {
|
||||
if (!phoneNumberData || !phoneNumberData.length) {
|
||||
var optOut = false;
|
||||
|
||||
if (this.model.isNew()) {
|
||||
optOut = this.phoneNumberOptedOutByDefault && this.model.name !== 'User';
|
||||
} else {
|
||||
optOut = this.model.get(this.isOptedOutFieldName)
|
||||
}
|
||||
|
||||
phoneNumberData = [{
|
||||
phoneNumber: this.model.get(this.name) || '',
|
||||
primary: true,
|
||||
type: this.defaultType,
|
||||
optOut: optOut,
|
||||
invalid: false
|
||||
invalid: false,
|
||||
}];
|
||||
}
|
||||
}
|
||||
@@ -102,14 +118,18 @@ define('views/fields/phone', 'views/fields/varchar', function (Dep) {
|
||||
|
||||
if (phoneNumberData) {
|
||||
phoneNumberData = Espo.Utils.cloneDeep(phoneNumberData);
|
||||
phoneNumberData.forEach(function (item) {
|
||||
|
||||
phoneNumberData.forEach((item) => {
|
||||
var number = item.phoneNumber || '';
|
||||
|
||||
item.erased = number.indexOf(this.erasedPlaceholder) === 0;
|
||||
|
||||
if (!item.erased) {
|
||||
item.valueForLink = number.replace(/ /g, '');
|
||||
}
|
||||
|
||||
item.lineThrough = item.optOut || item.invalid || this.model.get('doNotCall');
|
||||
}, this);
|
||||
});
|
||||
}
|
||||
|
||||
if ((!phoneNumberData || phoneNumberData.length === 0) && this.model.get(this.name)) {
|
||||
@@ -131,17 +151,20 @@ define('views/fields/phone', 'views/fields/varchar', function (Dep) {
|
||||
var data = _.extend({
|
||||
phoneNumberData: phoneNumberData,
|
||||
doNotCall: this.model.get('doNotCall'),
|
||||
lineThrough: this.model.get('doNotCall') || this.model.get(this.isOptedOutFieldName)
|
||||
lineThrough: this.model.get('doNotCall') || this.model.get(this.isOptedOutFieldName),
|
||||
}, Dep.prototype.data.call(this));
|
||||
|
||||
if (this.isReadMode()) {
|
||||
data.isOptedOut = this.model.get(this.isOptedOutFieldName);
|
||||
|
||||
if (this.model.get(this.name)) {
|
||||
data.isErased = this.model.get(this.name).indexOf(this.erasedPlaceholder) === 0;
|
||||
|
||||
if (!data.isErased) {
|
||||
data.valueForLink = this.model.get(this.name).replace(/ /g, '');
|
||||
}
|
||||
}
|
||||
|
||||
data.valueIsSet = this.model.has(this.name);
|
||||
}
|
||||
|
||||
@@ -156,31 +179,36 @@ define('views/fields/phone', 'views/fields/varchar', function (Dep) {
|
||||
var $block = $(e.currentTarget).closest('div.phone-number-block');
|
||||
var property = $target.data('property-type');
|
||||
|
||||
|
||||
if (property == 'primary') {
|
||||
if (property === 'primary') {
|
||||
if (!$target.hasClass('active')) {
|
||||
if ($block.find('input.phone-number').val() != '') {
|
||||
this.$el.find('button.phone-property[data-property-type="primary"]').removeClass('active').children().addClass('text-muted');
|
||||
if ($block.find('input.phone-number').val() !== '') {
|
||||
this.$el.find('button.phone-property[data-property-type="primary"]')
|
||||
.removeClass('active').children().addClass('text-muted');
|
||||
|
||||
$target.addClass('active').children().removeClass('text-muted');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if ($target.hasClass('active')) {
|
||||
$target.removeClass('active').children().addClass('text-muted');
|
||||
} else {
|
||||
$target.addClass('active').children().removeClass('text-muted');
|
||||
}
|
||||
}
|
||||
|
||||
this.trigger('change');
|
||||
},
|
||||
|
||||
'click [data-action="removePhoneNumber"]': function (e) {
|
||||
var $block = $(e.currentTarget).closest('div.phone-number-block');
|
||||
if ($block.parent().children().length == 1) {
|
||||
|
||||
if ($block.parent().children().length === 1) {
|
||||
$block.find('input.phone-number').val('');
|
||||
} else {
|
||||
this.removePhoneNumberBlock($block);
|
||||
}
|
||||
|
||||
this.trigger('change');
|
||||
},
|
||||
|
||||
@@ -189,7 +217,7 @@ define('views/fields/phone', 'views/fields/varchar', function (Dep) {
|
||||
var $block = $input.closest('div.phone-number-block');
|
||||
|
||||
if ($input.val() == '') {
|
||||
if ($block.parent().children().length == 1) {
|
||||
if ($block.parent().children().length === 1) {
|
||||
$block.find('input.phone-number').val('');
|
||||
} else {
|
||||
this.removePhoneNumberBlock($block);
|
||||
@@ -216,7 +244,7 @@ define('views/fields/phone', 'views/fields/varchar', function (Dep) {
|
||||
|
||||
o = {
|
||||
phoneNumber: '',
|
||||
primary: data.length ? false : true,
|
||||
primary: !data.length,
|
||||
type: false,
|
||||
optOut: this.emailAddressOptedOutByDefault,
|
||||
invalid: false,
|
||||
@@ -243,7 +271,11 @@ define('views/fields/phone', 'views/fields/varchar', function (Dep) {
|
||||
$block.remove();
|
||||
|
||||
if (changePrimary) {
|
||||
this.$el.find('button[data-property-type="primary"]').first().addClass('active').children().removeClass('text-muted');
|
||||
this.$el.find('button[data-property-type="primary"]')
|
||||
.first()
|
||||
.addClass('active')
|
||||
.children()
|
||||
.removeClass('text-muted');
|
||||
}
|
||||
|
||||
this.manageButtonsVisibility();
|
||||
@@ -260,15 +292,20 @@ define('views/fields/phone', 'views/fields/varchar', function (Dep) {
|
||||
});
|
||||
|
||||
if (c == $input.length) {
|
||||
this.$el.find('[data-action="addPhoneNumber"]').removeClass('disabled').removeAttr('disabled');
|
||||
this.$el.find('[data-action="addPhoneNumber"]')
|
||||
.removeClass('disabled')
|
||||
.removeAttr('disabled');
|
||||
} else {
|
||||
this.$el.find('[data-action="addPhoneNumber"]').addClass('disabled').attr('disabled', 'disabled');
|
||||
this.$el.find('[data-action="addPhoneNumber"]')
|
||||
.addClass('disabled')
|
||||
.attr('disabled', 'disabled');
|
||||
}
|
||||
},
|
||||
|
||||
manageButtonsVisibility: function () {
|
||||
var $primary = this.$el.find('button[data-property-type="primary"]');
|
||||
var $remove = this.$el.find('button[data-action="removePhoneNumber"]');
|
||||
|
||||
if ($primary.length > 1) {
|
||||
$primary.removeClass('hidden');
|
||||
$remove.removeClass('hidden');
|
||||
@@ -280,23 +317,32 @@ define('views/fields/phone', 'views/fields/varchar', function (Dep) {
|
||||
|
||||
setup: function () {
|
||||
this.dataFieldName = this.name + 'Data';
|
||||
this.defaultType = this.defaultType || this.getMetadata().get('entityDefs.' + this.model.name + '.fields.' + this.name + '.defaultType');
|
||||
this.defaultType = this.defaultType ||
|
||||
this.getMetadata()
|
||||
.get('entityDefs.' + this.model.name + '.fields.' + this.name + '.defaultType');
|
||||
|
||||
this.isOptedOutFieldName = this.name + 'IsOptedOut';
|
||||
|
||||
this.phoneNumberOptedOutByDefault = this.getConfig().get('phoneNumberIsOptedOutByDefault');
|
||||
|
||||
if (this.model.has('doNotCall')) {
|
||||
this.listenTo(this.model, 'change:doNotCall', function (model, value, o) {
|
||||
if (this.mode !== 'detail' && this.mode !== 'list') return;
|
||||
if (!o.ui) return;
|
||||
this.listenTo(this.model, 'change:doNotCall', (model, value, o) => {
|
||||
if (this.mode !== 'detail' && this.mode !== 'list') {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!o.ui) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.reRender();
|
||||
}, this);
|
||||
});
|
||||
}
|
||||
|
||||
this.erasedPlaceholder = 'ERASED:';
|
||||
|
||||
this.itemMaxLength = this.getMetadata().get(['entityDefs', 'PhoneNumber', 'fields', 'name', 'maxLength']);
|
||||
this.itemMaxLength = this.getMetadata()
|
||||
.get(['entityDefs', 'PhoneNumber', 'fields', 'name', 'maxLength']);
|
||||
},
|
||||
|
||||
fetchPhoneNumberData: function () {
|
||||
@@ -305,19 +351,23 @@ define('views/fields/phone', 'views/fields/varchar', function (Dep) {
|
||||
var $list = this.$el.find('div.phone-number-block');
|
||||
|
||||
if ($list.length) {
|
||||
$list.each(function (i, d) {
|
||||
$list.each((i, d) => {
|
||||
var row = {};
|
||||
var $d = $(d);
|
||||
|
||||
row.phoneNumber = $d.find('input.phone-number').val().trim();
|
||||
|
||||
if (row.phoneNumber == '') {
|
||||
return;
|
||||
}
|
||||
|
||||
row.primary = $d.find('button[data-property-type="primary"]').hasClass('active');
|
||||
row.type = $d.find('select[data-property-type="type"]').val();
|
||||
row.optOut = $d.find('button[data-property-type="optOut"]').hasClass('active');
|
||||
row.invalid = $d.find('button[data-property-type="invalid"]').hasClass('active');
|
||||
|
||||
data.push(row);
|
||||
}.bind(this));
|
||||
});
|
||||
}
|
||||
|
||||
return data;
|
||||
@@ -332,18 +382,20 @@ define('views/fields/phone', 'views/fields/varchar', function (Dep) {
|
||||
data[this.isOptedOutFieldName] = false;
|
||||
|
||||
var primaryIndex = 0;
|
||||
addressData.forEach(function (item, i) {
|
||||
|
||||
addressData.forEach((item, i) => {
|
||||
if (item.primary) {
|
||||
primaryIndex = i;
|
||||
|
||||
if (item.optOut) {
|
||||
data[this.isOptedOutFieldName] = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}, this);
|
||||
});
|
||||
|
||||
if (addressData.length && primaryIndex > 0) {
|
||||
var t = addressData[0];
|
||||
|
||||
addressData[0] = addressData[primaryIndex];
|
||||
addressData[primaryIndex] = t;
|
||||
}
|
||||
@@ -355,7 +407,6 @@ define('views/fields/phone', 'views/fields/varchar', function (Dep) {
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
define('views/fields/range-currency', 'views/fields/range-float', function (Dep, Float) {
|
||||
define('views/fields/range-currency', ['views/fields/range-float'], function (Dep, Float) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
@@ -38,7 +38,8 @@ define('views/fields/range-currency', 'views/fields/range-float', function (Dep,
|
||||
return _.extend({
|
||||
currencyField: this.currencyField,
|
||||
currencyValue: this.model.get(this.fromCurrencyField) ||
|
||||
this.getPreferences().get('defaultCurrency') || this.getConfig().get('defaultCurrency'),
|
||||
this.getPreferences().get('defaultCurrency') ||
|
||||
this.getConfig().get('defaultCurrency'),
|
||||
currencyOptions: this.currencyOptions,
|
||||
currencyList: this.currencyList
|
||||
}, Dep.prototype.data.call(this));
|
||||
@@ -68,10 +69,11 @@ define('views/fields/range-currency', 'views/fields/range-float', function (Dep,
|
||||
var fromValue = this.model.get(this.fromField);
|
||||
var toValue = this.model.get(this.toField);
|
||||
|
||||
var fromValue = isNaN(fromValue) ? null : fromValue;
|
||||
var toValue = isNaN(toValue) ? null : toValue;
|
||||
fromValue = isNaN(fromValue) ? null : fromValue;
|
||||
toValue = isNaN(toValue) ? null : toValue;
|
||||
|
||||
var currencyValue = this.model.get(this.fromCurrencyField) || this.model.get(this.toCurrencyField);
|
||||
var currencyValue = this.model.get(this.fromCurrencyField) ||
|
||||
this.model.get(this.toCurrencyField);
|
||||
|
||||
if (fromValue !== null && toValue !== null) {
|
||||
return this.formatNumber(fromValue) + ' – ' +
|
||||
@@ -109,8 +111,6 @@ define('views/fields/range-currency', 'views/fields/range-float', function (Dep,
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -69,7 +69,6 @@ define('views/fields/range-float', ['views/fields/range-int', 'views/fields/floa
|
||||
formatNumberEdit: function (value) {
|
||||
return Float.prototype.formatNumberEdit.call(this, value);
|
||||
},
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -63,8 +63,8 @@ define('views/fields/range-int', ['views/fields/base', 'views/fields/int'], func
|
||||
var fromValue = this.model.get(this.fromField);
|
||||
var toValue = this.model.get(this.toField);
|
||||
|
||||
var fromValue = isNaN(fromValue) ? null : fromValue;
|
||||
var toValue = isNaN(toValue) ? null : toValue;
|
||||
fromValue = isNaN(fromValue) ? null : fromValue;
|
||||
toValue = isNaN(toValue) ? null : toValue;
|
||||
|
||||
if (fromValue !== null && toValue !== null) {
|
||||
return this.formatNumber(fromValue) + ' – ' + this.formatNumber(toValue);
|
||||
@@ -121,7 +121,8 @@ define('views/fields/range-int', ['views/fields/base', 'views/fields/int'], func
|
||||
var validate = (name) => {
|
||||
if (this.model.isRequired(name)) {
|
||||
if (this.model.get(name) === null) {
|
||||
var msg = this.translate('fieldIsRequired', 'messages').replace('{field}', this.getLabelText());
|
||||
var msg = this.translate('fieldIsRequired', 'messages')
|
||||
.replace('{field}', this.getLabelText());
|
||||
|
||||
this.showValidationMessage(msg, '[data-name="'+name+'"]');
|
||||
|
||||
@@ -141,7 +142,8 @@ define('views/fields/range-int', ['views/fields/base', 'views/fields/int'], func
|
||||
validateInt: function () {
|
||||
var validate = (name) => {
|
||||
if (isNaN(this.model.get(name))) {
|
||||
var msg = this.translate('fieldShouldBeInt', 'messages').replace('{field}', this.getLabelText());
|
||||
var msg = this.translate('fieldShouldBeInt', 'messages')
|
||||
.replace('{field}', this.getLabelText());
|
||||
|
||||
this.showValidationMessage(msg, '[data-name="'+name+'"]');
|
||||
|
||||
@@ -240,7 +242,6 @@ define('views/fields/range-int', ['views/fields/base', 'views/fields/int'], func
|
||||
|
||||
formatNumber: function (value) {
|
||||
return value;
|
||||
//return Int.prototype.formatNumber.call(this, value);
|
||||
},
|
||||
|
||||
fetch: function (form) {
|
||||
|
||||
@@ -26,20 +26,20 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
Espo.define('views/fields/teams', 'views/fields/link-multiple', function (Dep) {
|
||||
define('views/fields/teams', ['views/fields/link-multiple'], function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
init: function () {
|
||||
this.assignmentPermission = this.getAcl().get('assignmentPermission');
|
||||
|
||||
Dep.prototype.init.call(this);
|
||||
},
|
||||
|
||||
getSelectBoolFilterList: function () {
|
||||
if (this.assignmentPermission == 'team' || this.assignmentPermission == 'no') {
|
||||
if (this.assignmentPermission === 'team' || this.assignmentPermission === 'no') {
|
||||
return ['onlyMy'];
|
||||
}
|
||||
},
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@@ -26,9 +26,17 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
define('views/fields/text', 'views/fields/base', function (Dep) {
|
||||
define('views/fields/text', ['views/fields/base'], function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
/**
|
||||
* A text field.
|
||||
*
|
||||
* @class
|
||||
* @name Class
|
||||
* @extends module:views/fields/base.Class
|
||||
* @memberOf module:views/fields/text
|
||||
*/
|
||||
return Dep.extend(/** @lends module:views/fields/text.Class# */{
|
||||
|
||||
type: 'text',
|
||||
|
||||
@@ -78,11 +86,8 @@ define('views/fields/text', 'views/fields/base', function (Dep) {
|
||||
Dep.prototype.setup.call(this);
|
||||
|
||||
this.params.rows = this.params.rows || this.rowsDefault;
|
||||
|
||||
this.noResize = this.options.noResize || this.params.noResize || this.noResize;
|
||||
|
||||
this.seeMoreDisabled = this.seeMoreDisabled || this.params.seeMoreDisabled;
|
||||
|
||||
this.autoHeightDisabled = this.options.autoHeightDisabled || this.params.autoHeightDisabled ||
|
||||
this.autoHeightDisabled;
|
||||
|
||||
@@ -245,6 +250,7 @@ define('views/fields/text', 'views/fields/base', function (Dep) {
|
||||
this.$element.val(text);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.mode === 'search') {
|
||||
var type = this.$el.find('select.search-type').val();
|
||||
|
||||
@@ -342,7 +348,8 @@ define('views/fields/text', 'views/fields/base', function (Dep) {
|
||||
},
|
||||
|
||||
getSearchType: function () {
|
||||
return this.getSearchParamsData().type || this.searchParams.typeFront || this.searchParams.type;
|
||||
return this.getSearchParamsData().type || this.searchParams.typeFront ||
|
||||
this.searchParams.type;
|
||||
},
|
||||
|
||||
mailTo: function (emailAddress) {
|
||||
@@ -359,7 +366,8 @@ define('views/fields/text', 'views/fields/base', function (Dep) {
|
||||
require('email-helper', (EmailHelper) => {
|
||||
var emailHelper = new EmailHelper();
|
||||
|
||||
var link = emailHelper.composeMailToLink(attributes, this.getConfig().get('outboundEmailBccAddress'));
|
||||
var link = emailHelper
|
||||
.composeMailToLink(attributes, this.getConfig().get('outboundEmailBccAddress'));
|
||||
|
||||
document.location.href = link;
|
||||
});
|
||||
@@ -374,11 +382,10 @@ define('views/fields/text', 'views/fields/base', function (Dep) {
|
||||
|
||||
this.createView('quickCreate', viewName, {
|
||||
attributes: attributes,
|
||||
}, function (view) {
|
||||
}, (view) => {
|
||||
view.render();
|
||||
view.notify(false);
|
||||
});
|
||||
},
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@@ -101,6 +101,5 @@ define('views/fields/url', ['views/fields/varchar', 'lib!underscore'], function
|
||||
|
||||
return data;
|
||||
},
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
define('views/fields/user-with-avatar', 'views/fields/user', function (Dep) {
|
||||
define('views/fields/user-with-avatar',[ 'views/fields/user'], function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
@@ -46,8 +46,8 @@ define('views/fields/user-with-avatar', 'views/fields/user', function (Dep) {
|
||||
},
|
||||
|
||||
getAvatarHtml: function () {
|
||||
return this.getHelper().getAvatarHtml(this.model.get(this.idName), 'small', 14, 'avatar-link');
|
||||
return this.getHelper()
|
||||
.getAvatarHtml(this.model.get(this.idName), 'small', 14, 'avatar-link');
|
||||
},
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
define('views/fields/user', 'views/fields/link', function (Dep) {
|
||||
define('views/fields/user',[ 'views/fields/link'], function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
@@ -103,54 +103,55 @@ define('views/fields/user', 'views/fields/link', function (Dep) {
|
||||
var $elemeneTeams = this.$el.find('input.element-teams');
|
||||
|
||||
$elemeneTeams.autocomplete({
|
||||
serviceUrl: function (q) {
|
||||
serviceUrl: (q) => {
|
||||
return 'Team?&maxSize=' + this.getAutocompleteMaxCount() + '&select=id,name';
|
||||
}.bind(this),
|
||||
},
|
||||
minChars: 1,
|
||||
triggerSelectOnValidInput: false,
|
||||
paramName: 'q',
|
||||
noCache: true,
|
||||
formatResult: function (suggestion) {
|
||||
formatResult: (suggestion) => {
|
||||
return this.getHelper().escapeString(suggestion.name);
|
||||
}.bind(this),
|
||||
transformResult: function (response) {
|
||||
},
|
||||
transformResult: (response) => {
|
||||
var response = JSON.parse(response);
|
||||
var list = [];
|
||||
response.list.forEach(function(item) {
|
||||
|
||||
response.list.forEach(item => {
|
||||
list.push({
|
||||
id: item.id,
|
||||
name: item.name,
|
||||
data: item.id,
|
||||
value: item.name
|
||||
});
|
||||
}, this);
|
||||
});
|
||||
|
||||
return {
|
||||
suggestions: list
|
||||
};
|
||||
}.bind(this),
|
||||
onSelect: function (s) {
|
||||
},
|
||||
onSelect: (s) => {
|
||||
this.addLinkTeams(s.id, s.name);
|
||||
|
||||
$elemeneTeams.val('');
|
||||
}.bind(this)
|
||||
},
|
||||
});
|
||||
|
||||
$elemeneTeams.attr('autocomplete', 'espo-' + this.name);
|
||||
|
||||
this.once('render', function () {
|
||||
this.once('render', () => {
|
||||
$elemeneTeams.autocomplete('dispose');
|
||||
}, this);
|
||||
});
|
||||
|
||||
this.once('remove', function () {
|
||||
this.once('remove', () => {
|
||||
$elemeneTeams.autocomplete('dispose');
|
||||
}, this);
|
||||
});
|
||||
|
||||
var type = this.$el.find('select.search-type').val();
|
||||
|
||||
if (type === 'isFromTeams') {
|
||||
this.searchData.teamIdList.forEach(function (id) {
|
||||
this.searchData.teamIdList.forEach(id => {
|
||||
this.addLinkTeamsHtml(id, this.searchData.teamNameHash[id]);
|
||||
}, this);
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -208,17 +209,16 @@ define('views/fields/user', 'views/fields/link', function (Dep) {
|
||||
var type = this.$el.find('select.search-type').val();
|
||||
|
||||
if (type === 'isFromTeams') {
|
||||
var data = {
|
||||
return {
|
||||
type: 'isUserFromTeams',
|
||||
field: this.name,
|
||||
value: this.searchData.teamIdList,
|
||||
data: {
|
||||
type: type,
|
||||
teamIdList: this.searchData.teamIdList,
|
||||
teamNameHash: this.searchData.teamNameHash
|
||||
teamNameHash: this.searchData.teamNameHash,
|
||||
}
|
||||
};
|
||||
return data;
|
||||
}
|
||||
|
||||
return Dep.prototype.fetchSearch.call(this);
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
define('views/fields/users', 'views/fields/link-multiple', function (Dep) {
|
||||
define('views/fields/users', ['views/fields/link-multiple'], function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
@@ -49,8 +49,5 @@ define('views/fields/users', 'views/fields/link-multiple', function (Dep) {
|
||||
getSelectPrimaryFilterName: function () {
|
||||
return 'active';
|
||||
},
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
Espo.define('views/fields/varchar-column', 'views/fields/varchar', function (Dep) {
|
||||
define('views/fields/varchar-column', ['views/fields/varchar'], function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
@@ -38,7 +38,7 @@ Espo.define('views/fields/varchar-column', 'views/fields/varchar', function (Dep
|
||||
var data;
|
||||
|
||||
if (~['isEmpty', 'isNotEmpty'].indexOf(type)) {
|
||||
if (type == 'isEmpty') {
|
||||
if (type === 'isEmpty') {
|
||||
data = {
|
||||
typeFront: type,
|
||||
where: {
|
||||
@@ -76,10 +76,15 @@ Espo.define('views/fields/varchar-column', 'views/fields/varchar', function (Dep
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return data;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
|
||||
var value = this.$element.val().toString().trim();
|
||||
|
||||
value = value.trim();
|
||||
|
||||
if (value) {
|
||||
data = {
|
||||
value: value,
|
||||
@@ -89,12 +94,13 @@ Espo.define('views/fields/varchar-column', 'views/fields/varchar', function (Dep
|
||||
value: value
|
||||
}
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -28,7 +28,15 @@
|
||||
|
||||
define('views/fields/varchar', ['views/fields/base'], function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
/**
|
||||
* A varchar field.
|
||||
*
|
||||
* @class
|
||||
* @name Class
|
||||
* @extends module:views/fields/base.Class
|
||||
* @memberOf module:views/fields/varchar
|
||||
*/
|
||||
return Dep.extend(/** @lends module:views/fields/varchar.Class# */{
|
||||
|
||||
type: 'varchar',
|
||||
|
||||
@@ -43,7 +51,13 @@ define('views/fields/varchar', ['views/fields/base'], function (Dep) {
|
||||
'notEquals', 'notLike', 'isEmpty', 'isNotEmpty',
|
||||
],
|
||||
|
||||
useAutocompleteUrl: null,
|
||||
/**
|
||||
* Use an autocomplete requesting data from the backend.
|
||||
*
|
||||
* @protected
|
||||
* @type {boolean}
|
||||
*/
|
||||
useAutocompleteUrl: false,
|
||||
|
||||
setup: function () {
|
||||
this.setupOptions();
|
||||
@@ -53,9 +67,17 @@ define('views/fields/varchar', ['views/fields/base'], function (Dep) {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Set up options.
|
||||
*/
|
||||
setupOptions: function () {
|
||||
},
|
||||
|
||||
/**
|
||||
* Set options.
|
||||
*
|
||||
* @param {string[]} optionList Options.
|
||||
*/
|
||||
setOptionList: function (optionList) {
|
||||
if (!this.originalOptionList) {
|
||||
this.originalOptionList = this.params.options || [];
|
||||
@@ -70,6 +92,9 @@ define('views/fields/varchar', ['views/fields/base'], function (Dep) {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Reset options.
|
||||
*/
|
||||
resetOptionList: function () {
|
||||
if (this.originalOptionList) {
|
||||
this.params.options = Espo.Utils.clone(this.originalOptionList);
|
||||
@@ -82,7 +107,15 @@ define('views/fields/varchar', ['views/fields/base'], function (Dep) {
|
||||
}
|
||||
},
|
||||
|
||||
getAutocompleteUrl: function (q) {},
|
||||
/**
|
||||
* Compose an autocomplete URL.
|
||||
*
|
||||
* @param {string} q A query.
|
||||
* @return {string}
|
||||
*/
|
||||
getAutocompleteUrl: function (q) {
|
||||
return '';
|
||||
},
|
||||
|
||||
transformAutocompleteResult: function (response) {
|
||||
let responseParsed = JSON.parse(response);
|
||||
@@ -115,11 +148,10 @@ define('views/fields/varchar', ['views/fields/base'], function (Dep) {
|
||||
|
||||
data: function () {
|
||||
var data = Dep.prototype.data.call(this);
|
||||
|
||||
if (
|
||||
this.model.get(this.name) !== null
|
||||
&&
|
||||
this.model.get(this.name) !== ''
|
||||
&&
|
||||
this.model.get(this.name) !== null &&
|
||||
this.model.get(this.name) !== '' &&
|
||||
this.model.has(this.name)
|
||||
) {
|
||||
data.isNotEmpty = true;
|
||||
@@ -190,7 +222,8 @@ define('views/fields/varchar', ['views/fields/base'], function (Dep) {
|
||||
|
||||
if (this.useAutocompleteUrl) {
|
||||
autocompleteOptions.serviceUrl = q => this.getAutocompleteUrl(q);
|
||||
autocompleteOptions.transformResult = response => this.transformAutocompleteResult(response);
|
||||
autocompleteOptions.transformResult = response =>
|
||||
this.transformAutocompleteResult(response);
|
||||
autocompleteOptions.noCache = true;
|
||||
autocompleteOptions.lookup = null;
|
||||
}
|
||||
@@ -313,8 +346,8 @@ define('views/fields/varchar', ['views/fields/base'], function (Dep) {
|
||||
},
|
||||
|
||||
getSearchType: function () {
|
||||
return this.getSearchParamsData().type || this.searchParams.typeFront || this.searchParams.type;
|
||||
return this.getSearchParamsData().type || this.searchParams.typeFront ||
|
||||
this.searchParams.type;
|
||||
},
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@@ -28,7 +28,15 @@
|
||||
|
||||
define('views/fields/wysiwyg', ['views/fields/text', 'lib!Summernote'], function (Dep, Summernote) {
|
||||
|
||||
return Dep.extend({
|
||||
/**
|
||||
* A wysiwyg field.
|
||||
*
|
||||
* @class
|
||||
* @name Class
|
||||
* @extends module:views/fields/base.Class
|
||||
* @memberOf module:views/fields/wysiwyg
|
||||
*/
|
||||
return Dep.extend(/** @lends module:views/fields/wysiwyg.Class# */{
|
||||
|
||||
type: 'wysiwyg',
|
||||
|
||||
|
||||
Reference in New Issue
Block a user