projects/ng-dynamic-forms/core/src/lib/model/select/dynamic-select.model.ts
constructor(config: DynamicSelectModelConfig
|
|||||||||
Parameters :
|
compareWithFn |
Type : function
|
filterable |
Type : boolean
|
Decorators :
@serializable()
|
multiple |
Type : boolean
|
Decorators :
@serializable()
|
placeholder |
Type : string
|
Decorators :
@serializable()
|
prefix |
Type : string | null
|
Decorators :
@serializable()
|
suffix |
Type : string | null
|
Decorators :
@serializable()
|
Readonly type |
Type : string
|
Default value : DYNAMIC_FORM_CONTROL_TYPE_SELECT
|
Decorators :
@serializable()
|
Private _options |
Type : DynamicFormOption<T>[]
|
Default value : []
|
Decorators :
@serializable('options')
|
Inherited from
DynamicOptionControlModel
|
Defined in
DynamicOptionControlModel:48
|
options$ |
Type : Observable<DynamicFormOption[]>
|
Inherited from
DynamicOptionControlModel
|
Defined in
DynamicOptionControlModel:49
|
Private _value |
Type : T | null
|
Decorators :
@serializable('value')
|
Inherited from
DynamicOptionControlModel
|
Defined in
DynamicOptionControlModel:22
|
additional |
Type : literal type | null
|
Decorators :
@serializable()
|
Inherited from
DynamicOptionControlModel
|
Defined in
DynamicOptionControlModel:18
|
hint |
Type : string | null
|
Decorators :
@serializable()
|
Inherited from
DynamicOptionControlModel
|
Defined in
DynamicOptionControlModel:19
|
required |
Type : boolean
|
Decorators :
@serializable()
|
Inherited from
DynamicOptionControlModel
|
Defined in
DynamicOptionControlModel:20
|
tabIndex |
Type : number | null
|
Decorators :
@serializable()
|
Inherited from
DynamicOptionControlModel
|
Defined in
DynamicOptionControlModel:21
|
Private Readonly value$ |
Type : BehaviorSubject<T>
|
Inherited from
DynamicOptionControlModel
|
Defined in
DynamicOptionControlModel:24
|
Readonly valueChanges |
Type : Observable<T>
|
Inherited from
DynamicOptionControlModel
|
Defined in
DynamicOptionControlModel:26
|
_disabled |
Type : boolean
|
Decorators :
@serializable('disabled')
|
Inherited from
DynamicOptionControlModel
|
Defined in
DynamicOptionControlModel:28
|
asyncValidators |
Type : DynamicValidatorsConfig | null
|
Decorators :
@serializable()
|
Inherited from
DynamicOptionControlModel
|
Defined in
DynamicOptionControlModel:27
|
controlTooltip |
Type : string | null
|
Decorators :
@serializable()
|
Inherited from
DynamicOptionControlModel
|
Defined in
DynamicOptionControlModel:34
|
Private Readonly disabled$ |
Type : BehaviorSubject<boolean>
|
Inherited from
DynamicOptionControlModel
|
Defined in
DynamicOptionControlModel:42
|
Readonly disabledChanges |
Type : Observable<boolean>
|
Inherited from
DynamicOptionControlModel
|
Defined in
DynamicOptionControlModel:44
|
errorMessages |
Type : DynamicValidatorsConfig | null
|
Decorators :
@serializable()
|
Inherited from
DynamicOptionControlModel
|
Defined in
DynamicOptionControlModel:29
|
hidden |
Type : boolean
|
Decorators :
@serializable()
|
Inherited from
DynamicOptionControlModel
|
Defined in
DynamicOptionControlModel:30
|
id |
Type : string
|
Decorators :
@serializable()
|
Inherited from
DynamicOptionControlModel
|
Defined in
DynamicOptionControlModel:31
|
label |
Type : string | null
|
Decorators :
@serializable()
|
Inherited from
DynamicOptionControlModel
|
Defined in
DynamicOptionControlModel:32
|
labelTooltip |
Type : string | null
|
Decorators :
@serializable()
|
Inherited from
DynamicOptionControlModel
|
Defined in
DynamicOptionControlModel:33
|
layout |
Type : DynamicFormControlLayout | null
|
Decorators :
@serializable()
|
Inherited from
DynamicOptionControlModel
|
Defined in
DynamicOptionControlModel:35
|
name |
Type : string
|
Decorators :
@serializable()
|
Inherited from
DynamicOptionControlModel
|
Defined in
DynamicOptionControlModel:36
|
parent |
Type : DynamicPathable | null
|
Default value : null
|
Inherited from
DynamicOptionControlModel
|
Defined in
DynamicOptionControlModel:37
|
relations |
Type : DynamicFormControlRelation[]
|
Decorators :
@serializable()
|
Inherited from
DynamicOptionControlModel
|
Defined in
DynamicOptionControlModel:38
|
Abstract Readonly type |
Type : string
|
Inherited from
DynamicOptionControlModel
|
Defined in
DynamicOptionControlModel:46
|
updateOn |
Type : DynamicFormHook | null
|
Decorators :
@serializable()
|
Inherited from
DynamicOptionControlModel
|
Defined in
DynamicOptionControlModel:39
|
validators |
Type : DynamicValidatorsConfig | null
|
Decorators :
@serializable()
|
Inherited from
DynamicOptionControlModel
|
Defined in
DynamicOptionControlModel:40
|
_disabled |
Type : boolean
|
Decorators :
@serializable('disabled')
|
Inherited from
DynamicOptionControlModel
|
Defined in
DynamicOptionControlModel:28
|
asyncValidators |
Type : DynamicValidatorsConfig | null
|
Decorators :
@serializable()
|
Inherited from
DynamicOptionControlModel
|
Defined in
DynamicOptionControlModel:27
|
controlTooltip |
Type : string | null
|
Decorators :
@serializable()
|
Inherited from
DynamicOptionControlModel
|
Defined in
DynamicOptionControlModel:34
|
Private Readonly disabled$ |
Type : BehaviorSubject<boolean>
|
Inherited from
DynamicOptionControlModel
|
Defined in
DynamicOptionControlModel:42
|
Readonly disabledChanges |
Type : Observable<boolean>
|
Inherited from
DynamicOptionControlModel
|
Defined in
DynamicOptionControlModel:44
|
errorMessages |
Type : DynamicValidatorsConfig | null
|
Decorators :
@serializable()
|
Inherited from
DynamicOptionControlModel
|
Defined in
DynamicOptionControlModel:29
|
hidden |
Type : boolean
|
Decorators :
@serializable()
|
Inherited from
DynamicOptionControlModel
|
Defined in
DynamicOptionControlModel:30
|
id |
Type : string
|
Decorators :
@serializable()
|
Inherited from
DynamicOptionControlModel
|
Defined in
DynamicOptionControlModel:31
|
label |
Type : string | null
|
Decorators :
@serializable()
|
Inherited from
DynamicOptionControlModel
|
Defined in
DynamicOptionControlModel:32
|
labelTooltip |
Type : string | null
|
Decorators :
@serializable()
|
Inherited from
DynamicOptionControlModel
|
Defined in
DynamicOptionControlModel:33
|
layout |
Type : DynamicFormControlLayout | null
|
Decorators :
@serializable()
|
Inherited from
DynamicOptionControlModel
|
Defined in
DynamicOptionControlModel:35
|
name |
Type : string
|
Decorators :
@serializable()
|
Inherited from
DynamicOptionControlModel
|
Defined in
DynamicOptionControlModel:36
|
parent |
Type : DynamicPathable | null
|
Default value : null
|
Inherited from
DynamicOptionControlModel
|
Defined in
DynamicOptionControlModel:37
|
relations |
Type : DynamicFormControlRelation[]
|
Decorators :
@serializable()
|
Inherited from
DynamicOptionControlModel
|
Defined in
DynamicOptionControlModel:38
|
Abstract Readonly type |
Type : string
|
Inherited from
DynamicOptionControlModel
|
Defined in
DynamicOptionControlModel:46
|
updateOn |
Type : DynamicFormHook | null
|
Decorators :
@serializable()
|
Inherited from
DynamicOptionControlModel
|
Defined in
DynamicOptionControlModel:39
|
validators |
Type : DynamicValidatorsConfig | null
|
Decorators :
@serializable()
|
Inherited from
DynamicOptionControlModel
|
Defined in
DynamicOptionControlModel:40
|
Private _value |
Type : T | null
|
Decorators :
@serializable('value')
|
Inherited from
DynamicFormValueControlModel
|
Defined in
DynamicFormValueControlModel:22
|
additional |
Type : literal type | null
|
Decorators :
@serializable()
|
Inherited from
DynamicFormValueControlModel
|
Defined in
DynamicFormValueControlModel:18
|
hint |
Type : string | null
|
Decorators :
@serializable()
|
Inherited from
DynamicFormValueControlModel
|
Defined in
DynamicFormValueControlModel:19
|
required |
Type : boolean
|
Decorators :
@serializable()
|
Inherited from
DynamicFormValueControlModel
|
Defined in
DynamicFormValueControlModel:20
|
tabIndex |
Type : number | null
|
Decorators :
@serializable()
|
Inherited from
DynamicFormValueControlModel
|
Defined in
DynamicFormValueControlModel:21
|
Private Readonly value$ |
Type : BehaviorSubject<T>
|
Inherited from
DynamicFormValueControlModel
|
Defined in
DynamicFormValueControlModel:24
|
Readonly valueChanges |
Type : Observable<T>
|
Inherited from
DynamicFormValueControlModel
|
Defined in
DynamicFormValueControlModel:26
|
_disabled |
Type : boolean
|
Decorators :
@serializable('disabled')
|
Inherited from
DynamicFormValueControlModel
|
Defined in
DynamicFormValueControlModel:28
|
asyncValidators |
Type : DynamicValidatorsConfig | null
|
Decorators :
@serializable()
|
Inherited from
DynamicFormValueControlModel
|
Defined in
DynamicFormValueControlModel:27
|
controlTooltip |
Type : string | null
|
Decorators :
@serializable()
|
Inherited from
DynamicFormValueControlModel
|
Defined in
DynamicFormValueControlModel:34
|
Private Readonly disabled$ |
Type : BehaviorSubject<boolean>
|
Inherited from
DynamicFormValueControlModel
|
Defined in
DynamicFormValueControlModel:42
|
Readonly disabledChanges |
Type : Observable<boolean>
|
Inherited from
DynamicFormValueControlModel
|
Defined in
DynamicFormValueControlModel:44
|
errorMessages |
Type : DynamicValidatorsConfig | null
|
Decorators :
@serializable()
|
Inherited from
DynamicFormValueControlModel
|
Defined in
DynamicFormValueControlModel:29
|
hidden |
Type : boolean
|
Decorators :
@serializable()
|
Inherited from
DynamicFormValueControlModel
|
Defined in
DynamicFormValueControlModel:30
|
id |
Type : string
|
Decorators :
@serializable()
|
Inherited from
DynamicFormValueControlModel
|
Defined in
DynamicFormValueControlModel:31
|
label |
Type : string | null
|
Decorators :
@serializable()
|
Inherited from
DynamicFormValueControlModel
|
Defined in
DynamicFormValueControlModel:32
|
labelTooltip |
Type : string | null
|
Decorators :
@serializable()
|
Inherited from
DynamicFormValueControlModel
|
Defined in
DynamicFormValueControlModel:33
|
layout |
Type : DynamicFormControlLayout | null
|
Decorators :
@serializable()
|
Inherited from
DynamicFormValueControlModel
|
Defined in
DynamicFormValueControlModel:35
|
name |
Type : string
|
Decorators :
@serializable()
|
Inherited from
DynamicFormValueControlModel
|
Defined in
DynamicFormValueControlModel:36
|
parent |
Type : DynamicPathable | null
|
Default value : null
|
Inherited from
DynamicFormValueControlModel
|
Defined in
DynamicFormValueControlModel:37
|
relations |
Type : DynamicFormControlRelation[]
|
Decorators :
@serializable()
|
Inherited from
DynamicFormValueControlModel
|
Defined in
DynamicFormValueControlModel:38
|
Abstract Readonly type |
Type : string
|
Inherited from
DynamicFormValueControlModel
|
Defined in
DynamicFormValueControlModel:46
|
updateOn |
Type : DynamicFormHook | null
|
Decorators :
@serializable()
|
Inherited from
DynamicFormValueControlModel
|
Defined in
DynamicFormValueControlModel:39
|
validators |
Type : DynamicValidatorsConfig | null
|
Decorators :
@serializable()
|
Inherited from
DynamicFormValueControlModel
|
Defined in
DynamicFormValueControlModel:40
|
_disabled |
Type : boolean
|
Decorators :
@serializable('disabled')
|
Inherited from
DynamicFormControlModel
|
Defined in
DynamicFormControlModel:28
|
asyncValidators |
Type : DynamicValidatorsConfig | null
|
Decorators :
@serializable()
|
Inherited from
DynamicFormControlModel
|
Defined in
DynamicFormControlModel:27
|
controlTooltip |
Type : string | null
|
Decorators :
@serializable()
|
Inherited from
DynamicFormControlModel
|
Defined in
DynamicFormControlModel:34
|
Private Readonly disabled$ |
Type : BehaviorSubject<boolean>
|
Inherited from
DynamicFormControlModel
|
Defined in
DynamicFormControlModel:42
|
Readonly disabledChanges |
Type : Observable<boolean>
|
Inherited from
DynamicFormControlModel
|
Defined in
DynamicFormControlModel:44
|
errorMessages |
Type : DynamicValidatorsConfig | null
|
Decorators :
@serializable()
|
Inherited from
DynamicFormControlModel
|
Defined in
DynamicFormControlModel:29
|
hidden |
Type : boolean
|
Decorators :
@serializable()
|
Inherited from
DynamicFormControlModel
|
Defined in
DynamicFormControlModel:30
|
id |
Type : string
|
Decorators :
@serializable()
|
Inherited from
DynamicFormControlModel
|
Defined in
DynamicFormControlModel:31
|
label |
Type : string | null
|
Decorators :
@serializable()
|
Inherited from
DynamicFormControlModel
|
Defined in
DynamicFormControlModel:32
|
labelTooltip |
Type : string | null
|
Decorators :
@serializable()
|
Inherited from
DynamicFormControlModel
|
Defined in
DynamicFormControlModel:33
|
layout |
Type : DynamicFormControlLayout | null
|
Decorators :
@serializable()
|
Inherited from
DynamicFormControlModel
|
Defined in
DynamicFormControlModel:35
|
name |
Type : string
|
Decorators :
@serializable()
|
Inherited from
DynamicFormControlModel
|
Defined in
DynamicFormControlModel:36
|
parent |
Type : DynamicPathable | null
|
Default value : null
|
Inherited from
DynamicFormControlModel
|
Defined in
DynamicFormControlModel:37
|
relations |
Type : DynamicFormControlRelation[]
|
Decorators :
@serializable()
|
Inherited from
DynamicFormControlModel
|
Defined in
DynamicFormControlModel:38
|
Abstract Readonly type |
Type : string
|
Inherited from
DynamicFormControlModel
|
Defined in
DynamicFormControlModel:46
|
updateOn |
Type : DynamicFormHook | null
|
Decorators :
@serializable()
|
Inherited from
DynamicFormControlModel
|
Defined in
DynamicFormControlModel:39
|
validators |
Type : DynamicValidatorsConfig | null
|
Decorators :
@serializable()
|
Inherited from
DynamicFormControlModel
|
Defined in
DynamicFormControlModel:40
|
select | ||||||
select(...indices: number[])
|
||||||
Parameters :
Returns :
void
|
add | ||||||
add(optionConfig: DynamicFormOptionConfig
|
||||||
Inherited from
DynamicOptionControlModel
|
||||||
Defined in
DynamicOptionControlModel:90
|
||||||
Parameters :
Returns :
DynamicFormOption<T>
|
get | ||||||
get(index: number)
|
||||||
Inherited from
DynamicOptionControlModel
|
||||||
Defined in
DynamicOptionControlModel:94
|
||||||
Parameters :
Returns :
DynamicFormOption<T>
|
insert | |||||||||
insert(index: number, optionConfig: DynamicFormOptionConfig
|
|||||||||
Inherited from
DynamicOptionControlModel
|
|||||||||
Defined in
DynamicOptionControlModel:98
|
|||||||||
Parameters :
Returns :
DynamicFormOption<T>
|
remove | ||||||
remove(...indices: number[])
|
||||||
Inherited from
DynamicOptionControlModel
|
||||||
Defined in
DynamicOptionControlModel:108
|
||||||
Parameters :
Returns :
void
|
Abstract select | ||||||
select(...indices: number[])
|
||||||
Inherited from
DynamicOptionControlModel
|
||||||
Defined in
DynamicOptionControlModel:114
|
||||||
Parameters :
Returns :
void
|
Private updateOptions$ |
updateOptions$()
|
Inherited from
DynamicOptionControlModel
|
Defined in
DynamicOptionControlModel:58
|
Returns :
void
|
getAdditional | |||||||||
getAdditional(key: string, defaultValue?: any | null)
|
|||||||||
Inherited from
DynamicOptionControlModel
|
|||||||||
Defined in
DynamicOptionControlModel:50
|
|||||||||
Parameters :
Returns :
any
|
toJSON |
toJSON()
|
Inherited from
DynamicOptionControlModel
|
Defined in
DynamicOptionControlModel:80
|
Returns :
any
|
toJSON |
toJSON()
|
Inherited from
DynamicOptionControlModel
|
Defined in
DynamicOptionControlModel:80
|
Returns :
any
|
getAdditional | |||||||||
getAdditional(key: string, defaultValue?: any | null)
|
|||||||||
Inherited from
DynamicFormValueControlModel
|
|||||||||
Defined in
DynamicFormValueControlModel:50
|
|||||||||
Parameters :
Returns :
any
|
toJSON |
toJSON()
|
Inherited from
DynamicFormValueControlModel
|
Defined in
DynamicFormValueControlModel:80
|
Returns :
any
|
toJSON |
toJSON()
|
Inherited from
DynamicFormControlModel
|
Defined in
DynamicFormControlModel:80
|
Returns :
any
|
import { ɵlooseIdentical as looseIdentical } from "@angular/core";
import { DynamicOptionControlModel, DynamicOptionControlModelConfig } from "../dynamic-option-control.model";
import { DynamicFormControlLayout } from "../misc/dynamic-form-control-layout.model";
import { serializable } from "../../decorator/serializable.decorator";
import { isBoolean, isFunction } from "../../utils/core.utils";
export const DYNAMIC_FORM_CONTROL_TYPE_SELECT = "SELECT";
export interface DynamicSelectModelConfig<T> extends DynamicOptionControlModelConfig<T> {
compareWithFn?: (o1: any, o2: any) => boolean;
filterable?: boolean;
multiple?: boolean;
placeholder?: string;
prefix?: string;
suffix?: string;
}
export class DynamicSelectModel<T> extends DynamicOptionControlModel<T> {
compareWithFn: (value1: any, value2: any) => boolean;
@serializable() filterable: boolean;
@serializable() multiple: boolean;
@serializable() placeholder: string;
@serializable() prefix: string | null;
@serializable() suffix: string | null;
@serializable() readonly type: string = DYNAMIC_FORM_CONTROL_TYPE_SELECT;
constructor(config: DynamicSelectModelConfig<T>, layout?: DynamicFormControlLayout) {
super(config, layout);
this.compareWithFn = isFunction(config.compareWithFn) ? config.compareWithFn : looseIdentical;
this.filterable = isBoolean(config.filterable) ? config.filterable : false;
this.multiple = isBoolean(config.multiple) ? config.multiple : false;
this.placeholder = config.placeholder || "";
this.prefix = config.prefix || null;
this.suffix = config.suffix || null;
}
select(...indices: number[]): void {
this.value = this.multiple ? indices.map(index => this.get(index).value) : this.get(indices[0]).value;
}
}