import { FocusMonitor, FocusOrigin } from '@angular/cdk/a11y'; import { AfterContentInit, AfterViewInit, ChangeDetectorRef, DoCheck, ElementRef, EventEmitter, InjectionToken, OnChanges, OnDestroy, OnInit, QueryList } from '@angular/core'; import { AbstractControl, ControlValueAccessor, FormGroupDirective, NgControl, NgForm, ValidationErrors, ValidatorFn } from '@angular/forms'; import { CanColor, CanDisable, CanUpdateErrorState, ErrorStateMatcher, HasTabIndex, ThemePalette } from '@ngx-simple/core/common-behaviors'; import { OnChangeType, OnTouchedType, SafeAny, ValidatorOnChange } from '@ngx-simple/core/types'; import { SimFormFieldControl } from '@ngx-simple/simple-ui/form-field'; export interface SimCheckboxDefaultOptions { color?: ThemePalette; } /** 注入令牌,用于覆盖'sim-checkbox'的默认选项。 */ export declare const SIM_CHECKBOX_DEFAULT_OPTIONS: InjectionToken; export declare function SIM_CHECKBOX_DEFAULT_OPTIONS_FACTORY(): SimCheckboxDefaultOptions; /** * 复选框标签显示的位置 */ export declare type CheckboxLabelPosition = 'before' | 'after'; /** * 表示需要在它们之间进行自定义转换的不同状态。 */ export declare enum TransitionCheckState { /** 组件在任何用户交互之前的初始状态。 */ Init = 0, /** 当组件选中时,表示该组件的状态。 */ Checked = 1, /** 当组件未选中时,表示该组件的状态。 */ Unchecked = 2, /** 当组件变得不确定时,表示该组件的状态。 */ Indeterminate = 3 } /** 更改SimCheckbox发出的事件对象 */ export declare class SimCheckboxChange { /** 发出更改事件的SimCheckbox */ source: SimCheckboxComponent; /** 复选框是否选中值 */ checked: boolean; constructor( /** 发出更改事件的SimCheckbox */ source: SimCheckboxComponent, /** 复选框是否选中值 */ checked: boolean); } /** * 复选框值 */ declare type CheckboxValue = Array; /** 更改SimCheckboxGroup发出的事件对象 */ export declare class SimCheckboxGroupChange { /** 发出更改事件的simCheckboxGroup集合。 */ source: SimCheckboxGroupDirective; /** SimCheckbox的值集合。 */ value: CheckboxValue; constructor( /** 发出更改事件的simCheckboxGroup集合。 */ source: SimCheckboxGroupDirective, /** SimCheckbox的值集合。 */ value: CheckboxValue); } declare class SimCheckboxGroupBase { _defaultErrorStateMatcher: ErrorStateMatcher; _parentForm: NgForm; _parentFormGroup: FormGroupDirective; ngControl: NgControl; constructor(_defaultErrorStateMatcher: ErrorStateMatcher, _parentForm: NgForm, _parentFormGroup: FormGroupDirective, ngControl: NgControl); } declare const _SimCheckboxGroupMixinBase: import("../../../dist/libs/core/common-behaviors/constructor").Constructor & typeof SimCheckboxGroupBase; /** 最小选项的表单控件验证器 */ export declare function simCheckboxMinValidator(minLength: number): ValidatorFn; /** 最大选项的表单控件验证器 */ export declare function simCheckboxMaxValidator(maxLength: number): (control: AbstractControl) => ValidationErrors | null; export declare class SimCheckboxGroupDirective extends _SimCheckboxGroupMixinBase implements SimFormFieldControl, OnChanges, DoCheck, AfterContentInit, OnDestroy, CanUpdateErrorState, ControlValueAccessor { ngControl: NgControl; private _changeDetector; /** 单选按钮组的名称。这个组中的所有单选按钮都将使用这个名称。 */ get name(): string; set name(value: string); private _name; /** 标签应该出现在单选按钮之后还是之前。默认为 after */ get labelPosition(): CheckboxLabelPosition; set labelPosition(v: CheckboxLabelPosition); private _labelPosition; /** * 单选按钮组的值。 * 如果存在一个具有匹配值的单选按钮,则该值应等于所选单选按钮的值。 * 如果没有这样的单选按钮,则在添加具有匹配值的新单选按钮的情况下,将继续应用此值。 */ get value(): CheckboxValue; set value(newValue: CheckboxValue); private _value; /** 单选按钮组是否禁用 */ get disabled(): boolean; set disabled(value: boolean); private _disabled; /** 单选按钮组是否必填 */ get required(): boolean; set required(value: boolean); private _required; /** 最大可以选择的有效项,超过只会,剩余未选中的项被禁用 */ get maxLength(): number | null; set maxLength(value: number | null); private _maxLength; id: string; /** 复选框主题 */ color: ThemePalette; errorStateMatcher: ErrorStateMatcher; /** * 当此单选按钮的选中状态更改时发出的事件。 * 只有当 value 是由于用户与单选按钮交互而发生更改时才会发出 change 事件(与``相同的行为)。 */ readonly change: EventEmitter; _checkboxes: QueryList; _controlValueAccessorChangeFn: OnChangeType; _onTouched: OnTouchedType; _validatorOnChange: ValidatorOnChange; _validator: ValidatorFn | null; get empty(): boolean; controlType: string; autofilled: boolean; placeholder: string; focused: boolean; /** 当前选中的sim-checkbox */ get selected(): SimCheckboxComponent[]; /** value 是否被设置为初始值。 */ private _isInitialized; private _selectionModel; /** 缓存超过 maxLength 未禁用的复选框 */ private _disabledCheckboxes; constructor(_defaultErrorStateMatcher: ErrorStateMatcher, ngControl: NgControl, _parentForm: NgForm, _parentFormGroup: FormGroupDirective, _changeDetector: ChangeDetectorRef); ngOnChanges(): void; ngAfterContentInit(): void; ngDoCheck(): void; ngOnDestroy(): void; registerOnValidatorChange(fn: ValidatorOnChange): void; validate(c: AbstractControl): ValidationErrors | null; writeValue(value: CheckboxValue): void; registerOnChange(fn: OnChangeType): void; registerOnTouched(fn: OnTouchedType): void; setDisabledState(isDisabled: boolean): void; onContainerClick(): void; setDescribedByIds(ids: string[]): void; _touch(): void; /** 检查 value长度是否在合法的给定 maxLength 中 */ _checkValueLength(): void; /** 根据sim-checkbox的checked的状态更新组选择的数组 */ _selectionCheckbox(checkbox: SimCheckboxComponent, newCheckedState: boolean): void; /** 更新复选框组的值 */ _groupValueChanged(): void; /** 具有当前选择和组值的派送更改事件。 */ _emitChangeEvent(): void; /** 从内部_value状态更新selected多选框。 */ private _updateSelectedCheckboxFromValue; private _markCheckboxesForCheck; private _updateCheckboxesButtonNames; } export declare class SimCheckboxBase { _defaultErrorStateMatcher: ErrorStateMatcher; _parentForm: NgForm; _parentFormGroup: FormGroupDirective; ngControl: NgControl; _elementRef: ElementRef; constructor(_defaultErrorStateMatcher: ErrorStateMatcher, _parentForm: NgForm, _parentFormGroup: FormGroupDirective, ngControl: NgControl, _elementRef: ElementRef); } declare const _SimCheckboxMixinBase: import("../../../dist/libs/core/common-behaviors/constructor").Constructor & import("../../../dist/libs/core/common-behaviors/constructor").Constructor & import("../../../dist/libs/core/common-behaviors/constructor").Constructor & import("../../../dist/libs/core/common-behaviors/constructor").Constructor & typeof SimCheckboxBase; export declare class SimCheckboxComponent extends _SimCheckboxMixinBase implements ControlValueAccessor, OnInit, AfterViewInit, CanColor, CanDisable, HasTabIndex, SimFormFieldControl, OnChanges, DoCheck, OnDestroy, CanUpdateErrorState { private _focusMonitor; ngControl: NgControl; private _changeDetector; private _options?; /** 复选框主题 */ color: ThemePalette; /** tab 键控制次序 */ tabIndex: number; private _uniqueId; /** 复选框输入的唯一id。如果没有提供,它将自动生成。 */ id: string; /** 绑定自定义数据 */ data: SafeAny; /** 复选框是否必选 */ get required(): boolean; set required(value: boolean); private _required; /** * 复选框是否选中 */ get checked(): boolean; set checked(value: boolean); private _checked; get indeterminate(): boolean; set indeterminate(value: boolean); private _indeterminate; /** 复选框是否被禁用 */ get disabled(): any; set disabled(value: any); private _disabled; /** 标签应该出现在单选按钮之后还是之前。默认为 after */ get labelPosition(): CheckboxLabelPosition; set labelPosition(value: CheckboxLabelPosition); private _labelPosition; /** 如果存在,将应用到隐藏input元素value值 */ value: string | number; /** 如果存在,将应用到隐藏input元素name值 */ name: string | null; errorStateMatcher: ErrorStateMatcher; /** 当复选框的选中值更改时发出的事件 */ readonly change: EventEmitter; /** 当复选框的`indeterminate`值发生变化时发出的事件 */ readonly indeterminateChange: EventEmitter; /** 获取 `` */ _inputElement: ElementRef; /** 设置隐藏input的id */ get inputId(): string; placeholder: string; focused: boolean; get empty(): boolean; controlType: string; autofilled: boolean; _controlValueAccessorChangeFn: OnChangeType; _onTouched: OnTouchedType; checkboxGroup: SimCheckboxGroupDirective; constructor(checkboxGroup: SimCheckboxGroupDirective, _elementRef: ElementRef, _defaultErrorStateMatcher: ErrorStateMatcher, _parentForm: NgForm, _parentFormGroup: FormGroupDirective, _focusMonitor: FocusMonitor, ngControl: NgControl, _changeDetector: ChangeDetectorRef, tabIndex: string, _options?: SimCheckboxDefaultOptions); ngOnInit(): void; ngAfterViewInit(): void; ngOnChanges(): void; ngDoCheck(): void; ngOnDestroy(): void; writeValue(value: boolean): void; registerOnChange(fn: OnChangeType): void; registerOnTouched(fn: OnTouchedType): void; setDisabledState(isDisabled: boolean): void; onContainerClick(): void; setDescribedByIds(ids: string[]): void; /** 复选框获取焦点 */ focus(origin?: FocusOrigin, options?: FocusOptions): void; /** 切换复选框的“checked”状态 */ toggle(): void; _onInputClick(event: Event): void; _onInputChange(event: Event): void; /** 每当标签文本更改时调用。 */ _onLabelTextChange(): void; _markForCheck(): void; private _emitChangeEvent; /** 将`indeterminate`值与DOM节点同步 */ private _syncIndeterminate; } export {};