TYPO3 v15 dev-main snapshot ()
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -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!
|
||||
*/
|
||||
class t extends CustomEvent{static{this.eventName="typo3:page-layout:hidden-content-count-changed"}constructor(e){super(t.eventName,{detail:{count:e}})}}export{t as HiddenContentCountChangedEvent};
|
||||
@@ -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/ajax/ajax-request.js";import f from"@typo3/backend/notification.js";import b from"@typo3/core/event/regular-event.js";import{sudoModeInterceptor as y}from"@typo3/backend/security/sudo-mode-interceptor.js";import r from"~labels/backend.layout";import{HiddenContentCountChangedEvent as h}from"@typo3/backend/layout-module/page-layout-event.js";import{HiddenContentCountChangedEvent as L}from"@typo3/backend/layout-module/page-layout-event.js";import"@typo3/backend/element/icon-element.js";new b("click",async(s,d)=>{s.preventDefault(),s.stopPropagation();const i=d;if(i.disabled)return;i.disabled=!0;const e=i.closest(".t3js-page-ce");if(e===null){i.disabled=!1;return}const c=e.dataset.table,l=parseInt(e.dataset.uid??"0",10),g=e.classList.contains("t3js-hidden-record"),u=i.querySelector("typo3-backend-icon");try{const t=await(await new p(TYPO3.settings.ajaxUrls.record_toggle_visibility).addMiddleware(y).post({table:c,uid:l,action:g?"show":"hide"})).resolve();if(e.classList.toggle("t3-page-ce-hidden",!t.isVisible),e.classList.toggle("t3js-hidden-record",!t.isVisible),t.isVisible)e.style.display="";else{const a=document.querySelector("typo3-backend-page-layout-toggle-hidden");a&&!a.active&&(e.style.display="none")}u?.setAttribute("identifier",t.isVisible?"actions-edit-hide":"actions-edit-unhide"),i.title=t.isVisible?r.get("hide"):r.get("unHide");const o=e.querySelector(".t3-page-ce-header-left [data-contextmenu-trigger] .t3js-icon");o&&t.icon&&o.replaceWith(document.createRange().createContextualFragment(t.icon));const m=document.querySelectorAll(".t3js-hidden-record").length;document.dispatchEvent(new h(m))}catch(n){if(n&&typeof n.resolve=="function"){const t=await n.resolve();for(const o of t.messages??[])f.error(o.title,o.message)}}finally{i.disabled=!1}}).delegateTo(document,'button[data-action="content-element-visibility-toggle"]');export{L as HiddenContentCountChangedEvent};
|
||||
@@ -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 d from"@typo3/core/document-service.js";import m from"@typo3/backend/ajax-data-handler.js";import u from"@typo3/backend/modal.js";import h from"@typo3/backend/severity.js";import"@typo3/backend/element/icon-element.js";import{SeverityEnum as p}from"@typo3/backend/enum/severity.js";import g from"@typo3/core/event/regular-event.js";import a from"~labels/backend.layout";class l{constructor(t){this.itemOnClipboardUid=0,this.itemOnClipboardTitle="",this.copyMode="",this.elementIdentifier=".t3js-page-ce",this.pasteAfterLinkTemplate="",this.pasteIntoLinkTemplate="",this.itemOnClipboardUid=t.itemOnClipboardUid,this.itemOnClipboardTitle=t.itemOnClipboardTitle,this.copyMode=t.copyMode,d.ready().then(()=>{document.querySelectorAll(".t3js-page-columns").length>0&&(this.generateButtonTemplates(),this.activatePasteIcons(),this.initializeEvents())})}static determineColumn(t){const e=t.closest("[data-colpos]");return parseInt(e?.dataset?.colpos??"0",10)}initializeEvents(){new g("click",(t,e)=>{t.preventDefault(),this.activatePasteModal(e)}).delegateTo(document,".t3js-paste")}generateButtonTemplates(){this.itemOnClipboardUid&&(this.pasteAfterLinkTemplate='<button type="button" class="t3js-paste t3js-paste'+(this.copyMode?"-"+this.copyMode:"")+' t3js-paste-after btn btn-default btn-sm" title="'+a.get("pasteAfterRecord")+'"><typo3-backend-icon identifier="actions-document-paste-into" size="small"></typo3-backend-icon></button>',this.pasteIntoLinkTemplate='<button type="button" class="t3js-paste t3js-paste'+(this.copyMode?"-"+this.copyMode:"")+' t3js-paste-into btn btn-default btn-sm" title="'+a.get("pasteIntoColumn")+'"><typo3-backend-icon identifier="actions-document-paste-into" size="small"></typo3-backend-icon></button>')}activatePasteIcons(){this.pasteAfterLinkTemplate&&this.pasteIntoLinkTemplate&&document.querySelectorAll(".t3js-page-new-ce").forEach(t=>{const e=t.parentElement.dataset.page?this.pasteIntoLinkTemplate:this.pasteAfterLinkTemplate;t.append(document.createRange().createContextualFragment(e))})}activatePasteModal(t){const e=a.get("paste.modal.title.paste")+': "'+this.itemOnClipboardTitle+'"',i=a.get("paste.modal.paste");let s=[];s=[{text:a.get("paste.modal.button.cancel"),active:!0,btnClass:"btn-default",trigger:(n,o)=>o.hideModal()},{text:a.get("paste.modal.button.paste"),btnClass:"btn-"+h.getCssClass(p.warning),trigger:(n,o)=>{o.hideModal(),this.execute(t)}}],u.show(e,i,p.warning,s)}execute(t){const e=l.determineColumn(t),i=t.closest(this.elementIdentifier),s=i.dataset.uid;let n;typeof s>"u"?n=parseInt(i.dataset.page,10):n=0-parseInt(s,10);const o=parseInt(t.closest("[data-language-uid]").dataset.languageUid,10),r={CB:{paste:"tt_content|"+n,pad:"normal",update:{colPos:e,sys_language_uid:o}}};m.process(r).then(c=>{c.hasErrors||window.location.reload()})}}export{l as default};
|
||||
@@ -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{html as h}from"lit";import{property as c,customElement as p}from"lit/decorators.js";import{PseudoButtonLitElement as m}from"@typo3/backend/element/pseudo-button.js";import y from"@typo3/backend/storage/persistent.js";import f from"~labels/backend.layout";import"@typo3/backend/element/icon-element.js";import{HiddenContentCountChangedEvent as u}from"@typo3/backend/layout-module/page-layout-event.js";var l=function(r,t,n,e){var i=arguments.length,o=i<3?t:e===null?e=Object.getOwnPropertyDescriptor(t,n):e,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(r,t,n,e);else for(var d=r.length-1;d>=0;d--)(a=r[d])&&(o=(i<3?a(o):i>3?a(t,n,o):a(t,n))||o);return i>3&&o&&Object.defineProperty(t,n,o),o};let s=class extends m{constructor(){super(...arguments),this.active=!1,this.count=0,this.onCountChanged=t=>{this.count=t.detail.count}}connectedCallback(){super.connectedCallback(),this.syncDropdownToggleStatus(),document.addEventListener(u.eventName,this.onCountChanged)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener(u.eventName,this.onCountChanged)}updated(t){t.has("active")&&this.syncDropdownToggleStatus()}createRenderRoot(){return this}render(){return h`<span class=dropdown-item-status></span><typo3-backend-icon identifier=actions-eye size=small></typo3-backend-icon>${f.get("hiddenCE")} (${this.count})`}buttonActivated(){if(this.hasAttribute("disabled"))return;this.setAttribute("disabled","");const t=!this.active,n=document.querySelectorAll(".t3js-hidden-record");for(const e of n){e.style.display="flow-root";const i=e.scrollHeight;e.style.overflow="clip",t?(e.addEventListener("transitionend",()=>{e.style.display="",e.style.overflow="",e.style.height=""},{once:!0}),e.style.height=i+"px"):(e.addEventListener("transitionend",()=>{e.style.display="none",e.style.overflow=""},{once:!0}),requestAnimationFrame(()=>{e.style.height=i+"px",requestAnimationFrame(()=>{e.style.height="0px"})}))}this.active=t,y.set("moduleData.web_layout.showHidden",t?"1":"0").then(()=>{this.removeAttribute("disabled")})}syncDropdownToggleStatus(){this.dataset.dropdowntoggleStatus=this.active?"active":"inactive"}};l([c({type:Boolean,reflect:!0})],s.prototype,"active",void 0),l([c({type:Number})],s.prototype,"count",void 0),s=l([p("typo3-backend-page-layout-toggle-hidden")],s);export{s as PageLayoutToggleHidden};
|
||||
@@ -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 S from"@typo3/core/document-service.js";import T from"@typo3/core/event/regular-event.js";const u=.2,f=2.5;S.ready().then(()=>{new T("dragstart",l=>{E(l)}).delegateTo(document,'[draggable="true"]')});function E(l){const t=document.scrollingElement;if(!(t instanceof HTMLElement)){console.warn("Scrolling element is not an HTMLElement. Velocity scroll will not work.");return}const e=p(l.target)??t;let a=0,s=0,m=!0,h=performance.now();const v=t.style.scrollBehavior,H=e.style.scrollBehavior;t.style.scrollBehavior="auto",e.style.scrollBehavior="auto";const w=o=>{const n=(o-h)/1e3;h=o;const r=t.scrollHeight-t.clientHeight,c=e.scrollWidth-e.clientWidth;t.scrollTop=Math.max(0,Math.min(t.scrollTop+a*n,r)),e.scrollLeft=Math.max(0,Math.min(e.scrollLeft+s*n,c)),m&&requestAnimationFrame(w)};requestAnimationFrame(w);const i=(o,n,r)=>o<n?(1-o/n)**2*r:0,d=o=>{const n=window.innerHeight*u,r=window.innerWidth*u,c=window.innerHeight*f,g=window.innerWidth*f;a=i(window.innerHeight-o.clientY,n,c)-i(o.clientY,n,c),s=i(window.innerWidth-o.clientX,r,g)-i(o.clientX,r,g)};d(l),window.addEventListener("dragover",d),window.addEventListener("dragend",()=>{window.removeEventListener("dragover",d),a=0,s=0,m=!1,t.style.scrollBehavior=v,e.style.scrollBehavior=H},{once:!0})}function p(l){let t=l;for(;t instanceof HTMLElement;){if(t.scrollWidth>t.clientWidth){const e=window.getComputedStyle(t).overflowX;if(e==="auto"||e==="scroll")return t}t=t.parentElement}return null}export{E as initVelocityScroll};
|
||||
Reference in New Issue
Block a user