[TASK] Deprecate jquery.clearable 58/61758/9
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Thu, 19 Sep 2019 09:00:08 +0000 (11:00 +0200)
committerBenni Mack <benni@typo3.org>
Mon, 23 Sep 2019 11:45:41 +0000 (13:45 +0200)
To slim down the usage of jQuery even further a bit, the jQuery plugin
`jquery.clearable` has been marked as deprecated. A new plugin
`TYPO3/CMS/Backend/Input/Clearable` may be used instead.

The new plugin extends the prototype of `HTMLInputElement` by a new
function called `clearable`.

Resolves: #89215
Releases: master
Change-Id: Id6e64b983561af0327cc3308499756b8fafbc883
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/61758
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Benni Mack <benni@typo3.org>
43 files changed:
Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Input/Clearable.ts [new file with mode: 0644]
Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Input/index.d.ts [new file with mode: 0644]
Build/Sources/TypeScript/backend/Resources/Public/TypeScript/LiveSearch.ts
Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Login.ts
Build/Sources/TypeScript/backend/Resources/Public/TypeScript/ToggleSearchToolbox.ts
Build/Sources/TypeScript/beuser/Resources/Public/TypeScript/BackendUserListing.ts
Build/Sources/TypeScript/extensionmanager/Resources/Public/TypeScript/Main.ts
Build/Sources/TypeScript/extensionmanager/Resources/Public/TypeScript/Repository.ts
Build/Sources/TypeScript/extensionmanager/Resources/Public/TypeScript/Update.ts
Build/Sources/TypeScript/extensionmanager/Resources/Public/TypeScript/UploadForm.ts
Build/Sources/TypeScript/filelist/Resources/Public/TypeScript/FileSearch.ts
Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Settings/ExtensionConfiguration.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/install/Resources/Public/TypeScript/Renderable/Clearable.ts [new file with mode: 0644]
Build/Sources/TypeScript/lowlevel/Resources/Public/TypeScript/ConfigurationView.ts
Build/Sources/TypeScript/lowlevel/Resources/Public/TypeScript/QueryGenerator.ts
Build/Sources/TypeScript/recycler/Resources/Public/TypeScript/Recycler.ts
Build/Sources/TypeScript/tstemplate/Resources/Public/TypeScript/TypoScriptObjectBrowser.ts
Build/Sources/TypeScript/workspaces/Resources/Public/TypeScript/Backend.ts
typo3/sysext/backend/Resources/Public/JavaScript/FormEngine.js
typo3/sysext/backend/Resources/Public/JavaScript/Input/Clearable.js [new file with mode: 0644]
typo3/sysext/backend/Resources/Public/JavaScript/LiveSearch.js
typo3/sysext/backend/Resources/Public/JavaScript/Login.js
typo3/sysext/backend/Resources/Public/JavaScript/PageTree/PageTreeToolbar.js
typo3/sysext/backend/Resources/Public/JavaScript/ToggleSearchToolbox.js
typo3/sysext/backend/Resources/Public/JavaScript/jquery.clearable.js
typo3/sysext/beuser/Resources/Public/JavaScript/BackendUserListing.js
typo3/sysext/core/Documentation/Changelog/master/Deprecation-89215-JQueryClearable.rst [new file with mode: 0644]
typo3/sysext/extensionmanager/Resources/Public/JavaScript/Main.js
typo3/sysext/extensionmanager/Resources/Public/JavaScript/Repository.js
typo3/sysext/extensionmanager/Resources/Public/JavaScript/Update.js
typo3/sysext/extensionmanager/Resources/Public/JavaScript/UploadForm.js
typo3/sysext/filelist/Resources/Public/JavaScript/FileSearch.js
typo3/sysext/install/Resources/Public/JavaScript/Module/Settings/ExtensionConfiguration.js
typo3/sysext/install/Resources/Public/JavaScript/Module/Settings/LocalConfiguration.js
typo3/sysext/install/Resources/Public/JavaScript/Module/Upgrade/UpgradeDocs.js
typo3/sysext/install/Resources/Public/JavaScript/Renderable/Clearable.js [new file with mode: 0644]
typo3/sysext/lowlevel/Resources/Public/JavaScript/ConfigurationView.js
typo3/sysext/lowlevel/Resources/Public/JavaScript/QueryGenerator.js
typo3/sysext/recycler/Resources/Public/JavaScript/Recycler.js
typo3/sysext/tstemplate/Resources/Public/JavaScript/TypoScriptObjectBrowser.js
typo3/sysext/workspaces/Resources/Public/JavaScript/Backend.js

diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Input/Clearable.ts b/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Input/Clearable.ts
new file mode 100644 (file)
index 0000000..9e92e54
--- /dev/null
@@ -0,0 +1,103 @@
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+class Clearable {
+  private static createCloseButton(): HTMLButtonElement {
+    // The inlined markup represents the current generated markup from the
+    // icon api for the icon actions-close that can be found in the official
+    // icon repository and is registered in the backend icon api.
+    //
+    // It´s not possible to use/open the backend icon api without opening
+    // new possible vectors for attackers to sniff system information.
+    //
+    // When the icon definition of actions-close changes also the inline
+    // icon should be updated.
+    //
+    // https://github.com/typo3/typo3.icons
+    const closeIcon =
+      `<span class="t3js-icon icon icon-size-small icon-state-default icon-actions-close" data-identifier="actions-close">
+        <span class="icon-markup">
+            <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
+                <path
+                    d="M11.9 5.5L9.4 8l2.5 2.5c.2.2.2.5 0
+                    .7l-.7.7c-.2.2-.5.2-.7 0L8 9.4l-2.5 2.5c-.2.2-.5.2-.7
+                    0l-.7-.7c-.2-.2-.2-.5 0-.7L6.6 8 4.1 5.5c-.2-.2-.2-.5
+                    0-.7l.7-.7c.2-.2.5-.2.7 0L8 6.6l2.5-2.5c.2-.2.5-.2.7
+                    0l.7.7c.2.2.2.5 0 .7z"
+                    class="icon-color"/>
+            </svg>
+        </span>
+    </span>`;
+
+    const closeButton = document.createElement('button');
+    closeButton.type = 'button';
+    closeButton.innerHTML = closeIcon;
+    closeButton.style.visibility = 'hidden';
+    closeButton.classList.add('close');
+
+    return closeButton;
+  }
+
+  constructor() {
+    if (typeof HTMLInputElement.prototype.clearable === 'function') {
+      return;
+    }
+
+    this.registerClearable();
+  }
+
+  private registerClearable(): void {
+    HTMLInputElement.prototype.clearable = function(options: Options = {}): void {
+      if (this.isClearable) {
+        // input field is already clearable, nothing to do here
+        return;
+      }
+
+      if (typeof options !== 'object') {
+        throw new Error('Passed options must be an object, ' + typeof options + ' given');
+      }
+
+      const wrap = document.createElement('div');
+      wrap.classList.add('form-control-clearable');
+      this.parentNode.insertBefore(wrap, this);
+      wrap.appendChild(this);
+
+      const clearButton = Clearable.createCloseButton();
+      const toggleClearButtonVisibility = (): void => {
+        clearButton.style.visibility = this.value.length === 0 ? 'hidden' : 'visible';
+      };
+
+      clearButton.addEventListener('click', (e: Event): void => {
+        e.preventDefault();
+
+        this.value = '';
+
+        if (typeof options.onClear === 'function') {
+          options.onClear(this);
+        }
+
+        this.dispatchEvent(new Event('change', {bubbles: true, cancelable: true}));
+        toggleClearButtonVisibility();
+      });
+      wrap.appendChild(clearButton);
+
+      this.addEventListener('focus', toggleClearButtonVisibility);
+      this.addEventListener('keyup', toggleClearButtonVisibility);
+
+      toggleClearButtonVisibility();
+      this.isClearable = true;
+    };
+  }
+}
+
+export = new Clearable();
diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Input/index.d.ts b/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Input/index.d.ts
new file mode 100644 (file)
index 0000000..aaf3dda
--- /dev/null
@@ -0,0 +1,8 @@
+interface Options {
+  onClear?: Function;
+}
+
+interface HTMLInputElement {
+  isClearable: boolean;
+  clearable: (options?: Options) => void;
+}
index 467ef7f..777714a 100644 (file)
@@ -15,7 +15,7 @@ import * as $ from 'jquery';
 import Viewport = require('./Viewport');
 import Icons = require('./Icons');
 import 'jquery/autocomplete';
-import 'TYPO3/CMS/Backend/jquery.clearable';
+import './Input/Clearable';
 
 enum Identifiers {
   containerSelector = '#typo3-cms-backend-backend-toolbaritems-livesearchtoolbaritem',
@@ -54,14 +54,16 @@ class LiveSearch {
 
       // Unset height, width and z-index
       $(Identifiers.toolbarItem).removeAttr('style');
-
-      $(Identifiers.searchFieldSelector).clearable({
-        onClear: (): void => {
-          if ($(Identifiers.toolbarItem).hasClass('open')) {
-            $(Identifiers.dropdownToggle).dropdown('toggle');
-          }
-        },
-      });
+      let searchField: HTMLInputElement;
+      if ((searchField = document.querySelector(Identifiers.searchFieldSelector)) !== null) {
+        searchField.clearable({
+          onClear: (): void => {
+            if ($(Identifiers.toolbarItem).hasClass('open')) {
+              $(Identifiers.dropdownToggle).dropdown('toggle');
+            }
+          },
+        });
+      }
     });
   }
 
index f383bea..ae57a5d 100644 (file)
@@ -13,7 +13,7 @@
 
 import 'bootstrap';
 import * as $ from 'jquery';
-import 'TYPO3/CMS/Backend/jquery.clearable';
+import 'TYPO3/CMS/Backend/Input/Clearable';
 
 /**
  * Module: TYPO3/CMS/Backend/Login
@@ -157,7 +157,9 @@ class BackendLogin {
       $(document).on('change blur', this.options.interfaceField, this.interfaceSelectorChanged);
     }
 
-    $('.t3js-clearable').clearable();
+    (<NodeListOf<HTMLInputElement>>document.querySelectorAll('.t3js-clearable')).forEach(
+      clearableField => clearableField.clearable(),
+    );
 
     // carousel news height transition
     $('.t3js-login-news-carousel').on('slide.bs.carousel', (e: any) => {
index 91565f8..1d9eae5 100644 (file)
@@ -13,7 +13,7 @@
 
 import * as $ from 'jquery';
 import DocumentHeader = require('./DocumentHeader');
-import 'TYPO3/CMS/Backend/jquery.clearable';
+import 'TYPO3/CMS/Backend/Input/Clearable';
 
 /**
  * Module: TYPO3/CMS/Backend/ToggleSearchToolbox
@@ -37,17 +37,19 @@ class ToggleSearchToolbox {
       }
     });
 
-    const $searchFields = $('#search_field');
-    const searchResultShown = ('' !== $searchFields.val());
+    let searchField: HTMLInputElement;
+    if ((searchField = document.querySelector('#search_field')) !== null) {
+      const searchResultShown = ('' !== searchField.value);
 
-    // make search field clearable
-    $searchFields.clearable({
-      onClear: (): void => {
-        if (searchResultShown) {
-          $(this).closest('form').submit();
-        }
-      },
-    });
+      // make search field clearable
+      searchField.clearable({
+        onClear: (input: HTMLInputElement): void => {
+          if (searchResultShown) {
+            input.closest('form').submit();
+          }
+        },
+      });
+    }
   }
 }
 
index 728e6f6..bdc9dfa 100644 (file)
@@ -11,8 +11,7 @@
  * The TYPO3 project - inspiring people to share!
  */
 
-import * as $ from 'jquery';
-import 'TYPO3/CMS/Backend/jquery.clearable';
+import 'TYPO3/CMS/Backend/Input/Clearable';
 
 /**
  * Module: TYPO3/CMS/Beuser/BackendUserListing
@@ -21,17 +20,19 @@ import 'TYPO3/CMS/Backend/jquery.clearable';
  */
 class BackendUserListing {
   constructor() {
-    let $searchFields = $('#tx_Beuser_username');
-    let searchResultShown = ('' !== $searchFields.first().val());
+    let searchField: HTMLInputElement;
+    if ((searchField = document.querySelector('#tx_Beuser_username')) !== null) {
+      const searchResultShown = ('' !== searchField.value);
 
-    // make search field clearable
-    $searchFields.clearable({
-      onClear: (e: JQueryEventObject): void => {
-        if (searchResultShown) {
-          $(e.currentTarget).closest('form').submit();
-        }
-      },
-    });
+      // make search field clearable
+      searchField.clearable({
+        onClear: (input: HTMLInputElement): void => {
+          if (searchResultShown) {
+            input.closest('form').submit();
+          }
+        },
+      });
+    }
   }
 }
 
index 8e893a9..443dacd 100644 (file)
@@ -21,7 +21,7 @@ import ExtensionManagerRepository = require('./Repository');
 import ExtensionManagerUpdate = require('./Update');
 import ExtensionManagerUploadForm = require('./UploadForm');
 import 'datatables';
-import 'TYPO3/CMS/Backend/jquery.clearable';
+import 'TYPO3/CMS/Backend/Input/Clearable';
 
 const securityUtility = new SecurityUtility();
 
@@ -84,11 +84,14 @@ class ExtensionManager {
         $actionButton.toggleClass('disabled', !$(e.currentTarget).prop('checked'));
       });
 
-      $(ExtensionManagerIdentifier.searchField).clearable({
-        onClear: (): void => {
-          dataTable.search('').draw();
-        },
-      });
+      let searchField: HTMLInputElement;
+      if ((searchField = document.querySelector(ExtensionManagerIdentifier.searchField)) !== null) {
+        searchField.clearable({
+          onClear: (): void => {
+            dataTable.search('').draw();
+          },
+        });
+      }
 
       $(document).on('click', '.t3-button-action-installdistribution', (): void => {
         NProgress.start();
index 1dfe6ca..f4ca8ca 100644 (file)
@@ -17,7 +17,7 @@ import Modal = require('TYPO3/CMS/Backend/Modal');
 import Notification = require('TYPO3/CMS/Backend/Notification');
 import Severity = require('TYPO3/CMS/Backend/Severity');
 import 'datatables';
-import 'TYPO3/CMS/Backend/jquery.clearable';
+import 'TYPO3/CMS/Backend/Input/Clearable';
 
 class Repository {
   public downloadPath: string = '';
@@ -186,18 +186,19 @@ class Repository {
   }
 
   private bindSearchFieldResetter(): void {
-    const $searchFields = $('.typo3-extensionmanager-searchTerForm input[type="text"]');
-    const searchResultShown = ('' !== $searchFields.first().val());
+    let searchField: HTMLInputElement;
+    if ((searchField = document.querySelector('.typo3-extensionmanager-searchTerForm input[type="text"]')) !== null) {
+      const searchResultShown = ('' !== searchField.value);
 
-    $searchFields.clearable(
-      {
-        onClear: (e: JQueryEventObject): void => {
+      // make search field clearable
+      searchField.clearable({
+        onClear: (input: HTMLInputElement): void => {
           if (searchResultShown) {
-            $(e.currentTarget).closest('form').submit();
+            input.closest('form').submit();
           }
         },
-      },
-    );
+      });
+    }
   }
 }
 
index e9c0569..242f4c1 100644 (file)
@@ -15,7 +15,6 @@ import * as $ from 'jquery';
 import * as NProgress from 'nprogress';
 import Notification = require('TYPO3/CMS/Backend/Notification');
 import 'datatables';
-import 'TYPO3/CMS/Backend/jquery.clearable';
 
 enum ExtensionManagerUpdateIdentifier {
   extensionTable = '#terTable',
index 5c290cf..7140632 100644 (file)
@@ -13,7 +13,6 @@
 
 import * as $ from 'jquery';
 import 'datatables';
-import 'TYPO3/CMS/Backend/jquery.clearable';
 
 class UploadForm {
   public expandedUploadFormClass: string = 'transformed';
index f71fd20..88a9637 100644 (file)
@@ -12,7 +12,7 @@
  */
 
 import * as $ from 'jquery';
-import 'TYPO3/CMS/Backend/jquery.clearable';
+import 'TYPO3/CMS/Backend/Input/Clearable';
 
 /**
  * Module: TYPO3/CMS/Filelist/RenameFile
@@ -22,17 +22,19 @@ import 'TYPO3/CMS/Backend/jquery.clearable';
 class FileSearch {
   constructor() {
     $((): void => {
-      const $searchFields = $('input[name="tx_filelist_file_filelistlist[searchWord]"]');
-      const searchResultShown = ('' !== $searchFields.first().val());
+      let searchField: HTMLInputElement;
+      if ((searchField = document.querySelector('input[name="tx_filelist_file_filelistlist[searchWord]"]')) !== null) {
+        const searchResultShown = ('' !== searchField.value);
 
-      // make search field clearable
-      $searchFields.clearable({
-        onClear: (): void => {
-          if (searchResultShown) {
-            $searchFields.closest('form').submit();
-          }
-        },
-      });
+        // make search field clearable
+        searchField.clearable({
+          onClear: (input: HTMLInputElement): void => {
+            if (searchResultShown) {
+              input.closest('form').submit();
+            }
+          },
+        });
+      }
     });
   }
 }
index eb1afa2..1e08430 100644 (file)
@@ -14,6 +14,7 @@
 import {AbstractInteractableModule} from '../AbstractInteractableModule';
 import * as $ from 'jquery';
 import 'bootstrap';
+import '../../Renderable/Clearable';
 import Router = require('../../Router');
 import Notification = require('TYPO3/CMS/Backend/Notification');
 
@@ -58,9 +59,9 @@ class ExtensionConfiguration extends AbstractInteractableModule {
       });
       currentModal.find('.searchhit').collapse('show');
       // Make search field clearable
-      require(['jquery.clearable'], (): void => {
-        $searchInput.clearable().focus();
-      });
+      const searchInput = <HTMLInputElement>$searchInput.get(0);
+      searchInput.clearable();
+      searchInput.focus();
     });
 
     currentModal.on('submit', this.selectorFormListener, (e: JQueryEventObject): void => {
index 95e0f26..ff013a9 100644 (file)
@@ -14,6 +14,7 @@
 import {AbstractInteractableModule} from '../AbstractInteractableModule';
 import * as $ from 'jquery';
 import 'bootstrap';
+import '../../Renderable/Clearable';
 import Router = require('../../Router');
 import Modal = require('TYPO3/CMS/Backend/Modal');
 import Notification = require('TYPO3/CMS/Backend/Notification');
@@ -80,9 +81,9 @@ class LocalConfiguration extends AbstractInteractableModule {
       });
       currentModal.find('.searchhit').parent().collapse('show');
       // Make search field clearable
-      require(['jquery.clearable'], (): void => {
-        $searchInput.clearable().focus();
-      });
+      const searchInput = <HTMLInputElement>$searchInput.get(0);
+      searchInput.clearable();
+      searchInput.focus();
     });
   }
 
index 3d28939..227c7e8 100644 (file)
@@ -14,6 +14,7 @@
 import {AbstractInteractableModule} from '../AbstractInteractableModule';
 import * as $ from 'jquery';
 import 'bootstrap';
+import '../../Renderable/Clearable';
 import Router = require('../../Router');
 import Notification = require('TYPO3/CMS/Backend/Notification');
 
@@ -72,9 +73,9 @@ class UpgradeDocs extends AbstractInteractableModule {
       };
     });
 
-    require(['jquery.clearable'], (): void => {
-      currentModal.find(this.selectorFulltextSearch).clearable().focus();
-    });
+    const searchInput = <HTMLInputElement>currentModal.find(this.selectorFulltextSearch).get(0);
+    searchInput.clearable();
+    searchInput.focus();
   }
 
   private getContent(): void {
@@ -142,7 +143,10 @@ class UpgradeDocs extends AbstractInteractableModule {
 
   private initializeFullTextSearch(): void {
     this.fulltextSearchField = this.findInModal(this.selectorFulltextSearch);
-    this.fulltextSearchField.clearable().focus();
+    const searchInput = <HTMLInputElement>this.fulltextSearchField.get(0);
+    searchInput.clearable();
+    searchInput.focus();
+
     this.initializeChosenSelector();
     this.fulltextSearchField.on('keyup', (): void => {
       this.combinedFilterSearch();
diff --git a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Renderable/Clearable.ts b/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Renderable/Clearable.ts
new file mode 100644 (file)
index 0000000..0546b0e
--- /dev/null
@@ -0,0 +1,103 @@
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+class Clearable {
+  private static createCloseButton(): HTMLButtonElement {
+    // The inlined markup represents the current generated markup from the
+    // icon api for the icon actions-close that can be found in the official
+    // icon repository and is registered in the backend icon api.
+    //
+    // It´s not possible to use/open the backend icon api without opening
+    // new possible vectors for attackers to sniff system information.
+    //
+    // When the icon definition of actions-close changes also the inline
+    // icon should be updated.
+    //
+    // https://github.com/typo3/typo3.icons
+    const closeIcon =
+      `<span class="t3js-icon icon icon-size-small icon-state-default icon-actions-close" data-identifier="actions-close">
+        <span class="icon-markup">
+            <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
+                <path
+                    d="M11.9 5.5L9.4 8l2.5 2.5c.2.2.2.5 0
+                    .7l-.7.7c-.2.2-.5.2-.7 0L8 9.4l-2.5 2.5c-.2.2-.5.2-.7
+                    0l-.7-.7c-.2-.2-.2-.5 0-.7L6.6 8 4.1 5.5c-.2-.2-.2-.5
+                    0-.7l.7-.7c.2-.2.5-.2.7 0L8 6.6l2.5-2.5c.2-.2.5-.2.7
+                    0l.7.7c.2.2.2.5 0 .7z"
+                    class="icon-color"/>
+              </svg>
+            </span>
+          </span>`;
+
+    const closeButton = document.createElement('button');
+    closeButton.type = 'button';
+    closeButton.innerHTML = closeIcon;
+    closeButton.style.visibility = 'hidden';
+    closeButton.classList.add('close');
+
+    return closeButton;
+  }
+
+  constructor() {
+    if (typeof HTMLInputElement.prototype.clearable === 'function') {
+      return;
+    }
+
+    this.registerClearable();
+  }
+
+  private registerClearable(): void {
+    HTMLInputElement.prototype.clearable = function(options: Options = {}): void {
+      if (this.dataset.clearable) {
+        // input field is already clearable, nothing to do here
+        return;
+      }
+
+      if (typeof options !== 'object') {
+        throw new Error('Passed options must be an object, ' + typeof options + ' given');
+      }
+
+      const wrap = document.createElement('div');
+      wrap.classList.add('form-control-clearable');
+      this.parentNode.insertBefore(wrap, this);
+      wrap.appendChild(this);
+
+      const clearButton = Clearable.createCloseButton();
+      const toggleClearButtonVisibility = (): void => {
+        clearButton.style.visibility = this.value.length === 0 ? 'hidden' : 'visible';
+      };
+
+      clearButton.addEventListener('click', (e: Event): void => {
+        e.preventDefault();
+
+        this.value = '';
+
+        if (typeof options.onClear === 'function') {
+          options.onClear(this);
+        }
+
+        this.dispatchEvent(new Event('change', {bubbles: true, cancelable: true}));
+        toggleClearButtonVisibility();
+      });
+      wrap.appendChild(clearButton);
+
+      this.addEventListener('focus', toggleClearButtonVisibility);
+      this.addEventListener('keyup', toggleClearButtonVisibility);
+
+      toggleClearButtonVisibility();
+      this.dataset.clearable = 'true';
+    };
+  }
+}
+
+export = new Clearable();
index 60f7e47..b400a76 100644 (file)
  */
 
 import * as $ from 'jquery';
-import 'TYPO3/CMS/Backend/jquery.clearable';
 
 /**
  * Module: TYPO3/CMS/Lowlevel/ConfigurationView
  * JavaScript for Configuration View
  */
 class ConfigurationView {
-  private $searchFields: JQuery = $('input[name="searchString"]');
-  private searchResultShown: boolean = ('' !== this.$searchFields.first().val());
+  private searchField: HTMLInputElement = document.querySelector('input[name="searchString"]');
+  private searchResultShown: boolean = ('' !== this.searchField.value);
 
   constructor() {
     // make search field clearable
-    this.$searchFields.clearable({
-      onClear: (): void => {
+    this.searchField.clearable({
+      onClear: (input: HTMLInputElement): void => {
         if (this.searchResultShown) {
-          $(this.$searchFields).closest('form').submit();
+          input.closest('form').submit();
         }
       },
     });
index 97a3db7..10337eb 100644 (file)
@@ -12,8 +12,7 @@
  */
 
 import * as $ from 'jquery';
-import DateTimePicker = require('TYPO3/CMS/Backend/DateTimePicker');
-import 'TYPO3/CMS/Backend/jquery.clearable';
+import 'TYPO3/CMS/Backend/Input/Clearable';
 
 /**
  * Module: TYPO3/CMS/Lowlevel/QueryGenerator
@@ -51,11 +50,13 @@ class QueryGenerator {
       const $field = $(e.currentTarget);
       this.addValueToField($field.data('field'), $field.val());
     });
-    this.form.find('.t3js-clearable').clearable({
-      onClear: (): void => {
-        this.doSubmit();
-      },
-    });
+    (<NodeListOf<HTMLInputElement>>document.querySelectorAll('form[name="queryform"] .t3js-clearable')).forEach(
+      clearableField => clearableField.clearable({
+        onClear: (): void => {
+          this.doSubmit();
+        },
+      }),
+    );
   }
 
   /**
index fb73d90..7143a01 100644 (file)
@@ -16,7 +16,6 @@ import * as NProgress from 'nprogress';
 import Modal = require('TYPO3/CMS/Backend/Modal');
 import Notification = require('TYPO3/CMS/Backend/Notification');
 import Severity = require('TYPO3/CMS/Backend/Severity');
-import 'TYPO3/CMS/Backend/jquery.clearable';
 
 enum RecyclerIdentifiers {
   searchForm = '#recycler-form',
@@ -104,7 +103,8 @@ class Recycler {
         this.elements.$searchSubmitBtn.addClass('disabled');
         this.loadDeletedElements();
       }
-    }).clearable(
+    });
+    this.elements.$searchTextField.get(0).clearable(
       {
         onClear: () => {
           this.elements.$searchSubmitBtn.addClass('disabled');
index 47d2073..8231960 100644 (file)
@@ -12,7 +12,7 @@
  */
 
 import * as $ from 'jquery';
-import 'TYPO3/CMS/Backend/jquery.clearable';
+import 'TYPO3/CMS/Backend/Input/Clearable';
 
 /**
  * Module: TYPO3/CMS/Tstemplate/TypoScriptObjectBrowser
@@ -20,17 +20,17 @@ import 'TYPO3/CMS/Backend/jquery.clearable';
  * @exports TYPO3/CMS/Tstemplate/TypoScriptObjectBrowser
  */
 class TypoScriptObjectBrowser {
-  private $searchFields: JQuery;
+  private searchField: HTMLInputElement;
   private readonly searchResultShown: boolean;
 
   constructor() {
-    this.$searchFields = $('input[name="search_field"]');
-    this.searchResultShown = ('' !== this.$searchFields.first().val());
+    this.searchField = document.querySelector('input[name="search_field"]');
+    this.searchResultShown = ('' !== this.searchField.value);
 
-    this.$searchFields.clearable({
-      onClear: (evt: JQueryEventObject): void => {
+    this.searchField.clearable({
+      onClear: (input: HTMLInputElement): void => {
         if (this.searchResultShown) {
-          $(evt.currentTarget).closest('form').submit();
+          input.closest('form').submit();
         }
       },
     });
index 305da19..d6baf41 100644 (file)
@@ -14,7 +14,7 @@
 import {SeverityEnum} from 'TYPO3/CMS/Backend/Enum/Severity';
 import 'twbs/bootstrap-slider';
 import 'nprogress';
-import 'TYPO3/CMS/Backend/jquery.clearable';
+import 'TYPO3/CMS/Backend/Input/Clearable';
 import * as $ from 'jquery';
 import Modal = require('TYPO3/CMS/Backend/Modal');
 import Persistent = require('TYPO3/CMS/Backend/Storage/Persistent');
@@ -327,7 +327,8 @@ class Backend extends Workspaces {
         this.elements.$searchSubmitBtn.addClass('disabled');
         this.getWorkspaceInfos();
       }
-    }).clearable(
+    });
+    (<HTMLInputElement>this.elements.$searchTextField.get(0)).clearable(
       {
         onClear: (): void => {
           this.elements.$searchSubmitBtn.addClass('disabled');
index 8fba755..bd30d56 100644 (file)
@@ -701,9 +701,13 @@ define(['jquery',
    */
   FormEngine.reinitialize = function() {
     // Apply "close" button to all input / datetime fields
-    if ($('.t3js-clearable').length) {
-      require(['TYPO3/CMS/Backend/jquery.clearable'], function() {
-        $('.t3js-clearable').clearable();
+    const clearables = Array.from(document.querySelectorAll('.t3js-clearable')).filter(inputElement => {
+      // Filter input fields being a date time picker and a color picker
+      return !inputElement.classList.contains('t3js-datetimepicker') && !inputElement.classList.contains('t3js-color-picker');
+    });
+    if (clearables.length > 0) {
+      require(['TYPO3/CMS/Backend/Input/Clearable'], function() {
+        clearables.forEach(clearableField => clearableField.clearable());
       });
     }
 
diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Input/Clearable.js b/typo3/sysext/backend/Resources/Public/JavaScript/Input/Clearable.js
new file mode 100644 (file)
index 0000000..573c40f
--- /dev/null
@@ -0,0 +1,13 @@
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+define(["require","exports"],function(e,t){"use strict";class n{static createCloseButton(){const e=document.createElement("button");return e.type="button",e.innerHTML='<span class="t3js-icon icon icon-size-small icon-state-default icon-actions-close" data-identifier="actions-close">\n        <span class="icon-markup">\n            <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">\n                <path\n                    d="M11.9 5.5L9.4 8l2.5 2.5c.2.2.2.5 0\n                    .7l-.7.7c-.2.2-.5.2-.7 0L8 9.4l-2.5 2.5c-.2.2-.5.2-.7\n                    0l-.7-.7c-.2-.2-.2-.5 0-.7L6.6 8 4.1 5.5c-.2-.2-.2-.5\n                    0-.7l.7-.7c.2-.2.5-.2.7 0L8 6.6l2.5-2.5c.2-.2.5-.2.7\n                    0l.7.7c.2.2.2.5 0 .7z"\n                    class="icon-color"/>\n            </svg>\n        </span>\n    </span>',e.style.visibility="hidden",e.classList.add("close"),e}constructor(){"function"!=typeof HTMLInputElement.prototype.clearable&&this.registerClearable()}registerClearable(){HTMLInputElement.prototype.clearable=function(e={}){if(this.isClearable)return;if("object"!=typeof e)throw new Error("Passed options must be an object, "+typeof e+" given");const t=document.createElement("div");t.classList.add("form-control-clearable"),this.parentNode.insertBefore(t,this),t.appendChild(this);const s=n.createCloseButton(),i=()=>{s.style.visibility=0===this.value.length?"hidden":"visible"};s.addEventListener("click",t=>{t.preventDefault(),this.value="","function"==typeof e.onClear&&e.onClear(this),this.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0})),i()}),t.appendChild(s),this.addEventListener("focus",i),this.addEventListener("keyup",i),i(),this.isClearable=!0}}}return new n});
\ No newline at end of file
index d77698a..38aa2e7 100644 (file)
@@ -10,4 +10,4 @@
  *
  * The TYPO3 project - inspiring people to share!
  */
-define(["require","exports","jquery","./Viewport","./Icons","jquery/autocomplete","TYPO3/CMS/Backend/jquery.clearable"],function(e,t,o,a,r){"use strict";var l;!function(e){e.containerSelector="#typo3-cms-backend-backend-toolbaritems-livesearchtoolbaritem",e.toolbarItem=".t3js-toolbar-item-search",e.dropdownToggle=".t3js-toolbar-search-dropdowntoggle",e.searchFieldSelector=".t3js-topbar-navigation-search-field",e.formSelector=".t3js-topbar-navigation-search"}(l||(l={}));return new class{constructor(){this.url=TYPO3.settings.ajaxUrls.livesearch,a.Topbar.Toolbar.registerEvent(()=>{this.registerAutocomplete(),this.registerEvents(),o(l.toolbarItem).removeAttr("style"),o(l.searchFieldSelector).clearable({onClear:()=>{o(l.toolbarItem).hasClass("open")&&o(l.dropdownToggle).dropdown("toggle")}})})}registerAutocomplete(){o(l.searchFieldSelector).autocomplete({serviceUrl:this.url,paramName:"q",dataType:"json",minChars:2,width:"100%",groupBy:"typeLabel",noCache:!0,containerClass:l.toolbarItem.substr(1,l.toolbarItem.length),appendTo:l.containerSelector+" .dropdown-menu",forceFixPosition:!1,preserveInput:!0,showNoSuggestionNotice:!0,triggerSelectOnValidInput:!1,preventBadQueries:!1,noSuggestionNotice:'<h3 class="dropdown-headline">'+TYPO3.lang.liveSearch_listEmptyText+"</h3><p>"+TYPO3.lang.liveSearch_helpTitle+"</p><hr><p>"+TYPO3.lang.liveSearch_helpDescription+"<br>"+TYPO3.lang.liveSearch_helpDescriptionPages+"</p>",transformResult:e=>({suggestions:o.map(e,e=>({value:e.title,data:e}))}),formatGroup:(e,t,o)=>{let a="";return o>0&&(a="<hr>"),a+'<h3 class="dropdown-headline">'+t+"</h3>"},formatResult:e=>'<div class="dropdown-table"><div class="dropdown-table-row"><div class="dropdown-table-column dropdown-table-icon">'+e.data.iconHTML+'</div><div class="dropdown-table-column dropdown-table-title"><a class="dropdown-table-title-ellipsis dropdown-list-link" href="#" data-pageid="'+e.data.pageId+'" data-target="'+e.data.editLink+'">'+e.data.title+"</a></div></div></div>",onSearchStart:()=>{const e=o(l.toolbarItem);e.hasClass("loading")||(e.addClass("loading"),r.getIcon("spinner-circle-light",r.sizes.small,"",r.states.default,r.markupIdentifiers.inline).done(t=>{e.find(".icon-apps-toolbar-menu-search").replaceWith(t)}))},onSearchComplete:()=>{const e=o(l.toolbarItem),t=o(l.searchFieldSelector);!e.hasClass("open")&&t.val().length>1&&(o(l.dropdownToggle).dropdown("toggle"),t.focus()),e.hasClass("loading")&&(e.removeClass("loading"),r.getIcon("apps-toolbar-menu-search",r.sizes.small,"",r.states.default,r.markupIdentifiers.inline).done(t=>{e.find(".icon-spinner-circle-light").replaceWith(t)}))},beforeRender:e=>{e.append('<hr><div><a href="#" class="btn btn-primary pull-right t3js-live-search-show-all">'+TYPO3.lang.liveSearch_showAllResults+"</a></div>"),o(l.toolbarItem).hasClass("open")||(o(l.dropdownToggle).dropdown("toggle"),o(l.searchFieldSelector).focus())},onHide:()=>{o(l.toolbarItem).hasClass("open")&&o(l.dropdownToggle).dropdown("toggle")}})}registerEvents(){const e=o(l.searchFieldSelector);o(l.containerSelector).on("click",".t3js-live-search-show-all",t=>{t.preventDefault(),TYPO3.ModuleMenu.App.showModule("web_list","id=0&search_levels=-1&search_field="+encodeURIComponent(e.val())),e.val("").trigger("change")}),e.length&&o("."+l.toolbarItem.substr(1,l.toolbarItem.length)).on("click.autocomplete",".dropdown-list-link",t=>{t.preventDefault();const a=o(t.currentTarget);top.jump(a.data("target"),"web_list","web",a.data("pageid")),e.val("").trigger("change")}),o(l.formSelector).on("submit",e=>{e.preventDefault()})}}});
\ No newline at end of file
+define(["require","exports","jquery","./Viewport","./Icons","jquery/autocomplete","./Input/Clearable"],function(e,t,o,a,l){"use strict";var r;!function(e){e.containerSelector="#typo3-cms-backend-backend-toolbaritems-livesearchtoolbaritem",e.toolbarItem=".t3js-toolbar-item-search",e.dropdownToggle=".t3js-toolbar-search-dropdowntoggle",e.searchFieldSelector=".t3js-topbar-navigation-search-field",e.formSelector=".t3js-topbar-navigation-search"}(r||(r={}));return new class{constructor(){this.url=TYPO3.settings.ajaxUrls.livesearch,a.Topbar.Toolbar.registerEvent(()=>{let e;this.registerAutocomplete(),this.registerEvents(),o(r.toolbarItem).removeAttr("style"),null!==(e=document.querySelector(r.searchFieldSelector))&&e.clearable({onClear:()=>{o(r.toolbarItem).hasClass("open")&&o(r.dropdownToggle).dropdown("toggle")}})})}registerAutocomplete(){o(r.searchFieldSelector).autocomplete({serviceUrl:this.url,paramName:"q",dataType:"json",minChars:2,width:"100%",groupBy:"typeLabel",noCache:!0,containerClass:r.toolbarItem.substr(1,r.toolbarItem.length),appendTo:r.containerSelector+" .dropdown-menu",forceFixPosition:!1,preserveInput:!0,showNoSuggestionNotice:!0,triggerSelectOnValidInput:!1,preventBadQueries:!1,noSuggestionNotice:'<h3 class="dropdown-headline">'+TYPO3.lang.liveSearch_listEmptyText+"</h3><p>"+TYPO3.lang.liveSearch_helpTitle+"</p><hr><p>"+TYPO3.lang.liveSearch_helpDescription+"<br>"+TYPO3.lang.liveSearch_helpDescriptionPages+"</p>",transformResult:e=>({suggestions:o.map(e,e=>({value:e.title,data:e}))}),formatGroup:(e,t,o)=>{let a="";return o>0&&(a="<hr>"),a+'<h3 class="dropdown-headline">'+t+"</h3>"},formatResult:e=>'<div class="dropdown-table"><div class="dropdown-table-row"><div class="dropdown-table-column dropdown-table-icon">'+e.data.iconHTML+'</div><div class="dropdown-table-column dropdown-table-title"><a class="dropdown-table-title-ellipsis dropdown-list-link" href="#" data-pageid="'+e.data.pageId+'" data-target="'+e.data.editLink+'">'+e.data.title+"</a></div></div></div>",onSearchStart:()=>{const e=o(r.toolbarItem);e.hasClass("loading")||(e.addClass("loading"),l.getIcon("spinner-circle-light",l.sizes.small,"",l.states.default,l.markupIdentifiers.inline).done(t=>{e.find(".icon-apps-toolbar-menu-search").replaceWith(t)}))},onSearchComplete:()=>{const e=o(r.toolbarItem),t=o(r.searchFieldSelector);!e.hasClass("open")&&t.val().length>1&&(o(r.dropdownToggle).dropdown("toggle"),t.focus()),e.hasClass("loading")&&(e.removeClass("loading"),l.getIcon("apps-toolbar-menu-search",l.sizes.small,"",l.states.default,l.markupIdentifiers.inline).done(t=>{e.find(".icon-spinner-circle-light").replaceWith(t)}))},beforeRender:e=>{e.append('<hr><div><a href="#" class="btn btn-primary pull-right t3js-live-search-show-all">'+TYPO3.lang.liveSearch_showAllResults+"</a></div>"),o(r.toolbarItem).hasClass("open")||(o(r.dropdownToggle).dropdown("toggle"),o(r.searchFieldSelector).focus())},onHide:()=>{o(r.toolbarItem).hasClass("open")&&o(r.dropdownToggle).dropdown("toggle")}})}registerEvents(){const e=o(r.searchFieldSelector);o(r.containerSelector).on("click",".t3js-live-search-show-all",t=>{t.preventDefault(),TYPO3.ModuleMenu.App.showModule("web_list","id=0&search_levels=-1&search_field="+encodeURIComponent(e.val())),e.val("").trigger("change")}),e.length&&o("."+r.toolbarItem.substr(1,r.toolbarItem.length)).on("click.autocomplete",".dropdown-list-link",t=>{t.preventDefault();const a=o(t.currentTarget);top.jump(a.data("target"),"web_list","web",a.data("pageid")),e.val("").trigger("change")}),o(r.formSelector).on("submit",e=>{e.preventDefault()})}}});
\ No newline at end of file
index 3cf2aa8..a976c66 100644 (file)
@@ -10,4 +10,4 @@
  *
  * The TYPO3 project - inspiring people to share!
  */
-define(["require","exports","jquery","bootstrap","TYPO3/CMS/Backend/jquery.clearable"],function(o,i,e){"use strict";return new class{constructor(){this.showLoginProcess=(()=>{this.showLoadingIndicator(),e(this.options.error).addClass("hidden"),e(this.options.errorNoCookies).addClass("hidden")}),this.showLoadingIndicator=(()=>{e(this.options.submitButton).button("loading")}),this.handleSubmit=(o=>{this.showLoginProcess(),"function"==typeof this.options.submitHandler&&this.options.submitHandler(o)}),this.interfaceSelectorChanged=(()=>{const o=new Date,i=new Date(o.getTime()+31536e6);document.cookie="typo3-login-interface="+e(this.options.interfaceField).val()+"; expires="+i.toUTCString()+";"}),this.checkForInterfaceCookie=(()=>{if(e(this.options.interfaceField).length){const o=document.cookie.indexOf("typo3-login-interface=");if(-1!==o){let i=document.cookie.substr(o+22);i=i.substr(0,i.indexOf(";")),e(this.options.interfaceField).val(i)}}}),this.showCookieWarning=(()=>{e(this.options.formFields).addClass("hidden"),e(this.options.errorNoCookies).removeClass("hidden")}),this.hideCookieWarning=(()=>{e(this.options.formFields).removeClass("hidden"),e(this.options.errorNoCookies).addClass("hidden")}),this.checkCookieSupport=(()=>{const o=navigator.cookieEnabled;!1===o?this.showCookieWarning():document.cookie||null!==o||(document.cookie="typo3-login-cookiecheck=1",document.cookie?document.cookie="typo3-login-cookiecheck=; expires="+new Date(0).toUTCString():this.showCookieWarning())}),this.initializeEvents=(()=>{e(document).ajaxStart(this.showLoadingIndicator),e(this.options.loginForm).on("submit",this.handleSubmit),e(this.options.interfaceField).length>0&&e(document).on("change blur",this.options.interfaceField,this.interfaceSelectorChanged),e(".t3js-clearable").clearable(),e(".t3js-login-news-carousel").on("slide.bs.carousel",o=>{const i=e(o.relatedTarget).height();e(o.target).find("div.active").parent().animate({height:i},500)})}),this.options={error:".t3js-login-error",errorNoCookies:".t3js-login-error-nocookies",formFields:".t3js-login-formfields",interfaceField:".t3js-login-interface-field",loginForm:"#typo3-login-form",submitButton:".t3js-login-submit",submitHandler:null,useridentField:".t3js-login-userident-field"},this.checkCookieSupport(),this.checkForInterfaceCookie(),this.initializeEvents(),top.location.href!==location.href&&(top.location.href=location.href)}}});
\ No newline at end of file
+define(["require","exports","jquery","bootstrap","TYPO3/CMS/Backend/Input/Clearable"],function(o,i,e){"use strict";return new class{constructor(){this.showLoginProcess=(()=>{this.showLoadingIndicator(),e(this.options.error).addClass("hidden"),e(this.options.errorNoCookies).addClass("hidden")}),this.showLoadingIndicator=(()=>{e(this.options.submitButton).button("loading")}),this.handleSubmit=(o=>{this.showLoginProcess(),"function"==typeof this.options.submitHandler&&this.options.submitHandler(o)}),this.interfaceSelectorChanged=(()=>{const o=new Date,i=new Date(o.getTime()+31536e6);document.cookie="typo3-login-interface="+e(this.options.interfaceField).val()+"; expires="+i.toUTCString()+";"}),this.checkForInterfaceCookie=(()=>{if(e(this.options.interfaceField).length){const o=document.cookie.indexOf("typo3-login-interface=");if(-1!==o){let i=document.cookie.substr(o+22);i=i.substr(0,i.indexOf(";")),e(this.options.interfaceField).val(i)}}}),this.showCookieWarning=(()=>{e(this.options.formFields).addClass("hidden"),e(this.options.errorNoCookies).removeClass("hidden")}),this.hideCookieWarning=(()=>{e(this.options.formFields).removeClass("hidden"),e(this.options.errorNoCookies).addClass("hidden")}),this.checkCookieSupport=(()=>{const o=navigator.cookieEnabled;!1===o?this.showCookieWarning():document.cookie||null!==o||(document.cookie="typo3-login-cookiecheck=1",document.cookie?document.cookie="typo3-login-cookiecheck=; expires="+new Date(0).toUTCString():this.showCookieWarning())}),this.initializeEvents=(()=>{e(document).ajaxStart(this.showLoadingIndicator),e(this.options.loginForm).on("submit",this.handleSubmit),e(this.options.interfaceField).length>0&&e(document).on("change blur",this.options.interfaceField,this.interfaceSelectorChanged),document.querySelectorAll(".t3js-clearable").forEach(o=>o.clearable()),e(".t3js-login-news-carousel").on("slide.bs.carousel",o=>{const i=e(o.relatedTarget).height();e(o.target).find("div.active").parent().animate({height:i},500)})}),this.options={error:".t3js-login-error",errorNoCookies:".t3js-login-error-nocookies",formFields:".t3js-login-formfields",interfaceField:".t3js-login-interface-field",loginForm:"#typo3-login-form",submitButton:".t3js-login-submit",submitHandler:null,useridentField:".t3js-login-userident-field"},this.checkCookieSupport(),this.checkForInterfaceCookie(),this.initializeEvents(),top.location.href!==location.href&&(top.location.href=location.href)}}});
\ No newline at end of file
index 2c8101c..a2407f1 100644 (file)
@@ -20,7 +20,7 @@ define(['jquery',
     'TYPO3/CMS/Backend/PageTree/PageTreeDragDrop',
     'TYPO3/CMS/Backend/Tooltip',
     'TYPO3/CMS/Backend/SvgTree',
-    'TYPO3/CMS/Backend/jquery.clearable'
+    'TYPO3/CMS/Backend/Input/Clearable'
   ],
   function($, Icons, d3, PageTreeDragDrop) {
     'use strict';
@@ -174,11 +174,15 @@ define(['jquery',
 
           $toolbar.find('[data-tree-submenu]').not($submenu).removeClass('active');
           $submenu.addClass('active');
-          $submenu.find('input').clearable({
-            onClear: function(){
-              $submenu.find('input').trigger('input');
-            }
-          });
+
+          let input = $submenu.find('input').get(0);
+          if (input) {
+            input.clearable({
+              onClear: function (input) {
+                $(input).trigger('input');
+              }
+            });
+          }
           $submenu.find('input').focus();
         });
       });
index 7f04285..460ec8e 100644 (file)
@@ -10,4 +10,4 @@
  *
  * The TYPO3 project - inspiring people to share!
  */
-define(["require","exports","jquery","./DocumentHeader","TYPO3/CMS/Backend/jquery.clearable"],function(e,i,s,t){"use strict";return new class{constructor(){s(()=>{this.initialize()})}initialize(){const e=s("#db_list-searchbox-toolbar");s(".t3js-toggle-search-toolbox").on("click",()=>{e.toggle(),t.reposition(),e.is(":visible")&&s("#search_field").focus()});const i=s("#search_field"),o=""!==i.val();i.clearable({onClear:()=>{o&&s(this).closest("form").submit()}})}}});
\ No newline at end of file
+define(["require","exports","jquery","./DocumentHeader","TYPO3/CMS/Backend/Input/Clearable"],function(e,t,i,o){"use strict";return new class{constructor(){i(()=>{this.initialize()})}initialize(){const e=i("#db_list-searchbox-toolbar");let t;if(i(".t3js-toggle-search-toolbox").on("click",()=>{e.toggle(),o.reposition(),e.is(":visible")&&i("#search_field").focus()}),null!==(t=document.querySelector("#search_field"))){const e=""!==t.value;t.clearable({onClear:t=>{e&&t.closest("form").submit()}})}}}});
\ No newline at end of file
index 691dffb..cc77b9a 100644 (file)
@@ -30,6 +30,7 @@
   }
 }(function($) {
   $.fn.clearable = function(options) {
+    console.warn('jquery.clearable has been marked as deprecated and will be removed in TYPO3 v11. Use TYPO3/CMS/Backend/Input/Clearable and native HTMLInputElement instead.');
 
     var defaults = {
       'onClear': function() {
index 8932895..1023088 100644 (file)
@@ -10,4 +10,4 @@
  *
  * The TYPO3 project - inspiring people to share!
  */
-define(["require","exports","jquery","TYPO3/CMS/Backend/jquery.clearable"],function(e,r,t){"use strict";return new class{constructor(){let e=t("#tx_Beuser_username"),r=""!==e.first().val();e.clearable({onClear:e=>{r&&t(e.currentTarget).closest("form").submit()}})}}});
\ No newline at end of file
+define(["require","exports","TYPO3/CMS/Backend/Input/Clearable"],function(e,r){"use strict";return new class{constructor(){let e;if(null!==(e=document.querySelector("#tx_Beuser_username"))){const r=""!==e.value;e.clearable({onClear:e=>{r&&e.closest("form").submit()}})}}}});
\ No newline at end of file
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-89215-JQueryClearable.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-89215-JQueryClearable.rst
new file mode 100644 (file)
index 0000000..3119c2e
--- /dev/null
@@ -0,0 +1,64 @@
+.. include:: ../../Includes.txt
+
+======================================
+Deprecation: #89215 - jQuery.clearable
+======================================
+
+See :issue:`89215`
+
+Description
+===========
+
+The jQuery plugin :js:`jquery.clearable` that provides a button to clear an input field has been marked as deprecated.
+
+
+Impact
+======
+
+Using :js:`jquery.clearable` will trigger a deprecation warning in the browser's console.
+
+
+Affected Installations
+======================
+
+All 3rd party extensions using :js:`jquery.clearable` are affected.
+
+
+Migration
+=========
+
+Import the module :js:`TYPO3/CMS/Backend/Input/Clearable` and use the method :js:`clearable()` on a native :js:`HTMLInputElement`.
+
+Example code:
+
+.. code-block:: js
+
+   require(['TYPO3/CMS/Backend/Input/Clearable'], function() {
+     const inputField = document.querySelector('#some-input');
+     if (inputField !== null) {
+       inputField.clearable();
+     }
+
+     const clearables = Array.from(document.querySelectorAll('.t3js-clearable')).filter(inputElement => {
+       // Filter input fields being a date time picker and a color picker
+       return !inputElement.classList.contains('t3js-datetimepicker') && !inputElement.classList.contains('t3js-color-picker');
+     });
+     clearables.forEach(clearableField => clearableField.clearable());
+  });
+
+The method also accepts an :js:`options` object, allowing to set a :js:`onClear` callback. The callback receives the input field as an argument the clearing was applied to.
+
+Example code:
+
+.. code-block:: js
+
+   const inputField = document.querySelector('#some-input');
+   if (inputField !== null) {
+     inputField.clearable({
+       onClear: function (input) {
+         input.closest('form').submit();
+       }
+     });
+   }
+
+.. index:: Backend, JavaScript, NotScanned, ext:backend
index e3506d6..1c488ed 100644 (file)
@@ -10,4 +10,4 @@
  *
  * The TYPO3 project - inspiring people to share!
  */
-define(["require","exports","jquery","nprogress","TYPO3/CMS/Backend/Modal","TYPO3/CMS/Backend/Tooltip","TYPO3/CMS/Backend/Severity","TYPO3/CMS/Core/SecurityUtility","./Repository","./Update","./UploadForm","datatables","TYPO3/CMS/Backend/jquery.clearable"],function(e,t,n,a,i,o,r,s,l,c,d){"use strict";const p=new s;var m;!function(e){e.extensionlist="#typo3-extension-list",e.searchField="#Tx_Extensionmanager_extensionkey"}(m||(m={}));class u{constructor(){this.bindExtensionListActions=(()=>{n(".removeExtension").not(".transformed").each((e,t)=>{const a=n(t);a.data("href",a.attr("href")),a.attr("href","#"),a.addClass("transformed"),a.click(()=>{i.confirm(TYPO3.lang["extensionList.removalConfirmation.title"],TYPO3.lang["extensionList.removalConfirmation.question"],r.error,[{text:TYPO3.lang["button.cancel"],active:!0,btnClass:"btn-default",trigger:()=>{i.dismiss()}},{text:TYPO3.lang["button.remove"],btnClass:"btn-danger",trigger:()=>{this.removeExtensionFromDisk(a),i.dismiss()}}])})})}),n(()=>{n.fn.dataTableExt.oSort["extension-asc"]=((e,t)=>u.extensionCompare(e,t)),n.fn.dataTableExt.oSort["extension-desc"]=((e,t)=>{return-1*u.extensionCompare(e,t)}),n.fn.dataTableExt.oSort["version-asc"]=((e,t)=>{return-1*u.versionCompare(e,t)}),n.fn.dataTableExt.oSort["version-desc"]=((e,t)=>u.versionCompare(e,t)),this.Update=new c,this.UploadForm=new d,this.Repository=new l;const e=this.manageExtensionListing();n(document).on("click",".onClickMaskExtensionManager",()=>{a.start()}).on("click","a[data-action=update-extension]",e=>{e.preventDefault(),n.ajax({url:n(this).attr("href"),dataType:"json",beforeSend:()=>{a.start()},success:this.updateExtension})}).on("change","input[name=unlockDependencyIgnoreButton]",e=>{n(".t3js-dependencies").toggleClass("disabled",!n(e.currentTarget).prop("checked"))}),n(m.searchField).clearable({onClear:()=>{e.search("").draw()}}),n(document).on("click",".t3-button-action-installdistribution",()=>{a.start()}),this.Repository.initDom(),this.Update.initializeEvents(),this.UploadForm.initializeEvents(),o.initialize("#typo3-extension-list [title]",{delay:{show:500,hide:100},trigger:"hover",container:"body"})})}manageExtensionListing(){const e=n(m.searchField),t=n(m.extensionlist).DataTable({paging:!1,dom:"lrtip",lengthChange:!1,pageLength:15,stateSave:!0,drawCallback:this.bindExtensionListActions,columns:[null,null,{type:"extension"},null,{type:"version"},{orderable:!1},null,null]});e.parents("form").on("submit",()=>!1);const a=u.getUrlVars(),i=a.search?a.search:t.search();return e.val(i),e.on("input",e=>{t.search(n(e.currentTarget).val()).draw()}),t}removeExtensionFromDisk(e){n.ajax({url:e.data("href"),beforeSend:()=>{a.start()},success:()=>{location.reload()},complete:()=>{a.done()}})}static getUrlVars(){let e,t=[],n=window.location.href.slice(window.location.href.indexOf("?")+1).split("&");for(let a=0;a<n.length;a++)e=n[a].split("="),t.push(e[0]),t[e[0]]=e[1];return t}static versionCompare(e,t){if(e===t)return 0;const n=e.split("."),a=t.split("."),i=Math.min(n.length,a.length);for(let e=0;e<i;e++){if(parseInt(n[e],10)>parseInt(a[e],10))return 1;if(parseInt(n[e],10)<parseInt(a[e],10))return-1}return n.length>a.length?1:n.length<a.length?-1:0}static extensionCompare(e,t){const n=document.createElement("div");n.innerHTML=e;const a=n.textContent||n.innerText||e;n.innerHTML=t;const i=n.textContent||n.innerText||t;return a.trim().localeCompare(i.trim())}updateExtension(e){let t=0;const o=n("<form>");n.each(e.updateComments,(e,a)=>{const i=n("<input>").attr({type:"radio",name:"version"}).val(e);0===t&&i.attr("checked","checked"),o.append([n("<h3>").append([i," "+p.encodeHtml(e)]),n("<div>").append(a.replace(/(\r\n|\n\r|\r|\n)/g,"\n").split(/\n/).map(e=>p.encodeHtml(e)).join("<br>"))]),t++});const s=n("<div>").append([n("<h1>").text(TYPO3.lang["extensionList.updateConfirmation.title"]),n("<h2>").text(TYPO3.lang["extensionList.updateConfirmation.message"]),o]);a.done(),i.confirm(TYPO3.lang["extensionList.updateConfirmation.questionVersionComments"],s,r.warning,[{text:TYPO3.lang["button.cancel"],active:!0,btnClass:"btn-default",trigger:()=>{i.dismiss()}},{text:TYPO3.lang["button.updateExtension"],btnClass:"btn-warning",trigger:()=>{n.ajax({url:e.url,data:{tx_extensionmanager_tools_extensionmanagerextensionmanager:{version:n("input:radio[name=version]:checked",i.currentModal).val()}},dataType:"json",beforeSend:()=>{a.start()},complete:()=>{location.reload()}}),i.dismiss()}}])}}let g=new u;return void 0===TYPO3.ExtensionManager&&(TYPO3.ExtensionManager=g),g});
\ No newline at end of file
+define(["require","exports","jquery","nprogress","TYPO3/CMS/Backend/Modal","TYPO3/CMS/Backend/Tooltip","TYPO3/CMS/Backend/Severity","TYPO3/CMS/Core/SecurityUtility","./Repository","./Update","./UploadForm","datatables","TYPO3/CMS/Backend/Input/Clearable"],function(e,t,n,a,i,o,r,s,l,c,d){"use strict";const p=new s;var u;!function(e){e.extensionlist="#typo3-extension-list",e.searchField="#Tx_Extensionmanager_extensionkey"}(u||(u={}));class m{constructor(){this.bindExtensionListActions=(()=>{n(".removeExtension").not(".transformed").each((e,t)=>{const a=n(t);a.data("href",a.attr("href")),a.attr("href","#"),a.addClass("transformed"),a.click(()=>{i.confirm(TYPO3.lang["extensionList.removalConfirmation.title"],TYPO3.lang["extensionList.removalConfirmation.question"],r.error,[{text:TYPO3.lang["button.cancel"],active:!0,btnClass:"btn-default",trigger:()=>{i.dismiss()}},{text:TYPO3.lang["button.remove"],btnClass:"btn-danger",trigger:()=>{this.removeExtensionFromDisk(a),i.dismiss()}}])})})}),n(()=>{n.fn.dataTableExt.oSort["extension-asc"]=((e,t)=>m.extensionCompare(e,t)),n.fn.dataTableExt.oSort["extension-desc"]=((e,t)=>{return-1*m.extensionCompare(e,t)}),n.fn.dataTableExt.oSort["version-asc"]=((e,t)=>{return-1*m.versionCompare(e,t)}),n.fn.dataTableExt.oSort["version-desc"]=((e,t)=>m.versionCompare(e,t)),this.Update=new c,this.UploadForm=new d,this.Repository=new l;const e=this.manageExtensionListing();let t;n(document).on("click",".onClickMaskExtensionManager",()=>{a.start()}).on("click","a[data-action=update-extension]",e=>{e.preventDefault(),n.ajax({url:n(this).attr("href"),dataType:"json",beforeSend:()=>{a.start()},success:this.updateExtension})}).on("change","input[name=unlockDependencyIgnoreButton]",e=>{n(".t3js-dependencies").toggleClass("disabled",!n(e.currentTarget).prop("checked"))}),null!==(t=document.querySelector(u.searchField))&&t.clearable({onClear:()=>{e.search("").draw()}}),n(document).on("click",".t3-button-action-installdistribution",()=>{a.start()}),this.Repository.initDom(),this.Update.initializeEvents(),this.UploadForm.initializeEvents(),o.initialize("#typo3-extension-list [title]",{delay:{show:500,hide:100},trigger:"hover",container:"body"})})}manageExtensionListing(){const e=n(u.searchField),t=n(u.extensionlist).DataTable({paging:!1,dom:"lrtip",lengthChange:!1,pageLength:15,stateSave:!0,drawCallback:this.bindExtensionListActions,columns:[null,null,{type:"extension"},null,{type:"version"},{orderable:!1},null,null]});e.parents("form").on("submit",()=>!1);const a=m.getUrlVars(),i=a.search?a.search:t.search();return e.val(i),e.on("input",e=>{t.search(n(e.currentTarget).val()).draw()}),t}removeExtensionFromDisk(e){n.ajax({url:e.data("href"),beforeSend:()=>{a.start()},success:()=>{location.reload()},complete:()=>{a.done()}})}static getUrlVars(){let e,t=[],n=window.location.href.slice(window.location.href.indexOf("?")+1).split("&");for(let a=0;a<n.length;a++)e=n[a].split("="),t.push(e[0]),t[e[0]]=e[1];return t}static versionCompare(e,t){if(e===t)return 0;const n=e.split("."),a=t.split("."),i=Math.min(n.length,a.length);for(let e=0;e<i;e++){if(parseInt(n[e],10)>parseInt(a[e],10))return 1;if(parseInt(n[e],10)<parseInt(a[e],10))return-1}return n.length>a.length?1:n.length<a.length?-1:0}static extensionCompare(e,t){const n=document.createElement("div");n.innerHTML=e;const a=n.textContent||n.innerText||e;n.innerHTML=t;const i=n.textContent||n.innerText||t;return a.trim().localeCompare(i.trim())}updateExtension(e){let t=0;const o=n("<form>");n.each(e.updateComments,(e,a)=>{const i=n("<input>").attr({type:"radio",name:"version"}).val(e);0===t&&i.attr("checked","checked"),o.append([n("<h3>").append([i," "+p.encodeHtml(e)]),n("<div>").append(a.replace(/(\r\n|\n\r|\r|\n)/g,"\n").split(/\n/).map(e=>p.encodeHtml(e)).join("<br>"))]),t++});const s=n("<div>").append([n("<h1>").text(TYPO3.lang["extensionList.updateConfirmation.title"]),n("<h2>").text(TYPO3.lang["extensionList.updateConfirmation.message"]),o]);a.done(),i.confirm(TYPO3.lang["extensionList.updateConfirmation.questionVersionComments"],s,r.warning,[{text:TYPO3.lang["button.cancel"],active:!0,btnClass:"btn-default",trigger:()=>{i.dismiss()}},{text:TYPO3.lang["button.updateExtension"],btnClass:"btn-warning",trigger:()=>{n.ajax({url:e.url,data:{tx_extensionmanager_tools_extensionmanagerextensionmanager:{version:n("input:radio[name=version]:checked",i.currentModal).val()}},dataType:"json",beforeSend:()=>{a.start()},complete:()=>{location.reload()}}),i.dismiss()}}])}}let g=new m;return void 0===TYPO3.ExtensionManager&&(TYPO3.ExtensionManager=g),g});
\ No newline at end of file
index df599ff..3a1756f 100644 (file)
@@ -10,4 +10,4 @@
  *
  * The TYPO3 project - inspiring people to share!
  */
-define(["require","exports","jquery","nprogress","TYPO3/CMS/Backend/Modal","TYPO3/CMS/Backend/Notification","TYPO3/CMS/Backend/Severity","datatables","TYPO3/CMS/Backend/jquery.clearable"],function(e,n,t,a,s,o,l){"use strict";return class{constructor(){this.downloadPath="",this.initDom=(()=>{a.configure({parent:".module-loading-indicator",showSpinner:!1}),t("#terTable").DataTable({lengthChange:!1,pageLength:15,stateSave:!1,info:!1,paging:!1,searching:!1,ordering:!1,drawCallback:this.bindDownload}),t("#terVersionTable").DataTable({lengthChange:!1,pageLength:15,stateSave:!1,info:!1,paging:!1,searching:!1,drawCallback:this.bindDownload,order:[[2,"asc"]],columns:[{orderable:!1},null,{type:"version"},null,null,null]}),t("#terSearchTable").DataTable({paging:!1,lengthChange:!1,stateSave:!1,searching:!1,language:{search:"Filter results:"},ordering:!1,drawCallback:this.bindDownload}),this.bindDownload(),this.bindSearchFieldResetter()}),this.bindDownload=(()=>{const e=t(".downloadFromTer form.download button[type=submit]");e.off("click"),e.on("click",e=>{e.preventDefault();const n=t(e.currentTarget).closest("form"),s=n.attr("data-href");this.downloadPath=n.find("input.downloadPath:checked").val(),t.ajax({url:s,dataType:"json",beforeSend:()=>{a.start()},success:this.getDependencies})})}),this.getDependencies=(e=>(a.done(),e.hasDependencies?s.confirm(e.title,t(e.message),l.info,[{text:TYPO3.lang["button.cancel"],active:!0,btnClass:"btn-default",trigger:()=>{s.dismiss()}},{text:TYPO3.lang["button.resolveDependencies"],btnClass:"btn-info",trigger:()=>{this.getResolveDependenciesAndInstallResult(e.url+"&tx_extensionmanager_tools_extensionmanagerextensionmanager[downloadPath]="+this.downloadPath),s.dismiss()}}]):e.hasErrors?o.error(e.title,e.message,15):this.getResolveDependenciesAndInstallResult(e.url+"&tx_extensionmanager_tools_extensionmanagerextensionmanager[downloadPath]="+this.downloadPath),!1)),this.getResolveDependenciesAndInstallResult=(e=>{t.ajax({url:e,dataType:"json",beforeSend:()=>{a.start()},success:e=>{if(e.errorCount>0)s.confirm(e.errorTitle,t(e.errorMessage),l.error,[{text:TYPO3.lang["button.cancel"],active:!0,btnClass:"btn-default",trigger:()=>{s.dismiss()}},{text:TYPO3.lang["button.resolveDependenciesIgnore"],btnClass:"btn-danger disabled t3js-dependencies",trigger:n=>{t(n.currentTarget).hasClass("disabled")||(this.getResolveDependenciesAndInstallResult(e.skipDependencyUri),s.dismiss())}}]),s.currentModal.on("shown.bs.modal",()=>{const e=s.currentModal.find(".t3js-dependencies");t('input[name="unlockDependencyIgnoreButton"]',s.currentModal).on("change",n=>{e.toggleClass("disabled",!t(n.currentTarget).prop("checked"))})});else{let n=TYPO3.lang["extensionList.dependenciesResolveDownloadSuccess.message"+e.installationTypeLanguageKey].replace(/\{0\}/g,e.extension);n+="\n"+TYPO3.lang["extensionList.dependenciesResolveDownloadSuccess.header"]+": ",t.each(e.result,(e,a)=>{n+="\n\n"+TYPO3.lang["extensionList.dependenciesResolveDownloadSuccess.item"]+" "+e+": ",t.each(a,e=>{n+="\n* "+e})}),o.info(TYPO3.lang["extensionList.dependenciesResolveFlashMessage.title"+e.installationTypeLanguageKey].replace(/\{0\}/g,e.extension),n,15),top.TYPO3.ModuleMenu.App.refreshMenu()}},complete:()=>{a.done()}})})}bindSearchFieldResetter(){const e=t('.typo3-extensionmanager-searchTerForm input[type="text"]'),n=""!==e.first().val();e.clearable({onClear:e=>{n&&t(e.currentTarget).closest("form").submit()}})}}});
\ No newline at end of file
+define(["require","exports","jquery","nprogress","TYPO3/CMS/Backend/Modal","TYPO3/CMS/Backend/Notification","TYPO3/CMS/Backend/Severity","datatables","TYPO3/CMS/Backend/Input/Clearable"],function(e,n,t,a,s,o,l){"use strict";return class{constructor(){this.downloadPath="",this.initDom=(()=>{a.configure({parent:".module-loading-indicator",showSpinner:!1}),t("#terTable").DataTable({lengthChange:!1,pageLength:15,stateSave:!1,info:!1,paging:!1,searching:!1,ordering:!1,drawCallback:this.bindDownload}),t("#terVersionTable").DataTable({lengthChange:!1,pageLength:15,stateSave:!1,info:!1,paging:!1,searching:!1,drawCallback:this.bindDownload,order:[[2,"asc"]],columns:[{orderable:!1},null,{type:"version"},null,null,null]}),t("#terSearchTable").DataTable({paging:!1,lengthChange:!1,stateSave:!1,searching:!1,language:{search:"Filter results:"},ordering:!1,drawCallback:this.bindDownload}),this.bindDownload(),this.bindSearchFieldResetter()}),this.bindDownload=(()=>{const e=t(".downloadFromTer form.download button[type=submit]");e.off("click"),e.on("click",e=>{e.preventDefault();const n=t(e.currentTarget).closest("form"),s=n.attr("data-href");this.downloadPath=n.find("input.downloadPath:checked").val(),t.ajax({url:s,dataType:"json",beforeSend:()=>{a.start()},success:this.getDependencies})})}),this.getDependencies=(e=>(a.done(),e.hasDependencies?s.confirm(e.title,t(e.message),l.info,[{text:TYPO3.lang["button.cancel"],active:!0,btnClass:"btn-default",trigger:()=>{s.dismiss()}},{text:TYPO3.lang["button.resolveDependencies"],btnClass:"btn-info",trigger:()=>{this.getResolveDependenciesAndInstallResult(e.url+"&tx_extensionmanager_tools_extensionmanagerextensionmanager[downloadPath]="+this.downloadPath),s.dismiss()}}]):e.hasErrors?o.error(e.title,e.message,15):this.getResolveDependenciesAndInstallResult(e.url+"&tx_extensionmanager_tools_extensionmanagerextensionmanager[downloadPath]="+this.downloadPath),!1)),this.getResolveDependenciesAndInstallResult=(e=>{t.ajax({url:e,dataType:"json",beforeSend:()=>{a.start()},success:e=>{if(e.errorCount>0)s.confirm(e.errorTitle,t(e.errorMessage),l.error,[{text:TYPO3.lang["button.cancel"],active:!0,btnClass:"btn-default",trigger:()=>{s.dismiss()}},{text:TYPO3.lang["button.resolveDependenciesIgnore"],btnClass:"btn-danger disabled t3js-dependencies",trigger:n=>{t(n.currentTarget).hasClass("disabled")||(this.getResolveDependenciesAndInstallResult(e.skipDependencyUri),s.dismiss())}}]),s.currentModal.on("shown.bs.modal",()=>{const e=s.currentModal.find(".t3js-dependencies");t('input[name="unlockDependencyIgnoreButton"]',s.currentModal).on("change",n=>{e.toggleClass("disabled",!t(n.currentTarget).prop("checked"))})});else{let n=TYPO3.lang["extensionList.dependenciesResolveDownloadSuccess.message"+e.installationTypeLanguageKey].replace(/\{0\}/g,e.extension);n+="\n"+TYPO3.lang["extensionList.dependenciesResolveDownloadSuccess.header"]+": ",t.each(e.result,(e,a)=>{n+="\n\n"+TYPO3.lang["extensionList.dependenciesResolveDownloadSuccess.item"]+" "+e+": ",t.each(a,e=>{n+="\n* "+e})}),o.info(TYPO3.lang["extensionList.dependenciesResolveFlashMessage.title"+e.installationTypeLanguageKey].replace(/\{0\}/g,e.extension),n,15),top.TYPO3.ModuleMenu.App.refreshMenu()}},complete:()=>{a.done()}})})}bindSearchFieldResetter(){let e;if(null!==(e=document.querySelector('.typo3-extensionmanager-searchTerForm input[type="text"]'))){const n=""!==e.value;e.clearable({onClear:e=>{n&&e.closest("form").submit()}})}}}});
\ No newline at end of file
index 77d9150..e9c0a41 100644 (file)
@@ -10,4 +10,4 @@
  *
  * The TYPO3 project - inspiring people to share!
  */
-define(["require","exports","jquery","nprogress","TYPO3/CMS/Backend/Notification","datatables","TYPO3/CMS/Backend/jquery.clearable"],function(e,a,t,s,r){"use strict";var n;!function(e){e.extensionTable="#terTable",e.terUpdateAction=".update-from-ter",e.pagination=".pagination-wrap",e.splashscreen=".splash-receivedata",e.terTableDataTableWrapper="#terTableWrapper .dataTables_wrapper"}(n||(n={}));return class{initializeEvents(){t(n.terUpdateAction).each((e,a)=>{const s=t(a),r=s.attr("action");s.attr("action","#"),s.submit(()=>(this.updateFromTer(r,!0),!1)),this.updateFromTer(r,!1)})}updateFromTer(e,a){a&&(e+="&tx_extensionmanager_tools_extensionmanagerextensionmanager%5BforceUpdateCheck%5D=1"),t(n.terUpdateAction).addClass("is-hidden"),t(n.extensionTable).hide(),t(n.splashscreen).addClass("is-shown"),t(n.terTableDataTableWrapper).addClass("is-loading"),t(n.pagination).addClass("is-loading");let i=!1;t.ajax({url:e,dataType:"json",cache:!1,beforeSend:()=>{s.start()},success:e=>{e.errorMessage.length&&r.error(TYPO3.lang["extensionList.updateFromTerFlashMessage.title"],e.errorMessage,10);const a=t(n.terUpdateAction+" .time-since-last-update");a.text(e.timeSinceLastUpdate),a.attr("title",TYPO3.lang["extensionList.updateFromTer.lastUpdate.timeOfLastUpdate"]+e.lastUpdateTime),e.updated&&(i=!0,window.location.replace(window.location.href))},error:(e,a,t)=>{const s=a+"("+t+"): "+e.responseText;r.warning(TYPO3.lang["extensionList.updateFromTerFlashMessage.title"],s,10)},complete:()=>{s.done(),i||(t(n.splashscreen).removeClass("is-shown"),t(n.terTableDataTableWrapper).removeClass("is-loading"),t(n.pagination).removeClass("is-loading"),t(n.terUpdateAction).removeClass("is-hidden"),t(n.extensionTable).show())}})}}});
\ No newline at end of file
+define(["require","exports","jquery","nprogress","TYPO3/CMS/Backend/Notification","datatables"],function(e,a,t,s,r){"use strict";var n;!function(e){e.extensionTable="#terTable",e.terUpdateAction=".update-from-ter",e.pagination=".pagination-wrap",e.splashscreen=".splash-receivedata",e.terTableDataTableWrapper="#terTableWrapper .dataTables_wrapper"}(n||(n={}));return class{initializeEvents(){t(n.terUpdateAction).each((e,a)=>{const s=t(a),r=s.attr("action");s.attr("action","#"),s.submit(()=>(this.updateFromTer(r,!0),!1)),this.updateFromTer(r,!1)})}updateFromTer(e,a){a&&(e+="&tx_extensionmanager_tools_extensionmanagerextensionmanager%5BforceUpdateCheck%5D=1"),t(n.terUpdateAction).addClass("is-hidden"),t(n.extensionTable).hide(),t(n.splashscreen).addClass("is-shown"),t(n.terTableDataTableWrapper).addClass("is-loading"),t(n.pagination).addClass("is-loading");let i=!1;t.ajax({url:e,dataType:"json",cache:!1,beforeSend:()=>{s.start()},success:e=>{e.errorMessage.length&&r.error(TYPO3.lang["extensionList.updateFromTerFlashMessage.title"],e.errorMessage,10);const a=t(n.terUpdateAction+" .time-since-last-update");a.text(e.timeSinceLastUpdate),a.attr("title",TYPO3.lang["extensionList.updateFromTer.lastUpdate.timeOfLastUpdate"]+e.lastUpdateTime),e.updated&&(i=!0,window.location.replace(window.location.href))},error:(e,a,t)=>{const s=a+"("+t+"): "+e.responseText;r.warning(TYPO3.lang["extensionList.updateFromTerFlashMessage.title"],s,10)},complete:()=>{s.done(),i||(t(n.splashscreen).removeClass("is-shown"),t(n.terTableDataTableWrapper).removeClass("is-loading"),t(n.pagination).removeClass("is-loading"),t(n.terUpdateAction).removeClass("is-hidden"),t(n.extensionTable).show())}})}}});
\ No newline at end of file
index b3527f1..fbba0b2 100644 (file)
@@ -10,4 +10,4 @@
  *
  * The TYPO3 project - inspiring people to share!
  */
-define(["require","exports","jquery","datatables","TYPO3/CMS/Backend/jquery.clearable"],function(e,s,a){"use strict";return class{constructor(){this.expandedUploadFormClass="transformed"}initializeEvents(){a(document).on("click",".t3js-upload",e=>{const s=a(e.currentTarget),t=a(".uploadForm");e.preventDefault(),s.hasClass(this.expandedUploadFormClass)?(t.stop().slideUp(),s.removeClass(this.expandedUploadFormClass)):(s.addClass(this.expandedUploadFormClass),t.stop().slideDown(),a.ajax({url:s.attr("href"),dataType:"html",success:e=>{t.html(e)}}))})}}});
\ No newline at end of file
+define(["require","exports","jquery","datatables"],function(s,e,a){"use strict";return class{constructor(){this.expandedUploadFormClass="transformed"}initializeEvents(){a(document).on("click",".t3js-upload",s=>{const e=a(s.currentTarget),t=a(".uploadForm");s.preventDefault(),e.hasClass(this.expandedUploadFormClass)?(t.stop().slideUp(),e.removeClass(this.expandedUploadFormClass)):(e.addClass(this.expandedUploadFormClass),t.stop().slideDown(),a.ajax({url:e.attr("href"),dataType:"html",success:s=>{t.html(s)}}))})}}});
\ No newline at end of file
index 7877e65..27f8578 100644 (file)
@@ -10,4 +10,4 @@
  *
  * The TYPO3 project - inspiring people to share!
  */
-define(["require","exports","jquery","TYPO3/CMS/Backend/jquery.clearable"],function(e,r,t){"use strict";return new class{constructor(){t(()=>{const e=t('input[name="tx_filelist_file_filelistlist[searchWord]"]'),r=""!==e.first().val();e.clearable({onClear:()=>{r&&e.closest("form").submit()}})})}}});
\ No newline at end of file
+define(["require","exports","jquery","TYPO3/CMS/Backend/Input/Clearable"],function(e,t,l){"use strict";return new class{constructor(){l(()=>{let e;if(null!==(e=document.querySelector('input[name="tx_filelist_file_filelistlist[searchWord]"]'))){const t=""!==e.value;e.clearable({onClear:e=>{t&&e.closest("form").submit()}})}})}}});
\ No newline at end of file
index 8457af6..388d75a 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(t,e,a,r,s,i){"use strict";return new class extends a.AbstractInteractableModule{constructor(){super(...arguments),this.selectorFormListener=".t3js-extensionConfiguration-form",this.selectorSearchInput=".t3js-extensionConfiguration-search"}initialize(e){this.currentModal=e,this.getContent(),e.on("keydown",t=>{const a=e.find(this.selectorSearchInput);t.ctrlKey||t.metaKey?"f"===String.fromCharCode(t.which).toLowerCase()&&(t.preventDefault(),a.focus()):27===t.keyCode&&(t.preventDefault(),a.val("").focus())}),e.on("keyup",this.selectorSearchInput,a=>{const s=r(a.target).val(),i=e.find(this.selectorSearchInput);e.find(".search-item").each((t,e)=>{const a=r(e);r(":contains("+s+")",a).length>0||r('input[value*="'+s+'"]',a).length>0?a.removeClass("hidden").addClass("searchhit"):a.removeClass("searchhit").addClass("hidden")}),e.find(".searchhit").collapse("show"),t(["jquery.clearable"],()=>{i.clearable().focus()})}),e.on("submit",this.selectorFormListener,t=>{t.preventDefault(),this.write(r(t.currentTarget))})}getContent(){const t=this.getModalBody();r.ajax({url:s.getUrl("extensionConfigurationGetContent"),cache:!1,success:e=>{!0===e.success&&(Array.isArray(e.status)&&e.status.forEach(t=>{i.success(t.title,t.message)}),t.html(e.html),this.initializeWrap())},error:e=>{s.handleAjaxError(e,t)}})}write(t){const e=this.getModalBody(),a=this.getModuleContent().data("extension-configuration-write-token"),n={};r.each(t.serializeArray(),(t,e)=>{n[e.name]=e.value}),r.ajax({url:s.getUrl(),method:"POST",data:{install:{token:a,action:"extensionConfigurationWrite",extensionKey:t.attr("data-extensionKey"),extensionConfiguration:n}},success:t=>{!0===t.success&&Array.isArray(t.status)?t.status.forEach(t=>{i.showMessage(t.title,t.message,t.severity)}):i.error("Something went wrong")},error:t=>{s.handleAjaxError(t,e)}}).always(()=>{})}initializeWrap(){this.findInModal(".t3js-emconf-offset").each((t,e)=>{const a=r(e),s=a.parent(),i=a.attr("id"),n=a.attr("value").split(",");a.attr("data-offsetfield-x","#"+i+"_offset_x").attr("data-offsetfield-y","#"+i+"_offset_y").wrap('<div class="hidden"></div>');const o=r("<div>",{class:"form-multigroup-item"}).append(r("<div>",{class:"input-group"}).append(r("<div>",{class:"input-group-addon"}).text("x"),r("<input>",{id:i+"_offset_x",class:"form-control t3js-emconf-offsetfield","data-target":"#"+i,value:r.trim(n[0])}))),d=r("<div>",{class:"form-multigroup-item"}).append(r("<div>",{class:"input-group"}).append(r("<div>",{class:"input-group-addon"}).text("y"),r("<input>",{id:i+"_offset_y",class:"form-control t3js-emconf-offsetfield","data-target":"#"+i,value:r.trim(n[1])}))),l=r("<div>",{class:"form-multigroup-wrap"}).append(o,d);s.append(l),s.find(".t3js-emconf-offsetfield").keyup(t=>{const e=s.find(r(t.currentTarget).data("target"));e.val(s.find(e.data("offsetfield-x")).val()+","+s.find(e.data("offsetfield-y")).val())})}),this.findInModal(".t3js-emconf-wrap").each((t,e)=>{const a=r(e),s=a.parent(),i=a.attr("id"),n=a.attr("value").split("|");a.attr("data-wrapfield-start","#"+i+"_wrap_start").attr("data-wrapfield-end","#"+i+"_wrap_end").wrap('<div class="hidden"></div>');const o=r("<div>",{class:"form-multigroup-wrap"}).append(r("<div>",{class:"form-multigroup-item"}).append(r("<input>",{id:i+"_wrap_start",class:"form-control t3js-emconf-wrapfield","data-target":"#"+i,value:r.trim(n[0])})),r("<div>",{class:"form-multigroup-item"}).append(r("<input>",{id:i+"_wrap_end",class:"form-control t3js-emconf-wrapfield","data-target":"#"+i,value:r.trim(n[1])})));s.append(o),s.find(".t3js-emconf-wrapfield").keyup(t=>{const e=s.find(r(t.currentTarget).data("target"));e.val(s.find(e.data("wrapfield-start")).val()+"|"+s.find(e.data("wrapfield-end")).val())})})}}});
\ No newline at end of file
+define(["require","exports","../AbstractInteractableModule","jquery","../../Router","TYPO3/CMS/Backend/Notification","bootstrap","../../Renderable/Clearable"],function(t,e,a,r,s,i){"use strict";return new class extends a.AbstractInteractableModule{constructor(){super(...arguments),this.selectorFormListener=".t3js-extensionConfiguration-form",this.selectorSearchInput=".t3js-extensionConfiguration-search"}initialize(t){this.currentModal=t,this.getContent(),t.on("keydown",e=>{const a=t.find(this.selectorSearchInput);e.ctrlKey||e.metaKey?"f"===String.fromCharCode(e.which).toLowerCase()&&(e.preventDefault(),a.focus()):27===e.keyCode&&(e.preventDefault(),a.val("").focus())}),t.on("keyup",this.selectorSearchInput,e=>{const a=r(e.target).val(),s=t.find(this.selectorSearchInput);t.find(".search-item").each((t,e)=>{const s=r(e);r(":contains("+a+")",s).length>0||r('input[value*="'+a+'"]',s).length>0?s.removeClass("hidden").addClass("searchhit"):s.removeClass("searchhit").addClass("hidden")}),t.find(".searchhit").collapse("show");const i=s.get(0);i.clearable(),i.focus()}),t.on("submit",this.selectorFormListener,t=>{t.preventDefault(),this.write(r(t.currentTarget))})}getContent(){const t=this.getModalBody();r.ajax({url:s.getUrl("extensionConfigurationGetContent"),cache:!1,success:e=>{!0===e.success&&(Array.isArray(e.status)&&e.status.forEach(t=>{i.success(t.title,t.message)}),t.html(e.html),this.initializeWrap())},error:e=>{s.handleAjaxError(e,t)}})}write(t){const e=this.getModalBody(),a=this.getModuleContent().data("extension-configuration-write-token"),n={};r.each(t.serializeArray(),(t,e)=>{n[e.name]=e.value}),r.ajax({url:s.getUrl(),method:"POST",data:{install:{token:a,action:"extensionConfigurationWrite",extensionKey:t.attr("data-extensionKey"),extensionConfiguration:n}},success:t=>{!0===t.success&&Array.isArray(t.status)?t.status.forEach(t=>{i.showMessage(t.title,t.message,t.severity)}):i.error("Something went wrong")},error:t=>{s.handleAjaxError(t,e)}}).always(()=>{})}initializeWrap(){this.findInModal(".t3js-emconf-offset").each((t,e)=>{const a=r(e),s=a.parent(),i=a.attr("id"),n=a.attr("value").split(",");a.attr("data-offsetfield-x","#"+i+"_offset_x").attr("data-offsetfield-y","#"+i+"_offset_y").wrap('<div class="hidden"></div>');const o=r("<div>",{class:"form-multigroup-item"}).append(r("<div>",{class:"input-group"}).append(r("<div>",{class:"input-group-addon"}).text("x"),r("<input>",{id:i+"_offset_x",class:"form-control t3js-emconf-offsetfield","data-target":"#"+i,value:r.trim(n[0])}))),d=r("<div>",{class:"form-multigroup-item"}).append(r("<div>",{class:"input-group"}).append(r("<div>",{class:"input-group-addon"}).text("y"),r("<input>",{id:i+"_offset_y",class:"form-control t3js-emconf-offsetfield","data-target":"#"+i,value:r.trim(n[1])}))),l=r("<div>",{class:"form-multigroup-wrap"}).append(o,d);s.append(l),s.find(".t3js-emconf-offsetfield").keyup(t=>{const e=s.find(r(t.currentTarget).data("target"));e.val(s.find(e.data("offsetfield-x")).val()+","+s.find(e.data("offsetfield-y")).val())})}),this.findInModal(".t3js-emconf-wrap").each((t,e)=>{const a=r(e),s=a.parent(),i=a.attr("id"),n=a.attr("value").split("|");a.attr("data-wrapfield-start","#"+i+"_wrap_start").attr("data-wrapfield-end","#"+i+"_wrap_end").wrap('<div class="hidden"></div>');const o=r("<div>",{class:"form-multigroup-wrap"}).append(r("<div>",{class:"form-multigroup-item"}).append(r("<input>",{id:i+"_wrap_start",class:"form-control t3js-emconf-wrapfield","data-target":"#"+i,value:r.trim(n[0])})),r("<div>",{class:"form-multigroup-item"}).append(r("<input>",{id:i+"_wrap_end",class:"form-control t3js-emconf-wrapfield","data-target":"#"+i,value:r.trim(n[1])})));s.append(o),s.find(".t3js-emconf-wrapfield").keyup(t=>{const e=s.find(r(t.currentTarget).data("target"));e.val(s.find(e.data("wrapfield-start")).val()+"|"+s.find(e.data("wrapfield-end")).val())})})}}});
\ No newline at end of file
index a9d0132..3f95035 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().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
+define(["require","exports","../AbstractInteractableModule","jquery","../../Router","TYPO3/CMS/Backend/Modal","TYPO3/CMS/Backend/Notification","bootstrap","../../Renderable/Clearable"],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(e){this.currentModal=e,this.getContent(),e.on("click",this.selectorWriteTrigger,()=>{this.write()}),e.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())),e.on("keydown",t=>{const r=e.find(this.selectorSearchTrigger);t.ctrlKey||t.metaKey?"f"===String.fromCharCode(t.which).toLowerCase()&&(t.preventDefault(),r.focus()):27===t.keyCode&&(t.preventDefault(),r.val("").focus())}),e.on("keyup",this.selectorSearchTrigger,t=>{const r=a(t.target).val(),s=e.find(this.selectorSearchTrigger);e.find("div.item").each((e,t)=>{const s=a(t);a(":contains("+r+")",s).length>0||a('input[value*="'+r+'"]',s).length>0?s.removeClass("hidden").addClass("searchhit"):s.removeClass("searchhit").addClass("hidden")}),e.find(".searchhit").parent().collapse("show");const o=s.get(0);o.clearable(),o.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 6745d3d..54ecd9f 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().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
+define(["require","exports","../AbstractInteractableModule","jquery","../../Router","TYPO3/CMS/Backend/Notification","bootstrap","../../Renderable/Clearable"],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()));const s=t.find(this.selectorFulltextSearch).get(0);s.clearable(),s.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);const e=this.fulltextSearchField.get(0);e.clearable(),e.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
diff --git a/typo3/sysext/install/Resources/Public/JavaScript/Renderable/Clearable.js b/typo3/sysext/install/Resources/Public/JavaScript/Renderable/Clearable.js
new file mode 100644 (file)
index 0000000..408eaca
--- /dev/null
@@ -0,0 +1,13 @@
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+define(["require","exports"],function(e,t){"use strict";class n{static createCloseButton(){const e=document.createElement("button");return e.type="button",e.innerHTML='<span class="t3js-icon icon icon-size-small icon-state-default icon-actions-close" data-identifier="actions-close">\n        <span class="icon-markup">\n            <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">\n                <path\n                    d="M11.9 5.5L9.4 8l2.5 2.5c.2.2.2.5 0\n                    .7l-.7.7c-.2.2-.5.2-.7 0L8 9.4l-2.5 2.5c-.2.2-.5.2-.7\n                    0l-.7-.7c-.2-.2-.2-.5 0-.7L6.6 8 4.1 5.5c-.2-.2-.2-.5\n                    0-.7l.7-.7c.2-.2.5-.2.7 0L8 6.6l2.5-2.5c.2-.2.5-.2.7\n                    0l.7.7c.2.2.2.5 0 .7z"\n                    class="icon-color"/>\n              </svg>\n            </span>\n          </span>',e.style.visibility="hidden",e.classList.add("close"),e}constructor(){"function"!=typeof HTMLInputElement.prototype.clearable&&this.registerClearable()}registerClearable(){HTMLInputElement.prototype.clearable=function(e={}){if(this.dataset.clearable)return;if("object"!=typeof e)throw new Error("Passed options must be an object, "+typeof e+" given");const t=document.createElement("div");t.classList.add("form-control-clearable"),this.parentNode.insertBefore(t,this),t.appendChild(this);const s=n.createCloseButton(),i=()=>{s.style.visibility=0===this.value.length?"hidden":"visible"};s.addEventListener("click",t=>{t.preventDefault(),this.value="","function"==typeof e.onClear&&e.onClear(this),this.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0})),i()}),t.appendChild(s),this.addEventListener("focus",i),this.addEventListener("keyup",i),i(),this.dataset.clearable="true"}}}return new n});
\ No newline at end of file
index 43319aa..8fe9d52 100644 (file)
@@ -10,4 +10,4 @@
  *
  * The TYPO3 project - inspiring people to share!
  */
-define(["require","exports","jquery","TYPO3/CMS/Backend/jquery.clearable"],function(e,s,r){"use strict";return new class{constructor(){this.$searchFields=r('input[name="searchString"]'),this.searchResultShown=""!==this.$searchFields.first().val(),this.$searchFields.clearable({onClear:()=>{this.searchResultShown&&r(this.$searchFields).closest("form").submit()}}),self.location.hash&&r("html, body").scrollTop((document.documentElement.scrollTop||document.body.scrollTop)-80)}}});
\ No newline at end of file
+define(["require","exports","jquery"],function(e,s,t){"use strict";return new class{constructor(){this.searchField=document.querySelector('input[name="searchString"]'),this.searchResultShown=""!==this.searchField.value,this.searchField.clearable({onClear:e=>{this.searchResultShown&&e.closest("form").submit()}}),self.location.hash&&t("html, body").scrollTop((document.documentElement.scrollTop||document.body.scrollTop)-80)}}});
\ No newline at end of file
index 1dac4c2..2e324f4 100644 (file)
@@ -10,4 +10,4 @@
  *
  * The TYPO3 project - inspiring people to share!
  */
-define(["require","exports","jquery","TYPO3/CMS/Backend/jquery.clearable"],function(t,i,e){"use strict";return new class{constructor(){this.form=null,this.limitField=null,this.initialize()}initialize(){this.form=e('form[name="queryform"]'),this.limitField=e("#queryLimit"),this.form.on("click",".t3js-submit-click",t=>{t.preventDefault(),this.doSubmit()}),this.form.on("change",".t3js-submit-change",t=>{t.preventDefault(),this.doSubmit()}),this.form.on("click",'.t3js-limit-submit input[type="button"]',t=>{t.preventDefault(),this.setLimit(e(t.currentTarget).data("value")),this.doSubmit()}),this.form.on("click",".t3js-addfield",t=>{t.preventDefault();const i=e(t.currentTarget);this.addValueToField(i.data("field"),i.val())}),this.form.find(".t3js-clearable").clearable({onClear:()=>{this.doSubmit()}})}doSubmit(){this.form.submit()}setLimit(t){this.limitField.val(t)}addValueToField(t,i){const e=this.form.find('[name="'+t+'"]'),l=e.val();e.val(l+","+i)}}});
\ No newline at end of file
+define(["require","exports","jquery","TYPO3/CMS/Backend/Input/Clearable"],function(t,i,e){"use strict";return new class{constructor(){this.form=null,this.limitField=null,this.initialize()}initialize(){this.form=e('form[name="queryform"]'),this.limitField=e("#queryLimit"),this.form.on("click",".t3js-submit-click",t=>{t.preventDefault(),this.doSubmit()}),this.form.on("change",".t3js-submit-change",t=>{t.preventDefault(),this.doSubmit()}),this.form.on("click",'.t3js-limit-submit input[type="button"]',t=>{t.preventDefault(),this.setLimit(e(t.currentTarget).data("value")),this.doSubmit()}),this.form.on("click",".t3js-addfield",t=>{t.preventDefault();const i=e(t.currentTarget);this.addValueToField(i.data("field"),i.val())}),document.querySelectorAll('form[name="queryform"] .t3js-clearable').forEach(t=>t.clearable({onClear:()=>{this.doSubmit()}}))}doSubmit(){this.form.submit()}setLimit(t){this.limitField.val(t)}addValueToField(t,i){const e=this.form.find('[name="'+t+'"]'),l=e.val();e.val(l+","+i)}}});
\ No newline at end of file
index 9012548..63de183 100644 (file)
@@ -10,4 +10,4 @@
  *
  * The TYPO3 project - inspiring people to share!
  */
-define(["require","exports","jquery","nprogress","TYPO3/CMS/Backend/Modal","TYPO3/CMS/Backend/Notification","TYPO3/CMS/Backend/Severity","TYPO3/CMS/Backend/jquery.clearable"],function(e,t,a,s,n,l,i){"use strict";var r;!function(e){e.searchForm="#recycler-form",e.searchText="#recycler-form [name=search-text]",e.searchSubmitBtn="#recycler-form button[type=submit]",e.depthSelector="#recycler-form [name=depth]",e.tableSelector="#recycler-form [name=pages]",e.recyclerTable="#itemsInRecycler",e.paginator="#recycler-index nav",e.reloadAction="a[data-action=reload]",e.massUndo="button[data-action=massundo]",e.massDelete="button[data-action=massdelete]",e.toggleAll=".t3js-toggle-all"}(r||(r={}));class o{constructor(){this.elements={},this.paging={currentPage:1,totalPages:1,totalItems:0,itemsPerPage:TYPO3.settings.Recycler.pagingSize},this.markedRecordsForMassAction=[],this.allToggled=!1,this.handleCheckboxSelects=(e=>{const t=a(e.currentTarget),s=t.parents("tr"),n=s.data("table")+":"+s.data("uid");if(t.prop("checked"))this.markedRecordsForMassAction.push(n),s.addClass("warning");else{const e=this.markedRecordsForMassAction.indexOf(n);e>-1&&this.markedRecordsForMassAction.splice(e,1),s.removeClass("warning")}if(this.markedRecordsForMassAction.length>0){this.elements.$massUndo.hasClass("disabled")&&this.elements.$massUndo.removeClass("disabled").removeAttr("disabled"),this.elements.$massDelete.hasClass("disabled")&&this.elements.$massDelete.removeClass("disabled").removeAttr("disabled");const e=this.createMessage(TYPO3.lang["button.undoselected"],[this.markedRecordsForMassAction.length]),t=this.createMessage(TYPO3.lang["button.deleteselected"],[this.markedRecordsForMassAction.length]);this.elements.$massUndo.find("span.text").text(e),this.elements.$massDelete.find("span.text").text(t)}else this.resetMassActionButtons()}),this.deleteRecord=(e=>{if(TYPO3.settings.Recycler.deleteDisable)return;const t=a(e.currentTarget).parents("tr"),s="TBODY"!==t.parent().prop("tagName");let l,r;if(s)l=this.markedRecordsForMassAction,r=TYPO3.lang["modal.massdelete.text"];else{const e=t.data("uid"),a=t.data("table"),s=t.data("recordtitle");l=[a+":"+e],r="pages"===a?TYPO3.lang["modal.deletepage.text"]:TYPO3.lang["modal.deletecontent.text"],r=this.createMessage(r,[s,"["+l[0]+"]"])}n.confirm(TYPO3.lang["modal.delete.header"],r,i.error,[{text:TYPO3.lang["button.cancel"],btnClass:"btn-default",trigger:function(){n.dismiss()}},{text:TYPO3.lang["button.delete"],btnClass:"btn-danger",trigger:()=>{this.callAjaxAction("delete",l,s)}}])}),this.undoRecord=(e=>{const t=a(e.currentTarget).parents("tr"),s="TBODY"!==t.parent().prop("tagName");let l,r,o;if(s)l=this.markedRecordsForMassAction,r=TYPO3.lang["modal.massundo.text"],o=!0;else{const e=t.data("uid"),a=t.data("table"),s=t.data("recordtitle");l=[a+":"+e],r=(o="pages"===a)?TYPO3.lang["modal.undopage.text"]:TYPO3.lang["modal.undocontent.text"],r=this.createMessage(r,[s,"["+l[0]+"]"]),o&&t.data("parentDeleted")&&(r+=TYPO3.lang["modal.undo.parentpages"])}let c=null;c=o?a("<div />").append(a("<p />").text(r),a("<div />",{class:"checkbox"}).append(a("<label />").append(TYPO3.lang["modal.undo.recursive"]).prepend(a("<input />",{id:"undo-recursive",type:"checkbox"})))):a("<p />").text(r),n.confirm(TYPO3.lang["modal.undo.header"],c,i.ok,[{text:TYPO3.lang["button.cancel"],btnClass:"btn-default",trigger:function(){n.dismiss()}},{text:TYPO3.lang["button.undo"],btnClass:"btn-success",trigger:()=>{this.callAjaxAction("undo","object"==typeof l?l:[l],s,c.find("#undo-recursive").prop("checked"))}}])}),a(()=>{this.initialize()})}static refreshPageTree(){top.TYPO3&&top.TYPO3.Backend&&top.TYPO3.Backend.NavigationContainer&&top.TYPO3.Backend.NavigationContainer.PageTree&&top.TYPO3.Backend.NavigationContainer.PageTree.refreshTree()}getElements(){this.elements={$searchForm:a(r.searchForm),$searchTextField:a(r.searchText),$searchSubmitBtn:a(r.searchSubmitBtn),$depthSelector:a(r.depthSelector),$tableSelector:a(r.tableSelector),$recyclerTable:a(r.recyclerTable),$tableBody:a(r.recyclerTable).find("tbody"),$paginator:a(r.paginator),$reloadAction:a(r.reloadAction),$massUndo:a(r.massUndo),$massDelete:a(r.massDelete),$toggleAll:a(r.toggleAll)}}registerEvents(){this.elements.$searchForm.on("submit",e=>{e.preventDefault(),""!==this.elements.$searchTextField.val()&&this.loadDeletedElements()}),this.elements.$searchTextField.on("keyup",e=>{""!==a(e.currentTarget).val()?this.elements.$searchSubmitBtn.removeClass("disabled"):(this.elements.$searchSubmitBtn.addClass("disabled"),this.loadDeletedElements())}).clearable({onClear:()=>{this.elements.$searchSubmitBtn.addClass("disabled"),this.loadDeletedElements()}}),this.elements.$depthSelector.on("change",()=>{a.when(this.loadAvailableTables()).done(()=>{this.loadDeletedElements()})}),this.elements.$tableSelector.on("change",()=>{this.paging.currentPage=1,this.loadDeletedElements()}),this.elements.$recyclerTable.on("click","[data-action=undo]",this.undoRecord),this.elements.$recyclerTable.on("click","[data-action=delete]",this.deleteRecord),this.elements.$reloadAction.on("click",e=>{e.preventDefault(),a.when(this.loadAvailableTables()).done(()=>{this.loadDeletedElements()})}),this.elements.$paginator.on("click","a[data-action]",e=>{e.preventDefault();const t=a(e.currentTarget);let s=!1;switch(t.data("action")){case"previous":this.paging.currentPage>1&&(this.paging.currentPage--,s=!0);break;case"next":this.paging.currentPage<this.paging.totalPages&&(this.paging.currentPage++,s=!0);break;case"page":this.paging.currentPage=parseInt(t.find("span").text(),10),s=!0}s&&this.loadDeletedElements()}),TYPO3.settings.Recycler.deleteDisable?this.elements.$massDelete.remove():this.elements.$massDelete.show(),this.elements.$recyclerTable.on("show.bs.collapse hide.bs.collapse","tr.collapse",e=>{let t,s,n=a(e.currentTarget).prev("tr").find("[data-action=expand]").find(".t3-icon");switch(e.type){case"show":t="t3-icon-pagetree-collapse",s="t3-icon-pagetree-expand";break;case"hide":t="t3-icon-pagetree-expand",s="t3-icon-pagetree-collapse"}n.removeClass(t).addClass(s)}),this.elements.$toggleAll.on("click",()=>{this.allToggled=!this.allToggled,a('input[type="checkbox"]').prop("checked",this.allToggled).trigger("change")}),this.elements.$recyclerTable.on("change","tr input[type=checkbox]",this.handleCheckboxSelects),this.elements.$massUndo.on("click",this.undoRecord),this.elements.$massDelete.on("click",this.deleteRecord)}initialize(){s.configure({parent:".module-loading-indicator",showSpinner:!1}),this.getElements(),this.registerEvents(),TYPO3.settings.Recycler.depthSelection>0?this.elements.$depthSelector.val(TYPO3.settings.Recycler.depthSelection).trigger("change"):a.when(this.loadAvailableTables()).done(()=>{this.loadDeletedElements()})}resetMassActionButtons(){this.markedRecordsForMassAction=[],this.elements.$massUndo.addClass("disabled").attr("disabled",!0),this.elements.$massUndo.find("span.text").text(TYPO3.lang["button.undo"]),this.elements.$massDelete.addClass("disabled").attr("disabled",!0),this.elements.$massDelete.find("span.text").text(TYPO3.lang["button.delete"])}loadAvailableTables(){return a.ajax({url:TYPO3.settings.ajaxUrls.recycler,dataType:"json",data:{action:"getTables",startUid:TYPO3.settings.Recycler.startUid,depth:this.elements.$depthSelector.find("option:selected").val()},beforeSend:()=>{s.start(),this.elements.$tableSelector.val(""),this.paging.currentPage=1},success:e=>{const t=[];this.elements.$tableSelector.children().remove(),a.each(e,(e,s)=>{const n=s[0],l=s[1],i=(s[2]?s[2]:TYPO3.lang.label_allrecordtypes)+" ("+l+")";t.push(a("<option />").val(n).text(i))}),t.length>0&&(this.elements.$tableSelector.append(t),""!==TYPO3.settings.Recycler.tableSelection&&this.elements.$tableSelector.val(TYPO3.settings.Recycler.tableSelection))},complete:()=>{s.done()}})}loadDeletedElements(){return a.ajax({url:TYPO3.settings.ajaxUrls.recycler,dataType:"json",data:{action:"getDeletedRecords",depth:this.elements.$depthSelector.find("option:selected").val(),startUid:TYPO3.settings.Recycler.startUid,table:this.elements.$tableSelector.find("option:selected").val(),filterTxt:this.elements.$searchTextField.val(),start:(this.paging.currentPage-1)*this.paging.itemsPerPage,limit:this.paging.itemsPerPage},beforeSend:()=>{s.start(),this.resetMassActionButtons()},success:e=>{this.elements.$tableBody.html(e.rows),this.buildPaginator(e.totalItems)},complete:()=>{s.done()}})}callAjaxAction(e,t,i,r=!1){let c={records:t,action:""},d=!1;if("undo"===e)c.action="undoRecords",c.recursive=r?1:0,d=!0;else{if("delete"!==e)return;c.action="deleteRecords"}a.ajax({url:TYPO3.settings.ajaxUrls.recycler,type:"POST",dataType:"json",data:c,beforeSend:()=>{s.start()},success:e=>{e.success?l.success("",e.message):l.error("",e.message),this.paging.currentPage=1,a.when(this.loadAvailableTables()).done(()=>{this.loadDeletedElements(),i&&this.resetMassActionButtons(),d&&o.refreshPageTree(),this.allToggled=!1})},complete:()=>{n.dismiss(),s.done()}})}createMessage(e,t){return void 0===e?"":e.replace(/\{([0-9]+)\}/g,function(e,a){return t[a]})}buildPaginator(e){if(0===e)return void this.elements.$paginator.contents().remove();if(this.paging.totalItems=e,this.paging.totalPages=Math.ceil(e/this.paging.itemsPerPage),1===this.paging.totalPages)return void this.elements.$paginator.contents().remove();const t=a("<ul />",{class:"pagination pagination-block"}),s=[],n=a("<li />").append(a("<a />",{"data-action":"previous"}).append(a("<span />",{class:"t3-icon fa fa-arrow-left"}))),l=a("<li />").append(a("<a />",{"data-action":"next"}).append(a("<span />",{class:"t3-icon fa fa-arrow-right"})));1===this.paging.currentPage&&n.disablePagingAction(),this.paging.currentPage===this.paging.totalPages&&l.disablePagingAction();for(let e=1;e<=this.paging.totalPages;e++){const t=a("<li />",{class:this.paging.currentPage===e?"active":""});t.append(a("<a />",{"data-action":"page"}).append(a("<span />").text(e))),s.push(t)}t.append(n,s,l),this.elements.$paginator.html(t)}}return a.fn.disablePagingAction=function(){a(this).addClass("disabled").find(".t3-icon").unwrap().wrap(a("<span />"))},new o});
\ No newline at end of file
+define(["require","exports","jquery","nprogress","TYPO3/CMS/Backend/Modal","TYPO3/CMS/Backend/Notification","TYPO3/CMS/Backend/Severity"],function(e,t,a,s,n,l,i){"use strict";var r;!function(e){e.searchForm="#recycler-form",e.searchText="#recycler-form [name=search-text]",e.searchSubmitBtn="#recycler-form button[type=submit]",e.depthSelector="#recycler-form [name=depth]",e.tableSelector="#recycler-form [name=pages]",e.recyclerTable="#itemsInRecycler",e.paginator="#recycler-index nav",e.reloadAction="a[data-action=reload]",e.massUndo="button[data-action=massundo]",e.massDelete="button[data-action=massdelete]",e.toggleAll=".t3js-toggle-all"}(r||(r={}));class o{constructor(){this.elements={},this.paging={currentPage:1,totalPages:1,totalItems:0,itemsPerPage:TYPO3.settings.Recycler.pagingSize},this.markedRecordsForMassAction=[],this.allToggled=!1,this.handleCheckboxSelects=(e=>{const t=a(e.currentTarget),s=t.parents("tr"),n=s.data("table")+":"+s.data("uid");if(t.prop("checked"))this.markedRecordsForMassAction.push(n),s.addClass("warning");else{const e=this.markedRecordsForMassAction.indexOf(n);e>-1&&this.markedRecordsForMassAction.splice(e,1),s.removeClass("warning")}if(this.markedRecordsForMassAction.length>0){this.elements.$massUndo.hasClass("disabled")&&this.elements.$massUndo.removeClass("disabled").removeAttr("disabled"),this.elements.$massDelete.hasClass("disabled")&&this.elements.$massDelete.removeClass("disabled").removeAttr("disabled");const e=this.createMessage(TYPO3.lang["button.undoselected"],[this.markedRecordsForMassAction.length]),t=this.createMessage(TYPO3.lang["button.deleteselected"],[this.markedRecordsForMassAction.length]);this.elements.$massUndo.find("span.text").text(e),this.elements.$massDelete.find("span.text").text(t)}else this.resetMassActionButtons()}),this.deleteRecord=(e=>{if(TYPO3.settings.Recycler.deleteDisable)return;const t=a(e.currentTarget).parents("tr"),s="TBODY"!==t.parent().prop("tagName");let l,r;if(s)l=this.markedRecordsForMassAction,r=TYPO3.lang["modal.massdelete.text"];else{const e=t.data("uid"),a=t.data("table"),s=t.data("recordtitle");l=[a+":"+e],r="pages"===a?TYPO3.lang["modal.deletepage.text"]:TYPO3.lang["modal.deletecontent.text"],r=this.createMessage(r,[s,"["+l[0]+"]"])}n.confirm(TYPO3.lang["modal.delete.header"],r,i.error,[{text:TYPO3.lang["button.cancel"],btnClass:"btn-default",trigger:function(){n.dismiss()}},{text:TYPO3.lang["button.delete"],btnClass:"btn-danger",trigger:()=>{this.callAjaxAction("delete",l,s)}}])}),this.undoRecord=(e=>{const t=a(e.currentTarget).parents("tr"),s="TBODY"!==t.parent().prop("tagName");let l,r,o;if(s)l=this.markedRecordsForMassAction,r=TYPO3.lang["modal.massundo.text"],o=!0;else{const e=t.data("uid"),a=t.data("table"),s=t.data("recordtitle");l=[a+":"+e],r=(o="pages"===a)?TYPO3.lang["modal.undopage.text"]:TYPO3.lang["modal.undocontent.text"],r=this.createMessage(r,[s,"["+l[0]+"]"]),o&&t.data("parentDeleted")&&(r+=TYPO3.lang["modal.undo.parentpages"])}let c=null;c=o?a("<div />").append(a("<p />").text(r),a("<div />",{class:"checkbox"}).append(a("<label />").append(TYPO3.lang["modal.undo.recursive"]).prepend(a("<input />",{id:"undo-recursive",type:"checkbox"})))):a("<p />").text(r),n.confirm(TYPO3.lang["modal.undo.header"],c,i.ok,[{text:TYPO3.lang["button.cancel"],btnClass:"btn-default",trigger:function(){n.dismiss()}},{text:TYPO3.lang["button.undo"],btnClass:"btn-success",trigger:()=>{this.callAjaxAction("undo","object"==typeof l?l:[l],s,c.find("#undo-recursive").prop("checked"))}}])}),a(()=>{this.initialize()})}static refreshPageTree(){top.TYPO3&&top.TYPO3.Backend&&top.TYPO3.Backend.NavigationContainer&&top.TYPO3.Backend.NavigationContainer.PageTree&&top.TYPO3.Backend.NavigationContainer.PageTree.refreshTree()}getElements(){this.elements={$searchForm:a(r.searchForm),$searchTextField:a(r.searchText),$searchSubmitBtn:a(r.searchSubmitBtn),$depthSelector:a(r.depthSelector),$tableSelector:a(r.tableSelector),$recyclerTable:a(r.recyclerTable),$tableBody:a(r.recyclerTable).find("tbody"),$paginator:a(r.paginator),$reloadAction:a(r.reloadAction),$massUndo:a(r.massUndo),$massDelete:a(r.massDelete),$toggleAll:a(r.toggleAll)}}registerEvents(){this.elements.$searchForm.on("submit",e=>{e.preventDefault(),""!==this.elements.$searchTextField.val()&&this.loadDeletedElements()}),this.elements.$searchTextField.on("keyup",e=>{""!==a(e.currentTarget).val()?this.elements.$searchSubmitBtn.removeClass("disabled"):(this.elements.$searchSubmitBtn.addClass("disabled"),this.loadDeletedElements())}),this.elements.$searchTextField.get(0).clearable({onClear:()=>{this.elements.$searchSubmitBtn.addClass("disabled"),this.loadDeletedElements()}}),this.elements.$depthSelector.on("change",()=>{a.when(this.loadAvailableTables()).done(()=>{this.loadDeletedElements()})}),this.elements.$tableSelector.on("change",()=>{this.paging.currentPage=1,this.loadDeletedElements()}),this.elements.$recyclerTable.on("click","[data-action=undo]",this.undoRecord),this.elements.$recyclerTable.on("click","[data-action=delete]",this.deleteRecord),this.elements.$reloadAction.on("click",e=>{e.preventDefault(),a.when(this.loadAvailableTables()).done(()=>{this.loadDeletedElements()})}),this.elements.$paginator.on("click","a[data-action]",e=>{e.preventDefault();const t=a(e.currentTarget);let s=!1;switch(t.data("action")){case"previous":this.paging.currentPage>1&&(this.paging.currentPage--,s=!0);break;case"next":this.paging.currentPage<this.paging.totalPages&&(this.paging.currentPage++,s=!0);break;case"page":this.paging.currentPage=parseInt(t.find("span").text(),10),s=!0}s&&this.loadDeletedElements()}),TYPO3.settings.Recycler.deleteDisable?this.elements.$massDelete.remove():this.elements.$massDelete.show(),this.elements.$recyclerTable.on("show.bs.collapse hide.bs.collapse","tr.collapse",e=>{let t,s,n=a(e.currentTarget).prev("tr").find("[data-action=expand]").find(".t3-icon");switch(e.type){case"show":t="t3-icon-pagetree-collapse",s="t3-icon-pagetree-expand";break;case"hide":t="t3-icon-pagetree-expand",s="t3-icon-pagetree-collapse"}n.removeClass(t).addClass(s)}),this.elements.$toggleAll.on("click",()=>{this.allToggled=!this.allToggled,a('input[type="checkbox"]').prop("checked",this.allToggled).trigger("change")}),this.elements.$recyclerTable.on("change","tr input[type=checkbox]",this.handleCheckboxSelects),this.elements.$massUndo.on("click",this.undoRecord),this.elements.$massDelete.on("click",this.deleteRecord)}initialize(){s.configure({parent:".module-loading-indicator",showSpinner:!1}),this.getElements(),this.registerEvents(),TYPO3.settings.Recycler.depthSelection>0?this.elements.$depthSelector.val(TYPO3.settings.Recycler.depthSelection).trigger("change"):a.when(this.loadAvailableTables()).done(()=>{this.loadDeletedElements()})}resetMassActionButtons(){this.markedRecordsForMassAction=[],this.elements.$massUndo.addClass("disabled").attr("disabled",!0),this.elements.$massUndo.find("span.text").text(TYPO3.lang["button.undo"]),this.elements.$massDelete.addClass("disabled").attr("disabled",!0),this.elements.$massDelete.find("span.text").text(TYPO3.lang["button.delete"])}loadAvailableTables(){return a.ajax({url:TYPO3.settings.ajaxUrls.recycler,dataType:"json",data:{action:"getTables",startUid:TYPO3.settings.Recycler.startUid,depth:this.elements.$depthSelector.find("option:selected").val()},beforeSend:()=>{s.start(),this.elements.$tableSelector.val(""),this.paging.currentPage=1},success:e=>{const t=[];this.elements.$tableSelector.children().remove(),a.each(e,(e,s)=>{const n=s[0],l=s[1],i=(s[2]?s[2]:TYPO3.lang.label_allrecordtypes)+" ("+l+")";t.push(a("<option />").val(n).text(i))}),t.length>0&&(this.elements.$tableSelector.append(t),""!==TYPO3.settings.Recycler.tableSelection&&this.elements.$tableSelector.val(TYPO3.settings.Recycler.tableSelection))},complete:()=>{s.done()}})}loadDeletedElements(){return a.ajax({url:TYPO3.settings.ajaxUrls.recycler,dataType:"json",data:{action:"getDeletedRecords",depth:this.elements.$depthSelector.find("option:selected").val(),startUid:TYPO3.settings.Recycler.startUid,table:this.elements.$tableSelector.find("option:selected").val(),filterTxt:this.elements.$searchTextField.val(),start:(this.paging.currentPage-1)*this.paging.itemsPerPage,limit:this.paging.itemsPerPage},beforeSend:()=>{s.start(),this.resetMassActionButtons()},success:e=>{this.elements.$tableBody.html(e.rows),this.buildPaginator(e.totalItems)},complete:()=>{s.done()}})}callAjaxAction(e,t,i,r=!1){let c={records:t,action:""},d=!1;if("undo"===e)c.action="undoRecords",c.recursive=r?1:0,d=!0;else{if("delete"!==e)return;c.action="deleteRecords"}a.ajax({url:TYPO3.settings.ajaxUrls.recycler,type:"POST",dataType:"json",data:c,beforeSend:()=>{s.start()},success:e=>{e.success?l.success("",e.message):l.error("",e.message),this.paging.currentPage=1,a.when(this.loadAvailableTables()).done(()=>{this.loadDeletedElements(),i&&this.resetMassActionButtons(),d&&o.refreshPageTree(),this.allToggled=!1})},complete:()=>{n.dismiss(),s.done()}})}createMessage(e,t){return void 0===e?"":e.replace(/\{([0-9]+)\}/g,function(e,a){return t[a]})}buildPaginator(e){if(0===e)return void this.elements.$paginator.contents().remove();if(this.paging.totalItems=e,this.paging.totalPages=Math.ceil(e/this.paging.itemsPerPage),1===this.paging.totalPages)return void this.elements.$paginator.contents().remove();const t=a("<ul />",{class:"pagination pagination-block"}),s=[],n=a("<li />").append(a("<a />",{"data-action":"previous"}).append(a("<span />",{class:"t3-icon fa fa-arrow-left"}))),l=a("<li />").append(a("<a />",{"data-action":"next"}).append(a("<span />",{class:"t3-icon fa fa-arrow-right"})));1===this.paging.currentPage&&n.disablePagingAction(),this.paging.currentPage===this.paging.totalPages&&l.disablePagingAction();for(let e=1;e<=this.paging.totalPages;e++){const t=a("<li />",{class:this.paging.currentPage===e?"active":""});t.append(a("<a />",{"data-action":"page"}).append(a("<span />").text(e))),s.push(t)}t.append(n,s,l),this.elements.$paginator.html(t)}}return a.fn.disablePagingAction=function(){a(this).addClass("disabled").find(".t3-icon").unwrap().wrap(a("<span />"))},new o});
\ No newline at end of file
index 87e3d7d..d92f44a 100644 (file)
@@ -10,4 +10,4 @@
  *
  * The TYPO3 project - inspiring people to share!
  */
-define(["require","exports","jquery","TYPO3/CMS/Backend/jquery.clearable"],function(e,s,r){"use strict";return new class{constructor(){this.$searchFields=r('input[name="search_field"]'),this.searchResultShown=""!==this.$searchFields.first().val(),this.$searchFields.clearable({onClear:e=>{this.searchResultShown&&r(e.currentTarget).closest("form").submit()}}),self.location.hash&&window.scrollTo(window.pageXOffset,window.pageYOffset-40)}}});
\ No newline at end of file
+define(["require","exports","TYPO3/CMS/Backend/Input/Clearable"],function(e,s){"use strict";return new class{constructor(){this.searchField=document.querySelector('input[name="search_field"]'),this.searchResultShown=""!==this.searchField.value,this.searchField.clearable({onClear:e=>{this.searchResultShown&&e.closest("form").submit()}}),self.location.hash&&window.scrollTo(window.pageXOffset,window.pageYOffset-40)}}});
\ No newline at end of file
index 0f82c73..39ee7e2 100644 (file)
@@ -10,4 +10,4 @@
  *
  * The TYPO3 project - inspiring people to share!
  */
-define(["require","exports","TYPO3/CMS/Backend/Enum/Severity","jquery","TYPO3/CMS/Backend/Modal","TYPO3/CMS/Backend/Storage/Persistent","TYPO3/CMS/Core/SecurityUtility","TYPO3/CMS/Backend/Tooltip","TYPO3/CMS/Backend/Utility","TYPO3/CMS/Backend/Viewport","TYPO3/CMS/Backend/Wizard","./Workspaces","twbs/bootstrap-slider","nprogress","TYPO3/CMS/Backend/jquery.clearable"],function(require,exports,Severity_1,$,Modal,Persistent,SecurityUtility,Tooltip,Utility,Viewport,Wizard,Workspaces_1){"use strict";var Identifiers;!function(e){e.searchForm="#workspace-settings-form",e.searchTextField='#workspace-settings-form input[name="search-text"]',e.searchSubmitBtn='#workspace-settings-form button[type="submit"]',e.depthSelector='#workspace-settings-form [name="depth"]',e.languageSelector='#workspace-settings-form select[name="languages"]',e.chooseStageAction='#workspace-actions-form [name="stage-action"]',e.chooseSelectionAction='#workspace-actions-form [name="selection-action"]',e.chooseMassAction='#workspace-actions-form [name="mass-action"]',e.container="#workspace-panel",e.actionIcons="#workspace-action-icons",e.toggleAll=".t3js-toggle-all",e.previewLinksButton=".t3js-preview-link",e.pagination="#workspace-pagination"}(Identifiers||(Identifiers={}));class Backend extends Workspaces_1.default{constructor(){super(),this.elements={},this.settings={dir:"ASC",id:TYPO3.settings.Workspaces.id,language:TYPO3.settings.Workspaces.language,limit:30,query:"",sort:"label_Live",start:0,filterTxt:""},this.paging={currentPage:1,totalPages:1,totalItems:0},this.allToggled=!1,this.latestPath="",this.markedRecordsForMassAction=[],this.indentationPadding=26,this.handleCheckboxChange=(e=>{const t=$(e.currentTarget),a=t.parents("tr"),s=a.data("table")+":"+a.data("uid")+":"+a.data("t3ver_oid");if(t.prop("checked"))this.markedRecordsForMassAction.push(s),a.addClass("warning");else{const e=this.markedRecordsForMassAction.indexOf(s);e>-1&&this.markedRecordsForMassAction.splice(e,1),a.removeClass("warning")}this.elements.$chooseStageAction.prop("disabled",0===this.markedRecordsForMassAction.length),this.elements.$chooseSelectionAction.prop("disabled",0===this.markedRecordsForMassAction.length),this.elements.$chooseMassAction.prop("disabled",this.markedRecordsForMassAction.length>0)}),this.viewChanges=(e=>{e.preventDefault();const t=$(e.currentTarget).closest("tr");this.sendRemoteRequest(this.generateRemotePayload("getRowDetails",{stage:t.data("stage"),t3ver_oid:t.data("t3ver_oid"),table:t.data("table"),uid:t.data("uid")})).done(e=>{const a=e[0].result.data[0],s=$("<div />"),n=$("<ul />",{class:"nav nav-tabs",role:"tablist"}),i=$("<div />",{class:"tab-content"}),o=[];s.append($("<p />").html(TYPO3.lang.path.replace("{0}",a.path_Live)),$("<p />").html(TYPO3.lang.current_step.replace("{0}",a.label_Stage).replace("{1}",a.stage_position).replace("{2}",a.stage_count))),a.diff.length>0&&(n.append($("<li />",{role:"presentation"}).append($("<a />",{href:"#workspace-changes","aria-controls":"workspace-changes",role:"tab","data-toggle":"tab"}).text(TYPO3.lang["window.recordChanges.tabs.changeSummary"]))),i.append($("<div />",{role:"tabpanel",class:"tab-pane",id:"workspace-changes"}).append($("<div />",{class:"form-section"}).append(Backend.generateDiffView(a.diff))))),a.comments.length>0&&(n.append($("<li />",{role:"presentation"}).append($("<a />",{href:"#workspace-comments","aria-controls":"workspace-comments",role:"tab","data-toggle":"tab"}).html(TYPO3.lang["window.recordChanges.tabs.comments"]+"&nbsp;").append($("<span />",{class:"badge"}).text(a.comments.length)))),i.append($("<div />",{role:"tabpanel",class:"tab-pane",id:"workspace-comments"}).append($("<div />",{class:"form-section"}).append(Backend.generateCommentView(a.comments))))),a.history.total>0&&(n.append($("<li />",{role:"presentation"}).append($("<a />",{href:"#workspace-history","aria-controls":"workspace-history",role:"tab","data-toggle":"tab"}).text(TYPO3.lang["window.recordChanges.tabs.history"]))),i.append($("<div />",{role:"tabpanel",class:"tab-pane",id:"workspace-history"}).append($("<div />",{class:"form-section"}).append(Backend.generateHistoryView(a.history.data))))),n.find("li").first().addClass("active"),i.find(".tab-pane").first().addClass("active"),s.append($("<div />").append(n,i)),t.data("stage")!==t.data("prevStage")&&o.push({text:a.label_PrevStage.title,active:!0,btnClass:"btn-default",name:"prevstage",trigger:()=>{Modal.currentModal.trigger("modal-dismiss"),this.sendToStage(t,"prev")}}),o.push({text:a.label_NextStage.title,active:!0,btnClass:"btn-default",name:"nextstage",trigger:()=>{Modal.currentModal.trigger("modal-dismiss"),this.sendToStage(t,"next")}}),o.push({text:TYPO3.lang.close,active:!0,btnClass:"btn-info",name:"cancel",trigger:()=>{Modal.currentModal.trigger("modal-dismiss")}}),Modal.advanced({type:Modal.types.default,title:TYPO3.lang["window.recordInformation"].replace("{0}",$.trim(t.find(".t3js-title-live").text())),content:s,severity:Severity_1.SeverityEnum.info,buttons:o,size:Modal.sizes.medium})})}),this.openPreview=(e=>{const $tr=$(e.currentTarget).closest("tr");this.sendRemoteRequest(this.generateRemoteActionsPayload("viewSingleRecord",[$tr.data("table"),$tr.data("uid")])).done(response=>{eval(response[0].result)})}),this.confirmDeleteRecordFromWorkspace=(e=>{const t=$(e.target).closest("tr"),a=Modal.confirm(TYPO3.lang["window.discard.title"],TYPO3.lang["window.discard.message"],Severity_1.SeverityEnum.warning,[{text:TYPO3.lang.cancel,active:!0,btnClass:"btn-default",name:"cancel",trigger:()=>{a.modal("hide")}},{text:TYPO3.lang.ok,btnClass:"btn-warning",name:"ok"}]);a.on("button.clicked",e=>{"ok"===e.target.name&&this.sendRemoteRequest([this.generateRemoteActionsPayload("deleteSingleRecord",[t.data("table"),t.data("uid")])]).done(()=>{a.modal("hide"),this.getWorkspaceInfos(),Backend.refreshPageTree()})})}),this.runSelectionAction=(()=>{const e=this.elements.$chooseSelectionAction.val(),t="discard"!==e;if(0===e.length)return;const a=[];for(let e=0;e<this.markedRecordsForMassAction.length;++e){const t=this.markedRecordsForMassAction[e].split(":");a.push({table:t[0],liveId:t[2],versionId:t[1]})}t?this.checkIntegrity({selection:a,type:"selection"}).done(t=>{Wizard.setForceSelection(!1),"warning"===t[0].result.result&&this.addIntegrityCheckWarningToWizard(),this.renderSelectionActionWizard(e,a)}):(Wizard.setForceSelection(!1),this.renderSelectionActionWizard(e,a))}),this.addIntegrityCheckWarningToWizard=(()=>{Wizard.addSlide("integrity-warning","Warning",TYPO3.lang["integrity.hasIssuesDescription"]+"<br>"+TYPO3.lang["integrity.hasIssuesQuestion"],Severity_1.SeverityEnum.warning)}),this.runMassAction=(()=>{const e=this.elements.$chooseMassAction.val(),t="discard"!==e;0!==e.length&&(t?this.checkIntegrity({language:this.settings.language,type:e}).done(t=>{Wizard.setForceSelection(!1),"warning"===t[0].result.result&&this.addIntegrityCheckWarningToWizard(),this.renderMassActionWizard(e)}):(Wizard.setForceSelection(!1),this.renderMassActionWizard(e)))}),this.sendToSpecificStageAction=(e=>{const t=[],a=$(e.currentTarget).val();for(let e=0;e<this.markedRecordsForMassAction.length;++e){const a=this.markedRecordsForMassAction[e].split(":");t.push({table:a[0],uid:a[1],t3ver_oid:a[2]})}this.sendRemoteRequest(this.generateRemoteActionsPayload("sendToSpecificStageWindow",[a,t])).done(e=>{const s=this.renderSendToStageWindow(e);s.on("button.clicked",e=>{if("ok"===e.target.name){const n=Utility.convertFormToObject(e.currentTarget.querySelector("form"));n.affects={elements:t,nextStage:a},this.sendRemoteRequest([this.generateRemoteActionsPayload("sendToSpecificStageExecute",[n]),this.generateRemotePayload("getWorkspaceInfos",this.settings)]).done(e=>{s.modal("hide"),this.renderWorkspaceInfos(e[1].result),Backend.refreshPageTree()})}}).on("modal-destroyed",()=>{this.elements.$chooseStageAction.val("")})})}),this.generatePreviewLinks=(()=>{this.sendRemoteRequest(this.generateRemoteActionsPayload("generateWorkspacePreviewLinksForAllLanguages",[this.settings.id])).done(e=>{const t=e[0].result,a=$("<dl />");$.each(t,(e,t)=>{a.append($("<dt />").text(e),$("<dd />").append($("<a />",{href:t,target:"_blank"}).text(t)))}),Modal.show(TYPO3.lang.previewLink,a,Severity_1.SeverityEnum.info,[{text:TYPO3.lang.ok,active:!0,btnClass:"btn-info",name:"ok",trigger:()=>{Modal.currentModal.trigger("modal-dismiss")}}],["modal-inner-scroll"])})}),$(()=>{let e;this.getElements(),this.registerEvents(),Persistent.isset("this.Module.depth")?(e=Persistent.get("this.Module.depth"),this.elements.$depthSelector.val(e),this.settings.depth=e):this.settings.depth=TYPO3.settings.Workspaces.depth,this.loadWorkspaceComponents()})}static refreshPageTree(){Viewport.NavigationContainer&&Viewport.NavigationContainer.PageTree&&Viewport.NavigationContainer.PageTree.refreshTree()}static generateDiffView(e){const t=$("<div />",{class:"diff"});for(let a=0;a<e.length;++a)t.append($("<div />",{class:"diff-item"}).append($("<div />",{class:"diff-item-title"}).text(e[a].label),$("<div />",{class:"diff-item-result diff-item-result-inline"}).html(e[a].content)));return t}static generateCommentView(e){const t=$("<div />");for(let a=0;a<e.length;++a){const s=$("<div />",{class:"panel panel-default"});e[a].user_comment.length>0&&s.append($("<div />",{class:"panel-body"}).html(e[a].user_comment)),s.append($("<div />",{class:"panel-footer"}).append($("<span />",{class:"label label-success"}).text(e[a].stage_title),$("<span />",{class:"label label-info"}).text(e[a].tstamp))),t.append($("<div />",{class:"media"}).append($("<div />",{class:"media-left text-center"}).text(e[a].user_username).prepend($("<div />").html(e[a].user_avatar)),$("<div />",{class:"media-body"}).append(s)))}return t}static generateHistoryView(e){const t=$("<div />");for(let a=0;a<e.length;++a){const s=$("<div />",{class:"panel panel-default"});let n;if("object"==typeof e[a].differences){if(0===e[a].differences.length)continue;n=$("<div />",{class:"diff"});for(let t=0;t<e[a].differences.length;++t)n.append($("<div />",{class:"diff-item"}).append($("<div />",{class:"diff-item-title"}).text(e[a].differences[t].label),$("<div />",{class:"diff-item-result diff-item-result-inline"}).html(e[a].differences[t].html)));s.append($("<div />").append(n))}else s.append($("<div />",{class:"panel-body"}).text(e[a].differences));s.append($("<div />",{class:"panel-footer"}).append($("<span />",{class:"label label-info"}).text(e[a].datetime))),t.append($("<div />",{class:"media"}).append($("<div />",{class:"media-left text-center"}).text(e[a].user).prepend($("<div />").html(e[a].user_avatar)),$("<div />",{class:"media-body"}).append(s)))}return t}getElements(){this.elements.$searchForm=$(Identifiers.searchForm),this.elements.$searchTextField=$(Identifiers.searchTextField),this.elements.$searchSubmitBtn=$(Identifiers.searchSubmitBtn),this.elements.$depthSelector=$(Identifiers.depthSelector),this.elements.$languageSelector=$(Identifiers.languageSelector),this.elements.$container=$(Identifiers.container),this.elements.$tableBody=this.elements.$container.find("tbody"),this.elements.$actionIcons=$(Identifiers.actionIcons),this.elements.$toggleAll=$(Identifiers.toggleAll),this.elements.$chooseStageAction=$(Identifiers.chooseStageAction),this.elements.$chooseSelectionAction=$(Identifiers.chooseSelectionAction),this.elements.$chooseMassAction=$(Identifiers.chooseMassAction),this.elements.$previewLinksButton=$(Identifiers.previewLinksButton),this.elements.$pagination=$(Identifiers.pagination)}registerEvents(){$(document).on("click",'[data-action="swap"]',e=>{const t=e.target.closest("tr");this.checkIntegrity({selection:[{liveId:t.dataset.uid,versionId:t.dataset.t3ver_oid,table:t.dataset.table}],type:"selection"}).done(e=>{"warning"===e[0].result.result&&this.addIntegrityCheckWarningToWizard(),Wizard.setForceSelection(!1),Wizard.addSlide("swap-confirm","Swap",TYPO3.lang["window.swap.message"],Severity_1.SeverityEnum.info),Wizard.addFinalProcessingSlide(()=>{this.sendRemoteRequest(this.generateRemoteActionsPayload("swapSingleRecord",[t.dataset.table,t.dataset.t3ver_oid,t.dataset.uid])).done(()=>{Wizard.dismiss(),this.getWorkspaceInfos(),Backend.refreshPageTree()})}).done(()=>{Wizard.show()})})}).on("click",'[data-action="prevstage"]',e=>{this.sendToStage($(e.currentTarget).closest("tr"),"prev")}).on("click",'[data-action="nextstage"]',e=>{this.sendToStage($(e.currentTarget).closest("tr"),"next")}).on("click",'[data-action="changes"]',this.viewChanges).on("click",'[data-action="preview"]',this.openPreview).on("click",'[data-action="open"]',e=>{const t=e.currentTarget.closest("tr");let a=TYPO3.settings.FormEngine.moduleUrl+"&returnUrl="+encodeURIComponent(document.location.href)+"&id="+TYPO3.settings.Workspaces.id+"&edit["+t.dataset.table+"]["+t.dataset.uid+"]=edit";TYPO3.settings.Workspaces.allView&&(a+="&workspace="+t.dataset.t3ver_wsid),window.location.href=a}).on("click",'[data-action="version"]',e=>{const t=e.currentTarget.closest("tr"),a="pages"===t.dataset.table?t.dataset.t3ver_oid:t.dataset.pid;window.location.href=top.TYPO3.configuration.pageModuleUrl+"&id="+a+"&returnUrl="+encodeURIComponent(window.location.href)}).on("click",'[data-action="remove"]',this.confirmDeleteRecordFromWorkspace).on("click",'[data-action="expand"]',e=>{const t=$(e.currentTarget);let a;a="true"===this.elements.$tableBody.find(t.data("target")).first().attr("aria-expanded")?"apps-pagetree-expand":"apps-pagetree-collapse",t.empty().append(this.getPreRenderedIcon(a))}),$(window.top.document).on("click",".t3js-workspace-recipients-selectall",e=>{e.preventDefault(),$(".t3js-workspace-recipient",window.top.document).not(":disabled").prop("checked",!0)}).on("click",".t3js-workspace-recipients-deselectall",e=>{e.preventDefault(),$(".t3js-workspace-recipient",window.top.document).not(":disabled").prop("checked",!1)}),this.elements.$searchForm.on("submit",e=>{e.preventDefault(),this.settings.filterTxt=this.elements.$searchTextField.val(),this.getWorkspaceInfos()}),this.elements.$searchTextField.on("keyup",e=>{""!==e.target.value?this.elements.$searchSubmitBtn.removeClass("disabled"):(this.elements.$searchSubmitBtn.addClass("disabled"),this.getWorkspaceInfos())}).clearable({onClear:()=>{this.elements.$searchSubmitBtn.addClass("disabled"),this.settings.filterTxt="",this.getWorkspaceInfos()}}),this.elements.$toggleAll.on("click",()=>{this.allToggled=!this.allToggled,this.elements.$tableBody.find('input[type="checkbox"]').prop("checked",this.allToggled).trigger("change")}),this.elements.$tableBody.on("change","tr input[type=checkbox]",this.handleCheckboxChange),this.elements.$depthSelector.on("change",e=>{const t=e.target.value;Persistent.set("this.Module.depth",t),this.settings.depth=t,this.getWorkspaceInfos()}),this.elements.$previewLinksButton.on("click",this.generatePreviewLinks),this.elements.$languageSelector.on("change",e=>{const t=$(e.target);this.settings.language=t.val(),this.sendRemoteRequest([this.generateRemoteActionsPayload("saveLanguageSelection",[t.val()]),this.generateRemotePayload("getWorkspaceInfos",this.settings)]).done(e=>{this.elements.$languageSelector.prev().html(t.find(":selected").data("icon")),this.renderWorkspaceInfos(e[1].result)})}),this.elements.$chooseStageAction.on("change",this.sendToSpecificStageAction),this.elements.$chooseSelectionAction.on("change",this.runSelectionAction),this.elements.$chooseMassAction.on("change",this.runMassAction),this.elements.$pagination.on("click","a[data-action]",e=>{e.preventDefault();const t=$(e.currentTarget);let a=!1;switch(t.data("action")){case"previous":this.paging.currentPage>1&&(this.paging.currentPage--,a=!0);break;case"next":this.paging.currentPage<this.paging.totalPages&&(this.paging.currentPage++,a=!0);break;case"page":this.paging.currentPage=parseInt(t.data("page"),10),a=!0;break;default:throw'Unknown action "'+t.data("action")+'"'}a&&(this.settings.start=parseInt(this.settings.limit.toString(),10)*(this.paging.currentPage-1),this.getWorkspaceInfos())})}sendToStage(e,t){let a,s,n;if("next"===t)a=e.data("nextStage"),s="sendToNextStageWindow",n="sendToNextStageExecute";else{if("prev"!==t)throw"Invalid direction given.";a=e.data("prevStage"),s="sendToPrevStageWindow",n="sendToPrevStageExecute"}this.sendRemoteRequest(this.generateRemoteActionsPayload(s,[e.data("uid"),e.data("table"),e.data("t3ver_oid")])).done(t=>{const s=this.renderSendToStageWindow(t);s.on("button.clicked",t=>{if("ok"===t.target.name){const i=Utility.convertFormToObject(t.currentTarget.querySelector("form"));i.affects={table:e.data("table"),nextStage:a,t3ver_oid:e.data("t3ver_oid"),uid:e.data("uid"),elements:[]},this.sendRemoteRequest([this.generateRemoteActionsPayload(n,[i]),this.generateRemotePayload("getWorkspaceInfos",this.settings)]).done(e=>{s.modal("hide"),this.renderWorkspaceInfos(e[1].result),Backend.refreshPageTree()})}})})}loadWorkspaceComponents(){this.sendRemoteRequest([this.generateRemotePayload("getWorkspaceInfos",this.settings),this.generateRemotePayload("getStageActions",{}),this.generateRemoteMassActionsPayload("getMassStageActions",{}),this.generateRemotePayload("getSystemLanguages",{pageUid:this.elements.$container.data("pageUid")})]).done(e=>{this.elements.$depthSelector.prop("disabled",!1),this.renderWorkspaceInfos(e[0].result);const t=e[1].result.data;let a;for(a=0;a<t.length;++a)this.elements.$chooseStageAction.append($("<option />").val(t[a].uid).text(t[a].title));const s=e[2].result.data;for(a=0;a<s.length;++a)this.elements.$chooseSelectionAction.append($("<option />").val(s[a].action).text(s[a].title)),this.elements.$chooseMassAction.append($("<option />").val(s[a].action).text(s[a].title));const n=e[3].result.data;for(a=0;a<n.length;++a){const e=$("<option />").val(n[a].uid).text(n[a].title).data("icon",n[a].icon);String(n[a].uid)===String(TYPO3.settings.Workspaces.language)&&(e.prop("selected",!0),this.elements.$languageSelector.prev().html(n[a].icon)),this.elements.$languageSelector.append(e)}this.elements.$languageSelector.prop("disabled",!1)})}getWorkspaceInfos(){this.sendRemoteRequest(this.generateRemotePayload("getWorkspaceInfos",this.settings)).done(e=>{this.renderWorkspaceInfos(e[0].result)})}renderWorkspaceInfos(e){this.elements.$tableBody.children().remove(),this.allToggled=!1,this.elements.$chooseStageAction.prop("disabled",!0),this.elements.$chooseSelectionAction.prop("disabled",!0),this.elements.$chooseMassAction.prop("disabled",0===e.data.length),this.buildPagination(e.total);for(let t=0;t<e.data.length;++t){const a=e.data[t],s=$("<div />",{class:"btn-group"});let n;s.append(this.getAction(a.Workspaces_CollectionChildren>0&&""!==a.Workspaces_CollectionCurrent,"expand","apps-pagetree-collapse").attr("title",TYPO3.lang["tooltip.expand"]).attr("data-target",'[data-collection="'+a.Workspaces_CollectionCurrent+'"]').attr("data-toggle","collapse"),$("<button />",{class:"btn btn-default","data-action":"changes","data-toggle":"tooltip",title:TYPO3.lang["tooltip.showChanges"]}).append(this.getPreRenderedIcon("actions-document-info")),this.getAction(a.allowedAction_swap&&""===a.Workspaces_CollectionParent,"swap","actions-version-swap-version").attr("title",TYPO3.lang["tooltip.swap"]),this.getAction(a.allowedAction_view,"preview","actions-version-workspace-preview").attr("title",TYPO3.lang["tooltip.viewElementAction"]),this.getAction(a.allowedAction_edit,"open","actions-open").attr("title",TYPO3.lang["tooltip.editElementAction"]),this.getAction(!0,"version","actions-version-page-open").attr("title",TYPO3.lang["tooltip.openPage"]),this.getAction(a.allowedAction_delete,"remove","actions-version-document-remove").attr("title",TYPO3.lang["tooltip.discardVersion"])),""!==a.integrity.messages&&(n=$(TYPO3.settings.Workspaces.icons[a.integrity.status])).attr("data-toggle","tooltip").attr("data-placement","top").attr("data-html","true").attr("title",a.integrity.messages),this.latestPath!==a.path_Workspace&&(this.latestPath=a.path_Workspace,this.elements.$tableBody.append($("<tr />").append($("<th />"),$("<th />",{colspan:6}).text(this.latestPath))));const i=$("<label />",{class:"btn btn-default btn-checkbox"}).append($("<input />",{type:"checkbox"}),$("<span />",{class:"t3-icon fa"})),o={"data-uid":a.uid,"data-pid":a.livepid,"data-t3ver_oid":a.t3ver_oid,"data-t3ver_wsid":a.t3ver_wsid,"data-table":a.table,"data-next-stage":a.value_nextStage,"data-prev-stage":a.value_prevStage,"data-stage":a.stage};""!==a.Workspaces_CollectionParent&&(o["data-collection"]=a.Workspaces_CollectionParent,o.class="collapse"),this.elements.$tableBody.append($("<tr />",o).append($("<td />").empty().append(i),$("<td />",{class:"t3js-title-workspace",style:a.Workspaces_CollectionLevel>0?"padding-left: "+this.indentationPadding*a.Workspaces_CollectionLevel+"px":""}).html(a.icon_Workspace+'&nbsp;<a href="#" data-action="changes"><span class="item-state-'+a.state_Workspace+'">'+a.label_Workspace+"</span></a>"),$("<td />",{class:"t3js-title-live"}).html(a.icon_Live+"&nbsp;"+a.label_Live),$("<td />").text(a.label_Stage),$("<td />").empty().append(n),$("<td />").html(a.language.icon),$("<td />",{class:"text-right nowrap"}).append(s))),Tooltip.initialize('[data-toggle="tooltip"]',{delay:{show:500,hide:100},trigger:"hover",container:"body"})}}buildPagination(e){if(0===e)return void this.elements.$pagination.contents().remove();if(this.paging.totalItems=e,this.paging.totalPages=Math.ceil(e/parseInt(this.settings.limit.toString(),10)),1===this.paging.totalPages)return void this.elements.$pagination.contents().remove();const t=$("<ul />",{class:"pagination pagination-block"}),a=[],s=$("<li />").append($("<a />",{"data-action":"previous"}).append($("<span />",{class:"t3-icon fa fa-arrow-left"}))),n=$("<li />").append($("<a />",{"data-action":"next"}).append($("<span />",{class:"t3-icon fa fa-arrow-right"})));1===this.paging.currentPage&&s.disablePagingAction(),this.paging.currentPage===this.paging.totalPages&&n.disablePagingAction();for(let e=1;e<=this.paging.totalPages;e++){const t=$("<li />",{class:this.paging.currentPage===e?"active":""});t.append($("<a />",{"data-action":"page","data-page":e}).append($("<span />").text(e))),a.push(t)}t.append(s,a,n),this.elements.$pagination.empty().append(t)}renderSelectionActionWizard(e,t){Wizard.addSlide("mass-action-confirmation",TYPO3.lang["window.selectionAction.title"],"<p>"+(new SecurityUtility).encodeHtml(TYPO3.lang["tooltip."+e+"Selected"])+"</p>",Severity_1.SeverityEnum.warning),Wizard.addFinalProcessingSlide(()=>{this.sendRemoteRequest(this.generateRemoteActionsPayload("executeSelectionAction",{action:e,selection:t})).done(()=>{this.getWorkspaceInfos(),Wizard.dismiss(),Backend.refreshPageTree()})}).done(()=>{Wizard.show(),Wizard.getComponent().on("wizard-dismissed",()=>{this.elements.$chooseSelectionAction.val("")})})}renderMassActionWizard(e){let t,a=!1;switch(e){case"publish":t="publishWorkspace";break;case"swap":t="publishWorkspace",a=!0;break;case"discard":t="flushWorkspace";break;default:throw"Invalid mass action "+e+" called."}const s=new SecurityUtility;Wizard.setForceSelection(!1),Wizard.addSlide("mass-action-confirmation",TYPO3.lang["window.massAction.title"],"<p>"+s.encodeHtml(TYPO3.lang["tooltip."+e+"All"])+"<br><br>"+s.encodeHtml(TYPO3.lang["tooltip.affectWholeWorkspace"])+"</p>",Severity_1.SeverityEnum.warning);const n=e=>{const a=e[0].result;a.processed<a.total?this.sendRemoteRequest(this.generateRemoteMassActionsPayload(t,a)).done(n):(this.getWorkspaceInfos(),Wizard.dismiss())};Wizard.addFinalProcessingSlide(()=>{this.sendRemoteRequest(this.generateRemoteMassActionsPayload(t,{init:!0,total:0,processed:0,language:this.settings.language,swap:a})).done(n)}).done(()=>{Wizard.show(),Wizard.getComponent().on("wizard-dismissed",()=>{this.elements.$chooseMassAction.val("")})})}getAction(e,t,a){return e?$("<button />",{class:"btn btn-default","data-action":t,"data-toggle":"tooltip"}).append(this.getPreRenderedIcon(a)):$("<span />",{class:"btn btn-default disabled"}).append(this.getPreRenderedIcon("empty-empty"))}getPreRenderedIcon(e){return this.elements.$actionIcons.find('[data-identifier="'+e+'"]').clone()}}return new Backend});
\ No newline at end of file
+define(["require","exports","TYPO3/CMS/Backend/Enum/Severity","jquery","TYPO3/CMS/Backend/Modal","TYPO3/CMS/Backend/Storage/Persistent","TYPO3/CMS/Core/SecurityUtility","TYPO3/CMS/Backend/Tooltip","TYPO3/CMS/Backend/Utility","TYPO3/CMS/Backend/Viewport","TYPO3/CMS/Backend/Wizard","./Workspaces","twbs/bootstrap-slider","nprogress","TYPO3/CMS/Backend/Input/Clearable"],function(require,exports,Severity_1,$,Modal,Persistent,SecurityUtility,Tooltip,Utility,Viewport,Wizard,Workspaces_1){"use strict";var Identifiers;!function(e){e.searchForm="#workspace-settings-form",e.searchTextField='#workspace-settings-form input[name="search-text"]',e.searchSubmitBtn='#workspace-settings-form button[type="submit"]',e.depthSelector='#workspace-settings-form [name="depth"]',e.languageSelector='#workspace-settings-form select[name="languages"]',e.chooseStageAction='#workspace-actions-form [name="stage-action"]',e.chooseSelectionAction='#workspace-actions-form [name="selection-action"]',e.chooseMassAction='#workspace-actions-form [name="mass-action"]',e.container="#workspace-panel",e.actionIcons="#workspace-action-icons",e.toggleAll=".t3js-toggle-all",e.previewLinksButton=".t3js-preview-link",e.pagination="#workspace-pagination"}(Identifiers||(Identifiers={}));class Backend extends Workspaces_1.default{constructor(){super(),this.elements={},this.settings={dir:"ASC",id:TYPO3.settings.Workspaces.id,language:TYPO3.settings.Workspaces.language,limit:30,query:"",sort:"label_Live",start:0,filterTxt:""},this.paging={currentPage:1,totalPages:1,totalItems:0},this.allToggled=!1,this.latestPath="",this.markedRecordsForMassAction=[],this.indentationPadding=26,this.handleCheckboxChange=(e=>{const t=$(e.currentTarget),a=t.parents("tr"),s=a.data("table")+":"+a.data("uid")+":"+a.data("t3ver_oid");if(t.prop("checked"))this.markedRecordsForMassAction.push(s),a.addClass("warning");else{const e=this.markedRecordsForMassAction.indexOf(s);e>-1&&this.markedRecordsForMassAction.splice(e,1),a.removeClass("warning")}this.elements.$chooseStageAction.prop("disabled",0===this.markedRecordsForMassAction.length),this.elements.$chooseSelectionAction.prop("disabled",0===this.markedRecordsForMassAction.length),this.elements.$chooseMassAction.prop("disabled",this.markedRecordsForMassAction.length>0)}),this.viewChanges=(e=>{e.preventDefault();const t=$(e.currentTarget).closest("tr");this.sendRemoteRequest(this.generateRemotePayload("getRowDetails",{stage:t.data("stage"),t3ver_oid:t.data("t3ver_oid"),table:t.data("table"),uid:t.data("uid")})).done(e=>{const a=e[0].result.data[0],s=$("<div />"),n=$("<ul />",{class:"nav nav-tabs",role:"tablist"}),i=$("<div />",{class:"tab-content"}),o=[];s.append($("<p />").html(TYPO3.lang.path.replace("{0}",a.path_Live)),$("<p />").html(TYPO3.lang.current_step.replace("{0}",a.label_Stage).replace("{1}",a.stage_position).replace("{2}",a.stage_count))),a.diff.length>0&&(n.append($("<li />",{role:"presentation"}).append($("<a />",{href:"#workspace-changes","aria-controls":"workspace-changes",role:"tab","data-toggle":"tab"}).text(TYPO3.lang["window.recordChanges.tabs.changeSummary"]))),i.append($("<div />",{role:"tabpanel",class:"tab-pane",id:"workspace-changes"}).append($("<div />",{class:"form-section"}).append(Backend.generateDiffView(a.diff))))),a.comments.length>0&&(n.append($("<li />",{role:"presentation"}).append($("<a />",{href:"#workspace-comments","aria-controls":"workspace-comments",role:"tab","data-toggle":"tab"}).html(TYPO3.lang["window.recordChanges.tabs.comments"]+"&nbsp;").append($("<span />",{class:"badge"}).text(a.comments.length)))),i.append($("<div />",{role:"tabpanel",class:"tab-pane",id:"workspace-comments"}).append($("<div />",{class:"form-section"}).append(Backend.generateCommentView(a.comments))))),a.history.total>0&&(n.append($("<li />",{role:"presentation"}).append($("<a />",{href:"#workspace-history","aria-controls":"workspace-history",role:"tab","data-toggle":"tab"}).text(TYPO3.lang["window.recordChanges.tabs.history"]))),i.append($("<div />",{role:"tabpanel",class:"tab-pane",id:"workspace-history"}).append($("<div />",{class:"form-section"}).append(Backend.generateHistoryView(a.history.data))))),n.find("li").first().addClass("active"),i.find(".tab-pane").first().addClass("active"),s.append($("<div />").append(n,i)),t.data("stage")!==t.data("prevStage")&&o.push({text:a.label_PrevStage.title,active:!0,btnClass:"btn-default",name:"prevstage",trigger:()=>{Modal.currentModal.trigger("modal-dismiss"),this.sendToStage(t,"prev")}}),o.push({text:a.label_NextStage.title,active:!0,btnClass:"btn-default",name:"nextstage",trigger:()=>{Modal.currentModal.trigger("modal-dismiss"),this.sendToStage(t,"next")}}),o.push({text:TYPO3.lang.close,active:!0,btnClass:"btn-info",name:"cancel",trigger:()=>{Modal.currentModal.trigger("modal-dismiss")}}),Modal.advanced({type:Modal.types.default,title:TYPO3.lang["window.recordInformation"].replace("{0}",$.trim(t.find(".t3js-title-live").text())),content:s,severity:Severity_1.SeverityEnum.info,buttons:o,size:Modal.sizes.medium})})}),this.openPreview=(e=>{const $tr=$(e.currentTarget).closest("tr");this.sendRemoteRequest(this.generateRemoteActionsPayload("viewSingleRecord",[$tr.data("table"),$tr.data("uid")])).done(response=>{eval(response[0].result)})}),this.confirmDeleteRecordFromWorkspace=(e=>{const t=$(e.target).closest("tr"),a=Modal.confirm(TYPO3.lang["window.discard.title"],TYPO3.lang["window.discard.message"],Severity_1.SeverityEnum.warning,[{text:TYPO3.lang.cancel,active:!0,btnClass:"btn-default",name:"cancel",trigger:()=>{a.modal("hide")}},{text:TYPO3.lang.ok,btnClass:"btn-warning",name:"ok"}]);a.on("button.clicked",e=>{"ok"===e.target.name&&this.sendRemoteRequest([this.generateRemoteActionsPayload("deleteSingleRecord",[t.data("table"),t.data("uid")])]).done(()=>{a.modal("hide"),this.getWorkspaceInfos(),Backend.refreshPageTree()})})}),this.runSelectionAction=(()=>{const e=this.elements.$chooseSelectionAction.val(),t="discard"!==e;if(0===e.length)return;const a=[];for(let e=0;e<this.markedRecordsForMassAction.length;++e){const t=this.markedRecordsForMassAction[e].split(":");a.push({table:t[0],liveId:t[2],versionId:t[1]})}t?this.checkIntegrity({selection:a,type:"selection"}).done(t=>{Wizard.setForceSelection(!1),"warning"===t[0].result.result&&this.addIntegrityCheckWarningToWizard(),this.renderSelectionActionWizard(e,a)}):(Wizard.setForceSelection(!1),this.renderSelectionActionWizard(e,a))}),this.addIntegrityCheckWarningToWizard=(()=>{Wizard.addSlide("integrity-warning","Warning",TYPO3.lang["integrity.hasIssuesDescription"]+"<br>"+TYPO3.lang["integrity.hasIssuesQuestion"],Severity_1.SeverityEnum.warning)}),this.runMassAction=(()=>{const e=this.elements.$chooseMassAction.val(),t="discard"!==e;0!==e.length&&(t?this.checkIntegrity({language:this.settings.language,type:e}).done(t=>{Wizard.setForceSelection(!1),"warning"===t[0].result.result&&this.addIntegrityCheckWarningToWizard(),this.renderMassActionWizard(e)}):(Wizard.setForceSelection(!1),this.renderMassActionWizard(e)))}),this.sendToSpecificStageAction=(e=>{const t=[],a=$(e.currentTarget).val();for(let e=0;e<this.markedRecordsForMassAction.length;++e){const a=this.markedRecordsForMassAction[e].split(":");t.push({table:a[0],uid:a[1],t3ver_oid:a[2]})}this.sendRemoteRequest(this.generateRemoteActionsPayload("sendToSpecificStageWindow",[a,t])).done(e=>{const s=this.renderSendToStageWindow(e);s.on("button.clicked",e=>{if("ok"===e.target.name){const n=Utility.convertFormToObject(e.currentTarget.querySelector("form"));n.affects={elements:t,nextStage:a},this.sendRemoteRequest([this.generateRemoteActionsPayload("sendToSpecificStageExecute",[n]),this.generateRemotePayload("getWorkspaceInfos",this.settings)]).done(e=>{s.modal("hide"),this.renderWorkspaceInfos(e[1].result),Backend.refreshPageTree()})}}).on("modal-destroyed",()=>{this.elements.$chooseStageAction.val("")})})}),this.generatePreviewLinks=(()=>{this.sendRemoteRequest(this.generateRemoteActionsPayload("generateWorkspacePreviewLinksForAllLanguages",[this.settings.id])).done(e=>{const t=e[0].result,a=$("<dl />");$.each(t,(e,t)=>{a.append($("<dt />").text(e),$("<dd />").append($("<a />",{href:t,target:"_blank"}).text(t)))}),Modal.show(TYPO3.lang.previewLink,a,Severity_1.SeverityEnum.info,[{text:TYPO3.lang.ok,active:!0,btnClass:"btn-info",name:"ok",trigger:()=>{Modal.currentModal.trigger("modal-dismiss")}}],["modal-inner-scroll"])})}),$(()=>{let e;this.getElements(),this.registerEvents(),Persistent.isset("this.Module.depth")?(e=Persistent.get("this.Module.depth"),this.elements.$depthSelector.val(e),this.settings.depth=e):this.settings.depth=TYPO3.settings.Workspaces.depth,this.loadWorkspaceComponents()})}static refreshPageTree(){Viewport.NavigationContainer&&Viewport.NavigationContainer.PageTree&&Viewport.NavigationContainer.PageTree.refreshTree()}static generateDiffView(e){const t=$("<div />",{class:"diff"});for(let a=0;a<e.length;++a)t.append($("<div />",{class:"diff-item"}).append($("<div />",{class:"diff-item-title"}).text(e[a].label),$("<div />",{class:"diff-item-result diff-item-result-inline"}).html(e[a].content)));return t}static generateCommentView(e){const t=$("<div />");for(let a=0;a<e.length;++a){const s=$("<div />",{class:"panel panel-default"});e[a].user_comment.length>0&&s.append($("<div />",{class:"panel-body"}).html(e[a].user_comment)),s.append($("<div />",{class:"panel-footer"}).append($("<span />",{class:"label label-success"}).text(e[a].stage_title),$("<span />",{class:"label label-info"}).text(e[a].tstamp))),t.append($("<div />",{class:"media"}).append($("<div />",{class:"media-left text-center"}).text(e[a].user_username).prepend($("<div />").html(e[a].user_avatar)),$("<div />",{class:"media-body"}).append(s)))}return t}static generateHistoryView(e){const t=$("<div />");for(let a=0;a<e.length;++a){const s=$("<div />",{class:"panel panel-default"});let n;if("object"==typeof e[a].differences){if(0===e[a].differences.length)continue;n=$("<div />",{class:"diff"});for(let t=0;t<e[a].differences.length;++t)n.append($("<div />",{class:"diff-item"}).append($("<div />",{class:"diff-item-title"}).text(e[a].differences[t].label),$("<div />",{class:"diff-item-result diff-item-result-inline"}).html(e[a].differences[t].html)));s.append($("<div />").append(n))}else s.append($("<div />",{class:"panel-body"}).text(e[a].differences));s.append($("<div />",{class:"panel-footer"}).append($("<span />",{class:"label label-info"}).text(e[a].datetime))),t.append($("<div />",{class:"media"}).append($("<div />",{class:"media-left text-center"}).text(e[a].user).prepend($("<div />").html(e[a].user_avatar)),$("<div />",{class:"media-body"}).append(s)))}return t}getElements(){this.elements.$searchForm=$(Identifiers.searchForm),this.elements.$searchTextField=$(Identifiers.searchTextField),this.elements.$searchSubmitBtn=$(Identifiers.searchSubmitBtn),this.elements.$depthSelector=$(Identifiers.depthSelector),this.elements.$languageSelector=$(Identifiers.languageSelector),this.elements.$container=$(Identifiers.container),this.elements.$tableBody=this.elements.$container.find("tbody"),this.elements.$actionIcons=$(Identifiers.actionIcons),this.elements.$toggleAll=$(Identifiers.toggleAll),this.elements.$chooseStageAction=$(Identifiers.chooseStageAction),this.elements.$chooseSelectionAction=$(Identifiers.chooseSelectionAction),this.elements.$chooseMassAction=$(Identifiers.chooseMassAction),this.elements.$previewLinksButton=$(Identifiers.previewLinksButton),this.elements.$pagination=$(Identifiers.pagination)}registerEvents(){$(document).on("click",'[data-action="swap"]',e=>{const t=e.target.closest("tr");this.checkIntegrity({selection:[{liveId:t.dataset.uid,versionId:t.dataset.t3ver_oid,table:t.dataset.table}],type:"selection"}).done(e=>{"warning"===e[0].result.result&&this.addIntegrityCheckWarningToWizard(),Wizard.setForceSelection(!1),Wizard.addSlide("swap-confirm","Swap",TYPO3.lang["window.swap.message"],Severity_1.SeverityEnum.info),Wizard.addFinalProcessingSlide(()=>{this.sendRemoteRequest(this.generateRemoteActionsPayload("swapSingleRecord",[t.dataset.table,t.dataset.t3ver_oid,t.dataset.uid])).done(()=>{Wizard.dismiss(),this.getWorkspaceInfos(),Backend.refreshPageTree()})}).done(()=>{Wizard.show()})})}).on("click",'[data-action="prevstage"]',e=>{this.sendToStage($(e.currentTarget).closest("tr"),"prev")}).on("click",'[data-action="nextstage"]',e=>{this.sendToStage($(e.currentTarget).closest("tr"),"next")}).on("click",'[data-action="changes"]',this.viewChanges).on("click",'[data-action="preview"]',this.openPreview).on("click",'[data-action="open"]',e=>{const t=e.currentTarget.closest("tr");let a=TYPO3.settings.FormEngine.moduleUrl+"&returnUrl="+encodeURIComponent(document.location.href)+"&id="+TYPO3.settings.Workspaces.id+"&edit["+t.dataset.table+"]["+t.dataset.uid+"]=edit";TYPO3.settings.Workspaces.allView&&(a+="&workspace="+t.dataset.t3ver_wsid),window.location.href=a}).on("click",'[data-action="version"]',e=>{const t=e.currentTarget.closest("tr"),a="pages"===t.dataset.table?t.dataset.t3ver_oid:t.dataset.pid;window.location.href=top.TYPO3.configuration.pageModuleUrl+"&id="+a+"&returnUrl="+encodeURIComponent(window.location.href)}).on("click",'[data-action="remove"]',this.confirmDeleteRecordFromWorkspace).on("click",'[data-action="expand"]',e=>{const t=$(e.currentTarget);let a;a="true"===this.elements.$tableBody.find(t.data("target")).first().attr("aria-expanded")?"apps-pagetree-expand":"apps-pagetree-collapse",t.empty().append(this.getPreRenderedIcon(a))}),$(window.top.document).on("click",".t3js-workspace-recipients-selectall",e=>{e.preventDefault(),$(".t3js-workspace-recipient",window.top.document).not(":disabled").prop("checked",!0)}).on("click",".t3js-workspace-recipients-deselectall",e=>{e.preventDefault(),$(".t3js-workspace-recipient",window.top.document).not(":disabled").prop("checked",!1)}),this.elements.$searchForm.on("submit",e=>{e.preventDefault(),this.settings.filterTxt=this.elements.$searchTextField.val(),this.getWorkspaceInfos()}),this.elements.$searchTextField.on("keyup",e=>{""!==e.target.value?this.elements.$searchSubmitBtn.removeClass("disabled"):(this.elements.$searchSubmitBtn.addClass("disabled"),this.getWorkspaceInfos())}),this.elements.$searchTextField.get(0).clearable({onClear:()=>{this.elements.$searchSubmitBtn.addClass("disabled"),this.settings.filterTxt="",this.getWorkspaceInfos()}}),this.elements.$toggleAll.on("click",()=>{this.allToggled=!this.allToggled,this.elements.$tableBody.find('input[type="checkbox"]').prop("checked",this.allToggled).trigger("change")}),this.elements.$tableBody.on("change","tr input[type=checkbox]",this.handleCheckboxChange),this.elements.$depthSelector.on("change",e=>{const t=e.target.value;Persistent.set("this.Module.depth",t),this.settings.depth=t,this.getWorkspaceInfos()}),this.elements.$previewLinksButton.on("click",this.generatePreviewLinks),this.elements.$languageSelector.on("change",e=>{const t=$(e.target);this.settings.language=t.val(),this.sendRemoteRequest([this.generateRemoteActionsPayload("saveLanguageSelection",[t.val()]),this.generateRemotePayload("getWorkspaceInfos",this.settings)]).done(e=>{this.elements.$languageSelector.prev().html(t.find(":selected").data("icon")),this.renderWorkspaceInfos(e[1].result)})}),this.elements.$chooseStageAction.on("change",this.sendToSpecificStageAction),this.elements.$chooseSelectionAction.on("change",this.runSelectionAction),this.elements.$chooseMassAction.on("change",this.runMassAction),this.elements.$pagination.on("click","a[data-action]",e=>{e.preventDefault();const t=$(e.currentTarget);let a=!1;switch(t.data("action")){case"previous":this.paging.currentPage>1&&(this.paging.currentPage--,a=!0);break;case"next":this.paging.currentPage<this.paging.totalPages&&(this.paging.currentPage++,a=!0);break;case"page":this.paging.currentPage=parseInt(t.data("page"),10),a=!0;break;default:throw'Unknown action "'+t.data("action")+'"'}a&&(this.settings.start=parseInt(this.settings.limit.toString(),10)*(this.paging.currentPage-1),this.getWorkspaceInfos())})}sendToStage(e,t){let a,s,n;if("next"===t)a=e.data("nextStage"),s="sendToNextStageWindow",n="sendToNextStageExecute";else{if("prev"!==t)throw"Invalid direction given.";a=e.data("prevStage"),s="sendToPrevStageWindow",n="sendToPrevStageExecute"}this.sendRemoteRequest(this.generateRemoteActionsPayload(s,[e.data("uid"),e.data("table"),e.data("t3ver_oid")])).done(t=>{const s=this.renderSendToStageWindow(t);s.on("button.clicked",t=>{if("ok"===t.target.name){const i=Utility.convertFormToObject(t.currentTarget.querySelector("form"));i.affects={table:e.data("table"),nextStage:a,t3ver_oid:e.data("t3ver_oid"),uid:e.data("uid"),elements:[]},this.sendRemoteRequest([this.generateRemoteActionsPayload(n,[i]),this.generateRemotePayload("getWorkspaceInfos",this.settings)]).done(e=>{s.modal("hide"),this.renderWorkspaceInfos(e[1].result),Backend.refreshPageTree()})}})})}loadWorkspaceComponents(){this.sendRemoteRequest([this.generateRemotePayload("getWorkspaceInfos",this.settings),this.generateRemotePayload("getStageActions",{}),this.generateRemoteMassActionsPayload("getMassStageActions",{}),this.generateRemotePayload("getSystemLanguages",{pageUid:this.elements.$container.data("pageUid")})]).done(e=>{this.elements.$depthSelector.prop("disabled",!1),this.renderWorkspaceInfos(e[0].result);const t=e[1].result.data;let a;for(a=0;a<t.length;++a)this.elements.$chooseStageAction.append($("<option />").val(t[a].uid).text(t[a].title));const s=e[2].result.data;for(a=0;a<s.length;++a)this.elements.$chooseSelectionAction.append($("<option />").val(s[a].action).text(s[a].title)),this.elements.$chooseMassAction.append($("<option />").val(s[a].action).text(s[a].title));const n=e[3].result.data;for(a=0;a<n.length;++a){const e=$("<option />").val(n[a].uid).text(n[a].title).data("icon",n[a].icon);String(n[a].uid)===String(TYPO3.settings.Workspaces.language)&&(e.prop("selected",!0),this.elements.$languageSelector.prev().html(n[a].icon)),this.elements.$languageSelector.append(e)}this.elements.$languageSelector.prop("disabled",!1)})}getWorkspaceInfos(){this.sendRemoteRequest(this.generateRemotePayload("getWorkspaceInfos",this.settings)).done(e=>{this.renderWorkspaceInfos(e[0].result)})}renderWorkspaceInfos(e){this.elements.$tableBody.children().remove(),this.allToggled=!1,this.elements.$chooseStageAction.prop("disabled",!0),this.elements.$chooseSelectionAction.prop("disabled",!0),this.elements.$chooseMassAction.prop("disabled",0===e.data.length),this.buildPagination(e.total);for(let t=0;t<e.data.length;++t){const a=e.data[t],s=$("<div />",{class:"btn-group"});let n;s.append(this.getAction(a.Workspaces_CollectionChildren>0&&""!==a.Workspaces_CollectionCurrent,"expand","apps-pagetree-collapse").attr("title",TYPO3.lang["tooltip.expand"]).attr("data-target",'[data-collection="'+a.Workspaces_CollectionCurrent+'"]').attr("data-toggle","collapse"),$("<button />",{class:"btn btn-default","data-action":"changes","data-toggle":"tooltip",title:TYPO3.lang["tooltip.showChanges"]}).append(this.getPreRenderedIcon("actions-document-info")),this.getAction(a.allowedAction_swap&&""===a.Workspaces_CollectionParent,"swap","actions-version-swap-version").attr("title",TYPO3.lang["tooltip.swap"]),this.getAction(a.allowedAction_view,"preview","actions-version-workspace-preview").attr("title",TYPO3.lang["tooltip.viewElementAction"]),this.getAction(a.allowedAction_edit,"open","actions-open").attr("title",TYPO3.lang["tooltip.editElementAction"]),this.getAction(!0,"version","actions-version-page-open").attr("title",TYPO3.lang["tooltip.openPage"]),this.getAction(a.allowedAction_delete,"remove","actions-version-document-remove").attr("title",TYPO3.lang["tooltip.discardVersion"])),""!==a.integrity.messages&&(n=$(TYPO3.settings.Workspaces.icons[a.integrity.status])).attr("data-toggle","tooltip").attr("data-placement","top").attr("data-html","true").attr("title",a.integrity.messages),this.latestPath!==a.path_Workspace&&(this.latestPath=a.path_Workspace,this.elements.$tableBody.append($("<tr />").append($("<th />"),$("<th />",{colspan:6}).text(this.latestPath))));const i=$("<label />",{class:"btn btn-default btn-checkbox"}).append($("<input />",{type:"checkbox"}),$("<span />",{class:"t3-icon fa"})),o={"data-uid":a.uid,"data-pid":a.livepid,"data-t3ver_oid":a.t3ver_oid,"data-t3ver_wsid":a.t3ver_wsid,"data-table":a.table,"data-next-stage":a.value_nextStage,"data-prev-stage":a.value_prevStage,"data-stage":a.stage};""!==a.Workspaces_CollectionParent&&(o["data-collection"]=a.Workspaces_CollectionParent,o.class="collapse"),this.elements.$tableBody.append($("<tr />",o).append($("<td />").empty().append(i),$("<td />",{class:"t3js-title-workspace",style:a.Workspaces_CollectionLevel>0?"padding-left: "+this.indentationPadding*a.Workspaces_CollectionLevel+"px":""}).html(a.icon_Workspace+'&nbsp;<a href="#" data-action="changes"><span class="item-state-'+a.state_Workspace+'">'+a.label_Workspace+"</span></a>"),$("<td />",{class:"t3js-title-live"}).html(a.icon_Live+"&nbsp;"+a.label_Live),$("<td />").text(a.label_Stage),$("<td />").empty().append(n),$("<td />").html(a.language.icon),$("<td />",{class:"text-right nowrap"}).append(s))),Tooltip.initialize('[data-toggle="tooltip"]',{delay:{show:500,hide:100},trigger:"hover",container:"body"})}}buildPagination(e){if(0===e)return void this.elements.$pagination.contents().remove();if(this.paging.totalItems=e,this.paging.totalPages=Math.ceil(e/parseInt(this.settings.limit.toString(),10)),1===this.paging.totalPages)return void this.elements.$pagination.contents().remove();const t=$("<ul />",{class:"pagination pagination-block"}),a=[],s=$("<li />").append($("<a />",{"data-action":"previous"}).append($("<span />",{class:"t3-icon fa fa-arrow-left"}))),n=$("<li />").append($("<a />",{"data-action":"next"}).append($("<span />",{class:"t3-icon fa fa-arrow-right"})));1===this.paging.currentPage&&s.disablePagingAction(),this.paging.currentPage===this.paging.totalPages&&n.disablePagingAction();for(let e=1;e<=this.paging.totalPages;e++){const t=$("<li />",{class:this.paging.currentPage===e?"active":""});t.append($("<a />",{"data-action":"page","data-page":e}).append($("<span />").text(e))),a.push(t)}t.append(s,a,n),this.elements.$pagination.empty().append(t)}renderSelectionActionWizard(e,t){Wizard.addSlide("mass-action-confirmation",TYPO3.lang["window.selectionAction.title"],"<p>"+(new SecurityUtility).encodeHtml(TYPO3.lang["tooltip."+e+"Selected"])+"</p>",Severity_1.SeverityEnum.warning),Wizard.addFinalProcessingSlide(()=>{this.sendRemoteRequest(this.generateRemoteActionsPayload("executeSelectionAction",{action:e,selection:t})).done(()=>{this.getWorkspaceInfos(),Wizard.dismiss(),Backend.refreshPageTree()})}).done(()=>{Wizard.show(),Wizard.getComponent().on("wizard-dismissed",()=>{this.elements.$chooseSelectionAction.val("")})})}renderMassActionWizard(e){let t,a=!1;switch(e){case"publish":t="publishWorkspace";break;case"swap":t="publishWorkspace",a=!0;break;case"discard":t="flushWorkspace";break;default:throw"Invalid mass action "+e+" called."}const s=new SecurityUtility;Wizard.setForceSelection(!1),Wizard.addSlide("mass-action-confirmation",TYPO3.lang["window.massAction.title"],"<p>"+s.encodeHtml(TYPO3.lang["tooltip."+e+"All"])+"<br><br>"+s.encodeHtml(TYPO3.lang["tooltip.affectWholeWorkspace"])+"</p>",Severity_1.SeverityEnum.warning);const n=e=>{const a=e[0].result;a.processed<a.total?this.sendRemoteRequest(this.generateRemoteMassActionsPayload(t,a)).done(n):(this.getWorkspaceInfos(),Wizard.dismiss())};Wizard.addFinalProcessingSlide(()=>{this.sendRemoteRequest(this.generateRemoteMassActionsPayload(t,{init:!0,total:0,processed:0,language:this.settings.language,swap:a})).done(n)}).done(()=>{Wizard.show(),Wizard.getComponent().on("wizard-dismissed",()=>{this.elements.$chooseMassAction.val("")})})}getAction(e,t,a){return e?$("<button />",{class:"btn btn-default","data-action":t,"data-toggle":"tooltip"}).append(this.getPreRenderedIcon(a)):$("<span />",{class:"btn btn-default disabled"}).append(this.getPreRenderedIcon("empty-empty"))}getPreRenderedIcon(e){return this.elements.$actionIcons.find('[data-identifier="'+e+'"]').clone()}}return new Backend});
\ No newline at end of file