@burdenoff/microfe-bigconsole 2026.1124.7 → 2026.1124.9

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.
@@ -1,31 +1,31 @@
1
1
  import { Section as e } from "../../common/Section.js";
2
2
  import { useWidgetQueryPreview as t } from "../../../hooks/useWidgetQueryPreview.js";
3
- import { NUMERIC_ONLY as n, QUERY_AGGREGATES as r, QUERY_LIMITS as i, describeQuery as a, detectFields as o, normalizeQuery as s, omitKey as c, queryInputLimits as l, queryProblem as u, queryRendererProblem as d, repeatedXWarning as f, suggestQuery as p, supportsQuery as m, supportsQuerySeries as h } from "../../../utils/widgetQuery.js";
3
+ import { NUMERIC_ONLY as n, QUERY_AGGREGATES as r, QUERY_LIMITS as i, dateBucketUnits as a, describeQuery as o, detectFields as ee, normalizeQuery as s, omitKey as c, queryInputLimits as l, queryProblem as u, queryRendererProblem as d, repeatedXWarning as f, suggestQuery as p, supportsQuery as m, supportsQuerySeries as h } from "../../../utils/widgetQuery.js";
4
4
  import "../../common/index.js";
5
5
  import { Suspense as g, lazy as _, useMemo as v } from "react";
6
6
  import { Calendar as y, Hash as b, Plus as x, ToggleLeft as S, Trash2 as C, Type as w } from "lucide-react";
7
- import { Button as T, Input as ee, Label as E, Select as D, SelectContent as O, SelectItem as k, SelectTrigger as A, SelectValue as j, Spinner as M } from "@burdenoff/fe-libs/ui";
8
- import { useI18n as N } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
9
- import { Fragment as P, jsx as F, jsxs as I } from "react/jsx-runtime";
7
+ import { Button as T, Input as E, Label as D, Select as O, SelectContent as k, SelectItem as A, SelectTrigger as j, SelectValue as M, Spinner as N } from "@burdenoff/fe-libs/ui";
8
+ import { useI18n as P } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
9
+ import { Fragment as F, jsx as I, jsxs as L } from "react/jsx-runtime";
10
10
  // src/bigconsole/components/builder/inspector/QuerySection.tsx
11
- var L = "__none__", R = 8, z = {
11
+ var R = "__none__", z = 8, B = {
12
12
  text: w,
13
13
  number: b,
14
14
  date: y,
15
15
  boolean: S
16
- }, B = {
16
+ }, V = {
17
17
  text: "text",
18
18
  number: "number",
19
19
  date: "date",
20
20
  boolean: "true/false"
21
- }, V = {
21
+ }, H = {
22
22
  sum: "Total",
23
23
  avg: "Average",
24
24
  min: "Smallest",
25
25
  max: "Largest",
26
26
  count: "Count",
27
27
  distinct_count: "Distinct count"
28
- }, H = [
28
+ }, U = [
29
29
  {
30
30
  value: "none",
31
31
  label: "Keep the data order"
@@ -43,11 +43,11 @@ var L = "__none__", R = 8, z = {
43
43
  label: "Group A to Z"
44
44
  }
45
45
  ];
46
- function U(e) {
46
+ function W(e) {
47
47
  let t = e.orderBy;
48
48
  return t ? t.by === "dimension" ? "group-asc" : t.direction === "desc" ? "value-desc" : "value-asc" : "none";
49
49
  }
50
- function W(e, t) {
50
+ function G(e, t) {
51
51
  let n = c(e, "orderBy");
52
52
  return t === "value-desc" ? {
53
53
  ...n,
@@ -72,70 +72,103 @@ function W(e, t) {
72
72
  }
73
73
  } : n;
74
74
  }
75
- var G = _(() => import("../../widgets/chart/ChartWidget.js"));
76
- function K(e) {
75
+ var K = _(() => import("../../widgets/chart/ChartWidget.js"));
76
+ function q(e) {
77
77
  return e.map((e) => Object.fromEntries(Object.entries(e).map(([e, t]) => [e, t === null || typeof t == "string" || typeof t == "number" ? t : void 0])));
78
78
  }
79
- var q = ({ field: e }) => {
80
- let t = z[e.kind];
81
- return /* @__PURE__ */ I("span", {
79
+ var J = ({ field: e }) => {
80
+ let t = B[e.kind];
81
+ return /* @__PURE__ */ L("span", {
82
82
  className: "flex items-center gap-2",
83
83
  children: [
84
- /* @__PURE__ */ F(t, {
84
+ /* @__PURE__ */ I(t, {
85
85
  className: "h-3.5 w-3.5 shrink-0 text-text-secondary",
86
86
  "aria-hidden": !0
87
87
  }),
88
- /* @__PURE__ */ F("span", { children: e.name }),
89
- /* @__PURE__ */ I("span", {
88
+ /* @__PURE__ */ I("span", { children: e.name }),
89
+ /* @__PURE__ */ L("span", {
90
90
  className: "sr-only",
91
91
  children: [
92
92
  "(",
93
- B[e.kind],
93
+ V[e.kind],
94
94
  ")"
95
95
  ]
96
96
  })
97
97
  ]
98
98
  });
99
- }, J = ({ id: e, label: t, value: n, fields: r, optional: i = !1, placeholder: a, onChange: o }) => /* @__PURE__ */ I(D, {
100
- value: n ?? (i ? L : void 0),
101
- onValueChange: (e) => o(e === L ? void 0 : e),
102
- children: [/* @__PURE__ */ F(A, {
99
+ }, Y = ({ id: e, label: t, value: n, fields: r, optional: i = !1, placeholder: a, onChange: o }) => /* @__PURE__ */ L(O, {
100
+ value: n ?? (i ? R : void 0),
101
+ onValueChange: (e) => o(e === R ? void 0 : e),
102
+ children: [/* @__PURE__ */ I(j, {
103
103
  id: e,
104
104
  "aria-label": t,
105
105
  style: {
106
106
  height: "var(--size-controlHeight-md)",
107
107
  fontSize: "var(--font-size-body-sm)"
108
108
  },
109
- children: /* @__PURE__ */ F(j, { placeholder: a })
110
- }), /* @__PURE__ */ I(O, { children: [
111
- i && /* @__PURE__ */ F(k, {
112
- value: L,
109
+ children: /* @__PURE__ */ I(M, { placeholder: a })
110
+ }), /* @__PURE__ */ L(k, { children: [
111
+ i && /* @__PURE__ */ I(A, {
112
+ value: R,
113
113
  children: "None"
114
114
  }),
115
- n !== void 0 && !r.some((e) => e.name === n) && /* @__PURE__ */ F(k, {
115
+ n !== void 0 && !r.some((e) => e.name === n) && /* @__PURE__ */ I(A, {
116
116
  value: n,
117
117
  children: n
118
118
  }),
119
- r.map((e) => /* @__PURE__ */ F(k, {
119
+ r.map((e) => /* @__PURE__ */ I(A, {
120
120
  value: e.name,
121
- children: /* @__PURE__ */ F(q, { field: e })
121
+ children: /* @__PURE__ */ I(J, { field: e })
122
122
  }, e.name))
123
123
  ] })]
124
- }), Y = ({ children: e }) => /* @__PURE__ */ F("div", {
124
+ }), X = ({ children: e }) => /* @__PURE__ */ I("div", {
125
125
  className: "flex min-w-0 items-center gap-2",
126
126
  children: e
127
- }), X = ({ widget: g, rows: _, query: y, sourceSaved: b, onChange: S }) => {
128
- let { t: w } = N(), M = v(() => _ ? o(_) : [], [_]), P = h(g.type, g.config), L = m(g.type, g.config), R = g.type === "metric_card", z = l(g.type, g.config), B = y ? d(y, g.type, g.config) ?? u(y, M, P, L) : null, G = y !== null && B === null, K = t(g.id, G ? y : null, G && b), q = g.type === "chart", X = typeof g.config?.xAxisField == "string" ? g.config.xAxisField : y?.dimensions[0] ?? void 0, Q = !y && q && _ ? f(_, X) : null, $ = (e) => S(s(e) ?? e);
129
- if (!L) return y ? /* @__PURE__ */ F(e, {
127
+ });
128
+ function te({ field: e, unit: t, options: n, onChange: r }) {
129
+ let { t: i } = P(), a = {
130
+ day: i("bigconsole.widget.query.dateBucketDay", "Day"),
131
+ week: i("bigconsole.widget.query.dateBucketWeek", "Week (starts Monday)"),
132
+ month: i("bigconsole.widget.query.dateBucketMonth", "Month"),
133
+ quarter: i("bigconsole.widget.query.dateBucketQuarter", "Quarter"),
134
+ year: i("bigconsole.widget.query.dateBucketYear", "Year")
135
+ }, o = i("bigconsole.widget.query.dateBucketField", "Date bucket for {{field}} (UTC)", { field: e });
136
+ return /* @__PURE__ */ L(O, {
137
+ value: t ?? R,
138
+ onValueChange: (e) => r(n.find((t) => t === e)),
139
+ children: [/* @__PURE__ */ I(j, {
140
+ "aria-label": o,
141
+ className: "min-h-11 text-sm",
142
+ children: /* @__PURE__ */ I(M, {})
143
+ }), /* @__PURE__ */ L(k, { children: [
144
+ /* @__PURE__ */ I(A, {
145
+ value: R,
146
+ children: i("bigconsole.widget.query.dateBucketNone", "No bucket")
147
+ }),
148
+ t && !n.includes(t) && /* @__PURE__ */ I(A, {
149
+ value: t,
150
+ disabled: !0,
151
+ children: a[t]
152
+ }),
153
+ n.map((e) => /* @__PURE__ */ I(A, {
154
+ value: e,
155
+ children: a[e]
156
+ }, e))
157
+ ] })]
158
+ });
159
+ }
160
+ var Z = ({ widget: g, rows: _, query: y, sourceSaved: b, onChange: S }) => {
161
+ let { t: w } = P(), N = v(() => _ ? ee(_) : [], [_]), F = h(g.type, g.config), R = m(g.type, g.config), z = g.type === "metric_card", B = l(g.type, g.config), V = y ? d(y, g.type, g.config) ?? u(y, N, F, R) : null, K = y !== null && V === null, q = t(g.id, K ? y : null, K && b), J = g.type === "chart", Z = typeof g.config?.xAxisField == "string" ? g.config.xAxisField : y?.dimensions[0] ?? void 0, Q = !y && J && _ ? f(_, Z) : null, $ = (e) => S(s(e) ?? e);
162
+ if (!R) return y ? /* @__PURE__ */ I(e, {
130
163
  title: w("bigconsole.widget.query.title", "Group and total"),
131
164
  "data-testid": "widget-inspector-query",
132
- children: /* @__PURE__ */ I("div", {
165
+ children: /* @__PURE__ */ L("div", {
133
166
  className: "space-y-3",
134
- children: [/* @__PURE__ */ F("p", {
167
+ children: [/* @__PURE__ */ I("p", {
135
168
  role: "alert",
136
169
  className: "text-sm text-text-secondary",
137
- children: B
138
- }), /* @__PURE__ */ F(T, {
170
+ children: V
171
+ }), /* @__PURE__ */ I(T, {
139
172
  type: "button",
140
173
  variant: "outline",
141
174
  onClick: () => S(null),
@@ -144,110 +177,130 @@ var q = ({ field: e }) => {
144
177
  })
145
178
  }) : null;
146
179
  if (!y) {
147
- let t = _ ? p(M, _, P, z.dimensions > 0) : null;
148
- return /* @__PURE__ */ F(e, {
180
+ let t = _ ? p(N, _, F, B.dimensions > 0) : null;
181
+ return /* @__PURE__ */ I(e, {
149
182
  title: w("bigconsole.widget.query.title", "Group and total"),
150
- description: w(R ? "bigconsole.widget.query.metricIntro" : "bigconsole.widget.query.intro", R ? "Calculate one value across the rows without writing a parser." : "Add up, average or count the rows, grouped by a field, without writing a parser."),
183
+ description: w(z ? "bigconsole.widget.query.metricIntro" : "bigconsole.widget.query.intro", z ? "Calculate one value across the rows without writing a parser." : "Add up, average or count the rows, grouped by a field, without writing a parser."),
151
184
  "data-testid": "widget-inspector-query",
152
- children: /* @__PURE__ */ I("div", {
185
+ children: /* @__PURE__ */ L("div", {
153
186
  className: "space-y-3",
154
187
  children: [
155
- Q && /* @__PURE__ */ F("p", {
188
+ Q && /* @__PURE__ */ I("p", {
156
189
  role: "status",
157
190
  className: "break-words text-xs text-[var(--color-status-warning-text)]",
158
191
  "data-testid": "query-repeat-warning",
159
192
  children: Q
160
193
  }),
161
- !_ && /* @__PURE__ */ F("p", {
194
+ !_ && /* @__PURE__ */ I("p", {
162
195
  className: "text-xs text-text-secondary",
163
196
  children: w("bigconsole.widget.query.needsRows", "Connect a data source and parser that return a list of rows to use this.")
164
197
  }),
165
- /* @__PURE__ */ F(T, {
198
+ /* @__PURE__ */ I(T, {
166
199
  type: "button",
167
200
  variant: "outline",
168
- disabled: !_ || M.length === 0,
201
+ disabled: !_ || N.length === 0,
169
202
  onClick: () => S(t ?? {
170
203
  dimensions: [],
171
204
  measures: [{ agg: "count" }],
172
205
  filters: []
173
206
  }),
174
207
  "data-testid": "query-start",
175
- children: R ? w("bigconsole.widget.query.metricStart", "Calculate a metric") : w("bigconsole.widget.query.start", "Group and total the rows")
208
+ children: z ? w("bigconsole.widget.query.metricStart", "Calculate a metric") : w("bigconsole.widget.query.start", "Group and total the rows")
176
209
  })
177
210
  ]
178
211
  })
179
212
  });
180
213
  }
181
- let te = y.measures.length === 1;
182
- return /* @__PURE__ */ F(e, {
214
+ let re = y.measures.length === 1;
215
+ return /* @__PURE__ */ I(e, {
183
216
  title: w("bigconsole.widget.query.title", "Group and total"),
184
- description: a(y),
217
+ description: o(y),
185
218
  "data-testid": "widget-inspector-query",
186
- children: /* @__PURE__ */ I("div", {
219
+ children: /* @__PURE__ */ L("div", {
187
220
  className: "flex flex-col gap-form-gap",
188
221
  children: [
189
- B && /* @__PURE__ */ F("p", {
222
+ V && /* @__PURE__ */ I("p", {
190
223
  role: "alert",
191
224
  className: "break-words text-xs text-[var(--color-status-error-text)]",
192
225
  "data-testid": "query-problem",
193
- children: B
226
+ children: V
194
227
  }),
195
- (z.dimensions > 0 || y.dimensions.length > 0) && /* @__PURE__ */ I("div", {
228
+ (B.dimensions > 0 || y.dimensions.length > 0) && /* @__PURE__ */ L("div", {
196
229
  className: "space-y-2",
197
230
  children: [
198
- /* @__PURE__ */ F(E, { children: w("bigconsole.widget.query.groupBy", "Group by") }),
199
- y.dimensions.map((e, t) => /* @__PURE__ */ I(Y, { children: [/* @__PURE__ */ F(J, {
200
- id: `query-group-${t}`,
201
- label: w("bigconsole.widget.query.groupByField", "Group by field {{n}}", { n: t + 1 }),
202
- value: e,
203
- fields: M,
204
- placeholder: w("bigconsole.widget.query.pickField", "Pick a field"),
205
- onChange: (e) => $({
206
- ...y,
207
- dimensions: y.dimensions.map((n, r) => r === t ? e ?? "" : n)
208
- })
209
- }), /* @__PURE__ */ F(T, {
210
- type: "button",
211
- variant: "ghost",
212
- size: "icon",
213
- "aria-label": w("bigconsole.widget.query.removeGroup", "Remove group by {{field}}", { field: e }),
214
- onClick: () => $({
215
- ...y,
216
- dimensions: y.dimensions.filter((e, n) => n !== t)
217
- }),
218
- children: /* @__PURE__ */ F(C, {
219
- className: "h-4 w-4",
220
- "aria-hidden": !0
221
- })
222
- })] }, `${e}-${t}`)),
223
- y.dimensions.length < z.dimensions && /* @__PURE__ */ I(T, {
231
+ /* @__PURE__ */ I(D, { children: w("bigconsole.widget.query.groupBy", "Group by") }),
232
+ y.dimensions.map((e, t) => {
233
+ let n = y.dateBuckets?.find(({ field: t }) => t === e), r = N.some(({ name: t, kind: n }) => t === e && n === "date");
234
+ return /* @__PURE__ */ L("div", {
235
+ className: "space-y-2",
236
+ children: [/* @__PURE__ */ L(X, { children: [/* @__PURE__ */ I(Y, {
237
+ id: `query-group-${t}`,
238
+ label: w("bigconsole.widget.query.groupByField", "Group by field {{n}}", { n: t + 1 }),
239
+ value: e,
240
+ fields: N,
241
+ placeholder: w("bigconsole.widget.query.pickField", "Pick a field"),
242
+ onChange: (e) => $({
243
+ ...y,
244
+ dimensions: y.dimensions.map((n, r) => r === t ? e ?? "" : n)
245
+ })
246
+ }), /* @__PURE__ */ I(T, {
247
+ type: "button",
248
+ variant: "ghost",
249
+ size: "icon",
250
+ "aria-label": w("bigconsole.widget.query.removeGroup", "Remove group by {{field}}", { field: e }),
251
+ onClick: () => $({
252
+ ...y,
253
+ dimensions: y.dimensions.filter((e, n) => n !== t)
254
+ }),
255
+ children: /* @__PURE__ */ I(C, {
256
+ className: "h-4 w-4",
257
+ "aria-hidden": !0
258
+ })
259
+ })] }), !z && (r || n) && /* @__PURE__ */ I(te, {
260
+ field: e,
261
+ unit: n?.unit,
262
+ options: a(_, e),
263
+ onChange: (t) => {
264
+ let n = y.dateBuckets?.filter(({ field: t }) => t !== e) ?? [];
265
+ t && n.push({
266
+ field: e,
267
+ unit: t
268
+ }), $({
269
+ ...y,
270
+ dateBuckets: n
271
+ });
272
+ }
273
+ })]
274
+ }, `${e}-${t}`);
275
+ }),
276
+ y.dimensions.length < B.dimensions && /* @__PURE__ */ L(T, {
224
277
  type: "button",
225
278
  variant: "ghost",
226
279
  size: "sm",
227
280
  onClick: () => {
228
- let e = M.find((e) => !y.dimensions.includes(e.name) && e.name !== y.series);
281
+ let e = N.find((e) => !y.dimensions.includes(e.name) && e.name !== y.series);
229
282
  $({
230
283
  ...y,
231
284
  dimensions: [...y.dimensions, e?.name ?? ""]
232
285
  });
233
286
  },
234
287
  "data-testid": "query-add-group",
235
- children: [/* @__PURE__ */ F(x, {
288
+ children: [/* @__PURE__ */ I(x, {
236
289
  className: "mr-1 h-4 w-4",
237
290
  "aria-hidden": !0
238
291
  }), w("bigconsole.widget.query.addGroup", "Add a group by")]
239
292
  })
240
293
  ]
241
294
  }),
242
- /* @__PURE__ */ I("div", {
295
+ /* @__PURE__ */ L("div", {
243
296
  className: "space-y-2",
244
297
  children: [
245
- /* @__PURE__ */ F(E, { children: w("bigconsole.widget.query.values", "Values") }),
246
- y.measures.map((e, t) => /* @__PURE__ */ I(Y, { children: [
247
- /* @__PURE__ */ I(D, {
298
+ /* @__PURE__ */ I(D, { children: w("bigconsole.widget.query.values", "Values") }),
299
+ y.measures.map((e, t) => /* @__PURE__ */ L(X, { children: [
300
+ /* @__PURE__ */ L(O, {
248
301
  value: e.agg,
249
302
  onValueChange: (r) => {
250
- let i = r, a = e.field !== void 0 && (!n.has(i) || M.find((t) => t.name === e.field)?.kind === "number");
303
+ let i = r, a = e.field !== void 0 && (!n.has(i) || N.find((t) => t.name === e.field)?.kind === "number");
251
304
  $({
252
305
  ...y,
253
306
  measures: y.measures.map((e, n) => n === t ? {
@@ -256,24 +309,24 @@ var q = ({ field: e }) => {
256
309
  } : e)
257
310
  });
258
311
  },
259
- children: [/* @__PURE__ */ F(A, {
312
+ children: [/* @__PURE__ */ I(j, {
260
313
  "aria-label": w("bigconsole.widget.query.calculation", "Calculation {{n}}", { n: t + 1 }),
261
314
  style: {
262
315
  height: "var(--size-controlHeight-md)",
263
316
  fontSize: "var(--font-size-body-sm)",
264
317
  maxWidth: "9rem"
265
318
  },
266
- children: /* @__PURE__ */ F(j, {})
267
- }), /* @__PURE__ */ F(O, { children: r.map((e) => /* @__PURE__ */ F(k, {
319
+ children: /* @__PURE__ */ I(M, {})
320
+ }), /* @__PURE__ */ I(k, { children: r.map((e) => /* @__PURE__ */ I(A, {
268
321
  value: e,
269
- children: V[e]
322
+ children: H[e]
270
323
  }, e)) })]
271
324
  }),
272
- /* @__PURE__ */ F(J, {
325
+ /* @__PURE__ */ I(Y, {
273
326
  id: `query-value-${t}`,
274
327
  label: w("bigconsole.widget.query.valueField", "Value field {{n}}", { n: t + 1 }),
275
328
  value: e.field,
276
- fields: n.has(e.agg) ? M.filter((e) => e.kind === "number") : M,
329
+ fields: n.has(e.agg) ? N.filter((e) => e.kind === "number") : N,
277
330
  optional: e.agg === "count",
278
331
  placeholder: e.agg === "count" ? w("bigconsole.widget.query.rows", "Rows") : w("bigconsole.widget.query.pickField", "Pick a field"),
279
332
  onChange: (e) => $({
@@ -288,7 +341,7 @@ var q = ({ field: e }) => {
288
341
  })
289
342
  })
290
343
  }),
291
- y.measures.length > 1 && /* @__PURE__ */ F(T, {
344
+ y.measures.length > 1 && /* @__PURE__ */ I(T, {
292
345
  type: "button",
293
346
  variant: "ghost",
294
347
  size: "icon",
@@ -298,18 +351,18 @@ var q = ({ field: e }) => {
298
351
  measures: y.measures.filter((e, n) => n !== t),
299
352
  series: void 0
300
353
  }),
301
- children: /* @__PURE__ */ F(C, {
354
+ children: /* @__PURE__ */ I(C, {
302
355
  className: "h-4 w-4",
303
356
  "aria-hidden": !0
304
357
  })
305
358
  })
306
359
  ] }, t)),
307
- y.measures.length < z.measures && !y.series && /* @__PURE__ */ I(T, {
360
+ y.measures.length < B.measures && !y.series && /* @__PURE__ */ L(T, {
308
361
  type: "button",
309
362
  variant: "ghost",
310
363
  size: "sm",
311
364
  onClick: () => {
312
- let e = M.find((e) => e.kind === "number" && !y.measures.some((t) => t.field === e.name));
365
+ let e = N.find((e) => e.kind === "number" && !y.measures.some((t) => t.field === e.name));
313
366
  $({
314
367
  ...y,
315
368
  measures: [...y.measures, e ? {
@@ -319,31 +372,31 @@ var q = ({ field: e }) => {
319
372
  });
320
373
  },
321
374
  "data-testid": "query-add-value",
322
- children: [/* @__PURE__ */ F(x, {
375
+ children: [/* @__PURE__ */ I(x, {
323
376
  className: "mr-1 h-4 w-4",
324
377
  "aria-hidden": !0
325
378
  }), w("bigconsole.widget.query.addValue", "Add a value")]
326
379
  })
327
380
  ]
328
381
  }),
329
- !P && y.series && /* @__PURE__ */ F(T, {
382
+ !F && y.series && /* @__PURE__ */ I(T, {
330
383
  type: "button",
331
384
  variant: "outline",
332
385
  onClick: () => $(c(y, "series")),
333
386
  children: w("bigconsole.widget.query.removeSeries", "Remove series split")
334
387
  }),
335
- P && /* @__PURE__ */ I("div", {
388
+ F && /* @__PURE__ */ L("div", {
336
389
  className: "space-y-2",
337
390
  children: [
338
- /* @__PURE__ */ F(E, {
391
+ /* @__PURE__ */ I(D, {
339
392
  htmlFor: "query-series",
340
393
  children: w("bigconsole.widget.query.series", "Split into lines by")
341
394
  }),
342
- /* @__PURE__ */ F(J, {
395
+ /* @__PURE__ */ I(Y, {
343
396
  id: "query-series",
344
397
  label: w("bigconsole.widget.query.series", "Split into lines by"),
345
398
  value: y.series,
346
- fields: M.filter((e) => !y.dimensions.includes(e.name)),
399
+ fields: N.filter((e) => !y.dimensions.includes(e.name)),
347
400
  optional: !0,
348
401
  placeholder: w("bigconsole.widget.query.noSeries", "One line"),
349
402
  onChange: (e) => {
@@ -354,44 +407,44 @@ var q = ({ field: e }) => {
354
407
  } : t);
355
408
  }
356
409
  }),
357
- !te && /* @__PURE__ */ F("p", {
410
+ !re && /* @__PURE__ */ I("p", {
358
411
  className: "text-xs text-text-secondary",
359
412
  children: w("bigconsole.widget.query.seriesNeedsOne", "Splitting into lines works with one value. Remove the others to use it.")
360
413
  }),
361
- y.series && /* @__PURE__ */ F("p", {
414
+ y.series && /* @__PURE__ */ I("p", {
362
415
  className: "text-xs text-text-secondary",
363
416
  children: w("bigconsole.widget.query.seriesMax", "Up to {{max}} different values; more would be too many lines.", { max: i.series })
364
417
  })
365
418
  ]
366
419
  }),
367
- /* @__PURE__ */ I("div", {
420
+ /* @__PURE__ */ L("div", {
368
421
  className: "grid grid-cols-2 gap-form-gap",
369
- children: [/* @__PURE__ */ I("div", {
422
+ children: [/* @__PURE__ */ L("div", {
370
423
  className: "space-y-2",
371
- children: [/* @__PURE__ */ F(E, {
424
+ children: [/* @__PURE__ */ I(D, {
372
425
  htmlFor: "query-sort",
373
426
  children: w("bigconsole.widget.query.sort", "Sort")
374
- }), /* @__PURE__ */ I(D, {
375
- value: U(y),
376
- onValueChange: (e) => $(W(y, e)),
377
- children: [/* @__PURE__ */ F(A, {
427
+ }), /* @__PURE__ */ L(O, {
428
+ value: W(y),
429
+ onValueChange: (e) => $(G(y, e)),
430
+ children: [/* @__PURE__ */ I(j, {
378
431
  id: "query-sort",
379
432
  style: {
380
433
  height: "var(--size-controlHeight-md)",
381
434
  fontSize: "var(--font-size-body-sm)"
382
435
  },
383
- children: /* @__PURE__ */ F(j, {})
384
- }), /* @__PURE__ */ F(O, { children: H.filter((e) => e.value !== "group-asc" || y.dimensions.length > 0).map((e) => /* @__PURE__ */ F(k, {
436
+ children: /* @__PURE__ */ I(M, {})
437
+ }), /* @__PURE__ */ I(k, { children: U.filter((e) => e.value !== "group-asc" || y.dimensions.length > 0).map((e) => /* @__PURE__ */ I(A, {
385
438
  value: e.value,
386
439
  children: e.label
387
440
  }, e.value)) })]
388
441
  })]
389
- }), /* @__PURE__ */ I("div", {
442
+ }), /* @__PURE__ */ L("div", {
390
443
  className: "space-y-2",
391
- children: [/* @__PURE__ */ F(E, {
444
+ children: [/* @__PURE__ */ I(D, {
392
445
  htmlFor: "query-limit",
393
446
  children: w("bigconsole.widget.query.limit", "Show only the first")
394
- }), /* @__PURE__ */ F(ee, {
447
+ }), /* @__PURE__ */ I(E, {
395
448
  id: "query-limit",
396
449
  type: "number",
397
450
  min: 1,
@@ -408,18 +461,18 @@ var q = ({ field: e }) => {
408
461
  })]
409
462
  })]
410
463
  }),
411
- G && !b && /* @__PURE__ */ F("p", {
464
+ K && !b && /* @__PURE__ */ I("p", {
412
465
  role: "status",
413
466
  className: "text-xs text-text-secondary",
414
467
  children: w("bigconsole.widget.query.previewRequiresSavedSource", "Save the data source changes to preview this query.")
415
468
  }),
416
- /* @__PURE__ */ F(Z, {
469
+ /* @__PURE__ */ I(ne, {
417
470
  widget: g,
418
- isChart: q,
419
- state: K,
420
- ready: G && b
471
+ isChart: J,
472
+ state: q,
473
+ ready: K && b
421
474
  }),
422
- /* @__PURE__ */ F("div", { children: /* @__PURE__ */ F(T, {
475
+ /* @__PURE__ */ I("div", { children: /* @__PURE__ */ I(T, {
423
476
  type: "button",
424
477
  variant: "ghost",
425
478
  size: "sm",
@@ -430,67 +483,67 @@ var q = ({ field: e }) => {
430
483
  ]
431
484
  })
432
485
  });
433
- }, Z = ({ widget: e, isChart: t, state: n, ready: r }) => {
434
- let { t: i } = N();
486
+ }, ne = ({ widget: e, isChart: t, state: n, ready: r }) => {
487
+ let { t: i } = P();
435
488
  if (!r) return null;
436
489
  let a = n.rows && n.rows[0] ? Object.keys(n.rows[0]) : [];
437
- return /* @__PURE__ */ I("div", {
490
+ return /* @__PURE__ */ L("div", {
438
491
  className: "space-y-2",
439
492
  "data-testid": "query-preview",
440
493
  "aria-live": "polite",
441
494
  children: [
442
- /* @__PURE__ */ I("div", {
495
+ /* @__PURE__ */ L("div", {
443
496
  className: "flex items-center gap-2",
444
- children: [/* @__PURE__ */ F(E, { children: i("bigconsole.widget.query.preview", "Preview") }), n.loading && /* @__PURE__ */ F(M, { style: {
497
+ children: [/* @__PURE__ */ I(D, { children: i("bigconsole.widget.query.preview", "Preview") }), n.loading && /* @__PURE__ */ I(N, { style: {
445
498
  width: "14px",
446
499
  height: "14px"
447
500
  } })]
448
501
  }),
449
- n.error && /* @__PURE__ */ F("p", {
502
+ n.error && /* @__PURE__ */ I("p", {
450
503
  role: "alert",
451
504
  className: "break-words text-xs text-[var(--color-status-error-text)]",
452
505
  "data-testid": "query-preview-error",
453
506
  children: n.error
454
507
  }),
455
- !n.error && n.rows && n.rows.length === 0 && /* @__PURE__ */ F("p", {
508
+ !n.error && n.rows && n.rows.length === 0 && /* @__PURE__ */ I("p", {
456
509
  className: "text-xs text-text-secondary",
457
510
  children: i("bigconsole.widget.query.previewEmpty", "No rows to show.")
458
511
  }),
459
- n.rows && n.rows.length > 0 && /* @__PURE__ */ I(P, { children: [
460
- t && /* @__PURE__ */ F("div", {
512
+ n.rows && n.rows.length > 0 && /* @__PURE__ */ L(F, { children: [
513
+ t && /* @__PURE__ */ I("div", {
461
514
  className: "h-56 min-w-0 rounded-input border border-[var(--color-border-subtle)] p-2",
462
515
  "data-testid": "query-preview-chart",
463
- children: /* @__PURE__ */ F(g, {
516
+ children: /* @__PURE__ */ I(g, {
464
517
  fallback: null,
465
- children: /* @__PURE__ */ F(G, {
518
+ children: /* @__PURE__ */ I(K, {
466
519
  widget: e,
467
- data: K(n.rows)
520
+ data: q(n.rows)
468
521
  })
469
522
  })
470
523
  }),
471
- /* @__PURE__ */ F("div", {
524
+ /* @__PURE__ */ I("div", {
472
525
  className: "max-h-48 min-w-0 overflow-auto rounded-input border border-[var(--color-border-subtle)]",
473
- children: /* @__PURE__ */ I("table", {
526
+ children: /* @__PURE__ */ L("table", {
474
527
  className: "w-full text-xs",
475
- children: [/* @__PURE__ */ F("thead", {
528
+ children: [/* @__PURE__ */ I("thead", {
476
529
  className: "bg-bg-surface text-left text-text-secondary",
477
- children: /* @__PURE__ */ F("tr", { children: a.map((e) => /* @__PURE__ */ F("th", {
530
+ children: /* @__PURE__ */ I("tr", { children: a.map((e) => /* @__PURE__ */ I("th", {
478
531
  className: "px-2 py-1 font-medium",
479
532
  children: e
480
533
  }, e)) })
481
- }), /* @__PURE__ */ F("tbody", { children: n.rows.slice(0, R).map((e, t) => /* @__PURE__ */ F("tr", {
534
+ }), /* @__PURE__ */ I("tbody", { children: n.rows.slice(0, z).map((e, t) => /* @__PURE__ */ I("tr", {
482
535
  className: "border-t border-[var(--color-border-subtle)]",
483
- children: a.map((t) => /* @__PURE__ */ F("td", {
536
+ children: a.map((t) => /* @__PURE__ */ I("td", {
484
537
  className: "px-2 py-1",
485
538
  children: String(e[t] ?? "")
486
539
  }, t))
487
540
  }, t)) })]
488
541
  })
489
542
  }),
490
- n.rows.length > R && /* @__PURE__ */ F("p", {
543
+ n.rows.length > z && /* @__PURE__ */ I("p", {
491
544
  className: "text-xs text-text-secondary",
492
545
  children: i("bigconsole.widget.query.previewMore", "Showing the first {{n}} of {{total}} rows.", {
493
- n: R,
546
+ n: z,
494
547
  total: n.rows.length
495
548
  })
496
549
  })
@@ -498,4 +551,4 @@ var q = ({ field: e }) => {
498
551
  ]
499
552
  });
500
553
  };
501
- export { X as QuerySection };
554
+ export { Z as QuerySection };