@code0-tech/pictor 0.0.0-mvp.45 → 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/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-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/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 +22 -22
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { jsxs as m, Fragment as H, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import o from "react";
|
|
3
|
+
import { Card as h } from "../card/Card.js";
|
|
4
|
+
import { Flex as F } from "../flex/Flex.js";
|
|
5
|
+
import { Text as J } from "../text/Text.js";
|
|
6
|
+
import { Button as f } from "../button/Button.js";
|
|
7
|
+
import { IconAlignLeft as K, IconEdit as P, IconX as Q } from "@tabler/icons-react";
|
|
8
|
+
import U from "./DFlowInputObjectEditDialog.js";
|
|
9
|
+
import '../../assets/components/form/Input.style.css';import '../../assets/components/d-flow-input/DFlowInputDataType.style.css';/* empty css */
|
|
10
|
+
import { ButtonGroup as Y } from "../button-group/ButtonGroup.js";
|
|
11
|
+
import { DFlowInputObjectTree as Z } from "./DFlowInputObjectTree.js";
|
|
12
|
+
import { useService as g, useStore as S } from "../../utils/contextStore.js";
|
|
13
|
+
import "merge-props";
|
|
14
|
+
import "js-md5";
|
|
15
|
+
import "../d-flow/DFlow.js";
|
|
16
|
+
import { DFlowReactiveService as w } from "../d-flow/DFlow.service.js";
|
|
17
|
+
import { DFlowFunctionReactiveService as x } from "../d-flow-function/DFlowFunction.service.js";
|
|
18
|
+
import { DFlowDataTypeReactiveService as C } from "../d-flow-data-type/DFlowDataType.service.js";
|
|
19
|
+
import { DFlowSuggestionMenu as $ } from "../d-flow-suggestion/DFlowSuggestionMenu.js";
|
|
20
|
+
import { useSuggestions as ee } from "../d-flow-suggestion/DFlowSuggestion.hook.js";
|
|
21
|
+
import "../../_virtual/compiler-runtime.js";
|
|
22
|
+
import "@radix-ui/react-checkbox";
|
|
23
|
+
import { InputLabel as te } from "../form/InputLabel.js";
|
|
24
|
+
import { InputDescription as oe } from "../form/InputDescription.js";
|
|
25
|
+
import { InputMessage as ie } from "../form/InputMessage.js";
|
|
26
|
+
/* empty css */
|
|
27
|
+
import "../form/EmailInput.js";
|
|
28
|
+
import "../form/Input.js";
|
|
29
|
+
import "../form/InputSuggestion.js";
|
|
30
|
+
import "../form/NumberInput.js";
|
|
31
|
+
import "../form/PasswordInput.js";
|
|
32
|
+
import "@radix-ui/react-one-time-password-field";
|
|
33
|
+
import "@radix-ui/react-radio-group";
|
|
34
|
+
import "../form/SwitchInput.js";
|
|
35
|
+
import "../form/TextInput.js";
|
|
36
|
+
import { DFlowInputNodeBadge as re } from "./DFlowInputNodeBadge.js";
|
|
37
|
+
import { DFlowInputReferenceBadge as ne } from "./DFlowInputReferenceBadge.js";
|
|
38
|
+
const Xe = (V) => {
|
|
39
|
+
const {
|
|
40
|
+
flowId: n,
|
|
41
|
+
nodeId: s,
|
|
42
|
+
parameterId: d,
|
|
43
|
+
title: b,
|
|
44
|
+
description: j,
|
|
45
|
+
formValidation: a,
|
|
46
|
+
onChange: _
|
|
47
|
+
} = V, E = g(w), M = S(w), y = g(C), v = S(C), T = g(x), z = S(x), l = o.useMemo(() => E.getNodeById(n, s), [M, n, s]), r = o.useMemo(() => l?.parameters?.nodes?.find((t) => t?.id === d), [l, d]), D = o.useMemo(() => T.getById(l?.functionDefinition?.id), [z, l]), c = o.useMemo(() => D?.parameterDefinitions?.find((t) => t.id === r?.parameterDefinition?.id), [D, r]), O = o.useMemo(() => !r?.value || r?.value?.__typename === "LiteralValue" && r.value.value == null ? y.getValueFromType(c?.dataTypeIdentifier) : r?.value, [r, c, v]), R = ee(n, s, d), [i, u] = o.useState(O), [I, p] = o.useState(!1), [k, B] = o.useState(null), [L, N] = o.useState({}), A = (t, X) => {
|
|
48
|
+
N((q) => ({
|
|
49
|
+
...q,
|
|
50
|
+
[t.join(".")]: X
|
|
51
|
+
}));
|
|
52
|
+
}, G = (t) => {
|
|
53
|
+
B(t), p(!0);
|
|
54
|
+
}, W = o.useCallback(() => {
|
|
55
|
+
u(y.getValueFromType(c?.dataTypeIdentifier));
|
|
56
|
+
}, [r, c, v]);
|
|
57
|
+
return o.useEffect(() => {
|
|
58
|
+
a?.setValue(i), _?.();
|
|
59
|
+
}, [i]), /* @__PURE__ */ m(H, { children: [
|
|
60
|
+
i?.__typename === "LiteralValue" && /* @__PURE__ */ e(U, { open: I, entry: k, value: i, onOpenChange: (t) => p(t), onObjectChange: (t) => u(t ?? void 0) }, String(I)),
|
|
61
|
+
/* @__PURE__ */ e(te, { children: b }),
|
|
62
|
+
/* @__PURE__ */ e(oe, { children: j }),
|
|
63
|
+
/* @__PURE__ */ m(h, { color: "secondary", paddingSize: "xs", children: [
|
|
64
|
+
/* @__PURE__ */ m(F, { style: {
|
|
65
|
+
gap: ".7rem"
|
|
66
|
+
}, align: "center", justify: "space-between", children: [
|
|
67
|
+
/* @__PURE__ */ e(F, { style: {
|
|
68
|
+
gap: ".35rem"
|
|
69
|
+
}, align: "center", children: /* @__PURE__ */ e(J, { children: "Object" }) }),
|
|
70
|
+
/* @__PURE__ */ m(Y, { color: "primary", children: [
|
|
71
|
+
/* @__PURE__ */ e($, { suggestions: R, onSuggestionSelect: (t) => u(t.value), triggerContent: /* @__PURE__ */ e(f, { paddingSize: "xxs", variant: "filled", color: "secondary", onClick: () => p(!0), children: /* @__PURE__ */ e(K, { size: 13 }) }) }),
|
|
72
|
+
/* @__PURE__ */ e(f, { paddingSize: "xxs", variant: "filled", color: "secondary", onClick: () => p(!0), children: /* @__PURE__ */ e(P, { size: 13 }) }),
|
|
73
|
+
/* @__PURE__ */ e(f, { paddingSize: "xxs", variant: "filled", color: "secondary", onClick: W, children: /* @__PURE__ */ e(Q, { size: 13 }) })
|
|
74
|
+
] })
|
|
75
|
+
] }),
|
|
76
|
+
/* @__PURE__ */ e(h, { paddingSize: "xs", mt: 0.7, mb: -0.55, mx: -0.55, children: i?.__typename === "NodeFunction" || i?.__typename === "NodeFunctionIdWrapper" ? /* @__PURE__ */ e(re, { value: i, flowId: n }) : i?.__typename === "ReferenceValue" ? /* @__PURE__ */ e(ne, { value: i, flowId: n }) : /* @__PURE__ */ e(Z, { object: i, onEntryClick: G, collapsedState: L, setCollapsedState: A }) })
|
|
77
|
+
] }),
|
|
78
|
+
!a?.valid && a?.notValidMessage && /* @__PURE__ */ e(ie, { children: a.notValidMessage })
|
|
79
|
+
] });
|
|
80
|
+
};
|
|
81
|
+
export {
|
|
82
|
+
Xe as DFlowInputObject
|
|
83
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { LiteralValue } from '@code0-tech/sagittarius-graphql-types';
|
|
3
|
+
export interface EditableObjectEntry {
|
|
4
|
+
key: string;
|
|
5
|
+
value: LiteralValue | null;
|
|
6
|
+
path: string[];
|
|
7
|
+
}
|
|
8
|
+
export interface DFlowInputObjectEditDialogProps {
|
|
9
|
+
open: boolean;
|
|
10
|
+
entry: EditableObjectEntry | null;
|
|
11
|
+
value: LiteralValue | null;
|
|
12
|
+
onOpenChange?: (open: boolean) => void;
|
|
13
|
+
onObjectChange?: (object: LiteralValue | null) => void;
|
|
14
|
+
}
|
|
15
|
+
declare const DFlowInputObjectEditDialog: React.FC<DFlowInputObjectEditDialogProps>;
|
|
16
|
+
export default DFlowInputObjectEditDialog;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { jsx as t, jsxs as p } from "react/jsx-runtime";
|
|
2
|
+
import c from "react";
|
|
3
|
+
import { Dialog as F, DialogPortal as I, DialogOverlay as G, DialogContent as H, DialogClose as L } from "../dialog/Dialog.js";
|
|
4
|
+
import { DLayout as B } from "../d-layout/DLayout.js";
|
|
5
|
+
import { Flex as N } from "../flex/Flex.js";
|
|
6
|
+
import { Text as X } from "../text/Text.js";
|
|
7
|
+
import { DResizablePanelGroup as q, DResizablePanel as v, DResizableHandle as J } from "../d-resizable/DResizable.js";
|
|
8
|
+
import { ScrollArea as K, ScrollAreaViewport as M, ScrollAreaScrollbar as S, ScrollAreaThumb as C } from "../scroll-area/ScrollArea.js";
|
|
9
|
+
import { Spacing as b } from "../spacing/Spacing.js";
|
|
10
|
+
import { Button as Q } from "../button/Button.js";
|
|
11
|
+
import { IconX as U } from "@tabler/icons-react";
|
|
12
|
+
import { Editor as W } from "../editor/Editor.js";
|
|
13
|
+
import { DFlowInputObjectTree as Y } from "./DFlowInputObjectTree.js";
|
|
14
|
+
function O(r, i) {
|
|
15
|
+
if (!r || !Array.isArray(i) || i.length === 0) return r?.value;
|
|
16
|
+
let e = r.value;
|
|
17
|
+
for (const n of i)
|
|
18
|
+
if (e && typeof e == "object" && n in e)
|
|
19
|
+
e = e[n];
|
|
20
|
+
else
|
|
21
|
+
return;
|
|
22
|
+
return e;
|
|
23
|
+
}
|
|
24
|
+
function m(r, i, e) {
|
|
25
|
+
if (!r) return null;
|
|
26
|
+
if (i.length === 0) return {
|
|
27
|
+
...r,
|
|
28
|
+
value: e
|
|
29
|
+
};
|
|
30
|
+
const [n, ...u] = i;
|
|
31
|
+
if (Array.isArray(r.value)) {
|
|
32
|
+
const l = Number(n), s = [...r.value];
|
|
33
|
+
return u.length > 0 && typeof s[l] == "object" && s[l] !== null ? s[l] = m({
|
|
34
|
+
...r,
|
|
35
|
+
value: s[l]
|
|
36
|
+
}, u, e)?.value : s[l] = e, {
|
|
37
|
+
...r,
|
|
38
|
+
value: s
|
|
39
|
+
};
|
|
40
|
+
} else if (typeof r.value == "object" && r.value !== null) {
|
|
41
|
+
const l = {
|
|
42
|
+
...r.value
|
|
43
|
+
};
|
|
44
|
+
return u.length > 0 && typeof l[n] == "object" && l[n] !== null ? l[n] = m({
|
|
45
|
+
...r,
|
|
46
|
+
value: l[n]
|
|
47
|
+
}, u, e)?.value : l[n] = e, {
|
|
48
|
+
...r,
|
|
49
|
+
value: l
|
|
50
|
+
};
|
|
51
|
+
} else
|
|
52
|
+
return {
|
|
53
|
+
...r,
|
|
54
|
+
value: e
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
const ue = (r) => {
|
|
58
|
+
const {
|
|
59
|
+
open: i,
|
|
60
|
+
entry: e,
|
|
61
|
+
value: n,
|
|
62
|
+
onObjectChange: u,
|
|
63
|
+
onOpenChange: l
|
|
64
|
+
} = r, [s, E] = c.useState(i), [w, A] = c.useState({}), [f, g] = c.useState(e?.path ?? []), [h, y] = c.useState(n), [x, k] = c.useState(O(n, e?.path ?? [])), d = c.useRef(null);
|
|
65
|
+
c.useEffect(() => {
|
|
66
|
+
k(O(h, f));
|
|
67
|
+
}, [f]), c.useEffect(() => {
|
|
68
|
+
g(e?.path ?? []), y(n);
|
|
69
|
+
}, [e]), c.useEffect(() => {
|
|
70
|
+
E(i);
|
|
71
|
+
}, [i]);
|
|
72
|
+
const D = (o, a) => {
|
|
73
|
+
A((j) => ({
|
|
74
|
+
...j,
|
|
75
|
+
[o.join(".")]: a
|
|
76
|
+
}));
|
|
77
|
+
}, z = (o) => {
|
|
78
|
+
d.current && clearTimeout(d.current), d.current = setTimeout(() => {
|
|
79
|
+
g(o.path ?? []);
|
|
80
|
+
}, 200);
|
|
81
|
+
}, P = (o, a) => {
|
|
82
|
+
d.current && clearTimeout(d.current), D(o, !a);
|
|
83
|
+
}, R = (o) => {
|
|
84
|
+
const a = m(h, f, o);
|
|
85
|
+
y(a), u?.(a);
|
|
86
|
+
}, T = () => null, V = {};
|
|
87
|
+
return /* @__PURE__ */ t(F, { open: s, onOpenChange: (o) => l?.(o), children: /* @__PURE__ */ p(I, { children: [
|
|
88
|
+
/* @__PURE__ */ t(G, {}),
|
|
89
|
+
/* @__PURE__ */ t(H, { "aria-describedby": "DFlowInputObjectEditDialog", onPointerDownOutside: (o) => {
|
|
90
|
+
const a = o.target;
|
|
91
|
+
(a.closest("[data-slot=resizable-handle]") || a.closest("[data-slot=resizable-panel]")) && o.preventDefault();
|
|
92
|
+
}, w: "75%", h: "75%", style: {
|
|
93
|
+
padding: "2px"
|
|
94
|
+
}, children: /* @__PURE__ */ t(B, { layoutGap: 0, showLayoutSplitter: !1, topContent: /* @__PURE__ */ p(N, { style: {
|
|
95
|
+
gap: ".7rem"
|
|
96
|
+
}, p: 0.7, justify: "space-between", align: "center", children: [
|
|
97
|
+
/* @__PURE__ */ t(X, { children: e?.key ?? "Edit Object" }),
|
|
98
|
+
/* @__PURE__ */ t(L, { asChild: !0, children: /* @__PURE__ */ t(Q, { variant: "filled", color: "tertiary", paddingSize: "xxs", children: /* @__PURE__ */ t(U, { size: 13 }) }) })
|
|
99
|
+
] }), children: /* @__PURE__ */ p(q, { style: {
|
|
100
|
+
borderRadius: "1rem"
|
|
101
|
+
}, children: [
|
|
102
|
+
/* @__PURE__ */ t(v, { color: "primary", children: /* @__PURE__ */ p(K, { h: "100%", w: "100%", type: "scroll", children: [
|
|
103
|
+
/* @__PURE__ */ p(M, { px: 1, children: [
|
|
104
|
+
/* @__PURE__ */ t(b, { spacing: "md" }),
|
|
105
|
+
/* @__PURE__ */ t(Y, { object: h, onEntryClick: z, collapsedState: w, setCollapsedState: D, activePath: f, onDoubleClick: P }),
|
|
106
|
+
/* @__PURE__ */ t(b, { spacing: "md" })
|
|
107
|
+
] }),
|
|
108
|
+
/* @__PURE__ */ t(S, { orientation: "vertical", children: /* @__PURE__ */ t(C, {}) }),
|
|
109
|
+
/* @__PURE__ */ t(S, { orientation: "horizontal", children: /* @__PURE__ */ t(C, {}) })
|
|
110
|
+
] }) }),
|
|
111
|
+
/* @__PURE__ */ t(J, {}),
|
|
112
|
+
/* @__PURE__ */ t(v, { color: "primary", children: /* @__PURE__ */ t(W, { suggestions: T, tokenHighlights: V, language: "json", initialValue: x, onChange: R }) })
|
|
113
|
+
] }) }) })
|
|
114
|
+
] }) });
|
|
115
|
+
};
|
|
116
|
+
export {
|
|
117
|
+
ue as default
|
|
118
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { EditableObjectEntry } from './DFlowInputObject';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
import { LiteralValue } from '@code0-tech/sagittarius-graphql-types';
|
|
4
|
+
export interface DFlowInputObjectTreeProps {
|
|
5
|
+
object: LiteralValue;
|
|
6
|
+
parentKey?: string;
|
|
7
|
+
isRoot?: boolean;
|
|
8
|
+
onEntryClick: (entry: EditableObjectEntry) => void;
|
|
9
|
+
collapsedState: Record<string, boolean>;
|
|
10
|
+
setCollapsedState: (path: string[], collapsed: boolean) => void;
|
|
11
|
+
path?: string[];
|
|
12
|
+
activePath?: string[] | null;
|
|
13
|
+
onDoubleClick?: (path: string[], isCollapsed: boolean) => void;
|
|
14
|
+
parentColor?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare const DFlowInputObjectTree: React.FC<DFlowInputObjectTreeProps>;
|
|
@@ -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
|
+
};
|