Commit 06bca9f1 authored by Benni Mack's avatar Benni Mack
Browse files

[BUGFIX] Show SVG actions in Element Browser trees

Due to the change of scalable SVG icons the tree actions
for selecting actions in the Page Selector / File Selector
were not rendered again.

This change fixes the issue by properly using a SVG
inside another SVG again, just like with icons
of the actual tree.

Resolves: #94545
Releases: master
Change-Id: I7bfae2e422adce6fd07eed46a26e8ab9767f12a6
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/69814


Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Jochen's avatarJochen <rothjochen@gmail.com>
Tested-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Jochen's avatarJochen <rothjochen@gmail.com>
Reviewed-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
parent 41110e39
......@@ -379,14 +379,14 @@ $svgColors: (
opacity: 0;
cursor: pointer;
path {
rect {
opacity: 0;
}
&.node-action-over {
opacity: 1;
path {
rect {
opacity: 1;
}
}
......
......@@ -451,7 +451,6 @@ export class SvgTree extends LitElement {
// delete nodes without corresponding data
nodes.exit().remove();
// delete
nodesBg.exit().remove();
nodesActions.exit().remove();
......@@ -724,6 +723,8 @@ export class SvgTree extends LitElement {
*/
protected updateNodeActions(nodesActions: TreeNodeSelection): TreeNodeSelection {
if (this.settings.actions && this.settings.actions.length) {
// Remove all existing actions again
this.nodesActionsContainer.selectAll('.node-action').selectChildren().remove();
return nodesActions.enter()
.append('g')
.merge(nodesActions as d3selection.Selection<SVGGElement, TreeNode, any, any>)
......@@ -736,6 +737,39 @@ export class SvgTree extends LitElement {
return nodesActions.enter();
}
/**
* This is a quick helper function to create custom action icons.
*/
protected createIconAreaForAction(actionItem: any, iconIdentifier: string): void
{
const icon = actionItem
.append('svg')
.attr('class', 'node-icon-container')
.attr('height', '20')
.attr('width', '20')
.attr('x', '0')
.attr('y', '0');
// improve usability by making the click area a 20px square
icon
.append('rect')
.attr('width', '20')
.attr('height', '20')
.attr('y', '0')
.attr('x', '0')
.attr('class', 'node-icon-click');
const nodeInner = icon
.append('svg')
.attr('height', '16')
.attr('width', '16')
.attr('y', '2')
.attr('x', '2')
.attr('class', 'node-icon-inner');
nodeInner
.append('use')
.attr('class', 'node-icon')
.attr('xlink:href', '#icon-' + iconIdentifier);
}
/**
* Check whether node can be selected.
* In some cases (e.g. selecting a parent) it should not be possible to select
......@@ -942,7 +976,7 @@ export class SvgTree extends LitElement {
* @param {Node} node
*/
protected getNodeActionTransform(node: TreeNode): string {
return 'translate(0, ' + ((node.y || 0) - 9) + ')';
return 'translate(-10, ' + ((node.y || 0) - 10) + ')';
}
/**
......
......@@ -42,14 +42,7 @@ class FileStorageBrowserTree extends FileStorageTree {
.on('click', (evt: MouseEvent, node: TreeNode) => {
this.linkItem(node);
});
linkAction
// improve usability by making the click area a 16px square
.append('path')
.attr('d', 'M 0 0 L 18 0 L 18 18 L 0 18 Z')
.exit();
linkAction
.append('use')
.attr('xlink:href', '#icon-actions-link');
this.createIconAreaForAction(linkAction, 'actions-link');
} else if (this.settings.actions.includes('select')) {
// Check if a node can be selected
this.fetchIcon('actions-link');
......@@ -58,14 +51,7 @@ class FileStorageBrowserTree extends FileStorageTree {
.on('click', (evt: MouseEvent, node: TreeNode) => {
this.selectItem(node);
});
linkAction
// improve usability by making the click area a 16px square
.append('path')
.attr('d', 'M 0 0 L 18 0 L 18 18 L 0 18 Z')
.exit();
linkAction
.append('use')
.attr('xlink:href', '#icon-actions-link');
this.createIconAreaForAction(linkAction, 'actions-link');
}
return nodes;
}
......
......@@ -59,7 +59,7 @@ class PageBrowserTree extends PageTree {
if (this.settings.actions.includes('link')) {
// Check if a node can be linked
this.fetchIcon('actions-link');
const linkAction = nodes
const linkAction = this.nodesActionsContainer.selectAll('.node-action')
.append('g')
.attr('visibility', (node: TreeNode) => {
return this.isLinkable(node) ? 'visible' : 'hidden'
......@@ -67,14 +67,7 @@ class PageBrowserTree extends PageTree {
.on('click', (evt: MouseEvent, node: TreeNode) => {
this.linkItem(node);
});
linkAction
// improve usability by making the click area a 16px square
.append('path')
.attr('d', 'M 0 0 L 18 0 L 18 18 L 0 18 Z')
.exit();
linkAction
.append('use')
.attr('xlink:href', '#icon-actions-link');
this.createIconAreaForAction(linkAction, 'actions-link');
} else if (this.settings.actions.includes('select')) {
// Check if a node can be selected
this.fetchIcon('actions-link');
......@@ -83,14 +76,7 @@ class PageBrowserTree extends PageTree {
.on('click', (evt: MouseEvent, node: TreeNode) => {
this.selectItem(node);
});
linkAction
// improve usability by making the click area a 16px square
.append('path')
.attr('d', 'M 0 0 L 18 0 L 18 18 L 0 18 Z')
.exit();
linkAction
.append('use')
.attr('xlink:href', '#icon-actions-link');
this.createIconAreaForAction(linkAction, 'actions-link');
}
return nodes;
}
......
......@@ -10,7 +10,7 @@
*
* The TYPO3 project - inspiring people to share!
*/
var __decorate=this&&this.__decorate||function(e,t,i,r){var n,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,i,s):n(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s},__importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};define(["require","exports","lit","lit/decorators","TYPO3/CMS/Core/Ajax/AjaxRequest","TYPO3/CMS/Recordlist/ElementBrowser","TYPO3/CMS/Recordlist/LinkBrowser","TYPO3/CMS/Backend/Storage/Persistent","./FileStorageTree","TYPO3/CMS/Backend/Element/IconElement"],(function(e,t,i,r,n,o,s,a,c){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileStorageBrowser=void 0,n=__importDefault(n),a=__importDefault(a);let d=class extends c.FileStorageTree{updateNodeActions(e){const t=super.updateNodeActions(e);if(this.settings.actions.includes("link")){this.fetchIcon("actions-link");const e=t.append("g").on("click",(e,t)=>{this.linkItem(t)});e.append("path").attr("d","M 0 0 L 18 0 L 18 18 L 0 18 Z").exit(),e.append("use").attr("xlink:href","#icon-actions-link")}else if(this.settings.actions.includes("select")){this.fetchIcon("actions-link");const e=t.append("g").on("click",(e,t)=>{this.selectItem(t)});e.append("path").attr("d","M 0 0 L 18 0 L 18 18 L 0 18 Z").exit(),e.append("use").attr("xlink:href","#icon-actions-link")}return t}linkItem(e){s.finalizeFunction("t3://folder?storage="+e.storage+"&identifier="+e.pathIdentifier)}selectItem(e){o.insertElement(e.itemType,e.identifier,e.name,e.identifier,!0)}};d=__decorate([r.customElement("typo3-backend-component-filestorage-browser-tree")],d);let l=class extends i.LitElement{constructor(){super(...arguments),this.activeFolder="",this.actions=[],this.triggerRender=()=>{this.tree.dispatchEvent(new Event("svg-tree:visible"))},this.selectActiveNode=e=>{let t=e.detail.nodes;e.detail.nodes=t.map(e=>(decodeURIComponent(e.identifier)===this.activeFolder&&(e.checked=!0),e))},this.toggleExpandState=e=>{const t=e.detail.node;t&&a.default.set("BackendComponents.States.FileStorageTree.stateHash."+t.stateIdentifier,t.expanded?"1":"0")},this.loadFolderDetails=e=>{const t=e.detail.node;if(!t.checked)return;let i=document.location.href+"&contentOnly=1&expandFolder="+t.identifier;new n.default(i).get().then(e=>e.resolve()).then(e=>{document.querySelector(".element-browser-main-content .element-browser-body").innerHTML=e})}}connectedCallback(){super.connectedCallback(),document.addEventListener("typo3:navigation:resized",this.triggerRender)}disconnectedCallback(){document.removeEventListener("typo3:navigation:resized",this.triggerRender),super.disconnectedCallback()}firstUpdated(){this.activeFolder=this.getAttribute("active-folder")||""}createRenderRoot(){return this}render(){this.hasAttribute("tree-actions")&&this.getAttribute("tree-actions").length&&(this.actions=JSON.parse(this.getAttribute("tree-actions")));const e={dataUrl:top.TYPO3.settings.ajaxUrls.filestorage_tree_data,filterUrl:top.TYPO3.settings.ajaxUrls.filestorage_tree_filter,showIcons:!0,actions:this.actions};return i.html`
var __decorate=this&&this.__decorate||function(e,t,i,r){var n,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,i,s):n(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s},__importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};define(["require","exports","lit","lit/decorators","TYPO3/CMS/Core/Ajax/AjaxRequest","TYPO3/CMS/Recordlist/ElementBrowser","TYPO3/CMS/Recordlist/LinkBrowser","TYPO3/CMS/Backend/Storage/Persistent","./FileStorageTree","TYPO3/CMS/Backend/Element/IconElement"],(function(e,t,i,r,n,o,s,a,c){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileStorageBrowser=void 0,n=__importDefault(n),a=__importDefault(a);let d=class extends c.FileStorageTree{updateNodeActions(e){const t=super.updateNodeActions(e);if(this.settings.actions.includes("link")){this.fetchIcon("actions-link");const e=t.append("g").on("click",(e,t)=>{this.linkItem(t)});this.createIconAreaForAction(e,"actions-link")}else if(this.settings.actions.includes("select")){this.fetchIcon("actions-link");const e=t.append("g").on("click",(e,t)=>{this.selectItem(t)});this.createIconAreaForAction(e,"actions-link")}return t}linkItem(e){s.finalizeFunction("t3://folder?storage="+e.storage+"&identifier="+e.pathIdentifier)}selectItem(e){o.insertElement(e.itemType,e.identifier,e.name,e.identifier,!0)}};d=__decorate([r.customElement("typo3-backend-component-filestorage-browser-tree")],d);let l=class extends i.LitElement{constructor(){super(...arguments),this.activeFolder="",this.actions=[],this.triggerRender=()=>{this.tree.dispatchEvent(new Event("svg-tree:visible"))},this.selectActiveNode=e=>{let t=e.detail.nodes;e.detail.nodes=t.map(e=>(decodeURIComponent(e.identifier)===this.activeFolder&&(e.checked=!0),e))},this.toggleExpandState=e=>{const t=e.detail.node;t&&a.default.set("BackendComponents.States.FileStorageTree.stateHash."+t.stateIdentifier,t.expanded?"1":"0")},this.loadFolderDetails=e=>{const t=e.detail.node;if(!t.checked)return;let i=document.location.href+"&contentOnly=1&expandFolder="+t.identifier;new n.default(i).get().then(e=>e.resolve()).then(e=>{document.querySelector(".element-browser-main-content .element-browser-body").innerHTML=e})}}connectedCallback(){super.connectedCallback(),document.addEventListener("typo3:navigation:resized",this.triggerRender)}disconnectedCallback(){document.removeEventListener("typo3:navigation:resized",this.triggerRender),super.disconnectedCallback()}firstUpdated(){this.activeFolder=this.getAttribute("active-folder")||""}createRenderRoot(){return this}render(){this.hasAttribute("tree-actions")&&this.getAttribute("tree-actions").length&&(this.actions=JSON.parse(this.getAttribute("tree-actions")));const e={dataUrl:top.TYPO3.settings.ajaxUrls.filestorage_tree_data,filterUrl:top.TYPO3.settings.ajaxUrls.filestorage_tree_filter,showIcons:!0,actions:this.actions};return i.html`
<div class="svg-tree">
<div>
<typo3-backend-tree-toolbar .tree="${this.tree}" class="svg-toolbar"></typo3-backend-tree-toolbar>
......
......@@ -10,9 +10,9 @@
*
* The TYPO3 project - inspiring people to share!
*/
var __decorate=this&&this.__decorate||function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s},__importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};define(["require","exports","lit","lit/decorators","lit/directives/until","TYPO3/CMS/Core/lit-helper","../PageTree/PageTree","TYPO3/CMS/Core/Ajax/AjaxRequest","TYPO3/CMS/Recordlist/ElementBrowser","TYPO3/CMS/Recordlist/LinkBrowser","TYPO3/CMS/Backend/Storage/Persistent","TYPO3/CMS/Backend/Element/IconElement"],(function(e,t,n,i,r,o,s,a,d,c,l){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PageBrowser=void 0,a=__importDefault(a),l=__importDefault(l);let p=class extends s.PageTree{appendTextElement(e){return super.appendTextElement(e).attr("opacity",e=>this.settings.actions.includes("link")?this.isLinkable(e)?1:.5:1)}updateNodeActions(e){const t=super.updateNodeActions(e);if(this.settings.actions.includes("link")){this.fetchIcon("actions-link");const e=t.append("g").attr("visibility",e=>this.isLinkable(e)?"visible":"hidden").on("click",(e,t)=>{this.linkItem(t)});e.append("path").attr("d","M 0 0 L 18 0 L 18 18 L 0 18 Z").exit(),e.append("use").attr("xlink:href","#icon-actions-link")}else if(this.settings.actions.includes("select")){this.fetchIcon("actions-link");const e=t.append("g").on("click",(e,t)=>{this.selectItem(t)});e.append("path").attr("d","M 0 0 L 18 0 L 18 18 L 0 18 Z").exit(),e.append("use").attr("xlink:href","#icon-actions-link")}return t}linkItem(e){c.finalizeFunction("t3://page?uid="+e.identifier)}isLinkable(e){return!1===["199","254","255"].includes(String(e.type))}selectItem(e){d.insertElement(e.itemType,e.identifier,e.name,e.identifier,!0)}};p=__decorate([i.customElement("typo3-backend-component-page-browser-tree")],p);let u=class extends n.LitElement{constructor(){super(...arguments),this.mountPointPath=null,this.activePageId=0,this.actions=[],this.configuration=null,this.triggerRender=()=>{this.tree.dispatchEvent(new Event("svg-tree:visible"))},this.selectActivePageInTree=e=>{let t=e.detail.nodes;e.detail.nodes=t.map(e=>(parseInt(e.identifier,10)===this.activePageId&&(e.checked=!0),e))},this.toggleExpandState=e=>{const t=e.detail.node;t&&l.default.set("BackendComponents.States.Pagetree.stateHash."+t.stateIdentifier,t.expanded?"1":"0")},this.loadRecordsOfPage=e=>{const t=e.detail.node;if(!t.checked)return;let n=document.location.href+"&contentOnly=1&expandPage="+t.identifier;new a.default(n).get().then(e=>e.resolve()).then(e=>{document.querySelector(".element-browser-main-content .element-browser-body").innerHTML=e})},this.setMountPoint=e=>{this.setTemporaryMountPoint(e.detail.pageId)}}connectedCallback(){super.connectedCallback(),document.addEventListener("typo3:navigation:resized",this.triggerRender),document.addEventListener("typo3:pagetree:mountPoint",this.setMountPoint)}disconnectedCallback(){document.removeEventListener("typo3:navigation:resized",this.triggerRender),document.removeEventListener("typo3:pagetree:mountPoint",this.setMountPoint),super.disconnectedCallback()}firstUpdated(){this.activePageId=parseInt(this.getAttribute("active-page"),10),this.actions=JSON.parse(this.getAttribute("tree-actions"))}createRenderRoot(){return this}getConfiguration(){if(null!==this.configuration)return Promise.resolve(this.configuration);const e=top.TYPO3.settings.ajaxUrls.page_tree_browser_configuration,t=this.hasAttribute("alternative-entry-points")?JSON.parse(this.getAttribute("alternative-entry-points")):[];let n=new a.default(e);return t.length&&(n=n.withQueryArguments("alternativeEntryPoints="+encodeURIComponent(t))),n.get().then(async e=>{const t=await e.resolve("json");return t.actions=this.actions,this.configuration=t,this.mountPointPath=t.temporaryMountPoint||null,t})}render(){return n.html`
var __decorate=this&&this.__decorate||function(e,t,n,i){var o,r=arguments.length,s=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(r<3?o(s):r>3?o(t,n,s):o(t,n))||s);return r>3&&s&&Object.defineProperty(t,n,s),s},__importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};define(["require","exports","lit","lit/decorators","lit/directives/until","TYPO3/CMS/Core/lit-helper","../PageTree/PageTree","TYPO3/CMS/Core/Ajax/AjaxRequest","TYPO3/CMS/Recordlist/ElementBrowser","TYPO3/CMS/Recordlist/LinkBrowser","TYPO3/CMS/Backend/Storage/Persistent","TYPO3/CMS/Backend/Element/IconElement"],(function(e,t,n,i,o,r,s,a,c,d,l){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PageBrowser=void 0,a=__importDefault(a),l=__importDefault(l);let p=class extends s.PageTree{appendTextElement(e){return super.appendTextElement(e).attr("opacity",e=>this.settings.actions.includes("link")?this.isLinkable(e)?1:.5:1)}updateNodeActions(e){const t=super.updateNodeActions(e);if(this.settings.actions.includes("link")){this.fetchIcon("actions-link");const e=this.nodesActionsContainer.selectAll(".node-action").append("g").attr("visibility",e=>this.isLinkable(e)?"visible":"hidden").on("click",(e,t)=>{this.linkItem(t)});this.createIconAreaForAction(e,"actions-link")}else if(this.settings.actions.includes("select")){this.fetchIcon("actions-link");const e=t.append("g").on("click",(e,t)=>{this.selectItem(t)});this.createIconAreaForAction(e,"actions-link")}return t}linkItem(e){d.finalizeFunction("t3://page?uid="+e.identifier)}isLinkable(e){return!1===["199","254","255"].includes(String(e.type))}selectItem(e){c.insertElement(e.itemType,e.identifier,e.name,e.identifier,!0)}};p=__decorate([i.customElement("typo3-backend-component-page-browser-tree")],p);let u=class extends n.LitElement{constructor(){super(...arguments),this.mountPointPath=null,this.activePageId=0,this.actions=[],this.configuration=null,this.triggerRender=()=>{this.tree.dispatchEvent(new Event("svg-tree:visible"))},this.selectActivePageInTree=e=>{let t=e.detail.nodes;e.detail.nodes=t.map(e=>(parseInt(e.identifier,10)===this.activePageId&&(e.checked=!0),e))},this.toggleExpandState=e=>{const t=e.detail.node;t&&l.default.set("BackendComponents.States.Pagetree.stateHash."+t.stateIdentifier,t.expanded?"1":"0")},this.loadRecordsOfPage=e=>{const t=e.detail.node;if(!t.checked)return;let n=document.location.href+"&contentOnly=1&expandPage="+t.identifier;new a.default(n).get().then(e=>e.resolve()).then(e=>{document.querySelector(".element-browser-main-content .element-browser-body").innerHTML=e})},this.setMountPoint=e=>{this.setTemporaryMountPoint(e.detail.pageId)}}connectedCallback(){super.connectedCallback(),document.addEventListener("typo3:navigation:resized",this.triggerRender),document.addEventListener("typo3:pagetree:mountPoint",this.setMountPoint)}disconnectedCallback(){document.removeEventListener("typo3:navigation:resized",this.triggerRender),document.removeEventListener("typo3:pagetree:mountPoint",this.setMountPoint),super.disconnectedCallback()}firstUpdated(){this.activePageId=parseInt(this.getAttribute("active-page"),10),this.actions=JSON.parse(this.getAttribute("tree-actions"))}createRenderRoot(){return this}getConfiguration(){if(null!==this.configuration)return Promise.resolve(this.configuration);const e=top.TYPO3.settings.ajaxUrls.page_tree_browser_configuration,t=this.hasAttribute("alternative-entry-points")?JSON.parse(this.getAttribute("alternative-entry-points")):[];let n=new a.default(e);return t.length&&(n=n.withQueryArguments("alternativeEntryPoints="+encodeURIComponent(t))),n.get().then(async e=>{const t=await e.resolve("json");return t.actions=this.actions,this.configuration=t,this.mountPointPath=t.temporaryMountPoint||null,t})}render(){return n.html`
<div class="svg-tree">
${r.until(this.renderTree(),this.renderLoader())}
${o.until(this.renderTree(),this.renderLoader())}
</div>
`}renderTree(){return this.getConfiguration().then(e=>n.html`
<div>
......@@ -31,7 +31,7 @@ var __decorate=this&&this.__decorate||function(e,t,n,i){var r,o=arguments.length
<div class="node-mount-point">
<div class="node-mount-point__icon"><typo3-backend-icon identifier="actions-document-info" size="small"></typo3-backend-icon></div>
<div class="node-mount-point__text">${this.mountPointPath}</div>
<div class="node-mount-point__icon mountpoint-close" @click="${()=>this.unsetTemporaryMountPoint()}" title="${o.lll("labels.temporaryDBmount")}">
<div class="node-mount-point__icon mountpoint-close" @click="${()=>this.unsetTemporaryMountPoint()}" title="${r.lll("labels.temporaryDBmount")}">
<typo3-backend-icon identifier="actions-close" size="small"></typo3-backend-icon>
</div>
</div>
......
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
var __decorate=this&&this.__decorate||function(t,e,r,o){var n,s=arguments.length,l=s<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(t,e,r,o);else for(var i=t.length-1;i>=0;i--)(n=t[i])&&(l=(s<3?n(l):s>3?n(e,r,l):n(e,r))||l);return s>3&&l&&Object.defineProperty(e,r,l),l};define(["require","exports","lit","lit/decorators","TYPO3/CMS/Backend/Enum/Severity","TYPO3/CMS/Backend/Severity","TYPO3/CMS/Backend/Modal","TYPO3/CMS/Core/lit-helper"],(function(t,e,r,o,n,s,l,i){"use strict";var a;Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.formatSelector=".t3js-record-export-format-selector",t.formatOptions=".t3js-record-export-format-option"}(a||(a={}));let c=class extends r.LitElement{constructor(){super(),this.addEventListener("click",t=>{t.preventDefault(),this.showExportConfigurationModal()})}render(){return r.html`<slot></slot>`}showExportConfigurationModal(){this.url&&l.advanced({content:this.url,title:this.title||"Export record",severity:n.SeverityEnum.notice,size:l.sizes.small,type:l.types.ajax,buttons:[{text:this.close||i.lll("button.close")||"Close",active:!0,btnClass:"btn-default",name:"cancel",trigger:()=>l.dismiss()},{text:this.ok||i.lll("button.ok")||"Export",btnClass:"btn-"+s.getCssClass(n.SeverityEnum.info),name:"export",trigger:()=>{const t=l.currentModal[0].querySelector("form");t&&t.submit(),l.dismiss()}}],ajaxCallback:()=>{const t=l.currentModal[0].querySelector(a.formatSelector),e=l.currentModal[0].querySelectorAll(a.formatOptions);null!==t&&e.length&&t.addEventListener("change",t=>{const r=t.target.value;e.forEach(t=>{t.dataset.formatname!==r?t.classList.add("hide"):t.classList.remove("hide")})})}})}};__decorate([o.property({type:String})],c.prototype,"url",void 0),__decorate([o.property({type:String})],c.prototype,"title",void 0),__decorate([o.property({type:String})],c.prototype,"ok",void 0),__decorate([o.property({type:String})],c.prototype,"close",void 0),c=__decorate([o.customElement("typo3-recordlist-record-export-button")],c)}));
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment