@nivaro/react 0.3.116 → 0.3.117
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/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/shared/components/CollectionBrowserView.js +1629 -1621
- package/dist/shared/components/ReportView.js +1086 -1091
- package/dist/shared/components/cbv/column-totals.js +62 -57
- package/dist/shared/components/charts/category-axis.js +93 -0
- package/dist/shared/components/pipeline/BindingStartStateSettings.js +163 -0
- package/dist/shared/components/pipeline/PipelineEditorView.js +313 -297
- package/dist/shared/lib/use-query-entry.js +17 -0
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { formatValue as
|
|
1
|
+
import { formatValue as b } from "../../lib/format-value.js";
|
|
2
2
|
const g = [
|
|
3
3
|
{ fn: "sum", label: "Sum", short: "Sum" },
|
|
4
4
|
{ fn: "avg", label: "Average", short: "Avg" },
|
|
@@ -6,63 +6,68 @@ const g = [
|
|
|
6
6
|
{ fn: "max", label: "Maximum", short: "Max" },
|
|
7
7
|
{ fn: "count", label: "Count (filled in)", short: "Count" }
|
|
8
8
|
];
|
|
9
|
-
function
|
|
9
|
+
function S(e) {
|
|
10
10
|
return typeof e == "string" && g.some((n) => n.fn === e);
|
|
11
11
|
}
|
|
12
12
|
function v(e) {
|
|
13
13
|
return /^[A-Za-z_][A-Za-z0-9_]*$/.test(e);
|
|
14
14
|
}
|
|
15
|
-
function w(e, n
|
|
15
|
+
function w(e, n) {
|
|
16
|
+
const t = /* @__PURE__ */ new Map();
|
|
17
|
+
for (const r of e) {
|
|
18
|
+
const o = t.get(r.fn) ?? [];
|
|
19
|
+
o.includes(r.key) || o.push(r.key), t.set(r.fn, o);
|
|
20
|
+
}
|
|
16
21
|
return {
|
|
17
|
-
[
|
|
18
|
-
...
|
|
19
|
-
...
|
|
22
|
+
...Object.fromEntries([...t].map(([r, o]) => [r, o.join(",")])),
|
|
23
|
+
...n.search ? { search: n.search } : {},
|
|
24
|
+
...n.conditions ? { conditions: n.conditions } : {}
|
|
20
25
|
};
|
|
21
26
|
}
|
|
22
|
-
function
|
|
23
|
-
var
|
|
24
|
-
const r = (c = (l = (
|
|
27
|
+
function x(e, n, t) {
|
|
28
|
+
var s, l, c;
|
|
29
|
+
const r = (c = (l = (s = e == null ? void 0 : e.data) == null ? void 0 : s[0]) == null ? void 0 : l[t]) == null ? void 0 : c[n];
|
|
25
30
|
if (r == null || r === "") return null;
|
|
26
31
|
const o = Number(r);
|
|
27
32
|
return Number.isFinite(o) ? o : null;
|
|
28
33
|
}
|
|
29
|
-
function
|
|
30
|
-
return n === "count" ? Math.round(e).toLocaleString("en-US") : (t == null ? void 0 : t.type) === "number" ?
|
|
34
|
+
function M(e, n, t) {
|
|
35
|
+
return n === "count" ? Math.round(e).toLocaleString("en-US") : (t == null ? void 0 : t.type) === "number" ? b(String(e), t) : (Math.round(e * 100) / 100).toLocaleString("en-US", { maximumFractionDigits: 2 });
|
|
31
36
|
}
|
|
32
|
-
const p = (e) => `nvr_cbv_totals_${e}`,
|
|
33
|
-
function
|
|
34
|
-
return
|
|
37
|
+
const p = (e) => `nvr_cbv_totals_${e}`, y = (e) => e === "off" || S(e);
|
|
38
|
+
function $(e) {
|
|
39
|
+
return _(p(e), v);
|
|
35
40
|
}
|
|
36
|
-
function
|
|
37
|
-
|
|
41
|
+
function j(e, n) {
|
|
42
|
+
O(p(e), n);
|
|
38
43
|
}
|
|
39
|
-
function
|
|
44
|
+
function _(e, n) {
|
|
40
45
|
try {
|
|
41
46
|
const t = localStorage.getItem(e), r = t ? JSON.parse(t) : null;
|
|
42
47
|
if (!r || typeof r != "object") return {};
|
|
43
|
-
const o = r.v === 2 && r.o && typeof r.o == "object" ? r.o : r,
|
|
44
|
-
for (const [l, c] of Object.entries(o)) n(l) &&
|
|
45
|
-
return
|
|
48
|
+
const o = r.v === 2 && r.o && typeof r.o == "object" ? r.o : r, s = {};
|
|
49
|
+
for (const [l, c] of Object.entries(o)) n(l) && y(c) && (s[l] = c);
|
|
50
|
+
return s;
|
|
46
51
|
} catch {
|
|
47
52
|
return {};
|
|
48
53
|
}
|
|
49
54
|
}
|
|
50
|
-
function
|
|
55
|
+
function O(e, n) {
|
|
51
56
|
try {
|
|
52
57
|
Object.keys(n).length === 0 ? localStorage.removeItem(e) : localStorage.setItem(e, JSON.stringify({ v: 2, o: n }));
|
|
53
58
|
} catch {
|
|
54
59
|
}
|
|
55
60
|
}
|
|
56
|
-
function
|
|
61
|
+
function z(e, n) {
|
|
57
62
|
const t = { ...e };
|
|
58
63
|
for (const [r, o] of Object.entries(n))
|
|
59
64
|
o === "off" ? delete t[r] : t[r] = o;
|
|
60
65
|
return t;
|
|
61
66
|
}
|
|
62
|
-
function
|
|
67
|
+
function F(e, n, t) {
|
|
63
68
|
return { ...e, [n]: t ?? "off" };
|
|
64
69
|
}
|
|
65
|
-
function
|
|
70
|
+
function N(e, n) {
|
|
66
71
|
const t = {};
|
|
67
72
|
for (const [r, o] of Object.entries(e))
|
|
68
73
|
(o === "off" ? !n[r] : n[r] === o) || (t[r] = o);
|
|
@@ -71,8 +76,8 @@ function Z(e, n) {
|
|
|
71
76
|
function h(e) {
|
|
72
77
|
return !e.computed_formula || !!e.computed_store;
|
|
73
78
|
}
|
|
74
|
-
const
|
|
75
|
-
function
|
|
79
|
+
const T = /* @__PURE__ */ new Set(["integer", "bigInteger", "biginteger", "decimal", "float"]);
|
|
80
|
+
function A(e) {
|
|
76
81
|
const n = String(e ?? "").trim();
|
|
77
82
|
if (!n) return null;
|
|
78
83
|
let t = 0;
|
|
@@ -80,9 +85,9 @@ function O(e) {
|
|
|
80
85
|
for (; t < n.length && /\s/.test(n[t]); ) t++;
|
|
81
86
|
}, o = () => {
|
|
82
87
|
r();
|
|
83
|
-
const a = n.slice(t),
|
|
84
|
-
if (
|
|
85
|
-
return t +=
|
|
88
|
+
const a = n.slice(t), i = /^item\.([A-Za-z_][A-Za-z0-9_]*)/.exec(a);
|
|
89
|
+
if (i)
|
|
90
|
+
return t += i[0].length, i[1];
|
|
86
91
|
const u = /^\{\{\s*([A-Za-z_][A-Za-z0-9_.]*)\s*\}\}/.exec(a);
|
|
87
92
|
if (u)
|
|
88
93
|
return t += u[0].length, u[1];
|
|
@@ -93,21 +98,21 @@ function O(e) {
|
|
|
93
98
|
return !d || !m ? null : (t += m[0].length, d);
|
|
94
99
|
}
|
|
95
100
|
return null;
|
|
96
|
-
},
|
|
97
|
-
let
|
|
101
|
+
}, s = /* @__PURE__ */ new Map(), l = (a) => {
|
|
102
|
+
let i = !0;
|
|
98
103
|
for (; ; ) {
|
|
99
104
|
r();
|
|
100
105
|
let u = a;
|
|
101
106
|
if (n[t] === "+" || n[t] === "-")
|
|
102
107
|
n[t] === "-" && (u = u === 1 ? -1 : 1), t++, r();
|
|
103
|
-
else if (!
|
|
104
|
-
if (
|
|
108
|
+
else if (!i) return !1;
|
|
109
|
+
if (i = !1, n[t] === "(") {
|
|
105
110
|
if (t++, !l(u) || (r(), n[t] !== ")")) return !1;
|
|
106
111
|
t++;
|
|
107
112
|
} else {
|
|
108
113
|
const f = o();
|
|
109
114
|
if (!f) return !1;
|
|
110
|
-
|
|
115
|
+
s.set(f, (s.get(f) ?? 0) + u);
|
|
111
116
|
}
|
|
112
117
|
if (r(), t >= n.length || n[t] === ")") return !0;
|
|
113
118
|
if (n[t] !== "+" && n[t] !== "-") return !1;
|
|
@@ -115,18 +120,18 @@ function O(e) {
|
|
|
115
120
|
};
|
|
116
121
|
if (!l(1) || (r(), t !== n.length)) return null;
|
|
117
122
|
const c = [];
|
|
118
|
-
for (const [a,
|
|
119
|
-
if (
|
|
120
|
-
else if (
|
|
123
|
+
for (const [a, i] of s)
|
|
124
|
+
if (i === 1 || i === -1) c.push({ field: a, sign: i });
|
|
125
|
+
else if (i !== 0) return null;
|
|
121
126
|
return c.length ? c : null;
|
|
122
127
|
}
|
|
123
|
-
function
|
|
128
|
+
function Z(e, n) {
|
|
124
129
|
if (h(e)) return { kind: "server" };
|
|
125
130
|
if (e.computed_type !== "rollup") {
|
|
126
|
-
const t =
|
|
131
|
+
const t = A(e.computed_formula ?? "");
|
|
127
132
|
if (t != null && t.every((r) => {
|
|
128
133
|
const o = n(r.field);
|
|
129
|
-
return !!o && h(o) &&
|
|
134
|
+
return !!o && h(o) && T.has(String(o.type ?? ""));
|
|
130
135
|
}))
|
|
131
136
|
return { kind: "derived", terms: t };
|
|
132
137
|
}
|
|
@@ -135,7 +140,7 @@ function C(e, n) {
|
|
|
135
140
|
why: e.computed_type === "rollup" ? "Worked out from linked records each time the list is read, so it has no total." : "Calculated each time the list is read from a formula that does more than add and subtract stored columns, so it has no total."
|
|
136
141
|
};
|
|
137
142
|
}
|
|
138
|
-
function
|
|
143
|
+
function C(e, n) {
|
|
139
144
|
let t = 0;
|
|
140
145
|
for (const r of e) {
|
|
141
146
|
const o = n(r.field);
|
|
@@ -145,27 +150,27 @@ function F(e, n) {
|
|
|
145
150
|
return Math.round(t * 1e6) / 1e6;
|
|
146
151
|
}
|
|
147
152
|
function L(e, n, t) {
|
|
148
|
-
var
|
|
149
|
-
const r = ((
|
|
153
|
+
var s;
|
|
154
|
+
const r = ((s = g.find((l) => l.fn === e)) == null ? void 0 : s.label.toLowerCase()) ?? e, o = t == null ? "all matching records" : `all ${t.toLocaleString("en-US")} matching records`;
|
|
150
155
|
return e === "count" ? `Records with ${n} filled in, across ${o}` : `${r.charAt(0).toUpperCase()}${r.slice(1)} of ${n} across ${o}`;
|
|
151
156
|
}
|
|
152
157
|
export {
|
|
153
158
|
g as TOTAL_FNS,
|
|
154
|
-
|
|
155
|
-
|
|
159
|
+
C as combineTerms,
|
|
160
|
+
M as formatTotal,
|
|
156
161
|
h as isStoredField,
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
162
|
+
S as isTotalFn,
|
|
163
|
+
A as linearSumTerms,
|
|
164
|
+
$ as loadTotalOverrides,
|
|
165
|
+
_ as loadTotalOverridesAt,
|
|
166
|
+
N as overridesAfterSave,
|
|
167
|
+
x as readTotal,
|
|
168
|
+
j as rememberTotalOverrides,
|
|
169
|
+
O as rememberTotalOverridesAt,
|
|
170
|
+
F as setOverride,
|
|
171
|
+
z as shownTotals,
|
|
167
172
|
L as totalTip,
|
|
173
|
+
w as totalsBatchParams,
|
|
168
174
|
v as totalsEligibleKey,
|
|
169
|
-
|
|
170
|
-
C as totalsSupport
|
|
175
|
+
Z as totalsSupport
|
|
171
176
|
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as M, useState as h, useLayoutEffect as S, useEffect as T, useMemo as w } from "react";
|
|
3
|
+
const p = 10.5, v = 10, _ = 0.4, y = 40;
|
|
4
|
+
let u;
|
|
5
|
+
function x(t, o = p) {
|
|
6
|
+
if (u === void 0)
|
|
7
|
+
try {
|
|
8
|
+
u = typeof document < "u" ? document.createElement("canvas").getContext("2d") : null;
|
|
9
|
+
} catch {
|
|
10
|
+
u = null;
|
|
11
|
+
}
|
|
12
|
+
if (u) {
|
|
13
|
+
const i = typeof getComputedStyle == "function" && typeof document < "u" && getComputedStyle(document.body).fontFamily || "sans-serif";
|
|
14
|
+
u.font = `${o}px ${i}`;
|
|
15
|
+
const n = u.measureText(t).width;
|
|
16
|
+
if (n > 0) return n;
|
|
17
|
+
}
|
|
18
|
+
return t.length * o * 0.56;
|
|
19
|
+
}
|
|
20
|
+
function $(t, o) {
|
|
21
|
+
const i = Math.ceil(t + v), n = o > 0 ? Math.floor(o * _) : 200;
|
|
22
|
+
return Math.max(y, Math.min(i, Math.max(y, n)));
|
|
23
|
+
}
|
|
24
|
+
function b(t, o, i = (n) => x(n)) {
|
|
25
|
+
if (i(t) <= o) return { text: t, cut: !1 };
|
|
26
|
+
let n = 0, r = t.length;
|
|
27
|
+
for (; n < r; ) {
|
|
28
|
+
const d = Math.ceil((n + r) / 2);
|
|
29
|
+
i(`${t.slice(0, d).trimEnd()}…`) <= o ? n = d : r = d - 1;
|
|
30
|
+
}
|
|
31
|
+
return { text: `${t.slice(0, n).trimEnd()}…`, cut: !0 };
|
|
32
|
+
}
|
|
33
|
+
function k(t, o = String) {
|
|
34
|
+
const i = M(null), [n, r] = h(0);
|
|
35
|
+
S(() => {
|
|
36
|
+
const e = i.current;
|
|
37
|
+
if (!e || (r(e.clientWidth), typeof ResizeObserver > "u")) return;
|
|
38
|
+
const c = new ResizeObserver(() => r(e.clientWidth));
|
|
39
|
+
return c.observe(e), () => c.disconnect();
|
|
40
|
+
}, []);
|
|
41
|
+
const [d, g] = h(0);
|
|
42
|
+
T(() => {
|
|
43
|
+
var a;
|
|
44
|
+
const e = typeof document < "u" ? document.fonts : void 0;
|
|
45
|
+
if (!e) return;
|
|
46
|
+
let c = !0;
|
|
47
|
+
const l = () => c && g((s) => s + 1);
|
|
48
|
+
return e.ready.then(l), (a = e.addEventListener) == null || a.call(e, "loadingdone", l), () => {
|
|
49
|
+
var s;
|
|
50
|
+
c = !1, (s = e.removeEventListener) == null || s.call(e, "loadingdone", l);
|
|
51
|
+
};
|
|
52
|
+
}, []);
|
|
53
|
+
const C = t.map((e) => o(e)).join("\0"), A = w(
|
|
54
|
+
() => Math.max(0, ...t.map((e) => x(o(e)))),
|
|
55
|
+
[C, d]
|
|
56
|
+
), m = $(A, n), E = m - v;
|
|
57
|
+
return {
|
|
58
|
+
ref: i,
|
|
59
|
+
yAxisProps: { width: m, tick: (e) => {
|
|
60
|
+
var s;
|
|
61
|
+
const c = o(((s = e.payload) == null ? void 0 : s.value) ?? ""), { text: l, cut: a } = b(c, E);
|
|
62
|
+
return /* @__PURE__ */ f("g", { transform: `translate(${e.x ?? 0},${e.y ?? 0})`, "data-tip": a ? c : void 0, children: /* @__PURE__ */ f(
|
|
63
|
+
"text",
|
|
64
|
+
{
|
|
65
|
+
x: 0,
|
|
66
|
+
y: 0,
|
|
67
|
+
dy: "0.35em",
|
|
68
|
+
textAnchor: "end",
|
|
69
|
+
fontSize: p,
|
|
70
|
+
fill: "currentColor",
|
|
71
|
+
children: l
|
|
72
|
+
}
|
|
73
|
+
) });
|
|
74
|
+
}, interval: 0, tickLine: !1 }
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function O({
|
|
78
|
+
labels: t,
|
|
79
|
+
format: o,
|
|
80
|
+
className: i,
|
|
81
|
+
children: n
|
|
82
|
+
}) {
|
|
83
|
+
const r = k(t, o);
|
|
84
|
+
return /* @__PURE__ */ f("div", { ref: r.ref, className: i, children: n(r.yAxisProps) });
|
|
85
|
+
}
|
|
86
|
+
export {
|
|
87
|
+
p as CATEGORY_TICK_FONT_PX,
|
|
88
|
+
O as CategoryAxisBox,
|
|
89
|
+
$ as categoryAxisWidth,
|
|
90
|
+
b as fitLabel,
|
|
91
|
+
x as measureTickText,
|
|
92
|
+
k as useCategoryAxis
|
|
93
|
+
};
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { jsxs as l, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useQuery as v } from "@tanstack/react-query";
|
|
3
|
+
import { X as w, Plus as N, ChevronsUpDown as g } from "lucide-react";
|
|
4
|
+
import { useState as k, useMemo as C } from "react";
|
|
5
|
+
import { useNivaroClient as L } from "../../context.js";
|
|
6
|
+
import { get as S } from "../../lib/commands.js";
|
|
7
|
+
import { Command as A, CommandInput as T, CommandList as _, CommandEmpty as P, CommandGroup as O, CommandItem as $ } from "../ui/command.js";
|
|
8
|
+
import { Popover as q, PopoverTrigger as F, PopoverContent as I } from "../ui/popover.js";
|
|
9
|
+
function b(o) {
|
|
10
|
+
let r = o;
|
|
11
|
+
if (typeof r == "string") {
|
|
12
|
+
const s = r.trim();
|
|
13
|
+
if (!s) return [];
|
|
14
|
+
try {
|
|
15
|
+
r = JSON.parse(s);
|
|
16
|
+
} catch {
|
|
17
|
+
r = s.split(",");
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return Array.isArray(r) ? [...new Set(r.map((s) => String(s ?? "").trim()).filter(Boolean))] : [];
|
|
21
|
+
}
|
|
22
|
+
function f({
|
|
23
|
+
label: o,
|
|
24
|
+
value: r,
|
|
25
|
+
options: s,
|
|
26
|
+
onChange: i,
|
|
27
|
+
addLabel: d,
|
|
28
|
+
findLabel: p,
|
|
29
|
+
emptyText: m,
|
|
30
|
+
noneText: h
|
|
31
|
+
}) {
|
|
32
|
+
const [x, c] = k(!1), u = C(() => new Map(s.map((a) => [a.value.toLowerCase(), a])), [s]), t = s.filter((a) => !r.some((n) => n.toLowerCase() === a.value.toLowerCase()));
|
|
33
|
+
return /* @__PURE__ */ l(
|
|
34
|
+
"fieldset",
|
|
35
|
+
{
|
|
36
|
+
className: "m-0 flex min-w-0 flex-wrap items-center gap-1.5 border-0 p-0",
|
|
37
|
+
"aria-label": o,
|
|
38
|
+
children: [
|
|
39
|
+
r.length === 0 && /* @__PURE__ */ e("span", { className: "text-[12px] text-slate-500 dark:text-slate-400", children: h }),
|
|
40
|
+
r.map((a) => {
|
|
41
|
+
const n = u.get(a.toLowerCase());
|
|
42
|
+
return /* @__PURE__ */ l(
|
|
43
|
+
"span",
|
|
44
|
+
{
|
|
45
|
+
className: "inline-flex h-6 items-center gap-1 rounded-md border border-slate-200 bg-slate-50 pl-2 pr-1 text-[12px] text-slate-700 dark:border-border dark:bg-muted dark:text-slate-200",
|
|
46
|
+
children: [
|
|
47
|
+
/* @__PURE__ */ e("span", { className: "max-w-[16rem] truncate", children: (n == null ? void 0 : n.label) ?? a }),
|
|
48
|
+
/* @__PURE__ */ e(
|
|
49
|
+
"button",
|
|
50
|
+
{
|
|
51
|
+
type: "button",
|
|
52
|
+
onClick: () => i(r.filter((y) => y !== a)),
|
|
53
|
+
"aria-label": `Remove ${(n == null ? void 0 : n.label) ?? a}`,
|
|
54
|
+
className: "rounded p-0.5 text-slate-400 hover:bg-slate-200 hover:text-slate-700 focus-visible:outline focus-visible:outline-2 focus-visible:outline-nvr-cyan dark:hover:bg-slate-700 dark:hover:text-white",
|
|
55
|
+
children: /* @__PURE__ */ e(w, { className: "h-3 w-3" })
|
|
56
|
+
}
|
|
57
|
+
)
|
|
58
|
+
]
|
|
59
|
+
},
|
|
60
|
+
a
|
|
61
|
+
);
|
|
62
|
+
}),
|
|
63
|
+
/* @__PURE__ */ l(q, { open: x, onOpenChange: c, children: [
|
|
64
|
+
/* @__PURE__ */ e(F, { asChild: !0, children: /* @__PURE__ */ l(
|
|
65
|
+
"button",
|
|
66
|
+
{
|
|
67
|
+
type: "button",
|
|
68
|
+
disabled: t.length === 0,
|
|
69
|
+
className: "inline-flex h-6 items-center gap-1 rounded-md border border-dashed border-slate-300 px-2 text-[12px] text-slate-600 hover:border-slate-400 hover:text-slate-900 disabled:cursor-not-allowed disabled:opacity-50 dark:border-border dark:text-slate-300 dark:hover:text-white",
|
|
70
|
+
children: [
|
|
71
|
+
/* @__PURE__ */ e(N, { className: "h-3 w-3" }),
|
|
72
|
+
" ",
|
|
73
|
+
d,
|
|
74
|
+
/* @__PURE__ */ e(g, { className: "h-3 w-3 opacity-60" })
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
) }),
|
|
78
|
+
/* @__PURE__ */ e(I, { align: "start", className: "w-64 p-0", children: /* @__PURE__ */ l(A, { children: [
|
|
79
|
+
/* @__PURE__ */ e(T, { placeholder: p }),
|
|
80
|
+
/* @__PURE__ */ l(_, { children: [
|
|
81
|
+
/* @__PURE__ */ e(P, { children: m }),
|
|
82
|
+
/* @__PURE__ */ e(O, { children: t.map((a) => /* @__PURE__ */ l(
|
|
83
|
+
$,
|
|
84
|
+
{
|
|
85
|
+
value: `${a.label} ${a.hint ?? ""} ${a.value}`,
|
|
86
|
+
onSelect: () => {
|
|
87
|
+
i([...r, a.value]), c(!1);
|
|
88
|
+
},
|
|
89
|
+
children: [
|
|
90
|
+
/* @__PURE__ */ e("span", { className: "truncate", children: a.label }),
|
|
91
|
+
a.hint && /* @__PURE__ */ e("span", { className: "ml-auto truncate font-mono text-[10.5px] text-slate-500 dark:text-slate-400", children: a.hint })
|
|
92
|
+
]
|
|
93
|
+
},
|
|
94
|
+
a.value
|
|
95
|
+
)) })
|
|
96
|
+
] })
|
|
97
|
+
] }) })
|
|
98
|
+
] })
|
|
99
|
+
]
|
|
100
|
+
}
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
function J({
|
|
104
|
+
collection: o,
|
|
105
|
+
roles: r,
|
|
106
|
+
allowed: s,
|
|
107
|
+
states: i,
|
|
108
|
+
onSave: d
|
|
109
|
+
}) {
|
|
110
|
+
const p = L(), m = b(r), h = b(s), { data: x } = v({
|
|
111
|
+
queryKey: ["pipeline-start-state-roles"],
|
|
112
|
+
queryFn: () => p.request(
|
|
113
|
+
S("/roles")
|
|
114
|
+
).then((t) => t.data).catch(() => []),
|
|
115
|
+
staleTime: 5 * 6e4
|
|
116
|
+
}), c = (x ?? []).filter((t) => !t.admin_access).map((t) => ({ value: String(t.id), label: t.name })), u = i.filter((t) => !t.is_initial).map((t) => ({ value: t.key, label: t.label, hint: t.key }));
|
|
117
|
+
return /* @__PURE__ */ l("div", { className: "mt-3 space-y-2.5 border-t border-slate-100 pt-3 dark:border-border", children: [
|
|
118
|
+
/* @__PURE__ */ l("div", { children: [
|
|
119
|
+
/* @__PURE__ */ e("div", { className: "text-[12px] font-medium text-slate-700 dark:text-slate-200", children: "Who may create records in a later step" }),
|
|
120
|
+
/* @__PURE__ */ l("p", { className: "mt-0.5 max-w-[72ch] text-[11.5px] text-slate-500 dark:text-slate-400", children: [
|
|
121
|
+
"An integration or person creating a ",
|
|
122
|
+
o,
|
|
123
|
+
" record can name the step it starts in (",
|
|
124
|
+
/* @__PURE__ */ e("code", { className: "font-mono", children: "start_state" }),
|
|
125
|
+
" in the API). Administrators always may. No transition runs, so its actions (partner pushes, emails set on the move) do not."
|
|
126
|
+
] }),
|
|
127
|
+
/* @__PURE__ */ e("div", { className: "mt-1.5", children: /* @__PURE__ */ e(
|
|
128
|
+
f,
|
|
129
|
+
{
|
|
130
|
+
label: "Roles that may create records in a later step",
|
|
131
|
+
value: m,
|
|
132
|
+
options: c,
|
|
133
|
+
onChange: (t) => d({ start_state_roles: t }),
|
|
134
|
+
addLabel: "Add a role",
|
|
135
|
+
findLabel: "Find a role",
|
|
136
|
+
emptyText: "No role matches.",
|
|
137
|
+
noneText: "Administrators only"
|
|
138
|
+
}
|
|
139
|
+
) })
|
|
140
|
+
] }),
|
|
141
|
+
m.length > 0 && /* @__PURE__ */ l("div", { children: [
|
|
142
|
+
/* @__PURE__ */ e("div", { className: "text-[12px] font-medium text-slate-700 dark:text-slate-200", children: "Which steps" }),
|
|
143
|
+
/* @__PURE__ */ e("p", { className: "mt-0.5 max-w-[72ch] text-[11.5px] text-slate-500 dark:text-slate-400", children: "The steps those roles may start a record in. Leave empty to allow any step." }),
|
|
144
|
+
/* @__PURE__ */ e("div", { className: "mt-1.5", children: /* @__PURE__ */ e(
|
|
145
|
+
f,
|
|
146
|
+
{
|
|
147
|
+
label: "Steps those roles may start a record in",
|
|
148
|
+
value: h,
|
|
149
|
+
options: u,
|
|
150
|
+
onChange: (t) => d({ start_state_allowed: t }),
|
|
151
|
+
addLabel: "Add a step",
|
|
152
|
+
findLabel: "Find a step",
|
|
153
|
+
emptyText: "No step matches.",
|
|
154
|
+
noneText: "Any step"
|
|
155
|
+
}
|
|
156
|
+
) })
|
|
157
|
+
] })
|
|
158
|
+
] });
|
|
159
|
+
}
|
|
160
|
+
export {
|
|
161
|
+
J as BindingStartStateSettings,
|
|
162
|
+
b as parseStartList
|
|
163
|
+
};
|