ywana-core8 0.0.515 → 0.0.518
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 +30 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +7 -0
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +30 -6
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +30 -6
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/domain/CollectionPage.js +5 -4
- package/src/widgets/planner/Planner.css +5 -0
- package/src/widgets/planner/Planner.js +23 -3
- package/src/widgets/planner/Planner.test.js +2 -2
- package/src/widgets/planner/Planner2.css +7 -0
package/package.json
CHANGED
@@ -22,7 +22,7 @@ export const CollectionPage = (props) => {
|
|
22
22
|
actions = [], onSelect,
|
23
23
|
canFilter = false, canAdd = false, canDelete = false, canEdit = false,
|
24
24
|
autosave = false, delay = 1000,
|
25
|
-
groupBy, levels,
|
25
|
+
groupBy, levels, sorter,
|
26
26
|
editor,
|
27
27
|
children
|
28
28
|
} = props
|
@@ -68,7 +68,7 @@ export const CollectionPage = (props) => {
|
|
68
68
|
<Header title={<Text>Lista de {name}</Text>} >
|
69
69
|
</Header>
|
70
70
|
{canFilter ? <CollectionFilters schema={schema}/> : null }
|
71
|
-
{levels ? <CollectionTree levels={levels} onSelect={onSelect}/> : <CollectionList groupBy={groupBy} onSelect={onSelect}/>}
|
71
|
+
{levels ? <CollectionTree levels={levels} onSelect={onSelect} sorter={sorter}/> : <CollectionList groupBy={groupBy} onSelect={onSelect}/>}
|
72
72
|
</menu>
|
73
73
|
<main key={id} className="collection-page">
|
74
74
|
<CollectionEditor icon={icon} schema={schema} layout={editor} autosave={autosave} delay={delay} />
|
@@ -166,7 +166,7 @@ const CollectionList = (props) => {
|
|
166
166
|
*/
|
167
167
|
export const CollectionTree = (props) => {
|
168
168
|
|
169
|
-
const { levels, onSelect } = props
|
169
|
+
const { levels, onSelect, sorter } = props
|
170
170
|
const [pageContext, setPageContext] = useContext(PageContext)
|
171
171
|
const { all = [] } = pageContext
|
172
172
|
|
@@ -213,7 +213,8 @@ export const CollectionTree = (props) => {
|
|
213
213
|
})
|
214
214
|
}
|
215
215
|
|
216
|
-
const
|
216
|
+
const items = sorter ? sorter(all) : all
|
217
|
+
const nodes = generateNodes(levels, items)
|
217
218
|
return (
|
218
219
|
<main>
|
219
220
|
<Tree>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React, { useEffect, useMemo, useState } from "react";
|
2
|
-
import { DropDown, Header, Icon, Text, TextField } from "../../html";
|
2
|
+
import { DropDown, Header, Icon, Text, TextField, Button } from "../../html";
|
3
3
|
import moment from "moment";
|
4
4
|
import { extendMoment } from "moment-range";
|
5
5
|
import "./Planner2.css";
|
@@ -21,6 +21,10 @@ export const Planner = ({ title, events = [], lanes = [], navigation = true, onS
|
|
21
21
|
const [from, setFrom] = useState(config.from);
|
22
22
|
const [to, setTo] = useState(config.to);
|
23
23
|
|
24
|
+
useEffect(() => {
|
25
|
+
showThisWeek()
|
26
|
+
}, [])
|
27
|
+
|
24
28
|
useEffect(() => {
|
25
29
|
const element = document.getElementById(focusEvent)
|
26
30
|
if (element) element.scrollIntoView({
|
@@ -60,6 +64,15 @@ export const Planner = ({ title, events = [], lanes = [], navigation = true, onS
|
|
60
64
|
if (onSelectCell) onSelectCell(lane, date);
|
61
65
|
}
|
62
66
|
|
67
|
+
function showThisWeek() {
|
68
|
+
const element = document.querySelector(".thisMonday")
|
69
|
+
if (element) element.scrollIntoView({
|
70
|
+
behavior: 'smooth',
|
71
|
+
block: 'start',
|
72
|
+
inline: 'start'
|
73
|
+
})
|
74
|
+
}
|
75
|
+
|
63
76
|
const period = useMemo(() => {
|
64
77
|
const start = ranges(from, "YYYY-MM-DD");
|
65
78
|
const end = ranges(to, "YYYY-MM-DD");
|
@@ -79,6 +92,8 @@ export const Planner = ({ title, events = [], lanes = [], navigation = true, onS
|
|
79
92
|
|
80
93
|
{navigation ? (
|
81
94
|
<Header title={label}>
|
95
|
+
|
96
|
+
<Button label="Esta Semana" outlined action={showThisWeek}/>
|
82
97
|
<Icon icon="chevron_right" clickable action={next} />
|
83
98
|
<TextField id="to" type="date" label="To" value={to} onChange={(id, value) => setTo(value)} />
|
84
99
|
<div className="expand"></div>
|
@@ -117,9 +132,10 @@ export const Planner = ({ title, events = [], lanes = [], navigation = true, onS
|
|
117
132
|
{period.map((date) => {
|
118
133
|
const isWekend = [0, 6].includes(date.moment.day());
|
119
134
|
const weekend = isWekend ? "weekend" : "";
|
135
|
+
const thisWeek = moment().startOf('week').isSame(date.moment, "week") ? "thisWeek" : "";
|
120
136
|
return (
|
121
137
|
<div className="column-header">
|
122
|
-
<div className={`date-header ${weekend}`}>
|
138
|
+
<div className={`date-header ${weekend} ${thisWeek}`}>
|
123
139
|
<Text use="headline6">{date.moment.format("DD")}</Text>
|
124
140
|
|
125
141
|
<Text use="caption">{date.moment.format("ddd")}</Text>
|
@@ -206,9 +222,13 @@ const PlannerCell = ({ lane, events, date, disabled = false, onAdd, onDelete, on
|
|
206
222
|
|
207
223
|
const isWekend = [0, 6].includes(date.moment.day());
|
208
224
|
const weekend = isWekend ? "weekend" : "";
|
225
|
+
|
226
|
+
const today = moment()
|
227
|
+
var weekStart = today.clone().startOf('week')
|
228
|
+
const thisMonday = (date.moment.isSame(weekStart)) ? "thisMonday" : ""
|
209
229
|
const dragOverStyle = dragOver ? "drag-over" : ""
|
210
230
|
return (
|
211
|
-
<div className={`cell ${weekend} ${dragOverStyle}`} onDragOver={onDragOver} onDragLeave={onDragLeave} onDrop={drop} onClick={select}>
|
231
|
+
<div className={`cell ${thisMonday} ${weekend} ${dragOverStyle}`} onDragOver={onDragOver} onDragLeave={onDragLeave} onDrop={drop} onClick={select}>
|
212
232
|
{events.map(event => {
|
213
233
|
const { Renderer = EventCard } = event
|
214
234
|
return <Renderer key={event.id} event={event} />
|
@@ -38,6 +38,13 @@
|
|
38
38
|
border-bottom: solid 1px var(--divider-color);
|
39
39
|
}
|
40
40
|
|
41
|
+
.planner .date-header.thisWeek {
|
42
|
+
background-color: rgb(10, 176, 35);
|
43
|
+
border-radius: 3px;
|
44
|
+
padding: .2rem;
|
45
|
+
color: var(--paper-color);
|
46
|
+
}
|
47
|
+
|
41
48
|
.planner .row-header {
|
42
49
|
width: var(--column-width);
|
43
50
|
background-color: var(--paper-color);
|