@factorialco/f0-react 1.415.0 → 1.416.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{F0HILActionConfirmation-Bu877U3G.js → F0HILActionConfirmation-BSTBAAeF.js} +381 -448
- package/dist/ai.d.ts +189 -447
- package/dist/ai.js +27 -60
- package/dist/experimental.d.ts +52 -7
- package/dist/experimental.js +1782 -1796
- package/dist/f0.d.ts +206 -447
- package/dist/f0.js +13030 -4020
- package/dist/i18n-provider-defaults.d.ts +20 -7
- package/dist/i18n-provider-defaults.js +17 -4
- package/dist/index-uiINov39.js +48074 -0
- package/dist/{F0AiChat.css → index.css} +1 -1
- package/dist/{F0Input-Ctwd5zZH.js → registry-B2RMtJNl.js} +160862 -68438
- package/dist/{F0AnalyticsDashboard.css → registry.css} +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/dist/F0AiChat-CrcLUV-I.js +0 -63788
- package/dist/F0AnalyticsDashboard-BhvG-yU1.js +0 -54136
- package/dist/F0ChatDashboard.d.ts +0 -364
- package/dist/F0ChatDashboard.js +0 -292
- package/dist/index-BZMnPkIB.js +0 -22909
- package/dist/useDataCollectionSource-BH2-U4PN.js +0 -8206
- package/dist/useDataCollectionSource.css +0 -1
|
@@ -1,364 +0,0 @@
|
|
|
1
|
-
import { JSX as JSX_2 } from 'react';
|
|
2
|
-
|
|
3
|
-
export declare type AggregationType = "count" | "sum" | "avg" | "min" | "max" | "countDistinct";
|
|
4
|
-
|
|
5
|
-
export declare interface ChartComputation {
|
|
6
|
-
datasetId: string;
|
|
7
|
-
xAxis: string;
|
|
8
|
-
yAxis: string;
|
|
9
|
-
aggregation: AggregationType;
|
|
10
|
-
series?: string;
|
|
11
|
-
sortBy?: "value" | "category";
|
|
12
|
-
sortOrder?: "asc" | "desc";
|
|
13
|
-
limit?: number;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export declare interface ChatDashboardBarChartConfig extends ChatDashboardChartConfigBase {
|
|
17
|
-
type: "bar";
|
|
18
|
-
orientation?: "vertical" | "horizontal";
|
|
19
|
-
stacked?: boolean;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export declare type ChatDashboardChartConfig = ChatDashboardBarChartConfig | ChatDashboardLineChartConfig | ChatDashboardFunnelChartConfig | ChatDashboardRadarChartConfig | ChatDashboardPieChartConfig | ChatDashboardGaugeChartConfig | ChatDashboardHeatmapChartConfig;
|
|
23
|
-
|
|
24
|
-
declare interface ChatDashboardChartConfigBase {
|
|
25
|
-
showLegend?: boolean;
|
|
26
|
-
showGrid?: boolean;
|
|
27
|
-
showLabels?: boolean;
|
|
28
|
-
valueFormat?: FormatPreset;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export declare interface ChatDashboardChartItem extends ChatDashboardItemBase {
|
|
32
|
-
type: "chart";
|
|
33
|
-
chart: ChatDashboardChartConfig;
|
|
34
|
-
computation: ChartComputation | RadarComputation | PieComputation | GaugeComputation | HeatmapComputation;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export declare interface ChatDashboardCollectionItem extends ChatDashboardItemBase {
|
|
38
|
-
type: "collection";
|
|
39
|
-
columns: ChatDashboardColumn[];
|
|
40
|
-
computation: CollectionComputation;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export declare interface ChatDashboardColumn {
|
|
44
|
-
/** Column key — must match a key in each row object */
|
|
45
|
-
id: string;
|
|
46
|
-
/** Display header label */
|
|
47
|
-
label: string;
|
|
48
|
-
/** Optional fixed width in pixels */
|
|
49
|
-
width?: number;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Complete dashboard configuration received via `displayDashboard`.
|
|
54
|
-
* Contains fetchSpecs that describe how to obtain data server-side —
|
|
55
|
-
* no raw data is included. Fully JSON-serializable.
|
|
56
|
-
*/
|
|
57
|
-
export declare interface ChatDashboardConfig {
|
|
58
|
-
/** Dashboard title displayed in the canvas header and chat report card */
|
|
59
|
-
title: string;
|
|
60
|
-
/** Filter definitions — keys become filter IDs */
|
|
61
|
-
filters?: Record<string, ChatDashboardFilterDefinition>;
|
|
62
|
-
/** Ordered list of dashboard items with computation specs */
|
|
63
|
-
items: ChatDashboardItem[];
|
|
64
|
-
/** Fetch specs for server-side data retrieval, keyed by datasetId */
|
|
65
|
-
fetchSpecs: Record<string, DashboardFetchSpec>;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export declare interface ChatDashboardFilterDefinition {
|
|
69
|
-
type: "in";
|
|
70
|
-
label: string;
|
|
71
|
-
column: string;
|
|
72
|
-
datasetId: string;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export declare interface ChatDashboardFunnelChartConfig {
|
|
76
|
-
type: "funnel";
|
|
77
|
-
sort?: "descending" | "ascending" | "none";
|
|
78
|
-
orient?: "horizontal" | "vertical";
|
|
79
|
-
labelPosition?: "inside" | "outside";
|
|
80
|
-
showLegend?: boolean;
|
|
81
|
-
showLabels?: boolean;
|
|
82
|
-
showConversion?: boolean;
|
|
83
|
-
valueFormat?: FormatPreset;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
declare interface ChatDashboardGaugeChartConfig {
|
|
87
|
-
type: "gauge";
|
|
88
|
-
min?: number;
|
|
89
|
-
max?: number;
|
|
90
|
-
showValue?: boolean;
|
|
91
|
-
valueFormat?: FormatPreset;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
declare interface ChatDashboardHeatmapChartConfig {
|
|
95
|
-
type: "heatmap";
|
|
96
|
-
min?: number;
|
|
97
|
-
max?: number;
|
|
98
|
-
showLabels?: boolean;
|
|
99
|
-
showVisualMap?: boolean;
|
|
100
|
-
valueFormat?: FormatPreset;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
export declare type ChatDashboardItem = ChatDashboardChartItem | ChatDashboardMetricItem | ChatDashboardCollectionItem;
|
|
104
|
-
|
|
105
|
-
declare interface ChatDashboardItemBase {
|
|
106
|
-
id: string;
|
|
107
|
-
title: string;
|
|
108
|
-
description?: string;
|
|
109
|
-
/** Source attribution shown as a subtitle (e.g. "Based on 8 feedbacks from 3 evaluators") */
|
|
110
|
-
sourceDescription?: string;
|
|
111
|
-
colSpan?: number;
|
|
112
|
-
rowSpan?: number;
|
|
113
|
-
x?: number;
|
|
114
|
-
y?: number;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export declare interface ChatDashboardLineChartConfig extends ChatDashboardChartConfigBase {
|
|
118
|
-
type: "line";
|
|
119
|
-
lineType?: "linear" | "smooth" | "step";
|
|
120
|
-
showArea?: boolean;
|
|
121
|
-
showDots?: boolean;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
export declare type ChatDashboardMetricFormat = {
|
|
125
|
-
type: "number";
|
|
126
|
-
} | {
|
|
127
|
-
type: "currency";
|
|
128
|
-
currency?: string;
|
|
129
|
-
} | {
|
|
130
|
-
type: "percent";
|
|
131
|
-
} | {
|
|
132
|
-
type: "custom";
|
|
133
|
-
suffix?: string;
|
|
134
|
-
prefix?: string;
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
export declare interface ChatDashboardMetricItem extends ChatDashboardItemBase {
|
|
138
|
-
type: "metric";
|
|
139
|
-
format?: ChatDashboardMetricFormat;
|
|
140
|
-
decimals?: number;
|
|
141
|
-
computation: MetricComputation;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
declare interface ChatDashboardPieChartConfig {
|
|
145
|
-
type: "pie";
|
|
146
|
-
innerRadius?: number;
|
|
147
|
-
showLegend?: boolean;
|
|
148
|
-
showLabels?: boolean;
|
|
149
|
-
showPercentage?: boolean;
|
|
150
|
-
valueFormat?: FormatPreset;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
declare interface ChatDashboardRadarChartConfig extends ChatDashboardChartConfigBase {
|
|
154
|
-
type: "radar";
|
|
155
|
-
showArea?: boolean;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
export declare interface CollectionComputation {
|
|
159
|
-
datasetId: string;
|
|
160
|
-
sortBy?: string;
|
|
161
|
-
sortOrder?: "asc" | "desc";
|
|
162
|
-
limit?: number;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
export declare interface DashboardFetchSpec {
|
|
166
|
-
fetch: Array<{
|
|
167
|
-
toolId: string;
|
|
168
|
-
args: Record<string, unknown>;
|
|
169
|
-
}>;
|
|
170
|
-
query: string | null;
|
|
171
|
-
columnLabels?: Record<string, string>;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Minimal descriptor of a dashboard item's position and size.
|
|
176
|
-
* Used by `onLayoutChange` so the consumer can reconcile layout
|
|
177
|
-
* edits against its own source-of-truth config items.
|
|
178
|
-
*/
|
|
179
|
-
declare type DashboardItemLayout = {
|
|
180
|
-
id: string;
|
|
181
|
-
colSpan: number;
|
|
182
|
-
rowSpan: number;
|
|
183
|
-
x: number;
|
|
184
|
-
y: number;
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* Renders an F0AnalyticsDashboard from a server-computed config.
|
|
189
|
-
*
|
|
190
|
-
* All data computation happens server-side via POST /api/dashboard/compute.
|
|
191
|
-
* Multiple widget fetchData calls within the same filter state share a
|
|
192
|
-
* single batch request.
|
|
193
|
-
*/
|
|
194
|
-
export declare function F0ChatDashboard({ config, apiConfig, refreshKey, editMode, onLayoutChange, }: F0ChatDashboardProps): JSX_2.Element;
|
|
195
|
-
|
|
196
|
-
export declare namespace F0ChatDashboard {
|
|
197
|
-
var displayName: string;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
export declare interface F0ChatDashboardProps {
|
|
201
|
-
config: ChatDashboardConfig;
|
|
202
|
-
apiConfig: {
|
|
203
|
-
baseUrl: string;
|
|
204
|
-
headers: Record<string, string>;
|
|
205
|
-
};
|
|
206
|
-
refreshKey?: number;
|
|
207
|
-
editMode?: boolean;
|
|
208
|
-
onLayoutChange?: (layout: DashboardItemLayout[]) => void;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* A preset formatting instruction the LLM can specify instead of a
|
|
213
|
-
* real formatter function. The wrapper component maps these to actual
|
|
214
|
-
* `(value: number) => string` functions at render time.
|
|
215
|
-
*/
|
|
216
|
-
export declare type FormatPreset = {
|
|
217
|
-
type: "number";
|
|
218
|
-
} | {
|
|
219
|
-
type: "currency";
|
|
220
|
-
currency?: string;
|
|
221
|
-
} | {
|
|
222
|
-
type: "percent";
|
|
223
|
-
} | {
|
|
224
|
-
type: "compact";
|
|
225
|
-
};
|
|
226
|
-
|
|
227
|
-
declare interface GaugeComputation {
|
|
228
|
-
datasetId: string;
|
|
229
|
-
aggregation: AggregationType;
|
|
230
|
-
column?: string;
|
|
231
|
-
min?: number;
|
|
232
|
-
max?: number;
|
|
233
|
-
name?: string;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
declare interface HeatmapComputation {
|
|
237
|
-
datasetId: string;
|
|
238
|
-
xAxis: string;
|
|
239
|
-
yAxis: string;
|
|
240
|
-
valueColumn: string;
|
|
241
|
-
aggregation: AggregationType;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
export declare interface MetricComputation {
|
|
245
|
-
datasetId: string;
|
|
246
|
-
aggregation: AggregationType;
|
|
247
|
-
column?: string;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
declare interface PieComputation {
|
|
251
|
-
datasetId: string;
|
|
252
|
-
nameColumn: string;
|
|
253
|
-
valueColumn: string;
|
|
254
|
-
aggregation: AggregationType;
|
|
255
|
-
sortBy?: "value" | "name";
|
|
256
|
-
sortOrder?: "asc" | "desc";
|
|
257
|
-
limit?: number;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
declare interface RadarComputation {
|
|
261
|
-
datasetId: string;
|
|
262
|
-
seriesColumn: string;
|
|
263
|
-
indicators: Array<{
|
|
264
|
-
column: string;
|
|
265
|
-
label: string;
|
|
266
|
-
max?: number;
|
|
267
|
-
}>;
|
|
268
|
-
limit?: number;
|
|
269
|
-
sortBy?: string;
|
|
270
|
-
sortOrder?: "asc" | "desc";
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
export { }
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
declare global {
|
|
277
|
-
interface Window {
|
|
278
|
-
XRay: {
|
|
279
|
-
enable: (filter?: ComponentTypes[]) => void;
|
|
280
|
-
disable: () => void;
|
|
281
|
-
};
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
declare namespace _DaytimePage {
|
|
287
|
-
var displayName: string;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
declare namespace _Page {
|
|
292
|
-
var displayName: string;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
declare module "gridstack" {
|
|
296
|
-
interface GridStackWidget {
|
|
297
|
-
id?: string;
|
|
298
|
-
allowedSizes?: Array<{
|
|
299
|
-
w: number;
|
|
300
|
-
h: number;
|
|
301
|
-
}>;
|
|
302
|
-
meta?: Record<string, unknown>;
|
|
303
|
-
}
|
|
304
|
-
interface GridStackNode {
|
|
305
|
-
allowedSizes?: Array<{
|
|
306
|
-
w: number;
|
|
307
|
-
h: number;
|
|
308
|
-
}>;
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
declare module "@tiptap/core" {
|
|
314
|
-
interface Commands<ReturnType> {
|
|
315
|
-
aiBlock: {
|
|
316
|
-
insertAIBlock: (data: AIBlockData, config: AIBlockConfig) => ReturnType;
|
|
317
|
-
executeAIAction: (actionType: string, config: AIBlockConfig) => ReturnType;
|
|
318
|
-
};
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
declare module "@tiptap/core" {
|
|
324
|
-
interface Commands<ReturnType> {
|
|
325
|
-
enhanceHighlight: {
|
|
326
|
-
setEnhanceHighlight: (from: number, to: number) => ReturnType;
|
|
327
|
-
clearEnhanceHighlight: () => ReturnType;
|
|
328
|
-
};
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
declare module "@tiptap/core" {
|
|
334
|
-
interface Commands<ReturnType> {
|
|
335
|
-
moodTracker: {
|
|
336
|
-
insertMoodTracker: (data: MoodTrackerData) => ReturnType;
|
|
337
|
-
};
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
declare module "@tiptap/core" {
|
|
343
|
-
interface Commands<ReturnType> {
|
|
344
|
-
transcript: {
|
|
345
|
-
insertTranscript: (data: TranscriptData) => ReturnType;
|
|
346
|
-
};
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
declare module "@tiptap/core" {
|
|
352
|
-
interface Commands<ReturnType> {
|
|
353
|
-
videoEmbed: {
|
|
354
|
-
setVideoEmbed: (options: {
|
|
355
|
-
src: string;
|
|
356
|
-
}) => ReturnType;
|
|
357
|
-
};
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
declare namespace Calendar {
|
|
363
|
-
var displayName: string;
|
|
364
|
-
}
|
package/dist/F0ChatDashboard.js
DELETED
|
@@ -1,292 +0,0 @@
|
|
|
1
|
-
import { jsx as $ } from "react/jsx-runtime";
|
|
2
|
-
import { useRef as w, useCallback as v, useState as j, useEffect as R, useMemo as D } from "react";
|
|
3
|
-
import { F as P } from "./F0AnalyticsDashboard-BhvG-yU1.js";
|
|
4
|
-
function _(t, e, n) {
|
|
5
|
-
const r = w(null), y = w(), i = w(t);
|
|
6
|
-
i.current = t;
|
|
7
|
-
const l = w(e);
|
|
8
|
-
l.current = e;
|
|
9
|
-
const b = w(n);
|
|
10
|
-
b.current = n;
|
|
11
|
-
const u = v(
|
|
12
|
-
(h, f) => {
|
|
13
|
-
const S = `${b.current}:${JSON.stringify(f)}`;
|
|
14
|
-
if (r.current?.key === S)
|
|
15
|
-
return r.current.promise.then(
|
|
16
|
-
(d) => d.results[h] ?? { error: "No result for item" }
|
|
17
|
-
);
|
|
18
|
-
r.current?.controller.abort();
|
|
19
|
-
const o = new AbortController(), s = i.current, c = l.current, g = {};
|
|
20
|
-
for (const [d, m] of Object.entries(f))
|
|
21
|
-
Array.isArray(m) && m.length > 0 && (g[d] = m.map(String));
|
|
22
|
-
const a = {
|
|
23
|
-
fetchSpecs: s.fetchSpecs,
|
|
24
|
-
items: s.items,
|
|
25
|
-
filters: s.filters,
|
|
26
|
-
filterValues: Object.keys(g).length > 0 ? g : void 0
|
|
27
|
-
}, F = fetch(`${c.baseUrl}/dashboard/compute`, {
|
|
28
|
-
method: "POST",
|
|
29
|
-
credentials: "include",
|
|
30
|
-
headers: {
|
|
31
|
-
"Content-Type": "application/json",
|
|
32
|
-
...c.headers
|
|
33
|
-
},
|
|
34
|
-
body: JSON.stringify(a),
|
|
35
|
-
signal: o.signal
|
|
36
|
-
}).then(async (d) => {
|
|
37
|
-
if (!d.ok) {
|
|
38
|
-
const k = await d.text().catch(() => "");
|
|
39
|
-
throw new Error(`Dashboard compute failed: ${d.status} ${k}`);
|
|
40
|
-
}
|
|
41
|
-
const m = await d.json();
|
|
42
|
-
return y.current = m, m;
|
|
43
|
-
});
|
|
44
|
-
return r.current = { key: S, promise: F, controller: o }, F.then(
|
|
45
|
-
(d) => d.results[h] ?? { error: "No result for item" }
|
|
46
|
-
);
|
|
47
|
-
},
|
|
48
|
-
[]
|
|
49
|
-
), p = v(
|
|
50
|
-
() => y.current?.filterOptions,
|
|
51
|
-
[]
|
|
52
|
-
);
|
|
53
|
-
return { fetchItem: u, getFilterOptions: p };
|
|
54
|
-
}
|
|
55
|
-
function A(t) {
|
|
56
|
-
if (t)
|
|
57
|
-
switch (t.type) {
|
|
58
|
-
case "number":
|
|
59
|
-
return (e) => e.toLocaleString();
|
|
60
|
-
case "currency": {
|
|
61
|
-
const e = t.currency ?? "EUR";
|
|
62
|
-
return (n) => {
|
|
63
|
-
try {
|
|
64
|
-
return n.toLocaleString(void 0, {
|
|
65
|
-
style: "currency",
|
|
66
|
-
currency: e,
|
|
67
|
-
maximumFractionDigits: 0
|
|
68
|
-
});
|
|
69
|
-
} catch {
|
|
70
|
-
return `${n}`;
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
case "percent":
|
|
75
|
-
return (e) => `${e}%`;
|
|
76
|
-
case "compact":
|
|
77
|
-
return (e) => Math.abs(e) >= 1e6 ? `${(e / 1e6).toFixed(1)}M` : Math.abs(e) >= 1e3 ? `${(e / 1e3).toFixed(1)}k` : `${e}`;
|
|
78
|
-
default:
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
function I(t) {
|
|
83
|
-
const e = A(
|
|
84
|
-
"valueFormat" in t ? t.valueFormat : void 0
|
|
85
|
-
);
|
|
86
|
-
switch (t.type) {
|
|
87
|
-
case "bar": {
|
|
88
|
-
const { valueFormat: n, ...r } = t;
|
|
89
|
-
return { ...r, ...e ? { valueFormatter: e } : {} };
|
|
90
|
-
}
|
|
91
|
-
case "line": {
|
|
92
|
-
const { valueFormat: n, ...r } = t;
|
|
93
|
-
return { ...r, ...e ? { valueFormatter: e } : {} };
|
|
94
|
-
}
|
|
95
|
-
case "funnel": {
|
|
96
|
-
const { valueFormat: n, ...r } = t;
|
|
97
|
-
return { ...r, ...e ? { valueFormatter: e } : {} };
|
|
98
|
-
}
|
|
99
|
-
case "radar": {
|
|
100
|
-
const { valueFormat: n, ...r } = t;
|
|
101
|
-
return { ...r, ...e ? { valueFormatter: e } : {} };
|
|
102
|
-
}
|
|
103
|
-
case "pie": {
|
|
104
|
-
const { valueFormat: n, ...r } = t;
|
|
105
|
-
return { ...r, ...e ? { valueFormatter: e } : {} };
|
|
106
|
-
}
|
|
107
|
-
case "gauge": {
|
|
108
|
-
const { valueFormat: n, ...r } = t;
|
|
109
|
-
return { ...r, ...e ? { valueFormatter: e } : {} };
|
|
110
|
-
}
|
|
111
|
-
case "heatmap": {
|
|
112
|
-
const { valueFormat: n, ...r } = t;
|
|
113
|
-
return { ...r, ...e ? { valueFormatter: e } : {} };
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
const x = 20;
|
|
118
|
-
function C({
|
|
119
|
-
config: t,
|
|
120
|
-
apiConfig: e,
|
|
121
|
-
refreshKey: n = 0,
|
|
122
|
-
editMode: r,
|
|
123
|
-
onLayoutChange: y
|
|
124
|
-
}) {
|
|
125
|
-
const { fetchItem: i, getFilterOptions: l } = _(
|
|
126
|
-
t,
|
|
127
|
-
e,
|
|
128
|
-
n
|
|
129
|
-
), [b, u] = j(), p = w(!1);
|
|
130
|
-
R(() => {
|
|
131
|
-
p.current = !1;
|
|
132
|
-
}, [n]), R(() => {
|
|
133
|
-
if (p.current) return;
|
|
134
|
-
const o = setInterval(() => {
|
|
135
|
-
const s = l();
|
|
136
|
-
s && (u(s), p.current = !0, clearInterval(o));
|
|
137
|
-
}, 100);
|
|
138
|
-
return () => clearInterval(o);
|
|
139
|
-
}, [l, n]);
|
|
140
|
-
const h = D(() => {
|
|
141
|
-
const o = t.filters;
|
|
142
|
-
if (!o || Object.keys(o).length === 0 || !b) return;
|
|
143
|
-
const s = {};
|
|
144
|
-
for (const [c, g] of Object.entries(o)) {
|
|
145
|
-
const a = b[c] ?? [];
|
|
146
|
-
a.length !== 0 && (s[c] = {
|
|
147
|
-
type: "in",
|
|
148
|
-
label: g.label,
|
|
149
|
-
options: {
|
|
150
|
-
options: a.map((F) => ({ value: F, label: F }))
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
if (Object.keys(s).length !== 0)
|
|
155
|
-
return s;
|
|
156
|
-
}, [t.filters, b]), f = v(
|
|
157
|
-
(o) => (s) => {
|
|
158
|
-
const c = {};
|
|
159
|
-
for (const [g, a] of Object.entries(s))
|
|
160
|
-
Array.isArray(a) && a.length > 0 && (c[g] = a);
|
|
161
|
-
return i(o, c).then((g) => {
|
|
162
|
-
const a = l();
|
|
163
|
-
return a && !p.current && (u(a), p.current = !0), g;
|
|
164
|
-
});
|
|
165
|
-
},
|
|
166
|
-
[i, l]
|
|
167
|
-
), S = D(
|
|
168
|
-
() => t.items.map((o) => {
|
|
169
|
-
switch (o.type) {
|
|
170
|
-
case "chart":
|
|
171
|
-
return E(o, f(o.id));
|
|
172
|
-
case "metric":
|
|
173
|
-
return L(o, f(o.id));
|
|
174
|
-
case "collection":
|
|
175
|
-
return M(o, f(o.id));
|
|
176
|
-
}
|
|
177
|
-
}),
|
|
178
|
-
[t.items, f]
|
|
179
|
-
);
|
|
180
|
-
return /* @__PURE__ */ $(
|
|
181
|
-
P,
|
|
182
|
-
{
|
|
183
|
-
filters: h,
|
|
184
|
-
items: S,
|
|
185
|
-
editMode: r,
|
|
186
|
-
onLayoutChange: y
|
|
187
|
-
},
|
|
188
|
-
n
|
|
189
|
-
);
|
|
190
|
-
}
|
|
191
|
-
C.displayName = "F0ChatDashboard";
|
|
192
|
-
function E(t, e) {
|
|
193
|
-
return {
|
|
194
|
-
id: t.id,
|
|
195
|
-
title: t.title,
|
|
196
|
-
description: O(t.description, t.sourceDescription),
|
|
197
|
-
colSpan: t.colSpan,
|
|
198
|
-
rowSpan: t.rowSpan,
|
|
199
|
-
x: t.x,
|
|
200
|
-
y: t.y,
|
|
201
|
-
type: "chart",
|
|
202
|
-
chart: I(t.chart),
|
|
203
|
-
fetchData: (n) => e(n).then((r) => r.chart ?? { categories: [], series: [] })
|
|
204
|
-
};
|
|
205
|
-
}
|
|
206
|
-
function O(t, e) {
|
|
207
|
-
return e ? t ? `${t}
|
|
208
|
-
${e}` : e : t;
|
|
209
|
-
}
|
|
210
|
-
function L(t, e) {
|
|
211
|
-
return {
|
|
212
|
-
id: t.id,
|
|
213
|
-
title: t.title,
|
|
214
|
-
description: O(t.description, t.sourceDescription),
|
|
215
|
-
colSpan: t.colSpan,
|
|
216
|
-
rowSpan: t.rowSpan,
|
|
217
|
-
x: t.x,
|
|
218
|
-
y: t.y,
|
|
219
|
-
type: "metric",
|
|
220
|
-
format: t.format,
|
|
221
|
-
decimals: t.decimals,
|
|
222
|
-
fetchData: (n) => e(n).then((r) => r.metric ?? { value: 0 })
|
|
223
|
-
};
|
|
224
|
-
}
|
|
225
|
-
function M(t, e) {
|
|
226
|
-
return {
|
|
227
|
-
id: t.id,
|
|
228
|
-
title: t.title,
|
|
229
|
-
description: O(t.description, t.sourceDescription),
|
|
230
|
-
colSpan: t.colSpan ?? 12,
|
|
231
|
-
rowSpan: t.rowSpan,
|
|
232
|
-
x: t.x,
|
|
233
|
-
y: t.y,
|
|
234
|
-
type: "collection",
|
|
235
|
-
createSource: (n) => {
|
|
236
|
-
let r = null;
|
|
237
|
-
const y = e(n).then((i) => (r = i.collection?.rows ?? [], r));
|
|
238
|
-
return {
|
|
239
|
-
dataAdapter: {
|
|
240
|
-
paginationType: "pages",
|
|
241
|
-
perPage: x,
|
|
242
|
-
fetchData: async ({
|
|
243
|
-
pagination: i,
|
|
244
|
-
search: l
|
|
245
|
-
}) => {
|
|
246
|
-
let u = r ?? await y;
|
|
247
|
-
if (l) {
|
|
248
|
-
const o = l.toLowerCase();
|
|
249
|
-
u = u.filter(
|
|
250
|
-
(s) => Object.values(s).some(
|
|
251
|
-
(c) => c != null && String(c).toLowerCase().includes(o)
|
|
252
|
-
)
|
|
253
|
-
);
|
|
254
|
-
}
|
|
255
|
-
const p = i?.currentPage ?? 1, h = i?.perPage ?? x, f = (p - 1) * h;
|
|
256
|
-
return {
|
|
257
|
-
type: "pages",
|
|
258
|
-
records: u.slice(f, f + h),
|
|
259
|
-
total: u.length,
|
|
260
|
-
currentPage: p,
|
|
261
|
-
perPage: h,
|
|
262
|
-
pagesCount: Math.ceil(u.length / h)
|
|
263
|
-
};
|
|
264
|
-
}
|
|
265
|
-
},
|
|
266
|
-
search: {
|
|
267
|
-
enabled: !0,
|
|
268
|
-
sync: !0
|
|
269
|
-
}
|
|
270
|
-
};
|
|
271
|
-
},
|
|
272
|
-
visualizations: [
|
|
273
|
-
{
|
|
274
|
-
type: "table",
|
|
275
|
-
options: {
|
|
276
|
-
columns: t.columns.map((n) => ({
|
|
277
|
-
label: n.label,
|
|
278
|
-
id: n.id,
|
|
279
|
-
...n.width ? { width: n.width } : {},
|
|
280
|
-
render: (r) => {
|
|
281
|
-
const y = r[n.id];
|
|
282
|
-
return y == null ? "-" : String(y);
|
|
283
|
-
}
|
|
284
|
-
}))
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
]
|
|
288
|
-
};
|
|
289
|
-
}
|
|
290
|
-
export {
|
|
291
|
-
C as F0ChatDashboard
|
|
292
|
-
};
|