@altertable/data-app-examples 0.76.0 → 0.77.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/package.json +1 -1
- package/templates/starter-data-app/index.tsx +60 -57
- package/templates/starter-finding-data-app/index.tsx +224 -166
- package/templates/starter-local-data-app/AGENTS.md +9 -9
- package/templates/starter-local-data-app/README.md +1 -1
- package/templates/starter-local-data-app/package.json +3 -3
- package/templates/starter-local-finding-data-app/AGENTS.md +9 -9
- package/templates/starter-local-finding-data-app/README.md +2 -2
- package/templates/starter-local-finding-data-app/app.ts +44 -33
- package/templates/starter-local-finding-data-app/package.json +3 -3
- package/templates/starter-local-finding-data-app/src/App.tsx +98 -113
- package/templates/starter-local-finding-data-app/src/data-context.ts +8 -2
- package/templates/starter-local-finding-data-app/src/filters.ts +48 -0
- package/templates/starter-local-finding-data-app/src/operations.ts +52 -34
- package/templates/starter-local-metric-data-app/AGENTS.md +9 -9
- package/templates/starter-local-metric-data-app/README.md +2 -2
- package/templates/starter-local-metric-data-app/package.json +3 -3
- package/templates/starter-local-metric-data-app/src/App.tsx +66 -67
- package/templates/starter-local-metric-data-app/src/filters.ts +20 -0
- package/templates/starter-local-metric-data-app/src/operations.ts +32 -39
- package/templates/starter-metric-data-app/index.tsx +110 -107
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
mountDataApp,
|
|
6
6
|
} from '@altertable/data-app-react';
|
|
7
7
|
import {
|
|
8
|
-
choiceVariable,
|
|
9
8
|
createDataHooks,
|
|
10
9
|
DataApp,
|
|
11
10
|
DataSection,
|
|
@@ -17,10 +16,11 @@ import {
|
|
|
17
16
|
import { BarChart, ComposedChart } from '@altertable/data-app-react/ui';
|
|
18
17
|
import { createDataClient } from '@altertable/data-app/client';
|
|
19
18
|
import {
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
dateTimeRangeFilter,
|
|
20
|
+
displayChoice,
|
|
22
21
|
parseCount,
|
|
23
22
|
} from '@altertable/data-app/contract';
|
|
23
|
+
// One query per widget: each section loads its own result when it nears the viewport.
|
|
24
24
|
const dataApp = defineDataApp({
|
|
25
25
|
title: 'Sample finding',
|
|
26
26
|
description:
|
|
@@ -28,84 +28,153 @@ const dataApp = defineDataApp({
|
|
|
28
28
|
scope: { organization: 'demo', environment: 'sample' },
|
|
29
29
|
appearance: { theme: 'system' },
|
|
30
30
|
queries: {
|
|
31
|
-
|
|
31
|
+
sampleTotal: {
|
|
32
|
+
projections: { sample_count: { type: 'number' } },
|
|
33
|
+
statement: `
|
|
34
|
+
SELECT COALESCE(SUM(sample_count), 0) AS sample_count
|
|
35
|
+
FROM starter_demo.daily_samples
|
|
36
|
+
WHERE sample_date >= $period.from AND sample_date < $period.to`,
|
|
37
|
+
params: { period: { type: 'dateTimeRange' } },
|
|
38
|
+
},
|
|
39
|
+
samplesOverTime: {
|
|
40
|
+
projections: {
|
|
41
|
+
period_start: { type: 'string' },
|
|
42
|
+
sample_count: { type: 'number' },
|
|
43
|
+
},
|
|
44
|
+
statement: `
|
|
45
|
+
SELECT strftime(date_trunc($grain, sample_date), '%Y-%m-%d') AS period_start,
|
|
46
|
+
SUM(sample_count) AS sample_count
|
|
47
|
+
FROM starter_demo.daily_samples
|
|
48
|
+
WHERE sample_date >= $period.from AND sample_date < $period.to
|
|
49
|
+
GROUP BY ALL ORDER BY period_start LIMIT 200`,
|
|
50
|
+
params: {
|
|
51
|
+
period: { type: 'dateTimeRange' },
|
|
52
|
+
grain: { type: 'string', defaultValue: 'day' },
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
samplesByMember: {
|
|
56
|
+
projections: {
|
|
57
|
+
member: { type: 'string' },
|
|
58
|
+
sample_count: { type: 'number' },
|
|
59
|
+
},
|
|
60
|
+
statement: `
|
|
61
|
+
SELECT CASE WHEN $breakdown = 'group' THEN group_name ELSE segment_name END AS member,
|
|
62
|
+
SUM(sample_count) AS sample_count
|
|
63
|
+
FROM starter_demo.daily_samples
|
|
64
|
+
WHERE sample_date >= $period.from AND sample_date < $period.to
|
|
65
|
+
GROUP BY ALL ORDER BY sample_count DESC LIMIT 50`,
|
|
66
|
+
params: {
|
|
67
|
+
period: { type: 'dateTimeRange' },
|
|
68
|
+
breakdown: { type: 'string', defaultValue: 'segment' },
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
sampleRows: {
|
|
32
72
|
projections: {
|
|
33
73
|
period_start: { type: 'string' },
|
|
34
74
|
member: { type: 'string' },
|
|
35
|
-
selected: { type: 'boolean' },
|
|
36
75
|
sample_count: { type: 'number' },
|
|
37
76
|
},
|
|
38
77
|
statement: `
|
|
39
78
|
SELECT strftime(date_trunc($grain, sample_date), '%Y-%m-%d') AS period_start,
|
|
40
79
|
CASE WHEN $breakdown = 'group' THEN group_name ELSE segment_name END AS member,
|
|
41
|
-
sample_date >= CAST($selected_start AS TIMESTAMP) AS selected,
|
|
42
80
|
SUM(sample_count) AS sample_count
|
|
43
81
|
FROM starter_demo.daily_samples
|
|
44
|
-
WHERE sample_date >=
|
|
45
|
-
GROUP BY ALL ORDER BY period_start, member LIMIT
|
|
82
|
+
WHERE sample_date >= $period.from AND sample_date < $period.to
|
|
83
|
+
GROUP BY ALL ORDER BY period_start, member LIMIT 500`,
|
|
46
84
|
params: {
|
|
47
|
-
|
|
48
|
-
end: { type: 'string', defaultValue: '2026-03-16T00:00:00Z' },
|
|
49
|
-
selected_start: {
|
|
50
|
-
type: 'string',
|
|
51
|
-
defaultValue: '2026-03-09T00:00:00Z',
|
|
52
|
-
},
|
|
85
|
+
period: { type: 'dateTimeRange' },
|
|
53
86
|
grain: { type: 'string', defaultValue: 'day' },
|
|
54
87
|
breakdown: { type: 'string', defaultValue: 'segment' },
|
|
55
|
-
limit: { type: 'number', defaultValue: 500 },
|
|
56
88
|
},
|
|
57
89
|
},
|
|
58
90
|
},
|
|
59
91
|
});
|
|
60
|
-
|
|
61
|
-
minDate: '2026-01-05',
|
|
62
|
-
maxDate: '2026-03-29',
|
|
63
|
-
maxRangeDays: 28,
|
|
64
|
-
timeZone: 'UTC',
|
|
65
|
-
});
|
|
92
|
+
// Declare each filter once; each operation lists the filters it reads.
|
|
66
93
|
const findingPeriod = {
|
|
67
94
|
from: new Date('2026-03-09T00:00:00Z'),
|
|
68
95
|
to: new Date('2026-03-16T00:00:00Z'),
|
|
69
96
|
};
|
|
70
|
-
const period =
|
|
97
|
+
const period = dateTimeRangeFilter({
|
|
71
98
|
key: 'period',
|
|
72
|
-
contract: calendar,
|
|
73
|
-
allowComparison: true,
|
|
74
99
|
defaultValue: findingPeriod,
|
|
100
|
+
minDate: '2026-01-05',
|
|
101
|
+
maxDate: '2026-03-29',
|
|
102
|
+
maxRangeDays: 28,
|
|
103
|
+
comparison: 'off',
|
|
75
104
|
presets: [{ label: 'Finding period', range: findingPeriod }],
|
|
76
105
|
});
|
|
106
|
+
const grain = displayChoice({
|
|
107
|
+
key: 'grain',
|
|
108
|
+
label: 'Grain',
|
|
109
|
+
defaultValue: 'day',
|
|
110
|
+
options: [
|
|
111
|
+
{ id: 'day', label: 'Day' },
|
|
112
|
+
{ id: 'week', label: 'Week' },
|
|
113
|
+
],
|
|
114
|
+
presentation: { control: 'widget' },
|
|
115
|
+
});
|
|
116
|
+
const breakdown = displayChoice({
|
|
117
|
+
key: 'breakdown',
|
|
118
|
+
label: 'Breakdown',
|
|
119
|
+
defaultValue: 'segment',
|
|
120
|
+
options: [
|
|
121
|
+
{ id: 'segment', label: 'Segment' },
|
|
122
|
+
{ id: 'group', label: 'Group' },
|
|
123
|
+
],
|
|
124
|
+
presentation: { control: 'widget' },
|
|
125
|
+
});
|
|
126
|
+
const policy = { maxQueryRows: 500, maxDurationMs: 15000 };
|
|
77
127
|
const operations = {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
128
|
+
sampleTotal: dataApp.defineOperation({
|
|
129
|
+
filters: { period },
|
|
130
|
+
policy,
|
|
131
|
+
async run({ query }, { period }) {
|
|
132
|
+
const current = await query('sampleTotal', { period: period.range });
|
|
133
|
+
const previous = period.comparison
|
|
134
|
+
? await query('sampleTotal', { period: period.comparison })
|
|
135
|
+
: null;
|
|
136
|
+
return {
|
|
137
|
+
current: parseCount(current.rows[0]!.sample_count),
|
|
138
|
+
previous: previous && parseCount(previous.rows[0]!.sample_count),
|
|
139
|
+
};
|
|
140
|
+
},
|
|
141
|
+
}),
|
|
142
|
+
samplesOverTime: dataApp.defineOperation({
|
|
143
|
+
filters: { period, grain },
|
|
144
|
+
policy,
|
|
145
|
+
async run({ query }, { period, grain }) {
|
|
146
|
+
// With the comparison on, the trend starts at the previous period.
|
|
147
|
+
const range = {
|
|
148
|
+
from: period.comparison?.from ?? period.range.from,
|
|
149
|
+
to: period.range.to,
|
|
150
|
+
};
|
|
151
|
+
const result = await query('samplesOverTime', { period: range, grain });
|
|
152
|
+
return result.rows.map(row => ({
|
|
153
|
+
periodStart: row.period_start,
|
|
154
|
+
sampleCount: parseCount(row.sample_count),
|
|
155
|
+
}));
|
|
156
|
+
},
|
|
157
|
+
}),
|
|
158
|
+
samplesByMember: dataApp.defineOperation({
|
|
159
|
+
filters: { period, breakdown },
|
|
160
|
+
policy,
|
|
161
|
+
async run({ query }, { period, breakdown }) {
|
|
162
|
+
const result = await query('samplesByMember', {
|
|
163
|
+
period: period.range,
|
|
83
164
|
breakdown,
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
return { period: period.parseInput(selection), grain, breakdown };
|
|
165
|
+
});
|
|
166
|
+
return result.rows.map(row => ({
|
|
167
|
+
member: row.member,
|
|
168
|
+
sampleCount: parseCount(row.sample_count),
|
|
169
|
+
}));
|
|
90
170
|
},
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
period: period.input(period.defaultValue),
|
|
99
|
-
grain: 'week',
|
|
100
|
-
breakdown: 'group',
|
|
101
|
-
},
|
|
102
|
-
],
|
|
103
|
-
policy: { maxQueryRows: 500, maxDurationMs: 15000 },
|
|
104
|
-
async run({ query }, { period: { range, comparison }, grain, breakdown }) {
|
|
105
|
-
const result = await query('samples', {
|
|
106
|
-
start: (comparison?.from ?? range.from).toISOString(),
|
|
107
|
-
end: range.to.toISOString(),
|
|
108
|
-
selected_start: range.from.toISOString(),
|
|
171
|
+
}),
|
|
172
|
+
sampleRows: dataApp.defineOperation({
|
|
173
|
+
filters: { period, grain, breakdown },
|
|
174
|
+
policy,
|
|
175
|
+
async run({ query }, { period, grain, breakdown }) {
|
|
176
|
+
const result = await query('sampleRows', {
|
|
177
|
+
period: period.range,
|
|
109
178
|
grain,
|
|
110
179
|
breakdown,
|
|
111
180
|
});
|
|
@@ -113,12 +182,16 @@ const operations = {
|
|
|
113
182
|
periodStart: row.period_start,
|
|
114
183
|
member: row.member,
|
|
115
184
|
sampleCount: parseCount(row.sample_count),
|
|
116
|
-
selected: row.selected,
|
|
117
185
|
}));
|
|
118
186
|
},
|
|
119
187
|
}),
|
|
120
188
|
};
|
|
121
|
-
const queryNames =
|
|
189
|
+
const queryNames = {
|
|
190
|
+
...operations.sampleTotal.queryNames,
|
|
191
|
+
...operations.samplesOverTime.queryNames,
|
|
192
|
+
...operations.samplesByMember.queryNames,
|
|
193
|
+
...operations.sampleRows.queryNames,
|
|
194
|
+
};
|
|
122
195
|
const sampleDataContext = createDataContext(queryNames)({
|
|
123
196
|
description:
|
|
124
197
|
'Fictional daily samples from starter_demo.daily_samples. Replace this evidence with the actual Finding queries.',
|
|
@@ -126,98 +199,73 @@ const sampleDataContext = createDataContext(queryNames)({
|
|
|
126
199
|
sampleCount: {
|
|
127
200
|
term: 'Sample count',
|
|
128
201
|
definition: 'Fixture samples recorded per day, group, and segment.',
|
|
129
|
-
queryNames:
|
|
202
|
+
queryNames: Object.values(queryNames),
|
|
130
203
|
},
|
|
131
204
|
},
|
|
132
205
|
});
|
|
133
|
-
const {
|
|
134
|
-
const
|
|
206
|
+
const { defineView } = createDataHooks(createDataClient({ operations }));
|
|
207
|
+
const count = { kind: 'count' } as const;
|
|
208
|
+
const emptyFallback = {
|
|
209
|
+
title: 'No samples in this period',
|
|
210
|
+
description: 'No observations are available for this period.',
|
|
211
|
+
};
|
|
212
|
+
const totalView = defineView({
|
|
135
213
|
dataContext: sampleDataContext,
|
|
136
|
-
operation: '
|
|
137
|
-
time: period,
|
|
138
|
-
variables: {
|
|
139
|
-
grain: choiceVariable({
|
|
140
|
-
key: 'grain',
|
|
141
|
-
label: 'Grain',
|
|
142
|
-
defaultValue: 'day',
|
|
143
|
-
options: [
|
|
144
|
-
{ id: 'day', label: 'Day' },
|
|
145
|
-
{ id: 'week', label: 'Week' },
|
|
146
|
-
],
|
|
147
|
-
presentation: { group: 'display', control: 'widget' },
|
|
148
|
-
}),
|
|
149
|
-
breakdown: choiceVariable({
|
|
150
|
-
key: 'breakdown',
|
|
151
|
-
label: 'Breakdown',
|
|
152
|
-
defaultValue: 'segment',
|
|
153
|
-
options: [
|
|
154
|
-
{ id: 'segment', label: 'Segment' },
|
|
155
|
-
{ id: 'group', label: 'Group' },
|
|
156
|
-
],
|
|
157
|
-
presentation: { group: 'display', control: 'widget' },
|
|
158
|
-
}),
|
|
159
|
-
},
|
|
160
|
-
isEmpty: rows => rows.length === 0,
|
|
161
|
-
emptyFallback: {
|
|
162
|
-
title: 'No samples in this period',
|
|
163
|
-
description: 'No observations are available for this period.',
|
|
164
|
-
},
|
|
214
|
+
operation: 'sampleTotal',
|
|
165
215
|
});
|
|
166
|
-
|
|
167
|
-
function total(rows: readonly SampleRow[]) {
|
|
168
|
-
return rows.reduce((sum, row) => sum + row.sampleCount, 0);
|
|
169
|
-
}
|
|
170
|
-
function totalsBy<Row extends SampleRow>(
|
|
171
|
-
rows: readonly Row[],
|
|
172
|
-
key: (row: Row) => string
|
|
173
|
-
) {
|
|
174
|
-
const totals = new Map<string, number>();
|
|
175
|
-
for (const row of rows)
|
|
176
|
-
totals.set(key(row), (totals.get(key(row)) ?? 0) + row.sampleCount);
|
|
177
|
-
return [...totals].map(([id, sampleCount]) => ({ id, sampleCount }));
|
|
178
|
-
}
|
|
179
|
-
const count = { kind: 'count' } as const;
|
|
180
|
-
const totalSamples = samplesView.metric(
|
|
216
|
+
const totalSamples = totalView.metric(
|
|
181
217
|
{
|
|
182
218
|
id: 'total-samples',
|
|
183
219
|
label: 'Samples',
|
|
184
220
|
glossaryId: 'sampleCount',
|
|
185
221
|
format: count,
|
|
186
222
|
},
|
|
187
|
-
|
|
188
|
-
current: total
|
|
189
|
-
...(
|
|
190
|
-
previous: total(rows.filter(row => !row.selected)),
|
|
191
|
-
}),
|
|
223
|
+
total => ({
|
|
224
|
+
current: total.current,
|
|
225
|
+
...(total.previous !== null && { previous: total.previous }),
|
|
192
226
|
})
|
|
193
227
|
);
|
|
194
|
-
const
|
|
228
|
+
const trendView = defineView({
|
|
229
|
+
dataContext: sampleDataContext,
|
|
230
|
+
operation: 'samplesOverTime',
|
|
231
|
+
isEmpty: rows => rows.length === 0,
|
|
232
|
+
emptyFallback,
|
|
233
|
+
});
|
|
234
|
+
const trend = trendView.dataset({
|
|
195
235
|
name: 'Samples over time',
|
|
196
|
-
select: rows =>
|
|
197
|
-
rowKey: row => row.
|
|
236
|
+
select: rows => rows,
|
|
237
|
+
rowKey: row => row.periodStart,
|
|
198
238
|
columns: {
|
|
199
|
-
|
|
239
|
+
periodStart: { label: 'Period start', value: row => row.periodStart },
|
|
200
240
|
sampleCount: { value: row => row.sampleCount, format: count },
|
|
201
241
|
},
|
|
202
242
|
evidence: { id: 'samples-over-time', glossaryIds: ['sampleCount'] },
|
|
203
243
|
});
|
|
204
|
-
const
|
|
244
|
+
const memberView = defineView({
|
|
245
|
+
dataContext: sampleDataContext,
|
|
246
|
+
operation: 'samplesByMember',
|
|
247
|
+
isEmpty: rows => rows.length === 0,
|
|
248
|
+
emptyFallback,
|
|
249
|
+
});
|
|
250
|
+
const byMember = memberView.dataset({
|
|
205
251
|
name: 'Samples by member',
|
|
206
|
-
select: rows =>
|
|
207
|
-
|
|
208
|
-
rows.filter(row => row.selected),
|
|
209
|
-
row => row.member
|
|
210
|
-
),
|
|
211
|
-
rowKey: row => row.id,
|
|
252
|
+
select: rows => rows,
|
|
253
|
+
rowKey: row => row.member,
|
|
212
254
|
columns: {
|
|
213
|
-
|
|
255
|
+
member: { label: 'Member', value: row => row.member },
|
|
214
256
|
sampleCount: { value: row => row.sampleCount, format: count },
|
|
215
257
|
},
|
|
216
258
|
evidence: { id: 'samples-by-member', glossaryIds: ['sampleCount'] },
|
|
217
259
|
});
|
|
218
|
-
const
|
|
260
|
+
const rowsView = defineView({
|
|
261
|
+
dataContext: sampleDataContext,
|
|
262
|
+
operation: 'sampleRows',
|
|
263
|
+
isEmpty: rows => rows.length === 0,
|
|
264
|
+
emptyFallback,
|
|
265
|
+
});
|
|
266
|
+
const sampleRows = rowsView.dataset({
|
|
219
267
|
name: 'Samples',
|
|
220
|
-
select: rows => rows
|
|
268
|
+
select: rows => rows,
|
|
221
269
|
rowKey: row => `${row.periodStart}:${row.member}`,
|
|
222
270
|
columns: {
|
|
223
271
|
periodStart: { label: 'Period start', value: row => row.periodStart },
|
|
@@ -227,54 +275,64 @@ const sampleRows = samplesView.dataset({
|
|
|
227
275
|
evidence: { id: 'samples', glossaryIds: ['sampleCount'] },
|
|
228
276
|
});
|
|
229
277
|
// The Finding's text is shown above the app; keep content to charts and captions.
|
|
230
|
-
const
|
|
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
|
-
|
|
278
|
+
const totalContent = totalView.content(result => (
|
|
279
|
+
<MetricWidget metric={totalSamples} source={result} />
|
|
280
|
+
));
|
|
281
|
+
const trendContent = trendView.content(result => (
|
|
282
|
+
<VisualizationWidget
|
|
283
|
+
dataset={trend}
|
|
284
|
+
source={result}
|
|
285
|
+
title="Samples over time"
|
|
286
|
+
description="Includes the previous period when comparison is on."
|
|
287
|
+
breakdown={trendView.breakdown('grain')}
|
|
288
|
+
>
|
|
289
|
+
{rows => (
|
|
290
|
+
<ComposedChart
|
|
291
|
+
ariaLabel="Samples over time"
|
|
292
|
+
data={rows}
|
|
293
|
+
valueFormat={count}
|
|
294
|
+
>
|
|
295
|
+
<ComposedChart.XAxis dataKey="periodStart" />
|
|
296
|
+
<ComposedChart.YAxis />
|
|
297
|
+
<ComposedChart.Line dataKey="sampleCount" name="Samples" />
|
|
298
|
+
<ComposedChart.Tooltip />
|
|
299
|
+
</ComposedChart>
|
|
300
|
+
)}
|
|
301
|
+
</VisualizationWidget>
|
|
302
|
+
));
|
|
303
|
+
const memberContent = memberView.content(result => (
|
|
304
|
+
<VisualizationWidget
|
|
305
|
+
dataset={byMember}
|
|
306
|
+
source={result}
|
|
307
|
+
title="Samples by member"
|
|
308
|
+
breakdown={memberView.breakdown('breakdown')}
|
|
309
|
+
>
|
|
310
|
+
{rows => (
|
|
311
|
+
<BarChart
|
|
312
|
+
ariaLabel="Samples by member"
|
|
313
|
+
unit="samples"
|
|
314
|
+
items={rows.map(row => ({
|
|
315
|
+
...row,
|
|
316
|
+
id: row.member,
|
|
317
|
+
label: row.member,
|
|
318
|
+
value: row.sampleCount,
|
|
319
|
+
}))}
|
|
320
|
+
/>
|
|
321
|
+
)}
|
|
322
|
+
</VisualizationWidget>
|
|
323
|
+
));
|
|
324
|
+
const rowsContent = rowsView.content(result => (
|
|
325
|
+
<TableWidget dataset={sampleRows} source={result} title="Samples" />
|
|
273
326
|
));
|
|
274
327
|
function App() {
|
|
275
328
|
return (
|
|
276
|
-
<DataApp view={
|
|
277
|
-
<
|
|
329
|
+
<DataApp view={totalView} showToolbar={false}>
|
|
330
|
+
<Stack>
|
|
331
|
+
<DataSection content={totalContent} />
|
|
332
|
+
<DataSection content={trendContent} />
|
|
333
|
+
<DataSection content={memberContent} />
|
|
334
|
+
<DataSection content={rowsContent} />
|
|
335
|
+
</Stack>
|
|
278
336
|
</DataApp>
|
|
279
337
|
);
|
|
280
338
|
}
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
Read `node_modules/@altertable/data-app/docs/app-authoring.md` and use this project
|
|
4
4
|
as the selected scaffold. If dependencies are unavailable, read the
|
|
5
|
-
[version-matched recipe](https://github.com/altertable-ai/data-app/blob/v0.
|
|
5
|
+
[version-matched recipe](https://github.com/altertable-ai/data-app/blob/v0.77.0/docs/app-authoring.md). <!-- x-release-please-version -->
|
|
6
6
|
|
|
7
|
-
| Task | App-owned files
|
|
8
|
-
| ------------------------------------------ |
|
|
9
|
-
| Define queries and
|
|
10
|
-
| Compose app content and supported features | `src/App.tsx`
|
|
11
|
-
| Bind definitions and source evidence | `src/data-context.ts`
|
|
12
|
-
| Change identity and appearance | `app.ts`
|
|
13
|
-
| Inject styles and mount React | `src/main.tsx`
|
|
14
|
-
| Configure local serving | `src/server.ts`
|
|
7
|
+
| Task | App-owned files |
|
|
8
|
+
| ------------------------------------------ | ------------------------------------------------------ |
|
|
9
|
+
| Define queries, filters, and operations | `app.ts`, `src/operations.ts`, shared `src/filters.ts` |
|
|
10
|
+
| Compose app content and supported features | `src/App.tsx` |
|
|
11
|
+
| Bind definitions and source evidence | `src/data-context.ts` |
|
|
12
|
+
| Change identity and appearance | `app.ts` |
|
|
13
|
+
| Inject styles and mount React | `src/main.tsx` |
|
|
14
|
+
| Configure local serving | `src/server.ts` |
|
|
15
15
|
|
|
16
16
|
See [README.md](README.md) for setup and checks.
|
|
17
17
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Local data app starter
|
|
2
2
|
|
|
3
3
|
Use `node_modules/@altertable/data-app/docs/app-authoring.md` for this SDK version.
|
|
4
|
-
Otherwise, read the [version-matched authoring recipe](https://github.com/altertable-ai/data-app/blob/v0.
|
|
4
|
+
Otherwise, read the [version-matched authoring recipe](https://github.com/altertable-ai/data-app/blob/v0.77.0/docs/app-authoring.md). <!-- x-release-please-version -->
|
|
5
5
|
See [AGENTS.md](AGENTS.md) for app-owned files.
|
|
6
6
|
|
|
7
7
|
## Run the app
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
"lint:fix": "oxlint --type-aware --fix src"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@altertable/data-app": "0.
|
|
21
|
-
"@altertable/data-app-bun": "0.
|
|
22
|
-
"@altertable/data-app-react": "0.
|
|
20
|
+
"@altertable/data-app": "0.77.0",
|
|
21
|
+
"@altertable/data-app-bun": "0.77.0",
|
|
22
|
+
"@altertable/data-app-react": "0.77.0",
|
|
23
23
|
"react": "19.3.1",
|
|
24
24
|
"react-dom": "19.3.1"
|
|
25
25
|
},
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
Read `node_modules/@altertable/data-app/docs/app-authoring.md` and use this project
|
|
4
4
|
as the selected scaffold. If dependencies are unavailable, read the
|
|
5
|
-
[version-matched recipe](https://github.com/altertable-ai/data-app/blob/v0.
|
|
5
|
+
[version-matched recipe](https://github.com/altertable-ai/data-app/blob/v0.77.0/docs/app-authoring.md). <!-- x-release-please-version -->
|
|
6
6
|
|
|
7
|
-
| Task | App-owned files
|
|
8
|
-
| ------------------------------------------ |
|
|
9
|
-
| Define queries and
|
|
10
|
-
| Compose app content and supported features | `src/App.tsx`
|
|
11
|
-
| Bind definitions and source evidence | `src/data-context.ts`
|
|
12
|
-
| Change identity and appearance | `app.ts`
|
|
13
|
-
| Inject styles and mount React | `src/main.tsx`
|
|
14
|
-
| Configure local serving | `src/server.ts`
|
|
7
|
+
| Task | App-owned files |
|
|
8
|
+
| ------------------------------------------ | ------------------------------------------------------ |
|
|
9
|
+
| Define queries, filters, and operations | `app.ts`, `src/operations.ts`, shared `src/filters.ts` |
|
|
10
|
+
| Compose app content and supported features | `src/App.tsx` |
|
|
11
|
+
| Bind definitions and source evidence | `src/data-context.ts` |
|
|
12
|
+
| Change identity and appearance | `app.ts` |
|
|
13
|
+
| Inject styles and mount React | `src/main.tsx` |
|
|
14
|
+
| Configure local serving | `src/server.ts` |
|
|
15
15
|
|
|
16
16
|
See [README.md](README.md) for setup and checks.
|
|
17
17
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# Local finding data app starter
|
|
2
2
|
|
|
3
3
|
Use `node_modules/@altertable/data-app/docs/app-authoring.md` for this SDK version.
|
|
4
|
-
Otherwise, read the [version-matched authoring recipe](https://github.com/altertable-ai/data-app/blob/v0.
|
|
4
|
+
Otherwise, read the [version-matched authoring recipe](https://github.com/altertable-ai/data-app/blob/v0.77.0/docs/app-authoring.md). <!-- x-release-please-version -->
|
|
5
5
|
See [AGENTS.md](AGENTS.md) for app-owned files.
|
|
6
6
|
|
|
7
7
|
The example queries require the seeded sample data described in the
|
|
8
|
-
[local preview guide](https://github.com/altertable-ai/data-app/blob/v0.
|
|
8
|
+
[local preview guide](https://github.com/altertable-ai/data-app/blob/v0.77.0/docs/local-data-apps.md#preview-the-use-case-starters). <!-- x-release-please-version -->
|
|
9
9
|
Use that mock for development, or replace the example queries with verified data
|
|
10
10
|
in your lakehouse. The starter does not install a mock or create demo tables.
|
|
11
11
|
|