ywana-core8 0.0.945 → 0.0.947
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 +5 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +5 -3
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +5 -3
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/html/table.js +7 -5
package/package.json
CHANGED
package/src/html/table.js
CHANGED
@@ -154,11 +154,12 @@ const DataTableFiltersRow = ({ columns }) => {
|
|
154
154
|
|
155
155
|
function changeFilter(id, value, onFilter) {
|
156
156
|
setForm({ ...form, [id]: value })
|
157
|
-
if (onFilter) onFilter(value)
|
157
|
+
if (onFilter) onFilter(id, value)
|
158
158
|
}
|
159
159
|
|
160
160
|
function clear() {
|
161
161
|
setForm({})
|
162
|
+
if (onFilter) onFilter({})
|
162
163
|
}
|
163
164
|
|
164
165
|
const dirty = Object.keys(form).length > 0 // dirty if there are filters set
|
@@ -167,10 +168,11 @@ const DataTableFiltersRow = ({ columns }) => {
|
|
167
168
|
<tr className="filters-row">
|
168
169
|
{columns.map(({ id, filterable, onFilter, options }) => {
|
169
170
|
|
170
|
-
const
|
171
|
-
|
172
|
-
|
173
|
-
|
171
|
+
const value = form[id] ? form[id] : ''
|
172
|
+
const field = options ?
|
173
|
+
<DropDown id={id} value={value} options={options} onChange={(id, value) => changeFilter(id, value, onFilter)} outlined />
|
174
|
+
:
|
175
|
+
<TextField id={id} value={value} onChange={(id, value) => changeFilter(id, value, onFilter)} outlined />
|
174
176
|
return (
|
175
177
|
<td className='filter-cell'>
|
176
178
|
{filterable ? field : null}
|