Convert `Form/Builder/Field/Language/ContentLanguage` to TypeScript
authorMatthias Schmidt <gravatronics@live.com>
Sat, 12 Dec 2020 14:36:03 +0000 (15:36 +0100)
committerMatthias Schmidt <gravatronics@live.com>
Tue, 15 Dec 2020 17:23:05 +0000 (18:23 +0100)
wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Field/Language/ContentLanguage.js
wcfsetup/install/files/ts/WoltLabSuite/Core/Form/Builder/Field/Language/ContentLanguage.js [deleted file]
wcfsetup/install/files/ts/WoltLabSuite/Core/Form/Builder/Field/Language/ContentLanguage.ts [new file with mode: 0644]

index cb8436dacab556796f6eee54d9c295381060f2b4..699a059e1278c37c38ce8bd5c120bafe0ac722b0 100644 (file)
@@ -1,28 +1,22 @@
 /**
  * Data handler for a content language form builder field in an Ajax form.
  *
- * @author     Matthias Schmidt
- * @copyright  2001-2019 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @module     WoltLabSuite/Core/Form/Builder/Field/Language/ContentLanguage
- * @since      5.2
+ * @author  Matthias Schmidt
+ * @copyright 2001-2020 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @module  WoltLabSuite/Core/Form/Builder/Field/Language/ContentLanguage
+ * @since 5.2
  */
-define(['Core', 'WoltLabSuite/Core/Language/Chooser', '../Value'], function (Core, LanguageChooser, FormBuilderFieldValue) {
+define(["require", "exports", "tslib", "../Value", "../../../../Language/Chooser", "../../../../Core"], function (require, exports, tslib_1, Value_1, LanguageChooser, Core) {
     "use strict";
-    /**
-     * @constructor
-     */
-    function FormBuilderFieldContentLanguage(fieldId) {
-        this.init(fieldId);
-    }
-    ;
-    Core.inherit(FormBuilderFieldContentLanguage, FormBuilderFieldValue, {
-        /**
-         * @see        WoltLabSuite/Core/Form/Builder/Field/Field#destroy
-         */
-        destroy: function () {
+    Value_1 = tslib_1.__importDefault(Value_1);
+    LanguageChooser = tslib_1.__importStar(LanguageChooser);
+    Core = tslib_1.__importStar(Core);
+    class ContentLanguage extends Value_1.default {
+        destroy() {
             LanguageChooser.removeChooser(this._fieldId);
         }
-    });
-    return FormBuilderFieldContentLanguage;
+    }
+    Core.enableLegacyInheritance(ContentLanguage);
+    return ContentLanguage;
 });
diff --git a/wcfsetup/install/files/ts/WoltLabSuite/Core/Form/Builder/Field/Language/ContentLanguage.js b/wcfsetup/install/files/ts/WoltLabSuite/Core/Form/Builder/Field/Language/ContentLanguage.js
deleted file mode 100644 (file)
index 5778849..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/**
- * Data handler for a content language form builder field in an Ajax form.
- * 
- * @author     Matthias Schmidt
- * @copyright  2001-2019 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @module     WoltLabSuite/Core/Form/Builder/Field/Language/ContentLanguage
- * @since      5.2
- */
-define(['Core', 'WoltLabSuite/Core/Language/Chooser', '../Value'], function(Core, LanguageChooser, FormBuilderFieldValue) {
-       "use strict";
-       
-       /**
-        * @constructor
-        */
-       function FormBuilderFieldContentLanguage(fieldId) {
-               this.init(fieldId);
-       };
-       Core.inherit(FormBuilderFieldContentLanguage, FormBuilderFieldValue, {
-               /**
-                * @see WoltLabSuite/Core/Form/Builder/Field/Field#destroy
-                */
-               destroy: function() {
-                       LanguageChooser.removeChooser(this._fieldId);
-               }
-       });
-       
-       return FormBuilderFieldContentLanguage;
-});
diff --git a/wcfsetup/install/files/ts/WoltLabSuite/Core/Form/Builder/Field/Language/ContentLanguage.ts b/wcfsetup/install/files/ts/WoltLabSuite/Core/Form/Builder/Field/Language/ContentLanguage.ts
new file mode 100644 (file)
index 0000000..bccb45e
--- /dev/null
@@ -0,0 +1,23 @@
+/**
+ * Data handler for a content language form builder field in an Ajax form.
+ *
+ * @author  Matthias Schmidt
+ * @copyright 2001-2020 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @module  WoltLabSuite/Core/Form/Builder/Field/Language/ContentLanguage
+ * @since 5.2
+ */
+
+import Value from "../Value";
+import * as LanguageChooser from "../../../../Language/Chooser";
+import * as Core from "../../../../Core";
+
+class ContentLanguage extends Value {
+  public destroy(): void {
+    LanguageChooser.removeChooser(this._fieldId);
+  }
+}
+
+Core.enableLegacyInheritance(ContentLanguage);
+
+export = ContentLanguage;