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 h from"@typo3/backend/storage/client.js";import S from"@typo3/core/document-service.js";import d from"@typo3/core/event/regular-event.js";class u{constructor(){this.localStorageKey="collapse-states-",this.localStorageKeyDefaultSuffix="general",this.searchValueSelector=".t3js-collapse-search-term",this.searchField=null,this.searchForm=null,this.stateCache=new Map,S.ready().then(()=>{this.searchField=document.querySelector(this.searchValueSelector),this.searchField!==null&&(this.searchForm=this.searchField.closest("form"),this.searchField.value=h.get(this.searchField.dataset.persistCollapseSearchKey)??""),this.registerEventListener(),this.recoverStates()})}registerEventListener(){const a='.collapse[data-persist-collapse-state="true"]';new d("show.bs.collapse",t=>{const e=t.target;e.dataset.persistCollapseState==="true"&&(this.searchField!==null&&this.searchField.value===""||e.dataset.persistCollapseStateNotIfSearch===void 0)&&this.toStorage(e,!0)}).delegateTo(document,a),new d("hide.bs.collapse",t=>{const e=t.target;e.dataset.persistCollapseState==="true"&&(this.searchField!==null&&this.searchField.value===""||e.dataset.persistCollapseStateNotIfSearch===void 0)&&this.toStorage(e,!1)}).delegateTo(document,a),this.searchForm!==null&&new d("submit",t=>{t.preventDefault(),this.searchField!==null&&this.searchField.value===""&&this.recoverStates()}).bindTo(this.searchForm)}recoverStates(){document.querySelectorAll('.collapse[data-persist-collapse-state="true"]').forEach(t=>{const e=t.dataset.persistCollapseStateSuffix??this.localStorageKeyDefaultSuffix,l=this.fromStorage(e),s=t.id;if(s===""||!this.shallRecoverState(t))return;const o=(t.dataset.persistCollapseStateIfState??"shown")==="shown",i=(t.dataset.persistCollapseStateIfState??"hidden")==="hidden",c=t.classList.contains("show");if(o===!0){if(l[s]===!0){if(!c){const r=document.querySelector('[data-bs-target="#'+s+'"]');r.classList.remove("collapsed"),r.setAttribute("aria-expanded","true"),t.classList.add("show")}}else if(c){const r=document.querySelector('[data-bs-target="#'+s+'"]');r.classList.add("collapsed"),r.setAttribute("aria-expanded","false"),t.classList.remove("show")}}if(i===!0){if(l[s]===!1){if(c){const r=document.querySelector('[data-bs-target="#'+s+'"]');r.classList.add("collapsed"),r.setAttribute("aria-expanded","false"),t.classList.remove("show")}}else if(!c){const r=document.querySelector('[data-bs-target="#'+s+'"]');r.classList.remove("collapsed"),r.setAttribute("aria-expanded","true"),t.classList.add("show")}}})}shallRecoverState(a){return a.dataset.persistCollapseStateNotIfSearch===void 0||a.dataset.persistCollapseStateNotIfSearch==="false"?!0:this.searchField!==null&&this.searchField.value===""}fromStorage(a){let t;if(this.stateCache.has(this.localStorageKey+a))t=this.stateCache.get(this.localStorageKey+a);else{const e=h.get(this.localStorageKey+a);t=e!==null?JSON.parse(e):{},this.stateCache.set(this.localStorageKey+a,t)}return t}toStorage(a,t){const e=a.id,l=a.dataset.persistCollapseStateSuffix??this.localStorageKeyDefaultSuffix,s=this.fromStorage(l),o=(a.dataset.persistCollapseStateIfState??"shown")==="shown",i=(a.dataset.persistCollapseStateIfState??"hidden")==="hidden";t===!0&&o===!0&&s[e]!==!0&&(s[e]=!0,this.updateStates(this.localStorageKey+l,s)),t===!0&&i===!0&&s[e]===!1&&(delete s[e],this.updateStates(this.localStorageKey+l,s)),t===!1&&i===!0&&s[e]!==!1&&(s[e]=!1,this.updateStates(this.localStorageKey+l,s)),t===!1&&o===!0&&s[e]===!0&&(delete s[e],this.updateStates(this.localStorageKey+l,s))}updateStates(a,t){h.set(a,JSON.stringify(t)),this.stateCache.set(a,t)}}var n=new u;export{u as CollapseStatePersister,n 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 h from"@typo3/backend/storage/client.js";import f from"@typo3/core/document-service.js";import m from"@typo3/core/event/debounce-event.js";import d from"@typo3/core/event/regular-event.js";import p from"mark.js";import S from"@typo3/backend/utility/dom-helper.js";import y from"~labels/backend.messages";class g{constructor(){this.searchValueSelector=".t3js-collapse-search-term",this.searchValue="",this.markInstances=[],f.ready().then(()=>{if(this.treeContainers=document.querySelectorAll(".t3js-collapse-states-search-tree"),this.treeContainers.length!==0){this.numberOfSearchMatchesContainer=document.querySelectorAll(".t3js-collapse-states-search-numberOfSearchMatches"),this.searchField=document.querySelector(this.searchValueSelector),this.searchForm=this.searchField.closest("form"),this.searchSessionKey=this.searchField.dataset.persistCollapseSearchKey,this.searchValue=h.get(this.searchSessionKey)??"",this.registerEvents();for(let e=0;e<this.treeContainers.length;e++)this.markInstances[e]=new p(this.treeContainers[e]);this.searchValue!==""&&(this.searchField.value=this.searchValue,this.searchField.dispatchEvent(new Event("keyup")),this.searchForm.requestSubmit())}})}registerEvents(){new d("search",()=>{this.searchField.value===""&&this.searchForm.requestSubmit()}).bindTo(this.searchField),new m("input",()=>{this.searchForm.requestSubmit()}).bindTo(this.searchField),new d("submit",e=>{e.preventDefault();for(let t=0;t<this.treeContainers.length;t++)this.filterTree(this.searchField.value,this.treeContainers[t],this.numberOfSearchMatchesContainer[t],this.markInstances[t])}).bindTo(this.searchForm)}filterTree(e,t,s,a){if(e=e.toLowerCase(),a.unmark(),h.set(this.searchSessionKey,e),e.length<3){s.classList.add("hidden");return}const n=new Set,c=[...this.findNodesByIdentifier(e,t),...this.findNodesByValue(e,t),...this.findNodesByComment(e,t),...this.findNodesByConstantSubstitution(e,t)];s.innerText=y.get("collapse_state_search.numberOfSearchMatches",{count:c.length}),s.classList.remove("hidden"),c.forEach(r=>{if(r===null)return;const o=r.parentElement.querySelector('[data-bs-toggle="collapse"]')?.dataset.bsTarget;o!==void 0&&n.add(o.substring(1));const l=S.parents(r,".collapse");for(const i of l)n.add(i.id)});const u=Array.from(t.querySelectorAll(".collapse"));for(const r of u){const o=r.classList.contains("show"),l=r.id;if(n.has(l)){if(!o){const i=document.querySelector('[data-bs-target="#'+l+'"]');i.classList.remove("collapsed"),i.setAttribute("aria-expanded","true"),r.classList.add("show")}}else if(o){const i=document.querySelector('[data-bs-target="#'+l+'"]');i.classList.add("collapsed"),i.setAttribute("aria-expanded","false"),r.classList.remove("show")}}a.mark(e,{element:"span",className:"text-highlight"})}findNodesByIdentifier(e,t){return Array.from(t.querySelectorAll(".treelist-label")).filter(s=>s.textContent.toLowerCase().includes(e))}findNodesByValue(e,t){return Array.from(t.querySelectorAll(".treelist-value")).filter(a=>a.textContent.toLowerCase().includes(e)).map(a=>a.previousElementSibling)}findNodesByComment(e,t){return Array.from(t.querySelectorAll(".treelist-comment")).filter(s=>s.textContent.toLowerCase().includes(e))}findNodesByConstantSubstitution(e,t){return Array.from(t.querySelectorAll(".treelist-constant-substitution")).filter(s=>s.textContent.toLowerCase().includes(e))}}var b=new g;export{b 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!
|
||||
*/
|
||||
class o{static parents(t,e){const n=[];let l;for(;(l=t.parentElement.closest(e))!==null;)t=l,n.push(l);return n}static scrollableParent(t){let e=t.parentElement;for(;e;){const l=window.getComputedStyle(e).overflowY;if(l==="auto"||l==="scroll")return e;e=e.parentElement}return document.documentElement}static scrollEventTarget(t){const e=this.scrollableParent(t);return e===document.documentElement?document:e}static nextAll(t){const e=[];let n=t.nextElementSibling;for(;n!==null;)e.push(n),n=n.nextElementSibling;return e}static scrollIntoViewIfNeeded(t,e=!1){if(!e&&"scrollIntoViewIfNeeded"in t&&typeof t.scrollIntoViewIfNeeded=="function")t.scrollIntoViewIfNeeded(!0);else{const n=t.getBoundingClientRect();n.top>=0&&n.left>=0&&n.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&n.right<=(window.innerWidth||document.documentElement.clientWidth)||(e?t.scrollIntoView({behavior:"smooth",block:"center",inline:"center"}):t.scrollIntoView())}}}export{o 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!
|
||||
*/
|
||||
class e{static isCopyModifierFromEvent(t){return t.dataTransfer.dropEffect==="copy"?!0:t.dataTransfer.dropEffect==="move"?!1:navigator.userAgent.includes("Mac")?t.dataTransfer.effectAllowed==="copy"||t.altKey:t.ctrlKey}static updateEventAndTooltipToReflectCopyMoveIntention(t){const o=e.isCopyModifierFromEvent(t);t.dataTransfer.dropEffect=o?"copy":"move",top.document.dispatchEvent(new CustomEvent("typo3:drag-tooltip:metadata-update",{detail:{statusIconIdentifier:o?"actions-duplicate":"actions-move"}}))}}export{e 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!
|
||||
*/
|
||||
class s{static fileSizeAsString(t,B="iec"){const a={iec:{base:1024,labels:[" "," KiB"," MiB"," GiB"," TiB"," PiB"," EiB"," ZiB"," YiB"]},si:{base:1e3,labels:[" "," kB"," MB"," GB"," TB"," PB"," EB"," ZB"," YB"]}}[B],i=t===0?0:Math.floor(Math.log(t)/Math.log(a.base));return+(t/Math.pow(a.base,i)).toFixed(2)+a.labels[i]}}export{s as FormatUtility};
|
||||
@@ -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 i{static getOrigin(){return window.origin}static verifyOrigin(n){return i.getOrigin()===n}static send(n,r=window){r.postMessage(n,i.getOrigin())}}export{i as MessageUtility};
|
||||
@@ -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!
|
||||
*/
|
||||
function o(t){const e=new CustomEvent("typo3:import-javascript-module",{detail:{specifier:t,importPromise:null}});return top.document.dispatchEvent(e),e.detail.importPromise?e.detail.importPromise:Promise.reject(new Error("Top level did not respond with a promise."))}export{o as topLevelModuleImport};
|
||||
Reference in New Issue
Block a user