This commit is contained in:
Yuri Kuznetsov
2024-08-04 14:07:11 +03:00
parent 9d297d5587
commit 8cc7adee3f
16 changed files with 284 additions and 281 deletions
@@ -26,13 +26,14 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
define('views/action-history-record/fields/target-type', ['views/fields/enum'], function (Dep) {
import EnumFieldView from 'views/fields/enum';
return Dep.extend({
export default class extends EnumFieldView {
setupOptions() {
super.setupOptions();
this.params.options = this.getMetadata().getScopeEntityList();
}
}
setupOptions: function () {
Dep.prototype.setupOptions.call(this);
this.params.options = this.getMetadata().getScopeEntityList();
},
});
});
@@ -26,38 +26,43 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
define('views/action-history-record/fields/target', ['views/fields/link-parent'], function (Dep) {
import LinkParentFieldView from 'views/fields/link-parent';
return Dep.extend({
class ActionHistoryRecordTargetFieldView extends LinkParentFieldView
{
displayScopeColorInListMode = true
displayScopeColorInListMode: true,
ignoreScopeList = [
'Preferences',
'ExternalAccount',
'Notification',
'Note',
'ArrayValue',
]
ignoreScopeList: ['Preferences', 'ExternalAccount', 'Notification', 'Note', 'ArrayValue'],
setup() {
super.setup();
setup: function () {
Dep.prototype.setup.call(this);
this.foreignScopeList = this.getMetadata().getScopeEntityList().filter(item => {
if (!this.getUser().isAdmin() && !this.getAcl().checkScopeHasAcl(item)) {
return false;
}
this.foreignScopeList = this.getMetadata().getScopeEntityList().filter(item => {
if (!this.getUser().isAdmin()) {
if (!this.getAcl().checkScopeHasAcl(item)) {
return;
}
}
if (this.ignoreScopeList.includes(item)) {
return false;
}
if (~this.ignoreScopeList.indexOf(item)) {
return;
}
if (!this.getAcl().checkScope(item)) {
return false;
}
if (!this.getAcl().checkScope(item)) {
return;
}
return true;
});
return true;
});
this.getLanguage().sortEntityList(this.foreignScopeList);
this.getLanguage().sortEntityList(this.foreignScopeList);
this.foreignScope = this.model.get(this.typeName) || this.foreignScopeList[0];
}
}
this.foreignScope = this.model.get(this.typeName) || this.foreignScopeList[0];
},
});
});
export default ActionHistoryRecordTargetFieldView;
@@ -26,15 +26,11 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
define('views/action-history-record/modals/detail', ['views/modals/detail'], function (Dep) {
import DetailModalView from 'views/modals/detail';
return Dep.extend({
fullFormDisabled: true,
editDisabled: true,
sideDisabled: true,
});
});
export default class extends DetailModalView {
fullFormDisabled = true
editDisabled = true
sideDisabled = true
}
@@ -26,12 +26,10 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
define('views/action-history-record/record/list', ['views/record/list'], function (Dep) {
import ListRecordView from 'views/record/list';
return Dep.extend({
export default class extends ListRecordView {
rowActionsView: 'views/record/row-actions/view-and-remove',
massActionList: ['remove', 'export'],
});
});
rowActionsView = 'views/record/row-actions/view-and-remove'
massActionList = ['remove', 'export']
}
+70 -68
View File
@@ -26,90 +26,92 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
define('views/address-map/view', ['views/main'], function (Dep) {
import MainView from 'views/main';
return Dep.extend({
class AddressMapView extends MainView {
templateContent: `
<div class="header page-header">{{{header}}}</div>
<div class="map-container">{{{map}}}</div>
`,
templateContent = `
<div class="header page-header">{{{header}}}</div>
<div class="map-container">{{{map}}}</div>
`
setup: function () {
this.scope = this.model.entityType;
setup() {
this.scope = this.model.entityType;
this.createView('header', 'views/header', {
model: this.model,
fullSelector: '#main > .header',
scope: this.model.entityType,
fontSizeFlexible: true,
});
},
this.createView('header', 'views/header', {
model: this.model,
fullSelector: '#main > .header',
scope: this.model.entityType,
fontSizeFlexible: true,
});
}
afterRender: function () {
var field = this.options.field;
afterRender() {
const field = this.options.field;
var viewName = this.model.getFieldParam(field + 'Map', 'view') ||
this.getFieldManager().getViewName('map');
const viewName = this.model.getFieldParam(field + 'Map', 'view') ||
this.getFieldManager().getViewName('map');
this.createView('map', viewName, {
model: this.model,
name: field + 'Map',
selector: '.map-container',
height: this.getHelper().calculateContentContainerHeight(this.$el.find('.map-container')),
}, (view) => {
view.render();
});
},
this.createView('map', viewName, {
model: this.model,
name: field + 'Map',
selector: '.map-container',
height: this.getHelper().calculateContentContainerHeight(this.$el.find('.map-container')),
}, view => {
view.render();
});
}
getHeader: function () {
let name = this.model.get('name');
getHeader() {
let name = this.model.get('name');
if (!name) {
name = this.model.id;
}
if (!name) {
name = this.model.id;
}
let recordUrl = '#' + this.model.entityType + '/view/' + this.model.id
let scopeLabel = this.getLanguage().translate(this.model.entityType, 'scopeNamesPlural');
let fieldLabel = this.translate(this.options.field, 'fields', this.model.entityType);
let rootUrl = this.options.rootUrl ||
this.options.params.rootUrl ||
'#' + this.model.entityType;
const recordUrl = `#${this.model.entityType}/view/${this.model.id}`;
const scopeLabel = this.getLanguage().translate(this.model.entityType, 'scopeNamesPlural');
const fieldLabel = this.translate(this.options.field, 'fields', this.model.entityType);
let $name = $('<a>')
.attr('href', recordUrl)
.append(
$('<span>')
const rootUrl = this.options.rootUrl ||
this.options.params.rootUrl ||
'#' + this.model.entityType;
const $name = $('<a>')
.attr('href', recordUrl)
.append(
$('<span>')
.addClass('font-size-flexible title')
.text(name)
);
);
if (this.model.get('deleted')) {
$name.css('text-decoration', 'line-through');
}
if (this.model.get('deleted')) {
$name.css('text-decoration', 'line-through');
}
let $root = $('<span>')
.append(
$('<a>')
.attr('href', rootUrl)
.addClass('action')
.attr('data-action', 'navigateToRoot')
.text(scopeLabel)
);
const $root = $('<span>')
.append(
$('<a>')
.attr('href', rootUrl)
.addClass('action')
.attr('data-action', 'navigateToRoot')
.text(scopeLabel)
);
let headerIconHtml = this.getHeaderIconHtml();
const headerIconHtml = this.getHeaderIconHtml();
if (headerIconHtml) {
$root.prepend(headerIconHtml);
}
if (headerIconHtml) {
$root.prepend(headerIconHtml);
}
let $field = $('<span>').text(fieldLabel)
const $field = $('<span>').text(fieldLabel);
return this.buildHeaderHtml([
$root,
$name,
$field,
]);
},
});
});
return this.buildHeaderHtml([
$root,
$name,
$field,
]);
}
}
export default AddressMapView
+8 -13
View File
@@ -26,18 +26,13 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
define('views/api-user/list', ['views/list'], function (Dep) {
import ListView from 'views/list';
return Dep.extend({
export default class extends ListView {
setup: function () {
Dep.prototype.setup.call(this);
},
getCreateAttributes: function () {
return {
type: 'api',
};
},
});
});
getCreateAttributes() {
return {
type: 'api',
};
}
}
+13 -14
View File
@@ -26,24 +26,23 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
define('views/attachment/fields/name', ['views/fields/varchar'], function (Dep) {
import VarcharFieldView from 'views/fields/varchar';
return Dep.extend({
export default class extends VarcharFieldView {
detailTemplate: 'attachment/fields/name/detail',
detailTemplate = 'attachment/fields/name/detail'
data: function () {
var data = Dep.prototype.data.call(this);
data() {
const data = super.data();
var url = this.getBasePath() + '?entryPoint=download&id=' + this.model.id;
let url = this.getBasePath() + '?entryPoint=download&id=' + this.model.id;
if (this.getUser().get('portalId')) {
url += '&portalId=' + this.getUser().get('portalId');
}
if (this.getUser().get('portalId')) {
url += '&portalId=' + this.getUser().get('portalId');
}
data.url = url;
data.url = url;
return data;
},
});
});
return data;
}
}
+29 -32
View File
@@ -26,45 +26,42 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
define('views/attachment/fields/parent', ['views/fields/link-parent'], function (Dep) {
import LinkParentFieldView from 'views/fields/link-parent';
return Dep.extend({
export default class extends LinkParentFieldView {
ignoreScopeList: [
'Preferences',
'ExternalAccount',
'Notification',
'Note',
'ArrayValue',
'Attachment',
],
ignoreScopeList = [
'Preferences',
'ExternalAccount',
'Notification',
'Note',
'ArrayValue',
'Attachment',
]
displayEntityType: true,
displayEntityType = true
setup: function () {
Dep.prototype.setup.call(this);
setup() {
super.setup();
this.foreignScopeList = this.getMetadata().getScopeEntityList().filter(item => {
if (!this.getUser().isAdmin()) {
if (!this.getAcl().checkScopeHasAcl(item)) {
return;
}
}
this.foreignScopeList = this.getMetadata().getScopeEntityList().filter(item => {
if (!this.getUser().isAdmin() && !this.getAcl().checkScopeHasAcl(item)) {
return false;
}
if (~this.ignoreScopeList.indexOf(item)) {
return;
}
if (this.ignoreScopeList.includes(item)) {
return false;
}
if (!this.getAcl().checkScope(item)) {
return;
}
if (!this.getAcl().checkScope(item)) {
return false;
}
return true;
});
return true;
});
this.getLanguage().sortEntityList(this.foreignScopeList);
this.getLanguage().sortEntityList(this.foreignScopeList);
this.foreignScope = this.model.get(this.typeName) || this.foreignScopeList[0];
},
});
});
this.foreignScope = this.model.get(this.typeName) || this.foreignScopeList[0];
}
}
+4 -5
View File
@@ -26,10 +26,9 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
define('views/attachment/modals/detail', ['views/modals/detail'], function (Dep) {
import DetailModalView from 'views/modals/detail';
return Dep.extend({
export default class extends DetailModalView {
editDisabled: true,
});
});
editDisabled = true
}
@@ -26,31 +26,39 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
define('views/attachment/modals/select-one', ['views/modal'], function (Dep) {
import ModalView from 'views/modal';
return Dep.extend({
export default class extends ModalView {
backdrop: true,
backdrop = true
// language=Handlebars
templateContent:
'<ul class="list-group no-side-margin">{{#each viewObject.options.dataList}}'+
'<li class="list-group-item">'+
'<a role="button" class="action" data-action="select" data-id="{{id}}">{{name}}</a>'+
'</li>'+
'{{/each}}</ul>',
// language=Handlebars
templateContent =
`<ul class="list-group no-side-margin">
{{#each viewObject.options.dataList}}
<li class="list-group-item"
><a
role="button"
class="action"
data-action="select"
data-id="{{id}}"
>{{name}}</a></li>
{{/each}}
</ul>
`
setup: function () {
this.headerText = this.translate('Select');
setup() {
this.headerText = this.translate('Select');
if (this.options.fieldLabel) {
this.headerText += ': ' + this.options.fieldLabel;
}
},
if (this.options.fieldLabel) {
this.headerText += ': ' + this.options.fieldLabel;
}
}
actionSelect: function (data) {
this.trigger('select', data.id);
this.remove();
},
});
});
// noinspection JSUnusedGlobalSymbols
actionSelect(data) {
this.trigger('select', data.id);
this.remove();
}
}
+4 -5
View File
@@ -26,10 +26,9 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
define('views/attachment/record/detail', ['views/record/detail'], function (Dep) {
import DetailRecordView from 'views/record/detail';
return Dep.extend({
export default class extends DetailRecordView {
readOnly: true,
});
});
readOnly = true
}
+5 -6
View File
@@ -26,11 +26,10 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
define('views/attachment/record/list', ['views/record/list'], function (Dep) {
import ListRecordView from 'views/record/list';
return Dep.extend({
export default class extends ListRecordView {
rowActionsView: 'views/record/row-actions/view-and-remove',
massActionList: ['remove'],
});
});
rowActionsView = 'views/record/row-actions/view-and-remove'
massActionList = ['remove']
}
@@ -26,25 +26,24 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
define('views/authentication-provider/fields/method', ['views/fields/enum'], function (Dep) {
import EnumFieldView from 'views/fields/enum';
return Dep.extend({
export default class extends EnumFieldView {
setupOptions: function () {
/** @var {Object.<string, Object.<string, *>>} defs */
let defs = this.getMetadata().get(['authenticationMethods']) || {};
setupOptions() {
/** @var {Object.<string, Object.<string, *>>} defs */
const defs = this.getMetadata().get(['authenticationMethods']) || {};
let options = Object.keys(defs)
.filter(item => {
/** @var {Object.<string, *>} */
let data = defs[item].provider || {};
const options = Object.keys(defs)
.filter(item => {
/** @var {Record} */
const data = defs[item].provider || {};
return data.isAvailable;
});
return data.isAvailable;
});
options.unshift('');
options.unshift('');
this.params.options = options;
},
});
});
this.params.options = options;
}
}
@@ -26,37 +26,37 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
define('views/authentication-provider/record/detail', ['views/record/detail', 'helpers/misc/authentication-provider'],
function (Dep, Helper) {
import DetailRecordView from 'views/record/detail';
import Helper from 'helpers/misc/authentication-provider';
return Dep.extend({
export default class extends DetailRecordView {
editModeDisabled: true,
editModeDisabled = true
/**
* @private
* @type {module:helpers/misc/authentication-provider.Class}
*/
helper: null,
/**
* @private
* @type {Helper}
*/
helper
setup: function () {
this.helper = new Helper(this);
setup() {
this.helper = new Helper(this);
Dep.prototype.setup.call(this);
},
super.setup();
}
setupBeforeFinal: function () {
this.dynamicLogicDefs = this.helper.setupMethods();
setupBeforeFinal() {
this.dynamicLogicDefs = this.helper.setupMethods();
Dep.prototype.setupBeforeFinal.call(this);
super.setupBeforeFinal();
this.helper.setupPanelsVisibility(() => {
this.processDynamicLogic();
});
},
this.helper.setupPanelsVisibility(() => {
this.processDynamicLogic();
});
}
modifyDetailLayout: function (layout) {
this.helper.modifyDetailLayout(layout);
},
});
});
// noinspection JSUnusedGlobalSymbols
modifyDetailLayout(layout) {
this.helper.modifyDetailLayout(layout);
}
}
@@ -26,37 +26,37 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
define('views/authentication-provider/record/edit', ['views/record/edit', 'helpers/misc/authentication-provider'],
function (Dep, Helper) {
import Helper from 'helpers/misc/authentication-provider';
import EditRecordView from 'views/record/edit';
return Dep.extend({
export default class extends EditRecordView {
saveAndNewAction: false,
saveAndNewAction = false
/**
* @private
* @type {module:helpers/misc/authentication-provider}
*/
helper: null,
/**
* @private
* @type {Helper}
*/
helper
setup: function () {
this.helper = new Helper(this);
setup() {
this.helper = new Helper(this);
Dep.prototype.setup.call(this);
},
super.setup();
}
setupBeforeFinal: function () {
this.dynamicLogicDefs = this.helper.setupMethods();
setupBeforeFinal() {
this.dynamicLogicDefs = this.helper.setupMethods();
Dep.prototype.setupBeforeFinal.call(this);
super.setupBeforeFinal();
this.helper.setupPanelsVisibility(() => {
this.processDynamicLogic();
});
},
this.helper.setupPanelsVisibility(() => {
this.processDynamicLogic();
});
}
modifyDetailLayout: function (layout) {
this.helper.modifyDetailLayout(layout);
},
});
});
// noinspection JSUnusedGlobalSymbols
modifyDetailLayout(layout) {
this.helper.modifyDetailLayout(layout);
}
}
+6
View File
@@ -202,6 +202,12 @@ class LinkParentFieldView extends BaseFieldView {
*/
displayScopeColorInListMode = true
/**
* @protected
* @type {boolean}
*/
displayEntityType
/** @inheritDoc */
events = {
/** @this LinkParentFieldView */