panel actions
This commit is contained in:
@@ -1,43 +1,44 @@
|
||||
{{#each buttonList}}
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-{{#if ../defs.style}}{{../defs.style}}{{else}}default{{/if}} btn-sm panel-action action{{#if hidden}} hidden{{/if}}"
|
||||
data-action="{{action}}"
|
||||
data-panel="{{../defs.name}}" {{#each data}} data-{{hyphen @key}}="{{./this}}"{{/each}}
|
||||
title="{{#if title}}{{translate title scope=../scope}}{{/if}}"
|
||||
>{{#if html}}{{{html}}}{{else}}{{#if text}}{{text}}{{else}}{{translate label scope=../scope}}{{/if}}{{/if}}</button>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-{{#if ../defs.style}}{{../defs.style}}{{else}}default{{/if}} btn-sm panel-action action{{#if hidden}} hidden{{/if}}"
|
||||
{{#if action}}data-action="{{action}}"{{/if}}
|
||||
{{#if name}}data-name="{{name}}"{{/if}}
|
||||
data-panel="{{../defs.name}}" {{#each data}} data-{{hyphen @key}}="{{./this}}"{{/each}}
|
||||
title="{{#if title}}{{translate title scope=../scope}}{{/if}}"
|
||||
>{{#if html}}{{{html}}}{{else}}{{#if text}}{{text}}{{else}}{{translate label scope=../scope}}{{/if}}{{/if}}</button>
|
||||
{{/each}}
|
||||
|
||||
{{#if actionList}}
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-{{#if defs.style}}{{defs.style}}{{else}}default{{/if}} btn-sm dropdown-toggle"
|
||||
data-toggle="dropdown"
|
||||
><span class="fas fa-ellipsis-h"></span></button>
|
||||
<ul class="dropdown-menu">
|
||||
{{#each actionList}}
|
||||
{{#if this}}
|
||||
{{dropdownItem
|
||||
action
|
||||
scope=../scope
|
||||
label=label
|
||||
labelTranslation=labelTranslation
|
||||
html=html
|
||||
title=title
|
||||
text=text
|
||||
hidden=hidden
|
||||
disabled=disabled
|
||||
data=data
|
||||
link=link
|
||||
className='panel-action'
|
||||
}}
|
||||
{{else}}
|
||||
{{#unless @first}}
|
||||
{{#unless @last}}
|
||||
<li class="divider"></li>
|
||||
{{/unless}}
|
||||
{{/unless}}
|
||||
{{/if}}
|
||||
{{/each}}
|
||||
</ul>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-{{#if defs.style}}{{defs.style}}{{else}}default{{/if}} btn-sm dropdown-toggle"
|
||||
data-toggle="dropdown"
|
||||
><span class="fas fa-ellipsis-h"></span></button>
|
||||
<ul class="dropdown-menu">
|
||||
{{#each actionList}}
|
||||
{{#if this}}
|
||||
{{dropdownItem
|
||||
action
|
||||
scope=../scope
|
||||
label=label
|
||||
labelTranslation=labelTranslation
|
||||
html=html
|
||||
title=title
|
||||
text=text
|
||||
hidden=hidden
|
||||
disabled=disabled
|
||||
data=data
|
||||
link=link
|
||||
className='panel-action'
|
||||
}}
|
||||
{{else}}
|
||||
{{#unless @first}}
|
||||
{{#unless @last}}
|
||||
<li class="divider"></li>
|
||||
{{/unless}}
|
||||
{{/unless}}
|
||||
{{/if}}
|
||||
{{/each}}
|
||||
</ul>
|
||||
{{/if}}
|
||||
|
||||
@@ -65,13 +65,16 @@ class PanelsContainerRecordView extends View {
|
||||
*
|
||||
* @typedef {Object} module:views/record/panels-container~button
|
||||
*
|
||||
* @property {string} action An action.
|
||||
* @property {string} [action] An action.
|
||||
* @property {string} [name] A name. Required if a handler is used.
|
||||
* @property {boolean} [hidden] Hidden.
|
||||
* @property {string} [label] A label. Translatable.
|
||||
* @property {string} [html] A HTML.
|
||||
* @property {string} [text] A text.
|
||||
* @property {string} [title] A title (on hover). Translatable.
|
||||
* @property {Object.<string, (string|number|boolean)>} [data] Data attributes.
|
||||
* @property {string} [handler] A handler.
|
||||
* @property {string} [actionFunction] An action function.
|
||||
* @property {function()} [onClick] A click event.
|
||||
*/
|
||||
|
||||
@@ -81,12 +84,15 @@ class PanelsContainerRecordView extends View {
|
||||
* @typedef {Object} module:views/record/panels-container~action
|
||||
*
|
||||
* @property {string} [action] An action.
|
||||
* @property {string} [name] A name. Required if a handler is used.
|
||||
* @property {string} [link] A link URL.
|
||||
* @property {boolean} [hidden] Hidden.
|
||||
* @property {string} [label] A label. Translatable.
|
||||
* @property {string} [html] A HTML.
|
||||
* @property {string} [text] A text.
|
||||
* @property {Object.<string, (string|number|boolean)>} [data] Data attributes.
|
||||
* @property {string} [handler] A handler.
|
||||
* @property {string} [actionFunction] An action function.
|
||||
* @property {function()} [onClick] A click event.
|
||||
*/
|
||||
|
||||
@@ -497,7 +503,7 @@ class PanelsContainerRecordView extends View {
|
||||
return;
|
||||
}
|
||||
|
||||
this.panelList.filter(item => item.name === name).forEach(item => {
|
||||
this.panelList.filter(item => item.name === name).forEach(item => {
|
||||
item.hidden = true;
|
||||
|
||||
if (typeof item.tabNumber !== 'undefined') {
|
||||
|
||||
@@ -123,6 +123,12 @@ class BottomPanelView extends View {
|
||||
this.buttonList = Espo.Utils.cloneDeep(this.defs.buttonList || this.buttonList || []);
|
||||
this.actionList = Espo.Utils.cloneDeep(this.defs.actionList || this.actionList || []);
|
||||
|
||||
this.actionList.forEach(it => {
|
||||
if (it.name) {
|
||||
it.action = it.name;
|
||||
}
|
||||
});
|
||||
|
||||
this.fieldList = this.options.fieldList || this.fieldList || [];
|
||||
|
||||
this.recordViewObject = this.options.recordViewObject;
|
||||
@@ -251,7 +257,7 @@ class BottomPanelView extends View {
|
||||
}
|
||||
}
|
||||
else {
|
||||
field = item;
|
||||
field = item;
|
||||
}
|
||||
|
||||
if (!(field in this.model.defs.fields)) {
|
||||
|
||||
Reference in New Issue
Block a user