@progressive-development/pd-calendar 0.2.3 → 0.2.5
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/package.json +1 -1
- package/src/PdCalendar.js +3 -2
- package/src/PdCalendarCell.js +32 -0
package/package.json
CHANGED
package/src/PdCalendar.js
CHANGED
|
@@ -272,8 +272,9 @@ export class PdCalendar extends LitElement {
|
|
|
272
272
|
if (!this.hideWeekend || ((day !== 6) && (day !== 0))) {
|
|
273
273
|
const key = format(tmpDate, 'YYYY-MM-DD');
|
|
274
274
|
// TODO => Array / Unit Thema... hier fest auf 0 zugegriffen zunächst
|
|
275
|
-
|
|
276
|
-
const
|
|
275
|
+
|
|
276
|
+
const infoTxt = this.data && this.data[key] ? this.data[key][0].info : undefined;
|
|
277
|
+
const special = this.data && this.data[key]
|
|
277
278
|
? this.data[key][0].special || false
|
|
278
279
|
: false;
|
|
279
280
|
|
package/src/PdCalendarCell.js
CHANGED
|
@@ -195,6 +195,8 @@ class PdCalendarCell extends LitElement {
|
|
|
195
195
|
return html` <div
|
|
196
196
|
@keypress="${this._selectableCellClicked}"
|
|
197
197
|
@click="${this._selectableCellClicked}"
|
|
198
|
+
@mouseenter="${this._mouseEnter}"
|
|
199
|
+
@mouseleave="${this._mouseLeave}"
|
|
198
200
|
data-date="${this.key}"
|
|
199
201
|
class="cell cell-day ${this.numberClass} ${this.special ? 'special' : 'free'}
|
|
200
202
|
${this.weekDayNumber === 6 ||
|
|
@@ -254,6 +256,36 @@ class PdCalendarCell extends LitElement {
|
|
|
254
256
|
);
|
|
255
257
|
}
|
|
256
258
|
}
|
|
259
|
+
|
|
260
|
+
_mouseEnter(e) {
|
|
261
|
+
const dateKey = e.target.dataset.date;
|
|
262
|
+
if (dateKey) {
|
|
263
|
+
// convert back to date
|
|
264
|
+
const userSelectedDate = parse(dateKey, 'YYYY-MM-DD');
|
|
265
|
+
this.dispatchEvent(
|
|
266
|
+
new CustomEvent('mouse-enter-date', {
|
|
267
|
+
detail: {
|
|
268
|
+
dateKey,
|
|
269
|
+
date: userSelectedDate,
|
|
270
|
+
bubbles: true,
|
|
271
|
+
composed: true
|
|
272
|
+
},
|
|
273
|
+
})
|
|
274
|
+
);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
_mouseLeave() {
|
|
279
|
+
this.dispatchEvent(
|
|
280
|
+
new CustomEvent('mouse-leave-date', {
|
|
281
|
+
detail: {
|
|
282
|
+
bubbles: true,
|
|
283
|
+
composed: true
|
|
284
|
+
},
|
|
285
|
+
})
|
|
286
|
+
);
|
|
287
|
+
}
|
|
288
|
+
|
|
257
289
|
}
|
|
258
290
|
|
|
259
291
|
window.customElements.define('pd-calendar-cell', PdCalendarCell);
|