@taiga-ui/kit
Version:
Taiga UI Angular main components kit
141 lines (136 loc) • 6.87 kB
JavaScript
import { __extends, __decorate, __param } from 'tslib';
import { Optional, Self, Inject, ChangeDetectorRef, Input, HostBinding, ViewChild, Component, ChangeDetectionStrategy, forwardRef, NgModule } from '@angular/core';
import { NgControl, FormsModule } from '@angular/forms';
import { TUI_DEFAULT_IDENTITY_MATCHER, tuiDefaultProp, TUI_FOCUSABLE_ITEM_ACCESSOR, AbstractTuiNullableControl, TuiFocusableModule, TuiFocusedModule, TuiHoveredModule, TuiPressedModule } from '@taiga-ui/cdk';
import { TuiModeDirective } from '@taiga-ui/core';
import { TuiRadioComponent, TuiRadioModule } from '@taiga-ui/kit/components/radio';
import { CommonModule } from '@angular/common';
var TuiRadioLabeledComponent = /** @class */ (function (_super) {
__extends(TuiRadioLabeledComponent, _super);
function TuiRadioLabeledComponent(control, changeDetectorRef, modeDirective) {
var _this = _super.call(this, control, changeDetectorRef) || this;
_this.modeDirective = modeDirective;
_this.size = 'm';
_this.identityMatcher = TUI_DEFAULT_IDENTITY_MATCHER;
_this.pseudoDisabled = false;
return _this;
}
TuiRadioLabeledComponent_1 = TuiRadioLabeledComponent;
Object.defineProperty(TuiRadioLabeledComponent.prototype, "nativeFocusableElement", {
get: function () {
return this.radio ? this.radio.nativeFocusableElement : null;
},
enumerable: true,
configurable: true
});
Object.defineProperty(TuiRadioLabeledComponent.prototype, "focused", {
get: function () {
return !!this.radio && this.radio.focused;
},
enumerable: true,
configurable: true
});
Object.defineProperty(TuiRadioLabeledComponent.prototype, "computedDisabled", {
get: function () {
return this.disabled || this.pseudoDisabled;
},
enumerable: true,
configurable: true
});
Object.defineProperty(TuiRadioLabeledComponent.prototype, "mode", {
get: function () {
return this.modeDirective ? this.modeDirective.mode : null;
},
enumerable: true,
configurable: true
});
TuiRadioLabeledComponent.prototype.onFocused = function (focused) {
this.updateFocused(focused);
};
TuiRadioLabeledComponent.prototype.onHovered = function (hovered) {
this.updateHovered(hovered);
};
TuiRadioLabeledComponent.prototype.onPressed = function (pressed) {
this.updatePressed(pressed);
};
TuiRadioLabeledComponent.prototype.onModelChange = function (value) {
this.updateValue(value);
};
var TuiRadioLabeledComponent_1;
TuiRadioLabeledComponent.ctorParameters = function () { return [
{ type: NgControl, decorators: [{ type: Optional }, { type: Self }, { type: Inject, args: [NgControl,] }] },
{ type: ChangeDetectorRef, decorators: [{ type: Inject, args: [ChangeDetectorRef,] }] },
{ type: TuiModeDirective, decorators: [{ type: Optional }, { type: Inject, args: [TuiModeDirective,] }] }
]; };
__decorate([
Input()
], TuiRadioLabeledComponent.prototype, "item", void 0);
__decorate([
Input(),
HostBinding('attr.data-tui-host-size'),
tuiDefaultProp()
], TuiRadioLabeledComponent.prototype, "size", void 0);
__decorate([
Input(),
tuiDefaultProp()
], TuiRadioLabeledComponent.prototype, "identityMatcher", void 0);
__decorate([
Input(),
tuiDefaultProp()
], TuiRadioLabeledComponent.prototype, "pseudoDisabled", void 0);
__decorate([
ViewChild(TuiRadioComponent)
], TuiRadioLabeledComponent.prototype, "radio", void 0);
__decorate([
HostBinding('class._disabled')
], TuiRadioLabeledComponent.prototype, "computedDisabled", null);
__decorate([
HostBinding('attr.data-mode')
], TuiRadioLabeledComponent.prototype, "mode", null);
TuiRadioLabeledComponent = TuiRadioLabeledComponent_1 = __decorate([
Component({
selector: 'tui-radio-labeled',
template: "<label\n class=\"wrapper\"\n (tuiHoveredChange)=\"onHovered($event)\"\n (tuiPressedChange)=\"onPressed($event)\"\n>\n <tui-radio\n [focusable]=\"focusable\"\n [identityMatcher]=\"identityMatcher\"\n [name]=\"computedName\"\n [nativeId]=\"nativeId\"\n [readOnly]=\"readOnly\"\n [pseudoDisabled]=\"computedDisabled\"\n [pseudoInvalid]=\"computedInvalid\"\n [pseudoFocused]=\"pseudoFocused\"\n [pseudoHovered]=\"computedHovered\"\n [pseudoPressed]=\"computedPressed\"\n [size]=\"size\"\n [item]=\"item\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (focusedChange)=\"onFocused($event)\"\n ></tui-radio>\n <div class=\"content\">\n <ng-content></ng-content>\n </div>\n</label>\n",
changeDetection: ChangeDetectionStrategy.OnPush,
providers: [
{
provide: TUI_FOCUSABLE_ITEM_ACCESSOR,
useExisting: forwardRef(function () { return TuiRadioLabeledComponent_1; }),
},
],
styles: [":host{font:var(--tui-font-text-s);line-height:16px;position:relative;display:block}:host._readonly{pointer-events:none}.wrapper{display:inline-flex;max-width:100%;cursor:pointer;vertical-align:top}:host._disabled .wrapper{cursor:default}:host[data-mode=onDark] .wrapper{color:var(--tui-base-01)}.content{word-wrap:break-word;min-width:0}:host[data-tui-host-size='m'] .content{margin-left:8px}:host[data-tui-host-size='l'] .content{font:var(--tui-font-text-m);margin-left:12px}"]
}),
__param(0, Optional()),
__param(0, Self()),
__param(0, Inject(NgControl)),
__param(1, Inject(ChangeDetectorRef)),
__param(2, Optional()),
__param(2, Inject(TuiModeDirective))
], TuiRadioLabeledComponent);
return TuiRadioLabeledComponent;
}(AbstractTuiNullableControl));
var TuiRadioLabeledModule = /** @class */ (function () {
function TuiRadioLabeledModule() {
}
TuiRadioLabeledModule = __decorate([
NgModule({
imports: [
CommonModule,
FormsModule,
TuiFocusableModule,
TuiFocusedModule,
TuiHoveredModule,
TuiPressedModule,
TuiRadioModule,
],
declarations: [TuiRadioLabeledComponent],
exports: [TuiRadioLabeledComponent],
})
], TuiRadioLabeledModule);
return TuiRadioLabeledModule;
}());
/**
* Generated bundle index. Do not edit.
*/
export { TuiRadioLabeledComponent, TuiRadioLabeledModule };
//# sourceMappingURL=taiga-ui-kit-components-radio-labeled.js.map