@kronor/dtv 7.7.3 → 8.0.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.
@@ -1,58 +1,150 @@
1
1
  import * as React from 'react';
2
- import type { FilterControl as FrameworkFilterControl, SuggestionFetcher } from '../framework/filters';
3
- export type { SuggestionFetcher };
2
+ import type { FilterControl as FrameworkFilterControl, SuggestionFetcher, SuggestionItem } from '../framework/filters';
3
+ import type * as FilterValue from '../framework/filterValue';
4
+ import type { MutableTuple } from './filterTyping';
5
+ export type { SuggestionFetcher, SuggestionItem };
4
6
  export type FilterControl = FrameworkFilterControl;
7
+ /**
8
+ * The controls below return their own variant of `FilterControl` rather than
9
+ * the whole union, and keep inline `items`/`operators` lists as tuples. That
10
+ * lets `filter({ rowType })` check the control against the type of the field
11
+ * it filters — see ./filterTyping.
12
+ */
13
+ type ControlOfType<Type extends FrameworkFilterControl['type']> = Extract<FrameworkFilterControl, {
14
+ type: Type;
15
+ }>;
16
+ export type TextControl = ControlOfType<'text'>;
17
+ export type NumberControl = ControlOfType<'number'>;
18
+ export type DateControl = ControlOfType<'date'>;
19
+ export type AutocompleteControl<Item extends SuggestionItem = SuggestionItem, Multiple extends boolean = false> = Omit<ControlOfType<'autocomplete'>, 'suggestionFetcher' | 'multiple'> & {
20
+ suggestionFetcher: SuggestionFetcher<Item>;
21
+ multiple?: Multiple;
22
+ };
23
+ export type CustomControl<Component extends React.ComponentType<any> = React.ComponentType<any>> = Omit<ControlOfType<'custom'>, 'component'> & {
24
+ component: Component;
25
+ };
26
+ export type ItemControlItem = {
27
+ label: string;
28
+ value: unknown;
29
+ };
30
+ export type DropdownControl<Items extends readonly ItemControlItem[]> = Omit<ControlOfType<'dropdown'>, 'items'> & {
31
+ items: MutableTuple<Items>;
32
+ };
33
+ export type MultiselectControl<Items extends readonly ItemControlItem[]> = Omit<ControlOfType<'multiselect'>, 'items'> & {
34
+ items: MutableTuple<Items>;
35
+ };
36
+ export type CustomOperatorControl<Operators extends readonly {
37
+ label: string;
38
+ value: string;
39
+ }[], ValueControl extends FrameworkFilterControl> = Omit<ControlOfType<'customOperator'>, 'operators' | 'valueControl'> & {
40
+ operators: MutableTuple<Operators>;
41
+ valueControl: ValueControl;
42
+ };
43
+ /**
44
+ * Every control can be seeded with a starting value, typed as the value that
45
+ * control produces (see `ControlValue` below) so a default cannot be of the
46
+ * wrong shape for its own input.
47
+ *
48
+ * `customOperator` is the exception: its `initialValue` seeds the *inner*
49
+ * value, alongside `valueControl.initialValue`, rather than the
50
+ * `{ operator, value }` pair the control stores — see `buildInitialFormState`
51
+ * in framework/state.
52
+ */
5
53
  export declare const FilterControl: {
6
54
  text: (options?: {
7
55
  label?: string;
8
56
  placeholder?: string;
9
- }) => FrameworkFilterControl;
57
+ initialValue?: ControlValue<TextControl>;
58
+ }) => TextControl;
10
59
  number: (options?: {
11
60
  label?: string;
12
61
  placeholder?: string;
13
- initialValue?: any;
14
- }) => FrameworkFilterControl;
62
+ initialValue?: ControlValue<NumberControl>;
63
+ }) => NumberControl;
15
64
  date: (options?: {
16
65
  label?: string;
17
66
  placeholder?: string;
18
67
  showTime?: boolean;
19
- initialValue?: any;
20
- }) => FrameworkFilterControl;
21
- dropdown: (options: {
22
- label?: string;
23
- items: {
24
- label: string;
25
- value: any;
26
- }[];
68
+ initialValue?: ControlValue<DateControl>;
69
+ }) => DateControl;
70
+ dropdown: <const Items extends readonly ItemControlItem[]>(options: {
71
+ label?: string;
72
+ items: Items;
27
73
  filterable?: boolean;
28
- }) => FrameworkFilterControl;
29
- multiselect: (options: {
74
+ initialValue?: ControlValue<DropdownControl<Items>>;
75
+ }) => DropdownControl<Items>;
76
+ multiselect: <const Items extends readonly ItemControlItem[]>(options: {
30
77
  label?: string;
31
- items: {
32
- label: string;
33
- value: any;
34
- }[];
78
+ items: Items;
35
79
  filterable?: boolean;
36
- }) => FrameworkFilterControl;
37
- customOperator: (options: {
80
+ initialValue?: ControlValue<MultiselectControl<Items>>;
81
+ }) => MultiselectControl<Items>;
82
+ customOperator: <const Operators extends readonly {
83
+ label: string;
84
+ value: string;
85
+ }[], const ValueControl extends FrameworkFilterControl>(options: {
38
86
  label?: string;
39
- operators: {
40
- label: string;
41
- value: string;
42
- }[];
43
- valueControl: FrameworkFilterControl;
44
- }) => FrameworkFilterControl;
45
- autocomplete: (options: {
87
+ operators: Operators;
88
+ valueControl: ValueControl;
89
+ initialValue?: ControlValue<ValueControl>;
90
+ }) => CustomOperatorControl<Operators, ValueControl>;
91
+ autocomplete: <Item extends SuggestionItem, const Multiple extends boolean = false>(options: {
46
92
  label?: string;
47
93
  placeholder?: string;
48
- suggestionFetcher: SuggestionFetcher;
94
+ suggestionFetcher: SuggestionFetcher<Item>;
49
95
  queryMinLength?: number;
50
96
  suggestionLabelField?: string;
51
- multiple?: boolean;
97
+ multiple?: Multiple;
52
98
  selectionLimit?: number;
53
- }) => FrameworkFilterControl;
54
- custom: (component: React.ComponentType<any>, options?: {
99
+ initialValue?: ControlValue<AutocompleteControl<Item, Multiple>>;
100
+ }) => AutocompleteControl<Item, Multiple>;
101
+ custom: <const Component extends React.ComponentType<any>>(component: Component, options?: {
55
102
  label?: string;
56
103
  props?: Record<string, any>;
57
- }) => FrameworkFilterControl;
104
+ initialValue?: ControlValue<CustomControl<Component>>;
105
+ }) => CustomControl<Component>;
58
106
  };
107
+ /**
108
+ * The value a control hands to its filter's query transform — what the form
109
+ * stores for it, which is also what `FilterTransform`'s `input` receives.
110
+ * Mirrors `renderInput` in components/FilterForm.tsx.
111
+ *
112
+ * `unknown` where the control cannot say: a `custom` component that does not
113
+ * type its `onChange`, or item/operator lists assembled at runtime.
114
+ */
115
+ export type ControlValue<Control> = Control extends {
116
+ type: 'text';
117
+ } ? string : Control extends {
118
+ type: 'number';
119
+ } ? number | null : Control extends {
120
+ type: 'date';
121
+ } ? Date : Control extends {
122
+ type: 'dropdown';
123
+ items: infer Items;
124
+ } ? ItemValue<Items> : Control extends {
125
+ type: 'multiselect';
126
+ items: infer Items;
127
+ } ? ItemValue<Items>[] : Control extends {
128
+ type: 'customOperator';
129
+ operators: infer Operators;
130
+ } ? {
131
+ operator: OperatorValue<Operators>;
132
+ value: FilterValue.FilterValue;
133
+ } : Control extends {
134
+ type: 'autocomplete';
135
+ suggestionFetcher: SuggestionFetcher<infer Item>;
136
+ multiple?: infer Multiple;
137
+ } ? SelectedSuggestion<Item, Multiple> : Control extends {
138
+ type: 'custom';
139
+ component: infer Component;
140
+ } ? CustomComponentValue<Component> : unknown;
141
+ type ItemValue<Items> = Items extends readonly {
142
+ value: infer Value;
143
+ }[] ? Value : unknown;
144
+ type OperatorValue<Operators> = Operators extends readonly {
145
+ value: infer Operator;
146
+ }[] ? Operator : string;
147
+ type SelectedSuggestion<Item, Multiple> = Exclude<Multiple, undefined> extends infer Many ? [Many] extends [never] ? Item : boolean extends Many ? Item | Item[] : Many extends true ? Item[] : Item : never;
148
+ type CustomComponentValue<Component> = Component extends React.ComponentType<infer Props> ? Props extends {
149
+ onChange?: ((value: infer Value) => void) | undefined;
150
+ } ? Value : unknown : unknown;
@@ -1,128 +1,94 @@
1
1
  import type { ConditionOnlyTransform, FilterControl, FilterExpr as FilterExprType, FilterField, FilterTransform } from '../framework/filters';
2
+ import type { ControlValue } from './filterControl';
3
+ import type { FilterLeafOperator } from './filterTyping';
2
4
  export type { ConditionOnlyTransform, FilterField, FilterTransform };
3
5
  export type FilterExpr = FilterExprType;
6
+ /**
7
+ * A leaf built by the helpers below. Field and control are kept as given:
8
+ * `filter({ rowType })` needs them to check the control and the operator
9
+ * against the type of the field being filtered (see ./filterTyping).
10
+ */
11
+ export type FilterExprLeaf<Type extends FilterLeafOperator, Field extends FilterField, Control extends FilterControl> = {
12
+ type: Type;
13
+ field: Field;
14
+ value: Control;
15
+ /** Shown by the applied-filter pill in place of the field path. */
16
+ fieldLabel?: string;
17
+ };
18
+ /** A leaf whose value passes through a transform on its way to the query. */
19
+ export type FilterExprLeafWithTransform<Type extends FilterLeafOperator, Field extends FilterField, Control extends FilterControl, Transform extends FilterTransform<any>> = FilterExprLeaf<Type, Field, Control> & {
20
+ transform: Transform;
21
+ };
22
+ type IsAny<T> = 0 extends 1 & T ? true : false;
23
+ type Exactly<A, B> = [A] extends [B] ? ([B] extends [A] ? true : false) : false;
24
+ /**
25
+ * Whether a transform was actually passed.
26
+ *
27
+ * It cannot be read from the presence of the property, because a transform's
28
+ * `input` is typed by making `Transform` a parameter constrained to
29
+ * `FilterTransform<ControlValue<Control>>` — a parameter's constraint is the
30
+ * only thing that contextually types a callback parameter, and an intersection
31
+ * member is not. So when the property is omitted, `Transform` lands on that
32
+ * constraint rather than on nothing.
33
+ *
34
+ * The constraint is distinguishable, though: its `toQuery` is optional and its
35
+ * input is *exactly* `ControlValue<Control>`. Every real transform differs —
36
+ * an inline object literal has a required `toQuery`, and one annotated
37
+ * `FilterTransform` or `FilterTransform<any>` has a wider input.
38
+ *
39
+ * Getting this wrong in the permissive direction would silently exempt leaves
40
+ * from the checks in ./filterTyping, so filterExpr.transformDetection.test.ts
41
+ * pins down every way a transform can arrive.
42
+ */
43
+ export type IsTransformed<Transform, Control> = Transform extends {
44
+ toQuery?: (input: infer Input, ...rest: never[]) => any;
45
+ } ? undefined extends Transform['toQuery'] ? IsAny<Input> extends true ? true : Exactly<Input, ControlValue<Control>> extends true ? false : true : true : true;
46
+ export type FilterExprLeafFor<Type extends FilterLeafOperator, Field extends FilterField, Control extends FilterControl, Transform> = IsTransformed<Transform, Control> extends true ? FilterExprLeafWithTransform<Type, Field, Control, Extract<Transform, FilterTransform<any>>> : FilterExprLeaf<Type, Field, Control>;
47
+ export type FilterRangeFor<Field extends FilterField, Control extends FilterControl, Transform> = {
48
+ type: 'and';
49
+ filters: [
50
+ FilterExprLeafFor<'greaterThanOrEqual', Field, Control, Transform>,
51
+ FilterExprLeafFor<'lessThanOrEqual', Field, Control, Transform>
52
+ ];
53
+ };
54
+ export type LeafArgs<Field extends FilterField, Control extends FilterControl, Transform extends FilterTransform<any>> = {
55
+ field: Field;
56
+ control: Control;
57
+ /**
58
+ * What the applied-filter pill shows instead of the field path — for a
59
+ * filter whose transform owns the query, where the path says nothing to
60
+ * whoever is reading the pill.
61
+ */
62
+ fieldLabel?: string;
63
+ transform?: Transform;
64
+ };
65
+ declare function range<const Field extends FilterField, const Control extends FilterControl, const Transform extends FilterTransform<ControlValue<Control>, unknown, Field>>(args: {
66
+ field: Field;
67
+ control: (options: {
68
+ placeholder: string;
69
+ }) => Control;
70
+ fieldLabel?: string;
71
+ transform?: Transform;
72
+ }): FilterRangeFor<Field, Control, Transform>;
4
73
  export declare const FilterExpr: {
5
- equals: <const Field extends FilterField>(args: {
6
- field: Field;
7
- control: FilterControl;
8
- transform?: FilterTransform;
9
- }) => {
10
- type: "equals";
11
- field: Field;
12
- value: FilterControl;
13
- transform?: FilterTransform;
14
- };
15
- notEquals: <const Field extends FilterField>(args: {
16
- field: Field;
17
- control: FilterControl;
18
- transform?: FilterTransform;
19
- }) => {
20
- type: "notEquals";
21
- field: Field;
22
- value: FilterControl;
23
- transform?: FilterTransform;
24
- };
25
- greaterThan: <const Field extends FilterField>(args: {
26
- field: Field;
27
- control: FilterControl;
28
- transform?: FilterTransform;
29
- }) => {
30
- type: "greaterThan";
31
- field: Field;
32
- value: FilterControl;
33
- transform?: FilterTransform;
34
- };
35
- lessThan: <const Field extends FilterField>(args: {
36
- field: Field;
37
- control: FilterControl;
38
- transform?: FilterTransform;
39
- }) => {
40
- type: "lessThan";
41
- field: Field;
42
- value: FilterControl;
43
- transform?: FilterTransform;
44
- };
45
- greaterThanOrEqual: <const Field extends FilterField>(args: {
46
- field: Field;
47
- control: FilterControl;
48
- transform?: FilterTransform;
49
- }) => {
50
- type: "greaterThanOrEqual";
51
- field: Field;
52
- value: FilterControl;
53
- transform?: FilterTransform;
54
- };
55
- lessThanOrEqual: <const Field extends FilterField>(args: {
56
- field: Field;
57
- control: FilterControl;
58
- transform?: FilterTransform;
59
- }) => {
60
- type: "lessThanOrEqual";
61
- field: Field;
62
- value: FilterControl;
63
- transform?: FilterTransform;
64
- };
65
- in: <const Field extends FilterField>(args: {
66
- field: Field;
67
- control: FilterControl;
68
- transform?: FilterTransform;
69
- }) => {
70
- type: "in";
71
- field: Field;
72
- value: FilterControl;
73
- transform?: FilterTransform;
74
- };
75
- notIn: <const Field extends FilterField>(args: {
76
- field: Field;
77
- control: FilterControl;
78
- transform?: FilterTransform;
79
- }) => {
80
- type: "notIn";
81
- field: Field;
82
- value: FilterControl;
83
- transform?: FilterTransform;
84
- };
85
- like: <const Field extends FilterField>(args: {
86
- field: Field;
87
- control: FilterControl;
88
- transform?: FilterTransform;
89
- }) => {
90
- type: "like";
91
- field: Field;
92
- value: FilterControl;
93
- transform?: FilterTransform;
94
- };
95
- iLike: <const Field extends FilterField>(args: {
96
- field: Field;
97
- control: FilterControl;
98
- transform?: FilterTransform;
99
- }) => {
100
- type: "iLike";
101
- field: Field;
102
- value: FilterControl;
103
- transform?: FilterTransform;
104
- };
105
- isNull: <const Field extends FilterField>(args: {
106
- field: Field;
107
- control: FilterControl;
108
- transform?: FilterTransform;
109
- }) => {
110
- type: "isNull";
111
- field: Field;
112
- value: FilterControl;
113
- transform?: FilterTransform;
114
- };
115
- computedCondition: (args: {
116
- control: FilterControl;
117
- transform: ConditionOnlyTransform;
118
- }) => {
119
- type: "equals";
120
- field: {
121
- or: [];
122
- };
123
- value: FilterControl;
124
- transform: ConditionOnlyTransform;
125
- };
74
+ equals: <const Field extends FilterField, const Control extends FilterControl, const Transform extends FilterTransform<ControlValue<Control>, unknown, Field>>(args: LeafArgs<Field, Control, Transform>) => FilterExprLeafFor<"equals", Field, Control, Transform>;
75
+ notEquals: <const Field extends FilterField, const Control extends FilterControl, const Transform extends FilterTransform<ControlValue<Control>, unknown, Field>>(args: LeafArgs<Field, Control, Transform>) => FilterExprLeafFor<"notEquals", Field, Control, Transform>;
76
+ greaterThan: <const Field extends FilterField, const Control extends FilterControl, const Transform extends FilterTransform<ControlValue<Control>, unknown, Field>>(args: LeafArgs<Field, Control, Transform>) => FilterExprLeafFor<"greaterThan", Field, Control, Transform>;
77
+ lessThan: <const Field extends FilterField, const Control extends FilterControl, const Transform extends FilterTransform<ControlValue<Control>, unknown, Field>>(args: LeafArgs<Field, Control, Transform>) => FilterExprLeafFor<"lessThan", Field, Control, Transform>;
78
+ greaterThanOrEqual: <const Field extends FilterField, const Control extends FilterControl, const Transform extends FilterTransform<ControlValue<Control>, unknown, Field>>(args: LeafArgs<Field, Control, Transform>) => FilterExprLeafFor<"greaterThanOrEqual", Field, Control, Transform>;
79
+ lessThanOrEqual: <const Field extends FilterField, const Control extends FilterControl, const Transform extends FilterTransform<ControlValue<Control>, unknown, Field>>(args: LeafArgs<Field, Control, Transform>) => FilterExprLeafFor<"lessThanOrEqual", Field, Control, Transform>;
80
+ in: <const Field extends FilterField, const Control extends FilterControl, const Transform extends FilterTransform<ControlValue<Control>, unknown, Field>>(args: LeafArgs<Field, Control, Transform>) => FilterExprLeafFor<"in", Field, Control, Transform>;
81
+ notIn: <const Field extends FilterField, const Control extends FilterControl, const Transform extends FilterTransform<ControlValue<Control>, unknown, Field>>(args: LeafArgs<Field, Control, Transform>) => FilterExprLeafFor<"notIn", Field, Control, Transform>;
82
+ like: <const Field extends FilterField, const Control extends FilterControl, const Transform extends FilterTransform<ControlValue<Control>, unknown, Field>>(args: LeafArgs<Field, Control, Transform>) => FilterExprLeafFor<"like", Field, Control, Transform>;
83
+ iLike: <const Field extends FilterField, const Control extends FilterControl, const Transform extends FilterTransform<ControlValue<Control>, unknown, Field>>(args: LeafArgs<Field, Control, Transform>) => FilterExprLeafFor<"iLike", Field, Control, Transform>;
84
+ isNull: <const Field extends FilterField, const Control extends FilterControl, const Transform extends FilterTransform<ControlValue<Control>, unknown, Field>>(args: LeafArgs<Field, Control, Transform>) => FilterExprLeafFor<"isNull", Field, Control, Transform>;
85
+ computedCondition: <const Control extends FilterControl, const Transform extends ConditionOnlyTransform<ControlValue<Control>>>(args: {
86
+ control: Control;
87
+ fieldLabel?: string;
88
+ transform: Transform;
89
+ }) => FilterExprLeafWithTransform<"equals", {
90
+ or: [];
91
+ }, Control, Transform>;
126
92
  and: <const Filters extends readonly FilterExprType[]>(args: {
127
93
  filters: Filters;
128
94
  }) => {
@@ -141,24 +107,7 @@ export declare const FilterExpr: {
141
107
  type: "not";
142
108
  filter: Filter;
143
109
  };
144
- range: <const Field extends FilterField>(args: {
145
- field: Field;
146
- control: (options: any) => FilterControl;
147
- transform?: FilterTransform;
148
- }) => {
149
- type: "and";
150
- filters: [{
151
- type: "greaterThanOrEqual";
152
- field: Field;
153
- value: FilterControl;
154
- transform?: FilterTransform;
155
- }, {
156
- type: "lessThanOrEqual";
157
- field: Field;
158
- value: FilterControl;
159
- transform?: FilterTransform;
160
- }];
161
- };
110
+ range: typeof range;
162
111
  allOperators: {
163
112
  label: string;
164
113
  value: string;
@@ -0,0 +1,111 @@
1
+ /**
2
+ * A row-scoped view of `FilterExpr`.
3
+ *
4
+ * The helpers on `FilterExpr` accept any field name and are checked once the
5
+ * expression reaches `filter({ rowType })`, which reports every problem on the
6
+ * `filter()` call. Scoping the builder to a row instead — the same shape as
7
+ * `hasuraDSLforRowType` and `queryForRowType` — gives the editor a row to work
8
+ * from:
9
+ *
10
+ * const F = filterExprForRowType(rowType<PaymentRow>());
11
+ *
12
+ * F.iLike({ field: 'customer.email', control: FilterControl.text() })
13
+ *
14
+ * Field names complete as they are typed, and each problem is reported on the
15
+ * property that caused it: an operator the column does not support on `field`,
16
+ * a control that cannot produce its type on `control`.
17
+ *
18
+ * The results are ordinary `FilterExpr` values, so `filter({ rowType })` still
19
+ * checks them; the row-scoped builder is about where errors appear, not about
20
+ * checking more.
21
+ */
22
+ import type { FieldPath } from '@kronor/hasura-graphql';
23
+ import type { FilterControl, FilterTransform } from '../framework/filters';
24
+ import type { FilterField } from '../framework/filters';
25
+ import { FilterExpr, type FilterExprLeaf, type FilterExprLeafWithTransform, type FilterRangeFor } from './filterExpr';
26
+ import type { ControlValue } from './filterControl';
27
+ import type { FilterFieldForRow } from './filters';
28
+ import type { FilterLeafOperator, MutableTuple, ValidateControlForRow, ValidateOperatorForRow, ValidateOperatorListForRow } from './filterTyping';
29
+ /**
30
+ * The checks for one leaf, each attached to the property it is about — an
31
+ * operator the column does not offer belongs on `field`, a control that cannot
32
+ * produce its type on `control`.
33
+ *
34
+ * A transform is passed as a second argument rather than as a third property,
35
+ * for two reasons. It decides the value that reaches the query, so it stands
36
+ * the pair of checks down — and a check that depended on a type parameter
37
+ * inferred from a *sibling property* would fix `Field` and `Control` to their
38
+ * constraints, costing both the per-property errors and the typed `input`.
39
+ * Separate arguments keep the two apart, and the arity tells the overloads
40
+ * apart cleanly.
41
+ */
42
+ /**
43
+ * When the field itself is not one of the row's paths, inference for `Field`
44
+ * falls back to its constraint — the whole union — and a check computed over
45
+ * that reports against every path of the row. The field's own error says
46
+ * everything needed, so the rest stands down.
47
+ */
48
+ type WhenFieldKnown<Row, Field, Check> = FilterFieldForRow<Row> extends Field ? unknown : Check;
49
+ type LeafBuilderForRow<Row, Type extends FilterLeafOperator> = {
50
+ <const Field extends FilterFieldForRow<Row>, const Control extends FilterControl>(args: {
51
+ field: Field & WhenFieldKnown<Row, Field, ValidateOperatorForRow<Row, Type, Field>>;
52
+ control: Control & WhenFieldKnown<Row, Field, ValidateControlForRow<Row, Type, Field, Control>>;
53
+ fieldLabel?: string;
54
+ }): FilterExprLeaf<Type, Field & FilterField, Control>;
55
+ <const Field extends FilterFieldForRow<Row>, const Control extends FilterControl, const Transform extends FilterTransform<ControlValue<Control>, Row, Field>>(args: {
56
+ field: Field;
57
+ control: Control & WhenFieldKnown<Row, Field, ValidateOperatorListForRow<Row, Field, Control>>;
58
+ fieldLabel?: string;
59
+ }, transform: Transform): FilterExprLeafWithTransform<Type, Field & FilterField, Control, Transform>;
60
+ };
61
+ type RangeBuilderForRow<Row> = {
62
+ <const Field extends FilterFieldForRow<Row>, const Control extends FilterControl>(args: {
63
+ field: Field & WhenFieldKnown<Row, Field, ValidateOperatorForRow<Row, 'greaterThanOrEqual', Field>>;
64
+ control: (options: {
65
+ placeholder: string;
66
+ }) => Control & WhenFieldKnown<Row, Field, ValidateControlForRow<Row, 'greaterThanOrEqual', Field, Control>>;
67
+ fieldLabel?: string;
68
+ }): FilterRangeFor<Field & FilterField, Control, never>;
69
+ <const Field extends FilterFieldForRow<Row>, const Control extends FilterControl, const Transform extends FilterTransform<ControlValue<Control>, Row, Field>>(args: {
70
+ field: Field;
71
+ control: (options: {
72
+ placeholder: string;
73
+ }) => Control;
74
+ fieldLabel?: string;
75
+ }, transform: Transform): FilterRangeFor<Field & FilterField, Control, Transform>;
76
+ };
77
+ export type FilterExprBuilderForRow<Row> = {
78
+ equals: LeafBuilderForRow<Row, 'equals'>;
79
+ notEquals: LeafBuilderForRow<Row, 'notEquals'>;
80
+ greaterThan: LeafBuilderForRow<Row, 'greaterThan'>;
81
+ lessThan: LeafBuilderForRow<Row, 'lessThan'>;
82
+ greaterThanOrEqual: LeafBuilderForRow<Row, 'greaterThanOrEqual'>;
83
+ lessThanOrEqual: LeafBuilderForRow<Row, 'lessThanOrEqual'>;
84
+ in: LeafBuilderForRow<Row, 'in'>;
85
+ notIn: LeafBuilderForRow<Row, 'notIn'>;
86
+ like: LeafBuilderForRow<Row, 'like'>;
87
+ iLike: LeafBuilderForRow<Row, 'iLike'>;
88
+ isNull: LeafBuilderForRow<Row, 'isNull'>;
89
+ range: RangeBuilderForRow<Row>;
90
+ /** Field groups that apply one control to several of the row's fields. */
91
+ field: {
92
+ and: <const Fields extends readonly FieldPath<Row>[]>(...fields: Fields) => {
93
+ and: MutableTuple<Fields>;
94
+ };
95
+ or: <const Fields extends readonly FieldPath<Row>[]>(...fields: Fields) => {
96
+ or: MutableTuple<Fields>;
97
+ };
98
+ };
99
+ and: typeof FilterExpr.and;
100
+ or: typeof FilterExpr.or;
101
+ not: typeof FilterExpr.not;
102
+ computedCondition: typeof FilterExpr.computedCondition;
103
+ allOperators: typeof FilterExpr.allOperators;
104
+ };
105
+ /**
106
+ * Entry point for the row-scoped filter expression builder. Pass the row type
107
+ * either as an explicit type argument or as a phantom value from `rowType()`.
108
+ */
109
+ export declare function filterExprForRowType<Row>(): FilterExprBuilderForRow<Row>;
110
+ export declare function filterExprForRowType<Row>(_rowType: Row): FilterExprBuilderForRow<Row>;
111
+ export default filterExprForRowType;
@@ -1,3 +1,3 @@
1
- export type FilterTransform = import('../framework/filters').FilterTransform;
1
+ export type FilterTransform<Input = unknown> = import('../framework/filters').FilterTransform<Input>;
2
2
  export { filterTransforms as FilterTransform } from '../framework/native-runtime';
3
3
  export default FilterTransform;