@malloy-publisher/sdk 0.3.0 → 0.3.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/README.md +8 -0
- package/dist/DocumentStorageProvider-BeBD0uWc.cjs.js +134 -0
- package/dist/DocumentStorageProvider-tGvodI8f.es.js +24268 -0
- package/dist/RenderedResult-CPi6uQWq.cjs.js +115 -0
- package/dist/RenderedResult-mDE-4u8S.es.js +542 -0
- package/dist/ServerProvider-CH71GsoL.cjs.js +1 -0
- package/dist/{ServerProvider-DSK9rfSY.es.js → ServerProvider-X2Ma0HRs.es.js} +486 -521
- package/dist/builder/index.cjs.js +105 -0
- package/dist/builder/index.d.ts +2 -0
- package/dist/builder/index.es.js +9561 -0
- package/dist/builder-entry.d.ts +8 -0
- package/dist/client/index.cjs.js +1 -1
- package/dist/client/index.es.js +1 -1
- package/dist/components/Dashboard/Dashboard.d.ts +19 -14
- package/dist/components/Dashboard/DashboardGrid.d.ts +67 -0
- package/dist/components/Dashboard/DashboardTile.d.ts +6 -1
- package/dist/components/Dashboard/ExploreDialog.d.ts +18 -0
- package/dist/components/Dashboard/RowsDialog.d.ts +47 -0
- package/dist/components/Dashboard/TileCard.d.ts +44 -0
- package/dist/components/Dashboard/index.d.ts +2 -0
- package/dist/components/Dashboard/promoteMeasureRow.d.ts +7 -3
- package/dist/components/Dashboard/telemetry.d.ts +43 -0
- package/dist/components/DashboardBuilder/AddTileDialog.d.ts +35 -0
- package/dist/components/DashboardBuilder/BuilderToolbar.d.ts +29 -0
- package/dist/components/DashboardBuilder/DashboardBuilder.d.ts +112 -0
- package/dist/components/DashboardBuilder/DashboardEditor.d.ts +32 -0
- package/dist/components/DashboardBuilder/DiffDialog.d.ts +15 -0
- package/dist/components/DashboardBuilder/DrillDialog.d.ts +15 -0
- package/dist/components/DashboardBuilder/FilterDialog.d.ts +54 -0
- package/dist/components/DashboardBuilder/FilterStrip.d.ts +17 -0
- package/dist/components/DashboardBuilder/SettingsPopover.d.ts +20 -0
- package/dist/components/DashboardBuilder/TileFrame.d.ts +42 -0
- package/dist/components/DashboardBuilder/TileMenu.d.ts +24 -0
- package/dist/components/DashboardBuilder/catalog.d.ts +62 -0
- package/dist/components/DashboardBuilder/controls.d.ts +157 -0
- package/dist/components/DashboardBuilder/diff.d.ts +35 -0
- package/dist/components/DashboardBuilder/document.d.ts +218 -0
- package/dist/components/DashboardBuilder/layout.d.ts +71 -0
- package/dist/components/DashboardBuilder/malloyText.d.ts +45 -0
- package/dist/components/DashboardBuilder/preview.d.ts +60 -0
- package/dist/components/DashboardBuilder/readDocument.d.ts +106 -0
- package/dist/components/DashboardBuilder/sortable.d.ts +51 -0
- package/dist/components/DashboardBuilder/spliceDocument.d.ts +44 -0
- package/dist/components/DashboardBuilder/testing/fixtures.d.ts +10 -0
- package/dist/components/DashboardBuilder/useBuilderShortcuts.d.ts +22 -0
- package/dist/components/DashboardBuilder/useDashboardEditor.d.ts +63 -0
- package/dist/components/DashboardBuilder/useDraft.d.ts +13 -0
- package/dist/components/DashboardBuilder/useFilterForm.d.ts +65 -0
- package/dist/components/DashboardBuilder/useTileReorder.d.ts +22 -0
- package/dist/components/DashboardBuilder/useTileResize.d.ts +29 -0
- package/dist/components/DocumentStorage/DocumentStorageProvider.d.ts +7 -0
- package/dist/components/DocumentStorage/index.d.ts +1 -1
- package/dist/components/FloatingIconButton.d.ts +16 -0
- package/dist/components/Prose.d.ts +46 -0
- package/dist/components/RenderedResult/ResultPanel.d.ts +30 -0
- package/dist/components/RenderedResult/index.d.ts +1 -0
- package/dist/components/drill/index.d.ts +1 -1
- package/dist/components/drill/resolveDrill.d.ts +22 -0
- package/dist/components/drill/useDrill.d.ts +11 -2
- package/dist/components/index.d.ts +1 -0
- package/dist/components/styles.d.ts +0 -4
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/useDocumentControls.d.ts +70 -0
- package/dist/hooks/useQueryResult.d.ts +40 -0
- package/dist/index.cjs.js +23 -270
- package/dist/index.es.js +16977 -41293
- package/dist/utils/malloyLiteral.d.ts +11 -0
- package/package.json +24 -9
- package/src/builder-entry.ts +55 -0
- package/src/components/Dashboard/Dashboard.spec.tsx +7 -10
- package/src/components/Dashboard/Dashboard.tsx +165 -175
- package/src/components/Dashboard/DashboardGrid.tsx +124 -0
- package/src/components/Dashboard/DashboardTile.spec.tsx +30 -6
- package/src/components/Dashboard/DashboardTile.tsx +66 -123
- package/src/components/Dashboard/ExploreDialog.tsx +84 -0
- package/src/components/Dashboard/RowsDialog.spec.ts +42 -0
- package/src/components/Dashboard/RowsDialog.tsx +234 -0
- package/src/components/Dashboard/TileCard.tsx +120 -0
- package/src/components/Dashboard/index.ts +2 -0
- package/src/components/Dashboard/promoteMeasureRow.spec.ts +70 -0
- package/src/components/Dashboard/promoteMeasureRow.ts +33 -2
- package/src/components/Dashboard/telemetry.ts +44 -0
- package/src/components/Dashboard/tileGridColumn.spec.ts +1 -1
- package/src/components/DashboardBuilder/AddTileDialog.tsx +249 -0
- package/src/components/DashboardBuilder/BuilderToolbar.tsx +270 -0
- package/src/components/DashboardBuilder/DashboardBuilder.spec.tsx +858 -0
- package/src/components/DashboardBuilder/DashboardBuilder.tsx +653 -0
- package/src/components/DashboardBuilder/DashboardEditor.spec.tsx +211 -0
- package/src/components/DashboardBuilder/DashboardEditor.tsx +493 -0
- package/src/components/DashboardBuilder/DiffDialog.tsx +129 -0
- package/src/components/DashboardBuilder/DrillDialog.tsx +281 -0
- package/src/components/DashboardBuilder/FilterDialog.tsx +581 -0
- package/src/components/DashboardBuilder/FilterStrip.tsx +125 -0
- package/src/components/DashboardBuilder/SettingsPopover.tsx +168 -0
- package/src/components/DashboardBuilder/TileFrame.tsx +380 -0
- package/src/components/DashboardBuilder/TileMenu.tsx +188 -0
- package/src/components/DashboardBuilder/catalog.spec.ts +215 -0
- package/src/components/DashboardBuilder/catalog.ts +225 -0
- package/src/components/DashboardBuilder/controls.spec.ts +243 -0
- package/src/components/DashboardBuilder/controls.ts +398 -0
- package/src/components/DashboardBuilder/diff.spec.ts +44 -0
- package/src/components/DashboardBuilder/diff.ts +93 -0
- package/src/components/DashboardBuilder/document.ts +209 -0
- package/src/components/DashboardBuilder/keepRowStructure.spec.ts +84 -0
- package/src/components/DashboardBuilder/layout.ts +143 -0
- package/src/components/DashboardBuilder/malloyText.spec.ts +84 -0
- package/src/components/DashboardBuilder/malloyText.ts +151 -0
- package/src/components/DashboardBuilder/moveIntoGap.spec.ts +90 -0
- package/src/components/DashboardBuilder/preview.spec.ts +149 -0
- package/src/components/DashboardBuilder/preview.ts +172 -0
- package/src/components/DashboardBuilder/readDocument.spec.ts +375 -0
- package/src/components/DashboardBuilder/readDocument.ts +467 -0
- package/src/components/DashboardBuilder/sortable.tsx +151 -0
- package/src/components/DashboardBuilder/spliceDocument.spec.ts +1108 -0
- package/src/components/DashboardBuilder/spliceDocument.ts +1098 -0
- package/src/components/DashboardBuilder/testing/fixtures.ts +48 -0
- package/src/components/DashboardBuilder/useBuilderShortcuts.ts +88 -0
- package/src/components/DashboardBuilder/useDashboardEditor.spec.ts +255 -0
- package/src/components/DashboardBuilder/useDashboardEditor.ts +193 -0
- package/src/components/DashboardBuilder/useDraft.ts +43 -0
- package/src/components/DashboardBuilder/useFilterForm.spec.tsx +144 -0
- package/src/components/DashboardBuilder/useFilterForm.ts +352 -0
- package/src/components/DashboardBuilder/useTileReorder.spec.tsx +97 -0
- package/src/components/DashboardBuilder/useTileReorder.ts +115 -0
- package/src/components/DashboardBuilder/useTileResize.spec.tsx +121 -0
- package/src/components/DashboardBuilder/useTileResize.ts +110 -0
- package/src/components/DashboardBuilder/withGaps.spec.ts +96 -0
- package/src/components/DocumentStorage/DocumentStorageProvider.tsx +12 -0
- package/src/components/DocumentStorage/index.ts +1 -0
- package/src/components/Environment/About.tsx +4 -36
- package/src/components/FloatingIconButton.tsx +41 -0
- package/src/components/Model/Model.tsx +6 -23
- package/src/components/Model/ModelCell.tsx +33 -72
- package/src/components/Notebook/Notebook.tsx +25 -88
- package/src/components/Notebook/NotebookCell.tsx +35 -183
- package/src/components/Prose.spec.tsx +85 -0
- package/src/components/Prose.tsx +179 -0
- package/src/components/QueryResult/QueryResult.tsx +15 -43
- package/src/components/RenderedResult/ResultContainer.tsx +4 -12
- package/src/components/RenderedResult/ResultPanel.spec.tsx +49 -0
- package/src/components/RenderedResult/ResultPanel.tsx +73 -0
- package/src/components/RenderedResult/index.ts +1 -0
- package/src/components/drill/index.ts +1 -0
- package/src/components/drill/resolveDrill.ts +22 -1
- package/src/components/drill/useDrill.spec.tsx +94 -0
- package/src/components/drill/useDrill.tsx +52 -12
- package/src/components/given/GivensPanel.tsx +1 -1
- package/src/components/index.ts +6 -0
- package/src/components/styles.ts +0 -37
- package/src/hooks/index.ts +13 -0
- package/src/hooks/useDocumentControls.ts +170 -0
- package/src/hooks/useQueryResult.ts +82 -0
- package/src/utils/malloyLiteral.spec.ts +43 -0
- package/src/utils/malloyLiteral.ts +76 -0
- package/vite.config.ts +5 -0
- package/dist/ServerProvider-CGnLjzag.cjs.js +0 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { DashboardBuilder } from './components/DashboardBuilder/DashboardBuilder';
|
|
2
|
+
export type { BuilderGiven, DashboardBuilderProps, } from './components/DashboardBuilder/DashboardBuilder';
|
|
3
|
+
export { DashboardEditor, type DashboardEditorProps, } from './components/DashboardBuilder/DashboardEditor';
|
|
4
|
+
export type { DashboardDocument, DashboardTile, LocalGiven, } from './components/DashboardBuilder/document';
|
|
5
|
+
export { readDashboardDocument, readFailed, type ReadResult, } from './components/DashboardBuilder/readDocument';
|
|
6
|
+
export { spliceDashboardDocument, spliceFailed, type SpliceResult, } from './components/DashboardBuilder/spliceDocument';
|
|
7
|
+
export { buildCatalog, type PackageCatalog, } from './components/DashboardBuilder/catalog';
|
|
8
|
+
export type { DashboardEvent, DashboardEventHandler, } from './components/Dashboard/telemetry';
|
package/dist/client/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../ServerProvider-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../ServerProvider-CH71GsoL.cjs.js");exports.AttachedDatabaseTypeEnum=e.AttachedDatabaseTypeEnum;exports.AzureConnectionAuthTypeEnum=e.AzureConnectionAuthTypeEnum;exports.CompileProblemSeverityEnum=e.CompileProblemSeverityEnum;exports.CompileRequestScopeEnum=e.CompileRequestScopeEnum;exports.CompileResultStatusEnum=e.CompileResultStatusEnum;exports.Configuration=e.Configuration;exports.ConnectionProxyTypeEnum=e.ConnectionProxyTypeEnum;exports.ConnectionStatusStatusEnum=e.ConnectionStatusStatusEnum;exports.ConnectionTypeEnum=e.ConnectionTypeEnum;exports.ConnectionsApi=e.ConnectionsApi;exports.ConnectionsApiAxiosParamCreator=e.ConnectionsApiAxiosParamCreator;exports.ConnectionsApiFactory=e.ConnectionsApiFactory;exports.ConnectionsApiFp=e.ConnectionsApiFp;exports.ConnectionsTestApi=e.ConnectionsTestApi;exports.ConnectionsTestApiAxiosParamCreator=e.ConnectionsTestApiAxiosParamCreator;exports.ConnectionsTestApiFactory=e.ConnectionsTestApiFactory;exports.ConnectionsTestApiFp=e.ConnectionsTestApiFp;exports.DashboardsApi=e.DashboardsApi;exports.DashboardsApiAxiosParamCreator=e.DashboardsApiAxiosParamCreator;exports.DashboardsApiFactory=e.DashboardsApiFactory;exports.DashboardsApiFp=e.DashboardsApiFp;exports.DataAppFitEnum=e.DataAppFitEnum;exports.DataAppsApi=e.DataAppsApi;exports.DataAppsApiAxiosParamCreator=e.DataAppsApiAxiosParamCreator;exports.DataAppsApiFactory=e.DataAppsApiFactory;exports.DataAppsApiFp=e.DataAppsApiFp;exports.DatabaseTypeEnum=e.DatabaseTypeEnum;exports.DatabasesApi=e.DatabasesApi;exports.DatabasesApiAxiosParamCreator=e.DatabasesApiAxiosParamCreator;exports.DatabasesApiFactory=e.DatabasesApiFactory;exports.DatabasesApiFp=e.DatabasesApiFp;exports.EnvironmentsApi=e.EnvironmentsApi;exports.EnvironmentsApiAxiosParamCreator=e.EnvironmentsApiAxiosParamCreator;exports.EnvironmentsApiFactory=e.EnvironmentsApiFactory;exports.EnvironmentsApiFp=e.EnvironmentsApiFp;exports.ExecuteNotebookCellBypassFiltersEnum=e.ExecuteNotebookCellBypassFiltersEnum;exports.FilterTypeEnum=e.FilterTypeEnum;exports.FreshnessFallbackEnum=e.FreshnessFallbackEnum;exports.GivenControlEnum=e.GivenControlEnum;exports.LedgerEntryStrategyEnum=e.LedgerEntryStrategyEnum;exports.LogMessageSeverityEnum=e.LogMessageSeverityEnum;exports.ManifestEntryFreshnessFallbackEnum=e.ManifestEntryFreshnessFallbackEnum;exports.ManifestEntryOriginEnum=e.ManifestEntryOriginEnum;exports.ManifestEntryRefreshEnum=e.ManifestEntryRefreshEnum;exports.MaterializationActionActionEnum=e.MaterializationActionActionEnum;exports.MaterializationStatus=e.MaterializationStatus;exports.MaterializationsApi=e.MaterializationsApi;exports.MaterializationsApiAxiosParamCreator=e.MaterializationsApiAxiosParamCreator;exports.MaterializationsApiFactory=e.MaterializationsApiFactory;exports.MaterializationsApiFp=e.MaterializationsApiFp;exports.ModelsApi=e.ModelsApi;exports.ModelsApiAxiosParamCreator=e.ModelsApiAxiosParamCreator;exports.ModelsApiFactory=e.ModelsApiFactory;exports.ModelsApiFp=e.ModelsApiFp;exports.NotebookCellResultTypeEnum=e.NotebookCellResultTypeEnum;exports.NotebookCellTypeEnum=e.NotebookCellTypeEnum;exports.NotebooksApi=e.NotebooksApi;exports.NotebooksApiAxiosParamCreator=e.NotebooksApiAxiosParamCreator;exports.NotebooksApiFactory=e.NotebooksApiFactory;exports.NotebooksApiFp=e.NotebooksApiFp;exports.PackageEmbeddingIndexStatusEnum=e.PackageEmbeddingIndexStatusEnum;exports.PackageManifestBindingStatusEnum=e.PackageManifestBindingStatusEnum;exports.PackageQueryableSourcesEnum=e.PackageQueryableSourcesEnum;exports.PackageScopeEnum=e.PackageScopeEnum;exports.PackageStorageServeBindingsInnerOriginEnum=e.PackageStorageServeBindingsInnerOriginEnum;exports.PackageWarningsInnerSeverityEnum=e.PackageWarningsInnerSeverityEnum;exports.PackagesApi=e.PackagesApi;exports.PackagesApiAxiosParamCreator=e.PackagesApiAxiosParamCreator;exports.PackagesApiFactory=e.PackagesApiFactory;exports.PackagesApiFp=e.PackagesApiFp;exports.PersistSourcePlanOriginEnum=e.PersistSourcePlanOriginEnum;exports.PostgresConnectionSslmodeEnum=e.PostgresConnectionSslmodeEnum;exports.PublisherApi=e.PublisherApi;exports.PublisherApiAxiosParamCreator=e.PublisherApiAxiosParamCreator;exports.PublisherApiFactory=e.PublisherApiFactory;exports.PublisherApiFp=e.PublisherApiFp;exports.QueryClass=e.QueryClass;exports.QueryResultQueryRowLimitSourceEnum=e.QueryResultQueryRowLimitSourceEnum;exports.QueryResultServedFromEnum=e.QueryResultServedFromEnum;exports.Realization=e.Realization;exports.RefusedSourceReasonEnum=e.RefusedSourceReasonEnum;exports.RefusedSourceTierEnum=e.RefusedSourceTierEnum;exports.RunContextTriggerEnum=e.RunContextTriggerEnum;exports.S3ConnectionProviderEnum=e.S3ConnectionProviderEnum;exports.ServerProvider=e.ServerProvider;exports.ServerStatusOperationalStateEnum=e.ServerStatusOperationalStateEnum;exports.ThemeDefaultModeEnum=e.ThemeDefaultModeEnum;exports.WatchModeApi=e.WatchModeApi;exports.WatchModeApiAxiosParamCreator=e.WatchModeApiAxiosParamCreator;exports.WatchModeApiFactory=e.WatchModeApiFactory;exports.WatchModeApiFp=e.WatchModeApiFp;exports.globalQueryClient=e.globalQueryClient;exports.useServer=e.useServer;
|
package/dist/client/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as e, a as i, C as o, b as n, c as t, aC as r, e as p, f as u, d as A, O as m, I as c, K as E, J as l, X as C, U as y, W as P, V as F, $ as b, Y as g, _ as d, Z as S, D as k, a3 as M, a0 as h, a2 as x, a1 as v, h as D, a7 as T, a4 as R, a6 as f, a5 as z, ab as N, a8 as Q, aa as W, a9 as B, ap as O, F as I, i as L, G as q, L as w, j, k as G, M as H, l as J, ag as K, m as U, af as V, ac as X, ae as Y, ad as Z, ak as _, ah as $, aj as aa, ai as sa, n as ea, N as ia, ao as oa, al as na, an as ta, am as ra, q as pa, p as ua, o as Aa, P as ma, r as ca, s as Ea, at as la, aq as Ca, as as ya, ar as Pa, t as Fa, v as ba, ax as ga, au as da, aw as Sa, av as ka, Q as Ma, w as ha, x as xa, R as va, z as Da, y as Ta, B as Ra, E as fa, S as za, H as Na, T as Qa, aB as Wa, ay as Ba, aA as Oa, az as Ia, g as La, u as qa } from "../ServerProvider-
|
|
1
|
+
import { A as e, a as i, C as o, b as n, c as t, aC as r, e as p, f as u, d as A, O as m, I as c, K as E, J as l, X as C, U as y, W as P, V as F, $ as b, Y as g, _ as d, Z as S, D as k, a3 as M, a0 as h, a2 as x, a1 as v, h as D, a7 as T, a4 as R, a6 as f, a5 as z, ab as N, a8 as Q, aa as W, a9 as B, ap as O, F as I, i as L, G as q, L as w, j, k as G, M as H, l as J, ag as K, m as U, af as V, ac as X, ae as Y, ad as Z, ak as _, ah as $, aj as aa, ai as sa, n as ea, N as ia, ao as oa, al as na, an as ta, am as ra, q as pa, p as ua, o as Aa, P as ma, r as ca, s as Ea, at as la, aq as Ca, as as ya, ar as Pa, t as Fa, v as ba, ax as ga, au as da, aw as Sa, av as ka, Q as Ma, w as ha, x as xa, R as va, z as Da, y as Ta, B as Ra, E as fa, S as za, H as Na, T as Qa, aB as Wa, ay as Ba, aA as Oa, az as Ia, g as La, u as qa } from "../ServerProvider-X2Ma0HRs.es.js";
|
|
2
2
|
export {
|
|
3
3
|
e as AttachedDatabaseTypeEnum,
|
|
4
4
|
i as AzureConnectionAuthTypeEnum,
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { DrillNavigation } from '../drill';
|
|
2
|
+
import { DashboardEventHandler } from './telemetry';
|
|
3
|
+
export { DEFAULT_COLUMNS, tileGridColumn } from './DashboardGrid';
|
|
2
4
|
export interface DashboardProps {
|
|
3
5
|
/** `publisher://environments/{env}/packages/{pkg}`, optionally `?versionId=`. */
|
|
4
6
|
resourceUri: string;
|
|
@@ -37,20 +39,9 @@ export interface DashboardProps {
|
|
|
37
39
|
*/
|
|
38
40
|
height?: number;
|
|
39
41
|
maxResultSize?: number;
|
|
42
|
+
/** The rows shown and tiles explored, for the host to log or count. */
|
|
43
|
+
onEvent?: DashboardEventHandler;
|
|
40
44
|
}
|
|
41
|
-
/**
|
|
42
|
-
* The `grid-column` one tile occupies: its `# colspan`, and a `# break` forcing
|
|
43
|
-
* it to start a fresh row.
|
|
44
|
-
*
|
|
45
|
-
* Clamped to the grid width the same way @malloydata/render clamps it, so one
|
|
46
|
-
* view laid out as a composite tile and as a `nest:` under `# dashboard` lands
|
|
47
|
-
* in the same place. A break is `1 / span N` — an explicit start line, which is
|
|
48
|
-
* what pushes the tile down to the next row; the renderer's grid does the same.
|
|
49
|
-
*/
|
|
50
|
-
export declare function tileGridColumn(tile: {
|
|
51
|
-
colspan?: number;
|
|
52
|
-
break?: boolean;
|
|
53
|
-
}, columns: number): string;
|
|
54
45
|
/**
|
|
55
46
|
* A Malloyyo-style dashboard: a control row over one or more query results,
|
|
56
47
|
* declared entirely by tags in a package's `dashboards/*.malloy`.
|
|
@@ -60,5 +51,19 @@ export declare function tileGridColumn(tile: {
|
|
|
60
51
|
* Console and an external React app render the same component and differ only
|
|
61
52
|
* in what they do with `onNavigate` and `onGivensChange`.
|
|
62
53
|
*/
|
|
63
|
-
export declare function Dashboard({ resourceUri, dashboard, givens, onGivensChange, onNavigate, height, maxResultSize, }: DashboardProps): import("react/jsx-runtime").JSX.Element;
|
|
54
|
+
export declare function Dashboard({ resourceUri, dashboard, givens, onGivensChange, onNavigate, height, maxResultSize, onEvent, }: DashboardProps): import("react/jsx-runtime").JSX.Element;
|
|
55
|
+
/**
|
|
56
|
+
* The prose header itself, over the two fields it actually needs.
|
|
57
|
+
*
|
|
58
|
+
* Separate from {@link DashboardHeader} so the BUILDER can render the same
|
|
59
|
+
* header over a `DashboardDocument` — which carries `title` and `description`
|
|
60
|
+
* but is not a manifest. Same argument as {@link tileGridColumn}: what the
|
|
61
|
+
* builder shows a author is the thing a reader will see, and one component is
|
|
62
|
+
* what stops the two drifting. A builder that restated this markdown block
|
|
63
|
+
* would be one edit away from showing a different header than it writes.
|
|
64
|
+
*/
|
|
65
|
+
export declare function DashboardProse({ title, description, }: {
|
|
66
|
+
title: string;
|
|
67
|
+
description?: string;
|
|
68
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
64
69
|
export default Dashboard;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/** Grid width when the dashboard declares no `# dashboard { columns=N }`. */
|
|
3
|
+
export declare const DEFAULT_COLUMNS = 2;
|
|
4
|
+
/**
|
|
5
|
+
* The gutter between tiles, in px.
|
|
6
|
+
*
|
|
7
|
+
* A number rather than a `gap: 2` spacing unit because the BUILDER has to do
|
|
8
|
+
* arithmetic with it: turning a dragged edge into a column count means solving
|
|
9
|
+
* for the track width, and that needs the gutter in the same units as a
|
|
10
|
+
* `getBoundingClientRect`. Exported so the value the grid paints and the value
|
|
11
|
+
* the drag solves with cannot drift apart.
|
|
12
|
+
*/
|
|
13
|
+
export declare const GRID_GAP_PX = 16;
|
|
14
|
+
/**
|
|
15
|
+
* The `grid-column` one tile occupies: its `# colspan`, and a `# break` forcing
|
|
16
|
+
* it to start a fresh row.
|
|
17
|
+
*
|
|
18
|
+
* Clamped to the grid width the same way @malloydata/render clamps it, so one
|
|
19
|
+
* view laid out as a composite tile and as a `nest:` under `# dashboard` lands
|
|
20
|
+
* in the same place. A break is `1 / span N` — an explicit start line, which is
|
|
21
|
+
* what pushes the tile down to the next row; the renderer's grid does the same.
|
|
22
|
+
*/
|
|
23
|
+
export declare function tileGridColumn(tile: {
|
|
24
|
+
colspan?: number;
|
|
25
|
+
break?: boolean;
|
|
26
|
+
}, columns: number): string;
|
|
27
|
+
/** The layout a tile carries, whatever else its own shape holds. */
|
|
28
|
+
export interface GridTile {
|
|
29
|
+
colspan?: number;
|
|
30
|
+
break?: boolean;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The composite dashboard's grid: the column track, and each tile's place on
|
|
34
|
+
* it.
|
|
35
|
+
*
|
|
36
|
+
* Shared by the READER ({@link Dashboard}) and the BUILDER, which is the whole
|
|
37
|
+
* point of it being a component rather than a rule each surface applies. An
|
|
38
|
+
* author arranging a dashboard is arranging the thing a reader will open, so
|
|
39
|
+
* the two cannot be allowed to lay tiles out even slightly differently; a
|
|
40
|
+
* restated track without the grid item's own `display: grid` ends rows at
|
|
41
|
+
* ragged heights on one surface and level on the other.
|
|
42
|
+
*
|
|
43
|
+
* **Why the item is a grid and not a block.** A grid item stretches to its row,
|
|
44
|
+
* but a block CHILD of one does not — it keeps its content height. Results
|
|
45
|
+
* divide on exactly that line (see `resultSizing`): a table, a map or a
|
|
46
|
+
* `# big_value` sizes to its content, while a plotted chart fills whatever box
|
|
47
|
+
* it is handed. So a block item put a short table beside a tall chart and let
|
|
48
|
+
* the row end twice. Making the item a grid passes the row's height down to the
|
|
49
|
+
* tile, and every card in a row ends level.
|
|
50
|
+
*
|
|
51
|
+
* The tile itself is the caller's: the reader renders a `DashboardTile`, the
|
|
52
|
+
* builder wraps one in its selection outline. Anything this component rendered
|
|
53
|
+
* on their behalf would be a third opinion about what a tile looks like.
|
|
54
|
+
*/
|
|
55
|
+
export declare function DashboardGrid<T extends GridTile>({ tiles, columns, keyOf, renderTile, }: {
|
|
56
|
+
tiles: readonly T[];
|
|
57
|
+
/** Track count — `# dashboard { columns=N }`, or {@link DEFAULT_COLUMNS}. */
|
|
58
|
+
columns: number;
|
|
59
|
+
/**
|
|
60
|
+
* This tile's React key. Taken from the caller because the two surfaces
|
|
61
|
+
* identify a tile differently and both are right: the manifest's `tiles=[…]`
|
|
62
|
+
* can repeat one expression (a typo, not a request for two identical
|
|
63
|
+
* panels), so the reader keys on position as well.
|
|
64
|
+
*/
|
|
65
|
+
keyOf: (tile: T, index: number) => string;
|
|
66
|
+
renderTile: (tile: T, index: number) => ReactNode;
|
|
67
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -35,6 +35,11 @@ export interface DashboardTileProps {
|
|
|
35
35
|
maxResultSize?: number;
|
|
36
36
|
/** Cell clicks and their affordance, for the dashboard's `# drill`. */
|
|
37
37
|
drill?: DrillBinding;
|
|
38
|
+
/**
|
|
39
|
+
* Open this tile's query somewhere it can be changed. Shown as a button in
|
|
40
|
+
* the heading, on hover; absent, the heading has no button.
|
|
41
|
+
*/
|
|
42
|
+
onExplore?: () => void;
|
|
38
43
|
}
|
|
39
44
|
/**
|
|
40
45
|
* A composite tile's heading when the view it names carries no `# label`: the
|
|
@@ -54,4 +59,4 @@ export declare function tileTitle(tile: string): string;
|
|
|
54
59
|
* tile: the broken one shows its error in place and the rest of the grid still
|
|
55
60
|
* renders, rather than one failure blanking the page.
|
|
56
61
|
*/
|
|
57
|
-
export declare function DashboardTile({ environmentName, packageName, versionId, modelPath, queryName, tile, label, subtitle, borderless, givens, declaredTypes, givenNames, height, maxResultSize, drill, }: DashboardTileProps): import("react/jsx-runtime").JSX.Element;
|
|
62
|
+
export declare function DashboardTile({ environmentName, packageName, versionId, modelPath, queryName, tile, label, subtitle, borderless, givens, declaredTypes, givenNames, height, maxResultSize, drill, onExplore, }: DashboardTileProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* "Explore from here": the tile's query, open in the model explorer on the
|
|
3
|
+
* tile's source, so the reader can change it rather than only look at it.
|
|
4
|
+
*
|
|
5
|
+
* The dashboard file is itself a model, so the explorer opens on that file:
|
|
6
|
+
* the tile's source is an extension declared there, and its query resolves
|
|
7
|
+
* as written. The model is fetched here rather than inside the explorer so
|
|
8
|
+
* the tile's source can be selected before it renders.
|
|
9
|
+
*/
|
|
10
|
+
export declare function ExploreDialog({ tile, environmentName, packageName, versionId, modelPath, onClose, }: {
|
|
11
|
+
/** The tile expression to open, or undefined when closed. */
|
|
12
|
+
tile: string | undefined;
|
|
13
|
+
environmentName: string;
|
|
14
|
+
packageName: string;
|
|
15
|
+
versionId?: string;
|
|
16
|
+
modelPath: string;
|
|
17
|
+
onClose: () => void;
|
|
18
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The rows behind a value: "show the rows" on a cell, as one query.
|
|
3
|
+
*
|
|
4
|
+
* A grouped value is an aggregate over rows of the tile's source, and Malloy's
|
|
5
|
+
* `drill:` names exactly those rows: `drill: <view>.<field> = <value>` applies
|
|
6
|
+
* the view's own `where:` — the tile's control bindings included — and the
|
|
7
|
+
* clicked value's, so what comes back is the rows the number was made of.
|
|
8
|
+
* Measured: `where: name = …` alone failed on a view that spelled the column
|
|
9
|
+
* `name is products.name`, because the output name is not a source field;
|
|
10
|
+
* `drill:` resolves it through the view, which is where the name lives.
|
|
11
|
+
*/
|
|
12
|
+
export declare const ROW_LIMIT = 200;
|
|
13
|
+
export interface RowsRequest {
|
|
14
|
+
/** The source the rows are of: the tile expression's first step. */
|
|
15
|
+
source: string;
|
|
16
|
+
/** The view the value was grouped in: the expression's last step. */
|
|
17
|
+
view: string;
|
|
18
|
+
field: string;
|
|
19
|
+
rawValue: unknown;
|
|
20
|
+
label: string;
|
|
21
|
+
}
|
|
22
|
+
/** The query the dialog runs, or undefined when the value cannot be spelled. */
|
|
23
|
+
export declare function rowsQuery(request: RowsRequest): string | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* `overview -> revenue_trend` → its source and view; undefined for anything
|
|
26
|
+
* else — an inline stage has no view to drill through, a refined one carries
|
|
27
|
+
* filters `drill:` would not, and a longer pipeline has no one view its value
|
|
28
|
+
* came from.
|
|
29
|
+
*/
|
|
30
|
+
export declare function stepsOf(tileExpression: string | undefined): {
|
|
31
|
+
source: string;
|
|
32
|
+
view: string;
|
|
33
|
+
} | undefined;
|
|
34
|
+
/** The source alone, for opening the explorer on it. */
|
|
35
|
+
export declare const sourceOf: (tileExpression: string | undefined) => string;
|
|
36
|
+
export declare function RowsDialog({ request, environmentName, packageName, versionId, modelPath, givens, onClose, onDone, }: {
|
|
37
|
+
request: RowsRequest | undefined;
|
|
38
|
+
environmentName: string;
|
|
39
|
+
packageName: string;
|
|
40
|
+
versionId?: string;
|
|
41
|
+
modelPath: string;
|
|
42
|
+
/** The applied control row, which the source's own `where:` may read. */
|
|
43
|
+
givens: Record<string, unknown>;
|
|
44
|
+
onClose: () => void;
|
|
45
|
+
/** The query's outcome and how long it took, once per request. */
|
|
46
|
+
onDone?: (ok: boolean, durationMs: number) => void;
|
|
47
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { SxProps, Theme } from '@mui/material';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* The card a dashboard tile sits in, and nothing else — so the builder, which
|
|
5
|
+
* draws a stand-in tile when it has no server to run one, draws the same card
|
|
6
|
+
* the reader does rather than restating its geometry.
|
|
7
|
+
*
|
|
8
|
+
* The instance theme's border, not MUI's `divider`: the renderer card's edge is
|
|
9
|
+
* this same value, and a card that agrees with the theme everywhere except its
|
|
10
|
+
* outline still reads as a different card. Radius stays on the host's
|
|
11
|
+
* `shape.borderRadius`, which the renderer card is pointed at too. The
|
|
12
|
+
* background is `theme.tile`, the value the renderer card paints — left unset,
|
|
13
|
+
* on a theme whose page is also white the composite tiles lost the tint that
|
|
14
|
+
* separates a card from the page while the single-query form kept it.
|
|
15
|
+
*
|
|
16
|
+
* `borderless` is `# borderless` on the view: the result with no card, which
|
|
17
|
+
* the renderer honours by dropping background, border, radius and most padding
|
|
18
|
+
* on its own `.dashboard-item`. Same here, so the tag reads the same on both
|
|
19
|
+
* forms.
|
|
20
|
+
*
|
|
21
|
+
* `overflow: hidden` and `minWidth: 0` are load-bearing for RESIZING, not
|
|
22
|
+
* tidiness: this card is a grid item, and a grid item that clips gets a
|
|
23
|
+
* minimum width of zero instead of its content's, which is what lets it
|
|
24
|
+
* narrow below the chart it holds so the renderer redraws the chart to fit.
|
|
25
|
+
* See the `minWidth: 0` note in `DashboardGrid` for the rest of that chain.
|
|
26
|
+
*/
|
|
27
|
+
export declare function TileCard({ borderless, sx, children, }: {
|
|
28
|
+
borderless?: boolean;
|
|
29
|
+
sx?: SxProps<Theme>;
|
|
30
|
+
children: ReactNode;
|
|
31
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
/**
|
|
33
|
+
* A tile's heading: its `# label`, and its `# subtitle` under it. In the
|
|
34
|
+
* instance theme's title colour and face, so a tile is titled the same
|
|
35
|
+
* whichever surface draws it.
|
|
36
|
+
*/
|
|
37
|
+
export declare function TileHeading({ title, subtitle, tooltip, action, }: {
|
|
38
|
+
title: string;
|
|
39
|
+
subtitle?: string;
|
|
40
|
+
/** What actually ran, kept reachable without being the heading. */
|
|
41
|
+
tooltip?: string;
|
|
42
|
+
/** A control on the heading's row, hard right — the tile's Explore button. */
|
|
43
|
+
action?: ReactNode;
|
|
44
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a dashboard surface reports about itself, for the host to log or
|
|
3
|
+
* count: the operations that matter (open, save, export, the rows behind a
|
|
4
|
+
* value, exploring a tile), each with its outcome and how long it took.
|
|
5
|
+
*
|
|
6
|
+
* Context-free on purpose — the host that mounted the surface knows which
|
|
7
|
+
* environment, package and dashboard it is, and adds that when it logs.
|
|
8
|
+
*/
|
|
9
|
+
export type DashboardEvent = {
|
|
10
|
+
type: "dashboard.opened";
|
|
11
|
+
/** The package file, or a draft the host had saved. */
|
|
12
|
+
from: "package" | "draft";
|
|
13
|
+
tiles: number;
|
|
14
|
+
durationMs: number;
|
|
15
|
+
} | {
|
|
16
|
+
type: "dashboard.open_refused";
|
|
17
|
+
reason: string;
|
|
18
|
+
} | {
|
|
19
|
+
type: "dashboard.saved";
|
|
20
|
+
tiles: number;
|
|
21
|
+
/** Whether a tile was added or removed, which moves declarations. */
|
|
22
|
+
structural: boolean;
|
|
23
|
+
durationMs: number;
|
|
24
|
+
} | {
|
|
25
|
+
type: "dashboard.save_refused";
|
|
26
|
+
reason: string;
|
|
27
|
+
} | {
|
|
28
|
+
type: "dashboard.exported";
|
|
29
|
+
bytes: number;
|
|
30
|
+
} | {
|
|
31
|
+
type: "dashboard.rows_shown";
|
|
32
|
+
source: string;
|
|
33
|
+
view: string;
|
|
34
|
+
field: string;
|
|
35
|
+
ok: boolean;
|
|
36
|
+
durationMs: number;
|
|
37
|
+
} | {
|
|
38
|
+
type: "dashboard.explored";
|
|
39
|
+
tile: string;
|
|
40
|
+
};
|
|
41
|
+
export type DashboardEventHandler = (event: DashboardEvent) => void;
|
|
42
|
+
/** A monotonic clock in milliseconds, for durations. */
|
|
43
|
+
export declare const now: () => number;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { PackageCatalog } from './catalog';
|
|
2
|
+
import { DashboardDocument } from './document';
|
|
3
|
+
/**
|
|
4
|
+
* What a new tile is: a view, picked from the package, on a source this file
|
|
5
|
+
* can reach.
|
|
6
|
+
*
|
|
7
|
+
* The picker is what makes a tile expression correct BY CONSTRUCTION. Every
|
|
8
|
+
* `source -> view` it offers came from the catalog, so the builder never emits
|
|
9
|
+
* a tile that does not resolve — which is why saving needs no compile step
|
|
10
|
+
* beyond the reader's own round-trip.
|
|
11
|
+
*
|
|
12
|
+
* "Can reach" is the rule the writer enforces and the reason some sources are
|
|
13
|
+
* not offered: a tile's view is declared in an extension of a model source, and
|
|
14
|
+
* that source has to be in this file's scope. The builder never adds an
|
|
15
|
+
* import, so a model source is offered only when the file already extends it,
|
|
16
|
+
* or imports it BY NAME. A bare `import "../m.malloy"` may well bring it in,
|
|
17
|
+
* but the file cannot say so, and a guess here fails the whole package load.
|
|
18
|
+
*/
|
|
19
|
+
export interface NewTile {
|
|
20
|
+
/** The model source the view lives on. */
|
|
21
|
+
base: string;
|
|
22
|
+
/** The view, as the catalog names it. */
|
|
23
|
+
view: string;
|
|
24
|
+
label?: string;
|
|
25
|
+
colspan: number;
|
|
26
|
+
}
|
|
27
|
+
export interface AddTileDialogProps {
|
|
28
|
+
open: boolean;
|
|
29
|
+
document: DashboardDocument;
|
|
30
|
+
catalog: PackageCatalog | undefined;
|
|
31
|
+
columns: number;
|
|
32
|
+
onClose: () => void;
|
|
33
|
+
onAdd: (tile: NewTile) => void;
|
|
34
|
+
}
|
|
35
|
+
export declare function AddTileDialog({ open, document, catalog, columns, onClose, onAdd, }: AddTileDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* The edit bar across the top of the builder, in the shape every builder has
|
|
4
|
+
* settled on: that you are editing on the left, what you can do about it on
|
|
5
|
+
* the right.
|
|
6
|
+
*
|
|
7
|
+
* Sticky, so undo and save stay in reach on a long dashboard; the reader's own
|
|
8
|
+
* header (title and description) stays in the page below it rather than being
|
|
9
|
+
* repeated here.
|
|
10
|
+
*/
|
|
11
|
+
export interface BuilderToolbarProps {
|
|
12
|
+
canUndo: boolean;
|
|
13
|
+
canRedo: boolean;
|
|
14
|
+
onUndo: () => void;
|
|
15
|
+
onRedo: () => void;
|
|
16
|
+
dirty: boolean;
|
|
17
|
+
saving: boolean;
|
|
18
|
+
/** Absent when the builder has nowhere to save: no Save, no unsaved marker. */
|
|
19
|
+
onSave?: () => void;
|
|
20
|
+
/** The host's actions, beside the builder's own: Export, Done. */
|
|
21
|
+
actions?: ReactNode;
|
|
22
|
+
/** Open the add-tile picker. Absent when the host passed no catalog to pick from. */
|
|
23
|
+
onAddTile?: () => void;
|
|
24
|
+
/** Open the page's settings, anchored to the button that asked. */
|
|
25
|
+
onSettings: (anchor: HTMLElement) => void;
|
|
26
|
+
/** Quick layout: every tile this file owns to one width. */
|
|
27
|
+
onQuickLayout: (share: 1 | 2 | 3 | 4) => void;
|
|
28
|
+
}
|
|
29
|
+
export declare function BuilderToolbar({ canUndo, canRedo, onUndo, onRedo, dirty, saving, onSave, actions, onAddTile, onSettings, onQuickLayout, }: BuilderToolbarProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { DashboardEventHandler } from '../Dashboard/telemetry';
|
|
3
|
+
import { BuilderGiven } from './controls';
|
|
4
|
+
import { PackageCatalog } from './catalog';
|
|
5
|
+
import { DashboardDocument, DashboardTile } from './document';
|
|
6
|
+
export type { BuilderGiven } from './controls';
|
|
7
|
+
/**
|
|
8
|
+
* The dashboard builder's editing surface.
|
|
9
|
+
*
|
|
10
|
+
* Lays the tiles out on the SAME grid the dashboard renders on — literally the
|
|
11
|
+
* same component, `DashboardGrid`, rather than a grid restated here to match.
|
|
12
|
+
* What you arrange is what a reader will see, and the two cannot drift.
|
|
13
|
+
*
|
|
14
|
+
* The TILE ITSELF is the caller's business, through `renderTile`. A tile's
|
|
15
|
+
* result comes from running a query, and where that query runs differs between
|
|
16
|
+
* a saved package dashboard and an unsaved draft; keeping it out here means the
|
|
17
|
+
* editing surface can be mounted, tested and reviewed without a server.
|
|
18
|
+
*
|
|
19
|
+
* `renderTile` replaces the tile rather than filling it, because `DashboardTile`
|
|
20
|
+
* draws its own card AND its own heading. Nesting one inside a card of ours
|
|
21
|
+
* would show a card in a card under two titles — which is precisely not what a
|
|
22
|
+
* reader sees. So every affordance is drawn AROUND whatever the caller renders:
|
|
23
|
+
* an outline for selection, a grip and a menu in the corners, a handle at the
|
|
24
|
+
* edge.
|
|
25
|
+
*
|
|
26
|
+
* **Everything here is on the thing it changes.** Drag a tile's right edge to
|
|
27
|
+
* set its width, and the tile itself to reorder — into the empty end of a row
|
|
28
|
+
* to change which row it is in. The tile's own menu holds its title and
|
|
29
|
+
* subtitle. FILTERS are configured in exactly one place, the strip under the
|
|
30
|
+
* header: each chip opens the tiles-to-update window for that control,
|
|
31
|
+
* which is where a tile is bound or unbound, and "Add filter" declares a new
|
|
32
|
+
* one in this file — the convention {@link LocalGiven} describes — or binds one
|
|
33
|
+
* the model offers. Nothing about filters is on the tiles themselves: a second
|
|
34
|
+
* place to edit the same binding is a second place for it to be wrong.
|
|
35
|
+
*
|
|
36
|
+
* Tiles are added from the package's catalog and removed from their menu; a
|
|
37
|
+
* save that adds or removes one shows the file's diff first, because those
|
|
38
|
+
* moves relocate declarations and the comments beside them.
|
|
39
|
+
*/
|
|
40
|
+
export interface DashboardBuilderProps {
|
|
41
|
+
/** The file being edited. */
|
|
42
|
+
source: string;
|
|
43
|
+
/** The document that file produced. */
|
|
44
|
+
document: DashboardDocument;
|
|
45
|
+
/** Persist the patched file. Left out, the builder edits without saving. */
|
|
46
|
+
onSave?: (source: string) => Promise<void> | void;
|
|
47
|
+
/**
|
|
48
|
+
* The document as it stands, on every edit — including the first render.
|
|
49
|
+
*
|
|
50
|
+
* For the host's LIVE VIEW. A tile's result and the control row are the
|
|
51
|
+
* host's to render (`renderTile`, `controls`), and both have to follow the
|
|
52
|
+
* document rather than the saved file, or an edit looks like it did
|
|
53
|
+
* nothing: unbinding a tile left it filtering, removing a control left it
|
|
54
|
+
* in the row. `preview.ts` turns the document handed here into what a reader
|
|
55
|
+
* would see.
|
|
56
|
+
*/
|
|
57
|
+
onChange?: (document: DashboardDocument) => void;
|
|
58
|
+
/**
|
|
59
|
+
* Renders a tile, card and heading included — this is where a real
|
|
60
|
+
* `DashboardTile` goes. Without it, tiles show what they will run.
|
|
61
|
+
*/
|
|
62
|
+
renderTile?: (tile: DashboardTile) => ReactNode;
|
|
63
|
+
/**
|
|
64
|
+
* The control row, in the slot the reader puts it — this is where a real
|
|
65
|
+
* `GivensPanel` goes.
|
|
66
|
+
*
|
|
67
|
+
* A seam for the same reason as `renderTile`, and not an oversight: a
|
|
68
|
+
* control's SPEC (its type, its control tag, its suggestions) is resolved by
|
|
69
|
+
* the server across the model and everything it imports, and a
|
|
70
|
+
* `DashboardDocument` holds only what this one file declares. The storefront
|
|
71
|
+
* dashboard is the ordinary case — it imports every given from
|
|
72
|
+
* `../givens.malloy` — so a bar built from the document alone would come up
|
|
73
|
+
* empty and claim the dashboard has no filters. Better to let a caller that
|
|
74
|
+
* has the manifest hand over the real one.
|
|
75
|
+
*
|
|
76
|
+
* It matters to LAYOUT, not just to fidelity: the bar takes vertical space
|
|
77
|
+
* above the grid, so an author arranging tiles without it is arranging
|
|
78
|
+
* against a page the reader never sees.
|
|
79
|
+
*/
|
|
80
|
+
controls?: ReactNode;
|
|
81
|
+
/**
|
|
82
|
+
* Givens a tile can be bound to, for the palette above the grid.
|
|
83
|
+
*
|
|
84
|
+
* A prop for the same reason as `controls`: which givens exist is resolved
|
|
85
|
+
* by the server across the model and its imports, and a `DashboardDocument`
|
|
86
|
+
* knows only what its own file declares.
|
|
87
|
+
*/
|
|
88
|
+
givens?: BuilderGiven[];
|
|
89
|
+
/**
|
|
90
|
+
* What the package offers, for the filter window to SEARCH a field rather
|
|
91
|
+
* than take one on trust: the dimensions of the source the tiles read are
|
|
92
|
+
* offered, an unknown name is marked where it stands, and a binding to a
|
|
93
|
+
* field the source does not have cannot be applied. Absent, any name is
|
|
94
|
+
* accepted — a binding to a missing field then fails at package load, which
|
|
95
|
+
* is the worst place for it.
|
|
96
|
+
*/
|
|
97
|
+
catalog?: PackageCatalog;
|
|
98
|
+
/**
|
|
99
|
+
* The other dashboards in the package, by slug — where a clicked cell can
|
|
100
|
+
* go. Absent, a drill can only filter this dashboard.
|
|
101
|
+
*/
|
|
102
|
+
dashboards?: string[];
|
|
103
|
+
/** Saves and refusals, for the host to log; see `DashboardEvent`. */
|
|
104
|
+
onEvent?: DashboardEventHandler;
|
|
105
|
+
/**
|
|
106
|
+
* The host's own actions for the edit bar — Export, Done — rendered beside
|
|
107
|
+
* undo, redo and save. The builder owns the edits; where the file goes
|
|
108
|
+
* afterwards is the host's, so its buttons sit in the host's slot.
|
|
109
|
+
*/
|
|
110
|
+
toolbar?: ReactNode;
|
|
111
|
+
}
|
|
112
|
+
export declare function DashboardBuilder({ source, document, onSave, onChange, renderTile, controls, givens, catalog, toolbar, dashboards, onEvent, }: DashboardBuilderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { DashboardEventHandler } from '../Dashboard/telemetry';
|
|
2
|
+
/**
|
|
3
|
+
* The builder, opened on a package dashboard, with everything a host has to
|
|
4
|
+
* supply already wired: the file's text and manifest from the server, a live
|
|
5
|
+
* control row and live tiles that follow the document, a catalog for the
|
|
6
|
+
* filter window's field search, and saving.
|
|
7
|
+
*
|
|
8
|
+
* SAVING is through the host's {@link DocumentStorage}, not to the package.
|
|
9
|
+
* The package dashboard is a read-only origin: editing works on a copy, the
|
|
10
|
+
* copy is saved where the host keeps documents (the Console's default is this
|
|
11
|
+
* browser), and "Export" hands the file back so it can be put in the package.
|
|
12
|
+
* That is the plan's copy-and-export model, and it needs no server write path.
|
|
13
|
+
* A host with no storage still gets the editor, without Save.
|
|
14
|
+
*
|
|
15
|
+
* What that costs is stated in the toolbar: a control added here is live in the
|
|
16
|
+
* editor (its value is written into each tile's query) but reaches the package
|
|
17
|
+
* only when the exported file does.
|
|
18
|
+
*/
|
|
19
|
+
export interface DashboardEditorProps {
|
|
20
|
+
environmentName: string;
|
|
21
|
+
packageName: string;
|
|
22
|
+
/** The dashboard's slug: `overview`, not `dashboards/overview.malloy`. */
|
|
23
|
+
dashboardName: string;
|
|
24
|
+
/** Leave the editor: the host's "Done". Absent, no Done button. */
|
|
25
|
+
onExit?: () => void;
|
|
26
|
+
/**
|
|
27
|
+
* What the editor does — opened, saved, exported, refused — for the host
|
|
28
|
+
* to log or count; see `DashboardEvent`.
|
|
29
|
+
*/
|
|
30
|
+
onEvent?: DashboardEventHandler;
|
|
31
|
+
}
|
|
32
|
+
export declare function DashboardEditor({ environmentName, packageName, dashboardName, onExit, onEvent, }: DashboardEditorProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a save will do to the file, before it does it.
|
|
3
|
+
*
|
|
4
|
+
* Shown for a STRUCTURAL save — a tile added or removed — because those move
|
|
5
|
+
* declarations and the comments beside them, and the file is git-native: a
|
|
6
|
+
* diff is the idiom its authors already read. A property edit never needs
|
|
7
|
+
* this; it changes one tag on one line.
|
|
8
|
+
*/
|
|
9
|
+
export declare function DiffDialog({ open, before, after, onConfirm, onClose, }: {
|
|
10
|
+
open: boolean;
|
|
11
|
+
before: string;
|
|
12
|
+
after: string;
|
|
13
|
+
onConfirm: () => void;
|
|
14
|
+
onClose: () => void;
|
|
15
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DashboardDocument, DashboardDrill, DashboardSource } from './document';
|
|
2
|
+
export interface DrillDialogProps {
|
|
3
|
+
open: boolean;
|
|
4
|
+
document: DashboardDocument;
|
|
5
|
+
/** The tile's source: the extension whose dimensions are offered. */
|
|
6
|
+
source: DashboardSource | undefined;
|
|
7
|
+
/** The controls a click can write into: the dashboard's and the model's. */
|
|
8
|
+
givenNames: string[];
|
|
9
|
+
/** Other dashboards in the package, by slug, as `to=` destinations. */
|
|
10
|
+
dashboards: string[];
|
|
11
|
+
onClose: () => void;
|
|
12
|
+
/** Every drill on `source`, replacing what the document had for it. */
|
|
13
|
+
onApply: (drills: DashboardDrill[]) => void;
|
|
14
|
+
}
|
|
15
|
+
export declare function DrillDialog({ open, document, source, givenNames, dashboards, onClose, onApply, }: DrillDialogProps): import("react/jsx-runtime").JSX.Element;
|