EspoCRM – Open Source CRM Application
PHP calendarcontactscrmcrm-platformcrm-systemcustomer-portalcustomer-supportcustomizabledocumentsemail-marketingkanbanleadsopen-sourcephpplatformsales-automationsingle-page-applicationsupport
Detail buttons changes
Yuriice1b90bf5826
diff --git a/client/res/templates/record/detail.tpl b/client/res/templates/record/detail.tplindex a7adecc26b..d82c87c2a8 100644--- a/client/res/templates/record/detail.tpl+++ b/client/res/templates/record/detail.tpl@@ -2,54 +2,10 @@{{#unless buttonsDisabled}}<div class="detail-button-container button-container record-buttons"><div class="sub-container clearfix">- <div class="btn-group actions-btn-group" role="group">- {{#each buttonList}}- {{button name- scope=../entityType- label=label- labelTranslation=labelTranslation- style=style- hidden=hidden- html=html- title=title- text=text- className='btn-xs-wide detail-action-item'- disabled=disabled- }}- {{/each}}- {{#if dropdownItemList}}- <button- type="button"- class="btn btn-default dropdown-toggle dropdown-item-list-button{{#if dropdownItemListEmpty}} hidden{{/if}}"- data-toggle="dropdown"- ><span class="fas fa-ellipsis-h"></span></button>- <ul class="dropdown-menu pull-left">- {{#each dropdownItemList}}- {{#if this}}- {{dropdownItem- name- scope=../entityType- label=label- labelTranslation=labelTranslation- html=html- title=title- text=text- hidden=hidden- disabled=disabled- data=data- className='detail-action-item'- }}- {{else}}- {{#unless @first}}- {{#unless @last}}- <li class="divider"></li>- {{/unless}}- {{/unless}}- {{/if}}- {{/each}}- </ul>- {{/if}}- </div>+ <div+ class="btn-group actions-btn-group"+ role="group"+ >{{{buttons}}}</div>{{#if navigateButtonsEnabled}}<div class="pull-right"><div class="btn-group" role="group">@@ -78,54 +34,10 @@</div><div class="detail-button-container button-container edit-buttons hidden"><div class="sub-container clearfix">- <div class="btn-group actions-btn-group" role="group">- {{#each buttonEditList}}- {{button name- scope=../entityType- label=label- labelTranslation=labelTranslation- style=style- hidden=hidden- html=html- title=title- text=text- className='btn-xs-wide edit-action-item'- disabled=disabled- }}- {{/each}}- {{#if dropdownEditItemList}}- <button- type="button"- class="btn btn-default dropdown-toggle dropdown-edit-item-list-button{{#if dropdownEditItemListEmpty}} hidden{{/if}}"- data-toggle="dropdown"- ><span class="fas fa-ellipsis-h"></span></button>- <ul class="dropdown-menu pull-left">- {{#each dropdownEditItemList}}- {{#if this}}- {{dropdownItem- name- scope=../entityType- label=label- labelTranslation=labelTranslation- html=html- title=title- text=text- hidden=hidden- disabled=disabled- data=data- className='edit-action-item'- }}- {{else}}- {{#unless @first}}- {{#unless @last}}- <li class="divider"></li>- {{/unless}}- {{/unless}}- {{/if}}- {{/each}}- </ul>- {{/if}}- </div>+ <div+ class="btn-group actions-btn-group"+ role="group"+ >{{{editButtons}}}</div></div></div>{{/unless}}diff --git a/client/res/templates/record/edit.tpl b/client/res/templates/record/edit.tplindex e949ab10c2..6aa9605351 100644--- a/client/res/templates/record/edit.tpl+++ b/client/res/templates/record/edit.tpl@@ -2,56 +2,10 @@{{#unless buttonsDisabled}}<div class="detail-button-container button-container record-buttons"><div class="sub-container clearfix">- <div class="btn-group actions-btn-group" role="group">- {{#each buttonList}}- {{button- name- scope=../entityType- label=label- labelTranslation=labelTranslation- style=style- html=html- hidden=hidden- title=title- text=text- className='btn-xs-wide detail-action-item'- disabled=disabled- }}- {{/each}}- {{#if dropdownItemList}}- <button- type="button"- class="btn btn-default dropdown-toggle{{#if dropdownItemListEmpty}} hidden{{/if}}"- data-toggle="dropdown"- ><span class="fas fa-ellipsis-h"></span>- </button>- <ul class="dropdown-menu pull-left">- {{#each dropdownItemList}}- {{#if this}}- {{dropdownItem- name- scope=../entityType- label=label- labelTranslation=labelTranslation- html=html- title=title- text=text- hidden=hidden- disabled=disabled- data=data- className='detail-action-item'- }}- {{else}}- {{#unless @first}}- {{#unless @last}}- <li class="divider"></li>- {{/unless}}- {{/unless}}- {{/if}}- {{/each}}- </ul>- {{/if}}- </div>+ <div+ class="btn-group actions-btn-group"+ role="group"+ >{{{buttons}}}</div></div></div>{{/unless}}diff --git a/client/src/helpers/action-item-setup.js b/client/src/helpers/action-item-setup.jsindex b922109461..715d0cc25b 100644--- a/client/src/helpers/action-item-setup.js+++ b/client/src/helpers/action-item-setup.js@@ -111,7 +111,7 @@ class ActionItemSetupHelper {const name = item.name;if (!item.label) {- item.html = this.language.translate(name, 'actions', scope);+ item.text = this.language.translate(name, 'actions', scope);}item.data = item.data || {};diff --git a/client/src/views/record/detail.ts b/client/src/views/record/detail.tsindex 56aac6e37e..c333fd1908 100644--- a/client/src/views/record/detail.ts+++ b/client/src/views/record/detail.ts@@ -44,6 +44,7 @@ import type {Defs} from 'dynamic-logic';import Ui from 'ui';import DynamicHandler from 'dynamic-handler';import type Collection from 'collection';+import DetailRecordButtonsView from 'views/record/detail/buttons';type ReturnDispatchParams = Record<string, unknown> & {controller?: string;@@ -637,9 +638,6 @@ class DetailRecordView<S extends DetailRecordViewSchema = DetailRecordViewSchemaprivate $middle: JQueryprivate $bottom: JQuery- private $detailButtonContainer: JQuery- private $dropdownItemListButton: JQuery;- private $dropdownEditItemListButton: JQuery;private blockUpdateWebSocketPeriod: number = 500@@ -1049,14 +1047,14 @@ class DetailRecordView<S extends DetailRecordViewSchema = DetailRecordViewSchema* Disable action items.*/disableActionItems() {- (this as any).disableButtons();+ this.disableButtons();}/*** Enable action items.*/enableActionItems() {- (this as any).enableButtons();+ this.enableButtons();}/**@@ -1098,24 +1096,8 @@ class DetailRecordView<S extends DetailRecordViewSchema = DetailRecordViewSchema}if (this.isRendered()) {- this.$detailButtonContainer- .find('li > .action[data-action="'+name+'"]')- .parent()- .addClass('hidden');-- this.$detailButtonContainer- .find('button.action[data-action="'+name+'"]')- .addClass('hidden');-- if (this.isDropdownItemListEmpty()) {- this.$dropdownItemListButton.addClass('hidden');- }-- if (this.isDropdownEditItemListEmpty()) {- this.$dropdownEditItemListButton.addClass('hidden');- }-- this.adjustButtons();+ this.getButtonsView()?.reRender();+ this.getEditButtonsView()?.reRender();}}@@ -1158,24 +1140,8 @@ class DetailRecordView<S extends DetailRecordViewSchema = DetailRecordViewSchema}if (this.isRendered()) {- this.$detailButtonContainer- .find('li > .action[data-action="'+name+'"]')- .parent()- .removeClass('hidden');-- this.$detailButtonContainer- .find('button.action[data-action="'+name+'"]')- .removeClass('hidden');-- if (!this.isDropdownItemListEmpty()) {- this.$dropdownItemListButton.removeClass('hidden');- }-- if (!this.isDropdownEditItemListEmpty()) {- this.$dropdownEditItemListButton.removeClass('hidden');- }-- this.adjustButtons();+ this.getButtonsView()?.reRender();+ this.getEditButtonsView()?.reRender();}}@@ -1219,16 +1185,8 @@ class DetailRecordView<S extends DetailRecordViewSchema = DetailRecordViewSchema}if (this.isRendered()) {- this.$detailButtonContainer- .find('li > .action[data-action="'+name+'"]')- .parent()- .addClass('disabled')- .attr('disabled', 'disabled');-- this.$detailButtonContainer- .find('button.action[data-action="'+name+'"]')- .addClass('disabled')- .attr('disabled', 'disabled');+ this.getButtonsView()?.disableItemElement(name);+ this.getEditButtonsView()?.disableItemElement(name);}}@@ -1272,16 +1230,8 @@ class DetailRecordView<S extends DetailRecordViewSchema = DetailRecordViewSchema}if (this.isRendered()) {- this.$detailButtonContainer- .find(`li > .action[data-action="${name}"]`)- .parent()- .removeClass('disabled')- .removeAttr('disabled');-- this.$detailButtonContainer- .find(`button.action[data-action="${name}"]`)- .removeClass('disabled')- .removeAttr('disabled');+ this.getButtonsView()?.enableItemElement(name);+ this.getEditButtonsView()?.enableItemElement(name);}}@@ -1523,10 +1473,7 @@ class DetailRecordView<S extends DetailRecordViewSchema = DetailRecordViewSchemathis.$bottom = this.$el.find('.bottom').first();}- this.initElementReferences();-this.adjustMiddlePanels();- this.adjustButtons();this.initStickableButtonsContainer();this.initFieldsControlBehaviour();@@ -1850,12 +1797,6 @@ class DetailRecordView<S extends DetailRecordViewSchema = DetailRecordViewSchemareturn {scope: this.scope,entityType: this.entityType,- buttonList: this.buttonList,- buttonEditList: this.buttonEditList,- dropdownItemList: this.getDropdownItemDataList(),- dropdownEditItemList: this.dropdownEditItemList,- dropdownItemListEmpty: this.isDropdownItemListEmpty(),- dropdownEditItemListEmpty: this.isDropdownEditItemListEmpty(),buttonsDisabled: this.buttonsDisabled,id: this.id,isWide: this.isWide,@@ -1926,38 +1867,6 @@ class DetailRecordView<S extends DetailRecordViewSchema = DetailRecordViewSchema}}- private isDropdownItemListEmpty(): boolean {- if (this.dropdownItemList.length === 0) {- return true;- }-- let isEmpty = true;-- this.dropdownItemList.forEach(item => {- if (!item.hidden) {- isEmpty = false;- }- });-- return isEmpty;- }-- private isDropdownEditItemListEmpty(): boolean {- if (this.dropdownEditItemList.length === 0) {- return true;- }-- let isEmpty = true;-- this.dropdownEditItemList.forEach(item => {- if (!item.hidden) {- isEmpty = false;- }- });-- return isEmpty;- }-protected setup() {this.setupEventHandlers();@@ -1965,6 +1874,8 @@ class DetailRecordView<S extends DetailRecordViewSchema = DetailRecordViewSchemathrow new Error('Model has not been injected into record view.');}+ this.setupButtons();+this.recordHelper = this.options.recordHelper ?? new ViewRecordHelper();this._initInlineEditSave();@@ -2080,10 +1991,6 @@ class DetailRecordView<S extends DetailRecordViewSchema = DetailRecordViewSchemathis.setupBeforeFinal();this.setupDynamicBehavior();- this.on('after:render', () => {- this.initElementReferences();- });-this._webSocketDebounceHelper = new DebounceHelper({interval: this._webSocketDebounceInterval,handler: () => this.handleRecordUpdate(),@@ -2995,51 +2902,8 @@ class DetailRecordView<S extends DetailRecordViewSchema = DetailRecordViewSchemaenableButtons() {this.allActionItemsDisabled = false;- this.$el.find(".button-container .actions-btn-group .action")- .removeAttr('disabled')- .removeClass('disabled');-- this.$el.find(".button-container .actions-btn-group .dropdown-toggle")- .removeAttr('disabled')- .removeClass('disabled');-- this.buttonList- .filter(item => item.disabled)- .forEach(item => {- this.$detailButtonContainer- .find(`button.action[data-action="${item.name}"]`)- .addClass('disabled')- .attr('disabled', 'disabled');- });-- this.buttonEditList- .filter(item => item.disabled)- .forEach(item => {- this.$detailButtonContainer- .find(`button.action[data-action="${item.name}"]`)- .addClass('disabled')- .attr('disabled', 'disabled');- });-- this.dropdownItemList- .filter(item => item.disabled)- .forEach(item => {- this.$detailButtonContainer- .find(`li > .action[data-action="${item.name}"]`)- .parent()- .addClass('disabled')- .attr('disabled', 'disabled');- });-- this.dropdownEditItemList- .filter(item => item.disabled)- .forEach(item => {- this.$detailButtonContainer- .find(`li > .action[data-action="${item.name}"]`)- .parent()- .addClass('disabled')- .attr('disabled', 'disabled');- });+ this.getButtonsView()?.reRender();+ this.getEditButtonsView()?.reRender();}// noinspection JSUnusedGlobalSymbols@@ -3049,13 +2913,8 @@ class DetailRecordView<S extends DetailRecordViewSchema = DetailRecordViewSchemadisableButtons() {this.allActionItemsDisabled = true;- this.$el.find(".button-container .actions-btn-group .action")- .attr('disabled', 'disabled')- .addClass('disabled');-- this.$el.find(".button-container .actions-btn-group .dropdown-toggle")- .attr('disabled', 'disabled')- .addClass('disabled');+ this.getButtonsView()?.reRender();+ this.getEditButtonsView()?.reRender();}/**@@ -3093,23 +2952,7 @@ class DetailRecordView<S extends DetailRecordViewSchema = DetailRecordViewSchemareturn;}- const $container = this.$el.find('.detail-button-container');-- const $action = $container.find(`ul > li > a.action[data-action="${name}"]`);-- if ($action.length) {- $action.parent().remove();-- $container.find(`ul > .divider:last-child`).remove();-- return;- }-- const $button = $container.find(`button.action[data-action="${name}"]`);-- if ($button.length) {- $button.remove();- }+ this.getButtonsView()?.reRender();}/**@@ -3704,48 +3547,6 @@ class DetailRecordView<S extends DetailRecordViewSchema = DetailRecordViewSchema});}- private adjustButtons() {- const $buttons = this.$detailButtonContainer.filter('.record-buttons').find('button.btn');-- $buttons- .removeClass('radius-left')- .removeClass('radius-right');-- const $buttonsVisible = $buttons.filter('button:not(.hidden)');-- $buttonsVisible.first().addClass('radius-left');- $buttonsVisible.last().addClass('radius-right');-- this.adjustEditButtons();- }-- private adjustEditButtons() {- const $buttons = this.$detailButtonContainer.filter('.edit-buttons').find('button.btn');-- $buttons- .removeClass('radius-left')- .removeClass('radius-right');-- const $buttonsVisible = $buttons.filter('button:not(.hidden)');-- $buttonsVisible.first().addClass('radius-left');- $buttonsVisible.last().addClass('radius-right');- }-- private initElementReferences() {- if (this.$detailButtonContainer && this.$detailButtonContainer.length) {- return;- }-- this.$detailButtonContainer = this.$el.find('.detail-button-container');-- this.$dropdownItemListButton = this.$detailButtonContainer- .find('.dropdown-item-list-button');-- this.$dropdownEditItemListButton = this.$detailButtonContainer- .find('.dropdown-edit-item-list-button');- }-protected focusForEdit() {this.$el.find('.field:not(.hidden) .form-control:not([disabled])')@@ -3991,6 +3792,50 @@ class DetailRecordView<S extends DetailRecordViewSchema = DetailRecordViewSchemasetupReuse() {this.initShortcuts();}++ protected setupButtons() {+ if (this.buttonsDisabled) {+ return;+ }++ const buttonsView = new DetailRecordButtonsView({+ entityType: this.entityType,+ dataProvider: () => {+ return {+ buttonList: this.buttonList,+ dropdownItemList: this.getDropdownItemDataList(),+ allDisabled: this.allActionItemsDisabled,+ };+ },+ actionClassName: 'detail-action-item',+ });++ this.assignView('buttons', buttonsView);++ if (this.type === 'detail') {+ const editButtonsView = new DetailRecordButtonsView({+ entityType: this.entityType,+ dataProvider: () => {+ return {+ buttonList: this.buttonEditList,+ dropdownItemList: this.dropdownEditItemList,+ allDisabled: this.allActionItemsDisabled,+ };+ },+ actionClassName: 'edit-action-item',+ });++ this.assignView('editButtons', editButtonsView);+ }+ }++ private getButtonsView(): DetailRecordButtonsView {+ return this.getView<DetailRecordButtonsView>('buttons');+ }++ private getEditButtonsView(): DetailRecordButtonsView {+ return this.getView<DetailRecordButtonsView>('editButtons');+ }}export default DetailRecordView;diff --git a/client/src/views/record/detail/buttons.ts b/client/src/views/record/detail/buttons.tsnew file mode 100644index 0000000000..df093125e2--- /dev/null+++ b/client/src/views/record/detail/buttons.ts@@ -0,0 +1,436 @@+/************************************************************************+ * This file is part of EspoCRM.+ *+ * EspoCRM – Open Source CRM application.+ * Copyright (C) 2014-2026 EspoCRM, Inc.+ * Website: https://www.espocrm.com+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as published by+ * the Free Software Foundation, either version 3 of the License, or+ * (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <https://www.gnu.org/licenses/>.+ *+ * The interactive user interfaces in modified source and object code versions+ * of this program must display Appropriate Legal Notices, as required under+ * Section 5 of the GNU Affero General Public License version 3.+ *+ * In accordance with Section 7(b) of the GNU Affero General Public License version 3,+ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word.+ ************************************************************************/++import View from 'view';+import type {Button, DropdownItem} from 'views/record/detail';+import Language from 'language';+import {inject} from 'di';+import {h, fragment} from 'bullbone';++export default class DetailRecordButtonsView extends View<{+ options: {+ dataProvider: () => {+ buttonList: Button[],+ dropdownItemList: (DropdownItem | false)[],+ allDisabled: boolean,+ },+ actionClassName: string,+ entityType: string,+ },+}> {++ readonly useVirtualDom = true++ content(): any {+ const data = this.data();++ const buttons = [];++ data.buttonList.forEach(it => {+ buttons.push(+ new ButtonComponent({+ name: it.name,+ scope: this.options.entityType,+ label: it.label,+ labelTranslation: it.labelTranslation,+ style: it.style,+ title: it.title,+ text: it.text,+ className: data.buttonClassName,+ hidden: it.hidden,+ disabled: it.disabled || data.allDisabled,+ }).node()+ );+ });++ const elements = [...buttons];++ if (data.dropdownItemList.length) {+ const icon = h('span', {class: {'fas': true, 'fa-ellipsis-h': true}});++ elements.push(+ h('button', {+ key: '_dropdown-button',+ attrs: {type: 'button'},+ class: {+ 'btn': true,+ 'btn-default': true,+ 'dropdown-toggle': true,+ 'dropdown-item-list-button': true,+ },+ dataset: {toggle: 'dropdown'}+ }, icon)+ );++ const dropdownItems = [];++ data.dropdownItemList.forEach((it, i) => {+ if (it === false) {+ if (i === 0 || i === data.dropdownItemList.length - 1) {+ return;+ }++ dropdownItems.push(+ h('li', {class: {'divider': true}})+ );++ return;+ }++ dropdownItems.push(+ new DropdownItemComponent({+ name: it.name,+ scope: this.options.entityType,+ label: it.label,+ labelTranslation: it.labelTranslation,+ title: it.title,+ text: it.text,+ className: data.actionClassName,+ hidden: it.hidden,+ disabled: it.disabled || data.allDisabled,+ }).node()+ );+ });++ elements.push(+ h('ul', {+ class: {'dropdown-menu': true, 'pull-left': true},+ }, dropdownItems)+ );+ }++ return fragment(elements);+ }++ /*+ // language=Handlebars+ templateContent_ = `+ {{#each buttonList}}+ {{#unless hidden}}+ {{button name+ scope=../entityType+ label=label+ labelTranslation=labelTranslation+ style=style+ hidden=hidden+ html=html+ title=title+ text=text+ className=../buttonClassName+ disabled=disabled+ }}+ {{/unless}}+ {{/each}}++ {{#if dropdownItemList}}+ <button+ type="button"+ class="btn btn-default dropdown-toggle dropdown-item-list-button {{#if dropdownEmpty}} hidden {{/if}}"+ data-toggle="dropdown"+ ><span class="fas fa-ellipsis-h"></span></button>+ <ul class="dropdown-menu pull-left">+ {{#each dropdownItemList}}+ {{#if this}}+ {{#unless hidden}}+ {{dropdownItem+ name+ scope=../entityType+ label=label+ labelTranslation=labelTranslation+ html=html+ title=title+ text=text+ hidden=hidden+ disabled=disabled+ data=data+ className=../actionClassName+ }}+ {{/unless}}+ {{else}}+ {{#unless @first}}+ {{#unless @last}}+ <li class="divider"></li>+ {{/unless}}+ {{/unless}}+ {{/if}}+ {{/each}}+ </ul>+ {{/if}}+ `+ */++ protected data() {+ const data = this.options.dataProvider();++ const dropdownEmpty = data.dropdownItemList.filter(it => it && !it.hidden).length === 0;++ const dropdownItemList = data.dropdownItemList+ .filter(it => it === false || !it.hidden)+ .filter((it, i, list) => {+ if (i === 0) {+ return true;+ }++ if (it === false && list[i - 1] === false) {+ return false;+ }++ return true;+ });++ return {+ buttonList: data.buttonList.filter(it => !it.hidden),+ dropdownItemList: dropdownItemList,+ entityType: this.options.entityType,+ buttonClassName: 'btn-xs-wide ' + this.options.actionClassName,+ actionClassName: this.options.actionClassName,+ dropdownEmpty: dropdownEmpty,+ allDisabled: data.allDisabled,+ };+ }++ protected afterRender() {+ this.adjust();+ }++ private adjust() {+ const buttons = this.element.querySelectorAll<HTMLButtonElement>('button.btn');++ buttons.forEach(element => element.classList.remove('radius-left', 'radius-right'));++ const visibleButtons = Array.from(buttons).filter(element => !element.classList.contains('hidden'));++ visibleButtons[0]?.classList.add('radius-left');+ visibleButtons[visibleButtons.length - 1]?.classList.add('radius-right');+ }++ enableItemElement(name: string) {+ const button = this.element.querySelector<HTMLButtonElement>(`button.action[data-action="${name}"]`);++ if (button) {+ button.disabled = false;+ button.classList.remove('disabled');+ }++ const a = this.element.querySelector<HTMLLIElement>(`li > .action[data-action="${name}"]`);++ if (a) {+ a.classList.remove('disabled');+ }+ }++ disableItemElement(name: string) {+ const button = this.element.querySelector<HTMLButtonElement>(`button.action[data-action="${name}"]`);++ if (button) {+ button.disabled = true;+ button.classList.add('disabled');+ }++ const a = this.element.querySelector<HTMLLIElement>(`li > .action[data-action="${name}"]`);++ if (a) {+ a.classList.add('disabled');+ }+ }+}++// @todo No html?++class ButtonComponent {++ @inject(Language)+ private language: Language++ constructor(+ private options: {+ name: string,+ style?: 'default' | 'success' | 'danger'| 'warning' | 'info' | 'primary' | 'text' | null,+ className?: string | null,+ scope?: string | null,+ title?: string | null,+ label?: string | null,+ labelTranslation?: string | null,+ link?: string | null,+ iconClass?: string | null,+ text?: string | null,+ disabled?: boolean,+ hidden?: boolean,+ },+ ) {}++ node(): any {+ const classes = {+ 'btn': true,+ 'disabled': this.options.disabled === true,+ 'hidden': this.options.hidden === true,+ 'action': true,+ };++ const style = this.options.style ?? 'default';+ classes['btn-' + style] = true;++ if (this.options.className) {+ this.options.className.split(' ').forEach(it => classes[it.trim()] = true);+ }++ const tag: 'button' | 'a' = this.options.link ? 'a' : 'button';++ const attrs: Record<string, any> = {};++ if (this.options.link) {+ attrs.href = this.options.link;+ } else {+ attrs.type = 'button';+ }++ if (this.options.disabled) {+ attrs.disabled = 'disabled';+ }++ if (this.options.title) {+ attrs.title = this.options.title;+ }++ const label = this.options.label ?? this.options.name;++ const text = this.options.text ??+ (+ this.options.labelTranslation ?+ this.language.translatePath(this.options.labelTranslation) :+ this.language.translate(label, 'labels', this.options.scope)+ );++ const content = this.options.iconClass ?+ fragment([+ h('span', {class: {[this.options.iconClass]: true}}),+ ' ',+ h('span', text),+ ]) :+ text;++ return h(tag, {+ key: this.options.name ?? null,+ class: classes,+ attrs: attrs,+ dataset: {+ name: this.options.name,+ action: this.options.name,+ },+ }, content);+ }+}++class DropdownItemComponent {++ @inject(Language)+ private language: Language++ constructor(+ private options: {+ name: string,+ className?: string | null,+ scope?: string | null,+ title?: string | null,+ label?: string | null,+ labelTranslation?: string | null,+ link?: string | null,+ iconClass?: string | null,+ text?: string | null,+ disabled?: boolean,+ hidden?: boolean,+ },+ ) {}++ node(): any {+ const classes = {+ 'disabled': this.options.disabled === true,+ 'hidden': this.options.hidden === true,+ 'action': true,+ };++ if (this.options.className) {+ this.options.className.split(' ').forEach(it => classes[it.trim()] = true);+ }++ const attrs: Record<string, any> = {+ tabindex: 0,+ };++ if (this.options.link) {+ attrs.href = this.options.link;+ }+ if (this.options.disabled) {+ attrs.disabled = 'disabled';+ }++ if (this.options.title) {+ attrs.title = this.options.title;+ }++ const label = this.options.label ?? this.options.name;++ const text = this.options.text ??+ (+ this.options.labelTranslation ?+ this.language.translatePath(this.options.labelTranslation) :+ this.language.translate(label, 'labels', this.options.scope)+ );++ const content = this.options.iconClass ?+ fragment([+ h('span', {class: {[this.options.iconClass]: true}}),+ ' ',+ h('span', text),+ ]) :+ text;++ const dataset = {+ name: this.options.name,+ action: this.options.name,+ } as Record<string, any>;++ if (!this.options.link) {+ attrs.role = 'button';+ }++ const a = h('a', {+ class: classes,+ attrs: attrs,+ dataset: dataset,+ }, content);++ return h('li', {+ key: this.options.name ?? null,+ class: {+ 'disabled': this.options.disabled === true,+ 'hidden': this.options.hidden === true,+ },+ }, a);+ }+}diff --git a/client/src/views/record/list-pagination.js b/client/src/views/record/list-pagination.jsindex f13b3837c0..20f9429283 100644--- a/client/src/views/record/list-pagination.js+++ b/client/src/views/record/list-pagination.js@@ -32,7 +32,7 @@ class RecordListPagination extends View {template = 'record/list-pagination'- isComponent = true+ isStandaloneComponent = truedata() {const total = this.collection.total;diff --git a/package.json b/package.jsonindex 1966f7fac0..0094d88510 100644--- a/package.json+++ b/package.json@@ -71,7 +71,7 @@"bootstrap": "github:yurikuzn/espo-bootstrap#0.1.2","bootstrap-colorpicker": "^2.5.2","bootstrap-datepicker": "^1.9.0",- "bullbone": "github:espocrm/bullbone#1.4.5",+ "bullbone": "github:espocrm/bullbone#1.4.6","cronstrue": "^1.114.0","cropper": "^0.7.9","devbridge-autocomplete": "^1.4.11",