serverside_pivot 0.0.91 → 0.0.96
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/README.md +182 -182
- package/dist/react/chunks/ContextMenu-DJuS4qTZ.mjs +198 -0
- package/dist/react/chunks/{DetailDrawer-Eb4EpVHG.mjs → DetailDrawer-DgKSC5Vu.mjs} +1 -1
- package/dist/react/chunks/{DetailSidePanel-BTcHOiKr.mjs → DetailSidePanel-CC5Dugyl.mjs} +1 -1
- package/dist/react/chunks/{DetailSurfaceContent-B3ZNKh7q.mjs → DetailSurfaceContent-CrQVHlcU.mjs} +85 -77
- package/dist/react/chunks/{ECharts2dRenderer-C3Qv0uAa.mjs → ECharts2dRenderer-46gLrUdf.mjs} +412 -410
- package/dist/react/chunks/{ECharts3dRenderer-BB_7-fOt.mjs → ECharts3dRenderer-Dg4ta5Bl.mjs} +2211 -3197
- package/dist/react/chunks/{EditSidePanel-C2cAvxlK.mjs → EditSidePanel-CkShaByb.mjs} +77 -65
- package/dist/react/chunks/{InlineDetailPanel-BXLAw1o3.mjs → InlineDetailPanel-mnwjoD0I.mjs} +1 -1
- package/dist/react/chunks/PivotCharts-MX-Z7DlR.mjs +5076 -0
- package/dist/react/chunks/{ReportEditor-D4V0ry2B.mjs → ReportEditor-U0E42xKL.mjs} +952 -631
- package/dist/react/chunks/SidebarPanel-BzRW1Kgq.mjs +3944 -0
- package/dist/react/chunks/{SparklineDetailGraph-Bu85X7OJ.mjs → SparklineDetailGraph-35Tim_8B.mjs} +88 -58
- package/dist/react/chunks/installCanvasRenderer-DRq0xpXO.mjs +21174 -0
- package/dist/react/chunks/react-CL4GbEOd.mjs +33206 -0
- package/dist/react/chunks/{xlsx.mini.min-vfxHk3Ry.mjs → xlsx.mini.min-kfIgXMVB.mjs} +5 -5
- package/dist/react/components/Charts/ChartRenderers.d.ts +5 -73
- package/dist/react/components/Charts/ChartWorkspace.d.ts +3 -34
- package/dist/react/components/Charts/ECharts2dRenderer.d.ts +2 -5
- package/dist/react/components/Charts/ECharts3dRenderer.d.ts +2 -6
- package/dist/react/components/Charts/PivotCharts.d.ts +2 -9
- package/dist/react/components/Charts/chartEnhancements.d.ts +17 -66
- package/dist/react/components/Charts/chartExportPresentation.d.ts +5 -19
- package/dist/react/components/Charts/chartMath.d.ts +4 -4
- package/dist/react/components/Charts/useChartExportMenu.d.ts +4 -12
- package/dist/react/components/DashTanstackPivot.react.d.ts +40 -0
- package/dist/react/components/Filters/ColumnFilter.d.ts +2 -12
- package/dist/react/components/Filters/DateRangeFilter.d.ts +2 -7
- package/dist/react/components/Filters/FilterPopover.d.ts +2 -13
- package/dist/react/components/Filters/MultiSelectFilter.d.ts +2 -11
- package/dist/react/components/Filters/NumericRangeFilter.d.ts +2 -7
- package/dist/react/components/Notification.d.ts +2 -6
- package/dist/react/components/PivotAppBar.d.ts +2 -2
- package/dist/react/components/PivotErrorBoundary.d.ts +11 -7
- package/dist/react/components/PivotSmallComponents.d.ts +2 -3
- package/dist/react/components/PivotWorkspaceCanvas.d.ts +2 -5
- package/dist/react/components/PivotWorkspaceControls.d.ts +4 -8
- package/dist/react/components/PivotWorkspaceShell.d.ts +4 -12
- package/dist/react/components/RuntimeDataError.d.ts +2 -7
- package/dist/react/components/ShimmerFallback.d.ts +11 -0
- package/dist/react/components/Sidebar/ColumnTreeItem.d.ts +2 -13
- package/dist/react/components/Sidebar/ReportEditor.d.ts +7 -20
- package/dist/react/components/Sidebar/SidebarFilterItem.d.ts +2 -13
- package/dist/react/components/Sidebar/SidebarPanel.d.ts +1 -2
- package/dist/react/components/Sidebar/ToolPanelSection.d.ts +2 -13
- package/dist/react/components/Sidebar/customCategoryUtils.d.ts +31 -62
- package/dist/react/components/Sidebar/formulaUtils.d.ts +16 -18
- package/dist/react/components/SkeletonRow.d.ts +2 -5
- package/dist/react/components/Table/ContextMenu.d.ts +2 -8
- package/dist/react/components/Table/DetailDrawer.d.ts +2 -11
- package/dist/react/components/Table/DetailSidePanel.d.ts +2 -11
- package/dist/react/components/Table/DetailSurfaceContent.d.ts +2 -11
- package/dist/react/components/Table/EditSidePanel.d.ts +2 -20
- package/dist/react/components/Table/EditableCell.d.ts +2 -28
- package/dist/react/components/Table/InlineDetailPanel.d.ts +2 -13
- package/dist/react/components/Table/PivotTableBody.d.ts +3 -3
- package/dist/react/components/Table/SparklineCell.d.ts +2 -17
- package/dist/react/components/Table/SparklineDetailGraph.d.ts +2 -5
- package/dist/react/components/Table/StatusBar.d.ts +2 -7
- package/dist/react/components/ThemedSelect.d.ts +8 -0
- package/dist/react/contexts/PivotConfigContext.d.ts +5 -33
- package/dist/react/contexts/PivotThemeContext.d.ts +8 -4
- package/dist/react/contexts/PivotValueDisplayContext.d.ts +5 -9
- package/dist/react/hooks/useChartState.d.ts +2 -71
- package/dist/react/hooks/useColumnDefs.d.ts +3 -68
- package/dist/react/hooks/useColumnVirtualizer.d.ts +1 -30
- package/dist/react/hooks/useDetailDrillThrough.d.ts +2 -36
- package/dist/react/hooks/useFilteredData.d.ts +4 -2
- package/dist/react/hooks/useFormatState.d.ts +2 -39
- package/dist/react/hooks/usePersistence.d.ts +4 -5
- package/dist/react/hooks/usePivotFieldInteractions.d.ts +2 -23
- package/dist/react/hooks/usePivotNormalization.d.ts +127 -461
- package/dist/react/hooks/usePivotRenderCounter.d.ts +2 -1
- package/dist/react/hooks/usePivotTransactions.d.ts +2 -23
- package/dist/react/hooks/useRenderHelpers.d.ts +3 -71
- package/dist/react/hooks/useReportMode.d.ts +2 -28
- package/dist/react/hooks/useRowCache.d.ts +16 -15
- package/dist/react/hooks/useRuntimeDataCommit.d.ts +2 -22
- package/dist/react/hooks/useRuntimeProfiling.d.ts +2 -13
- package/dist/react/hooks/useRuntimeTransport.d.ts +2 -18
- package/dist/react/hooks/useServerSideRowModel.d.ts +1 -50
- package/dist/react/hooks/useServerSideViewportController.d.ts +1 -64
- package/dist/react/hooks/useSidebarUI.d.ts +2 -32
- package/dist/react/hooks/useStickyStyles.d.ts +2 -23
- package/dist/react/index.mjs +15 -9
- package/dist/react/presentation/headerFormatting.d.ts +28 -11
- package/dist/react/presentation/safeCellContent.d.ts +22 -5
- package/dist/react/react.d.ts +4 -1
- package/dist/react/runtime/PivotRuntimeRoot.d.ts +1 -1
- package/dist/react/runtime/client/clientPivotTransport.d.ts +6 -1
- package/dist/react/runtime/client/clientResponsePostProcessor.d.ts +50 -0
- package/dist/react/runtime/client/duckdbWasmExecutor.d.ts +3 -0
- package/dist/react/runtime/client/types.d.ts +17 -0
- package/dist/react/runtime/createRuntimeCellPresentation.d.ts +2 -7
- package/dist/react/runtime/createRuntimeExportCommands.d.ts +2 -71
- package/dist/react/runtime/createRuntimeRowPinCommand.d.ts +2 -9
- package/dist/react/runtime/displayColumnOrder.d.ts +4 -4
- package/dist/react/runtime/httpTransport.d.ts +1 -0
- package/dist/react/runtime/runtime-contract.generated.d.ts +3 -0
- package/dist/react/runtime/runtimeContract.d.ts +3 -0
- package/dist/react/runtime/runtimeDomains.d.ts +110 -0
- package/dist/react/runtime/useChartWorkspacePresentation.d.ts +2 -45
- package/dist/react/runtime/useCoreRuntime.d.ts +4 -1
- package/dist/react/runtime/useCoreRuntimeStage.d.ts +1 -1
- package/dist/react/runtime/useRuntimeCellSelection.d.ts +2 -40
- package/dist/react/runtime/useRuntimeChartCanvasCommands.d.ts +7 -31
- package/dist/react/runtime/useRuntimeChartCanvasResize.d.ts +2 -13
- package/dist/react/runtime/useRuntimeChartCanvasVerticalResize.d.ts +2 -9
- package/dist/react/runtime/useRuntimeChartDefinitionCommands.d.ts +2 -14
- package/dist/react/runtime/useRuntimeChartFloatingInteractions.d.ts +2 -28
- package/dist/react/runtime/useRuntimeChartModels.d.ts +2 -62
- package/dist/react/runtime/useRuntimeChartPanelSizing.d.ts +2 -12
- package/dist/react/runtime/useRuntimeChartRequestDispatch.d.ts +2 -4
- package/dist/react/runtime/useRuntimeClipboardExportPresentation.d.ts +2 -152
- package/dist/react/runtime/useRuntimeClipboardPaste.d.ts +2 -7
- package/dist/react/runtime/useRuntimeColorScalePresentation.d.ts +2 -55
- package/dist/react/runtime/useRuntimeColumnAutoSizing.d.ts +2 -26
- package/dist/react/runtime/useRuntimeColumnCommands.d.ts +2 -22
- package/dist/react/runtime/useRuntimeColumnMeasurement.d.ts +2 -11
- package/dist/react/runtime/useRuntimeDataRetry.d.ts +2 -12
- package/dist/react/runtime/useRuntimeDisplayNavigation.d.ts +2 -11
- package/dist/react/runtime/useRuntimeEditCellIdentity.d.ts +2 -18
- package/dist/react/runtime/useRuntimeEditChangeTracking.d.ts +2 -28
- package/dist/react/runtime/useRuntimeEditComparisonState.d.ts +2 -35
- package/dist/react/runtime/useRuntimeEditDispatch.d.ts +2 -43
- package/dist/react/runtime/useRuntimeEditOwnership.d.ts +2 -28
- package/dist/react/runtime/useRuntimeEditPresentation.d.ts +2 -32
- package/dist/react/runtime/useRuntimeEditStatePersistence.d.ts +2 -24
- package/dist/react/runtime/useRuntimeExportState.d.ts +5 -5
- package/dist/react/runtime/useRuntimeFilterPopover.d.ts +2 -19
- package/dist/react/runtime/useRuntimeLayoutHistory.d.ts +2 -40
- package/dist/react/runtime/useRuntimeOptimisticCellState.d.ts +2 -27
- package/dist/react/runtime/useRuntimeRequestSession.d.ts +2 -76
- package/dist/react/runtime/useRuntimeResponseLifecycle.d.ts +2 -43
- package/dist/react/runtime/useRuntimeResponsePostCommit.d.ts +2 -15
- package/dist/react/runtime/useRuntimeRowEditSessions.d.ts +2 -28
- package/dist/react/runtime/useRuntimeRowEditing.d.ts +2 -18
- package/dist/react/runtime/useRuntimeRowSelection.d.ts +2 -14
- package/dist/react/runtime/useRuntimeSelectionFormatting.d.ts +2 -30
- package/dist/react/runtime/useRuntimeStructuralSync.d.ts +2 -61
- package/dist/react/runtime/useRuntimeViewRestoreScroll.d.ts +2 -5
- package/dist/react/runtime/useRuntimeViewSnapshot.d.ts +2 -196
- package/dist/react/runtime/useRuntimeViewportTableData.d.ts +2 -23
- package/dist/react/runtime/useWorkspaceStatusPresentation.d.ts +2 -109
- package/dist/react/utils/Icons.d.ts +2 -45
- package/dist/react/utils/chartModelBuilders.d.ts +76 -230
- package/dist/react/utils/columnOrder.d.ts +8 -12
- package/dist/react/utils/dataBars.d.ts +4 -7
- package/dist/react/utils/domEvents.d.ts +2 -1
- package/dist/react/utils/editing.d.ts +12 -47
- package/dist/react/utils/exportUtils.d.ts +30 -101
- package/dist/react/utils/fieldPanelLayout.d.ts +12 -61
- package/dist/react/utils/filterOptions.d.ts +4 -4
- package/dist/react/utils/helpers.d.ts +21 -18
- package/dist/react/utils/horizontalViewport.d.ts +1 -12
- package/dist/react/utils/layoutRows.d.ts +3 -3
- package/dist/react/utils/measureAxis.d.ts +6 -22
- package/dist/react/utils/pivotLayoutUtils.d.ts +7 -2
- package/dist/react/utils/pivotProfiler.d.ts +3 -3
- package/dist/react/utils/reportEditorSelection.d.ts +1 -23
- package/dist/react/utils/rowSpanning.d.ts +3 -6
- package/dist/react/utils/savedReports.d.ts +4 -7
- package/dist/react/utils/sorting.d.ts +8 -14
- package/dist/react/utils/sparklineDetail.d.ts +5 -8
- package/dist/react/utils/sparklines.d.ts +10 -78
- package/dist/react/utils/styles.d.ts +19 -308
- package/package.json +114 -114
- package/dist/react/chunks/ContextMenu-Bt5_3bmD.mjs +0 -192
- package/dist/react/chunks/PivotCharts-Bw6Swoa3.mjs +0 -4252
- package/dist/react/chunks/SidebarPanel-xO59p_2o.mjs +0 -3339
- package/dist/react/chunks/installCanvasRenderer-B7sfDGoL.mjs +0 -21281
- package/dist/react/chunks/react-CPZZxtSo.mjs +0 -26999
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import t, { useState as H, useRef as
|
|
2
|
-
import {
|
|
3
|
-
const
|
|
1
|
+
import t, { useState as H, useRef as Fe, useMemo as W, useCallback as B, useEffect as Ee } from "react";
|
|
2
|
+
import { ab as St, an as wt, I as m, ao as Ct, T as U, ad as kt, _ as M, ap as At } from "./react-CL4GbEOd.mjs";
|
|
3
|
+
const oe = () => `r${Date.now().toString(36)}${Math.random().toString(36).slice(2, 6)}`, Qe = [
|
|
4
4
|
{ value: "eq", label: "Equals" },
|
|
5
5
|
{ value: "not_eq", label: "Not equals" },
|
|
6
6
|
{ value: "in", label: "In list" },
|
|
@@ -11,7 +11,7 @@ const ae = () => `r${Date.now().toString(36)}${Math.random().toString(36).slice(
|
|
|
11
11
|
{ value: "gte", label: "Greater or equal" },
|
|
12
12
|
{ value: "lt", label: "Less than" },
|
|
13
13
|
{ value: "lte", label: "Less or equal" }
|
|
14
|
-
],
|
|
14
|
+
], pe = /* @__PURE__ */ new Set(["in", "not_in"]), $t = {
|
|
15
15
|
eq: "=",
|
|
16
16
|
not_eq: "!=",
|
|
17
17
|
in: "in",
|
|
@@ -22,7 +22,7 @@ const ae = () => `r${Date.now().toString(36)}${Math.random().toString(36).slice(
|
|
|
22
22
|
gte: ">=",
|
|
23
23
|
lt: "<",
|
|
24
24
|
lte: "<="
|
|
25
|
-
},
|
|
25
|
+
}, Ft = /* @__PURE__ */ new Set([
|
|
26
26
|
"depth",
|
|
27
27
|
"_id",
|
|
28
28
|
"_path",
|
|
@@ -32,8 +32,8 @@ const ae = () => `r${Date.now().toString(36)}${Math.random().toString(36).slice(
|
|
|
32
32
|
"_has_children",
|
|
33
33
|
"_is_expanded",
|
|
34
34
|
"__col_schema"
|
|
35
|
-
]), T = "default",
|
|
36
|
-
const l = e && typeof e == "object" ? e : {}, n = Number(l.indent), a = Number(l.borderWidth), r = typeof l.borderStyle == "string" &&
|
|
35
|
+
]), T = "default", De = "branch:", Ue = ["", "solid", "dashed", "dotted", "double"], et = (e = "") => ({ _id: oe(), field: e, operator: "eq", value: "", values: [] }), Le = () => ({ op: "AND", clauses: [] }), Bt = () => ({ _id: oe(), label: "", condition: Le(), child: null }), Se = (e = {}) => {
|
|
36
|
+
const l = e && typeof e == "object" ? e : {}, n = Number(l.indent), a = Number(l.borderWidth), r = typeof l.borderStyle == "string" && Ue.includes(l.borderStyle) ? l.borderStyle : "";
|
|
37
37
|
return {
|
|
38
38
|
indent: Number.isFinite(n) && n >= 0 ? Math.floor(n) : "",
|
|
39
39
|
bold: l.bold === !0,
|
|
@@ -46,8 +46,8 @@ const ae = () => `r${Date.now().toString(36)}${Math.random().toString(36).slice(
|
|
|
46
46
|
borderColor: typeof l.borderColor == "string" ? l.borderColor : "",
|
|
47
47
|
borderWidth: Number.isFinite(a) && a > 0 ? Math.floor(a) : ""
|
|
48
48
|
};
|
|
49
|
-
},
|
|
50
|
-
_id:
|
|
49
|
+
}, Y = (e = "") => ({
|
|
50
|
+
_id: oe(),
|
|
51
51
|
field: e,
|
|
52
52
|
label: "",
|
|
53
53
|
topN: null,
|
|
@@ -55,37 +55,37 @@ const ae = () => `r${Date.now().toString(36)}${Math.random().toString(36).slice(
|
|
|
55
55
|
sortDir: "desc",
|
|
56
56
|
sortAbs: !1,
|
|
57
57
|
filters: null,
|
|
58
|
-
format:
|
|
58
|
+
format: Se(),
|
|
59
59
|
defaultChild: null,
|
|
60
60
|
branches: []
|
|
61
|
-
}),
|
|
62
|
-
_id: typeof e._id == "string" ? e._id :
|
|
61
|
+
}), Dt = (e) => !e || typeof e.field != "string" || !e.field ? null : {
|
|
62
|
+
_id: typeof e._id == "string" ? e._id : oe(),
|
|
63
63
|
field: e.field,
|
|
64
|
-
operator:
|
|
64
|
+
operator: Qe.some((l) => l.value === e.operator) ? e.operator : "eq",
|
|
65
65
|
value: e.value !== void 0 && e.value !== null ? String(e.value) : "",
|
|
66
66
|
values: Array.isArray(e.values) ? e.values.map(String).filter(Boolean) : []
|
|
67
|
-
},
|
|
67
|
+
}, ze = (e) => ({
|
|
68
68
|
op: e && e.op === "OR" ? "OR" : "AND",
|
|
69
|
-
clauses: Array.isArray(e && e.clauses) ? e.clauses.map(
|
|
70
|
-
}),
|
|
71
|
-
_id: typeof e._id == "string" ? e._id :
|
|
69
|
+
clauses: Array.isArray(e && e.clauses) ? e.clauses.map(Dt).filter(Boolean) : []
|
|
70
|
+
}), Re = (e) => !e || typeof e != "object" ? null : {
|
|
71
|
+
_id: typeof e._id == "string" ? e._id : oe(),
|
|
72
72
|
label: typeof e.label == "string" ? e.label : "",
|
|
73
|
-
condition:
|
|
73
|
+
condition: ze(e.condition),
|
|
74
74
|
sourceRowPath: Array.isArray(e.sourceRowPath) ? e.sourceRowPath.map(String).filter(Boolean) : [],
|
|
75
75
|
sourcePathFields: Array.isArray(e.sourcePathFields) ? e.sourcePathFields.map(String).filter(Boolean) : [],
|
|
76
76
|
child: e.child ? V(e.child) : null
|
|
77
77
|
};
|
|
78
78
|
function V(e) {
|
|
79
79
|
if (!e || typeof e != "object") return null;
|
|
80
|
-
let l = Array.isArray(e.branches) ? e.branches.map(
|
|
81
|
-
l.length === 0 && e.childrenByValue && typeof e.childrenByValue == "object" && (l = Object.entries(e.childrenByValue).filter(([a]) => a).map(([a, r]) =>
|
|
80
|
+
let l = Array.isArray(e.branches) ? e.branches.map(Re).filter(Boolean) : [];
|
|
81
|
+
l.length === 0 && e.childrenByValue && typeof e.childrenByValue == "object" && (l = Object.entries(e.childrenByValue).filter(([a]) => a).map(([a, r]) => Re({
|
|
82
82
|
label: a,
|
|
83
83
|
condition: { op: "AND", clauses: [{ field: e.field || "", operator: "eq", value: a, values: [] }] },
|
|
84
84
|
child: r
|
|
85
85
|
})).filter(Boolean));
|
|
86
|
-
const n = e.filters && typeof e.filters == "object" ?
|
|
86
|
+
const n = e.filters && typeof e.filters == "object" ? ze(e.filters) : null;
|
|
87
87
|
return {
|
|
88
|
-
_id: typeof e._id == "string" ? e._id :
|
|
88
|
+
_id: typeof e._id == "string" ? e._id : oe(),
|
|
89
89
|
field: typeof e.field == "string" ? e.field : "",
|
|
90
90
|
label: typeof e.label == "string" ? e.label : "",
|
|
91
91
|
topN: Number.isFinite(Number(e.topN)) && Number(e.topN) > 0 ? Math.floor(Number(e.topN)) : null,
|
|
@@ -93,42 +93,60 @@ function V(e) {
|
|
|
93
93
|
sortDir: e.sortDir === "asc" ? "asc" : "desc",
|
|
94
94
|
sortAbs: e.sortAbs === !0,
|
|
95
95
|
filters: n && n.clauses.length > 0 ? n : null,
|
|
96
|
-
format:
|
|
96
|
+
format: Se(e.format),
|
|
97
97
|
defaultChild: e.defaultChild ? V(e.defaultChild) : null,
|
|
98
98
|
branches: l
|
|
99
99
|
};
|
|
100
100
|
}
|
|
101
|
-
const _e = (e) => `${
|
|
102
|
-
if (typeof e != "string" || !e.startsWith(
|
|
103
|
-
const l = parseInt(e.slice(
|
|
101
|
+
const _e = (e) => `${De}${e}`, Ce = (e) => {
|
|
102
|
+
if (typeof e != "string" || !e.startsWith(De)) return -1;
|
|
103
|
+
const l = parseInt(e.slice(De.length), 10);
|
|
104
104
|
return Number.isFinite(l) ? l : -1;
|
|
105
|
-
},
|
|
105
|
+
}, Rt = (e, l) => {
|
|
106
106
|
const n = new Set(
|
|
107
|
-
(l || []).filter(
|
|
107
|
+
(l || []).filter(
|
|
108
|
+
/** @param {any} [config] @returns {any} */
|
|
109
|
+
(a) => a && a.field && a.agg
|
|
110
|
+
).map(
|
|
111
|
+
/** @param {any} [config] @returns {any} */
|
|
112
|
+
(a) => a.agg === "formula" ? a.field : `${a.field}_${a.agg}`
|
|
113
|
+
)
|
|
114
|
+
);
|
|
115
|
+
return (e || []).filter(
|
|
116
|
+
/** @param {any} [field] @returns {any} */
|
|
117
|
+
(a) => a && typeof a == "string" && !Ft.has(a) && (!a.startsWith("_") || kt(a)) && !n.has(a)
|
|
108
118
|
);
|
|
109
|
-
|
|
110
|
-
}, Rt = (e) => {
|
|
119
|
+
}, Nt = (e) => {
|
|
111
120
|
const l = [
|
|
112
121
|
{ value: "", label: "(default)" },
|
|
113
122
|
{ value: "__field__", label: "Field value (A→Z / Z→A)" }
|
|
114
123
|
];
|
|
115
|
-
return (e || []).forEach(
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
124
|
+
return (e || []).forEach(
|
|
125
|
+
/** @param {any} [config] @returns {any} */
|
|
126
|
+
(n) => {
|
|
127
|
+
if (!n || !n.field || !n.agg) return;
|
|
128
|
+
const a = n.agg === "formula" ? n.field : `${n.field}_${n.agg}`, r = n.agg === "formula" ? n.label || M(n.field) : `${M(n.field)} (${At(n.agg, n.weightField)})`;
|
|
129
|
+
l.push({ value: a, label: r });
|
|
130
|
+
}
|
|
131
|
+
), l;
|
|
132
|
+
}, ke = (e) => !e || !e.clauses || e.clauses.length === 0 ? "No filter" : e.clauses.map(
|
|
133
|
+
/** @param {any} [clause] @returns {any} */
|
|
134
|
+
(l) => {
|
|
135
|
+
const n = M(l.field), a = $t[l.operator] || l.operator;
|
|
136
|
+
if (pe.has(l.operator)) {
|
|
137
|
+
const r = l.values.slice(0, 3), i = l.values.length > 3 ? ` +${l.values.length - 3}` : "";
|
|
138
|
+
return `${n} ${a} [${r.join(", ")}${i}]`;
|
|
139
|
+
}
|
|
140
|
+
return `${n} ${a} ${l.value || "..."}`;
|
|
125
141
|
}
|
|
126
|
-
|
|
127
|
-
}).join(` ${e.op} `), et = (e, l) => {
|
|
142
|
+
).join(` ${e.op} `), tt = (e, l) => {
|
|
128
143
|
if (!e) return "";
|
|
129
|
-
const n = (l || []).find(
|
|
144
|
+
const n = (l || []).find(
|
|
145
|
+
/** @param {any} [item] @returns {any} */
|
|
146
|
+
(a) => a.value === e
|
|
147
|
+
);
|
|
130
148
|
return n ? n.label : M(e);
|
|
131
|
-
},
|
|
149
|
+
}, lt = (e) => e ? e.label && e.label.trim() ? e.label.trim() : e.field ? M(e.field) : "Select field" : "Select field", It = (e) => !e || !e.field ? !1 : pe.has(e.operator) ? Array.isArray(e.values) && e.values.length > 0 : e.value !== void 0 && e.value !== null && String(e.value).trim() !== "", Ne = (e) => !!(e && Array.isArray(e.clauses) && e.clauses.length > 0) && e.clauses.every(It), Ge = (e, l) => {
|
|
132
150
|
if (!e || !l || typeof l != "object") return !1;
|
|
133
151
|
const n = l[e.field], a = n == null ? "" : String(n), r = e.value === void 0 || e.value === null ? "" : String(e.value), i = Array.isArray(e.values) ? e.values.map(String) : [], s = Number(a), f = Number(r);
|
|
134
152
|
switch (e.operator) {
|
|
@@ -155,57 +173,78 @@ const _e = (e) => `${Be}${e}`, Se = (e) => {
|
|
|
155
173
|
return a === r;
|
|
156
174
|
}
|
|
157
175
|
}, Ye = (e, l) => {
|
|
158
|
-
if (!
|
|
176
|
+
if (!Ne(e) || !Array.isArray(l) || l.length === 0) return !0;
|
|
159
177
|
const n = l.filter((r) => r && typeof r == "object" && !r._isTotal && !r._isOther);
|
|
160
|
-
return n.some(
|
|
161
|
-
|
|
178
|
+
return n.some(
|
|
179
|
+
/** @param {any} [row] @returns {any} */
|
|
180
|
+
(r) => e.clauses.every(
|
|
181
|
+
/** @param {any} [clause] @returns {any} */
|
|
182
|
+
(i) => Object.prototype.hasOwnProperty.call(r, i.field)
|
|
183
|
+
)
|
|
184
|
+
) ? n.some(
|
|
185
|
+
/** @param {any} [row] @returns {any} */
|
|
186
|
+
(r) => e.op === "OR" ? e.clauses.some(
|
|
187
|
+
/** @param {any} [clause] @returns {any} */
|
|
188
|
+
(i) => Ge(i, r)
|
|
189
|
+
) : e.clauses.every(
|
|
190
|
+
/** @param {any} [clause] @returns {any} */
|
|
191
|
+
(i) => Ge(i, r)
|
|
192
|
+
)
|
|
193
|
+
) : !0;
|
|
194
|
+
}, Pt = (e, l) => {
|
|
162
195
|
if (!Array.isArray(e) || e.length === 0 || !Array.isArray(l) || l.length === 0) return !0;
|
|
163
196
|
const n = e.map(String).join("|||");
|
|
164
197
|
return l.some((a) => a && typeof a == "object" && a._path === n);
|
|
165
|
-
},
|
|
198
|
+
}, Ze = (e, {
|
|
166
199
|
allFields: l = [],
|
|
167
200
|
valConfigs: n = [],
|
|
168
201
|
data: a = []
|
|
169
202
|
} = {}) => {
|
|
170
|
-
const r = [], i = [], s = (n || []).some(
|
|
203
|
+
const r = [], i = [], s = (n || []).some(
|
|
204
|
+
/** @param {any} [config] @returns {any} */
|
|
205
|
+
(y) => y && y.field && y.agg
|
|
206
|
+
), f = new Set(Array.isArray(l) ? l : []), E = /* @__PURE__ */ new Map(), b = Array.isArray(a) ? a : [], F = (y, C) => {
|
|
171
207
|
const c = y.trim().toLowerCase();
|
|
172
208
|
if (c) {
|
|
173
|
-
if (
|
|
174
|
-
r.push(`Duplicate header "${y}" at ${
|
|
209
|
+
if (E.has(c)) {
|
|
210
|
+
r.push(`Duplicate header "${y}" at ${C}; already used at ${E.get(c)}.`);
|
|
175
211
|
return;
|
|
176
212
|
}
|
|
177
|
-
|
|
213
|
+
E.set(c, C);
|
|
178
214
|
}
|
|
179
|
-
}, N = (y,
|
|
215
|
+
}, N = (y, C, c = /* @__PURE__ */ new Set()) => {
|
|
180
216
|
if (!y) return;
|
|
181
|
-
const
|
|
182
|
-
if (c.has(
|
|
183
|
-
r.push(`Circular row override detected at ${
|
|
217
|
+
const h = y._id || `${C}:${y.field || ""}`;
|
|
218
|
+
if (c.has(h)) {
|
|
219
|
+
r.push(`Circular row override detected at ${C}.`);
|
|
184
220
|
return;
|
|
185
221
|
}
|
|
186
|
-
const
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
222
|
+
const v = new Set(c);
|
|
223
|
+
v.add(h), y.field ? f.size > 0 && !f.has(y.field) && r.push(`Field "${M(y.field)}" at ${C} is no longer available.`) : r.push(`Missing field at ${C}.`), F(lt(y), C), y.topN && !s && r.push(`Top-N at ${C} needs at least one measure selected.`), y.filters && !Ne(y.filters) ? r.push(`Level filter at ${C} has incomplete rules.`) : y.filters && !Ye(y.filters, b) && r.push(`Level filter at ${C} does not match any loaded rows.`), y.defaultChild && N(y.defaultChild, `${C} > Default children`, v), (y.branches || []).forEach(
|
|
224
|
+
/** @param {any} [branch] @param {any} [index] @returns {any} */
|
|
225
|
+
(u, D) => {
|
|
226
|
+
const R = u.label && u.label.trim() ? u.label.trim() : `Row override ${D + 1}`, x = `${C} > ${R}`;
|
|
227
|
+
Ne(u.condition) ? Ye(u.condition, b) || r.push(`Row override "${R}" does not match any loaded rows.`) : r.push(`Row override "${R}" needs a complete row rule.`), Array.isArray(u.sourcePathFields) && u.sourcePathFields.length > 0 && u.sourcePathFields[u.sourcePathFields.length - 1] !== y.field && r.push(`Row override "${R}" was created for another level and no longer points to this row path.`), Pt(u.sourceRowPath, b) || i.push(`Row override "${R}" points to a row path that is not in the current loaded rows.`), u.child && N(u.child, `${x} > Custom children`, v), u.child || i.push(`Row override "${R}" has no Custom children; it only renames the matching row.`);
|
|
228
|
+
}
|
|
229
|
+
);
|
|
191
230
|
};
|
|
192
231
|
return e ? N(e, "Level 1") : r.push("Report needs at least Level 1."), { errors: r, warnings: i, valid: r.length === 0 };
|
|
193
|
-
},
|
|
232
|
+
}, Lt = (e) => !e || !e.branchBadge ? `Level ${e ? e.levelNumber : 1}` : e.branchDepth === 0 ? `Override children ${e.branchBadge}` : `Override child level ${e.branchBadge}.${e.branchDepth + 1}`, ae = (e, l) => {
|
|
194
233
|
let n = e;
|
|
195
234
|
for (let a = 0; n && a < l.length; a += 1) {
|
|
196
235
|
const r = l[a];
|
|
197
236
|
if (r === T)
|
|
198
237
|
n = n.defaultChild || null;
|
|
199
238
|
else {
|
|
200
|
-
const i =
|
|
239
|
+
const i = Ce(r);
|
|
201
240
|
n = i >= 0 && n.branches[i] ? n.branches[i].child : null;
|
|
202
241
|
}
|
|
203
242
|
}
|
|
204
243
|
return n || null;
|
|
205
|
-
},
|
|
206
|
-
const a =
|
|
244
|
+
}, Be = (e, l, n) => {
|
|
245
|
+
const a = ae(e, l);
|
|
207
246
|
return a && a.branches[n] ? a.branches[n] : null;
|
|
208
|
-
},
|
|
247
|
+
}, _ = (e, l, n) => {
|
|
209
248
|
if (!e) return e;
|
|
210
249
|
const a = (r, i) => {
|
|
211
250
|
if (!r) return r;
|
|
@@ -216,17 +255,28 @@ const _e = (e) => `${Be}${e}`, Se = (e) => {
|
|
|
216
255
|
...r,
|
|
217
256
|
defaultChild: a(r.defaultChild, i + 1)
|
|
218
257
|
});
|
|
219
|
-
const f =
|
|
258
|
+
const f = Ce(s);
|
|
220
259
|
return f < 0 || f >= r.branches.length ? r : V({
|
|
221
260
|
...r,
|
|
222
|
-
branches: r.branches.map(
|
|
261
|
+
branches: r.branches.map(
|
|
262
|
+
/** @param {any} [branch] @param {any} [index] @returns {any} */
|
|
263
|
+
(E, b) => b === f ? { ...E, child: a(E.child, i + 1) } : E
|
|
264
|
+
)
|
|
223
265
|
});
|
|
224
266
|
};
|
|
225
267
|
return a(e, 0);
|
|
226
|
-
},
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
268
|
+
}, me = (e, l, n, a) => e && _(
|
|
269
|
+
e,
|
|
270
|
+
l,
|
|
271
|
+
/** @param {any} [node] @returns {any} */
|
|
272
|
+
(r) => n < 0 || n >= r.branches.length ? r : {
|
|
273
|
+
...r,
|
|
274
|
+
branches: r.branches.map(
|
|
275
|
+
/** @param {any} [branch] @param {any} [index] @returns {any} */
|
|
276
|
+
(i, s) => s === n ? Re(a(i)) : i
|
|
277
|
+
)
|
|
278
|
+
}
|
|
279
|
+
), zt = (e) => {
|
|
230
280
|
if (!e) return [];
|
|
231
281
|
const l = [], n = (a, r) => {
|
|
232
282
|
a && (l.push({
|
|
@@ -237,23 +287,26 @@ const _e = (e) => `${Be}${e}`, Se = (e) => {
|
|
|
237
287
|
levelNumber: r.levelNumber,
|
|
238
288
|
branchBadge: r.branchBadge,
|
|
239
289
|
branchDepth: r.branchDepth
|
|
240
|
-
}), a.branches.forEach(
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
290
|
+
}), a.branches.forEach(
|
|
291
|
+
/** @param {any} [branch] @param {any} [index] @returns {any} */
|
|
292
|
+
(i, s) => {
|
|
293
|
+
const f = `${r.levelNumber}.${s + 1}`;
|
|
294
|
+
l.push({
|
|
295
|
+
kind: "branch",
|
|
296
|
+
branch: i,
|
|
297
|
+
nodePath: r.nodePath,
|
|
298
|
+
branchIndex: s,
|
|
299
|
+
depth: r.depth + 1,
|
|
300
|
+
badge: f
|
|
301
|
+
}), i.child && n(i.child, {
|
|
302
|
+
nodePath: [...r.nodePath, _e(s)],
|
|
303
|
+
depth: r.depth + 2,
|
|
304
|
+
levelNumber: r.levelNumber + 1,
|
|
305
|
+
branchBadge: f,
|
|
306
|
+
branchDepth: 0
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
), a.defaultChild && n(a.defaultChild, {
|
|
257
310
|
nodePath: [...r.nodePath, T],
|
|
258
311
|
depth: r.depth + 1,
|
|
259
312
|
levelNumber: r.levelNumber + 1,
|
|
@@ -268,23 +321,32 @@ const _e = (e) => `${Be}${e}`, Se = (e) => {
|
|
|
268
321
|
branchBadge: null,
|
|
269
322
|
branchDepth: 0
|
|
270
323
|
}), l;
|
|
271
|
-
},
|
|
324
|
+
}, re = (e = []) => e.join(">"), Ae = (e = [], l = []) => re(e) === re(l), Q = (e) => e == null ? "" : String(e), Z = (e) => e ? e.type === "node" ? `node:${re(e.path)}` : e.type === "branch" ? `branch:${re(e.nodePath)}:${e.branchIndex}` : e.type === "rowPath" ? `rowPath:${re(e.nodePath)}:${e.field}:${Q(e.value)}` : "" : "", we = (e, l) => (e || []).find(
|
|
325
|
+
/** @param {any} [item] @returns {any} */
|
|
326
|
+
(n) => n.kind === "node" && Ae(n.nodePath, l)
|
|
327
|
+
) || null, rt = (e, l, n) => (e || []).find(
|
|
328
|
+
/** @param {any} [item] @returns {any} */
|
|
329
|
+
(a) => a.kind === "branch" && Ae(a.nodePath, l) && a.branchIndex === n
|
|
330
|
+
) || null, Xe = (e, l, n) => {
|
|
272
331
|
if (!e || !l) return !1;
|
|
273
332
|
const a = Q(n);
|
|
274
|
-
return (e.condition && Array.isArray(e.condition.clauses) ? e.condition.clauses : []).some(
|
|
333
|
+
return (e.condition && Array.isArray(e.condition.clauses) ? e.condition.clauses : []).some(
|
|
334
|
+
/** @param {any} [clause] @returns {any} */
|
|
335
|
+
(i) => !i || i.field !== l ? !1 : i.operator === "eq" || i.operator === "=" ? Q(i.value) === a : i.operator === "in" ? Array.isArray(i.values) && i.values.map(Q).includes(a) : !1
|
|
336
|
+
);
|
|
275
337
|
}, _t = (e, l, n, a = "") => ({
|
|
276
|
-
...
|
|
338
|
+
...Bt(),
|
|
277
339
|
label: Q(n || l),
|
|
278
340
|
condition: {
|
|
279
341
|
op: "AND",
|
|
280
342
|
clauses: [{
|
|
281
|
-
...
|
|
343
|
+
...et(e),
|
|
282
344
|
operator: "eq",
|
|
283
345
|
value: Q(l),
|
|
284
346
|
values: []
|
|
285
347
|
}]
|
|
286
348
|
},
|
|
287
|
-
child:
|
|
349
|
+
child: Y(a)
|
|
288
350
|
}), Oe = (e) => {
|
|
289
351
|
if (!e) return null;
|
|
290
352
|
try {
|
|
@@ -292,7 +354,7 @@ const _e = (e) => `${Be}${e}`, Se = (e) => {
|
|
|
292
354
|
} catch {
|
|
293
355
|
return V(e);
|
|
294
356
|
}
|
|
295
|
-
},
|
|
357
|
+
}, Ie = (e) => Array.from({ length: Math.max(0, e) }, () => T), We = (e, l = 1, n = []) => {
|
|
296
358
|
const a = [];
|
|
297
359
|
let r = e, i = 0, s = Array.isArray(n) ? [...n] : [];
|
|
298
360
|
for (; r; )
|
|
@@ -312,45 +374,54 @@ const _e = (e) => `${Be}${e}`, Se = (e) => {
|
|
|
312
374
|
defaultChild: l
|
|
313
375
|
});
|
|
314
376
|
return l;
|
|
315
|
-
},
|
|
316
|
-
const a = We(e).map(
|
|
377
|
+
}, nt = (e, l, n) => {
|
|
378
|
+
const a = We(e).map(
|
|
379
|
+
/** @param {any} [item] @returns {any} */
|
|
380
|
+
(s) => s.node
|
|
381
|
+
);
|
|
317
382
|
if (l < 0 || n < 0 || l >= a.length || n >= a.length || l === n)
|
|
318
383
|
return e;
|
|
319
384
|
const r = [...a], [i] = r.splice(l, 1);
|
|
320
385
|
return r.splice(n, 0, i), Wt(r);
|
|
321
|
-
},
|
|
386
|
+
}, Tt = (e) => {
|
|
322
387
|
const l = Oe(e);
|
|
323
388
|
return !l || !l.field ? null : l;
|
|
324
|
-
},
|
|
389
|
+
}, jt = (e, l) => l ? l.type === "node" ? we(e, l.path) : l.type === "branch" ? rt(e, l.nodePath, l.branchIndex) : null : null, Mt = (e, l) => {
|
|
325
390
|
if (!l) return [];
|
|
326
391
|
const n = [], a = (s) => {
|
|
327
|
-
const f =
|
|
392
|
+
const f = we(e, s);
|
|
328
393
|
f && n.push(f);
|
|
329
394
|
}, r = (s, f) => {
|
|
330
|
-
const
|
|
331
|
-
|
|
395
|
+
const E = rt(e, s, f);
|
|
396
|
+
E && n.push(E);
|
|
332
397
|
}, i = (s) => {
|
|
333
398
|
if (a([]), !Array.isArray(s) || s.length === 0) return;
|
|
334
399
|
let f = [];
|
|
335
|
-
s.forEach((
|
|
336
|
-
if (
|
|
337
|
-
f = [...f,
|
|
400
|
+
s.forEach((E) => {
|
|
401
|
+
if (E === T) {
|
|
402
|
+
f = [...f, E], a(f);
|
|
338
403
|
return;
|
|
339
404
|
}
|
|
340
|
-
const
|
|
341
|
-
|
|
405
|
+
const b = Ce(E);
|
|
406
|
+
b >= 0 && (r(f, b), f = [...f, E], a(f));
|
|
342
407
|
});
|
|
343
408
|
};
|
|
344
409
|
return l.type === "node" ? (i(l.path), n) : (i(l.nodePath), r(l.nodePath, l.branchIndex), n);
|
|
345
|
-
},
|
|
410
|
+
}, Ht = (e, l) => {
|
|
346
411
|
if (!l) return [];
|
|
347
412
|
if (l.type === "node") {
|
|
348
|
-
const a = [], r =
|
|
413
|
+
const a = [], r = we(e, [...l.path, T]);
|
|
349
414
|
r && a.push(r);
|
|
350
|
-
const i = (e || []).filter(
|
|
415
|
+
const i = (e || []).filter(
|
|
416
|
+
/** @param {any} [item] @returns {any} */
|
|
417
|
+
(s) => s.kind === "branch" && Ae(s.nodePath, l.path)
|
|
418
|
+
).sort(
|
|
419
|
+
/** @param {any} [left] @param {any} [right] @returns {any} */
|
|
420
|
+
(s, f) => s.branchIndex - f.branchIndex
|
|
421
|
+
);
|
|
351
422
|
return [...a, ...i];
|
|
352
423
|
}
|
|
353
|
-
const n =
|
|
424
|
+
const n = we(e, [...l.nodePath, _e(l.branchIndex)]);
|
|
354
425
|
return n ? [n] : [];
|
|
355
426
|
}, q = (e, l = {}) => ({
|
|
356
427
|
border: `1px solid ${e.border}`,
|
|
@@ -386,7 +457,7 @@ const _e = (e) => `${Be}${e}`, Se = (e) => {
|
|
|
386
457
|
alignItems: "center",
|
|
387
458
|
gap: "6px",
|
|
388
459
|
marginBottom: "10px"
|
|
389
|
-
}),
|
|
460
|
+
}), ue = (e) => ({
|
|
390
461
|
border: `1px solid ${e.border}`,
|
|
391
462
|
borderRadius: "14px",
|
|
392
463
|
background: e.surfaceBg || e.background || "#fff",
|
|
@@ -394,13 +465,13 @@ const _e = (e) => `${Be}${e}`, Se = (e) => {
|
|
|
394
465
|
display: "flex",
|
|
395
466
|
flexDirection: "column",
|
|
396
467
|
gap: "12px"
|
|
397
|
-
}),
|
|
468
|
+
}), Vt = (e) => ({
|
|
398
469
|
borderTop: `2px solid ${e.textSec || "#334155"}`,
|
|
399
470
|
paddingTop: "14px",
|
|
400
471
|
display: "flex",
|
|
401
472
|
flexDirection: "column",
|
|
402
473
|
gap: "12px"
|
|
403
|
-
}),
|
|
474
|
+
}), at = (e, l, n) => ({
|
|
404
475
|
width: `calc(100% - ${n * 14}px)`,
|
|
405
476
|
marginLeft: `${n * 14}px`,
|
|
406
477
|
border: `1px solid ${l ? e.primary || "#2563EB" : e.border}`,
|
|
@@ -434,7 +505,7 @@ function X({ children: e, theme: l, tone: n = "neutral" }) {
|
|
|
434
505
|
e
|
|
435
506
|
);
|
|
436
507
|
}
|
|
437
|
-
function
|
|
508
|
+
function ne({
|
|
438
509
|
theme: e,
|
|
439
510
|
title: l,
|
|
440
511
|
description: n,
|
|
@@ -443,30 +514,54 @@ function re({
|
|
|
443
514
|
sectionId: i,
|
|
444
515
|
children: s
|
|
445
516
|
}) {
|
|
446
|
-
return /* @__PURE__ */ t.createElement("section", { "data-report-section": i || l, style:
|
|
517
|
+
return /* @__PURE__ */ t.createElement("section", { "data-report-section": i || l, style: Vt(e) }, /* @__PURE__ */ t.createElement("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: "12px" } }, /* @__PURE__ */ t.createElement("div", { style: { display: "flex", alignItems: "flex-start", gap: "8px", minWidth: 0 } }, /* @__PURE__ */ t.createElement("div", { style: { color: e.textSec, display: "flex", alignItems: "center", paddingTop: "1px", flexShrink: 0 } }, a), /* @__PURE__ */ t.createElement("div", { style: { minWidth: 0 } }, /* @__PURE__ */ t.createElement("div", { style: { fontSize: "13px", fontWeight: 900, color: e.text } }, l), n && /* @__PURE__ */ t.createElement("div", { style: { fontSize: "11px", color: e.textSec, lineHeight: 1.45, marginTop: "2px" } }, n))), r && /* @__PURE__ */ t.createElement("div", { style: { flexShrink: 0 } }, r)), /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "10px" } }, s));
|
|
447
518
|
}
|
|
448
|
-
function
|
|
449
|
-
const [
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
519
|
+
function Pe({ condition: e, allFields: l, getFieldLabel: n = M, onSave: a, onClose: r, theme: i, title: s, description: f }) {
|
|
520
|
+
const [E, b] = H(() => ze(e)), F = q(i), N = B(() => {
|
|
521
|
+
b(
|
|
522
|
+
/** @param {any} [prev] @returns {any} */
|
|
523
|
+
(c) => ({ ...c, clauses: [...c.clauses, et(l[0] || "")] })
|
|
524
|
+
);
|
|
525
|
+
}, [l]), y = B((c, h) => {
|
|
526
|
+
b(
|
|
527
|
+
/** @param {any} [prev] @returns {any} */
|
|
528
|
+
(v) => ({
|
|
529
|
+
...v,
|
|
530
|
+
clauses: v.clauses.map(
|
|
531
|
+
/** @param {any} [clause] @param {any} [clauseIndex] @returns {any} */
|
|
532
|
+
(u, D) => D === c ? { ...u, ...h } : u
|
|
533
|
+
)
|
|
534
|
+
})
|
|
535
|
+
);
|
|
536
|
+
}, []), C = B((c) => {
|
|
537
|
+
b(
|
|
538
|
+
/** @param {any} [prev] @returns {any} */
|
|
539
|
+
(h) => ({
|
|
540
|
+
...h,
|
|
541
|
+
clauses: h.clauses.filter(
|
|
542
|
+
/** @param {any} [_] @param {any} [clauseIndex] @returns {any} */
|
|
543
|
+
(v, u) => u !== c
|
|
544
|
+
)
|
|
545
|
+
})
|
|
546
|
+
);
|
|
461
547
|
}, []);
|
|
462
|
-
return
|
|
548
|
+
return Ee(() => {
|
|
549
|
+
if (typeof r != "function") return;
|
|
550
|
+
const c = (h) => {
|
|
551
|
+
h.key === "Escape" && !h.defaultPrevented && (h.preventDefault(), r());
|
|
552
|
+
};
|
|
553
|
+
return window.addEventListener("keydown", c), () => window.removeEventListener("keydown", c);
|
|
554
|
+
}, [r]), /* @__PURE__ */ t.createElement(
|
|
463
555
|
"div",
|
|
464
556
|
{
|
|
557
|
+
className: "sp-dialog-backdrop",
|
|
465
558
|
style: {
|
|
466
559
|
position: "fixed",
|
|
467
560
|
inset: 0,
|
|
468
561
|
zIndex: 9999,
|
|
469
|
-
background: "rgba(15, 23, 42, 0.
|
|
562
|
+
background: "rgba(15, 23, 42, 0.38)",
|
|
563
|
+
backdropFilter: "blur(6px)",
|
|
564
|
+
WebkitBackdropFilter: "blur(6px)",
|
|
470
565
|
display: "flex",
|
|
471
566
|
alignItems: "center",
|
|
472
567
|
justifyContent: "center"
|
|
@@ -476,23 +571,29 @@ function Ie({ condition: e, allFields: l, getFieldLabel: n = M, onSave: a, onClo
|
|
|
476
571
|
/* @__PURE__ */ t.createElement(
|
|
477
572
|
"div",
|
|
478
573
|
{
|
|
574
|
+
className: "sp-dialog-surface",
|
|
575
|
+
role: "dialog",
|
|
576
|
+
"aria-modal": "true",
|
|
479
577
|
style: {
|
|
480
|
-
...
|
|
578
|
+
...ue(i),
|
|
481
579
|
width: "520px",
|
|
482
580
|
maxWidth: "95vw",
|
|
483
581
|
maxHeight: "85vh",
|
|
484
582
|
overflowY: "auto",
|
|
485
|
-
boxShadow: "0 24px 64px rgba(15, 23, 42, 0.
|
|
583
|
+
boxShadow: i.shadow || "0 24px 64px rgba(15, 23, 42, 0.26)"
|
|
486
584
|
},
|
|
487
585
|
onClick: (c) => c.stopPropagation()
|
|
488
586
|
},
|
|
489
|
-
/* @__PURE__ */ t.createElement("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: "10px" } }, /* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: { fontSize: "14px", fontWeight: 800, color: i.text } }, s || "Edit row override rule"), /* @__PURE__ */ t.createElement("div", { style: { fontSize: "12px", color: i.textSec, marginTop: "2px" } }, f || "Add one or more clauses to decide when this row override should be used.")), /* @__PURE__ */ t.createElement("button", { type: "button", onClick: r, style: { background: "
|
|
490
|
-
|
|
587
|
+
/* @__PURE__ */ t.createElement("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: "10px" } }, /* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: { fontSize: "14px", fontWeight: 800, letterSpacing: "-0.01em", color: i.text } }, s || "Edit row override rule"), /* @__PURE__ */ t.createElement("div", { style: { fontSize: "12px", color: i.textSec, marginTop: "2px" } }, f || "Add one or more clauses to decide when this row override should be used.")), /* @__PURE__ */ t.createElement("button", { type: "button", className: "sp-btn sp-btn-ghost", onClick: r, style: { background: "transparent", border: "none", borderRadius: "6px", cursor: "pointer", color: i.textSec, padding: "4px", display: "inline-flex", alignItems: "center" } }, /* @__PURE__ */ t.createElement(m.Close, null))),
|
|
588
|
+
E.clauses.length > 1 && /* @__PURE__ */ t.createElement("div", { style: { display: "flex", gap: "6px", alignItems: "center", flexWrap: "wrap" } }, /* @__PURE__ */ t.createElement("span", { style: { fontSize: "11px", color: i.textSec, fontWeight: 700 } }, "Match:"), ["AND", "OR"].map((c) => /* @__PURE__ */ t.createElement(
|
|
491
589
|
"button",
|
|
492
590
|
{
|
|
493
591
|
key: c,
|
|
494
592
|
type: "button",
|
|
495
|
-
onClick: () =>
|
|
593
|
+
onClick: () => b(
|
|
594
|
+
/** @param {any} [prev] @returns {any} */
|
|
595
|
+
(h) => ({ ...h, op: c })
|
|
596
|
+
),
|
|
496
597
|
style: {
|
|
497
598
|
padding: "5px 12px",
|
|
498
599
|
borderRadius: "999px",
|
|
@@ -500,89 +601,108 @@ function Ie({ condition: e, allFields: l, getFieldLabel: n = M, onSave: a, onClo
|
|
|
500
601
|
fontWeight: 800,
|
|
501
602
|
border: "none",
|
|
502
603
|
cursor: "pointer",
|
|
503
|
-
background:
|
|
504
|
-
color:
|
|
604
|
+
background: E.op === c ? i.primary || "#2563EB" : i.hover || "#F3F4F6",
|
|
605
|
+
color: E.op === c ? "#fff" : i.textSec
|
|
505
606
|
}
|
|
506
607
|
},
|
|
507
608
|
c
|
|
508
609
|
))),
|
|
509
|
-
/* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "8px" } },
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
style: {
|
|
514
|
-
border: `1px solid ${i.border}`,
|
|
515
|
-
borderRadius: "12px",
|
|
516
|
-
background: i.hover || "#F8FAFC",
|
|
517
|
-
padding: "10px",
|
|
518
|
-
display: "flex",
|
|
519
|
-
gap: "8px",
|
|
520
|
-
alignItems: "flex-start"
|
|
521
|
-
}
|
|
522
|
-
},
|
|
523
|
-
/* @__PURE__ */ t.createElement("div", { style: { width: "32px", paddingTop: "6px", textAlign: "center", fontSize: "10px", fontWeight: 800, color: i.textSec } }, E > 0 ? m.op : ""),
|
|
524
|
-
/* @__PURE__ */ t.createElement("div", { style: { flex: 1, display: "flex", flexDirection: "column", gap: "8px" } }, /* @__PURE__ */ t.createElement("div", { style: { display: "flex", gap: "8px", flexWrap: "wrap" } }, /* @__PURE__ */ t.createElement(
|
|
525
|
-
"select",
|
|
610
|
+
/* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "8px" } }, E.clauses.length === 0 && /* @__PURE__ */ t.createElement("div", { style: { fontSize: "12px", color: i.textSec, fontStyle: "italic" } }, "No clauses means this row override matches every row at this level."), E.clauses.map(
|
|
611
|
+
/** @param {any} [clause] @param {any} [index] @returns {any} */
|
|
612
|
+
(c, h) => /* @__PURE__ */ t.createElement(
|
|
613
|
+
"div",
|
|
526
614
|
{
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
615
|
+
key: c._id,
|
|
616
|
+
style: {
|
|
617
|
+
border: `1px solid ${i.border}`,
|
|
618
|
+
borderRadius: "12px",
|
|
619
|
+
background: i.hover || "#F8FAFC",
|
|
620
|
+
padding: "10px",
|
|
621
|
+
display: "flex",
|
|
622
|
+
gap: "8px",
|
|
623
|
+
alignItems: "flex-start"
|
|
624
|
+
}
|
|
530
625
|
},
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
y(
|
|
539
|
-
|
|
540
|
-
values: D ? R ? c.values : c.value ? [c.value] : [] : c.values,
|
|
541
|
-
value: D ? c.value : c.values[0] || c.value || ""
|
|
542
|
-
});
|
|
626
|
+
/* @__PURE__ */ t.createElement("div", { style: { width: "32px", paddingTop: "6px", textAlign: "center", fontSize: "10px", fontWeight: 800, color: i.textSec } }, h > 0 ? E.op : ""),
|
|
627
|
+
/* @__PURE__ */ t.createElement("div", { style: { flex: 1, display: "flex", flexDirection: "column", gap: "8px" } }, /* @__PURE__ */ t.createElement("div", { style: { display: "flex", gap: "8px", flexWrap: "wrap" } }, /* @__PURE__ */ t.createElement(
|
|
628
|
+
U,
|
|
629
|
+
{
|
|
630
|
+
size: "sm",
|
|
631
|
+
"aria-label": "Filter field",
|
|
632
|
+
value: c.field,
|
|
633
|
+
onChange: (v) => y(h, { field: v.target.value }),
|
|
634
|
+
style: { ...F, flex: 1, minWidth: "140px" }
|
|
543
635
|
},
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
636
|
+
l.map(
|
|
637
|
+
/** @param {any} [field] @returns {any} */
|
|
638
|
+
(v) => /* @__PURE__ */ t.createElement("option", { key: v, value: v }, n(v))
|
|
639
|
+
)
|
|
640
|
+
), /* @__PURE__ */ t.createElement(
|
|
641
|
+
U,
|
|
642
|
+
{
|
|
643
|
+
size: "sm",
|
|
644
|
+
"aria-label": "Filter operator",
|
|
645
|
+
value: c.operator,
|
|
646
|
+
onChange: (v) => {
|
|
647
|
+
const u = v.target.value, D = pe.has(u), R = pe.has(c.operator);
|
|
648
|
+
y(h, {
|
|
649
|
+
operator: u,
|
|
650
|
+
values: D ? R ? c.values : c.value ? [c.value] : [] : c.values,
|
|
651
|
+
value: D ? c.value : c.values[0] || c.value || ""
|
|
652
|
+
});
|
|
653
|
+
},
|
|
654
|
+
style: { ...F, width: "160px", flexShrink: 0 }
|
|
655
|
+
},
|
|
656
|
+
Qe.map((v) => /* @__PURE__ */ t.createElement("option", { key: v.value, value: v.value }, v.label))
|
|
657
|
+
)), pe.has(c.operator) ? /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "8px" } }, c.values.length > 0 && /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexWrap: "wrap", gap: "6px" } }, c.values.map(
|
|
658
|
+
/** @param {any} [value] @param {any} [valueIndex] @returns {any} */
|
|
659
|
+
(v, u) => /* @__PURE__ */ t.createElement(X, { key: `${c._id}-${u}`, theme: i, tone: "primary" }, /* @__PURE__ */ t.createElement("span", null, v), /* @__PURE__ */ t.createElement(
|
|
660
|
+
"button",
|
|
661
|
+
{
|
|
662
|
+
type: "button",
|
|
663
|
+
onClick: () => y(h, {
|
|
664
|
+
values: c.values.filter(
|
|
665
|
+
/** @param {any} [_] @param {any} [currentIndex] @returns {any} */
|
|
666
|
+
(D, R) => R !== u
|
|
667
|
+
)
|
|
668
|
+
}),
|
|
669
|
+
style: { background: "none", border: "none", padding: 0, cursor: "pointer", color: "inherit", lineHeight: 1 }
|
|
670
|
+
},
|
|
671
|
+
"x"
|
|
672
|
+
))
|
|
673
|
+
)), /* @__PURE__ */ t.createElement(
|
|
674
|
+
"input",
|
|
675
|
+
{
|
|
676
|
+
placeholder: "Type a value and press Enter",
|
|
677
|
+
style: F,
|
|
678
|
+
onKeyDown: (
|
|
679
|
+
/** @param {any} event */
|
|
680
|
+
((v) => {
|
|
681
|
+
const u = v.target.value.trim();
|
|
682
|
+
v.key === "Enter" && u && (c.values.includes(u) || y(h, { values: [...c.values, u] }), v.target.value = "", v.preventDefault());
|
|
683
|
+
})
|
|
684
|
+
)
|
|
565
685
|
}
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
686
|
+
)) : /* @__PURE__ */ t.createElement(
|
|
687
|
+
"input",
|
|
688
|
+
{
|
|
689
|
+
value: c.value,
|
|
690
|
+
onChange: (v) => y(h, { value: v.target.value }),
|
|
691
|
+
placeholder: "Value",
|
|
692
|
+
style: F
|
|
693
|
+
}
|
|
694
|
+
)),
|
|
695
|
+
/* @__PURE__ */ t.createElement(
|
|
696
|
+
"button",
|
|
697
|
+
{
|
|
698
|
+
type: "button",
|
|
699
|
+
onClick: () => C(h),
|
|
700
|
+
style: { background: "none", border: "none", cursor: "pointer", color: "#B91C1C", padding: "6px" }
|
|
701
|
+
},
|
|
702
|
+
/* @__PURE__ */ t.createElement(m.Delete, null)
|
|
703
|
+
)
|
|
584
704
|
)
|
|
585
|
-
))
|
|
705
|
+
)),
|
|
586
706
|
/* @__PURE__ */ t.createElement(
|
|
587
707
|
"button",
|
|
588
708
|
{
|
|
@@ -594,7 +714,7 @@ function Ie({ condition: e, allFields: l, getFieldLabel: n = M, onSave: a, onClo
|
|
|
594
714
|
borderStyle: "dashed"
|
|
595
715
|
}
|
|
596
716
|
},
|
|
597
|
-
/* @__PURE__ */ t.createElement(
|
|
717
|
+
/* @__PURE__ */ t.createElement(m.Add, null),
|
|
598
718
|
" Add clause"
|
|
599
719
|
),
|
|
600
720
|
/* @__PURE__ */ t.createElement("div", { style: { display: "flex", justifyContent: "flex-end", gap: "8px", borderTop: `1px solid ${i.border}`, paddingTop: "12px" } }, /* @__PURE__ */ t.createElement("button", { type: "button", onClick: r, style: j(i) }, "Cancel"), /* @__PURE__ */ t.createElement(
|
|
@@ -602,7 +722,7 @@ function Ie({ condition: e, allFields: l, getFieldLabel: n = M, onSave: a, onClo
|
|
|
602
722
|
{
|
|
603
723
|
type: "button",
|
|
604
724
|
onClick: () => {
|
|
605
|
-
a(
|
|
725
|
+
a(E), r();
|
|
606
726
|
},
|
|
607
727
|
style: {
|
|
608
728
|
background: i.primary || "#2563EB",
|
|
@@ -620,15 +740,21 @@ function Ie({ condition: e, allFields: l, getFieldLabel: n = M, onSave: a, onClo
|
|
|
620
740
|
)
|
|
621
741
|
);
|
|
622
742
|
}
|
|
623
|
-
function
|
|
624
|
-
const a =
|
|
625
|
-
return /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "10px" } }, /* @__PURE__ */ t.createElement("div", { style: L(n) }, "Presentation"), /* @__PURE__ */ t.createElement("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: "8px" } }, /* @__PURE__ */ t.createElement("label", { style: { display: "flex", flexDirection: "column", gap: "5px", fontSize: "11px", color: n.textSec } }, "Indent px", /* @__PURE__ */ t.createElement("input", { type: "number", min: "0", value: a.indent, onChange: (s) => i({ indent: s.target.value }), placeholder: "Auto", style: r })), /* @__PURE__ */ t.createElement("label", { style: { display: "flex", flexDirection: "column", gap: "5px", fontSize: "11px", color: n.textSec } }, "Row color", /* @__PURE__ */ t.createElement("input", { value: a.rowColor, onChange: (s) => i({ rowColor: s.target.value }), placeholder: "#F8FAFC", style: r })), /* @__PURE__ */ t.createElement("label", { style: { display: "flex", flexDirection: "column", gap: "5px", fontSize: "11px", color: n.textSec } }, "Label prefix", /* @__PURE__ */ t.createElement("input", { value: a.labelPrefix, onChange: (s) => i({ labelPrefix: s.target.value }), placeholder: "Optional", style: r })), /* @__PURE__ */ t.createElement("label", { style: { display: "flex", flexDirection: "column", gap: "5px", fontSize: "11px", color: n.textSec } }, "Label suffix", /* @__PURE__ */ t.createElement("input", { value: a.labelSuffix, onChange: (s) => i({ labelSuffix: s.target.value }), placeholder: "Optional", style: r })), /* @__PURE__ */ t.createElement("label", { style: { display: "flex", flexDirection: "column", gap: "5px", fontSize: "11px", color: n.textSec, gridColumn: "1 / -1" } }, "Number format override", /* @__PURE__ */ t.createElement("input", { value: a.numberFormat, onChange: (s) => i({ numberFormat: s.target.value }), placeholder: "fixed:2, percent, currency:$", style: r }))), /* @__PURE__ */ t.createElement("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr 1fr", gap: "8px" } }, /* @__PURE__ */ t.createElement("label", { style: { display: "flex", flexDirection: "column", gap: "5px", fontSize: "11px", color: n.textSec } }, "Border", /* @__PURE__ */ t.createElement("
|
|
743
|
+
function ot({ value: e, onChange: l, theme: n }) {
|
|
744
|
+
const a = Se(e), r = q(n), i = (s) => l(Se({ ...a, ...s }));
|
|
745
|
+
return /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "10px" } }, /* @__PURE__ */ t.createElement("div", { style: L(n) }, "Presentation"), /* @__PURE__ */ t.createElement("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: "8px" } }, /* @__PURE__ */ t.createElement("label", { style: { display: "flex", flexDirection: "column", gap: "5px", fontSize: "11px", color: n.textSec } }, "Indent px", /* @__PURE__ */ t.createElement("input", { type: "number", min: "0", value: a.indent, onChange: (s) => i({ indent: s.target.value }), placeholder: "Auto", style: r })), /* @__PURE__ */ t.createElement("label", { style: { display: "flex", flexDirection: "column", gap: "5px", fontSize: "11px", color: n.textSec } }, "Row color", /* @__PURE__ */ t.createElement("input", { value: a.rowColor, onChange: (s) => i({ rowColor: s.target.value }), placeholder: "#F8FAFC", style: r })), /* @__PURE__ */ t.createElement("label", { style: { display: "flex", flexDirection: "column", gap: "5px", fontSize: "11px", color: n.textSec } }, "Label prefix", /* @__PURE__ */ t.createElement("input", { value: a.labelPrefix, onChange: (s) => i({ labelPrefix: s.target.value }), placeholder: "Optional", style: r })), /* @__PURE__ */ t.createElement("label", { style: { display: "flex", flexDirection: "column", gap: "5px", fontSize: "11px", color: n.textSec } }, "Label suffix", /* @__PURE__ */ t.createElement("input", { value: a.labelSuffix, onChange: (s) => i({ labelSuffix: s.target.value }), placeholder: "Optional", style: r })), /* @__PURE__ */ t.createElement("label", { style: { display: "flex", flexDirection: "column", gap: "5px", fontSize: "11px", color: n.textSec, gridColumn: "1 / -1" } }, "Number format override", /* @__PURE__ */ t.createElement("input", { value: a.numberFormat, onChange: (s) => i({ numberFormat: s.target.value }), placeholder: "fixed:2, percent, currency:$", style: r }))), /* @__PURE__ */ t.createElement("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr 1fr", gap: "8px" } }, /* @__PURE__ */ t.createElement("label", { style: { display: "flex", flexDirection: "column", gap: "5px", fontSize: "11px", color: n.textSec } }, "Border", /* @__PURE__ */ t.createElement(U, { size: "sm", "aria-label": "Border", value: a.borderStyle, onChange: (s) => i({ borderStyle: s.target.value }), style: { ...r, width: "100%" } }, Ue.map((s) => /* @__PURE__ */ t.createElement("option", { key: s || "none", value: s }, s || "None")))), /* @__PURE__ */ t.createElement("label", { style: { display: "flex", flexDirection: "column", gap: "5px", fontSize: "11px", color: n.textSec } }, "Border color", /* @__PURE__ */ t.createElement("input", { value: a.borderColor, onChange: (s) => i({ borderColor: s.target.value }), placeholder: "#CBD5E1", style: r })), /* @__PURE__ */ t.createElement("label", { style: { display: "flex", flexDirection: "column", gap: "5px", fontSize: "11px", color: n.textSec } }, "Width", /* @__PURE__ */ t.createElement("input", { type: "number", min: "1", value: a.borderWidth, onChange: (s) => i({ borderWidth: s.target.value }), placeholder: "1", style: r }))), /* @__PURE__ */ t.createElement("div", { style: { display: "flex", gap: "14px", flexWrap: "wrap" } }, /* @__PURE__ */ t.createElement("label", { style: { display: "inline-flex", alignItems: "center", gap: "7px", fontSize: "12px", color: n.text, fontWeight: 700 } }, /* @__PURE__ */ t.createElement("input", { type: "checkbox", checked: a.bold, onChange: (s) => i({ bold: s.target.checked }) }), "Bold row"), /* @__PURE__ */ t.createElement("label", { style: { display: "inline-flex", alignItems: "center", gap: "7px", fontSize: "12px", color: n.text, fontWeight: 700 } }, /* @__PURE__ */ t.createElement("input", { type: "checkbox", checked: a.showSubtotal, onChange: (s) => i({ showSubtotal: s.target.checked }) }), "Show subtotal/other rows")));
|
|
626
746
|
}
|
|
627
|
-
function
|
|
747
|
+
function qt({ validation: e, theme: l }) {
|
|
628
748
|
const n = e && Array.isArray(e.errors) ? e.errors : [], a = e && Array.isArray(e.warnings) ? e.warnings : [];
|
|
629
|
-
return n.length === 0 && a.length === 0 ? null : /* @__PURE__ */ t.createElement("div", { "data-report-validation": "true", style: { border: `1px solid ${n.length > 0 ? "#FCA5A5" : "#FDE68A"}`, borderRadius: "12px", padding: "10px 12px", background: n.length > 0 ? "#FEF2F2" : "#FFFBEB", color: n.length > 0 ? "#991B1B" : "#92400E", fontSize: "11px", lineHeight: 1.45, display: "flex", flexDirection: "column", gap: "6px" } }, n.length > 0 && /* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: { fontWeight: 900, marginBottom: "4px" } }, "Fix before applying or saving"), n.map(
|
|
749
|
+
return n.length === 0 && a.length === 0 ? null : /* @__PURE__ */ t.createElement("div", { "data-report-validation": "true", style: { border: `1px solid ${n.length > 0 ? "#FCA5A5" : "#FDE68A"}`, borderRadius: "12px", padding: "10px 12px", background: n.length > 0 ? "#FEF2F2" : "#FFFBEB", color: n.length > 0 ? "#991B1B" : "#92400E", fontSize: "11px", lineHeight: 1.45, display: "flex", flexDirection: "column", gap: "6px" } }, n.length > 0 && /* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: { fontWeight: 900, marginBottom: "4px" } }, "Fix before applying or saving"), n.map(
|
|
750
|
+
/** @param {any} [message] @returns {any} */
|
|
751
|
+
(r) => /* @__PURE__ */ t.createElement("div", { key: `err:${r}` }, r)
|
|
752
|
+
)), a.length > 0 && /* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: { fontWeight: 900, marginBottom: "4px" } }, "Warnings"), a.map(
|
|
753
|
+
/** @param {any} [message] @returns {any} */
|
|
754
|
+
(r) => /* @__PURE__ */ t.createElement("div", { key: `warn:${r}` }, r)
|
|
755
|
+
)));
|
|
630
756
|
}
|
|
631
|
-
function
|
|
757
|
+
function Kt({ debug: e, theme: l }) {
|
|
632
758
|
if (!e || typeof e != "object") return null;
|
|
633
759
|
const n = [
|
|
634
760
|
["Matched level", e.matchedLevel || e.levelLabel || ""],
|
|
@@ -637,9 +763,12 @@ function qt({ debug: e, theme: l }) {
|
|
|
637
763
|
["Children source", e.childrenSource || "Default children"],
|
|
638
764
|
["Rule", e.matchedCondition || ""]
|
|
639
765
|
].filter(([, a]) => a);
|
|
640
|
-
return n.length === 0 ? null : /* @__PURE__ */ t.createElement("div", { "data-report-debug-inspector": "true", style: { border: `1px solid ${l.border}`, borderRadius: "12px", padding: "10px", background: l.hover || "#F8FAFC", display: "flex", flexDirection: "column", gap: "7px" } }, /* @__PURE__ */ t.createElement("div", { style: L(l) }, "Why Is This Row Here?"), n.map(
|
|
766
|
+
return n.length === 0 ? null : /* @__PURE__ */ t.createElement("div", { "data-report-debug-inspector": "true", style: { border: `1px solid ${l.border}`, borderRadius: "12px", padding: "10px", background: l.hover || "#F8FAFC", display: "flex", flexDirection: "column", gap: "7px" } }, /* @__PURE__ */ t.createElement("div", { style: L(l) }, "Why Is This Row Here?"), n.map(
|
|
767
|
+
/** @param {any} p0 @returns {any} */
|
|
768
|
+
([a, r]) => /* @__PURE__ */ t.createElement("div", { key: a, style: { display: "flex", justifyContent: "space-between", gap: "10px", fontSize: "11px" } }, /* @__PURE__ */ t.createElement("span", { style: { color: l.textSec, fontWeight: 800 } }, a), /* @__PURE__ */ t.createElement("span", { style: { color: l.text, textAlign: "right", overflowWrap: "anywhere" } }, r))
|
|
769
|
+
));
|
|
641
770
|
}
|
|
642
|
-
function
|
|
771
|
+
function it({
|
|
643
772
|
title: e,
|
|
644
773
|
summary: l,
|
|
645
774
|
theme: n,
|
|
@@ -663,7 +792,10 @@ function ot({
|
|
|
663
792
|
"button",
|
|
664
793
|
{
|
|
665
794
|
type: "button",
|
|
666
|
-
onClick: () => s(
|
|
795
|
+
onClick: () => s(
|
|
796
|
+
/** @param {any} [current] @returns {any} */
|
|
797
|
+
(f) => !f
|
|
798
|
+
),
|
|
667
799
|
style: {
|
|
668
800
|
width: "100%",
|
|
669
801
|
border: "none",
|
|
@@ -678,21 +810,21 @@ function ot({
|
|
|
678
810
|
},
|
|
679
811
|
"aria-expanded": i
|
|
680
812
|
},
|
|
681
|
-
/* @__PURE__ */ t.createElement("span", { style: { display: "inline-flex", color: n.textSec, flexShrink: 0 } }, i ? /* @__PURE__ */ t.createElement(
|
|
813
|
+
/* @__PURE__ */ t.createElement("span", { style: { display: "inline-flex", color: n.textSec, flexShrink: 0 } }, i ? /* @__PURE__ */ t.createElement(m.ChevronDown, null) : /* @__PURE__ */ t.createElement(m.ChevronRight, null)),
|
|
682
814
|
/* @__PURE__ */ t.createElement("span", { style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ t.createElement("span", { style: { display: "block", fontSize: "12px", fontWeight: 900, color: n.text } }, e), l && /* @__PURE__ */ t.createElement("span", { style: { display: "block", fontSize: "11px", color: n.textSec, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", marginTop: "2px" } }, l))
|
|
683
815
|
),
|
|
684
816
|
i && /* @__PURE__ */ t.createElement("div", { style: { borderTop: `1px solid ${n.border}`, padding: "12px", display: "flex", flexDirection: "column", gap: "12px" } }, r)
|
|
685
817
|
);
|
|
686
818
|
}
|
|
687
819
|
function Jt({ item: e, selected: l, theme: n, sortByOptions: a, getFieldLabel: r = M, onSelect: i }) {
|
|
688
|
-
const s = e.node, f =
|
|
689
|
-
return /* @__PURE__ */ t.createElement("button", { type: "button", onClick: i, style:
|
|
820
|
+
const s = e.node, f = Lt(e), E = s.field ? r(s.field) : "Select field", b = lt(s), F = tt(s.sortBy, a);
|
|
821
|
+
return /* @__PURE__ */ t.createElement("button", { type: "button", onClick: i, style: at(n, l, e.depth) }, /* @__PURE__ */ t.createElement("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: "10px" } }, /* @__PURE__ */ t.createElement("div", { style: { minWidth: 0, display: "flex", flexDirection: "column", gap: "7px" } }, /* @__PURE__ */ t.createElement("div", { style: { display: "flex", alignItems: "center", gap: "6px", flexWrap: "wrap" } }, /* @__PURE__ */ t.createElement(X, { theme: n, tone: e.branchBadge ? "primary" : "neutral" }, f), /* @__PURE__ */ t.createElement("span", { style: { fontSize: "12px", fontWeight: 800, color: n.text } }, E)), /* @__PURE__ */ t.createElement("div", { style: { fontSize: "11px", color: n.textSec } }, "Header: ", b), /* @__PURE__ */ t.createElement("div", { style: { display: "flex", gap: "6px", flexWrap: "wrap" } }, /* @__PURE__ */ t.createElement(X, { theme: n }, s.topN ? `Top ${s.topN}` : "All rows"), /* @__PURE__ */ t.createElement(X, { theme: n }, F ? `Sort ${s.sortDir}${s.sortAbs ? " |abs|" : ""} by ${F}` : "Default sort"), s.defaultChild && /* @__PURE__ */ t.createElement(X, { theme: n }, "Has next level"), s.branches.length > 0 && /* @__PURE__ */ t.createElement(X, { theme: n, tone: "primary" }, s.branches.length, " row override", s.branches.length === 1 ? "" : "s"))), /* @__PURE__ */ t.createElement("span", { style: { color: l ? n.primary || "#2563EB" : n.textSec, flexShrink: 0 } }, /* @__PURE__ */ t.createElement(m.ChevronRight, null))));
|
|
690
822
|
}
|
|
691
|
-
function
|
|
823
|
+
function Gt({ item: e, selected: l, theme: n, onSelect: a }) {
|
|
692
824
|
const r = e.branch, i = r.label && r.label.trim() ? r.label.trim() : "Display original label";
|
|
693
|
-
return /* @__PURE__ */ t.createElement("button", { type: "button", onClick: a, style:
|
|
825
|
+
return /* @__PURE__ */ t.createElement("button", { type: "button", onClick: a, style: at(n, l, e.depth) }, /* @__PURE__ */ t.createElement("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: "10px" } }, /* @__PURE__ */ t.createElement("div", { style: { minWidth: 0, display: "flex", flexDirection: "column", gap: "7px" } }, /* @__PURE__ */ t.createElement("div", { style: { display: "flex", alignItems: "center", gap: "6px", flexWrap: "wrap" } }, /* @__PURE__ */ t.createElement(X, { theme: n, tone: "primary" }, `Row override ${e.badge}`), /* @__PURE__ */ t.createElement("span", { style: { fontSize: "12px", fontWeight: 800, color: n.text } }, i)), /* @__PURE__ */ t.createElement("div", { style: { fontSize: "11px", color: n.textSec, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, ke(r.condition)), /* @__PURE__ */ t.createElement("div", { style: { display: "flex", gap: "6px", flexWrap: "wrap" } }, /* @__PURE__ */ t.createElement(X, { theme: n }, r.child ? "Custom children" : "Default children"))), /* @__PURE__ */ t.createElement("span", { style: { color: l ? n.primary || "#2563EB" : n.textSec, flexShrink: 0 } }, /* @__PURE__ */ t.createElement(m.ChevronRight, null))));
|
|
694
826
|
}
|
|
695
|
-
function
|
|
827
|
+
function st({
|
|
696
828
|
item: e,
|
|
697
829
|
selected: l,
|
|
698
830
|
theme: n,
|
|
@@ -701,9 +833,9 @@ function it({
|
|
|
701
833
|
onSelect: i,
|
|
702
834
|
onDragStart: s,
|
|
703
835
|
onDragOver: f,
|
|
704
|
-
onDrop:
|
|
836
|
+
onDrop: E
|
|
705
837
|
}) {
|
|
706
|
-
const
|
|
838
|
+
const b = e.node, F = b.field ? r(b.field) : "Select field", N = b.label && b.label.trim() ? b.label.trim() : F, y = tt(b.sortBy, a);
|
|
707
839
|
return /* @__PURE__ */ t.createElement(
|
|
708
840
|
"button",
|
|
709
841
|
{
|
|
@@ -711,7 +843,7 @@ function it({
|
|
|
711
843
|
draggable: !0,
|
|
712
844
|
onDragStart: s,
|
|
713
845
|
onDragOver: f,
|
|
714
|
-
onDrop:
|
|
846
|
+
onDrop: E,
|
|
715
847
|
onClick: i,
|
|
716
848
|
style: {
|
|
717
849
|
width: "100%",
|
|
@@ -726,9 +858,9 @@ function it({
|
|
|
726
858
|
gap: "10px"
|
|
727
859
|
}
|
|
728
860
|
},
|
|
729
|
-
/* @__PURE__ */ t.createElement("span", { style: { cursor: "grab", display: "inline-flex" } }, /* @__PURE__ */ t.createElement(
|
|
730
|
-
/* @__PURE__ */ t.createElement("div", { style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ t.createElement("div", { style: { display: "flex", alignItems: "center", gap: "7px", minWidth: 0 } }, /* @__PURE__ */ t.createElement("span", { style: { fontSize: "11px", fontWeight: 800, color: n.textSec, flexShrink: 0 } }, "Level ", e.levelNumber), /* @__PURE__ */ t.createElement("span", { style: { fontSize: "12px", fontWeight: 800, color: n.text, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, N)), /* @__PURE__ */ t.createElement("div", { style: { fontSize: "11px", color: n.textSec, marginTop: "3px", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, F, y ? ` · ${
|
|
731
|
-
/* @__PURE__ */ t.createElement("span", { style: { color: l ? n.primary || "#2563EB" : n.textSec, flexShrink: 0 } }, /* @__PURE__ */ t.createElement(
|
|
861
|
+
/* @__PURE__ */ t.createElement("span", { style: { cursor: "grab", display: "inline-flex" } }, /* @__PURE__ */ t.createElement(m.DragIndicator, null)),
|
|
862
|
+
/* @__PURE__ */ t.createElement("div", { style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ t.createElement("div", { style: { display: "flex", alignItems: "center", gap: "7px", minWidth: 0 } }, /* @__PURE__ */ t.createElement("span", { style: { fontSize: "11px", fontWeight: 800, color: n.textSec, flexShrink: 0 } }, "Level ", e.levelNumber), /* @__PURE__ */ t.createElement("span", { style: { fontSize: "12px", fontWeight: 800, color: n.text, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, N)), /* @__PURE__ */ t.createElement("div", { style: { fontSize: "11px", color: n.textSec, marginTop: "3px", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, F, y ? ` · ${b.sortDir === "asc" ? "Asc" : "Desc"}${b.sortAbs ? " |abs|" : ""} by ${y}` : "", b.topN ? ` · Top ${b.topN}` : "", b.filters && b.filters.clauses && b.filters.clauses.length > 0 ? ` · ${b.filters.clauses.length} filter${b.filters.clauses.length === 1 ? "" : "s"}` : "")),
|
|
863
|
+
/* @__PURE__ */ t.createElement("span", { style: { color: l ? n.primary || "#2563EB" : n.textSec, flexShrink: 0 } }, /* @__PURE__ */ t.createElement(m.ChevronRight, null))
|
|
732
864
|
);
|
|
733
865
|
}
|
|
734
866
|
function Yt({
|
|
@@ -740,18 +872,18 @@ function Yt({
|
|
|
740
872
|
theme: i,
|
|
741
873
|
onUpdate: s,
|
|
742
874
|
onApply: f,
|
|
743
|
-
onRemove:
|
|
744
|
-
onEditFilter:
|
|
875
|
+
onRemove: E,
|
|
876
|
+
onEditFilter: b,
|
|
745
877
|
titleLabel: F = "Title",
|
|
746
878
|
canRemove: N = !0
|
|
747
879
|
}) {
|
|
748
|
-
const y = q(i),
|
|
880
|
+
const y = q(i), C = e && e.levelNumber ? `Level ${e.levelNumber}` : "Level", c = !!(l.filters && l.filters.clauses && l.filters.clauses.length > 0), v = [
|
|
749
881
|
l.field ? a(l.field) : "Select field",
|
|
750
882
|
l.label && l.label.trim() ? `Title: ${l.label.trim()}` : null,
|
|
751
883
|
l.topN ? `Top ${l.topN}` : null,
|
|
752
884
|
c ? `${l.filters.clauses.length} filter${l.filters.clauses.length === 1 ? "" : "s"}` : null
|
|
753
885
|
].filter(Boolean);
|
|
754
|
-
return /* @__PURE__ */ t.createElement("div", { style:
|
|
886
|
+
return /* @__PURE__ */ t.createElement("div", { style: ue(i) }, /* @__PURE__ */ t.createElement("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: "12px" } }, /* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: { fontSize: "14px", fontWeight: 800, color: i.text } }, C)), /* @__PURE__ */ t.createElement("div", { style: { display: "flex", gap: "8px", flexShrink: 0 } }, /* @__PURE__ */ t.createElement(
|
|
755
887
|
"button",
|
|
756
888
|
{
|
|
757
889
|
type: "button",
|
|
@@ -768,23 +900,28 @@ function Yt({
|
|
|
768
900
|
}
|
|
769
901
|
},
|
|
770
902
|
"Apply"
|
|
771
|
-
), N && /* @__PURE__ */ t.createElement("button", { type: "button", onClick:
|
|
772
|
-
|
|
903
|
+
), N && /* @__PURE__ */ t.createElement("button", { type: "button", onClick: E, style: j(i, !1, !0) }, /* @__PURE__ */ t.createElement(m.Delete, null), " ", e && e.path && e.path.length === 0 ? "Clear report" : "Remove level"))), /* @__PURE__ */ t.createElement(
|
|
904
|
+
it,
|
|
773
905
|
{
|
|
774
|
-
title: `${
|
|
775
|
-
summary:
|
|
906
|
+
title: `${C} settings`,
|
|
907
|
+
summary: v.join(" · "),
|
|
776
908
|
theme: i,
|
|
777
909
|
defaultOpen: !1
|
|
778
910
|
},
|
|
779
911
|
/* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: L(i) }, "Break Down By"), /* @__PURE__ */ t.createElement(
|
|
780
|
-
|
|
912
|
+
U,
|
|
781
913
|
{
|
|
914
|
+
size: "sm",
|
|
915
|
+
"aria-label": "Break down by",
|
|
782
916
|
value: l.field,
|
|
783
917
|
onChange: (u) => s({ ...l, field: u.target.value }),
|
|
784
|
-
style: y
|
|
918
|
+
style: { ...y, width: "100%" }
|
|
785
919
|
},
|
|
786
920
|
/* @__PURE__ */ t.createElement("option", { value: "" }, "Select field..."),
|
|
787
|
-
n.map(
|
|
921
|
+
n.map(
|
|
922
|
+
/** @param {any} [field] @returns {any} */
|
|
923
|
+
(u) => /* @__PURE__ */ t.createElement("option", { key: u, value: u }, a(u))
|
|
924
|
+
)
|
|
788
925
|
)),
|
|
789
926
|
/* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: L(i) }, F), /* @__PURE__ */ t.createElement(
|
|
790
927
|
"input",
|
|
@@ -809,13 +946,18 @@ function Yt({
|
|
|
809
946
|
style: { ...y, textAlign: "center" }
|
|
810
947
|
}
|
|
811
948
|
), /* @__PURE__ */ t.createElement(
|
|
812
|
-
|
|
949
|
+
U,
|
|
813
950
|
{
|
|
951
|
+
size: "sm",
|
|
952
|
+
"aria-label": "Sort by",
|
|
814
953
|
value: l.sortBy || "",
|
|
815
954
|
onChange: (u) => s({ ...l, sortBy: u.target.value || null }),
|
|
816
|
-
style: y
|
|
955
|
+
style: { ...y, width: "100%" }
|
|
817
956
|
},
|
|
818
|
-
r.map(
|
|
957
|
+
r.map(
|
|
958
|
+
/** @param {any} [option] @returns {any} */
|
|
959
|
+
(u) => /* @__PURE__ */ t.createElement("option", { key: u.value, value: u.value }, u.label)
|
|
960
|
+
)
|
|
819
961
|
), /* @__PURE__ */ t.createElement(
|
|
820
962
|
"button",
|
|
821
963
|
{
|
|
@@ -853,13 +995,13 @@ function Yt({
|
|
|
853
995
|
},
|
|
854
996
|
title: l.sortDir === "asc" ? "Ascending" : "Descending"
|
|
855
997
|
},
|
|
856
|
-
l.sortDir === "asc" ? /* @__PURE__ */ t.createElement(
|
|
998
|
+
l.sortDir === "asc" ? /* @__PURE__ */ t.createElement(m.SortAsc, null) : /* @__PURE__ */ t.createElement(m.SortDesc, null)
|
|
857
999
|
))),
|
|
858
1000
|
/* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: L(i) }, "Level Filter"), /* @__PURE__ */ t.createElement("div", { style: { display: "flex", gap: "8px", alignItems: "stretch" } }, /* @__PURE__ */ t.createElement(
|
|
859
1001
|
"button",
|
|
860
1002
|
{
|
|
861
1003
|
type: "button",
|
|
862
|
-
onClick:
|
|
1004
|
+
onClick: b,
|
|
863
1005
|
style: q(i, {
|
|
864
1006
|
flex: 1,
|
|
865
1007
|
display: "flex",
|
|
@@ -871,8 +1013,8 @@ function Yt({
|
|
|
871
1013
|
borderColor: c ? `${i.primary || "#2563EB"}45` : void 0
|
|
872
1014
|
})
|
|
873
1015
|
},
|
|
874
|
-
/* @__PURE__ */ t.createElement(
|
|
875
|
-
/* @__PURE__ */ t.createElement("span", { style: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", flex: 1 } }, c ?
|
|
1016
|
+
/* @__PURE__ */ t.createElement(m.Filter, null),
|
|
1017
|
+
/* @__PURE__ */ t.createElement("span", { style: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", flex: 1 } }, c ? ke(l.filters) : "No filter (show all rows)")
|
|
876
1018
|
), c && /* @__PURE__ */ t.createElement(
|
|
877
1019
|
"button",
|
|
878
1020
|
{
|
|
@@ -892,19 +1034,22 @@ function Yt({
|
|
|
892
1034
|
},
|
|
893
1035
|
title: "Clear filter"
|
|
894
1036
|
},
|
|
895
|
-
/* @__PURE__ */ t.createElement(
|
|
1037
|
+
/* @__PURE__ */ t.createElement(m.Close, null)
|
|
896
1038
|
)), /* @__PURE__ */ t.createElement("div", { style: { fontSize: "11px", color: i.textSec, marginTop: "6px", lineHeight: 1.4 } }, `Rows that don't match the filter are grouped into "Others" to keep totals intact.`)),
|
|
897
1039
|
/* @__PURE__ */ t.createElement(
|
|
898
|
-
|
|
1040
|
+
ot,
|
|
899
1041
|
{
|
|
900
1042
|
value: l.format,
|
|
901
1043
|
theme: i,
|
|
902
|
-
onChange: (
|
|
1044
|
+
onChange: (
|
|
1045
|
+
/** @param {any} [format] @returns {any} */
|
|
1046
|
+
((u) => s({ ...l, format: u }))
|
|
1047
|
+
)
|
|
903
1048
|
}
|
|
904
1049
|
)
|
|
905
1050
|
));
|
|
906
1051
|
}
|
|
907
|
-
function
|
|
1052
|
+
function Zt({
|
|
908
1053
|
draft: e,
|
|
909
1054
|
allFields: l,
|
|
910
1055
|
getFieldLabel: n = M,
|
|
@@ -914,47 +1059,57 @@ function Gt({
|
|
|
914
1059
|
onApply: s,
|
|
915
1060
|
onCancel: f
|
|
916
1061
|
}) {
|
|
917
|
-
const [
|
|
1062
|
+
const [E, b] = H(null), [F, N] = H(!1), y = e && e.child ? e.child : Y(""), C = Array.isArray(e && e.selectedPath) ? e.selectedPath : [], c = ae(y, C) || y, h = !!(c.filters && c.filters.clauses && c.filters.clauses.length > 0), v = We(y, e.childLevelNumber || 2), u = Math.max(0, C.length), D = (e && Number.isFinite(Number(e.childLevelNumber)) ? Number(e.childLevelNumber) : 2) + C.length, R = q(r), x = [
|
|
918
1063
|
c.field ? n(c.field) : "Select field",
|
|
919
1064
|
e.title && e.title.trim() ? `Title: ${e.title.trim()}` : null,
|
|
920
1065
|
c.topN ? `Top ${c.topN}` : null,
|
|
921
|
-
|
|
922
|
-
].filter(Boolean),
|
|
1066
|
+
h ? `${c.filters.clauses.length} filter${c.filters.clauses.length === 1 ? "" : "s"}` : null
|
|
1067
|
+
].filter(Boolean), w = (d) => {
|
|
923
1068
|
i({
|
|
924
1069
|
...e,
|
|
925
|
-
child:
|
|
1070
|
+
child: _(y, C, () => d)
|
|
926
1071
|
});
|
|
927
|
-
},
|
|
1072
|
+
}, K = (d) => {
|
|
928
1073
|
i({
|
|
929
1074
|
...e,
|
|
930
|
-
selectedPath:
|
|
1075
|
+
selectedPath: Ie(d)
|
|
931
1076
|
});
|
|
932
|
-
},
|
|
933
|
-
const d = [...
|
|
1077
|
+
}, fe = () => {
|
|
1078
|
+
const d = [...C, T];
|
|
934
1079
|
i({
|
|
935
1080
|
...e,
|
|
936
|
-
child:
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
1081
|
+
child: _(
|
|
1082
|
+
y,
|
|
1083
|
+
C,
|
|
1084
|
+
/** @param {any} [node] @returns {any} */
|
|
1085
|
+
(A) => ({
|
|
1086
|
+
...A,
|
|
1087
|
+
defaultChild: A.defaultChild || Y("")
|
|
1088
|
+
})
|
|
1089
|
+
),
|
|
940
1090
|
selectedPath: d
|
|
941
1091
|
});
|
|
942
|
-
},
|
|
1092
|
+
}, ie = () => {
|
|
943
1093
|
i({
|
|
944
1094
|
...e,
|
|
945
|
-
child:
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
1095
|
+
child: _(
|
|
1096
|
+
y,
|
|
1097
|
+
C,
|
|
1098
|
+
/** @param {any} [node] @returns {any} */
|
|
1099
|
+
(d) => ({
|
|
1100
|
+
...d,
|
|
1101
|
+
defaultChild: null
|
|
1102
|
+
})
|
|
1103
|
+
)
|
|
949
1104
|
});
|
|
950
|
-
},
|
|
951
|
-
d === null || d ===
|
|
1105
|
+
}, ye = (d, A) => {
|
|
1106
|
+
d === null || d === A || (i({
|
|
952
1107
|
...e,
|
|
953
|
-
child:
|
|
954
|
-
selectedPath:
|
|
955
|
-
}),
|
|
1108
|
+
child: nt(y, d, A),
|
|
1109
|
+
selectedPath: Ie(A)
|
|
1110
|
+
}), b(null));
|
|
956
1111
|
};
|
|
957
|
-
return /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement("div", { style:
|
|
1112
|
+
return /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement("div", { style: ue(r) }, /* @__PURE__ */ t.createElement("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: "12px" } }, /* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: { fontSize: "14px", fontWeight: 800, color: r.text } }, e.rowLabel || "Selected row"), /* @__PURE__ */ t.createElement("div", { style: { fontSize: "12px", color: r.textSec, marginTop: "2px" } }, "Override applies to this row only.")), /* @__PURE__ */ t.createElement("div", { style: { display: "flex", gap: "8px", flexShrink: 0 } }, /* @__PURE__ */ t.createElement("button", { type: "button", onClick: f, style: j(r) }, /* @__PURE__ */ t.createElement(m.Close, null), " Close"), /* @__PURE__ */ t.createElement(
|
|
958
1113
|
"button",
|
|
959
1114
|
{
|
|
960
1115
|
type: "button",
|
|
@@ -971,26 +1126,38 @@ function Gt({
|
|
|
971
1126
|
}
|
|
972
1127
|
},
|
|
973
1128
|
"Apply"
|
|
974
|
-
))), /* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: L(r) }, "Level"), /* @__PURE__ */ t.createElement("div", { style: { fontSize: "12px", fontWeight: 800, color: r.text } }, `Level ${D}`)), /* @__PURE__ */ t.createElement(
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
1129
|
+
))), /* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: L(r) }, "Level"), /* @__PURE__ */ t.createElement("div", { style: { fontSize: "12px", fontWeight: 800, color: r.text } }, `Level ${D}`)), /* @__PURE__ */ t.createElement(Kt, { debug: e.request && e.request.debug, theme: r }), v.length > 1 && /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "8px" } }, v.map(
|
|
1130
|
+
/** @param {any} [item] @returns {any} */
|
|
1131
|
+
(d) => /* @__PURE__ */ t.createElement(
|
|
1132
|
+
st,
|
|
1133
|
+
{
|
|
1134
|
+
key: `draft-level:${d.index}:${d.node._id}`,
|
|
1135
|
+
item: d,
|
|
1136
|
+
selected: u === d.index,
|
|
1137
|
+
theme: r,
|
|
1138
|
+
sortByOptions: a,
|
|
1139
|
+
getFieldLabel: n,
|
|
1140
|
+
onSelect: () => K(d.index),
|
|
1141
|
+
onDragStart: (
|
|
1142
|
+
/** @param {any} [event] @returns {any} */
|
|
1143
|
+
((A) => {
|
|
1144
|
+
b(d.index), A.dataTransfer.effectAllowed = "move";
|
|
1145
|
+
})
|
|
1146
|
+
),
|
|
1147
|
+
onDragOver: (
|
|
1148
|
+
/** @param {any} [event] @returns {any} */
|
|
1149
|
+
((A) => A.preventDefault())
|
|
1150
|
+
),
|
|
1151
|
+
onDrop: (
|
|
1152
|
+
/** @param {any} [event] @returns {any} */
|
|
1153
|
+
((A) => {
|
|
1154
|
+
A.preventDefault(), ye(E, d.index);
|
|
1155
|
+
})
|
|
1156
|
+
)
|
|
990
1157
|
}
|
|
991
|
-
|
|
992
|
-
))
|
|
993
|
-
|
|
1158
|
+
)
|
|
1159
|
+
)), /* @__PURE__ */ t.createElement(
|
|
1160
|
+
it,
|
|
994
1161
|
{
|
|
995
1162
|
title: `Level ${D} settings`,
|
|
996
1163
|
summary: x.join(" · "),
|
|
@@ -1007,14 +1174,19 @@ function Gt({
|
|
|
1007
1174
|
}
|
|
1008
1175
|
)),
|
|
1009
1176
|
/* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: L(r) }, "Break Down By"), /* @__PURE__ */ t.createElement(
|
|
1010
|
-
|
|
1177
|
+
U,
|
|
1011
1178
|
{
|
|
1179
|
+
size: "sm",
|
|
1180
|
+
"aria-label": "Break down by",
|
|
1012
1181
|
value: c.field,
|
|
1013
|
-
onChange: (d) =>
|
|
1014
|
-
style: R
|
|
1182
|
+
onChange: (d) => w({ ...c, field: d.target.value }),
|
|
1183
|
+
style: { ...R, width: "100%" }
|
|
1015
1184
|
},
|
|
1016
1185
|
/* @__PURE__ */ t.createElement("option", { value: "" }, "Select field..."),
|
|
1017
|
-
l.map(
|
|
1186
|
+
l.map(
|
|
1187
|
+
/** @param {any} [field] @returns {any} */
|
|
1188
|
+
(d) => /* @__PURE__ */ t.createElement("option", { key: d, value: d }, n(d))
|
|
1189
|
+
)
|
|
1018
1190
|
)),
|
|
1019
1191
|
/* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: L(r) }, "Ranking And Sort"), /* @__PURE__ */ t.createElement("div", { style: { display: "grid", gridTemplateColumns: "82px 1fr 42px 42px", gap: "8px", alignItems: "stretch" } }, /* @__PURE__ */ t.createElement(
|
|
1020
1192
|
"input",
|
|
@@ -1023,25 +1195,30 @@ function Gt({
|
|
|
1023
1195
|
min: "1",
|
|
1024
1196
|
value: c.topN || "",
|
|
1025
1197
|
onChange: (d) => {
|
|
1026
|
-
const
|
|
1027
|
-
|
|
1198
|
+
const A = d.target.value === "" ? null : parseInt(d.target.value, 10);
|
|
1199
|
+
w({ ...c, topN: A && A > 0 ? A : null });
|
|
1028
1200
|
},
|
|
1029
1201
|
placeholder: "All",
|
|
1030
1202
|
style: { ...R, textAlign: "center" }
|
|
1031
1203
|
}
|
|
1032
1204
|
), /* @__PURE__ */ t.createElement(
|
|
1033
|
-
|
|
1205
|
+
U,
|
|
1034
1206
|
{
|
|
1207
|
+
size: "sm",
|
|
1208
|
+
"aria-label": "Sort by",
|
|
1035
1209
|
value: c.sortBy || "",
|
|
1036
|
-
onChange: (d) =>
|
|
1037
|
-
style: R
|
|
1210
|
+
onChange: (d) => w({ ...c, sortBy: d.target.value || null }),
|
|
1211
|
+
style: { ...R, width: "100%" }
|
|
1038
1212
|
},
|
|
1039
|
-
a.map(
|
|
1213
|
+
a.map(
|
|
1214
|
+
/** @param {any} [option] @returns {any} */
|
|
1215
|
+
(d) => /* @__PURE__ */ t.createElement("option", { key: d.value, value: d.value }, d.label)
|
|
1216
|
+
)
|
|
1040
1217
|
), /* @__PURE__ */ t.createElement(
|
|
1041
1218
|
"button",
|
|
1042
1219
|
{
|
|
1043
1220
|
type: "button",
|
|
1044
|
-
onClick: () =>
|
|
1221
|
+
onClick: () => w({ ...c, sortAbs: !c.sortAbs }),
|
|
1045
1222
|
style: {
|
|
1046
1223
|
border: `1px solid ${c.sortAbs ? r.primary || "#2563EB" : r.border}`,
|
|
1047
1224
|
borderRadius: "10px",
|
|
@@ -1061,7 +1238,7 @@ function Gt({
|
|
|
1061
1238
|
"button",
|
|
1062
1239
|
{
|
|
1063
1240
|
type: "button",
|
|
1064
|
-
onClick: () =>
|
|
1241
|
+
onClick: () => w({ ...c, sortDir: c.sortDir === "asc" ? "desc" : "asc" }),
|
|
1065
1242
|
style: {
|
|
1066
1243
|
border: `1px solid ${r.border}`,
|
|
1067
1244
|
borderRadius: "10px",
|
|
@@ -1074,7 +1251,7 @@ function Gt({
|
|
|
1074
1251
|
},
|
|
1075
1252
|
title: c.sortDir === "asc" ? "Ascending" : "Descending"
|
|
1076
1253
|
},
|
|
1077
|
-
c.sortDir === "asc" ? /* @__PURE__ */ t.createElement(
|
|
1254
|
+
c.sortDir === "asc" ? /* @__PURE__ */ t.createElement(m.SortAsc, null) : /* @__PURE__ */ t.createElement(m.SortDesc, null)
|
|
1078
1255
|
))),
|
|
1079
1256
|
/* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: L(r) }, "Filter (this row's children only)"), /* @__PURE__ */ t.createElement("div", { style: { display: "flex", gap: "8px", alignItems: "stretch" } }, /* @__PURE__ */ t.createElement(
|
|
1080
1257
|
"button",
|
|
@@ -1088,17 +1265,17 @@ function Gt({
|
|
|
1088
1265
|
gap: "8px",
|
|
1089
1266
|
textAlign: "left",
|
|
1090
1267
|
cursor: "pointer",
|
|
1091
|
-
background:
|
|
1092
|
-
borderColor:
|
|
1268
|
+
background: h ? `${r.primary || "#2563EB"}08` : r.hover || "#F8FAFC",
|
|
1269
|
+
borderColor: h ? `${r.primary || "#2563EB"}45` : void 0
|
|
1093
1270
|
})
|
|
1094
1271
|
},
|
|
1095
|
-
/* @__PURE__ */ t.createElement(
|
|
1096
|
-
/* @__PURE__ */ t.createElement("span", { style: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", flex: 1 } },
|
|
1097
|
-
),
|
|
1272
|
+
/* @__PURE__ */ t.createElement(m.Filter, null),
|
|
1273
|
+
/* @__PURE__ */ t.createElement("span", { style: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", flex: 1 } }, h ? ke(c.filters) : "No filter (show all children)")
|
|
1274
|
+
), h && /* @__PURE__ */ t.createElement(
|
|
1098
1275
|
"button",
|
|
1099
1276
|
{
|
|
1100
1277
|
type: "button",
|
|
1101
|
-
onClick: () =>
|
|
1278
|
+
onClick: () => w({ ...c, filters: null }),
|
|
1102
1279
|
style: {
|
|
1103
1280
|
border: `1px solid ${r.border}`,
|
|
1104
1281
|
borderRadius: "10px",
|
|
@@ -1113,48 +1290,54 @@ function Gt({
|
|
|
1113
1290
|
},
|
|
1114
1291
|
title: "Clear filter"
|
|
1115
1292
|
},
|
|
1116
|
-
/* @__PURE__ */ t.createElement(
|
|
1293
|
+
/* @__PURE__ */ t.createElement(m.Close, null)
|
|
1117
1294
|
)), /* @__PURE__ */ t.createElement("div", { style: { fontSize: "11px", color: r.textSec, marginTop: "6px", lineHeight: 1.4 } }, 'Filtered-out children are grouped into "Others" to keep totals intact.')),
|
|
1118
1295
|
/* @__PURE__ */ t.createElement(
|
|
1119
|
-
|
|
1296
|
+
ot,
|
|
1120
1297
|
{
|
|
1121
1298
|
value: c.format,
|
|
1122
1299
|
theme: r,
|
|
1123
|
-
onChange: (
|
|
1300
|
+
onChange: (
|
|
1301
|
+
/** @param {any} [format] @returns {any} */
|
|
1302
|
+
((d) => w({ ...c, format: d }))
|
|
1303
|
+
)
|
|
1124
1304
|
}
|
|
1125
1305
|
),
|
|
1126
1306
|
/* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px" } }, /* @__PURE__ */ t.createElement(
|
|
1127
1307
|
"button",
|
|
1128
1308
|
{
|
|
1129
1309
|
type: "button",
|
|
1130
|
-
onClick:
|
|
1310
|
+
onClick: fe,
|
|
1131
1311
|
disabled: !c.field,
|
|
1132
1312
|
style: { ...j(r, !!c.defaultChild), opacity: c.field ? 1 : 0.5 }
|
|
1133
1313
|
},
|
|
1134
|
-
/* @__PURE__ */ t.createElement(
|
|
1314
|
+
/* @__PURE__ */ t.createElement(m.Add, null),
|
|
1135
1315
|
" ",
|
|
1136
1316
|
c.defaultChild ? "Open next level" : "Add next level"
|
|
1137
|
-
), c.defaultChild && /* @__PURE__ */ t.createElement("button", { type: "button", onClick:
|
|
1317
|
+
), c.defaultChild && /* @__PURE__ */ t.createElement("button", { type: "button", onClick: ie, style: j(r, !1, !0) }, /* @__PURE__ */ t.createElement(m.Delete, null), " Remove next level"))
|
|
1138
1318
|
)), F && /* @__PURE__ */ t.createElement(
|
|
1139
|
-
|
|
1319
|
+
Pe,
|
|
1140
1320
|
{
|
|
1141
1321
|
title: `Filter children of "${e.rowLabel || "this row"}"`,
|
|
1142
1322
|
description: "Only children matching this filter are shown. Filtered-out rows are grouped into 'Others' to keep totals intact.",
|
|
1143
|
-
condition: c.filters ||
|
|
1323
|
+
condition: c.filters || Le(),
|
|
1144
1324
|
allFields: l,
|
|
1145
1325
|
getFieldLabel: n,
|
|
1146
1326
|
theme: r,
|
|
1147
|
-
onSave: (
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1327
|
+
onSave: (
|
|
1328
|
+
/** @param {any} [nextCondition] @returns {any} */
|
|
1329
|
+
((d) => {
|
|
1330
|
+
w({
|
|
1331
|
+
...c,
|
|
1332
|
+
filters: d.clauses.length > 0 ? d : null
|
|
1333
|
+
});
|
|
1334
|
+
})
|
|
1335
|
+
),
|
|
1153
1336
|
onClose: () => N(!1)
|
|
1154
1337
|
}
|
|
1155
1338
|
));
|
|
1156
1339
|
}
|
|
1157
|
-
function
|
|
1340
|
+
function Xt({
|
|
1158
1341
|
item: e,
|
|
1159
1342
|
branch: l,
|
|
1160
1343
|
theme: n,
|
|
@@ -1164,21 +1347,21 @@ function Zt({
|
|
|
1164
1347
|
onRemoveCustomChildren: s,
|
|
1165
1348
|
onRemove: f
|
|
1166
1349
|
}) {
|
|
1167
|
-
const
|
|
1168
|
-
return /* @__PURE__ */ t.createElement("div", { style:
|
|
1350
|
+
const E = q(n), b = ke(l.condition);
|
|
1351
|
+
return /* @__PURE__ */ t.createElement("div", { style: ue(n) }, /* @__PURE__ */ t.createElement("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: "12px" } }, /* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: { fontSize: "14px", fontWeight: 800, color: n.text } }, `Row override ${e.badge}`), /* @__PURE__ */ t.createElement("div", { style: { fontSize: "12px", color: n.textSec, marginTop: "2px" } }, "Use a row override when matching rows need a different label or child breakdown.")), /* @__PURE__ */ t.createElement("button", { type: "button", onClick: f, style: j(n, !1, !0) }, /* @__PURE__ */ t.createElement(m.Delete, null), " Remove override")), /* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: L(n) }, "Display As"), /* @__PURE__ */ t.createElement(
|
|
1169
1352
|
"input",
|
|
1170
1353
|
{
|
|
1171
1354
|
value: l.label,
|
|
1172
1355
|
onChange: (F) => a({ ...l, label: F.target.value }),
|
|
1173
1356
|
placeholder: "Label to show for matching rows",
|
|
1174
|
-
style:
|
|
1357
|
+
style: E
|
|
1175
1358
|
}
|
|
1176
1359
|
)), /* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: L(n) }, "Rule"), /* @__PURE__ */ t.createElement(
|
|
1177
1360
|
"button",
|
|
1178
1361
|
{
|
|
1179
1362
|
type: "button",
|
|
1180
1363
|
onClick: r,
|
|
1181
|
-
title:
|
|
1364
|
+
title: b,
|
|
1182
1365
|
style: {
|
|
1183
1366
|
...q(n),
|
|
1184
1367
|
display: "flex",
|
|
@@ -1189,9 +1372,9 @@ function Zt({
|
|
|
1189
1372
|
background: n.hover || "#F8FAFC"
|
|
1190
1373
|
}
|
|
1191
1374
|
},
|
|
1192
|
-
/* @__PURE__ */ t.createElement(
|
|
1193
|
-
/* @__PURE__ */ t.createElement("span", { style: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } },
|
|
1194
|
-
)), /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px" } }, /* @__PURE__ */ t.createElement("button", { type: "button", onClick: i, style: j(n, !!l.child) }, /* @__PURE__ */ t.createElement(
|
|
1375
|
+
/* @__PURE__ */ t.createElement(m.Filter, null),
|
|
1376
|
+
/* @__PURE__ */ t.createElement("span", { style: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, b)
|
|
1377
|
+
)), /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px" } }, /* @__PURE__ */ t.createElement("button", { type: "button", onClick: i, style: j(n, !!l.child) }, /* @__PURE__ */ t.createElement(m.Add, null), " ", l.child ? "Open Custom children" : "Add Custom children"), l.child && /* @__PURE__ */ t.createElement("button", { type: "button", onClick: s, style: j(n, !1, !0) }, /* @__PURE__ */ t.createElement(m.Delete, null), " Remove Custom children")), /* @__PURE__ */ t.createElement(
|
|
1195
1378
|
"div",
|
|
1196
1379
|
{
|
|
1197
1380
|
style: {
|
|
@@ -1206,7 +1389,7 @@ function Zt({
|
|
|
1206
1389
|
"Override applies to this row only. Rows without this override continue with Default children."
|
|
1207
1390
|
));
|
|
1208
1391
|
}
|
|
1209
|
-
function
|
|
1392
|
+
function el({
|
|
1210
1393
|
reportDef: e,
|
|
1211
1394
|
setReportDef: l,
|
|
1212
1395
|
availableFields: n,
|
|
@@ -1215,217 +1398,311 @@ function Ut({
|
|
|
1215
1398
|
data: i = [],
|
|
1216
1399
|
valConfigs: s,
|
|
1217
1400
|
colFields: f,
|
|
1218
|
-
setColFields:
|
|
1219
|
-
setValConfigs:
|
|
1401
|
+
setColFields: E,
|
|
1402
|
+
setValConfigs: b,
|
|
1220
1403
|
savedReports: F,
|
|
1221
1404
|
setSavedReports: N,
|
|
1222
1405
|
activeReportId: y,
|
|
1223
|
-
setActiveReportId:
|
|
1406
|
+
setActiveReportId: C,
|
|
1224
1407
|
showNotification: c,
|
|
1225
|
-
requestedSelection:
|
|
1226
|
-
showReportConfigColumn:
|
|
1408
|
+
requestedSelection: h = null,
|
|
1409
|
+
showReportConfigColumn: v = !0,
|
|
1227
1410
|
setShowReportConfigColumn: u
|
|
1228
1411
|
}) {
|
|
1229
|
-
const [D, R] = H(""), [x,
|
|
1412
|
+
const [D, R] = H(""), [x, w] = H(null), [K, fe] = H(null), [ie, ye] = H(null), [d, A] = H(null), [ct, Te] = H(null), xe = Fe(null), se = Fe(!1), je = Fe(null), g = W(
|
|
1230
1413
|
() => e && e.root ? V(e.root) : null,
|
|
1231
1414
|
[e]
|
|
1232
|
-
),
|
|
1233
|
-
() =>
|
|
1415
|
+
), O = W(
|
|
1416
|
+
() => Rt(n, s),
|
|
1234
1417
|
[n, s]
|
|
1235
|
-
),
|
|
1236
|
-
(o) =>
|
|
1418
|
+
), ee = B(
|
|
1419
|
+
(o) => St(o, a),
|
|
1237
1420
|
[a]
|
|
1238
|
-
),
|
|
1239
|
-
() =>
|
|
1421
|
+
), be = W(
|
|
1422
|
+
() => Nt(s),
|
|
1240
1423
|
[s]
|
|
1241
|
-
),
|
|
1242
|
-
() =>
|
|
1243
|
-
[
|
|
1424
|
+
), J = W(
|
|
1425
|
+
() => Ze(g, { allFields: O, valConfigs: s, data: i }),
|
|
1426
|
+
[g, O, s, i]
|
|
1244
1427
|
), $ = B((o) => {
|
|
1245
|
-
l(
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1428
|
+
l(
|
|
1429
|
+
/** @param {any} [prev] @returns {any} */
|
|
1430
|
+
(p) => {
|
|
1431
|
+
const S = p && typeof p == "object" ? p : {}, k = S.root ? V(S.root) : null, P = typeof o == "function" ? o(k) : o;
|
|
1432
|
+
return { ...S, root: P };
|
|
1433
|
+
}
|
|
1434
|
+
);
|
|
1435
|
+
}, [l]), te = W(() => zt(g), [g]), I = W(() => We(g), [g]), ce = W(
|
|
1436
|
+
() => jt(te, x),
|
|
1437
|
+
[te, x]
|
|
1252
1438
|
);
|
|
1253
|
-
|
|
1254
|
-
() =>
|
|
1255
|
-
[
|
|
1256
|
-
),
|
|
1257
|
-
() =>
|
|
1258
|
-
[
|
|
1439
|
+
W(
|
|
1440
|
+
() => Mt(te, x),
|
|
1441
|
+
[te, x]
|
|
1442
|
+
), W(
|
|
1443
|
+
() => Ht(te, x),
|
|
1444
|
+
[te, x]
|
|
1259
1445
|
);
|
|
1260
|
-
const
|
|
1261
|
-
if (!
|
|
1446
|
+
const le = W(() => {
|
|
1447
|
+
if (!g || !x) return null;
|
|
1262
1448
|
if (x.type === "node") {
|
|
1263
|
-
const o =
|
|
1449
|
+
const o = ae(g, x.path);
|
|
1264
1450
|
return o ? { type: "node", node: o } : null;
|
|
1265
1451
|
}
|
|
1266
1452
|
if (x.type === "branch") {
|
|
1267
|
-
const o =
|
|
1453
|
+
const o = Be(g, x.nodePath, x.branchIndex);
|
|
1268
1454
|
return o ? { type: "branch", branch: o } : null;
|
|
1269
1455
|
}
|
|
1270
1456
|
return null;
|
|
1271
|
-
}, [
|
|
1272
|
-
if (!o || o.type !== "rowPath" || !
|
|
1273
|
-
const p = Array.isArray(o.nodePath) ? o.nodePath : [], S =
|
|
1457
|
+
}, [g, x]), $e = W(() => !K || !g ? null : Be(g, K.nodePath, K.branchIndex), [K, g]), Me = B((o) => {
|
|
1458
|
+
if (!o || o.type !== "rowPath" || !g) return !1;
|
|
1459
|
+
const p = Array.isArray(o.nodePath) ? o.nodePath : [], S = ae(g, p);
|
|
1274
1460
|
if (!S) return !1;
|
|
1275
|
-
const
|
|
1276
|
-
|
|
1461
|
+
const k = Array.isArray(S.branches) ? S.branches : [], P = k.findIndex(
|
|
1462
|
+
/** @param {any} [branch] @returns {any} */
|
|
1463
|
+
(de) => Xe(de, o.field, o.value)
|
|
1464
|
+
), z = P >= 0 ? k[P] : null, he = z && z.child ? z.child : S.defaultChild || Y(""), G = Q(o.label || o.value);
|
|
1465
|
+
return A({
|
|
1277
1466
|
request: o,
|
|
1278
1467
|
nodePath: p,
|
|
1279
1468
|
branchIndex: P,
|
|
1280
|
-
rowLabel:
|
|
1281
|
-
title:
|
|
1282
|
-
child: Oe(
|
|
1469
|
+
rowLabel: G,
|
|
1470
|
+
title: z && z.label ? z.label : G,
|
|
1471
|
+
child: Oe(he) || Y(""),
|
|
1283
1472
|
selectedPath: [],
|
|
1284
1473
|
childLevelNumber: Number.isFinite(Number(o.levelNumber)) ? Number(o.levelNumber) + 1 : 2
|
|
1285
|
-
}),
|
|
1286
|
-
}, [
|
|
1287
|
-
|
|
1288
|
-
if (!
|
|
1289
|
-
x !== null &&
|
|
1474
|
+
}), w({ type: "node", path: p }), !0;
|
|
1475
|
+
}, [g]);
|
|
1476
|
+
Ee(() => {
|
|
1477
|
+
if (!g) {
|
|
1478
|
+
x !== null && w(null);
|
|
1290
1479
|
return;
|
|
1291
1480
|
}
|
|
1292
1481
|
if (x) {
|
|
1293
1482
|
if (x.type === "node") {
|
|
1294
|
-
|
|
1483
|
+
ae(g, x.path) || w({ type: "node", path: [] });
|
|
1295
1484
|
return;
|
|
1296
1485
|
}
|
|
1297
|
-
|
|
1486
|
+
Be(g, x.nodePath, x.branchIndex) || w({ type: "node", path: x.nodePath });
|
|
1298
1487
|
}
|
|
1299
|
-
}, [
|
|
1488
|
+
}, [g, x]);
|
|
1300
1489
|
const ge = B(() => {
|
|
1301
|
-
const o =
|
|
1490
|
+
const o = xe.current;
|
|
1302
1491
|
!o || typeof o.scrollIntoView != "function" || window.requestAnimationFrame(() => {
|
|
1303
1492
|
o.scrollIntoView({ block: "start", behavior: "smooth" });
|
|
1304
1493
|
});
|
|
1305
1494
|
}, []);
|
|
1306
|
-
|
|
1307
|
-
if (
|
|
1308
|
-
if (
|
|
1309
|
-
|
|
1495
|
+
Ee(() => {
|
|
1496
|
+
if (h && je.current !== h) {
|
|
1497
|
+
if (je.current = h, se.current = !0, h.type === "rowPath") {
|
|
1498
|
+
Me(h) || (se.current = !1);
|
|
1310
1499
|
return;
|
|
1311
1500
|
}
|
|
1312
|
-
if (Z(
|
|
1313
|
-
|
|
1501
|
+
if (Z(h) === Z(x)) {
|
|
1502
|
+
se.current = !1, ge();
|
|
1314
1503
|
return;
|
|
1315
1504
|
}
|
|
1316
|
-
|
|
1505
|
+
w(h);
|
|
1317
1506
|
}
|
|
1318
|
-
}, [
|
|
1319
|
-
|
|
1507
|
+
}, [Me, h, ge, x]), Ee(() => {
|
|
1508
|
+
se.current && (se.current = !1, ge());
|
|
1320
1509
|
}, [ge, x]);
|
|
1321
|
-
const
|
|
1322
|
-
$(
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
$(
|
|
1510
|
+
const He = B((o, p) => {
|
|
1511
|
+
$(
|
|
1512
|
+
/** @param {any} [prevRoot] @returns {any} */
|
|
1513
|
+
(S) => _(S, o, () => p)
|
|
1514
|
+
);
|
|
1515
|
+
}, [$]), Ve = B((o, p, S) => {
|
|
1516
|
+
$(
|
|
1517
|
+
/** @param {any} [prevRoot] @returns {any} */
|
|
1518
|
+
(k) => me(k, o, p, () => S)
|
|
1519
|
+
);
|
|
1520
|
+
}, [$]), dt = B((o) => {
|
|
1521
|
+
const p = Y(o);
|
|
1522
|
+
$(p), A(null), w({ type: "node", path: [] });
|
|
1328
1523
|
}, [$]);
|
|
1329
1524
|
B((o, p) => {
|
|
1330
|
-
p || $(
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1525
|
+
p || $(
|
|
1526
|
+
/** @param {any} [prevRoot] @returns {any} */
|
|
1527
|
+
(S) => _(
|
|
1528
|
+
S,
|
|
1529
|
+
o,
|
|
1530
|
+
/** @param {any} [node] @returns {any} */
|
|
1531
|
+
(k) => ({
|
|
1532
|
+
...k,
|
|
1533
|
+
defaultChild: Y("")
|
|
1534
|
+
})
|
|
1535
|
+
)
|
|
1536
|
+
), w({ type: "node", path: [...o, T] });
|
|
1334
1537
|
}, [$]), B((o) => {
|
|
1335
|
-
$(
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1538
|
+
$(
|
|
1539
|
+
/** @param {any} [prevRoot] @returns {any} */
|
|
1540
|
+
(p) => _(
|
|
1541
|
+
p,
|
|
1542
|
+
o,
|
|
1543
|
+
/** @param {any} [node] @returns {any} */
|
|
1544
|
+
(S) => ({
|
|
1545
|
+
...S,
|
|
1546
|
+
defaultChild: null
|
|
1547
|
+
})
|
|
1548
|
+
)
|
|
1549
|
+
), w({ type: "node", path: o });
|
|
1339
1550
|
}, [$]);
|
|
1340
|
-
const
|
|
1341
|
-
S || $(
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1551
|
+
const pt = B((o, p, S) => {
|
|
1552
|
+
S || $(
|
|
1553
|
+
/** @param {any} [prevRoot] @returns {any} */
|
|
1554
|
+
(k) => me(
|
|
1555
|
+
k,
|
|
1556
|
+
o,
|
|
1557
|
+
p,
|
|
1558
|
+
/** @param {any} [branch] @returns {any} */
|
|
1559
|
+
(P) => ({
|
|
1560
|
+
...P,
|
|
1561
|
+
child: Y(O[0] || "")
|
|
1562
|
+
})
|
|
1563
|
+
)
|
|
1564
|
+
), w({ type: "node", path: [...o, _e(p)] });
|
|
1565
|
+
}, [O, $]), ut = B((o, p) => {
|
|
1566
|
+
$(
|
|
1567
|
+
/** @param {any} [prevRoot] @returns {any} */
|
|
1568
|
+
(S) => me(
|
|
1569
|
+
S,
|
|
1570
|
+
o,
|
|
1571
|
+
p,
|
|
1572
|
+
/** @param {any} [branch] @returns {any} */
|
|
1573
|
+
(k) => ({
|
|
1574
|
+
...k,
|
|
1575
|
+
child: null
|
|
1576
|
+
})
|
|
1577
|
+
)
|
|
1578
|
+
), w({ type: "branch", nodePath: o, branchIndex: p });
|
|
1579
|
+
}, [$]), ft = B((o) => {
|
|
1351
1580
|
if (o.length === 0) {
|
|
1352
|
-
$(null),
|
|
1581
|
+
$(null), A(null), w(null);
|
|
1353
1582
|
return;
|
|
1354
1583
|
}
|
|
1355
1584
|
const p = o.slice(0, -1), S = o[o.length - 1];
|
|
1356
1585
|
if (S === T) {
|
|
1357
|
-
$(
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1586
|
+
$(
|
|
1587
|
+
/** @param {any} [prevRoot] @returns {any} */
|
|
1588
|
+
(P) => _(
|
|
1589
|
+
P,
|
|
1590
|
+
p,
|
|
1591
|
+
/** @param {any} [node] @returns {any} */
|
|
1592
|
+
(z) => ({
|
|
1593
|
+
...z,
|
|
1594
|
+
defaultChild: null
|
|
1595
|
+
})
|
|
1596
|
+
)
|
|
1597
|
+
), w({ type: "node", path: p });
|
|
1361
1598
|
return;
|
|
1362
1599
|
}
|
|
1363
|
-
const
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1600
|
+
const k = Ce(S);
|
|
1601
|
+
k >= 0 && ($(
|
|
1602
|
+
/** @param {any} [prevRoot] @returns {any} */
|
|
1603
|
+
(P) => me(
|
|
1604
|
+
P,
|
|
1605
|
+
p,
|
|
1606
|
+
k,
|
|
1607
|
+
/** @param {any} [branch] @returns {any} */
|
|
1608
|
+
(z) => ({
|
|
1609
|
+
...z,
|
|
1610
|
+
child: null
|
|
1611
|
+
})
|
|
1612
|
+
)
|
|
1613
|
+
), w({ type: "branch", nodePath: p, branchIndex: k }));
|
|
1614
|
+
}, [$]), yt = B((o, p) => {
|
|
1615
|
+
$(
|
|
1616
|
+
/** @param {any} [prevRoot] @returns {any} */
|
|
1617
|
+
(S) => _(
|
|
1618
|
+
S,
|
|
1619
|
+
o,
|
|
1620
|
+
/** @param {any} [node] @returns {any} */
|
|
1621
|
+
(k) => ({
|
|
1622
|
+
...k,
|
|
1623
|
+
branches: k.branches.filter(
|
|
1624
|
+
/** @param {any} [_] @param {any} [index] @returns {any} */
|
|
1625
|
+
(P, z) => z !== p
|
|
1626
|
+
)
|
|
1627
|
+
})
|
|
1628
|
+
)
|
|
1629
|
+
), w({ type: "node", path: o });
|
|
1630
|
+
}, [$]), xt = B((o) => {
|
|
1631
|
+
A(null), w({ type: "node", path: o });
|
|
1632
|
+
}, []), qe = B((o) => {
|
|
1376
1633
|
if (o) {
|
|
1377
|
-
if (
|
|
1378
|
-
|
|
1634
|
+
if (A(null), o.kind === "branch") {
|
|
1635
|
+
w({ type: "branch", nodePath: o.nodePath, branchIndex: o.branchIndex });
|
|
1379
1636
|
return;
|
|
1380
1637
|
}
|
|
1381
|
-
|
|
1638
|
+
w({ type: "node", path: o.nodePath });
|
|
1382
1639
|
}
|
|
1383
|
-
}, []),
|
|
1384
|
-
if (!
|
|
1640
|
+
}, []), bt = B(() => {
|
|
1641
|
+
if (!g || !I.length) return;
|
|
1385
1642
|
const o = I[I.length - 1];
|
|
1386
1643
|
if (!o || !o.node || !o.node.field) return;
|
|
1387
1644
|
const p = [...o.path, T];
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1645
|
+
A(null), $(
|
|
1646
|
+
/** @param {any} [prevRoot] @returns {any} */
|
|
1647
|
+
(S) => _(
|
|
1648
|
+
S,
|
|
1649
|
+
o.path,
|
|
1650
|
+
/** @param {any} [node] @returns {any} */
|
|
1651
|
+
(k) => ({
|
|
1652
|
+
...k,
|
|
1653
|
+
defaultChild: k.defaultChild || Y("")
|
|
1654
|
+
})
|
|
1655
|
+
)
|
|
1656
|
+
), w({ type: "node", path: p });
|
|
1657
|
+
}, [I, g, $]), gt = B((o, p) => {
|
|
1658
|
+
o === null || o === p || ($(
|
|
1659
|
+
/** @param {any} [prevRoot] @returns {any} */
|
|
1660
|
+
(S) => nt(S, o, p)
|
|
1661
|
+
), w({ type: "node", path: Ie(p) }), Te(null));
|
|
1662
|
+
}, [$]), ht = B(() => {
|
|
1663
|
+
A(null), w(null);
|
|
1664
|
+
}, []), vt = B(() => {
|
|
1665
|
+
if (!J.valid) {
|
|
1666
|
+
c && c(J.errors[0] || "Fix report validation errors before applying.", "error");
|
|
1399
1667
|
return;
|
|
1400
1668
|
}
|
|
1401
|
-
|
|
1402
|
-
}, [
|
|
1669
|
+
w(null);
|
|
1670
|
+
}, [J, c]), mt = B(() => {
|
|
1403
1671
|
if (!d || !d.request) return;
|
|
1404
|
-
const o = d.request, p = Array.isArray(d.nodePath) ? d.nodePath : [], S =
|
|
1672
|
+
const o = d.request, p = Array.isArray(d.nodePath) ? d.nodePath : [], S = Tt(d.child), k = {
|
|
1405
1673
|
..._t(o.field, o.value, d.title || d.rowLabel, ""),
|
|
1406
1674
|
label: Q(d.title || d.rowLabel || o.value),
|
|
1407
1675
|
sourceRowPath: Array.isArray(o.pathValues) ? o.pathValues.map(String).filter(Boolean) : [],
|
|
1408
1676
|
sourcePathFields: Array.isArray(o.pathFields) ? o.pathFields.map(String).filter(Boolean) : [],
|
|
1409
1677
|
child: S
|
|
1410
|
-
}, P = (
|
|
1411
|
-
const
|
|
1678
|
+
}, P = (G) => {
|
|
1679
|
+
const de = Array.isArray(G.branches) ? G.branches : [], Je = de.findIndex(
|
|
1680
|
+
/** @param {any} [branch] @returns {any} */
|
|
1681
|
+
(ve) => Xe(ve, o.field, o.value)
|
|
1682
|
+
);
|
|
1412
1683
|
return Je >= 0 ? {
|
|
1413
|
-
...
|
|
1414
|
-
branches:
|
|
1684
|
+
...G,
|
|
1685
|
+
branches: de.map(
|
|
1686
|
+
/** @param {any} [branch] @param {any} [index] @returns {any} */
|
|
1687
|
+
(ve, Et) => Et === Je ? { ...k, _id: ve._id || k._id } : ve
|
|
1688
|
+
)
|
|
1415
1689
|
} : {
|
|
1416
|
-
...
|
|
1417
|
-
branches: [...
|
|
1690
|
+
...G,
|
|
1691
|
+
branches: [...de, k]
|
|
1418
1692
|
};
|
|
1419
|
-
},
|
|
1420
|
-
if (!
|
|
1421
|
-
c && c(
|
|
1693
|
+
}, z = _(g, p, P), he = Ze(z, { allFields: O, valConfigs: s, data: i });
|
|
1694
|
+
if (!he.valid) {
|
|
1695
|
+
c && c(he.errors[0] || "Fix report validation errors before applying.", "error");
|
|
1422
1696
|
return;
|
|
1423
1697
|
}
|
|
1424
|
-
$(
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1698
|
+
$(
|
|
1699
|
+
/** @param {any} [prevRoot] @returns {any} */
|
|
1700
|
+
(G) => _(G, p, P)
|
|
1701
|
+
), A(null), w(null), c && c(`Applied settings for ${d.rowLabel || "row"}`, "info");
|
|
1702
|
+
}, [O, i, g, d, $, c, s]), Ke = B(() => {
|
|
1703
|
+
if (!g || !g.field) return;
|
|
1704
|
+
if (!J.valid) {
|
|
1705
|
+
c && c(J.errors[0] || "Fix report validation errors before saving.", "error");
|
|
1429
1706
|
return;
|
|
1430
1707
|
}
|
|
1431
1708
|
const o = `report-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 6)}`, p = D.trim() || `Report ${(F || []).length + 1}`;
|
|
@@ -1435,66 +1712,75 @@ function Ut({
|
|
|
1435
1712
|
id: o,
|
|
1436
1713
|
name: p,
|
|
1437
1714
|
reportDef: JSON.parse(JSON.stringify(e)),
|
|
1438
|
-
layout:
|
|
1715
|
+
layout: wt(f, s),
|
|
1439
1716
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1440
1717
|
}
|
|
1441
|
-
]),
|
|
1442
|
-
}, [f, s, e, D,
|
|
1443
|
-
return /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "18px", padding: "2px 0 8px" } }, (F || []).length > 0 && /* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: L(r) }, /* @__PURE__ */ t.createElement(
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
onClick: () => {
|
|
1448
|
-
Ct(o, { setReportDef: l, setActiveReportId: w, setColFields: m, setValConfigs: g }), k(null), C({ type: "node", path: [] });
|
|
1449
|
-
},
|
|
1450
|
-
style: {
|
|
1451
|
-
display: "flex",
|
|
1452
|
-
alignItems: "center",
|
|
1453
|
-
gap: "8px",
|
|
1454
|
-
padding: "8px 10px",
|
|
1455
|
-
borderRadius: "10px",
|
|
1456
|
-
cursor: "pointer",
|
|
1457
|
-
background: o.id === y ? r.select || `${r.primary || "#2563EB"}14` : r.hover || "#F9FAFB",
|
|
1458
|
-
border: `1px solid ${o.id === y ? r.primary || "#2563EB" : r.border}`
|
|
1459
|
-
}
|
|
1460
|
-
},
|
|
1461
|
-
/* @__PURE__ */ t.createElement(v.Report, null),
|
|
1462
|
-
/* @__PURE__ */ t.createElement("div", { style: { flex: 1, minWidth: 0, fontSize: "12px", fontWeight: 700, color: r.text, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, o.name),
|
|
1463
|
-
/* @__PURE__ */ t.createElement(
|
|
1464
|
-
"button",
|
|
1718
|
+
]), C(o), R(""), c && c(`Report "${p}" saved`, "info");
|
|
1719
|
+
}, [f, s, e, D, J, g, F, C, N, c]);
|
|
1720
|
+
return /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "18px", padding: "2px 0 8px" } }, (F || []).length > 0 && /* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: L(r) }, /* @__PURE__ */ t.createElement(m.Save, null), " Saved Reports"), /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "6px" } }, (F || []).map(
|
|
1721
|
+
/** @param {any} [report] @returns {any} */
|
|
1722
|
+
(o) => /* @__PURE__ */ t.createElement(
|
|
1723
|
+
"div",
|
|
1465
1724
|
{
|
|
1466
|
-
|
|
1467
|
-
onClick: (
|
|
1468
|
-
|
|
1725
|
+
key: o.id,
|
|
1726
|
+
onClick: () => {
|
|
1727
|
+
Ct(o, { setReportDef: l, setActiveReportId: C, setColFields: E, setValConfigs: b }), A(null), w({ type: "node", path: [] });
|
|
1469
1728
|
},
|
|
1470
|
-
style: {
|
|
1729
|
+
style: {
|
|
1730
|
+
display: "flex",
|
|
1731
|
+
alignItems: "center",
|
|
1732
|
+
gap: "8px",
|
|
1733
|
+
padding: "8px 10px",
|
|
1734
|
+
borderRadius: "10px",
|
|
1735
|
+
cursor: "pointer",
|
|
1736
|
+
background: o.id === y ? r.select || `${r.primary || "#2563EB"}14` : r.hover || "#F9FAFB",
|
|
1737
|
+
border: `1px solid ${o.id === y ? r.primary || "#2563EB" : r.border}`
|
|
1738
|
+
}
|
|
1471
1739
|
},
|
|
1472
|
-
/* @__PURE__ */ t.createElement(
|
|
1740
|
+
/* @__PURE__ */ t.createElement(m.Report, null),
|
|
1741
|
+
/* @__PURE__ */ t.createElement("div", { style: { flex: 1, minWidth: 0, fontSize: "12px", fontWeight: 700, color: r.text, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, o.name),
|
|
1742
|
+
/* @__PURE__ */ t.createElement(
|
|
1743
|
+
"button",
|
|
1744
|
+
{
|
|
1745
|
+
type: "button",
|
|
1746
|
+
onClick: (p) => {
|
|
1747
|
+
p.stopPropagation(), N(
|
|
1748
|
+
/** @param {any} [prev] @returns {any} */
|
|
1749
|
+
(S) => (S || []).filter(
|
|
1750
|
+
/** @param {any} [current] @returns {any} */
|
|
1751
|
+
(k) => k.id !== o.id
|
|
1752
|
+
)
|
|
1753
|
+
), y === o.id && C(null);
|
|
1754
|
+
},
|
|
1755
|
+
style: { background: "none", border: "none", cursor: "pointer", color: "#B91C1C", padding: "2px", flexShrink: 0 }
|
|
1756
|
+
},
|
|
1757
|
+
/* @__PURE__ */ t.createElement(m.Delete, null)
|
|
1758
|
+
)
|
|
1473
1759
|
)
|
|
1474
|
-
)))
|
|
1475
|
-
|
|
1760
|
+
))), /* @__PURE__ */ t.createElement(
|
|
1761
|
+
ne,
|
|
1476
1762
|
{
|
|
1477
1763
|
theme: r,
|
|
1478
1764
|
sectionId: "report-levels",
|
|
1479
1765
|
title: "Report Levels",
|
|
1480
1766
|
description: "Default hierarchy applied to every row unless a row override changes its children.",
|
|
1481
|
-
icon: /* @__PURE__ */ t.createElement(
|
|
1482
|
-
action:
|
|
1767
|
+
icon: /* @__PURE__ */ t.createElement(m.ReportLevel, null),
|
|
1768
|
+
action: g && /* @__PURE__ */ t.createElement("div", { style: { display: "flex", gap: "8px", flexWrap: "wrap", justifyContent: "flex-end" } }, typeof u == "function" && /* @__PURE__ */ t.createElement(
|
|
1483
1769
|
"button",
|
|
1484
1770
|
{
|
|
1485
1771
|
type: "button",
|
|
1486
1772
|
onClick: () => u((o) => o === !1),
|
|
1487
|
-
style: j(r,
|
|
1488
|
-
title:
|
|
1773
|
+
style: j(r, v !== !1, !1),
|
|
1774
|
+
title: v !== !1 ? "Hide row gear column" : "Show row gear column"
|
|
1489
1775
|
},
|
|
1490
|
-
/* @__PURE__ */ t.createElement(
|
|
1776
|
+
/* @__PURE__ */ t.createElement(m.Settings, null),
|
|
1491
1777
|
" ",
|
|
1492
|
-
|
|
1778
|
+
v !== !1 ? "Hide row gears" : "Show row gears"
|
|
1493
1779
|
), /* @__PURE__ */ t.createElement(
|
|
1494
1780
|
"button",
|
|
1495
1781
|
{
|
|
1496
1782
|
type: "button",
|
|
1497
|
-
onClick:
|
|
1783
|
+
onClick: bt,
|
|
1498
1784
|
disabled: !I.length || !I[I.length - 1].node.field,
|
|
1499
1785
|
style: {
|
|
1500
1786
|
...j(r, !1, !1),
|
|
@@ -1502,160 +1788,189 @@ function Ut({
|
|
|
1502
1788
|
pointerEvents: !I.length || !I[I.length - 1].node.field ? "none" : "auto"
|
|
1503
1789
|
}
|
|
1504
1790
|
},
|
|
1505
|
-
/* @__PURE__ */ t.createElement(
|
|
1791
|
+
/* @__PURE__ */ t.createElement(m.Add, null),
|
|
1506
1792
|
" Add next level"
|
|
1507
1793
|
))
|
|
1508
1794
|
},
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1795
|
+
g ? /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "8px" } }, I.map(
|
|
1796
|
+
/** @param {any} [item] @returns {any} */
|
|
1797
|
+
(o) => /* @__PURE__ */ t.createElement(
|
|
1798
|
+
st,
|
|
1799
|
+
{
|
|
1800
|
+
key: `default-level:${o.index}:${o.node._id}`,
|
|
1801
|
+
item: o,
|
|
1802
|
+
selected: !d && Z(x) === Z({ type: "node", path: o.path }),
|
|
1803
|
+
theme: r,
|
|
1804
|
+
sortByOptions: be,
|
|
1805
|
+
getFieldLabel: ee,
|
|
1806
|
+
onSelect: () => xt(o.path),
|
|
1807
|
+
onDragStart: (
|
|
1808
|
+
/** @param {any} [event] @returns {any} */
|
|
1809
|
+
((p) => {
|
|
1810
|
+
Te(o.index), p.dataTransfer.effectAllowed = "move";
|
|
1811
|
+
})
|
|
1812
|
+
),
|
|
1813
|
+
onDragOver: (
|
|
1814
|
+
/** @param {any} [event] @returns {any} */
|
|
1815
|
+
((p) => p.preventDefault())
|
|
1816
|
+
),
|
|
1817
|
+
onDrop: (
|
|
1818
|
+
/** @param {any} [event] @returns {any} */
|
|
1819
|
+
((p) => {
|
|
1820
|
+
p.preventDefault(), gt(ct, o.index);
|
|
1821
|
+
})
|
|
1822
|
+
)
|
|
1525
1823
|
}
|
|
1526
|
-
|
|
1527
|
-
))
|
|
1528
|
-
|
|
1824
|
+
)
|
|
1825
|
+
)) : /* @__PURE__ */ t.createElement("div", { style: ue(r) }, /* @__PURE__ */ t.createElement("div", { style: { fontSize: "14px", fontWeight: 800, color: r.text } }, "Level 1"), /* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: L(r) }, "Break Down By"), /* @__PURE__ */ t.createElement(
|
|
1826
|
+
U,
|
|
1529
1827
|
{
|
|
1828
|
+
size: "sm",
|
|
1829
|
+
"aria-label": "Level 1 field",
|
|
1530
1830
|
value: "",
|
|
1531
1831
|
onChange: (o) => {
|
|
1532
|
-
o.target.value &&
|
|
1832
|
+
o.target.value && dt(o.target.value);
|
|
1533
1833
|
},
|
|
1534
|
-
style: q(r)
|
|
1834
|
+
style: { ...q(r), width: "100%" }
|
|
1535
1835
|
},
|
|
1536
1836
|
/* @__PURE__ */ t.createElement("option", { value: "" }, "Select field..."),
|
|
1537
|
-
|
|
1837
|
+
O.map(
|
|
1838
|
+
/** @param {any} [field] @returns {any} */
|
|
1839
|
+
(o) => /* @__PURE__ */ t.createElement("option", { key: o, value: o }, ee(o))
|
|
1840
|
+
)
|
|
1538
1841
|
)))
|
|
1539
|
-
),
|
|
1540
|
-
|
|
1842
|
+
), g && /* @__PURE__ */ t.createElement(
|
|
1843
|
+
ne,
|
|
1541
1844
|
{
|
|
1542
1845
|
theme: r,
|
|
1543
1846
|
sectionId: "report-outline",
|
|
1544
1847
|
title: "Report Outline",
|
|
1545
1848
|
description: "Default levels plus every row override, shown as a separate map of Default children.",
|
|
1546
|
-
icon: /* @__PURE__ */ t.createElement(
|
|
1849
|
+
icon: /* @__PURE__ */ t.createElement(m.Report, null)
|
|
1547
1850
|
},
|
|
1548
|
-
/* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "8px" } },
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1851
|
+
/* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "8px" } }, te.map(
|
|
1852
|
+
/** @param {any} [item] @returns {any} */
|
|
1853
|
+
(o) => o.kind === "branch" ? /* @__PURE__ */ t.createElement(
|
|
1854
|
+
Gt,
|
|
1855
|
+
{
|
|
1856
|
+
key: `outline-branch:${re(o.nodePath)}:${o.branchIndex}:${o.branch._id}`,
|
|
1857
|
+
item: o,
|
|
1858
|
+
selected: !d && Z(x) === Z({
|
|
1859
|
+
type: "branch",
|
|
1860
|
+
nodePath: o.nodePath,
|
|
1861
|
+
branchIndex: o.branchIndex
|
|
1862
|
+
}),
|
|
1863
|
+
theme: r,
|
|
1864
|
+
onSelect: () => qe(o)
|
|
1865
|
+
}
|
|
1866
|
+
) : /* @__PURE__ */ t.createElement(
|
|
1867
|
+
Jt,
|
|
1868
|
+
{
|
|
1869
|
+
key: `outline-node:${re(o.nodePath)}:${o.node._id}`,
|
|
1870
|
+
item: o,
|
|
1871
|
+
selected: !d && Z(x) === Z({ type: "node", path: o.nodePath }),
|
|
1872
|
+
theme: r,
|
|
1873
|
+
sortByOptions: be,
|
|
1874
|
+
getFieldLabel: ee,
|
|
1875
|
+
onSelect: () => qe(o)
|
|
1876
|
+
}
|
|
1877
|
+
)
|
|
1878
|
+
))
|
|
1879
|
+
), g && d && /* @__PURE__ */ t.createElement("div", { ref: xe }, /* @__PURE__ */ t.createElement(
|
|
1880
|
+
ne,
|
|
1575
1881
|
{
|
|
1576
1882
|
theme: r,
|
|
1577
1883
|
sectionId: "selected-row",
|
|
1578
1884
|
title: "Selected Row",
|
|
1579
1885
|
description: "Configure Custom children for the row gear you clicked.",
|
|
1580
|
-
icon: /* @__PURE__ */ t.createElement(
|
|
1886
|
+
icon: /* @__PURE__ */ t.createElement(m.Settings, null)
|
|
1581
1887
|
},
|
|
1582
1888
|
/* @__PURE__ */ t.createElement(
|
|
1583
|
-
|
|
1889
|
+
Zt,
|
|
1584
1890
|
{
|
|
1585
1891
|
draft: d,
|
|
1586
|
-
allFields:
|
|
1587
|
-
getFieldLabel:
|
|
1588
|
-
sortByOptions:
|
|
1892
|
+
allFields: O,
|
|
1893
|
+
getFieldLabel: ee,
|
|
1894
|
+
sortByOptions: be,
|
|
1589
1895
|
theme: r,
|
|
1590
|
-
onChange:
|
|
1591
|
-
onApply:
|
|
1592
|
-
onCancel:
|
|
1896
|
+
onChange: A,
|
|
1897
|
+
onApply: mt,
|
|
1898
|
+
onCancel: ht
|
|
1593
1899
|
}
|
|
1594
1900
|
)
|
|
1595
|
-
)),
|
|
1596
|
-
|
|
1901
|
+
)), g && !d && x && le && le.type === "node" && /* @__PURE__ */ t.createElement("div", { ref: xe }, /* @__PURE__ */ t.createElement(
|
|
1902
|
+
ne,
|
|
1597
1903
|
{
|
|
1598
1904
|
theme: r,
|
|
1599
1905
|
sectionId: "selected-level",
|
|
1600
1906
|
title: "Selected Level",
|
|
1601
1907
|
description: "Edit the selected default level or override child level.",
|
|
1602
|
-
icon: /* @__PURE__ */ t.createElement(
|
|
1908
|
+
icon: /* @__PURE__ */ t.createElement(m.Edit, null)
|
|
1603
1909
|
},
|
|
1604
1910
|
/* @__PURE__ */ t.createElement(
|
|
1605
1911
|
Yt,
|
|
1606
1912
|
{
|
|
1607
|
-
item: I.find(
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1913
|
+
item: I.find(
|
|
1914
|
+
/** @param {any} [item] @returns {any} */
|
|
1915
|
+
(o) => Ae(o.path, x.path)
|
|
1916
|
+
) || (ce ? { ...ce, path: ce.nodePath } : { path: x.path, levelNumber: x.path.length + 1 }),
|
|
1917
|
+
node: le.node,
|
|
1918
|
+
allFields: O,
|
|
1919
|
+
getFieldLabel: ee,
|
|
1920
|
+
sortByOptions: be,
|
|
1612
1921
|
theme: r,
|
|
1613
|
-
onUpdate: (
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1922
|
+
onUpdate: (
|
|
1923
|
+
/** @param {any} [nextNode] @returns {any} */
|
|
1924
|
+
((o) => He(x.path, o))
|
|
1925
|
+
),
|
|
1926
|
+
onApply: vt,
|
|
1927
|
+
onRemove: () => ft(x.path),
|
|
1928
|
+
onEditFilter: () => ye(x.path),
|
|
1617
1929
|
titleLabel: "Title"
|
|
1618
1930
|
}
|
|
1619
1931
|
)
|
|
1620
|
-
)),
|
|
1621
|
-
|
|
1932
|
+
)), g && !d && x && le && le.type === "branch" && ce && /* @__PURE__ */ t.createElement("div", { ref: xe }, /* @__PURE__ */ t.createElement(
|
|
1933
|
+
ne,
|
|
1622
1934
|
{
|
|
1623
1935
|
theme: r,
|
|
1624
1936
|
sectionId: "row-override",
|
|
1625
1937
|
title: "Row Override",
|
|
1626
1938
|
description: "Override applies to this row only. Configure its rule and Custom children.",
|
|
1627
|
-
icon: /* @__PURE__ */ t.createElement(
|
|
1939
|
+
icon: /* @__PURE__ */ t.createElement(m.Settings, null)
|
|
1628
1940
|
},
|
|
1629
1941
|
/* @__PURE__ */ t.createElement(
|
|
1630
|
-
|
|
1942
|
+
Xt,
|
|
1631
1943
|
{
|
|
1632
|
-
item:
|
|
1633
|
-
branch:
|
|
1944
|
+
item: ce,
|
|
1945
|
+
branch: le.branch,
|
|
1634
1946
|
theme: r,
|
|
1635
|
-
onUpdate: (
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1947
|
+
onUpdate: (
|
|
1948
|
+
/** @param {any} [nextBranch] @returns {any} */
|
|
1949
|
+
((o) => Ve(x.nodePath, x.branchIndex, o))
|
|
1950
|
+
),
|
|
1951
|
+
onEditCondition: () => fe({ nodePath: x.nodePath, branchIndex: x.branchIndex }),
|
|
1952
|
+
onOpenCustomChildren: () => pt(x.nodePath, x.branchIndex, !!le.branch.child),
|
|
1953
|
+
onRemoveCustomChildren: () => ut(x.nodePath, x.branchIndex),
|
|
1954
|
+
onRemove: () => yt(x.nodePath, x.branchIndex)
|
|
1640
1955
|
}
|
|
1641
1956
|
)
|
|
1642
1957
|
)), /* @__PURE__ */ t.createElement(
|
|
1643
|
-
|
|
1958
|
+
ne,
|
|
1644
1959
|
{
|
|
1645
1960
|
theme: r,
|
|
1646
1961
|
sectionId: "save-report",
|
|
1647
1962
|
title: "Save Report",
|
|
1648
1963
|
description: "Store the current report levels and row overrides.",
|
|
1649
|
-
icon: /* @__PURE__ */ t.createElement(
|
|
1964
|
+
icon: /* @__PURE__ */ t.createElement(m.Save, null)
|
|
1650
1965
|
},
|
|
1651
|
-
/* @__PURE__ */ t.createElement(
|
|
1966
|
+
/* @__PURE__ */ t.createElement(qt, { validation: J, theme: r }),
|
|
1652
1967
|
/* @__PURE__ */ t.createElement("div", { style: { display: "flex", gap: "8px" } }, /* @__PURE__ */ t.createElement(
|
|
1653
1968
|
"input",
|
|
1654
1969
|
{
|
|
1655
1970
|
value: D,
|
|
1656
1971
|
onChange: (o) => R(o.target.value),
|
|
1657
1972
|
onKeyDown: (o) => {
|
|
1658
|
-
o.key === "Enter" &&
|
|
1973
|
+
o.key === "Enter" && Ke();
|
|
1659
1974
|
},
|
|
1660
1975
|
placeholder: "Report name...",
|
|
1661
1976
|
style: { ...q(r), flex: 1 }
|
|
@@ -1664,8 +1979,8 @@ function Ut({
|
|
|
1664
1979
|
"button",
|
|
1665
1980
|
{
|
|
1666
1981
|
type: "button",
|
|
1667
|
-
onClick:
|
|
1668
|
-
disabled: !
|
|
1982
|
+
onClick: Ke,
|
|
1983
|
+
disabled: !g || !g.field || !J.valid,
|
|
1669
1984
|
style: {
|
|
1670
1985
|
display: "inline-flex",
|
|
1671
1986
|
alignItems: "center",
|
|
@@ -1678,49 +1993,55 @@ function Ut({
|
|
|
1678
1993
|
fontWeight: 800,
|
|
1679
1994
|
color: "#fff",
|
|
1680
1995
|
cursor: "pointer",
|
|
1681
|
-
opacity: !
|
|
1996
|
+
opacity: !g || !g.field || !J.valid ? 0.5 : 1
|
|
1682
1997
|
}
|
|
1683
1998
|
},
|
|
1684
|
-
/* @__PURE__ */ t.createElement(
|
|
1999
|
+
/* @__PURE__ */ t.createElement(m.Save, null),
|
|
1685
2000
|
" Save"
|
|
1686
2001
|
))
|
|
1687
|
-
),
|
|
1688
|
-
|
|
2002
|
+
), K && $e && /* @__PURE__ */ t.createElement(
|
|
2003
|
+
Pe,
|
|
1689
2004
|
{
|
|
1690
|
-
condition:
|
|
1691
|
-
allFields:
|
|
1692
|
-
getFieldLabel:
|
|
2005
|
+
condition: $e.condition,
|
|
2006
|
+
allFields: O,
|
|
2007
|
+
getFieldLabel: ee,
|
|
1693
2008
|
theme: r,
|
|
1694
|
-
onSave: (
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
2009
|
+
onSave: (
|
|
2010
|
+
/** @param {any} [nextCondition] @returns {any} */
|
|
2011
|
+
((o) => {
|
|
2012
|
+
Ve(K.nodePath, K.branchIndex, {
|
|
2013
|
+
...$e,
|
|
2014
|
+
condition: o
|
|
2015
|
+
});
|
|
2016
|
+
})
|
|
2017
|
+
),
|
|
2018
|
+
onClose: () => fe(null)
|
|
1701
2019
|
}
|
|
1702
|
-
),
|
|
1703
|
-
const o =
|
|
2020
|
+
), ie && (() => {
|
|
2021
|
+
const o = ae(g, ie);
|
|
1704
2022
|
return o ? /* @__PURE__ */ t.createElement(
|
|
1705
|
-
|
|
2023
|
+
Pe,
|
|
1706
2024
|
{
|
|
1707
2025
|
title: "Edit level filter",
|
|
1708
2026
|
description: "Rows that don't match are grouped into 'Others' to keep totals intact. Applies to this level and all its children.",
|
|
1709
|
-
condition: o.filters ||
|
|
1710
|
-
allFields:
|
|
1711
|
-
getFieldLabel:
|
|
2027
|
+
condition: o.filters || Le(),
|
|
2028
|
+
allFields: O,
|
|
2029
|
+
getFieldLabel: ee,
|
|
1712
2030
|
theme: r,
|
|
1713
|
-
onSave: (
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
2031
|
+
onSave: (
|
|
2032
|
+
/** @param {any} [nextCondition] @returns {any} */
|
|
2033
|
+
((p) => {
|
|
2034
|
+
He(ie, {
|
|
2035
|
+
...o,
|
|
2036
|
+
filters: p.clauses.length > 0 ? p : null
|
|
2037
|
+
});
|
|
2038
|
+
})
|
|
2039
|
+
),
|
|
2040
|
+
onClose: () => ye(null)
|
|
1720
2041
|
}
|
|
1721
2042
|
) : null;
|
|
1722
2043
|
})());
|
|
1723
2044
|
}
|
|
1724
2045
|
export {
|
|
1725
|
-
|
|
2046
|
+
el as ReportEditor
|
|
1726
2047
|
};
|