@carto/api-client 0.5.1 → 0.5.2-alpha.0
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/build/api-client.cjs +79 -77
- package/build/api-client.cjs.map +1 -1
- package/build/api-client.d.cts +9 -1
- package/build/api-client.d.ts +9 -1
- package/build/api-client.js +77 -76
- package/build/api-client.js.map +1 -1
- package/build/worker.js +35 -33
- package/build/worker.js.map +1 -1
- package/package.json +3 -2
- package/src/filters.ts +37 -2
- package/src/utils.ts +0 -35
- package/src/widget-sources/widget-remote-source.ts +2 -1
- package/src/widget-sources/widget-tileset-source-impl.ts +2 -6
package/build/api-client.d.cts
CHANGED
|
@@ -1019,6 +1019,14 @@ type GetFilterOptions<T extends FilterType> = {
|
|
|
1019
1019
|
owner?: string;
|
|
1020
1020
|
};
|
|
1021
1021
|
declare function getFilter<T extends FilterType>(filters: Record<string, Filter>, { column, type, owner }: GetFilterOptions<T>): Filter[T] | null;
|
|
1022
|
+
/**
|
|
1023
|
+
* Given all filters for a dataset, returns the subset of filters that are not
|
|
1024
|
+
* attributable to the given owner. Typically used to allow filterable widgets
|
|
1025
|
+
* to affect other widgets *without* filtering themselves.
|
|
1026
|
+
*
|
|
1027
|
+
* @privateRemarks Source: @carto/react-widgets
|
|
1028
|
+
*/
|
|
1029
|
+
declare function getApplicableFilters(owner?: string, filters?: Record<string, Filter>): Record<string, Filter>;
|
|
1022
1030
|
|
|
1023
1031
|
/**
|
|
1024
1032
|
* Returns a {@link SpatialFilter} for a given viewport, typically obtained
|
|
@@ -1760,4 +1768,4 @@ declare function getColumnNameFromGeoColumn(geoColumn: string | null | undefined
|
|
|
1760
1768
|
*/
|
|
1761
1769
|
declare function getSpatialIndexFromGeoColumn(geoColumn: string): SpatialIndex | null;
|
|
1762
1770
|
|
|
1763
|
-
export { AGGREGATION, type APIErrorContext, type APIRequestType, type AddFilterOptions, type AggregationFunction, type AggregationType, ApiVersion, type Attribute, _default as BASEMAP, type BaseRequestOptions, type Basemap, type BoundaryQuerySourceOptions, type BoundaryQuerySourceResponse, type BoundaryTableSourceOptions, type BoundaryTableSourceResponse, CartoAPIError, type CategoryRequestOptions, type CategoryResponse, type ColumnsOption, DEFAULT_API_BASE_URL, FEATURE_GEOM_PROPERTY, type FeaturesRequestOptions, type FeaturesResponse, type FetchMapOptions, type FetchMapResult, type Filter, type FilterFunction, type FilterInterval, type FilterIntervalComplete, type FilterIntervalExtremum, type FilterLogicalOperator, type FilterOptions, FilterType, type Filters, type Format, type FormulaRequestOptions, type FormulaResponse, type GetFilterOptions, type GoogleBasemap, type GroupByFeature, type GroupDateType, type H3QuerySourceOptions, type H3QuerySourceResponse, type H3TableSourceOptions, type H3TableSourceResponse, type H3TilesetSourceOptions, type H3TilesetSourceResponse, type HasFilterOptions, type HistogramRequestOptions, type HistogramResponse, type KeplerMapConfig, type Layer, type LayerDescriptor, type LayerType, type MapLibreBasemap, type MapType, type NamedQueryParameter, OPACITY_MAP, type ParseMapResult, type PositionalQueryParameter, Provider, type ProviderType, type QuadbinQuerySourceOptions, type QuadbinQuerySourceResponse, type QuadbinTableSourceOptions, type QuadbinTableSourceResponse, type QuadbinTilesetSourceOptions, type QuadbinTilesetSourceResponse, type QueryOptions, type QueryParameterValue, type QueryParameters, type QueryResult, type QuerySourceOptions, type RangeRequestOptions, type RangeResponse, type Raster, RasterBandColorinterp, type RasterBandType, type RasterMetadata, type RasterMetadataBand, type RasterMetadataBandStats, type RasterSourceOptions, type RasterTile, type RemoveFilterOptions, type SCALE_TYPE, SOURCE_DEFAULTS, type ScatterPlotFeature, type ScatterRequestOptions, type ScatterResponse, type SortColumnType, type SortDirection, type SourceOptionalOptions, type SourceOptions, type SourceRequiredOptions, type SpatialDataType, type SpatialFilter, type SpatialFilterPolyfillMode, SpatialIndex, SpatialIndexColumn, type SpatialIndexTile, type StringSearchOptions, type TableRequestOptions, type TableResponse, type TableSourceOptions, type Tile, type TileFeatureExtractOptions, type TileFeatures, type TileFeaturesSpatialIndexOptions, TileFormat, type TileResolution, type Tilejson, type TilejsonResult, type TilesetSourceOptions, type Tilestats, type TimeSeriesRequestOptions, type TimeSeriesResponse, type VectorLayer, type VectorQuerySourceOptions, type VectorQuerySourceResponse, type VectorTableSourceOptions, type VectorTableSourceResponse, type VectorTilesetSourceOptions, type VectorTilesetSourceResponse, type ViewState, type Viewport, WidgetQuerySource, type WidgetQuerySourceResult, WidgetRasterSource, type WidgetRasterSourceProps, type WidgetRasterSourceResult, WidgetRemoteSource, type WidgetRemoteSourceProps, WidgetSource, type WidgetSourceProps, WidgetTableSource, type WidgetTableSourceResult, WidgetTilesetSource, type WidgetTilesetSourceProps, type WidgetTilesetSourceResult, type _DataFilterExtensionProps, _buildFeatureFilter, domainFromValues as _domainFromValues, _getHexagonResolution, addFilter, aggregate, aggregationFunctions, applyFilters, applySorting, boundaryQuerySource, boundaryTableSource, buildBinaryFeatureFilter, buildPublicMapUrl, buildStatsUrl, clearFilters, configureSource, createPolygonSpatialFilter, createViewportSpatialFilter, fetchBasemapProps, fetchMap, filterFunctions, geojsonFeatures, getClient, getColorAccessor, getColorValueAccessor, getColumnNameFromGeoColumn, getDataFilterExtensionProps, getFilter, getIconUrlAccessor, getLayerProps, getMaxMarkerSize, getSizeAccessor, getSpatialIndexFromGeoColumn, getTextAccessor, groupValuesByColumn, groupValuesByDateColumn, h3QuerySource, h3TableSource, h3TilesetSource, hasFilter, histogram, makeIntervalComplete, negateAccessor, opacityToAlpha, parseMap, quadbinQuerySource, quadbinTableSource, quadbinTilesetSource, query, rasterSource, removeFilter, requestWithParameters, scaleAggregationResLevel, scatterPlot, setClient, tileFeatures, tileFeaturesGeometries, tileFeaturesSpatialIndex, transformToTileCoords, vectorQuerySource, vectorTableSource, vectorTilesetSource };
|
|
1771
|
+
export { AGGREGATION, type APIErrorContext, type APIRequestType, type AddFilterOptions, type AggregationFunction, type AggregationType, ApiVersion, type Attribute, _default as BASEMAP, type BaseRequestOptions, type Basemap, type BoundaryQuerySourceOptions, type BoundaryQuerySourceResponse, type BoundaryTableSourceOptions, type BoundaryTableSourceResponse, CartoAPIError, type CategoryRequestOptions, type CategoryResponse, type ColumnsOption, DEFAULT_API_BASE_URL, FEATURE_GEOM_PROPERTY, type FeaturesRequestOptions, type FeaturesResponse, type FetchMapOptions, type FetchMapResult, type Filter, type FilterFunction, type FilterInterval, type FilterIntervalComplete, type FilterIntervalExtremum, type FilterLogicalOperator, type FilterOptions, FilterType, type Filters, type Format, type FormulaRequestOptions, type FormulaResponse, type GetFilterOptions, type GoogleBasemap, type GroupByFeature, type GroupDateType, type H3QuerySourceOptions, type H3QuerySourceResponse, type H3TableSourceOptions, type H3TableSourceResponse, type H3TilesetSourceOptions, type H3TilesetSourceResponse, type HasFilterOptions, type HistogramRequestOptions, type HistogramResponse, type KeplerMapConfig, type Layer, type LayerDescriptor, type LayerType, type MapLibreBasemap, type MapType, type NamedQueryParameter, OPACITY_MAP, type ParseMapResult, type PositionalQueryParameter, Provider, type ProviderType, type QuadbinQuerySourceOptions, type QuadbinQuerySourceResponse, type QuadbinTableSourceOptions, type QuadbinTableSourceResponse, type QuadbinTilesetSourceOptions, type QuadbinTilesetSourceResponse, type QueryOptions, type QueryParameterValue, type QueryParameters, type QueryResult, type QuerySourceOptions, type RangeRequestOptions, type RangeResponse, type Raster, RasterBandColorinterp, type RasterBandType, type RasterMetadata, type RasterMetadataBand, type RasterMetadataBandStats, type RasterSourceOptions, type RasterTile, type RemoveFilterOptions, type SCALE_TYPE, SOURCE_DEFAULTS, type ScatterPlotFeature, type ScatterRequestOptions, type ScatterResponse, type SortColumnType, type SortDirection, type SourceOptionalOptions, type SourceOptions, type SourceRequiredOptions, type SpatialDataType, type SpatialFilter, type SpatialFilterPolyfillMode, SpatialIndex, SpatialIndexColumn, type SpatialIndexTile, type StringSearchOptions, type TableRequestOptions, type TableResponse, type TableSourceOptions, type Tile, type TileFeatureExtractOptions, type TileFeatures, type TileFeaturesSpatialIndexOptions, TileFormat, type TileResolution, type Tilejson, type TilejsonResult, type TilesetSourceOptions, type Tilestats, type TimeSeriesRequestOptions, type TimeSeriesResponse, type VectorLayer, type VectorQuerySourceOptions, type VectorQuerySourceResponse, type VectorTableSourceOptions, type VectorTableSourceResponse, type VectorTilesetSourceOptions, type VectorTilesetSourceResponse, type ViewState, type Viewport, WidgetQuerySource, type WidgetQuerySourceResult, WidgetRasterSource, type WidgetRasterSourceProps, type WidgetRasterSourceResult, WidgetRemoteSource, type WidgetRemoteSourceProps, WidgetSource, type WidgetSourceProps, WidgetTableSource, type WidgetTableSourceResult, WidgetTilesetSource, type WidgetTilesetSourceProps, type WidgetTilesetSourceResult, type _DataFilterExtensionProps, _buildFeatureFilter, domainFromValues as _domainFromValues, _getHexagonResolution, addFilter, aggregate, aggregationFunctions, applyFilters, applySorting, boundaryQuerySource, boundaryTableSource, buildBinaryFeatureFilter, buildPublicMapUrl, buildStatsUrl, clearFilters, configureSource, createPolygonSpatialFilter, createViewportSpatialFilter, fetchBasemapProps, fetchMap, filterFunctions, geojsonFeatures, getApplicableFilters, getClient, getColorAccessor, getColorValueAccessor, getColumnNameFromGeoColumn, getDataFilterExtensionProps, getFilter, getIconUrlAccessor, getLayerProps, getMaxMarkerSize, getSizeAccessor, getSpatialIndexFromGeoColumn, getTextAccessor, groupValuesByColumn, groupValuesByDateColumn, h3QuerySource, h3TableSource, h3TilesetSource, hasFilter, histogram, makeIntervalComplete, negateAccessor, opacityToAlpha, parseMap, quadbinQuerySource, quadbinTableSource, quadbinTilesetSource, query, rasterSource, removeFilter, requestWithParameters, scaleAggregationResLevel, scatterPlot, setClient, tileFeatures, tileFeaturesGeometries, tileFeaturesSpatialIndex, transformToTileCoords, vectorQuerySource, vectorTableSource, vectorTilesetSource };
|
package/build/api-client.d.ts
CHANGED
|
@@ -1019,6 +1019,14 @@ type GetFilterOptions<T extends FilterType> = {
|
|
|
1019
1019
|
owner?: string;
|
|
1020
1020
|
};
|
|
1021
1021
|
declare function getFilter<T extends FilterType>(filters: Record<string, Filter>, { column, type, owner }: GetFilterOptions<T>): Filter[T] | null;
|
|
1022
|
+
/**
|
|
1023
|
+
* Given all filters for a dataset, returns the subset of filters that are not
|
|
1024
|
+
* attributable to the given owner. Typically used to allow filterable widgets
|
|
1025
|
+
* to affect other widgets *without* filtering themselves.
|
|
1026
|
+
*
|
|
1027
|
+
* @privateRemarks Source: @carto/react-widgets
|
|
1028
|
+
*/
|
|
1029
|
+
declare function getApplicableFilters(owner?: string, filters?: Record<string, Filter>): Record<string, Filter>;
|
|
1022
1030
|
|
|
1023
1031
|
/**
|
|
1024
1032
|
* Returns a {@link SpatialFilter} for a given viewport, typically obtained
|
|
@@ -1760,4 +1768,4 @@ declare function getColumnNameFromGeoColumn(geoColumn: string | null | undefined
|
|
|
1760
1768
|
*/
|
|
1761
1769
|
declare function getSpatialIndexFromGeoColumn(geoColumn: string): SpatialIndex | null;
|
|
1762
1770
|
|
|
1763
|
-
export { AGGREGATION, type APIErrorContext, type APIRequestType, type AddFilterOptions, type AggregationFunction, type AggregationType, ApiVersion, type Attribute, _default as BASEMAP, type BaseRequestOptions, type Basemap, type BoundaryQuerySourceOptions, type BoundaryQuerySourceResponse, type BoundaryTableSourceOptions, type BoundaryTableSourceResponse, CartoAPIError, type CategoryRequestOptions, type CategoryResponse, type ColumnsOption, DEFAULT_API_BASE_URL, FEATURE_GEOM_PROPERTY, type FeaturesRequestOptions, type FeaturesResponse, type FetchMapOptions, type FetchMapResult, type Filter, type FilterFunction, type FilterInterval, type FilterIntervalComplete, type FilterIntervalExtremum, type FilterLogicalOperator, type FilterOptions, FilterType, type Filters, type Format, type FormulaRequestOptions, type FormulaResponse, type GetFilterOptions, type GoogleBasemap, type GroupByFeature, type GroupDateType, type H3QuerySourceOptions, type H3QuerySourceResponse, type H3TableSourceOptions, type H3TableSourceResponse, type H3TilesetSourceOptions, type H3TilesetSourceResponse, type HasFilterOptions, type HistogramRequestOptions, type HistogramResponse, type KeplerMapConfig, type Layer, type LayerDescriptor, type LayerType, type MapLibreBasemap, type MapType, type NamedQueryParameter, OPACITY_MAP, type ParseMapResult, type PositionalQueryParameter, Provider, type ProviderType, type QuadbinQuerySourceOptions, type QuadbinQuerySourceResponse, type QuadbinTableSourceOptions, type QuadbinTableSourceResponse, type QuadbinTilesetSourceOptions, type QuadbinTilesetSourceResponse, type QueryOptions, type QueryParameterValue, type QueryParameters, type QueryResult, type QuerySourceOptions, type RangeRequestOptions, type RangeResponse, type Raster, RasterBandColorinterp, type RasterBandType, type RasterMetadata, type RasterMetadataBand, type RasterMetadataBandStats, type RasterSourceOptions, type RasterTile, type RemoveFilterOptions, type SCALE_TYPE, SOURCE_DEFAULTS, type ScatterPlotFeature, type ScatterRequestOptions, type ScatterResponse, type SortColumnType, type SortDirection, type SourceOptionalOptions, type SourceOptions, type SourceRequiredOptions, type SpatialDataType, type SpatialFilter, type SpatialFilterPolyfillMode, SpatialIndex, SpatialIndexColumn, type SpatialIndexTile, type StringSearchOptions, type TableRequestOptions, type TableResponse, type TableSourceOptions, type Tile, type TileFeatureExtractOptions, type TileFeatures, type TileFeaturesSpatialIndexOptions, TileFormat, type TileResolution, type Tilejson, type TilejsonResult, type TilesetSourceOptions, type Tilestats, type TimeSeriesRequestOptions, type TimeSeriesResponse, type VectorLayer, type VectorQuerySourceOptions, type VectorQuerySourceResponse, type VectorTableSourceOptions, type VectorTableSourceResponse, type VectorTilesetSourceOptions, type VectorTilesetSourceResponse, type ViewState, type Viewport, WidgetQuerySource, type WidgetQuerySourceResult, WidgetRasterSource, type WidgetRasterSourceProps, type WidgetRasterSourceResult, WidgetRemoteSource, type WidgetRemoteSourceProps, WidgetSource, type WidgetSourceProps, WidgetTableSource, type WidgetTableSourceResult, WidgetTilesetSource, type WidgetTilesetSourceProps, type WidgetTilesetSourceResult, type _DataFilterExtensionProps, _buildFeatureFilter, domainFromValues as _domainFromValues, _getHexagonResolution, addFilter, aggregate, aggregationFunctions, applyFilters, applySorting, boundaryQuerySource, boundaryTableSource, buildBinaryFeatureFilter, buildPublicMapUrl, buildStatsUrl, clearFilters, configureSource, createPolygonSpatialFilter, createViewportSpatialFilter, fetchBasemapProps, fetchMap, filterFunctions, geojsonFeatures, getClient, getColorAccessor, getColorValueAccessor, getColumnNameFromGeoColumn, getDataFilterExtensionProps, getFilter, getIconUrlAccessor, getLayerProps, getMaxMarkerSize, getSizeAccessor, getSpatialIndexFromGeoColumn, getTextAccessor, groupValuesByColumn, groupValuesByDateColumn, h3QuerySource, h3TableSource, h3TilesetSource, hasFilter, histogram, makeIntervalComplete, negateAccessor, opacityToAlpha, parseMap, quadbinQuerySource, quadbinTableSource, quadbinTilesetSource, query, rasterSource, removeFilter, requestWithParameters, scaleAggregationResLevel, scatterPlot, setClient, tileFeatures, tileFeaturesGeometries, tileFeaturesSpatialIndex, transformToTileCoords, vectorQuerySource, vectorTableSource, vectorTilesetSource };
|
|
1771
|
+
export { AGGREGATION, type APIErrorContext, type APIRequestType, type AddFilterOptions, type AggregationFunction, type AggregationType, ApiVersion, type Attribute, _default as BASEMAP, type BaseRequestOptions, type Basemap, type BoundaryQuerySourceOptions, type BoundaryQuerySourceResponse, type BoundaryTableSourceOptions, type BoundaryTableSourceResponse, CartoAPIError, type CategoryRequestOptions, type CategoryResponse, type ColumnsOption, DEFAULT_API_BASE_URL, FEATURE_GEOM_PROPERTY, type FeaturesRequestOptions, type FeaturesResponse, type FetchMapOptions, type FetchMapResult, type Filter, type FilterFunction, type FilterInterval, type FilterIntervalComplete, type FilterIntervalExtremum, type FilterLogicalOperator, type FilterOptions, FilterType, type Filters, type Format, type FormulaRequestOptions, type FormulaResponse, type GetFilterOptions, type GoogleBasemap, type GroupByFeature, type GroupDateType, type H3QuerySourceOptions, type H3QuerySourceResponse, type H3TableSourceOptions, type H3TableSourceResponse, type H3TilesetSourceOptions, type H3TilesetSourceResponse, type HasFilterOptions, type HistogramRequestOptions, type HistogramResponse, type KeplerMapConfig, type Layer, type LayerDescriptor, type LayerType, type MapLibreBasemap, type MapType, type NamedQueryParameter, OPACITY_MAP, type ParseMapResult, type PositionalQueryParameter, Provider, type ProviderType, type QuadbinQuerySourceOptions, type QuadbinQuerySourceResponse, type QuadbinTableSourceOptions, type QuadbinTableSourceResponse, type QuadbinTilesetSourceOptions, type QuadbinTilesetSourceResponse, type QueryOptions, type QueryParameterValue, type QueryParameters, type QueryResult, type QuerySourceOptions, type RangeRequestOptions, type RangeResponse, type Raster, RasterBandColorinterp, type RasterBandType, type RasterMetadata, type RasterMetadataBand, type RasterMetadataBandStats, type RasterSourceOptions, type RasterTile, type RemoveFilterOptions, type SCALE_TYPE, SOURCE_DEFAULTS, type ScatterPlotFeature, type ScatterRequestOptions, type ScatterResponse, type SortColumnType, type SortDirection, type SourceOptionalOptions, type SourceOptions, type SourceRequiredOptions, type SpatialDataType, type SpatialFilter, type SpatialFilterPolyfillMode, SpatialIndex, SpatialIndexColumn, type SpatialIndexTile, type StringSearchOptions, type TableRequestOptions, type TableResponse, type TableSourceOptions, type Tile, type TileFeatureExtractOptions, type TileFeatures, type TileFeaturesSpatialIndexOptions, TileFormat, type TileResolution, type Tilejson, type TilejsonResult, type TilesetSourceOptions, type Tilestats, type TimeSeriesRequestOptions, type TimeSeriesResponse, type VectorLayer, type VectorQuerySourceOptions, type VectorQuerySourceResponse, type VectorTableSourceOptions, type VectorTableSourceResponse, type VectorTilesetSourceOptions, type VectorTilesetSourceResponse, type ViewState, type Viewport, WidgetQuerySource, type WidgetQuerySourceResult, WidgetRasterSource, type WidgetRasterSourceProps, type WidgetRasterSourceResult, WidgetRemoteSource, type WidgetRemoteSourceProps, WidgetSource, type WidgetSourceProps, WidgetTableSource, type WidgetTableSourceResult, WidgetTilesetSource, type WidgetTilesetSourceProps, type WidgetTilesetSourceResult, type _DataFilterExtensionProps, _buildFeatureFilter, domainFromValues as _domainFromValues, _getHexagonResolution, addFilter, aggregate, aggregationFunctions, applyFilters, applySorting, boundaryQuerySource, boundaryTableSource, buildBinaryFeatureFilter, buildPublicMapUrl, buildStatsUrl, clearFilters, configureSource, createPolygonSpatialFilter, createViewportSpatialFilter, fetchBasemapProps, fetchMap, filterFunctions, geojsonFeatures, getApplicableFilters, getClient, getColorAccessor, getColorValueAccessor, getColumnNameFromGeoColumn, getDataFilterExtensionProps, getFilter, getIconUrlAccessor, getLayerProps, getMaxMarkerSize, getSizeAccessor, getSpatialIndexFromGeoColumn, getTextAccessor, groupValuesByColumn, groupValuesByDateColumn, h3QuerySource, h3TableSource, h3TilesetSource, hasFilter, histogram, makeIntervalComplete, negateAccessor, opacityToAlpha, parseMap, quadbinQuerySource, quadbinTableSource, quadbinTilesetSource, query, rasterSource, removeFilter, requestWithParameters, scaleAggregationResLevel, scatterPlot, setClient, tileFeatures, tileFeaturesGeometries, tileFeaturesSpatialIndex, transformToTileCoords, vectorQuerySource, vectorTableSource, vectorTilesetSource };
|
package/build/api-client.js
CHANGED
|
@@ -10894,24 +10894,6 @@ function isValidBandValue(value, nodata) {
|
|
|
10894
10894
|
}
|
|
10895
10895
|
|
|
10896
10896
|
// src/utils.ts
|
|
10897
|
-
var FILTER_TYPES = new Set(Object.values(FilterType));
|
|
10898
|
-
var isFilterType = (type) => FILTER_TYPES.has(type);
|
|
10899
|
-
function getApplicableFilters(owner, filters) {
|
|
10900
|
-
if (!filters) return {};
|
|
10901
|
-
const applicableFilters = {};
|
|
10902
|
-
for (const column in filters) {
|
|
10903
|
-
for (const type in filters[column]) {
|
|
10904
|
-
if (!isFilterType(type)) continue;
|
|
10905
|
-
const filter = filters[column][type];
|
|
10906
|
-
const isApplicable = !owner || !filter?.owner || filter?.owner !== owner;
|
|
10907
|
-
if (filter && isApplicable) {
|
|
10908
|
-
applicableFilters[column] || (applicableFilters[column] = {});
|
|
10909
|
-
applicableFilters[column][type] = filter;
|
|
10910
|
-
}
|
|
10911
|
-
}
|
|
10912
|
-
}
|
|
10913
|
-
return applicableFilters;
|
|
10914
|
-
}
|
|
10915
10897
|
function normalizeObjectKeys(el) {
|
|
10916
10898
|
if (Array.isArray(el)) {
|
|
10917
10899
|
return el.map((value) => normalizeObjectKeys(value));
|
|
@@ -11558,6 +11540,82 @@ function objectToURLSearchParams(object) {
|
|
|
11558
11540
|
return params;
|
|
11559
11541
|
}
|
|
11560
11542
|
|
|
11543
|
+
// src/filters.ts
|
|
11544
|
+
var FILTER_TYPES = new Set(Object.values(FilterType));
|
|
11545
|
+
var isFilterType = (type) => FILTER_TYPES.has(type);
|
|
11546
|
+
function addFilter(filters, { column, type, values, owner }) {
|
|
11547
|
+
if (!filters[column]) {
|
|
11548
|
+
filters[column] = {};
|
|
11549
|
+
}
|
|
11550
|
+
const filter = { values, owner };
|
|
11551
|
+
filters[column][type] = filter;
|
|
11552
|
+
return filters;
|
|
11553
|
+
}
|
|
11554
|
+
function removeFilter(filters, { column, owner }) {
|
|
11555
|
+
const filter = filters[column];
|
|
11556
|
+
if (!filter) {
|
|
11557
|
+
return filters;
|
|
11558
|
+
}
|
|
11559
|
+
if (owner) {
|
|
11560
|
+
for (const type of FILTER_TYPES) {
|
|
11561
|
+
if (owner === filter[type]?.owner) {
|
|
11562
|
+
delete filter[type];
|
|
11563
|
+
}
|
|
11564
|
+
}
|
|
11565
|
+
}
|
|
11566
|
+
if (!owner || isEmptyObject(filter)) {
|
|
11567
|
+
delete filters[column];
|
|
11568
|
+
}
|
|
11569
|
+
return filters;
|
|
11570
|
+
}
|
|
11571
|
+
function clearFilters(filters) {
|
|
11572
|
+
for (const column of Object.keys(filters)) {
|
|
11573
|
+
delete filters[column];
|
|
11574
|
+
}
|
|
11575
|
+
return filters;
|
|
11576
|
+
}
|
|
11577
|
+
function hasFilter(filters, { column, owner }) {
|
|
11578
|
+
const filter = filters[column];
|
|
11579
|
+
if (!filter) {
|
|
11580
|
+
return false;
|
|
11581
|
+
}
|
|
11582
|
+
if (!owner) {
|
|
11583
|
+
return true;
|
|
11584
|
+
}
|
|
11585
|
+
for (const type of FILTER_TYPES) {
|
|
11586
|
+
if (owner === filter[type]?.owner) {
|
|
11587
|
+
return true;
|
|
11588
|
+
}
|
|
11589
|
+
}
|
|
11590
|
+
return false;
|
|
11591
|
+
}
|
|
11592
|
+
function getFilter(filters, { column, type, owner }) {
|
|
11593
|
+
const filter = filters[column];
|
|
11594
|
+
if (!filter) {
|
|
11595
|
+
return null;
|
|
11596
|
+
}
|
|
11597
|
+
if (!owner || owner === filter[type]?.owner) {
|
|
11598
|
+
return filter[type] || null;
|
|
11599
|
+
}
|
|
11600
|
+
return null;
|
|
11601
|
+
}
|
|
11602
|
+
function getApplicableFilters(owner, filters) {
|
|
11603
|
+
if (!filters) return {};
|
|
11604
|
+
const applicableFilters = {};
|
|
11605
|
+
for (const column in filters) {
|
|
11606
|
+
for (const type in filters[column]) {
|
|
11607
|
+
if (!isFilterType(type)) continue;
|
|
11608
|
+
const filter = filters[column][type];
|
|
11609
|
+
const isApplicable = !owner || !filter?.owner || filter?.owner !== owner;
|
|
11610
|
+
if (filter && isApplicable) {
|
|
11611
|
+
applicableFilters[column] || (applicableFilters[column] = {});
|
|
11612
|
+
applicableFilters[column][type] = filter;
|
|
11613
|
+
}
|
|
11614
|
+
}
|
|
11615
|
+
}
|
|
11616
|
+
return applicableFilters;
|
|
11617
|
+
}
|
|
11618
|
+
|
|
11561
11619
|
// src/widget-sources/widget-remote-source.ts
|
|
11562
11620
|
var WidgetRemoteSource = class extends WidgetSource {
|
|
11563
11621
|
_getModelSource(filters, filterOwner) {
|
|
@@ -15160,64 +15218,6 @@ async function fetchMap({
|
|
|
15160
15218
|
return out;
|
|
15161
15219
|
}
|
|
15162
15220
|
|
|
15163
|
-
// src/filters.ts
|
|
15164
|
-
function addFilter(filters, { column, type, values, owner }) {
|
|
15165
|
-
if (!filters[column]) {
|
|
15166
|
-
filters[column] = {};
|
|
15167
|
-
}
|
|
15168
|
-
const filter = { values, owner };
|
|
15169
|
-
filters[column][type] = filter;
|
|
15170
|
-
return filters;
|
|
15171
|
-
}
|
|
15172
|
-
function removeFilter(filters, { column, owner }) {
|
|
15173
|
-
const filter = filters[column];
|
|
15174
|
-
if (!filter) {
|
|
15175
|
-
return filters;
|
|
15176
|
-
}
|
|
15177
|
-
if (owner) {
|
|
15178
|
-
for (const type of Object.values(FilterType)) {
|
|
15179
|
-
if (owner === filter[type]?.owner) {
|
|
15180
|
-
delete filter[type];
|
|
15181
|
-
}
|
|
15182
|
-
}
|
|
15183
|
-
}
|
|
15184
|
-
if (!owner || isEmptyObject(filter)) {
|
|
15185
|
-
delete filters[column];
|
|
15186
|
-
}
|
|
15187
|
-
return filters;
|
|
15188
|
-
}
|
|
15189
|
-
function clearFilters(filters) {
|
|
15190
|
-
for (const column of Object.keys(filters)) {
|
|
15191
|
-
delete filters[column];
|
|
15192
|
-
}
|
|
15193
|
-
return filters;
|
|
15194
|
-
}
|
|
15195
|
-
function hasFilter(filters, { column, owner }) {
|
|
15196
|
-
const filter = filters[column];
|
|
15197
|
-
if (!filter) {
|
|
15198
|
-
return false;
|
|
15199
|
-
}
|
|
15200
|
-
if (!owner) {
|
|
15201
|
-
return true;
|
|
15202
|
-
}
|
|
15203
|
-
for (const type of Object.values(FilterType)) {
|
|
15204
|
-
if (owner === filter[type]?.owner) {
|
|
15205
|
-
return true;
|
|
15206
|
-
}
|
|
15207
|
-
}
|
|
15208
|
-
return false;
|
|
15209
|
-
}
|
|
15210
|
-
function getFilter(filters, { column, type, owner }) {
|
|
15211
|
-
const filter = filters[column];
|
|
15212
|
-
if (!filter) {
|
|
15213
|
-
return null;
|
|
15214
|
-
}
|
|
15215
|
-
if (!owner || owner === filter[type]?.owner) {
|
|
15216
|
-
return filter[type] || null;
|
|
15217
|
-
}
|
|
15218
|
-
return null;
|
|
15219
|
-
}
|
|
15220
|
-
|
|
15221
15221
|
// node_modules/@turf/union/dist/esm/index.js
|
|
15222
15222
|
function union2(features, options = {}) {
|
|
15223
15223
|
const geoms = [];
|
|
@@ -15394,6 +15394,7 @@ export {
|
|
|
15394
15394
|
fetchMap,
|
|
15395
15395
|
filterFunctions,
|
|
15396
15396
|
geojsonFeatures,
|
|
15397
|
+
getApplicableFilters,
|
|
15397
15398
|
getClient,
|
|
15398
15399
|
getColorAccessor,
|
|
15399
15400
|
getColorValueAccessor,
|