@onehat/ui 0.3.120 → 0.3.122
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/package.json
CHANGED
|
@@ -44,6 +44,7 @@ export default function withFilters(WrappedComponent) {
|
|
|
44
44
|
customFilters = [], // of shape: { title, type, field, value, getRepoFilters(value) }
|
|
45
45
|
minFilters = 3,
|
|
46
46
|
maxFilters = 6,
|
|
47
|
+
onFilterChange,
|
|
47
48
|
|
|
48
49
|
// withData
|
|
49
50
|
Repository,
|
|
@@ -192,6 +193,9 @@ export default function withFilters(WrappedComponent) {
|
|
|
192
193
|
if (save && id) {
|
|
193
194
|
setSaved(id + '-filters', filters);
|
|
194
195
|
}
|
|
196
|
+
if (onFilterChange) {
|
|
197
|
+
onFilterChange(filters);
|
|
198
|
+
}
|
|
195
199
|
},
|
|
196
200
|
onFilterChangeValue = (field, value) => {
|
|
197
201
|
// handler for when a filter value changes
|
|
@@ -336,11 +340,15 @@ export default function withFilters(WrappedComponent) {
|
|
|
336
340
|
}
|
|
337
341
|
|
|
338
342
|
if (isUsingCustomFilters) {
|
|
339
|
-
_.each(filtersToUse, (
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
343
|
+
_.each(filtersToUse, ({ field, value, getRepoFilters }) => {
|
|
344
|
+
if (getRepoFilters) {
|
|
345
|
+
const repoFiltersFromFilter = getRepoFilters(value);
|
|
346
|
+
_.each(repoFiltersFromFilter, (repoFilter) => { // one custom filter might generate multiple filters for the repository
|
|
347
|
+
newRepoFilters.push(repoFilter);
|
|
348
|
+
});
|
|
349
|
+
} else {
|
|
350
|
+
newRepoFilters.push({ name: field, value, });
|
|
351
|
+
}
|
|
344
352
|
});
|
|
345
353
|
} else {
|
|
346
354
|
const newFilterNames = [];
|