@3mo/date-time-fields 0.5.3 → 0.5.4
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 +1 -1
- package/dist/FieldDateTimeBase.d.ts.map +1 -1
- package/dist/FieldDateTimeBase.js +112 -112
- package/dist/FieldDateTimeRange.d.ts +1 -1
- package/dist/FieldDateTimeRange.d.ts.map +1 -1
- package/dist/FieldDateTimeRange.js +34 -34
- package/dist/FieldToggleableDateTimeRange.js +7 -7
- package/dist/custom-elements.json +5 -5
- package/dist/selection/DateList.d.ts +1 -1
- package/dist/selection/DateList.d.ts.map +1 -1
- 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.d.ts +1 -1
- package/dist/selection/calendar/Calendar.d.ts.map +1 -1
- 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 +7 -7
- package/dist/selection/calendar/SelectableRangeCalendar.d.ts +1 -1
- package/dist/selection/calendar/SelectableRangeCalendar.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -3,14 +3,14 @@ import { component, html, range } from '@a11d/lit';
|
|
|
3
3
|
import { DateList } from './DateList.js';
|
|
4
4
|
let SecondList = class SecondList extends DateList {
|
|
5
5
|
get listItemsTemplate() {
|
|
6
|
-
return html `
|
|
7
|
-
${[...range(0, 60)].map(second => html `
|
|
8
|
-
<mo-selectable-list-item
|
|
9
|
-
?selected=${this.value?.second === second}
|
|
10
|
-
?data-now=${this.now.second === second}
|
|
11
|
-
@change=${(e) => !e.selected ? void 0 : this.change.dispatch((this.value ?? new DateTime).with({ second }))}
|
|
12
|
-
>${second.format().padStart(2, this.zero.format())}</mo-selectable-list-item>
|
|
13
|
-
`)}
|
|
6
|
+
return html `
|
|
7
|
+
${[...range(0, 60)].map(second => html `
|
|
8
|
+
<mo-selectable-list-item
|
|
9
|
+
?selected=${this.value?.second === second}
|
|
10
|
+
?data-now=${this.now.second === second}
|
|
11
|
+
@change=${(e) => !e.selected ? void 0 : this.change.dispatch((this.value ?? new DateTime).with({ second }))}
|
|
12
|
+
>${second.format().padStart(2, this.zero.format())}</mo-selectable-list-item>
|
|
13
|
+
`)}
|
|
14
14
|
`;
|
|
15
15
|
}
|
|
16
16
|
};
|
|
@@ -11,14 +11,14 @@ let YearList = class YearList extends DateList {
|
|
|
11
11
|
}
|
|
12
12
|
get listItemsTemplate() {
|
|
13
13
|
const now = this.now;
|
|
14
|
-
return html `
|
|
15
|
-
${this.years.map(year => html `
|
|
16
|
-
<mo-selectable-list-item
|
|
17
|
-
?selected=${this.value?.year === year}
|
|
18
|
-
?data-now=${now.year === year}
|
|
19
|
-
@change=${(e) => !e.selected ? void 0 : this.change.dispatch((this.value ?? new DateTime).with({ year }))}
|
|
20
|
-
>${year.format()}</mo-selectable-list-item>
|
|
21
|
-
`)}
|
|
14
|
+
return html `
|
|
15
|
+
${this.years.map(year => html `
|
|
16
|
+
<mo-selectable-list-item
|
|
17
|
+
?selected=${this.value?.year === year}
|
|
18
|
+
?data-now=${now.year === year}
|
|
19
|
+
@change=${(e) => !e.selected ? void 0 : this.change.dispatch((this.value ?? new DateTime).with({ year }))}
|
|
20
|
+
>${year.format()}</mo-selectable-list-item>
|
|
21
|
+
`)}
|
|
22
22
|
`;
|
|
23
23
|
}
|
|
24
24
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Calendar.d.ts","sourceRoot":"","sources":["../../../selection/calendar/Calendar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAmD,SAAS,EAAS,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"Calendar.d.ts","sourceRoot":"","sources":["../../../selection/calendar/Calendar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAmD,KAAK,SAAS,EAAS,MAAM,WAAW,CAAA;AAC7G,OAAO,6BAA6B,CAAA;AAGpC,qBACa,QAAS,SAAQ,SAAS;IACM,kBAAkB,UAAQ;IAUnE,eAAe,gDAAe;IAExB,OAAO,CAAC,IAAI,CAA2D;IAEhF,WAAoB,MAAM,kCAmDzB;IAED,cAAuB,QAAQ,0CAqB9B;IAED,OAAO,CAAG,OAAO;IAOjB,SAAS,CAAC,cAAc,CAAC,GAAG,EAAE,QAAQ;IAQtC,SAAS,CAAC,cAAc,CAAC,GAAG,EAAE,QAAQ;IAKtC,OAAO,KAAK,GAAG,GAA0B;IAEzC,SAAS,CAAC,oBAAoB,CAAC,GAAG,EAAE,QAAQ,GAAG,SAAS;CAOxD;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,aAAa,EAAE,QAAQ,CAAA;KACvB;CACD"}
|
|
@@ -10,77 +10,77 @@ let Calendar = class Calendar extends Component {
|
|
|
10
10
|
this.days = new Array();
|
|
11
11
|
}
|
|
12
12
|
static get styles() {
|
|
13
|
-
return css `
|
|
14
|
-
:host {
|
|
15
|
-
--mo-calendar-day-size: 36px;
|
|
16
|
-
--mo-calendar-week-number-width: var(--mo-calendar-day-size);
|
|
17
|
-
padding-inline: 10px;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.monthHeader {
|
|
21
|
-
color: var(--mo-color-gray);
|
|
22
|
-
align-items: center;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.week {
|
|
26
|
-
color: var(--mo-color-gray);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.day {
|
|
30
|
-
text-align: center;
|
|
31
|
-
border-radius: 100px;
|
|
32
|
-
cursor: pointer;
|
|
33
|
-
transition: 100ms;
|
|
34
|
-
font-weight: 500;
|
|
35
|
-
user-select: none;
|
|
36
|
-
font-size: medium;
|
|
37
|
-
width: var(--mo-calendar-day-size);
|
|
38
|
-
-webkit-user-select: none;
|
|
39
|
-
align-items: center;
|
|
40
|
-
justify-content: center;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.day {
|
|
44
|
-
height: var(--mo-calendar-day-size);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.day:hover {
|
|
48
|
-
background: var(--mo-color-transparent-gray-3);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
.day:not(.isInMonth) {
|
|
52
|
-
color: var(--mo-color-gray);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.day.today {
|
|
56
|
-
outline: 2px dashed var(--mo-color-gray-transparent);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.day.navigation {
|
|
60
|
-
background: var(--mo-color-transparent-gray-3);
|
|
61
|
-
}
|
|
13
|
+
return css `
|
|
14
|
+
:host {
|
|
15
|
+
--mo-calendar-day-size: 36px;
|
|
16
|
+
--mo-calendar-week-number-width: var(--mo-calendar-day-size);
|
|
17
|
+
padding-inline: 10px;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.monthHeader {
|
|
21
|
+
color: var(--mo-color-gray);
|
|
22
|
+
align-items: center;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.week {
|
|
26
|
+
color: var(--mo-color-gray);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.day {
|
|
30
|
+
text-align: center;
|
|
31
|
+
border-radius: 100px;
|
|
32
|
+
cursor: pointer;
|
|
33
|
+
transition: 100ms;
|
|
34
|
+
font-weight: 500;
|
|
35
|
+
user-select: none;
|
|
36
|
+
font-size: medium;
|
|
37
|
+
width: var(--mo-calendar-day-size);
|
|
38
|
+
-webkit-user-select: none;
|
|
39
|
+
align-items: center;
|
|
40
|
+
justify-content: center;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.day {
|
|
44
|
+
height: var(--mo-calendar-day-size);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.day:hover {
|
|
48
|
+
background: var(--mo-color-transparent-gray-3);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.day:not(.isInMonth) {
|
|
52
|
+
color: var(--mo-color-gray);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.day.today {
|
|
56
|
+
outline: 2px dashed var(--mo-color-gray-transparent);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.day.navigation {
|
|
60
|
+
background: var(--mo-color-transparent-gray-3);
|
|
61
|
+
}
|
|
62
62
|
`;
|
|
63
63
|
}
|
|
64
64
|
get template() {
|
|
65
|
-
return html `
|
|
66
|
-
<mo-grid class='month'
|
|
67
|
-
rows='repeat(auto-fill, var(--mo-calendar-day-size))'
|
|
68
|
-
columns=${this.includeWeekNumbers ? 'var(--mo-calendar-week-number-width) repeat(7, var(--mo-calendar-day-size))' : 'repeat(7, var(--mo-calendar-day-size))'}
|
|
69
|
-
${style({ alignItems: 'center', justifyItems: 'center' })}
|
|
70
|
-
>
|
|
71
|
-
${this.includeWeekNumbers === false ? html.nothing : html `<div></div>`}
|
|
72
|
-
|
|
73
|
-
${this.navigatingValue.weekDayNames.map(dayName => html `
|
|
74
|
-
<div class='monthHeader'>
|
|
75
|
-
${dayName.charAt(0).toUpperCase() + dayName.charAt(1)}
|
|
76
|
-
</div>
|
|
77
|
-
`)}
|
|
78
|
-
|
|
79
|
-
${this.days.map(([weekNumber, days]) => html `
|
|
80
|
-
${this.includeWeekNumbers === false ? html.nothing : html `<div class='week'>${weekNumber}</div>`}
|
|
81
|
-
${days.map(day => this.getDayTemplate(day))}
|
|
82
|
-
`)}
|
|
83
|
-
</mo-grid>
|
|
65
|
+
return html `
|
|
66
|
+
<mo-grid class='month'
|
|
67
|
+
rows='repeat(auto-fill, var(--mo-calendar-day-size))'
|
|
68
|
+
columns=${this.includeWeekNumbers ? 'var(--mo-calendar-week-number-width) repeat(7, var(--mo-calendar-day-size))' : 'repeat(7, var(--mo-calendar-day-size))'}
|
|
69
|
+
${style({ alignItems: 'center', justifyItems: 'center' })}
|
|
70
|
+
>
|
|
71
|
+
${this.includeWeekNumbers === false ? html.nothing : html `<div></div>`}
|
|
72
|
+
|
|
73
|
+
${this.navigatingValue.weekDayNames.map(dayName => html `
|
|
74
|
+
<div class='monthHeader'>
|
|
75
|
+
${dayName.charAt(0).toUpperCase() + dayName.charAt(1)}
|
|
76
|
+
</div>
|
|
77
|
+
`)}
|
|
78
|
+
|
|
79
|
+
${this.days.map(([weekNumber, days]) => html `
|
|
80
|
+
${this.includeWeekNumbers === false ? html.nothing : html `<div class='week'>${weekNumber}</div>`}
|
|
81
|
+
${days.map(day => this.getDayTemplate(day))}
|
|
82
|
+
`)}
|
|
83
|
+
</mo-grid>
|
|
84
84
|
`;
|
|
85
85
|
}
|
|
86
86
|
*rangeOf(start, end) {
|
|
@@ -90,10 +90,10 @@ let Calendar = class Calendar extends Component {
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
getDayTemplate(day) {
|
|
93
|
-
return html `
|
|
94
|
-
<mo-flex class=${classMap(this.getDayElementClasses(day))} @click=${() => this.handleDayClick(day)}>
|
|
95
|
-
${day.format({ day: 'numeric' })}
|
|
96
|
-
</mo-flex>
|
|
93
|
+
return html `
|
|
94
|
+
<mo-flex tabindex='0' class=${classMap(this.getDayElementClasses(day))} @click=${() => this.handleDayClick(day)}>
|
|
95
|
+
${day.format({ day: 'numeric' })}
|
|
96
|
+
</mo-flex>
|
|
97
97
|
`;
|
|
98
98
|
}
|
|
99
99
|
handleDayClick(day) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectableCalendar.d.ts","sourceRoot":"","sources":["../../../selection/calendar/SelectableCalendar.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"SelectableCalendar.d.ts","sourceRoot":"","sources":["../../../selection/calendar/SelectableCalendar.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAE9C,oBAAoB;AACpB,qBACa,kBAAmB,SAAQ,QAAQ;IACtC,QAAQ,CAAC,MAAM,EAAG,eAAe,CAAC,QAAQ,CAAC,CAAA;IAExB,KAAK,CAAC,EAAE,QAAQ,CAAA;IAE5C,WAAoB,MAAM,kCASzB;cAEkB,cAAc,CAAC,GAAG,EAAE,QAAQ;cAK5B,oBAAoB,CAAC,GAAG,EAAE,QAAQ;;;CAMrD;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,wBAAwB,EAAE,kBAAkB,CAAA;KAC5C;CACD"}
|
|
@@ -4,13 +4,13 @@ import { Calendar } from './Calendar.js';
|
|
|
4
4
|
/** @fires change */
|
|
5
5
|
let SelectableCalendar = class SelectableCalendar extends Calendar {
|
|
6
6
|
static get styles() {
|
|
7
|
-
return css `
|
|
8
|
-
${super.styles}
|
|
9
|
-
|
|
10
|
-
.day.selected {
|
|
11
|
-
background: var(--mo-color-accent-transparent);
|
|
12
|
-
color: var(--mo-color-accent) !important;
|
|
13
|
-
}
|
|
7
|
+
return css `
|
|
8
|
+
${super.styles}
|
|
9
|
+
|
|
10
|
+
.day.selected {
|
|
11
|
+
background: var(--mo-color-accent-transparent);
|
|
12
|
+
color: var(--mo-color-accent) !important;
|
|
13
|
+
}
|
|
14
14
|
`;
|
|
15
15
|
}
|
|
16
16
|
handleDayClick(day) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectableRangeCalendar.d.ts","sourceRoot":"","sources":["../../../selection/calendar/SelectableRangeCalendar.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"SelectableRangeCalendar.d.ts","sourceRoot":"","sources":["../../../selection/calendar/SelectableRangeCalendar.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAE5D,oBAAoB;AACpB,qBACa,uBAAwB,SAAQ,kBAAkB;IAClC,SAAS,CAAC,EAAE,aAAa,CAAA;IAErD,WAAoB,MAAM,kCA8BzB;cAEkB,oBAAoB,CAAC,GAAG,EAAE,QAAQ;;;;;;CAWrD;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,8BAA8B,EAAE,uBAAuB,CAAA;KACvD;CACD"}
|