react-semaphor 0.1.62 → 0.1.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/dashboard-plus-BT1JEFt7.js +17438 -0
- package/dist/chunks/dashboard-plus-C7mXurPl.js +235 -0
- package/dist/chunks/index-DHzLB6Yx.js +1045 -0
- package/dist/chunks/{index--MUeDITx.js → index-Dji-XteI.js} +25747 -28323
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.js +106 -107
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +1 -1
- package/dist/types/main.d.ts +0 -8
- package/package.json +1 -1
- package/dist/chunks/axis-mapping-8ZVwlkl6.js +0 -315
- package/dist/chunks/axis-mapping-Cwa3KrDR.js +0 -16
- package/dist/chunks/bar-chart-settings-B_WyC-7g.js +0 -52
- package/dist/chunks/bar-chart-settings-CvorW7RD.js +0 -1
- package/dist/chunks/bubble-chart-settings-BPtESqYK.js +0 -1
- package/dist/chunks/bubble-chart-settings-CxFAlErV.js +0 -50
- package/dist/chunks/common-chart-settings-CvRrQf-H.js +0 -1
- package/dist/chunks/common-chart-settings-D3ww0Xtx.js +0 -147
- package/dist/chunks/custom-visual-settings-DXWyN2Dr.js +0 -11
- package/dist/chunks/custom-visual-settings-m5o8R5tL.js +0 -243
- package/dist/chunks/dashboard-plus-B8-ocT_Z.js +0 -41
- package/dist/chunks/dashboard-plus-DSUKhvcv.js +0 -2941
- package/dist/chunks/display-labels-BYsRReye.js +0 -1
- package/dist/chunks/display-labels-C_jsL0Jo.js +0 -74
- package/dist/chunks/editor-C7xQi9Ab.js +0 -105
- package/dist/chunks/editor-DqvyBUrl.js +0 -8321
- package/dist/chunks/filter-on-click-columns-6dRYhvgz.js +0 -1
- package/dist/chunks/filter-on-click-columns-BJUGTE6W.js +0 -120
- package/dist/chunks/frame-filters-D9sDN4Vm.js +0 -1
- package/dist/chunks/frame-filters-DFgqSoV2.js +0 -75
- package/dist/chunks/index-Bvtpj-_R.js +0 -1080
- package/dist/chunks/kpi-settings-BONvmfNr.js +0 -1
- package/dist/chunks/kpi-settings-CI-9fp4Z.js +0 -286
- package/dist/chunks/map-chart-settings-CSxZdu_g.js +0 -1
- package/dist/chunks/map-chart-settings-DQIN7Pn8.js +0 -334
- package/dist/chunks/pie-chart-settings-CN3JCLdP.js +0 -86
- package/dist/chunks/pie-chart-settings-CsErfZOL.js +0 -1
- package/dist/chunks/reusable-select-CQbD03nT.js +0 -40
- package/dist/chunks/reusable-select-CVRzPWkg.js +0 -1
- package/dist/chunks/stacked-chart-settings-BfqHFFqA.js +0 -1
- package/dist/chunks/stacked-chart-settings-poYotO6Q.js +0 -90
- package/dist/chunks/table-visual-settings-B46pdUra.js +0 -46
- package/dist/chunks/table-visual-settings-ZKWuNokZ.js +0 -1
- package/dist/chunks/tag-BrxBSbSe.js +0 -20
- package/dist/chunks/tag-D9G2kz2B.js +0 -6
- package/dist/chunks/use-assign-filter-5gplfsO1.js +0 -83
- package/dist/chunks/use-assign-filter-DzmBSsyO.js +0 -1
- package/dist/chunks/use-local-storage-state-CBh2HHB9.js +0 -16
- package/dist/chunks/use-local-storage-state-CL0JsTZM.js +0 -1745
- package/dist/chunks/use-plugin-query-DA6Yrp7P.js +0 -12
- package/dist/chunks/use-plugin-query-JdHNPYZS.js +0 -1
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { jsxs as a, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { memo as u } from "react";
|
|
3
|
-
import { u as m, Y as h, Z as d, A as p, a as r, b as n, t as x, c as o } from "./index--MUeDITx.js";
|
|
4
|
-
import { F as f } from "./filter-on-click-columns-BJUGTE6W.js";
|
|
5
|
-
import "react-dom";
|
|
6
|
-
import { F as g } from "./frame-filters-DFgqSoV2.js";
|
|
7
|
-
function y() {
|
|
8
|
-
var l;
|
|
9
|
-
const t = m((i) => i.card.preferences), { setCardPreferences: s } = m((i) => i.actions);
|
|
10
|
-
function c(i) {
|
|
11
|
-
s({
|
|
12
|
-
...t,
|
|
13
|
-
textVisualOptions: {
|
|
14
|
-
...t == null ? void 0 : t.textVisualOptions,
|
|
15
|
-
isDynamicText: i === "dynamic"
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
return /* @__PURE__ */ a(
|
|
20
|
-
h,
|
|
21
|
-
{
|
|
22
|
-
value: (l = t == null ? void 0 : t.textVisualOptions) != null && l.isDynamicText ? "dynamic" : "static",
|
|
23
|
-
onValueChange: c,
|
|
24
|
-
className: "flex gap-3",
|
|
25
|
-
defaultValue: "x",
|
|
26
|
-
children: [
|
|
27
|
-
/* @__PURE__ */ a("div", { className: "flex items-center space-x-2", children: [
|
|
28
|
-
/* @__PURE__ */ e(d, { value: "static", id: "r1" }),
|
|
29
|
-
/* @__PURE__ */ e("label", { className: "text-sm", htmlFor: "r1", children: "Static" })
|
|
30
|
-
] }),
|
|
31
|
-
/* @__PURE__ */ a("div", { className: "flex items-center space-x-2", children: [
|
|
32
|
-
/* @__PURE__ */ e(d, { value: "dynamic", id: "r2" }),
|
|
33
|
-
/* @__PURE__ */ e("label", { className: "text-sm", htmlFor: "r2", children: "Dynamic" })
|
|
34
|
-
] })
|
|
35
|
-
]
|
|
36
|
-
}
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
function v({
|
|
40
|
-
cardType: t,
|
|
41
|
-
docContent: s,
|
|
42
|
-
suffix: c = "Chart"
|
|
43
|
-
}) {
|
|
44
|
-
let l = "pie-donut-polar";
|
|
45
|
-
return t === "funnel" && (l = "funnel"), /* @__PURE__ */ e("div", { className: "space-y-6 px-6 py-2", children: /* @__PURE__ */ a(p, { defaultValue: ["item-2"], type: "multiple", children: [
|
|
46
|
-
/* @__PURE__ */ a(r, { value: "item-1", children: [
|
|
47
|
-
/* @__PURE__ */ e(n, { children: `${x(t)} ${c}` }),
|
|
48
|
-
/* @__PURE__ */ e(o, { children: s || /* @__PURE__ */ a("div", { className: "space-y-4 font-mono text-xs", children: [
|
|
49
|
-
/* @__PURE__ */ e("div", { className: "rounded bg-muted px-2 py-1 text-xs", children: "SELECT label, measure FROM table" }),
|
|
50
|
-
/* @__PURE__ */ a("ul", { className: "ml-6 list-disc text-xs [&>li]:mt-2", children: [
|
|
51
|
-
/* @__PURE__ */ e("li", { children: "label - category" }),
|
|
52
|
-
/* @__PURE__ */ e("li", { children: "measure - number" })
|
|
53
|
-
] }),
|
|
54
|
-
/* @__PURE__ */ a("div", { children: [
|
|
55
|
-
"See ",
|
|
56
|
-
/* @__PURE__ */ e(
|
|
57
|
-
"a",
|
|
58
|
-
{
|
|
59
|
-
target: "_blank",
|
|
60
|
-
onClick: (i) => i.stopPropagation(),
|
|
61
|
-
className: "text-blue-700",
|
|
62
|
-
href: `https://docs.semaphor.cloud/docs/charts/${l}`,
|
|
63
|
-
children: "example"
|
|
64
|
-
}
|
|
65
|
-
),
|
|
66
|
-
" in the docs."
|
|
67
|
-
] })
|
|
68
|
-
] }) })
|
|
69
|
-
] }),
|
|
70
|
-
t === "text" && /* @__PURE__ */ a(r, { value: "item-2", children: [
|
|
71
|
-
/* @__PURE__ */ e(n, { children: "Settings" }),
|
|
72
|
-
/* @__PURE__ */ e(o, { className: "space-y-4 px-2 py-4", children: /* @__PURE__ */ e(y, {}) })
|
|
73
|
-
] }),
|
|
74
|
-
!["range", "text"].includes(t) && /* @__PURE__ */ a(r, { value: "item-3", children: [
|
|
75
|
-
/* @__PURE__ */ e(n, { children: "Click Filters" }),
|
|
76
|
-
/* @__PURE__ */ a(o, { className: "space-y-4 px-2", children: [
|
|
77
|
-
/* @__PURE__ */ e(f, {}),
|
|
78
|
-
/* @__PURE__ */ e(g, {})
|
|
79
|
-
] })
|
|
80
|
-
] })
|
|
81
|
-
] }) });
|
|
82
|
-
}
|
|
83
|
-
const A = u(v);
|
|
84
|
-
export {
|
|
85
|
-
A as default
|
|
86
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("react"),s=require("./index-Bvtpj-_R.js"),a=require("./filter-on-click-columns-6dRYhvgz.js");require("react-dom");const o=require("./frame-filters-D9sDN4Vm.js");function d(){var l;const t=s.useEditorStore(i=>i.card.preferences),{setCardPreferences:c}=s.useEditorStore(i=>i.actions);function n(i){c({...t,textVisualOptions:{...t==null?void 0:t.textVisualOptions,isDynamicText:i==="dynamic"}})}return e.jsxs(s.RadioGroup,{value:(l=t==null?void 0:t.textVisualOptions)!=null&&l.isDynamicText?"dynamic":"static",onValueChange:n,className:"flex gap-3",defaultValue:"x",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(s.RadioGroupItem,{value:"static",id:"r1"}),e.jsx("label",{className:"text-sm",htmlFor:"r1",children:"Static"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(s.RadioGroupItem,{value:"dynamic",id:"r2"}),e.jsx("label",{className:"text-sm",htmlFor:"r2",children:"Dynamic"})]})]})}function x({cardType:t,docContent:c,suffix:n="Chart"}){let l="pie-donut-polar";return t==="funnel"&&(l="funnel"),e.jsx("div",{className:"space-y-6 px-6 py-2",children:e.jsxs(s.Accordion,{defaultValue:["item-2"],type:"multiple",children:[e.jsxs(s.AccordionItem,{value:"item-1",children:[e.jsx(s.AccordionTrigger,{children:`${s.titleCase(t)} ${n}`}),e.jsx(s.AccordionContent,{children:c||e.jsxs("div",{className:"space-y-4 font-mono text-xs",children:[e.jsx("div",{className:"rounded bg-muted px-2 py-1 text-xs",children:"SELECT label, measure FROM table"}),e.jsxs("ul",{className:"ml-6 list-disc text-xs [&>li]:mt-2",children:[e.jsx("li",{children:"label - category"}),e.jsx("li",{children:"measure - number"})]}),e.jsxs("div",{children:["See ",e.jsx("a",{target:"_blank",onClick:i=>i.stopPropagation(),className:"text-blue-700",href:`https://docs.semaphor.cloud/docs/charts/${l}`,children:"example"})," in the docs."]})]})})]}),t==="text"&&e.jsxs(s.AccordionItem,{value:"item-2",children:[e.jsx(s.AccordionTrigger,{children:"Settings"}),e.jsx(s.AccordionContent,{className:"space-y-4 px-2 py-4",children:e.jsx(d,{})})]}),!["range","text"].includes(t)&&e.jsxs(s.AccordionItem,{value:"item-3",children:[e.jsx(s.AccordionTrigger,{children:"Click Filters"}),e.jsxs(s.AccordionContent,{className:"space-y-4 px-2",children:[e.jsx(a.FilterOnClickColumns,{}),e.jsx(o.FrameFilters,{})]})]})]})})}const m=r.memo(x);exports.default=m;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { jsxs as a, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { S as f, s as h, q as m, v as S, w as o, x as p, y as g, z as v } from "./index--MUeDITx.js";
|
|
3
|
-
function j({
|
|
4
|
-
defaultValue: s,
|
|
5
|
-
label: c,
|
|
6
|
-
options: t,
|
|
7
|
-
value: n,
|
|
8
|
-
onValueChange: i,
|
|
9
|
-
className: u,
|
|
10
|
-
icon: r,
|
|
11
|
-
showPlaceholderLabel: d = !0
|
|
12
|
-
}) {
|
|
13
|
-
return /* @__PURE__ */ a(
|
|
14
|
-
f,
|
|
15
|
-
{
|
|
16
|
-
defaultValue: s,
|
|
17
|
-
value: n,
|
|
18
|
-
onValueChange: i,
|
|
19
|
-
children: [
|
|
20
|
-
/* @__PURE__ */ e(
|
|
21
|
-
h,
|
|
22
|
-
{
|
|
23
|
-
className: m("w-full focus:ring-0 focus:ring-offset-0", u),
|
|
24
|
-
children: /* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
|
|
25
|
-
r && /* @__PURE__ */ e("span", { children: r }),
|
|
26
|
-
d && /* @__PURE__ */ e(S, { placeholder: c })
|
|
27
|
-
] })
|
|
28
|
-
}
|
|
29
|
-
),
|
|
30
|
-
/* @__PURE__ */ e(o, { children: /* @__PURE__ */ a(p, { children: [
|
|
31
|
-
/* @__PURE__ */ e(g, { children: c }),
|
|
32
|
-
t.map((l) => /* @__PURE__ */ e(v, { value: l.value, children: l.label }, l.value))
|
|
33
|
-
] }) })
|
|
34
|
-
]
|
|
35
|
-
}
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
export {
|
|
39
|
-
j as R
|
|
40
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("react/jsx-runtime"),l=require("./index-Bvtpj-_R.js");function d({defaultValue:t,label:c,options:n,value:u,onValueChange:i,className:a,icon:r,showPlaceholderLabel:x=!0}){return e.jsxs(l.Select,{defaultValue:t,value:u,onValueChange:i,children:[e.jsx(l.SelectTrigger,{className:l.cn("w-full focus:ring-0 focus:ring-offset-0",a),children:e.jsxs("div",{className:"flex items-center gap-2",children:[r&&e.jsx("span",{children:r}),x&&e.jsx(l.SelectValue,{placeholder:c})]})}),e.jsx(l.SelectContent,{children:e.jsxs(l.SelectGroup,{children:[e.jsx(l.SelectLabel,{children:c}),n.map(s=>e.jsx(l.SelectItem,{value:s.value,children:s.label},s.value))]})})]})}exports.ReusableSelect=d;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("react"),s=require("./index-Bvtpj-_R.js"),o=require("./filter-on-click-columns-6dRYhvgz.js"),d=require("./axis-mapping-Cwa3KrDR.js"),x=require("./frame-filters-D9sDN4Vm.js"),u=require("./reusable-select-CVRzPWkg.js");function h(){const i=s.useEditorStore(r=>{var c,t;return(t=(c=r==null?void 0:r.card)==null?void 0:c.preferences)==null?void 0:t.sortChart}),{setSortChart:n}=s.useEditorActions();function l(){return e.jsxs("div",{className:"space-y-2",children:[e.jsx(s.Label,{children:"Sort"}),e.jsx(u.ReusableSelect,{className:"h-8",label:"Sort Chart",options:[{label:"None",value:"none"},{label:"ASC",value:"asc"},{label:"DESC",value:"desc"}],value:i||"none",onValueChange:r=>{n(r)}})]})}return e.jsx("div",{className:"space-y-6 px-6 py-2",children:e.jsxs(s.Accordion,{defaultValue:["item-2"],type:"multiple",children:[e.jsxs(s.AccordionItem,{value:"item-1",children:[e.jsx(s.AccordionTrigger,{children:"Stacked Chart"}),e.jsxs(s.AccordionContent,{className:"space-y-4 font-mono text-xs",children:[e.jsx("div",{className:"rounded bg-muted px-2 py-1 text-xs",children:"SELECT x-axis, stack-by, y-axis FROM table"}),e.jsxs("ul",{className:"ml-6 list-disc text-xs [&>li]:mt-2",children:[e.jsx("li",{children:"x-axis - category"}),e.jsx("li",{children:"stack by - category"}),e.jsx("li",{children:"y-axis - number"})]}),e.jsxs("div",{children:["See ",e.jsx("a",{target:"_blank",onClick:r=>r.stopPropagation(),className:"text-blue-700",href:"https://docs.semaphor.cloud/docs/charts/stacked",children:"example"})," in the docs."]})]})]}),e.jsxs(s.AccordionItem,{value:"item-2",children:[e.jsx(s.AccordionTrigger,{children:"Settings"}),e.jsxs(s.AccordionContent,{className:"space-y-4 px-2",children:[l(),e.jsx(d.AxisMapping,{})]})]}),e.jsxs(s.AccordionItem,{value:"item-3",children:[e.jsx(s.AccordionTrigger,{children:"Click Filters"}),e.jsxs(s.AccordionContent,{className:"space-y-4 px-2",children:[e.jsx(o.FilterOnClickColumns,{}),e.jsx(x.FrameFilters,{})]})]})]})})}const m=a.memo(h);exports.default=m;
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { jsx as e, jsxs as a } from "react/jsx-runtime";
|
|
2
|
-
import { memo as m } from "react";
|
|
3
|
-
import { u as h, d as p, A as u, a as t, b as s, c as l, L as x } from "./index--MUeDITx.js";
|
|
4
|
-
import { F as C } from "./filter-on-click-columns-BJUGTE6W.js";
|
|
5
|
-
import { A as S } from "./axis-mapping-8ZVwlkl6.js";
|
|
6
|
-
import { F as b } from "./frame-filters-DFgqSoV2.js";
|
|
7
|
-
import { R as f } from "./reusable-select-CQbD03nT.js";
|
|
8
|
-
function y() {
|
|
9
|
-
const o = h(
|
|
10
|
-
(r) => {
|
|
11
|
-
var c, i;
|
|
12
|
-
return (i = (c = r == null ? void 0 : r.card) == null ? void 0 : c.preferences) == null ? void 0 : i.sortChart;
|
|
13
|
-
}
|
|
14
|
-
), { setSortChart: n } = p();
|
|
15
|
-
function d() {
|
|
16
|
-
return /* @__PURE__ */ a("div", { className: "space-y-2", children: [
|
|
17
|
-
/* @__PURE__ */ e(x, { children: "Sort" }),
|
|
18
|
-
/* @__PURE__ */ e(
|
|
19
|
-
f,
|
|
20
|
-
{
|
|
21
|
-
className: "h-8",
|
|
22
|
-
label: "Sort Chart",
|
|
23
|
-
options: [
|
|
24
|
-
{
|
|
25
|
-
label: "None",
|
|
26
|
-
value: "none"
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
label: "ASC",
|
|
30
|
-
value: "asc"
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
label: "DESC",
|
|
34
|
-
value: "desc"
|
|
35
|
-
}
|
|
36
|
-
],
|
|
37
|
-
value: o || "none",
|
|
38
|
-
onValueChange: (r) => {
|
|
39
|
-
n(r);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
)
|
|
43
|
-
] });
|
|
44
|
-
}
|
|
45
|
-
return /* @__PURE__ */ e("div", { className: "space-y-6 px-6 py-2", children: /* @__PURE__ */ a(u, { defaultValue: ["item-2"], type: "multiple", children: [
|
|
46
|
-
/* @__PURE__ */ a(t, { value: "item-1", children: [
|
|
47
|
-
/* @__PURE__ */ e(s, { children: "Stacked Chart" }),
|
|
48
|
-
/* @__PURE__ */ a(l, { className: "space-y-4 font-mono text-xs", children: [
|
|
49
|
-
/* @__PURE__ */ e("div", { className: "rounded bg-muted px-2 py-1 text-xs", children: "SELECT x-axis, stack-by, y-axis FROM table" }),
|
|
50
|
-
/* @__PURE__ */ a("ul", { className: "ml-6 list-disc text-xs [&>li]:mt-2", children: [
|
|
51
|
-
/* @__PURE__ */ e("li", { children: "x-axis - category" }),
|
|
52
|
-
/* @__PURE__ */ e("li", { children: "stack by - category" }),
|
|
53
|
-
/* @__PURE__ */ e("li", { children: "y-axis - number" })
|
|
54
|
-
] }),
|
|
55
|
-
/* @__PURE__ */ a("div", { children: [
|
|
56
|
-
"See ",
|
|
57
|
-
/* @__PURE__ */ e(
|
|
58
|
-
"a",
|
|
59
|
-
{
|
|
60
|
-
target: "_blank",
|
|
61
|
-
onClick: (r) => r.stopPropagation(),
|
|
62
|
-
className: "text-blue-700",
|
|
63
|
-
href: "https://docs.semaphor.cloud/docs/charts/stacked",
|
|
64
|
-
children: "example"
|
|
65
|
-
}
|
|
66
|
-
),
|
|
67
|
-
" in the docs."
|
|
68
|
-
] })
|
|
69
|
-
] })
|
|
70
|
-
] }),
|
|
71
|
-
/* @__PURE__ */ a(t, { value: "item-2", children: [
|
|
72
|
-
/* @__PURE__ */ e(s, { children: "Settings" }),
|
|
73
|
-
/* @__PURE__ */ a(l, { className: "space-y-4 px-2", children: [
|
|
74
|
-
d(),
|
|
75
|
-
/* @__PURE__ */ e(S, {})
|
|
76
|
-
] })
|
|
77
|
-
] }),
|
|
78
|
-
/* @__PURE__ */ a(t, { value: "item-3", children: [
|
|
79
|
-
/* @__PURE__ */ e(s, { children: "Click Filters" }),
|
|
80
|
-
/* @__PURE__ */ a(l, { className: "space-y-4 px-2", children: [
|
|
81
|
-
/* @__PURE__ */ e(C, {}),
|
|
82
|
-
/* @__PURE__ */ e(b, {})
|
|
83
|
-
] })
|
|
84
|
-
] })
|
|
85
|
-
] }) });
|
|
86
|
-
}
|
|
87
|
-
const L = m(y);
|
|
88
|
-
export {
|
|
89
|
-
L as default
|
|
90
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { jsxs as o, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { memo as t } from "react";
|
|
3
|
-
import { u as r, A as i, a as d, b as m, c as p, C as h } from "./index--MUeDITx.js";
|
|
4
|
-
import { F as f } from "./filter-on-click-columns-BJUGTE6W.js";
|
|
5
|
-
import "react-dom";
|
|
6
|
-
import { F as u } from "./frame-filters-DFgqSoV2.js";
|
|
7
|
-
function C({
|
|
8
|
-
cardType: s = "table"
|
|
9
|
-
}) {
|
|
10
|
-
console.log("cardType", s);
|
|
11
|
-
const c = r((a) => {
|
|
12
|
-
var l;
|
|
13
|
-
return (l = a.card) == null ? void 0 : l.preferences;
|
|
14
|
-
}), n = r(
|
|
15
|
-
(a) => a.actions.setCardPreferences
|
|
16
|
-
);
|
|
17
|
-
return /* @__PURE__ */ o("div", { className: "space-y-6 px-6 py-2", children: [
|
|
18
|
-
/* @__PURE__ */ e(i, { defaultValue: ["item-3"], type: "multiple", children: /* @__PURE__ */ o(d, { value: "item-3", children: [
|
|
19
|
-
/* @__PURE__ */ e(m, { children: "Click Filters" }),
|
|
20
|
-
/* @__PURE__ */ o(p, { className: "space-y-4 px-2", children: [
|
|
21
|
-
/* @__PURE__ */ e(f, {}),
|
|
22
|
-
/* @__PURE__ */ e(u, {})
|
|
23
|
-
] })
|
|
24
|
-
] }) }),
|
|
25
|
-
/* @__PURE__ */ o("div", { className: "flex items-center space-x-2", children: [
|
|
26
|
-
/* @__PURE__ */ e(h, { onCheckedChange: (a) => {
|
|
27
|
-
n({
|
|
28
|
-
...c,
|
|
29
|
-
allowDownload: a
|
|
30
|
-
});
|
|
31
|
-
}, id: "allow-download" }),
|
|
32
|
-
/* @__PURE__ */ e(
|
|
33
|
-
"label",
|
|
34
|
-
{
|
|
35
|
-
htmlFor: "allow-download",
|
|
36
|
-
className: "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
|
37
|
-
children: "Allow Download"
|
|
38
|
-
}
|
|
39
|
-
)
|
|
40
|
-
] })
|
|
41
|
-
] });
|
|
42
|
-
}
|
|
43
|
-
const A = t(C);
|
|
44
|
-
export {
|
|
45
|
-
A as default
|
|
46
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("react"),r=require("./index-Bvtpj-_R.js"),a=require("./filter-on-click-columns-6dRYhvgz.js");require("react-dom");const d=require("./frame-filters-D9sDN4Vm.js");function u({cardType:n="table"}){console.log("cardType",n);const o=r.useEditorStore(s=>{var l;return(l=s.card)==null?void 0:l.preferences}),t=r.useEditorStore(s=>s.actions.setCardPreferences),c=s=>{t({...o,allowDownload:s})};return e.jsxs("div",{className:"space-y-6 px-6 py-2",children:[e.jsx(r.Accordion,{defaultValue:["item-3"],type:"multiple",children:e.jsxs(r.AccordionItem,{value:"item-3",children:[e.jsx(r.AccordionTrigger,{children:"Click Filters"}),e.jsxs(r.AccordionContent,{className:"space-y-4 px-2",children:[e.jsx(a.FilterOnClickColumns,{}),e.jsx(d.FrameFilters,{})]})]})}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(r.Checkbox,{onCheckedChange:c,id:"allow-download"}),e.jsx("label",{htmlFor:"allow-download",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Allow Download"})]})]})}const m=i.memo(u);exports.default=m;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { E as a } from "./index--MUeDITx.js";
|
|
2
|
-
/**
|
|
3
|
-
* @license lucide-react v0.453.0 - ISC
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the ISC license.
|
|
6
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
|
-
const r = a("Tag", [
|
|
9
|
-
[
|
|
10
|
-
"path",
|
|
11
|
-
{
|
|
12
|
-
d: "M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",
|
|
13
|
-
key: "vktsd0"
|
|
14
|
-
}
|
|
15
|
-
],
|
|
16
|
-
["circle", { cx: "7.5", cy: "7.5", r: ".5", fill: "currentColor", key: "kqv944" }]
|
|
17
|
-
]);
|
|
18
|
-
export {
|
|
19
|
-
r as T
|
|
20
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";const c=require("./index-Bvtpj-_R.js");/**
|
|
2
|
-
* @license lucide-react v0.453.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const e=c.createLucideIcon("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);exports.Tag=e;
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import "react/jsx-runtime";
|
|
2
|
-
import { u as d, e as b, G as M, f as O, H as N, J as G, K as H, M as J, N as _, O as q } from "./index--MUeDITx.js";
|
|
3
|
-
import "react";
|
|
4
|
-
import "react-dom";
|
|
5
|
-
function V() {
|
|
6
|
-
const u = d((e) => e.selectedConnectionId), p = d((e) => e.selectedDatamodelId), i = d((e) => e.selectedDatabaseName), A = d((e) => e.selectedSchemaName), E = d((e) => e.selectedTableName), m = b((e) => e.dashboard.filters) || [], l = b((e) => e.selectedSheetId), F = b((e) => e.actions.addFilter), $ = b((e) => e.actions.removeFilter), { removeFilterValues: v } = M(), { modelItems: h, tableName: S, connectionType: C } = O();
|
|
7
|
-
function g(e, c = "sheet", t) {
|
|
8
|
-
var T;
|
|
9
|
-
const r = N(e.column_name), f = N(i || ""), x = N(A || ""), y = N(S);
|
|
10
|
-
let n = G({
|
|
11
|
-
schemaName: x,
|
|
12
|
-
tableName: y,
|
|
13
|
-
connectionType: C,
|
|
14
|
-
databaseName: f
|
|
15
|
-
}), s = `${n}.${r}`;
|
|
16
|
-
const I = (T = h == null ? void 0 : h.find(
|
|
17
|
-
(a) => a.id === p
|
|
18
|
-
)) == null ? void 0 : T.name;
|
|
19
|
-
p && p !== "none" && (s = `${q}.${I}.${r}`, n = `${q}.${I}`), t != null && t.qualifiedFieldName && (s = t.qualifiedFieldName), t != null && t.entityName && (n = t.entityName);
|
|
20
|
-
let o;
|
|
21
|
-
if (c === "sheet" && l ? o = H(
|
|
22
|
-
m,
|
|
23
|
-
s,
|
|
24
|
-
y,
|
|
25
|
-
i || "",
|
|
26
|
-
// Raw database name (as stored in filters)
|
|
27
|
-
f,
|
|
28
|
-
// Formatted database name (with quotes if uppercase)
|
|
29
|
-
l
|
|
30
|
-
) : o = m == null ? void 0 : m.find(
|
|
31
|
-
(a) => a.column === s && a.table === y && (a.database === f || a.database === i)
|
|
32
|
-
), o)
|
|
33
|
-
v(o.id), $(o.id);
|
|
34
|
-
else {
|
|
35
|
-
const a = J(), D = c === "sheet" && l ? [l] : void 0;
|
|
36
|
-
return S === "api" && u ? (F({
|
|
37
|
-
location: c,
|
|
38
|
-
id: a,
|
|
39
|
-
//uuidv4(),
|
|
40
|
-
column: s,
|
|
41
|
-
title: e.label || e.column_name,
|
|
42
|
-
dataType: e.data_type,
|
|
43
|
-
table: "api",
|
|
44
|
-
database: "",
|
|
45
|
-
// database: 'NA',
|
|
46
|
-
connectionId: u,
|
|
47
|
-
operation: "in",
|
|
48
|
-
applyToSheetIds: D,
|
|
49
|
-
// Add sheet scoping
|
|
50
|
-
sql: _(
|
|
51
|
-
e.data_type,
|
|
52
|
-
n,
|
|
53
|
-
r
|
|
54
|
-
)
|
|
55
|
-
//DATE_DATA_TYPES.includes(column.data_type) ? dateSql : sql,
|
|
56
|
-
}), a) : (F({
|
|
57
|
-
id: a,
|
|
58
|
-
//uuidv4(),
|
|
59
|
-
location: c,
|
|
60
|
-
column: s,
|
|
61
|
-
//columnName, //`${qualifiedTableName}.${formattedColumnName}`,
|
|
62
|
-
title: e.label || e.column_name,
|
|
63
|
-
dataType: e.data_type,
|
|
64
|
-
table: E || "",
|
|
65
|
-
database: i || "",
|
|
66
|
-
connectionId: u || "",
|
|
67
|
-
operation: "in",
|
|
68
|
-
applyToSheetIds: D,
|
|
69
|
-
// Add sheet scoping
|
|
70
|
-
sql: _(
|
|
71
|
-
e.data_type,
|
|
72
|
-
n,
|
|
73
|
-
r
|
|
74
|
-
)
|
|
75
|
-
//DATE_DATA_TYPES.includes(column.data_type) ? dateSql : sql,
|
|
76
|
-
}), a);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
return { assignFilter: g };
|
|
80
|
-
}
|
|
81
|
-
export {
|
|
82
|
-
V as u
|
|
83
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";require("react/jsx-runtime");const t=require("./index-Bvtpj-_R.js");require("react");require("react-dom");function $(){const u=t.useEditorStore(e=>e.selectedConnectionId),b=t.useEditorStore(e=>e.selectedDatamodelId),n=t.useEditorStore(e=>e.selectedDatabaseName),A=t.useEditorStore(e=>e.selectedSchemaName),F=t.useEditorStore(e=>e.selectedTableName),r=t.useDashboardStore(e=>e.dashboard.filters)||[],l=t.useDashboardStore(e=>e.selectedSheetId),f=t.useDashboardStore(e=>e.actions.addFilter),y=t.useDashboardStore(e=>e.actions.removeFilter),{removeFilterValues:T}=t.useDashboardActions(),{modelItems:N,tableName:D,connectionType:I}=t.useEditorAside();function _(e,m="sheet",s){var p;const c=t.fmt(e.column_name),S=t.fmt(n||""),C=t.fmt(A||""),h=t.fmt(D);let i=t.getQualifiedTableName({schemaName:C,tableName:h,connectionType:I,databaseName:S}),o=`${i}.${c}`;const E=(p=N==null?void 0:N.find(a=>a.id===b))==null?void 0:p.name;b&&b!=="none"&&(o=`${t.DATAMODEL_NAMESPCACE}.${E}.${c}`,i=`${t.DATAMODEL_NAMESPCACE}.${E}`),s!=null&&s.qualifiedFieldName&&(o=s.qualifiedFieldName),s!=null&&s.entityName&&(i=s.entityName);let d;if(m==="sheet"&&l?d=t.filterExistsInSheet(r,o,h,n||"",S,l):d=r==null?void 0:r.find(a=>a.column===o&&a.table===h&&(a.database===S||a.database===n)),d)T(d.id),y(d.id);else{const a=t.v4(),q=m==="sheet"&&l?[l]:void 0;return D==="api"&&u?(f({location:m,id:a,column:o,title:e.label||e.column_name,dataType:e.data_type,table:"api",database:"",connectionId:u,operation:"in",applyToSheetIds:q,sql:t.getDefaultFilterSql(e.data_type,i,c)}),a):(f({id:a,location:m,column:o,title:e.label||e.column_name,dataType:e.data_type,table:F||"",database:n||"",connectionId:u||"",operation:"in",applyToSheetIds:q,sql:t.getDefaultFilterSql(e.data_type,i,c)}),a)}}return{assignFilter:_}}exports.useAssignFilter=$;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";const S=require("react"),s=require("react/jsx-runtime"),e=require("./index-Bvtpj-_R.js"),re=require("./use-assign-filter-DzmBSsyO.js");require("react-dom");const ae=require("./tag-D9G2kz2B.js");/**
|
|
2
|
-
* @license lucide-react v0.453.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const ne=e.createLucideIcon("Eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]]);/**
|
|
7
|
-
* @license lucide-react v0.453.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const z=e.createLucideIcon("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/**
|
|
12
|
-
* @license lucide-react v0.453.0 - ISC
|
|
13
|
-
*
|
|
14
|
-
* This source code is licensed under the ISC license.
|
|
15
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const oe=e.createLucideIcon("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);function ie(t,n={}){const{enabled:r=!0,eventType:a="mousedown"}=n,l=S.useRef(null);return S.useEffect(()=>{const d=u=>{const m=u.target;l.current&&l.current.contains(m)||m instanceof Element&&(m.closest("[data-radix-popper-content-wrapper]")||m.closest("[data-radix-select-content]")||m.closest("[data-radix-popover-content]")||m.closest("[data-radix-dropdown-menu-content]")||m.closest("[data-radix-tooltip-content]")||m.closest('[role="listbox"]')||m.closest('[role="option"]')||m.closest('[role="combobox"]'))||m instanceof Element&&m.hasAttribute("data-radix-")||t()};return r&&document.addEventListener(a,d),()=>{document.removeEventListener(a,d)}},[t,r,a]),l}function P(t){const[n,r]=S.useState(null),[a,l]=S.useState(null);return S.useEffect(()=>{if(!t||t.trim()===""){r(null),l(null);return}(async()=>{try{if(!t.startsWith("http://")&&!t.startsWith("https://"))throw new Error(`Invalid URL format: ${t}`);try{new URL(t)}catch{throw new Error(`Invalid URL: ${t}`)}const m=`${t.endsWith("/")?t:`${t}/`}index.js`;try{if(!(await fetch(m,{method:"HEAD"})).ok)throw new Error(`Module not found at ${m}`)}catch{}const p=await import(m);if(typeof p.useChartStore!="function")throw new Error("useChartStore is not a function");r(()=>p.useChartStore),l(null)}catch(u){const m=u instanceof Error?u.message:"Unknown error";console.error("Failed to load remote chart store:",m),l(m),r(null)}})()},[t]),n}function le(t){const n=t.toUpperCase().indexOf("WHERE"),r=t.toUpperCase().indexOf("GROUP BY"),a=t.toUpperCase().indexOf("LIMIT"),l=t.toUpperCase().indexOf("ORDER BY");let d=t.length;if(l!==-1&&(d=l),a!==-1&&a<d&&(d=a),n!==-1){const u=t.substring(0,n),m=t.substring(n);return`${u} {{ filters | where }} AND ${m.substring(6)}`}else if(r!==-1){const u=t.substring(0,r),m=t.substring(r);return`${u} {{ filters | where }} ${m}`}else{const u=t.substring(0,d),m=t.substring(d);return console.log("beforeClause",u),console.log("afterClause",m),m?`${u} {{ filters | where }} ${m}`:`${u.replace(/;$/,"")} {{ filters | where }}`}}function ce(t,n){if(t.length===0)return"";if(n){const r=t.find(a=>a.id===n);if(r){const a=r.tabTitle;if(a=="All__Header")return t[0].id;if(a&&a.endsWith("__Header")){const d=a.split("__")[0],u=t.find(m=>m.tabTitle===d);return u?u.id:t[0].id}return n}}return t[0].id}async function H(t,n,r,a){if(!n||!r)throw new Error("Missing auth token or visual ID");const l=["resource-by-id","visual",r],d=a.getQueryData(l);if(d)return console.log("Using cached visual data for:",r),{data:d,fromCache:!0};console.log("Fetching visual data from network for:",r);const u=e.ue.loading("Loading visual...",{position:"top-center"});try{const m=await fetch(`${t}/management/v1/visuals/${r}`,{headers:{Authorization:`Bearer ${n}`}});if(!m.ok)throw new Error("Failed to load visual");const p=await m.json();return a.setQueryData(l,p),e.ue.dismiss(u),{data:p,fromCache:!1}}catch(m){throw e.ue.dismiss(u),m}}function X(t){if(typeof t=="string")return JSON.parse(t);if(typeof t=="object")return t;throw new Error("Invalid frame object format")}function de(t,n){var d,u;const r=(t==null?void 0:t.frameObject)??((d=t==null?void 0:t.visual)==null?void 0:d.frameObject);if(!r)return!1;const a=X(r);if(!(a!=null&&a.cards)||a.cards.length===0)return!1;const l=(u=a.cards)==null?void 0:u.find(m=>m.id===a.activeCardId);return l?(e.setupEditorWithCard({...n,frame:a,card:l,visualId:(t==null?void 0:t.id)||a.visualId}),!0):!1}function ue(){var g;const{setCardSql:t}=e.useEditorActions(),n=e.useEditorStore(o=>o.frame),r=e.useEditorStore(o=>o.card),a=P(((g=r.customCardPreferences)==null?void 0:g.url)||""),l=e.useEditorStore(o=>o.selectedSchemaName),d=e.useEditorStore(o=>o.selectedDatamodelId),u=e.useEditorStore(o=>o.selectedDatabaseName),m=e.useEditorStore(o=>o.selectedTableName),p=e.useEditorStore(o=>o.selectedConnectionId),y=e.useEditorStore(o=>o.isShowingVisual),C=r.sql;return{getUpdatedFrame:S.useCallback(()=>{var v;let o=C;C&&!C.includes("{{")&&(o=le(C),t(o));const h=(v=a==null?void 0:a.getState())==null?void 0:v.settings,N={...r,dataSource:r.dataSource||{mode:"directSource"},lastSelectedSchema:l,lastSelectedDatamodelId:d,lastSelectedDatabase:u,lastSelectedTable:m,connectionId:p,sql:o,customCfg:y?r.customCfg:null,preferences:r.preferences,...h&&{customCardPreferences:{...r.customCardPreferences,settings:h}}},T=n.cards.map(A=>A.id===r.id?N:A);return{...n,cards:T,activeCardId:ce(T,n.activeCardId)}},[r,n,y,l,d,u,m,p,t,a,C])}}function _(){const{authToken:t,tokenProps:n}=e.useSemaphorContext(),r=e.useQueryClient(),a=e.useSelectedVisual(),{selectVisual:l}=e.useManagementActions(),{setFrame:d,setCard:u,setIsDevMode:m,setActiveTabCardId:p,updateDataSource:y,setQueryResultColumns:C,setSelectedConnectionId:F,setSelectedDatabaseName:g,setSelectedSchemaName:o,setSelectedTableName:h,setSelectedDatamodelId:N,setFilterValues:T,setApplyFilters:v}=e.useEditorActions(),{setIsDashboardEditing:A,setIsVisualEditing:D,setSelectedFrameId:$,clearSelectedFrameId:M,addFrame:x,setIsDashboardPanelOpen:b}=e.useDashboardActions(),k=e.useDashboardStore(i=>i.selectedSheetId),I=e.useDashboardStore(i=>i.selectedFrameId),V=e.useDashboardStore(i=>i.dashboard),O=e.useDashboardStore(i=>i.filterValues),q=e.useVisualById((a==null?void 0:a.id)||"",{enabled:!!(a!=null&&a.id)&&!!(t!=null&&t.accessToken)}),Q=S.useCallback(async i=>{try{l(i),M();const{data:j,fromCache:f}=await H(n.apiServiceUrl,(t==null?void 0:t.accessToken)||"",i.id,r);if(!de(j,{setFrame:d,setCard:u,setIsDevMode:m,setActiveTabCardId:p,updateDataSource:y,setQueryResultColumns:C,setSelectedConnectionId:F,setSelectedDatabaseName:g,setSelectedSchemaName:o,setSelectedTableName:h,setSelectedDatamodelId:N,setFilterValues:T,setApplyFilters:v,setIsDashboardEditing:A,setIsVisualEditing:D,dashboard:V,selectedSheetId:k,selectedFrameId:I,filterValues:O}))throw new Error("Failed to setup editor with visual data");return{success:!0,fromCache:f}}catch(j){return console.error("Error editing visual:",j),{success:!1,error:"Failed to load visual for editing"}}},[t==null?void 0:t.accessToken,n.apiServiceUrl,r,l,d,u,A,D,m,p,y,C,F,g,o,h,N,T,v,M,V,k,I,O]),c=S.useCallback(async i=>{var j;try{if(l(i),!k)return{success:!1,error:"No sheet selected. Please select a sheet first."};const{data:f,fromCache:w}=await H(n.apiServiceUrl,(t==null?void 0:t.accessToken)||"",i.id,r),B=(f==null?void 0:f.frameObject)??((j=f==null?void 0:f.visual)==null?void 0:j.frameObject);if(!B)return{success:!1,error:"Visual has no frame data"};const L=X(B);if(!(L!=null&&L.cards)||L.cards.length===0)return{success:!1,error:"Visual frame is malformed"};const U={...L,id:e.v4(),visualId:i.id};return x(k,U,"end"),A(!0),$(U.id),b(!1),{success:!0,fromCache:w}}catch(f){return console.error("Error adding visual:",f),{success:!1,error:"Failed to add visual to dashboard"}}},[t==null?void 0:t.accessToken,n.apiServiceUrl,r,l,k,x,A,$,b]);return{visual:q.data,isLoading:q.isLoading,isError:q.isError,error:q.error,handleEditLibraryVisual:Q,handleAddLibraryVisual:c,getUpdatedFrame:ue().getUpdatedFrame,refetch:q.refetch}}function me({className:t,variant:n="outline"}){var m;const{setCardSql:r}=e.useEditorActions();e.useEditorStore(p=>p.frame);const a=e.useEditorStore(p=>p.card);P(((m=a.customCardPreferences)==null?void 0:m.url)||""),e.useEditorStore(p=>p.selectedSchemaName),e.useEditorStore(p=>p.selectedDatamodelId),e.useEditorStore(p=>p.selectedDatabaseName),e.useEditorStore(p=>p.selectedTableName),e.useEditorStore(p=>p.selectedConnectionId),e.useEditorStore(p=>p.isShowingVisual),a.sql;const l=e.useEditorStore(p=>p.onSave),{getUpdatedFrame:d}=_();function u(){const p=d();l==null||l(p)}return s.jsxs(e.Button,{onClick:u,className:e.cn("h-8",t),size:"sm",variant:n,children:[s.jsx(e.Check,{className:"mr-2 size-4 font-bold"}),"Accept"]})}function pe({className:t,variant:n="default"}){const r=e.useQueryClient(),[a,l]=S.useState(!1),d=e.useDashboardStore(g=>g.actions.setIsDashboardPanelOpen),{setIsVisualEditing:u}=e.useDashboardActions(),{getUpdatedFrame:m}=_(),p=e.useSelectedVisual(),y=e.useEditorStore(g=>g.frame),C=e.useUpdateVisualMutation(),F=()=>{const g=m(),o=(y==null?void 0:y.visualId)||(p==null?void 0:p.id);if(!o){e.ue.error("No visual to save");return}l(!0),C.mutate({visualId:o,data:{frameObject:g}},{onSuccess:()=>{l(!1),d(!0),e.ue.success("Visual updated successfully"),r.invalidateQueries({queryKey:["resource-by-id","visual",o],exact:!0})},onError:()=>{l(!1),e.ue.error("Failed to update visual")}})};return s.jsxs(e.Button,{onClick:F,className:e.cn("h-8",t),size:"sm",variant:n,children:[a&&s.jsxs(s.Fragment,{children:[s.jsx(e.LoaderCircle,{className:"mr-2 size-4 animate-spin font-bold"})," Saving"]}),!a&&s.jsxs(s.Fragment,{children:[s.jsx(z,{className:"mr-2 size-4 font-bold"}),"Save to Library"]})]})}function he({className:t}){const n=e.useQueryClient(),[r,a]=S.useState(!1),l=e.useSelectedVisual(),d=e.useEditorStore(g=>g.frame),u=e.useDashboardStore(g=>g.selectedSheetId),{updateFrame:m,setIsVisualEditing:p}=e.useDashboardActions(),{getUpdatedFrame:y}=_(),C=e.useUpdateVisualMutation(),F=async()=>{if(!u){e.ue.error("No sheet selected");return}const g=(d==null?void 0:d.visualId)||(l==null?void 0:l.id);if(!g){e.ue.error("No visual to update");return}a(!0);try{const o=y();await C.mutateAsync({visualId:g,data:{frameObject:o}});const h={...o,visualId:g};m(u,h),n.invalidateQueries({queryKey:["visuals"]}),n.invalidateQueries({queryKey:["visual",g]}),e.ue.success("Saved to library and applied locally"),setTimeout(()=>{p(!1)},300)}catch(o){console.error("Failed to save and apply:",o),e.ue.error("Failed to save and apply changes")}finally{a(!1)}};return s.jsx(e.Button,{onClick:F,className:e.cn("h-8",t),size:"sm",variant:"default",disabled:r,children:r?s.jsxs(s.Fragment,{children:[s.jsx(e.LoaderCircle,{className:"mr-2 size-4 animate-spin font-bold"})," Saving..."]}):s.jsxs(s.Fragment,{children:[s.jsx(z,{className:"mr-2 size-4 font-bold"}),"Save & Apply"]})})}function ge({className:t}){const{getUpdatedFrame:n}=_();e.useEditorStore(p=>p.frame);const r=e.useDashboardStore(p=>p.selectedSheetId),{updateFrame:a,setIsVisualEditing:l}=e.useDashboardActions(),[d,u]=S.useState(!1),m=()=>{if(!r){e.ue.error("No sheet selected");return}u(!0);const y={...n(),visualId:void 0};a(r,y),setTimeout(()=>{u(!1),e.ue.success("Changes applied. Visual is now local to this dashboard"),l(!1)},300)};return s.jsxs(e.Button,{onClick:m,className:e.cn("h-8",t),size:"sm",variant:"outline",children:[d&&s.jsxs(s.Fragment,{children:[s.jsx(e.LoaderCircle,{className:"mr-2 size-4 animate-spin font-bold"})," Applying"]}),!d&&s.jsxs(s.Fragment,{children:[s.jsx(e.Check,{className:"mr-2 size-4 font-bold"}),"Apply Locally"]})]})}function fe({className:t}){const{setTempQueryData:n,setSqlGen:r}=e.useEditorActions(),a=e.useQueryClient(),l=e.useEditorStore(y=>y.tempQueryData),d=e.useEditorStore(y=>y.onClose),u=e.useEditorStore(y=>y.card),{queryKey:m}=e.useDashboardCardQuery(u);function p(){if(l){const{queryKey:y,queryData:C}=l;y&&C&&a.setQueryData(y,C)}r({}),d==null||d()}return s.jsxs(e.Button,{onClick:p,className:e.cn("h-8",t),size:"sm",variant:"outline",children:[s.jsx(e.X,{className:"mr-2 size-4"}),"Close"]})}function ye(){const{setTempQueryData:t}=e.useEditorActions(),n=e.useQueryClient();e.useEditorStore(N=>N.isDevMode);const r=e.useEditorStore(N=>N.tempQueryData),a=e.useEditorStore(N=>N.card),{queryKey:l}=e.useDashboardCardQuery(a),{setCardSql:d,setSqlGen:u,setCardPython:m,setCardCustomCfg:p,setCardPreferences:y,updateDataSource:C,clearQueryConfig:F,setCardConfig:g,setCardType:o}=e.useEditorActions();function h(){const N=n.getQueryData(l);r!=null&&r.queryData||t({queryKey:l,queryData:N}),n.setQueryData(l,null),n.removeQueries({queryKey:l,exact:!0}),d(""),u({}),F(),g(void 0),m(""),p(""),y({}),o("bar")}return s.jsxs(e.Button,{onClick:h,className:"h-8",size:"sm",variant:"secondary",children:[s.jsx(ne,{className:"mr-2 size-4"}),"Clear"]})}function K(t){const{tokenProps:n,authToken:r}=e.useSemaphorContext(),a=n==null?void 0:n.apiServiceUrl;return e.useQuery({queryKey:["joinability-map",t],queryFn:async()=>{if(!t||!(r!=null&&r.accessToken))return null;const l=`${a}/v1/domains/${t}/joinability`;return e.getRequest(l,r.accessToken)},enabled:!!t&&!!(r!=null&&r.accessToken)&&!!a,staleTime:5*60*1e3,gcTime:10*60*1e3,retry:2,retryDelay:l=>Math.min(1e3*2**l,3e4)})}function Y(t,n,r){if(n==="source")return{isValid:!0};const a=e.getDataType(t.dataType);if(r==="kpi"){if(n==="groupBy"&&a!=="date")return{isValid:!1,reason:"KPI Trend By only accepts date fields"};if(n==="metrics"&&a==="date")return{isValid:!1,reason:"KPI metrics cannot be date fields"}}return{isValid:!0}}function Z(t,n,r,a,l){if(t!=="kpi"||l.length<3)return;const d=(n==null?void 0:n.groupByColumns)&&n.groupByColumns.length>0,u=(n==null?void 0:n.comparisonType)==="none";!d&&u||r(a,{groupByColumns:[],comparisonType:"none"})}const ee=t=>{var Q;const n=(Q=t==null?void 0:t.dataSource)==null?void 0:Q.semanticDomainId,{data:r}=K(n),{updateCardConfig:a,updateGroupByColumn:l,updateMetricColumn:d,updatePivotByColumn:u,updateSortByColumn:m,removeGroupByColumn:p,removeMetricColumn:y,removePivotByColumn:C,removeSortByColumn:F}=e.useEditorActions(),g=e.useEditorStore(c=>c.card.type),o=t==null?void 0:t.id,h=S.useCallback(c=>{if(!(t!=null&&t.config))return[];switch(c){case"groupBy":return(t.config.groupByColumns||[]).map(i=>({id:i.id,name:i.name,dataType:i.dataType,label:i.label!==void 0?i.label:i.name,qualifiedEntityName:i.qualifiedEntityName,entityId:i.entityId,entityName:i.entityName,entityType:i.entityType,dateFormat:i.dateFormat,customFormat:i.customFormat,granularity:i.granularity}));case"metrics":return t.config.metricColumns||[];case"pivotBy":return(t.config.pivotByColumns||[]).map(i=>({id:i.id,name:i.name,dataType:i.dataType,label:i.label!==void 0?i.label:i.name,qualifiedEntityName:i.qualifiedEntityName,entityId:i.entityId,entityName:i.entityName,entityType:i.entityType}));case"sortBy":return(t.config.sortByColumns||[]).map(i=>({id:i.id,name:i.name,dataType:i.dataType,label:i.label!==void 0?i.label:i.name,qualifiedEntityName:i.qualifiedEntityName,entityId:i.entityId,entityName:i.entityName,entityType:i.entityType,direction:i.direction}));case"source":return[];default:return[]}},[t]),N=S.useCallback((c,i)=>{if(o)switch(c){case"groupBy":{a(o,{groupByColumns:i});break}case"metrics":{a(o,{metricColumns:i});break}case"pivotBy":{a(o,{pivotByColumns:i});break}case"sortBy":{a(o,{sortByColumns:i});break}}},[o,a]),T=S.useCallback((c,i,j)=>{if(!o)return;const w=h(c)[i];if(w)switch(c){case"groupBy":l(o,w.id,{label:j});break;case"metrics":d(o,w.id,{label:j});break;case"pivotBy":u(o,w.id,{label:j});break;case"sortBy":m(o,w.id,{label:j});break}},[o,h,l,d,u,m]),v=S.useCallback((c,i)=>{if(!o)return;const f=h("metrics")[c];f&&d(o,f.id,{aggregate:i,label:e.getAggregationLabel(f.name,i)})},[o,h,d]),A=S.useCallback((c,i,j)=>{if(!o)return;const w=h("groupBy")[c];if(!w)return;const B={dateFormat:i};i==="custom"&&j?B.customFormat=j:B.customFormat=void 0,l(o,w.id,B)},[o,h,l]),D=S.useCallback((c,i)=>{if(!o)return;const f=h("groupBy")[c];f&&l(o,f.id,{granularity:i})},[o,h,l]),$=S.useCallback((c,i)=>{if(!o)return;const f=h("metrics")[c];f&&d(o,f.id,{aliasTemplate:i})},[o,h,d]),M=S.useCallback((c,i)=>{if(console.log("handleValueAliasesChange",c,i),!o)return;console.log("handleValueAliasesChange",c,i);const f=h("metrics")[c];f&&(console.log("handleValueAliasesChange",i),d(o,f.id,{valueAliases:i}))},[o,h,d]),x=S.useCallback(c=>{if(!o)return;if(h("metrics").length===0){e.ue.error("Add Metric First",{description:"Please add a metric field before selecting a comparison type",position:"top-center",duration:3e3});return}a(o,{comparisonType:c})},[o,a,h]),b=S.useCallback(c=>{o&&a(o,{showTrendline:c})},[o,a]),k=S.useCallback(c=>{o&&a(o,{trendlineWindow:c})},[o,a]),I=S.useCallback(c=>{o&&a(o,{trendlineGranularity:c})},[o,a]),V=S.useCallback(c=>{o&&a(o,{targetValue:c})},[o,a]),O=S.useCallback(c=>{var U;if(!o)return;const i=[...h("groupBy"),...h("pivotBy"),...h("metrics"),...h("sortBy")],j=e.validateEntityConsistency(c,i,{joinPlan:(U=t==null?void 0:t.config)==null?void 0:U.joinPlan,joinabilityMap:r==null?void 0:r.joinabilityMap,semanticDomainId:n});if(!j.isValid){j.showError&&e.showJoinRequiredNotification();return}const f=e.getSmartContainerForField(c,i,g);if(!f){e.ue.error("Invalid Field",{description:"This field cannot be added to any container",position:"top-center",duration:3e3});return}const w=Y(c,f,g);if(!w.isValid){e.ue.error("Invalid Field Type",{description:w.reason,position:"top-center",duration:3e3});return}const B=h(f);if(e.fieldAlreadyExists(c,B))return;const L=e.getNewField(c,f,B);if(L){const E=[...B,L];N(f,E),f==="metrics"&&Z(g,t==null?void 0:t.config,a,o,E)}},[o,t==null?void 0:t.config,h,N,n,r,g,a]),q=S.useCallback((c,i)=>{if(!o)return;const f=h(c)[i];if(f){if(c!=="sortBy"){const w=h("sortBy"),B=w.filter(L=>!(L.name===f.name&&L.qualifiedEntityName===f.qualifiedEntityName));B.length!==w.length&&a(o,{sortByColumns:B})}switch(c){case"groupBy":p(o,f.id);break;case"metrics":y(o,f.id);break;case"pivotBy":C(o,f.id);break;case"sortBy":F(o,f.id);break}}},[o,h,p,y,C,F,a]);return{getFieldsForContainer:h,setFieldsForContainer:N,updateLabel:T,handleAggregationChange:v,handleDateFormatChange:A,handleGranularityChange:D,handleAliasTemplateChange:$,handleValueAliasesChange:M,removeField:q,handleFieldClick:O,handleKpiComparisonTypeChange:x,handleKpiShowTrendlineChange:b,handleKpiTrendlineWindowChange:k,handleKpiTrendlineGranularityChange:I,handleKpiTargetValueChange:V,cardType:g}};function G(t){return`${t}-${e.v4()}`}function J(t,n){const r=e.toTitleCase(t.replace(/_/g," "));switch(n){case"SUM":return`Sum of ${r}`;case"COUNT":return`Count of ${r}`;case"DISTINCT":return`Unique ${r}`;case"AVG":return`Average of ${r}`;case"MIN":return`Min of ${r}`;case"MAX":return`Max of ${r}`;default:return r}}function be(t,n){const r=e.toTitleCase(t.replace(/_/g," "));switch(n){case"day":return`Date of ${r}`;case"week":return`Week of ${r}`;case"month":return`Month of ${r}`;case"year":return`Year of ${r}`;default:return r}}function W(t){if(!t||!t.selectedEntities||t.selectedEntities.length===0)return{tableName:void 0,schemaName:void 0,databaseName:void 0,connectionId:t==null?void 0:t.connectionId,connectionType:t==null?void 0:t.connectionType};const n=t.selectedEntities[0];return{tableName:n==null?void 0:n.name,schemaName:n==null?void 0:n.schema,databaseName:n==null?void 0:n.database,connectionId:t.connectionId,connectionType:t.connectionType}}function te(t){if(!t||!t.selectedEntities||t.selectedEntities.length===0)return!1;const n=t.selectedEntities[0];return!!(n!=null&&n.name)}function se(){const t=e.useEditorStore(x=>x.sqlGen),n=e.useEditorStore(x=>x.isDevMode),r=e.useEditorStore(x=>x.card.dataSource),a=e.useEditorStore(x=>{var b,k;return(k=(b=x.card)==null?void 0:b.queryConfig)==null?void 0:k.metricColumns}),{tableName:l,schemaName:d,databaseName:u}=W(r),m=te(r),p=e.useEditorStore(x=>x.selectedDatamodelId),{addColumnToMetricColumns:y,addColumnToGroupBy:C,setCardSql:F,setRunSql:g,setSqlGen:o,setIsShowingVisual:h}=e.useEditorActions(),{connectionType:N,modelItems:T,selectedDatamodelName:v}=e.useEditorAside(),A=x=>({column_name:x.name,data_type:x.dataType,label:x.label,description:x.description});return{handleDevModeFieldClick:x=>{var k;if(!n)return;const b=A(x);if(n&&m&&l){const I=e.createSqlGenConfig(b,t);o(I);const V=(k=T==null?void 0:T.find(q=>q.id===p))==null?void 0:k.name,O=e.getSql(I,e.fmt(d||""),e.fmt(l),V||"",N,u||"");O&&(F(O),g(!0))}else if(!n){if(e.isTextDataType(b.data_type))if(a&&a.length>0){const I={...b,role:"groupby",id:G(b.column_name),name:b.column_name,type:b.data_type};C(I)}else{const I={...b,role:"metric",id:G(b.column_name),name:b.column_name,label:J(b.column_name,"COUNT"),type:b.data_type,aggregate:"COUNT"};y(I)}if(e.isDateDataType(b.data_type)){const I={...b,role:"groupby",id:G(b.column_name),name:b.column_name,type:b.data_type,label:be(b.column_name,"month"),granularity:"month"};C(I)}if(e.isNumberDataType(b.data_type)){const I={...b,role:"metric",id:G(b.column_name),name:b.column_name,label:J(b.column_name,"SUM"),type:b.data_type,aggregate:"SUM"};y(I)}}},handleShowSample:()=>{if(!m||!l){console.warn("Cannot generate SQL: missing table metadata");return}const x=e.getFormattedTableNameForQuery({schemaName:d||"",tableName:l,modelName:v,connectionType:N,databaseName:u||""});h(!1);const b=N==="MSSQL"?`SELECT top 10 * FROM ${x}`:`SELECT * FROM ${x} LIMIT 10`;F(b),g(!0)},handleShowCount:()=>{if(!m||!l){console.warn("Cannot generate SQL: missing table metadata");return}const x=e.getFormattedTableNameForQuery({schemaName:d||"",tableName:l,modelName:v,connectionType:N,databaseName:u||""});F(`SELECT COUNT(*) as count FROM ${x}`),g(!0)},isNumberField:x=>e.isNumberDataType(x.dataType)}}function xe({column:t}){const[n,r]=S.useState(!1),a=e.useEditorStore(v=>v.card.dataSource),{tableName:l,schemaName:d,databaseName:u}=W(a),m=e.useEditorStore(v=>v.selectedDatamodelId),p=e.useEditorStore(v=>v.sqlGen),{modelItems:y,connectionType:C}=e.useEditorAside(),F=e.useEditorStore(v=>v.actions.setSqlGen),g=e.useEditorStore(v=>v.actions.setCardSql),o=e.useEditorStore(v=>v.actions.setRunSql),h=te(a);function N(v,A){var x;if(!h||!l){console.warn("Cannot generate SQL: missing table metadata");return}const D=e.createSqlGenConfig(v,p,A),$=(x=y==null?void 0:y.find(b=>b.id===m))==null?void 0:x.name;F(D);const M=e.getSql(D,e.fmt(d||""),e.fmt(l),$||"",C,u||"");M&&(g(M),o(!0)),r(!1)}function T(){return s.jsxs("ul",{className:"text-xs",children:[s.jsx("li",{onClick:()=>N(t,"COUNT"),className:"cursor-pointer p-1 px-3 transition-colors hover:bg-muted",children:"Count"}),s.jsx("li",{onClick:()=>N(t,"AVG"),className:"cursor-pointer p-1 px-3 transition-colors hover:bg-muted",children:"Avg"}),s.jsx("li",{onClick:()=>N(t,"SUM"),className:"cursor-pointer p-1 px-3 transition-colors hover:bg-muted",children:"Sum"}),s.jsx("li",{onClick:()=>N(t,"MAX"),className:"cursor-pointer p-1 px-3 transition-colors hover:bg-muted",children:"Max"}),s.jsx("li",{onClick:()=>N(t,"MIN"),className:"cursor-pointer p-1 px-3 transition-colors hover:bg-muted",children:"Min"})]})}return h?s.jsxs(e.HoverCard,{openDelay:0,open:n,onOpenChange:r,children:[s.jsx(e.HoverCardTrigger,{asChild:!0,children:s.jsx(e.EllipsisVertical,{className:"invisible size-3.5 cursor-pointer text-foreground/40 group-hover/container:visible"})}),s.jsx(e.HoverCardContent,{align:"center",className:"w-20 rounded-md p-0 shadow-none",children:T()})]}):null}function Se({field:t,fieldState:n}){return s.jsxs("div",{className:"w-64 bg-background p-0",children:[s.jsxs("div",{className:"mb-2 flex items-start justify-between gap-2",children:[s.jsx("h3",{className:"text-sm font-medium text-foreground",children:t.label||t.name}),s.jsx("span",{className:"rounded bg-muted px-2 py-0.5 font-mono text-xs text-muted-foreground",children:t.dataType})]}),t.description&&s.jsx("p",{className:"mb-3 text-xs text-muted-foreground",children:t.description}),n&&n.tooltip&&s.jsx("div",{className:"mb-2 rounded bg-muted/50 p-2",children:s.jsx("p",{className:"text-xs text-muted-foreground",children:n.tooltip})}),s.jsx("div",{className:"overflow-x-auto border-t border-border pb-2 pt-2",children:s.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:t.name})})]})}function Ce({field:t,context:n="editor",fieldState:r}){const a=e.useEditorStore(E=>E.isDevMode),l=n==="filter",d=a||l||(r==null?void 0:r.state)==="unreachable"&&!l,u=e.useDashboardStore(E=>E.dashboard.filters),m=e.useDashboardStore(E=>E.selectedSheetId),p=e.useDashboardStore(E=>E.actions.removeFilter),{removeFilterValues:y}=e.useDashboardActions(),{assignFilter:C}=re.useAssignFilter(),F=l?e.getSheetScopedFilters(u,m):u,g=l?F==null?void 0:F.find(E=>{var R;return E.title===t.name||((R=E.column)==null?void 0:R.includes(t.name))}):void 0,o=!!g,h=g&&l?u==null?void 0:u.find(E=>E.id===g.id):void 0,N=h&&(h.applyToSheetIds&&h.applyToSheetIds.length>1||h.excludeSheetIds&&h.excludeSheetIds.length>0||!h.applyToSheetIds&&!h.excludeSheetIds&&!h.sheetId);l&&o&&console.log("[SourceField Debug]",{fieldName:t.name,hasActiveFilter:o,activeFilterOnSheet:g?{id:g.id,title:g.title,column:g.column,applyToSheetIds:g.applyToSheetIds,excludeSheetIds:g.excludeSheetIds}:null,activeFilterForField:h?{id:h.id,title:h.title,column:h.column,applyToSheetIds:h.applyToSheetIds,excludeSheetIds:h.excludeSheetIds}:null,isMultiSheetFilter:N,selectedSheetId:m});const[T,v]=S.useState(!1),[A,D]=S.useState(null),{attributes:$,listeners:M,setNodeRef:x,transform:b,transition:k,isDragging:I}=e.useSortable({id:t.id,disabled:d}),[V,O]=S.useState(!1),q=e.useEditorStore(E=>E.card),{handleFieldClick:Q}=ee(q),{handleDevModeFieldClick:c,isNumberField:i}=se(),j=()=>{h&&(console.log("[SourceField] Removing multi-sheet filter:",h.id),y(h.id),p(h.id)),D(null),v(!1)},f=()=>{if(l){const E={column_name:t.name,data_type:t.dataType,label:t.label,description:t.description};console.log("[SourceField Click]",{fieldName:t.name,hasActiveFilter:o,isMultiSheetFilter:N,willShowWarning:o&&N}),o&&N?(console.log("[SourceField] Showing warning dialog for multi-sheet filter"),D({column:E,field:t}),v(!0)):(console.log("[SourceField] Calling assignFilter directly (single-sheet or new filter)"),C(E,"sheet",t))}else a?c(t):Q(t)},w={column_name:t.name,data_type:t.dataType,label:t.label,description:t.description},B={transform:e.CSS.Transform.toString(b),transition:k},U=(()=>{if(!r||l)return{};const R={base:{hoverBorderColor:"hover:border-blue-500/40",hoverBgColor:"hover:bg-blue-50/50 dark:hover:bg-blue-950/20"},draggable:{hoverBorderColor:"hover:border-green-500/40",hoverBgColor:"hover:bg-green-50/30 dark:hover:bg-green-950/20"},indirect:{hoverBorderColor:"hover:border-yellow-500/40",hoverBgColor:"hover:bg-yellow-50/30 dark:hover:bg-yellow-950/20"},unreachable:{borderColor:"border-gray-300/40 dark:border-gray-700/40",bgColor:"bg-gray-50/30 dark:bg-gray-900/20",hoverBgColor:"hover:bg-gray-100/30 dark:hover:bg-gray-800/20",opacity:"opacity-50",cursor:"cursor-not-allowed"}}[r.state]||{};return r.isSelected&&{base:{borderColor:"border-blue-300/30 dark:border-blue-700/30",bgColor:"bg-blue-50/20 dark:bg-blue-950/10",...R},draggable:{borderColor:"border-green-300/30 dark:border-green-700/30",bgColor:"bg-green-50/20 dark:bg-green-950/10",...R},indirect:{borderColor:"border-yellow-300/30 dark:border-yellow-700/30",bgColor:"bg-yellow-50/20 dark:bg-yellow-950/10",...R}}[r.state]||R})();return s.jsxs("div",{ref:x,style:B,...d?{}:$,...d?{}:M,className:e.cn("group/container max-w-[265px] overflow-hidden rounded-lg transition-all",I&&"scale-95 opacity-50",!I&&"border",U.borderColor||"border-transparent",U.bgColor||"",U.hoverBorderColor,U.hoverBgColor||"hover:bg-muted",U.opacity,U.cursor,o&&"bg-accent border-accent-foreground/20",{"cursor-pointer":a||l,"cursor-grab active:cursor-grabbing":!d&&!a&&!l}),title:r==null?void 0:r.tooltip,children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-3 p-2",onClick:f,children:[e.getFieldIconComponent(t.dataType),s.jsx(e.TooltipProvider,{children:s.jsxs(e.Tooltip,{children:[s.jsx(e.TooltipTrigger,{asChild:!0,children:s.jsx("div",{className:"min-w-0 flex-1 overflow-hidden",children:s.jsx("span",{className:`block text-sm text-foreground/80 hover:text-foreground dark:text-muted-foreground ${V?"whitespace-normal break-words":"truncate"}`,children:t.label||t.name})})}),s.jsx(e.TooltipContent,{side:"bottom",align:"start",className:"ml-5 max-w-xs px-4 pb-2 pt-4",children:s.jsx(Se,{field:t,fieldState:r})})]})}),a&&!l&&i(t)&&s.jsx("div",{onClick:E=>E.stopPropagation(),children:s.jsx(xe,{column:w})})]}),V&&s.jsx("div",{className:"text-muted-foreground-700 px-2 pb-3 text-sm",children:s.jsx(e.Card,{className:"",children:s.jsxs(e.CardContent,{className:"space-y-2 p-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ae.Tag,{className:"h-4 w-4 text-muted-foreground"}),s.jsx("span",{className:"break-all",children:t.label||t.name})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(oe,{className:"h-4 w-4 text-muted-foreground"}),s.jsx("span",{className:"break-all",children:t.name})]}),s.jsx(e.Badge,{variant:"outline",className:"mt-2 text-xs",children:t.dataType})]})})}),s.jsx(e.AlertDialog,{open:T,onOpenChange:v,children:s.jsxs(e.AlertDialogContent,{children:[s.jsxs(e.AlertDialogHeader,{children:[s.jsx(e.AlertDialogTitle,{children:"Remove Filter from Multiple Sheets?"}),s.jsx(e.AlertDialogDescription,{children:"This filter is currently applied to multiple sheets. Removing it will affect all sheets where it's applied."})]}),s.jsxs(e.AlertDialogFooter,{children:[s.jsx(e.AlertDialogCancel,{children:"Cancel"}),s.jsx(e.AlertDialogAction,{onClick:j,children:"Remove Filter"})]})]})})]})}function Ne({context:t="editor"}={}){var V,O,q,Q;const[n,r]=S.useState(""),[a,l]=S.useState("all");e.useEditorStore(c=>c.isDevMode);const d=e.useEditorStore(c=>c.card.dataSource),u=e.useEditorStore(c=>c.card.config),m=e.useEditorStore(c=>c.card),{autoJoinMetadata:p}=e.useDashboardCardQuery(m),{columns:y=[],columnGroups:C=[],isLoading:F,error:g}=e.useColumns(),o=(d==null?void 0:d.mode)==="semanticDomain"?d.semanticDomainId:void 0,{data:h}=K(o),N=[...(u==null?void 0:u.groupByColumns)||[],...(u==null?void 0:u.metricColumns)||[]];(O=(V=u==null?void 0:u.joinPlan)==null?void 0:V.baseEntity)==null||O.name,(Q=(q=p==null?void 0:p.resolvedJoinPlan)==null?void 0:q.baseEntity)==null||Q.name,se();const T=y.filter(c=>c.name.toLowerCase().includes(n.toLowerCase())||c.dataType.toLowerCase().includes(n.toLowerCase())||c.label&&c.label.toLowerCase().includes(n.toLowerCase())||c.qualifiedEntityName&&c.qualifiedEntityName.toLowerCase().includes(n.toLowerCase())),v=c=>{if(c.dataType==="number"||c.dataType==="integer"||c.dataType==="float"||c.dataType==="decimal"||c.dataType==="currency")return"metrics";const i=e.getDataType(c.dataType);return["date","string","boolean"].includes(i)?"dimensions":i==="number"?"metrics":"dimensions"},D=(a==="all"?T:T.filter(c=>v(c)===a)).reduce((c,i)=>{const j=i.qualifiedEntityName||"Other Fields";return c[j]||(c[j]={label:e.toLabel(i.entityName),fields:[]}),c[j].fields.push(i),c},{}),M=Object.keys(D),x=T.filter(c=>v(c)==="dimensions").length,b=T.filter(c=>v(c)==="metrics").length,k=T.filter(c=>v(c)==="calculated").length,I=T.length>0;return F?s.jsx("div",{className:"flex h-full w-[290px] flex-col items-center justify-center",children:s.jsx(e.LoadingDots,{size:"md",color:"muted","aria-label":"Loading data"})}):g?s.jsxs("div",{className:"flex h-full w-[290px] flex-col items-center justify-center",children:[s.jsx(e.Database,{className:"mb-4 h-12 w-12 text-red-300"}),s.jsx("p",{className:"mb-2 text-sm text-red-500",children:"Error loading fields"}),s.jsx("p",{className:"px-4 text-center text-xs text-red-400",children:g.message||"Failed to load column data"})]}):!d||!d.selectedEntities||d.selectedEntities.length===0?s.jsx(e.ScrollArea,{className:"h-[calc(100vh-200px)] w-[290px]",children:s.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[s.jsx(e.Database,{className:"mb-4 h-12 w-12 text-gray-300"}),s.jsx("p",{className:"mb-2 text-sm text-gray-500",children:"No data source selected"}),s.jsx("p",{className:"px-4 text-xs text-gray-400",children:t==="filter"?"Configure a data source for this card to see available fields":"Select a table, view, or dataset from the data source panel to see available fields"})]})}):s.jsxs("div",{className:"mt-2 flex h-full w-full grow flex-col gap-2 px-6 pb-6",children:[s.jsxs("div",{className:"mt-1 flex-shrink-0 space-y-2",children:[y.length>0&&s.jsxs("div",{className:"relative mb-4",children:[s.jsx(e.Search,{className:"absolute left-3 top-1/2 size-3.5 -translate-y-1/2 transform text-muted-foreground"}),s.jsx(e.Input$1,{className:"pl-10 pr-10",type:"text",placeholder:"Search fields...",value:n,onChange:c=>r(c.target.value)}),n&&s.jsx("button",{className:"absolute right-3 top-1/2 -translate-y-1/2 transform text-muted-foreground hover:text-foreground",onClick:()=>r(""),type:"button",children:s.jsx(e.X,{className:"size-3.5"})})]}),I&&s.jsx(e.Tabs,{defaultValue:"all",value:a,onValueChange:c=>l(c),className:"mb-4",children:s.jsxs(e.TabsList,{className:"grid h-9 w-full grid-cols-4",children:[s.jsxs(e.TabsTrigger,{value:"all",className:"text-xs",children:["All",s.jsx("span",{className:"ml-2 text-xs font-semibold",children:T.length})]}),s.jsxs(e.TabsTrigger,{value:"dimensions",className:"text-xs",children:[s.jsx(e.Layers,{className:"size-4 shrink-0"}),s.jsx("span",{className:"ml-2 text-xs font-semibold",children:x})]}),s.jsxs(e.TabsTrigger,{value:"metrics",className:"text-xs",children:[s.jsx(e.ChartColumn,{className:"size-4 shrink-0"}),s.jsx("span",{className:"ml-2 text-xs font-semibold",children:b})]}),s.jsxs(e.TabsTrigger,{value:"calculated",className:"text-xs",children:[s.jsx(e.Calculator,{className:"size-4 shrink-0"}),s.jsx("span",{className:"ml-2 text-xs font-semibold",children:k})]})]})})]}),s.jsxs(e.CustomScrollArea,{className:"py-2",children:[s.jsx(e.Accordion,{type:"multiple",defaultValue:M,className:"space-y-2",children:Object.entries(D).map(([c,i])=>{const j=C.find(f=>f.entityName===c)||{entityName:c,label:i.label};return s.jsxs(e.AccordionItem,{value:c,className:"border-none",children:[s.jsx(e.AccordionTrigger,{className:"group rounded-md px-2.5 py-2 text-muted-foreground hover:bg-muted hover:no-underline",children:s.jsxs("div",{title:j.label||j.entityName,className:"flex items-center gap-2",children:[s.jsx("span",{className:"max-w-[190px] truncate text-ellipsis whitespace-nowrap text-sm font-medium text-primary",children:j.label||j.entityName}),s.jsx(e.Badge,{variant:"secondary",className:"rounded-full text-xs text-muted-foreground group-hover:bg-background",children:i.fields.length})]})}),s.jsx(e.AccordionContent,{className:"pb-2",children:s.jsx("div",{className:"space-y-1",children:i.fields.map(f=>{const w=e.calculateFieldState(f,{joinabilityMap:(h==null?void 0:h.joinabilityMap)||null,selectedFields:N,cardConfig:u,autoJoinMetadata:p});return s.jsx(Ce,{field:f,context:t,fieldState:w},f.id)})})})]},c)})}),Object.keys(D).length===0&&y.length===0&&s.jsxs("div",{className:"py-8 text-center text-sm text-gray-500",children:[s.jsx("p",{children:"No fields found for selected data source"}),s.jsx("p",{className:"mt-1 text-xs text-gray-400",children:t==="filter"?"The selected data source has no available fields":"Try selecting different data sources"})]}),Object.keys(D).length===0&&y.length>0&&s.jsx("div",{className:"py-4 text-center text-sm text-gray-500",children:"No fields found for this category"}),s.jsx(e.ScrollBar,{orientation:"horizontal"}),s.jsx(e.ScrollBar,{orientation:"vertical"})]})]})}function ve({context:t="editor"}={}){return s.jsxs("div",{"data-content":"fields-section",className:"flex h-full grow flex-col items-center overflow-hidden",children:[" ",s.jsx(Ne,{context:t})," "]})}function je(){const t=e.useEditorStore(u=>u.card.dataSource),{setSelectedConnectionId:n,setSelectedDatabaseName:r,setSelectedSchemaName:a,setSelectedTableName:l,setSelectedDatamodelId:d}=e.useEditorActions();S.useEffect(()=>{var o;if(!t)return;const{tableName:u,schemaName:m,databaseName:p,connectionId:y}=W(t),C=(o=t.selectedEntities)==null?void 0:o[0],g=(C==null?void 0:C.type)==="model"&&"id"in C?C.id:"";n(y||""),r(p||""),a(m||""),l(u||""),d(g)},[t,n,r,a,l,d])}function Fe(t,n){const[r,a]=S.useState(()=>{const l=localStorage.getItem(t);return l?JSON.parse(l):n});return S.useEffect(()=>{localStorage.setItem(t,JSON.stringify(r))},[r,t]),[r,a]}exports.EditorAcceptButton=me;exports.EditorCancelButton=fe;exports.EditorClearButton=ye;exports.FieldsSection=ve;exports.Save=z;exports.VisualApplyLocalButton=ge;exports.VisualSaveAndApplyButton=he;exports.VisualSaveButton=pe;exports.cleanupKpiMetricComparisonMode=Z;exports.useClickOutside=ie;exports.useFieldManagement=ee;exports.useJoinabilityMap=K;exports.useLocalStorageState=Fe;exports.useRemoteChartStore=P;exports.useSyncLegacyEditorState=je;exports.useVisualUtils=_;exports.validateFieldForChartType=Y;
|