@ai-matrx/records-ui 0.116.11 → 0.116.13
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 +21 -1
- package/dist/{chunk-HL7ZIVVJ.js → chunk-NE72B4OK.js} +163 -139
- package/dist/{chunk-HL7ZIVVJ.js.map → chunk-NE72B4OK.js.map} +1 -1
- package/dist/index.cjs +2474 -2436
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -1
- package/dist/index.d.ts +16 -1
- package/dist/index.js +29 -15
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +212 -188
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +1 -1
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -5353,6 +5353,21 @@ interface ChartBlockProps {
|
|
|
5353
5353
|
className?: string | undefined;
|
|
5354
5354
|
/** A donut draws its total in the middle (the first measure added up over its groups). */
|
|
5355
5355
|
centerValue?: boolean | undefined;
|
|
5356
|
+
/**
|
|
5357
|
+
* The number a `centerValue` donut draws in its middle when the host knows the whole answer: the
|
|
5358
|
+
* total over EVERY record (a cut of 200 groups still counts all of them), or an average / min / max
|
|
5359
|
+
* over every record, which adding the groups up would get wrong. `null` = the store had no total
|
|
5360
|
+
* ("–"). Absent: the drawn groups added up.
|
|
5361
|
+
*/
|
|
5362
|
+
centerTotal?: number | null | undefined;
|
|
5363
|
+
/** `false` draws no legend beside a donut and no value list under bars or a line. Default `true`. */
|
|
5364
|
+
legend?: boolean | undefined;
|
|
5365
|
+
/**
|
|
5366
|
+
* The colour each group is drawn in, keyed by its stored value as text ("" for no value) — a
|
|
5367
|
+
* choice column's own option colours. A group not named here takes the palette's next colour.
|
|
5368
|
+
* Single-group blocks only; a compared block keeps its two series tones.
|
|
5369
|
+
*/
|
|
5370
|
+
groupColors?: Readonly<Record<string, string>> | undefined;
|
|
5356
5371
|
/**
|
|
5357
5372
|
* `bare` — the drawing alone, for a block a page already titles: no figure border, no padding,
|
|
5358
5373
|
* no caption row. Default `card`.
|
|
@@ -5368,7 +5383,7 @@ interface ChartBlockProps {
|
|
|
5368
5383
|
token: string;
|
|
5369
5384
|
} | undefined;
|
|
5370
5385
|
}
|
|
5371
|
-
declare function ChartBlock({ block, subject, tableName, className, centerValue, variant, source }: ChartBlockProps): react.JSX.Element;
|
|
5386
|
+
declare function ChartBlock({ block, subject, tableName, className, centerValue, centerTotal, legend, groupColors, variant, source }: ChartBlockProps): react.JSX.Element;
|
|
5372
5387
|
|
|
5373
5388
|
type ChartLayoutKind = "bar" | "line" | "donut";
|
|
5374
5389
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -5353,6 +5353,21 @@ interface ChartBlockProps {
|
|
|
5353
5353
|
className?: string | undefined;
|
|
5354
5354
|
/** A donut draws its total in the middle (the first measure added up over its groups). */
|
|
5355
5355
|
centerValue?: boolean | undefined;
|
|
5356
|
+
/**
|
|
5357
|
+
* The number a `centerValue` donut draws in its middle when the host knows the whole answer: the
|
|
5358
|
+
* total over EVERY record (a cut of 200 groups still counts all of them), or an average / min / max
|
|
5359
|
+
* over every record, which adding the groups up would get wrong. `null` = the store had no total
|
|
5360
|
+
* ("–"). Absent: the drawn groups added up.
|
|
5361
|
+
*/
|
|
5362
|
+
centerTotal?: number | null | undefined;
|
|
5363
|
+
/** `false` draws no legend beside a donut and no value list under bars or a line. Default `true`. */
|
|
5364
|
+
legend?: boolean | undefined;
|
|
5365
|
+
/**
|
|
5366
|
+
* The colour each group is drawn in, keyed by its stored value as text ("" for no value) — a
|
|
5367
|
+
* choice column's own option colours. A group not named here takes the palette's next colour.
|
|
5368
|
+
* Single-group blocks only; a compared block keeps its two series tones.
|
|
5369
|
+
*/
|
|
5370
|
+
groupColors?: Readonly<Record<string, string>> | undefined;
|
|
5356
5371
|
/**
|
|
5357
5372
|
* `bare` — the drawing alone, for a block a page already titles: no figure border, no padding,
|
|
5358
5373
|
* no caption row. Default `card`.
|
|
@@ -5368,7 +5383,7 @@ interface ChartBlockProps {
|
|
|
5368
5383
|
token: string;
|
|
5369
5384
|
} | undefined;
|
|
5370
5385
|
}
|
|
5371
|
-
declare function ChartBlock({ block, subject, tableName, className, centerValue, variant, source }: ChartBlockProps): react.JSX.Element;
|
|
5386
|
+
declare function ChartBlock({ block, subject, tableName, className, centerValue, centerTotal, legend, groupColors, variant, source }: ChartBlockProps): react.JSX.Element;
|
|
5372
5387
|
|
|
5373
5388
|
type ChartLayoutKind = "bar" | "line" | "donut";
|
|
5374
5389
|
/**
|
package/dist/index.js
CHANGED
|
@@ -172,7 +172,7 @@ import {
|
|
|
172
172
|
withoutAddition,
|
|
173
173
|
withoutLeadingBlank,
|
|
174
174
|
workedOutErrorFor
|
|
175
|
-
} from "./chunk-
|
|
175
|
+
} from "./chunk-NE72B4OK.js";
|
|
176
176
|
import {
|
|
177
177
|
CHART_PLOT_PX,
|
|
178
178
|
RECORDS_GRID_ROW_PX,
|
|
@@ -23471,8 +23471,15 @@ function asRefusal2(block) {
|
|
|
23471
23471
|
"dashboard_run"
|
|
23472
23472
|
);
|
|
23473
23473
|
}
|
|
23474
|
+
function colorOfGroup(groups, colors) {
|
|
23475
|
+
if (!colors) return null;
|
|
23476
|
+
const values = Object.values(groups);
|
|
23477
|
+
if (values.length > 1) return null;
|
|
23478
|
+
const raw = values[0];
|
|
23479
|
+
return colors[raw === null || raw === void 0 ? "" : String(raw)] ?? null;
|
|
23480
|
+
}
|
|
23474
23481
|
var NO_GROUPS = { title: "", kind: "bar", group_by: [], rows: [] };
|
|
23475
|
-
function ChartBlock({ block, subject, tableName: tableName2, className, centerValue, variant = "card", source }) {
|
|
23482
|
+
function ChartBlock({ block, subject, tableName: tableName2, className, centerValue, centerTotal, legend = true, groupColors, variant = "card", source }) {
|
|
23476
23483
|
const bare = variant === "bare";
|
|
23477
23484
|
const host = useRecordsUi();
|
|
23478
23485
|
const kind2 = block.kind;
|
|
@@ -23523,10 +23530,10 @@ function ChartBlock({ block, subject, tableName: tableName2, className, centerVa
|
|
|
23523
23530
|
};
|
|
23524
23531
|
}
|
|
23525
23532
|
points.forEach((point, index) => {
|
|
23526
|
-
out[point.label] ??= { label: point.label, color: SERIES_COLORS[index % SERIES_COLORS.length] };
|
|
23533
|
+
out[point.label] ??= { label: point.label, color: (!windows ? colorOfGroup(point.groups, groupColors) : null) ?? SERIES_COLORS[index % SERIES_COLORS.length] };
|
|
23527
23534
|
});
|
|
23528
23535
|
return out;
|
|
23529
|
-
}, [primary, measureName, windows, points]);
|
|
23536
|
+
}, [primary, measureName, windows, points, groupColors]);
|
|
23530
23537
|
const goal = target && typeof target.value === "number" ? {
|
|
23531
23538
|
value: typeof target.pace === "number" ? target.pace : block.bucket ? null : target.value,
|
|
23532
23539
|
label: typeof target.pace === "number" && target.per !== "bucket" ? `${target.label} pace` : target.label
|
|
@@ -23585,10 +23592,11 @@ function ChartBlock({ block, subject, tableName: tableName2, className, centerVa
|
|
|
23585
23592
|
config,
|
|
23586
23593
|
onDrill: drill,
|
|
23587
23594
|
goal,
|
|
23588
|
-
...centerValue ? { center: points.reduce((sum, p) => sum + (p.values[primary] ?? 0), 0) } : {}
|
|
23595
|
+
...centerValue ? { center: centerTotal !== void 0 ? centerTotal : points.reduce((sum, p) => sum + (p.values[primary] ?? 0), 0) } : {},
|
|
23596
|
+
showLegend: legend
|
|
23589
23597
|
}
|
|
23590
23598
|
),
|
|
23591
|
-
kind2 === "donut" ? null : /* @__PURE__ */ jsx79(Values, { points, measure: primary, config, onDrill: drill, compared, aimingUp: !!target })
|
|
23599
|
+
kind2 === "donut" || !legend ? null : /* @__PURE__ */ jsx79(Values, { points, measure: primary, config, onDrill: drill, compared, aimingUp: !!target })
|
|
23592
23600
|
] }) })
|
|
23593
23601
|
]
|
|
23594
23602
|
}
|
|
@@ -23727,6 +23735,11 @@ function StuckList({ rows }) {
|
|
|
23727
23735
|
] });
|
|
23728
23736
|
}
|
|
23729
23737
|
var HEIGHT = CHART_PLOT_PX;
|
|
23738
|
+
var MANY_SLICES = 24;
|
|
23739
|
+
function donutGap(slices) {
|
|
23740
|
+
if (slices <= 1) return 0;
|
|
23741
|
+
return slices > MANY_SLICES ? 180 / slices : 1;
|
|
23742
|
+
}
|
|
23730
23743
|
var DONUT_LEGEND_MAX_PX = 264;
|
|
23731
23744
|
function compactTick(value) {
|
|
23732
23745
|
if (typeof value !== "number" || !Number.isFinite(value)) return String(value ?? "");
|
|
@@ -23795,7 +23808,8 @@ function Drawing({
|
|
|
23795
23808
|
config,
|
|
23796
23809
|
onDrill,
|
|
23797
23810
|
goal,
|
|
23798
|
-
center
|
|
23811
|
+
center,
|
|
23812
|
+
showLegend = true
|
|
23799
23813
|
}) {
|
|
23800
23814
|
const compared = series.length > 1;
|
|
23801
23815
|
const drawOrder = compared ? [series[1], series[0]] : series;
|
|
@@ -23838,10 +23852,10 @@ function Drawing({
|
|
|
23838
23852
|
nameKey: "label",
|
|
23839
23853
|
innerRadius: 44,
|
|
23840
23854
|
outerRadius: 66,
|
|
23841
|
-
paddingAngle: points.length
|
|
23855
|
+
paddingAngle: donutGap(points.length),
|
|
23842
23856
|
isAnimationActive: false,
|
|
23843
23857
|
...click ? { onClick: click, className: "cursor-pointer" } : {},
|
|
23844
|
-
children: points.map((point, at) => /* @__PURE__ */ jsx79(Cell, { fill: String(config[point.label]?.color ?? SERIES_COLORS[at % SERIES_COLORS.length]) }, `${at}:${point.label}`))
|
|
23858
|
+
children: points.map((point, at) => /* @__PURE__ */ jsx79(Cell, { fill: String(config[point.label]?.color ?? SERIES_COLORS[at % SERIES_COLORS.length]), ...points.length > MANY_SLICES ? { stroke: "none" } : {} }, `${at}:${point.label}`))
|
|
23845
23859
|
}
|
|
23846
23860
|
)
|
|
23847
23861
|
] }) });
|
|
@@ -23852,25 +23866,25 @@ function Drawing({
|
|
|
23852
23866
|
{
|
|
23853
23867
|
className: "pointer-events-none absolute inset-0 flex items-center justify-center px-6 font-semibold tabular-nums",
|
|
23854
23868
|
"data-records-chart-center": "",
|
|
23855
|
-
title: pretty(center),
|
|
23856
|
-
style: { fontSize: pretty(center).length > 6 ? 13 : 16 },
|
|
23857
|
-
children: pretty(center).length > 7 ? compactTick(center) : pretty(center)
|
|
23869
|
+
title: center === null ? void 0 : pretty(center),
|
|
23870
|
+
style: { fontSize: center !== null && pretty(center).length > 6 ? 13 : 16 },
|
|
23871
|
+
children: center === null ? "\u2013" : pretty(center).length > 7 ? compactTick(center) : pretty(center)
|
|
23858
23872
|
}
|
|
23859
23873
|
)
|
|
23860
23874
|
] });
|
|
23861
23875
|
return /* @__PURE__ */ jsxs72("div", { className: "flex min-w-0 flex-wrap items-center gap-x-4 gap-y-2", "data-records-donut": "", children: [
|
|
23862
23876
|
ringWithCenter,
|
|
23863
|
-
/* @__PURE__ */ jsx79("ul", { className: "flex min-w-[8rem] max-w-md flex-1 basis-40 flex-col gap-0.5 overflow-y-auto overscroll-contain", style: { maxHeight: DONUT_LEGEND_MAX_PX }, "data-records-donut-legend": "", children: points.map((point, at) => {
|
|
23877
|
+
showLegend ? /* @__PURE__ */ jsx79("ul", { className: "flex min-w-[8rem] max-w-md flex-1 basis-40 flex-col gap-0.5 overflow-y-auto overscroll-contain", style: { maxHeight: DONUT_LEGEND_MAX_PX }, "data-records-donut-legend": "", children: points.map((point, at) => {
|
|
23864
23878
|
const value = point.values[series[0]] ?? 0;
|
|
23865
23879
|
const share = total > 0 ? Math.round(value / total * 1e3) / 10 : 0;
|
|
23866
23880
|
const row = /* @__PURE__ */ jsxs72(Fragment34, { children: [
|
|
23867
23881
|
/* @__PURE__ */ jsx79("span", { className: "h-2.5 w-2.5 shrink-0 rounded-[2px]", style: { background: String(config[point.label]?.color ?? SERIES_COLORS[at % SERIES_COLORS.length]) } }),
|
|
23868
23882
|
/* @__PURE__ */ jsx79("span", { className: "min-w-0 flex-1 truncate", title: point.label, children: point.label }),
|
|
23869
23883
|
/* @__PURE__ */ jsx79("span", { className: "tabular-nums", "data-records-donut-value": "", children: pretty(value) }),
|
|
23870
|
-
/* @__PURE__ */ jsx79("span", { className: "w-10 shrink-0 text-right tabular-nums text-muted-foreground", "data-records-donut-share": "", children: `${share}%` })
|
|
23884
|
+
/* @__PURE__ */ jsx79("span", { className: "min-w-10 shrink-0 whitespace-nowrap text-right tabular-nums text-muted-foreground", "data-records-donut-share": "", children: `${share}%` })
|
|
23871
23885
|
] });
|
|
23872
23886
|
return /* @__PURE__ */ jsx79("li", { className: "min-w-0 text-xs", children: onDrill ? /* @__PURE__ */ jsx79("button", { type: "button", className: "flex w-full min-w-0 items-center gap-2 rounded px-1 py-0.5 text-left hover:bg-muted focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring", onClick: () => onDrill(point), children: row }) : /* @__PURE__ */ jsx79("span", { className: "flex w-full min-w-0 items-center gap-2 px-1 py-0.5", children: row }) }, `${at}:${point.label}`);
|
|
23873
|
-
}) })
|
|
23887
|
+
}) }) : null
|
|
23874
23888
|
] });
|
|
23875
23889
|
}
|
|
23876
23890
|
if (kind2 === "line") {
|