-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathdata-display.ts
More file actions
1066 lines (1038 loc) · 24.4 KB
/
Copy pathdata-display.ts
File metadata and controls
1066 lines (1038 loc) · 24.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* ObjectUI
* Copyright (c) 2024-present ObjectStack Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/**
* @object-ui/types - Data Display Component Schemas
*
* Type definitions for components that display data and information.
*
* @module data-display
* @packageDocumentation
*/
import type { ChartType as SpecChartType } from '@objectstack/spec/ui';
import type { BaseSchema, SchemaNode } from './base';
/**
* Alert component
*/
export interface AlertSchema extends BaseSchema {
type: 'alert';
/**
* Alert title
*/
title?: string;
/**
* Alert description/message
*/
description?: string;
/**
* Alert variant
* @default 'default'
*/
variant?: 'default' | 'destructive';
/**
* Alert icon
*/
icon?: string;
/**
* Whether alert is dismissible
*/
dismissible?: boolean;
/**
* Dismiss handler
*/
onDismiss?: () => void;
/**
* Child content
*/
children?: SchemaNode | SchemaNode[];
}
/**
* Statistic component for dashboards
*/
export interface StatisticSchema extends BaseSchema {
type: 'statistic';
/**
* The label/title of the statistic (e.g. "Total Revenue")
*/
label?: string;
/**
* The main value (e.g. "$45,231.89")
*/
value: string | number;
/**
* Optional trend indicator
*/
trend?: 'up' | 'down' | 'neutral';
/**
* Additional description (e.g. "+20.1% from last month")
*/
description?: string;
/**
* Optional icon name
*/
icon?: string;
}
/**
* Badge component
*/
export interface BadgeSchema extends BaseSchema {
type: 'badge';
/**
* Badge text
*/
label?: string;
/**
* Badge variant
* @default 'default'
*/
variant?: 'default' | 'secondary' | 'destructive' | 'outline';
/**
* Badge icon
*/
icon?: string;
/**
* Child content
*/
children?: SchemaNode | SchemaNode[];
}
/**
* Avatar component
*/
export interface AvatarSchema extends BaseSchema {
type: 'avatar';
/**
* Image source URL
*/
src?: string;
/**
* Alt text
*/
alt?: string;
/**
* Fallback text (initials)
*/
fallback?: string;
/**
* Avatar size
* @default 'default'
*/
size?: 'sm' | 'default' | 'lg' | 'xl';
/**
* Avatar shape
* @default 'circle'
*/
shape?: 'circle' | 'square';
}
/**
* List component
*/
export interface ListSchema extends BaseSchema {
type: 'list';
/**
* List items
*/
items: ListItem[];
/**
* Whether list is ordered
* @default false
*/
ordered?: boolean;
/**
* List item dividers
* @default false
*/
dividers?: boolean;
/**
* Dense/compact layout
* @default false
*/
dense?: boolean;
}
/**
* List item
*/
export interface ListItem {
/**
* Unique item identifier
*/
id?: string;
/**
* Item label/title
*/
label?: string;
/**
* Item description
*/
description?: string;
/**
* Item icon
*/
icon?: string;
/**
* Item avatar image
*/
avatar?: string;
/**
* Whether item is disabled
*/
disabled?: boolean;
/**
* Click handler
*/
onClick?: () => void;
/**
* Item content (schema nodes)
*/
content?: SchemaNode | SchemaNode[];
}
/**
* Table column definition
*/
export interface TableColumn {
/**
* Column header text
*/
header: string;
/**
* Key to access data in row object
*/
accessorKey: string;
/**
* Header CSS class
*/
className?: string;
/**
* Cell CSS class
*/
cellClassName?: string;
/**
* Column width
*/
width?: string | number;
/**
* Column minimum width
*/
minWidth?: string | number;
/**
* Text alignment
* @default 'left'
*/
align?: 'left' | 'center' | 'right';
/**
* Pin column to side
*/
fixed?: 'left' | 'right';
/**
* Data type for formatting
*/
type?: 'text' | 'number' | 'date' | 'datetime' | 'currency' | 'percent' | 'boolean' | 'action';
/**
* Whether column is sortable
* @default true
*/
sortable?: boolean;
/**
* Whether column is filterable
* @default true
*/
filterable?: boolean;
/**
* Whether column is resizable
* @default true
*/
resizable?: boolean;
/**
* Whether column is editable (for inline editing)
* @default true
*/
editable?: boolean;
/**
* Custom cell renderer function
*/
cell?: (value: any, row: any) => any;
}
/**
* Simple table component
*/
export interface TableSchema extends BaseSchema {
type: 'table';
/**
* Table caption
*/
caption?: string;
/**
* Table columns
*/
columns: TableColumn[];
/**
* Table data rows
*/
data: any[];
/**
* Table footer content
*/
footer?: SchemaNode | SchemaNode[] | string;
/**
* Whether table has hover effect
* @default true
*/
hoverable?: boolean;
/**
* Whether table has striped rows
* @default false
*/
striped?: boolean;
}
/**
* A single extra per-row action rendered in the data-table's row overflow
* menu (after Edit/Delete). Used to surface an object's own row actions in
* embedded tables — e.g. a detail page's related list showing the child
* object's `list_item` actions. The host pre-localizes `label`/`confirmText`
* and executes the action via {@link DataTableSchema.onRowActionDef}.
*/
export interface DataTableRowAction {
/** Stable action name. */
name: string;
/** Display label (already localized). */
label?: string;
/** Lucide icon name (kebab-case). */
icon?: string;
/** `'danger'` renders the item in the destructive color. */
variant?: 'primary' | 'secondary' | 'danger' | 'ghost' | 'link';
/** Confirmation prompt shown before the action runs. */
confirmText?: string;
/** Remaining action metadata is preserved for the host executor. */
[k: string]: unknown;
}
/**
* Enterprise data table with advanced features
*/
export interface DataTableSchema extends BaseSchema {
type: 'data-table';
/**
* Render the table without its outer rounded border. Useful when the
* table is embedded inside a parent container that already provides
* visual framing (e.g. grouped rows, sub-tables).
* @default false
*/
borderless?: boolean;
/**
* Drop the table's own horizontal/vertical scroll container so the table
* overflows into a shared parent scroll container instead. Used by the
* grouped grid so every per-group sub-table participates in ONE shared
* horizontal scrollbar (and keeps columns aligned) rather than each group
* scrolling independently.
* @default false
*/
disableInnerScroll?: boolean;
/**
* Table caption
*/
caption?: string;
/**
* Table toolbar actions/content
*/
toolbar?: SchemaNode[];
/**
* Table columns
*/
columns: TableColumn[];
/**
* Table data rows
*/
data: any[];
/**
* Enable pagination
* @default true
*/
pagination?: boolean;
/**
* Rows per page
* @default 10
*/
pageSize?: number;
/**
* Options offered in the "rows per page" selector. When omitted the table
* falls back to its built-in list (5/10/20/50/100). The current `pageSize`
* is always merged in so the selector can show the active value even if it
* is not one of the configured options.
*/
pageSizeOptions?: number[];
/**
* Server-side ("manual") pagination. When true, `data` is treated as the
* already-fetched current page (not sliced locally), `rowCount` provides the
* total match count used to compute total pages, the current page is
* controlled via `page`, and page/size changes are reported through
* `onPageChange` / `onPageSizeChange` so the caller can re-fetch. Without it
* the table paginates the in-memory `data` client-side (legacy behavior).
* @default false
*/
manualPagination?: boolean;
/**
* Total number of rows matching the query on the server. Only used when
* `manualPagination` is true — drives the total-page count.
*/
rowCount?: number;
/**
* Controlled current page (1-based) for `manualPagination`.
*/
page?: number;
/**
* Called when the user navigates to another page under `manualPagination`.
*/
onPageChange?: (page: number) => void;
/**
* Called when the user changes the page size under `manualPagination`.
*/
onPageSizeChange?: (pageSize: number) => void;
/**
* Enable search
* @default true
*/
searchable?: boolean;
/**
* Enable row selection
* - boolean: Enable/disable selection (true = multiple selection)
* - 'single': Single row selection
* - 'multiple': Multiple row selection
* @default false
*/
selectable?: boolean | 'single' | 'multiple';
/**
* Selection checkbox display style
* - 'always': Checkboxes are always visible
* - 'hover': Checkboxes only appear on row hover
* @default 'always'
*/
selectionStyle?: 'always' | 'hover';
/**
* Whether to render the built-in "N selected" count in the table toolbar.
* Set false when an outer container (e.g. ObjectGrid's BulkActionBar) already
* surfaces the selection, to avoid a duplicate — and otherwise orphaned —
* toolbar row.
* @default true
*/
showSelectionCount?: boolean;
/**
* Enable column sorting
* @default true
*/
sortable?: boolean;
/**
* Enable CSV export
* @default false
*/
exportable?: boolean;
/**
* Show row actions (edit/delete)
* @default false
*/
rowActions?: boolean;
/**
* Enable column resizing
* @default true
*/
resizableColumns?: boolean;
/**
* Enable column reordering
* @default true
*/
reorderableColumns?: boolean;
/**
* Row edit handler
*/
onRowEdit?: (row: any) => void;
/**
* Row delete handler
*/
onRowDelete?: (row: any) => void;
/**
* Per-record CEL predicates gating the built-in row Edit item
* (objectui#2614), from the object's `userActions.edit` object form.
* `visibleWhen` false → the item is not rendered for that row (fail-closed);
* `disabledWhen` true → rendered disabled (fail-soft). Bare CEL string or
* `{ dialect: 'cel', source }` envelope, evaluated per row with the record
* bound as `record.*` and bare fields.
*/
rowEditPredicates?: { visibleWhen?: unknown; disabledWhen?: unknown };
/**
* Per-record CEL predicates gating the built-in row Delete item
* (objectui#2614), from the object's `userActions.delete` object form.
*/
rowDeletePredicates?: { visibleWhen?: unknown; disabledWhen?: unknown };
/**
* Extra per-row action definitions rendered in the row overflow menu, after
* Edit/Delete. Each is dispatched via {@link onRowActionDef} with the clicked
* row. Surfaces an object's own row actions in embedded tables (e.g. a detail
* page's related list). Requires {@link rowActions} to be enabled.
*/
rowActionDefs?: DataTableRowAction[];
/**
* Handler invoked when one of {@link rowActionDefs} is chosen from the row
* overflow menu.
*/
onRowActionDef?: (action: DataTableRowAction, row: any) => void | Promise<void>;
/**
* Selection change handler
*/
onSelectionChange?: (selectedRows: any[]) => void;
/**
* Bump this value to imperatively clear the table's internal row selection.
* The table clears its checkbox selection whenever the key changes to a new
* value. Lets a host (e.g. a grid clearing selection after a bulk action)
* reset the checkboxes, which are otherwise internal table state.
*/
selectionResetKey?: string | number;
/**
* Columns reorder handler
*/
onColumnsReorder?: (columns: TableColumn[]) => void;
/**
* Enable inline cell editing
* When true, cells become editable on double-click or Enter key
* @default false
*/
editable?: boolean;
/**
* Enable single-click editing mode
* When true with editable, clicking a cell enters edit mode (instead of double-click)
* @default false
*/
singleClickEdit?: boolean;
/**
* Cell value change handler
* Called when a cell value is edited
*/
onCellChange?: (rowIndex: number, columnKey: string, newValue: any, row: any) => void;
/**
* Row save handler
* Called when saving changes for a single row
*/
onRowSave?: (rowIndex: number, changes: Record<string, any>, row: any) => void | Promise<void>;
/**
* Batch save handler
* Called when saving changes for multiple rows
*/
onBatchSave?: (changes: Array<{ rowIndex: number; changes: Record<string, any>; row: any }>) => void | Promise<void>;
/**
* Row click handler
* Called when a row is clicked
*/
onRowClick?: (row: any) => void;
/**
* Dynamic row class name
* Function that returns a CSS class string for each row
*/
rowClassName?: (row: any, index: number) => string | undefined;
/**
* Dynamic row inline style
* Function that returns CSSProperties for each row (e.g., from conditionalFormatting).
*/
rowStyle?: (row: any, index: number) => React.CSSProperties | undefined;
/**
* Number of columns to freeze (left-pin)
* When set, the first N columns remain fixed while the rest scroll horizontally.
* @default 0
*/
frozenColumns?: number;
/**
* Show row numbers in the first column (Airtable-style)
* @default false
*/
showRowNumbers?: boolean;
/**
* Show "+ Add record" row at the bottom of the table (Airtable-style)
* @default false
*/
showAddRow?: boolean;
/**
* Optional schema node rendered inside the empty-state, e.g. an
* "Add record" button. Lets the empty state become an actionable
* invitation rather than a dead end.
*/
emptyAction?: SchemaNode;
/**
* Callback when the "+ Add record" row is clicked
*/
onAddRecord?: () => void;
/**
* Column resize handler
* Called when a column is resized
*/
onColumnResize?: (columnKey: string, width: number) => void;
/**
* Column reorder handler (new order of accessorKeys)
* Called when columns are reordered via drag-and-drop
*/
onColumnReorder?: (newOrder: string[]) => void;
}
/**
* Markdown renderer component
*/
export interface MarkdownSchema extends BaseSchema {
type: 'markdown';
/**
* Markdown content
*/
content: string;
/**
* Whether to sanitize HTML
* @default true
*/
sanitize?: boolean;
/**
* Custom components for markdown elements
*/
components?: Record<string, any>;
}
/**
* Tree view node
*/
export interface TreeNode {
/**
* Unique node identifier
*/
id: string;
/**
* Node label
*/
label: string;
/**
* Node icon
*/
icon?: string;
/**
* Whether node is expanded by default
* @default false
*/
defaultExpanded?: boolean;
/**
* Whether node is selectable
* @default true
*/
selectable?: boolean;
/**
* Child nodes
*/
children?: TreeNode[];
/**
* Additional data
*/
data?: any;
}
/**
* Tree view component
*/
export interface TreeViewSchema extends BaseSchema {
type: 'tree-view';
/**
* Tree data
*/
data: TreeNode[];
/**
* Default expanded node IDs
*/
defaultExpandedIds?: string[];
/**
* Default selected node IDs
*/
defaultSelectedIds?: string[];
/**
* Controlled expanded node IDs
*/
expandedIds?: string[];
/**
* Controlled selected node IDs
*/
selectedIds?: string[];
/**
* Enable multi-selection
* @default false
*/
multiSelect?: boolean;
/**
* Show lines connecting nodes
* @default true
*/
showLines?: boolean;
/**
* Node select handler
*/
onSelectChange?: (selectedIds: string[]) => void;
/**
* Node expand handler
*/
onExpandChange?: (expandedIds: string[]) => void;
}
/**
* Chart type
*/
/**
* Chart Type — `@objectstack/spec`'s own `ChartType` re-exported (issue
* #2231/#2901; formerly a hand-written union that had drifted to 7 of 19 values).
*
* Re-exported rather than restated, so a chart family the spec adds cannot go
* missing here.
*/
export type ChartType = SpecChartType;
/**
* Chart data series
*/
export interface ChartSeries {
/**
* Series name
*/
name: string;
/**
* Series data points
*/
data: number[];
/**
* Series color
*/
color?: string;
}
/**
* Chart component
*/
export interface ChartSchema extends BaseSchema {
type: 'chart';
/**
* Chart type
*/
chartType: ChartType;
/**
* Chart title
*/
title?: string;
/**
* Chart description
*/
description?: string;
/**
* X-axis labels/categories
*/
categories?: string[];
/**
* Data series
*/
series: ChartSeries[];
/**
* Chart height
*/
height?: string | number;
/**
* Chart width
*/
width?: string | number;
/**
* Show legend
* @default true
*/
showLegend?: boolean;
/**
* Show grid
* @default true
*/
showGrid?: boolean;
/**
* Enable animations
* @default true
*/
animate?: boolean;
/**
* Chart configuration (library-specific)
*/
config?: Record<string, any>;
/**
* Optional drill-down configuration. When enabled, clicking a chart
* segment opens a filtered list view (drawer/dialog).
*/
drillDown?: DrillDownConfig;
}
/**
* Aggregation function for pivot table values
*/
export type PivotAggregation = 'sum' | 'count' | 'avg' | 'min' | 'max';
/**
* Declarative drill-down configuration shared by pivot tables and charts.
*
* When a user clicks a pivot cell / chart segment, the engine opens a side
* drawer (default) listing the underlying records filtered by the click
* context. All values support `${event.*}` interpolation; sensible defaults
* are derived from the widget's row/column/groupBy fields when omitted.
*
* Pivot event payload: rowKey, colKey, rowLabel, colLabel, value, scope
* Chart event payload: category, series, value
*/
export interface DrillDownConfig {
/** Master switch. Set to true (or supply any other field) to enable. */
enabled?: boolean;
/**
* Which drill interaction the widget performs:
*
* - `'filter'` (default) — **drill-through**: the click point is an
* aggregated bucket (pivot cell, chart segment, KPI). The drawer lists
* the underlying records filtered by the click context. Used by charts,
* pivot tables and metric cards.
* - `'record'` — **drill-to-record**: the click point already *is* a single
* record (a row in a table / list widget). The drawer shows that record's
* detail instead of a filtered list. This is the default for table / list
* widgets, mirroring Salesforce list-view row → record and Power BI's
* "see records" row interaction.
*
* When omitted the consuming widget picks the natural default for its type.
*/
mode?: 'filter' | 'record';
/**
* Where the drill-down lands. Defaults to `'drawer'`.
*
* - `'drawer'` — in-place side sheet listing the records (peek without
* leaving the dashboard). The mainstream default.
* - `'dialog'` — same content in a centered modal (used when stacking over
* another drawer).
* - `'navigate'` — skip the in-place view and go straight to the object's
* full list page (sort / bulk-select / export / shareable URL). Requires a
* host that provides drill navigation (see `DrillNavigationContext`); falls
* back to `'drawer'` when none is available.
*
* Independent of `target`, the in-place drawer also offers an "Open in list →"
* affordance when a host navigation handler is present, so users can escalate
* from a peek to the full list at any time.
*/
target?: 'drawer' | 'dialog' | 'navigate';
/**
* Filter applied to the drilled list view. Each value supports
* `${event.x}` interpolation (e.g. `"${event.rowKey}"`).
* When omitted, the engine derives a default filter from the widget's
* row/column/groupBy fields and the click payload.
*/
filter?: Record<string, unknown>;
/** Drawer/dialog title. Supports `${event.*}` interpolation. */
title?: string;
/**
* Optional list view id (reserved). When supported the engine looks up
* the named list view from the app and renders it inside the drawer.
* For the L1 implementation an inline ObjectDataTable is rendered.
*/
view?: string;
/**
* Drill into an analytical Report instead of the raw record list. When
* provided, the drill-down drawer renders the supplied `SpecReport` (with
* `widget.filter ∧ report.filter` merged so the metric's scope is honoured).
*
* This is the M3 "Dashboard → Report → List → Record" path: the KPI on the
* dashboard expands into a multi-dimensional breakdown report; the report
* itself can drill into a list of records (via its own row-click drill),
* which can drill into a single record.
*
* Either an inline `SpecReport` JSON or a named report reference is
* supported. Implementations may render the named form by resolving it
* against an app-level report registry.
*
* The shape is structural to avoid a circular import with `spec-report.ts`.
*/
report?:
| {
name: string;
objectName: string;
type?: 'tabular' | 'summary' | 'matrix' | 'joined';
columns: Array<unknown>;
[k: string]: unknown;
}
| { name: string };
/**
* Optional column whitelist for the inline drill list. When omitted the
* data table renders all default columns.
*/
columns?: string[];
/** Default sort applied to the drill list. */
sort?: Array<{ field: string; dir?: 'asc' | 'desc' }>;
/** Hard cap on rows fetched. */
maxRows?: number;
}
/**
* Pivot table (cross-tabulation) component
*
* Renders a matrix where rows correspond to one field,
* columns to another, and cells show an aggregated value.
*/
export interface PivotTableSchema extends BaseSchema {
type: 'pivot';
/**
* Pivot table title
*/
title?: string;
/**
* Field used for row headers
*/
rowField: string;
/**
* Field used for column headers
*/
columnField: string;
/**
* Field whose values are aggregated in cells
*/
valueField: string;
/**
* Aggregation function applied to valueField
* @default 'sum'
*/
aggregation?: PivotAggregation;
/**
* Source data rows
*/
data: Record<string, unknown>[];
/**
* Show a totals column on the right
* @default false
*/
showRowTotals?: boolean;
/**
* Show a totals row at the bottom
* @default false
*/
showColumnTotals?: boolean;
/**
* Numeric format string (e.g. "$,.2f") — applied via simple prefix/suffix/decimals
*/
format?: string;
/**
* Mapping of column header values to Tailwind text-color classes
*/
columnColors?: Record<string, string>;
/**
* Optional drill-down configuration. When enabled, clicking a cell /
* row header / column header / total opens a filtered list view.
*/
drillDown?: DrillDownConfig;
}
/**
* Timeline event
*/
export interface TimelineEvent {
/**
* Event unique identifier
*/
id?: string;
/**
* Event title
*/
title: string;
/**
* Event description
*/
description?: string;
/**
* Event date/time
*/
date: string | Date;
/**
* Event icon
*/
icon?: string;
/**
* Event color
*/
color?: string;
/**
* Event content
*/
content?: SchemaNode | SchemaNode[];
}
/**
* Timeline component
*/
export interface TimelineSchema extends BaseSchema {
type: 'timeline';
/**
* Timeline events
*/
events: TimelineEvent[];
/**
* Timeline orientation
* @default 'vertical'
*/
orientation?: 'vertical' | 'horizontal';
/**
* Timeline position (for vertical)
* @default 'left'
*/
position?: 'left' | 'right' | 'alternate';
}
/**
* Breadcrumb item
*/
export interface BreadcrumbItem {
/**
* Item label
*/
label: string;
/**