@malloydata/malloy-explorer 0.0.294-dev250630221944 → 0.0.295-dev250710213205
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/.gitmodules +3 -0
- package/@flowtypes/components/MalloyExplorerProvider.flow.js +2 -5
- package/README.md +7 -0
- package/dist/cjs/index.cjs +111 -77
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.js +112 -78
- package/dist/esm/index.js.map +1 -1
- package/dist/malloy-explorer.css +2 -0
- package/dist/types/components/MalloyExplorerProvider.d.ts +2 -4
- package/dist/types/components/QueryPanel/AddMenu/ValueList.d.ts +2 -1
- package/dist/types/components/ResultPanel/ResultDisplay.d.ts +0 -4
- package/dist/types/contexts/QueryEditorContext.d.ts +2 -4
- package/package.json +8 -6
- package/vite.config.mts +5 -0
package/dist/esm/index.js
CHANGED
|
@@ -17,7 +17,7 @@ import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
|
17
17
|
import * as React from "react";
|
|
18
18
|
import React__default, { useLayoutEffect, useEffect, useMemo, useState, useRef, createElement, useContext, useCallback, createContext, memo, useReducer } from "react";
|
|
19
19
|
import * as QB from "@malloydata/malloy-query-builder";
|
|
20
|
-
import { ASTArrowQueryDefinition, ASTArrowViewDefinition, ASTSegmentViewDefinition, ASTNestViewOperation, ASTRefinementViewDefinition, ASTFilterWithLiteralEquality, ASTAnnotation, ASTOrderByViewOperation, ASTGroupByViewOperation, ASTAggregateViewOperation, ASTLimitViewOperation, ASTTimeTruncationExpression, ASTFilterWithFilterString, ASTWhereViewOperation, ASTHavingViewOperation, ASTDrillViewOperation, ASTQuery } from "@malloydata/malloy-query-builder";
|
|
20
|
+
import { ASTArrowQueryDefinition, ASTArrowViewDefinition, ASTSegmentViewDefinition, ASTNestViewOperation, ASTRefinementViewDefinition, ASTFilterWithLiteralEquality, ASTAnnotation, ASTOrderByViewOperation, ASTGroupByViewOperation, ASTAggregateViewOperation, ASTLimitViewOperation, ASTTimeTruncationExpression, ASTFilterWithFilterString, ASTReferenceExpression, ASTWhereViewOperation, ASTHavingViewOperation, ASTDrillViewOperation, ASTQuery } from "@malloydata/malloy-query-builder";
|
|
21
21
|
import { Tag } from "@malloydata/malloy-tag";
|
|
22
22
|
import { MalloyRenderer, isCoreVizPluginInstance } from "@malloydata/render";
|
|
23
23
|
import { TemporalFilterExpression, BooleanFilterExpression, NumberFilterExpression, StringFilterExpression } from "@malloydata/malloy-filter";
|
|
@@ -7992,16 +7992,14 @@ function SelectorToken({
|
|
|
7992
7992
|
onValueChange: handleValueChange,
|
|
7993
7993
|
required: true,
|
|
7994
7994
|
children: [/* @__PURE__ */ jsxs(Trigger$3, {
|
|
7995
|
-
..._stylex.props(tokenStyles.main, styles$H.selectTrigger, tokenColorVariants[color], tokenSizeVariants[size2],
|
|
7995
|
+
..._stylex.props(tokenStyles.main, styles$H.selectTrigger, tokenColorVariants[color], tokenSizeVariants[size2], customStyle),
|
|
7996
7996
|
children: [icon && /* @__PURE__ */ jsx(Icon, {
|
|
7997
7997
|
name: icon,
|
|
7998
7998
|
customStyle: tokenStyles.icon
|
|
7999
7999
|
}), /* @__PURE__ */ jsx(Value$1, {
|
|
8000
8000
|
asChild: true,
|
|
8001
8001
|
children: /* @__PURE__ */ jsx("div", {
|
|
8002
|
-
...
|
|
8003
|
-
className: "mlyb3r6kr mlylyipyv"
|
|
8004
|
-
},
|
|
8002
|
+
..._stylex.props(fontStyles.body, tokenStyles.label),
|
|
8005
8003
|
children: label
|
|
8006
8004
|
})
|
|
8007
8005
|
})]
|
|
@@ -8030,17 +8028,15 @@ function SelectorToken({
|
|
|
8030
8028
|
}, 10);
|
|
8031
8029
|
}
|
|
8032
8030
|
}
|
|
8033
|
-
}), /* @__PURE__ */ jsx(
|
|
8034
|
-
|
|
8035
|
-
|
|
8036
|
-
|
|
8037
|
-
|
|
8038
|
-
|
|
8039
|
-
|
|
8040
|
-
|
|
8041
|
-
|
|
8042
|
-
}, item.value))
|
|
8043
|
-
})
|
|
8031
|
+
}), /* @__PURE__ */ jsx(Group$1, {
|
|
8032
|
+
...{
|
|
8033
|
+
className: "mly78zum5 mlydt5ytf mlyuyqlj2 mlyfawy5m mly195vfkc mlyysyzu8"
|
|
8034
|
+
},
|
|
8035
|
+
children: filteredItems.map((item) => /* @__PURE__ */ jsx(SelectItem, {
|
|
8036
|
+
value: item.value,
|
|
8037
|
+
selectedValue: value,
|
|
8038
|
+
children: item.label
|
|
8039
|
+
}, item.value))
|
|
8044
8040
|
})]
|
|
8045
8041
|
})
|
|
8046
8042
|
})
|
|
@@ -26289,19 +26285,22 @@ function DrillOperations({
|
|
|
26289
26285
|
...{
|
|
26290
26286
|
className: "mly78zum5 mlydt5ytf mly1jnr06f"
|
|
26291
26287
|
},
|
|
26292
|
-
children: drills.map((drill, key2) =>
|
|
26293
|
-
|
|
26294
|
-
|
|
26295
|
-
|
|
26296
|
-
|
|
26297
|
-
|
|
26298
|
-
|
|
26299
|
-
|
|
26300
|
-
|
|
26301
|
-
|
|
26302
|
-
|
|
26303
|
-
|
|
26304
|
-
|
|
26288
|
+
children: drills.map((drill, key2) => {
|
|
26289
|
+
const field = drill.filter.expression.getFieldInfo();
|
|
26290
|
+
return field ? /* @__PURE__ */ jsxs(TokenGroup, {
|
|
26291
|
+
color: "cyan",
|
|
26292
|
+
customStyle: localStyles.tokenGroup,
|
|
26293
|
+
children: [/* @__PURE__ */ jsx(FieldToken, {
|
|
26294
|
+
field
|
|
26295
|
+
}), /* @__PURE__ */ jsx(Token, {
|
|
26296
|
+
label: "="
|
|
26297
|
+
}), drill.filter instanceof ASTFilterWithLiteralEquality ? /* @__PURE__ */ jsx(LiteralValue, {
|
|
26298
|
+
value: drill.filter.value.node
|
|
26299
|
+
}) : /* @__PURE__ */ jsx(Token, {
|
|
26300
|
+
label: drill.filter.filterString
|
|
26301
|
+
})]
|
|
26302
|
+
}, key2) : null;
|
|
26303
|
+
})
|
|
26305
26304
|
})]
|
|
26306
26305
|
});
|
|
26307
26306
|
}
|
|
@@ -31975,17 +31974,21 @@ function Visualization$1({
|
|
|
31975
31974
|
const renderer = useMemo(() => new MalloyRenderer(), []);
|
|
31976
31975
|
const [currentRenderer, setCurrentRenderer] = useState("table");
|
|
31977
31976
|
const [plugin, setPlugin] = useState();
|
|
31977
|
+
const [error, setError] = useState("");
|
|
31978
31978
|
const [open, setOpen] = useState(false);
|
|
31979
|
+
const tag = view.getTag().toString();
|
|
31979
31980
|
useEffect(() => {
|
|
31980
31981
|
var _a2;
|
|
31982
|
+
setError("");
|
|
31981
31983
|
const viz = renderer.createViz({
|
|
31982
|
-
onError: (
|
|
31983
|
-
console.error("Malloy render error",
|
|
31984
|
+
onError: (error2) => {
|
|
31985
|
+
console.error("Malloy render error", error2);
|
|
31986
|
+
setError(error2.message);
|
|
31984
31987
|
}
|
|
31985
31988
|
});
|
|
31986
31989
|
viz.setResult({
|
|
31987
31990
|
schema: view.definition.getOutputSchema(),
|
|
31988
|
-
annotations:
|
|
31991
|
+
annotations: tag.split("\n").map((value) => ({
|
|
31989
31992
|
value
|
|
31990
31993
|
})),
|
|
31991
31994
|
connection_name: ""
|
|
@@ -31993,17 +31996,23 @@ function Visualization$1({
|
|
|
31993
31996
|
const metadata = viz.getMetadata();
|
|
31994
31997
|
if (metadata) {
|
|
31995
31998
|
const plugin2 = viz.getActivePlugin(metadata.getRootField().key);
|
|
31996
|
-
if (plugin2
|
|
31997
|
-
|
|
31998
|
-
|
|
31999
|
+
if (plugin2) {
|
|
32000
|
+
if (isCoreVizPluginInstance(plugin2)) {
|
|
32001
|
+
setCurrentRenderer(plugin2.name);
|
|
32002
|
+
setPlugin(plugin2);
|
|
32003
|
+
return;
|
|
32004
|
+
}
|
|
32005
|
+
if (plugin2.name === "error") {
|
|
32006
|
+
setError(plugin2.getMetadata().message);
|
|
32007
|
+
}
|
|
31999
32008
|
}
|
|
32000
|
-
} else {
|
|
32001
|
-
const currentTag = view.getTag();
|
|
32002
|
-
const rendererTag = view.getTag(RENDERER_PREFIX);
|
|
32003
|
-
const currentRenderer2 = ((_a2 = rendererTag.tag("viz")) == null ? void 0 : _a2.text()) ?? legacyToViz(tagToRenderer(currentTag) ?? "table");
|
|
32004
|
-
setCurrentRenderer(currentRenderer2);
|
|
32005
32009
|
}
|
|
32006
|
-
|
|
32010
|
+
const currentTag = view.getTag();
|
|
32011
|
+
const rendererTag = view.getTag(RENDERER_PREFIX);
|
|
32012
|
+
const currentRenderer2 = ((_a2 = rendererTag.tag("viz")) == null ? void 0 : _a2.text()) ?? legacyToViz(tagToRenderer(currentTag) ?? "table");
|
|
32013
|
+
setCurrentRenderer(currentRenderer2);
|
|
32014
|
+
setPlugin(void 0);
|
|
32015
|
+
}, [renderer, view, tag]);
|
|
32007
32016
|
const updateViz = (renderer2) => {
|
|
32008
32017
|
view.setTagProperty(["viz"], renderer2, RENDERER_PREFIX);
|
|
32009
32018
|
setQuery == null ? void 0 : setQuery(rootQuery.build());
|
|
@@ -32031,6 +32040,13 @@ function Visualization$1({
|
|
|
32031
32040
|
tooltip: "Edit Settings..."
|
|
32032
32041
|
}, "gear"));
|
|
32033
32042
|
}
|
|
32043
|
+
if (error) {
|
|
32044
|
+
tokens2.push(/* @__PURE__ */ jsx(Token, {
|
|
32045
|
+
icon: "warning",
|
|
32046
|
+
tooltip: error,
|
|
32047
|
+
customStyle: styles$o.trigger
|
|
32048
|
+
}));
|
|
32049
|
+
}
|
|
32034
32050
|
return /* @__PURE__ */ jsxs(Fragment, {
|
|
32035
32051
|
children: [/* @__PURE__ */ jsx(TokenGroup, {
|
|
32036
32052
|
customStyle: styles$o.group,
|
|
@@ -32600,7 +32616,8 @@ function ValueList({
|
|
|
32600
32616
|
fieldPath,
|
|
32601
32617
|
ref,
|
|
32602
32618
|
customStyle,
|
|
32603
|
-
showPath = true
|
|
32619
|
+
showPath = true,
|
|
32620
|
+
hideNoMatchMessage = false
|
|
32604
32621
|
}) {
|
|
32605
32622
|
const {
|
|
32606
32623
|
searchResults
|
|
@@ -32622,7 +32639,7 @@ function ValueList({
|
|
|
32622
32639
|
},
|
|
32623
32640
|
children: value.fieldName
|
|
32624
32641
|
}) : null]
|
|
32625
|
-
}, value.fieldName + ":" + value.fieldValue)) : search ? /* @__PURE__ */ jsx("div", {
|
|
32642
|
+
}, value.fieldName + ":" + value.fieldValue)) : search && !hideNoMatchMessage ? /* @__PURE__ */ jsx("div", {
|
|
32626
32643
|
..._stylex.props(addMenuStyles.item),
|
|
32627
32644
|
"data-disabled": "true",
|
|
32628
32645
|
children: "No matching values"
|
|
@@ -32817,7 +32834,8 @@ const StringFilterCore = ({
|
|
|
32817
32834
|
},
|
|
32818
32835
|
customStyle: styles$i.valueList,
|
|
32819
32836
|
showPath: false,
|
|
32820
|
-
filter: (value) => !currentFilter.values.includes(value)
|
|
32837
|
+
filter: (value) => !currentFilter.values.includes(value),
|
|
32838
|
+
hideNoMatchMessage: true
|
|
32821
32839
|
})
|
|
32822
32840
|
})]
|
|
32823
32841
|
}) : currentFilter.operator === "~" ? /* @__PURE__ */ jsx(StringEditor, {
|
|
@@ -34376,24 +34394,39 @@ function SortableOperation({
|
|
|
34376
34394
|
id,
|
|
34377
34395
|
ref: setNodeRef,
|
|
34378
34396
|
style,
|
|
34379
|
-
children: [granular ? /* @__PURE__ */ jsxs(
|
|
34380
|
-
|
|
34381
|
-
|
|
34382
|
-
|
|
34383
|
-
|
|
34384
|
-
|
|
34385
|
-
|
|
34386
|
-
attributes,
|
|
34387
|
-
listeners
|
|
34397
|
+
children: [granular ? /* @__PURE__ */ jsxs("div", {
|
|
34398
|
+
...{
|
|
34399
|
+
0: {
|
|
34400
|
+
className: "mly78zum5 mly6s0dn4 mly1nhvcw1 mly1jnr06f mly11ogjb6 mly1g9of4s"
|
|
34401
|
+
},
|
|
34402
|
+
1: {
|
|
34403
|
+
className: "mly78zum5 mly6s0dn4 mly1nhvcw1 mly1jnr06f mly1ae5hkt"
|
|
34388
34404
|
}
|
|
34389
|
-
}
|
|
34390
|
-
|
|
34391
|
-
|
|
34392
|
-
|
|
34393
|
-
|
|
34394
|
-
|
|
34405
|
+
}[!!hoverActionsVisible << 0],
|
|
34406
|
+
children: [/* @__PURE__ */ jsxs(TokenGroup, {
|
|
34407
|
+
customStyle: customStyles.tokenGroup,
|
|
34408
|
+
children: [/* @__PURE__ */ jsx(Token, {
|
|
34409
|
+
color,
|
|
34410
|
+
icon,
|
|
34411
|
+
label: fieldInfo.name,
|
|
34412
|
+
dragProps: {
|
|
34413
|
+
attributes,
|
|
34414
|
+
listeners
|
|
34415
|
+
}
|
|
34416
|
+
}), /* @__PURE__ */ jsx(SelectorToken, {
|
|
34417
|
+
color,
|
|
34418
|
+
value: granular.value,
|
|
34419
|
+
onChange: (granulation) => {
|
|
34420
|
+
if (operation.field.expression instanceof ASTTimeTruncationExpression) operation.field.expression.truncation = granulation;
|
|
34421
|
+
setQuery == null ? void 0 : setQuery(rootQuery.build());
|
|
34422
|
+
},
|
|
34423
|
+
items: granular.options
|
|
34424
|
+
})]
|
|
34425
|
+
}), hoverActions && /* @__PURE__ */ jsx("div", {
|
|
34426
|
+
...{
|
|
34427
|
+
className: "mly2b4tyj mly2lah0s"
|
|
34395
34428
|
},
|
|
34396
|
-
|
|
34429
|
+
children: hoverActions
|
|
34397
34430
|
})]
|
|
34398
34431
|
}) : /* @__PURE__ */ jsx(FieldToken, {
|
|
34399
34432
|
field: fieldInfo,
|
|
@@ -34751,29 +34784,33 @@ function SingleFilterOperation({
|
|
|
34751
34784
|
}
|
|
34752
34785
|
setQuery == null ? void 0 : setQuery(rootQuery.build());
|
|
34753
34786
|
}, [filterOperation.filter, rootQuery, setQuery]);
|
|
34754
|
-
|
|
34787
|
+
const {
|
|
34788
|
+
filter
|
|
34789
|
+
} = filterOperation;
|
|
34790
|
+
if (!(filter instanceof ASTFilterWithFilterString)) {
|
|
34755
34791
|
return null;
|
|
34756
34792
|
}
|
|
34757
34793
|
const {
|
|
34758
|
-
|
|
34794
|
+
expression,
|
|
34759
34795
|
filterString
|
|
34760
|
-
} =
|
|
34761
|
-
|
|
34762
|
-
|
|
34763
|
-
if (fieldInfo.kind !== "dimension" && fieldInfo.kind !== "measure") {
|
|
34764
|
-
throw new Error(`Invalid filter field kind: ${fieldInfo.kind}`);
|
|
34796
|
+
} = filter;
|
|
34797
|
+
if (!(expression instanceof ASTReferenceExpression)) {
|
|
34798
|
+
return null;
|
|
34765
34799
|
}
|
|
34800
|
+
const fieldInfo = filter.getFieldInfo();
|
|
34801
|
+
const parsedFilter = filter.getFilter();
|
|
34802
|
+
const path = expression.path ?? [];
|
|
34766
34803
|
const {
|
|
34767
34804
|
op,
|
|
34768
34805
|
value
|
|
34769
|
-
} = parsedToLabels(
|
|
34806
|
+
} = parsedToLabels(parsedFilter, filterString);
|
|
34770
34807
|
const label = `${fieldInfo.name} ${op} ${value}`;
|
|
34771
34808
|
return /* @__PURE__ */ jsxs("div", {
|
|
34772
34809
|
..._stylex.props(hoverStyles.main),
|
|
34773
34810
|
children: [/* @__PURE__ */ jsx(FilterPopover, {
|
|
34774
34811
|
fieldInfo,
|
|
34775
|
-
path
|
|
34776
|
-
filter,
|
|
34812
|
+
path,
|
|
34813
|
+
filter: parsedFilter,
|
|
34777
34814
|
setFilter,
|
|
34778
34815
|
trigger: /* @__PURE__ */ jsx(Token, {
|
|
34779
34816
|
icon: "filter",
|
|
@@ -36684,17 +36721,14 @@ function RenderedResult({
|
|
|
36684
36721
|
const viz = useMemo(() => {
|
|
36685
36722
|
const renderer = new MalloyRenderer();
|
|
36686
36723
|
const viz2 = renderer.createViz({
|
|
36687
|
-
onDrill: ({
|
|
36688
|
-
stableQuery,
|
|
36689
|
-
stableDrillClauses
|
|
36690
|
-
}) => {
|
|
36724
|
+
onDrill: (drillData) => {
|
|
36691
36725
|
if (onDrill) {
|
|
36692
|
-
onDrill(
|
|
36693
|
-
stableQuery,
|
|
36694
|
-
stableDrillClauses
|
|
36695
|
-
});
|
|
36726
|
+
onDrill(drillData);
|
|
36696
36727
|
return;
|
|
36697
36728
|
}
|
|
36729
|
+
const {
|
|
36730
|
+
stableQuery
|
|
36731
|
+
} = drillData;
|
|
36698
36732
|
const rootQuery = new ASTQuery({
|
|
36699
36733
|
query: stableQuery,
|
|
36700
36734
|
source
|