UNPKG

@stratio/egeo

Version:
128 lines 11.2 kB
/** * @fileoverview added by tsickle * Generated from: lib/st-radio-menu/st-radio-menu.component.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /* * © 2017 Stratio Big Data Inc., Sucursal en España. * * This software is licensed under the Apache License, Version 2.0. * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the terms of the License for more details. * * SPDX-License-Identifier: Apache-2.0. */ import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core'; /** * \@description {Component} [Radio Menu] * * The Radio Menu is composed of options with radios. Usually, it is used in forms and when user * interacts with the radio menu, certain part of that form changes according to the selected option. * Moreover, you can add to the radio menu a specific theme in order to adapt its colors as you need it. * * \@example * * {html} * * ``` * <st-radio-menu [activeOption]="selectedOptionTheme1" class="radio-menu" [options]="options" * qaTag="radio-menu-theme-gray-1"> * </st-radio-menu> * ``` * */ var StRadioMenuComponent = /** @class */ (function () { function StRadioMenuComponent() { /** * \@Input {StRadioMenuOption} [changedOption=''] */ this.changedOption = new EventEmitter(); } /** * @param {?} option * @return {?} */ StRadioMenuComponent.prototype.isActive = /** * @param {?} option * @return {?} */ function (option) { return (this.activeOption !== undefined && this.activeOption.value === option.value); }; /** * @param {?} option * @return {?} */ StRadioMenuComponent.prototype.activateOption = /** * @param {?} option * @return {?} */ function (option) { this.activeOption = option; this.changedOption.emit(option); }; /** * @param {?} option * @return {?} */ StRadioMenuComponent.prototype.checkedOption = /** * @param {?} option * @return {?} */ function (option) { return this.activeOption && (this.activeOption.value === option.value); }; StRadioMenuComponent.decorators = [ { type: Component, args: [{ selector: 'st-radio-menu', template: "<!--\n\n \u00A9 2017 Stratio Big Data Inc., Sucursal en Espa\u00F1a.\n\n This software is licensed under the Apache License, Version 2.0.\n This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;\n without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n See the terms of the License for more details.\n\n SPDX-License-Identifier: Apache-2.0.\n\n-->\n<section class=\"st-radio-menu sth-radio-menu\">\n <ul class=\"st-radio-menu__list\">\n <li *ngFor=\"let option of options; let i = index;\" class=\"st-radio-menu__option\">\n\n <div class=\"st-radio-menu__option sth-radio-menu-option\" (click)=\"activateOption(option)\" [ngClass]=\"{'active': isActive(option),\n 'no-active': !isActive(option) && activeOption}\" [attr.id]=\"qaTag + '-option-' + i\">\n\n <st-radio [name]=\"option.label\" [value]=\"option.value\" [checked]=\"checkedOption(option)\">\n <span class=\"st-radio-menu__option-text\">{{ option.label }}</span>\n </st-radio>\n </div>\n </li>\n </ul>\n</section>\n", changeDetection: ChangeDetectionStrategy.OnPush, host: { '[class]': 'theme' }, styles: ["@charset \"UTF-8\";:host{display:block}.st-radio-menu{height:100%;width:100%;display:block;position:relative}.st-radio-menu__list{height:100%;position:relative;list-style:none;width:100%;padding-right:30px}.st-radio-menu__option{padding:3px 0 0 8px;height:29px;font-size:15px;margin-bottom:6px;cursor:pointer}.st-radio-menu__option-text{padding-left:7px}.st-radio-menu__option.active{width:80%}.st-radio-menu__option.active:after{border-top:60px solid transparent;border-bottom:60px solid transparent}.st-radio-menu__option.active:before{transform:rotate(45deg);content:\" \";float:right;width:20px;height:20px;margin-top:1.7px;margin-right:-10.4px}"] }] } ]; /** @nocollapse */ StRadioMenuComponent.ctorParameters = function () { return []; }; StRadioMenuComponent.propDecorators = { activeOption: [{ type: Input }], options: [{ type: Input }], qaTag: [{ type: Input }], theme: [{ type: Input }], changedOption: [{ type: Output }] }; return StRadioMenuComponent; }()); export { StRadioMenuComponent }; if (false) { /** * \@Input {StRadioMenuOption} [activeOption=''] Current active option * @type {?} */ StRadioMenuComponent.prototype.activeOption; /** * \@Input {StRadioMenuOption[]} [options=''] Array of string with options, option names must be translated * @type {?} */ StRadioMenuComponent.prototype.options; /** * \@Input {string} [qaTag=''] Identifier to generate a qa tag for each option * @type {?} */ StRadioMenuComponent.prototype.qaTag; /** * \@Input {string} [theme=''] String representing the theme (css class) to be applied to the radio menu component. * If you are using the Stratio theme, the possible values are theme-gray-1 and theme-gray-2 * @type {?} */ StRadioMenuComponent.prototype.theme; /** * \@Input {StRadioMenuOption} [changedOption=''] * @type {?} */ StRadioMenuComponent.prototype.changedOption; } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3QtcmFkaW8tbWVudS5jb21wb25lbnQuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9Ac3RyYXRpby9lZ2VvLyIsInNvdXJjZXMiOlsibGliL3N0LXJhZGlvLW1lbnUvc3QtcmFkaW8tbWVudS5jb21wb25lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7O0FBVUEsT0FBTyxFQUNKLHVCQUF1QixFQUN2QixTQUFTLEVBQ1QsWUFBWSxFQUNaLEtBQUssRUFDTCxNQUFNLEVBQ1IsTUFBTSxlQUFlLENBQUM7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFxQnZCO0lBd0JHOzs7O1FBRlUsa0JBQWEsR0FBb0MsSUFBSSxZQUFZLEVBQXFCLENBQUM7SUFFbEYsQ0FBQzs7Ozs7SUFFaEIsdUNBQVE7Ozs7SUFBUixVQUFTLE1BQXlCO1FBQy9CLE9BQU8sQ0FDSixJQUFJLENBQUMsWUFBWSxLQUFLLFNBQVM7WUFDL0IsSUFBSSxDQUFDLFlBQVksQ0FBQyxLQUFLLEtBQUssTUFBTSxDQUFDLEtBQUssQ0FDMUMsQ0FBQztJQUNMLENBQUM7Ozs7O0lBRUQsNkNBQWM7Ozs7SUFBZCxVQUFlLE1BQXlCO1FBQ3JDLElBQUksQ0FBQyxZQUFZLEdBQUcsTUFBTSxDQUFDO1FBQzNCLElBQUksQ0FBQyxhQUFhLENBQUMsSUFBSSxDQUFDLE1BQU0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