Skip to content

Commit

Permalink
fix(kit): InputDateMulti fix disableItemHandler (#6947)
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimirpotekhin authored Mar 5, 2024
1 parent c24257c commit 97b2bea
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import {
tuiIsString,
TuiMapper,
TuiMonth,
TuiTypedMapper,
} from '@taiga-ui/cdk';
import {
TUI_DEFAULT_MARKER_HANDLER,
Expand Down Expand Up @@ -191,6 +192,11 @@ export class TuiInputDateMultiComponent
> = handler => stringifiable =>
tuiIsString(stringifiable) || handler(stringifiable.item);

readonly valueMapper: TuiTypedMapper<
[readonly TuiDay[]],
ReadonlyArray<TuiStringifiableItem<TuiDay>>
> = value => value.map(item => new TuiStringifiableItem(item, item => String(item)));

@HostBinding('attr.data-size')
get size(): TuiSizeL | TuiSizeS {
return this.textfieldSize.size;
Expand Down Expand Up @@ -278,14 +284,14 @@ export class TuiInputDateMultiComponent
this.done();
}

onValueChange(value: readonly TuiDay[]): void {
onValueChange(value: ReadonlyArray<TuiStringifiableItem<TuiDay>>): void {
this.control?.updateValueAndValidity({emitEvent: false});

if (!value.length) {
this.onOpenChange(true);
}

this.value = value;
this.value = value.map(({item}) => item);
}

onDayClick(value: TuiDay): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
[inputHidden]="inputHidden"
[maskito]="maskitoOptions"
[nativeId]="nativeId"
[ngModel]="value"
[ngModel]="value | tuiMapper: valueMapper"
[placeholder]="placeholder"
[pseudoFocus]="pseudoFocus"
[pseudoHover]="pseudoHover"
[pseudoInvalid]="computedInvalid"
[readOnly]="readOnly"
[removable]="!nativeDropdownMode"
[rows]="rows"
[tagValidator]="tagValidator"
[tagValidator]="tagValidator | tuiMapper: disabledItemHandlerWrapper"
[tuiTextfieldFiller]="(filler$ | async) || ''"
[tuiTextfieldIcon]="calendarIcon && iconContent"
(keydown.enter)="onEnter(inputTag.search || '')"
Expand Down

0 comments on commit 97b2bea

Please sign in to comment.