ywana-core8 0.0.941 → 0.0.943
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 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +17 -5
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +17 -5
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/html/tab.js +5 -4
- package/src/html/tab.test.js +11 -2
- package/src/incubator/planner.js +10 -1
- package/src/widgets/calendar/Calendar.js +2 -1
package/package.json
CHANGED
package/src/html/tab.js
CHANGED
@@ -10,7 +10,8 @@ export const Tabs = (props) => {
|
|
10
10
|
|
11
11
|
const { children, selected, onChange, fillLeft=false, fillRight=true } = props
|
12
12
|
|
13
|
-
const
|
13
|
+
const notNullChildren = React.Children.toArray(children).filter(child => child !== null)
|
14
|
+
const tabs = notNullChildren.map((child, index) => {
|
14
15
|
|
15
16
|
function select(id) {
|
16
17
|
if (onChange) onChange(id || index)
|
@@ -61,9 +62,9 @@ export const Tab = (props) => {
|
|
61
62
|
|
62
63
|
const { selected = 0 } = props
|
63
64
|
|
64
|
-
const
|
65
|
-
|
66
|
-
|
65
|
+
const notNullChildren = React.Children.toArray(props.children).filter(child => child !== null)
|
66
|
+
|
67
|
+
const child = notNullChildren.filter((child, index) => index === selected )[0]
|
67
68
|
|
68
69
|
return (
|
69
70
|
<Fragment>
|
package/src/html/tab.test.js
CHANGED
@@ -1,16 +1,25 @@
|
|
1
1
|
import React, { useState } from 'react'
|
2
|
-
import { Icon } from '.'
|
2
|
+
import { Icon, Stack } from '.'
|
3
3
|
import { Tabs, Tab } from './tab'
|
4
4
|
|
5
5
|
const TabTest = (prop) => {
|
6
6
|
|
7
|
+
const [selected, setSelected] = useState(0)
|
8
|
+
|
7
9
|
return (
|
8
10
|
<>
|
9
|
-
<Tabs>
|
11
|
+
<Tabs selected={selected} onChange={(id) => setSelected(id) }>
|
12
|
+
{null}
|
10
13
|
<Tab label="tab1" action={<Icon icon="close" size="small" />} />
|
11
14
|
<Tab label="tab2" action={<Icon icon="close" size="small" />} />
|
12
15
|
<Tab label="tab3" action={<Icon icon="close" size="small" />} />
|
13
16
|
</Tabs>
|
17
|
+
<Stack selected={selected}>
|
18
|
+
<div>Content 1</div>
|
19
|
+
{null}
|
20
|
+
<div>Content 2</div>
|
21
|
+
<div>Content 3</div>
|
22
|
+
</Stack>
|
14
23
|
</>
|
15
24
|
)
|
16
25
|
}
|
package/src/incubator/planner.js
CHANGED
@@ -41,6 +41,10 @@ export const Planner2 = ({ from, to, lanes = [], events = [], cellWidth = 10, ro
|
|
41
41
|
if (onSelectCell) onSelectCell(cell)
|
42
42
|
}
|
43
43
|
|
44
|
+
function drop() {
|
45
|
+
//TODO
|
46
|
+
}
|
47
|
+
|
44
48
|
const uniqueMonths = Array.from(
|
45
49
|
new Set(days.map(({ month }) => month))
|
46
50
|
);
|
@@ -108,7 +112,12 @@ export const Planner2 = ({ from, to, lanes = [], events = [], cellWidth = 10, ro
|
|
108
112
|
});
|
109
113
|
const weekendClass = isWeekend ? 'weekend' : '';
|
110
114
|
return (
|
111
|
-
<div
|
115
|
+
<div
|
116
|
+
key={`content${index}_${year}-${month}-${day}`}
|
117
|
+
className={`content-cell ${weekendClass}`} style={{ minWidth: dayWidth, maxWidth: dayWidth }}
|
118
|
+
onClick={() => selectCell({ lane: lane.id, date: dayDate })}
|
119
|
+
onDrop={drop}
|
120
|
+
>
|
112
121
|
{dayEvents.map((event, index) => <EventRenderer key={`${event.id}-${index}`} event={event} />)}
|
113
122
|
</div>
|
114
123
|
)
|
@@ -13,11 +13,12 @@ const moment = extendMoment(Moment)
|
|
13
13
|
*/
|
14
14
|
export const Calendar = (props) => {
|
15
15
|
|
16
|
-
const { events = [], children, onChange } = props
|
16
|
+
const { events = [], children, onChange, onRange } = props
|
17
17
|
const [range, setRange] = useState(props.range || "year")
|
18
18
|
|
19
19
|
function onChangeRange(range) {
|
20
20
|
setRange(range)
|
21
|
+
if (onRange) onRange(range)
|
21
22
|
}
|
22
23
|
|
23
24
|
return (
|