@taiga-ui/core 5.0.0-rc.2 → 5.0.0-rc.4
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/components/calendar/calendar-sheet.component.d.ts +8 -15
- package/components/calendar/calendar-spin.component.d.ts +5 -8
- package/components/calendar/calendar-year.component.d.ts +11 -19
- package/components/calendar/calendar.component.d.ts +7 -9
- package/components/checkbox/checkbox.component.d.ts +10 -0
- package/components/checkbox/checkbox.options.d.ts +10 -0
- package/components/checkbox/index.d.ts +2 -0
- package/components/data-list/data-list.component.d.ts +1 -0
- package/components/index.d.ts +3 -0
- package/components/input/input.directive.d.ts +2 -0
- package/components/loader/loader.component.d.ts +0 -2
- package/components/radio/index.d.ts +4 -0
- package/components/radio/radio.component.d.ts +18 -0
- package/components/radio/radio.d.ts +3 -0
- package/components/radio/radio.directive.d.ts +8 -0
- package/components/radio/radio.options.d.ts +7 -0
- package/components/slider/helpers/key-steps.d.ts +27 -0
- package/components/slider/helpers/slider-key-steps.directive.d.ts +32 -0
- package/components/slider/helpers/slider-readonly.directive.d.ts +15 -0
- package/components/slider/helpers/slider-thumb-label.component.d.ts +13 -0
- package/components/slider/index.d.ts +6 -0
- package/components/slider/slider.component.d.ts +22 -0
- package/components/slider/slider.d.ts +5 -0
- package/components/textfield/index.d.ts +0 -1
- package/components/textfield/textfield.component.d.ts +1 -0
- package/directives/items-handlers/items-handlers.validator.d.ts +1 -0
- package/fesm2022/taiga-ui-core-components-button.mjs +2 -2
- package/fesm2022/taiga-ui-core-components-button.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-components-calendar.mjs +84 -174
- package/fesm2022/taiga-ui-core-components-calendar.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-components-cell.mjs +2 -2
- package/fesm2022/taiga-ui-core-components-cell.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-components-checkbox.mjs +37 -0
- package/fesm2022/taiga-ui-core-components-checkbox.mjs.map +1 -0
- package/fesm2022/taiga-ui-core-components-data-list.mjs +10 -4
- package/fesm2022/taiga-ui-core-components-data-list.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-components-error.mjs +3 -3
- package/fesm2022/taiga-ui-core-components-error.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-components-icon.mjs +2 -2
- package/fesm2022/taiga-ui-core-components-icon.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-components-input.mjs +4 -2
- package/fesm2022/taiga-ui-core-components-input.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-components-label.mjs +3 -3
- package/fesm2022/taiga-ui-core-components-label.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-components-link.mjs +2 -2
- package/fesm2022/taiga-ui-core-components-link.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-components-loader.mjs +5 -8
- package/fesm2022/taiga-ui-core-components-loader.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-components-notification.mjs +2 -2
- package/fesm2022/taiga-ui-core-components-notification.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-components-radio.mjs +91 -0
- package/fesm2022/taiga-ui-core-components-radio.mjs.map +1 -0
- package/fesm2022/taiga-ui-core-components-root.mjs +2 -2
- package/fesm2022/taiga-ui-core-components-root.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-components-slider.mjs +337 -0
- package/fesm2022/taiga-ui-core-components-slider.mjs.map +1 -0
- package/fesm2022/taiga-ui-core-components-spin-button.mjs +2 -2
- package/fesm2022/taiga-ui-core-components-spin-button.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-components-textfield.mjs +20 -21
- package/fesm2022/taiga-ui-core-components-textfield.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-components-title.mjs +3 -3
- package/fesm2022/taiga-ui-core-components-title.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-components.mjs +3 -0
- package/fesm2022/taiga-ui-core-components.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-directives-appearance.mjs +3 -3
- package/fesm2022/taiga-ui-core-directives-appearance.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-directives-group.mjs +3 -3
- package/fesm2022/taiga-ui-core-directives-group.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-directives-icons.mjs +3 -3
- package/fesm2022/taiga-ui-core-directives-icons.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-directives-items-handlers.mjs +7 -1
- package/fesm2022/taiga-ui-core-directives-items-handlers.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-portals-alert.mjs +2 -2
- package/fesm2022/taiga-ui-core-portals-alert.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-portals-dialog.mjs +2 -2
- package/fesm2022/taiga-ui-core-portals-dialog.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-portals-dropdown.mjs +167 -115
- package/fesm2022/taiga-ui-core-portals-dropdown.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-portals-hint.mjs +3 -3
- package/fesm2022/taiga-ui-core-portals-hint.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-portals-modal.mjs +2 -2
- package/fesm2022/taiga-ui-core-portals-modal.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-portals-popup.mjs +2 -2
- package/fesm2022/taiga-ui-core-portals-popup.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-tokens.mjs +1 -1
- package/fesm2022/taiga-ui-core-tokens.mjs.map +1 -1
- package/fesm2022/taiga-ui-core-utils-miscellaneous.mjs.map +1 -1
- package/package.json +32 -20
- package/portals/dropdown/dropdown-a11y.directive.d.ts +10 -0
- package/portals/dropdown/dropdown-close.directive.d.ts +3 -3
- package/portals/dropdown/dropdown-open.directive.d.ts +4 -3
- package/portals/dropdown/dropdown-selection.directive.d.ts +1 -0
- package/portals/dropdown/dropdown.d.ts +2 -1
- package/portals/dropdown/dropdown.directive.d.ts +5 -5
- package/portals/dropdown/index.d.ts +1 -0
- package/utils/miscellaneous/font-scaling.d.ts +2 -2
- package/components/textfield/textfield-icon.d.ts +0 -6
- package/styles/components/appearance.less +0 -51
- package/styles/components/button.less +0 -134
- package/styles/components/group.less +0 -172
- package/styles/components/icon.less +0 -83
- package/styles/components/icons.less +0 -79
- package/styles/components/label.less +0 -51
- package/styles/components/link.less +0 -69
- package/styles/components/notification.less +0 -184
- package/styles/components/textfield.less +0 -358
- package/styles/components/title.less +0 -80
- package/styles/mixins/appearance.less +0 -56
- package/styles/mixins/appearance.scss +0 -57
- package/styles/mixins/browsers.less +0 -23
- package/styles/mixins/browsers.scss +0 -23
- package/styles/mixins/date-picker.less +0 -152
- package/styles/mixins/mixins.less +0 -168
- package/styles/mixins/mixins.scss +0 -161
- package/styles/mixins/picker.less +0 -200
- package/styles/mixins/picker.scss +0 -199
- package/styles/mixins/slider.less +0 -67
- package/styles/mixins/slider.scss +0 -67
- package/styles/taiga-ui-fonts.less +0 -4
- package/styles/taiga-ui-local.less +0 -7
- package/styles/taiga-ui-local.scss +0 -6
- package/styles/taiga-ui-theme.less +0 -4
- package/styles/theme/appearance/accent.less +0 -14
- package/styles/theme/appearance/action.less +0 -38
- package/styles/theme/appearance/flat.less +0 -23
- package/styles/theme/appearance/floating.less +0 -21
- package/styles/theme/appearance/glass.less +0 -30
- package/styles/theme/appearance/outline.less +0 -78
- package/styles/theme/appearance/primary.less +0 -48
- package/styles/theme/appearance/secondary.less +0 -77
- package/styles/theme/appearance/status.less +0 -125
- package/styles/theme/appearance/table.less +0 -68
- package/styles/theme/appearance/textfield.less +0 -80
- package/styles/theme/appearance.less +0 -12
- package/styles/theme/palette.less +0 -161
- package/styles/theme/variables.less +0 -42
- package/styles/variables/media.less +0 -23
- package/styles/variables/media.scss +0 -23
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { signal, inject, Pipe,
|
|
2
|
+
import { signal, inject, Pipe, input, model, output, Input, ChangeDetectionStrategy, Component, computed, ChangeDetectorRef, EventEmitter, Output } from '@angular/core';
|
|
3
3
|
import { TuiDayOfWeek, DAYS_IN_WEEK, TuiDay, TuiMonth, TuiDayRange, TUI_FIRST_DAY, TUI_LAST_DAY, MIN_YEAR, MAX_YEAR, TuiYear, TuiMonthRange, TUI_LAST_DISPLAYED_DAY } from '@taiga-ui/cdk/date-time';
|
|
4
4
|
import { TuiMapperPipe } from '@taiga-ui/cdk/pipes/mapper';
|
|
5
5
|
import { tuiNullableSame, tuiIsNumber } from '@taiga-ui/cdk/utils/miscellaneous';
|
|
@@ -133,12 +133,13 @@ class TuiCalendarSheet {
|
|
|
133
133
|
this.today = TuiDay.currentLocal();
|
|
134
134
|
this.unorderedWeekDays$ = toObservable(inject(TUI_SHORT_WEEK_DAYS));
|
|
135
135
|
this.dayType = inject(TUI_CALENDAR_OPTIONS).dayType;
|
|
136
|
-
this.month = TuiMonth.currentLocal();
|
|
137
|
-
this.disabledItemHandler = TUI_FALSE_HANDLER;
|
|
138
|
-
this.markerHandler = null;
|
|
139
|
-
this.value = null;
|
|
140
|
-
this.
|
|
141
|
-
this.
|
|
136
|
+
this.month = input(TuiMonth.currentLocal());
|
|
137
|
+
this.disabledItemHandler = input(TUI_FALSE_HANDLER);
|
|
138
|
+
this.markerHandler = input(null);
|
|
139
|
+
this.value = input(null);
|
|
140
|
+
this.showAdjacent = input(true);
|
|
141
|
+
this.hoveredItem = model(null);
|
|
142
|
+
this.dayClick = output();
|
|
142
143
|
/**
|
|
143
144
|
* @deprecated use static DI options instead
|
|
144
145
|
* ```
|
|
@@ -147,8 +148,6 @@ class TuiCalendarSheet {
|
|
|
147
148
|
* TODO(v5): delete it
|
|
148
149
|
*/
|
|
149
150
|
this.single = true;
|
|
150
|
-
this.hoveredItemChange = new EventEmitter();
|
|
151
|
-
this.dayClick = new EventEmitter();
|
|
152
151
|
this.toMarkers = (day, today, range, markerHandler) => {
|
|
153
152
|
if (today || ['active', 'end', 'start'].includes(range || '')) {
|
|
154
153
|
return null;
|
|
@@ -157,28 +156,11 @@ class TuiCalendarSheet {
|
|
|
157
156
|
return markers?.length ? markers : null;
|
|
158
157
|
};
|
|
159
158
|
}
|
|
160
|
-
/**
|
|
161
|
-
* @deprecated TODO(v5): delete it. It is used nowhere except unit tests
|
|
162
|
-
*/
|
|
163
|
-
itemIsInterval(day) {
|
|
164
|
-
const { value, hoveredItem } = this;
|
|
165
|
-
if (!(value instanceof TuiDayRange)) {
|
|
166
|
-
return false;
|
|
167
|
-
}
|
|
168
|
-
if (!value.isSingleDay) {
|
|
169
|
-
return value.from.daySameOrBefore(day) && value.to.dayAfter(day);
|
|
170
|
-
}
|
|
171
|
-
if (hoveredItem === null) {
|
|
172
|
-
return false;
|
|
173
|
-
}
|
|
174
|
-
const range = TuiDayRange.sort(value.from, hoveredItem);
|
|
175
|
-
return range.from.daySameOrBefore(day) && range.to.dayAfter(day);
|
|
176
|
-
}
|
|
177
159
|
onItemHovered(item) {
|
|
178
160
|
this.updateHoveredItem(item || null);
|
|
179
161
|
}
|
|
180
162
|
getItemRange(item) {
|
|
181
|
-
const
|
|
163
|
+
const value = this.value();
|
|
182
164
|
if (!value) {
|
|
183
165
|
return null;
|
|
184
166
|
}
|
|
@@ -191,7 +173,7 @@ class TuiCalendarSheet {
|
|
|
191
173
|
if (!(value instanceof TuiDay) && !(value instanceof TuiDayRange)) {
|
|
192
174
|
return value.find((day) => day.daySame(item)) ? 'active' : null;
|
|
193
175
|
}
|
|
194
|
-
const range = this.getRange(value, hoveredItem);
|
|
176
|
+
const range = this.getRange(value, this.hoveredItem());
|
|
195
177
|
if (range.isSingleDay && range.from.daySame(item)) {
|
|
196
178
|
return 'active';
|
|
197
179
|
}
|
|
@@ -207,22 +189,20 @@ class TuiCalendarSheet {
|
|
|
207
189
|
return !this.single || this.options.rangeMode;
|
|
208
190
|
}
|
|
209
191
|
get isRangePicking() {
|
|
192
|
+
const value = this.value();
|
|
210
193
|
return this.computedRangeMode
|
|
211
|
-
?
|
|
194
|
+
? value instanceof TuiDay
|
|
212
195
|
: /**
|
|
213
196
|
* Only for backward compatibility!
|
|
214
197
|
* TODO(v5): replace with `this.options.rangeMode && this.value instanceof TuiDay`
|
|
215
198
|
*/
|
|
216
|
-
|
|
199
|
+
value instanceof TuiDayRange && value.isSingleDay;
|
|
217
200
|
}
|
|
218
201
|
itemIsToday(item) {
|
|
219
202
|
return this.today.daySame(item);
|
|
220
203
|
}
|
|
221
204
|
itemIsUnavailable(item) {
|
|
222
|
-
return !this.month.monthSame(item);
|
|
223
|
-
}
|
|
224
|
-
onItemClick(item) {
|
|
225
|
-
this.dayClick.emit(item);
|
|
205
|
+
return !this.month().monthSame(item);
|
|
226
206
|
}
|
|
227
207
|
getRange(value, hoveredItem) {
|
|
228
208
|
if (value instanceof TuiDay) {
|
|
@@ -233,14 +213,13 @@ class TuiCalendarSheet {
|
|
|
233
213
|
: value;
|
|
234
214
|
}
|
|
235
215
|
updateHoveredItem(day) {
|
|
236
|
-
if (tuiNullableSame(this.hoveredItem, day, (a, b) => a.daySame(b))) {
|
|
216
|
+
if (tuiNullableSame(this.hoveredItem(), day, (a, b) => a.daySame(b))) {
|
|
237
217
|
return;
|
|
238
218
|
}
|
|
239
|
-
this.hoveredItem
|
|
240
|
-
this.hoveredItemChange.emit(day);
|
|
219
|
+
this.hoveredItem.set(day);
|
|
241
220
|
}
|
|
242
221
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiCalendarSheet, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
243
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.18", type: TuiCalendarSheet, isStandalone: true, selector: "tui-calendar-sheet", inputs: { month: "month", disabledItemHandler: "disabledItemHandler", markerHandler: "markerHandler", value: "value",
|
|
222
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.18", type: TuiCalendarSheet, isStandalone: true, selector: "tui-calendar-sheet", inputs: { month: { classPropertyName: "month", publicName: "month", isSignal: true, isRequired: false, transformFunction: null }, disabledItemHandler: { classPropertyName: "disabledItemHandler", publicName: "disabledItemHandler", isSignal: true, isRequired: false, transformFunction: null }, markerHandler: { classPropertyName: "markerHandler", publicName: "markerHandler", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, showAdjacent: { classPropertyName: "showAdjacent", publicName: "showAdjacent", isSignal: true, isRequired: false, transformFunction: null }, hoveredItem: { classPropertyName: "hoveredItem", publicName: "hoveredItem", isSignal: true, isRequired: false, transformFunction: null }, single: { classPropertyName: "single", publicName: "single", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { hoveredItem: "hoveredItemChange", dayClick: "dayClick" }, host: { properties: { "class._picking": "isRangePicking" } }, ngImport: i0, template: "<div class=\"t-row t-row_weekday\">\n @for (day of unorderedWeekDays$ | tuiOrderWeekDays | async; track day) {\n <div\n class=\"t-cell\"\n [textContent]=\"day\"\n ></div>\n }\n</div>\n@let sheet = month() | tuiCalendarSheet: true;\n<div>\n @for (_ of '-'.repeat(sheet.length); track $index) {\n @let rowIndex = $index;\n <div\n automation-id=\"tui-calendar-sheet__row\"\n class=\"t-row\"\n >\n @for (_ of '-'.repeat(sheet[rowIndex]?.length ?? 0); track $index) {\n @let item = sheet[rowIndex]?.[$index];\n @if (item && (!itemIsUnavailable(item) || showAdjacent())) {\n <div\n automation-id=\"tui-calendar-sheet__cell\"\n class=\"t-cell\"\n [attr.data-range]=\"getItemRange(item)\"\n [attr.data-type]=\"item | tuiMapper: dayType\"\n [class.t-cell_disabled]=\"disabledItemHandler()(item)\"\n [class.t-cell_today]=\"itemIsToday(item)\"\n [class.t-cell_unavailable]=\"itemIsUnavailable(item)\"\n (click)=\"dayClick.emit(item)\"\n (tuiHoveredChange)=\"onItemHovered($event && item)\"\n >\n {{ item.day }}\n @if (\n item | tuiMapper: toMarkers : itemIsToday(item) : getItemRange(item) : markerHandler();\n as markers\n ) {\n <div class=\"t-dots\">\n <div\n class=\"t-dot\"\n [style.background]=\"markers?.[0]\"\n ></div>\n @if (markers.length > 1) {\n <div\n class=\"t-dot\"\n [style.background]=\"markers?.[1] || ''\"\n ></div>\n }\n </div>\n }\n </div>\n }\n }\n </div>\n }\n</div>\n", styles: [".t-row{display:flex;justify-content:flex-start;font:var(--tui-typography-body-m)}.t-row:last-child{justify-content:flex-start}.t-cell{position:relative;display:flex;align-items:center;justify-content:center;line-height:2rem;isolation:isolate;cursor:pointer;overflow:hidden;border:.125rem solid transparent;box-sizing:border-box;mask:linear-gradient(transparent calc(50% - 1rem),#000 calc(50% - 1rem),#000 calc(50% + 1rem),transparent calc(50% + 1rem))}.t-cell:first-child{border-inline-start-color:transparent!important}.t-cell:last-child{border-inline-end-color:transparent!important}.t-cell:before,.t-cell:after{position:absolute;inset:0;content:\"\";z-index:-1;border-radius:var(--tui-radius-m)}.t-cell:after{mask:url('data:image/svg+xml,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 12 32\"><path d=\"M0.2856 0L0.6763 0C2.9265 0 4.9876 1.259 6.0147 3.2611L10.2442 11.5048C11.5301 14.0113 11.5683 16.9754 10.3472 19.5141L5.9766 28.6007C4.9772 30.6786 2.8754 32 0.5696 32H0.285645V0Z\"></path></svg>') right / .75rem 100% no-repeat,linear-gradient(#000,#000) left / calc(100% - .7rem) 100% no-repeat}.t-cell[data-range]:before{background:var(--tui-background-neutral-1)}:host._picking .t-cell[data-range]:before{background:var(--tui-background-neutral-1-hover)}.t-cell[data-range=middle]{border-color:var(--tui-background-neutral-1)}:host._picking .t-cell[data-range=middle]{border-color:var(--tui-background-neutral-1-hover)}.t-cell[data-range=middle]:not(:first-child):before{border-top-left-radius:0;border-bottom-left-radius:0}.t-cell[data-range=middle]:not(:last-child):before{border-top-right-radius:0;border-bottom-right-radius:0}.t-cell[data-range=start]{border-inline-end-color:var(--tui-background-neutral-1);color:var(--tui-text-primary-on-accent-1)}:host._picking .t-cell[data-range=start]{border-inline-end-color:var(--tui-background-neutral-1-hover)}.t-cell[data-range=start]:not(:last-child):before{right:-1rem}.t-cell[data-range=start]:after{background:var(--tui-background-accent-1)}.t-cell[data-range=end]{border-inline-start-color:var(--tui-background-neutral-1);color:var(--tui-text-primary-on-accent-1)}:host._picking .t-cell[data-range=end]{border-inline-start-color:var(--tui-background-neutral-1-hover)}.t-cell[data-range=end]:not(:first-child):before{left:-1rem}.t-cell[data-range=end]:after{background:var(--tui-background-accent-1);transform:scaleX(-1)}.t-cell[data-range=active]{color:var(--tui-text-primary-on-accent-1)}.t-cell[data-range=active]:after{background:var(--tui-background-accent-1);mask:none}.t-cell_disabled{opacity:var(--tui-disabled-opacity);pointer-events:none}.t-cell_today{text-decoration:underline;text-underline-offset:.25rem}@media (hover: hover) and (pointer: fine){.t-cell:hover:not([data-range=start]):not([data-range=end]):before{background:var(--tui-background-neutral-1-hover)}.t-cell[data-range=start]:hover:after,.t-cell[data-range=end]:hover:after,.t-cell[data-range=active]:hover:after{background:var(--tui-background-accent-1-hover)}}.t-cell{inline-size:calc(100% / 7)}[data-type=weekday]{color:var(--tui-text-primary)}[data-type=weekend]{color:var(--tui-text-negative)}.t-row{justify-content:flex-start}.t-row:first-child{justify-content:flex-end}.t-row_weekday{font:var(--tui-typography-body-s);color:var(--tui-text-secondary);pointer-events:none}.t-cell_unavailable{opacity:var(--tui-disabled-opacity)}.t-dots{position:absolute;bottom:0;display:flex;justify-content:center;margin-block-start:-.5rem;padding-block-end:.25rem}.t-dot{display:inline-block;inline-size:.25rem;block-size:.25rem;border-radius:100%;margin:0 .0625rem}\n"], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "pipe", type: TuiCalendarSheetPipe, name: "tuiCalendarSheet" }, { kind: "directive", type: TuiHovered, selector: "[tuiHoveredChange]", outputs: ["tuiHoveredChange"] }, { kind: "pipe", type: TuiMapperPipe, name: "tuiMapper" }, { kind: "pipe", type: TuiOrderWeekDaysPipe, name: "tuiOrderWeekDays" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
244
223
|
}
|
|
245
224
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiCalendarSheet, decorators: [{
|
|
246
225
|
type: Component,
|
|
@@ -250,72 +229,43 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImpo
|
|
|
250
229
|
TuiHovered,
|
|
251
230
|
TuiMapperPipe,
|
|
252
231
|
TuiOrderWeekDaysPipe,
|
|
253
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, host: { '[class._picking]': 'isRangePicking' }, template: "<div class=\"t-row t-row_weekday\">\n @for (day of unorderedWeekDays$ | tuiOrderWeekDays | async; track day) {\n <div\n class=\"t-cell\"\n [textContent]=\"day\"\n ></div>\n }\n</div>\n@let sheet = month | tuiCalendarSheet: true;\n<div>\n @for (_ of '-'.repeat(sheet.length); track $index) {\n @let rowIndex = $index;\n <div\n automation-id=\"tui-calendar-sheet__row\"\n class=\"t-row\"\n >\n @for (_ of '-'.repeat(sheet[rowIndex]?.length ?? 0); track $index) {\n @let item = sheet[rowIndex]?.[$index];\n @if (item && (!itemIsUnavailable(item) || showAdjacent)) {\n <div\n automation-id=\"tui-calendar-sheet__cell\"\n class=\"t-cell\"\n [attr.data-range]=\"getItemRange(item)\"\n [attr.data-type]=\"item | tuiMapper: dayType\"\n [class.t-cell_disabled]=\"disabledItemHandler(item)\"\n [class.t-cell_today]=\"itemIsToday(item)\"\n [class.t-cell_unavailable]=\"itemIsUnavailable(item)\"\n (click)=\"
|
|
254
|
-
}], propDecorators: {
|
|
255
|
-
type: Input
|
|
256
|
-
}], disabledItemHandler: [{
|
|
257
|
-
type: Input
|
|
258
|
-
}], markerHandler: [{
|
|
259
|
-
type: Input
|
|
260
|
-
}], value: [{
|
|
232
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, host: { '[class._picking]': 'isRangePicking' }, template: "<div class=\"t-row t-row_weekday\">\n @for (day of unorderedWeekDays$ | tuiOrderWeekDays | async; track day) {\n <div\n class=\"t-cell\"\n [textContent]=\"day\"\n ></div>\n }\n</div>\n@let sheet = month() | tuiCalendarSheet: true;\n<div>\n @for (_ of '-'.repeat(sheet.length); track $index) {\n @let rowIndex = $index;\n <div\n automation-id=\"tui-calendar-sheet__row\"\n class=\"t-row\"\n >\n @for (_ of '-'.repeat(sheet[rowIndex]?.length ?? 0); track $index) {\n @let item = sheet[rowIndex]?.[$index];\n @if (item && (!itemIsUnavailable(item) || showAdjacent())) {\n <div\n automation-id=\"tui-calendar-sheet__cell\"\n class=\"t-cell\"\n [attr.data-range]=\"getItemRange(item)\"\n [attr.data-type]=\"item | tuiMapper: dayType\"\n [class.t-cell_disabled]=\"disabledItemHandler()(item)\"\n [class.t-cell_today]=\"itemIsToday(item)\"\n [class.t-cell_unavailable]=\"itemIsUnavailable(item)\"\n (click)=\"dayClick.emit(item)\"\n (tuiHoveredChange)=\"onItemHovered($event && item)\"\n >\n {{ item.day }}\n @if (\n item | tuiMapper: toMarkers : itemIsToday(item) : getItemRange(item) : markerHandler();\n as markers\n ) {\n <div class=\"t-dots\">\n <div\n class=\"t-dot\"\n [style.background]=\"markers?.[0]\"\n ></div>\n @if (markers.length > 1) {\n <div\n class=\"t-dot\"\n [style.background]=\"markers?.[1] || ''\"\n ></div>\n }\n </div>\n }\n </div>\n }\n }\n </div>\n }\n</div>\n", styles: [".t-row{display:flex;justify-content:flex-start;font:var(--tui-typography-body-m)}.t-row:last-child{justify-content:flex-start}.t-cell{position:relative;display:flex;align-items:center;justify-content:center;line-height:2rem;isolation:isolate;cursor:pointer;overflow:hidden;border:.125rem solid transparent;box-sizing:border-box;mask:linear-gradient(transparent calc(50% - 1rem),#000 calc(50% - 1rem),#000 calc(50% + 1rem),transparent calc(50% + 1rem))}.t-cell:first-child{border-inline-start-color:transparent!important}.t-cell:last-child{border-inline-end-color:transparent!important}.t-cell:before,.t-cell:after{position:absolute;inset:0;content:\"\";z-index:-1;border-radius:var(--tui-radius-m)}.t-cell:after{mask:url('data:image/svg+xml,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 12 32\"><path d=\"M0.2856 0L0.6763 0C2.9265 0 4.9876 1.259 6.0147 3.2611L10.2442 11.5048C11.5301 14.0113 11.5683 16.9754 10.3472 19.5141L5.9766 28.6007C4.9772 30.6786 2.8754 32 0.5696 32H0.285645V0Z\"></path></svg>') right / .75rem 100% no-repeat,linear-gradient(#000,#000) left / calc(100% - .7rem) 100% no-repeat}.t-cell[data-range]:before{background:var(--tui-background-neutral-1)}:host._picking .t-cell[data-range]:before{background:var(--tui-background-neutral-1-hover)}.t-cell[data-range=middle]{border-color:var(--tui-background-neutral-1)}:host._picking .t-cell[data-range=middle]{border-color:var(--tui-background-neutral-1-hover)}.t-cell[data-range=middle]:not(:first-child):before{border-top-left-radius:0;border-bottom-left-radius:0}.t-cell[data-range=middle]:not(:last-child):before{border-top-right-radius:0;border-bottom-right-radius:0}.t-cell[data-range=start]{border-inline-end-color:var(--tui-background-neutral-1);color:var(--tui-text-primary-on-accent-1)}:host._picking .t-cell[data-range=start]{border-inline-end-color:var(--tui-background-neutral-1-hover)}.t-cell[data-range=start]:not(:last-child):before{right:-1rem}.t-cell[data-range=start]:after{background:var(--tui-background-accent-1)}.t-cell[data-range=end]{border-inline-start-color:var(--tui-background-neutral-1);color:var(--tui-text-primary-on-accent-1)}:host._picking .t-cell[data-range=end]{border-inline-start-color:var(--tui-background-neutral-1-hover)}.t-cell[data-range=end]:not(:first-child):before{left:-1rem}.t-cell[data-range=end]:after{background:var(--tui-background-accent-1);transform:scaleX(-1)}.t-cell[data-range=active]{color:var(--tui-text-primary-on-accent-1)}.t-cell[data-range=active]:after{background:var(--tui-background-accent-1);mask:none}.t-cell_disabled{opacity:var(--tui-disabled-opacity);pointer-events:none}.t-cell_today{text-decoration:underline;text-underline-offset:.25rem}@media (hover: hover) and (pointer: fine){.t-cell:hover:not([data-range=start]):not([data-range=end]):before{background:var(--tui-background-neutral-1-hover)}.t-cell[data-range=start]:hover:after,.t-cell[data-range=end]:hover:after,.t-cell[data-range=active]:hover:after{background:var(--tui-background-accent-1-hover)}}.t-cell{inline-size:calc(100% / 7)}[data-type=weekday]{color:var(--tui-text-primary)}[data-type=weekend]{color:var(--tui-text-negative)}.t-row{justify-content:flex-start}.t-row:first-child{justify-content:flex-end}.t-row_weekday{font:var(--tui-typography-body-s);color:var(--tui-text-secondary);pointer-events:none}.t-cell_unavailable{opacity:var(--tui-disabled-opacity)}.t-dots{position:absolute;bottom:0;display:flex;justify-content:center;margin-block-start:-.5rem;padding-block-end:.25rem}.t-dot{display:inline-block;inline-size:.25rem;block-size:.25rem;border-radius:100%;margin:0 .0625rem}\n"] }]
|
|
233
|
+
}], propDecorators: { single: [{
|
|
261
234
|
type: Input
|
|
262
|
-
}], hoveredItem: [{
|
|
263
|
-
type: Input
|
|
264
|
-
}], showAdjacent: [{
|
|
265
|
-
type: Input
|
|
266
|
-
}], single: [{
|
|
267
|
-
type: Input
|
|
268
|
-
}], hoveredItemChange: [{
|
|
269
|
-
type: Output
|
|
270
|
-
}], dayClick: [{
|
|
271
|
-
type: Output
|
|
272
235
|
}] } });
|
|
273
236
|
|
|
274
237
|
class TuiCalendarSpin {
|
|
275
238
|
constructor() {
|
|
276
239
|
this.months = inject(TUI_MONTHS);
|
|
277
|
-
this.value = TuiMonth.currentLocal();
|
|
278
|
-
this.min = TUI_FIRST_DAY;
|
|
279
|
-
this.max = TUI_LAST_DAY;
|
|
280
|
-
this.
|
|
281
|
-
this.yearClick = new EventEmitter();
|
|
282
|
-
}
|
|
283
|
-
onYearClick() {
|
|
284
|
-
this.yearClick.next(this.value);
|
|
240
|
+
this.value = model(TuiMonth.currentLocal());
|
|
241
|
+
this.min = input(TUI_FIRST_DAY);
|
|
242
|
+
this.max = input(TUI_LAST_DAY);
|
|
243
|
+
this.yearClick = output();
|
|
285
244
|
}
|
|
286
245
|
append(date) {
|
|
287
|
-
const value = this.value.append(date);
|
|
288
|
-
|
|
289
|
-
|
|
246
|
+
const value = this.value().append(date);
|
|
247
|
+
const min = this.min();
|
|
248
|
+
const max = this.max();
|
|
249
|
+
if (min.monthSameOrAfter(value)) {
|
|
250
|
+
this.updateValue(min);
|
|
290
251
|
}
|
|
291
252
|
else {
|
|
292
|
-
this.updateValue(
|
|
253
|
+
this.updateValue(max.monthSameOrBefore(value) ? max : value);
|
|
293
254
|
}
|
|
294
255
|
}
|
|
295
256
|
updateValue(value) {
|
|
296
|
-
if (this.value.monthSame(value)) {
|
|
257
|
+
if (this.value().monthSame(value)) {
|
|
297
258
|
return;
|
|
298
259
|
}
|
|
299
|
-
this.value
|
|
300
|
-
this.valueChange.emit(value);
|
|
260
|
+
this.value.set(value);
|
|
301
261
|
}
|
|
302
262
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiCalendarSpin, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
303
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.18", type: TuiCalendarSpin, isStandalone: true, selector: "tui-calendar-spin", inputs: { value: "value", min: "min", max: "max" }, outputs: {
|
|
263
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.18", type: TuiCalendarSpin, isStandalone: true, selector: "tui-calendar-spin", inputs: { value: { classPropertyName: "value", publicName: "value", 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 } }, outputs: { value: "valueChange", yearClick: "yearClick" }, ngImport: i0, template: "<tui-spin-button\n [focusable]=\"false\"\n [leftDisabled]=\"value().monthSameOrBefore(min())\"\n [rightDisabled]=\"value().monthSameOrAfter(max())\"\n (leftClick)=\"append({month: -1})\"\n (rightClick)=\"append({month: 1})\"\n>\n {{ months()[value().month] }}\n @if (min().year === max().year) {\n {{ value().formattedYear }}\n } @else {\n <button\n tabIndex=\"-1\"\n tuiLink\n type=\"button\"\n (click)=\"yearClick.emit(value())\"\n >\n {{ value().formattedYear }}\n </button>\n }\n</tui-spin-button>\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "directive", type: TuiLink, selector: "a[tuiLink], button[tuiLink]" }, { kind: "component", type: TuiSpinButton, selector: "tui-spin-button", inputs: ["focusable", "disabled", "leftDisabled", "rightDisabled"], outputs: ["leftClick", "rightClick"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
304
264
|
}
|
|
305
265
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiCalendarSpin, decorators: [{
|
|
306
266
|
type: Component,
|
|
307
|
-
args: [{ selector: 'tui-calendar-spin', imports: [TuiLink, TuiSpinButton], changeDetection: ChangeDetectionStrategy.OnPush, template: "<tui-spin-button\n [focusable]=\"false\"\n [leftDisabled]=\"value.monthSameOrBefore(min)\"\n [rightDisabled]=\"value.monthSameOrAfter(max)\"\n (leftClick)=\"append({month: -1})\"\n (rightClick)=\"append({month: 1})\"\n>\n {{ months()[value.month] }}\n @if (min.year === max.year) {\n {{ value.formattedYear }}\n } @else {\n <button\n tabIndex=\"-1\"\n tuiLink\n type=\"button\"\n (click)=\"
|
|
308
|
-
}]
|
|
309
|
-
type: Input
|
|
310
|
-
}], min: [{
|
|
311
|
-
type: Input
|
|
312
|
-
}], max: [{
|
|
313
|
-
type: Input
|
|
314
|
-
}], valueChange: [{
|
|
315
|
-
type: Output
|
|
316
|
-
}], yearClick: [{
|
|
317
|
-
type: Output
|
|
318
|
-
}] } });
|
|
267
|
+
args: [{ selector: 'tui-calendar-spin', imports: [TuiLink, TuiSpinButton], changeDetection: ChangeDetectionStrategy.OnPush, template: "<tui-spin-button\n [focusable]=\"false\"\n [leftDisabled]=\"value().monthSameOrBefore(min())\"\n [rightDisabled]=\"value().monthSameOrAfter(max())\"\n (leftClick)=\"append({month: -1})\"\n (rightClick)=\"append({month: 1})\"\n>\n {{ months()[value().month] }}\n @if (min().year === max().year) {\n {{ value().formattedYear }}\n } @else {\n <button\n tabIndex=\"-1\"\n tuiLink\n type=\"button\"\n (click)=\"yearClick.emit(value())\"\n >\n {{ value().formattedYear }}\n </button>\n }\n</tui-spin-button>\n", styles: [":host{display:block}\n"] }]
|
|
268
|
+
}] });
|
|
319
269
|
|
|
320
270
|
const LIMIT = 100;
|
|
321
271
|
const ITEMS_IN_ROW = 4;
|
|
@@ -323,35 +273,36 @@ const CURRENT_YEAR = TuiMonth.currentLocal().year;
|
|
|
323
273
|
class TuiCalendarYear {
|
|
324
274
|
constructor() {
|
|
325
275
|
this.hoveredItem = signal(null);
|
|
326
|
-
this.
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
this.
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
this.
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
this.min
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
276
|
+
this.calculatedMin = computed(() => {
|
|
277
|
+
const initial = this.initialItem() - LIMIT;
|
|
278
|
+
const min = this.min() ?? MIN_YEAR;
|
|
279
|
+
return min > initial ? min : initial;
|
|
280
|
+
});
|
|
281
|
+
this.calculatedMax = computed(() => {
|
|
282
|
+
const initial = this.initialItem() + LIMIT;
|
|
283
|
+
const max = this.max() ?? MAX_YEAR;
|
|
284
|
+
return max < initial ? max + 1 : initial;
|
|
285
|
+
});
|
|
286
|
+
this.isRangePicking = computed((x = this.value()) => this.rangeMode() && (x instanceof TuiDay || x instanceof TuiMonth));
|
|
287
|
+
this.rows = computed(() => Math.ceil((this.calculatedMax() - this.calculatedMin()) / ITEMS_IN_ROW));
|
|
288
|
+
this.rangeMode = input(false);
|
|
289
|
+
this.disabledItemHandler = input(inject(TUI_ITEMS_HANDLERS).disabledItemHandler());
|
|
290
|
+
this.value = input(null);
|
|
291
|
+
this.min = input(MIN_YEAR, {
|
|
292
|
+
transform: (x) => x ?? MIN_YEAR,
|
|
293
|
+
});
|
|
294
|
+
this.max = input(MAX_YEAR, {
|
|
295
|
+
transform: (x) => x ?? MAX_YEAR,
|
|
296
|
+
});
|
|
297
|
+
this.initialItem = input(CURRENT_YEAR, {
|
|
298
|
+
transform: (x) => x ?? CURRENT_YEAR,
|
|
299
|
+
});
|
|
300
|
+
this.yearClick = output();
|
|
350
301
|
}
|
|
351
302
|
isDisabled(item) {
|
|
352
303
|
return ((this.max() && this.max() < item) ||
|
|
353
304
|
(this.min() && this.min() > item) ||
|
|
354
|
-
this.disabledItemHandler(item));
|
|
305
|
+
this.disabledItemHandler()(item));
|
|
355
306
|
}
|
|
356
307
|
getItemRange(item) {
|
|
357
308
|
const value = this.value();
|
|
@@ -384,53 +335,22 @@ class TuiCalendarYear {
|
|
|
384
335
|
onItemHovered(hovered, item) {
|
|
385
336
|
this.hoveredItem.set(hovered ? item : null);
|
|
386
337
|
}
|
|
387
|
-
get rows() {
|
|
388
|
-
return Math.ceil((this.calculatedMax - this.calculatedMin) / ITEMS_IN_ROW);
|
|
389
|
-
}
|
|
390
338
|
scrollItemIntoView(item) {
|
|
391
339
|
return this.initialItem() === item;
|
|
392
340
|
}
|
|
393
341
|
getItem(rowIndex, colIndex) {
|
|
394
|
-
return rowIndex * ITEMS_IN_ROW + colIndex + this.calculatedMin;
|
|
342
|
+
return rowIndex * ITEMS_IN_ROW + colIndex + this.calculatedMin();
|
|
395
343
|
}
|
|
396
344
|
itemIsToday(item) {
|
|
397
345
|
return CURRENT_YEAR === item;
|
|
398
346
|
}
|
|
399
|
-
get calculatedMin() {
|
|
400
|
-
const initial = this.initialItem() - LIMIT;
|
|
401
|
-
const min = this.min() ?? MIN_YEAR;
|
|
402
|
-
return min > initial ? min : initial;
|
|
403
|
-
}
|
|
404
|
-
get calculatedMax() {
|
|
405
|
-
const initial = this.initialItem() + LIMIT;
|
|
406
|
-
const max = this.max() ?? MAX_YEAR;
|
|
407
|
-
return max < initial ? max + 1 : initial;
|
|
408
|
-
}
|
|
409
347
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiCalendarYear, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
410
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.18", type: TuiCalendarYear, isStandalone: true, selector: "tui-calendar-year", inputs: { rangeMode: "rangeMode", disabledItemHandler: "disabledItemHandler",
|
|
348
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.18", type: TuiCalendarYear, isStandalone: true, selector: "tui-calendar-year", inputs: { rangeMode: { classPropertyName: "rangeMode", publicName: "rangeMode", 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 }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, initialItem: { classPropertyName: "initialItem", publicName: "initialItem", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { yearClick: "yearClick" }, host: { properties: { "class._picking": "isRangePicking()" } }, providers: [tuiAsAuxiliary(TuiCalendarYear)], ngImport: i0, template: "@for (_ of '-'.repeat(rows()); track $index) {\n @let rowIndex = $index;\n <div\n automation-id=\"tui-calendar-year__row\"\n class=\"t-row\"\n >\n @for (_ of '-'.repeat(4); track $index) {\n @let item = getItem(rowIndex, $index);\n <div\n automation-id=\"tui-calendar-year__cell\"\n class=\"t-cell\"\n [attr.data-range]=\"getItemRange(item)\"\n [class.t-cell_disabled]=\"isDisabled(item)\"\n [class.t-cell_today]=\"itemIsToday(item)\"\n [tuiScrollIntoView]=\"scrollItemIntoView(item)\"\n (click)=\"yearClick.emit(item)\"\n (tuiHoveredChange)=\"onItemHovered($event, item)\"\n >\n {{ item }}\n </div>\n }\n </div>\n}\n", styles: [".t-row{display:flex;justify-content:flex-start;font:var(--tui-typography-body-m)}.t-row:first-child{justify-content:flex-end}.t-row:last-child{justify-content:flex-start}.t-cell{position:relative;display:flex;align-items:center;justify-content:center;line-height:2rem;isolation:isolate;cursor:pointer;overflow:hidden;border:.125rem solid transparent;box-sizing:border-box;mask:linear-gradient(transparent calc(50% - 1rem),#000 calc(50% - 1rem),#000 calc(50% + 1rem),transparent calc(50% + 1rem))}.t-cell:first-child{border-inline-start-color:transparent!important}.t-cell:last-child{border-inline-end-color:transparent!important}.t-cell:before,.t-cell:after{position:absolute;inset:0;content:\"\";z-index:-1;border-radius:var(--tui-radius-m)}.t-cell:after{mask:url('data:image/svg+xml,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 12 32\"><path d=\"M0.2856 0L0.6763 0C2.9265 0 4.9876 1.259 6.0147 3.2611L10.2442 11.5048C11.5301 14.0113 11.5683 16.9754 10.3472 19.5141L5.9766 28.6007C4.9772 30.6786 2.8754 32 0.5696 32H0.285645V0Z\"></path></svg>') right / .75rem 100% no-repeat,linear-gradient(#000,#000) left / calc(100% - .7rem) 100% no-repeat}.t-cell[data-range]:before{background:var(--tui-background-neutral-1)}:host._picking .t-cell[data-range]:before{background:var(--tui-background-neutral-1-hover)}.t-cell[data-range=middle]{border-color:var(--tui-background-neutral-1)}:host._picking .t-cell[data-range=middle]{border-color:var(--tui-background-neutral-1-hover)}.t-cell[data-range=middle]:not(:first-child):before{border-top-left-radius:0;border-bottom-left-radius:0}.t-cell[data-range=middle]:not(:last-child):before{border-top-right-radius:0;border-bottom-right-radius:0}.t-cell[data-range=start]{border-inline-end-color:var(--tui-background-neutral-1);color:var(--tui-text-primary-on-accent-1)}:host._picking .t-cell[data-range=start]{border-inline-end-color:var(--tui-background-neutral-1-hover)}.t-cell[data-range=start]:not(:last-child):before{right:-1rem}.t-cell[data-range=start]:after{background:var(--tui-background-accent-1)}.t-cell[data-range=end]{border-inline-start-color:var(--tui-background-neutral-1);color:var(--tui-text-primary-on-accent-1)}:host._picking .t-cell[data-range=end]{border-inline-start-color:var(--tui-background-neutral-1-hover)}.t-cell[data-range=end]:not(:first-child):before{left:-1rem}.t-cell[data-range=end]:after{background:var(--tui-background-accent-1);transform:scaleX(-1)}.t-cell[data-range=active]{color:var(--tui-text-primary-on-accent-1)}.t-cell[data-range=active]:after{background:var(--tui-background-accent-1);mask:none}.t-cell_disabled{opacity:var(--tui-disabled-opacity);pointer-events:none}.t-cell_today{text-decoration:underline;text-underline-offset:.25rem}@media (hover: hover) and (pointer: fine){.t-cell:hover:not([data-range=start]):not([data-range=end]):before{background:var(--tui-background-neutral-1-hover)}.t-cell[data-range=start]:hover:after,.t-cell[data-range=end]:hover:after,.t-cell[data-range=active]:hover:after{background:var(--tui-background-accent-1-hover)}}:host{display:block;padding-inline-end:1rem;inline-size:15.75rem;padding:0 1.125rem}.t-cell{flex:1;border-block-start-width:.5rem;border-block-end-width:.5rem}\n"], dependencies: [{ kind: "directive", type: TuiHovered, selector: "[tuiHoveredChange]", outputs: ["tuiHoveredChange"] }, { kind: "directive", type: TuiScrollIntoView, selector: "[tuiScrollIntoView]", inputs: ["tuiScrollIntoView"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
411
349
|
}
|
|
412
350
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiCalendarYear, decorators: [{
|
|
413
351
|
type: Component,
|
|
414
|
-
args: [{ selector: 'tui-calendar-year', imports: [TuiHovered, TuiScrollIntoView], changeDetection: ChangeDetectionStrategy.OnPush, providers: [tuiAsAuxiliary(TuiCalendarYear)], host: { '[class._picking]': 'isRangePicking()' }, template: "@for (_ of '-'.repeat(rows); track $index) {\n @let rowIndex = $index;\n <div\n automation-id=\"tui-calendar-year__row\"\n class=\"t-row\"\n >\n @for (_ of '-'.repeat(4); track $index) {\n @let item = getItem(rowIndex, $index);\n <div\n automation-id=\"tui-calendar-year__cell\"\n class=\"t-cell\"\n [attr.data-range]=\"getItemRange(item)\"\n [class.t-cell_disabled]=\"isDisabled(item)\"\n [class.t-cell_today]=\"itemIsToday(item)\"\n [tuiScrollIntoView]=\"scrollItemIntoView(item)\"\n (click)=\"yearClick.emit(item)\"\n (tuiHoveredChange)=\"onItemHovered($event, item)\"\n >\n {{ item }}\n </div>\n }\n </div>\n}\n", styles: [".t-row{display:flex;justify-content:flex-start;font:var(--tui-
|
|
415
|
-
}]
|
|
416
|
-
type: Input
|
|
417
|
-
}], disabledItemHandler: [{
|
|
418
|
-
type: Input
|
|
419
|
-
}], yearClick: [{
|
|
420
|
-
type: Output
|
|
421
|
-
}], initialItemSetter: [{
|
|
422
|
-
type: Input,
|
|
423
|
-
args: [{ alias: 'initialItem', transform: (x) => x ?? CURRENT_YEAR }]
|
|
424
|
-
}], minSetter: [{
|
|
425
|
-
type: Input,
|
|
426
|
-
args: [{ alias: 'min', transform: (x) => x ?? MIN_YEAR }]
|
|
427
|
-
}], maxSetter: [{
|
|
428
|
-
type: Input,
|
|
429
|
-
args: [{ alias: 'max', transform: (x) => x ?? MAX_YEAR }]
|
|
430
|
-
}], valueSetter: [{
|
|
431
|
-
type: Input,
|
|
432
|
-
args: ['value']
|
|
433
|
-
}] } });
|
|
352
|
+
args: [{ selector: 'tui-calendar-year', imports: [TuiHovered, TuiScrollIntoView], changeDetection: ChangeDetectionStrategy.OnPush, providers: [tuiAsAuxiliary(TuiCalendarYear)], host: { '[class._picking]': 'isRangePicking()' }, template: "@for (_ of '-'.repeat(rows()); track $index) {\n @let rowIndex = $index;\n <div\n automation-id=\"tui-calendar-year__row\"\n class=\"t-row\"\n >\n @for (_ of '-'.repeat(4); track $index) {\n @let item = getItem(rowIndex, $index);\n <div\n automation-id=\"tui-calendar-year__cell\"\n class=\"t-cell\"\n [attr.data-range]=\"getItemRange(item)\"\n [class.t-cell_disabled]=\"isDisabled(item)\"\n [class.t-cell_today]=\"itemIsToday(item)\"\n [tuiScrollIntoView]=\"scrollItemIntoView(item)\"\n (click)=\"yearClick.emit(item)\"\n (tuiHoveredChange)=\"onItemHovered($event, item)\"\n >\n {{ item }}\n </div>\n }\n </div>\n}\n", styles: [".t-row{display:flex;justify-content:flex-start;font:var(--tui-typography-body-m)}.t-row:first-child{justify-content:flex-end}.t-row:last-child{justify-content:flex-start}.t-cell{position:relative;display:flex;align-items:center;justify-content:center;line-height:2rem;isolation:isolate;cursor:pointer;overflow:hidden;border:.125rem solid transparent;box-sizing:border-box;mask:linear-gradient(transparent calc(50% - 1rem),#000 calc(50% - 1rem),#000 calc(50% + 1rem),transparent calc(50% + 1rem))}.t-cell:first-child{border-inline-start-color:transparent!important}.t-cell:last-child{border-inline-end-color:transparent!important}.t-cell:before,.t-cell:after{position:absolute;inset:0;content:\"\";z-index:-1;border-radius:var(--tui-radius-m)}.t-cell:after{mask:url('data:image/svg+xml,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 12 32\"><path d=\"M0.2856 0L0.6763 0C2.9265 0 4.9876 1.259 6.0147 3.2611L10.2442 11.5048C11.5301 14.0113 11.5683 16.9754 10.3472 19.5141L5.9766 28.6007C4.9772 30.6786 2.8754 32 0.5696 32H0.285645V0Z\"></path></svg>') right / .75rem 100% no-repeat,linear-gradient(#000,#000) left / calc(100% - .7rem) 100% no-repeat}.t-cell[data-range]:before{background:var(--tui-background-neutral-1)}:host._picking .t-cell[data-range]:before{background:var(--tui-background-neutral-1-hover)}.t-cell[data-range=middle]{border-color:var(--tui-background-neutral-1)}:host._picking .t-cell[data-range=middle]{border-color:var(--tui-background-neutral-1-hover)}.t-cell[data-range=middle]:not(:first-child):before{border-top-left-radius:0;border-bottom-left-radius:0}.t-cell[data-range=middle]:not(:last-child):before{border-top-right-radius:0;border-bottom-right-radius:0}.t-cell[data-range=start]{border-inline-end-color:var(--tui-background-neutral-1);color:var(--tui-text-primary-on-accent-1)}:host._picking .t-cell[data-range=start]{border-inline-end-color:var(--tui-background-neutral-1-hover)}.t-cell[data-range=start]:not(:last-child):before{right:-1rem}.t-cell[data-range=start]:after{background:var(--tui-background-accent-1)}.t-cell[data-range=end]{border-inline-start-color:var(--tui-background-neutral-1);color:var(--tui-text-primary-on-accent-1)}:host._picking .t-cell[data-range=end]{border-inline-start-color:var(--tui-background-neutral-1-hover)}.t-cell[data-range=end]:not(:first-child):before{left:-1rem}.t-cell[data-range=end]:after{background:var(--tui-background-accent-1);transform:scaleX(-1)}.t-cell[data-range=active]{color:var(--tui-text-primary-on-accent-1)}.t-cell[data-range=active]:after{background:var(--tui-background-accent-1);mask:none}.t-cell_disabled{opacity:var(--tui-disabled-opacity);pointer-events:none}.t-cell_today{text-decoration:underline;text-underline-offset:.25rem}@media (hover: hover) and (pointer: fine){.t-cell:hover:not([data-range=start]):not([data-range=end]):before{background:var(--tui-background-neutral-1-hover)}.t-cell[data-range=start]:hover:after,.t-cell[data-range=end]:hover:after,.t-cell[data-range=active]:hover:after{background:var(--tui-background-accent-1-hover)}}:host{display:block;padding-inline-end:1rem;inline-size:15.75rem;padding:0 1.125rem}.t-cell{flex:1;border-block-start-width:.5rem;border-block-end-width:.5rem}\n"] }]
|
|
353
|
+
}] });
|
|
434
354
|
|
|
435
355
|
class TuiCalendar {
|
|
436
356
|
constructor() {
|
|
@@ -440,10 +360,24 @@ class TuiCalendar {
|
|
|
440
360
|
this.options = inject(TUI_CALENDAR_SHEET_OPTIONS);
|
|
441
361
|
this.month = TuiMonth.currentLocal();
|
|
442
362
|
this.disabledItemHandler = inject(TUI_ITEMS_HANDLERS).disabledItemHandler();
|
|
443
|
-
this.min = TUI_FIRST_DAY
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
this.
|
|
363
|
+
this.min = input(TUI_FIRST_DAY, {
|
|
364
|
+
transform: (x) => x ?? TUI_FIRST_DAY,
|
|
365
|
+
});
|
|
366
|
+
this.max = input(TUI_LAST_DAY, {
|
|
367
|
+
transform: (x) => x ?? TUI_LAST_DAY,
|
|
368
|
+
});
|
|
369
|
+
this.minViewedMonth = input(TUI_FIRST_DAY);
|
|
370
|
+
this.maxViewedMonth = input(TUI_LAST_DAY);
|
|
371
|
+
this.computedMinViewedMonth = computed(() => {
|
|
372
|
+
const min = this.min();
|
|
373
|
+
const minViewed = this.minViewedMonth() ?? TUI_FIRST_DAY;
|
|
374
|
+
return minViewed.monthSameOrAfter(min) ? minViewed : min;
|
|
375
|
+
});
|
|
376
|
+
this.computedMaxViewedMonth = computed(() => {
|
|
377
|
+
const max = this.max();
|
|
378
|
+
const maxViewed = this.maxViewedMonth() ?? TUI_LAST_DAY;
|
|
379
|
+
return maxViewed.monthSameOrBefore(max) ? maxViewed : max;
|
|
380
|
+
});
|
|
447
381
|
this.hoveredItem = null;
|
|
448
382
|
this.showAdjacent = true;
|
|
449
383
|
this.markerHandler = null;
|
|
@@ -479,22 +413,6 @@ class TuiCalendar {
|
|
|
479
413
|
onHoveredItemChange(day) {
|
|
480
414
|
this.updateHoveredDay(day);
|
|
481
415
|
}
|
|
482
|
-
get computedMin() {
|
|
483
|
-
return this.min ?? TUI_FIRST_DAY;
|
|
484
|
-
}
|
|
485
|
-
get computedMax() {
|
|
486
|
-
return this.max ?? TUI_LAST_DAY;
|
|
487
|
-
}
|
|
488
|
-
get computedMinViewedMonth() {
|
|
489
|
-
const min = this.computedMin;
|
|
490
|
-
const minViewed = this.minViewedMonth ?? TUI_FIRST_DAY;
|
|
491
|
-
return minViewed.monthSameOrAfter(min) ? minViewed : min;
|
|
492
|
-
}
|
|
493
|
-
get computedMaxViewedMonth() {
|
|
494
|
-
const max = this.computedMax;
|
|
495
|
-
const maxViewed = this.maxViewedMonth ?? TUI_LAST_DAY;
|
|
496
|
-
return maxViewed.monthSameOrBefore(max) ? maxViewed : max;
|
|
497
|
-
}
|
|
498
416
|
get isInYearView() {
|
|
499
417
|
return this.view === 'year';
|
|
500
418
|
}
|
|
@@ -520,7 +438,7 @@ class TuiCalendar {
|
|
|
520
438
|
this.hoveredItemChange.emit(day);
|
|
521
439
|
}
|
|
522
440
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiCalendar, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
523
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.18", type: TuiCalendar, isStandalone: true, selector: "tui-calendar", inputs: { month: "month", disabledItemHandler: "disabledItemHandler", min: "min", max: "max", minViewedMonth: "minViewedMonth", maxViewedMonth: "maxViewedMonth", hoveredItem: "hoveredItem", showAdjacent: "showAdjacent", markerHandler: "markerHandler", value: "value", initialView: "initialView" }, outputs: { dayClick: "dayClick", monthChange: "monthChange", hoveredItemChange: "hoveredItemChange" }, host: { listeners: { "pointerdown.prevent.zoneless": "0" } }, providers: [tuiAsAuxiliary(TuiCalendar)], ngImport: i0, template: "@if (isInYearView) {\n <tui-scrollbar\n automation-id=\"tui-calendar__scrollbar\"\n class=\"t-scrollbar\"\n >\n <tui-calendar-year\n automation-id=\"tui-calendar__year\"\n [initialItem]=\"month.year\"\n [max]=\"
|
|
441
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.18", type: TuiCalendar, isStandalone: true, selector: "tui-calendar", inputs: { month: { classPropertyName: "month", publicName: "month", isSignal: false, isRequired: false, transformFunction: null }, disabledItemHandler: { classPropertyName: "disabledItemHandler", publicName: "disabledItemHandler", isSignal: false, 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 }, minViewedMonth: { classPropertyName: "minViewedMonth", publicName: "minViewedMonth", isSignal: true, isRequired: false, transformFunction: null }, maxViewedMonth: { classPropertyName: "maxViewedMonth", publicName: "maxViewedMonth", isSignal: true, isRequired: false, transformFunction: null }, hoveredItem: { classPropertyName: "hoveredItem", publicName: "hoveredItem", isSignal: false, isRequired: false, transformFunction: null }, showAdjacent: { classPropertyName: "showAdjacent", publicName: "showAdjacent", isSignal: false, isRequired: false, transformFunction: null }, markerHandler: { classPropertyName: "markerHandler", publicName: "markerHandler", isSignal: false, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: false, isRequired: false, transformFunction: null }, initialView: { classPropertyName: "initialView", publicName: "initialView", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { dayClick: "dayClick", monthChange: "monthChange", hoveredItemChange: "hoveredItemChange" }, host: { listeners: { "pointerdown.prevent.zoneless": "0" } }, providers: [tuiAsAuxiliary(TuiCalendar)], ngImport: i0, template: "@if (isInYearView) {\n <tui-scrollbar\n automation-id=\"tui-calendar__scrollbar\"\n class=\"t-scrollbar\"\n >\n <tui-calendar-year\n automation-id=\"tui-calendar__year\"\n [initialItem]=\"month.year\"\n [max]=\"max().year\"\n [min]=\"min().year\"\n [rangeMode]=\"options.rangeMode\"\n [value]=\"value\"\n (yearClick)=\"onPickerYearClick($event)\"\n />\n </tui-scrollbar>\n} @else {\n <tui-calendar-spin\n automation-id=\"tui-calendar__pagination\"\n class=\"t-pagination\"\n [max]=\"computedMaxViewedMonth()\"\n [min]=\"computedMinViewedMonth()\"\n [value]=\"month\"\n (valueChange)=\"onPaginationValueChange($event)\"\n (yearClick)=\"onPaginationYearClick()\"\n />\n <tui-calendar-sheet\n automation-id=\"tui-calendar__calendar\"\n [disabledItemHandler]=\"disabledItemHandler | tuiMapper: disabledItemHandlerMapper : min() : max()\"\n [hoveredItem]=\"hoveredItem\"\n [markerHandler]=\"markerHandler\"\n [month]=\"month\"\n [showAdjacent]=\"showAdjacent\"\n [value]=\"value\"\n (dayClick)=\"onDayClick($event)\"\n (hoveredItemChange)=\"onHoveredItemChange($event)\"\n />\n}\n", styles: [":host{display:block;min-block-size:20.25rem;inline-size:18rem;padding:1rem 1.125rem;box-sizing:border-box;flex-shrink:0}:host-context(tui-sheet-dialog){inline-size:100%}tui-calendar-year{padding:0}.t-scrollbar{block-size:18.25rem;inline-size:calc(100% + 1rem)}.t-pagination{margin-block-end:1rem}\n"], dependencies: [{ kind: "component", type: TuiCalendarSheet, selector: "tui-calendar-sheet", inputs: ["month", "disabledItemHandler", "markerHandler", "value", "showAdjacent", "hoveredItem", "single"], outputs: ["hoveredItemChange", "dayClick"] }, { kind: "component", type: TuiCalendarSpin, selector: "tui-calendar-spin", inputs: ["value", "min", "max"], outputs: ["valueChange", "yearClick"] }, { kind: "component", type: TuiCalendarYear, selector: "tui-calendar-year", inputs: ["rangeMode", "disabledItemHandler", "value", "min", "max", "initialItem"], outputs: ["yearClick"] }, { kind: "pipe", type: TuiMapperPipe, name: "tuiMapper" }, { kind: "component", type: TuiScrollbar, selector: "tui-scrollbar" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
524
442
|
}
|
|
525
443
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiCalendar, decorators: [{
|
|
526
444
|
type: Component,
|
|
@@ -530,19 +448,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImpo
|
|
|
530
448
|
TuiCalendarYear,
|
|
531
449
|
TuiMapperPipe,
|
|
532
450
|
TuiScrollbar,
|
|
533
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, providers: [tuiAsAuxiliary(TuiCalendar)], host: { '(pointerdown.prevent.zoneless)': '0' }, template: "@if (isInYearView) {\n <tui-scrollbar\n automation-id=\"tui-calendar__scrollbar\"\n class=\"t-scrollbar\"\n >\n <tui-calendar-year\n automation-id=\"tui-calendar__year\"\n [initialItem]=\"month.year\"\n [max]=\"
|
|
451
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, providers: [tuiAsAuxiliary(TuiCalendar)], host: { '(pointerdown.prevent.zoneless)': '0' }, template: "@if (isInYearView) {\n <tui-scrollbar\n automation-id=\"tui-calendar__scrollbar\"\n class=\"t-scrollbar\"\n >\n <tui-calendar-year\n automation-id=\"tui-calendar__year\"\n [initialItem]=\"month.year\"\n [max]=\"max().year\"\n [min]=\"min().year\"\n [rangeMode]=\"options.rangeMode\"\n [value]=\"value\"\n (yearClick)=\"onPickerYearClick($event)\"\n />\n </tui-scrollbar>\n} @else {\n <tui-calendar-spin\n automation-id=\"tui-calendar__pagination\"\n class=\"t-pagination\"\n [max]=\"computedMaxViewedMonth()\"\n [min]=\"computedMinViewedMonth()\"\n [value]=\"month\"\n (valueChange)=\"onPaginationValueChange($event)\"\n (yearClick)=\"onPaginationYearClick()\"\n />\n <tui-calendar-sheet\n automation-id=\"tui-calendar__calendar\"\n [disabledItemHandler]=\"disabledItemHandler | tuiMapper: disabledItemHandlerMapper : min() : max()\"\n [hoveredItem]=\"hoveredItem\"\n [markerHandler]=\"markerHandler\"\n [month]=\"month\"\n [showAdjacent]=\"showAdjacent\"\n [value]=\"value\"\n (dayClick)=\"onDayClick($event)\"\n (hoveredItemChange)=\"onHoveredItemChange($event)\"\n />\n}\n", styles: [":host{display:block;min-block-size:20.25rem;inline-size:18rem;padding:1rem 1.125rem;box-sizing:border-box;flex-shrink:0}:host-context(tui-sheet-dialog){inline-size:100%}tui-calendar-year{padding:0}.t-scrollbar{block-size:18.25rem;inline-size:calc(100% + 1rem)}.t-pagination{margin-block-end:1rem}\n"] }]
|
|
534
452
|
}], propDecorators: { month: [{
|
|
535
453
|
type: Input
|
|
536
454
|
}], disabledItemHandler: [{
|
|
537
455
|
type: Input
|
|
538
|
-
}], min: [{
|
|
539
|
-
type: Input
|
|
540
|
-
}], max: [{
|
|
541
|
-
type: Input
|
|
542
|
-
}], minViewedMonth: [{
|
|
543
|
-
type: Input
|
|
544
|
-
}], maxViewedMonth: [{
|
|
545
|
-
type: Input
|
|
546
456
|
}], hoveredItem: [{
|
|
547
457
|
type: Input
|
|
548
458
|
}], showAdjacent: [{
|