@3mo/date-time-fields 0.5.1 → 0.5.3
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.js +6 -6
- package/dist/FieldDateTimeBase.d.ts +2 -3
- package/dist/FieldDateTimeBase.d.ts.map +1 -1
- package/dist/FieldDateTimeBase.js +113 -118
- package/dist/FieldDateTimeRange.js +34 -34
- package/dist/FieldTime.js +3 -3
- package/dist/FieldToggleableDateTimeRange.js +7 -7
- package/dist/custom-elements.json +3877 -0
- package/dist/selection/DateList.js +24 -24
- package/dist/selection/HourList.js +8 -8
- package/dist/selection/MinuteList.js +8 -8
- package/dist/selection/MonthList.js +14 -14
- package/dist/selection/SecondList.js +8 -8
- package/dist/selection/YearList.js +8 -8
- package/dist/selection/calendar/Calendar.js +72 -72
- package/dist/selection/calendar/SelectableCalendar.d.ts +1 -1
- package/dist/selection/calendar/SelectableCalendar.d.ts.map +1 -1
- package/dist/selection/calendar/SelectableCalendar.js +8 -8
- package/dist/selection/calendar/SelectableRangeCalendar.d.ts +1 -1
- package/dist/selection/calendar/SelectableRangeCalendar.d.ts.map +1 -1
- package/dist/selection/calendar/SelectableRangeCalendar.js +2 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -1
- package/README.md +0 -3
package/dist/FieldDateTime.js
CHANGED
|
@@ -10,12 +10,12 @@ let FieldDateTime = class FieldDateTime extends FieldDateTimeBase {
|
|
|
10
10
|
return new DateTime().format(this.formatOptions);
|
|
11
11
|
}
|
|
12
12
|
get calendarTemplate() {
|
|
13
|
-
return html `
|
|
14
|
-
<mo-selectable-calendar
|
|
15
|
-
.navigatingValue=${this.navigatingDate}
|
|
16
|
-
.value=${this.selectedDate}
|
|
17
|
-
@change=${(e) => this.handleSelectedDateChange(e.detail, FieldDateTimePrecision.Day)}
|
|
18
|
-
></mo-selectable-calendar>
|
|
13
|
+
return html `
|
|
14
|
+
<mo-selectable-calendar
|
|
15
|
+
.navigatingValue=${this.navigatingDate}
|
|
16
|
+
.value=${this.selectedDate}
|
|
17
|
+
@change=${(e) => this.handleSelectedDateChange(e.detail, FieldDateTimePrecision.Day)}
|
|
18
|
+
></mo-selectable-calendar>
|
|
19
19
|
`;
|
|
20
20
|
}
|
|
21
21
|
handleSelectedDateChange(date, precision) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { HTMLTemplateResult } from '@a11d/lit';
|
|
2
2
|
import { InputFieldComponent } from '@3mo/field';
|
|
3
3
|
import type { MaterialIcon } from '@3mo/icon';
|
|
4
|
-
import { FocusMethod } from '@3mo/focus-controller';
|
|
4
|
+
import type { FocusMethod } from '@3mo/focus-controller';
|
|
5
5
|
export declare enum FieldDateTimePrecision {
|
|
6
6
|
Year = "year",
|
|
7
7
|
Month = "month",
|
|
@@ -37,9 +37,8 @@ export declare abstract class FieldDateTimeBase<T> extends InputFieldComponent<T
|
|
|
37
37
|
protected get inputTemplate(): HTMLTemplateResult;
|
|
38
38
|
protected abstract inputValueToValue(value: string): T | undefined;
|
|
39
39
|
protected abstract valueToInputValue(value: T | undefined): string;
|
|
40
|
-
private iconButtonActivated;
|
|
41
40
|
protected get calendarIconButtonTemplate(): HTMLTemplateResult;
|
|
42
|
-
protected handleFocus(bubbled: boolean, method: FocusMethod):
|
|
41
|
+
protected handleFocus(bubbled: boolean, method: FocusMethod): void;
|
|
43
42
|
protected handleBlur(bubbled: boolean, method: FocusMethod): void;
|
|
44
43
|
protected get popoverTemplate(): HTMLTemplateResult;
|
|
45
44
|
protected get popoverContentTemplate(): HTMLTemplateResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldDateTimeBase.d.ts","sourceRoot":"","sources":["../FieldDateTimeBase.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAA2C,MAAM,WAAW,CAAA;AACvF,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"FieldDateTimeBase.d.ts","sourceRoot":"","sources":["../FieldDateTimeBase.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAA2C,MAAM,WAAW,CAAA;AACvF,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,oBAAY,sBAAsB;IACjC,IAAI,SAAS;IACb,KAAK,UAAU;IACf,GAAG,QAAQ;IACX,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,MAAM,WAAW;CACjB;AAcD;;;;;GAKG;AACH,8BAAsB,iBAAiB,CAAC,CAAC,CAAE,SAAQ,mBAAmB,CAAC,CAAC,CAAC;IAWrE,IAAI,UAAQ;IACc,YAAY,UAAQ;IACrB,qBAAqB,gDAAe;IACpD,SAAS,yBAAgC;IAErD,OAAO,CAAC,SAAS,CAAC,CAAG;IAErB,SAAS,CAAC,QAAQ,CAAC,sBAAsB,EAAE,YAAY,CAAU;IAEjE,SAAS,CAAC,QAAQ,KAAK,cAAc,IAAI,QAAQ,CAAA;IAEjD,SAAS,CAAC,QAAQ,KAAK,YAAY,IAAI,QAAQ,GAAG,SAAS,CAAA;IAE3D,SAAS,KAAK,aAAa,IAAI,IAAI,CAAC,qBAAqB,CAYxD;IAED,SAAS,CAAC,gBAAgB,CAAC,IAAI,EAAE,QAAQ;IAWzC,SAAS,CAAC,eAAe,CAAC,IAAI,EAAE,QAAQ;cAWrB,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK;IAKpD,cAAuB,QAAQ,YAE9B;IAED,SAAS,KAAK,WAAW,WAExB;IAED,WAAoB,MAAM,kCAmCzB;IAED,cAAuB,QAAQ,uBAK9B;IAED,cAAuB,eAAe,uBAKrC;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,SAAS,KAAK,0BAA0B,uBAOvC;cAEkB,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW;cAOjD,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW;IAKnE,SAAS,KAAK,eAAe,uBAQ5B;IAED,SAAS,KAAK,sBAAsB,uBAOnC;IAED,SAAS,KAAK,YAAY,uBAMzB;IAED,OAAO,KAAK,gBAAgB,GAQ3B;IAED,OAAO,KAAK,iBAAiB,GAQ5B;IAED,OAAO,KAAK,WAAW,GAEtB;IAED,SAAS,CAAC,QAAQ,KAAK,gBAAgB,IAAI,kBAAkB,CAAA;IAE7D,OAAO,KAAK,YAAY,GAcvB;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;CAKpF"}
|
|
@@ -35,7 +35,6 @@ export class FieldDateTimeBase extends InputFieldComponent {
|
|
|
35
35
|
this.shortcutReferenceDate = new DateTime;
|
|
36
36
|
this.precision = FieldDateTimePrecision.Minute;
|
|
37
37
|
this.calendarIconButtonIcon = 'today';
|
|
38
|
-
this.iconButtonActivated = false;
|
|
39
38
|
}
|
|
40
39
|
get formatOptions() {
|
|
41
40
|
return {
|
|
@@ -81,174 +80,170 @@ export class FieldDateTimeBase extends InputFieldComponent {
|
|
|
81
80
|
return '';
|
|
82
81
|
}
|
|
83
82
|
static get styles() {
|
|
84
|
-
return css `
|
|
85
|
-
${super.styles}
|
|
86
|
-
|
|
87
|
-
:host {
|
|
88
|
-
position: relative;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
mo-popover {
|
|
92
|
-
background: var(--mo-color-background);
|
|
93
|
-
box-shadow: var(--mo-shadow);
|
|
94
|
-
border-radius: var(--mo-border-radius);
|
|
95
|
-
color: var(--mo-color-foreground);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
#selector {
|
|
99
|
-
min-height: 175px;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.timezone {
|
|
103
|
-
padding: 3px;
|
|
104
|
-
font-size: small;
|
|
105
|
-
text-align: end;
|
|
106
|
-
font-weight: 500;
|
|
107
|
-
color: var(--mo-color-gray);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
input::placeholder {
|
|
111
|
-
color: transparent;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
mo-field[active]:not([dense]) input::placeholder {
|
|
115
|
-
color: var(--mo-color-gray);
|
|
116
|
-
}
|
|
83
|
+
return css `
|
|
84
|
+
${super.styles}
|
|
85
|
+
|
|
86
|
+
:host {
|
|
87
|
+
position: relative;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
mo-popover {
|
|
91
|
+
background: var(--mo-color-background);
|
|
92
|
+
box-shadow: var(--mo-shadow);
|
|
93
|
+
border-radius: var(--mo-border-radius);
|
|
94
|
+
color: var(--mo-color-foreground);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
#selector {
|
|
98
|
+
min-height: 175px;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.timezone {
|
|
102
|
+
padding: 3px;
|
|
103
|
+
font-size: small;
|
|
104
|
+
text-align: end;
|
|
105
|
+
font-weight: 500;
|
|
106
|
+
color: var(--mo-color-gray);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
input::placeholder {
|
|
110
|
+
color: transparent;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
mo-field[active]:not([dense]) input::placeholder {
|
|
114
|
+
color: var(--mo-color-gray);
|
|
115
|
+
}
|
|
117
116
|
`;
|
|
118
117
|
}
|
|
119
118
|
get template() {
|
|
120
|
-
return html `
|
|
121
|
-
${super.template}
|
|
122
|
-
${this.popoverTemplate}
|
|
119
|
+
return html `
|
|
120
|
+
${super.template}
|
|
121
|
+
${this.popoverTemplate}
|
|
123
122
|
`;
|
|
124
123
|
}
|
|
125
124
|
get endSlotTemplate() {
|
|
126
|
-
return html `
|
|
127
|
-
${super.endSlotTemplate}
|
|
128
|
-
${this.calendarIconButtonTemplate}
|
|
125
|
+
return html `
|
|
126
|
+
${super.endSlotTemplate}
|
|
127
|
+
${this.calendarIconButtonTemplate}
|
|
129
128
|
`;
|
|
130
129
|
}
|
|
131
130
|
get inputTemplate() {
|
|
132
|
-
return html `
|
|
133
|
-
<input
|
|
134
|
-
part='input'
|
|
135
|
-
?readonly=${this.readonly}
|
|
136
|
-
?required=${this.required}
|
|
137
|
-
?disabled=${this.disabled}
|
|
138
|
-
placeholder=${this.placeholder}
|
|
139
|
-
.value=${live(this.inputStringValue || '')}
|
|
140
|
-
@input=${(e) => this.handleInput(this.inputValueToValue(this.inputElement.value || ''), e)}
|
|
141
|
-
@change=${(e) => this.handleChange(this.inputValueToValue(this.inputElement.value || ''), e)}
|
|
142
|
-
>
|
|
131
|
+
return html `
|
|
132
|
+
<input
|
|
133
|
+
part='input'
|
|
134
|
+
?readonly=${this.readonly}
|
|
135
|
+
?required=${this.required}
|
|
136
|
+
?disabled=${this.disabled}
|
|
137
|
+
placeholder=${this.placeholder}
|
|
138
|
+
.value=${live(this.inputStringValue || '')}
|
|
139
|
+
@input=${(e) => this.handleInput(this.inputValueToValue(this.inputElement.value || ''), e)}
|
|
140
|
+
@change=${(e) => this.handleChange(this.inputValueToValue(this.inputElement.value || ''), e)}
|
|
141
|
+
>
|
|
143
142
|
`;
|
|
144
143
|
}
|
|
145
144
|
get calendarIconButtonTemplate() {
|
|
146
|
-
return this.pickerHidden ? html.nothing : html `
|
|
147
|
-
<mo-icon
|
|
148
|
-
icon=${this.calendarIconButtonIcon}
|
|
149
|
-
${style({ color: this.isActive ? 'var(--mo-color-accent)' : 'var(--mo-color-gray)', fontSize: '22px', marginTop: '2px' })}
|
|
150
|
-
|
|
151
|
-
></mo-icon-button>
|
|
145
|
+
return this.pickerHidden ? html.nothing : html `
|
|
146
|
+
<mo-icon tabindex='-1' dense slot='end'
|
|
147
|
+
icon=${this.calendarIconButtonIcon}
|
|
148
|
+
${style({ color: this.isActive ? 'var(--mo-color-accent)' : 'var(--mo-color-gray)', fontSize: '22px', marginTop: '2px', cursor: 'pointer', userSelect: 'none' })}
|
|
149
|
+
></mo-icon>
|
|
152
150
|
`;
|
|
153
151
|
}
|
|
154
|
-
|
|
152
|
+
handleFocus(bubbled, method) {
|
|
155
153
|
super.handleFocus(bubbled, method);
|
|
156
154
|
if (method === 'pointer') {
|
|
157
155
|
this.open = true;
|
|
158
156
|
}
|
|
159
|
-
await new Promise(r => setTimeout(r));
|
|
160
|
-
this.iconButtonActivated = true;
|
|
161
157
|
}
|
|
162
158
|
handleBlur(bubbled, method) {
|
|
163
159
|
super.handleBlur(bubbled, method);
|
|
164
160
|
this.open = false;
|
|
165
|
-
this.iconButtonActivated = false;
|
|
166
161
|
}
|
|
167
162
|
get popoverTemplate() {
|
|
168
|
-
return this.pickerHidden ? html.nothing : html `
|
|
169
|
-
<mo-popover tabindex='-1' fixed manual
|
|
170
|
-
.anchor=${this}
|
|
171
|
-
?open=${this.open}
|
|
172
|
-
@openChange=${(e) => this.open = e.detail}
|
|
173
|
-
>${cache(!this.open ? html.nothing : this.popoverContentTemplate)}</mo-popover>
|
|
163
|
+
return this.pickerHidden ? html.nothing : html `
|
|
164
|
+
<mo-popover tabindex='-1' fixed manual
|
|
165
|
+
.anchor=${this}
|
|
166
|
+
?open=${this.open}
|
|
167
|
+
@openChange=${(e) => this.open = e.detail}
|
|
168
|
+
>${cache(!this.open ? html.nothing : this.popoverContentTemplate)}</mo-popover>
|
|
174
169
|
`;
|
|
175
170
|
}
|
|
176
171
|
get popoverContentTemplate() {
|
|
177
|
-
return html `
|
|
178
|
-
<mo-flex id='selector' direction='horizontal' style='height: 100%'>
|
|
179
|
-
${this.dateTemplate}
|
|
180
|
-
${this.timeTemplate}
|
|
181
|
-
</mo-flex>
|
|
172
|
+
return html `
|
|
173
|
+
<mo-flex id='selector' direction='horizontal' style='height: 100%'>
|
|
174
|
+
${this.dateTemplate}
|
|
175
|
+
${this.timeTemplate}
|
|
176
|
+
</mo-flex>
|
|
182
177
|
`;
|
|
183
178
|
}
|
|
184
179
|
get dateTemplate() {
|
|
185
|
-
return html `
|
|
186
|
-
${this.yearListTemplate}
|
|
187
|
-
${this.monthListTemplate}
|
|
188
|
-
${this.dayTemplate}
|
|
180
|
+
return html `
|
|
181
|
+
${this.yearListTemplate}
|
|
182
|
+
${this.monthListTemplate}
|
|
183
|
+
${this.dayTemplate}
|
|
189
184
|
`;
|
|
190
185
|
}
|
|
191
186
|
get yearListTemplate() {
|
|
192
|
-
return html `
|
|
193
|
-
<mo-year-list
|
|
194
|
-
.navigatingValue=${this.navigatingDate}
|
|
195
|
-
.value=${this.selectedDate}
|
|
196
|
-
@change=${(e) => this.handleSelectedDateChange(e.detail, FieldDateTimePrecision.Year)}
|
|
197
|
-
></mo-year-list>
|
|
187
|
+
return html `
|
|
188
|
+
<mo-year-list
|
|
189
|
+
.navigatingValue=${this.navigatingDate}
|
|
190
|
+
.value=${this.selectedDate}
|
|
191
|
+
@change=${(e) => this.handleSelectedDateChange(e.detail, FieldDateTimePrecision.Year)}
|
|
192
|
+
></mo-year-list>
|
|
198
193
|
`;
|
|
199
194
|
}
|
|
200
195
|
get monthListTemplate() {
|
|
201
|
-
return [FieldDateTimePrecision.Year].includes(this.precision) ? html.nothing : html `
|
|
202
|
-
<mo-month-list
|
|
203
|
-
.navigatingValue=${this.navigatingDate}
|
|
204
|
-
.value=${this.selectedDate}
|
|
205
|
-
@change=${(e) => this.handleSelectedDateChange(e.detail, FieldDateTimePrecision.Month)}
|
|
206
|
-
></mo-month-list>
|
|
196
|
+
return [FieldDateTimePrecision.Year].includes(this.precision) ? html.nothing : html `
|
|
197
|
+
<mo-month-list
|
|
198
|
+
.navigatingValue=${this.navigatingDate}
|
|
199
|
+
.value=${this.selectedDate}
|
|
200
|
+
@change=${(e) => this.handleSelectedDateChange(e.detail, FieldDateTimePrecision.Month)}
|
|
201
|
+
></mo-month-list>
|
|
207
202
|
`;
|
|
208
203
|
}
|
|
209
204
|
get dayTemplate() {
|
|
210
205
|
return [FieldDateTimePrecision.Year, FieldDateTimePrecision.Month].includes(this.precision) ? html.nothing : this.calendarTemplate;
|
|
211
206
|
}
|
|
212
207
|
get timeTemplate() {
|
|
213
|
-
return [FieldDateTimePrecision.Year, FieldDateTimePrecision.Month, FieldDateTimePrecision.Day].includes(this.precision) ? html.nothing : html `
|
|
214
|
-
<mo-flex gap='6px'>
|
|
215
|
-
<div class='timezone'>
|
|
216
|
-
${this.navigatingDate?.formatToParts({ timeZoneName: 'long' }).find(x => x.type === 'timeZoneName')?.value}
|
|
217
|
-
(${this.navigatingDate?.formatToParts({ timeZoneName: 'shortOffset' }).find(x => x.type === 'timeZoneName')?.value})
|
|
218
|
-
</div>
|
|
219
|
-
<mo-flex direction='horizontal' style='flex: 1'>
|
|
220
|
-
${this.hourListTemplate}
|
|
221
|
-
${this.minuteListTemplate}
|
|
222
|
-
${this.secondListTemplate}
|
|
223
|
-
</mo-flex>
|
|
224
|
-
</mo-flex>
|
|
208
|
+
return [FieldDateTimePrecision.Year, FieldDateTimePrecision.Month, FieldDateTimePrecision.Day].includes(this.precision) ? html.nothing : html `
|
|
209
|
+
<mo-flex gap='6px'>
|
|
210
|
+
<div class='timezone'>
|
|
211
|
+
${this.navigatingDate?.formatToParts({ timeZoneName: 'long' }).find(x => x.type === 'timeZoneName')?.value}
|
|
212
|
+
(${this.navigatingDate?.formatToParts({ timeZoneName: 'shortOffset' }).find(x => x.type === 'timeZoneName')?.value})
|
|
213
|
+
</div>
|
|
214
|
+
<mo-flex direction='horizontal' style='flex: 1'>
|
|
215
|
+
${this.hourListTemplate}
|
|
216
|
+
${this.minuteListTemplate}
|
|
217
|
+
${this.secondListTemplate}
|
|
218
|
+
</mo-flex>
|
|
219
|
+
</mo-flex>
|
|
225
220
|
`;
|
|
226
221
|
}
|
|
227
222
|
get hourListTemplate() {
|
|
228
|
-
return html `
|
|
229
|
-
<mo-hour-list style='flex: 1'
|
|
230
|
-
.navigatingValue=${this.navigatingDate}
|
|
231
|
-
.value=${this.selectedDate}
|
|
232
|
-
@change=${(e) => this.handleSelectedDateChange(e.detail, FieldDateTimePrecision.Hour)}
|
|
233
|
-
></mo-hour-list>
|
|
223
|
+
return html `
|
|
224
|
+
<mo-hour-list style='flex: 1'
|
|
225
|
+
.navigatingValue=${this.navigatingDate}
|
|
226
|
+
.value=${this.selectedDate}
|
|
227
|
+
@change=${(e) => this.handleSelectedDateChange(e.detail, FieldDateTimePrecision.Hour)}
|
|
228
|
+
></mo-hour-list>
|
|
234
229
|
`;
|
|
235
230
|
}
|
|
236
231
|
get minuteListTemplate() {
|
|
237
|
-
return [FieldDateTimePrecision.Hour].includes(this.precision) ? html.nothing : html `
|
|
238
|
-
<mo-minute-list style='flex: 1'
|
|
239
|
-
.navigatingValue=${this.navigatingDate}
|
|
240
|
-
.value=${this.selectedDate}
|
|
241
|
-
@change=${(e) => this.handleSelectedDateChange(e.detail, FieldDateTimePrecision.Minute)}
|
|
242
|
-
></mo-minute-list>
|
|
232
|
+
return [FieldDateTimePrecision.Hour].includes(this.precision) ? html.nothing : html `
|
|
233
|
+
<mo-minute-list style='flex: 1'
|
|
234
|
+
.navigatingValue=${this.navigatingDate}
|
|
235
|
+
.value=${this.selectedDate}
|
|
236
|
+
@change=${(e) => this.handleSelectedDateChange(e.detail, FieldDateTimePrecision.Minute)}
|
|
237
|
+
></mo-minute-list>
|
|
243
238
|
`;
|
|
244
239
|
}
|
|
245
240
|
get secondListTemplate() {
|
|
246
|
-
return [FieldDateTimePrecision.Hour, FieldDateTimePrecision.Minute].includes(this.precision) ? html.nothing : html `
|
|
247
|
-
<mo-second-list style='flex: 1'
|
|
248
|
-
.navigatingValue=${this.navigatingDate}
|
|
249
|
-
.value=${this.selectedDate}
|
|
250
|
-
@change=${(e) => this.handleSelectedDateChange(e.detail, FieldDateTimePrecision.Second)}
|
|
251
|
-
></mo-second-list>
|
|
241
|
+
return [FieldDateTimePrecision.Hour, FieldDateTimePrecision.Minute].includes(this.precision) ? html.nothing : html `
|
|
242
|
+
<mo-second-list style='flex: 1'
|
|
243
|
+
.navigatingValue=${this.navigatingDate}
|
|
244
|
+
.value=${this.selectedDate}
|
|
245
|
+
@change=${(e) => this.handleSelectedDateChange(e.detail, FieldDateTimePrecision.Second)}
|
|
246
|
+
></mo-second-list>
|
|
252
247
|
`;
|
|
253
248
|
}
|
|
254
249
|
handleSelectedDateChange(date, precision) {
|
|
@@ -31,55 +31,55 @@ let FieldDateTimeRange = class FieldDateTimeRange extends FieldDateTimeBase {
|
|
|
31
31
|
get navigatingDate() { return (this.selection === FieldDateRangeSelection.Start ? this.value?.start : this.value?.end) ?? new DateTime(); }
|
|
32
32
|
get selectedDate() { return this.selection === FieldDateRangeSelection.Start ? this.value?.start : this.value?.end; }
|
|
33
33
|
static get styles() {
|
|
34
|
-
return css `
|
|
35
|
-
${super.styles}
|
|
36
|
-
|
|
37
|
-
mo-tab-bar {
|
|
38
|
-
max-width: 200px;
|
|
39
|
-
place-self: center;
|
|
40
|
-
padding-block: 4px;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
mo-tab {
|
|
44
|
-
--mdc-tab-height: 40px;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
mo-tab:not([active]) {
|
|
48
|
-
opacity: 0.5;
|
|
49
|
-
}
|
|
34
|
+
return css `
|
|
35
|
+
${super.styles}
|
|
36
|
+
|
|
37
|
+
mo-tab-bar {
|
|
38
|
+
max-width: 200px;
|
|
39
|
+
place-self: center;
|
|
40
|
+
padding-block: 4px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
mo-tab {
|
|
44
|
+
--mdc-tab-height: 40px;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
mo-tab:not([active]) {
|
|
48
|
+
opacity: 0.5;
|
|
49
|
+
}
|
|
50
50
|
`;
|
|
51
51
|
}
|
|
52
52
|
get placeholder() {
|
|
53
53
|
return new DateTimeRange(new DateTime().subtract({ years: 1 }), new DateTime()).format(this.formatOptions);
|
|
54
54
|
}
|
|
55
55
|
get calendarTemplate() {
|
|
56
|
-
return html `
|
|
57
|
-
<mo-selectable-range-calendar
|
|
58
|
-
.navigatingValue=${this.navigatingDate}
|
|
59
|
-
.dateRange=${this.value}
|
|
60
|
-
@change=${(e) => this.handleSelectedDateChange(e.detail, FieldDateTimePrecision.Day)}
|
|
61
|
-
></mo-selectable-range-calendar>
|
|
56
|
+
return html `
|
|
57
|
+
<mo-selectable-range-calendar
|
|
58
|
+
.navigatingValue=${this.navigatingDate}
|
|
59
|
+
.dateRange=${this.value}
|
|
60
|
+
@change=${(e) => this.handleSelectedDateChange(e.detail, FieldDateTimePrecision.Day)}
|
|
61
|
+
></mo-selectable-range-calendar>
|
|
62
62
|
`;
|
|
63
63
|
}
|
|
64
64
|
get popoverContentTemplate() {
|
|
65
|
-
return html `
|
|
66
|
-
${this.popoverToolbarTemplate}
|
|
67
|
-
${super.popoverContentTemplate}
|
|
65
|
+
return html `
|
|
66
|
+
${this.popoverToolbarTemplate}
|
|
67
|
+
${super.popoverContentTemplate}
|
|
68
68
|
`;
|
|
69
69
|
}
|
|
70
70
|
get popoverToolbarTemplate() {
|
|
71
|
-
return html `
|
|
72
|
-
${this.startEndTabBarTemplate}
|
|
71
|
+
return html `
|
|
72
|
+
${this.startEndTabBarTemplate}
|
|
73
73
|
`;
|
|
74
74
|
}
|
|
75
75
|
get startEndTabBarTemplate() {
|
|
76
|
-
return html `
|
|
77
|
-
<mo-flex>
|
|
78
|
-
<mo-tab-bar ${bind(this, 'selection')}>
|
|
79
|
-
<mo-tab value=${FieldDateRangeSelection.Start}>${t('Start')}</mo-tab>
|
|
80
|
-
<mo-tab value=${FieldDateRangeSelection.End}>${t('End')}</mo-tab>
|
|
81
|
-
</mo-tab-bar>
|
|
82
|
-
</mo-flex>
|
|
76
|
+
return html `
|
|
77
|
+
<mo-flex>
|
|
78
|
+
<mo-tab-bar ${bind(this, 'selection')}>
|
|
79
|
+
<mo-tab value=${FieldDateRangeSelection.Start}>${t('Start')}</mo-tab>
|
|
80
|
+
<mo-tab value=${FieldDateRangeSelection.End}>${t('End')}</mo-tab>
|
|
81
|
+
</mo-tab-bar>
|
|
82
|
+
</mo-flex>
|
|
83
83
|
`;
|
|
84
84
|
}
|
|
85
85
|
handleSelectedDateChange(date, precision) {
|
package/dist/FieldTime.js
CHANGED
|
@@ -7,9 +7,9 @@ let FieldTime = class FieldTime extends FieldText {
|
|
|
7
7
|
return 'time';
|
|
8
8
|
}
|
|
9
9
|
get startSlotTemplate() {
|
|
10
|
-
return html `
|
|
11
|
-
<mo-icon slot='start' @click=${() => this.focus()} icon='schedule' ${style({ color: 'var(--mo-color-gray)' })}></mo-icon>
|
|
12
|
-
${super.startSlotTemplate}
|
|
10
|
+
return html `
|
|
11
|
+
<mo-icon slot='start' @click=${() => this.focus()} icon='schedule' ${style({ color: 'var(--mo-color-gray)' })}></mo-icon>
|
|
12
|
+
${super.startSlotTemplate}
|
|
13
13
|
`;
|
|
14
14
|
}
|
|
15
15
|
};
|
|
@@ -19,16 +19,16 @@ let FieldToggleableDateTimeRange = class FieldToggleableDateTimeRange extends Fi
|
|
|
19
19
|
get includeTime() { return this.precision === FieldDateTimePrecision.Minute; }
|
|
20
20
|
set includeTime(includeTime) { this.precision = includeTime ? FieldDateTimePrecision.Minute : FieldDateTimePrecision.Day; }
|
|
21
21
|
get popoverToolbarTemplate() {
|
|
22
|
-
return html `
|
|
23
|
-
<mo-grid style='width: calc(100% - 16px); padding-inline: 8px;' columns='* auto'>
|
|
24
|
-
${super.popoverToolbarTemplate}
|
|
25
|
-
${this.toggleTemplate}
|
|
26
|
-
</mo-grid>
|
|
22
|
+
return html `
|
|
23
|
+
<mo-grid style='width: calc(100% - 16px); padding-inline: 8px;' columns='* auto'>
|
|
24
|
+
${super.popoverToolbarTemplate}
|
|
25
|
+
${this.toggleTemplate}
|
|
26
|
+
</mo-grid>
|
|
27
27
|
`;
|
|
28
28
|
}
|
|
29
29
|
get toggleTemplate() {
|
|
30
|
-
return html `
|
|
31
|
-
<mo-switch label=${t('Include time')} ${bind(this, 'includeTime')}></mo-switch>
|
|
30
|
+
return html `
|
|
31
|
+
<mo-switch label=${t('Include time')} ${bind(this, 'includeTime')}></mo-switch>
|
|
32
32
|
`;
|
|
33
33
|
}
|
|
34
34
|
};
|