@dolusoft/query-table 3.12.0 → 3.13.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/dist/query-table.js +84 -35
- package/dist/query-table.js.map +1 -1
- package/dist/types/contract.d.ts +37 -3
- package/dist/types/core/labels.d.ts +3 -1
- package/dist/types/core/table-context.d.ts +2 -2
- package/dist/types/filter/use-filter-trigger.d.ts +3 -2
- package/dist/types/use-query-table.d.ts +6 -3
- package/package.json +3 -3
package/dist/types/contract.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ import type { Component } from 'vue';
|
|
|
13
13
|
* The query types are the protocol's (`@dolusoft/query-protocol`), exported
|
|
14
14
|
* again so a consumer of the Vue package imports them from here, as in 2.2.x.
|
|
15
15
|
*/
|
|
16
|
-
export type { ColumnType, CursorQuery, CursorRequest, FilterCondition, FilterRule, FilterValue, PageCursors, Query, QueryChangeReason, SortDirection, SortState, TableQuery } from '@dolusoft/query-protocol';
|
|
16
|
+
export type { ColumnType, CursorQuery, CursorRequest, FilterCondition, FilterRule, FilterValue, NoValueCondition, NoValueFilterRule, PageCursors, Query, QueryChangeReason, RangeCondition, RangeFilterRule, SortDirection, SortState, TableQuery, ValueCondition, ValueFilterRule } from '@dolusoft/query-protocol';
|
|
17
17
|
/**
|
|
18
18
|
* What produced the `rows` given with it (C-93), from the core's row-change
|
|
19
19
|
* module (`@dolusoft/query-table-core/row-changes`).
|
|
@@ -82,6 +82,15 @@ export interface Column {
|
|
|
82
82
|
hide?: boolean;
|
|
83
83
|
/** Show a filter input for this column (needs table `filterable`). Defaults to `true`. */
|
|
84
84
|
filterable?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* The conditions the `filter-menu` slot offers for this column, in this
|
|
87
|
+
* order, in place of the list of its type (C-112). It is how a column offers
|
|
88
|
+
* `IsNull`, `IsNotNull` and `Between`, which the list of a type leaves
|
|
89
|
+
* out. A condition the column type does not take is left out (`Between`
|
|
90
|
+
* on `string`, `Contains` on `number`). Unset, the menu offers the list
|
|
91
|
+
* of the type, as in 3.12.
|
|
92
|
+
*/
|
|
93
|
+
filterConditions?: FilterCondition[];
|
|
85
94
|
/** Allow sorting by this column (needs table `sortable`). Defaults to `true`. */
|
|
86
95
|
sortable?: boolean;
|
|
87
96
|
}
|
|
@@ -389,6 +398,17 @@ export interface TableLabels {
|
|
|
389
398
|
openRightPanel: string;
|
|
390
399
|
/** Name of a filter input. Default `` name => `Filter ${name}` ``. */
|
|
391
400
|
filterInput: (column: string) => string;
|
|
401
|
+
/**
|
|
402
|
+
* Name of the lower bound input of a `Between` filter. Default
|
|
403
|
+
* `` name => `Filter ${name} from` ``. Optional (3.13), so a complete
|
|
404
|
+
* `TableLabels` of 3.12 still type-checks.
|
|
405
|
+
*/
|
|
406
|
+
filterInputFrom?: (column: string) => string;
|
|
407
|
+
/**
|
|
408
|
+
* Name of the upper bound input of a `Between` filter. Default
|
|
409
|
+
* `` name => `Filter ${name} to` ``. Optional (3.13), like `filterInputFrom`.
|
|
410
|
+
*/
|
|
411
|
+
filterInputTo?: (column: string) => string;
|
|
392
412
|
/** Name and tooltip of a filter button. Default `` name => `Filter options for ${name}` ``. */
|
|
393
413
|
filterOptions: (column: string) => string;
|
|
394
414
|
/** Name of a column's resize handle. Default `` name => `Resize ${name}` ``. */
|
|
@@ -543,12 +563,20 @@ export interface SubtableSlotProps<T> {
|
|
|
543
563
|
row: T;
|
|
544
564
|
rowIndex: number;
|
|
545
565
|
}
|
|
566
|
+
/** Which bound of a `Between` filter an input holds (C-114). */
|
|
567
|
+
export type FilterBound = 'lower' | 'upper';
|
|
546
568
|
export interface FilterDatetimeSlotProps {
|
|
547
569
|
column: Column;
|
|
548
570
|
/** Text currently in the filter input. */
|
|
549
571
|
value: string | undefined;
|
|
550
572
|
/** Replace the input text; the filter is applied after the debounce. */
|
|
551
573
|
updateValue: (value: string) => void;
|
|
574
|
+
/**
|
|
575
|
+
* The bound this input holds when the column's condition is `Between`:
|
|
576
|
+
* the slot is then drawn twice, `'lower'` first. `null` for a filter of
|
|
577
|
+
* one value (C-114).
|
|
578
|
+
*/
|
|
579
|
+
bound: FilterBound | null;
|
|
552
580
|
}
|
|
553
581
|
/** One entry of the condition list offered for a column. */
|
|
554
582
|
export interface FilterConditionOption {
|
|
@@ -562,11 +590,17 @@ export interface FilterMenuSlotProps {
|
|
|
562
590
|
rules: FilterRule[];
|
|
563
591
|
/** Condition shown for the column: the first rule's, else the one picked, else `null`. */
|
|
564
592
|
condition: FilterCondition | null;
|
|
565
|
-
/**
|
|
593
|
+
/**
|
|
594
|
+
* Conditions offered for the column, labelled by `labels.filterCondition`:
|
|
595
|
+
* the column's `filterConditions`, else those of its type (C-112).
|
|
596
|
+
*/
|
|
566
597
|
conditions: FilterConditionOption[];
|
|
567
598
|
/**
|
|
568
599
|
* Pick a condition. With a value typed the filter is applied; otherwise the
|
|
569
|
-
* pick waits for a value. `null` clears the filter.
|
|
600
|
+
* pick waits for a value. `null` clears the filter. `IsNull` and
|
|
601
|
+
* `IsNotNull` apply at once (C-113); `Between` waits for both bounds
|
|
602
|
+
* (C-114). Any condition is taken, also one outside `conditions`: the
|
|
603
|
+
* column's `filterConditions` only drives the menu (C-112).
|
|
570
604
|
*/
|
|
571
605
|
setCondition: (condition: FilterCondition | null) => void;
|
|
572
606
|
/** Remove the rules of this column. Sort is left alone. */
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { Column, TableLabels } from '../contract.js';
|
|
2
|
-
|
|
2
|
+
/** The labels the table reads: every entry filled, the optional ones too. */
|
|
3
|
+
export type ResolvedLabels = Required<TableLabels>;
|
|
4
|
+
export declare const resolveLabels: (labels: Partial<TableLabels> | undefined) => ResolvedLabels;
|
|
3
5
|
/** The name of a column in a label: its `title`, else its `field`. */
|
|
4
6
|
export declare const columnName: (column: Column) => string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ResolvedLabels } from './labels.js';
|
|
2
2
|
import type { ColumnReorder } from '../reorder/use-column-reorder.js';
|
|
3
3
|
import type { ColumnResize } from '../resize/use-column-resize.js';
|
|
4
4
|
import type { QueryTableFilters, QueryTableLayout, QueryTableSelection, QueryTableSort } from '../use-query-table.js';
|
|
@@ -18,7 +18,7 @@ export interface TableContext {
|
|
|
18
18
|
reorder: ColumnReorder;
|
|
19
19
|
/** The select-all checkbox of the selection column (C-59). */
|
|
20
20
|
selection: Pick<QueryTableSelection<object>, 'allSelected' | 'someSelected' | 'toggleAll'>;
|
|
21
|
-
labels: () =>
|
|
21
|
+
labels: () => ResolvedLabels;
|
|
22
22
|
}
|
|
23
23
|
export declare const provideTableContext: (context: TableContext) => void;
|
|
24
24
|
export declare const useTableContext: () => TableContext;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { type Component } from 'vue';
|
|
2
|
-
import type { Column
|
|
2
|
+
import type { Column } from '../contract.js';
|
|
3
|
+
import { type ResolvedLabels } from '../core/labels.js';
|
|
3
4
|
export interface FilterTriggerOptions {
|
|
4
5
|
/** The column of this header cell, as the table has it now. */
|
|
5
6
|
column: () => Column;
|
|
6
|
-
labels: () =>
|
|
7
|
+
labels: () => ResolvedLabels;
|
|
7
8
|
isFiltered: () => boolean;
|
|
8
9
|
}
|
|
9
10
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type FilterDraft, type Query } from '@dolusoft/query-protocol';
|
|
2
|
-
import { type FilterLabel } from '@dolusoft/query-table-core';
|
|
2
|
+
import { type FilterBound, type FilterLabel } from '@dolusoft/query-table-core';
|
|
3
3
|
import { type VueTable } from '@tanstack/vue-table';
|
|
4
4
|
import { type ComputedRef, type MaybeRefOrGetter } from 'vue';
|
|
5
5
|
import type { Column, ColumnChangeReason, ColumnControl, FilterCondition, PageCursors, PaginationSlotProps, QueryChangeReason, RowPinning, RowSelection, SortDirection, TableProps, TableQuery } from './contract.js';
|
|
@@ -97,8 +97,11 @@ export interface ColumnEntry {
|
|
|
97
97
|
export interface QueryTableFilters {
|
|
98
98
|
/** The column's typed text and picked condition; blank when nothing is typed. */
|
|
99
99
|
draftOf: (field: string) => Readonly<FilterDraft>;
|
|
100
|
-
/**
|
|
101
|
-
|
|
100
|
+
/**
|
|
101
|
+
* The input's text changed: applied after the debounce (C-09). `'upper'`
|
|
102
|
+
* sets the upper bound of a `Between` filter instead (C-114).
|
|
103
|
+
*/
|
|
104
|
+
setInput: (field: string, text: string, bound?: FilterBound) => void;
|
|
102
105
|
/** Enter: applies the column's pending text now (C-12). */
|
|
103
106
|
apply: (field: string) => void;
|
|
104
107
|
/** Applies every pending text in one update; `true` when it changed the filters. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dolusoft/query-table",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.13.0",
|
|
4
4
|
"description": "A thin Vue 3 table for server-side data: it renders rows and emits sort, filter, search and paging changes. Built on TanStack Table.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
],
|
|
46
46
|
"license": "MIT",
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@dolusoft/query-protocol": "3.
|
|
49
|
-
"@dolusoft/query-table-core": "3.
|
|
48
|
+
"@dolusoft/query-protocol": "3.13.0",
|
|
49
|
+
"@dolusoft/query-table-core": "3.13.0",
|
|
50
50
|
"@tanstack/vue-table": "9.2.6"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|