@aintela/bi 0.2.0
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 +299 -0
- package/dist/BiClientProvider-CWJochvi.js +219 -0
- package/dist/BiClientProvider-CWJochvi.js.map +1 -0
- package/dist/ChartCardDefaultsContext-Cl5T25H0.js +32 -0
- package/dist/ChartCardDefaultsContext-Cl5T25H0.js.map +1 -0
- package/dist/ChartContext-C_f_6khG.js +14 -0
- package/dist/ChartContext-C_f_6khG.js.map +1 -0
- package/dist/DashboardParametersContext-Clv--79U.js +39 -0
- package/dist/DashboardParametersContext-Clv--79U.js.map +1 -0
- package/dist/cards/ChartCard.d.ts +62 -0
- package/dist/cards/DataTableCard.d.ts +55 -0
- package/dist/cards/GaugeCard.d.ts +20 -0
- package/dist/cards/GaugeGroup.d.ts +12 -0
- package/dist/cards/MapBubbles.d.ts +35 -0
- package/dist/cards/MapConnections.d.ts +28 -0
- package/dist/cards/MetricCard.d.ts +15 -0
- package/dist/cards/MetricGroupCard.d.ts +10 -0
- package/dist/cards/TreeMapCard.d.ts +15 -0
- package/dist/cards/geoLayers.d.ts +23 -0
- package/dist/cards/index.d.ts +24 -0
- package/dist/cards/licenseGuard.d.ts +9 -0
- package/dist/cards/mapUtils.d.ts +23 -0
- package/dist/cards/useContainerRectangle.d.ts +9 -0
- package/dist/cards/worldMapPath.d.ts +7 -0
- package/dist/cards.d.ts +2 -0
- package/dist/cards.js +28 -0
- package/dist/cards.js.map +1 -0
- package/dist/client/BiClient.d.ts +160 -0
- package/dist/client/BiClientProvider.d.ts +21 -0
- package/dist/client/index.d.ts +4 -0
- package/dist/client.d.ts +2 -0
- package/dist/client.js +11 -0
- package/dist/client.js.map +1 -0
- package/dist/composer/environment/environmentDom.d.ts +31 -0
- package/dist/composer/environment/types.d.ts +67 -0
- package/dist/composer/icons/cardTypeIcons.d.ts +31 -0
- package/dist/composer/index.d.ts +66 -0
- package/dist/composer/llm/ExampleCardSketch.d.ts +22 -0
- package/dist/composer/llm/ExamplePad.d.ts +18 -0
- package/dist/composer/llm/PrototypePad.d.ts +13 -0
- package/dist/composer/llm/useDashboardPad.d.ts +25 -0
- package/dist/composer/models/catalog.d.ts +33 -0
- package/dist/composer/models/sketchModels.d.ts +102 -0
- package/dist/composer/models/utils.d.ts +9 -0
- package/dist/composer/pad/CardSketch.d.ts +25 -0
- package/dist/composer/pad/ClonedComponent.d.ts +13 -0
- package/dist/composer/pad/DashboardPad.d.ts +38 -0
- package/dist/composer/pad/DashboardPadEditor.d.ts +35 -0
- package/dist/composer/pad/DashboardPadSketch.d.ts +31 -0
- package/dist/composer/pad/DatasetParameterizationControls.d.ts +34 -0
- package/dist/composer/pad/FilterSketch.d.ts +10 -0
- package/dist/composer/pad/HoverButton.d.ts +12 -0
- package/dist/composer/pad/TitleSketch.d.ts +19 -0
- package/dist/composer/pad/ToolBox.d.ts +11 -0
- package/dist/composer/store/ComposerProvider.d.ts +36 -0
- package/dist/composer/store/createComposerStore.d.ts +107 -0
- package/dist/composer/store/drafts.d.ts +20 -0
- package/dist/composer/view/ComposerChatBinding.d.ts +10 -0
- package/dist/composer/view/ComposerView.d.ts +49 -0
- package/dist/composer/view/DashboardPin.d.ts +3 -0
- package/dist/composer/view/DashboardSidePanel.d.ts +10 -0
- package/dist/composer/view/DrawablePrompt.d.ts +22 -0
- package/dist/composer/view/EntryEmptyState.d.ts +22 -0
- package/dist/composer/view/SpotlightOverlay.d.ts +21 -0
- package/dist/composer/view/composerAnimations.d.ts +11 -0
- package/dist/composer/view/composerTypes.d.ts +18 -0
- package/dist/composer/view/data/suggestions.d.ts +10 -0
- package/dist/composer/view/data/templates.d.ts +33 -0
- package/dist/composer/view/surfaces.d.ts +19 -0
- package/dist/composer/view/useComposerChatBridge.d.ts +43 -0
- package/dist/composer.d.ts +2 -0
- package/dist/composer.js +99 -0
- package/dist/composer.js.map +1 -0
- package/dist/createBiTheme-TyUv_UHM.js +93 -0
- package/dist/createBiTheme-TyUv_UHM.js.map +1 -0
- package/dist/data/ChartCardDefaultsContext.d.ts +43 -0
- package/dist/data/dataUtils.d.ts +152 -0
- package/dist/data/index.d.ts +5 -0
- package/dist/data/queryModel.d.ts +23 -0
- package/dist/data.d.ts +2 -0
- package/dist/data.js +37 -0
- package/dist/data.js.map +1 -0
- package/dist/dataUtils-CAUE5uZY.js +372 -0
- package/dist/dataUtils-CAUE5uZY.js.map +1 -0
- package/dist/filters/VizAutoComplete.d.ts +23 -0
- package/dist/filters/VizDatePicker.d.ts +9 -0
- package/dist/filters/VizDateRangePicker.d.ts +14 -0
- package/dist/filters/VizSelect.d.ts +12 -0
- package/dist/filters/VizTextField.d.ts +8 -0
- package/dist/filters/VizTriggerButton.d.ts +9 -0
- package/dist/filters/filterFactory.d.ts +30 -0
- package/dist/filters/friendlyName.d.ts +4 -0
- package/dist/filters/index.d.ts +15 -0
- package/dist/filters.d.ts +2 -0
- package/dist/filters.js +15 -0
- package/dist/filters.js.map +1 -0
- package/dist/grid/BiErrorBoundary.d.ts +24 -0
- package/dist/grid/ChartContext.d.ts +14 -0
- package/dist/grid/GridCard.d.ts +45 -0
- package/dist/grid/GridCardPlaceHolder.d.ts +8 -0
- package/dist/grid/GridLayout.d.ts +147 -0
- package/dist/grid/gridModels.d.ts +33 -0
- package/dist/grid/index.d.ts +14 -0
- package/dist/grid/types.d.ts +23 -0
- package/dist/grid/useGridConfigTranslator.d.ts +72 -0
- package/dist/grid.d.ts +2 -0
- package/dist/grid.js +20 -0
- package/dist/grid.js.map +1 -0
- package/dist/hooks/DashboardParametersContext.d.ts +32 -0
- package/dist/hooks/index.d.ts +8 -0
- package/dist/hooks/useDashboardData.d.ts +20 -0
- package/dist/hooks/useDashboardLazyData.d.ts +79 -0
- package/dist/hooks.d.ts +2 -0
- package/dist/hooks.js +16 -0
- package/dist/hooks.js.map +1 -0
- package/dist/index-BYc79sSy.js +131 -0
- package/dist/index-BYc79sSy.js.map +1 -0
- package/dist/index-C6JQ6770.js +4545 -0
- package/dist/index-C6JQ6770.js.map +1 -0
- package/dist/index-CZbCaXMC.js +15 -0
- package/dist/index-CZbCaXMC.js.map +1 -0
- package/dist/index-D3OoOPjl.js +259 -0
- package/dist/index-D3OoOPjl.js.map +1 -0
- package/dist/index-D7Oo_dC-.js +94 -0
- package/dist/index-D7Oo_dC-.js.map +1 -0
- package/dist/index-D7tVPX8d.js +347 -0
- package/dist/index-D7tVPX8d.js.map +1 -0
- package/dist/index-DGyvUtY3.js +494 -0
- package/dist/index-DGyvUtY3.js.map +1 -0
- package/dist/index-DOpx0R4Y.js +41 -0
- package/dist/index-DOpx0R4Y.js.map +1 -0
- package/dist/index-wtSLspPh.js +1065 -0
- package/dist/index-wtSLspPh.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +236 -0
- package/dist/index.js.map +1 -0
- package/dist/inline/Chart.d.ts +29 -0
- package/dist/inline/IFrame.d.ts +19 -0
- package/dist/inline/Metric.d.ts +16 -0
- package/dist/inline/MetricGroup.d.ts +11 -0
- package/dist/inline/index.d.ts +9 -0
- package/dist/inline/parseKnownNumbers.d.ts +11 -0
- package/dist/inline.d.ts +2 -0
- package/dist/inline.js +9 -0
- package/dist/inline.js.map +1 -0
- package/dist/runtime/IDashboardDefinition.d.ts +22 -0
- package/dist/runtime/biModuleSurface.d.ts +2 -0
- package/dist/runtime/createBiUiTools.d.ts +74 -0
- package/dist/runtime/index.d.ts +9 -0
- package/dist/runtime/loadDashboardBundle.d.ts +32 -0
- package/dist/runtime/registerBiModules.d.ts +36 -0
- package/dist/runtime/version.d.ts +6 -0
- package/dist/runtime.d.ts +2 -0
- package/dist/runtime.js +19 -0
- package/dist/runtime.js.map +1 -0
- package/dist/style.css +1 -0
- package/dist/theme/BiThemeBridge.d.ts +32 -0
- package/dist/theme/biPalette.d.ts +23 -0
- package/dist/theme/createBiTheme.d.ts +25 -0
- package/dist/theme/index.d.ts +5 -0
- package/dist/theme.d.ts +2 -0
- package/dist/theme.js +15 -0
- package/dist/theme.js.map +1 -0
- package/dist/version-DnqajORq.js +83 -0
- package/dist/version-DnqajORq.js.map +1 -0
- package/dist/viewer/ScriptDashboardViewer.d.ts +82 -0
- package/dist/viewer/ScriptDashboardViewerVertical.d.ts +24 -0
- package/dist/viewer/cardMetadata.d.ts +15 -0
- package/dist/viewer/index.d.ts +8 -0
- package/dist/viewer/models.d.ts +67 -0
- package/dist/viewer/useDashboardBundle.d.ts +73 -0
- package/dist/viewer.d.ts +2 -0
- package/dist/viewer.js +9 -0
- package/dist/viewer.js.map +1 -0
- package/package.json +196 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { default as React, HTMLAttributes, ReactNode, CSSProperties } from 'react';
|
|
2
|
+
import { SvgIconComponent } from '@mui/icons-material';
|
|
3
|
+
/** Header configuration for GridCard */
|
|
4
|
+
export interface GridCardHeader {
|
|
5
|
+
title: string;
|
|
6
|
+
/** Material Icons ligature name (host loads the font) or an MUI icon component */
|
|
7
|
+
icon?: string | SvgIconComponent;
|
|
8
|
+
}
|
|
9
|
+
/** Predefined accent variants for the card */
|
|
10
|
+
export type GridCardColor = 'kpi' | 'chart' | 'table' | 'info' | 'iframe' | 'details' | 'custom';
|
|
11
|
+
export type GridCardContentDisplay = 'default' | 'grid';
|
|
12
|
+
/**
|
|
13
|
+
* - "Boxed": default look with header, border accents, etc.
|
|
14
|
+
* - "Naked": no header, no border accents, blends with the background; only
|
|
15
|
+
* subtle drag/resize handles on hover.
|
|
16
|
+
*/
|
|
17
|
+
export type GridCardViewType = 'Boxed' | 'Naked';
|
|
18
|
+
export interface GridCardProps extends HTMLAttributes<HTMLDivElement> {
|
|
19
|
+
className?: string;
|
|
20
|
+
variant?: 'default' | 'elevated';
|
|
21
|
+
viewType?: GridCardViewType;
|
|
22
|
+
header?: GridCardHeader;
|
|
23
|
+
/** Custom header render function; overrides the default header. */
|
|
24
|
+
renderHeader?: (header: GridCardHeader) => ReactNode;
|
|
25
|
+
/** Accent variant. */
|
|
26
|
+
color?: GridCardColor;
|
|
27
|
+
/** Custom accent (used when color="custom"): any CSS colour, e.g. a theme token you resolved. */
|
|
28
|
+
customColor?: string;
|
|
29
|
+
contentDisplay?: GridCardContentDisplay;
|
|
30
|
+
contentStyle?: CSSProperties;
|
|
31
|
+
contentClassName?: string;
|
|
32
|
+
noBorder?: boolean;
|
|
33
|
+
/** Raw CSS injected in a `<style>` next to the card (dashboard bundles emit per-card styles). */
|
|
34
|
+
htmlStyle?: string;
|
|
35
|
+
dragLocked?: boolean;
|
|
36
|
+
zoomLevel?: number;
|
|
37
|
+
isResizable?: boolean;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* GridCard — a card usable directly as a react-grid-layout item. Forwards the
|
|
41
|
+
* ref and the mouse/touch props RGL needs; use it as a direct child of
|
|
42
|
+
* `GridLayout` with a `key`.
|
|
43
|
+
*/
|
|
44
|
+
export declare const GridCard: React.ForwardRefExoticComponent<GridCardProps & React.RefAttributes<HTMLDivElement>>;
|
|
45
|
+
export default GridCard;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { default as React, HTMLAttributes } from 'react';
|
|
2
|
+
export interface GridCardPlaceHolderProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
static?: boolean;
|
|
4
|
+
naked?: boolean;
|
|
5
|
+
}
|
|
6
|
+
/** An empty grid item drawn while a card is being sketched / dropped. */
|
|
7
|
+
export declare const GridCardPlaceHolder: React.ForwardRefExoticComponent<GridCardPlaceHolderProps & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
export default GridCardPlaceHolder;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Layout, LayoutItem } from 'react-grid-layout';
|
|
3
|
+
import { GridConfig, ResponsiveGridConfig, ResponsiveLayouts, BreakpointName } from './types';
|
|
4
|
+
import { AutoResponsiveStrategy } from './useGridConfigTranslator';
|
|
5
|
+
/**
|
|
6
|
+
* Props for the GridLayout component
|
|
7
|
+
*/
|
|
8
|
+
export interface GridLayoutProps {
|
|
9
|
+
/**
|
|
10
|
+
* Grid configuration abstraction (rows/cells)
|
|
11
|
+
* Used to generate the initial layout
|
|
12
|
+
*/
|
|
13
|
+
config?: GridConfig | ResponsiveGridConfig;
|
|
14
|
+
/**
|
|
15
|
+
* Optional override layouts (native format)
|
|
16
|
+
* When provided, these are used instead of translating config
|
|
17
|
+
* Use this for persisted user modifications
|
|
18
|
+
*/
|
|
19
|
+
layouts?: Layout | ResponsiveLayouts;
|
|
20
|
+
/**
|
|
21
|
+
* Whether to automatically generate responsive layouts for different breakpoints.
|
|
22
|
+
* When true (default), a single GridConfig is automatically adapted for all screen sizes.
|
|
23
|
+
* When false, the same layout is used for all breakpoints (only scaled by column count).
|
|
24
|
+
* @default true
|
|
25
|
+
*/
|
|
26
|
+
responsive?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Strategy for auto-responsive layout generation.
|
|
29
|
+
* - "scale": Proportionally scale widths (items may become narrow)
|
|
30
|
+
* - "stack": Stack items vertically on small screens (full width)
|
|
31
|
+
* - "hybrid": Scale for medium screens, stack for small screens (default)
|
|
32
|
+
* Only applies when `responsive` is true and a single GridConfig is provided.
|
|
33
|
+
* @default "hybrid"
|
|
34
|
+
*/
|
|
35
|
+
autoResponsiveStrategy?: AutoResponsiveStrategy;
|
|
36
|
+
dragLocked?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Row height in pixels
|
|
39
|
+
* @default 25
|
|
40
|
+
*/
|
|
41
|
+
rowHeight?: number;
|
|
42
|
+
/**
|
|
43
|
+
* Row height in pixels
|
|
44
|
+
* @default 50
|
|
45
|
+
*/
|
|
46
|
+
rowMultiplier?: number;
|
|
47
|
+
/**
|
|
48
|
+
* Breakpoint definitions (name → min-width)
|
|
49
|
+
* @default { lg: 1200, md: 900, sm: 768, xs: 480, xxs: 0 }
|
|
50
|
+
*/
|
|
51
|
+
breakpoints?: Record<BreakpointName, number>;
|
|
52
|
+
/**
|
|
53
|
+
* Column counts per breakpoint
|
|
54
|
+
* @default { lg: 12, md: 12, sm: 12, xs: 4, xxs: 2 }
|
|
55
|
+
*/
|
|
56
|
+
cols?: Record<BreakpointName, number>;
|
|
57
|
+
/**
|
|
58
|
+
* Maximum number of rows
|
|
59
|
+
* @default Infinity
|
|
60
|
+
*/
|
|
61
|
+
maxRows?: number;
|
|
62
|
+
/**
|
|
63
|
+
* Called when layout changes (after drag or resize ends)
|
|
64
|
+
* Only fires when layout actually changed
|
|
65
|
+
*/
|
|
66
|
+
onLayoutChange?: (layout: Layout, allLayouts: ResponsiveLayouts) => void;
|
|
67
|
+
/**
|
|
68
|
+
* User-driven boundaries. RGL fires these only at the end of a real
|
|
69
|
+
* resize / drag interaction — *not* on prop syncs or layout reflows.
|
|
70
|
+
* Use these (instead of `onLayoutChange`) when the consumer needs a
|
|
71
|
+
* "the user committed a change" signal that shouldn't fire when a
|
|
72
|
+
* fresh `layouts` prop comes in from above.
|
|
73
|
+
*/
|
|
74
|
+
onResizeStop?: (layout: Layout, oldItem: LayoutItem | null, newItem: LayoutItem | null) => void;
|
|
75
|
+
onDragStop?: (layout: Layout, oldItem: LayoutItem | null, newItem: LayoutItem | null) => void;
|
|
76
|
+
/**
|
|
77
|
+
* Children components (must have key prop matching cell keys)
|
|
78
|
+
*/
|
|
79
|
+
children: React.ReactNode;
|
|
80
|
+
zoomLevel?: number;
|
|
81
|
+
/**
|
|
82
|
+
* Additional class name for the container
|
|
83
|
+
*/
|
|
84
|
+
className?: string;
|
|
85
|
+
/**
|
|
86
|
+
* Additional styles for the container
|
|
87
|
+
*/
|
|
88
|
+
style?: React.CSSProperties;
|
|
89
|
+
onDrop?: (data: any, item?: LayoutItem) => void;
|
|
90
|
+
manualWidth?: number;
|
|
91
|
+
/**
|
|
92
|
+
* Row-aware resize.
|
|
93
|
+
*
|
|
94
|
+
* When configured, dragging a card's resize handle adjusts the height
|
|
95
|
+
* of every "row sibling" — items whose top edge (`y`) matches the
|
|
96
|
+
* resized item's `y` — together. The width of the resized item is
|
|
97
|
+
* unaffected, and so are widths/heights of any items NOT in the row.
|
|
98
|
+
*
|
|
99
|
+
* - Pass `true` for the default policy: a modifier (Shift) must be
|
|
100
|
+
* held to opt into row-aware behaviour for a given drag.
|
|
101
|
+
* - Pass an object to invert the default (`defaultOn: true` makes
|
|
102
|
+
* row-aware the no-modifier behaviour and the modifier turns it
|
|
103
|
+
* OFF for that drag) and/or to pick a different modifier key.
|
|
104
|
+
* - Pass `false` (or omit the prop) to disable entirely.
|
|
105
|
+
*/
|
|
106
|
+
rowAwareResize?: boolean | RowAwareResizeConfig;
|
|
107
|
+
}
|
|
108
|
+
export interface RowAwareResizeConfig {
|
|
109
|
+
/** Master switch. Defaults to `true` when this object is supplied. */
|
|
110
|
+
enabled?: boolean;
|
|
111
|
+
/**
|
|
112
|
+
* When `true`, row-aware resize is the DEFAULT and holding the
|
|
113
|
+
* modifier inverts it (i.e. the modifier disables row-aware for that
|
|
114
|
+
* drag). When `false` (default), the user must hold the modifier to
|
|
115
|
+
* opt into row-aware for that drag.
|
|
116
|
+
*/
|
|
117
|
+
defaultOn?: boolean;
|
|
118
|
+
/** Modifier key that flips the default behaviour. */
|
|
119
|
+
modifierKey?: 'Shift' | 'Alt' | 'Ctrl' | 'Meta';
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* GridLayout component
|
|
123
|
+
*
|
|
124
|
+
* A wrapper around react-grid-layout's Responsive component that accepts
|
|
125
|
+
* a simplified row/cell configuration and translates it to the native format.
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```tsx
|
|
129
|
+
* const config: GridConfig = {
|
|
130
|
+
* rows: [
|
|
131
|
+
* { height: 1, cells: [{ key: "header", width: 12 }] },
|
|
132
|
+
* { height: 3, cells: [
|
|
133
|
+
* { key: "chart1", width: 6 },
|
|
134
|
+
* { key: "chart2", width: 6 }
|
|
135
|
+
* ]}
|
|
136
|
+
* ]
|
|
137
|
+
* };
|
|
138
|
+
*
|
|
139
|
+
* <GridLayout config={config} onLayoutChange={handleChange}>
|
|
140
|
+
* <div key="header">Header</div>
|
|
141
|
+
* <div key="chart1">Chart 1</div>
|
|
142
|
+
* <div key="chart2">Chart 2</div>
|
|
143
|
+
* </GridLayout>
|
|
144
|
+
* ```
|
|
145
|
+
*/
|
|
146
|
+
export declare const GridLayout: React.FC<GridLayoutProps>;
|
|
147
|
+
export default GridLayout;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Grid layout abstraction shared by the Dashboard model and GridLayout:
|
|
3
|
+
* a tree of rows and cells that `translateGridConfig` flattens into
|
|
4
|
+
* react-grid-layout items.
|
|
5
|
+
*/
|
|
6
|
+
export interface CellConfig {
|
|
7
|
+
/** Unique key for the cell (must match children keys) */
|
|
8
|
+
key?: string;
|
|
9
|
+
/** Width in grid units (out of 12 for root level) */
|
|
10
|
+
width: number;
|
|
11
|
+
/** Height override (defaults to parent row's height) */
|
|
12
|
+
height?: number;
|
|
13
|
+
minW?: number;
|
|
14
|
+
maxW?: number;
|
|
15
|
+
minH?: number;
|
|
16
|
+
maxH?: number;
|
|
17
|
+
/** Nested rows within this cell */
|
|
18
|
+
rows?: RowConfig[];
|
|
19
|
+
/** If true, item cannot be dragged or resized; others compact around it. */
|
|
20
|
+
static?: boolean;
|
|
21
|
+
isDraggable?: boolean;
|
|
22
|
+
isResizable?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface RowConfig {
|
|
25
|
+
/** Height in grid units (default: 1) */
|
|
26
|
+
height?: number;
|
|
27
|
+
cells: CellConfig[];
|
|
28
|
+
}
|
|
29
|
+
export interface GridConfig {
|
|
30
|
+
rows: RowConfig[];
|
|
31
|
+
/** Internal — set by GridLayout from its `rowMultiplier` prop. */
|
|
32
|
+
rowMultipler?: number;
|
|
33
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { GridLayout } from './GridLayout';
|
|
2
|
+
export type { GridLayoutProps, RowAwareResizeConfig } from './GridLayout';
|
|
3
|
+
export { GridCard } from './GridCard';
|
|
4
|
+
export type { GridCardProps, GridCardHeader, GridCardColor, GridCardContentDisplay, GridCardViewType } from './GridCard';
|
|
5
|
+
export { GridCardPlaceHolder } from './GridCardPlaceHolder';
|
|
6
|
+
export type { GridCardPlaceHolderProps } from './GridCardPlaceHolder';
|
|
7
|
+
export { ChartContextProvider, useChartContext } from './ChartContext';
|
|
8
|
+
export type { ChartContextState } from './ChartContext';
|
|
9
|
+
export { BiErrorBoundary } from './BiErrorBoundary';
|
|
10
|
+
export type { BiErrorBoundaryProps } from './BiErrorBoundary';
|
|
11
|
+
export { useGridConfigTranslator, translateGridConfig, translateResponsiveGridConfig, translateGridConfigAutoResponsive, } from './useGridConfigTranslator';
|
|
12
|
+
export type { UseGridConfigTranslatorOptions, UseGridConfigTranslatorResult, AutoResponsiveStrategy } from './useGridConfigTranslator';
|
|
13
|
+
export type { CellConfig, RowConfig, GridConfig, ResponsiveGridConfig, ResponsiveLayouts, BreakpointName } from './types';
|
|
14
|
+
export { DEFAULT_BREAKPOINTS, DEFAULT_COLS, DEFAULT_ROW_HEIGHT, DEFAULT_ROW_MULTIPLIER, DEFAULT_MAX_ROWS } from './types';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Layout } from 'react-grid-layout';
|
|
2
|
+
import { GridConfig } from './gridModels';
|
|
3
|
+
export type { CellConfig, RowConfig, GridConfig } from './gridModels';
|
|
4
|
+
/** Breakpoint names supported by the grid */
|
|
5
|
+
export type BreakpointName = 'lg' | 'md' | 'sm' | 'xs' | 'xxs';
|
|
6
|
+
/** Responsive grid configuration — a GridConfig per breakpoint */
|
|
7
|
+
export interface ResponsiveGridConfig {
|
|
8
|
+
lg?: GridConfig;
|
|
9
|
+
md?: GridConfig;
|
|
10
|
+
sm?: GridConfig;
|
|
11
|
+
xs?: GridConfig;
|
|
12
|
+
xxs?: GridConfig;
|
|
13
|
+
rowMultipler?: number;
|
|
14
|
+
}
|
|
15
|
+
/** Responsive layouts (native react-grid-layout format) */
|
|
16
|
+
export type ResponsiveLayouts = {
|
|
17
|
+
[K in BreakpointName]?: Layout;
|
|
18
|
+
};
|
|
19
|
+
export declare const DEFAULT_BREAKPOINTS: Record<BreakpointName, number>;
|
|
20
|
+
export declare const DEFAULT_COLS: Record<BreakpointName, number>;
|
|
21
|
+
export declare const DEFAULT_ROW_HEIGHT = 20;
|
|
22
|
+
export declare const DEFAULT_ROW_MULTIPLIER = 3;
|
|
23
|
+
export declare const DEFAULT_MAX_ROWS = 36;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Layout } from 'react-grid-layout';
|
|
2
|
+
import { GridConfig, ResponsiveGridConfig, ResponsiveLayouts, BreakpointName } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Translates a GridConfig (row/cell tree) into a flat Layout array
|
|
5
|
+
* that react-grid-layout understands.
|
|
6
|
+
*
|
|
7
|
+
* @param config - The grid configuration
|
|
8
|
+
* @param cols - Number of columns (default: 12)
|
|
9
|
+
* @returns Flat layout array for react-grid-layout
|
|
10
|
+
*/
|
|
11
|
+
export declare function translateGridConfig(config: GridConfig, cols?: number): Layout;
|
|
12
|
+
/**
|
|
13
|
+
* Translates a ResponsiveGridConfig into ResponsiveLayouts
|
|
14
|
+
* If a breakpoint is not defined, it falls back to larger breakpoints
|
|
15
|
+
*
|
|
16
|
+
* @param config - The responsive grid configuration
|
|
17
|
+
* @param colsPerBreakpoint - Columns per breakpoint (default: DEFAULT_COLS)
|
|
18
|
+
* @returns Responsive layouts object for react-grid-layout
|
|
19
|
+
*/
|
|
20
|
+
export declare function translateResponsiveGridConfig(config: ResponsiveGridConfig, colsPerBreakpoint?: Record<BreakpointName, number>): ResponsiveLayouts;
|
|
21
|
+
/**
|
|
22
|
+
* Auto-responsive translation strategy.
|
|
23
|
+
* Determines how items should be arranged when columns decrease.
|
|
24
|
+
*/
|
|
25
|
+
export type AutoResponsiveStrategy = "scale" | "stack" | "hybrid";
|
|
26
|
+
/**
|
|
27
|
+
* Translates a single GridConfig into responsive layouts automatically.
|
|
28
|
+
*
|
|
29
|
+
* This function intelligently adapts the layout for different screen sizes:
|
|
30
|
+
* - For breakpoints with same column count as base: preserves layout
|
|
31
|
+
* - For breakpoints with fewer columns: applies the chosen strategy
|
|
32
|
+
*
|
|
33
|
+
* Strategies:
|
|
34
|
+
* - "scale": Proportionally scale widths (items may become very narrow)
|
|
35
|
+
* - "stack": Stack items vertically (each item becomes full width)
|
|
36
|
+
* - "hybrid": Scale for moderate reductions, stack for small screens (default)
|
|
37
|
+
*
|
|
38
|
+
* @param config - The grid configuration (designed for lg/12 columns)
|
|
39
|
+
* @param colsPerBreakpoint - Columns per breakpoint (default: DEFAULT_COLS)
|
|
40
|
+
* @param strategy - How to handle smaller breakpoints (default: "hybrid")
|
|
41
|
+
* @returns Responsive layouts object for react-grid-layout
|
|
42
|
+
*/
|
|
43
|
+
export declare function translateGridConfigAutoResponsive(config: GridConfig, colsPerBreakpoint?: Record<BreakpointName, number>, strategy?: AutoResponsiveStrategy): ResponsiveLayouts;
|
|
44
|
+
/**
|
|
45
|
+
* Options for the useGridConfigTranslator hook
|
|
46
|
+
*/
|
|
47
|
+
export interface UseGridConfigTranslatorOptions {
|
|
48
|
+
/** Grid configuration (single or responsive) */
|
|
49
|
+
config: GridConfig | ResponsiveGridConfig;
|
|
50
|
+
/** Whether the config is responsive (has per-breakpoint configs) */
|
|
51
|
+
responsive?: boolean;
|
|
52
|
+
/** Columns per breakpoint (only used if responsive) */
|
|
53
|
+
cols?: Record<BreakpointName, number>;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Result of the useGridConfigTranslator hook
|
|
57
|
+
*/
|
|
58
|
+
export interface UseGridConfigTranslatorResult {
|
|
59
|
+
/** Single layout (only if not responsive) */
|
|
60
|
+
layout: Layout | undefined;
|
|
61
|
+
/** Responsive layouts (only if responsive) */
|
|
62
|
+
layouts: ResponsiveLayouts | undefined;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Hook to translate GridConfig to react-grid-layout format
|
|
66
|
+
* Memoizes the result to avoid unnecessary recalculations
|
|
67
|
+
*
|
|
68
|
+
* @param options - Translation options
|
|
69
|
+
* @returns Translated layout(s)
|
|
70
|
+
*/
|
|
71
|
+
export declare function useGridConfigTranslator(options: UseGridConfigTranslatorOptions): UseGridConfigTranslatorResult;
|
|
72
|
+
export default useGridConfigTranslator;
|
package/dist/grid.d.ts
ADDED
package/dist/grid.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { B as s, D as o, a as t, b as e, c as i, d, G as n, e as C, f as E, t as G, g as L, h as T, u as A } from "./index-DGyvUtY3.js";
|
|
2
|
+
import { C as f, u } from "./ChartContext-C_f_6khG.js";
|
|
3
|
+
export {
|
|
4
|
+
s as BiErrorBoundary,
|
|
5
|
+
f as ChartContextProvider,
|
|
6
|
+
o as DEFAULT_BREAKPOINTS,
|
|
7
|
+
t as DEFAULT_COLS,
|
|
8
|
+
e as DEFAULT_MAX_ROWS,
|
|
9
|
+
i as DEFAULT_ROW_HEIGHT,
|
|
10
|
+
d as DEFAULT_ROW_MULTIPLIER,
|
|
11
|
+
n as GridCard,
|
|
12
|
+
C as GridCardPlaceHolder,
|
|
13
|
+
E as GridLayout,
|
|
14
|
+
G as translateGridConfig,
|
|
15
|
+
L as translateGridConfigAutoResponsive,
|
|
16
|
+
T as translateResponsiveGridConfig,
|
|
17
|
+
u as useChartContext,
|
|
18
|
+
A as useGridConfigTranslator
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=grid.js.map
|
package/dist/grid.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grid.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
|
+
export interface ParametersStateSlim {
|
|
3
|
+
dashboardId: string;
|
|
4
|
+
parameters: Record<string, string | string[]>;
|
|
5
|
+
/**
|
|
6
|
+
* Monotonic counter the host bumps to force every active
|
|
7
|
+
* `useDashboardData` consumer to re-fetch with `noCache`. Defaults to 0;
|
|
8
|
+
* the hook treats the first observed value as the baseline (mounting is
|
|
9
|
+
* never a force-refresh).
|
|
10
|
+
*/
|
|
11
|
+
refreshTick?: number;
|
|
12
|
+
/**
|
|
13
|
+
* Admin-only runtime override for the dataset on a parameterised
|
|
14
|
+
* dashboard. Shipped in every data-fetch POST body; the server validates
|
|
15
|
+
* and silently drops it for non-admin callers.
|
|
16
|
+
*/
|
|
17
|
+
datasetOverride?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface ParametersState {
|
|
20
|
+
dashboardId: string;
|
|
21
|
+
parameters: Record<string, string | string[]>;
|
|
22
|
+
setParameter: (key: string, value: string | string[] | undefined) => void;
|
|
23
|
+
getParameter: (key: string) => string | string[] | undefined;
|
|
24
|
+
refreshTick: number;
|
|
25
|
+
datasetOverride?: string;
|
|
26
|
+
}
|
|
27
|
+
export declare const DashboardParametersContext: React.Context<ParametersState | undefined>;
|
|
28
|
+
export declare function DashboardParametersProvider({ values, children }: {
|
|
29
|
+
values: ParametersStateSlim;
|
|
30
|
+
children: ReactNode;
|
|
31
|
+
}): React.JSX.Element;
|
|
32
|
+
export declare function useDashboardParameters(): ParametersState | undefined;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { useDashboardData } from './useDashboardData';
|
|
2
|
+
export type { UseDashboardDataResult, SchemaInput, QueryResult, QueryResultRow, ResultField } from './useDashboardData';
|
|
3
|
+
export { useDashboardLazyData } from './useDashboardLazyData';
|
|
4
|
+
export type { LazyDataResult, LazySchemaInput } from './useDashboardLazyData';
|
|
5
|
+
export { DashboardParametersContext, DashboardParametersProvider, useDashboardParameters } from './DashboardParametersContext';
|
|
6
|
+
export type { ParametersState, ParametersStateSlim } from './DashboardParametersContext';
|
|
7
|
+
export { createBiClient, BiClientProvider, useBiClient, useBiClientOptional, useBiSessionId } from '../client';
|
|
8
|
+
export type { BiClient, BiClientOptions, BiRoutes, BiFetch, ArtifactUrlScope, QueryExecutionBody, PagedQueryBody, ExportQueryBody, BiClientProviderProps } from '../client';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { DataResult, ColumnSchema, FieldType, InferModel } from '../data/dataUtils';
|
|
2
|
+
import { QueryResult } from '../data/queryModel';
|
|
3
|
+
export type { QueryResult, QueryResultRow, ResultField } from '../data/queryModel';
|
|
4
|
+
export type SchemaInput<S extends Record<string, FieldType>> = ColumnSchema<S> | S;
|
|
5
|
+
export interface UseDashboardDataResult {
|
|
6
|
+
data: QueryResult | null;
|
|
7
|
+
loading: boolean;
|
|
8
|
+
error: string | null;
|
|
9
|
+
refetch: () => void;
|
|
10
|
+
toDataResult: <const S extends Record<string, FieldType>>(schema: SchemaInput<S>) => DataResult<InferModel<S>> | null;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Fetches dashboard data by query hash through the injected `BiClient`
|
|
14
|
+
* (`client.runQuery(dashboardId, queryHash, body)`). The hash maps to a
|
|
15
|
+
* pre-registered SQL query on the server, so no raw SQL reaches the client.
|
|
16
|
+
*
|
|
17
|
+
* Reads all current parameters from `DashboardParametersContext`, POSTs them
|
|
18
|
+
* alongside the hash and re-fetches when they change.
|
|
19
|
+
*/
|
|
20
|
+
export declare function useDashboardData(queryHash: string): UseDashboardDataResult;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { GridApi, GridGetRowsParams, GridGetRowsResponse } from '@mui/x-data-grid-pro';
|
|
2
|
+
import { ColumnSchema, FieldType, InferModel } from '../data/dataUtils';
|
|
3
|
+
export type LazySchemaInput<S extends Record<string, FieldType>> = ColumnSchema<S> | S;
|
|
4
|
+
/**
|
|
5
|
+
* Companion to {@link useDashboardData} for tables that page from the
|
|
6
|
+
* server. Returned object is consumed by `<DataTableCard lazyData={...} />`,
|
|
7
|
+
* which adapts it to MUI X DataGrid's `dataSource` prop. The card never
|
|
8
|
+
* builds an in-memory `DataResult` — sort/filter/paginate are delegated
|
|
9
|
+
* to the server via `client.getQueryPage(dashboardId, viewId, body)`.
|
|
10
|
+
*
|
|
11
|
+
* Per-page caching is intentionally not implemented here: MUI's
|
|
12
|
+
* built-in `dataSourceCache` already handles short-lived per-grid
|
|
13
|
+
* caching. We only invalidate via `apiRef.dataSource.fetchRows()` when
|
|
14
|
+
* dashboard parameters or `refreshTick` change.
|
|
15
|
+
*/
|
|
16
|
+
export interface LazyDataResult<TModel extends Record<string, any> = Record<string, any>> {
|
|
17
|
+
/** Direct passthrough to `<DataGrid dataSource={{ getRows }} />`. */
|
|
18
|
+
getRows: (params: GridGetRowsParams) => Promise<GridGetRowsResponse>;
|
|
19
|
+
/** Wired to `<DataGrid onDataSourceError={...} />` so fetch failures show the standard overlay. */
|
|
20
|
+
onError: (err: unknown) => void;
|
|
21
|
+
/** Owned by the hook so refetch-on-parameter-change can call `dataSource.fetchRows()`. */
|
|
22
|
+
apiRef: React.MutableRefObject<GridApi>;
|
|
23
|
+
/** Same column-config surface as `DataResult.columnSchema`. */
|
|
24
|
+
columnSchema: ColumnSchema<any>;
|
|
25
|
+
error: string | null;
|
|
26
|
+
/** True while any page request is in flight. Card uses it to drive the grid's loading overlay. */
|
|
27
|
+
loading: boolean;
|
|
28
|
+
/** Bypasses MUI's cache for the next set of fetches. */
|
|
29
|
+
refetch: () => void;
|
|
30
|
+
/**
|
|
31
|
+
* Streams the full server-side rowset as CSV (`client.exportQuery(..., 'csv', body)`)
|
|
32
|
+
* and triggers a browser download. Honors the current sort/filter
|
|
33
|
+
* state from the grid and the current dashboard parameters — so
|
|
34
|
+
* the downloaded file matches what the user is looking at, not the
|
|
35
|
+
* raw view body.
|
|
36
|
+
*
|
|
37
|
+
* The endpoint streams chunked, so even multi-million-row exports
|
|
38
|
+
* don't blow client or server memory.
|
|
39
|
+
*/
|
|
40
|
+
downloadCsv: (filename?: string) => Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* Same as {@link downloadCsv}, but hits the XLSX endpoint instead.
|
|
43
|
+
* The server writes the workbook to a temp file via MiniExcel and
|
|
44
|
+
* streams it back; client memory is bounded by the browser's blob
|
|
45
|
+
* file-store backing (large blobs page to disk automatically).
|
|
46
|
+
*/
|
|
47
|
+
downloadXlsx: (filename?: string) => Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* True from the moment {@link downloadCsv} or {@link downloadXlsx}
|
|
50
|
+
* is invoked until the download has either completed or failed.
|
|
51
|
+
* Toolbar uses this to show a progress indicator and disable the
|
|
52
|
+
* menu items.
|
|
53
|
+
*/
|
|
54
|
+
exporting: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Compatibility shim with the {@link useDashboardData} →
|
|
57
|
+
* {@link toDataResult} pattern. Returns the same lazy result
|
|
58
|
+
* unchanged — the schema must already have been supplied to
|
|
59
|
+
* `useDashboardLazyData(viewId, schema)` (it drives dynamic
|
|
60
|
+
* distinct-value fetches and column rendering that the hook
|
|
61
|
+
* can't wire up after the fact).
|
|
62
|
+
*
|
|
63
|
+
* Exists purely so LLM-generated code that mirrors the local-
|
|
64
|
+
* mode pattern
|
|
65
|
+
* `const result = useDashboardLazyData('view').toLazyDataResult(schema)`
|
|
66
|
+
* compiles and behaves correctly. The `schema` argument is
|
|
67
|
+
* accepted and ignored; if the hook was called without a schema
|
|
68
|
+
* the TS compiler already flagged that at the call site.
|
|
69
|
+
*/
|
|
70
|
+
toLazyDataResult: (schema?: unknown) => LazyDataResult<TModel>;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Hook factory: `useDashboardLazyData('view-id', schema)` returns a
|
|
74
|
+
* {@link LazyDataResult} ready to be passed to `<DataTableCard lazyData={...} />`.
|
|
75
|
+
*
|
|
76
|
+
* @param viewId server-side view name (same identifier as `useDashboardData`)
|
|
77
|
+
* @param schemaInput a schema literal (e.g. `{ airlineIata: 'string' } as const`) or a `ColumnSchema`
|
|
78
|
+
*/
|
|
79
|
+
export declare function useDashboardLazyData<const S extends Record<string, FieldType>>(viewId: string, schemaInput: LazySchemaInput<S>): LazyDataResult<InferModel<S>>;
|
package/dist/hooks.d.ts
ADDED
package/dist/hooks.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { u as s, a as r } from "./index-D3OoOPjl.js";
|
|
2
|
+
import { D as t, a as i, u } from "./DashboardParametersContext-Clv--79U.js";
|
|
3
|
+
import { B as D, c as n, u as m, a as B, e as b } from "./BiClientProvider-CWJochvi.js";
|
|
4
|
+
export {
|
|
5
|
+
D as BiClientProvider,
|
|
6
|
+
t as DashboardParametersContext,
|
|
7
|
+
i as DashboardParametersProvider,
|
|
8
|
+
n as createBiClient,
|
|
9
|
+
m as useBiClient,
|
|
10
|
+
B as useBiClientOptional,
|
|
11
|
+
b as useBiSessionId,
|
|
12
|
+
s as useDashboardData,
|
|
13
|
+
r as useDashboardLazyData,
|
|
14
|
+
u as useDashboardParameters
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|