From 5076f3f8715f8c9aed20918c3c7ef79de756ae47 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Sat, 12 Dec 2020 15:36:03 +0100 Subject: [PATCH] Convert `Form/Builder/Field/Language/ContentLanguage` to TypeScript --- .../Builder/Field/Language/ContentLanguage.js | 34 ++++++++----------- .../Builder/Field/Language/ContentLanguage.js | 29 ---------------- .../Builder/Field/Language/ContentLanguage.ts | 23 +++++++++++++ 3 files changed, 37 insertions(+), 49 deletions(-) delete mode 100644 wcfsetup/install/files/ts/WoltLabSuite/Core/Form/Builder/Field/Language/ContentLanguage.js create mode 100644 wcfsetup/install/files/ts/WoltLabSuite/Core/Form/Builder/Field/Language/ContentLanguage.ts diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Field/Language/ContentLanguage.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Field/Language/ContentLanguage.js index cb8436daca..699a059e12 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Field/Language/ContentLanguage.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Field/Language/ContentLanguage.js @@ -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 - * @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 + * @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 index 57788494db..0000000000 --- a/wcfsetup/install/files/ts/WoltLabSuite/Core/Form/Builder/Field/Language/ContentLanguage.js +++ /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 - * @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 index 0000000000..bccb45e7c7 --- /dev/null +++ b/wcfsetup/install/files/ts/WoltLabSuite/Core/Form/Builder/Field/Language/ContentLanguage.ts @@ -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 + * @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; -- 2.20.1