@tensor_1/react 2.49.1 → 2.51.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/components/DataWorkspace.d.ts +216 -9
- package/dist/components/DataWorkspace.js +849 -93
- package/dist/components/FilterEditor.d.ts +3 -1
- package/dist/components/FilterEditor.js +22 -6
- package/dist/components/SearchBar.d.ts +3 -1
- package/dist/components/SearchBar.js +2 -0
- package/dist/components/Table.d.ts +10 -1
- package/dist/components/Table.js +12 -4
- package/dist/filter-model.d.ts +15 -1
- package/dist/filter-model.js +8 -2
- package/dist/index.cjs +911 -118
- package/dist/index.d.cts +263 -14
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -0
- package/dist/labels-context.d.ts +6 -1
- package/dist/table-engine.d.ts +14 -3
- package/dist/table-engine.js +7 -2
- package/package.json +1 -1
package/dist/table-engine.d.ts
CHANGED
|
@@ -24,8 +24,10 @@ declare function multiSort<T extends Row>(rows: readonly T[], keys: readonly Sor
|
|
|
24
24
|
declare function nextSortDir(current: SortDir | 'none' | undefined): SortDir | 'none';
|
|
25
25
|
/**
|
|
26
26
|
* Toggle a field within a multi-sort key list. Without shift, it replaces the
|
|
27
|
-
* list with just this field (cycling its direction); with shift,
|
|
28
|
-
* the
|
|
27
|
+
* list with just this field (cycling its direction); with shift, a new field is
|
|
28
|
+
* appended as the last key, an existing key turns in place (it keeps its priority,
|
|
29
|
+
* as TanStack Table and TENSOR's DataTable do; 2.50, HAR-2623) and is removed when
|
|
30
|
+
* it cycles back to none.
|
|
29
31
|
*/
|
|
30
32
|
declare function toggleSort(keys: readonly SortKey[], field: string, additive?: boolean): SortKey[];
|
|
31
33
|
type FilterKind = 'enum' | 'text' | 'number' | 'date' | 'boolean';
|
|
@@ -37,6 +39,15 @@ interface ColumnFilter {
|
|
|
37
39
|
/** value(s): a scalar, an array (enum / between), or [min,max] for between */
|
|
38
40
|
value: Primitive | Primitive[];
|
|
39
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* An `enum` `FilterValue` (what `FilterEditor` and `DataWorkspace` filters hold) as the engine's
|
|
44
|
+
* `ColumnFilter` for `field` (HAR-2631): `is-none-of` maps to `isNoneOf`, anything else to `isAnyOf`.
|
|
45
|
+
*/
|
|
46
|
+
declare function enumColumnFilter(field: string, value: {
|
|
47
|
+
kind: 'enum';
|
|
48
|
+
values: readonly string[];
|
|
49
|
+
operator?: 'is-any-of' | 'is-none-of';
|
|
50
|
+
}): ColumnFilter;
|
|
40
51
|
declare function matchFilter(row: Row, f: ColumnFilter): boolean;
|
|
41
52
|
/** Keep rows that satisfy EVERY active filter (AND across columns). */
|
|
42
53
|
declare function applyFilters<T extends Row>(rows: readonly T[], filters: readonly ColumnFilter[]): T[];
|
|
@@ -93,4 +104,4 @@ declare function togglePage(selected: ReadonlySet<string>, pageIds: readonly str
|
|
|
93
104
|
/** Pinned rows (kept present regardless of filter/sort) hoisted above the rest. */
|
|
94
105
|
declare function mergePinned<T extends Row>(all: readonly T[], visible: readonly T[], pinnedIds: ReadonlySet<string>, idField?: string): T[];
|
|
95
106
|
|
|
96
|
-
export { type ColumnFilter, type FilterKind, type FilterOp, type Primitive, type Row, type Segment, type SelectAllState, type SortDir, type SortKey, type ViewState, type VirtualWindow, applyFilters, clampWidth, highlightSegments, matchFilter, mergePinned, multiSort, nextSortDir, parseView, reorder, searchRows, selectAllState, serializeView, shouldVirtualize, toggleId, togglePage, toggleSort, virtualWindow };
|
|
107
|
+
export { type ColumnFilter, type FilterKind, type FilterOp, type Primitive, type Row, type Segment, type SelectAllState, type SortDir, type SortKey, type ViewState, type VirtualWindow, applyFilters, clampWidth, enumColumnFilter, highlightSegments, matchFilter, mergePinned, multiSort, nextSortDir, parseView, reorder, searchRows, selectAllState, serializeView, shouldVirtualize, toggleId, togglePage, toggleSort, virtualWindow };
|
package/dist/table-engine.js
CHANGED
|
@@ -25,8 +25,12 @@ function toggleSort(keys, field, additive = false) {
|
|
|
25
25
|
const existing = keys.find((k) => k.field === field);
|
|
26
26
|
const dir = nextSortDir(existing?.dir);
|
|
27
27
|
if (!additive) return dir === "none" ? [] : [{ field, dir }];
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
if (dir === "none") return keys.filter((k) => k.field !== field);
|
|
29
|
+
if (!existing) return [...keys, { field, dir }];
|
|
30
|
+
return keys.map((k) => k.field === field ? { field, dir } : k);
|
|
31
|
+
}
|
|
32
|
+
function enumColumnFilter(field, value) {
|
|
33
|
+
return { field, kind: "enum", op: value.operator === "is-none-of" ? "isNoneOf" : "isAnyOf", value: [...value.values] };
|
|
30
34
|
}
|
|
31
35
|
function asNum(v) {
|
|
32
36
|
return typeof v === "number" ? v : Number(v);
|
|
@@ -236,6 +240,7 @@ function mergePinned(all, visible, pinnedIds, idField = "id") {
|
|
|
236
240
|
export {
|
|
237
241
|
applyFilters,
|
|
238
242
|
clampWidth,
|
|
243
|
+
enumColumnFilter,
|
|
239
244
|
highlightSegments,
|
|
240
245
|
matchFilter,
|
|
241
246
|
mergePinned,
|