diff --git a/examples/parsersample.ts b/examples/parsersample.ts index f25d66ed3..2cc832489 100644 --- a/examples/parsersample.ts +++ b/examples/parsersample.ts @@ -16,6 +16,13 @@ export class SampleParser implements StyleParser { info: 'Blur is only partially supported' } } + }, + Function: { + acos: 'none', + strAbbreviate: { + support: 'partial', + info: 'Better use strSubstring instead.' + } } }; diff --git a/functions.ts b/functions.ts index 90c1575b7..5a24eb499 100644 --- a/functions.ts +++ b/functions.ts @@ -120,9 +120,9 @@ export interface Fatan2 extends FunctionCall { export interface Fbetween extends FunctionCall { name: 'between'; args: [ - Expression, - Expression, - Expression + Expression, + Expression, + Expression ]; }; diff --git a/style.ts b/style.ts index 6d4d10381..2ffb9eabb 100644 --- a/style.ts +++ b/style.ts @@ -1,5 +1,6 @@ import { GeoStylerBooleanFunction, + GeoStylerFunction, GeoStylerNumberFunction, GeoStylerStringFunction } from './functions'; @@ -80,12 +81,13 @@ export type RangeFilter = [ ]; /** - * A ComparisonFilter compares a value of an object (by key) with an expected - * value. + * A ComparisonFilter compares two values. + * If the fist argument is a GeoStylerFunction it will be evaluated it. + * If it is a string it will be treated as key of an object. */ export type ComparisonFilter = [ ComparisonOperator, - Expression, + Expression, Expression ] | RangeFilter; @@ -733,6 +735,9 @@ export interface UnsupportedProperties { [key in keyof Required]?: SupportDef }; }; + Function?: SupportDef | { + [key in GeoStylerFunction['name']]?: SupportDef; + }; } /**