@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 @@
|
|
|
1
|
+
{"version":3,"file":"composer.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
var r = Object.defineProperty;
|
|
2
|
+
var i = (e, t) => r(e, "name", { value: t, configurable: !0 });
|
|
3
|
+
import { useTheme as o, createTheme as s } from "@mui/material/styles";
|
|
4
|
+
const c = {
|
|
5
|
+
series: [
|
|
6
|
+
"#b8781f",
|
|
7
|
+
// amber
|
|
8
|
+
"#3f6fb5",
|
|
9
|
+
// blue
|
|
10
|
+
"#7a5ea8",
|
|
11
|
+
// violet
|
|
12
|
+
"#2f8f62",
|
|
13
|
+
// green
|
|
14
|
+
"#c65b5b",
|
|
15
|
+
// coral
|
|
16
|
+
"#1f8a8a",
|
|
17
|
+
// teal
|
|
18
|
+
"#8a6a4f",
|
|
19
|
+
// brown
|
|
20
|
+
"#5b6fc4"
|
|
21
|
+
// indigo
|
|
22
|
+
],
|
|
23
|
+
positive: "#2e7d32",
|
|
24
|
+
negative: "#c62828",
|
|
25
|
+
neutral: "#6b6b6b"
|
|
26
|
+
}, u = {
|
|
27
|
+
series: [
|
|
28
|
+
"#e0a458",
|
|
29
|
+
// amber (v2 accent)
|
|
30
|
+
"#7d9bd1",
|
|
31
|
+
// muted blue
|
|
32
|
+
"#9c8bb5",
|
|
33
|
+
// muted lavender
|
|
34
|
+
"#5eb88a",
|
|
35
|
+
// green
|
|
36
|
+
"#d97a7a",
|
|
37
|
+
// coral
|
|
38
|
+
"#4db6ac",
|
|
39
|
+
// teal
|
|
40
|
+
"#bcaaa4",
|
|
41
|
+
// warm grey
|
|
42
|
+
"#7986cb"
|
|
43
|
+
// indigo
|
|
44
|
+
],
|
|
45
|
+
positive: "#5eb88a",
|
|
46
|
+
negative: "#d97a7a",
|
|
47
|
+
neutral: "#9e9e9e"
|
|
48
|
+
};
|
|
49
|
+
function a(e) {
|
|
50
|
+
const t = e.palette.mode === "dark" ? u : c, n = e.palette.bi;
|
|
51
|
+
return n ? {
|
|
52
|
+
series: n.series && n.series.length > 0 ? n.series : t.series,
|
|
53
|
+
positive: n.positive ?? t.positive,
|
|
54
|
+
negative: n.negative ?? t.negative,
|
|
55
|
+
neutral: n.neutral ?? t.neutral
|
|
56
|
+
} : t;
|
|
57
|
+
}
|
|
58
|
+
i(a, "resolveBiPalette");
|
|
59
|
+
function f(e) {
|
|
60
|
+
const t = a(e);
|
|
61
|
+
return e.palette.bi === t ? e : s(e, { palette: { bi: t } });
|
|
62
|
+
}
|
|
63
|
+
i(f, "withBiPalette");
|
|
64
|
+
function d(e) {
|
|
65
|
+
const t = e && b(e) ? e : s(e ?? {});
|
|
66
|
+
return f(t);
|
|
67
|
+
}
|
|
68
|
+
i(d, "createBiTheme");
|
|
69
|
+
function b(e) {
|
|
70
|
+
var t;
|
|
71
|
+
return typeof e.spacing == "function" && typeof ((t = e.breakpoints) == null ? void 0 : t.up) == "function";
|
|
72
|
+
}
|
|
73
|
+
i(b, "isTheme");
|
|
74
|
+
function g(e, t) {
|
|
75
|
+
const { series: n } = a(e);
|
|
76
|
+
return n[(t % n.length + n.length) % n.length];
|
|
77
|
+
}
|
|
78
|
+
i(g, "biSeriesColor");
|
|
79
|
+
function v() {
|
|
80
|
+
const e = o();
|
|
81
|
+
return a(e);
|
|
82
|
+
}
|
|
83
|
+
i(v, "useBiPalette");
|
|
84
|
+
export {
|
|
85
|
+
c as a,
|
|
86
|
+
u as b,
|
|
87
|
+
g as c,
|
|
88
|
+
d,
|
|
89
|
+
a as r,
|
|
90
|
+
v as u,
|
|
91
|
+
f as w
|
|
92
|
+
};
|
|
93
|
+
//# sourceMappingURL=createBiTheme-TyUv_UHM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createBiTheme-TyUv_UHM.js","sources":["../src/theme/biPalette.ts","../src/theme/createBiTheme.ts"],"sourcesContent":["// ─────────────────────────────────────────────────────────────────────────────\n// THE ONLY FILE IN THIS PACKAGE THAT MAY CONTAIN A COLOUR LITERAL.\n//\n// Everything else reads colours from the MUI theme (`theme.palette.*`,\n// `alpha(...)`, `useBiPalette()`) or from the CSS custom properties that\n// <BiThemeBridge/> derives from it. The ESLint `no-restricted-syntax` rule,\n// stylelint and `tests/theme/colourLiterals.test.ts` all enforce that; this\n// file is their single allow-list entry.\n//\n// Hosts normally override these in their own `createTheme({ palette: { bi } })`.\n// The values here are only the defaults `withBiPalette()` falls back to when a\n// host did not set `palette.bi`, chosen per `palette.mode`.\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** The BI-specific slice of the MUI palette. */\nexport interface BiPalette {\n /** Categorical series colours, used in order by charts, pies, treemaps and map bubbles. */\n series: string[];\n /** \"Good\" trend / gauge band. */\n positive: string;\n /** \"Bad\" trend / gauge band. */\n negative: string;\n /** Flat trend / neutral band. */\n neutral: string;\n}\n\ndeclare module '@mui/material/styles' {\n interface Palette {\n bi: BiPalette;\n }\n interface PaletteOptions {\n bi?: Partial<BiPalette>;\n }\n}\n\n/** Series set tuned for a light canvas (deeper, more saturated hues). */\nexport const biLightPalette: BiPalette = {\n series: [\n '#b8781f', // amber\n '#3f6fb5', // blue\n '#7a5ea8', // violet\n '#2f8f62', // green\n '#c65b5b', // coral\n '#1f8a8a', // teal\n '#8a6a4f', // brown\n '#5b6fc4', // indigo\n ],\n positive: '#2e7d32',\n negative: '#c62828',\n neutral: '#6b6b6b',\n};\n\n/** Series set tuned for a dark canvas (the legacy Envision v2 chart palette, extended). */\nexport const biDarkPalette: BiPalette = {\n series: [\n '#e0a458', // amber (v2 accent)\n '#7d9bd1', // muted blue\n '#9c8bb5', // muted lavender\n '#5eb88a', // green\n '#d97a7a', // coral\n '#4db6ac', // teal\n '#bcaaa4', // warm grey\n '#7986cb', // indigo\n ],\n positive: '#5eb88a',\n negative: '#d97a7a',\n neutral: '#9e9e9e',\n};\n","import { createTheme, useTheme } from '@mui/material/styles';\nimport type { Theme, ThemeOptions } from '@mui/material/styles';\nimport { biDarkPalette, biLightPalette, type BiPalette } from './biPalette';\n\n/**\n * Resolve the BI palette for a theme without mutating it: the host's\n * `palette.bi` wins field by field, the mode-appropriate default fills the\n * gaps. Safe to call on a theme that never heard of `palette.bi`.\n */\nexport function resolveBiPalette(theme: Theme): BiPalette {\n const defaults = theme.palette.mode === 'dark' ? biDarkPalette : biLightPalette;\n const own = (theme.palette as Partial<{ bi: Partial<BiPalette> }>).bi;\n if (!own) return defaults;\n return {\n series: own.series && own.series.length > 0 ? own.series : defaults.series,\n positive: own.positive ?? defaults.positive,\n negative: own.negative ?? defaults.negative,\n neutral: own.neutral ?? defaults.neutral,\n };\n}\n\n/**\n * Returns a theme whose `palette.bi` is fully populated. When the host already\n * set every field this is the same theme instance; otherwise a new theme is\n * derived with `createTheme(theme, { palette: { bi } })` so every other\n * theme field is preserved.\n */\nexport function withBiPalette(theme: Theme): Theme {\n const resolved = resolveBiPalette(theme);\n const own = (theme.palette as Partial<{ bi: Partial<BiPalette> }>).bi;\n if (own === resolved) return theme;\n return createTheme(theme, { palette: { bi: resolved } });\n}\n\n/**\n * `createTheme` with the BI augmentation applied. Accepts either a finished\n * theme (`createBiTheme(myTheme)`) or plain `ThemeOptions`\n * (`createBiTheme({ palette: { mode: 'light' } })`).\n */\nexport function createBiTheme(base?: Theme | ThemeOptions): Theme {\n const theme = base && isTheme(base) ? base : createTheme(base ?? {});\n return withBiPalette(theme);\n}\n\nfunction isTheme(value: Theme | ThemeOptions): value is Theme {\n return typeof (value as Theme).spacing === 'function' && typeof (value as Theme).breakpoints?.up === 'function';\n}\n\n/** i-th series colour of the theme's BI palette, wrapping around. */\nexport function biSeriesColor(theme: Theme, index: number): string {\n const { series } = resolveBiPalette(theme);\n return series[((index % series.length) + series.length) % series.length];\n}\n\n/** Hook form of {@link resolveBiPalette} — reads the ambient MUI theme. */\nexport function useBiPalette(): BiPalette {\n const theme = useTheme();\n return resolveBiPalette(theme);\n}\n"],"names":["biLightPalette","biDarkPalette","resolveBiPalette","theme","defaults","own","__name","withBiPalette","resolved","createTheme","createBiTheme","base","isTheme","value","_a","biSeriesColor","index","series","useBiPalette","useTheme"],"mappings":";;;AAoCO,MAAMA,IAA4B;AAAA,EACrC,QAAQ;AAAA,IACJ;AAAA;AAAA,IACA;AAAA;AAAA,IACA;AAAA;AAAA,IACA;AAAA;AAAA,IACA;AAAA;AAAA,IACA;AAAA;AAAA,IACA;AAAA;AAAA,IACA;AAAA;AAAA,EAAA;AAAA,EAEJ,UAAU;AAAA,EACV,UAAU;AAAA,EACV,SAAS;AACb,GAGaC,IAA2B;AAAA,EACpC,QAAQ;AAAA,IACJ;AAAA;AAAA,IACA;AAAA;AAAA,IACA;AAAA;AAAA,IACA;AAAA;AAAA,IACA;AAAA;AAAA,IACA;AAAA;AAAA,IACA;AAAA;AAAA,IACA;AAAA;AAAA,EAAA;AAAA,EAEJ,UAAU;AAAA,EACV,UAAU;AAAA,EACV,SAAS;AACb;AC1DO,SAASC,EAAiBC,GAAyB;AACtD,QAAMC,IAAWD,EAAM,QAAQ,SAAS,SAASF,IAAgBD,GAC3DK,IAAOF,EAAM,QAAgD;AACnE,SAAKE,IACE;AAAA,IACH,QAAQA,EAAI,UAAUA,EAAI,OAAO,SAAS,IAAIA,EAAI,SAASD,EAAS;AAAA,IACpE,UAAUC,EAAI,YAAYD,EAAS;AAAA,IACnC,UAAUC,EAAI,YAAYD,EAAS;AAAA,IACnC,SAASC,EAAI,WAAWD,EAAS;AAAA,EAAA,IALpBA;AAOrB;AAVgBE,EAAAJ,GAAA;AAkBT,SAASK,EAAcJ,GAAqB;AAC/C,QAAMK,IAAWN,EAAiBC,CAAK;AAEvC,SADaA,EAAM,QAAgD,OACvDK,IAAiBL,IACtBM,EAAYN,GAAO,EAAE,SAAS,EAAE,IAAIK,EAAA,GAAY;AAC3D;AALgBF,EAAAC,GAAA;AAYT,SAASG,EAAcC,GAAoC;AAC9D,QAAMR,IAAQQ,KAAQC,EAAQD,CAAI,IAAIA,IAAOF,EAAYE,KAAQ,EAAE;AACnE,SAAOJ,EAAcJ,CAAK;AAC9B;AAHgBG,EAAAI,GAAA;AAKhB,SAASE,EAAQC,GAA6C;;AAC1D,SAAO,OAAQA,EAAgB,WAAY,cAAc,SAAQC,IAAAD,EAAgB,gBAAhB,gBAAAC,EAA6B,OAAO;AACzG;AAFSR,EAAAM,GAAA;AAKF,SAASG,EAAcZ,GAAca,GAAuB;AAC/D,QAAM,EAAE,QAAAC,EAAA,IAAWf,EAAiBC,CAAK;AACzC,SAAOc,GAASD,IAAQC,EAAO,SAAUA,EAAO,UAAUA,EAAO,MAAM;AAC3E;AAHgBX,EAAAS,GAAA;AAMT,SAASG,IAA0B;AACtC,QAAMf,IAAQgB,EAAA;AACd,SAAOjB,EAAiBC,CAAK;AACjC;AAHgBG,EAAAY,GAAA;"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Chart defaults — a host (or a dashboard viewer) can override the series
|
|
4
|
+
* palette for a subtree and turn on "mono-shade per category" so single-series
|
|
5
|
+
* bar charts use shades of one hue instead of the categorical palette.
|
|
6
|
+
*
|
|
7
|
+
* `palette` is the per-dashboard override; when absent, charts read
|
|
8
|
+
* `theme.palette.bi.series` (see `useBiPalette`).
|
|
9
|
+
*/
|
|
10
|
+
export interface ChartCardDefaults {
|
|
11
|
+
/** Replaces `theme.palette.bi.series` for series and pie / donut slice colours. */
|
|
12
|
+
palette?: readonly string[];
|
|
13
|
+
/**
|
|
14
|
+
* When true, single-series bar charts colour each *category* (data row)
|
|
15
|
+
* with a different opacity of the base series colour.
|
|
16
|
+
*/
|
|
17
|
+
monoShadePerCategory?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* When true, each ChartCard mounted under the provider gets a different
|
|
20
|
+
* primer colour from the palette in round-robin mount order.
|
|
21
|
+
*/
|
|
22
|
+
rotateBasePerChart?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Internal: provider-supplied counter used by ChartCard to claim a slot
|
|
25
|
+
* index on first mount. Use `ChartCardDefaultsProvider` rather than
|
|
26
|
+
* setting this directly.
|
|
27
|
+
*/
|
|
28
|
+
allocateChartSlot?: () => number;
|
|
29
|
+
}
|
|
30
|
+
export declare const ChartCardDefaultsContext: React.Context<ChartCardDefaults>;
|
|
31
|
+
export declare function useChartCardDefaults(): ChartCardDefaults;
|
|
32
|
+
export interface ChartCardDefaultsProviderProps {
|
|
33
|
+
palette?: readonly string[];
|
|
34
|
+
monoShadePerCategory?: boolean;
|
|
35
|
+
rotateBasePerChart?: boolean;
|
|
36
|
+
children: React.ReactNode;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Wraps a subtree in a `ChartCardDefaultsContext`. Keeps a monotonically
|
|
40
|
+
* increasing counter across child ChartCard mounts so each captures a stable
|
|
41
|
+
* slot index on first render (not reset on parent re-renders).
|
|
42
|
+
*/
|
|
43
|
+
export declare const ChartCardDefaultsProvider: React.FC<ChartCardDefaultsProviderProps>;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { QueryResult } from './queryModel';
|
|
2
|
+
import { DataTableColumn } from '../cards/DataTableCard';
|
|
3
|
+
export type TypeMap = {
|
|
4
|
+
string: string;
|
|
5
|
+
number: number;
|
|
6
|
+
date: Date;
|
|
7
|
+
boolean: boolean;
|
|
8
|
+
'string[]': string[];
|
|
9
|
+
'number[]': number[];
|
|
10
|
+
'date[]': Date[];
|
|
11
|
+
'boolean[]': boolean[];
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Name-only field type — the legacy / simple shape:
|
|
15
|
+
* `id: 'string', amount: 'number'`
|
|
16
|
+
*
|
|
17
|
+
* Continues to be the canonical form for most columns; only
|
|
18
|
+
* dropdown-filtered columns need the richer {@link FieldDescriptor}
|
|
19
|
+
* object form.
|
|
20
|
+
*/
|
|
21
|
+
export type FieldTypeName = keyof TypeMap;
|
|
22
|
+
/**
|
|
23
|
+
* Object-form field descriptor used to declare richer column
|
|
24
|
+
* metadata that the table needs at build time:
|
|
25
|
+
*
|
|
26
|
+
* - `values: T[]` — static dropdown filter (singleSelect)
|
|
27
|
+
* - `values: 'distinct'` — dynamic dropdown, values fetched
|
|
28
|
+
* from `/Query/.../distinct/{column}`
|
|
29
|
+
* - `multiple: true` — multi-select dropdown (server-side
|
|
30
|
+
* `isAnyOf` operator)
|
|
31
|
+
*
|
|
32
|
+
* Columns without dropdown semantics (numbers, free-text strings,
|
|
33
|
+
* dates) keep the simple {@link FieldTypeName} form.
|
|
34
|
+
*/
|
|
35
|
+
export interface FieldDescriptor<T extends FieldTypeName = FieldTypeName> {
|
|
36
|
+
/** Base data type the column carries. */
|
|
37
|
+
type: T;
|
|
38
|
+
/**
|
|
39
|
+
* If a literal array: those are the dropdown choices.
|
|
40
|
+
* If `'distinct'`: the lazy hook fetches the values from the
|
|
41
|
+
* server on mount (cached per (view, params) on the server).
|
|
42
|
+
* Omitted: no dropdown — falls back to whatever the type's
|
|
43
|
+
* default filter UI is.
|
|
44
|
+
*/
|
|
45
|
+
values?: ReadonlyArray<TypeMap[T]> | 'distinct';
|
|
46
|
+
/**
|
|
47
|
+
* `true` enables a multi-select dropdown that emits the
|
|
48
|
+
* `isAnyOf` operator. Default is single-select (`is`).
|
|
49
|
+
*/
|
|
50
|
+
multiple?: boolean;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Either form is accepted in {@link defineSchema}'s input shape.
|
|
54
|
+
* Existing callers passing plain strings keep working unchanged.
|
|
55
|
+
*/
|
|
56
|
+
export type FieldType = FieldTypeName | FieldDescriptor;
|
|
57
|
+
/**
|
|
58
|
+
* Pulls the underlying TypeMap entry out of either form, so
|
|
59
|
+
* `InferModel<{ id: 'string'; status: { type: 'string'; values: ['A'] } }>`
|
|
60
|
+
* resolves to `{ id: string; status: string }`.
|
|
61
|
+
*/
|
|
62
|
+
type FieldTypeBase<F> = F extends FieldTypeName ? F : F extends FieldDescriptor<infer T> ? T : never;
|
|
63
|
+
export type InferModel<S extends Record<string, FieldType>> = {
|
|
64
|
+
-readonly [K in keyof S]: TypeMap[FieldTypeBase<S[K]>];
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Normalizes a field type entry to its base name. Used internally
|
|
68
|
+
* by the schema builders so the simple and object forms share one
|
|
69
|
+
* code path for column-type / formatter lookup.
|
|
70
|
+
*/
|
|
71
|
+
export declare function extractFieldTypeName(f: FieldType): FieldTypeName;
|
|
72
|
+
/**
|
|
73
|
+
* Returns the descriptor associated with a field entry, if any.
|
|
74
|
+
* Simple-form entries (just a string) return `undefined`.
|
|
75
|
+
*/
|
|
76
|
+
export declare function extractFieldDescriptor(f: FieldType): FieldDescriptor | undefined;
|
|
77
|
+
export type ColumnSchema<S extends Record<string, FieldType>> = {
|
|
78
|
+
[K in keyof S & string]: {
|
|
79
|
+
configure(config: Partial<Omit<DataTableColumn<InferModel<S>, TypeMap[FieldTypeBase<S[K]>]>, 'field'>>): ColumnSchema<S>;
|
|
80
|
+
};
|
|
81
|
+
} & {
|
|
82
|
+
readonly definition: S;
|
|
83
|
+
build(): DataTableColumn<InferModel<S>>[];
|
|
84
|
+
};
|
|
85
|
+
export declare function defineSchema<const S extends Record<string, FieldType>>(schema: S): ColumnSchema<S>;
|
|
86
|
+
export declare function toNumber(v: unknown): number;
|
|
87
|
+
export declare function toDate(v: unknown): Date | string;
|
|
88
|
+
export declare function toBoolean(v: unknown): boolean;
|
|
89
|
+
export declare function toStr(v: unknown): string;
|
|
90
|
+
export declare class DataResult<TModel extends Record<string, any>> {
|
|
91
|
+
rows: TModel[];
|
|
92
|
+
columns: (keyof TModel & string)[];
|
|
93
|
+
private schema;
|
|
94
|
+
private _columnSchema?;
|
|
95
|
+
length: () => number;
|
|
96
|
+
get columnSchema(): ColumnSchema<any>;
|
|
97
|
+
set columnSchema(value: ColumnSchema<any>);
|
|
98
|
+
constructor(data: QueryResult | null | undefined, schema: Record<string, FieldType>);
|
|
99
|
+
first(): TModel | null;
|
|
100
|
+
last(): TModel | null;
|
|
101
|
+
isEmpty(): boolean;
|
|
102
|
+
column<K extends keyof TModel & string>(key: K): TModel[K][];
|
|
103
|
+
sum(key: keyof TModel & string): number;
|
|
104
|
+
avg(key: keyof TModel & string): number;
|
|
105
|
+
min(key: keyof TModel & string): number;
|
|
106
|
+
max(key: keyof TModel & string): number;
|
|
107
|
+
groupBy<K extends keyof TModel & string>(key: K): Map<string, DataResult<TModel>>;
|
|
108
|
+
sortedBy(key: keyof TModel & string, order?: 'asc' | 'desc'): DataResult<TModel>;
|
|
109
|
+
distinct(key: string): DataResult<TModel>;
|
|
110
|
+
slice(start: number, end?: number): DataResult<TModel>;
|
|
111
|
+
take(count: number): DataResult<TModel>;
|
|
112
|
+
filter(predicate: (row: TModel) => boolean): DataResult<TModel>;
|
|
113
|
+
map<U extends Record<string, any>>(fn: (row: TModel, index: number) => U): DataResult<U>;
|
|
114
|
+
clone(rows: Record<string, any>[], newSchema?: Record<string, FieldType>): DataResult<TModel>;
|
|
115
|
+
}
|
|
116
|
+
type ArrayKeys<T> = {
|
|
117
|
+
[K in keyof T]: NonNullable<T[K]> extends any[] ? K : never;
|
|
118
|
+
}[keyof T];
|
|
119
|
+
type ArrayItem<T, K extends keyof T> = NonNullable<T[K]> extends (infer U)[] ? U & Record<string, any> : never;
|
|
120
|
+
/** Wrap a plain array directly into a DataResult. */
|
|
121
|
+
export declare function toDashResult<TItem extends Record<string, any>>(source: TItem[]): DataResult<TItem>;
|
|
122
|
+
/** Wrap an object's array field into a DataResult, auto-detecting the first array property. */
|
|
123
|
+
export declare function toDashResult<TInput extends Record<string, any>, K extends ArrayKeys<TInput> = ArrayKeys<TInput>>(source: TInput, arrayKey?: K): DataResult<ArrayItem<TInput, K>>;
|
|
124
|
+
/** Wrap a plain array directly into a DataResult. */
|
|
125
|
+
export declare function toDataResultFromList<TItem extends Record<string, any>>(source: TItem[]): DataResult<TItem>;
|
|
126
|
+
/** Wrap an object's array field into a DataResult, auto-detecting the first array property. */
|
|
127
|
+
export declare function toDataResultFromList<TInput extends Record<string, any>, K extends ArrayKeys<TInput> = ArrayKeys<TInput>>(source: TInput, arrayKey?: K): DataResult<ArrayItem<TInput, K>>;
|
|
128
|
+
export declare function formatCompact(value: number, decimals?: number, addSuffix?: boolean, info?: any): string;
|
|
129
|
+
export declare function formatNumber(value: number, options?: {
|
|
130
|
+
decimals?: number;
|
|
131
|
+
locale?: string;
|
|
132
|
+
}): string;
|
|
133
|
+
export declare function formatCurrency(value: number, options?: {
|
|
134
|
+
currency?: string;
|
|
135
|
+
locale?: string;
|
|
136
|
+
}): string;
|
|
137
|
+
export declare function formatPercent(value: number, options?: {
|
|
138
|
+
decimals?: number;
|
|
139
|
+
isRatio?: boolean;
|
|
140
|
+
}): string;
|
|
141
|
+
export declare function formatBoolean(value: boolean | number): string;
|
|
142
|
+
export declare function formatDate(date: Date | null | undefined, format?: string): string;
|
|
143
|
+
export declare function formatISODate(date: Date | null | undefined): string;
|
|
144
|
+
export declare function truncateText(text: string, maxLength: number, suffix?: string): string;
|
|
145
|
+
export declare function capitalize(text: string): string;
|
|
146
|
+
export declare function toTitleCase(text: string): string;
|
|
147
|
+
export declare function computeDomain(values: number[], padding?: number): [number, number];
|
|
148
|
+
export declare function computeTicks(min: number, max: number, count?: number): number[];
|
|
149
|
+
export declare function percentChange(previous: number, current: number): number | null;
|
|
150
|
+
export declare function trendArrow(value: number): '↑' | '↓' | '→';
|
|
151
|
+
export declare function trendColor(value: number, positiveIsGood?: boolean): 'success' | 'error' | 'default';
|
|
152
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export * from './dataUtils';
|
|
2
|
+
export type { QueryResult, QueryResultRow, ResultField, IRow, IGeneratedQueryResult, IGeneratedQueryResultRow } from './queryModel';
|
|
3
|
+
export { ChartCardDefaultsContext, ChartCardDefaultsProvider, useChartCardDefaults } from './ChartCardDefaultsContext';
|
|
4
|
+
export type { ChartCardDefaults, ChartCardDefaultsProviderProps } from './ChartCardDefaultsContext';
|
|
5
|
+
export { useBiPalette, biSeriesColor, resolveBiPalette } from '../theme/createBiTheme';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wire shape of a query result as the server returns it: positional
|
|
3
|
+
* `values[]` per row aligned with `headers[]`. Shared by `DataResult`, the
|
|
4
|
+
* data hooks and the filter components.
|
|
5
|
+
*/
|
|
6
|
+
export interface ResultField {
|
|
7
|
+
v?: string | null;
|
|
8
|
+
vs?: string[] | null;
|
|
9
|
+
}
|
|
10
|
+
export interface QueryResultRow {
|
|
11
|
+
values: ResultField[];
|
|
12
|
+
}
|
|
13
|
+
export interface QueryResult {
|
|
14
|
+
headers: string[];
|
|
15
|
+
rows: QueryResultRow[];
|
|
16
|
+
}
|
|
17
|
+
/** A result row keyed by header name (the auto-complete filter's option shape). */
|
|
18
|
+
export interface IRow {
|
|
19
|
+
[key: string]: string;
|
|
20
|
+
}
|
|
21
|
+
/** Legacy aliases kept for code compiled against the old `QueryModel.ts`. */
|
|
22
|
+
export type IGeneratedQueryResultRow = QueryResultRow;
|
|
23
|
+
export type IGeneratedQueryResult = QueryResult;
|
package/dist/data.d.ts
ADDED
package/dist/data.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { D as e, c as s, a as r, b as o, d as m, e as l, f as u, g as i, h as c, i as f, j as C, k as n, l as D, m as p, p as d, t as x, n as h, o as b, q as B, r as P, s as S, u as T, v, w as F, x as N } from "./dataUtils-CAUE5uZY.js";
|
|
2
|
+
import { C as g, a as k, u as w } from "./ChartCardDefaultsContext-Cl5T25H0.js";
|
|
3
|
+
import { c as j, r as q, u as z } from "./createBiTheme-TyUv_UHM.js";
|
|
4
|
+
export {
|
|
5
|
+
g as ChartCardDefaultsContext,
|
|
6
|
+
k as ChartCardDefaultsProvider,
|
|
7
|
+
e as DataResult,
|
|
8
|
+
j as biSeriesColor,
|
|
9
|
+
s as capitalize,
|
|
10
|
+
r as computeDomain,
|
|
11
|
+
o as computeTicks,
|
|
12
|
+
m as defineSchema,
|
|
13
|
+
l as extractFieldDescriptor,
|
|
14
|
+
u as extractFieldTypeName,
|
|
15
|
+
i as formatBoolean,
|
|
16
|
+
c as formatCompact,
|
|
17
|
+
f as formatCurrency,
|
|
18
|
+
C as formatDate,
|
|
19
|
+
n as formatISODate,
|
|
20
|
+
D as formatNumber,
|
|
21
|
+
p as formatPercent,
|
|
22
|
+
d as percentChange,
|
|
23
|
+
q as resolveBiPalette,
|
|
24
|
+
x as toBoolean,
|
|
25
|
+
h as toDashResult,
|
|
26
|
+
b as toDataResultFromList,
|
|
27
|
+
B as toDate,
|
|
28
|
+
P as toNumber,
|
|
29
|
+
S as toStr,
|
|
30
|
+
T as toTitleCase,
|
|
31
|
+
v as trendArrow,
|
|
32
|
+
F as trendColor,
|
|
33
|
+
N as truncateText,
|
|
34
|
+
z as useBiPalette,
|
|
35
|
+
w as useChartCardDefaults
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=data.js.map
|
package/dist/data.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|