@iyulab/components 1.57.1 → 2.0.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 +208 -0
- package/README.md +3 -1
- package/dist/_virtual/_glob-assets_raw/dark.css.e8ac080d.js +1 -1
- package/dist/_virtual/_glob-assets_raw/light.css.637cb2f8.js +1 -1
- package/dist/assets/locales/ar.json.js +16 -2
- package/dist/assets/locales/de.json.js +16 -2
- package/dist/assets/locales/en.json.js +16 -2
- package/dist/assets/locales/es.json.js +18 -2
- package/dist/assets/locales/fr.json.js +16 -2
- package/dist/assets/locales/id.json.js +16 -2
- package/dist/assets/locales/ja.json.js +18 -2
- package/dist/assets/locales/ko.json.js +18 -2
- package/dist/assets/locales/pt-BR.json.js +16 -2
- package/dist/assets/locales/ru.json.js +16 -2
- package/dist/assets/locales/th.json.js +18 -2
- package/dist/assets/locales/vi.json.js +16 -2
- package/dist/assets/locales/zh-CN.json.js +18 -2
- package/dist/assets/locales/zh-TW.json.js +18 -2
- package/dist/components/UElement.styles.js +2 -2
- package/dist/components/alert/UAlert.d.ts +12 -7
- package/dist/components/alert/UAlert.js +3 -3
- package/dist/components/alert/UAlert.styles.js +6 -23
- package/dist/components/badge/UBadge.d.ts +5 -5
- package/dist/components/badge/UBadge.js +3 -3
- package/dist/components/badge/UBadge.styles.js +4 -4
- package/dist/components/breadcrumb-item/UBreadcrumbItem.styles.js +1 -1
- package/dist/components/button/UButton.d.ts +32 -16
- package/dist/components/button/UButton.js +38 -5
- package/dist/components/button/UButton.styles.js +67 -50
- package/dist/components/button/forwarded-aria.d.ts +6 -0
- package/dist/components/button/forwarded-aria.js +15 -0
- package/dist/components/button-group/UButtonGroup.d.ts +4 -4
- package/dist/components/button-group/UButtonGroup.js +8 -8
- package/dist/components/button-group/UButtonGroup.styles.js +2 -2
- package/dist/components/calendar/UCalendar.d.ts +4 -0
- package/dist/components/calendar/UCalendar.js +5 -4
- package/dist/components/calendar/UCalendar.styles.js +4 -3
- 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 +42 -2
- package/dist/components/card/UCard.d.ts +4 -3
- package/dist/components/card/UCard.js +3 -3
- package/dist/components/card/UCard.styles.js +2 -1
- package/dist/components/carousel/UCarousel.d.ts +7 -1
- package/dist/components/carousel/UCarousel.js +10 -3
- package/dist/components/carousel/UCarousel.styles.js +17 -6
- package/dist/components/checkbox/UCheckbox.d.ts +8 -9
- package/dist/components/checkbox/UCheckbox.js +3 -3
- package/dist/components/checkbox/UCheckbox.styles.js +22 -18
- package/dist/components/chip/UChip.d.ts +2 -2
- package/dist/components/chip/UChip.js +4 -4
- package/dist/components/copy-button/UCopyButton.d.ts +2 -2
- package/dist/components/copy-button/UCopyButton.js +4 -4
- package/dist/components/date-picker/UDatePicker.d.ts +32 -1
- package/dist/components/date-picker/UDatePicker.js +96 -33
- package/dist/components/date-picker/UDatePicker.styles.js +10 -18
- package/dist/components/date-range-picker/UDateRangePicker.d.ts +72 -7
- package/dist/components/date-range-picker/UDateRangePicker.js +210 -34
- package/dist/components/date-range-picker/UDateRangePicker.styles.js +13 -3
- package/dist/components/dialog/UDialog.js +1 -1
- package/dist/components/divider/UDivider.d.ts +3 -3
- package/dist/components/divider/UDivider.js +2 -2
- package/dist/components/divider/UDivider.styles.js +5 -5
- package/dist/components/drawer/UDrawer.js +1 -1
- package/dist/components/expander/UExpander.styles.js +2 -2
- package/dist/components/file-input/UFileInput.styles.js +5 -2
- package/dist/components/icon-button/UIconButton.d.ts +4 -3
- package/dist/components/icon-button/UIconButton.js +16 -6
- package/dist/components/icon-button/UIconButton.styles.js +2 -2
- package/dist/components/input/UInput.d.ts +12 -5
- package/dist/components/input/UInput.js +7 -4
- package/dist/components/input/UInput.styles.js +60 -30
- package/dist/components/menu/UMenu.d.ts +5 -4
- package/dist/components/menu/UMenu.js +3 -3
- package/dist/components/menu/UMenu.styles.js +1 -1
- package/dist/components/menu-item/UMenuItem.styles.js +1 -1
- package/dist/components/option/UOption.d.ts +1 -0
- package/dist/components/option/UOption.js +6 -3
- package/dist/components/option/UOption.styles.js +1 -1
- package/dist/components/progress-bar/UProgressBar.styles.js +11 -0
- package/dist/components/radio/URadio.d.ts +27 -6
- package/dist/components/radio/URadio.js +48 -12
- package/dist/components/radio/URadio.styles.js +47 -13
- package/dist/components/rating/URating.styles.js +5 -1
- package/dist/components/select/USelect.d.ts +9 -2
- package/dist/components/select/USelect.js +7 -2
- package/dist/components/select/USelect.styles.js +55 -26
- package/dist/components/slider/USlider.styles.js +4 -4
- package/dist/components/spinner/USpinner.styles.js +2 -0
- package/dist/components/split-panel/USplitPanel.styles.js +2 -1
- package/dist/components/steps/USteps.d.ts +57 -0
- package/dist/components/steps/USteps.js +58 -0
- package/dist/components/steps/USteps.styles.d.ts +1 -0
- package/dist/components/steps/USteps.styles.js +110 -0
- package/dist/components/switch/USwitch.styles.js +5 -3
- package/dist/components/tab/UTab.js +2 -2
- package/dist/components/tab/UTab.styles.js +1 -1
- package/dist/components/tab-panel/UTabPanel.d.ts +11 -2
- package/dist/components/tab-panel/UTabPanel.js +33 -5
- package/dist/components/tab-panel/UTabPanel.styles.js +29 -29
- package/dist/components/tag/UTag.d.ts +14 -6
- package/dist/components/tag/UTag.js +8 -3
- package/dist/components/tag/UTag.styles.js +33 -26
- package/dist/components/textarea/UTextarea.d.ts +9 -3
- package/dist/components/textarea/UTextarea.js +7 -2
- package/dist/components/textarea/UTextarea.styles.js +41 -22
- package/dist/components/tree-item/UTreeItem.styles.js +7 -5
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -2
- package/dist/plugins/vite-plugin-react-wrapper.js +14 -5
- package/dist/react/UAlert.d.ts +4 -2
- package/dist/react/UAvatar.d.ts +4 -2
- package/dist/react/UBadge.d.ts +4 -2
- package/dist/react/UBreadcrumb.d.ts +4 -2
- package/dist/react/UBreadcrumbItem.d.ts +4 -2
- package/dist/react/UButton.d.ts +4 -2
- package/dist/react/UButtonGroup.d.ts +4 -2
- package/dist/react/UCard.d.ts +4 -2
- package/dist/react/UCarousel.d.ts +4 -2
- package/dist/react/UCheckbox.d.ts +4 -2
- package/dist/react/UChip.d.ts +4 -2
- package/dist/react/UCopyButton.d.ts +4 -2
- package/dist/react/UDatePicker.d.ts +4 -2
- package/dist/react/UDateRangePicker.d.ts +4 -2
- package/dist/react/UDialog.d.ts +4 -2
- package/dist/react/UDivider.d.ts +4 -2
- package/dist/react/UDrawer.d.ts +4 -2
- package/dist/react/UExpander.d.ts +4 -2
- package/dist/react/UField.d.ts +4 -2
- package/dist/react/UFileInput.d.ts +4 -2
- package/dist/react/UForm.d.ts +4 -2
- package/dist/react/UIcon.d.ts +4 -2
- package/dist/react/UIconButton.d.ts +4 -2
- package/dist/react/UInput.d.ts +4 -2
- package/dist/react/UMenu.d.ts +4 -2
- package/dist/react/UMenuItem.d.ts +4 -2
- package/dist/react/UOption.d.ts +4 -2
- package/dist/react/UPanel.d.ts +4 -2
- package/dist/react/UPopover.d.ts +4 -2
- package/dist/react/UProgressBar.d.ts +4 -2
- package/dist/react/UProgressRing.d.ts +4 -2
- package/dist/react/URadio.d.ts +4 -2
- package/dist/react/URating.d.ts +4 -2
- package/dist/react/USelect.d.ts +4 -2
- package/dist/react/USkeleton.d.ts +4 -2
- package/dist/react/USlider.d.ts +4 -2
- package/dist/react/USpinner.d.ts +4 -2
- package/dist/react/USplitPanel.d.ts +4 -2
- package/dist/react/USteps.d.ts +14 -0
- package/dist/react/USteps.js +10 -0
- package/dist/react/USwitch.d.ts +4 -2
- package/dist/react/UTab.d.ts +4 -2
- package/dist/react/UTabPanel.d.ts +4 -2
- package/dist/react/UTag.d.ts +4 -2
- package/dist/react/UText.d.ts +4 -2
- package/dist/react/UTextarea.d.ts +4 -2
- package/dist/react/UTooltip.d.ts +4 -2
- package/dist/react/UTree.d.ts +4 -2
- package/dist/react/UTreeItem.d.ts +4 -2
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.js +1 -0
- package/dist/styles/dark.css +42 -0
- package/dist/styles/light.css +44 -0
- package/dist/utilities/Dialog.d.ts +2 -2
- package/dist/utilities/Dialog.js +3 -3
- package/dist/utilities/Locale.d.ts +2 -2
- package/dist/utilities/Locale.js +2 -2
- package/dist/utilities/Toast.d.ts +2 -2
- package/dist/utilities/Toast.js +1 -1
- package/dist/utilities/format.d.ts +32 -4
- package/dist/utilities/format.js +131 -15
- package/dist/utilities/icons.d.ts +12 -3
- package/dist/utilities/icons.js +24 -6
- package/package.json +1 -1
- package/skills/iyulab-components/SKILL.md +3 -3
- package/skills/iyulab-components/references/components/alert.md +5 -5
- package/skills/iyulab-components/references/components/badge.md +3 -3
- package/skills/iyulab-components/references/components/button-group.md +3 -3
- package/skills/iyulab-components/references/components/button.md +34 -19
- package/skills/iyulab-components/references/components/card.md +3 -3
- package/skills/iyulab-components/references/components/carousel.md +3 -1
- package/skills/iyulab-components/references/components/checkbox.md +5 -5
- package/skills/iyulab-components/references/components/chip.md +2 -2
- package/skills/iyulab-components/references/components/copy-button.md +1 -1
- package/skills/iyulab-components/references/components/date-picker.md +35 -2
- package/skills/iyulab-components/references/components/date-range-picker.md +53 -5
- package/skills/iyulab-components/references/components/dialog.md +2 -2
- package/skills/iyulab-components/references/components/divider.md +2 -2
- package/skills/iyulab-components/references/components/drawer.md +1 -1
- package/skills/iyulab-components/references/components/field.md +1 -1
- package/skills/iyulab-components/references/components/icon-button.md +8 -2
- package/skills/iyulab-components/references/components/input.md +4 -2
- package/skills/iyulab-components/references/components/menu.md +1 -1
- package/skills/iyulab-components/references/components/radio.md +16 -4
- package/skills/iyulab-components/references/components/select.md +2 -1
- package/skills/iyulab-components/references/components/steps.md +66 -0
- package/skills/iyulab-components/references/components/tab-panel.md +10 -3
- package/skills/iyulab-components/references/components/tag.md +11 -7
- package/skills/iyulab-components/references/components/textarea.md +2 -1
- package/skills/iyulab-components/references/usage.md +1 -1
- package/skills/iyulab-components/references/utilities/dialog.md +2 -2
- package/skills/iyulab-components/references/utilities/icons.md +2 -2
- package/skills/iyulab-components/references/utilities/locale.md +1 -1
- package/skills/iyulab-components/references/utilities/theme.md +9 -5
- package/skills/iyulab-components/references/utilities/toast.md +2 -2
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { PropertyValues } from 'lit';
|
|
2
|
+
import { FieldSize } from '../input/UInput.js';
|
|
2
3
|
import { UFormControlElement } from '../UFormControlElement.js';
|
|
3
4
|
import { DateTextFormat } from '../../utilities/format.js';
|
|
4
5
|
import { UCalendar } from '../calendar/UCalendar.js';
|
|
6
|
+
import { DateDisabledFn } from '../calendar/dates.js';
|
|
5
7
|
import { UPopover } from '../popover/UPopover.js';
|
|
6
8
|
export type DatePickerMode = 'date' | 'datetime';
|
|
9
|
+
export type { DateDisabledFn } from '../calendar/dates.js';
|
|
7
10
|
/**
|
|
8
11
|
* A single-date(-time)-selection form control. In `mode="date"` (default) the value follows
|
|
9
12
|
* the same convention as the native `input[type=date]`: an ISO `YYYY-MM-DD` string. The field is a
|
|
@@ -51,14 +54,21 @@ export type DatePickerMode = 'date' | 'datetime';
|
|
|
51
54
|
* @cssprop --date-picker-popover-width - width of the calendar popover (default: 296px, independent of trigger width — a fixed-width calendar reads more naturally)
|
|
52
55
|
*
|
|
53
56
|
* @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
|
|
57
|
+
* time input (datetime mode, once a date is set), or clicks the clear button — with `confirm`,
|
|
58
|
+
* calendar picks fire it only when Apply commits a different value. Programmatic
|
|
55
59
|
* value assignment does not fire it (same contract as native form controls).
|
|
56
60
|
*/
|
|
57
61
|
export declare class UDatePicker extends UFormControlElement<string> {
|
|
58
62
|
static styles: import('lit').CSSResultGroup[];
|
|
63
|
+
/** 크기 — 다른 필드·버튼과 같은 세 단(`sm` 12px · `md` = `--u-density`(14px) · `lg` 16px). */
|
|
64
|
+
size: FieldSize;
|
|
59
65
|
/** `date` (default) selects a calendar day only. `datetime` also captures a time-of-day and
|
|
60
66
|
* the value becomes a complete ISO-8601 `DateTimeOffset` string. */
|
|
61
67
|
mode: DatePickerMode;
|
|
68
|
+
/** `mode="datetime"`: the time is entered to the second — the time input shows seconds and the
|
|
69
|
+
* text box reads and shows `HH:mm:ss`. Without it the time is to the minute (the value always
|
|
70
|
+
* carries seconds either way). */
|
|
71
|
+
seconds: boolean;
|
|
62
72
|
/** Minimum value (ISO YYYY-MM-DD) — dates before this cannot be selected. Date-only even in
|
|
63
73
|
* `mode="datetime"`; time-of-day is never range-checked. */
|
|
64
74
|
min?: string;
|
|
@@ -67,6 +77,10 @@ export declare class UDatePicker extends UFormControlElement<string> {
|
|
|
67
77
|
max?: string;
|
|
68
78
|
/** Whether to show the clear button */
|
|
69
79
|
clearable: boolean;
|
|
80
|
+
/** App rule for days that cannot be chosen — receives the ISO day, returns `true` to disable it
|
|
81
|
+
* (weekends, holidays, fully booked days). Such days cannot be picked in the calendar ("Today" too);
|
|
82
|
+
* a typed or assigned value on one reports `stepMismatch`. Property only. */
|
|
83
|
+
isDateDisabled?: DateDisabledFn;
|
|
70
84
|
/** Placeholder text (shown when there is no value). Defaults to the pattern to type
|
|
71
85
|
* (`YYYY-MM-DD`, or `YYYY-MM-DD HH:mm` in `mode="datetime"`). */
|
|
72
86
|
placeholder?: string;
|
|
@@ -75,6 +89,11 @@ export declare class UDatePicker extends UFormControlElement<string> {
|
|
|
75
89
|
* `20261002` are read in both. The time, in `mode="datetime"`, is always `HH:mm`. The value is
|
|
76
90
|
* ISO either way. */
|
|
77
91
|
format: DateTextFormat;
|
|
92
|
+
/** Picks in the calendar wait for an Apply button instead of committing at once. Choosing a day,
|
|
93
|
+
* the time, "today" or "clear" inside the calendar only stages the choice; Apply commits it, fires
|
|
94
|
+
* `change` and closes; Cancel, Escape or closing the calendar any other way drops it. Typing in
|
|
95
|
+
* the text box still commits on Enter or leaving the field. */
|
|
96
|
+
confirm: boolean;
|
|
78
97
|
containerEl?: HTMLElement;
|
|
79
98
|
popoverEl?: UPopover;
|
|
80
99
|
calendarEl?: UCalendar;
|
|
@@ -84,15 +103,23 @@ export declare class UDatePicker extends UFormControlElement<string> {
|
|
|
84
103
|
/** Time-of-day for the next selection while no `value` exists yet (`mode="datetime"` only) —
|
|
85
104
|
* once `value` is set, the time input reads/writes its time portion directly instead. */
|
|
86
105
|
private pendingTime;
|
|
106
|
+
/** With `confirm`, the choice made in the open calendar that Apply would commit. */
|
|
107
|
+
private staged?;
|
|
87
108
|
/** The typed-date text box — what is being typed, committing it, opening the calendar. */
|
|
88
109
|
private readonly textEntry;
|
|
110
|
+
protected shouldValidate(changed: PropertyValues): boolean;
|
|
111
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
89
112
|
protected updated(changed: PropertyValues): void;
|
|
113
|
+
/** What the open calendar shows and edits: the staged choice with `confirm`, otherwise the value. */
|
|
114
|
+
private get working();
|
|
90
115
|
/** The value as the text box shows it: `YYYY-MM-DD`, or `YYYY-MM-DD HH:mm` in `mode="datetime"`. */
|
|
91
116
|
private shownText;
|
|
92
117
|
render(): import('lit-html').TemplateResult<1>;
|
|
93
118
|
private renderCalendar;
|
|
94
119
|
private renderTimeRow;
|
|
95
120
|
private renderFooter;
|
|
121
|
+
/** A day the calendar refuses — outside `min`/`max` or disabled by `isDateDisabled`. */
|
|
122
|
+
private unavailable;
|
|
96
123
|
/** `timeOverride` lets a caller force the time-of-day (the "today" quick action wants
|
|
97
124
|
* "right now", overriding whatever time was previously set) — a plain day-cell click omits
|
|
98
125
|
* it, which preserves the existing time-of-day (or `pendingTime`) so switching the date
|
|
@@ -123,6 +150,10 @@ export declare class UDatePicker extends UFormControlElement<string> {
|
|
|
123
150
|
/** 캘린더 팝오버 안 "초기화" 퀵액션 — 트리거의 clear 아이콘(`handleClearClick`)과 값을
|
|
124
151
|
* 비우는 로직은 같지만, 팝오버가 열린 채로 눌렸으므로 선택 완료와 동일하게 닫아 준다. */
|
|
125
152
|
private handleFooterResetClick;
|
|
153
|
+
/** `confirm` 모드의 «적용» — 달력에서 고른 것을 값으로 확정한다(비운 채면 값을 비운다). */
|
|
154
|
+
private handleApplyClick;
|
|
155
|
+
/** `confirm` 모드의 «취소» — 고른 것은 다음에 열 때 값에서 다시 시작하므로 닫기만 하면 버려진다. */
|
|
156
|
+
private handleCancelClick;
|
|
126
157
|
private resetValue;
|
|
127
158
|
/** suffix `u-icon`은 순수 표시 요소(버튼 아님)라 네이티브 키보드 활성화가 없다 —
|
|
128
159
|
* `role="button"`+`tabindex="0"`로 포커스 가능하게 한 뒤, Enter/Space를 같은 클릭
|
|
@@ -5,48 +5,44 @@ import "../button/UButton.js";
|
|
|
5
5
|
import "../icon/UIcon.js";
|
|
6
6
|
import { Locale } from "../../utilities/Locale.js";
|
|
7
7
|
import { dateTextPattern, formatDateText, formatDateTimeText, parseDate, parseDateTime } from "../../utilities/format.js";
|
|
8
|
-
import {
|
|
8
|
+
import { isDayUnavailable, parseISODate, toISODate } from "../calendar/dates.js";
|
|
9
9
|
import { UCalendar } from "../calendar/UCalendar.js";
|
|
10
10
|
import "../field/UField.js";
|
|
11
11
|
import { UPopover } from "../popover/UPopover.js";
|
|
12
12
|
import { DateTextController } from "../calendar/date-text-controller.js";
|
|
13
|
+
import { normalizeTime, splitDateTime, toDateTimeOffset } from "../calendar/datetime.js";
|
|
13
14
|
import { styles } from "../calendar/picker.styles.js";
|
|
14
15
|
import { styles as styles$1 } from "./UDatePicker.styles.js";
|
|
15
16
|
import { html } from "lit";
|
|
16
17
|
import { customElement, property, query, state } from "lit/decorators.js";
|
|
17
18
|
import { ifDefined } from "lit/directives/if-defined.js";
|
|
18
19
|
//#region src/components/date-picker/UDatePicker.ts
|
|
19
|
-
/** `±HH:mm` for the browser's local timezone at `date` (DST-aware — recomputed per date,
|
|
20
|
-
* not cached — `getTimezoneOffset()`'s sign is the inverse of the ISO-8601 offset sign). */
|
|
21
|
-
function getLocalOffset(date) {
|
|
22
|
-
const minutes = -date.getTimezoneOffset();
|
|
23
|
-
const sign = minutes >= 0 ? "+" : "-";
|
|
24
|
-
const abs = Math.abs(minutes);
|
|
25
|
-
return `${sign}${String(Math.floor(abs / 60)).padStart(2, "0")}:${String(abs % 60).padStart(2, "0")}`;
|
|
26
|
-
}
|
|
27
20
|
/** Builds the `value` for the given mode — `datetime` always emits seconds + local offset so
|
|
28
21
|
* the result is unconditionally a valid, unambiguous ISO-8601 `DateTimeOffset` regardless of
|
|
29
22
|
* how coarse the UI input was (this is the guarantee the datetime mode request asked for). */
|
|
30
23
|
function buildValue(date, mode, time) {
|
|
31
|
-
return mode === "datetime" ?
|
|
24
|
+
return mode === "datetime" ? toDateTimeOffset(toISODate(date), time) : toISODate(date);
|
|
32
25
|
}
|
|
33
|
-
/** Splits a `value` into its date portion (as a `Date
|
|
34
|
-
*
|
|
35
|
-
*
|
|
26
|
+
/** Splits a `value` into its date portion (as a local-midnight `Date` — no timezone conversion)
|
|
27
|
+
* and its `HH:mm:ss` time-of-day (`'00:00:00'` if absent — covers both plain date-mode values and a
|
|
28
|
+
* datetime value with no time captured yet). Seconds are kept here whatever `seconds` says, so
|
|
29
|
+
* picking another day never drops seconds a value already has. */
|
|
36
30
|
function splitValue(value) {
|
|
37
|
-
const
|
|
38
|
-
const match = rest?.match(/^(\d{2}:\d{2})/);
|
|
31
|
+
const { day, time } = splitDateTime(value, true);
|
|
39
32
|
return {
|
|
40
|
-
date: parseISODate(
|
|
41
|
-
time
|
|
33
|
+
date: parseISODate(day),
|
|
34
|
+
time
|
|
42
35
|
};
|
|
43
36
|
}
|
|
44
37
|
var UDatePicker = class UDatePicker extends UFormControlElement {
|
|
45
38
|
constructor(..._args) {
|
|
46
39
|
super(..._args);
|
|
40
|
+
this.size = "md";
|
|
47
41
|
this.mode = "date";
|
|
42
|
+
this.seconds = false;
|
|
48
43
|
this.clearable = false;
|
|
49
44
|
this.format = "iso";
|
|
45
|
+
this.confirm = false;
|
|
50
46
|
this.calendarId = `u-date-picker-calendar-${Math.random().toString(36).slice(2, 8)}`;
|
|
51
47
|
this.open = false;
|
|
52
48
|
this.pendingTime = "00:00";
|
|
@@ -71,8 +67,12 @@ var UDatePicker = class UDatePicker extends UFormControlElement {
|
|
|
71
67
|
interactive: () => !this.effectivelyDisabled && !this.readonly
|
|
72
68
|
});
|
|
73
69
|
this.handleTimeChange = (e) => {
|
|
74
|
-
const time = e.target.value || "00:00";
|
|
70
|
+
const time = normalizeTime(e.target.value || "00:00", this.seconds);
|
|
75
71
|
this.pendingTime = time;
|
|
72
|
+
if (this.confirm) {
|
|
73
|
+
if (this.staged) this.staged = buildValue(splitValue(this.staged).date, this.mode, time);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
76
|
if (!this.value) return;
|
|
77
77
|
const iso = buildValue(splitValue(this.value).date, this.mode, time);
|
|
78
78
|
const changed = iso !== this.value;
|
|
@@ -103,14 +103,32 @@ var UDatePicker = class UDatePicker extends UFormControlElement {
|
|
|
103
103
|
};
|
|
104
104
|
this.handleTodayClick = () => {
|
|
105
105
|
const now = /* @__PURE__ */ new Date();
|
|
106
|
-
const
|
|
106
|
+
const pad = (n) => String(n).padStart(2, "0");
|
|
107
|
+
const time = this.mode === "datetime" ? `${pad(now.getHours())}:${pad(now.getMinutes())}${this.seconds ? `:${pad(now.getSeconds())}` : ""}` : void 0;
|
|
107
108
|
this.selectDay(now, time);
|
|
108
109
|
};
|
|
109
110
|
this.handleFooterResetClick = () => {
|
|
111
|
+
if (this.confirm) {
|
|
112
|
+
this.staged = void 0;
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
110
115
|
this.resetValue();
|
|
111
116
|
this.popoverEl?.hide();
|
|
112
117
|
(this.textInputEl ?? this.containerEl)?.focus();
|
|
113
118
|
};
|
|
119
|
+
this.handleApplyClick = () => {
|
|
120
|
+
const next = this.staged;
|
|
121
|
+
const changed = next !== this.value;
|
|
122
|
+
this.textEntry.clear();
|
|
123
|
+
this.value = next;
|
|
124
|
+
if (changed) this.emitChange();
|
|
125
|
+
this.popoverEl?.hide();
|
|
126
|
+
(this.textInputEl ?? this.containerEl)?.focus();
|
|
127
|
+
};
|
|
128
|
+
this.handleCancelClick = () => {
|
|
129
|
+
this.popoverEl?.hide();
|
|
130
|
+
(this.textInputEl ?? this.containerEl)?.focus();
|
|
131
|
+
};
|
|
114
132
|
this.handleClearKeydown = (e) => {
|
|
115
133
|
if (e.key !== "Enter" && e.key !== " ") return;
|
|
116
134
|
e.preventDefault();
|
|
@@ -124,17 +142,28 @@ var UDatePicker = class UDatePicker extends UFormControlElement {
|
|
|
124
142
|
styles$1
|
|
125
143
|
];
|
|
126
144
|
}
|
|
145
|
+
shouldValidate(changed) {
|
|
146
|
+
return super.shouldValidate(changed) || changed.has("min") || changed.has("max") || changed.has("isDateDisabled");
|
|
147
|
+
}
|
|
148
|
+
willUpdate(changed) {
|
|
149
|
+
super.willUpdate(changed);
|
|
150
|
+
if (this.open && (changed.has("open") || changed.has("value"))) this.staged = this.value;
|
|
151
|
+
}
|
|
127
152
|
updated(changed) {
|
|
128
153
|
super.updated(changed);
|
|
129
154
|
if (changed.has("value")) this.internals?.setFormValue(this.value ?? "");
|
|
130
155
|
if (changed.has("open")) this.internals?.states[this.open ? "add" : "delete"]("open");
|
|
131
156
|
if (changed.has("open") && this.open) this.textEntry.calendarOpened(this.value ? toISODate(splitValue(this.value).date) : /* @__PURE__ */ new Date());
|
|
132
157
|
}
|
|
158
|
+
/** What the open calendar shows and edits: the staged choice with `confirm`, otherwise the value. */
|
|
159
|
+
get working() {
|
|
160
|
+
return this.confirm && this.open ? this.staged : this.value;
|
|
161
|
+
}
|
|
133
162
|
/** The value as the text box shows it: `YYYY-MM-DD`, or `YYYY-MM-DD HH:mm` in `mode="datetime"`. */
|
|
134
163
|
shownText() {
|
|
135
164
|
if (!this.value) return "";
|
|
136
165
|
const { date, time } = splitValue(this.value);
|
|
137
|
-
return this.mode === "datetime" ? formatDateTimeText(`${toISODate(date)}T${time}`, this.format) : formatDateText(toISODate(date), this.format);
|
|
166
|
+
return this.mode === "datetime" ? formatDateTimeText(`${toISODate(date)}T${time}`, this.format, void 0, this.seconds) : formatDateText(toISODate(date), this.format);
|
|
138
167
|
}
|
|
139
168
|
render() {
|
|
140
169
|
const datetime = this.mode === "datetime";
|
|
@@ -159,7 +188,7 @@ var UDatePicker = class UDatePicker extends UFormControlElement {
|
|
|
159
188
|
aria-label=${ifDefined(this.resolvedAriaLabel)}
|
|
160
189
|
aria-description=${ifDefined(this.resolvedAriaDescription)}
|
|
161
190
|
aria-invalid=${this.textEntry.badText ? "true" : "false"}
|
|
162
|
-
placeholder=${this.placeholder ?? (datetime ? `${dateTextPattern(this.format)} HH:mm` : dateTextPattern(this.format))}
|
|
191
|
+
placeholder=${this.placeholder ?? (datetime ? `${dateTextPattern(this.format)} ${this.seconds ? "HH:mm:ss" : "HH:mm"}` : dateTextPattern(this.format))}
|
|
163
192
|
.value=${this.textEntry.text}
|
|
164
193
|
?disabled=${this.effectivelyDisabled}
|
|
165
194
|
?readonly=${this.readonly}
|
|
@@ -210,9 +239,10 @@ var UDatePicker = class UDatePicker extends UFormControlElement {
|
|
|
210
239
|
<div class="calendar" part="calendar">
|
|
211
240
|
<u-calendar
|
|
212
241
|
exportparts="calendar-header, calendar-title, calendar-weekdays, calendar-grid, calendar-week, day"
|
|
213
|
-
.value=${this.
|
|
242
|
+
.value=${this.working ? toISODate(splitValue(this.working).date) : void 0}
|
|
214
243
|
.min=${this.min}
|
|
215
244
|
.max=${this.max}
|
|
245
|
+
.isDateDisabled=${this.isDateDisabled}
|
|
216
246
|
@day-select=${this.handleDaySelect}
|
|
217
247
|
@keydown=${this.handleCalendarKeydown}
|
|
218
248
|
></u-calendar>
|
|
@@ -223,40 +253,55 @@ var UDatePicker = class UDatePicker extends UFormControlElement {
|
|
|
223
253
|
}
|
|
224
254
|
renderTimeRow() {
|
|
225
255
|
if (this.mode !== "datetime") return "";
|
|
226
|
-
const time = this.
|
|
256
|
+
const time = this.working ? splitValue(this.working).time : this.pendingTime;
|
|
227
257
|
return html`
|
|
228
258
|
<div class="calendar-time" part="calendar-time">
|
|
229
259
|
<input type="time" class="time-input" part="time-input"
|
|
230
260
|
aria-label=${Locale.getValue("time")}
|
|
231
|
-
|
|
261
|
+
step=${ifDefined(this.seconds ? "1" : void 0)}
|
|
262
|
+
.value=${normalizeTime(time, this.seconds)}
|
|
232
263
|
@change=${this.handleTimeChange}
|
|
233
264
|
/>
|
|
234
265
|
</div>
|
|
235
266
|
`;
|
|
236
267
|
}
|
|
237
268
|
renderFooter() {
|
|
238
|
-
const todayDisabled =
|
|
269
|
+
const todayDisabled = this.unavailable(/* @__PURE__ */ new Date());
|
|
239
270
|
return html`
|
|
240
271
|
<div class="calendar-footer" part="calendar-footer">
|
|
241
|
-
<u-button
|
|
242
|
-
${this.clearable && this.
|
|
243
|
-
<u-button
|
|
272
|
+
<u-button appearance="plain" size="sm" ?disabled=${todayDisabled} @click=${this.handleTodayClick}>${Locale.getValue("today")}</u-button>
|
|
273
|
+
${this.clearable && this.working ? html`
|
|
274
|
+
<u-button appearance="plain" size="sm" @click=${this.handleFooterResetClick}>${Locale.getValue("clear")}</u-button>
|
|
275
|
+
` : ""}
|
|
276
|
+
${this.confirm ? html`
|
|
277
|
+
<span class="confirm-actions">
|
|
278
|
+
<u-button appearance="plain" size="sm" @click=${this.handleCancelClick}>${Locale.getValue("cancel")}</u-button>
|
|
279
|
+
<u-button size="sm" @click=${this.handleApplyClick}>${Locale.getValue("apply")}</u-button>
|
|
280
|
+
</span>
|
|
244
281
|
` : ""}
|
|
245
282
|
</div>
|
|
246
283
|
`;
|
|
247
284
|
}
|
|
285
|
+
/** A day the calendar refuses — outside `min`/`max` or disabled by `isDateDisabled`. */
|
|
286
|
+
unavailable(date) {
|
|
287
|
+
return isDayUnavailable(date, this.min, this.max, this.isDateDisabled);
|
|
288
|
+
}
|
|
248
289
|
/** `timeOverride` lets a caller force the time-of-day (the "today" quick action wants
|
|
249
290
|
* "right now", overriding whatever time was previously set) — a plain day-cell click omits
|
|
250
291
|
* it, which preserves the existing time-of-day (or `pendingTime`) so switching the date
|
|
251
292
|
* alone doesn't clobber a time the user already picked. */
|
|
252
293
|
selectDay(date, timeOverride) {
|
|
253
|
-
if (
|
|
254
|
-
const time = timeOverride ?? (this.
|
|
294
|
+
if (this.unavailable(date)) return;
|
|
295
|
+
const time = timeOverride ?? (this.working ? splitValue(this.working).time : this.pendingTime);
|
|
255
296
|
const iso = buildValue(date, this.mode, time);
|
|
297
|
+
if (this.mode === "datetime") this.pendingTime = time;
|
|
298
|
+
if (this.confirm) {
|
|
299
|
+
this.staged = iso;
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
256
302
|
const changed = iso !== this.value;
|
|
257
303
|
this.textEntry.clear();
|
|
258
304
|
this.value = iso;
|
|
259
|
-
if (this.mode === "datetime") this.pendingTime = time;
|
|
260
305
|
if (changed) this.emitChange();
|
|
261
306
|
this.popoverEl?.hide();
|
|
262
307
|
(this.textInputEl ?? this.containerEl)?.focus();
|
|
@@ -277,11 +322,12 @@ var UDatePicker = class UDatePicker extends UFormControlElement {
|
|
|
277
322
|
const keep = this.value ? splitValue(this.value).time : this.pendingTime;
|
|
278
323
|
const dt = parseDateTime(text, {
|
|
279
324
|
format: this.format,
|
|
280
|
-
defaultTime: keep
|
|
325
|
+
defaultTime: keep,
|
|
326
|
+
seconds: this.seconds
|
|
281
327
|
});
|
|
282
328
|
return dt ? {
|
|
283
329
|
date: dt.slice(0, 10),
|
|
284
|
-
time: dt.slice(11
|
|
330
|
+
time: dt.slice(11)
|
|
285
331
|
} : null;
|
|
286
332
|
}
|
|
287
333
|
resetValue() {
|
|
@@ -312,6 +358,9 @@ var UDatePicker = class UDatePicker extends UFormControlElement {
|
|
|
312
358
|
} else if (this.value && this.max && splitValue(this.value).date.getTime() > parseISODate(this.max).getTime()) {
|
|
313
359
|
flags = { rangeOverflow: true };
|
|
314
360
|
message = Locale.getValue("rangeOverflow", { max: this.max });
|
|
361
|
+
} else if (this.value && this.isDateDisabled?.(toISODate(splitValue(this.value).date))) {
|
|
362
|
+
flags = { stepMismatch: true };
|
|
363
|
+
message = Locale.getValue("dateUnavailable");
|
|
315
364
|
}
|
|
316
365
|
this.commit(flags, message, this.textInputEl ?? this.containerEl ?? void 0);
|
|
317
366
|
}
|
|
@@ -331,26 +380,40 @@ var UDatePicker = class UDatePicker extends UFormControlElement {
|
|
|
331
380
|
(this.textInputEl ?? this.containerEl)?.blur();
|
|
332
381
|
}
|
|
333
382
|
};
|
|
383
|
+
__decorate([property({
|
|
384
|
+
type: String,
|
|
385
|
+
reflect: true
|
|
386
|
+
}), __decorateMetadata("design:type", Object)], UDatePicker.prototype, "size", void 0);
|
|
334
387
|
__decorate([property({
|
|
335
388
|
type: String,
|
|
336
389
|
reflect: true
|
|
337
390
|
}), __decorateMetadata("design:type", Object)], UDatePicker.prototype, "mode", void 0);
|
|
391
|
+
__decorate([property({
|
|
392
|
+
type: Boolean,
|
|
393
|
+
reflect: true
|
|
394
|
+
}), __decorateMetadata("design:type", Boolean)], UDatePicker.prototype, "seconds", void 0);
|
|
338
395
|
__decorate([property({ type: String }), __decorateMetadata("design:type", String)], UDatePicker.prototype, "min", void 0);
|
|
339
396
|
__decorate([property({ type: String }), __decorateMetadata("design:type", String)], UDatePicker.prototype, "max", void 0);
|
|
340
397
|
__decorate([property({
|
|
341
398
|
type: Boolean,
|
|
342
399
|
reflect: true
|
|
343
400
|
}), __decorateMetadata("design:type", Boolean)], UDatePicker.prototype, "clearable", void 0);
|
|
401
|
+
__decorate([property({ attribute: false }), __decorateMetadata("design:type", Object)], UDatePicker.prototype, "isDateDisabled", void 0);
|
|
344
402
|
__decorate([property({ type: String }), __decorateMetadata("design:type", String)], UDatePicker.prototype, "placeholder", void 0);
|
|
345
403
|
__decorate([property({
|
|
346
404
|
type: String,
|
|
347
405
|
reflect: true
|
|
348
406
|
}), __decorateMetadata("design:type", Object)], UDatePicker.prototype, "format", void 0);
|
|
407
|
+
__decorate([property({
|
|
408
|
+
type: Boolean,
|
|
409
|
+
reflect: true
|
|
410
|
+
}), __decorateMetadata("design:type", Boolean)], UDatePicker.prototype, "confirm", void 0);
|
|
349
411
|
__decorate([query(".container", true), __decorateMetadata("design:type", typeof HTMLElement === "undefined" ? Object : HTMLElement)], UDatePicker.prototype, "containerEl", void 0);
|
|
350
412
|
__decorate([query("u-popover", true), __decorateMetadata("design:type", typeof UPopover === "undefined" ? Object : UPopover)], UDatePicker.prototype, "popoverEl", void 0);
|
|
351
413
|
__decorate([query("u-calendar"), __decorateMetadata("design:type", typeof UCalendar === "undefined" ? Object : UCalendar)], UDatePicker.prototype, "calendarEl", void 0);
|
|
352
414
|
__decorate([state(), __decorateMetadata("design:type", Boolean)], UDatePicker.prototype, "open", void 0);
|
|
353
415
|
__decorate([state(), __decorateMetadata("design:type", String)], UDatePicker.prototype, "pendingTime", void 0);
|
|
416
|
+
__decorate([state(), __decorateMetadata("design:type", String)], UDatePicker.prototype, "staged", void 0);
|
|
354
417
|
UDatePicker = __decorate([customElement("u-date-picker")], UDatePicker);
|
|
355
418
|
//#endregion
|
|
356
419
|
export { UDatePicker };
|
|
@@ -10,12 +10,12 @@ var styles = css`
|
|
|
10
10
|
display: var(--u-date-picker-display, inline-block);
|
|
11
11
|
width: var(--u-date-picker-width, auto);
|
|
12
12
|
color: var(--u-txt-color, #212121);
|
|
13
|
-
font-size: inherit;
|
|
14
13
|
font-family: var(--u-font-base);
|
|
15
14
|
}
|
|
16
15
|
|
|
17
16
|
u-popover {
|
|
18
|
-
|
|
17
|
+
/* 호스트 하한(--u-target-size)이 있으면 칸 7개가 그 폭으로 들어가는 너비(팝오버 여백 8px ×2 · 테두리 1px ×2) 이상. */
|
|
18
|
+
width: max(var(--date-picker-popover-width), calc(7 * var(--u-target-size, 0px) + 18px));
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
/* mode="date": the trigger is a text box — it takes the container's room and reads like its text. */
|
|
@@ -37,23 +37,15 @@ var styles = css`
|
|
|
37
37
|
cursor: pointer;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
padding: 4px 4px 0;
|
|
44
|
-
}
|
|
45
|
-
.time-input {
|
|
46
|
-
font-family: inherit;
|
|
47
|
-
font-size: 0.9em;
|
|
48
|
-
padding: 2px 6px;
|
|
49
|
-
border: 1px solid var(--u-input-border-color, #E0E0E0);
|
|
50
|
-
border-radius: 0.25em;
|
|
51
|
-
background-color: var(--u-input-bg-color, #FFFFFF);
|
|
52
|
-
color: var(--u-txt-color, #212121);
|
|
40
|
+
/* === Size — 다른 필드·버튼과 같은 세 단 === */
|
|
41
|
+
:host {
|
|
42
|
+
font-size: var(--u-density, 14px);
|
|
53
43
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
44
|
+
:host([size="sm"]) {
|
|
45
|
+
font-size: 12px;
|
|
46
|
+
}
|
|
47
|
+
:host([size="lg"]) {
|
|
48
|
+
font-size: 16px;
|
|
57
49
|
}
|
|
58
50
|
`;
|
|
59
51
|
//#endregion
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { PropertyValues } from 'lit';
|
|
2
|
+
import { FieldSize } from '../input/UInput.js';
|
|
2
3
|
import { UFormControlElement } from '../UFormControlElement.js';
|
|
3
4
|
import { DateTextFormat } from '../../utilities/format.js';
|
|
4
5
|
import { UCalendar } from '../calendar/UCalendar.js';
|
|
6
|
+
import { DateDisabledFn } from '../calendar/dates.js';
|
|
7
|
+
import { DatePickerMode } from '../date-picker/UDatePicker.js';
|
|
5
8
|
import { UPopover } from '../popover/UPopover.js';
|
|
6
9
|
import { DateRangePresetOption } from './presets.js';
|
|
7
10
|
export type { DateRangePreset, DateRangePresetName, DateRangePresetOption } from './presets.js';
|
|
@@ -20,6 +23,12 @@ export type { DateRangePreset, DateRangePresetName, DateRangePresetOption } from
|
|
|
20
23
|
* in the text box; ArrowDown (or Alt+ArrowDown) moves into the calendar. Text that is not a range
|
|
21
24
|
* clears the value and reports `badInput`.
|
|
22
25
|
*
|
|
26
|
+
* `mode="datetime"` adds a start time and an end time: each half of the value is a complete
|
|
27
|
+
* ISO-8601 `DateTimeOffset` (`2026-10-01T09:00:00+09:00/2026-10-31T18:00:00+09:00`), and the text
|
|
28
|
+
* box reads `2026-10-01 09:00 ~ 2026-10-31 18:00` or `2026-10-01 09:00 ~ 18:00` (a time alone ends on
|
|
29
|
+
* the first day). The first range picked covers its days whole (00:00 to 23:59); after that, picking
|
|
30
|
+
* other days keeps the times set. `min`/`max` and `isDateDisabled` stay date-only.
|
|
31
|
+
*
|
|
23
32
|
* The calendar shows two months. The first day chosen is an anchor and the range previews up to
|
|
24
33
|
* the day under the pointer or keyboard focus; the second day completes the range, fires
|
|
25
34
|
* `change` and closes the calendar. Escape while an anchor is set drops it; Escape again closes.
|
|
@@ -48,6 +57,8 @@ export type { DateRangePreset, DateRangePresetName, DateRangePresetOption } from
|
|
|
48
57
|
* @csspart calendar-grid - a date grid
|
|
49
58
|
* @csspart calendar-week - one week row inside a date grid
|
|
50
59
|
* @csspart day - a date cell button
|
|
60
|
+
* @csspart calendar-time - the row holding the start and end time inputs (`mode="datetime"` only)
|
|
61
|
+
* @csspart time-input - a time-of-day input (`mode="datetime"` only)
|
|
51
62
|
* @csspart calendar-footer - the row holding the "clear" quick action
|
|
52
63
|
* @csspart presets - the list of quick ranges beside the calendar
|
|
53
64
|
* @csspart preset - one quick-range button
|
|
@@ -57,17 +68,25 @@ export type { DateRangePreset, DateRangePresetName, DateRangePresetOption } from
|
|
|
57
68
|
* @cssprop --u-date-range-picker-width - host `width` (default: auto). Set `100%` where `block`
|
|
58
69
|
* alone does not stretch the host (e.g. inside a flex container).
|
|
59
70
|
*
|
|
60
|
-
* @event change - fires when the user completes a range or clears it
|
|
71
|
+
* @event change - fires when the user completes a range or clears it (with `confirm`, when Apply
|
|
72
|
+
* commits a different value). Programmatic value
|
|
61
73
|
* assignment does not fire it (same contract as native form controls).
|
|
62
74
|
*/
|
|
63
75
|
export declare class UDateRangePicker extends UFormControlElement<string> {
|
|
64
76
|
static styles: import('lit').CSSResultGroup[];
|
|
77
|
+
/** 크기 — 다른 필드·버튼과 같은 세 단(`sm` 12px · `md` = `--u-density`(14px) · `lg` 16px). */
|
|
78
|
+
size: FieldSize;
|
|
65
79
|
/** Earliest selectable day (ISO `YYYY-MM-DD`), inclusive. */
|
|
66
80
|
min?: string;
|
|
67
81
|
/** Latest selectable day (ISO `YYYY-MM-DD`), inclusive. */
|
|
68
82
|
max?: string;
|
|
69
83
|
/** Whether to show the clear button */
|
|
70
84
|
clearable: boolean;
|
|
85
|
+
/** App rule for days that cannot be chosen — receives the ISO day, returns `true` to disable it.
|
|
86
|
+
* Such a day cannot start or end a range, though a range may run across it (a week across a
|
|
87
|
+
* weekend); a preset that starts or ends on one is disabled. A typed or assigned range that starts
|
|
88
|
+
* or ends on one reports `stepMismatch`. Property only. */
|
|
89
|
+
isDateDisabled?: DateDisabledFn;
|
|
71
90
|
/** Placeholder text (shown when there is no value). Defaults to the pattern to type. */
|
|
72
91
|
placeholder?: string;
|
|
73
92
|
/** How the text box writes and reads each day: `iso` (default, `YYYY-MM-DD` in every language) or
|
|
@@ -79,29 +98,71 @@ export declare class UDateRangePicker extends UFormControlElement<string> {
|
|
|
79
98
|
* (`presets="today last7Days thisMonth"`). Empty (default) shows no list.
|
|
80
99
|
*/
|
|
81
100
|
presets: DateRangePresetOption[];
|
|
82
|
-
/**
|
|
101
|
+
/** Picks in the calendar wait for an Apply button instead of committing at once. Completing a
|
|
102
|
+
* range, choosing a preset or "clear" inside the calendar only stages the choice; Apply commits
|
|
103
|
+
* it, fires `change` and closes; Cancel, Escape or closing the calendar any other way drops it.
|
|
104
|
+
* Typing in the text box still commits on Enter or leaving the field. */
|
|
105
|
+
confirm: boolean;
|
|
106
|
+
/** `date` (default) picks a period of days. `datetime` adds a start and an end time; each half of
|
|
107
|
+
* the value becomes a complete ISO-8601 `DateTimeOffset` (`…T09:00:00+09:00/…T18:00:00+09:00`). */
|
|
108
|
+
mode: DatePickerMode;
|
|
109
|
+
/** `mode="datetime"`: times are entered to the second — the time inputs show seconds, the text box
|
|
110
|
+
* reads and shows `HH:mm:ss`, and a whole day ends at `23:59:59`. */
|
|
111
|
+
seconds: boolean;
|
|
112
|
+
/** Start of the range — the ISO day, or in `mode="datetime"` the ISO date-time; `undefined` when
|
|
113
|
+
* there is no complete range. */
|
|
83
114
|
get start(): string | undefined;
|
|
84
|
-
/**
|
|
115
|
+
/** End of the range — the ISO day, or in `mode="datetime"` the ISO date-time; `undefined` when
|
|
116
|
+
* there is no complete range. */
|
|
85
117
|
get end(): string | undefined;
|
|
86
118
|
containerEl?: HTMLElement;
|
|
87
119
|
popoverEl?: UPopover;
|
|
88
120
|
calendarEl?: UCalendar;
|
|
89
121
|
private readonly calendarId;
|
|
90
122
|
private open;
|
|
123
|
+
/** With `confirm`, the range chosen in the open calendar that Apply would commit. */
|
|
124
|
+
private staged?;
|
|
125
|
+
/** `mode="datetime"`: the times the next range takes while there is none yet — once a range
|
|
126
|
+
* exists, the time inputs read and write its halves instead. */
|
|
127
|
+
private pendingTimes?;
|
|
128
|
+
/** Times a whole-day range takes in `mode="datetime"` — a preset or a first calendar pick: from
|
|
129
|
+
* the first minute (or second, with `seconds`) to the last. */
|
|
130
|
+
private get wholeDay();
|
|
91
131
|
/** The typed-range text box — what is being typed, committing it, opening the calendar. */
|
|
92
132
|
private readonly textEntry;
|
|
93
133
|
protected willUpdate(changed: PropertyValues): void;
|
|
134
|
+
/** What the open calendar shows and edits: the staged range with `confirm`, otherwise the value. */
|
|
135
|
+
private get working();
|
|
136
|
+
/** The times the working range has — or, without one, the ones the next range takes. */
|
|
137
|
+
private workingTimes;
|
|
138
|
+
/** The value for two days (and, in `mode="datetime"`, two times), earlier first. */
|
|
139
|
+
private build;
|
|
140
|
+
/** Typed text as a range — days, or in `mode="datetime"` local date-times. A day typed without a
|
|
141
|
+
* time keeps the working range's time at that end. */
|
|
142
|
+
private parseTyped;
|
|
94
143
|
protected shouldValidate(changed: PropertyValues): boolean;
|
|
95
144
|
protected updated(changed: PropertyValues): void;
|
|
96
145
|
render(): import('lit-html').TemplateResult<1>;
|
|
97
146
|
private renderCalendar;
|
|
147
|
+
private renderTimeRow;
|
|
148
|
+
/** A time input changed — with a range, that end moves (committed at once, or staged with
|
|
149
|
+
* `confirm`; the calendar stays open); without one, the next range takes it. A start time set
|
|
150
|
+
* after the end on the same day swaps the two, as a reversed range always is. */
|
|
151
|
+
private handleTimeChange;
|
|
98
152
|
private renderPresets;
|
|
99
|
-
/** A preset that reaches outside `min`/`max
|
|
100
|
-
*
|
|
101
|
-
private
|
|
153
|
+
/** A preset that reaches outside `min`/`max`, or starts or ends on a disabled day, is not
|
|
154
|
+
* offered — its label would promise a range the calendar itself refuses. */
|
|
155
|
+
private unavailable;
|
|
156
|
+
/** Whether `isDateDisabled` refuses either end of the range (the days between may be disabled). */
|
|
157
|
+
private endpointDisabled;
|
|
102
158
|
private handleRangeSelect;
|
|
103
|
-
/** A user-chosen range (calendar or preset): set it,
|
|
159
|
+
/** A user-chosen range of days (calendar or preset) at `times` (`mode="datetime"`): set it,
|
|
160
|
+
* announce it, close the calendar — or, with `confirm`, stage it for Apply. A calendar pick keeps
|
|
161
|
+
* the times already set; a preset covers its days whole. */
|
|
104
162
|
private commitRange;
|
|
163
|
+
/** Commits `next` as the value (firing `change` when it differs), closes the calendar and
|
|
164
|
+
* returns focus to the text box. */
|
|
165
|
+
private commitValue;
|
|
105
166
|
private get textInputEl();
|
|
106
167
|
/** Escape that reaches the picker closes the calendar — the calendar keeps the first Escape
|
|
107
168
|
* for itself while a range is half picked. */
|
|
@@ -110,6 +171,10 @@ export declare class UDateRangePicker extends UFormControlElement<string> {
|
|
|
110
171
|
private handlePopoverHide;
|
|
111
172
|
private handleClearClick;
|
|
112
173
|
private handleFooterResetClick;
|
|
174
|
+
/** `confirm` 모드의 «적용» — 달력에서 고른 범위를 값으로 확정한다(비운 채면 값을 비운다). */
|
|
175
|
+
private handleApplyClick;
|
|
176
|
+
/** `confirm` 모드의 «취소» — 고른 것은 다음에 열 때 값에서 다시 시작하므로 닫기만 하면 버려진다. */
|
|
177
|
+
private handleCancelClick;
|
|
113
178
|
private resetValue;
|
|
114
179
|
/** The clear icon is a display element — relay Enter/Space to its click handler
|
|
115
180
|
* (same pattern as `u-date-picker`, `u-input`, `u-select`). */
|