@dashspec/renderer 0.1.40 → 0.1.42
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/CHANGELOG.md +36 -0
- package/README.md +1 -1
- package/dist/FlowMapView-BSTKU7D4.js +458 -0
- package/dist/FlowMapView-BSTKU7D4.js.map +1 -0
- package/dist/chunk-5LRFKK4I.js +118 -0
- package/dist/chunk-5LRFKK4I.js.map +1 -0
- package/dist/{chunk-NLKXHTLO.js → chunk-D4GFCPCL.js} +6 -33
- package/dist/chunk-D4GFCPCL.js.map +1 -0
- package/dist/chunk-E4CT25TF.js +440 -0
- package/dist/chunk-E4CT25TF.js.map +1 -0
- package/dist/chunk-HUBYJ34E.js +38 -0
- package/dist/chunk-HUBYJ34E.js.map +1 -0
- package/dist/{chunk-M4WXE3FW.js → chunk-JCPQBIAL.js} +5 -3
- package/dist/{chunk-M4WXE3FW.js.map → chunk-JCPQBIAL.js.map} +1 -1
- package/dist/{chunk-UK4FBI4D.js → chunk-O4BYNRCA.js} +204 -526
- package/dist/chunk-O4BYNRCA.js.map +1 -0
- package/dist/{core-CrM2CTkH.d.ts → core-B0gU-OwN.d.ts} +34 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +18 -16
- package/dist/index.d.ts +61 -5
- package/dist/index.js +587 -505
- package/dist/index.js.map +1 -1
- package/dist/sandbox-RCDZ7SDZ.js +11 -0
- package/dist/sandbox.js +3 -2
- package/dist/schema.json +12 -0
- package/docs/README.md +1 -1
- package/docs/api.md +1 -1
- package/docs/data.md +8 -0
- package/docs/design-systems.md +21 -0
- package/docs/getting-started.md +1 -1
- package/docs/json-format.md +2 -0
- package/docs/theming.md +31 -0
- package/docs/widgets.md +2 -1
- package/package.json +1 -1
- package/dist/chunk-NLKXHTLO.js.map +0 -1
- package/dist/chunk-UK4FBI4D.js.map +0 -1
- package/dist/sandbox-WEMG76LE.js +0 -10
- /package/dist/{sandbox-WEMG76LE.js.map → sandbox-RCDZ7SDZ.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -30,8 +30,8 @@ import {
|
|
|
30
30
|
EventHandler,
|
|
31
31
|
EventMap,
|
|
32
32
|
Expression,
|
|
33
|
-
ExpressionError,
|
|
34
33
|
FilterContract,
|
|
34
|
+
FlowMapContract,
|
|
35
35
|
FnProp,
|
|
36
36
|
GaugeContract,
|
|
37
37
|
Handler,
|
|
@@ -83,57 +83,74 @@ import {
|
|
|
83
83
|
buildUrl,
|
|
84
84
|
builtInWidgetChecks,
|
|
85
85
|
checkWidget,
|
|
86
|
-
collectReferences,
|
|
87
|
-
compile,
|
|
88
86
|
createHelpers,
|
|
89
87
|
createHttpClient,
|
|
90
88
|
createWidgetRegistry,
|
|
91
89
|
dashboardJsonSchema,
|
|
92
|
-
evaluate,
|
|
93
|
-
evaluateSafe,
|
|
94
|
-
expressionReferences,
|
|
95
90
|
graphqlData,
|
|
96
|
-
interpolate,
|
|
97
|
-
interpolateUrl,
|
|
98
91
|
isCallbackSource,
|
|
99
92
|
isSafeUrl,
|
|
100
93
|
loadDocument,
|
|
101
94
|
mergeConnections,
|
|
102
95
|
migrateDocument,
|
|
103
|
-
parse,
|
|
104
96
|
parseDuration,
|
|
105
|
-
placeholders,
|
|
106
97
|
plantDate,
|
|
107
98
|
plantDayStart,
|
|
108
|
-
resolve,
|
|
109
99
|
resolveBaseUrl,
|
|
110
|
-
resolveRequest,
|
|
111
100
|
safeLink,
|
|
112
101
|
satisfies,
|
|
113
|
-
scope,
|
|
114
|
-
stripStrings,
|
|
115
|
-
templateReferences,
|
|
116
102
|
translator,
|
|
117
103
|
validateDocument,
|
|
118
104
|
widgetChecks
|
|
119
|
-
} from "./chunk-
|
|
105
|
+
} from "./chunk-O4BYNRCA.js";
|
|
106
|
+
import {
|
|
107
|
+
Chips,
|
|
108
|
+
asRows,
|
|
109
|
+
deepMerge,
|
|
110
|
+
evalOver,
|
|
111
|
+
field,
|
|
112
|
+
formatValue,
|
|
113
|
+
safeImageSrc,
|
|
114
|
+
toNumber,
|
|
115
|
+
tone,
|
|
116
|
+
toneOf
|
|
117
|
+
} from "./chunk-5LRFKK4I.js";
|
|
118
|
+
import {
|
|
119
|
+
ExpressionError,
|
|
120
|
+
collectReferences,
|
|
121
|
+
compile,
|
|
122
|
+
evaluate,
|
|
123
|
+
evaluateSafe,
|
|
124
|
+
expressionReferences,
|
|
125
|
+
interpolate,
|
|
126
|
+
interpolateUrl,
|
|
127
|
+
parse,
|
|
128
|
+
placeholders,
|
|
129
|
+
resolve,
|
|
130
|
+
resolveRequest,
|
|
131
|
+
scope,
|
|
132
|
+
stripStrings,
|
|
133
|
+
templateReferences
|
|
134
|
+
} from "./chunk-E4CT25TF.js";
|
|
120
135
|
import {
|
|
121
136
|
createStateProxy,
|
|
122
|
-
getPath,
|
|
123
137
|
offRunner,
|
|
124
138
|
stateActions,
|
|
125
139
|
stateSlice,
|
|
126
140
|
stateWriteProblem,
|
|
127
141
|
trustedRunner
|
|
128
|
-
} from "./chunk-
|
|
142
|
+
} from "./chunk-D4GFCPCL.js";
|
|
143
|
+
import {
|
|
144
|
+
getPath
|
|
145
|
+
} from "./chunk-HUBYJ34E.js";
|
|
129
146
|
|
|
130
147
|
// src/components/context.tsx
|
|
131
148
|
import { createContext, useCallback, useContext, useRef, useSyncExternalStore } from "react";
|
|
132
149
|
var DashboardContext = createContext(null);
|
|
133
150
|
function useDashboard() {
|
|
134
|
-
const
|
|
135
|
-
if (!
|
|
136
|
-
return
|
|
151
|
+
const v2 = useContext(DashboardContext);
|
|
152
|
+
if (!v2) throw new Error("DashSpec components must be inside <DashboardRenderer>");
|
|
153
|
+
return v2;
|
|
137
154
|
}
|
|
138
155
|
function shallowEqual(a, b) {
|
|
139
156
|
if (Object.is(a, b)) return true;
|
|
@@ -251,7 +268,8 @@ function buildTree(state, data, inputs) {
|
|
|
251
268
|
computing.add(id);
|
|
252
269
|
const up = derive(def.from);
|
|
253
270
|
computing.delete(id);
|
|
254
|
-
const
|
|
271
|
+
const pathTpl = typeof def.path === "string" ? def.path : void 0;
|
|
272
|
+
const filters = readsState(def.transform) || Boolean(pathTpl?.includes("${"));
|
|
255
273
|
const keyState = filters ? state : null;
|
|
256
274
|
const keyContext = filters ? inputs.context : null;
|
|
257
275
|
const prev = memo.get(id);
|
|
@@ -264,7 +282,12 @@ function buildTree(state, data, inputs) {
|
|
|
264
282
|
if (up.data === void 0) result = { status: up.status, ...up.error ? { error: up.error } : {} };
|
|
265
283
|
else {
|
|
266
284
|
try {
|
|
267
|
-
|
|
285
|
+
let input = up.data;
|
|
286
|
+
if (pathTpl) {
|
|
287
|
+
const resolved = pathTpl.includes("${") ? String(interpolate(pathTpl, root) ?? "") : pathTpl;
|
|
288
|
+
input = resolved ? getPath(up.data, resolved) : up.data;
|
|
289
|
+
}
|
|
290
|
+
const out = applyTransform(input, def.transform ?? [], root, {
|
|
268
291
|
...inputs.runFn ? { runFn: inputs.runFn } : {},
|
|
269
292
|
...inputs.maxRows ? { maxRows: inputs.maxRows } : {}
|
|
270
293
|
});
|
|
@@ -323,7 +346,7 @@ function createActionRunner(deps) {
|
|
|
323
346
|
drill: drillValues(tree, event?.panel)
|
|
324
347
|
});
|
|
325
348
|
};
|
|
326
|
-
const fill = (
|
|
349
|
+
const fill = (v2, event) => resolve(v2, scopeFor(event));
|
|
327
350
|
const go = (to, opts) => {
|
|
328
351
|
const href = safeLink(to);
|
|
329
352
|
if (href === void 0) {
|
|
@@ -352,13 +375,13 @@ function createActionRunner(deps) {
|
|
|
352
375
|
}
|
|
353
376
|
async function runCallback(code, event, key, mode) {
|
|
354
377
|
if (mode === "latest") runs.get(key)?.ctrl.abort();
|
|
355
|
-
const
|
|
378
|
+
const token2 = {};
|
|
356
379
|
const ctrl = new AbortController();
|
|
357
|
-
runs.set(key, { token, ctrl });
|
|
380
|
+
runs.set(key, { token: token2, ctrl });
|
|
358
381
|
const state = createStateProxy({
|
|
359
382
|
read: deps.getTree,
|
|
360
383
|
write: (path, value) => deps.dispatch(stateActions.set({ path, value })),
|
|
361
|
-
isCancelled: () => mode === "latest" && runs.get(key)?.token !==
|
|
384
|
+
isCancelled: () => mode === "latest" && runs.get(key)?.token !== token2
|
|
362
385
|
});
|
|
363
386
|
try {
|
|
364
387
|
await deps.scripts.callback(code, event ?? {}, state, api(ctrl.signal));
|
|
@@ -371,7 +394,7 @@ function createActionRunner(deps) {
|
|
|
371
394
|
});
|
|
372
395
|
deps.hooks.toast?.(e.message, "bad");
|
|
373
396
|
} finally {
|
|
374
|
-
if (runs.get(key)?.token ===
|
|
397
|
+
if (runs.get(key)?.token === token2) runs.delete(key);
|
|
375
398
|
}
|
|
376
399
|
}
|
|
377
400
|
async function runAction(a, event, key, mode) {
|
|
@@ -672,10 +695,10 @@ async function pool(items, limit, fn) {
|
|
|
672
695
|
await Promise.all(Array.from({ length: Math.min(limit, items.length) }, worker));
|
|
673
696
|
return out;
|
|
674
697
|
}
|
|
675
|
-
function strings(
|
|
676
|
-
if (typeof
|
|
677
|
-
else if (Array.isArray(
|
|
678
|
-
else if (
|
|
698
|
+
function strings(v2, out = []) {
|
|
699
|
+
if (typeof v2 === "string") out.push(v2);
|
|
700
|
+
else if (Array.isArray(v2)) for (const x of v2) strings(x, out);
|
|
701
|
+
else if (v2 && typeof v2 === "object") for (const x of Object.values(v2)) strings(x, out);
|
|
679
702
|
return out;
|
|
680
703
|
}
|
|
681
704
|
function pollInterval(every) {
|
|
@@ -688,7 +711,7 @@ function pollInterval(every) {
|
|
|
688
711
|
}
|
|
689
712
|
return ms > 0 ? Math.max(1e3, ms) : void 0;
|
|
690
713
|
}
|
|
691
|
-
var isObjLike = (
|
|
714
|
+
var isObjLike = (v2) => v2 !== null && typeof v2 === "object";
|
|
692
715
|
function createDataEngine(deps) {
|
|
693
716
|
const { datasources: defs, http } = deps;
|
|
694
717
|
const now = deps.now ?? Date.now;
|
|
@@ -1003,8 +1026,8 @@ function createDataEngine(deps) {
|
|
|
1003
1026
|
}
|
|
1004
1027
|
if (ds.type === "host") {
|
|
1005
1028
|
const key = ds.key;
|
|
1006
|
-
const
|
|
1007
|
-
if (cur?.data !==
|
|
1029
|
+
const v2 = hostData && Object.hasOwn(hostData, key) ? hostData[key] : void 0;
|
|
1030
|
+
if (cur?.data !== v2) deps.dispatch(dataActions.success({ id, key: "host", data: v2, at: now() }));
|
|
1008
1031
|
return;
|
|
1009
1032
|
}
|
|
1010
1033
|
if (typeof ds.enabled === "string") {
|
|
@@ -1193,9 +1216,9 @@ function presetRange(preset, t) {
|
|
|
1193
1216
|
return r(addDays(today, -6), today);
|
|
1194
1217
|
}
|
|
1195
1218
|
}
|
|
1196
|
-
function initialFilterValue(
|
|
1197
|
-
const kind =
|
|
1198
|
-
const raw = fromUrl !== void 0 ? fromUrl :
|
|
1219
|
+
function initialFilterValue(v2, t, fromUrl) {
|
|
1220
|
+
const kind = v2.kind;
|
|
1221
|
+
const raw = fromUrl !== void 0 ? fromUrl : v2.default;
|
|
1199
1222
|
switch (kind) {
|
|
1200
1223
|
case "DateRange":
|
|
1201
1224
|
if (typeof raw === "string") return presetRange(raw, t);
|
|
@@ -1210,13 +1233,13 @@ function initialFilterValue(v, t, fromUrl) {
|
|
|
1210
1233
|
case "Search":
|
|
1211
1234
|
return typeof raw === "string" ? raw : "";
|
|
1212
1235
|
case "Chips":
|
|
1213
|
-
return raw ?? (
|
|
1236
|
+
return raw ?? (v2.multiple ? [] : null);
|
|
1214
1237
|
default:
|
|
1215
1238
|
return raw ?? null;
|
|
1216
1239
|
}
|
|
1217
1240
|
}
|
|
1218
1241
|
function initialFilters(variables, t, url = {}) {
|
|
1219
|
-
return Object.fromEntries(variables.map((
|
|
1242
|
+
return Object.fromEntries(variables.map((v2) => [v2.name, initialFilterValue(v2, t, url[v2.name])]));
|
|
1220
1243
|
}
|
|
1221
1244
|
|
|
1222
1245
|
// src/runtime/index.ts
|
|
@@ -1243,7 +1266,7 @@ function pickRunner(o) {
|
|
|
1243
1266
|
}
|
|
1244
1267
|
function timeSettingsFor(doc, time = {}) {
|
|
1245
1268
|
const d = doc.spec.display ?? {};
|
|
1246
|
-
const own = Object.fromEntries(Object.entries(time).filter(([,
|
|
1269
|
+
const own = Object.fromEntries(Object.entries(time).filter(([, v2]) => v2 !== void 0));
|
|
1247
1270
|
return {
|
|
1248
1271
|
...d.timeZone ? { timeZone: d.timeZone } : {},
|
|
1249
1272
|
...d.dayStartsAt ? { dayStartsAt: d.dayStartsAt } : {},
|
|
@@ -1341,14 +1364,14 @@ function createDashboardRuntime(doc, options = {}) {
|
|
|
1341
1364
|
hooks: options.hooks ?? {}
|
|
1342
1365
|
});
|
|
1343
1366
|
const optionSources = (doc.spec.variables ?? []).map(
|
|
1344
|
-
(
|
|
1367
|
+
(v2) => v2.options && typeof v2.options === "object" && !Array.isArray(v2.options) ? v2.options.source : void 0
|
|
1345
1368
|
).filter((s) => typeof s === "string");
|
|
1346
1369
|
engine.want(optionSources);
|
|
1347
|
-
const variableDefs = new Map((doc.spec.variables ?? []).map((
|
|
1370
|
+
const variableDefs = new Map((doc.spec.variables ?? []).map((v2) => [v2.name, v2]));
|
|
1348
1371
|
const dependents = /* @__PURE__ */ new Map();
|
|
1349
|
-
for (const
|
|
1350
|
-
for (const parent of
|
|
1351
|
-
dependents.set(parent, [...dependents.get(parent) ?? [],
|
|
1372
|
+
for (const v2 of variableDefs.values())
|
|
1373
|
+
for (const parent of v2.dependsOn ?? [])
|
|
1374
|
+
dependents.set(parent, [...dependents.get(parent) ?? [], v2.name]);
|
|
1352
1375
|
let offFilters = null;
|
|
1353
1376
|
let loadedOnce = false;
|
|
1354
1377
|
const watches = [
|
|
@@ -1577,14 +1600,14 @@ var dark = {
|
|
|
1577
1600
|
var defaultTheme = { name: "default", mode: "auto", scale, light, dark };
|
|
1578
1601
|
|
|
1579
1602
|
// src/theme/createTheme.ts
|
|
1580
|
-
var isObject = (
|
|
1603
|
+
var isObject = (v2) => typeof v2 === "object" && v2 !== null && !Array.isArray(v2);
|
|
1581
1604
|
function mergeDeep(base, patch) {
|
|
1582
1605
|
if (patch === void 0) return base;
|
|
1583
1606
|
if (!isObject(base) || !isObject(patch)) return patch;
|
|
1584
1607
|
const out = { ...base };
|
|
1585
|
-
for (const [k,
|
|
1586
|
-
if (
|
|
1587
|
-
out[k] = mergeDeep(base[k],
|
|
1608
|
+
for (const [k, v2] of Object.entries(patch)) {
|
|
1609
|
+
if (v2 === void 0) continue;
|
|
1610
|
+
out[k] = mergeDeep(base[k], v2);
|
|
1588
1611
|
}
|
|
1589
1612
|
return out;
|
|
1590
1613
|
}
|
|
@@ -1599,7 +1622,11 @@ function shortcutColors(c) {
|
|
|
1599
1622
|
...c.series ? { chart: { series: c.series } } : {}
|
|
1600
1623
|
};
|
|
1601
1624
|
}
|
|
1602
|
-
function createTheme(input = {}) {
|
|
1625
|
+
function createTheme(input = {}, start) {
|
|
1626
|
+
if (typeof input === "function") {
|
|
1627
|
+
const from = start ?? defaultTheme;
|
|
1628
|
+
return createTheme({ extends: from, ...input(from) });
|
|
1629
|
+
}
|
|
1603
1630
|
const base = input.extends ?? defaultTheme;
|
|
1604
1631
|
const shortcut = input.colors ? shortcutColors(input.colors) : void 0;
|
|
1605
1632
|
let scale2 = mergeDeep(base.scale, input.scale);
|
|
@@ -1758,9 +1785,9 @@ function cssRulesToString(rules, unsafe) {
|
|
|
1758
1785
|
for (const [selector, decl2] of Object.entries(rules)) {
|
|
1759
1786
|
if (!decl2 || typeof decl2 !== "object" || /[{};<>]/.test(selector)) continue;
|
|
1760
1787
|
const sel = selector.includes("&") ? selector : `& ${selector}`;
|
|
1761
|
-
const body = Object.entries(decl2).filter(([,
|
|
1788
|
+
const body = Object.entries(decl2).filter(([, v2]) => (typeof v2 === "string" || typeof v2 === "number") && !unsafe.test(String(v2))).map(([k, v2]) => {
|
|
1762
1789
|
const prop = k.startsWith("--") ? k : k.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`);
|
|
1763
|
-
const val = typeof
|
|
1790
|
+
const val = typeof v2 === "number" && v2 !== 0 && !k.startsWith("--") && !UNITLESS.has(k) ? `${v2}px` : String(v2);
|
|
1764
1791
|
return `${prop}: ${val};`;
|
|
1765
1792
|
}).join(" ");
|
|
1766
1793
|
if (body) out.push(`${sel} { ${body} }`);
|
|
@@ -1772,9 +1799,9 @@ function cssRulesToString(rules, unsafe) {
|
|
|
1772
1799
|
var kebab = (s) => s.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`);
|
|
1773
1800
|
function flatten(prefix, value, out, unit = "") {
|
|
1774
1801
|
if (Array.isArray(value)) {
|
|
1775
|
-
value.forEach((
|
|
1802
|
+
value.forEach((v2, i) => flatten(`${prefix}-${i + 1}`, v2, out, unit));
|
|
1776
1803
|
} else if (typeof value === "object" && value !== null) {
|
|
1777
|
-
for (const [k,
|
|
1804
|
+
for (const [k, v2] of Object.entries(value)) flatten(`${prefix}-${kebab(k)}`, v2, out, unit);
|
|
1778
1805
|
} else if (value !== void 0) {
|
|
1779
1806
|
out[prefix] = typeof value === "number" && unit ? `${value}${unit}` : String(value);
|
|
1780
1807
|
}
|
|
@@ -1793,7 +1820,7 @@ function themeCssVars(theme, mode) {
|
|
|
1793
1820
|
out["--ds-color-surface-table-header"] ??= c.surface.sunken;
|
|
1794
1821
|
const density = Object.hasOwn(DENSITY, s.density) ? s.density : "comfortable";
|
|
1795
1822
|
const d = DENSITY[density];
|
|
1796
|
-
const space = Object.fromEntries(Object.entries(s.space).map(([k,
|
|
1823
|
+
const space = Object.fromEntries(Object.entries(s.space).map(([k, v2]) => [k, Math.round(v2 * d.space)]));
|
|
1797
1824
|
flatten("--ds-space", space, out, "px");
|
|
1798
1825
|
out["--ds-control-height"] = `${d.control}px`;
|
|
1799
1826
|
out["--ds-density"] = density;
|
|
@@ -1851,7 +1878,7 @@ var UNSAFE_CSS = /[;{}<>\r\n\f\\]/;
|
|
|
1851
1878
|
var SAFE_NAME = /^--[\w-]+$/;
|
|
1852
1879
|
function themeStylesheet(theme, selector = ".ds-root") {
|
|
1853
1880
|
const block = (sel, vars) => `${sel} {
|
|
1854
|
-
${Object.entries(vars).filter(([k,
|
|
1881
|
+
${Object.entries(vars).filter(([k, v2]) => SAFE_NAME.test(k) && !UNSAFE_CSS.test(v2)).map(([k, v2]) => ` ${k}: ${v2};`).join("\n")}
|
|
1855
1882
|
}`;
|
|
1856
1883
|
return [
|
|
1857
1884
|
block(selector, themeCssVars(theme, "light")),
|
|
@@ -1864,14 +1891,14 @@ function widgetThemeCss(theme, scope2, mode = "light") {
|
|
|
1864
1891
|
const m = /^([A-Za-z][\w.-]*)(?::([A-Za-z][\w-]*))?$/.exec(kind);
|
|
1865
1892
|
if (!m || !w) continue;
|
|
1866
1893
|
const sel = `${scope2} .ds-panel[data-kind="${m[1]}"]${m[2] ? `[data-variant="${m[2]}"]` : ""}`;
|
|
1867
|
-
const vars = Object.entries(w.vars ?? {}).filter(([k,
|
|
1868
|
-
if (vars.length) out.push(`${sel} { ${vars.map(([k,
|
|
1894
|
+
const vars = Object.entries(w.vars ?? {}).filter(([k, v2]) => SAFE_NAME.test(k) && !UNSAFE_CSS.test(String(v2)));
|
|
1895
|
+
if (vars.length) out.push(`${sel} { ${vars.map(([k, v2]) => `${k}: ${v2};`).join(" ")} }`);
|
|
1869
1896
|
const css = typeof w.css === "object" && w.css !== null ? cssRulesToString(w.css, UNSAFE_CSS) : w.css;
|
|
1870
1897
|
if (typeof css === "string" && css && !/<\/?\s*style/i.test(css))
|
|
1871
1898
|
out.push(css.includes("&") ? css.replaceAll("&", sel) : `${sel} { ${css} }`);
|
|
1872
1899
|
if (mode === "dark" && w.dark) {
|
|
1873
|
-
const dv = Object.entries(w.dark.vars ?? {}).filter(([k,
|
|
1874
|
-
if (dv.length) out.push(`${sel} { ${dv.map(([k,
|
|
1900
|
+
const dv = Object.entries(w.dark.vars ?? {}).filter(([k, v2]) => SAFE_NAME.test(k) && !UNSAFE_CSS.test(String(v2)));
|
|
1901
|
+
if (dv.length) out.push(`${sel} { ${dv.map(([k, v2]) => `${k}: ${v2};`).join(" ")} }`);
|
|
1875
1902
|
const dc = typeof w.dark.css === "object" && w.dark.css !== null ? cssRulesToString(w.dark.css, UNSAFE_CSS) : w.dark.css;
|
|
1876
1903
|
if (typeof dc === "string" && dc && !/<\/?\s*style/i.test(dc))
|
|
1877
1904
|
out.push(dc.includes("&") ? dc.replaceAll("&", sel) : `${sel} { ${dc} }`);
|
|
@@ -1882,10 +1909,10 @@ function widgetThemeCss(theme, scope2, mode = "light") {
|
|
|
1882
1909
|
|
|
1883
1910
|
// src/theme/parts.ts
|
|
1884
1911
|
var SAFE = /^[^;{}<>\\\n\r]*$/;
|
|
1885
|
-
var ok = (
|
|
1886
|
-
var px = (
|
|
1912
|
+
var ok = (v2) => typeof v2 === "number" && Number.isFinite(v2) || typeof v2 === "string" && SAFE.test(v2);
|
|
1913
|
+
var px = (v2) => v2 === void 0 ? void 0 : `${v2}px`;
|
|
1887
1914
|
function decl(map) {
|
|
1888
|
-
return Object.entries(map).filter(([,
|
|
1915
|
+
return Object.entries(map).filter(([, v2]) => v2 !== void 0 && ok(v2)).map(([k, v2]) => `${k}: ${v2};`).join(" ");
|
|
1889
1916
|
}
|
|
1890
1917
|
function text(t, c) {
|
|
1891
1918
|
if (!t) return "";
|
|
@@ -1902,7 +1929,7 @@ function text(t, c) {
|
|
|
1902
1929
|
function partsCss(theme, scope2, mode = "light") {
|
|
1903
1930
|
const p = theme.scale.parts;
|
|
1904
1931
|
if (!p) return "";
|
|
1905
|
-
const c = (
|
|
1932
|
+
const c = (v2) => v2 === void 0 || typeof v2 === "string" ? v2 : v2[mode];
|
|
1906
1933
|
const rules = [
|
|
1907
1934
|
[".ds-panel-title", text(p.title, c)],
|
|
1908
1935
|
[".ds-panel-subtitle", text(p.subtitle, c)],
|
|
@@ -1958,6 +1985,18 @@ function partsCss(theme, scope2, mode = "light") {
|
|
|
1958
1985
|
decl({ width: px(p.liveDot?.size), height: px(p.liveDot?.size), background: c(p.liveDot?.color) })
|
|
1959
1986
|
],
|
|
1960
1987
|
[".ds-live[data-stale] > span", decl({ background: c(p.liveDot?.staleColor) })],
|
|
1988
|
+
[
|
|
1989
|
+
".ds-flow-hover",
|
|
1990
|
+
decl({
|
|
1991
|
+
padding: p.popover?.padding,
|
|
1992
|
+
"border-radius": px(p.popover?.radius),
|
|
1993
|
+
border: p.popover?.border,
|
|
1994
|
+
"backdrop-filter": p.popover?.blur !== void 0 ? `blur(${p.popover.blur}px)` : void 0,
|
|
1995
|
+
display: p.popover?.gap !== void 0 ? "flex" : void 0,
|
|
1996
|
+
"flex-direction": p.popover?.gap !== void 0 ? "column" : void 0,
|
|
1997
|
+
gap: px(p.popover?.gap)
|
|
1998
|
+
})
|
|
1999
|
+
],
|
|
1961
2000
|
[".ds-filters", decl({ padding: p.filterBar?.padding, "border-radius": px(p.filterBar?.radius) })],
|
|
1962
2001
|
[".ds-chart-legend", decl({ gap: px(p.legend?.gap) })],
|
|
1963
2002
|
[
|
|
@@ -2030,54 +2069,6 @@ function defineWidget(def) {
|
|
|
2030
2069
|
return def;
|
|
2031
2070
|
}
|
|
2032
2071
|
|
|
2033
|
-
// src/widgets/shared/format.ts
|
|
2034
|
-
var field = (row, path) => path === void 0 ? row : getPath(row, path);
|
|
2035
|
-
var toNumber = (v) => {
|
|
2036
|
-
if (typeof v === "number") return Number.isFinite(v) ? v : void 0;
|
|
2037
|
-
if (typeof v === "string" && v.trim() !== "" && !Number.isNaN(Number(v))) return Number(v);
|
|
2038
|
-
return void 0;
|
|
2039
|
-
};
|
|
2040
|
-
function formatValue(v, h, format = "number", decimals) {
|
|
2041
|
-
if (v === null || v === void 0 || v === "") return "\u2013";
|
|
2042
|
-
switch (format) {
|
|
2043
|
-
case "text":
|
|
2044
|
-
return String(v);
|
|
2045
|
-
case "compact":
|
|
2046
|
-
return h.fmt.compact(v);
|
|
2047
|
-
case "percent":
|
|
2048
|
-
return h.fmt.percent(v, decimals ?? 0);
|
|
2049
|
-
case "duration":
|
|
2050
|
-
return h.fmt.duration(v);
|
|
2051
|
-
case "date":
|
|
2052
|
-
return h.fmt.date(v, "date");
|
|
2053
|
-
case "datetime":
|
|
2054
|
-
return h.fmt.date(v, "datetime");
|
|
2055
|
-
case "time":
|
|
2056
|
-
return h.fmt.date(v, "time");
|
|
2057
|
-
default: {
|
|
2058
|
-
const n = toNumber(v);
|
|
2059
|
-
return n === void 0 ? String(v) : h.fmt.number(n, decimals);
|
|
2060
|
-
}
|
|
2061
|
-
}
|
|
2062
|
-
}
|
|
2063
|
-
var tone = (t) => {
|
|
2064
|
-
const k = t && ["good", "warn", "bad", "neutral", "info"].includes(t) ? t : "neutral";
|
|
2065
|
-
return {
|
|
2066
|
-
fg: `var(--ds-color-status-${k}-fg)`,
|
|
2067
|
-
bg: `var(--ds-color-status-${k}-bg)`,
|
|
2068
|
-
border: `var(--ds-color-status-${k}-border)`,
|
|
2069
|
-
solid: `var(--ds-color-status-${k}-solid)`
|
|
2070
|
-
};
|
|
2071
|
-
};
|
|
2072
|
-
var asRows = (data) => Array.isArray(data) ? data : data && typeof data === "object" ? [data] : [];
|
|
2073
|
-
function deepMerge(base, extra) {
|
|
2074
|
-
if (!extra || typeof extra !== "object" || Array.isArray(extra)) return extra ?? base;
|
|
2075
|
-
if (!base || typeof base !== "object" || Array.isArray(base)) return extra;
|
|
2076
|
-
const out = { ...base };
|
|
2077
|
-
for (const [k, v] of Object.entries(extra)) out[k] = k in out ? deepMerge(out[k], v) : v;
|
|
2078
|
-
return out;
|
|
2079
|
-
}
|
|
2080
|
-
|
|
2081
2072
|
// src/widgets/builtins/Breakdown.tsx
|
|
2082
2073
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
2083
2074
|
var Breakdown = defineWidget({
|
|
@@ -2105,7 +2096,7 @@ var Breakdown = defineWidget({
|
|
|
2105
2096
|
const t = items[i]?.tone;
|
|
2106
2097
|
return t ? `var(--ds-color-status-${t}-solid)` : `var(--ds-series-${i % 8 + 1})`;
|
|
2107
2098
|
};
|
|
2108
|
-
const fmt = (
|
|
2099
|
+
const fmt = (v2) => `${formatValue(v2, helpers, spec.format, spec.decimals)}${spec.unit ? ` ${spec.unit}` : ""}`;
|
|
2109
2100
|
const on = (i, type) => emit(type, "item", { datum: items[i]?.row, value: items[i]?.value, x: items[i]?.label, index: i });
|
|
2110
2101
|
if (spec.mode === "donut") {
|
|
2111
2102
|
let acc = 0;
|
|
@@ -2317,7 +2308,8 @@ var Container = defineWidget({
|
|
|
2317
2308
|
gap: spec.gap,
|
|
2318
2309
|
justifyContent: JUSTIFY[spec.justify],
|
|
2319
2310
|
alignItems: ALIGN[spec.align],
|
|
2320
|
-
|
|
2311
|
+
// An equal split is across a row; in a column, children keep their own height.
|
|
2312
|
+
["--ds-child-flex"]: spec.equal && spec.direction === "row" ? `1 1 ${spec.childMinWidth}px` : "0 0 auto",
|
|
2321
2313
|
["--ds-child-min"]: `${spec.direction === "row" ? spec.childMinWidth : 0}px`,
|
|
2322
2314
|
overflow: spec.scroll ? "auto" : "visible"
|
|
2323
2315
|
};
|
|
@@ -2721,7 +2713,7 @@ function SelectControl({
|
|
|
2721
2713
|
{
|
|
2722
2714
|
id,
|
|
2723
2715
|
options,
|
|
2724
|
-
isSelected: (
|
|
2716
|
+
isSelected: (v2) => v2 === value,
|
|
2725
2717
|
onPick: (o) => {
|
|
2726
2718
|
onChange(o.value);
|
|
2727
2719
|
p.setOpen(false);
|
|
@@ -2794,7 +2786,7 @@ function MultiSelectControl({
|
|
|
2794
2786
|
id,
|
|
2795
2787
|
multiple: true,
|
|
2796
2788
|
options,
|
|
2797
|
-
isSelected: (
|
|
2789
|
+
isSelected: (v2) => chosen.includes(v2),
|
|
2798
2790
|
onPick: (o) => onChange(chosen.includes(o.value) ? chosen.filter((x) => x !== o.value) : [...chosen, o.value])
|
|
2799
2791
|
}
|
|
2800
2792
|
),
|
|
@@ -3096,7 +3088,7 @@ function DateControl({
|
|
|
3096
3088
|
max,
|
|
3097
3089
|
locale,
|
|
3098
3090
|
single: true,
|
|
3099
|
-
onChange: (
|
|
3091
|
+
onChange: (v2) => v2.from && onChange(v2.from)
|
|
3100
3092
|
}
|
|
3101
3093
|
);
|
|
3102
3094
|
if (!stepper) return control;
|
|
@@ -3194,9 +3186,9 @@ function ControlField({
|
|
|
3194
3186
|
const label = def.label;
|
|
3195
3187
|
const locale = runtime.doc.spec.display.locale;
|
|
3196
3188
|
const bound = (key) => {
|
|
3197
|
-
const
|
|
3198
|
-
if (typeof
|
|
3199
|
-
const r =
|
|
3189
|
+
const v2 = def[key];
|
|
3190
|
+
if (typeof v2 !== "string") return void 0;
|
|
3191
|
+
const r = v2 === "today" ? runtime.helpers.today() : interpolate(v2, rootScope(runtime.getTree(), runtime.helpers));
|
|
3200
3192
|
return typeof r === "number" ? new Date(r).toISOString().slice(0, 10) : r || void 0;
|
|
3201
3193
|
};
|
|
3202
3194
|
const [text2, setText] = useState2(typeof value === "string" ? value : "");
|
|
@@ -3211,10 +3203,10 @@ function ControlField({
|
|
|
3211
3203
|
onChange,
|
|
3212
3204
|
options,
|
|
3213
3205
|
text: text2,
|
|
3214
|
-
setText: (
|
|
3215
|
-
setText(
|
|
3206
|
+
setText: (v2) => {
|
|
3207
|
+
setText(v2);
|
|
3216
3208
|
clearTimeout(timer.current);
|
|
3217
|
-
timer.current = setTimeout(() => onChange(
|
|
3209
|
+
timer.current = setTimeout(() => onChange(v2), def.debounce ? parseDuration(def.debounce) : 300);
|
|
3218
3210
|
},
|
|
3219
3211
|
min: bound("min"),
|
|
3220
3212
|
max: bound("max"),
|
|
@@ -3253,7 +3245,7 @@ function ControlField({
|
|
|
3253
3245
|
max: bound("max"),
|
|
3254
3246
|
maxDays: def.maxDays,
|
|
3255
3247
|
locale,
|
|
3256
|
-
onChange: (
|
|
3248
|
+
onChange: (v2) => onChange(v2),
|
|
3257
3249
|
onReject: (m) => runtime.runAction({ do: "toast", message: m, tone: "warn" })
|
|
3258
3250
|
}
|
|
3259
3251
|
);
|
|
@@ -3287,7 +3279,7 @@ function ControlField({
|
|
|
3287
3279
|
case "Chips": {
|
|
3288
3280
|
const multi = Boolean(def.multiple);
|
|
3289
3281
|
const chosen = multi ? Array.isArray(value) ? value : [] : [value];
|
|
3290
|
-
const toggle = (
|
|
3282
|
+
const toggle = (v2) => multi ? onChange(chosen.includes(v2) ? chosen.filter((x) => x !== v2) : [...chosen, v2]) : onChange(value === v2 ? null : v2);
|
|
3291
3283
|
return (
|
|
3292
3284
|
// biome-ignore lint/a11y/useSemanticElements: a chip group, not a form fieldset
|
|
3293
3285
|
/* @__PURE__ */ jsx8("div", { className: "ds-chips", role: "group", "aria-label": label ?? String(def.name), children: options.map((o, k) => /* @__PURE__ */ jsxs6(
|
|
@@ -3323,8 +3315,8 @@ function ControlField({
|
|
|
3323
3315
|
onChange: (e) => {
|
|
3324
3316
|
setText(e.target.value);
|
|
3325
3317
|
clearTimeout(timer.current);
|
|
3326
|
-
const
|
|
3327
|
-
timer.current = setTimeout(() => onChange(
|
|
3318
|
+
const v2 = e.target.value;
|
|
3319
|
+
timer.current = setTimeout(() => onChange(v2), wait);
|
|
3328
3320
|
}
|
|
3329
3321
|
}
|
|
3330
3322
|
)
|
|
@@ -3456,8 +3448,8 @@ function FilterBar() {
|
|
|
3456
3448
|
filters: t.filters,
|
|
3457
3449
|
view: t.view,
|
|
3458
3450
|
visible: variables.filter(
|
|
3459
|
-
(
|
|
3460
|
-
).map((
|
|
3451
|
+
(v2) => typeof v2.visibleWhen !== "string" || Boolean(evaluateSafe(v2.visibleWhen, rootScope(t, runtime.helpers), true))
|
|
3452
|
+
).map((v2) => v2.name).join("\0")
|
|
3461
3453
|
}),
|
|
3462
3454
|
[variables, runtime]
|
|
3463
3455
|
),
|
|
@@ -3466,22 +3458,22 @@ function FilterBar() {
|
|
|
3466
3458
|
const visibleNames = new Set(state.visible.split("\0"));
|
|
3467
3459
|
const [draft, setDraft] = useState2(null);
|
|
3468
3460
|
const bar = runtime.doc.spec.display.filterBar ?? {};
|
|
3469
|
-
const applyMode = (
|
|
3470
|
-
const needsApply = variables.some((
|
|
3461
|
+
const applyMode = (v2) => v2.apply === "button" ? "button" : v2.apply === "immediate" ? "change" : bar.apply ?? "change";
|
|
3462
|
+
const needsApply = variables.some((v2) => applyMode(v2) === "button");
|
|
3471
3463
|
const defaults = () => Object.fromEntries(
|
|
3472
|
-
variables.map((
|
|
3473
|
-
|
|
3474
|
-
initialFilterValue(
|
|
3464
|
+
variables.map((v2) => [
|
|
3465
|
+
v2.name,
|
|
3466
|
+
initialFilterValue(v2, { ...runtime.doc.spec.display, now: runtime.helpers.now })
|
|
3475
3467
|
])
|
|
3476
3468
|
);
|
|
3477
3469
|
const start = defaults();
|
|
3478
|
-
const changed = (
|
|
3470
|
+
const changed = (v2) => JSON.stringify(state.filters[v2.name]) !== JSON.stringify(start[v2.name]);
|
|
3479
3471
|
const isDefault = !variables.some(changed);
|
|
3480
3472
|
const placed = new Set(
|
|
3481
3473
|
Object.values(runtime.doc.spec.panels).filter((p) => p.kind === "Filter").map((p) => p.spec?.variable)
|
|
3482
3474
|
);
|
|
3483
3475
|
const shown = variables.filter(
|
|
3484
|
-
(
|
|
3476
|
+
(v2) => !v2.hidden && !placed.has(v2.name) && visibleNames.has(v2.name)
|
|
3485
3477
|
);
|
|
3486
3478
|
if (shown.length === 0 || bar.show === false) return null;
|
|
3487
3479
|
const values = { ...state.filters, ...draft };
|
|
@@ -3491,16 +3483,16 @@ function FilterBar() {
|
|
|
3491
3483
|
const layouts = runtime.doc.spec.layouts ?? [];
|
|
3492
3484
|
const views = [];
|
|
3493
3485
|
for (const l of layouts)
|
|
3494
|
-
if (l.view && !views.some((
|
|
3495
|
-
const byName = new Map(variables.map((
|
|
3486
|
+
if (l.view && !views.some((v2) => v2.name === l.view)) views.push({ name: l.view, label: l.label ?? l.view });
|
|
3487
|
+
const byName = new Map(variables.map((v2) => [v2.name, v2]));
|
|
3496
3488
|
return /* @__PURE__ */ jsx8(
|
|
3497
3489
|
Custom,
|
|
3498
3490
|
{
|
|
3499
|
-
filters: shown.map((
|
|
3500
|
-
name:
|
|
3501
|
-
kind:
|
|
3502
|
-
...typeof
|
|
3503
|
-
config:
|
|
3491
|
+
filters: shown.map((v2) => ({
|
|
3492
|
+
name: v2.name,
|
|
3493
|
+
kind: v2.kind,
|
|
3494
|
+
...typeof v2.label === "string" ? { label: v2.label } : {},
|
|
3495
|
+
config: v2
|
|
3504
3496
|
})),
|
|
3505
3497
|
values,
|
|
3506
3498
|
setFilter: (name, value) => runtime.store.dispatch(stateActions.setFilter({ name, value })),
|
|
@@ -3544,32 +3536,32 @@ function FilterBar() {
|
|
|
3544
3536
|
/* @__PURE__ */ jsxs6(Track, { segmented: bar.look === "segmented", children: [
|
|
3545
3537
|
bar.icon !== "none" && /* @__PURE__ */ jsx8("span", { className: "ds-filters-icon", "aria-hidden": "true", children: options.ui?.icons?.filterBar ?? BAR_ICONS[bar.icon ?? "sliders"] ?? BAR_ICONS.sliders }),
|
|
3546
3538
|
shown.map(
|
|
3547
|
-
(
|
|
3539
|
+
(v2) => options.onFilterSelect ? (
|
|
3548
3540
|
// Builder: a click selects the filter to configure it instead of opening it.
|
|
3549
3541
|
/* @__PURE__ */ jsx8(
|
|
3550
3542
|
"div",
|
|
3551
3543
|
{
|
|
3552
3544
|
className: "ds-filter-pick",
|
|
3553
|
-
"data-selected": options.selectedFilter ===
|
|
3554
|
-
onPointerDownCapture: () => options.onFilterSelect?.(
|
|
3545
|
+
"data-selected": options.selectedFilter === v2.name || void 0,
|
|
3546
|
+
onPointerDownCapture: () => options.onFilterSelect?.(v2.name),
|
|
3555
3547
|
onClickCapture: (e) => {
|
|
3556
3548
|
e.preventDefault();
|
|
3557
3549
|
e.stopPropagation();
|
|
3558
3550
|
},
|
|
3559
|
-
children: /* @__PURE__ */ jsx8(ControlField, { compact: true, def:
|
|
3551
|
+
children: /* @__PURE__ */ jsx8(ControlField, { compact: true, def: v2, value: values[v2.name], onChange: () => {
|
|
3560
3552
|
} })
|
|
3561
3553
|
},
|
|
3562
|
-
|
|
3554
|
+
v2.name
|
|
3563
3555
|
)
|
|
3564
3556
|
) : /* @__PURE__ */ jsx8(
|
|
3565
3557
|
ControlField,
|
|
3566
3558
|
{
|
|
3567
3559
|
compact: true,
|
|
3568
|
-
def:
|
|
3569
|
-
value: values[
|
|
3570
|
-
onChange: (val) => set(
|
|
3560
|
+
def: v2,
|
|
3561
|
+
value: values[v2.name],
|
|
3562
|
+
onChange: (val) => set(v2.name, val, applyMode(v2) === "change")
|
|
3571
3563
|
},
|
|
3572
|
-
|
|
3564
|
+
v2.name
|
|
3573
3565
|
)
|
|
3574
3566
|
)
|
|
3575
3567
|
] }),
|
|
@@ -3685,7 +3677,7 @@ var Filter = defineWidget({
|
|
|
3685
3677
|
defaults: { variable: "" },
|
|
3686
3678
|
component: function FilterWidget({ spec, mode }) {
|
|
3687
3679
|
const { runtime } = useDashboard();
|
|
3688
|
-
const def = (runtime.doc.spec.variables ?? []).find((
|
|
3680
|
+
const def = (runtime.doc.spec.variables ?? []).find((v2) => v2.name === spec.variable);
|
|
3689
3681
|
const state = useTree(
|
|
3690
3682
|
useCallback3((t) => ({ value: t.filters[spec.variable], tree: t }), [spec.variable]),
|
|
3691
3683
|
(a, b) => a.value === b.value && a.tree.view === b.tree.view && a.tree.filters === b.tree.filters
|
|
@@ -3706,21 +3698,69 @@ var Filter = defineWidget({
|
|
|
3706
3698
|
}
|
|
3707
3699
|
});
|
|
3708
3700
|
|
|
3709
|
-
// src/widgets/
|
|
3710
|
-
import "
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
function
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3701
|
+
// src/widgets/wrap.tsx
|
|
3702
|
+
import { Suspense, lazy } from "react";
|
|
3703
|
+
import { z as z6 } from "zod";
|
|
3704
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
3705
|
+
function wrapComponent(Component2, o) {
|
|
3706
|
+
const schema = o.schema ?? z6.record(z6.unknown());
|
|
3707
|
+
const eventNames = [...new Set(Object.values(o.events ?? {}))];
|
|
3708
|
+
return defineWidget({
|
|
3709
|
+
kind: o.kind,
|
|
3710
|
+
version: o.version ?? 1,
|
|
3711
|
+
meta: o.meta,
|
|
3712
|
+
schema,
|
|
3713
|
+
...o.defaults ? { defaults: o.defaults } : {},
|
|
3714
|
+
...o.implements ? { implements: o.implements } : {},
|
|
3715
|
+
...o.exposes ? { exposes: o.exposes } : {},
|
|
3716
|
+
...o.frame ? { frame: o.frame } : {},
|
|
3717
|
+
...o.small ? { small: true } : {},
|
|
3718
|
+
events: eventNames,
|
|
3719
|
+
...o.slots ? { slots: Object.fromEntries(Object.values(o.slots).map((s) => [s, { label: s }])) } : {},
|
|
3720
|
+
component: function Wrapped(props) {
|
|
3721
|
+
const mapped = o.mapProps ? o.mapProps(props) : { ...props.spec, data: props.data };
|
|
3722
|
+
const handlers = {};
|
|
3723
|
+
for (const [prop, event] of Object.entries(o.events ?? {}))
|
|
3724
|
+
handlers[prop] = (value, ...rest) => props.emit(event, void 0, { value, args: [value, ...rest] });
|
|
3725
|
+
for (const [prop, path] of Object.entries(o.writes ?? {})) {
|
|
3726
|
+
const before = handlers[prop];
|
|
3727
|
+
handlers[prop] = (value, ...rest) => {
|
|
3728
|
+
props.store.set(path, value);
|
|
3729
|
+
before?.(value, ...rest);
|
|
3730
|
+
};
|
|
3731
|
+
}
|
|
3732
|
+
const slotProps = {};
|
|
3733
|
+
for (const [prop, slot] of Object.entries(o.slots ?? {})) slotProps[prop] = props.renderSlot(slot);
|
|
3734
|
+
return /* @__PURE__ */ jsx10(Component2, { ...mapped, ...handlers, ...slotProps });
|
|
3735
|
+
}
|
|
3736
|
+
});
|
|
3737
|
+
}
|
|
3738
|
+
function lazyWidget(def) {
|
|
3739
|
+
const { load, fallback, ...rest } = def;
|
|
3740
|
+
let Comp;
|
|
3741
|
+
return defineWidget({
|
|
3742
|
+
...rest,
|
|
3743
|
+
component: function LazyWidget(props) {
|
|
3744
|
+
Comp ??= lazy(load);
|
|
3745
|
+
return /* @__PURE__ */ jsx10(Suspense, { fallback: fallback ?? /* @__PURE__ */ jsx10("div", { className: "ds-skeleton", "aria-busy": "true" }), children: /* @__PURE__ */ jsx10(Comp, { ...props }) });
|
|
3746
|
+
}
|
|
3747
|
+
});
|
|
3720
3748
|
}
|
|
3721
3749
|
|
|
3750
|
+
// src/widgets/builtins/FlowMap.tsx
|
|
3751
|
+
var FlowMap = lazyWidget({
|
|
3752
|
+
...FlowMapContract,
|
|
3753
|
+
implements: "flow-map",
|
|
3754
|
+
exposes: { selection: "the clicked step's row" },
|
|
3755
|
+
meta: { label: "Flow map", icon: "flow", category: "Process", size: { w: 12, h: 12, minW: 6, minH: 6 } },
|
|
3756
|
+
events: ["click", "hover", "hoverEnd"],
|
|
3757
|
+
parts: ["step", "chip", "tag"],
|
|
3758
|
+
load: () => import("./FlowMapView-BSTKU7D4.js").then((m) => ({ default: m.FlowMapView }))
|
|
3759
|
+
});
|
|
3760
|
+
|
|
3722
3761
|
// src/widgets/builtins/Image.tsx
|
|
3723
|
-
import
|
|
3762
|
+
import "zod";
|
|
3763
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
3724
3764
|
var Image = defineWidget({
|
|
3725
3765
|
...ImageContract,
|
|
3726
3766
|
implements: "image",
|
|
@@ -3728,15 +3768,15 @@ var Image = defineWidget({
|
|
|
3728
3768
|
events: ["click"],
|
|
3729
3769
|
component: function ImageWidget({ spec, data, emit }) {
|
|
3730
3770
|
const src = safeImageSrc(spec.src ?? field(data, spec.srcField) ?? (typeof data === "string" ? data : void 0));
|
|
3731
|
-
if (!src) return /* @__PURE__ */
|
|
3732
|
-
return /* @__PURE__ */
|
|
3771
|
+
if (!src) return /* @__PURE__ */ jsx11("div", { className: "ds-state", children: "No image" });
|
|
3772
|
+
return /* @__PURE__ */ jsx11(
|
|
3733
3773
|
"button",
|
|
3734
3774
|
{
|
|
3735
3775
|
type: "button",
|
|
3736
3776
|
className: "ds-plain",
|
|
3737
3777
|
onClick: () => emit("click", "image", { value: src }),
|
|
3738
3778
|
style: { width: "100%", height: "100%" },
|
|
3739
|
-
children: /* @__PURE__ */
|
|
3779
|
+
children: /* @__PURE__ */ jsx11("img", { src, alt: spec.alt, style: { width: "100%", height: "100%", objectFit: spec.fit } })
|
|
3740
3780
|
}
|
|
3741
3781
|
);
|
|
3742
3782
|
}
|
|
@@ -3744,7 +3784,7 @@ var Image = defineWidget({
|
|
|
3744
3784
|
|
|
3745
3785
|
// src/widgets/builtins/ImageMap.tsx
|
|
3746
3786
|
import "zod";
|
|
3747
|
-
import { jsx as
|
|
3787
|
+
import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
3748
3788
|
var ImageMap = defineWidget({
|
|
3749
3789
|
...ImageMapContract,
|
|
3750
3790
|
implements: "image-map",
|
|
@@ -3763,7 +3803,7 @@ var ImageMap = defineWidget({
|
|
|
3763
3803
|
})) : [];
|
|
3764
3804
|
const src = safeImageSrc(spec.src);
|
|
3765
3805
|
return /* @__PURE__ */ jsxs7("div", { className: "ds-imagemap", children: [
|
|
3766
|
-
src && /* @__PURE__ */
|
|
3806
|
+
src && /* @__PURE__ */ jsx12("img", { src, alt: spec.alt }),
|
|
3767
3807
|
markers.map((mk, i) => {
|
|
3768
3808
|
const t = mk.status ? spec.statusMap?.[mk.status] ?? mk.status : "info";
|
|
3769
3809
|
return /* @__PURE__ */ jsxs7(
|
|
@@ -3802,7 +3842,7 @@ import "zod";
|
|
|
3802
3842
|
// src/widgets/shared/InfoTip.tsx
|
|
3803
3843
|
import { useEffect as useEffect3, useLayoutEffect as useLayoutEffect2, useRef as useRef4, useState as useState3 } from "react";
|
|
3804
3844
|
import { createPortal as createPortal2 } from "react-dom";
|
|
3805
|
-
import { jsx as
|
|
3845
|
+
import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
3806
3846
|
function InfoTip({ text: text2 }) {
|
|
3807
3847
|
const ref = useRef4(null);
|
|
3808
3848
|
const tip = useRef4(null);
|
|
@@ -3855,11 +3895,11 @@ function InfoTip({ text: text2 }) {
|
|
|
3855
3895
|
onBlur: hide,
|
|
3856
3896
|
children: [
|
|
3857
3897
|
/* @__PURE__ */ jsxs8("svg", { viewBox: "0 0 16 16", width: "14", height: "14", "aria-hidden": "true", children: [
|
|
3858
|
-
/* @__PURE__ */
|
|
3859
|
-
/* @__PURE__ */
|
|
3898
|
+
/* @__PURE__ */ jsx13("circle", { cx: "8", cy: "8", r: "6.5", fill: "none", stroke: "currentColor", strokeWidth: "1" }),
|
|
3899
|
+
/* @__PURE__ */ jsx13("path", { d: "M8 7.2v3.6M8 5.2v.1", stroke: "currentColor", strokeWidth: "1.2", strokeLinecap: "round" })
|
|
3860
3900
|
] }),
|
|
3861
3901
|
mounted && root && createPortal2(
|
|
3862
|
-
/* @__PURE__ */
|
|
3902
|
+
/* @__PURE__ */ jsx13(
|
|
3863
3903
|
"span",
|
|
3864
3904
|
{
|
|
3865
3905
|
ref: tip,
|
|
@@ -3945,7 +3985,7 @@ var Boundary = class extends Component {
|
|
|
3945
3985
|
|
|
3946
3986
|
// src/components/Slot.tsx
|
|
3947
3987
|
import { createContext as createContext3, useContext as useContext4 } from "react";
|
|
3948
|
-
import { Fragment as Fragment5, jsx as
|
|
3988
|
+
import { Fragment as Fragment5, jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3949
3989
|
var NodeScopeContext = createContext3({});
|
|
3950
3990
|
var useNodeScope = () => useContext4(NodeScopeContext);
|
|
3951
3991
|
var SlotOwnerContext = createContext3(null);
|
|
@@ -3981,7 +4021,7 @@ function Slot({
|
|
|
3981
4021
|
item: item !== void 0 ? item : outer.item,
|
|
3982
4022
|
index: index !== void 0 ? index : outer.index
|
|
3983
4023
|
};
|
|
3984
|
-
return /* @__PURE__ */
|
|
4024
|
+
return /* @__PURE__ */ jsx14(NodeScopeContext.Provider, { value: scope2, children: /* @__PURE__ */ jsxs9(
|
|
3985
4025
|
"div",
|
|
3986
4026
|
{
|
|
3987
4027
|
className: className ? `ds-slot ${className}` : "ds-slot",
|
|
@@ -3990,16 +4030,16 @@ function Slot({
|
|
|
3990
4030
|
"data-owner": owner.id,
|
|
3991
4031
|
"data-empty": ids.length === 0 || void 0,
|
|
3992
4032
|
children: [
|
|
3993
|
-
ids.map((id) => /* @__PURE__ */
|
|
3994
|
-
ids.length === 0 && editing && (empty ?? /* @__PURE__ */
|
|
4033
|
+
ids.map((id) => /* @__PURE__ */ jsx14(SlotItem, { children: renderChild(id) }, id)),
|
|
4034
|
+
ids.length === 0 && editing && (empty ?? /* @__PURE__ */ jsx14("span", { className: "ds-slot-hint", children: "Drop here" }))
|
|
3995
4035
|
]
|
|
3996
4036
|
}
|
|
3997
4037
|
) });
|
|
3998
4038
|
}
|
|
3999
|
-
var SlotItem = ({ children }) => /* @__PURE__ */
|
|
4039
|
+
var SlotItem = ({ children }) => /* @__PURE__ */ jsx14(Fragment5, { children });
|
|
4000
4040
|
|
|
4001
4041
|
// src/components/PanelFrame.tsx
|
|
4002
|
-
import { jsx as
|
|
4042
|
+
import { jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
4003
4043
|
var isEmpty = (d) => d === void 0 || d === null || Array.isArray(d) && d.length === 0 || typeof d === "object" && !Array.isArray(d) && Object.keys(d).length === 0;
|
|
4004
4044
|
function useSize() {
|
|
4005
4045
|
const [size2, setSize] = useState4({ width: 0, height: 0 });
|
|
@@ -4022,32 +4062,32 @@ function useSize() {
|
|
|
4022
4062
|
}
|
|
4023
4063
|
var DEFERRED = /(^|[^\w.$])(row|item|avg)\b/;
|
|
4024
4064
|
var DEFERRED_IN_ITEM = /(^|[^\w.$])(row|avg)\b/;
|
|
4025
|
-
function interpolateMarkdown(
|
|
4026
|
-
const bodies = placeholders(
|
|
4027
|
-
const whole = bodies.length === 1 &&
|
|
4028
|
-
const r = interpolate(
|
|
4065
|
+
function interpolateMarkdown(v2, scope2) {
|
|
4066
|
+
const bodies = placeholders(v2);
|
|
4067
|
+
const whole = bodies.length === 1 && v2.trim() === `\${${bodies[0]}}`;
|
|
4068
|
+
const r = interpolate(v2, scope2, escapeMarkdown);
|
|
4029
4069
|
if (!whole) return r;
|
|
4030
4070
|
return r === null || r === void 0 ? "" : escapeMarkdown(typeof r === "object" ? JSON.stringify(r) : String(r));
|
|
4031
4071
|
}
|
|
4032
|
-
function resolvePanel(
|
|
4072
|
+
function resolvePanel(v2, scope2, inItem = false, key) {
|
|
4033
4073
|
const deferred = inItem ? DEFERRED_IN_ITEM : DEFERRED;
|
|
4034
|
-
if (typeof
|
|
4035
|
-
if (placeholders(
|
|
4036
|
-
return key === "markdown" ? interpolateMarkdown(
|
|
4074
|
+
if (typeof v2 === "string") {
|
|
4075
|
+
if (placeholders(v2).some((b) => deferred.test(stripStrings(b)))) return v2;
|
|
4076
|
+
return key === "markdown" ? interpolateMarkdown(v2, scope2) : interpolate(v2, scope2);
|
|
4037
4077
|
}
|
|
4038
|
-
if (Array.isArray(
|
|
4039
|
-
if (
|
|
4040
|
-
return Object.fromEntries(Object.entries(
|
|
4041
|
-
return
|
|
4042
|
-
}
|
|
4043
|
-
function withFunctions(
|
|
4044
|
-
if (Array.isArray(
|
|
4045
|
-
if (
|
|
4046
|
-
const o =
|
|
4078
|
+
if (Array.isArray(v2)) return v2.map((x) => resolvePanel(x, scope2, inItem));
|
|
4079
|
+
if (v2 && typeof v2 === "object")
|
|
4080
|
+
return Object.fromEntries(Object.entries(v2).map(([k, x]) => [k, resolvePanel(x, scope2, inItem, k)]));
|
|
4081
|
+
return v2;
|
|
4082
|
+
}
|
|
4083
|
+
function withFunctions(v2, make) {
|
|
4084
|
+
if (Array.isArray(v2)) return v2.map((x) => withFunctions(x, make));
|
|
4085
|
+
if (v2 && typeof v2 === "object") {
|
|
4086
|
+
const o = v2;
|
|
4047
4087
|
if (typeof o.fn === "string" && Object.keys(o).length === 1) return make(o.fn);
|
|
4048
4088
|
return Object.fromEntries(Object.entries(o).map(([k, x]) => [k, withFunctions(x, make)]));
|
|
4049
4089
|
}
|
|
4050
|
-
return
|
|
4090
|
+
return v2;
|
|
4051
4091
|
}
|
|
4052
4092
|
var SHADOWS = {
|
|
4053
4093
|
none: "none",
|
|
@@ -4056,12 +4096,12 @@ var SHADOWS = {
|
|
|
4056
4096
|
lg: "0 14px 36px rgba(13, 13, 13, 0.14)"
|
|
4057
4097
|
};
|
|
4058
4098
|
var PADDING = { none: "0", compact: "8px", roomy: "24px" };
|
|
4059
|
-
var colour = (
|
|
4060
|
-
if (typeof
|
|
4061
|
-
if (/^[a-z]+(-[a-z]+)+$/.test(
|
|
4062
|
-
return /^(#[0-9a-f]{3,8}|rgba?\([\d\s.,%]+\)|hsla?\([\d\s.,%deg]+\)|[a-z]+)$/i.test(
|
|
4099
|
+
var colour = (v2) => {
|
|
4100
|
+
if (typeof v2 !== "string" || !v2) return void 0;
|
|
4101
|
+
if (/^[a-z]+(-[a-z]+)+$/.test(v2) && !v2.includes("(")) return `var(--ds-color-${v2})`;
|
|
4102
|
+
return /^(#[0-9a-f]{3,8}|rgba?\([\d\s.,%]+\)|hsla?\([\d\s.,%deg]+\)|[a-z]+)$/i.test(v2) ? v2 : void 0;
|
|
4063
4103
|
};
|
|
4064
|
-
var size = (
|
|
4104
|
+
var size = (v2) => typeof v2 === "number" ? `${v2}px` : typeof v2 === "string" && /^[\d.]+(px|%|rem|em|vw)?$/.test(v2) ? v2 : void 0;
|
|
4065
4105
|
var PART_CLASSES = [
|
|
4066
4106
|
[".ds-panel-title, .ds-kpi-label", "title"],
|
|
4067
4107
|
[".ds-info", "info"],
|
|
@@ -4211,7 +4251,7 @@ function dropIndexAt(panel, x, y) {
|
|
|
4211
4251
|
return { slot: box.getAttribute("data-slot") ?? void 0, index: indexIn(box, x, y) };
|
|
4212
4252
|
}
|
|
4213
4253
|
function PanelFrame({ id, nested = false }) {
|
|
4214
|
-
return /* @__PURE__ */
|
|
4254
|
+
return /* @__PURE__ */ jsx15(Boundary, { resetKeys: [id], fallback: (e) => /* @__PURE__ */ jsx15(PanelCrash, { id, error: e }), children: /* @__PURE__ */ jsx15(PanelFrameInner, { id, nested }) });
|
|
4215
4255
|
}
|
|
4216
4256
|
function PanelCrash({ id, error }) {
|
|
4217
4257
|
const { options } = useDashboard();
|
|
@@ -4221,7 +4261,7 @@ function PanelCrash({ id, error }) {
|
|
|
4221
4261
|
} catch {
|
|
4222
4262
|
custom = void 0;
|
|
4223
4263
|
}
|
|
4224
|
-
return /* @__PURE__ */
|
|
4264
|
+
return /* @__PURE__ */ jsx15("section", { className: "ds-panel", "data-panel": id, "aria-label": id, children: /* @__PURE__ */ jsx15("div", { className: "ds-panel-body", children: custom ?? /* @__PURE__ */ jsxs10("div", { className: "ds-state ds-state-error", role: "alert", children: [
|
|
4225
4265
|
"This panel could not be shown: ",
|
|
4226
4266
|
error.message
|
|
4227
4267
|
] }) }) });
|
|
@@ -4308,7 +4348,7 @@ function PanelFrameInner({ id, nested }) {
|
|
|
4308
4348
|
),
|
|
4309
4349
|
samePanelView
|
|
4310
4350
|
);
|
|
4311
|
-
const renderNested = useCallback4((child) => /* @__PURE__ */
|
|
4351
|
+
const renderNested = useCallback4((child) => /* @__PURE__ */ jsx15(PanelFrame, { id: child, nested: true }, child), []);
|
|
4312
4352
|
const store = useMemo3(() => widgetStore(runtime), [runtime]);
|
|
4313
4353
|
const [bodyRef, size2] = useSize();
|
|
4314
4354
|
const frameRef = useRef5(null);
|
|
@@ -4399,14 +4439,14 @@ function PanelFrameInner({ id, nested }) {
|
|
|
4399
4439
|
"\u201D"
|
|
4400
4440
|
] });
|
|
4401
4441
|
else if (view.error && view.data === void 0)
|
|
4402
|
-
body = options.renderError?.(view.error, id) ?? /* @__PURE__ */
|
|
4442
|
+
body = options.renderError?.(view.error, id) ?? /* @__PURE__ */ jsx15("div", { className: "ds-state ds-state-error", role: "alert", children: view.messages?.error ?? view.error.message });
|
|
4403
4443
|
else if (view.source && view.data === void 0 && (view.status === "loading" || view.status === "idle"))
|
|
4404
|
-
body = options.renderLoading?.(id, loadingText(view.messages)) ?? /* @__PURE__ */
|
|
4444
|
+
body = options.renderLoading?.(id, loadingText(view.messages)) ?? /* @__PURE__ */ jsx15(LoadingState, { text: loadingText(view.messages) });
|
|
4405
4445
|
else if (view.source && isEmpty(view.data) && widget.empty !== "widget")
|
|
4406
|
-
body = options.renderEmpty?.(id) ?? /* @__PURE__ */
|
|
4446
|
+
body = options.renderEmpty?.(id) ?? /* @__PURE__ */ jsx15("div", { className: "ds-state", children: view.messages?.empty ?? "No data" });
|
|
4407
4447
|
else {
|
|
4408
4448
|
const W = widget.component;
|
|
4409
|
-
body = /* @__PURE__ */
|
|
4449
|
+
body = /* @__PURE__ */ jsx15(
|
|
4410
4450
|
Boundary,
|
|
4411
4451
|
{
|
|
4412
4452
|
resetKeys: [view.data, props],
|
|
@@ -4414,7 +4454,7 @@ function PanelFrameInner({ id, nested }) {
|
|
|
4414
4454
|
"This panel could not be shown: ",
|
|
4415
4455
|
e.message
|
|
4416
4456
|
] }),
|
|
4417
|
-
children: /* @__PURE__ */
|
|
4457
|
+
children: /* @__PURE__ */ jsx15(
|
|
4418
4458
|
W,
|
|
4419
4459
|
{
|
|
4420
4460
|
spec: props,
|
|
@@ -4430,7 +4470,7 @@ function PanelFrameInner({ id, nested }) {
|
|
|
4430
4470
|
mode: options.mode,
|
|
4431
4471
|
helpers: runtime.helpers,
|
|
4432
4472
|
panelId: id,
|
|
4433
|
-
renderSlot: (name, o) => /* @__PURE__ */
|
|
4473
|
+
renderSlot: (name, o) => /* @__PURE__ */ jsx15(Slot, { name, ...o }),
|
|
4434
4474
|
store
|
|
4435
4475
|
}
|
|
4436
4476
|
)
|
|
@@ -4447,7 +4487,7 @@ function PanelFrameInner({ id, nested }) {
|
|
|
4447
4487
|
const name = el?.getAttribute("data-slot") ?? defaultSlot;
|
|
4448
4488
|
return { slot: name, index: el ? indexIn(el, x, y) : void 0 };
|
|
4449
4489
|
};
|
|
4450
|
-
return /* @__PURE__ */
|
|
4490
|
+
return /* @__PURE__ */ jsx15(SlotOwnerContext.Provider, { value: { id, data: view.data, def }, children: /* @__PURE__ */ jsx15(SlotChildContext.Provider, { value: renderNested, children: /* @__PURE__ */ jsxs10(
|
|
4451
4491
|
"section",
|
|
4452
4492
|
{
|
|
4453
4493
|
ref: frameRef,
|
|
@@ -4500,15 +4540,15 @@ function PanelFrameInner({ id, nested }) {
|
|
|
4500
4540
|
/* @__PURE__ */ jsxs10("div", { style: { minWidth: 0 }, children: [
|
|
4501
4541
|
title && /* @__PURE__ */ jsxs10("h3", { className: "ds-panel-title", children: [
|
|
4502
4542
|
title,
|
|
4503
|
-
info && /* @__PURE__ */
|
|
4543
|
+
info && /* @__PURE__ */ jsx15(InfoTip, { text: info })
|
|
4504
4544
|
] }),
|
|
4505
|
-
subtitle && /* @__PURE__ */
|
|
4545
|
+
subtitle && /* @__PURE__ */ jsx15("p", { className: "ds-panel-subtitle", children: subtitle }),
|
|
4506
4546
|
drill.length > 0 && /* @__PURE__ */ jsxs10("nav", { className: "ds-crumbs", "aria-label": "Drill path", children: [
|
|
4507
|
-
/* @__PURE__ */
|
|
4547
|
+
/* @__PURE__ */ jsx15("button", { type: "button", onClick: () => runtime.runAction({ do: "drillReset", panel: id }), children: "All" }),
|
|
4508
4548
|
drill.map((d, i) => /* @__PURE__ */ jsxs10("span", { children: [
|
|
4509
4549
|
"\u203A",
|
|
4510
4550
|
" ",
|
|
4511
|
-
i < drill.length - 1 ? /* @__PURE__ */
|
|
4551
|
+
i < drill.length - 1 ? /* @__PURE__ */ jsx15(
|
|
4512
4552
|
"button",
|
|
4513
4553
|
{
|
|
4514
4554
|
type: "button",
|
|
@@ -4522,22 +4562,22 @@ function PanelFrameInner({ id, nested }) {
|
|
|
4522
4562
|
] })
|
|
4523
4563
|
] }),
|
|
4524
4564
|
/* @__PURE__ */ jsxs10("div", { className: "ds-panel-tools", children: [
|
|
4525
|
-
headerKids.length > 0 && /* @__PURE__ */
|
|
4526
|
-
meta2 && /* @__PURE__ */
|
|
4565
|
+
headerKids.length > 0 && /* @__PURE__ */ jsx15(Slot, { name: "header", className: "ds-panel-addons" }),
|
|
4566
|
+
meta2 && /* @__PURE__ */ jsx15("span", { className: "ds-panel-meta", children: meta2 }),
|
|
4527
4567
|
live2 ? /* @__PURE__ */ jsxs10("span", { className: "ds-live", "data-stale": view.stale || void 0, title: view.error?.message, children: [
|
|
4528
|
-
/* @__PURE__ */
|
|
4568
|
+
/* @__PURE__ */ jsx15("span", { "aria-hidden": "true" }),
|
|
4529
4569
|
liveLabel(props.liveText, view.updatedAt, runtime.helpers)
|
|
4530
|
-
] }) : view.stale && /* @__PURE__ */
|
|
4531
|
-
controls.map((c) => /* @__PURE__ */
|
|
4570
|
+
] }) : view.stale && /* @__PURE__ */ jsx15("span", { className: "ds-badge ds-badge-stale", title: view.error?.message, children: "Stale" }),
|
|
4571
|
+
controls.map((c) => /* @__PURE__ */ jsx15(
|
|
4532
4572
|
ControlField,
|
|
4533
4573
|
{
|
|
4534
4574
|
def: c,
|
|
4535
4575
|
compact: true,
|
|
4536
4576
|
value: view.panel.controls?.[c.name],
|
|
4537
|
-
onChange: (
|
|
4577
|
+
onChange: (v2) => runtime.store.dispatch(
|
|
4538
4578
|
stateActions.patchPanel({
|
|
4539
4579
|
id,
|
|
4540
|
-
patch: { controls: { ...view.panel.controls, [c.name]:
|
|
4580
|
+
patch: { controls: { ...view.panel.controls, [c.name]: v2 } }
|
|
4541
4581
|
})
|
|
4542
4582
|
)
|
|
4543
4583
|
},
|
|
@@ -4545,22 +4585,22 @@ function PanelFrameInner({ id, nested }) {
|
|
|
4545
4585
|
))
|
|
4546
4586
|
] })
|
|
4547
4587
|
] }),
|
|
4548
|
-
toolbarKids.length > 0 && /* @__PURE__ */
|
|
4549
|
-
/* @__PURE__ */
|
|
4550
|
-
footerKids.length > 0 && /* @__PURE__ */
|
|
4588
|
+
toolbarKids.length > 0 && /* @__PURE__ */ jsx15(Slot, { name: "toolbar", className: "ds-panel-toolbar" }),
|
|
4589
|
+
/* @__PURE__ */ jsx15("div", { className: "ds-panel-body", ref: bodyRef, children: body }),
|
|
4590
|
+
footerKids.length > 0 && /* @__PURE__ */ jsx15(Slot, { name: "footer", className: "ds-panel-foot" })
|
|
4551
4591
|
]
|
|
4552
4592
|
}
|
|
4553
4593
|
) }) });
|
|
4554
4594
|
}
|
|
4555
4595
|
function loadingText(messages) {
|
|
4556
|
-
const
|
|
4557
|
-
return
|
|
4596
|
+
const v2 = messages?.loading;
|
|
4597
|
+
return v2 === void 0 || v2 === null || v2 === "" ? void 0 : String(v2);
|
|
4558
4598
|
}
|
|
4559
4599
|
function LoadingState({ text: text2 }) {
|
|
4560
|
-
if (!text2) return /* @__PURE__ */
|
|
4600
|
+
if (!text2) return /* @__PURE__ */ jsx15("div", { className: "ds-skeleton", "aria-busy": "true", "aria-label": "Loading" });
|
|
4561
4601
|
return /* @__PURE__ */ jsxs10("output", { className: "ds-loading", "aria-busy": "true", children: [
|
|
4562
|
-
/* @__PURE__ */
|
|
4563
|
-
/* @__PURE__ */
|
|
4602
|
+
/* @__PURE__ */ jsx15("div", { className: "ds-skeleton", "aria-hidden": "true" }),
|
|
4603
|
+
/* @__PURE__ */ jsx15("span", { className: "ds-loading-text", children: text2 })
|
|
4564
4604
|
] });
|
|
4565
4605
|
}
|
|
4566
4606
|
|
|
@@ -4599,8 +4639,8 @@ function useCountUp(target, ms = 700) {
|
|
|
4599
4639
|
let raf = 0;
|
|
4600
4640
|
const step = (now) => {
|
|
4601
4641
|
const t = Math.min(1, (now - start) / ms);
|
|
4602
|
-
const
|
|
4603
|
-
setShown(t === 1 ? target : Number.isInteger(target) ? Math.round(
|
|
4642
|
+
const v2 = a + (target - a) * easeOut(t);
|
|
4643
|
+
setShown(t === 1 ? target : Number.isInteger(target) ? Math.round(v2) : v2);
|
|
4604
4644
|
if (t < 1) raf = requestAnimationFrame(step);
|
|
4605
4645
|
else from.current = target;
|
|
4606
4646
|
};
|
|
@@ -4614,7 +4654,7 @@ function useCountUp(target, ms = 700) {
|
|
|
4614
4654
|
}
|
|
4615
4655
|
|
|
4616
4656
|
// src/widgets/builtins/Kpi.tsx
|
|
4617
|
-
import { Fragment as Fragment6, jsx as
|
|
4657
|
+
import { Fragment as Fragment6, jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
4618
4658
|
var Kpi = defineWidget({
|
|
4619
4659
|
...KpiContract,
|
|
4620
4660
|
implements: "kpi",
|
|
@@ -4627,11 +4667,11 @@ var Kpi = defineWidget({
|
|
|
4627
4667
|
component: function KpiWidget({ spec, data, source, emit, helpers, panelId }) {
|
|
4628
4668
|
const clickable = useClickable(panelId, () => {
|
|
4629
4669
|
}).role === "button";
|
|
4630
|
-
const num = (
|
|
4670
|
+
const num = (v2) => typeof v2 === "number" ? v2 : toNumber(field(source, v2));
|
|
4631
4671
|
const value = toNumber(data) ?? data;
|
|
4632
4672
|
const animated = useCountUp(value);
|
|
4633
4673
|
const n = toNumber(value);
|
|
4634
|
-
const fmt = (
|
|
4674
|
+
const fmt = (v2) => formatValue(v2, helpers, spec.format, spec.decimals);
|
|
4635
4675
|
const unit = spec.format === "duration" ? void 0 : spec.unit;
|
|
4636
4676
|
const empty = spec.empty === true || value === void 0 || value === null || value === "";
|
|
4637
4677
|
const hasTarget = spec.target !== void 0;
|
|
@@ -4650,10 +4690,10 @@ var Kpi = defineWidget({
|
|
|
4650
4690
|
const ratio = n !== void 0 && pTarget ? Math.min(spec.progress?.cap ?? Number.POSITIVE_INFINITY, n / pTarget * 100) : void 0;
|
|
4651
4691
|
return /* @__PURE__ */ jsxs11("div", { className: "ds-kpi", "data-size": spec.size, children: [
|
|
4652
4692
|
/* @__PURE__ */ jsxs11("div", { className: "ds-kpi-label", children: [
|
|
4653
|
-
/* @__PURE__ */
|
|
4654
|
-
spec.info && /* @__PURE__ */
|
|
4693
|
+
/* @__PURE__ */ jsx16("span", { children: spec.title }),
|
|
4694
|
+
spec.info && /* @__PURE__ */ jsx16(InfoTip, { text: spec.info })
|
|
4655
4695
|
] }),
|
|
4656
|
-
/* @__PURE__ */
|
|
4696
|
+
/* @__PURE__ */ jsx16(
|
|
4657
4697
|
"button",
|
|
4658
4698
|
{
|
|
4659
4699
|
type: "button",
|
|
@@ -4664,7 +4704,7 @@ var Kpi = defineWidget({
|
|
|
4664
4704
|
"aria-label": `${spec.title ?? "Value"}: ${empty ? spec.emptyText ?? "no value" : fmt(value)}${unit ? ` ${unit}` : ""}`,
|
|
4665
4705
|
children: empty ? (
|
|
4666
4706
|
// No value is not zero: the author's text, else a dash.
|
|
4667
|
-
/* @__PURE__ */
|
|
4707
|
+
/* @__PURE__ */ jsx16("span", { className: "ds-kpi-empty", children: spec.emptyText || "\u2014" })
|
|
4668
4708
|
) : /* @__PURE__ */ jsxs11(Fragment6, { children: [
|
|
4669
4709
|
/* @__PURE__ */ jsxs11(
|
|
4670
4710
|
"span",
|
|
@@ -4677,7 +4717,7 @@ var Kpi = defineWidget({
|
|
|
4677
4717
|
]
|
|
4678
4718
|
}
|
|
4679
4719
|
),
|
|
4680
|
-
unit && spec.unitStyle !== "value" && /* @__PURE__ */
|
|
4720
|
+
unit && spec.unitStyle !== "value" && /* @__PURE__ */ jsx16("span", { className: "ds-kpi-unit", children: unit })
|
|
4681
4721
|
] })
|
|
4682
4722
|
}
|
|
4683
4723
|
),
|
|
@@ -4697,8 +4737,8 @@ var Kpi = defineWidget({
|
|
|
4697
4737
|
]
|
|
4698
4738
|
}
|
|
4699
4739
|
),
|
|
4700
|
-
spec.note && /* @__PURE__ */
|
|
4701
|
-
spec.sublabel && /* @__PURE__ */
|
|
4740
|
+
spec.note && /* @__PURE__ */ jsx16("span", { className: "ds-kpi-sub", children: spec.note }),
|
|
4741
|
+
spec.sublabel && /* @__PURE__ */ jsx16("span", { className: "ds-kpi-sub", children: spec.sublabel }),
|
|
4702
4742
|
low !== void 0 && high !== void 0 && /* @__PURE__ */ jsxs11("span", { className: "ds-kpi-sub", children: [
|
|
4703
4743
|
"Expected ",
|
|
4704
4744
|
fmt(low),
|
|
@@ -4706,7 +4746,7 @@ var Kpi = defineWidget({
|
|
|
4706
4746
|
fmt(high)
|
|
4707
4747
|
] }),
|
|
4708
4748
|
ratio !== void 0 && // biome-ignore lint/a11y/useFocusableInteractive: a progress bar is read-only, not interactive
|
|
4709
|
-
/* @__PURE__ */
|
|
4749
|
+
/* @__PURE__ */ jsx16(
|
|
4710
4750
|
"span",
|
|
4711
4751
|
{
|
|
4712
4752
|
className: "ds-progress",
|
|
@@ -4714,7 +4754,7 @@ var Kpi = defineWidget({
|
|
|
4714
4754
|
"aria-valuenow": Math.round(ratio),
|
|
4715
4755
|
"aria-valuemin": 0,
|
|
4716
4756
|
"aria-valuemax": 100,
|
|
4717
|
-
children: /* @__PURE__ */
|
|
4757
|
+
children: /* @__PURE__ */ jsx16(
|
|
4718
4758
|
"span",
|
|
4719
4759
|
{
|
|
4720
4760
|
style: { width: `${Math.min(100, ratio)}%`, background: tone(ratio >= 100 ? "good" : "info").solid }
|
|
@@ -4723,8 +4763,8 @@ var Kpi = defineWidget({
|
|
|
4723
4763
|
}
|
|
4724
4764
|
),
|
|
4725
4765
|
(hasTarget || targetText) && /* @__PURE__ */ jsxs11("div", { className: "ds-kpi-foot", children: [
|
|
4726
|
-
hasTarget && target === void 0 ? /* @__PURE__ */
|
|
4727
|
-
spec.badge !== false && met !== void 0 && !empty && /* @__PURE__ */
|
|
4766
|
+
hasTarget && target === void 0 ? /* @__PURE__ */ jsx16("span", { className: "ds-chip", "data-tone": "bad", children: spec.targetMissing }) : /* @__PURE__ */ jsx16("span", { "data-ds-part": "target", children: targetText }),
|
|
4767
|
+
spec.badge !== false && met !== void 0 && !empty && /* @__PURE__ */ jsx16("span", { className: "ds-chip", "data-tone": met ? "good" : "bad", "data-ds-part": "badge", children: met ? labels.good : labels.bad })
|
|
4728
4768
|
] })
|
|
4729
4769
|
] });
|
|
4730
4770
|
}
|
|
@@ -4732,14 +4772,14 @@ var Kpi = defineWidget({
|
|
|
4732
4772
|
|
|
4733
4773
|
// src/widgets/builtins/Sparkline.tsx
|
|
4734
4774
|
import "zod";
|
|
4735
|
-
import { jsx as
|
|
4775
|
+
import { jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
4736
4776
|
function sparkPath(values, w, h, pad = 2) {
|
|
4737
4777
|
if (values.length === 0) return { line: "", area: "" };
|
|
4738
4778
|
const min = values.reduce((a, b) => Math.min(a, b));
|
|
4739
4779
|
const max = values.reduce((a, b) => Math.max(a, b));
|
|
4740
4780
|
const span = max - min || 1;
|
|
4741
4781
|
const step = values.length > 1 ? (w - pad * 2) / (values.length - 1) : 0;
|
|
4742
|
-
const pts = values.map((
|
|
4782
|
+
const pts = values.map((v2, i) => [pad + i * step, h - pad - (v2 - min) / span * (h - pad * 2)]);
|
|
4743
4783
|
const line = pts.map(([x, y], i) => `${i ? "L" : "M"}${x.toFixed(1)},${y.toFixed(1)}`).join(" ");
|
|
4744
4784
|
const last = pts[pts.length - 1];
|
|
4745
4785
|
return { line, area: `${line} L${last[0].toFixed(1)},${h} L${pad},${h} Z` };
|
|
@@ -4753,8 +4793,8 @@ function SparkSvg({
|
|
|
4753
4793
|
const w = 120;
|
|
4754
4794
|
const { line, area: fill } = sparkPath(values, w, height);
|
|
4755
4795
|
return /* @__PURE__ */ jsxs12("svg", { viewBox: `0 0 ${w} ${height}`, preserveAspectRatio: "none", style: { width: "100%", height }, "aria-hidden": "true", children: [
|
|
4756
|
-
area && /* @__PURE__ */
|
|
4757
|
-
/* @__PURE__ */
|
|
4796
|
+
area && /* @__PURE__ */ jsx17("path", { d: fill, fill: color2, opacity: 0.15 }),
|
|
4797
|
+
/* @__PURE__ */ jsx17("path", { d: line, fill: "none", stroke: color2, strokeWidth: 1.5, vectorEffect: "non-scaling-stroke" })
|
|
4758
4798
|
] });
|
|
4759
4799
|
}
|
|
4760
4800
|
var Sparkline = defineWidget({
|
|
@@ -4766,14 +4806,14 @@ var Sparkline = defineWidget({
|
|
|
4766
4806
|
component: function SparklineWidget({ spec, data, size: size2, emit }) {
|
|
4767
4807
|
const rows = asRows(data);
|
|
4768
4808
|
const values = rows.map((r) => toNumber(field(r, spec.y)) ?? 0);
|
|
4769
|
-
return /* @__PURE__ */
|
|
4809
|
+
return /* @__PURE__ */ jsx17(
|
|
4770
4810
|
"div",
|
|
4771
4811
|
{
|
|
4772
4812
|
onMouseEnter: () => emit("hover", "line", { value: values[values.length - 1] }),
|
|
4773
4813
|
style: { height: "100%" },
|
|
4774
4814
|
role: "img",
|
|
4775
4815
|
"aria-label": `${spec.title ?? spec.y}: ${values.length} points`,
|
|
4776
|
-
children: /* @__PURE__ */
|
|
4816
|
+
children: /* @__PURE__ */ jsx17(SparkSvg, { values, area: spec.area, height: Math.max(24, size2.height || 32) })
|
|
4777
4817
|
}
|
|
4778
4818
|
);
|
|
4779
4819
|
}
|
|
@@ -4781,7 +4821,7 @@ var Sparkline = defineWidget({
|
|
|
4781
4821
|
|
|
4782
4822
|
// src/widgets/builtins/StageTracker.tsx
|
|
4783
4823
|
import "zod";
|
|
4784
|
-
import { jsx as
|
|
4824
|
+
import { jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
4785
4825
|
var StageTracker = defineWidget({
|
|
4786
4826
|
...StageTrackerContract,
|
|
4787
4827
|
implements: "stages",
|
|
@@ -4791,16 +4831,16 @@ var StageTracker = defineWidget({
|
|
|
4791
4831
|
component: function StageTrackerWidget({ spec, data, emit }) {
|
|
4792
4832
|
const raw = typeof data === "string" || typeof data === "number" ? data : field(data, spec.current);
|
|
4793
4833
|
const idx = typeof raw === "number" ? raw : spec.stages.findIndex((s) => s.toLowerCase() === String(raw ?? "").toLowerCase());
|
|
4794
|
-
return /* @__PURE__ */
|
|
4834
|
+
return /* @__PURE__ */ jsx18("ol", { className: "ds-stages", children: spec.stages.map((s, i) => {
|
|
4795
4835
|
const state = i < idx ? "done" : i === idx ? "current" : "todo";
|
|
4796
|
-
return /* @__PURE__ */
|
|
4836
|
+
return /* @__PURE__ */ jsx18("li", { "data-state": state, children: /* @__PURE__ */ jsxs13(
|
|
4797
4837
|
"button",
|
|
4798
4838
|
{
|
|
4799
4839
|
type: "button",
|
|
4800
4840
|
onClick: () => emit("click", "stage", { value: s, index: i, datum: data }),
|
|
4801
4841
|
"aria-current": state === "current" ? "step" : void 0,
|
|
4802
4842
|
children: [
|
|
4803
|
-
/* @__PURE__ */
|
|
4843
|
+
/* @__PURE__ */ jsx18("span", { className: "ds-stage-dot", "aria-hidden": "true", children: state === "done" ? "\u2713" : i + 1 }),
|
|
4804
4844
|
s
|
|
4805
4845
|
]
|
|
4806
4846
|
}
|
|
@@ -4811,7 +4851,7 @@ var StageTracker = defineWidget({
|
|
|
4811
4851
|
|
|
4812
4852
|
// src/widgets/builtins/StateTimeline.tsx
|
|
4813
4853
|
import "zod";
|
|
4814
|
-
import { jsx as
|
|
4854
|
+
import { jsx as jsx19, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
4815
4855
|
var StateTimeline = defineWidget({
|
|
4816
4856
|
...StateTimelineContract,
|
|
4817
4857
|
implements: "timeline",
|
|
@@ -4836,10 +4876,10 @@ var StateTimeline = defineWidget({
|
|
|
4836
4876
|
return { p, from, to, state };
|
|
4837
4877
|
});
|
|
4838
4878
|
return /* @__PURE__ */ jsxs14("div", { className: "ds-timeline-lane", children: [
|
|
4839
|
-
lane && /* @__PURE__ */
|
|
4840
|
-
/* @__PURE__ */
|
|
4879
|
+
lane && /* @__PURE__ */ jsx19("span", { className: "ds-timeline-name", children: lane }),
|
|
4880
|
+
/* @__PURE__ */ jsx19("div", { className: "ds-timeline-bar", role: "img", "aria-label": `${spec.title ?? "Timeline"} ${lane}`, children: segs.filter((s) => s.to > s.from).map((s) => (
|
|
4841
4881
|
// biome-ignore lint/a11y/useKeyWithClickEvents: the per-state totals below summarise the same data for keyboard users
|
|
4842
|
-
/* @__PURE__ */
|
|
4882
|
+
/* @__PURE__ */ jsx19(
|
|
4843
4883
|
"span",
|
|
4844
4884
|
{
|
|
4845
4885
|
title: `${s.state} \xB7 ${helpers.fmt.date(s.from, "time")}\u2013${helpers.fmt.date(s.to, "time")} (${helpers.fmt.duration((s.to - s.from) / 1e3)})`,
|
|
@@ -4857,11 +4897,11 @@ var StateTimeline = defineWidget({
|
|
|
4857
4897
|
] }, lane);
|
|
4858
4898
|
}),
|
|
4859
4899
|
/* @__PURE__ */ jsxs14("div", { className: "ds-timeline-axis", children: [
|
|
4860
|
-
/* @__PURE__ */
|
|
4861
|
-
/* @__PURE__ */
|
|
4900
|
+
/* @__PURE__ */ jsx19("span", { children: helpers.fmt.date(start, "time") }),
|
|
4901
|
+
/* @__PURE__ */ jsx19("span", { children: spec.endLabel ?? helpers.fmt.date(end, "time") })
|
|
4862
4902
|
] }),
|
|
4863
|
-
/* @__PURE__ */
|
|
4864
|
-
/* @__PURE__ */
|
|
4903
|
+
/* @__PURE__ */ jsx19("ul", { className: "ds-legend", children: [...states.entries()].map(([s, ms]) => /* @__PURE__ */ jsxs14("li", { children: [
|
|
4904
|
+
/* @__PURE__ */ jsx19(
|
|
4865
4905
|
"span",
|
|
4866
4906
|
{
|
|
4867
4907
|
className: "ds-dot",
|
|
@@ -4871,7 +4911,7 @@ var StateTimeline = defineWidget({
|
|
|
4871
4911
|
),
|
|
4872
4912
|
s,
|
|
4873
4913
|
" ",
|
|
4874
|
-
/* @__PURE__ */
|
|
4914
|
+
/* @__PURE__ */ jsx19("strong", { children: helpers.fmt.duration(ms / 1e3) })
|
|
4875
4915
|
] }, s)) })
|
|
4876
4916
|
] });
|
|
4877
4917
|
}
|
|
@@ -4879,7 +4919,7 @@ var StateTimeline = defineWidget({
|
|
|
4879
4919
|
|
|
4880
4920
|
// src/widgets/builtins/Status.tsx
|
|
4881
4921
|
import "zod";
|
|
4882
|
-
import { jsx as
|
|
4922
|
+
import { jsx as jsx20, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
4883
4923
|
var Status = defineWidget({
|
|
4884
4924
|
...StatusContract,
|
|
4885
4925
|
implements: "badge",
|
|
@@ -4894,56 +4934,16 @@ var Status = defineWidget({
|
|
|
4894
4934
|
const text2 = spec.text ?? spec.labels?.[state] ?? state.charAt(0).toUpperCase() + state.slice(1);
|
|
4895
4935
|
return /* @__PURE__ */ jsxs15("button", { type: "button", className: "ds-status", onClick: () => emit("click", "status", { datum: row, value: state }), children: [
|
|
4896
4936
|
/* @__PURE__ */ jsxs15("span", { className: "ds-pill", style: { background: tone(t).bg, color: tone(t).fg, borderColor: tone(t).border }, children: [
|
|
4897
|
-
/* @__PURE__ */
|
|
4937
|
+
/* @__PURE__ */ jsx20("span", { className: "ds-dot", style: { background: tone(t).solid }, "aria-hidden": "true" }),
|
|
4898
4938
|
text2
|
|
4899
4939
|
] }),
|
|
4900
|
-
spec.label && /* @__PURE__ */
|
|
4940
|
+
spec.label && /* @__PURE__ */ jsx20("span", { className: "ds-status-label", children: String(field(row, spec.label) ?? "") })
|
|
4901
4941
|
] });
|
|
4902
4942
|
}
|
|
4903
4943
|
});
|
|
4904
4944
|
|
|
4905
4945
|
// src/widgets/builtins/Table.tsx
|
|
4906
4946
|
import { useEffect as useEffect6, useMemo as useMemo4, useRef as useRef7, useState as useState6 } from "react";
|
|
4907
|
-
|
|
4908
|
-
// src/widgets/shared/chips.tsx
|
|
4909
|
-
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
4910
|
-
var TONES = /* @__PURE__ */ new Set(["good", "warn", "bad", "neutral", "info", "action", "muted"]);
|
|
4911
|
-
function evalOver(expr, vars, helpers) {
|
|
4912
|
-
try {
|
|
4913
|
-
return evaluate(expr, scope(vars, helpers));
|
|
4914
|
-
} catch {
|
|
4915
|
-
return void 0;
|
|
4916
|
-
}
|
|
4917
|
-
}
|
|
4918
|
-
function toneOf(tone2, vars, helpers) {
|
|
4919
|
-
if (!tone2) return void 0;
|
|
4920
|
-
if (TONES.has(tone2)) return tone2;
|
|
4921
|
-
const t = evalOver(tone2, vars, helpers);
|
|
4922
|
-
return typeof t === "string" ? t : void 0;
|
|
4923
|
-
}
|
|
4924
|
-
function Chips({
|
|
4925
|
-
chips,
|
|
4926
|
-
vars,
|
|
4927
|
-
helpers
|
|
4928
|
-
}) {
|
|
4929
|
-
if (!chips?.length) return null;
|
|
4930
|
-
const shown = chips.filter((c) => c.when === void 0 || Boolean(evalOver(c.when, vars, helpers))).map((c) => {
|
|
4931
|
-
let text2 = "";
|
|
4932
|
-
try {
|
|
4933
|
-
const v = interpolate(c.text, scope(vars, helpers));
|
|
4934
|
-
text2 = v === null || v === void 0 ? "" : String(v);
|
|
4935
|
-
} catch {
|
|
4936
|
-
}
|
|
4937
|
-
return { text: text2, tone: toneOf(c.tone, vars, helpers) ?? "neutral" };
|
|
4938
|
-
}).filter((c) => c.text);
|
|
4939
|
-
if (shown.length === 0) return null;
|
|
4940
|
-
return /* @__PURE__ */ jsx20("span", { className: "ds-chips", children: shown.map((c, i) => (
|
|
4941
|
-
// biome-ignore lint/suspicious/noArrayIndexKey: chips come from a fixed list in the spec
|
|
4942
|
-
/* @__PURE__ */ jsx20("span", { className: "ds-chip", "data-tone": c.tone, children: c.text }, i)
|
|
4943
|
-
)) });
|
|
4944
|
-
}
|
|
4945
|
-
|
|
4946
|
-
// src/widgets/builtins/Table.tsx
|
|
4947
4947
|
import { jsx as jsx21, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
4948
4948
|
var ROW_H = 36;
|
|
4949
4949
|
function pageList(current, pages) {
|
|
@@ -4968,8 +4968,8 @@ var Table = defineWidget({
|
|
|
4968
4968
|
component: function TableWidget({ spec, data, source, emit, helpers, size: size2, state, setUi, status, renderSlot }) {
|
|
4969
4969
|
const tpl = (t, row, item) => {
|
|
4970
4970
|
try {
|
|
4971
|
-
const
|
|
4972
|
-
return
|
|
4971
|
+
const v2 = interpolate(t, scope({ row, item, datum: row }, helpers));
|
|
4972
|
+
return v2 === null || v2 === void 0 ? "" : String(v2);
|
|
4973
4973
|
} catch {
|
|
4974
4974
|
return "";
|
|
4975
4975
|
}
|
|
@@ -4985,7 +4985,7 @@ var Table = defineWidget({
|
|
|
4985
4985
|
return asRows(field(source, cf.path)).map((c) => {
|
|
4986
4986
|
const key = String(field(c, cf.key));
|
|
4987
4987
|
const label = String(field(c, cf.label) ?? field(c, cf.key));
|
|
4988
|
-
const fill = (
|
|
4988
|
+
const fill = (v2) => typeof v2 === "string" ? v2.replaceAll("{key}", key).replaceAll("{label}", label) : Array.isArray(v2) ? v2.map(fill) : v2 && typeof v2 === "object" ? Object.fromEntries(Object.entries(v2).map(([k, x]) => [k, fill(x)])) : v2;
|
|
4989
4989
|
return {
|
|
4990
4990
|
key,
|
|
4991
4991
|
label,
|
|
@@ -5036,7 +5036,7 @@ var Table = defineWidget({
|
|
|
5036
5036
|
sortKey: next.sortKey,
|
|
5037
5037
|
sortOrder: next.sortKey ? next.sortOrder : void 0,
|
|
5038
5038
|
ordering: next.sortKey ? `${next.sortOrder === "desc" ? "-" : ""}${next.sortKey}` : void 0,
|
|
5039
|
-
filters: Object.fromEntries(Object.entries(next.filters).filter(([,
|
|
5039
|
+
filters: Object.fromEntries(Object.entries(next.filters).filter(([, v2]) => v2 !== ""))
|
|
5040
5040
|
});
|
|
5041
5041
|
};
|
|
5042
5042
|
const [searchText, setSearchText] = useState6(view.search);
|
|
@@ -5048,15 +5048,15 @@ var Table = defineWidget({
|
|
|
5048
5048
|
const rows = useMemo4(() => {
|
|
5049
5049
|
let r = base;
|
|
5050
5050
|
if (fl && !server.filter)
|
|
5051
|
-
for (const [k,
|
|
5052
|
-
if (
|
|
5051
|
+
for (const [k, v2] of Object.entries(view.filters)) {
|
|
5052
|
+
if (v2 === "") continue;
|
|
5053
5053
|
const c = columns.find((x) => x.key === k);
|
|
5054
5054
|
if (c?.filter === "min")
|
|
5055
|
-
r = r.filter((row) => (toNumber(field(row, k)) ?? Number.NEGATIVE_INFINITY) >= Number(
|
|
5056
|
-
else if (c?.filter === "select") r = r.filter((row) => String(field(row, k) ?? "") ===
|
|
5055
|
+
r = r.filter((row) => (toNumber(field(row, k)) ?? Number.NEGATIVE_INFINITY) >= Number(v2));
|
|
5056
|
+
else if (c?.filter === "select") r = r.filter((row) => String(field(row, k) ?? "") === v2);
|
|
5057
5057
|
else
|
|
5058
5058
|
r = r.filter(
|
|
5059
|
-
(row) => String(field(row, k) ?? "").toLowerCase().includes(
|
|
5059
|
+
(row) => String(field(row, k) ?? "").toLowerCase().includes(v2.toLowerCase())
|
|
5060
5060
|
);
|
|
5061
5061
|
}
|
|
5062
5062
|
if (sr && !server.search && view.search) {
|
|
@@ -5064,7 +5064,7 @@ var Table = defineWidget({
|
|
|
5064
5064
|
const fields = sr.mode === "client" && "fields" in sr ? sr.fields : void 0;
|
|
5065
5065
|
r = r.filter(
|
|
5066
5066
|
(row) => (fields ? fields.map((f) => field(row, f)) : Object.values(row)).some(
|
|
5067
|
-
(
|
|
5067
|
+
(v2) => v2 !== null && v2 !== void 0 && typeof v2 !== "object" && String(v2).toLowerCase().includes(q)
|
|
5068
5068
|
)
|
|
5069
5069
|
);
|
|
5070
5070
|
}
|
|
@@ -5096,19 +5096,19 @@ var Table = defineWidget({
|
|
|
5096
5096
|
const busy = status === "loading" && base.length > 0;
|
|
5097
5097
|
const filterChoices = (c) => c.filterOptions ?? [
|
|
5098
5098
|
...new Set(
|
|
5099
|
-
base.map((r) => field(r, c.key)).filter((
|
|
5099
|
+
base.map((r) => field(r, c.key)).filter((v2) => v2 !== null && v2 !== void 0 && v2 !== "").map(String)
|
|
5100
5100
|
)
|
|
5101
5101
|
].sort();
|
|
5102
5102
|
const cell = (c, row) => {
|
|
5103
|
-
const
|
|
5103
|
+
const v2 = field(row, c.key);
|
|
5104
5104
|
if (c.type === "badge") {
|
|
5105
|
-
const text2 = c.template ? tpl(c.template, row) :
|
|
5105
|
+
const text2 = c.template ? tpl(c.template, row) : v2 === null || v2 === void 0 || v2 === "" ? "" : String(v2);
|
|
5106
5106
|
if (!text2) return c.empty ? /* @__PURE__ */ jsx21("span", { className: "ds-cell-empty", children: c.empty }) : "";
|
|
5107
|
-
let t = c.map?.[String(
|
|
5107
|
+
let t = c.map?.[String(v2)] ?? "neutral";
|
|
5108
5108
|
if (c.tone) {
|
|
5109
5109
|
try {
|
|
5110
5110
|
t = String(
|
|
5111
|
-
evaluate(c.tone, scope({ row, value:
|
|
5111
|
+
evaluate(c.tone, scope({ row, value: v2 }, helpers))
|
|
5112
5112
|
);
|
|
5113
5113
|
} catch {
|
|
5114
5114
|
}
|
|
@@ -5117,24 +5117,24 @@ var Table = defineWidget({
|
|
|
5117
5117
|
}
|
|
5118
5118
|
if (c.template) return tpl(c.template, row) || (c.empty ? /* @__PURE__ */ jsx21("span", { className: "ds-cell-empty", children: c.empty }) : "");
|
|
5119
5119
|
if (c.list !== void 0) {
|
|
5120
|
-
const items = Array.isArray(
|
|
5120
|
+
const items = Array.isArray(v2) ? v2 : [];
|
|
5121
5121
|
if (items.length === 0) return c.empty ?? "";
|
|
5122
5122
|
return /* @__PURE__ */ jsx21("span", { className: "ds-cell-list", children: items.map((it, i) => (
|
|
5123
5123
|
// biome-ignore lint/suspicious/noArrayIndexKey: list items have no id and never reorder within a render
|
|
5124
5124
|
/* @__PURE__ */ jsx21("span", { children: tpl(c.list, row, it) }, i)
|
|
5125
5125
|
)) });
|
|
5126
5126
|
}
|
|
5127
|
-
if (
|
|
5127
|
+
if (v2 === null || v2 === void 0 || v2 === "")
|
|
5128
5128
|
return c.empty ? /* @__PURE__ */ jsx21("span", { className: "ds-cell-empty", children: c.empty }) : "";
|
|
5129
5129
|
switch (c.type) {
|
|
5130
5130
|
case "link": {
|
|
5131
|
-
const href = safeLink(c.href ? tpl(c.href, row) : String(
|
|
5132
|
-
return href ? /* @__PURE__ */ jsx21("a", { className: "ds-link", href, onClick: (e) => e.stopPropagation(), children: String(
|
|
5131
|
+
const href = safeLink(c.href ? tpl(c.href, row) : String(v2));
|
|
5132
|
+
return href ? /* @__PURE__ */ jsx21("a", { className: "ds-link", href, onClick: (e) => e.stopPropagation(), children: String(v2) }) : String(v2);
|
|
5133
5133
|
}
|
|
5134
5134
|
case "image":
|
|
5135
|
-
return safeImageSrc(
|
|
5135
|
+
return safeImageSrc(v2) ? /* @__PURE__ */ jsx21("img", { src: v2, alt: "", style: { height: 28, borderRadius: 4 } }) : null;
|
|
5136
5136
|
case "progress": {
|
|
5137
|
-
const n = toNumber(
|
|
5137
|
+
const n = toNumber(v2) ?? 0;
|
|
5138
5138
|
const pct = Math.min(100, n / (c.max ?? 100) * 100);
|
|
5139
5139
|
return /* @__PURE__ */ jsxs16("span", { className: "ds-inline", children: [
|
|
5140
5140
|
/* @__PURE__ */ jsx21("span", { className: "ds-progress", style: { flex: 1, minWidth: 40 }, children: /* @__PURE__ */ jsx21("span", { style: { width: `${pct}%`, background: "var(--ds-series-1)" } }) }),
|
|
@@ -5146,7 +5146,7 @@ var Table = defineWidget({
|
|
|
5146
5146
|
return /* @__PURE__ */ jsx21(
|
|
5147
5147
|
SparkSvg,
|
|
5148
5148
|
{
|
|
5149
|
-
values: (Array.isArray(
|
|
5149
|
+
values: (Array.isArray(v2) ? v2 : []).map(
|
|
5150
5150
|
(x) => toNumber(typeof x === "object" ? field(x, "value") : x) ?? 0
|
|
5151
5151
|
),
|
|
5152
5152
|
height: 24,
|
|
@@ -5154,7 +5154,7 @@ var Table = defineWidget({
|
|
|
5154
5154
|
}
|
|
5155
5155
|
);
|
|
5156
5156
|
default:
|
|
5157
|
-
return `${c.prefix ?? ""}${typeof
|
|
5157
|
+
return `${c.prefix ?? ""}${typeof v2 === "number" || c.format ? formatValue(v2, helpers, c.format, c.decimals) : String(v2)}${c.suffix ?? ""}`;
|
|
5158
5158
|
}
|
|
5159
5159
|
};
|
|
5160
5160
|
const WEIGHT = { regular: 400, medium: 500, semibold: 600, bold: 700 };
|
|
@@ -5178,8 +5178,8 @@ var Table = defineWidget({
|
|
|
5178
5178
|
if (!how) return null;
|
|
5179
5179
|
const nums = rows.map((r) => toNumber(field(r, c.key))).filter((n) => n !== void 0);
|
|
5180
5180
|
if (how !== "count" && nums.length === 0) return "";
|
|
5181
|
-
const
|
|
5182
|
-
return `${c.prefix ?? ""}${formatValue(
|
|
5181
|
+
const v2 = how === "count" ? rows.length : how === "sum" ? nums.reduce((a, b) => a + b, 0) : how === "avg" ? nums.reduce((a, b) => a + b, 0) / (nums.length || 1) : how === "min" ? nums.reduce((a, b) => Math.min(a, b)) : nums.reduce((a, b) => Math.max(a, b));
|
|
5182
|
+
return `${c.prefix ?? ""}${formatValue(v2, helpers, c.format === "date" ? "number" : c.format, c.decimals)}${c.suffix ?? ""}`;
|
|
5183
5183
|
};
|
|
5184
5184
|
const muted = (row) => {
|
|
5185
5185
|
if (!spec.rowMutedWhen) return false;
|
|
@@ -5205,10 +5205,10 @@ var Table = defineWidget({
|
|
|
5205
5205
|
placeholder: "placeholder" in sr && sr.placeholder || "Search",
|
|
5206
5206
|
value: searchText,
|
|
5207
5207
|
onChange: (e) => {
|
|
5208
|
-
const
|
|
5209
|
-
setSearchText(
|
|
5208
|
+
const v2 = e.target.value;
|
|
5209
|
+
setSearchText(v2);
|
|
5210
5210
|
clearTimeout(searchTimer.current);
|
|
5211
|
-
searchTimer.current = setTimeout(() => update({ search:
|
|
5211
|
+
searchTimer.current = setTimeout(() => update({ search: v2, page: 1 }), server.search ? 350 : 120);
|
|
5212
5212
|
}
|
|
5213
5213
|
}
|
|
5214
5214
|
)
|
|
@@ -5267,7 +5267,7 @@ var Table = defineWidget({
|
|
|
5267
5267
|
...filterChoices(c).map((o) => ({ value: o, label: o }))
|
|
5268
5268
|
],
|
|
5269
5269
|
value: view.filters[c.key] ?? "",
|
|
5270
|
-
onChange: (
|
|
5270
|
+
onChange: (v2) => update({ filters: { ...view.filters, [c.key]: String(v2 ?? "") }, page: 1 })
|
|
5271
5271
|
}
|
|
5272
5272
|
) : c.filter ? /* @__PURE__ */ jsx21(
|
|
5273
5273
|
"input",
|
|
@@ -5384,7 +5384,7 @@ var Table = defineWidget({
|
|
|
5384
5384
|
ariaLabel: "Rows per page",
|
|
5385
5385
|
options: (pg?.pageSizes ?? [10, 20, 50, 100]).map((n) => ({ value: n, label: String(n) })),
|
|
5386
5386
|
value: pageSize,
|
|
5387
|
-
onChange: (
|
|
5387
|
+
onChange: (v2) => update({ pageSize: Number(v2), page: 1 })
|
|
5388
5388
|
}
|
|
5389
5389
|
)
|
|
5390
5390
|
] }),
|
|
@@ -5473,13 +5473,13 @@ var Tiles = defineWidget({
|
|
|
5473
5473
|
},
|
|
5474
5474
|
children: rows.map((r, i) => {
|
|
5475
5475
|
const label = field(r, spec.label);
|
|
5476
|
-
const
|
|
5477
|
-
const n = toNumber(
|
|
5476
|
+
const v2 = spec.value.includes("${") ? tplValue(spec.value, r, helpers) : field(r, spec.value);
|
|
5477
|
+
const n = toNumber(v2);
|
|
5478
5478
|
const status = spec.status ? String(field(r, spec.status)) : void 0;
|
|
5479
5479
|
const st = status ? spec.statusMap?.[status] ?? status : void 0;
|
|
5480
5480
|
const vt = n === void 0 || !spec.valueTone ? void 0 : n > 0 ? spec.valueTone.positive : n < 0 ? spec.valueTone.negative : spec.valueTone.zero;
|
|
5481
5481
|
const active = spec.selectable && spec.selected !== void 0 && spec.selected === label;
|
|
5482
|
-
const vars = { row: r, value:
|
|
5482
|
+
const vars = { row: r, value: v2 };
|
|
5483
5483
|
const mutedTile = spec.mutedWhen ? Boolean(evalOver(spec.mutedWhen, vars, helpers)) : false;
|
|
5484
5484
|
const lit = spec.highlightWhen ? Boolean(evalOver(spec.highlightWhen, vars, helpers)) : false;
|
|
5485
5485
|
return /* @__PURE__ */ jsxs17(
|
|
@@ -5505,13 +5505,13 @@ var Tiles = defineWidget({
|
|
|
5505
5505
|
spec.count && /* @__PURE__ */ jsx22("span", { className: "ds-chip-count", children: String(field(r, spec.count) ?? "") })
|
|
5506
5506
|
] }),
|
|
5507
5507
|
(() => {
|
|
5508
|
-
const valueEl =
|
|
5508
|
+
const valueEl = v2 === "" ? null : /* @__PURE__ */ jsxs17(
|
|
5509
5509
|
"span",
|
|
5510
5510
|
{
|
|
5511
5511
|
className: "ds-tile-value",
|
|
5512
5512
|
style: vt ? { color: vt === "muted" ? "var(--ds-color-text-disabled)" : tone(vt).fg } : void 0,
|
|
5513
5513
|
children: [
|
|
5514
|
-
/* @__PURE__ */ jsx22(CountUp, { value:
|
|
5514
|
+
/* @__PURE__ */ jsx22(CountUp, { value: v2, render: (x) => formatValue(x, helpers, spec.format, spec.decimals) }),
|
|
5515
5515
|
spec.unit && /* @__PURE__ */ jsx22("span", { className: "ds-kpi-unit", children: spec.unit })
|
|
5516
5516
|
]
|
|
5517
5517
|
}
|
|
@@ -5566,9 +5566,9 @@ var Text = defineWidget({
|
|
|
5566
5566
|
events: ["click"],
|
|
5567
5567
|
defaults: { text: "Label" },
|
|
5568
5568
|
component: function TextAtom({ spec, data, helpers, emit, panelId }) {
|
|
5569
|
-
const
|
|
5570
|
-
const click = useClickable(panelId, () => emit("click", "text", { value:
|
|
5571
|
-
const shown = spec.text.includes("{value}") && (
|
|
5569
|
+
const v2 = boundValue(data, spec.field);
|
|
5570
|
+
const click = useClickable(panelId, () => emit("click", "text", { value: v2 }));
|
|
5571
|
+
const shown = spec.text.includes("{value}") && (v2 === void 0 || v2 === null || v2 === "") ? spec.emptyText ?? spec.text.replace("{value}", "\u2013") : spec.text.replace("{value}", v2 === void 0 ? "" : formatValue(v2, helpers, "text"));
|
|
5572
5572
|
return /* @__PURE__ */ jsx23(
|
|
5573
5573
|
"span",
|
|
5574
5574
|
{
|
|
@@ -5589,11 +5589,11 @@ var Value = defineWidget({
|
|
|
5589
5589
|
meta: meta("Value", 3, 2),
|
|
5590
5590
|
events: ["click"],
|
|
5591
5591
|
component: function ValueAtom({ spec, data, helpers, emit, panelId }) {
|
|
5592
|
-
const
|
|
5593
|
-
const click = useClickable(panelId, () => emit("click", "value", { value:
|
|
5594
|
-
const n = toNumber(
|
|
5592
|
+
const v2 = boundValue(data, spec.field);
|
|
5593
|
+
const click = useClickable(panelId, () => emit("click", "value", { value: v2 }));
|
|
5594
|
+
const n = toNumber(v2);
|
|
5595
5595
|
const animated = useCountUp(spec.countUp ? n : void 0);
|
|
5596
|
-
const shown = n !== void 0 && spec.countUp ? animated :
|
|
5596
|
+
const shown = n !== void 0 && spec.countUp ? animated : v2;
|
|
5597
5597
|
const target = typeof spec.target === "number" ? spec.target : spec.target ? toNumber(boundValue(data, spec.target)) : void 0;
|
|
5598
5598
|
const met = n !== void 0 && target !== void 0 ? spec.goodWhen === "down" ? n <= target : n >= target : void 0;
|
|
5599
5599
|
const c = spec.color === "byTarget" ? met === void 0 ? void 0 : tone(met ? "good" : "bad").fg : spec.color === "primary" ? "var(--ds-color-action-primary)" : spec.color === "default" ? void 0 : tone(spec.color).fg;
|
|
@@ -5981,11 +5981,11 @@ function cartesian(data, source, spec, type, h, colors) {
|
|
|
5981
5981
|
const totals = cats.map((_, i) => series.reduce((a, s) => a + (s.values[i] ?? 0), 0) || 1);
|
|
5982
5982
|
series = series.map((s) => ({
|
|
5983
5983
|
...s,
|
|
5984
|
-
values: s.values.map((
|
|
5984
|
+
values: s.values.map((v2, i) => v2 === null ? null : v2 / totals[i] * 100)
|
|
5985
5985
|
}));
|
|
5986
5986
|
}
|
|
5987
|
-
const labelValue = (
|
|
5988
|
-
const fmt = (
|
|
5987
|
+
const labelValue = (v2) => spec.maxDecimals !== void 0 && typeof v2 === "number" ? formatValue(Math.round(v2 * 10 ** spec.maxDecimals) / 10 ** spec.maxDecimals, h, spec.format, void 0) : formatValue(v2, h, spec.format, spec.decimals ?? 1);
|
|
5988
|
+
const fmt = (v2) => spec.normalized ? h.fmt.percent(v2, 0) : `${formatValue(v2, h, spec.format, spec.decimals)}${spec.unit ? ` ${spec.unit}` : ""}`;
|
|
5989
5989
|
const target = typeof spec.target === "number" ? spec.target : spec.target !== void 0 ? toNumber(field(source, spec.target)) : void 0;
|
|
5990
5990
|
const catAxis = {
|
|
5991
5991
|
type: "category",
|
|
@@ -5995,18 +5995,18 @@ function cartesian(data, source, spec, type, h, colors) {
|
|
|
5995
5995
|
const valAxis = {
|
|
5996
5996
|
type: "value",
|
|
5997
5997
|
axisLabel: {
|
|
5998
|
-
formatter: (
|
|
5998
|
+
formatter: (v2) => spec.normalized ? `${v2}%` : formatValue(v2, h, spec.format === "duration" ? "duration" : "compact")
|
|
5999
5999
|
},
|
|
6000
6000
|
...spec.normalized ? { max: 100 } : {},
|
|
6001
6001
|
...spec.valueAxis?.min !== void 0 ? { min: spec.valueAxis.min } : {},
|
|
6002
|
-
...spec.valueAxis?.max !== void 0 ? { max: spec.valueAxis.max } : spec.valueAxis?.atLeast !== void 0 ? { max: (
|
|
6002
|
+
...spec.valueAxis?.max !== void 0 ? { max: spec.valueAxis.max } : spec.valueAxis?.atLeast !== void 0 ? { max: (v2) => Math.max(spec.valueAxis?.atLeast ?? 0, v2.max) } : {},
|
|
6003
6003
|
...spec.valueAxis?.step !== void 0 ? { interval: spec.valueAxis.step } : {},
|
|
6004
6004
|
...spec.valueAxis?.minStep !== void 0 ? { minInterval: spec.valueAxis.minStep } : {}
|
|
6005
6005
|
};
|
|
6006
6006
|
const stack = spec.stacked || spec.normalized || spec.range ? "total" : void 0;
|
|
6007
6007
|
const single = series.length === 1 && !spec.range;
|
|
6008
6008
|
const isPartial = cats.map((c) => Boolean(spec.partial && field(firstRow.get(String(c)), spec.partial)));
|
|
6009
|
-
const full = single ? (series[0]?.values ?? []).filter((
|
|
6009
|
+
const full = single ? (series[0]?.values ?? []).filter((v2, i) => v2 !== null && !isPartial[i]) : [];
|
|
6010
6010
|
const given = typeof spec.average === "number" ? spec.average : spec.average !== void 0 ? toNumber(field(source, spec.average)) ?? void 0 : void 0;
|
|
6011
6011
|
const avg = given ?? (full.length ? full.reduce((a, b) => a + b, 0) / full.length : void 0);
|
|
6012
6012
|
const toneOf2 = (i) => {
|
|
@@ -6026,18 +6026,18 @@ function cartesian(data, source, spec, type, h, colors) {
|
|
|
6026
6026
|
let sum = 0;
|
|
6027
6027
|
let any = false;
|
|
6028
6028
|
for (const x of series) {
|
|
6029
|
-
const
|
|
6030
|
-
if (typeof
|
|
6031
|
-
sum +=
|
|
6029
|
+
const v2 = x.values[i];
|
|
6030
|
+
if (typeof v2 === "number") {
|
|
6031
|
+
sum += v2;
|
|
6032
6032
|
any = true;
|
|
6033
6033
|
}
|
|
6034
6034
|
}
|
|
6035
6035
|
return any ? sum : null;
|
|
6036
6036
|
};
|
|
6037
6037
|
for (const s of series) {
|
|
6038
|
-
const styled = type === "bar" && single && colors ? s.values.map((
|
|
6039
|
-
value:
|
|
6040
|
-
itemStyle: isPartial[i] ? { color: colors.partial } : toned ? toneOf2(i) ? { color: toneOf2(i) } : void 0 : colourByAvg &&
|
|
6038
|
+
const styled = type === "bar" && single && colors ? s.values.map((v2, i) => ({
|
|
6039
|
+
value: v2,
|
|
6040
|
+
itemStyle: isPartial[i] ? { color: colors.partial } : toned ? toneOf2(i) ? { color: toneOf2(i) } : void 0 : colourByAvg && v2 !== null ? { color: v2 >= avg ? colors.good : colors.bad } : void 0
|
|
6041
6041
|
})) : void 0;
|
|
6042
6042
|
if (s.base)
|
|
6043
6043
|
out.push({
|
|
@@ -6064,9 +6064,9 @@ function cartesian(data, source, spec, type, h, colors) {
|
|
|
6064
6064
|
fontSize: 12,
|
|
6065
6065
|
...colors ? { color: colors.text } : {},
|
|
6066
6066
|
formatter: (p) => {
|
|
6067
|
-
const
|
|
6068
|
-
if (
|
|
6069
|
-
return `${labelValue(
|
|
6067
|
+
const v2 = stackedTotals ? totalAt(p.dataIndex) : p.value;
|
|
6068
|
+
if (v2 === null || v2 === void 0 || spec.hideZeroLabels && Number(v2) === 0) return "";
|
|
6069
|
+
return `${labelValue(v2)}${isPartial[p.dataIndex] ? " so far" : ""}`;
|
|
6070
6070
|
}
|
|
6071
6071
|
}
|
|
6072
6072
|
} : {},
|
|
@@ -6118,7 +6118,7 @@ function cartesian(data, source, spec, type, h, colors) {
|
|
|
6118
6118
|
tooltip: {
|
|
6119
6119
|
trigger: "axis",
|
|
6120
6120
|
axisPointer: { type: type === "bar" ? "shadow" : "line" },
|
|
6121
|
-
valueFormatter: (
|
|
6121
|
+
valueFormatter: (v2) => fmt(v2),
|
|
6122
6122
|
// Your own tooltip: a title and lines, templates over the hovered category's `row`; **bold** marks values.
|
|
6123
6123
|
...spec.tooltip ? {
|
|
6124
6124
|
formatter: (params) => {
|
|
@@ -6126,8 +6126,8 @@ function cartesian(data, source, spec, type, h, colors) {
|
|
|
6126
6126
|
const row = firstRow.get(String(first?.axisValue ?? first?.name)) ?? {};
|
|
6127
6127
|
const fill = (t) => {
|
|
6128
6128
|
try {
|
|
6129
|
-
const
|
|
6130
|
-
return
|
|
6129
|
+
const v2 = interpolate(t, scope({ row }, h));
|
|
6130
|
+
return v2 === null || v2 === void 0 ? "" : String(v2);
|
|
6131
6131
|
} catch {
|
|
6132
6132
|
return "";
|
|
6133
6133
|
}
|
|
@@ -6293,7 +6293,7 @@ var PieChart2 = defineWidget({
|
|
|
6293
6293
|
() => ({
|
|
6294
6294
|
tooltip: {
|
|
6295
6295
|
trigger: "item",
|
|
6296
|
-
valueFormatter: (
|
|
6296
|
+
valueFormatter: (v2) => `${formatValue(v2, helpers, spec.format, spec.decimals)}${spec.unit ? ` ${spec.unit}` : ""}`
|
|
6297
6297
|
},
|
|
6298
6298
|
legend: { type: "scroll", bottom: 0 },
|
|
6299
6299
|
series: [
|
|
@@ -6351,8 +6351,8 @@ var Scatter = defineWidget({
|
|
|
6351
6351
|
name: g,
|
|
6352
6352
|
type: "scatter",
|
|
6353
6353
|
data: rows.filter((r) => !spec.series || String(field(r, spec.series)) === g).map((r) => {
|
|
6354
|
-
const
|
|
6355
|
-
return spec.size ? { value:
|
|
6354
|
+
const v2 = [toNumber(field(r, spec.x)), toNumber(field(r, spec.y))];
|
|
6355
|
+
return spec.size ? { value: v2, symbolSize: 6 + (toNumber(field(r, spec.size)) ?? 0) / max * 24 } : v2;
|
|
6356
6356
|
})
|
|
6357
6357
|
}))
|
|
6358
6358
|
};
|
|
@@ -6410,7 +6410,7 @@ var Gauge = defineWidget({
|
|
|
6410
6410
|
offsetCenter: [0, arc ? "30%" : 0],
|
|
6411
6411
|
fontSize: 22,
|
|
6412
6412
|
color: tokens?.theme[tokens.mode].text.primary,
|
|
6413
|
-
formatter: (
|
|
6413
|
+
formatter: (v2) => `${formatValue(v2, helpers, spec.format, spec.decimals)}${spec.unit ?? ""}`
|
|
6414
6414
|
},
|
|
6415
6415
|
data: [{ value, name: spec.title ?? "" }],
|
|
6416
6416
|
title: { show: false }
|
|
@@ -6460,7 +6460,7 @@ var MatrixChart = defineWidget({
|
|
|
6460
6460
|
option: {
|
|
6461
6461
|
grid: { left: 8, right: 8, top: 8, bottom: 40, containLabel: true },
|
|
6462
6462
|
tooltip: {
|
|
6463
|
-
valueFormatter: (
|
|
6463
|
+
valueFormatter: (v2) => `${formatValue(Array.isArray(v2) ? v2[2] : v2, helpers, spec.format, spec.decimals)}${spec.unit ? ` ${spec.unit}` : ""}`
|
|
6464
6464
|
},
|
|
6465
6465
|
xAxis: { type: "category", data: xs, splitArea: { show: true } },
|
|
6466
6466
|
yAxis: { type: "category", data: ys, splitArea: { show: true } },
|
|
@@ -6600,6 +6600,7 @@ var builtInWidgets = [
|
|
|
6600
6600
|
Status,
|
|
6601
6601
|
CardGrid,
|
|
6602
6602
|
ImageMap,
|
|
6603
|
+
FlowMap,
|
|
6603
6604
|
Sparkline,
|
|
6604
6605
|
Content,
|
|
6605
6606
|
Image,
|
|
@@ -6869,11 +6870,11 @@ function Grid({
|
|
|
6869
6870
|
|
|
6870
6871
|
// src/components/ModalHost.tsx
|
|
6871
6872
|
import { useCallback as useCallback6, useEffect as useEffect9, useRef as useRef10 } from "react";
|
|
6872
|
-
import { jsx as jsx28, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
6873
|
+
import { Fragment as Fragment10, jsx as jsx28, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
6873
6874
|
var WIDTH = { sm: "420px", md: "720px", lg: "1040px", xl: "1320px", full: "100%" };
|
|
6874
6875
|
var FOCUSABLE2 = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
6875
6876
|
function ModalHost() {
|
|
6876
|
-
const { runtime } = useDashboard();
|
|
6877
|
+
const { runtime, options } = useDashboard();
|
|
6877
6878
|
const modals = runtime.doc.spec.modals ?? {};
|
|
6878
6879
|
const open = useTree(
|
|
6879
6880
|
// biome-ignore lint/correctness/useExhaustiveDependencies: modals are fixed per runtime
|
|
@@ -6882,10 +6883,10 @@ function ModalHost() {
|
|
|
6882
6883
|
const byExpression = useTree(
|
|
6883
6884
|
// biome-ignore lint/correctness/useExhaustiveDependencies: modals are fixed per runtime
|
|
6884
6885
|
useCallback6(
|
|
6885
|
-
(t) => Object.entries(modals).filter(([,
|
|
6886
|
-
if (typeof
|
|
6886
|
+
(t) => Object.entries(modals).filter(([, m]) => {
|
|
6887
|
+
if (typeof m.open !== "string") return false;
|
|
6887
6888
|
try {
|
|
6888
|
-
return Boolean(interpolate(
|
|
6889
|
+
return Boolean(interpolate(m.open, rootScope(t, runtime.helpers)));
|
|
6889
6890
|
} catch {
|
|
6890
6891
|
return false;
|
|
6891
6892
|
}
|
|
@@ -6909,9 +6910,9 @@ function ModalHost() {
|
|
|
6909
6910
|
}
|
|
6910
6911
|
}, [byExpression, runtime]);
|
|
6911
6912
|
function titleOf(t, id) {
|
|
6912
|
-
const
|
|
6913
|
+
const m = modals[id];
|
|
6913
6914
|
try {
|
|
6914
|
-
return
|
|
6915
|
+
return m?.title ? String(interpolate(m.title, rootScope(t, runtime.helpers)) ?? "") : "";
|
|
6915
6916
|
} catch {
|
|
6916
6917
|
return "";
|
|
6917
6918
|
}
|
|
@@ -6928,8 +6929,9 @@ function ModalHost() {
|
|
|
6928
6929
|
}, [openId, runtime, modals]);
|
|
6929
6930
|
const closeRef = useRef10(close);
|
|
6930
6931
|
closeRef.current = close;
|
|
6932
|
+
const hostDrawerOpen = Boolean(options.ui?.Drawer && openId && modals[openId]?.presentation === "drawer");
|
|
6931
6933
|
useEffect9(() => {
|
|
6932
|
-
if (!openId) return;
|
|
6934
|
+
if (!openId || hostDrawerOpen) return;
|
|
6933
6935
|
const prev = document.activeElement;
|
|
6934
6936
|
dialog.current?.focus();
|
|
6935
6937
|
const onKey = (e) => {
|
|
@@ -6964,35 +6966,56 @@ function ModalHost() {
|
|
|
6964
6966
|
for (const el of siblings) el.removeAttribute("inert");
|
|
6965
6967
|
prev?.focus?.();
|
|
6966
6968
|
};
|
|
6967
|
-
}, [openId]);
|
|
6969
|
+
}, [openId, hostDrawerOpen]);
|
|
6968
6970
|
const hidden = useHiddenPanels(open ? Object.keys(modals[open.id]?.panels ?? {}) : []);
|
|
6969
|
-
|
|
6970
|
-
const
|
|
6971
|
-
|
|
6972
|
-
|
|
6973
|
-
|
|
6974
|
-
|
|
6975
|
-
|
|
6976
|
-
|
|
6977
|
-
|
|
6978
|
-
|
|
6979
|
-
|
|
6980
|
-
|
|
6981
|
-
|
|
6982
|
-
|
|
6983
|
-
|
|
6984
|
-
|
|
6985
|
-
|
|
6986
|
-
|
|
6987
|
-
|
|
6988
|
-
|
|
6989
|
-
|
|
6990
|
-
|
|
6991
|
-
|
|
6992
|
-
|
|
6993
|
-
|
|
6994
|
-
|
|
6995
|
-
|
|
6971
|
+
const HostDrawer = options.ui?.Drawer;
|
|
6972
|
+
const available = useTree(
|
|
6973
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: modals are fixed per runtime
|
|
6974
|
+
useCallback6(
|
|
6975
|
+
(t) => Object.entries(modals).filter(([, m]) => {
|
|
6976
|
+
if (typeof m.availableWhen !== "string") return true;
|
|
6977
|
+
try {
|
|
6978
|
+
return Boolean(evaluate(m.availableWhen, rootScope(t, runtime.helpers)));
|
|
6979
|
+
} catch {
|
|
6980
|
+
return false;
|
|
6981
|
+
}
|
|
6982
|
+
}).map(([id]) => id).join("\0"),
|
|
6983
|
+
[runtime]
|
|
6984
|
+
),
|
|
6985
|
+
Object.is
|
|
6986
|
+
).split("\0");
|
|
6987
|
+
useEffect9(() => {
|
|
6988
|
+
if (openId && modals[openId]?.availableWhen && !available.includes(openId))
|
|
6989
|
+
runtime.store.dispatch(stateActions.closeModal());
|
|
6990
|
+
});
|
|
6991
|
+
const lastArgs = useRef10(/* @__PURE__ */ new Map());
|
|
6992
|
+
const openArgs = useTree(
|
|
6993
|
+
useCallback6((t) => t.modal ? t.modal.args : void 0, []),
|
|
6994
|
+
Object.is
|
|
6995
|
+
);
|
|
6996
|
+
if (open?.id) lastArgs.current.set(open.id, openArgs);
|
|
6997
|
+
if (HostDrawer) {
|
|
6998
|
+
const drawers = Object.entries(modals).filter(
|
|
6999
|
+
([id, m]) => m.presentation === "drawer" && (!m.availableWhen || available.includes(id))
|
|
7000
|
+
);
|
|
7001
|
+
if (drawers.length) {
|
|
7002
|
+
const grid = runtime.doc.spec.grid;
|
|
7003
|
+
const drawerEls = /* @__PURE__ */ jsx28(Fragment10, { children: drawers.map(([id, m]) => {
|
|
7004
|
+
const isOpen = open?.id === id;
|
|
7005
|
+
return /* @__PURE__ */ jsx28(
|
|
7006
|
+
HostDrawer,
|
|
7007
|
+
{
|
|
7008
|
+
id,
|
|
7009
|
+
open: isOpen,
|
|
7010
|
+
title: isOpen ? open.title : "",
|
|
7011
|
+
onClose: isOpen ? close : () => {
|
|
7012
|
+
},
|
|
7013
|
+
onReopen: () => void runtime.runAction({
|
|
7014
|
+
do: "openModal",
|
|
7015
|
+
modal: id,
|
|
7016
|
+
args: lastArgs.current.get(id) ?? m.defaultArgs
|
|
7017
|
+
}),
|
|
7018
|
+
children: isOpen ? /* @__PURE__ */ jsx28(
|
|
6996
7019
|
Grid,
|
|
6997
7020
|
{
|
|
6998
7021
|
layouts: [{ items: m.layout }],
|
|
@@ -7001,14 +7024,68 @@ function ModalHost() {
|
|
|
7001
7024
|
columns: grid.columns,
|
|
7002
7025
|
rowHeight: grid.rowHeight,
|
|
7003
7026
|
gap: grid.gap,
|
|
7004
|
-
|
|
7027
|
+
exactHeights: grid.exactHeights,
|
|
7028
|
+
children: (pid) => /* @__PURE__ */ jsx28(PanelFrame, { id: pid })
|
|
7005
7029
|
}
|
|
7006
|
-
)
|
|
7007
|
-
|
|
7008
|
-
|
|
7009
|
-
|
|
7030
|
+
) : null
|
|
7031
|
+
},
|
|
7032
|
+
id
|
|
7033
|
+
);
|
|
7034
|
+
}) });
|
|
7035
|
+
if (!open || modals[open.id]?.presentation === "drawer") return drawerEls;
|
|
7036
|
+
return /* @__PURE__ */ jsxs21(Fragment10, { children: [
|
|
7037
|
+
drawerEls,
|
|
7038
|
+
renderModal(open)
|
|
7039
|
+
] });
|
|
7010
7040
|
}
|
|
7011
|
-
|
|
7041
|
+
}
|
|
7042
|
+
if (!open) return null;
|
|
7043
|
+
return renderModal(open);
|
|
7044
|
+
function renderModal(open2) {
|
|
7045
|
+
const m = modals[open2.id];
|
|
7046
|
+
if (!m) return null;
|
|
7047
|
+
const grid = runtime.doc.spec.grid;
|
|
7048
|
+
return /* @__PURE__ */ jsx28(
|
|
7049
|
+
"div",
|
|
7050
|
+
{
|
|
7051
|
+
ref: scrim,
|
|
7052
|
+
className: "ds-scrim",
|
|
7053
|
+
"data-presentation": m.presentation ?? "modal",
|
|
7054
|
+
onMouseDown: (e) => e.target === e.currentTarget && close(),
|
|
7055
|
+
children: /* @__PURE__ */ jsxs21(
|
|
7056
|
+
"dialog",
|
|
7057
|
+
{
|
|
7058
|
+
open: true,
|
|
7059
|
+
className: "ds-dialog",
|
|
7060
|
+
"aria-modal": "true",
|
|
7061
|
+
"aria-label": open2.title || open2.id,
|
|
7062
|
+
tabIndex: -1,
|
|
7063
|
+
ref: dialog,
|
|
7064
|
+
style: { ["--ds-dialog-w"]: WIDTH[m.size ?? "md"] ?? WIDTH.md },
|
|
7065
|
+
children: [
|
|
7066
|
+
/* @__PURE__ */ jsxs21("div", { className: "ds-dialog-head", children: [
|
|
7067
|
+
/* @__PURE__ */ jsx28("h2", { children: open2.title }),
|
|
7068
|
+
/* @__PURE__ */ jsx28("button", { type: "button", className: "ds-close", "aria-label": "Close", onClick: close, children: "\xD7" })
|
|
7069
|
+
] }),
|
|
7070
|
+
/* @__PURE__ */ jsx28(
|
|
7071
|
+
Grid,
|
|
7072
|
+
{
|
|
7073
|
+
layouts: [{ items: m.layout }],
|
|
7074
|
+
hidden,
|
|
7075
|
+
view: null,
|
|
7076
|
+
columns: grid.columns,
|
|
7077
|
+
rowHeight: grid.rowHeight,
|
|
7078
|
+
gap: grid.gap,
|
|
7079
|
+
exactHeights: grid.exactHeights,
|
|
7080
|
+
children: (id) => /* @__PURE__ */ jsx28(PanelFrame, { id })
|
|
7081
|
+
}
|
|
7082
|
+
)
|
|
7083
|
+
]
|
|
7084
|
+
}
|
|
7085
|
+
)
|
|
7086
|
+
}
|
|
7087
|
+
);
|
|
7088
|
+
}
|
|
7012
7089
|
}
|
|
7013
7090
|
|
|
7014
7091
|
// src/components/Provider.tsx
|
|
@@ -7035,7 +7112,7 @@ var LISTS = ["designSystems", "widgets", "datasourceTypes", "trustedOrigins"];
|
|
|
7035
7112
|
var MAPS = ["aliases", "actions", "functions", "themes", "context", "data", "connections", "connectionMap"];
|
|
7036
7113
|
function mergeSettings(outer, inner) {
|
|
7037
7114
|
const out = { ...outer };
|
|
7038
|
-
for (const [k,
|
|
7115
|
+
for (const [k, v2] of Object.entries(inner)) if (v2 !== void 0) out[k] = v2;
|
|
7039
7116
|
const o = outer;
|
|
7040
7117
|
const i = inner;
|
|
7041
7118
|
for (const k of LISTS)
|
|
@@ -7048,7 +7125,7 @@ function mergeSettings(outer, inner) {
|
|
|
7048
7125
|
}
|
|
7049
7126
|
return out;
|
|
7050
7127
|
}
|
|
7051
|
-
var isObj = (
|
|
7128
|
+
var isObj = (v2) => v2 !== null && typeof v2 === "object" && !Array.isArray(v2);
|
|
7052
7129
|
var THEME_MODES = /* @__PURE__ */ new Set(["light", "dark", "auto"]);
|
|
7053
7130
|
function pickTheme(name, themes, fallback) {
|
|
7054
7131
|
if (typeof name !== "string" || !name) return { theme: fallback, mode: fallback.mode };
|
|
@@ -7062,7 +7139,7 @@ function pickTheme(name, themes, fallback) {
|
|
|
7062
7139
|
|
|
7063
7140
|
// src/components/Tour.tsx
|
|
7064
7141
|
import { useCallback as useCallback7, useEffect as useEffect10, useId as useId5, useLayoutEffect as useLayoutEffect3, useRef as useRef12, useState as useState9 } from "react";
|
|
7065
|
-
import { Fragment as
|
|
7142
|
+
import { Fragment as Fragment11, jsx as jsx30, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
7066
7143
|
var useClientLayoutEffect = typeof window === "undefined" ? useEffect10 : useLayoutEffect3;
|
|
7067
7144
|
function panelElement(root, id) {
|
|
7068
7145
|
if (!root || !id) return null;
|
|
@@ -7085,12 +7162,12 @@ function TourButton({ steps }) {
|
|
|
7085
7162
|
(t) => {
|
|
7086
7163
|
if (!step) return null;
|
|
7087
7164
|
const sc = rootScope(t, runtime.helpers);
|
|
7088
|
-
const fill = (
|
|
7089
|
-
if (!
|
|
7165
|
+
const fill = (v2) => {
|
|
7166
|
+
if (!v2) return "";
|
|
7090
7167
|
try {
|
|
7091
|
-
return String(interpolate(
|
|
7168
|
+
return String(interpolate(v2, sc) ?? "");
|
|
7092
7169
|
} catch {
|
|
7093
|
-
return
|
|
7170
|
+
return v2;
|
|
7094
7171
|
}
|
|
7095
7172
|
};
|
|
7096
7173
|
return { title: fill(step.title), text: fill(step.text) };
|
|
@@ -7139,7 +7216,7 @@ function TourButton({ steps }) {
|
|
|
7139
7216
|
}, [isOpen]);
|
|
7140
7217
|
if (steps.length === 0) return null;
|
|
7141
7218
|
const last = at === steps.length - 1;
|
|
7142
|
-
return /* @__PURE__ */ jsxs22(
|
|
7219
|
+
return /* @__PURE__ */ jsxs22(Fragment11, { children: [
|
|
7143
7220
|
/* @__PURE__ */ jsx30(
|
|
7144
7221
|
"button",
|
|
7145
7222
|
{
|
|
@@ -7821,25 +7898,64 @@ var RENDERER_CSS = `
|
|
|
7821
7898
|
.ds-repeater { height: 100%; overflow: auto; }
|
|
7822
7899
|
.ds-repeater-item { display: flex; flex-direction: column; gap: 8px; }
|
|
7823
7900
|
.ds-repeater-item > .ds-panel { height: auto; }
|
|
7901
|
+
/* FlowMap: a process flow; every colour from the theme, so it works in light and dark */
|
|
7902
|
+
.ds-flow { display: block; min-width: 0; }
|
|
7903
|
+
.ds-flow-scroll { flex: none; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
|
|
7904
|
+
.ds-flow-svg { display: block; width: 100%; height: auto; margin: 0 auto; }
|
|
7905
|
+
.ds-flow-track { fill: none; stroke: var(--ds-flow-track, var(--ds-color-border-default)); stroke-width: var(--ds-flow-track-width, 6); stroke-linecap: round; stroke-linejoin: round; }
|
|
7906
|
+
.ds-flow-track[data-dashed] { stroke-linecap: butt; stroke-dasharray: 5 2.5; }
|
|
7907
|
+
.ds-flow-chevron { fill: none; stroke: var(--ds-color-text-subtle); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
|
|
7908
|
+
.ds-flow-tag rect { fill: var(--ds-color-status-info-bg); }
|
|
7909
|
+
.ds-flow-tag text { font-family: var(--ds-font-heading); font-size: 11px; font-weight: 500; fill: var(--ds-color-status-info-fg); }
|
|
7910
|
+
.ds-flow-tag[data-dim] rect { fill: var(--ds-color-surface-table-header); }
|
|
7911
|
+
.ds-flow-tag[data-dim] text { fill: var(--ds-color-text-subtle); }
|
|
7912
|
+
.ds-flow-step { cursor: pointer; outline: none; }
|
|
7913
|
+
.ds-flow-step[data-untracked] { cursor: default; }
|
|
7914
|
+
.ds-flow-step:focus-visible .ds-flow-hit { stroke: var(--ds-color-border-focus); stroke-width: 2; }
|
|
7915
|
+
.ds-flow-hit { fill: transparent; pointer-events: all; }
|
|
7916
|
+
.ds-flow-label { font-family: var(--ds-font-heading); font-size: 14px; font-weight: 700; fill: var(--ds-color-text-primary); paint-order: stroke; stroke: var(--ds-color-surface-card); stroke-width: 6px; stroke-linejoin: round; }
|
|
7917
|
+
.ds-flow-label[data-selected] { font-size: 16px; }
|
|
7918
|
+
.ds-flow-step[data-untracked] .ds-flow-label { fill: var(--ds-color-text-disabled); }
|
|
7919
|
+
.ds-flow-untracked { fill: var(--ds-color-surface-card); stroke: var(--ds-color-text-disabled); stroke-width: 2; stroke-dasharray: 3 2; }
|
|
7920
|
+
.ds-flow-shape { stroke: var(--ds-color-surface-card); stroke-width: 3; paint-order: stroke; }
|
|
7921
|
+
.ds-flow-step[data-dim] .ds-flow-shape { fill: var(--ds-color-text-subtle); }
|
|
7922
|
+
.ds-flow-step[data-dim] image { filter: grayscale(1); }
|
|
7923
|
+
.ds-flow-halo { animation: ds-flow-pulse 1.2s ease-in-out infinite; }
|
|
7924
|
+
@keyframes ds-flow-pulse { 50% { opacity: .7; } }
|
|
7925
|
+
@media (prefers-reduced-motion: reduce) { .ds-flow-halo { animation: none; } }
|
|
7926
|
+
.ds-flow-chip rect { fill: var(--ds-color-surface-table-header); }
|
|
7927
|
+
.ds-flow-chip text { font-family: var(--ds-font-body); fill: var(--ds-color-text-primary); }
|
|
7928
|
+
.ds-flow-chip-value { font-size: 14px; font-weight: 700; }
|
|
7929
|
+
.ds-flow-chip-unit { font-size: 12px; font-weight: 400; fill: var(--ds-color-text-subtle); }
|
|
7930
|
+
.ds-flow-chip[data-tone="good"] rect { fill: var(--ds-color-status-good-bg); }
|
|
7931
|
+
.ds-flow-chip[data-tone="good"] text, .ds-flow-chip[data-tone="good"] .ds-flow-chip-unit { fill: var(--ds-color-status-good-fg); }
|
|
7932
|
+
.ds-flow-chip[data-tone="dim"] text, .ds-flow-chip[data-tone="dim"] .ds-flow-chip-unit { fill: var(--ds-color-text-subtle); }
|
|
7933
|
+
.ds-flow-chip[data-tone="selected"] rect { fill: var(--ds-color-surface-selection); }
|
|
7934
|
+
.ds-flow-chip[data-tone="selected"] text, .ds-flow-chip[data-tone="selected"] .ds-flow-chip-unit { fill: var(--ds-color-action-primary); }
|
|
7935
|
+
.ds-flow-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 20px; font-family: var(--ds-font-body); font-size: 12px; color: var(--ds-color-text-primary); }
|
|
7936
|
+
.ds-flow-legend li { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
|
|
7937
|
+
.ds-panel-tools .ds-flow-legend { flex: none; }
|
|
7938
|
+
.ds-flow-hover { position: fixed; z-index: var(--ds-z-tooltip); min-width: 220px; max-width: 320px; padding: 12px; border-radius: 12px; background: var(--ds-color-chart-tooltip-bg); color: var(--ds-color-chart-tooltip-text); box-shadow: var(--ds-shadow-overlay); backdrop-filter: blur(16px); }
|
|
7939
|
+
.ds-flow-hover > * { margin: 0; }
|
|
7824
7940
|
`;
|
|
7825
7941
|
|
|
7826
7942
|
// src/components/urlSync.ts
|
|
7827
|
-
function encodeValue(kind,
|
|
7828
|
-
if (
|
|
7829
|
-
if (kind === "DateRange" && typeof
|
|
7830
|
-
const r =
|
|
7943
|
+
function encodeValue(kind, v2) {
|
|
7944
|
+
if (v2 === null || v2 === void 0 || v2 === "" || Array.isArray(v2) && v2.length === 0) return null;
|
|
7945
|
+
if (kind === "DateRange" && typeof v2 === "object") {
|
|
7946
|
+
const r = v2;
|
|
7831
7947
|
return r.preset && r.preset !== "custom" ? r.preset : `${r.from}..${r.to}`;
|
|
7832
7948
|
}
|
|
7833
|
-
if (Array.isArray(
|
|
7834
|
-
if (typeof
|
|
7835
|
-
return String(
|
|
7949
|
+
if (Array.isArray(v2)) return v2.map(String).join(",");
|
|
7950
|
+
if (typeof v2 === "object") return JSON.stringify(v2);
|
|
7951
|
+
return String(v2);
|
|
7836
7952
|
}
|
|
7837
7953
|
function matchOption(def, s) {
|
|
7838
7954
|
const opts = def?.options;
|
|
7839
7955
|
if (!Array.isArray(opts)) return s;
|
|
7840
7956
|
for (const o of opts) {
|
|
7841
|
-
const
|
|
7842
|
-
if (String(
|
|
7957
|
+
const v2 = o && typeof o === "object" ? o.value : o;
|
|
7958
|
+
if (String(v2) === s) return v2;
|
|
7843
7959
|
}
|
|
7844
7960
|
return s;
|
|
7845
7961
|
}
|
|
@@ -7857,20 +7973,20 @@ function decodeValue(kind, s, def, time = {}) {
|
|
|
7857
7973
|
function readUrlState(search, variables, prefix, time = {}) {
|
|
7858
7974
|
const params = new URLSearchParams(search);
|
|
7859
7975
|
const filters = {};
|
|
7860
|
-
for (const
|
|
7861
|
-
if ((
|
|
7862
|
-
const raw = params.get(`${prefix}${
|
|
7863
|
-
if (raw !== null) filters[
|
|
7976
|
+
for (const v2 of variables) {
|
|
7977
|
+
if ((v2.persist ?? "url") !== "url") continue;
|
|
7978
|
+
const raw = params.get(`${prefix}${v2.name}`);
|
|
7979
|
+
if (raw !== null) filters[v2.name] = decodeValue(v2.kind, raw, v2, time);
|
|
7864
7980
|
}
|
|
7865
7981
|
const view = params.get(`${prefix}view`);
|
|
7866
7982
|
return { filters, view };
|
|
7867
7983
|
}
|
|
7868
7984
|
function writeUrlState(href, variables, prefix, filters, view) {
|
|
7869
7985
|
const url = new URL(href);
|
|
7870
|
-
for (const
|
|
7871
|
-
if ((
|
|
7872
|
-
const key = `${prefix}${
|
|
7873
|
-
const enc = encodeValue(
|
|
7986
|
+
for (const v2 of variables) {
|
|
7987
|
+
if ((v2.persist ?? "url") !== "url") continue;
|
|
7988
|
+
const key = `${prefix}${v2.name}`;
|
|
7989
|
+
const enc = encodeValue(v2.kind, filters[v2.name]);
|
|
7874
7990
|
if (enc === null) url.searchParams.delete(key);
|
|
7875
7991
|
else url.searchParams.set(key, enc);
|
|
7876
7992
|
}
|
|
@@ -7889,7 +8005,7 @@ function releaseDefaultPrefix(owner) {
|
|
|
7889
8005
|
}
|
|
7890
8006
|
|
|
7891
8007
|
// src/components/DashboardRenderer.tsx
|
|
7892
|
-
import { Fragment as
|
|
8008
|
+
import { Fragment as Fragment12, jsx as jsx31, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
7893
8009
|
function usesScripts(doc) {
|
|
7894
8010
|
const handler = (h) => {
|
|
7895
8011
|
if (typeof h === "string") return isCallbackSource(h);
|
|
@@ -7900,10 +8016,10 @@ function usesScripts(doc) {
|
|
|
7900
8016
|
}
|
|
7901
8017
|
return false;
|
|
7902
8018
|
};
|
|
7903
|
-
const walk = (
|
|
7904
|
-
if (Array.isArray(
|
|
7905
|
-
if (!
|
|
7906
|
-
const o =
|
|
8019
|
+
const walk = (v2) => {
|
|
8020
|
+
if (Array.isArray(v2)) return v2.some(walk);
|
|
8021
|
+
if (!v2 || typeof v2 !== "object") return false;
|
|
8022
|
+
const o = v2;
|
|
7907
8023
|
if (typeof o.fn === "string") return true;
|
|
7908
8024
|
if (o.do === "script" && typeof o.code === "string") return true;
|
|
7909
8025
|
for (const [k, x] of Object.entries(o)) {
|
|
@@ -7943,8 +8059,8 @@ var devWarn = (message) => {
|
|
|
7943
8059
|
function toCsv(rows) {
|
|
7944
8060
|
if (!Array.isArray(rows) || rows.length === 0) return "";
|
|
7945
8061
|
const cols = [...new Set(rows.flatMap((r) => r && typeof r === "object" ? Object.keys(r) : []))];
|
|
7946
|
-
const cell = (
|
|
7947
|
-
const s =
|
|
8062
|
+
const cell = (v2) => {
|
|
8063
|
+
const s = v2 === null || v2 === void 0 ? "" : typeof v2 === "object" ? JSON.stringify(v2) : String(v2);
|
|
7948
8064
|
return /[",\n]/.test(s) ? `"${s.replace(/"/g, '""')}"` : s;
|
|
7949
8065
|
};
|
|
7950
8066
|
return [cols.join(","), ...rows.map((r) => cols.map((c) => cell(r[c])).join(","))].join("\n");
|
|
@@ -8019,7 +8135,7 @@ var DashboardRenderer = forwardRef(
|
|
|
8019
8135
|
useEffect12(() => {
|
|
8020
8136
|
if (!needsSandbox || sandbox) return;
|
|
8021
8137
|
let cancelled = false;
|
|
8022
|
-
import("./sandbox-
|
|
8138
|
+
import("./sandbox-RCDZ7SDZ.js").then((m) => m.createSandboxRunner()).then((r) => !cancelled && setSandbox(r)).catch((e) => !cancelled && setSandboxError(String(e?.message ?? e)));
|
|
8023
8139
|
return () => {
|
|
8024
8140
|
cancelled = true;
|
|
8025
8141
|
};
|
|
@@ -8340,12 +8456,12 @@ function DashboardBody({
|
|
|
8340
8456
|
useCallback9(
|
|
8341
8457
|
(t) => {
|
|
8342
8458
|
const sc = rootScope(t, runtime.helpers);
|
|
8343
|
-
const text2 = (
|
|
8344
|
-
if (!
|
|
8459
|
+
const text2 = (v2) => {
|
|
8460
|
+
if (!v2) return void 0;
|
|
8345
8461
|
try {
|
|
8346
|
-
return String(interpolate(
|
|
8462
|
+
return String(interpolate(v2, sc) ?? "");
|
|
8347
8463
|
} catch {
|
|
8348
|
-
return
|
|
8464
|
+
return v2;
|
|
8349
8465
|
}
|
|
8350
8466
|
};
|
|
8351
8467
|
return {
|
|
@@ -8361,7 +8477,7 @@ function DashboardBody({
|
|
|
8361
8477
|
const grid = doc.spec.grid;
|
|
8362
8478
|
const tour = editable ? NO_STEPS : doc.spec.tour ?? NO_STEPS;
|
|
8363
8479
|
const hidden = useHiddenPanels(Object.keys(doc.spec.panels));
|
|
8364
|
-
return /* @__PURE__ */ jsxs23(
|
|
8480
|
+
return /* @__PURE__ */ jsxs23(Fragment12, { children: [
|
|
8365
8481
|
!hideHeader && (head.title || head.synced || tour.length > 0) && /* @__PURE__ */ jsxs23("div", { className: "ds-header", children: [
|
|
8366
8482
|
head.title && /* @__PURE__ */ jsx31("h2", { className: "ds-title", children: head.title }),
|
|
8367
8483
|
head.description && /* @__PURE__ */ jsx31("p", { className: "ds-desc", children: head.description }),
|
|
@@ -8390,7 +8506,7 @@ function DashboardBody({
|
|
|
8390
8506
|
flowStyle: (id, height) => {
|
|
8391
8507
|
const panel = doc.spec.panels[id];
|
|
8392
8508
|
const st = panel?.style;
|
|
8393
|
-
const px2 = (
|
|
8509
|
+
const px2 = (v2) => typeof v2 === "number" ? `${v2}px` : v2;
|
|
8394
8510
|
return {
|
|
8395
8511
|
flex: st?.flex ?? "1 1 100%",
|
|
8396
8512
|
// Charts and images size themselves to the card, so their card keeps its grid height; anything
|
|
@@ -8426,54 +8542,19 @@ function PartError({ what, error }) {
|
|
|
8426
8542
|
] });
|
|
8427
8543
|
}
|
|
8428
8544
|
|
|
8429
|
-
// src/
|
|
8430
|
-
|
|
8431
|
-
|
|
8432
|
-
|
|
8433
|
-
|
|
8434
|
-
|
|
8435
|
-
|
|
8436
|
-
|
|
8437
|
-
|
|
8438
|
-
|
|
8439
|
-
|
|
8440
|
-
|
|
8441
|
-
|
|
8442
|
-
...o.implements ? { implements: o.implements } : {},
|
|
8443
|
-
...o.exposes ? { exposes: o.exposes } : {},
|
|
8444
|
-
...o.frame ? { frame: o.frame } : {},
|
|
8445
|
-
...o.small ? { small: true } : {},
|
|
8446
|
-
events: eventNames,
|
|
8447
|
-
...o.slots ? { slots: Object.fromEntries(Object.values(o.slots).map((s) => [s, { label: s }])) } : {},
|
|
8448
|
-
component: function Wrapped(props) {
|
|
8449
|
-
const mapped = o.mapProps ? o.mapProps(props) : { ...props.spec, data: props.data };
|
|
8450
|
-
const handlers = {};
|
|
8451
|
-
for (const [prop, event] of Object.entries(o.events ?? {}))
|
|
8452
|
-
handlers[prop] = (value, ...rest) => props.emit(event, void 0, { value, args: [value, ...rest] });
|
|
8453
|
-
for (const [prop, path] of Object.entries(o.writes ?? {})) {
|
|
8454
|
-
const before = handlers[prop];
|
|
8455
|
-
handlers[prop] = (value, ...rest) => {
|
|
8456
|
-
props.store.set(path, value);
|
|
8457
|
-
before?.(value, ...rest);
|
|
8458
|
-
};
|
|
8459
|
-
}
|
|
8460
|
-
const slotProps = {};
|
|
8461
|
-
for (const [prop, slot] of Object.entries(o.slots ?? {})) slotProps[prop] = props.renderSlot(slot);
|
|
8462
|
-
return /* @__PURE__ */ jsx32(Component2, { ...mapped, ...handlers, ...slotProps });
|
|
8463
|
-
}
|
|
8464
|
-
});
|
|
8465
|
-
}
|
|
8466
|
-
function lazyWidget(def) {
|
|
8467
|
-
const { load, fallback, ...rest } = def;
|
|
8468
|
-
let Comp;
|
|
8469
|
-
return defineWidget({
|
|
8470
|
-
...rest,
|
|
8471
|
-
component: function LazyWidget(props) {
|
|
8472
|
-
Comp ??= lazy(load);
|
|
8473
|
-
return /* @__PURE__ */ jsx32(Suspense, { fallback: fallback ?? /* @__PURE__ */ jsx32("div", { className: "ds-skeleton", "aria-busy": "true" }), children: /* @__PURE__ */ jsx32(Comp, { ...props }) });
|
|
8474
|
-
}
|
|
8475
|
-
});
|
|
8476
|
-
}
|
|
8545
|
+
// src/theme/token.ts
|
|
8546
|
+
var kebab2 = (s) => s.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`);
|
|
8547
|
+
var v = (prefix, path) => `var(--ds-${prefix}-${path.split(".").map(kebab2).join("-")})`;
|
|
8548
|
+
var token = {
|
|
8549
|
+
/** A colour of the active mode: `token.color("status.good.fg")`. */
|
|
8550
|
+
color: (path) => v("color", path),
|
|
8551
|
+
/** A spacing step: `token.space("md")`. */
|
|
8552
|
+
space: (step) => v("space", step),
|
|
8553
|
+
/** A corner radius: `token.radius("card")`. */
|
|
8554
|
+
radius: (name) => v("radius", name),
|
|
8555
|
+
/** A font family: `token.font("heading")`. */
|
|
8556
|
+
font: (name) => `var(--ds-font-${name})`
|
|
8557
|
+
};
|
|
8477
8558
|
export {
|
|
8478
8559
|
ACTION_KINDS,
|
|
8479
8560
|
ACTION_SCHEMAS,
|
|
@@ -8595,6 +8676,7 @@ export {
|
|
|
8595
8676
|
themeCssVars,
|
|
8596
8677
|
themeStylesheet,
|
|
8597
8678
|
timeSettingsFor,
|
|
8679
|
+
token,
|
|
8598
8680
|
translator,
|
|
8599
8681
|
trustedRunner,
|
|
8600
8682
|
useDashSpecSettings,
|