@dashspec/renderer 0.1.28 → 0.1.30
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 +27 -0
- package/dist/{chunk-DHZPR7K7.js → chunk-76OGTPVF.js} +8 -3
- package/dist/chunk-76OGTPVF.js.map +1 -0
- package/dist/{core-CwFVyxKt.d.ts → core-CtA4jk0f.d.ts} +20 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +1 -1
- package/dist/index.d.ts +17 -5
- package/dist/index.js +69 -46
- package/dist/index.js.map +1 -1
- package/dist/schema.json +3 -0
- package/docs/json-format.md +1 -0
- package/docs/styling-hooks.md +1 -1
- package/docs/theming.md +7 -1
- package/package.json +1 -1
- package/dist/chunk-DHZPR7K7.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -116,7 +116,7 @@ import {
|
|
|
116
116
|
translator,
|
|
117
117
|
validateDocument,
|
|
118
118
|
widgetChecks
|
|
119
|
-
} from "./chunk-
|
|
119
|
+
} from "./chunk-76OGTPVF.js";
|
|
120
120
|
import {
|
|
121
121
|
createStateProxy,
|
|
122
122
|
getPath,
|
|
@@ -1695,6 +1695,7 @@ var DS_CLASSES = [
|
|
|
1695
1695
|
"ds-panel-foot",
|
|
1696
1696
|
"ds-panel-head",
|
|
1697
1697
|
"ds-panel-meta",
|
|
1698
|
+
"ds-panel-subtitle",
|
|
1698
1699
|
"ds-panel-title",
|
|
1699
1700
|
"ds-panel-toolbar",
|
|
1700
1701
|
"ds-panel-tools",
|
|
@@ -1807,6 +1808,9 @@ function themeCssVars(theme, mode) {
|
|
|
1807
1808
|
if (s.control?.iconSize) out["--ds-filter-icon-size"] = `${s.control.iconSize}px`;
|
|
1808
1809
|
if (s.control?.stepBackground && !UNSAFE_CSS.test(s.control.stepBackground))
|
|
1809
1810
|
out["--ds-control-step-bg"] = s.control.stepBackground;
|
|
1811
|
+
if (s.control?.valueColor && !UNSAFE_CSS.test(s.control.valueColor))
|
|
1812
|
+
out["--ds-control-value-color"] = s.control.valueColor;
|
|
1813
|
+
if (typeof s.control?.valueWeight === "number") out["--ds-control-value-weight"] = String(s.control.valueWeight);
|
|
1810
1814
|
flatten("--ds-shadow", s.shadow, out);
|
|
1811
1815
|
flatten("--ds-z", s.z, out);
|
|
1812
1816
|
out["--ds-motion-fast"] = `${s.motion.fast}ms`;
|
|
@@ -2316,6 +2320,7 @@ import { useCallback as useCallback2, useEffect as useEffect2, useId as useId3,
|
|
|
2316
2320
|
|
|
2317
2321
|
// src/components/controls.tsx
|
|
2318
2322
|
import {
|
|
2323
|
+
useContext as useContext3,
|
|
2319
2324
|
useEffect,
|
|
2320
2325
|
useId as useId2,
|
|
2321
2326
|
useLayoutEffect,
|
|
@@ -2324,7 +2329,7 @@ import {
|
|
|
2324
2329
|
useState
|
|
2325
2330
|
} from "react";
|
|
2326
2331
|
import { createPortal } from "react-dom";
|
|
2327
|
-
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
2332
|
+
import { Fragment as Fragment3, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
2328
2333
|
var Chevron = () => /* @__PURE__ */ jsx7("svg", { className: "ds-pill-chev", viewBox: "0 0 16 16", width: "14", height: "14", "aria-hidden": "true", children: /* @__PURE__ */ jsx7(
|
|
2329
2334
|
"path",
|
|
2330
2335
|
{
|
|
@@ -2336,7 +2341,12 @@ var Chevron = () => /* @__PURE__ */ jsx7("svg", { className: "ds-pill-chev", vie
|
|
|
2336
2341
|
strokeLinejoin: "round"
|
|
2337
2342
|
}
|
|
2338
2343
|
) });
|
|
2339
|
-
var Arrow = ({ dir }) =>
|
|
2344
|
+
var Arrow = ({ dir }) => {
|
|
2345
|
+
const icons = useContext3(DashboardContext)?.options.ui?.icons;
|
|
2346
|
+
const own = dir === "left" ? icons?.previous : icons?.next;
|
|
2347
|
+
return own ? /* @__PURE__ */ jsx7(Fragment3, { children: own }) : /* @__PURE__ */ jsx7(DefaultArrow, { dir });
|
|
2348
|
+
};
|
|
2349
|
+
var DefaultArrow = ({ dir }) => /* @__PURE__ */ jsx7("svg", { viewBox: "0 0 16 16", width: "15", height: "15", "aria-hidden": "true", children: /* @__PURE__ */ jsx7(
|
|
2340
2350
|
"path",
|
|
2341
2351
|
{
|
|
2342
2352
|
d: dir === "left" ? "M13 8H3m4-4L3 8l4 4" : "M3 8h10M9 4l4 4-4 4",
|
|
@@ -2471,7 +2481,7 @@ function PillTrigger({
|
|
|
2471
2481
|
value,
|
|
2472
2482
|
")"
|
|
2473
2483
|
] })
|
|
2474
|
-
] }) : /* @__PURE__ */ jsx7("span", { className: "ds-pill-value", children: value }),
|
|
2484
|
+
] }) : /* @__PURE__ */ jsx7("span", { className: "ds-pill-value ds-pill-value-only", children: value }),
|
|
2475
2485
|
/* @__PURE__ */ jsx7(Chevron, {})
|
|
2476
2486
|
]
|
|
2477
2487
|
}
|
|
@@ -3010,7 +3020,7 @@ function DateControl({
|
|
|
3010
3020
|
}
|
|
3011
3021
|
|
|
3012
3022
|
// src/components/FilterBar.tsx
|
|
3013
|
-
import { Fragment as
|
|
3023
|
+
import { Fragment as Fragment4, jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
3014
3024
|
var PRESET_LABELS = {
|
|
3015
3025
|
today: "Today",
|
|
3016
3026
|
yesterday: "Yesterday",
|
|
@@ -3309,7 +3319,7 @@ var icon = (d) => /* @__PURE__ */ jsx8(
|
|
|
3309
3319
|
);
|
|
3310
3320
|
var BAR_ICONS = {
|
|
3311
3321
|
sliders: icon(
|
|
3312
|
-
/* @__PURE__ */ jsxs6(
|
|
3322
|
+
/* @__PURE__ */ jsxs6(Fragment4, { children: [
|
|
3313
3323
|
/* @__PURE__ */ jsx8("path", { d: "M3 6h9M15 6h2M3 14h3M9 14h8" }),
|
|
3314
3324
|
/* @__PURE__ */ jsx8("circle", { cx: "13.5", cy: "6", r: "1.8" }),
|
|
3315
3325
|
/* @__PURE__ */ jsx8("circle", { cx: "7.5", cy: "14", r: "1.8" })
|
|
@@ -3317,13 +3327,13 @@ var BAR_ICONS = {
|
|
|
3317
3327
|
),
|
|
3318
3328
|
filter: icon(/* @__PURE__ */ jsx8("path", { d: "M3 4h14l-5.5 6.5V16l-3-1.5v-4z", strokeLinejoin: "round" })),
|
|
3319
3329
|
calendar: icon(
|
|
3320
|
-
/* @__PURE__ */ jsxs6(
|
|
3330
|
+
/* @__PURE__ */ jsxs6(Fragment4, { children: [
|
|
3321
3331
|
/* @__PURE__ */ jsx8("rect", { x: "3", y: "4.5", width: "14", height: "12", rx: "2" }),
|
|
3322
3332
|
/* @__PURE__ */ jsx8("path", { d: "M3 8.5h14M7 2.5v4M13 2.5v4" })
|
|
3323
3333
|
] })
|
|
3324
3334
|
),
|
|
3325
3335
|
search: icon(
|
|
3326
|
-
/* @__PURE__ */ jsxs6(
|
|
3336
|
+
/* @__PURE__ */ jsxs6(Fragment4, { children: [
|
|
3327
3337
|
/* @__PURE__ */ jsx8("circle", { cx: "9", cy: "9", r: "5" }),
|
|
3328
3338
|
/* @__PURE__ */ jsx8("path", { d: "M13 13l4 4" })
|
|
3329
3339
|
] })
|
|
@@ -3424,7 +3434,7 @@ function FilterBar() {
|
|
|
3424
3434
|
} : void 0,
|
|
3425
3435
|
children: [
|
|
3426
3436
|
/* @__PURE__ */ jsxs6(Track, { segmented: bar.look === "segmented", children: [
|
|
3427
|
-
bar.icon !== "none" && /* @__PURE__ */ jsx8("span", { className: "ds-filters-icon", "aria-hidden": "true", children: BAR_ICONS[bar.icon ?? "sliders"] ?? BAR_ICONS.sliders }),
|
|
3437
|
+
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 }),
|
|
3428
3438
|
shown.map(
|
|
3429
3439
|
(v) => options.onFilterSelect ? (
|
|
3430
3440
|
// Builder: a click selects the filter to configure it instead of opening it.
|
|
@@ -3553,7 +3563,7 @@ function FilterDrawer({ active, children }) {
|
|
|
3553
3563
|
] });
|
|
3554
3564
|
}
|
|
3555
3565
|
function Track({ segmented, children }) {
|
|
3556
|
-
return segmented ? /* @__PURE__ */ jsx8("div", { className: "ds-filters-track", children }) : /* @__PURE__ */ jsx8(
|
|
3566
|
+
return segmented ? /* @__PURE__ */ jsx8("div", { className: "ds-filters-track", children }) : /* @__PURE__ */ jsx8(Fragment4, { children });
|
|
3557
3567
|
}
|
|
3558
3568
|
|
|
3559
3569
|
// src/widgets/builtins/Filter.tsx
|
|
@@ -3766,7 +3776,7 @@ function InfoTip({ text }) {
|
|
|
3766
3776
|
}
|
|
3767
3777
|
|
|
3768
3778
|
// src/widgets/shared/clickable.ts
|
|
3769
|
-
import { useContext as
|
|
3779
|
+
import { useContext as useContext5 } from "react";
|
|
3770
3780
|
|
|
3771
3781
|
// src/components/PanelFrame.tsx
|
|
3772
3782
|
import { useCallback as useCallback4, useEffect as useEffect4, useId as useId4, useMemo as useMemo3, useRef as useRef5, useState as useState4 } from "react";
|
|
@@ -3826,10 +3836,10 @@ var Boundary = class extends Component {
|
|
|
3826
3836
|
};
|
|
3827
3837
|
|
|
3828
3838
|
// src/components/Slot.tsx
|
|
3829
|
-
import { createContext as createContext3, useContext as
|
|
3830
|
-
import { Fragment as
|
|
3839
|
+
import { createContext as createContext3, useContext as useContext4 } from "react";
|
|
3840
|
+
import { Fragment as Fragment5, jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3831
3841
|
var NodeScopeContext = createContext3({});
|
|
3832
|
-
var useNodeScope = () =>
|
|
3842
|
+
var useNodeScope = () => useContext4(NodeScopeContext);
|
|
3833
3843
|
var SlotOwnerContext = createContext3(null);
|
|
3834
3844
|
var SlotChildContext = createContext3(null);
|
|
3835
3845
|
function slotChildren(def, name) {
|
|
@@ -3847,9 +3857,9 @@ function Slot({
|
|
|
3847
3857
|
empty
|
|
3848
3858
|
}) {
|
|
3849
3859
|
const { options } = useDashboard();
|
|
3850
|
-
const owner =
|
|
3860
|
+
const owner = useContext4(SlotOwnerContext);
|
|
3851
3861
|
const outer = useNodeScope();
|
|
3852
|
-
const renderChild =
|
|
3862
|
+
const renderChild = useContext4(SlotChildContext);
|
|
3853
3863
|
if (!owner || !renderChild) return null;
|
|
3854
3864
|
const ids = slotChildren(owner.def, name);
|
|
3855
3865
|
const editing = options.mode === "edit";
|
|
@@ -3878,7 +3888,7 @@ function Slot({
|
|
|
3878
3888
|
}
|
|
3879
3889
|
) });
|
|
3880
3890
|
}
|
|
3881
|
-
var SlotItem = ({ children }) => /* @__PURE__ */ jsx13(
|
|
3891
|
+
var SlotItem = ({ children }) => /* @__PURE__ */ jsx13(Fragment5, { children });
|
|
3882
3892
|
|
|
3883
3893
|
// src/components/PanelFrame.tsx
|
|
3884
3894
|
import { jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
@@ -4262,6 +4272,7 @@ function PanelFrameInner({ id, nested }) {
|
|
|
4262
4272
|
if (!view.visible || view.hidden) return null;
|
|
4263
4273
|
const ownHeader = widget?.header === "widget";
|
|
4264
4274
|
const title = ownHeader ? void 0 : props.title;
|
|
4275
|
+
const subtitle = ownHeader || typeof props.subtitle !== "string" ? void 0 : props.subtitle || void 0;
|
|
4265
4276
|
const info = ownHeader ? void 0 : props.info;
|
|
4266
4277
|
const meta2 = props.meta;
|
|
4267
4278
|
const live2 = Boolean(props.live);
|
|
@@ -4271,7 +4282,7 @@ function PanelFrameInner({ id, nested }) {
|
|
|
4271
4282
|
const headerKids = slotChildren(def, "header");
|
|
4272
4283
|
const footerKids = slotChildren(def, "footer");
|
|
4273
4284
|
const toolbarKids = slotChildren(def, "toolbar");
|
|
4274
|
-
const hideHeader = Boolean(def.style?.hideHeader) || !title && !meta2 && !live2 && drill.length === 0 && controls.length === 0 && !view.stale && headerKids.length === 0;
|
|
4285
|
+
const hideHeader = Boolean(def.style?.hideHeader) || !title && !subtitle && !meta2 && !live2 && drill.length === 0 && controls.length === 0 && !view.stale && headerKids.length === 0;
|
|
4275
4286
|
const dnd = Boolean(options.onDropOnPanel);
|
|
4276
4287
|
let body;
|
|
4277
4288
|
if (!widget) body = /* @__PURE__ */ jsxs10("div", { className: "ds-state", children: [
|
|
@@ -4383,6 +4394,7 @@ function PanelFrameInner({ id, nested }) {
|
|
|
4383
4394
|
title,
|
|
4384
4395
|
info && /* @__PURE__ */ jsx14(InfoTip, { text: info })
|
|
4385
4396
|
] }),
|
|
4397
|
+
subtitle && /* @__PURE__ */ jsx14("p", { className: "ds-panel-subtitle", children: subtitle }),
|
|
4386
4398
|
drill.length > 0 && /* @__PURE__ */ jsxs10("nav", { className: "ds-crumbs", "aria-label": "Drill path", children: [
|
|
4387
4399
|
/* @__PURE__ */ jsx14("button", { type: "button", onClick: () => runtime.runAction({ do: "drillReset", panel: id }), children: "All" }),
|
|
4388
4400
|
drill.map((d, i) => /* @__PURE__ */ jsxs10("span", { children: [
|
|
@@ -4446,7 +4458,7 @@ function LoadingState({ text }) {
|
|
|
4446
4458
|
|
|
4447
4459
|
// src/widgets/shared/clickable.ts
|
|
4448
4460
|
function useClickable(panelId, activate) {
|
|
4449
|
-
const ctx =
|
|
4461
|
+
const ctx = useContext5(DashboardContext);
|
|
4450
4462
|
const def = ctx && panelId ? findPanel(ctx.runtime.doc, panelId) : void 0;
|
|
4451
4463
|
const on = def?.on;
|
|
4452
4464
|
if (on?.click === void 0) return { onClick: activate };
|
|
@@ -4494,7 +4506,7 @@ function useCountUp(target, ms = 700) {
|
|
|
4494
4506
|
}
|
|
4495
4507
|
|
|
4496
4508
|
// src/widgets/builtins/Kpi.tsx
|
|
4497
|
-
import { Fragment as
|
|
4509
|
+
import { Fragment as Fragment6, jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
4498
4510
|
var Kpi = defineWidget({
|
|
4499
4511
|
...KpiContract,
|
|
4500
4512
|
implements: "kpi",
|
|
@@ -4545,7 +4557,7 @@ var Kpi = defineWidget({
|
|
|
4545
4557
|
children: empty ? (
|
|
4546
4558
|
// No value is not zero: the author's text, else a dash.
|
|
4547
4559
|
/* @__PURE__ */ jsx15("span", { className: "ds-kpi-empty", children: spec.emptyText || "\u2014" })
|
|
4548
|
-
) : /* @__PURE__ */ jsxs11(
|
|
4560
|
+
) : /* @__PURE__ */ jsxs11(Fragment6, { children: [
|
|
4549
4561
|
/* @__PURE__ */ jsxs11(
|
|
4550
4562
|
"span",
|
|
4551
4563
|
{
|
|
@@ -5317,7 +5329,7 @@ var Table = defineWidget({
|
|
|
5317
5329
|
|
|
5318
5330
|
// src/widgets/builtins/Tiles.tsx
|
|
5319
5331
|
import "zod";
|
|
5320
|
-
import { Fragment as
|
|
5332
|
+
import { Fragment as Fragment7, jsx as jsx22, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
5321
5333
|
var Tiles = defineWidget({
|
|
5322
5334
|
...TilesContract,
|
|
5323
5335
|
implements: "tiles",
|
|
@@ -5401,7 +5413,7 @@ var Tiles = defineWidget({
|
|
|
5401
5413
|
return spec.captionInline ? /* @__PURE__ */ jsxs17("span", { className: "ds-tile-main", children: [
|
|
5402
5414
|
valueEl,
|
|
5403
5415
|
capEl
|
|
5404
|
-
] }) : /* @__PURE__ */ jsxs17(
|
|
5416
|
+
] }) : /* @__PURE__ */ jsxs17(Fragment7, { children: [
|
|
5405
5417
|
valueEl,
|
|
5406
5418
|
capEl
|
|
5407
5419
|
] });
|
|
@@ -5419,7 +5431,7 @@ var Tiles = defineWidget({
|
|
|
5419
5431
|
function CountUp({ value, render }) {
|
|
5420
5432
|
const n = toNumber(value);
|
|
5421
5433
|
const shown = useCountUp(n ?? value);
|
|
5422
|
-
return /* @__PURE__ */ jsx22(
|
|
5434
|
+
return /* @__PURE__ */ jsx22(Fragment7, { children: render(n === void 0 ? value : shown) });
|
|
5423
5435
|
}
|
|
5424
5436
|
function tplValue(t, row, helpers) {
|
|
5425
5437
|
try {
|
|
@@ -6039,7 +6051,7 @@ function cartesian(data, source, spec, type, h, colors) {
|
|
|
6039
6051
|
}
|
|
6040
6052
|
|
|
6041
6053
|
// src/widgets/builtins/charts.tsx
|
|
6042
|
-
import { Fragment as
|
|
6054
|
+
import { Fragment as Fragment8, jsx as jsx25, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
6043
6055
|
var chartEvents = ["click", "doubleClick", "hover", "hoverEnd", "legendClick", "brush", "datazoom"];
|
|
6044
6056
|
var BarChart2 = defineWidget({
|
|
6045
6057
|
...BarChartContract,
|
|
@@ -6070,7 +6082,7 @@ var BarChart2 = defineWidget({
|
|
|
6070
6082
|
const legend = c.coloured || avgText || c.legend.length > 0;
|
|
6071
6083
|
return /* @__PURE__ */ jsxs19("div", { className: "ds-chart", children: [
|
|
6072
6084
|
legend && /* @__PURE__ */ jsxs19("ul", { className: "ds-chart-legend", children: [
|
|
6073
|
-
c.coloured && /* @__PURE__ */ jsxs19(
|
|
6085
|
+
c.coloured && /* @__PURE__ */ jsxs19(Fragment8, { children: [
|
|
6074
6086
|
/* @__PURE__ */ jsxs19("li", { children: [
|
|
6075
6087
|
/* @__PURE__ */ jsx25("span", { className: "ds-swatch", style: { background: colors?.good } }),
|
|
6076
6088
|
spec.legendLabels?.above ?? "At or above avg"
|
|
@@ -6358,7 +6370,7 @@ var MatrixChart = defineWidget({
|
|
|
6358
6370
|
});
|
|
6359
6371
|
|
|
6360
6372
|
// src/widgets/builtins/layout.tsx
|
|
6361
|
-
import { Fragment as
|
|
6373
|
+
import { Fragment as Fragment9 } from "react";
|
|
6362
6374
|
import "zod";
|
|
6363
6375
|
import { jsx as jsx26, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
6364
6376
|
var Row = defineWidget({
|
|
@@ -6440,7 +6452,7 @@ var Repeater = defineWidget({
|
|
|
6440
6452
|
}) }) : /* @__PURE__ */ jsx26("div", { className: "ds-state", children: spec.emptyText });
|
|
6441
6453
|
return /* @__PURE__ */ jsx26("div", { className: "ds-repeater", style, children: rows.map((row, i) => (
|
|
6442
6454
|
// biome-ignore lint/suspicious/noArrayIndexKey: rows have no guaranteed id
|
|
6443
|
-
/* @__PURE__ */ jsx26(
|
|
6455
|
+
/* @__PURE__ */ jsx26(Fragment9, { children: renderSlot("item", { item: row, index: i, className: "ds-repeater-item" }) }, i)
|
|
6444
6456
|
)) });
|
|
6445
6457
|
}
|
|
6446
6458
|
});
|
|
@@ -6527,6 +6539,7 @@ function Grid({
|
|
|
6527
6539
|
columns,
|
|
6528
6540
|
rowHeight,
|
|
6529
6541
|
gap,
|
|
6542
|
+
exactHeights = false,
|
|
6530
6543
|
children,
|
|
6531
6544
|
editable = false,
|
|
6532
6545
|
onLayoutChange,
|
|
@@ -6553,15 +6566,19 @@ function Grid({
|
|
|
6553
6566
|
return () => ro.disconnect();
|
|
6554
6567
|
}, [wrapEl]);
|
|
6555
6568
|
const base = useMemo7(() => layoutsForView(layouts, view, columns), [layouts, view, columns]);
|
|
6569
|
+
const exact = exactHeights && !editable;
|
|
6570
|
+
const unit = rowHeight + gap;
|
|
6556
6571
|
const { rgl, panels, cols } = useMemo7(() => {
|
|
6557
|
-
|
|
6572
|
+
const scale2 = (l) => exact ? (l ?? []).map((i) => ({ ...i, y: i.y * unit, h: i.h * unit, minH: void 0, maxH: void 0 })) : l ?? [];
|
|
6573
|
+
const scaled = exact ? Object.fromEntries(Object.entries(base.layouts).map(([bp, l]) => [bp, scale2(l)])) : base.layouts;
|
|
6574
|
+
if (!hidden?.size || editable) return { rgl: scaled, panels: base.panels, cols: base.cols };
|
|
6558
6575
|
const keep = (l) => (l ?? []).filter((i) => !hidden.has(i.i));
|
|
6559
6576
|
return {
|
|
6560
|
-
rgl: Object.fromEntries(Object.entries(
|
|
6577
|
+
rgl: Object.fromEntries(Object.entries(scaled).map(([bp, l]) => [bp, keep(l)])),
|
|
6561
6578
|
panels: base.panels.filter((p) => !hidden.has(p)),
|
|
6562
6579
|
cols: base.cols
|
|
6563
6580
|
};
|
|
6564
|
-
}, [base, hidden, editable]);
|
|
6581
|
+
}, [base, hidden, editable, exact, unit]);
|
|
6565
6582
|
const [fitRows, setFitRows] = useState7({});
|
|
6566
6583
|
const fitted = useMemo7(() => {
|
|
6567
6584
|
if (editable || base.fit.size === 0) return rgl;
|
|
@@ -6576,12 +6593,12 @@ function Grid({
|
|
|
6576
6593
|
}
|
|
6577
6594
|
return (l ?? []).map((i) => {
|
|
6578
6595
|
const want = base.fit.has(i.i) ? rowWant.get(i.y) : void 0;
|
|
6579
|
-
return want && want > i.h ? { ...i, h: want } : i;
|
|
6596
|
+
return want && (exact || want > i.h) ? { ...i, h: want } : i;
|
|
6580
6597
|
});
|
|
6581
6598
|
})()
|
|
6582
6599
|
])
|
|
6583
6600
|
);
|
|
6584
|
-
}, [rgl, base.fit, fitRows, editable]);
|
|
6601
|
+
}, [rgl, base.fit, fitRows, editable, exact]);
|
|
6585
6602
|
const observeFit = (panel) => (el) => {
|
|
6586
6603
|
const prev = fitObservers.current.get(panel);
|
|
6587
6604
|
if (prev) {
|
|
@@ -6595,7 +6612,7 @@ function Grid({
|
|
|
6595
6612
|
const px = target2?.offsetHeight ?? 0;
|
|
6596
6613
|
el.removeAttribute("data-measuring");
|
|
6597
6614
|
if (!px) return;
|
|
6598
|
-
const rows = Math.ceil((px + gap) / (rowHeight + gap));
|
|
6615
|
+
const rows = exact ? Math.ceil(px) + gap : Math.ceil((px + gap) / (rowHeight + gap));
|
|
6599
6616
|
setFitRows((r) => {
|
|
6600
6617
|
const cur = r[panel];
|
|
6601
6618
|
if (cur === rows) return r;
|
|
@@ -6658,12 +6675,13 @@ function Grid({
|
|
|
6658
6675
|
return /* @__PURE__ */ jsx27("div", { ref: setWrapEl, children: /* @__PURE__ */ jsx27(
|
|
6659
6676
|
ResponsiveGrid,
|
|
6660
6677
|
{
|
|
6661
|
-
className: editable ? "ds-grid ds-grid-edit" : "ds-grid",
|
|
6678
|
+
className: editable ? "ds-grid ds-grid-edit" : exact ? "ds-grid ds-grid-exact" : "ds-grid",
|
|
6679
|
+
style: exact ? { "--ds-grid-gap": `${gap}px` } : void 0,
|
|
6662
6680
|
layouts: breakpoint ? { [breakpoint]: rgl[breakpoint] ?? [] } : fitted,
|
|
6663
6681
|
breakpoints: breakpoint ? { [breakpoint]: 0 } : BREAKPOINT_MIN,
|
|
6664
6682
|
cols: breakpoint ? { [breakpoint]: cols[breakpoint] } : cols,
|
|
6665
|
-
rowHeight,
|
|
6666
|
-
margin: [gap, gap],
|
|
6683
|
+
rowHeight: exact ? 1 : rowHeight,
|
|
6684
|
+
margin: exact ? [gap, 0] : [gap, gap],
|
|
6667
6685
|
containerPadding: [0, 0],
|
|
6668
6686
|
isDraggable: editable,
|
|
6669
6687
|
isResizable: editable,
|
|
@@ -6846,11 +6864,11 @@ function ModalHost() {
|
|
|
6846
6864
|
}
|
|
6847
6865
|
|
|
6848
6866
|
// src/components/Provider.tsx
|
|
6849
|
-
import { createContext as createContext4, useContext as
|
|
6867
|
+
import { createContext as createContext4, useContext as useContext6, useRef as useRef11 } from "react";
|
|
6850
6868
|
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
6851
6869
|
var SettingsContext = createContext4({});
|
|
6852
6870
|
function DashSpecProvider({ children, ...settings }) {
|
|
6853
|
-
const outer =
|
|
6871
|
+
const outer = useContext6(SettingsContext);
|
|
6854
6872
|
const last = useRef11(
|
|
6855
6873
|
void 0
|
|
6856
6874
|
);
|
|
@@ -6863,7 +6881,7 @@ function shallowEqual2(a, b) {
|
|
|
6863
6881
|
return ka.length === Object.keys(b).length && ka.every((k) => Object.is(a[k], b[k]));
|
|
6864
6882
|
}
|
|
6865
6883
|
function useDashSpecSettings() {
|
|
6866
|
-
return
|
|
6884
|
+
return useContext6(SettingsContext);
|
|
6867
6885
|
}
|
|
6868
6886
|
var LISTS = ["designSystems", "widgets", "datasourceTypes", "trustedOrigins"];
|
|
6869
6887
|
var MAPS = ["aliases", "actions", "functions", "themes", "context", "data", "connections", "connectionMap"];
|
|
@@ -6877,7 +6895,8 @@ function mergeSettings(outer, inner) {
|
|
|
6877
6895
|
for (const k of MAPS) if (isObj(o[k]) && isObj(i[k])) out[k] = { ...o[k], ...i[k] };
|
|
6878
6896
|
if (isObj(o.ui) && isObj(i.ui)) {
|
|
6879
6897
|
const filters = isObj(o.ui.filters) && isObj(i.ui.filters) ? { ...o.ui.filters, ...i.ui.filters } : i.ui.filters ?? o.ui.filters;
|
|
6880
|
-
|
|
6898
|
+
const icons = isObj(o.ui.icons) && isObj(i.ui.icons) ? { ...o.ui.icons, ...i.ui.icons } : i.ui.icons ?? o.ui.icons;
|
|
6899
|
+
out.ui = { ...o.ui, ...i.ui, ...filters ? { filters } : {}, ...icons ? { icons } : {} };
|
|
6881
6900
|
}
|
|
6882
6901
|
return out;
|
|
6883
6902
|
}
|
|
@@ -6895,7 +6914,7 @@ function pickTheme(name, themes, fallback) {
|
|
|
6895
6914
|
|
|
6896
6915
|
// src/components/Tour.tsx
|
|
6897
6916
|
import { useCallback as useCallback6, useEffect as useEffect10, useId as useId5, useLayoutEffect as useLayoutEffect3, useRef as useRef12, useState as useState8 } from "react";
|
|
6898
|
-
import { Fragment as
|
|
6917
|
+
import { Fragment as Fragment10, jsx as jsx30, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
6899
6918
|
var useClientLayoutEffect = typeof window === "undefined" ? useEffect10 : useLayoutEffect3;
|
|
6900
6919
|
function panelElement(root, id) {
|
|
6901
6920
|
if (!root || !id) return null;
|
|
@@ -6972,7 +6991,7 @@ function TourButton({ steps }) {
|
|
|
6972
6991
|
}, [isOpen]);
|
|
6973
6992
|
if (steps.length === 0) return null;
|
|
6974
6993
|
const last = at === steps.length - 1;
|
|
6975
|
-
return /* @__PURE__ */ jsxs22(
|
|
6994
|
+
return /* @__PURE__ */ jsxs22(Fragment10, { children: [
|
|
6976
6995
|
/* @__PURE__ */ jsx30(
|
|
6977
6996
|
"button",
|
|
6978
6997
|
{
|
|
@@ -7263,6 +7282,7 @@ var RENDERER_CSS = `
|
|
|
7263
7282
|
/* ---- Card anatomy ---- */
|
|
7264
7283
|
.ds-panel { padding: var(--ds-space-lg); border: 0; }
|
|
7265
7284
|
.ds-panel-head { margin-bottom: var(--ds-space-md); min-height: 20px; flex-wrap: wrap; row-gap: 2px; }
|
|
7285
|
+
.ds-panel-subtitle { margin: 2px 0 0; font-family: var(--ds-type-caption-family); font-size: var(--ds-type-caption-size); line-height: var(--ds-type-caption-line-height); color: var(--ds-color-text-subtle); }
|
|
7266
7286
|
.ds-panel-title { display: inline-flex; align-items: center; gap: var(--ds-space-xs); min-width: 0; max-width: 100%; }
|
|
7267
7287
|
.ds-panel-meta { font-size: var(--ds-type-label-size); color: var(--ds-color-text-subtle); white-space: nowrap; }
|
|
7268
7288
|
.ds-live { display: inline-flex; align-items: center; gap: 6px; font-size: var(--ds-type-label-size); color: var(--ds-color-text-subtle); white-space: nowrap; }
|
|
@@ -7300,7 +7320,8 @@ var RENDERER_CSS = `
|
|
|
7300
7320
|
.ds-flow .ds-tiles { height: auto; overflow-y: visible; }
|
|
7301
7321
|
/* Grid items with fit: the panel takes its natural height (at least the cell's), so the grid can measure it. */
|
|
7302
7322
|
[data-fit] > .ds-fit { height: 100%; }
|
|
7303
|
-
.ds-
|
|
7323
|
+
.ds-grid-exact > .react-grid-item { padding-bottom: var(--ds-grid-gap); }
|
|
7324
|
+
.ds-fit > .ds-panel { height: auto !important; min-height: 100% !important; }
|
|
7304
7325
|
/* While measuring, the panel takes only its content's height (no stretching), then goes back. */
|
|
7305
7326
|
.ds-fit[data-measuring] > .ds-panel { min-height: 0 !important; }
|
|
7306
7327
|
.ds-fit[data-measuring] .ds-panel-body, .ds-fit[data-measuring] .ds-panel-body > * { flex: none !important; height: auto !important; }
|
|
@@ -7395,6 +7416,7 @@ var RENDERER_CSS = `
|
|
|
7395
7416
|
.ds-pill-btn[aria-expanded="true"] { border-color: var(--ds-color-action-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ds-color-action-primary) 14%, transparent); }
|
|
7396
7417
|
.ds-pill-btn > svg:first-child { color: var(--ds-color-text-subtle); }
|
|
7397
7418
|
.ds-pill-value { color: var(--ds-color-action-primary); font-weight: 500; }
|
|
7419
|
+
.ds-pill-value-only { color: var(--ds-control-value-color, var(--ds-color-action-primary)); font-weight: var(--ds-control-value-weight, 500); }
|
|
7398
7420
|
.ds-pill-chev { color: var(--ds-color-text-subtle); margin-left: 2px; transition: transform 180ms ease; }
|
|
7399
7421
|
.ds-pill-btn[aria-expanded="true"] .ds-pill-chev { transform: rotate(180deg); color: var(--ds-color-action-primary); }
|
|
7400
7422
|
|
|
@@ -7716,7 +7738,7 @@ function releaseDefaultPrefix(owner) {
|
|
|
7716
7738
|
}
|
|
7717
7739
|
|
|
7718
7740
|
// src/components/DashboardRenderer.tsx
|
|
7719
|
-
import { Fragment as
|
|
7741
|
+
import { Fragment as Fragment11, jsx as jsx31, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
7720
7742
|
function usesScripts(doc) {
|
|
7721
7743
|
const handler = (h) => {
|
|
7722
7744
|
if (typeof h === "string") return isCallbackSource(h);
|
|
@@ -8188,7 +8210,7 @@ function DashboardBody({
|
|
|
8188
8210
|
const grid = doc.spec.grid;
|
|
8189
8211
|
const tour = editable ? NO_STEPS : doc.spec.tour ?? NO_STEPS;
|
|
8190
8212
|
const hidden = useHiddenPanels(Object.keys(doc.spec.panels));
|
|
8191
|
-
return /* @__PURE__ */ jsxs23(
|
|
8213
|
+
return /* @__PURE__ */ jsxs23(Fragment11, { children: [
|
|
8192
8214
|
!hideHeader && (head.title || head.synced || tour.length > 0) && /* @__PURE__ */ jsxs23("div", { className: "ds-header", children: [
|
|
8193
8215
|
head.title && /* @__PURE__ */ jsx31("h2", { className: "ds-title", children: head.title }),
|
|
8194
8216
|
head.description && /* @__PURE__ */ jsx31("p", { className: "ds-desc", children: head.description }),
|
|
@@ -8231,6 +8253,7 @@ function DashboardBody({
|
|
|
8231
8253
|
columns: grid.columns,
|
|
8232
8254
|
rowHeight: grid.rowHeight,
|
|
8233
8255
|
gap: grid.gap,
|
|
8256
|
+
exactHeights: grid.exactHeights,
|
|
8234
8257
|
editable,
|
|
8235
8258
|
hidden,
|
|
8236
8259
|
...breakpoint ? { breakpoint } : {},
|