ywana-core8 0.0.288 → 0.0.289
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 +11 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +11 -1
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +11 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/html/table.js +1 -1
- package/src/widgets/planner/Planner.js +10 -1
- package/src/widgets/planner/Planner.test.js +16 -7
package/package.json
CHANGED
package/src/html/table.js
CHANGED
@@ -78,7 +78,7 @@ export const DataTable = (props) => {
|
|
78
78
|
const sort = sortDir[id] ? sortDir[id] : null
|
79
79
|
const [rowspan, colspan] = type === TYPES.ENTITY ? [1, Object.values(item).filter(v=>v.column===true).length] : [2, 1]
|
80
80
|
return (
|
81
|
-
<th rowSpan={rowspan} colSpan={colspan}>
|
81
|
+
<th key={id} rowSpan={rowspan} colSpan={colspan}>
|
82
82
|
{id === "checked" ? <CheckBox onChange={checkAll} /> : <Text key={`th_${id}`}>{label}</Text>}
|
83
83
|
{sortable ? <Icon icon="arrow_up" size="small" clickable /> : null}
|
84
84
|
</th>
|
@@ -14,12 +14,21 @@ const DATE_RANGE = [
|
|
14
14
|
/**
|
15
15
|
* Planner
|
16
16
|
*/
|
17
|
-
export const Planner = ({ title, events = [], lanes = [], navigation = true, onSelectCell }) => {
|
17
|
+
export const Planner = ({ title, events = [], lanes = [], navigation = true, onSelectCell, focusEvent }) => {
|
18
18
|
|
19
19
|
const [dateRange, setDateRange] = useState("month");
|
20
20
|
const [from, setFrom] = useState("2021-02-26");
|
21
21
|
const [to, setTo] = useState("2021-04-01");
|
22
22
|
|
23
|
+
useEffect(() => {
|
24
|
+
const element = document.getElementById(focusEvent)
|
25
|
+
if (element) element.scrollIntoView({
|
26
|
+
behavior: 'smooth',
|
27
|
+
block: 'start',
|
28
|
+
inline: 'center'
|
29
|
+
})
|
30
|
+
}, [focusEvent])
|
31
|
+
|
23
32
|
useEffect(() => {
|
24
33
|
const today = moment();
|
25
34
|
const from_date = today.startOf(dateRange).format("YYYY-MM-DD");
|
@@ -1,13 +1,13 @@
|
|
1
|
-
import React from 'react'
|
1
|
+
import React, {useEffect, useState} from 'react'
|
2
2
|
import { Planner } from './Planner'
|
3
3
|
|
4
4
|
const EventCard = (props) => {
|
5
|
-
const { event } = props
|
6
|
-
const { title, color } = event
|
5
|
+
const { event={} } = props
|
6
|
+
const { id, title, color } = event
|
7
7
|
|
8
8
|
let style = { backgroundColor : "red", color: "white" }
|
9
9
|
return (
|
10
|
-
<div className={`event-card`} style={style}>
|
10
|
+
<div id={id} className={`event-card`} style={style}>
|
11
11
|
{title}
|
12
12
|
</div>
|
13
13
|
)
|
@@ -15,6 +15,12 @@ const EventCard = (props) => {
|
|
15
15
|
|
16
16
|
const PlannerTest = (prop) => {
|
17
17
|
|
18
|
+
const [event, setEvent] = useState()
|
19
|
+
|
20
|
+
useEffect(() => {
|
21
|
+
setEvent("3")
|
22
|
+
}, [])
|
23
|
+
|
18
24
|
const lanes = [
|
19
25
|
{ id: "lane1", label: "Lane 1" },
|
20
26
|
{ id: "lane2", label: "Lane 2" },
|
@@ -26,12 +32,15 @@ const PlannerTest = (prop) => {
|
|
26
32
|
]
|
27
33
|
|
28
34
|
const events = [
|
29
|
-
{ lane: "lane1", date: "2022-
|
35
|
+
{ id: "1", lane: "lane1", date: "2022-03-01", color: "red", title : "Event One", Renderer: EventCard },
|
36
|
+
{ id: "2", lane: "lane1", date: "2022-03-22", color: "red", title : "Event One", Renderer: EventCard },
|
37
|
+
{ id: "3", lane: "lane1", date: "2022-04-03", color: "red", title : "Event One", Renderer: EventCard },
|
38
|
+
{ id: "4", lane: "lane1", date: "2022-03-04", color: "red", title : "Event One", Renderer: EventCard },
|
30
39
|
]
|
31
40
|
|
41
|
+
|
32
42
|
return (
|
33
|
-
|
34
|
-
<Planner title="Planner 1" lanes={lanes} events={events} navigation={true} onSelectCell={console.log}>
|
43
|
+
<Planner title="Planner 1" lanes={lanes} events={events} navigation={true} onSelectCell={console.log} focusEvent={event}>
|
35
44
|
|
36
45
|
</Planner>
|
37
46
|
|