@3mo/date-time-fields 0.14.0 → 0.14.2
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/FieldDate.d.ts +0 -3
- package/dist/FieldDate.d.ts.map +1 -1
- package/dist/FieldDate.js +0 -7
- package/dist/FieldDateTime.d.ts +6 -1
- package/dist/FieldDateTime.d.ts.map +1 -1
- package/dist/FieldDateTime.js +19 -7
- package/dist/FieldDateTimeBase.js +140 -140
- package/dist/FieldDateTimeRange.d.ts +1 -1
- package/dist/FieldDateTimeRange.d.ts.map +1 -1
- package/dist/FieldDateTimeRange.js +3 -4
- package/dist/custom-elements.json +14 -14
- package/dist/selection/Calendar.js +245 -245
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +49 -49
package/dist/FieldDate.d.ts
CHANGED
|
@@ -2,12 +2,9 @@ import { FieldDateTime } from './FieldDateTime.js';
|
|
|
2
2
|
import { FieldDateTimePrecision } from './FieldDateTimePrecision.js';
|
|
3
3
|
/**
|
|
4
4
|
* @element mo-field-date
|
|
5
|
-
*
|
|
6
|
-
* @i18n "Date"
|
|
7
5
|
*/
|
|
8
6
|
export declare class FieldDate extends FieldDateTime {
|
|
9
7
|
precision: FieldDateTimePrecision;
|
|
10
|
-
label: string;
|
|
11
8
|
}
|
|
12
9
|
declare global {
|
|
13
10
|
interface HTMLElementTagNameMap {
|
package/dist/FieldDate.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldDate.d.ts","sourceRoot":"","sources":["../FieldDate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FieldDate.d.ts","sourceRoot":"","sources":["../FieldDate.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAEpE;;GAEG;AACH,qBACa,SAAU,SAAQ,aAAa;IAClC,SAAS,yBAA6B;CAC/C;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,eAAe,EAAE,aAAa,CAAA;KAC9B;CACD"}
|
package/dist/FieldDate.js
CHANGED
|
@@ -1,21 +1,14 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { component } from '@a11d/lit';
|
|
3
|
-
import { Localizer } from '@3mo/localization';
|
|
4
3
|
import { FieldDateTime } from './FieldDateTime.js';
|
|
5
4
|
import { FieldDateTimePrecision } from './FieldDateTimePrecision.js';
|
|
6
|
-
Localizer.dictionaries.add('de', {
|
|
7
|
-
'Date': 'Datum',
|
|
8
|
-
});
|
|
9
5
|
/**
|
|
10
6
|
* @element mo-field-date
|
|
11
|
-
*
|
|
12
|
-
* @i18n "Date"
|
|
13
7
|
*/
|
|
14
8
|
let FieldDate = class FieldDate extends FieldDateTime {
|
|
15
9
|
constructor() {
|
|
16
10
|
super(...arguments);
|
|
17
11
|
this.precision = FieldDateTimePrecision.Day;
|
|
18
|
-
this.label = t('Date');
|
|
19
12
|
}
|
|
20
13
|
};
|
|
21
14
|
FieldDate = __decorate([
|
package/dist/FieldDateTime.d.ts
CHANGED
|
@@ -5,6 +5,10 @@ import { FieldDateTimePrecision } from './FieldDateTimePrecision.js';
|
|
|
5
5
|
* @element mo-field-date-time
|
|
6
6
|
*
|
|
7
7
|
* @i18n "Date & Time"
|
|
8
|
+
* @i18n "Date"
|
|
9
|
+
* @i18n "Year"
|
|
10
|
+
* @i18n "Month"
|
|
11
|
+
* @i18n "Week"
|
|
8
12
|
* @i18n "Today"
|
|
9
13
|
* @i18n "Yesterday"
|
|
10
14
|
* @i18n "Tomorrow"
|
|
@@ -17,7 +21,8 @@ import { FieldDateTimePrecision } from './FieldDateTimePrecision.js';
|
|
|
17
21
|
*/
|
|
18
22
|
export declare class FieldDateTime extends FieldDateTimeBase<Date | undefined> {
|
|
19
23
|
protected get selectedDate(): import("@3mo/date-time/DateTime.js").DateTime | undefined;
|
|
20
|
-
|
|
24
|
+
protected get _label(): string;
|
|
25
|
+
private get defaultLabel();
|
|
21
26
|
value?: Date;
|
|
22
27
|
protected get placeholder(): string;
|
|
23
28
|
protected resetNavigationDate(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldDateTime.d.ts","sourceRoot":"","sources":["../FieldDateTime.ts"],"names":[],"mappings":"AACA,OAAO,EAAmC,KAAK,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAEpF,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":"AACA,OAAO,EAAmC,KAAK,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAEpF,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAmBpE;;;;;;;;;;;;;;;;;GAiBG;AACH,qBACa,aAAc,SAAQ,iBAAiB,CAAC,IAAI,GAAG,SAAS,CAAC;IACrE,SAAS,KAAK,YAAY,8DAQzB;IAED,cAAuB,MAAM,WAE5B;IAED,OAAO,KAAK,YAAY,GAQvB;IAE2B,KAAK,CAAC,EAAE,IAAI,CAAA;IAExC,cACuB,WAAW,WAEjC;IAED,SAAS,CAAC,mBAAmB;IAI7B,SAAS,KAAK,aAAa,4DAE1B;IAED,cAAuB,eAAe,IAcoB,kBAAkB,CAC3E;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
|
@@ -6,6 +6,9 @@ import { FieldDateTimePrecision } from './FieldDateTimePrecision.js';
|
|
|
6
6
|
import { Memoize as memoize } from 'typescript-memoize';
|
|
7
7
|
Localizer.dictionaries.add('de', {
|
|
8
8
|
'Date & Time': 'Datum & Uhrzeit',
|
|
9
|
+
'Date': 'Datum',
|
|
10
|
+
'Year': 'Jahr',
|
|
11
|
+
'Month': 'Monat',
|
|
9
12
|
'Today': 'Heute',
|
|
10
13
|
'Yesterday': 'Gestern',
|
|
11
14
|
'Tomorrow': 'Morgen',
|
|
@@ -20,6 +23,10 @@ Localizer.dictionaries.add('de', {
|
|
|
20
23
|
* @element mo-field-date-time
|
|
21
24
|
*
|
|
22
25
|
* @i18n "Date & Time"
|
|
26
|
+
* @i18n "Date"
|
|
27
|
+
* @i18n "Year"
|
|
28
|
+
* @i18n "Month"
|
|
29
|
+
* @i18n "Week"
|
|
23
30
|
* @i18n "Today"
|
|
24
31
|
* @i18n "Yesterday"
|
|
25
32
|
* @i18n "Tomorrow"
|
|
@@ -31,10 +38,6 @@ Localizer.dictionaries.add('de', {
|
|
|
31
38
|
* @i18n "Year end"
|
|
32
39
|
*/
|
|
33
40
|
let FieldDateTime = class FieldDateTime extends FieldDateTimeBase {
|
|
34
|
-
constructor() {
|
|
35
|
-
super(...arguments);
|
|
36
|
-
this.label = t('Date & Time');
|
|
37
|
-
}
|
|
38
41
|
get selectedDate() {
|
|
39
42
|
if (!this.value) {
|
|
40
43
|
return undefined;
|
|
@@ -44,6 +47,18 @@ let FieldDateTime = class FieldDateTime extends FieldDateTimeBase {
|
|
|
44
47
|
}
|
|
45
48
|
return this.value;
|
|
46
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
|
+
}
|
|
47
62
|
get placeholder() {
|
|
48
63
|
return new DateTime().format(this.formatOptions);
|
|
49
64
|
}
|
|
@@ -82,9 +97,6 @@ let FieldDateTime = class FieldDateTime extends FieldDateTimeBase {
|
|
|
82
97
|
return value ? DateTime.parseAsDateTime(value, this.shortcutReferenceDate) : undefined;
|
|
83
98
|
}
|
|
84
99
|
};
|
|
85
|
-
__decorate([
|
|
86
|
-
property()
|
|
87
|
-
], FieldDateTime.prototype, "label", void 0);
|
|
88
100
|
__decorate([
|
|
89
101
|
property({ type: Object })
|
|
90
102
|
], FieldDateTime.prototype, "value", void 0);
|
|
@@ -63,86 +63,86 @@ export class FieldDateTimeBase extends InputFieldComponent {
|
|
|
63
63
|
return '';
|
|
64
64
|
}
|
|
65
65
|
static get styles() {
|
|
66
|
-
return css `
|
|
67
|
-
${super.styles}
|
|
68
|
-
|
|
69
|
-
:host {
|
|
70
|
-
position: relative;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
:host([disabled]) {
|
|
74
|
-
pointer-events: none;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
mo-field {
|
|
78
|
-
anchor-name: --mo-field-date-time;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
mo-popover {
|
|
82
|
-
position-anchor: --mo-field-date-time;
|
|
83
|
-
position-visibility: anchors-visible;
|
|
84
|
-
background: var(--mo-color-background);
|
|
85
|
-
box-shadow: var(--mo-shadow);
|
|
86
|
-
border-radius: var(--mo-border-radius);
|
|
87
|
-
color: var(--mo-color-foreground);
|
|
88
|
-
font-size: 0.875em;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
#selector {
|
|
92
|
-
min-height: 175px;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
.timezone {
|
|
96
|
-
padding: 0.4rem;
|
|
97
|
-
font-size: small;
|
|
98
|
-
text-align: center;
|
|
99
|
-
font-weight: 500;
|
|
100
|
-
color: var(--mo-color-gray);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
input::placeholder {
|
|
104
|
-
color: transparent;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
mo-field[active]:not([dense]) input::placeholder {
|
|
108
|
-
color: var(--mo-color-gray);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
#presets {
|
|
112
|
-
background-color: var(--mo-color-transparent-gray-1);
|
|
113
|
-
mo-list-item {
|
|
114
|
-
padding-block: 0.5rem;
|
|
115
|
-
min-height: auto;
|
|
116
|
-
opacity: 0.9;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
66
|
+
return css `
|
|
67
|
+
${super.styles}
|
|
68
|
+
|
|
69
|
+
:host {
|
|
70
|
+
position: relative;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
:host([disabled]) {
|
|
74
|
+
pointer-events: none;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
mo-field {
|
|
78
|
+
anchor-name: --mo-field-date-time;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
mo-popover {
|
|
82
|
+
position-anchor: --mo-field-date-time;
|
|
83
|
+
position-visibility: anchors-visible;
|
|
84
|
+
background: var(--mo-color-background);
|
|
85
|
+
box-shadow: var(--mo-shadow);
|
|
86
|
+
border-radius: var(--mo-border-radius);
|
|
87
|
+
color: var(--mo-color-foreground);
|
|
88
|
+
font-size: 0.875em;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
#selector {
|
|
92
|
+
min-height: 175px;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.timezone {
|
|
96
|
+
padding: 0.4rem;
|
|
97
|
+
font-size: small;
|
|
98
|
+
text-align: center;
|
|
99
|
+
font-weight: 500;
|
|
100
|
+
color: var(--mo-color-gray);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
input::placeholder {
|
|
104
|
+
color: transparent;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
mo-field[active]:not([dense]) input::placeholder {
|
|
108
|
+
color: var(--mo-color-gray);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
#presets {
|
|
112
|
+
background-color: var(--mo-color-transparent-gray-1);
|
|
113
|
+
mo-list-item {
|
|
114
|
+
padding-block: 0.5rem;
|
|
115
|
+
min-height: auto;
|
|
116
|
+
opacity: 0.9;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
119
|
`;
|
|
120
120
|
}
|
|
121
121
|
get template() {
|
|
122
|
-
return html `
|
|
123
|
-
${super.template}
|
|
124
|
-
${this.popoverTemplate}
|
|
122
|
+
return html `
|
|
123
|
+
${super.template}
|
|
124
|
+
${this.popoverTemplate}
|
|
125
125
|
`;
|
|
126
126
|
}
|
|
127
127
|
get endSlotTemplate() {
|
|
128
|
-
return html `
|
|
129
|
-
${super.endSlotTemplate}
|
|
130
|
-
${this.clearIconButtonTemplate}
|
|
131
|
-
${this.calendarIconButtonTemplate}
|
|
128
|
+
return html `
|
|
129
|
+
${super.endSlotTemplate}
|
|
130
|
+
${this.clearIconButtonTemplate}
|
|
131
|
+
${this.calendarIconButtonTemplate}
|
|
132
132
|
`;
|
|
133
133
|
}
|
|
134
134
|
get inputTemplate() {
|
|
135
|
-
return html `
|
|
136
|
-
<input
|
|
137
|
-
part='input'
|
|
138
|
-
?readonly=${this.readonly}
|
|
139
|
-
?required=${this.required}
|
|
140
|
-
?disabled=${this.disabled}
|
|
141
|
-
placeholder=${this.placeholder}
|
|
142
|
-
.value=${live(this.inputStringValue || '')}
|
|
143
|
-
@input=${(e) => this.handleInput(this.inputValueToValue(this.inputElement.value || ''), e)}
|
|
144
|
-
@change=${(e) => this.handleChange(this.inputValueToValue(this.inputElement.value || ''), e)}
|
|
145
|
-
>
|
|
135
|
+
return html `
|
|
136
|
+
<input
|
|
137
|
+
part='input'
|
|
138
|
+
?readonly=${this.readonly}
|
|
139
|
+
?required=${this.required}
|
|
140
|
+
?disabled=${this.disabled}
|
|
141
|
+
placeholder=${this.placeholder}
|
|
142
|
+
.value=${live(this.inputStringValue || '')}
|
|
143
|
+
@input=${(e) => this.handleInput(this.inputValueToValue(this.inputElement.value || ''), e)}
|
|
144
|
+
@change=${(e) => this.handleChange(this.inputValueToValue(this.inputElement.value || ''), e)}
|
|
145
|
+
>
|
|
146
146
|
`;
|
|
147
147
|
}
|
|
148
148
|
get clearIconButtonTemplate() {
|
|
@@ -151,46 +151,46 @@ export class FieldDateTimeBase extends InputFieldComponent {
|
|
|
151
151
|
this.handleInput(undefined);
|
|
152
152
|
this.handleChange(undefined);
|
|
153
153
|
};
|
|
154
|
-
return !this.value || !this.focusController.focused ? html.nothing : html `
|
|
155
|
-
<mo-icon-button tabindex='-1' dense slot='end' icon='cancel'
|
|
156
|
-
@click=${clear}
|
|
157
|
-
${style({ color: 'var(--mo-color-gray)', fontSize: '20px', cursor: 'pointer', userSelect: 'none', marginBlockStart: '2.75px', marginInlineEnd: '5px' })}
|
|
158
|
-
></mo-icon-button>
|
|
154
|
+
return !this.value || !this.focusController.focused ? html.nothing : html `
|
|
155
|
+
<mo-icon-button tabindex='-1' dense slot='end' icon='cancel'
|
|
156
|
+
@click=${clear}
|
|
157
|
+
${style({ color: 'var(--mo-color-gray)', fontSize: '20px', cursor: 'pointer', userSelect: 'none', marginBlockStart: '2.75px', marginInlineEnd: '5px' })}
|
|
158
|
+
></mo-icon-button>
|
|
159
159
|
`;
|
|
160
160
|
}
|
|
161
161
|
get calendarIconButtonTemplate() {
|
|
162
|
-
return this.pickerHidden ? html.nothing : html `
|
|
163
|
-
<mo-icon tabindex='-1' slot='end'
|
|
164
|
-
icon=${this.calendarIconButtonIcon}
|
|
165
|
-
${style({ color: this.isActive ? 'var(--mo-color-accent)' : 'var(--mo-color-gray)', fontSize: '22px', marginBlockStart: '2px', cursor: 'pointer', userSelect: 'none' })}
|
|
166
|
-
></mo-icon>
|
|
162
|
+
return this.pickerHidden ? html.nothing : html `
|
|
163
|
+
<mo-icon tabindex='-1' slot='end'
|
|
164
|
+
icon=${this.calendarIconButtonIcon}
|
|
165
|
+
${style({ color: this.isActive ? 'var(--mo-color-accent)' : 'var(--mo-color-gray)', fontSize: '22px', marginBlockStart: '2px', cursor: 'pointer', userSelect: 'none' })}
|
|
166
|
+
></mo-icon>
|
|
167
167
|
`;
|
|
168
168
|
}
|
|
169
169
|
get popoverTemplate() {
|
|
170
|
-
return this.pickerHidden ? html.nothing : html `
|
|
171
|
-
<mo-popover tabindex='-1'
|
|
172
|
-
.anchor=${this} target='field'
|
|
173
|
-
?open=${bind(this, 'open', { sourceUpdated: () => setTimeout(() => this.calendar?.setNavigatingValue(this.navigationDate)) })}
|
|
174
|
-
>
|
|
175
|
-
${cache(!this.open ? html.nothing : html `
|
|
176
|
-
<mo-flex direction='horizontal'>
|
|
177
|
-
${this.presetsTemplate === html.nothing ? html.nothing : html `
|
|
178
|
-
<mo-flex id='presets'>
|
|
179
|
-
${this.presetsTemplate}
|
|
180
|
-
</mo-flex>
|
|
181
|
-
`}
|
|
182
|
-
${this.popoverSelectionTemplate}
|
|
183
|
-
</mo-flex>
|
|
184
|
-
`)}
|
|
185
|
-
</mo-popover>
|
|
170
|
+
return this.pickerHidden ? html.nothing : html `
|
|
171
|
+
<mo-popover tabindex='-1'
|
|
172
|
+
.anchor=${this} target='field'
|
|
173
|
+
?open=${bind(this, 'open', { sourceUpdated: () => setTimeout(() => this.calendar?.setNavigatingValue(this.navigationDate)) })}
|
|
174
|
+
>
|
|
175
|
+
${cache(!this.open ? html.nothing : html `
|
|
176
|
+
<mo-flex direction='horizontal'>
|
|
177
|
+
${this.presetsTemplate === html.nothing ? html.nothing : html `
|
|
178
|
+
<mo-flex id='presets'>
|
|
179
|
+
${this.presetsTemplate}
|
|
180
|
+
</mo-flex>
|
|
181
|
+
`}
|
|
182
|
+
${this.popoverSelectionTemplate}
|
|
183
|
+
</mo-flex>
|
|
184
|
+
`)}
|
|
185
|
+
</mo-popover>
|
|
186
186
|
`;
|
|
187
187
|
}
|
|
188
188
|
get popoverSelectionTemplate() {
|
|
189
|
-
return html `
|
|
190
|
-
<mo-flex id='selector' direction='horizontal' style='height: 100%; flex: 1'>
|
|
191
|
-
${this.dateTemplate}
|
|
192
|
-
${this.timeTemplate}
|
|
193
|
-
</mo-flex>
|
|
189
|
+
return html `
|
|
190
|
+
<mo-flex id='selector' direction='horizontal' style='height: 100%; flex: 1'>
|
|
191
|
+
${this.dateTemplate}
|
|
192
|
+
${this.timeTemplate}
|
|
193
|
+
</mo-flex>
|
|
194
194
|
`;
|
|
195
195
|
}
|
|
196
196
|
getPresetTemplate(label, value) {
|
|
@@ -217,56 +217,56 @@ export class FieldDateTimeBase extends InputFieldComponent {
|
|
|
217
217
|
return this.calendarTemplate;
|
|
218
218
|
}
|
|
219
219
|
get calendarTemplate() {
|
|
220
|
-
return html `
|
|
221
|
-
<mo-calendar
|
|
222
|
-
.precision=${this.precision > FieldDateTimePrecision.Day ? FieldDateTimePrecision.Day : this.precision}
|
|
223
|
-
.value=${this.calendarValue}
|
|
224
|
-
.min=${this.min}
|
|
225
|
-
.max=${this.max}
|
|
226
|
-
.dateDisabled=${this.dateDisabled}
|
|
227
|
-
@dateClick=${(e) => this.handleSelectedDateChange(e.detail, this.precision)}
|
|
228
|
-
></mo-calendar>
|
|
220
|
+
return html `
|
|
221
|
+
<mo-calendar
|
|
222
|
+
.precision=${this.precision > FieldDateTimePrecision.Day ? FieldDateTimePrecision.Day : this.precision}
|
|
223
|
+
.value=${this.calendarValue}
|
|
224
|
+
.min=${this.min}
|
|
225
|
+
.max=${this.max}
|
|
226
|
+
.dateDisabled=${this.dateDisabled}
|
|
227
|
+
@dateClick=${(e) => this.handleSelectedDateChange(e.detail, this.precision)}
|
|
228
|
+
></mo-calendar>
|
|
229
229
|
`;
|
|
230
230
|
}
|
|
231
231
|
get timeTemplate() {
|
|
232
|
-
return this.precision <= FieldDateTimePrecision.Day ? html.nothing : html `
|
|
233
|
-
<mo-flex gap='0.5rem' style='border-inline-start: 1px solid var(--mo-color-transparent-gray-3)'>
|
|
234
|
-
<mo-flex direction='horizontal' style='flex: 1'>
|
|
235
|
-
${this.hourListTemplate}
|
|
236
|
-
${this.minuteListTemplate}
|
|
237
|
-
${this.secondListTemplate}
|
|
238
|
-
</mo-flex>
|
|
239
|
-
<div class='timezone' title=${ifDefined(this.navigationDate?.formatToParts({ timeZoneName: 'long' }).find(x => x.type === 'timeZoneName')?.value)}>
|
|
240
|
-
${this.navigationDate?.formatToParts({ timeZoneName: 'shortOffset' }).find(x => x.type === 'timeZoneName')?.value}
|
|
241
|
-
</div>
|
|
242
|
-
</mo-flex>
|
|
232
|
+
return this.precision <= FieldDateTimePrecision.Day ? html.nothing : html `
|
|
233
|
+
<mo-flex gap='0.5rem' style='border-inline-start: 1px solid var(--mo-color-transparent-gray-3)'>
|
|
234
|
+
<mo-flex direction='horizontal' style='flex: 1'>
|
|
235
|
+
${this.hourListTemplate}
|
|
236
|
+
${this.minuteListTemplate}
|
|
237
|
+
${this.secondListTemplate}
|
|
238
|
+
</mo-flex>
|
|
239
|
+
<div class='timezone' title=${ifDefined(this.navigationDate?.formatToParts({ timeZoneName: 'long' }).find(x => x.type === 'timeZoneName')?.value)}>
|
|
240
|
+
${this.navigationDate?.formatToParts({ timeZoneName: 'shortOffset' }).find(x => x.type === 'timeZoneName')?.value}
|
|
241
|
+
</div>
|
|
242
|
+
</mo-flex>
|
|
243
243
|
`;
|
|
244
244
|
}
|
|
245
245
|
get hourListTemplate() {
|
|
246
|
-
return this.precision < FieldDateTimePrecision.Hour ? html.nothing : html `
|
|
247
|
-
<mo-hour-list style='flex: 1'
|
|
248
|
-
.navigationDate=${bind(this, 'navigationDate')}
|
|
249
|
-
.value=${this.selectedDate}
|
|
250
|
-
@change=${(e) => this.handleSelectedDateChange(e.detail, FieldDateTimePrecision.Hour)}
|
|
251
|
-
></mo-hour-list>
|
|
246
|
+
return this.precision < FieldDateTimePrecision.Hour ? html.nothing : html `
|
|
247
|
+
<mo-hour-list style='flex: 1'
|
|
248
|
+
.navigationDate=${bind(this, 'navigationDate')}
|
|
249
|
+
.value=${this.selectedDate}
|
|
250
|
+
@change=${(e) => this.handleSelectedDateChange(e.detail, FieldDateTimePrecision.Hour)}
|
|
251
|
+
></mo-hour-list>
|
|
252
252
|
`;
|
|
253
253
|
}
|
|
254
254
|
get minuteListTemplate() {
|
|
255
|
-
return this.precision < FieldDateTimePrecision.Minute ? html.nothing : html `
|
|
256
|
-
<mo-minute-list style='flex: 1'
|
|
257
|
-
.navigationDate=${bind(this, 'navigationDate')}
|
|
258
|
-
.value=${this.selectedDate}
|
|
259
|
-
@change=${(e) => this.handleSelectedDateChange(e.detail, FieldDateTimePrecision.Minute)}
|
|
260
|
-
></mo-minute-list>
|
|
255
|
+
return this.precision < FieldDateTimePrecision.Minute ? html.nothing : html `
|
|
256
|
+
<mo-minute-list style='flex: 1'
|
|
257
|
+
.navigationDate=${bind(this, 'navigationDate')}
|
|
258
|
+
.value=${this.selectedDate}
|
|
259
|
+
@change=${(e) => this.handleSelectedDateChange(e.detail, FieldDateTimePrecision.Minute)}
|
|
260
|
+
></mo-minute-list>
|
|
261
261
|
`;
|
|
262
262
|
}
|
|
263
263
|
get secondListTemplate() {
|
|
264
|
-
return this.precision < FieldDateTimePrecision.Second ? html.nothing : html `
|
|
265
|
-
<mo-second-list style='flex: 1'
|
|
266
|
-
.navigationDate=${bind(this, 'navigationDate')}
|
|
267
|
-
.value=${this.selectedDate}
|
|
268
|
-
@change=${(e) => this.handleSelectedDateChange(e.detail, FieldDateTimePrecision.Second)}
|
|
269
|
-
></mo-second-list>
|
|
264
|
+
return this.precision < FieldDateTimePrecision.Second ? html.nothing : html `
|
|
265
|
+
<mo-second-list style='flex: 1'
|
|
266
|
+
.navigationDate=${bind(this, 'navigationDate')}
|
|
267
|
+
.value=${this.selectedDate}
|
|
268
|
+
@change=${(e) => this.handleSelectedDateChange(e.detail, FieldDateTimePrecision.Second)}
|
|
269
|
+
></mo-second-list>
|
|
270
270
|
`;
|
|
271
271
|
}
|
|
272
272
|
handleSelectedDateChange(date, precision) {
|
|
@@ -28,10 +28,10 @@ declare enum FieldDateRangeSelection {
|
|
|
28
28
|
*/
|
|
29
29
|
export declare class FieldDateTimeRange extends FieldDateTimeBase<DateTimeRange | undefined> {
|
|
30
30
|
protected get selectedDate(): import("@3mo/date-time/DateTime.js").DateTime | undefined;
|
|
31
|
-
label: string;
|
|
32
31
|
selection: FieldDateRangeSelection;
|
|
33
32
|
value?: DateTimeRange;
|
|
34
33
|
protected resetNavigationDate(): void;
|
|
34
|
+
protected get _label(): string;
|
|
35
35
|
protected get presetsTemplate(): HTMLTemplateResult;
|
|
36
36
|
static get styles(): import("@a11d/lit").CSSResult;
|
|
37
37
|
protected calendarIconButtonIcon: MaterialIcon;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldDateTimeRange.d.ts","sourceRoot":"","sources":["../FieldDateTimeRange.ts"],"names":[],"mappings":"AACA,OAAO,EAA8C,KAAK,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAC/F,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;AAmBpE,aAAK,uBAAuB;IAC3B,KAAK,UAAU;IACf,GAAG,QAAQ;CACX;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBACa,kBAAmB,SAAQ,iBAAiB,CAAC,aAAa,GAAG,SAAS,CAAC;IACnF,SAAS,KAAK,YAAY,8DAAoG;
|
|
1
|
+
{"version":3,"file":"FieldDateTimeRange.d.ts","sourceRoot":"","sources":["../FieldDateTimeRange.ts"],"names":[],"mappings":"AACA,OAAO,EAA8C,KAAK,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAC/F,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;AAmBpE,aAAK,uBAAuB;IAC3B,KAAK,UAAU;IACf,GAAG,QAAQ;CACX;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBACa,kBAAmB,SAAQ,iBAAiB,CAAC,aAAa,GAAG,SAAS,CAAC;IACnF,SAAS,KAAK,YAAY,8DAAoG;IAElH,SAAS,0BAAgC;IACzB,KAAK,CAAC,EAAE,aAAa,CAAA;IAEjD,SAAS,CAAC,mBAAmB;IAM7B,cAAuB,MAAM,WAE5B;IAED,cAAuB,eAAe,IAoBuB,kBAAkB,CAC9E;IAED,WAAoB,MAAM,kCAezB;IAED,UAAmB,sBAAsB,EAAE,YAAY,CAAe;IAEtE,cACuB,WAAW,WAEjC;IAED,SAAS,KAAK,aAAa,wEAE1B;IAED,cAAuB,wBAAwB,uBAO9C;IAED,SAAS,KAAK,sBAAsB,uBAInC;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"}
|
|
@@ -48,7 +48,6 @@ var FieldDateRangeSelection;
|
|
|
48
48
|
let FieldDateTimeRange = class FieldDateTimeRange extends FieldDateTimeBase {
|
|
49
49
|
constructor() {
|
|
50
50
|
super(...arguments);
|
|
51
|
-
this.label = t('Period');
|
|
52
51
|
this.selection = FieldDateRangeSelection.Start;
|
|
53
52
|
this.calendarIconButtonIcon = 'date_range';
|
|
54
53
|
}
|
|
@@ -58,6 +57,9 @@ let FieldDateTimeRange = class FieldDateTimeRange extends FieldDateTimeBase {
|
|
|
58
57
|
? this.value?.start ?? this.navigationDate
|
|
59
58
|
: this.value?.end ?? this.navigationDate;
|
|
60
59
|
}
|
|
60
|
+
get _label() {
|
|
61
|
+
return super._label || t('Period');
|
|
62
|
+
}
|
|
61
63
|
get presetsTemplate() {
|
|
62
64
|
return join([
|
|
63
65
|
this.precision < FieldDateTimePrecision.Day ? undefined : html `
|
|
@@ -146,9 +148,6 @@ let FieldDateTimeRange = class FieldDateTimeRange extends FieldDateTimeBase {
|
|
|
146
148
|
return value ? DateRangeParser.parse(value, this.shortcutReferenceDate) : undefined;
|
|
147
149
|
}
|
|
148
150
|
};
|
|
149
|
-
__decorate([
|
|
150
|
-
property()
|
|
151
|
-
], FieldDateTimeRange.prototype, "label", void 0);
|
|
152
151
|
__decorate([
|
|
153
152
|
property()
|
|
154
153
|
], FieldDateTimeRange.prototype, "selection", void 0);
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"name": "label",
|
|
66
66
|
"description": "The field's label",
|
|
67
67
|
"type": "string",
|
|
68
|
-
"default": "\"
|
|
68
|
+
"default": "\"\""
|
|
69
69
|
},
|
|
70
70
|
{
|
|
71
71
|
"name": "readonly",
|
|
@@ -183,7 +183,7 @@
|
|
|
183
183
|
"attribute": "label",
|
|
184
184
|
"description": "The field's label",
|
|
185
185
|
"type": "string",
|
|
186
|
-
"default": "\"
|
|
186
|
+
"default": "\"\""
|
|
187
187
|
},
|
|
188
188
|
{
|
|
189
189
|
"name": "readonly",
|
|
@@ -316,7 +316,7 @@
|
|
|
316
316
|
"name": "label",
|
|
317
317
|
"description": "The field's label",
|
|
318
318
|
"type": "string",
|
|
319
|
-
"default": "\"
|
|
319
|
+
"default": "\"\""
|
|
320
320
|
},
|
|
321
321
|
{
|
|
322
322
|
"name": "readonly",
|
|
@@ -441,7 +441,7 @@
|
|
|
441
441
|
"attribute": "label",
|
|
442
442
|
"description": "The field's label",
|
|
443
443
|
"type": "string",
|
|
444
|
-
"default": "\"
|
|
444
|
+
"default": "\"\""
|
|
445
445
|
},
|
|
446
446
|
{
|
|
447
447
|
"name": "readonly",
|
|
@@ -574,7 +574,7 @@
|
|
|
574
574
|
"name": "label",
|
|
575
575
|
"description": "The field's label",
|
|
576
576
|
"type": "string",
|
|
577
|
-
"default": "\"
|
|
577
|
+
"default": "\"\""
|
|
578
578
|
},
|
|
579
579
|
{
|
|
580
580
|
"name": "readonly",
|
|
@@ -699,7 +699,7 @@
|
|
|
699
699
|
"attribute": "label",
|
|
700
700
|
"description": "The field's label",
|
|
701
701
|
"type": "string",
|
|
702
|
-
"default": "\"
|
|
702
|
+
"default": "\"\""
|
|
703
703
|
},
|
|
704
704
|
{
|
|
705
705
|
"name": "readonly",
|
|
@@ -826,7 +826,7 @@
|
|
|
826
826
|
"name": "label",
|
|
827
827
|
"description": "The field's label",
|
|
828
828
|
"type": "string",
|
|
829
|
-
"default": "\"
|
|
829
|
+
"default": "\"\""
|
|
830
830
|
},
|
|
831
831
|
{
|
|
832
832
|
"name": "readonly",
|
|
@@ -944,7 +944,7 @@
|
|
|
944
944
|
"attribute": "label",
|
|
945
945
|
"description": "The field's label",
|
|
946
946
|
"type": "string",
|
|
947
|
-
"default": "\"
|
|
947
|
+
"default": "\"\""
|
|
948
948
|
},
|
|
949
949
|
{
|
|
950
950
|
"name": "readonly",
|
|
@@ -1077,7 +1077,7 @@
|
|
|
1077
1077
|
"name": "label",
|
|
1078
1078
|
"description": "The field's label",
|
|
1079
1079
|
"type": "string",
|
|
1080
|
-
"default": "\"
|
|
1080
|
+
"default": "\"\""
|
|
1081
1081
|
},
|
|
1082
1082
|
{
|
|
1083
1083
|
"name": "readonly",
|
|
@@ -1202,7 +1202,7 @@
|
|
|
1202
1202
|
"attribute": "label",
|
|
1203
1203
|
"description": "The field's label",
|
|
1204
1204
|
"type": "string",
|
|
1205
|
-
"default": "\"
|
|
1205
|
+
"default": "\"\""
|
|
1206
1206
|
},
|
|
1207
1207
|
{
|
|
1208
1208
|
"name": "readonly",
|
|
@@ -1335,7 +1335,7 @@
|
|
|
1335
1335
|
"name": "label",
|
|
1336
1336
|
"description": "The field's label",
|
|
1337
1337
|
"type": "string",
|
|
1338
|
-
"default": "\"
|
|
1338
|
+
"default": "\"\""
|
|
1339
1339
|
},
|
|
1340
1340
|
{
|
|
1341
1341
|
"name": "readonly",
|
|
@@ -1460,7 +1460,7 @@
|
|
|
1460
1460
|
"attribute": "label",
|
|
1461
1461
|
"description": "The field's label",
|
|
1462
1462
|
"type": "string",
|
|
1463
|
-
"default": "\"
|
|
1463
|
+
"default": "\"\""
|
|
1464
1464
|
},
|
|
1465
1465
|
{
|
|
1466
1466
|
"name": "readonly",
|
|
@@ -1788,7 +1788,7 @@
|
|
|
1788
1788
|
"name": "label",
|
|
1789
1789
|
"description": "The field's label",
|
|
1790
1790
|
"type": "string",
|
|
1791
|
-
"default": "\"
|
|
1791
|
+
"default": "\"\""
|
|
1792
1792
|
},
|
|
1793
1793
|
{
|
|
1794
1794
|
"name": "readonly",
|
|
@@ -1917,7 +1917,7 @@
|
|
|
1917
1917
|
"attribute": "label",
|
|
1918
1918
|
"description": "The field's label",
|
|
1919
1919
|
"type": "string",
|
|
1920
|
-
"default": "\"
|
|
1920
|
+
"default": "\"\""
|
|
1921
1921
|
},
|
|
1922
1922
|
{
|
|
1923
1923
|
"name": "readonly",
|