@angular/material
Version:
Angular Material
539 lines (533 loc) • 28.1 kB
JavaScript
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import { __extends } from 'tslib';
import * as tslib_1 from 'tslib';
import { coerceBooleanProperty } from '@angular/cdk/coercion';
import { Attribute, ChangeDetectionStrategy, ChangeDetectorRef, Component, Directive, ElementRef, EventEmitter, Input, NgModule, Output, Renderer2, ViewChild, ViewEncapsulation, forwardRef } from '@angular/core';
import { CheckboxRequiredValidator, NG_VALIDATORS, NG_VALUE_ACCESSOR } from '@angular/forms';
import { MatCommonModule, MatRipple, MatRippleModule, mixinColor, mixinDisableRipple, mixinDisabled, mixinTabIndex } from '@angular/material/core';
import { A11yModule, FocusMonitor } from '@angular/cdk/a11y';
import { CommonModule } from '@angular/common';
import { ObserversModule } from '@angular/cdk/observers';
// Increasing integer for generating unique ids for checkbox components.
var nextUniqueId = 0;
/**
* Provider Expression that allows mat-checkbox to register as a ControlValueAccessor.
* This allows it to support [(ngModel)].
* \@docs-private
*/
var MAT_CHECKBOX_CONTROL_VALUE_ACCESSOR = {
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(function () { return MatCheckbox; }),
multi: true
};
var TransitionCheckState = {};
TransitionCheckState.Init = 0;
TransitionCheckState.Checked = 1;
TransitionCheckState.Unchecked = 2;
TransitionCheckState.Indeterminate = 3;
TransitionCheckState[TransitionCheckState.Init] = "Init";
TransitionCheckState[TransitionCheckState.Checked] = "Checked";
TransitionCheckState[TransitionCheckState.Unchecked] = "Unchecked";
TransitionCheckState[TransitionCheckState.Indeterminate] = "Indeterminate";
/**
* Change event object emitted by MatCheckbox.
*/
var MatCheckboxChange = (function () {
function MatCheckboxChange() {
}
return MatCheckboxChange;
}());
/**
* \@docs-private
*/
var MatCheckboxBase = (function () {
/**
* @param {?} _renderer
* @param {?} _elementRef
*/
function MatCheckboxBase(_renderer, _elementRef) {
this._renderer = _renderer;
this._elementRef = _elementRef;
}
return MatCheckboxBase;
}());
var _MatCheckboxMixinBase = mixinTabIndex(mixinColor(mixinDisableRipple(mixinDisabled(MatCheckboxBase)), 'accent'));
/**
* A material design checkbox component. Supports all of the functionality of an HTML5 checkbox,
* and exposes a similar API. A MatCheckbox can be either checked, unchecked, indeterminate, or
* disabled. Note that all additional accessibility attributes are taken care of by the component,
* so there is no need to provide them yourself. However, if you want to omit a label and still
* have the checkbox be accessible, you may supply an [aria-label] input.
* See: https://www.google.com/design/spec/components/selection-controls.html
*/
var MatCheckbox = (function (_super) {
__extends(MatCheckbox, _super);
/**
* @param {?} renderer
* @param {?} elementRef
* @param {?} _changeDetectorRef
* @param {?} _focusMonitor
* @param {?} tabIndex
*/
function MatCheckbox(renderer, elementRef, _changeDetectorRef, _focusMonitor, tabIndex) {
var _this = _super.call(this, renderer, elementRef) || this;
_this._changeDetectorRef = _changeDetectorRef;
_this._focusMonitor = _focusMonitor;
/**
* Attached to the aria-label attribute of the host element. In most cases, arial-labelledby will
* take precedence so this may be omitted.
*/
_this.ariaLabel = '';
/**
* Users can specify the `aria-labelledby` attribute which will be forwarded to the input element
*/
_this.ariaLabelledby = null;
_this._uniqueId = "mat-checkbox-" + ++nextUniqueId;
/**
* A unique id for the checkbox input. If none is supplied, it will be auto-generated.
*/
_this.id = _this._uniqueId;
/**
* Whether the label should appear after or before the checkbox. Defaults to 'after'
*/
_this.labelPosition = 'after';
/**
* Name value will be applied to the input element if present
*/
_this.name = null;
/**
* Event emitted when the checkbox's `checked` value changes.
*/
_this.change = new EventEmitter();
/**
* Event emitted when the checkbox's `indeterminate` value changes.
*/
_this.indeterminateChange = new EventEmitter();
/**
* Called when the checkbox is blurred. Needed to properly implement ControlValueAccessor.
* \@docs-private
*/
_this.onTouched = function () { };
_this._currentAnimationClass = '';
_this._currentCheckState = TransitionCheckState.Init;
_this._checked = false;
_this._indeterminate = false;
_this._controlValueAccessorChangeFn = function () { };
_this.tabIndex = parseInt(tabIndex) || 0;
return _this;
}
Object.defineProperty(MatCheckbox.prototype, "inputId", {
/**
* Returns the unique id for the visual hidden input.
* @return {?}
*/
get: function () { return (this.id || this._uniqueId) + "-input"; },
enumerable: true,
configurable: true
});
Object.defineProperty(MatCheckbox.prototype, "required", {
/**
* Whether the checkbox is required.
* @return {?}
*/
get: function () { return this._required; },
/**
* @param {?} value
* @return {?}
*/
set: function (value) { this._required = coerceBooleanProperty(value); },
enumerable: true,
configurable: true
});
Object.defineProperty(MatCheckbox.prototype, "align", {
/**
* Whether or not the checkbox should appear before or after the label.
* @deprecated
* @return {?}
*/
get: function () {
// align refers to the checkbox relative to the label, while labelPosition refers to the
// label relative to the checkbox. As such, they are inverted.
return this.labelPosition == 'after' ? 'start' : 'end';
},
/**
* @param {?} v
* @return {?}
*/
set: function (v) {
this.labelPosition = (v == 'start') ? 'after' : 'before';
},
enumerable: true,
configurable: true
});
/**
* @return {?}
*/
MatCheckbox.prototype.ngAfterViewInit = function () {
var _this = this;
this._focusMonitor
.monitor(this._inputElement.nativeElement, this._renderer, false)
.subscribe(function (focusOrigin) { return _this._onInputFocusChange(focusOrigin); });
};
/**
* @return {?}
*/
MatCheckbox.prototype.ngOnDestroy = function () {
this._focusMonitor.stopMonitoring(this._inputElement.nativeElement);
};
Object.defineProperty(MatCheckbox.prototype, "checked", {
/**
* Whether the checkbox is checked.
* @return {?}
*/
get: function () {
return this._checked;
},
/**
* @param {?} checked
* @return {?}
*/
set: function (checked) {
if (checked != this.checked) {
this._checked = checked;
this._changeDetectorRef.markForCheck();
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(MatCheckbox.prototype, "indeterminate", {
/**
* Whether the checkbox is indeterminate. This is also known as "mixed" mode and can be used to
* represent a checkbox with three states, e.g. a checkbox that represents a nested list of
* checkable items. Note that whenever checkbox is manually clicked, indeterminate is immediately
* set to false.
* @return {?}
*/
get: function () {
return this._indeterminate;
},
/**
* @param {?} indeterminate
* @return {?}
*/
set: function (indeterminate) {
var /** @type {?} */ changed = indeterminate != this._indeterminate;
this._indeterminate = indeterminate;
if (changed) {
if (this._indeterminate) {
this._transitionCheckState(TransitionCheckState.Indeterminate);
}
else {
this._transitionCheckState(this.checked ? TransitionCheckState.Checked : TransitionCheckState.Unchecked);
}
this.indeterminateChange.emit(this._indeterminate);
}
},
enumerable: true,
configurable: true
});
/**
* @return {?}
*/
MatCheckbox.prototype._isRippleDisabled = function () {
return this.disableRipple || this.disabled;
};
/**
* Method being called whenever the label text changes.
* @return {?}
*/
MatCheckbox.prototype._onLabelTextChange = function () {
// This method is getting called whenever the label of the checkbox changes.
// Since the checkbox uses the OnPush strategy we need to notify it about the change
// that has been recognized by the cdkObserveContent directive.
this._changeDetectorRef.markForCheck();
};
/**
* Sets the model value. Implemented as part of ControlValueAccessor.
* @param {?} value Value to be set to the model.
* @return {?}
*/
MatCheckbox.prototype.writeValue = function (value) {
this.checked = !!value;
};
/**
* Registers a callback to be triggered when the value has changed.
* Implemented as part of ControlValueAccessor.
* @param {?} fn Function to be called on change.
* @return {?}
*/
MatCheckbox.prototype.registerOnChange = function (fn) {
this._controlValueAccessorChangeFn = fn;
};
/**
* Registers a callback to be triggered when the control has been touched.
* Implemented as part of ControlValueAccessor.
* @param {?} fn Callback to be triggered when the checkbox is touched.
* @return {?}
*/
MatCheckbox.prototype.registerOnTouched = function (fn) {
this.onTouched = fn;
};
/**
* Sets the checkbox's disabled state. Implemented as a part of ControlValueAccessor.
* @param {?} isDisabled Whether the checkbox should be disabled.
* @return {?}
*/
MatCheckbox.prototype.setDisabledState = function (isDisabled) {
this.disabled = isDisabled;
this._changeDetectorRef.markForCheck();
};
/**
* @param {?} newState
* @return {?}
*/
MatCheckbox.prototype._transitionCheckState = function (newState) {
var /** @type {?} */ oldState = this._currentCheckState;
var /** @type {?} */ renderer = this._renderer;
var /** @type {?} */ elementRef = this._elementRef;
if (oldState === newState) {
return;
}
if (this._currentAnimationClass.length > 0) {
renderer.removeClass(elementRef.nativeElement, this._currentAnimationClass);
}
this._currentAnimationClass = this._getAnimationClassForCheckStateTransition(oldState, newState);
this._currentCheckState = newState;
if (this._currentAnimationClass.length > 0) {
renderer.addClass(elementRef.nativeElement, this._currentAnimationClass);
}
};
/**
* @return {?}
*/
MatCheckbox.prototype._emitChangeEvent = function () {
var /** @type {?} */ event = new MatCheckboxChange();
event.source = this;
event.checked = this.checked;
this._controlValueAccessorChangeFn(this.checked);
this.change.emit(event);
};
/**
* Function is called whenever the focus changes for the input element.
* @param {?} focusOrigin
* @return {?}
*/
MatCheckbox.prototype._onInputFocusChange = function (focusOrigin) {
if (!this._focusRipple && focusOrigin === 'keyboard') {
this._focusRipple = this._ripple.launch(0, 0, { persistent: true, centered: true });
}
else if (!focusOrigin) {
this._removeFocusRipple();
this.onTouched();
}
};
/**
* Toggles the `checked` state of the checkbox.
* @return {?}
*/
MatCheckbox.prototype.toggle = function () {
this.checked = !this.checked;
};
/**
* Event handler for checkbox input element.
* Toggles checked state if element is not disabled.
* Do not toggle on (change) event since IE doesn't fire change event when
* indeterminate checkbox is clicked.
* @param {?} event
* @return {?}
*/
MatCheckbox.prototype._onInputClick = function (event) {
var _this = this;
// We have to stop propagation for click events on the visual hidden input element.
// By default, when a user clicks on a label element, a generated click event will be
// dispatched on the associated input element. Since we are using a label element as our
// root container, the click event on the `checkbox` will be executed twice.
// The real click event will bubble up, and the generated click event also tries to bubble up.
// This will lead to multiple click events.
// Preventing bubbling for the second event will solve that issue.
event.stopPropagation();
this._removeFocusRipple();
if (!this.disabled) {
// When user manually click on the checkbox, `indeterminate` is set to false.
if (this._indeterminate) {
Promise.resolve().then(function () {
_this._indeterminate = false;
_this.indeterminateChange.emit(_this._indeterminate);
});
}
this.toggle();
this._transitionCheckState(this._checked ? TransitionCheckState.Checked : TransitionCheckState.Unchecked);
// Emit our custom change event if the native input emitted one.
// It is important to only emit it, if the native input triggered one, because
// we don't want to trigger a change event, when the `checked` variable changes for example.
this._emitChangeEvent();
}
};
/**
* Focuses the checkbox.
* @return {?}
*/
MatCheckbox.prototype.focus = function () {
this._focusMonitor.focusVia(this._inputElement.nativeElement, 'keyboard');
};
/**
* @param {?} event
* @return {?}
*/
MatCheckbox.prototype._onInteractionEvent = function (event) {
// We always have to stop propagation on the change event.
// Otherwise the change event, from the input element, will bubble up and
// emit its event object to the `change` output.
event.stopPropagation();
};
/**
* @param {?} oldState
* @param {?} newState
* @return {?}
*/
MatCheckbox.prototype._getAnimationClassForCheckStateTransition = function (oldState, newState) {
var /** @type {?} */ animSuffix = '';
switch (oldState) {
case TransitionCheckState.Init:
// Handle edge case where user interacts with checkbox that does not have [(ngModel)] or
// [checked] bound to it.
if (newState === TransitionCheckState.Checked) {
animSuffix = 'unchecked-checked';
}
else if (newState == TransitionCheckState.Indeterminate) {
animSuffix = 'unchecked-indeterminate';
}
else {
return '';
}
break;
case TransitionCheckState.Unchecked:
animSuffix = newState === TransitionCheckState.Checked ?
'unchecked-checked' : 'unchecked-indeterminate';
break;
case TransitionCheckState.Checked:
animSuffix = newState === TransitionCheckState.Unchecked ?
'checked-unchecked' : 'checked-indeterminate';
break;
case TransitionCheckState.Indeterminate:
animSuffix = newState === TransitionCheckState.Checked ?
'indeterminate-checked' : 'indeterminate-unchecked';
break;
}
return "mat-checkbox-anim-" + animSuffix;
};
/**
* Fades out the focus state ripple.
* @return {?}
*/
MatCheckbox.prototype._removeFocusRipple = function () {
if (this._focusRipple) {
this._focusRipple.fadeOut();
this._focusRipple = null;
}
};
MatCheckbox.decorators = [
{ type: Component, args: [{selector: 'mat-checkbox',
template: "<label [attr.for]=\"inputId\" class=\"mat-checkbox-layout\" #label><div class=\"mat-checkbox-inner-container\" [class.mat-checkbox-inner-container-no-side-margin]=\"!checkboxLabel.textContent || !checkboxLabel.textContent.trim()\"><input #input class=\"mat-checkbox-input cdk-visually-hidden\" type=\"checkbox\" [id]=\"inputId\" [required]=\"required\" [checked]=\"checked\" [attr.value]=\"value\" [disabled]=\"disabled\" [attr.name]=\"name\" [tabIndex]=\"tabIndex\" [indeterminate]=\"indeterminate\" [attr.aria-label]=\"ariaLabel\" [attr.aria-labelledby]=\"ariaLabelledby\" (change)=\"_onInteractionEvent($event)\" (click)=\"_onInputClick($event)\"><div matRipple class=\"mat-checkbox-ripple\" [matRippleTrigger]=\"label\" [matRippleDisabled]=\"_isRippleDisabled()\" [matRippleCentered]=\"true\"></div><div class=\"mat-checkbox-frame\"></div><div class=\"mat-checkbox-background\"><svg version=\"1.1\" focusable=\"false\" class=\"mat-checkbox-checkmark\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" xml:space=\"preserve\"><path class=\"mat-checkbox-checkmark-path\" fill=\"none\" stroke=\"white\" d=\"M4.1,12.7 9,17.6 20.3,6.3\"/></svg><div class=\"mat-checkbox-mixedmark\"></div></div></div><span class=\"mat-checkbox-label\" #checkboxLabel (cdkObserveContent)=\"_onLabelTextChange()\"><span style=\"display:none\"> </span><ng-content></ng-content></span></label>",
styles: ["@keyframes mat-checkbox-fade-in-background{0%{opacity:0}50%{opacity:1}}@keyframes mat-checkbox-fade-out-background{0%,50%{opacity:1}100%{opacity:0}}@keyframes mat-checkbox-unchecked-checked-checkmark-path{0%,50%{stroke-dashoffset:22.91026}50%{animation-timing-function:cubic-bezier(0,0,.2,.1)}100%{stroke-dashoffset:0}}@keyframes mat-checkbox-unchecked-indeterminate-mixedmark{0%,68.2%{transform:scaleX(0)}68.2%{animation-timing-function:cubic-bezier(0,0,0,1)}100%{transform:scaleX(1)}}@keyframes mat-checkbox-checked-unchecked-checkmark-path{from{animation-timing-function:cubic-bezier(.4,0,1,1);stroke-dashoffset:0}to{stroke-dashoffset:-22.91026}}@keyframes mat-checkbox-checked-indeterminate-checkmark{from{animation-timing-function:cubic-bezier(0,0,.2,.1);opacity:1;transform:rotate(0)}to{opacity:0;transform:rotate(45deg)}}@keyframes mat-checkbox-indeterminate-checked-checkmark{from{animation-timing-function:cubic-bezier(.14,0,0,1);opacity:0;transform:rotate(45deg)}to{opacity:1;transform:rotate(360deg)}}@keyframes mat-checkbox-checked-indeterminate-mixedmark{from{animation-timing-function:cubic-bezier(0,0,.2,.1);opacity:0;transform:rotate(-45deg)}to{opacity:1;transform:rotate(0)}}@keyframes mat-checkbox-indeterminate-checked-mixedmark{from{animation-timing-function:cubic-bezier(.14,0,0,1);opacity:1;transform:rotate(0)}to{opacity:0;transform:rotate(315deg)}}@keyframes mat-checkbox-indeterminate-unchecked-mixedmark{0%{animation-timing-function:linear;opacity:1;transform:scaleX(1)}100%,32.8%{opacity:0;transform:scaleX(0)}}.mat-checkbox-checkmark,.mat-checkbox-mixedmark{width:calc(100% - 4px)}.mat-checkbox-background,.mat-checkbox-frame{top:0;left:0;right:0;bottom:0;position:absolute;border-radius:2px;box-sizing:border-box;pointer-events:none}.mat-checkbox{transition:background .4s cubic-bezier(.25,.8,.25,1),box-shadow 280ms cubic-bezier(.4,0,.2,1);cursor:pointer}.mat-checkbox-layout{cursor:inherit;align-items:baseline;vertical-align:middle;display:inline-flex;white-space:nowrap}.mat-checkbox-inner-container{display:inline-block;height:20px;line-height:0;margin:auto;margin-right:8px;order:0;position:relative;vertical-align:middle;white-space:nowrap;width:20px;flex-shrink:0}[dir=rtl] .mat-checkbox-inner-container{margin-left:8px;margin-right:auto}.mat-checkbox-inner-container-no-side-margin{margin-left:0;margin-right:0}.mat-checkbox-frame{background-color:transparent;transition:border-color 90ms cubic-bezier(0,0,.2,.1);border-width:2px;border-style:solid}.mat-checkbox-background{align-items:center;display:inline-flex;justify-content:center;transition:background-color 90ms cubic-bezier(0,0,.2,.1),opacity 90ms cubic-bezier(0,0,.2,.1)}.mat-checkbox-checkmark{top:0;left:0;right:0;bottom:0;position:absolute;width:100%}.mat-checkbox-checkmark-path{stroke-dashoffset:22.91026;stroke-dasharray:22.91026;stroke-width:2.66667px}.mat-checkbox-mixedmark{height:2px;opacity:0;transform:scaleX(0) rotate(0)}.mat-checkbox-label-before .mat-checkbox-inner-container{order:1;margin-left:8px;margin-right:auto}[dir=rtl] .mat-checkbox-label-before .mat-checkbox-inner-container{margin-left:auto;margin-right:8px}.mat-checkbox-checked .mat-checkbox-checkmark{opacity:1}.mat-checkbox-checked .mat-checkbox-checkmark-path{stroke-dashoffset:0}.mat-checkbox-checked .mat-checkbox-mixedmark{transform:scaleX(1) rotate(-45deg)}.mat-checkbox-indeterminate .mat-checkbox-checkmark{opacity:0;transform:rotate(45deg)}.mat-checkbox-indeterminate .mat-checkbox-checkmark-path{stroke-dashoffset:0}.mat-checkbox-indeterminate .mat-checkbox-mixedmark{opacity:1;transform:scaleX(1) rotate(0)}.mat-checkbox-unchecked .mat-checkbox-background{background-color:transparent}.mat-checkbox-disabled{cursor:default}.mat-checkbox-anim-unchecked-checked .mat-checkbox-background{animation:180ms linear 0s mat-checkbox-fade-in-background}.mat-checkbox-anim-unchecked-checked .mat-checkbox-checkmark-path{animation:180ms linear 0s mat-checkbox-unchecked-checked-checkmark-path}.mat-checkbox-anim-unchecked-indeterminate .mat-checkbox-background{animation:180ms linear 0s mat-checkbox-fade-in-background}.mat-checkbox-anim-unchecked-indeterminate .mat-checkbox-mixedmark{animation:90ms linear 0s mat-checkbox-unchecked-indeterminate-mixedmark}.mat-checkbox-anim-checked-unchecked .mat-checkbox-background{animation:180ms linear 0s mat-checkbox-fade-out-background}.mat-checkbox-anim-checked-unchecked .mat-checkbox-checkmark-path{animation:90ms linear 0s mat-checkbox-checked-unchecked-checkmark-path}.mat-checkbox-anim-checked-indeterminate .mat-checkbox-checkmark{animation:90ms linear 0s mat-checkbox-checked-indeterminate-checkmark}.mat-checkbox-anim-checked-indeterminate .mat-checkbox-mixedmark{animation:90ms linear 0s mat-checkbox-checked-indeterminate-mixedmark}.mat-checkbox-anim-indeterminate-checked .mat-checkbox-checkmark{animation:.5s linear 0s mat-checkbox-indeterminate-checked-checkmark}.mat-checkbox-anim-indeterminate-checked .mat-checkbox-mixedmark{animation:.5s linear 0s mat-checkbox-indeterminate-checked-mixedmark}.mat-checkbox-anim-indeterminate-unchecked .mat-checkbox-background{animation:180ms linear 0s mat-checkbox-fade-out-background}.mat-checkbox-anim-indeterminate-unchecked .mat-checkbox-mixedmark{animation:.3s linear 0s mat-checkbox-indeterminate-unchecked-mixedmark}.mat-checkbox-input{bottom:0;left:50%}.mat-checkbox-ripple{position:absolute;left:-15px;top:-15px;right:-15px;bottom:-15px;border-radius:50%;z-index:1;pointer-events:none}"],
exportAs: 'matCheckbox',
host: {
'class': 'mat-checkbox',
'[id]': 'id',
'[class.mat-checkbox-indeterminate]': 'indeterminate',
'[class.mat-checkbox-checked]': 'checked',
'[class.mat-checkbox-disabled]': 'disabled',
'[class.mat-checkbox-label-before]': 'labelPosition == "before"',
},
providers: [MAT_CHECKBOX_CONTROL_VALUE_ACCESSOR],
inputs: ['disabled', 'disableRipple', 'color', 'tabIndex'],
encapsulation: ViewEncapsulation.None,
preserveWhitespaces: false,
changeDetection: ChangeDetectionStrategy.OnPush
},] },
];
/**
* @nocollapse
*/
MatCheckbox.ctorParameters = function () { return [
{ type: Renderer2, },
{ type: ElementRef, },
{ type: ChangeDetectorRef, },
{ type: FocusMonitor, },
{ type: undefined, decorators: [{ type: Attribute, args: ['tabindex',] },] },
]; };
MatCheckbox.propDecorators = {
'ariaLabel': [{ type: Input, args: ['aria-label',] },],
'ariaLabelledby': [{ type: Input, args: ['aria-labelledby',] },],
'id': [{ type: Input },],
'required': [{ type: Input },],
'align': [{ type: Input },],
'labelPosition': [{ type: Input },],
'name': [{ type: Input },],
'change': [{ type: Output },],
'indeterminateChange': [{ type: Output },],
'value': [{ type: Input },],
'_inputElement': [{ type: ViewChild, args: ['input',] },],
'_ripple': [{ type: ViewChild, args: [MatRipple,] },],
'checked': [{ type: Input },],
'indeterminate': [{ type: Input },],
};
return MatCheckbox;
}(_MatCheckboxMixinBase));
var _MatCheckboxRequiredValidator = CheckboxRequiredValidator;
var MAT_CHECKBOX_REQUIRED_VALIDATOR = {
provide: NG_VALIDATORS,
useExisting: forwardRef(function () { return MatCheckboxRequiredValidator; }),
multi: true
};
/**
* Validator for Material checkbox's required attribute in template-driven checkbox.
* Current CheckboxRequiredValidator only work with `input type=checkbox` and does not
* work with `mat-checkbox`.
*/
var MatCheckboxRequiredValidator = (function (_super) {
__extends(MatCheckboxRequiredValidator, _super);
function MatCheckboxRequiredValidator() {
return _super !== null && _super.apply(this, arguments) || this;
}
MatCheckboxRequiredValidator.decorators = [
{ type: Directive, args: [{
selector: "mat-checkbox[required][formControlName],\n mat-checkbox[required][formControl], mat-checkbox[required][ngModel]",
providers: [MAT_CHECKBOX_REQUIRED_VALIDATOR],
host: { '[attr.required]': 'required ? "" : null' }
},] },
];
/**
* @nocollapse
*/
MatCheckboxRequiredValidator.ctorParameters = function () { return []; };
return MatCheckboxRequiredValidator;
}(_MatCheckboxRequiredValidator));
var MatCheckboxModule = (function () {
function MatCheckboxModule() {
}
MatCheckboxModule.decorators = [
{ type: NgModule, args: [{
imports: [CommonModule, MatRippleModule, MatCommonModule, ObserversModule, A11yModule],
exports: [MatCheckbox, MatCheckboxRequiredValidator, MatCommonModule],
declarations: [MatCheckbox, MatCheckboxRequiredValidator],
},] },
];
/**
* @nocollapse
*/
MatCheckboxModule.ctorParameters = function () { return []; };
return MatCheckboxModule;
}());
/**
* Generated bundle index. Do not edit.
*/
export { MAT_CHECKBOX_CONTROL_VALUE_ACCESSOR, TransitionCheckState, MatCheckboxChange, MatCheckboxBase, _MatCheckboxMixinBase, MatCheckbox, MatCheckboxModule, _MatCheckboxRequiredValidator, MAT_CHECKBOX_REQUIRED_VALIDATOR, MatCheckboxRequiredValidator };
//# sourceMappingURL=checkbox.es5.js.map