@pythia-software/query-table-ui 0.9.4 → 0.9.6
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 +57 -0
- package/dist/index.d.ts +6 -2
- package/dist/index.js +700 -365
- package/dist/index.js.map +1 -1
- package/dist/theme.css +308 -120
- package/dist/theme.css.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1958,8 +1958,9 @@ import { useCallback, useEffect as useEffect5, useRef as useRef5, useState as us
|
|
|
1958
1958
|
import { createPortal as createPortal2 } from "react-dom";
|
|
1959
1959
|
import { autoUpdate, flip, offset, shift, size, useFloating } from "@floating-ui/react";
|
|
1960
1960
|
import { Fragment as Fragment4, jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1961
|
-
function useFloatingOverlay({ anchor, onClose, returnFocus, width = 240, placement = "bottom-start", nodeId }) {
|
|
1962
|
-
const
|
|
1961
|
+
function useFloatingOverlay({ anchor, onClose, returnFocus, width = 240, placement = "bottom-start", nodeId, modalOnMobile = true, retainAnchorFocus = false, maxHeight }) {
|
|
1962
|
+
const mobileLayout = useMobileLayout();
|
|
1963
|
+
const mobile = mobileLayout && modalOnMobile;
|
|
1963
1964
|
const themeAnchor = useRef5(null);
|
|
1964
1965
|
const theme = useOverlayTheme(themeAnchor);
|
|
1965
1966
|
const surface = useRef5(null);
|
|
@@ -1984,7 +1985,7 @@ function useFloatingOverlay({ anchor, onClose, returnFocus, width = 240, placeme
|
|
|
1984
1985
|
middleware: [offset(4), flip({ padding: 8 }), shift({ padding: 8 }), size({
|
|
1985
1986
|
padding: 8,
|
|
1986
1987
|
apply({ availableHeight, elements }) {
|
|
1987
|
-
elements.floating.style.maxHeight = `${Math.max(0, availableHeight)}px`;
|
|
1988
|
+
elements.floating.style.maxHeight = `${Math.max(0, Math.min(availableHeight, maxHeight ?? Infinity))}px`;
|
|
1988
1989
|
}
|
|
1989
1990
|
})]
|
|
1990
1991
|
});
|
|
@@ -2028,7 +2029,7 @@ function useFloatingOverlay({ anchor, onClose, returnFocus, width = 240, placeme
|
|
|
2028
2029
|
close("outside");
|
|
2029
2030
|
};
|
|
2030
2031
|
const focusOutside = (event) => {
|
|
2031
|
-
if (pointerOnAnchor && event.target instanceof Node && isElementAnchor && anchor.contains(event.target)) return;
|
|
2032
|
+
if ((pointerOnAnchor || retainAnchorFocus) && event.target instanceof Node && isElementAnchor && anchor.contains(event.target)) return;
|
|
2032
2033
|
if (event.target instanceof Node && !surface.current?.contains(event.target)) close("outside");
|
|
2033
2034
|
};
|
|
2034
2035
|
const scroll = (event) => {
|
|
@@ -2047,7 +2048,7 @@ function useFloatingOverlay({ anchor, onClose, returnFocus, width = 240, placeme
|
|
|
2047
2048
|
document.removeEventListener("scroll", scroll, true);
|
|
2048
2049
|
window.removeEventListener("blur", blur);
|
|
2049
2050
|
};
|
|
2050
|
-
}, [close, mobile, isElementAnchor, anchor]);
|
|
2051
|
+
}, [close, mobile, isElementAnchor, anchor, retainAnchorFocus]);
|
|
2051
2052
|
const setSurface = useCallback((element) => {
|
|
2052
2053
|
surface.current = element;
|
|
2053
2054
|
refs.setFloating(mobile ? null : element);
|
|
@@ -8471,6 +8472,7 @@ import {
|
|
|
8471
8472
|
} from "react";
|
|
8472
8473
|
import {
|
|
8473
8474
|
MAX_AGGREGATIONS,
|
|
8475
|
+
MAX_METRIC_WINDOW_PERIODS,
|
|
8474
8476
|
METRIC_FUNCTIONS as METRIC_FUNCTIONS2,
|
|
8475
8477
|
aggOpsForField,
|
|
8476
8478
|
compileFormula,
|
|
@@ -9811,6 +9813,7 @@ function MetricCard({
|
|
|
9811
9813
|
buckets.length > clause.display.maxGroups ? " plus Other" : "",
|
|
9812
9814
|
"."
|
|
9813
9815
|
] }),
|
|
9816
|
+
(clause.window || clause.share) && /* @__PURE__ */ jsx31("p", { className: "qt-metric-note", children: seriesNote(clause) }),
|
|
9814
9817
|
!!result?.hiddenGroups && clause.minCount !== void 0 && /* @__PURE__ */ jsxs27("p", { className: "qt-metric-note", children: [
|
|
9815
9818
|
result.hiddenGroups.toLocaleString(),
|
|
9816
9819
|
" ",
|
|
@@ -9832,6 +9835,23 @@ function MetricCard({
|
|
|
9832
9835
|
}
|
|
9833
9836
|
);
|
|
9834
9837
|
}
|
|
9838
|
+
function seriesNote(clause) {
|
|
9839
|
+
const unit = clause.dateGrouping?.interval ?? "interval", window2 = clause.window;
|
|
9840
|
+
const parts = [];
|
|
9841
|
+
if (window2) {
|
|
9842
|
+
const span = window2.periods === "all" ? `from the first ${unit}` : `over the trailing ${window2.periods} ${unit}s`;
|
|
9843
|
+
parts.push(
|
|
9844
|
+
window2.reduce === "mean" ? `Mean per ${unit} ${span}` : `Total ${span}`
|
|
9845
|
+
);
|
|
9846
|
+
if (window2.periods !== "all" && window2.partial !== "include")
|
|
9847
|
+
parts.push("shorter windows at the start have no value");
|
|
9848
|
+
}
|
|
9849
|
+
if (clause.share)
|
|
9850
|
+
parts.push(
|
|
9851
|
+
clause.share === "group0" ? `${parts.length ? "as a share" : "Share"} of each ${clause.dateGrouping ? unit : "first group"}'s total` : `${parts.length ? "as a share" : "Share"} of the total`
|
|
9852
|
+
);
|
|
9853
|
+
return `${parts.join("; ")}.`;
|
|
9854
|
+
}
|
|
9835
9855
|
function BigNumber({
|
|
9836
9856
|
bucket,
|
|
9837
9857
|
fmt,
|
|
@@ -10507,12 +10527,26 @@ function MetricsEditor({
|
|
|
10507
10527
|
const index = name === void 0 ? -1 : groupBy.indexOf(name);
|
|
10508
10528
|
return index < 0 ? [] : [{ ...s, key: `group${index}` }];
|
|
10509
10529
|
});
|
|
10530
|
+
const dated = selected.dateGrouping?.field === groupBy[0];
|
|
10531
|
+
const share = groupBy.length >= (selected.share === "group0" ? 2 : 1) ? selected.share : void 0;
|
|
10510
10532
|
patch(selected.id, {
|
|
10511
10533
|
groupBy,
|
|
10512
10534
|
...sort ? { sort } : {},
|
|
10513
|
-
dateGrouping:
|
|
10535
|
+
dateGrouping: dated ? selected.dateGrouping : void 0,
|
|
10536
|
+
window: dated ? selected.window : void 0,
|
|
10537
|
+
share,
|
|
10538
|
+
...shareDisplay(selected.share, share)
|
|
10514
10539
|
});
|
|
10515
10540
|
}
|
|
10541
|
+
function shareDisplay(previous, next) {
|
|
10542
|
+
if (next && !previous && !chosen.format)
|
|
10543
|
+
return { display: { ...chosen, format: SHARE_FORMAT } };
|
|
10544
|
+
if (!next && previous && sameFormat(chosen.format, SHARE_FORMAT)) {
|
|
10545
|
+
const { format: _format, ...display2 } = chosen;
|
|
10546
|
+
return { display: display2 };
|
|
10547
|
+
}
|
|
10548
|
+
return {};
|
|
10549
|
+
}
|
|
10516
10550
|
function changeSize(key, raw) {
|
|
10517
10551
|
if (!selected || !Number.isFinite(raw)) return;
|
|
10518
10552
|
const layout = {
|
|
@@ -10525,7 +10559,12 @@ function MetricsEditor({
|
|
|
10525
10559
|
}
|
|
10526
10560
|
function changeDisplay(kind) {
|
|
10527
10561
|
if (!selected) return;
|
|
10528
|
-
const
|
|
10562
|
+
const single = !["box", "histogram", "scatter"].includes(kind);
|
|
10563
|
+
const display2 = !single && shareDisplay(selected.share, void 0).display || chosen;
|
|
10564
|
+
const next = {
|
|
10565
|
+
display: { ...display2, kind },
|
|
10566
|
+
...single ? {} : { window: void 0, share: void 0 }
|
|
10567
|
+
};
|
|
10529
10568
|
setFormatTarget(kind === "scatter" || kind === "histogram" ? "x" : "value");
|
|
10530
10569
|
if (selected.sort)
|
|
10531
10570
|
next.sort = selected.sort.filter(
|
|
@@ -11506,7 +11545,10 @@ function MetricsEditor({
|
|
|
11506
11545
|
value: selected.dateGrouping?.interval ?? "exact",
|
|
11507
11546
|
onChange: (e) => {
|
|
11508
11547
|
if (e.target.value === "exact") {
|
|
11509
|
-
patch(selected.id, {
|
|
11548
|
+
patch(selected.id, {
|
|
11549
|
+
dateGrouping: void 0,
|
|
11550
|
+
window: void 0
|
|
11551
|
+
});
|
|
11510
11552
|
return;
|
|
11511
11553
|
}
|
|
11512
11554
|
const interval = e.target.value;
|
|
@@ -11641,6 +11683,25 @@ function MetricsEditor({
|
|
|
11641
11683
|
] }),
|
|
11642
11684
|
/* @__PURE__ */ jsx33("p", { className: "qt-metric-help", children: "Direct counts and sums use 0 for empty dates. Averages, ratios, and other expressions have no value." })
|
|
11643
11685
|
] }),
|
|
11686
|
+
/* @__PURE__ */ jsxs28("label", { className: "qt-metric-date-toggle", children: [
|
|
11687
|
+
/* @__PURE__ */ jsx33(
|
|
11688
|
+
"input",
|
|
11689
|
+
{
|
|
11690
|
+
type: "checkbox",
|
|
11691
|
+
"aria-label": "Whole intervals only",
|
|
11692
|
+
disabled: !selected.dateGrouping,
|
|
11693
|
+
checked: selected.dateGrouping?.partialIntervals === "exclude",
|
|
11694
|
+
onChange: (e) => {
|
|
11695
|
+
const { partialIntervals: _partial, ...rest } = selected.dateGrouping;
|
|
11696
|
+
patch(selected.id, {
|
|
11697
|
+
dateGrouping: e.target.checked ? { ...rest, partialIntervals: "exclude" } : rest
|
|
11698
|
+
});
|
|
11699
|
+
}
|
|
11700
|
+
}
|
|
11701
|
+
),
|
|
11702
|
+
"Whole intervals only"
|
|
11703
|
+
] }),
|
|
11704
|
+
/* @__PURE__ */ jsx33("p", { className: "qt-metric-help", children: "Leave out intervals the date filters cut short and the interval still in progress." }),
|
|
11644
11705
|
/* @__PURE__ */ jsx33("p", { className: "qt-metric-help", children: "Calendar boundaries and custom dates use the grouping timezone. Weeks begin Monday." })
|
|
11645
11706
|
] }),
|
|
11646
11707
|
/* @__PURE__ */ jsxs28(
|
|
@@ -11663,6 +11724,18 @@ function MetricsEditor({
|
|
|
11663
11724
|
]
|
|
11664
11725
|
}
|
|
11665
11726
|
),
|
|
11727
|
+
selected.groupBy.length > 0 && !["box", "histogram", "scatter"].includes(chosen.kind) && /* @__PURE__ */ jsx33(
|
|
11728
|
+
MetricSeriesSettings,
|
|
11729
|
+
{
|
|
11730
|
+
clause: selected,
|
|
11731
|
+
fields,
|
|
11732
|
+
settings: settingsState("Window & share"),
|
|
11733
|
+
onChange: (values) => patch(selected.id, {
|
|
11734
|
+
...values,
|
|
11735
|
+
..."share" in values ? shareDisplay(selected.share, values.share) : {}
|
|
11736
|
+
})
|
|
11737
|
+
}
|
|
11738
|
+
),
|
|
11666
11739
|
/* @__PURE__ */ jsxs28(
|
|
11667
11740
|
Settings,
|
|
11668
11741
|
{
|
|
@@ -12566,6 +12639,167 @@ function Settings({
|
|
|
12566
12639
|
}
|
|
12567
12640
|
);
|
|
12568
12641
|
}
|
|
12642
|
+
var SHARE_FORMAT = { kind: "percent", decimals: 1 };
|
|
12643
|
+
var sameFormat = (a, b) => !!a && JSON.stringify(a) === JSON.stringify(b);
|
|
12644
|
+
var windowOf = (periods, mean, partial) => ({
|
|
12645
|
+
periods,
|
|
12646
|
+
...mean ? { reduce: "mean" } : {},
|
|
12647
|
+
...partial ? { partial: "include" } : {}
|
|
12648
|
+
});
|
|
12649
|
+
function MetricSeriesSettings({
|
|
12650
|
+
clause,
|
|
12651
|
+
fields,
|
|
12652
|
+
settings,
|
|
12653
|
+
onChange
|
|
12654
|
+
}) {
|
|
12655
|
+
const { window: window2, share, dateGrouping } = clause;
|
|
12656
|
+
const first = fields.find((f) => f.name === clause.groupBy[0])?.label ?? clause.groupBy[0];
|
|
12657
|
+
const unit = dateGrouping?.interval ?? "interval";
|
|
12658
|
+
const mode = !window2 ? "none" : window2.periods === "all" ? "all" : "trailing";
|
|
12659
|
+
const setWindow = (next) => onChange({
|
|
12660
|
+
window: next,
|
|
12661
|
+
...next && dateGrouping && !dateGrouping.includeEmpty ? { dateGrouping: { ...dateGrouping, includeEmpty: true } } : {},
|
|
12662
|
+
// A share of the total cannot be windowed, and its option is hidden.
|
|
12663
|
+
...next && share === "total" ? { share: void 0 } : {}
|
|
12664
|
+
});
|
|
12665
|
+
const summary = [
|
|
12666
|
+
!window2 ? "" : window2.periods === "all" ? "Running" : `Trailing ${window2.periods} ${unit}s`,
|
|
12667
|
+
window2?.reduce === "mean" ? `mean per ${unit}` : "",
|
|
12668
|
+
share === "group0" ? `share of each ${dateGrouping ? unit : first}` : share === "total" ? "share of total" : ""
|
|
12669
|
+
].filter(Boolean).join(" \xB7 ");
|
|
12670
|
+
return /* @__PURE__ */ jsxs28(
|
|
12671
|
+
Settings,
|
|
12672
|
+
{
|
|
12673
|
+
title: "Window & share",
|
|
12674
|
+
...settings,
|
|
12675
|
+
summary: summary || "Values as computed",
|
|
12676
|
+
children: [
|
|
12677
|
+
dateGrouping && /* @__PURE__ */ jsxs28(Fragment20, { children: [
|
|
12678
|
+
/* @__PURE__ */ jsxs28("label", { children: [
|
|
12679
|
+
"Window",
|
|
12680
|
+
/* @__PURE__ */ jsxs28(
|
|
12681
|
+
"select",
|
|
12682
|
+
{
|
|
12683
|
+
"aria-label": "Window",
|
|
12684
|
+
value: mode,
|
|
12685
|
+
onChange: (e) => setWindow(
|
|
12686
|
+
e.target.value === "none" ? void 0 : windowOf(
|
|
12687
|
+
e.target.value === "all" ? "all" : window2 && window2.periods !== "all" ? window2.periods : 7,
|
|
12688
|
+
window2?.reduce === "mean",
|
|
12689
|
+
// A running value has no partial windows.
|
|
12690
|
+
e.target.value !== "all" && window2?.partial === "include"
|
|
12691
|
+
)
|
|
12692
|
+
),
|
|
12693
|
+
children: [
|
|
12694
|
+
/* @__PURE__ */ jsx33("option", { value: "none", children: "None" }),
|
|
12695
|
+
/* @__PURE__ */ jsxs28("option", { value: "trailing", children: [
|
|
12696
|
+
"Trailing ",
|
|
12697
|
+
unit,
|
|
12698
|
+
"s"
|
|
12699
|
+
] }),
|
|
12700
|
+
/* @__PURE__ */ jsxs28("option", { value: "all", children: [
|
|
12701
|
+
"Running from the first ",
|
|
12702
|
+
unit
|
|
12703
|
+
] })
|
|
12704
|
+
]
|
|
12705
|
+
}
|
|
12706
|
+
)
|
|
12707
|
+
] }),
|
|
12708
|
+
window2 && window2.periods !== "all" && /* @__PURE__ */ jsxs28("label", { children: [
|
|
12709
|
+
`${unit[0].toUpperCase()}${unit.slice(1)}s per window`,
|
|
12710
|
+
/* @__PURE__ */ jsx33(
|
|
12711
|
+
"input",
|
|
12712
|
+
{
|
|
12713
|
+
"aria-label": "Window length",
|
|
12714
|
+
type: "number",
|
|
12715
|
+
min: 2,
|
|
12716
|
+
max: MAX_METRIC_WINDOW_PERIODS,
|
|
12717
|
+
value: window2.periods,
|
|
12718
|
+
onChange: (e) => {
|
|
12719
|
+
const n = e.currentTarget.valueAsNumber;
|
|
12720
|
+
if (Number.isInteger(n) && n >= 2 && n <= MAX_METRIC_WINDOW_PERIODS)
|
|
12721
|
+
setWindow({ ...window2, periods: n });
|
|
12722
|
+
}
|
|
12723
|
+
}
|
|
12724
|
+
)
|
|
12725
|
+
] }),
|
|
12726
|
+
window2 && /* @__PURE__ */ jsxs28(Fragment20, { children: [
|
|
12727
|
+
/* @__PURE__ */ jsxs28("label", { children: [
|
|
12728
|
+
"Combine",
|
|
12729
|
+
/* @__PURE__ */ jsxs28(
|
|
12730
|
+
"select",
|
|
12731
|
+
{
|
|
12732
|
+
"aria-label": "Combine window",
|
|
12733
|
+
value: window2.reduce ?? "total",
|
|
12734
|
+
onChange: (e) => setWindow(
|
|
12735
|
+
windowOf(
|
|
12736
|
+
window2.periods,
|
|
12737
|
+
e.target.value === "mean",
|
|
12738
|
+
window2.partial === "include"
|
|
12739
|
+
)
|
|
12740
|
+
),
|
|
12741
|
+
children: [
|
|
12742
|
+
/* @__PURE__ */ jsx33("option", { value: "total", children: "Total over the window" }),
|
|
12743
|
+
/* @__PURE__ */ jsxs28("option", { value: "mean", children: [
|
|
12744
|
+
"Mean per ",
|
|
12745
|
+
unit
|
|
12746
|
+
] })
|
|
12747
|
+
]
|
|
12748
|
+
}
|
|
12749
|
+
)
|
|
12750
|
+
] }),
|
|
12751
|
+
window2.periods !== "all" && /* @__PURE__ */ jsxs28("label", { className: "qt-metric-date-toggle", children: [
|
|
12752
|
+
/* @__PURE__ */ jsx33(
|
|
12753
|
+
"input",
|
|
12754
|
+
{
|
|
12755
|
+
type: "checkbox",
|
|
12756
|
+
"aria-label": "Show partial windows",
|
|
12757
|
+
checked: window2.partial === "include",
|
|
12758
|
+
onChange: (e) => setWindow(
|
|
12759
|
+
windowOf(
|
|
12760
|
+
window2.periods,
|
|
12761
|
+
window2.reduce === "mean",
|
|
12762
|
+
e.target.checked
|
|
12763
|
+
)
|
|
12764
|
+
)
|
|
12765
|
+
}
|
|
12766
|
+
),
|
|
12767
|
+
"Show windows that start before the range"
|
|
12768
|
+
] }),
|
|
12769
|
+
/* @__PURE__ */ jsxs28("p", { className: "qt-metric-help", children: [
|
|
12770
|
+
"A total evaluates the metric over every row in the window, so ratios and averages pool their parts. A mean per ",
|
|
12771
|
+
unit,
|
|
12772
|
+
" ",
|
|
12773
|
+
"averages a single sum, count or distinct count."
|
|
12774
|
+
] })
|
|
12775
|
+
] })
|
|
12776
|
+
] }),
|
|
12777
|
+
/* @__PURE__ */ jsxs28("label", { children: [
|
|
12778
|
+
"Show values as",
|
|
12779
|
+
/* @__PURE__ */ jsxs28(
|
|
12780
|
+
"select",
|
|
12781
|
+
{
|
|
12782
|
+
"aria-label": "Show values as",
|
|
12783
|
+
value: share ?? "values",
|
|
12784
|
+
onChange: (e) => onChange({
|
|
12785
|
+
share: e.target.value === "values" ? void 0 : e.target.value
|
|
12786
|
+
}),
|
|
12787
|
+
children: [
|
|
12788
|
+
/* @__PURE__ */ jsx33("option", { value: "values", children: "Values" }),
|
|
12789
|
+
clause.groupBy.length > 1 && /* @__PURE__ */ jsxs28("option", { value: "group0", children: [
|
|
12790
|
+
"Share of each ",
|
|
12791
|
+
dateGrouping ? unit : first
|
|
12792
|
+
] }),
|
|
12793
|
+
!window2 && /* @__PURE__ */ jsx33("option", { value: "total", children: "Share of all groups" })
|
|
12794
|
+
]
|
|
12795
|
+
}
|
|
12796
|
+
)
|
|
12797
|
+
] }),
|
|
12798
|
+
share && /* @__PURE__ */ jsx33("p", { className: "qt-metric-help", children: "Divides each group by a total of the same sum or count, including groups past the group limit." })
|
|
12799
|
+
]
|
|
12800
|
+
}
|
|
12801
|
+
);
|
|
12802
|
+
}
|
|
12569
12803
|
function MetricFormatControls({
|
|
12570
12804
|
format,
|
|
12571
12805
|
onChange,
|
|
@@ -13135,11 +13369,11 @@ function SetFilterEditor({ api, field, returnFocus, classNames, mode: initialMod
|
|
|
13135
13369
|
// src/QueryBuilder.tsx
|
|
13136
13370
|
import {
|
|
13137
13371
|
Fragment as Fragment23,
|
|
13138
|
-
useEffect as
|
|
13139
|
-
useId as
|
|
13372
|
+
useEffect as useEffect22,
|
|
13373
|
+
useId as useId11,
|
|
13140
13374
|
useMemo as useMemo12,
|
|
13141
|
-
useRef as
|
|
13142
|
-
useState as
|
|
13375
|
+
useRef as useRef23,
|
|
13376
|
+
useState as useState31
|
|
13143
13377
|
} from "react";
|
|
13144
13378
|
import {
|
|
13145
13379
|
NULLARY_OPS as NULLARY_OPS2,
|
|
@@ -13223,8 +13457,148 @@ function SavedQueriesModal({ saved, onClose, onLoad }) {
|
|
|
13223
13457
|
}) }) }) });
|
|
13224
13458
|
}
|
|
13225
13459
|
|
|
13460
|
+
// src/FilterValueAutocomplete.tsx
|
|
13461
|
+
import { useEffect as useEffect21, useId as useId10, useRef as useRef22, useState as useState30 } from "react";
|
|
13462
|
+
import { jsx as jsx38, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
13463
|
+
function FilterValueAutocomplete({ api, field, value, contextKey, className, widthChars, onChange }) {
|
|
13464
|
+
const input = useRef22(null);
|
|
13465
|
+
const listId = useId10();
|
|
13466
|
+
const [open, setOpen] = useState30(false);
|
|
13467
|
+
const [active, setActive] = useState30(null);
|
|
13468
|
+
const scopeKey = JSON.stringify([field.name, contextKey]);
|
|
13469
|
+
const requestKey = JSON.stringify([scopeKey, value]);
|
|
13470
|
+
const fetchValues = api.filterValues;
|
|
13471
|
+
const [known, setKnown] = useState30(null);
|
|
13472
|
+
const [response, setResponse] = useState30(null);
|
|
13473
|
+
const current = response?.key === requestKey && response.fetchValues === fetchValues ? response : null;
|
|
13474
|
+
const search = value.trim().toLowerCase();
|
|
13475
|
+
const previousValues = known?.scopeKey === scopeKey && known.fetchValues === fetchValues ? known.result.values.filter((choice) => choice.toLowerCase().includes(search)) : [];
|
|
13476
|
+
const values = [...new Set(current?.result?.values ?? previousValues)];
|
|
13477
|
+
const activeIndex = active === null ? -1 : values.indexOf(active);
|
|
13478
|
+
const activeId = open && activeIndex >= 0 ? `${listId}-${activeIndex}` : void 0;
|
|
13479
|
+
useEffect21(() => {
|
|
13480
|
+
let cancelled = false;
|
|
13481
|
+
setActive(null);
|
|
13482
|
+
const timer = setTimeout(() => {
|
|
13483
|
+
void Promise.resolve().then(() => fetchValues(field.name, value)).then(
|
|
13484
|
+
(result) => {
|
|
13485
|
+
if (cancelled) return;
|
|
13486
|
+
setResponse({ key: requestKey, fetchValues, result });
|
|
13487
|
+
setKnown({ scopeKey, fetchValues, result });
|
|
13488
|
+
},
|
|
13489
|
+
() => {
|
|
13490
|
+
if (!cancelled) setResponse({ key: requestKey, fetchValues, failed: true });
|
|
13491
|
+
}
|
|
13492
|
+
);
|
|
13493
|
+
}, 200);
|
|
13494
|
+
return () => {
|
|
13495
|
+
cancelled = true;
|
|
13496
|
+
clearTimeout(timer);
|
|
13497
|
+
};
|
|
13498
|
+
}, [fetchValues, requestKey, scopeKey, field.name, value]);
|
|
13499
|
+
useEffect21(() => {
|
|
13500
|
+
if (activeId) document.getElementById(activeId)?.scrollIntoView?.({ block: "nearest" });
|
|
13501
|
+
}, [activeId]);
|
|
13502
|
+
const close = () => {
|
|
13503
|
+
setOpen(false);
|
|
13504
|
+
setActive(null);
|
|
13505
|
+
};
|
|
13506
|
+
const choose = (choice) => {
|
|
13507
|
+
onChange(choice);
|
|
13508
|
+
close();
|
|
13509
|
+
input.current?.focus({ preventScroll: true });
|
|
13510
|
+
};
|
|
13511
|
+
const status = !current ? values.length ? "" : "Loading suggestions\u2026" : current.failed ? "Suggestions unavailable. Keep typing a value." : values.length === 0 ? "No matching values. Keep typing a value." : current.result?.hasMore ? "keep typing to refine\u2026" : "";
|
|
13512
|
+
return /* @__PURE__ */ jsxs33("span", { className: "qt-autocomplete", children: [
|
|
13513
|
+
/* @__PURE__ */ jsx38(
|
|
13514
|
+
"input",
|
|
13515
|
+
{
|
|
13516
|
+
ref: input,
|
|
13517
|
+
className,
|
|
13518
|
+
value,
|
|
13519
|
+
placeholder: "value",
|
|
13520
|
+
"aria-label": `Value for ${field.label}`,
|
|
13521
|
+
role: "combobox",
|
|
13522
|
+
"aria-autocomplete": "list",
|
|
13523
|
+
"aria-haspopup": "listbox",
|
|
13524
|
+
"aria-expanded": open,
|
|
13525
|
+
"aria-controls": open ? listId : void 0,
|
|
13526
|
+
"aria-activedescendant": activeId,
|
|
13527
|
+
"aria-describedby": open && status ? `${listId}-status` : void 0,
|
|
13528
|
+
autoComplete: "off",
|
|
13529
|
+
size: widthChars,
|
|
13530
|
+
style: { width: `${widthChars}ch` },
|
|
13531
|
+
onFocus: () => setOpen(true),
|
|
13532
|
+
onClick: () => setOpen(true),
|
|
13533
|
+
onChange: (event) => {
|
|
13534
|
+
setActive(null);
|
|
13535
|
+
setOpen(true);
|
|
13536
|
+
onChange(event.target.value);
|
|
13537
|
+
},
|
|
13538
|
+
onKeyDown: (event) => {
|
|
13539
|
+
if (event.nativeEvent.isComposing || event.keyCode === 229) return;
|
|
13540
|
+
if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
13541
|
+
event.preventDefault();
|
|
13542
|
+
setOpen(true);
|
|
13543
|
+
if (values.length) {
|
|
13544
|
+
const next = !open || activeIndex < 0 ? event.key === "ArrowDown" ? 0 : values.length - 1 : (activeIndex + (event.key === "ArrowDown" ? 1 : -1) + values.length) % values.length;
|
|
13545
|
+
setActive(values[next]);
|
|
13546
|
+
}
|
|
13547
|
+
} else if (open && activeIndex >= 0 && (event.key === "Home" || event.key === "End")) {
|
|
13548
|
+
event.preventDefault();
|
|
13549
|
+
setActive(values[event.key === "Home" ? 0 : values.length - 1]);
|
|
13550
|
+
} else if (open && event.key === "Enter" && activeIndex >= 0) {
|
|
13551
|
+
event.preventDefault();
|
|
13552
|
+
choose(values[activeIndex]);
|
|
13553
|
+
} else if (open && event.key === "Escape") {
|
|
13554
|
+
event.preventDefault();
|
|
13555
|
+
event.stopPropagation();
|
|
13556
|
+
close();
|
|
13557
|
+
} else if (event.key === "Tab") close();
|
|
13558
|
+
}
|
|
13559
|
+
}
|
|
13560
|
+
),
|
|
13561
|
+
open && input.current && /* @__PURE__ */ jsxs33(Suggestions, { anchor: input.current, onClose: close, children: [
|
|
13562
|
+
/* @__PURE__ */ jsx38("div", { id: listId, role: "listbox", "aria-label": `Suggestions for ${field.label}`, "aria-busy": !current, children: values.map((choice, index) => /* @__PURE__ */ jsx38(
|
|
13563
|
+
"div",
|
|
13564
|
+
{
|
|
13565
|
+
id: `${listId}-${index}`,
|
|
13566
|
+
role: "option",
|
|
13567
|
+
"aria-selected": choice === active,
|
|
13568
|
+
className: "qt-autocomplete-option",
|
|
13569
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
13570
|
+
onClick: () => choose(choice),
|
|
13571
|
+
children: choice
|
|
13572
|
+
},
|
|
13573
|
+
choice
|
|
13574
|
+
)) }),
|
|
13575
|
+
status && /* @__PURE__ */ jsx38("p", { id: `${listId}-status`, role: "status", className: "qt-autocomplete-status", children: status })
|
|
13576
|
+
] })
|
|
13577
|
+
] });
|
|
13578
|
+
}
|
|
13579
|
+
function Suggestions({ anchor, onClose, children }) {
|
|
13580
|
+
const overlay = useFloatingOverlay({
|
|
13581
|
+
anchor,
|
|
13582
|
+
onClose,
|
|
13583
|
+
width: "max-content",
|
|
13584
|
+
maxHeight: 440,
|
|
13585
|
+
modalOnMobile: false,
|
|
13586
|
+
retainAnchorFocus: true
|
|
13587
|
+
});
|
|
13588
|
+
return /* @__PURE__ */ jsx38(OverlayPortal, { overlay, label: "Value suggestions", children: /* @__PURE__ */ jsx38(
|
|
13589
|
+
"div",
|
|
13590
|
+
{
|
|
13591
|
+
ref: overlay.setSurface,
|
|
13592
|
+
style: overlay.style,
|
|
13593
|
+
className: "qt-menu-surface qt-autocomplete-menu",
|
|
13594
|
+
onClick: (event) => event.stopPropagation(),
|
|
13595
|
+
children
|
|
13596
|
+
}
|
|
13597
|
+
) });
|
|
13598
|
+
}
|
|
13599
|
+
|
|
13226
13600
|
// src/QueryBuilder.tsx
|
|
13227
|
-
import { Fragment as Fragment24, jsx as
|
|
13601
|
+
import { Fragment as Fragment24, jsx as jsx39, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
13228
13602
|
var cx5 = (...parts) => parts.filter((p) => Boolean(p)).join(" ");
|
|
13229
13603
|
var MAX_AUTO_REFRESH_POLLS = 1e3;
|
|
13230
13604
|
var DEFAULT_AUTO_REFRESH_FREQUENCY_MS = 2e4;
|
|
@@ -13272,8 +13646,8 @@ function formatStatusTime(ms) {
|
|
|
13272
13646
|
});
|
|
13273
13647
|
}
|
|
13274
13648
|
function useFieldHasNull(api, fieldName) {
|
|
13275
|
-
const [hasNull, setHasNull] =
|
|
13276
|
-
|
|
13649
|
+
const [hasNull, setHasNull] = useState31(void 0);
|
|
13650
|
+
useEffect22(() => {
|
|
13277
13651
|
if (!fieldName) return;
|
|
13278
13652
|
let cancelled = false;
|
|
13279
13653
|
void api.filterValues(fieldName, "").then((r) => {
|
|
@@ -13374,21 +13748,21 @@ function QueryBuilder({
|
|
|
13374
13748
|
selectPresentation ?? (selectPresentation = groupingUI.selectPresentation);
|
|
13375
13749
|
const mobile = useMobileLayout();
|
|
13376
13750
|
const UNSAVED_QUERY_EDIT_ID = "__qt-unsaved-query__";
|
|
13377
|
-
const [showSaved, setShowSaved] =
|
|
13378
|
-
const [shareCopied, setShareCopied] =
|
|
13379
|
-
const [showActivity, setShowActivity] =
|
|
13380
|
-
const activityId =
|
|
13381
|
-
const [showAutoRefresh, setShowAutoRefresh] =
|
|
13382
|
-
const [autoRefreshFrequencyMs, setAutoRefreshFrequencyMs] =
|
|
13751
|
+
const [showSaved, setShowSaved] = useState31(false);
|
|
13752
|
+
const [shareCopied, setShareCopied] = useState31(false);
|
|
13753
|
+
const [showActivity, setShowActivity] = useState31(false);
|
|
13754
|
+
const activityId = useId11();
|
|
13755
|
+
const [showAutoRefresh, setShowAutoRefresh] = useState31(false);
|
|
13756
|
+
const [autoRefreshFrequencyMs, setAutoRefreshFrequencyMs] = useState31(
|
|
13383
13757
|
DEFAULT_AUTO_REFRESH_FREQUENCY_MS
|
|
13384
13758
|
);
|
|
13385
|
-
const [autoRefreshTurnOffAfterMs, setAutoRefreshTurnOffAfterMs] =
|
|
13759
|
+
const [autoRefreshTurnOffAfterMs, setAutoRefreshTurnOffAfterMs] = useState31(
|
|
13386
13760
|
DEFAULT_AUTO_REFRESH_TURN_OFF_AFTER_MS
|
|
13387
13761
|
);
|
|
13388
|
-
const [editingSavedId, setEditingSavedId] =
|
|
13389
|
-
const [editingSavedName, setEditingSavedName] =
|
|
13390
|
-
const [lastSavedId, setLastSavedId] =
|
|
13391
|
-
const [collapsedFallback, setCollapsedFallback] =
|
|
13762
|
+
const [editingSavedId, setEditingSavedId] = useState31(null);
|
|
13763
|
+
const [editingSavedName, setEditingSavedName] = useState31("");
|
|
13764
|
+
const [lastSavedId, setLastSavedId] = useState31(null);
|
|
13765
|
+
const [collapsedFallback, setCollapsedFallback] = useState31(defaultCollapsed);
|
|
13392
13766
|
const collapsedControlled = typeof collapsed !== "undefined";
|
|
13393
13767
|
const isCollapsed = collapsedControlled ? collapsed : collapsedFallback;
|
|
13394
13768
|
const setCollapsed = (next) => {
|
|
@@ -13398,8 +13772,8 @@ function QueryBuilder({
|
|
|
13398
13772
|
}
|
|
13399
13773
|
setCollapsedFallback(next);
|
|
13400
13774
|
};
|
|
13401
|
-
const [lastUpdatedAt, setLastUpdatedAt] =
|
|
13402
|
-
const [lastFailureAt, setLastFailureAt] =
|
|
13775
|
+
const [lastUpdatedAt, setLastUpdatedAt] = useState31(null);
|
|
13776
|
+
const [lastFailureAt, setLastFailureAt] = useState31(null);
|
|
13403
13777
|
const byName = useMemo12(
|
|
13404
13778
|
() => new Map(fields.map((f) => [f.name, f])),
|
|
13405
13779
|
[fields]
|
|
@@ -13416,7 +13790,7 @@ function QueryBuilder({
|
|
|
13416
13790
|
);
|
|
13417
13791
|
const isSavedQuery = activeSavedQuery != null;
|
|
13418
13792
|
const isEditingUnsaved = editingSavedId === UNSAVED_QUERY_EDIT_ID;
|
|
13419
|
-
const bodyId =
|
|
13793
|
+
const bodyId = useId11();
|
|
13420
13794
|
const isEditingSaved = editingSavedId != null && activeSavedQuery?.id === editingSavedId;
|
|
13421
13795
|
const showUpdateButton = api.saved.canUpdate && Boolean(lastSavedQuery) && !activeSavedQuery;
|
|
13422
13796
|
const collapsedSummary = useMemo12(
|
|
@@ -13443,28 +13817,28 @@ function QueryBuilder({
|
|
|
13443
13817
|
const lastUpdatedText = formatStatusTime(lastUpdatedAt);
|
|
13444
13818
|
const failureText = api.error ? `Error: ${api.error.message}` : lastFailureAt ? `Last failure at ${formatStatusTime(lastFailureAt)}` : null;
|
|
13445
13819
|
const isBusy = Boolean(running) || api.loading || api.links.busy;
|
|
13446
|
-
const lastRowsRef =
|
|
13447
|
-
const lastTotalRef =
|
|
13448
|
-
const previousLoadingRef =
|
|
13449
|
-
const autoRefreshRef =
|
|
13450
|
-
const shareFeedbackTimerRef =
|
|
13820
|
+
const lastRowsRef = useRef23(null);
|
|
13821
|
+
const lastTotalRef = useRef23(null);
|
|
13822
|
+
const previousLoadingRef = useRef23(api.loading);
|
|
13823
|
+
const autoRefreshRef = useRef23(null);
|
|
13824
|
+
const shareFeedbackTimerRef = useRef23(
|
|
13451
13825
|
null
|
|
13452
13826
|
);
|
|
13453
|
-
|
|
13827
|
+
useEffect22(
|
|
13454
13828
|
() => () => {
|
|
13455
13829
|
if (shareFeedbackTimerRef.current)
|
|
13456
13830
|
clearTimeout(shareFeedbackTimerRef.current);
|
|
13457
13831
|
},
|
|
13458
13832
|
[]
|
|
13459
13833
|
);
|
|
13460
|
-
|
|
13834
|
+
useEffect22(() => {
|
|
13461
13835
|
setShareCopied(false);
|
|
13462
13836
|
if (shareFeedbackTimerRef.current) {
|
|
13463
13837
|
clearTimeout(shareFeedbackTimerRef.current);
|
|
13464
13838
|
shareFeedbackTimerRef.current = null;
|
|
13465
13839
|
}
|
|
13466
13840
|
}, [api.query]);
|
|
13467
|
-
|
|
13841
|
+
useEffect22(() => {
|
|
13468
13842
|
if (activeSavedQuery) {
|
|
13469
13843
|
setLastSavedId(activeSavedQuery.id);
|
|
13470
13844
|
if (!isEditingSaved) {
|
|
@@ -13478,12 +13852,12 @@ function QueryBuilder({
|
|
|
13478
13852
|
setEditingSavedName("");
|
|
13479
13853
|
}
|
|
13480
13854
|
}, [activeSavedQuery, isEditingSaved, isEditingUnsaved]);
|
|
13481
|
-
|
|
13855
|
+
useEffect22(() => {
|
|
13482
13856
|
if (!lastSavedId || api.saved.items.some((item) => item.id === lastSavedId))
|
|
13483
13857
|
return;
|
|
13484
13858
|
setLastSavedId(null);
|
|
13485
13859
|
}, [api.saved.items, lastSavedId]);
|
|
13486
|
-
|
|
13860
|
+
useEffect22(() => {
|
|
13487
13861
|
const hasData = api.rows.length > 0 || total != null;
|
|
13488
13862
|
const rowsChanged = lastRowsRef.current !== api.rows;
|
|
13489
13863
|
const totalChanged = lastTotalRef.current !== total;
|
|
@@ -13573,10 +13947,10 @@ function QueryBuilder({
|
|
|
13573
13947
|
return;
|
|
13574
13948
|
}
|
|
13575
13949
|
}
|
|
13576
|
-
|
|
13950
|
+
useEffect22(() => {
|
|
13577
13951
|
if (isCollapsed) setShowSaved(false);
|
|
13578
13952
|
}, [isCollapsed]);
|
|
13579
|
-
|
|
13953
|
+
useEffect22(() => {
|
|
13580
13954
|
if (!showAutoRefresh || !autoRefreshStatus) return;
|
|
13581
13955
|
setAutoRefreshFrequencyMs(autoRefreshStatus.frequencyMs);
|
|
13582
13956
|
setAutoRefreshTurnOffAfterMs(autoRefreshStatus.turnOffAfterMs);
|
|
@@ -13624,15 +13998,15 @@ function QueryBuilder({
|
|
|
13624
13998
|
window.prompt("Copy this query URL", url.toString());
|
|
13625
13999
|
}
|
|
13626
14000
|
}
|
|
13627
|
-
return /* @__PURE__ */
|
|
14001
|
+
return /* @__PURE__ */ jsxs34("div", { className: cx5(
|
|
13628
14002
|
"qt-qb",
|
|
13629
14003
|
api.grouping && "qt-qb--groupable",
|
|
13630
14004
|
compact && "qt-qb--compact",
|
|
13631
14005
|
classNames?.root
|
|
13632
14006
|
), children: [
|
|
13633
|
-
/* @__PURE__ */
|
|
13634
|
-
/* @__PURE__ */
|
|
13635
|
-
/* @__PURE__ */
|
|
14007
|
+
/* @__PURE__ */ jsxs34("div", { className: "qt-qb-bar qt-qb-state-bar qt-qb-row", children: [
|
|
14008
|
+
/* @__PURE__ */ jsxs34("span", { className: "qt-qb-state-main", children: [
|
|
14009
|
+
/* @__PURE__ */ jsxs34(
|
|
13636
14010
|
"button",
|
|
13637
14011
|
{
|
|
13638
14012
|
type: "button",
|
|
@@ -13643,7 +14017,7 @@ function QueryBuilder({
|
|
|
13643
14017
|
"aria-label": isCollapsed ? "Expand query builder" : "Collapse query builder",
|
|
13644
14018
|
title: isCollapsed ? "Expand query builder" : "Collapse query builder",
|
|
13645
14019
|
children: [
|
|
13646
|
-
/* @__PURE__ */
|
|
14020
|
+
/* @__PURE__ */ jsx39(
|
|
13647
14021
|
Icon,
|
|
13648
14022
|
{
|
|
13649
14023
|
name: "chevronDown",
|
|
@@ -13654,12 +14028,12 @@ function QueryBuilder({
|
|
|
13654
14028
|
)
|
|
13655
14029
|
}
|
|
13656
14030
|
),
|
|
13657
|
-
/* @__PURE__ */
|
|
14031
|
+
/* @__PURE__ */ jsx39("span", { children: "Query" })
|
|
13658
14032
|
]
|
|
13659
14033
|
}
|
|
13660
14034
|
),
|
|
13661
|
-
savedQueryControls !== void 0 ? savedQueryControls : /* @__PURE__ */
|
|
13662
|
-
/* @__PURE__ */
|
|
14035
|
+
savedQueryControls !== void 0 ? savedQueryControls : /* @__PURE__ */ jsxs34("span", { className: "qt-qb-saved", children: [
|
|
14036
|
+
/* @__PURE__ */ jsx39(
|
|
13663
14037
|
"button",
|
|
13664
14038
|
{
|
|
13665
14039
|
type: "button",
|
|
@@ -13671,11 +14045,11 @@ function QueryBuilder({
|
|
|
13671
14045
|
"aria-label": isSavedQuery ? "Rename saved query" : "Save query",
|
|
13672
14046
|
disabled: isBusy,
|
|
13673
14047
|
onClick: beginEditSavedName,
|
|
13674
|
-
children: /* @__PURE__ */
|
|
14048
|
+
children: /* @__PURE__ */ jsx39(Icon, { name: "star", size: 16, filled: isSavedQuery })
|
|
13675
14049
|
}
|
|
13676
14050
|
),
|
|
13677
|
-
isEditingSaved || isEditingUnsaved ? /* @__PURE__ */
|
|
13678
|
-
/* @__PURE__ */
|
|
14051
|
+
isEditingSaved || isEditingUnsaved ? /* @__PURE__ */ jsxs34("span", { className: "qt-qb-saved-input-wrap", children: [
|
|
14052
|
+
/* @__PURE__ */ jsx39(
|
|
13679
14053
|
"input",
|
|
13680
14054
|
{
|
|
13681
14055
|
type: "text",
|
|
@@ -13698,7 +14072,7 @@ function QueryBuilder({
|
|
|
13698
14072
|
onClick: (e) => e.stopPropagation()
|
|
13699
14073
|
}
|
|
13700
14074
|
),
|
|
13701
|
-
/* @__PURE__ */
|
|
14075
|
+
/* @__PURE__ */ jsx39(
|
|
13702
14076
|
"button",
|
|
13703
14077
|
{
|
|
13704
14078
|
type: "button",
|
|
@@ -13710,10 +14084,10 @@ function QueryBuilder({
|
|
|
13710
14084
|
cancelNameEdit();
|
|
13711
14085
|
},
|
|
13712
14086
|
onClick: (e) => e.stopPropagation(),
|
|
13713
|
-
children: /* @__PURE__ */
|
|
14087
|
+
children: /* @__PURE__ */ jsx39(Icon, { name: "close" })
|
|
13714
14088
|
}
|
|
13715
14089
|
)
|
|
13716
|
-
] }) : /* @__PURE__ */
|
|
14090
|
+
] }) : /* @__PURE__ */ jsx39(
|
|
13717
14091
|
"button",
|
|
13718
14092
|
{
|
|
13719
14093
|
type: "button",
|
|
@@ -13726,24 +14100,24 @@ function QueryBuilder({
|
|
|
13726
14100
|
}
|
|
13727
14101
|
)
|
|
13728
14102
|
] }),
|
|
13729
|
-
isCollapsed ? /* @__PURE__ */
|
|
14103
|
+
isCollapsed ? /* @__PURE__ */ jsx39(
|
|
13730
14104
|
"span",
|
|
13731
14105
|
{
|
|
13732
14106
|
className: "qt-qb-summary qt-truncate",
|
|
13733
14107
|
title: summary ? void 0 : collapsedSummary,
|
|
13734
|
-
children: summary ?? /* @__PURE__ */
|
|
13735
|
-
/* @__PURE__ */
|
|
14108
|
+
children: summary ?? /* @__PURE__ */ jsxs34(Fragment24, { children: [
|
|
14109
|
+
/* @__PURE__ */ jsx39("span", { className: "qt-qb-summary-kw", children: "WHERE" }),
|
|
13736
14110
|
" ",
|
|
13737
|
-
/* @__PURE__ */
|
|
14111
|
+
/* @__PURE__ */ jsx39("strong", { children: collapsedWhereText }),
|
|
13738
14112
|
" ",
|
|
13739
|
-
/* @__PURE__ */
|
|
14113
|
+
/* @__PURE__ */ jsx39("span", { className: "qt-qb-summary-kw", children: "ORDER BY" }),
|
|
13740
14114
|
" ",
|
|
13741
|
-
/* @__PURE__ */
|
|
14115
|
+
/* @__PURE__ */ jsx39("strong", { children: collapsedOrderText })
|
|
13742
14116
|
] })
|
|
13743
14117
|
}
|
|
13744
14118
|
) : null
|
|
13745
14119
|
] }),
|
|
13746
|
-
savedQueryControls === void 0 && showUpdateButton ? /* @__PURE__ */
|
|
14120
|
+
savedQueryControls === void 0 && showUpdateButton ? /* @__PURE__ */ jsx39(
|
|
13747
14121
|
"button",
|
|
13748
14122
|
{
|
|
13749
14123
|
type: "button",
|
|
@@ -13753,7 +14127,7 @@ function QueryBuilder({
|
|
|
13753
14127
|
children: `Update Query '${lastSavedQuery?.name ?? "query"}'`
|
|
13754
14128
|
}
|
|
13755
14129
|
) : null,
|
|
13756
|
-
/* @__PURE__ */
|
|
14130
|
+
/* @__PURE__ */ jsxs34(
|
|
13757
14131
|
"button",
|
|
13758
14132
|
{
|
|
13759
14133
|
type: "button",
|
|
@@ -13763,28 +14137,28 @@ function QueryBuilder({
|
|
|
13763
14137
|
"aria-live": "polite",
|
|
13764
14138
|
disabled: api.loading || api.links.busy,
|
|
13765
14139
|
children: [
|
|
13766
|
-
/* @__PURE__ */
|
|
14140
|
+
/* @__PURE__ */ jsx39(Icon, { name: shareCopied ? "check" : "share" }),
|
|
13767
14141
|
shareCopied ? "Copied!" : "Share"
|
|
13768
14142
|
]
|
|
13769
14143
|
}
|
|
13770
14144
|
),
|
|
13771
|
-
api.links.kind === "local" && /* @__PURE__ */
|
|
13772
|
-
api.links.error && /* @__PURE__ */
|
|
13773
|
-
savedQueryControls === void 0 && /* @__PURE__ */
|
|
14145
|
+
api.links.kind === "local" && /* @__PURE__ */ jsx39("small", { role: "status", children: "Temporary link \xB7 this browser only" }),
|
|
14146
|
+
api.links.error && /* @__PURE__ */ jsx39("small", { role: "alert", children: api.links.error.message }),
|
|
14147
|
+
savedQueryControls === void 0 && /* @__PURE__ */ jsxs34(
|
|
13774
14148
|
"button",
|
|
13775
14149
|
{
|
|
13776
14150
|
type: "button",
|
|
13777
14151
|
className: cx5("qt-btn", classNames?.button),
|
|
13778
14152
|
onClick: () => setShowSaved(true),
|
|
13779
14153
|
children: [
|
|
13780
|
-
/* @__PURE__ */
|
|
14154
|
+
/* @__PURE__ */ jsx39(Icon, { name: "bookmark" }),
|
|
13781
14155
|
"Saved",
|
|
13782
14156
|
api.saved.items.length > 0 ? ` (${api.saved.items.length})` : ""
|
|
13783
14157
|
]
|
|
13784
14158
|
}
|
|
13785
14159
|
),
|
|
13786
|
-
/* @__PURE__ */
|
|
13787
|
-
/* @__PURE__ */
|
|
14160
|
+
/* @__PURE__ */ jsxs34("div", { className: "qt-property-history qt-query-history", role: "group", "aria-label": "Query history", children: [
|
|
14161
|
+
/* @__PURE__ */ jsx39(
|
|
13788
14162
|
"button",
|
|
13789
14163
|
{
|
|
13790
14164
|
type: "button",
|
|
@@ -13793,10 +14167,10 @@ function QueryBuilder({
|
|
|
13793
14167
|
title: "Undo query change",
|
|
13794
14168
|
disabled: !api.canUndo || isBusy,
|
|
13795
14169
|
onClick: api.undo,
|
|
13796
|
-
children: /* @__PURE__ */
|
|
14170
|
+
children: /* @__PURE__ */ jsx39(Icon, { name: "undo", size: 14 })
|
|
13797
14171
|
}
|
|
13798
14172
|
),
|
|
13799
|
-
/* @__PURE__ */
|
|
14173
|
+
/* @__PURE__ */ jsx39(
|
|
13800
14174
|
"button",
|
|
13801
14175
|
{
|
|
13802
14176
|
type: "button",
|
|
@@ -13805,10 +14179,10 @@ function QueryBuilder({
|
|
|
13805
14179
|
title: "Redo query change",
|
|
13806
14180
|
disabled: !api.canRedo || isBusy,
|
|
13807
14181
|
onClick: api.redo,
|
|
13808
|
-
children: /* @__PURE__ */
|
|
14182
|
+
children: /* @__PURE__ */ jsx39(Icon, { name: "redo", size: 14 })
|
|
13809
14183
|
}
|
|
13810
14184
|
),
|
|
13811
|
-
/* @__PURE__ */
|
|
14185
|
+
/* @__PURE__ */ jsx39(
|
|
13812
14186
|
"button",
|
|
13813
14187
|
{
|
|
13814
14188
|
type: "button",
|
|
@@ -13817,13 +14191,13 @@ function QueryBuilder({
|
|
|
13817
14191
|
title: "Reset query",
|
|
13818
14192
|
disabled: isBusy,
|
|
13819
14193
|
onClick: api.resetAll,
|
|
13820
|
-
children: /* @__PURE__ */
|
|
14194
|
+
children: /* @__PURE__ */ jsx39(Icon, { name: "reset", size: 14 })
|
|
13821
14195
|
}
|
|
13822
14196
|
)
|
|
13823
14197
|
] })
|
|
13824
14198
|
] }),
|
|
13825
|
-
!isCollapsed ? /* @__PURE__ */
|
|
13826
|
-
/* @__PURE__ */
|
|
14199
|
+
!isCollapsed ? /* @__PURE__ */ jsx39("div", { className: "qt-qb-bar qt-qb-editor-bar", children: /* @__PURE__ */ jsxs34("div", { id: bodyId, className: "qt-qb-body", children: [
|
|
14200
|
+
/* @__PURE__ */ jsx39(
|
|
13827
14201
|
SelectRow,
|
|
13828
14202
|
{
|
|
13829
14203
|
api,
|
|
@@ -13833,7 +14207,7 @@ function QueryBuilder({
|
|
|
13833
14207
|
presentation: selectPresentation
|
|
13834
14208
|
}
|
|
13835
14209
|
),
|
|
13836
|
-
whereRow ?? /* @__PURE__ */
|
|
14210
|
+
whereRow ?? /* @__PURE__ */ jsx39(
|
|
13837
14211
|
WhereRow,
|
|
13838
14212
|
{
|
|
13839
14213
|
api,
|
|
@@ -13844,7 +14218,7 @@ function QueryBuilder({
|
|
|
13844
14218
|
}
|
|
13845
14219
|
),
|
|
13846
14220
|
clauses,
|
|
13847
|
-
/* @__PURE__ */
|
|
14221
|
+
/* @__PURE__ */ jsx39(
|
|
13848
14222
|
OrderRow,
|
|
13849
14223
|
{
|
|
13850
14224
|
api,
|
|
@@ -13853,7 +14227,7 @@ function QueryBuilder({
|
|
|
13853
14227
|
disabled: isBusy
|
|
13854
14228
|
}
|
|
13855
14229
|
),
|
|
13856
|
-
/* @__PURE__ */
|
|
14230
|
+
/* @__PURE__ */ jsx39(
|
|
13857
14231
|
WindowRow,
|
|
13858
14232
|
{
|
|
13859
14233
|
api,
|
|
@@ -13863,7 +14237,7 @@ function QueryBuilder({
|
|
|
13863
14237
|
disabled: isBusy
|
|
13864
14238
|
}
|
|
13865
14239
|
),
|
|
13866
|
-
/* @__PURE__ */
|
|
14240
|
+
/* @__PURE__ */ jsx39(
|
|
13867
14241
|
MetricsRow,
|
|
13868
14242
|
{
|
|
13869
14243
|
api,
|
|
@@ -13873,8 +14247,8 @@ function QueryBuilder({
|
|
|
13873
14247
|
}
|
|
13874
14248
|
)
|
|
13875
14249
|
] }) }) : null,
|
|
13876
|
-
/* @__PURE__ */
|
|
13877
|
-
/* @__PURE__ */
|
|
14250
|
+
/* @__PURE__ */ jsxs34("div", { className: "qt-qb-bar qt-qb-run-bar qt-qb-row", children: [
|
|
14251
|
+
/* @__PURE__ */ jsx39(
|
|
13878
14252
|
"span",
|
|
13879
14253
|
{
|
|
13880
14254
|
className: "qt-qb-run-metric qt-qb-run-metric--strong",
|
|
@@ -13882,16 +14256,16 @@ function QueryBuilder({
|
|
|
13882
14256
|
children: api.loading ? "loading\u2026" : `${rowSummary} rows`
|
|
13883
14257
|
}
|
|
13884
14258
|
),
|
|
13885
|
-
/* @__PURE__ */
|
|
14259
|
+
/* @__PURE__ */ jsxs34("span", { className: "qt-qb-run-metric", children: [
|
|
13886
14260
|
"Last updated ",
|
|
13887
14261
|
lastUpdatedText
|
|
13888
14262
|
] }),
|
|
13889
|
-
failureText ? /* @__PURE__ */
|
|
13890
|
-
/* @__PURE__ */
|
|
13891
|
-
autoRefreshStatus ? /* @__PURE__ */
|
|
14263
|
+
failureText ? /* @__PURE__ */ jsx39("span", { className: "qt-qb-run-error", children: failureText }) : null,
|
|
14264
|
+
/* @__PURE__ */ jsxs34("span", { className: "qt-qb-run-actions", children: [
|
|
14265
|
+
autoRefreshStatus ? /* @__PURE__ */ jsx39("span", { className: "qt-qb-auto-status", children: `Every ${formatDuration2(autoRefreshStatus.frequencyMs)}; clear after ${formatDuration2(
|
|
13892
14266
|
autoRefreshStatus.turnOffAfterMs
|
|
13893
14267
|
)} (${autoRefreshStatus.pollCount} polls run)` }) : null,
|
|
13894
|
-
/* @__PURE__ */
|
|
14268
|
+
/* @__PURE__ */ jsx39(
|
|
13895
14269
|
"button",
|
|
13896
14270
|
{
|
|
13897
14271
|
type: "button",
|
|
@@ -13905,11 +14279,11 @@ function QueryBuilder({
|
|
|
13905
14279
|
"aria-expanded": showActivity,
|
|
13906
14280
|
"aria-controls": activityId,
|
|
13907
14281
|
onClick: () => setShowActivity((v) => !v),
|
|
13908
|
-
children: /* @__PURE__ */
|
|
14282
|
+
children: /* @__PURE__ */ jsx39(Icon, { name: "stopwatch" })
|
|
13909
14283
|
}
|
|
13910
14284
|
),
|
|
13911
|
-
/* @__PURE__ */
|
|
13912
|
-
/* @__PURE__ */
|
|
14285
|
+
/* @__PURE__ */ jsxs34("span", { className: "qt-auto-refresh", children: [
|
|
14286
|
+
/* @__PURE__ */ jsxs34(
|
|
13913
14287
|
"button",
|
|
13914
14288
|
{
|
|
13915
14289
|
type: "button",
|
|
@@ -13924,12 +14298,12 @@ function QueryBuilder({
|
|
|
13924
14298
|
"aria-expanded": showAutoRefresh,
|
|
13925
14299
|
title: autoRefreshStatus ? "View or clear auto-update" : "Configure auto-update",
|
|
13926
14300
|
children: [
|
|
13927
|
-
/* @__PURE__ */
|
|
14301
|
+
/* @__PURE__ */ jsx39(Icon, { name: "clock" }),
|
|
13928
14302
|
autoRefreshButtonText
|
|
13929
14303
|
]
|
|
13930
14304
|
}
|
|
13931
14305
|
),
|
|
13932
|
-
showAutoRefresh && autoRefreshRef.current ? /* @__PURE__ */
|
|
14306
|
+
showAutoRefresh && autoRefreshRef.current ? /* @__PURE__ */ jsxs34(
|
|
13933
14307
|
Popover,
|
|
13934
14308
|
{
|
|
13935
14309
|
anchor: autoRefreshRef.current,
|
|
@@ -13938,27 +14312,27 @@ function QueryBuilder({
|
|
|
13938
14312
|
label: "Auto-refresh settings",
|
|
13939
14313
|
onClose: () => setShowAutoRefresh(false),
|
|
13940
14314
|
children: [
|
|
13941
|
-
/* @__PURE__ */
|
|
13942
|
-
/* @__PURE__ */
|
|
13943
|
-
/* @__PURE__ */
|
|
14315
|
+
/* @__PURE__ */ jsxs34("label", { className: "qt-auto-refresh-field", children: [
|
|
14316
|
+
/* @__PURE__ */ jsx39("span", { children: "Frequency" }),
|
|
14317
|
+
/* @__PURE__ */ jsx39(
|
|
13944
14318
|
"select",
|
|
13945
14319
|
{
|
|
13946
14320
|
className: "qt-auto-refresh-select",
|
|
13947
14321
|
value: autoRefreshFrequencyMs,
|
|
13948
14322
|
onChange: (e) => setAutoRefreshFrequencyMs(Number(e.target.value)),
|
|
13949
|
-
children: AUTO_REFRESH_FREQUENCIES.map((option) => /* @__PURE__ */
|
|
14323
|
+
children: AUTO_REFRESH_FREQUENCIES.map((option) => /* @__PURE__ */ jsx39("option", { value: option.value, children: option.label }, option.value))
|
|
13950
14324
|
}
|
|
13951
14325
|
)
|
|
13952
14326
|
] }),
|
|
13953
|
-
/* @__PURE__ */
|
|
13954
|
-
/* @__PURE__ */
|
|
13955
|
-
/* @__PURE__ */
|
|
14327
|
+
/* @__PURE__ */ jsxs34("label", { className: "qt-auto-refresh-field", children: [
|
|
14328
|
+
/* @__PURE__ */ jsx39("span", { children: "Turn off after" }),
|
|
14329
|
+
/* @__PURE__ */ jsx39(
|
|
13956
14330
|
"select",
|
|
13957
14331
|
{
|
|
13958
14332
|
className: "qt-auto-refresh-select",
|
|
13959
14333
|
value: autoRefreshTurnOffAfterMs,
|
|
13960
14334
|
onChange: (e) => setAutoRefreshTurnOffAfterMs(Number(e.target.value)),
|
|
13961
|
-
children: AUTO_REFRESH_TURN_OFF_AFTER.map((option) => /* @__PURE__ */
|
|
14335
|
+
children: AUTO_REFRESH_TURN_OFF_AFTER.map((option) => /* @__PURE__ */ jsx39(
|
|
13962
14336
|
"option",
|
|
13963
14337
|
{
|
|
13964
14338
|
value: option.value,
|
|
@@ -13976,7 +14350,7 @@ function QueryBuilder({
|
|
|
13976
14350
|
}
|
|
13977
14351
|
)
|
|
13978
14352
|
] }),
|
|
13979
|
-
/* @__PURE__ */
|
|
14353
|
+
/* @__PURE__ */ jsx39(
|
|
13980
14354
|
"span",
|
|
13981
14355
|
{
|
|
13982
14356
|
className: cx5(
|
|
@@ -13986,7 +14360,7 @@ function QueryBuilder({
|
|
|
13986
14360
|
children: canSubmitAutoRefresh ? `${selectedAutoRefreshPolls} polls maximum` : `Choose between 1 and 1000 polls`
|
|
13987
14361
|
}
|
|
13988
14362
|
),
|
|
13989
|
-
autoRefreshStatus ? /* @__PURE__ */
|
|
14363
|
+
autoRefreshStatus ? /* @__PURE__ */ jsxs34("span", { className: "qt-auto-refresh-status", children: [
|
|
13990
14364
|
"Active: every",
|
|
13991
14365
|
" ",
|
|
13992
14366
|
formatDuration2(autoRefreshStatus.frequencyMs),
|
|
@@ -13997,8 +14371,8 @@ function QueryBuilder({
|
|
|
13997
14371
|
autoRefreshStatus.pollCount,
|
|
13998
14372
|
" polls run."
|
|
13999
14373
|
] }) : null,
|
|
14000
|
-
/* @__PURE__ */
|
|
14001
|
-
/* @__PURE__ */
|
|
14374
|
+
/* @__PURE__ */ jsxs34("span", { className: "qt-auto-refresh-actions", children: [
|
|
14375
|
+
/* @__PURE__ */ jsx39(
|
|
14002
14376
|
"button",
|
|
14003
14377
|
{
|
|
14004
14378
|
type: "button",
|
|
@@ -14008,7 +14382,7 @@ function QueryBuilder({
|
|
|
14008
14382
|
children: autoRefreshStatus ? "Update" : "Start"
|
|
14009
14383
|
}
|
|
14010
14384
|
),
|
|
14011
|
-
autoRefreshStatus ? /* @__PURE__ */
|
|
14385
|
+
autoRefreshStatus ? /* @__PURE__ */ jsx39(
|
|
14012
14386
|
"button",
|
|
14013
14387
|
{
|
|
14014
14388
|
type: "button",
|
|
@@ -14025,7 +14399,7 @@ function QueryBuilder({
|
|
|
14025
14399
|
}
|
|
14026
14400
|
) : null
|
|
14027
14401
|
] }),
|
|
14028
|
-
/* @__PURE__ */
|
|
14402
|
+
/* @__PURE__ */ jsxs34(
|
|
14029
14403
|
"button",
|
|
14030
14404
|
{
|
|
14031
14405
|
type: "button",
|
|
@@ -14033,7 +14407,7 @@ function QueryBuilder({
|
|
|
14033
14407
|
onClick: api.refresh,
|
|
14034
14408
|
disabled: isBusy,
|
|
14035
14409
|
children: [
|
|
14036
|
-
/* @__PURE__ */
|
|
14410
|
+
/* @__PURE__ */ jsx39(Icon, { name: "refresh" }),
|
|
14037
14411
|
"Run Now"
|
|
14038
14412
|
]
|
|
14039
14413
|
}
|
|
@@ -14041,8 +14415,8 @@ function QueryBuilder({
|
|
|
14041
14415
|
] })
|
|
14042
14416
|
] }),
|
|
14043
14417
|
groupingUI.overlays,
|
|
14044
|
-
showActivity && /* @__PURE__ */
|
|
14045
|
-
savedQueryControls === void 0 && showSaved ? /* @__PURE__ */
|
|
14418
|
+
showActivity && /* @__PURE__ */ jsx39(RequestActivity, { id: activityId, activity: api.requestActivity, children: requestActivityDetails }),
|
|
14419
|
+
savedQueryControls === void 0 && showSaved ? /* @__PURE__ */ jsx39(
|
|
14046
14420
|
SavedQueriesModal,
|
|
14047
14421
|
{
|
|
14048
14422
|
saved: api.saved,
|
|
@@ -14069,13 +14443,13 @@ function SelectRow({
|
|
|
14069
14443
|
}
|
|
14070
14444
|
}
|
|
14071
14445
|
const mobile = useMobileLayout();
|
|
14072
|
-
const [editingColumns, setEditingColumns] =
|
|
14073
|
-
const [editingField, setEditingField] =
|
|
14446
|
+
const [editingColumns, setEditingColumns] = useState31(false);
|
|
14447
|
+
const [editingField, setEditingField] = useState31();
|
|
14074
14448
|
function openColumnEditor(field) {
|
|
14075
14449
|
setEditingField(field);
|
|
14076
14450
|
setEditingColumns(true);
|
|
14077
14451
|
}
|
|
14078
|
-
const detailSettingsButton = (field) => field === ITEM_DETAILS_COLUMN3 && api.itemDetails ? /* @__PURE__ */
|
|
14452
|
+
const detailSettingsButton = (field) => field === ITEM_DETAILS_COLUMN3 && api.itemDetails ? /* @__PURE__ */ jsx39(
|
|
14079
14453
|
"button",
|
|
14080
14454
|
{
|
|
14081
14455
|
type: "button",
|
|
@@ -14086,11 +14460,11 @@ function SelectRow({
|
|
|
14086
14460
|
"aria-expanded": editingColumns && editingField === field,
|
|
14087
14461
|
disabled,
|
|
14088
14462
|
onClick: () => openColumnEditor(field),
|
|
14089
|
-
children: /* @__PURE__ */
|
|
14463
|
+
children: /* @__PURE__ */ jsx39(Icon, { name: "chevronRight", size: 18 })
|
|
14090
14464
|
}
|
|
14091
14465
|
) : null;
|
|
14092
|
-
const [adding, setAdding] =
|
|
14093
|
-
const addColumnRef =
|
|
14466
|
+
const [adding, setAdding] = useState31(false);
|
|
14467
|
+
const addColumnRef = useRef23(null);
|
|
14094
14468
|
const fieldLabelByName = useMemo12(
|
|
14095
14469
|
() => new Map(select.fields.map((f) => [f.name, f.label])),
|
|
14096
14470
|
[select.fields]
|
|
@@ -14101,10 +14475,10 @@ function SelectRow({
|
|
|
14101
14475
|
const fieldNames = select.visible.map((c) => c.field);
|
|
14102
14476
|
const dragSource = columnDrag.source;
|
|
14103
14477
|
const rendered = columnDrag.preview(fieldNames);
|
|
14104
|
-
const actions = /* @__PURE__ */
|
|
14105
|
-
/* @__PURE__ */
|
|
14106
|
-
/* @__PURE__ */
|
|
14107
|
-
/* @__PURE__ */
|
|
14478
|
+
const actions = /* @__PURE__ */ jsxs34(Fragment24, { children: [
|
|
14479
|
+
/* @__PURE__ */ jsxs34(PickerAnchor, { children: [
|
|
14480
|
+
/* @__PURE__ */ jsxs34("span", { className: "qt-split-btn", role: "group", "aria-label": "Column actions", children: [
|
|
14481
|
+
/* @__PURE__ */ jsxs34(
|
|
14108
14482
|
"button",
|
|
14109
14483
|
{
|
|
14110
14484
|
type: "button",
|
|
@@ -14116,12 +14490,12 @@ function SelectRow({
|
|
|
14116
14490
|
onClick: () => setAdding(!adding),
|
|
14117
14491
|
disabled: disabled || !presentation?.renderPicker && select.hidden.length === 0,
|
|
14118
14492
|
children: [
|
|
14119
|
-
/* @__PURE__ */
|
|
14493
|
+
/* @__PURE__ */ jsx39(Icon, { name: "add" }),
|
|
14120
14494
|
mobile ? "Add" : "add column"
|
|
14121
14495
|
]
|
|
14122
14496
|
}
|
|
14123
14497
|
),
|
|
14124
|
-
/* @__PURE__ */
|
|
14498
|
+
/* @__PURE__ */ jsx39(
|
|
14125
14499
|
"button",
|
|
14126
14500
|
{
|
|
14127
14501
|
type: "button",
|
|
@@ -14132,11 +14506,11 @@ function SelectRow({
|
|
|
14132
14506
|
"aria-expanded": editingColumns,
|
|
14133
14507
|
disabled,
|
|
14134
14508
|
onClick: () => openColumnEditor(),
|
|
14135
|
-
children: /* @__PURE__ */
|
|
14509
|
+
children: /* @__PURE__ */ jsx39(Icon, { name: "chevronRight", size: 18 })
|
|
14136
14510
|
}
|
|
14137
14511
|
)
|
|
14138
14512
|
] }),
|
|
14139
|
-
adding ? presentation?.renderPicker ? presentation.renderPicker(() => setAdding(false)) : /* @__PURE__ */
|
|
14513
|
+
adding ? presentation?.renderPicker ? presentation.renderPicker(() => setAdding(false)) : /* @__PURE__ */ jsx39(
|
|
14140
14514
|
FieldPicker,
|
|
14141
14515
|
{
|
|
14142
14516
|
anchor: addColumnRef.current ?? void 0,
|
|
@@ -14149,7 +14523,7 @@ function SelectRow({
|
|
|
14149
14523
|
}
|
|
14150
14524
|
) : null
|
|
14151
14525
|
] }),
|
|
14152
|
-
/* @__PURE__ */
|
|
14526
|
+
/* @__PURE__ */ jsx39(
|
|
14153
14527
|
"button",
|
|
14154
14528
|
{
|
|
14155
14529
|
type: "button",
|
|
@@ -14162,12 +14536,12 @@ function SelectRow({
|
|
|
14162
14536
|
}
|
|
14163
14537
|
)
|
|
14164
14538
|
] });
|
|
14165
|
-
return /* @__PURE__ */
|
|
14166
|
-
/* @__PURE__ */
|
|
14167
|
-
/* @__PURE__ */
|
|
14539
|
+
return /* @__PURE__ */ jsxs34("div", { className: "qt-qb-row qt-qb-row--select", children: [
|
|
14540
|
+
/* @__PURE__ */ jsxs34("div", { className: "qt-qb-section-header", children: [
|
|
14541
|
+
/* @__PURE__ */ jsx39("span", { className: "qt-qb-kw", "data-mobile-label": "Columns", children: "select" }),
|
|
14168
14542
|
mobile && actions
|
|
14169
14543
|
] }),
|
|
14170
|
-
editingColumns && (presentation?.renderEditor ? presentation.renderEditor(() => setEditingColumns(false)) : /* @__PURE__ */
|
|
14544
|
+
editingColumns && (presentation?.renderEditor ? presentation.renderEditor(() => setEditingColumns(false)) : /* @__PURE__ */ jsx39(
|
|
14171
14545
|
SelectColumnEditor,
|
|
14172
14546
|
{
|
|
14173
14547
|
api,
|
|
@@ -14176,7 +14550,7 @@ function SelectRow({
|
|
|
14176
14550
|
notice: presentation?.editorNotice
|
|
14177
14551
|
}
|
|
14178
14552
|
)),
|
|
14179
|
-
mobile ? /* @__PURE__ */
|
|
14553
|
+
mobile ? /* @__PURE__ */ jsx39(
|
|
14180
14554
|
ReorderList,
|
|
14181
14555
|
{
|
|
14182
14556
|
className: "qt-query-reorder-list qt-query-reorder-list--columns",
|
|
@@ -14188,10 +14562,10 @@ function SelectRow({
|
|
|
14188
14562
|
})),
|
|
14189
14563
|
onMove: select.move,
|
|
14190
14564
|
disabled,
|
|
14191
|
-
renderItem: (item) => /* @__PURE__ */
|
|
14192
|
-
presentation?.renderChip?.(item.id, item.label) ?? /* @__PURE__ */
|
|
14565
|
+
renderItem: (item) => /* @__PURE__ */ jsxs34(Fragment24, { children: [
|
|
14566
|
+
presentation?.renderChip?.(item.id, item.label) ?? /* @__PURE__ */ jsx39("span", { className: "qt-chip-field", children: item.label }),
|
|
14193
14567
|
detailSettingsButton(item.id),
|
|
14194
|
-
/* @__PURE__ */
|
|
14568
|
+
/* @__PURE__ */ jsx39(
|
|
14195
14569
|
"button",
|
|
14196
14570
|
{
|
|
14197
14571
|
type: "button",
|
|
@@ -14199,14 +14573,14 @@ function SelectRow({
|
|
|
14199
14573
|
onClick: () => removeColumn(item.id),
|
|
14200
14574
|
disabled,
|
|
14201
14575
|
"aria-label": `Remove ${item.label} column`,
|
|
14202
|
-
children: /* @__PURE__ */
|
|
14576
|
+
children: /* @__PURE__ */ jsx39(Icon, { name: "close" })
|
|
14203
14577
|
}
|
|
14204
14578
|
)
|
|
14205
14579
|
] })
|
|
14206
14580
|
}
|
|
14207
14581
|
) : rendered.map((name) => {
|
|
14208
14582
|
const label = fieldLabelByName.get(name) ?? name;
|
|
14209
|
-
return /* @__PURE__ */
|
|
14583
|
+
return /* @__PURE__ */ jsxs34(
|
|
14210
14584
|
"span",
|
|
14211
14585
|
{
|
|
14212
14586
|
className: cx5(
|
|
@@ -14249,10 +14623,10 @@ function SelectRow({
|
|
|
14249
14623
|
onDragEnd: () => columnDrag.end(),
|
|
14250
14624
|
title: "drag to reorder",
|
|
14251
14625
|
children: [
|
|
14252
|
-
/* @__PURE__ */
|
|
14253
|
-
presentation?.renderChip?.(name, label) ?? /* @__PURE__ */
|
|
14626
|
+
/* @__PURE__ */ jsx39("span", { "aria-hidden": true, className: "qt-chip-grip", children: /* @__PURE__ */ jsx39(Icon, { name: "grip" }) }),
|
|
14627
|
+
presentation?.renderChip?.(name, label) ?? /* @__PURE__ */ jsx39("span", { className: "qt-chip-field", children: label }),
|
|
14254
14628
|
detailSettingsButton(name),
|
|
14255
|
-
/* @__PURE__ */
|
|
14629
|
+
/* @__PURE__ */ jsx39(
|
|
14256
14630
|
"button",
|
|
14257
14631
|
{
|
|
14258
14632
|
type: "button",
|
|
@@ -14260,7 +14634,7 @@ function SelectRow({
|
|
|
14260
14634
|
onClick: () => removeColumn(name),
|
|
14261
14635
|
disabled,
|
|
14262
14636
|
"aria-label": `Remove ${label} column`,
|
|
14263
|
-
children: /* @__PURE__ */
|
|
14637
|
+
children: /* @__PURE__ */ jsx39(Icon, { name: "close" })
|
|
14264
14638
|
}
|
|
14265
14639
|
)
|
|
14266
14640
|
]
|
|
@@ -14281,7 +14655,7 @@ function QueryFilterRow({
|
|
|
14281
14655
|
() => new Map(fields.map((field) => [field.name, field])),
|
|
14282
14656
|
[fields]
|
|
14283
14657
|
);
|
|
14284
|
-
return /* @__PURE__ */
|
|
14658
|
+
return /* @__PURE__ */ jsx39(
|
|
14285
14659
|
WhereRow,
|
|
14286
14660
|
{
|
|
14287
14661
|
api,
|
|
@@ -14308,14 +14682,14 @@ function WhereRow({
|
|
|
14308
14682
|
disabled,
|
|
14309
14683
|
label = "where"
|
|
14310
14684
|
}) {
|
|
14311
|
-
const [adding, setAdding] =
|
|
14685
|
+
const [adding, setAdding] = useState31(false);
|
|
14312
14686
|
const mobile = useMobileLayout();
|
|
14313
|
-
const editorId =
|
|
14314
|
-
const nextSetId =
|
|
14315
|
-
const addFilterButton =
|
|
14316
|
-
const [editingSet, setEditingSet] =
|
|
14317
|
-
const [drag, setDrag] =
|
|
14318
|
-
const [editingFilter, setEditingFilter] =
|
|
14687
|
+
const editorId = useId11();
|
|
14688
|
+
const nextSetId = useRef23(0);
|
|
14689
|
+
const addFilterButton = useRef23(null);
|
|
14690
|
+
const [editingSet, setEditingSet] = useState31(null);
|
|
14691
|
+
const [drag, setDrag] = useState31(null);
|
|
14692
|
+
const [editingFilter, setEditingFilter] = useState31(null);
|
|
14319
14693
|
const where = api.query.where;
|
|
14320
14694
|
const whereSignature = JSON.stringify(where);
|
|
14321
14695
|
const setEditors = /* @__PURE__ */ new Map();
|
|
@@ -14330,7 +14704,7 @@ function WhereRow({
|
|
|
14330
14704
|
hiddenSetTerms.add(index + offset3);
|
|
14331
14705
|
index += set.count - 1;
|
|
14332
14706
|
}
|
|
14333
|
-
|
|
14707
|
+
useEffect22(() => {
|
|
14334
14708
|
if (editingSet && editingSet.signature !== whereSignature)
|
|
14335
14709
|
setEditingSet(null);
|
|
14336
14710
|
}, [editingSet, whereSignature]);
|
|
@@ -14400,9 +14774,9 @@ function WhereRow({
|
|
|
14400
14774
|
}
|
|
14401
14775
|
setDrag(null);
|
|
14402
14776
|
}
|
|
14403
|
-
const actions = /* @__PURE__ */
|
|
14404
|
-
/* @__PURE__ */
|
|
14405
|
-
/* @__PURE__ */
|
|
14777
|
+
const actions = /* @__PURE__ */ jsxs34(Fragment24, { children: [
|
|
14778
|
+
/* @__PURE__ */ jsxs34(PickerAnchor, { children: [
|
|
14779
|
+
/* @__PURE__ */ jsxs34(
|
|
14406
14780
|
"button",
|
|
14407
14781
|
{
|
|
14408
14782
|
ref: addFilterButton,
|
|
@@ -14414,12 +14788,12 @@ function WhereRow({
|
|
|
14414
14788
|
onClick: () => setAdding(!adding),
|
|
14415
14789
|
disabled,
|
|
14416
14790
|
children: [
|
|
14417
|
-
/* @__PURE__ */
|
|
14791
|
+
/* @__PURE__ */ jsx39(Icon, { name: "add" }),
|
|
14418
14792
|
label === "having" ? "having" : "add filter"
|
|
14419
14793
|
]
|
|
14420
14794
|
}
|
|
14421
14795
|
),
|
|
14422
|
-
adding && /* @__PURE__ */
|
|
14796
|
+
adding && /* @__PURE__ */ jsx39(
|
|
14423
14797
|
FieldPicker,
|
|
14424
14798
|
{
|
|
14425
14799
|
anchor: addFilterButton.current ?? void 0,
|
|
@@ -14430,7 +14804,7 @@ function WhereRow({
|
|
|
14430
14804
|
}
|
|
14431
14805
|
)
|
|
14432
14806
|
] }),
|
|
14433
|
-
where.length > 0 && /* @__PURE__ */
|
|
14807
|
+
where.length > 0 && /* @__PURE__ */ jsx39(
|
|
14434
14808
|
"button",
|
|
14435
14809
|
{
|
|
14436
14810
|
type: "button",
|
|
@@ -14442,18 +14816,18 @@ function WhereRow({
|
|
|
14442
14816
|
}
|
|
14443
14817
|
)
|
|
14444
14818
|
] });
|
|
14445
|
-
return /* @__PURE__ */
|
|
14446
|
-
/* @__PURE__ */
|
|
14447
|
-
/* @__PURE__ */
|
|
14819
|
+
return /* @__PURE__ */ jsxs34("div", { className: cx5("qt-qb-row qt-qb-row--filters", where.length === 0 && "qt-qb-row--unused"), "data-clause": label, children: [
|
|
14820
|
+
/* @__PURE__ */ jsxs34("div", { className: "qt-qb-section-header", children: [
|
|
14821
|
+
/* @__PURE__ */ jsx39("span", { className: "qt-qb-kw", "data-mobile-label": label === "having" ? "Having" : "Filters", children: label }),
|
|
14448
14822
|
mobile && actions
|
|
14449
14823
|
] }),
|
|
14450
14824
|
where.map((term, index) => {
|
|
14451
14825
|
if (hiddenSetTerms.has(index)) return null;
|
|
14452
14826
|
const set = setEditors.get(index);
|
|
14453
|
-
return /* @__PURE__ */
|
|
14454
|
-
index > 0 && hasOr && /* @__PURE__ */
|
|
14455
|
-
set ? /* @__PURE__ */
|
|
14456
|
-
/* @__PURE__ */
|
|
14827
|
+
return /* @__PURE__ */ jsxs34("span", { className: "qt-where-term-wrap", children: [
|
|
14828
|
+
index > 0 && hasOr && /* @__PURE__ */ jsx39("span", { className: "qt-where-and", children: "AND" }),
|
|
14829
|
+
set ? /* @__PURE__ */ jsxs34("span", { className: cx5("qt-chip", classNames?.chip), children: [
|
|
14830
|
+
/* @__PURE__ */ jsxs34(
|
|
14457
14831
|
"button",
|
|
14458
14832
|
{
|
|
14459
14833
|
type: "button",
|
|
@@ -14475,8 +14849,8 @@ function WhereRow({
|
|
|
14475
14849
|
]
|
|
14476
14850
|
}
|
|
14477
14851
|
),
|
|
14478
|
-
set.metadata.values.map((value) => /* @__PURE__ */
|
|
14479
|
-
/* @__PURE__ */
|
|
14852
|
+
set.metadata.values.map((value) => /* @__PURE__ */ jsxs34("span", { className: "qt-set-tag", children: [
|
|
14853
|
+
/* @__PURE__ */ jsx39(
|
|
14480
14854
|
PresentedFilterValue,
|
|
14481
14855
|
{
|
|
14482
14856
|
field: set.field.name,
|
|
@@ -14484,7 +14858,7 @@ function WhereRow({
|
|
|
14484
14858
|
label: setFilterValueLabel(set.field, value)
|
|
14485
14859
|
}
|
|
14486
14860
|
),
|
|
14487
|
-
/* @__PURE__ */
|
|
14861
|
+
/* @__PURE__ */ jsx39(
|
|
14488
14862
|
"button",
|
|
14489
14863
|
{
|
|
14490
14864
|
type: "button",
|
|
@@ -14505,7 +14879,7 @@ function WhereRow({
|
|
|
14505
14879
|
}
|
|
14506
14880
|
)
|
|
14507
14881
|
] }, value)),
|
|
14508
|
-
/* @__PURE__ */
|
|
14882
|
+
/* @__PURE__ */ jsx39(
|
|
14509
14883
|
"button",
|
|
14510
14884
|
{
|
|
14511
14885
|
type: "button",
|
|
@@ -14516,7 +14890,7 @@ function WhereRow({
|
|
|
14516
14890
|
children: "\u2715"
|
|
14517
14891
|
}
|
|
14518
14892
|
)
|
|
14519
|
-
] }) : /* @__PURE__ */
|
|
14893
|
+
] }) : /* @__PURE__ */ jsx39(
|
|
14520
14894
|
TermChip,
|
|
14521
14895
|
{
|
|
14522
14896
|
api,
|
|
@@ -14537,7 +14911,7 @@ function WhereRow({
|
|
|
14537
14911
|
)
|
|
14538
14912
|
] }, index);
|
|
14539
14913
|
}),
|
|
14540
|
-
editingSet && /* @__PURE__ */
|
|
14914
|
+
editingSet && /* @__PURE__ */ jsx39(
|
|
14541
14915
|
SetFilterEditor,
|
|
14542
14916
|
{
|
|
14543
14917
|
api,
|
|
@@ -14602,7 +14976,7 @@ function TermChip({
|
|
|
14602
14976
|
const group = isOrGroup(term);
|
|
14603
14977
|
const predicates = predicatesOf2(term);
|
|
14604
14978
|
if (mobile)
|
|
14605
|
-
return /* @__PURE__ */
|
|
14979
|
+
return /* @__PURE__ */ jsx39(
|
|
14606
14980
|
MobileFilter,
|
|
14607
14981
|
{
|
|
14608
14982
|
api,
|
|
@@ -14615,7 +14989,7 @@ function TermChip({
|
|
|
14615
14989
|
onOpenChange: onEditorChange
|
|
14616
14990
|
}
|
|
14617
14991
|
);
|
|
14618
|
-
const grip = /* @__PURE__ */
|
|
14992
|
+
const grip = /* @__PURE__ */ jsx39(
|
|
14619
14993
|
"span",
|
|
14620
14994
|
{
|
|
14621
14995
|
className: "qt-chip-grip",
|
|
@@ -14628,10 +15002,10 @@ function TermChip({
|
|
|
14628
15002
|
},
|
|
14629
15003
|
onDragEnd,
|
|
14630
15004
|
title: "drag to reorder, or drop onto another filter to make an OR",
|
|
14631
|
-
children: /* @__PURE__ */
|
|
15005
|
+
children: /* @__PURE__ */ jsx39(Icon, { name: "grip" })
|
|
14632
15006
|
}
|
|
14633
15007
|
);
|
|
14634
|
-
return /* @__PURE__ */
|
|
15008
|
+
return /* @__PURE__ */ jsxs34(
|
|
14635
15009
|
"span",
|
|
14636
15010
|
{
|
|
14637
15011
|
className: cx5(
|
|
@@ -14649,9 +15023,9 @@ function TermChip({
|
|
|
14649
15023
|
},
|
|
14650
15024
|
children: [
|
|
14651
15025
|
grip,
|
|
14652
|
-
group ? /* @__PURE__ */
|
|
14653
|
-
predIndex > 0 && /* @__PURE__ */
|
|
14654
|
-
/* @__PURE__ */
|
|
15026
|
+
group ? /* @__PURE__ */ jsx39("span", { className: "qt-or-group", children: predicates.map((clause, predIndex) => /* @__PURE__ */ jsxs34("span", { className: "qt-or-member", children: [
|
|
15027
|
+
predIndex > 0 && /* @__PURE__ */ jsx39("span", { className: "qt-chip-and qt-chip-or", children: "OR" }),
|
|
15028
|
+
/* @__PURE__ */ jsx39(
|
|
14655
15029
|
PredicateEditor,
|
|
14656
15030
|
{
|
|
14657
15031
|
api,
|
|
@@ -14663,7 +15037,7 @@ function TermChip({
|
|
|
14663
15037
|
onRemove: () => api.removePredicate(index, predIndex)
|
|
14664
15038
|
}
|
|
14665
15039
|
)
|
|
14666
|
-
] }, predIndex)) }) : /* @__PURE__ */
|
|
15040
|
+
] }, predIndex)) }) : /* @__PURE__ */ jsx39(
|
|
14667
15041
|
PredicateEditor,
|
|
14668
15042
|
{
|
|
14669
15043
|
api,
|
|
@@ -14690,8 +15064,8 @@ function MobileFilter({
|
|
|
14690
15064
|
onOpenChange
|
|
14691
15065
|
}) {
|
|
14692
15066
|
const predicates = predicatesOf2(term);
|
|
14693
|
-
return /* @__PURE__ */
|
|
14694
|
-
/* @__PURE__ */
|
|
15067
|
+
return /* @__PURE__ */ jsxs34(Fragment24, { children: [
|
|
15068
|
+
/* @__PURE__ */ jsx39(
|
|
14695
15069
|
MobileClauseSummary,
|
|
14696
15070
|
{
|
|
14697
15071
|
editLabel: `Edit filter: ${whereTermAsText(term, byName)}`,
|
|
@@ -14699,24 +15073,24 @@ function MobileFilter({
|
|
|
14699
15073
|
className: classNames?.chip,
|
|
14700
15074
|
filter: true,
|
|
14701
15075
|
onEdit: () => onOpenChange(true),
|
|
14702
|
-
children: /* @__PURE__ */
|
|
15076
|
+
children: /* @__PURE__ */ jsx39("span", { children: predicates.map((clause, position) => {
|
|
14703
15077
|
const strategy = byName.get(clause.field)?.filter?.values;
|
|
14704
15078
|
const option = strategy?.source === "static" ? strategy.options.find(
|
|
14705
15079
|
(choice) => typeof choice !== "string" && choice.value === clause.value
|
|
14706
15080
|
) : void 0;
|
|
14707
15081
|
const label = typeof option === "object" ? option.label : clause.value === "" ? '""' : clause.value;
|
|
14708
15082
|
const emptyStringCondition = clause.value === "0" && (clause.op === "length_eq" || clause.op === "length_gt");
|
|
14709
|
-
return /* @__PURE__ */
|
|
14710
|
-
position > 0 && /* @__PURE__ */
|
|
14711
|
-
/* @__PURE__ */
|
|
14712
|
-
/* @__PURE__ */
|
|
15083
|
+
return /* @__PURE__ */ jsxs34("span", { className: "qt-mobile-filter-summary", children: [
|
|
15084
|
+
position > 0 && /* @__PURE__ */ jsx39("small", { children: "OR" }),
|
|
15085
|
+
/* @__PURE__ */ jsx39("strong", { children: byName.get(clause.field)?.label ?? clause.field }),
|
|
15086
|
+
/* @__PURE__ */ jsxs34("span", { children: [
|
|
14713
15087
|
choiceLabel(
|
|
14714
15088
|
clause.op,
|
|
14715
15089
|
Boolean(clause.negated),
|
|
14716
15090
|
clause.value
|
|
14717
15091
|
),
|
|
14718
15092
|
" ",
|
|
14719
|
-
!NULLARY_OPS2.has(clause.op) && !emptyStringCondition && /* @__PURE__ */
|
|
15093
|
+
!NULLARY_OPS2.has(clause.op) && !emptyStringCondition && /* @__PURE__ */ jsx39(
|
|
14720
15094
|
PresentedFilterValue,
|
|
14721
15095
|
{
|
|
14722
15096
|
field: clause.field,
|
|
@@ -14729,15 +15103,15 @@ function MobileFilter({
|
|
|
14729
15103
|
}) })
|
|
14730
15104
|
}
|
|
14731
15105
|
),
|
|
14732
|
-
open && /* @__PURE__ */
|
|
15106
|
+
open && /* @__PURE__ */ jsx39(
|
|
14733
15107
|
ModalSurface,
|
|
14734
15108
|
{
|
|
14735
15109
|
title: predicates.length > 1 ? "Edit filter group" : `Filter by ${byName.get(predicates[0].field)?.label ?? predicates[0].field}`,
|
|
14736
15110
|
onClose: () => onOpenChange(false),
|
|
14737
|
-
children: /* @__PURE__ */
|
|
14738
|
-
predicates.map((clause, position) => /* @__PURE__ */
|
|
14739
|
-
position > 0 && /* @__PURE__ */
|
|
14740
|
-
/* @__PURE__ */
|
|
15111
|
+
children: /* @__PURE__ */ jsxs34("div", { className: "qt-overlay-body qt-filter-editor", children: [
|
|
15112
|
+
predicates.map((clause, position) => /* @__PURE__ */ jsxs34(Fragment23, { children: [
|
|
15113
|
+
position > 0 && /* @__PURE__ */ jsx39("p", { className: "qt-muted", children: "OR" }),
|
|
15114
|
+
/* @__PURE__ */ jsx39(
|
|
14741
15115
|
PredicateEditor,
|
|
14742
15116
|
{
|
|
14743
15117
|
api,
|
|
@@ -14754,7 +15128,7 @@ function MobileFilter({
|
|
|
14754
15128
|
}
|
|
14755
15129
|
)
|
|
14756
15130
|
] }, position)),
|
|
14757
|
-
predicates.length > 1 && /* @__PURE__ */
|
|
15131
|
+
predicates.length > 1 && /* @__PURE__ */ jsx39(
|
|
14758
15132
|
"button",
|
|
14759
15133
|
{
|
|
14760
15134
|
type: "button",
|
|
@@ -14768,9 +15142,9 @@ function MobileFilter({
|
|
|
14768
15142
|
children: "Remove filter group"
|
|
14769
15143
|
}
|
|
14770
15144
|
),
|
|
14771
|
-
api.query.where.length > 1 && /* @__PURE__ */
|
|
15145
|
+
api.query.where.length > 1 && /* @__PURE__ */ jsxs34("label", { className: "qt-filter-combine", children: [
|
|
14772
15146
|
"Match either filter (OR)",
|
|
14773
|
-
/* @__PURE__ */
|
|
15147
|
+
/* @__PURE__ */ jsxs34(
|
|
14774
15148
|
"select",
|
|
14775
15149
|
{
|
|
14776
15150
|
className: "qt-input",
|
|
@@ -14782,9 +15156,9 @@ function MobileFilter({
|
|
|
14782
15156
|
api.mergeFilters(index, Number(event.target.value));
|
|
14783
15157
|
},
|
|
14784
15158
|
children: [
|
|
14785
|
-
/* @__PURE__ */
|
|
15159
|
+
/* @__PURE__ */ jsx39("option", { value: "", children: "Combine with another filter\u2026" }),
|
|
14786
15160
|
api.query.where.map(
|
|
14787
|
-
(candidate, position) => position !== index && /* @__PURE__ */
|
|
15161
|
+
(candidate, position) => position !== index && /* @__PURE__ */ jsx39("option", { value: position, children: whereTermAsText(candidate, byName) }, position)
|
|
14788
15162
|
)
|
|
14789
15163
|
]
|
|
14790
15164
|
}
|
|
@@ -14837,7 +15211,7 @@ function OpPicker({
|
|
|
14837
15211
|
) : { op: choice.op, negated: false };
|
|
14838
15212
|
return resolved.op === clause.op && Boolean(resolved.negated) === Boolean(clause.negated);
|
|
14839
15213
|
};
|
|
14840
|
-
return /* @__PURE__ */
|
|
15214
|
+
return /* @__PURE__ */ jsx39("span", { className: "qt-op-picker", children: /* @__PURE__ */ jsx39(
|
|
14841
15215
|
MenuButton,
|
|
14842
15216
|
{
|
|
14843
15217
|
label: "Choose condition",
|
|
@@ -14847,15 +15221,15 @@ function OpPicker({
|
|
|
14847
15221
|
disabled: disabled || visiblePairs.length === 0,
|
|
14848
15222
|
"aria-label": choiceLabel(clause.op, Boolean(clause.negated), clause.value)
|
|
14849
15223
|
},
|
|
14850
|
-
trigger: /* @__PURE__ */
|
|
15224
|
+
trigger: /* @__PURE__ */ jsxs34(Fragment24, { children: [
|
|
14851
15225
|
choiceLabel(clause.op, Boolean(clause.negated), clause.value),
|
|
14852
|
-
/* @__PURE__ */
|
|
15226
|
+
/* @__PURE__ */ jsx39(Icon, { name: "chevronDown", size: 12, className: "qt-op-caret" })
|
|
14853
15227
|
] }),
|
|
14854
|
-
children: /* @__PURE__ */
|
|
14855
|
-
/* @__PURE__ */
|
|
14856
|
-
/* @__PURE__ */
|
|
14857
|
-
visiblePairs.map((pair, i) => /* @__PURE__ */
|
|
14858
|
-
/* @__PURE__ */
|
|
15228
|
+
children: /* @__PURE__ */ jsxs34(MenuGroup, { label: `Condition for ${field?.label ?? clause.field}`, columns: 2, className: "qt-op-pop", children: [
|
|
15229
|
+
/* @__PURE__ */ jsx39("span", { className: "qt-cm-col-head", children: "keep" }),
|
|
15230
|
+
/* @__PURE__ */ jsx39("span", { className: "qt-cm-col-head qt-cm-col-head--neg", children: "exclude" }),
|
|
15231
|
+
visiblePairs.map((pair, i) => /* @__PURE__ */ jsxs34(Fragment23, { children: [
|
|
15232
|
+
/* @__PURE__ */ jsx39(
|
|
14859
15233
|
MenuItem,
|
|
14860
15234
|
{
|
|
14861
15235
|
className: cx5("qt-op-cell", isActive(pair.keep) && "qt-op-cell--on"),
|
|
@@ -14865,7 +15239,7 @@ function OpPicker({
|
|
|
14865
15239
|
children: choiceLabel(pair.keep.op, pair.keep.negated, clause.value)
|
|
14866
15240
|
}
|
|
14867
15241
|
),
|
|
14868
|
-
/* @__PURE__ */
|
|
15242
|
+
/* @__PURE__ */ jsx39(
|
|
14869
15243
|
MenuItem,
|
|
14870
15244
|
{
|
|
14871
15245
|
className: cx5("qt-op-cell", "qt-op-cell--neg", isActive(pair.exclude) && "qt-op-cell--on"),
|
|
@@ -14903,7 +15277,7 @@ function PredicateEditor({
|
|
|
14903
15277
|
choice.negated ? negateClause2(next, field ? opsForField3(field) : void 0) : next
|
|
14904
15278
|
);
|
|
14905
15279
|
}
|
|
14906
|
-
const conditionControl = /* @__PURE__ */
|
|
15280
|
+
const conditionControl = /* @__PURE__ */ jsx39(
|
|
14907
15281
|
OpPicker,
|
|
14908
15282
|
{
|
|
14909
15283
|
field,
|
|
@@ -14913,12 +15287,16 @@ function PredicateEditor({
|
|
|
14913
15287
|
onPick: pickOp
|
|
14914
15288
|
}
|
|
14915
15289
|
);
|
|
14916
|
-
const valueControl = needsValue ? /* @__PURE__ */
|
|
15290
|
+
const valueControl = needsValue ? /* @__PURE__ */ jsx39(
|
|
14917
15291
|
ValueInput,
|
|
14918
15292
|
{
|
|
14919
15293
|
api,
|
|
14920
15294
|
field,
|
|
14921
15295
|
value: clause.value,
|
|
15296
|
+
contextKey: JSON.stringify(
|
|
15297
|
+
{ ...api.query, offset: 0 },
|
|
15298
|
+
(_key, entry) => entry === clause ? { ...clause, value: "" } : entry
|
|
15299
|
+
),
|
|
14922
15300
|
forceFreeform: isRegex || isLength,
|
|
14923
15301
|
numeric: isLength,
|
|
14924
15302
|
placeholder: isRegex ? "regex" : isLength ? "length" : field?.type === "datetime" ? "ISO date or signed duration" : "value",
|
|
@@ -14926,7 +15304,7 @@ function PredicateEditor({
|
|
|
14926
15304
|
onChange: (value) => onChange({ ...clause, value })
|
|
14927
15305
|
}
|
|
14928
15306
|
) : null;
|
|
14929
|
-
const removeControl = /* @__PURE__ */
|
|
15307
|
+
const removeControl = /* @__PURE__ */ jsx39(
|
|
14930
15308
|
"button",
|
|
14931
15309
|
{
|
|
14932
15310
|
type: "button",
|
|
@@ -14934,13 +15312,13 @@ function PredicateEditor({
|
|
|
14934
15312
|
onClick: onRemove,
|
|
14935
15313
|
disabled,
|
|
14936
15314
|
"aria-label": `Remove ${field?.label ?? clause.field} filter`,
|
|
14937
|
-
children: mobile ? "Remove filter" : /* @__PURE__ */
|
|
15315
|
+
children: mobile ? "Remove filter" : /* @__PURE__ */ jsx39(Icon, { name: "close" })
|
|
14938
15316
|
}
|
|
14939
15317
|
);
|
|
14940
15318
|
if (mobile)
|
|
14941
|
-
return /* @__PURE__ */
|
|
14942
|
-
showField && /* @__PURE__ */
|
|
14943
|
-
/* @__PURE__ */
|
|
15319
|
+
return /* @__PURE__ */ jsxs34("div", { className: "qt-mobile-predicate qt-mobile-form", children: [
|
|
15320
|
+
showField && /* @__PURE__ */ jsx39("strong", { className: "qt-mobile-form-field--wide", children: field?.label ?? clause.field }),
|
|
15321
|
+
/* @__PURE__ */ jsxs34(
|
|
14944
15322
|
"label",
|
|
14945
15323
|
{
|
|
14946
15324
|
className: cx5(
|
|
@@ -14948,19 +15326,19 @@ function PredicateEditor({
|
|
|
14948
15326
|
!needsValue && "qt-mobile-form-field--wide"
|
|
14949
15327
|
),
|
|
14950
15328
|
children: [
|
|
14951
|
-
/* @__PURE__ */
|
|
15329
|
+
/* @__PURE__ */ jsx39("span", { children: "Condition" }),
|
|
14952
15330
|
conditionControl
|
|
14953
15331
|
]
|
|
14954
15332
|
}
|
|
14955
15333
|
),
|
|
14956
|
-
valueControl && /* @__PURE__ */
|
|
14957
|
-
/* @__PURE__ */
|
|
15334
|
+
valueControl && /* @__PURE__ */ jsxs34("label", { className: "qt-mobile-form-field", children: [
|
|
15335
|
+
/* @__PURE__ */ jsx39("span", { children: "Value" }),
|
|
14958
15336
|
valueControl
|
|
14959
15337
|
] }),
|
|
14960
15338
|
removeControl
|
|
14961
15339
|
] });
|
|
14962
|
-
return /* @__PURE__ */
|
|
14963
|
-
/* @__PURE__ */
|
|
15340
|
+
return /* @__PURE__ */ jsxs34("span", { className: "qt-pred", children: [
|
|
15341
|
+
/* @__PURE__ */ jsx39("span", { className: "qt-chip-field", children: field?.label ?? clause.field }),
|
|
14964
15342
|
conditionControl,
|
|
14965
15343
|
valueControl,
|
|
14966
15344
|
removeControl
|
|
@@ -14970,6 +15348,7 @@ function ValueInput({
|
|
|
14970
15348
|
api,
|
|
14971
15349
|
field,
|
|
14972
15350
|
value,
|
|
15351
|
+
contextKey,
|
|
14973
15352
|
forceFreeform,
|
|
14974
15353
|
numeric: numeric2,
|
|
14975
15354
|
placeholder = "value",
|
|
@@ -14980,7 +15359,7 @@ function ValueInput({
|
|
|
14980
15359
|
const strategy = field ? filterValuesFor(field) : { source: "freeform" };
|
|
14981
15360
|
if (!forceFreeform && strategy.source === "static") {
|
|
14982
15361
|
if (presentation.render || presentation.label || strategy.options.some((o) => typeof o !== "string")) {
|
|
14983
|
-
return /* @__PURE__ */
|
|
15362
|
+
return /* @__PURE__ */ jsx39(
|
|
14984
15363
|
PresentedValueInput,
|
|
14985
15364
|
{
|
|
14986
15365
|
field: field?.name ?? "",
|
|
@@ -14990,7 +15369,7 @@ function ValueInput({
|
|
|
14990
15369
|
}
|
|
14991
15370
|
);
|
|
14992
15371
|
}
|
|
14993
|
-
return /* @__PURE__ */
|
|
15372
|
+
return /* @__PURE__ */ jsxs34(
|
|
14994
15373
|
"select",
|
|
14995
15374
|
{
|
|
14996
15375
|
className: cx5("qt-chip-val", classNames?.select),
|
|
@@ -14998,10 +15377,10 @@ function ValueInput({
|
|
|
14998
15377
|
value,
|
|
14999
15378
|
onChange: (e) => onChange(e.target.value),
|
|
15000
15379
|
children: [
|
|
15001
|
-
/* @__PURE__ */
|
|
15380
|
+
/* @__PURE__ */ jsx39("option", { value: "", children: "\u2014" }),
|
|
15002
15381
|
strategy.options.map((o) => {
|
|
15003
15382
|
const option = typeof o === "string" ? { value: o, label: o } : o;
|
|
15004
|
-
return /* @__PURE__ */
|
|
15383
|
+
return /* @__PURE__ */ jsx39("option", { value: option.value, children: option.label }, option.value);
|
|
15005
15384
|
})
|
|
15006
15385
|
]
|
|
15007
15386
|
}
|
|
@@ -15014,7 +15393,7 @@ function ValueInput({
|
|
|
15014
15393
|
5,
|
|
15015
15394
|
4
|
|
15016
15395
|
);
|
|
15017
|
-
return /* @__PURE__ */
|
|
15396
|
+
return /* @__PURE__ */ jsx39(
|
|
15018
15397
|
"input",
|
|
15019
15398
|
{
|
|
15020
15399
|
className: cx5("qt-chip-val", classNames?.input),
|
|
@@ -15029,63 +15408,19 @@ function ValueInput({
|
|
|
15029
15408
|
}
|
|
15030
15409
|
);
|
|
15031
15410
|
}
|
|
15032
|
-
return /* @__PURE__ */
|
|
15033
|
-
|
|
15411
|
+
return /* @__PURE__ */ jsx39(
|
|
15412
|
+
FilterValueAutocomplete,
|
|
15034
15413
|
{
|
|
15035
15414
|
api,
|
|
15036
15415
|
field,
|
|
15037
15416
|
value,
|
|
15038
|
-
|
|
15417
|
+
contextKey,
|
|
15418
|
+
className: cx5("qt-chip-val", classNames?.input),
|
|
15419
|
+
widthChars: chipFieldWidthForInput(value || "value", field.type, 5, 4),
|
|
15039
15420
|
onChange
|
|
15040
15421
|
}
|
|
15041
15422
|
);
|
|
15042
15423
|
}
|
|
15043
|
-
function AutocompleteInput({
|
|
15044
|
-
api,
|
|
15045
|
-
field,
|
|
15046
|
-
value,
|
|
15047
|
-
classNames,
|
|
15048
|
-
onChange
|
|
15049
|
-
}) {
|
|
15050
|
-
const [result, setResult] = useState30({
|
|
15051
|
-
values: [],
|
|
15052
|
-
hasMore: false
|
|
15053
|
-
});
|
|
15054
|
-
const listId = useId10();
|
|
15055
|
-
useEffect21(() => {
|
|
15056
|
-
let cancelled = false;
|
|
15057
|
-
const t = setTimeout(() => {
|
|
15058
|
-
void api.filterValues(field.name, value).then((r) => {
|
|
15059
|
-
if (!cancelled) setResult(r);
|
|
15060
|
-
}).catch(() => {
|
|
15061
|
-
if (!cancelled) setResult({ values: [], hasMore: false });
|
|
15062
|
-
});
|
|
15063
|
-
}, 200);
|
|
15064
|
-
return () => {
|
|
15065
|
-
cancelled = true;
|
|
15066
|
-
clearTimeout(t);
|
|
15067
|
-
};
|
|
15068
|
-
}, [api, field.name, value]);
|
|
15069
|
-
return /* @__PURE__ */ jsxs33("span", { className: "qt-autocomplete", children: [
|
|
15070
|
-
/* @__PURE__ */ jsx38(
|
|
15071
|
-
"input",
|
|
15072
|
-
{
|
|
15073
|
-
className: cx5("qt-chip-val", classNames?.input),
|
|
15074
|
-
value,
|
|
15075
|
-
placeholder: "value",
|
|
15076
|
-
"aria-label": `Value for ${field.label}`,
|
|
15077
|
-
list: listId,
|
|
15078
|
-
size: chipFieldWidthForInput(value || "value", field.type, 5, 4),
|
|
15079
|
-
style: {
|
|
15080
|
-
width: `${chipFieldWidthForInput(value || "value", field.type, 5, 4)}ch`
|
|
15081
|
-
},
|
|
15082
|
-
onChange: (e) => onChange(e.target.value)
|
|
15083
|
-
}
|
|
15084
|
-
),
|
|
15085
|
-
/* @__PURE__ */ jsx38("datalist", { id: listId, children: result.values.map((v) => /* @__PURE__ */ jsx38("option", { value: v }, v)) }),
|
|
15086
|
-
result.hasMore && /* @__PURE__ */ jsx38("span", { className: "qt-autocomplete-hint", children: "keep typing to refine\u2026" })
|
|
15087
|
-
] });
|
|
15088
|
-
}
|
|
15089
15424
|
function MobileClauseSummary({
|
|
15090
15425
|
editLabel,
|
|
15091
15426
|
disabled,
|
|
@@ -15094,7 +15429,7 @@ function MobileClauseSummary({
|
|
|
15094
15429
|
onEdit,
|
|
15095
15430
|
children
|
|
15096
15431
|
}) {
|
|
15097
|
-
return /* @__PURE__ */
|
|
15432
|
+
return /* @__PURE__ */ jsx39("div", { className: cx5("qt-mobile-clause", className), children: /* @__PURE__ */ jsxs34(
|
|
15098
15433
|
"button",
|
|
15099
15434
|
{
|
|
15100
15435
|
type: "button",
|
|
@@ -15107,7 +15442,7 @@ function MobileClauseSummary({
|
|
|
15107
15442
|
onClick: onEdit,
|
|
15108
15443
|
children: [
|
|
15109
15444
|
children,
|
|
15110
|
-
/* @__PURE__ */
|
|
15445
|
+
/* @__PURE__ */ jsx39("span", { className: "qt-mobile-filter-edit", children: /* @__PURE__ */ jsx39(Icon, { name: "pencil" }) })
|
|
15111
15446
|
]
|
|
15112
15447
|
}
|
|
15113
15448
|
) });
|
|
@@ -15123,20 +15458,20 @@ function MobileChipEditor({
|
|
|
15123
15458
|
}) {
|
|
15124
15459
|
const mobile = useMobileLayout();
|
|
15125
15460
|
if (!mobile) return children;
|
|
15126
|
-
return /* @__PURE__ */
|
|
15127
|
-
/* @__PURE__ */
|
|
15461
|
+
return /* @__PURE__ */ jsxs34(Fragment24, { children: [
|
|
15462
|
+
/* @__PURE__ */ jsx39(
|
|
15128
15463
|
MobileClauseSummary,
|
|
15129
15464
|
{
|
|
15130
15465
|
editLabel: `Edit ${title}: ${summary}`,
|
|
15131
15466
|
disabled,
|
|
15132
15467
|
onEdit: () => onOpenChange(true),
|
|
15133
|
-
children: /* @__PURE__ */
|
|
15134
|
-
/* @__PURE__ */
|
|
15135
|
-
/* @__PURE__ */
|
|
15468
|
+
children: /* @__PURE__ */ jsxs34("span", { className: "qt-mobile-filter-summary", children: [
|
|
15469
|
+
/* @__PURE__ */ jsx39("strong", { children: summaryTitle }),
|
|
15470
|
+
/* @__PURE__ */ jsx39("span", { children: summary })
|
|
15136
15471
|
] })
|
|
15137
15472
|
}
|
|
15138
15473
|
),
|
|
15139
|
-
open && /* @__PURE__ */
|
|
15474
|
+
open && /* @__PURE__ */ jsx39(ModalSurface, { title, onClose: () => onOpenChange(false), children: /* @__PURE__ */ jsx39("div", { className: "qt-overlay-body qt-mobile-chip-editor", children }) })
|
|
15140
15475
|
] });
|
|
15141
15476
|
}
|
|
15142
15477
|
function OrderTermChip({
|
|
@@ -15162,10 +15497,10 @@ function OrderTermChip({
|
|
|
15162
15497
|
}) {
|
|
15163
15498
|
const fieldHasNull = useFieldHasNull(api, field?.name);
|
|
15164
15499
|
const mobile = useMobileLayout();
|
|
15165
|
-
const [extractOpen, setExtractOpen] =
|
|
15500
|
+
const [extractOpen, setExtractOpen] = useState31(false);
|
|
15166
15501
|
const title = `Sort by ${label}`;
|
|
15167
15502
|
const summary = `${term.dir === "asc" ? "Ascending" : "Descending"}${showPriority ? ` \xB7 Priority ${priority}` : ""}${term.extract ? " \xB7 Regex extraction" : ""}`;
|
|
15168
|
-
const extractionEditor = extractOpen && /* @__PURE__ */
|
|
15503
|
+
const extractionEditor = extractOpen && /* @__PURE__ */ jsx39(
|
|
15169
15504
|
SortExtractionEditor,
|
|
15170
15505
|
{
|
|
15171
15506
|
api,
|
|
@@ -15185,8 +15520,8 @@ function OrderTermChip({
|
|
|
15185
15520
|
}
|
|
15186
15521
|
);
|
|
15187
15522
|
if (mobile)
|
|
15188
|
-
return /* @__PURE__ */
|
|
15189
|
-
/* @__PURE__ */
|
|
15523
|
+
return /* @__PURE__ */ jsxs34(Fragment24, { children: [
|
|
15524
|
+
/* @__PURE__ */ jsx39(
|
|
15190
15525
|
MobileChipEditor,
|
|
15191
15526
|
{
|
|
15192
15527
|
title,
|
|
@@ -15195,10 +15530,10 @@ function OrderTermChip({
|
|
|
15195
15530
|
disabled,
|
|
15196
15531
|
open: editorOpen,
|
|
15197
15532
|
onOpenChange: onEditorChange,
|
|
15198
|
-
children: /* @__PURE__ */
|
|
15199
|
-
/* @__PURE__ */
|
|
15200
|
-
/* @__PURE__ */
|
|
15201
|
-
/* @__PURE__ */
|
|
15533
|
+
children: /* @__PURE__ */ jsxs34("div", { className: "qt-mobile-form", children: [
|
|
15534
|
+
/* @__PURE__ */ jsxs34("label", { className: "qt-mobile-form-field", children: [
|
|
15535
|
+
/* @__PURE__ */ jsx39("span", { children: "Direction" }),
|
|
15536
|
+
/* @__PURE__ */ jsxs34(
|
|
15202
15537
|
"select",
|
|
15203
15538
|
{
|
|
15204
15539
|
className: cx5("qt-input", classNames?.select),
|
|
@@ -15208,15 +15543,15 @@ function OrderTermChip({
|
|
|
15208
15543
|
dir: event.target.value
|
|
15209
15544
|
}),
|
|
15210
15545
|
children: [
|
|
15211
|
-
/* @__PURE__ */
|
|
15212
|
-
/* @__PURE__ */
|
|
15546
|
+
/* @__PURE__ */ jsx39("option", { value: "asc", children: "Ascending" }),
|
|
15547
|
+
/* @__PURE__ */ jsx39("option", { value: "desc", children: "Descending" })
|
|
15213
15548
|
]
|
|
15214
15549
|
}
|
|
15215
15550
|
)
|
|
15216
15551
|
] }),
|
|
15217
|
-
(term.extract != null || fieldHasNull !== false) && /* @__PURE__ */
|
|
15218
|
-
/* @__PURE__ */
|
|
15219
|
-
/* @__PURE__ */
|
|
15552
|
+
(term.extract != null || fieldHasNull !== false) && /* @__PURE__ */ jsxs34("label", { className: "qt-mobile-form-field", children: [
|
|
15553
|
+
/* @__PURE__ */ jsx39("span", { children: "Null values" }),
|
|
15554
|
+
/* @__PURE__ */ jsxs34(
|
|
15220
15555
|
"select",
|
|
15221
15556
|
{
|
|
15222
15557
|
className: cx5("qt-input", classNames?.select),
|
|
@@ -15226,15 +15561,15 @@ function OrderTermChip({
|
|
|
15226
15561
|
nulls: event.target.value
|
|
15227
15562
|
}),
|
|
15228
15563
|
children: [
|
|
15229
|
-
/* @__PURE__ */
|
|
15230
|
-
/* @__PURE__ */
|
|
15564
|
+
/* @__PURE__ */ jsx39("option", { value: "last", children: "Last" }),
|
|
15565
|
+
/* @__PURE__ */ jsx39("option", { value: "first", children: "First" })
|
|
15231
15566
|
]
|
|
15232
15567
|
}
|
|
15233
15568
|
)
|
|
15234
15569
|
] }),
|
|
15235
|
-
/* @__PURE__ */
|
|
15236
|
-
/* @__PURE__ */
|
|
15237
|
-
/* @__PURE__ */
|
|
15570
|
+
/* @__PURE__ */ jsxs34("div", { className: "qt-mobile-form-field qt-mobile-form-field--wide", children: [
|
|
15571
|
+
/* @__PURE__ */ jsx39("span", { children: "Extraction" }),
|
|
15572
|
+
/* @__PURE__ */ jsxs34(
|
|
15238
15573
|
"button",
|
|
15239
15574
|
{
|
|
15240
15575
|
type: "button",
|
|
@@ -15243,13 +15578,13 @@ function OrderTermChip({
|
|
|
15243
15578
|
onClick: () => setExtractOpen(true),
|
|
15244
15579
|
"aria-label": `Configure regex extract for ${label}`,
|
|
15245
15580
|
children: [
|
|
15246
|
-
/* @__PURE__ */
|
|
15581
|
+
/* @__PURE__ */ jsx39(Icon, { name: term.extract ? "pencil" : "add" }),
|
|
15247
15582
|
term.extract ? "Edit regex extraction" : "regex extract"
|
|
15248
15583
|
]
|
|
15249
15584
|
}
|
|
15250
15585
|
)
|
|
15251
15586
|
] }),
|
|
15252
|
-
/* @__PURE__ */
|
|
15587
|
+
/* @__PURE__ */ jsx39("div", { className: "qt-mobile-form-actions", children: /* @__PURE__ */ jsx39(
|
|
15253
15588
|
"button",
|
|
15254
15589
|
{
|
|
15255
15590
|
type: "button",
|
|
@@ -15265,8 +15600,8 @@ function OrderTermChip({
|
|
|
15265
15600
|
),
|
|
15266
15601
|
extractionEditor
|
|
15267
15602
|
] });
|
|
15268
|
-
return /* @__PURE__ */
|
|
15269
|
-
/* @__PURE__ */
|
|
15603
|
+
return /* @__PURE__ */ jsxs34(Fragment24, { children: [
|
|
15604
|
+
/* @__PURE__ */ jsxs34(
|
|
15270
15605
|
"span",
|
|
15271
15606
|
{
|
|
15272
15607
|
className: cx5(
|
|
@@ -15290,10 +15625,10 @@ function OrderTermChip({
|
|
|
15290
15625
|
onDragEnd,
|
|
15291
15626
|
title: "drag to reorder sort priority",
|
|
15292
15627
|
children: [
|
|
15293
|
-
/* @__PURE__ */
|
|
15294
|
-
showPriority && /* @__PURE__ */
|
|
15295
|
-
/* @__PURE__ */
|
|
15296
|
-
/* @__PURE__ */
|
|
15628
|
+
/* @__PURE__ */ jsx39("span", { "aria-hidden": true, className: "qt-chip-grip", children: /* @__PURE__ */ jsx39(Icon, { name: "grip" }) }),
|
|
15629
|
+
showPriority && /* @__PURE__ */ jsx39("span", { className: "qt-chip-priority", children: priority }),
|
|
15630
|
+
/* @__PURE__ */ jsx39("span", { className: "qt-chip-field", children: label }),
|
|
15631
|
+
/* @__PURE__ */ jsxs34(
|
|
15297
15632
|
"button",
|
|
15298
15633
|
{
|
|
15299
15634
|
type: "button",
|
|
@@ -15301,12 +15636,12 @@ function OrderTermChip({
|
|
|
15301
15636
|
disabled,
|
|
15302
15637
|
onClick: () => updateTerm(dataIndex, { dir: term.dir === "asc" ? "desc" : "asc" }),
|
|
15303
15638
|
children: [
|
|
15304
|
-
/* @__PURE__ */
|
|
15639
|
+
/* @__PURE__ */ jsx39(Icon, { name: term.dir === "asc" ? "arrowUp" : "arrowDown" }),
|
|
15305
15640
|
term.dir === "asc" ? "asc" : "desc"
|
|
15306
15641
|
]
|
|
15307
15642
|
}
|
|
15308
15643
|
),
|
|
15309
|
-
term.extract && /* @__PURE__ */
|
|
15644
|
+
term.extract && /* @__PURE__ */ jsxs34(
|
|
15310
15645
|
"button",
|
|
15311
15646
|
{
|
|
15312
15647
|
type: "button",
|
|
@@ -15316,12 +15651,12 @@ function OrderTermChip({
|
|
|
15316
15651
|
disabled,
|
|
15317
15652
|
onClick: () => setExtractOpen(true),
|
|
15318
15653
|
children: [
|
|
15319
|
-
/* @__PURE__ */
|
|
15654
|
+
/* @__PURE__ */ jsx39(Icon, { name: "pencil" }),
|
|
15320
15655
|
"regex extraction"
|
|
15321
15656
|
]
|
|
15322
15657
|
}
|
|
15323
15658
|
),
|
|
15324
|
-
(term.extract != null || fieldHasNull !== false) && /* @__PURE__ */
|
|
15659
|
+
(term.extract != null || fieldHasNull !== false) && /* @__PURE__ */ jsxs34(
|
|
15325
15660
|
"button",
|
|
15326
15661
|
{
|
|
15327
15662
|
type: "button",
|
|
@@ -15337,7 +15672,7 @@ function OrderTermChip({
|
|
|
15337
15672
|
]
|
|
15338
15673
|
}
|
|
15339
15674
|
),
|
|
15340
|
-
/* @__PURE__ */
|
|
15675
|
+
/* @__PURE__ */ jsx39(
|
|
15341
15676
|
"button",
|
|
15342
15677
|
{
|
|
15343
15678
|
type: "button",
|
|
@@ -15345,7 +15680,7 @@ function OrderTermChip({
|
|
|
15345
15680
|
onClick: () => removeTerm(dataIndex),
|
|
15346
15681
|
disabled,
|
|
15347
15682
|
"aria-label": `Remove ${label} sort`,
|
|
15348
|
-
children: /* @__PURE__ */
|
|
15683
|
+
children: /* @__PURE__ */ jsx39(Icon, { name: "close" })
|
|
15349
15684
|
}
|
|
15350
15685
|
)
|
|
15351
15686
|
]
|
|
@@ -15366,11 +15701,11 @@ function OrderRow({
|
|
|
15366
15701
|
() => new Map(fields.map((f) => [f.name, f])),
|
|
15367
15702
|
[fields]
|
|
15368
15703
|
);
|
|
15369
|
-
const [drag, setDrag] =
|
|
15370
|
-
const [adding, setAdding] =
|
|
15371
|
-
const [regexField, setRegexField] =
|
|
15372
|
-
const [regexDirection, setRegexDirection] =
|
|
15373
|
-
const [editingSort, setEditingSort] =
|
|
15704
|
+
const [drag, setDrag] = useState31(null);
|
|
15705
|
+
const [adding, setAdding] = useState31(false);
|
|
15706
|
+
const [regexField, setRegexField] = useState31(null);
|
|
15707
|
+
const [regexDirection, setRegexDirection] = useState31("desc");
|
|
15708
|
+
const [editingSort, setEditingSort] = useState31(null);
|
|
15374
15709
|
function setOrderBy(next) {
|
|
15375
15710
|
api.setSort(next);
|
|
15376
15711
|
}
|
|
@@ -15463,7 +15798,7 @@ function OrderRow({
|
|
|
15463
15798
|
}
|
|
15464
15799
|
const renderTerm = (name, position) => {
|
|
15465
15800
|
const term = termByField.get(name);
|
|
15466
|
-
return /* @__PURE__ */
|
|
15801
|
+
return /* @__PURE__ */ jsx39(
|
|
15467
15802
|
OrderTermChip,
|
|
15468
15803
|
{
|
|
15469
15804
|
api,
|
|
@@ -15493,10 +15828,10 @@ function OrderRow({
|
|
|
15493
15828
|
const next = api.defaults.orderBy[i];
|
|
15494
15829
|
return term.field === next?.field && term.dir === next?.dir && (term.nulls ?? "last") === (next?.nulls ?? "last") && (term.extract?.regex ?? null) === (next?.extract?.regex ?? null);
|
|
15495
15830
|
});
|
|
15496
|
-
const actions = /* @__PURE__ */
|
|
15497
|
-
/* @__PURE__ */
|
|
15498
|
-
/* @__PURE__ */
|
|
15499
|
-
/* @__PURE__ */
|
|
15831
|
+
const actions = /* @__PURE__ */ jsxs34(Fragment24, { children: [
|
|
15832
|
+
/* @__PURE__ */ jsxs34(PickerAnchor, { children: [
|
|
15833
|
+
/* @__PURE__ */ jsxs34("span", { className: "qt-split-btn", role: "group", "aria-label": "Sort actions", children: [
|
|
15834
|
+
/* @__PURE__ */ jsxs34(
|
|
15500
15835
|
"button",
|
|
15501
15836
|
{
|
|
15502
15837
|
type: "button",
|
|
@@ -15507,12 +15842,12 @@ function OrderRow({
|
|
|
15507
15842
|
onClick: () => setAdding((previous) => !previous),
|
|
15508
15843
|
disabled: disabled || sortable.length === 0,
|
|
15509
15844
|
children: [
|
|
15510
|
-
/* @__PURE__ */
|
|
15845
|
+
/* @__PURE__ */ jsx39(Icon, { name: "add" }),
|
|
15511
15846
|
mobile ? "Add" : "add sort"
|
|
15512
15847
|
]
|
|
15513
15848
|
}
|
|
15514
15849
|
),
|
|
15515
|
-
/* @__PURE__ */
|
|
15850
|
+
/* @__PURE__ */ jsx39(
|
|
15516
15851
|
"button",
|
|
15517
15852
|
{
|
|
15518
15853
|
type: "button",
|
|
@@ -15523,11 +15858,11 @@ function OrderRow({
|
|
|
15523
15858
|
"aria-expanded": regexField != null,
|
|
15524
15859
|
disabled: disabled || sortable.length === 0,
|
|
15525
15860
|
onClick: () => openRegexConfigurator(),
|
|
15526
|
-
children: /* @__PURE__ */
|
|
15861
|
+
children: /* @__PURE__ */ jsx39(Icon, { name: "chevronRight", size: 18 })
|
|
15527
15862
|
}
|
|
15528
15863
|
)
|
|
15529
15864
|
] }),
|
|
15530
|
-
adding && /* @__PURE__ */
|
|
15865
|
+
adding && /* @__PURE__ */ jsx39(
|
|
15531
15866
|
SortPicker,
|
|
15532
15867
|
{
|
|
15533
15868
|
fields: sortable,
|
|
@@ -15537,7 +15872,7 @@ function OrderRow({
|
|
|
15537
15872
|
}
|
|
15538
15873
|
)
|
|
15539
15874
|
] }),
|
|
15540
|
-
!isDefaultOrderBy && /* @__PURE__ */
|
|
15875
|
+
!isDefaultOrderBy && /* @__PURE__ */ jsx39(
|
|
15541
15876
|
"button",
|
|
15542
15877
|
{
|
|
15543
15878
|
type: "button",
|
|
@@ -15548,13 +15883,13 @@ function OrderRow({
|
|
|
15548
15883
|
}
|
|
15549
15884
|
)
|
|
15550
15885
|
] });
|
|
15551
|
-
return /* @__PURE__ */
|
|
15552
|
-
/* @__PURE__ */
|
|
15553
|
-
/* @__PURE__ */
|
|
15886
|
+
return /* @__PURE__ */ jsxs34("div", { className: cx5("qt-qb-row qt-qb-row--sort", orderBy.length === 0 && "qt-qb-row--unused"), children: [
|
|
15887
|
+
/* @__PURE__ */ jsxs34("div", { className: "qt-qb-section-header", children: [
|
|
15888
|
+
/* @__PURE__ */ jsx39("span", { className: "qt-qb-kw", "data-mobile-label": "Sort", children: "order by" }),
|
|
15554
15889
|
mobile && actions
|
|
15555
15890
|
] }),
|
|
15556
|
-
orderBy.length === 0 && !adding && /* @__PURE__ */
|
|
15557
|
-
mobile && orderBy.length > 0 ? /* @__PURE__ */
|
|
15891
|
+
orderBy.length === 0 && !adding && /* @__PURE__ */ jsx39("span", { className: "qt-qb-hint", children: "(default)" }),
|
|
15892
|
+
mobile && orderBy.length > 0 ? /* @__PURE__ */ jsx39(
|
|
15558
15893
|
ReorderList,
|
|
15559
15894
|
{
|
|
15560
15895
|
className: "qt-query-reorder-list",
|
|
@@ -15576,7 +15911,7 @@ function OrderRow({
|
|
|
15576
15911
|
}
|
|
15577
15912
|
) : rendered.map(renderTerm),
|
|
15578
15913
|
!mobile && actions,
|
|
15579
|
-
regexField && /* @__PURE__ */
|
|
15914
|
+
regexField && /* @__PURE__ */ jsx39(
|
|
15580
15915
|
SortExtractionEditor,
|
|
15581
15916
|
{
|
|
15582
15917
|
api,
|
|
@@ -15617,17 +15952,17 @@ function WindowRow({
|
|
|
15617
15952
|
compact
|
|
15618
15953
|
}) {
|
|
15619
15954
|
const { query } = api;
|
|
15620
|
-
const offsetId =
|
|
15621
|
-
const [addingOffset, setAddingOffset] =
|
|
15622
|
-
const offsetInput =
|
|
15623
|
-
const [limitDraft, setLimitDraft] =
|
|
15624
|
-
const [offsetDraft, setOffsetDraft] =
|
|
15625
|
-
|
|
15626
|
-
|
|
15627
|
-
|
|
15955
|
+
const offsetId = useId11();
|
|
15956
|
+
const [addingOffset, setAddingOffset] = useState31(false);
|
|
15957
|
+
const offsetInput = useRef23(null);
|
|
15958
|
+
const [limitDraft, setLimitDraft] = useState31(String(query.limit));
|
|
15959
|
+
const [offsetDraft, setOffsetDraft] = useState31(String(query.offset));
|
|
15960
|
+
useEffect22(() => setLimitDraft(String(query.limit)), [query.limit]);
|
|
15961
|
+
useEffect22(() => setOffsetDraft(String(query.offset)), [query.offset]);
|
|
15962
|
+
useEffect22(() => {
|
|
15628
15963
|
if (query.offset > 0) setAddingOffset(false);
|
|
15629
15964
|
}, [query.offset]);
|
|
15630
|
-
|
|
15965
|
+
useEffect22(() => {
|
|
15631
15966
|
if (addingOffset) {
|
|
15632
15967
|
offsetInput.current?.focus();
|
|
15633
15968
|
offsetInput.current?.select();
|
|
@@ -15639,10 +15974,10 @@ function WindowRow({
|
|
|
15639
15974
|
function commitOffset() {
|
|
15640
15975
|
api.setOffset(Math.max(0, Number(offsetDraft) || 0));
|
|
15641
15976
|
}
|
|
15642
|
-
return /* @__PURE__ */
|
|
15643
|
-
/* @__PURE__ */
|
|
15644
|
-
/* @__PURE__ */
|
|
15645
|
-
/* @__PURE__ */
|
|
15977
|
+
return /* @__PURE__ */ jsxs34("div", { className: "qt-qb-row qt-qb-pagination", children: [
|
|
15978
|
+
/* @__PURE__ */ jsxs34("label", { className: "qt-qb-window-field", children: [
|
|
15979
|
+
/* @__PURE__ */ jsx39("span", { className: "qt-qb-kw", "data-mobile-label": "Limit", children: "limit" }),
|
|
15980
|
+
/* @__PURE__ */ jsx39(
|
|
15646
15981
|
"input",
|
|
15647
15982
|
{
|
|
15648
15983
|
className: cx5("qt-qb-num", classNames?.input),
|
|
@@ -15656,8 +15991,8 @@ function WindowRow({
|
|
|
15656
15991
|
}
|
|
15657
15992
|
)
|
|
15658
15993
|
] }),
|
|
15659
|
-
!compact || query.offset > 0 || addingOffset ? /* @__PURE__ */
|
|
15660
|
-
/* @__PURE__ */
|
|
15994
|
+
!compact || query.offset > 0 || addingOffset ? /* @__PURE__ */ jsxs34("div", { className: "qt-qb-window-field", children: [
|
|
15995
|
+
/* @__PURE__ */ jsx39(
|
|
15661
15996
|
"label",
|
|
15662
15997
|
{
|
|
15663
15998
|
className: "qt-qb-kw",
|
|
@@ -15666,8 +16001,8 @@ function WindowRow({
|
|
|
15666
16001
|
children: "offset"
|
|
15667
16002
|
}
|
|
15668
16003
|
),
|
|
15669
|
-
/* @__PURE__ */
|
|
15670
|
-
/* @__PURE__ */
|
|
16004
|
+
/* @__PURE__ */ jsxs34("span", { className: "qt-qb-num-combo", children: [
|
|
16005
|
+
/* @__PURE__ */ jsx39(
|
|
15671
16006
|
"input",
|
|
15672
16007
|
{
|
|
15673
16008
|
ref: offsetInput,
|
|
@@ -15682,7 +16017,7 @@ function WindowRow({
|
|
|
15682
16017
|
onKeyDown: (e) => e.key === "Enter" && commitOffset()
|
|
15683
16018
|
}
|
|
15684
16019
|
),
|
|
15685
|
-
query.offset >= query.limit && /* @__PURE__ */
|
|
16020
|
+
query.offset >= query.limit && /* @__PURE__ */ jsxs34(
|
|
15686
16021
|
"button",
|
|
15687
16022
|
{
|
|
15688
16023
|
type: "button",
|
|
@@ -15697,7 +16032,7 @@ function WindowRow({
|
|
|
15697
16032
|
]
|
|
15698
16033
|
}
|
|
15699
16034
|
),
|
|
15700
|
-
/* @__PURE__ */
|
|
16035
|
+
/* @__PURE__ */ jsxs34(
|
|
15701
16036
|
"button",
|
|
15702
16037
|
{
|
|
15703
16038
|
type: "button",
|
|
@@ -15713,12 +16048,12 @@ function WindowRow({
|
|
|
15713
16048
|
}
|
|
15714
16049
|
)
|
|
15715
16050
|
] }),
|
|
15716
|
-
compact && /* @__PURE__ */
|
|
16051
|
+
compact && /* @__PURE__ */ jsx39("button", { type: "button", className: "qt-chip-x", "aria-label": "Clear offset", disabled, onClick: () => {
|
|
15717
16052
|
setAddingOffset(false);
|
|
15718
16053
|
api.setOffset(0);
|
|
15719
|
-
}, children: /* @__PURE__ */
|
|
15720
|
-
] }) : /* @__PURE__ */
|
|
15721
|
-
/* @__PURE__ */
|
|
16054
|
+
}, children: /* @__PURE__ */ jsx39(Icon, { name: "close" }) })
|
|
16055
|
+
] }) : /* @__PURE__ */ jsxs34("button", { type: "button", className: "qt-add", "aria-label": "Add offset", disabled, onClick: () => setAddingOffset(true), children: [
|
|
16056
|
+
/* @__PURE__ */ jsx39(Icon, { name: "add" }),
|
|
15722
16057
|
"add offset"
|
|
15723
16058
|
] })
|
|
15724
16059
|
] });
|
|
@@ -15729,7 +16064,7 @@ function MetricsRow({
|
|
|
15729
16064
|
theme,
|
|
15730
16065
|
locale
|
|
15731
16066
|
}) {
|
|
15732
|
-
const [editing, setEditing] =
|
|
16067
|
+
const [editing, setEditing] = useState31(false);
|
|
15733
16068
|
const allFields = useMemo12(
|
|
15734
16069
|
() => [
|
|
15735
16070
|
...fields,
|
|
@@ -15739,10 +16074,10 @@ function MetricsRow({
|
|
|
15739
16074
|
],
|
|
15740
16075
|
[fields, api.computed.catalogue]
|
|
15741
16076
|
);
|
|
15742
|
-
return /* @__PURE__ */
|
|
15743
|
-
api.aggregations.clauses.length === 0 && /* @__PURE__ */
|
|
15744
|
-
/* @__PURE__ */
|
|
15745
|
-
/* @__PURE__ */
|
|
16077
|
+
return /* @__PURE__ */ jsxs34(Fragment24, { children: [
|
|
16078
|
+
api.aggregations.clauses.length === 0 && /* @__PURE__ */ jsx39("div", { className: "qt-qb-row qt-qb-row--metrics qt-qb-row--unused", children: /* @__PURE__ */ jsxs34("div", { className: "qt-qb-section-header", children: [
|
|
16079
|
+
/* @__PURE__ */ jsx39("span", { className: "qt-qb-kw", "data-mobile-label": "Metrics", children: "metrics" }),
|
|
16080
|
+
/* @__PURE__ */ jsxs34(
|
|
15746
16081
|
"button",
|
|
15747
16082
|
{
|
|
15748
16083
|
type: "button",
|
|
@@ -15751,14 +16086,14 @@ function MetricsRow({
|
|
|
15751
16086
|
"aria-haspopup": "dialog",
|
|
15752
16087
|
onClick: () => setEditing(true),
|
|
15753
16088
|
children: [
|
|
15754
|
-
/* @__PURE__ */
|
|
16089
|
+
/* @__PURE__ */ jsx39(Icon, { name: "add" }),
|
|
15755
16090
|
"add metric",
|
|
15756
|
-
/* @__PURE__ */
|
|
16091
|
+
/* @__PURE__ */ jsx39(Icon, { name: "arrowRight", size: 14 })
|
|
15757
16092
|
]
|
|
15758
16093
|
}
|
|
15759
16094
|
)
|
|
15760
16095
|
] }) }),
|
|
15761
|
-
editing && /* @__PURE__ */
|
|
16096
|
+
editing && /* @__PURE__ */ jsx39(
|
|
15762
16097
|
MetricsEditor,
|
|
15763
16098
|
{
|
|
15764
16099
|
api,
|
|
@@ -15772,17 +16107,17 @@ function MetricsRow({
|
|
|
15772
16107
|
}
|
|
15773
16108
|
|
|
15774
16109
|
// src/SelectionToolbar.tsx
|
|
15775
|
-
import { jsx as
|
|
16110
|
+
import { jsx as jsx40, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
15776
16111
|
var cx6 = (...parts) => parts.filter(Boolean).join(" ");
|
|
15777
16112
|
function SelectionToolbar({ selection, actions, alwaysShow, className }) {
|
|
15778
16113
|
if (selection.count === 0 && !alwaysShow) return null;
|
|
15779
16114
|
const selectedIds = [...selection.selected];
|
|
15780
|
-
return /* @__PURE__ */
|
|
15781
|
-
/* @__PURE__ */
|
|
16115
|
+
return /* @__PURE__ */ jsxs35("div", { className: cx6("qt-selection-toolbar", className), role: "toolbar", children: [
|
|
16116
|
+
/* @__PURE__ */ jsxs35("span", { className: "qt-selection-count", children: [
|
|
15782
16117
|
selection.count,
|
|
15783
16118
|
" selected"
|
|
15784
16119
|
] }),
|
|
15785
|
-
/* @__PURE__ */
|
|
16120
|
+
/* @__PURE__ */ jsx40(
|
|
15786
16121
|
"button",
|
|
15787
16122
|
{
|
|
15788
16123
|
type: "button",
|
|
@@ -15792,7 +16127,7 @@ function SelectionToolbar({ selection, actions, alwaysShow, className }) {
|
|
|
15792
16127
|
children: "clear"
|
|
15793
16128
|
}
|
|
15794
16129
|
),
|
|
15795
|
-
/* @__PURE__ */
|
|
16130
|
+
/* @__PURE__ */ jsx40("span", { className: "qt-selection-actions", children: actions(selectedIds, selection) })
|
|
15796
16131
|
] });
|
|
15797
16132
|
}
|
|
15798
16133
|
export {
|