@3mo/date-time-fields 0.15.1 → 0.16.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/dist/FieldDateTimeBase.d.ts +1 -0
- package/dist/FieldDateTimeBase.d.ts.map +1 -1
- package/dist/FieldDateTimeBase.js +1 -1
- package/dist/FieldTime.d.ts +49 -4
- package/dist/FieldTime.d.ts.map +1 -1
- package/dist/FieldTime.js +201 -9
- package/dist/custom-elements.json +153 -97
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/segments/DateTimeSegment.d.ts +20 -0
- package/dist/segments/DateTimeSegment.d.ts.map +1 -0
- package/dist/segments/DateTimeSegment.js +4 -0
- package/dist/segments/DateTimeSegmenter.d.ts +68 -0
- package/dist/segments/DateTimeSegmenter.d.ts.map +1 -0
- package/dist/segments/DateTimeSegmenter.js +247 -0
- package/dist/segments/DateTimeSegmentsController.d.ts +90 -0
- package/dist/segments/DateTimeSegmentsController.d.ts.map +1 -0
- package/dist/segments/DateTimeSegmentsController.js +235 -0
- package/dist/segments/index.d.ts +5 -0
- package/dist/segments/index.d.ts.map +1 -0
- package/dist/segments/index.js +4 -0
- package/dist/segments/segmentsStyles.d.ts +3 -0
- package/dist/segments/segmentsStyles.d.ts.map +1 -0
- package/dist/segments/segmentsStyles.js +46 -0
- package/dist/selection/Calendar.d.ts.map +1 -1
- package/dist/selection/Calendar.js +3 -0
- package/dist/selection/HourList.d.ts +4 -0
- package/dist/selection/HourList.d.ts.map +1 -1
- package/dist/selection/HourList.js +24 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -2
|
@@ -3,6 +3,7 @@ import { InputFieldComponent } from '@3mo/field';
|
|
|
3
3
|
import { type MaterialIcon } from '@3mo/icon';
|
|
4
4
|
import { FieldDateTimePrecision } from './FieldDateTimePrecision.js';
|
|
5
5
|
import type { Calendar } from './selection/index.js';
|
|
6
|
+
export declare const dateTimeConverter: (value: unknown) => import("@3mo/date-time/DateTime.js").DateTime | undefined;
|
|
6
7
|
/**
|
|
7
8
|
* @attr open - Whether the date picker is open
|
|
8
9
|
* @attr pickerHidden - Hide the date picker
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldDateTimeBase.d.ts","sourceRoot":"","sources":["../FieldDateTimeBase.ts"],"names":[],"mappings":"AACA,OAAO,EAA0E,KAAK,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAE3H,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AACpE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"FieldDateTimeBase.d.ts","sourceRoot":"","sources":["../FieldDateTimeBase.ts"],"names":[],"mappings":"AACA,OAAO,EAA0E,KAAK,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAE3H,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AACpE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAEpD,eAAO,MAAM,iBAAiB,GAAI,OAAO,OAAO,8DAW/C,CAAA;AAED;;;;;;;;GAQG;AACH,8BAAsB,iBAAiB,CAAC,CAAC,CAAE,SAAQ,mBAAmB,CAAC,CAAC,CAAC;IAC5B,IAAI,UAAQ;IAC3B,YAAY,UAAQ;IACS,qBAAqB,gDAAiB;IACE,SAAS,yBAAgC;IACjF,GAAG,CAAC,EAAE,QAAQ,CAAA;IACd,GAAG,CAAC,EAAE,QAAQ,CAAA;IAChC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,OAAO,CAAA;IAEzE,cAAc,gDAAiB;IAElB,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAA;cAEzC,SAAS;cAIT,YAAY;IAI/B,OAAO,CAAC,oBAAoB,CAE3B;IAED,SAAS,CAAC,QAAQ,CAAC,sBAAsB,EAAE,YAAY,CAAU;IAEjE,SAAS,CAAC,QAAQ,KAAK,YAAY,IAAI,QAAQ,GAAG,SAAS,CAAA;IAE3D,SAAS,KAAK,aAAa,IAAI,IAAI,CAAC,qBAAqB,CAMxD;cAEkB,YAAY;IAK/B,SAAS,CAAC,QAAQ,CAAC,mBAAmB,IAAI,IAAI;cAE3B,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK;IAKpD,cAAuB,QAAQ,YAE9B;IAED,SAAS,KAAK,WAAW,WAExB;IAED,WAAoB,MAAM,kCAuDzB;IAED,cAAuB,QAAQ,uBAK9B;IAED,cAAuB,eAAe,uBAMrC;IAED,cAAuB,aAAa,uBAanC;IAED,SAAS,CAAC,QAAQ,CAAC,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;uBACtC,iBAAiB,CAAC,KAAK,EAAE,CAAC,GAAG,SAAS,GAAG,MAAM;IAE3E,OAAO,KAAK,uBAAuB,GAYlC;IAED,SAAS,KAAK,0BAA0B,uBAOvC;IAED,SAAS,KAAK,eAAe,uBAkB5B;IAED,SAAS,KAAK,wBAAwB,uBAOrC;IAED,SAAS,CAAC,QAAQ,KAAK,eAAe,IAAI,kBAAkB,CAAA;IAE5D,SAAS,CAAC,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC;IAYzD,OAAO,CAAC,gBAAgB;IAaxB,SAAS,KAAK,YAAY,uBAEzB;IAED,SAAS,KAAK,gBAAgB,uBAW7B;IAED,SAAS,CAAC,QAAQ,KAAK,aAAa,IAAI,aAAa,GAAG,SAAS,CAAA;IAEjE,OAAO,KAAK,YAAY,GAavB;IAED,OAAO,KAAK,gBAAgB,GAQ3B;IAED,OAAO,KAAK,kBAAkB,GAQ7B;IAED,OAAO,KAAK,kBAAkB,GAQ7B;IAED,SAAS,CAAC,wBAAwB,CAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,sBAAsB;CAMpF"}
|
|
@@ -3,7 +3,7 @@ import { cache, css, html, live, property, style, bind, state, query, ifDefined
|
|
|
3
3
|
import { hasChanged } from '@a11d/equals';
|
|
4
4
|
import { InputFieldComponent } from '@3mo/field';
|
|
5
5
|
import { FieldDateTimePrecision } from './FieldDateTimePrecision.js';
|
|
6
|
-
const dateTimeConverter = (value) => {
|
|
6
|
+
export const dateTimeConverter = (value) => {
|
|
7
7
|
if (value instanceof DateTime) {
|
|
8
8
|
return value;
|
|
9
9
|
}
|
package/dist/FieldTime.d.ts
CHANGED
|
@@ -1,13 +1,58 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FieldComponent } from '@3mo/field';
|
|
2
|
+
import { FieldDateTimePrecision } from './FieldDateTimePrecision.js';
|
|
3
|
+
import { DateTimeSegmentsController, type HourCycle } from './segments/index.js';
|
|
2
4
|
/**
|
|
5
|
+
* A time-of-day field. Its value is the 24-hour `HH:mm` (or `HH:mm:ss` at second precision) string the
|
|
6
|
+
* native time input uses, so that it drops in where one was, while the segments follow the language's
|
|
7
|
+
* own clock — "02:07 PM" for English, "14:07" for German — and the popover offers the hour and minute wheels.
|
|
8
|
+
*
|
|
3
9
|
* @element mo-field-time
|
|
4
10
|
*
|
|
11
|
+
* @attr value - The time as `HH:mm` or `HH:mm:ss`
|
|
12
|
+
* @attr open - Whether the time picker is open
|
|
13
|
+
* @attr pickerHidden - Hide the time picker
|
|
14
|
+
* @attr dense - Whether the field is dense
|
|
15
|
+
* @attr precision - 'minute' (default) or 'second'
|
|
16
|
+
* @attr hourCycle - The hour cycle of the segments ('h11', 'h12', 'h23' or 'h24'). Defaults to the language's convention.
|
|
17
|
+
* @attr shortcutReferenceDate - The date the units the user leaves out are taken from. Defaults to now.
|
|
18
|
+
*
|
|
19
|
+
* @csspart segments - The group of segments making up the time
|
|
20
|
+
* @csspart segment - An editable unit of the time
|
|
21
|
+
* @csspart literal - A separator between the units
|
|
22
|
+
*
|
|
5
23
|
* @i18n "Time"
|
|
6
24
|
*/
|
|
7
|
-
export declare class FieldTime extends
|
|
25
|
+
export declare class FieldTime extends FieldComponent<string> {
|
|
8
26
|
label: string;
|
|
9
|
-
|
|
10
|
-
|
|
27
|
+
value?: string;
|
|
28
|
+
open: boolean;
|
|
29
|
+
pickerHidden: boolean;
|
|
30
|
+
dense: boolean;
|
|
31
|
+
precision: FieldDateTimePrecision;
|
|
32
|
+
hourCycle?: HourCycle;
|
|
33
|
+
shortcutReferenceDate: import("@3mo/date-time/DateTime.js").DateTime;
|
|
34
|
+
navigationDate: import("@3mo/date-time/DateTime.js").DateTime;
|
|
35
|
+
readonly segments: DateTimeSegmentsController<this>;
|
|
36
|
+
/** Alt+ArrowDown opens the picker, as it does on a native date-time input. */
|
|
37
|
+
protected handlePickerKey(event: KeyboardEvent): void;
|
|
38
|
+
/** The value as a time on the reference day, which is all the segments need to render and edit it. */
|
|
39
|
+
get selectedDate(): DateTime | undefined;
|
|
40
|
+
protected toValue(date: DateTime | undefined): string | undefined;
|
|
41
|
+
protected valueUpdated(): void;
|
|
42
|
+
protected get isActive(): boolean;
|
|
43
|
+
protected get isDense(): boolean;
|
|
44
|
+
protected get isPopulated(): boolean;
|
|
45
|
+
focus(): void;
|
|
46
|
+
private customValidity;
|
|
47
|
+
setCustomValidity(error: string): void;
|
|
48
|
+
checkValidity(): Promise<boolean>;
|
|
49
|
+
reportValidity(): void;
|
|
50
|
+
static get styles(): import("@a11d/lit").CSSResult;
|
|
51
|
+
protected get template(): import("lit-html").HTMLTemplateResult;
|
|
52
|
+
protected get inputTemplate(): import("lit-html").HTMLTemplateResult;
|
|
53
|
+
protected get endSlotTemplate(): import("lit-html").HTMLTemplateResult;
|
|
54
|
+
protected get popoverTemplate(): import("lit-html").HTMLTemplateResult;
|
|
55
|
+
private handleListChange;
|
|
11
56
|
}
|
|
12
57
|
declare global {
|
|
13
58
|
interface HTMLElementTagNameMap {
|
package/dist/FieldTime.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldTime.d.ts","sourceRoot":"","sources":["../FieldTime.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FieldTime.d.ts","sourceRoot":"","sources":["../FieldTime.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAE3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAEpE,OAAO,EAAE,0BAA0B,EAAsC,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAQpH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBACa,SAAU,SAAQ,cAAc,CAAC,MAAM,CAAC;IAC/B,KAAK,SAAY;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAA;IACkB,IAAI,UAAQ;IAC3B,YAAY,UAAQ;IACpB,KAAK,UAAQ;IACwD,SAAS,yBAAgC;IAChF,SAAS,CAAC,EAAE,SAAS,CAAA;IACtB,qBAAqB,gDAAiB;IAEvF,cAAc,gDAAiB;IAExC,QAAQ,CAAC,QAAQ,mCAad;IAEH,8EAA8E;IAC9E,SAAS,CAAC,eAAe,CAAC,KAAK,EAAE,aAAa;IAO9C,sGAAsG;IACtG,IAAI,YAAY,IAAI,QAAQ,GAAG,SAAS,CAOvC;IAED,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,GAAG,SAAS;cASzB,YAAY;IAK/B,cAAuB,QAAQ,YAE9B;IAED,cAAuB,OAAO,YAE7B;IAED,cAAuB,WAAW,YAEjC;IAEQ,KAAK;IAId,OAAO,CAAC,cAAc,CAAK;IAElB,iBAAiB,CAAC,KAAK,EAAE,MAAM;IAIzB,aAAa;IAKnB,cAAc;IAIvB,WAAoB,MAAM,kCAgCzB;IAED,cAAuB,QAAQ,0CAK9B;IAED,cAAuB,aAAa,0CAMnC;IAED,cAAuB,eAAe,0CASrC;IAED,SAAS,KAAK,eAAe,0CA2B5B;IAED,OAAO,CAAC,gBAAgB;CAGxB;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,eAAe,EAAE,SAAS,CAAA;KAC1B;CACD"}
|
package/dist/FieldTime.js
CHANGED
|
@@ -1,34 +1,226 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { component, html, property, style } from '@a11d/lit';
|
|
2
|
+
import { bind, cache, component, css, html, property, state, style } from '@a11d/lit';
|
|
3
|
+
import { FieldComponent } from '@3mo/field';
|
|
3
4
|
import { Localizer } from '@3mo/localization';
|
|
4
|
-
import {
|
|
5
|
+
import { FieldDateTimePrecision } from './FieldDateTimePrecision.js';
|
|
6
|
+
import { dateTimeConverter } from './FieldDateTimeBase.js';
|
|
7
|
+
import { DateTimeSegmentsController, hourCycleConverter, segmentsStyles } from './segments/index.js';
|
|
5
8
|
Localizer.dictionaries.add('de', {
|
|
6
9
|
'Time': 'Uhrzeit',
|
|
7
10
|
});
|
|
8
|
-
|
|
11
|
+
const timePattern = /^(\d{1,2}):(\d{2})(?::(\d{2}))?$/;
|
|
9
12
|
/**
|
|
13
|
+
* A time-of-day field. Its value is the 24-hour `HH:mm` (or `HH:mm:ss` at second precision) string the
|
|
14
|
+
* native time input uses, so that it drops in where one was, while the segments follow the language's
|
|
15
|
+
* own clock — "02:07 PM" for English, "14:07" for German — and the popover offers the hour and minute wheels.
|
|
16
|
+
*
|
|
10
17
|
* @element mo-field-time
|
|
11
18
|
*
|
|
19
|
+
* @attr value - The time as `HH:mm` or `HH:mm:ss`
|
|
20
|
+
* @attr open - Whether the time picker is open
|
|
21
|
+
* @attr pickerHidden - Hide the time picker
|
|
22
|
+
* @attr dense - Whether the field is dense
|
|
23
|
+
* @attr precision - 'minute' (default) or 'second'
|
|
24
|
+
* @attr hourCycle - The hour cycle of the segments ('h11', 'h12', 'h23' or 'h24'). Defaults to the language's convention.
|
|
25
|
+
* @attr shortcutReferenceDate - The date the units the user leaves out are taken from. Defaults to now.
|
|
26
|
+
*
|
|
27
|
+
* @csspart segments - The group of segments making up the time
|
|
28
|
+
* @csspart segment - An editable unit of the time
|
|
29
|
+
* @csspart literal - A separator between the units
|
|
30
|
+
*
|
|
12
31
|
* @i18n "Time"
|
|
13
32
|
*/
|
|
14
|
-
let FieldTime = class FieldTime extends
|
|
33
|
+
let FieldTime = class FieldTime extends FieldComponent {
|
|
15
34
|
constructor() {
|
|
16
35
|
super(...arguments);
|
|
17
36
|
this.label = t('Time');
|
|
37
|
+
this.open = false;
|
|
38
|
+
this.pickerHidden = false;
|
|
39
|
+
this.dense = false;
|
|
40
|
+
this.precision = FieldDateTimePrecision.Minute;
|
|
41
|
+
this.shortcutReferenceDate = new DateTime();
|
|
42
|
+
this.navigationDate = new DateTime();
|
|
43
|
+
this.segments = new DateTimeSegmentsController(this, host => ({
|
|
44
|
+
timeOnly: true,
|
|
45
|
+
get value() { return host.selectedDate; },
|
|
46
|
+
get precision() { return host.precision; },
|
|
47
|
+
get referenceDate() { return host.shortcutReferenceDate; },
|
|
48
|
+
get hourCycle() { return host.hourCycle; },
|
|
49
|
+
get label() { return host._label; },
|
|
50
|
+
get disabled() { return host.disabled; },
|
|
51
|
+
get readonly() { return host.readonly; },
|
|
52
|
+
get required() { return host.required; },
|
|
53
|
+
get invalid() { return host.invalid; },
|
|
54
|
+
handleInput: value => host.handleInput(host.toValue(value)),
|
|
55
|
+
handleChange: value => host.handleChange(host.toValue(value)),
|
|
56
|
+
}));
|
|
57
|
+
this.customValidity = '';
|
|
58
|
+
}
|
|
59
|
+
/** Alt+ArrowDown opens the picker, as it does on a native date-time input. */
|
|
60
|
+
handlePickerKey(event) {
|
|
61
|
+
if (event.altKey && event.key === 'ArrowDown' && !this.pickerHidden) {
|
|
62
|
+
event.preventDefault();
|
|
63
|
+
this.open = true;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/** The value as a time on the reference day, which is all the segments need to render and edit it. */
|
|
67
|
+
get selectedDate() {
|
|
68
|
+
const match = this.value?.match(timePattern);
|
|
69
|
+
if (!match) {
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
72
|
+
const [, hour, minute, second] = match.map(Number);
|
|
73
|
+
return this.shortcutReferenceDate.dayStart.with({ hour, minute, second: second || 0 });
|
|
74
|
+
}
|
|
75
|
+
toValue(date) {
|
|
76
|
+
if (!date) {
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
const pad = (value) => String(value).padStart(2, '0');
|
|
80
|
+
const time = `${pad(date.hour)}:${pad(date.minute)}`;
|
|
81
|
+
return this.precision >= FieldDateTimePrecision.Second ? `${time}:${pad(date.second)}` : time;
|
|
82
|
+
}
|
|
83
|
+
valueUpdated() {
|
|
84
|
+
super.valueUpdated();
|
|
85
|
+
this.navigationDate = this.selectedDate ?? new DateTime();
|
|
86
|
+
}
|
|
87
|
+
get isActive() {
|
|
88
|
+
return super.isActive || this.open;
|
|
89
|
+
}
|
|
90
|
+
get isDense() {
|
|
91
|
+
return this.dense;
|
|
18
92
|
}
|
|
19
|
-
get
|
|
20
|
-
return
|
|
93
|
+
get isPopulated() {
|
|
94
|
+
return !!this.value || !this.segments.isEmpty;
|
|
21
95
|
}
|
|
22
|
-
|
|
96
|
+
focus() {
|
|
97
|
+
this.segments.focus();
|
|
98
|
+
}
|
|
99
|
+
setCustomValidity(error) {
|
|
100
|
+
this.customValidity = error;
|
|
101
|
+
}
|
|
102
|
+
async checkValidity() {
|
|
103
|
+
await this.updateComplete;
|
|
104
|
+
return !this.customValidity && !(this.required && !this.value);
|
|
105
|
+
}
|
|
106
|
+
reportValidity() {
|
|
107
|
+
this.focus();
|
|
108
|
+
}
|
|
109
|
+
static get styles() {
|
|
110
|
+
return css `
|
|
111
|
+
${super.styles}
|
|
112
|
+
|
|
113
|
+
:host {
|
|
114
|
+
position: relative;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
:host([disabled]) {
|
|
118
|
+
pointer-events: none;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
mo-field {
|
|
122
|
+
anchor-name: --mo-field-time;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
mo-popover {
|
|
126
|
+
position-anchor: --mo-field-time;
|
|
127
|
+
position-visibility: anchors-visible;
|
|
128
|
+
background: var(--mo-color-background);
|
|
129
|
+
box-shadow: var(--mo-shadow);
|
|
130
|
+
border-radius: var(--mo-border-radius);
|
|
131
|
+
color: var(--mo-color-foreground);
|
|
132
|
+
font-size: 0.875em;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
#selector {
|
|
136
|
+
height: clamp(175px, 100vh, 300px);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
${segmentsStyles}
|
|
140
|
+
`;
|
|
141
|
+
}
|
|
142
|
+
get template() {
|
|
23
143
|
return html `
|
|
24
|
-
|
|
25
|
-
${
|
|
144
|
+
${super.template}
|
|
145
|
+
${this.popoverTemplate}
|
|
26
146
|
`;
|
|
27
147
|
}
|
|
148
|
+
get inputTemplate() {
|
|
149
|
+
return html `
|
|
150
|
+
<div part='segments' @keydown=${(e) => this.handlePickerKey(e)} ${this.segments.group.ref()}>
|
|
151
|
+
${this.segments.segments.map(segment => html `<span part=${segment.editable ? 'segment' : 'literal'} ${this.segments.segment.ref(segment)}></span>`)}
|
|
152
|
+
</div>
|
|
153
|
+
`;
|
|
154
|
+
}
|
|
155
|
+
get endSlotTemplate() {
|
|
156
|
+
return html `
|
|
157
|
+
${super.endSlotTemplate}
|
|
158
|
+
${this.pickerHidden ? html.nothing : html `
|
|
159
|
+
<mo-icon id='picker' slot='end' icon='schedule'
|
|
160
|
+
${style({ color: this.isActive ? 'var(--mo-color-accent)' : 'var(--mo-color-gray)', cursor: 'pointer', userSelect: 'none' })}
|
|
161
|
+
></mo-icon>
|
|
162
|
+
`}
|
|
163
|
+
`;
|
|
164
|
+
}
|
|
165
|
+
get popoverTemplate() {
|
|
166
|
+
return this.pickerHidden ? html.nothing : html `
|
|
167
|
+
<mo-popover tabindex='-1' .anchor=${this} target='picker' ?open=${bind(this, 'open')}>
|
|
168
|
+
${cache(!this.open ? html.nothing : html `
|
|
169
|
+
<mo-flex id='selector' direction='horizontal'>
|
|
170
|
+
<mo-hour-list style='flex: 1'
|
|
171
|
+
.hourCycle=${this.hourCycle}
|
|
172
|
+
.navigationDate=${bind(this, 'navigationDate')}
|
|
173
|
+
.value=${this.selectedDate}
|
|
174
|
+
@change=${(e) => this.handleListChange(e.detail)}
|
|
175
|
+
></mo-hour-list>
|
|
176
|
+
<mo-minute-list style='flex: 1'
|
|
177
|
+
.navigationDate=${bind(this, 'navigationDate')}
|
|
178
|
+
.value=${this.selectedDate}
|
|
179
|
+
@change=${(e) => this.handleListChange(e.detail)}
|
|
180
|
+
></mo-minute-list>
|
|
181
|
+
${this.precision < FieldDateTimePrecision.Second ? html.nothing : html `
|
|
182
|
+
<mo-second-list style='flex: 1'
|
|
183
|
+
.navigationDate=${bind(this, 'navigationDate')}
|
|
184
|
+
.value=${this.selectedDate}
|
|
185
|
+
@change=${(e) => this.handleListChange(e.detail)}
|
|
186
|
+
></mo-second-list>
|
|
187
|
+
`}
|
|
188
|
+
</mo-flex>
|
|
189
|
+
`)}
|
|
190
|
+
</mo-popover>
|
|
191
|
+
`;
|
|
192
|
+
}
|
|
193
|
+
handleListChange(date) {
|
|
194
|
+
this.handleChange(this.toValue(date));
|
|
195
|
+
}
|
|
28
196
|
};
|
|
29
197
|
__decorate([
|
|
30
198
|
property()
|
|
31
199
|
], FieldTime.prototype, "label", void 0);
|
|
200
|
+
__decorate([
|
|
201
|
+
property()
|
|
202
|
+
], FieldTime.prototype, "value", void 0);
|
|
203
|
+
__decorate([
|
|
204
|
+
property({ type: Boolean, reflect: true })
|
|
205
|
+
], FieldTime.prototype, "open", void 0);
|
|
206
|
+
__decorate([
|
|
207
|
+
property({ type: Boolean })
|
|
208
|
+
], FieldTime.prototype, "pickerHidden", void 0);
|
|
209
|
+
__decorate([
|
|
210
|
+
property({ type: Boolean })
|
|
211
|
+
], FieldTime.prototype, "dense", void 0);
|
|
212
|
+
__decorate([
|
|
213
|
+
property({ type: String, converter: value => FieldDateTimePrecision.parse(value || undefined) })
|
|
214
|
+
], FieldTime.prototype, "precision", void 0);
|
|
215
|
+
__decorate([
|
|
216
|
+
property({ type: String, converter: hourCycleConverter })
|
|
217
|
+
], FieldTime.prototype, "hourCycle", void 0);
|
|
218
|
+
__decorate([
|
|
219
|
+
property({ type: Object, converter: dateTimeConverter })
|
|
220
|
+
], FieldTime.prototype, "shortcutReferenceDate", void 0);
|
|
221
|
+
__decorate([
|
|
222
|
+
state()
|
|
223
|
+
], FieldTime.prototype, "navigationDate", void 0);
|
|
32
224
|
FieldTime = __decorate([
|
|
33
225
|
component('mo-field-time')
|
|
34
226
|
], FieldTime);
|