[TASK] Migrate TYPO3/CMS/Lowlevel/* to TypeScript 57/60257/3
authorFrank Naegler <frank.naegler@typo3.org>
Fri, 15 Mar 2019 12:51:06 +0000 (13:51 +0100)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Fri, 29 Mar 2019 08:41:42 +0000 (09:41 +0100)
Resolves: #87922
Releases: master
Change-Id: I77f1973c656b3b2538a37cd2f4dc2b04358a7198
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60257
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
typo3/sysext/lowlevel/Resources/Private/TypeScript/ConfigurationView.ts [new file with mode: 0644]
typo3/sysext/lowlevel/Resources/Private/TypeScript/QueryGenerator.ts [new file with mode: 0644]
typo3/sysext/lowlevel/Resources/Public/JavaScript/ConfigurationView.js
typo3/sysext/lowlevel/Resources/Public/JavaScript/QueryGenerator.js

diff --git a/typo3/sysext/lowlevel/Resources/Private/TypeScript/ConfigurationView.ts b/typo3/sysext/lowlevel/Resources/Private/TypeScript/ConfigurationView.ts
new file mode 100644 (file)
index 0000000..60f7e47
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+import * as $ 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());
+
+  constructor() {
+    // make search field clearable
+    this.$searchFields.clearable({
+      onClear: (): void => {
+        if (this.searchResultShown) {
+          $(this.$searchFields).closest('form').submit();
+        }
+      },
+    });
+    if (self.location.hash) {
+      // scroll page down, so the just opened subtree is visible after reload and not hidden by doc header
+      $('html, body').scrollTop((document.documentElement.scrollTop || document.body.scrollTop) - 80);
+    }
+  }
+}
+
+export = new ConfigurationView();
diff --git a/typo3/sysext/lowlevel/Resources/Private/TypeScript/QueryGenerator.ts b/typo3/sysext/lowlevel/Resources/Private/TypeScript/QueryGenerator.ts
new file mode 100644 (file)
index 0000000..97a3db7
--- /dev/null
@@ -0,0 +1,90 @@
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+import * as $ from 'jquery';
+import DateTimePicker = require('TYPO3/CMS/Backend/DateTimePicker');
+import 'TYPO3/CMS/Backend/jquery.clearable';
+
+/**
+ * Module: TYPO3/CMS/Lowlevel/QueryGenerator
+ * This module handle the QueryGenerator forms.
+ */
+class QueryGenerator {
+  private form: JQuery = null;
+  private limitField: JQuery = null;
+
+  constructor() {
+    this.initialize();
+  }
+
+  /**
+   * Initialize the QueryGenerator object
+   */
+  private initialize(): void {
+    this.form = $('form[name="queryform"]');
+    this.limitField = $('#queryLimit');
+    this.form.on('click', '.t3js-submit-click', (e: JQueryEventObject): void => {
+      e.preventDefault();
+      this.doSubmit();
+    });
+    this.form.on('change', '.t3js-submit-change', (e: JQueryEventObject): void => {
+      e.preventDefault();
+      this.doSubmit();
+    });
+    this.form.on('click', '.t3js-limit-submit input[type="button"]', (e: JQueryEventObject): void => {
+      e.preventDefault();
+      this.setLimit($(e.currentTarget).data('value'));
+      this.doSubmit();
+    });
+    this.form.on('click', '.t3js-addfield', (e: JQueryEventObject): void => {
+      e.preventDefault();
+      const $field = $(e.currentTarget);
+      this.addValueToField($field.data('field'), $field.val());
+    });
+    this.form.find('.t3js-clearable').clearable({
+      onClear: (): void => {
+        this.doSubmit();
+      },
+    });
+  }
+
+  /**
+   * Submit the form
+   */
+  private doSubmit(): void {
+    this.form.submit();
+  }
+
+  /**
+   * Set query limit
+   *
+   * @param {String} value
+   */
+  private setLimit(value: string): void {
+    this.limitField.val(value);
+  }
+
+  /**
+   * Add value to text field
+   *
+   * @param {String} field the name of the field
+   * @param {String} value the value to add
+   */
+  private addValueToField(field: string, value: string): void {
+    const $target = this.form.find('[name="' + field + '"]');
+    const currentValue = $target.val();
+    $target.val(currentValue + ',' + value);
+  }
+}
+
+export = new QueryGenerator();
index 7123e82..5442b14 100644 (file)
  *
  * The TYPO3 project - inspiring people to share!
  */
-
-/**
- * Module: TYPO3/CMS/Lowlevel/ConfigurationView
- * JavaScript for Configuration View
- * @exports TYPO3/CMS/Lowlevel/ConfigurationView
- */
-define(['jquery', 'TYPO3/CMS/Backend/jquery.clearable'], function($) {
-
-  var $searchFields = $('input[name="searchString"]');
-  var searchResultShown = ('' !== $searchFields.first().val());
-
-  // make search field clearable
-  $searchFields.clearable({
-    onClear: function() {
-      if (searchResultShown) {
-        $(this).closest('form').submit();
-      }
-    }
-  });
-
-  if (self.location.hash) {
-    // scroll page down, so the just opened subtree is visible after reload and not hidden by doc header
-    $("html, body").scrollTop((document.documentElement.scrollTop || document.body.scrollTop) - 80);
-  }
-});
+define(["require","exports","jquery","TYPO3/CMS/Backend/jquery.clearable"],function(e,s,r){"use strict";return new function(){var e=this;this.$searchFields=r('input[name="searchString"]'),this.searchResultShown=""!==this.$searchFields.first().val(),this.$searchFields.clearable({onClear:function(){e.searchResultShown&&r(e.$searchFields).closest("form").submit()}}),self.location.hash&&r("html, body").scrollTop((document.documentElement.scrollTop||document.body.scrollTop)-80)}});
\ No newline at end of file
index 47a00da..4584be9 100644 (file)
  *
  * The TYPO3 project - inspiring people to share!
  */
-
-/**
- * Module: TYPO3/CMS/Lowlevel/QueryGenerator
- * This module handle the QueryGenerator forms.
- */
-define(['jquery', 'TYPO3/CMS/Backend/DateTimePicker', 'TYPO3/CMS/Backend/jquery.clearable'], function($) {
-
-  /**
-   * The QueryGenerator AMD module
-   *
-   * @type {{form: null, limitField: null}}
-   * @exports TYPO3/CMS/Lowlevel/QueryGenerator
-   */
-  var QueryGenerator = {
-    form: null,
-    limitField: null
-  };
-
-  /**
-   * Initialize the QueryGenerator object
-   */
-  QueryGenerator.initialize = function() {
-    QueryGenerator.form = $('form[name="queryform"]');
-    QueryGenerator.limitField = $('#queryLimit');
-    QueryGenerator.form.on('click', '.t3js-submit-click', function(e) {
-      e.preventDefault();
-      QueryGenerator.doSubmit();
-    });
-    QueryGenerator.form.on('change', '.t3js-submit-change', function(e) {
-      e.preventDefault();
-      QueryGenerator.doSubmit();
-    });
-    QueryGenerator.form.on('click', '.t3js-limit-submit button', function(e) {
-      e.preventDefault();
-      QueryGenerator.setLimit($(this).data('value'));
-      QueryGenerator.doSubmit();
-    });
-    QueryGenerator.form.on('click', '.t3js-addfield', function(e) {
-      e.preventDefault();
-      QueryGenerator.addValueToField($(this).data('field'), $(this).val());
-    });
-    QueryGenerator.form.find('.t3js-clearable').clearable({
-      onClear: function() {
-        QueryGenerator.doSubmit();
-      }
-    });
-  };
-
-  /**
-   * Submit the form
-   */
-  QueryGenerator.doSubmit = function() {
-    QueryGenerator.form.submit();
-  };
-
-  /**
-   * Set query limit
-   *
-   * @param {String} value
-   */
-  QueryGenerator.setLimit = function(value) {
-    QueryGenerator.limitField.val(value);
-  };
-
-  /**
-   * Add value to text field
-   *
-   * @param {String} field the name of the field
-   * @param {String} value the value to add
-   */
-  QueryGenerator.addValueToField = function(field, value) {
-    var $target = QueryGenerator.form.find('[name="' + field + '"]');
-    var currentValue = $target.val();
-    $target.val(currentValue + ',' + value);
-  };
-
-  // Initialize
-  QueryGenerator.initialize();
-  return QueryGenerator;
-});
+define(["require","exports","jquery","TYPO3/CMS/Backend/jquery.clearable"],function(t,i,e){"use strict";return new(function(){function t(){this.form=null,this.limitField=null,this.initialize()}return t.prototype.initialize=function(){var t=this;this.form=e('form[name="queryform"]'),this.limitField=e("#queryLimit"),this.form.on("click",".t3js-submit-click",function(i){i.preventDefault(),t.doSubmit()}),this.form.on("change",".t3js-submit-change",function(i){i.preventDefault(),t.doSubmit()}),this.form.on("click",'.t3js-limit-submit input[type="button"]',function(i){i.preventDefault(),t.setLimit(e(i.currentTarget).data("value")),t.doSubmit()}),this.form.on("click",".t3js-addfield",function(i){i.preventDefault();var n=e(i.currentTarget);t.addValueToField(n.data("field"),n.val())}),this.form.find(".t3js-clearable").clearable({onClear:function(){t.doSubmit()}})},t.prototype.doSubmit=function(){this.form.submit()},t.prototype.setLimit=function(t){this.limitField.val(t)},t.prototype.addValueToField=function(t,i){var e=this.form.find('[name="'+t+'"]'),n=e.val();e.val(n+","+i)},t}())});
\ No newline at end of file