ywana-core8 0.0.942 → 0.0.944
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 +49 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +49 -10
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +49 -10
- 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/html/table.js +25 -3
- package/src/incubator/planner.js +10 -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/html/table.js
CHANGED
@@ -13,7 +13,7 @@ const isFunction = value => value && (Object.prototype.toString.call(value) ===
|
|
13
13
|
*/
|
14
14
|
export const DataTable = (props) => {
|
15
15
|
|
16
|
-
const { columns = [], rows = [], onRowSelection, onSort, onCheckAll, editable, outlined, expanded = false, className, emptyMessage = "No Results Found", multisort = false, filterable = false } = props
|
16
|
+
const { columns = [], rows = [], onRowSelection, onSort, onCheckAll, editable, outlined, expanded = false, className, emptyMessage = "No Results Found", multisort = false, filterable = false, onClearFilters } = props
|
17
17
|
const [sortDir, setSortDir] = useState({})
|
18
18
|
const [allChecked, setAllChecked] = useState(false)
|
19
19
|
|
@@ -145,19 +145,41 @@ export const DataTable = (props) => {
|
|
145
145
|
)
|
146
146
|
}
|
147
147
|
|
148
|
+
/**
|
149
|
+
* DataTableFiltersRow
|
150
|
+
*/
|
148
151
|
const DataTableFiltersRow = ({ columns }) => {
|
152
|
+
|
153
|
+
const [form, setForm] = useState({})
|
154
|
+
|
155
|
+
function changeFilter(id, value, onFilter) {
|
156
|
+
setForm({ ...form, [id]: value })
|
157
|
+
if (onFilter) onFilter(value)
|
158
|
+
}
|
159
|
+
|
160
|
+
function clear() {
|
161
|
+
setForm({})
|
162
|
+
}
|
163
|
+
|
164
|
+
const dirty = Object.keys(form).length > 0 // dirty if there are filters set
|
165
|
+
|
149
166
|
return (
|
150
167
|
<tr className="filters-row">
|
151
168
|
{columns.map(({ id, filterable, onFilter, options }) => {
|
152
169
|
|
153
|
-
const field = options ?
|
154
|
-
|
170
|
+
const field = options ?
|
171
|
+
<DropDown id={id} value={form[id]} options={options} onChange={(id,value) => changeFilter(id,value, onFilter)} outlined />
|
172
|
+
:
|
173
|
+
<TextField id={id} value={form[id]} onChange={(id,value) => changeFilter(id,value, onFilter)} outlined />
|
155
174
|
return (
|
156
175
|
<td className='filter-cell'>
|
157
176
|
{filterable ? field : null}
|
158
177
|
</td>
|
159
178
|
)
|
160
179
|
})}
|
180
|
+
<td>
|
181
|
+
<Icon icon="close" size="small" clickable action={clear} disabled={!dirty} />
|
182
|
+
</td>
|
161
183
|
</tr>
|
162
184
|
)
|
163
185
|
}
|
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
|
)
|