Skip to content

Commit

Permalink
chore: apply changes after linting [bot]
Browse files Browse the repository at this point in the history
  • Loading branch information
taiga-family-bot authored and splincode committed Nov 20, 2023
1 parent d891681 commit c274291
Show file tree
Hide file tree
Showing 23 changed files with 48 additions and 103 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import {
TuiDayRange,
TuiDestroyService,
TuiInjectionTokenType,
tuiIsNullish,
TuiMonth,
tuiTypedFromEvent,
TuiTypedMapper,
Expand All @@ -41,9 +40,6 @@ import {
TUI_CHOOSE_DAY_OR_RANGE_TEXTS,
TUI_DONE_WORD,
tuiImmutableUpdateInputDateMulti as updateMultiValue,
tuiIsDay,
tuiIsDayOrNonSingleDayRange,
tuiIsDayRange,
} from '@taiga-ui/kit';
import {identity, MonoTypeOperatorFunction, Observable, race, timer} from 'rxjs';
import {
Expand Down Expand Up @@ -137,7 +133,7 @@ export class TuiMobileCalendarComponent implements AfterViewInit {
@Inject(TUI_SHORT_WEEK_DAYS)
readonly unorderedWeekDays$: TuiInjectionTokenType<typeof TUI_SHORT_WEEK_DAYS>,
@Inject(TUI_CHOOSE_DAY_OR_RANGE_TEXTS)
readonly chooseDayOrRangeTexts$: Observable<[string, string]>,
readonly chooseDayOrRangeTexts$: Observable<[string, string, string]>,
@Inject(TUI_ANIMATIONS_DURATION) private readonly duration: number,
@Inject(NgZone) private readonly ngZone: NgZone,
) {
Expand Down Expand Up @@ -175,11 +171,11 @@ export class TuiMobileCalendarComponent implements AfterViewInit {
this.value = day;
} else if (this.isMultiValue(this.value)) {
this.value = updateMultiValue(this.value, day);
} else if (tuiIsDayOrNonSingleDayRange(this.value)) {
} else if (this.isSingleValue(this.value)) {
this.value = new TuiDayRange(day, day);
} else if (tuiIsDayRange(this.value)) {
} else if (this.value instanceof TuiDayRange) {
this.value = TuiDayRange.sort(this.value.from, day);
} else if (tuiIsNullish(this.value)) {
} else if (!this.value) {
this.value = new TuiDayRange(day, day);
}
}
Expand Down Expand Up @@ -237,8 +233,12 @@ export class TuiMobileCalendarComponent implements AfterViewInit {
(max !== null && item.dayAfter(max)) ||
disabledItemHandler(item);

private isMultiValue(val: any): val is readonly TuiDay[] | undefined {
return !tuiIsDay(val) && !tuiIsDayRange(val) && this.multi;
private isMultiValue(day: any): day is readonly TuiDay[] | undefined {
return !(day instanceof TuiDay) && !(day instanceof TuiDayRange) && this.multi;
}

private isSingleValue(day: any): day is TuiDay {
return day instanceof TuiDay || (day instanceof TuiDayRange && !day.isSingleDay);
}

private get initialYear(): number {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
automation-id="tui-mobile-calendar__label"
class="t-label"
>
{{ single ? texts[0] : texts[1] }}
{{ single ? texts?.[0] : multi ? texts?.[2] : texts?.[1] }}
</h2>
<button
automation-id="tui-mobile-calendar__confirm"
Expand Down Expand Up @@ -73,16 +73,13 @@
*cdkVirtualFor="let month of months; templateCacheSize: 10"
class="t-month-wrapper"
>
<ng-container *ngIf="month | tuiMonth | async as monthTitle">
<h2 class="t-month">{{ monthTitle }}</h2>
<tui-primitive-calendar-mobile
class="t-calendar"
[attr.data-month]="monthTitle | lowercase"
[disabledItemHandler]="disabledItemHandler | tuiMapper: disabledItemHandlerMapper : min : max"
[month]="month"
[value]="value"
(dayClick)="onDayClick($event)"
></tui-primitive-calendar-mobile>
</ng-container>
<h2 class="t-month">{{ month | tuiMonth | async }}</h2>
<tui-primitive-calendar-mobile
class="t-calendar"
[disabledItemHandler]="disabledItemHandler | tuiMapper: disabledItemHandlerMapper : min : max"
[month]="month"
[value]="value"
(dayClick)="onDayClick($event)"
></tui-primitive-calendar-mobile>
</section>
</cdk-virtual-scroll-viewport>
4 changes: 0 additions & 4 deletions projects/cdk/utils/miscellaneous/is-present.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
export function tuiIsPresent<T>(value?: T | null): value is T {
return value !== null && value !== undefined;
}

export function tuiIsNullish<T>(value?: T | null): value is null | undefined {
return !tuiIsPresent(value);
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {TUI_PLAYWRIGHT_MOBILE_USER_AGENT} from '../../../playwright.options';

test.describe(`InputDate and mobile user agent`, () => {
const date = new Date(2023, 10, 1);
const november = '[data-month="november"] .t-cell';
const november = `.t-month-wrapper:nth-child(2) .t-cell`;

test.use({
viewport: {width: 430, height: 932},
Expand All @@ -16,10 +16,10 @@ test.describe(`InputDate and mobile user agent`, () => {
await tuiGoto(page, `components/input-date-range/API`, {date});

await new TuiDocumentationPagePO(page).apiPageExample
.locator('tui-input-date-range .t-icons')
.locator(`tui-input-date-range .t-icons`)
.click();

await page.waitForSelector('tui-dialog', {state: 'visible'});
await page.waitForSelector(`tui-dialog`, {state: `visible`});
await expect(page).toHaveScreenshot(`01-input-date-range-mobile-1.png`);

await page.locator(november).nth(0).click();
Expand All @@ -39,10 +39,10 @@ test.describe(`InputDate and mobile user agent`, () => {
await tuiGoto(page, `components/input-date-multi/API`, {date});

await new TuiDocumentationPagePO(page).apiPageExample
.locator('tui-input-date[multiple] .t-icons')
.locator(`tui-input-date[multiple] .t-icons`)
.click();

await page.waitForSelector('tui-dialog', {state: 'visible'});
await page.waitForSelector(`tui-dialog`, {state: `visible`});
await expect(page).toHaveScreenshot(`02-input-date-range-mobile-1.png`);

await page.locator(november).nth(0).click();
Expand All @@ -69,10 +69,10 @@ test.describe(`InputDate and mobile user agent`, () => {
await tuiGoto(page, `components/input-date/API`, {date});

await new TuiDocumentationPagePO(page).apiPageExample
.locator('tui-input-date .t-icons')
.locator(`tui-input-date .t-icons`)
.click();

await page.waitForSelector('tui-dialog', {state: 'visible'});
await page.waitForSelector(`tui-dialog`, {state: `visible`});
await expect(page).toHaveScreenshot(`03-input-date-range-mobile-1.png`);

await page.locator(november).nth(0).click();
Expand Down
4 changes: 2 additions & 2 deletions projects/i18n/interfaces/language.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ export interface TuiLanguageKit {
maxSizeRejectionReason: string;
};
/**
* [@string 'choose day', @param 'choose range']
* [@string 'choose day', @param 'choose range', @param 'choose days']
*/
mobileCalendarTexts: [string, string];
mobileCalendarTexts: [string, string, string];
more: string;
multiSelectTexts: {
all: string;
Expand Down
2 changes: 1 addition & 1 deletion projects/i18n/languages/chinese/kit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const TUI_CHINESE_LANGUAGE_KIT: TuiLanguageKit = {
otherDate: `其他日期...`,
showAll: `显示所有`,
hide: `隐藏`,
mobileCalendarTexts: [`选择日期`, `选择范围`],
mobileCalendarTexts: [`选择日期`, `选择范围`, `選擇日期`],
range: [`从`, `至`],
countTexts: [`加`, `减`],
time: {
Expand Down
2 changes: 1 addition & 1 deletion projects/i18n/languages/dutch/kit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const TUI_DUTCH_LANGUAGE_KIT: TuiLanguageKit = {
otherDate: `Andere datum ...`,
showAll: `Show all`,
hide: `Hide`,
mobileCalendarTexts: [`Kies een dag`, `Kies bereik`],
mobileCalendarTexts: [`Kies een dag`, `Kies bereik`, `Kies dagen`],
range: [`van`, `tot`],
countTexts: [`Plus`, `Min`],
time: {
Expand Down
2 changes: 1 addition & 1 deletion projects/i18n/languages/english/kit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const TUI_ENGLISH_LANGUAGE_KIT: TuiLanguageKit = {
otherDate: `Other date...`,
showAll: `Show all`,
hide: `Hide`,
mobileCalendarTexts: [`Choose day`, `Choose range`],
mobileCalendarTexts: [`Choose day`, `Choose range`, `Choose days`],
range: [`from`, `to`],
countTexts: [`Plus`, `Minus`],
time: {
Expand Down
6 changes: 5 additions & 1 deletion projects/i18n/languages/french/kit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ export const TUI_FRENCH_LANGUAGE_KIT: TuiLanguageKit = {
otherDate: `Autre date...`,
showAll: `Tout afficher`,
hide: `Cacher`,
mobileCalendarTexts: [`Choisir un jour`, `Choisir un intervalle`],
mobileCalendarTexts: [
`Choisir un jour`,
`Choisir un intervalle`,
`Choisissez des jours`,
],
range: [`De`, `À`],
countTexts: [`Plus`, `Moins`],
time: {
Expand Down
2 changes: 1 addition & 1 deletion projects/i18n/languages/german/kit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const TUI_GERMAN_LANGUAGE_KIT: TuiLanguageKit = {
otherDate: `Anderes Datum...`,
showAll: `Show all`,
hide: `Hide`,
mobileCalendarTexts: [`Tag auswählen`, `Zeitraum auswählen`],
mobileCalendarTexts: [`Tag auswählen`, `Zeitraum auswählen`, `Wählen Sie Tage`],
range: [`von`, `bis`],
countTexts: [`Plus`, `Minus`],
time: {
Expand Down
2 changes: 1 addition & 1 deletion projects/i18n/languages/italian/kit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const TUI_ITALIAN_LANGUAGE_KIT: TuiLanguageKit = {
otherDate: `Altra data...`,
showAll: `Show all`,
hide: `Hide`,
mobileCalendarTexts: [`Scegli giorno`, `Scegli intervallo`],
mobileCalendarTexts: [`Scegli giorno`, `Scegli intervallo`, `Scegli i giorni`],
range: [`da`, `a`],
countTexts: [`Più`, `Meno`],
time: {
Expand Down
2 changes: 1 addition & 1 deletion projects/i18n/languages/kazakh/kit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const TUI_KAZAKH_LANGUAGE_KIT: TuiLanguageKit = {
otherDate: `Басқа күн...`,
showAll: `Барлығын көрсету`,
hide: `Жасыру`,
mobileCalendarTexts: [`Күнді таңдаңыз`, `Аралықты таңдаңыз`],
mobileCalendarTexts: [`Күнді таңдаңыз`, `Аралықты таңдаңыз`, `Күндерді таңдаңыз`],
range: [`бастап`, `дейін`],
countTexts: [`Плюс`, `Минус`],
time: {
Expand Down
2 changes: 1 addition & 1 deletion projects/i18n/languages/polish/kit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const TUI_POLISH_LANGUAGE_KIT: TuiLanguageKit = {
otherDate: `Inna data...`,
showAll: `Show all`,
hide: `Hide`,
mobileCalendarTexts: [`Wybierz dzień`, `Wybierz zakres`],
mobileCalendarTexts: [`Wybierz dzień`, `Wybierz zakres`, `Wybierz dni`],
range: [`od`, `do`],
countTexts: [`Plus`, `Minus`],
time: {
Expand Down
2 changes: 1 addition & 1 deletion projects/i18n/languages/portuguese/kit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const TUI_PORTUGUESE_LANGUAGE_KIT: TuiLanguageKit = {
otherDate: `Outra data...`,
showAll: `Show all`,
hide: `Hide`,
mobileCalendarTexts: [`Escolha o dia`, `Escolha o intervalo`],
mobileCalendarTexts: [`Escolha o dia`, `Escolha o intervalo`, `Escolha os dias`],
range: [`de`, `para`],
countTexts: [`Mais`, `Menos`],
time: {
Expand Down
2 changes: 1 addition & 1 deletion projects/i18n/languages/russian/kit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const TUI_RUSSIAN_LANGUAGE_KIT: TuiLanguageKit = {
otherDate: `Другая дата...`,
showAll: `Показать все`,
hide: `Скрыть`,
mobileCalendarTexts: [`Выберите день`, `Выберите период`],
mobileCalendarTexts: [`Выберите день`, `Выберите период`, `Выбрать дни`],
range: [`от`, `до`],
countTexts: [`Плюс`, `Минус`],
time: {
Expand Down
2 changes: 1 addition & 1 deletion projects/i18n/languages/spanish/kit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const TUI_SPANISH_LANGUAGE_KIT: TuiLanguageKit = {
otherDate: `Otra fecha...`,
showAll: `Show all`,
hide: `Hide`,
mobileCalendarTexts: [`Seleccione el día`, `Seleccione un rango`],
mobileCalendarTexts: [`Seleccione el día`, `Seleccione un rango`, `Elige días`],
range: [`desde`, `hasta`],
countTexts: [`Más`, `Menos`],
time: {
Expand Down
2 changes: 1 addition & 1 deletion projects/i18n/languages/turkish/kit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const TUI_TURKISH_LANGUAGE_KIT: TuiLanguageKit = {
otherDate: `Farklı bir tarih...`,
showAll: `Show all`,
hide: `Hide`,
mobileCalendarTexts: [`Gün seç`, `Aralık seç`],
mobileCalendarTexts: [`Gün seç`, `Aralık seç`, `Günleri seçin`],
range: [`dan`, `a`],
countTexts: [`Artı`, `Eksi`],
time: {
Expand Down
2 changes: 1 addition & 1 deletion projects/i18n/languages/ukrainian/kit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const TUI_UKRAINIAN_LANGUAGE_KIT: TuiLanguageKit = {
otherDate: `Інша дата ...`,
showAll: `Show all`,
hide: `Hide`,
mobileCalendarTexts: [`Виберіть день`, `Виберіть період`],
mobileCalendarTexts: [`Виберіть день`, `Виберіть період`, `Виберіть дні`],
range: [`від`, `до`],
countTexts: [`Плюс`, `Мінус`],
time: {
Expand Down
2 changes: 1 addition & 1 deletion projects/i18n/languages/vietnamese/kit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const TUI_VIETNAMESE_LANGUAGE_KIT: TuiLanguageKit = {
otherDate: `Ngày khác...`,
showAll: `Hiển thị tất cả`,
hide: `Ẩn`,
mobileCalendarTexts: [`Chọn ngày`, `Chọn phạm vi`],
mobileCalendarTexts: [`Chọn ngày`, `Chọn phạm vi`, `Chọn ngày`],
range: [`từ`, `đến`],
countTexts: [`Cộng`, `Trừ`],
time: {
Expand Down
2 changes: 1 addition & 1 deletion projects/kit/utils/date/asserts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ export function tuiIsDayRange(day: any): day is TuiDayRange {
}

export function tuiIsDayOrNonSingleDayRange(day: any): day is TuiDayRange {
return tuiIsDay(day) || (tuiIsDayRange(day) && !day.isSingleDay);
return day instanceof TuiDay || (day instanceof TuiDayRange && !day.isSingleDay);
}
1 change: 0 additions & 1 deletion projects/kit/utils/date/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export * from './asserts';
export * from './update';
51 changes: 0 additions & 51 deletions projects/kit/utils/date/test/asserts.spec.ts

This file was deleted.

2 changes: 1 addition & 1 deletion projects/kit/utils/date/update.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {TuiDay} from '@taiga-ui/cdk';

export function tuiImmutableUpdateInputDateMulti(
value: readonly TuiDay[] | undefined,
value: readonly TuiDay[] = [],
day: TuiDay,
): readonly TuiDay[] {
const days = value ?? [];
Expand Down

0 comments on commit c274291

Please sign in to comment.