@marimo-team/islands 0.23.14-dev30 → 0.23.14-dev32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{code-visibility-CAkgOEA5.js → code-visibility-BUGZuhE4.js} +1 -1
- package/dist/main.js +951 -953
- package/dist/{reveal-component-x6IwgqPf.js → reveal-component-BFbxRhIh.js} +1 -1
- package/package.json +1 -1
- package/src/components/data-table/charts/__tests__/altair-generator.test.ts +24 -0
- package/src/components/data-table/charts/chart-spec/altair-generator.ts +4 -1
- package/src/components/data-table/charts/charts.tsx +2 -3
|
@@ -9,7 +9,7 @@ import { t as require_compiler_runtime } from "./compiler-runtime-CEbnTgxf.js";
|
|
|
9
9
|
import { lt as kioskModeAtom, pt as outputIsStale } from "./html-to-image-DLSOS-bE.js";
|
|
10
10
|
import "./chunk-5FQGJX7Z-BbqSm5gU.js";
|
|
11
11
|
import { u as createLucideIcon } from "./dist--2Bqjvs0.js";
|
|
12
|
-
import { a as DEFAULT_SLIDE_TYPE, c as Slide, ct as PanelGroup, i as DEFAULT_DECK_TRANSITION, lt as PanelResizeHandle, on as EyeOff, s as SlideSidebar, sn as Expand, st as Panel, t as useNotebookCodeAvailable, un as Code } from "./code-visibility-
|
|
12
|
+
import { a as DEFAULT_SLIDE_TYPE, c as Slide, ct as PanelGroup, i as DEFAULT_DECK_TRANSITION, lt as PanelResizeHandle, on as EyeOff, s as SlideSidebar, sn as Expand, st as Panel, t as useNotebookCodeAvailable, un as Code } from "./code-visibility-BUGZuhE4.js";
|
|
13
13
|
import { X as useDebouncedCallback } from "./input-BSdZp5Ng.js";
|
|
14
14
|
import "./toDate-D1Z7ZXWh.js";
|
|
15
15
|
import "./react-dom-BTJzcVJ9.js";
|
package/package.json
CHANGED
|
@@ -85,6 +85,10 @@ const Mocks = {
|
|
|
85
85
|
type: "arc",
|
|
86
86
|
innerRadius: 100,
|
|
87
87
|
},
|
|
88
|
+
arcDefault: {
|
|
89
|
+
type: "arc",
|
|
90
|
+
innerRadius: undefined,
|
|
91
|
+
},
|
|
88
92
|
},
|
|
89
93
|
};
|
|
90
94
|
|
|
@@ -128,6 +132,26 @@ describe("generateAltairChart", () => {
|
|
|
128
132
|
`);
|
|
129
133
|
});
|
|
130
134
|
|
|
135
|
+
it("should generate a pie chart when arc has undefined innerRadius", () => {
|
|
136
|
+
const spec = createSpec({
|
|
137
|
+
mark: Mocks.marks.arcDefault,
|
|
138
|
+
encoding: {
|
|
139
|
+
theta: Mocks.thetaAxis,
|
|
140
|
+
},
|
|
141
|
+
});
|
|
142
|
+
const datasource = "df";
|
|
143
|
+
|
|
144
|
+
const result = generateAltairChart(spec, datasource).toCode();
|
|
145
|
+
|
|
146
|
+
expect(result).toMatchInlineSnapshot(`
|
|
147
|
+
"alt.Chart(df)
|
|
148
|
+
.mark_arc()
|
|
149
|
+
.encode(theta=alt.Theta(field='theta', axis={
|
|
150
|
+
'title': 'Theta Axis'
|
|
151
|
+
}))"
|
|
152
|
+
`);
|
|
153
|
+
});
|
|
154
|
+
|
|
131
155
|
it("should generate a donut chart", () => {
|
|
132
156
|
const spec = createSpec({
|
|
133
157
|
mark: Mocks.marks.arc,
|
|
@@ -30,7 +30,10 @@ export function generateAltairChart(
|
|
|
30
30
|
if (typeof spec.mark === "object" && "type" in spec.mark) {
|
|
31
31
|
markProps = Object.fromEntries(
|
|
32
32
|
Object.entries(spec.mark)
|
|
33
|
-
.filter(
|
|
33
|
+
.filter(
|
|
34
|
+
([key, value]) =>
|
|
35
|
+
key !== "type" && value !== undefined && value !== null,
|
|
36
|
+
)
|
|
34
37
|
.map(([key, value]) => [key, new Literal(value)]),
|
|
35
38
|
);
|
|
36
39
|
}
|
|
@@ -27,6 +27,7 @@ import { useDebouncedCallback } from "@/hooks/useDebounce";
|
|
|
27
27
|
import type { GetDataUrl } from "@/plugins/impl/DataTablePlugin";
|
|
28
28
|
import { vegaLoadData } from "@/plugins/impl/vega/loader";
|
|
29
29
|
import { useTheme } from "@/theme/useTheme";
|
|
30
|
+
import { uniqueBy } from "@/utils/arrays";
|
|
30
31
|
import { inferFieldTypes } from "../columns";
|
|
31
32
|
import {
|
|
32
33
|
type FieldTypesWithExternalType,
|
|
@@ -67,9 +68,7 @@ export function mergeIndexFields(
|
|
|
67
68
|
if (!rowHeaders || rowHeaders.length === 0) {
|
|
68
69
|
return base;
|
|
69
70
|
}
|
|
70
|
-
|
|
71
|
-
const indexFields = rowHeaders.filter(([name]) => !seen.has(name));
|
|
72
|
-
return [...base, ...indexFields];
|
|
71
|
+
return uniqueBy([...base, ...rowHeaders], (f) => f[0]);
|
|
73
72
|
}
|
|
74
73
|
|
|
75
74
|
export interface TablePanelProps {
|