@happyvertical/smrt-ui 0.42.4 → 0.42.5

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.
Files changed (48) hide show
  1. package/README.md +157 -3
  2. package/dist/components/data/DataTable.svelte +1097 -111
  3. package/dist/components/data/DataTable.svelte.d.ts +1 -1
  4. package/dist/components/data/DataTable.svelte.d.ts.map +1 -1
  5. package/dist/components/data/DataTableController.d.ts +45 -5
  6. package/dist/components/data/DataTableController.d.ts.map +1 -1
  7. package/dist/components/data/DataTableController.js +153 -11
  8. package/dist/components/data/DataTableLayout.d.ts +37 -0
  9. package/dist/components/data/DataTableLayout.d.ts.map +1 -0
  10. package/dist/components/data/DataTableLayout.js +135 -0
  11. package/dist/components/data/DataTablePerformance.d.ts +31 -0
  12. package/dist/components/data/DataTablePerformance.d.ts.map +1 -0
  13. package/dist/components/data/DataTablePerformance.js +46 -0
  14. package/dist/components/data/DataTableVirtualization.d.ts +71 -0
  15. package/dist/components/data/DataTableVirtualization.d.ts.map +1 -0
  16. package/dist/components/data/DataTableVirtualization.js +100 -0
  17. package/dist/components/data/__benchmarks__/DataTable.bench.d.ts +2 -0
  18. package/dist/components/data/__benchmarks__/DataTable.bench.d.ts.map +1 -0
  19. package/dist/components/data/__benchmarks__/DataTable.bench.js +53 -0
  20. package/dist/components/data/__fixtures__/DataTableConformanceFixture.d.ts +27 -0
  21. package/dist/components/data/__fixtures__/DataTableConformanceFixture.d.ts.map +1 -0
  22. package/dist/components/data/__fixtures__/DataTableConformanceFixture.js +141 -0
  23. package/dist/components/data/__fixtures__/DataTablePerformanceFixture.d.ts +10 -0
  24. package/dist/components/data/__fixtures__/DataTablePerformanceFixture.d.ts.map +1 -0
  25. package/dist/components/data/__fixtures__/DataTablePerformanceFixture.js +23 -0
  26. package/dist/components/data/__tests__/DataTable.test.js +393 -8
  27. package/dist/components/data/__tests__/DataTableConformance.test.js +212 -0
  28. package/dist/components/data/__tests__/DataTableController.test.js +124 -2
  29. package/dist/components/data/__tests__/DataTableLayout.test.js +195 -0
  30. package/dist/components/data/__tests__/DataTablePerformance.test.js +21 -0
  31. package/dist/components/data/__tests__/DataTableVirtualization.test.js +80 -0
  32. package/dist/components/data/__tests__/DataTableVirtualizationComponent.test.js +255 -0
  33. package/dist/components/data/__tests__/data-surface.test.js +675 -0
  34. package/dist/components/data/data-surface.d.ts +246 -0
  35. package/dist/components/data/data-surface.d.ts.map +1 -0
  36. package/dist/components/data/data-surface.js +1102 -0
  37. package/dist/components/data/index.d.ts +3 -0
  38. package/dist/components/data/index.d.ts.map +1 -1
  39. package/dist/components/data/index.js +3 -0
  40. package/dist/components/data/types.d.ts +83 -1
  41. package/dist/components/data/types.d.ts.map +1 -1
  42. package/dist/i18n/strings.d.ts +25 -0
  43. package/dist/i18n/strings.d.ts.map +1 -1
  44. package/dist/i18n/strings.js +27 -2
  45. package/dist/svelte/playground/DataTablePreview.svelte +374 -5
  46. package/dist/svelte/playground/DataTablePreview.svelte.d.ts.map +1 -1
  47. package/dist/svelte/playground.js +2 -2
  48. package/package.json +3 -2
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Published, testable scale guidance for the DataTable pipeline.
3
+ *
4
+ * These are interaction thresholds, not hard data limits. Use the benchmark
5
+ * fixture before raising them for a new renderer, browser target, or cell shape.
6
+ */
7
+ export const DATA_TABLE_SCALE_THRESHOLDS = {
8
+ localRender: {
9
+ maxRows: 250,
10
+ maxCells: 5_000,
11
+ recommendation: 'Use normal semantic rendering for ordinary, bounded result sets.',
12
+ },
13
+ clientTransforms: {
14
+ maxRows: 1_000,
15
+ maxCells: 20_000,
16
+ recommendation: 'Use manual filtering, sorting, or paging once a client transform exceeds this budget.',
17
+ },
18
+ manualPaging: {
19
+ recommendedPageSize: 100,
20
+ maxRenderedRows: 250,
21
+ recommendation: 'Keep remote pages bounded and pass totalRows only for a known server total.',
22
+ },
23
+ virtualization: {
24
+ minRows: 250,
25
+ recommendation: 'Use fixed-height virtualization for continuous browsing above the local render budget; preserve stable rowKey values and retain remote paging for unbounded data.',
26
+ },
27
+ };
28
+ /** Returns the recommended rendering strategy for a known row and column count. */
29
+ export function recommendDataTableScaleStrategy(rowCount, columnCount) {
30
+ if (!Number.isInteger(rowCount) ||
31
+ !Number.isInteger(columnCount) ||
32
+ rowCount < 0 ||
33
+ columnCount < 0) {
34
+ throw new TypeError('DataTable scale counts must be non-negative integers');
35
+ }
36
+ const cells = rowCount * columnCount;
37
+ if (rowCount <= DATA_TABLE_SCALE_THRESHOLDS.localRender.maxRows &&
38
+ cells <= DATA_TABLE_SCALE_THRESHOLDS.localRender.maxCells) {
39
+ return 'local';
40
+ }
41
+ if (rowCount > DATA_TABLE_SCALE_THRESHOLDS.clientTransforms.maxRows ||
42
+ cells > DATA_TABLE_SCALE_THRESHOLDS.clientTransforms.maxCells) {
43
+ return 'manual-paging';
44
+ }
45
+ return 'virtualization';
46
+ }
@@ -0,0 +1,71 @@
1
+ import type { DataTableRowId } from './DataTableController.js';
2
+ /**
3
+ * Fixed-height virtualization configuration for the DataTable body.
4
+ *
5
+ * Header groups and summary rows remain normal table sections and are not
6
+ * included in the virtual row count. Body rows must have a fixed height.
7
+ */
8
+ export interface DataTableVirtualizationOptions {
9
+ /** The measured, fixed height of each data row in CSS pixels. */
10
+ rowHeight: number;
11
+ /**
12
+ * The visible height of the scrolling data viewport in CSS pixels. The
13
+ * component adds measured caption and header height around this body region.
14
+ */
15
+ viewportHeight: number;
16
+ /** Extra rows rendered before and after the visible range. Defaults to 3. */
17
+ overscan?: number;
18
+ /** Controlled scroll position, used to restore a table after remounting. */
19
+ scrollTop?: number;
20
+ /**
21
+ * Receives the current virtual scroll position. When a footer is present,
22
+ * its measured height extends the range so it remains reachable.
23
+ */
24
+ onScrollTopChange?: (scrollTop: number) => void;
25
+ /**
26
+ * A stable row id that must remain visible. Use this with
27
+ * `onFocusedRowIdChange` to restore keyboard focus after a data refresh.
28
+ */
29
+ focusedRowId?: DataTableRowId | null;
30
+ /** Receives the stable id of a row when focus enters that row. */
31
+ onFocusedRowIdChange?: (rowId: DataTableRowId) => void;
32
+ }
33
+ export type DataTableVirtualizationReason = 'disabled' | 'variable-row-height';
34
+ export interface DataTableVirtualizationContext {
35
+ options?: DataTableVirtualizationOptions;
36
+ rowCount: number;
37
+ scrollTop: number;
38
+ /** Expansion and body group rows produce variable heights and disable the window. */
39
+ hasVariableRowHeight?: boolean;
40
+ /** Structural header rows, including grouped headers. Excluded from the window. */
41
+ headerRowCount?: number;
42
+ /** Structural summary rows. Excluded from the window. */
43
+ summaryRowCount?: number;
44
+ }
45
+ export interface DataTableVirtualWindow {
46
+ enabled: boolean;
47
+ reason?: DataTableVirtualizationReason;
48
+ startIndex: number;
49
+ endIndex: number;
50
+ topSpacerHeight: number;
51
+ bottomSpacerHeight: number;
52
+ totalBodyHeight: number;
53
+ headerRowCount: number;
54
+ summaryRowCount: number;
55
+ }
56
+ /**
57
+ * Returns the maximum scroll position for a virtual body and an optional
58
+ * measured summary footer. Header and caption height are outside this range.
59
+ */
60
+ export declare function maximumDataTableVirtualScrollTop(rowCount: number, options: Pick<DataTableVirtualizationOptions, 'rowHeight' | 'viewportHeight'>, footerHeight?: number): number;
61
+ /**
62
+ * Resolves the renderable data-row window without using source order as an
63
+ * identity. The caller retains the rows and slices by the returned indexes.
64
+ */
65
+ export declare function resolveDataTableVirtualWindow(context: DataTableVirtualizationContext): DataTableVirtualWindow;
66
+ /**
67
+ * Returns the smallest fixed-height scroll position that reveals a stable row
68
+ * index, clamped to the body extent. Callers resolve the index from `rowKey`.
69
+ */
70
+ export declare function scrollTopForDataTableRow(rowIndex: number, rowCount: number, options: Pick<DataTableVirtualizationOptions, 'rowHeight' | 'viewportHeight'>, currentScrollTop?: number): number;
71
+ //# sourceMappingURL=DataTableVirtualization.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataTableVirtualization.d.ts","sourceRoot":"","sources":["../../../src/components/data/DataTableVirtualization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE/D;;;;;GAKG;AACH,MAAM,WAAW,8BAA8B;IAC7C,iEAAiE;IACjE,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4EAA4E;IAC5E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD;;;OAGG;IACH,YAAY,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;IACrC,kEAAkE;IAClE,oBAAoB,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;CACxD;AAED,MAAM,MAAM,6BAA6B,GAAG,UAAU,GAAG,qBAAqB,CAAC;AAE/E,MAAM,WAAW,8BAA8B;IAC7C,OAAO,CAAC,EAAE,8BAA8B,CAAC;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,qFAAqF;IACrF,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,mFAAmF;IACnF,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,yDAAyD;IACzD,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,6BAA6B,CAAC;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;CACzB;AAkCD;;;GAGG;AACH,wBAAgB,gCAAgC,CAC9C,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,IAAI,CAAC,8BAA8B,EAAE,WAAW,GAAG,gBAAgB,CAAC,EAC7E,YAAY,SAAI,GACf,MAAM,CAaR;AAqBD;;;GAGG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,8BAA8B,GACtC,sBAAsB,CAyDxB;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,IAAI,CAAC,8BAA8B,EAAE,WAAW,GAAG,gBAAgB,CAAC,EAC7E,gBAAgB,SAAI,GACnB,MAAM,CA0BR"}
@@ -0,0 +1,100 @@
1
+ function assertNonNegativeInteger(value, label) {
2
+ if (!Number.isInteger(value) || value < 0) {
3
+ throw new TypeError(`DataTable virtualization ${label} must be a non-negative integer`);
4
+ }
5
+ }
6
+ function assertPositiveFinite(value, label) {
7
+ if (!Number.isFinite(value) || value <= 0) {
8
+ throw new TypeError(`DataTable virtualization ${label} must be a positive finite number`);
9
+ }
10
+ }
11
+ function clampScrollTop(scrollTop, totalBodyHeight, viewportHeight) {
12
+ if (!Number.isFinite(scrollTop)) {
13
+ throw new TypeError('DataTable virtualization scrollTop must be a finite number');
14
+ }
15
+ return Math.min(Math.max(0, scrollTop), Math.max(0, totalBodyHeight - viewportHeight));
16
+ }
17
+ /**
18
+ * Returns the maximum scroll position for a virtual body and an optional
19
+ * measured summary footer. Header and caption height are outside this range.
20
+ */
21
+ export function maximumDataTableVirtualScrollTop(rowCount, options, footerHeight = 0) {
22
+ assertNonNegativeInteger(rowCount, 'rowCount');
23
+ assertPositiveFinite(options.rowHeight, 'rowHeight');
24
+ assertPositiveFinite(options.viewportHeight, 'viewportHeight');
25
+ if (!Number.isFinite(footerHeight) || footerHeight < 0) {
26
+ throw new TypeError('DataTable virtualization footerHeight must be a non-negative finite number');
27
+ }
28
+ return Math.max(0, rowCount * options.rowHeight - options.viewportHeight + footerHeight);
29
+ }
30
+ function staticWindow(rowCount, reason, headerRowCount, summaryRowCount) {
31
+ return {
32
+ enabled: false,
33
+ reason,
34
+ startIndex: 0,
35
+ endIndex: rowCount,
36
+ topSpacerHeight: 0,
37
+ bottomSpacerHeight: 0,
38
+ totalBodyHeight: 0,
39
+ headerRowCount,
40
+ summaryRowCount,
41
+ };
42
+ }
43
+ /**
44
+ * Resolves the renderable data-row window without using source order as an
45
+ * identity. The caller retains the rows and slices by the returned indexes.
46
+ */
47
+ export function resolveDataTableVirtualWindow(context) {
48
+ const { options, rowCount, scrollTop, hasVariableRowHeight = false, headerRowCount = 0, summaryRowCount = 0, } = context;
49
+ assertNonNegativeInteger(rowCount, 'rowCount');
50
+ assertNonNegativeInteger(headerRowCount, 'headerRowCount');
51
+ assertNonNegativeInteger(summaryRowCount, 'summaryRowCount');
52
+ if (!options) {
53
+ return staticWindow(rowCount, 'disabled', headerRowCount, summaryRowCount);
54
+ }
55
+ const overscan = options.overscan ?? 3;
56
+ assertPositiveFinite(options.rowHeight, 'rowHeight');
57
+ assertPositiveFinite(options.viewportHeight, 'viewportHeight');
58
+ assertNonNegativeInteger(overscan, 'overscan');
59
+ if (hasVariableRowHeight) {
60
+ return staticWindow(rowCount, 'variable-row-height', headerRowCount, summaryRowCount);
61
+ }
62
+ const totalBodyHeight = rowCount * options.rowHeight;
63
+ const currentScrollTop = clampScrollTop(scrollTop, totalBodyHeight, options.viewportHeight);
64
+ const startIndex = Math.max(0, Math.floor(currentScrollTop / options.rowHeight) - overscan);
65
+ const endIndex = Math.min(rowCount, Math.ceil((currentScrollTop + options.viewportHeight) / options.rowHeight) +
66
+ overscan);
67
+ return {
68
+ enabled: true,
69
+ startIndex,
70
+ endIndex,
71
+ topSpacerHeight: startIndex * options.rowHeight,
72
+ bottomSpacerHeight: (rowCount - endIndex) * options.rowHeight,
73
+ totalBodyHeight,
74
+ headerRowCount,
75
+ summaryRowCount,
76
+ };
77
+ }
78
+ /**
79
+ * Returns the smallest fixed-height scroll position that reveals a stable row
80
+ * index, clamped to the body extent. Callers resolve the index from `rowKey`.
81
+ */
82
+ export function scrollTopForDataTableRow(rowIndex, rowCount, options, currentScrollTop = 0) {
83
+ assertNonNegativeInteger(rowIndex, 'rowIndex');
84
+ assertNonNegativeInteger(rowCount, 'rowCount');
85
+ if (rowIndex >= rowCount) {
86
+ throw new RangeError('DataTable virtualization rowIndex must reference a data row');
87
+ }
88
+ assertPositiveFinite(options.rowHeight, 'rowHeight');
89
+ assertPositiveFinite(options.viewportHeight, 'viewportHeight');
90
+ const totalBodyHeight = rowCount * options.rowHeight;
91
+ const current = clampScrollTop(currentScrollTop, totalBodyHeight, options.viewportHeight);
92
+ const rowTop = rowIndex * options.rowHeight;
93
+ const rowBottom = rowTop + options.rowHeight;
94
+ const next = rowTop < current
95
+ ? rowTop
96
+ : rowBottom > current + options.viewportHeight
97
+ ? rowBottom - options.viewportHeight
98
+ : current;
99
+ return clampScrollTop(next, totalBodyHeight, options.viewportHeight);
100
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=DataTable.bench.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataTable.bench.d.ts","sourceRoot":"","sources":["../../../../src/components/data/__benchmarks__/DataTable.bench.ts"],"names":[],"mappings":""}
@@ -0,0 +1,53 @@
1
+ import { render } from '@testing-library/svelte';
2
+ import { bench, describe } from 'vitest';
3
+ import { createDataTablePerformanceColumns, createDataTablePerformanceRows, } from '../__fixtures__/DataTablePerformanceFixture.js';
4
+ import DataTable from '../DataTable.svelte';
5
+ import { createDataTableController } from '../DataTableController.js';
6
+ const localRows = createDataTablePerformanceRows(250, 18);
7
+ const localColumns = createDataTablePerformanceColumns(18);
8
+ const transformRows = createDataTablePerformanceRows(1_000, 18);
9
+ const manualPageRows = createDataTablePerformanceRows(100, 18);
10
+ const BenchmarkDataTable = DataTable;
11
+ describe('DataTable scale thresholds', () => {
12
+ bench('local render: 250 rows and 20 columns', () => {
13
+ const table = render(BenchmarkDataTable, {
14
+ props: { data: localRows, columns: localColumns, rowKey: 'id' },
15
+ });
16
+ table.unmount();
17
+ });
18
+ bench('client transforms: 1,000 rows and 20 columns', () => {
19
+ const controller = createDataTableController({
20
+ columnIds: localColumns.map((column) => column.id),
21
+ initialState: {
22
+ search: 'record 00',
23
+ sorting: [{ columnId: 'value0', direction: 'desc' }],
24
+ },
25
+ });
26
+ const table = render(BenchmarkDataTable, {
27
+ props: {
28
+ data: transformRows,
29
+ columns: localColumns,
30
+ rowKey: 'id',
31
+ controller,
32
+ },
33
+ });
34
+ table.unmount();
35
+ });
36
+ bench('manual paging: 100 supplied rows from a 100,000-row remote result', () => {
37
+ const controller = createDataTableController({
38
+ columnIds: localColumns.map((column) => column.id),
39
+ modes: { filtering: 'manual', sorting: 'manual', pagination: 'manual' },
40
+ initialState: { page: 500, pageSize: 100 },
41
+ });
42
+ const table = render(BenchmarkDataTable, {
43
+ props: {
44
+ data: manualPageRows,
45
+ columns: localColumns,
46
+ rowKey: 'id',
47
+ controller,
48
+ totalRows: 100_000,
49
+ },
50
+ });
51
+ table.unmount();
52
+ });
53
+ });
@@ -0,0 +1,27 @@
1
+ import type { DataTableColumn, DataTableStructuralRow } from '../types.js';
2
+ /**
3
+ * Shared, domain-neutral data used to exercise the documented DataTable
4
+ * contracts in component tests and the interactive workbench preview.
5
+ */
6
+ export interface DataTableConformanceRow {
7
+ id: string;
8
+ account: string;
9
+ team: string;
10
+ actual: number;
11
+ forecast: number;
12
+ variance: number;
13
+ status: 'On track' | 'Watch';
14
+ action: string;
15
+ }
16
+ export declare const dataTableConformanceRows: DataTableConformanceRow[];
17
+ export declare const dataTableConformanceColumns: DataTableColumn<DataTableConformanceRow>[];
18
+ export declare const dataTableConformanceStructuralRows: DataTableStructuralRow<DataTableConformanceRow>[];
19
+ /** The release-level scenarios that must remain represented in tests and the playground. */
20
+ export interface DataTableConformanceScenario {
21
+ id: 'semantic-interaction' | 'manual-query' | 'async-lifecycle' | 'responsive-overflow' | 'report-layout' | 'scale-virtualization';
22
+ title: string;
23
+ contracts: readonly string[];
24
+ }
25
+ export declare const dataTableConformanceScenarios: readonly DataTableConformanceScenario[];
26
+ export declare function createDataTableConformanceRows(rowCount: number): DataTableConformanceRow[];
27
+ //# sourceMappingURL=DataTableConformanceFixture.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataTableConformanceFixture.d.ts","sourceRoot":"","sources":["../../../../src/components/data/__fixtures__/DataTableConformanceFixture.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAE3E;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,wBAAwB,EAAE,uBAAuB,EAqB7D,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE,eAAe,CAAC,uBAAuB,CAAC,EAgD/E,CAAC;AAEJ,eAAO,MAAM,kCAAkC,EAAE,sBAAsB,CAAC,uBAAuB,CAAC,EAc7F,CAAC;AAEJ,4FAA4F;AAC5F,MAAM,WAAW,4BAA4B;IAC3C,EAAE,EACE,sBAAsB,GACtB,cAAc,GACd,iBAAiB,GACjB,qBAAqB,GACrB,eAAe,GACf,sBAAsB,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;CAC9B;AAED,eAAO,MAAM,6BAA6B,EAAE,SAAS,4BAA4B,EA8C9E,CAAC;AAEJ,wBAAgB,8BAA8B,CAC5C,QAAQ,EAAE,MAAM,GACf,uBAAuB,EAAE,CAW3B"}
@@ -0,0 +1,141 @@
1
+ export const dataTableConformanceRows = [
2
+ {
3
+ id: 'revenue',
4
+ account: 'Subscription revenue',
5
+ team: 'Growth',
6
+ actual: 182_400,
7
+ forecast: 176_000,
8
+ variance: 6_400,
9
+ status: 'On track',
10
+ action: 'Review',
11
+ },
12
+ {
13
+ id: 'services',
14
+ account: 'Professional services',
15
+ team: 'Delivery',
16
+ actual: 48_300,
17
+ forecast: 52_000,
18
+ variance: -3_700,
19
+ status: 'Watch',
20
+ action: 'Review',
21
+ },
22
+ ];
23
+ export const dataTableConformanceColumns = [
24
+ {
25
+ id: 'account',
26
+ label: 'Account',
27
+ headerPath: [{ id: 'dimensions', label: 'Dimensions' }],
28
+ minWidth: '13rem',
29
+ resizable: true,
30
+ sortable: true,
31
+ },
32
+ {
33
+ id: 'team',
34
+ label: 'Team',
35
+ headerPath: [{ id: 'dimensions', label: 'Dimensions' }],
36
+ minWidth: '9rem',
37
+ },
38
+ {
39
+ id: 'actual',
40
+ label: 'Actual',
41
+ headerPath: [{ id: 'performance', label: 'Performance' }],
42
+ align: 'right',
43
+ resizable: true,
44
+ },
45
+ {
46
+ id: 'forecast',
47
+ label: 'Forecast',
48
+ headerPath: [{ id: 'performance', label: 'Performance' }],
49
+ align: 'right',
50
+ resizable: true,
51
+ },
52
+ {
53
+ id: 'variance',
54
+ label: 'Variance',
55
+ headerPath: [{ id: 'performance', label: 'Performance' }],
56
+ align: 'right',
57
+ },
58
+ {
59
+ id: 'status',
60
+ label: 'Status',
61
+ role: 'status',
62
+ responsive: { keepVisible: true, priority: 10 },
63
+ },
64
+ {
65
+ id: 'action',
66
+ label: 'Action',
67
+ role: 'action',
68
+ responsive: { keepVisible: true, priority: 10 },
69
+ },
70
+ ];
71
+ export const dataTableConformanceStructuralRows = [
72
+ {
73
+ id: 'forecast-subtotal',
74
+ kind: 'subtotal',
75
+ label: 'Current forecast',
76
+ values: { actual: 230_700, forecast: 228_000, variance: 2_700 },
77
+ },
78
+ {
79
+ id: 'forecast-total',
80
+ kind: 'footer',
81
+ label: 'All accounts',
82
+ values: { actual: 230_700, forecast: 228_000, variance: 2_700 },
83
+ },
84
+ ];
85
+ export const dataTableConformanceScenarios = [
86
+ {
87
+ id: 'semantic-interaction',
88
+ title: 'Semantic interaction',
89
+ contracts: ['caption', 'rowKey', 'selection', 'keyboard row actions'],
90
+ },
91
+ {
92
+ id: 'manual-query',
93
+ title: 'Manual query ownership',
94
+ contracts: [
95
+ 'modes',
96
+ 'totalRows',
97
+ 'query revision',
98
+ 'allMatching selection',
99
+ ],
100
+ },
101
+ {
102
+ id: 'async-lifecycle',
103
+ title: 'Async lifecycle',
104
+ contracts: ['loading', 'refreshing', 'stale', 'partial results', 'retry'],
105
+ },
106
+ {
107
+ id: 'responsive-overflow',
108
+ title: 'Responsive overflow',
109
+ contracts: [
110
+ 'responsive metadata',
111
+ 'named overflow region',
112
+ 'keyboard scroll',
113
+ ],
114
+ },
115
+ {
116
+ id: 'report-layout',
117
+ title: 'Report layout',
118
+ contracts: ['grouped headers', 'structural rows', 'widths', 'pinning'],
119
+ },
120
+ {
121
+ id: 'scale-virtualization',
122
+ title: 'Scale and virtualization',
123
+ contracts: [
124
+ 'rowKey',
125
+ 'virtual body',
126
+ 'stable focus',
127
+ 'footer reachability',
128
+ ],
129
+ },
130
+ ];
131
+ export function createDataTableConformanceRows(rowCount) {
132
+ return Array.from({ length: rowCount }, (_, index) => {
133
+ const source = dataTableConformanceRows[index % dataTableConformanceRows.length];
134
+ const rowNumber = index + 1;
135
+ return {
136
+ ...source,
137
+ id: `conformance-${rowNumber}`,
138
+ account: `${source.account} ${rowNumber}`,
139
+ };
140
+ });
141
+ }
@@ -0,0 +1,10 @@
1
+ import type { DataTableColumn } from '../types.js';
2
+ export interface DataTablePerformanceRow {
3
+ id: string;
4
+ name: string;
5
+ group: string;
6
+ values: Record<string, number>;
7
+ }
8
+ export declare function createDataTablePerformanceRows(rowCount: number, valueColumnCount: number): DataTablePerformanceRow[];
9
+ export declare function createDataTablePerformanceColumns(valueColumnCount: number): DataTableColumn<DataTablePerformanceRow>[];
10
+ //# sourceMappingURL=DataTablePerformanceFixture.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataTablePerformanceFixture.d.ts","sourceRoot":"","sources":["../../../../src/components/data/__fixtures__/DataTablePerformanceFixture.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,MAAM,WAAW,uBAAuB;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChC;AAED,wBAAgB,8BAA8B,CAC5C,QAAQ,EAAE,MAAM,EAChB,gBAAgB,EAAE,MAAM,GACvB,uBAAuB,EAAE,CAY3B;AAED,wBAAgB,iCAAiC,CAC/C,gBAAgB,EAAE,MAAM,GACvB,eAAe,CAAC,uBAAuB,CAAC,EAAE,CAW5C"}
@@ -0,0 +1,23 @@
1
+ export function createDataTablePerformanceRows(rowCount, valueColumnCount) {
2
+ return Array.from({ length: rowCount }, (_, index) => ({
3
+ id: `row-${index}`,
4
+ name: `Record ${index.toString().padStart(5, '0')}`,
5
+ group: `group-${index % 10}`,
6
+ values: Object.fromEntries(Array.from({ length: valueColumnCount }, (_, valueIndex) => [
7
+ `value${valueIndex}`,
8
+ (index * (valueIndex + 3)) % 997,
9
+ ])),
10
+ }));
11
+ }
12
+ export function createDataTablePerformanceColumns(valueColumnCount) {
13
+ return [
14
+ { id: 'name', label: 'Name', accessor: 'name', sortable: true },
15
+ { id: 'group', label: 'Group', accessor: 'group', sortable: true },
16
+ ...Array.from({ length: valueColumnCount }, (_, index) => ({
17
+ id: `value${index}`,
18
+ label: `Value ${index + 1}`,
19
+ accessor: `values.value${index}`,
20
+ sortable: true,
21
+ })),
22
+ ];
23
+ }