UNPKG

woltlab-compiler

Version:

A compiler for WoltLab-Package Archives and WoltLab-Package Components

220 lines 6.76 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const util_1 = require("util"); const Localization_1 = require("../Globalization/Localization"); const OptionItem_1 = require("./OptionItem"); const OptionType_1 = require("./OptionType"); /** * Represents an option. */ class Option { /** * Initializes a new instance of the `Option` class. */ constructor(category, options) { /** * The id of the option. */ this.id = null; /** * The human-readable name of the option. */ this.displayName = new Localization_1.Localization(); /** * The description of the option. */ this.description = new Localization_1.Localization(); /** * The category of the option. */ this.category = null; /** * The type of the option. */ this.type = OptionType_1.OptionType.TextBox; /** * The default value of the option. */ this.defaultValue = null; /** * The show-order of the option. */ this.showOrder = null; /** * The validation-pattern of the option. */ this.validationPattern = null; /** * The items of the option. */ this.items = []; /** * A list of options of which at least one needs to be enabled for the option to be shown. */ this.options = []; /** * A list of options which should be visually enabled when this option is enabled. * * A leading exclamation mark (`!`, `U+0021`) will disable the specified option when this option is enabled. * For `ComboBox` and `RadioButton` types the list should be prefixed by the name of the `selectoption`s followed by a colon (`:`, `U+003A`). * * This setting is a visual helper for the administrator only. * It does not have an effect on the server side processing of the option. */ this.enableOptions = []; /** * A set of additional properties of the option. */ this.additionalProperties = {}; this.category = category; if (!util_1.isNullOrUndefined(options.ID)) { this.ID = options.ID; } this.Name = options.Name; if (!util_1.isNullOrUndefined(options.DisplayName)) { this.DisplayName.Data = options.DisplayName; } if (!util_1.isNullOrUndefined(options.Description)) { this.Description.Data = options.Description; } if (!util_1.isNullOrUndefined(options.Type)) { this.Type = options.Type; } if (!util_1.isNullOrUndefined(options.DefaultValue)) { this.DefaultValue = options.DefaultValue; } if (!util_1.isNullOrUndefined(options.ShowOrder)) { this.ShowOrder = options.ShowOrder; } if (!util_1.isNullOrUndefined(options.ValidationPattern)) { this.ValidationPattern = options.ValidationPattern; } if (!util_1.isNullOrUndefined(options.Items)) { for (let item of options.Items) { this.Items.push(new OptionItem_1.OptionItem(this, item)); } } if (!util_1.isNullOrUndefined(options.Options)) { this.Options = options.Options; } if (!util_1.isNullOrUndefined(options.EnableOptions)) { this.EnableOptions = options.EnableOptions; } if (!util_1.isNullOrUndefined(options.AdditionalProperties)) { this.AdditionalProperties = options.AdditionalProperties; } } /** * Gets or sets the id of the option. */ get ID() { return this.id; } set ID(value) { this.id = value; } /** * Gets or sets the name of the option. */ get Name() { return this.name; } set Name(value) { this.name = value; } /** * Gets the human-readable name of the option. */ get DisplayName() { return this.displayName; } /** * Gets the description of the option. */ get Description() { return this.description; } /** * Gets the category of the option. */ get Category() { return this.category; } /** * Gets or sets the type of the option. */ get Type() { return this.type; } set Type(value) { this.type = value; } /** * Gets or sets the default value of the option. */ get DefaultValue() { return this.defaultValue; } set DefaultValue(value) { this.defaultValue = value; } /** * Gets or sets the show-order of the option. */ get ShowOrder() { return this.showOrder; } set ShowOrder(value) { this.showOrder = value; } /** * Gets or sets the validation-pattern of the option. */ get ValidationPattern() { return this.validationPattern; } set ValidationPattern(value) { this.validationPattern = value; } /** * Gets the items of the option. */ get Items() { return this.items; } /** * Gets or sets a list of options of which at least one needs to be enabled for the option to be shown. */ get Options() { return this.options; } set Options(value) { this.options = value; } /** * Gets or sets a list of options which should be visually enabled when this option is enabled. * * A leading exclamation mark (`!`, `U+0021`) will disable the specified option when this option is enabled. * For `ComboBox` and `RadioButton` types the list should be prefixed by the name of the `selectoption`s followed by a colon (`:`, `U+003A`). * * This setting is a visual helper for the administrator only. * It does not have an effect on the server side processing of the option. */ get EnableOptions() { return this.enableOptions; } set EnableOptions(value) { this.enableOptions = value; } /** * Gets or sets a set of additional properties of the option. */ get AdditionalProperties() { return this.additionalProperties; } set AdditionalProperties(value) { this.additionalProperties = value; } } exports.Option = Option; //# sourceMappingURL=Option.js.map