@3mo/date-time-fields 0.5.12-preview.2 → 0.7.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/FieldDateTime.d.ts +1 -1
- package/dist/FieldDateTime.d.ts.map +1 -1
- package/dist/FieldDateTime.js +3 -1
- package/dist/FieldDateTimeBase.d.ts +4 -5
- package/dist/FieldDateTimeBase.d.ts.map +1 -1
- package/dist/FieldDateTimeBase.js +23 -191
- package/dist/FieldDateTimeRange.d.ts +1 -1
- package/dist/FieldDateTimeRange.d.ts.map +1 -1
- package/dist/FieldDateTimeRange.js +9 -6
- package/dist/custom-elements.json +2319 -8
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/selection/DateList.d.ts +10 -7
- package/dist/selection/DateList.d.ts.map +1 -1
- package/dist/selection/DateList.js +68 -27
- package/dist/selection/HourList.d.ts.map +1 -1
- package/dist/selection/HourList.js +2 -1
- package/dist/selection/MinuteList.d.ts.map +1 -1
- package/dist/selection/MinuteList.js +2 -1
- package/dist/selection/MonthList.d.ts.map +1 -1
- package/dist/selection/MonthList.js +2 -1
- package/dist/selection/SecondList.d.ts.map +1 -1
- package/dist/selection/SecondList.js +2 -1
- package/dist/selection/YearList.js +2 -2
- package/dist/selection/calendar/Calendar.d.ts.map +1 -1
- package/dist/selection/calendar/Calendar.js +36 -21
- package/dist/selection/calendar/SelectableRangeCalendar.d.ts.map +1 -1
- package/dist/selection/calendar/SelectableRangeCalendar.js +23 -22
- package/dist/selection/index.d.ts +0 -2
- package/dist/selection/index.d.ts.map +1 -1
- package/dist/selection/index.js +0 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/dist/selection/FieldSelectMonth.d.ts +0 -17
- package/dist/selection/FieldSelectMonth.d.ts.map +0 -1
- package/dist/selection/FieldSelectMonth.js +0 -54
- package/dist/selection/FieldSelectYear.d.ts +0 -18
- package/dist/selection/FieldSelectYear.d.ts.map +0 -1
- package/dist/selection/FieldSelectYear.js +0 -52
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,CAAA;AACvB,OAAO,WAAW,CAAA;AAClB,OAAO,kBAAkB,CAAA;AACzB,OAAO,cAAc,CAAA;AACrB,OAAO,WAAW,CAAA;AAClB,OAAO,WAAW,CAAA;AAClB,OAAO,YAAY,CAAA;AACnB,OAAO,UAAU,CAAA;AACjB,OAAO,eAAe,CAAA;AACtB,OAAO,WAAW,CAAA;AAClB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,CAAA;AACvB,OAAO,WAAW,CAAA;AAClB,OAAO,kBAAkB,CAAA;AACzB,OAAO,cAAc,CAAA;AACrB,OAAO,WAAW,CAAA;AAClB,OAAO,WAAW,CAAA;AAClB,OAAO,YAAY,CAAA;AACnB,OAAO,UAAU,CAAA;AACjB,OAAO,eAAe,CAAA;AACtB,OAAO,WAAW,CAAA;AAClB,cAAc,sBAAsB,CAAA;AACpC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,oBAAoB,CAAA;AAClC,cAAc,yBAAyB,CAAA;AACvC,cAAc,qBAAqB,CAAA;AACnC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mCAAmC,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
import { Component, type HTMLTemplateResult } from '@a11d/lit';
|
|
2
|
-
import { IntervalController } from '@3mo/interval-controller';
|
|
3
2
|
export declare abstract class DateList extends Component {
|
|
4
3
|
readonly change: EventDispatcher<DateTime>;
|
|
4
|
+
readonly navigate: EventDispatcher<DateTime>;
|
|
5
5
|
navigatingValue: DateTime;
|
|
6
6
|
value?: DateTime;
|
|
7
|
-
private
|
|
8
|
-
|
|
7
|
+
private readonly selector;
|
|
8
|
+
private readonly items;
|
|
9
|
+
private readonly navigatingItem?;
|
|
10
|
+
private readonly selectedItem?;
|
|
9
11
|
get zero(): number;
|
|
10
|
-
readonly intervalController: IntervalController;
|
|
11
12
|
static get styles(): import("@a11d/lit").CSSResult;
|
|
12
|
-
private readonly selectedListItem?;
|
|
13
|
-
private readonly nowListItem?;
|
|
14
13
|
protected connected(): void;
|
|
15
14
|
protected get template(): HTMLTemplateResult;
|
|
16
|
-
|
|
15
|
+
private scrollIntoItem;
|
|
16
|
+
private _navigateOnScroll;
|
|
17
|
+
get navigateOnScroll(): boolean;
|
|
18
|
+
set navigateOnScroll(value: boolean);
|
|
19
|
+
protected handleScroll(): void;
|
|
17
20
|
protected abstract get listItemsTemplate(): HTMLTemplateResult;
|
|
18
21
|
}
|
|
19
22
|
//# sourceMappingURL=DateList.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateList.d.ts","sourceRoot":"","sources":["../../selection/DateList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,kBAAkB,
|
|
1
|
+
{"version":3,"file":"DateList.d.ts","sourceRoot":"","sources":["../../selection/DateList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,kBAAkB,EAA6D,MAAM,WAAW,CAAA;AAGzH,8BAAsB,QAAS,SAAQ,SAAS;IACtC,QAAQ,CAAC,MAAM,EAAG,eAAe,CAAC,QAAQ,CAAC,CAAA;IAC3C,QAAQ,CAAC,QAAQ,EAAG,eAAe,CAAC,QAAQ,CAAC,CAAA;IAEP,eAAe,EAAG,QAAQ,CAAA;IAC7C,KAAK,CAAC,EAAE,QAAQ,CAAA;IAExB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAc;IACtB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA4B;IACpC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAoB;IAC3D,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAoB;IAE9F,IAAI,IAAI,WAAe;IAEvB,WAAoB,MAAM,kCA+BzB;cAEkB,SAAS;IAI5B,cAAuB,QAAQ,uBAiB9B;YAEa,cAAc;IAM5B,OAAO,CAAC,iBAAiB,CAAQ;IACjC,IAAI,gBAAgB,YAAoC;IACxD,IAAI,gBAAgB,CAAC,KAAK,SAAA,EAMzB;IAID,SAAS,CAAC,YAAY;IAYtB,SAAS,CAAC,QAAQ,KAAK,iBAAiB,IAAI,kBAAkB,CAAA;CAC9D"}
|
|
@@ -1,46 +1,57 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { Component, css, event, html, property, query } from '@a11d/lit';
|
|
3
|
-
import { IntervalController } from '@3mo/interval-controller';
|
|
2
|
+
import { Component, css, event, eventOptions, html, property, query, queryAll } from '@a11d/lit';
|
|
4
3
|
export class DateList extends Component {
|
|
5
4
|
constructor() {
|
|
6
5
|
super(...arguments);
|
|
7
|
-
this.
|
|
8
|
-
this.intervalController = new IntervalController(this, 1000, () => {
|
|
9
|
-
this.requestUpdate();
|
|
10
|
-
if (this.preventIntervalScrolling === false) {
|
|
11
|
-
this.scrollIntoSelectedItem();
|
|
12
|
-
}
|
|
13
|
-
});
|
|
6
|
+
this._navigateOnScroll = false;
|
|
14
7
|
}
|
|
15
|
-
get now() { return new DateTime(); }
|
|
16
8
|
get zero() { return 0; }
|
|
17
9
|
static get styles() {
|
|
18
10
|
return css `
|
|
11
|
+
:host {
|
|
12
|
+
position: relative;
|
|
13
|
+
}
|
|
14
|
+
|
|
19
15
|
mo-scroller {
|
|
20
16
|
min-width: 70px;
|
|
21
17
|
}
|
|
22
18
|
|
|
19
|
+
.selector {
|
|
20
|
+
position: absolute;
|
|
21
|
+
transform: translateY(-50%);
|
|
22
|
+
inset-block-start: 50%;
|
|
23
|
+
inset-inline: 0;
|
|
24
|
+
width: 100%;
|
|
25
|
+
height: 32px;
|
|
26
|
+
border-block: 2px dashed var(--mo-color-gray-transparent);
|
|
27
|
+
}
|
|
28
|
+
|
|
23
29
|
.pad {
|
|
24
|
-
height:
|
|
30
|
+
height: 130px;
|
|
25
31
|
}
|
|
26
32
|
|
|
27
33
|
mo-selectable-list-item {
|
|
28
34
|
min-height: 32px;
|
|
29
35
|
padding-block: 8px;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
mo-selectable-list-item[data-now] {
|
|
33
|
-
outline: 2px dashed var(--mo-color-gray-transparent);
|
|
36
|
+
scroll-snap-align: center;
|
|
37
|
+
scroll-snap-stop: always;
|
|
34
38
|
}
|
|
35
39
|
`;
|
|
36
40
|
}
|
|
37
41
|
connected() {
|
|
38
|
-
this.
|
|
42
|
+
this.scrollIntoItem('navigating', 'instant');
|
|
39
43
|
}
|
|
40
44
|
get template() {
|
|
41
45
|
return this.navigatingValue === undefined ? html.nothing : html `
|
|
42
|
-
<
|
|
43
|
-
|
|
46
|
+
<div class='selector'></div>
|
|
47
|
+
<mo-scroller snapType='y mandatory'
|
|
48
|
+
@scroll=${this.handleScroll}
|
|
49
|
+
@mouseenter=${() => this.navigateOnScroll = true}
|
|
50
|
+
@mouseleave=${() => this.navigateOnScroll = false}
|
|
51
|
+
@touchstart=${() => this.navigateOnScroll = true}
|
|
52
|
+
@touchend=${() => this.navigateOnScroll = false}
|
|
53
|
+
>
|
|
54
|
+
<mo-selectable-list @change=${() => this.scrollIntoItem('selected', 'smooth')}>
|
|
44
55
|
<div class='pad'></div>
|
|
45
56
|
${this.listItemsTemplate}
|
|
46
57
|
<div class='pad'></div>
|
|
@@ -48,26 +59,56 @@ export class DateList extends Component {
|
|
|
48
59
|
</mo-scroller>
|
|
49
60
|
`;
|
|
50
61
|
}
|
|
51
|
-
async
|
|
62
|
+
async scrollIntoItem(key, behavior = 'smooth') {
|
|
52
63
|
await this.updateComplete;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
64
|
+
const item = key === 'navigating' ? this.navigatingItem : this.selectedItem;
|
|
65
|
+
item?.scrollIntoView({ block: 'center', behavior });
|
|
66
|
+
}
|
|
67
|
+
get navigateOnScroll() { return this._navigateOnScroll; }
|
|
68
|
+
set navigateOnScroll(value) {
|
|
69
|
+
if (value) {
|
|
70
|
+
this._navigateOnScroll = value;
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
setTimeout(() => this._navigateOnScroll = value, 100);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
handleScroll() {
|
|
77
|
+
if (!this.navigateOnScroll) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const middleY = this.selector.getBoundingClientRect().y;
|
|
81
|
+
const middleItem = this.items.reduce((closest, item) => {
|
|
82
|
+
const itemY = item.getBoundingClientRect().y;
|
|
83
|
+
return Math.abs(itemY - middleY) < Math.abs(closest.getBoundingClientRect().y - middleY) ? item : closest;
|
|
56
84
|
});
|
|
85
|
+
middleItem?.dispatchEvent(new CustomEvent('navigate'));
|
|
57
86
|
}
|
|
58
87
|
}
|
|
59
88
|
__decorate([
|
|
60
89
|
event()
|
|
61
90
|
], DateList.prototype, "change", void 0);
|
|
62
91
|
__decorate([
|
|
63
|
-
|
|
92
|
+
event()
|
|
93
|
+
], DateList.prototype, "navigate", void 0);
|
|
94
|
+
__decorate([
|
|
95
|
+
property({ type: Object, event: 'navigate' })
|
|
64
96
|
], DateList.prototype, "navigatingValue", void 0);
|
|
65
97
|
__decorate([
|
|
66
|
-
property({ type: Object
|
|
98
|
+
property({ type: Object })
|
|
67
99
|
], DateList.prototype, "value", void 0);
|
|
100
|
+
__decorate([
|
|
101
|
+
query('.selector')
|
|
102
|
+
], DateList.prototype, "selector", void 0);
|
|
103
|
+
__decorate([
|
|
104
|
+
queryAll('mo-selectable-list-item')
|
|
105
|
+
], DateList.prototype, "items", void 0);
|
|
106
|
+
__decorate([
|
|
107
|
+
query('mo-selectable-list-item[data-navigating]')
|
|
108
|
+
], DateList.prototype, "navigatingItem", void 0);
|
|
68
109
|
__decorate([
|
|
69
110
|
query('mo-selectable-list-item[selected]')
|
|
70
|
-
], DateList.prototype, "
|
|
111
|
+
], DateList.prototype, "selectedItem", void 0);
|
|
71
112
|
__decorate([
|
|
72
|
-
|
|
73
|
-
], DateList.prototype, "
|
|
113
|
+
eventOptions({ passive: true })
|
|
114
|
+
], DateList.prototype, "handleScroll", null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HourList.d.ts","sourceRoot":"","sources":["../../selection/HourList.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAGxC,qBACa,QAAS,SAAQ,QAAQ;IACrC,cAAuB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"HourList.d.ts","sourceRoot":"","sources":["../../selection/HourList.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAGxC,qBACa,QAAS,SAAQ,QAAQ;IACrC,cAAuB,iBAAiB,0CAWvC;CACD;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,cAAc,EAAE,QAAQ,CAAA;KACxB;CACD"}
|
|
@@ -7,7 +7,8 @@ let HourList = class HourList extends DateList {
|
|
|
7
7
|
${[...range(0, this.navigatingValue.hoursInDay)].map(hour => html `
|
|
8
8
|
<mo-selectable-list-item
|
|
9
9
|
?selected=${this.value?.hour === hour}
|
|
10
|
-
?data-
|
|
10
|
+
?data-navigating=${this.navigatingValue.hour === hour}
|
|
11
|
+
@navigate=${() => this.navigate.dispatch(this.navigatingValue.with({ hour }))}
|
|
11
12
|
@change=${(e) => !e.selected ? void 0 : this.change.dispatch((this.value ?? new DateTime).with({ hour }))}
|
|
12
13
|
>${hour.format().padStart(2, this.zero.format())}</mo-selectable-list-item>
|
|
13
14
|
`)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MinuteList.d.ts","sourceRoot":"","sources":["../../selection/MinuteList.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,qBACa,UAAW,SAAQ,QAAQ;IACvC,cAAuB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"MinuteList.d.ts","sourceRoot":"","sources":["../../selection/MinuteList.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,qBACa,UAAW,SAAQ,QAAQ;IACvC,cAAuB,iBAAiB,0CAWvC;CACD;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,gBAAgB,EAAE,UAAU,CAAA;KAC5B;CACD"}
|
|
@@ -7,7 +7,8 @@ let MinuteList = class MinuteList extends DateList {
|
|
|
7
7
|
${[...range(0, 60)].map(minute => html `
|
|
8
8
|
<mo-selectable-list-item
|
|
9
9
|
?selected=${this.value?.minute === minute}
|
|
10
|
-
?data-
|
|
10
|
+
?data-navigating=${this.navigatingValue.minute === minute}
|
|
11
|
+
@navigate=${() => this.navigate.dispatch(this.navigatingValue.with({ minute }))}
|
|
11
12
|
@change=${(e) => !e.selected ? void 0 : this.change.dispatch((this.value ?? new DateTime).with({ minute }))}
|
|
12
13
|
>${minute.format().padStart(2, this.zero.format())}</mo-selectable-list-item>
|
|
13
14
|
`)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MonthList.d.ts","sourceRoot":"","sources":["../../selection/MonthList.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,qBACa,SAAU,SAAQ,QAAQ;IACtC,WAAoB,MAAM,kCAQzB;IAED,OAAO,KAAK,UAAU,GAKrB;IAED,cAAuB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"MonthList.d.ts","sourceRoot":"","sources":["../../selection/MonthList.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,qBACa,SAAU,SAAQ,QAAQ;IACtC,WAAoB,MAAM,kCAQzB;IAED,OAAO,KAAK,UAAU,GAKrB;IAED,cAAuB,iBAAiB,0CAWvC;CACD;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,eAAe,EAAE,SAAS,CAAA;KAC1B;CACD"}
|
|
@@ -22,7 +22,8 @@ let MonthList = class MonthList extends DateList {
|
|
|
22
22
|
${this.monthNames.map(([month, name]) => html `
|
|
23
23
|
<mo-selectable-list-item
|
|
24
24
|
?selected=${this.value?.month === month}
|
|
25
|
-
?data-
|
|
25
|
+
?data-navigating=${this.navigatingValue.month === month}
|
|
26
|
+
@navigate=${() => this.navigate.dispatch(this.navigatingValue.with({ month }))}
|
|
26
27
|
@change=${(e) => !e.selected ? void 0 : this.change.dispatch((this.value ?? new DateTime).with({ month }))}
|
|
27
28
|
>${name}</mo-selectable-list-item>
|
|
28
29
|
`)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SecondList.d.ts","sourceRoot":"","sources":["../../selection/SecondList.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,qBACa,UAAW,SAAQ,QAAQ;IACvC,cAAuB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"SecondList.d.ts","sourceRoot":"","sources":["../../selection/SecondList.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,qBACa,UAAW,SAAQ,QAAQ;IACvC,cAAuB,iBAAiB,0CAWvC;CACD;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,gBAAgB,EAAE,UAAU,CAAA;KAC5B;CACD"}
|
|
@@ -7,7 +7,8 @@ let SecondList = class SecondList extends DateList {
|
|
|
7
7
|
${[...range(0, 60)].map(second => html `
|
|
8
8
|
<mo-selectable-list-item
|
|
9
9
|
?selected=${this.value?.second === second}
|
|
10
|
-
?data-
|
|
10
|
+
?data-navigating=${this.navigatingValue.second === second}
|
|
11
|
+
@navigate=${() => this.navigate.dispatch(this.navigatingValue.with({ second }))}
|
|
11
12
|
@change=${(e) => !e.selected ? void 0 : this.change.dispatch((this.value ?? new DateTime).with({ second }))}
|
|
12
13
|
>${second.format().padStart(2, this.zero.format())}</mo-selectable-list-item>
|
|
13
14
|
`)}
|
|
@@ -10,12 +10,12 @@ let YearList = class YearList extends DateList {
|
|
|
10
10
|
.map((_, i) => this.nowYear - 100 + i);
|
|
11
11
|
}
|
|
12
12
|
get listItemsTemplate() {
|
|
13
|
-
const now = this.now;
|
|
14
13
|
return html `
|
|
15
14
|
${this.years.map(year => html `
|
|
16
15
|
<mo-selectable-list-item
|
|
17
16
|
?selected=${this.value?.year === year}
|
|
18
|
-
?data-
|
|
17
|
+
?data-navigating=${this.navigatingValue.year === year}
|
|
18
|
+
@navigate=${() => this.navigate.dispatch(this.navigatingValue.with({ year }))}
|
|
19
19
|
@change=${(e) => !e.selected ? void 0 : this.change.dispatch((this.value ?? new DateTime).with({ year }))}
|
|
20
20
|
>${year.format()}</mo-selectable-list-item>
|
|
21
21
|
`)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Calendar.d.ts","sourceRoot":"","sources":["../../../selection/calendar/Calendar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"Calendar.d.ts","sourceRoot":"","sources":["../../../selection/calendar/Calendar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA4C,KAAK,SAAS,EAAS,MAAM,WAAW,CAAA;AACtG,OAAO,6BAA6B,CAAA;AAGpC,qBACa,QAAS,SAAQ,SAAS;IACM,kBAAkB,UAAQ;IAUnE,eAAe,gDAAe;IAExB,OAAO,CAAC,IAAI,CAA2D;IAEhF,WAAoB,MAAM,kCA8DzB;IAED,cAAuB,QAAQ,0CAyB9B;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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { Component, css, component, html, property, classMap,
|
|
2
|
+
import { Component, css, component, html, property, classMap, state } from '@a11d/lit';
|
|
3
3
|
import '@a11d/array.prototype.group';
|
|
4
4
|
import { MemoizeExpiring as memoizeExpiring } from 'typescript-memoize';
|
|
5
5
|
let Calendar = class Calendar extends Component {
|
|
@@ -17,9 +17,23 @@ let Calendar = class Calendar extends Component {
|
|
|
17
17
|
padding-inline: 10px;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
.
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
.month {
|
|
21
|
+
min-height: 270px;
|
|
22
|
+
place-items: center;
|
|
23
|
+
|
|
24
|
+
.heading {
|
|
25
|
+
font-weight: 500;
|
|
26
|
+
font-size: 16px;
|
|
27
|
+
grid-column: 1 / -1;
|
|
28
|
+
place-self: stretch;
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
margin-inline-start: 6px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.header {
|
|
35
|
+
color: var(--mo-color-gray);
|
|
36
|
+
}
|
|
23
37
|
}
|
|
24
38
|
|
|
25
39
|
.week {
|
|
@@ -38,26 +52,23 @@ let Calendar = class Calendar extends Component {
|
|
|
38
52
|
-webkit-user-select: none;
|
|
39
53
|
align-items: center;
|
|
40
54
|
justify-content: center;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.day {
|
|
44
55
|
height: var(--mo-calendar-day-size);
|
|
45
|
-
}
|
|
46
56
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
57
|
+
&:hover {
|
|
58
|
+
background: var(--mo-color-transparent-gray-3);
|
|
59
|
+
}
|
|
50
60
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
61
|
+
&:not(.isInMonth) {
|
|
62
|
+
color: var(--mo-color-gray);
|
|
63
|
+
}
|
|
54
64
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
65
|
+
&.today {
|
|
66
|
+
outline: 2px dashed var(--mo-color-gray-transparent);
|
|
67
|
+
}
|
|
58
68
|
|
|
59
|
-
|
|
60
|
-
|
|
69
|
+
&.navigation {
|
|
70
|
+
background: var(--mo-color-transparent-gray-3);
|
|
71
|
+
}
|
|
61
72
|
}
|
|
62
73
|
`;
|
|
63
74
|
}
|
|
@@ -66,12 +77,16 @@ let Calendar = class Calendar extends Component {
|
|
|
66
77
|
<mo-grid class='month'
|
|
67
78
|
rows='repeat(auto-fill, var(--mo-calendar-day-size))'
|
|
68
79
|
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
80
|
>
|
|
81
|
+
<div class='heading' style='grid-column: 1 / -1'>
|
|
82
|
+
${this.navigatingValue.format({ year: 'numeric' })}
|
|
83
|
+
${this.navigatingValue.format({ month: 'long' })}
|
|
84
|
+
</div>
|
|
85
|
+
|
|
71
86
|
${this.includeWeekNumbers === false ? html.nothing : html `<div></div>`}
|
|
72
87
|
|
|
73
88
|
${this.navigatingValue.weekDayNames.map(dayName => html `
|
|
74
|
-
<div class='
|
|
89
|
+
<div class='header'>
|
|
75
90
|
${dayName.charAt(0).toUpperCase() + dayName.charAt(1)}
|
|
76
91
|
</div>
|
|
77
92
|
`)}
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,kCA+BzB;cAEkB,oBAAoB,CAAC,GAAG,EAAE,QAAQ;;;;;;CAWrD;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,8BAA8B,EAAE,uBAAuB,CAAA;KACvD;CACD"}
|
|
@@ -7,30 +7,31 @@ let SelectableRangeCalendar = class SelectableRangeCalendar extends SelectableCa
|
|
|
7
7
|
return css `
|
|
8
8
|
${super.styles}
|
|
9
9
|
|
|
10
|
-
.day
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
.day {
|
|
11
|
+
&.isInRange {
|
|
12
|
+
border-radius: 0px;
|
|
13
|
+
&:not(.selected) {
|
|
14
|
+
background: color-mix(in srgb, var(--mo-color-accent), transparent 92%);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
border-start-start-radius: 0;
|
|
27
|
-
border-start-end-radius: 100px;
|
|
28
|
-
border-end-start-radius: 0;
|
|
29
|
-
border-end-end-radius: 100px;
|
|
30
|
-
}
|
|
18
|
+
&.selected {
|
|
19
|
+
&.first {
|
|
20
|
+
border-radius: 100px;
|
|
21
|
+
border-start-start-radius: 100px;
|
|
22
|
+
border-start-end-radius: 0;
|
|
23
|
+
border-end-start-radius: 100px;
|
|
24
|
+
border-end-end-radius: 0;
|
|
25
|
+
}
|
|
31
26
|
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
&.last {
|
|
28
|
+
border-radius: 100px;
|
|
29
|
+
border-start-start-radius: 0;
|
|
30
|
+
border-start-end-radius: 100px;
|
|
31
|
+
border-end-start-radius: 0;
|
|
32
|
+
border-end-end-radius: 100px;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
34
35
|
}
|
|
35
36
|
`;
|
|
36
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../selection/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../selection/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,qBAAqB,CAAA"}
|