@3mo/date-time-fields 0.16.0 → 0.17.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/FieldDateTimePrecision.d.ts.map +1 -1
- package/dist/FieldDateTimePrecision.js +0 -1
- package/dist/custom-elements.json +993 -1154
- package/dist/{FieldDate.d.ts → date-time/FieldDate.d.ts} +1 -1
- package/dist/date-time/FieldDate.d.ts.map +1 -0
- package/dist/{FieldDate.js → date-time/FieldDate.js} +1 -1
- package/dist/date-time/FieldDateTime.d.ts +36 -0
- package/dist/date-time/FieldDateTime.d.ts.map +1 -0
- package/dist/date-time/FieldDateTime.js +61 -0
- package/dist/{FieldDateTimeBase.d.ts → date-time/FieldDateTimeBase.d.ts} +30 -22
- package/dist/date-time/FieldDateTimeBase.d.ts.map +1 -0
- package/dist/{FieldDateTimeBase.js → date-time/FieldDateTimeBase.js} +103 -105
- package/dist/date-time/FieldDateTimeController.d.ts +30 -0
- package/dist/date-time/FieldDateTimeController.d.ts.map +1 -0
- package/dist/date-time/FieldDateTimeController.js +87 -0
- package/dist/date-time/FieldDateTimeControllerBase.d.ts +81 -0
- package/dist/date-time/FieldDateTimeControllerBase.d.ts.map +1 -0
- package/dist/date-time/FieldDateTimeControllerBase.js +103 -0
- package/dist/date-time/index.d.ts +5 -0
- package/dist/date-time/index.d.ts.map +1 -0
- package/dist/date-time/index.js +4 -0
- package/dist/date-time-range/DateRangeParser.d.ts.map +1 -0
- package/dist/{FieldDateRange.d.ts → date-time-range/FieldDateRange.d.ts} +1 -1
- package/dist/date-time-range/FieldDateRange.d.ts.map +1 -0
- package/dist/{FieldDateRange.js → date-time-range/FieldDateRange.js} +1 -1
- package/dist/date-time-range/FieldDateTimeRange.d.ts +41 -0
- package/dist/date-time-range/FieldDateTimeRange.d.ts.map +1 -0
- package/dist/date-time-range/FieldDateTimeRange.js +100 -0
- package/dist/date-time-range/FieldDateTimeRangeController.d.ts +44 -0
- package/dist/date-time-range/FieldDateTimeRangeController.d.ts.map +1 -0
- package/dist/date-time-range/FieldDateTimeRangeController.js +137 -0
- package/dist/{FieldToggleableDateTimeRange.d.ts → date-time-range/FieldToggleableDateTimeRange.d.ts} +1 -1
- package/dist/date-time-range/FieldToggleableDateTimeRange.d.ts.map +1 -0
- package/dist/{FieldToggleableDateTimeRange.js → date-time-range/FieldToggleableDateTimeRange.js} +1 -1
- package/dist/date-time-range/index.d.ts +5 -0
- package/dist/date-time-range/index.d.ts.map +1 -0
- package/dist/date-time-range/index.js +4 -0
- package/dist/dateTimeConverter.d.ts +2 -0
- package/dist/dateTimeConverter.d.ts.map +1 -0
- package/dist/dateTimeConverter.js +10 -0
- package/dist/index.d.ts +3 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -6
- package/dist/selection/Calendar.d.ts.map +1 -1
- package/dist/selection/Calendar.js +4 -3
- package/dist/{FieldTime.d.ts → time/FieldTime.d.ts} +6 -12
- package/dist/time/FieldTime.d.ts.map +1 -0
- package/dist/{FieldTime.js → time/FieldTime.js} +25 -69
- package/dist/time/FieldTimeController.d.ts +72 -0
- package/dist/time/FieldTimeController.d.ts.map +1 -0
- package/dist/time/FieldTimeController.js +110 -0
- package/dist/time/index.d.ts +3 -0
- package/dist/time/index.d.ts.map +1 -0
- package/dist/time/index.js +2 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/DateRangeParser.d.ts.map +0 -1
- package/dist/FieldDate.d.ts.map +0 -1
- package/dist/FieldDateRange.d.ts.map +0 -1
- package/dist/FieldDateTime.d.ts +0 -40
- package/dist/FieldDateTime.d.ts.map +0 -1
- package/dist/FieldDateTime.js +0 -109
- package/dist/FieldDateTimeBase.d.ts.map +0 -1
- package/dist/FieldDateTimeRange.d.ts +0 -53
- package/dist/FieldDateTimeRange.d.ts.map +0 -1
- package/dist/FieldDateTimeRange.js +0 -167
- package/dist/FieldTime.d.ts.map +0 -1
- package/dist/FieldToggleableDateTimeRange.d.ts.map +0 -1
- /package/dist/{DateRangeParser.d.ts → date-time-range/DateRangeParser.d.ts} +0 -0
- /package/dist/{DateRangeParser.js → date-time-range/DateRangeParser.js} +0 -0
package/dist/FieldDateTime.js
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
import { component, html, join, property } from '@a11d/lit';
|
|
3
|
-
import { Localizer } from '@3mo/localization';
|
|
4
|
-
import { FieldDateTimeBase } from './FieldDateTimeBase.js';
|
|
5
|
-
import { FieldDateTimePrecision } from './FieldDateTimePrecision.js';
|
|
6
|
-
import { Memoize as memoize } from 'typescript-memoize';
|
|
7
|
-
Localizer.dictionaries.add('de', {
|
|
8
|
-
'Date & Time': 'Datum & Uhrzeit',
|
|
9
|
-
'Date': 'Datum',
|
|
10
|
-
'Year': 'Jahr',
|
|
11
|
-
'Month': 'Monat',
|
|
12
|
-
'Today': 'Heute',
|
|
13
|
-
'Yesterday': 'Gestern',
|
|
14
|
-
'Tomorrow': 'Morgen',
|
|
15
|
-
'Week start': 'Wochenstart',
|
|
16
|
-
'Week end': 'Wochenende',
|
|
17
|
-
'Month start': 'Monatsanfang',
|
|
18
|
-
'Month end': 'Monatsende',
|
|
19
|
-
'Year start': 'Jahresanfang',
|
|
20
|
-
'Year end': 'Jahresende',
|
|
21
|
-
});
|
|
22
|
-
/**
|
|
23
|
-
* @element mo-field-date-time
|
|
24
|
-
*
|
|
25
|
-
* @i18n "Date & Time"
|
|
26
|
-
* @i18n "Date"
|
|
27
|
-
* @i18n "Year"
|
|
28
|
-
* @i18n "Month"
|
|
29
|
-
* @i18n "Week"
|
|
30
|
-
* @i18n "Today"
|
|
31
|
-
* @i18n "Yesterday"
|
|
32
|
-
* @i18n "Tomorrow"
|
|
33
|
-
* @i18n "Week start"
|
|
34
|
-
* @i18n "Week end"
|
|
35
|
-
* @i18n "Month start"
|
|
36
|
-
* @i18n "Month end"
|
|
37
|
-
* @i18n "Year start"
|
|
38
|
-
* @i18n "Year end"
|
|
39
|
-
*/
|
|
40
|
-
let FieldDateTime = class FieldDateTime extends FieldDateTimeBase {
|
|
41
|
-
get selectedDate() {
|
|
42
|
-
if (!this.value) {
|
|
43
|
-
return undefined;
|
|
44
|
-
}
|
|
45
|
-
if (this.value instanceof Date) {
|
|
46
|
-
return new DateTime(this.value);
|
|
47
|
-
}
|
|
48
|
-
return this.value;
|
|
49
|
-
}
|
|
50
|
-
get _label() {
|
|
51
|
-
return super._label || this.defaultLabel;
|
|
52
|
-
}
|
|
53
|
-
get defaultLabel() {
|
|
54
|
-
switch (this.precision) {
|
|
55
|
-
case FieldDateTimePrecision.Year: return t('Year');
|
|
56
|
-
case FieldDateTimePrecision.Month: return t('Month');
|
|
57
|
-
case FieldDateTimePrecision.Week: return t('Week');
|
|
58
|
-
case FieldDateTimePrecision.Day: return t('Date');
|
|
59
|
-
default: return t('Date & Time');
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
get placeholder() {
|
|
63
|
-
return new DateTime().format(this.formatOptions);
|
|
64
|
-
}
|
|
65
|
-
resetNavigationDate() {
|
|
66
|
-
this.navigationDate = this.selectedDate ?? new DateTime();
|
|
67
|
-
}
|
|
68
|
-
get calendarValue() {
|
|
69
|
-
return new DateTimeRange(this.selectedDate, this.selectedDate);
|
|
70
|
-
}
|
|
71
|
-
get presetsTemplate() {
|
|
72
|
-
return join([this.precision < FieldDateTimePrecision.Day ? undefined : html `
|
|
73
|
-
${this.getPresetTemplate(t('Today'), () => new DateTime().dayStart)}
|
|
74
|
-
${this.getPresetTemplate(t('Yesterday'), () => new DateTime().subtract({ days: 1 }).dayStart)}
|
|
75
|
-
${this.getPresetTemplate(t('Tomorrow'), () => new DateTime().add({ days: 1 }).dayStart)}
|
|
76
|
-
<mo-line></mo-line>
|
|
77
|
-
${this.getPresetTemplate(t('Week start'), () => new DateTime().weekStart.dayStart)}
|
|
78
|
-
${this.getPresetTemplate(t('Week end'), () => new DateTime().weekEnd.dayEnd)}
|
|
79
|
-
<mo-line></mo-line>
|
|
80
|
-
${this.getPresetTemplate(t('Month start'), () => new DateTime().monthStart.dayStart)}
|
|
81
|
-
${this.getPresetTemplate(t('Month end'), () => new DateTime().monthEnd.dayEnd)}
|
|
82
|
-
<mo-line></mo-line>
|
|
83
|
-
${this.getPresetTemplate(t('Year start'), () => new DateTime().yearStart.dayStart)}
|
|
84
|
-
${this.getPresetTemplate(t('Year end'), () => new DateTime().yearEnd.dayEnd)}
|
|
85
|
-
`].filter(Boolean), html `<mo-line></mo-line>`);
|
|
86
|
-
}
|
|
87
|
-
handleSelectedDateChange(date, precision) {
|
|
88
|
-
const { hour, minute, second } = this.navigationDate;
|
|
89
|
-
date = date.with({ hour, minute, second });
|
|
90
|
-
this.value = !date ? undefined : this.precision.getRange(date).start;
|
|
91
|
-
super.handleSelectedDateChange(date, precision);
|
|
92
|
-
}
|
|
93
|
-
valueToInputValue(value) {
|
|
94
|
-
return value?.format(this.formatOptions) ?? '';
|
|
95
|
-
}
|
|
96
|
-
inputValueToValue(value) {
|
|
97
|
-
return value ? DateTime.parseAsDateTime(value, this.shortcutReferenceDate) : undefined;
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
__decorate([
|
|
101
|
-
property({ type: Object })
|
|
102
|
-
], FieldDateTime.prototype, "value", void 0);
|
|
103
|
-
__decorate([
|
|
104
|
-
memoize()
|
|
105
|
-
], FieldDateTime.prototype, "placeholder", null);
|
|
106
|
-
FieldDateTime = __decorate([
|
|
107
|
-
component('mo-field-date-time')
|
|
108
|
-
], FieldDateTime);
|
|
109
|
-
export { FieldDateTime };
|
|
@@ -1 +0,0 @@
|
|
|
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,EA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AAC,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"}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { type HTMLTemplateResult } from '@a11d/lit';
|
|
2
|
-
import { type MaterialIcon } from '@3mo/icon';
|
|
3
|
-
import { FieldDateTimeBase as FieldDateTimeBase } from './FieldDateTimeBase.js';
|
|
4
|
-
import { FieldDateTimePrecision } from './FieldDateTimePrecision.js';
|
|
5
|
-
declare enum FieldDateRangeSelection {
|
|
6
|
-
Start = "start",
|
|
7
|
-
End = "end"
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* @element mo-field-date-range
|
|
11
|
-
*
|
|
12
|
-
* @attr selection - The selected date range. Either "start" or "end". Defaults to "start".
|
|
13
|
-
* @attr value - The selected date range.
|
|
14
|
-
*
|
|
15
|
-
* @i18n "Period"
|
|
16
|
-
* @i18n "Start"
|
|
17
|
-
* @i18n "End"
|
|
18
|
-
* @i18n "Last ${count:number} days"
|
|
19
|
-
* @i18n "Last week"
|
|
20
|
-
* @i18n "This week"
|
|
21
|
-
* @i18n "Next week"
|
|
22
|
-
* @i18n "Last month"
|
|
23
|
-
* @i18n "This month"
|
|
24
|
-
* @i18n "Next month"
|
|
25
|
-
* @i18n "Last year"
|
|
26
|
-
* @i18n "This year"
|
|
27
|
-
* @i18n "Next year"
|
|
28
|
-
*/
|
|
29
|
-
export declare class FieldDateTimeRange extends FieldDateTimeBase<DateTimeRange | undefined> {
|
|
30
|
-
protected get selectedDate(): import("@3mo/date-time/DateTime.js").DateTime | undefined;
|
|
31
|
-
selection: FieldDateRangeSelection;
|
|
32
|
-
value?: DateTimeRange;
|
|
33
|
-
protected resetNavigationDate(): void;
|
|
34
|
-
protected get _label(): string;
|
|
35
|
-
protected get presetsTemplate(): HTMLTemplateResult;
|
|
36
|
-
static get styles(): import("@a11d/lit").CSSResult;
|
|
37
|
-
protected calendarIconButtonIcon: MaterialIcon;
|
|
38
|
-
protected get placeholder(): string;
|
|
39
|
-
protected get calendarValue(): import("@3mo/date-time/DateTimeRange.js").DateTimeRange | undefined;
|
|
40
|
-
protected get popoverSelectionTemplate(): HTMLTemplateResult;
|
|
41
|
-
protected get popoverToolbarTemplate(): HTMLTemplateResult;
|
|
42
|
-
private get startEndTabBarTemplate();
|
|
43
|
-
handleSelectedDateChange(date: DateTime, precision: FieldDateTimePrecision): void;
|
|
44
|
-
protected valueToInputValue(value: DateTimeRange | undefined): string;
|
|
45
|
-
protected inputValueToValue(value: string): import("@3mo/date-time/DateTimeRange.js").DateTimeRange | undefined;
|
|
46
|
-
}
|
|
47
|
-
declare global {
|
|
48
|
-
interface HTMLElementTagNameMap {
|
|
49
|
-
'mo-field-date-time-range': FieldDateTimeRange;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
export {};
|
|
53
|
-
//# sourceMappingURL=FieldDateTimeRange.d.ts.map
|
|
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decorate } from "tslib";
|
|
2
|
-
import { bind, component, css, html, join, property } from '@a11d/lit';
|
|
3
|
-
import { Localizer } from '@3mo/localization';
|
|
4
|
-
import { Memoize as memoize } from 'typescript-memoize';
|
|
5
|
-
import { FieldDateTimeBase as FieldDateTimeBase } from './FieldDateTimeBase.js';
|
|
6
|
-
import { FieldDateTimePrecision } from './FieldDateTimePrecision.js';
|
|
7
|
-
import { DateRangeParser } from './DateRangeParser.js';
|
|
8
|
-
Localizer.dictionaries.add('de', {
|
|
9
|
-
'Period': 'Zeitraum',
|
|
10
|
-
'Start': 'Start',
|
|
11
|
-
'End': 'Ende',
|
|
12
|
-
'Last ${count:number} days': 'Letzte ${count} Tage',
|
|
13
|
-
'Last week': 'Letzte Woche',
|
|
14
|
-
'This week': 'Diese Woche',
|
|
15
|
-
'Next week': 'Nächste Woche',
|
|
16
|
-
'Last month': 'Letzter Monat',
|
|
17
|
-
'This month': 'Dieser Monat',
|
|
18
|
-
'Next month': 'Nächster Monat',
|
|
19
|
-
'Last year': 'Letztes Jahr',
|
|
20
|
-
'This year': 'Dieses Jahr',
|
|
21
|
-
'Next year': 'Nächstes Jahr',
|
|
22
|
-
});
|
|
23
|
-
var FieldDateRangeSelection;
|
|
24
|
-
(function (FieldDateRangeSelection) {
|
|
25
|
-
FieldDateRangeSelection["Start"] = "start";
|
|
26
|
-
FieldDateRangeSelection["End"] = "end";
|
|
27
|
-
})(FieldDateRangeSelection || (FieldDateRangeSelection = {}));
|
|
28
|
-
/**
|
|
29
|
-
* @element mo-field-date-range
|
|
30
|
-
*
|
|
31
|
-
* @attr selection - The selected date range. Either "start" or "end". Defaults to "start".
|
|
32
|
-
* @attr value - The selected date range.
|
|
33
|
-
*
|
|
34
|
-
* @i18n "Period"
|
|
35
|
-
* @i18n "Start"
|
|
36
|
-
* @i18n "End"
|
|
37
|
-
* @i18n "Last ${count:number} days"
|
|
38
|
-
* @i18n "Last week"
|
|
39
|
-
* @i18n "This week"
|
|
40
|
-
* @i18n "Next week"
|
|
41
|
-
* @i18n "Last month"
|
|
42
|
-
* @i18n "This month"
|
|
43
|
-
* @i18n "Next month"
|
|
44
|
-
* @i18n "Last year"
|
|
45
|
-
* @i18n "This year"
|
|
46
|
-
* @i18n "Next year"
|
|
47
|
-
*/
|
|
48
|
-
let FieldDateTimeRange = class FieldDateTimeRange extends FieldDateTimeBase {
|
|
49
|
-
constructor() {
|
|
50
|
-
super(...arguments);
|
|
51
|
-
this.selection = FieldDateRangeSelection.Start;
|
|
52
|
-
this.calendarIconButtonIcon = 'date_range';
|
|
53
|
-
}
|
|
54
|
-
get selectedDate() { return this.selection === FieldDateRangeSelection.Start ? this.value?.start : this.value?.end; }
|
|
55
|
-
resetNavigationDate() {
|
|
56
|
-
this.navigationDate = this.selection === FieldDateRangeSelection.Start
|
|
57
|
-
? this.value?.start ?? this.navigationDate
|
|
58
|
-
: this.value?.end ?? this.navigationDate;
|
|
59
|
-
}
|
|
60
|
-
get _label() {
|
|
61
|
-
return super._label || t('Period');
|
|
62
|
-
}
|
|
63
|
-
get presetsTemplate() {
|
|
64
|
-
return join([
|
|
65
|
-
this.precision < FieldDateTimePrecision.Day ? undefined : html `
|
|
66
|
-
${this.getPresetTemplate(t('Last week'), () => new DateTimeRange(new DateTime().add({ weeks: -1 }).weekStart.dayStart, new DateTime().add({ weeks: -1 }).weekEnd.dayEnd))}
|
|
67
|
-
${this.getPresetTemplate(t('This week'), () => new DateTimeRange(new DateTime().weekStart.dayStart, new DateTime().weekEnd.dayEnd))}
|
|
68
|
-
${this.getPresetTemplate(t('Next week'), () => new DateTimeRange(new DateTime().add({ weeks: 1 }).weekStart.dayStart, new DateTime().add({ weeks: 1 }).weekEnd.dayEnd))}
|
|
69
|
-
${this.getPresetTemplate(t('Last ${count:number} days', { count: 7 }), () => new DateTimeRange(new DateTime().subtract({ days: 6 }).dayStart, new DateTime().dayEnd))}
|
|
70
|
-
${this.getPresetTemplate(t('Last ${count:number} days', { count: 30 }), () => new DateTimeRange(new DateTime().subtract({ days: 29 }).dayStart, new DateTime().dayEnd))}
|
|
71
|
-
${this.getPresetTemplate(t('Last ${count:number} days', { count: 90 }), () => new DateTimeRange(new DateTime().subtract({ days: 89 }).dayStart, new DateTime().dayEnd))}
|
|
72
|
-
`,
|
|
73
|
-
this.precision < FieldDateTimePrecision.Month ? undefined : html `
|
|
74
|
-
${this.getPresetTemplate(t('Last month'), () => new DateTimeRange(new DateTime().add({ months: -1 }).monthStart.dayStart, new DateTime().add({ months: -1 }).monthEnd.dayEnd))}
|
|
75
|
-
${this.getPresetTemplate(t('This month'), () => new DateTimeRange(new DateTime().monthStart.dayStart, new DateTime().monthEnd.dayEnd))}
|
|
76
|
-
${this.getPresetTemplate(t('Next month'), () => new DateTimeRange(new DateTime().add({ months: 1 }).monthStart.dayStart, new DateTime().add({ months: 1 }).monthEnd.dayEnd))}
|
|
77
|
-
`,
|
|
78
|
-
this.precision < FieldDateTimePrecision.Year ? undefined : html `
|
|
79
|
-
${this.getPresetTemplate(t('Last year'), () => new DateTimeRange(new DateTime().add({ years: -1 }).yearStart.dayStart, new DateTime().add({ years: -1 }).yearEnd.dayEnd))}
|
|
80
|
-
${this.getPresetTemplate(t('This year'), () => new DateTimeRange(new DateTime().yearStart.dayStart, new DateTime().yearEnd.dayEnd))}
|
|
81
|
-
${this.getPresetTemplate(t('Next year'), () => new DateTimeRange(new DateTime().add({ years: 1 }).yearStart.dayStart, new DateTime().add({ years: 1 }).yearEnd.dayEnd))}
|
|
82
|
-
`
|
|
83
|
-
].filter(Boolean), html `<mo-line></mo-line>`);
|
|
84
|
-
}
|
|
85
|
-
static get styles() {
|
|
86
|
-
return css `
|
|
87
|
-
${super.styles}
|
|
88
|
-
|
|
89
|
-
mo-tab-bar {
|
|
90
|
-
max-width: 200px;
|
|
91
|
-
place-self: center;
|
|
92
|
-
padding-block: 4px;
|
|
93
|
-
mo-tab {
|
|
94
|
-
&:not([active]) {
|
|
95
|
-
opacity: 0.5;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
#selector {
|
|
101
|
-
flex: none !important;
|
|
102
|
-
}
|
|
103
|
-
`;
|
|
104
|
-
}
|
|
105
|
-
get placeholder() {
|
|
106
|
-
return new DateTimeRange(new DateTime().subtract({ years: 1 }), new DateTime()).format(this.formatOptions);
|
|
107
|
-
}
|
|
108
|
-
get calendarValue() {
|
|
109
|
-
return this.value;
|
|
110
|
-
}
|
|
111
|
-
get popoverSelectionTemplate() {
|
|
112
|
-
return html `
|
|
113
|
-
<mo-flex style='flex: 1'>
|
|
114
|
-
${this.popoverToolbarTemplate}
|
|
115
|
-
${super.popoverSelectionTemplate}
|
|
116
|
-
</mo-flex>
|
|
117
|
-
`;
|
|
118
|
-
}
|
|
119
|
-
get popoverToolbarTemplate() {
|
|
120
|
-
return html `
|
|
121
|
-
${this.startEndTabBarTemplate}
|
|
122
|
-
`;
|
|
123
|
-
}
|
|
124
|
-
get startEndTabBarTemplate() {
|
|
125
|
-
return html `
|
|
126
|
-
<mo-flex style='border-inline-start: 1px solid var(--mo-color-transparent-gray-3)'>
|
|
127
|
-
<mo-tab-bar ${bind(this, 'selection', { sourceUpdated: () => this.resetNavigationDate() })}>
|
|
128
|
-
<mo-tab value=${FieldDateRangeSelection.Start}>${t('Start')}</mo-tab>
|
|
129
|
-
<mo-tab value=${FieldDateRangeSelection.End}>${t('End')}</mo-tab>
|
|
130
|
-
</mo-tab-bar>
|
|
131
|
-
</mo-flex>
|
|
132
|
-
`;
|
|
133
|
-
}
|
|
134
|
-
handleSelectedDateChange(date, precision) {
|
|
135
|
-
const { hour, minute, second } = this.navigationDate;
|
|
136
|
-
date = date.with({ hour, minute, second });
|
|
137
|
-
const { start, end } = this.precision.getRange(date);
|
|
138
|
-
this.value = this.selection === FieldDateRangeSelection.Start
|
|
139
|
-
? new DateTimeRange(start, this.value?.end)
|
|
140
|
-
: new DateTimeRange(this.value?.start, end);
|
|
141
|
-
if (this.precision === precision) {
|
|
142
|
-
this.selection = this.selection === FieldDateRangeSelection.Start
|
|
143
|
-
? FieldDateRangeSelection.End
|
|
144
|
-
: FieldDateRangeSelection.Start;
|
|
145
|
-
}
|
|
146
|
-
super.handleSelectedDateChange(date, precision);
|
|
147
|
-
}
|
|
148
|
-
valueToInputValue(value) {
|
|
149
|
-
return value?.format(this.formatOptions) ?? '';
|
|
150
|
-
}
|
|
151
|
-
inputValueToValue(value) {
|
|
152
|
-
return value ? DateRangeParser.parse(value, this.shortcutReferenceDate) : undefined;
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
__decorate([
|
|
156
|
-
property()
|
|
157
|
-
], FieldDateTimeRange.prototype, "selection", void 0);
|
|
158
|
-
__decorate([
|
|
159
|
-
property({ type: Object })
|
|
160
|
-
], FieldDateTimeRange.prototype, "value", void 0);
|
|
161
|
-
__decorate([
|
|
162
|
-
memoize()
|
|
163
|
-
], FieldDateTimeRange.prototype, "placeholder", null);
|
|
164
|
-
FieldDateTimeRange = __decorate([
|
|
165
|
-
component('mo-field-date-time-range')
|
|
166
|
-
], FieldDateTimeRange);
|
|
167
|
-
export { FieldDateTimeRange };
|
package/dist/FieldTime.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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,yBA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
|
File without changes
|