TYPO3 v15 dev-main snapshot ()
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* 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!
|
||||
*/
|
||||
import{customElement as p}from"lit/decorators.js";import{LitElement as a}from"lit";var m=function(n,t,r,c){var o=arguments.length,e=o<3?t:c===null?c=Object.getOwnPropertyDescriptor(t,r):c,f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")e=Reflect.decorate(n,t,r,c);else for(var l=n.length-1;l>=0;l--)(f=n[l])&&(e=(o<3?f(e):o>3?f(t,r,e):f(t,r))||e);return o>3&&e&&Object.defineProperty(t,r,e),e};let i=class extends a{createRenderRoot(){return this}};i=m([p("typo3-backend-live-search")],i);export{i as BackendSearch};
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* 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!
|
||||
*/
|
||||
import{property as m,customElement as h}from"lit/decorators.js";import{LitElement as a,nothing as u,html as d}from"lit";import{markdown as s}from"@typo3/core/directive/markdown.js";import"@typo3/backend/element/icon-element.js";var f=function(i,e,n,r){var o=arguments.length,t=o<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,n):r,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")t=Reflect.decorate(i,e,n,r);else for(var p=i.length-1;p>=0;p--)(l=i[p])&&(t=(o<3?l(t):o>3?l(e,n,t):l(e,n))||t);return o>3&&t&&Object.defineProperty(e,n,t),t};let c=class extends a{createRenderRoot(){return this}render(){return this.hint===""?u:d`<typo3-backend-icon identifier=actions-lightbulb-on size=small></typo3-backend-icon>${s(this.hint,"minimal")}`}};f([m({type:String})],c.prototype,"hint",void 0),c=f([h("typo3-backend-live-search-hint")],c);export{c as Hint};
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* 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!
|
||||
*/
|
||||
import{property as l,customElement as m}from"lit/decorators.js";import{LitElement as v,html as d,nothing as u}from"lit";import"@typo3/backend/element/icon-element.js";import f from"~labels/core.misc";var r=function(o,i,a,n){var s=arguments.length,e=s<3?i:n===null?n=Object.getOwnPropertyDescriptor(i,a):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")e=Reflect.decorate(o,i,a,n);else for(var p=o.length-1;p>=0;p--)(c=o[p])&&(e=(s<3?c(e):s>3?c(i,a,e):c(i,a))||e);return s>3&&e&&Object.defineProperty(i,a,e),e};let t=class extends v{constructor(){super(...arguments),this.language=null}createRenderRoot(){return this}render(){return d`<div class=livesearch-result-item-icon><typo3-backend-icon title=${this.icon.title} identifier=${this.icon.identifier} overlay=${this.icon.overlay} size=small></typo3-backend-icon>${this.language?d`<typo3-backend-icon title=${this.language.title} identifier=${this.language.iconIdentifier} size=small></typo3-backend-icon>`:u}</div><div class=livesearch-result-item-summary><div class=livesearch-result-item-title><div class=livesearch-result-item-title-contentlabel>${this.itemTitle}</div>${this.extraData.inWorkspace?d`<div class=livesearch-result-item-title-indicator><typo3-backend-icon title=${f.get("liveSearch.versionizedRecord")} identifier=actions-dot size=small class=text-warning></typo3-backend-icon></div>`:u}</div>${this.extraData.breadcrumb!==void 0?d`<small>${this.extraData.breadcrumb}</small>`:u}</div>`}};r([l({type:Object,attribute:!1})],t.prototype,"icon",void 0),r([l({type:Object,attribute:!1})],t.prototype,"language",void 0),r([l({type:String,attribute:!1})],t.prototype,"itemTitle",void 0),r([l({type:String,attribute:!1})],t.prototype,"typeLabel",void 0),r([l({type:Object,attribute:!1})],t.prototype,"extraData",void 0),t=r([m("typo3-backend-live-search-result-item-default")],t);export{t as DefaultProviderResultItem};
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* 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!
|
||||
*/
|
||||
import{property as l,customElement as m}from"lit/decorators.js";import{LitElement as v,html as p,nothing as u}from"lit";import"@typo3/backend/element/icon-element.js";import f from"~labels/core.misc";var r=function(o,i,a,s){var n=arguments.length,e=n<3?i:s===null?s=Object.getOwnPropertyDescriptor(i,a):s,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")e=Reflect.decorate(o,i,a,s);else for(var d=o.length-1;d>=0;d--)(c=o[d])&&(e=(n<3?c(e):n>3?c(i,a,e):c(i,a))||e);return n>3&&e&&Object.defineProperty(i,a,e),e};let t=class extends v{constructor(){super(...arguments),this.language=null}createRenderRoot(){return this}render(){return p`<div class=livesearch-result-item-icon><typo3-backend-icon title=${this.icon.title} identifier=${this.icon.identifier} overlay=${this.icon.overlay} size=small></typo3-backend-icon>${this.language?p`<typo3-backend-icon title=${this.language.title} identifier=${this.language.iconIdentifier} size=small></typo3-backend-icon>`:u}</div><div class=livesearch-result-item-summary><div class=livesearch-result-item-title><div class=livesearch-result-item-title-contentlabel>${this.itemTitle}</div>${this.extraData.inWorkspace?p`<div class=livesearch-result-item-title-indicator><typo3-backend-icon title=${f.get("liveSearch.versionizedRecord")} identifier=actions-dot size=small class=text-warning></typo3-backend-icon></div>`:u}</div><small>${this.extraData.breadcrumb}</small></div>`}};r([l({type:Object,attribute:!1})],t.prototype,"icon",void 0),r([l({type:Object,attribute:!1})],t.prototype,"language",void 0),r([l({type:String,attribute:!1})],t.prototype,"itemTitle",void 0),r([l({type:String,attribute:!1})],t.prototype,"typeLabel",void 0),r([l({type:Object,attribute:!1})],t.prototype,"extraData",void 0),t=r([m("typo3-backend-live-search-result-item-page-provider")],t);var b=t;export{b as default};
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* 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!
|
||||
*/
|
||||
import p from"@typo3/core/document-service.js";import{property as v,customElement as d}from"lit/decorators.js";import{LitElement as h,html as a,css as y}from"lit";import"@typo3/backend/live-search/element/result/item/action/action.js";var u=function(r,e,t,i){var o=arguments.length,n=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(r,e,t,i);else for(var l=r.length-1;l>=0;l--)(s=r[l])&&(n=(o<3?s(n):o>3?s(e,t,n):s(e,t))||n);return o>3&&n&&Object.defineProperty(e,t,n),n};const f="typo3-backend-live-search-result-item-action-container";let c=class extends h{constructor(){super(...arguments),this.resultItem=null}createRenderRoot(){return this}render(){return a`<typo3-backend-live-search-result-action-list>${this.resultItem.actions.map(e=>this.renderActionItem(this.resultItem,e))}</typo3-backend-live-search-result-action-list>`}renderActionItem(e,t){return a`<typo3-backend-live-search-result-item-action .resultItem=${e} .resultItemAction=${t} @click=${()=>this.invokeAction(this.resultItem,t)}></typo3-backend-live-search-result-item-action>`}invokeAction(e,t){this.closest("typo3-backend-live-search-result-container").dispatchEvent(new CustomEvent("livesearch:invoke-action",{detail:{resultItem:e,action:t}}))}};u([v({type:Object,attribute:!1})],c.prototype,"resultItem",void 0),c=u([d("typo3-backend-live-search-result-item-action-container")],c);let m=class extends h{static{this.styles=y`:host{display:block}`}async connectedCallback(){await p.ready(),this.parentContainer=this.closest("typo3-backend-live-search-result-container"),this.resultItemContainer=this.parentContainer.querySelector("typo3-backend-live-search-result-item-container"),super.connectedCallback(),this.addEventListener("keydown",this.handleKeyDown),this.addEventListener("keyup",this.handleKeyUp)}disconnectedCallback(){this.removeEventListener("keydown",this.handleKeyDown),this.removeEventListener("keyup",this.handleKeyUp),super.disconnectedCallback()}render(){return a`<slot></slot>`}handleKeyDown(e){if(!["ArrowDown","ArrowUp","ArrowLeft"].includes(e.key)||document.activeElement.tagName.toLowerCase()!=="typo3-backend-live-search-result-item-action")return;e.preventDefault();let t;e.key==="ArrowDown"?t=document.activeElement.nextElementSibling:e.key==="ArrowUp"?t=document.activeElement.previousElementSibling:e.key==="ArrowLeft"&&(t=this.resultItemContainer.querySelector("typo3-backend-live-search-result-item.active")),t!==null&&t.focus()}handleKeyUp(e){if(!["Enter"," "].includes(e.key))return;e.preventDefault();const t=e.target;this.parentContainer.dispatchEvent(new CustomEvent("livesearch:invoke-action",{detail:{resultItem:t.resultItem,action:t.resultItemAction}}))}};m=u([d("typo3-backend-live-search-result-action-list")],m);export{c as ActionContainer,m as ActionList,f as componentName};
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* 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!
|
||||
*/
|
||||
import{property as p,customElement as d}from"lit/decorators.js";import{ifDefined as f}from"lit/directives/if-defined.js";import{LitElement as m,html as u}from"lit";import"@typo3/backend/element/icon-element.js";var a=function(o,e,i,n){var c=arguments.length,t=c<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,i):n,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")t=Reflect.decorate(o,e,i,n);else for(var s=o.length-1;s>=0;s--)(l=o[s])&&(t=(c<3?l(t):c>3?l(e,i,t):l(e,i))||t);return c>3&&t&&Object.defineProperty(e,i,t),t};let r=class extends m{connectedCallback(){super.connectedCallback(),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0")}createRenderRoot(){return this}render(){return u`<div><div class=livesearch-result-item-icon><typo3-backend-icon identifier=${f(this.resultItemAction.icon.identifier||"actions-arrow-right")} overlay=${this.resultItemAction.icon.overlay} size=small></typo3-backend-icon></div><div class=livesearch-result-item-title>${this.resultItemAction.label}</div></div>`}};a([p({type:Object,attribute:!1})],r.prototype,"resultItem",void 0),a([p({type:Object,attribute:!1})],r.prototype,"resultItemAction",void 0),r=a([d("typo3-backend-live-search-result-item-action")],r);export{r as Action};
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* 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!
|
||||
*/
|
||||
import"@typo3/backend/element/spinner-element.js";import m from"@typo3/backend/live-search/live-search-configurator.js";import{LitElement as p,html as l,css as v}from"lit";import{property as y,customElement as h}from"lit/decorators.js";import{until as b}from"lit/directives/until.js";import"@typo3/backend/live-search/element/provider/default-result-item.js";import"@typo3/backend/live-search/element/result/item/item.js";var u=function(o,e,t,n){var i=arguments.length,r=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,e,t,n);else for(var c=o.length-1;c>=0;c--)(s=o[c])&&(r=(i<3?s(r):i>3?s(e,t,r):s(e,t))||r);return i>3&&r&&Object.defineProperty(e,t,r),r};const f="typo3-backend-live-search-result-item-container";let a=class extends p{constructor(){super(...arguments),this.results=null}connectedCallback(){super.connectedCallback(),this.addEventListener("scroll",this.onScroll)}disconnectedCallback(){this.removeEventListener("scroll",this.onScroll),super.disconnectedCallback()}createRenderRoot(){return this}render(){const e={},t=this.results.filter(n=>n!==null);return t.length!==this.results.length&&console.warn('The result set contained "null" values, indicating something went wrong while building the search results. Affected values were removed to no break the user interface.'),t.forEach(n=>{n.typeLabel in e?e[n.typeLabel].push(n):e[n.typeLabel]=[n]}),l`<typo3-backend-live-search-result-list>${this.renderGroupedResults(e)}</typo3-backend-live-search-result-list>`}renderGroupedResults(e){const t=[];for(const[n,i]of Object.entries(e)){const r=i.length;t.push(l`<h6 class=livesearch-result-item-group-label>${n} (${r})</h6>`),t.push(...i.map(s=>l`${b(this.renderResultItem(s),l`<typo3-backend-spinner></typo3-backend-spinner>`)}`))}return l`${t}`}async renderResultItem(e){const t=m.getRenderers();let n;return t[e.provider]!==void 0?(await import(t[e.provider].module),n=t[e.provider].callback(e)):n=l`<typo3-backend-live-search-result-item-default title="${e.typeLabel}: ${e.itemTitle}" .icon=${e.icon} .language=${e.language} .itemTitle=${e.itemTitle} .typeLabel=${e.typeLabel} .extraData=${e.extraData}></typo3-backend-live-search-result-item-default>`,l`<typo3-backend-live-search-result-item .resultItem=${e} @click=${()=>this.invokeAction(e,e.defaultAction)} @focus=${()=>this.requestActions(e)}>${n}</typo3-backend-live-search-result-item>`}requestActions(e){this.parentElement.dispatchEvent(new CustomEvent("livesearch:request-actions",{detail:{resultItem:e}}))}invokeAction(e,t){this.parentElement.dispatchEvent(new CustomEvent("livesearch:invoke-action",{detail:{resultItem:e,action:t}}))}onScroll(e){this.querySelectorAll(".livesearch-result-item-group-label").forEach(t=>{t.classList.toggle("sticky",t.offsetTop<=e.target.scrollTop)})}};u([y({type:Object,attribute:!1})],a.prototype,"results",void 0),a=u([h("typo3-backend-live-search-result-item-container")],a);let d=class extends p{static{this.styles=v`:host{display:block}`}connectedCallback(){this.parentContainer=this.closest("typo3-backend-live-search-result-container"),this.resultItemDetailContainer=this.parentContainer.querySelector("typo3-backend-live-search-result-item-detail-container"),super.connectedCallback(),this.addEventListener("keydown",this.handleKeyDown),this.addEventListener("keyup",this.handleKeyUp)}disconnectedCallback(){this.removeEventListener("keydown",this.handleKeyDown),this.removeEventListener("keyup",this.handleKeyUp),super.disconnectedCallback()}render(){return l`<slot></slot>`}handleKeyDown(e){if(!["ArrowDown","ArrowUp","ArrowRight"].includes(e.key))return;const t="typo3-backend-live-search-result-item";if(document.activeElement.tagName.toLowerCase()!==t)return;e.preventDefault();let n;if(e.key==="ArrowDown"){let i=document.activeElement.nextElementSibling;for(;i!==null&&i.tagName.toLowerCase()!==t;)i=i.nextElementSibling;n=i}else if(e.key==="ArrowUp"){let i=document.activeElement.previousElementSibling;for(;i!==null&&i.tagName.toLowerCase()!==t;)i=i.previousElementSibling;n=i,n===null&&(n=document.querySelector("typo3-backend-live-search").querySelector('input[type="search"]'))}else e.key==="ArrowRight"&&(n=this.resultItemDetailContainer.querySelector("typo3-backend-live-search-result-item-action"));n!==null&&n.focus()}handleKeyUp(e){if(!["Enter"," "].includes(e.key))return;e.preventDefault();const t=e.target.resultItem;this.invokeAction(t)}invokeAction(e){this.parentContainer.dispatchEvent(new CustomEvent("livesearch:invoke-action",{detail:{resultItem:e,action:e.actions[0]}}))}};d=u([h("typo3-backend-live-search-result-list")],d);export{a as ItemContainer,d as ResultList,f as componentName};
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* 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!
|
||||
*/
|
||||
import{property as d,customElement as p}from"lit/decorators.js";import{LitElement as u,html as f}from"lit";import"@typo3/backend/element/icon-element.js";var l=function(n,e,t,o){var i=arguments.length,c=i<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,t):o,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(n,e,t,o);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(c=(i<3?r(c):i>3?r(e,t,c):r(e,t))||c);return i>3&&c&&Object.defineProperty(e,t,c),c};let s=class extends u{connectedCallback(){super.connectedCallback(),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.addEventListener("focus",this.onFocus)}disconnectedCallback(){this.removeEventListener("focus",this.onFocus),super.disconnectedCallback()}createRenderRoot(){return this}render(){return f`<div class=livesearch-expand-action @click=${e=>{e.stopPropagation(),this.focus()}}><typo3-backend-icon identifier=actions-chevron-end size=small></typo3-backend-icon></div>`}onFocus(e){const t=e.target;t.parentElement.querySelector(".active")?.classList.remove("active"),t.classList.add("active")}};l([d({type:Object,attribute:!1})],s.prototype,"resultItem",void 0),s=l([p("typo3-backend-live-search-result-item")],s);export{s as Item};
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* 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!
|
||||
*/
|
||||
import h from"@typo3/backend/live-search/live-search-configurator.js";import m from"@typo3/backend/viewport.js";import{property as u,query as p,customElement as f}from"lit/decorators.js";import{LitElement as y,html as c,nothing as b}from"lit";import"@typo3/backend/live-search/element/result/item/item-container.js";import"@typo3/backend/live-search/element/result/result-detail-container.js";import v from"~labels/core.misc";var s=function(l,e,n,r){var t=arguments.length,i=t<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,n):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(l,e,n,r);else for(var d=l.length-1;d>=0;d--)(a=l[d])&&(i=(t<3?a(i):t>3?a(e,n,i):a(e,n))||i);return t>3&&i&&Object.defineProperty(e,n,i),i};const k="typo3-backend-live-search-result-container";let o=class extends y{constructor(){super(...arguments),this.results=null,this.hasErrors=!1,this.loading=!1}connectedCallback(){super.connectedCallback(),this.addEventListener("livesearch:request-actions",this.onActionsRequested),this.addEventListener("livesearch:invoke-action",this.onActionInvoked)}disconnectedCallback(){this.removeEventListener("livesearch:request-actions",this.onActionsRequested),this.removeEventListener("livesearch:invoke-action",this.onActionInvoked),super.disconnectedCallback()}createRenderRoot(){return this}render(){return this.loading?c`<div class="d-flex flex-fill align-items-center justify-content-center"><typo3-backend-spinner size=large></typo3-backend-spinner></div>`:this.hasErrors?c`<div class="alert alert-danger">${v.get("liveSearch_hasErrors")}</div>`:this.results===null?b:this.results.length===0?c`<div class="alert alert-info">${v.get("liveSearch_listEmptyText")}</div>`:c`<typo3-backend-live-search-result-item-container .results=${this.results}></typo3-backend-live-search-result-item-container><typo3-backend-live-search-result-item-detail-container></typo3-backend-live-search-result-item-detail-container>`}onActionsRequested(e){this.resultDetailContainer.resultItem=e.detail.resultItem}onActionInvoked(e){const n=h.getInvokeHandlers(),r=e.detail.resultItem,t=e.detail.action;t!==void 0&&(typeof n[r.provider+"_"+t.identifier]=="function"?n[r.provider+"_"+t.identifier](r,t):m.ContentContainer.setUrl(t.url),this.dispatchEvent(new CustomEvent("live-search:item-chosen",{detail:{resultItem:r}})))}};s([u({type:Object})],o.prototype,"results",void 0),s([u({type:Boolean,attribute:!1})],o.prototype,"hasErrors",void 0),s([u({type:Boolean,attribute:!1})],o.prototype,"loading",void 0),s([p("typo3-backend-live-search-result-item-container")],o.prototype,"itemContainer",void 0),s([p("typo3-backend-live-search-result-item-detail-container")],o.prototype,"resultDetailContainer",void 0),o=s([f("typo3-backend-live-search-result-container")],o);export{o as ResultContainer,k as componentName};
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* 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!
|
||||
*/
|
||||
import{property as u,customElement as d}from"lit/decorators.js";import{LitElement as h,nothing as m,html as l}from"lit";import"@typo3/backend/live-search/element/result/item/action/action-container.js";var p=function(n,e,r,i){var s=arguments.length,t=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")t=Reflect.decorate(n,e,r,i);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(t=(s<3?a(t):s>3?a(e,r,t):a(e,r))||t);return s>3&&t&&Object.defineProperty(e,r,t),t};const b="typo3-backend-live-search-result-item-detail-container";let o=class extends h{constructor(){super(...arguments),this.resultItem=null}createRenderRoot(){return this}render(){if(this.resultItem===null)return m;const e=Object.entries(this.resultItem.properties??{});return l`<div class=livesearch-detail-preamble>${this.resultItem.thumbnailUrl?l`<div class=livesearch-detail-preamble-thumbnail><img src=${this.resultItem.thumbnailUrl} loading=lazy alt></div>`:l`<typo3-backend-icon identifier=${this.resultItem.icon.identifier} overlay=${this.resultItem.icon.overlay} size=large></typo3-backend-icon>`}<h3>${this.resultItem.itemTitle}</h3><p class=livesearch-detail-preamble-type>${this.resultItem.typeLabel}</p></div>${e.length>0?l`<dl class=livesearch-detail-properties>${e.map(([r,i])=>l`<dt>${r}</dt><dd>${i}</dd>`)}</dl>`:m}<typo3-backend-live-search-result-item-action-container .resultItem=${this.resultItem}></typo3-backend-live-search-result-item-action-container>`}};p([u({type:Object,attribute:!1})],o.prototype,"resultItem",void 0),o=p([d("typo3-backend-live-search-result-item-detail-container")],o);export{o as ResultDetailContainer,b as componentName};
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* 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!
|
||||
*/
|
||||
import{property as h,customElement as u}from"lit/decorators.js";import{LitElement as P,nothing as i,html as t}from"lit";import"@typo3/backend/element/icon-element.js";var n=function(s,e,l,r){var g=arguments.length,a=g<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,l):r,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,e,l,r);else for(var d=s.length-1;d>=0;d--)(c=s[d])&&(a=(g<3?c(a):g>3?c(e,l,a):c(e,l))||a);return g>3&&a&&Object.defineProperty(e,l,a),a};let p=class extends P{constructor(){super(...arguments),this.pagination=null,this.loading=!1}createRenderRoot(){return this}render(){return this.loading||this.pagination===null||this.pagination.allPageNumbers.length<=1?i:t`<nav><ul class=pagination><li class=page-item><typo3-backend-live-search-result-page class="page-link ${!this.pagination.previousPageNumber||this.pagination.previousPageNumber<this.pagination.firstPage?"disabled":""}" page=${this.pagination.previousPageNumber} perpage=${this.pagination.itemsPerPage}><typo3-backend-icon identifier=actions-view-paging-previous size=small></typo3-backend-icon></typo3-backend-live-search-result-page></li>${this.pagination.allPageNumbers.includes(this.pagination.firstPage)?i:t`<li class=page-item><typo3-backend-live-search-result-page class=page-link page=${this.pagination.firstPage} perpage=${this.pagination.itemsPerPage}>${this.pagination.firstPage}</typo3-backend-live-search-result-page></li>`} ${this.pagination.hasLessPages?t`<li class="page-item disabled"><span class="page-link disabled">…</span></li>`:i} ${this.pagination.allPageNumbers.map(e=>t`<li class=page-item><typo3-backend-live-search-result-page page=${e} perpage=${this.pagination.itemsPerPage} class="page-link ${this.pagination.currentPage===e?"active":""}">${e}</typo3-backend-live-search-result-page></li>`)} ${this.pagination.hasMorePages?t`<li class=page-item><span class="page-link disabled">…</span></li>`:i} ${this.pagination.allPageNumbers.includes(this.pagination.lastPage)?i:t`<li class=page-item><typo3-backend-live-search-result-page class=page-link page=${this.pagination.lastPage} perpage=${this.pagination.itemsPerPage}>${this.pagination.lastPage}</typo3-backend-live-search-result-page></li>`}<li class=page-item><typo3-backend-live-search-result-page class="page-link ${!this.pagination.nextPageNumber||this.pagination.nextPageNumber>this.pagination.lastPage?"disabled":""}" page=${this.pagination.nextPageNumber} perpage=${this.pagination.itemsPerPage}><typo3-backend-icon identifier=actions-view-paging-next size=small></typo3-backend-icon></typo3-backend-live-search-result-page></li></ul></nav>`}};n([h({type:Object})],p.prototype,"pagination",void 0),n([h({type:Boolean,attribute:!1})],p.prototype,"loading",void 0),p=n([u("typo3-backend-live-search-result-pagination")],p);let o=class extends P{connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.dispatchPaginationEvent)}disconnectedCallback(){this.removeEventListener("click",this.dispatchPaginationEvent),super.disconnectedCallback()}createRenderRoot(){return this}render(){return i}dispatchPaginationEvent(){this.closest("typo3-backend-live-search").dispatchEvent(new CustomEvent("livesearch:pagination-selected",{detail:{offset:(this.page-1)*this.perPage}}))}};n([h({type:Number})],o.prototype,"page",void 0),n([h({type:Number})],o.prototype,"perPage",void 0),o=n([u("typo3-backend-live-search-result-page")],o);export{p as ResultPagination,o as ResultPaginationPage};
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* 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!
|
||||
*/
|
||||
import{property as s,customElement as h}from"lit/decorators.js";import{LitElement as d,html as v}from"lit";import m from"@typo3/backend/storage/browser-session.js";var n=function(r,o,i,p){var c=arguments.length,t=c<3?o:p===null?p=Object.getOwnPropertyDescriptor(o,i):p,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")t=Reflect.decorate(r,o,i,p);else for(var l=r.length-1;l>=0;l--)(a=r[l])&&(t=(c<3?a(t):c>3?a(o,i,t):a(o,i))||t);return c>3&&t&&Object.defineProperty(o,i,t),t};let e=class extends d{constructor(){super(...arguments),this.active=!1}connectedCallback(){this.parentContainer=this.closest("typo3-backend-live-search"),super.connectedCallback()}createRenderRoot(){return this}render(){return v`<div class=form-check><input type=checkbox class=form-check-input name=${this.optionName}[] value=${this.optionId} id=${this.optionId} ?checked=${this.active} @input=${this.handleInput}> <label class=form-check-label for=${this.optionId}>${this.optionLabel}</label></div>`}getStorageKey(){return`livesearch-option-${this.optionName}-${this.optionId}`}handleInput(){this.active=!this.active,this.parentContainer.dispatchEvent(new CustomEvent("typo3:live-search:option-invoked",{detail:{active:this.active}})),m.set(this.getStorageKey(),this.active?"1":"0")}};n([s({type:Boolean})],e.prototype,"active",void 0),n([s({type:String})],e.prototype,"optionId",void 0),n([s({type:String})],e.prototype,"optionName",void 0),n([s({type:String})],e.prototype,"optionLabel",void 0),e=n([h("typo3-backend-live-search-option-item")],e);export{e as SearchOptionItem};
|
||||
Reference in New Issue
Block a user