@fayz-ai/plugin-reports 0.13.3 → 0.13.5
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/index.js
CHANGED
|
@@ -5,9 +5,9 @@ export { exportToPdf } from './chunk-BPTKNPXQ.js';
|
|
|
5
5
|
import { expandBagColumns, formatValuePlain, reportColumnsToTanstack } from './chunk-4QIHTUXD.js';
|
|
6
6
|
import * as React10 from 'react';
|
|
7
7
|
import React10__default, { useState, useEffect } from 'react';
|
|
8
|
-
import { usePluginRuntime, getAnalyticsCards,
|
|
8
|
+
import { usePluginRuntime, getAnalyticsCards, useTranslation, exportCSV, registerTranslations, createSafeDataProvider, getSupabaseClientOptional, hashRouterAdapter } from '@fayz-ai/core';
|
|
9
9
|
import { useOrganizationStore, useShellRailAvailable, useContextualNav, askAI, useAgentSurface, QuickActionsButton, AssistantInvite, RightRailPage } from '@fayz-ai/admin';
|
|
10
|
-
import { AnalyticsContextProvider, useModuleLayout, ModulePage, collectFilters, AnalyticsControls, AnalyticsGrid, Card, FilterChip, DataTable, Button, SubpageHeader, useAnalyticsCard, useAnalyticsCardRows, ToolbarAction, PageHeaderActions, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, useAnalyticsContext, AnalyticsCard, Dropdown, DropdownTrigger, DropdownContent, DropdownItem, Badge, getLucideIcon, Input, Checkbox } from '@fayz-ai/ui';
|
|
10
|
+
import { AnalyticsContextProvider, useModuleLayout, ModulePage, collectFilters, AnalyticsControls, AnalyticsGrid, Card, FilterChip, DataTable, Button, SubpageHeader, useToolbarPanelClose, useAnalyticsCard, useAnalyticsCardRows, ToolbarAction, PageHeaderActions, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, useAnalyticsContext, useAnalyticsAllRows, StatementTable, formatBucket, AnalyticsCard, Dropdown, DropdownTrigger, DropdownContent, DropdownItem, Badge, getLucideIcon, Input, Checkbox } from '@fayz-ai/ui';
|
|
11
11
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
12
12
|
import { BarChart3, User, Search, ArrowLeft, Printer, RotateCcw, ChevronUp, ChevronDown, EyeOff, Eye, Trash2, Construction, Download, GripVertical, SlidersHorizontal, Radio, ChevronLeft, ChevronRight } from 'lucide-react';
|
|
13
13
|
|
|
@@ -1774,6 +1774,8 @@ function useAnalyticsTree() {
|
|
|
1774
1774
|
}), [labels, showLiveView, cards, t]);
|
|
1775
1775
|
}
|
|
1776
1776
|
function AnalyticsModule({ view, cardId, children }) {
|
|
1777
|
+
const t = useTranslation();
|
|
1778
|
+
const { labels } = useAnalyticsConfig();
|
|
1777
1779
|
const variant = useModuleLayout();
|
|
1778
1780
|
const tree = useAnalyticsTree();
|
|
1779
1781
|
const activeId = cardId ? decodeURIComponent(cardId) : void 0;
|
|
@@ -1812,7 +1814,12 @@ function AnalyticsModule({ view, cardId, children }) {
|
|
|
1812
1814
|
section: "main"
|
|
1813
1815
|
}
|
|
1814
1816
|
], [tree]);
|
|
1815
|
-
useContextualNav(claimsRail ? {
|
|
1817
|
+
useContextualNav(claimsRail ? {
|
|
1818
|
+
base: ANALYTICS_BASE,
|
|
1819
|
+
entries,
|
|
1820
|
+
label: tree.title,
|
|
1821
|
+
searchPlaceholder: labels.searchReports ?? t("reports.search")
|
|
1822
|
+
} : null);
|
|
1816
1823
|
const nav = React10__default.useMemo(() => {
|
|
1817
1824
|
if (claimsRail) return [];
|
|
1818
1825
|
return [
|
|
@@ -2113,6 +2120,8 @@ function ViewerBody({ card }) {
|
|
|
2113
2120
|
const { labels, currency } = useAnalyticsConfig();
|
|
2114
2121
|
const { state, setPage, setPageSize } = useAnalyticsContext();
|
|
2115
2122
|
const { result, loading, error, engineMissing } = useAnalyticsCard(card);
|
|
2123
|
+
const isStatement = card.viz.type === "statement" && !!card.viz.statement;
|
|
2124
|
+
const all = useAnalyticsAllRows(card, isStatement && card.available !== false);
|
|
2116
2125
|
const columns = React10__default.useMemo(() => cardColumns(card), [card]);
|
|
2117
2126
|
const expanded = React10__default.useMemo(
|
|
2118
2127
|
() => expandBagColumns(columns, result?.rows ?? []),
|
|
@@ -2131,6 +2140,29 @@ function ViewerBody({ card }) {
|
|
|
2131
2140
|
] });
|
|
2132
2141
|
}
|
|
2133
2142
|
const hasViz = card.viz.type !== "table" || (card.query.measures?.length ?? 0) > 0;
|
|
2143
|
+
if (isStatement && card.viz.statement) {
|
|
2144
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2145
|
+
engineMissing ? /* @__PURE__ */ jsxs("div", { className: "rounded-lg border bg-muted/40 p-3 text-sm", children: [
|
|
2146
|
+
/* @__PURE__ */ jsx("p", { className: "font-medium", children: "Analytics engine not installed" }),
|
|
2147
|
+
/* @__PURE__ */ jsxs("p", { className: "mt-0.5 text-muted-foreground", children: [
|
|
2148
|
+
"This report aggregates server-side and needs migration 0039 (",
|
|
2149
|
+
/* @__PURE__ */ jsx("code", { className: "text-xs", children: "analytics_run" }),
|
|
2150
|
+
" + the read models) applied to this project."
|
|
2151
|
+
] })
|
|
2152
|
+
] }) : error ?? all.error ? /* @__PURE__ */ jsx("div", { className: "rounded-lg border border-destructive/50 bg-destructive/10 p-3 text-sm text-destructive", children: error ?? all.error }) : null,
|
|
2153
|
+
/* @__PURE__ */ jsx(
|
|
2154
|
+
StatementTable,
|
|
2155
|
+
{
|
|
2156
|
+
rows: all.rows,
|
|
2157
|
+
def: card.viz.statement,
|
|
2158
|
+
currency,
|
|
2159
|
+
formatPeriod: (p) => formatBucket(p, "month"),
|
|
2160
|
+
emptyMessage: labels.noResults,
|
|
2161
|
+
loading: all.loading
|
|
2162
|
+
}
|
|
2163
|
+
)
|
|
2164
|
+
] });
|
|
2165
|
+
}
|
|
2134
2166
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2135
2167
|
hasViz ? /* @__PURE__ */ jsx(
|
|
2136
2168
|
AnalyticsCard,
|
|
@@ -2147,7 +2179,7 @@ function ViewerBody({ card }) {
|
|
|
2147
2179
|
" + the read models) applied to this project."
|
|
2148
2180
|
] })
|
|
2149
2181
|
] }) : error ? /* @__PURE__ */ jsx("div", { className: "rounded-lg border border-destructive/50 bg-destructive/10 p-3 text-sm text-destructive", children: error }) : null,
|
|
2150
|
-
/* @__PURE__ */ jsx(
|
|
2182
|
+
/* @__PURE__ */ jsx("div", { className: "print-flow", children: /* @__PURE__ */ jsx(
|
|
2151
2183
|
DataTable,
|
|
2152
2184
|
{
|
|
2153
2185
|
columns: tanstackColumns,
|
|
@@ -2158,7 +2190,7 @@ function ViewerBody({ card }) {
|
|
|
2158
2190
|
variant: "card",
|
|
2159
2191
|
compact: true
|
|
2160
2192
|
}
|
|
2161
|
-
),
|
|
2193
|
+
) }),
|
|
2162
2194
|
!loading ? /* @__PURE__ */ jsx("div", { className: "no-print", children: /* @__PURE__ */ jsx(
|
|
2163
2195
|
ReportPagination,
|
|
2164
2196
|
{
|
|
@@ -2211,6 +2243,13 @@ function AnalyticsReportViewer({ cardId }) {
|
|
|
2211
2243
|
}
|
|
2212
2244
|
function ViewerActions({ card }) {
|
|
2213
2245
|
const { currency, labels } = useAnalyticsConfig();
|
|
2246
|
+
const closePanel = useToolbarPanelClose();
|
|
2247
|
+
const print = React10__default.useCallback(() => {
|
|
2248
|
+
closePanel();
|
|
2249
|
+
requestAnimationFrame(() => {
|
|
2250
|
+
requestAnimationFrame(() => window.setTimeout(() => window.print(), 120));
|
|
2251
|
+
});
|
|
2252
|
+
}, [closePanel]);
|
|
2214
2253
|
const { result } = useAnalyticsCard(card);
|
|
2215
2254
|
const columns = React10__default.useMemo(() => cardColumns(card), [card]);
|
|
2216
2255
|
const fetchAll = useAnalyticsCardRows(card);
|
|
@@ -2227,7 +2266,7 @@ function ViewerActions({ card }) {
|
|
|
2227
2266
|
title: card.name
|
|
2228
2267
|
}
|
|
2229
2268
|
),
|
|
2230
|
-
/* @__PURE__ */ jsx(ToolbarAction, { icon: Printer, onClick:
|
|
2269
|
+
/* @__PURE__ */ jsx(ToolbarAction, { icon: Printer, onClick: print, children: labels.print })
|
|
2231
2270
|
] });
|
|
2232
2271
|
}
|
|
2233
2272
|
function LiveViewPage() {
|