@3mo/date-time-fields 0.10.3 → 0.11.0-preview.1
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/FieldDateTime.d.ts +3 -3
- package/dist/FieldDateTime.d.ts.map +1 -1
- package/dist/FieldDateTime.js +7 -12
- package/dist/FieldDateTimeBase.d.ts +13 -14
- package/dist/FieldDateTimeBase.d.ts.map +1 -1
- package/dist/FieldDateTimeBase.js +28 -39
- package/dist/FieldDateTimeRange.d.ts +3 -3
- package/dist/FieldDateTimeRange.d.ts.map +1 -1
- package/dist/FieldDateTimeRange.js +9 -15
- package/dist/custom-elements.json +75 -282
- package/dist/selection/Calendar.d.ts +38 -0
- package/dist/selection/Calendar.d.ts.map +1 -0
- package/dist/selection/Calendar.js +347 -0
- package/dist/selection/CalendarDatesController.d.ts +22 -0
- package/dist/selection/CalendarDatesController.d.ts.map +1 -0
- package/dist/selection/CalendarDatesController.js +76 -0
- package/dist/selection/DateList.d.ts +2 -2
- package/dist/selection/DateList.d.ts.map +1 -1
- package/dist/selection/DateList.js +10 -6
- package/dist/selection/HourList.js +3 -3
- package/dist/selection/MinuteList.js +2 -2
- package/dist/selection/SecondList.js +2 -2
- package/dist/selection/index.d.ts +1 -3
- package/dist/selection/index.d.ts.map +1 -1
- package/dist/selection/index.js +1 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/dist/selection/MonthList.d.ts +0 -12
- package/dist/selection/MonthList.d.ts.map +0 -1
- package/dist/selection/MonthList.js +0 -36
- package/dist/selection/YearList.d.ts +0 -12
- package/dist/selection/YearList.d.ts.map +0 -1
- package/dist/selection/YearList.js +0 -28
- package/dist/selection/calendar/Calendar.d.ts +0 -24
- package/dist/selection/calendar/Calendar.d.ts.map +0 -1
- package/dist/selection/calendar/Calendar.js +0 -160
- package/dist/selection/calendar/SelectableCalendar.d.ts +0 -20
- package/dist/selection/calendar/SelectableCalendar.d.ts.map +0 -1
- package/dist/selection/calendar/SelectableCalendar.js +0 -76
- package/dist/selection/calendar/index.d.ts +0 -3
- package/dist/selection/calendar/index.d.ts.map +0 -1
- package/dist/selection/calendar/index.js +0 -2
package/dist/FieldDateTime.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FieldDateTimeBase } from './FieldDateTimeBase.js';
|
|
2
|
-
import { FieldDateTimePrecision } from './FieldDateTimePrecision.js';
|
|
2
|
+
import { type FieldDateTimePrecision } from './FieldDateTimePrecision.js';
|
|
3
3
|
/**
|
|
4
4
|
* @element mo-field-date-time
|
|
5
5
|
*
|
|
@@ -10,8 +10,8 @@ export declare class FieldDateTime extends FieldDateTimeBase<Date | undefined> {
|
|
|
10
10
|
label: string;
|
|
11
11
|
value?: Date;
|
|
12
12
|
protected get placeholder(): string;
|
|
13
|
-
protected
|
|
14
|
-
protected get
|
|
13
|
+
protected resetNavigationDate(): void;
|
|
14
|
+
protected get calendarValue(): import("@3mo/date-time/DateTimeRange.js").DateTimeRange;
|
|
15
15
|
protected handleSelectedDateChange(date: DateTime, precision: FieldDateTimePrecision): void;
|
|
16
16
|
protected valueToInputValue(value: Date | undefined): string;
|
|
17
17
|
protected inputValueToValue(value: string): import("@3mo/date-time/DateTime.js").DateTime | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldDateTime.d.ts","sourceRoot":"","sources":["../FieldDateTime.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;
|
|
1
|
+
{"version":3,"file":"FieldDateTime.d.ts","sourceRoot":"","sources":["../FieldDateTime.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAOzE;;;;GAIG;AACH,qBACa,aAAc,SAAQ,iBAAiB,CAAC,IAAI,GAAG,SAAS,CAAC;IACrE,SAAS,KAAK,YAAY,8DAQzB;IAEoB,KAAK,SAAmB;IACjB,KAAK,CAAC,EAAE,IAAI,CAAA;IAExC,cACuB,WAAW,WAEjC;IAED,SAAS,CAAC,mBAAmB;IAI7B,SAAS,KAAK,aAAa,4DAE1B;cAEkB,wBAAwB,CAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,sBAAsB;IAO7F,SAAS,CAAC,iBAAiB,CAAC,KAAK,EAAE,IAAI,GAAG,SAAS;IAInD,SAAS,CAAC,iBAAiB,CAAC,KAAK,EAAE,MAAM;CAGzC;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,oBAAoB,EAAE,aAAa,CAAA;KACnC;CACD"}
|
package/dist/FieldDateTime.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { component,
|
|
2
|
+
import { component, property } from '@a11d/lit';
|
|
3
3
|
import { Localizer } from '@3mo/localization';
|
|
4
4
|
import { FieldDateTimeBase } from './FieldDateTimeBase.js';
|
|
5
|
-
import { FieldDateTimePrecision } from './FieldDateTimePrecision.js';
|
|
6
5
|
import { Memoize as memoize } from 'typescript-memoize';
|
|
7
6
|
Localizer.dictionaries.add('de', {
|
|
8
7
|
'Date & Time': 'Datum & Uhrzeit',
|
|
@@ -29,19 +28,15 @@ let FieldDateTime = class FieldDateTime extends FieldDateTimeBase {
|
|
|
29
28
|
get placeholder() {
|
|
30
29
|
return new DateTime().format(this.formatOptions);
|
|
31
30
|
}
|
|
32
|
-
|
|
33
|
-
this.
|
|
31
|
+
resetNavigationDate() {
|
|
32
|
+
this.navigationDate = this.selectedDate ?? new DateTime();
|
|
34
33
|
}
|
|
35
|
-
get
|
|
36
|
-
return
|
|
37
|
-
<mo-selectable-calendar
|
|
38
|
-
.navigatingValue=${this.navigatingDate}
|
|
39
|
-
.value=${new DateTimeRange(this.selectedDate, this.selectedDate)}
|
|
40
|
-
@dayClick=${(e) => this.handleSelectedDateChange(e.detail, FieldDateTimePrecision.Day)}
|
|
41
|
-
></mo-selectable-calendar>
|
|
42
|
-
`;
|
|
34
|
+
get calendarValue() {
|
|
35
|
+
return new DateTimeRange(this.selectedDate, this.selectedDate);
|
|
43
36
|
}
|
|
44
37
|
handleSelectedDateChange(date, precision) {
|
|
38
|
+
const { hour, minute, second } = this.navigationDate;
|
|
39
|
+
date = date.with({ hour, minute, second });
|
|
45
40
|
this.value = !date ? undefined : this.precision.getRange(date).start;
|
|
46
41
|
super.handleSelectedDateChange(date, precision);
|
|
47
42
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type HTMLTemplateResult } from '@a11d/lit';
|
|
2
1
|
import { InputFieldComponent } from '@3mo/field';
|
|
3
2
|
import { type MaterialIcon } from '@3mo/icon';
|
|
4
3
|
import { FieldDateTimePrecision } from './FieldDateTimePrecision.js';
|
|
4
|
+
import type { Calendar } from './selection/index.js';
|
|
5
5
|
/**
|
|
6
6
|
* @attr open - Whether the date picker is open
|
|
7
7
|
* @attr pickerHidden - Hide the date picker
|
|
@@ -13,7 +13,8 @@ export declare abstract class FieldDateTimeBase<T> extends InputFieldComponent<T
|
|
|
13
13
|
pickerHidden: boolean;
|
|
14
14
|
shortcutReferenceDate: import("@3mo/date-time/DateTime.js").DateTime;
|
|
15
15
|
precision: FieldDateTimePrecision;
|
|
16
|
-
|
|
16
|
+
navigationDate: import("@3mo/date-time/DateTime.js").DateTime;
|
|
17
|
+
protected readonly calendar?: Calendar;
|
|
17
18
|
protected connected(): void;
|
|
18
19
|
protected disconnected(): void;
|
|
19
20
|
private handleLanguageChange;
|
|
@@ -21,25 +22,23 @@ export declare abstract class FieldDateTimeBase<T> extends InputFieldComponent<T
|
|
|
21
22
|
protected abstract get selectedDate(): DateTime | undefined;
|
|
22
23
|
protected get formatOptions(): Intl.DateTimeFormatOptions;
|
|
23
24
|
protected valueUpdated(): void;
|
|
24
|
-
protected abstract
|
|
25
|
+
protected abstract resetNavigationDate(): void;
|
|
25
26
|
protected handleChange(value?: T, e?: Event): void;
|
|
26
27
|
protected get isActive(): boolean;
|
|
27
28
|
protected get placeholder(): string;
|
|
28
29
|
static get styles(): import("@a11d/lit").CSSResult;
|
|
29
|
-
protected get template(): HTMLTemplateResult;
|
|
30
|
-
protected get endSlotTemplate(): HTMLTemplateResult;
|
|
31
|
-
protected get inputTemplate(): HTMLTemplateResult;
|
|
30
|
+
protected get template(): import("lit-html").HTMLTemplateResult;
|
|
31
|
+
protected get endSlotTemplate(): import("lit-html").HTMLTemplateResult;
|
|
32
|
+
protected get inputTemplate(): import("lit-html").HTMLTemplateResult;
|
|
32
33
|
protected abstract inputValueToValue(value: string): T | undefined;
|
|
33
34
|
protected abstract valueToInputValue(value: T | undefined): string;
|
|
34
35
|
private get clearIconButtonTemplate();
|
|
35
|
-
protected get calendarIconButtonTemplate(): HTMLTemplateResult;
|
|
36
|
-
protected get popoverTemplate(): HTMLTemplateResult;
|
|
37
|
-
protected get popoverContentTemplate(): HTMLTemplateResult;
|
|
38
|
-
protected get dateTemplate(): HTMLTemplateResult;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
private get dayTemplate();
|
|
42
|
-
protected abstract get calendarTemplate(): HTMLTemplateResult;
|
|
36
|
+
protected get calendarIconButtonTemplate(): import("lit-html").HTMLTemplateResult;
|
|
37
|
+
protected get popoverTemplate(): import("lit-html").HTMLTemplateResult;
|
|
38
|
+
protected get popoverContentTemplate(): import("lit-html").HTMLTemplateResult;
|
|
39
|
+
protected get dateTemplate(): import("lit-html").HTMLTemplateResult;
|
|
40
|
+
protected get calendarTemplate(): import("lit-html").HTMLTemplateResult;
|
|
41
|
+
protected abstract get calendarValue(): DateTimeRange | undefined;
|
|
43
42
|
private get timeTemplate();
|
|
44
43
|
private get hourListTemplate();
|
|
45
44
|
private get minuteListTemplate();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldDateTimeBase.d.ts","sourceRoot":"","sources":["../FieldDateTimeBase.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FieldDateTimeBase.d.ts","sourceRoot":"","sources":["../FieldDateTimeBase.ts"],"names":[],"mappings":"AAEA,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;;;;;GAKG;AACH,8BAAsB,iBAAiB,CAAC,CAAC,CAAE,SAAQ,mBAAmB,CAAC,CAAC,CAAC;IAC5B,IAAI,UAAQ;IAC3B,YAAY,UAAQ;IACrB,qBAAqB,gDAAe;IACkC,SAAS,yBAAgC;IAElI,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,kCA8CzB;IAED,cAAuB,QAAQ,0CAK9B;IAED,cAAuB,eAAe,0CAMrC;IAED,cAAuB,aAAa,0CAanC;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,0CAOvC;IAED,SAAS,KAAK,eAAe,0CAS5B;IAED,SAAS,KAAK,sBAAsB,0CAOnC;IAED,SAAS,KAAK,YAAY,0CAEzB;IAED,SAAS,KAAK,gBAAgB,0CAQ7B;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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { cache, css, html, live, property, style, bind, state } from '@a11d/lit';
|
|
2
|
+
import { cache, css, html, live, property, style, bind, state, query, ifDefined } from '@a11d/lit';
|
|
3
3
|
import { InputFieldComponent } from '@3mo/field';
|
|
4
4
|
import { FieldDateTimePrecision } from './FieldDateTimePrecision.js';
|
|
5
5
|
/**
|
|
@@ -15,9 +15,9 @@ export class FieldDateTimeBase extends InputFieldComponent {
|
|
|
15
15
|
this.pickerHidden = false;
|
|
16
16
|
this.shortcutReferenceDate = new DateTime;
|
|
17
17
|
this.precision = FieldDateTimePrecision.Minute;
|
|
18
|
-
this.
|
|
18
|
+
this.navigationDate = new DateTime();
|
|
19
19
|
this.handleLanguageChange = () => {
|
|
20
|
-
this.
|
|
20
|
+
this.navigationDate = new DateTime(this.navigationDate);
|
|
21
21
|
};
|
|
22
22
|
this.calendarIconButtonIcon = 'today';
|
|
23
23
|
}
|
|
@@ -36,7 +36,7 @@ export class FieldDateTimeBase extends InputFieldComponent {
|
|
|
36
36
|
}
|
|
37
37
|
valueUpdated() {
|
|
38
38
|
super.valueUpdated();
|
|
39
|
-
this.
|
|
39
|
+
this.resetNavigationDate();
|
|
40
40
|
}
|
|
41
41
|
handleChange(value, e) {
|
|
42
42
|
super.handleChange(value, e);
|
|
@@ -79,9 +79,9 @@ export class FieldDateTimeBase extends InputFieldComponent {
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
.timezone {
|
|
82
|
-
padding:
|
|
82
|
+
padding: 0.4rem;
|
|
83
83
|
font-size: small;
|
|
84
|
-
text-align:
|
|
84
|
+
text-align: center;
|
|
85
85
|
font-weight: 500;
|
|
86
86
|
color: var(--mo-color-gray);
|
|
87
87
|
}
|
|
@@ -145,7 +145,10 @@ export class FieldDateTimeBase extends InputFieldComponent {
|
|
|
145
145
|
}
|
|
146
146
|
get popoverTemplate() {
|
|
147
147
|
return this.pickerHidden ? html.nothing : html `
|
|
148
|
-
<mo-popover tabindex='-1'
|
|
148
|
+
<mo-popover tabindex='-1'
|
|
149
|
+
.anchor=${this} target='field'
|
|
150
|
+
?open=${bind(this, 'open', { sourceUpdated: () => setTimeout(() => this.calendar?.setNavigatingValue(this.navigationDate)) })}
|
|
151
|
+
>
|
|
149
152
|
${cache(!this.open ? html.nothing : this.popoverContentTemplate)}
|
|
150
153
|
</mo-popover>
|
|
151
154
|
`;
|
|
@@ -159,52 +162,35 @@ export class FieldDateTimeBase extends InputFieldComponent {
|
|
|
159
162
|
`;
|
|
160
163
|
}
|
|
161
164
|
get dateTemplate() {
|
|
162
|
-
return
|
|
163
|
-
${this.yearListTemplate}
|
|
164
|
-
${this.monthListTemplate}
|
|
165
|
-
${this.dayTemplate}
|
|
166
|
-
`;
|
|
165
|
+
return this.calendarTemplate;
|
|
167
166
|
}
|
|
168
|
-
get
|
|
167
|
+
get calendarTemplate() {
|
|
169
168
|
return html `
|
|
170
|
-
<mo-
|
|
171
|
-
.
|
|
172
|
-
.value=${this.
|
|
173
|
-
@
|
|
174
|
-
></mo-
|
|
169
|
+
<mo-calendar
|
|
170
|
+
.precision=${this.precision}
|
|
171
|
+
.value=${this.calendarValue}
|
|
172
|
+
@dateClick=${(e) => this.handleSelectedDateChange(e.detail, this.precision)}
|
|
173
|
+
></mo-calendar>
|
|
175
174
|
`;
|
|
176
175
|
}
|
|
177
|
-
get monthListTemplate() {
|
|
178
|
-
return this.precision < FieldDateTimePrecision.Month ? html.nothing : html `
|
|
179
|
-
<mo-month-list
|
|
180
|
-
.navigatingValue=${bind(this, 'navigatingDate')}
|
|
181
|
-
.value=${this.selectedDate}
|
|
182
|
-
@change=${(e) => this.handleSelectedDateChange(e.detail, FieldDateTimePrecision.Month)}
|
|
183
|
-
></mo-month-list>
|
|
184
|
-
`;
|
|
185
|
-
}
|
|
186
|
-
get dayTemplate() {
|
|
187
|
-
return this.precision < FieldDateTimePrecision.Day ? html.nothing : this.calendarTemplate;
|
|
188
|
-
}
|
|
189
176
|
get timeTemplate() {
|
|
190
177
|
return this.precision <= FieldDateTimePrecision.Day ? html.nothing : html `
|
|
191
|
-
<mo-flex gap='
|
|
192
|
-
<div class='timezone'>
|
|
193
|
-
${this.navigatingDate?.formatToParts({ timeZoneName: 'long' }).find(x => x.type === 'timeZoneName')?.value}
|
|
194
|
-
(${this.navigatingDate?.formatToParts({ timeZoneName: 'shortOffset' }).find(x => x.type === 'timeZoneName')?.value})
|
|
195
|
-
</div>
|
|
178
|
+
<mo-flex gap='0.5rem'>
|
|
196
179
|
<mo-flex direction='horizontal' style='flex: 1'>
|
|
197
180
|
${this.hourListTemplate}
|
|
198
181
|
${this.minuteListTemplate}
|
|
199
182
|
${this.secondListTemplate}
|
|
200
183
|
</mo-flex>
|
|
184
|
+
<div class='timezone' title=${ifDefined(this.navigationDate?.formatToParts({ timeZoneName: 'long' }).find(x => x.type === 'timeZoneName')?.value)}>
|
|
185
|
+
${this.navigationDate?.formatToParts({ timeZoneName: 'shortOffset' }).find(x => x.type === 'timeZoneName')?.value}
|
|
186
|
+
</div>
|
|
201
187
|
</mo-flex>
|
|
202
188
|
`;
|
|
203
189
|
}
|
|
204
190
|
get hourListTemplate() {
|
|
205
191
|
return this.precision < FieldDateTimePrecision.Hour ? html.nothing : html `
|
|
206
192
|
<mo-hour-list style='flex: 1'
|
|
207
|
-
.
|
|
193
|
+
.navigationDate=${bind(this, 'navigationDate')}
|
|
208
194
|
.value=${this.selectedDate}
|
|
209
195
|
@change=${(e) => this.handleSelectedDateChange(e.detail, FieldDateTimePrecision.Hour)}
|
|
210
196
|
></mo-hour-list>
|
|
@@ -213,7 +199,7 @@ export class FieldDateTimeBase extends InputFieldComponent {
|
|
|
213
199
|
get minuteListTemplate() {
|
|
214
200
|
return this.precision < FieldDateTimePrecision.Minute ? html.nothing : html `
|
|
215
201
|
<mo-minute-list style='flex: 1'
|
|
216
|
-
.
|
|
202
|
+
.navigationDate=${bind(this, 'navigationDate')}
|
|
217
203
|
.value=${this.selectedDate}
|
|
218
204
|
@change=${(e) => this.handleSelectedDateChange(e.detail, FieldDateTimePrecision.Minute)}
|
|
219
205
|
></mo-minute-list>
|
|
@@ -222,7 +208,7 @@ export class FieldDateTimeBase extends InputFieldComponent {
|
|
|
222
208
|
get secondListTemplate() {
|
|
223
209
|
return this.precision < FieldDateTimePrecision.Second ? html.nothing : html `
|
|
224
210
|
<mo-second-list style='flex: 1'
|
|
225
|
-
.
|
|
211
|
+
.navigationDate=${bind(this, 'navigationDate')}
|
|
226
212
|
.value=${this.selectedDate}
|
|
227
213
|
@change=${(e) => this.handleSelectedDateChange(e.detail, FieldDateTimePrecision.Second)}
|
|
228
214
|
></mo-second-list>
|
|
@@ -249,4 +235,7 @@ __decorate([
|
|
|
249
235
|
], FieldDateTimeBase.prototype, "precision", void 0);
|
|
250
236
|
__decorate([
|
|
251
237
|
state()
|
|
252
|
-
], FieldDateTimeBase.prototype, "
|
|
238
|
+
], FieldDateTimeBase.prototype, "navigationDate", void 0);
|
|
239
|
+
__decorate([
|
|
240
|
+
query('mo-calendar')
|
|
241
|
+
], FieldDateTimeBase.prototype, "calendar", void 0);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type MaterialIcon } from '@3mo/icon';
|
|
2
2
|
import { FieldDateTimeBase as FieldDateTimeBase } from './FieldDateTimeBase.js';
|
|
3
|
-
import { FieldDateTimePrecision } from './FieldDateTimePrecision.js';
|
|
3
|
+
import { type FieldDateTimePrecision } from './FieldDateTimePrecision.js';
|
|
4
4
|
declare enum FieldDateRangeSelection {
|
|
5
5
|
Start = "start",
|
|
6
6
|
End = "end"
|
|
@@ -20,11 +20,11 @@ export declare class FieldDateTimeRange extends FieldDateTimeBase<DateTimeRange
|
|
|
20
20
|
label: string;
|
|
21
21
|
selection: FieldDateRangeSelection;
|
|
22
22
|
value?: DateTimeRange;
|
|
23
|
-
protected
|
|
23
|
+
protected resetNavigationDate(): void;
|
|
24
24
|
static get styles(): import("@a11d/lit").CSSResult;
|
|
25
25
|
protected calendarIconButtonIcon: MaterialIcon;
|
|
26
26
|
protected get placeholder(): string;
|
|
27
|
-
protected get
|
|
27
|
+
protected get calendarValue(): import("@3mo/date-time/DateTimeRange.js").DateTimeRange | undefined;
|
|
28
28
|
protected get popoverContentTemplate(): import("lit-html").HTMLTemplateResult;
|
|
29
29
|
protected get popoverToolbarTemplate(): import("lit-html").HTMLTemplateResult;
|
|
30
30
|
private get startEndTabBarTemplate();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldDateTimeRange.d.ts","sourceRoot":"","sources":["../FieldDateTimeRange.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAA;AAG7C,OAAO,EAAE,iBAAiB,IAAI,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;
|
|
1
|
+
{"version":3,"file":"FieldDateTimeRange.d.ts","sourceRoot":"","sources":["../FieldDateTimeRange.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAA;AAG7C,OAAO,EAAE,iBAAiB,IAAI,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC/E,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AASzE,aAAK,uBAAuB;IAC3B,KAAK,UAAU;IACf,GAAG,QAAQ;CACX;AAED;;;;;;;;;GASG;AACH,qBACa,kBAAmB,SAAQ,iBAAiB,CAAC,aAAa,GAAG,SAAS,CAAC;IACnF,SAAS,KAAK,YAAY,8DAAoG;IAEzG,KAAK,SAAc;IAC5B,SAAS,0BAAgC;IACzB,KAAK,CAAC,EAAE,aAAa,CAAA;IAEjD,SAAS,CAAC,mBAAmB;IAM7B,WAAoB,MAAM,kCAezB;IAED,UAAmB,sBAAsB,EAAE,YAAY,CAAe;IAEtE,cACuB,WAAW,WAEjC;IAED,SAAS,KAAK,aAAa,wEAE1B;IAED,cAAuB,sBAAsB,0CAK5C;IAED,SAAS,KAAK,sBAAsB,0CAInC;IAED,OAAO,KAAK,sBAAsB,GASjC;IAEQ,wBAAwB,CAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,sBAAsB;IAiBnF,SAAS,CAAC,iBAAiB,CAAC,KAAK,EAAE,aAAa,GAAG,SAAS;cAIzC,iBAAiB,CAAC,KAAK,EAAE,MAAM;CAGlD;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,0BAA0B,EAAE,kBAAkB,CAAA;KAC9C;CACD"}
|
|
@@ -3,7 +3,6 @@ import { bind, component, css, html, property } from '@a11d/lit';
|
|
|
3
3
|
import { Localizer } from '@3mo/localization';
|
|
4
4
|
import { Memoize as memoize } from 'typescript-memoize';
|
|
5
5
|
import { FieldDateTimeBase as FieldDateTimeBase } from './FieldDateTimeBase.js';
|
|
6
|
-
import { FieldDateTimePrecision } from './FieldDateTimePrecision.js';
|
|
7
6
|
import { DateRangeParser } from './DateRangeParser.js';
|
|
8
7
|
Localizer.dictionaries.add('de', {
|
|
9
8
|
'Period': 'Zeitraum',
|
|
@@ -33,10 +32,10 @@ let FieldDateTimeRange = class FieldDateTimeRange extends FieldDateTimeBase {
|
|
|
33
32
|
this.calendarIconButtonIcon = 'date_range';
|
|
34
33
|
}
|
|
35
34
|
get selectedDate() { return this.selection === FieldDateRangeSelection.Start ? this.value?.start : this.value?.end; }
|
|
36
|
-
|
|
37
|
-
this.
|
|
38
|
-
? this.value?.start ?? this.
|
|
39
|
-
: this.value?.end ?? this.
|
|
35
|
+
resetNavigationDate() {
|
|
36
|
+
this.navigationDate = this.selection === FieldDateRangeSelection.Start
|
|
37
|
+
? this.value?.start ?? this.navigationDate
|
|
38
|
+
: this.value?.end ?? this.navigationDate;
|
|
40
39
|
}
|
|
41
40
|
static get styles() {
|
|
42
41
|
return css `
|
|
@@ -57,15 +56,8 @@ let FieldDateTimeRange = class FieldDateTimeRange extends FieldDateTimeBase {
|
|
|
57
56
|
get placeholder() {
|
|
58
57
|
return new DateTimeRange(new DateTime().subtract({ years: 1 }), new DateTime()).format(this.formatOptions);
|
|
59
58
|
}
|
|
60
|
-
get
|
|
61
|
-
return
|
|
62
|
-
<mo-selectable-calendar
|
|
63
|
-
data-selection=${this.selection}
|
|
64
|
-
.navigatingValue=${this.navigatingDate}
|
|
65
|
-
.value=${this.value}
|
|
66
|
-
@dayClick=${(e) => this.handleSelectedDateChange(e.detail, FieldDateTimePrecision.Day)}
|
|
67
|
-
></mo-selectable-calendar>
|
|
68
|
-
`;
|
|
59
|
+
get calendarValue() {
|
|
60
|
+
return this.value;
|
|
69
61
|
}
|
|
70
62
|
get popoverContentTemplate() {
|
|
71
63
|
return html `
|
|
@@ -81,7 +73,7 @@ let FieldDateTimeRange = class FieldDateTimeRange extends FieldDateTimeBase {
|
|
|
81
73
|
get startEndTabBarTemplate() {
|
|
82
74
|
return html `
|
|
83
75
|
<mo-flex>
|
|
84
|
-
<mo-tab-bar ${bind(this, 'selection', { sourceUpdated: () => this.
|
|
76
|
+
<mo-tab-bar ${bind(this, 'selection', { sourceUpdated: () => this.resetNavigationDate() })}>
|
|
85
77
|
<mo-tab value=${FieldDateRangeSelection.Start}>${t('Start')}</mo-tab>
|
|
86
78
|
<mo-tab value=${FieldDateRangeSelection.End}>${t('End')}</mo-tab>
|
|
87
79
|
</mo-tab-bar>
|
|
@@ -89,6 +81,8 @@ let FieldDateTimeRange = class FieldDateTimeRange extends FieldDateTimeBase {
|
|
|
89
81
|
`;
|
|
90
82
|
}
|
|
91
83
|
handleSelectedDateChange(date, precision) {
|
|
84
|
+
const { hour, minute, second } = this.navigationDate;
|
|
85
|
+
date = date.with({ hour, minute, second });
|
|
92
86
|
const { start, end } = this.precision.getRange(date);
|
|
93
87
|
this.value = this.selection === FieldDateRangeSelection.Start
|
|
94
88
|
? new DateTimeRange(start, this.value?.end)
|