From: Matthias Schmidt Date: Wed, 9 Dec 2020 16:32:58 +0000 (+0100) Subject: Convert `Form/Builder/Field/Acl` to TypeScript X-Git-Tag: 5.4.0_Alpha_1~526^2~36 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=3193e9c85b54df57224a238c87b203b0b53a8914;p=GitHub%2FWoltLab%2FWCF.git Convert `Form/Builder/Field/Acl` to TypeScript --- diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Field/Acl.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Field/Acl.js index 44e5559a6d..ef94c0247b 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Field/Acl.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Field/Acl.js @@ -1,45 +1,30 @@ /** * Data handler for a acl 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/Acl - * @since 5.2.3 + * @author Matthias Schmidt + * @copyright 2001-2020 WoltLab GmbH + * @license GNU Lesser General Public License + * @module WoltLabSuite/Core/Form/Builder/Field/Acl + * @since 5.2.3 */ -define(['Core', './Field'], function (Core, FormBuilderField) { +define(["require", "exports", "tslib", "./Field", "../../../Core"], function (require, exports, tslib_1, Field_1, Core) { "use strict"; - /** - * @constructor - */ - function FormBuilderFieldAcl(fieldId) { - this.init(fieldId); - this._aclList = null; - } - ; - Core.inherit(FormBuilderFieldAcl, FormBuilderField, { - /** - * @see WoltLabSuite/Core/Form/Builder/Field/Field#_getData - */ - _getData: function () { - var data = {}; - data[this._fieldId] = this._aclList.getData(); - return data; - }, - /** - * @see WoltLabSuite/Core/Form/Builder/Field/Field#_readField - */ - _readField: function () { + Field_1 = tslib_1.__importDefault(Field_1); + Core = tslib_1.__importStar(Core); + class Acl extends Field_1.default { + _getData() { + return { + [this._fieldId]: this._aclList.getData(), + }; + } + _readField() { // does nothing - }, - /** - * Sets the ACL list object used to extract the ACL values. - * - * @param {WCF.ACL.List} aclList - */ - setAclList: function (aclList) { + } + setAclList(aclList) { this._aclList = aclList; + return this; } - }); - return FormBuilderFieldAcl; + } + Core.enableLegacyInheritance(Acl); + return Acl; }); diff --git a/wcfsetup/install/files/ts/WoltLabSuite/Core/Form/Builder/Field/Acl.js b/wcfsetup/install/files/ts/WoltLabSuite/Core/Form/Builder/Field/Acl.js deleted file mode 100644 index c984d4cadf..0000000000 --- a/wcfsetup/install/files/ts/WoltLabSuite/Core/Form/Builder/Field/Acl.js +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Data handler for a acl 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/Acl - * @since 5.2.3 - */ -define(['Core', './Field'], function(Core, FormBuilderField) { - "use strict"; - - /** - * @constructor - */ - function FormBuilderFieldAcl(fieldId) { - this.init(fieldId); - - this._aclList = null; - }; - Core.inherit(FormBuilderFieldAcl, FormBuilderField, { - /** - * @see WoltLabSuite/Core/Form/Builder/Field/Field#_getData - */ - _getData: function() { - var data = {}; - - data[this._fieldId] = this._aclList.getData(); - - return data; - }, - - /** - * @see WoltLabSuite/Core/Form/Builder/Field/Field#_readField - */ - _readField: function() { - // does nothing - }, - - /** - * Sets the ACL list object used to extract the ACL values. - * - * @param {WCF.ACL.List} aclList - */ - setAclList: function(aclList) { - this._aclList = aclList; - } - }); - - return FormBuilderFieldAcl; -}); diff --git a/wcfsetup/install/files/ts/WoltLabSuite/Core/Form/Builder/Field/Acl.ts b/wcfsetup/install/files/ts/WoltLabSuite/Core/Form/Builder/Field/Acl.ts new file mode 100644 index 0000000000..88e1391c44 --- /dev/null +++ b/wcfsetup/install/files/ts/WoltLabSuite/Core/Form/Builder/Field/Acl.ts @@ -0,0 +1,41 @@ +/** + * Data handler for a acl 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/Acl + * @since 5.2.3 + */ + +import Field from "./Field"; +import { FormBuilderData } from "../Data"; +import * as Core from "../../../Core"; + +interface AclList { + getData: () => object; +} + +class Acl extends Field { + protected _aclList: AclList; + + protected _getData(): FormBuilderData { + return { + [this._fieldId]: this._aclList.getData(), + }; + } + + protected _readField(): void { + // does nothing + } + + public setAclList(aclList: AclList): Acl { + this._aclList = aclList; + + return this; + } +} + +Core.enableLegacyInheritance(Acl); + +export = Acl;