@code0-tech/pictor 0.0.0-mvp.44 → 0.0.0-mvp.46
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/assets/components/d-flow-input/DFlowInputDataType.style.css +1 -1
- package/dist/assets/components/d-flow-suggestion/DFlowSuggestionSearchInput.style.css +1 -1
- package/dist/assets/components/menu/Menu.style.css +1 -1
- package/dist/components/d-flow/DFlow.service.js +31 -23
- package/dist/components/d-flow-data-type/DFlowDataType.service.d.ts +2 -2
- package/dist/components/d-flow-data-type/rules/DFlowDataTypeContainsKeyRule.js +22 -13
- package/dist/components/d-flow-data-type/rules/DFlowDataTypeContainsTypeRule.js +19 -13
- package/dist/components/d-flow-file/DFlowTabDefault.js +38 -37
- package/dist/components/d-flow-file/DFlowTabTrigger.js +1 -1
- package/dist/components/d-flow-file/DFlowTabs.js +57 -105
- package/dist/components/d-flow-input/DFlowInput.d.ts +11 -0
- package/dist/components/d-flow-input/DFlowInput.js +29 -0
- package/dist/components/d-flow-input/DFlowInputDefault.d.ts +2 -7
- package/dist/components/d-flow-input/DFlowInputNodeBadge.js +13 -13
- package/dist/components/d-flow-input/DFlowInputObject.d.ts +10 -0
- package/dist/components/d-flow-input/DFlowInputObject.js +83 -0
- package/dist/components/d-flow-input/DFlowInputObjectEditDialog.d.ts +16 -0
- package/dist/components/d-flow-input/DFlowInputObjectEditDialog.js +118 -0
- package/dist/components/d-flow-input/DFlowInputObjectTree.d.ts +16 -0
- package/dist/components/d-flow-input/DFlowInputObjectTree.js +99 -0
- package/dist/components/d-flow-input/DFlowInputReferenceBadge.js +12 -12
- package/dist/components/d-flow-node/DFlowNodeReference.return.hook.d.ts +4 -0
- package/dist/components/d-flow-node/DFlowNodeReference.return.hook.js +77 -0
- package/dist/components/d-flow-suggestion/DFlowReferenceSuggestions.hook.js +104 -103
- package/dist/components/d-flow-suggestion/DFlowSuggestionMenu.js +43 -50
- package/dist/components/d-flow-validation/DNodeValidation.hook.js +44 -39
- package/dist/components/d-project/DNamespaceProject.view.d.ts +7 -1
- package/dist/components/d-project/DNamespaceProject.view.js +7 -1
- package/dist/components/editor/Editor.js +15 -15
- package/dist/components/form/InputSuggestion.js +29 -29
- package/dist/components/form/useForm.d.ts +3 -3
- package/dist/components/form/useForm.js +16 -16
- package/dist/node_modules/prettier/plugins/babel.js +6674 -6685
- package/dist/node_modules/prettier/plugins/estree.js +2830 -2628
- package/dist/node_modules/prettier/standalone.js +1657 -1440
- package/dist/utils/generics.js +85 -97
- package/package.json +26 -26
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { jsx as t, jsxs as u } from "react/jsx-runtime";
|
|
2
|
+
import N from "react";
|
|
3
|
+
import { IconChevronUp as w, IconChevronDown as R } from "@tabler/icons-react";
|
|
4
|
+
import { Flex as j } from "../flex/Flex.js";
|
|
5
|
+
import { Text as a } from "../text/Text.js";
|
|
6
|
+
import "../../utils/contextStore.js";
|
|
7
|
+
import { hashToColor as I } from "../../utils/utils.js";
|
|
8
|
+
import { Badge as A } from "../badge/Badge.js";
|
|
9
|
+
const F = (O) => {
|
|
10
|
+
const {
|
|
11
|
+
object: g,
|
|
12
|
+
parentKey: v,
|
|
13
|
+
isRoot: p = !v,
|
|
14
|
+
onEntryClick: _,
|
|
15
|
+
collapsedState: d,
|
|
16
|
+
setCollapsedState: y,
|
|
17
|
+
path: m = [],
|
|
18
|
+
activePath: i = null,
|
|
19
|
+
onDoubleClick: x,
|
|
20
|
+
parentColor: E
|
|
21
|
+
} = O, o = p ? g?.value : g;
|
|
22
|
+
if (typeof o != "object" || o === null) return null;
|
|
23
|
+
const n = N.useRef(null), S = 250, T = (e) => {
|
|
24
|
+
n.current && clearTimeout(n.current), n.current = setTimeout(() => {
|
|
25
|
+
_(e), n.current = null;
|
|
26
|
+
}, S);
|
|
27
|
+
}, k = (e, r) => {
|
|
28
|
+
n.current && (clearTimeout(n.current), n.current = null), x ? x(e, r) : y(e, !r);
|
|
29
|
+
};
|
|
30
|
+
N.useEffect(() => {
|
|
31
|
+
const e = m ?? [], r = (p ? ["root"] : e).join(".");
|
|
32
|
+
e.length > 1 && d[r] === void 0 && y(e.length === 0 ? ["root"] : e, !0);
|
|
33
|
+
}, [m, p, d, y]);
|
|
34
|
+
const W = () => {
|
|
35
|
+
const e = [...m], r = "root", l = d[r] || !1, h = typeof o == "object" && o !== null && (Array.isArray(o) ? o.length > 0 : Object.keys(o).length > 0), c = Array.isArray(i) && i.length === 0 && v === void 0;
|
|
36
|
+
return /* @__PURE__ */ u("div", { onClick: (s) => {
|
|
37
|
+
s.stopPropagation(), T({
|
|
38
|
+
key: r,
|
|
39
|
+
value: g,
|
|
40
|
+
path: e
|
|
41
|
+
});
|
|
42
|
+
}, onDoubleClick: (s) => {
|
|
43
|
+
s.stopPropagation(), k(e, l);
|
|
44
|
+
}, "aria-selected": c || void 0, children: [
|
|
45
|
+
/* @__PURE__ */ u(j, { align: "center", style: {
|
|
46
|
+
gap: ".35rem",
|
|
47
|
+
textWrap: "nowrap"
|
|
48
|
+
}, "aria-selected": c || void 0, className: "rule", children: [
|
|
49
|
+
h ? l ? /* @__PURE__ */ t(w, { size: 13 }) : /* @__PURE__ */ t(R, { size: 13 }) : null,
|
|
50
|
+
/* @__PURE__ */ t(a, { hierarchy: "tertiary", children: Array.isArray(o) ? "is a list of" : "is a nested object" })
|
|
51
|
+
] }),
|
|
52
|
+
!l && /* @__PURE__ */ t("ul", { children: z })
|
|
53
|
+
] });
|
|
54
|
+
}, z = Array.isArray(o) || o && typeof o == "object" ? Object.entries(o).map(([e, r]) => {
|
|
55
|
+
const l = [...m, e], h = l.join("."), c = d[h] || !1, b = i && i.length > 0 && l.join(".") === i.join("."), s = E ?? I("root"), f = typeof r == "object" && r !== null && (Array.isArray(r) ? r.length > 0 : Object.keys(r ?? {}).length > 0), K = f ? I(h) : s, B = f ? /* @__PURE__ */ u(j, { align: "center", style: {
|
|
56
|
+
gap: ".35rem",
|
|
57
|
+
textWrap: "nowrap"
|
|
58
|
+
}, className: "rule", "aria-selected": b || void 0, children: [
|
|
59
|
+
f ? c ? /* @__PURE__ */ t(w, { size: 13 }) : /* @__PURE__ */ t(R, { size: 13 }) : null,
|
|
60
|
+
/* @__PURE__ */ t(A, { border: !0, color: K, style: {
|
|
61
|
+
verticalAlign: "middle"
|
|
62
|
+
}, children: /* @__PURE__ */ t(a, { size: "xs", style: {
|
|
63
|
+
color: "inherit"
|
|
64
|
+
}, children: e }) }),
|
|
65
|
+
/* @__PURE__ */ t(a, { hierarchy: "tertiary", children: Array.isArray(r) ? "is a list of" : "is a nested object" })
|
|
66
|
+
] }) : /* @__PURE__ */ u(j, { align: "center", style: {
|
|
67
|
+
gap: ".35rem",
|
|
68
|
+
textWrap: "nowrap"
|
|
69
|
+
}, className: "rule", "aria-selected": b || void 0, children: [
|
|
70
|
+
/* @__PURE__ */ t(A, { border: !0, color: s, style: {
|
|
71
|
+
verticalAlign: "middle"
|
|
72
|
+
}, children: /* @__PURE__ */ t(a, { size: "xs", style: {
|
|
73
|
+
color: "inherit"
|
|
74
|
+
}, children: e }) }),
|
|
75
|
+
/* @__PURE__ */ t(a, { hierarchy: "tertiary", children: "has value" }),
|
|
76
|
+
/* @__PURE__ */ t(A, { border: !0, color: "tertiary", style: {
|
|
77
|
+
verticalAlign: "middle"
|
|
78
|
+
}, children: /* @__PURE__ */ t(a, { size: "xs", style: {
|
|
79
|
+
color: "inherit"
|
|
80
|
+
}, children: String(r) }) })
|
|
81
|
+
] });
|
|
82
|
+
return /* @__PURE__ */ t("li", { children: /* @__PURE__ */ u("div", { onClick: (C) => {
|
|
83
|
+
C.stopPropagation(), T({
|
|
84
|
+
key: e,
|
|
85
|
+
value: r,
|
|
86
|
+
path: l
|
|
87
|
+
});
|
|
88
|
+
}, onDoubleClick: (C) => {
|
|
89
|
+
C.stopPropagation(), k(l, c);
|
|
90
|
+
}, children: [
|
|
91
|
+
B,
|
|
92
|
+
f && !c ? /* @__PURE__ */ t(F, { object: r, parentKey: e, isRoot: !1, onEntryClick: _, collapsedState: d, setCollapsedState: y, path: l, activePath: i, parentColor: K }) : null
|
|
93
|
+
] }) }, h);
|
|
94
|
+
}) : null, D = W(), P = ((D && p ? [D] : z) ?? []).filter(Boolean);
|
|
95
|
+
return P.length === 0 ? null : /* @__PURE__ */ t("ul", { children: P });
|
|
96
|
+
};
|
|
97
|
+
export {
|
|
98
|
+
F as DFlowInputObjectTree
|
|
99
|
+
};
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { jsxs as i, jsx as
|
|
2
|
-
import { Badge as
|
|
3
|
-
import
|
|
4
|
-
import { Text as
|
|
1
|
+
import { jsxs as i, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { Badge as m } from "../badge/Badge.js";
|
|
3
|
+
import a from "react";
|
|
4
|
+
import { Text as c } from "../text/Text.js";
|
|
5
5
|
import { Flex as f } from "../flex/Flex.js";
|
|
6
6
|
import { DFlowInputNodeBadge as u } from "./DFlowInputNodeBadge.js";
|
|
7
7
|
import { IconVariable as s } from "@tabler/icons-react";
|
|
8
8
|
const T = (t) => {
|
|
9
9
|
const {
|
|
10
10
|
value: e,
|
|
11
|
-
flowId:
|
|
11
|
+
flowId: n,
|
|
12
12
|
definition: o,
|
|
13
13
|
...d
|
|
14
|
-
} = t, p =
|
|
15
|
-
/* @__PURE__ */
|
|
14
|
+
} = t, p = a.useMemo(() => n ? /* @__PURE__ */ i(f, { align: "center", display: "inline-flex", children: [
|
|
15
|
+
/* @__PURE__ */ r(u, { definition: o, value: {
|
|
16
16
|
id: e.nodeFunctionId,
|
|
17
17
|
__typename: "NodeFunctionIdWrapper"
|
|
18
|
-
}, flowId:
|
|
18
|
+
}, flowId: n }),
|
|
19
19
|
"inputTypeIdentifier" in e && e.inputTypeIdentifier ? "." + e.inputTypeIdentifier : "",
|
|
20
20
|
e.referencePath ? "." + (e.referencePath?.map((l) => l.path).join(".") ?? "") : ""
|
|
21
|
-
] }) : "
|
|
22
|
-
return /* @__PURE__ */ i(
|
|
21
|
+
] }) : "undefined", [e]);
|
|
22
|
+
return /* @__PURE__ */ i(m, { style: {
|
|
23
23
|
verticalAlign: "middle"
|
|
24
24
|
}, color: "warning", py: "0", border: !0, ...d, children: [
|
|
25
|
-
/* @__PURE__ */
|
|
26
|
-
/* @__PURE__ */
|
|
25
|
+
/* @__PURE__ */ r(s, { size: 12 }),
|
|
26
|
+
/* @__PURE__ */ r(c, { size: "sm", style: {
|
|
27
27
|
color: "inherit"
|
|
28
28
|
}, children: p })
|
|
29
29
|
] });
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { DataTypeIdentifier, FlowType, NodeFunction, ReferenceValue } from '@code0-tech/sagittarius-graphql-types';
|
|
2
|
+
import { DFlowFunctionReactiveService, FunctionDefinitionView } from '../d-flow-function';
|
|
3
|
+
import { DFlowDataTypeReactiveService } from '../d-flow-data-type';
|
|
4
|
+
export declare const getReferenceType: (reference: ReferenceValue, dataTypeService: DFlowDataTypeReactiveService, functionService: DFlowFunctionReactiveService, functionDefinition?: FunctionDefinitionView, node?: NodeFunction, flowType?: FlowType) => DataTypeIdentifier | undefined;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { resolveGenericKeys as M, targetForGenericKey as T, replaceGenericKeysInType as h, resolveType as m } from "../../utils/generics.js";
|
|
2
|
+
const G = (e, o, c, D, f, y) => {
|
|
3
|
+
let t, g = /* @__PURE__ */ new Map();
|
|
4
|
+
if (e.nodeFunctionId && (e.inputIndex === void 0 || e.parameterIndex === void 0)) {
|
|
5
|
+
const n = D;
|
|
6
|
+
if (n && n.returnType) {
|
|
7
|
+
if (t = n.returnType, f && f.parameters && n.parameterDefinitions) {
|
|
8
|
+
const r = f.parameters.nodes?.map((a) => a?.value).filter(Boolean);
|
|
9
|
+
if (g = M(n, r, o, c), t) {
|
|
10
|
+
const a = T(n, t), l = new Map(Array.from(g.entries()).filter(([, i]) => i && i.__typename === "DataTypeIdentifier")), p = new Map([...l.entries()].map(([i, u]) => [a.get(i) ?? i, u]));
|
|
11
|
+
t = h(t, p);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
t = t ? m(t, o) : void 0;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
if (e.nodeFunctionId && e.inputIndex !== void 0 && e.inputIndex !== null && e.parameterIndex !== void 0 && e.parameterIndex !== null) {
|
|
18
|
+
const n = D;
|
|
19
|
+
if (n && n.parameterDefinitions) {
|
|
20
|
+
const r = n.parameterDefinitions[e.parameterIndex];
|
|
21
|
+
if (r && r.dataTypeIdentifier) {
|
|
22
|
+
const a = o.getDataType(r.dataTypeIdentifier);
|
|
23
|
+
if (a && a.rules?.nodes) {
|
|
24
|
+
const l = a.rules.nodes.find((p) => p?.variant === "INPUT_TYPES");
|
|
25
|
+
if (l && l.config) {
|
|
26
|
+
const p = l.config;
|
|
27
|
+
if (Array.isArray(p.inputTypes) && e.inputIndex !== void 0 && e.inputIndex !== null) {
|
|
28
|
+
const i = p.inputTypes[e.inputIndex];
|
|
29
|
+
if (i && i.dataTypeIdentifier) {
|
|
30
|
+
if (t = i.dataTypeIdentifier, f && f.parameters && n.parameterDefinitions && t) {
|
|
31
|
+
const u = f.parameters.nodes?.map((d) => d?.value).filter(Boolean);
|
|
32
|
+
g = M(n, u, o, c);
|
|
33
|
+
const s = T(n, t), I = new Map(Array.from(g.entries()).filter(([, d]) => d && d.__typename === "DataTypeIdentifier")), v = new Map([...I.entries()].map(([d, _]) => [s.get(d) ?? d, _]));
|
|
34
|
+
t = h(t, v);
|
|
35
|
+
}
|
|
36
|
+
t = t ? m(t, o) : void 0;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (!t) {
|
|
42
|
+
if (t = r.dataTypeIdentifier, f && f.parameters && n.parameterDefinitions && t) {
|
|
43
|
+
const l = f.parameters.nodes?.map((s) => s?.value).filter(Boolean);
|
|
44
|
+
g = M(n, l, o, c);
|
|
45
|
+
const p = T(n, t), i = new Map(Array.from(g.entries()).filter(([, s]) => s && s.__typename === "DataTypeIdentifier")), u = new Map([...i.entries()].map(([s, I]) => [p.get(s) ?? s, I]));
|
|
46
|
+
t = h(t, u);
|
|
47
|
+
}
|
|
48
|
+
t = t ? m(t, o) : void 0;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
!e.nodeFunctionId && y && y.inputType && (t = {
|
|
54
|
+
dataType: y.inputType
|
|
55
|
+
}, t = t ? m(t, o) : void 0);
|
|
56
|
+
function x(n, r) {
|
|
57
|
+
if (!n || !r || r.length === 0) return n;
|
|
58
|
+
const [a, ...l] = r, p = n.dataType ? o.getDataType(n) : n.genericType?.dataType;
|
|
59
|
+
if (!p || !p.rules?.nodes) return n;
|
|
60
|
+
const i = p.rules.nodes.find((s) => s?.variant === "CONTAINS_KEY" && s.config?.key === a.path);
|
|
61
|
+
if (!i || !i.config) return n;
|
|
62
|
+
const u = i.config;
|
|
63
|
+
return u.dataTypeIdentifier ? x(u.dataTypeIdentifier, l) : n;
|
|
64
|
+
}
|
|
65
|
+
if (t && e.referencePath && e.referencePath.length > 0) {
|
|
66
|
+
const n = e.referencePath.map((a) => ({
|
|
67
|
+
path: typeof a.path == "string" ? a.path : void 0
|
|
68
|
+
})).filter((a) => !!a.path);
|
|
69
|
+
if (n.length !== e.referencePath.length) return t ? m(t, o) : void 0;
|
|
70
|
+
const r = x(t, n);
|
|
71
|
+
return r ? m(r, o) : void 0;
|
|
72
|
+
}
|
|
73
|
+
return t ? m(t, o) : void 0;
|
|
74
|
+
};
|
|
75
|
+
export {
|
|
76
|
+
G as getReferenceType
|
|
77
|
+
};
|
|
@@ -1,132 +1,133 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useService as
|
|
1
|
+
import f from "react";
|
|
2
|
+
import { useService as g, useStore as I } from "../../utils/contextStore.js";
|
|
3
3
|
import "merge-props";
|
|
4
4
|
import "js-md5";
|
|
5
|
-
import { DFlowDataTypeReactiveService as
|
|
6
|
-
import { DFlowSuggestionType as
|
|
7
|
-
import { replaceGenericsAndSortType as C, resolveType as P, isMatchingType as
|
|
8
|
-
import { DFlowFunctionReactiveService as
|
|
5
|
+
import { DFlowDataTypeReactiveService as R } from "../d-flow-data-type/DFlowDataType.service.js";
|
|
6
|
+
import { DFlowSuggestionType as Y } from "./DFlowSuggestion.view.js";
|
|
7
|
+
import { replaceGenericsAndSortType as C, resolveType as P, isMatchingType as k, resolveGenericKeys as J, targetForGenericKey as U, replaceGenericKeysInType as q } from "../../utils/generics.js";
|
|
8
|
+
import { DFlowFunctionReactiveService as G } from "../d-flow-function/DFlowFunction.service.js";
|
|
9
9
|
import "../d-flow/DFlow.js";
|
|
10
|
-
import { DFlowReactiveService as
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
import { DFlowReactiveService as B } from "../d-flow/DFlow.service.js";
|
|
11
|
+
import { useReturnType as z } from "../d-flow-function/DFlowFunction.return.hook.js";
|
|
12
|
+
import { DFlowTypeReactiveService as j } from "../d-flow-type/DFlowType.service.js";
|
|
13
|
+
const pe = (o, t, n, d = []) => {
|
|
14
|
+
const m = g(R), u = I(R), M = g(B), s = I(B), N = $(o), l = f.useMemo(() => t ? N?.find((i) => i.nodeFunctionId === t) : void 0, [N, t]), D = f.useMemo(() => t ? M.getNodeById(o, t)?.parameters?.nodes?.map((r) => r?.value).filter((r) => r?.__typename === "NodeFunctionIdWrapper") ?? [] : [], [o, t, M, s]), S = f.useMemo(() => n ? C(P(n, m), d) : void 0, [n, m, u, d]), h = H(o);
|
|
15
|
+
return f.useMemo(() => {
|
|
16
|
+
if (!S || !l) return [];
|
|
16
17
|
const {
|
|
17
18
|
depth: i,
|
|
18
|
-
scope:
|
|
19
|
-
node:
|
|
20
|
-
} =
|
|
21
|
-
return
|
|
19
|
+
scope: r,
|
|
20
|
+
node: T
|
|
21
|
+
} = l;
|
|
22
|
+
return h.flatMap((e) => {
|
|
22
23
|
if (e.node === null || e.node === void 0) return [];
|
|
23
24
|
if (e.depth === null || e.depth === void 0) return [];
|
|
24
25
|
if (e.scope === null || e.scope === void 0) return [];
|
|
25
|
-
const
|
|
26
|
-
if (
|
|
27
|
-
if (
|
|
28
|
-
if (!
|
|
26
|
+
const c = e.parameterIndex !== void 0 && e.inputIndex !== void 0, a = c ? e.scope?.every((p, x) => r?.[x] === p) : !0;
|
|
27
|
+
if (c && !a) return [];
|
|
28
|
+
if (D.some((p) => p.id === e.nodeFunctionId)) return [];
|
|
29
|
+
if (!c && e.node >= T) return [];
|
|
29
30
|
if (e.depth > i) return [];
|
|
30
|
-
if (e.scope.some((
|
|
31
|
-
const
|
|
32
|
-
return
|
|
31
|
+
if (e.scope.some((p) => !r.includes(p))) return [];
|
|
32
|
+
const F = C(P(e.dataTypeIdentifier, m), []);
|
|
33
|
+
return k(S, F) ? [{
|
|
33
34
|
path: [],
|
|
34
|
-
type:
|
|
35
|
-
displayText: [`${e.depth}-${e.scope}-${e.node || ""}-${e.referencePath?.map((
|
|
35
|
+
type: Y.REF_OBJECT,
|
|
36
|
+
displayText: [`${e.depth}-${e.scope}-${e.node || ""}-${e.referencePath?.map((p) => p.path).join(".") ?? ""}`],
|
|
36
37
|
value: e
|
|
37
38
|
}] : [];
|
|
38
39
|
});
|
|
39
|
-
}, [m,
|
|
40
|
-
},
|
|
41
|
-
const t =
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
return
|
|
46
|
-
}) ?? [], [
|
|
40
|
+
}, [m, l, D, h, S]);
|
|
41
|
+
}, H = (o) => {
|
|
42
|
+
const t = g(R);
|
|
43
|
+
I(R);
|
|
44
|
+
const n = g(G), d = g(B), m = I(B), u = g(j), M = I(j), s = f.useMemo(() => d.getById(o), [o, m]), N = f.useMemo(() => u.getById(s?.type?.id), [s?.type?.id, M]), l = $(o), D = f.useMemo(() => s?.nodes?.nodes?.map((i) => {
|
|
45
|
+
const r = i?.parameters?.nodes?.map((a) => a?.value) ?? [], T = n.getById(i?.functionDefinition?.id), e = z(T, r, t, n), c = l?.find((a) => a.nodeFunctionId === i?.id);
|
|
46
|
+
return e && c ? E(c, e, t) : {};
|
|
47
|
+
}) ?? [], [s]), S = f.useMemo(() => E({
|
|
47
48
|
node: 0,
|
|
48
49
|
depth: 0,
|
|
49
|
-
nodeFunctionId: "gid://sagittarius/NodeFunction/-1",
|
|
50
50
|
scope: [0]
|
|
51
51
|
}, {
|
|
52
|
-
dataType:
|
|
53
|
-
}), [
|
|
54
|
-
return [...
|
|
55
|
-
const
|
|
56
|
-
if (!
|
|
57
|
-
const
|
|
58
|
-
return (
|
|
59
|
-
const
|
|
60
|
-
if (!
|
|
61
|
-
const
|
|
62
|
-
if (!
|
|
63
|
-
const
|
|
64
|
-
if (!
|
|
65
|
-
const
|
|
66
|
-
if (!
|
|
67
|
-
const
|
|
68
|
-
return
|
|
69
|
-
const
|
|
70
|
-
return
|
|
71
|
-
...
|
|
72
|
-
nodeFunctionId:
|
|
73
|
-
parameterIndex:
|
|
74
|
-
|
|
75
|
-
inputTypeIdentifier:
|
|
76
|
-
},
|
|
52
|
+
dataType: N?.inputType
|
|
53
|
+
}, t), [s]);
|
|
54
|
+
return [...f.useMemo(() => s?.nodes?.nodes?.length ? s.nodes.nodes.flatMap((i) => {
|
|
55
|
+
const r = n.getById(i?.functionDefinition?.id);
|
|
56
|
+
if (!r) return [];
|
|
57
|
+
const T = i?.parameters?.nodes?.map((e) => e?.value).filter(Boolean) ?? [];
|
|
58
|
+
return (r.parameterDefinitions ?? []).flatMap((e, c) => {
|
|
59
|
+
const a = e?.dataTypeIdentifier;
|
|
60
|
+
if (!a) return [];
|
|
61
|
+
const F = t.getDataType(a);
|
|
62
|
+
if (!F || F.variant !== "NODE") return [];
|
|
63
|
+
const p = i?.parameters?.nodes?.find((y) => y?.parameterDefinition?.id === e?.id);
|
|
64
|
+
if (!p?.value || p.value.__typename !== "NodeFunctionIdWrapper") return [];
|
|
65
|
+
const x = l?.find((y) => p?.value?.__typename === "NodeFunctionIdWrapper" && y.nodeFunctionId === p.value?.id);
|
|
66
|
+
if (!x) return [];
|
|
67
|
+
const v = F.rules?.nodes?.filter((y) => y?.variant === "INPUT_TYPES") ?? [], w = J(r, T, t, n), K = U(r, a), V = new Map([...w].map(([y, O]) => [K.get(y) ?? y, O]));
|
|
68
|
+
return v.flatMap((y) => (y?.config?.inputTypes ?? []).flatMap((b, A) => {
|
|
69
|
+
const W = q(b.dataTypeIdentifier, V);
|
|
70
|
+
return W ? E({
|
|
71
|
+
...x,
|
|
72
|
+
nodeFunctionId: i?.id,
|
|
73
|
+
parameterIndex: c,
|
|
74
|
+
inputIndex: A,
|
|
75
|
+
inputTypeIdentifier: b.inputIdentifier
|
|
76
|
+
}, W, t) : [];
|
|
77
77
|
}));
|
|
78
78
|
});
|
|
79
|
-
}) : [], [
|
|
80
|
-
},
|
|
81
|
-
const
|
|
82
|
-
return
|
|
83
|
-
if (
|
|
84
|
-
return t ?
|
|
85
|
-
...
|
|
86
|
-
referencePath: [...
|
|
87
|
-
path:
|
|
79
|
+
}) : [], [s, l, n, t]), ...S, ...D].flat();
|
|
80
|
+
}, E = (o, t, n) => {
|
|
81
|
+
const d = t.dataType ? n.getDataType(t) : t.genericType?.dataType;
|
|
82
|
+
return d ? [...d.rules?.nodes?.map((u) => {
|
|
83
|
+
if (u?.variant === "CONTAINS_KEY")
|
|
84
|
+
return t ? E({
|
|
85
|
+
...o,
|
|
86
|
+
referencePath: [...o.referencePath ?? [], {
|
|
87
|
+
path: u.config.key
|
|
88
88
|
}]
|
|
89
|
-
},
|
|
90
|
-
}).flat().filter((
|
|
89
|
+
}, u.config.dataTypeIdentifier, n) : void 0;
|
|
90
|
+
}).flat().filter((u) => !!u) ?? [], {
|
|
91
|
+
...o,
|
|
91
92
|
__typename: "ReferenceValue",
|
|
92
|
-
nodeFunctionId:
|
|
93
|
-
|
|
93
|
+
nodeFunctionId: o.nodeFunctionId,
|
|
94
|
+
dataTypeIdentifier: t
|
|
94
95
|
}] : [];
|
|
95
|
-
}, $ = (
|
|
96
|
-
const t =
|
|
97
|
-
return
|
|
98
|
-
if (!t || !
|
|
99
|
-
let
|
|
100
|
-
const
|
|
101
|
-
let
|
|
102
|
-
const
|
|
103
|
-
if (!
|
|
104
|
-
let
|
|
105
|
-
for (;
|
|
106
|
-
const
|
|
107
|
-
if (!
|
|
108
|
-
if (
|
|
109
|
-
for (const
|
|
110
|
-
const
|
|
111
|
-
if (
|
|
112
|
-
if (
|
|
113
|
-
const
|
|
114
|
-
|
|
96
|
+
}, $ = (o) => {
|
|
97
|
+
const t = g(R), n = g(B), d = g(G), m = I(B), u = I(G), M = I(R), s = f.useMemo(() => n.getById(o), [o, m]);
|
|
98
|
+
return f.useMemo(() => {
|
|
99
|
+
if (!t || !n || !d || !s?.startingNodeId) return;
|
|
100
|
+
let N = 0;
|
|
101
|
+
const l = () => ++N;
|
|
102
|
+
let D = 0;
|
|
103
|
+
const S = () => ++D, h = [], i = (r, T, e) => {
|
|
104
|
+
if (!r) return;
|
|
105
|
+
let c = r.__typename === "NodeFunctionIdWrapper" ? n.getNodeById(o, r.id) : r;
|
|
106
|
+
for (; c; ) {
|
|
107
|
+
const a = d.getById(c.functionDefinition?.id);
|
|
108
|
+
if (!a) break;
|
|
109
|
+
if (c.parameters && a.parameterDefinitions)
|
|
110
|
+
for (const p of a.parameterDefinitions) {
|
|
111
|
+
const x = t.getDataType(p.dataTypeIdentifier), v = c.parameters?.nodes?.find((w) => w?.parameterDefinition?.id === p.id);
|
|
112
|
+
if (x?.variant === "NODE") {
|
|
113
|
+
if (v?.value && v.value.__typename === "NodeFunctionIdWrapper") {
|
|
114
|
+
const w = [...e, l()];
|
|
115
|
+
i(v.value, T + 1, w);
|
|
115
116
|
}
|
|
116
|
-
} else
|
|
117
|
+
} else v?.value && v.value.__typename === "NodeFunctionIdWrapper" && i(v.value, T, e);
|
|
117
118
|
}
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
node:
|
|
121
|
-
depth:
|
|
122
|
-
scope:
|
|
123
|
-
nodeFunctionId:
|
|
124
|
-
}),
|
|
119
|
+
const F = S();
|
|
120
|
+
h.push({
|
|
121
|
+
node: F,
|
|
122
|
+
depth: T,
|
|
123
|
+
scope: e,
|
|
124
|
+
nodeFunctionId: c.id
|
|
125
|
+
}), c = n.getNodeById(s.id, c.nextNodeId);
|
|
125
126
|
}
|
|
126
127
|
};
|
|
127
|
-
return
|
|
128
|
-
}, [t,
|
|
128
|
+
return i(n.getNodeById(s.id, s.startingNodeId), 0, [0]), h;
|
|
129
|
+
}, [t, s, o, n, d, M, m, u]) ?? [];
|
|
129
130
|
};
|
|
130
131
|
export {
|
|
131
|
-
|
|
132
|
+
pe as useReferenceSuggestions
|
|
132
133
|
};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { c as
|
|
3
|
-
import { MenuTrigger as
|
|
4
|
-
import
|
|
5
|
-
import { DFlowSuggestionMenuFooter as B } from "./DFlowSuggestionMenuFooter.js";
|
|
1
|
+
import { jsx as m, jsxs as w } from "react/jsx-runtime";
|
|
2
|
+
import { c as F } from "../../_virtual/compiler-runtime.js";
|
|
3
|
+
import { MenuTrigger as j, MenuPortal as k, Menu as v } from "../menu/Menu.js";
|
|
4
|
+
import D from "react";
|
|
6
5
|
import "@radix-ui/react-checkbox";
|
|
7
6
|
import "merge-props";
|
|
8
7
|
import "js-md5";
|
|
@@ -10,64 +9,58 @@ import "@tabler/icons-react";
|
|
|
10
9
|
import '../../assets/components/form/Input.style.css';/* empty css */
|
|
11
10
|
import "../form/EmailInput.js";
|
|
12
11
|
import "../form/Input.js";
|
|
13
|
-
import { InputSuggestionMenuContentItems as
|
|
12
|
+
import { InputSuggestionMenuContentItems as A, InputSuggestionMenuContent as E } from "../form/InputSuggestion.js";
|
|
14
13
|
import "../form/NumberInput.js";
|
|
15
14
|
import "../form/PasswordInput.js";
|
|
16
15
|
import "@radix-ui/react-one-time-password-field";
|
|
17
16
|
import "@radix-ui/react-radio-group";
|
|
18
17
|
import "../form/SwitchInput.js";
|
|
19
18
|
import "../form/TextInput.js";
|
|
20
|
-
import { toInputSuggestions as
|
|
21
|
-
import { DFlowSuggestionMenuSearchBar as
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
19
|
+
import { toInputSuggestions as z } from "./DFlowSuggestionMenu.util.js";
|
|
20
|
+
import { DFlowSuggestionMenuSearchBar as B } from "./DFlowSuggestionMenuSearchBar.js";
|
|
21
|
+
import { Card as L } from "../card/Card.js";
|
|
22
|
+
const it = (y) => {
|
|
23
|
+
const t = F.c(22), {
|
|
24
|
+
suggestions: p,
|
|
25
|
+
triggerContent: S,
|
|
26
|
+
onSuggestionSelect: M
|
|
27
|
+
} = y;
|
|
28
|
+
let g;
|
|
29
|
+
t[0] !== p ? (g = p === void 0 ? [] : p, t[0] = p, t[1] = g) : g = t[1];
|
|
30
|
+
const e = g, d = M === void 0 ? P : M, h = D.useRef(null), [x, I] = D.useState(e);
|
|
31
|
+
let c, f;
|
|
32
|
+
t[2] !== e ? (c = () => {
|
|
33
|
+
I(e);
|
|
34
|
+
}, f = [e], t[2] = e, t[3] = c, t[4] = f) : (c = t[3], f = t[4]), D.useEffect(c, f);
|
|
35
|
+
let r;
|
|
36
|
+
t[5] !== S ? (r = /* @__PURE__ */ m(j, { asChild: !0, children: S }), t[5] = S, t[6] = r) : r = t[6];
|
|
35
37
|
let i;
|
|
36
|
-
|
|
38
|
+
t[7] !== e ? (i = /* @__PURE__ */ m(B, { onType: (o) => {
|
|
39
|
+
o.key === "ArrowDown" ? (o.preventDefault(), h.current?.focusFirstItem()) : o.key === "ArrowUp" && (o.preventDefault(), h.current?.focusLastItem());
|
|
40
|
+
const C = o.target.value;
|
|
41
|
+
return I(e.filter((R) => R.displayText.some((T) => T.includes(C)))), o.preventDefault(), !1;
|
|
42
|
+
} }), t[7] = e, t[8] = i) : i = t[8];
|
|
37
43
|
let s;
|
|
38
|
-
|
|
39
|
-
o.key === "ArrowDown" ? (o.preventDefault(), w.current?.focusFirstItem()) : o.key === "ArrowUp" && (o.preventDefault(), w.current?.focusLastItem());
|
|
40
|
-
const T = o.target.value;
|
|
41
|
-
return F(t.filter((b) => b.displayText.some((j) => j.includes(T)))), o.preventDefault(), !1;
|
|
42
|
-
} }), e[7] = t, e[8] = s) : s = e[8];
|
|
43
|
-
let a;
|
|
44
|
-
e[9] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (a = /* @__PURE__ */ r(C, {}), e[9] = a) : a = e[9];
|
|
44
|
+
t[9] !== x ? (s = z(x), t[9] = x, t[10] = s) : s = t[10];
|
|
45
45
|
let n;
|
|
46
|
-
|
|
46
|
+
t[11] !== d ? (n = (o) => {
|
|
47
|
+
d(o.valueData);
|
|
48
|
+
}, t[11] = d, t[12] = n) : n = t[12];
|
|
47
49
|
let l;
|
|
48
|
-
|
|
49
|
-
D(o.valueData);
|
|
50
|
-
}, e[12] = D, e[13] = l) : l = e[13];
|
|
50
|
+
t[13] !== s || t[14] !== n ? (l = /* @__PURE__ */ m(L, { paddingSize: "xxs", mt: -0.2, mx: -0.2, children: /* @__PURE__ */ m(A, { ref: h, suggestions: s, onSuggestionSelect: n }) }), t[13] = s, t[14] = n, t[15] = l) : l = t[15];
|
|
51
51
|
let u;
|
|
52
|
-
|
|
53
|
-
let S, d;
|
|
54
|
-
e[17] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (S = /* @__PURE__ */ r(C, {}), d = /* @__PURE__ */ r(B, {}), e[17] = S, e[18] = d) : (S = e[17], d = e[18]);
|
|
55
|
-
let m;
|
|
56
|
-
e[19] !== u || e[20] !== s ? (m = /* @__PURE__ */ r(A, { children: /* @__PURE__ */ _(P, { align: "center", children: [
|
|
57
|
-
s,
|
|
58
|
-
a,
|
|
59
|
-
u,
|
|
60
|
-
S,
|
|
61
|
-
d
|
|
62
|
-
] }) }), e[19] = u, e[20] = s, e[21] = m) : m = e[21];
|
|
63
|
-
let h;
|
|
64
|
-
return e[22] !== m || e[23] !== i ? (h = /* @__PURE__ */ _(E, { children: [
|
|
52
|
+
t[16] !== i || t[17] !== l ? (u = /* @__PURE__ */ m(k, { children: /* @__PURE__ */ w(E, { align: "center", color: "secondary", children: [
|
|
65
53
|
i,
|
|
66
|
-
|
|
67
|
-
] }),
|
|
54
|
+
l
|
|
55
|
+
] }) }), t[16] = i, t[17] = l, t[18] = u) : u = t[18];
|
|
56
|
+
let a;
|
|
57
|
+
return t[19] !== u || t[20] !== r ? (a = /* @__PURE__ */ w(v, { children: [
|
|
58
|
+
r,
|
|
59
|
+
u
|
|
60
|
+
] }), t[19] = u, t[20] = r, t[21] = a) : a = t[21], a;
|
|
68
61
|
};
|
|
69
|
-
function
|
|
62
|
+
function P() {
|
|
70
63
|
}
|
|
71
64
|
export {
|
|
72
|
-
|
|
65
|
+
it as DFlowSuggestionMenu
|
|
73
66
|
};
|