@illinois-grad/grad-vue 6.0.14 → 7.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.
@@ -2172,10 +2172,10 @@
2172
2172
  "kind": "field",
2173
2173
  "name": "filtering",
2174
2174
  "type": {
2175
- "text": "UseFilteringReturn<any>"
2175
+ "text": "UseFilteringReturn<any, AnyFilterRecord>"
2176
2176
  },
2177
2177
  "optional": true,
2178
- "description": "Filtering object created with useFiltering()"
2178
+ "description": "Filtering object created with useFiltering() Filter state is keyed by each column's filter key (`filter.key ?? key`)."
2179
2179
  },
2180
2180
  {
2181
2181
  "kind": "field",
@@ -2284,7 +2284,7 @@
2284
2284
  "kind": "field",
2285
2285
  "name": "filter",
2286
2286
  "type": {
2287
- "text": "Partial<Record<keyof TableRow, any>>"
2287
+ "text": "FilterState<AnyFilterRecord>"
2288
2288
  },
2289
2289
  "optional": true
2290
2290
  },
@@ -147,8 +147,8 @@ declare const __VLS_export: import("vue").DefineComponent<{
147
147
  onChange?: ((value: (string | number)[]) => any) | undefined;
148
148
  }>, {
149
149
  required: boolean;
150
+ searchDescription: boolean;
150
151
  disabled: boolean;
151
152
  errors: string[];
152
153
  hiddenLabel: boolean;
153
- searchDescription: boolean;
154
154
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -161,10 +161,10 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
161
161
  "onUpdate:modelValue"?: ((value: string | number | null | undefined) => any) | undefined;
162
162
  }>, {
163
163
  required: boolean;
164
- disabled: boolean;
165
- errors: string[];
166
164
  searchDescription: boolean;
167
165
  searchable: boolean;
166
+ disabled: boolean;
167
+ errors: string[];
168
168
  compact: boolean;
169
169
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
170
170
  option?: (props: {
@@ -1,6 +1,6 @@
1
- import type { TableColumn, TableColumnState, TableRow, TableSort } from "./table/TableColumn.ts";
1
+ import type { AnyFilterRecord, TableColumn, TableColumnState, TableRow, TableSort } from "./table/TableColumn.ts";
2
2
  import type { VNode } from "vue";
3
- import type { UseFilteringReturn } from "../compose/useFiltering.ts";
3
+ import type { FilterState, UseFilteringReturn } from "../compose/useFiltering.ts";
4
4
  import type { CellChangePayload, UseTableChangesReturn } from "../compose/useTableChanges.ts";
5
5
  export interface BulkAction {
6
6
  /**
@@ -34,6 +34,11 @@ export interface BulkAction {
34
34
  * objects to use, and `label` for the column header.
35
35
  * - `sortable: true` makes the column sortable.
36
36
  * - `filter` can be used to provide a `TableColumnFilter` configuration.
37
+ * Filter state is keyed by `filter.key`, or by the column `key` when
38
+ * `filter.key` is omitted. Pass a filter/request type as the third
39
+ * `TableColumn` type argument to type-check `filter.key` and values, and
40
+ * use `buildFilterRequest()` to convert filter state into request values
41
+ * (for example `match: "contains"` produces `%text%`).
37
42
  * - `display` accepts a custom render function for the column data.
38
43
  * - `trClass` and `tdClass` can be used to provide custom classes for table rows and cells.
39
44
  * - `data` array with objects containing fields for the columns.
@@ -48,7 +53,7 @@ export interface BulkAction {
48
53
  */
49
54
  declare const _default: typeof __VLS_export;
50
55
  export default _default;
51
- declare const __VLS_export: <T extends TableRow, C extends TableColumn<T>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
56
+ declare const __VLS_export: <T extends TableRow, C extends TableColumn<T> = TableColumn<T>, F = AnyFilterRecord>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
52
57
  props: import("vue").PublicProps & __VLS_PrettifyLocal<({
53
58
  /**
54
59
  * Accessible label
@@ -91,8 +96,11 @@ declare const __VLS_export: <T extends TableRow, C extends TableColumn<T>>(__VLS
91
96
  groupRender?: (groupValue: any, row: T) => VNode;
92
97
  /**
93
98
  * Filtering object created with useFiltering()
99
+ *
100
+ * Filter state is keyed by each column's filter key
101
+ * (`filter.key ?? key`).
94
102
  */
95
- filtering?: UseFilteringReturn<any>;
103
+ filtering?: UseFilteringReturn<any, F>;
96
104
  /**
97
105
  * Make the table rows clickable
98
106
  */
@@ -142,7 +150,7 @@ declare const __VLS_export: <T extends TableRow, C extends TableColumn<T>>(__VLS
142
150
  resizableColumns?: boolean;
143
151
  } & {
144
152
  sort?: TableSort<T>[];
145
- filter?: Partial<Record<keyof T, any>>;
153
+ filter?: FilterState<F>;
146
154
  columnState?: TableColumnState<T>;
147
155
  selectedRows?: string[];
148
156
  }) & {
@@ -150,7 +158,7 @@ declare const __VLS_export: <T extends TableRow, C extends TableColumn<T>>(__VLS
150
158
  "onCell-change"?: ((payload: CellChangePayload<T, Extract<keyof T, string>>) => any) | undefined;
151
159
  "onUpdate:pageSize"?: ((value: number) => any) | undefined;
152
160
  "onUpdate:sort"?: ((value: TableSort<T, Extract<keyof T, string>>[]) => any) | undefined;
153
- "onUpdate:filter"?: ((value: Partial<Record<keyof T, any>>) => any) | undefined;
161
+ "onUpdate:filter"?: ((value: FilterState<F>) => any) | undefined;
154
162
  "onUpdate:columnState"?: ((value: Partial<Record<Extract<keyof T, string>, import("./table/TableColumn.ts").TableColumnStateValue>>) => any) | undefined;
155
163
  "onUpdate:selectedRows"?: ((value: string[]) => any) | undefined;
156
164
  "onUpdate:startIndex"?: ((value: number) => any) | undefined;
@@ -171,7 +179,7 @@ declare const __VLS_export: <T extends TableRow, C extends TableColumn<T>>(__VLS
171
179
  (e: "cell-change", payload: CellChangePayload<T>): void;
172
180
  (e: "update:startIndex", value: number): void;
173
181
  (e: "update:pageSize", value: number): void;
174
- } & (((event: "update:sort", value: TableSort<T, Extract<keyof T, string>>[]) => void) & ((event: "update:filter", value: Partial<Record<keyof T, any>>) => void) & ((event: "update:columnState", value: Partial<Record<Extract<keyof T, string>, import("./table/TableColumn.ts").TableColumnStateValue>>) => void) & ((event: "update:selectedRows", value: string[]) => void));
182
+ } & (((event: "update:sort", value: TableSort<T, Extract<keyof T, string>>[]) => void) & ((event: "update:filter", value: FilterState<F>) => void) & ((event: "update:columnState", value: Partial<Record<Extract<keyof T, string>, import("./table/TableColumn.ts").TableColumnStateValue>>) => void) & ((event: "update:selectedRows", value: string[]) => void));
175
183
  }>) => import("vue").VNode & {
176
184
  __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
177
185
  };
@@ -1,12 +1,53 @@
1
1
  import { VNode } from "vue";
2
- export type TableColumnFilter = SelectColumnFilter | MultiSelectColumnFilter | ToggleColumnFilter | SearchColumnFilter;
3
- export interface SelectColumnFilter {
4
- type: 'select';
5
- options: Array<{
6
- label: string;
7
- value: any;
8
- description?: string;
9
- }>;
2
+ /**
3
+ * Default filter/request type used when a column does not declare one.
4
+ */
5
+ export type AnyFilterRecord = Record<string, any>;
6
+ /**
7
+ * String keys of a filter/request type.
8
+ */
9
+ export type FilterKey<F> = Extract<keyof F, string>;
10
+ /**
11
+ * The non-null value type accepted by the request field `K` of `F`.
12
+ */
13
+ export type FilterApiValue<F, K extends keyof F> = Exclude<F[K], null | undefined>;
14
+ export type FilterPrimitive = string | number | boolean;
15
+ /**
16
+ * How a search filter's text is converted for the request.
17
+ *
18
+ * - `exact` (default): the trimmed text is sent unchanged.
19
+ * - `contains`: `%text%`
20
+ * - `startsWith`: `text%`
21
+ * - `endsWith`: `%text`
22
+ */
23
+ export type SearchFilterMatch = "exact" | "contains" | "startsWith" | "endsWith";
24
+ export interface FilterOption<V = any> {
25
+ label: string;
26
+ value: V;
27
+ description?: string;
28
+ }
29
+ /**
30
+ * Converts a normalized UI value into the request value for `F[K]`.
31
+ * Returning `undefined` omits the field from the request.
32
+ */
33
+ export type FilterTransform<In, F, K extends keyof F> = (value: In) => FilterApiValue<F, K> | undefined;
34
+ type ArrayElement<V> = V extends readonly (infer E)[] ? E : never;
35
+ interface SearchFilterBase {
36
+ type: "search";
37
+ /**
38
+ * Placeholder text shown in the search input.
39
+ */
40
+ placeholder?: string;
41
+ }
42
+ type SearchFilterMapping<F, K extends keyof F> = (string extends FilterApiValue<F, K> ? {
43
+ match?: SearchFilterMatch;
44
+ transform?: undefined;
45
+ } : never) | {
46
+ match?: undefined;
47
+ transform: FilterTransform<string, F, K>;
48
+ };
49
+ interface SelectFilterBase {
50
+ type: "select";
10
51
  placeholder?: string;
11
52
  /**
12
53
  * Include the option `description` in the searchable text match.
@@ -14,20 +55,15 @@ export interface SelectColumnFilter {
14
55
  */
15
56
  searchDescription?: boolean;
16
57
  }
17
- export interface SearchColumnFilter {
18
- type: 'search';
19
- /**
20
- * Placeholder text shown in the search input.
21
- */
22
- placeholder?: string;
23
- }
24
- export interface MultiSelectColumnFilter {
25
- type: 'multi-select';
26
- options: Array<{
27
- label: string;
28
- value: any;
29
- description?: string;
30
- }>;
58
+ type SelectFilterMapping<F, K extends keyof F> = {
59
+ options: Array<FilterOption<FilterApiValue<F, K>>>;
60
+ transform?: undefined;
61
+ } | {
62
+ options: Array<FilterOption<FilterPrimitive>>;
63
+ transform: FilterTransform<FilterPrimitive, F, K>;
64
+ };
65
+ interface MultiSelectFilterBase {
66
+ type: "multi-select";
31
67
  placeholder?: string;
32
68
  /**
33
69
  * When true, renders a searchable GMultiSelect combobox instead of a
@@ -41,11 +77,73 @@ export interface MultiSelectColumnFilter {
41
77
  */
42
78
  searchDescription?: boolean;
43
79
  }
44
- export interface ToggleColumnFilter {
45
- type: 'toggle';
80
+ type MultiSelectFilterMapping<F, K extends keyof F> = ([FilterApiValue<F, K>] extends [readonly unknown[]] ? {
81
+ options: Array<FilterOption<ArrayElement<FilterApiValue<F, K>>>>;
82
+ transform?: undefined;
83
+ } : never) | {
84
+ options: Array<FilterOption<FilterPrimitive>>;
85
+ transform: FilterTransform<FilterPrimitive[], F, K>;
86
+ };
87
+ interface ToggleFilterBase {
88
+ type: "toggle";
46
89
  label: string;
47
90
  description?: string;
48
91
  }
92
+ type ToggleFilterMapping<F, K extends keyof F> = (true extends FilterApiValue<F, K> ? {
93
+ transform?: undefined;
94
+ } : never) | {
95
+ transform: FilterTransform<true, F, K>;
96
+ };
97
+ /**
98
+ * A search input filter.
99
+ *
100
+ * The UI value is the entered text. Without `transform`, the request field
101
+ * must accept a string; `match` controls wildcard wrapping. With
102
+ * `transform`, the trimmed text is converted to the request field's type.
103
+ */
104
+ export type SearchColumnFilter<F = AnyFilterRecord, K extends FilterKey<F> = FilterKey<F>> = SearchFilterBase & {
105
+ key?: K;
106
+ } & SearchFilterMapping<F, K>;
107
+ /**
108
+ * A single-select filter. Without `transform`, option values must match the
109
+ * request field's type.
110
+ */
111
+ export type SelectColumnFilter<F = AnyFilterRecord, K extends FilterKey<F> = FilterKey<F>> = SelectFilterBase & {
112
+ key?: K;
113
+ } & SelectFilterMapping<F, K>;
114
+ /**
115
+ * A multi-select filter. Without `transform`, the request field must be an
116
+ * array and option values must match its element type.
117
+ */
118
+ export type MultiSelectColumnFilter<F = AnyFilterRecord, K extends FilterKey<F> = FilterKey<F>> = MultiSelectFilterBase & {
119
+ key?: K;
120
+ } & MultiSelectFilterMapping<F, K>;
121
+ /**
122
+ * A toggle filter. It is active only when on. Without `transform`, the
123
+ * request field must accept `true`.
124
+ */
125
+ export type ToggleColumnFilter<F = AnyFilterRecord, K extends FilterKey<F> = FilterKey<F>> = ToggleFilterBase & {
126
+ key?: K;
127
+ } & ToggleFilterMapping<F, K>;
128
+ type ColumnFilterFor<F, K extends FilterKey<F>> = (SearchFilterBase & SearchFilterMapping<F, K>) | (SelectFilterBase & SelectFilterMapping<F, K>) | (MultiSelectFilterBase & MultiSelectFilterMapping<F, K>) | (ToggleFilterBase & ToggleFilterMapping<F, K>);
129
+ type KeyedColumnFilter<F, K extends FilterKey<F>> = K extends unknown ? ColumnFilterFor<F, K> & {
130
+ /**
131
+ * The filter/request field this filter reads and writes. Defaults to
132
+ * the column key, which must then be a key of the filter type.
133
+ */
134
+ key: K;
135
+ } : never;
136
+ type DefaultKeyColumnFilter<F, K> = K extends FilterKey<F> ? ColumnFilterFor<F, K> & {
137
+ key?: undefined;
138
+ } : never;
139
+ /**
140
+ * Filter configuration for a column.
141
+ *
142
+ * `F` is the filter/request type (for example a generated API query type).
143
+ * `filter.key` must be a key of `F`. When `key` is omitted, the column key
144
+ * (`DefaultKey`) is used and must itself be a key of `F`.
145
+ */
146
+ export type TableColumnFilter<F = AnyFilterRecord, DefaultKey extends string = FilterKey<F>> = KeyedColumnFilter<F, FilterKey<F>> | DefaultKeyColumnFilter<F, DefaultKey>;
49
147
  export interface EditableColumnConfig {
50
148
  /**
51
149
  * Type of editable control. Defaults to "input".
@@ -77,7 +175,7 @@ export interface EditableColumnConfig {
77
175
  */
78
176
  labelKey?: string;
79
177
  }
80
- type ColumnKey<T> = Extract<keyof T, string>;
178
+ export type ColumnKey<T> = Extract<keyof T, string>;
81
179
  export interface TableColumnStateValue {
82
180
  visible?: boolean;
83
181
  width?: number;
@@ -87,11 +185,18 @@ export interface TableSort<T extends TableRow, K extends ColumnKey<T> = ColumnKe
87
185
  key: K;
88
186
  order: 1 | -1;
89
187
  }
90
- export interface TableColumn<T extends TableRow, K extends ColumnKey<T> = ColumnKey<T>> {
188
+ export interface TableColumnConfig<T extends TableRow, K extends ColumnKey<T> = ColumnKey<T>, F = AnyFilterRecord> {
189
+ /**
190
+ * Row field used for display and sorting.
191
+ */
91
192
  key: K;
92
193
  label: string;
93
194
  sortable?: boolean;
94
- filter?: TableColumnFilter;
195
+ /**
196
+ * Filter configuration. Use `filter.key` when the filter/request field
197
+ * differs from the column key.
198
+ */
199
+ filter?: TableColumnFilter<F, K>;
95
200
  /**
96
201
  * Custom render function for the column data.
97
202
  * Cannot be used with `editable`.
@@ -106,6 +211,14 @@ export interface TableColumn<T extends TableRow, K extends ColumnKey<T> = Column
106
211
  */
107
212
  editable?: EditableColumnConfig;
108
213
  }
214
+ /**
215
+ * A table column for rows of type `T`.
216
+ *
217
+ * `F` is an independent filter/request type that column filters map to.
218
+ * This distributes over `K` so each column's default filter key is checked
219
+ * against its own row key.
220
+ */
221
+ export type TableColumn<T extends TableRow, K extends ColumnKey<T> = ColumnKey<T>, F = AnyFilterRecord> = K extends ColumnKey<T> ? TableColumnConfig<T, K, F> : never;
109
222
  export interface TableRow extends Record<string, any> {
110
223
  key: string;
111
224
  }
@@ -0,0 +1,58 @@
1
+ import type { FilterOption, FilterPrimitive, SearchFilterMatch } from "./TableColumn.ts";
2
+ /**
3
+ * A raw filter value as stored in filter state and route queries.
4
+ *
5
+ * Values read back from a URL are strings, so column-aware helpers normalize
6
+ * them against the column filter configuration before use.
7
+ */
8
+ export type FilterInputValue = FilterPrimitive | FilterPrimitive[] | null | undefined;
9
+ /**
10
+ * Structural view of any `TableColumnFilter`, independent of its filter type.
11
+ */
12
+ type AnyColumnFilter = {
13
+ type: "search";
14
+ match?: SearchFilterMatch;
15
+ transform?: (value: string) => unknown;
16
+ } | {
17
+ type: "select";
18
+ options: readonly FilterOption<unknown>[];
19
+ transform?: (value: FilterPrimitive) => unknown;
20
+ } | {
21
+ type: "multi-select";
22
+ options: readonly FilterOption<unknown>[];
23
+ transform?: (value: FilterPrimitive[]) => unknown;
24
+ } | {
25
+ type: "toggle";
26
+ transform?: (value: true) => unknown;
27
+ };
28
+ interface FilterableColumn {
29
+ key: string;
30
+ filter?: {
31
+ key?: string;
32
+ };
33
+ }
34
+ /**
35
+ * The filter/request key a column filter reads and writes.
36
+ */
37
+ export declare function columnFilterKey(column: FilterableColumn): string;
38
+ /**
39
+ * Normalizes a raw state value into the value expected by the filter control.
40
+ */
41
+ export declare function filterInputValue(filter: AnyColumnFilter, raw: FilterInputValue): FilterPrimitive | FilterPrimitive[] | undefined;
42
+ /**
43
+ * Converts a value emitted by a filter control into a raw state value.
44
+ * Empty values (including an unchecked toggle) become `undefined`, except
45
+ * multi-select values, which stay arrays.
46
+ */
47
+ export declare function filterStateValue(filter: AnyColumnFilter, input: unknown): FilterInputValue;
48
+ /**
49
+ * Whether a raw state value represents an active filter for the column.
50
+ * `0` and `false` are meaningful select values; toggles are active only when on.
51
+ */
52
+ export declare function isColumnFilterActive(filter: AnyColumnFilter, raw: FilterInputValue): boolean;
53
+ /**
54
+ * Converts a raw state value into the request value for the column filter.
55
+ * Returns `undefined` when the filter is inactive.
56
+ */
57
+ export declare function filterRequestValue(filter: AnyColumnFilter, raw: FilterInputValue): unknown;
58
+ export {};
@@ -1,4 +1,23 @@
1
1
  import { Reactive, type Ref } from "vue";
2
+ import type { AnyFilterRecord, ColumnKey, FilterApiValue, FilterKey, TableColumn, TableRow } from "../components/table/TableColumn.ts";
3
+ import { type FilterInputValue } from "../components/table/columnFilters.ts";
4
+ export type { FilterInputValue } from "../components/table/columnFilters.ts";
5
+ /**
6
+ * Raw UI filter state keyed by filter/request keys of `F`.
7
+ *
8
+ * Values are kept as entered (or as read from the URL) and are only
9
+ * converted to request values by `buildFilterRequest()`.
10
+ */
11
+ export type FilterState<F> = {
12
+ [K in keyof F]?: FilterInputValue;
13
+ };
14
+ /**
15
+ * A request object built from filter state. Each value has the type of the
16
+ * corresponding field in `F`.
17
+ */
18
+ export type FilterRequest<F> = {
19
+ [K in keyof F]?: FilterApiValue<F, K>;
20
+ };
2
21
  export type FilterLocationQueryValueRaw = string | number;
3
22
  export type FilterRouteQueryValue = string | null;
4
23
  export type FilterRouteQuery = {
@@ -13,7 +32,7 @@ export type FilterLocationQuery = {
13
32
  export interface FilteringOptions {
14
33
  syncWith?: Ref<FilterRouteQuery>;
15
34
  }
16
- export interface QueryFilteringOptions<F extends Record<string, any> = Record<string, any>> {
35
+ export interface QueryFilteringOptions<F = AnyFilterRecord> {
17
36
  route: {
18
37
  query: FilterRouteQuery;
19
38
  };
@@ -22,7 +41,7 @@ export interface QueryFilteringOptions<F extends Record<string, any> = Record<st
22
41
  query: FilterLocationQuery;
23
42
  }) => unknown;
24
43
  };
25
- booleanArrayKeys?: readonly Extract<keyof F, string>[];
44
+ booleanArrayKeys?: readonly FilterKey<F>[];
26
45
  }
27
46
  /**
28
47
  * Represents a type that defines a set of filters for a given record type.
@@ -37,14 +56,15 @@ export type FiltersForRecord<T extends object, F extends {
37
56
  /**
38
57
  * Represents the return type of a composition function used for handling
39
58
  * filtering logic in a data structure.
59
+ *
60
+ * `T` is the row type and `F` is the independent filter/request type. Filter
61
+ * state and `filteredColumns` are keyed by filter keys of `F`.
40
62
  */
41
- export interface UseFilteringReturn<T extends Record<string, any> = Record<string, any>, F extends {
42
- [K in keyof T]?: any;
43
- } = Record<keyof T, any>> {
44
- filters: Reactive<F>;
63
+ export interface UseFilteringReturn<T extends object = AnyFilterRecord, F = Partial<Record<keyof T, any>>> {
64
+ filters: Reactive<FilterState<F>>;
45
65
  isFiltered: Ref<boolean>;
46
66
  clearFilters: () => void;
47
- filteredColumns: Ref<Partial<Record<keyof T, boolean>>>;
67
+ filteredColumns: Ref<Partial<Record<FilterKey<F>, boolean>>>;
48
68
  }
49
69
  /**
50
70
  * Returns the value if it's not empty, or undefined if it's empty.
@@ -63,6 +83,24 @@ export declare function asArray<T>(value: T | T[]): NonNullable<T>[] | undefined
63
83
  * values (`?tag=a,b`) and removes null entries from array values.
64
84
  */
65
85
  export declare function parseQueryArrayValue(value: FilterRouteQueryValue | FilterRouteQueryValue[] | readonly FilterRouteQueryValue[] | undefined): string[] | undefined;
86
+ /**
87
+ * Builds a typed request object from column filter configuration and raw
88
+ * filter state.
89
+ *
90
+ * Each filtered column reads `filters[filter.key ?? column.key]` and applies
91
+ * its explicit transformation (`match` for search filters, or `transform`).
92
+ * Only keys produced by column filters are included.
93
+ *
94
+ * @example
95
+ * ```ts
96
+ * type Query = NonNullable<GetStudentsData["query"]>;
97
+ * const columns: TableColumn<StudentRow, ColumnKey<StudentRow>, Query>[] = [
98
+ * { key: "major", label: "Major", filter: { type: "search", key: "major__like", match: "contains" } },
99
+ * ];
100
+ * const query: FilterRequest<Query> = buildFilterRequest(columns, filters);
101
+ * ```
102
+ */
103
+ export declare function buildFilterRequest<T extends TableRow, F>(columns: readonly TableColumn<T, ColumnKey<T>, F>[], filters: FilterState<F>): FilterRequest<F>;
66
104
  /**
67
105
  * Converts filter criteria into a format suitable for use as a query object
68
106
  * in vue-router.
@@ -86,16 +124,16 @@ export declare function filtersToQueryParams<T extends Record<string, any>>(filt
86
124
  * be used for multi-value filters that should be converted to boolean values
87
125
  * inside the filter state.
88
126
  */
89
- export declare function useQueryFiltering<T extends Record<string, any>, F extends {
90
- [K in keyof T]?: any;
91
- } = Record<keyof T, any>>(filters: F, options: QueryFilteringOptions<F>): UseFilteringReturn<T, F>;
127
+ export declare function useQueryFiltering<T extends object = AnyFilterRecord, F = Partial<Record<keyof T, any>>>(filters: FilterState<F>, options: QueryFilteringOptions<F>): UseFilteringReturn<T, F>;
92
128
  /**
93
129
  * Provides a mechanism to manage and synchronize filterable data with given filters and options.
94
130
  *
131
+ * Filter state is keyed by filter/request keys (`filter.key ?? column.key`)
132
+ * and holds raw UI values. Use `buildFilterRequest()` to convert it into
133
+ * typed request values.
134
+ *
95
135
  * @param filters An object that defines the filters applicable to the data record.
96
136
  * @param options Configuration options for filtering, such as synchronization.
97
137
  * @return Returns an object that can be used with GTable.
98
138
  */
99
- export declare function useFiltering<T extends Record<string, any> = Record<string, any>, F extends {
100
- [K in keyof T]?: any;
101
- } = Record<keyof T, any>>(filters: F, options?: FilteringOptions): UseFilteringReturn<T, F>;
139
+ export declare function useFiltering<T extends object = AnyFilterRecord, F = Partial<Record<keyof T, any>>>(filters: FilterState<F>, options?: FilteringOptions): UseFilteringReturn<T, F>;
@@ -2,5 +2,5 @@ import type { TableColumn, TableColumnState, TableColumnStateValue, TableRow } f
2
2
  import { type MaybeRefOrGetter } from "vue";
3
3
  export declare function normalizeTableColumnState<T extends TableRow>(value: unknown, columns: readonly TableColumn<T>[]): TableColumnState<T>;
4
4
  export declare function usePersistentTableColumnState<T extends TableRow>(storageKey: string, columns: MaybeRefOrGetter<readonly TableColumn<T>[]>): {
5
- columnState: import("@vueuse/core").RemovableRef<Partial<Record<Extract<keyof T, string>, TableColumnStateValue>>>;
5
+ columnState: import("@vueuse/shared").RemovableRef<Partial<Record<Extract<keyof T, string>, TableColumnStateValue>>>;
6
6
  };
@@ -1,5 +1,5 @@
1
1
  import { ComputedRef } from "vue";
2
- import { TableColumn, TableRow } from "../components/table/TableColumn.ts";
2
+ import { TableColumnConfig, TableRow } from "../components/table/TableColumn.ts";
3
3
  import { EventHookOn } from "@vueuse/core";
4
4
  export type ColumnKey<R extends TableRow> = Extract<keyof R, string>;
5
5
  /**
@@ -33,7 +33,7 @@ export interface CellChangeEvent<R extends TableRow = TableRow, K extends Column
33
33
  */
34
34
  export interface CellChangePayload<T extends TableRow = TableRow, K extends ColumnKey<T> = ColumnKey<T>> {
35
35
  row: T;
36
- column: TableColumn<T, K>;
36
+ column: TableColumnConfig<T, K>;
37
37
  value: T[K];
38
38
  previousValue: T[K];
39
39
  }