ywana-core8 0.0.287 → 0.0.290
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 +18 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +10 -0
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +18 -6
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +18 -6
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/domain/TablePage.js +0 -1
- package/src/html/table.js +4 -2
- package/src/html/table.test.js +31 -0
- package/src/site/site.css +10 -0
- package/src/site/site.js +4 -4
- package/src/site/site.test.js +15 -7
- package/src/widgets/planner/Planner.js +10 -1
- package/src/widgets/planner/Planner.test.js +16 -7
package/package.json
CHANGED
package/src/domain/TablePage.js
CHANGED
@@ -318,7 +318,6 @@ export const TableEditor = (props) => {
|
|
318
318
|
if (grouper.options) {
|
319
319
|
const options = CHECK['isFunction'](grouper.options) ? grouper.options() : grouper.options
|
320
320
|
const option = options.find(option => option.value === groupName)
|
321
|
-
console.log(groupName, options, option)
|
322
321
|
return option ? option.label : groupName
|
323
322
|
} else {
|
324
323
|
return groupName
|
package/src/html/table.js
CHANGED
@@ -54,7 +54,9 @@ export const DataTable = (props) => {
|
|
54
54
|
}
|
55
55
|
|
56
56
|
function select(row, event) {
|
57
|
-
if (
|
57
|
+
if (event.target.id !== "checked") {
|
58
|
+
if (onRowSelection) onRowSelection(row, event)
|
59
|
+
}
|
58
60
|
}
|
59
61
|
|
60
62
|
function sort(dragged, dropped) {
|
@@ -76,7 +78,7 @@ export const DataTable = (props) => {
|
|
76
78
|
const sort = sortDir[id] ? sortDir[id] : null
|
77
79
|
const [rowspan, colspan] = type === TYPES.ENTITY ? [1, Object.values(item).filter(v=>v.column===true).length] : [2, 1]
|
78
80
|
return (
|
79
|
-
<th rowSpan={rowspan} colSpan={colspan}>
|
81
|
+
<th key={id} rowSpan={rowspan} colSpan={colspan}>
|
80
82
|
{id === "checked" ? <CheckBox onChange={checkAll} /> : <Text key={`th_${id}`}>{label}</Text>}
|
81
83
|
{sortable ? <Icon icon="arrow_up" size="small" clickable /> : null}
|
82
84
|
</th>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import React, { useState } from 'react'
|
2
|
+
import { DataTable } from './table'
|
3
|
+
|
4
|
+
const TableTest = (prop) => {
|
5
|
+
|
6
|
+
function select(row) {
|
7
|
+
console.log('select',row)
|
8
|
+
}
|
9
|
+
|
10
|
+
function check(id,checked, c) {
|
11
|
+
console.log('check', id, checked, c)
|
12
|
+
}
|
13
|
+
|
14
|
+
const table = {
|
15
|
+
columns : [
|
16
|
+
{ id: "checked", onChange: check },
|
17
|
+
{ id: "name", label: "Name" },
|
18
|
+
|
19
|
+
],
|
20
|
+
rows: [
|
21
|
+
{ checked: true, name: "John Smith"},
|
22
|
+
{ checked: false, name: "Ann Martin"},
|
23
|
+
]
|
24
|
+
}
|
25
|
+
|
26
|
+
return (
|
27
|
+
<>
|
28
|
+
<DataTable {...table} onRowSelection={select}/>
|
29
|
+
</>
|
30
|
+
)
|
31
|
+
}
|
package/src/site/site.css
CHANGED
@@ -48,6 +48,10 @@
|
|
48
48
|
width: 20rem;
|
49
49
|
}
|
50
50
|
|
51
|
+
.site6>menu>main {
|
52
|
+
padding: .1rem;
|
53
|
+
}
|
54
|
+
|
51
55
|
.site6>menu>main>.site-menu-item {
|
52
56
|
width: 100%;
|
53
57
|
display: flex;
|
@@ -59,6 +63,12 @@
|
|
59
63
|
cursor: pointer;
|
60
64
|
}
|
61
65
|
|
66
|
+
.site6>menu>main>.site-menu-item.selected {
|
67
|
+
color: rgb(255, 255, 255);
|
68
|
+
background-color: rgb(60, 60, 60);
|
69
|
+
border-radius: .5rem;
|
70
|
+
}
|
71
|
+
|
62
72
|
.site6>menu>main {
|
63
73
|
flex: 1;
|
64
74
|
overflow-x: hidden;
|
package/src/site/site.js
CHANGED
@@ -166,7 +166,7 @@ const SiteAside = () => {
|
|
166
166
|
const SiteMenu = ({ logo, title, children, min }) => {
|
167
167
|
|
168
168
|
const context = useContext(SiteContext)
|
169
|
-
const { sideNav, setSideNav, showNav } = context
|
169
|
+
const { page, sideNav, setSideNav, showNav } = context
|
170
170
|
|
171
171
|
useEffect(() => {
|
172
172
|
if (min) context.setSideNav('min')
|
@@ -191,7 +191,6 @@ const SiteMenu = ({ logo, title, children, min }) => {
|
|
191
191
|
return sections
|
192
192
|
}, {}) : {}
|
193
193
|
|
194
|
-
|
195
194
|
const style = sideNav === 'max' ? 'max' : 'min'
|
196
195
|
const toggleIcon = sideNav === 'max' ? 'chevron_left' : 'chevron_right'
|
197
196
|
return (
|
@@ -200,9 +199,10 @@ const SiteMenu = ({ logo, title, children, min }) => {
|
|
200
199
|
{Object.keys(sections).map(title => (
|
201
200
|
<Fragment key={title}>
|
202
201
|
{sections[title].map(({ id, icon = 'info', title }) => {
|
202
|
+
const styleItem = id === page ? 'selected' : ''
|
203
203
|
return (
|
204
|
-
<div className=
|
205
|
-
<Icon key={id} icon={icon} clickable
|
204
|
+
<div className={`site-menu-item ${styleItem}`} key={id} onClick={() => goto(id)}>
|
205
|
+
<Icon key={id} icon={icon} clickable action={() => goto(id)} />
|
206
206
|
{ sideNav === 'max' ? <label>{title}</label> : null }
|
207
207
|
</div>
|
208
208
|
)
|
package/src/site/site.test.js
CHANGED
@@ -1,19 +1,18 @@
|
|
1
|
-
import React, { useContext, useEffect, useState } from 'react'
|
1
|
+
import React, { Fragment, useContext, useEffect, useState } from 'react'
|
2
|
+
import { SiteContext } from './siteContext'
|
2
3
|
import { Site } from './site'
|
3
4
|
import { Page } from './page'
|
4
5
|
import './site.css'
|
5
6
|
import './page.css'
|
6
|
-
import { Fragment } from 'react/cjs/react.production.min'
|
7
|
-
import { SiteContext } from './siteContext'
|
8
7
|
|
9
8
|
const SiteTest = (prop) => {
|
10
9
|
return (
|
11
|
-
<Site icon="star" title="Site Test" init={"
|
10
|
+
<Site icon="star" title="Site Test" init={"PAGE2"}>
|
12
11
|
<Page id="PAGE1" section="SECTION1" icon="description" title="Page 1" layout="workspace">
|
13
12
|
<Page1 />
|
14
13
|
</Page>
|
15
14
|
<Page id="PAGE2" section="SECTION1" icon="description" title="Page 2" layout="workspace">
|
16
|
-
|
15
|
+
<Page2 />
|
17
16
|
</Page>
|
18
17
|
</Site>
|
19
18
|
)
|
@@ -23,15 +22,24 @@ const Page1 = (props) => {
|
|
23
22
|
|
24
23
|
const site = useContext(SiteContext)
|
25
24
|
useEffect(() => {
|
26
|
-
|
27
25
|
site.notify({ title: "Notification 1", body: "Lorem ipsum dolor sit amet"})
|
28
26
|
}, [])
|
29
27
|
|
30
28
|
return (
|
31
29
|
<Fragment>
|
32
30
|
<header>Page 1</header>
|
33
|
-
<main
|
31
|
+
<main></main>
|
34
32
|
<footer>f1</footer>
|
35
33
|
</Fragment>
|
36
34
|
)
|
35
|
+
}
|
36
|
+
|
37
|
+
const Page2 = (props) => {
|
38
|
+
return (
|
39
|
+
<Fragment>
|
40
|
+
<header>Page 2</header>
|
41
|
+
<main></main>
|
42
|
+
<footer>f2</footer>
|
43
|
+
</Fragment>
|
44
|
+
)
|
37
45
|
}
|
@@ -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
|
|