@burdenoff/microfe-bigconsole 2026.1012.4 → 2026.1012.6
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/bigconsole/BigConsoleRoutes.js +149 -140
- package/dist/bigconsole/assistant/assistantProduct.js +4 -1
- package/dist/bigconsole/assistant/displayCopy.d.ts +32 -0
- package/dist/bigconsole/assistant/pageContext.d.ts +14 -0
- package/dist/bigconsole/assistant/pageContext.js +6 -1
- package/dist/bigconsole/assistant/pageControls.d.ts +81 -0
- package/dist/bigconsole/assistant/pageControls.js +169 -0
- package/dist/bigconsole/assistant/previewControl.d.ts +16 -0
- package/dist/bigconsole/assistant/previewControl.js +10 -0
- package/dist/bigconsole/assistant/recordAdapters.js +27 -26
- package/dist/bigconsole/assistant/usePreviewControl.d.ts +2 -0
- package/dist/bigconsole/assistant/usePreviewControl.js +20 -0
- package/dist/bigconsole/components/builder/inspector/AppearanceSection.js +9 -9
- package/dist/bigconsole/components/builder/inspector/DataBindingSection.js +31 -31
- package/dist/bigconsole/components/common/SortBySelect.d.ts +11 -0
- package/dist/bigconsole/components/common/SortBySelect.js +29 -0
- package/dist/bigconsole/components/common/index.d.ts +1 -0
- package/dist/bigconsole/components/common/index.js +1 -0
- package/dist/bigconsole/components/dashboard/CreateDashboardDialog.js +44 -44
- package/dist/bigconsole/components/dashboard/DashboardCanvas.js +36 -36
- package/dist/bigconsole/components/dashboard/DashboardToolbar.js +59 -59
- package/dist/bigconsole/components/dashboard/DrilldownBreadcrumb.js +15 -15
- package/dist/bigconsole/components/dashboard/GlobalFiltersBar/FilterChip.js +30 -30
- package/dist/bigconsole/components/dashboard/GlobalFiltersBar/FilterEditor.js +41 -41
- package/dist/bigconsole/components/dashboard/GlobalFiltersBar/FilterPresetSelector.js +34 -34
- package/dist/bigconsole/components/dashboard/GlobalFiltersBar/GlobalFiltersBar.js +34 -34
- package/dist/bigconsole/components/dashboard/ImportDashboardDialog.js +153 -153
- package/dist/bigconsole/components/dashboard/PublishToStoreDialog.js +21 -21
- package/dist/bigconsole/components/dashboard/SavedViewsDropdown/SavedViewsDropdown.js +46 -46
- package/dist/bigconsole/components/dashboard/ShareDialog/EmbedTab.js +134 -134
- package/dist/bigconsole/components/dashboard/ShareDialog/ShareDialog.js +101 -101
- package/dist/bigconsole/components/dashboard/TemplateInstallOptions.js +31 -31
- package/dist/bigconsole/components/dashboard/TemplateLayoutPreview.js +15 -15
- package/dist/bigconsole/components/dashboard/TemplatePicker/TemplatePicker.js +1 -1
- package/dist/bigconsole/components/dashboard/WidgetPalette.js +46 -46
- package/dist/bigconsole/components/datasink/AlertExecutionHistory.js +37 -37
- package/dist/bigconsole/components/datasink/AlertRuleEditor.js +66 -66
- package/dist/bigconsole/components/datasink/CacheTTLSelector.js +35 -35
- package/dist/bigconsole/components/datasink/DataSinkCard.js +51 -50
- package/dist/bigconsole/components/datasink/DataSinkDeleteDialog.js +18 -18
- package/dist/bigconsole/components/datasink/DataSinkRefreshDialog.js +20 -20
- package/dist/bigconsole/components/datasink/ImportDataGuideDialog.js +47 -47
- package/dist/bigconsole/components/datasink/ImportDataSinkDialog.js +91 -91
- package/dist/bigconsole/components/datasink/RefreshTypeSelector.js +35 -35
- package/dist/bigconsole/components/parser/DataSinkSelector.js +40 -40
- package/dist/bigconsole/components/parser/ImportParserDialog.js +120 -120
- package/dist/bigconsole/components/parser/ParserSelector.js +51 -51
- package/dist/bigconsole/components/pipeline/PipelineScopePicker.js +10 -10
- package/dist/bigconsole/components/preview/AiPreviewContent.js +0 -1
- package/dist/bigconsole/components/preview/AiPreviewMiniPanel.js +77 -76
- package/dist/bigconsole/components/preview/AiPreviewPanel.js +96 -95
- package/dist/bigconsole/components/widgets/ActionConfigDialog.js +4 -4
- package/dist/bigconsole/components/widgets/DrilldownConfigPanel.js +93 -93
- package/dist/bigconsole/components/widgets/PropertiesPanel.js +507 -499
- package/dist/bigconsole/components/widgets/advanced/AdvancedWidgetConfig.js +14 -14
- package/dist/bigconsole/components/widgets/advanced/AdvancedWidgets.js +68 -67
- package/dist/bigconsole/components/widgets/advanced/boxPlotDescription.d.ts +7 -0
- package/dist/bigconsole/components/widgets/advanced/boxPlotDescription.js +12 -0
- package/dist/bigconsole/components/widgets/calendar/CalendarWidget.js +4 -4
- package/dist/bigconsole/components/widgets/chart/ChartConfig.js +48 -48
- package/dist/bigconsole/components/widgets/comments/WidgetComments.js +46 -46
- package/dist/bigconsole/components/widgets/event-logs/EventLogViewer.js +61 -61
- package/dist/bigconsole/components/widgets/form/FormWidget.js +36 -36
- package/dist/bigconsole/components/widgets/gauge/GaugeConfig.js +42 -42
- package/dist/bigconsole/components/widgets/heatmap/HeatmapConfig.js +25 -25
- package/dist/bigconsole/components/widgets/kanban/KanbanWidget.js +4 -4
- package/dist/bigconsole/components/widgets/list/ListConfig.js +30 -30
- package/dist/bigconsole/components/widgets/metric-card/MetricCardConfig.js +38 -38
- package/dist/bigconsole/components/widgets/metric-card/SparklineChart.js +9 -9
- package/dist/bigconsole/components/widgets/metric-card/TrendIndicator.js +9 -9
- package/dist/bigconsole/components/widgets/pivot-table/PivotTableWidget.js +49 -49
- package/dist/bigconsole/components/widgets/progress/ProgressConfig.js +39 -39
- package/dist/bigconsole/components/widgets/table/TableConfig.js +73 -73
- package/dist/bigconsole/components/widgets/webhook-config/WebhookConfigPanel.js +64 -64
- package/dist/bigconsole/components/workflow/WorkflowOpenGuard.js +15 -15
- package/dist/bigconsole/components/workflow/WorkflowSinkLinkForm.js +15 -15
- package/dist/bigconsole/constants/backendErrors.js +94 -0
- package/dist/bigconsole/customWidget/CustomWidgetBuilderSheet.js +10 -10
- package/dist/bigconsole/customWidget/CustomWidgetProposalPanel.js +67 -67
- package/dist/bigconsole/hooks/useDashboardLayoutBaseline.d.ts +14 -0
- package/dist/bigconsole/hooks/useDashboardLayoutBaseline.js +32 -0
- package/dist/bigconsole/hooks/useDataSinkAlerts.d.ts +23 -0
- package/dist/bigconsole/hooks/useDataSinkAlerts.js +138 -113
- package/dist/bigconsole/hooks/useDrilldown.js +3 -3
- package/dist/bigconsole/hooks/useGlobalFilters.js +3 -3
- package/dist/bigconsole/pages/AdminPage.js +130 -130
- package/dist/bigconsole/pages/DashboardBuilderPage.js +72 -60
- package/dist/bigconsole/pages/DashboardViewPage.js +244 -221
- package/dist/bigconsole/pages/DashboardsPage.js +269 -221
- package/dist/bigconsole/pages/DataParsersPage.js +180 -157
- package/dist/bigconsole/pages/DataSinkAlertsPage.js +62 -55
- package/dist/bigconsole/pages/DataSinkBuilderPage.js +252 -234
- package/dist/bigconsole/pages/DataSinkViewPage.js +1 -1
- package/dist/bigconsole/pages/DataSinksPage.js +335 -299
- package/dist/bigconsole/pages/DataSourcesPage.js +5 -5
- package/dist/bigconsole/pages/InsightsPage.js +279 -265
- package/dist/bigconsole/pages/OverviewPage.js +47 -47
- package/dist/bigconsole/pages/ParserBuilderPage.js +229 -213
- package/dist/bigconsole/pages/ParserViewPage.js +97 -97
- package/dist/bigconsole/pages/PipelineBuilderPage.js +256 -214
- package/dist/bigconsole/pages/PipelineViewPage.js +146 -146
- package/dist/bigconsole/pages/PipelinesPage.js +107 -88
- package/dist/bigconsole/pages/SettingsPage.js +179 -173
- package/dist/bigconsole/pages/WidgetDemoPage.js +42 -42
- package/dist/bigconsole/pages/WorkflowViewPage.js +1 -1
- package/dist/bigconsole/pages/WorkflowsPage.js +141 -141
- package/dist/bigconsole/providers/BigConsoleQuotaProvider.js +12 -12
- package/dist/bigconsole/renderers/adapters/AdaptiveCardRenderer.js +34 -34
- package/dist/bigconsole/renderers/adapters/BlockKitRenderer.js +69 -69
- package/dist/bigconsole/renderers/adapters/CustomRenderer.js +46 -46
- package/dist/bigconsole/store/widgetStore.d.ts +12 -0
- package/dist/bigconsole/store/widgetStore.js +3 -1
- package/dist/bigconsole/utils/backendError.d.ts +18 -0
- package/dist/bigconsole/utils/backendError.js +42 -0
- package/dist/bigconsole/utils/dashboardList.d.ts +28 -0
- package/dist/bigconsole/utils/dashboardList.js +15 -0
- package/dist/bigconsole/utils/dataSinkList.d.ts +15 -0
- package/dist/bigconsole/utils/dataSinkList.js +15 -0
- package/dist/bigconsole/utils/formDirty.d.ts +82 -0
- package/dist/bigconsole/utils/formDirty.js +21 -0
- package/dist/bigconsole/utils/insightsDraft.d.ts +29 -0
- package/dist/bigconsole/utils/insightsDraft.js +8 -0
- package/dist/bigconsole/utils/layoutBaseline.d.ts +130 -0
- package/dist/bigconsole/utils/layoutBaseline.js +96 -0
- package/dist/bigconsole/utils/listSort.d.ts +80 -0
- package/dist/bigconsole/utils/listSort.js +85 -0
- package/dist/bigconsole/utils/widgetFormDirty.d.ts +16 -0
- package/dist/bigconsole/utils/widgetFormDirty.js +13 -0
- package/dist/bigconsole/workflowOpen.js +15 -14
- package/package.json +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { memo as e, useMemo as t } from "react";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { useI18n as n } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
3
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
4
4
|
//#region src/bigconsole/renderers/adapters/CustomRenderer.tsx
|
|
5
5
|
var a = /* @__PURE__ */ new Map();
|
|
6
6
|
function o(e, t) {
|
|
@@ -13,77 +13,77 @@ function c() {
|
|
|
13
13
|
return Array.from(a.keys());
|
|
14
14
|
}
|
|
15
15
|
o("SimpleText", ({ data: e, props: t }) => {
|
|
16
|
-
let { t:
|
|
17
|
-
return a ? /* @__PURE__ */
|
|
16
|
+
let { t: i } = n(), a = e.text || t?.text, o = t?.align || "left";
|
|
17
|
+
return a ? /* @__PURE__ */ r("div", {
|
|
18
18
|
className: `p-4 text-${o}`,
|
|
19
|
-
children: /* @__PURE__ */
|
|
19
|
+
children: /* @__PURE__ */ r("p", {
|
|
20
20
|
className: "text-primary",
|
|
21
21
|
children: a
|
|
22
22
|
})
|
|
23
|
-
}) : /* @__PURE__ */
|
|
23
|
+
}) : /* @__PURE__ */ r("div", {
|
|
24
24
|
className: "flex items-center justify-center h-full p-4 text-secondary",
|
|
25
|
-
children: /* @__PURE__ */
|
|
25
|
+
children: /* @__PURE__ */ r("p", {
|
|
26
26
|
className: "text-sm",
|
|
27
|
-
children:
|
|
27
|
+
children: i("bigconsole.widget.renderer.custom.noData", "No data available")
|
|
28
28
|
})
|
|
29
29
|
});
|
|
30
30
|
}), o("Counter", ({ data: e, props: t }) => {
|
|
31
|
-
let { t: a } =
|
|
32
|
-
if (o == null) return /* @__PURE__ */
|
|
31
|
+
let { t: a } = n(), o = e.value ?? t?.value, s = e.label || t?.label, c = t?.format || "number";
|
|
32
|
+
if (o == null) return /* @__PURE__ */ r("div", {
|
|
33
33
|
className: "flex flex-col items-center justify-center h-full p-4 text-secondary",
|
|
34
|
-
children: /* @__PURE__ */
|
|
34
|
+
children: /* @__PURE__ */ r("p", {
|
|
35
35
|
className: "text-sm",
|
|
36
36
|
children: a("bigconsole.widget.renderer.custom.noData", "No data available")
|
|
37
37
|
})
|
|
38
38
|
});
|
|
39
39
|
let l = o;
|
|
40
|
-
return /* @__PURE__ */
|
|
40
|
+
return /* @__PURE__ */ i("div", {
|
|
41
41
|
className: "flex flex-col items-center justify-center h-full p-4 animate-in fade-in duration-200",
|
|
42
|
-
children: [/* @__PURE__ */
|
|
42
|
+
children: [/* @__PURE__ */ r("span", {
|
|
43
43
|
className: "text-3xl font-bold text-primary",
|
|
44
44
|
children: c === "currency" ? new Intl.NumberFormat("en-US", {
|
|
45
45
|
style: "currency",
|
|
46
46
|
currency: "USD"
|
|
47
47
|
}).format(l) : c === "percent" ? `${(l * 100).toFixed(1)}%` : new Intl.NumberFormat().format(l)
|
|
48
|
-
}), s && /* @__PURE__ */
|
|
48
|
+
}), s && /* @__PURE__ */ r("span", {
|
|
49
49
|
className: "text-sm text-secondary mt-1",
|
|
50
50
|
children: s
|
|
51
51
|
})]
|
|
52
52
|
});
|
|
53
53
|
}), o("Card", ({ data: e, props: t, onAction: a }) => {
|
|
54
|
-
let { t: o } =
|
|
55
|
-
if (!s && !c) return /* @__PURE__ */
|
|
54
|
+
let { t: o } = n(), s = e.title || t?.title, c = e.description || t?.description || "";
|
|
55
|
+
if (!s && !c) return /* @__PURE__ */ r("div", {
|
|
56
56
|
className: "flex items-center justify-center h-full p-4 text-secondary",
|
|
57
|
-
children: /* @__PURE__ */
|
|
57
|
+
children: /* @__PURE__ */ r("p", {
|
|
58
58
|
className: "text-sm",
|
|
59
59
|
children: o("bigconsole.widget.renderer.custom.noData", "No data available")
|
|
60
60
|
})
|
|
61
61
|
});
|
|
62
62
|
let l = e.image || t?.image, u = t?.actionLabel || o("bigconsole.widget.renderer.custom.viewDetails", "View Details"), d = t?.showAction !== !1;
|
|
63
|
-
return /* @__PURE__ */
|
|
63
|
+
return /* @__PURE__ */ i("div", {
|
|
64
64
|
className: "flex flex-col h-full bg-surface rounded-lg overflow-hidden animate-in fade-in duration-200",
|
|
65
65
|
children: [
|
|
66
|
-
l && /* @__PURE__ */
|
|
66
|
+
l && /* @__PURE__ */ r("div", {
|
|
67
67
|
className: "aspect-video bg-bg-sunken",
|
|
68
|
-
children: /* @__PURE__ */
|
|
68
|
+
children: /* @__PURE__ */ r("img", {
|
|
69
69
|
src: l,
|
|
70
70
|
alt: "",
|
|
71
71
|
className: "w-full h-full object-cover"
|
|
72
72
|
})
|
|
73
73
|
}),
|
|
74
|
-
/* @__PURE__ */
|
|
74
|
+
/* @__PURE__ */ i("div", {
|
|
75
75
|
className: "flex-1 p-4",
|
|
76
|
-
children: [s && /* @__PURE__ */
|
|
76
|
+
children: [s && /* @__PURE__ */ r("h3", {
|
|
77
77
|
className: "text-lg font-semibold text-primary",
|
|
78
78
|
children: s
|
|
79
|
-
}), c && /* @__PURE__ */
|
|
79
|
+
}), c && /* @__PURE__ */ r("p", {
|
|
80
80
|
className: "text-sm text-secondary mt-1",
|
|
81
81
|
children: c
|
|
82
82
|
})]
|
|
83
83
|
}),
|
|
84
|
-
d && /* @__PURE__ */
|
|
84
|
+
d && /* @__PURE__ */ r("div", {
|
|
85
85
|
className: "p-4 pt-0",
|
|
86
|
-
children: /* @__PURE__ */
|
|
86
|
+
children: /* @__PURE__ */ r("button", {
|
|
87
87
|
type: "button",
|
|
88
88
|
onClick: () => a?.("click", { title: s }),
|
|
89
89
|
className: "w-full px-4 py-2 text-sm font-medium text-white bg-action-primary hover:bg-action-primary/90 rounded-md transition-colors",
|
|
@@ -94,25 +94,25 @@ o("SimpleText", ({ data: e, props: t }) => {
|
|
|
94
94
|
});
|
|
95
95
|
});
|
|
96
96
|
var l = ({ componentName: e }) => {
|
|
97
|
-
let { t } =
|
|
98
|
-
return /* @__PURE__ */
|
|
97
|
+
let { t } = n();
|
|
98
|
+
return /* @__PURE__ */ r("div", {
|
|
99
99
|
className: "flex flex-col items-center justify-center h-full p-4 text-secondary animate-in fade-in duration-200",
|
|
100
|
-
children: /* @__PURE__ */
|
|
100
|
+
children: /* @__PURE__ */ i("div", {
|
|
101
101
|
className: "text-center",
|
|
102
102
|
children: [
|
|
103
|
-
/* @__PURE__ */
|
|
103
|
+
/* @__PURE__ */ r("p", {
|
|
104
104
|
className: "font-medium",
|
|
105
105
|
children: t("bigconsole.widget.renderer.custom.componentNotFound", "Component Not Found")
|
|
106
106
|
}),
|
|
107
|
-
/* @__PURE__ */
|
|
107
|
+
/* @__PURE__ */ r("p", {
|
|
108
108
|
className: "text-sm mt-1",
|
|
109
109
|
children: t("bigconsole.widget.renderer.custom.componentNotRegistered", "Component \"{{name}}\" is not registered", { name: e ?? "" })
|
|
110
110
|
}),
|
|
111
|
-
/* @__PURE__ */
|
|
111
|
+
/* @__PURE__ */ i("div", {
|
|
112
112
|
className: "mt-4 text-xs",
|
|
113
|
-
children: [/* @__PURE__ */
|
|
113
|
+
children: [/* @__PURE__ */ r("p", { children: t("bigconsole.widget.renderer.custom.availableComponents", "Available components:") }), /* @__PURE__ */ r("ul", {
|
|
114
114
|
className: "mt-1",
|
|
115
|
-
children: c().map((e) => /* @__PURE__ */
|
|
115
|
+
children: c().map((e) => /* @__PURE__ */ r("li", {
|
|
116
116
|
className: "text-link",
|
|
117
117
|
children: e
|
|
118
118
|
}, e))
|
|
@@ -122,44 +122,44 @@ var l = ({ componentName: e }) => {
|
|
|
122
122
|
})
|
|
123
123
|
});
|
|
124
124
|
}, u = e(function({ widget: e, data: a, template: o, isLoading: c, error: u, onDrilldown: d, onAction: f }) {
|
|
125
|
-
let { t: p } =
|
|
125
|
+
let { t: p } = n(), m = t(() => {
|
|
126
126
|
if (o && typeof o == "object" && "componentName" in o) return o.componentName;
|
|
127
127
|
let t = e.config;
|
|
128
128
|
return t?.componentName || t?.componentId || "";
|
|
129
129
|
}, [o, e.config]), h = t(() => o && typeof o == "object" && "props" in o ? o.props : {}, [o]), g = t(() => m ? s(m) : null, [m]);
|
|
130
|
-
return c ? /* @__PURE__ */
|
|
130
|
+
return c ? /* @__PURE__ */ r("div", {
|
|
131
131
|
className: "flex items-center justify-center h-full p-4 animate-in fade-in duration-200",
|
|
132
|
-
children: /* @__PURE__ */
|
|
132
|
+
children: /* @__PURE__ */ i("div", {
|
|
133
133
|
className: "animate-pulse space-y-2 w-full",
|
|
134
|
-
children: [/* @__PURE__ */
|
|
134
|
+
children: [/* @__PURE__ */ r("div", { className: "h-4 bg-bg-sunken rounded w-3/4" }), /* @__PURE__ */ r("div", { className: "h-4 bg-bg-sunken rounded w-1/2" })]
|
|
135
135
|
})
|
|
136
|
-
}) : u ? /* @__PURE__ */
|
|
136
|
+
}) : u ? /* @__PURE__ */ r("div", {
|
|
137
137
|
className: "flex items-center justify-center h-full p-4 text-red-600 dark:text-red-400",
|
|
138
|
-
children: /* @__PURE__ */
|
|
138
|
+
children: /* @__PURE__ */ i("div", {
|
|
139
139
|
className: "text-center",
|
|
140
|
-
children: [/* @__PURE__ */
|
|
140
|
+
children: [/* @__PURE__ */ r("p", {
|
|
141
141
|
className: "font-medium",
|
|
142
142
|
children: p("bigconsole.widget.renderer.custom.errorRendering", "Error rendering component")
|
|
143
|
-
}), /* @__PURE__ */
|
|
143
|
+
}), /* @__PURE__ */ r("p", {
|
|
144
144
|
className: "text-sm mt-1",
|
|
145
145
|
children: u
|
|
146
146
|
})]
|
|
147
147
|
})
|
|
148
|
-
}) : m ? g ? /* @__PURE__ */
|
|
148
|
+
}) : m ? g ? /* @__PURE__ */ r(g, {
|
|
149
149
|
widget: e,
|
|
150
150
|
data: a,
|
|
151
151
|
template: o,
|
|
152
152
|
props: h,
|
|
153
153
|
onAction: f,
|
|
154
154
|
onDrilldown: d
|
|
155
|
-
}) : /* @__PURE__ */
|
|
155
|
+
}) : /* @__PURE__ */ r(l, { componentName: m }) : /* @__PURE__ */ r("div", {
|
|
156
156
|
className: "flex items-center justify-center h-full p-4 text-secondary animate-in fade-in duration-200",
|
|
157
|
-
children: /* @__PURE__ */
|
|
157
|
+
children: /* @__PURE__ */ i("div", {
|
|
158
158
|
className: "text-center",
|
|
159
|
-
children: [/* @__PURE__ */
|
|
159
|
+
children: [/* @__PURE__ */ r("p", {
|
|
160
160
|
className: "font-medium",
|
|
161
161
|
children: p("bigconsole.widget.renderer.custom.noComponentSpecified", "No Component Specified")
|
|
162
|
-
}), /* @__PURE__ */
|
|
162
|
+
}), /* @__PURE__ */ r("p", {
|
|
163
163
|
className: "text-sm mt-1",
|
|
164
164
|
children: p("bigconsole.widget.renderer.custom.setComponentName", "Set componentName in template or widget config")
|
|
165
165
|
})]
|
|
@@ -20,6 +20,18 @@ interface WidgetState {
|
|
|
20
20
|
clipboardWidgetId: string | null;
|
|
21
21
|
clipboardAction: 'copy' | 'cut' | null;
|
|
22
22
|
gridLayout: GridLayoutItem[];
|
|
23
|
+
/**
|
|
24
|
+
* Counts the placements a PERSON made: bumped by `updateWidgetPosition` and by
|
|
25
|
+
* nothing else. The canvas calls that action only when a drag or a resize ENDS
|
|
26
|
+
* (`DashboardCanvas.handleLayoutChange`), and the inspector's "Position & size"
|
|
27
|
+
* fields call it only on a typed change that actually moves the widget
|
|
28
|
+
* (`LayoutSection.commit`). Loading (`setWidgets`), creating (`addWidget`),
|
|
29
|
+
* saving (`updateWidget`) and deleting (`removeWidget`) leave it alone, so a
|
|
30
|
+
* reader can tell "the person moved something" from "the list was refreshed"
|
|
31
|
+
* without comparing positions (BOFF-8060, the dashboard leave guard).
|
|
32
|
+
* Never reset: a reader keeps the last value it saw across `reset()`.
|
|
33
|
+
*/
|
|
34
|
+
layoutEditRevision: number;
|
|
23
35
|
typeFilter: WidgetType | null;
|
|
24
36
|
setWidgets: (widgets: Widget[]) => void;
|
|
25
37
|
addWidget: (widget: Widget) => void;
|
|
@@ -20,6 +20,7 @@ var i = {
|
|
|
20
20
|
typeFilter: null
|
|
21
21
|
}, a = e()(t(n((e, t) => ({
|
|
22
22
|
...i,
|
|
23
|
+
layoutEditRevision: 0,
|
|
23
24
|
setWidgets: (t) => e({
|
|
24
25
|
widgets: new Map(t.map((e) => [e.id, e])),
|
|
25
26
|
gridLayout: t.map((e) => ({
|
|
@@ -155,7 +156,8 @@ var i = {
|
|
|
155
156
|
y: n.y,
|
|
156
157
|
w: n.width,
|
|
157
158
|
h: n.height
|
|
158
|
-
} : e)
|
|
159
|
+
} : e),
|
|
160
|
+
layoutEditRevision: e.layoutEditRevision + 1
|
|
159
161
|
};
|
|
160
162
|
}),
|
|
161
163
|
setGridLayout: (t) => e({ gridLayout: t }),
|
|
@@ -1,3 +1,21 @@
|
|
|
1
1
|
type TranslateFn = (key: string, fallback: string) => string;
|
|
2
2
|
export declare function resolveBackendErrorMessage(t: TranslateFn, error: unknown): string;
|
|
3
|
+
/**
|
|
4
|
+
* Every GraphQL `extensions.code` reachable from an error, in the shapes the
|
|
5
|
+
* fe-libs Apollo 4 client hands back:
|
|
6
|
+
*
|
|
7
|
+
* - `CombinedGraphQLErrors` (a `query()` resolved with `{ error }` under
|
|
8
|
+
* errorPolicy "all", or thrown under "none"): `error.errors[]`;
|
|
9
|
+
* - legacy Apollo 3 errors: `error.graphQLErrors[]`;
|
|
10
|
+
* - `ServerError` for a non-2xx answer sent as `application/json` — a subgraph
|
|
11
|
+
* that maps NOT_FOUND to HTTP 404 lands here, with the GraphQL body only in
|
|
12
|
+
* `error.bodyText` (Apollo 3 kept it parsed on `error.result`);
|
|
13
|
+
* - a bare GraphQL error: `error.extensions.code`;
|
|
14
|
+
* - any of those wrapped in `cause` / `error`.
|
|
15
|
+
*
|
|
16
|
+
* Returns `[]` when none is found. Never throws.
|
|
17
|
+
*/
|
|
18
|
+
export declare function graphQLErrorCodes(error: unknown): string[];
|
|
19
|
+
/** True when any GraphQL error reachable from `error` carries one of `codes`. */
|
|
20
|
+
export declare function hasGraphQLErrorCode(error: unknown, codes: ReadonlySet<string>): boolean;
|
|
3
21
|
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
//#region src/bigconsole/utils/backendError.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
return typeof e == "object" && !!e;
|
|
4
|
+
}
|
|
5
|
+
var t = 4;
|
|
6
|
+
function n(t) {
|
|
7
|
+
return Array.isArray(t) ? t.flatMap((t) => {
|
|
8
|
+
let n = e(t) && e(t.extensions) ? t.extensions.code : void 0;
|
|
9
|
+
return typeof n == "string" && n.length > 0 ? [n] : [];
|
|
10
|
+
}) : [];
|
|
11
|
+
}
|
|
12
|
+
function r(t) {
|
|
13
|
+
if (typeof t != "string" || t.length === 0) return [];
|
|
14
|
+
try {
|
|
15
|
+
let r = JSON.parse(t);
|
|
16
|
+
return e(r) ? n(r.errors) : [];
|
|
17
|
+
} catch {
|
|
18
|
+
return [];
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function i(i) {
|
|
22
|
+
let a = /* @__PURE__ */ new Set(), o = (i, s) => {
|
|
23
|
+
if (!e(i) || s > t || a.has(i)) return [];
|
|
24
|
+
a.add(i);
|
|
25
|
+
let c = e(i.extensions) ? i.extensions.code : void 0;
|
|
26
|
+
return [
|
|
27
|
+
...n(i.errors),
|
|
28
|
+
...n(i.graphQLErrors),
|
|
29
|
+
...e(i.result) ? n(i.result.errors) : [],
|
|
30
|
+
...r(i.bodyText),
|
|
31
|
+
...typeof c == "string" && c.length > 0 ? [c] : [],
|
|
32
|
+
...o(i.cause, s + 1),
|
|
33
|
+
...o(i.error, s + 1)
|
|
34
|
+
];
|
|
35
|
+
};
|
|
36
|
+
return [...new Set(o(i, 0))];
|
|
37
|
+
}
|
|
38
|
+
function a(e, t) {
|
|
39
|
+
return i(e).some((e) => t.has(e));
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
export { i as graphQLErrorCodes, a as hasGraphQLErrorCode };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ListSortValue } from './listSort';
|
|
2
|
+
|
|
3
|
+
export interface DashboardRow {
|
|
4
|
+
name: string;
|
|
5
|
+
description?: string | null;
|
|
6
|
+
category?: string | null;
|
|
7
|
+
status?: string;
|
|
8
|
+
updatedAt: string;
|
|
9
|
+
}
|
|
10
|
+
export interface DashboardListQuery {
|
|
11
|
+
search: string;
|
|
12
|
+
/** '' = all categories. */
|
|
13
|
+
category: string;
|
|
14
|
+
/** '' = all statuses. */
|
|
15
|
+
status: string;
|
|
16
|
+
sort: ListSortValue;
|
|
17
|
+
/** 1-based. */
|
|
18
|
+
page: number;
|
|
19
|
+
pageSize: number;
|
|
20
|
+
}
|
|
21
|
+
export interface DashboardListResult<T> {
|
|
22
|
+
/** Every row that passes search and filters, in the chosen order. */
|
|
23
|
+
filtered: T[];
|
|
24
|
+
totalPages: number;
|
|
25
|
+
/** The rows on `page` (clamped to the available pages). */
|
|
26
|
+
pageItems: T[];
|
|
27
|
+
}
|
|
28
|
+
export declare function selectDashboards<T extends DashboardRow>(dashboards: readonly T[], query: DashboardListQuery): DashboardListResult<T>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { sortList as e } from "./listSort.js";
|
|
2
|
+
//#region src/bigconsole/utils/dashboardList.ts
|
|
3
|
+
function t(t, n) {
|
|
4
|
+
let r = n.search.toLowerCase(), i = e(t.filter((e) => (!n.category || e.category === n.category) && (!n.status || e.status === n.status) && (e.name.toLowerCase().includes(r) || e.description?.toLowerCase().includes(r))), n.sort, {
|
|
5
|
+
name: (e) => e.name,
|
|
6
|
+
updatedAt: (e) => e.updatedAt
|
|
7
|
+
}), a = Math.max(1, Math.ceil(i.length / n.pageSize)), o = (Math.min(Math.max(1, n.page), a) - 1) * n.pageSize;
|
|
8
|
+
return {
|
|
9
|
+
filtered: i,
|
|
10
|
+
totalPages: a,
|
|
11
|
+
pageItems: i.slice(o, o + n.pageSize)
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { t as selectDashboards };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DataSink, DataSinkSetupState, DataSinkStatus } from '../types';
|
|
2
|
+
import { ListSortValue } from './listSort';
|
|
3
|
+
|
|
4
|
+
export interface DataSinkRow {
|
|
5
|
+
dataSink: DataSink;
|
|
6
|
+
setupState: DataSinkSetupState;
|
|
7
|
+
}
|
|
8
|
+
export interface DataSinkListQuery {
|
|
9
|
+
setupState: 'all' | 'in_progress' | 'completed';
|
|
10
|
+
status: DataSinkStatus | null;
|
|
11
|
+
active: boolean | null;
|
|
12
|
+
search: string;
|
|
13
|
+
sort: ListSortValue;
|
|
14
|
+
}
|
|
15
|
+
export declare function selectDataSinks<T extends DataSinkRow>(rows: readonly T[], query: DataSinkListQuery): T[];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { sortList as e } from "./listSort.js";
|
|
2
|
+
//#region src/bigconsole/utils/dataSinkList.ts
|
|
3
|
+
function t(t, n) {
|
|
4
|
+
let r = [...t];
|
|
5
|
+
if (n.setupState === "in_progress" ? r = r.filter((e) => e.setupState !== "completed") : n.setupState === "completed" && (r = r.filter((e) => e.setupState === "completed")), n.status !== null && (r = r.filter((e) => e.dataSink.status === n.status)), n.active !== null && (r = r.filter((e) => e.dataSink.isActive === n.active)), n.search.trim()) {
|
|
6
|
+
let e = n.search.toLowerCase();
|
|
7
|
+
r = r.filter((t) => t.dataSink.name?.toLowerCase().includes(e) || t.dataSink.key.toLowerCase().includes(e) || t.dataSink.description?.toLowerCase().includes(e));
|
|
8
|
+
}
|
|
9
|
+
return e(r, n.sort, {
|
|
10
|
+
name: (e) => e.dataSink.name || e.dataSink.key,
|
|
11
|
+
updatedAt: (e) => e.dataSink.updatedAt
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { t as selectDataSinks };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Form dirty helpers (BOFF-8060, N3 leave guard).
|
|
3
|
+
*
|
|
4
|
+
* Pure functions, no React, so the "is this editor holding an unsaved draft"
|
|
5
|
+
* decision is testable without a DOM. Each editor keeps a baseline of the
|
|
6
|
+
* values it seeded or last saved, and reports `isDirty(current, baseline)` to
|
|
7
|
+
* `useUnsavedChanges`.
|
|
8
|
+
*
|
|
9
|
+
* Two rules keep the signal honest:
|
|
10
|
+
* - A missing baseline (`null`/`undefined`) is CLEAN. An editor whose seed has
|
|
11
|
+
* not landed yet has nothing to lose, and reporting dirty there would make a
|
|
12
|
+
* freshly opened page refuse the assistant's navigation.
|
|
13
|
+
* - Comparison is by value (stable JSON, sorted keys, `undefined` dropped), so
|
|
14
|
+
* object identity, key order and a refetch that returns equal data never
|
|
15
|
+
* count as an edit.
|
|
16
|
+
*/
|
|
17
|
+
/** JSON with object keys sorted at every depth, so key order never matters. */
|
|
18
|
+
export declare function stableStringify(value: unknown): string;
|
|
19
|
+
/**
|
|
20
|
+
* True when `current` differs by value from `baseline`. A missing baseline is
|
|
21
|
+
* clean (see the module note).
|
|
22
|
+
*/
|
|
23
|
+
export declare function isDirty(current: unknown, baseline: unknown): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Whether an edit form should be (re)seeded from the record the store now holds.
|
|
26
|
+
*
|
|
27
|
+
* A record can arrive twice: first as a partial list item (no expression, ttl, version), then as
|
|
28
|
+
* the full record after the detail fetch. The second arrival must refresh a form the person has
|
|
29
|
+
* not touched, otherwise the partial values would be saved over the stored ones. It must never
|
|
30
|
+
* overwrite an edit in progress.
|
|
31
|
+
* - `seededId`: the id of the record the form was last seeded from (null = never seeded);
|
|
32
|
+
* - `form` / `baseline`: the current form and the form as last seeded or saved.
|
|
33
|
+
* Seed when the record is a different one, or when the form still equals its baseline (a missing
|
|
34
|
+
* baseline counts as clean). Skip only when the same record is loaded and the form is dirty.
|
|
35
|
+
*/
|
|
36
|
+
export declare function shouldReseedForm(seededId: string | null, recordId: string, form: unknown, baseline: unknown): boolean;
|
|
37
|
+
/** A grid item: react-grid-layout names the id `i`, our own widgets use `id`. */
|
|
38
|
+
export type LayoutItem = {
|
|
39
|
+
readonly id: string;
|
|
40
|
+
readonly x: number;
|
|
41
|
+
readonly y: number;
|
|
42
|
+
readonly w: number;
|
|
43
|
+
readonly h: number;
|
|
44
|
+
} | {
|
|
45
|
+
readonly i: string;
|
|
46
|
+
readonly x: number;
|
|
47
|
+
readonly y: number;
|
|
48
|
+
readonly w: number;
|
|
49
|
+
readonly h: number;
|
|
50
|
+
};
|
|
51
|
+
/** Item id to `x,y,w,h`, keys in sorted order. */
|
|
52
|
+
export type NormalisedLayout = Readonly<Record<string, string>>;
|
|
53
|
+
/**
|
|
54
|
+
* Reduces a layout to the four numbers per item that a person can change by
|
|
55
|
+
* dragging or resizing. Array order, extra grid bookkeeping fields (`moved`,
|
|
56
|
+
* `static`, min/max) and item order never matter.
|
|
57
|
+
*/
|
|
58
|
+
export declare function normaliseLayout(items: readonly LayoutItem[]): NormalisedLayout;
|
|
59
|
+
type LayoutInput = readonly LayoutItem[] | NormalisedLayout;
|
|
60
|
+
/** True when the layout differs by value from the baseline. No baseline is clean. */
|
|
61
|
+
export declare function layoutDirty(current: LayoutInput, baseline: LayoutInput | null | undefined): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* react-grid-layout fires `onLayoutChange` on mount and again whenever it
|
|
64
|
+
* compacts, with no person involved, so "a change event happened" is not a
|
|
65
|
+
* dirty signal. The baseline therefore FLOATS (follows every layout change)
|
|
66
|
+
* until the first user gesture (drag or resize stop), then FREEZES; from then on
|
|
67
|
+
* `layoutDirty(current, tracker.baseline)` is the answer. Reloading the
|
|
68
|
+
* dashboard or a successful save starts a fresh tracker; a failed save keeps
|
|
69
|
+
* the old one, so the draft stays dirty.
|
|
70
|
+
*/
|
|
71
|
+
export interface LayoutTracker {
|
|
72
|
+
readonly baseline: NormalisedLayout | null;
|
|
73
|
+
readonly frozen: boolean;
|
|
74
|
+
}
|
|
75
|
+
export declare const EMPTY_LAYOUT_TRACKER: LayoutTracker;
|
|
76
|
+
/** A fresh floating tracker, for after a load or a successful save. */
|
|
77
|
+
export declare function resetLayoutTracker(items: readonly LayoutItem[]): LayoutTracker;
|
|
78
|
+
/** A layout-change event: moves the baseline while floating, ignored once frozen. */
|
|
79
|
+
export declare function trackLayoutChange(tracker: LayoutTracker, items: readonly LayoutItem[]): LayoutTracker;
|
|
80
|
+
/** The first user gesture: stops the baseline following layout changes. */
|
|
81
|
+
export declare function freezeLayoutTracker(tracker: LayoutTracker): LayoutTracker;
|
|
82
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region src/bigconsole/utils/formDirty.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
return JSON.stringify(t(e));
|
|
4
|
+
}
|
|
5
|
+
function t(e) {
|
|
6
|
+
if (Array.isArray(e)) return e.map(t);
|
|
7
|
+
if (typeof e == "object" && e) {
|
|
8
|
+
let n = e, r = {};
|
|
9
|
+
for (let e of Object.keys(n).sort()) r[e] = t(n[e]);
|
|
10
|
+
return r;
|
|
11
|
+
}
|
|
12
|
+
return e;
|
|
13
|
+
}
|
|
14
|
+
function n(t, n) {
|
|
15
|
+
return n == null ? !1 : e(t) !== e(n);
|
|
16
|
+
}
|
|
17
|
+
function r(e, t, r, i) {
|
|
18
|
+
return e === t ? !n(r, i) : !0;
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { n as isDirty, r as shouldReseedForm };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Does the Insights page hold a description the person has typed and not submitted?
|
|
3
|
+
* (BOFF-8060, N3/N4 leave guard.)
|
|
4
|
+
*
|
|
5
|
+
* The page has two draft textareas: the "Describe your dashboard" prompt and the refine
|
|
6
|
+
* modal's "What should change?". Both are cleared by the page itself when their
|
|
7
|
+
* submission is accepted (and when the refine modal is reopened), so the last submitted
|
|
8
|
+
* value is always the empty string and "unsubmitted" reads as "non-empty". Pure
|
|
9
|
+
* functions, no React, so the rule is testable without a DOM.
|
|
10
|
+
*
|
|
11
|
+
* - Whitespace-only text is clean: the page will not submit it, and nothing is lost.
|
|
12
|
+
* - Text being submitted right now is clean: it already left the page (the mutation
|
|
13
|
+
* keeps running after the person navigates). If the submission fails the page keeps
|
|
14
|
+
* the text and clears the in-flight flag, so the draft reads dirty again.
|
|
15
|
+
* - The refine text only counts while the refine modal is open.
|
|
16
|
+
*/
|
|
17
|
+
export interface InsightsDraftState {
|
|
18
|
+
/** The "Describe your dashboard" textarea. */
|
|
19
|
+
readonly promptText: string;
|
|
20
|
+
/** A generation request for `promptText` is in flight. */
|
|
21
|
+
readonly isGenerating: boolean;
|
|
22
|
+
/** The refine modal is open. */
|
|
23
|
+
readonly refineOpen: boolean;
|
|
24
|
+
/** The refine modal's "What should change?" textarea. */
|
|
25
|
+
readonly refineText: string;
|
|
26
|
+
/** A refine request for the open generation is in flight. */
|
|
27
|
+
readonly refineBusy: boolean;
|
|
28
|
+
}
|
|
29
|
+
export declare function isInsightsDraftDirty(state: InsightsDraftState): boolean;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/bigconsole/utils/insightsDraft.ts
|
|
2
|
+
var e = (e) => e.trim() !== "";
|
|
3
|
+
function t(t) {
|
|
4
|
+
let n = e(t.promptText) && !t.isGenerating, r = t.refineOpen && e(t.refineText) && !t.refineBusy;
|
|
5
|
+
return n || r;
|
|
6
|
+
}
|
|
7
|
+
//#endregion
|
|
8
|
+
export { t as isInsightsDraftDirty };
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dashboard layout baseline (BOFF-8060, N3/N4: the dashboard leave guard).
|
|
3
|
+
*
|
|
4
|
+
* The dashboard builder keeps moved and resized widgets only in the widget store
|
|
5
|
+
* until the toolbar Save runs (`DashboardBuilderPage.handleSave`, step 2). To tell
|
|
6
|
+
* the assistant "this editor holds unsaved work" the builder needs one honest
|
|
7
|
+
* boolean, and the store has none: `widgetStore.dirtyWidgetIds` is never marked and
|
|
8
|
+
* `dashboardStore.hasUnsavedChanges` is never cleared. This module is that boolean,
|
|
9
|
+
* as plain functions with no React, so it can be tested without a DOM.
|
|
10
|
+
*
|
|
11
|
+
* ★★ "A layout event happened" is NOT a dirty signal. Positions reach the store on
|
|
12
|
+
* load (`setWidgets`), when a widget is created or deleted, and when a save writes
|
|
13
|
+
* its own positions back, none of which is the person's work. Only a PERSON'S
|
|
14
|
+
* placement is. So the baseline FLOATS (it is re-taken on every observation)
|
|
15
|
+
* until the first placement by a person, and from then on it is FROZEN: it holds
|
|
16
|
+
* the last layout the server is known to have, and "dirty" means the current
|
|
17
|
+
* layout differs from it BY VALUE:
|
|
18
|
+
*
|
|
19
|
+
* load / refetch / add / delete / save write-back -> baseline follows, clean
|
|
20
|
+
* first drag, resize, or typed placement -> baseline freezes
|
|
21
|
+
* a drag that moves and moves back -> equal again, clean
|
|
22
|
+
* a successful save -> baseline = what was saved
|
|
23
|
+
* a failed save -> nothing happens, still dirty
|
|
24
|
+
*
|
|
25
|
+
* ★★ The "placement by a person" signal is `layoutEditRevision` on the widget
|
|
26
|
+
* store, a counter bumped by `updateWidgetPosition` and by nothing else. It is the
|
|
27
|
+
* ONE writer shared by the canvas (drag stop, resize stop) and the inspector's
|
|
28
|
+
* "Position & size" fields, so a placement typed into the inspector, which never
|
|
29
|
+
* touches the grid, freezes the baseline too. A signal taken from the grid alone
|
|
30
|
+
* would let a floating baseline silently absorb it.
|
|
31
|
+
*
|
|
32
|
+
* Every function here is pure. `useDashboardLayoutBaseline` is the React shell.
|
|
33
|
+
*/
|
|
34
|
+
/** One widget's grid cell, in grid units (columns / rows). */
|
|
35
|
+
export interface LayoutRect {
|
|
36
|
+
readonly x: number;
|
|
37
|
+
readonly y: number;
|
|
38
|
+
readonly w: number;
|
|
39
|
+
readonly h: number;
|
|
40
|
+
}
|
|
41
|
+
export interface LayoutItem extends LayoutRect {
|
|
42
|
+
readonly id: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Widget id -> cell, keys in sorted order. A `Map` (not a plain object) so an
|
|
46
|
+
* id such as `"1"` or `"__proto__"` is only ever a key.
|
|
47
|
+
*/
|
|
48
|
+
export type NormalisedLayout = ReadonlyMap<string, LayoutRect>;
|
|
49
|
+
interface PositionLike {
|
|
50
|
+
readonly x?: number | null;
|
|
51
|
+
readonly y?: number | null;
|
|
52
|
+
readonly width?: number | null;
|
|
53
|
+
readonly height?: number | null;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* What a widget must carry for its cell to be read. Structural, so the store's
|
|
57
|
+
* `Widget` satisfies it and a test can pass a plain object.
|
|
58
|
+
*/
|
|
59
|
+
export interface LayoutSourceWidget {
|
|
60
|
+
readonly id: string;
|
|
61
|
+
readonly position?: PositionLike | null;
|
|
62
|
+
readonly positionX?: number | null;
|
|
63
|
+
readonly positionY?: number | null;
|
|
64
|
+
readonly positionWidth?: number | null;
|
|
65
|
+
readonly positionHeight?: number | null;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* The cell a widget with no stored size falls back to. These mirror
|
|
69
|
+
* `DashboardGrid.widgetToLayout` exactly, so the baseline reads a widget the same
|
|
70
|
+
* way the grid draws it.
|
|
71
|
+
*/
|
|
72
|
+
export declare const DEFAULT_LAYOUT_CELL: LayoutRect;
|
|
73
|
+
/**
|
|
74
|
+
* Items -> a sorted `id -> x,y,w,h` map. Order of the input does not matter, a
|
|
75
|
+
* repeated id keeps the last one, and a non-finite number becomes 0 so a stray
|
|
76
|
+
* `NaN` (which is never equal to itself) cannot make a layout permanently dirty.
|
|
77
|
+
*/
|
|
78
|
+
export declare function normaliseLayout(items: Iterable<LayoutItem>): NormalisedLayout;
|
|
79
|
+
/** The widget store's widgets -> a normalised layout (every widget in the store, which is what Save sends). */
|
|
80
|
+
export declare function layoutFromWidgets(widgets: Iterable<LayoutSourceWidget>): NormalisedLayout;
|
|
81
|
+
/** The `{ id, position }` list `batchUpdatePositions` sends -> layout items (exactly what reached the server). */
|
|
82
|
+
export declare function layoutItemsFromPositionUpdates(updates: ReadonlyArray<{
|
|
83
|
+
readonly id: string;
|
|
84
|
+
readonly position: PositionLike;
|
|
85
|
+
}>): LayoutItem[];
|
|
86
|
+
/** Same widgets in the same cells (by value; key order and object identity are irrelevant). */
|
|
87
|
+
export declare function layoutEquals(a: NormalisedLayout, b: NormalisedLayout): boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Does `current` differ from `baseline`? Different cells, a widget present on only
|
|
90
|
+
* one side, or both, all count. With no baseline there is nothing to differ from,
|
|
91
|
+
* so the answer is no: this never claims unsaved work it cannot point to.
|
|
92
|
+
*/
|
|
93
|
+
export declare function layoutDirty(current: NormalisedLayout, baseline: NormalisedLayout | null): boolean;
|
|
94
|
+
export interface LayoutBaselineState {
|
|
95
|
+
/** The layout the server is known to hold, or the last loaded one while floating. `null` until first observed. */
|
|
96
|
+
readonly baseline: NormalisedLayout | null;
|
|
97
|
+
/** True once a person has placed something since the baseline was taken. Frozen baselines do not follow the store. */
|
|
98
|
+
readonly frozen: boolean;
|
|
99
|
+
/** The last `layoutEditRevision` seen, to notice the next placement. `null` until first observed. */
|
|
100
|
+
readonly seenRevision: number | null;
|
|
101
|
+
}
|
|
102
|
+
export declare const INITIAL_LAYOUT_BASELINE: LayoutBaselineState;
|
|
103
|
+
export type LayoutBaselineAction =
|
|
104
|
+
/** The store changed (or the page mounted): here is the layout and the placement counter now. */
|
|
105
|
+
{
|
|
106
|
+
readonly type: 'observe';
|
|
107
|
+
readonly layout: NormalisedLayout;
|
|
108
|
+
readonly editRevision: number;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* The positions reached the server. `layout` is exactly what was sent;
|
|
112
|
+
* `editRevision` is the counter read BEFORE the request started, so a
|
|
113
|
+
* placement made while it was in flight is not mistaken for saved.
|
|
114
|
+
*/
|
|
115
|
+
| {
|
|
116
|
+
readonly type: 'saved';
|
|
117
|
+
readonly layout: NormalisedLayout;
|
|
118
|
+
readonly editRevision: number;
|
|
119
|
+
}
|
|
120
|
+
/** A different dashboard: forget everything. */
|
|
121
|
+
| {
|
|
122
|
+
readonly type: 'reset';
|
|
123
|
+
};
|
|
124
|
+
export declare function reduceLayoutBaseline(state: LayoutBaselineState, action: LayoutBaselineAction): LayoutBaselineState;
|
|
125
|
+
/**
|
|
126
|
+
* The one boolean the builder reports. A floating baseline is never dirty by
|
|
127
|
+
* definition: it follows the store, so whatever differs is not the person's work.
|
|
128
|
+
*/
|
|
129
|
+
export declare function isLayoutBaselineDirty(state: LayoutBaselineState, current: NormalisedLayout): boolean;
|
|
130
|
+
export {};
|