@tectra-ng/ui 0.1.2 → 0.1.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/README.md +36 -19
- package/accordion/README.md +61 -0
- package/analog-clock/README.md +31 -0
- package/breadcrumb/README.md +57 -0
- package/countdown/README.md +45 -0
- package/datepicker/README.md +109 -0
- package/export/README.md +79 -0
- package/export-font/OFL.txt +93 -0
- package/export-font/README.md +7 -0
- package/fesm2022/tectra-ng-ui-accordion.mjs +980 -0
- package/fesm2022/tectra-ng-ui-accordion.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-analog-clock.mjs +386 -0
- package/fesm2022/tectra-ng-ui-analog-clock.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-autocomplete.mjs +2 -2
- package/fesm2022/tectra-ng-ui-autocomplete.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-breadcrumb.mjs +382 -0
- package/fesm2022/tectra-ng-ui-breadcrumb.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-cascade-select.mjs +2 -2
- package/fesm2022/tectra-ng-ui-cascade-select.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-chips-input.mjs +2 -2
- package/fesm2022/tectra-ng-ui-chips-input.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-color-picker.mjs +2 -2
- package/fesm2022/tectra-ng-ui-color-picker.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-countdown.mjs +513 -0
- package/fesm2022/tectra-ng-ui-countdown.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-datepicker.mjs +2640 -0
- package/fesm2022/tectra-ng-ui-datepicker.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-export-font.mjs +7 -0
- package/fesm2022/tectra-ng-ui-export-font.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-export.mjs +2574 -0
- package/fesm2022/tectra-ng-ui-export.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-field.mjs +1 -1
- package/fesm2022/tectra-ng-ui-field.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-file-upload.mjs +1452 -0
- package/fesm2022/tectra-ng-ui-file-upload.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-input-group.mjs +2 -2
- package/fesm2022/tectra-ng-ui-input-group.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-input.mjs +2 -2
- package/fesm2022/tectra-ng-ui-input.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-label.mjs +4 -4
- package/fesm2022/tectra-ng-ui-label.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-listbox.mjs +2 -2
- package/fesm2022/tectra-ng-ui-listbox.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-menubar.mjs +742 -0
- package/fesm2022/tectra-ng-ui-menubar.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-month-calendar.mjs +601 -0
- package/fesm2022/tectra-ng-ui-month-calendar.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-multiselect.mjs +2 -2
- package/fesm2022/tectra-ng-ui-multiselect.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-panel-menu.mjs +610 -0
- package/fesm2022/tectra-ng-ui-panel-menu.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-scroll-panel.mjs +319 -0
- package/fesm2022/tectra-ng-ui-scroll-panel.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-select.mjs +2 -2
- package/fesm2022/tectra-ng-ui-select.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-sparkline.mjs +240 -0
- package/fesm2022/tectra-ng-ui-sparkline.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-splitter.mjs +750 -0
- package/fesm2022/tectra-ng-ui-splitter.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-stat-tiles.mjs +661 -0
- package/fesm2022/tectra-ng-ui-stat-tiles.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-stepper.mjs +1166 -0
- package/fesm2022/tectra-ng-ui-stepper.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-table.mjs +195 -71
- package/fesm2022/tectra-ng-ui-table.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-tabs.mjs +1218 -0
- package/fesm2022/tectra-ng-ui-tabs.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-textarea.mjs +4 -1
- package/fesm2022/tectra-ng-ui-textarea.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-timeline.mjs +407 -0
- package/fesm2022/tectra-ng-ui-timeline.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-toolbar.mjs +348 -0
- package/fesm2022/tectra-ng-ui-toolbar.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-tree-select.mjs +2 -2
- package/fesm2022/tectra-ng-ui-tree-select.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-tree-table.mjs +80 -2
- package/fesm2022/tectra-ng-ui-tree-table.mjs.map +1 -1
- package/field/README.md +1 -1
- package/file-upload/README.md +85 -0
- package/menubar/README.md +51 -0
- package/month-calendar/README.md +46 -0
- package/package.json +80 -4
- package/panel-menu/README.md +45 -0
- package/scroll-panel/README.md +35 -0
- package/sparkline/README.md +27 -0
- package/splitter/README.md +62 -0
- package/stat-tiles/README.md +53 -0
- package/stepper/README.md +66 -0
- package/table/README.md +1 -1
- package/tabs/README.md +69 -0
- package/timeline/README.md +42 -0
- package/toolbar/README.md +35 -0
- package/types/tectra-ng-ui-accordion.d.ts +304 -0
- package/types/tectra-ng-ui-accordion.d.ts.map +1 -0
- package/types/tectra-ng-ui-analog-clock.d.ts +127 -0
- package/types/tectra-ng-ui-analog-clock.d.ts.map +1 -0
- package/types/tectra-ng-ui-breadcrumb.d.ts +157 -0
- package/types/tectra-ng-ui-breadcrumb.d.ts.map +1 -0
- package/types/tectra-ng-ui-countdown.d.ts +150 -0
- package/types/tectra-ng-ui-countdown.d.ts.map +1 -0
- package/types/tectra-ng-ui-datepicker.d.ts +801 -0
- package/types/tectra-ng-ui-datepicker.d.ts.map +1 -0
- package/types/tectra-ng-ui-export-font.d.ts +5 -0
- package/types/tectra-ng-ui-export-font.d.ts.map +1 -0
- package/types/tectra-ng-ui-export.d.ts +427 -0
- package/types/tectra-ng-ui-export.d.ts.map +1 -0
- package/types/tectra-ng-ui-file-upload.d.ts +527 -0
- package/types/tectra-ng-ui-file-upload.d.ts.map +1 -0
- package/types/tectra-ng-ui-menubar.d.ts +201 -0
- package/types/tectra-ng-ui-menubar.d.ts.map +1 -0
- package/types/tectra-ng-ui-month-calendar.d.ts +287 -0
- package/types/tectra-ng-ui-month-calendar.d.ts.map +1 -0
- package/types/tectra-ng-ui-panel-menu.d.ts +244 -0
- package/types/tectra-ng-ui-panel-menu.d.ts.map +1 -0
- package/types/tectra-ng-ui-scroll-panel.d.ts +94 -0
- package/types/tectra-ng-ui-scroll-panel.d.ts.map +1 -0
- package/types/tectra-ng-ui-sparkline.d.ts +80 -0
- package/types/tectra-ng-ui-sparkline.d.ts.map +1 -0
- package/types/tectra-ng-ui-splitter.d.ts +226 -0
- package/types/tectra-ng-ui-splitter.d.ts.map +1 -0
- package/types/tectra-ng-ui-stat-tiles.d.ts +287 -0
- package/types/tectra-ng-ui-stat-tiles.d.ts.map +1 -0
- package/types/tectra-ng-ui-stepper.d.ts +446 -0
- package/types/tectra-ng-ui-stepper.d.ts.map +1 -0
- package/types/tectra-ng-ui-table.d.ts +2 -4
- package/types/tectra-ng-ui-table.d.ts.map +1 -1
- package/types/tectra-ng-ui-tabs.d.ts +420 -0
- package/types/tectra-ng-ui-tabs.d.ts.map +1 -0
- package/types/tectra-ng-ui-textarea.d.ts +1 -0
- package/types/tectra-ng-ui-textarea.d.ts.map +1 -1
- package/types/tectra-ng-ui-timeline.d.ts +129 -0
- package/types/tectra-ng-ui-timeline.d.ts.map +1 -0
- package/types/tectra-ng-ui-toolbar.d.ts +85 -0
- package/types/tectra-ng-ui-toolbar.d.ts.map +1 -0
- package/types/tectra-ng-ui-tree-table.d.ts.map +1 -1
|
@@ -0,0 +1,601 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { ChangeDetectionStrategy, Component, Directive, ElementRef, TemplateRef, computed, contentChild, inject, input, linkedSignal, numberAttribute, output } from "@angular/core";
|
|
3
|
+
import { NgTemplateOutlet } from "@angular/common";
|
|
4
|
+
import { injectPassThrough, injectUnstyled } from "@tectra-ng/core/config";
|
|
5
|
+
import { TxLocaleService, injectTranslations } from "@tectra-ng/core/i18n";
|
|
6
|
+
import { optionalBoolean } from "@tectra-ng/core/utils";
|
|
7
|
+
import { toStyleObject } from "@tectra-ng/themes";
|
|
8
|
+
import { TxAvatar } from "@tectra-ng/ui/avatar";
|
|
9
|
+
import { TxPill } from "@tectra-ng/ui/pill";
|
|
10
|
+
var TxMonthCalendarEventTemplate = class TxMonthCalendarEventTemplate {
|
|
11
|
+
templateRef = inject(TemplateRef);
|
|
12
|
+
static ngTemplateContextGuard(_directive, context) {
|
|
13
|
+
return !!context;
|
|
14
|
+
}
|
|
15
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
16
|
+
minVersion: "12.0.0",
|
|
17
|
+
version: "22.2.3",
|
|
18
|
+
ngImport: i0,
|
|
19
|
+
type: TxMonthCalendarEventTemplate,
|
|
20
|
+
deps: [],
|
|
21
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
22
|
+
});
|
|
23
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
24
|
+
minVersion: "14.0.0",
|
|
25
|
+
version: "22.2.3",
|
|
26
|
+
type: TxMonthCalendarEventTemplate,
|
|
27
|
+
isStandalone: true,
|
|
28
|
+
selector: "ng-template[txMonthCalendarEvent]",
|
|
29
|
+
ngImport: i0
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
33
|
+
minVersion: "12.0.0",
|
|
34
|
+
version: "22.2.3",
|
|
35
|
+
ngImport: i0,
|
|
36
|
+
type: TxMonthCalendarEventTemplate,
|
|
37
|
+
decorators: [{
|
|
38
|
+
type: Directive,
|
|
39
|
+
args: [{ selector: "ng-template[txMonthCalendarEvent]" }]
|
|
40
|
+
}]
|
|
41
|
+
});
|
|
42
|
+
const DAY_MS = 864e5;
|
|
43
|
+
const MAX_DOTS = 3;
|
|
44
|
+
const ISO_DAY = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
45
|
+
function dayIndex(value) {
|
|
46
|
+
if (value === null || value === void 0 || value === "") return null;
|
|
47
|
+
let date;
|
|
48
|
+
const match = typeof value === "string" ? ISO_DAY.exec(value) : null;
|
|
49
|
+
if (match) date = new Date(+match[1], +match[2] - 1, +match[3]);
|
|
50
|
+
else date = new Date(value);
|
|
51
|
+
if (Number.isNaN(date.getTime())) return null;
|
|
52
|
+
return Math.round(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()) / DAY_MS);
|
|
53
|
+
}
|
|
54
|
+
function indexToDate(index) {
|
|
55
|
+
const utc = /* @__PURE__ */ new Date(index * DAY_MS);
|
|
56
|
+
return new Date(utc.getUTCFullYear(), utc.getUTCMonth(), utc.getUTCDate());
|
|
57
|
+
}
|
|
58
|
+
function indexKey(index) {
|
|
59
|
+
return (/* @__PURE__ */ new Date(index * DAY_MS)).toISOString().slice(0, 10);
|
|
60
|
+
}
|
|
61
|
+
function weekday(index) {
|
|
62
|
+
return (/* @__PURE__ */ new Date(index * DAY_MS)).getUTCDay();
|
|
63
|
+
}
|
|
64
|
+
function monthOf(index) {
|
|
65
|
+
return (/* @__PURE__ */ new Date(index * DAY_MS)).getUTCMonth();
|
|
66
|
+
}
|
|
67
|
+
function toItems(events) {
|
|
68
|
+
const items = [];
|
|
69
|
+
events.forEach((event, order) => {
|
|
70
|
+
const start = dayIndex(event.start);
|
|
71
|
+
if (start === null) return;
|
|
72
|
+
const end = dayIndex(event.end) ?? start;
|
|
73
|
+
items.push({
|
|
74
|
+
event,
|
|
75
|
+
start: Math.min(start, end),
|
|
76
|
+
end: Math.max(start, end),
|
|
77
|
+
order
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
return items.sort((a, b) => a.start - b.start || b.end - b.start - (a.end - a.start) || a.order - b.order);
|
|
81
|
+
}
|
|
82
|
+
function toMarkers(markers) {
|
|
83
|
+
const map = /* @__PURE__ */ new Map();
|
|
84
|
+
for (const marker of markers) {
|
|
85
|
+
const index = dayIndex(marker.date);
|
|
86
|
+
if (index !== null) map.set(index, [...map.get(index) ?? [], marker]);
|
|
87
|
+
}
|
|
88
|
+
return map;
|
|
89
|
+
}
|
|
90
|
+
function allocate(lanes, from, to) {
|
|
91
|
+
let lane = lanes.findIndex((columns) => columns.slice(from, to + 1).every((busy) => !busy));
|
|
92
|
+
if (lane === -1) lane = lanes.push(Array.from({ length: 7 }, () => false)) - 1;
|
|
93
|
+
for (let column = from; column <= to; column++) lanes[lane][column] = true;
|
|
94
|
+
return lane;
|
|
95
|
+
}
|
|
96
|
+
function buildMonthLayout(request) {
|
|
97
|
+
const year = request.month.getFullYear();
|
|
98
|
+
const month = request.month.getMonth();
|
|
99
|
+
const first = dayIndex(new Date(year, month, 1));
|
|
100
|
+
const last = dayIndex(new Date(year, month + 1, 0));
|
|
101
|
+
const start = (request.weekStartsOn % 7 + 7) % 7;
|
|
102
|
+
const gridStart = first - (weekday(first) - start + 7) % 7;
|
|
103
|
+
const weeks = Math.ceil((last - gridStart + 1) / 7);
|
|
104
|
+
const items = toItems(request.events);
|
|
105
|
+
const markers = toMarkers(request.markers);
|
|
106
|
+
const today = dayIndex(request.today);
|
|
107
|
+
const selected = dayIndex(request.selectedDate);
|
|
108
|
+
const maxLanes = Math.max(0, request.maxLanes);
|
|
109
|
+
return Array.from({ length: weeks }, (_, week) => {
|
|
110
|
+
const weekStart = gridStart + week * 7;
|
|
111
|
+
const weekEnd = weekStart + 6;
|
|
112
|
+
const weekItems = items.filter((item) => item.start <= weekEnd && item.end >= weekStart);
|
|
113
|
+
const lanes = [];
|
|
114
|
+
const hidden = Array.from({ length: 7 }, () => 0);
|
|
115
|
+
const segments = [];
|
|
116
|
+
for (const item of weekItems) {
|
|
117
|
+
const from = Math.max(item.start, weekStart) - weekStart;
|
|
118
|
+
const to = Math.min(item.end, weekEnd) - weekStart;
|
|
119
|
+
const lane = allocate(lanes, from, to);
|
|
120
|
+
if (lane >= maxLanes) {
|
|
121
|
+
for (let column = from; column <= to; column++) hidden[column]++;
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
segments.push({
|
|
125
|
+
key: `${item.event.id}:${weekStart}`,
|
|
126
|
+
event: item.event,
|
|
127
|
+
lane,
|
|
128
|
+
column: from + 1,
|
|
129
|
+
span: to - from + 1,
|
|
130
|
+
startsHere: item.start >= weekStart,
|
|
131
|
+
endsHere: item.end <= weekEnd
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
const days = Array.from({ length: 7 }, (_, column) => {
|
|
135
|
+
const index = weekStart + column;
|
|
136
|
+
const day = weekday(index);
|
|
137
|
+
const events = weekItems.filter((item) => item.start <= index && item.end >= index).map((item) => item.event);
|
|
138
|
+
const date = indexToDate(index);
|
|
139
|
+
return {
|
|
140
|
+
key: indexKey(index),
|
|
141
|
+
date,
|
|
142
|
+
index,
|
|
143
|
+
day: date.getDate(),
|
|
144
|
+
column: column + 1,
|
|
145
|
+
inMonth: monthOf(index) === month,
|
|
146
|
+
weekend: day === 0 || day === 6,
|
|
147
|
+
today: index === today,
|
|
148
|
+
selected: index === selected,
|
|
149
|
+
markers: markers.get(index) ?? [],
|
|
150
|
+
events,
|
|
151
|
+
dots: events.slice(0, MAX_DOTS).map((event) => event.tone),
|
|
152
|
+
hidden: hidden[column]
|
|
153
|
+
};
|
|
154
|
+
});
|
|
155
|
+
return {
|
|
156
|
+
key: indexKey(weekStart),
|
|
157
|
+
days,
|
|
158
|
+
segments
|
|
159
|
+
};
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
function monthWeekdays(weekStartsOn, locale) {
|
|
163
|
+
const short = new Intl.DateTimeFormat(locale, { weekday: "short" });
|
|
164
|
+
const narrow = new Intl.DateTimeFormat(locale, { weekday: "narrow" });
|
|
165
|
+
return Array.from({ length: 7 }, (_, column) => {
|
|
166
|
+
const key = ((weekStartsOn + column) % 7 + 7) % 7;
|
|
167
|
+
const date = new Date(2023, 0, 1 + key);
|
|
168
|
+
return {
|
|
169
|
+
key,
|
|
170
|
+
short: short.format(date),
|
|
171
|
+
narrow: narrow.format(date),
|
|
172
|
+
weekend: key === 0 || key === 6
|
|
173
|
+
};
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
const KEY_STEPS = {
|
|
177
|
+
ArrowLeft: -1,
|
|
178
|
+
ArrowRight: 1,
|
|
179
|
+
ArrowUp: -7,
|
|
180
|
+
ArrowDown: 7
|
|
181
|
+
};
|
|
182
|
+
var TxMonthCalendar = class TxMonthCalendar {
|
|
183
|
+
host = inject(ElementRef);
|
|
184
|
+
localeService = inject(TxLocaleService);
|
|
185
|
+
createdAt = /* @__PURE__ */ new Date();
|
|
186
|
+
month = input(void 0, ...ngDevMode ? [{ debugName: "month" }] : /* istanbul ignore next */ []);
|
|
187
|
+
events = input([], ...ngDevMode ? [{ debugName: "events" }] : /* istanbul ignore next */ []);
|
|
188
|
+
markers = input([], ...ngDevMode ? [{ debugName: "markers" }] : /* istanbul ignore next */ []);
|
|
189
|
+
selectedDate = input(null, ...ngDevMode ? [{ debugName: "selectedDate" }] : /* istanbul ignore next */ []);
|
|
190
|
+
weekStartsOn = input(void 0, ...ngDevMode ? [{ debugName: "weekStartsOn" }] : /* istanbul ignore next */ []);
|
|
191
|
+
maxLanes = input(3, {
|
|
192
|
+
...ngDevMode ? { debugName: "maxLanes" } : /* istanbul ignore next */ {},
|
|
193
|
+
transform: numberAttribute
|
|
194
|
+
});
|
|
195
|
+
labels = input({}, ...ngDevMode ? [{ debugName: "labels" }] : /* istanbul ignore next */ []);
|
|
196
|
+
locale = input(void 0, ...ngDevMode ? [{ debugName: "locale" }] : /* istanbul ignore next */ []);
|
|
197
|
+
today = input(void 0, ...ngDevMode ? [{ debugName: "today" }] : /* istanbul ignore next */ []);
|
|
198
|
+
dt = input(void 0, ...ngDevMode ? [{ debugName: "dt" }] : /* istanbul ignore next */ []);
|
|
199
|
+
pt = input(void 0, ...ngDevMode ? [{ debugName: "pt" }] : /* istanbul ignore next */ []);
|
|
200
|
+
ptOptions = input(void 0, ...ngDevMode ? [{ debugName: "ptOptions" }] : /* istanbul ignore next */ []);
|
|
201
|
+
unstyled = input(void 0, {
|
|
202
|
+
...ngDevMode ? { debugName: "unstyled" } : /* istanbul ignore next */ {},
|
|
203
|
+
transform: optionalBoolean
|
|
204
|
+
});
|
|
205
|
+
dayClick = output();
|
|
206
|
+
eventClick = output();
|
|
207
|
+
eventTemplate = contentChild(TxMonthCalendarEventTemplate, ...ngDevMode ? [{ debugName: "eventTemplate" }] : /* istanbul ignore next */ []);
|
|
208
|
+
translations = injectTranslations();
|
|
209
|
+
isUnstyled = injectUnstyled(this.unstyled);
|
|
210
|
+
passThrough = injectPassThrough("monthCalendar", this, this.pt, this.ptOptions);
|
|
211
|
+
hostStyle = computed(() => ({
|
|
212
|
+
...toStyleObject(this.dt(), "--tx-month-calendar"),
|
|
213
|
+
...this.passThrough().root?.style
|
|
214
|
+
}), ...ngDevMode ? [{ debugName: "hostStyle" }] : /* istanbul ignore next */ []);
|
|
215
|
+
resolvedLocale = computed(() => this.locale() ?? this.localeService.locale().intl, ...ngDevMode ? [{ debugName: "resolvedLocale" }] : /* istanbul ignore next */ []);
|
|
216
|
+
resolvedWeekStart = computed(() => this.weekStartsOn() ?? this.localeService.locale().firstDayOfWeek, ...ngDevMode ? [{ debugName: "resolvedWeekStart" }] : /* istanbul ignore next */ []);
|
|
217
|
+
text = computed(() => {
|
|
218
|
+
const translations = this.translations();
|
|
219
|
+
return {
|
|
220
|
+
more: translations.moreEvents,
|
|
221
|
+
today: translations.today,
|
|
222
|
+
region: translations.calendar,
|
|
223
|
+
...this.labels()
|
|
224
|
+
};
|
|
225
|
+
}, ...ngDevMode ? [{ debugName: "text" }] : /* istanbul ignore next */ []);
|
|
226
|
+
weekdays = computed(() => monthWeekdays(this.resolvedWeekStart(), this.resolvedLocale()), ...ngDevMode ? [{ debugName: "weekdays" }] : /* istanbul ignore next */ []);
|
|
227
|
+
weeks = computed(() => buildMonthLayout({
|
|
228
|
+
month: this.month() ?? this.createdAt,
|
|
229
|
+
events: this.events(),
|
|
230
|
+
markers: this.markers(),
|
|
231
|
+
selectedDate: this.selectedDate(),
|
|
232
|
+
today: this.today() ?? this.createdAt,
|
|
233
|
+
weekStartsOn: this.resolvedWeekStart(),
|
|
234
|
+
maxLanes: this.maxLanes()
|
|
235
|
+
}), ...ngDevMode ? [{ debugName: "weeks" }] : /* istanbul ignore next */ []);
|
|
236
|
+
days = computed(() => this.weeks().flatMap((week) => week.days), ...ngDevMode ? [{ debugName: "days" }] : /* istanbul ignore next */ []);
|
|
237
|
+
focusKey = linkedSignal(() => {
|
|
238
|
+
const days = this.days();
|
|
239
|
+
return (days.find((day) => day.selected) ?? days.find((day) => day.today && day.inMonth) ?? days.find((day) => day.inMonth))?.key ?? "";
|
|
240
|
+
}, ...ngDevMode ? [{ debugName: "focusKey" }] : /* istanbul ignore next */ []);
|
|
241
|
+
dateFormat = computed(() => new Intl.DateTimeFormat(this.resolvedLocale(), { dateStyle: "full" }), ...ngDevMode ? [{ debugName: "dateFormat" }] : /* istanbul ignore next */ []);
|
|
242
|
+
dayLabel(day) {
|
|
243
|
+
const events = day.events.length ? this.translations().events.replace("{count}", String(day.events.length)) : "";
|
|
244
|
+
return [
|
|
245
|
+
this.dateFormat().format(day.date),
|
|
246
|
+
day.today ? this.text().today : "",
|
|
247
|
+
...day.markers.map((marker) => marker.label),
|
|
248
|
+
events,
|
|
249
|
+
...day.events.map((event) => event.title)
|
|
250
|
+
].filter(Boolean).join(", ");
|
|
251
|
+
}
|
|
252
|
+
moreLabel(count) {
|
|
253
|
+
return this.text().more.replace(/\{count\}/g, String(count));
|
|
254
|
+
}
|
|
255
|
+
onDayClick(day) {
|
|
256
|
+
this.focusKey.set(day.key);
|
|
257
|
+
this.dayClick.emit(day.date);
|
|
258
|
+
}
|
|
259
|
+
onEventClick(event) {
|
|
260
|
+
this.eventClick.emit(event);
|
|
261
|
+
}
|
|
262
|
+
onDayKeydown(event, day) {
|
|
263
|
+
const step = KEY_STEPS[event.key];
|
|
264
|
+
if (!step) return;
|
|
265
|
+
event.preventDefault();
|
|
266
|
+
const target = this.days().find((item) => item.index === day.index + step);
|
|
267
|
+
if (!target) return;
|
|
268
|
+
this.focusKey.set(target.key);
|
|
269
|
+
this.host.nativeElement.querySelector(`[data-day-key="${target.key}"]`)?.focus();
|
|
270
|
+
}
|
|
271
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
272
|
+
minVersion: "12.0.0",
|
|
273
|
+
version: "22.2.3",
|
|
274
|
+
ngImport: i0,
|
|
275
|
+
type: TxMonthCalendar,
|
|
276
|
+
deps: [],
|
|
277
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
278
|
+
});
|
|
279
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
280
|
+
minVersion: "17.0.0",
|
|
281
|
+
version: "22.2.3",
|
|
282
|
+
type: TxMonthCalendar,
|
|
283
|
+
isStandalone: true,
|
|
284
|
+
selector: "tx-month-calendar",
|
|
285
|
+
inputs: {
|
|
286
|
+
month: {
|
|
287
|
+
classPropertyName: "month",
|
|
288
|
+
publicName: "month",
|
|
289
|
+
isSignal: true,
|
|
290
|
+
isRequired: false,
|
|
291
|
+
transformFunction: null
|
|
292
|
+
},
|
|
293
|
+
events: {
|
|
294
|
+
classPropertyName: "events",
|
|
295
|
+
publicName: "events",
|
|
296
|
+
isSignal: true,
|
|
297
|
+
isRequired: false,
|
|
298
|
+
transformFunction: null
|
|
299
|
+
},
|
|
300
|
+
markers: {
|
|
301
|
+
classPropertyName: "markers",
|
|
302
|
+
publicName: "markers",
|
|
303
|
+
isSignal: true,
|
|
304
|
+
isRequired: false,
|
|
305
|
+
transformFunction: null
|
|
306
|
+
},
|
|
307
|
+
selectedDate: {
|
|
308
|
+
classPropertyName: "selectedDate",
|
|
309
|
+
publicName: "selectedDate",
|
|
310
|
+
isSignal: true,
|
|
311
|
+
isRequired: false,
|
|
312
|
+
transformFunction: null
|
|
313
|
+
},
|
|
314
|
+
weekStartsOn: {
|
|
315
|
+
classPropertyName: "weekStartsOn",
|
|
316
|
+
publicName: "weekStartsOn",
|
|
317
|
+
isSignal: true,
|
|
318
|
+
isRequired: false,
|
|
319
|
+
transformFunction: null
|
|
320
|
+
},
|
|
321
|
+
maxLanes: {
|
|
322
|
+
classPropertyName: "maxLanes",
|
|
323
|
+
publicName: "maxLanes",
|
|
324
|
+
isSignal: true,
|
|
325
|
+
isRequired: false,
|
|
326
|
+
transformFunction: null
|
|
327
|
+
},
|
|
328
|
+
labels: {
|
|
329
|
+
classPropertyName: "labels",
|
|
330
|
+
publicName: "labels",
|
|
331
|
+
isSignal: true,
|
|
332
|
+
isRequired: false,
|
|
333
|
+
transformFunction: null
|
|
334
|
+
},
|
|
335
|
+
locale: {
|
|
336
|
+
classPropertyName: "locale",
|
|
337
|
+
publicName: "locale",
|
|
338
|
+
isSignal: true,
|
|
339
|
+
isRequired: false,
|
|
340
|
+
transformFunction: null
|
|
341
|
+
},
|
|
342
|
+
today: {
|
|
343
|
+
classPropertyName: "today",
|
|
344
|
+
publicName: "today",
|
|
345
|
+
isSignal: true,
|
|
346
|
+
isRequired: false,
|
|
347
|
+
transformFunction: null
|
|
348
|
+
},
|
|
349
|
+
dt: {
|
|
350
|
+
classPropertyName: "dt",
|
|
351
|
+
publicName: "dt",
|
|
352
|
+
isSignal: true,
|
|
353
|
+
isRequired: false,
|
|
354
|
+
transformFunction: null
|
|
355
|
+
},
|
|
356
|
+
pt: {
|
|
357
|
+
classPropertyName: "pt",
|
|
358
|
+
publicName: "pt",
|
|
359
|
+
isSignal: true,
|
|
360
|
+
isRequired: false,
|
|
361
|
+
transformFunction: null
|
|
362
|
+
},
|
|
363
|
+
ptOptions: {
|
|
364
|
+
classPropertyName: "ptOptions",
|
|
365
|
+
publicName: "ptOptions",
|
|
366
|
+
isSignal: true,
|
|
367
|
+
isRequired: false,
|
|
368
|
+
transformFunction: null
|
|
369
|
+
},
|
|
370
|
+
unstyled: {
|
|
371
|
+
classPropertyName: "unstyled",
|
|
372
|
+
publicName: "unstyled",
|
|
373
|
+
isSignal: true,
|
|
374
|
+
isRequired: false,
|
|
375
|
+
transformFunction: null
|
|
376
|
+
}
|
|
377
|
+
},
|
|
378
|
+
outputs: {
|
|
379
|
+
dayClick: "dayClick",
|
|
380
|
+
eventClick: "eventClick"
|
|
381
|
+
},
|
|
382
|
+
host: {
|
|
383
|
+
properties: {
|
|
384
|
+
"class": "passThrough().root?.class",
|
|
385
|
+
"style": "hostStyle()",
|
|
386
|
+
"attr.data-styled": "!isUnstyled() || null"
|
|
387
|
+
},
|
|
388
|
+
classAttribute: "tx-month-calendar"
|
|
389
|
+
},
|
|
390
|
+
queries: [{
|
|
391
|
+
propertyName: "eventTemplate",
|
|
392
|
+
first: true,
|
|
393
|
+
predicate: TxMonthCalendarEventTemplate,
|
|
394
|
+
descendants: true,
|
|
395
|
+
isSignal: true
|
|
396
|
+
}],
|
|
397
|
+
ngImport: i0,
|
|
398
|
+
template: "<div\n class=\"tx-month-calendar__grid\"\n role=\"grid\"\n [attr.aria-label]=\"text().region\"\n [style.--tx-month-calendar-lanes]=\"maxLanes()\"\n [class]=\"passThrough().grid?.class\"\n [style]=\"passThrough().grid?.style\"\n>\n <div class=\"tx-month-calendar__head\" role=\"row\" [class]=\"passThrough().head?.class\" [style]=\"passThrough().head?.style\">\n @for (weekday of weekdays(); track weekday.key) {\n <div\n class=\"tx-month-calendar__weekday\"\n role=\"columnheader\"\n [class.tx-month-calendar__weekday--weekend]=\"weekday.weekend\"\n [attr.aria-label]=\"weekday.short\"\n [class]=\"passThrough().weekday?.class\"\n [style]=\"passThrough().weekday?.style\"\n >\n <span class=\"tx-month-calendar__weekday-short\" aria-hidden=\"true\">{{ weekday.short }}</span>\n <span class=\"tx-month-calendar__weekday-narrow\" aria-hidden=\"true\">{{ weekday.narrow }}</span>\n </div>\n }\n </div>\n\n @for (week of weeks(); track week.key) {\n <div class=\"tx-month-calendar__week\" role=\"row\" [class]=\"passThrough().week?.class\" [style]=\"passThrough().week?.style\">\n @for (day of week.days; track day.key) {\n <div\n class=\"tx-month-calendar__cell\"\n role=\"gridcell\"\n [style.grid-column]=\"day.column\"\n [class.tx-month-calendar__cell--first]=\"day.column === 1\"\n [class.tx-month-calendar__cell--weekend]=\"day.weekend\"\n [class.tx-month-calendar__cell--outside]=\"!day.inMonth\"\n [class.tx-month-calendar__cell--selected]=\"day.selected\"\n [attr.aria-selected]=\"day.selected\"\n [class]=\"passThrough().cell?.class\"\n [style]=\"passThrough().cell?.style\"\n >\n <button\n type=\"button\"\n class=\"tx-month-calendar__day\"\n [attr.data-day-key]=\"day.key\"\n [attr.tabindex]=\"day.key === focusKey() ? 0 : -1\"\n [attr.aria-current]=\"day.today ? 'date' : null\"\n [class]=\"passThrough().day?.class\"\n [style]=\"passThrough().day?.style\"\n (click)=\"onDayClick(day)\"\n (keydown)=\"onDayKeydown($event, day)\"\n >\n <span class=\"tx-month-calendar__label\">{{ dayLabel(day) }}</span>\n <span class=\"tx-month-calendar__day-head\" aria-hidden=\"true\">\n <span\n class=\"tx-month-calendar__number\"\n [class.tx-month-calendar__number--today]=\"day.today\"\n [class]=\"passThrough().number?.class\"\n [style]=\"passThrough().number?.style\"\n >{{ day.day }}</span\n >\n @for (marker of day.markers; track $index) {\n <span class=\"tx-month-calendar__marker\" [class]=\"passThrough().marker?.class\" [style]=\"passThrough().marker?.style\">\n <tx-pill size=\"small\" [tone]=\"marker.tone\" [icon]=\"marker.icon || undefined\" [unstyled]=\"isUnstyled()\">{{ marker.label }}</tx-pill>\n </span>\n <span class=\"tx-month-calendar__marker-dot\" [attr.data-tone]=\"marker.tone\"></span>\n }\n </span>\n @if (day.dots.length) {\n <span class=\"tx-month-calendar__dots\" aria-hidden=\"true\">\n @for (tone of day.dots; track $index) {\n <span class=\"tx-month-calendar__dot\" [attr.data-tone]=\"tone\"></span>\n }\n </span>\n }\n </button>\n </div>\n }\n\n @for (segment of week.segments; track segment.key) {\n <button\n type=\"button\"\n tabindex=\"-1\"\n aria-hidden=\"true\"\n class=\"tx-month-calendar__event\"\n [attr.data-tone]=\"segment.event.tone\"\n [class.tx-month-calendar__event--start]=\"segment.startsHere\"\n [class.tx-month-calendar__event--end]=\"segment.endsHere\"\n [style.grid-row]=\"segment.lane + 2\"\n [style.grid-column]=\"segment.column + ' / span ' + segment.span\"\n [attr.title]=\"segment.event.title\"\n [class]=\"passThrough().event?.class\"\n [style]=\"passThrough().event?.style\"\n (click)=\"onEventClick(segment.event)\"\n >\n @if (eventTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template.templateRef\" [ngTemplateOutletContext]=\"{ $implicit: segment.event, event: segment.event, segment: segment }\" />\n } @else {\n @if (segment.event.avatar && segment.startsHere) {\n <tx-avatar\n class=\"tx-month-calendar__avatar\"\n aria-hidden=\"true\"\n [size]=\"14\"\n [image]=\"segment.event.avatar.src\"\n [name]=\"segment.event.avatar.name\"\n [unstyled]=\"isUnstyled()\"\n />\n }\n <span class=\"tx-month-calendar__event-title\">{{ segment.event.title }}</span>\n }\n </button>\n }\n\n @for (day of week.days; track day.key) {\n @if (day.hidden) {\n <button\n type=\"button\"\n tabindex=\"-1\"\n aria-hidden=\"true\"\n class=\"tx-month-calendar__more\"\n [style.grid-row]=\"maxLanes() + 2\"\n [style.grid-column]=\"day.column\"\n [class]=\"passThrough().more?.class\"\n [style]=\"passThrough().more?.style\"\n (click)=\"onDayClick(day)\"\n >\n {{ moreLabel(day.hidden) }}\n </button>\n }\n }\n </div>\n }\n</div>\n",
|
|
399
|
+
styles: [":host{display:block;min-width:0;container-type:inline-size}.tx-month-calendar__grid{display:flex;flex-direction:column;overflow:hidden}.tx-month-calendar__head,.tx-month-calendar__week{display:grid;grid-template-columns:repeat(7,minmax(0,1fr))}.tx-month-calendar__cell{grid-row:1/-1;min-width:0}.tx-month-calendar__day{position:relative;display:flex;flex-direction:column;box-sizing:border-box;width:100%;height:100%;min-width:0;margin:0;border:0;border-radius:0;background:transparent;color:inherit;font:inherit;text-align:start;cursor:pointer}.tx-month-calendar__label{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}.tx-month-calendar__day-head{display:flex;align-items:center;justify-content:center;min-width:0}.tx-month-calendar__weekday-short,.tx-month-calendar__marker,.tx-month-calendar__event,.tx-month-calendar__more{display:none}.tx-month-calendar__event,.tx-month-calendar__more{position:relative;z-index:1;border:0;font:inherit;cursor:pointer}.tx-month-calendar__event-title{min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.tx-month-calendar__marker-dot,.tx-month-calendar__dot{display:block}.tx-month-calendar__dots{position:absolute;inset-inline:0;display:flex;justify-content:center}@container (width >= 560px){.tx-month-calendar__weekday-short,.tx-month-calendar__marker{display:inline-flex}.tx-month-calendar__weekday-narrow,.tx-month-calendar__marker-dot,.tx-month-calendar__dots{display:none}.tx-month-calendar__day-head{justify-content:space-between}.tx-month-calendar__event{display:flex;align-items:center}.tx-month-calendar__more{display:inline-flex;align-self:center;justify-self:start}}:host([data-styled]){--_mc-tone: var(--tx-month-calendar-tone-primary);font-family:var(--tx-font-family);font-variant-numeric:tabular-nums}:host([data-styled]) :is(.tx-month-calendar__event,.tx-month-calendar__dot,.tx-month-calendar__marker-dot)[data-tone=info]{--_mc-tone: var(--tx-month-calendar-tone-info)}:host([data-styled]) :is(.tx-month-calendar__event,.tx-month-calendar__dot,.tx-month-calendar__marker-dot)[data-tone=success]{--_mc-tone: var(--tx-month-calendar-tone-success)}:host([data-styled]) :is(.tx-month-calendar__event,.tx-month-calendar__dot,.tx-month-calendar__marker-dot)[data-tone=warn]{--_mc-tone: var(--tx-month-calendar-tone-warn)}:host([data-styled]) :is(.tx-month-calendar__event,.tx-month-calendar__dot,.tx-month-calendar__marker-dot)[data-tone=danger]{--_mc-tone: var(--tx-month-calendar-tone-danger)}:host([data-styled]) :is(.tx-month-calendar__event,.tx-month-calendar__dot,.tx-month-calendar__marker-dot)[data-tone=neutral]{--_mc-tone: var(--tx-month-calendar-tone-neutral)}:host([data-styled]) .tx-month-calendar__grid{border-radius:var(--tx-month-calendar-border-radius);background:var(--tx-month-calendar-background);box-shadow:0 0 0 1px var(--tx-month-calendar-border-color)}:host([data-styled]) .tx-month-calendar__head{background:var(--tx-month-calendar-head-background)}:host([data-styled]) .tx-month-calendar__weekday{padding:var(--tx-month-calendar-weekday-padding);color:var(--tx-month-calendar-weekday-color);font-size:var(--tx-month-calendar-weekday-font-size);font-weight:var(--tx-month-calendar-weekday-font-weight);text-align:center}:host([data-styled]) .tx-month-calendar__weekday--weekend{color:var(--tx-month-calendar-weekday-weekend-color)}:host([data-styled]) .tx-month-calendar__week{grid-template-rows:var(--tx-month-calendar-week-height)}:host([data-styled]) .tx-month-calendar__cell{border-top:1px solid var(--tx-month-calendar-cell-border-color);border-left:1px solid var(--tx-month-calendar-cell-border-color);transition:background-color var(--tx-month-calendar-transition-duration)}:host([data-styled]) .tx-month-calendar__cell--first{border-left:0}:host([data-styled]) .tx-month-calendar__cell--weekend{background:var(--tx-month-calendar-cell-weekend-background)}:host([data-styled]) .tx-month-calendar__cell--selected{background:var(--tx-month-calendar-cell-selected-background)}:host([data-styled]) .tx-month-calendar__day{padding:var(--tx-month-calendar-day-padding);outline:none;color:var(--tx-month-calendar-day-color);transition:background-color var(--tx-month-calendar-transition-duration)}:host([data-styled]) .tx-month-calendar__day:hover{background:var(--tx-month-calendar-day-hover-background)}:host([data-styled]) .tx-month-calendar__day:focus-visible{z-index:2;box-shadow:inset 0 0 0 var(--tx-month-calendar-day-focus-ring-width) var(--tx-month-calendar-day-focus-ring-color)}:host([data-styled]) .tx-month-calendar__day-head{gap:var(--tx-month-calendar-day-gap)}:host([data-styled]) .tx-month-calendar__number{display:flex;flex-shrink:0;align-items:center;justify-content:center;width:var(--tx-month-calendar-number-size);height:var(--tx-month-calendar-number-size);border-radius:50%;font-size:var(--tx-month-calendar-number-font-size);font-weight:var(--tx-month-calendar-number-font-weight)}:host([data-styled]) .tx-month-calendar__cell--outside .tx-month-calendar__number{color:var(--tx-month-calendar-number-outside-color)}:host([data-styled]) .tx-month-calendar__cell--selected .tx-month-calendar__number{color:var(--tx-month-calendar-number-selected-color);font-weight:var(--tx-month-calendar-number-selected-font-weight)}:host([data-styled]) .tx-month-calendar__number--today,:host([data-styled]) .tx-month-calendar__cell--selected .tx-month-calendar__number--today{background:var(--tx-month-calendar-number-today-background);color:var(--tx-month-calendar-number-today-color);font-weight:var(--tx-month-calendar-number-selected-font-weight)}:host([data-styled]) .tx-month-calendar__marker{min-width:0;overflow:hidden}:host([data-styled]) .tx-month-calendar__marker-dot,:host([data-styled]) .tx-month-calendar__dot{flex-shrink:0;width:var(--tx-month-calendar-dot-size);height:var(--tx-month-calendar-dot-size);border-radius:50%;background:var(--_mc-tone)}:host([data-styled]) .tx-month-calendar__dots{bottom:var(--tx-month-calendar-dot-bottom);gap:var(--tx-month-calendar-dot-gap)}:host([data-styled]) .tx-month-calendar__event{gap:var(--tx-month-calendar-event-gap);min-width:0;height:var(--tx-month-calendar-event-height);margin-block:auto;padding:0 var(--tx-month-calendar-event-padding-x);border-radius:0;outline:none;background:color-mix(in srgb,var(--_mc-tone) var(--tx-month-calendar-event-background-mix),transparent);color:color-mix(in srgb,var(--_mc-tone) var(--tx-month-calendar-event-text-mix),var(--tx-month-calendar-event-text-base));font-size:var(--tx-month-calendar-event-font-size);font-weight:var(--tx-month-calendar-event-font-weight);text-align:start;transition:background-color var(--tx-month-calendar-transition-duration)}:host([data-styled]) .tx-month-calendar__event:hover{background:color-mix(in srgb,var(--_mc-tone) var(--tx-month-calendar-event-hover-background-mix),transparent)}:host([data-styled]) .tx-month-calendar__event:focus-visible{box-shadow:0 0 0 2px var(--_mc-tone)}:host([data-styled]) .tx-month-calendar__event--start{margin-inline-start:var(--tx-month-calendar-event-inset);border-start-start-radius:var(--tx-month-calendar-event-border-radius);border-end-start-radius:var(--tx-month-calendar-event-border-radius)}:host([data-styled]) .tx-month-calendar__event--end{margin-inline-end:var(--tx-month-calendar-event-inset);border-start-end-radius:var(--tx-month-calendar-event-border-radius);border-end-end-radius:var(--tx-month-calendar-event-border-radius)}:host([data-styled]) .tx-month-calendar__avatar{flex-shrink:0;width:var(--tx-month-calendar-event-avatar-size);height:var(--tx-month-calendar-event-avatar-size)}:host([data-styled]) .tx-month-calendar__more{margin-inline:var(--tx-month-calendar-more-margin);padding:var(--tx-month-calendar-more-padding);border-radius:var(--tx-month-calendar-more-border-radius);outline:none;background:transparent;color:var(--tx-month-calendar-more-color);font-size:var(--tx-month-calendar-more-font-size);font-weight:var(--tx-month-calendar-more-font-weight);transition:background-color var(--tx-month-calendar-transition-duration),color var(--tx-month-calendar-transition-duration)}:host([data-styled]) .tx-month-calendar__more:hover{background:var(--tx-month-calendar-more-hover-background);color:var(--tx-month-calendar-more-hover-color)}:host([data-styled]) .tx-month-calendar__more:focus-visible{box-shadow:0 0 0 2px var(--tx-month-calendar-more-hover-color)}@container (width >= 560px){:host([data-styled]) .tx-month-calendar__weekday{padding-inline:var(--tx-month-calendar-weekday-wide-padding-x);text-align:start}:host([data-styled]) .tx-month-calendar__week{grid-template-rows:var(--tx-month-calendar-week-head-height) repeat(var(--tx-month-calendar-lanes),var(--tx-month-calendar-week-lane-height)) var(--tx-month-calendar-week-more-height)}:host([data-styled]) .tx-month-calendar__day{padding:var(--tx-month-calendar-day-padding) var(--tx-month-calendar-day-wide-padding-x)}}@media(prefers-reduced-motion:reduce){:host([data-styled]) .tx-month-calendar__cell,:host([data-styled]) .tx-month-calendar__day,:host([data-styled]) .tx-month-calendar__event,:host([data-styled]) .tx-month-calendar__more{transition:none}}\n"],
|
|
400
|
+
dependencies: [
|
|
401
|
+
{
|
|
402
|
+
kind: "directive",
|
|
403
|
+
type: NgTemplateOutlet,
|
|
404
|
+
selector: "[ngTemplateOutlet]",
|
|
405
|
+
inputs: [
|
|
406
|
+
"ngTemplateOutletContext",
|
|
407
|
+
"ngTemplateOutlet",
|
|
408
|
+
"ngTemplateOutletInjector"
|
|
409
|
+
]
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
kind: "component",
|
|
413
|
+
type: TxAvatar,
|
|
414
|
+
selector: "tx-avatar",
|
|
415
|
+
inputs: [
|
|
416
|
+
"image",
|
|
417
|
+
"name",
|
|
418
|
+
"label",
|
|
419
|
+
"icon",
|
|
420
|
+
"size",
|
|
421
|
+
"shape",
|
|
422
|
+
"tone",
|
|
423
|
+
"ariaLabel",
|
|
424
|
+
"dt",
|
|
425
|
+
"pt",
|
|
426
|
+
"ptOptions",
|
|
427
|
+
"unstyled"
|
|
428
|
+
],
|
|
429
|
+
outputs: ["imageError"]
|
|
430
|
+
},
|
|
431
|
+
{
|
|
432
|
+
kind: "component",
|
|
433
|
+
type: TxPill,
|
|
434
|
+
selector: "tx-pill",
|
|
435
|
+
inputs: [
|
|
436
|
+
"value",
|
|
437
|
+
"tone",
|
|
438
|
+
"variant",
|
|
439
|
+
"size",
|
|
440
|
+
"icon",
|
|
441
|
+
"dot",
|
|
442
|
+
"removable",
|
|
443
|
+
"removeLabel",
|
|
444
|
+
"dt",
|
|
445
|
+
"pt",
|
|
446
|
+
"ptOptions",
|
|
447
|
+
"unstyled"
|
|
448
|
+
],
|
|
449
|
+
outputs: ["removed"]
|
|
450
|
+
}
|
|
451
|
+
],
|
|
452
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
453
|
+
});
|
|
454
|
+
};
|
|
455
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
456
|
+
minVersion: "12.0.0",
|
|
457
|
+
version: "22.2.3",
|
|
458
|
+
ngImport: i0,
|
|
459
|
+
type: TxMonthCalendar,
|
|
460
|
+
decorators: [{
|
|
461
|
+
type: Component,
|
|
462
|
+
args: [{
|
|
463
|
+
selector: "tx-month-calendar",
|
|
464
|
+
imports: [
|
|
465
|
+
NgTemplateOutlet,
|
|
466
|
+
TxAvatar,
|
|
467
|
+
TxPill
|
|
468
|
+
],
|
|
469
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
470
|
+
host: {
|
|
471
|
+
class: "tx-month-calendar",
|
|
472
|
+
"[class]": "passThrough().root?.class",
|
|
473
|
+
"[style]": "hostStyle()",
|
|
474
|
+
"[attr.data-styled]": "!isUnstyled() || null"
|
|
475
|
+
},
|
|
476
|
+
template: "<div\n class=\"tx-month-calendar__grid\"\n role=\"grid\"\n [attr.aria-label]=\"text().region\"\n [style.--tx-month-calendar-lanes]=\"maxLanes()\"\n [class]=\"passThrough().grid?.class\"\n [style]=\"passThrough().grid?.style\"\n>\n <div class=\"tx-month-calendar__head\" role=\"row\" [class]=\"passThrough().head?.class\" [style]=\"passThrough().head?.style\">\n @for (weekday of weekdays(); track weekday.key) {\n <div\n class=\"tx-month-calendar__weekday\"\n role=\"columnheader\"\n [class.tx-month-calendar__weekday--weekend]=\"weekday.weekend\"\n [attr.aria-label]=\"weekday.short\"\n [class]=\"passThrough().weekday?.class\"\n [style]=\"passThrough().weekday?.style\"\n >\n <span class=\"tx-month-calendar__weekday-short\" aria-hidden=\"true\">{{ weekday.short }}</span>\n <span class=\"tx-month-calendar__weekday-narrow\" aria-hidden=\"true\">{{ weekday.narrow }}</span>\n </div>\n }\n </div>\n\n @for (week of weeks(); track week.key) {\n <div class=\"tx-month-calendar__week\" role=\"row\" [class]=\"passThrough().week?.class\" [style]=\"passThrough().week?.style\">\n @for (day of week.days; track day.key) {\n <div\n class=\"tx-month-calendar__cell\"\n role=\"gridcell\"\n [style.grid-column]=\"day.column\"\n [class.tx-month-calendar__cell--first]=\"day.column === 1\"\n [class.tx-month-calendar__cell--weekend]=\"day.weekend\"\n [class.tx-month-calendar__cell--outside]=\"!day.inMonth\"\n [class.tx-month-calendar__cell--selected]=\"day.selected\"\n [attr.aria-selected]=\"day.selected\"\n [class]=\"passThrough().cell?.class\"\n [style]=\"passThrough().cell?.style\"\n >\n <button\n type=\"button\"\n class=\"tx-month-calendar__day\"\n [attr.data-day-key]=\"day.key\"\n [attr.tabindex]=\"day.key === focusKey() ? 0 : -1\"\n [attr.aria-current]=\"day.today ? 'date' : null\"\n [class]=\"passThrough().day?.class\"\n [style]=\"passThrough().day?.style\"\n (click)=\"onDayClick(day)\"\n (keydown)=\"onDayKeydown($event, day)\"\n >\n <span class=\"tx-month-calendar__label\">{{ dayLabel(day) }}</span>\n <span class=\"tx-month-calendar__day-head\" aria-hidden=\"true\">\n <span\n class=\"tx-month-calendar__number\"\n [class.tx-month-calendar__number--today]=\"day.today\"\n [class]=\"passThrough().number?.class\"\n [style]=\"passThrough().number?.style\"\n >{{ day.day }}</span\n >\n @for (marker of day.markers; track $index) {\n <span class=\"tx-month-calendar__marker\" [class]=\"passThrough().marker?.class\" [style]=\"passThrough().marker?.style\">\n <tx-pill size=\"small\" [tone]=\"marker.tone\" [icon]=\"marker.icon || undefined\" [unstyled]=\"isUnstyled()\">{{ marker.label }}</tx-pill>\n </span>\n <span class=\"tx-month-calendar__marker-dot\" [attr.data-tone]=\"marker.tone\"></span>\n }\n </span>\n @if (day.dots.length) {\n <span class=\"tx-month-calendar__dots\" aria-hidden=\"true\">\n @for (tone of day.dots; track $index) {\n <span class=\"tx-month-calendar__dot\" [attr.data-tone]=\"tone\"></span>\n }\n </span>\n }\n </button>\n </div>\n }\n\n @for (segment of week.segments; track segment.key) {\n <button\n type=\"button\"\n tabindex=\"-1\"\n aria-hidden=\"true\"\n class=\"tx-month-calendar__event\"\n [attr.data-tone]=\"segment.event.tone\"\n [class.tx-month-calendar__event--start]=\"segment.startsHere\"\n [class.tx-month-calendar__event--end]=\"segment.endsHere\"\n [style.grid-row]=\"segment.lane + 2\"\n [style.grid-column]=\"segment.column + ' / span ' + segment.span\"\n [attr.title]=\"segment.event.title\"\n [class]=\"passThrough().event?.class\"\n [style]=\"passThrough().event?.style\"\n (click)=\"onEventClick(segment.event)\"\n >\n @if (eventTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template.templateRef\" [ngTemplateOutletContext]=\"{ $implicit: segment.event, event: segment.event, segment: segment }\" />\n } @else {\n @if (segment.event.avatar && segment.startsHere) {\n <tx-avatar\n class=\"tx-month-calendar__avatar\"\n aria-hidden=\"true\"\n [size]=\"14\"\n [image]=\"segment.event.avatar.src\"\n [name]=\"segment.event.avatar.name\"\n [unstyled]=\"isUnstyled()\"\n />\n }\n <span class=\"tx-month-calendar__event-title\">{{ segment.event.title }}</span>\n }\n </button>\n }\n\n @for (day of week.days; track day.key) {\n @if (day.hidden) {\n <button\n type=\"button\"\n tabindex=\"-1\"\n aria-hidden=\"true\"\n class=\"tx-month-calendar__more\"\n [style.grid-row]=\"maxLanes() + 2\"\n [style.grid-column]=\"day.column\"\n [class]=\"passThrough().more?.class\"\n [style]=\"passThrough().more?.style\"\n (click)=\"onDayClick(day)\"\n >\n {{ moreLabel(day.hidden) }}\n </button>\n }\n }\n </div>\n }\n</div>\n",
|
|
477
|
+
styles: [":host{display:block;min-width:0;container-type:inline-size}.tx-month-calendar__grid{display:flex;flex-direction:column;overflow:hidden}.tx-month-calendar__head,.tx-month-calendar__week{display:grid;grid-template-columns:repeat(7,minmax(0,1fr))}.tx-month-calendar__cell{grid-row:1/-1;min-width:0}.tx-month-calendar__day{position:relative;display:flex;flex-direction:column;box-sizing:border-box;width:100%;height:100%;min-width:0;margin:0;border:0;border-radius:0;background:transparent;color:inherit;font:inherit;text-align:start;cursor:pointer}.tx-month-calendar__label{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}.tx-month-calendar__day-head{display:flex;align-items:center;justify-content:center;min-width:0}.tx-month-calendar__weekday-short,.tx-month-calendar__marker,.tx-month-calendar__event,.tx-month-calendar__more{display:none}.tx-month-calendar__event,.tx-month-calendar__more{position:relative;z-index:1;border:0;font:inherit;cursor:pointer}.tx-month-calendar__event-title{min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.tx-month-calendar__marker-dot,.tx-month-calendar__dot{display:block}.tx-month-calendar__dots{position:absolute;inset-inline:0;display:flex;justify-content:center}@container (width >= 560px){.tx-month-calendar__weekday-short,.tx-month-calendar__marker{display:inline-flex}.tx-month-calendar__weekday-narrow,.tx-month-calendar__marker-dot,.tx-month-calendar__dots{display:none}.tx-month-calendar__day-head{justify-content:space-between}.tx-month-calendar__event{display:flex;align-items:center}.tx-month-calendar__more{display:inline-flex;align-self:center;justify-self:start}}:host([data-styled]){--_mc-tone: var(--tx-month-calendar-tone-primary);font-family:var(--tx-font-family);font-variant-numeric:tabular-nums}:host([data-styled]) :is(.tx-month-calendar__event,.tx-month-calendar__dot,.tx-month-calendar__marker-dot)[data-tone=info]{--_mc-tone: var(--tx-month-calendar-tone-info)}:host([data-styled]) :is(.tx-month-calendar__event,.tx-month-calendar__dot,.tx-month-calendar__marker-dot)[data-tone=success]{--_mc-tone: var(--tx-month-calendar-tone-success)}:host([data-styled]) :is(.tx-month-calendar__event,.tx-month-calendar__dot,.tx-month-calendar__marker-dot)[data-tone=warn]{--_mc-tone: var(--tx-month-calendar-tone-warn)}:host([data-styled]) :is(.tx-month-calendar__event,.tx-month-calendar__dot,.tx-month-calendar__marker-dot)[data-tone=danger]{--_mc-tone: var(--tx-month-calendar-tone-danger)}:host([data-styled]) :is(.tx-month-calendar__event,.tx-month-calendar__dot,.tx-month-calendar__marker-dot)[data-tone=neutral]{--_mc-tone: var(--tx-month-calendar-tone-neutral)}:host([data-styled]) .tx-month-calendar__grid{border-radius:var(--tx-month-calendar-border-radius);background:var(--tx-month-calendar-background);box-shadow:0 0 0 1px var(--tx-month-calendar-border-color)}:host([data-styled]) .tx-month-calendar__head{background:var(--tx-month-calendar-head-background)}:host([data-styled]) .tx-month-calendar__weekday{padding:var(--tx-month-calendar-weekday-padding);color:var(--tx-month-calendar-weekday-color);font-size:var(--tx-month-calendar-weekday-font-size);font-weight:var(--tx-month-calendar-weekday-font-weight);text-align:center}:host([data-styled]) .tx-month-calendar__weekday--weekend{color:var(--tx-month-calendar-weekday-weekend-color)}:host([data-styled]) .tx-month-calendar__week{grid-template-rows:var(--tx-month-calendar-week-height)}:host([data-styled]) .tx-month-calendar__cell{border-top:1px solid var(--tx-month-calendar-cell-border-color);border-left:1px solid var(--tx-month-calendar-cell-border-color);transition:background-color var(--tx-month-calendar-transition-duration)}:host([data-styled]) .tx-month-calendar__cell--first{border-left:0}:host([data-styled]) .tx-month-calendar__cell--weekend{background:var(--tx-month-calendar-cell-weekend-background)}:host([data-styled]) .tx-month-calendar__cell--selected{background:var(--tx-month-calendar-cell-selected-background)}:host([data-styled]) .tx-month-calendar__day{padding:var(--tx-month-calendar-day-padding);outline:none;color:var(--tx-month-calendar-day-color);transition:background-color var(--tx-month-calendar-transition-duration)}:host([data-styled]) .tx-month-calendar__day:hover{background:var(--tx-month-calendar-day-hover-background)}:host([data-styled]) .tx-month-calendar__day:focus-visible{z-index:2;box-shadow:inset 0 0 0 var(--tx-month-calendar-day-focus-ring-width) var(--tx-month-calendar-day-focus-ring-color)}:host([data-styled]) .tx-month-calendar__day-head{gap:var(--tx-month-calendar-day-gap)}:host([data-styled]) .tx-month-calendar__number{display:flex;flex-shrink:0;align-items:center;justify-content:center;width:var(--tx-month-calendar-number-size);height:var(--tx-month-calendar-number-size);border-radius:50%;font-size:var(--tx-month-calendar-number-font-size);font-weight:var(--tx-month-calendar-number-font-weight)}:host([data-styled]) .tx-month-calendar__cell--outside .tx-month-calendar__number{color:var(--tx-month-calendar-number-outside-color)}:host([data-styled]) .tx-month-calendar__cell--selected .tx-month-calendar__number{color:var(--tx-month-calendar-number-selected-color);font-weight:var(--tx-month-calendar-number-selected-font-weight)}:host([data-styled]) .tx-month-calendar__number--today,:host([data-styled]) .tx-month-calendar__cell--selected .tx-month-calendar__number--today{background:var(--tx-month-calendar-number-today-background);color:var(--tx-month-calendar-number-today-color);font-weight:var(--tx-month-calendar-number-selected-font-weight)}:host([data-styled]) .tx-month-calendar__marker{min-width:0;overflow:hidden}:host([data-styled]) .tx-month-calendar__marker-dot,:host([data-styled]) .tx-month-calendar__dot{flex-shrink:0;width:var(--tx-month-calendar-dot-size);height:var(--tx-month-calendar-dot-size);border-radius:50%;background:var(--_mc-tone)}:host([data-styled]) .tx-month-calendar__dots{bottom:var(--tx-month-calendar-dot-bottom);gap:var(--tx-month-calendar-dot-gap)}:host([data-styled]) .tx-month-calendar__event{gap:var(--tx-month-calendar-event-gap);min-width:0;height:var(--tx-month-calendar-event-height);margin-block:auto;padding:0 var(--tx-month-calendar-event-padding-x);border-radius:0;outline:none;background:color-mix(in srgb,var(--_mc-tone) var(--tx-month-calendar-event-background-mix),transparent);color:color-mix(in srgb,var(--_mc-tone) var(--tx-month-calendar-event-text-mix),var(--tx-month-calendar-event-text-base));font-size:var(--tx-month-calendar-event-font-size);font-weight:var(--tx-month-calendar-event-font-weight);text-align:start;transition:background-color var(--tx-month-calendar-transition-duration)}:host([data-styled]) .tx-month-calendar__event:hover{background:color-mix(in srgb,var(--_mc-tone) var(--tx-month-calendar-event-hover-background-mix),transparent)}:host([data-styled]) .tx-month-calendar__event:focus-visible{box-shadow:0 0 0 2px var(--_mc-tone)}:host([data-styled]) .tx-month-calendar__event--start{margin-inline-start:var(--tx-month-calendar-event-inset);border-start-start-radius:var(--tx-month-calendar-event-border-radius);border-end-start-radius:var(--tx-month-calendar-event-border-radius)}:host([data-styled]) .tx-month-calendar__event--end{margin-inline-end:var(--tx-month-calendar-event-inset);border-start-end-radius:var(--tx-month-calendar-event-border-radius);border-end-end-radius:var(--tx-month-calendar-event-border-radius)}:host([data-styled]) .tx-month-calendar__avatar{flex-shrink:0;width:var(--tx-month-calendar-event-avatar-size);height:var(--tx-month-calendar-event-avatar-size)}:host([data-styled]) .tx-month-calendar__more{margin-inline:var(--tx-month-calendar-more-margin);padding:var(--tx-month-calendar-more-padding);border-radius:var(--tx-month-calendar-more-border-radius);outline:none;background:transparent;color:var(--tx-month-calendar-more-color);font-size:var(--tx-month-calendar-more-font-size);font-weight:var(--tx-month-calendar-more-font-weight);transition:background-color var(--tx-month-calendar-transition-duration),color var(--tx-month-calendar-transition-duration)}:host([data-styled]) .tx-month-calendar__more:hover{background:var(--tx-month-calendar-more-hover-background);color:var(--tx-month-calendar-more-hover-color)}:host([data-styled]) .tx-month-calendar__more:focus-visible{box-shadow:0 0 0 2px var(--tx-month-calendar-more-hover-color)}@container (width >= 560px){:host([data-styled]) .tx-month-calendar__weekday{padding-inline:var(--tx-month-calendar-weekday-wide-padding-x);text-align:start}:host([data-styled]) .tx-month-calendar__week{grid-template-rows:var(--tx-month-calendar-week-head-height) repeat(var(--tx-month-calendar-lanes),var(--tx-month-calendar-week-lane-height)) var(--tx-month-calendar-week-more-height)}:host([data-styled]) .tx-month-calendar__day{padding:var(--tx-month-calendar-day-padding) var(--tx-month-calendar-day-wide-padding-x)}}@media(prefers-reduced-motion:reduce){:host([data-styled]) .tx-month-calendar__cell,:host([data-styled]) .tx-month-calendar__day,:host([data-styled]) .tx-month-calendar__event,:host([data-styled]) .tx-month-calendar__more{transition:none}}\n"]
|
|
478
|
+
}]
|
|
479
|
+
}],
|
|
480
|
+
propDecorators: {
|
|
481
|
+
month: [{
|
|
482
|
+
type: i0.Input,
|
|
483
|
+
args: [{
|
|
484
|
+
isSignal: true,
|
|
485
|
+
alias: "month",
|
|
486
|
+
required: false
|
|
487
|
+
}]
|
|
488
|
+
}],
|
|
489
|
+
events: [{
|
|
490
|
+
type: i0.Input,
|
|
491
|
+
args: [{
|
|
492
|
+
isSignal: true,
|
|
493
|
+
alias: "events",
|
|
494
|
+
required: false
|
|
495
|
+
}]
|
|
496
|
+
}],
|
|
497
|
+
markers: [{
|
|
498
|
+
type: i0.Input,
|
|
499
|
+
args: [{
|
|
500
|
+
isSignal: true,
|
|
501
|
+
alias: "markers",
|
|
502
|
+
required: false
|
|
503
|
+
}]
|
|
504
|
+
}],
|
|
505
|
+
selectedDate: [{
|
|
506
|
+
type: i0.Input,
|
|
507
|
+
args: [{
|
|
508
|
+
isSignal: true,
|
|
509
|
+
alias: "selectedDate",
|
|
510
|
+
required: false
|
|
511
|
+
}]
|
|
512
|
+
}],
|
|
513
|
+
weekStartsOn: [{
|
|
514
|
+
type: i0.Input,
|
|
515
|
+
args: [{
|
|
516
|
+
isSignal: true,
|
|
517
|
+
alias: "weekStartsOn",
|
|
518
|
+
required: false
|
|
519
|
+
}]
|
|
520
|
+
}],
|
|
521
|
+
maxLanes: [{
|
|
522
|
+
type: i0.Input,
|
|
523
|
+
args: [{
|
|
524
|
+
isSignal: true,
|
|
525
|
+
alias: "maxLanes",
|
|
526
|
+
required: false
|
|
527
|
+
}]
|
|
528
|
+
}],
|
|
529
|
+
labels: [{
|
|
530
|
+
type: i0.Input,
|
|
531
|
+
args: [{
|
|
532
|
+
isSignal: true,
|
|
533
|
+
alias: "labels",
|
|
534
|
+
required: false
|
|
535
|
+
}]
|
|
536
|
+
}],
|
|
537
|
+
locale: [{
|
|
538
|
+
type: i0.Input,
|
|
539
|
+
args: [{
|
|
540
|
+
isSignal: true,
|
|
541
|
+
alias: "locale",
|
|
542
|
+
required: false
|
|
543
|
+
}]
|
|
544
|
+
}],
|
|
545
|
+
today: [{
|
|
546
|
+
type: i0.Input,
|
|
547
|
+
args: [{
|
|
548
|
+
isSignal: true,
|
|
549
|
+
alias: "today",
|
|
550
|
+
required: false
|
|
551
|
+
}]
|
|
552
|
+
}],
|
|
553
|
+
dt: [{
|
|
554
|
+
type: i0.Input,
|
|
555
|
+
args: [{
|
|
556
|
+
isSignal: true,
|
|
557
|
+
alias: "dt",
|
|
558
|
+
required: false
|
|
559
|
+
}]
|
|
560
|
+
}],
|
|
561
|
+
pt: [{
|
|
562
|
+
type: i0.Input,
|
|
563
|
+
args: [{
|
|
564
|
+
isSignal: true,
|
|
565
|
+
alias: "pt",
|
|
566
|
+
required: false
|
|
567
|
+
}]
|
|
568
|
+
}],
|
|
569
|
+
ptOptions: [{
|
|
570
|
+
type: i0.Input,
|
|
571
|
+
args: [{
|
|
572
|
+
isSignal: true,
|
|
573
|
+
alias: "ptOptions",
|
|
574
|
+
required: false
|
|
575
|
+
}]
|
|
576
|
+
}],
|
|
577
|
+
unstyled: [{
|
|
578
|
+
type: i0.Input,
|
|
579
|
+
args: [{
|
|
580
|
+
isSignal: true,
|
|
581
|
+
alias: "unstyled",
|
|
582
|
+
required: false
|
|
583
|
+
}]
|
|
584
|
+
}],
|
|
585
|
+
dayClick: [{
|
|
586
|
+
type: i0.Output,
|
|
587
|
+
args: ["dayClick"]
|
|
588
|
+
}],
|
|
589
|
+
eventClick: [{
|
|
590
|
+
type: i0.Output,
|
|
591
|
+
args: ["eventClick"]
|
|
592
|
+
}],
|
|
593
|
+
eventTemplate: [{
|
|
594
|
+
type: i0.ContentChild,
|
|
595
|
+
args: [i0.forwardRef(() => TxMonthCalendarEventTemplate), { isSignal: true }]
|
|
596
|
+
}]
|
|
597
|
+
}
|
|
598
|
+
});
|
|
599
|
+
export { TxMonthCalendar, TxMonthCalendarEventTemplate, buildMonthLayout, dayIndex, indexToDate, monthWeekdays };
|
|
600
|
+
|
|
601
|
+
//# sourceMappingURL=tectra-ng-ui-month-calendar.mjs.map
|