@squadbase/vantage 0.7.0-dev1.db66685 → 0.7.0-dev1.f5bddba
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/dist/{chunk-4KMBJHNZ.js → chunk-GNGDOPBT.js} +1187 -213
- package/dist/chunk-GNGDOPBT.js.map +1 -0
- package/dist/{chunk-TRMHNMMZ.js → chunk-LYUGDHSF.js} +3 -3
- package/dist/{chunk-TRMHNMMZ.js.map → chunk-LYUGDHSF.js.map} +1 -1
- package/dist/{chunk-QNOX7WLZ.js → chunk-MQUIAP66.js} +69 -4
- package/dist/chunk-MQUIAP66.js.map +1 -0
- package/dist/{chunk-2IAPIOPS.js → chunk-P2KIHF65.js} +2 -2
- package/dist/chunk-P2KIHF65.js.map +1 -0
- package/dist/{chunk-3RJEOP3J.js → chunk-XRKSIC5Z.js} +5 -3
- package/dist/chunk-XRKSIC5Z.js.map +1 -0
- package/dist/components/index.d.ts +170 -6
- package/dist/components/index.js +4 -4
- package/dist/{delta-text-CbrOaW83.d.ts → delta-text-tav2Lh5d.d.ts} +1 -1
- package/dist/doc/index.d.ts +2 -2
- package/dist/doc/index.js +4 -4
- package/dist/{format-DihQkL1N.d.ts → format-D34piCei.d.ts} +2 -1
- package/dist/slide/index.d.ts +2 -2
- package/dist/slide/index.js +3 -3
- package/dist/table/index.js +4 -5
- package/dist/table/index.js.map +1 -1
- package/dist/ui/index.js +2 -3
- package/dist/ui/index.js.map +1 -1
- package/docs/en/parts/page-shell.md +1 -1
- package/docs/ja/parts/page-shell.md +1 -1
- package/package.json +2 -2
- package/registry/parts.json +4974 -0
- package/registry/ui/combo-chart.tsx +2 -1
- package/registry/ui/dashboard-card.tsx +3 -1
- package/registry/ui/data-table.tsx +3 -1
- package/registry/ui/delta.tsx +3 -1
- package/registry/ui/filter-bar.tsx +3 -1
- package/registry/ui/funnel-steps.tsx +1 -1
- package/registry/ui/kpi-card.tsx +3 -1
- package/registry/ui/metric-value.tsx +2 -2
- package/registry/ui/page-shell.tsx +25 -4
- package/registry/ui/paired-chart.tsx +1 -1
- package/registry/ui/pivot-table.tsx +2 -1
- package/registry/ui/progress-circle.tsx +2 -2
- package/registry/ui/sparkline.tsx +1 -1
- package/registry/ui/treemap.tsx +2 -1
- package/dist/chunk-2IAPIOPS.js.map +0 -1
- package/dist/chunk-3RJEOP3J.js.map +0 -1
- package/dist/chunk-4KMBJHNZ.js.map +0 -1
- package/dist/chunk-NZ5QIIG4.js +0 -74
- package/dist/chunk-NZ5QIIG4.js.map +0 -1
- package/dist/chunk-QNOX7WLZ.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ChartFrameContext, useChartSurface, resolveChartColors,
|
|
2
|
-
import { Sparkline } from './chunk-
|
|
3
|
-
import { formatDateRange, EMPTY_VALUE,
|
|
4
|
-
import { Tooltip, TooltipTrigger, TooltipContent, Badge, SidebarProvider, Sidebar, SidebarContent, SidebarGroup, SidebarGroupLabel, SidebarMenu, SidebarFooter, SidebarRail, SidebarInset, SidebarTrigger, Separator, Input, Table, TableHeader, TableRow, TableHead, TableBody, TableCell, Skeleton, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuCheckboxItem, useIsMobile, Popover, PopoverTrigger, PopoverContent, Calendar, ToggleGroup, ToggleGroupItem, SelectGroup, SelectLabel, Collapsible, CollapsibleTrigger, SidebarMenuButton, SidebarMenuBadge, CollapsibleContent, SidebarMenuSub, SidebarMenuSubItem, SidebarMenuSubButton, SidebarMenuItem, Command, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, Checkbox, Card, CardHeader, CardDescription, CardTitle, CardAction, CardFooter } from './chunk-
|
|
1
|
+
import { ChartFrameContext, useChartSurface, resolveChartColors, resolveFillColors, EChart, CHART_OTHER_COLOR } from './chunk-EG4PX726.js';
|
|
2
|
+
import { Sparkline } from './chunk-P2KIHF65.js';
|
|
3
|
+
import { formatDateRange, EMPTY_VALUE, toValueFormatter, formatDate, formatValue, formatPoints, formatKind, formatDelta, MINUS_SIGN, DEFAULT_LOCALE, formatDatesInText } from './chunk-XRKSIC5Z.js';
|
|
4
|
+
import { Tooltip, TooltipTrigger, TooltipContent, Badge, SidebarProvider, Sidebar, SidebarContent, SidebarGroup, SidebarGroupLabel, SidebarMenu, SidebarFooter, SidebarRail, SidebarInset, SidebarTrigger, Separator, Input, Table, TableHeader, TableRow, TableHead, TableBody, TableCell, Skeleton, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuCheckboxItem, useIsMobile, Popover, PopoverTrigger, PopoverContent, Calendar, ToggleGroup, ToggleGroupItem, SelectGroup, SelectLabel, Collapsible, CollapsibleTrigger, SidebarMenuButton, SidebarMenuBadge, CollapsibleContent, SidebarMenuSub, SidebarMenuSubItem, SidebarMenuSubButton, SidebarMenuItem, Command, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, Empty, Checkbox, Card, CardHeader, CardDescription, CardTitle, CardAction, CardFooter } from './chunk-MQUIAP66.js';
|
|
5
5
|
import { useLocale, uiLanguage, Button, weekStartsOn, resolveLocale, defaultFiscalYearStartMonth, FALLBACK_LOCALE } from './chunk-ROHNXP7J.js';
|
|
6
6
|
import { cn } from './chunk-U736PVHY.js';
|
|
7
7
|
import { forwardRef, useState, useEffect, createContext, useId, useMemo, useRef, useCallback, Fragment as Fragment$1, useContext, useInsertionEffect, useLayoutEffect } from 'react';
|
|
@@ -12,8 +12,8 @@ import { use, registerMap } from 'echarts/core';
|
|
|
12
12
|
import { GraphicComponent, VisualMapComponent, GeoComponent } from 'echarts/components';
|
|
13
13
|
import { ScatterChart as ScatterChart$1, HeatmapChart, MapChart, TreemapChart } from 'echarts/charts';
|
|
14
14
|
import 'echarts';
|
|
15
|
+
import { subMonths, subDays, endOfDay, startOfDay, startOfWeek, subWeeks, endOfWeek, startOfMonth, endOfMonth, isSameDay, addMonths, differenceInCalendarDays, parseISO } from 'date-fns';
|
|
15
16
|
import { flexRender, useReactTable, getPaginationRowModel, getFilteredRowModel, getSortedRowModel, getCoreRowModel } from '@tanstack/react-table';
|
|
16
|
-
import { subMonths, subDays, endOfDay, startOfDay, startOfWeek, subWeeks, endOfWeek, startOfMonth, endOfMonth, isSameDay, addMonths } from 'date-fns';
|
|
17
17
|
import { ja } from 'date-fns/locale';
|
|
18
18
|
|
|
19
19
|
// @squadbase/vantage — generated build. Do not edit.
|
|
@@ -127,7 +127,13 @@ var UpdatedAt = forwardRef(
|
|
|
127
127
|
);
|
|
128
128
|
UpdatedAt.displayName = "UpdatedAt";
|
|
129
129
|
var PageShell = forwardRef(
|
|
130
|
-
({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, "data-slot": "page-shell", className: cn("flex flex-col", className), ...props
|
|
130
|
+
({ className, title, description, children, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, "data-slot": "page-shell", className: cn("flex flex-col", className), ...props, children: title === void 0 ? children : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
131
|
+
/* @__PURE__ */ jsx(PageShellHeader, { children: /* @__PURE__ */ jsxs(PageShellHeading, { children: [
|
|
132
|
+
/* @__PURE__ */ jsx(PageShellTitle, { children: title }),
|
|
133
|
+
description ? /* @__PURE__ */ jsx(PageShellDescription, { children: description }) : null
|
|
134
|
+
] }) }),
|
|
135
|
+
/* @__PURE__ */ jsx(PageShellContent, { children })
|
|
136
|
+
] }) })
|
|
131
137
|
);
|
|
132
138
|
PageShell.displayName = "PageShell";
|
|
133
139
|
var SOURCE_PREFIX = { ja: "\u51FA\u5178\uFF1A", en: "Source: " };
|
|
@@ -743,7 +749,7 @@ function ChartDataTableView({ table, fallbackCaption }) {
|
|
|
743
749
|
caption && /* @__PURE__ */ jsx("caption", { children: caption }),
|
|
744
750
|
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", { children: table.columns.map((column, i) => /* @__PURE__ */ jsx("th", { scope: "col", children: column }, i)) }) }),
|
|
745
751
|
/* @__PURE__ */ jsx("tbody", { children: table.rows.map((row, r) => /* @__PURE__ */ jsx("tr", { children: row.map(
|
|
746
|
-
(
|
|
752
|
+
(cell2, c) => c === 0 ? /* @__PURE__ */ jsx("th", { scope: "row", children: cell2 }, c) : /* @__PURE__ */ jsx("td", { children: cell2 }, c)
|
|
747
753
|
) }, r)) })
|
|
748
754
|
] }) });
|
|
749
755
|
}
|
|
@@ -800,8 +806,8 @@ function chartColorAt(colors, i) {
|
|
|
800
806
|
const palette = colors && colors.length > 0 ? colors : DEFAULT_CHART_COLORS;
|
|
801
807
|
return palette[i % palette.length];
|
|
802
808
|
}
|
|
803
|
-
function tintCss(cssColor,
|
|
804
|
-
return `color-mix(in oklab, ${cssColor} ${
|
|
809
|
+
function tintCss(cssColor, percent2) {
|
|
810
|
+
return `color-mix(in oklab, ${cssColor} ${percent2}%, transparent)`;
|
|
805
811
|
}
|
|
806
812
|
function resolveValueFormatter(valueFormatter, format, locale) {
|
|
807
813
|
return valueFormatter ?? toValueFormatter(format, locale);
|
|
@@ -1217,20 +1223,20 @@ function baselineOfLabel(named, language) {
|
|
|
1217
1223
|
}
|
|
1218
1224
|
return named;
|
|
1219
1225
|
}
|
|
1220
|
-
function comparisonBaseline(vs, grain, label2,
|
|
1226
|
+
function comparisonBaseline(vs, grain, label2, toDate3, locale) {
|
|
1221
1227
|
const language = uiLanguage(resolveLocale(locale));
|
|
1222
1228
|
const nouns = BASELINE_NOUNS[language];
|
|
1223
1229
|
const named = label2?.trim();
|
|
1224
1230
|
if (named) return baselineOfLabel(named, language);
|
|
1225
|
-
if (vs === "custom") return nouns.custom;
|
|
1226
1231
|
if (vs === "target") return nouns.target;
|
|
1227
|
-
if (vs === "prior-year" &&
|
|
1232
|
+
if (vs === "prior-year" && toDate3) return nouns["prior-year"].unknown;
|
|
1233
|
+
if (vs !== "prior-year" && vs !== "prior-period") return nouns.custom;
|
|
1228
1234
|
return nouns[vs][grain ?? "unknown"];
|
|
1229
1235
|
}
|
|
1230
|
-
function comparisonLabel(vs, grain, label2,
|
|
1236
|
+
function comparisonLabel(vs, grain, label2, toDate3, locale) {
|
|
1231
1237
|
if (label2?.trim()) return label2;
|
|
1232
1238
|
const resolved = resolveLocale(locale);
|
|
1233
|
-
return LABEL_OF[uiLanguage(resolved)](comparisonBaseline(vs, grain, void 0,
|
|
1239
|
+
return LABEL_OF[uiLanguage(resolved)](comparisonBaseline(vs, grain, void 0, toDate3, resolved));
|
|
1234
1240
|
}
|
|
1235
1241
|
var toNumber = (v) => v === null || v === void 0 || Number.isNaN(v) ? null : v;
|
|
1236
1242
|
function computeComparison(current, comparison, options) {
|
|
@@ -1740,9 +1746,9 @@ function buildCartesianOption(cfg) {
|
|
|
1740
1746
|
const text = chartText(locale);
|
|
1741
1747
|
const provisionalLabel = cfg.provisionalLabel ?? text.provisional;
|
|
1742
1748
|
const stacked = kind !== "line" && type !== "default";
|
|
1743
|
-
const
|
|
1749
|
+
const percent2 = kind !== "line" && type === "percent";
|
|
1744
1750
|
const horizontalBars = kind === "bar" && layout === "vertical";
|
|
1745
|
-
const comparison = kind !== "bar" && !
|
|
1751
|
+
const comparison = kind !== "bar" && !percent2 ? cfg.comparison : void 0;
|
|
1746
1752
|
const compIdx = comparison ? categories.indexOf(comparison.category) : -1;
|
|
1747
1753
|
const mainIdx = categories.map((_, i) => i).filter((i) => i !== compIdx);
|
|
1748
1754
|
const seriesType = kind === "line" ? "default" : type;
|
|
@@ -1757,7 +1763,7 @@ function buildCartesianOption(cfg) {
|
|
|
1757
1763
|
const rawIndex = data.map((row) => row[index]);
|
|
1758
1764
|
const lastActual = labels.length - 1;
|
|
1759
1765
|
const provStart = categories.length > 0 ? provisionalStart(rawIndex, cfg.provisionalFrom) : -1;
|
|
1760
|
-
const forecast = kind !== "bar" && !
|
|
1766
|
+
const forecast = kind !== "bar" && !percent2 && cfg.forecast && cfg.forecast.data.length > 0 && data.length > 0 && categories.length > 0 ? cfg.forecast : void 0;
|
|
1761
1767
|
const forecastAt = [];
|
|
1762
1768
|
if (forecast) {
|
|
1763
1769
|
const position = new Map(labels.map((label2, i) => [label2, i]));
|
|
@@ -1798,14 +1804,14 @@ function buildCartesianOption(cfg) {
|
|
|
1798
1804
|
(title, i) => nameLabels ? hasLabel(nameLabels, labels[i] ?? "") ? labelOf(labels[i] ?? "", nameLabels) : title : title
|
|
1799
1805
|
);
|
|
1800
1806
|
const highlight = cfg.highlight ?? defaultChartHighlight(kind, data, index);
|
|
1801
|
-
const stackTotals = stacked && !
|
|
1807
|
+
const stackTotals = stacked && !percent2 ? stackTotalsOf(mainIdx.map((i) => values[i])) : null;
|
|
1802
1808
|
const highlightSeries = (stackTotals ? mainIdx[mainIdx.length - 1] : mainIdx[0]) ?? 0;
|
|
1803
|
-
const shareHighlight =
|
|
1804
|
-
const picked = highlight !== "auto" || mainIdx.length === 0 ||
|
|
1809
|
+
const shareHighlight = percent2 && kind === "area";
|
|
1810
|
+
const picked = highlight !== "auto" || mainIdx.length === 0 || percent2 && !shareHighlight ? [] : shareHighlight ? categories.length <= 2 ? pickShareHighlightPoints(values[0] ?? []) : [] : stackTotals ? pickHighlightPoints(stackTotals) : mainIdx.length <= 2 ? pickHighlightPoints(values[highlightSeries] ?? []) : [];
|
|
1805
1811
|
const pointGap = plotWidth && labels.length > 1 ? plotWidth / (kind === "bar" ? labels.length : labels.length - 1) : null;
|
|
1806
1812
|
const latestOnly = cfg.highlight === void 0 && !shareHighlight && picked.length === 2;
|
|
1807
1813
|
const highlightPoints = latestOnly ? [picked[1]] : picked.length === 2 && pointGap !== null && Math.abs(picked[1].index - picked[0].index) * pointGap < HIGHLIGHT_LABEL_WIDTH ? [picked[1]] : picked;
|
|
1808
|
-
const boundaryIndex = kind !== "bar" && !
|
|
1814
|
+
const boundaryIndex = kind !== "bar" && !percent2 && cfg.forecast && cfg.forecast.data.length > 0 ? lastActual : -1;
|
|
1809
1815
|
const edgeAlign = (i) => horizontalBars || labels.length < 2 ? void 0 : i === boundaryIndex && i !== last ? { align: "right", offset: [-6, 0] } : i === last ? { align: "right", ...kind === "bar" ? { offset: [8, 0] } : {} } : i === 0 ? { align: "left", ...kind === "bar" ? { offset: [-8, 0] } : {} } : void 0;
|
|
1810
1816
|
const perBarTarget = kind === "bar" && Boolean(targetKey);
|
|
1811
1817
|
const hasTarget = !perBarTarget && target !== void 0 && Number.isFinite(target);
|
|
@@ -1826,7 +1832,7 @@ function buildCartesianOption(cfg) {
|
|
|
1826
1832
|
const hideTargetLabel = kind === "line" && targetLabelPosition === "legend" || !shareHighlight && plotWidth !== void 0 && plotWidth < TARGET_LABEL_NARROW_WIDTH && highlightPoints.some((p) => p.index === labels.length - 1 && (nearTargetLabel(p, "under") || nearTargetLabel(p, "over")));
|
|
1827
1833
|
const below = (p) => !shareHighlight && !hideTargetLabel && nearTargetLabel(p, "under");
|
|
1828
1834
|
const targetLabelBelow = !shareHighlight && !hideTargetLabel && highlightPoints.some((p) => nearTargetLabel(p, "over"));
|
|
1829
|
-
const barTargets = perBarTarget && targetKey && !
|
|
1835
|
+
const barTargets = perBarTarget && targetKey && !percent2 && (stacked || categories.length === 1) ? barTargetValues(data, targetKey) : null;
|
|
1830
1836
|
const barTargetName = targetLabel ?? text.target;
|
|
1831
1837
|
const barTargetColor = labelColor ?? guideColor;
|
|
1832
1838
|
const markPointFor = (c, color) => c === highlightSeries && highlightPoints.length > 0 ? {
|
|
@@ -1951,7 +1957,7 @@ function buildCartesianOption(cfg) {
|
|
|
1951
1957
|
symbolSize: 6,
|
|
1952
1958
|
showSymbol: showDots || data.length === 1,
|
|
1953
1959
|
// 100% stacked: the top band's upper edge is the 100% line, not a value — drawn, it reads as「this band = 100%」.
|
|
1954
|
-
lineStyle:
|
|
1960
|
+
lineStyle: percent2 && c === categories.length - 1 ? { width: 0, color, opacity: 0 } : { width: 2, color, opacity: dimSeries ? DIMMED : 1 },
|
|
1955
1961
|
itemStyle: { color, opacity: dimSeries ? DIMMED : 1 },
|
|
1956
1962
|
// Hovering a series fades the others (not for a stack, where the bands read together).
|
|
1957
1963
|
emphasis: stacked ? void 0 : { focus: "series" },
|
|
@@ -1980,7 +1986,7 @@ function buildCartesianOption(cfg) {
|
|
|
1980
1986
|
symbol: "circle",
|
|
1981
1987
|
symbolSize: 6,
|
|
1982
1988
|
showSymbol: showDots || data.length === 1,
|
|
1983
|
-
lineStyle:
|
|
1989
|
+
lineStyle: percent2 && c === categories.length - 1 ? { width: 0, color, opacity: 0 } : { width: 2, type: "dashed", color, opacity },
|
|
1984
1990
|
itemStyle: { color, opacity },
|
|
1985
1991
|
areaStyle: solid.areaStyle ? { ...solid.areaStyle, opacity: (solid.areaStyle.opacity ?? 1) * PROVISIONAL_OPACITY } : void 0,
|
|
1986
1992
|
markPoint: void 0,
|
|
@@ -2096,7 +2102,7 @@ function buildCartesianOption(cfg) {
|
|
|
2096
2102
|
const totals = labels.map(
|
|
2097
2103
|
(_, i) => stacked ? values.reduce((sum, v) => sum + Math.max(0, v[i] ?? 0), 0) : Math.max(0, ...values.map((v) => v[i] ?? 0))
|
|
2098
2104
|
);
|
|
2099
|
-
const top =
|
|
2105
|
+
const top = percent2 ? 100 : maxValue ?? Math.max(target, ...totals);
|
|
2100
2106
|
if (!(top > 0)) return "center";
|
|
2101
2107
|
const ratio = Math.min(1, Math.max(0, target / top));
|
|
2102
2108
|
const half = (estimateTextWidth(targetText) + 8) / 2;
|
|
@@ -2280,16 +2286,16 @@ function buildCartesianOption(cfg) {
|
|
|
2280
2286
|
const fit = kind === "line" && (fitToData ?? autoMinValue);
|
|
2281
2287
|
const valueSplitNumber = (() => {
|
|
2282
2288
|
if (!horizontalBars || !plotWidth) return void 0;
|
|
2283
|
-
const top =
|
|
2289
|
+
const top = percent2 ? 100 : maxValue ?? Math.max(0, ...(stacked ? stackTotalsOf(values) : values.flat()).map((v) => v ?? 0));
|
|
2284
2290
|
const categoryColumn = showYAxis ? (yAxisWidth ?? Math.min(160, Math.max(0, ...labels.map(estimateTextWidth)))) + 8 : 0;
|
|
2285
2291
|
const plot = plotWidth - categoryColumn - (highlightPoints.length > 0 ? 64 : 16) - 4;
|
|
2286
|
-
const text2 =
|
|
2292
|
+
const text2 = percent2 ? (v) => `${v}%` : (v) => axisFormatter(v);
|
|
2287
2293
|
return valueAxisSplitNumber(plot, [text2(0), text2(top)]);
|
|
2288
2294
|
})();
|
|
2289
2295
|
const limits = valueAxisLimits({ minValue, maxValue }, kind !== "line");
|
|
2290
2296
|
const splitNumber = horizontalBars ? valueSplitNumber : valueAxisSplitCount(plotHeight);
|
|
2291
2297
|
const tickFormatter = (() => {
|
|
2292
|
-
if (!cfg.axisTicks ||
|
|
2298
|
+
if (!cfg.axisTicks || percent2) return axisFormatter;
|
|
2293
2299
|
const extentValues = [];
|
|
2294
2300
|
const addAll = (list) => {
|
|
2295
2301
|
for (const v of list) if (v !== null && Number.isFinite(v)) extentValues.push(v);
|
|
@@ -2314,8 +2320,8 @@ function buildCartesianOption(cfg) {
|
|
|
2314
2320
|
show: horizontalBars ? showXAxis : showYAxis,
|
|
2315
2321
|
// Bars and areas always start at 0 (a positive `minValue` can't lift them, a negative one makes room below);
|
|
2316
2322
|
// lines do too unless asked to fit the data. A limit never cuts the data: the axis widens to it.
|
|
2317
|
-
min:
|
|
2318
|
-
max:
|
|
2323
|
+
min: percent2 ? 0 : kind === "line" ? minValue === void 0 ? fit ? void 0 : zeroBasedMin : limits.min : limits.min,
|
|
2324
|
+
max: percent2 ? 100 : limits.max,
|
|
2319
2325
|
scale: fit && minValue == null,
|
|
2320
2326
|
splitNumber,
|
|
2321
2327
|
minInterval: allowDecimals ? void 0 : 1,
|
|
@@ -2323,7 +2329,7 @@ function buildCartesianOption(cfg) {
|
|
|
2323
2329
|
axisTick: { show: false },
|
|
2324
2330
|
splitLine: { show: showGridLines },
|
|
2325
2331
|
axisLabel: {
|
|
2326
|
-
formatter:
|
|
2332
|
+
formatter: percent2 ? (v) => `${v}%` : (v) => tickFormatter(v),
|
|
2327
2333
|
// Fitted to the data: the lowest tick would print over the first x label at the bottom left. The gridline stays.
|
|
2328
2334
|
showMinLabel: fit && minValue == null && !horizontalBars ? false : void 0,
|
|
2329
2335
|
// Horizontal: ticks that would still touch on a narrow plot are dropped.
|
|
@@ -2397,7 +2403,7 @@ function buildCartesianOption(cfg) {
|
|
|
2397
2403
|
)
|
|
2398
2404
|
};
|
|
2399
2405
|
};
|
|
2400
|
-
const shares =
|
|
2406
|
+
const shares = percent2 ? cartesianSeriesValues(i <= lastActual ? [row] : [], categories, "percent") : null;
|
|
2401
2407
|
const legendRank = (p) => {
|
|
2402
2408
|
const at = categories.indexOf(p.seriesName ?? "");
|
|
2403
2409
|
return at === -1 ? categories.length : at;
|
|
@@ -5083,10 +5089,10 @@ var HEATMAP_CELL_PADDING = 4;
|
|
|
5083
5089
|
var HEATMAP_BUCKET_MID = 20;
|
|
5084
5090
|
function heatmapCellFontSize(plotWidth, columns, rowNames, texts) {
|
|
5085
5091
|
const widest = (items) => items.reduce((m, t) => Math.max(m, estimateTextWidth2(t)), 0);
|
|
5086
|
-
const
|
|
5092
|
+
const cell2 = (plotWidth + HEATMAP_BUCKET_MID - HEATMAP_GRID_X - (widest(rowNames) + 8)) / Math.max(1, columns);
|
|
5087
5093
|
const text = widest(texts);
|
|
5088
|
-
if (text + HEATMAP_CELL_PADDING <=
|
|
5089
|
-
return text * 10 / 12 + HEATMAP_CELL_PADDING <=
|
|
5094
|
+
if (text + HEATMAP_CELL_PADDING <= cell2) return 12;
|
|
5095
|
+
return text * 10 / 12 + HEATMAP_CELL_PADDING <= cell2 ? 10 : null;
|
|
5090
5096
|
}
|
|
5091
5097
|
var TEXT13 = {
|
|
5092
5098
|
ja: {
|
|
@@ -5114,24 +5120,24 @@ function buildHeatmapOption(config) {
|
|
|
5114
5120
|
const base = config.color || "#6366f1";
|
|
5115
5121
|
const range = [mixIntoSurface(base, config.surfaceColor, HEATMAP_FLOOR_SHARE), base];
|
|
5116
5122
|
const gapColor = "rgba(0, 0, 0, 0)";
|
|
5117
|
-
const flagged = (
|
|
5118
|
-
const tooltip = (
|
|
5119
|
-
const head = `${escapeHtml2(label2(model.ys[
|
|
5120
|
-
const main =
|
|
5123
|
+
const flagged = (cell2) => cell2.flagged ? { borderColor: config.flagColor, borderWidth: 3, borderType: "solid" } : { borderColor: "transparent", borderWidth: 1 };
|
|
5124
|
+
const tooltip = (cell2) => {
|
|
5125
|
+
const head = `${escapeHtml2(label2(model.ys[cell2.yi]))} ${escapeHtml2(label2(model.xs[cell2.xi]))}`;
|
|
5126
|
+
const main = cell2.value === null ? EMPTY_VALUE : escapeHtml2(valueFormatter(cell2.value));
|
|
5121
5127
|
const extras = (config.details ?? []).map((key) => {
|
|
5122
|
-
const n =
|
|
5128
|
+
const n = cell2.row ? toChartNumber(cell2.row[key]) : null;
|
|
5123
5129
|
return `${escapeHtml2(label2(key))} ${n === null ? EMPTY_VALUE : escapeHtml2(valueFormatter(n))}`;
|
|
5124
5130
|
}).join(t.join);
|
|
5125
|
-
const flag =
|
|
5131
|
+
const flag = cell2.flagged ? `${t.join}${t.flagged}` : "";
|
|
5126
5132
|
return `${head} ${main}${extras ? `${t.join}${extras}` : ""}${flag}`;
|
|
5127
5133
|
};
|
|
5128
5134
|
const cellFont = config.plotWidth ? heatmapCellFontSize(
|
|
5129
5135
|
config.plotWidth,
|
|
5130
5136
|
model.xs.length,
|
|
5131
5137
|
model.ys.map(label2),
|
|
5132
|
-
model.cells.flatMap((
|
|
5138
|
+
model.cells.flatMap((cell2) => cell2.value === null ? [] : [valueFormatter(cell2.value)])
|
|
5133
5139
|
) : 12;
|
|
5134
|
-
const point = (
|
|
5140
|
+
const point = (cell2) => ({ value: [cell2.xi, cell2.yi, cell2.value], cell: cell2 });
|
|
5135
5141
|
const option = {
|
|
5136
5142
|
animation: false,
|
|
5137
5143
|
tooltip: config.showTooltip ? { trigger: "item", formatter: (p) => tooltip(p.data.cell) } : { show: false },
|
|
@@ -5179,11 +5185,11 @@ function buildHeatmapOption(config) {
|
|
|
5179
5185
|
{
|
|
5180
5186
|
id: "values",
|
|
5181
5187
|
type: "heatmap",
|
|
5182
|
-
data: present.map((
|
|
5183
|
-
...point(
|
|
5184
|
-
itemStyle: flagged(
|
|
5188
|
+
data: present.map((cell2) => ({
|
|
5189
|
+
...point(cell2),
|
|
5190
|
+
itemStyle: flagged(cell2),
|
|
5185
5191
|
label: {
|
|
5186
|
-
color: heatmapRatio(
|
|
5192
|
+
color: heatmapRatio(cell2.value, model.min, model.max) >= HEATMAP_LIGHT_TEXT_FROM ? config.darkCellText : config.lightCellText
|
|
5187
5193
|
}
|
|
5188
5194
|
})),
|
|
5189
5195
|
label: {
|
|
@@ -5198,7 +5204,7 @@ function buildHeatmapOption(config) {
|
|
|
5198
5204
|
{
|
|
5199
5205
|
id: "gaps",
|
|
5200
5206
|
type: "heatmap",
|
|
5201
|
-
data: missing.map((
|
|
5207
|
+
data: missing.map((cell2) => ({ value: [cell2.xi, cell2.yi, 0], cell: cell2, itemStyle: flagged(cell2) })),
|
|
5202
5208
|
label: { show: false },
|
|
5203
5209
|
itemStyle: {
|
|
5204
5210
|
color: gapColor,
|
|
@@ -5234,7 +5240,7 @@ function heatmapDataTable(model, names, formatter, labels, locale) {
|
|
|
5234
5240
|
}
|
|
5235
5241
|
function buildHeatmapSummary(model, formatter, title, labels, locale) {
|
|
5236
5242
|
let best;
|
|
5237
|
-
for (const
|
|
5243
|
+
for (const cell2 of model.cells) if (cell2.value !== null && (!best || cell2.value > best.value)) best = cell2;
|
|
5238
5244
|
if (!best) return void 0;
|
|
5239
5245
|
const label2 = (key) => labels?.[key] ?? key;
|
|
5240
5246
|
const head = title ? `${title}: ` : "";
|
|
@@ -5347,6 +5353,1061 @@ function HeatmapLegend({
|
|
|
5347
5353
|
}
|
|
5348
5354
|
var Heatmap = forwardRef(HeatmapImpl);
|
|
5349
5355
|
Heatmap.displayName = "Heatmap";
|
|
5356
|
+
var TEXT14 = {
|
|
5357
|
+
ja: { item: "\u9805\u76EE", chart: (keys) => `${keys.join("\u30FB")}\u306E\u63A8\u79FB(\u4E0A\u6BB5 \u68D2\u3001\u4E0B\u6BB5 \u7DDA)` },
|
|
5358
|
+
en: { item: "Item", chart: (keys) => `Trend of ${keys.join(", ")} (bars on top, line below)` }
|
|
5359
|
+
};
|
|
5360
|
+
var NO_ROWS12 = [];
|
|
5361
|
+
var NO_KEYS = [];
|
|
5362
|
+
var PANEL_GAP = 20;
|
|
5363
|
+
var LEGEND_LINE = 24;
|
|
5364
|
+
var DEFAULT_HEIGHT = 400;
|
|
5365
|
+
var DEFAULT_Y_AXIS_WIDTH = 64;
|
|
5366
|
+
function pairedPalette(barKeys, lineKeys, barColors, lineColors) {
|
|
5367
|
+
const bars = seriesColorsFor(barKeys, barColors, CHART_OTHER_COLOR);
|
|
5368
|
+
const line = lineColors ? seriesColorsFor(lineKeys, lineColors, CHART_OTHER_COLOR) : lineKeys.map((_, i) => DEFAULT_CHART_COLORS[(barKeys.length + i) % DEFAULT_CHART_COLORS.length]);
|
|
5369
|
+
return { bars, line };
|
|
5370
|
+
}
|
|
5371
|
+
function buildPairedOption(cfg) {
|
|
5372
|
+
const { data, index, labels, barKeys, lineKeys, height, heightRatio, yAxisWidth, showLegend, showTooltip } = cfg;
|
|
5373
|
+
const legendNames = [...barKeys, ...lineKeys];
|
|
5374
|
+
const legendWidth = legendNames.reduce((sum, name) => sum + [...labels?.[name] ?? name].length * 12 + 29, 0);
|
|
5375
|
+
const budget = Math.max(80, Math.min(cfg.plotWidth ?? 720, 720) - (cfg.reserveActions ? 80 : 0));
|
|
5376
|
+
const legendRows = showLegend ? Math.min(3, Math.max(1, Math.ceil(legendWidth / budget))) : 0;
|
|
5377
|
+
const top = (showLegend ? 12 + LEGEND_LINE * legendRows : 12) + 4;
|
|
5378
|
+
const room = Math.max(120, height - top - PANEL_GAP);
|
|
5379
|
+
const [a, b] = heightRatio;
|
|
5380
|
+
const upper = Math.round(room * a / (a + b));
|
|
5381
|
+
const common = {
|
|
5382
|
+
data,
|
|
5383
|
+
index,
|
|
5384
|
+
labels,
|
|
5385
|
+
showLegend: false,
|
|
5386
|
+
showTooltip: false,
|
|
5387
|
+
highlight: "none",
|
|
5388
|
+
yAxisWidth,
|
|
5389
|
+
reducedMotion: false,
|
|
5390
|
+
locale: cfg.locale
|
|
5391
|
+
};
|
|
5392
|
+
const barOpt = buildCartesianOption({
|
|
5393
|
+
...common,
|
|
5394
|
+
kind: "bar",
|
|
5395
|
+
categories: barKeys,
|
|
5396
|
+
palette: cfg.barPalette,
|
|
5397
|
+
valueFormatter: cfg.barFormatter,
|
|
5398
|
+
axisFormatter: cfg.barAxis,
|
|
5399
|
+
axisTicks: cfg.barTicks,
|
|
5400
|
+
type: cfg.type,
|
|
5401
|
+
showXAxis: false,
|
|
5402
|
+
yAxisLabel: cfg.barAxisLabel,
|
|
5403
|
+
maxValue: cfg.barMax,
|
|
5404
|
+
plotWidth: cfg.plotWidth,
|
|
5405
|
+
plotHeight: upper
|
|
5406
|
+
});
|
|
5407
|
+
const lineOpt = buildCartesianOption({
|
|
5408
|
+
...common,
|
|
5409
|
+
kind: "line",
|
|
5410
|
+
categories: lineKeys,
|
|
5411
|
+
palette: cfg.linePalette,
|
|
5412
|
+
valueFormatter: cfg.lineFormatter,
|
|
5413
|
+
axisFormatter: cfg.lineAxis,
|
|
5414
|
+
axisTicks: cfg.lineTicks,
|
|
5415
|
+
fitToData: cfg.fitToData,
|
|
5416
|
+
showXAxis: true,
|
|
5417
|
+
yAxisLabel: cfg.lineAxisLabel,
|
|
5418
|
+
minValue: cfg.lineMin,
|
|
5419
|
+
maxValue: cfg.lineMax,
|
|
5420
|
+
guideColor: cfg.guideColor,
|
|
5421
|
+
plotWidth: cfg.plotWidth,
|
|
5422
|
+
plotHeight: room - upper
|
|
5423
|
+
});
|
|
5424
|
+
const times = timeTooltipLabels(data.map((row) => row[index]), cfg.locale);
|
|
5425
|
+
const titles = labelRows(data, index, labels).map((row, i) => String(times?.[i] ?? row[index] ?? ""));
|
|
5426
|
+
const cell2 = (row, key) => {
|
|
5427
|
+
const v = row[key];
|
|
5428
|
+
const n = typeof v === "number" ? v : typeof v === "string" && v.trim() !== "" ? Number(v) : NaN;
|
|
5429
|
+
return Number.isFinite(n) ? n : null;
|
|
5430
|
+
};
|
|
5431
|
+
const rowsOf = (row, keys, palette) => keys.map((key, i) => ({ name: labelOf(key, labels), color: palette[i] || "currentColor", value: cell2(row, key) }));
|
|
5432
|
+
const emptyTitle = tooltipHtml("", [], String, [], cfg.locale);
|
|
5433
|
+
const tooltipFormatter = (params) => {
|
|
5434
|
+
const list = Array.isArray(params) ? params : [params];
|
|
5435
|
+
const i = list[0]?.dataIndex ?? 0;
|
|
5436
|
+
const row = data[i] ?? {};
|
|
5437
|
+
const upperHtml = tooltipHtml(titles[i] ?? "", rowsOf(row, barKeys, cfg.barPalette), cfg.barFormatter, [], cfg.locale);
|
|
5438
|
+
const lowerHtml = tooltipHtml("", rowsOf(row, lineKeys, cfg.linePalette), cfg.lineFormatter, [], cfg.locale).slice(emptyTitle.length);
|
|
5439
|
+
return `${upperHtml}${lowerHtml}`;
|
|
5440
|
+
};
|
|
5441
|
+
const lineX = { ...lineOpt.xAxis, id: "x-line", gridIndex: 1, boundaryGap: true };
|
|
5442
|
+
const barX = { ...barOpt.xAxis, id: "x-bars", gridIndex: 0, show: true, axisLine: { show: false }, axisLabel: { show: false } };
|
|
5443
|
+
const gridLeft = barOpt.grid.left ?? 4;
|
|
5444
|
+
const right = 16;
|
|
5445
|
+
const option = {
|
|
5446
|
+
...barOpt,
|
|
5447
|
+
legend: { ...barOpt.legend, show: showLegend, data: legendNames, right: cfg.reserveActions ? 80 : 0 },
|
|
5448
|
+
grid: [
|
|
5449
|
+
{ top, height: upper, left: gridLeft, right, containLabel: true },
|
|
5450
|
+
{ top: top + upper + PANEL_GAP, bottom: 4, left: gridLeft, right, containLabel: true }
|
|
5451
|
+
],
|
|
5452
|
+
xAxis: [barX, lineX],
|
|
5453
|
+
yAxis: [
|
|
5454
|
+
{ ...barOpt.yAxis, id: "y-bars", gridIndex: 0 },
|
|
5455
|
+
{ ...lineOpt.yAxis, id: "y-line", gridIndex: 1 }
|
|
5456
|
+
],
|
|
5457
|
+
series: [
|
|
5458
|
+
...barOpt.series.map((s) => ({ ...s, xAxisIndex: 0, yAxisIndex: 0 })),
|
|
5459
|
+
...lineOpt.series.map((s) => ({ ...s, xAxisIndex: 1, yAxisIndex: 1 }))
|
|
5460
|
+
],
|
|
5461
|
+
tooltip: {
|
|
5462
|
+
...barOpt.tooltip,
|
|
5463
|
+
show: showTooltip,
|
|
5464
|
+
trigger: "axis",
|
|
5465
|
+
axisPointer: { type: "line", link: [{ xAxisIndex: "all" }] },
|
|
5466
|
+
formatter: tooltipFormatter
|
|
5467
|
+
},
|
|
5468
|
+
axisPointer: { link: [{ xAxisIndex: "all" }] }
|
|
5469
|
+
};
|
|
5470
|
+
return mergeChartOptions(option, cfg.chartOptions);
|
|
5471
|
+
}
|
|
5472
|
+
function PairedChartImpl({
|
|
5473
|
+
data = NO_ROWS12,
|
|
5474
|
+
index,
|
|
5475
|
+
labels,
|
|
5476
|
+
bars,
|
|
5477
|
+
line,
|
|
5478
|
+
title,
|
|
5479
|
+
summary,
|
|
5480
|
+
actions,
|
|
5481
|
+
fileName,
|
|
5482
|
+
isLoading,
|
|
5483
|
+
emptyState,
|
|
5484
|
+
height = DEFAULT_HEIGHT,
|
|
5485
|
+
heightRatio = [3, 2],
|
|
5486
|
+
yAxisWidth = DEFAULT_Y_AXIS_WIDTH,
|
|
5487
|
+
showLegend = true,
|
|
5488
|
+
showTooltip = true,
|
|
5489
|
+
chartOptions,
|
|
5490
|
+
ariaLabel,
|
|
5491
|
+
className,
|
|
5492
|
+
...rest
|
|
5493
|
+
}, ref) {
|
|
5494
|
+
const { ref: frameRef, width: plotWidth, tokens } = useChartSurface(ref);
|
|
5495
|
+
const barKeys = bars?.categories ?? NO_KEYS;
|
|
5496
|
+
const lineKeys = line?.categories ?? NO_KEYS;
|
|
5497
|
+
const locale = useLocale();
|
|
5498
|
+
const t = TEXT14[uiLanguage(locale)];
|
|
5499
|
+
const barFormatter = useMemo(() => resolveValueFormatter(bars?.valueFormatter, bars?.format, locale), [bars?.valueFormatter, bars?.format, locale]);
|
|
5500
|
+
const lineFormatter = useMemo(() => resolveValueFormatter(line?.valueFormatter, line?.format, locale), [line?.valueFormatter, line?.format, locale]);
|
|
5501
|
+
const barAxis = useMemo(() => resolveAxisFormatter(bars?.valueFormatter, bars?.format, locale), [bars?.valueFormatter, bars?.format, locale]);
|
|
5502
|
+
const lineAxis = useMemo(() => resolveAxisFormatter(line?.valueFormatter, line?.format, locale), [line?.valueFormatter, line?.format, locale]);
|
|
5503
|
+
const barTicks = useMemo(() => resolveAxisTickFormatter(bars?.valueFormatter, bars?.format, locale), [bars?.valueFormatter, bars?.format, locale]);
|
|
5504
|
+
const lineTicks = useMemo(() => resolveAxisTickFormatter(line?.valueFormatter, line?.format, locale), [line?.valueFormatter, line?.format, locale]);
|
|
5505
|
+
const palette = useMemo(() => {
|
|
5506
|
+
const p = pairedPalette(barKeys, lineKeys, bars?.colors, line?.colors);
|
|
5507
|
+
return { bars: resolveChartColors(p.bars, tokens), line: resolveChartColors(p.line, tokens) };
|
|
5508
|
+
}, [barKeys, lineKeys, bars?.colors, line?.colors, tokens]);
|
|
5509
|
+
const option = useMemo(
|
|
5510
|
+
() => buildPairedOption({
|
|
5511
|
+
data,
|
|
5512
|
+
index,
|
|
5513
|
+
labels,
|
|
5514
|
+
barKeys,
|
|
5515
|
+
lineKeys,
|
|
5516
|
+
barPalette: palette.bars,
|
|
5517
|
+
linePalette: palette.line,
|
|
5518
|
+
barFormatter,
|
|
5519
|
+
lineFormatter,
|
|
5520
|
+
barAxis,
|
|
5521
|
+
lineAxis,
|
|
5522
|
+
barTicks,
|
|
5523
|
+
lineTicks,
|
|
5524
|
+
type: bars?.type,
|
|
5525
|
+
fitToData: line?.fitToData,
|
|
5526
|
+
barAxisLabel: bars?.yAxisLabel,
|
|
5527
|
+
lineAxisLabel: line?.yAxisLabel,
|
|
5528
|
+
barMax: bars?.maxValue,
|
|
5529
|
+
lineMax: line?.maxValue,
|
|
5530
|
+
lineMin: line?.minValue,
|
|
5531
|
+
height,
|
|
5532
|
+
heightRatio,
|
|
5533
|
+
yAxisWidth,
|
|
5534
|
+
showLegend,
|
|
5535
|
+
showTooltip,
|
|
5536
|
+
reserveActions: Boolean(actions),
|
|
5537
|
+
plotWidth,
|
|
5538
|
+
guideColor: tokens?.mutedForeground ?? void 0,
|
|
5539
|
+
chartOptions,
|
|
5540
|
+
locale
|
|
5541
|
+
}),
|
|
5542
|
+
[
|
|
5543
|
+
data,
|
|
5544
|
+
index,
|
|
5545
|
+
labels,
|
|
5546
|
+
barKeys,
|
|
5547
|
+
lineKeys,
|
|
5548
|
+
palette,
|
|
5549
|
+
barFormatter,
|
|
5550
|
+
lineFormatter,
|
|
5551
|
+
barAxis,
|
|
5552
|
+
lineAxis,
|
|
5553
|
+
barTicks,
|
|
5554
|
+
lineTicks,
|
|
5555
|
+
bars?.type,
|
|
5556
|
+
bars?.yAxisLabel,
|
|
5557
|
+
bars?.maxValue,
|
|
5558
|
+
line?.fitToData,
|
|
5559
|
+
line?.yAxisLabel,
|
|
5560
|
+
line?.maxValue,
|
|
5561
|
+
line?.minValue,
|
|
5562
|
+
height,
|
|
5563
|
+
heightRatio,
|
|
5564
|
+
yAxisWidth,
|
|
5565
|
+
showLegend,
|
|
5566
|
+
showTooltip,
|
|
5567
|
+
actions,
|
|
5568
|
+
plotWidth,
|
|
5569
|
+
tokens,
|
|
5570
|
+
chartOptions,
|
|
5571
|
+
locale
|
|
5572
|
+
]
|
|
5573
|
+
);
|
|
5574
|
+
const dataTable = useMemo(() => {
|
|
5575
|
+
const upper = chartDataTable(labelRows(data, index, labels), index, barKeys, barFormatter, labels, t.item);
|
|
5576
|
+
const lower = chartDataTable(labelRows(data, index, labels), index, lineKeys, lineFormatter, labels, t.item);
|
|
5577
|
+
const times = timeTooltipLabels(data.map((row) => row[index]), locale);
|
|
5578
|
+
return {
|
|
5579
|
+
...upper,
|
|
5580
|
+
columns: [...upper.columns, ...lower.columns.slice(1)],
|
|
5581
|
+
rows: upper.rows.map((r, i) => [times?.[i] ?? r[0] ?? "", ...r.slice(1), ...(lower.rows[i] ?? []).slice(1)])
|
|
5582
|
+
};
|
|
5583
|
+
}, [data, index, labels, barKeys, lineKeys, barFormatter, lineFormatter, t, locale]);
|
|
5584
|
+
const label2 = ariaLabel ?? t.chart([...barKeys, ...lineKeys]);
|
|
5585
|
+
return /* @__PURE__ */ jsx(
|
|
5586
|
+
ChartFrame,
|
|
5587
|
+
{
|
|
5588
|
+
...chartRootProps(rest),
|
|
5589
|
+
ref: frameRef,
|
|
5590
|
+
title,
|
|
5591
|
+
summary: summary === "auto" ? void 0 : summary,
|
|
5592
|
+
isLoading: isLoading ?? false,
|
|
5593
|
+
isEmpty: data.length === 0,
|
|
5594
|
+
emptyState,
|
|
5595
|
+
height,
|
|
5596
|
+
variant: "bar",
|
|
5597
|
+
ariaLabel: label2,
|
|
5598
|
+
className,
|
|
5599
|
+
dataTable,
|
|
5600
|
+
children: /* @__PURE__ */ jsx(EChart, { option, height: "100%", ariaLabel: label2, actions, fileName, exportHeader: { title, summary: summary === "auto" ? void 0 : summary } })
|
|
5601
|
+
}
|
|
5602
|
+
);
|
|
5603
|
+
}
|
|
5604
|
+
var PairedChart = forwardRef(PairedChartImpl);
|
|
5605
|
+
PairedChart.displayName = "PairedChart";
|
|
5606
|
+
|
|
5607
|
+
// ../squadkit/registry/lib/distribution.ts
|
|
5608
|
+
function toFinite(value) {
|
|
5609
|
+
const n = typeof value === "number" ? value : typeof value === "string" && value.trim() !== "" ? Number(value) : NaN;
|
|
5610
|
+
return Number.isFinite(n) ? n : null;
|
|
5611
|
+
}
|
|
5612
|
+
function sortedNumbers(values) {
|
|
5613
|
+
const out = [];
|
|
5614
|
+
for (const v of values) {
|
|
5615
|
+
const n = toFinite(v);
|
|
5616
|
+
if (n !== null) out.push(n);
|
|
5617
|
+
}
|
|
5618
|
+
return out.sort((a, b) => a - b);
|
|
5619
|
+
}
|
|
5620
|
+
function quantile(sorted, p) {
|
|
5621
|
+
if (sorted.length === 0) return null;
|
|
5622
|
+
const pos = (sorted.length - 1) * Math.min(1, Math.max(0, p));
|
|
5623
|
+
const lo = Math.floor(pos);
|
|
5624
|
+
const hi = Math.ceil(pos);
|
|
5625
|
+
return sorted[lo] + (sorted[hi] - sorted[lo]) * (pos - lo);
|
|
5626
|
+
}
|
|
5627
|
+
function boxStats(values, whisker = 1.5) {
|
|
5628
|
+
const sorted = sortedNumbers(values);
|
|
5629
|
+
if (sorted.length === 0) return null;
|
|
5630
|
+
const q1 = quantile(sorted, 0.25);
|
|
5631
|
+
const median = quantile(sorted, 0.5);
|
|
5632
|
+
const q3 = quantile(sorted, 0.75);
|
|
5633
|
+
const reach = Math.max(0, whisker) * (q3 - q1);
|
|
5634
|
+
const low = q1 - reach;
|
|
5635
|
+
const high = q3 + reach;
|
|
5636
|
+
const inside = sorted.filter((v) => v >= low && v <= high);
|
|
5637
|
+
return {
|
|
5638
|
+
count: sorted.length,
|
|
5639
|
+
min: sorted[0],
|
|
5640
|
+
max: sorted[sorted.length - 1],
|
|
5641
|
+
q1,
|
|
5642
|
+
median,
|
|
5643
|
+
q3,
|
|
5644
|
+
whiskerLow: inside[0] ?? q1,
|
|
5645
|
+
whiskerHigh: inside[inside.length - 1] ?? q3,
|
|
5646
|
+
outliers: sorted.filter((v) => v < low || v > high)
|
|
5647
|
+
};
|
|
5648
|
+
}
|
|
5649
|
+
function niceBinWidth(span, target = 10) {
|
|
5650
|
+
if (!(span > 0) || !Number.isFinite(span)) return 1;
|
|
5651
|
+
const raw = span / target;
|
|
5652
|
+
const pow = 10 ** Math.floor(Math.log10(raw));
|
|
5653
|
+
const f = raw / pow;
|
|
5654
|
+
return (f <= 1 ? 1 : f <= 2 ? 2 : f <= 2.5 ? 2.5 : f <= 5 ? 5 : 10) * pow;
|
|
5655
|
+
}
|
|
5656
|
+
var MAX_BINS = 200;
|
|
5657
|
+
function tidy(n, step) {
|
|
5658
|
+
const digits = Math.min(100, Math.max(0, Math.ceil(-Math.log10(step)) + 6));
|
|
5659
|
+
const rounded = Number(n.toFixed(digits));
|
|
5660
|
+
return Number.isFinite(rounded) ? rounded : n;
|
|
5661
|
+
}
|
|
5662
|
+
function histogramBins(values, config = {}) {
|
|
5663
|
+
const sorted = sortedNumbers(values);
|
|
5664
|
+
if (sorted.length === 0) return [];
|
|
5665
|
+
const width = config.binWidth !== void 0 && Number.isFinite(config.binWidth) && config.binWidth > 0 ? config.binWidth : null;
|
|
5666
|
+
const lo = sorted[0];
|
|
5667
|
+
const hi = sorted[sorted.length - 1];
|
|
5668
|
+
const cap = config.max !== void 0 && Number.isFinite(config.max) ? config.max : null;
|
|
5669
|
+
const end = cap !== null ? cap : hi;
|
|
5670
|
+
const first = config.start !== void 0 && Number.isFinite(config.start) ? config.start : null;
|
|
5671
|
+
let step = width ?? niceBinWidth((cap !== null ? Math.min(hi, cap) : hi) - (first ?? lo));
|
|
5672
|
+
const start = first ?? tidy(Math.floor(lo / step) * step, step);
|
|
5673
|
+
const countFor = (w) => Math.ceil((end - start) / w - 1e-9);
|
|
5674
|
+
if (countFor(step) > MAX_BINS) step = niceBinWidth(end - start, MAX_BINS);
|
|
5675
|
+
const n = Math.min(MAX_BINS, Math.max(cap === null ? 1 : 0, countFor(step)));
|
|
5676
|
+
const bins = [];
|
|
5677
|
+
for (let i = 0; i < n; i++) {
|
|
5678
|
+
const from = i === 0 ? start : bins[i - 1].to;
|
|
5679
|
+
let to = tidy(start + (i + 1) * step, step);
|
|
5680
|
+
if (!(to > from)) to = start + (i + 1) * step;
|
|
5681
|
+
if (cap !== null) to = Math.min(to, cap);
|
|
5682
|
+
bins.push({ from, to, count: 0, overflow: false });
|
|
5683
|
+
}
|
|
5684
|
+
const inRange = cap === null ? sorted : sorted.filter((v) => v < cap);
|
|
5685
|
+
const over = cap === null ? [] : sorted.filter((v) => v >= cap);
|
|
5686
|
+
for (const v of inRange) {
|
|
5687
|
+
if (v < start || bins.length === 0) continue;
|
|
5688
|
+
const i = Math.min(bins.length - 1, Math.floor((v - start) / step + 1e-9));
|
|
5689
|
+
bins[i].count += 1;
|
|
5690
|
+
}
|
|
5691
|
+
if (over.length > 0) bins.push({ from: cap, to: Math.max(hi, cap), count: over.length, overflow: true });
|
|
5692
|
+
return bins;
|
|
5693
|
+
}
|
|
5694
|
+
var TEXT15 = {
|
|
5695
|
+
ja: {
|
|
5696
|
+
countUnit: "\u4EF6",
|
|
5697
|
+
atOrAbove: (from) => `${from}\u4EE5\u4E0A`,
|
|
5698
|
+
range: (from, to) => `${from}\u301C${to}`,
|
|
5699
|
+
count: (n, unit) => `${n}${unit}`,
|
|
5700
|
+
countHeader: (unit) => `${unit}\u6570`,
|
|
5701
|
+
share: "\u69CB\u6210\u6BD4",
|
|
5702
|
+
value: "\u5024",
|
|
5703
|
+
valueInSentence: "\u5024",
|
|
5704
|
+
threshold: "\u3057\u304D\u3044\u5024",
|
|
5705
|
+
peak: (total, bin, count, unit) => `${total}${unit}\u306E\u3046\u3061\u6700\u3082\u591A\u3044\u306E\u306F ${bin}\uFF08${count}${unit}\uFF09`,
|
|
5706
|
+
overThreshold: (name, value, count, share) => `${name}\uFF08${value}\uFF09\u4EE5\u4E0A\u306F ${count}\uFF08${share}\uFF09`,
|
|
5707
|
+
sentenceJoin: "\u3002",
|
|
5708
|
+
chart: (label2) => `${label2}\u306E\u30D2\u30B9\u30C8\u30B0\u30E9\u30E0`
|
|
5709
|
+
},
|
|
5710
|
+
en: {
|
|
5711
|
+
countUnit: "",
|
|
5712
|
+
atOrAbove: (from) => `${from}+`,
|
|
5713
|
+
range: (from, to) => `${from}\u2013${to}`,
|
|
5714
|
+
count: (n, unit) => unit ? `${n} ${unit}` : `${n}`,
|
|
5715
|
+
countHeader: () => "Count",
|
|
5716
|
+
share: "Share",
|
|
5717
|
+
value: "Value",
|
|
5718
|
+
valueInSentence: "values",
|
|
5719
|
+
threshold: "Threshold",
|
|
5720
|
+
peak: (total, bin, count, unit) => `Most common: ${bin} (${unit ? `${count} ${unit}` : count} of ${total})`,
|
|
5721
|
+
overThreshold: (name, value, count, share) => `At or above ${name} (${value}): ${count} (${share})`,
|
|
5722
|
+
sentenceJoin: ". ",
|
|
5723
|
+
chart: (label2) => `Histogram of ${label2}`
|
|
5724
|
+
}
|
|
5725
|
+
};
|
|
5726
|
+
var textOf4 = (locale) => TEXT15[uiLanguage(resolveLocale(locale))];
|
|
5727
|
+
function binLabel(bin, formatter, locale) {
|
|
5728
|
+
const t = textOf4(locale);
|
|
5729
|
+
return bin.overflow ? t.atOrAbove(formatter(bin.from)) : t.range(formatter(bin.from), formatter(bin.to));
|
|
5730
|
+
}
|
|
5731
|
+
function thresholdPosition(bins, value) {
|
|
5732
|
+
const lastIndex = bins.length - 1;
|
|
5733
|
+
const i = bins.findIndex((b, k) => k === lastIndex ? value >= b.from && (b.overflow || value <= b.to) : value >= b.from && value < b.to);
|
|
5734
|
+
const bin = bins[i];
|
|
5735
|
+
if (!bin) return null;
|
|
5736
|
+
return bin.overflow ? i - 0.5 : i - 0.5 + (value - bin.from) / (bin.to - bin.from);
|
|
5737
|
+
}
|
|
5738
|
+
function countAtOrAbove(values, value, from = -Infinity) {
|
|
5739
|
+
return sortedNumbers(values).filter((v) => v >= value && v >= from).length;
|
|
5740
|
+
}
|
|
5741
|
+
var percent = (n, total) => total === 0 ? "0%" : `${Math.round(n / total * 100)}%`;
|
|
5742
|
+
function buildHistogramSummary(bins, formatter, config) {
|
|
5743
|
+
if (bins.length === 0 || config.total === 0) return void 0;
|
|
5744
|
+
const t = textOf4(config.locale);
|
|
5745
|
+
const count = (n) => t.count(n, config.countUnit);
|
|
5746
|
+
const peak = bins.reduce((a, b) => b.count > a.count ? b : a);
|
|
5747
|
+
const parts = [t.peak(config.total, binLabel(peak, formatter, config.locale), peak.count, config.countUnit)];
|
|
5748
|
+
if (config.threshold && config.atOrAbove !== void 0) {
|
|
5749
|
+
const name = config.threshold.label ?? t.threshold;
|
|
5750
|
+
parts.push(t.overThreshold(name, formatter(config.threshold.value), count(config.atOrAbove), percent(config.atOrAbove, config.total)));
|
|
5751
|
+
}
|
|
5752
|
+
return parts.join(t.sentenceJoin);
|
|
5753
|
+
}
|
|
5754
|
+
function histogramDataTable(bins, formatter, config) {
|
|
5755
|
+
const t = textOf4(config.locale);
|
|
5756
|
+
return {
|
|
5757
|
+
columns: [config.valueLabel ?? t.value, t.countHeader(config.countUnit), t.share],
|
|
5758
|
+
rows: bins.map((b) => [binLabel(b, formatter, config.locale), `${b.count}`, percent(b.count, config.total)])
|
|
5759
|
+
};
|
|
5760
|
+
}
|
|
5761
|
+
function thresholdPoint(bins, value) {
|
|
5762
|
+
const pos = thresholdPosition(bins, value) ?? 0;
|
|
5763
|
+
const index = Math.min(bins.length - 1, Math.max(0, Math.round(pos)));
|
|
5764
|
+
return [index, 0, pos - index];
|
|
5765
|
+
}
|
|
5766
|
+
function thresholdRenderer(style) {
|
|
5767
|
+
return (params, api) => {
|
|
5768
|
+
const { x: gx, y: gy, width, height } = params.coordSys;
|
|
5769
|
+
const band = Math.abs(api.size([1, 0])[0] ?? 0);
|
|
5770
|
+
const x = (api.coord([api.value(0), 0])[0] ?? 0) + api.value(2) * band;
|
|
5771
|
+
const nearRight = x > gx + width * 0.7;
|
|
5772
|
+
return {
|
|
5773
|
+
type: "group",
|
|
5774
|
+
children: [
|
|
5775
|
+
{
|
|
5776
|
+
type: "line",
|
|
5777
|
+
shape: { x1: x, y1: gy, x2: x, y2: gy + height },
|
|
5778
|
+
style: { stroke: style.lineColor || "#888", lineWidth: 1.5, lineDash: [4, 4], fill: "none" }
|
|
5779
|
+
},
|
|
5780
|
+
{
|
|
5781
|
+
type: "text",
|
|
5782
|
+
style: {
|
|
5783
|
+
text: style.text,
|
|
5784
|
+
x,
|
|
5785
|
+
y: gy - 4,
|
|
5786
|
+
fill: style.labelColor || "#888",
|
|
5787
|
+
textAlign: nearRight ? "right" : "left",
|
|
5788
|
+
textVerticalAlign: "bottom"
|
|
5789
|
+
}
|
|
5790
|
+
}
|
|
5791
|
+
]
|
|
5792
|
+
};
|
|
5793
|
+
};
|
|
5794
|
+
}
|
|
5795
|
+
var ROW_STYLE3 = "display:flex;align-items:center;gap:8px;line-height:20px";
|
|
5796
|
+
function buildHistogramOption(config) {
|
|
5797
|
+
const { locale } = config;
|
|
5798
|
+
const t = textOf4(locale);
|
|
5799
|
+
const { bins, total, colors, valueFormatter, threshold, showTooltip = true, countUnit = t.countUnit } = config;
|
|
5800
|
+
const pos = threshold ? thresholdPosition(bins, threshold.value) : null;
|
|
5801
|
+
const option = {
|
|
5802
|
+
...chartMotion(false),
|
|
5803
|
+
legend: { show: false },
|
|
5804
|
+
grid: { top: pos === null ? 16 : 28, right: 16, bottom: 4, left: 4, containLabel: true },
|
|
5805
|
+
tooltip: {
|
|
5806
|
+
show: showTooltip,
|
|
5807
|
+
trigger: "axis",
|
|
5808
|
+
axisPointer: { type: "shadow" },
|
|
5809
|
+
formatter: (params) => {
|
|
5810
|
+
const list = Array.isArray(params) ? params : [params];
|
|
5811
|
+
const bin = bins[(list.find((p) => p.seriesId === "count") ?? list[0])?.dataIndex ?? 0];
|
|
5812
|
+
if (!bin) return "";
|
|
5813
|
+
const color = escapeHtml((bin.overflow ? colors.overflow : colors.bar) || "currentColor");
|
|
5814
|
+
const line = (name, text) => `<div style="${ROW_STYLE3}"><span style="display:inline-block;width:8px;height:8px;border-radius:9999px;background:${color}"></span><span style="flex:1;opacity:.8">${escapeHtml(name)}</span><span style="font-weight:500;font-variant-numeric:tabular-nums;margin-left:12px">${escapeHtml(text)}</span></div>`;
|
|
5815
|
+
return `<div style="font-weight:500;margin-bottom:4px">${escapeHtml(binLabel(bin, valueFormatter, locale))}</div>` + line(t.countHeader(countUnit), t.count(bin.count, countUnit)) + line(t.share, percent(bin.count, total));
|
|
5816
|
+
}
|
|
5817
|
+
},
|
|
5818
|
+
xAxis: {
|
|
5819
|
+
type: "category",
|
|
5820
|
+
data: bins.map((b) => binLabel(b, valueFormatter, locale)),
|
|
5821
|
+
axisTick: { show: false },
|
|
5822
|
+
axisLabel: { hideOverlap: true }
|
|
5823
|
+
},
|
|
5824
|
+
yAxis: {
|
|
5825
|
+
type: "value",
|
|
5826
|
+
minInterval: 1,
|
|
5827
|
+
axisLine: { show: false },
|
|
5828
|
+
axisTick: { show: false },
|
|
5829
|
+
splitLine: { show: true }
|
|
5830
|
+
},
|
|
5831
|
+
series: [
|
|
5832
|
+
{
|
|
5833
|
+
id: "count",
|
|
5834
|
+
type: "bar",
|
|
5835
|
+
barCategoryGap: "6%",
|
|
5836
|
+
data: bins.map((b) => ({
|
|
5837
|
+
value: b.count,
|
|
5838
|
+
itemStyle: { color: (b.overflow ? colors.overflow : colors.bar) || void 0, borderRadius: [2, 2, 0, 0] }
|
|
5839
|
+
})),
|
|
5840
|
+
label: { show: false, color: config.labelColor, fontVariantNumeric: "tabular-nums" }
|
|
5841
|
+
},
|
|
5842
|
+
...threshold && pos !== null ? [
|
|
5843
|
+
{
|
|
5844
|
+
id: "threshold",
|
|
5845
|
+
type: "custom",
|
|
5846
|
+
silent: true,
|
|
5847
|
+
z: 10,
|
|
5848
|
+
animation: false,
|
|
5849
|
+
tooltip: { show: false },
|
|
5850
|
+
encode: { x: 0, y: 1 },
|
|
5851
|
+
// [階級の添字, 0(y の位置は使わない), 階級の中での位置(左端 -0.5 〜 右端 0.5)]
|
|
5852
|
+
data: [thresholdPoint(bins, threshold.value)],
|
|
5853
|
+
renderItem: thresholdRenderer({
|
|
5854
|
+
text: `${threshold.label ?? t.threshold} ${valueFormatter(threshold.value)}`,
|
|
5855
|
+
lineColor: config.lineColor,
|
|
5856
|
+
labelColor: config.labelColor
|
|
5857
|
+
})
|
|
5858
|
+
}
|
|
5859
|
+
] : []
|
|
5860
|
+
]
|
|
5861
|
+
};
|
|
5862
|
+
return mergeChartOptions(option, config.chartOptions);
|
|
5863
|
+
}
|
|
5864
|
+
var NO_VALUES = [];
|
|
5865
|
+
var HistogramChart = forwardRef(function HistogramChart2({
|
|
5866
|
+
values = NO_VALUES,
|
|
5867
|
+
binWidth,
|
|
5868
|
+
start,
|
|
5869
|
+
max,
|
|
5870
|
+
threshold,
|
|
5871
|
+
countUnit: countUnitProp,
|
|
5872
|
+
valueLabel,
|
|
5873
|
+
format,
|
|
5874
|
+
valueFormatter: valueFormatterProp,
|
|
5875
|
+
showTooltip = true,
|
|
5876
|
+
title,
|
|
5877
|
+
summary,
|
|
5878
|
+
actions,
|
|
5879
|
+
fileName,
|
|
5880
|
+
isLoading,
|
|
5881
|
+
emptyState,
|
|
5882
|
+
height,
|
|
5883
|
+
chartOptions,
|
|
5884
|
+
ariaLabel,
|
|
5885
|
+
className,
|
|
5886
|
+
...rest
|
|
5887
|
+
}, ref) {
|
|
5888
|
+
const { ref: frameRef, tokens } = useChartSurface(ref);
|
|
5889
|
+
const locale = useLocale();
|
|
5890
|
+
const t = TEXT15[uiLanguage(locale)];
|
|
5891
|
+
const countUnit = countUnitProp ?? t.countUnit;
|
|
5892
|
+
const valueFormatter = useMemo(
|
|
5893
|
+
() => valueFormatterProp ?? (format === void 0 ? toValueFormatter("number", locale) : resolveValueFormatter(void 0, format, locale)),
|
|
5894
|
+
[valueFormatterProp, format, locale]
|
|
5895
|
+
);
|
|
5896
|
+
const bins = useMemo(() => histogramBins(values, { binWidth, start, max }), [values, binWidth, start, max]);
|
|
5897
|
+
const total = useMemo(() => bins.reduce((sum, b) => sum + b.count, 0), [bins]);
|
|
5898
|
+
const colors = useMemo(() => {
|
|
5899
|
+
const [bar = ""] = resolveChartColors(["chart-1"], tokens);
|
|
5900
|
+
return { bar, overflow: resolveFillColors(tokens).neutral };
|
|
5901
|
+
}, [tokens]);
|
|
5902
|
+
const option = useMemo(
|
|
5903
|
+
() => buildHistogramOption({
|
|
5904
|
+
bins,
|
|
5905
|
+
total,
|
|
5906
|
+
colors,
|
|
5907
|
+
valueFormatter,
|
|
5908
|
+
countUnit,
|
|
5909
|
+
threshold,
|
|
5910
|
+
showTooltip,
|
|
5911
|
+
labelColor: tokens?.foreground ?? void 0,
|
|
5912
|
+
lineColor: tokens?.mutedForeground ?? void 0,
|
|
5913
|
+
chartOptions,
|
|
5914
|
+
locale
|
|
5915
|
+
}),
|
|
5916
|
+
[bins, total, colors, valueFormatter, countUnit, threshold, showTooltip, tokens, chartOptions, locale]
|
|
5917
|
+
);
|
|
5918
|
+
const dataTable = useMemo(
|
|
5919
|
+
() => histogramDataTable(bins, valueFormatter, { total, countUnit, valueLabel, locale }),
|
|
5920
|
+
[bins, valueFormatter, total, countUnit, valueLabel, locale]
|
|
5921
|
+
);
|
|
5922
|
+
const resolvedSummary = useMemo(
|
|
5923
|
+
() => summary === "auto" ? buildHistogramSummary(bins, valueFormatter, {
|
|
5924
|
+
total,
|
|
5925
|
+
countUnit,
|
|
5926
|
+
threshold,
|
|
5927
|
+
atOrAbove: threshold ? countAtOrAbove(values, threshold.value, bins[0]?.from) : void 0,
|
|
5928
|
+
locale
|
|
5929
|
+
}) : summary,
|
|
5930
|
+
[summary, bins, valueFormatter, total, countUnit, threshold, values, locale]
|
|
5931
|
+
);
|
|
5932
|
+
const label2 = ariaLabel ?? t.chart(valueLabel ?? t.valueInSentence);
|
|
5933
|
+
return /* @__PURE__ */ jsx(
|
|
5934
|
+
ChartFrame,
|
|
5935
|
+
{
|
|
5936
|
+
...chartRootProps(rest),
|
|
5937
|
+
ref: frameRef,
|
|
5938
|
+
title,
|
|
5939
|
+
summary: resolvedSummary,
|
|
5940
|
+
isLoading: isLoading ?? false,
|
|
5941
|
+
isEmpty: bins.length === 0,
|
|
5942
|
+
emptyState,
|
|
5943
|
+
height,
|
|
5944
|
+
variant: "bar",
|
|
5945
|
+
ariaLabel: label2,
|
|
5946
|
+
className,
|
|
5947
|
+
dataTable,
|
|
5948
|
+
children: /* @__PURE__ */ jsx(EChart, { option, height: "100%", ariaLabel: label2, actions, fileName, exportHeader: { title, summary: resolvedSummary } })
|
|
5949
|
+
}
|
|
5950
|
+
);
|
|
5951
|
+
});
|
|
5952
|
+
HistogramChart.displayName = "HistogramChart";
|
|
5953
|
+
var TEXT16 = {
|
|
5954
|
+
ja: {
|
|
5955
|
+
value: "\u5024",
|
|
5956
|
+
valueInSentence: "\u5024",
|
|
5957
|
+
medianOf: (name, label2, median) => `${name}\u306E${label2}\u306E\u4E2D\u592E\u5024\u306F ${median}`,
|
|
5958
|
+
medianRange: (label2, top, topMedian, low, lowMedian) => `${label2}\u306E\u4E2D\u592E\u5024\u304C\u6700\u3082\u9AD8\u3044\u306E\u306F ${top}\uFF08${topMedian}\uFF09\u3001\u6700\u3082\u4F4E\u3044\u306E\u306F ${low}\uFF08${lowMedian}\uFF09`,
|
|
5959
|
+
outliers: (n) => `\u5916\u308C\u5024\u306F ${n} \u4EF6`,
|
|
5960
|
+
sentenceJoin: "\u3002",
|
|
5961
|
+
columns: ["\u7FA4", "\u4EF6\u6570", "\u6700\u5C0F\uFF08\u3072\u3052\uFF09", "\u7B2C1\u56DB\u5206\u4F4D", "\u4E2D\u592E\u5024", "\u7B2C3\u56DB\u5206\u4F4D", "\u6700\u5927\uFF08\u3072\u3052\uFF09", "\u5916\u308C\u5024"],
|
|
5962
|
+
listJoin: "\u3001",
|
|
5963
|
+
none: "\u306A\u3057",
|
|
5964
|
+
tooltipTitle: (name, label2, count) => `${name}\uFF08${label2}\u30FB${count}\u4EF6\uFF09`,
|
|
5965
|
+
max: "\u6700\u5927\uFF08\u3072\u3052\uFF09",
|
|
5966
|
+
q3: "\u7B2C3\u56DB\u5206\u4F4D",
|
|
5967
|
+
median: "\u4E2D\u592E\u5024",
|
|
5968
|
+
q1: "\u7B2C1\u56DB\u5206\u4F4D",
|
|
5969
|
+
min: "\u6700\u5C0F\uFF08\u3072\u3052\uFF09",
|
|
5970
|
+
outlierRow: "\u5916\u308C\u5024",
|
|
5971
|
+
chart: (label2) => `${label2}\u306E\u7BB1\u3072\u3052\u56F3`
|
|
5972
|
+
},
|
|
5973
|
+
en: {
|
|
5974
|
+
value: "Value",
|
|
5975
|
+
valueInSentence: "value",
|
|
5976
|
+
medianOf: (name, label2, median) => `Median ${label2} for ${name}: ${median}`,
|
|
5977
|
+
medianRange: (label2, top, topMedian, low, lowMedian) => `Highest median ${label2}: ${top} (${topMedian}); lowest: ${low} (${lowMedian})`,
|
|
5978
|
+
outliers: (n) => n === 1 ? "1 outlier" : `${n} outliers`,
|
|
5979
|
+
sentenceJoin: ". ",
|
|
5980
|
+
columns: ["Group", "Count", "Min (whisker)", "Q1", "Median", "Q3", "Max (whisker)", "Outliers"],
|
|
5981
|
+
listJoin: ", ",
|
|
5982
|
+
none: "None",
|
|
5983
|
+
tooltipTitle: (name, label2, count) => `${name} (${label2}, n=${count})`,
|
|
5984
|
+
max: "Max (whisker)",
|
|
5985
|
+
q3: "Q3",
|
|
5986
|
+
median: "Median",
|
|
5987
|
+
q1: "Q1",
|
|
5988
|
+
min: "Min (whisker)",
|
|
5989
|
+
outlierRow: "Outliers",
|
|
5990
|
+
chart: (label2) => `Box plot of ${label2}`
|
|
5991
|
+
}
|
|
5992
|
+
};
|
|
5993
|
+
var textOf5 = (locale) => TEXT16[uiLanguage(resolveLocale(locale))];
|
|
5994
|
+
function boxPlotEntries(groups, whisker) {
|
|
5995
|
+
return groups.map((g) => ({ name: g.name, stats: boxStats(g.values, whisker) }));
|
|
5996
|
+
}
|
|
5997
|
+
function buildBoxPlotSummary(entries, formatter, valueLabel, locale) {
|
|
5998
|
+
const t = textOf5(locale);
|
|
5999
|
+
const label2 = valueLabel ?? t.valueInSentence;
|
|
6000
|
+
const real = entries.filter((e) => e.stats !== null);
|
|
6001
|
+
if (real.length === 0) return void 0;
|
|
6002
|
+
const top = real.reduce((a, b) => b.stats.median > a.stats.median ? b : a);
|
|
6003
|
+
const low = real.reduce((a, b) => b.stats.median < a.stats.median ? b : a);
|
|
6004
|
+
const parts = [
|
|
6005
|
+
real.length === 1 ? t.medianOf(top.name, label2, formatter(top.stats.median)) : t.medianRange(label2, top.name, formatter(top.stats.median), low.name, formatter(low.stats.median))
|
|
6006
|
+
];
|
|
6007
|
+
const outliers = real.reduce((sum, e) => sum + e.stats.outliers.length, 0);
|
|
6008
|
+
if (outliers > 0) parts.push(t.outliers(outliers));
|
|
6009
|
+
return parts.join(t.sentenceJoin);
|
|
6010
|
+
}
|
|
6011
|
+
function boxPlotDataTable(entries, formatter, locale) {
|
|
6012
|
+
const t = textOf5(locale);
|
|
6013
|
+
const f = (n) => n === void 0 ? EMPTY_VALUE : formatter(n);
|
|
6014
|
+
return {
|
|
6015
|
+
columns: [...t.columns],
|
|
6016
|
+
rows: entries.map(({ name, stats: s }) => [
|
|
6017
|
+
name,
|
|
6018
|
+
s ? `${s.count}` : EMPTY_VALUE,
|
|
6019
|
+
f(s?.whiskerLow),
|
|
6020
|
+
f(s?.q1),
|
|
6021
|
+
f(s?.median),
|
|
6022
|
+
f(s?.q3),
|
|
6023
|
+
f(s?.whiskerHigh),
|
|
6024
|
+
s ? s.outliers.length > 0 ? s.outliers.map(formatter).join(t.listJoin) : t.none : EMPTY_VALUE
|
|
6025
|
+
])
|
|
6026
|
+
};
|
|
6027
|
+
}
|
|
6028
|
+
var ROW_STYLE4 = "display:flex;align-items:center;gap:8px;line-height:20px";
|
|
6029
|
+
var BOX_SHARE = 0.4;
|
|
6030
|
+
function boxPlotRenderer(color, outliers) {
|
|
6031
|
+
return (_params, api) => {
|
|
6032
|
+
const x = api.coord([api.value(0), api.value(3)])[0] ?? 0;
|
|
6033
|
+
const y = (dim) => api.coord([api.value(0), api.value(dim)])[1] ?? 0;
|
|
6034
|
+
const band = Math.abs(api.size([1, 0])[0] ?? 0);
|
|
6035
|
+
const half = band * BOX_SHARE / 2;
|
|
6036
|
+
const cap = half / 2;
|
|
6037
|
+
const [yLow, yQ1, yMed, yQ3, yHigh] = [y(1), y(2), y(3), y(4), y(5)];
|
|
6038
|
+
const stroke = { stroke: color, lineWidth: 1.5, fill: "none" };
|
|
6039
|
+
const line = (x1, y1, x2, y2) => ({ type: "line", shape: { x1, y1, x2, y2 }, style: stroke });
|
|
6040
|
+
return {
|
|
6041
|
+
type: "group",
|
|
6042
|
+
children: [
|
|
6043
|
+
line(x, yHigh, x, yQ3),
|
|
6044
|
+
line(x, yQ1, x, yLow),
|
|
6045
|
+
line(x - cap, yHigh, x + cap, yHigh),
|
|
6046
|
+
line(x - cap, yLow, x + cap, yLow),
|
|
6047
|
+
{
|
|
6048
|
+
type: "rect",
|
|
6049
|
+
shape: { x: x - half, y: Math.min(yQ3, yQ1), width: half * 2, height: Math.abs(yQ1 - yQ3), r: 2 },
|
|
6050
|
+
style: { fill: withAlpha(color, 0.25), stroke: color, lineWidth: 1.5 }
|
|
6051
|
+
},
|
|
6052
|
+
line(x - half, yMed, x + half, yMed),
|
|
6053
|
+
...(outliers[api.value(0)] ?? []).map((v) => ({
|
|
6054
|
+
type: "circle",
|
|
6055
|
+
shape: { cx: x, cy: api.coord([api.value(0), v])[1] ?? 0, r: 3 },
|
|
6056
|
+
style: { fill: "transparent", stroke: color, lineWidth: 1.5 }
|
|
6057
|
+
}))
|
|
6058
|
+
]
|
|
6059
|
+
};
|
|
6060
|
+
};
|
|
6061
|
+
}
|
|
6062
|
+
function buildBoxPlotOption(config) {
|
|
6063
|
+
const t = textOf5(config.locale);
|
|
6064
|
+
const { entries, valueFormatter, showTooltip = true, valueLabel = t.value } = config;
|
|
6065
|
+
const axisFormatter = config.axisFormatter ?? valueFormatter;
|
|
6066
|
+
const color = config.color || "#888";
|
|
6067
|
+
const data = entries.flatMap((e, i) => e.stats ? [[i, e.stats.whiskerLow, e.stats.q1, e.stats.median, e.stats.q3, e.stats.whiskerHigh, e.stats.min, e.stats.max]] : []);
|
|
6068
|
+
const entryAt = (i) => entries[i];
|
|
6069
|
+
const option = {
|
|
6070
|
+
...chartMotion(false),
|
|
6071
|
+
legend: { show: false },
|
|
6072
|
+
grid: { top: 16, right: 16, bottom: 4, left: 4, containLabel: true },
|
|
6073
|
+
tooltip: {
|
|
6074
|
+
show: showTooltip,
|
|
6075
|
+
trigger: "item",
|
|
6076
|
+
formatter: (params) => {
|
|
6077
|
+
const entry = entryAt(params.value?.[0] ?? -1);
|
|
6078
|
+
const s = entry?.stats;
|
|
6079
|
+
if (!entry || !s) return "";
|
|
6080
|
+
const line = (name, text) => `<div style="${ROW_STYLE4}"><span style="flex:1;opacity:.8">${escapeHtml(name)}</span><span style="font-weight:500;font-variant-numeric:tabular-nums;margin-left:12px">${escapeHtml(text)}</span></div>`;
|
|
6081
|
+
return `<div style="font-weight:500;margin-bottom:4px">${escapeHtml(t.tooltipTitle(entry.name, valueLabel, s.count))}</div>` + line(t.max, valueFormatter(s.whiskerHigh)) + line(t.q3, valueFormatter(s.q3)) + line(t.median, valueFormatter(s.median)) + line(t.q1, valueFormatter(s.q1)) + line(t.min, valueFormatter(s.whiskerLow)) + (s.outliers.length > 0 ? line(t.outlierRow, s.outliers.map(valueFormatter).join(t.listJoin)) : "");
|
|
6082
|
+
}
|
|
6083
|
+
},
|
|
6084
|
+
xAxis: { type: "category", data: entries.map((e) => e.name), axisTick: { show: false }, axisLabel: { interval: 0, hideOverlap: false } },
|
|
6085
|
+
yAxis: {
|
|
6086
|
+
type: "value",
|
|
6087
|
+
axisLine: { show: false },
|
|
6088
|
+
axisTick: { show: false },
|
|
6089
|
+
splitLine: { show: true },
|
|
6090
|
+
axisLabel: { formatter: (v) => axisFormatter(v) }
|
|
6091
|
+
},
|
|
6092
|
+
series: [
|
|
6093
|
+
{
|
|
6094
|
+
id: "box",
|
|
6095
|
+
type: "custom",
|
|
6096
|
+
encode: { x: 0, y: [1, 2, 3, 4, 5, 6, 7] },
|
|
6097
|
+
data,
|
|
6098
|
+
renderItem: boxPlotRenderer(color, entries.map((e) => e.stats?.outliers ?? []))
|
|
6099
|
+
}
|
|
6100
|
+
]
|
|
6101
|
+
};
|
|
6102
|
+
return mergeChartOptions(option, config.chartOptions);
|
|
6103
|
+
}
|
|
6104
|
+
var NO_GROUPS = [];
|
|
6105
|
+
var BoxPlotChart = forwardRef(function BoxPlotChart2({
|
|
6106
|
+
groups = NO_GROUPS,
|
|
6107
|
+
whisker,
|
|
6108
|
+
valueLabel,
|
|
6109
|
+
format,
|
|
6110
|
+
valueFormatter: valueFormatterProp,
|
|
6111
|
+
showTooltip = true,
|
|
6112
|
+
title,
|
|
6113
|
+
summary,
|
|
6114
|
+
actions,
|
|
6115
|
+
fileName,
|
|
6116
|
+
isLoading,
|
|
6117
|
+
emptyState,
|
|
6118
|
+
height,
|
|
6119
|
+
chartOptions,
|
|
6120
|
+
ariaLabel,
|
|
6121
|
+
className,
|
|
6122
|
+
...rest
|
|
6123
|
+
}, ref) {
|
|
6124
|
+
const { ref: frameRef, tokens } = useChartSurface(ref);
|
|
6125
|
+
const locale = useLocale();
|
|
6126
|
+
const t = TEXT16[uiLanguage(locale)];
|
|
6127
|
+
const valueFormatter = useMemo(() => resolveValueFormatter(valueFormatterProp, format, locale), [valueFormatterProp, format, locale]);
|
|
6128
|
+
const entries = useMemo(() => boxPlotEntries(groups, whisker), [groups, whisker]);
|
|
6129
|
+
const [color = ""] = useMemo(() => resolveChartColors(["chart-1"], tokens), [tokens]);
|
|
6130
|
+
const option = useMemo(
|
|
6131
|
+
() => buildBoxPlotOption({ entries, color, valueFormatter, valueLabel, showTooltip, labelColor: tokens?.foreground ?? void 0, chartOptions, locale }),
|
|
6132
|
+
[entries, color, valueFormatter, valueLabel, showTooltip, tokens, chartOptions, locale]
|
|
6133
|
+
);
|
|
6134
|
+
const dataTable = useMemo(() => boxPlotDataTable(entries, valueFormatter, locale), [entries, valueFormatter, locale]);
|
|
6135
|
+
const resolvedSummary = useMemo(
|
|
6136
|
+
() => summary === "auto" ? buildBoxPlotSummary(entries, valueFormatter, valueLabel, locale) : summary,
|
|
6137
|
+
[summary, entries, valueFormatter, valueLabel, locale]
|
|
6138
|
+
);
|
|
6139
|
+
const label2 = ariaLabel ?? t.chart(valueLabel ?? t.valueInSentence);
|
|
6140
|
+
return /* @__PURE__ */ jsx(
|
|
6141
|
+
ChartFrame,
|
|
6142
|
+
{
|
|
6143
|
+
...chartRootProps(rest),
|
|
6144
|
+
ref: frameRef,
|
|
6145
|
+
title,
|
|
6146
|
+
summary: resolvedSummary,
|
|
6147
|
+
isLoading: isLoading ?? false,
|
|
6148
|
+
isEmpty: entries.length === 0,
|
|
6149
|
+
emptyState,
|
|
6150
|
+
height,
|
|
6151
|
+
variant: "bar",
|
|
6152
|
+
ariaLabel: label2,
|
|
6153
|
+
className,
|
|
6154
|
+
dataTable,
|
|
6155
|
+
children: /* @__PURE__ */ jsx(EChart, { option, height: "100%", ariaLabel: label2, actions, fileName, exportHeader: { title, summary: resolvedSummary } })
|
|
6156
|
+
}
|
|
6157
|
+
);
|
|
6158
|
+
});
|
|
6159
|
+
BoxPlotChart.displayName = "BoxPlotChart";
|
|
6160
|
+
var STATUS_LABELS = {
|
|
6161
|
+
ja: {
|
|
6162
|
+
success: "\u6B63\u5E38",
|
|
6163
|
+
partial: "\u4E00\u90E8\u5931\u6557",
|
|
6164
|
+
failed: "\u5931\u6557",
|
|
6165
|
+
delayed: "\u9045\u5EF6",
|
|
6166
|
+
running: "\u5B9F\u884C\u4E2D",
|
|
6167
|
+
stopped: "\u505C\u6B62\u4E2D",
|
|
6168
|
+
active: "\u6709\u52B9",
|
|
6169
|
+
inactive: "\u7121\u52B9",
|
|
6170
|
+
warning: "\u8B66\u544A",
|
|
6171
|
+
error: "\u30A8\u30E9\u30FC",
|
|
6172
|
+
pending: "\u4FDD\u7559\u4E2D"
|
|
6173
|
+
},
|
|
6174
|
+
en: {
|
|
6175
|
+
success: "Healthy",
|
|
6176
|
+
partial: "Partially failed",
|
|
6177
|
+
failed: "Failed",
|
|
6178
|
+
delayed: "Delayed",
|
|
6179
|
+
running: "Running",
|
|
6180
|
+
stopped: "Stopped",
|
|
6181
|
+
active: "Active",
|
|
6182
|
+
inactive: "Inactive",
|
|
6183
|
+
warning: "Warning",
|
|
6184
|
+
error: "Error",
|
|
6185
|
+
pending: "Pending"
|
|
6186
|
+
}
|
|
6187
|
+
};
|
|
6188
|
+
var STATUS_VOCABULARY = {
|
|
6189
|
+
success: { label: STATUS_LABELS.en.success, tone: "positive" },
|
|
6190
|
+
partial: { label: STATUS_LABELS.en.partial, tone: "warning" },
|
|
6191
|
+
failed: { label: STATUS_LABELS.en.failed, tone: "negative" },
|
|
6192
|
+
delayed: { label: STATUS_LABELS.en.delayed, tone: "warning" },
|
|
6193
|
+
running: { label: STATUS_LABELS.en.running, tone: "info" },
|
|
6194
|
+
stopped: { label: STATUS_LABELS.en.stopped, tone: "neutral" },
|
|
6195
|
+
active: { label: STATUS_LABELS.en.active, tone: "positive" },
|
|
6196
|
+
inactive: { label: STATUS_LABELS.en.inactive, tone: "neutral" },
|
|
6197
|
+
warning: { label: STATUS_LABELS.en.warning, tone: "warning" },
|
|
6198
|
+
error: { label: STATUS_LABELS.en.error, tone: "negative" },
|
|
6199
|
+
pending: { label: STATUS_LABELS.en.pending, tone: "info" }
|
|
6200
|
+
};
|
|
6201
|
+
function statusLabel(status, locale) {
|
|
6202
|
+
return Object.hasOwn(STATUS_VOCABULARY, status) ? STATUS_LABELS[uiLanguage(resolveLocale(locale))][status] : status;
|
|
6203
|
+
}
|
|
6204
|
+
var defaultColorMap = Object.fromEntries(
|
|
6205
|
+
Object.entries(STATUS_VOCABULARY).map(([key, { tone }]) => [key, tone])
|
|
6206
|
+
);
|
|
6207
|
+
var legacyColorTones = {
|
|
6208
|
+
green: "positive",
|
|
6209
|
+
gray: "neutral",
|
|
6210
|
+
yellow: "warning",
|
|
6211
|
+
red: "negative",
|
|
6212
|
+
blue: "info"
|
|
6213
|
+
};
|
|
6214
|
+
var toneStyles = {
|
|
6215
|
+
positive: { dot: "bg-positive", bg: "bg-positive-subtle", text: "text-positive", border: "border-positive/20 dark:border-positive/25" },
|
|
6216
|
+
negative: { dot: "bg-negative", bg: "bg-negative-subtle", text: "text-negative", border: "border-negative/20 dark:border-negative/25" },
|
|
6217
|
+
warning: { dot: "bg-warning", bg: "bg-warning-subtle", text: "text-warning", border: "border-warning/20 dark:border-warning/25" },
|
|
6218
|
+
info: { dot: "bg-info", bg: "bg-info-subtle", text: "text-info", border: "border-info/20 dark:border-info/25" },
|
|
6219
|
+
neutral: { dot: "bg-neutral", bg: "bg-neutral-subtle", text: "text-neutral", border: "border-neutral/20 dark:border-neutral/25" }
|
|
6220
|
+
};
|
|
6221
|
+
var resolveTone = (color) => {
|
|
6222
|
+
if (color === void 0) return "neutral";
|
|
6223
|
+
if (Object.hasOwn(toneStyles, color)) return color;
|
|
6224
|
+
return legacyColorTones[color] ?? "neutral";
|
|
6225
|
+
};
|
|
6226
|
+
var StatusBadge = forwardRef(function StatusBadge2({ status, label: label2, colorMap, className }, ref) {
|
|
6227
|
+
const locale = useLocale();
|
|
6228
|
+
const mergedColorMap = { ...defaultColorMap, ...colorMap };
|
|
6229
|
+
const style = toneStyles[resolveTone(mergedColorMap[status])];
|
|
6230
|
+
const displayLabel = label2 ?? statusLabel(status, locale);
|
|
6231
|
+
return /* @__PURE__ */ jsxs(
|
|
6232
|
+
Badge,
|
|
6233
|
+
{
|
|
6234
|
+
ref,
|
|
6235
|
+
"data-slot": "status-badge",
|
|
6236
|
+
variant: "outline",
|
|
6237
|
+
className: cn("gap-1.5 rounded-md", style.border, style.bg, style.text, className),
|
|
6238
|
+
"aria-label": displayLabel,
|
|
6239
|
+
children: [
|
|
6240
|
+
/* @__PURE__ */ jsx("span", { className: cn("inline-block size-1.5 rounded-full", style.dot), "aria-hidden": "true" }),
|
|
6241
|
+
displayLabel
|
|
6242
|
+
]
|
|
6243
|
+
}
|
|
6244
|
+
);
|
|
6245
|
+
});
|
|
6246
|
+
StatusBadge.displayName = "StatusBadge";
|
|
6247
|
+
var KIND_ORDER = ["overdue", "risk", "dueSoon", "stale"];
|
|
6248
|
+
var KIND_TONES = {
|
|
6249
|
+
overdue: "negative",
|
|
6250
|
+
risk: "negative",
|
|
6251
|
+
dueSoon: "warning",
|
|
6252
|
+
stale: "info"
|
|
6253
|
+
};
|
|
6254
|
+
var daysEn = (n) => n === 1 ? "1 day" : `${n} days`;
|
|
6255
|
+
var TEXT17 = {
|
|
6256
|
+
ja: {
|
|
6257
|
+
labels: { overdue: "\u671F\u65E5\u8D85\u904E", risk: "\u30EA\u30B9\u30AF", dueSoon: "\u671F\u9650\u9593\u8FD1", stale: "\u6EDE\u7559" },
|
|
6258
|
+
overdue: (days) => `\u671F\u65E5\u3092 ${days} \u65E5\u904E\u304E\u3066\u3044\u307E\u3059`,
|
|
6259
|
+
dueToday: "\u671F\u65E5\u306F\u4ECA\u65E5\u3067\u3059",
|
|
6260
|
+
dueIn: (days) => `\u671F\u65E5\u307E\u3067\u3042\u3068 ${days} \u65E5\u3067\u3059`,
|
|
6261
|
+
stale: (days) => `${days} \u65E5\u9593\u52D5\u304D\u304C\u3042\u308A\u307E\u305B\u3093`,
|
|
6262
|
+
empty: "\u5BFE\u5FDC\u304C\u5FC5\u8981\u306A\u9805\u76EE\u306F\u3042\u308A\u307E\u305B\u3093",
|
|
6263
|
+
due: "\u671F\u65E5",
|
|
6264
|
+
nextAction: "\u6B21\u306E\u4E00\u624B: "
|
|
6265
|
+
},
|
|
6266
|
+
en: {
|
|
6267
|
+
labels: { overdue: "Overdue", risk: "At risk", dueSoon: "Due soon", stale: "Stalled" },
|
|
6268
|
+
overdue: (days) => `${daysEn(days)} overdue`,
|
|
6269
|
+
dueToday: "Due today",
|
|
6270
|
+
dueIn: (days) => `Due in ${daysEn(days)}`,
|
|
6271
|
+
stale: (days) => `No activity for ${daysEn(days)}`,
|
|
6272
|
+
empty: "Nothing needs attention",
|
|
6273
|
+
due: "Due",
|
|
6274
|
+
nextAction: "Next step: "
|
|
6275
|
+
}
|
|
6276
|
+
};
|
|
6277
|
+
TEXT17.en.labels;
|
|
6278
|
+
function toDate2(value) {
|
|
6279
|
+
if (value === null || value === void 0 || value === "") return null;
|
|
6280
|
+
const date = typeof value === "string" ? parseISO(value) : value;
|
|
6281
|
+
return Number.isFinite(date.getTime()) ? date : null;
|
|
6282
|
+
}
|
|
6283
|
+
function judgeAttention(input) {
|
|
6284
|
+
const asOf = toDate2(input.asOf);
|
|
6285
|
+
if (!asOf) return null;
|
|
6286
|
+
const dueSoonDays = input.dueSoonDays ?? 7;
|
|
6287
|
+
const due = toDate2(input.dueDate);
|
|
6288
|
+
if (due) {
|
|
6289
|
+
const untilDue = differenceInCalendarDays(due, asOf);
|
|
6290
|
+
if (untilDue < 0) return { kind: "overdue", days: -untilDue };
|
|
6291
|
+
}
|
|
6292
|
+
if (input.risk) return { kind: "risk", days: 0 };
|
|
6293
|
+
if (due) {
|
|
6294
|
+
const untilDue = differenceInCalendarDays(due, asOf);
|
|
6295
|
+
if (untilDue <= dueSoonDays) return { kind: "dueSoon", days: untilDue };
|
|
6296
|
+
}
|
|
6297
|
+
const last = toDate2(input.lastActivityAt);
|
|
6298
|
+
if (last && input.staleDays !== void 0) {
|
|
6299
|
+
const idle = differenceInCalendarDays(asOf, last);
|
|
6300
|
+
if (idle >= input.staleDays) return { kind: "stale", days: idle };
|
|
6301
|
+
}
|
|
6302
|
+
return null;
|
|
6303
|
+
}
|
|
6304
|
+
function compareAttention(a, b) {
|
|
6305
|
+
if (!a || !b) return a ? -1 : b ? 1 : 0;
|
|
6306
|
+
const byKind = KIND_ORDER.indexOf(a.kind) - KIND_ORDER.indexOf(b.kind);
|
|
6307
|
+
if (byKind !== 0) return byKind;
|
|
6308
|
+
return a.kind === "dueSoon" ? a.days - b.days : b.days - a.days;
|
|
6309
|
+
}
|
|
6310
|
+
function defaultReason(j, labels, t) {
|
|
6311
|
+
switch (j.kind) {
|
|
6312
|
+
case "overdue":
|
|
6313
|
+
return t.overdue(j.days);
|
|
6314
|
+
case "dueSoon":
|
|
6315
|
+
return j.days === 0 ? t.dueToday : t.dueIn(j.days);
|
|
6316
|
+
case "stale":
|
|
6317
|
+
return t.stale(j.days);
|
|
6318
|
+
case "risk":
|
|
6319
|
+
return labels.risk;
|
|
6320
|
+
}
|
|
6321
|
+
}
|
|
6322
|
+
function cell(row, key) {
|
|
6323
|
+
if (!key || row === null || typeof row !== "object") return void 0;
|
|
6324
|
+
return row[key];
|
|
6325
|
+
}
|
|
6326
|
+
function asDateInput(value) {
|
|
6327
|
+
return typeof value === "string" || value instanceof Date ? value : void 0;
|
|
6328
|
+
}
|
|
6329
|
+
function asNode(value) {
|
|
6330
|
+
return typeof value === "string" || typeof value === "number" ? value : null;
|
|
6331
|
+
}
|
|
6332
|
+
function AttentionList({
|
|
6333
|
+
rows,
|
|
6334
|
+
asOf,
|
|
6335
|
+
dueSoonDays,
|
|
6336
|
+
staleDays,
|
|
6337
|
+
labels,
|
|
6338
|
+
getRowId,
|
|
6339
|
+
getTitle,
|
|
6340
|
+
getDueDate,
|
|
6341
|
+
getLastActivityAt,
|
|
6342
|
+
isRisk,
|
|
6343
|
+
idKey,
|
|
6344
|
+
titleKey,
|
|
6345
|
+
dueDateKey,
|
|
6346
|
+
lastActivityAtKey,
|
|
6347
|
+
riskKey,
|
|
6348
|
+
nextActionKey,
|
|
6349
|
+
getReason,
|
|
6350
|
+
getNextAction,
|
|
6351
|
+
getMeta,
|
|
6352
|
+
onRowClick,
|
|
6353
|
+
includeUnflagged = false,
|
|
6354
|
+
emptyTitle,
|
|
6355
|
+
emptyDescription,
|
|
6356
|
+
className,
|
|
6357
|
+
...rest
|
|
6358
|
+
}) {
|
|
6359
|
+
const locale = useLocale();
|
|
6360
|
+
const t = TEXT17[uiLanguage(locale)];
|
|
6361
|
+
const mergedLabels = useMemo(() => ({ ...t.labels, ...labels }), [t, labels]);
|
|
6362
|
+
const colorMap = KIND_TONES;
|
|
6363
|
+
const dueOf = (row) => getDueDate ? getDueDate(row) : asDateInput(cell(row, dueDateKey));
|
|
6364
|
+
const nextActionOf = (row, j) => getNextAction ? getNextAction(row, j) : asNode(cell(row, nextActionKey));
|
|
6365
|
+
const items = (rows ?? []).map((row, index) => ({
|
|
6366
|
+
row,
|
|
6367
|
+
index,
|
|
6368
|
+
judgement: judgeAttention({
|
|
6369
|
+
dueDate: dueOf(row),
|
|
6370
|
+
lastActivityAt: getLastActivityAt ? getLastActivityAt(row) : asDateInput(cell(row, lastActivityAtKey)),
|
|
6371
|
+
risk: isRisk ? isRisk(row) : Boolean(cell(row, riskKey)),
|
|
6372
|
+
asOf,
|
|
6373
|
+
dueSoonDays,
|
|
6374
|
+
staleDays
|
|
6375
|
+
})
|
|
6376
|
+
})).filter((item) => includeUnflagged || item.judgement).sort((a, b) => compareAttention(a.judgement, b.judgement) || a.index - b.index);
|
|
6377
|
+
if (items.length === 0) {
|
|
6378
|
+
return /* @__PURE__ */ jsx(Empty, { title: emptyTitle ?? t.empty, description: emptyDescription, className });
|
|
6379
|
+
}
|
|
6380
|
+
return /* @__PURE__ */ jsx("ul", { "data-slot": "attention-list", className: cn("divide-y divide-border", className), ...rest, children: items.map(({ row, index, judgement }) => {
|
|
6381
|
+
const due = dueOf(row);
|
|
6382
|
+
const body = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6383
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1", children: [
|
|
6384
|
+
judgement && /* @__PURE__ */ jsx(StatusBadge, { status: judgement.kind, label: mergedLabels[judgement.kind], colorMap }),
|
|
6385
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 font-medium", children: getTitle ? getTitle(row) : asNode(cell(row, titleKey)) }),
|
|
6386
|
+
getMeta && /* @__PURE__ */ jsx("span", { className: "text-sm tabular-nums text-muted-foreground", children: getMeta(row) }),
|
|
6387
|
+
due ? /* @__PURE__ */ jsxs("span", { className: "ml-auto text-sm tabular-nums text-muted-foreground", children: [
|
|
6388
|
+
t.due,
|
|
6389
|
+
" ",
|
|
6390
|
+
formatDate(due, "date", locale)
|
|
6391
|
+
] }) : null
|
|
6392
|
+
] }),
|
|
6393
|
+
judgement && /* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-muted-foreground", children: getReason ? getReason(row, judgement) : defaultReason(judgement, mergedLabels, t) }),
|
|
6394
|
+
judgement && (getNextAction || nextActionKey) && nextActionOf(row, judgement) ? /* @__PURE__ */ jsxs("p", { className: "mt-1 text-sm", children: [
|
|
6395
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: t.nextAction }),
|
|
6396
|
+
nextActionOf(row, judgement)
|
|
6397
|
+
] }) : null
|
|
6398
|
+
] });
|
|
6399
|
+
return /* @__PURE__ */ jsx("li", { "data-slot": "attention-list-row", children: onRowClick ? /* @__PURE__ */ jsx(
|
|
6400
|
+
"button",
|
|
6401
|
+
{
|
|
6402
|
+
type: "button",
|
|
6403
|
+
onClick: () => onRowClick(row),
|
|
6404
|
+
className: "block w-full px-3 py-3 text-left transition-colors hover:bg-muted/50 focus-visible:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
6405
|
+
children: body
|
|
6406
|
+
}
|
|
6407
|
+
) : /* @__PURE__ */ jsx("div", { className: "px-3 py-3", children: body }) }, getRowId ? getRowId(row) : String(cell(row, idKey) ?? index));
|
|
6408
|
+
}) });
|
|
6409
|
+
}
|
|
6410
|
+
AttentionList.displayName = "AttentionList";
|
|
5350
6411
|
function niceStep2(raw) {
|
|
5351
6412
|
if (!(raw > 0) || !Number.isFinite(raw)) return 1;
|
|
5352
6413
|
const exp10 = 10 ** Math.floor(Math.log10(raw));
|
|
@@ -5374,11 +6435,11 @@ var splitCountFor = (height) => height < 200 ? 3 : height < 300 ? 4 : 5;
|
|
|
5374
6435
|
function escapeHtml3(text) {
|
|
5375
6436
|
return text.replace(/[&<>"']/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" })[c]);
|
|
5376
6437
|
}
|
|
5377
|
-
var
|
|
6438
|
+
var TEXT18 = {
|
|
5378
6439
|
ja: { item: "\u9805\u76EE", chart: "\u8907\u5408\u30B0\u30E9\u30D5" },
|
|
5379
6440
|
en: { item: "Item", chart: "Combination chart" }
|
|
5380
6441
|
};
|
|
5381
|
-
var
|
|
6442
|
+
var textOf6 = (locale) => TEXT18[uiLanguage(resolveLocale(locale))];
|
|
5382
6443
|
var axisOf = (s) => s.axis === "right" ? "right" : "left";
|
|
5383
6444
|
function comboSeriesList(series) {
|
|
5384
6445
|
if (!Array.isArray(series)) return [];
|
|
@@ -5531,7 +6592,7 @@ function comboChartDataTable(data, index, series, formatters, labels, locale) {
|
|
|
5531
6592
|
const list = comboSeriesList(series);
|
|
5532
6593
|
const label2 = (key) => labels?.[key] ?? key;
|
|
5533
6594
|
return {
|
|
5534
|
-
columns: [labels?.[index] ??
|
|
6595
|
+
columns: [labels?.[index] ?? textOf6(locale).item, ...list.map((s) => s.label ?? label2(s.key))],
|
|
5535
6596
|
rows: data.map((row) => [
|
|
5536
6597
|
label2(String(row?.[index] ?? "")),
|
|
5537
6598
|
...list.map((s) => {
|
|
@@ -5541,11 +6602,11 @@ function comboChartDataTable(data, index, series, formatters, labels, locale) {
|
|
|
5541
6602
|
])
|
|
5542
6603
|
};
|
|
5543
6604
|
}
|
|
5544
|
-
var
|
|
6605
|
+
var NO_ROWS13 = [];
|
|
5545
6606
|
function ComboChartImpl({
|
|
5546
|
-
data =
|
|
6607
|
+
data = NO_ROWS13,
|
|
5547
6608
|
index,
|
|
5548
|
-
series =
|
|
6609
|
+
series = NO_ROWS13,
|
|
5549
6610
|
format,
|
|
5550
6611
|
rightFormat,
|
|
5551
6612
|
labels,
|
|
@@ -5567,7 +6628,7 @@ function ComboChartImpl({
|
|
|
5567
6628
|
ariaLabel,
|
|
5568
6629
|
...rest
|
|
5569
6630
|
}, ref) {
|
|
5570
|
-
const rows = Array.isArray(data) ? data :
|
|
6631
|
+
const rows = Array.isArray(data) ? data : NO_ROWS13;
|
|
5571
6632
|
const list = useMemo(() => comboSeriesList(series), [series]);
|
|
5572
6633
|
const { ref: frameRef, tokens } = useChartSurface(ref);
|
|
5573
6634
|
const locale = useLocale();
|
|
@@ -5612,7 +6673,7 @@ function ComboChartImpl({
|
|
|
5612
6673
|
[onSelect, rows, list.length]
|
|
5613
6674
|
);
|
|
5614
6675
|
const dataTable = useMemo(() => comboChartDataTable(rows, index, list, formatters, labels, locale), [rows, index, list, formatters, labels, locale]);
|
|
5615
|
-
const label2 = ariaLabel ??
|
|
6676
|
+
const label2 = ariaLabel ?? textOf6(locale).chart;
|
|
5616
6677
|
return /* @__PURE__ */ jsx(
|
|
5617
6678
|
ChartFrame,
|
|
5618
6679
|
{
|
|
@@ -5896,7 +6957,7 @@ function buildFilledMapModel(config) {
|
|
|
5896
6957
|
function escapeHtml4(text) {
|
|
5897
6958
|
return text.replace(/[&<>"']/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" })[c]);
|
|
5898
6959
|
}
|
|
5899
|
-
var
|
|
6960
|
+
var TEXT19 = {
|
|
5900
6961
|
ja: {
|
|
5901
6962
|
join: "\u30FB",
|
|
5902
6963
|
region: "\u5730\u57DF",
|
|
@@ -5912,7 +6973,7 @@ var TEXT15 = {
|
|
|
5912
6973
|
chart: (value) => `Map of ${value}`
|
|
5913
6974
|
}
|
|
5914
6975
|
};
|
|
5915
|
-
var
|
|
6976
|
+
var textOf7 = (locale) => TEXT19[uiLanguage(resolveLocale(locale))];
|
|
5916
6977
|
function detailText(raw, formatter) {
|
|
5917
6978
|
if (raw === null || raw === void 0 || raw === "") return EMPTY_VALUE;
|
|
5918
6979
|
const n = typeof raw === "string" ? null : toChartNumber(raw);
|
|
@@ -5920,7 +6981,7 @@ function detailText(raw, formatter) {
|
|
|
5920
6981
|
}
|
|
5921
6982
|
function buildFilledMapOption(config) {
|
|
5922
6983
|
const { model, labels, valueFormatter } = config;
|
|
5923
|
-
const t =
|
|
6984
|
+
const t = textOf7(config.locale);
|
|
5924
6985
|
const label2 = (key) => labels?.[key] ?? key;
|
|
5925
6986
|
const base = config.color || "#6366f1";
|
|
5926
6987
|
const border = config.surfaceColor ?? "#ffffff";
|
|
@@ -5974,7 +7035,7 @@ function mergeDeep3(a, b) {
|
|
|
5974
7035
|
return out;
|
|
5975
7036
|
}
|
|
5976
7037
|
function filledMapDataTable(model, names, formatter, details = [], labels, locale) {
|
|
5977
|
-
const t =
|
|
7038
|
+
const t = textOf7(locale);
|
|
5978
7039
|
const label2 = (key) => labels?.[key] ?? key;
|
|
5979
7040
|
const cells = (row, value) => [
|
|
5980
7041
|
value === null ? EMPTY_VALUE : formatter(value),
|
|
@@ -5990,15 +7051,15 @@ function buildFilledMapSummary(model, formatter, title, locale) {
|
|
|
5990
7051
|
let best;
|
|
5991
7052
|
for (const r of model.regions) if (r.value !== null && (!best || r.value > best.value)) best = r;
|
|
5992
7053
|
if (!best) return void 0;
|
|
5993
|
-
return `${title ? `${title}: ` : ""}${
|
|
7054
|
+
return `${title ? `${title}: ` : ""}${textOf7(locale).top(best.name, formatter(best.value))}`;
|
|
5994
7055
|
}
|
|
5995
7056
|
function colorsFor2(tokens, tone) {
|
|
5996
7057
|
const [color = "", empty = "", hover = ""] = resolveChartColors([tone, "var(--muted)", "var(--foreground)"], tokens);
|
|
5997
7058
|
return { color, empty, hover };
|
|
5998
7059
|
}
|
|
5999
|
-
var
|
|
7060
|
+
var NO_ROWS14 = [];
|
|
6000
7061
|
function FilledMapImpl({
|
|
6001
|
-
data =
|
|
7062
|
+
data = NO_ROWS14,
|
|
6002
7063
|
region,
|
|
6003
7064
|
value,
|
|
6004
7065
|
map = "auto",
|
|
@@ -6024,7 +7085,7 @@ function FilledMapImpl({
|
|
|
6024
7085
|
ariaLabel,
|
|
6025
7086
|
...rest
|
|
6026
7087
|
}, ref) {
|
|
6027
|
-
const rows = Array.isArray(data) ? data :
|
|
7088
|
+
const rows = Array.isArray(data) ? data : NO_ROWS14;
|
|
6028
7089
|
const { ref: frameRef, surface, tokens } = useChartSurface(ref);
|
|
6029
7090
|
const locale = useLocale();
|
|
6030
7091
|
const formatter = useMemo(() => resolveValueFormatter(valueFormatter, format ?? "number", locale), [valueFormatter, format, locale]);
|
|
@@ -6068,7 +7129,7 @@ function FilledMapImpl({
|
|
|
6068
7129
|
() => summary === "auto" ? model ? buildFilledMapSummary(model, formatter, title, locale) : void 0 : summary,
|
|
6069
7130
|
[summary, model, formatter, title, locale]
|
|
6070
7131
|
);
|
|
6071
|
-
const label2 = ariaLabel ??
|
|
7132
|
+
const label2 = ariaLabel ?? textOf7(locale).chart(labels?.[value] ?? value ?? "");
|
|
6072
7133
|
const isEmpty = rows.length === 0;
|
|
6073
7134
|
return /* @__PURE__ */ jsx(
|
|
6074
7135
|
ChartFrame,
|
|
@@ -6144,7 +7205,7 @@ function symbolMapSize(value, max, hasSize) {
|
|
|
6144
7205
|
function escapeHtml5(text) {
|
|
6145
7206
|
return text.replace(/[&<>"']/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" })[c]);
|
|
6146
7207
|
}
|
|
6147
|
-
var
|
|
7208
|
+
var TEXT20 = {
|
|
6148
7209
|
ja: {
|
|
6149
7210
|
join: "\u30FB",
|
|
6150
7211
|
point: "\u5730\u70B9",
|
|
@@ -6162,7 +7223,7 @@ var TEXT16 = {
|
|
|
6162
7223
|
chart: "Map of points"
|
|
6163
7224
|
}
|
|
6164
7225
|
};
|
|
6165
|
-
var
|
|
7226
|
+
var textOf8 = (locale) => TEXT20[uiLanguage(resolveLocale(locale))];
|
|
6166
7227
|
var coordText = (n) => n === null ? EMPTY_VALUE : n.toFixed(4).replace(/\.?0+$/, "");
|
|
6167
7228
|
function buildSymbolMapOption(config) {
|
|
6168
7229
|
const { model, labels, valueFormatter, sizeFormatter } = config;
|
|
@@ -6239,7 +7300,7 @@ function mergeDeep4(a, b) {
|
|
|
6239
7300
|
return out;
|
|
6240
7301
|
}
|
|
6241
7302
|
function symbolMapDataTable(model, names, formatters, details = [], labels, locale) {
|
|
6242
|
-
const t =
|
|
7303
|
+
const t = textOf8(locale);
|
|
6243
7304
|
const label2 = (key) => labels?.[key] ?? key;
|
|
6244
7305
|
const extra = [names.size, names.color].filter((k) => !!k && k !== names.latitude && k !== names.longitude);
|
|
6245
7306
|
const keys = [.../* @__PURE__ */ new Set([...extra, ...details])];
|
|
@@ -6264,9 +7325,9 @@ function colorsFor3(tokens, tone) {
|
|
|
6264
7325
|
const [toneColor = "", land = "", border = ""] = resolved;
|
|
6265
7326
|
return { toneColor, land, border, categories: resolved.slice(3) };
|
|
6266
7327
|
}
|
|
6267
|
-
var
|
|
7328
|
+
var NO_ROWS15 = [];
|
|
6268
7329
|
function SymbolMapImpl({
|
|
6269
|
-
data =
|
|
7330
|
+
data = NO_ROWS15,
|
|
6270
7331
|
latitude,
|
|
6271
7332
|
longitude,
|
|
6272
7333
|
name,
|
|
@@ -6294,7 +7355,7 @@ function SymbolMapImpl({
|
|
|
6294
7355
|
ariaLabel,
|
|
6295
7356
|
...rest
|
|
6296
7357
|
}, ref) {
|
|
6297
|
-
const rows = Array.isArray(data) ? data :
|
|
7358
|
+
const rows = Array.isArray(data) ? data : NO_ROWS15;
|
|
6298
7359
|
const { ref: frameRef, surface, tokens } = useChartSurface(ref);
|
|
6299
7360
|
const locale = useLocale();
|
|
6300
7361
|
const formatter = useMemo(() => resolveValueFormatter(void 0, format ?? "number", locale), [format, locale]);
|
|
@@ -6304,7 +7365,7 @@ function SymbolMapImpl({
|
|
|
6304
7365
|
() => basemap === "auto" ? detectBasemap(model.points.map((p) => [p.lon, p.lat])) : basemap,
|
|
6305
7366
|
[basemap, model]
|
|
6306
7367
|
);
|
|
6307
|
-
const geo = useGeoMap(
|
|
7368
|
+
const geo = useGeoMap(NO_ROWS15, resolvedBasemap);
|
|
6308
7369
|
const colors = useMemo(() => colorsFor3(tokens, tone), [tokens, tone]);
|
|
6309
7370
|
const option = useMemo(
|
|
6310
7371
|
() => geo ? buildSymbolMapOption({
|
|
@@ -6339,7 +7400,7 @@ function SymbolMapImpl({
|
|
|
6339
7400
|
() => symbolMapDataTable(model, { latitude, longitude, name, size, color }, { value: formatter, size: sizeFormatter }, details, labels, locale),
|
|
6340
7401
|
[model, latitude, longitude, name, size, color, formatter, sizeFormatter, details, labels, locale]
|
|
6341
7402
|
);
|
|
6342
|
-
const label2 = ariaLabel ??
|
|
7403
|
+
const label2 = ariaLabel ?? textOf8(locale).chart;
|
|
6343
7404
|
const isEmpty = rows.length === 0;
|
|
6344
7405
|
const legendCategories = model.categories.length > MAX_CATEGORIES ? [...model.categories.slice(0, MAX_CATEGORIES), otherSeriesLabel(locale)] : model.categories;
|
|
6345
7406
|
const legend = !showLegend ? null : model.colorMode === "numeric" ? /* @__PURE__ */ jsx("div", { "data-slot": "symbol-map-legend", className: "flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-foreground tabular-nums", children: /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
|
|
@@ -6408,7 +7469,7 @@ function buildTreemapModel(config) {
|
|
|
6408
7469
|
function escapeHtml6(text) {
|
|
6409
7470
|
return text.replace(/[&<>"']/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" })[c]);
|
|
6410
7471
|
}
|
|
6411
|
-
var
|
|
7472
|
+
var TEXT21 = {
|
|
6412
7473
|
ja: {
|
|
6413
7474
|
join: "\u30FB",
|
|
6414
7475
|
item: "\u9805\u76EE",
|
|
@@ -6426,10 +7487,10 @@ var TEXT17 = {
|
|
|
6426
7487
|
chart: (value) => `Treemap of ${value}`
|
|
6427
7488
|
}
|
|
6428
7489
|
};
|
|
6429
|
-
var
|
|
7490
|
+
var textOf9 = (locale) => TEXT21[uiLanguage(resolveLocale(locale))];
|
|
6430
7491
|
function buildTreemapOption(config) {
|
|
6431
7492
|
const { model, labels, valueFormatter } = config;
|
|
6432
|
-
const t =
|
|
7493
|
+
const t = textOf9(config.locale);
|
|
6433
7494
|
const label2 = (key) => labels?.[key] ?? key;
|
|
6434
7495
|
const surface = config.surfaceColor ?? "#ffffff";
|
|
6435
7496
|
const base = config.toneColor || "#6366f1";
|
|
@@ -6518,7 +7579,7 @@ function mergeDeep5(a, b) {
|
|
|
6518
7579
|
return out;
|
|
6519
7580
|
}
|
|
6520
7581
|
function treemapDataTable(model, names, formatters, labels, locale) {
|
|
6521
|
-
const t =
|
|
7582
|
+
const t = textOf9(locale);
|
|
6522
7583
|
const label2 = (key) => labels?.[key] ?? key;
|
|
6523
7584
|
const share = (v) => v === null || v <= 0 || model.total <= 0 ? EMPTY_VALUE : formatValue(v / model.total, "percent", locale);
|
|
6524
7585
|
return {
|
|
@@ -6542,16 +7603,16 @@ function buildTreemapSummary(model, title, labels, locale) {
|
|
|
6542
7603
|
let best;
|
|
6543
7604
|
for (const g of model.groups) for (const l of g.leaves) if (!best || l.value > best.value) best = l;
|
|
6544
7605
|
if (!best || model.total <= 0) return void 0;
|
|
6545
|
-
return `${title ? `${title}: ` : ""}${
|
|
7606
|
+
return `${title ? `${title}: ` : ""}${textOf9(locale).top(labels?.[best.name] ?? best.name, formatValue(best.value / model.total, "percent", locale))}`;
|
|
6546
7607
|
}
|
|
6547
7608
|
function colorsFor4(tokens, tone) {
|
|
6548
7609
|
const resolved = resolveChartColors([tone, "var(--foreground)", ...DEFAULT_CHART_COLORS, CHART_OTHER_COLOR], tokens);
|
|
6549
7610
|
const [toneColor = "", foreground = ""] = resolved;
|
|
6550
7611
|
return { toneColor, foreground, categories: resolved.slice(2) };
|
|
6551
7612
|
}
|
|
6552
|
-
var
|
|
7613
|
+
var NO_ROWS16 = [];
|
|
6553
7614
|
function TreemapImpl({
|
|
6554
|
-
data =
|
|
7615
|
+
data = NO_ROWS16,
|
|
6555
7616
|
index,
|
|
6556
7617
|
group,
|
|
6557
7618
|
value,
|
|
@@ -6576,7 +7637,7 @@ function TreemapImpl({
|
|
|
6576
7637
|
ariaLabel,
|
|
6577
7638
|
...rest
|
|
6578
7639
|
}, ref) {
|
|
6579
|
-
const rows = Array.isArray(data) ? data :
|
|
7640
|
+
const rows = Array.isArray(data) ? data : NO_ROWS16;
|
|
6580
7641
|
const { ref: frameRef, surface, tokens } = useChartSurface(ref);
|
|
6581
7642
|
const locale = useLocale();
|
|
6582
7643
|
const formatter = useMemo(() => resolveValueFormatter(valueFormatter, format ?? "number", locale), [valueFormatter, format, locale]);
|
|
@@ -6620,7 +7681,7 @@ function TreemapImpl({
|
|
|
6620
7681
|
() => summary === "auto" ? buildTreemapSummary(model, title, labels, locale) : summary,
|
|
6621
7682
|
[summary, model, title, labels, locale]
|
|
6622
7683
|
);
|
|
6623
|
-
const label2 = ariaLabel ??
|
|
7684
|
+
const label2 = ariaLabel ?? textOf9(locale).chart(labels?.[value] ?? value ?? "");
|
|
6624
7685
|
const legendCategories = model.categories.length > MAX_CATEGORIES2 ? [...model.categories.slice(0, MAX_CATEGORIES2), otherSeriesLabel(locale)] : model.categories;
|
|
6625
7686
|
const legend = !showLegend ? null : colorMode === "numeric" ? /* @__PURE__ */ jsx("div", { "data-slot": "treemap-legend", className: "flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-foreground tabular-nums", children: /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
|
|
6626
7687
|
color && /* @__PURE__ */ jsx("span", { children: labels?.[color] ?? color }),
|
|
@@ -6652,7 +7713,7 @@ function TreemapImpl({
|
|
|
6652
7713
|
}
|
|
6653
7714
|
var Treemap = forwardRef(TreemapImpl);
|
|
6654
7715
|
Treemap.displayName = "Treemap";
|
|
6655
|
-
var
|
|
7716
|
+
var TEXT22 = {
|
|
6656
7717
|
ja: {
|
|
6657
7718
|
tones: { positive: "\u826F\u597D", warning: "\u6CE8\u610F", negative: "\u8981\u5BFE\u5FDC", neutral: "\u4E2D\u7ACB" },
|
|
6658
7719
|
toneNote: (label2) => `\uFF08${label2}\uFF09`,
|
|
@@ -6686,7 +7747,7 @@ var TEXT18 = {
|
|
|
6686
7747
|
exportCsv: "Export CSV"
|
|
6687
7748
|
}
|
|
6688
7749
|
};
|
|
6689
|
-
var useText = () =>
|
|
7750
|
+
var useText = () => TEXT22[uiLanguage(useLocale())];
|
|
6690
7751
|
function resolveFormat(format, row) {
|
|
6691
7752
|
return typeof format === "function" ? format(row) : format;
|
|
6692
7753
|
}
|
|
@@ -6749,10 +7810,10 @@ function useDataTable() {
|
|
|
6749
7810
|
if (!ctx) throw new Error("useDataTable must be used inside <DataTable>");
|
|
6750
7811
|
return ctx;
|
|
6751
7812
|
}
|
|
6752
|
-
var
|
|
7813
|
+
var NO_ROWS17 = [];
|
|
6753
7814
|
function DataTable({
|
|
6754
|
-
columns =
|
|
6755
|
-
data =
|
|
7815
|
+
columns = NO_ROWS17,
|
|
7816
|
+
data = NO_ROWS17,
|
|
6756
7817
|
enableSorting = true,
|
|
6757
7818
|
sorting: sortingProp,
|
|
6758
7819
|
onSortingChange,
|
|
@@ -6779,7 +7840,7 @@ function DataTable({
|
|
|
6779
7840
|
children
|
|
6780
7841
|
}) {
|
|
6781
7842
|
const locale = useLocale();
|
|
6782
|
-
const t =
|
|
7843
|
+
const t = TEXT22[uiLanguage(locale)];
|
|
6783
7844
|
const [sorting, setSorting] = useControlledState(sortingProp, [], onSortingChange);
|
|
6784
7845
|
const [columnFilters, setColumnFilters] = useControlledState(
|
|
6785
7846
|
columnFiltersProp,
|
|
@@ -7063,19 +8124,19 @@ var DataTableContent = forwardRef(
|
|
|
7063
8124
|
}) }, headerGroup.id)) }),
|
|
7064
8125
|
/* @__PURE__ */ jsx(TableBody, { children: isLoading ? Array.from({ length: enablePagination ? table.getState().pagination.pageSize : 5 }).map(
|
|
7065
8126
|
(_, i) => /* @__PURE__ */ jsx(TableRow, { "data-slot": "data-table-skeleton-row", children: Array.from({ length: visibleColumnCount }).map((__, j) => /* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-full" }) }, j)) }, i)
|
|
7066
|
-
) : table.getRowModel().rows.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ jsx(TableRow, { "data-state": row.getIsSelected() ? "selected" : void 0, children: row.getVisibleCells().map((
|
|
7067
|
-
const meta =
|
|
7068
|
-
const comparisonColumn = comparisonOf.get(
|
|
8127
|
+
) : table.getRowModel().rows.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ jsx(TableRow, { "data-state": row.getIsSelected() ? "selected" : void 0, children: row.getVisibleCells().map((cell2) => {
|
|
8128
|
+
const meta = cell2.column.columnDef.meta;
|
|
8129
|
+
const comparisonColumn = comparisonOf.get(cell2.column.id);
|
|
7069
8130
|
const comparisonCell = comparisonColumn ? row.getVisibleCells().find((c) => c.column.id === comparisonColumn.id) : void 0;
|
|
7070
8131
|
return /* @__PURE__ */ jsxs(
|
|
7071
8132
|
TableCell,
|
|
7072
8133
|
{
|
|
7073
8134
|
className: columnClassName(meta, {
|
|
7074
|
-
isComparison: comparisonIds.has(
|
|
7075
|
-
isHost: comparisonOf.has(
|
|
8135
|
+
isComparison: comparisonIds.has(cell2.column.id),
|
|
8136
|
+
isHost: comparisonOf.has(cell2.column.id)
|
|
7076
8137
|
}),
|
|
7077
8138
|
children: [
|
|
7078
|
-
flexRender(
|
|
8139
|
+
flexRender(cell2.column.columnDef.cell, cell2.getContext()),
|
|
7079
8140
|
comparisonCell && /* @__PURE__ */ jsx(
|
|
7080
8141
|
"div",
|
|
7081
8142
|
{
|
|
@@ -7090,7 +8151,7 @@ var DataTableContent = forwardRef(
|
|
|
7090
8151
|
)
|
|
7091
8152
|
]
|
|
7092
8153
|
},
|
|
7093
|
-
|
|
8154
|
+
cell2.id
|
|
7094
8155
|
);
|
|
7095
8156
|
}) }, row.id)) : /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsx(
|
|
7096
8157
|
TableCell,
|
|
@@ -7225,16 +8286,16 @@ DataTableColumnVisibility.displayName = "DataTableColumnVisibility";
|
|
|
7225
8286
|
var SIGNED_NUMBER = /^[+-]\s?[^\d\s=+\-@]{0,3}\d[\d,.]*[^\d\s=+\-@]{0,4}$/;
|
|
7226
8287
|
function toCsv(header, rows, options = {}) {
|
|
7227
8288
|
const { bom = true, guardFormulas = false } = options;
|
|
7228
|
-
const field = (
|
|
7229
|
-
let text =
|
|
7230
|
-
if (guard && typeof
|
|
8289
|
+
const field = (cell2, guard) => {
|
|
8290
|
+
let text = cell2 === null || cell2 === void 0 ? "" : String(cell2);
|
|
8291
|
+
if (guard && typeof cell2 === "string" && /^[=+\-@]/.test(text) && !SIGNED_NUMBER.test(text)) {
|
|
7231
8292
|
text = `'${text}`;
|
|
7232
8293
|
}
|
|
7233
8294
|
return /[",\r\n]/.test(text) ? `"${text.replace(/"/g, '""')}"` : text;
|
|
7234
8295
|
};
|
|
7235
8296
|
const lines = [
|
|
7236
8297
|
header.map((h) => field(h, false)).join(","),
|
|
7237
|
-
...rows.map((row) => row.map((
|
|
8298
|
+
...rows.map((row) => row.map((cell2) => field(cell2, guardFormulas)).join(","))
|
|
7238
8299
|
];
|
|
7239
8300
|
return (bom ? "\uFEFF" : "") + lines.join("\r\n");
|
|
7240
8301
|
}
|
|
@@ -7288,7 +8349,7 @@ function DataTableExport({
|
|
|
7288
8349
|
disabled: isLoading,
|
|
7289
8350
|
children: [
|
|
7290
8351
|
/* @__PURE__ */ jsx(Download, { className: "size-4", "aria-hidden": "true" }),
|
|
7291
|
-
children ??
|
|
8352
|
+
children ?? TEXT22[uiLanguage(locale)].exportCsv
|
|
7292
8353
|
]
|
|
7293
8354
|
}
|
|
7294
8355
|
);
|
|
@@ -7368,14 +8429,14 @@ function pivotSpans(keys, level) {
|
|
|
7368
8429
|
});
|
|
7369
8430
|
return out;
|
|
7370
8431
|
}
|
|
7371
|
-
var
|
|
8432
|
+
var TEXT23 = {
|
|
7372
8433
|
ja: { table: "\u30D4\u30DC\u30C3\u30C8\u8868" },
|
|
7373
8434
|
en: { table: "Pivot table" }
|
|
7374
8435
|
};
|
|
7375
|
-
var
|
|
8436
|
+
var NO_ROWS18 = [];
|
|
7376
8437
|
var asList = (v) => Array.isArray(v) ? v.filter((x) => typeof x === "string") : [];
|
|
7377
8438
|
function PivotTable({
|
|
7378
|
-
data =
|
|
8439
|
+
data = NO_ROWS18,
|
|
7379
8440
|
rows: rowDims,
|
|
7380
8441
|
columns: colDims,
|
|
7381
8442
|
values: valueKeys,
|
|
@@ -7393,8 +8454,8 @@ function PivotTable({
|
|
|
7393
8454
|
ariaLabel
|
|
7394
8455
|
}) {
|
|
7395
8456
|
const locale = useLocale();
|
|
7396
|
-
const t =
|
|
7397
|
-
const dataRows = Array.isArray(data) ? data :
|
|
8457
|
+
const t = TEXT23[uiLanguage(resolveLocale(locale))];
|
|
8458
|
+
const dataRows = Array.isArray(data) ? data : NO_ROWS18;
|
|
7398
8459
|
const rows = useMemo(() => asList(rowDims), [rowDims]);
|
|
7399
8460
|
const columns = useMemo(() => asList(colDims), [colDims]);
|
|
7400
8461
|
const values = useMemo(() => asList(valueKeys), [valueKeys]);
|
|
@@ -7465,7 +8526,7 @@ function PivotTable({
|
|
|
7465
8526
|
);
|
|
7466
8527
|
}
|
|
7467
8528
|
var FilterBarContext = createContext(null);
|
|
7468
|
-
var
|
|
8529
|
+
var TEXT24 = {
|
|
7469
8530
|
ja: {
|
|
7470
8531
|
filters: "\u30D5\u30A3\u30EB\u30BF\u30FC",
|
|
7471
8532
|
selected: (count) => ` (${count}\u4EF6\u9078\u629E\u4E2D)`,
|
|
@@ -7481,7 +8542,7 @@ var TEXT20 = {
|
|
|
7481
8542
|
clearAll: "Clear all filters"
|
|
7482
8543
|
}
|
|
7483
8544
|
};
|
|
7484
|
-
var useText2 = () =>
|
|
8545
|
+
var useText2 = () => TEXT24[uiLanguage(useLocale())];
|
|
7485
8546
|
function useFilterBar() {
|
|
7486
8547
|
const ctx = useContext(FilterBarContext);
|
|
7487
8548
|
if (!ctx) throw new Error("useFilterBar must be used within <FilterBar>");
|
|
@@ -7784,7 +8845,7 @@ var PRESET_LABELS = {
|
|
|
7784
8845
|
lastFiscalYear: "Last fiscal year"
|
|
7785
8846
|
}
|
|
7786
8847
|
};
|
|
7787
|
-
var
|
|
8848
|
+
var TEXT25 = {
|
|
7788
8849
|
ja: { placeholder: "\u671F\u9593\u3092\u9078\u629E", rangeSeparator: " - " },
|
|
7789
8850
|
en: { placeholder: "Pick a date range", rangeSeparator: " \u2013 " }
|
|
7790
8851
|
};
|
|
@@ -7802,7 +8863,7 @@ function createDatePresets({
|
|
|
7802
8863
|
const today = now();
|
|
7803
8864
|
return { from: startOfDay(subDays(today, days - 1)), to: endOfDay(today) };
|
|
7804
8865
|
};
|
|
7805
|
-
const
|
|
8866
|
+
const toDate3 = (unit) => () => {
|
|
7806
8867
|
const today = now();
|
|
7807
8868
|
return {
|
|
7808
8869
|
from: fiscalPeriodRange(today, { unit, fiscalYearStartMonth: startMonth }).from,
|
|
@@ -7852,9 +8913,9 @@ function createDatePresets({
|
|
|
7852
8913
|
return { from: startOfMonth(lastMonth), to: endOfMonth(lastMonth) };
|
|
7853
8914
|
}
|
|
7854
8915
|
},
|
|
7855
|
-
{ label: t.thisQuarter, getValue:
|
|
8916
|
+
{ label: t.thisQuarter, getValue: toDate3("quarter") },
|
|
7856
8917
|
{ label: t.lastQuarter, getValue: previous("quarter") },
|
|
7857
|
-
{ label: t.thisFiscalYear, getValue:
|
|
8918
|
+
{ label: t.thisFiscalYear, getValue: toDate3("year") },
|
|
7858
8919
|
{ label: t.lastFiscalYear, getValue: previous("year") }
|
|
7859
8920
|
];
|
|
7860
8921
|
}
|
|
@@ -7885,7 +8946,7 @@ var DateRangePicker = forwardRef(
|
|
|
7885
8946
|
const [open, setOpen] = useState(false);
|
|
7886
8947
|
const isMobile = useIsMobile();
|
|
7887
8948
|
const locale = useLocale(localeProp);
|
|
7888
|
-
const t =
|
|
8949
|
+
const t = TEXT25[uiLanguage(locale)];
|
|
7889
8950
|
const presets = useMemo(
|
|
7890
8951
|
() => presetsProp ?? createDatePresets({ locale, fiscalYearStartMonth }),
|
|
7891
8952
|
[presetsProp, locale, fiscalYearStartMonth]
|
|
@@ -8102,7 +9163,7 @@ function RemoveButton({ label: label2, onRemove, iconClassName }) {
|
|
|
8102
9163
|
}
|
|
8103
9164
|
);
|
|
8104
9165
|
}
|
|
8105
|
-
var
|
|
9166
|
+
var TEXT26 = {
|
|
8106
9167
|
ja: { placeholder: "\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044", search: "\u691C\u7D22...", empty: "\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3067\u3057\u305F", clear: "\u30AF\u30EA\u30A2" },
|
|
8107
9168
|
en: { placeholder: "Select an option", search: "Search...", empty: "No results found.", clear: "Clear" }
|
|
8108
9169
|
};
|
|
@@ -8122,7 +9183,7 @@ var SearchableSelect = forwardRef(
|
|
|
8122
9183
|
className
|
|
8123
9184
|
}, ref) {
|
|
8124
9185
|
const [open, setOpen] = useState(false);
|
|
8125
|
-
const t =
|
|
9186
|
+
const t = TEXT26[uiLanguage(useLocale())];
|
|
8126
9187
|
const allOptions = useMemo(() => flattenOptions(options), [options]);
|
|
8127
9188
|
const selectedOption = useMemo(
|
|
8128
9189
|
() => allOptions.find((opt) => opt.value === value),
|
|
@@ -8175,7 +9236,7 @@ var SearchableSelect = forwardRef(
|
|
|
8175
9236
|
}
|
|
8176
9237
|
);
|
|
8177
9238
|
SearchableSelect.displayName = "SearchableSelect";
|
|
8178
|
-
var
|
|
9239
|
+
var TEXT27 = {
|
|
8179
9240
|
ja: {
|
|
8180
9241
|
placeholder: "\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044",
|
|
8181
9242
|
search: "\u691C\u7D22...",
|
|
@@ -8192,10 +9253,10 @@ var TEXT23 = {
|
|
|
8192
9253
|
}
|
|
8193
9254
|
};
|
|
8194
9255
|
var NO_OPTIONS3 = [];
|
|
8195
|
-
var
|
|
9256
|
+
var NO_VALUES2 = [];
|
|
8196
9257
|
var MultiSelect = forwardRef(function MultiSelect2({
|
|
8197
9258
|
options = NO_OPTIONS3,
|
|
8198
|
-
value =
|
|
9259
|
+
value = NO_VALUES2,
|
|
8199
9260
|
onChange,
|
|
8200
9261
|
onSearch,
|
|
8201
9262
|
maxCount = 3,
|
|
@@ -8208,7 +9269,7 @@ var MultiSelect = forwardRef(function MultiSelect2({
|
|
|
8208
9269
|
}, ref) {
|
|
8209
9270
|
const [open, setOpen] = useState(false);
|
|
8210
9271
|
const listId = useId();
|
|
8211
|
-
const t =
|
|
9272
|
+
const t = TEXT27[uiLanguage(useLocale())];
|
|
8212
9273
|
const allOptions = useMemo(() => flattenOptions(options), [options]);
|
|
8213
9274
|
const selectedOptions = useMemo(
|
|
8214
9275
|
() => allOptions.filter((opt) => value.includes(opt.value)),
|
|
@@ -8490,7 +9551,7 @@ var LONG_VALUE_CHARS = 10;
|
|
|
8490
9551
|
var DELTA_UNDER_PLACEMENT = "col-start-1 row-span-1 row-start-3 justify-self-start";
|
|
8491
9552
|
var KPI_FOOTER_CLASS = "flex-col items-start gap-2 rounded-none border-t-0 bg-transparent pt-0 text-sm";
|
|
8492
9553
|
var PLACEHOLDER = /\{(\w+)\}/g;
|
|
8493
|
-
var
|
|
9554
|
+
var TEXT28 = {
|
|
8494
9555
|
ja: {
|
|
8495
9556
|
target: "\u76EE\u6A19",
|
|
8496
9557
|
provisional: "\u901F\u5831",
|
|
@@ -8622,7 +9683,7 @@ function KpiCard({
|
|
|
8622
9683
|
...props
|
|
8623
9684
|
}) {
|
|
8624
9685
|
const locale = useLocale(localeProp);
|
|
8625
|
-
const t =
|
|
9686
|
+
const t = TEXT28[uiLanguage(locale)];
|
|
8626
9687
|
const allComparisons = [...comparisonProp ? [comparisonProp] : [], ...comparisons ?? []];
|
|
8627
9688
|
const comparison = allComparisons[0];
|
|
8628
9689
|
const isProvisional = provisional !== void 0 && provisional !== false;
|
|
@@ -8873,7 +9934,7 @@ function updatedAtText(updatedAt, display, locale, t, now, timeZone) {
|
|
|
8873
9934
|
const absolute2 = formatDate(updatedAt, "datetime", locale, { timeZone });
|
|
8874
9935
|
return display === "absolute" ? t.updatedAbsolute(absolute2) : t.updatedBoth(absolute2, relative2);
|
|
8875
9936
|
}
|
|
8876
|
-
var
|
|
9937
|
+
var TEXT29 = {
|
|
8877
9938
|
ja: {
|
|
8878
9939
|
flat: (value) => `\u5909\u5316\u306A\u3057 ${value}%`,
|
|
8879
9940
|
up: (value) => `${value}% \u5897\u52A0`,
|
|
@@ -8902,7 +9963,7 @@ var TrendIndicator = forwardRef(
|
|
|
8902
9963
|
const isGood = direction === "neutral" ? null : direction === "up" === positiveIsGood;
|
|
8903
9964
|
const sentiment = isGood === null ? "neutral" : isGood ? "positive" : "negative";
|
|
8904
9965
|
const Icon = direction === "up" ? ArrowUp : direction === "down" ? ArrowDown : Minus;
|
|
8905
|
-
const t =
|
|
9966
|
+
const t = TEXT29[uiLanguage(useLocale())];
|
|
8906
9967
|
const ariaLabel = direction === "neutral" ? t.flat(value) : direction === "up" ? t.up(value) : t.down(value);
|
|
8907
9968
|
return /* @__PURE__ */ jsxs(
|
|
8908
9969
|
"span",
|
|
@@ -8923,93 +9984,6 @@ var TrendIndicator = forwardRef(
|
|
|
8923
9984
|
}
|
|
8924
9985
|
);
|
|
8925
9986
|
TrendIndicator.displayName = "TrendIndicator";
|
|
8926
|
-
var STATUS_LABELS = {
|
|
8927
|
-
ja: {
|
|
8928
|
-
success: "\u6B63\u5E38",
|
|
8929
|
-
partial: "\u4E00\u90E8\u5931\u6557",
|
|
8930
|
-
failed: "\u5931\u6557",
|
|
8931
|
-
delayed: "\u9045\u5EF6",
|
|
8932
|
-
running: "\u5B9F\u884C\u4E2D",
|
|
8933
|
-
stopped: "\u505C\u6B62\u4E2D",
|
|
8934
|
-
active: "\u6709\u52B9",
|
|
8935
|
-
inactive: "\u7121\u52B9",
|
|
8936
|
-
warning: "\u8B66\u544A",
|
|
8937
|
-
error: "\u30A8\u30E9\u30FC",
|
|
8938
|
-
pending: "\u4FDD\u7559\u4E2D"
|
|
8939
|
-
},
|
|
8940
|
-
en: {
|
|
8941
|
-
success: "Healthy",
|
|
8942
|
-
partial: "Partially failed",
|
|
8943
|
-
failed: "Failed",
|
|
8944
|
-
delayed: "Delayed",
|
|
8945
|
-
running: "Running",
|
|
8946
|
-
stopped: "Stopped",
|
|
8947
|
-
active: "Active",
|
|
8948
|
-
inactive: "Inactive",
|
|
8949
|
-
warning: "Warning",
|
|
8950
|
-
error: "Error",
|
|
8951
|
-
pending: "Pending"
|
|
8952
|
-
}
|
|
8953
|
-
};
|
|
8954
|
-
var STATUS_VOCABULARY = {
|
|
8955
|
-
success: { label: STATUS_LABELS.en.success, tone: "positive" },
|
|
8956
|
-
partial: { label: STATUS_LABELS.en.partial, tone: "warning" },
|
|
8957
|
-
failed: { label: STATUS_LABELS.en.failed, tone: "negative" },
|
|
8958
|
-
delayed: { label: STATUS_LABELS.en.delayed, tone: "warning" },
|
|
8959
|
-
running: { label: STATUS_LABELS.en.running, tone: "info" },
|
|
8960
|
-
stopped: { label: STATUS_LABELS.en.stopped, tone: "neutral" },
|
|
8961
|
-
active: { label: STATUS_LABELS.en.active, tone: "positive" },
|
|
8962
|
-
inactive: { label: STATUS_LABELS.en.inactive, tone: "neutral" },
|
|
8963
|
-
warning: { label: STATUS_LABELS.en.warning, tone: "warning" },
|
|
8964
|
-
error: { label: STATUS_LABELS.en.error, tone: "negative" },
|
|
8965
|
-
pending: { label: STATUS_LABELS.en.pending, tone: "info" }
|
|
8966
|
-
};
|
|
8967
|
-
function statusLabel(status, locale) {
|
|
8968
|
-
return Object.hasOwn(STATUS_VOCABULARY, status) ? STATUS_LABELS[uiLanguage(resolveLocale(locale))][status] : status;
|
|
8969
|
-
}
|
|
8970
|
-
var defaultColorMap = Object.fromEntries(
|
|
8971
|
-
Object.entries(STATUS_VOCABULARY).map(([key, { tone }]) => [key, tone])
|
|
8972
|
-
);
|
|
8973
|
-
var legacyColorTones = {
|
|
8974
|
-
green: "positive",
|
|
8975
|
-
gray: "neutral",
|
|
8976
|
-
yellow: "warning",
|
|
8977
|
-
red: "negative",
|
|
8978
|
-
blue: "info"
|
|
8979
|
-
};
|
|
8980
|
-
var toneStyles = {
|
|
8981
|
-
positive: { dot: "bg-positive", bg: "bg-positive-subtle", text: "text-positive", border: "border-positive/20 dark:border-positive/25" },
|
|
8982
|
-
negative: { dot: "bg-negative", bg: "bg-negative-subtle", text: "text-negative", border: "border-negative/20 dark:border-negative/25" },
|
|
8983
|
-
warning: { dot: "bg-warning", bg: "bg-warning-subtle", text: "text-warning", border: "border-warning/20 dark:border-warning/25" },
|
|
8984
|
-
info: { dot: "bg-info", bg: "bg-info-subtle", text: "text-info", border: "border-info/20 dark:border-info/25" },
|
|
8985
|
-
neutral: { dot: "bg-neutral", bg: "bg-neutral-subtle", text: "text-neutral", border: "border-neutral/20 dark:border-neutral/25" }
|
|
8986
|
-
};
|
|
8987
|
-
var resolveTone = (color) => {
|
|
8988
|
-
if (color === void 0) return "neutral";
|
|
8989
|
-
if (Object.hasOwn(toneStyles, color)) return color;
|
|
8990
|
-
return legacyColorTones[color] ?? "neutral";
|
|
8991
|
-
};
|
|
8992
|
-
var StatusBadge = forwardRef(function StatusBadge2({ status, label: label2, colorMap, className }, ref) {
|
|
8993
|
-
const locale = useLocale();
|
|
8994
|
-
const mergedColorMap = { ...defaultColorMap, ...colorMap };
|
|
8995
|
-
const style = toneStyles[resolveTone(mergedColorMap[status])];
|
|
8996
|
-
const displayLabel = label2 ?? statusLabel(status, locale);
|
|
8997
|
-
return /* @__PURE__ */ jsxs(
|
|
8998
|
-
Badge,
|
|
8999
|
-
{
|
|
9000
|
-
ref,
|
|
9001
|
-
"data-slot": "status-badge",
|
|
9002
|
-
variant: "outline",
|
|
9003
|
-
className: cn("gap-1.5 rounded-md", style.border, style.bg, style.text, className),
|
|
9004
|
-
"aria-label": displayLabel,
|
|
9005
|
-
children: [
|
|
9006
|
-
/* @__PURE__ */ jsx("span", { className: cn("inline-block size-1.5 rounded-full", style.dot), "aria-hidden": "true" }),
|
|
9007
|
-
displayLabel
|
|
9008
|
-
]
|
|
9009
|
-
}
|
|
9010
|
-
);
|
|
9011
|
-
});
|
|
9012
|
-
StatusBadge.displayName = "StatusBadge";
|
|
9013
9987
|
var Placeholder = forwardRef(function Placeholder2({ className, ...props }, ref) {
|
|
9014
9988
|
return /* @__PURE__ */ jsx(
|
|
9015
9989
|
"span",
|
|
@@ -9085,6 +10059,6 @@ function DraftChartPreview({ children }) {
|
|
|
9085
10059
|
return /* @__PURE__ */ jsx("div", { ref, "data-slot": "draft-chart", style: { display: "contents" }, children });
|
|
9086
10060
|
}
|
|
9087
10061
|
|
|
9088
|
-
export { AppShell, AreaChart, BarChart, BarList, COMPARISON_LABELS, CategoryBar, ChartFrame, ComboChart, DEFAULT_SAMPLE_LABEL, DELTA_NOT_COMPARABLE, DashboardCard, DashboardCardAction, DashboardCardContent, DashboardCardDescription, DashboardCardFooter, DashboardCardHeader, DashboardCardPreset, DashboardCardSkeleton, DashboardCardTitle, DataTable, DataTableColumnVisibility, DataTableContent, DataTableExport, DataTablePagination, DataTablePreset, DataTableToolbar, DateRangePicker, Delta, DonutChart, DraftChart, FilledMap, FilterBar, FilterBarActiveChips, FilterBarClearButton, FilterBarMultiSelect, FilterBarPreset, FilterBarSelect, FunnelSteps, Heatmap, KpiCard, Legend, LineChart, MetricUnit, MetricValue, MultiSelect, PageShell, PageShellActions, PageShellContent, PageShellDescription, PageShellHeader, PageShellHeaderEnd, PageShellHeading, PageShellMeta, PageShellSummary, PageShellSummaryCard, PageShellTitle, PivotTable, Placeholder, ProgressCircle, RECORD_MIN_POINTS, SampleBadge, SampleClaim, SampleData, ScatterChart, SearchableSelect, SectionHeader, SegmentedControl, StatusBadge, SymbolMap, Tracker, Treemap, TrendIndicator, UpdatedAt, WaterfallChart, comparisonBaseline, comparisonLabel, computeComparison, computeTargetProgress, defaultChangeDisplay, defaultPresets, deltaVariants, detectRecord, fillKpiTemplate, flattenOptions, formatChange, formatChangeAmount, formatRelativeTime, funnelStepsVariants, inferPeriodGrain, isGroupedOptions, metricValueVariants, pageShellSummaryCardVariants, tableToCsv, toCsv, toneForValue, useDataTable, useSampleMark };
|
|
9089
|
-
//# sourceMappingURL=chunk-
|
|
9090
|
-
//# sourceMappingURL=chunk-
|
|
10062
|
+
export { AppShell, AreaChart, AttentionList, BarChart, BarList, BoxPlotChart, COMPARISON_LABELS, CategoryBar, ChartFrame, ComboChart, DEFAULT_SAMPLE_LABEL, DELTA_NOT_COMPARABLE, DashboardCard, DashboardCardAction, DashboardCardContent, DashboardCardDescription, DashboardCardFooter, DashboardCardHeader, DashboardCardPreset, DashboardCardSkeleton, DashboardCardTitle, DataTable, DataTableColumnVisibility, DataTableContent, DataTableExport, DataTablePagination, DataTablePreset, DataTableToolbar, DateRangePicker, Delta, DonutChart, DraftChart, FilledMap, FilterBar, FilterBarActiveChips, FilterBarClearButton, FilterBarMultiSelect, FilterBarPreset, FilterBarSelect, FunnelSteps, Heatmap, HistogramChart, KpiCard, Legend, LineChart, MetricUnit, MetricValue, MultiSelect, PageShell, PageShellActions, PageShellContent, PageShellDescription, PageShellHeader, PageShellHeaderEnd, PageShellHeading, PageShellMeta, PageShellSummary, PageShellSummaryCard, PageShellTitle, PairedChart, PivotTable, Placeholder, ProgressCircle, RECORD_MIN_POINTS, SampleBadge, SampleClaim, SampleData, ScatterChart, SearchableSelect, SectionHeader, SegmentedControl, StatusBadge, SymbolMap, Tracker, Treemap, TrendIndicator, UpdatedAt, WaterfallChart, comparisonBaseline, comparisonLabel, computeComparison, computeTargetProgress, defaultChangeDisplay, defaultPresets, deltaVariants, detectRecord, fillKpiTemplate, flattenOptions, formatChange, formatChangeAmount, formatRelativeTime, funnelStepsVariants, inferPeriodGrain, isGroupedOptions, metricValueVariants, pageShellSummaryCardVariants, tableToCsv, toCsv, toneForValue, useDataTable, useSampleMark };
|
|
10063
|
+
//# sourceMappingURL=chunk-GNGDOPBT.js.map
|
|
10064
|
+
//# sourceMappingURL=chunk-GNGDOPBT.js.map
|