TYPO3 v15 dev-main snapshot ()
This commit is contained in:
commit
aad9daaefd
1506 files changed
+94005
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{LitElement as c,html as f}from"lit";import{query as p,customElement as h}from"lit/decorators.js";import"@typo3/backend/tree/tree-toolbar.js";import"@typo3/form/backend/form-editor-tree.js";var l=function(i,e,t,n){var a=arguments.length,r=a<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(i,e,t,n);else for(var d=i.length-1;d>=0;d--)(s=i[d])&&(r=(a<3?s(r):a>3?s(e,t,r):s(e,t))||r);return a>3&&r&&Object.defineProperty(e,t,r),r};const m="typo3-backend-navigation-component-formeditortree";let o=class extends c{async setNodes(e){await this.updateComplete,this.tree&&this.tree.setNodes(e)}setSelectedNode(e){this.tree&&this.tree.setSelectedNode(e)}search(e){this.tree&&this.tree.search(e)}setNodeValidationError(e,t=!0){this.tree&&this.tree.setNodeValidationError(e,t)}setNodeChildHasError(e,t=!0){this.tree&&this.tree.setNodeChildHasError(e,t)}clearAllValidationErrors(){this.tree&&this.tree.clearAllValidationErrors()}createRenderRoot(){return this}render(){return f`<typo3-backend-tree-toolbar .tree=${this.tree} .showRefresh=${!1} id=typo3-formeditortree-toolbar></typo3-backend-tree-toolbar><typo3-backend-navigation-component-formeditor-tree id=typo3-formeditortree-tree></typo3-backend-navigation-component-formeditor-tree>`}firstUpdated(){this.toolbar&&this.tree&&(this.toolbar.tree=this.tree),this.dispatchEvent(new CustomEvent("typo3:tree-container:ready",{bubbles:!0,composed:!0}))}};l([p("typo3-backend-navigation-component-formeditor-tree")],o.prototype,"tree",void 0),l([p("typo3-backend-tree-toolbar")],o.prototype,"toolbar",void 0),o=l([h("typo3-backend-navigation-component-formeditortree")],o);export{o as FormEditorTreeContainer,m as navigationComponentName};
|
||||
@@ -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!
|
||||
*/
|
||||
const e={NODE_CLICKED:"typo3:form-editor-tree:node-clicked",NODE_EDIT:"typo3:form-editor-tree:node-edit",NODE_DELETE:"typo3:form-editor-tree:node-delete",DND_UPDATE:"typo3:form-editor-tree:dnd-update",DND_CHANGE:"typo3:form-editor-tree:dnd-change"};export{e as FORM_EDITOR_TREE_EVENTS};
|
||||
@@ -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 T}from"lit/decorators.js";import{Tree as _}from"@typo3/backend/tree/tree.js";import{TreeNodePositionEnum as d}from"@typo3/backend/tree/tree-node.js";import{DataTransferTypes as b}from"@typo3/backend/enum/data-transfer-types.js";import y from"@typo3/backend/severity.js";import{FORM_EDITOR_TREE_EVENTS as N}from"@typo3/form/backend/form-editor-tree-events.js";import g from"~labels/form.form_editor_javascript";var P=function(h,e,t,r){var s=arguments.length,i=s<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(h,e,t,r);else for(var n=h.length-1;n>=0;n--)(a=h[n])&&(i=(s<3?a(i):s>3?a(e,t,i):a(e,t))||i);return s>3&&i&&Object.defineProperty(e,t,i),i};const w=0,I=1;let E=class extends _{constructor(){super(),this.nodeMetadata=new Map,this.validationErrors=new Set,this.childValidationErrors=new Set,this.settings.showIcons=!0,this.settings.defaultProperties={hasChildren:!1,nameSourceField:"label",type:"form_element",prefix:"",suffix:"",locked:!1,loaded:!0,overlayIcon:"",selectable:!0,expanded:!1,checked:!1},this.settings.dataUrl="",this.settings.filterUrl="",this.allowNodeEdit=!1,this.allowNodeDrag=!0,this.allowNodeSorting=!0}setNodes(e){this.syncExpandedStates(),this.nodeMetadata.clear();const t=this.convertToTreeNodes(e);this.nodes=this.enhanceNodes(t),this.applyValidationState(),this.requestUpdate()}setSelectedNode(e){const t=this.nodes.find(r=>r.identifier===e);t&&this.selectNode(t,!1)}setNodeValidationError(e,t=!0){t?this.validationErrors.add(e):this.validationErrors.delete(e),this.applyValidationState(),this.requestUpdate()}setNodeChildHasError(e,t=!0){t?this.childValidationErrors.add(e):this.childValidationErrors.delete(e),this.applyValidationState(),this.requestUpdate()}clearAllValidationErrors(){this.validationErrors.clear(),this.childValidationErrors.clear(),this.applyValidationState(),this.requestUpdate()}applyValidationState(){for(const e of this.nodes)e.statusInformation=[],e.overlayIcon=e.overlayIcon==="overlay-missing"?"":e.overlayIcon,this.validationErrors.has(e.identifier)?(e.overlayIcon="overlay-missing",e.statusInformation.push({label:g.get("formEditor.validation.hasError")||"Has validation errors",icon:"actions-exclamation-circle",overlayIcon:"",severity:y.error,priority:2})):this.childValidationErrors.has(e.identifier)&&e.statusInformation.push({label:g.get("formEditor.validation.childHasError")||"Contains elements with validation errors",icon:"actions-dot",overlayIcon:"",severity:y.warning,priority:1})}search(e){this.filter(e)}filter(e){if(typeof e=="string"&&(this.searchTerm=e),this.searchTerm){const t=this.searchTerm.toLowerCase();this.nodes.forEach(r=>{this.nodeMatchesSearchTerm(r,t)?(r.__hidden=!1,this.showParentNodes(r)):r.__hidden=!0})}else this.nodes.forEach(t=>{t.__hidden=!1});this.requestUpdate()}nodeMatchesSearchTerm(e,t){return e.name.toLowerCase().includes(t)||e.identifier.toLowerCase().includes(t)||e.note&&e.note.toLowerCase().includes(t)}async loadData(){this.loading=!1}async fetchData(){return[]}async loadChildren(e){e.loaded=!0}hideChildren(e){e.__expanded=!1,this.saveNodeStatus(e),this.dispatchEvent(new CustomEvent("typo3:tree:expand-toggle",{detail:{node:e}})),this.requestUpdate()}async showChildren(e){e.__expanded=!0,await this.loadChildren(e),this.saveNodeStatus(e),this.dispatchEvent(new CustomEvent("typo3:tree:expand-toggle",{detail:{node:e}})),this.requestUpdate()}selectNode(e,t=!0){super.selectNode(e,t),this.requestUpdate(),this.dispatchEvent(new CustomEvent("typo3:form-editor-tree:node-clicked",{detail:{identifierPath:e.identifier},bubbles:!0,composed:!0}))}async moveNode(e,t,r){const s=e.identifier,i=t.identifier,a=e.parentIdentifier,n=this.getParentNode(e);let l,o;r===d.INSIDE?(l=i,o=t):(l=t.parentIdentifier,o=this.getParentNode(t));const f=Array.from(this.nodes),c=f.indexOf(t);let p="",u="";r===d.BEFORE?(c>0&&(p=f[c-1].identifier),u=i):r===d.AFTER&&(p=i,c<f.length-1&&(u=f[c+1].identifier));const D=a!==l,v=this.nodes.indexOf(e);v>-1&&this.nodeMap.splice(v,1),e.parentIdentifier=l,o?e.depth=o.depth+1:e.depth=0,n&&this.getNodeChildren(n).length===0&&(n.hasChildren=!1,n.__expanded=!1),o&&(o.hasChildren||(o.hasChildren=!0,o.__expanded=!0),o.__expanded||await this.showChildren(o));let m=this.nodes.indexOf(t);(r===d.INSIDE||r===d.AFTER)&&m++,this.nodeMap.splice(m,0,e),this.requestUpdate(),D?this.dispatchEvent(new CustomEvent("typo3:form-editor-tree:dnd-change",{detail:{itemIdentifierPath:s,parentIdentifierPath:l,position:r,previousIdentifierPath:p,nextIdentifierPath:u},bubbles:!0,composed:!0})):this.dispatchEvent(new CustomEvent("typo3:form-editor-tree:dnd-update",{detail:{movedIdentifierPath:s,previousIdentifierPath:p,nextIdentifierPath:u},bubbles:!0,composed:!0}))}async firstUpdated(){await super.firstUpdated()}handleNodeDrop(e){const t=super.handleNodeDrop(e);return this.cleanDrag(),t&&(this.nodeDragMode=null,this.nodeDragPosition=null,this.refreshDragToolTip(),wLine truncated
|
||||
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* 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 y from"@typo3/backend/notification.js";import*as a from"@typo3/form/backend/form-editor/core.js";import{cloneDeep as d}from"lodash-es";import m from"~labels/form.form_editor_fail_safe_error_handling_javascript";const n=a.assert;class c{constructor(t,e,r){this.isRunning=!1,this.unsavedContent=!1,this.configuration=t||{},this.mediator=e,this.viewModel=r}getPublisherSubscriber(){return a.getPublisherSubscriber()}undoApplicationState(){this.getApplicationStateStack().incrementCurrentStackPointer()}redoApplicationState(){this.getApplicationStateStack().decrementCurrentStackPointer()}getMaximalApplicationStates(){return this.getApplicationStateStack().getMaximalStackSize()}getCurrentApplicationStates(){return this.getApplicationStateStack().getCurrentStackSize()}getCurrentApplicationStatePosition(){return this.getApplicationStateStack().getCurrentStackPointer()}setFormDefinition(t){n(typeof t=="object"&&t!==null&&!Array.isArray(t),'Invalid parameter "formDefinition"',1519855175),this.getApplicationStateStack().setCurrentState("formDefinition",this.getFactory().createFormElement(t,void 0,void 0,!0))}getRunningAjaxRequest(t){return n(this.getUtility().isNonEmptyString(t),'Invalid parameter "type"',1475378543),a.getRunningAjaxRequest(t)}getUtility(){return a.getUtility()}assert(t,e,r){this.getUtility().assert(t,e,r)}buildPropertyPath(t,e,r,i,o){this.getUtility().isUndefinedOrNull(i)&&(i=this.getCurrentlySelectedFormElement());const l=this.getRepository().findFormElement(i);return this.getUtility().buildPropertyPath(t,e,r,l,o)}addPropertyValidationValidator(t,e){this.getPropertyValidationService().addValidator(t,e)}validateCurrentlySelectedFormElementProperty(t){return this.validateFormElementProperty(this.getCurrentlySelectedFormElement(),t)}validateFormElementProperty(t,e){const r=this.getRepository().findFormElement(t);return this.getPropertyValidationService().validateFormElementProperty(r,e)}validateFormElement(t){const e=this.getRepository().findFormElement(t);return this.getPropertyValidationService().validateFormElement(e)}validationResultsHasErrors(t){return this.getPropertyValidationService().validationResultsHasErrors(t)}validateFormElementRecursive(t,e){const r=this.getRepository().findFormElement(t);return this.getPropertyValidationService().validateFormElementRecursive(r,e)}setUnsavedContent(t){n(typeof t=="boolean",'Invalid parameter "unsavedContent"',1475378544),this.unsavedContent=t}getUnsavedContent(){return this.unsavedContent}getRootFormElement(){return this.getRepository().getRootFormElement()}getCurrentlySelectedFormElement(){return this.getRepository().findFormElementByIdentifierPath(this.getApplicationStateStack().getCurrentState("currentlySelectedFormElementIdentifierPath"))}setCurrentlySelectedFormElement(t,e){e=!!e;const r=this.getRepository().findFormElement(t);this.getApplicationStateStack().setCurrentState("currentlySelectedFormElementIdentifierPath",r.get("__identifierPath")),e||this.refreshCurrentlySelectedPageIndex(),this.getPublisherSubscriber().publish("core/currentlySelectedFormElementChanged",[r])}getFormElementByIdentifierPath(t){return n(this.getUtility().isNonEmptyString(t),'Invalid parameter "identifierPath"',1475378545),this.getRepository().findFormElementByIdentifierPath(t)}isFormElementIdentifierUsed(t){return this.getRepository().isFormElementIdentifierUsed(t)}createAndAddFormElement(t,e,r){const i=this.addFormElement(this.createFormElement(t,r),e,r);return i.set("renderables",i.get("renderables")),i}addFormElement(t,e,r){this.saveApplicationState(),this.getUtility().isUndefinedOrNull(e)&&(e=this.getCurrentlySelectedFormElement());const i=this.getRepository().findFormElement(e);return n(typeof t=="object"&&t!==null&&!Array.isArray(t),'Invalid parameter "formElement"',1475434337),this.getRepository().addFormElement(t,i,!0,r)}createFormElement(t,e){n(this.getUtility().isNonEmptyString(t),'Invalid parameter "formElementType"',1475434336);const r=this.getRepository().getNextFreeFormElementIdentifier(t),i=this.getFormElementDefinitionByType(t,void 0);return this.getFactory().createFormElement({type:t,identifier:r,label:i.label||t},void 0,void 0,void 0,e)}removeFormElement(t,e){this.saveApplicationState();const r=this.getRepository().findFormElement(t),i=r.get("__parentRenderable");return this.getRepository().removeFormElement(r,!0,e),i}moveFormElement(t,e,r,i){this.saveApplicationState();let o=this.getRepository().findFormElement(t);const l=this.getRepository().findFormElement(r);return n(e==="after"||e==="before"||e==="inside",'Invalid position "'+e+'"',1475378551),o=this.getRepository().moveFormElement(o,e,l,!0),i=!!i,i||o.get("__parentRenderable").set("renderables",o.get("__parentRenderable").get("renderables")),o}getPropertyCollectionElementConfiguration(t,e,r){let i,o;this.getUtility().isUndefinedOrNull(r)&&(r=this.getCurrentlySelectedFormElement());const l=this.getRepository().findFormElement(r);n(this.getUtility().isNonEmptyString(t),'Invalid parameter "collectioLine truncated
|
||||
\r
|
||||
`+m.get("formEditor.error.technicalReason")+`\r
|
||||
`+t.message)}return this}saveApplicationState(){this.getApplicationStateStack().addAndReset({formDefinition:this.getApplicationStateStack().getCurrentState("formDefinition").clone(),currentlySelectedPageIndex:this.getApplicationStateStack().getCurrentState("currentlySelectedPageIndex"),currentlySelectedFormElementIdentifierPath:this.getApplicationStateStack().getCurrentState("currentlySelectedFormElementIdentifierPath")})}getDataBackend(){return a.getDataBackend()}getFactory(){return a.getFactory()}getRepository(){return a.getRepository()}getPropertyValidationService(){return a.getPropertyValidationService()}getApplicationStateStack(){return a.getApplicationStateStack()}dataBackendSetup(t,e,r){n(typeof t=="object"&&t!==null&&!Array.isArray(t),'Invalid parameter "endpoints"',1475379748),n(this.getUtility().isNonEmptyString(e),'Invalid parameter "prototypeName"',1475927876),n(this.getUtility().isNonEmptyString(r),'Invalid parameter "formPersistenceIdentifier"',1475379749),a.getDataBackend().setEndpoints(t),a.getDataBackend().setPrototypeName(e),a.getDataBackend().setPersistenceIdentifier(r)}repositorySetup(t){n(typeof t=="object"&&t!==null&&!Array.isArray(t),'Invalid parameter "formEditorDefinitions"',1475379750),this.getRepository().setFormEditorDefinitions(t)}viewSetup(t){n(typeof this.viewModel.bootstrap=="function",'The view model does not implement the method "bootstrap"',1475492374),this.getUtility().isUndefinedOrNull(t)&&(t=[]),this.viewModel.bootstrap(s,t)}mediatorSetup(){n(typeof this.mediator.bootstrap=="function",'The mediator does not implement the method "bootstrap"',1475492032),this.mediator.bootstrap(s,this.viewModel)}applicationStateStackSetup(t,e){n(typeof t=="object"&&t!==null&&!Array.isArray(t),'Invalid parameter "rootFormElement"',1475379751),typeof e!="number"&&(e=10),this.getApplicationStateStack().setMaximalStackSize(e),this.getApplicationStateStack().addAndReset({currentlySelectedPageIndex:0,currentlySelectedFormElementIdentifierPath:t.identifier},!0),this.getApplicationStateStack().setCurrentState("formDefinition",this.getFactory().createFormElement(t,void 0,void 0,!0))}bootstrap(){this.mediatorSetup(),this.dataBackendSetup(this.configuration.endpoints,this.configuration.prototypeName,this.configuration.formPersistenceIdentifier),this.repositorySetup(this.configuration.formEditorDefinitions),this.applicationStateStackSetup(this.configuration.formDefinition,this.configuration.maximumUndoSteps),this.setCurrentlySelectedFormElement(this.getRepository().getRootFormElement()),this.viewSetup(this.configuration.additionalViewModelModules)}}let s=null;function h(g,t,e){return s===null&&(s=new c(g,t,e)),s}export{c as FormEditor,h as getInstance};
|
||||
@@ -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{LitElement as v,html as d,nothing as p}from"lit";import{property as g,state as r,customElement as $}from"lit/decorators.js";import o from"~labels/form.relative_date_editor";var n=function(u,t,e,s){var h=arguments.length,a=h<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,e):s,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(u,t,e,s);else for(var m=u.length-1;m>=0;m--)(l=u[m])&&(a=(h<3?l(a):h>3?l(t,e,a):l(t,e))||a);return h>3&&a&&Object.defineProperty(t,e,a),a};class c extends Event{static{this.eventName="typo3:backend:form-editor:component:date-editor:change"}constructor(t){super(c.eventName),this.value=t}}let i=class extends v{constructor(){super(...arguments),this.mode="no",this.absoluteDate="",this.direction="-",this.amount=0,this.unit="years",this.customValue="",this.value="",this._absoluteDateRegex=null}get absoluteDateRegex(){return this._absoluteDateRegex||(this._absoluteDateRegex=new RegExp(this.absolutePattern)),this._absoluteDateRegex}firstUpdated(){if(!this.absolutePattern)throw new Error("typo3-form-date-editor: absolute-pattern attribute is required.");this.parseValue(this.value)}createRenderRoot(){return this}render(){return d`<div class=mb-2><select class=form-select @change=${this.handleModeChange} .value=${this.mode}><option value=no ?selected=${this.mode==="no"}>${o.get("mode.no")}</option><option value=today ?selected=${this.mode==="today"}>${o.get("mode.today")}</option><option value=absolute ?selected=${this.mode==="absolute"}>${o.get("mode.absolute")}</option><option value=relative ?selected=${this.mode==="relative"}>${o.get("mode.relative")}</option><option value=custom ?selected=${this.mode==="custom"}>${o.get("mode.custom")}</option></select></div>${this.mode==="absolute"?this.renderAbsolute():p} ${this.mode==="relative"?this.renderRelative():p} ${this.mode==="custom"?this.renderCustom():p}`}renderAbsolute(){return d`<div class=mb-2><input type=date class=form-control .value=${this.absoluteDate} @change=${this.handleAbsoluteChange}></div>`}renderRelative(){return d`<div class=input-group><select class=form-select .value=${this.direction} @change=${this.handleDirectionChange}><option value=- ?selected=${this.direction==="-"}>${o.get("direction.past")}</option><option value=+ ?selected=${this.direction==="+"}>${o.get("direction.future")}</option></select> <input type=number min=1 class=form-control style=max-width:80px .value=${this.amount.toString()} @input=${this.handleAmountChange}> <select class=form-select .value=${this.unit} @change=${this.handleUnitChange}><option value=days ?selected=${this.unit==="days"}>${o.get("unit.days",{count:this.amount})}</option><option value=weeks ?selected=${this.unit==="weeks"}>${o.get("unit.weeks",{count:this.amount})}</option><option value=months ?selected=${this.unit==="months"}>${o.get("unit.months",{count:this.amount})}</option><option value=years ?selected=${this.unit==="years"}>${o.get("unit.years",{count:this.amount})}</option></select></div>`}renderCustom(){return d`<div class=mb-2><input type=text class=form-control placeholder=${o.get("custom.placeholder")} .value=${this.customValue} @input=${this.handleCustomChange}></div>`}parseValue(t){if(!t){this.mode="no";return}if(t.toLowerCase()==="today"){this.mode="today";return}if(this.absoluteDateRegex.test(t)){this.mode="absolute",this.absoluteDate=t;return}const e=t.match(/^([+-]?)\s*(\d+)\s+(days?|weeks?|months?|years?)$/i);if(e){this.mode="relative",this.direction=e[1]==="+"?"+":"-",this.amount=parseInt(e[2],10);const s=e[3].toLowerCase();this.unit=s.endsWith("s")?s:`${s}s`;return}this.mode="custom",this.customValue=t}composeValue(){switch(this.mode){case"today":return"today";case"absolute":return this.absoluteDate;case"relative":return this.amount===0?"":`${this.direction}${this.amount} ${this.unit}`;case"custom":return this.customValue.trim();default:return""}}emitChange(){const t=this.composeValue();this.value=t,this.dispatchEvent(new c(t))}handleModeChange(t){const e=t.target.value;if(e==="custom"&&this.mode==="relative"){const s=this.composeValue();s&&(this.customValue=s)}this.mode=e,this.mode==="relative"&&this.amount===0&&(this.amount=1),this.emitChange()}handleAbsoluteChange(t){this.absoluteDate=t.target.value,this.emitChange()}handleDirectionChange(t){this.direction=t.target.value,this.emitChange()}handleAmountChange(t){this.amount=parseInt(t.target.value,10)||0,this.emitChange()}handleUnitChange(t){this.unit=t.target.value,this.emitChange()}handleCustomChange(t){this.customValue=t.target.value,this.emitChange()}};n([g({type:String,attribute:"absolute-pattern"})],i.prototype,"absolutePattern",void 0),n([r()],i.prototype,"mode",void 0),n([r()],i.prototype,"absoluteDate",void 0),n([r()],i.prototype,"direction",void 0),n([r()],i.prototype,"amount",void 0),n([r()],i.prototype,"unit",void 0),n([r()],i.prototype,"customValue",void 0),i=n([$("typo3-form-date-editor")],i);export{i as DateEditor,c as DateEditorChangeEvent};
|
||||
@@ -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 u}from"lit/decorators.js";import{LitElement as f,html as p,nothing as b}from"lit";var d=function(r,e,n,i){var s=arguments.length,t=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")t=Reflect.decorate(r,e,n,i);else for(var c=r.length-1;c>=0;c--)(l=r[c])&&(t=(s<3?l(t):s>3?l(e,n,t):l(e,n))||t);return s>3&&t&&Object.defineProperty(e,n,t),t};class a extends Event{static{this.eventName="typo3:backend:form-editor:component:form-element-selector:selected"}constructor(e){super(a.eventName),this.value=e}}let o=class extends f{constructor(){super(...arguments),this.elements=[],this.size=""}createRenderRoot(){return this}render(){return this.elements?.length?p`<span class=input-group-btn role=group data-identifier=inspectorEditorFormElementSelectorControlsWrapper> <span class=btn-group data-identifier=inspectorEditorFormElementSelectorSplitButtonContainer><button type=button class="btn btn-default dropdown-toggle${this.size==="small"?" btn-sm":""}" data-bs-toggle=dropdown aria-expanded=false title="{f:translate(key: 'LLL:EXT:form/Resources/Private/Language/Database.xlf:formEditor.inspector.editor.formelement_selector.title')}"><typo3-backend-icon identifier=actions-variable-select></typo3-backend-icon><span class=visually-hidden>Toggle Dropdown</span></button> <ul class="dropdown-menu dropdown-menu-right" data-identifier=inspectorEditorFormElementSelectorSplitButtonListContainer>${this.elements.map(e=>this.renderEntry(e))}</ul> </span> </span>`:p`${b}`}renderEntry(e){return p`<li><a @click=${()=>this.onSelect(e.value)} href=# class=dropdown-item data-formelement-identifier=${e.value}> <span class=dropdown-item-columns><span class="dropdown-item-column dropdown-item-column-icon"> <typo3-backend-icon identifier=${e.icon} size=small></typo3-backend-icon> </span> <span class="dropdown-item-column dropdown-item-column-text">${e.label}</span> </span> </a></li>`}onSelect(e){this.dispatchEvent(new a(e))}};d([m({type:Array,attribute:"elements"})],o.prototype,"elements",void 0),d([m({type:String})],o.prototype,"size",void 0),o=d([u("typo3-form-element-selector")],o);export{o as FormElementSelector,a as FormElementSelectorSelectedEvent};
|
||||
+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{LitElement as f,nothing as b,html as p}from"lit";import{property as n,customElement as v}from"lit/decorators.js";import c from"~labels/form.form_editor_javascript";import"@typo3/backend/element/icon-element.js";var o=function(l,e,r,a){var s=arguments.length,i=s<3?e:a===null?a=Object.getOwnPropertyDescriptor(e,r):a,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(l,e,r,a);else for(var m=l.length-1;m>=0;m--)(d=l[m])&&(i=(s<3?d(i):s>3?d(e,r,i):d(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i};let t=class extends f{constructor(){super(...arguments),this.active=!1,this.iconIdentifier="",this.elementType="",this.elementIdentifier="",this.isHidden=!1,this.isInvalid=!1}createRenderRoot(){return this}render(){return this.active?p`<div class=formeditor-element-toolbar><div class=formeditor-element-toolbar-left><typo3-backend-icon identifier=${this.iconIdentifier} size=small overlay=${this.isHidden?"overlay-hidden":this.isInvalid?"overlay-missing":""}></typo3-backend-icon></div><div class=formeditor-element-toolbar-title>${this.elementType}</div><div class=formeditor-element-toolbar-right><div class=btn-toolbar><div class="btn-group btn-group-sm" role=group><a class="btn btn-default btn-borderless" href=# title=${c.get("formEditor.stage.toolbar.new_element.before")} @click=${this.handleNewElementBefore}> <typo3-backend-icon identifier=actions-form-insert-before size=small></typo3-backend-icon> </a> <a class="btn btn-default btn-borderless" href=# title=${c.get("formEditor.stage.toolbar.new_element.after")} @click=${this.handleNewElementAfter}><typo3-backend-icon identifier=actions-form-insert-after size=small></typo3-backend-icon> </a> <a class="btn btn-default btn-borderless" href=# title=${c.get("formEditor.stage.toolbar.remove")} @click=${this.handleRemoveElement}><typo3-backend-icon identifier=actions-edit-delete size=small></typo3-backend-icon> </a></div></div></div></div>`:b}handleNewElementBefore(e){e.preventDefault(),this.dispatchEvent(new CustomEvent("toolbar-new-element-before",{bubbles:!0,composed:!0}))}handleNewElementAfter(e){e.preventDefault(),this.dispatchEvent(new CustomEvent("toolbar-new-element-after",{bubbles:!0,composed:!0}))}handleRemoveElement(e){e.preventDefault(),this.dispatchEvent(new CustomEvent("toolbar-remove-element",{bubbles:!0,composed:!0}))}};o([n({type:Boolean,reflect:!0})],t.prototype,"active",void 0),o([n({type:String,attribute:"icon-identifier"})],t.prototype,"iconIdentifier",void 0),o([n({type:String,attribute:"element-type"})],t.prototype,"elementType",void 0),o([n({type:String,attribute:"element-identifier"})],t.prototype,"elementIdentifier",void 0),o([n({type:Boolean,attribute:"is-hidden"})],t.prototype,"isHidden",void 0),o([n({type:Boolean,attribute:"is-invalid"})],t.prototype,"isInvalid",void 0),t=o([v("typo3-form-form-element-stage-item-toolbar")],t);export{t as FormElementStageItemToolbar};
|
||||
@@ -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{LitElement as c,html as s,nothing as f}from"lit";import{property as n,customElement as u}from"lit/decorators.js";import"@typo3/backend/element/icon-element.js";import"@typo3/form/backend/form-editor/component/form-element-stage-item-toolbar.js";import{stripTags as v}from"@typo3/form/backend/form-editor/utility/string-utility.js";var o=function(d,e,i,r){var a=arguments.length,l=a<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,i):r,m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(d,e,i,r);else for(var p=d.length-1;p>=0;p--)(m=d[p])&&(l=(a<3?m(l):a>3?m(e,i,l):m(e,i))||l);return a>3&&l&&Object.defineProperty(e,i,l),l};let t=class extends c{constructor(){super(...arguments),this.elementType="",this.elementIdentifier="",this.elementLabel="",this.elementIconIdentifier="",this.isRequired=!1,this.isHidden=!1,this.invalid=!1,this.validators=[],this.options=[]}createRenderRoot(){return this}render(){return s`<typo3-form-form-element-stage-item-toolbar active icon-identifier=${this.elementIconIdentifier} element-type=${this.elementType} element-identifier=${this.elementIdentifier} ?is-hidden=${this.isHidden} ?is-invalid=${this.invalid}></typo3-form-form-element-stage-item-toolbar><div class=formeditor-element-body><div class=formeditor-element-info><div class=formeditor-element-info-label><span>${v(this.elementLabel)}</span> ${this.isRequired?s`<span>*</span>`:f}</div>${this.renderInfoContent()}</div>${this.renderValidators()}</div>`}renderInfoContent(){const e=this.renderContentItems();return e.length?s`<div class=formeditor-element-info-content>${e}</div>`:f}renderContentItems(){const e=[];if(this.content&&e.push(s`<div class=formeditor-element-info-text>${v(this.content)}</div>`),this.options?.length){const i=this.options.map(r=>({label:r.label,className:r.selected?"selected":void 0}));e.push(this.renderMultivalue(i))}if(this.allowedMimeTypes?.length){const i=this.allowedMimeTypes.map(r=>({label:r}));e.push(this.renderMultivalue(i))}return e}renderMultivalue(e){return s`<div class=formeditor-element-info-multivalue>${e.map(i=>s`<div class=formeditor-element-info-multivalue-item${i.className?` ${i.className}`:""}>${i.label}</div>`)}</div>`}renderValidators(){return this.validators?.length?s`<div class=formeditor-element-validator><div class=formeditor-element-validator-icon><typo3-backend-icon identifier=form-validator size=small></typo3-backend-icon></div><div class=formeditor-element-validator-list>${this.validators.map(e=>s`<div class=formeditor-element-validator-list-item>${e.label}</div>`)}</div></div>`:f}};o([n({type:String,attribute:"element-type"})],t.prototype,"elementType",void 0),o([n({type:String,attribute:"element-identifier"})],t.prototype,"elementIdentifier",void 0),o([n({type:String,attribute:"element-label"})],t.prototype,"elementLabel",void 0),o([n({type:String,attribute:"element-icon-identifier"})],t.prototype,"elementIconIdentifier",void 0),o([n({type:Boolean,attribute:"is-required"})],t.prototype,"isRequired",void 0),o([n({type:Boolean,attribute:"is-hidden"})],t.prototype,"isHidden",void 0),o([n({type:Boolean,reflect:!0})],t.prototype,"invalid",void 0),o([n({type:Array})],t.prototype,"validators",void 0),o([n({type:Array})],t.prototype,"options",void 0),o([n({type:Array})],t.prototype,"allowedMimeTypes",void 0),o([n({type:String})],t.prototype,"content",void 0),t=o([u("typo3-form-form-element-stage-item")],t);export{t as FormElementStageItem};
|
||||
@@ -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{LitElement as f,html as c}from"lit";import{property as s,customElement as g}from"lit/decorators.js";import u from"~labels/form.form_editor_javascript";var a=function(o,e,r,p){var i=arguments.length,t=i<3?e:p===null?p=Object.getOwnPropertyDescriptor(e,r):p,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")t=Reflect.decorate(o,e,r,p);else for(var m=o.length-1;m>=0;m--)(l=o[m])&&(t=(i<3?l(t):i>3?l(e,r,t):l(e,r))||t);return i>3&&t&&Object.defineProperty(e,r,t),t};let n=class extends f{constructor(){super(...arguments),this.pageTitle=""}createRenderRoot(){return this}render(){const e=this.pageTitle||u.get("formEditor.step.name.empty");return c`<h2 class=formeditor-page-title>${e}</h2>`}};a([s({type:String,attribute:"page-title"})],n.prototype,"pageTitle",void 0),n=a([g("typo3-form-page-stage-item")],n);export{n as PageStageItem};
|
||||
@@ -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{LitElement as f,html as d,nothing as h}from"lit";import{repeat as v}from"lit/directives/repeat.js";import{classMap as g}from"lit/directives/class-map.js";import{live as b}from"lit/directives/live.js";import{property as s,state as u,customElement as y}from"lit/decorators.js";import"@typo3/backend/element/icon-element.js";import"@typo3/form/backend/form-editor/component/form-element-selector.js";var a=function(p,e,t,l){var i=arguments.length,o=i<3?e:l===null?l=Object.getOwnPropertyDescriptor(e,t):l,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(p,e,t,l);else for(var c=p.length-1;c>=0;c--)(r=p[c])&&(o=(i<3?r(o):i>3?r(e,t,o):r(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o};class m extends Event{static{this.eventName="typo3:backend:form-editor:component:property-grid-editor:update"}constructor(e){super(m.eventName),this.data=e}}let n=class extends f{constructor(){super(...arguments),this.entries=[],this.formElements=[],this.labelLabel="Label",this.labelValue="Value",this.labelSelected="Selected",this.labelAdd="Add",this.labelRemove="Remove",this.labelMove="Move",this.enableAddRow=!1,this.enableDeleteRow=!1,this.enableSelection=!0,this.enableMultiSelection=!1,this.enableSorting=!1,this.enableLabelAsFallbackValue=!1,this.enableLabelFormElementSelectionButton=!1,this.enableValueFormElementSelectionButton=!1,this.draggedEntry=null,this.movedEntry=null,this.activeElementRef=null}createRenderRoot(){return this}updated(e){if(this.activeElementRef&&(this.activeElementRef.focus(),this.activeElementRef=null),e.has("entries")){const t=e.get("entries");t!==void 0&&JSON.stringify(t)!==JSON.stringify(this.entries)&&this.dispatchEvent(new m(this.entries))}}render(){return d`<div class=property-grid-editor>${this.entries?.length?d`<div class=property-grid-editor__entries>${v(this.entries,e=>e.id,e=>this.renderEntry(e))}</div>`:h} ${this.enableAddRow?d`<div class=property-grid-editor__actions><button class="btn btn-sm btn-default" title=${this.labelAdd} @click=${this.handleCreate}><typo3-backend-icon identifier=actions-plus size=small></typo3-backend-icon><span class=btn-label>${this.labelAdd}</span></button></div>`:h}</div>`}renderEntry(e){return d`<div class=${g({"property-grid-editor__entry":!0,moving:this.movedEntry===e,dragging:this.draggedEntry===e})} @dragover=${t=>this.handleDragOver(t)} @dragenter=${t=>this.handleDragEnter(t,e)} @drop=${t=>this.handleDrop(t)} @dragend=${t=>this.handleDragEnd(t)}><div class=property-grid-editor__entry-inputs><div class=form-group><label for=${e.id}-label class=form-label>${this.labelLabel}</label><div class="input-group form-control-wrap"><input id=${e.id}-label class="form-control form-control-sm" type=text @change=${t=>this.handleChange(t,"label",e)} @keyup=${t=>this.handleChange(t,"label",e)} @focusout=${()=>this.handleFocusOut(e)} .value=${b(e.label)}> ${this.renderFormElementSelectionButton(this.enableLabelFormElementSelectionButton,"label",e)}</div></div><div class=form-group><label for=${e.id}-value class=form-label>${this.labelValue}</label><div class="input-group form-control-wrap"><input id=${e.id}-value class="form-control form-control-sm" type=text @change=${t=>this.handleChange(t,"value",e)} @keyup=${t=>this.handleChange(t,"value",e)} .value=${b(e.value)}> ${this.renderFormElementSelectionButton(this.enableValueFormElementSelectionButton,"value",e)}</div></div>${this.enableSelection||this.enableMultiSelection?d`<div class=form-check><input id=${e.id}-selected class=form-check-input type=checkbox @change=${t=>this.handleChange(t,"selected",e)} .checked=${b(e.selected)}> <label for=${e.id}-selected class=form-check-label>${this.labelSelected}</label></div>`:h}</div>${this.enableSorting||this.enableDeleteRow?d`<div class=property-grid-editor__entry-buttons>${this.enableSorting?d`<button class="btn btn-sm btn-default" title=${this.labelMove} draggable=true @click=${t=>this.handleMoveClick(t,e)} @keydown=${this.handleMoveKeyDown} @dragstart=${t=>this.handleDragStart(t,e)}><typo3-backend-icon identifier=${this.movedEntry===e?"actions-thumbtack":"actions-move-move"} size=small></typo3-backend-icon></button>`:h} ${this.enableDeleteRow?d`<button class="btn btn-sm btn-default" title=${this.labelRemove} @click=${()=>this.handleRemove(e)}><typo3-backend-icon identifier=actions-delete size=small></typo3-backend-icon></button>`:h}</div>`:h}</div>`}renderFormElementSelectionButton(e,t,l){return!e||!this.formElements?.length?d`${h}`:d`<typo3-form-element-selector @typo3:backend:form-editor:component:form-element-selector:selected=${i=>this.handleFormElementSelection(i,t,l)} elements=${JSON.stringify(this.formElements)} size=small></typo3-form-element-selector>`}handleFormElementSelection(e,t,l){const i=l[t];i?this.setEntryProperty(l,t,`${i} {${e.value}}`):this.setEntryProperty(l,t,`{${e.value}}`)}handleFocusOut(e){this.enableLabelAsFallbackValue&&e.value===""&&this.setEntryProperty(e,"value",e.label)}handleChange(e,t,l){const i=e.targLine 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 D from"@typo3/core/ajax/ajax-request.js";import{AjaxResponse as P}from"@typo3/core/ajax/ajax-response.js";import{cloneDeep as R}from"lodash-es";function a(c,e,t){if(typeof c=="function"&&(c=c()!==!1),!c)throw e=e||"Assertion failed",t&&(e=e+" ("+t+")"),typeof Error<"u"?new Error(e):e}class O{assert(e,t,r){a(e,t,r)}isUndefinedOrNull(e){return e==null}isNonEmptyArray(e){return Array.isArray(e)&&e.length>0}isNonEmptyString(e){return typeof e=="string"&&e.length>0}canBeInterpretedAsInteger(e){if(typeof e=="number")return!0;if(typeof e!="string")return!1;const t=e;return(t*1).toString()===t.toString()&&t.toString().indexOf(".")===-1}buildPropertyPath(e,t,r,i,n){let o="";return n=!!n,this.isNonEmptyString(t)||this.isNonEmptyString(r)?(a(this.isNonEmptyString(t),'Invalid parameter "collectionElementIdentifier"',1475412569),a(this.isNonEmptyString(r),'Invalid parameter "collectionName"',1475412570),o=r+"."+C.getIndexFromPropertyCollectionElementByIdentifier(t,r,i)):o="",this.isUndefinedOrNull(e)||(a(this.isNonEmptyString(e),'Invalid parameter "propertyPath"',1475415988),this.isNonEmptyString(o)?o=o+"."+e:o=e),n||a(this.isNonEmptyString(o),"The property path could not be resolved",1475663210),o}convertToSimpleObject(e){a(typeof e=="object"&&e!==null&&!Array.isArray(e),'Invalid parameter "formElement"',1475377782);const t={},r="getObjectData"in e&&typeof e.getObjectData=="function"?e.getObjectData():e,i=r.renderables;delete r.renderables;for(const[n,o]of Object.entries(r))n.match(/^__/)||(o!==null&&typeof o=="object"&&!Array.isArray(o)?t[n]=this.convertToSimpleObject(o):typeof o!="function"&&typeof o<"u"&&(t[n]=o));if(Array.isArray(i)){t.renderables=[];for(let n=0,o=i.length;n<o;++n)t.renderables.push(this.convertToSimpleObject(i[n]))}return t}}const B=["ItemCount"];function V(c){const e=Array.isArray(c.propertyValidators)?[...c.propertyValidators]:[];return(!l.isUndefinedOrNull(c.minItems)||!l.isUndefinedOrNull(c.maxItems))&&!e.includes("ItemCount")&&e.push("ItemCount"),e}class k{constructor(){this.validators={}}addValidatorIdentifiersToFormElementProperty(e,t,r,i,n,o){a(Array.isArray(t),'Invalid parameter "validators"',1475661026),a(Array.isArray(t),'Invalid parameter "validators"',1479238074),a(typeof e=="object"&&e!==null&&!Array.isArray(e),'Invalid parameter "formElement"',1475661025);const s=e.get("__identifierPath");r=l.buildPropertyPath(r,i,n,e);const d=u().getCurrentState("propertyValidationServiceRegisteredValidators");l.isUndefinedOrNull(d[s])&&(d[s]={}),l.isUndefinedOrNull(d[s][r])&&(d[s][r]={validators:[],configuration:o});for(const p of t)d[s][r].validators.indexOf(p)===-1&&d[s][r].validators.push(p);u().setCurrentState("propertyValidationServiceRegisteredValidators",d)}removeValidatorIdentifiersFromFormElementProperty(e,t){a(typeof e=="object"&&e!==null&&!Array.isArray(e),'Invalid parameter "formElement"',1475700618),a(l.isNonEmptyString(t),'Invalid parameter "propertyPath"',1475706896);const r=e.get("__identifierPath"),i={},n=u().getCurrentState("propertyValidationServiceRegisteredValidators");if(r in n)for(const o of Object.keys(n[r]||{}))o.indexOf(t)>-1||(i[o]=n[r][o]);n[r]=i,u().setCurrentState("propertyValidationServiceRegisteredValidators",n)}removeAllValidatorIdentifiersFromFormElement(e){a(typeof e=="object"&&e!==null&&!Array.isArray(e),'Invalid parameter "formElement"',1475668189);const t={},r=u().getCurrentState("propertyValidationServiceRegisteredValidators");for(const i of Object.keys(r||{}))i===e.get("__identifierPath")||i.indexOf(e.get("__identifierPath")+"/")>-1||(t[i]=r[i]);u().setCurrentState("propertyValidationServiceRegisteredValidators",t)}addValidator(e,t){a(l.isNonEmptyString(e),'Invalid parameter "validatorIdentifier"',1475669143),a(typeof t=="function",'Invalid parameter "func"',1475669144),a(typeof this.validators[e]!="function",'The validator "'+e+'" is already registered',1475669145),this.validators[e]=t}validateFormElementProperty(e,t){let r;a(typeof e=="object"&&e!==null&&!Array.isArray(e),'Invalid parameter "formElement"',1475676517),a(l.isNonEmptyString(t),'Invalid parameter "propertyPath"',1475676518);const i=e.get("__identifierPath"),n=[],o=u().getCurrentState("propertyValidationServiceRegisteredValidators");if(r={propertyValidatorsMode:"AND"},!l.isUndefinedOrNull(o[i])&&typeof o[i][t]=="object"&&o[i][t]!==null&&!Array.isArray(o[i][t])&&Array.isArray(o[i][t].validators)){r=o[i][t].configuration;const s=o[i][t].validators,d=[],p=[];let y=0;for(let I=0,h=s.length;I<h;++I){const f=s[I];if(typeof this.validators[f]!="function")continue;const v=B.includes(f);v||++y;const m=this.validators[f](e,t);l.isNonEmptyString(m)&&(v?p.push(m):d.push(m))}r.propertyValidatorsMode==="OR"&&d.length>0&&d.length!==y||n.push(...d),n.push(...p)}return n}validateFormElement(e){a(typeof e=="object"&&e!==null&&!Array.isArray(e),'Invalid parameter "formElement"',1475749668);const t=e.get("__identifierPath"),r=[],i=u().getCurrentState("propertyValidationServiceRegisteredValidators");if(!l.iLine 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{merge as E}from"lodash-es";let d=null,r=null;const p={domElementClassNames:{active:"active",buttonCollectionElementRemove:"formeditor-inspector-collection-element-remove-button",buttonFormEditor:"formeditor-button",disabled:"disabled",hidden:"hidden",icon:"formeditor-icon",sortableHover:"sortable-hover"},domElementDataAttributeNames:{elementIdentifier:"data-element-identifier-path",identifier:"data-identifier",template:"data-template-name",templateProperty:"data-template-property"},domElementSelectorPattern:{bracesWithKey:"[{0}]",bracesWithKeyValue:'[{0}="{1}"]',class:".{0}",id:"#{0}",keyValue:'{0}="{1}"'}};function s(){return d}function l(){return s().getUtility()}function a(e,n,t){return s().assert(e,n,t)}function b(e){return a(typeof e=="object"&&e!==null&&!Array.isArray(e),'Invalid parameter "partialConfiguration"',1478950623),r=E({},p,e),this}function c(e,n){let t;a(!l().isUndefinedOrNull(r.domElementSelectorPattern[e]),'Invalid parameter "patternIdentifier" ('+e+")",1478801251),a(Array.isArray(n),'Invalid parameter "replacements"',1478801252),t=r.domElementSelectorPattern[e];for(let m=0,f=n.length;m<f;++m)t=t.replace("{"+m+"}",n[m]);return t}function o(e,n){return a(!l().isUndefinedOrNull(r.domElementSelectorPattern[e]),'Invalid parameter "selectorIdentifier" ('+e+")",1478372374),c(e,n)}function y(e,n){let t;return a(!l().isUndefinedOrNull(r.domElementClassNames[e]),'Invalid parameter "classNameIdentifier" ('+e+")",1478803906),t=r.domElementClassNames[e],n&&(t=o("class",[t])),t}function D(e,n){let t;return a(!l().isUndefinedOrNull(r.domElementIdNames[e]),'Invalid parameter "domElementIdNames" ('+e+")",1479251518),t=r.domElementIdNames[e],n&&(t=o("id",[t])),t}function u(e){return a(!l().isUndefinedOrNull(r.domElementDataAttributeValues[e]),'Invalid parameter "dataAttributeValueIdentifier" ('+e+")",1478806884),r.domElementDataAttributeValues[e]}function i(e,n,t){return a(!l().isUndefinedOrNull(r.domElementDataAttributeNames[e]),'Invalid parameter "dataAttributeIdentifier" ('+e+")",1478808035),l().isUndefinedOrNull(n)?r.domElementDataAttributeNames[e]:(t=t||[],o(n,[r.domElementDataAttributeNames[e]].concat(t)))}function N(e){return i("identifier","bracesWithKeyValue",[u(e)])}function v(e){return l().isUndefinedOrNull(r.domElementDataAttributeValues[e])||(e=u(e)),document.querySelector(i("template","bracesWithKeyValue",[e]))}function g(e,n){return n.querySelector(i("templateProperty","bracesWithKeyValue",[e]))}function h(e){d=e}export{h as bootstrap,c as buildDomElementSelectorHelper,y as getDomElementClassName,i as getDomElementDataAttribute,u as getDomElementDataAttributeValue,N as getDomElementDataIdentifierSelector,D as getDomElementIdName,o as getDomElementSelector,v as getTemplateElement,g as getTemplatePropertyElement,b as setConfiguration};
|
||||
@@ -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*as M from"@typo3/form/backend/form-editor/helper.js";import{merge as ye}from"lodash-es";import T from"@typo3/backend/icons.js";import V from"@typo3/backend/modal.js";import{MessageUtility as Ee}from"@typo3/backend/utility/message-utility.js";import be from"sortablejs";import _ from"dompurify";import{PropertyGridEditorUpdateEvent as fe}from"@typo3/form/backend/form-editor/component/property-grid-editor.js";import{DateEditorChangeEvent as ve}from"@typo3/form/backend/form-editor/component/date-editor.js";import{FormElementSelectorSelectedEvent as he}from"@typo3/form/backend/form-editor/component/form-element-selector.js";const Pe=await import("@typo3/rte-ckeditor/ckeditor5.js").catch(()=>null),ge={domElementClassNames:{buttonFormElementRemove:"formeditor-inspector-element-remove-button",collectionElement:"formeditor-inspector-collection-element",finisherEditorPrefix:"t3-form-inspector-finishers-editor-",inspectorEditor:"formeditor-inspector-element",inspectorInputGroup:"input-group",sortable:"sortable",validatorEditorPrefix:"formeditor-inspector-validators-editor-"},domElementDataAttributeNames:{contentElementSelectorTarget:"data-insert-target",finisher:"data-finisher-identifier",validator:"data-validator-identifier",randomId:"data-random-id",randomIdTarget:"data-random-id-attribute",randomIdIndex:"data-random-id-number",maximumFileSize:"data-maximumFileSize"},domElementDataAttributeValues:{collapse:"actions-view-table-expand",editorControlsInputGroup:"inspectorEditorControlsGroup",editorWrapper:"editorWrapper",editorControlsWrapper:"inspectorEditorControlsWrapper",formElementHeaderEditor:"inspectorFormElementHeaderEditor",formElementSelectorControlsWrapper:"inspectorEditorFormElementSelectorControlsWrapper",formElementSelectorSplitButtonContainer:"inspectorEditorFormElementSelectorSplitButtonContainer",formElementSelectorSplitButtonListContainer:"inspectorEditorFormElementSelectorSplitButtonListContainer",iconNotAvailable:"actions-close",inspector:"inspector","Inspector-CheckboxEditor":"Inspector-CheckboxEditor","Inspector-CollectionElementHeaderEditor":"Inspector-CollectionElementHeaderEditor","Inspector-FinishersEditor":"Inspector-FinishersEditor","Inspector-FormElementHeaderEditor":"Inspector-FormElementHeaderEditor","Inspector-PropertyGridEditor":"Inspector-PropertyGridEditor","Inspector-RemoveElementEditor":"Inspector-RemoveElementEditor","Inspector-RequiredValidatorEditor":"Inspector-RequiredValidatorEditor","Inspector-SingleSelectEditor":"Inspector-SingleSelectEditor","Inspector-MultiSelectEditor":"Inspector-MultiSelectEditor","Inspector-GridColumnViewPortConfigurationEditor":"Inspector-GridColumnViewPortConfigurationEditor","Inspector-TextareaEditor":"Inspector-TextareaEditor","Inspector-TextEditor":"Inspector-TextEditor","Inspector-Typo3WinBrowserEditor":"Inspector-Typo3WinBrowserEditor","Inspector-ValidatorsEditor":"Inspector-ValidatorsEditor","Inspector-ValidationErrorMessageEditor":"Inspector-ValidationErrorMessageEditor","Inspector-DateEditor":"Inspector-DateEditor",inspectorFinishers:"inspectorFinishers",inspectorValidators:"inspectorValidators",viewportButton:"viewportButton"},domElementIdNames:{finisherPrefix:"t3-form-inspector-finishers-",validatorPrefix:"t3-form-inspector-validators-"},isSortable:!0};let j=null,U=null;function v(){return U}function D(){return v().getViewModel()}function o(e){return d().isUndefinedOrNull(e)?M.setConfiguration(j):M.setConfiguration(e)}function d(){return v().getUtility()}function p(e,t,r){return v().assert(e,t,r)}function Ae(){return v().getRootFormElement()}function E(){return v().getCurrentlySelectedFormElement()}function w(){return v().getPublisherSubscriber()}function N(e,t){return v().getFormElementDefinition(e,t)}const Ie={ALLOWED_TAGS:["abbr","b","br","code","em","i","kbd","span","strong","u"],ALLOWED_ATTR:["class","title","role"]},Se={ALLOWED_TAGS:["a","abbr","blockquote","b","br","code","em","i","kbd","li","p","pre","span","strong","u","ul","ol"],ALLOWED_ATTR:["class","href","title","target","role","rel"]};function P(e,t){e&&(e.innerHTML=_.sanitize(t,Ie))}function q(e,t){e&&(e.innerHTML=_.sanitize(t,Se))}function G(e,t,r,l){switch(e.templateName){case"Inspector-FormElementHeaderEditor":J(e,t);break;case"Inspector-CollectionElementHeaderEditor":Q(e,t,r,l);break;case"Inspector-MaximumFileSizeEditor":X(e,t);break;case"Inspector-TextEditor":Z(e,t,r,l);break;case"Inspector-FinishersEditor":W("finishers",e,t);break;case"Inspector-ValidatorsEditor":W("validators",e,t);break;case"Inspector-ValidationErrorMessageEditor":C(e,t);break;case"Inspector-RemoveElementEditor":pe(e,t,r,l);break;case"Inspector-RequiredValidatorEditor":ae(e,t,r,l);break;case"Inspector-CheckboxEditor":se(e,t,r,l);break;case"Inspector-CountrySelectEditor":H(e,t,r,l);break;case"Inspector-CountrySingleSelectEditor":ee(e,t,r,l);break;case"Inspector-SingleSelectEditor":te(e,t,r,l);break;case"Inspector-MultiSelectEditor":re(e,t,r,l);break;case"Inspector-GridColumnViewPortConfigurationEdLine 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*as u from"@typo3/form/backend/form-editor/helper.js";let m=null,b=null;function n(){return m}function e(){return b}function g(){return n().getUtility()}function w(i,t,o){return n().assert(i,t,o)}function d(i){return g().isUndefinedOrNull(i)?u.setConfiguration(e().getConfiguration()):u.setConfiguration(i)}function l(){return n().getCurrentlySelectedFormElement()}function r(){return n().getPublisherSubscriber()}function a(){return n().getRootFormElement()}function v(){window.onbeforeunload=function(i){if(n().getUnsavedContent())return i=i||window.event,i&&(i.returnValue=n().getFormElementDefinition(a(),"modalCloseDialogMessage")),n().getFormElementDefinition(a(),"modalCloseDialogTitle")},r().subscribe("view/ready",()=>{e().onViewReadyBatch()}),r().subscribe("core/applicationState/add",(i,[t,o,s])=>{e().disableButton(document.querySelector(d().getDomElementDataIdentifierSelector("buttonHeaderRedo"))),s>1&&o<=s?e().enableButton(document.querySelector(d().getDomElementDataIdentifierSelector("buttonHeaderUndo"))):e().disableButton(document.querySelector(d().getDomElementDataIdentifierSelector("buttonHeaderUndo")))}),r().subscribe("core/ajax/saveFormDefinition/success",(i,[t])=>{n().setUnsavedContent(!1),e().setPreviewMode(!1),e().showSaveSuccessMessage(),e().showSaveButtonSaveIcon(),n().setFormDefinition(t.formDefinition),e().addStructureRootElementSelection(),n().setCurrentlySelectedFormElement(a()),e().setStructureRootElementTitle(),e().setStageHeadline(),e().renderAbstractStageArea(),e().renewStructure(),e().renderPagination(),e().renderInspectorEditors()}),r().subscribe("core/ajax/saveFormDefinition/error",(i,[t])=>{e().showSaveButtonSaveIcon(),e().showSaveErrorMessage({message:t.message})}),r().subscribe("core/ajax/renderFormDefinitionPage/success",(i,[t,o])=>{e().renderPreviewStageArea(t)}),r().subscribe("core/ajax/error",(i,[t,o])=>{e().showErrorFlashMessage(t,o),e().renderPreviewStageArea(o)}),r().subscribe("view/header/button/save/clicked",()=>{n().validationResultsHasErrors(n().validateFormElementRecursive(a(),!0))?e().showValidationErrorsModal():(e().showSaveButtonSpinnerIcon(),n().saveFormDefinition())}),r().subscribe("view/header/formSettings/clicked",()=>{e().setPreviewMode(!1),e().addStructureRootElementSelection(),n().setCurrentlySelectedFormElement(a()),e().renderAbstractStageArea(),e().renewStructure(),e().renderPagination(),e().showInspectorSidebar(),e().renderInspectorEditors()}),r().subscribe("view/header/button/newPage/clicked",(i,[t])=>{n().isRootFormElementSelected()&&e().selectPageBatch(0),e().showInsertPagesModal(t)}),r().subscribe("view/header/button/close/clicked",()=>{e().showCloseConfirmationModal()}),r().subscribe("view/undoButton/clicked",()=>{e().disableButton(document.querySelector(d().getDomElementDataIdentifierSelector("buttonHeaderUndo"))),e().disableButton(document.querySelector(d().getDomElementDataIdentifierSelector("buttonHeaderRedo"))),n().undoApplicationState(),e().getPreviewMode()?n().renderCurrentFormPage():e().renderAbstractStageArea(),n().setUnsavedContent(!0),e().renewStructure(),e().renderPagination(),e().renderInspectorEditors()}),r().subscribe("view/redoButton/clicked",()=>{e().disableButton(document.querySelector(d().getDomElementDataIdentifierSelector("buttonHeaderUndo"))),e().disableButton(document.querySelector(d().getDomElementDataIdentifierSelector("buttonHeaderRedo"))),n().redoApplicationState(),e().getPreviewMode()?n().renderCurrentFormPage():e().renderAbstractStageArea(),n().setUnsavedContent(!0),e().renewStructure(),e().renderPagination(),e().renderInspectorEditors()}),r().subscribe("view/stage/element/clicked",(i,[t])=>{e().getPreviewMode()||l().get("__identifierPath")!==t&&(n().setCurrentlySelectedFormElement(t),e().selectStructureNode(),e().renewStructure(),e().refreshSelectedElementItemsBatch(),e().addAbstractViewValidationResults(),e().showInspectorSidebar(),e().renderInspectorEditors(),e().focusFirstInspectorInput())}),r().subscribe("view/stage/abstract/elementToolbar/button/newElement/clicked",(i,[t,o])=>{n().isRootFormElementSelected()&&e().selectPageBatch(0),e().showInsertElementsModal(t,o)}),r().subscribe("view/stage/abstract/button/newElement/clicked",(i,[t,o])=>{n().isRootFormElementSelected()&&e().selectPageBatch(0),e().showInsertElementsModal(t,o||void 0)}),r().subscribe("view/stage/abstract/dnd/start",(i,[t,o])=>{e().onAbstractViewDndStartBatch(t,o)}),r().subscribe("view/stage/abstract/dnd/stop",(i,[t])=>{n().setCurrentlySelectedFormElement(t),e().renewStructure(),e().setPreviewMode(!1),e().renderAbstractStageArea(),e().refreshSelectedElementItemsBatch(),e().addAbstractViewValidationResults(),e().renderInspectorEditors()}),r().subscribe("view/stage/abstract/dnd/change",(i,[t,o,s])=>{e().onAbstractViewDndChangeBatch(t,o,s)}),r().subscribe("view/stage/abstract/dnd/update",(i,[t,o,s,c])=>{e().onAbstractViewDndUpdateBatch(t,o,s,c)}),r().subscribe("view/viewModeButton/abstract/clicked",()=>{e().getPreviewMode()&&(e().setPreviewMode(!1)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*as y from"@typo3/form/backend/form-editor/helper.js";import{merge as A}from"lodash-es";import d from"@typo3/backend/modal.js";import h from"@typo3/backend/severity.js";let w=null;const M={domElementClassNames:{buttonDefault:"btn-default",buttonInfo:"btn-info",buttonWarning:"btn-warning"},domElementDataAttributeNames:{elementType:"element-type",fullElementType:"data-element-type"},domElementDataAttributeValues:{rowItem:"rowItem",rowLink:"rowLink",rowsContainer:"rowsContainer",templateInsertElements:"Modal-InsertElements",templateInsertPages:"Modal-InsertPages",templateValidationErrors:"Modal-ValidationErrors"}};let D=null;function f(){return D}function r(e){return p().isUndefinedOrNull(e)?y.setConfiguration(w):y.setConfiguration(e)}function p(){return f().getUtility()}function u(e,t,n){return f().assert(e,t,n)}function i(){return f().getRootFormElement()}function b(){return f().getPublisherSubscriber()}function m(e,t){return f().getFormElementDefinition(e,t)}function I(e,t){const n=[];u(p().isNonEmptyString(e),'Invalid parameter "publisherTopicName"',1478889049),u(Array.isArray(t),'Invalid parameter "formElement"',1478889044),n.push({text:m(i(),"modalRemoveElementCancelButton"),active:!0,btnClass:r().getDomElementClassName("buttonDefault"),name:"cancel",trigger:(o,l)=>{l.hideModal()}}),n.push({text:m(i(),"modalRemoveElementConfirmButton"),active:!0,btnClass:r().getDomElementClassName("buttonWarning"),name:"confirm",trigger:(o,l)=>{b().publish(e,t),l.hideModal()}}),d.show(m(i(),"modalRemoveElementDialogTitle"),m(i(),"modalRemoveElementDialogMessage"),h.warning,n)}function C(e,t,n){if(u(p().isNonEmptyString(t),'Invalid parameter "publisherTopicName"',1478910954),typeof n=="object"&&n!==null&&!Array.isArray(n))for(const o of Object.keys(n)){if(o==="disableElementTypes"&&Array.isArray(n[o]))for(let l=0,E=n[o].length;l<E;++l)e.querySelectorAll(r().getDomElementDataAttribute("fullElementType","bracesWithKeyValue",[n[o][l]])).forEach(a=>a.classList.add(r().getDomElementClassName("disabled")));o==="onlyEnableElementTypes"&&Array.isArray(n[o])&&e.querySelectorAll(r().getDomElementDataAttribute("fullElementType","bracesWithKey")).forEach(l=>{const E=l.getAttribute(r().getDomElementDataAttribute("elementType"));n[o].some(c=>c===E)||l.classList.add(r().getDomElementClassName("disabled"))})}[...e.children].forEach(o=>o.addEventListener("typo3:form:insert-element-click",function(l){b().publish(t,[l.detail.item.identifier])}))}function S(e,t){let n,o;u(Array.isArray(t),'Invalid parameter "validationResults"',1479161268);const l=r().getDomElementDataIdentifierSelector("rowItem"),E=e.querySelector(l)?.cloneNode(!0);e.querySelectorAll(l).forEach(a=>a.remove());for(let a=0,c=t.length;a<c;++a){let v=!1;for(let s=0,g=t[a].validationResults.length;s<g;++s)if(t[a].validationResults[s].validationResults&&t[a].validationResults[s].validationResults.length>0){v=!0;break}if(v){n=f().getFormElementByIdentifierPath(t[a].formElementIdentifierPath),o=E?.cloneNode(!0);const s=o?.querySelector(r().getDomElementDataIdentifierSelector("rowLink"));s&&(s.setAttribute(r().getDomElementDataAttribute("elementIdentifier"),t[a].formElementIdentifierPath),s.replaceChildren(N(n)));const g=e.querySelector(r().getDomElementDataIdentifierSelector("rowsContainer"));g&&o&&g.append(o)}}e.querySelectorAll("a").forEach(a=>{a.addEventListener("click",function(){b().publish("view/modal/validationErrors/element/clicked",[a.getAttribute(r().getDomElementDataAttribute("elementIdentifier"))]),e.querySelectorAll("a").forEach(c=>c.replaceWith(c.cloneNode(!0))),d.currentModal.hideModal()})})}function N(e){u(typeof e=="object"&&e!==null&&!Array.isArray(e),'Invalid parameter "formElement"',1479162557);const t=document.createElement("span");return t.textContent=e.get("label")?e.get("label"):e.get("identifier"),t}function T(e){I("view/modal/removeFormElement/perform",[e])}function B(e,t,n){u(p().isNonEmptyString(e),'Invalid parameter "collectionElementIdentifier"',1478894420),u(p().isNonEmptyString(t),'Invalid parameter "collectionName"',1478894421),I("view/modal/removeCollectionElement/perform",[e,t,n])}function P(){const e=[];e.push({text:m(i(),"modalCloseCancelButton"),active:!0,btnClass:r().getDomElementClassName("buttonDefault"),name:"cancel",trigger:(t,n)=>{n.hideModal()}}),e.push({text:m(i(),"modalCloseConfirmButton"),active:!0,btnClass:r().getDomElementClassName("buttonWarning"),name:"confirm",trigger:(t,n)=>{b().publish("view/modal/close/perform",[]),n.hideModal()}}),d.show(m(i(),"modalCloseDialogTitle"),m(i(),"modalCloseDialogMessage"),h.warning,e)}function R(e,t){const n=r().getTemplateElement("templateInsertElements");if(n){const o=document.importNode(n.content,!0);C(o,e,t),d.advanced({title:m(i(),"modalInsertElementsDialogTitle"),size:d.sizes.large,content:o})}}function k(e){const t=r().getTemplateElement("templateInsertPages");if(t){const n=document.importNode(t.content,!0);C(n,e),d.advanced({title:m(i(),"modalInsertPagesDialogTitle"),size:d.sizes.smLine 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*as L from"@typo3/form/backend/form-editor/helper.js";import{merge as G}from"lodash-es";import J from"sortablejs";import"@typo3/form/backend/form-editor/component/form-element-stage-item.js";import"@typo3/form/backend/form-editor/component/form-element-stage-item-toolbar.js";import"@typo3/form/backend/form-editor/component/page-stage-item.js";import Q from"~labels/form.form_editor_javascript";const X={domElementClassNames:{formElementIsComposit:"formeditor-element-composit",formElementIsTopLevel:"formeditor-element-toplevel",noNesting:"no-nesting",selected:"selected",sortable:"sortable",previewViewPreviewElement:"formeditor-element-preview"},domElementDataAttributeNames:{abstractType:"data-element-abstract-type",noSorting:"data-no-sorting"},domElementDataAttributeValues:{abstractViewToolbarNewElement:"stageElementToolbarNewElement",abstractViewToolbarNewElementSplitButton:"stageElementToolbarNewElementSplitButton",abstractViewToolbarNewElementSplitButtonAfter:"stageElementToolbarNewElementSplitButtonAfter",abstractViewToolbarNewElementSplitButtonInside:"stageElementToolbarNewElementSplitButtonInside",abstractViewToolbarRemoveElement:"stageElementToolbarRemoveElement",buttonHeaderRedo:"redoButton",buttonHeaderUndo:"undoButton",buttonPaginationPrevious:"buttonPaginationPrevious",buttonPaginationNext:"buttonPaginationNext",formElementIcon:"elementIcon",iconValidator:"form-validator",multiValueContainer:"multiValueContainer",paginationTitle:"paginationTitle",stageHeadline:"formDefinitionLabel",stagePanel:"stagePanel",validatorsContainer:"validatorsContainer",validatorIcon:"validatorIcon"},isSortable:!0};let N=null,F=null,d=null;function s(){return F}function l(e){return b().isUndefinedOrNull(e)?L.setConfiguration(N):L.setConfiguration(e)}function b(){return s().getUtility()}function v(){return s().getViewModel()}function w(e,t,n){return s().assert(e,t,n)}function T(){return s().getRootFormElement()}function O(){return s().getCurrentlySelectedFormElement()}function p(){return s().getPublisherSubscriber()}function c(e,t){return s().getFormElementDefinition(e,t)}function Y(e,t){p().publish("view/stage/abstract/render/template/perform",[e,t])}function Z(e,t){const n=document.createElement("li");n.setAttribute("data-no-sorting","true"),n.classList.add("formeditor-new-element-placeholder");const o=Q.get("formEditor.stage.toolbar.new_element"),i=document.createElement("button");i.type="button",i.title=o,i.classList.add("btn","btn-sm","btn-default");const r=document.createElement("typo3-backend-icon");return r.setAttribute("identifier","actions-plus"),r.setAttribute("size","small"),i.append(r,document.createTextNode(" "+o)),i.addEventListener("click",function(u){u.stopPropagation(),s().setCurrentlySelectedFormElement(e),t==="inside"?p().publish("view/stage/abstract/elementToolbar/button/newElement/clicked",["view/insertElements/perform/inside",{disableElementTypes:[],onlyEnableElementTypes:[]}]):p().publish("view/stage/abstract/elementToolbar/button/newElement/clicked",["view/insertElements/perform/after",{disableElementTypes:[],onlyEnableElementTypes:[]}])}),n.append(i),n}function U(e){let t;const n=document.createElement("li");c(e,"_isCompositeFormElement")||n.classList.add(l().getDomElementClassName("noNesting")),c(e,"_isTopLevelFormElement")&&n.classList.add(l().getDomElementClassName("formElementIsTopLevel")),c(e,"_isCompositeFormElement")&&n.classList.add(l().getDomElementClassName("formElementIsComposit"));let o;try{o=l().getTemplateElement("FormElement-"+e.get("type"))}catch{o=null}const i=o===null,r=document.createElement("div");r.setAttribute(l().getDomElementDataAttribute("elementIdentifier"),e.get("__identifierPath")),o&&r.append(document.importNode(o.content,!0));const u=c(e,"_isCompositeFormElement");u&&r.setAttribute(l().getDomElementDataAttribute("abstractType"),"isCompositeFormElement");const E=c(e,"_isTopLevelFormElement");if(E?r.setAttribute(l().getDomElementDataAttribute("abstractType"),"isTopLevelFormElement"):(r.classList.add("formeditor-element"),r.setAttribute("tabindex","0"),r.setAttribute("role","button"),r.setAttribute("aria-label",(e.get("label")||e.get("identifier"))+" ("+c(e,"label")+")")),e.get("renderingOptions.enabled")===!1&&r.classList.add("formeditor-element-hidden"),!E&&!i&&!r.querySelector("typo3-form-form-element-stage-item-toolbar")){const f=document.createElement("typo3-form-form-element-stage-item-toolbar");f.iconIdentifier=c(e,"iconIdentifier")||"",f.elementType=c(e,"label")||"",f.elementIdentifier=e.get("identifier")||"",f.isHidden=e.get("renderingOptions.enabled")===!1,f.active=!0,r.prepend(f)}if(n.append(r),E&&i?j(e,r):i?M(e,r):Y(e,r),E||u){t=document.createElement("ol"),t.classList.add(l().getDomElementClassName("sortable")),t.classList.add("formeditor-list");const f=e.get("renderables"),g=Array.isArray(f)&&f.length>0;if(g||t.append(Z(e,"inside")),g)for(let A=0,k=f.length;A<k;++A)t.append(U(f[A]));n.append(t)}return n}function $(){const e=d.querySelectorAll("ol."+l(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*as B from"@typo3/form/backend/form-editor/helper.js";import{FORM_EDITOR_TREE_EVENTS as p}from"@typo3/form/backend/form-editor-tree-events.js";import{stripTags as G}from"@typo3/form/backend/form-editor/utility/string-utility.js";import"@typo3/form/backend/form-editor-tree-container.js";let b=null,i=null,o=null;function a(){return b}function d(){return a().getPublisherSubscriber()}function y(){return a().getRootFormElement()}function h(){return a().getCurrentlySelectedFormElement()}function u(e,t){return a().getFormElementDefinition(e,t)}function w(e){const t=e.get("label")||e.get("identifier"),n={identifier:e.get("identifier"),identifierPath:e.get("__identifierPath"),label:G(t),type:u(e,"label"),iconIdentifier:u(e,"iconIdentifier"),isComposite:u(e,"_isCompositeFormElement"),isTopLevel:u(e,"_isTopLevelFormElement"),enabled:e.get("renderingOptions.enabled")!==!1,children:[]},r=e.get("renderables");return Array.isArray(r)&&r.length>0&&(n.children=r.map(l=>w(l))),n}function K(){const e=y(),t=w(e);return t.expanded=!0,[t]}function E(e){if(!i)return;const t=K();requestAnimationFrame(async()=>{await i.setNodes(t);let n=e;if(!n)try{n=h()}catch{n=null}if(n){const r=n.get("__identifierPath");i.setSelectedNode(r)}d().publish("view/structure/renew/postProcess")})}function N(e){if(!i)return;let t=e;if(!t)try{t=h()}catch{return}i.setSelectedNode(t.get("__identifierPath"))}function F(e,t){if(!t)try{t=h()}catch{return}e&&t.set("label",e),E(t)}function D(e){let t;if(typeof e=="string")t=e;else{let n=e;if(!n)try{n=h()}catch{return null}t=n.get("__identifierPath")}return o?o.querySelector(`[data-id="${t}"]`):null}function S(){return o?o.querySelectorAll(".tree-item"):document.querySelectorAll(".tree-item-none")}function I(e,t=!0){i&&i.setNodeValidationError(e,t)}function A(e,t=!0){i&&i.setNodeChildHasError(e,t)}function C(){i&&i.clearAllValidationErrors()}function _(){return o}function L(e){const t=document.createElement("span");t.textContent=e.get("label")?e.get("label"):e.get("identifier");const n=document.createElement("small");return n.textContent="("+u(e,"label")+")",t.appendChild(n),t}function q(e){return e?e.querySelector(".tree-item-content"):null}function x(e){return e?.closest("[data-id]")?.getAttribute("data-id")??""}function O(e){const t=e?.parentElement?.closest("li[data-id]");return t?t.querySelector(".tree-item-content"):null}function R(e){return e?.parentElement?.closest("li[data-id]")?.getAttribute("data-id")??""}function W(e,t="prev"){const n=e?.closest("li[data-id]");return n?(t==="prev"?n.previousElementSibling?.matches("li[data-id]")?n.previousElementSibling:null:n.nextElementSibling?.matches("li[data-id]")?n.nextElementSibling:null)?.getAttribute("data-id")??"":""}function V(){return document.createElement("div")}function v(){return window.parent.document.querySelector("typo3-backend-navigation-component-formeditortree")}function M(){const e=v();return e?Promise.resolve(e):new Promise(t=>{const n=()=>{clearTimeout(r),window.parent.document.removeEventListener("typo3:tree-container:ready",n);const l=v();t(l)};window.parent.document.addEventListener("typo3:tree-container:ready",n);const r=window.setTimeout(()=>{window.parent.document.removeEventListener("typo3:tree-container:ready",n),console.warn("[FormEditor Tree Adapter] Tree container not found within timeout"),t(null)},5e3)})}function H(e,t){return b=e,o=t,i=v(),i?k():M().then(n=>{n&&(i=n,k(),b&&y()&&E())}),{renew:E,selectTreeNode:N,setTreeNodeTitle:F,getTreeNode:D,getAllTreeNodes:S,setNodeValidationError:I,setNodeChildHasError:A,clearAllValidationErrors:C,getTreeDomElement:_,buildTitleByFormElement:L,getTreeNodeWithinDomElement:q,getTreeNodeIdentifierPathWithinDomElement:x,getParentTreeNodeWithinDomElement:O,getParentTreeNodeIdentifierPathWithinDomElement:R,getSiblingTreeNodeIdentifierPathWithinDomElement:W,renderCompositeFormElementChildsAsSortableList:V,bootstrap:H}}function k(){i&&(i.addEventListener(p.NODE_CLICKED,e=>{const t=e,{identifierPath:n}=t.detail;try{d().publish("view/tree/node/clicked",[n])}catch{}}),i.addEventListener(p.NODE_EDIT,e=>{const t=e,{identifierPath:n}=t.detail;d().publish("view/tree/node/clicked",[n])}),i.addEventListener(p.DND_UPDATE,e=>{const t=e,{movedIdentifierPath:n,previousIdentifierPath:r,nextIdentifierPath:l}=t.detail,m=o?o.querySelector(`[data-id="${n}"]`):null;d().publish("view/tree/dnd/update",[m,n,r,l]),d().publish("view/tree/dnd/stop",[n])}),i.addEventListener(p.DND_CHANGE,e=>{const t=e,{itemIdentifierPath:n,parentIdentifierPath:r,position:l,previousIdentifierPath:m,nextIdentifierPath:P}=t.detail,g=o?o.querySelector(`[data-id="${n}"]`):null,$=a().findEnclosingCompositeFormElementWhichIsNotOnTopLevel(r);d().publish("view/tree/dnd/change",[g,r,$]);let s,c;l==="inside"?(s="inside",c=r):P?(s="before",c=P):m?(s="after",c=m):(s="inside",c=r);try{const f=a().moveFormElement(n,s,c,!1),T=f.get("__identifierPath");f&&g!==null&&g.setAttribute(B.getDomElementDataAttribute("elementIdentifier"),T),d().publish("view/treLine 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!
|
||||
*/
|
||||
function n(t){if(!t)return t;const e=document.createElement("div");return e.innerHTML=t,e.textContent||e.innerText||""}export{n as stripTags};
|
||||
@@ -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{cloneDeep as de}from"lodash-es";import*as k from"@typo3/form/backend/form-editor/tree-component-adapter.js";import*as B from"@typo3/form/backend/form-editor/modals-component.js";import*as F from"@typo3/form/backend/form-editor/inspector-component.js";import*as me from"@typo3/form/backend/form-editor/stage-component.js";import*as N from"@typo3/form/backend/form-editor/helper.js";import y from"@typo3/backend/icons.js";import w from"@typo3/backend/notification.js";import{loadModule as ue}from"@typo3/core/java-script-item-processor.js";const O={domElementClassNames:{formElementIsComposit:"formeditor-element-composit",formElementIsTopLevel:"formeditor-element-toplevel",hasError:"has-error",selectedCompositFormElement:"selected",selectedFormElement:"selected",selectedRootFormElement:"selected",selectedStagePanel:"t3-form-form-stage-selected",sortableHover:"sortable-hover",viewModeAbstract:"formeditor-module-viewmode-abstract",viewModePreview:"formeditor-module-viewmode-preview"},domElementDataAttributeNames:{abstractType:"data-element-abstract-type"},domElementDataAttributeValues:{buttonHeaderClose:"closeButton",buttonHeaderPaginationNext:"buttonPaginationNext",buttonHeaderPaginationPrevious:"buttonPaginationPrevious",buttonHeaderRedo:"redoButton",buttonHeaderSave:"saveButton",buttonHeaderUndo:"undoButton",buttonHeaderViewModeAbstract:"buttonViewModeAbstract",buttonHeaderViewModePreview:"buttonViewModePreview",buttonFormSettings:"formSettings",buttonToggleStructure:"formeditorStructureToggle",buttonExpandInspector:"formeditorInspectorExpand",buttonCollapseInspector:"formeditorInspectorCollapse",buttonNewPage:"newPage",iconMailform:"content-form",iconSave:"actions-document-save",iconSaveSpinner:"spinner-circle",inspectorSection:"inspectorSection",moduleLoadingIndicator:"moduleLoadingIndicator",moduleWrapper:"moduleWrapper",stageArea:"stageArea",stageContainer:"stageContainer",stageContainerInner:"stageContainerInner",stagePanelHeading:"panelHeading",stageSection:"stageSection",structure:"structure-element",structureSection:"structureSection",structureRootContainer:"treeRootContainer",structureRootElement:"treeRootElement"}};let W=!1,I=null,_=null,j=null,z=null,K=null;function u(){return a().getRootFormElement()}function E(e,t,n){return a().assert(e,t,n)}function m(){return a().getUtility()}function v(){return a().getCurrentlySelectedFormElement()}function s(){return a().getPublisherSubscriber()}const ce=/^([0-9]{4})-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])$/i;function V(e){return ce.test(e)}function $(e){const t=e.trim();return t.length>0&&!V(t)}function fe(){a().addPropertyValidationValidator("NotEmpty",function(e,t){const n=e.get(t);if(!n||n===""||Array.isArray(n)&&!n.length)return a().getFormElementPropertyValidatorDefinition("NotEmpty").errorMessage||"invalid value"}),a().addPropertyValidationValidator("Integer",function(e,t){const n=e.get(t);if(n===""||n===null||isNaN(Number(n)))return a().getFormElementPropertyValidatorDefinition("Integer").errorMessage||"invalid value"}),a().addPropertyValidationValidator("IntegerOrEmpty",function(e,t){if(!m().isUndefinedOrNull(e.get(t))&&e.get(t).length>0&&isNaN(Number(e.get(t))))return a().getFormElementPropertyValidatorDefinition("Integer").errorMessage||"invalid value"}),a().addPropertyValidationValidator("NaiveEmail",function(e,t){if(!m().isUndefinedOrNull(e.get(t))&&!e.get(t).match(/\S+@\S+\.\S+/))return a().getFormElementPropertyValidatorDefinition("NaiveEmail").errorMessage||"invalid value"}),a().addPropertyValidationValidator("NaiveEmailOrEmpty",function(e,t){if(!m().isUndefinedOrNull(e.get(t))&&e.get(t).length>0&&!e.get(t).match(/\S+@\S+\.\S+/))return a().getFormElementPropertyValidatorDefinition("NaiveEmailOrEmpty").errorMessage||"invalid value"}),a().addPropertyValidationValidator("FormElementIdentifierWithinCurlyBracesInclusive",function(e,t){if(m().isUndefinedOrNull(e.get(t)))return;const r=/\{([a-z0-9-_]+)?\}/gi.exec(e.get(t));if(r&&(r[1]&&r[1]!=="__currentTimestamp"&&!a().isFormElementIdentifierUsed(r[1])||!r[1]))return a().getFormElementPropertyValidatorDefinition("FormElementIdentifierWithinCurlyBracesInclusive").errorMessage||"invalid value"}),a().addPropertyValidationValidator("FormElementIdentifierWithinCurlyBracesExclusive",function(e,t){if(m().isUndefinedOrNull(e.get(t)))return;const r=/^\{([a-z0-9-_]+)?\}$/i.exec(e.get(t));if(!r||r[1]&&r[1]!=="__currentTimestamp"&&!a().isFormElementIdentifierUsed(r[1])||!r[1])return a().getFormElementPropertyValidatorDefinition("FormElementIdentifierWithinCurlyBracesInclusive").errorMessage||"invalid value"}),a().addPropertyValidationValidator("FileSize",function(e,t){if(!m().isUndefinedOrNull(e.get(t))&&!e.get(t).match(/^(\d*\.?\d+)(B|K|M|G)$/i))return a().getFormElementPropertyValidatorDefinition("FileSize").errorMessage||"invalid value"}),a().addPropertyValidationValidator("RFC3339FullDate",function(e,t){if(m().isUndefinedOrNull(e.get(t)))return;const n=e.get(t);if(!V(n)&&!$(n))return a().getFormElemenLine 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!
|
||||
*/
|
||||
function n(r,t,i){if(typeof r=="function"&&(r=r()!==!1),!r)throw t=t||"Assertion failed",i&&(t=t+" ("+i+")"),typeof Error<"u"?new Error(t):t}class s{constructor(t,i){this.isRunning=!1,this.configuration=t,this.viewModel=i}assert(t,i,e){n(t,i,e)}getPrototypes(){return Array.isArray(this.configuration.selectablePrototypesConfiguration)?this.configuration.selectablePrototypesConfiguration.map(t=>({label:t.label,value:t.identifier})):[]}getTemplatesForPrototype(t){if(n(typeof t=="string",'Invalid parameter "prototypeName"',1475945286),!Array.isArray(this.configuration.selectablePrototypesConfiguration))return[];const i=[];return this.configuration.selectablePrototypesConfiguration.forEach(e=>{Array.isArray(e.newFormTemplates)&&e.identifier===t&&e.newFormTemplates.forEach(a=>{i.push({label:a.label,value:a.templatePath})})}),i}getAccessibleStorageAdapters(){return Array.isArray(this.configuration.accessibleStorageAdapters)?this.configuration.accessibleStorageAdapters:[]}getAccessibleStorageLocationsForAdapter(t){const i=this.configuration.accessibleStorageAdapters?.find(e=>e.typeIdentifier===t.typeIdentifier);return!i||!i.options?.allowedStorageLocations?[]:i.options.allowedStorageLocations}getAjaxEndpoint(t){return n(typeof this.configuration.endpoints[t]<"u","Endpoint "+t+" does not exist",1477506508),this.configuration.endpoints[t]}run(){if(this.isRunning)throw"You can not run the app twice (1475942618)";return this.bootstrap(),this.isRunning=!0,this}viewSetup(){n(typeof this.viewModel.bootstrap=="function",'The view model does not implement the method "bootstrap"',1475942906),this.viewModel.bootstrap(this)}bootstrap(){this.configuration=this.configuration||{},n(typeof this.configuration.endpoints=="object",'Invalid parameter "endpoints"',1477506504),this.viewSetup()}}let o=null;function f(r,t){return o===null&&(o=new s(r,t)),o}export{s as FormManager,n as assert,f as getInstance};
|
||||
@@ -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 t from"@typo3/core/document-service.js";import o from"@typo3/core/event/regular-event.js";class a{constructor(){t.ready().then(()=>{const e=document.getElementById("search_field");if(e!==null){const r=e.value!=="";new o("search",()=>{e.value===""&&r&&e.closest("form").requestSubmit()}).bindTo(e)}})}}var n=new a;export{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 l from"@typo3/backend/modal.js";import h from"@typo3/backend/severity.js";import v from"@typo3/backend/icons.js";import b from"@typo3/backend/notification.js";import z from"@typo3/core/security-utility.js";import M from"@typo3/core/ajax/ajax-request.js";import{AjaxResponse as L}from"@typo3/core/ajax/ajax-response.js";import{SeverityEnum as w}from"@typo3/backend/enum/severity.js";import{topLevelModuleImport as y}from"@typo3/backend/utility/top-level-module-import.js";import{html as k}from"lit";import t from"~labels/form.form_manager_javascript";const u=new z;var f;(function(e){e.newFormModalTrigger='[data-identifier="newForm"]',e.duplicateFormModalTrigger='[data-identifier="duplicateForm"]',e.removeFormModalTrigger='[data-identifier="removeForm"]',e.showReferences='[data-identifier="showReferences"]',e.referenceLink='[data-identifier="referenceLink"]'})(f||(f={}));function S(e){document.querySelectorAll(f.newFormModalTrigger).forEach(r=>{r.addEventListener("click",async c=>{c.preventDefault(),await y("@typo3/form/backend/form-wizard/form-wizard.js");const n=k`<typo3-backend-form-wizard .formManager=${e}></typo3-backend-form-wizard>`;l.advanced({title:t.get("formManager.newFormWizard.step1.title"),content:n,severity:w.notice,size:l.sizes.medium,staticBackdrop:!0,buttons:[]})})})}function T(e){document.querySelectorAll(f.removeFormModalTrigger).forEach(r=>{r.addEventListener("click",async c=>{const n=[];c.preventDefault(),n.push({text:t.get("formManager.cancel"),active:!0,btnClass:"btn-default",name:"cancel",trigger:function(i,o){o.hideModal()}}),n.push({text:t.get("formManager.remove_form"),active:!0,btnClass:"btn-danger",name:"createform",trigger:function(i,o){new M(e.getAjaxEndpoint("delete")).post({formPersistenceIdentifier:r.dataset.formPersistenceIdentifier}).then(async s=>{const d=await s.resolve();d.status==="success"?document.location=d.url:b.error(d.title,d.message),o.hideModal()})}}),l.show(t.get("formManager.remove_form_title"),t.get("formManager.remove_form_message",{0:r.dataset.formName}),h.error,n)})})}function x(e){document.querySelectorAll(f.duplicateFormModalTrigger).forEach(r=>{r.addEventListener("click",async c=>{c.preventDefault(),await y("@typo3/form/backend/form-wizard/form-wizard.js");const n={name:r.dataset.formName,persistenceIdentifier:r.dataset.formPersistenceIdentifier},i=k`<typo3-backend-form-wizard .formManager=${e} .duplicateForm=${n}></typo3-backend-form-wizard>`;l.advanced({title:t.get("formManager.duplicateFormWizard.step1.title",{0:r.dataset.formName}),content:i,severity:w.notice,size:l.sizes.medium,staticBackdrop:!0,buttons:[]})})})}function I(e){document.querySelectorAll(f.showReferences).forEach(r=>{r.addEventListener("click",c=>{c.preventDefault();const n=e.getAjaxEndpoint("references")+"&formPersistenceIdentifier="+r.dataset.formPersistenceIdentifier;new M(n).get().then(async i=>{const o=await i.resolve();let s;const d=[];d.push({text:t.get("formManager.cancel"),active:!0,btnClass:"btn-default",name:"cancel",trigger:function(a,m){m.hideModal()}});const E=o.references.length,F=await v.getIcon("actions-open",v.sizes.small);if(E>0){s='<h2 class="h3">'+t.get("formManager.references.headline")+'</h2><div class="table-fit"><table id="forms" class="table table-striped table-hover"><thead><tr><th class="col-icon"></th><th class="col-recordtitle">'+t.get("formManager.table.field.title")+"</th><th>"+t.get("formManager.table.field.uid")+'</th><th class="col-control nowrap"><span class="visually-hidden">'+t.get("formManager.table.field.control")+"</span></th></tr></thead><tbody>";for(let a=0,m=o.references.length;a<m;++a)s+='<tr><td class="col-icon">'+o.references[a].recordIcon+'</td><td class="col-recordtitle"><a href="'+u.encodeHtml(o.references[a].recordEditUrl)+'" data-identifier="referenceLink">'+u.encodeHtml(o.references[a].recordTitle)+"</a></td><td>"+u.encodeHtml(o.references[a].recordUid)+'</td><td class="col-control"><div class="btn-group" role="group"><a href="'+u.encodeHtml(o.references[a].recordEditUrl)+'" data-identifier="referenceLink" class="btn btn-default" title="'+t.get("formManager.btn.edit.title")+'">'+F+"</a></div></td></tr>";s+="</tbody></table></div>"}else s="<div><h1>"+t.get("formManager.references.title",{0:u.encodeHtml(o.formPersistenceIdentifier)})+"</h1></div><div>"+t.get("formManager.no_references")+"</div>";const g=document.createElement("template");g.innerHTML=s;const p=g.content;p.querySelectorAll(f.referenceLink).forEach(a=>{a.addEventListener("click",m=>{m.preventDefault(),l.currentModal.hideModal(),document.location=m.currentTarget.href})}),l.show(t.get("formManager.references.title",{0:r.dataset.formName}),p,h.notice,d)}).catch(i=>{i instanceof L&&b.error(i.response.statusText,String(i.response.status),2)})})})}function j(e){T(e),S(e),x(e),I(e)}export{j as bootstrap};
|
||||
+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};
|
||||
@@ -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{loadModule as a}from"@typo3/core/java-script-item-processor.js";import r from"@typo3/core/document-service.js";class l{static dispatchFormEditor(o,t){r.ready().then(()=>{Promise.all([a(o.app),a(o.mediator),a(o.viewModel)]).then(e=>((d,i,n)=>{window.TYPO3.FORMEDITOR_APP=d.getInstance(t,i,n).run()})(...e))})}static dispatchFormManager(o,t){r.ready().then(()=>{Promise.all([a(o.app),a(o.viewModel)]).then(e=>((d,i)=>{window.TYPO3.FORMMANAGER_APP=d.getInstance(t,i).run()})(...e))})}}export{l as Helper};
|
||||
Reference in new issue
Block a user