[TASK] Incorporate ES 6 features 49/61649/7
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Mon, 9 Sep 2019 14:37:43 +0000 (16:37 +0200)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Mon, 23 Sep 2019 11:14:32 +0000 (13:14 +0200)
Since the build chain can generate ES6, the TypeScript code should
incorporate these changes.

Namely, this patch changes:
- Use native NodeList over arrays generated by Array.from() where
  possible
- Use explicit string search functions instead of indexOf

Resolves: #89118
Releases: master
Change-Id: I6e03ade35c545ece05ecca222cd1fde876fc22d4
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/61649
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Frank Nägler <frank.naegler@typo3.org>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Susanne Moog <look@susi.dev>
Reviewed-by: Frank Nägler <frank.naegler@typo3.org>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
37 files changed:
Build/Sources/TypeScript/adminpanel/Resources/Public/TypeScript/Modules/Cache.ts
Build/Sources/TypeScript/backend/Resources/Public/TypeScript/ContextMenu.ts
Build/Sources/TypeScript/backend/Resources/Public/TypeScript/ContextMenuActions.ts
Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Event/ConsumerScope.ts
Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Event/TriggerRequest.ts
Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Container/InlineControlContainer.ts
Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/AbstractSortableSelectItems.ts
Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/SelectMultipleSideBySideElement.ts
Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Icons.ts
Build/Sources/TypeScript/backend/Resources/Public/TypeScript/LayoutModule/Paste.ts
Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Modal.ts
Build/Sources/TypeScript/backend/Resources/Public/TypeScript/ModuleMenu.ts
Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Utility.ts
Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Maintenance/Cache.ts
Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Settings/LocalConfiguration.ts
Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Upgrade/UpgradeDocs.ts
Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/LinkBrowser.ts
Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/TelephoneLinkHandler.ts
Build/Sources/TypeScript/workspaces/Resources/Public/TypeScript/Toolbar/WorkspacesMenu.ts
typo3/sysext/adminpanel/Resources/Public/JavaScript/Modules/Cache.js
typo3/sysext/backend/Resources/Public/JavaScript/ContextMenu.js
typo3/sysext/backend/Resources/Public/JavaScript/ContextMenuActions.js
typo3/sysext/backend/Resources/Public/JavaScript/Event/ConsumerScope.js
typo3/sysext/backend/Resources/Public/JavaScript/Event/TriggerRequest.js
typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Container/InlineControlContainer.js
typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/AbstractSortableSelectItems.js
typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/SelectMultipleSideBySideElement.js
typo3/sysext/backend/Resources/Public/JavaScript/Icons.js
typo3/sysext/backend/Resources/Public/JavaScript/LayoutModule/Paste.js
typo3/sysext/backend/Resources/Public/JavaScript/Modal.js
typo3/sysext/backend/Resources/Public/JavaScript/ModuleMenu.js
typo3/sysext/backend/Resources/Public/JavaScript/Utility.js
typo3/sysext/install/Resources/Public/JavaScript/Module/Settings/LocalConfiguration.js
typo3/sysext/install/Resources/Public/JavaScript/Module/Upgrade/UpgradeDocs.js
typo3/sysext/recordlist/Resources/Public/JavaScript/LinkBrowser.js
typo3/sysext/recordlist/Resources/Public/JavaScript/TelephoneLinkHandler.js
typo3/sysext/workspaces/Resources/Public/JavaScript/Toolbar/WorkspacesMenu.js

index b21843f..01d7b87 100644 (file)
@@ -1,9 +1,9 @@
 namespace TYPO3 {
   export class Cache {
-    private buttons: Array<Element>;
+    private buttons: NodeList;
 
     constructor() {
-      this.buttons = Array.from(document.querySelectorAll('[data-typo3-role="clearCacheButton"]'));
+      this.buttons = document.querySelectorAll('[data-typo3-role="clearCacheButton"]');
 
       this.buttons.forEach((element: HTMLElement): void => {
         element.addEventListener('click', (): void => {
index d397e00..6707fd5 100644 (file)
@@ -158,7 +158,7 @@ class ContextMenu {
   private fetch(parameters: string): void {
     let url = TYPO3.settings.ajaxUrls.contextmenu;
     if (parameters) {
-      url += ((url.indexOf('?') === -1) ? '?' : '&') + parameters;
+      url += (!url.includes('?') ? '?' : '&') + parameters;
     }
     $.ajax(url).done((response: MenuItems): void => {
       if (typeof response !== 'undefined' && Object.keys(response).length > 0) {
index f2338bc..765bb7c 100644 (file)
@@ -280,7 +280,7 @@ class ContextMenuActions {
    * @param {string} iframeUrl
    */
   public static triggerRefresh(iframeUrl: string): void {
-    if (iframeUrl.indexOf('record%2Fedit') === -1) {
+    if (!iframeUrl.includes('record%2Fedit')) {
       Viewport.ContentContainer.refresh();
     }
   }
index d6aeb0c..71542d5 100644 (file)
@@ -23,7 +23,7 @@ class ConsumerScope {
   }
 
   public hasConsumer(consumer: Consumable): boolean {
-    return this.consumers.indexOf(consumer) !== -1;
+    return this.consumers.includes(consumer);
   }
 
   public attach(consumer: Consumable): void {
index 433c6fd..e5d46e7 100644 (file)
@@ -33,13 +33,13 @@ class TriggerRequest extends InteractionRequest {
   }
 
   public concernsTypes(types: string[]): boolean {
-    if (types.indexOf(this.type) !== -1) {
+    if (types.includes(this.type)) {
       return true;
     }
     let request: InteractionRequest = this;
     while (request.parentRequest instanceof InteractionRequest) {
       request = request.parentRequest;
-      if (types.indexOf(request.type) !== -1) {
+      if (types.includes(request.type)) {
         return true;
       }
     }
index 1e739bd..75a56d5 100644 (file)
@@ -214,7 +214,7 @@ class InlineControlContainer {
       return;
     }
 
-    const options: Array<HTMLOptionElement> = Array.from(selectElement.querySelectorAll('option'));
+    const options: NodeListOf<HTMLOptionElement> = selectElement.querySelectorAll('option');
     let index: number = -1;
 
     for (let possibleValue of Object.keys(unique.possible)) {
index 8e46d48..c7be22e 100644 (file)
@@ -35,7 +35,7 @@ export abstract class AbstractSortableSelectItems {
    * @param {HTMLSelectElement} fieldElement
    */
   private static moveOptionToBottom(fieldElement: HTMLSelectElement): void {
-    Array.from(fieldElement.querySelectorAll(':checked')).forEach((optionEl: HTMLOptionElement): void => {
+    fieldElement.querySelectorAll(':checked').forEach((optionEl: HTMLOptionElement): void => {
       fieldElement.insertBefore(optionEl, null);
     });
   }
@@ -83,7 +83,7 @@ export abstract class AbstractSortableSelectItems {
    * @param {HTMLSelectElement} availableFieldElement
    */
   private static removeOption(fieldElement: HTMLSelectElement, availableFieldElement: HTMLSelectElement): void {
-    Array.from(fieldElement.querySelectorAll(':checked')).forEach((option: HTMLOptionElement): void => {
+    fieldElement.querySelectorAll(':checked').forEach((option: HTMLOptionElement): void => {
       const originalOption = <HTMLOptionElement>availableFieldElement.querySelector('option[value="' + option.value + '"]');
       if (originalOption !== null) {
         originalOption.classList.remove('hidden');
index d3e2037..d40ecf8 100644 (file)
@@ -40,7 +40,7 @@ class SelectMultipleSideBySideElement extends AbstractSortableSelectItems {
         const exclusiveValues = el.dataset.exclusiveValues;
         const selectedOptions = el.querySelectorAll('option:checked'); // Yep, :checked finds selected options
         if (selectedOptions.length > 0) {
-          Array.from(selectedOptions).forEach((optionElement: HTMLOptionElement): void => {
+          selectedOptions.forEach((optionElement: HTMLOptionElement): void => {
             FormEngine.setSelectOptionFromExternalSource(
               fieldName,
               optionElement.value,
index f414484..d0a7d03 100644 (file)
@@ -122,7 +122,7 @@ class Icons {
           icon: JSON.stringify(icon),
         },
         success: (markup: string) => {
-          if (markup.indexOf('t3js-icon') !== -1 && markup.indexOf('<span class="icon-markup">') !== -1) {
+          if (markup.includes('t3js-icon') && markup.includes('<span class="icon-markup">')) {
             ClientStorage.set('icon_' + cacheIdentifier, markup);
           }
           return markup;
index 422f7f7..52da994 100644 (file)
@@ -138,7 +138,7 @@ class Paste {
       ];
     }
     if (url !== null) {
-      const separator = (url.indexOf('?') > -1) ? '&' : '?';
+      const separator = url.contains('?') ? '&' : '?';
       const params = $.param({data: $element.data()});
       Modal.loadUrl(title, severity, buttons, url + separator + params);
     } else {
index fa0f25b..8602deb 100644 (file)
@@ -344,7 +344,7 @@ class Modal {
         : SeverityEnum.info;
       let url = $element.data('url') || null;
       if (url !== null) {
-        const separator = (url.indexOf('?') > -1) ? '&' : '?';
+        const separator = url.includes('?') ? '&' : '?';
         const params = $.param({data: $element.data()});
         url = url + separator + params;
       }
index dd4673a..e490d06 100644 (file)
@@ -367,7 +367,7 @@ class ModuleMenu {
    * @returns {JQueryDeferred<TriggerRequest>}
    */
   private openInNavFrame(url: string, params: string, interactionRequest: InteractionRequest): JQueryDeferred<TriggerRequest> {
-    const navUrl = url + (params ? (url.indexOf('?') !== -1 ? '&' : '?') + params : '');
+    const navUrl = url + (params ? (url.includes('?') ? '&' : '?') + params : '');
     const currentUrl = Viewport.NavigationContainer.getUrl();
     const deferred = Viewport.NavigationContainer.setUrl(
       url,
@@ -401,7 +401,7 @@ class ModuleMenu {
       );
       top.nextLoadModuleUrl = '';
     } else {
-      const urlToLoad = url + (params ? (url.indexOf('?') !== -1 ? '&' : '?') + params : '');
+      const urlToLoad = url + (params ? (url.includes('?') ? '&' : '?') + params : '');
       deferred = Viewport.ContentContainer.setUrl(
         urlToLoad,
         new TriggerRequest('typo3.openInContentFrame', interactionRequest),
index 367a396..f898f26 100644 (file)
@@ -91,7 +91,7 @@ class Utility {
    */
   public static updateQueryStringParameter(url: string, key: string, value: string): string {
     const re = new RegExp('([?&])' + key + '=.*?(&|$)', 'i');
-    const separator = url.indexOf('?') !== -1 ? '&' : '?';
+    const separator = url.includes('?') ? '&' : '?';
 
     if (url.match(re)) {
       return url.replace(re, '$1' + key + '=' + value + '$2');
index 4f27786..0333c3f 100644 (file)
@@ -30,9 +30,9 @@ class Cache implements InlineModuleInterface {
       success: (data: any): void => {
         if (data.success === true && Array.isArray(data.status)) {
           if (data.status.length > 0) {
-            data.status.forEach(((element: any): void => {
+            data.status.forEach((element: any): void => {
               Notification.success(element.title, element.message);
-            }));
+            });
           }
         } else {
           Notification.error('Something went wrong clearing caches');
index 43e518d..95e0f26 100644 (file)
@@ -46,7 +46,7 @@ class LocalConfiguration extends AbstractInteractableModule {
     // Make jquerys "contains" work case-insensitive
     jQuery.expr[':'].contains = jQuery.expr.createPseudo((arg: any): Function => {
       return (elem: any): boolean => {
-        return jQuery(elem).text().toUpperCase().indexOf(arg.toUpperCase()) >= 0;
+        return jQuery(elem).text().toUpperCase().includes(arg.toUpperCase());
       };
     });
 
index 086f283..3d28939 100644 (file)
@@ -68,7 +68,7 @@ class UpgradeDocs extends AbstractInteractableModule {
     // Make jquerys "contains" work case-insensitive
     jQuery.expr[':'].contains = jQuery.expr.createPseudo((arg: any): Function => {
       return (elem: any): boolean => {
-        return jQuery(elem).text().toUpperCase().indexOf(arg.toUpperCase()) >= 0;
+        return jQuery(elem).text().toUpperCase().includes(arg.toUpperCase());
       };
     });
 
@@ -207,7 +207,7 @@ class UpgradeDocs extends AbstractInteractableModule {
       const andTags: Array<string> = [];
       $.each(this.chosenField.val(), (index: number, item: any): void => {
         const tagFilter = '[data-item-tags*="' + item + '"]';
-        if (item.indexOf(':') > 0) {
+        if (item.contains(':', 1)) {
           orTags.push(tagFilter);
         } else {
           andTags.push(tagFilter);
index e36e51b..a7b3252 100644 (file)
@@ -74,7 +74,7 @@ class LinkBrowser {
       if (obj.hasOwnProperty(p)) {
         const k: string = prefix ? prefix + '[' + p + ']' : p;
         const v: any = obj[p];
-        if (url.indexOf(k + '=') === -1) {
+        if (!url.includes(k + '=')) {
           str.push(
             typeof v === 'object'
               ? this.encodeGetParameters(v, k, url)
index f57be98..c74e5df 100644 (file)
@@ -29,7 +29,7 @@ class TelephoneLinkHandler {
         if (value === 'tel:') {
           return;
         }
-        if (value.indexOf('tel:') === 0) {
+        if (value.startsWith('tel:')) {
           value = value.substr(4);
         }
 
index 8fdad54..1027668 100644 (file)
@@ -142,12 +142,12 @@ class WorkspacesMenu {
         if (response.pageId) {
           top.fsMod.recentIds.web = response.pageId;
           let url = TYPO3.Backend.ContentContainer.getUrl();
-          url += (url.indexOf('?') === -1 ? '?' : '&') + '&id=' + response.pageId;
+          url += (!url.includes('?') ? '?' : '&') + '&id=' + response.pageId;
           WorkspacesMenu.refreshPageTree();
           Viewport.ContentContainer.setUrl(url);
 
           // when in web module reload, otherwise send the user to the web module
-        } else if (top.currentModuleLoaded.indexOf('web_') === 0) {
+        } else if (top.currentModuleLoaded.startsWith('web_')) {
           WorkspacesMenu.refreshPageTree();
           ModuleMenu.App.reloadFrames();
         } else if (TYPO3.configuration.pageModule) {
index 338c523..35d9771 100644 (file)
@@ -10,4 +10,4 @@
  *
  * The TYPO3 project - inspiring people to share!
  */
-"use strict";var TYPO3;!function(t){t.Cache=class{constructor(){this.buttons=Array.from(document.querySelectorAll('[data-typo3-role="clearCacheButton"]')),this.buttons.forEach(t=>{t.addEventListener("click",()=>{let e=t.dataset.typo3AjaxUrl,o=new XMLHttpRequest;o.open("GET",e),o.send(),o.onload=(()=>{location.reload()})})})}}}(TYPO3||(TYPO3={})),window.addEventListener("load",()=>new TYPO3.Cache,!1);
\ No newline at end of file
+"use strict";var TYPO3;!function(t){t.Cache=class{constructor(){this.buttons=document.querySelectorAll('[data-typo3-role="clearCacheButton"]'),this.buttons.forEach(t=>{t.addEventListener("click",()=>{let e=t.dataset.typo3AjaxUrl,o=new XMLHttpRequest;o.open("GET",e),o.send(),o.onload=(()=>{location.reload()})})})}}}(TYPO3||(TYPO3={})),window.addEventListener("load",()=>new TYPO3.Cache,!1);
\ No newline at end of file
index 5334ed6..6b79661 100644 (file)
@@ -10,4 +10,4 @@
  *
  * The TYPO3 project - inspiring people to share!
  */
-define(["require","exports","jquery","./ContextMenuActions"],function(t,e,i,n){"use strict";class s{constructor(){this.mousePos={X:null,Y:null},this.delayContextMenuHide=!1,this.record={uid:null,table:null},this.storeMousePositionEvent=(t=>{this.mousePos={X:t.pageX,Y:t.pageY},this.mouseOutFromMenu("#contentMenu0"),this.mouseOutFromMenu("#contentMenu1")}),this.initializeEvents()}static drawActionItem(t){const e=t.additionalAttributes||{};let i="";for(let t in e)e.hasOwnProperty(t)&&(i+=" "+t+'="'+e[t]+'"');return'<a class="list-group-item" data-callback-action="'+t.callbackAction+'"'+i+'><span class="list-group-item-icon">'+t.icon+"</span> "+t.label+"</a>"}static within(t,e,i){const n=t.offset();return i>=n.top&&i<n.top+t.height()&&e>=n.left&&e<n.left+t.width()}static initializeContextMenuContainer(){if(0===i("#contentMenu0").length){const t='<div id="contentMenu0" class="context-menu"></div><div id="contentMenu1" class="context-menu" style="display: block;"></div>';i("body").append(t)}}initializeEvents(){i(document).on("click contextmenu",".t3js-contextmenutrigger",t=>{const e=i(t.currentTarget);e.prop("onclick")&&"click"===t.type||(t.preventDefault(),this.show(e.data("table"),e.data("uid"),e.data("context"),e.data("iteminfo"),e.data("parameters")))}),i(document).on("mousemove",this.storeMousePositionEvent)}show(t,e,i,n,s){this.record={table:t,uid:e};let o="";void 0!==t&&(o+="table="+encodeURIComponent(t)),void 0!==e&&(o+=(o.length>0?"&":"")+"uid="+e),void 0!==i&&(o+=(o.length>0?"&":"")+"context="+i),void 0!==n&&(o+=(o.length>0?"&":"")+"enDisItems="+n),void 0!==s&&(o+=(o.length>0?"&":"")+"addParams="+s),this.fetch(o)}fetch(t){let e=TYPO3.settings.ajaxUrls.contextmenu;t&&(e+=(-1===e.indexOf("?")?"?":"&")+t),i.ajax(e).done(t=>{void 0!==t&&Object.keys(t).length>0&&this.populateData(t,0)})}populateData(e,o){s.initializeContextMenuContainer();const l=i("#contentMenu"+o);if(l.length&&(0===o||i("#contentMenu"+(o-1)).is(":visible"))){const s=this.drawMenu(e,o);l.html('<div class="list-group">'+s+"</div>"),i("a.list-group-item",l).click(e=>{e.preventDefault();const s=i(e.currentTarget);if(s.hasClass("list-group-item-submenu"))return void this.openSubmenu(o,s);const l=s.data("callback-action"),a=s.data("callback-module");s.data("callback-module")?t([a],t=>{t[l].bind(s)(this.record.table,this.record.uid)}):n&&"function"==typeof n[l]?n[l].bind(s)(this.record.table,this.record.uid):console.log("action: "+l+" not found"),this.hideAll()}),l.css(this.getPosition(l)).show()}}openSubmenu(t,e){const n=i("#contentMenu"+(t+1)).html("");e.next().find(".list-group").clone(!0).appendTo(n),n.css(this.getPosition(n)).show()}getPosition(t){let e=this.mousePos.X,n=this.mousePos.Y;const s=i(window).width()-20,o=i(window).height(),l=t.width(),a=t.height(),c=this.mousePos.X-i(document).scrollLeft(),u=this.mousePos.Y-i(document).scrollTop();return o-a<u&&(u>a?n-=a-10:n+=o-a-u),s-l<c&&(c>l?e-=l-10:s-l-c<i(document).scrollLeft()?e=i(document).scrollLeft():e+=s-l-c),{left:e+"px",top:n+"px"}}drawMenu(t,e){let i="";for(let n in t)if(t.hasOwnProperty(n)){const o=t[n];if("item"===o.type)i+=s.drawActionItem(o);else if("divider"===o.type)i+='<a class="list-group-item list-group-item-divider"></a>';else if("submenu"===o.type||o.childItems){i+='<a class="list-group-item list-group-item-submenu"><span class="list-group-item-icon">'+o.icon+"</span> "+o.label+'&nbsp;&nbsp;<span class="fa fa-caret-right"></span></a>',i+='<div class="context-menu contentMenu'+(e+1)+'" style="display:none;"><div class="list-group">'+this.drawMenu(o.childItems,1)+"</div></div>"}}return i}mouseOutFromMenu(t){const e=i(t);e.length>0&&e.is(":visible")&&!s.within(e,this.mousePos.X,this.mousePos.Y)?this.hide(t):e.length>0&&e.is(":visible")&&(this.delayContextMenuHide=!0)}hide(t){this.delayContextMenuHide=!1,window.setTimeout(()=>{this.delayContextMenuHide||i(t).hide()},500)}hideAll(){this.hide("#contentMenu0"),this.hide("#contentMenu1")}}return new s});
\ No newline at end of file
+define(["require","exports","jquery","./ContextMenuActions"],function(t,e,i,n){"use strict";class s{constructor(){this.mousePos={X:null,Y:null},this.delayContextMenuHide=!1,this.record={uid:null,table:null},this.storeMousePositionEvent=(t=>{this.mousePos={X:t.pageX,Y:t.pageY},this.mouseOutFromMenu("#contentMenu0"),this.mouseOutFromMenu("#contentMenu1")}),this.initializeEvents()}static drawActionItem(t){const e=t.additionalAttributes||{};let i="";for(let t in e)e.hasOwnProperty(t)&&(i+=" "+t+'="'+e[t]+'"');return'<a class="list-group-item" data-callback-action="'+t.callbackAction+'"'+i+'><span class="list-group-item-icon">'+t.icon+"</span> "+t.label+"</a>"}static within(t,e,i){const n=t.offset();return i>=n.top&&i<n.top+t.height()&&e>=n.left&&e<n.left+t.width()}static initializeContextMenuContainer(){if(0===i("#contentMenu0").length){const t='<div id="contentMenu0" class="context-menu"></div><div id="contentMenu1" class="context-menu" style="display: block;"></div>';i("body").append(t)}}initializeEvents(){i(document).on("click contextmenu",".t3js-contextmenutrigger",t=>{const e=i(t.currentTarget);e.prop("onclick")&&"click"===t.type||(t.preventDefault(),this.show(e.data("table"),e.data("uid"),e.data("context"),e.data("iteminfo"),e.data("parameters")))}),i(document).on("mousemove",this.storeMousePositionEvent)}show(t,e,i,n,s){this.record={table:t,uid:e};let o="";void 0!==t&&(o+="table="+encodeURIComponent(t)),void 0!==e&&(o+=(o.length>0?"&":"")+"uid="+e),void 0!==i&&(o+=(o.length>0?"&":"")+"context="+i),void 0!==n&&(o+=(o.length>0?"&":"")+"enDisItems="+n),void 0!==s&&(o+=(o.length>0?"&":"")+"addParams="+s),this.fetch(o)}fetch(t){let e=TYPO3.settings.ajaxUrls.contextmenu;t&&(e+=(e.includes("?")?"&":"?")+t),i.ajax(e).done(t=>{void 0!==t&&Object.keys(t).length>0&&this.populateData(t,0)})}populateData(e,o){s.initializeContextMenuContainer();const l=i("#contentMenu"+o);if(l.length&&(0===o||i("#contentMenu"+(o-1)).is(":visible"))){const s=this.drawMenu(e,o);l.html('<div class="list-group">'+s+"</div>"),i("a.list-group-item",l).click(e=>{e.preventDefault();const s=i(e.currentTarget);if(s.hasClass("list-group-item-submenu"))return void this.openSubmenu(o,s);const l=s.data("callback-action"),a=s.data("callback-module");s.data("callback-module")?t([a],t=>{t[l].bind(s)(this.record.table,this.record.uid)}):n&&"function"==typeof n[l]?n[l].bind(s)(this.record.table,this.record.uid):console.log("action: "+l+" not found"),this.hideAll()}),l.css(this.getPosition(l)).show()}}openSubmenu(t,e){const n=i("#contentMenu"+(t+1)).html("");e.next().find(".list-group").clone(!0).appendTo(n),n.css(this.getPosition(n)).show()}getPosition(t){let e=this.mousePos.X,n=this.mousePos.Y;const s=i(window).width()-20,o=i(window).height(),l=t.width(),a=t.height(),c=this.mousePos.X-i(document).scrollLeft(),u=this.mousePos.Y-i(document).scrollTop();return o-a<u&&(u>a?n-=a-10:n+=o-a-u),s-l<c&&(c>l?e-=l-10:s-l-c<i(document).scrollLeft()?e=i(document).scrollLeft():e+=s-l-c),{left:e+"px",top:n+"px"}}drawMenu(t,e){let i="";for(let n in t)if(t.hasOwnProperty(n)){const o=t[n];if("item"===o.type)i+=s.drawActionItem(o);else if("divider"===o.type)i+='<a class="list-group-item list-group-item-divider"></a>';else if("submenu"===o.type||o.childItems){i+='<a class="list-group-item list-group-item-submenu"><span class="list-group-item-icon">'+o.icon+"</span> "+o.label+'&nbsp;&nbsp;<span class="fa fa-caret-right"></span></a>',i+='<div class="context-menu contentMenu'+(e+1)+'" style="display:none;"><div class="list-group">'+this.drawMenu(o.childItems,1)+"</div></div>"}}return i}mouseOutFromMenu(t){const e=i(t);e.length>0&&e.is(":visible")&&!s.within(e,this.mousePos.X,this.mousePos.Y)?this.hide(t):e.length>0&&e.is(":visible")&&(this.delayContextMenuHide=!0)}hide(t){this.delayContextMenuHide=!1,window.setTimeout(()=>{this.delayContextMenuHide||i(t).hide()},500)}hideAll(){this.hide("#contentMenu0"),this.hide("#contentMenu1")}}return new s});
\ No newline at end of file
index c6b46d6..b073ecc 100644 (file)
@@ -10,4 +10,4 @@
  *
  * The TYPO3 project - inspiring people to share!
  */
-define(["require","exports","./Enum/Severity","jquery","./InfoWindow","./Modal","./ModuleMenu","./Viewport","TYPO3/CMS/Backend/Notification"],function(e,t,n,a,r,o,i,s,l){"use strict";class c{static getReturnUrl(){return encodeURIComponent(top.list_frame.document.location.pathname+top.list_frame.document.location.search)}static editRecord(e,t){let n="",r=a(this).data("pages-language-uid");r&&(n="&overrideVals[pages][sys_language_uid]="+r),s.ContentContainer.setUrl(top.TYPO3.settings.FormEngine.moduleUrl+"&edit["+e+"]["+t+"]=edit"+n+"&returnUrl="+c.getReturnUrl())}static viewRecord(e,t){const n=a(this).data("preview-url");if(n){window.open(n,"newTYPO3frontendWindow").focus()}}static openInfoPopUp(e,t){r.showItem(e,t)}static mountAsTreeRoot(e,t){"pages"===e&&s.NavigationContainer.PageTree.setTemporaryMountPoint(t)}static newPageWizard(e,t){s.ContentContainer.setUrl(top.TYPO3.settings.NewRecord.moduleUrl+"&id="+t+"&pagesOnly=1&returnUrl="+c.getReturnUrl())}static newContentWizard(e,t){const r=a(this);let i=r.data("new-wizard-url");i&&(i+="&returnUrl="+c.getReturnUrl(),o.advanced({title:r.data("title"),type:o.types.ajax,size:o.sizes.medium,content:i,severity:n.SeverityEnum.notice}))}static newRecord(e,t){s.ContentContainer.setUrl(top.TYPO3.settings.FormEngine.moduleUrl+"&edit["+e+"][-"+t+"]=new&returnUrl="+c.getReturnUrl())}static openHistoryPopUp(e,t){s.ContentContainer.setUrl(top.TYPO3.settings.RecordHistory.moduleUrl+"&element="+e+":"+t+"&returnUrl="+c.getReturnUrl())}static openListModule(e,t){const n="pages"===e?t:a(this).data("page-uid");i.App.showModule("web_list","id="+n)}static pagesSort(e,t){const n=a(this).data("pages-sort-url");n&&s.ContentContainer.setUrl(n)}static pagesNewMultiple(e,t){const n=a(this).data("pages-new-multiple-url");n&&s.ContentContainer.setUrl(n)}static disableRecord(e,t){s.ContentContainer.setUrl(top.TYPO3.settings.RecordCommit.moduleUrl+"&data["+e+"]["+t+"][hidden]=1&redirect="+c.getReturnUrl()).done(()=>{s.NavigationContainer.PageTree.refreshTree()})}static enableRecord(e,t){s.ContentContainer.setUrl(top.TYPO3.settings.RecordCommit.moduleUrl+"&data["+e+"]["+t+"][hidden]=0&redirect="+c.getReturnUrl()).done(()=>{s.NavigationContainer.PageTree.refreshTree()})}static deleteRecord(e,t){const r=a(this);o.confirm(r.data("title"),r.data("message"),n.SeverityEnum.warning,[{text:a(this).data("button-close-text")||TYPO3.lang["button.cancel"]||"Cancel",active:!0,btnClass:"btn-default",name:"cancel"},{text:a(this).data("button-ok-text")||TYPO3.lang["button.delete"]||"Delete",btnClass:"btn-warning",name:"delete"}]).on("button.clicked",n=>{if("delete"===n.target.getAttribute("name")){const n=top.TYPO3.settings.RecordCommit.moduleUrl+"&cmd["+e+"]["+t+"][delete]=1";a.ajax({url:n,success:()=>{if("pages"===e&&s.NavigationContainer.PageTree){if(t===top.fsMod.recentIds.web){let e=s.NavigationContainer.PageTree.getFirstNode();s.NavigationContainer.PageTree.selectNode(e)}s.NavigationContainer.PageTree.refreshTree()}}})}o.dismiss()})}static copy(e,t){const n=TYPO3.settings.ajaxUrls.contextmenu_clipboard+"&CB[el]["+e+"%7C"+t+"]=1&CB[setCopyMode]=1";a.ajax(n).always(()=>{c.triggerRefresh(s.ContentContainer.get().location.href)})}static clipboardRelease(e,t){const n=TYPO3.settings.ajaxUrls.contextmenu_clipboard+"&CB[el]["+e+"%7C"+t+"]=0";a.ajax(n).always(()=>{c.triggerRefresh(s.ContentContainer.get().location.href)})}static cut(e,t){const n=TYPO3.settings.ajaxUrls.contextmenu_clipboard+"&CB[el]["+e+"%7C"+t+"]=1&CB[setCopyMode]=0";a.ajax(n).always(()=>{c.triggerRefresh(s.ContentContainer.get().location.href)})}static triggerRefresh(e){-1===e.indexOf("record%2Fedit")&&s.ContentContainer.refresh()}static clearCache(e,t){a.ajax({url:TYPO3.settings.ajaxUrls.web_list_clearpagecache+"&id="+t,cache:!1,dataType:"json",success:e=>{!0===e.success?l.success(e.title,e.message,1):l.error(e.title,e.message,1)},error:()=>{l.error("Clearing page caches went wrong on the server side.")}})}static pasteAfter(e,t){c.pasteInto.bind(a(this))(e,-t)}static pasteInto(e,t){const r=a(this),i=()=>{const n="&CB[paste]="+e+"%7C"+t+"&CB[pad]=normal&redirect="+c.getReturnUrl();s.ContentContainer.setUrl(top.TYPO3.settings.RecordCommit.moduleUrl+n).done(()=>{"pages"===e&&s.NavigationContainer.PageTree&&s.NavigationContainer.PageTree.refreshTree()})};r.data("title")?o.confirm(r.data("title"),r.data("message"),n.SeverityEnum.warning,[{text:a(this).data("button-close-text")||TYPO3.lang["button.cancel"]||"Cancel",active:!0,btnClass:"btn-default",name:"cancel"},{text:a(this).data("button-ok-text")||TYPO3.lang["button.ok"]||"OK",btnClass:"btn-warning",name:"ok"}]).on("button.clicked",e=>{"ok"===e.target.getAttribute("name")&&i(),o.dismiss()}):i()}}return c});
\ No newline at end of file
+define(["require","exports","./Enum/Severity","jquery","./InfoWindow","./Modal","./ModuleMenu","./Viewport","TYPO3/CMS/Backend/Notification"],function(e,t,n,a,r,o,i,s,l){"use strict";class c{static getReturnUrl(){return encodeURIComponent(top.list_frame.document.location.pathname+top.list_frame.document.location.search)}static editRecord(e,t){let n="",r=a(this).data("pages-language-uid");r&&(n="&overrideVals[pages][sys_language_uid]="+r),s.ContentContainer.setUrl(top.TYPO3.settings.FormEngine.moduleUrl+"&edit["+e+"]["+t+"]=edit"+n+"&returnUrl="+c.getReturnUrl())}static viewRecord(e,t){const n=a(this).data("preview-url");if(n){window.open(n,"newTYPO3frontendWindow").focus()}}static openInfoPopUp(e,t){r.showItem(e,t)}static mountAsTreeRoot(e,t){"pages"===e&&s.NavigationContainer.PageTree.setTemporaryMountPoint(t)}static newPageWizard(e,t){s.ContentContainer.setUrl(top.TYPO3.settings.NewRecord.moduleUrl+"&id="+t+"&pagesOnly=1&returnUrl="+c.getReturnUrl())}static newContentWizard(e,t){const r=a(this);let i=r.data("new-wizard-url");i&&(i+="&returnUrl="+c.getReturnUrl(),o.advanced({title:r.data("title"),type:o.types.ajax,size:o.sizes.medium,content:i,severity:n.SeverityEnum.notice}))}static newRecord(e,t){s.ContentContainer.setUrl(top.TYPO3.settings.FormEngine.moduleUrl+"&edit["+e+"][-"+t+"]=new&returnUrl="+c.getReturnUrl())}static openHistoryPopUp(e,t){s.ContentContainer.setUrl(top.TYPO3.settings.RecordHistory.moduleUrl+"&element="+e+":"+t+"&returnUrl="+c.getReturnUrl())}static openListModule(e,t){const n="pages"===e?t:a(this).data("page-uid");i.App.showModule("web_list","id="+n)}static pagesSort(e,t){const n=a(this).data("pages-sort-url");n&&s.ContentContainer.setUrl(n)}static pagesNewMultiple(e,t){const n=a(this).data("pages-new-multiple-url");n&&s.ContentContainer.setUrl(n)}static disableRecord(e,t){s.ContentContainer.setUrl(top.TYPO3.settings.RecordCommit.moduleUrl+"&data["+e+"]["+t+"][hidden]=1&redirect="+c.getReturnUrl()).done(()=>{s.NavigationContainer.PageTree.refreshTree()})}static enableRecord(e,t){s.ContentContainer.setUrl(top.TYPO3.settings.RecordCommit.moduleUrl+"&data["+e+"]["+t+"][hidden]=0&redirect="+c.getReturnUrl()).done(()=>{s.NavigationContainer.PageTree.refreshTree()})}static deleteRecord(e,t){const r=a(this);o.confirm(r.data("title"),r.data("message"),n.SeverityEnum.warning,[{text:a(this).data("button-close-text")||TYPO3.lang["button.cancel"]||"Cancel",active:!0,btnClass:"btn-default",name:"cancel"},{text:a(this).data("button-ok-text")||TYPO3.lang["button.delete"]||"Delete",btnClass:"btn-warning",name:"delete"}]).on("button.clicked",n=>{if("delete"===n.target.getAttribute("name")){const n=top.TYPO3.settings.RecordCommit.moduleUrl+"&cmd["+e+"]["+t+"][delete]=1";a.ajax({url:n,success:()=>{if("pages"===e&&s.NavigationContainer.PageTree){if(t===top.fsMod.recentIds.web){let e=s.NavigationContainer.PageTree.getFirstNode();s.NavigationContainer.PageTree.selectNode(e)}s.NavigationContainer.PageTree.refreshTree()}}})}o.dismiss()})}static copy(e,t){const n=TYPO3.settings.ajaxUrls.contextmenu_clipboard+"&CB[el]["+e+"%7C"+t+"]=1&CB[setCopyMode]=1";a.ajax(n).always(()=>{c.triggerRefresh(s.ContentContainer.get().location.href)})}static clipboardRelease(e,t){const n=TYPO3.settings.ajaxUrls.contextmenu_clipboard+"&CB[el]["+e+"%7C"+t+"]=0";a.ajax(n).always(()=>{c.triggerRefresh(s.ContentContainer.get().location.href)})}static cut(e,t){const n=TYPO3.settings.ajaxUrls.contextmenu_clipboard+"&CB[el]["+e+"%7C"+t+"]=1&CB[setCopyMode]=0";a.ajax(n).always(()=>{c.triggerRefresh(s.ContentContainer.get().location.href)})}static triggerRefresh(e){e.includes("record%2Fedit")||s.ContentContainer.refresh()}static clearCache(e,t){a.ajax({url:TYPO3.settings.ajaxUrls.web_list_clearpagecache+"&id="+t,cache:!1,dataType:"json",success:e=>{!0===e.success?l.success(e.title,e.message,1):l.error(e.title,e.message,1)},error:()=>{l.error("Clearing page caches went wrong on the server side.")}})}static pasteAfter(e,t){c.pasteInto.bind(a(this))(e,-t)}static pasteInto(e,t){const r=a(this),i=()=>{const n="&CB[paste]="+e+"%7C"+t+"&CB[pad]=normal&redirect="+c.getReturnUrl();s.ContentContainer.setUrl(top.TYPO3.settings.RecordCommit.moduleUrl+n).done(()=>{"pages"===e&&s.NavigationContainer.PageTree&&s.NavigationContainer.PageTree.refreshTree()})};r.data("title")?o.confirm(r.data("title"),r.data("message"),n.SeverityEnum.warning,[{text:a(this).data("button-close-text")||TYPO3.lang["button.cancel"]||"Cancel",active:!0,btnClass:"btn-default",name:"cancel"},{text:a(this).data("button-ok-text")||TYPO3.lang["button.ok"]||"OK",btnClass:"btn-warning",name:"ok"}]).on("button.clicked",e=>{"ok"===e.target.getAttribute("name")&&i(),o.dismiss()}):i()}}return c});
\ No newline at end of file
index 26fcc5a..023d5a9 100644 (file)
@@ -10,4 +10,4 @@
  *
  * The TYPO3 project - inspiring people to share!
  */
-define(["require","exports","jquery"],function(s,e,r){"use strict";return new class{constructor(){this.consumers=[]}getConsumers(){return this.consumers}hasConsumer(s){return-1!==this.consumers.indexOf(s)}attach(s){this.hasConsumer(s)||this.consumers.push(s)}detach(s){this.consumers=this.consumers.filter(e=>e!==s)}invoke(s){const e=[];return this.consumers.forEach(r=>{const n=r.consume.call(r,s);n&&e.push(n)}),r.when.apply(r,e)}}});
\ No newline at end of file
+define(["require","exports","jquery"],function(s,e,r){"use strict";return new class{constructor(){this.consumers=[]}getConsumers(){return this.consumers}hasConsumer(s){return this.consumers.includes(s)}attach(s){this.hasConsumer(s)||this.consumers.push(s)}detach(s){this.consumers=this.consumers.filter(e=>e!==s)}invoke(s){const e=[];return this.consumers.forEach(r=>{const n=r.consume.call(r,s);n&&e.push(n)}),r.when.apply(r,e)}}});
\ No newline at end of file
index 33916e6..8e4bb18 100644 (file)
@@ -10,4 +10,4 @@
  *
  * The TYPO3 project - inspiring people to share!
  */
-define(["require","exports","./InteractionRequest"],function(e,t,r){"use strict";return class extends r{constructor(e,t=null){super(e,t)}concerns(e){if(this===e)return!0;let t=this;for(;t.parentRequest instanceof r;)if((t=t.parentRequest)===e)return!0;return!1}concernsTypes(e){if(-1!==e.indexOf(this.type))return!0;let t=this;for(;t.parentRequest instanceof r;)if(t=t.parentRequest,-1!==e.indexOf(t.type))return!0;return!1}}});
\ No newline at end of file
+define(["require","exports","./InteractionRequest"],function(e,t,r){"use strict";return class extends r{constructor(e,t=null){super(e,t)}concerns(e){if(this===e)return!0;let t=this;for(;t.parentRequest instanceof r;)if((t=t.parentRequest)===e)return!0;return!1}concernsTypes(e){if(e.includes(this.type))return!0;let t=this;for(;t.parentRequest instanceof r;)if(t=t.parentRequest,e.includes(t.type))return!0;return!1}}});
\ No newline at end of file
index afeaf47..6fff5a8 100644 (file)
@@ -10,4 +10,4 @@
  *
  * The TYPO3 project - inspiring people to share!
  */
-define(["require","exports","./../InlineRelation/AjaxDispatcher","../../Utility/MessageUtility","jquery","TYPO3/CMS/Backend/FormEngine","TYPO3/CMS/Backend/FormEngineValidation","../../Icons","../../InfoWindow","../../Modal","../../Notification","nprogress","../../Severity","Sortable","../../Utility"],function(e,t,n,i,o,r,a,s,l,c,d,u,g,h,p){"use strict";var m,f,b,v;!function(e){e.toggleSelector='[data-toggle="formengine-inline"]',e.controlSectionSelector=".t3js-formengine-irre-control",e.createNewRecordButtonSelector=".t3js-create-new-button",e.createNewRecordBySelectorSelector=".t3js-create-new-selector",e.deleteRecordButtonSelector=".t3js-editform-delete-inline-record",e.enableDisableRecordButtonSelector=".t3js-toggle-visibility-button",e.infoWindowButton='[data-action="infowindow"]',e.synchronizeLocalizeRecordButtonSelector=".t3js-synchronizelocalize-button",e.uniqueValueSelectors="select.t3js-inline-unique",e.revertUniqueness=".t3js-revert-unique",e.controlContainerButtons=".t3js-inline-controls"}(m||(m={})),function(e){e.new="inlineIsNewRecord",e.visible="panel-visible",e.collapsed="panel-collapsed"}(f||(f={})),function(e){e.structureSeparator="-"}(b||(b={})),function(e){e.DOWN="down",e.UP="up"}(v||(v={}));class S{constructor(e){this.container=null,this.ajaxDispatcher=null,this.appearance=null,this.xhrQueue={},this.progessQueue={},this.noTitleString=TYPO3.lang?TYPO3.lang["FormEngine.noRecordTitle"]:"[No title]",this.handlePostMessage=(e=>{if(!i.MessageUtility.verifyOrigin(e.origin))throw"Denied message sent by "+e.origin;if(void 0===e.data.objectGroup)throw"No object group defined for message";e.data.objectGroup===this.container.dataset.objectGroup&&(this.isUniqueElementUsed(parseInt(e.data.uid,10),e.data.table)?d.error("There is already a relation to the selected element"):this.importRecord([e.data.objectGroup,e.data.uid]))}),o(()=>{this.container=document.querySelector("#"+e),this.ajaxDispatcher=new n.AjaxDispatcher(this.container.dataset.objectGroup),this.registerEvents()})}static getDelegatedEventTarget(e,t){let n;return null===(n=e.closest(t))&&e.matches(t)&&(n=e),n}static getInlineRecordContainer(e){return document.querySelector('[data-object-id="'+e+'"]')}static registerInfoButton(e){let t;null!==(t=S.getDelegatedEventTarget(e.target,m.infoWindowButton))&&(e.preventDefault(),e.stopImmediatePropagation(),l.showItem(t.dataset.infoTable,t.dataset.infoUid))}static toggleElement(e){const t=S.getInlineRecordContainer(e);t.classList.contains(f.collapsed)?(t.classList.remove(f.collapsed),t.classList.add(f.visible)):(t.classList.remove(f.visible),t.classList.add(f.collapsed))}static isNewRecord(e){return S.getInlineRecordContainer(e).classList.contains(f.new)}static updateExpandedCollapsedStateLocally(e,t){const n=S.getInlineRecordContainer(e),i="uc[inlineView]["+n.dataset.topmostParentTable+"]["+n.dataset.topmostParentUid+"]"+n.dataset.fieldName,o=document.getElementsByName(i);o.length&&(o[0].value=t?"1":"0")}static getValuesFromHashMap(e){return Object.keys(e).map(t=>e[t])}static selectOptionValueExists(e,t){return null!==e.querySelector('option[value="'+t+'"]')}static removeSelectOptionByValue(e,t){const n=e.querySelector('option[value="'+t+'"]');null!==n&&n.remove()}static reAddSelectOption(e,t,n){if(S.selectOptionValueExists(e,t))return;const i=Array.from(e.querySelectorAll("option"));let o=-1;for(let e of Object.keys(n.possible)){if(e===t)break;for(let t=0;t<i.length;++t){if(i[t].value===e){o=t;break}}}-1===o?o=0:o<i.length&&o++;const r=document.createElement("option");r.text=n.possible[t],r.value=t,e.insertBefore(r,e.options[o])}registerEvents(){if(this.container.addEventListener("click",e=>{this.registerToggle(e),this.registerSort(e),this.registerCreateRecordButton(e),this.registerEnableDisableButton(e),S.registerInfoButton(e),this.registerDeleteButton(e),this.registerSynchronizeLocalize(e),this.registerRevertUniquenessAction(e)}),this.container.addEventListener("change",e=>{this.registerCreateRecordBySelector(e),this.registerUniqueSelectFieldChanged(e)}),window.addEventListener("message",this.handlePostMessage),this.getAppearance().useSortable){const e=document.querySelector("#"+this.container.getAttribute("id")+"_records");new h(e,{group:e.getAttribute("id"),handle:".sortableHandle",onSort:()=>{this.updateSorting()}})}}registerToggle(e){if(S.getDelegatedEventTarget(e.target,m.controlSectionSelector))return;let t;null!==(t=S.getDelegatedEventTarget(e.target,m.toggleSelector))&&(e.preventDefault(),e.stopImmediatePropagation(),this.loadRecordDetails(t.parentElement.dataset.objectId))}registerSort(e){let t;null!==(t=S.getDelegatedEventTarget(e.target,m.controlSectionSelector+' [data-action="sort"]'))&&(e.preventDefault(),e.stopImmediatePropagation(),this.changeSortingByButton(t.closest("[data-object-id]").dataset.objectId,t.dataset.direction))}registerCreateRecordButton(e){let t;if(null!==(t=S.getDelegatedEventTarget(e.target,m.createNewRecordButtonSelector))&&(e.preventDefault(),e.stopImmediatePropagation(),this.isBelowMax())){let e=this.container.dataset.objectGroup;void 0!==t.dataset.recordUid&&(e+=b.structureSeparator+t.dataset.recordUid),this.importRecord([e],t.dataset.recordUid)}}registerCreateRecordBySelector(e){let t;if(null===(t=S.getDelegatedEventTarget(e.target,m.createNewRecordBySelectorSelector)))return;e.preventDefault(),e.stopImmediatePropagation();const n=t,i=n.options[n.selectedIndex].getAttribute("value");this.importRecord([this.container.dataset.objectGroup,i])}createRecord(e,t,n=null,i=null){let o=this.container.dataset.objectGroup;null!==n&&(o+=b.structureSeparator+n),null!==n?(S.getInlineRecordContainer(o).insertAdjacentHTML("afterend",t),this.memorizeAddRecord(e,n,i)):(document.querySelector("#"+this.container.getAttribute("id")+"_records").insertAdjacentHTML("beforeend",t),this.memorizeAddRecord(e,null,i))}importRecord(e,t){this.ajaxDispatcher.send(this.ajaxDispatcher.newRequest(this.ajaxDispatcher.getEndpoint("record_inline_create")).withContext().withParams(e)).done(e=>{this.isBelowMax()&&(this.createRecord(e.compilerInput.uid,e.data,void 0!==t?t:null,void 0!==e.compilerInput.childChildUid?e.compilerInput.childChildUid:null),r.reinitialize(),r.Validation.initializeInputFields(),r.Validation.validate())})}registerEnableDisableButton(e){let t;if(null===(t=S.getDelegatedEventTarget(e.target,m.enableDisableRecordButtonSelector)))return;e.preventDefault(),e.stopImmediatePropagation();const n=t.closest("[data-object-id]").dataset.objectId,i=S.getInlineRecordContainer(n),o="data"+i.dataset.fieldName+"["+t.dataset.hiddenField+"]",r=document.querySelector('[data-formengine-input-name="'+o+'"'),a=document.querySelector('[name="'+o+'"');null!==r&&null!==a&&(r.checked=!r.checked,a.value=r.checked?"1":"0",TBE_EDITOR.fieldChanged_fName(o,o));const l="t3-form-field-container-inline-hidden";let c="";i.classList.contains(l)?(c="actions-edit-hide",i.classList.remove(l)):(c="actions-edit-unhide",i.classList.add(l)),s.getIcon(c,s.sizes.small).done(e=>{t.replaceChild(document.createRange().createContextualFragment(e),t.querySelector(".t3js-icon"))})}registerDeleteButton(e){let t;if(null===(t=S.getDelegatedEventTarget(e.target,m.deleteRecordButtonSelector)))return;e.preventDefault(),e.stopImmediatePropagation();const n=TYPO3.lang["label.confirm.delete_record.title"]||"Delete this record?",i=TYPO3.lang["label.confirm.delete_record.content"]||"Are you sure you want to delete this record?";c.confirm(n,i,g.warning,[{text:TYPO3.lang["buttons.confirm.delete_record.no"]||"Cancel",active:!0,btnClass:"btn-default",name:"no"},{text:TYPO3.lang["buttons.confirm.delete_record.yes"]||"Yes, delete this record",btnClass:"btn-warning",name:"yes"}]).on("button.clicked",e=>{if("yes"===e.target.name){const e=t.closest("[data-object-id]").dataset.objectId;this.deleteRecord(e)}c.dismiss()})}registerSynchronizeLocalize(e){let t;if(null===(t=S.getDelegatedEventTarget(e.target,m.synchronizeLocalizeRecordButtonSelector)))return;this.ajaxDispatcher.send(this.ajaxDispatcher.newRequest(this.ajaxDispatcher.getEndpoint("record_inline_synchronizelocalize")).withContext().withParams([this.container.dataset.objectGroup,t.dataset.type])).done(e=>{document.querySelector("#"+this.container.getAttribute("id")+"_records").insertAdjacentHTML("beforeend",e.data);const t=this.container.dataset.objectGroup+b.structureSeparator;for(let n of e.compilerInput.delete)this.deleteRecord(t+n,!0);for(let n of e.compilerInput.localize){if(void 0!==n.remove){const e=S.getInlineRecordContainer(t+n.remove);e.parentElement.removeChild(e)}this.memorizeAddRecord(n.uid,null,n.selectedValue)}})}registerUniqueSelectFieldChanged(e){let t;if(null===(t=S.getDelegatedEventTarget(e.target,m.uniqueValueSelectors)))return;const n=t.closest("[data-object-id]");if(null!==n){const e=n.dataset.objectId,i=n.dataset.objectUid;this.handleChangedField(t,e);const o=this.getFormFieldForElements();if(null===o)return;this.updateUnique(t,o,i)}}registerRevertUniquenessAction(e){let t;null!==(t=S.getDelegatedEventTarget(e.target,m.revertUniqueness))&&this.revertUnique(t.dataset.uid)}loadRecordDetails(e){const t=document.querySelector("#"+e+"_fields"),n=void 0!==this.xhrQueue[e];if(null!==t&&"\x3c!--notloaded--\x3e"!==t.innerHTML.substr(0,16))this.collapseExpandRecord(e);else{const i=this.getProgress(e);if(n)this.xhrQueue[e].abort(),delete this.xhrQueue[e],delete this.progessQueue[e],i.done();else{const n=this.ajaxDispatcher.send(this.ajaxDispatcher.newRequest(this.ajaxDispatcher.getEndpoint("record_inline_details")).withContext().withParams([e]));n.done(n=>{if(delete this.xhrQueue[e],delete this.progessQueue[e],t.innerHTML=n.data,this.collapseExpandRecord(e),i.done(),r.reinitialize(),r.Validation.initializeInputFields(),r.Validation.validate(),this.hasObjectGroupDefinedUniqueConstraints()){const t=S.getInlineRecordContainer(e);this.removeUsed(t)}}),this.xhrQueue[e]=n,i.start()}}}collapseExpandRecord(e){const t=S.getInlineRecordContainer(e),n=!0===this.getAppearance().expandSingle,i=t.classList.contains(f.collapsed);let o=[];const r=[];n&&i&&(o=this.collapseAllRecords(t.dataset.objectUid)),S.toggleElement(e),S.isNewRecord(e)?S.updateExpandedCollapsedStateLocally(e,i):i?r.push(t.dataset.objectUid):i||o.push(t.dataset.objectUid),this.ajaxDispatcher.send(this.ajaxDispatcher.newRequest(this.ajaxDispatcher.getEndpoint("record_inline_expandcollapse")).withContext().withParams([e,r.join(","),o.join(",")]))}memorizeAddRecord(e,t=null,n=null){const i=this.getFormFieldForElements();if(null===i)return;let r=p.trimExplode(",",i.value);if(t){const n=[];for(let i=0;i<r.length;i++)r[i].length&&n.push(r[i]),t===r[i]&&n.push(e);r=n}else r.push(e);i.value=r.join(","),i.classList.add("has-change"),o(document).trigger("change"),this.redrawSortingButtons(this.container.dataset.objectGroup,r),this.setUnique(e,n),this.isBelowMax()||this.toggleContainerControls(!1),TBE_EDITOR.fieldChanged_fName(i.name,i)}memorizeRemoveRecord(e){const t=this.getFormFieldForElements();if(null===t)return[];let n=p.trimExplode(",",t.value);const i=n.indexOf(e);return i>-1&&(delete n[i],t.value=n.join(","),t.classList.add("has-change"),o(document).trigger("change"),this.redrawSortingButtons(this.container.dataset.objectGroup,n)),n}changeSortingByButton(e,t){const n=S.getInlineRecordContainer(e),i=n.dataset.objectUid,o=document.querySelector("#"+this.container.getAttribute("id")+"_records"),r=Array.from(o.children).map(e=>e.dataset.objectUid);let a=r.indexOf(i),s=!1;if(t===v.UP&&a>0?(r[a]=r[a-1],r[a-1]=i,s=!0):t===v.DOWN&&a<r.length-1&&(r[a]=r[a+1],r[a+1]=i,s=!0),s){const e=this.container.dataset.objectGroup+b.structureSeparator,i=t===v.UP?1:0;n.parentElement.insertBefore(S.getInlineRecordContainer(e+r[a-i]),S.getInlineRecordContainer(e+r[a+1-i])),this.updateSorting()}}updateSorting(){const e=this.getFormFieldForElements();if(null===e)return;const t=document.querySelector("#"+this.container.getAttribute("id")+"_records"),n=Array.from(t.children).map(e=>e.dataset.objectUid);e.value=n.join(","),e.classList.add("has-change"),o(document).trigger("inline:sorting-changed"),o(document).trigger("change"),this.redrawSortingButtons(this.container.dataset.objectGroup,n)}deleteRecord(e,t=!1){const n=S.getInlineRecordContainer(e),i=n.dataset.objectUid;if(n.classList.add("t3js-inline-record-deleted"),!S.isNewRecord(e)&&!t){const e=this.container.querySelector('[name="cmd'+n.dataset.fieldName+'[delete]"]');e.removeAttribute("disabled"),n.parentElement.insertAdjacentElement("afterbegin",e)}n.addEventListener("transitionend",()=>{n.parentElement.removeChild(n),a.validate()}),this.revertUnique(i),this.memorizeRemoveRecord(i),n.classList.add("form-irre-object--deleted"),this.isBelowMax()&&this.toggleContainerControls(!0)}toggleContainerControls(e){const t=this.container.querySelector(m.controlContainerButtons);null!==t&&(t.style.display=e?"block":"none")}getProgress(e){const t="#"+e+"_header";let n;return void 0!==this.progessQueue[e]?n=this.progessQueue[e]:((n=u).configure({parent:t,showSpinner:!1}),this.progessQueue[e]=n),n}collapseAllRecords(e){const t=this.getFormFieldForElements(),n=[];if(null!==t){const i=p.trimExplode(",",t.value);for(let t of i){if(t===e)continue;const i=this.container.dataset.objectGroup+b.structureSeparator+t,o=S.getInlineRecordContainer(i);o.classList.contains(f.visible)&&(o.classList.remove(f.visible),o.classList.add(f.collapsed),S.isNewRecord(i)?S.updateExpandedCollapsedStateLocally(i,!1):n.push(t))}}return n}getFormFieldForElements(){const e=document.getElementsByName(this.container.dataset.formField);return e.length>0?e[0]:null}redrawSortingButtons(e,t=[]){if(0===t.length){const e=this.getFormFieldForElements();null!==e&&(t=p.trimExplode(",",e.value))}0!==t.length&&t.forEach((n,i)=>{const o="#"+e+b.structureSeparator+n+"_header",r=document.querySelector(o),a=r.querySelector('[data-action="sort"][data-direction="'+v.UP+'"]');if(null!==a){let e="actions-move-up";0===i?(a.classList.add("disabled"),e="empty-empty"):a.classList.remove("disabled"),s.getIcon(e,s.sizes.small).done(e=>{a.replaceChild(document.createRange().createContextualFragment(e),a.querySelector(".t3js-icon"))})}const l=r.querySelector('[data-action="sort"][data-direction="'+v.DOWN+'"]');if(null!==l){let e="actions-move-down";i===t.length-1?(l.classList.add("disabled"),e="empty-empty"):l.classList.remove("disabled"),s.getIcon(e,s.sizes.small).done(e=>{l.replaceChild(document.createRange().createContextualFragment(e),l.querySelector(".t3js-icon"))})}})}isBelowMax(){const e=this.getFormFieldForElements();if(null===e)return!0;if(void 0!==TYPO3.settings.FormEngineInline.config[this.container.dataset.objectGroup]){if(p.trimExplode(",",e.value).length>=TYPO3.settings.FormEngineInline.config[this.container.dataset.objectGroup].max)return!1;if(this.hasObjectGroupDefinedUniqueConstraints()){const e=TYPO3.settings.FormEngineInline.unique[this.container.dataset.objectGroup];if(e.used.length>=e.max&&e.max>=0)return!1}}return!0}isUniqueElementUsed(e,t){if(!this.hasObjectGroupDefinedUniqueConstraints())return!1;const n=TYPO3.settings.FormEngineInline.unique[this.container.dataset.objectGroup],i=S.getValuesFromHashMap(n.used);if("select"===n.type&&-1!==i.indexOf(e))return!0;if("groupdb"===n.type)for(let n=i.length-1;n>=0;n--)if(i[n].table===t&&i[n].uid===e)return!0;return!1}removeUsed(e){if(!this.hasObjectGroupDefinedUniqueConstraints())return;const t=TYPO3.settings.FormEngineInline.unique[this.container.dataset.objectGroup];if("select"!==t.type)return;let n=e.querySelector('[name="data['+t.table+"]["+e.dataset.objectUid+"]["+t.field+']"]');const i=S.getValuesFromHashMap(t.used);if(null!==n){const e=n.options[n.selectedIndex].value;for(let t=0;t<i.length;t++)i[t]!==e&&S.removeSelectOptionByValue(n,i[t])}}setUnique(e,t){if(!this.hasObjectGroupDefinedUniqueConstraints())return;const n=document.querySelector("#"+this.container.dataset.objectGroup+"_selector"),i=TYPO3.settings.FormEngineInline.unique[this.container.dataset.objectGroup];if("select"===i.type){if(!i.selector||-1!==i.max){const o=this.getFormFieldForElements(),r=this.container.dataset.objectGroup+b.structureSeparator+e;let a=S.getInlineRecordContainer(r).querySelector('[name="data['+i.table+"]["+e+"]["+i.field+']"]');const s=S.getValuesFromHashMap(i.used);if(null!==n){if(null!==a){for(let e=0;e<s.length;e++)S.removeSelectOptionByValue(a,s[e]);i.selector||(t=a.options[0].value,a.options[0].selected=!0,this.updateUnique(a,o,e),this.handleChangedField(a,this.container.dataset.objectGroup+"["+e+"]"))}for(let e=0;e<s.length;e++)S.removeSelectOptionByValue(a,s[e]);void 0!==i.used.length&&(i.used={}),i.used[e]={table:i.elTable,uid:t}}if(null!==o&&S.selectOptionValueExists(n,t)){const n=p.trimExplode(",",o.value);for(let o=0;o<n.length;o++)null!==(a=document.querySelector('[name="data['+i.table+"]["+n[o]+"]["+i.field+']"]'))&&n[o]!==e&&S.removeSelectOptionByValue(a,t)}}}else"groupdb"===i.type&&(i.used[e]={table:i.elTable,uid:t});"select"===i.selector&&S.selectOptionValueExists(n,t)&&(S.removeSelectOptionByValue(n,t),i.used[e]={table:i.elTable,uid:t})}updateUnique(e,t,n){if(!this.hasObjectGroupDefinedUniqueConstraints())return;const i=TYPO3.settings.FormEngineInline.unique[this.container.dataset.objectGroup],o=i.used[n];if("select"===i.selector){const t=document.querySelector("#"+this.container.dataset.objectGroup+"_selector");S.removeSelectOptionByValue(t,e.value),void 0!==o&&S.reAddSelectOption(t,o,i)}if(i.selector&&-1===i.max)return;if(!i||null===t)return;const r=p.trimExplode(",",t.value);let a;for(let t=0;t<r.length;t++)null!==(a=document.querySelector('[name="data['+i.table+"]["+r[t]+"]["+i.field+']"]'))&&a!==e&&(S.removeSelectOptionByValue(a,e.value),void 0!==o&&S.reAddSelectOption(a,o,i));i.used[n]=e.value}revertUnique(e){if(!this.hasObjectGroupDefinedUniqueConstraints())return;const t=TYPO3.settings.FormEngineInline.unique[this.container.dataset.objectGroup],n=this.container.dataset.objectGroup+b.structureSeparator+e,i=S.getInlineRecordContainer(n);let o=i.querySelector('[name="data['+t.table+"]["+i.dataset.objectUid+"]["+t.field+']"]');if("select"===t.type){let n;if(null!==o)n=o.value;else{if(""===i.dataset.tableUniqueOriginalValue)return;n=i.dataset.tableUniqueOriginalValue}if("select"===t.selector&&!isNaN(parseInt(n,10))){const e=document.querySelector("#"+this.container.dataset.objectGroup+"_selector");S.reAddSelectOption(e,n,t)}if(t.selector&&-1===t.max)return;const r=this.getFormFieldForElements();if(null===r)return;const a=p.trimExplode(",",r.value);let s;for(let e=0;e<a.length;e++)null!==(s=document.querySelector('[name="data['+t.table+"]["+a[e]+"]["+t.field+']"]'))&&S.reAddSelectOption(s,n,t);delete t.used[e]}else"groupdb"===t.type&&delete t.used[e]}hasObjectGroupDefinedUniqueConstraints(){return void 0!==TYPO3.settings.FormEngineInline.unique&&void 0!==TYPO3.settings.FormEngineInline.unique[this.container.dataset.objectGroup]}handleChangedField(e,t){let n;n=e instanceof HTMLSelectElement?e.options[e.selectedIndex].text:e.value,document.querySelector("#"+t+"_label").textContent=n.length?n:this.noTitleString}getAppearance(){if(null===this.appearance&&(this.appearance={},"string"==typeof this.container.dataset.appearance))try{this.appearance=JSON.parse(this.container.dataset.appearance)}catch(e){console.error(e)}return this.appearance}}return S});
\ No newline at end of file
+define(["require","exports","./../InlineRelation/AjaxDispatcher","../../Utility/MessageUtility","jquery","TYPO3/CMS/Backend/FormEngine","TYPO3/CMS/Backend/FormEngineValidation","../../Icons","../../InfoWindow","../../Modal","../../Notification","nprogress","../../Severity","Sortable","../../Utility"],function(e,t,n,i,o,r,a,s,l,c,d,u,g,h,p){"use strict";var m,f,b,v;!function(e){e.toggleSelector='[data-toggle="formengine-inline"]',e.controlSectionSelector=".t3js-formengine-irre-control",e.createNewRecordButtonSelector=".t3js-create-new-button",e.createNewRecordBySelectorSelector=".t3js-create-new-selector",e.deleteRecordButtonSelector=".t3js-editform-delete-inline-record",e.enableDisableRecordButtonSelector=".t3js-toggle-visibility-button",e.infoWindowButton='[data-action="infowindow"]',e.synchronizeLocalizeRecordButtonSelector=".t3js-synchronizelocalize-button",e.uniqueValueSelectors="select.t3js-inline-unique",e.revertUniqueness=".t3js-revert-unique",e.controlContainerButtons=".t3js-inline-controls"}(m||(m={})),function(e){e.new="inlineIsNewRecord",e.visible="panel-visible",e.collapsed="panel-collapsed"}(f||(f={})),function(e){e.structureSeparator="-"}(b||(b={})),function(e){e.DOWN="down",e.UP="up"}(v||(v={}));class S{constructor(e){this.container=null,this.ajaxDispatcher=null,this.appearance=null,this.xhrQueue={},this.progessQueue={},this.noTitleString=TYPO3.lang?TYPO3.lang["FormEngine.noRecordTitle"]:"[No title]",this.handlePostMessage=(e=>{if(!i.MessageUtility.verifyOrigin(e.origin))throw"Denied message sent by "+e.origin;if(void 0===e.data.objectGroup)throw"No object group defined for message";e.data.objectGroup===this.container.dataset.objectGroup&&(this.isUniqueElementUsed(parseInt(e.data.uid,10),e.data.table)?d.error("There is already a relation to the selected element"):this.importRecord([e.data.objectGroup,e.data.uid]))}),o(()=>{this.container=document.querySelector("#"+e),this.ajaxDispatcher=new n.AjaxDispatcher(this.container.dataset.objectGroup),this.registerEvents()})}static getDelegatedEventTarget(e,t){let n;return null===(n=e.closest(t))&&e.matches(t)&&(n=e),n}static getInlineRecordContainer(e){return document.querySelector('[data-object-id="'+e+'"]')}static registerInfoButton(e){let t;null!==(t=S.getDelegatedEventTarget(e.target,m.infoWindowButton))&&(e.preventDefault(),e.stopImmediatePropagation(),l.showItem(t.dataset.infoTable,t.dataset.infoUid))}static toggleElement(e){const t=S.getInlineRecordContainer(e);t.classList.contains(f.collapsed)?(t.classList.remove(f.collapsed),t.classList.add(f.visible)):(t.classList.remove(f.visible),t.classList.add(f.collapsed))}static isNewRecord(e){return S.getInlineRecordContainer(e).classList.contains(f.new)}static updateExpandedCollapsedStateLocally(e,t){const n=S.getInlineRecordContainer(e),i="uc[inlineView]["+n.dataset.topmostParentTable+"]["+n.dataset.topmostParentUid+"]"+n.dataset.fieldName,o=document.getElementsByName(i);o.length&&(o[0].value=t?"1":"0")}static getValuesFromHashMap(e){return Object.keys(e).map(t=>e[t])}static selectOptionValueExists(e,t){return null!==e.querySelector('option[value="'+t+'"]')}static removeSelectOptionByValue(e,t){const n=e.querySelector('option[value="'+t+'"]');null!==n&&n.remove()}static reAddSelectOption(e,t,n){if(S.selectOptionValueExists(e,t))return;const i=e.querySelectorAll("option");let o=-1;for(let e of Object.keys(n.possible)){if(e===t)break;for(let t=0;t<i.length;++t){if(i[t].value===e){o=t;break}}}-1===o?o=0:o<i.length&&o++;const r=document.createElement("option");r.text=n.possible[t],r.value=t,e.insertBefore(r,e.options[o])}registerEvents(){if(this.container.addEventListener("click",e=>{this.registerToggle(e),this.registerSort(e),this.registerCreateRecordButton(e),this.registerEnableDisableButton(e),S.registerInfoButton(e),this.registerDeleteButton(e),this.registerSynchronizeLocalize(e),this.registerRevertUniquenessAction(e)}),this.container.addEventListener("change",e=>{this.registerCreateRecordBySelector(e),this.registerUniqueSelectFieldChanged(e)}),window.addEventListener("message",this.handlePostMessage),this.getAppearance().useSortable){const e=document.querySelector("#"+this.container.getAttribute("id")+"_records");new h(e,{group:e.getAttribute("id"),handle:".sortableHandle",onSort:()=>{this.updateSorting()}})}}registerToggle(e){if(S.getDelegatedEventTarget(e.target,m.controlSectionSelector))return;let t;null!==(t=S.getDelegatedEventTarget(e.target,m.toggleSelector))&&(e.preventDefault(),e.stopImmediatePropagation(),this.loadRecordDetails(t.parentElement.dataset.objectId))}registerSort(e){let t;null!==(t=S.getDelegatedEventTarget(e.target,m.controlSectionSelector+' [data-action="sort"]'))&&(e.preventDefault(),e.stopImmediatePropagation(),this.changeSortingByButton(t.closest("[data-object-id]").dataset.objectId,t.dataset.direction))}registerCreateRecordButton(e){let t;if(null!==(t=S.getDelegatedEventTarget(e.target,m.createNewRecordButtonSelector))&&(e.preventDefault(),e.stopImmediatePropagation(),this.isBelowMax())){let e=this.container.dataset.objectGroup;void 0!==t.dataset.recordUid&&(e+=b.structureSeparator+t.dataset.recordUid),this.importRecord([e],t.dataset.recordUid)}}registerCreateRecordBySelector(e){let t;if(null===(t=S.getDelegatedEventTarget(e.target,m.createNewRecordBySelectorSelector)))return;e.preventDefault(),e.stopImmediatePropagation();const n=t,i=n.options[n.selectedIndex].getAttribute("value");this.importRecord([this.container.dataset.objectGroup,i])}createRecord(e,t,n=null,i=null){let o=this.container.dataset.objectGroup;null!==n&&(o+=b.structureSeparator+n),null!==n?(S.getInlineRecordContainer(o).insertAdjacentHTML("afterend",t),this.memorizeAddRecord(e,n,i)):(document.querySelector("#"+this.container.getAttribute("id")+"_records").insertAdjacentHTML("beforeend",t),this.memorizeAddRecord(e,null,i))}importRecord(e,t){this.ajaxDispatcher.send(this.ajaxDispatcher.newRequest(this.ajaxDispatcher.getEndpoint("record_inline_create")).withContext().withParams(e)).done(e=>{this.isBelowMax()&&(this.createRecord(e.compilerInput.uid,e.data,void 0!==t?t:null,void 0!==e.compilerInput.childChildUid?e.compilerInput.childChildUid:null),r.reinitialize(),r.Validation.initializeInputFields(),r.Validation.validate())})}registerEnableDisableButton(e){let t;if(null===(t=S.getDelegatedEventTarget(e.target,m.enableDisableRecordButtonSelector)))return;e.preventDefault(),e.stopImmediatePropagation();const n=t.closest("[data-object-id]").dataset.objectId,i=S.getInlineRecordContainer(n),o="data"+i.dataset.fieldName+"["+t.dataset.hiddenField+"]",r=document.querySelector('[data-formengine-input-name="'+o+'"'),a=document.querySelector('[name="'+o+'"');null!==r&&null!==a&&(r.checked=!r.checked,a.value=r.checked?"1":"0",TBE_EDITOR.fieldChanged_fName(o,o));const l="t3-form-field-container-inline-hidden";let c="";i.classList.contains(l)?(c="actions-edit-hide",i.classList.remove(l)):(c="actions-edit-unhide",i.classList.add(l)),s.getIcon(c,s.sizes.small).done(e=>{t.replaceChild(document.createRange().createContextualFragment(e),t.querySelector(".t3js-icon"))})}registerDeleteButton(e){let t;if(null===(t=S.getDelegatedEventTarget(e.target,m.deleteRecordButtonSelector)))return;e.preventDefault(),e.stopImmediatePropagation();const n=TYPO3.lang["label.confirm.delete_record.title"]||"Delete this record?",i=TYPO3.lang["label.confirm.delete_record.content"]||"Are you sure you want to delete this record?";c.confirm(n,i,g.warning,[{text:TYPO3.lang["buttons.confirm.delete_record.no"]||"Cancel",active:!0,btnClass:"btn-default",name:"no"},{text:TYPO3.lang["buttons.confirm.delete_record.yes"]||"Yes, delete this record",btnClass:"btn-warning",name:"yes"}]).on("button.clicked",e=>{if("yes"===e.target.name){const e=t.closest("[data-object-id]").dataset.objectId;this.deleteRecord(e)}c.dismiss()})}registerSynchronizeLocalize(e){let t;if(null===(t=S.getDelegatedEventTarget(e.target,m.synchronizeLocalizeRecordButtonSelector)))return;this.ajaxDispatcher.send(this.ajaxDispatcher.newRequest(this.ajaxDispatcher.getEndpoint("record_inline_synchronizelocalize")).withContext().withParams([this.container.dataset.objectGroup,t.dataset.type])).done(e=>{document.querySelector("#"+this.container.getAttribute("id")+"_records").insertAdjacentHTML("beforeend",e.data);const t=this.container.dataset.objectGroup+b.structureSeparator;for(let n of e.compilerInput.delete)this.deleteRecord(t+n,!0);for(let n of e.compilerInput.localize){if(void 0!==n.remove){const e=S.getInlineRecordContainer(t+n.remove);e.parentElement.removeChild(e)}this.memorizeAddRecord(n.uid,null,n.selectedValue)}})}registerUniqueSelectFieldChanged(e){let t;if(null===(t=S.getDelegatedEventTarget(e.target,m.uniqueValueSelectors)))return;const n=t.closest("[data-object-id]");if(null!==n){const e=n.dataset.objectId,i=n.dataset.objectUid;this.handleChangedField(t,e);const o=this.getFormFieldForElements();if(null===o)return;this.updateUnique(t,o,i)}}registerRevertUniquenessAction(e){let t;null!==(t=S.getDelegatedEventTarget(e.target,m.revertUniqueness))&&this.revertUnique(t.dataset.uid)}loadRecordDetails(e){const t=document.querySelector("#"+e+"_fields"),n=void 0!==this.xhrQueue[e];if(null!==t&&"\x3c!--notloaded--\x3e"!==t.innerHTML.substr(0,16))this.collapseExpandRecord(e);else{const i=this.getProgress(e);if(n)this.xhrQueue[e].abort(),delete this.xhrQueue[e],delete this.progessQueue[e],i.done();else{const n=this.ajaxDispatcher.send(this.ajaxDispatcher.newRequest(this.ajaxDispatcher.getEndpoint("record_inline_details")).withContext().withParams([e]));n.done(n=>{if(delete this.xhrQueue[e],delete this.progessQueue[e],t.innerHTML=n.data,this.collapseExpandRecord(e),i.done(),r.reinitialize(),r.Validation.initializeInputFields(),r.Validation.validate(),this.hasObjectGroupDefinedUniqueConstraints()){const t=S.getInlineRecordContainer(e);this.removeUsed(t)}}),this.xhrQueue[e]=n,i.start()}}}collapseExpandRecord(e){const t=S.getInlineRecordContainer(e),n=!0===this.getAppearance().expandSingle,i=t.classList.contains(f.collapsed);let o=[];const r=[];n&&i&&(o=this.collapseAllRecords(t.dataset.objectUid)),S.toggleElement(e),S.isNewRecord(e)?S.updateExpandedCollapsedStateLocally(e,i):i?r.push(t.dataset.objectUid):i||o.push(t.dataset.objectUid),this.ajaxDispatcher.send(this.ajaxDispatcher.newRequest(this.ajaxDispatcher.getEndpoint("record_inline_expandcollapse")).withContext().withParams([e,r.join(","),o.join(",")]))}memorizeAddRecord(e,t=null,n=null){const i=this.getFormFieldForElements();if(null===i)return;let r=p.trimExplode(",",i.value);if(t){const n=[];for(let i=0;i<r.length;i++)r[i].length&&n.push(r[i]),t===r[i]&&n.push(e);r=n}else r.push(e);i.value=r.join(","),i.classList.add("has-change"),o(document).trigger("change"),this.redrawSortingButtons(this.container.dataset.objectGroup,r),this.setUnique(e,n),this.isBelowMax()||this.toggleContainerControls(!1),TBE_EDITOR.fieldChanged_fName(i.name,i)}memorizeRemoveRecord(e){const t=this.getFormFieldForElements();if(null===t)return[];let n=p.trimExplode(",",t.value);const i=n.indexOf(e);return i>-1&&(delete n[i],t.value=n.join(","),t.classList.add("has-change"),o(document).trigger("change"),this.redrawSortingButtons(this.container.dataset.objectGroup,n)),n}changeSortingByButton(e,t){const n=S.getInlineRecordContainer(e),i=n.dataset.objectUid,o=document.querySelector("#"+this.container.getAttribute("id")+"_records"),r=Array.from(o.children).map(e=>e.dataset.objectUid);let a=r.indexOf(i),s=!1;if(t===v.UP&&a>0?(r[a]=r[a-1],r[a-1]=i,s=!0):t===v.DOWN&&a<r.length-1&&(r[a]=r[a+1],r[a+1]=i,s=!0),s){const e=this.container.dataset.objectGroup+b.structureSeparator,i=t===v.UP?1:0;n.parentElement.insertBefore(S.getInlineRecordContainer(e+r[a-i]),S.getInlineRecordContainer(e+r[a+1-i])),this.updateSorting()}}updateSorting(){const e=this.getFormFieldForElements();if(null===e)return;const t=document.querySelector("#"+this.container.getAttribute("id")+"_records"),n=Array.from(t.children).map(e=>e.dataset.objectUid);e.value=n.join(","),e.classList.add("has-change"),o(document).trigger("inline:sorting-changed"),o(document).trigger("change"),this.redrawSortingButtons(this.container.dataset.objectGroup,n)}deleteRecord(e,t=!1){const n=S.getInlineRecordContainer(e),i=n.dataset.objectUid;if(n.classList.add("t3js-inline-record-deleted"),!S.isNewRecord(e)&&!t){const e=this.container.querySelector('[name="cmd'+n.dataset.fieldName+'[delete]"]');e.removeAttribute("disabled"),n.parentElement.insertAdjacentElement("afterbegin",e)}n.addEventListener("transitionend",()=>{n.parentElement.removeChild(n),a.validate()}),this.revertUnique(i),this.memorizeRemoveRecord(i),n.classList.add("form-irre-object--deleted"),this.isBelowMax()&&this.toggleContainerControls(!0)}toggleContainerControls(e){const t=this.container.querySelector(m.controlContainerButtons);null!==t&&(t.style.display=e?"block":"none")}getProgress(e){const t="#"+e+"_header";let n;return void 0!==this.progessQueue[e]?n=this.progessQueue[e]:((n=u).configure({parent:t,showSpinner:!1}),this.progessQueue[e]=n),n}collapseAllRecords(e){const t=this.getFormFieldForElements(),n=[];if(null!==t){const i=p.trimExplode(",",t.value);for(let t of i){if(t===e)continue;const i=this.container.dataset.objectGroup+b.structureSeparator+t,o=S.getInlineRecordContainer(i);o.classList.contains(f.visible)&&(o.classList.remove(f.visible),o.classList.add(f.collapsed),S.isNewRecord(i)?S.updateExpandedCollapsedStateLocally(i,!1):n.push(t))}}return n}getFormFieldForElements(){const e=document.getElementsByName(this.container.dataset.formField);return e.length>0?e[0]:null}redrawSortingButtons(e,t=[]){if(0===t.length){const e=this.getFormFieldForElements();null!==e&&(t=p.trimExplode(",",e.value))}0!==t.length&&t.forEach((n,i)=>{const o="#"+e+b.structureSeparator+n+"_header",r=document.querySelector(o),a=r.querySelector('[data-action="sort"][data-direction="'+v.UP+'"]');if(null!==a){let e="actions-move-up";0===i?(a.classList.add("disabled"),e="empty-empty"):a.classList.remove("disabled"),s.getIcon(e,s.sizes.small).done(e=>{a.replaceChild(document.createRange().createContextualFragment(e),a.querySelector(".t3js-icon"))})}const l=r.querySelector('[data-action="sort"][data-direction="'+v.DOWN+'"]');if(null!==l){let e="actions-move-down";i===t.length-1?(l.classList.add("disabled"),e="empty-empty"):l.classList.remove("disabled"),s.getIcon(e,s.sizes.small).done(e=>{l.replaceChild(document.createRange().createContextualFragment(e),l.querySelector(".t3js-icon"))})}})}isBelowMax(){const e=this.getFormFieldForElements();if(null===e)return!0;if(void 0!==TYPO3.settings.FormEngineInline.config[this.container.dataset.objectGroup]){if(p.trimExplode(",",e.value).length>=TYPO3.settings.FormEngineInline.config[this.container.dataset.objectGroup].max)return!1;if(this.hasObjectGroupDefinedUniqueConstraints()){const e=TYPO3.settings.FormEngineInline.unique[this.container.dataset.objectGroup];if(e.used.length>=e.max&&e.max>=0)return!1}}return!0}isUniqueElementUsed(e,t){if(!this.hasObjectGroupDefinedUniqueConstraints())return!1;const n=TYPO3.settings.FormEngineInline.unique[this.container.dataset.objectGroup],i=S.getValuesFromHashMap(n.used);if("select"===n.type&&-1!==i.indexOf(e))return!0;if("groupdb"===n.type)for(let n=i.length-1;n>=0;n--)if(i[n].table===t&&i[n].uid===e)return!0;return!1}removeUsed(e){if(!this.hasObjectGroupDefinedUniqueConstraints())return;const t=TYPO3.settings.FormEngineInline.unique[this.container.dataset.objectGroup];if("select"!==t.type)return;let n=e.querySelector('[name="data['+t.table+"]["+e.dataset.objectUid+"]["+t.field+']"]');const i=S.getValuesFromHashMap(t.used);if(null!==n){const e=n.options[n.selectedIndex].value;for(let t=0;t<i.length;t++)i[t]!==e&&S.removeSelectOptionByValue(n,i[t])}}setUnique(e,t){if(!this.hasObjectGroupDefinedUniqueConstraints())return;const n=document.querySelector("#"+this.container.dataset.objectGroup+"_selector"),i=TYPO3.settings.FormEngineInline.unique[this.container.dataset.objectGroup];if("select"===i.type){if(!i.selector||-1!==i.max){const o=this.getFormFieldForElements(),r=this.container.dataset.objectGroup+b.structureSeparator+e;let a=S.getInlineRecordContainer(r).querySelector('[name="data['+i.table+"]["+e+"]["+i.field+']"]');const s=S.getValuesFromHashMap(i.used);if(null!==n){if(null!==a){for(let e=0;e<s.length;e++)S.removeSelectOptionByValue(a,s[e]);i.selector||(t=a.options[0].value,a.options[0].selected=!0,this.updateUnique(a,o,e),this.handleChangedField(a,this.container.dataset.objectGroup+"["+e+"]"))}for(let e=0;e<s.length;e++)S.removeSelectOptionByValue(a,s[e]);void 0!==i.used.length&&(i.used={}),i.used[e]={table:i.elTable,uid:t}}if(null!==o&&S.selectOptionValueExists(n,t)){const n=p.trimExplode(",",o.value);for(let o=0;o<n.length;o++)null!==(a=document.querySelector('[name="data['+i.table+"]["+n[o]+"]["+i.field+']"]'))&&n[o]!==e&&S.removeSelectOptionByValue(a,t)}}}else"groupdb"===i.type&&(i.used[e]={table:i.elTable,uid:t});"select"===i.selector&&S.selectOptionValueExists(n,t)&&(S.removeSelectOptionByValue(n,t),i.used[e]={table:i.elTable,uid:t})}updateUnique(e,t,n){if(!this.hasObjectGroupDefinedUniqueConstraints())return;const i=TYPO3.settings.FormEngineInline.unique[this.container.dataset.objectGroup],o=i.used[n];if("select"===i.selector){const t=document.querySelector("#"+this.container.dataset.objectGroup+"_selector");S.removeSelectOptionByValue(t,e.value),void 0!==o&&S.reAddSelectOption(t,o,i)}if(i.selector&&-1===i.max)return;if(!i||null===t)return;const r=p.trimExplode(",",t.value);let a;for(let t=0;t<r.length;t++)null!==(a=document.querySelector('[name="data['+i.table+"]["+r[t]+"]["+i.field+']"]'))&&a!==e&&(S.removeSelectOptionByValue(a,e.value),void 0!==o&&S.reAddSelectOption(a,o,i));i.used[n]=e.value}revertUnique(e){if(!this.hasObjectGroupDefinedUniqueConstraints())return;const t=TYPO3.settings.FormEngineInline.unique[this.container.dataset.objectGroup],n=this.container.dataset.objectGroup+b.structureSeparator+e,i=S.getInlineRecordContainer(n);let o=i.querySelector('[name="data['+t.table+"]["+i.dataset.objectUid+"]["+t.field+']"]');if("select"===t.type){let n;if(null!==o)n=o.value;else{if(""===i.dataset.tableUniqueOriginalValue)return;n=i.dataset.tableUniqueOriginalValue}if("select"===t.selector&&!isNaN(parseInt(n,10))){const e=document.querySelector("#"+this.container.dataset.objectGroup+"_selector");S.reAddSelectOption(e,n,t)}if(t.selector&&-1===t.max)return;const r=this.getFormFieldForElements();if(null===r)return;const a=p.trimExplode(",",r.value);let s;for(let e=0;e<a.length;e++)null!==(s=document.querySelector('[name="data['+t.table+"]["+a[e]+"]["+t.field+']"]'))&&S.reAddSelectOption(s,n,t);delete t.used[e]}else"groupdb"===t.type&&delete t.used[e]}hasObjectGroupDefinedUniqueConstraints(){return void 0!==TYPO3.settings.FormEngineInline.unique&&void 0!==TYPO3.settings.FormEngineInline.unique[this.container.dataset.objectGroup]}handleChangedField(e,t){let n;n=e instanceof HTMLSelectElement?e.options[e.selectedIndex].text:e.value,document.querySelector("#"+t+"_label").textContent=n.length?n:this.noTitleString}getAppearance(){if(null===this.appearance&&(this.appearance={},"string"==typeof this.container.dataset.appearance))try{this.appearance=JSON.parse(this.container.dataset.appearance)}catch(e){console.error(e)}return this.appearance}}return S});
\ No newline at end of file
index 33b8145..f6a01da 100644 (file)
@@ -10,4 +10,4 @@
  *
  * The TYPO3 project - inspiring people to share!
  */
-define(["require","exports","jquery","TYPO3/CMS/Backend/FormEngine","TYPO3/CMS/Backend/FormEngineValidation"],function(e,t,o,r,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});class i{constructor(){this.registerSortableEventHandler=(e=>{const t=e.closest(".form-wizards-wrap").querySelector(".form-wizards-items-aside");null!==t&&t.addEventListener("click",t=>{let l;if(null===(l=t.target.closest(".t3js-btn-option")))return void(t.target.matches(".t3js-btn-option")&&(l=t.target));t.preventDefault();const s=l.dataset.fieldname;l.classList.contains("t3js-btn-moveoption-top")?i.moveOptionToTop(e):l.classList.contains("t3js-btn-moveoption-up")?i.moveOptionUp(e):l.classList.contains("t3js-btn-moveoption-down")?i.moveOptionDown(e):l.classList.contains("t3js-btn-moveoption-bottom")?i.moveOptionToBottom(e):l.classList.contains("t3js-btn-removeoption")&&i.removeOption(e,r.getFieldElement(s,"_avail").get(0)),r.updateHiddenFieldValueFromSelect(e,r.getFieldElement(s).get(0)),r.legacyFieldChangedCb(),n.markFieldAsChanged(o(e)),n.validate()})})}static moveOptionToTop(e){Array.from(e.querySelectorAll(":checked")).reverse().forEach(t=>{e.insertBefore(t,e.firstElementChild)})}static moveOptionToBottom(e){Array.from(e.querySelectorAll(":checked")).forEach(t=>{e.insertBefore(t,null)})}static moveOptionUp(e){const t=Array.from(e.children),o=Array.from(e.querySelectorAll(":checked"));for(let r of o){if(0===t.indexOf(r)&&null===r.previousElementSibling)break;e.insertBefore(r,r.previousElementSibling)}}static moveOptionDown(e){const t=Array.from(e.children).reverse(),o=Array.from(e.querySelectorAll(":checked")).reverse();for(let r of o){if(0===t.indexOf(r)&&null===r.nextElementSibling)break;e.insertBefore(r,r.nextElementSibling.nextElementSibling)}}static removeOption(e,t){Array.from(e.querySelectorAll(":checked")).forEach(o=>{const r=t.querySelector('option[value="'+o.value+'"]');null!==r&&(r.classList.remove("hidden"),r.disabled=!1),e.removeChild(o)})}}t.AbstractSortableSelectItems=i});
\ No newline at end of file
+define(["require","exports","jquery","TYPO3/CMS/Backend/FormEngine","TYPO3/CMS/Backend/FormEngineValidation"],function(e,t,o,n,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});class i{constructor(){this.registerSortableEventHandler=(e=>{const t=e.closest(".form-wizards-wrap").querySelector(".form-wizards-items-aside");null!==t&&t.addEventListener("click",t=>{let l;if(null===(l=t.target.closest(".t3js-btn-option")))return void(t.target.matches(".t3js-btn-option")&&(l=t.target));t.preventDefault();const s=l.dataset.fieldname;l.classList.contains("t3js-btn-moveoption-top")?i.moveOptionToTop(e):l.classList.contains("t3js-btn-moveoption-up")?i.moveOptionUp(e):l.classList.contains("t3js-btn-moveoption-down")?i.moveOptionDown(e):l.classList.contains("t3js-btn-moveoption-bottom")?i.moveOptionToBottom(e):l.classList.contains("t3js-btn-removeoption")&&i.removeOption(e,n.getFieldElement(s,"_avail").get(0)),n.updateHiddenFieldValueFromSelect(e,n.getFieldElement(s).get(0)),n.legacyFieldChangedCb(),r.markFieldAsChanged(o(e)),r.validate()})})}static moveOptionToTop(e){Array.from(e.querySelectorAll(":checked")).reverse().forEach(t=>{e.insertBefore(t,e.firstElementChild)})}static moveOptionToBottom(e){e.querySelectorAll(":checked").forEach(t=>{e.insertBefore(t,null)})}static moveOptionUp(e){const t=Array.from(e.children),o=Array.from(e.querySelectorAll(":checked"));for(let n of o){if(0===t.indexOf(n)&&null===n.previousElementSibling)break;e.insertBefore(n,n.previousElementSibling)}}static moveOptionDown(e){const t=Array.from(e.children).reverse(),o=Array.from(e.querySelectorAll(":checked")).reverse();for(let n of o){if(0===t.indexOf(n)&&null===n.nextElementSibling)break;e.insertBefore(n,n.nextElementSibling.nextElementSibling)}}static removeOption(e,t){e.querySelectorAll(":checked").forEach(o=>{const n=t.querySelector('option[value="'+o.value+'"]');null!==n&&(n.classList.remove("hidden"),n.disabled=!1),e.removeChild(o)})}}t.AbstractSortableSelectItems=i});
\ No newline at end of file
index 22209b6..083d838 100644 (file)
@@ -10,4 +10,4 @@
  *
  * The TYPO3 project - inspiring people to share!
  */
-define(["require","exports","./AbstractSortableSelectItems","jquery","TYPO3/CMS/Backend/FormEngine","./Extra/SelectBoxFilter"],function(e,t,l,n,r,s){"use strict";return class extends l.AbstractSortableSelectItems{constructor(e,t){super(),this.selectedOptionsElement=null,this.availableOptionsElement=null,n(()=>{this.selectedOptionsElement=document.querySelector("#"+e),this.availableOptionsElement=document.querySelector("#"+t),this.registerEventHandler()})}registerEventHandler(){this.registerSortableEventHandler(this.selectedOptionsElement),this.availableOptionsElement.addEventListener("click",e=>{const t=e.currentTarget,l=t.dataset.relatedfieldname;if(l){const e=t.dataset.exclusiveValues,s=t.querySelectorAll("option:checked");s.length>0&&Array.from(s).forEach(t=>{r.setSelectOptionFromExternalSource(l,t.value,t.textContent,t.getAttribute("title"),e,n(t))})}}),new s(this.availableOptionsElement)}}});
\ No newline at end of file
+define(["require","exports","./AbstractSortableSelectItems","jquery","TYPO3/CMS/Backend/FormEngine","./Extra/SelectBoxFilter"],function(e,t,l,n,r,s){"use strict";return class extends l.AbstractSortableSelectItems{constructor(e,t){super(),this.selectedOptionsElement=null,this.availableOptionsElement=null,n(()=>{this.selectedOptionsElement=document.querySelector("#"+e),this.availableOptionsElement=document.querySelector("#"+t),this.registerEventHandler()})}registerEventHandler(){this.registerSortableEventHandler(this.selectedOptionsElement),this.availableOptionsElement.addEventListener("click",e=>{const t=e.currentTarget,l=t.dataset.relatedfieldname;if(l){const e=t.dataset.exclusiveValues,s=t.querySelectorAll("option:checked");s.length>0&&s.forEach(t=>{r.setSelectOptionFromExternalSource(l,t.value,t.textContent,t.getAttribute("title"),e,n(t))})}}),new s(this.availableOptionsElement)}}});
\ No newline at end of file
index 9c0da55..41dabad 100644 (file)
@@ -10,4 +10,4 @@
  *
  * The TYPO3 project - inspiring people to share!
  */
-define(["require","exports","jquery","./Storage/Client"],function(e,i,t,s){"use strict";var r,c,n;!function(e){e.small="small",e.default="default",e.large="large",e.overlay="overlay"}(r||(r={})),function(e){e.default="default",e.disabled="disabled"}(c||(c={})),function(e){e.default="default",e.inline="inline"}(n||(n={}));class a{constructor(){this.sizes=r,this.states=c,this.markupIdentifiers=n,this.promiseCache={}}getIcon(e,i,a,o,h){const l=[e,i=i||r.default,a,o=o||c.default,h=h||n.default],u=l.join("_");return t.when(this.getIconRegistryCache()).pipe(e=>(s.isset("icon_registry_cache_identifier")&&s.get("icon_registry_cache_identifier")===e||(s.unsetByPrefix("icon_"),s.set("icon_registry_cache_identifier",e)),this.fetchFromLocal(u).then(null,()=>this.fetchFromRemote(l,u))))}getIconRegistryCache(){return this.isPromiseCached("icon_registry_cache_identifier")||this.putInPromiseCache("icon_registry_cache_identifier",t.ajax({url:TYPO3.settings.ajaxUrls.icons_cache,success:e=>e})),this.getFromPromiseCache("icon_registry_cache_identifier")}fetchFromRemote(e,i){return this.isPromiseCached(i)||this.putInPromiseCache(i,t.ajax({url:TYPO3.settings.ajaxUrls.icons,dataType:"html",data:{icon:JSON.stringify(e)},success:e=>(-1!==e.indexOf("t3js-icon")&&-1!==e.indexOf('<span class="icon-markup">')&&s.set("icon_"+i,e),e)})),this.getFromPromiseCache(i)}fetchFromLocal(e){const i=t.Deferred();return s.isset("icon_"+e)?i.resolve(s.get("icon_"+e)):i.reject(),i.promise()}isPromiseCached(e){return void 0!==this.promiseCache[e]}getFromPromiseCache(e){return this.promiseCache[e]}putInPromiseCache(e,i){this.promiseCache[e]=i}}let o;return o||(o=new a,TYPO3.Icons=o),o});
\ No newline at end of file
+define(["require","exports","jquery","./Storage/Client"],function(e,i,t,s){"use strict";var r,c,n;!function(e){e.small="small",e.default="default",e.large="large",e.overlay="overlay"}(r||(r={})),function(e){e.default="default",e.disabled="disabled"}(c||(c={})),function(e){e.default="default",e.inline="inline"}(n||(n={}));class a{constructor(){this.sizes=r,this.states=c,this.markupIdentifiers=n,this.promiseCache={}}getIcon(e,i,a,o,h){const l=[e,i=i||r.default,a,o=o||c.default,h=h||n.default],u=l.join("_");return t.when(this.getIconRegistryCache()).pipe(e=>(s.isset("icon_registry_cache_identifier")&&s.get("icon_registry_cache_identifier")===e||(s.unsetByPrefix("icon_"),s.set("icon_registry_cache_identifier",e)),this.fetchFromLocal(u).then(null,()=>this.fetchFromRemote(l,u))))}getIconRegistryCache(){return this.isPromiseCached("icon_registry_cache_identifier")||this.putInPromiseCache("icon_registry_cache_identifier",t.ajax({url:TYPO3.settings.ajaxUrls.icons_cache,success:e=>e})),this.getFromPromiseCache("icon_registry_cache_identifier")}fetchFromRemote(e,i){return this.isPromiseCached(i)||this.putInPromiseCache(i,t.ajax({url:TYPO3.settings.ajaxUrls.icons,dataType:"html",data:{icon:JSON.stringify(e)},success:e=>(e.includes("t3js-icon")&&e.includes('<span class="icon-markup">')&&s.set("icon_"+i,e),e)})),this.getFromPromiseCache(i)}fetchFromLocal(e){const i=t.Deferred();return s.isset("icon_"+e)?i.resolve(s.get("icon_"+e)):i.reject(),i.promise()}isPromiseCached(e){return void 0!==this.promiseCache[e]}getFromPromiseCache(e){return this.promiseCache[e]}putInPromiseCache(e,i){this.promiseCache[e]=i}}let o;return o||(o=new a,TYPO3.Icons=o),o});
\ No newline at end of file
index 08b1b84..cdba0da 100644 (file)
@@ -10,4 +10,4 @@
  *
  * The TYPO3 project - inspiring people to share!
  */
-define(["require","exports","jquery","../AjaxDataHandler","../Modal","../Severity"],function(t,e,a,s,n,o){"use strict";class l{constructor(){this.elementIdentifier=".t3js-page-ce",a(()=>{a(".t3js-page-columns").length&&this.activatePasteIcons()})}static determineColumn(t){const e=t.closest("[data-colpos]");return e.length&&"undefined"!==e.data("colpos")?e.data("colpos"):0}activatePasteIcons(){const t=this;a(".t3-page-ce-wrapper-new-ce").each((e,s)=>{if(a(s).find(".t3js-toggle-new-content-element-wizard").length&&(a(".t3js-page-lang-column .t3-page-ce > .t3-page-ce").removeClass("t3js-page-ce"),top.pasteAfterLinkTemplate&&top.pasteIntoLinkTemplate)){a(s).parent().data("page")?a(s).append(top.pasteIntoLinkTemplate):a(s).append(top.pasteAfterLinkTemplate),a(s).find(".t3js-paste").on("click",e=>{e.preventDefault(),t.activatePasteModal(a(e.currentTarget))})}})}activatePasteModal(t){const e=this,s=a(t),l=s.data("url")||null,r=(TYPO3.lang["paste.modal.title.paste"]||"Paste record")+': "'+s.data("title")+'"',i=void 0!==top.TYPO3.Severity[s.data("severity")]?top.TYPO3.Severity[s.data("severity")]:top.TYPO3.Severity.info;let d="",p=[];if(s.hasClass("t3js-paste-copy")?(d=TYPO3.lang["paste.modal.pastecopy"]||"Do you want to copy the record to this position?",p=[{text:TYPO3.lang["paste.modal.button.cancel"]||"Cancel",active:!0,btnClass:"btn-default",trigger:()=>{n.currentModal.trigger("modal-dismiss")}},{text:TYPO3.lang["paste.modal.button.pastecopy"]||"Copy",btnClass:"btn-"+o.getCssClass(i),trigger:()=>{n.currentModal.trigger("modal-dismiss"),e.execute(s)}}]):(d=TYPO3.lang["paste.modal.paste"]||"Do you want to move the record to this position?",p=[{text:TYPO3.lang["paste.modal.button.cancel"]||"Cancel",active:!0,btnClass:"btn-default",trigger:()=>{n.currentModal.trigger("modal-dismiss")}},{text:TYPO3.lang["paste.modal.button.paste"]||"Move",btnClass:"btn-"+o.getCssClass(i),trigger:()=>{n.currentModal.trigger("modal-dismiss"),e.execute(s)}}]),null!==l){const t=l.indexOf("?")>-1?"&":"?",e=a.param({data:s.data()});n.loadUrl(r,i,p,l+t+e)}else n.show(r,d,i,p)}execute(t){const e=l.determineColumn(t),a=t.closest(this.elementIdentifier),n=a.data("uid");let o;const r={CB:{paste:"tt_content|"+(o=void 0===n?parseInt(a.data("page"),10):0-parseInt(n,10)),update:{colPos:e,sys_language_uid:parseInt(t.closest("[data-language-uid]").data("language-uid"),10)}}};s.process(r).done(t=>{t.hasErrors||window.location.reload(!0)})}}return new l});
\ No newline at end of file
+define(["require","exports","jquery","../AjaxDataHandler","../Modal","../Severity"],function(t,e,a,s,n,o){"use strict";class l{constructor(){this.elementIdentifier=".t3js-page-ce",a(()=>{a(".t3js-page-columns").length&&this.activatePasteIcons()})}static determineColumn(t){const e=t.closest("[data-colpos]");return e.length&&"undefined"!==e.data("colpos")?e.data("colpos"):0}activatePasteIcons(){const t=this;a(".t3-page-ce-wrapper-new-ce").each((e,s)=>{if(a(s).find(".t3js-toggle-new-content-element-wizard").length&&(a(".t3js-page-lang-column .t3-page-ce > .t3-page-ce").removeClass("t3js-page-ce"),top.pasteAfterLinkTemplate&&top.pasteIntoLinkTemplate)){a(s).parent().data("page")?a(s).append(top.pasteIntoLinkTemplate):a(s).append(top.pasteAfterLinkTemplate),a(s).find(".t3js-paste").on("click",e=>{e.preventDefault(),t.activatePasteModal(a(e.currentTarget))})}})}activatePasteModal(t){const e=this,s=a(t),l=s.data("url")||null,r=(TYPO3.lang["paste.modal.title.paste"]||"Paste record")+': "'+s.data("title")+'"',i=void 0!==top.TYPO3.Severity[s.data("severity")]?top.TYPO3.Severity[s.data("severity")]:top.TYPO3.Severity.info;let d="",c=[];if(s.hasClass("t3js-paste-copy")?(d=TYPO3.lang["paste.modal.pastecopy"]||"Do you want to copy the record to this position?",c=[{text:TYPO3.lang["paste.modal.button.cancel"]||"Cancel",active:!0,btnClass:"btn-default",trigger:()=>{n.currentModal.trigger("modal-dismiss")}},{text:TYPO3.lang["paste.modal.button.pastecopy"]||"Copy",btnClass:"btn-"+o.getCssClass(i),trigger:()=>{n.currentModal.trigger("modal-dismiss"),e.execute(s)}}]):(d=TYPO3.lang["paste.modal.paste"]||"Do you want to move the record to this position?",c=[{text:TYPO3.lang["paste.modal.button.cancel"]||"Cancel",active:!0,btnClass:"btn-default",trigger:()=>{n.currentModal.trigger("modal-dismiss")}},{text:TYPO3.lang["paste.modal.button.paste"]||"Move",btnClass:"btn-"+o.getCssClass(i),trigger:()=>{n.currentModal.trigger("modal-dismiss"),e.execute(s)}}]),null!==l){const t=l.contains("?")?"&":"?",e=a.param({data:s.data()});n.loadUrl(r,i,c,l+t+e)}else n.show(r,d,i,c)}execute(t){const e=l.determineColumn(t),a=t.closest(this.elementIdentifier),n=a.data("uid");let o;const r={CB:{paste:"tt_content|"+(o=void 0===n?parseInt(a.data("page"),10):0-parseInt(n,10)),update:{colPos:e,sys_language_uid:parseInt(t.closest("[data-language-uid]").data("language-uid"),10)}}};s.process(r).done(t=>{t.hasErrors||window.location.reload(!0)})}}return new l});
\ No newline at end of file
index 9550a05..ea29e2d 100644 (file)
@@ -10,4 +10,4 @@
  *
  * The TYPO3 project - inspiring people to share!
  */
-define(["require","exports","./Enum/Severity","jquery","./Icons","./Severity","TYPO3/CMS/Core/SecurityUtility","bootstrap"],function(t,e,a,n,i,s,l){"use strict";var o,d,r,c;!function(t){t.modal=".t3js-modal",t.content=".t3js-modal-content",t.title=".t3js-modal-title",t.close=".t3js-modal-close",t.body=".t3js-modal-body",t.footer=".t3js-modal-footer",t.iframe=".t3js-modal-iframe",t.iconPlaceholder=".t3js-modal-icon-placeholder"}(o||(o={})),function(t){t.small="small",t.default="default",t.medium="medium",t.large="large",t.full="full"}(d||(d={})),function(t){t.default="default",t.light="light",t.dark="dark"}(r||(r={})),function(t){t.default="default",t.ajax="ajax",t.iframe="iframe"}(c||(c={}));class u{constructor(t){this.sizes=d,this.styles=r,this.types=c,this.currentModal=null,this.instances=[],this.$template=n('<div class="t3js-modal modal fade"><div class="modal-dialog"><div class="t3js-modal-content modal-content"><div class="modal-header"><button class="t3js-modal-close close"><span aria-hidden="true"><span class="t3js-modal-icon-placeholder" data-icon="actions-close"></span></span><span class="sr-only"></span></button><h4 class="t3js-modal-title modal-title"></h4></div><div class="t3js-modal-body modal-body"></div><div class="t3js-modal-footer modal-footer"></div></div></div></div>'),this.defaultConfiguration={type:c.default,title:"Information",content:"No content provided, please check your <code>Modal</code> configuration.",severity:a.SeverityEnum.notice,buttons:[],style:r.default,size:d.default,additionalCssClasses:[],callback:n.noop(),ajaxCallback:n.noop(),ajaxTarget:null},this.securityUtility=t,n(document).on("modal-dismiss",this.dismiss),this.initializeMarkupTrigger(document)}dismiss(){this.currentModal&&this.currentModal.modal("hide")}confirm(t,e,i=a.SeverityEnum.warning,l=[],o){return 0===l.length&&l.push({text:n(this).data("button-close-text")||TYPO3.lang["button.cancel"]||"Cancel",active:!0,btnClass:"btn-default",name:"cancel"},{text:n(this).data("button-ok-text")||TYPO3.lang["button.ok"]||"OK",btnClass:"btn-"+s.getCssClass(i),name:"ok"}),this.advanced({title:t,content:e,severity:i,buttons:l,additionalCssClasses:o,callback:t=>{t.on("button.clicked",t=>{"cancel"===t.target.getAttribute("name")?n(t.currentTarget).trigger("confirm.button.cancel"):"ok"===t.target.getAttribute("name")&&n(t.currentTarget).trigger("confirm.button.ok")})}})}loadUrl(t,e=a.SeverityEnum.info,n,i,s,l){return this.advanced({type:c.ajax,title:t,severity:e,buttons:n,ajaxCallback:s,ajaxTarget:l})}show(t,e,n=a.SeverityEnum.info,i,s){return this.advanced({type:c.default,title:t,content:e,severity:n,buttons:i,additionalCssClasses:s})}advanced(t){return t.type="string"==typeof t.type&&t.type in c?t.type:this.defaultConfiguration.type,t.title="string"==typeof t.title?t.title:this.defaultConfiguration.title,t.content="string"==typeof t.content||"object"==typeof t.content?t.content:this.defaultConfiguration.content,t.severity=void 0!==t.severity?t.severity:this.defaultConfiguration.severity,t.buttons=t.buttons||this.defaultConfiguration.buttons,t.size="string"==typeof t.size&&t.size in d?t.size:this.defaultConfiguration.size,t.style="string"==typeof t.style&&t.style in r?t.style:this.defaultConfiguration.style,t.additionalCssClasses=t.additionalCssClasses||this.defaultConfiguration.additionalCssClasses,t.callback="function"==typeof t.callback?t.callback:this.defaultConfiguration.callback,t.ajaxCallback="function"==typeof t.ajaxCallback?t.ajaxCallback:this.defaultConfiguration.ajaxCallback,t.ajaxTarget="string"==typeof t.ajaxTarget?t.ajaxTarget:this.defaultConfiguration.ajaxTarget,this.generate(t)}setButtons(t){if(t.length>0){this.currentModal.find(o.footer).empty();for(let e=0;e<t.length;e++){const a=t[e],i=n("<button />",{class:"btn"});i.html("<span>"+this.securityUtility.encodeHtml(a.text,!1)+"</span>"),a.active&&i.addClass("t3js-active"),""!==a.btnClass&&i.addClass(a.btnClass),""!==a.name&&i.attr("name",a.name),a.trigger&&i.on("click",a.trigger),a.dataAttributes&&Object.keys(a.dataAttributes).length>0&&Object.keys(a.dataAttributes).map(t=>{i.attr("data-"+t,a.dataAttributes[t])}),a.icon&&i.prepend('<span class="t3js-modal-icon-placeholder" data-icon="'+a.icon+'"></span>'),this.currentModal.find(o.footer).append(i)}this.currentModal.find(o.footer).show(),this.currentModal.find(o.footer).find("button").on("click",t=>{n(t.currentTarget).trigger("button.clicked")})}else this.currentModal.find(o.footer).hide();return this.currentModal}initializeMarkupTrigger(t){n(t).on("click",".t3js-modal-trigger",t=>{t.preventDefault();const e=n(t.currentTarget),i=e.data("content")||"Are you sure?",l=void 0!==a.SeverityEnum[e.data("severity")]?a.SeverityEnum[e.data("severity")]:a.SeverityEnum.info;let o=e.data("url")||null;if(null!==o){const t=o.indexOf("?")>-1?"&":"?";o=o+t+n.param({data:e.data()})}this.advanced({type:null!==o?c.ajax:c.default,title:e.data("title")||"Alert",content:null!==o?o:i,severity:l,buttons:[{text:e.data("button-close-text")||TYPO3.lang["button.close"]||"Close",active:!0,btnClass:"btn-default",trigger:()=>{this.currentModal.trigger("modal-dismiss")}},{text:e.data("button-ok-text")||TYPO3.lang["button.ok"]||"OK",btnClass:"btn-"+s.getCssClass(l),trigger:()=>{this.currentModal.trigger("modal-dismiss"),t.target.ownerDocument.location.href=e.data("href")||e.attr("href")}}]})})}generate(t){const e=this.$template.clone();if(t.additionalCssClasses.length>0)for(let a of t.additionalCssClasses)e.addClass(a);if(e.addClass("modal-type-"+t.type),e.addClass("modal-severity-"+s.getCssClass(t.severity)),e.addClass("modal-style-"+t.style),e.addClass("modal-size-"+t.size),e.attr("tabindex","-1"),e.find(o.title).text(t.title),e.find(o.close).on("click",()=>{e.modal("hide")}),"ajax"===t.type){const a=t.ajaxTarget?t.ajaxTarget:o.body,s=e.find(a);i.getIcon("spinner-circle",i.sizes.default,null,null,i.markupIdentifiers.inline).done(e=>{s.html('<div class="modal-loading">'+e+"</div>"),n.get(t.content,e=>{this.currentModal.find(a).empty().append(e),t.ajaxCallback&&t.ajaxCallback(),this.currentModal.trigger("modal-loaded")},"html")})}else"iframe"===t.type?(e.find(o.body).append(n("<iframe />",{src:t.content,name:"modal_frame",class:"modal-iframe t3js-modal-iframe"})),e.find(o.iframe).on("load",()=>{e.find(o.title).text(e.find(o.iframe).get(0).contentDocument.title)})):("string"==typeof t.content&&(t.content=n("<p />").html(this.securityUtility.encodeHtml(t.content))),e.find(o.body).append(t.content));return e.on("shown.bs.modal",t=>{const e=n(t.currentTarget);e.find(o.footer).find(".t3js-active").first().focus(),e.find(o.iconPlaceholder).each((t,e)=>{i.getIcon(n(e).data("icon"),i.sizes.small,null,null,i.markupIdentifiers.inline).done(t=>{this.currentModal.find(o.iconPlaceholder+"[data-icon="+n(t).data("identifier")+"]").replaceWith(t)})})}),e.on("hidden.bs.modal",t=>{if(this.instances.length>0){const t=this.instances.length-1;this.instances.splice(t,1),this.currentModal=this.instances[t-1]}e.trigger("modal-destroyed"),n(t.currentTarget).remove(),this.instances.length>0&&n("body").addClass("modal-open")}),e.on("show.bs.modal",e=>{this.currentModal=n(e.currentTarget),this.setButtons(t.buttons),this.instances.push(this.currentModal)}),e.on("modal-dismiss",t=>{n(t.currentTarget).modal("hide")}),t.callback&&t.callback(e),e.modal()}}let f=null;try{parent&&parent.window.TYPO3&&parent.window.TYPO3.Modal?(parent.window.TYPO3.Modal.initializeMarkupTrigger(document),f=parent.window.TYPO3.Modal):top&&top.TYPO3.Modal&&(top.TYPO3.Modal.initializeMarkupTrigger(document),f=top.TYPO3.Modal)}catch(t){}return f||(f=new u(new l),TYPO3.Modal=f),f});
\ No newline at end of file
+define(["require","exports","./Enum/Severity","jquery","./Icons","./Severity","TYPO3/CMS/Core/SecurityUtility","bootstrap"],function(t,e,a,n,i,s,l){"use strict";var o,d,r,c;!function(t){t.modal=".t3js-modal",t.content=".t3js-modal-content",t.title=".t3js-modal-title",t.close=".t3js-modal-close",t.body=".t3js-modal-body",t.footer=".t3js-modal-footer",t.iframe=".t3js-modal-iframe",t.iconPlaceholder=".t3js-modal-icon-placeholder"}(o||(o={})),function(t){t.small="small",t.default="default",t.medium="medium",t.large="large",t.full="full"}(d||(d={})),function(t){t.default="default",t.light="light",t.dark="dark"}(r||(r={})),function(t){t.default="default",t.ajax="ajax",t.iframe="iframe"}(c||(c={}));class u{constructor(t){this.sizes=d,this.styles=r,this.types=c,this.currentModal=null,this.instances=[],this.$template=n('<div class="t3js-modal modal fade"><div class="modal-dialog"><div class="t3js-modal-content modal-content"><div class="modal-header"><button class="t3js-modal-close close"><span aria-hidden="true"><span class="t3js-modal-icon-placeholder" data-icon="actions-close"></span></span><span class="sr-only"></span></button><h4 class="t3js-modal-title modal-title"></h4></div><div class="t3js-modal-body modal-body"></div><div class="t3js-modal-footer modal-footer"></div></div></div></div>'),this.defaultConfiguration={type:c.default,title:"Information",content:"No content provided, please check your <code>Modal</code> configuration.",severity:a.SeverityEnum.notice,buttons:[],style:r.default,size:d.default,additionalCssClasses:[],callback:n.noop(),ajaxCallback:n.noop(),ajaxTarget:null},this.securityUtility=t,n(document).on("modal-dismiss",this.dismiss),this.initializeMarkupTrigger(document)}dismiss(){this.currentModal&&this.currentModal.modal("hide")}confirm(t,e,i=a.SeverityEnum.warning,l=[],o){return 0===l.length&&l.push({text:n(this).data("button-close-text")||TYPO3.lang["button.cancel"]||"Cancel",active:!0,btnClass:"btn-default",name:"cancel"},{text:n(this).data("button-ok-text")||TYPO3.lang["button.ok"]||"OK",btnClass:"btn-"+s.getCssClass(i),name:"ok"}),this.advanced({title:t,content:e,severity:i,buttons:l,additionalCssClasses:o,callback:t=>{t.on("button.clicked",t=>{"cancel"===t.target.getAttribute("name")?n(t.currentTarget).trigger("confirm.button.cancel"):"ok"===t.target.getAttribute("name")&&n(t.currentTarget).trigger("confirm.button.ok")})}})}loadUrl(t,e=a.SeverityEnum.info,n,i,s,l){return this.advanced({type:c.ajax,title:t,severity:e,buttons:n,ajaxCallback:s,ajaxTarget:l})}show(t,e,n=a.SeverityEnum.info,i,s){return this.advanced({type:c.default,title:t,content:e,severity:n,buttons:i,additionalCssClasses:s})}advanced(t){return t.type="string"==typeof t.type&&t.type in c?t.type:this.defaultConfiguration.type,t.title="string"==typeof t.title?t.title:this.defaultConfiguration.title,t.content="string"==typeof t.content||"object"==typeof t.content?t.content:this.defaultConfiguration.content,t.severity=void 0!==t.severity?t.severity:this.defaultConfiguration.severity,t.buttons=t.buttons||this.defaultConfiguration.buttons,t.size="string"==typeof t.size&&t.size in d?t.size:this.defaultConfiguration.size,t.style="string"==typeof t.style&&t.style in r?t.style:this.defaultConfiguration.style,t.additionalCssClasses=t.additionalCssClasses||this.defaultConfiguration.additionalCssClasses,t.callback="function"==typeof t.callback?t.callback:this.defaultConfiguration.callback,t.ajaxCallback="function"==typeof t.ajaxCallback?t.ajaxCallback:this.defaultConfiguration.ajaxCallback,t.ajaxTarget="string"==typeof t.ajaxTarget?t.ajaxTarget:this.defaultConfiguration.ajaxTarget,this.generate(t)}setButtons(t){if(t.length>0){this.currentModal.find(o.footer).empty();for(let e=0;e<t.length;e++){const a=t[e],i=n("<button />",{class:"btn"});i.html("<span>"+this.securityUtility.encodeHtml(a.text,!1)+"</span>"),a.active&&i.addClass("t3js-active"),""!==a.btnClass&&i.addClass(a.btnClass),""!==a.name&&i.attr("name",a.name),a.trigger&&i.on("click",a.trigger),a.dataAttributes&&Object.keys(a.dataAttributes).length>0&&Object.keys(a.dataAttributes).map(t=>{i.attr("data-"+t,a.dataAttributes[t])}),a.icon&&i.prepend('<span class="t3js-modal-icon-placeholder" data-icon="'+a.icon+'"></span>'),this.currentModal.find(o.footer).append(i)}this.currentModal.find(o.footer).show(),this.currentModal.find(o.footer).find("button").on("click",t=>{n(t.currentTarget).trigger("button.clicked")})}else this.currentModal.find(o.footer).hide();return this.currentModal}initializeMarkupTrigger(t){n(t).on("click",".t3js-modal-trigger",t=>{t.preventDefault();const e=n(t.currentTarget),i=e.data("content")||"Are you sure?",l=void 0!==a.SeverityEnum[e.data("severity")]?a.SeverityEnum[e.data("severity")]:a.SeverityEnum.info;let o=e.data("url")||null;if(null!==o){const t=o.includes("?")?"&":"?";o=o+t+n.param({data:e.data()})}this.advanced({type:null!==o?c.ajax:c.default,title:e.data("title")||"Alert",content:null!==o?o:i,severity:l,buttons:[{text:e.data("button-close-text")||TYPO3.lang["button.close"]||"Close",active:!0,btnClass:"btn-default",trigger:()=>{this.currentModal.trigger("modal-dismiss")}},{text:e.data("button-ok-text")||TYPO3.lang["button.ok"]||"OK",btnClass:"btn-"+s.getCssClass(l),trigger:()=>{this.currentModal.trigger("modal-dismiss"),t.target.ownerDocument.location.href=e.data("href")||e.attr("href")}}]})})}generate(t){const e=this.$template.clone();if(t.additionalCssClasses.length>0)for(let a of t.additionalCssClasses)e.addClass(a);if(e.addClass("modal-type-"+t.type),e.addClass("modal-severity-"+s.getCssClass(t.severity)),e.addClass("modal-style-"+t.style),e.addClass("modal-size-"+t.size),e.attr("tabindex","-1"),e.find(o.title).text(t.title),e.find(o.close).on("click",()=>{e.modal("hide")}),"ajax"===t.type){const a=t.ajaxTarget?t.ajaxTarget:o.body,s=e.find(a);i.getIcon("spinner-circle",i.sizes.default,null,null,i.markupIdentifiers.inline).done(e=>{s.html('<div class="modal-loading">'+e+"</div>"),n.get(t.content,e=>{this.currentModal.find(a).empty().append(e),t.ajaxCallback&&t.ajaxCallback(),this.currentModal.trigger("modal-loaded")},"html")})}else"iframe"===t.type?(e.find(o.body).append(n("<iframe />",{src:t.content,name:"modal_frame",class:"modal-iframe t3js-modal-iframe"})),e.find(o.iframe).on("load",()=>{e.find(o.title).text(e.find(o.iframe).get(0).contentDocument.title)})):("string"==typeof t.content&&(t.content=n("<p />").html(this.securityUtility.encodeHtml(t.content))),e.find(o.body).append(t.content));return e.on("shown.bs.modal",t=>{const e=n(t.currentTarget);e.find(o.footer).find(".t3js-active").first().focus(),e.find(o.iconPlaceholder).each((t,e)=>{i.getIcon(n(e).data("icon"),i.sizes.small,null,null,i.markupIdentifiers.inline).done(t=>{this.currentModal.find(o.iconPlaceholder+"[data-icon="+n(t).data("identifier")+"]").replaceWith(t)})})}),e.on("hidden.bs.modal",t=>{if(this.instances.length>0){const t=this.instances.length-1;this.instances.splice(t,1),this.currentModal=this.instances[t-1]}e.trigger("modal-destroyed"),n(t.currentTarget).remove(),this.instances.length>0&&n("body").addClass("modal-open")}),e.on("show.bs.modal",e=>{this.currentModal=n(e.currentTarget),this.setButtons(t.buttons),this.instances.push(this.currentModal)}),e.on("modal-dismiss",t=>{n(t.currentTarget).modal("hide")}),t.callback&&t.callback(e),e.modal()}}let f=null;try{parent&&parent.window.TYPO3&&parent.window.TYPO3.Modal?(parent.window.TYPO3.Modal.initializeMarkupTrigger(document),f=parent.window.TYPO3.Modal):top&&top.TYPO3.Modal&&(top.TYPO3.Modal.initializeMarkupTrigger(document),f=top.TYPO3.Modal)}catch(t){}return f||(f=new u(new l),TYPO3.Modal=f),f});
\ No newline at end of file
index 5ed7d7e..3e7d9c7 100644 (file)
@@ -10,4 +10,4 @@
  *
  * The TYPO3 project - inspiring people to share!
  */
-define(["require","exports","./Enum/Viewport/ScaffoldIdentifier","jquery","./Storage/Persistent","./Viewport","./Event/ClientRequest","./Event/TriggerRequest"],function(e,t,n,o,a,i,d,r){"use strict";class l{constructor(){this.loadedModule=null,this.loadedNavigationComponentId="",o(()=>this.initialize())}static getCollapsedMainMenuItems(){return a.isset("modulemenu")?JSON.parse(a.get("modulemenu")):{}}static addCollapsedMainMenuItem(e){const t=l.getCollapsedMainMenuItems();t[e]=!0,a.set("modulemenu",JSON.stringify(t))}static removeCollapseMainMenuItem(e){const t=this.getCollapsedMainMenuItems();delete t[e],a.set("modulemenu",JSON.stringify(t))}static includeId(e,t){if(!e.navigationComponentId&&!e.navigationFrameScript)return t;let n="";return n="TYPO3/CMS/Backend/PageTree/PageTreeElement"===e.navigationComponentId?"web":e.name.split("_")[0],top.fsMod.recentIds[n]&&(t="id="+top.fsMod.recentIds[n]+"&"+t),t}static toggleMenu(e){i.NavigationContainer.cleanup();const t=o(n.ScaffoldIdentifierEnum.scaffold);void 0===e&&(e=t.hasClass("scaffold-modulemenu-expanded")),t.toggleClass("scaffold-modulemenu-expanded",!e),e||o(".scaffold").removeClass("scaffold-search-expanded").removeClass("scaffold-toolbar-expanded"),a.set("BackendComponents.States.typo3-module-menu",{collapsed:e}),i.doLayout()}static getRecordFromName(e){const t=o("#"+e);return{name:e,navigationComponentId:t.data("navigationcomponentid"),navigationFrameScript:t.data("navigationframescript"),navigationFrameScriptParam:t.data("navigationframescriptparameters"),link:t.find("a").data("link")}}static highlightModuleMenuItem(e){o(".modulemenu-item.active").removeClass("active"),o("#"+e).addClass("active")}refreshMenu(){o.ajax(TYPO3.settings.ajaxUrls.modulemenu).done(e=>{o("#menu").replaceWith(e.menu),top.currentModuleLoaded&&l.highlightModuleMenuItem(top.currentModuleLoaded),i.doLayout()})}reloadFrames(){i.NavigationContainer.refresh(),i.ContentContainer.refresh()}showModule(e,t,n){t=t||"";const o=l.getRecordFromName(e);return this.loadModuleComponents(o,t,new d("typo3.showModule",n?n.originalEvent:null))}initialize(){const e=this;let t=o.Deferred();if(t.resolve(),top.startInModule&&top.startInModule[0]&&o("#"+top.startInModule[0]).length>0)t=this.showModule(top.startInModule[0],top.startInModule[1]);else{const e=o(".t3js-mainmodule:first");e.attr("id")&&(t=this.showModule(e.attr("id")))}t.then(()=>{e.initializeEvents()})}initializeEvents(){o(document).on("click",".modulemenu-group .modulemenu-group-header",e=>{const t=o(e.currentTarget).parent(".modulemenu-group"),n=t.find(".modulemenu-group-container");i.NavigationContainer.cleanup(),t.hasClass("expanded")?(l.addCollapsedMainMenuItem(t.attr("id")),t.addClass("collapsed").removeClass("expanded"),n.stop().slideUp().promise().done(()=>{i.doLayout()})):(l.removeCollapseMainMenuItem(t.attr("id")),t.addClass("expanded").removeClass("collapsed"),n.stop().slideDown().promise().done(()=>{i.doLayout()}))}),o(document).on("click",".modulemenu-item,.t3-menuitem-submodule",e=>{e.preventDefault(),this.showModule(o(e.currentTarget).attr("id"),"",e)}),o(document).on("click",".t3js-topbar-button-modulemenu",e=>{e.preventDefault(),l.toggleMenu()}),o(document).on("click",".t3js-scaffold-content-overlay",e=>{e.preventDefault(),l.toggleMenu(!0)}),o(document).on("click",".t3js-topbar-button-navigationcomponent",e=>{e.preventDefault(),i.NavigationContainer.toggle()})}loadModuleComponents(e,t,n){const a=e.name,d=i.ContentContainer.beforeSetUrl(n);return d.then(o.proxy(()=>{e.navigationComponentId?this.loadNavigationComponent(e.navigationComponentId):e.navigationFrameScript?(i.NavigationContainer.show("typo3-navigationIframe"),this.openInNavFrame(e.navigationFrameScript,e.navigationFrameScriptParam,new r("typo3.loadModuleComponents",n))):i.NavigationContainer.hide(),l.highlightModuleMenuItem(a),this.loadedModule=a,t=l.includeId(e,t),this.openInContentFrame(e.link,t,new r("typo3.loadModuleComponents",n)),top.currentSubScript=e.link,top.currentModuleLoaded=a,i.doLayout()},this)),d}loadNavigationComponent(t){const n=this;if(i.NavigationContainer.show(t),t===this.loadedNavigationComponentId)return;const a=t.replace(/[\/]/g,"_");""!==this.loadedNavigationComponentId&&o("#navigationComponent-"+this.loadedNavigationComponentId.replace(/[\/]/g,"_")).hide(),o('.t3js-scaffold-content-navigation [data-component="'+t+'"]').length<1&&o(".t3js-scaffold-content-navigation").append(o("<div />",{class:"scaffold-content-navigation-component","data-component":t,id:"navigationComponent-"+a})),e([t],e=>{e.initialize("#navigationComponent-"+a),i.NavigationContainer.show(t),n.loadedNavigationComponentId=t})}openInNavFrame(e,t,n){const o=e+(t?(-1!==e.indexOf("?")?"&":"?")+t:""),a=i.NavigationContainer.getUrl(),d=i.NavigationContainer.setUrl(e,new r("typo3.openInNavFrame",n));return a!==o&&("resolved"===d.state()?i.NavigationContainer.refresh():d.then(i.NavigationContainer.refresh)),d}openInContentFrame(e,t,n){let o;if(top.nextLoadModuleUrl)o=i.ContentContainer.setUrl(top.nextLoadModuleUrl,new r("typo3.openInContentFrame",n)),top.nextLoadModuleUrl="";else{const a=e+(t?(-1!==e.indexOf("?")?"&":"?")+t:"");o=i.ContentContainer.setUrl(a,new r("typo3.openInContentFrame",n))}return o}}return top.TYPO3.ModuleMenu||(top.TYPO3.ModuleMenu={App:new l}),top.TYPO3.ModuleMenu});
\ No newline at end of file
+define(["require","exports","./Enum/Viewport/ScaffoldIdentifier","jquery","./Storage/Persistent","./Viewport","./Event/ClientRequest","./Event/TriggerRequest"],function(e,t,n,o,a,i,d,r){"use strict";class l{constructor(){this.loadedModule=null,this.loadedNavigationComponentId="",o(()=>this.initialize())}static getCollapsedMainMenuItems(){return a.isset("modulemenu")?JSON.parse(a.get("modulemenu")):{}}static addCollapsedMainMenuItem(e){const t=l.getCollapsedMainMenuItems();t[e]=!0,a.set("modulemenu",JSON.stringify(t))}static removeCollapseMainMenuItem(e){const t=this.getCollapsedMainMenuItems();delete t[e],a.set("modulemenu",JSON.stringify(t))}static includeId(e,t){if(!e.navigationComponentId&&!e.navigationFrameScript)return t;let n="";return n="TYPO3/CMS/Backend/PageTree/PageTreeElement"===e.navigationComponentId?"web":e.name.split("_")[0],top.fsMod.recentIds[n]&&(t="id="+top.fsMod.recentIds[n]+"&"+t),t}static toggleMenu(e){i.NavigationContainer.cleanup();const t=o(n.ScaffoldIdentifierEnum.scaffold);void 0===e&&(e=t.hasClass("scaffold-modulemenu-expanded")),t.toggleClass("scaffold-modulemenu-expanded",!e),e||o(".scaffold").removeClass("scaffold-search-expanded").removeClass("scaffold-toolbar-expanded"),a.set("BackendComponents.States.typo3-module-menu",{collapsed:e}),i.doLayout()}static getRecordFromName(e){const t=o("#"+e);return{name:e,navigationComponentId:t.data("navigationcomponentid"),navigationFrameScript:t.data("navigationframescript"),navigationFrameScriptParam:t.data("navigationframescriptparameters"),link:t.find("a").data("link")}}static highlightModuleMenuItem(e){o(".modulemenu-item.active").removeClass("active"),o("#"+e).addClass("active")}refreshMenu(){o.ajax(TYPO3.settings.ajaxUrls.modulemenu).done(e=>{o("#menu").replaceWith(e.menu),top.currentModuleLoaded&&l.highlightModuleMenuItem(top.currentModuleLoaded),i.doLayout()})}reloadFrames(){i.NavigationContainer.refresh(),i.ContentContainer.refresh()}showModule(e,t,n){t=t||"";const o=l.getRecordFromName(e);return this.loadModuleComponents(o,t,new d("typo3.showModule",n?n.originalEvent:null))}initialize(){const e=this;let t=o.Deferred();if(t.resolve(),top.startInModule&&top.startInModule[0]&&o("#"+top.startInModule[0]).length>0)t=this.showModule(top.startInModule[0],top.startInModule[1]);else{const e=o(".t3js-mainmodule:first");e.attr("id")&&(t=this.showModule(e.attr("id")))}t.then(()=>{e.initializeEvents()})}initializeEvents(){o(document).on("click",".modulemenu-group .modulemenu-group-header",e=>{const t=o(e.currentTarget).parent(".modulemenu-group"),n=t.find(".modulemenu-group-container");i.NavigationContainer.cleanup(),t.hasClass("expanded")?(l.addCollapsedMainMenuItem(t.attr("id")),t.addClass("collapsed").removeClass("expanded"),n.stop().slideUp().promise().done(()=>{i.doLayout()})):(l.removeCollapseMainMenuItem(t.attr("id")),t.addClass("expanded").removeClass("collapsed"),n.stop().slideDown().promise().done(()=>{i.doLayout()}))}),o(document).on("click",".modulemenu-item,.t3-menuitem-submodule",e=>{e.preventDefault(),this.showModule(o(e.currentTarget).attr("id"),"",e)}),o(document).on("click",".t3js-topbar-button-modulemenu",e=>{e.preventDefault(),l.toggleMenu()}),o(document).on("click",".t3js-scaffold-content-overlay",e=>{e.preventDefault(),l.toggleMenu(!0)}),o(document).on("click",".t3js-topbar-button-navigationcomponent",e=>{e.preventDefault(),i.NavigationContainer.toggle()})}loadModuleComponents(e,t,n){const a=e.name,d=i.ContentContainer.beforeSetUrl(n);return d.then(o.proxy(()=>{e.navigationComponentId?this.loadNavigationComponent(e.navigationComponentId):e.navigationFrameScript?(i.NavigationContainer.show("typo3-navigationIframe"),this.openInNavFrame(e.navigationFrameScript,e.navigationFrameScriptParam,new r("typo3.loadModuleComponents",n))):i.NavigationContainer.hide(),l.highlightModuleMenuItem(a),this.loadedModule=a,t=l.includeId(e,t),this.openInContentFrame(e.link,t,new r("typo3.loadModuleComponents",n)),top.currentSubScript=e.link,top.currentModuleLoaded=a,i.doLayout()},this)),d}loadNavigationComponent(t){const n=this;if(i.NavigationContainer.show(t),t===this.loadedNavigationComponentId)return;const a=t.replace(/[\/]/g,"_");""!==this.loadedNavigationComponentId&&o("#navigationComponent-"+this.loadedNavigationComponentId.replace(/[\/]/g,"_")).hide(),o('.t3js-scaffold-content-navigation [data-component="'+t+'"]').length<1&&o(".t3js-scaffold-content-navigation").append(o("<div />",{class:"scaffold-content-navigation-component","data-component":t,id:"navigationComponent-"+a})),e([t],e=>{e.initialize("#navigationComponent-"+a),i.NavigationContainer.show(t),n.loadedNavigationComponentId=t})}openInNavFrame(e,t,n){const o=e+(t?(e.includes("?")?"&":"?")+t:""),a=i.NavigationContainer.getUrl(),d=i.NavigationContainer.setUrl(e,new r("typo3.openInNavFrame",n));return a!==o&&("resolved"===d.state()?i.NavigationContainer.refresh():d.then(i.NavigationContainer.refresh)),d}openInContentFrame(e,t,n){let o;if(top.nextLoadModuleUrl)o=i.ContentContainer.setUrl(top.nextLoadModuleUrl,new r("typo3.openInContentFrame",n)),top.nextLoadModuleUrl="";else{const a=e+(t?(e.includes("?")?"&":"?")+t:"");o=i.ContentContainer.setUrl(a,new r("typo3.openInContentFrame",n))}return o}}return top.TYPO3.ModuleMenu||(top.TYPO3.ModuleMenu={App:new l}),top.TYPO3.ModuleMenu});
\ No newline at end of file
index 6e6807a..b21b578 100644 (file)
@@ -10,4 +10,4 @@
  *
  * The TYPO3 project - inspiring people to share!
  */
-define(["require","exports"],function(t,e){"use strict";return class{static trimExplode(t,e){return e.split(t).map(t=>t.trim()).filter(t=>""!==t)}static intExplode(t,e,r=!1){return e.split(t).map(t=>parseInt(t,10)).filter(t=>!isNaN(t)||r&&0===t)}static isNumber(t){return!isNaN(parseFloat(t.toString()))&&isFinite(t)}static getParameterFromUrl(t,e){if("function"!=typeof t.split)return"";const r=t.split("?");let i="";if(r.length>=2){const t=r.join("?"),n=encodeURIComponent(e)+"=",s=t.split(/[&;]/g);for(let t=s.length;t-- >0;)if(-1!==s[t].lastIndexOf(n,0)){i=s[t].split("=")[1];break}}return i}static updateQueryStringParameter(t,e,r){const i=new RegExp("([?&])"+e+"=.*?(&|$)","i"),n=-1!==t.indexOf("?")?"&":"?";return t.match(i)?t.replace(i,"$1"+e+"="+r+"$2"):t+n+e+"="+r}static convertFormToObject(t){const e={},r=t.querySelectorAll("input, select, textarea");for(let t=0;t<r.length;++t){const i=r[t],n=i.name,s=i.value;n&&(e[n]=s)}return e}}});
\ No newline at end of file
+define(["require","exports"],function(t,e){"use strict";return class{static trimExplode(t,e){return e.split(t).map(t=>t.trim()).filter(t=>""!==t)}static intExplode(t,e,r=!1){return e.split(t).map(t=>parseInt(t,10)).filter(t=>!isNaN(t)||r&&0===t)}static isNumber(t){return!isNaN(parseFloat(t.toString()))&&isFinite(t)}static getParameterFromUrl(t,e){if("function"!=typeof t.split)return"";const r=t.split("?");let i="";if(r.length>=2){const t=r.join("?"),n=encodeURIComponent(e)+"=",s=t.split(/[&;]/g);for(let t=s.length;t-- >0;)if(-1!==s[t].lastIndexOf(n,0)){i=s[t].split("=")[1];break}}return i}static updateQueryStringParameter(t,e,r){const i=new RegExp("([?&])"+e+"=.*?(&|$)","i"),n=t.includes("?")?"&":"?";return t.match(i)?t.replace(i,"$1"+e+"="+r+"$2"):t+n+e+"="+r}static convertFormToObject(t){const e={},r=t.querySelectorAll("input, select, textarea");for(let t=0;t<r.length;++t){const i=r[t],n=i.name,s=i.value;n&&(e[n]=s)}return e}}});
\ No newline at end of file
index 9d9b602..a9d0132 100644 (file)
@@ -10,4 +10,4 @@
  *
  * The TYPO3 project - inspiring people to share!
  */
-define(["require","exports","../AbstractInteractableModule","jquery","../../Router","TYPO3/CMS/Backend/Modal","TYPO3/CMS/Backend/Notification","bootstrap"],function(e,t,r,a,s,o,i){"use strict";return new class extends r.AbstractInteractableModule{constructor(){super(...arguments),this.selectorToggleAllTrigger=".t3js-localConfiguration-toggleAll",this.selectorWriteTrigger=".t3js-localConfiguration-write",this.selectorSearchTrigger=".t3js-localConfiguration-search"}initialize(t){this.currentModal=t,this.getContent(),t.on("click",this.selectorWriteTrigger,()=>{this.write()}),t.on("click",this.selectorToggleAllTrigger,()=>{const e=this.getModalBody().find(".panel-collapse"),t=e.eq(0).hasClass("in")?"hide":"show";e.collapse(t)}),jQuery.expr[":"].contains=jQuery.expr.createPseudo(e=>t=>jQuery(t).text().toUpperCase().indexOf(e.toUpperCase())>=0),t.on("keydown",e=>{const r=t.find(this.selectorSearchTrigger);e.ctrlKey||e.metaKey?"f"===String.fromCharCode(e.which).toLowerCase()&&(e.preventDefault(),r.focus()):27===e.keyCode&&(e.preventDefault(),r.val("").focus())}),t.on("keyup",this.selectorSearchTrigger,r=>{const s=a(r.target).val(),o=t.find(this.selectorSearchTrigger);t.find("div.item").each((e,t)=>{const r=a(t);a(":contains("+s+")",r).length>0||a('input[value*="'+s+'"]',r).length>0?r.removeClass("hidden").addClass("searchhit"):r.removeClass("searchhit").addClass("hidden")}),t.find(".searchhit").parent().collapse("show"),e(["jquery.clearable"],()=>{o.clearable().focus()})})}getContent(){const e=this.getModalBody();a.ajax({url:s.getUrl("localConfigurationGetContent"),cache:!1,success:t=>{!0===t.success&&(Array.isArray(t.status)&&t.status.forEach(e=>{i.success(e.title,e.message)}),e.html(t.html),o.setButtons(t.buttons))},error:t=>{s.handleAjaxError(t,e)}})}write(){const e=this.getModalBody(),t=this.getModuleContent().data("local-configuration-write-token"),r={};this.findInModal(".t3js-localConfiguration-pathValue").each((e,t)=>{const s=a(t);"checkbox"===s.attr("type")?t.checked?r[s.data("path")]="1":r[s.data("path")]="0":r[s.data("path")]=s.val()}),a.ajax({url:s.getUrl(),method:"POST",data:{install:{action:"localConfigurationWrite",token:t,configurationValues:r}},cache:!1,success:e=>{!0===e.success&&Array.isArray(e.status)?e.status.forEach(e=>{i.showMessage(e.title,e.message,e.severity)}):i.error("Something went wrong")},error:t=>{s.handleAjaxError(t,e)}})}}});
\ No newline at end of file
+define(["require","exports","../AbstractInteractableModule","jquery","../../Router","TYPO3/CMS/Backend/Modal","TYPO3/CMS/Backend/Notification","bootstrap"],function(e,t,r,a,s,o,i){"use strict";return new class extends r.AbstractInteractableModule{constructor(){super(...arguments),this.selectorToggleAllTrigger=".t3js-localConfiguration-toggleAll",this.selectorWriteTrigger=".t3js-localConfiguration-write",this.selectorSearchTrigger=".t3js-localConfiguration-search"}initialize(t){this.currentModal=t,this.getContent(),t.on("click",this.selectorWriteTrigger,()=>{this.write()}),t.on("click",this.selectorToggleAllTrigger,()=>{const e=this.getModalBody().find(".panel-collapse"),t=e.eq(0).hasClass("in")?"hide":"show";e.collapse(t)}),jQuery.expr[":"].contains=jQuery.expr.createPseudo(e=>t=>jQuery(t).text().toUpperCase().includes(e.toUpperCase())),t.on("keydown",e=>{const r=t.find(this.selectorSearchTrigger);e.ctrlKey||e.metaKey?"f"===String.fromCharCode(e.which).toLowerCase()&&(e.preventDefault(),r.focus()):27===e.keyCode&&(e.preventDefault(),r.val("").focus())}),t.on("keyup",this.selectorSearchTrigger,r=>{const s=a(r.target).val(),o=t.find(this.selectorSearchTrigger);t.find("div.item").each((e,t)=>{const r=a(t);a(":contains("+s+")",r).length>0||a('input[value*="'+s+'"]',r).length>0?r.removeClass("hidden").addClass("searchhit"):r.removeClass("searchhit").addClass("hidden")}),t.find(".searchhit").parent().collapse("show"),e(["jquery.clearable"],()=>{o.clearable().focus()})})}getContent(){const e=this.getModalBody();a.ajax({url:s.getUrl("localConfigurationGetContent"),cache:!1,success:t=>{!0===t.success&&(Array.isArray(t.status)&&t.status.forEach(e=>{i.success(e.title,e.message)}),e.html(t.html),o.setButtons(t.buttons))},error:t=>{s.handleAjaxError(t,e)}})}write(){const e=this.getModalBody(),t=this.getModuleContent().data("local-configuration-write-token"),r={};this.findInModal(".t3js-localConfiguration-pathValue").each((e,t)=>{const s=a(t);"checkbox"===s.attr("type")?t.checked?r[s.data("path")]="1":r[s.data("path")]="0":r[s.data("path")]=s.val()}),a.ajax({url:s.getUrl(),method:"POST",data:{install:{action:"localConfigurationWrite",token:t,configurationValues:r}},cache:!1,success:e=>{!0===e.success&&Array.isArray(e.status)?e.status.forEach(e=>{i.showMessage(e.title,e.message,e.severity)}):i.error("Something went wrong")},error:t=>{s.handleAjaxError(t,e)}})}}});
\ No newline at end of file
index 0ff8def..6745d3d 100644 (file)
@@ -10,4 +10,4 @@
  *
  * The TYPO3 project - inspiring people to share!
  */
-define(["require","exports","../AbstractInteractableModule","jquery","../../Router","TYPO3/CMS/Backend/Notification","bootstrap"],function(e,t,s,a,o,n){"use strict";class l extends s.AbstractInteractableModule{constructor(){super(...arguments),this.selectorFulltextSearch=".t3js-upgradeDocs-fulltext-search",this.selectorChosenField=".t3js-upgradeDocs-chosen-select",this.selectorChangeLogsForVersionContainer=".t3js-version-changes",this.selectorChangeLogsForVersion=".t3js-changelog-list",this.selectorUpgradeDoc=".t3js-upgrade-doc"}static trimExplodeAndUnique(e,t){const s=[],o=t.split(e);for(let e=0;e<o.length;e++){const t=o[e].trim();t.length>0&&-1===a.inArray(t,s)&&s.push(t)}return s}initialize(t){this.currentModal=t,window.location!==window.parent.location?top.require(["TYPO3/CMS/Install/chosen.jquery.min"],()=>{this.getContent()}):e(["TYPO3/CMS/Install/chosen.jquery.min"],()=>{this.getContent()}),t.on("click",".t3js-upgradeDocs-markRead",e=>{this.markRead(e.target)}),t.on("click",".t3js-upgradeDocs-unmarkRead",e=>{this.unmarkRead(e.target)}),jQuery.expr[":"].contains=jQuery.expr.createPseudo(e=>t=>jQuery(t).text().toUpperCase().indexOf(e.toUpperCase())>=0),e(["jquery.clearable"],()=>{t.find(this.selectorFulltextSearch).clearable().focus()})}getContent(){const e=this.getModalBody();e.on("show.bs.collapse",this.selectorUpgradeDoc,e=>{this.renderTags(a(e.currentTarget))}),a.ajax({url:o.getUrl("upgradeDocsGetContent"),cache:!1,success:t=>{!0===t.success&&"undefined"!==t.html&&t.html.length>0&&(e.empty().append(t.html),this.initializeFullTextSearch(),this.initializeChosenSelector(),this.loadChangelogs())},error:t=>{o.handleAjaxError(t,e)}})}loadChangelogs(){const e=[],t=this.getModalBody();this.findInModal(this.selectorChangeLogsForVersionContainer).each((s,l)=>{const i=a.ajax({url:o.getUrl("upgradeDocsGetChangelogForVersion"),cache:!1,data:{install:{version:l.dataset.version}},success:e=>{if(!0===e.success){const t=a(l),s=t.find(this.selectorChangeLogsForVersion);s.html(e.html),this.moveNotRelevantDocuments(s),t.find(".t3js-panel-loading").remove()}else n.error("Something went wrong")},error:e=>{o.handleAjaxError(e,t)}});e.push(i)}),a.when.apply(a,e).done(()=>{this.fulltextSearchField.prop("disabled",!1),this.appendItemsToChosenSelector()})}initializeFullTextSearch(){this.fulltextSearchField=this.findInModal(this.selectorFulltextSearch),this.fulltextSearchField.clearable().focus(),this.initializeChosenSelector(),this.fulltextSearchField.on("keyup",()=>{this.combinedFilterSearch()})}initializeChosenSelector(){this.chosenField=this.getModalBody().find(this.selectorChosenField);const e={".chosen-select":{width:"100%",placeholder_text_multiple:"tags"},".chosen-select-deselect":{allow_single_deselect:!0},".chosen-select-no-single":{disable_search_threshold:10},".chosen-select-no-results":{no_results_text:"Oops, nothing found!"},".chosen-select-width":{width:"100%"}};for(const t in e)e.hasOwnProperty(t)&&this.findInModal(t).chosen(e[t]);this.chosenField.on("change",()=>{this.combinedFilterSearch()})}appendItemsToChosenSelector(){let e="";a(this.findInModal(this.selectorUpgradeDoc)).each((t,s)=>{e+=a(s).data("item-tags")+","});const t=l.trimExplodeAndUnique(",",e).sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase()));this.chosenField.prop("disabled",!1),a.each(t,(e,t)=>{this.chosenField.append(a("<option>").text(t))}),this.chosenField.trigger("chosen:updated")}combinedFilterSearch(){const e=this.getModalBody(),t=e.find("div.item");if(this.chosenField.val().length<1&&this.fulltextSearchField.val().length<1)return a(".panel-version:not(:first) > .panel-collapse").collapse("hide"),t.removeClass("hidden searchhit filterhit"),!1;if(t.addClass("hidden").removeClass("searchhit filterhit"),this.chosenField.val().length>0){t.addClass("hidden").removeClass("filterhit");const s=[],o=[];a.each(this.chosenField.val(),(e,t)=>{const a='[data-item-tags*="'+t+'"]';t.indexOf(":")>0?s.push(a):o.push(a)});const n=o.join(""),l=[];if(s.length)for(let e=0;e<s.length;e++)l.push(n+s[e]);else l.push(n);const i=l.join(",");e.find(i).removeClass("hidden").addClass("searchhit filterhit")}else t.addClass("filterhit").removeClass("hidden");const s=this.fulltextSearchField.val();return e.find("div.item.filterhit").each((e,t)=>{const o=a(t);a(":contains("+s+")",o).length>0||a('input[value*="'+s+'"]',o).length>0?o.removeClass("hidden").addClass("searchhit"):o.removeClass("searchhit").addClass("hidden")}),e.find(".searchhit").closest(".panel-collapse").collapse("show"),e.find(".panel-version").each((e,t)=>{const s=a(t);s.find(".searchhit",".filterhit").length<1&&s.find(" > .panel-collapse").collapse("hide")}),!0}renderTags(e){const t=e.find(".t3js-tags");if(0===t.children().length){e.data("item-tags").split(",").forEach(e=>{t.append(a("<span />",{class:"label"}).text(e))})}}moveNotRelevantDocuments(e){e.find('[data-item-state="read"]').appendTo(this.findInModal(".panel-body-read")),e.find('[data-item-state="notAffected"]').appendTo(this.findInModal(".panel-body-not-affected"))}markRead(e){const t=this.getModalBody(),s=this.getModuleContent().data("upgrade-docs-mark-read-token"),n=a(e).closest("a");n.toggleClass("t3js-upgradeDocs-unmarkRead t3js-upgradeDocs-markRead"),n.find("i").toggleClass("fa-check fa-ban"),n.closest(".panel").appendTo(this.findInModal(".panel-body-read")),a.ajax({method:"POST",url:o.getUrl(),data:{install:{ignoreFile:n.data("filepath"),token:s,action:"upgradeDocsMarkRead"}},error:e=>{o.handleAjaxError(e,t)}})}unmarkRead(e){const t=this.getModalBody(),s=this.getModuleContent().data("upgrade-docs-unmark-read-token"),n=a(e).closest("a"),l=n.closest(".panel").data("item-version");n.toggleClass("t3js-upgradeDocs-markRead t3js-upgradeDocs-unmarkRead"),n.find("i").toggleClass("fa-check fa-ban"),n.closest(".panel").appendTo(this.findInModal('*[data-group-version="'+l+'"] .panel-body')),a.ajax({method:"POST",url:o.getUrl(),data:{install:{ignoreFile:n.data("filepath"),token:s,action:"upgradeDocsUnmarkRead"}},error:e=>{o.handleAjaxError(e,t)}})}}return new l});
\ No newline at end of file
+define(["require","exports","../AbstractInteractableModule","jquery","../../Router","TYPO3/CMS/Backend/Notification","bootstrap"],function(e,t,s,a,o,n){"use strict";class l extends s.AbstractInteractableModule{constructor(){super(...arguments),this.selectorFulltextSearch=".t3js-upgradeDocs-fulltext-search",this.selectorChosenField=".t3js-upgradeDocs-chosen-select",this.selectorChangeLogsForVersionContainer=".t3js-version-changes",this.selectorChangeLogsForVersion=".t3js-changelog-list",this.selectorUpgradeDoc=".t3js-upgrade-doc"}static trimExplodeAndUnique(e,t){const s=[],o=t.split(e);for(let e=0;e<o.length;e++){const t=o[e].trim();t.length>0&&-1===a.inArray(t,s)&&s.push(t)}return s}initialize(t){this.currentModal=t,window.location!==window.parent.location?top.require(["TYPO3/CMS/Install/chosen.jquery.min"],()=>{this.getContent()}):e(["TYPO3/CMS/Install/chosen.jquery.min"],()=>{this.getContent()}),t.on("click",".t3js-upgradeDocs-markRead",e=>{this.markRead(e.target)}),t.on("click",".t3js-upgradeDocs-unmarkRead",e=>{this.unmarkRead(e.target)}),jQuery.expr[":"].contains=jQuery.expr.createPseudo(e=>t=>jQuery(t).text().toUpperCase().includes(e.toUpperCase())),e(["jquery.clearable"],()=>{t.find(this.selectorFulltextSearch).clearable().focus()})}getContent(){const e=this.getModalBody();e.on("show.bs.collapse",this.selectorUpgradeDoc,e=>{this.renderTags(a(e.currentTarget))}),a.ajax({url:o.getUrl("upgradeDocsGetContent"),cache:!1,success:t=>{!0===t.success&&"undefined"!==t.html&&t.html.length>0&&(e.empty().append(t.html),this.initializeFullTextSearch(),this.initializeChosenSelector(),this.loadChangelogs())},error:t=>{o.handleAjaxError(t,e)}})}loadChangelogs(){const e=[],t=this.getModalBody();this.findInModal(this.selectorChangeLogsForVersionContainer).each((s,l)=>{const i=a.ajax({url:o.getUrl("upgradeDocsGetChangelogForVersion"),cache:!1,data:{install:{version:l.dataset.version}},success:e=>{if(!0===e.success){const t=a(l),s=t.find(this.selectorChangeLogsForVersion);s.html(e.html),this.moveNotRelevantDocuments(s),t.find(".t3js-panel-loading").remove()}else n.error("Something went wrong")},error:e=>{o.handleAjaxError(e,t)}});e.push(i)}),a.when.apply(a,e).done(()=>{this.fulltextSearchField.prop("disabled",!1),this.appendItemsToChosenSelector()})}initializeFullTextSearch(){this.fulltextSearchField=this.findInModal(this.selectorFulltextSearch),this.fulltextSearchField.clearable().focus(),this.initializeChosenSelector(),this.fulltextSearchField.on("keyup",()=>{this.combinedFilterSearch()})}initializeChosenSelector(){this.chosenField=this.getModalBody().find(this.selectorChosenField);const e={".chosen-select":{width:"100%",placeholder_text_multiple:"tags"},".chosen-select-deselect":{allow_single_deselect:!0},".chosen-select-no-single":{disable_search_threshold:10},".chosen-select-no-results":{no_results_text:"Oops, nothing found!"},".chosen-select-width":{width:"100%"}};for(const t in e)e.hasOwnProperty(t)&&this.findInModal(t).chosen(e[t]);this.chosenField.on("change",()=>{this.combinedFilterSearch()})}appendItemsToChosenSelector(){let e="";a(this.findInModal(this.selectorUpgradeDoc)).each((t,s)=>{e+=a(s).data("item-tags")+","});const t=l.trimExplodeAndUnique(",",e).sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase()));this.chosenField.prop("disabled",!1),a.each(t,(e,t)=>{this.chosenField.append(a("<option>").text(t))}),this.chosenField.trigger("chosen:updated")}combinedFilterSearch(){const e=this.getModalBody(),t=e.find("div.item");if(this.chosenField.val().length<1&&this.fulltextSearchField.val().length<1)return a(".panel-version:not(:first) > .panel-collapse").collapse("hide"),t.removeClass("hidden searchhit filterhit"),!1;if(t.addClass("hidden").removeClass("searchhit filterhit"),this.chosenField.val().length>0){t.addClass("hidden").removeClass("filterhit");const s=[],o=[];a.each(this.chosenField.val(),(e,t)=>{const a='[data-item-tags*="'+t+'"]';t.contains(":",1)?s.push(a):o.push(a)});const n=o.join(""),l=[];if(s.length)for(let e=0;e<s.length;e++)l.push(n+s[e]);else l.push(n);const i=l.join(",");e.find(i).removeClass("hidden").addClass("searchhit filterhit")}else t.addClass("filterhit").removeClass("hidden");const s=this.fulltextSearchField.val();return e.find("div.item.filterhit").each((e,t)=>{const o=a(t);a(":contains("+s+")",o).length>0||a('input[value*="'+s+'"]',o).length>0?o.removeClass("hidden").addClass("searchhit"):o.removeClass("searchhit").addClass("hidden")}),e.find(".searchhit").closest(".panel-collapse").collapse("show"),e.find(".panel-version").each((e,t)=>{const s=a(t);s.find(".searchhit",".filterhit").length<1&&s.find(" > .panel-collapse").collapse("hide")}),!0}renderTags(e){const t=e.find(".t3js-tags");if(0===t.children().length){e.data("item-tags").split(",").forEach(e=>{t.append(a("<span />",{class:"label"}).text(e))})}}moveNotRelevantDocuments(e){e.find('[data-item-state="read"]').appendTo(this.findInModal(".panel-body-read")),e.find('[data-item-state="notAffected"]').appendTo(this.findInModal(".panel-body-not-affected"))}markRead(e){const t=this.getModalBody(),s=this.getModuleContent().data("upgrade-docs-mark-read-token"),n=a(e).closest("a");n.toggleClass("t3js-upgradeDocs-unmarkRead t3js-upgradeDocs-markRead"),n.find("i").toggleClass("fa-check fa-ban"),n.closest(".panel").appendTo(this.findInModal(".panel-body-read")),a.ajax({method:"POST",url:o.getUrl(),data:{install:{ignoreFile:n.data("filepath"),token:s,action:"upgradeDocsMarkRead"}},error:e=>{o.handleAjaxError(e,t)}})}unmarkRead(e){const t=this.getModalBody(),s=this.getModuleContent().data("upgrade-docs-unmark-read-token"),n=a(e).closest("a"),l=n.closest(".panel").data("item-version");n.toggleClass("t3js-upgradeDocs-markRead t3js-upgradeDocs-unmarkRead"),n.find("i").toggleClass("fa-check fa-ban"),n.closest(".panel").appendTo(this.findInModal('*[data-group-version="'+l+'"] .panel-body')),a.ajax({method:"POST",url:o.getUrl(),data:{install:{ignoreFile:n.data("filepath"),token:s,action:"upgradeDocsUnmarkRead"}},error:e=>{o.handleAjaxError(e,t)}})}}return new l});
\ No newline at end of file
index 113d435..9e72fcb 100644 (file)
@@ -10,4 +10,4 @@
  *
  * The TYPO3 project - inspiring people to share!
  */
-define(["require","exports","jquery"],function(t,e,r){"use strict";return new class{constructor(){this.thisScriptUrl="",this.urlParameters={},this.parameters={},this.addOnParams="",this.additionalLinkAttributes={},this.loadTarget=(t=>{const e=r(t.currentTarget);r(".t3js-linkTarget").val(e.val()),e.get(0).selectedIndex=0}),r(()=>{const t=r("body").data();this.thisScriptUrl=t.thisScriptUrl,this.urlParameters=t.urlParameters,this.parameters=t.parameters,this.addOnParams=t.addOnParams,this.linkAttributeFields=t.linkAttributeFields,r(".t3js-targetPreselect").on("change",this.loadTarget),r("form.t3js-dummyform").on("submit",t=>{t.preventDefault()})})}getLinkAttributeValues(){const t={};return r.each(this.linkAttributeFields,(e,i)=>{const s=r('[name="l'+i+'"]').val();s&&(t[i]=s)}),r.extend(t,this.additionalLinkAttributes),t}encodeGetParameters(t,e,r){const i=[];for(let s in t)if(t.hasOwnProperty(s)){const n=e?e+"["+s+"]":s,a=t[s];-1===r.indexOf(n+"=")&&i.push("object"==typeof a?this.encodeGetParameters(a,n,r):encodeURIComponent(n)+"="+encodeURIComponent(a))}return"&"+i.join("&")}setAdditionalLinkAttribute(t,e){this.additionalLinkAttributes[t]=e}finalizeFunction(t){throw"The link browser requires the finalizeFunction to be set. Seems like you discovered a major bug."}}});
\ No newline at end of file
+define(["require","exports","jquery"],function(t,e,r){"use strict";return new class{constructor(){this.thisScriptUrl="",this.urlParameters={},this.parameters={},this.addOnParams="",this.additionalLinkAttributes={},this.loadTarget=(t=>{const e=r(t.currentTarget);r(".t3js-linkTarget").val(e.val()),e.get(0).selectedIndex=0}),r(()=>{const t=r("body").data();this.thisScriptUrl=t.thisScriptUrl,this.urlParameters=t.urlParameters,this.parameters=t.parameters,this.addOnParams=t.addOnParams,this.linkAttributeFields=t.linkAttributeFields,r(".t3js-targetPreselect").on("change",this.loadTarget),r("form.t3js-dummyform").on("submit",t=>{t.preventDefault()})})}getLinkAttributeValues(){const t={};return r.each(this.linkAttributeFields,(e,i)=>{const s=r('[name="l'+i+'"]').val();s&&(t[i]=s)}),r.extend(t,this.additionalLinkAttributes),t}encodeGetParameters(t,e,r){const i=[];for(let s in t)if(t.hasOwnProperty(s)){const n=e?e+"["+s+"]":s,a=t[s];r.includes(n+"=")||i.push("object"==typeof a?this.encodeGetParameters(a,n,r):encodeURIComponent(n)+"="+encodeURIComponent(a))}return"&"+i.join("&")}setAdditionalLinkAttribute(t,e){this.additionalLinkAttributes[t]=e}finalizeFunction(t){throw"The link browser requires the finalizeFunction to be set. Seems like you discovered a major bug."}}});
\ No newline at end of file
index 5e710e4..3ea8751 100644 (file)
@@ -10,4 +10,4 @@
  *
  * The TYPO3 project - inspiring people to share!
  */
-define(["require","exports","jquery","./LinkBrowser"],function(e,t,n,r){"use strict";return new class{constructor(){n(()=>{n("#ltelephoneform").on("submit",e=>{e.preventDefault();let t=n(e.currentTarget).find('[name="ltelephone"]').val();"tel:"!==t&&(0===t.indexOf("tel:")&&(t=t.substr(4)),r.finalizeFunction("tel:"+t))})})}}});
\ No newline at end of file
+define(["require","exports","jquery","./LinkBrowser"],function(e,t,r,n){"use strict";return new class{constructor(){r(()=>{r("#ltelephoneform").on("submit",e=>{e.preventDefault();let t=r(e.currentTarget).find('[name="ltelephone"]').val();"tel:"!==t&&(t.startsWith("tel:")&&(t=t.substr(4)),n.finalizeFunction("tel:"+t))})})}}});
\ No newline at end of file
index 2da081d..8386818 100644 (file)
@@ -10,4 +10,4 @@
  *
  * The TYPO3 project - inspiring people to share!
  */
-define(["require","exports","jquery","TYPO3/CMS/Backend/ModuleMenu","TYPO3/CMS/Backend/Viewport"],function(e,t,o,a,r){"use strict";var s,n;!function(e){e.containerSelector="#typo3-cms-workspaces-backend-toolbaritems-workspaceselectortoolbaritem",e.activeMenuItemLinkSelector=".dropdown-menu .selected",e.menuItemSelector=".t3js-workspace-item",e.menuItemLinkSelector=".t3js-workspaces-switchlink",e.toolbarItemSelector=".dropdown-toggle",e.workspaceModuleLinkSelector=".t3js-workspaces-modulelink"}(s||(s={})),function(e){e.workspaceBodyClass="typo3-in-workspace",e.workspacesTitleInToolbarClass="toolbar-item-name"}(n||(n={}));class c{static refreshPageTree(){r.NavigationContainer&&r.NavigationContainer.PageTree&&r.NavigationContainer.PageTree.refreshTree()}static updateTopBar(e){if(o("."+n.workspacesTitleInToolbarClass,s.containerSelector).remove(),e&&e.length){let t=o("<span>",{class:n.workspacesTitleInToolbarClass}).text(e);o(s.toolbarItemSelector,s.containerSelector).append(t)}}static updateBackendContext(e=""){let t="";TYPO3.configuration.inWorkspace?(o("body").addClass(n.workspaceBodyClass),t=e||TYPO3.lang["Workspaces.workspaceTitle"]):o("body").removeClass(n.workspaceBodyClass),c.updateTopBar(t)}constructor(){r.Topbar.Toolbar.registerEvent(()=>{this.initializeEvents(),c.updateBackendContext()})}performWorkspaceSwitch(e,t){top.TYPO3.Backend.workspaceTitle=t,top.TYPO3.configuration.inWorkspace=0!==e,c.updateBackendContext(t);o(s.activeMenuItemLinkSelector+" i",s.containerSelector).removeClass("fa fa-check").addClass("fa fa-empty-empty"),o(s.activeMenuItemLinkSelector,s.containerSelector).removeClass("selected");const a=o(s.menuItemLinkSelector+"[data-workspaceid="+e+"]",s.containerSelector).closest(s.menuItemSelector);a.find("i").removeClass("fa fa-empty-empty").addClass("fa fa-check"),a.addClass("selected")}initializeEvents(){o(s.containerSelector).on("click",s.workspaceModuleLinkSelector,e=>{e.preventDefault(),a.App.showModule(e.currentTarget.dataset.module)}),o(s.containerSelector).on("click",s.menuItemLinkSelector,e=>{e.preventDefault(),this.switchWorkspace(parseInt(e.currentTarget.dataset.workspaceid,10))})}switchWorkspace(e){o.ajax({url:TYPO3.settings.ajaxUrls.workspace_switch,type:"post",data:{workspaceId:e,pageId:top.fsMod.recentIds.web},success:e=>{if(e.workspaceId||(e.workspaceId=0),this.performWorkspaceSwitch(parseInt(e.workspaceId,10),e.title),e.pageId){top.fsMod.recentIds.web=e.pageId;let t=TYPO3.Backend.ContentContainer.getUrl();t+=(-1===t.indexOf("?")?"?":"&")+"&id="+e.pageId,c.refreshPageTree(),r.ContentContainer.setUrl(t)}else 0===top.currentModuleLoaded.indexOf("web_")?(c.refreshPageTree(),a.App.reloadFrames()):TYPO3.configuration.pageModule&&a.App.showModule(TYPO3.configuration.pageModule);a.App.refreshMenu()}})}}const i=new c;return TYPO3.WorkspacesMenu=i,i});
\ No newline at end of file
+define(["require","exports","jquery","TYPO3/CMS/Backend/ModuleMenu","TYPO3/CMS/Backend/Viewport"],function(e,t,o,a,r){"use strict";var s,n;!function(e){e.containerSelector="#typo3-cms-workspaces-backend-toolbaritems-workspaceselectortoolbaritem",e.activeMenuItemLinkSelector=".dropdown-menu .selected",e.menuItemSelector=".t3js-workspace-item",e.menuItemLinkSelector=".t3js-workspaces-switchlink",e.toolbarItemSelector=".dropdown-toggle",e.workspaceModuleLinkSelector=".t3js-workspaces-modulelink"}(s||(s={})),function(e){e.workspaceBodyClass="typo3-in-workspace",e.workspacesTitleInToolbarClass="toolbar-item-name"}(n||(n={}));class c{static refreshPageTree(){r.NavigationContainer&&r.NavigationContainer.PageTree&&r.NavigationContainer.PageTree.refreshTree()}static updateTopBar(e){if(o("."+n.workspacesTitleInToolbarClass,s.containerSelector).remove(),e&&e.length){let t=o("<span>",{class:n.workspacesTitleInToolbarClass}).text(e);o(s.toolbarItemSelector,s.containerSelector).append(t)}}static updateBackendContext(e=""){let t="";TYPO3.configuration.inWorkspace?(o("body").addClass(n.workspaceBodyClass),t=e||TYPO3.lang["Workspaces.workspaceTitle"]):o("body").removeClass(n.workspaceBodyClass),c.updateTopBar(t)}constructor(){r.Topbar.Toolbar.registerEvent(()=>{this.initializeEvents(),c.updateBackendContext()})}performWorkspaceSwitch(e,t){top.TYPO3.Backend.workspaceTitle=t,top.TYPO3.configuration.inWorkspace=0!==e,c.updateBackendContext(t);o(s.activeMenuItemLinkSelector+" i",s.containerSelector).removeClass("fa fa-check").addClass("fa fa-empty-empty"),o(s.activeMenuItemLinkSelector,s.containerSelector).removeClass("selected");const a=o(s.menuItemLinkSelector+"[data-workspaceid="+e+"]",s.containerSelector).closest(s.menuItemSelector);a.find("i").removeClass("fa fa-empty-empty").addClass("fa fa-check"),a.addClass("selected")}initializeEvents(){o(s.containerSelector).on("click",s.workspaceModuleLinkSelector,e=>{e.preventDefault(),a.App.showModule(e.currentTarget.dataset.module)}),o(s.containerSelector).on("click",s.menuItemLinkSelector,e=>{e.preventDefault(),this.switchWorkspace(parseInt(e.currentTarget.dataset.workspaceid,10))})}switchWorkspace(e){o.ajax({url:TYPO3.settings.ajaxUrls.workspace_switch,type:"post",data:{workspaceId:e,pageId:top.fsMod.recentIds.web},success:e=>{if(e.workspaceId||(e.workspaceId=0),this.performWorkspaceSwitch(parseInt(e.workspaceId,10),e.title),e.pageId){top.fsMod.recentIds.web=e.pageId;let t=TYPO3.Backend.ContentContainer.getUrl();t+=(t.includes("?")?"&":"?")+"&id="+e.pageId,c.refreshPageTree(),r.ContentContainer.setUrl(t)}else top.currentModuleLoaded.startsWith("web_")?(c.refreshPageTree(),a.App.reloadFrames()):TYPO3.configuration.pageModule&&a.App.showModule(TYPO3.configuration.pageModule);a.App.refreshMenu()}})}}const i=new c;return TYPO3.WorkspacesMenu=i,i});
\ No newline at end of file