serverside_pivot 0.0.90 → 0.0.95
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 -165
- package/dist/react/chunks/{ContextMenu-Bt5_3bmD.mjs → ContextMenu-1G-o1ms9.mjs} +52 -49
- package/dist/react/chunks/{DetailDrawer-DtsvdhO4.mjs → DetailDrawer-DCKIxSpW.mjs} +1 -1
- package/dist/react/chunks/{DetailSidePanel-v_7iU73g.mjs → DetailSidePanel-DgUWPBQk.mjs} +1 -1
- package/dist/react/chunks/{DetailSurfaceContent-BOXVc58A.mjs → DetailSurfaceContent-BEL6xuaZ.mjs} +46 -37
- package/dist/react/chunks/{ECharts2dRenderer-BGL_NVGU.mjs → ECharts2dRenderer-Dgkp9_1P.mjs} +412 -410
- package/dist/react/chunks/{ECharts3dRenderer-BF2YWlsP.mjs → ECharts3dRenderer-70VOp8V0.mjs} +2211 -3197
- package/dist/react/chunks/{EditSidePanel-CuvtsKTK.mjs → EditSidePanel-CygqVXLX.mjs} +77 -65
- package/dist/react/chunks/{InlineDetailPanel-Bmtlu3lc.mjs → InlineDetailPanel-BUBRWdFW.mjs} +1 -1
- package/dist/react/chunks/{PivotCharts-CA3_0bB8.mjs → PivotCharts-VX5-mEEp.mjs} +2206 -1396
- package/dist/react/chunks/{ReportEditor-DYBr0HDz.mjs → ReportEditor-B5j-CU9-.mjs} +614 -319
- package/dist/react/chunks/{SidebarPanel-B64bhrUW.mjs → SidebarPanel-LXUE6nPd.mjs} +1793 -1390
- package/dist/react/chunks/{SparklineDetailGraph-90WjWkhg.mjs → SparklineDetailGraph-Cfe2KcOp.mjs} +88 -58
- package/dist/react/chunks/installCanvasRenderer-C4h5pc1p.mjs +21174 -0
- package/dist/react/chunks/react-CDa-ADnG.mjs +31199 -0
- package/dist/react/chunks/{xlsx.mini.min-BwwnBtoK.mjs → xlsx.mini.min-CzdkdH3N.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 +43 -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/PivotWorkspace.d.ts +1 -1
- 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/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/contexts/PivotConfigContext.d.ts +5 -33
- package/dist/react/contexts/PivotThemeContext.d.ts +7 -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 -451
- 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 +20 -6
- 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 -0
- package/dist/react/runtime/PivotRuntimeRoot.d.ts +1 -1
- package/dist/react/runtime/client/clientPivotTransport.d.ts +32 -0
- package/dist/react/runtime/client/clientResponsePostProcessor.d.ts +70 -0
- package/dist/react/runtime/client/clientSqlPlanner.d.ts +5 -0
- package/dist/react/runtime/client/duckdbWasmExecutor.d.ts +36 -0
- package/dist/react/runtime/client/index.d.ts +6 -0
- package/dist/react/runtime/client/modeResolver.d.ts +16 -0
- package/dist/react/runtime/client/types.d.ts +207 -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 +18 -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 -58
- 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 +3 -7
- package/dist/react/utils/domEvents.d.ts +1 -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 +16 -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 +3 -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 -89
- package/dist/react/chunks/installCanvasRenderer-C8gE9ttC.mjs +0 -21281
- package/dist/react/chunks/react-52jgz-em.mjs +0 -25301
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import t, { useState as H, useRef as ke, useMemo as z, useCallback as B, useEffect as $e } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { aa as Et, am as St, z as v, an as Ct, ac as wt, Z as M, ao as At } from "./react-CDa-ADnG.mjs";
|
|
3
3
|
const ae = () => `r${Date.now().toString(36)}${Math.random().toString(36).slice(2, 6)}`, Xe = [
|
|
4
4
|
{ value: "eq", label: "Equals" },
|
|
5
5
|
{ value: "not_eq", label: "Not equals" },
|
|
@@ -46,7 +46,7 @@ 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
|
-
},
|
|
49
|
+
}, Y = (e = "") => ({
|
|
50
50
|
_id: ae(),
|
|
51
51
|
field: e,
|
|
52
52
|
label: "",
|
|
@@ -104,29 +104,47 @@ const _e = (e) => `${Be}${e}`, Se = (e) => {
|
|
|
104
104
|
return Number.isFinite(l) ? l : -1;
|
|
105
105
|
}, Dt = (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" && !$t.has(a) && (!a.startsWith("_") || wt(a)) && !n.has(a)
|
|
108
118
|
);
|
|
109
|
-
return (e || []).filter((a) => a && typeof a == "string" && !$t.has(a) && (!a.startsWith("_") || wt(a)) && !n.has(a));
|
|
110
119
|
}, Rt = (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
|
+
}, Ce = (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 = kt[l.operator] || l.operator;
|
|
136
|
+
if (de.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} `), et = (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
|
}, tt = (e) => e ? e.label && e.label.trim() ? e.label.trim() : e.field ? M(e.field) : "Select field" : "Select field", Nt = (e) => !e || !e.field ? !1 : de.has(e.operator) ? Array.isArray(e.values) && e.values.length > 0 : e.value !== void 0 && e.value !== null && String(e.value).trim() !== "", Re = (e) => !!(e && Array.isArray(e.clauses) && e.clauses.length > 0) && e.clauses.every(Nt), Ke = (e, l) => {
|
|
132
150
|
if (!e || !l || typeof l != "object") return !1;
|
|
@@ -154,20 +172,38 @@ const _e = (e) => `${Be}${e}`, Se = (e) => {
|
|
|
154
172
|
default:
|
|
155
173
|
return a === r;
|
|
156
174
|
}
|
|
157
|
-
},
|
|
175
|
+
}, Ge = (e, l) => {
|
|
158
176
|
if (!Re(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(
|
|
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) => Ke(i, r)
|
|
189
|
+
) : e.clauses.every(
|
|
190
|
+
/** @param {any} [clause] @returns {any} */
|
|
191
|
+
(i) => Ke(i, r)
|
|
192
|
+
)
|
|
193
|
+
) : !0;
|
|
161
194
|
}, It = (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
|
+
}, Ye = (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 : []), m = /* @__PURE__ */ new Map(), g = Array.isArray(a) ? a : [], F = (y, w) => {
|
|
171
207
|
const c = y.trim().toLowerCase();
|
|
172
208
|
if (c) {
|
|
173
209
|
if (m.has(c)) {
|
|
@@ -184,10 +220,13 @@ const _e = (e) => `${Be}${e}`, Se = (e) => {
|
|
|
184
220
|
return;
|
|
185
221
|
}
|
|
186
222
|
const h = new Set(c);
|
|
187
|
-
h.add(E), y.field ? f.size > 0 && !f.has(y.field) && r.push(`Field "${M(y.field)}" at ${w} is no longer available.`) : r.push(`Missing field at ${w}.`), F(tt(y), w), y.topN && !s && r.push(`Top-N at ${w} needs at least one measure selected.`), y.filters && !Re(y.filters) ? r.push(`Level filter at ${w} has incomplete rules.`) : y.filters && !
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
223
|
+
h.add(E), y.field ? f.size > 0 && !f.has(y.field) && r.push(`Field "${M(y.field)}" at ${w} is no longer available.`) : r.push(`Missing field at ${w}.`), F(tt(y), w), y.topN && !s && r.push(`Top-N at ${w} needs at least one measure selected.`), y.filters && !Re(y.filters) ? r.push(`Level filter at ${w} has incomplete rules.`) : y.filters && !Ge(y.filters, g) && r.push(`Level filter at ${w} does not match any loaded rows.`), y.defaultChild && N(y.defaultChild, `${w} > Default children`, h), (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 = `${w} > ${R}`;
|
|
227
|
+
Re(u.condition) ? Ge(u.condition, g) || 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.`), It(u.sourceRowPath, g) || 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`, h), 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
|
}, Pt = (e) => !e || !e.branchBadge ? `Level ${e ? e.levelNumber : 1}` : e.branchDepth === 0 ? `Override children ${e.branchBadge}` : `Override child level ${e.branchBadge}.${e.branchDepth + 1}`, ne = (e, l) => {
|
|
@@ -219,14 +258,25 @@ const _e = (e) => `${Be}${e}`, Se = (e) => {
|
|
|
219
258
|
const f = Se(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
|
+
(m, g) => g === f ? { ...m, child: a(m.child, i + 1) } : m
|
|
264
|
+
)
|
|
223
265
|
});
|
|
224
266
|
};
|
|
225
267
|
return a(e, 0);
|
|
226
|
-
}, ve = (e, l, n, a) => e && O(
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
268
|
+
}, ve = (e, l, n, a) => e && O(
|
|
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 ? De(a(i)) : i
|
|
277
|
+
)
|
|
278
|
+
}
|
|
279
|
+
), Lt = (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,10 +321,19 @@ const _e = (e) => `${Be}${e}`, Se = (e) => {
|
|
|
268
321
|
branchBadge: null,
|
|
269
322
|
branchDepth: 0
|
|
270
323
|
}), l;
|
|
271
|
-
}, le = (e = []) => e.join(">"), we = (e = [], l = []) => le(e) === le(l), Q = (e) => e == null ? "" : String(e), Z = (e) => e ? e.type === "node" ? `node:${le(e.path)}` : e.type === "branch" ? `branch:${le(e.nodePath)}:${e.branchIndex}` : e.type === "rowPath" ? `rowPath:${le(e.nodePath)}:${e.field}:${Q(e.value)}` : "" : "", Ee = (e, l) => (e || []).find(
|
|
324
|
+
}, le = (e = []) => e.join(">"), we = (e = [], l = []) => le(e) === le(l), Q = (e) => e == null ? "" : String(e), Z = (e) => e ? e.type === "node" ? `node:${le(e.path)}` : e.type === "branch" ? `branch:${le(e.nodePath)}:${e.branchIndex}` : e.type === "rowPath" ? `rowPath:${le(e.nodePath)}:${e.field}:${Q(e.value)}` : "" : "", Ee = (e, l) => (e || []).find(
|
|
325
|
+
/** @param {any} [item] @returns {any} */
|
|
326
|
+
(n) => n.kind === "node" && we(n.nodePath, l)
|
|
327
|
+
) || null, lt = (e, l, n) => (e || []).find(
|
|
328
|
+
/** @param {any} [item] @returns {any} */
|
|
329
|
+
(a) => a.kind === "branch" && we(a.nodePath, l) && a.branchIndex === n
|
|
330
|
+
) || null, Ze = (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
|
...Ft(),
|
|
277
339
|
label: Q(n || l),
|
|
@@ -284,7 +346,7 @@ const _e = (e) => `${Be}${e}`, Se = (e) => {
|
|
|
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 {
|
|
@@ -313,7 +375,10 @@ const _e = (e) => `${Be}${e}`, Se = (e) => {
|
|
|
313
375
|
});
|
|
314
376
|
return l;
|
|
315
377
|
}, rt = (e, l, n) => {
|
|
316
|
-
const a = We(e).map(
|
|
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);
|
|
@@ -347,7 +412,13 @@ const _e = (e) => `${Be}${e}`, Se = (e) => {
|
|
|
347
412
|
if (l.type === "node") {
|
|
348
413
|
const a = [], r = Ee(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" && we(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
424
|
const n = Ee(e, [...l.nodePath, _e(l.branchIndex)]);
|
|
@@ -447,17 +518,32 @@ function re({
|
|
|
447
518
|
}
|
|
448
519
|
function Ie({ condition: e, allFields: l, getFieldLabel: n = M, onSave: a, onClose: r, theme: i, title: s, description: f }) {
|
|
449
520
|
const [m, g] = H(() => Le(e)), F = q(i), N = B(() => {
|
|
450
|
-
g(
|
|
521
|
+
g(
|
|
522
|
+
/** @param {any} [prev] @returns {any} */
|
|
523
|
+
(c) => ({ ...c, clauses: [...c.clauses, Ue(l[0] || "")] })
|
|
524
|
+
);
|
|
451
525
|
}, [l]), y = B((c, E) => {
|
|
452
|
-
g(
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
526
|
+
g(
|
|
527
|
+
/** @param {any} [prev] @returns {any} */
|
|
528
|
+
(h) => ({
|
|
529
|
+
...h,
|
|
530
|
+
clauses: h.clauses.map(
|
|
531
|
+
/** @param {any} [clause] @param {any} [clauseIndex] @returns {any} */
|
|
532
|
+
(u, D) => D === c ? { ...u, ...E } : u
|
|
533
|
+
)
|
|
534
|
+
})
|
|
535
|
+
);
|
|
456
536
|
}, []), w = B((c) => {
|
|
457
|
-
g(
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
537
|
+
g(
|
|
538
|
+
/** @param {any} [prev] @returns {any} */
|
|
539
|
+
(E) => ({
|
|
540
|
+
...E,
|
|
541
|
+
clauses: E.clauses.filter(
|
|
542
|
+
/** @param {any} [_] @param {any} [clauseIndex] @returns {any} */
|
|
543
|
+
(h, u) => u !== c
|
|
544
|
+
)
|
|
545
|
+
})
|
|
546
|
+
);
|
|
461
547
|
}, []);
|
|
462
548
|
return /* @__PURE__ */ t.createElement(
|
|
463
549
|
"div",
|
|
@@ -492,7 +578,10 @@ function Ie({ condition: e, allFields: l, getFieldLabel: n = M, onSave: a, onClo
|
|
|
492
578
|
{
|
|
493
579
|
key: c,
|
|
494
580
|
type: "button",
|
|
495
|
-
onClick: () => g(
|
|
581
|
+
onClick: () => g(
|
|
582
|
+
/** @param {any} [prev] @returns {any} */
|
|
583
|
+
(E) => ({ ...E, op: c })
|
|
584
|
+
),
|
|
496
585
|
style: {
|
|
497
586
|
padding: "5px 12px",
|
|
498
587
|
borderRadius: "999px",
|
|
@@ -506,83 +595,98 @@ function Ie({ condition: e, allFields: l, getFieldLabel: n = M, onSave: a, onClo
|
|
|
506
595
|
},
|
|
507
596
|
c
|
|
508
597
|
))),
|
|
509
|
-
/* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "8px" } }, m.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."), m.clauses.map(
|
|
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",
|
|
598
|
+
/* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "8px" } }, m.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."), m.clauses.map(
|
|
599
|
+
/** @param {any} [clause] @param {any} [index] @returns {any} */
|
|
600
|
+
(c, E) => /* @__PURE__ */ t.createElement(
|
|
601
|
+
"div",
|
|
526
602
|
{
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
603
|
+
key: c._id,
|
|
604
|
+
style: {
|
|
605
|
+
border: `1px solid ${i.border}`,
|
|
606
|
+
borderRadius: "12px",
|
|
607
|
+
background: i.hover || "#F8FAFC",
|
|
608
|
+
padding: "10px",
|
|
609
|
+
display: "flex",
|
|
610
|
+
gap: "8px",
|
|
611
|
+
alignItems: "flex-start"
|
|
612
|
+
}
|
|
530
613
|
},
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
y(E, {
|
|
539
|
-
operator: u,
|
|
540
|
-
values: D ? R ? c.values : c.value ? [c.value] : [] : c.values,
|
|
541
|
-
value: D ? c.value : c.values[0] || c.value || ""
|
|
542
|
-
});
|
|
614
|
+
/* @__PURE__ */ t.createElement("div", { style: { width: "32px", paddingTop: "6px", textAlign: "center", fontSize: "10px", fontWeight: 800, color: i.textSec } }, E > 0 ? m.op : ""),
|
|
615
|
+
/* @__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(
|
|
616
|
+
"select",
|
|
617
|
+
{
|
|
618
|
+
value: c.field,
|
|
619
|
+
onChange: (h) => y(E, { field: h.target.value }),
|
|
620
|
+
style: { ...F, flex: 1, minWidth: "140px" }
|
|
543
621
|
},
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
622
|
+
l.map(
|
|
623
|
+
/** @param {any} [field] @returns {any} */
|
|
624
|
+
(h) => /* @__PURE__ */ t.createElement("option", { key: h, value: h }, n(h))
|
|
625
|
+
)
|
|
626
|
+
), /* @__PURE__ */ t.createElement(
|
|
627
|
+
"select",
|
|
628
|
+
{
|
|
629
|
+
value: c.operator,
|
|
630
|
+
onChange: (h) => {
|
|
631
|
+
const u = h.target.value, D = de.has(u), R = de.has(c.operator);
|
|
632
|
+
y(E, {
|
|
633
|
+
operator: u,
|
|
634
|
+
values: D ? R ? c.values : c.value ? [c.value] : [] : c.values,
|
|
635
|
+
value: D ? c.value : c.values[0] || c.value || ""
|
|
636
|
+
});
|
|
637
|
+
},
|
|
638
|
+
style: { ...F, width: "160px", flexShrink: 0 }
|
|
639
|
+
},
|
|
640
|
+
Xe.map((h) => /* @__PURE__ */ t.createElement("option", { key: h.value, value: h.value }, h.label))
|
|
641
|
+
)), de.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(
|
|
642
|
+
/** @param {any} [value] @param {any} [valueIndex] @returns {any} */
|
|
643
|
+
(h, u) => /* @__PURE__ */ t.createElement(X, { key: `${c._id}-${u}`, theme: i, tone: "primary" }, /* @__PURE__ */ t.createElement("span", null, h), /* @__PURE__ */ t.createElement(
|
|
644
|
+
"button",
|
|
645
|
+
{
|
|
646
|
+
type: "button",
|
|
647
|
+
onClick: () => y(E, {
|
|
648
|
+
values: c.values.filter(
|
|
649
|
+
/** @param {any} [_] @param {any} [currentIndex] @returns {any} */
|
|
650
|
+
(D, R) => R !== u
|
|
651
|
+
)
|
|
652
|
+
}),
|
|
653
|
+
style: { background: "none", border: "none", padding: 0, cursor: "pointer", color: "inherit", lineHeight: 1 }
|
|
654
|
+
},
|
|
655
|
+
"x"
|
|
656
|
+
))
|
|
657
|
+
)), /* @__PURE__ */ t.createElement(
|
|
658
|
+
"input",
|
|
659
|
+
{
|
|
660
|
+
placeholder: "Type a value and press Enter",
|
|
661
|
+
style: F,
|
|
662
|
+
onKeyDown: (
|
|
663
|
+
/** @param {any} event */
|
|
664
|
+
((h) => {
|
|
665
|
+
const u = h.target.value.trim();
|
|
666
|
+
h.key === "Enter" && u && (c.values.includes(u) || y(E, { values: [...c.values, u] }), h.target.value = "", h.preventDefault());
|
|
667
|
+
})
|
|
668
|
+
)
|
|
565
669
|
}
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
670
|
+
)) : /* @__PURE__ */ t.createElement(
|
|
671
|
+
"input",
|
|
672
|
+
{
|
|
673
|
+
value: c.value,
|
|
674
|
+
onChange: (h) => y(E, { value: h.target.value }),
|
|
675
|
+
placeholder: "Value",
|
|
676
|
+
style: F
|
|
677
|
+
}
|
|
678
|
+
)),
|
|
679
|
+
/* @__PURE__ */ t.createElement(
|
|
680
|
+
"button",
|
|
681
|
+
{
|
|
682
|
+
type: "button",
|
|
683
|
+
onClick: () => w(E),
|
|
684
|
+
style: { background: "none", border: "none", cursor: "pointer", color: "#B91C1C", padding: "6px" }
|
|
685
|
+
},
|
|
686
|
+
/* @__PURE__ */ t.createElement(v.Delete, null)
|
|
687
|
+
)
|
|
584
688
|
)
|
|
585
|
-
))
|
|
689
|
+
)),
|
|
586
690
|
/* @__PURE__ */ t.createElement(
|
|
587
691
|
"button",
|
|
588
692
|
{
|
|
@@ -626,7 +730,13 @@ function at({ value: e, onChange: l, theme: n }) {
|
|
|
626
730
|
}
|
|
627
731
|
function Vt({ validation: e, theme: l }) {
|
|
628
732
|
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(
|
|
733
|
+
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(
|
|
734
|
+
/** @param {any} [message] @returns {any} */
|
|
735
|
+
(r) => /* @__PURE__ */ t.createElement("div", { key: `err:${r}` }, r)
|
|
736
|
+
)), a.length > 0 && /* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: { fontWeight: 900, marginBottom: "4px" } }, "Warnings"), a.map(
|
|
737
|
+
/** @param {any} [message] @returns {any} */
|
|
738
|
+
(r) => /* @__PURE__ */ t.createElement("div", { key: `warn:${r}` }, r)
|
|
739
|
+
)));
|
|
630
740
|
}
|
|
631
741
|
function qt({ debug: e, theme: l }) {
|
|
632
742
|
if (!e || typeof e != "object") return null;
|
|
@@ -637,7 +747,10 @@ function qt({ debug: e, theme: l }) {
|
|
|
637
747
|
["Children source", e.childrenSource || "Default children"],
|
|
638
748
|
["Rule", e.matchedCondition || ""]
|
|
639
749
|
].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(
|
|
750
|
+
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(
|
|
751
|
+
/** @param {any} p0 @returns {any} */
|
|
752
|
+
([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))
|
|
753
|
+
));
|
|
641
754
|
}
|
|
642
755
|
function ot({
|
|
643
756
|
title: e,
|
|
@@ -663,7 +776,10 @@ function ot({
|
|
|
663
776
|
"button",
|
|
664
777
|
{
|
|
665
778
|
type: "button",
|
|
666
|
-
onClick: () => s(
|
|
779
|
+
onClick: () => s(
|
|
780
|
+
/** @param {any} [current] @returns {any} */
|
|
781
|
+
(f) => !f
|
|
782
|
+
),
|
|
667
783
|
style: {
|
|
668
784
|
width: "100%",
|
|
669
785
|
border: "none",
|
|
@@ -731,7 +847,7 @@ function it({
|
|
|
731
847
|
/* @__PURE__ */ t.createElement("span", { style: { color: l ? n.primary || "#2563EB" : n.textSec, flexShrink: 0 } }, /* @__PURE__ */ t.createElement(v.ChevronRight, null))
|
|
732
848
|
);
|
|
733
849
|
}
|
|
734
|
-
function
|
|
850
|
+
function Gt({
|
|
735
851
|
item: e,
|
|
736
852
|
node: l,
|
|
737
853
|
allFields: n,
|
|
@@ -784,7 +900,10 @@ function Yt({
|
|
|
784
900
|
style: y
|
|
785
901
|
},
|
|
786
902
|
/* @__PURE__ */ t.createElement("option", { value: "" }, "Select field..."),
|
|
787
|
-
n.map(
|
|
903
|
+
n.map(
|
|
904
|
+
/** @param {any} [field] @returns {any} */
|
|
905
|
+
(u) => /* @__PURE__ */ t.createElement("option", { key: u, value: u }, a(u))
|
|
906
|
+
)
|
|
788
907
|
)),
|
|
789
908
|
/* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: L(i) }, F), /* @__PURE__ */ t.createElement(
|
|
790
909
|
"input",
|
|
@@ -815,7 +934,10 @@ function Yt({
|
|
|
815
934
|
onChange: (u) => s({ ...l, sortBy: u.target.value || null }),
|
|
816
935
|
style: y
|
|
817
936
|
},
|
|
818
|
-
r.map(
|
|
937
|
+
r.map(
|
|
938
|
+
/** @param {any} [option] @returns {any} */
|
|
939
|
+
(u) => /* @__PURE__ */ t.createElement("option", { key: u.value, value: u.value }, u.label)
|
|
940
|
+
)
|
|
819
941
|
), /* @__PURE__ */ t.createElement(
|
|
820
942
|
"button",
|
|
821
943
|
{
|
|
@@ -899,12 +1021,15 @@ function Yt({
|
|
|
899
1021
|
{
|
|
900
1022
|
value: l.format,
|
|
901
1023
|
theme: i,
|
|
902
|
-
onChange: (
|
|
1024
|
+
onChange: (
|
|
1025
|
+
/** @param {any} [format] @returns {any} */
|
|
1026
|
+
((u) => s({ ...l, format: u }))
|
|
1027
|
+
)
|
|
903
1028
|
}
|
|
904
1029
|
)
|
|
905
1030
|
));
|
|
906
1031
|
}
|
|
907
|
-
function
|
|
1032
|
+
function Yt({
|
|
908
1033
|
draft: e,
|
|
909
1034
|
allFields: l,
|
|
910
1035
|
getFieldLabel: n = M,
|
|
@@ -914,7 +1039,7 @@ function Gt({
|
|
|
914
1039
|
onApply: s,
|
|
915
1040
|
onCancel: f
|
|
916
1041
|
}) {
|
|
917
|
-
const [m, g] = H(null), [F, N] = H(!1), y = e && e.child ? e.child :
|
|
1042
|
+
const [m, g] = H(null), [F, N] = H(!1), y = e && e.child ? e.child : Y(""), w = Array.isArray(e && e.selectedPath) ? e.selectedPath : [], c = ne(y, w) || y, E = !!(c.filters && c.filters.clauses && c.filters.clauses.length > 0), h = We(y, e.childLevelNumber || 2), u = Math.max(0, w.length), D = (e && Number.isFinite(Number(e.childLevelNumber)) ? Number(e.childLevelNumber) : 2) + w.length, R = q(r), x = [
|
|
918
1043
|
c.field ? n(c.field) : "Select field",
|
|
919
1044
|
e.title && e.title.trim() ? `Title: ${e.title.trim()}` : null,
|
|
920
1045
|
c.topN ? `Top ${c.topN}` : null,
|
|
@@ -933,19 +1058,29 @@ function Gt({
|
|
|
933
1058
|
const d = [...w, T];
|
|
934
1059
|
i({
|
|
935
1060
|
...e,
|
|
936
|
-
child: O(
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
1061
|
+
child: O(
|
|
1062
|
+
y,
|
|
1063
|
+
w,
|
|
1064
|
+
/** @param {any} [node] @returns {any} */
|
|
1065
|
+
(k) => ({
|
|
1066
|
+
...k,
|
|
1067
|
+
defaultChild: k.defaultChild || Y("")
|
|
1068
|
+
})
|
|
1069
|
+
),
|
|
940
1070
|
selectedPath: d
|
|
941
1071
|
});
|
|
942
1072
|
}, oe = () => {
|
|
943
1073
|
i({
|
|
944
1074
|
...e,
|
|
945
|
-
child: O(
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
1075
|
+
child: O(
|
|
1076
|
+
y,
|
|
1077
|
+
w,
|
|
1078
|
+
/** @param {any} [node] @returns {any} */
|
|
1079
|
+
(d) => ({
|
|
1080
|
+
...d,
|
|
1081
|
+
defaultChild: null
|
|
1082
|
+
})
|
|
1083
|
+
)
|
|
949
1084
|
});
|
|
950
1085
|
}, fe = (d, k) => {
|
|
951
1086
|
d === null || d === k || (i({
|
|
@@ -971,25 +1106,37 @@ function Gt({
|
|
|
971
1106
|
}
|
|
972
1107
|
},
|
|
973
1108
|
"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(qt, { debug: e.request && e.request.debug, theme: r }), h.length > 1 && /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "8px" } }, h.map(
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
1109
|
+
))), /* @__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(qt, { debug: e.request && e.request.debug, theme: r }), h.length > 1 && /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "8px" } }, h.map(
|
|
1110
|
+
/** @param {any} [item] @returns {any} */
|
|
1111
|
+
(d) => /* @__PURE__ */ t.createElement(
|
|
1112
|
+
it,
|
|
1113
|
+
{
|
|
1114
|
+
key: `draft-level:${d.index}:${d.node._id}`,
|
|
1115
|
+
item: d,
|
|
1116
|
+
selected: u === d.index,
|
|
1117
|
+
theme: r,
|
|
1118
|
+
sortByOptions: a,
|
|
1119
|
+
getFieldLabel: n,
|
|
1120
|
+
onSelect: () => J(d.index),
|
|
1121
|
+
onDragStart: (
|
|
1122
|
+
/** @param {any} [event] @returns {any} */
|
|
1123
|
+
((k) => {
|
|
1124
|
+
g(d.index), k.dataTransfer.effectAllowed = "move";
|
|
1125
|
+
})
|
|
1126
|
+
),
|
|
1127
|
+
onDragOver: (
|
|
1128
|
+
/** @param {any} [event] @returns {any} */
|
|
1129
|
+
((k) => k.preventDefault())
|
|
1130
|
+
),
|
|
1131
|
+
onDrop: (
|
|
1132
|
+
/** @param {any} [event] @returns {any} */
|
|
1133
|
+
((k) => {
|
|
1134
|
+
k.preventDefault(), fe(m, d.index);
|
|
1135
|
+
})
|
|
1136
|
+
)
|
|
990
1137
|
}
|
|
991
|
-
|
|
992
|
-
))
|
|
1138
|
+
)
|
|
1139
|
+
)), /* @__PURE__ */ t.createElement(
|
|
993
1140
|
ot,
|
|
994
1141
|
{
|
|
995
1142
|
title: `Level ${D} settings`,
|
|
@@ -1014,7 +1161,10 @@ function Gt({
|
|
|
1014
1161
|
style: R
|
|
1015
1162
|
},
|
|
1016
1163
|
/* @__PURE__ */ t.createElement("option", { value: "" }, "Select field..."),
|
|
1017
|
-
l.map(
|
|
1164
|
+
l.map(
|
|
1165
|
+
/** @param {any} [field] @returns {any} */
|
|
1166
|
+
(d) => /* @__PURE__ */ t.createElement("option", { key: d, value: d }, n(d))
|
|
1167
|
+
)
|
|
1018
1168
|
)),
|
|
1019
1169
|
/* @__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
1170
|
"input",
|
|
@@ -1036,7 +1186,10 @@ function Gt({
|
|
|
1036
1186
|
onChange: (d) => C({ ...c, sortBy: d.target.value || null }),
|
|
1037
1187
|
style: R
|
|
1038
1188
|
},
|
|
1039
|
-
a.map(
|
|
1189
|
+
a.map(
|
|
1190
|
+
/** @param {any} [option] @returns {any} */
|
|
1191
|
+
(d) => /* @__PURE__ */ t.createElement("option", { key: d.value, value: d.value }, d.label)
|
|
1192
|
+
)
|
|
1040
1193
|
), /* @__PURE__ */ t.createElement(
|
|
1041
1194
|
"button",
|
|
1042
1195
|
{
|
|
@@ -1120,7 +1273,10 @@ function Gt({
|
|
|
1120
1273
|
{
|
|
1121
1274
|
value: c.format,
|
|
1122
1275
|
theme: r,
|
|
1123
|
-
onChange: (
|
|
1276
|
+
onChange: (
|
|
1277
|
+
/** @param {any} [format] @returns {any} */
|
|
1278
|
+
((d) => C({ ...c, format: d }))
|
|
1279
|
+
)
|
|
1124
1280
|
}
|
|
1125
1281
|
),
|
|
1126
1282
|
/* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px" } }, /* @__PURE__ */ t.createElement(
|
|
@@ -1144,12 +1300,15 @@ function Gt({
|
|
|
1144
1300
|
allFields: l,
|
|
1145
1301
|
getFieldLabel: n,
|
|
1146
1302
|
theme: r,
|
|
1147
|
-
onSave: (
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1303
|
+
onSave: (
|
|
1304
|
+
/** @param {any} [nextCondition] @returns {any} */
|
|
1305
|
+
((d) => {
|
|
1306
|
+
C({
|
|
1307
|
+
...c,
|
|
1308
|
+
filters: d.clauses.length > 0 ? d : null
|
|
1309
|
+
});
|
|
1310
|
+
})
|
|
1311
|
+
),
|
|
1153
1312
|
onClose: () => N(!1)
|
|
1154
1313
|
}
|
|
1155
1314
|
));
|
|
@@ -1239,13 +1398,16 @@ function Ut({
|
|
|
1239
1398
|
() => Rt(s),
|
|
1240
1399
|
[s]
|
|
1241
1400
|
), K = z(
|
|
1242
|
-
() =>
|
|
1401
|
+
() => Ye(b, { allFields: W, valConfigs: s, data: i }),
|
|
1243
1402
|
[b, W, s, i]
|
|
1244
1403
|
), $ = B((o) => {
|
|
1245
|
-
l(
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1404
|
+
l(
|
|
1405
|
+
/** @param {any} [prev] @returns {any} */
|
|
1406
|
+
(p) => {
|
|
1407
|
+
const S = p && typeof p == "object" ? p : {}, A = S.root ? V(S.root) : null, P = typeof o == "function" ? o(A) : o;
|
|
1408
|
+
return { ...S, root: P };
|
|
1409
|
+
}
|
|
1410
|
+
);
|
|
1249
1411
|
}, [l]), ee = z(() => Lt(b), [b]), I = z(() => We(b), [b]), se = z(
|
|
1250
1412
|
() => Tt(ee, x),
|
|
1251
1413
|
[ee, x]
|
|
@@ -1272,14 +1434,17 @@ function Ut({
|
|
|
1272
1434
|
if (!o || o.type !== "rowPath" || !b) return !1;
|
|
1273
1435
|
const p = Array.isArray(o.nodePath) ? o.nodePath : [], S = ne(b, p);
|
|
1274
1436
|
if (!S) return !1;
|
|
1275
|
-
const A = Array.isArray(S.branches) ? S.branches : [], P = A.findIndex(
|
|
1437
|
+
const A = Array.isArray(S.branches) ? S.branches : [], P = A.findIndex(
|
|
1438
|
+
/** @param {any} [branch] @returns {any} */
|
|
1439
|
+
(ce) => Ze(ce, o.field, o.value)
|
|
1440
|
+
), _ = P >= 0 ? A[P] : null, be = _ && _.child ? _.child : S.defaultChild || Y(""), G = Q(o.label || o.value);
|
|
1276
1441
|
return k({
|
|
1277
1442
|
request: o,
|
|
1278
1443
|
nodePath: p,
|
|
1279
1444
|
branchIndex: P,
|
|
1280
|
-
rowLabel:
|
|
1281
|
-
title: _ && _.label ? _.label :
|
|
1282
|
-
child: Oe(be) ||
|
|
1445
|
+
rowLabel: G,
|
|
1446
|
+
title: _ && _.label ? _.label : G,
|
|
1447
|
+
child: Oe(be) || Y(""),
|
|
1283
1448
|
selectedPath: [],
|
|
1284
1449
|
childLevelNumber: Number.isFinite(Number(o.levelNumber)) ? Number(o.levelNumber) + 1 : 2
|
|
1285
1450
|
}), C({ type: "node", path: p }), !0;
|
|
@@ -1319,34 +1484,74 @@ function Ut({
|
|
|
1319
1484
|
ie.current && (ie.current = !1, ge());
|
|
1320
1485
|
}, [ge, x]);
|
|
1321
1486
|
const Me = B((o, p) => {
|
|
1322
|
-
$(
|
|
1487
|
+
$(
|
|
1488
|
+
/** @param {any} [prevRoot] @returns {any} */
|
|
1489
|
+
(S) => O(S, o, () => p)
|
|
1490
|
+
);
|
|
1323
1491
|
}, [$]), He = B((o, p, S) => {
|
|
1324
|
-
$(
|
|
1492
|
+
$(
|
|
1493
|
+
/** @param {any} [prevRoot] @returns {any} */
|
|
1494
|
+
(A) => ve(A, o, p, () => S)
|
|
1495
|
+
);
|
|
1325
1496
|
}, [$]), ct = B((o) => {
|
|
1326
|
-
const p =
|
|
1497
|
+
const p = Y(o);
|
|
1327
1498
|
$(p), k(null), C({ type: "node", path: [] });
|
|
1328
1499
|
}, [$]);
|
|
1329
1500
|
B((o, p) => {
|
|
1330
|
-
p || $(
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1501
|
+
p || $(
|
|
1502
|
+
/** @param {any} [prevRoot] @returns {any} */
|
|
1503
|
+
(S) => O(
|
|
1504
|
+
S,
|
|
1505
|
+
o,
|
|
1506
|
+
/** @param {any} [node] @returns {any} */
|
|
1507
|
+
(A) => ({
|
|
1508
|
+
...A,
|
|
1509
|
+
defaultChild: Y("")
|
|
1510
|
+
})
|
|
1511
|
+
)
|
|
1512
|
+
), C({ type: "node", path: [...o, T] });
|
|
1334
1513
|
}, [$]), B((o) => {
|
|
1335
|
-
$(
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1514
|
+
$(
|
|
1515
|
+
/** @param {any} [prevRoot] @returns {any} */
|
|
1516
|
+
(p) => O(
|
|
1517
|
+
p,
|
|
1518
|
+
o,
|
|
1519
|
+
/** @param {any} [node] @returns {any} */
|
|
1520
|
+
(S) => ({
|
|
1521
|
+
...S,
|
|
1522
|
+
defaultChild: null
|
|
1523
|
+
})
|
|
1524
|
+
)
|
|
1525
|
+
), C({ type: "node", path: o });
|
|
1339
1526
|
}, [$]);
|
|
1340
1527
|
const dt = B((o, p, S) => {
|
|
1341
|
-
S || $(
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1528
|
+
S || $(
|
|
1529
|
+
/** @param {any} [prevRoot] @returns {any} */
|
|
1530
|
+
(A) => ve(
|
|
1531
|
+
A,
|
|
1532
|
+
o,
|
|
1533
|
+
p,
|
|
1534
|
+
/** @param {any} [branch] @returns {any} */
|
|
1535
|
+
(P) => ({
|
|
1536
|
+
...P,
|
|
1537
|
+
child: Y(W[0] || "")
|
|
1538
|
+
})
|
|
1539
|
+
)
|
|
1540
|
+
), C({ type: "node", path: [...o, _e(p)] });
|
|
1345
1541
|
}, [W, $]), pt = B((o, p) => {
|
|
1346
|
-
$(
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1542
|
+
$(
|
|
1543
|
+
/** @param {any} [prevRoot] @returns {any} */
|
|
1544
|
+
(S) => ve(
|
|
1545
|
+
S,
|
|
1546
|
+
o,
|
|
1547
|
+
p,
|
|
1548
|
+
/** @param {any} [branch] @returns {any} */
|
|
1549
|
+
(A) => ({
|
|
1550
|
+
...A,
|
|
1551
|
+
child: null
|
|
1552
|
+
})
|
|
1553
|
+
)
|
|
1554
|
+
), C({ type: "branch", nodePath: o, branchIndex: p });
|
|
1350
1555
|
}, [$]), ut = B((o) => {
|
|
1351
1556
|
if (o.length === 0) {
|
|
1352
1557
|
$(null), k(null), C(null);
|
|
@@ -1354,22 +1559,50 @@ function Ut({
|
|
|
1354
1559
|
}
|
|
1355
1560
|
const p = o.slice(0, -1), S = o[o.length - 1];
|
|
1356
1561
|
if (S === T) {
|
|
1357
|
-
$(
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1562
|
+
$(
|
|
1563
|
+
/** @param {any} [prevRoot] @returns {any} */
|
|
1564
|
+
(P) => O(
|
|
1565
|
+
P,
|
|
1566
|
+
p,
|
|
1567
|
+
/** @param {any} [node] @returns {any} */
|
|
1568
|
+
(_) => ({
|
|
1569
|
+
..._,
|
|
1570
|
+
defaultChild: null
|
|
1571
|
+
})
|
|
1572
|
+
)
|
|
1573
|
+
), C({ type: "node", path: p });
|
|
1361
1574
|
return;
|
|
1362
1575
|
}
|
|
1363
1576
|
const A = Se(S);
|
|
1364
|
-
A >= 0 && ($(
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1577
|
+
A >= 0 && ($(
|
|
1578
|
+
/** @param {any} [prevRoot] @returns {any} */
|
|
1579
|
+
(P) => ve(
|
|
1580
|
+
P,
|
|
1581
|
+
p,
|
|
1582
|
+
A,
|
|
1583
|
+
/** @param {any} [branch] @returns {any} */
|
|
1584
|
+
(_) => ({
|
|
1585
|
+
..._,
|
|
1586
|
+
child: null
|
|
1587
|
+
})
|
|
1588
|
+
)
|
|
1589
|
+
), C({ type: "branch", nodePath: p, branchIndex: A }));
|
|
1368
1590
|
}, [$]), ft = B((o, p) => {
|
|
1369
|
-
$(
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1591
|
+
$(
|
|
1592
|
+
/** @param {any} [prevRoot] @returns {any} */
|
|
1593
|
+
(S) => O(
|
|
1594
|
+
S,
|
|
1595
|
+
o,
|
|
1596
|
+
/** @param {any} [node] @returns {any} */
|
|
1597
|
+
(A) => ({
|
|
1598
|
+
...A,
|
|
1599
|
+
branches: A.branches.filter(
|
|
1600
|
+
/** @param {any} [_] @param {any} [index] @returns {any} */
|
|
1601
|
+
(P, _) => _ !== p
|
|
1602
|
+
)
|
|
1603
|
+
})
|
|
1604
|
+
)
|
|
1605
|
+
), C({ type: "node", path: o });
|
|
1373
1606
|
}, [$]), yt = B((o) => {
|
|
1374
1607
|
k(null), C({ type: "node", path: o });
|
|
1375
1608
|
}, []), Ve = B((o) => {
|
|
@@ -1385,12 +1618,23 @@ function Ut({
|
|
|
1385
1618
|
const o = I[I.length - 1];
|
|
1386
1619
|
if (!o || !o.node || !o.node.field) return;
|
|
1387
1620
|
const p = [...o.path, T];
|
|
1388
|
-
k(null), $(
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1621
|
+
k(null), $(
|
|
1622
|
+
/** @param {any} [prevRoot] @returns {any} */
|
|
1623
|
+
(S) => O(
|
|
1624
|
+
S,
|
|
1625
|
+
o.path,
|
|
1626
|
+
/** @param {any} [node] @returns {any} */
|
|
1627
|
+
(A) => ({
|
|
1628
|
+
...A,
|
|
1629
|
+
defaultChild: A.defaultChild || Y("")
|
|
1630
|
+
})
|
|
1631
|
+
)
|
|
1632
|
+
), C({ type: "node", path: p });
|
|
1392
1633
|
}, [I, b, $]), gt = B((o, p) => {
|
|
1393
|
-
o === null || o === p || ($(
|
|
1634
|
+
o === null || o === p || ($(
|
|
1635
|
+
/** @param {any} [prevRoot] @returns {any} */
|
|
1636
|
+
(S) => rt(S, o, p)
|
|
1637
|
+
), C({ type: "node", path: Ne(p) }), ze(null));
|
|
1394
1638
|
}, [$]), bt = B(() => {
|
|
1395
1639
|
k(null), C(null);
|
|
1396
1640
|
}, []), ht = B(() => {
|
|
@@ -1407,21 +1651,30 @@ function Ut({
|
|
|
1407
1651
|
sourceRowPath: Array.isArray(o.pathValues) ? o.pathValues.map(String).filter(Boolean) : [],
|
|
1408
1652
|
sourcePathFields: Array.isArray(o.pathFields) ? o.pathFields.map(String).filter(Boolean) : [],
|
|
1409
1653
|
child: S
|
|
1410
|
-
}, P = (
|
|
1411
|
-
const ce = Array.isArray(
|
|
1654
|
+
}, P = (G) => {
|
|
1655
|
+
const ce = Array.isArray(G.branches) ? G.branches : [], Je = ce.findIndex(
|
|
1656
|
+
/** @param {any} [branch] @returns {any} */
|
|
1657
|
+
(he) => Ze(he, o.field, o.value)
|
|
1658
|
+
);
|
|
1412
1659
|
return Je >= 0 ? {
|
|
1413
|
-
...
|
|
1414
|
-
branches: ce.map(
|
|
1660
|
+
...G,
|
|
1661
|
+
branches: ce.map(
|
|
1662
|
+
/** @param {any} [branch] @param {any} [index] @returns {any} */
|
|
1663
|
+
(he, mt) => mt === Je ? { ...A, _id: he._id || A._id } : he
|
|
1664
|
+
)
|
|
1415
1665
|
} : {
|
|
1416
|
-
...
|
|
1666
|
+
...G,
|
|
1417
1667
|
branches: [...ce, A]
|
|
1418
1668
|
};
|
|
1419
|
-
}, _ = O(b, p, P), be =
|
|
1669
|
+
}, _ = O(b, p, P), be = Ye(_, { allFields: W, valConfigs: s, data: i });
|
|
1420
1670
|
if (!be.valid) {
|
|
1421
1671
|
c && c(be.errors[0] || "Fix report validation errors before applying.", "error");
|
|
1422
1672
|
return;
|
|
1423
1673
|
}
|
|
1424
|
-
$(
|
|
1674
|
+
$(
|
|
1675
|
+
/** @param {any} [prevRoot] @returns {any} */
|
|
1676
|
+
(G) => O(G, p, P)
|
|
1677
|
+
), k(null), C(null), c && c(`Applied settings for ${d.rowLabel || "row"}`, "info");
|
|
1425
1678
|
}, [W, i, b, d, $, c, s]), qe = B(() => {
|
|
1426
1679
|
if (!b || !b.field) return;
|
|
1427
1680
|
if (!K.valid) {
|
|
@@ -1440,38 +1693,47 @@ function Ut({
|
|
|
1440
1693
|
}
|
|
1441
1694
|
]), w(o), R(""), c && c(`Report "${p}" saved`, "info");
|
|
1442
1695
|
}, [f, s, e, D, K, b, F, w, N, c]);
|
|
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(v.Save, null), " Saved Reports"), /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "6px" } }, (F || []).map(
|
|
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",
|
|
1696
|
+
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(v.Save, null), " Saved Reports"), /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "6px" } }, (F || []).map(
|
|
1697
|
+
/** @param {any} [report] @returns {any} */
|
|
1698
|
+
(o) => /* @__PURE__ */ t.createElement(
|
|
1699
|
+
"div",
|
|
1465
1700
|
{
|
|
1466
|
-
|
|
1467
|
-
onClick: (
|
|
1468
|
-
|
|
1701
|
+
key: o.id,
|
|
1702
|
+
onClick: () => {
|
|
1703
|
+
Ct(o, { setReportDef: l, setActiveReportId: w, setColFields: m, setValConfigs: g }), k(null), C({ type: "node", path: [] });
|
|
1469
1704
|
},
|
|
1470
|
-
style: {
|
|
1705
|
+
style: {
|
|
1706
|
+
display: "flex",
|
|
1707
|
+
alignItems: "center",
|
|
1708
|
+
gap: "8px",
|
|
1709
|
+
padding: "8px 10px",
|
|
1710
|
+
borderRadius: "10px",
|
|
1711
|
+
cursor: "pointer",
|
|
1712
|
+
background: o.id === y ? r.select || `${r.primary || "#2563EB"}14` : r.hover || "#F9FAFB",
|
|
1713
|
+
border: `1px solid ${o.id === y ? r.primary || "#2563EB" : r.border}`
|
|
1714
|
+
}
|
|
1471
1715
|
},
|
|
1472
|
-
/* @__PURE__ */ t.createElement(v.
|
|
1716
|
+
/* @__PURE__ */ t.createElement(v.Report, null),
|
|
1717
|
+
/* @__PURE__ */ t.createElement("div", { style: { flex: 1, minWidth: 0, fontSize: "12px", fontWeight: 700, color: r.text, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, o.name),
|
|
1718
|
+
/* @__PURE__ */ t.createElement(
|
|
1719
|
+
"button",
|
|
1720
|
+
{
|
|
1721
|
+
type: "button",
|
|
1722
|
+
onClick: (p) => {
|
|
1723
|
+
p.stopPropagation(), N(
|
|
1724
|
+
/** @param {any} [prev] @returns {any} */
|
|
1725
|
+
(S) => (S || []).filter(
|
|
1726
|
+
/** @param {any} [current] @returns {any} */
|
|
1727
|
+
(A) => A.id !== o.id
|
|
1728
|
+
)
|
|
1729
|
+
), y === o.id && w(null);
|
|
1730
|
+
},
|
|
1731
|
+
style: { background: "none", border: "none", cursor: "pointer", color: "#B91C1C", padding: "2px", flexShrink: 0 }
|
|
1732
|
+
},
|
|
1733
|
+
/* @__PURE__ */ t.createElement(v.Delete, null)
|
|
1734
|
+
)
|
|
1473
1735
|
)
|
|
1474
|
-
)))
|
|
1736
|
+
))), /* @__PURE__ */ t.createElement(
|
|
1475
1737
|
re,
|
|
1476
1738
|
{
|
|
1477
1739
|
theme: r,
|
|
@@ -1506,25 +1768,37 @@ function Ut({
|
|
|
1506
1768
|
" Add next level"
|
|
1507
1769
|
))
|
|
1508
1770
|
},
|
|
1509
|
-
b ? /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "8px" } }, I.map(
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1771
|
+
b ? /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "8px" } }, I.map(
|
|
1772
|
+
/** @param {any} [item] @returns {any} */
|
|
1773
|
+
(o) => /* @__PURE__ */ t.createElement(
|
|
1774
|
+
it,
|
|
1775
|
+
{
|
|
1776
|
+
key: `default-level:${o.index}:${o.node._id}`,
|
|
1777
|
+
item: o,
|
|
1778
|
+
selected: !d && Z(x) === Z({ type: "node", path: o.path }),
|
|
1779
|
+
theme: r,
|
|
1780
|
+
sortByOptions: xe,
|
|
1781
|
+
getFieldLabel: U,
|
|
1782
|
+
onSelect: () => yt(o.path),
|
|
1783
|
+
onDragStart: (
|
|
1784
|
+
/** @param {any} [event] @returns {any} */
|
|
1785
|
+
((p) => {
|
|
1786
|
+
ze(o.index), p.dataTransfer.effectAllowed = "move";
|
|
1787
|
+
})
|
|
1788
|
+
),
|
|
1789
|
+
onDragOver: (
|
|
1790
|
+
/** @param {any} [event] @returns {any} */
|
|
1791
|
+
((p) => p.preventDefault())
|
|
1792
|
+
),
|
|
1793
|
+
onDrop: (
|
|
1794
|
+
/** @param {any} [event] @returns {any} */
|
|
1795
|
+
((p) => {
|
|
1796
|
+
p.preventDefault(), gt(st, o.index);
|
|
1797
|
+
})
|
|
1798
|
+
)
|
|
1525
1799
|
}
|
|
1526
|
-
|
|
1527
|
-
))
|
|
1800
|
+
)
|
|
1801
|
+
)) : /* @__PURE__ */ t.createElement("div", { style: pe(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(
|
|
1528
1802
|
"select",
|
|
1529
1803
|
{
|
|
1530
1804
|
value: "",
|
|
@@ -1534,7 +1808,10 @@ function Ut({
|
|
|
1534
1808
|
style: q(r)
|
|
1535
1809
|
},
|
|
1536
1810
|
/* @__PURE__ */ t.createElement("option", { value: "" }, "Select field..."),
|
|
1537
|
-
W.map(
|
|
1811
|
+
W.map(
|
|
1812
|
+
/** @param {any} [field] @returns {any} */
|
|
1813
|
+
(o) => /* @__PURE__ */ t.createElement("option", { key: o, value: o }, U(o))
|
|
1814
|
+
)
|
|
1538
1815
|
)))
|
|
1539
1816
|
), b && /* @__PURE__ */ t.createElement(
|
|
1540
1817
|
re,
|
|
@@ -1545,31 +1822,34 @@ function Ut({
|
|
|
1545
1822
|
description: "Default levels plus every row override, shown as a separate map of Default children.",
|
|
1546
1823
|
icon: /* @__PURE__ */ t.createElement(v.Report, null)
|
|
1547
1824
|
},
|
|
1548
|
-
/* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "8px" } }, ee.map(
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1825
|
+
/* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "8px" } }, ee.map(
|
|
1826
|
+
/** @param {any} [item] @returns {any} */
|
|
1827
|
+
(o) => o.kind === "branch" ? /* @__PURE__ */ t.createElement(
|
|
1828
|
+
Kt,
|
|
1829
|
+
{
|
|
1830
|
+
key: `outline-branch:${le(o.nodePath)}:${o.branchIndex}:${o.branch._id}`,
|
|
1831
|
+
item: o,
|
|
1832
|
+
selected: !d && Z(x) === Z({
|
|
1833
|
+
type: "branch",
|
|
1834
|
+
nodePath: o.nodePath,
|
|
1835
|
+
branchIndex: o.branchIndex
|
|
1836
|
+
}),
|
|
1837
|
+
theme: r,
|
|
1838
|
+
onSelect: () => Ve(o)
|
|
1839
|
+
}
|
|
1840
|
+
) : /* @__PURE__ */ t.createElement(
|
|
1841
|
+
Jt,
|
|
1842
|
+
{
|
|
1843
|
+
key: `outline-node:${le(o.nodePath)}:${o.node._id}`,
|
|
1844
|
+
item: o,
|
|
1845
|
+
selected: !d && Z(x) === Z({ type: "node", path: o.nodePath }),
|
|
1846
|
+
theme: r,
|
|
1847
|
+
sortByOptions: xe,
|
|
1848
|
+
getFieldLabel: U,
|
|
1849
|
+
onSelect: () => Ve(o)
|
|
1850
|
+
}
|
|
1851
|
+
)
|
|
1852
|
+
))
|
|
1573
1853
|
), b && d && /* @__PURE__ */ t.createElement("div", { ref: ye }, /* @__PURE__ */ t.createElement(
|
|
1574
1854
|
re,
|
|
1575
1855
|
{
|
|
@@ -1580,7 +1860,7 @@ function Ut({
|
|
|
1580
1860
|
icon: /* @__PURE__ */ t.createElement(v.Settings, null)
|
|
1581
1861
|
},
|
|
1582
1862
|
/* @__PURE__ */ t.createElement(
|
|
1583
|
-
|
|
1863
|
+
Yt,
|
|
1584
1864
|
{
|
|
1585
1865
|
draft: d,
|
|
1586
1866
|
allFields: W,
|
|
@@ -1602,15 +1882,21 @@ function Ut({
|
|
|
1602
1882
|
icon: /* @__PURE__ */ t.createElement(v.Edit, null)
|
|
1603
1883
|
},
|
|
1604
1884
|
/* @__PURE__ */ t.createElement(
|
|
1605
|
-
|
|
1885
|
+
Gt,
|
|
1606
1886
|
{
|
|
1607
|
-
item: I.find(
|
|
1887
|
+
item: I.find(
|
|
1888
|
+
/** @param {any} [item] @returns {any} */
|
|
1889
|
+
(o) => we(o.path, x.path)
|
|
1890
|
+
) || (se ? { ...se, path: se.nodePath } : { path: x.path, levelNumber: x.path.length + 1 }),
|
|
1608
1891
|
node: te.node,
|
|
1609
1892
|
allFields: W,
|
|
1610
1893
|
getFieldLabel: U,
|
|
1611
1894
|
sortByOptions: xe,
|
|
1612
1895
|
theme: r,
|
|
1613
|
-
onUpdate: (
|
|
1896
|
+
onUpdate: (
|
|
1897
|
+
/** @param {any} [nextNode] @returns {any} */
|
|
1898
|
+
((o) => Me(x.path, o))
|
|
1899
|
+
),
|
|
1614
1900
|
onApply: ht,
|
|
1615
1901
|
onRemove: () => ut(x.path),
|
|
1616
1902
|
onEditFilter: () => fe(x.path),
|
|
@@ -1632,7 +1918,10 @@ function Ut({
|
|
|
1632
1918
|
item: se,
|
|
1633
1919
|
branch: te.branch,
|
|
1634
1920
|
theme: r,
|
|
1635
|
-
onUpdate: (
|
|
1921
|
+
onUpdate: (
|
|
1922
|
+
/** @param {any} [nextBranch] @returns {any} */
|
|
1923
|
+
((o) => He(x.nodePath, x.branchIndex, o))
|
|
1924
|
+
),
|
|
1636
1925
|
onEditCondition: () => ue({ nodePath: x.nodePath, branchIndex: x.branchIndex }),
|
|
1637
1926
|
onOpenCustomChildren: () => dt(x.nodePath, x.branchIndex, !!te.branch.child),
|
|
1638
1927
|
onRemoveCustomChildren: () => pt(x.nodePath, x.branchIndex),
|
|
@@ -1691,12 +1980,15 @@ function Ut({
|
|
|
1691
1980
|
allFields: W,
|
|
1692
1981
|
getFieldLabel: U,
|
|
1693
1982
|
theme: r,
|
|
1694
|
-
onSave: (
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1983
|
+
onSave: (
|
|
1984
|
+
/** @param {any} [nextCondition] @returns {any} */
|
|
1985
|
+
((o) => {
|
|
1986
|
+
He(J.nodePath, J.branchIndex, {
|
|
1987
|
+
...Ae,
|
|
1988
|
+
condition: o
|
|
1989
|
+
});
|
|
1990
|
+
})
|
|
1991
|
+
),
|
|
1700
1992
|
onClose: () => ue(null)
|
|
1701
1993
|
}
|
|
1702
1994
|
), oe && (() => {
|
|
@@ -1710,12 +2002,15 @@ function Ut({
|
|
|
1710
2002
|
allFields: W,
|
|
1711
2003
|
getFieldLabel: U,
|
|
1712
2004
|
theme: r,
|
|
1713
|
-
onSave: (
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
2005
|
+
onSave: (
|
|
2006
|
+
/** @param {any} [nextCondition] @returns {any} */
|
|
2007
|
+
((p) => {
|
|
2008
|
+
Me(oe, {
|
|
2009
|
+
...o,
|
|
2010
|
+
filters: p.clauses.length > 0 ? p : null
|
|
2011
|
+
});
|
|
2012
|
+
})
|
|
2013
|
+
),
|
|
1719
2014
|
onClose: () => fe(null)
|
|
1720
2015
|
}
|
|
1721
2016
|
) : null;
|