@malloydata/malloy-explorer 0.0.257-dev250410160631 → 0.0.257-dev250412010850
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/@flowtypes/components/ResultPanel/ResultPanel.flow.js +6 -1
- package/babel.config.mjs +1 -0
- package/dist/cjs/index.cjs +358 -210
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.js +359 -211
- package/dist/esm/index.js.map +1 -1
- package/dist/malloy-explorer.css +1 -1
- package/dist/types/components/QueryPanel/AddMenu/AddAggregate.d.ts +4 -3
- package/dist/types/components/QueryPanel/AddMenu/AddEmptyNest.d.ts +4 -3
- package/dist/types/components/QueryPanel/AddMenu/AddFieldItem.d.ts +4 -4
- package/dist/types/components/QueryPanel/AddMenu/AddGroupBy.d.ts +4 -3
- package/dist/types/components/QueryPanel/AddMenu/AddLimit.d.ts +4 -3
- package/dist/types/components/QueryPanel/AddMenu/AddMenu.d.ts +3 -2
- package/dist/types/components/QueryPanel/AddMenu/AddOrderBy.d.ts +4 -3
- package/dist/types/components/QueryPanel/AddMenu/AddView.d.ts +4 -4
- package/dist/types/components/QueryPanel/AddMenu/AddWhere.d.ts +4 -3
- package/dist/types/components/QueryPanel/AddMenu/FieldList.d.ts +4 -4
- package/dist/types/components/QueryPanel/AddMenu/FieldMenu.d.ts +4 -4
- package/dist/types/components/QueryPanel/Operations.d.ts +3 -1
- package/dist/types/components/QueryPanel/ViewDefinition.d.ts +3 -1
- package/dist/types/components/QueryPanel/operations/AggregateOperations.d.ts +4 -3
- package/dist/types/components/QueryPanel/operations/GroupByOperations.d.ts +4 -3
- package/dist/types/components/QueryPanel/operations/LimitOperation.d.ts +1 -2
- package/dist/types/components/QueryPanel/operations/NestOperation.d.ts +1 -2
- package/dist/types/components/QueryPanel/operations/OperationActionTitle.d.ts +4 -3
- package/dist/types/components/QueryPanel/operations/OrderByOperations.d.ts +1 -2
- package/dist/types/components/QueryPanel/operations/WhereOperations.d.ts +1 -2
- package/dist/types/components/ResultPanel/DebugPane.d.ts +11 -0
- package/dist/types/components/ResultPanel/ResultPanel.d.ts +2 -0
- package/dist/types/components/primitives/CollapsibleListItem.d.ts +5 -1
- package/dist/types/components/utils/fields.d.ts +6 -0
- package/dist/types/components/utils/segment.d.ts +2 -0
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -17,7 +17,7 @@ import * as React from "react";
|
|
|
17
17
|
import React__default, { useLayoutEffect, useEffect, useMemo, useState, useRef, createElement, useContext, useCallback } from "react";
|
|
18
18
|
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
19
19
|
import * as QB from "@malloydata/malloy-query-builder";
|
|
20
|
-
import { ASTLimitViewOperation, ASTNestViewOperation, ASTOrderByViewOperation, ASTGroupByViewOperation, ASTAggregateViewOperation, ASTWhereViewOperation, ASTArrowViewDefinition
|
|
20
|
+
import { ASTArrowQueryDefinition, ASTSegmentViewDefinition, ASTLimitViewOperation, ASTNestViewOperation, ASTRefinementViewDefinition, ASTOrderByViewOperation, ASTGroupByViewOperation, ASTAggregateViewOperation, ASTWhereViewOperation, ASTArrowViewDefinition } from "@malloydata/malloy-query-builder";
|
|
21
21
|
import { Tag } from "@malloydata/malloy-tag";
|
|
22
22
|
import * as render from "@malloydata/render";
|
|
23
23
|
import "@malloydata/render/webcomponent";
|
|
@@ -3592,6 +3592,15 @@ const tooltipStyles = {
|
|
|
3592
3592
|
}
|
|
3593
3593
|
};
|
|
3594
3594
|
const fontStyles = {
|
|
3595
|
+
largeBody: {
|
|
3596
|
+
fontFamily: "x1rj5sg5",
|
|
3597
|
+
color: "x1dhlylr",
|
|
3598
|
+
fontWeight: "xo1l8bm",
|
|
3599
|
+
fontSize: "x1j61zf2",
|
|
3600
|
+
lineHeight: "x1fc57z9",
|
|
3601
|
+
letterSpacing: "x12oo3zp",
|
|
3602
|
+
$$css: true
|
|
3603
|
+
},
|
|
3595
3604
|
emphasized: {
|
|
3596
3605
|
fontFamily: "x1rj5sg5",
|
|
3597
3606
|
color: "x1dhlylr",
|
|
@@ -8141,16 +8150,17 @@ const styles$o = {
|
|
|
8141
8150
|
function CollapsibleListItem({
|
|
8142
8151
|
label,
|
|
8143
8152
|
sublabel,
|
|
8144
|
-
children
|
|
8153
|
+
children,
|
|
8154
|
+
isInitiallyExpanded = false
|
|
8145
8155
|
}) {
|
|
8146
|
-
const [isExpanded, setIsExpanded] = React.useState(
|
|
8156
|
+
const [isExpanded, setIsExpanded] = React.useState(isInitiallyExpanded);
|
|
8147
8157
|
const handleToggle = () => {
|
|
8148
8158
|
setIsExpanded((prev) => !prev);
|
|
8149
8159
|
};
|
|
8150
8160
|
return /* @__PURE__ */ jsxs("div", {
|
|
8151
8161
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
8152
8162
|
...{
|
|
8153
|
-
className: "
|
|
8163
|
+
className: "xrvj5dj x1mt1orb x6s0dn4 xlqzeqv xe8ttls x167g77z xur7f20 x1ypdohk x1haqvef"
|
|
8154
8164
|
},
|
|
8155
8165
|
onClick: handleToggle,
|
|
8156
8166
|
children: [isExpanded ? /* @__PURE__ */ jsx(Icon, {
|
|
@@ -8161,7 +8171,7 @@ function CollapsibleListItem({
|
|
|
8161
8171
|
color: "secondary"
|
|
8162
8172
|
}), /* @__PURE__ */ jsxs("div", {
|
|
8163
8173
|
...{
|
|
8164
|
-
className: "x78zum5 xdt5ytf x1iyjqo2"
|
|
8174
|
+
className: "x78zum5 xdt5ytf x1iyjqo2 xb3r6kr"
|
|
8165
8175
|
},
|
|
8166
8176
|
children: [/* @__PURE__ */ jsx("span", {
|
|
8167
8177
|
..._stylex.props(fontStyles.body, styles$n.label),
|
|
@@ -8183,11 +8193,19 @@ const styles$n = {
|
|
|
8183
8193
|
label: {
|
|
8184
8194
|
flexGrow: "x1iyjqo2",
|
|
8185
8195
|
fontWeight: "x1xlr1w8",
|
|
8196
|
+
overflow: "xb3r6kr",
|
|
8197
|
+
overflowX: null,
|
|
8198
|
+
overflowY: null,
|
|
8199
|
+
textOverflow: "xlyipyv",
|
|
8186
8200
|
$$css: true
|
|
8187
8201
|
},
|
|
8188
8202
|
sublabel: {
|
|
8189
8203
|
flexGrow: "x1iyjqo2",
|
|
8190
8204
|
color: "x12ohj93",
|
|
8205
|
+
overflow: "xb3r6kr",
|
|
8206
|
+
overflowX: null,
|
|
8207
|
+
overflowY: null,
|
|
8208
|
+
textOverflow: "xlyipyv",
|
|
8191
8209
|
$$css: true
|
|
8192
8210
|
}
|
|
8193
8211
|
};
|
|
@@ -25879,6 +25897,46 @@ function ClearButton({
|
|
|
25879
25897
|
onClick
|
|
25880
25898
|
});
|
|
25881
25899
|
}
|
|
25900
|
+
function sortFieldInfoOrder(field) {
|
|
25901
|
+
if (field.kind === "join") {
|
|
25902
|
+
return 3;
|
|
25903
|
+
} else if (field.kind === "view") {
|
|
25904
|
+
return 2;
|
|
25905
|
+
} else if (field.kind === "dimension") {
|
|
25906
|
+
return 1;
|
|
25907
|
+
} else {
|
|
25908
|
+
return 0;
|
|
25909
|
+
}
|
|
25910
|
+
}
|
|
25911
|
+
function sortFieldInfos(fields) {
|
|
25912
|
+
return fields.sort((a, b2) => {
|
|
25913
|
+
const orderA = sortFieldInfoOrder(a);
|
|
25914
|
+
const orderB = sortFieldInfoOrder(b2);
|
|
25915
|
+
return orderA === orderB ? a.name.localeCompare(b2.name) : orderB - orderA;
|
|
25916
|
+
});
|
|
25917
|
+
}
|
|
25918
|
+
const INDEX_FIELDS = ["fieldName", "fieldPath", "fieldValue", "fieldType", "fieldRange", "weight"];
|
|
25919
|
+
function isIndexView(field) {
|
|
25920
|
+
const allFields = /* @__PURE__ */ new Set([...INDEX_FIELDS, ...field.schema.fields.map((field2) => field2.name)]);
|
|
25921
|
+
return allFields.size === INDEX_FIELDS.length;
|
|
25922
|
+
}
|
|
25923
|
+
function getViewDefinition(parent) {
|
|
25924
|
+
return parent instanceof ASTArrowQueryDefinition ? parent.view : parent.definition;
|
|
25925
|
+
}
|
|
25926
|
+
function getInputSchemaFromViewParent(parent) {
|
|
25927
|
+
const definition = getViewDefinition(parent);
|
|
25928
|
+
return definition.getInputSchema();
|
|
25929
|
+
}
|
|
25930
|
+
function viewParentHasField(parent, field, path) {
|
|
25931
|
+
const definition = getViewDefinition(parent);
|
|
25932
|
+
if (definition instanceof ASTSegmentViewDefinition) {
|
|
25933
|
+
return definition.hasField(field.name, path);
|
|
25934
|
+
}
|
|
25935
|
+
return false;
|
|
25936
|
+
}
|
|
25937
|
+
function viewParentDoesNotHaveField(parent, field, path) {
|
|
25938
|
+
return !viewParentHasField(parent, field, path);
|
|
25939
|
+
}
|
|
25882
25940
|
function segmentHasLimit(segment) {
|
|
25883
25941
|
return segment.operations.items.find((operation) => operation instanceof ASTLimitViewOperation) !== void 0;
|
|
25884
25942
|
}
|
|
@@ -25904,11 +25962,21 @@ function segmentNestNo(segment, name) {
|
|
|
25904
25962
|
function addGroupBy(rootQuery, segment, field, path, setQuery) {
|
|
25905
25963
|
segment.addGroupBy(field.name, path);
|
|
25906
25964
|
if (!segmentHasLimit(segment)) {
|
|
25907
|
-
segment.setLimit(
|
|
25965
|
+
segment.setLimit(1e3);
|
|
25908
25966
|
}
|
|
25909
|
-
segment.addOrderBy(field.name);
|
|
25910
25967
|
setQuery == null ? void 0 : setQuery(rootQuery.build());
|
|
25911
25968
|
}
|
|
25969
|
+
function getSegmentIfPresent(parent) {
|
|
25970
|
+
const definition = getViewDefinition(parent);
|
|
25971
|
+
if (definition instanceof ASTSegmentViewDefinition) {
|
|
25972
|
+
return definition;
|
|
25973
|
+
} else if (definition instanceof ASTRefinementViewDefinition) {
|
|
25974
|
+
if (definition.refinement instanceof ASTSegmentViewDefinition) {
|
|
25975
|
+
return definition.refinement;
|
|
25976
|
+
}
|
|
25977
|
+
}
|
|
25978
|
+
return void 0;
|
|
25979
|
+
}
|
|
25912
25980
|
const addMenuStyles = {
|
|
25913
25981
|
content: {
|
|
25914
25982
|
background: "x82tljd",
|
|
@@ -25999,29 +26067,6 @@ const addMenuStyles = {
|
|
|
25999
26067
|
$$css: true
|
|
26000
26068
|
}
|
|
26001
26069
|
};
|
|
26002
|
-
function sortFieldInfoOrder(field) {
|
|
26003
|
-
if (field.kind === "join") {
|
|
26004
|
-
return 3;
|
|
26005
|
-
} else if (field.kind === "view") {
|
|
26006
|
-
return 2;
|
|
26007
|
-
} else if (field.kind === "dimension") {
|
|
26008
|
-
return 1;
|
|
26009
|
-
} else {
|
|
26010
|
-
return 0;
|
|
26011
|
-
}
|
|
26012
|
-
}
|
|
26013
|
-
function sortFieldInfos(fields) {
|
|
26014
|
-
return fields.sort((a, b2) => {
|
|
26015
|
-
const orderA = sortFieldInfoOrder(a);
|
|
26016
|
-
const orderB = sortFieldInfoOrder(b2);
|
|
26017
|
-
return orderA === orderB ? a.name.localeCompare(b2.name) : orderB - orderA;
|
|
26018
|
-
});
|
|
26019
|
-
}
|
|
26020
|
-
const INDEX_FIELDS = ["fieldName", "fieldPath", "fieldValue", "fieldType", "fieldRange", "weight"];
|
|
26021
|
-
function isIndexView(field) {
|
|
26022
|
-
const allFields = /* @__PURE__ */ new Set([...INDEX_FIELDS, ...field.schema.fields.map((field2) => field2.name)]);
|
|
26023
|
-
return allFields.size === INDEX_FIELDS.length;
|
|
26024
|
-
}
|
|
26025
26070
|
function atomicTypeToIcon(type) {
|
|
26026
26071
|
return atomicTypeMap[type];
|
|
26027
26072
|
}
|
|
@@ -26463,7 +26508,7 @@ const styles$d = {
|
|
|
26463
26508
|
}
|
|
26464
26509
|
};
|
|
26465
26510
|
function FieldList({
|
|
26466
|
-
|
|
26511
|
+
view,
|
|
26467
26512
|
fields,
|
|
26468
26513
|
onClick,
|
|
26469
26514
|
search,
|
|
@@ -26473,7 +26518,7 @@ function FieldList({
|
|
|
26473
26518
|
const groups = useMemo(() => {
|
|
26474
26519
|
const groups2 = [];
|
|
26475
26520
|
const buildGroups = (types22, path, name, fields2) => {
|
|
26476
|
-
const filteredFields = sortFieldInfos(fields2).filter((field) => field.kind !== "join").filter((field) => field.name.includes(search) && types22.includes(field.kind)).filter((field) => filter ? filter(
|
|
26521
|
+
const filteredFields = sortFieldInfos(fields2).filter((field) => field.kind !== "join").filter((field) => field.name.includes(search) && types22.includes(field.kind)).filter((field) => filter ? filter(view, field, path) : true);
|
|
26477
26522
|
const joins = fields2.filter((field) => field.kind === "join");
|
|
26478
26523
|
if (filteredFields.length) {
|
|
26479
26524
|
groups2.push({
|
|
@@ -26494,7 +26539,7 @@ function FieldList({
|
|
|
26494
26539
|
};
|
|
26495
26540
|
buildGroups(types2, [], "Source", fields);
|
|
26496
26541
|
return groups2;
|
|
26497
|
-
}, [fields, filter, search,
|
|
26542
|
+
}, [fields, filter, search, view, types2]);
|
|
26498
26543
|
return /* @__PURE__ */ jsx("div", {
|
|
26499
26544
|
children: groups.length ? groups.map((group) => /* @__PURE__ */ jsxs("div", {
|
|
26500
26545
|
children: [/* @__PURE__ */ jsx("div", {
|
|
@@ -26517,7 +26562,8 @@ function FieldList({
|
|
|
26517
26562
|
tooltipProps: {
|
|
26518
26563
|
side: "right",
|
|
26519
26564
|
align: "start",
|
|
26520
|
-
sideOffset: 4
|
|
26565
|
+
sideOffset: 4,
|
|
26566
|
+
alignOffset: 24
|
|
26521
26567
|
}
|
|
26522
26568
|
})
|
|
26523
26569
|
}, group.name + ":" + field.name))]
|
|
@@ -26537,7 +26583,7 @@ const styles$c = {
|
|
|
26537
26583
|
}
|
|
26538
26584
|
};
|
|
26539
26585
|
function FieldMenu({
|
|
26540
|
-
|
|
26586
|
+
view,
|
|
26541
26587
|
fields,
|
|
26542
26588
|
types: types2,
|
|
26543
26589
|
filter,
|
|
@@ -26562,7 +26608,7 @@ function FieldMenu({
|
|
|
26562
26608
|
flex: 1
|
|
26563
26609
|
},
|
|
26564
26610
|
children: /* @__PURE__ */ jsx(FieldList, {
|
|
26565
|
-
|
|
26611
|
+
view,
|
|
26566
26612
|
fields,
|
|
26567
26613
|
search,
|
|
26568
26614
|
types: types2,
|
|
@@ -26574,7 +26620,7 @@ function FieldMenu({
|
|
|
26574
26620
|
}
|
|
26575
26621
|
function OperationActionTitle({
|
|
26576
26622
|
actionTitle,
|
|
26577
|
-
|
|
26623
|
+
view,
|
|
26578
26624
|
fields,
|
|
26579
26625
|
title,
|
|
26580
26626
|
types: types2,
|
|
@@ -26601,10 +26647,10 @@ function OperationActionTitle({
|
|
|
26601
26647
|
align: "start",
|
|
26602
26648
|
alignOffset: -16,
|
|
26603
26649
|
children: /* @__PURE__ */ jsx(FieldMenu, {
|
|
26604
|
-
|
|
26650
|
+
view,
|
|
26605
26651
|
fields,
|
|
26606
26652
|
types: types2,
|
|
26607
|
-
filter:
|
|
26653
|
+
filter: viewParentDoesNotHaveField,
|
|
26608
26654
|
onClick
|
|
26609
26655
|
})
|
|
26610
26656
|
})
|
|
@@ -26638,7 +26684,7 @@ function FieldHover({
|
|
|
26638
26684
|
}
|
|
26639
26685
|
function GroupByOperations({
|
|
26640
26686
|
rootQuery,
|
|
26641
|
-
|
|
26687
|
+
view,
|
|
26642
26688
|
groupBys
|
|
26643
26689
|
}) {
|
|
26644
26690
|
const {
|
|
@@ -26649,16 +26695,17 @@ function GroupByOperations({
|
|
|
26649
26695
|
}
|
|
26650
26696
|
const {
|
|
26651
26697
|
fields
|
|
26652
|
-
} =
|
|
26698
|
+
} = getInputSchemaFromViewParent(view);
|
|
26653
26699
|
return /* @__PURE__ */ jsxs("div", {
|
|
26654
26700
|
children: [/* @__PURE__ */ jsx(OperationActionTitle, {
|
|
26655
26701
|
title: "group by",
|
|
26656
26702
|
actionTitle: "Add group by",
|
|
26657
26703
|
rootQuery,
|
|
26658
|
-
|
|
26704
|
+
view,
|
|
26659
26705
|
fields,
|
|
26660
26706
|
types: ["dimension"],
|
|
26661
26707
|
onClick: (field, path) => {
|
|
26708
|
+
const segment = view.getOrAddDefaultSegment();
|
|
26662
26709
|
addGroupBy(rootQuery, segment, field, path, setQuery);
|
|
26663
26710
|
}
|
|
26664
26711
|
}), /* @__PURE__ */ jsx("div", {
|
|
@@ -27835,6 +27882,28 @@ function dateTimeFilterChangeType(filter, type) {
|
|
|
27835
27882
|
return filter;
|
|
27836
27883
|
}
|
|
27837
27884
|
}
|
|
27885
|
+
class ErrorElement extends React.Component {
|
|
27886
|
+
constructor(props2) {
|
|
27887
|
+
super(props2);
|
|
27888
|
+
this.state = {
|
|
27889
|
+
hasError: false
|
|
27890
|
+
};
|
|
27891
|
+
}
|
|
27892
|
+
static getDerivedStateFromError(_error) {
|
|
27893
|
+
return {
|
|
27894
|
+
hasError: true
|
|
27895
|
+
};
|
|
27896
|
+
}
|
|
27897
|
+
componentDidCatch(error, info) {
|
|
27898
|
+
console.error(error, info);
|
|
27899
|
+
}
|
|
27900
|
+
render() {
|
|
27901
|
+
if (this.state.hasError) {
|
|
27902
|
+
return this.props.fallback;
|
|
27903
|
+
}
|
|
27904
|
+
return this.props.children;
|
|
27905
|
+
}
|
|
27906
|
+
}
|
|
27838
27907
|
function WhereOperations({
|
|
27839
27908
|
rootQuery,
|
|
27840
27909
|
wheres
|
|
@@ -27852,117 +27921,139 @@ function WhereOperations({
|
|
|
27852
27921
|
}), /* @__PURE__ */ jsx("div", {
|
|
27853
27922
|
..._stylex.props(styles$h.tokenContainer),
|
|
27854
27923
|
children: wheres.map((where, key2) => {
|
|
27855
|
-
|
|
27856
|
-
|
|
27857
|
-
|
|
27858
|
-
} = where.filter;
|
|
27859
|
-
const fieldInfo = fieldReference.getFieldInfo();
|
|
27860
|
-
if (fieldInfo.kind !== "dimension" && fieldInfo.kind !== "measure") {
|
|
27861
|
-
return null;
|
|
27862
|
-
}
|
|
27863
|
-
const icon = atomicTypeToIcon(fieldInfo.type.kind);
|
|
27864
|
-
const color = fieldKindToColor(fieldInfo.kind);
|
|
27865
|
-
const filter = where.filter.getFilter();
|
|
27866
|
-
let rhsToken = null;
|
|
27867
|
-
if (filter.kind === "string") {
|
|
27868
|
-
rhsToken = /* @__PURE__ */ jsx(StringFilterToken, {
|
|
27869
|
-
fieldInfo,
|
|
27870
|
-
path: where.filter.fieldReference.path ?? [],
|
|
27871
|
-
filter: filter.parsed,
|
|
27872
|
-
setFilter: (filter2) => {
|
|
27873
|
-
where.filter.setFilter({
|
|
27874
|
-
kind: "string",
|
|
27875
|
-
parsed: filter2
|
|
27876
|
-
});
|
|
27877
|
-
setQuery == null ? void 0 : setQuery(rootQuery.build());
|
|
27878
|
-
}
|
|
27879
|
-
}, key2);
|
|
27880
|
-
}
|
|
27881
|
-
if (filter.kind === "boolean" && filter.parsed) {
|
|
27882
|
-
rhsToken = /* @__PURE__ */ jsx(BooleanFilterToken, {
|
|
27883
|
-
fieldInfo,
|
|
27884
|
-
filter: filter.parsed,
|
|
27885
|
-
setFilter: (filter2) => {
|
|
27886
|
-
where.filter.setFilter({
|
|
27887
|
-
kind: "boolean",
|
|
27888
|
-
parsed: filter2
|
|
27889
|
-
});
|
|
27890
|
-
setQuery == null ? void 0 : setQuery(rootQuery.build());
|
|
27891
|
-
}
|
|
27892
|
-
}, key2);
|
|
27893
|
-
}
|
|
27894
|
-
if (filter.kind === "number" && filter.parsed) {
|
|
27895
|
-
rhsToken = /* @__PURE__ */ jsx(NumberFilterToken, {
|
|
27896
|
-
fieldInfo,
|
|
27897
|
-
filter: filter.parsed,
|
|
27898
|
-
setFilter: (filter2) => {
|
|
27899
|
-
where.filter.setFilter({
|
|
27900
|
-
kind: "number",
|
|
27901
|
-
parsed: filter2
|
|
27902
|
-
});
|
|
27903
|
-
setQuery == null ? void 0 : setQuery(rootQuery.build());
|
|
27904
|
-
}
|
|
27905
|
-
}, key2);
|
|
27906
|
-
}
|
|
27907
|
-
if (filter.kind === "date" && filter.parsed) {
|
|
27908
|
-
rhsToken = /* @__PURE__ */ jsx(DateTimeFilterToken, {
|
|
27909
|
-
fieldInfo,
|
|
27910
|
-
filter: filter.parsed,
|
|
27911
|
-
setFilter: (filter2) => {
|
|
27912
|
-
where.filter.setFilter({
|
|
27913
|
-
kind: "date",
|
|
27914
|
-
parsed: filter2
|
|
27915
|
-
});
|
|
27916
|
-
setQuery == null ? void 0 : setQuery(rootQuery.build());
|
|
27917
|
-
}
|
|
27918
|
-
}, key2);
|
|
27919
|
-
}
|
|
27920
|
-
if (filter.kind === "timestamp" && filter.parsed) {
|
|
27921
|
-
rhsToken = /* @__PURE__ */ jsx(DateTimeFilterToken, {
|
|
27922
|
-
fieldInfo,
|
|
27923
|
-
filter: filter.parsed,
|
|
27924
|
-
setFilter: (filter2) => {
|
|
27925
|
-
where.filter.setFilter({
|
|
27926
|
-
kind: "timestamp",
|
|
27927
|
-
parsed: filter2
|
|
27928
|
-
});
|
|
27929
|
-
setQuery == null ? void 0 : setQuery(rootQuery.build());
|
|
27930
|
-
}
|
|
27931
|
-
}, key2);
|
|
27932
|
-
}
|
|
27933
|
-
const {
|
|
27934
|
-
op,
|
|
27935
|
-
value
|
|
27936
|
-
} = parsedToLabels(filter, filterString);
|
|
27937
|
-
if (!rhsToken) {
|
|
27938
|
-
rhsToken = /* @__PURE__ */ jsxs(TokenGroup, {
|
|
27939
|
-
color,
|
|
27940
|
-
children: [/* @__PURE__ */ jsx(Token, {
|
|
27941
|
-
icon,
|
|
27942
|
-
label: fieldInfo.name
|
|
27943
|
-
}), /* @__PURE__ */ jsx(Token, {
|
|
27944
|
-
label: op
|
|
27945
|
-
}), /* @__PURE__ */ jsx(Token, {
|
|
27946
|
-
label: value
|
|
27947
|
-
})]
|
|
27948
|
-
});
|
|
27949
|
-
}
|
|
27950
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
27951
|
-
..._stylex.props(hoverStyles.main),
|
|
27952
|
-
children: [rhsToken, /* @__PURE__ */ jsx("div", {
|
|
27953
|
-
..._stylex.props(hoverStyles.hoverActions),
|
|
27954
|
-
children: /* @__PURE__ */ jsx(ClearButton, {
|
|
27924
|
+
return /* @__PURE__ */ jsx(ErrorElement, {
|
|
27925
|
+
fallback: /* @__PURE__ */ jsxs("div", {
|
|
27926
|
+
children: ["Invalid filter", /* @__PURE__ */ jsx(ClearButton, {
|
|
27955
27927
|
onClick: () => {
|
|
27956
27928
|
where.delete();
|
|
27957
27929
|
setQuery == null ? void 0 : setQuery(rootQuery.build());
|
|
27958
27930
|
}
|
|
27959
|
-
})
|
|
27960
|
-
})
|
|
27931
|
+
})]
|
|
27932
|
+
}),
|
|
27933
|
+
children: /* @__PURE__ */ jsx(SingleWhereOperation, {
|
|
27934
|
+
where,
|
|
27935
|
+
rootQuery
|
|
27936
|
+
})
|
|
27961
27937
|
}, key2);
|
|
27962
27938
|
})
|
|
27963
27939
|
})]
|
|
27964
27940
|
});
|
|
27965
27941
|
}
|
|
27942
|
+
function SingleWhereOperation({
|
|
27943
|
+
rootQuery,
|
|
27944
|
+
where
|
|
27945
|
+
}) {
|
|
27946
|
+
const {
|
|
27947
|
+
fieldReference,
|
|
27948
|
+
filterString
|
|
27949
|
+
} = where.filter;
|
|
27950
|
+
const fieldInfo = fieldReference.getFieldInfo();
|
|
27951
|
+
const {
|
|
27952
|
+
setQuery
|
|
27953
|
+
} = useContext(QueryEditorContext);
|
|
27954
|
+
if (fieldInfo.kind !== "dimension" && fieldInfo.kind !== "measure") {
|
|
27955
|
+
return null;
|
|
27956
|
+
}
|
|
27957
|
+
const icon = atomicTypeToIcon(fieldInfo.type.kind);
|
|
27958
|
+
const color = fieldKindToColor(fieldInfo.kind);
|
|
27959
|
+
const filter = where.filter.getFilter();
|
|
27960
|
+
let rhsToken = null;
|
|
27961
|
+
if (filter.kind === "string") {
|
|
27962
|
+
rhsToken = /* @__PURE__ */ jsx(StringFilterToken, {
|
|
27963
|
+
fieldInfo,
|
|
27964
|
+
path: where.filter.fieldReference.path ?? [],
|
|
27965
|
+
filter: filter.parsed,
|
|
27966
|
+
setFilter: (filter2) => {
|
|
27967
|
+
where.filter.setFilter({
|
|
27968
|
+
kind: "string",
|
|
27969
|
+
parsed: filter2
|
|
27970
|
+
});
|
|
27971
|
+
setQuery == null ? void 0 : setQuery(rootQuery.build());
|
|
27972
|
+
}
|
|
27973
|
+
});
|
|
27974
|
+
}
|
|
27975
|
+
if (filter.kind === "boolean" && filter.parsed) {
|
|
27976
|
+
rhsToken = /* @__PURE__ */ jsx(BooleanFilterToken, {
|
|
27977
|
+
fieldInfo,
|
|
27978
|
+
filter: filter.parsed,
|
|
27979
|
+
setFilter: (filter2) => {
|
|
27980
|
+
where.filter.setFilter({
|
|
27981
|
+
kind: "boolean",
|
|
27982
|
+
parsed: filter2
|
|
27983
|
+
});
|
|
27984
|
+
setQuery == null ? void 0 : setQuery(rootQuery.build());
|
|
27985
|
+
}
|
|
27986
|
+
});
|
|
27987
|
+
}
|
|
27988
|
+
if (filter.kind === "number" && filter.parsed) {
|
|
27989
|
+
rhsToken = /* @__PURE__ */ jsx(NumberFilterToken, {
|
|
27990
|
+
fieldInfo,
|
|
27991
|
+
filter: filter.parsed,
|
|
27992
|
+
setFilter: (filter2) => {
|
|
27993
|
+
where.filter.setFilter({
|
|
27994
|
+
kind: "number",
|
|
27995
|
+
parsed: filter2
|
|
27996
|
+
});
|
|
27997
|
+
setQuery == null ? void 0 : setQuery(rootQuery.build());
|
|
27998
|
+
}
|
|
27999
|
+
});
|
|
28000
|
+
}
|
|
28001
|
+
if (filter.kind === "date" && filter.parsed) {
|
|
28002
|
+
rhsToken = /* @__PURE__ */ jsx(DateTimeFilterToken, {
|
|
28003
|
+
fieldInfo,
|
|
28004
|
+
filter: filter.parsed,
|
|
28005
|
+
setFilter: (filter2) => {
|
|
28006
|
+
where.filter.setFilter({
|
|
28007
|
+
kind: "date",
|
|
28008
|
+
parsed: filter2
|
|
28009
|
+
});
|
|
28010
|
+
setQuery == null ? void 0 : setQuery(rootQuery.build());
|
|
28011
|
+
}
|
|
28012
|
+
});
|
|
28013
|
+
}
|
|
28014
|
+
if (filter.kind === "timestamp" && filter.parsed) {
|
|
28015
|
+
rhsToken = /* @__PURE__ */ jsx(DateTimeFilterToken, {
|
|
28016
|
+
fieldInfo,
|
|
28017
|
+
filter: filter.parsed,
|
|
28018
|
+
setFilter: (filter2) => {
|
|
28019
|
+
where.filter.setFilter({
|
|
28020
|
+
kind: "timestamp",
|
|
28021
|
+
parsed: filter2
|
|
28022
|
+
});
|
|
28023
|
+
setQuery == null ? void 0 : setQuery(rootQuery.build());
|
|
28024
|
+
}
|
|
28025
|
+
});
|
|
28026
|
+
}
|
|
28027
|
+
const {
|
|
28028
|
+
op,
|
|
28029
|
+
value
|
|
28030
|
+
} = parsedToLabels(filter, filterString);
|
|
28031
|
+
if (!rhsToken) {
|
|
28032
|
+
rhsToken = /* @__PURE__ */ jsxs(TokenGroup, {
|
|
28033
|
+
color,
|
|
28034
|
+
children: [/* @__PURE__ */ jsx(Token, {
|
|
28035
|
+
icon,
|
|
28036
|
+
label: fieldInfo.name
|
|
28037
|
+
}), /* @__PURE__ */ jsx(Token, {
|
|
28038
|
+
label: op
|
|
28039
|
+
}), /* @__PURE__ */ jsx(Token, {
|
|
28040
|
+
label: value
|
|
28041
|
+
})]
|
|
28042
|
+
});
|
|
28043
|
+
}
|
|
28044
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
28045
|
+
..._stylex.props(hoverStyles.main),
|
|
28046
|
+
children: [rhsToken, /* @__PURE__ */ jsx("div", {
|
|
28047
|
+
..._stylex.props(hoverStyles.hoverActions),
|
|
28048
|
+
children: /* @__PURE__ */ jsx(ClearButton, {
|
|
28049
|
+
onClick: () => {
|
|
28050
|
+
where.delete();
|
|
28051
|
+
setQuery == null ? void 0 : setQuery(rootQuery.build());
|
|
28052
|
+
}
|
|
28053
|
+
})
|
|
28054
|
+
})]
|
|
28055
|
+
});
|
|
28056
|
+
}
|
|
27966
28057
|
const parsedToLabels = (parsed, filterString) => {
|
|
27967
28058
|
if (parsed.parsed === null) {
|
|
27968
28059
|
return {
|
|
@@ -28169,7 +28260,7 @@ function LimitOperation({
|
|
|
28169
28260
|
}
|
|
28170
28261
|
function AggregateOperations({
|
|
28171
28262
|
rootQuery,
|
|
28172
|
-
|
|
28263
|
+
view,
|
|
28173
28264
|
aggregates
|
|
28174
28265
|
}) {
|
|
28175
28266
|
const {
|
|
@@ -28180,16 +28271,17 @@ function AggregateOperations({
|
|
|
28180
28271
|
}
|
|
28181
28272
|
const {
|
|
28182
28273
|
fields
|
|
28183
|
-
} =
|
|
28274
|
+
} = getInputSchemaFromViewParent(view);
|
|
28184
28275
|
return /* @__PURE__ */ jsxs("div", {
|
|
28185
28276
|
children: [/* @__PURE__ */ jsx(OperationActionTitle, {
|
|
28186
28277
|
title: "aggregate",
|
|
28187
28278
|
actionTitle: "Add aggregate",
|
|
28188
28279
|
rootQuery,
|
|
28189
|
-
|
|
28280
|
+
view,
|
|
28190
28281
|
fields,
|
|
28191
28282
|
types: ["measure"],
|
|
28192
28283
|
onClick: (field, path) => {
|
|
28284
|
+
const segment = view.getOrAddDefaultSegment();
|
|
28193
28285
|
segment.addAggregate(field.name, path);
|
|
28194
28286
|
setQuery == null ? void 0 : setQuery(rootQuery.build());
|
|
28195
28287
|
}
|
|
@@ -28300,6 +28392,7 @@ function View({
|
|
|
28300
28392
|
view
|
|
28301
28393
|
}), /* @__PURE__ */ jsx(ViewDefinition, {
|
|
28302
28394
|
rootQuery,
|
|
28395
|
+
view,
|
|
28303
28396
|
viewDef: view.definition
|
|
28304
28397
|
})]
|
|
28305
28398
|
});
|
|
@@ -28404,12 +28497,13 @@ function AddItem({
|
|
|
28404
28497
|
}
|
|
28405
28498
|
function AddLimit({
|
|
28406
28499
|
rootQuery,
|
|
28407
|
-
|
|
28500
|
+
view
|
|
28408
28501
|
}) {
|
|
28409
28502
|
const {
|
|
28410
28503
|
setQuery
|
|
28411
28504
|
} = useContext(QueryEditorContext);
|
|
28412
|
-
const
|
|
28505
|
+
const segment = getSegmentIfPresent(view);
|
|
28506
|
+
const hasLimit = segment ? segmentHasLimit(segment) : false;
|
|
28413
28507
|
return /* @__PURE__ */ jsx(AddItem, {
|
|
28414
28508
|
icon: /* @__PURE__ */ jsx(Icon, {
|
|
28415
28509
|
name: "limit"
|
|
@@ -28417,32 +28511,34 @@ function AddLimit({
|
|
|
28417
28511
|
label: "Limit",
|
|
28418
28512
|
disable: () => hasLimit,
|
|
28419
28513
|
onClick: () => {
|
|
28420
|
-
|
|
28514
|
+
const segment2 = view.getOrAddDefaultSegment();
|
|
28515
|
+
segment2.setLimit(10);
|
|
28421
28516
|
setQuery == null ? void 0 : setQuery(rootQuery.build());
|
|
28422
28517
|
}
|
|
28423
28518
|
});
|
|
28424
28519
|
}
|
|
28425
28520
|
function AddEmptyNest({
|
|
28426
28521
|
rootQuery,
|
|
28427
|
-
|
|
28522
|
+
view
|
|
28428
28523
|
}) {
|
|
28429
28524
|
const {
|
|
28430
28525
|
setQuery
|
|
28431
28526
|
} = useContext(QueryEditorContext);
|
|
28432
|
-
const nestNo = segmentNestNo(segment, `Nest`);
|
|
28433
28527
|
return /* @__PURE__ */ jsx(AddItem, {
|
|
28434
28528
|
icon: /* @__PURE__ */ jsx(Icon, {
|
|
28435
28529
|
name: "nest"
|
|
28436
28530
|
}),
|
|
28437
28531
|
label: "Add blank nested query",
|
|
28438
28532
|
onClick: () => {
|
|
28533
|
+
const segment = view.getOrAddDefaultSegment();
|
|
28534
|
+
const nestNo = segmentNestNo(segment, `Nest`);
|
|
28439
28535
|
segment.addEmptyNest(nestNo > 1 ? `Nest ${nestNo}` : `Nest`);
|
|
28440
28536
|
setQuery == null ? void 0 : setQuery(rootQuery.build());
|
|
28441
28537
|
}
|
|
28442
28538
|
});
|
|
28443
28539
|
}
|
|
28444
28540
|
function AddFieldItem({
|
|
28445
|
-
|
|
28541
|
+
view,
|
|
28446
28542
|
fields,
|
|
28447
28543
|
icon,
|
|
28448
28544
|
label,
|
|
@@ -28504,7 +28600,7 @@ function AddFieldItem({
|
|
|
28504
28600
|
}), /* @__PURE__ */ jsx(FieldMenu, {
|
|
28505
28601
|
types: types2,
|
|
28506
28602
|
filter,
|
|
28507
|
-
|
|
28603
|
+
view,
|
|
28508
28604
|
fields,
|
|
28509
28605
|
onClick
|
|
28510
28606
|
})]
|
|
@@ -28514,21 +28610,23 @@ function AddFieldItem({
|
|
|
28514
28610
|
}
|
|
28515
28611
|
function AddOrderBy({
|
|
28516
28612
|
rootQuery,
|
|
28517
|
-
|
|
28613
|
+
view
|
|
28518
28614
|
}) {
|
|
28519
28615
|
const {
|
|
28520
28616
|
setQuery
|
|
28521
28617
|
} = useContext(QueryEditorContext);
|
|
28522
|
-
const outputSchemaFields =
|
|
28523
|
-
const
|
|
28618
|
+
const outputSchemaFields = view.getOutputSchema().fields;
|
|
28619
|
+
const segment = getSegmentIfPresent(view);
|
|
28620
|
+
const fields = useMemo(() => outputSchemaFields.filter((field) => field.kind === "dimension").filter((field) => ORDERABLE_TYPES$1.includes(field.type.kind)).filter((field) => segment ? !segmentHasOrderBy(segment, field.name) : true), [outputSchemaFields, segment]);
|
|
28524
28621
|
return /* @__PURE__ */ jsx(AddFieldItem, {
|
|
28525
28622
|
label: "Add order by",
|
|
28526
28623
|
icon: "orderBy",
|
|
28527
|
-
|
|
28624
|
+
view,
|
|
28528
28625
|
fields,
|
|
28529
28626
|
types: ["dimension"],
|
|
28530
28627
|
onClick: (field) => {
|
|
28531
|
-
|
|
28628
|
+
const segment2 = view.getOrAddDefaultSegment();
|
|
28629
|
+
segment2.addOrderBy(field.name, "asc");
|
|
28532
28630
|
setQuery == null ? void 0 : setQuery(rootQuery.build());
|
|
28533
28631
|
},
|
|
28534
28632
|
disabledMessage: "There must be at least one field in the output to order by."
|
|
@@ -28537,44 +28635,46 @@ function AddOrderBy({
|
|
|
28537
28635
|
const ORDERABLE_TYPES$1 = ["string_type", "number_type", "boolean_type", "date_type", "timestamp_type"];
|
|
28538
28636
|
function AddGroupBy({
|
|
28539
28637
|
rootQuery,
|
|
28540
|
-
|
|
28638
|
+
view
|
|
28541
28639
|
}) {
|
|
28542
28640
|
const {
|
|
28543
28641
|
setQuery
|
|
28544
28642
|
} = useContext(QueryEditorContext);
|
|
28545
28643
|
const {
|
|
28546
28644
|
fields
|
|
28547
|
-
} =
|
|
28645
|
+
} = getInputSchemaFromViewParent(view);
|
|
28548
28646
|
return /* @__PURE__ */ jsx(AddFieldItem, {
|
|
28549
28647
|
label: "Add group by",
|
|
28550
28648
|
icon: "groupBy",
|
|
28551
|
-
|
|
28649
|
+
view,
|
|
28552
28650
|
fields,
|
|
28553
28651
|
types: ["dimension"],
|
|
28554
|
-
filter:
|
|
28652
|
+
filter: viewParentDoesNotHaveField,
|
|
28555
28653
|
onClick: (field, path) => {
|
|
28654
|
+
const segment = view.getOrAddDefaultSegment();
|
|
28556
28655
|
addGroupBy(rootQuery, segment, field, path, setQuery);
|
|
28557
28656
|
}
|
|
28558
28657
|
});
|
|
28559
28658
|
}
|
|
28560
28659
|
function AddAggregate({
|
|
28561
28660
|
rootQuery,
|
|
28562
|
-
|
|
28661
|
+
view
|
|
28563
28662
|
}) {
|
|
28564
28663
|
const {
|
|
28565
28664
|
setQuery
|
|
28566
28665
|
} = useContext(QueryEditorContext);
|
|
28567
28666
|
const {
|
|
28568
28667
|
fields
|
|
28569
|
-
} =
|
|
28668
|
+
} = getInputSchemaFromViewParent(view);
|
|
28570
28669
|
return /* @__PURE__ */ jsx(AddFieldItem, {
|
|
28571
28670
|
label: "Add aggregate",
|
|
28572
28671
|
icon: "aggregate",
|
|
28573
|
-
|
|
28672
|
+
view,
|
|
28574
28673
|
fields,
|
|
28575
28674
|
types: ["measure"],
|
|
28576
|
-
filter:
|
|
28675
|
+
filter: viewParentDoesNotHaveField,
|
|
28577
28676
|
onClick: (field, path) => {
|
|
28677
|
+
const segment = view.getOrAddDefaultSegment();
|
|
28578
28678
|
segment.addAggregate(field.name, path);
|
|
28579
28679
|
setQuery == null ? void 0 : setQuery(rootQuery.build());
|
|
28580
28680
|
}
|
|
@@ -28582,22 +28682,23 @@ function AddAggregate({
|
|
|
28582
28682
|
}
|
|
28583
28683
|
function AddWhere({
|
|
28584
28684
|
rootQuery,
|
|
28585
|
-
|
|
28685
|
+
view
|
|
28586
28686
|
}) {
|
|
28587
28687
|
const {
|
|
28588
28688
|
setQuery
|
|
28589
28689
|
} = useContext(QueryEditorContext);
|
|
28590
28690
|
const {
|
|
28591
28691
|
fields
|
|
28592
|
-
} =
|
|
28692
|
+
} = getInputSchemaFromViewParent(view);
|
|
28593
28693
|
return /* @__PURE__ */ jsx(AddFieldItem, {
|
|
28594
28694
|
label: "Add filter",
|
|
28595
28695
|
icon: "filter",
|
|
28596
|
-
|
|
28696
|
+
view,
|
|
28597
28697
|
fields,
|
|
28598
28698
|
types: ["measure", "dimension"],
|
|
28599
28699
|
filter: (_segment, field) => (field.kind === "dimension" || field.kind === "measure") && FILTERABLE_TYPES$1.has(field.type.kind),
|
|
28600
28700
|
onClick: (field, path) => {
|
|
28701
|
+
const segment = view.getOrAddDefaultSegment();
|
|
28601
28702
|
if (field.kind === "dimension" || field.kind === "measure") {
|
|
28602
28703
|
if (field.type.kind === "string_type") {
|
|
28603
28704
|
segment.addWhere(field.name, path, "-null");
|
|
@@ -28618,24 +28719,24 @@ function AddWhere({
|
|
|
28618
28719
|
const FILTERABLE_TYPES$1 = /* @__PURE__ */ new Set(["string_type", "boolean_type", "number_type", "date_type", "timestamp_type"]);
|
|
28619
28720
|
function AddView({
|
|
28620
28721
|
rootQuery,
|
|
28621
|
-
view
|
|
28622
|
-
segment
|
|
28722
|
+
view
|
|
28623
28723
|
}) {
|
|
28624
28724
|
const {
|
|
28625
28725
|
setQuery
|
|
28626
28726
|
} = useContext(QueryEditorContext);
|
|
28627
|
-
const allFields =
|
|
28727
|
+
const allFields = getInputSchemaFromViewParent(view).fields;
|
|
28628
28728
|
const fields = useMemo(() => allFields.filter((field) => field.kind === "view" && !isIndexView(field)), [allFields]);
|
|
28629
28729
|
return /* @__PURE__ */ jsx(AddFieldItem, {
|
|
28630
28730
|
label: "Add view",
|
|
28631
28731
|
icon: "view",
|
|
28632
|
-
|
|
28732
|
+
view,
|
|
28633
28733
|
fields,
|
|
28634
28734
|
types: ["view"],
|
|
28635
28735
|
onClick: (field) => {
|
|
28636
|
-
if (
|
|
28736
|
+
if (rootQuery.isEmpty()) {
|
|
28637
28737
|
rootQuery.setView(field.name);
|
|
28638
28738
|
} else {
|
|
28739
|
+
const segment = view.getOrAddDefaultSegment();
|
|
28639
28740
|
const nestNo = segmentNestNo(segment, field.name);
|
|
28640
28741
|
segment.addNest(field.name, nestNo > 1 ? `${field.name} ${nestNo}` : void 0);
|
|
28641
28742
|
}
|
|
@@ -28730,7 +28831,6 @@ function AddMenu({
|
|
|
28730
28831
|
setQuery
|
|
28731
28832
|
} = useContext(QueryEditorContext);
|
|
28732
28833
|
const [search, setSearch] = useState("");
|
|
28733
|
-
const segment = view.getOrAddDefaultSegment();
|
|
28734
28834
|
return /* @__PURE__ */ jsxs(Root2$2, {
|
|
28735
28835
|
open,
|
|
28736
28836
|
onOpenChange: (open2) => {
|
|
@@ -28770,16 +28870,16 @@ function AddMenu({
|
|
|
28770
28870
|
flex: 1
|
|
28771
28871
|
},
|
|
28772
28872
|
children: [/* @__PURE__ */ jsx(FieldList, {
|
|
28773
|
-
|
|
28774
|
-
fields:
|
|
28873
|
+
view,
|
|
28874
|
+
fields: getInputSchemaFromViewParent(view).fields,
|
|
28775
28875
|
types: ["dimension", "measure", "view"],
|
|
28776
28876
|
onClick: function(field, path) {
|
|
28877
|
+
const segment = view.getOrAddDefaultSegment();
|
|
28777
28878
|
if (field.kind === "dimension") {
|
|
28778
28879
|
segment.addGroupBy(field.name, path);
|
|
28779
28880
|
if (!segmentHasLimit(segment)) {
|
|
28780
|
-
segment.setLimit(
|
|
28881
|
+
segment.setLimit(1e3);
|
|
28781
28882
|
}
|
|
28782
|
-
segment.addOrderBy(field.name);
|
|
28783
28883
|
} else if (field.kind === "measure") {
|
|
28784
28884
|
segment.addAggregate(field.name, path);
|
|
28785
28885
|
} else {
|
|
@@ -28794,6 +28894,7 @@ function AddMenu({
|
|
|
28794
28894
|
onClick: (value) => {
|
|
28795
28895
|
const path = value.fieldName.split(".");
|
|
28796
28896
|
const name = path.pop();
|
|
28897
|
+
const segment = view.getOrAddDefaultSegment();
|
|
28797
28898
|
segment.addWhere(name, path, {
|
|
28798
28899
|
kind: "string",
|
|
28799
28900
|
parsed: {
|
|
@@ -28807,26 +28908,25 @@ function AddMenu({
|
|
|
28807
28908
|
}) : /* @__PURE__ */ jsxs(Fragment, {
|
|
28808
28909
|
children: [/* @__PURE__ */ jsx(AddGroupBy, {
|
|
28809
28910
|
rootQuery,
|
|
28810
|
-
|
|
28911
|
+
view
|
|
28811
28912
|
}), /* @__PURE__ */ jsx(AddAggregate, {
|
|
28812
28913
|
rootQuery,
|
|
28813
|
-
|
|
28914
|
+
view
|
|
28814
28915
|
}), /* @__PURE__ */ jsx(AddWhere, {
|
|
28815
28916
|
rootQuery,
|
|
28816
|
-
|
|
28917
|
+
view
|
|
28817
28918
|
}), /* @__PURE__ */ jsx(AddView, {
|
|
28818
28919
|
rootQuery,
|
|
28819
|
-
view
|
|
28820
|
-
segment
|
|
28920
|
+
view
|
|
28821
28921
|
}), /* @__PURE__ */ jsx(Divider, {}), /* @__PURE__ */ jsx(AddLimit, {
|
|
28822
28922
|
rootQuery,
|
|
28823
|
-
|
|
28923
|
+
view
|
|
28824
28924
|
}), /* @__PURE__ */ jsx(AddOrderBy, {
|
|
28825
28925
|
rootQuery,
|
|
28826
|
-
|
|
28926
|
+
view
|
|
28827
28927
|
}), /* @__PURE__ */ jsx(AddEmptyNest, {
|
|
28828
28928
|
rootQuery,
|
|
28829
|
-
|
|
28929
|
+
view
|
|
28830
28930
|
})]
|
|
28831
28931
|
})]
|
|
28832
28932
|
})
|
|
@@ -28898,6 +28998,7 @@ function NestOperations({
|
|
|
28898
28998
|
}
|
|
28899
28999
|
function Operations({
|
|
28900
29000
|
rootQuery,
|
|
29001
|
+
view,
|
|
28901
29002
|
viewDef
|
|
28902
29003
|
}) {
|
|
28903
29004
|
const groupBys = [];
|
|
@@ -28906,7 +29007,10 @@ function Operations({
|
|
|
28906
29007
|
const orderBys = [];
|
|
28907
29008
|
const nests = [];
|
|
28908
29009
|
let limit;
|
|
28909
|
-
|
|
29010
|
+
if (!(viewDef instanceof ASTSegmentViewDefinition)) {
|
|
29011
|
+
return null;
|
|
29012
|
+
}
|
|
29013
|
+
const segment = viewDef;
|
|
28910
29014
|
segment.operations.items.forEach((operation) => {
|
|
28911
29015
|
if (operation instanceof ASTGroupByViewOperation) {
|
|
28912
29016
|
groupBys.push(operation);
|
|
@@ -28928,53 +29032,54 @@ function Operations({
|
|
|
28928
29032
|
},
|
|
28929
29033
|
children: [/* @__PURE__ */ jsx(GroupByOperations, {
|
|
28930
29034
|
rootQuery,
|
|
28931
|
-
|
|
29035
|
+
view,
|
|
28932
29036
|
groupBys
|
|
28933
29037
|
}), /* @__PURE__ */ jsx(AggregateOperations, {
|
|
28934
29038
|
rootQuery,
|
|
28935
|
-
|
|
29039
|
+
view,
|
|
28936
29040
|
aggregates
|
|
28937
29041
|
}), /* @__PURE__ */ jsx(WhereOperations, {
|
|
28938
29042
|
rootQuery,
|
|
28939
|
-
segment,
|
|
28940
29043
|
wheres
|
|
28941
29044
|
}), /* @__PURE__ */ jsx(OrderByOperations, {
|
|
28942
29045
|
rootQuery,
|
|
28943
|
-
segment,
|
|
28944
29046
|
orderBys
|
|
28945
29047
|
}), /* @__PURE__ */ jsx(NestOperations, {
|
|
28946
29048
|
rootQuery,
|
|
28947
|
-
segment,
|
|
28948
29049
|
nests
|
|
28949
29050
|
}), /* @__PURE__ */ jsx(LimitOperation, {
|
|
28950
29051
|
rootQuery,
|
|
28951
|
-
segment,
|
|
28952
29052
|
limit
|
|
28953
29053
|
})]
|
|
28954
29054
|
});
|
|
28955
29055
|
}
|
|
28956
29056
|
function ViewDefinition({
|
|
28957
29057
|
rootQuery,
|
|
29058
|
+
view,
|
|
28958
29059
|
viewDef
|
|
28959
29060
|
}) {
|
|
28960
29061
|
if (viewDef instanceof ASTArrowViewDefinition) {
|
|
28961
29062
|
return /* @__PURE__ */ jsx(ViewDefinition, {
|
|
28962
29063
|
rootQuery,
|
|
29064
|
+
view,
|
|
28963
29065
|
viewDef: viewDef.view
|
|
28964
29066
|
});
|
|
28965
29067
|
} else if (viewDef instanceof ASTRefinementViewDefinition) {
|
|
28966
29068
|
return /* @__PURE__ */ jsxs("div", {
|
|
28967
29069
|
children: [/* @__PURE__ */ jsx(ViewDefinition, {
|
|
28968
29070
|
rootQuery,
|
|
29071
|
+
view,
|
|
28969
29072
|
viewDef: viewDef.base
|
|
28970
29073
|
}), /* @__PURE__ */ jsx(ViewDefinition, {
|
|
28971
29074
|
rootQuery,
|
|
29075
|
+
view,
|
|
28972
29076
|
viewDef: viewDef.refinement
|
|
28973
29077
|
})]
|
|
28974
29078
|
});
|
|
28975
29079
|
} else if (viewDef instanceof ASTSegmentViewDefinition) {
|
|
28976
29080
|
return /* @__PURE__ */ jsx(Operations, {
|
|
28977
29081
|
rootQuery,
|
|
29082
|
+
view,
|
|
28978
29083
|
viewDef
|
|
28979
29084
|
});
|
|
28980
29085
|
} else {
|
|
@@ -29087,10 +29192,10 @@ function Query({
|
|
|
29087
29192
|
},
|
|
29088
29193
|
disabled: rootQuery.isEmpty()
|
|
29089
29194
|
}) : /* @__PURE__ */ jsx(Fragment, {})
|
|
29090
|
-
}), /* @__PURE__ */ jsx(AddMenu, {
|
|
29195
|
+
}), query.definition instanceof ASTArrowQueryDefinition ? /* @__PURE__ */ jsx(AddMenu, {
|
|
29091
29196
|
rootQuery,
|
|
29092
|
-
view: query
|
|
29093
|
-
})]
|
|
29197
|
+
view: query.definition
|
|
29198
|
+
}) : null]
|
|
29094
29199
|
}),
|
|
29095
29200
|
collapsedControls: /* @__PURE__ */ jsx(VisualizationIcon, {
|
|
29096
29201
|
view: query
|
|
@@ -29106,6 +29211,7 @@ function Query({
|
|
|
29106
29211
|
view: query
|
|
29107
29212
|
}), /* @__PURE__ */ jsx(ViewDefinition, {
|
|
29108
29213
|
rootQuery,
|
|
29214
|
+
view: query.definition,
|
|
29109
29215
|
viewDef: query.definition.view
|
|
29110
29216
|
})]
|
|
29111
29217
|
}) : null, query.isEmpty() ? /* @__PURE__ */ jsx("div", {
|
|
@@ -29237,7 +29343,7 @@ function Parameters({
|
|
|
29237
29343
|
title: "Source parameters",
|
|
29238
29344
|
children: /* @__PURE__ */ jsx("div", {
|
|
29239
29345
|
...{
|
|
29240
|
-
className: "x78zum5
|
|
29346
|
+
className: "x78zum5 xdt5ytf x1jnr06f xnm25rq"
|
|
29241
29347
|
},
|
|
29242
29348
|
children: sourceParameters.map((parameter) => {
|
|
29243
29349
|
var _a2;
|
|
@@ -29637,11 +29743,6 @@ function ResponseDisplay({
|
|
|
29637
29743
|
title: "Empty Response",
|
|
29638
29744
|
variant: "critical"
|
|
29639
29745
|
};
|
|
29640
|
-
} else if (!response.result) {
|
|
29641
|
-
bannerProps = {
|
|
29642
|
-
title: "Empty Result",
|
|
29643
|
-
variant: "critical"
|
|
29644
|
-
};
|
|
29645
29746
|
} else if (response.error && !response.error.customRenderer) {
|
|
29646
29747
|
const e = response.error;
|
|
29647
29748
|
let variant;
|
|
@@ -29666,6 +29767,11 @@ function ResponseDisplay({
|
|
|
29666
29767
|
children: e.content,
|
|
29667
29768
|
variant
|
|
29668
29769
|
};
|
|
29770
|
+
} else if (!response.result) {
|
|
29771
|
+
bannerProps = {
|
|
29772
|
+
title: "Empty Result",
|
|
29773
|
+
variant: "critical"
|
|
29774
|
+
};
|
|
29669
29775
|
}
|
|
29670
29776
|
return /* @__PURE__ */ jsxs("div", {
|
|
29671
29777
|
children: [bannerProps && /* @__PURE__ */ jsx(Banner, {
|
|
@@ -29756,6 +29862,38 @@ const styles$4 = {
|
|
|
29756
29862
|
$$css: true
|
|
29757
29863
|
}
|
|
29758
29864
|
};
|
|
29865
|
+
function DebugPane({
|
|
29866
|
+
query,
|
|
29867
|
+
debug
|
|
29868
|
+
}) {
|
|
29869
|
+
const [selectedDebugger, setSelectedDebugger] = useState();
|
|
29870
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
29871
|
+
children: [debug && /* @__PURE__ */ jsxs("div", {
|
|
29872
|
+
...{
|
|
29873
|
+
className: "x78zum5 x167g77z x6s0dn4"
|
|
29874
|
+
},
|
|
29875
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
29876
|
+
..._stylex.props(fontStyles.largeBody),
|
|
29877
|
+
children: "Debug with:"
|
|
29878
|
+
}), /* @__PURE__ */ jsx(SelectDropdown, {
|
|
29879
|
+
options: debug.debuggers.map((d) => ({
|
|
29880
|
+
label: d,
|
|
29881
|
+
value: d
|
|
29882
|
+
})),
|
|
29883
|
+
value: selectedDebugger,
|
|
29884
|
+
onChange: (v2) => setSelectedDebugger(v2)
|
|
29885
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
29886
|
+
variant: "default",
|
|
29887
|
+
label: "Run",
|
|
29888
|
+
isDisabled: !selectedDebugger,
|
|
29889
|
+
onClick: () => selectedDebugger && debug.onDebugQuery(query, selectedDebugger)
|
|
29890
|
+
})]
|
|
29891
|
+
}), /* @__PURE__ */ jsx(CodeBlock, {
|
|
29892
|
+
code: JSON.stringify(query, null, 2),
|
|
29893
|
+
language: "json"
|
|
29894
|
+
})]
|
|
29895
|
+
});
|
|
29896
|
+
}
|
|
29759
29897
|
function ResultPanel({
|
|
29760
29898
|
source,
|
|
29761
29899
|
draftQuery,
|
|
@@ -29898,9 +30036,12 @@ function ResultPanel({
|
|
|
29898
30036
|
...{
|
|
29899
30037
|
className: "xwp4ipm xh8yej3 x5yr21d x9f619"
|
|
29900
30038
|
},
|
|
29901
|
-
children: /* @__PURE__ */ jsx(
|
|
29902
|
-
|
|
29903
|
-
|
|
30039
|
+
children: /* @__PURE__ */ jsx(DebugPane, {
|
|
30040
|
+
query: draftQuery,
|
|
30041
|
+
debug: options.debugOptions ? {
|
|
30042
|
+
debuggers: options.debugOptions.debuggers,
|
|
30043
|
+
onDebugQuery: options.debugOptions.onDebugQuery
|
|
30044
|
+
} : void 0
|
|
29904
30045
|
})
|
|
29905
30046
|
})]
|
|
29906
30047
|
})]
|
|
@@ -30520,9 +30661,10 @@ function FieldGroupList({
|
|
|
30520
30661
|
..._stylex.props(fontStyles.body, styles$1.title),
|
|
30521
30662
|
children: title
|
|
30522
30663
|
}), /* @__PURE__ */ jsx(List$1, {
|
|
30523
|
-
children: items.map((item) => /* @__PURE__ */ jsx(CollapsibleListItem, {
|
|
30664
|
+
children: items.map((item, index2) => /* @__PURE__ */ jsx(CollapsibleListItem, {
|
|
30524
30665
|
label: getLabelFromPath(source, item.groupPath),
|
|
30525
30666
|
sublabel: getSublabelFromPath(source, item.groupPath),
|
|
30667
|
+
isInitiallyExpanded: index2 === 0,
|
|
30526
30668
|
children: item.items.map(({
|
|
30527
30669
|
field,
|
|
30528
30670
|
path
|
|
@@ -30598,12 +30740,17 @@ function SourcePanel({
|
|
|
30598
30740
|
},
|
|
30599
30741
|
children: [subpanelType == null ? /* @__PURE__ */ jsxs("div", {
|
|
30600
30742
|
...{
|
|
30601
|
-
className: "x78zum5 x6s0dn4 x167g77z xdqdrvq"
|
|
30743
|
+
className: "x78zum5 x6s0dn4 x167g77z xdqdrvq xb3r6kr"
|
|
30602
30744
|
},
|
|
30603
30745
|
children: [/* @__PURE__ */ jsx(Icon, {
|
|
30604
30746
|
name: "database",
|
|
30605
30747
|
color: "gray"
|
|
30606
|
-
}),
|
|
30748
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
30749
|
+
...{
|
|
30750
|
+
className: "xb3r6kr xlyipyv"
|
|
30751
|
+
},
|
|
30752
|
+
children: source.name
|
|
30753
|
+
})]
|
|
30607
30754
|
}) : /* @__PURE__ */ jsx(Button, {
|
|
30608
30755
|
icon: "chevronLeft",
|
|
30609
30756
|
label: "Back",
|
|
@@ -30614,7 +30761,8 @@ function SourcePanel({
|
|
|
30614
30761
|
children: /* @__PURE__ */ jsx(Button, {
|
|
30615
30762
|
icon: "chevronLeft",
|
|
30616
30763
|
tooltip: "Close the source panel",
|
|
30617
|
-
onClick: () => setIsSourcePanelOpen(false)
|
|
30764
|
+
onClick: () => setIsSourcePanelOpen(false),
|
|
30765
|
+
size: "compact"
|
|
30618
30766
|
})
|
|
30619
30767
|
})]
|
|
30620
30768
|
}), /* @__PURE__ */ jsx(TextInput, {
|