ref, docs

This commit is contained in:
Yuri Kuznetsov
2024-09-18 10:45:27 +03:00
parent 8a242e0628
commit 4194c4115d
8 changed files with 1426 additions and 1431 deletions
@@ -26,42 +26,39 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
define('views/admin/entity-manager/fields/icon-class', ['views/fields/base'], function (Dep) {
import BaseFieldView from 'views/fields/base';
return Dep.extend({
export default class extends BaseFieldView {
editTemplate: 'admin/entity-manager/fields/icon-class/edit',
editTemplate = 'admin/entity-manager/fields/icon-class/edit'
setup: function () {
Dep.prototype.setup.call(this);
setup() {
super.setup();
this.events['click [data-action="selectIcon"]'] = function () {
this.selectIcon();
};
},
this.addActionHandler('selectIcon', () => this.selectIcon());
}
selectIcon: function () {
this.createView('dialog', 'views/admin/entity-manager/modals/select-icon', {}, view => {
view.render();
selectIcon() {
this.createView('dialog', 'views/admin/entity-manager/modals/select-icon', {}, view => {
view.render();
this.listenToOnce(view, 'select', value => {
if (value === '') {
value = null;
}
this.listenToOnce(view, 'select', value => {
if (value === '') {
value = null;
}
this.model.set(this.name, value);
this.model.set(this.name, value);
view.close();
});
view.close();
});
},
});
}
fetch: function () {
let data = {};
fetch() {
const data = {};
data[this.name] = this.model.get(this.name);
data[this.name] = this.model.get(this.name);
return data;
},
});
});
return data;
}
}
@@ -128,7 +128,7 @@ class EntityManagerFormulaView extends View {
}
actionSave() {
let data = this.recordView.fetch();
const data = this.recordView.fetch();
if (_.isEqual(data, this.attributes)) {
Espo.Ui.warning(this.translate('notModified', 'messages'));
@@ -215,7 +215,7 @@ class EntityManagerFormulaView extends View {
* @param {KeyboardEvent} e
*/
onKeyDown(e) {
let key = Espo.Utils.getKeyFromKeyEvent(e);
const key = Espo.Utils.getKeyFromKeyEvent(e);
if (key === 'Control+KeyS' || key === 'Control+Enter') {
this.actionSave();
@@ -60,10 +60,10 @@ class EntityManagerIndexView extends View {
return v1.localeCompare(v2);
});
let scopeListSorted = [];
const scopeListSorted = [];
scopeList.forEach(scope => {
var d = this.getMetadata().get('scopes.' + scope);
const d = this.getMetadata().get('scopes.' + scope);
if (d.entity && d.customizable) {
scopeListSorted.push(scope);
@@ -71,7 +71,7 @@ class EntityManagerIndexView extends View {
});
scopeList.forEach(scope => {
var d = this.getMetadata().get('scopes.' + scope);
const d = this.getMetadata().get('scopes.' + scope);
if (d.entity && !d.customizable) {
scopeListSorted.push(scope);
@@ -121,7 +121,7 @@ class EntityManagerIndexView extends View {
processQuickSearch(text) {
text = text.trim();
let $noData = this.$noData;
const $noData = this.$noData;
$noData.addClass('hidden');
@@ -131,9 +131,9 @@ class EntityManagerIndexView extends View {
return;
}
let matchedList = [];
const matchedList = [];
let lowerCaseText = text.toLowerCase();
const lowerCaseText = text.toLowerCase();
this.scopeDataList.forEach(item => {
let matched = false;
@@ -146,7 +146,7 @@ class EntityManagerIndexView extends View {
}
if (!matched) {
let wordList = item.label.split(' ')
const wordList = item.label.split(' ')
.concat(
item.label.split(' ')
);
@@ -54,7 +54,8 @@ class EntityManagerExportModalView extends ModalView {
},
];
let manifest = this.getConfig().get('customExportManifest') || {};
/** @type {Record} */
const manifest = this.getConfig().get('customExportManifest') || {};
this.model = new Model({
name: manifest.name ?? null,
@@ -26,57 +26,50 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
define('views/admin/entity-manager/modals/select-formula', ['views/modal'], function (Dep) {
import ModalView from 'views/modal';
/**
* @class
* @name Class
* @extends module:views/modal
* @memberOf module:views/admin/entity-manager/modals/select-formula
*/
return Dep.extend(/** @lends module:views/admin/entity-manager/modals/select-formula.Class# */{
export default class extends ModalView {
// language=Handlebars
templateContent: `
<div class="panel no-side-margin">
<table class="table table-bordered">
{{#each typeList}}
<tr>
<td style="width: 40%">
<a
class="btn btn-default btn-lg btn-full-wide"
href="#Admin/entityManager/formula&scope={{../scope}}&type={{this}}"
>
{{translate this category='fields' scope='EntityManager'}}
</a>
</td>
<td style="width: 60%">
<div class="complex-text">{{complexText (translate this category='messages' scope='EntityManager')}}
</td>
</tr>
{{/each}}
</table>
</div>
`,
// language=Handlebars
templateContent = `
<div class="panel no-side-margin">
<table class="table table-bordered">
{{#each typeList}}
<tr>
<td style="width: 40%">
<a
class="btn btn-default btn-lg btn-full-wide"
href="#Admin/entityManager/formula&scope={{../scope}}&type={{this}}"
>
{{translate this category='fields' scope='EntityManager'}}
</a>
</td>
<td style="width: 60%">
<div class="complex-text">{{complexText (translate this category='messages' scope='EntityManager')}}
</td>
</tr>
{{/each}}
</table>
</div>
`
backdrop: true,
backdrop = true
data: function () {
return {
typeList: this.typeList,
scope: this.scope,
};
},
data() {
return {
typeList: this.typeList,
scope: this.scope,
};
}
setup: function () {
this.scope = this.options.scope;
setup() {
this.scope = this.options.scope;
this.typeList = [
'beforeSaveCustomScript',
'beforeSaveApiScript',
];
this.typeList = [
'beforeSaveCustomScript',
'beforeSaveApiScript',
];
this.headerText = this.translate('Formula', 'labels', 'EntityManager')
},
});
});
this.headerText = this.translate('Formula', 'labels', 'EntityManager')
}
}
File diff suppressed because it is too large Load Diff
@@ -26,174 +26,174 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
define('views/admin/entity-manager/record/edit', ['views/record/edit'], function (Dep) {
import EditRecordView from 'views/record/edit';
return Dep.extend({
export default class EntityManagerEditRecordView extends EditRecordView {
bottomView: null,
sideView: null,
bottomView = null
sideView = null
dropdownItemList: [],
dropdownItemList = []
accessControlDisabled: true,
saveAndContinueEditingAction: false,
saveAndNewAction: false,
accessControlDisabled = true
saveAndContinueEditingAction = false
saveAndNewAction = false
shortcutKeys: {
'Control+Enter': 'save',
'Control+KeyS': 'save',
},
shortcutKeys = {
'Control+Enter': 'save',
'Control+KeyS': 'save',
}
setup: function () {
this.isCreate = this.options.isNew;
setup() {
this.isCreate = this.options.isNew;
this.scope = 'EntityManager';
this.scope = 'EntityManager';
this.subjectEntityType = this.options.subjectEntityType;
this.subjectEntityType = this.options.subjectEntityType;
if (!this.isCreate) {
this.buttonList = [
{
name: 'save',
style: 'danger',
label: 'Save',
},
{
name: 'cancel',
label: 'Cancel',
},
];
}
else {
this.buttonList = [
{
name: 'save',
style: 'danger',
label: 'Create',
},
{
name: 'cancel',
label: 'Cancel',
},
];
}
if (!this.isCreate) {
this.buttonList = [
{
name: 'save',
style: 'danger',
label: 'Save',
onClick: () => this.actionSave(),
},
{
name: 'cancel',
label: 'Cancel',
},
];
} else {
this.buttonList = [
{
name: 'save',
style: 'danger',
label: 'Create',
onClick: () => this.actionSave(),
},
{
name: 'cancel',
label: 'Cancel',
},
];
}
if (!this.isCreate && !this.options.isCustom) {
this.buttonList.push({
name: 'resetToDefault',
text: this.translate('Reset to Default', 'labels', 'Admin'),
});
}
if (!this.isCreate && !this.options.isCustom) {
this.buttonList.push({
name: 'resetToDefault',
text: this.translate('Reset to Default', 'labels', 'Admin'),
onClick: () => this.actionResetToDefault(),
});
}
Dep.prototype.setup.call(this);
super.setup();
if (this.isCreate) {
this.hideField('sortBy');
this.hideField('sortDirection');
this.hideField('textFilterFields');
this.hideField('statusField');
this.hideField('fullTextSearch');
this.hideField('countDisabled');
this.hideField('kanbanViewMode');
this.hideField('kanbanStatusIgnoreList');
this.hideField('disabled');
}
if (this.isCreate) {
this.hideField('sortBy');
this.hideField('sortDirection');
this.hideField('textFilterFields');
this.hideField('statusField');
this.hideField('fullTextSearch');
this.hideField('countDisabled');
this.hideField('kanbanViewMode');
this.hideField('kanbanStatusIgnoreList');
this.hideField('disabled');
}
if (!this.options.hasColorField) {
this.hideField('color');
}
if (!this.options.hasColorField) {
this.hideField('color');
}
if (!this.options.hasStreamField) {
this.hideField('stream');
}
if (!this.options.hasStreamField) {
this.hideField('stream');
}
if (!this.isCreate) {
this.manageKanbanFields({});
if (!this.isCreate) {
this.manageKanbanFields({});
this.listenTo(this.model, 'change:statusField', (m, v, o) => {
this.manageKanbanFields(o);
});
this.listenTo(this.model, 'change:statusField', (m, v, o) => {
this.manageKanbanFields(o);
});
this.manageKanbanViewModeField();
this.listenTo(this.model, 'change:kanbanViewMode', () => {
this.manageKanbanViewModeField();
});
}
}
this.listenTo(this.model, 'change:kanbanViewMode', () => {
this.manageKanbanViewModeField();
});
}
},
actionSave(data) {
this.trigger('save');
}
actionSave: function () {
this.trigger('save');
},
actionCancel() {
this.trigger('cancel');
}
actionCancel: function () {
this.trigger('cancel');
},
actionResetToDefault() {
this.trigger('reset-to-default');
}
actionResetToDefault: function () {
this.trigger('reset-to-default');
},
manageKanbanViewModeField() {
if (this.model.get('kanbanViewMode')) {
this.showField('kanbanStatusIgnoreList');
} else {
this.hideField('kanbanStatusIgnoreList');
}
}
manageKanbanFields(o) {
if (o.ui) {
this.model.set('kanbanStatusIgnoreList', []);
}
if (this.model.get('statusField')) {
this.setKanbanStatusIgnoreListOptions();
this.showField('kanbanViewMode');
manageKanbanViewModeField: function () {
if (this.model.get('kanbanViewMode')) {
this.showField('kanbanStatusIgnoreList');
} else {
this.hideField('kanbanStatusIgnoreList');
}
},
} else {
this.hideField('kanbanViewMode');
this.hideField('kanbanStatusIgnoreList');
}
}
manageKanbanFields: function (o) {
if (o.ui) {
this.model.set('kanbanStatusIgnoreList', []);
}
setKanbanStatusIgnoreListOptions() {
const statusField = this.model.get('statusField');
if (this.model.get('statusField')) {
this.setKanbanStatusIgnoreListOptions();
const optionList =
this.getMetadata().get(['entityDefs', this.subjectEntityType, 'fields', statusField, 'options']) || [];
this.showField('kanbanViewMode');
this.setFieldOptionList('kanbanStatusIgnoreList', optionList);
if (this.model.get('kanbanViewMode')) {
this.showField('kanbanStatusIgnoreList');
} else {
this.hideField('kanbanStatusIgnoreList');
}
}
else {
this.hideField('kanbanViewMode');
this.hideField('kanbanStatusIgnoreList');
}
},
const fieldView = this.getFieldView('kanbanStatusIgnoreList');
setKanbanStatusIgnoreListOptions: function () {
let statusField = this.model.get('statusField');
if (!fieldView) {
this.once('after:render', () => this.setKanbanStatusIgnoreListTranslation());
var optionList = this.getMetadata()
.get(['entityDefs', this.subjectEntityType, 'fields', statusField, 'options']) || [];
return;
}
this.setFieldOptionList('kanbanStatusIgnoreList', optionList);
this.setKanbanStatusIgnoreListTranslation();
}
let fieldView = this.getFieldView('kanbanStatusIgnoreList');
setKanbanStatusIgnoreListTranslation() {
/** @type {import('views/fields/multi-enum').default} */
const fieldView = this.getFieldView('kanbanStatusIgnoreList');
if (!fieldView) {
this.once('after:render', () => this.setKanbanStatusIgnoreListTranslation());
const statusField = this.model.get('statusField');
return;
}
fieldView.params.translation =
this.getMetadata().get(['entityDefs', this.subjectEntityType, 'fields', statusField, 'translation']) ||
`${this.subjectEntityType}.options.${statusField}`;
this.setKanbanStatusIgnoreListTranslation();
},
setKanbanStatusIgnoreListTranslation: function () {
var fieldView = this.getFieldView('kanbanStatusIgnoreList');
var statusField = this.model.get('statusField');
var translation = this.getMetadata()
.get(['entityDefs', this.subjectEntityType, 'fields', statusField, 'translation']) ||
this.subjectEntityType + '.options.' + statusField;
fieldView.params.translation = translation;
fieldView.setupTranslation();
},
});
});
fieldView.setupTranslation();
}
}
+5 -1
View File
@@ -44,7 +44,11 @@ class EditRecordView extends DetailRecordView {
fieldsMode = 'edit'
/** @inheritDoc */
mode = 'edit'
/** @inheritDoc */
/**
* @inheritDoc
* @type {module:views/record/detail~button[]}
*/
buttonList = [
{
name: 'save',