@taiga-ui/addon-mobile 4.52.0-canary.c107f6a → 4.52.0-canary.c8448e0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/components/bottom-sheet/bottom-sheet.component.d.ts +3 -3
- package/components/index.d.ts +0 -1
- package/components/mobile-calendar/calendar-date-stream.d.ts +6 -0
- package/components/mobile-calendar/index.d.ts +1 -0
- package/components/mobile-calendar/mobile-calendar.component.d.ts +16 -18
- package/components/mobile-calendar/mobile-calendar.strategy.d.ts +3 -7
- package/components/mobile-calendar-dropdown/mobile-calendar-dropdown.component.d.ts +10 -12
- package/components/mobile-calendar-dropdown/mobile-calendar-dropdown.directive.d.ts +6 -6
- package/components/pull-to-refresh/pull-to-refresh.component.d.ts +8 -7
- package/components/sheet-dialog/sheet-dialog.component.d.ts +2 -2
- package/components/sheet-dialog/sheet-dialog.options.d.ts +3 -9
- package/components/sheet-dialog/sheet-dialog.service.d.ts +2 -2
- package/components/swipe-action/swipe-actions-auto-close.directive.d.ts +2 -2
- package/components/tab-bar/tab-bar-item.component.d.ts +3 -3
- package/components/tab-bar/tab-bar.component.d.ts +4 -7
- package/directives/dropdown-mobile/dropdown-mobile.component.d.ts +1 -1
- package/directives/dropdown-sheet/dropdown-sheet.component.d.ts +1 -1
- package/directives/elastic-sticky/elastic-sticky.directive.d.ts +1 -2
- package/directives/responsive-dialog/responsive-dialog.directive.d.ts +5 -4
- package/directives/responsive-dialog/responsive-dialog.service.d.ts +4 -7
- package/directives/ripple/ripple.directive.d.ts +2 -2
- package/directives/touchable/touchable.directive.d.ts +5 -5
- package/fesm2022/taiga-ui-addon-mobile-components-bottom-sheet.mjs +15 -22
- package/fesm2022/taiga-ui-addon-mobile-components-bottom-sheet.mjs.map +1 -1
- package/fesm2022/taiga-ui-addon-mobile-components-mobile-calendar-dropdown.mjs +32 -53
- package/fesm2022/taiga-ui-addon-mobile-components-mobile-calendar-dropdown.mjs.map +1 -1
- package/fesm2022/taiga-ui-addon-mobile-components-mobile-calendar-sheet.mjs +7 -9
- package/fesm2022/taiga-ui-addon-mobile-components-mobile-calendar-sheet.mjs.map +1 -1
- package/fesm2022/taiga-ui-addon-mobile-components-mobile-calendar.mjs +119 -152
- package/fesm2022/taiga-ui-addon-mobile-components-mobile-calendar.mjs.map +1 -1
- package/fesm2022/taiga-ui-addon-mobile-components-pull-to-refresh.mjs +42 -53
- package/fesm2022/taiga-ui-addon-mobile-components-pull-to-refresh.mjs.map +1 -1
- package/fesm2022/taiga-ui-addon-mobile-components-sheet-dialog.mjs +27 -37
- package/fesm2022/taiga-ui-addon-mobile-components-sheet-dialog.mjs.map +1 -1
- package/fesm2022/taiga-ui-addon-mobile-components-swipe-action.mjs +12 -19
- package/fesm2022/taiga-ui-addon-mobile-components-swipe-action.mjs.map +1 -1
- package/fesm2022/taiga-ui-addon-mobile-components-tab-bar.mjs +31 -50
- package/fesm2022/taiga-ui-addon-mobile-components-tab-bar.mjs.map +1 -1
- package/fesm2022/taiga-ui-addon-mobile-components.mjs +0 -1
- package/fesm2022/taiga-ui-addon-mobile-components.mjs.map +1 -1
- package/fesm2022/taiga-ui-addon-mobile-directives-dropdown-mobile.mjs +8 -8
- package/fesm2022/taiga-ui-addon-mobile-directives-dropdown-mobile.mjs.map +1 -1
- package/fesm2022/taiga-ui-addon-mobile-directives-dropdown-sheet.mjs +9 -9
- package/fesm2022/taiga-ui-addon-mobile-directives-dropdown-sheet.mjs.map +1 -1
- package/fesm2022/taiga-ui-addon-mobile-directives-elastic-sticky.mjs +11 -14
- package/fesm2022/taiga-ui-addon-mobile-directives-elastic-sticky.mjs.map +1 -1
- package/fesm2022/taiga-ui-addon-mobile-directives-responsive-dialog.mjs +44 -26
- package/fesm2022/taiga-ui-addon-mobile-directives-responsive-dialog.mjs.map +1 -1
- package/fesm2022/taiga-ui-addon-mobile-directives-ripple.mjs +10 -12
- package/fesm2022/taiga-ui-addon-mobile-directives-ripple.mjs.map +1 -1
- package/fesm2022/taiga-ui-addon-mobile-directives-touchable.mjs +18 -24
- package/fesm2022/taiga-ui-addon-mobile-directives-touchable.mjs.map +1 -1
- package/fesm2022/taiga-ui-addon-mobile-services.mjs +34 -5
- package/fesm2022/taiga-ui-addon-mobile-services.mjs.map +1 -1
- package/package.json +1 -5
- package/services/index.d.ts +1 -0
- package/services/theme-color.service.d.ts +18 -0
- package/styles/android/app-bar.less +5 -1
- package/styles/android/switch.less +1 -0
- package/styles/common/badge-notification.less +1 -1
- package/styles/common/badge.less +2 -2
- package/styles/common/block-status.less +1 -1
- package/styles/common/button.less +1 -1
- package/styles/common/card-large.less +1 -1
- package/styles/common/header.less +1 -1
- package/styles/common/message.less +1 -1
- package/styles/common/segmented.less +1 -1
- package/styles/common/title.less +0 -1
- package/styles/common/toast.less +1 -1
- package/styles/ios/switch.less +50 -1
- package/styles/taiga-ui-mobile.less +6 -0
- package/components/mobile-dialog/index.d.ts +0 -3
- package/components/mobile-dialog/mobile-dialog.component.d.ts +0 -10
- package/components/mobile-dialog/mobile-dialog.options.d.ts +0 -12
- package/components/mobile-dialog/mobile-dialog.service.d.ts +0 -10
- package/fesm2022/taiga-ui-addon-mobile-components-mobile-dialog.mjs +0 -64
- package/fesm2022/taiga-ui-addon-mobile-components-mobile-dialog.mjs.map +0 -1
|
@@ -1,28 +1,41 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { InjectionToken, Optional, Self, inject, viewChild, DestroyRef, NgZone, computed, input, output, model, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import { NgControl } from '@angular/forms';
|
|
4
|
+
import { tuiControlValue, tuiWatch, tuiZonefreeScheduler, tuiZonefree, tuiTypedFromEvent } from '@taiga-ui/cdk/observables';
|
|
5
|
+
import { of, map, Subject, distinctUntilChanged, EMPTY, timer, identity, delay, take, windowToggle, mergeMap, filter, switchMap, race, debounceTime, takeUntil } from 'rxjs';
|
|
1
6
|
import { VIRTUAL_SCROLL_STRATEGY, CdkFixedSizeVirtualScroll, CdkVirtualForOf, CdkVirtualScrollViewport } from '@angular/cdk/scrolling';
|
|
2
7
|
import { DOCUMENT, AsyncPipe } from '@angular/common';
|
|
3
|
-
import * as i0 from '@angular/core';
|
|
4
|
-
import { InjectionToken, Optional, inject, DestroyRef, NgZone, EventEmitter, Input, Output, ViewChild, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
5
8
|
import { takeUntilDestroyed, toObservable } from '@angular/core/rxjs-interop';
|
|
6
9
|
import { TuiMobileCalendarSheet } from '@taiga-ui/addon-mobile/components/mobile-calendar-sheet';
|
|
7
|
-
import { TuiRipple
|
|
10
|
+
import { TuiRipple } from '@taiga-ui/addon-mobile/directives/ripple';
|
|
11
|
+
import { TuiTouchable } from '@taiga-ui/addon-mobile/directives/touchable';
|
|
8
12
|
import { TUI_FALSE_HANDLER } from '@taiga-ui/cdk/constants';
|
|
9
|
-
import { MONTHS_IN_YEAR, TuiDay, TuiMonth, TUI_FIRST_DAY, TUI_LAST_DAY
|
|
10
|
-
import { tuiWatch, tuiZonefreeScheduler, tuiZonefree, tuiTypedFromEvent } from '@taiga-ui/cdk/observables';
|
|
13
|
+
import { MONTHS_IN_YEAR, TuiDay, TuiDayRange, TuiMonth, TUI_FIRST_DAY, TUI_LAST_DAY } from '@taiga-ui/cdk/date-time';
|
|
11
14
|
import { TuiMapperPipe } from '@taiga-ui/cdk/pipes/mapper';
|
|
12
15
|
import { TUI_IS_IOS, TUI_IS_E2E } from '@taiga-ui/cdk/tokens';
|
|
13
16
|
import { TuiButton } from '@taiga-ui/core/components/button';
|
|
14
|
-
import { TUI_CALENDAR_SHEET_OPTIONS } from '@taiga-ui/core/components/calendar';
|
|
17
|
+
import { TUI_CALENDAR_SHEET_OPTIONS, TuiOrderWeekDaysPipe } from '@taiga-ui/core/components/calendar';
|
|
15
18
|
import { TuiLink } from '@taiga-ui/core/components/link';
|
|
16
|
-
import {
|
|
17
|
-
import { TuiOrderWeekDaysPipe } from '@taiga-ui/core/pipes/order-week-days';
|
|
18
|
-
import { TUI_ANIMATIONS_SPEED, TUI_COMMON_ICONS, TUI_CLOSE_WORD, TUI_SHORT_WEEK_DAYS } from '@taiga-ui/core/tokens';
|
|
19
|
+
import { TUI_ANIMATIONS_SPEED, TUI_COMMON_ICONS, TUI_CLOSE_WORD, TUI_MONTHS, TUI_SHORT_WEEK_DAYS } from '@taiga-ui/core/tokens';
|
|
19
20
|
import { tuiGetDuration } from '@taiga-ui/core/utils/miscellaneous';
|
|
20
|
-
import {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
import { TUI_CANCEL_WORD, TUI_DONE_WORD, TUI_CHOOSE_DAY_OR_RANGE_TEXTS } from '@taiga-ui/kit/tokens';
|
|
22
|
+
|
|
23
|
+
const TUI_CALENDAR_DATE_STREAM = new InjectionToken(ngDevMode ? 'TUI_CALENDAR_DATE_STREAM' : '');
|
|
24
|
+
function tuiDateStreamWithTransformer(transformer) {
|
|
25
|
+
return {
|
|
26
|
+
provide: TUI_CALENDAR_DATE_STREAM,
|
|
27
|
+
deps: [
|
|
28
|
+
[new Optional(), new Self(), NgControl],
|
|
29
|
+
[new Optional(), transformer],
|
|
30
|
+
],
|
|
31
|
+
useFactory: tuiControlValueFactory,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function tuiControlValueFactory(control, transformer) {
|
|
35
|
+
return control
|
|
36
|
+
? tuiControlValue(control).pipe(map((value) => transformer ? transformer?.fromControlValue(value) : value))
|
|
37
|
+
: of(null);
|
|
38
|
+
}
|
|
26
39
|
|
|
27
40
|
function getCycle(options) {
|
|
28
41
|
return Array.from({ length: options.yearCycle }, (_, i) => Array.from({ length: MONTHS_IN_YEAR }, (_, month) => options.label +
|
|
@@ -70,20 +83,17 @@ function reduceCycle(cycle, lastYear = 28, lastMonth = 12) {
|
|
|
70
83
|
: total, 0);
|
|
71
84
|
}
|
|
72
85
|
/**
|
|
73
|
-
* This scroll strategy is hard
|
|
86
|
+
* This scroll strategy is hard-wired with styles for iOS and Android.
|
|
74
87
|
* It is dependent on month height on those platforms and is designed to
|
|
75
88
|
* work for {@link TuiMobileCalendar} with years 1906 to 2102
|
|
76
89
|
*/
|
|
77
90
|
class TuiMobileCalendarStrategy {
|
|
78
|
-
constructor(
|
|
79
|
-
this.isIOS =
|
|
80
|
-
this.
|
|
91
|
+
constructor() {
|
|
92
|
+
this.isIOS = inject(TUI_IS_IOS);
|
|
93
|
+
this.destroy$ = new Subject();
|
|
81
94
|
this.index$ = new Subject();
|
|
82
95
|
this.viewport = null;
|
|
83
|
-
this.
|
|
84
|
-
}
|
|
85
|
-
get scrolledIndexChange() {
|
|
86
|
-
return this.index$.pipe(distinctUntilChanged());
|
|
96
|
+
this.scrolledIndexChange = this.index$.pipe(distinctUntilChanged());
|
|
87
97
|
}
|
|
88
98
|
attach(viewport) {
|
|
89
99
|
const cycle = this.isIOS ? IOS_CYCLE_HEIGHT : ANDROID_CYCLE_HEIGHT;
|
|
@@ -107,18 +117,7 @@ class TuiMobileCalendarStrategy {
|
|
|
107
117
|
onContentRendered() { }
|
|
108
118
|
onRenderedOffsetChanged() { }
|
|
109
119
|
scrollToIndex(index, behavior) {
|
|
110
|
-
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
const scrollTop = this.getOffsetForIndex(index);
|
|
114
|
-
if (behavior !== 'smooth') {
|
|
115
|
-
this.viewport.scrollToOffset(scrollTop, behavior);
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
this.scrollService
|
|
119
|
-
.scroll$(this.viewport.elementRef.nativeElement, scrollTop)
|
|
120
|
-
.pipe(takeUntil(this.destroy$))
|
|
121
|
-
.subscribe();
|
|
120
|
+
this.viewport?.scrollToOffset(this.getOffsetForIndex(index), behavior);
|
|
122
121
|
}
|
|
123
122
|
getOffsetForIndex(index) {
|
|
124
123
|
const month = index % MONTHS_IN_YEAR;
|
|
@@ -175,19 +174,14 @@ class TuiMobileCalendarStrategy {
|
|
|
175
174
|
this.index$.next(firstVisibleIndex);
|
|
176
175
|
}
|
|
177
176
|
}
|
|
178
|
-
__decorate([
|
|
179
|
-
tuiPure
|
|
180
|
-
], TuiMobileCalendarStrategy.prototype, "scrolledIndexChange", null);
|
|
181
177
|
|
|
182
178
|
/**
|
|
183
179
|
* Stream for updating value
|
|
184
180
|
*/
|
|
185
181
|
const TUI_VALUE_STREAM = new InjectionToken(ngDevMode ? 'TUI_VALUE_STREAM' : '');
|
|
186
182
|
const TUI_MOBILE_CALENDAR_PROVIDERS = [
|
|
187
|
-
TuiScrollService,
|
|
188
183
|
{
|
|
189
184
|
provide: VIRTUAL_SCROLL_STRATEGY,
|
|
190
|
-
deps: [TUI_IS_IOS, TuiScrollService],
|
|
191
185
|
useClass: TuiMobileCalendarStrategy,
|
|
192
186
|
},
|
|
193
187
|
{
|
|
@@ -199,7 +193,8 @@ const TUI_MOBILE_CALENDAR_PROVIDERS = [
|
|
|
199
193
|
|
|
200
194
|
class TuiMobileCalendar {
|
|
201
195
|
constructor() {
|
|
202
|
-
this.
|
|
196
|
+
this.yearsScroll = viewChild('yearsScroll');
|
|
197
|
+
this.monthsScroll = viewChild('monthsScroll');
|
|
203
198
|
this.today = TuiDay.currentLocal();
|
|
204
199
|
this.activeYear = 0;
|
|
205
200
|
this.activeMonth = 0;
|
|
@@ -207,6 +202,32 @@ class TuiMobileCalendar {
|
|
|
207
202
|
this.doc = inject(DOCUMENT);
|
|
208
203
|
this.speed = inject(TUI_ANIMATIONS_SPEED);
|
|
209
204
|
this.ngZone = inject(NgZone);
|
|
205
|
+
this.getYearsViewportSize = computed(() => this.yearsScroll()?.getViewportSize() || 0);
|
|
206
|
+
this.initialYear = computed((value = this.value()) => {
|
|
207
|
+
if (!value) {
|
|
208
|
+
return this.today.year;
|
|
209
|
+
}
|
|
210
|
+
if (value instanceof TuiDay) {
|
|
211
|
+
return value.year;
|
|
212
|
+
}
|
|
213
|
+
if (!(value instanceof TuiDayRange)) {
|
|
214
|
+
return value?.[0]?.year ?? this.today.year;
|
|
215
|
+
}
|
|
216
|
+
return value.to.year;
|
|
217
|
+
});
|
|
218
|
+
this.initialMonth = computed((value = this.value()) => {
|
|
219
|
+
if (!value) {
|
|
220
|
+
return this.today.month + (this.today.year - STARTING_YEAR) * MONTHS_IN_YEAR;
|
|
221
|
+
}
|
|
222
|
+
if (value instanceof TuiDay) {
|
|
223
|
+
return value.month + (value.year - STARTING_YEAR) * MONTHS_IN_YEAR;
|
|
224
|
+
}
|
|
225
|
+
if (!(value instanceof TuiDayRange)) {
|
|
226
|
+
return ((value?.[0]?.month ?? this.today.month) +
|
|
227
|
+
((value?.[0]?.year ?? this.today.year) - STARTING_YEAR) * MONTHS_IN_YEAR);
|
|
228
|
+
}
|
|
229
|
+
return value.to.month + (value.to.year - STARTING_YEAR) * MONTHS_IN_YEAR;
|
|
230
|
+
});
|
|
210
231
|
this.initialized = false;
|
|
211
232
|
this.isIOS = inject(TUI_IS_IOS);
|
|
212
233
|
this.isE2E = inject(TUI_IS_E2E);
|
|
@@ -214,6 +235,7 @@ class TuiMobileCalendar {
|
|
|
214
235
|
this.closeWord = inject(TUI_CLOSE_WORD);
|
|
215
236
|
this.cancelWord = inject(TUI_CANCEL_WORD);
|
|
216
237
|
this.doneWord = inject(TUI_DONE_WORD);
|
|
238
|
+
this.monthNames = inject(TUI_MONTHS);
|
|
217
239
|
this.unorderedWeekDays$ = toObservable(inject(TUI_SHORT_WEEK_DAYS));
|
|
218
240
|
this.chooseDayOrRangeTexts = inject(TUI_CHOOSE_DAY_OR_RANGE_TEXTS, {
|
|
219
241
|
optional: true,
|
|
@@ -227,34 +249,26 @@ class TuiMobileCalendar {
|
|
|
227
249
|
* ```
|
|
228
250
|
* TODO(v5): delete it
|
|
229
251
|
*/
|
|
230
|
-
this.single = !inject(TUI_CALENDAR_SHEET_OPTIONS).rangeMode;
|
|
231
|
-
this.multi = false;
|
|
232
|
-
this.min = TUI_FIRST_DAY;
|
|
233
|
-
this.max = TUI_LAST_DAY;
|
|
234
|
-
this.disabledItemHandler = TUI_FALSE_HANDLER;
|
|
235
|
-
this.cancel =
|
|
236
|
-
this.confirm =
|
|
237
|
-
this.
|
|
252
|
+
this.single = input(!inject(TUI_CALENDAR_SHEET_OPTIONS).rangeMode);
|
|
253
|
+
this.multi = input(false);
|
|
254
|
+
this.min = input(TUI_FIRST_DAY);
|
|
255
|
+
this.max = input(TUI_LAST_DAY);
|
|
256
|
+
this.disabledItemHandler = input(TUI_FALSE_HANDLER);
|
|
257
|
+
this.cancel = output();
|
|
258
|
+
this.confirm = output();
|
|
259
|
+
this.value = model(null);
|
|
238
260
|
this.disabledItemHandlerMapper = (disabledItemHandler, min, max) => (item) => item.dayBefore(min) ||
|
|
239
261
|
(max !== null && item.dayAfter(max)) ||
|
|
240
262
|
disabledItemHandler(item);
|
|
241
263
|
inject(TUI_VALUE_STREAM)
|
|
242
264
|
.pipe(takeUntilDestroyed())
|
|
243
265
|
.subscribe((value) => {
|
|
244
|
-
this.value
|
|
266
|
+
this.value.set(value);
|
|
245
267
|
});
|
|
246
268
|
}
|
|
247
|
-
set value(value) {
|
|
248
|
-
if (value !== undefined) {
|
|
249
|
-
this.value$.next(value);
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
get value() {
|
|
253
|
-
return this.value$.value;
|
|
254
|
-
}
|
|
255
269
|
ngAfterViewInit() {
|
|
256
|
-
this.activeYear = this.initialYear;
|
|
257
|
-
this.activeMonth = this.initialMonth;
|
|
270
|
+
this.activeYear = this.initialYear();
|
|
271
|
+
this.activeMonth = this.initialMonth();
|
|
258
272
|
// Virtual scroll has not yet rendered items even in ngAfterViewInit
|
|
259
273
|
this.waitScrolledChange();
|
|
260
274
|
}
|
|
@@ -276,28 +290,30 @@ class TuiMobileCalendar {
|
|
|
276
290
|
this.cancel.emit();
|
|
277
291
|
}
|
|
278
292
|
onConfirm() {
|
|
279
|
-
|
|
280
|
-
|
|
293
|
+
const value = this.value();
|
|
294
|
+
if (value) {
|
|
295
|
+
this.confirm.emit(value);
|
|
281
296
|
}
|
|
282
297
|
else {
|
|
283
298
|
this.cancel.emit();
|
|
284
299
|
}
|
|
285
300
|
}
|
|
286
301
|
onDayClick(day) {
|
|
287
|
-
|
|
288
|
-
|
|
302
|
+
const value = this.value();
|
|
303
|
+
if (this.single()) {
|
|
304
|
+
this.value.set(day);
|
|
289
305
|
}
|
|
290
|
-
else if (this.isMultiValue(
|
|
291
|
-
this.value
|
|
306
|
+
else if (this.isMultiValue(value)) {
|
|
307
|
+
this.value.set(toggleDay(value, day));
|
|
292
308
|
}
|
|
293
|
-
else if (
|
|
294
|
-
this.value
|
|
309
|
+
else if (value instanceof TuiDay) {
|
|
310
|
+
this.value.set(TuiDayRange.sort(value, day));
|
|
295
311
|
}
|
|
296
|
-
else if (
|
|
297
|
-
this.value
|
|
312
|
+
else if (value instanceof TuiDayRange) {
|
|
313
|
+
this.value.set(day);
|
|
298
314
|
}
|
|
299
|
-
else if (!
|
|
300
|
-
this.value
|
|
315
|
+
else if (!value) {
|
|
316
|
+
this.value.set(day);
|
|
301
317
|
}
|
|
302
318
|
}
|
|
303
319
|
getState(index) {
|
|
@@ -322,49 +338,20 @@ class TuiMobileCalendar {
|
|
|
322
338
|
this.activeYear = activeYear;
|
|
323
339
|
this.scrollToActiveYear();
|
|
324
340
|
}
|
|
325
|
-
get initialYear() {
|
|
326
|
-
if (!this.value) {
|
|
327
|
-
return this.today.year;
|
|
328
|
-
}
|
|
329
|
-
if (this.value instanceof TuiDay) {
|
|
330
|
-
return this.value.year;
|
|
331
|
-
}
|
|
332
|
-
if (!(this.value instanceof TuiDayRange)) {
|
|
333
|
-
return this.value?.[0]?.year ?? this.today.year;
|
|
334
|
-
}
|
|
335
|
-
return this.value.to.year;
|
|
336
|
-
}
|
|
337
|
-
get initialMonth() {
|
|
338
|
-
if (!this.value) {
|
|
339
|
-
return this.today.month + (this.today.year - STARTING_YEAR) * MONTHS_IN_YEAR;
|
|
340
|
-
}
|
|
341
|
-
if (this.value instanceof TuiDay) {
|
|
342
|
-
return this.value.month + (this.value.year - STARTING_YEAR) * MONTHS_IN_YEAR;
|
|
343
|
-
}
|
|
344
|
-
if (!(this.value instanceof TuiDayRange)) {
|
|
345
|
-
return ((this.value?.[0]?.month ?? this.today.month) +
|
|
346
|
-
((this.value?.[0]?.year ?? this.today.year) - STARTING_YEAR) *
|
|
347
|
-
MONTHS_IN_YEAR);
|
|
348
|
-
}
|
|
349
|
-
return (this.value.to.month + (this.value.to.year - STARTING_YEAR) * MONTHS_IN_YEAR);
|
|
350
|
-
}
|
|
351
341
|
isMultiValue(day) {
|
|
352
|
-
return !(day instanceof TuiDay) && !(day instanceof TuiDayRange) && this.multi;
|
|
353
|
-
}
|
|
354
|
-
getYearsViewportSize() {
|
|
355
|
-
return this.yearsScrollRef?.getViewportSize() || 0;
|
|
342
|
+
return !(day instanceof TuiDay) && !(day instanceof TuiDayRange) && this.multi();
|
|
356
343
|
}
|
|
357
344
|
updateViewportDimension() {
|
|
358
|
-
this.
|
|
359
|
-
this.
|
|
345
|
+
this.yearsScroll()?.checkViewportSize();
|
|
346
|
+
this.monthsScroll()?.checkViewportSize();
|
|
360
347
|
}
|
|
361
348
|
lateInit() {
|
|
362
349
|
return this.getYearsViewportSize() > 0 ? identity : delay(200);
|
|
363
350
|
}
|
|
364
351
|
waitScrolledChange() {
|
|
365
352
|
this.updateViewportDimension();
|
|
366
|
-
this.
|
|
367
|
-
.pipe(delay(tuiGetDuration(this.speed)), this.lateInit(), take(1), takeUntilDestroyed(this.destroyRef))
|
|
353
|
+
this.monthsScroll()
|
|
354
|
+
?.scrolledIndexChange.pipe(delay(tuiGetDuration(this.speed)), this.lateInit(), take(1), takeUntilDestroyed(this.destroyRef))
|
|
368
355
|
.subscribe(() => {
|
|
369
356
|
this.initialized = true;
|
|
370
357
|
this.updateViewportDimension();
|
|
@@ -375,21 +362,21 @@ class TuiMobileCalendar {
|
|
|
375
362
|
});
|
|
376
363
|
}
|
|
377
364
|
initYearScroll() {
|
|
378
|
-
const
|
|
379
|
-
if (!
|
|
365
|
+
const yearsScroll = this.yearsScroll();
|
|
366
|
+
if (!yearsScroll) {
|
|
380
367
|
return;
|
|
381
368
|
}
|
|
382
|
-
const touchstart$ = tuiTypedFromEvent(
|
|
383
|
-
const touchend$ = tuiTypedFromEvent(
|
|
384
|
-
const click$ = tuiTypedFromEvent(
|
|
369
|
+
const touchstart$ = tuiTypedFromEvent(yearsScroll.elementRef.nativeElement, 'touchstart', { passive: true });
|
|
370
|
+
const touchend$ = tuiTypedFromEvent(yearsScroll.elementRef.nativeElement, 'touchend', { passive: true });
|
|
371
|
+
const click$ = tuiTypedFromEvent(yearsScroll.elementRef.nativeElement, 'click');
|
|
385
372
|
// Refresh activeYear
|
|
386
|
-
|
|
373
|
+
yearsScroll
|
|
387
374
|
.elementScrolled()
|
|
388
375
|
.pipe(
|
|
389
376
|
// Ignore smooth scroll resulting from click on the exact year
|
|
390
377
|
windowToggle(touchstart$, () => click$), mergeMap((x) => x),
|
|
391
378
|
// Delay is required to run months scroll in the next frame to prevent flicker
|
|
392
|
-
delay(0), map(() => Math.round(
|
|
379
|
+
delay(0), map(() => Math.round(yearsScroll.measureScrollOffset() / this.yearWidth) +
|
|
393
380
|
Math.floor(YEARS_IN_ROW / 2) +
|
|
394
381
|
STARTING_YEAR), filter((activeYear) => activeYear !== this.activeYear), takeUntilDestroyed(this.destroyRef))
|
|
395
382
|
.subscribe((activeYear) => {
|
|
@@ -399,26 +386,26 @@ class TuiMobileCalendar {
|
|
|
399
386
|
});
|
|
400
387
|
// Smooth scroll to activeYear after scrolling is done
|
|
401
388
|
touchstart$
|
|
402
|
-
.pipe(switchMap(() => touchend$), switchMap(() => race(
|
|
389
|
+
.pipe(switchMap(() => touchend$), switchMap(() => race(yearsScroll.elementScrolled(), timer(SCROLL_DEBOUNCE_TIME, tuiZonefreeScheduler(this.ngZone))).pipe(debounceTime(SCROLL_DEBOUNCE_TIME * 2, tuiZonefreeScheduler(this.ngZone)), take(1), takeUntil(touchstart$))), takeUntilDestroyed(this.destroyRef))
|
|
403
390
|
.subscribe(() => this.scrollToActiveYear('smooth'));
|
|
404
391
|
}
|
|
405
392
|
initMonthScroll() {
|
|
406
|
-
const
|
|
407
|
-
if (!
|
|
393
|
+
const monthsScroll = this.monthsScroll();
|
|
394
|
+
if (!monthsScroll) {
|
|
408
395
|
return;
|
|
409
396
|
}
|
|
410
|
-
const touchstart$ = tuiTypedFromEvent(
|
|
411
|
-
const touchend$ = tuiTypedFromEvent(
|
|
397
|
+
const touchstart$ = tuiTypedFromEvent(monthsScroll.elementRef.nativeElement, 'touchstart', { passive: true });
|
|
398
|
+
const touchend$ = tuiTypedFromEvent(monthsScroll.elementRef.nativeElement, 'touchend', { passive: true });
|
|
412
399
|
// Smooth scroll to the closest month after scrolling is done
|
|
413
400
|
touchstart$
|
|
414
|
-
.pipe(switchMap(() => touchend$), switchMap(() => race(
|
|
401
|
+
.pipe(switchMap(() => touchend$), switchMap(() => race(monthsScroll.elementScrolled(), timer(SCROLL_DEBOUNCE_TIME, tuiZonefreeScheduler(this.ngZone))).pipe(debounceTime(SCROLL_DEBOUNCE_TIME * 2, tuiZonefreeScheduler(this.ngZone)), take(1), takeUntil(touchstart$))), takeUntilDestroyed(this.destroyRef))
|
|
415
402
|
.subscribe(() => this.scrollToActiveMonth('smooth'));
|
|
416
403
|
}
|
|
417
404
|
scrollToActiveYear(behavior = 'auto') {
|
|
418
|
-
this.
|
|
405
|
+
this.yearsScroll()?.scrollToIndex(Math.max(this.activeYear - STARTING_YEAR - 2, 0), this.isE2E ? 'auto' : behavior);
|
|
419
406
|
}
|
|
420
407
|
scrollToActiveMonth(behavior = 'auto') {
|
|
421
|
-
this.
|
|
408
|
+
this.monthsScroll()?.scrollToIndex(this.activeMonth, this.isE2E ? 'auto' : behavior);
|
|
422
409
|
}
|
|
423
410
|
isYearActive(index) {
|
|
424
411
|
return index === this.activeYear;
|
|
@@ -429,10 +416,10 @@ class TuiMobileCalendar {
|
|
|
429
416
|
getMonthOffset(year) {
|
|
430
417
|
return (year - this.activeYear) * MONTHS_IN_YEAR;
|
|
431
418
|
}
|
|
432
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.
|
|
433
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.
|
|
419
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiMobileCalendar, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
420
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: TuiMobileCalendar, isStandalone: true, selector: "tui-mobile-calendar", inputs: { single: { classPropertyName: "single", publicName: "single", isSignal: true, isRequired: false, transformFunction: null }, multi: { classPropertyName: "multi", publicName: "multi", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, disabledItemHandler: { classPropertyName: "disabledItemHandler", publicName: "disabledItemHandler", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { cancel: "cancel", confirm: "confirm", value: "valueChange" }, host: { listeners: { "mousedown.prevent": "0" }, properties: { "class._ios": "isIOS", "class._initialized": "initialized" } }, providers: TUI_MOBILE_CALENDAR_PROVIDERS, viewQueries: [{ propertyName: "yearsScroll", first: true, predicate: ["yearsScroll"], descendants: true, isSignal: true }, { propertyName: "monthsScroll", first: true, predicate: ["monthsScroll"], descendants: true, isSignal: true }], ngImport: i0, template: "@if (chooseDayOrRangeTexts?.(); as texts) {\n <header class=\"t-header\">\n <button\n appearance=\"\"\n automation-id=\"tui-mobile-calendar__cancel\"\n tuiIconButton\n tuiRipple\n type=\"button\"\n class=\"t-close\"\n [iconStart]=\"icons.close\"\n [style.border-radius.%]=\"100\"\n (click)=\"onClose()\"\n >\n {{ closeWord() }}\n </button>\n <button\n tuiLink\n tuiTouchable=\"opacity\"\n type=\"button\"\n class=\"t-link t-link_close\"\n (click)=\"onClose()\"\n >\n {{ cancelWord() }}\n </button>\n <h2\n automation-id=\"tui-mobile-calendar__label\"\n class=\"t-label\"\n >\n {{ single() ? texts[0] : multi() ? texts[2] : texts[1] }}\n </h2>\n <button\n automation-id=\"tui-mobile-calendar__confirm\"\n tuiLink\n tuiTouchable=\"opacity\"\n type=\"button\"\n class=\"t-link\"\n (click)=\"onConfirm()\"\n >\n {{ doneWord() }}\n </button>\n </header>\n}\n<cdk-virtual-scroll-viewport\n #yearsScroll\n orientation=\"horizontal\"\n class=\"t-years\"\n [itemSize]=\"yearWidth\"\n>\n <div class=\"t-years-wrapper\">\n <button\n *cdkVirtualFor=\"let index of years\"\n type=\"button\"\n class=\"t-year\"\n [attr.data-state]=\"getState(index)\"\n (click)=\"setYear(index)\"\n >\n {{ index }}\n </button>\n </div>\n</cdk-virtual-scroll-viewport>\n<div class=\"t-week\">\n @for (day of unorderedWeekDays$ | tuiOrderWeekDays | async; track day) {\n <div class=\"t-day\">\n {{ day }}\n </div>\n }\n</div>\n<cdk-virtual-scroll-viewport\n #monthsScroll\n itemSize=\"354\"\n maxBufferPx=\"5000\"\n minBufferPx=\"0\"\n class=\"t-months\"\n (scrolledIndexChange)=\"onMonthChange($event)\"\n>\n <section\n *cdkVirtualFor=\"let month of months; templateCacheSize: 10\"\n class=\"t-month-wrapper\"\n >\n <h2 class=\"t-month\">{{ monthNames()[month.month] }}</h2>\n <tui-mobile-calendar-sheet\n class=\"t-calendar\"\n [disabledItemHandler]=\"disabledItemHandler() | tuiMapper: disabledItemHandlerMapper : min() : max()\"\n [month]=\"month\"\n [single]=\"single()\"\n [value]=\"value()\"\n (dayClick)=\"onDayClick($event)\"\n />\n </section>\n</cdk-virtual-scroll-viewport>\n", styles: [":host{display:block;block-size:100%;color:var(--tui-text-primary);overscroll-behavior:none;-webkit-tap-highlight-color:transparent}:host ::ng-deep .t-cell:before,:host ::ng-deep .t-cell:after{transform:translateZ(1px)}.t-header{position:relative;display:flex;align-items:center;block-size:3.5rem;padding:0 1rem;border-block-end:.5px solid var(--tui-border-normal)}:host._ios .t-header{block-size:2.75rem;border-block-end:none}.t-close{inline-size:1.5rem;block-size:1.5rem;margin-inline-end:2rem}:host._ios .t-close{display:none}.t-link{margin-inline-start:auto;flex-shrink:0;font-size:.875rem;line-height:1rem;font-weight:500;text-transform:uppercase;color:var(--tui-text-action)}.t-link_close{display:none}:host._ios .t-link{min-inline-size:3.75rem;text-align:end;font-size:.9375rem;line-height:1.125rem;font-weight:400;letter-spacing:.018125rem;text-transform:none}:host._ios .t-link_close{display:block;margin:0 auto 0 0;text-align:start}.t-label{flex-grow:1;margin:0;font-size:1.25rem;line-height:3.5rem;font-weight:500;letter-spacing:-.0125rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.t-label+.t-link{padding-inline-start:1rem}:host._ios .t-label{font-size:1.0625rem;font-weight:600;letter-spacing:-.025625rem;text-align:center}.t-years{scrollbar-width:none;-ms-overflow-style:none;block-size:4.0625rem;background-color:var(--tui-background-base);box-shadow:0 .5px var(--tui-border-normal)}.t-years::-webkit-scrollbar,.t-years::-webkit-scrollbar-thumb{display:none}:host._ios .t-years{background-color:transparent}.t-years-wrapper{display:flex;block-size:4.0625rem}.t-year{-webkit-appearance:none;appearance:none;padding:0;border:0;background:none;font:inherit;line-height:inherit;text-decoration:none;outline:none;inline-size:20vw;flex-shrink:0;font-size:.9375rem;font-weight:700;letter-spacing:.015625rem;cursor:pointer;opacity:.1;transform:scale(.73);transition:color,opacity,transform .2s}.t-year[data-state=adjacent]{transform:scale(.86);opacity:.3}.t-year[data-state=active]{color:var(--tui-text-action);opacity:1;transform:scale(1)}.t-week{display:flex;align-items:center;block-size:1.875rem;inline-size:20.75rem;max-inline-size:100%;margin:0 auto;font-size:.75rem}:host._ios .t-week{inline-size:22.625rem;font-size:.6875rem;font-weight:500;color:var(--tui-text-secondary)}.t-day{flex:1;text-align:center}.t-months{scrollbar-width:none;-ms-overflow-style:none;block-size:calc(100% - 9.5rem);box-shadow:0 -1px var(--tui-border-normal);overflow-x:hidden}.t-months::-webkit-scrollbar,.t-months::-webkit-scrollbar-thumb{display:none}:host._ios .t-months{block-size:calc(100% - 8.75rem)}.t-month-wrapper{display:flex;margin:.625rem 0 -.625rem;block-size:22.125rem;flex-direction:column}.t-month{block-size:2.75rem;inline-size:100%;line-height:2.75rem;padding-inline-start:1rem;font-size:.875rem;font-weight:500;text-transform:uppercase;margin:0 0 1.25rem;box-sizing:border-box;border-block-end:.5px solid var(--tui-border-normal)}:host._ios .t-month{block-size:3.125rem;margin:0;border-block-end:none;text-transform:none;font-size:1.375rem;line-height:3.125rem;letter-spacing:.02rem;font-weight:700}.t-calendar{margin:0 auto;transition:opacity .2s}.t-week,.t-years,.t-months{transition-property:opacity;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;opacity:0}:host(._initialized) .t-week,:host(._initialized) .t-years,:host(._initialized) .t-months{opacity:1}\n"], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "directive", type: CdkFixedSizeVirtualScroll, selector: "cdk-virtual-scroll-viewport[itemSize]", inputs: ["itemSize", "minBufferPx", "maxBufferPx"] }, { kind: "directive", type: CdkVirtualForOf, selector: "[cdkVirtualFor][cdkVirtualForOf]", inputs: ["cdkVirtualForOf", "cdkVirtualForTrackBy", "cdkVirtualForTemplate", "cdkVirtualForTemplateCacheSize"] }, { kind: "component", type: CdkVirtualScrollViewport, selector: "cdk-virtual-scroll-viewport", inputs: ["orientation", "appendOnly"], outputs: ["scrolledIndexChange"] }, { kind: "directive", type: TuiButton, selector: "a[tuiButton],button[tuiButton],a[tuiIconButton],button[tuiIconButton]", inputs: ["size"] }, { kind: "directive", type: TuiLink, selector: "a[tuiLink], button[tuiLink]" }, { kind: "pipe", type: TuiMapperPipe, name: "tuiMapper" }, { kind: "component", type: TuiMobileCalendarSheet, selector: "tui-mobile-calendar-sheet" }, { kind: "pipe", type: TuiOrderWeekDaysPipe, name: "tuiOrderWeekDays" }, { kind: "directive", type: TuiRipple, selector: "[tuiRipple]", inputs: ["tuiRipple"] }, { kind: "directive", type: TuiTouchable, selector: "[tuiTouchable]", inputs: ["tuiTouchable"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
434
421
|
}
|
|
435
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
422
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiMobileCalendar, decorators: [{
|
|
436
423
|
type: Component,
|
|
437
424
|
args: [{ selector: 'tui-mobile-calendar', imports: [
|
|
438
425
|
AsyncPipe,
|
|
@@ -443,7 +430,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
|
|
|
443
430
|
TuiLink,
|
|
444
431
|
TuiMapperPipe,
|
|
445
432
|
TuiMobileCalendarSheet,
|
|
446
|
-
TuiMonthPipe,
|
|
447
433
|
TuiOrderWeekDaysPipe,
|
|
448
434
|
TuiRipple,
|
|
449
435
|
TuiTouchable,
|
|
@@ -451,36 +437,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
|
|
|
451
437
|
'[class._ios]': 'isIOS',
|
|
452
438
|
'[class._initialized]': 'initialized',
|
|
453
439
|
'(mousedown.prevent)': '0',
|
|
454
|
-
}, template: "@if (chooseDayOrRangeTexts?.(); as texts) {\n <header class=\"t-header\">\n <button\n appearance=\"\"\n automation-id=\"tui-mobile-calendar__cancel\"\n tuiIconButton\n tuiRipple\n type=\"button\"\n class=\"t-close\"\n [iconStart]=\"icons.close\"\n [style.border-radius.%]=\"100\"\n (click)=\"onClose()\"\n >\n {{ closeWord() }}\n </button>\n <button\n tuiLink\n tuiTouchable=\"opacity\"\n type=\"button\"\n class=\"t-link t-link_close\"\n (click)=\"onClose()\"\n >\n {{ cancelWord() }}\n </button>\n <h2\n automation-id=\"tui-mobile-calendar__label\"\n class=\"t-label\"\n >\n {{ single ? texts[0] : multi ? texts[2] : texts[1] }}\n </h2>\n <button\n automation-id=\"tui-mobile-calendar__confirm\"\n tuiLink\n tuiTouchable=\"opacity\"\n type=\"button\"\n class=\"t-link\"\n (click)=\"onConfirm()\"\n >\n {{ doneWord() }}\n </button>\n </header>\n}\n<cdk-virtual-scroll-viewport\n #
|
|
455
|
-
}], ctorParameters: () => []
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
}], single: [{
|
|
462
|
-
type: Input
|
|
463
|
-
}], multi: [{
|
|
464
|
-
type: Input
|
|
465
|
-
}], min: [{
|
|
466
|
-
type: Input
|
|
467
|
-
}], max: [{
|
|
468
|
-
type: Input
|
|
469
|
-
}], disabledItemHandler: [{
|
|
470
|
-
type: Input
|
|
471
|
-
}], cancel: [{
|
|
472
|
-
type: Output
|
|
473
|
-
}], confirm: [{
|
|
474
|
-
type: Output
|
|
475
|
-
}], valueChange: [{
|
|
476
|
-
type: Output
|
|
477
|
-
}], value: [{
|
|
478
|
-
type: Input
|
|
479
|
-
}] } });
|
|
440
|
+
}, template: "@if (chooseDayOrRangeTexts?.(); as texts) {\n <header class=\"t-header\">\n <button\n appearance=\"\"\n automation-id=\"tui-mobile-calendar__cancel\"\n tuiIconButton\n tuiRipple\n type=\"button\"\n class=\"t-close\"\n [iconStart]=\"icons.close\"\n [style.border-radius.%]=\"100\"\n (click)=\"onClose()\"\n >\n {{ closeWord() }}\n </button>\n <button\n tuiLink\n tuiTouchable=\"opacity\"\n type=\"button\"\n class=\"t-link t-link_close\"\n (click)=\"onClose()\"\n >\n {{ cancelWord() }}\n </button>\n <h2\n automation-id=\"tui-mobile-calendar__label\"\n class=\"t-label\"\n >\n {{ single() ? texts[0] : multi() ? texts[2] : texts[1] }}\n </h2>\n <button\n automation-id=\"tui-mobile-calendar__confirm\"\n tuiLink\n tuiTouchable=\"opacity\"\n type=\"button\"\n class=\"t-link\"\n (click)=\"onConfirm()\"\n >\n {{ doneWord() }}\n </button>\n </header>\n}\n<cdk-virtual-scroll-viewport\n #yearsScroll\n orientation=\"horizontal\"\n class=\"t-years\"\n [itemSize]=\"yearWidth\"\n>\n <div class=\"t-years-wrapper\">\n <button\n *cdkVirtualFor=\"let index of years\"\n type=\"button\"\n class=\"t-year\"\n [attr.data-state]=\"getState(index)\"\n (click)=\"setYear(index)\"\n >\n {{ index }}\n </button>\n </div>\n</cdk-virtual-scroll-viewport>\n<div class=\"t-week\">\n @for (day of unorderedWeekDays$ | tuiOrderWeekDays | async; track day) {\n <div class=\"t-day\">\n {{ day }}\n </div>\n }\n</div>\n<cdk-virtual-scroll-viewport\n #monthsScroll\n itemSize=\"354\"\n maxBufferPx=\"5000\"\n minBufferPx=\"0\"\n class=\"t-months\"\n (scrolledIndexChange)=\"onMonthChange($event)\"\n>\n <section\n *cdkVirtualFor=\"let month of months; templateCacheSize: 10\"\n class=\"t-month-wrapper\"\n >\n <h2 class=\"t-month\">{{ monthNames()[month.month] }}</h2>\n <tui-mobile-calendar-sheet\n class=\"t-calendar\"\n [disabledItemHandler]=\"disabledItemHandler() | tuiMapper: disabledItemHandlerMapper : min() : max()\"\n [month]=\"month\"\n [single]=\"single()\"\n [value]=\"value()\"\n (dayClick)=\"onDayClick($event)\"\n />\n </section>\n</cdk-virtual-scroll-viewport>\n", styles: [":host{display:block;block-size:100%;color:var(--tui-text-primary);overscroll-behavior:none;-webkit-tap-highlight-color:transparent}:host ::ng-deep .t-cell:before,:host ::ng-deep .t-cell:after{transform:translateZ(1px)}.t-header{position:relative;display:flex;align-items:center;block-size:3.5rem;padding:0 1rem;border-block-end:.5px solid var(--tui-border-normal)}:host._ios .t-header{block-size:2.75rem;border-block-end:none}.t-close{inline-size:1.5rem;block-size:1.5rem;margin-inline-end:2rem}:host._ios .t-close{display:none}.t-link{margin-inline-start:auto;flex-shrink:0;font-size:.875rem;line-height:1rem;font-weight:500;text-transform:uppercase;color:var(--tui-text-action)}.t-link_close{display:none}:host._ios .t-link{min-inline-size:3.75rem;text-align:end;font-size:.9375rem;line-height:1.125rem;font-weight:400;letter-spacing:.018125rem;text-transform:none}:host._ios .t-link_close{display:block;margin:0 auto 0 0;text-align:start}.t-label{flex-grow:1;margin:0;font-size:1.25rem;line-height:3.5rem;font-weight:500;letter-spacing:-.0125rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.t-label+.t-link{padding-inline-start:1rem}:host._ios .t-label{font-size:1.0625rem;font-weight:600;letter-spacing:-.025625rem;text-align:center}.t-years{scrollbar-width:none;-ms-overflow-style:none;block-size:4.0625rem;background-color:var(--tui-background-base);box-shadow:0 .5px var(--tui-border-normal)}.t-years::-webkit-scrollbar,.t-years::-webkit-scrollbar-thumb{display:none}:host._ios .t-years{background-color:transparent}.t-years-wrapper{display:flex;block-size:4.0625rem}.t-year{-webkit-appearance:none;appearance:none;padding:0;border:0;background:none;font:inherit;line-height:inherit;text-decoration:none;outline:none;inline-size:20vw;flex-shrink:0;font-size:.9375rem;font-weight:700;letter-spacing:.015625rem;cursor:pointer;opacity:.1;transform:scale(.73);transition:color,opacity,transform .2s}.t-year[data-state=adjacent]{transform:scale(.86);opacity:.3}.t-year[data-state=active]{color:var(--tui-text-action);opacity:1;transform:scale(1)}.t-week{display:flex;align-items:center;block-size:1.875rem;inline-size:20.75rem;max-inline-size:100%;margin:0 auto;font-size:.75rem}:host._ios .t-week{inline-size:22.625rem;font-size:.6875rem;font-weight:500;color:var(--tui-text-secondary)}.t-day{flex:1;text-align:center}.t-months{scrollbar-width:none;-ms-overflow-style:none;block-size:calc(100% - 9.5rem);box-shadow:0 -1px var(--tui-border-normal);overflow-x:hidden}.t-months::-webkit-scrollbar,.t-months::-webkit-scrollbar-thumb{display:none}:host._ios .t-months{block-size:calc(100% - 8.75rem)}.t-month-wrapper{display:flex;margin:.625rem 0 -.625rem;block-size:22.125rem;flex-direction:column}.t-month{block-size:2.75rem;inline-size:100%;line-height:2.75rem;padding-inline-start:1rem;font-size:.875rem;font-weight:500;text-transform:uppercase;margin:0 0 1.25rem;box-sizing:border-box;border-block-end:.5px solid var(--tui-border-normal)}:host._ios .t-month{block-size:3.125rem;margin:0;border-block-end:none;text-transform:none;font-size:1.375rem;line-height:3.125rem;letter-spacing:.02rem;font-weight:700}.t-calendar{margin:0 auto;transition:opacity .2s}.t-week,.t-years,.t-months{transition-property:opacity;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;opacity:0}:host(._initialized) .t-week,:host(._initialized) .t-years,:host(._initialized) .t-months{opacity:1}\n"] }]
|
|
441
|
+
}], ctorParameters: () => [] });
|
|
442
|
+
function toggleDay(days, day) {
|
|
443
|
+
return ((days?.find((item) => item.daySame(day))
|
|
444
|
+
? days.filter((item) => !item.daySame(day))
|
|
445
|
+
: days?.concat(day)) || []);
|
|
446
|
+
}
|
|
480
447
|
|
|
481
448
|
/**
|
|
482
449
|
* Generated bundle index. Do not edit.
|
|
483
450
|
*/
|
|
484
451
|
|
|
485
|
-
export { ANDROID_CYCLE, ANDROID_LABEL, ANDROID_WEEK, BUFFER, IOS_CYCLE, IOS_LABEL, IOS_WEEK, RANGE, SCROLL_DEBOUNCE_TIME, STARTING_YEAR, TUI_MOBILE_CALENDAR_PROVIDERS, TUI_VALUE_STREAM, TuiMobileCalendar, TuiMobileCalendarStrategy, YEARLY_CYCLE, YEARS_IN_ROW };
|
|
452
|
+
export { ANDROID_CYCLE, ANDROID_LABEL, ANDROID_WEEK, BUFFER, IOS_CYCLE, IOS_LABEL, IOS_WEEK, RANGE, SCROLL_DEBOUNCE_TIME, STARTING_YEAR, TUI_CALENDAR_DATE_STREAM, TUI_MOBILE_CALENDAR_PROVIDERS, TUI_VALUE_STREAM, TuiMobileCalendar, TuiMobileCalendarStrategy, YEARLY_CYCLE, YEARS_IN_ROW, tuiDateStreamWithTransformer };
|
|
486
453
|
//# sourceMappingURL=taiga-ui-addon-mobile-components-mobile-calendar.mjs.map
|