Skip to content

Commit 38dd0d8

Browse files
author
Nathan Reyes
committed
Commit latest changes
1 parent 8f32b9f commit 38dd0d8

File tree

3 files changed

+91
-71
lines changed

3 files changed

+91
-71
lines changed

docs/components/home/examples/ExAttributes.vue

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,6 @@ export default {
101101
backgroundColor: todo.color,
102102
opacity: todo.isComplete ? 0.3 : 1,
103103
},
104-
contentHoverStyle: {
105-
backgroundColor: 'rgba(0, 0, 0, 0.1)',
106-
cursor: 'pointer',
107-
},
108104
popover: {
109105
label: todo.description,
110106
},

docs/components/home/sections/SectionPopovers.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
<b-tab-item label='Overview'>
1010
<div class='content'>
1111
<ul>
12-
<li>Supports both simple toolips and custom slot content</li>
12+
<li>Assign simple toolips and custom slot content per attribute</li>
1313
<li>Makes inline editing possible for custom data</li>
14-
<li>Optionally animated on appearance or disappearance</li>
15-
<li>Use content styles to properly display day content</li>
14+
<li>Multiple visibility options like 'hover' and 'focus'</li>
15+
<li>Assignable slots for header and footer content</li>
1616
</ul>
1717
</div>
1818
</b-tab-item>

src/components/CalendarDay.vue

Lines changed: 88 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -8,65 +8,67 @@
88
:content-style='popoverContentStyle'
99
:is-interactive='popoverIsInteractive'
1010
toggle-visible-on-click>
11-
<div
12-
class='c-day'
13-
:style='dayCellStyle'>
14-
<!-- Background layers -->
15-
<transition-group
16-
name='background'
17-
tag='div'>
18-
<div
19-
v-for='background in backgrounds'
20-
:key='background.key'
21-
:class='background.wrapperClass'>
22-
<div
23-
class='c-day-background'
24-
:style='background.style'>
25-
</div>
26-
</div>
27-
</transition-group>
28-
<!-- Content layer -->
29-
<div class='c-day-layer c-day-box-center-center'>
11+
<!-- Background layers -->
12+
<transition-group
13+
name='background'
14+
tag='div'
15+
class='c-day-backgrounds'>
16+
<div
17+
v-for='background in backgrounds'
18+
:key='background.key'
19+
:class='background.wrapperClass'
20+
:style='dayOpacityStyle'>
3021
<div
31-
ref='dayContent'
32-
class='c-day-content'
33-
:style='contentStyle_'
34-
@click='click'
35-
@mouseenter='mouseenter'
36-
@mouseover='mouseover'
37-
@mouseleave='mouseleave'>
38-
{{ label }}
22+
class='c-day-background'
23+
:style='background.style'>
3924
</div>
4025
</div>
41-
<!-- Dots layer -->
26+
</transition-group>
27+
<!-- Content layer -->
28+
<div
29+
class='c-day-layer c-day-box-center-center'
30+
:style='dayOpacityStyle'>
4231
<div
43-
class='c-day-layer c-day-box-center-bottom'
44-
v-if='hasDots'>
45-
<div
46-
class='c-day-dots'
47-
:style='dotsStyle'>
48-
<span
49-
v-for='dot in dots'
50-
:key='dot.key'
51-
class='c-day-dot'
52-
:style='dot.style'>
53-
</span>
54-
</div>
32+
ref='dayContent'
33+
class='c-day-content'
34+
:style='contentStyle_'
35+
@click='click'
36+
@mouseenter='mouseenter'
37+
@mouseover='mouseover'
38+
@mouseleave='mouseleave'>
39+
{{ label }}
5540
</div>
56-
<!-- Bars layer -->
41+
</div>
42+
<!-- Dots layer -->
43+
<div
44+
class='c-day-layer c-day-box-center-bottom'
45+
:style='dayOpacityStyle'
46+
v-if='hasDots'>
5747
<div
58-
class='c-day-layer c-day-box-center-bottom'
59-
v-if='hasBars'>
60-
<div
61-
class='c-day-bars'
62-
:style='barsStyle'>
63-
<span
64-
v-for='bar in bars'
65-
:key='bar.key'
66-
class='c-day-bar'
67-
:style='bar.style'>
68-
</span>
69-
</div>
48+
class='c-day-dots'
49+
:style='dotsStyle'>
50+
<span
51+
v-for='dot in dots'
52+
:key='dot.key'
53+
class='c-day-dot'
54+
:style='dot.style'>
55+
</span>
56+
</div>
57+
</div>
58+
<!-- Bars layer -->
59+
<div
60+
class='c-day-layer c-day-box-center-bottom'
61+
:style='dayOpacityStyle'
62+
v-if='hasBars'>
63+
<div
64+
class='c-day-bars'
65+
:style='barsStyle'>
66+
<span
67+
v-for='bar in bars'
68+
:key='bar.key'
69+
class='c-day-bar'
70+
:style='bar.style'>
71+
</span>
7072
</div>
7173
</div>
7274
<!-- Popover content -->
@@ -139,11 +141,26 @@ export default {
139141
inMonth() {
140142
return this.dayInfo.inMonth;
141143
},
144+
dayOpacityStyle() {
145+
const dayCell = this.styles.dayCell;
146+
const dayCellNotInMonth = this.styles.dayCellNotInMonth;
147+
// Assign default opacity
148+
let opacity = (dayCell && dayCell.opacity) || 1;
149+
// Reassign to 'not in month' opacity if it was specified
150+
if (!this.inMonth && Object.prototype.hasOwnProperty.call(dayCellNotInMonth, 'opacity')) opacity = dayCellNotInMonth.opacity;
151+
return {
152+
opacity,
153+
};
154+
},
142155
dayCellStyle() {
143-
return this.inMonth ? this.styles.dayCell : {
156+
// Merge 'not in month' style if needed
157+
const style = this.inMonth ? this.styles.dayCell : {
144158
...this.styles.dayCell,
145159
...this.styles.dayCellNotInMonth,
146160
};
161+
// Due to some rendering glitches in Chrome, we need to remove opacity from top level style
162+
delete style.opacity;
163+
return style;
147164
},
148165
contentStyle_() {
149166
let style = this.contentStyle;
@@ -278,7 +295,7 @@ export default {
278295
},
279296
};
280297
if (dateInfo.isDate) {
281-
background.wrapperClass = `c-day-layer c-day-box-center-center${highlight.animated ? ' c-day-scale-enter c-day-scale-leave' : ''}`;
298+
background.wrapperClass = `c-day-box-center-center${highlight.animated ? ' c-day-scale-enter c-day-scale-leave' : ''}`;
282299
} else {
283300
const onStart = dateInfo.startTime === this.dateTime;
284301
const onEnd = dateInfo.endTime === this.dateTime;
@@ -287,25 +304,25 @@ export default {
287304
const endWidth = '95%';
288305
// Is the day date on the highlight start and end date
289306
if (onStart && onEnd) {
290-
background.wrapperClass = `c-day-layer c-day-box-center-center${highlight.animated ? ' c-day-scale-enter c-day-scale-leave' : ''}`;
307+
background.wrapperClass = `c-day-box-center-center${highlight.animated ? ' c-day-scale-enter c-day-scale-leave' : ''}`;
291308
background.style.width = endWidth;
292309
background.style.borderWidth = borderWidth;
293310
background.style.borderRadius = `${borderRadius} ${borderRadius} ${borderRadius} ${borderRadius}`;
294311
// Is the day date on the highlight start date
295312
} else if (onStart) {
296-
background.wrapperClass = `c-day-layer c-day-box-right-center shift-right${highlight.animated ? ' c-day-slide-left-enter' : ''}`;
313+
background.wrapperClass = `c-day-box-right-center shift-right${highlight.animated ? ' c-day-slide-left-enter' : ''}`;
297314
background.style.width = endWidth;
298315
background.style.borderWidth = `${borderWidth} 0 ${borderWidth} ${borderWidth}`;
299316
background.style.borderRadius = `${borderRadius} 0 0 ${borderRadius}`;
300317
// Is the day date on the highlight end date
301318
} else if (onEnd) {
302-
background.wrapperClass = `c-day-layer c-day-box-left-center shift-left${highlight.animated ? ' c-day-slide-right-enter' : ''}`;
319+
background.wrapperClass = `c-day-box-left-center shift-left${highlight.animated ? ' c-day-slide-right-enter' : ''}`;
303320
background.style.width = endWidth;
304321
background.style.borderWidth = `${borderWidth} ${borderWidth} ${borderWidth} 0`;
305322
background.style.borderRadius = `0 ${borderRadius} ${borderRadius} 0`;
306323
// Is the day date between the highlight start/end dates
307324
} else {
308-
background.wrapperClass = 'c-day-layer c-day-box-center-center shift-left-right';
325+
background.wrapperClass = 'c-day-box-center-center shift-left-right';
309326
background.style.width = '100%';
310327
background.style.borderWidth = `${borderWidth} 0`;
311328
background.style.borderRadius = '0';
@@ -374,11 +391,8 @@ export default {
374391
@import '../styles/mixins.sass'
375392
376393
.c-day-popover
377-
flex: 1
378-
379-
.c-day
380394
position: relative
381-
overflow: hidden
395+
flex: 1
382396
height: $dayHeight
383397
384398
.c-day-layer
@@ -388,23 +402,32 @@ export default {
388402
top: 0
389403
bottom: 0
390404
pointer-events: none
391-
overflow: hidden
392405
393406
.c-day-box-center-center
394407
+box()
408+
height: 100%
395409
transform-origin: 50% 50%
396410
397411
.c-day-box-left-center
398412
+box(flex-start)
413+
height: 100%
399414
transform-origin: 0% 50%
400415
401416
.c-day-box-right-center
402417
+box(flex-end)
418+
height: 100%
403419
transform-origin: 100% 50%
404420
405421
.c-day-box-center-bottom
406422
+box(center, flex-end)
407423
424+
.c-day-box-not-in-month
425+
opacity: 0.4
426+
427+
.c-day-backgrounds
428+
height: 100%
429+
overflow: hidden
430+
408431
.c-day-background
409432
transition: height $backgroundTransitionTime, background-color $backgroundTransitionTime
410433
@@ -445,6 +468,7 @@ export default {
445468
height: $dayContentHeight
446469
font-size: $dayContentFontSize
447470
font-weight: $dayContentFontWeight
471+
line-height: 1
448472
border-radius: $dayContentBorderRadius
449473
transition: all $dayContentTransitionTime
450474
user-select: none

0 commit comments

Comments
 (0)