@upbound/monarch-blocks 0.11.1 → 0.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/data-table.d.ts +34 -38
- package/dist/data-table.js +93 -49
- package/dist/data-table.js.map +1 -1
- package/dist/{empty-view-CjRwaITk.d.ts → empty-view--jBQ7evg.d.ts} +80 -8
- package/dist/graph.d.ts +5 -4
- package/dist/graph.js +52 -10
- package/dist/graph.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +96 -61
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,6 +1,78 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { IconName } from '@upbound/monarch-core';
|
|
3
|
-
import { RowData, Cell } from '@tanstack/react-table';
|
|
3
|
+
import { RowData, Cell, Column, TableOptions, Row, ColumnDef, HeaderGroup, Header, ReactTable, TableFeatures } from '@tanstack/react-table';
|
|
4
|
+
import * as _tanstack_table_core from '@tanstack/table-core';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Every TanStack Table feature `DataTable` uses, registered once for all tables.
|
|
8
|
+
*
|
|
9
|
+
* TanStack Table v9 only exposes an API (`column.getIsPinned()`, `table.getRowModel()` sorting, …)
|
|
10
|
+
* when its feature is registered here, and the row-model slots are static. `DataTable` therefore
|
|
11
|
+
* always registers every row model and turns a stage off through state or `manual*` options
|
|
12
|
+
* instead (see `data-table.tsx`).
|
|
13
|
+
*/
|
|
14
|
+
declare const dataTableFeatures: {
|
|
15
|
+
columnFilteringFeature: _tanstack_table_core.TableFeature;
|
|
16
|
+
globalFilteringFeature: _tanstack_table_core.TableFeature;
|
|
17
|
+
columnFacetingFeature: _tanstack_table_core.TableFeature;
|
|
18
|
+
rowSortingFeature: _tanstack_table_core.TableFeature;
|
|
19
|
+
rowPaginationFeature: _tanstack_table_core.TableFeature;
|
|
20
|
+
rowExpandingFeature: _tanstack_table_core.TableFeature;
|
|
21
|
+
columnGroupingFeature: _tanstack_table_core.TableFeature;
|
|
22
|
+
columnOrderingFeature: _tanstack_table_core.TableFeature;
|
|
23
|
+
columnPinningFeature: _tanstack_table_core.TableFeature;
|
|
24
|
+
columnVisibilityFeature: _tanstack_table_core.TableFeature;
|
|
25
|
+
columnSizingFeature: _tanstack_table_core.TableFeature;
|
|
26
|
+
columnResizingFeature: _tanstack_table_core.TableFeature;
|
|
27
|
+
filteredRowModel: (table: _tanstack_table_core.Table<any, any>) => () => _tanstack_table_core.RowModel<any, any>;
|
|
28
|
+
facetedRowModel: (table: _tanstack_table_core.Table<any, any>, columnId: string) => () => _tanstack_table_core.RowModel<any, any>;
|
|
29
|
+
facetedUniqueValues: (table: _tanstack_table_core.Table<_tanstack_table_core.TableFeatures, any>, columnId: string) => () => Map<any, number>;
|
|
30
|
+
sortedRowModel: (table: _tanstack_table_core.Table<any, any>) => () => _tanstack_table_core.RowModel<any, any>;
|
|
31
|
+
paginatedRowModel: (table: _tanstack_table_core.Table<any, any>) => () => _tanstack_table_core.RowModel<any, any>;
|
|
32
|
+
groupedRowModel: (table: _tanstack_table_core.Table<any, any>) => () => _tanstack_table_core.RowModel<any, any>;
|
|
33
|
+
expandedRowModel: (table: _tanstack_table_core.Table<any, any>) => () => _tanstack_table_core.RowModel<any, any>;
|
|
34
|
+
filterFns: {
|
|
35
|
+
arrIncludes: _tanstack_table_core.CreatedFilterFn<any, any>;
|
|
36
|
+
arrIncludesAll: _tanstack_table_core.CreatedFilterFn<any, any>;
|
|
37
|
+
arrHas: _tanstack_table_core.CreatedFilterFn<any, any>;
|
|
38
|
+
arrIncludesSome: _tanstack_table_core.CreatedFilterFn<any, any>;
|
|
39
|
+
between: _tanstack_table_core.CreatedFilterFn<any, any>;
|
|
40
|
+
betweenInclusive: _tanstack_table_core.CreatedFilterFn<any, any>;
|
|
41
|
+
empty: _tanstack_table_core.CreatedFilterFn<any, any>;
|
|
42
|
+
endsWith: _tanstack_table_core.CreatedFilterFn<any, any>;
|
|
43
|
+
equals: _tanstack_table_core.CreatedFilterFn<any, any>;
|
|
44
|
+
equalsString: _tanstack_table_core.CreatedFilterFn<any, any>;
|
|
45
|
+
equalsStringSensitive: _tanstack_table_core.CreatedFilterFn<any, any>;
|
|
46
|
+
inDateRange: _tanstack_table_core.CreatedFilterFn<any, any>;
|
|
47
|
+
inNumberRange: _tanstack_table_core.CreatedFilterFn<any, any>;
|
|
48
|
+
includesString: _tanstack_table_core.CreatedFilterFn<any, any>;
|
|
49
|
+
includesStringSensitive: _tanstack_table_core.CreatedFilterFn<any, any>;
|
|
50
|
+
notEmpty: _tanstack_table_core.CreatedFilterFn<any, any>;
|
|
51
|
+
startsWith: _tanstack_table_core.CreatedFilterFn<any, any>;
|
|
52
|
+
weakEquals: _tanstack_table_core.CreatedFilterFn<any, any>;
|
|
53
|
+
};
|
|
54
|
+
sortFns: {
|
|
55
|
+
alphanumeric: _tanstack_table_core.CreatedSortFn<any, any>;
|
|
56
|
+
alphanumericCaseSensitive: _tanstack_table_core.CreatedSortFn<any, any>;
|
|
57
|
+
basic: _tanstack_table_core.CreatedSortFn<any, any>;
|
|
58
|
+
datetime: _tanstack_table_core.CreatedSortFn<any, any>;
|
|
59
|
+
text: _tanstack_table_core.CreatedSortFn<any, any>;
|
|
60
|
+
textCaseSensitive: _tanstack_table_core.CreatedSortFn<any, any>;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
/** The feature set every `DataTable` is built with — the `TFeatures` argument of TanStack's core types. */
|
|
64
|
+
type DataTableFeatures = typeof dataTableFeatures;
|
|
65
|
+
/** TanStack's `ColumnDef`, bound to `DataTable`'s features. Use this to author `DataTable` columns. */
|
|
66
|
+
type DataTableColumnDef<TData extends RowData, TValue = unknown> = ColumnDef<DataTableFeatures, TData, TValue>;
|
|
67
|
+
/** TanStack's `TableOptions`, bound to `DataTable`'s features. */
|
|
68
|
+
type DataTableOptions<TData extends RowData> = TableOptions<DataTableFeatures, TData>;
|
|
69
|
+
/** The table instance `useTable` returns for `DataTable`'s features. */
|
|
70
|
+
type DataTableInstance<TData extends RowData> = ReactTable<DataTableFeatures, TData>;
|
|
71
|
+
type DataTableColumnInstance<TData extends RowData, TValue = unknown> = Column<DataTableFeatures, TData, TValue>;
|
|
72
|
+
type DataTableRowInstance<TData extends RowData> = Row<DataTableFeatures, TData>;
|
|
73
|
+
type DataTableCellInstance<TData extends RowData, TValue = unknown> = Cell<DataTableFeatures, TData, TValue>;
|
|
74
|
+
type DataTableHeaderInstance<TData extends RowData, TValue = unknown> = Header<DataTableFeatures, TData, TValue>;
|
|
75
|
+
type DataTableHeaderGroupInstance<TData extends RowData> = HeaderGroup<DataTableFeatures, TData>;
|
|
4
76
|
|
|
5
77
|
/**
|
|
6
78
|
* Non-CEL column filter definitions — the `meta.filter` vocabulary consumed by
|
|
@@ -79,9 +151,9 @@ type MultiTextColumnFilterValue = string[] | undefined;
|
|
|
79
151
|
type ColumnFilterValue = CheckboxColumnFilterValue | RadioColumnFilterValue | DateRangeColumnFilterValue | TextColumnFilterValue | MultiTextColumnFilterValue;
|
|
80
152
|
|
|
81
153
|
/** Derives a contextual (right-click cell) column-filter value from a cell. */
|
|
82
|
-
type ContextualFilterValueParser<TData extends RowData, TValue> = (cell:
|
|
154
|
+
type ContextualFilterValueParser<TData extends RowData, TValue> = (cell: DataTableCellInstance<TData, TValue>) => ColumnFilterValue | undefined;
|
|
83
155
|
/** Derives a contextual (right-click cell) global-search term from a cell. */
|
|
84
|
-
type ContextualGlobalSearchValueParser<TData extends RowData, TValue> = (cell:
|
|
156
|
+
type ContextualGlobalSearchValueParser<TData extends RowData, TValue> = (cell: DataTableCellInstance<TData, TValue>) => string | undefined;
|
|
85
157
|
/** A fixed-width grid track: sizes to content or an explicit CSS length. */
|
|
86
158
|
type GridColumnFixed = {
|
|
87
159
|
fixed: string;
|
|
@@ -122,9 +194,9 @@ type GridColumnSizing = GridColumnFixed | GridColumnFlex;
|
|
|
122
194
|
* with any of these fields.
|
|
123
195
|
*/
|
|
124
196
|
declare module '@tanstack/react-table' {
|
|
125
|
-
interface ColumnMeta<TData extends RowData, TValue> {
|
|
126
|
-
/** Pins the column
|
|
127
|
-
pinning?: '
|
|
197
|
+
interface ColumnMeta<TFeatures extends TableFeatures, TData extends RowData, TValue> {
|
|
198
|
+
/** Pins the column to the inline start or end edge. Pinned columns are excluded from column reordering. */
|
|
199
|
+
pinning?: 'start' | 'end';
|
|
128
200
|
/** Marks an actions column — hides its header label and excludes it from contextual filtering. */
|
|
129
201
|
actions?: boolean;
|
|
130
202
|
/** The column's non-CEL filter definition, read by the plain filter bar and contextual filtering. */
|
|
@@ -175,5 +247,5 @@ declare function DataTableEmptyView({ emptyView, tableState, filterCount, resetF
|
|
|
175
247
|
resetFilters: () => void;
|
|
176
248
|
}): React.JSX.Element;
|
|
177
249
|
|
|
178
|
-
export { DataTableEmptyView as
|
|
179
|
-
export type {
|
|
250
|
+
export { DataTableEmptyView as d, dataTableFeatures as k, defaultEmptyConfig as l, defaultErrorConfig as m, defaultNoFilterFoundConfig as n };
|
|
251
|
+
export type { DataTableCellInstance as D, TableDataState as T, DataTableColumnDef as a, DataTableColumnInstance as b, DataTableEmptyConfig as c, DataTableFeatures as e, DataTableHeaderGroupInstance as f, DataTableHeaderInstance as g, DataTableInstance as h, DataTableOptions as i, DataTableRowInstance as j };
|
package/dist/graph.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Node, NodeProps, Edge, EdgeProps, NodeTypes, EdgeTypes } from 'reactflow';
|
|
2
2
|
export { Edge, Node } from 'reactflow';
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import {
|
|
5
|
-
import { T as TableDataState } from './empty-view
|
|
6
|
-
import { DataTableEmptyConfig } from './data-table.js';
|
|
4
|
+
import { ColumnFiltersState } from '@tanstack/react-table';
|
|
5
|
+
import { T as TableDataState } from './empty-view--jBQ7evg.js';
|
|
6
|
+
import { DataTableColumnDef, DataTableEmptyConfig } from './data-table.js';
|
|
7
7
|
import '@upbound/monarch-core';
|
|
8
|
+
import '@tanstack/table-core';
|
|
8
9
|
|
|
9
10
|
type GraphBadgeVariant = 'default' | 'secondary' | 'destructive' | 'outline' | 'ghost' | 'link' | 'healthy' | 'unhealthy' | 'warning' | 'stale' | 'info' | 'unknown';
|
|
10
11
|
type BadgeWithTooltip = {
|
|
@@ -83,7 +84,7 @@ interface GraphProps<T extends object> {
|
|
|
83
84
|
id: string;
|
|
84
85
|
viewportFocusNodeId?: string;
|
|
85
86
|
config: GraphOptions<T>;
|
|
86
|
-
columnDefinitions?:
|
|
87
|
+
columnDefinitions?: DataTableColumnDef<T, unknown>[];
|
|
87
88
|
title?: React.ReactNode;
|
|
88
89
|
loading?: boolean;
|
|
89
90
|
showError?: boolean;
|
package/dist/graph.js
CHANGED
|
@@ -430,13 +430,58 @@ GraphActionsProvider.displayName = "GraphActionsProvider";
|
|
|
430
430
|
|
|
431
431
|
// src/graph/graph.tsx
|
|
432
432
|
import * as React7 from "react";
|
|
433
|
+
import { useTable } from "@tanstack/react-table";
|
|
434
|
+
|
|
435
|
+
// src/lib/data-table/features.ts
|
|
433
436
|
import {
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
437
|
+
columnFacetingFeature,
|
|
438
|
+
columnFilteringFeature,
|
|
439
|
+
columnGroupingFeature,
|
|
440
|
+
columnOrderingFeature,
|
|
441
|
+
columnPinningFeature,
|
|
442
|
+
columnResizingFeature,
|
|
443
|
+
columnSizingFeature,
|
|
444
|
+
columnVisibilityFeature,
|
|
445
|
+
createExpandedRowModel,
|
|
446
|
+
createFacetedRowModel,
|
|
447
|
+
createFacetedUniqueValues,
|
|
448
|
+
createFilteredRowModel,
|
|
449
|
+
createGroupedRowModel,
|
|
450
|
+
createPaginatedRowModel,
|
|
451
|
+
createSortedRowModel,
|
|
452
|
+
filterFns,
|
|
453
|
+
globalFilteringFeature,
|
|
454
|
+
rowExpandingFeature,
|
|
455
|
+
rowPaginationFeature,
|
|
456
|
+
rowSortingFeature,
|
|
457
|
+
sortFns,
|
|
458
|
+
tableFeatures
|
|
439
459
|
} from "@tanstack/react-table";
|
|
460
|
+
var dataTableFeatures = tableFeatures({
|
|
461
|
+
columnFilteringFeature,
|
|
462
|
+
globalFilteringFeature,
|
|
463
|
+
columnFacetingFeature,
|
|
464
|
+
rowSortingFeature,
|
|
465
|
+
rowPaginationFeature,
|
|
466
|
+
rowExpandingFeature,
|
|
467
|
+
columnGroupingFeature,
|
|
468
|
+
columnOrderingFeature,
|
|
469
|
+
columnPinningFeature,
|
|
470
|
+
columnVisibilityFeature,
|
|
471
|
+
columnSizingFeature,
|
|
472
|
+
columnResizingFeature,
|
|
473
|
+
filteredRowModel: createFilteredRowModel(),
|
|
474
|
+
facetedRowModel: createFacetedRowModel(),
|
|
475
|
+
facetedUniqueValues: createFacetedUniqueValues(),
|
|
476
|
+
sortedRowModel: createSortedRowModel(),
|
|
477
|
+
paginatedRowModel: createPaginatedRowModel(),
|
|
478
|
+
groupedRowModel: createGroupedRowModel(),
|
|
479
|
+
expandedRowModel: createExpandedRowModel(),
|
|
480
|
+
filterFns,
|
|
481
|
+
sortFns
|
|
482
|
+
});
|
|
483
|
+
|
|
484
|
+
// src/graph/graph.tsx
|
|
440
485
|
import { Icon as Icon4, InputGroup, InputGroupAddon, InputGroupInput } from "@upbound/monarch-core";
|
|
441
486
|
|
|
442
487
|
// src/lib/data-table/contextual-filters.ts
|
|
@@ -1590,13 +1635,10 @@ function Graph({
|
|
|
1590
1635
|
}, [parentGlobalFilter]);
|
|
1591
1636
|
const columnFilters = parentColumnFilters != null ? parentColumnFilters : innerColumnFilters;
|
|
1592
1637
|
const setColumnFilters = parentSetColumnFilters != null ? parentSetColumnFilters : setInnerColumnFilters;
|
|
1593
|
-
const table =
|
|
1638
|
+
const table = useTable({
|
|
1639
|
+
features: dataTableFeatures,
|
|
1594
1640
|
data: config.data,
|
|
1595
1641
|
columns: columnDefinitions,
|
|
1596
|
-
getCoreRowModel: getCoreRowModel(),
|
|
1597
|
-
getFilteredRowModel: getFilteredRowModel(),
|
|
1598
|
-
getFacetedRowModel: getFacetedRowModel(),
|
|
1599
|
-
getFacetedUniqueValues: getFacetedUniqueValues(),
|
|
1600
1642
|
state: { columnFilters, globalFilter },
|
|
1601
1643
|
onColumnFiltersChange: setColumnFilters,
|
|
1602
1644
|
onGlobalFilterChange: setGlobalFilter,
|