From: Matthias Schmidt Date: Sat, 12 Dec 2020 14:20:40 +0000 (+0100) Subject: Apply changes from review on form builder TypeScript code X-Git-Tag: 5.4.0_Alpha_1~526^2~22 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=5b56b28b09422a0d3abd8cdc558f8eb45cf66f07;p=GitHub%2FWoltLab%2FWCF.git Apply changes from review on form builder TypeScript code --- diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Field/Button.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Field/Button.js index ff97b3835f..983f78c5ee 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Field/Button.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Field/Button.js @@ -10,6 +10,7 @@ define(["require", "exports", "tslib", "./Field"], function (require, exports, tslib_1, Field_1) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); + exports.Button = void 0; Field_1 = tslib_1.__importDefault(Field_1); class Button extends Field_1.default { _getData() { @@ -20,5 +21,6 @@ define(["require", "exports", "tslib", "./Field"], function (require, exports, t return data; } } + exports.Button = Button; exports.default = Button; }); diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Field/Checked.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Field/Checked.js index 112a4c8a98..267b36e684 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Field/Checked.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Field/Checked.js @@ -15,7 +15,7 @@ define(["require", "exports", "tslib", "./Field", "../../../Core"], function (re class Checked extends Field_1.default { _getData() { return { - [this._fieldId]: this._field.checked ? "1" : "0", + [this._fieldId]: this._field.checked ? 1 : 0, }; } } diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Field/RadioButton.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Field/RadioButton.js index d647b149be..3619d51d2f 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Field/RadioButton.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Field/RadioButton.js @@ -19,6 +19,7 @@ define(["require", "exports", "tslib", "./Field", "../../../Core"], function (re data[this._fieldId] = input.value; return true; } + return false; }); return data; } diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Field/Tag.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Field/Tag.js index 4871837882..cdbed7e6bf 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Field/Tag.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Field/Tag.js @@ -14,9 +14,7 @@ define(["require", "exports", "tslib", "./Field", "../../../Ui/ItemList", "../.. Core = tslib_1.__importStar(Core); class Tag extends Field_1.default { _getData() { - const values = UiItemList.getValues(this._fieldId).map((item) => { - return item.value; - }); + const values = UiItemList.getValues(this._fieldId).map((item) => item.value); return { [this._fieldId]: values, }; diff --git a/wcfsetup/install/files/ts/WoltLabSuite/Core/Form/Builder/Field/Button.ts b/wcfsetup/install/files/ts/WoltLabSuite/Core/Form/Builder/Field/Button.ts index 08deadece7..c88f19846a 100644 --- a/wcfsetup/install/files/ts/WoltLabSuite/Core/Form/Builder/Field/Button.ts +++ b/wcfsetup/install/files/ts/WoltLabSuite/Core/Form/Builder/Field/Button.ts @@ -11,7 +11,7 @@ import Field from "./Field"; import { FormBuilderData } from "../Data"; -export default class Button extends Field { +export class Button extends Field { protected _getData(): FormBuilderData { const data = {}; @@ -22,3 +22,5 @@ export default class Button extends Field { return data; } } + +export default Button; diff --git a/wcfsetup/install/files/ts/WoltLabSuite/Core/Form/Builder/Field/Checked.ts b/wcfsetup/install/files/ts/WoltLabSuite/Core/Form/Builder/Field/Checked.ts index 5f5bcedc04..401052762a 100644 --- a/wcfsetup/install/files/ts/WoltLabSuite/Core/Form/Builder/Field/Checked.ts +++ b/wcfsetup/install/files/ts/WoltLabSuite/Core/Form/Builder/Field/Checked.ts @@ -16,7 +16,7 @@ import * as Core from "../../../Core"; class Checked extends Field { protected _getData(): FormBuilderData { return { - [this._fieldId]: (this._field as HTMLInputElement).checked ? "1" : "0", + [this._fieldId]: (this._field as HTMLInputElement).checked ? 1 : 0, }; } } diff --git a/wcfsetup/install/files/ts/WoltLabSuite/Core/Form/Builder/Field/RadioButton.ts b/wcfsetup/install/files/ts/WoltLabSuite/Core/Form/Builder/Field/RadioButton.ts index be54ac8091..cd5ff2b975 100644 --- a/wcfsetup/install/files/ts/WoltLabSuite/Core/Form/Builder/Field/RadioButton.ts +++ b/wcfsetup/install/files/ts/WoltLabSuite/Core/Form/Builder/Field/RadioButton.ts @@ -23,6 +23,8 @@ class RadioButton extends Field { data[this._fieldId] = input.value; return true; } + + return false; }); return data; diff --git a/wcfsetup/install/files/ts/WoltLabSuite/Core/Form/Builder/Field/Tag.ts b/wcfsetup/install/files/ts/WoltLabSuite/Core/Form/Builder/Field/Tag.ts index cee036ec2b..a56b322f4b 100644 --- a/wcfsetup/install/files/ts/WoltLabSuite/Core/Form/Builder/Field/Tag.ts +++ b/wcfsetup/install/files/ts/WoltLabSuite/Core/Form/Builder/Field/Tag.ts @@ -15,9 +15,7 @@ import * as Core from "../../../Core"; class Tag extends Field { protected _getData(): FormBuilderData { - const values: string[] = UiItemList.getValues(this._fieldId).map((item) => { - return item.value; - }); + const values: string[] = UiItemList.getValues(this._fieldId).map((item) => item.value); return { [this._fieldId]: values,