@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
|
@@ -1,58 +1,63 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { DFlowDataTypeReactiveService as
|
|
3
|
-
import { DataTypeView as
|
|
4
|
-
import { useService as
|
|
5
|
-
import { InspectionSeverity as
|
|
1
|
+
import V from "react";
|
|
2
|
+
import { DFlowDataTypeReactiveService as x } from "../d-flow-data-type/DFlowDataType.service.js";
|
|
3
|
+
import { DataTypeView as q } from "../d-flow-data-type/DFlowDataType.view.js";
|
|
4
|
+
import { useService as _, useStore as R } from "../../utils/contextStore.js";
|
|
5
|
+
import { InspectionSeverity as z } from "../../utils/inspection.js";
|
|
6
6
|
import "merge-props";
|
|
7
7
|
import "js-md5";
|
|
8
|
-
import { resolveGenericKeys as
|
|
9
|
-
import { useReturnType as
|
|
10
|
-
import { DFlowFunctionReactiveService as
|
|
11
|
-
import { useDataTypeValidation as
|
|
12
|
-
import { useValueValidation as
|
|
8
|
+
import { resolveGenericKeys as H, replaceGenericKeysInType as J, replaceGenericKeysInDataTypeObject as L } from "../../utils/generics.js";
|
|
9
|
+
import { useReturnType as Q } from "../d-flow-function/DFlowFunction.return.hook.js";
|
|
10
|
+
import { DFlowFunctionReactiveService as E } from "../d-flow-function/DFlowFunction.service.js";
|
|
11
|
+
import { useDataTypeValidation as G } from "./DDataTypeValidation.hook.js";
|
|
12
|
+
import { useValueValidation as O } from "./DValueValidation.hook.js";
|
|
13
13
|
import "../d-flow/DFlow.js";
|
|
14
14
|
import { DFlowReactiveService as M } from "../d-flow/DFlow.service.js";
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
import { getReferenceType as X } from "../d-flow-node/DFlowNodeReference.return.hook.js";
|
|
16
|
+
import { DFlowTypeReactiveService as W } from "../d-flow-type/DFlowType.service.js";
|
|
17
|
+
const F = (r) => r.__typename === "ReferenceValue", I = (r) => r.__typename === "NodeFunctionIdWrapper", b = (r, i) => new q(L(r.json, i)), j = (r, i, n) => ({
|
|
18
|
+
parameterId: r,
|
|
19
|
+
type: z.ERROR,
|
|
18
20
|
message: [{
|
|
19
21
|
code: "en-US",
|
|
20
|
-
content: `Argument of type ${
|
|
22
|
+
content: `Argument of type ${n?.name[0]?.content} is not assignable to parameter of type ${i?.name[0]?.content}`
|
|
21
23
|
}]
|
|
22
|
-
}),
|
|
23
|
-
const
|
|
24
|
-
if (
|
|
25
|
-
const
|
|
26
|
-
return
|
|
24
|
+
}), ue = (r, i) => {
|
|
25
|
+
const n = _(E), $ = R(E), y = _(M), N = R(M), k = _(W), A = R(W), o = _(x), B = R(x), s = y.getById(i), T = y.getNodeById(i, r), g = T?.parameters?.nodes?.map((e) => e?.value) ?? [], f = n.getById(T?.functionDefinition?.id), S = f?.parameterDefinitions ?? [], w = f?.genericKeys ?? [], D = V.useMemo(() => H(f, g, o, n, s), [f, g, o, B, s, N]), K = V.useCallback((e, p) => {
|
|
26
|
+
if (I(e) && p?.variant !== "NODE") {
|
|
27
|
+
const a = y.getNodeById(i, e.__typename == "NodeFunctionIdWrapper" ? e.id : e.__typename === "ReferenceValue" ? e.nodeFunctionId : void 0), t = n.getById(a?.functionDefinition?.id), m = a?.parameters?.nodes?.map((d) => d?.value) ?? [];
|
|
28
|
+
return Q(t, m, o, n);
|
|
29
|
+
} else if (F(e)) {
|
|
30
|
+
const a = y.getNodeById(i, e.__typename == "NodeFunctionIdWrapper" ? e.id : e.__typename === "ReferenceValue" ? e.nodeFunctionId : void 0), t = n.getById(a?.functionDefinition?.id), m = k.getById(s?.type?.id)?.json();
|
|
31
|
+
return X(e, o, n, t, a, m);
|
|
27
32
|
}
|
|
28
|
-
return
|
|
29
|
-
}, [
|
|
30
|
-
return
|
|
33
|
+
return o.getTypeFromValue(e, s);
|
|
34
|
+
}, [o, s, i, y, n, A]);
|
|
35
|
+
return V.useMemo(() => {
|
|
31
36
|
const e = [];
|
|
32
|
-
for (let
|
|
33
|
-
const
|
|
34
|
-
if (!
|
|
35
|
-
const
|
|
36
|
-
if (!c || !
|
|
37
|
-
e.push(
|
|
37
|
+
for (let p = 0; p < S.length; p++) {
|
|
38
|
+
const a = S[p], t = g[p], m = T?.parameters?.nodes?.find((v) => v?.parameterDefinition?.id === a.id);
|
|
39
|
+
if (!t) continue;
|
|
40
|
+
const d = a.dataTypeIdentifier, h = J(d, D), c = o.getDataType(h), C = K(t, c), u = o.getDataType(C);
|
|
41
|
+
if (!c || !u) {
|
|
42
|
+
e.push(j(m?.id, c, u));
|
|
38
43
|
continue;
|
|
39
44
|
}
|
|
40
|
-
const
|
|
41
|
-
let
|
|
42
|
-
if (
|
|
45
|
+
const P = !!d?.genericType || !!d?.genericKey && w.includes(d.genericKey);
|
|
46
|
+
let l = !0;
|
|
47
|
+
if (P) {
|
|
43
48
|
const v = b(c, D);
|
|
44
|
-
if (
|
|
45
|
-
const
|
|
46
|
-
|
|
49
|
+
if (F(t) || I(t) && c.variant !== "NODE") {
|
|
50
|
+
const U = b(u, D);
|
|
51
|
+
l = G(v, U);
|
|
47
52
|
} else
|
|
48
|
-
|
|
53
|
+
l = O(t, v, o, s, h?.genericType?.genericMappers, n);
|
|
49
54
|
} else
|
|
50
|
-
|
|
51
|
-
|
|
55
|
+
F(t) || I(t) && c.variant !== "NODE" ? l = G(c, u) : l = O(t, c, o, s, [], n);
|
|
56
|
+
l || e.push(j(m?.id, c, u));
|
|
52
57
|
}
|
|
53
58
|
return e.length > 0 ? e : null;
|
|
54
|
-
}, [s,
|
|
59
|
+
}, [s, T, g, f, S, w, D, K, r, i, $, N, B, o]);
|
|
55
60
|
};
|
|
56
61
|
export {
|
|
57
|
-
|
|
62
|
+
ue as useNodeValidation
|
|
58
63
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Flow, FlowConnection, Maybe, Namespace, NamespaceProject, NamespaceProjectUserAbilities, Runtime, RuntimeConnection, Scalars } from '@code0-tech/sagittarius-graphql-types';
|
|
1
|
+
import { Flow, FlowConnection, Maybe, Namespace, NamespaceProject, NamespaceProjectUserAbilities, NamespaceRoleConnection, Runtime, RuntimeConnection, Scalars } from '@code0-tech/sagittarius-graphql-types';
|
|
2
2
|
export declare class DNamespaceProjectView {
|
|
3
3
|
/** Time when this NamespaceProject was created */
|
|
4
4
|
private readonly _createdAt?;
|
|
@@ -16,8 +16,12 @@ export declare class DNamespaceProjectView {
|
|
|
16
16
|
private readonly _namespace?;
|
|
17
17
|
/** The primary runtime for the project */
|
|
18
18
|
private readonly _primaryRuntime?;
|
|
19
|
+
/** Roles assigned to this project */
|
|
20
|
+
private readonly _roles?;
|
|
19
21
|
/** Runtimes assigned to this project */
|
|
20
22
|
private readonly _runtimes?;
|
|
23
|
+
/** Slug of the project used in URLs to identify flows */
|
|
24
|
+
private readonly _slug?;
|
|
21
25
|
/** Time when this NamespaceProject was last updated */
|
|
22
26
|
private readonly _updatedAt?;
|
|
23
27
|
/** Abilities for the current user on this NamespaceProject */
|
|
@@ -31,7 +35,9 @@ export declare class DNamespaceProjectView {
|
|
|
31
35
|
get name(): Maybe<Scalars["String"]["output"]> | undefined;
|
|
32
36
|
get namespace(): Maybe<Namespace> | undefined;
|
|
33
37
|
get primaryRuntime(): Maybe<Runtime> | undefined;
|
|
38
|
+
get roles(): Maybe<NamespaceRoleConnection> | undefined;
|
|
34
39
|
get runtimes(): Maybe<RuntimeConnection> | undefined;
|
|
40
|
+
get slug(): Maybe<Scalars["String"]["output"]> | undefined;
|
|
35
41
|
get updatedAt(): Maybe<Scalars["Time"]["output"]> | undefined;
|
|
36
42
|
get userAbilities(): Maybe<NamespaceProjectUserAbilities> | undefined;
|
|
37
43
|
json(): NamespaceProject;
|
|
@@ -17,7 +17,7 @@ function u(i, t) {
|
|
|
17
17
|
}
|
|
18
18
|
class o {
|
|
19
19
|
constructor(t) {
|
|
20
|
-
e(this, "_createdAt", void 0), e(this, "_description", void 0), e(this, "_flow", void 0), e(this, "_flows", void 0), e(this, "_id", void 0), e(this, "_name", void 0), e(this, "_namespace", void 0), e(this, "_primaryRuntime", void 0), e(this, "_runtimes", void 0), e(this, "_updatedAt", void 0), e(this, "_userAbilities", void 0), this._createdAt = t.createdAt, this._description = t.description, this._flow = t.flow, this._flows = t.flows, this._id = t.id, this._name = t.name, this._namespace = t.namespace, this._primaryRuntime = t.primaryRuntime, this._runtimes = t.runtimes, this._updatedAt = t.updatedAt, this._userAbilities = t.userAbilities;
|
|
20
|
+
e(this, "_createdAt", void 0), e(this, "_description", void 0), e(this, "_flow", void 0), e(this, "_flows", void 0), e(this, "_id", void 0), e(this, "_name", void 0), e(this, "_namespace", void 0), e(this, "_primaryRuntime", void 0), e(this, "_roles", void 0), e(this, "_runtimes", void 0), e(this, "_slug", void 0), e(this, "_updatedAt", void 0), e(this, "_userAbilities", void 0), this._createdAt = t.createdAt, this._description = t.description, this._flow = t.flow, this._flows = t.flows, this._id = t.id, this._name = t.name, this._namespace = t.namespace, this._primaryRuntime = t.primaryRuntime, this._roles = t.roles, this._runtimes = t.runtimes, this._slug = t.slug, this._updatedAt = t.updatedAt, this._userAbilities = t.userAbilities;
|
|
21
21
|
}
|
|
22
22
|
get createdAt() {
|
|
23
23
|
return this._createdAt;
|
|
@@ -43,9 +43,15 @@ class o {
|
|
|
43
43
|
get primaryRuntime() {
|
|
44
44
|
return this._primaryRuntime;
|
|
45
45
|
}
|
|
46
|
+
get roles() {
|
|
47
|
+
return this._roles;
|
|
48
|
+
}
|
|
46
49
|
get runtimes() {
|
|
47
50
|
return this._runtimes;
|
|
48
51
|
}
|
|
52
|
+
get slug() {
|
|
53
|
+
return this._slug;
|
|
54
|
+
}
|
|
49
55
|
get updatedAt() {
|
|
50
56
|
return this._updatedAt;
|
|
51
57
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsxs as s, jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import m, { isValidElement as ce } from "react";
|
|
3
|
-
import { createPortal as
|
|
3
|
+
import { createPortal as K } from "react-dom";
|
|
4
4
|
import "../../utils/contextStore.js";
|
|
5
5
|
import { mergeCode0Props as ue } from "../../utils/utils.js";
|
|
6
|
-
import de, { Prec as
|
|
6
|
+
import de, { Prec as _, keymap as J, ViewPlugin as me, RangeSetBuilder as he, Decoration as F, EditorView as fe, WidgetType as ge } from "@uiw/react-codemirror";
|
|
7
7
|
import { json as pe, jsonParseLinter as ye } from "@codemirror/lang-json";
|
|
8
8
|
import { syntaxTree as L } from "@codemirror/language";
|
|
9
9
|
import { linter as be } from "@codemirror/lint";
|
|
@@ -15,7 +15,7 @@ import { tags as b, getStyleTags as Te } from "../../node_modules/@lezer/highlig
|
|
|
15
15
|
import { hashToColor as v } from "../d-flow/DFlow.util.js";
|
|
16
16
|
import '../../assets/components/editor/Editor.styles.css';/* empty css */
|
|
17
17
|
import { Badge as y } from "../badge/Badge.js";
|
|
18
|
-
import { IconExclamationCircle as
|
|
18
|
+
import { IconExclamationCircle as Ae, IconAlertTriangle as xe, IconAlertSquareRounded as ke, IconInfoCircle as Ee, IconSpace as ze, IconArrowBarToRight as Pe, IconCornerDownLeft as je } from "@tabler/icons-react";
|
|
19
19
|
import { Text as a } from "../text/Text.js";
|
|
20
20
|
import { Flex as k } from "../flex/Flex.js";
|
|
21
21
|
import { Tooltip as E, TooltipTrigger as z, TooltipPortal as P, TooltipContent as j, TooltipArrow as V } from "../tooltip/Tooltip.js";
|
|
@@ -140,10 +140,10 @@ const Fe = Ce({
|
|
|
140
140
|
} : {
|
|
141
141
|
override: [w]
|
|
142
142
|
}
|
|
143
|
-
})), e.push(
|
|
143
|
+
})), e.push(_.highest(J.of([{
|
|
144
144
|
key: "Tab",
|
|
145
145
|
run: Re
|
|
146
|
-
}]))), D && e.push(
|
|
146
|
+
}]))), D && e.push(_.highest(J.of([{
|
|
147
147
|
key: "ArrowUp",
|
|
148
148
|
run: (l) => (f || N(l), !0)
|
|
149
149
|
}, {
|
|
@@ -165,15 +165,15 @@ const Fe = Ce({
|
|
|
165
165
|
const l = new he(), u = Object.keys(g || {});
|
|
166
166
|
return L(o.state).iterate({
|
|
167
167
|
enter: (d) => {
|
|
168
|
-
const
|
|
169
|
-
if (
|
|
168
|
+
const A = o.state.doc.sliceString(d.from, d.to);
|
|
169
|
+
if (A.includes(`
|
|
170
170
|
`)) return;
|
|
171
|
-
const q = h?.(
|
|
172
|
-
|
|
173
|
-
widget: new X(
|
|
171
|
+
const q = h?.(A), ae = Te(d)?.tags.map((x) => "name" in x ? x.name : void 0), H = u.find((x) => ae?.includes(x));
|
|
172
|
+
H && !q ? l.add(d.from, d.to, F.replace({
|
|
173
|
+
widget: new X(H, A),
|
|
174
174
|
point: !0
|
|
175
175
|
})) : q && l.add(d.from, d.to, F.replace({
|
|
176
|
-
widget: new X(q,
|
|
176
|
+
widget: new X(q, A),
|
|
177
177
|
point: !0
|
|
178
178
|
}));
|
|
179
179
|
}
|
|
@@ -237,7 +237,7 @@ const Fe = Ce({
|
|
|
237
237
|
}, align: "center", children: [
|
|
238
238
|
c.filter((e) => e.severity == "error").length > 0 ? /* @__PURE__ */ s(E, { children: [
|
|
239
239
|
/* @__PURE__ */ t(z, { asChild: !0, children: /* @__PURE__ */ s(y, { color: "red", children: [
|
|
240
|
-
/* @__PURE__ */ t(
|
|
240
|
+
/* @__PURE__ */ t(Ae, { size: 13 }),
|
|
241
241
|
/* @__PURE__ */ t(a, { children: c.filter((e) => e.severity == "error").length })
|
|
242
242
|
] }) }),
|
|
243
243
|
/* @__PURE__ */ t(P, { children: /* @__PURE__ */ s(j, { side: "bottom", children: [
|
|
@@ -247,7 +247,7 @@ const Fe = Ce({
|
|
|
247
247
|
] }) : null,
|
|
248
248
|
c.filter((e) => e.severity == "warning").length > 0 ? /* @__PURE__ */ s(E, { children: [
|
|
249
249
|
/* @__PURE__ */ t(z, { asChild: !0, children: /* @__PURE__ */ s(y, { color: "orange", children: [
|
|
250
|
-
/* @__PURE__ */ t(
|
|
250
|
+
/* @__PURE__ */ t(xe, { size: 13 }),
|
|
251
251
|
/* @__PURE__ */ t(a, { children: c.filter((e) => e.severity == "warning").length })
|
|
252
252
|
] }) }),
|
|
253
253
|
/* @__PURE__ */ t(P, { children: /* @__PURE__ */ s(j, { side: "bottom", children: [
|
|
@@ -316,13 +316,13 @@ const Fe = Ce({
|
|
|
316
316
|
}, onUpdate: M, basicSetup: ee }),
|
|
317
317
|
g && Array.from(oe.entries()).map(([e, n]) => {
|
|
318
318
|
const o = g[n.type];
|
|
319
|
-
return o ?
|
|
319
|
+
return o ? K(/* @__PURE__ */ t("div", { style: {
|
|
320
320
|
display: "contents"
|
|
321
321
|
}, children: o({
|
|
322
322
|
content: n.value
|
|
323
323
|
}) }, e.outerHTML + n.value), e) : null;
|
|
324
324
|
}),
|
|
325
|
-
f &&
|
|
325
|
+
f && K(/* @__PURE__ */ t("div", { ref: B, style: {
|
|
326
326
|
position: "fixed",
|
|
327
327
|
top: f.position.top,
|
|
328
328
|
left: f.position.left,
|
|
@@ -4,50 +4,50 @@ import { MenuItem as L, MenuContent as F, MenuLabel as k } from "../menu/Menu.js
|
|
|
4
4
|
import i from "react";
|
|
5
5
|
import { ScrollArea as N, ScrollAreaViewport as O, ScrollAreaScrollbar as T, ScrollAreaThumb as j } from "../scroll-area/ScrollArea.js";
|
|
6
6
|
import { IconChevronDown as $, IconChevronUp as z } from "@tabler/icons-react";
|
|
7
|
-
const D = i.memo((
|
|
7
|
+
const D = i.memo((l) => {
|
|
8
8
|
const e = x.c(17), {
|
|
9
9
|
suggestion: n,
|
|
10
|
-
visibleIndex:
|
|
10
|
+
visibleIndex: u,
|
|
11
11
|
isActive: p,
|
|
12
12
|
inputRef: d,
|
|
13
13
|
onSelect: v,
|
|
14
14
|
onActivate: c,
|
|
15
15
|
itemRef: f
|
|
16
|
-
} =
|
|
17
|
-
if (
|
|
16
|
+
} = l;
|
|
17
|
+
if (u === null)
|
|
18
18
|
return null;
|
|
19
19
|
let m;
|
|
20
|
-
if (e[0] !== d || e[1] !== c || e[2] !==
|
|
20
|
+
if (e[0] !== d || e[1] !== c || e[2] !== u) {
|
|
21
21
|
const b = () => {
|
|
22
|
-
c(
|
|
22
|
+
c(u), d?.current?.focus({
|
|
23
23
|
preventScroll: !0
|
|
24
24
|
});
|
|
25
25
|
};
|
|
26
26
|
m = (M) => {
|
|
27
27
|
M.preventDefault(), b();
|
|
28
|
-
}, e[0] = d, e[1] = c, e[2] =
|
|
28
|
+
}, e[0] = d, e[1] = c, e[2] = u, e[3] = m;
|
|
29
29
|
} else
|
|
30
30
|
m = e[3];
|
|
31
31
|
const g = m;
|
|
32
32
|
let a;
|
|
33
|
-
e[4] !== c || e[5] !==
|
|
34
|
-
b.preventDefault(), b.stopPropagation(), c(
|
|
35
|
-
}, e[4] = c, e[5] =
|
|
33
|
+
e[4] !== c || e[5] !== u ? (a = (b) => {
|
|
34
|
+
b.preventDefault(), b.stopPropagation(), c(u);
|
|
35
|
+
}, e[4] = c, e[5] = u, e[6] = a) : a = e[6];
|
|
36
36
|
const y = a;
|
|
37
37
|
let C;
|
|
38
38
|
e[7] !== v || e[8] !== n ? (C = () => setTimeout(() => v(n), 0), e[7] = v, e[8] = n, e[9] = C) : C = e[9];
|
|
39
39
|
let o;
|
|
40
40
|
return e[10] !== g || e[11] !== y || e[12] !== p || e[13] !== f || e[14] !== n.children || e[15] !== C ? (o = /* @__PURE__ */ I(L, { textValue: "", onPointerDown: g, onPointerMove: y, onSelect: C, "data-focus": p, ref: f, children: n.children }), e[10] = g, e[11] = y, e[12] = p, e[13] = f, e[14] = n.children, e[15] = C, e[16] = o) : o = e[16], o;
|
|
41
|
-
}, (
|
|
41
|
+
}, (l, e) => l.suggestion === e.suggestion && l.visibleIndex === e.visibleIndex && l.isActive === e.isActive && l.inputRef === e.inputRef && l.onSelect === e.onSelect && l.onActivate === e.onActivate && l.itemRef === e.itemRef);
|
|
42
42
|
D.displayName = "SuggestionMenuItem";
|
|
43
|
-
const P = i.forwardRef((
|
|
43
|
+
const P = i.forwardRef((l, e) => {
|
|
44
44
|
const n = x.c(12);
|
|
45
|
-
let
|
|
46
|
-
n[0] !==
|
|
47
|
-
children:
|
|
45
|
+
let u, p, d;
|
|
46
|
+
n[0] !== l ? ({
|
|
47
|
+
children: u,
|
|
48
48
|
inputRef: p,
|
|
49
49
|
...d
|
|
50
|
-
} =
|
|
50
|
+
} = l, n[0] = l, n[1] = u, n[2] = p, n[3] = d) : (u = n[1], p = n[2], d = n[3]);
|
|
51
51
|
const v = i.useRef(null);
|
|
52
52
|
let c, f;
|
|
53
53
|
n[4] !== p ? (c = (g) => {
|
|
@@ -58,17 +58,17 @@ const P = i.forwardRef((u, e) => {
|
|
|
58
58
|
preventScroll: !0
|
|
59
59
|
}), n[4] = p, n[5] = c, n[6] = f) : (c = n[5], f = n[6]);
|
|
60
60
|
let m;
|
|
61
|
-
return n[7] !==
|
|
61
|
+
return n[7] !== u || n[8] !== d || n[9] !== c || n[10] !== f ? (m = /* @__PURE__ */ I(F, { ref: v, onContextMenuCapture: H, onInteractOutside: U, onCloseAutoFocus: q, onOpenAutoFocus: c, onFocusCapture: f, align: "start", sideOffset: 8, ...d, children: u }), n[7] = u, n[8] = d, n[9] = c, n[10] = f, n[11] = m) : m = n[11], m;
|
|
62
62
|
});
|
|
63
63
|
P.displayName = "InputSuggestionMenuContent";
|
|
64
|
-
const Z = i.memo(P), V = i.forwardRef((
|
|
64
|
+
const Z = i.memo(P), V = i.forwardRef((l, e) => {
|
|
65
65
|
const {
|
|
66
66
|
suggestions: n,
|
|
67
|
-
onSuggestionSelect:
|
|
67
|
+
onSuggestionSelect: u = () => {
|
|
68
68
|
},
|
|
69
69
|
inputRef: p,
|
|
70
70
|
...d
|
|
71
|
-
} =
|
|
71
|
+
} = l, v = i.useRef([]), c = i.useRef(/* @__PURE__ */ new Map()), [f, m] = i.useState({}), g = i.useRef(null), a = i.useCallback((t, r) => {
|
|
72
72
|
const s = g.current;
|
|
73
73
|
if (!(!r?.force && s === t) && (s !== null && v.current[s]?.removeAttribute("data-focus"), g.current = t, t !== null)) {
|
|
74
74
|
const h = v.current[t];
|
|
@@ -155,10 +155,10 @@ const Z = i.memo(P), V = i.forwardRef((u, e) => {
|
|
|
155
155
|
const t = g.current;
|
|
156
156
|
if (t === null || !o[t]) return;
|
|
157
157
|
const r = o[t];
|
|
158
|
-
return setTimeout(() =>
|
|
158
|
+
return setTimeout(() => u(r), 0), r;
|
|
159
159
|
},
|
|
160
160
|
clearActiveItem: () => a(null)
|
|
161
|
-
}), [
|
|
161
|
+
}), [u, a, o]);
|
|
162
162
|
const b = (t) => {
|
|
163
163
|
m((r) => ({
|
|
164
164
|
...r,
|
|
@@ -191,7 +191,7 @@ const Z = i.memo(P), V = i.forwardRef((u, e) => {
|
|
|
191
191
|
visibleIndex: S,
|
|
192
192
|
isActive: w,
|
|
193
193
|
inputRef: p,
|
|
194
|
-
onSelect:
|
|
194
|
+
onSelect: u,
|
|
195
195
|
onActivate: a,
|
|
196
196
|
itemRef: S !== null ? M(S) : void 0
|
|
197
197
|
}
|
|
@@ -203,14 +203,14 @@ const Z = i.memo(P), V = i.forwardRef((u, e) => {
|
|
|
203
203
|
});
|
|
204
204
|
V.displayName = "InputSuggestionMenuContentItems";
|
|
205
205
|
const _ = i.memo(V);
|
|
206
|
-
function H(
|
|
207
|
-
return
|
|
206
|
+
function H(l) {
|
|
207
|
+
return l.stopPropagation();
|
|
208
208
|
}
|
|
209
|
-
function U(
|
|
210
|
-
return
|
|
209
|
+
function U(l) {
|
|
210
|
+
return l.target instanceof HTMLInputElement && l.preventDefault();
|
|
211
211
|
}
|
|
212
|
-
function q(
|
|
213
|
-
return
|
|
212
|
+
function q(l) {
|
|
213
|
+
return l.preventDefault();
|
|
214
214
|
}
|
|
215
215
|
export {
|
|
216
216
|
Z as InputSuggestionMenuContent,
|
|
@@ -8,9 +8,9 @@ export interface FormValidationProps<Values> {
|
|
|
8
8
|
onSubmit?: (values: Values) => void;
|
|
9
9
|
}
|
|
10
10
|
export interface ValidationProps<Value> {
|
|
11
|
-
initialValue?: Value |
|
|
12
|
-
defaultValue?: Value |
|
|
13
|
-
value?: Value |
|
|
11
|
+
initialValue?: Value | undefined;
|
|
12
|
+
defaultValue?: Value | undefined;
|
|
13
|
+
value?: Value | undefined;
|
|
14
14
|
required?: boolean;
|
|
15
15
|
formValidation?: {
|
|
16
16
|
setValue: (value: any) => void;
|
|
@@ -10,15 +10,15 @@ function S(r, t) {
|
|
|
10
10
|
if (typeof r != "object" || !r) return r;
|
|
11
11
|
var e = r[Symbol.toPrimitive];
|
|
12
12
|
if (e !== void 0) {
|
|
13
|
-
var
|
|
14
|
-
if (typeof
|
|
13
|
+
var i = e.call(r, t);
|
|
14
|
+
if (typeof i != "object") return i;
|
|
15
15
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
16
16
|
}
|
|
17
17
|
return (t === "string" ? String : Number)(r);
|
|
18
18
|
}
|
|
19
19
|
class f {
|
|
20
|
-
constructor(t, e,
|
|
21
|
-
c(this, "changeValue", void 0), c(this, "currentValues", void 0), c(this, "currentValidations", void 0), this.changeValue = t, this.currentValues = e, this.currentValidations =
|
|
20
|
+
constructor(t, e, i) {
|
|
21
|
+
c(this, "changeValue", void 0), c(this, "currentValues", void 0), c(this, "currentValidations", void 0), this.changeValue = t, this.currentValues = e, this.currentValidations = i;
|
|
22
22
|
}
|
|
23
23
|
isValid() {
|
|
24
24
|
if (!this.currentValidations) return !0;
|
|
@@ -30,14 +30,14 @@ class f {
|
|
|
30
30
|
return !0;
|
|
31
31
|
}
|
|
32
32
|
getInputProps(t) {
|
|
33
|
-
const e = this.currentValues[t],
|
|
33
|
+
const e = this.currentValues[t], i = e ?? null, u = t, a = (this.currentValidations && this.currentValidations[t] ? this.currentValidations[t] : (n) => null)(e, this.currentValues);
|
|
34
34
|
return {
|
|
35
35
|
// @ts-ignore – z.B. wenn dein Input `defaultValue` kennt
|
|
36
|
-
defaultValue:
|
|
37
|
-
initialValue:
|
|
36
|
+
defaultValue: i,
|
|
37
|
+
initialValue: i || void 0,
|
|
38
38
|
formValidation: {
|
|
39
|
-
setValue: (
|
|
40
|
-
this.changeValue(u,
|
|
39
|
+
setValue: (n) => {
|
|
40
|
+
this.changeValue(u, n);
|
|
41
41
|
},
|
|
42
42
|
notValidMessage: a,
|
|
43
43
|
valid: a === null
|
|
@@ -52,11 +52,11 @@ const _ = (r) => {
|
|
|
52
52
|
const {
|
|
53
53
|
initialValues: t,
|
|
54
54
|
validate: e = {},
|
|
55
|
-
truthyValidationBeforeSubmit:
|
|
55
|
+
truthyValidationBeforeSubmit: i = !0,
|
|
56
56
|
onSubmit: u
|
|
57
|
-
} = r, [o, a] = b(t),
|
|
57
|
+
} = r, [o, a] = b(t), n = p(t);
|
|
58
58
|
y(() => {
|
|
59
|
-
a(t),
|
|
59
|
+
a(t), n.current = t;
|
|
60
60
|
}, [t]);
|
|
61
61
|
const s = d((l, m) => {
|
|
62
62
|
a((g) => {
|
|
@@ -64,12 +64,12 @@ const _ = (r) => {
|
|
|
64
64
|
...g,
|
|
65
65
|
[l]: m
|
|
66
66
|
};
|
|
67
|
-
return
|
|
67
|
+
return n.current = V, V;
|
|
68
68
|
});
|
|
69
69
|
}, []), h = P(() => new f(s, o, e), [s, o, e]), v = d(() => {
|
|
70
|
-
const l = new f(s,
|
|
71
|
-
u && (!
|
|
72
|
-
}, [s, e, u,
|
|
70
|
+
const l = new f(s, n.current, e);
|
|
71
|
+
u && (!i || l.isValid()) && u(n.current);
|
|
72
|
+
}, [s, e, u, i]);
|
|
73
73
|
return [h, v];
|
|
74
74
|
};
|
|
75
75
|
export {
|