import { OnDestroy, OnInit } from '@angular/core'; import { ControlValueAccessor } from '@angular/forms'; import { NumberInput } from '@ngx-simple/core/coercion'; import { Observable } from 'rxjs'; import { SimSelectionDirective } from './selection.directive'; /** * 使元素成为选择切换项 * * 必须在父`simSelection`指令中使用。 * 必须提供的值。如果在`simSelection`上使用`trackBy`,则值的索引是必需的。 * 如果元素实现了`ControlValueAccessor`,例如:`SimCheckbox`,该指令自动将其与`simSelection`指令提供的选择状态连接。 * 如果没有,使用`checked$`来获取值的检查状态,使用`toggle()`来更改选择状态。 */ export declare class SimSelectionToggleDirective implements OnDestroy, OnInit { private _selection; private _controlValueAccessors; static ngAcceptInputType_index: NumberInput; /** 与切换关联的值 */ value: T; /** 列表中值的索引。与trackBy一起使用时需要 */ get index(): number | undefined; set index(index: number | undefined); protected _index?: number; /** 选择项的选中状态 */ readonly checked: Observable; /** 当指令被销毁时发出 */ private _destroyed; constructor(_selection: SimSelectionDirective, _controlValueAccessors: ControlValueAccessor[]); ngOnInit(): void; ngOnDestroy(): void; /** 切换选择 */ toggle(): void; /** 断言父指令`simSelection`是否存在 */ private _assertValidParentSelection; /** * 配置 ControlValueAccessor 实现 */ private _configureControlValueAccessor; /** * 是否选中 */ private _isSelected; }