Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.
Allow function return type of getData in getFilterValueAccessor (#2708)
Igor Dykhta8e4d723b77cc
diff --git a/src/table/src/gpu-filter-utils.ts b/src/table/src/gpu-filter-utils.tsindex fab90ef38..ec600b799 100644--- a/src/table/src/gpu-filter-utils.ts+++ b/src/table/src/gpu-filter-utils.ts@@ -163,12 +163,18 @@ const getFilterValueAccessor =const fieldIndex = getDatasetFieldIndexForFilter(dataId, filter);const field = fields[fieldIndex];- const value =- filter.type === FILTER_TYPES.timeRange- ? field.filterProps && Array.isArray(field.filterProps.mappedValue)- ? field.filterProps.mappedValue[getIndex(d)]- : moment.utc(getData(dc, d, fieldIndex)).valueOf()- : getData(dc, d, fieldIndex);+ let value;+ const data = getData(dc, d, fieldIndex);+ if (typeof data === 'function') {+ value = data(field);+ } else {+ value =+ filter.type === FILTER_TYPES.timeRange+ ? field.filterProps && Array.isArray(field.filterProps.mappedValue)+ ? field.filterProps.mappedValue[getIndex(d)]+ : moment.utc(data).valueOf()+ : data;+ }return notNullorUndefined(value)? Array.isArray(value)