ywana-core8 0.0.865 → 0.0.866
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 +41 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +41 -30
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +41 -30
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/html/table.js +16 -1
package/package.json
CHANGED
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 } = props
|
16
|
+
const { columns = [], rows = [], onRowSelection, onSort, onCheckAll, editable, outlined, expanded = false, className, emptyMessage = "No Results Found", multisort = false, filterable = false } = props
|
17
17
|
const [sortDir, setSortDir] = useState({})
|
18
18
|
const [allChecked, setAllChecked] = useState(false)
|
19
19
|
|
@@ -122,6 +122,9 @@ export const DataTable = (props) => {
|
|
122
122
|
</tr>
|
123
123
|
</thead>
|
124
124
|
<tbody>
|
125
|
+
|
126
|
+
{ filterable ? <DataTableFiltersRow columns={columns} /> : null }
|
127
|
+
|
125
128
|
{rows.length > 0 ?
|
126
129
|
multiSort(rows, sortDir).map((row, index) => (
|
127
130
|
<DataTableRow key={row.id} index={index} row={row} columns={columns} onSelect={select} onDrop={moveRow} editable={editable} expanded={expanded} />
|
@@ -142,6 +145,18 @@ export const DataTable = (props) => {
|
|
142
145
|
)
|
143
146
|
}
|
144
147
|
|
148
|
+
const DataTableFiltersRow = ({ columns }) => {
|
149
|
+
return (
|
150
|
+
<tr className="filters-row">
|
151
|
+
{columns.map(({ id, filterable, onFilter }) => {
|
152
|
+
<td className='filter-cell'>
|
153
|
+
{ filterable ? <TextField id={id} onChange={onFilter} /> : null }
|
154
|
+
</td>
|
155
|
+
})}
|
156
|
+
</tr>
|
157
|
+
)
|
158
|
+
}
|
159
|
+
|
145
160
|
/**
|
146
161
|
* DataTable Row
|
147
162
|
*/
|