EspoCRM – Open Source CRM Application
PHP calendarcontactscrmcrm-platformcrm-systemcustomer-portalcustomer-supportcustomizabledocumentsemail-marketingkanbanleadsopen-sourcephpplatformsales-automationsingle-page-applicationsupport
Actions setup ref
Yurii7c9d72fdc1b8
diff --git a/client/src/helpers/action-item-setup.js b/client/src/helpers/action-item-setup.jsindex ba2244ffd1..6d2e6b7b74 100644--- a/client/src/helpers/action-item-setup.js+++ b/client/src/helpers/action-item-setup.js@@ -65,16 +65,24 @@ class ActionItemSetupHelper {language/**- * @param {import('view').default<any>} view- * @param {string} type- * @param {function(Promise): void} waitFunc- * @param {(item: import('views/record/detail').DropdownItem) => void} addFunc- * @param {function(string): void} showFunc- * @param {function(string): void} hideFunc- * @param {{listenToViewModelSync?: boolean}} [options]+ * @param {{+ * view: import('view').default<any>,+ * type: string,+ * waitFunc: (Promise) => void,+ * addFunc: (item: import('views/record/detail').DropdownItem) => void,+ * showFunc: (string) => void,+ * hideFunc: (string) => void,+ * listenToViewModelSync?: boolean,+ * }} options*/- setup(view, type, waitFunc, addFunc, showFunc, hideFunc, options) {- options = options || {};+ setup(options) {+ const view = options.view;+ const type = options.type;+ const waitFunc = options.waitFunc;+ const addFunc = options.addFunc;+ const showFunc = options.showFunc;+ const hideFunc = options.hideFunc;+const actionList = [];// noinspection JSUnresolvedReferencediff --git a/client/src/views/modals/detail.js b/client/src/views/modals/detail.jsindex 55d7eedcec..7bcf8e681a 100644--- a/client/src/views/modals/detail.js+++ b/client/src/views/modals/detail.js@@ -288,15 +288,15 @@ class DetailModalView extends ModalView {setupActionItems() {const actionItemSetup = new ActionItemSetup();- actionItemSetup.setup(- this,- 'modalDetail',- promise => this.wait(promise),- item => this.addDropdownItem(item),- name => this.showActionItem(name),- name => this.hideActionItem(name),- {listenToViewModelSync: true}- );+ actionItemSetup.setup({+ view: this,+ type: 'modalDetail',+ waitFunc: promise => this.wait(promise),+ addFunc: item => this.addDropdownItem(item),+ showFunc: name => this.showActionItem(name),+ hideFunc: name => this.hideActionItem(name),+ listenToViewModelSync: true,+ });}/**diff --git a/client/src/views/modals/edit.js b/client/src/views/modals/edit.jsindex 5f61bfcc12..e4f711b220 100644--- a/client/src/views/modals/edit.js+++ b/client/src/views/modals/edit.js@@ -549,15 +549,15 @@ class EditModalView extends ModalView {setupActionItems() {const actionItemSetup = new ActionItemSetup();- actionItemSetup.setup(- this,- 'modalEdit',- promise => this.wait(promise),- item => this.addDropdownItem(item),- name => this.showActionItem(name),- name => this.hideActionItem(name),- {listenToViewModelSync: true}- );+ actionItemSetup.setup({+ view: this,+ type: 'modalEdit',+ waitFunc: promise => this.wait(promise),+ addFunc: item => this.addDropdownItem(item),+ showFunc: name => this.showActionItem(name),+ hideFunc: name => this.hideActionItem(name),+ listenToViewModelSync: true,+ });}}diff --git a/client/src/views/record/detail.ts b/client/src/views/record/detail.tsindex c299aea5cb..1032bde773 100644--- a/client/src/views/record/detail.ts+++ b/client/src/views/record/detail.ts@@ -1030,14 +1030,14 @@ class DetailRecordView<S extends DetailRecordViewSchema = DetailRecordViewSchemaif (this.type === this.TYPE_DETAIL) {const actionItemSetup = new ActionItemSetup();- actionItemSetup.setup(- this,- this.type,- promise => this.wait(promise),- item => this.addDropdownItem(item),- name => this.showActionItem(name),- name => this.hideActionItem(name)- );+ actionItemSetup.setup({+ view: this,+ type: this.type,+ waitFunc: promise => this.wait(promise),+ addFunc: item => this.addDropdownItem(item),+ showFunc: name => this.showActionItem(name),+ hideFunc: name => this.hideActionItem(name),+ });if (this.saveAndContinueEditingAction) {this.dropdownEditItemList.push({@@ -1052,20 +1052,20 @@ class DetailRecordView<S extends DetailRecordViewSchema = DetailRecordViewSchemaif (this.type === this.TYPE_EDIT || this.type === this.TYPE_DETAIL) {const actionItemSetup = new ActionItemSetup();- actionItemSetup.setup(- this,- 'edit',- promise => this.wait(promise),- item => {+ actionItemSetup.setup({+ view: this,+ type: 'edit',+ waitFunc: promise => this.wait(promise),+ addFunc: item => {if (this.type === this.TYPE_EDIT) {this.addDropdownItem(item);} else {this.dropdownEditItemList.push(item);}},- name => this.showActionItem(name),- name => this.hideActionItem(name)- );+ showFunc: name => this.showActionItem(name),+ hideFunc: name => this.hideActionItem(name),+ });}}