@iyulab/components 1.57.0 → 1.58.0
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/CHANGELOG.md +61 -0
- package/dist/assets/locales/ar.json.js +12 -2
- package/dist/assets/locales/de.json.js +12 -2
- package/dist/assets/locales/en.json.js +12 -2
- package/dist/assets/locales/es.json.js +14 -2
- package/dist/assets/locales/fr.json.js +12 -2
- package/dist/assets/locales/id.json.js +12 -2
- package/dist/assets/locales/ja.json.js +14 -2
- package/dist/assets/locales/ko.json.js +14 -2
- package/dist/assets/locales/pt-BR.json.js +12 -2
- package/dist/assets/locales/ru.json.js +12 -2
- package/dist/assets/locales/th.json.js +14 -2
- package/dist/assets/locales/vi.json.js +12 -2
- package/dist/assets/locales/zh-CN.json.js +14 -2
- package/dist/assets/locales/zh-TW.json.js +14 -2
- package/dist/components/calendar/UCalendar.d.ts +4 -0
- package/dist/components/calendar/UCalendar.js +5 -4
- package/dist/components/calendar/date-text-controller.d.ts +62 -0
- package/dist/components/calendar/date-text-controller.js +90 -0
- package/dist/components/calendar/dates.d.ts +4 -0
- package/dist/components/calendar/dates.js +5 -1
- package/dist/components/calendar/datetime.d.ts +14 -0
- package/dist/components/calendar/datetime.js +35 -0
- package/dist/components/calendar/picker.styles.js +35 -0
- package/dist/components/carousel/UCarousel.d.ts +7 -1
- package/dist/components/carousel/UCarousel.js +8 -1
- package/dist/components/date-picker/UDatePicker.d.ts +33 -21
- package/dist/components/date-picker/UDatePicker.js +128 -103
- package/dist/components/date-picker/UDatePicker.styles.js +0 -19
- package/dist/components/date-range-picker/UDateRangePicker.d.ts +71 -24
- package/dist/components/date-range-picker/UDateRangePicker.js +233 -103
- package/dist/index.js +2 -2
- package/dist/utilities/Locale.d.ts +2 -2
- package/dist/utilities/Locale.js +2 -2
- package/dist/utilities/format.d.ts +32 -4
- package/dist/utilities/format.js +131 -15
- package/package.json +1 -1
- package/skills/iyulab-components/references/components/carousel.md +3 -1
- package/skills/iyulab-components/references/components/date-picker.md +34 -2
- package/skills/iyulab-components/references/components/date-range-picker.md +52 -5
- package/skills/iyulab-components/references/utilities/locale.md +1 -1
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
//#region src/components/calendar/date-text-controller.ts
|
|
2
|
+
/**
|
|
3
|
+
* The typed-date text box shared by `u-date-picker` and `u-date-range-picker`: what is being typed
|
|
4
|
+
* (`draft`), whether the last commit was unreadable (`badText`), committing on Enter and blur,
|
|
5
|
+
* opening the calendar on a click (caret stays in the box) or ArrowDown (focus moves into the grid),
|
|
6
|
+
* and following the typing in an open calendar.
|
|
7
|
+
*/
|
|
8
|
+
var DateTextController = class {
|
|
9
|
+
constructor(host, options) {
|
|
10
|
+
this.host = host;
|
|
11
|
+
this.options = options;
|
|
12
|
+
this.draft = null;
|
|
13
|
+
this.badText = false;
|
|
14
|
+
this.focusGridOnOpen = false;
|
|
15
|
+
this.handleInput = (e) => {
|
|
16
|
+
this.draft = e.target.value;
|
|
17
|
+
this.host.requestUpdate();
|
|
18
|
+
const day = this.options.dayOf(this.draft);
|
|
19
|
+
if (day && this.options.popover()?.open) this.options.calendar()?.showDate(day);
|
|
20
|
+
};
|
|
21
|
+
this.handleKeydown = (e) => {
|
|
22
|
+
if (e.key === "ArrowDown") {
|
|
23
|
+
e.preventDefault();
|
|
24
|
+
this.commit();
|
|
25
|
+
this.open(true);
|
|
26
|
+
} else if (e.key === "Enter" && !e.isComposing) this.commit();
|
|
27
|
+
};
|
|
28
|
+
this.handleContainerClick = (e) => {
|
|
29
|
+
if (e.target.closest?.("u-icon")) return;
|
|
30
|
+
const input = this.options.input();
|
|
31
|
+
const root = this.host.shadowRoot;
|
|
32
|
+
if (input && root && root.activeElement !== input) input.focus();
|
|
33
|
+
this.open(false);
|
|
34
|
+
};
|
|
35
|
+
this.handleCalendarButtonClick = (e) => {
|
|
36
|
+
e.stopPropagation();
|
|
37
|
+
if (this.options.popover()?.open) {
|
|
38
|
+
this.options.popover()?.hide();
|
|
39
|
+
this.options.input()?.focus();
|
|
40
|
+
} else this.open(true);
|
|
41
|
+
};
|
|
42
|
+
this.commit = () => {
|
|
43
|
+
if (this.draft === null) return;
|
|
44
|
+
const text = this.draft;
|
|
45
|
+
const next = this.options.toValue(text);
|
|
46
|
+
this.badText = next === null;
|
|
47
|
+
const value = next ?? void 0;
|
|
48
|
+
const changed = value !== this.host.value;
|
|
49
|
+
this.host.value = value;
|
|
50
|
+
this.draft = this.badText ? text : null;
|
|
51
|
+
this.host.requestUpdate();
|
|
52
|
+
if (changed) this.options.onChange();
|
|
53
|
+
else if (this.badText) this.options.onBadText();
|
|
54
|
+
};
|
|
55
|
+
host.addController(this);
|
|
56
|
+
}
|
|
57
|
+
hostConnected() {}
|
|
58
|
+
/** The text box's current text. */
|
|
59
|
+
get text() {
|
|
60
|
+
return this.draft ?? this.options.shown();
|
|
61
|
+
}
|
|
62
|
+
/** Forget what was typed — after a calendar pick, a clear or a reset. */
|
|
63
|
+
clear() {
|
|
64
|
+
this.draft = null;
|
|
65
|
+
this.badText = false;
|
|
66
|
+
this.host.requestUpdate();
|
|
67
|
+
}
|
|
68
|
+
/** Called when the calendar has opened: show the typed (or current) month and, if the opening
|
|
69
|
+
* came from the keyboard, move focus into the grid. */
|
|
70
|
+
calendarOpened(fallbackDay) {
|
|
71
|
+
const calendar = this.options.calendar();
|
|
72
|
+
const typed = this.draft !== null ? this.options.dayOf(this.draft) : null;
|
|
73
|
+
calendar?.showDate(typed ?? fallbackDay);
|
|
74
|
+
const moveFocus = this.focusGridOnOpen;
|
|
75
|
+
this.focusGridOnOpen = false;
|
|
76
|
+
if (moveFocus) this.options.popover()?.updateComplete.then(() => calendar?.focusDay());
|
|
77
|
+
}
|
|
78
|
+
open(focusGrid) {
|
|
79
|
+
if (!this.options.interactive()) return;
|
|
80
|
+
if (this.options.popover()?.open) {
|
|
81
|
+
if (focusGrid) this.options.calendar()?.focusDay();
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
this.focusGridOnOpen = focusGrid;
|
|
85
|
+
const container = this.options.container();
|
|
86
|
+
if (container) this.options.popover()?.show(container);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
//#endregion
|
|
90
|
+
export { DateTextController };
|
|
@@ -9,5 +9,9 @@ export declare function addDays(date: Date, delta: number): Date;
|
|
|
9
9
|
export declare function daysInMonth(date: Date): number;
|
|
10
10
|
/** 두 날의 달 차이(`b` 가 `a` 보다 몇 달 뒤인가). 일자는 무시한다. */
|
|
11
11
|
export declare function monthDiff(a: Date, b: Date): number;
|
|
12
|
+
/** 앱이 정하는 날짜별 비활성 규칙 — ISO `YYYY-MM-DD` 를 받아 고를 수 없으면 `true`. */
|
|
13
|
+
export type DateDisabledFn = (date: string) => boolean;
|
|
14
|
+
/** 고를 수 없는 날인가 — `min`/`max` 밖이거나 앱 규칙이 막았다. */
|
|
15
|
+
export declare function isDayUnavailable(date: Date, min?: string, max?: string, isDateDisabled?: DateDisabledFn): boolean;
|
|
12
16
|
/** `min`/`max`(ISO 날짜, 둘 다 선택)를 벗어나는가 — 경계일은 포함이다. */
|
|
13
17
|
export declare function isOutOfRange(date: Date, min?: string, max?: string): boolean;
|
|
@@ -27,6 +27,10 @@ function daysInMonth(date) {
|
|
|
27
27
|
function monthDiff(a, b) {
|
|
28
28
|
return (b.getFullYear() - a.getFullYear()) * 12 + (b.getMonth() - a.getMonth());
|
|
29
29
|
}
|
|
30
|
+
/** 고를 수 없는 날인가 — `min`/`max` 밖이거나 앱 규칙이 막았다. */
|
|
31
|
+
function isDayUnavailable(date, min, max, isDateDisabled) {
|
|
32
|
+
return isOutOfRange(date, min, max) || !!isDateDisabled?.(toISODate(date));
|
|
33
|
+
}
|
|
30
34
|
/** `min`/`max`(ISO 날짜, 둘 다 선택)를 벗어나는가 — 경계일은 포함이다. */
|
|
31
35
|
function isOutOfRange(date, min, max) {
|
|
32
36
|
if (min && date.getTime() < parseISODate(min).getTime()) return true;
|
|
@@ -34,4 +38,4 @@ function isOutOfRange(date, min, max) {
|
|
|
34
38
|
return false;
|
|
35
39
|
}
|
|
36
40
|
//#endregion
|
|
37
|
-
export { addDays, addMonths, daysInMonth, isOutOfRange, isSameDay, monthDiff, parseISODate, startOfMonth, toISODate };
|
|
41
|
+
export { addDays, addMonths, daysInMonth, isDayUnavailable, isOutOfRange, isSameDay, monthDiff, parseISODate, startOfMonth, toISODate };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** `±HH:mm` for the browser's local timezone at `date` (DST-aware — recomputed per date,
|
|
2
|
+
* not cached — `getTimezoneOffset()`'s sign is the inverse of the ISO-8601 offset sign). */
|
|
3
|
+
export declare function localOffset(date: Date): string;
|
|
4
|
+
/** ISO day + `HH:mm` or `HH:mm:ss` → `YYYY-MM-DDTHH:mm:ss±HH:mm` (the offset of that local day and time). */
|
|
5
|
+
export declare function toDateTimeOffset(day: string, time: string): string;
|
|
6
|
+
/** Splits a value into its ISO day and its time — `HH:mm`, or `HH:mm:ss` with `seconds`
|
|
7
|
+
* (`00:00` when there is no time part). */
|
|
8
|
+
export declare function splitDateTime(value: string, seconds?: boolean): {
|
|
9
|
+
day: string;
|
|
10
|
+
time: string;
|
|
11
|
+
};
|
|
12
|
+
/** `HH:mm[:ss]` → `HH:mm`, or `HH:mm:ss` with `seconds` (`:00` added when missing). A time input
|
|
13
|
+
* with a seconds step may report `14:30` for `14:30:00`, so both shapes come in. */
|
|
14
|
+
export declare function normalizeTime(time: string, seconds: boolean): string;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { parseISODate } from "./dates.js";
|
|
2
|
+
//#region src/components/calendar/datetime.ts
|
|
3
|
+
/** `±HH:mm` for the browser's local timezone at `date` (DST-aware — recomputed per date,
|
|
4
|
+
* not cached — `getTimezoneOffset()`'s sign is the inverse of the ISO-8601 offset sign). */
|
|
5
|
+
function localOffset(date) {
|
|
6
|
+
const minutes = -date.getTimezoneOffset();
|
|
7
|
+
const sign = minutes >= 0 ? "+" : "-";
|
|
8
|
+
const abs = Math.abs(minutes);
|
|
9
|
+
return `${sign}${String(Math.floor(abs / 60)).padStart(2, "0")}:${String(abs % 60).padStart(2, "0")}`;
|
|
10
|
+
}
|
|
11
|
+
/** ISO day + `HH:mm` or `HH:mm:ss` → `YYYY-MM-DDTHH:mm:ss±HH:mm` (the offset of that local day and time). */
|
|
12
|
+
function toDateTimeOffset(day, time) {
|
|
13
|
+
const [h, m, s = 0] = time.split(":").map(Number);
|
|
14
|
+
const local = parseISODate(day);
|
|
15
|
+
local.setHours(h, m, s);
|
|
16
|
+
return `${day}T${normalizeTime(time, true)}${localOffset(local)}`;
|
|
17
|
+
}
|
|
18
|
+
/** Splits a value into its ISO day and its time — `HH:mm`, or `HH:mm:ss` with `seconds`
|
|
19
|
+
* (`00:00` when there is no time part). */
|
|
20
|
+
function splitDateTime(value, seconds = false) {
|
|
21
|
+
const [day, rest] = value.split("T");
|
|
22
|
+
const match = rest?.match(/^\d{2}:\d{2}(?::\d{2})?/);
|
|
23
|
+
return {
|
|
24
|
+
day,
|
|
25
|
+
time: normalizeTime(match ? match[0] : "00:00", seconds)
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/** `HH:mm[:ss]` → `HH:mm`, or `HH:mm:ss` with `seconds` (`:00` added when missing). A time input
|
|
29
|
+
* with a seconds step may report `14:30` for `14:30:00`, so both shapes come in. */
|
|
30
|
+
function normalizeTime(time, seconds) {
|
|
31
|
+
const hm = time.slice(0, 5);
|
|
32
|
+
return seconds ? `${hm}:${time.slice(6, 8) || "00"}` : hm;
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { localOffset, normalizeTime, splitDateTime, toDateTimeOffset };
|
|
@@ -73,6 +73,41 @@ var styles = css`
|
|
|
73
73
|
margin-top: 4px;
|
|
74
74
|
border-top: 1px solid var(--u-border-color-weak, #EEEEEE);
|
|
75
75
|
}
|
|
76
|
+
|
|
77
|
+
/* mode="datetime" 의 시간 칸 줄 — 단일 피커는 칸 하나, 기간 피커는 이름 붙은 칸 둘. */
|
|
78
|
+
.calendar-time {
|
|
79
|
+
display: flex;
|
|
80
|
+
justify-content: flex-end;
|
|
81
|
+
flex-wrap: wrap;
|
|
82
|
+
gap: 4px 12px;
|
|
83
|
+
padding: 4px 4px 0;
|
|
84
|
+
}
|
|
85
|
+
.time-field {
|
|
86
|
+
display: inline-flex;
|
|
87
|
+
align-items: center;
|
|
88
|
+
gap: 6px;
|
|
89
|
+
color: var(--u-txt-color-weak, #616161);
|
|
90
|
+
}
|
|
91
|
+
.time-input {
|
|
92
|
+
font-family: inherit;
|
|
93
|
+
font-size: 0.9em;
|
|
94
|
+
padding: 2px 6px;
|
|
95
|
+
border: 1px solid var(--u-input-border-color, #E0E0E0);
|
|
96
|
+
border-radius: 0.25em;
|
|
97
|
+
background-color: var(--u-input-bg-color, #FFFFFF);
|
|
98
|
+
color: var(--u-txt-color, #212121);
|
|
99
|
+
}
|
|
100
|
+
.time-input:focus-visible {
|
|
101
|
+
outline: none;
|
|
102
|
+
box-shadow: 0 0 0 1px var(--u-input-border-color-focus, #1565C0);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/* confirm 모드의 취소·적용 — 줄 끝에 붙는다(빠른 동작이 없으면 혼자서도 오른쪽). */
|
|
106
|
+
.confirm-actions {
|
|
107
|
+
display: flex;
|
|
108
|
+
gap: 4px;
|
|
109
|
+
margin-inline-start: auto;
|
|
110
|
+
}
|
|
76
111
|
`;
|
|
77
112
|
//#endregion
|
|
78
113
|
export { styles };
|
|
@@ -7,7 +7,8 @@ import { UElement } from '../UElement.js';
|
|
|
7
7
|
*
|
|
8
8
|
* `autoplay` 이면 회전 제어 버튼(정지/시작)이 인디케이터 줄의 첫 자리에 그려진다. 포인터가 캐러셀 위에
|
|
9
9
|
* 있는 동안은 잠시 멈추고, 키보드 초점이 안으로 들어오면 사용자가 다시 시작할 때까지 멈춘다
|
|
10
|
-
* (WAI-ARIA APG Carousel · WCAG 2.2.2).
|
|
10
|
+
* (WAI-ARIA APG Carousel · WCAG 2.2.2). 사용자가 동작 줄이기(`prefers-reduced-motion: reduce`)를
|
|
11
|
+
* 켜 두었으면 정지 상태로 시작하고(시작 버튼으로 켤 수 있다), 보는 중에 그 설정이 켜지면 멈춘다.
|
|
11
12
|
*
|
|
12
13
|
* @csspart slides - 슬라이드 컨테이너
|
|
13
14
|
* @csspart prev-button - 이전 버튼
|
|
@@ -46,6 +47,8 @@ export declare class UCarousel extends UElement {
|
|
|
46
47
|
/** 포인터가 캐러셀 위에 있다 — 그동안만 잠시 멈춘다. */
|
|
47
48
|
private hovered;
|
|
48
49
|
private autoplayTimer?;
|
|
50
|
+
/** `prefers-reduced-motion: reduce` 질의 — 연결된 동안만 듣는다. */
|
|
51
|
+
private reducedMotion?;
|
|
49
52
|
private dragStartX;
|
|
50
53
|
private dragStartTime;
|
|
51
54
|
private pointerDown;
|
|
@@ -75,6 +78,9 @@ export declare class UCarousel extends UElement {
|
|
|
75
78
|
private toggleRotation;
|
|
76
79
|
/** 키보드 초점이 들어오면 멈춘다 — 포인터로 누른 초점은 멈추지 않는다(누른 버튼이 정지 버튼이면 그 클릭이 결정한다). */
|
|
77
80
|
private handleFocusIn;
|
|
81
|
+
/** 보는 중에 동작 줄이기가 켜지면 멈춘다. 꺼질 때는 다시 시작하지 않는다 — 멈춘 것을 움직이게
|
|
82
|
+
* 하는 것은 사용자의 몫이다. */
|
|
83
|
+
private handleReducedMotionChange;
|
|
78
84
|
private handlePointerEnter;
|
|
79
85
|
private handlePointerLeave;
|
|
80
86
|
private handleClickCancel;
|
|
@@ -92,6 +92,9 @@ var UCarousel = class UCarousel extends UElement {
|
|
|
92
92
|
const origin = e.composedPath()[0];
|
|
93
93
|
if (origin instanceof Element && origin.matches(":focus-visible")) this.rotationStopped = true;
|
|
94
94
|
};
|
|
95
|
+
this.handleReducedMotionChange = (e) => {
|
|
96
|
+
if (e.matches && this.autoplay) this.rotationStopped = true;
|
|
97
|
+
};
|
|
95
98
|
this.handlePointerEnter = (e) => {
|
|
96
99
|
if (e.pointerType === "mouse") this.hovered = true;
|
|
97
100
|
};
|
|
@@ -133,10 +136,14 @@ var UCarousel = class UCarousel extends UElement {
|
|
|
133
136
|
this.addEventListener("focusin", this.handleFocusIn);
|
|
134
137
|
this.addEventListener("pointerenter", this.handlePointerEnter);
|
|
135
138
|
this.addEventListener("pointerleave", this.handlePointerLeave);
|
|
139
|
+
this.reducedMotion = window.matchMedia?.("(prefers-reduced-motion: reduce)");
|
|
140
|
+
this.reducedMotion?.addEventListener("change", this.handleReducedMotionChange);
|
|
136
141
|
if (this.rotating) this.startAutoplay();
|
|
137
142
|
}
|
|
138
143
|
disconnectedCallback() {
|
|
139
144
|
this.stopAutoplay();
|
|
145
|
+
this.reducedMotion?.removeEventListener("change", this.handleReducedMotionChange);
|
|
146
|
+
this.reducedMotion = void 0;
|
|
140
147
|
this.removeEventListener("focusin", this.handleFocusIn);
|
|
141
148
|
this.removeEventListener("pointerenter", this.handlePointerEnter);
|
|
142
149
|
this.removeEventListener("pointerleave", this.handlePointerLeave);
|
|
@@ -144,7 +151,7 @@ var UCarousel = class UCarousel extends UElement {
|
|
|
144
151
|
}
|
|
145
152
|
willUpdate(changedProperties) {
|
|
146
153
|
super.willUpdate(changedProperties);
|
|
147
|
-
if (changedProperties.has("autoplay") && this.autoplay) this.rotationStopped =
|
|
154
|
+
if (changedProperties.has("autoplay") && this.autoplay) this.rotationStopped = !!this.reducedMotion?.matches;
|
|
148
155
|
if (changedProperties.has("slidesPerView")) this.style.setProperty("--slides-per-view", String(this.perView));
|
|
149
156
|
if (changedProperties.has("gap")) this.style.setProperty("--slide-gap", `${this.gap}px`);
|
|
150
157
|
}
|
|
@@ -2,8 +2,10 @@ import { PropertyValues } from 'lit';
|
|
|
2
2
|
import { UFormControlElement } from '../UFormControlElement.js';
|
|
3
3
|
import { DateTextFormat } from '../../utilities/format.js';
|
|
4
4
|
import { UCalendar } from '../calendar/UCalendar.js';
|
|
5
|
+
import { DateDisabledFn } from '../calendar/dates.js';
|
|
5
6
|
import { UPopover } from '../popover/UPopover.js';
|
|
6
7
|
export type DatePickerMode = 'date' | 'datetime';
|
|
8
|
+
export type { DateDisabledFn } from '../calendar/dates.js';
|
|
7
9
|
/**
|
|
8
10
|
* A single-date(-time)-selection form control. In `mode="date"` (default) the value follows
|
|
9
11
|
* the same convention as the native `input[type=date]`: an ISO `YYYY-MM-DD` string. The field is a
|
|
@@ -51,7 +53,8 @@ export type DatePickerMode = 'date' | 'datetime';
|
|
|
51
53
|
* @cssprop --date-picker-popover-width - width of the calendar popover (default: 296px, independent of trigger width — a fixed-width calendar reads more naturally)
|
|
52
54
|
*
|
|
53
55
|
* @event change - fires when the user clicks a date cell, confirms via keyboard, changes the
|
|
54
|
-
* time input (datetime mode, once a date is set), or clicks the clear button
|
|
56
|
+
* time input (datetime mode, once a date is set), or clicks the clear button — with `confirm`,
|
|
57
|
+
* calendar picks fire it only when Apply commits a different value. Programmatic
|
|
55
58
|
* value assignment does not fire it (same contract as native form controls).
|
|
56
59
|
*/
|
|
57
60
|
export declare class UDatePicker extends UFormControlElement<string> {
|
|
@@ -59,6 +62,10 @@ export declare class UDatePicker extends UFormControlElement<string> {
|
|
|
59
62
|
/** `date` (default) selects a calendar day only. `datetime` also captures a time-of-day and
|
|
60
63
|
* the value becomes a complete ISO-8601 `DateTimeOffset` string. */
|
|
61
64
|
mode: DatePickerMode;
|
|
65
|
+
/** `mode="datetime"`: the time is entered to the second — the time input shows seconds and the
|
|
66
|
+
* text box reads and shows `HH:mm:ss`. Without it the time is to the minute (the value always
|
|
67
|
+
* carries seconds either way). */
|
|
68
|
+
seconds: boolean;
|
|
62
69
|
/** Minimum value (ISO YYYY-MM-DD) — dates before this cannot be selected. Date-only even in
|
|
63
70
|
* `mode="datetime"`; time-of-day is never range-checked. */
|
|
64
71
|
min?: string;
|
|
@@ -67,6 +74,10 @@ export declare class UDatePicker extends UFormControlElement<string> {
|
|
|
67
74
|
max?: string;
|
|
68
75
|
/** Whether to show the clear button */
|
|
69
76
|
clearable: boolean;
|
|
77
|
+
/** App rule for days that cannot be chosen — receives the ISO day, returns `true` to disable it
|
|
78
|
+
* (weekends, holidays, fully booked days). Such days cannot be picked in the calendar ("Today" too);
|
|
79
|
+
* a typed or assigned value on one reports `stepMismatch`. Property only. */
|
|
80
|
+
isDateDisabled?: DateDisabledFn;
|
|
70
81
|
/** Placeholder text (shown when there is no value). Defaults to the pattern to type
|
|
71
82
|
* (`YYYY-MM-DD`, or `YYYY-MM-DD HH:mm` in `mode="datetime"`). */
|
|
72
83
|
placeholder?: string;
|
|
@@ -75,6 +86,11 @@ export declare class UDatePicker extends UFormControlElement<string> {
|
|
|
75
86
|
* `20261002` are read in both. The time, in `mode="datetime"`, is always `HH:mm`. The value is
|
|
76
87
|
* ISO either way. */
|
|
77
88
|
format: DateTextFormat;
|
|
89
|
+
/** Picks in the calendar wait for an Apply button instead of committing at once. Choosing a day,
|
|
90
|
+
* the time, "today" or "clear" inside the calendar only stages the choice; Apply commits it, fires
|
|
91
|
+
* `change` and closes; Cancel, Escape or closing the calendar any other way drops it. Typing in
|
|
92
|
+
* the text box still commits on Enter or leaving the field. */
|
|
93
|
+
confirm: boolean;
|
|
78
94
|
containerEl?: HTMLElement;
|
|
79
95
|
popoverEl?: UPopover;
|
|
80
96
|
calendarEl?: UCalendar;
|
|
@@ -84,18 +100,23 @@ export declare class UDatePicker extends UFormControlElement<string> {
|
|
|
84
100
|
/** Time-of-day for the next selection while no `value` exists yet (`mode="datetime"` only) —
|
|
85
101
|
* once `value` is set, the time input reads/writes its time portion directly instead. */
|
|
86
102
|
private pendingTime;
|
|
87
|
-
/**
|
|
88
|
-
private
|
|
89
|
-
/** The
|
|
90
|
-
private
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
private focusCalendarOnOpen;
|
|
103
|
+
/** With `confirm`, the choice made in the open calendar that Apply would commit. */
|
|
104
|
+
private staged?;
|
|
105
|
+
/** The typed-date text box — what is being typed, committing it, opening the calendar. */
|
|
106
|
+
private readonly textEntry;
|
|
107
|
+
protected shouldValidate(changed: PropertyValues): boolean;
|
|
108
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
94
109
|
protected updated(changed: PropertyValues): void;
|
|
110
|
+
/** What the open calendar shows and edits: the staged choice with `confirm`, otherwise the value. */
|
|
111
|
+
private get working();
|
|
112
|
+
/** The value as the text box shows it: `YYYY-MM-DD`, or `YYYY-MM-DD HH:mm` in `mode="datetime"`. */
|
|
113
|
+
private shownText;
|
|
95
114
|
render(): import('lit-html').TemplateResult<1>;
|
|
96
115
|
private renderCalendar;
|
|
97
116
|
private renderTimeRow;
|
|
98
117
|
private renderFooter;
|
|
118
|
+
/** A day the calendar refuses — outside `min`/`max` or disabled by `isDateDisabled`. */
|
|
119
|
+
private unavailable;
|
|
99
120
|
/** `timeOverride` lets a caller force the time-of-day (the "today" quick action wants
|
|
100
121
|
* "right now", overriding whatever time was previously set) — a plain day-cell click omits
|
|
101
122
|
* it, which preserves the existing time-of-day (or `pendingTime`) so switching the date
|
|
@@ -108,22 +129,9 @@ export declare class UDatePicker extends UFormControlElement<string> {
|
|
|
108
129
|
private handleTimeChange;
|
|
109
130
|
private handleDaySelect;
|
|
110
131
|
private get textInputEl();
|
|
111
|
-
private openCalendar;
|
|
112
132
|
/** The typed text as a date (ISO) and, in `mode="datetime"`, a time — or `null` when it is not one.
|
|
113
133
|
* Typing only a date in `mode="datetime"` keeps the time already set (or the pending one). */
|
|
114
134
|
private parseTyped;
|
|
115
|
-
private handleTextInput;
|
|
116
|
-
/** A click anywhere on the field (not on its clear or calendar button) opens the calendar and
|
|
117
|
-
* puts the caret in the text box — the person can pick a day or keep typing. */
|
|
118
|
-
private handleContainerClick;
|
|
119
|
-
private handleCalendarButtonClick;
|
|
120
|
-
/** ArrowDown / Alt+ArrowDown opens the calendar and moves into it (the combobox convention);
|
|
121
|
-
* Enter commits what was typed. Escape is the popover layer's — it closes the calendar. */
|
|
122
|
-
private handleTextKeydown;
|
|
123
|
-
/** Turns the typed text into the value. Empty text clears it; text that is not a date also clears
|
|
124
|
-
* it and reports `badInput` (the native date input does the same); a date outside `min`/`max` is
|
|
125
|
-
* kept and reported as out of range — the person typed it, so it is not silently dropped. */
|
|
126
|
-
private commitText;
|
|
127
135
|
/** Escape inside the grid closes the calendar and returns focus to the trigger — the grid
|
|
128
136
|
* itself does not know it lives in a popover, so the picker owns this. */
|
|
129
137
|
private handleCalendarKeydown;
|
|
@@ -139,6 +147,10 @@ export declare class UDatePicker extends UFormControlElement<string> {
|
|
|
139
147
|
/** 캘린더 팝오버 안 "초기화" 퀵액션 — 트리거의 clear 아이콘(`handleClearClick`)과 값을
|
|
140
148
|
* 비우는 로직은 같지만, 팝오버가 열린 채로 눌렸으므로 선택 완료와 동일하게 닫아 준다. */
|
|
141
149
|
private handleFooterResetClick;
|
|
150
|
+
/** `confirm` 모드의 «적용» — 달력에서 고른 것을 값으로 확정한다(비운 채면 값을 비운다). */
|
|
151
|
+
private handleApplyClick;
|
|
152
|
+
/** `confirm` 모드의 «취소» — 고른 것은 다음에 열 때 값에서 다시 시작하므로 닫기만 하면 버려진다. */
|
|
153
|
+
private handleCancelClick;
|
|
142
154
|
private resetValue;
|
|
143
155
|
/** suffix `u-icon`은 순수 표시 요소(버튼 아님)라 네이티브 키보드 활성화가 없다 —
|
|
144
156
|
* `role="button"`+`tabindex="0"`로 포커스 가능하게 한 뒤, Enter/Space를 같은 클릭
|