TYPO3 v15 dev-main snapshot ()
This commit is contained in:
+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 o from"@typo3/core/ajax/ajax-request.js";import s from"~labels/form.form_manager_javascript";class a{constructor(e){this.context=e}async execute(){const e=this.context.getDataStore(),r=this.context.formManager.getAjaxEndpoint("create"),t=await(await new o(r).post({formName:e.settings.formName,templatePath:e.settings.template,prototypeName:e.settings.prototype,storage:e.storage.typeIdentifier,storageLocation:e.settings.storageLocation})).resolve();return t?.status==="success"?{success:!0,finisher:{identifier:"redirect",module:"@typo3/backend/wizard/finisher/redirect-finisher.js",data:{url:t.url},labels:{successTitle:s.get("formManager.finisher.redirect.success.title"),successDescription:s.get("formManager.finisher.redirect.success.description")}}}:{success:!1,errors:[t?.message]}}}export{a as CreateFormSubmissionService};
|
||||
+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 i from"@typo3/core/ajax/ajax-request.js";import r from"~labels/form.form_manager_javascript";class o{constructor(e,s){this.context=e,this.formPersistenceIdentifier=s}async execute(){const e=this.context.getDataStore(),s=this.context.formManager.getAjaxEndpoint("duplicate"),t=await(await new i(s).post({formName:e.settings.formName,storage:e.storage.typeIdentifier,storageLocation:e.settings.storageLocation,formPersistenceIdentifier:this.formPersistenceIdentifier})).resolve();return t?.status==="success"?{success:!0,finisher:{identifier:"redirect",module:"@typo3/backend/wizard/finisher/redirect-finisher.js",data:{url:t.url},labels:{successTitle:r.get("formManager.finisher.redirect.success.title"),successDescription:r.get("formManager.finisher.redirect.success.description")}}}:{success:!1,errors:[t?.message]}}}export{o as DuplicateFormSubmissionService};
|
||||
@@ -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/wizard/wizard.js";import{state as d,property as l,query as S,customElement as w}from"lit/decorators.js";import u from"@typo3/form/backend/form-wizard/steps/settings-step.js";import{LitElement as g,html as f}from"lit";import c from"~labels/form.form_manager_javascript";import{StepSummaryEvent as h}from"@typo3/backend/wizard/events/step-summary-event.js";import{DuplicateFormSubmissionService as v}from"@typo3/form/backend/form-wizard/finisher/duplicate-form-submission-service.js";import y from"@typo3/form/backend/form-wizard/steps/mode-step.js";import{CreateFormSubmissionService as z}from"@typo3/form/backend/form-wizard/finisher/create-form-submission-service.js";import{FormManager as M}from"@typo3/form/backend/form-manager.js";import{AutoAdvanceEvent as F}from"@typo3/backend/wizard/events/auto-advance-event.js";import{StorageStep as b}from"@typo3/form/backend/form-wizard/steps/storage-step.js";var a=function(o,t,e,s){var n=arguments.length,i=n<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,e):s,m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,s);else for(var p=o.length-1;p>=0;p--)(m=o[p])&&(i=(n<3?m(i):n>3?m(t,e,i):m(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i};let r=class extends g{constructor(){super(...arguments),this.steps=[],this.errorMessage=null,this.duplicateForm=null}connectedCallback(){super.connectedCallback(),this.addEventListener(h.eventName,this.handleStepSummary)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(h.eventName,this.handleStepSummary)}firstUpdated(t){if(super.firstUpdated(t),this.formManager.getAccessibleStorageAdapters().length<1){this.errorMessage=c.get("formManager.newFormWizard.step1.noStorages");return}const e={wizard:this.wizard,formManager:this.formManager,getStoreData:this.wizard.getStoreData.bind(this.wizard),setStoreData:this.wizard.setStoreData.bind(this.wizard),clearStoreData:this.wizard.clearStoreData.bind(this.wizard),getDataStore:this.wizard.getDataStore.bind(this.wizard),dispatchAutoAdvance:()=>this.wizard.dispatchEvent(new F)};this.duplicateForm!=null?(this.steps=[new b(e),new u(e)],this.submissionService=new v(e,this.duplicateForm.persistenceIdentifier)):(this.steps=[new y(e),new b(e),new u(e)],this.submissionService=new z(e))}createRenderRoot(){return this}render(){return this.errorMessage?this.wizard.renderError(this.errorMessage):f`<typo3-backend-wizard .steps=${this.steps} .submissionService=${this.submissionService} confirm-button-label=${c.get("formManager.newFormWizard.step1.title")} skip-summary></typo3-backend-wizard>`}handleStepSummary(t){this.duplicateForm!==null&&(t.detail.summaryData=[{label:c.get("formManager.form_copied"),value:f`<typo3-backend-icon identifier=content-form size=small class=me-1></typo3-backend-icon>${this.duplicateForm.name}`},...t.detail.summaryData])}};a([d()],r.prototype,"steps",void 0),a([d()],r.prototype,"submissionService",void 0),a([d()],r.prototype,"errorMessage",void 0),a([l({type:M,attribute:!1})],r.prototype,"formManager",void 0),a([l({type:Object,attribute:!1})],r.prototype,"duplicateForm",void 0),a([S("typo3-backend-wizard")],r.prototype,"wizard",void 0),r=a([w("typo3-backend-form-wizard")],r);export{r as FormWizard};
|
||||
@@ -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 l}from"lit/directives/live.js";import{unsafeHTML as c}from"lit/directives/unsafe-html.js";import t from"~labels/form.form_manager_javascript";var a;(function(i){i.Blank="blank",i.Predefined="predefined"})(a||(a={}));class n{constructor(e){this.context=e,this.key="mode",this.title=t.get("formManager.newFormWizard.step1.progressLabel"),this.autoAdvance=!0,this.selectedMode=null,this.modes=[{key:a.Blank,label:t.get("formManager.blankForm.label"),description:t.get("formManager.blankForm.description"),iconIdentifier:"apps-pagetree-page-default"},{key:a.Predefined,label:t.get("formManager.predefinedForm.label"),description:t.get("formManager.predefinedForm.description"),iconIdentifier:"form-page"}]}isComplete(){return this.getValue()!==null}render(){return this.getValue()==null&&this.modes.length>0&&this.setValue(this.modes[0].key),s`<div class=form-mode-selection><div class=form-check-card-container>${this.modes.map(e=>s`<div class="form-check form-check-type-card"><input class=form-check-input type=radio name=${this.key} id=mode-${e.key} value=${e.key} .checked=${l(this.getValue()===e.key)} @change=${()=>this.setValue(e.key)}> <label class=form-check-label for=mode-${e.key}><span class=form-check-label-header> <typo3-backend-icon identifier=${e.iconIdentifier} size=medium></typo3-backend-icon> ${e.label} </span> <span class=form-check-label-body>${c(e.description)} </span></label></div>`)}</div></div>`}reset(){this.setValue(null),this.context.clearStoreData(this.key)}getValue(){return this.selectedMode}setValue(e){this.selectedMode=e,this.context.wizard.requestUpdate()}beforeAdvance(){this.context.setStoreData(this.key,this.getValue())}getSummaryData(){const e=this.context.getStoreData(this.key);if(!e)return[];const r=this.modes.find(o=>o.key===e);return r?[{label:t.get("formManager.newFormWizard.step.modes.summary.title"),value:s`<typo3-backend-icon identifier=${r.iconIdentifier} size=small class=me-1></typo3-backend-icon>${r.label}`}]:[]}}export{a as MODE,n as ModeStep,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{html as r,nothing as i}from"lit";import{MODE as m}from"@typo3/form/backend/form-wizard/steps/mode-step.js";import o from"~labels/form.form_manager_javascript";class c{constructor(e){this.context=e,this.key="settings",this.title=o.get("formManager.newFormWizard.step2.title"),this.autoAdvance=!0,this.data={formName:"",storageLocation:"",prototype:"",template:""},this.reset()}isComplete(){return this.getValue()?.formName!==""}render(){return r`${this.renderPredefinedFormFields()} ${this.renderSavePath()} ${this.renderFormNameInput()}`}reset(){this.setValue({formName:"",storageLocation:""}),this.setPrototype(this.context.formManager.getPrototypes()[0]?.value??""),this.context.clearStoreData(this.key)}getValue(){return this.data}setValue(e){this.data={...this.data,...e},this.context.wizard.requestUpdate()}beforeAdvance(){this.context.setStoreData(this.key,this.getValue())}getSummaryData(){const e=this.context.getStoreData(this.key),a=this.context.formManager.getPrototypes().find(s=>s.value===e.prototype)?.label,n=this.context.formManager.getTemplatesForPrototype(e.prototype).find(s=>s.value===e.template)?.label,l=this.context.getStoreData("mode")===m.Predefined,t=this.context.getStoreData("storage"),g=(t?this.context.formManager.getAccessibleStorageLocationsForAdapter(t):[]).find(s=>s.value===e.storageLocation)?.label??e.storageLocation;return[...l?[{value:a,label:o.get("formManager.form_prototype")},{value:n,label:o.get("formManager.form_template")}]:[],{value:e.formName,label:o.get("formManager.form_name")},{value:g,label:o.get("formManager.form_storageLocation")}]}renderSavePath(){const e=this.context.formManager.getAccessibleStorageLocationsForAdapter(this.context.getStoreData("storage"))??[];return e.length<=1?(this.setValue({storageLocation:e[0]?.value??""}),i):(!this.data.storageLocation&&e.length>0&&this.setValue({storageLocation:e[0].value}),r`<div class=form-group><label class=form-label for=new-form-save-path>${o.get("formManager.form_storageLocation")}</label><div class=form-description>${o.get("formManager.form_storageLocation_description")}</div><select class="new-form-save-path form-select" id=new-form-save-path data-identifier=newFormSavePath @change=${a=>this.setValue({storageLocation:a.target.value})}>${e.map(a=>r`<option value=${a.value} ?selected=${a.value===this.data.storageLocation}>${a.label}</option>`)}</select></div>`)}renderFormNameInput(){return r`<div class=form-group><label class=form-label for=new-form-name>${o.get("formManager.form_name")}</label><div class=form-description>${o.get("formManager.form_name_description")}</div><input class="form-control ${this.isComplete()?"":"has-error"}" id=new-form-name data-identifier=newFormName name=newFormName .value=${this.data.formName} @input=${e=>this.setValue({formName:e.target.value})}></div>`}renderPredefinedFormFields(){const e=this.context.formManager.getPrototypes()??[];if(this.context.getStoreData("mode")!==m.Predefined||e.length<1)return i;const a=this.data.prototype,n=this.context.formManager.getTemplatesForPrototype(a);let l=i;return n.length>0&&(l=r`<div class=form-group><label class=form-label for=new-form-template>${o.get("formManager.form_template")}</label> <select class="new-form-template form-select" id=new-form-template data-identifier=newFormTemplate @change=${t=>this.setValue({template:t.target.value})}>${n.map(t=>r`<option ?selected=${t.value===this.data.template} value=${t.value}>${t.label}</option>`)}</select></div>`),r`<div class=form-group><label class=form-label for=new-form-prototype-name>${o.get("formManager.form_prototype")}</label> <select class="new-form-prototype-name form-select" id=new-form-prototype-name data-identifier=newFormPrototype @change=${t=>this.setPrototype(t.currentTarget.value)}>${e.map(t=>r`<option value=${t.value} ?selected=${t.value===this.data.prototype}>${t.label}</option>`)}</select></div>${l}`}setPrototype(e){const a=this.context.formManager.getTemplatesForPrototype(e);this.setValue({prototype:e,template:a[0]?.value??""})}}export{c as SettingsStep,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 o}from"lit/directives/live.js";import{unsafeHTML as n}from"lit/directives/unsafe-html.js";import a from"~labels/form.form_manager_javascript";class r{constructor(e){this.context=e,this.key="storage",this.title=a.get("formManager.newFormWizard.step.storages.progressLabel"),this.autoAdvance=!0,this.hasDispatchedAutoAdvance=!1,this.selectedStorage=null}isComplete(){return this.getValue()!==null}render(){const e=this.context.formManager.getAccessibleStorageAdapters();let i=!1;return this.getValue()==null&&e.length>0&&(this.setValue(e[0]),e.length===1&&(i=!0)),i&&!this.hasDispatchedAutoAdvance?(this.hasDispatchedAutoAdvance=!0,this.context.dispatchAutoAdvance(),this.context.wizard.renderLoader()):s`<h2 class=h4>${a.get("formManager.newFormWizard.step.storages.title")}</h2><p>${a.get("formManager.newFormWizard.step.storages.description")}</p><div class=form-storage-selection><div class=form-check-card-container>${e.map(t=>s`<div class="form-check form-check-type-card"><input class=form-check-input type=radio name=${this.key} id=mode-${t.typeIdentifier} value=${t.typeIdentifier} .checked=${o(this.getValue()?.typeIdentifier===t.typeIdentifier)} @change=${()=>this.setValue(t)}> <label class=form-check-label for=mode-${t.typeIdentifier}><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>${n(t.description)} </span></label></div>`)}</div></div>`}reset(){this.setValue(null),this.context.clearStoreData(this.key)}getValue(){return this.selectedStorage}setValue(e){this.selectedStorage=e,this.context.wizard.requestUpdate()}beforeAdvance(){this.context.setStoreData(this.key,this.getValue())}getSummaryData(){const e=this.context.getStoreData(this.key);return e?[{label:a.get("formManager.newFormWizard.step.storages.summary.title"),value:s`<typo3-backend-icon identifier=${e.iconIdentifier} size=small class=me-1></typo3-backend-icon>${e.label}`}]:[]}}export{r as StorageStep,r as default};
|
||||
Reference in New Issue
Block a user