ywana-core8 0.0.908 → 0.0.910
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/index.cjs +17 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +15 -9
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +17 -16
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +17 -16
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/widgets/calendar/Calendar.css +15 -9
- package/src/widgets/calendar/Calendar.js +27 -20
- package/src/widgets/calendar/Calendar.test.js +4 -4
- package/src/widgets/planner/Planner.test.js +1 -0
package/package.json
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
|
2
2
|
.calendar {
|
3
|
-
margin:
|
3
|
+
margin: 1rem;
|
4
4
|
overflow: hidden;
|
5
5
|
display: flex;
|
6
6
|
flex-direction: column;
|
7
|
-
padding:
|
7
|
+
padding: 0rem;
|
8
|
+
|
8
9
|
}
|
9
10
|
|
10
11
|
.calendar>nav {
|
@@ -22,11 +23,10 @@
|
|
22
23
|
|
23
24
|
.calendar>nav>button {
|
24
25
|
margin-left: 1px;
|
26
|
+
border-radius: 3px;
|
25
27
|
}
|
26
28
|
|
27
29
|
.calendar>header {
|
28
|
-
border: solid 1px var(--divider-color);
|
29
|
-
border-width: 1px 1px 0 0px;
|
30
30
|
display: grid;
|
31
31
|
grid-template-columns: repeat(7, 1fr);
|
32
32
|
font-size: .8rem;
|
@@ -45,9 +45,9 @@
|
|
45
45
|
}
|
46
46
|
|
47
47
|
.week-day-cell {
|
48
|
-
border
|
48
|
+
border: solid 0px var(--divider-color);
|
49
49
|
padding: 2px;
|
50
|
-
text-align:
|
50
|
+
text-align: right;
|
51
51
|
min-width: 5rem;
|
52
52
|
}
|
53
53
|
|
@@ -56,13 +56,19 @@
|
|
56
56
|
border-width: 0 0 1px 1px;
|
57
57
|
padding: .5rem;
|
58
58
|
text-align: right;
|
59
|
-
min-height:
|
59
|
+
min-height: 6rem;
|
60
60
|
min-width: 5rem;
|
61
|
+
font-weight: 400;
|
61
62
|
}
|
62
63
|
|
63
64
|
.day-cell.today>header {
|
64
|
-
|
65
|
-
padding: .3rem
|
65
|
+
border-bottom: solid 2px var(--primary-color);
|
66
|
+
padding: .3rem;
|
67
|
+
font-weight: 600;
|
68
|
+
}
|
69
|
+
|
70
|
+
.day-cell.other-month {
|
71
|
+
color: var(--text-color-lighter);
|
66
72
|
}
|
67
73
|
|
68
74
|
.day-cell:hover {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React, { useState, useEffect } from 'react'
|
2
|
-
import { Button } from '../../html'
|
2
|
+
import { Button, Text } from '../../html'
|
3
3
|
import Moment from 'moment'
|
4
4
|
import { extendMoment } from 'moment-range';
|
5
5
|
import 'moment/locale/es'
|
@@ -41,7 +41,7 @@ export const Calendar = (props) => {
|
|
41
41
|
|
42
42
|
function today() {
|
43
43
|
const today = moment()
|
44
|
-
setPosition(today)
|
44
|
+
setPosition(today)
|
45
45
|
}
|
46
46
|
|
47
47
|
if (!position) return "..."
|
@@ -56,32 +56,38 @@ export const Calendar = (props) => {
|
|
56
56
|
const days = Array.from(range.by('days'))
|
57
57
|
|
58
58
|
const cells = days.map(day => {
|
59
|
-
|
60
|
-
|
61
|
-
|
59
|
+
|
60
|
+
const eventsOfDay = events.filter(event => {
|
61
|
+
console.log(event.date, day.format("YYYY-MM-DD"))
|
62
|
+
const eventDay = moment(event.date)
|
63
|
+
return eventDay.isSame(day, 'day')
|
62
64
|
})
|
63
|
-
|
65
|
+
|
66
|
+
return {
|
67
|
+
day,
|
68
|
+
events: eventsOfDay
|
69
|
+
}
|
64
70
|
})
|
65
71
|
|
66
72
|
return (
|
67
73
|
<div className="calendar">
|
68
74
|
<nav>
|
69
|
-
<label> {monthName} {year}</label>
|
70
|
-
<Button icon="chevron_left"
|
71
|
-
<Button label="
|
72
|
-
<Button icon="chevron_right"
|
75
|
+
<label> <Text>{monthName}</Text> {year}</label>
|
76
|
+
<Button icon="chevron_left" action={prev} />
|
77
|
+
<Button label="Today" outlined action={today} />
|
78
|
+
<Button icon="chevron_right" action={next} />
|
73
79
|
</nav>
|
74
80
|
<header>
|
75
|
-
<div className='week-day-cell'>
|
76
|
-
<div className='week-day-cell'>
|
77
|
-
<div className='week-day-cell'>
|
78
|
-
<div className='week-day-cell'>
|
79
|
-
<div className='week-day-cell'>
|
80
|
-
<div className='week-day-cell'>
|
81
|
-
<div className='week-day-cell'>
|
81
|
+
<div className='week-day-cell'><Text>Mon</Text></div>
|
82
|
+
<div className='week-day-cell'><Text>Tue</Text></div>
|
83
|
+
<div className='week-day-cell'><Text>Wed</Text></div>
|
84
|
+
<div className='week-day-cell'><Text>Thu</Text></div>
|
85
|
+
<div className='week-day-cell'><Text>Fri</Text></div>
|
86
|
+
<div className='week-day-cell'><Text>Sat</Text></div>
|
87
|
+
<div className='week-day-cell'><Text>Sun</Text></div>
|
82
88
|
</header>
|
83
89
|
<main>
|
84
|
-
{cells.map(cell => <DayCell cell={cell} >{children}</DayCell>)}
|
90
|
+
{cells.map(cell => <DayCell key={cell.day} cell={cell} >{children}</DayCell>)}
|
85
91
|
</main>
|
86
92
|
</div>
|
87
93
|
)
|
@@ -89,11 +95,12 @@ export const Calendar = (props) => {
|
|
89
95
|
|
90
96
|
const DayCell = (props) => {
|
91
97
|
const { cell = [], children } = props
|
92
|
-
const {day, events} = cell
|
98
|
+
const { day, events } = cell
|
93
99
|
const todayStyle = day.isSame(moment(), 'day') ? 'today' : ''
|
100
|
+
const sameMonthStyle = day.isSame(moment(), 'month') ? '' : 'other-month'
|
94
101
|
|
95
102
|
return (
|
96
|
-
<div className={`day-cell ${todayStyle}`}>
|
103
|
+
<div className={`day-cell ${todayStyle} ${sameMonthStyle}`}>
|
97
104
|
<header>
|
98
105
|
{day.format("DD")}
|
99
106
|
</header>
|
@@ -6,9 +6,9 @@ const CalendarTest = (prop) => {
|
|
6
6
|
|
7
7
|
const events = [
|
8
8
|
{ id: 1, date: "2022-05-26", title: 'Event 1' },
|
9
|
-
{ id:
|
10
|
-
{ id:
|
11
|
-
|
9
|
+
{ id: 2, date: "2023-12-26", title: 'Event 2' },
|
10
|
+
{ id: 3, date: "2023-12-07", title: 'Event 3' },
|
11
|
+
|
12
12
|
]
|
13
13
|
|
14
14
|
return (
|
@@ -22,7 +22,7 @@ const CustomEvent = (props) => {
|
|
22
22
|
const { event } = props
|
23
23
|
return (
|
24
24
|
<div className="custom-event" onClick={() => alert("!xxx")}>
|
25
|
-
|
25
|
+
{event.title}
|
26
26
|
</div>
|
27
27
|
)
|
28
28
|
}
|