TYPO3 v15 dev-main snapshot ()

This commit is contained in:
wappler committed 2026-08-10 22:31:00 +02:00
commit f9941541b7
1178 files changed
+135377

No files matched your search

@@ -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 l,nothing as p}from"lit";import{live as d}from"lit/directives/live.js";import{styleMap as f}from"lit/directives/style-map.js";import{repeat as u}from"lit/directives/repeat.js";import{Task as m,TaskStatus as h}from"@lit/task";import y from"@typo3/core/ajax/ajax-request.js";import"@typo3/backend/element/alert-element.js";import"@typo3/backend/element/icon-element.js";import"@typo3/backend/element/spinner-element.js";import n from"~labels/backend.wizards.localization";class g{constructor(e){this.context=e,this.key="contentRecordSelection",this.title=n.get("step.content_selection.title"),this.autoAdvance=!0,this.lastTargetLanguage=null,this.lastSourceLanguage=null,this.hasDispatchedAutoAdvance=!1,this.hasUserInteracted=!1,this.selectedRecordUids=[],this.task=new m(this.context.wizard,{task:async([t,i,s])=>await(await new y(TYPO3.settings.ajaxUrls.wizard_localization_get_content).withQueryArguments({pageUid:t,targetLanguage:i,sourceLanguage:s}).get()).resolve(),args:()=>[this.context.recordUid,this.context.getStoreData("targetLanguage"),this.context.getStoreData("sourceLanguage")],autoRun:!1})}isComplete(){return!0}render(){const e=this.context.getStoreData("targetLanguage"),t=this.context.getStoreData("sourceLanguage");return(this.lastTargetLanguage!==e||this.lastSourceLanguage!==t||this.task.status===h.INITIAL)&&(this.lastTargetLanguage=e,this.lastSourceLanguage=t,this.hasDispatchedAutoAdvance=!1,this.hasUserInteracted=!1,this.task.run()),this.task.render({complete:s=>{if(this.getValue().length===0&&!this.hasUserInteracted){const o=this.context.getStoreData("selectedRecordUids");o&&o.length>0&&this.setValue(o)}if(s.layout.elementCount===0&&!this.hasDispatchedAutoAdvance)return this.hasDispatchedAutoAdvance=!0,this.context.dispatchAutoAdvance(),this.context.wizard.renderLoader();const a=this.getAllRecordUids(s.layout);this.getValue().length===0&&a.length>0&&!this.hasUserInteracted&&this.setValue(a);const c=a.length>0&&a.every(o=>this.getValue().includes(o));return l`<div class=localization-record-selection><div class="d-flex justify-content-between align-items-center mb-3"><div><h2 class=h4>${n.get("step.content_selection.headline")}</h2><p class=mb-0>${n.get("step.content_selection.description")}</p></div>${a.length>0?l`<button type=button id=selectionToggle class="btn btn-primary" @click=${()=>this.handleSelectionToggle()}>${c?n.get("step.content_selection.button.deselect_all"):n.get("step.content_selection.button.select_all")}</button>`:p}</div>${a.length===0?l`<typo3-backend-alert severity=3 message=${n.get("step.content_selection.no_content.message")} show-icon></typo3-backend-alert>`:l`<div class=record-selection-content>${this.renderLayout(s.layout)}</div>`}</div>`},error:s=>this.context.wizard.renderError(n.get("step.content_selection.error.message"),s),pending:()=>this.context.wizard.renderLoader()})}reset(){this.setValue([]),this.context.clearStoreData("selectedRecordUids"),this.hasUserInteracted=!1}getValue(){return this.selectedRecordUids}setValue(e){this.selectedRecordUids=e,this.context.setStoreData("selectedRecordUids",e)}beforeAdvance(){this.context.setStoreData("selectedRecordUids",this.getValue())}getSelectedRecordsWithDetails(){const e=this.getValue(),t=[];return this.task.value&&this.task.value.layout.rows.forEach(i=>{i.columns.forEach(s=>{s.records.forEach(a=>{e.includes(a.uid)&&t.push(a)})})}),t}getSummaryData(){const e=this.getSelectedRecordsWithDetails();return e.length===0?[]:[{label:n.get("step.content_selection.summary.title"),value:l`<ul class=list-group>${e.map(i=>l`<li class=list-group-item><span title="id=${i.uid}"> <typo3-backend-icon identifier=${i.icon} size=small class=me-1></typo3-backend-icon> </span>${i.title}</li>`)}</ul>`}]}renderLayout(e){let t=1;return l`<div class=pagelayout>${e.rows.map(i=>{const s=this.renderRow(i,t);return t+=1,s})}</div>`}renderRow(e,t){let i=1;return l`${u(e.columns,s=>s.position,s=>{const a=this.renderColumn(s,t,i);return i+=s.colspan||1,a})}`}renderColumn(e,t,i){const s=e.records.filter(r=>this.getValue().includes(r.uid)),a=s.length===e.records.length,c=s.length>0&&s.length<e.records.length,o=f({"--pagelayout-cell-col":i,"--pagelayout-cell-colspan":e.colspan||1,"--pagelayout-cell-row":t,"--pagelayout-cell-rowspan":e.rowspan||1});return l`<div class=pagelayout-cell style=${o}><div class=pagelayout-cell-header>${e.records.length>0?l`<div class="form-check form-check-type-toggle"><input class=form-check-input type=checkbox id=records-column-${e.position} .checked=${d(a)} .indeterminate=${c} @change=${r=>this.handleColumnToggle(r,e)}> <label class=form-check-label for=records-column-${e.position}>${e.label}</label></div>`:l`<div class="form-check form-check-type-toggle"><div class=form-check-text>${e.label}</div></div>`}</div><div class=pagelayout-cell-content>${u(e.records,r=>r.uid,r=>this.renderRecord(r))}</div></div>`}renderRecord(e){return l`<div class="form-check form-check-type-toggle"><input type=checkbox class=form-check-inpu Line truncated
@@ -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 r}from"lit";import{live as c}from"lit/directives/live.js";import{Task as d,TaskStatus as h}from"@lit/task";import u from"@typo3/core/ajax/ajax-request.js";import i from"~labels/backend.wizards.localization";class p{constructor(e){this.context=e,this.key="handler",this.title=i.get("step.handler_selection.title"),this.autoAdvance=!0,this.hasDispatchedAutoAdvance=!1,this.selectedHandler=null,this.task=new d(this.context.wizard,{task:async([t,a,n,s,l])=>{if(n==null||s==null||l==null)return[];try{return await(await new u(TYPO3.settings.ajaxUrls.wizard_localization_get_handlers).withQueryArguments({recordType:t,recordUid:a,sourceLanguage:n,targetLanguage:s,mode:l}).get()).resolve()}catch(o){return console.warn("Failed to fetch handlers:",o),[]}},args:()=>[this.context.recordType,this.context.recordUid,this.context.getStoreData("sourceLanguage"),this.context.getStoreData("targetLanguage"),this.context.getStoreData("localizationMode")],autoRun:!1})}isComplete(){return this.getValue()!==null}render(){return this.task.status===h.INITIAL&&this.task.run(),this.task.render({complete:e=>{if(this.getValue()==null){const a=this.context.getStoreData("localizationHandler");a!=null&&this.setValue(a)}let t=!1;return this.getValue()==null&&e.length>0&&(this.setValue(e[0].identifier),e.length===1&&(t=!0)),t&&!this.hasDispatchedAutoAdvance?(this.hasDispatchedAutoAdvance=!0,this.context.dispatchAutoAdvance(),this.context.wizard.renderLoader()):e.length===0?r`<div class="alert alert-warning"><p>${i.get("step.handler_selection.no_handlers")}</p></div>`:r`<div class=localization-handler-selection><h2 class=h4>${i.get("step.handler_selection.headline")}</h2><p>${i.get("step.handler_selection.description")}</p><div class=form-check-card-container>${e.map(a=>this.renderHandlerOption(a))}</div></div>`},error:e=>this.context.wizard.renderError(i.get("step.handler_selection.error"),e),pending:()=>this.context.wizard.renderLoader()})}reset(){this.setValue(null),this.context.clearStoreData("localizationHandler")}getValue(){return this.selectedHandler}setValue(e){this.selectedHandler=e}beforeAdvance(){this.context.setStoreData("localizationHandler",this.getValue())}getSummaryData(){const e=this.context.getStoreData("localizationHandler");if(e==null||!this.task.value)return[];const t=this.task.value.find(a=>a.identifier===e);return t?[{label:i.get("step.handler_selection.summary_label"),value:r`<typo3-backend-icon identifier=${t.iconIdentifier} size=small class=me-1></typo3-backend-icon>${t.label}`}]:[]}renderHandlerOption(e){const t=this.getValue()===e.identifier;return r`<div class="form-check form-check-type-card"><input class=form-check-input type=radio name=localization-handler id=handler-${e.identifier} value=${e.identifier} .checked=${c(t)} @change=${()=>this.setValue(e.identifier)}> <label class=form-check-label for=handler-${e.identifier}><span class=form-check-label-header> <typo3-backend-icon identifier=${e.iconIdentifier} size=small></typo3-backend-icon> ${e.label} </span> <span class=form-check-label-body>${e.description} </span></label></div>`}}export{p as HandlerSelectionStep};
@@ -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{nothing as c,html as o}from"lit";import{live as d}from"lit/directives/live.js";import{unsafeHTML as h}from"lit/directives/unsafe-html.js";import{Task as u,TaskStatus as p}from"@lit/task";import m from"@typo3/core/ajax/ajax-request.js";import i from"~labels/backend.wizards.localization";class l{constructor(e){this.context=e,this.key="mode",this.title=i.get("step.modes.title"),this.autoAdvance=!0,this.hasDispatchedAutoAdvance=!1,this.selectedMode=null,this.task=new u(this.context.wizard,{task:async([a,s,t,r])=>{if(t==null||r==null)return[];try{return await(await new m(TYPO3.settings.ajaxUrls.wizard_localization_get_modes).withQueryArguments({recordType:a,recordUid:s,targetLanguage:t,sourceLanguage:r}).get()).resolve()}catch(n){return console.warn("Failed to fetch localization modes:",n),[]}},args:()=>[this.context.recordType,this.context.recordUid,this.context.getStoreData("targetLanguage"),this.context.getStoreData("sourceLanguage")],autoRun:!1})}isComplete(){return this.getValue()!==null}render(){return this.task.status===p.INITIAL&&this.task.run(),this.task.render({complete:e=>{if(this.getValue()==null){const t=this.context.getStoreData("localizationMode");t!=null&&this.setValue(t)}let a=!1;if(this.getValue()==null&&e.length>0&&(this.setValue(e[0].key),e.length===1&&(a=!0)),a&&!this.hasDispatchedAutoAdvance)return this.hasDispatchedAutoAdvance=!0,this.context.dispatchAutoAdvance(),this.context.wizard.renderLoader();let s=c;return e.length===0?s=o`<div class=text-center><p>${i.get("step.modes.none_available")}</p></div>`:s=o`<p>${i.get("step.modes.description")}</p><div class=form-check-card-container>${e.map(t=>o`<div class="form-check form-check-type-card"><input class=form-check-input type=radio name=localizationMode id=mode-${t.key} value=${t.key} .checked=${d(this.getValue()===t.key)} @change=${()=>this.setValue(t.key)}> <label class=form-check-label for=mode-${t.key}><span class=form-check-label-header> <typo3-backend-icon identifier=${t.iconIdentifier} size=medium></typo3-backend-icon> ${t.label} </span> <span class=form-check-label-body>${h(t.description)} </span></label></div>`)}</div>`,o`<div class=localization-mode-selection><h2 class=h4>${i.get("step.modes.headline")}</h2>${s}</div>`},error:e=>this.context.wizard.renderError(i.get("step.modes.error.message"),e),pending:()=>this.context.wizard.renderLoader()})}reset(){this.setValue(null),this.context.clearStoreData("localizationMode")}getValue(){return this.selectedMode}setValue(e){this.selectedMode=e}beforeAdvance(){this.context.setStoreData("localizationMode",this.getValue())}getSummaryData(){const e=this.context.getStoreData("localizationMode");if(!e||!this.task.value)return[];const a=this.task.value.find(s=>s.key===e);return a?[{label:i.get("step.modes.summary.title"),value:o`<typo3-backend-icon identifier=${a.iconIdentifier} size=small class=me-1></typo3-backend-icon>${a.label}`}]:[]}}export{l as ModeStep,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 i}from"lit";import{live as o}from"lit/directives/live.js";import{Task as l,TaskStatus as u}from"@lit/task";import d from"@typo3/core/ajax/ajax-request.js";import s from"~labels/backend.wizards.localization";class c{constructor(t){this.context=t,this.key="sourceLanguage",this.title=s.get("step.source_language.title"),this.autoAdvance=!0,this.hasDispatchedAutoAdvance=!1,this.selectedLanguage=null,this.task=new l(this.context.wizard,{task:async([a,e,r])=>{if(r==null)return[];try{return await(await new d(TYPO3.settings.ajaxUrls.wizard_localization_get_sources).withQueryArguments({recordType:a,recordUid:e,targetLanguage:r}).get()).resolve()}catch(n){return console.warn("Failed to fetch source languages:",n),[]}},args:()=>[this.context.recordType,this.context.recordUid,this.context.getStoreData("targetLanguage")],autoRun:!1})}isComplete(){return this.getValue()!=null}render(){return this.task.status===u.INITIAL&&this.task.run(),this.task.render({complete:t=>{if(this.getValue()==null){const e=this.context.getStoreData("sourceLanguage");e!=null&&this.setValue(e)}let a=!1;if(this.getValue()==null&&t.length>0){const e=t.find(r=>r.uid===0)||t[0];this.setValue(e.uid),t.length===1&&(a=!0)}return a&&!this.hasDispatchedAutoAdvance?(this.hasDispatchedAutoAdvance=!0,this.context.dispatchAutoAdvance(),this.context.wizard.renderLoader()):t.length===0?i`<div class=localization-language-selection><h2 class=h4>${s.get("step.source_language.headline")}</h2><div class=text-center><p>${s.get("step.source_language.none_available")}</p></div></div>`:i`<div class=localization-language-selection><h2 class=h4>${s.get("step.source_language.headline")}</h2><p>${s.get("step.source_language.description")}</p><div class=form-check-card-container>${t.map(e=>i`<div class="form-check form-check-type-card"><input class=form-check-input type=radio name=sourceLanguage id=source-lang-${e.uid} value=${e.uid} .checked=${o(this.getValue()===e.uid)} @change=${()=>this.setValue(e.uid)}> <label class=form-check-label for=source-lang-${e.uid}><span class="form-check-label-header form-check-label-header-inherit"> <typo3-backend-icon identifier=${e.flagIcon} size=small></typo3-backend-icon> ${e.title} </span></label></div>`)}</div></div>`},error:t=>this.context.wizard.renderError(s.get("step.source_language.error.message"),t),pending:()=>this.context.wizard.renderLoader()})}reset(){this.setValue(null),this.context.clearStoreData("sourceLanguage")}getValue(){return this.selectedLanguage}setValue(t){this.selectedLanguage=t}beforeAdvance(){this.context.setStoreData("sourceLanguage",this.getValue())}getSummaryData(){const t=this.context.getStoreData("sourceLanguage");if(t==null||!this.task.value)return[];const a=this.task.value.find(e=>e.uid===t);return a?[{label:s.get("step.source_language.summary.title"),value:i`<typo3-backend-icon identifier=${a.flagIcon} size=small class=me-1></typo3-backend-icon>${a.title}`}]:[]}}export{c as SourceLanguageStep,c 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 s}from"lit";import{live as g}from"lit/directives/live.js";import{Task as u,TaskStatus as d}from"@lit/task";import h from"@typo3/core/ajax/ajax-request.js";import"@typo3/backend/localization/localization-wizard.js";import r from"~labels/backend.wizards.localization";class c{constructor(t){this.context=t,this.key="targetLanguage",this.title=r.get("step.target_language.title"),this.autoAdvance=!0,this.hasDispatchedAutoAdvance=!1,this.selectedLanguage=null,this.task=new u(this.context.wizard,{task:async([a,e])=>{try{let i=await(await new h(TYPO3.settings.ajaxUrls.wizard_localization_get_targets).withQueryArguments({recordType:a,recordUid:e}).get()).resolve();const l=this.context.targetLanguage;return l!=null&&(i=i.filter(o=>o.uid===l)),i}catch(n){return console.warn("Failed to fetch target languages:",n),[]}},args:()=>[this.context.recordType,this.context.recordUid],autoRun:!1})}isComplete(){return this.getValue()!=null}render(){return this.task.status===d.INITIAL&&this.task.run(),this.task.render({complete:t=>{if(this.getValue()==null){const e=this.context.getStoreData("targetLanguage");e!=null&&this.setValue(e)}let a=!1;if(this.getValue()==null){const e=this.context.targetLanguage;if(e!=null?(this.setValue(e),a=!0):t.length>0&&(this.setValue(t[0].uid),t.length===1&&(a=!0)),a&&!this.hasDispatchedAutoAdvance)return this.hasDispatchedAutoAdvance=!0,this.context.dispatchAutoAdvance(),this.context.wizard.renderLoader()}return t.length===0?s`<div class=localization-language-selection><h2 class=h4>${r.get("step.target_language.headline")}</h2><div class=text-center><p>${r.get("step.target_language.none_available")}</p></div></div>`:s`<div class=localization-language-selection><h2 class=h4>${r.get("step.target_language.headline")}</h2><p>${r.get("step.target_language.description")}</p><div class=form-check-card-container>${t.map(e=>s`<div class="form-check form-check-type-card"><input class=form-check-input type=radio name=targetLanguage id=target-lang-${e.uid} value=${e.uid} .checked=${g(this.getValue()===e.uid)} @change=${()=>this.setValue(e.uid)}> <label class=form-check-label for=target-lang-${e.uid}><span class="form-check-label-header form-check-label-header-inherit"> <typo3-backend-icon identifier=${e.flagIcon} size=small></typo3-backend-icon> ${e.title} </span></label></div>`)}</div></div>`},error:t=>this.context.wizard.renderError(r.get("step.target_language.error.message"),t),pending:()=>this.context.wizard.renderLoader()})}reset(){this.setValue(null),this.context.clearStoreData("targetLanguage")}getValue(){return this.selectedLanguage}setValue(t){this.selectedLanguage=t}beforeAdvance(){this.context.setStoreData("targetLanguage",this.getValue())}getSummaryData(){const t=this.context.getStoreData("targetLanguage");if(t==null||!this.task.value)return[];const a=this.task.value.find(e=>e.uid===t);return a?[{label:r.get("step.target_language.summary.title"),value:s`<typo3-backend-icon identifier=${a.flagIcon} size=small class=me-1></typo3-backend-icon>${a.title}`}]:[]}}export{c as TargetLanguageStep,c as default};