/**
* Data handler for a captcha 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/Captcha
- * @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/Captcha
+ * @since 5.2
*/
-define(['Core', './Field', 'WoltLabSuite/Core/Controller/Captcha'], function (Core, FormBuilderField, Captcha) {
+define(["require", "exports", "tslib", "./Field", "../../../Controller/Captcha", "../../../Core"], function (require, exports, tslib_1, Field_1, Captcha_1, Core) {
"use strict";
- /**
- * @constructor
- */
- function FormBuilderFieldCaptcha(fieldId) {
- this.init(fieldId);
- }
- ;
- Core.inherit(FormBuilderFieldCaptcha, FormBuilderField, {
- /**
- * @see WoltLabSuite/Core/Form/Builder/Field/Field#getData
- */
- _getData: function () {
- if (Captcha.has(this._fieldId)) {
- return Captcha.getData(this._fieldId);
+ Field_1 = tslib_1.__importDefault(Field_1);
+ Captcha_1 = tslib_1.__importDefault(Captcha_1);
+ Core = tslib_1.__importStar(Core);
+ class Captcha extends Field_1.default {
+ _getData() {
+ if (Captcha_1.default.has(this._fieldId)) {
+ return Captcha_1.default.getData(this._fieldId);
}
return {};
- },
- /**
- * @see WoltLabSuite/Core/Form/Builder/Field/Field#_readField
- */
- _readField: function () {
+ }
+ _readField() {
// does nothing
- },
- /**
- * @see WoltLabSuite/Core/Form/Builder/Field/Field#destroy
- */
- destroy: function () {
- if (Captcha.has(this._fieldId)) {
- Captcha.delete(this._fieldId);
+ }
+ destroy() {
+ if (Captcha_1.default.has(this._fieldId)) {
+ Captcha_1.default.delete(this._fieldId);
}
}
- });
- return FormBuilderFieldCaptcha;
+ }
+ Core.enableLegacyInheritance(Captcha);
+ return Captcha;
});
+++ /dev/null
-/**
- * Data handler for a captcha 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/Captcha
- * @since 5.2
- */
-define(['Core', './Field', 'WoltLabSuite/Core/Controller/Captcha'], function(Core, FormBuilderField, Captcha) {
- "use strict";
-
- /**
- * @constructor
- */
- function FormBuilderFieldCaptcha(fieldId) {
- this.init(fieldId);
- };
- Core.inherit(FormBuilderFieldCaptcha, FormBuilderField, {
- /**
- * @see WoltLabSuite/Core/Form/Builder/Field/Field#getData
- */
- _getData: function() {
- if (Captcha.has(this._fieldId)) {
- return Captcha.getData(this._fieldId);
- }
-
- return {};
- },
-
- /**
- * @see WoltLabSuite/Core/Form/Builder/Field/Field#_readField
- */
- _readField: function() {
- // does nothing
- },
-
- /**
- * @see WoltLabSuite/Core/Form/Builder/Field/Field#destroy
- */
- destroy: function() {
- if (Captcha.has(this._fieldId)) {
- Captcha.delete(this._fieldId);
- }
- }
- });
-
- return FormBuilderFieldCaptcha;
-});
--- /dev/null
+/**
+ * Data handler for a captcha 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/Captcha
+ * @since 5.2
+ */
+
+import Field from "./Field";
+import ControllerCaptcha from "../../../Controller/Captcha";
+import { FormBuilderData } from "../Data";
+import * as Core from "../../../Core";
+
+class Captcha extends Field {
+ protected _getData(): FormBuilderData {
+ if (ControllerCaptcha.has(this._fieldId)) {
+ return ControllerCaptcha.getData(this._fieldId) as FormBuilderData;
+ }
+
+ return {};
+ }
+
+ protected _readField(): void {
+ // does nothing
+ }
+
+ destroy(): void {
+ if (ControllerCaptcha.has(this._fieldId)) {
+ ControllerCaptcha.delete(this._fieldId);
+ }
+ }
+}
+
+Core.enableLegacyInheritance(Captcha);
+
+export = Captcha;