treege 3.0.0-beta.8 → 3.0.0-beta40
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/LICENSE +18 -12
- package/README.md +213 -30
- package/dist/DefaultInputs-8yJMEyMh.js +1557 -0
- package/dist/ThemeContext-Ejgu9Mwr.js +1603 -0
- package/dist/editor/components/input/ComboboxWithCreate.d.ts +2 -1
- package/dist/editor/constants/defaultNode.d.ts +1 -1
- package/dist/editor/constants/edgeTypes.d.ts +3 -2
- package/dist/editor/constants/inputTypeIcons.d.ts +3 -0
- package/dist/editor/constants/nodeSpacing.d.ts +33 -0
- package/dist/editor/constants/nodeTypes.d.ts +5 -5
- package/dist/editor/context/TreegeEditorContext.d.ts +53 -1
- package/dist/editor/features/TreegeEditor/TreegeEditor.d.ts +1 -1
- package/dist/editor/features/TreegeEditor/dialogs/ChangeNodeTypeDialog.d.ts +2 -0
- package/dist/editor/features/TreegeEditor/dialogs/DeleteNodeDialog.d.ts +2 -0
- package/dist/editor/features/TreegeEditor/edges/ConditionalEdge.d.ts +2 -2
- package/dist/editor/features/TreegeEditor/edges/DefaultEdge.d.ts +3 -0
- package/dist/editor/features/TreegeEditor/forms/SubmitConfigForm.d.ts +7 -0
- package/dist/editor/features/TreegeEditor/inputs/ComboboxPattern.d.ts +2 -1
- package/dist/editor/features/TreegeEditor/inputs/OptionImageField.d.ts +6 -0
- package/dist/editor/features/TreegeEditor/nodes/GroupNode.d.ts +2 -2
- package/dist/editor/features/TreegeEditor/nodes/TreegeNode.d.ts +6 -0
- package/dist/editor/features/TreegeEditor/nodes/components/BottomHandleDropdown.d.ts +6 -0
- package/dist/editor/features/TreegeEditor/nodes/components/NodeInputPreview.d.ts +7 -0
- package/dist/editor/features/TreegeEditor/nodes/components/NodeLabelInput.d.ts +9 -0
- package/dist/editor/features/TreegeEditor/nodes/components/NodeMoreMenu.d.ts +6 -0
- package/dist/editor/features/TreegeEditor/nodes/components/NodeTypeBadge.d.ts +7 -0
- package/dist/editor/features/TreegeEditor/nodes/components/OptionsEditor.d.ts +7 -0
- package/dist/editor/features/TreegeEditor/nodes/components/RequiredBadge.d.ts +6 -0
- package/dist/editor/features/TreegeEditor/nodes/layout/NodeWrapper.d.ts +2 -1
- package/dist/editor/features/TreegeEditor/panel/AIGeneratorDialog.d.ts +16 -0
- package/dist/editor/hooks/useAutoLayout.d.ts +15 -0
- package/dist/editor/hooks/useFlowActions.d.ts +5 -2
- package/dist/editor/hooks/useFlowConnections.d.ts +4 -0
- package/dist/editor/hooks/useNodesSelection.d.ts +5 -5
- package/dist/editor/types/ai.d.ts +65 -0
- package/dist/editor/types/editor.d.ts +9 -8
- package/dist/editor/utils/aiFlowGenerator.d.ts +5 -0
- package/dist/editor/utils/dagreLayout.d.ts +17 -0
- package/dist/editor/utils/edge.d.ts +14 -0
- package/dist/editor/utils/image.d.ts +7 -0
- package/dist/editor/utils/inputTypeIcon.d.ts +6 -0
- package/dist/editor-DWJ95r4g.js +4001 -0
- package/dist/editor.js +3 -7
- package/dist/main.js +4 -52
- package/dist/renderer/context/TreegeRendererContext.d.ts +4 -1
- package/dist/renderer/features/TreegeRenderer/native/TreegeRenderer.d.ts +19 -11
- package/dist/renderer/features/TreegeRenderer/native/components/DefaultFormWrapper.d.ts +7 -7
- package/dist/renderer/features/TreegeRenderer/native/components/DefaultGroup.d.ts +7 -7
- package/dist/renderer/features/TreegeRenderer/native/components/DefaultInputs.d.ts +21 -15
- package/dist/renderer/features/TreegeRenderer/native/components/DefaultSubmitButton.d.ts +9 -7
- package/dist/renderer/features/TreegeRenderer/native/components/DefaultSubmitButtonWrapper.d.ts +11 -0
- package/dist/renderer/features/TreegeRenderer/native/components/DefaultUI.d.ts +8 -7
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultAddressInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultAutocompleteInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultCheckboxInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultDateInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultDateRangeInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultFileInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultHiddenInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultHttpInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultNumberInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultPasswordInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultRadioInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultSelectInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultSwitchInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultTextInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultTextareaInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultTimeInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultTimeRangeInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/useTreegeRenderer.d.ts +84 -24
- package/dist/renderer/features/TreegeRenderer/web/TreegeRenderer.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/DefaultSubmitButton.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultAddressInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultAutocompleteInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultCheckboxInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultDateInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultDateRangeInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultFileInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultHiddenInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultHttpInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultNumberInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultPasswordInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultRadioInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultSelectInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultSubmitInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultSwitchInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultTextAreaInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultTextInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultTimeInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultTimeRangeInput.d.ts +1 -1
- package/dist/renderer/hooks/useRenderNode.d.ts +55 -0
- package/dist/renderer/hooks/useSubmitHandler.d.ts +34 -0
- package/dist/renderer/hooks/useTranslate.d.ts +6 -4
- package/dist/renderer/index.d.ts +2 -0
- package/dist/renderer/index.native.d.ts +19 -0
- package/dist/renderer/types/renderer.d.ts +60 -6
- package/dist/renderer/utils/form.d.ts +22 -2
- package/dist/renderer/utils/http.d.ts +101 -0
- package/dist/renderer/utils/node.d.ts +18 -1
- package/dist/renderer/utils/sanitize.d.ts +85 -0
- package/dist/renderer/utils/sanitize.native.d.ts +69 -0
- package/dist/renderer/utils/submit.d.ts +47 -0
- package/dist/renderer-native.d.ts +2 -0
- package/dist/renderer-native.js +3496 -0
- package/dist/renderer.js +3 -45
- package/dist/shared/components/ui/badge.d.ts +2 -2
- package/dist/shared/components/ui/button.d.ts +2 -2
- package/dist/shared/components/ui/collapsible.d.ts +1 -1
- package/dist/shared/components/ui/command.d.ts +1 -1
- package/dist/shared/components/ui/dropdown-menu.d.ts +1 -1
- package/dist/shared/components/ui/form.d.ts +1 -1
- package/dist/shared/components/ui/popover.d.ts +4 -2
- package/dist/shared/components/ui/select.d.ts +3 -1
- package/dist/shared/components/ui/sheet.d.ts +1 -1
- package/dist/shared/components/ui/tooltip.d.ts +1 -1
- package/dist/shared/constants/colors.d.ts +45 -0
- package/dist/shared/constants/inputType.d.ts +1 -0
- package/dist/shared/context/ThemeContext.d.ts +2 -0
- package/dist/shared/context/ThemeContext.native.d.ts +22 -0
- package/dist/shared/hooks/useThemeColors.d.ts +37 -0
- package/dist/shared/locales/ar.json.d.ts +117 -10
- package/dist/shared/locales/de.json.d.ts +118 -11
- package/dist/shared/locales/en.json.d.ts +119 -12
- package/dist/shared/locales/es.json.d.ts +118 -11
- package/dist/shared/locales/fr.json.d.ts +118 -11
- package/dist/shared/locales/it.json.d.ts +118 -11
- package/dist/shared/locales/pt.json.d.ts +118 -11
- package/dist/shared/types/edge.d.ts +6 -0
- package/dist/shared/types/node.d.ts +64 -0
- package/package.json +38 -12
- package/dist/ThemeContext-BIvs8Kw-.js +0 -758
- package/dist/TreegeEditor-Lv5Tn9_F.js +0 -2152
- package/dist/TreegeRenderer-D3EvsEfJ.js +0 -1413
- package/dist/editor/features/TreegeEditor/inputs/SelectInputType.d.ts +0 -7
- package/dist/editor/features/TreegeEditor/nodes/FlowNode.d.ts +0 -6
- package/dist/editor/features/TreegeEditor/nodes/InputNode.d.ts +0 -6
- package/dist/editor/features/TreegeEditor/nodes/UINode.d.ts +0 -6
|
@@ -0,0 +1,1557 @@
|
|
|
1
|
+
import { S as e, _ as t, c as n, f as r, i, m as a, o, p as s, r as c, s as l, t as u, u as d, w as f } from "./ThemeContext-Ejgu9Mwr.js";
|
|
2
|
+
import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
3
|
+
import { Check as g, CheckIcon as _, ChevronDownIcon as v, ChevronLeftIcon as y, ChevronRightIcon as b, ChevronUpIcon as x, ChevronsUpDown as S, CircleIcon as C, Loader2 as ee, MapPin as w, SearchIcon as T, XIcon as te } from "lucide-react";
|
|
4
|
+
import * as E from "react";
|
|
5
|
+
import { forwardRef as D, useCallback as O, useEffect as k, useMemo as ne, useRef as A, useState as j } from "react";
|
|
6
|
+
import { Slot as M } from "@radix-ui/react-slot";
|
|
7
|
+
import { cva as N } from "class-variance-authority";
|
|
8
|
+
import { clsx as P } from "clsx";
|
|
9
|
+
import { twMerge as F } from "tailwind-merge";
|
|
10
|
+
import * as I from "@radix-ui/react-checkbox";
|
|
11
|
+
import * as re from "@radix-ui/react-label";
|
|
12
|
+
import * as L from "@radix-ui/react-popover";
|
|
13
|
+
import * as R from "@radix-ui/react-select";
|
|
14
|
+
import { Command as z } from "cmdk";
|
|
15
|
+
import * as B from "@radix-ui/react-dialog";
|
|
16
|
+
import { DayPicker as ie, getDefaultClassNames as V } from "react-day-picker";
|
|
17
|
+
import * as H from "@radix-ui/react-tooltip";
|
|
18
|
+
import * as U from "@radix-ui/react-radio-group";
|
|
19
|
+
import * as ae from "@radix-ui/react-separator";
|
|
20
|
+
import * as oe from "@radix-ui/react-switch";
|
|
21
|
+
//#region src/shared/lib/utils.ts
|
|
22
|
+
function W(...e) {
|
|
23
|
+
return F(P(e));
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region src/shared/components/ui/button.tsx
|
|
27
|
+
var G = N("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", {
|
|
28
|
+
defaultVariants: {
|
|
29
|
+
size: "default",
|
|
30
|
+
variant: "default"
|
|
31
|
+
},
|
|
32
|
+
variants: {
|
|
33
|
+
size: {
|
|
34
|
+
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
35
|
+
icon: "size-9",
|
|
36
|
+
"icon-lg": "size-10",
|
|
37
|
+
"icon-sm": "size-8",
|
|
38
|
+
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
39
|
+
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
40
|
+
xs: "h-6 rounded-md gap-1 px-2 text-xs has-[>svg]:px-1.5"
|
|
41
|
+
},
|
|
42
|
+
variant: {
|
|
43
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
44
|
+
destructive: "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
45
|
+
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
46
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
47
|
+
outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
|
48
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
function K({ className: e, variant: t, size: n, asChild: r = !1, ...i }) {
|
|
53
|
+
return /* @__PURE__ */ m(r ? M : "button", {
|
|
54
|
+
"data-slot": "button",
|
|
55
|
+
className: W(G({
|
|
56
|
+
className: e,
|
|
57
|
+
size: n,
|
|
58
|
+
variant: t
|
|
59
|
+
})),
|
|
60
|
+
...i
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/shared/components/ui/checkbox.tsx
|
|
65
|
+
function se({ className: e, ...t }) {
|
|
66
|
+
return /* @__PURE__ */ m(I.Root, {
|
|
67
|
+
"data-slot": "checkbox",
|
|
68
|
+
className: W("peer size-4 shrink-0 rounded-[4px] border border-input shadow-xs outline-none transition-shadow focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:bg-input/30 dark:data-[state=checked]:bg-primary dark:aria-invalid:ring-destructive/40", e),
|
|
69
|
+
...t,
|
|
70
|
+
children: /* @__PURE__ */ m(I.Indicator, {
|
|
71
|
+
"data-slot": "checkbox-indicator",
|
|
72
|
+
className: "grid place-content-center text-current transition-none",
|
|
73
|
+
children: /* @__PURE__ */ m(_, { className: "size-3.5" })
|
|
74
|
+
})
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region src/shared/components/ui/form.tsx
|
|
79
|
+
function q({ className: e, ...t }) {
|
|
80
|
+
return /* @__PURE__ */ m("div", {
|
|
81
|
+
"data-slot": "form-item",
|
|
82
|
+
className: W("grid gap-2", e),
|
|
83
|
+
...t
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
function J({ className: e, ...t }) {
|
|
87
|
+
return /* @__PURE__ */ m("p", {
|
|
88
|
+
"data-slot": "form-description",
|
|
89
|
+
className: W("text-muted-foreground text-xs", e),
|
|
90
|
+
...t
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
function Y({ className: e, ...t }) {
|
|
94
|
+
return /* @__PURE__ */ m("p", {
|
|
95
|
+
"data-slot": "form-error",
|
|
96
|
+
className: W("text-destructive text-xs", e),
|
|
97
|
+
...t
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
//#endregion
|
|
101
|
+
//#region src/shared/components/ui/input.tsx
|
|
102
|
+
function X({ className: e, type: t, ...n }) {
|
|
103
|
+
return /* @__PURE__ */ m("input", {
|
|
104
|
+
type: t,
|
|
105
|
+
"data-slot": "input",
|
|
106
|
+
className: W("h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs outline-none transition-[color,box-shadow] selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:font-medium file:text-foreground file:text-sm placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30", "focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50", "aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40", e),
|
|
107
|
+
...n
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
//#endregion
|
|
111
|
+
//#region src/shared/components/ui/label.tsx
|
|
112
|
+
var Z = ({ className: e, ...t }) => /* @__PURE__ */ m(re.Root, {
|
|
113
|
+
"data-slot": "label",
|
|
114
|
+
className: W("flex select-none items-center gap-2 font-medium text-muted-foreground text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-50 group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50", e),
|
|
115
|
+
...t
|
|
116
|
+
});
|
|
117
|
+
//#endregion
|
|
118
|
+
//#region src/shared/components/ui/popover.tsx
|
|
119
|
+
function Q({ ...e }) {
|
|
120
|
+
return /* @__PURE__ */ m(L.Root, {
|
|
121
|
+
"data-slot": "popover",
|
|
122
|
+
...e
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
function ce({ ...e }) {
|
|
126
|
+
return /* @__PURE__ */ m(L.Trigger, {
|
|
127
|
+
"data-slot": "popover-trigger",
|
|
128
|
+
...e
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
function $({ className: e, align: t = "center", sideOffset: n = 4, disablePortal: r = !1, ...i }) {
|
|
132
|
+
let a = /* @__PURE__ */ m(L.Content, {
|
|
133
|
+
"data-slot": "popover-content",
|
|
134
|
+
align: t,
|
|
135
|
+
sideOffset: n,
|
|
136
|
+
className: W("data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden data-[state=closed]:animate-out data-[state=open]:animate-in", e),
|
|
137
|
+
...i
|
|
138
|
+
});
|
|
139
|
+
return r ? a : /* @__PURE__ */ m(L.Portal, { children: a });
|
|
140
|
+
}
|
|
141
|
+
//#endregion
|
|
142
|
+
//#region src/shared/components/ui/select.tsx
|
|
143
|
+
var le = ({ ...e }) => /* @__PURE__ */ m(R.Root, {
|
|
144
|
+
"data-slot": "select",
|
|
145
|
+
...e
|
|
146
|
+
}), ue = ({ ...e }) => /* @__PURE__ */ m(R.Group, {
|
|
147
|
+
"data-slot": "select-group",
|
|
148
|
+
...e
|
|
149
|
+
}), de = ({ ...e }) => /* @__PURE__ */ m(R.Value, {
|
|
150
|
+
"data-slot": "select-value",
|
|
151
|
+
...e
|
|
152
|
+
}), fe = ({ className: e, size: t = "default", children: n, ...r }) => /* @__PURE__ */ h(R.Trigger, {
|
|
153
|
+
"data-slot": "select-trigger",
|
|
154
|
+
"data-size": t,
|
|
155
|
+
className: W("flex w-fit items-center justify-between gap-2 whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-xs outline-none transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[size=default]:h-9 data-[size=sm]:h-8 data-[placeholder]:text-muted-foreground *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 dark:bg-input/30 dark:aria-invalid:ring-destructive/40 dark:hover:bg-input/50 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0", e),
|
|
156
|
+
...r,
|
|
157
|
+
children: [n, /* @__PURE__ */ m(R.Icon, {
|
|
158
|
+
asChild: !0,
|
|
159
|
+
children: /* @__PURE__ */ m(v, { className: "size-4 opacity-50" })
|
|
160
|
+
})]
|
|
161
|
+
}), pe = ({ className: e, children: t, position: n = "popper", ...r }) => /* @__PURE__ */ m(R.Portal, { children: /* @__PURE__ */ h(R.Content, {
|
|
162
|
+
"data-slot": "select-content",
|
|
163
|
+
className: W("data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=closed]:animate-out data-[state=open]:animate-in", n === "popper" && "data-[side=left]:-translate-x-1 data-[side=top]:-translate-y-1 data-[side=right]:translate-x-1 data-[side=bottom]:translate-y-1", e),
|
|
164
|
+
position: n,
|
|
165
|
+
...r,
|
|
166
|
+
children: [
|
|
167
|
+
/* @__PURE__ */ m(_e, {}),
|
|
168
|
+
/* @__PURE__ */ m(R.Viewport, {
|
|
169
|
+
className: W("p-1", n === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),
|
|
170
|
+
children: t
|
|
171
|
+
}),
|
|
172
|
+
/* @__PURE__ */ m(ve, {})
|
|
173
|
+
]
|
|
174
|
+
}) }), me = ({ className: e, htmlFor: t, children: n, ...r }) => /* @__PURE__ */ m(R.Label, {
|
|
175
|
+
"data-slot": "select-label",
|
|
176
|
+
className: W("pb-1.5 font-medium text-muted-foreground text-sm", e),
|
|
177
|
+
...r,
|
|
178
|
+
children: /* @__PURE__ */ m("label", {
|
|
179
|
+
htmlFor: t,
|
|
180
|
+
children: n
|
|
181
|
+
})
|
|
182
|
+
}), he = ({ className: e, children: t, ...n }) => /* @__PURE__ */ h(R.Item, {
|
|
183
|
+
"data-slot": "select-item",
|
|
184
|
+
className: W("relative flex w-full cursor-pointer select-none items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2", e),
|
|
185
|
+
...n,
|
|
186
|
+
children: [/* @__PURE__ */ m("span", {
|
|
187
|
+
className: "absolute right-2 flex size-3.5 items-center justify-center",
|
|
188
|
+
children: /* @__PURE__ */ m(R.ItemIndicator, { children: /* @__PURE__ */ m(_, { className: "size-4" }) })
|
|
189
|
+
}), /* @__PURE__ */ m(R.ItemText, { children: t })]
|
|
190
|
+
}), ge = ({ className: e, ...t }) => /* @__PURE__ */ m(R.Separator, {
|
|
191
|
+
"data-slot": "select-separator",
|
|
192
|
+
className: W("-mx-1 pointer-events-none my-1 h-px bg-border", e),
|
|
193
|
+
...t
|
|
194
|
+
}), _e = ({ className: e, ...t }) => /* @__PURE__ */ m(R.ScrollUpButton, {
|
|
195
|
+
"data-slot": "select-scroll-up-button",
|
|
196
|
+
className: W("flex cursor-default items-center justify-center py-1", e),
|
|
197
|
+
...t,
|
|
198
|
+
children: /* @__PURE__ */ m(x, { className: "size-4" })
|
|
199
|
+
}), ve = ({ className: e, ...t }) => /* @__PURE__ */ m(R.ScrollDownButton, {
|
|
200
|
+
"data-slot": "select-scroll-down-button",
|
|
201
|
+
className: W("flex cursor-default items-center justify-center py-1", e),
|
|
202
|
+
...t,
|
|
203
|
+
children: /* @__PURE__ */ m(v, { className: "size-4" })
|
|
204
|
+
});
|
|
205
|
+
//#endregion
|
|
206
|
+
//#region src/shared/components/ui/dialog.tsx
|
|
207
|
+
function ye({ ...e }) {
|
|
208
|
+
return /* @__PURE__ */ m(B.Root, {
|
|
209
|
+
"data-slot": "dialog",
|
|
210
|
+
...e
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
function be({ ...e }) {
|
|
214
|
+
return /* @__PURE__ */ m(B.Trigger, {
|
|
215
|
+
"data-slot": "dialog-trigger",
|
|
216
|
+
...e
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
function xe({ ...e }) {
|
|
220
|
+
return /* @__PURE__ */ m(B.Portal, {
|
|
221
|
+
"data-slot": "dialog-portal",
|
|
222
|
+
...e
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
function Se({ className: e, ...t }) {
|
|
226
|
+
return /* @__PURE__ */ m(B.Overlay, {
|
|
227
|
+
"data-slot": "dialog-overlay",
|
|
228
|
+
className: W("data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=open]:animate-in", e),
|
|
229
|
+
...t
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
function Ce({ className: e, children: t, showCloseButton: n = !0, ...r }) {
|
|
233
|
+
return /* @__PURE__ */ h(xe, {
|
|
234
|
+
"data-slot": "dialog-portal",
|
|
235
|
+
children: [/* @__PURE__ */ m(Se, {}), /* @__PURE__ */ h(B.Content, {
|
|
236
|
+
"data-slot": "dialog-content",
|
|
237
|
+
className: W("data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 data-[state=closed]:animate-out data-[state=open]:animate-in sm:max-w-lg", e),
|
|
238
|
+
...r,
|
|
239
|
+
children: [t, n && /* @__PURE__ */ h(B.Close, {
|
|
240
|
+
"data-slot": "dialog-close",
|
|
241
|
+
className: "absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
242
|
+
children: [/* @__PURE__ */ m(te, {}), /* @__PURE__ */ m("span", {
|
|
243
|
+
className: "sr-only",
|
|
244
|
+
children: "Close"
|
|
245
|
+
})]
|
|
246
|
+
})]
|
|
247
|
+
})]
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
function we({ className: e, ...t }) {
|
|
251
|
+
return /* @__PURE__ */ m("div", {
|
|
252
|
+
"data-slot": "dialog-header",
|
|
253
|
+
className: W("flex flex-col gap-2 text-center sm:text-left", e),
|
|
254
|
+
...t
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
function Te({ className: e, ...t }) {
|
|
258
|
+
return /* @__PURE__ */ m("div", {
|
|
259
|
+
"data-slot": "dialog-footer",
|
|
260
|
+
className: W("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", e),
|
|
261
|
+
...t
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
function Ee({ className: e, ...t }) {
|
|
265
|
+
return /* @__PURE__ */ m(B.Title, {
|
|
266
|
+
"data-slot": "dialog-title",
|
|
267
|
+
className: W("font-semibold text-lg leading-none", e),
|
|
268
|
+
...t
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
function De({ className: e, ...t }) {
|
|
272
|
+
return /* @__PURE__ */ m(B.Description, {
|
|
273
|
+
"data-slot": "dialog-description",
|
|
274
|
+
className: W("text-muted-foreground text-sm", e),
|
|
275
|
+
...t
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
//#endregion
|
|
279
|
+
//#region src/shared/components/ui/command.tsx
|
|
280
|
+
function Oe({ className: e, ...t }) {
|
|
281
|
+
return /* @__PURE__ */ m(z, {
|
|
282
|
+
"data-slot": "command",
|
|
283
|
+
className: W("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground", e),
|
|
284
|
+
...t
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
function ke({ className: e, ...t }) {
|
|
288
|
+
return /* @__PURE__ */ h("div", {
|
|
289
|
+
"data-slot": "command-input-wrapper",
|
|
290
|
+
className: "flex h-9 items-center gap-2 border-b px-3",
|
|
291
|
+
children: [/* @__PURE__ */ m(T, { className: "size-4 shrink-0 opacity-50" }), /* @__PURE__ */ m(z.Input, {
|
|
292
|
+
"data-slot": "command-input",
|
|
293
|
+
className: W("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50", e),
|
|
294
|
+
...t
|
|
295
|
+
})]
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
function Ae({ className: e, ...t }) {
|
|
299
|
+
return /* @__PURE__ */ m(z.List, {
|
|
300
|
+
"data-slot": "command-list",
|
|
301
|
+
className: W("max-h-[300px] scroll-py-1 overflow-y-auto overflow-x-hidden", e),
|
|
302
|
+
...t
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
function je({ ...e }) {
|
|
306
|
+
return /* @__PURE__ */ m(z.Empty, {
|
|
307
|
+
"data-slot": "command-empty",
|
|
308
|
+
className: "py-6 text-center text-sm",
|
|
309
|
+
...e
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
function Me({ className: e, ...t }) {
|
|
313
|
+
return /* @__PURE__ */ m(z.Group, {
|
|
314
|
+
"data-slot": "command-group",
|
|
315
|
+
className: W("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group-heading]]:text-xs", e),
|
|
316
|
+
...t
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
function Ne({ className: e, ...t }) {
|
|
320
|
+
return /* @__PURE__ */ m(z.Item, {
|
|
321
|
+
"data-slot": "command-item",
|
|
322
|
+
className: W("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0", e),
|
|
323
|
+
...t
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
//#endregion
|
|
327
|
+
//#region src/renderer/features/TreegeRenderer/web/components/inputs/DefaultAddressInput.tsx
|
|
328
|
+
var Pe = async (e, t) => {
|
|
329
|
+
if (!e || e.trim().length < 3) return [];
|
|
330
|
+
try {
|
|
331
|
+
let n = await fetch(`https://nominatim.openstreetmap.org/search?q=${encodeURIComponent(e)}&format=jsonv2&addressdetails=1&limit=5`, { headers: {
|
|
332
|
+
Accept: "application/json",
|
|
333
|
+
"User-Agent": "Treege Renderer",
|
|
334
|
+
...t && { "Accept-Language": t }
|
|
335
|
+
} });
|
|
336
|
+
return n.ok ? (await n.json()).map((e) => ({
|
|
337
|
+
label: e.display_name,
|
|
338
|
+
value: e.display_name
|
|
339
|
+
})) : [];
|
|
340
|
+
} catch (e) {
|
|
341
|
+
return console.error("Nominatim fetch error:", e), [];
|
|
342
|
+
}
|
|
343
|
+
}, Fe = (e) => !e || e.trim().length < 3 ? Promise.resolve([]) : new Promise((t) => {
|
|
344
|
+
if (!window.google?.maps?.places) {
|
|
345
|
+
console.warn("Google Places SDK not loaded yet"), t([]);
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
new window.google.maps.places.AutocompleteService().getPlacePredictions({ input: e }, (e, n) => {
|
|
349
|
+
if (n !== google.maps.places.PlacesServiceStatus.OK || !e) {
|
|
350
|
+
console.warn("Google Places API status:", n), t([]);
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
t(e.map((e) => ({
|
|
354
|
+
label: e.description,
|
|
355
|
+
value: e.description
|
|
356
|
+
})));
|
|
357
|
+
});
|
|
358
|
+
}), Ie = ({ node: e, value: t, setValue: n, error: r, label: i, placeholder: o, helperText: s, id: c, name: l }) => {
|
|
359
|
+
let [u, f] = j(""), [g, _] = j([]), [v, y] = j(!1), { googleApiKey: b, language: x } = a(), S = d(), C = O((e) => {
|
|
360
|
+
n(e.value), f(e.value), y(!1);
|
|
361
|
+
}, [n]);
|
|
362
|
+
k(() => {
|
|
363
|
+
if (!u || u.trim().length < 3) {
|
|
364
|
+
_([]);
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
let e = setTimeout(async () => {
|
|
368
|
+
_(b ? await Fe(u) : await Pe(u, x));
|
|
369
|
+
}, 300);
|
|
370
|
+
return () => clearTimeout(e);
|
|
371
|
+
}, [
|
|
372
|
+
u,
|
|
373
|
+
b,
|
|
374
|
+
x
|
|
375
|
+
]);
|
|
376
|
+
let ee = O((e) => {
|
|
377
|
+
n(e), f(e), e.length >= 3 && y(!0);
|
|
378
|
+
}, [n]);
|
|
379
|
+
return /* @__PURE__ */ h(p, { children: [b && /* @__PURE__ */ m("script", {
|
|
380
|
+
async: !0,
|
|
381
|
+
src: `https://maps.googleapis.com/maps/api/js?key=${b}&libraries=places`
|
|
382
|
+
}), /* @__PURE__ */ h(q, {
|
|
383
|
+
className: "mb-4",
|
|
384
|
+
children: [
|
|
385
|
+
/* @__PURE__ */ h(Z, {
|
|
386
|
+
htmlFor: c,
|
|
387
|
+
children: [i || e.data.name, e.data.required && /* @__PURE__ */ m("span", {
|
|
388
|
+
className: "text-red-500",
|
|
389
|
+
children: "*"
|
|
390
|
+
})]
|
|
391
|
+
}),
|
|
392
|
+
/* @__PURE__ */ h("div", {
|
|
393
|
+
className: "relative",
|
|
394
|
+
children: [
|
|
395
|
+
/* @__PURE__ */ m(X, {
|
|
396
|
+
type: "text",
|
|
397
|
+
id: c,
|
|
398
|
+
name: l,
|
|
399
|
+
value: t || "",
|
|
400
|
+
onChange: (e) => ee(e.target.value),
|
|
401
|
+
onFocus: () => {
|
|
402
|
+
g.length > 0 && y(!0);
|
|
403
|
+
},
|
|
404
|
+
placeholder: o || S("renderer.defaultAddressInput.enterAddress"),
|
|
405
|
+
className: "pr-10",
|
|
406
|
+
autoComplete: "off"
|
|
407
|
+
}),
|
|
408
|
+
/* @__PURE__ */ m(w, { className: "-translate-y-1/2 pointer-events-none absolute top-1/2 right-3 h-4 w-4 text-muted-foreground" }),
|
|
409
|
+
v && /* @__PURE__ */ m("div", {
|
|
410
|
+
className: "absolute z-50 mt-1 w-full rounded-md border bg-popover shadow-md",
|
|
411
|
+
children: /* @__PURE__ */ m(Oe, { children: /* @__PURE__ */ h(Ae, { children: [/* @__PURE__ */ m(je, { children: S("renderer.defaultAddressInput.noAddressesFound") }), /* @__PURE__ */ m(Me, { children: g.map((e, t) => /* @__PURE__ */ h(Ne, {
|
|
412
|
+
value: e.value,
|
|
413
|
+
onSelect: () => C(e),
|
|
414
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
415
|
+
children: [/* @__PURE__ */ m(w, { className: "mr-2 h-4 w-4" }), e.label]
|
|
416
|
+
}, t)) })] }) })
|
|
417
|
+
})
|
|
418
|
+
]
|
|
419
|
+
}),
|
|
420
|
+
r && /* @__PURE__ */ m(Y, { children: r }),
|
|
421
|
+
s && !r && /* @__PURE__ */ m(J, { children: s })
|
|
422
|
+
]
|
|
423
|
+
})] });
|
|
424
|
+
}, Le = ({ node: e, value: t, setValue: n, error: r, label: i, placeholder: a, helperText: o, id: s }) => {
|
|
425
|
+
let c = d(), [l, u] = j(!1), f = `${s}-trigger`, p = `${s}-error`, _ = e.data.options || [], v = _.find((e) => e.value === t);
|
|
426
|
+
return /* @__PURE__ */ h(q, {
|
|
427
|
+
className: "mb-4",
|
|
428
|
+
children: [
|
|
429
|
+
/* @__PURE__ */ h(Z, {
|
|
430
|
+
htmlFor: f,
|
|
431
|
+
children: [i || e.data.name, e.data.required && /* @__PURE__ */ m("span", {
|
|
432
|
+
className: "text-red-500",
|
|
433
|
+
children: "*"
|
|
434
|
+
})]
|
|
435
|
+
}),
|
|
436
|
+
/* @__PURE__ */ h(Q, {
|
|
437
|
+
open: l,
|
|
438
|
+
onOpenChange: u,
|
|
439
|
+
children: [/* @__PURE__ */ m(ce, {
|
|
440
|
+
asChild: !0,
|
|
441
|
+
children: /* @__PURE__ */ h(K, {
|
|
442
|
+
id: f,
|
|
443
|
+
variant: "outline",
|
|
444
|
+
role: "combobox",
|
|
445
|
+
"aria-expanded": l,
|
|
446
|
+
"aria-invalid": !!r || void 0,
|
|
447
|
+
"aria-describedby": r ? p : void 0,
|
|
448
|
+
className: "w-full justify-between font-normal",
|
|
449
|
+
children: [t ? v?.label ? c(v.label) : t : a || c("renderer.defaultAutocompleteInput.selectOption"), /* @__PURE__ */ m(S, { className: "ml-2 size-4 shrink-0 opacity-50" })]
|
|
450
|
+
})
|
|
451
|
+
}), /* @__PURE__ */ m($, {
|
|
452
|
+
className: "w-full p-0",
|
|
453
|
+
align: "start",
|
|
454
|
+
children: /* @__PURE__ */ h(Oe, { children: [/* @__PURE__ */ m(ke, { placeholder: a || c("renderer.defaultAutocompleteInput.search") }), /* @__PURE__ */ h(Ae, { children: [/* @__PURE__ */ m(je, { children: c("renderer.defaultAutocompleteInput.noResults") }), /* @__PURE__ */ m(Me, { children: _.map((e) => /* @__PURE__ */ h(Ne, {
|
|
455
|
+
value: e.value,
|
|
456
|
+
disabled: e.disabled,
|
|
457
|
+
onSelect: (e) => {
|
|
458
|
+
n(e === t ? "" : e), u(!1);
|
|
459
|
+
},
|
|
460
|
+
children: [/* @__PURE__ */ m(g, { className: W("mr-2 size-4", t === e.value ? "opacity-100" : "opacity-0") }), c(e.label)]
|
|
461
|
+
}, e.value)) })] })] })
|
|
462
|
+
})]
|
|
463
|
+
}),
|
|
464
|
+
r && /* @__PURE__ */ m(Y, {
|
|
465
|
+
id: p,
|
|
466
|
+
children: r
|
|
467
|
+
}),
|
|
468
|
+
o && !r && /* @__PURE__ */ m(J, { children: o })
|
|
469
|
+
]
|
|
470
|
+
});
|
|
471
|
+
}, Re = ({ node: e, value: t, setValue: n, error: r, label: i, helperText: a, id: o, name: s }) => {
|
|
472
|
+
let c = d();
|
|
473
|
+
if (e.data.options && e.data.options.length > 0) {
|
|
474
|
+
let l = Array.isArray(t) ? t.map(String) : [], u = (e, t) => {
|
|
475
|
+
n(t ? [...l, e] : l.filter((t) => t !== e));
|
|
476
|
+
};
|
|
477
|
+
return /* @__PURE__ */ h(q, {
|
|
478
|
+
className: "mb-4",
|
|
479
|
+
children: [
|
|
480
|
+
/* @__PURE__ */ h(Z, {
|
|
481
|
+
className: "mb-1",
|
|
482
|
+
children: [i || e.data.name, e.data.required && /* @__PURE__ */ m("span", {
|
|
483
|
+
className: "text-red-500",
|
|
484
|
+
children: "*"
|
|
485
|
+
})]
|
|
486
|
+
}),
|
|
487
|
+
/* @__PURE__ */ m("div", {
|
|
488
|
+
className: "space-y-2",
|
|
489
|
+
children: e.data.options.map((e, t) => {
|
|
490
|
+
let n = c(e.description);
|
|
491
|
+
return /* @__PURE__ */ h("div", {
|
|
492
|
+
className: "flex items-start gap-3",
|
|
493
|
+
children: [/* @__PURE__ */ m(se, {
|
|
494
|
+
id: `${o}-${e.value}`,
|
|
495
|
+
name: s,
|
|
496
|
+
checked: l.includes(String(e.value)),
|
|
497
|
+
onCheckedChange: (t) => u(String(e.value), !!t),
|
|
498
|
+
disabled: e.disabled,
|
|
499
|
+
className: "mt-0.5"
|
|
500
|
+
}), /* @__PURE__ */ h("div", {
|
|
501
|
+
className: "flex flex-col",
|
|
502
|
+
children: [/* @__PURE__ */ m(Z, {
|
|
503
|
+
htmlFor: `${o}-${e.value}`,
|
|
504
|
+
className: "cursor-pointer font-normal text-sm",
|
|
505
|
+
children: c(e.label) ? c(e.label) : e.value
|
|
506
|
+
}), n && /* @__PURE__ */ m("span", {
|
|
507
|
+
className: "text-muted-foreground text-xs",
|
|
508
|
+
children: n
|
|
509
|
+
})]
|
|
510
|
+
})]
|
|
511
|
+
}, e.value + t);
|
|
512
|
+
})
|
|
513
|
+
}),
|
|
514
|
+
r && /* @__PURE__ */ m(Y, { children: r }),
|
|
515
|
+
a && !r && /* @__PURE__ */ m(J, { children: a })
|
|
516
|
+
]
|
|
517
|
+
});
|
|
518
|
+
}
|
|
519
|
+
return /* @__PURE__ */ h(q, {
|
|
520
|
+
className: "mb-4",
|
|
521
|
+
children: [/* @__PURE__ */ h("div", {
|
|
522
|
+
className: "flex items-center gap-3",
|
|
523
|
+
children: [/* @__PURE__ */ m(se, {
|
|
524
|
+
id: o,
|
|
525
|
+
name: s,
|
|
526
|
+
checked: typeof t == "boolean" ? t : !1,
|
|
527
|
+
onCheckedChange: (e) => n(!!e)
|
|
528
|
+
}), /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ h(Z, {
|
|
529
|
+
htmlFor: o,
|
|
530
|
+
className: "cursor-pointer font-medium text-sm",
|
|
531
|
+
children: [i || e.data.name, e.data.required && /* @__PURE__ */ m("span", {
|
|
532
|
+
className: "text-red-500",
|
|
533
|
+
children: "*"
|
|
534
|
+
})]
|
|
535
|
+
}), a && !r && /* @__PURE__ */ m(J, { children: a })] })]
|
|
536
|
+
}), r && /* @__PURE__ */ m(Y, { children: r })]
|
|
537
|
+
});
|
|
538
|
+
};
|
|
539
|
+
//#endregion
|
|
540
|
+
//#region src/shared/components/ui/calendar.tsx
|
|
541
|
+
function ze({ className: e, classNames: t, showOutsideDays: n = !0, captionLayout: r = "label", buttonVariant: i = "ghost", formatters: a, components: o, ...s }) {
|
|
542
|
+
let c = V();
|
|
543
|
+
return /* @__PURE__ */ m(ie, {
|
|
544
|
+
showOutsideDays: n,
|
|
545
|
+
className: W("group/calendar bg-background p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent", String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`, String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`, e),
|
|
546
|
+
captionLayout: r,
|
|
547
|
+
formatters: {
|
|
548
|
+
formatMonthDropdown: (e) => e.toLocaleString("default", { month: "short" }),
|
|
549
|
+
...a
|
|
550
|
+
},
|
|
551
|
+
classNames: {
|
|
552
|
+
button_next: W(G({ variant: i }), "size-(--cell-size) aria-disabled:opacity-50 p-0 select-none", c.button_next),
|
|
553
|
+
button_previous: W(G({ variant: i }), "size-(--cell-size) aria-disabled:opacity-50 p-0 select-none", c.button_previous),
|
|
554
|
+
caption_label: W("select-none font-medium", r === "label" ? "text-sm" : "rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-muted-foreground [&>svg]:size-3.5", c.caption_label),
|
|
555
|
+
day: W("relative w-full h-full p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md group/day aspect-square select-none", c.day),
|
|
556
|
+
disabled: W("text-muted-foreground opacity-50", c.disabled),
|
|
557
|
+
dropdown: W("absolute bg-popover inset-0 opacity-0", c.dropdown),
|
|
558
|
+
dropdown_root: W("relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md", c.dropdown_root),
|
|
559
|
+
dropdowns: W("w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5", c.dropdowns),
|
|
560
|
+
hidden: W("invisible", c.hidden),
|
|
561
|
+
month: W("flex flex-col w-full gap-4", c.month),
|
|
562
|
+
month_caption: W("flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)", c.month_caption),
|
|
563
|
+
months: W("flex gap-4 flex-col md:flex-row relative", c.months),
|
|
564
|
+
nav: W("flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between", c.nav),
|
|
565
|
+
outside: W("text-muted-foreground aria-selected:text-muted-foreground", c.outside),
|
|
566
|
+
range_end: W("rounded-r-md bg-accent", c.range_end),
|
|
567
|
+
range_middle: W("rounded-none", c.range_middle),
|
|
568
|
+
range_start: W("rounded-l-md bg-accent", c.range_start),
|
|
569
|
+
root: W("w-fit", c.root),
|
|
570
|
+
table: "w-full border-collapse",
|
|
571
|
+
today: W("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none", c.today),
|
|
572
|
+
week: W("flex w-full mt-2", c.week),
|
|
573
|
+
week_number: W("text-[0.8rem] select-none text-muted-foreground", c.week_number),
|
|
574
|
+
week_number_header: W("select-none w-(--cell-size)", c.week_number_header),
|
|
575
|
+
weekday: W("text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none", c.weekday),
|
|
576
|
+
weekdays: W("flex", c.weekdays),
|
|
577
|
+
...t
|
|
578
|
+
},
|
|
579
|
+
components: {
|
|
580
|
+
Chevron: ({ className: e, orientation: t, ...n }) => m(t === "left" ? y : t === "right" ? b : v, {
|
|
581
|
+
className: W("size-4", e),
|
|
582
|
+
...n
|
|
583
|
+
}),
|
|
584
|
+
DayButton: Be,
|
|
585
|
+
Root: ({ className: e, rootRef: t, ...n }) => /* @__PURE__ */ m("div", {
|
|
586
|
+
"data-slot": "calendar",
|
|
587
|
+
ref: t,
|
|
588
|
+
className: W(e),
|
|
589
|
+
...n
|
|
590
|
+
}),
|
|
591
|
+
WeekNumber: ({ children: e, ...t }) => /* @__PURE__ */ m("td", {
|
|
592
|
+
...t,
|
|
593
|
+
children: /* @__PURE__ */ m("div", {
|
|
594
|
+
className: "flex size-(--cell-size) items-center justify-center text-center",
|
|
595
|
+
children: e
|
|
596
|
+
})
|
|
597
|
+
}),
|
|
598
|
+
...o
|
|
599
|
+
},
|
|
600
|
+
...s
|
|
601
|
+
});
|
|
602
|
+
}
|
|
603
|
+
function Be({ className: e, day: t, modifiers: n, ...r }) {
|
|
604
|
+
let i = V(), a = E.useRef(null);
|
|
605
|
+
return E.useEffect(() => {
|
|
606
|
+
n.focused && a.current?.focus();
|
|
607
|
+
}, [n.focused]), /* @__PURE__ */ m(K, {
|
|
608
|
+
ref: a,
|
|
609
|
+
variant: "ghost",
|
|
610
|
+
size: "icon",
|
|
611
|
+
"data-day": t.date.toLocaleDateString(),
|
|
612
|
+
"data-selected-single": n.selected && !n.range_start && !n.range_end && !n.range_middle,
|
|
613
|
+
"data-range-start": n.range_start,
|
|
614
|
+
"data-range-end": n.range_end,
|
|
615
|
+
"data-range-middle": n.range_middle,
|
|
616
|
+
className: W("flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 font-normal leading-none data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-start=true]:rounded-l-md data-[range-end=true]:bg-primary data-[range-middle=true]:bg-accent data-[range-start=true]:bg-primary data-[selected-single=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:text-accent-foreground data-[range-start=true]:text-primary-foreground data-[selected-single=true]:text-primary-foreground group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-[3px] group-data-[focused=true]/day:ring-ring/50 dark:hover:text-accent-foreground [&>span]:text-xs [&>span]:opacity-70", i.day, e),
|
|
617
|
+
...r
|
|
618
|
+
});
|
|
619
|
+
}
|
|
620
|
+
//#endregion
|
|
621
|
+
//#region src/renderer/features/TreegeRenderer/web/components/inputs/DefaultDateInput.tsx
|
|
622
|
+
var Ve = ({ node: e, value: t, setValue: n, error: r, label: i, placeholder: a, helperText: o, id: s, name: c }) => {
|
|
623
|
+
let [l, u] = j(!1), f = d(), p = t ? new Date(t) : void 0;
|
|
624
|
+
return /* @__PURE__ */ h(q, {
|
|
625
|
+
className: "mb-4",
|
|
626
|
+
children: [
|
|
627
|
+
/* @__PURE__ */ h(Z, {
|
|
628
|
+
htmlFor: s,
|
|
629
|
+
children: [i || e.data.name, e.data.required && /* @__PURE__ */ m("span", {
|
|
630
|
+
className: "text-red-500",
|
|
631
|
+
children: "*"
|
|
632
|
+
})]
|
|
633
|
+
}),
|
|
634
|
+
/* @__PURE__ */ h(Q, {
|
|
635
|
+
open: l,
|
|
636
|
+
onOpenChange: u,
|
|
637
|
+
children: [/* @__PURE__ */ m(ce, {
|
|
638
|
+
asChild: !0,
|
|
639
|
+
children: /* @__PURE__ */ h(K, {
|
|
640
|
+
variant: "outline",
|
|
641
|
+
id: s,
|
|
642
|
+
name: c,
|
|
643
|
+
className: "w-full justify-between font-normal",
|
|
644
|
+
children: [p ? p.toLocaleDateString() : a || f("renderer.defaultInputs.selectDate"), /* @__PURE__ */ m(v, { className: "size-4" })]
|
|
645
|
+
})
|
|
646
|
+
}), /* @__PURE__ */ m($, {
|
|
647
|
+
className: "w-auto overflow-hidden p-0",
|
|
648
|
+
align: "start",
|
|
649
|
+
children: /* @__PURE__ */ m(ze, {
|
|
650
|
+
mode: "single",
|
|
651
|
+
selected: p,
|
|
652
|
+
captionLayout: "dropdown",
|
|
653
|
+
disabled: (t) => {
|
|
654
|
+
if (e.data.disablePast) {
|
|
655
|
+
let e = /* @__PURE__ */ new Date();
|
|
656
|
+
return e.setHours(0, 0, 0, 0), t < e;
|
|
657
|
+
}
|
|
658
|
+
return !1;
|
|
659
|
+
},
|
|
660
|
+
onSelect: (e) => {
|
|
661
|
+
n(e ? e.toISOString() : ""), u(!1);
|
|
662
|
+
}
|
|
663
|
+
})
|
|
664
|
+
})]
|
|
665
|
+
}),
|
|
666
|
+
r && /* @__PURE__ */ m(Y, { children: r }),
|
|
667
|
+
o && !r && /* @__PURE__ */ m(J, { children: o })
|
|
668
|
+
]
|
|
669
|
+
});
|
|
670
|
+
}, He = ({ node: e, value: t, setValue: n, error: r, label: i, helperText: a, id: o }) => {
|
|
671
|
+
let [s, c] = j(!1), l = d(), u = Array.isArray(t) ? t : [], f = u[0] ? new Date(u[0]) : void 0, p = u[1] ? new Date(u[1]) : void 0;
|
|
672
|
+
return /* @__PURE__ */ h(q, {
|
|
673
|
+
className: "mb-4",
|
|
674
|
+
children: [
|
|
675
|
+
/* @__PURE__ */ h(Z, {
|
|
676
|
+
htmlFor: o,
|
|
677
|
+
children: [i || e.data.name, e.data.required && /* @__PURE__ */ m("span", {
|
|
678
|
+
className: "text-red-500",
|
|
679
|
+
children: "*"
|
|
680
|
+
})]
|
|
681
|
+
}),
|
|
682
|
+
/* @__PURE__ */ h(Q, {
|
|
683
|
+
open: s,
|
|
684
|
+
onOpenChange: c,
|
|
685
|
+
children: [/* @__PURE__ */ m(ce, {
|
|
686
|
+
asChild: !0,
|
|
687
|
+
children: /* @__PURE__ */ h(K, {
|
|
688
|
+
id: o,
|
|
689
|
+
variant: "outline",
|
|
690
|
+
className: "w-full justify-between font-normal",
|
|
691
|
+
children: [f && p ? `${f.toLocaleDateString()} - ${p.toLocaleDateString()}` : f ? f.toLocaleDateString() : l("renderer.defaultInputs.selectDateRange"), /* @__PURE__ */ m(v, { className: "size-4" })]
|
|
692
|
+
})
|
|
693
|
+
}), /* @__PURE__ */ m($, {
|
|
694
|
+
className: "w-auto overflow-hidden p-0",
|
|
695
|
+
align: "start",
|
|
696
|
+
children: /* @__PURE__ */ m(ze, {
|
|
697
|
+
mode: "range",
|
|
698
|
+
selected: {
|
|
699
|
+
from: f,
|
|
700
|
+
to: p
|
|
701
|
+
},
|
|
702
|
+
captionLayout: "dropdown",
|
|
703
|
+
disabled: (t) => {
|
|
704
|
+
if (e.data.disablePast) {
|
|
705
|
+
let e = /* @__PURE__ */ new Date();
|
|
706
|
+
return e.setHours(0, 0, 0, 0), t < e;
|
|
707
|
+
}
|
|
708
|
+
return !1;
|
|
709
|
+
},
|
|
710
|
+
onSelect: (e) => {
|
|
711
|
+
n([e?.from ? e.from.toISOString() : void 0, e?.to ? e.to.toISOString() : void 0]);
|
|
712
|
+
},
|
|
713
|
+
numberOfMonths: 2
|
|
714
|
+
})
|
|
715
|
+
})]
|
|
716
|
+
}),
|
|
717
|
+
r && /* @__PURE__ */ m(Y, { children: r }),
|
|
718
|
+
a && !r && /* @__PURE__ */ m(J, { children: a })
|
|
719
|
+
]
|
|
720
|
+
});
|
|
721
|
+
}, Ue = ({ node: e, setValue: t, error: r, label: i, placeholder: a, helperText: o, name: s, id: c }) => /* @__PURE__ */ h(q, {
|
|
722
|
+
className: "mb-4",
|
|
723
|
+
children: [
|
|
724
|
+
/* @__PURE__ */ h(Z, {
|
|
725
|
+
htmlFor: c,
|
|
726
|
+
children: [i || e.data.name, e.data.required && /* @__PURE__ */ m("span", {
|
|
727
|
+
className: "text-red-500",
|
|
728
|
+
children: "*"
|
|
729
|
+
})]
|
|
730
|
+
}),
|
|
731
|
+
/* @__PURE__ */ m(X, {
|
|
732
|
+
type: "file",
|
|
733
|
+
name: s,
|
|
734
|
+
id: c,
|
|
735
|
+
onChange: async (r) => {
|
|
736
|
+
let { files: i } = r.target;
|
|
737
|
+
if (!i || i.length === 0) {
|
|
738
|
+
t(null);
|
|
739
|
+
return;
|
|
740
|
+
}
|
|
741
|
+
if (e.data.multiple) {
|
|
742
|
+
t(await n(Array.from(i)));
|
|
743
|
+
return;
|
|
744
|
+
}
|
|
745
|
+
t(await l(i[0]));
|
|
746
|
+
},
|
|
747
|
+
multiple: e.data.multiple,
|
|
748
|
+
placeholder: a
|
|
749
|
+
}),
|
|
750
|
+
r && /* @__PURE__ */ m(Y, { children: r }),
|
|
751
|
+
o && !r && /* @__PURE__ */ m(J, { children: o })
|
|
752
|
+
]
|
|
753
|
+
}), We = ({ value: e, name: t, id: n }) => /* @__PURE__ */ m(X, {
|
|
754
|
+
type: "hidden",
|
|
755
|
+
id: n,
|
|
756
|
+
name: t,
|
|
757
|
+
value: e ?? ""
|
|
758
|
+
});
|
|
759
|
+
//#endregion
|
|
760
|
+
//#region src/shared/components/ui/tooltip.tsx
|
|
761
|
+
function Ge({ delayDuration: e = 0, ...t }) {
|
|
762
|
+
return /* @__PURE__ */ m(H.Provider, {
|
|
763
|
+
"data-slot": "tooltip-provider",
|
|
764
|
+
delayDuration: e,
|
|
765
|
+
...t
|
|
766
|
+
});
|
|
767
|
+
}
|
|
768
|
+
function Ke({ ...e }) {
|
|
769
|
+
return /* @__PURE__ */ m(Ge, { children: /* @__PURE__ */ m(H.Root, {
|
|
770
|
+
"data-slot": "tooltip",
|
|
771
|
+
...e
|
|
772
|
+
}) });
|
|
773
|
+
}
|
|
774
|
+
function qe({ ...e }) {
|
|
775
|
+
return /* @__PURE__ */ m(H.Trigger, {
|
|
776
|
+
"data-slot": "tooltip-trigger",
|
|
777
|
+
...e
|
|
778
|
+
});
|
|
779
|
+
}
|
|
780
|
+
function Je({ className: e, sideOffset: t = 0, children: n, ...r }) {
|
|
781
|
+
return /* @__PURE__ */ m(H.Portal, { children: /* @__PURE__ */ h(H.Content, {
|
|
782
|
+
"data-slot": "tooltip-content",
|
|
783
|
+
sideOffset: t,
|
|
784
|
+
className: W("fade-in-0 zoom-in-95 data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in text-balance rounded-md bg-foreground px-3 py-1.5 text-background text-xs data-[state=closed]:animate-out", e),
|
|
785
|
+
...r,
|
|
786
|
+
children: [n, /* @__PURE__ */ m(H.Arrow, { className: "z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground" })]
|
|
787
|
+
}) });
|
|
788
|
+
}
|
|
789
|
+
//#endregion
|
|
790
|
+
//#region src/renderer/features/TreegeRenderer/web/components/inputs/DefaultHttpInput.tsx
|
|
791
|
+
var Ye = (e, t) => t ? t.split(".").reduce((e, t) => {
|
|
792
|
+
if (e == null) return;
|
|
793
|
+
let n = t.match(/^(\w+)\[(\d+)]$/);
|
|
794
|
+
if (n) {
|
|
795
|
+
let [, t, r] = n, i = e[t];
|
|
796
|
+
return Array.isArray(i) ? i[Number.parseInt(r, 10)] : i;
|
|
797
|
+
}
|
|
798
|
+
return e[t];
|
|
799
|
+
}, e) : e, Xe = (e) => {
|
|
800
|
+
let t = e.matchAll(/{{([\w-]+)}}/g);
|
|
801
|
+
return Array.from(t, (e) => e[1]);
|
|
802
|
+
}, Ze = (e, t) => Xe(e).every((e) => {
|
|
803
|
+
let n = t[e];
|
|
804
|
+
return n != null && n !== "";
|
|
805
|
+
}), Qe = (e, t, n = !1) => e.replace(/{{([\w-]+)}}/g, (e, r) => {
|
|
806
|
+
let i = t[r], a = i == null ? "" : String(i);
|
|
807
|
+
return n ? encodeURIComponent(a) : a;
|
|
808
|
+
}), $e = ({ node: t, value: n, setValue: i, error: o, label: s, placeholder: c, helperText: l, id: u, name: _ }) => {
|
|
809
|
+
let [v, y] = j(!1), [b, x] = j(null), [C, w] = j([]), [T, te] = j(""), [E, D] = j(!1), { formValues: M, inputNodes: N } = a(), P = d(), { httpConfig: F } = t.data, I = A(!1), re = A(""), L = A(F), R = A(M), z = A(N), B = A(i), ie = A(null), V = A(null), H = ne(() => F?.url ? Xe(F.url) : [], [F?.url]), U = H.length > 0, ae = ne(() => H.map((e) => `${e}:${String(M[e] ?? "")}`).join("|"), [H, M]), oe = ne(() => F?.url ? U ? Ze(F.url, M) : !0 : !1, [
|
|
810
|
+
F?.url,
|
|
811
|
+
U,
|
|
812
|
+
M
|
|
813
|
+
]), G = O(async (t) => {
|
|
814
|
+
V.current && V.current.abort();
|
|
815
|
+
let n = new AbortController();
|
|
816
|
+
V.current = n;
|
|
817
|
+
let i = L.current, a = R.current, o = B.current;
|
|
818
|
+
if (!i?.url) {
|
|
819
|
+
x(P("renderer.defaultHttpInput.noUrlConfigured")), V.current = null;
|
|
820
|
+
return;
|
|
821
|
+
}
|
|
822
|
+
if (i.url && !Ze(i.url, a)) {
|
|
823
|
+
V.current = null;
|
|
824
|
+
return;
|
|
825
|
+
}
|
|
826
|
+
y(!0), x(null);
|
|
827
|
+
try {
|
|
828
|
+
let s = Qe(i.url, a, !0), c = i.searchParam && t ? `${s}${s.includes("?") ? "&" : "?"}${i.searchParam}=${encodeURIComponent(t)}` : s, l = {};
|
|
829
|
+
i.headers?.forEach((e) => {
|
|
830
|
+
l[e.key] = Qe(e.value, a);
|
|
831
|
+
});
|
|
832
|
+
let u = [
|
|
833
|
+
"POST",
|
|
834
|
+
"PUT",
|
|
835
|
+
"PATCH"
|
|
836
|
+
].includes(i.method || "") ? i.sendAllFormValues ? JSON.stringify(e(a, z.current)) : i.body ? Qe(i.body, a) : void 0 : void 0, d = setTimeout(() => n.abort(), 3e4), f = await fetch(c, {
|
|
837
|
+
body: u || void 0,
|
|
838
|
+
headers: {
|
|
839
|
+
"Content-Type": "application/json",
|
|
840
|
+
...l
|
|
841
|
+
},
|
|
842
|
+
method: i.method || "GET",
|
|
843
|
+
signal: n.signal
|
|
844
|
+
});
|
|
845
|
+
if (clearTimeout(d), !f.ok) {
|
|
846
|
+
x(`HTTP Error ${f.status}: ${f.statusText}`), y(!1);
|
|
847
|
+
return;
|
|
848
|
+
}
|
|
849
|
+
let p = r(await f.json()), m = i.responsePath ? Ye(p, i.responsePath) : p;
|
|
850
|
+
if (i.responseMapping && Array.isArray(m)) {
|
|
851
|
+
let { valueField: e = "value", labelField: t = "label" } = i.responseMapping;
|
|
852
|
+
w(m.map((n) => ({
|
|
853
|
+
label: String(Ye(n, t) || ""),
|
|
854
|
+
value: String(Ye(n, e) || "")
|
|
855
|
+
})));
|
|
856
|
+
} else o(typeof m == "string" ? m : JSON.stringify(m));
|
|
857
|
+
} catch (e) {
|
|
858
|
+
if (e instanceof Error && e.name === "AbortError") return;
|
|
859
|
+
x(e instanceof Error ? e.message : P("renderer.defaultHttpInput.fetchFailed")), console.error("HTTP Input fetch error:", e);
|
|
860
|
+
} finally {
|
|
861
|
+
y(!1), V.current = null;
|
|
862
|
+
}
|
|
863
|
+
}, [P]);
|
|
864
|
+
if (k(() => {
|
|
865
|
+
L.current = F, R.current = M, z.current = N, B.current = i, ie.current = G;
|
|
866
|
+
}, [
|
|
867
|
+
F,
|
|
868
|
+
M,
|
|
869
|
+
N,
|
|
870
|
+
i,
|
|
871
|
+
G
|
|
872
|
+
]), k(() => () => {
|
|
873
|
+
V.current && V.current.abort();
|
|
874
|
+
}, []), k(() => {
|
|
875
|
+
if (I.current) return;
|
|
876
|
+
I.current = !0;
|
|
877
|
+
let e = L.current, t = R.current, n = ie.current, r = e?.url && Ze(e.url, t);
|
|
878
|
+
e?.fetchOnMount && r && n && (n(), e.url && (re.current = Xe(e.url).map((e) => `${e}:${String(t[e] ?? "")}`).join("|")));
|
|
879
|
+
}, []), k(() => {
|
|
880
|
+
if (!I.current || !U || re.current === ae || !oe) return;
|
|
881
|
+
let e = setTimeout(() => {
|
|
882
|
+
G(), re.current = ae;
|
|
883
|
+
}, 500);
|
|
884
|
+
return () => clearTimeout(e);
|
|
885
|
+
}, [
|
|
886
|
+
ae,
|
|
887
|
+
U,
|
|
888
|
+
oe,
|
|
889
|
+
G
|
|
890
|
+
]), k(() => {
|
|
891
|
+
if (!(F?.searchParam && T)) return;
|
|
892
|
+
let e = setTimeout(() => {
|
|
893
|
+
G(T);
|
|
894
|
+
}, 300);
|
|
895
|
+
return () => clearTimeout(e);
|
|
896
|
+
}, [
|
|
897
|
+
T,
|
|
898
|
+
F?.searchParam,
|
|
899
|
+
G
|
|
900
|
+
]), F?.responseMapping) {
|
|
901
|
+
let e = Array.isArray(n) ? n[0] : n, r = C.find((t) => t.value === e);
|
|
902
|
+
if (F.searchParam) {
|
|
903
|
+
let e = v && F?.showLoading ? /* @__PURE__ */ h("div", {
|
|
904
|
+
className: "flex items-center gap-2",
|
|
905
|
+
children: [/* @__PURE__ */ m(ee, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ m("span", {
|
|
906
|
+
className: "text-muted-foreground",
|
|
907
|
+
children: r?.label || c || P("renderer.defaultHttpInput.search")
|
|
908
|
+
})]
|
|
909
|
+
}) : r?.label || c || P("renderer.defaultHttpInput.search");
|
|
910
|
+
return /* @__PURE__ */ h(q, {
|
|
911
|
+
className: "mb-4",
|
|
912
|
+
children: [
|
|
913
|
+
/* @__PURE__ */ h(Z, { children: [s || t.data.name, t.data.required && /* @__PURE__ */ m("span", {
|
|
914
|
+
className: "text-red-500",
|
|
915
|
+
children: "*"
|
|
916
|
+
})] }),
|
|
917
|
+
/* @__PURE__ */ h(Q, {
|
|
918
|
+
open: E,
|
|
919
|
+
onOpenChange: D,
|
|
920
|
+
children: [/* @__PURE__ */ m(ce, {
|
|
921
|
+
asChild: !0,
|
|
922
|
+
children: /* @__PURE__ */ h(K, {
|
|
923
|
+
variant: "outline",
|
|
924
|
+
role: "combobox",
|
|
925
|
+
"aria-expanded": E,
|
|
926
|
+
className: "w-full justify-between",
|
|
927
|
+
children: [e, /* @__PURE__ */ m(S, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })]
|
|
928
|
+
})
|
|
929
|
+
}), /* @__PURE__ */ m($, {
|
|
930
|
+
className: "w-[300px] p-0",
|
|
931
|
+
align: "start",
|
|
932
|
+
children: /* @__PURE__ */ h(Oe, {
|
|
933
|
+
shouldFilter: !1,
|
|
934
|
+
children: [/* @__PURE__ */ m(ke, {
|
|
935
|
+
placeholder: P("renderer.defaultHttpInput.search"),
|
|
936
|
+
value: T,
|
|
937
|
+
onValueChange: (e) => {
|
|
938
|
+
te(e), x(null);
|
|
939
|
+
}
|
|
940
|
+
}), /* @__PURE__ */ h(Ae, { children: [
|
|
941
|
+
v && /* @__PURE__ */ m("div", {
|
|
942
|
+
className: "flex items-center justify-center p-4",
|
|
943
|
+
children: /* @__PURE__ */ m(ee, { className: "h-4 w-4 animate-spin" })
|
|
944
|
+
}),
|
|
945
|
+
!v && b && /* @__PURE__ */ h("div", {
|
|
946
|
+
className: "p-4 text-destructive text-sm",
|
|
947
|
+
children: [/* @__PURE__ */ m("div", { children: b }), /* @__PURE__ */ m("button", {
|
|
948
|
+
type: "button",
|
|
949
|
+
onClick: () => G(T),
|
|
950
|
+
className: "mt-2 block text-primary hover:underline",
|
|
951
|
+
children: P("renderer.defaultHttpInput.retry")
|
|
952
|
+
})]
|
|
953
|
+
}),
|
|
954
|
+
!(v || b) && /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m(je, { children: P("renderer.defaultHttpInput.noResults") }), /* @__PURE__ */ m(Me, { children: C.map((e) => /* @__PURE__ */ h(Ne, {
|
|
955
|
+
value: e.value,
|
|
956
|
+
onSelect: () => {
|
|
957
|
+
i(e.value), D(!1);
|
|
958
|
+
},
|
|
959
|
+
children: [/* @__PURE__ */ m(g, { className: W("mr-2 h-4 w-4", n === e.value ? "opacity-100" : "opacity-0") }), e.label]
|
|
960
|
+
}, e.value)) })] })
|
|
961
|
+
] })]
|
|
962
|
+
})
|
|
963
|
+
})]
|
|
964
|
+
}),
|
|
965
|
+
o && /* @__PURE__ */ m(Y, { children: o }),
|
|
966
|
+
l && !o && /* @__PURE__ */ m(J, { children: l })
|
|
967
|
+
]
|
|
968
|
+
});
|
|
969
|
+
}
|
|
970
|
+
let a = v && F?.showLoading, d = H.filter((e) => {
|
|
971
|
+
let t = M[e];
|
|
972
|
+
return t == null || t === "";
|
|
973
|
+
}), y = d.map((e) => f(e, N) || e), w = C.length === 0 && !a ? b || (d.length > 0 ? `${P("renderer.defaultHttpInput.waitingForRequiredFields")}: ${y.join(", ")}` : P("renderer.defaultHttpInput.noDataAvailable")) : void 0, O = /* @__PURE__ */ h(le, {
|
|
974
|
+
value: Array.isArray(n) ? n[0] ?? "" : n ?? "",
|
|
975
|
+
onValueChange: (e) => i(e),
|
|
976
|
+
disabled: a || C.length === 0,
|
|
977
|
+
name: _,
|
|
978
|
+
children: [/* @__PURE__ */ h(fe, {
|
|
979
|
+
id: u,
|
|
980
|
+
name: _,
|
|
981
|
+
className: "w-full",
|
|
982
|
+
children: [a && /* @__PURE__ */ m(ee, { className: "mr-2 h-4 w-4 animate-spin" }), /* @__PURE__ */ m(de, { placeholder: c || P("renderer.defaultHttpInput.selectOption") })]
|
|
983
|
+
}), /* @__PURE__ */ m(pe, { children: /* @__PURE__ */ m(ue, { children: C.map((e, t) => /* @__PURE__ */ m(he, {
|
|
984
|
+
value: e.value,
|
|
985
|
+
children: e.label
|
|
986
|
+
}, e.value + t)) }) })]
|
|
987
|
+
});
|
|
988
|
+
return /* @__PURE__ */ h(q, {
|
|
989
|
+
className: "mb-4",
|
|
990
|
+
children: [
|
|
991
|
+
/* @__PURE__ */ h(Z, {
|
|
992
|
+
htmlFor: u,
|
|
993
|
+
children: [s || t.data.name, t.data.required && /* @__PURE__ */ m("span", {
|
|
994
|
+
className: "text-red-500",
|
|
995
|
+
children: "*"
|
|
996
|
+
})]
|
|
997
|
+
}),
|
|
998
|
+
w ? /* @__PURE__ */ m(Ge, { children: /* @__PURE__ */ h(Ke, { children: [/* @__PURE__ */ m(qe, {
|
|
999
|
+
asChild: !0,
|
|
1000
|
+
children: /* @__PURE__ */ m("div", {
|
|
1001
|
+
className: "w-full",
|
|
1002
|
+
children: O
|
|
1003
|
+
})
|
|
1004
|
+
}), /* @__PURE__ */ m(Je, { children: /* @__PURE__ */ m("p", { children: w }) })] }) }) : O,
|
|
1005
|
+
o && /* @__PURE__ */ m(Y, { children: o }),
|
|
1006
|
+
l && !o && /* @__PURE__ */ m(J, { children: l })
|
|
1007
|
+
]
|
|
1008
|
+
});
|
|
1009
|
+
}
|
|
1010
|
+
return /* @__PURE__ */ h(q, {
|
|
1011
|
+
className: "mb-4",
|
|
1012
|
+
children: [
|
|
1013
|
+
/* @__PURE__ */ h(Z, {
|
|
1014
|
+
htmlFor: u,
|
|
1015
|
+
children: [s || t.data.name, t.data.required && /* @__PURE__ */ m("span", {
|
|
1016
|
+
className: "text-red-500",
|
|
1017
|
+
children: "*"
|
|
1018
|
+
})]
|
|
1019
|
+
}),
|
|
1020
|
+
/* @__PURE__ */ m(X, {
|
|
1021
|
+
type: "text",
|
|
1022
|
+
name: _,
|
|
1023
|
+
id: u,
|
|
1024
|
+
value: typeof n == "string" ? n : JSON.stringify(n),
|
|
1025
|
+
readOnly: !0,
|
|
1026
|
+
disabled: !0
|
|
1027
|
+
}),
|
|
1028
|
+
o && /* @__PURE__ */ m(Y, { children: o }),
|
|
1029
|
+
l && !o && /* @__PURE__ */ m(J, { children: l })
|
|
1030
|
+
]
|
|
1031
|
+
});
|
|
1032
|
+
}, et = ({ node: e, value: t, setValue: n, error: r, label: i, placeholder: a, helperText: o, name: s, id: c }) => /* @__PURE__ */ h(q, {
|
|
1033
|
+
className: "mb-4",
|
|
1034
|
+
children: [
|
|
1035
|
+
/* @__PURE__ */ h(Z, {
|
|
1036
|
+
htmlFor: c,
|
|
1037
|
+
children: [i || e.data.name, e.data.required && /* @__PURE__ */ m("span", {
|
|
1038
|
+
className: "text-red-500",
|
|
1039
|
+
children: "*"
|
|
1040
|
+
})]
|
|
1041
|
+
}),
|
|
1042
|
+
/* @__PURE__ */ m(X, {
|
|
1043
|
+
id: c,
|
|
1044
|
+
type: "number",
|
|
1045
|
+
name: s,
|
|
1046
|
+
value: t ?? "",
|
|
1047
|
+
onChange: (e) => n(e.target.value === "" ? null : Number(e.target.value)),
|
|
1048
|
+
placeholder: a
|
|
1049
|
+
}),
|
|
1050
|
+
r && /* @__PURE__ */ m(Y, { children: r }),
|
|
1051
|
+
o && !r && /* @__PURE__ */ m(J, { children: o })
|
|
1052
|
+
]
|
|
1053
|
+
}), tt = ({ node: e, value: t, setValue: n, error: r, label: i, placeholder: a, helperText: o, name: s, id: c }) => /* @__PURE__ */ h(q, {
|
|
1054
|
+
className: "mb-4",
|
|
1055
|
+
children: [
|
|
1056
|
+
/* @__PURE__ */ h(Z, {
|
|
1057
|
+
htmlFor: c,
|
|
1058
|
+
children: [i || e.data.name, e.data.required && /* @__PURE__ */ m("span", {
|
|
1059
|
+
className: "text-red-500",
|
|
1060
|
+
children: "*"
|
|
1061
|
+
})]
|
|
1062
|
+
}),
|
|
1063
|
+
/* @__PURE__ */ m(X, {
|
|
1064
|
+
id: c,
|
|
1065
|
+
name: s,
|
|
1066
|
+
type: "password",
|
|
1067
|
+
value: t ?? "",
|
|
1068
|
+
onChange: (e) => n(e.target.value),
|
|
1069
|
+
placeholder: a,
|
|
1070
|
+
autoComplete: "new-password"
|
|
1071
|
+
}),
|
|
1072
|
+
r && /* @__PURE__ */ m(Y, { children: r }),
|
|
1073
|
+
o && !r && /* @__PURE__ */ m(J, { children: o })
|
|
1074
|
+
]
|
|
1075
|
+
});
|
|
1076
|
+
//#endregion
|
|
1077
|
+
//#region src/shared/components/ui/radio-group.tsx
|
|
1078
|
+
function nt({ className: e, ...t }) {
|
|
1079
|
+
return /* @__PURE__ */ m(U.Root, {
|
|
1080
|
+
"data-slot": "radio-group",
|
|
1081
|
+
className: W("grid gap-3", e),
|
|
1082
|
+
...t
|
|
1083
|
+
});
|
|
1084
|
+
}
|
|
1085
|
+
function rt({ className: e, ...t }) {
|
|
1086
|
+
return /* @__PURE__ */ m(U.Item, {
|
|
1087
|
+
"data-slot": "radio-group-item",
|
|
1088
|
+
className: W("aspect-square size-4 shrink-0 rounded-full border border-input text-primary shadow-xs outline-none transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:bg-input/30 dark:aria-invalid:ring-destructive/40", e),
|
|
1089
|
+
...t,
|
|
1090
|
+
children: /* @__PURE__ */ m(U.Indicator, {
|
|
1091
|
+
"data-slot": "radio-group-indicator",
|
|
1092
|
+
className: "relative flex items-center justify-center",
|
|
1093
|
+
children: /* @__PURE__ */ m(C, { className: "-translate-x-1/2 -translate-y-1/2 absolute top-1/2 left-1/2 size-2 fill-primary" })
|
|
1094
|
+
})
|
|
1095
|
+
});
|
|
1096
|
+
}
|
|
1097
|
+
//#endregion
|
|
1098
|
+
//#region src/renderer/features/TreegeRenderer/web/components/inputs/DefaultRadioInput.tsx
|
|
1099
|
+
var it = ({ node: e, value: t, setValue: n, error: r, label: i, helperText: a, id: o, name: s }) => {
|
|
1100
|
+
let c = d(), l = t ? String(t) : "", u = e.data.variant === "card";
|
|
1101
|
+
return /* @__PURE__ */ h(q, {
|
|
1102
|
+
className: "mb-4",
|
|
1103
|
+
children: [
|
|
1104
|
+
/* @__PURE__ */ h(Z, {
|
|
1105
|
+
className: "mb-1",
|
|
1106
|
+
htmlFor: o,
|
|
1107
|
+
children: [i || e.data.name, e.data.required && /* @__PURE__ */ m("span", {
|
|
1108
|
+
className: "text-red-500",
|
|
1109
|
+
children: "*"
|
|
1110
|
+
})]
|
|
1111
|
+
}),
|
|
1112
|
+
/* @__PURE__ */ m(nt, {
|
|
1113
|
+
value: l,
|
|
1114
|
+
onValueChange: (e) => n(e),
|
|
1115
|
+
id: o,
|
|
1116
|
+
name: s,
|
|
1117
|
+
className: u ? "flex flex-col gap-2" : void 0,
|
|
1118
|
+
children: e.data.options?.map((e, t) => {
|
|
1119
|
+
let n = `${o}-${e.value}`, r = c(e.label) || e.value, i = c(e.description), a = l === String(e.value);
|
|
1120
|
+
return u ? /* @__PURE__ */ h(Z, {
|
|
1121
|
+
htmlFor: n,
|
|
1122
|
+
className: W("flex cursor-pointer items-start gap-3 rounded-md border p-3 transition-colors", "hover:border-primary/50", a && "border-primary bg-primary/5", e.disabled && "pointer-events-none opacity-50"),
|
|
1123
|
+
children: [
|
|
1124
|
+
/* @__PURE__ */ m(rt, {
|
|
1125
|
+
value: String(e.value),
|
|
1126
|
+
id: n,
|
|
1127
|
+
disabled: e.disabled,
|
|
1128
|
+
className: "mt-1"
|
|
1129
|
+
}),
|
|
1130
|
+
e.image && /* @__PURE__ */ m("img", {
|
|
1131
|
+
src: e.image,
|
|
1132
|
+
alt: "",
|
|
1133
|
+
className: "h-10 w-10 shrink-0 rounded object-cover"
|
|
1134
|
+
}),
|
|
1135
|
+
/* @__PURE__ */ h("div", {
|
|
1136
|
+
className: "flex min-w-0 flex-col",
|
|
1137
|
+
children: [/* @__PURE__ */ m("span", {
|
|
1138
|
+
className: "font-medium text-sm",
|
|
1139
|
+
children: r
|
|
1140
|
+
}), i && /* @__PURE__ */ m("span", {
|
|
1141
|
+
className: "text-muted-foreground text-xs",
|
|
1142
|
+
children: i
|
|
1143
|
+
})]
|
|
1144
|
+
})
|
|
1145
|
+
]
|
|
1146
|
+
}, e.value + t) : /* @__PURE__ */ h("div", {
|
|
1147
|
+
className: "flex items-start space-x-2",
|
|
1148
|
+
children: [
|
|
1149
|
+
/* @__PURE__ */ m(rt, {
|
|
1150
|
+
value: String(e.value),
|
|
1151
|
+
id: n,
|
|
1152
|
+
disabled: e.disabled,
|
|
1153
|
+
className: "mt-0.5"
|
|
1154
|
+
}),
|
|
1155
|
+
e.image && /* @__PURE__ */ m("img", {
|
|
1156
|
+
src: e.image,
|
|
1157
|
+
alt: "",
|
|
1158
|
+
className: "h-8 w-8 rounded object-cover"
|
|
1159
|
+
}),
|
|
1160
|
+
/* @__PURE__ */ h("div", {
|
|
1161
|
+
className: "flex flex-col",
|
|
1162
|
+
children: [/* @__PURE__ */ m(Z, {
|
|
1163
|
+
htmlFor: n,
|
|
1164
|
+
className: "cursor-pointer font-normal text-sm",
|
|
1165
|
+
children: r
|
|
1166
|
+
}), i && /* @__PURE__ */ m("span", {
|
|
1167
|
+
className: "text-muted-foreground text-xs",
|
|
1168
|
+
children: i
|
|
1169
|
+
})]
|
|
1170
|
+
})
|
|
1171
|
+
]
|
|
1172
|
+
}, e.value + t);
|
|
1173
|
+
})
|
|
1174
|
+
}),
|
|
1175
|
+
r && /* @__PURE__ */ m(Y, { children: r }),
|
|
1176
|
+
a && !r && /* @__PURE__ */ m(J, { children: a })
|
|
1177
|
+
]
|
|
1178
|
+
});
|
|
1179
|
+
}, at = ({ node: e, value: t, setValue: n, error: r, label: i, placeholder: a, helperText: o, name: s, id: c }) => {
|
|
1180
|
+
let l = d(), u = t ? String(t) : "";
|
|
1181
|
+
return /* @__PURE__ */ h(q, {
|
|
1182
|
+
className: "mb-4",
|
|
1183
|
+
children: [
|
|
1184
|
+
/* @__PURE__ */ h(Z, {
|
|
1185
|
+
htmlFor: c,
|
|
1186
|
+
children: [i || e.data.name, e.data.required && /* @__PURE__ */ m("span", {
|
|
1187
|
+
className: "text-red-500",
|
|
1188
|
+
children: "*"
|
|
1189
|
+
})]
|
|
1190
|
+
}),
|
|
1191
|
+
/* @__PURE__ */ h(le, {
|
|
1192
|
+
name: s,
|
|
1193
|
+
value: u,
|
|
1194
|
+
onValueChange: (e) => n(e),
|
|
1195
|
+
children: [/* @__PURE__ */ m(fe, {
|
|
1196
|
+
id: c,
|
|
1197
|
+
name: s,
|
|
1198
|
+
className: "w-full",
|
|
1199
|
+
children: /* @__PURE__ */ m(de, { placeholder: a || l("renderer.defaultSelectInput.selectOption") })
|
|
1200
|
+
}), /* @__PURE__ */ m(pe, { children: /* @__PURE__ */ m(ue, { children: e.data.options?.map((e, t) => /* @__PURE__ */ m(he, {
|
|
1201
|
+
value: String(e.value),
|
|
1202
|
+
disabled: e.disabled,
|
|
1203
|
+
children: l(e.label) ? l(e.label) : e.value
|
|
1204
|
+
}, `${e.value}-${t}`)) }) })]
|
|
1205
|
+
}),
|
|
1206
|
+
r && /* @__PURE__ */ m(Y, { children: r }),
|
|
1207
|
+
o && !r && /* @__PURE__ */ m(J, { children: o })
|
|
1208
|
+
]
|
|
1209
|
+
});
|
|
1210
|
+
}, ot = ({ children: e, onSubmit: t }) => /* @__PURE__ */ m("form", {
|
|
1211
|
+
onSubmit: t,
|
|
1212
|
+
className: "mx-auto max-w-2xl gap-y-3",
|
|
1213
|
+
children: e
|
|
1214
|
+
}), st = ({ node: e, children: t }) => {
|
|
1215
|
+
let n = d()(e.data.label);
|
|
1216
|
+
return /* @__PURE__ */ h("section", {
|
|
1217
|
+
className: "mb-6 rounded-lg border p-4",
|
|
1218
|
+
children: [n && /* @__PURE__ */ m("h3", {
|
|
1219
|
+
className: "mb-4 font-semibold text-lg",
|
|
1220
|
+
children: n
|
|
1221
|
+
}), t]
|
|
1222
|
+
});
|
|
1223
|
+
}, ct = D(({ label: e, id: t, disabled: n, onBlur: r, onClick: i, onFocus: a, onPointerDown: o, onPointerLeave: s, onPointerMove: c, ...l }, u) => {
|
|
1224
|
+
let f = d();
|
|
1225
|
+
return /* @__PURE__ */ m("button", {
|
|
1226
|
+
ref: u,
|
|
1227
|
+
id: t,
|
|
1228
|
+
onBlur: r,
|
|
1229
|
+
onClick: i,
|
|
1230
|
+
onFocus: a,
|
|
1231
|
+
onPointerDown: o,
|
|
1232
|
+
disabled: n,
|
|
1233
|
+
onPointerLeave: s,
|
|
1234
|
+
onPointerMove: c,
|
|
1235
|
+
type: "submit",
|
|
1236
|
+
className: "mt-4 rounded-md bg-blue-500 px-4 py-2 font-medium text-white transition-colors hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
1237
|
+
...l,
|
|
1238
|
+
children: e || f("renderer.defaultSubmitButton.submit")
|
|
1239
|
+
});
|
|
1240
|
+
});
|
|
1241
|
+
//#endregion
|
|
1242
|
+
//#region src/shared/components/ui/separator.tsx
|
|
1243
|
+
function lt({ className: e, orientation: t = "horizontal", decorative: n = !0, ...r }) {
|
|
1244
|
+
return /* @__PURE__ */ m(ae.Root, {
|
|
1245
|
+
"data-slot": "separator",
|
|
1246
|
+
decorative: n,
|
|
1247
|
+
orientation: t,
|
|
1248
|
+
className: W("shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=vertical]:h-full data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px", e),
|
|
1249
|
+
...r
|
|
1250
|
+
});
|
|
1251
|
+
}
|
|
1252
|
+
//#endregion
|
|
1253
|
+
//#region src/renderer/features/TreegeRenderer/web/components/DefaultUI.tsx
|
|
1254
|
+
var ut = ({ node: e }) => {
|
|
1255
|
+
let t = d()(e.data?.label);
|
|
1256
|
+
return t ? /* @__PURE__ */ h("div", {
|
|
1257
|
+
className: "flex items-center gap-x-3",
|
|
1258
|
+
children: [
|
|
1259
|
+
/* @__PURE__ */ m(lt, { className: "my-8 flex-1" }),
|
|
1260
|
+
/* @__PURE__ */ m("h4", {
|
|
1261
|
+
className: "font-semibold text-sm",
|
|
1262
|
+
children: t
|
|
1263
|
+
}),
|
|
1264
|
+
/* @__PURE__ */ m(lt, { className: "my-8 flex-1" })
|
|
1265
|
+
]
|
|
1266
|
+
}) : /* @__PURE__ */ m(lt, { className: "my-8" });
|
|
1267
|
+
}, dt = ({ node: e }) => {
|
|
1268
|
+
let { edges: n } = a(), r = d();
|
|
1269
|
+
return /* @__PURE__ */ m("h2", {
|
|
1270
|
+
className: W("mb-5 font-bold text-2xl", !t(e.id, n) && "mt-10"),
|
|
1271
|
+
children: r(e.data?.label)
|
|
1272
|
+
});
|
|
1273
|
+
}, ft = {
|
|
1274
|
+
divider: ut,
|
|
1275
|
+
title: dt
|
|
1276
|
+
}, pt = ({ children: e, missingFields: t = [] }) => {
|
|
1277
|
+
let n = t.length > 0, r = d();
|
|
1278
|
+
return n ? /* @__PURE__ */ m(Ge, { children: /* @__PURE__ */ h(Ke, { children: [/* @__PURE__ */ m(qe, {
|
|
1279
|
+
asChild: !0,
|
|
1280
|
+
children: e
|
|
1281
|
+
}), /* @__PURE__ */ m(Je, { children: /* @__PURE__ */ h("div", {
|
|
1282
|
+
className: "space-y-1",
|
|
1283
|
+
children: [/* @__PURE__ */ h("p", {
|
|
1284
|
+
className: "font-semibold",
|
|
1285
|
+
children: [r("renderer.defaultSubmitButton.requiredFieldsMissing"), ":"]
|
|
1286
|
+
}), /* @__PURE__ */ m("ul", {
|
|
1287
|
+
className: "list-inside list-disc",
|
|
1288
|
+
children: t.map((e, t) => /* @__PURE__ */ m("li", { children: e }, t))
|
|
1289
|
+
})]
|
|
1290
|
+
}) })] }) }) : e;
|
|
1291
|
+
}, mt = ({ components: e, className: t, flows: n, googleApiKey: r, language: a, onChange: o, onSubmit: l, theme: d, validate: f, validationMode: p, initialValues: g = {} }) => {
|
|
1292
|
+
let { canSubmit: _, clearSubmitMessage: v, config: y, firstErrorFieldId: b, formErrors: x, formValues: S, handleSubmit: C, inputNodes: ee, isSubmitting: w, mergedFlow: T, missingRequiredFields: te, setFieldValue: E, submitMessage: D, t: k, visibleNodes: ne, visibleRootNodes: A } = i({
|
|
1293
|
+
components: e,
|
|
1294
|
+
flows: n,
|
|
1295
|
+
googleApiKey: r,
|
|
1296
|
+
initialValues: g,
|
|
1297
|
+
language: a,
|
|
1298
|
+
onChange: o,
|
|
1299
|
+
onSubmit: l,
|
|
1300
|
+
theme: d,
|
|
1301
|
+
validate: f,
|
|
1302
|
+
validationMode: p
|
|
1303
|
+
}), { FormWrapper: j, SubmitButton: M, SubmitButtonWrapper: N, renderNode: P } = c({
|
|
1304
|
+
config: y,
|
|
1305
|
+
DefaultFormWrapper: ot,
|
|
1306
|
+
DefaultGroup: st,
|
|
1307
|
+
DefaultSubmitButton: ct,
|
|
1308
|
+
DefaultSubmitButtonWrapper: pt,
|
|
1309
|
+
defaultInputRenderers: Ct,
|
|
1310
|
+
defaultUI: ft,
|
|
1311
|
+
formErrors: x,
|
|
1312
|
+
formValues: S,
|
|
1313
|
+
missingRequiredFields: te,
|
|
1314
|
+
setFieldValue: E,
|
|
1315
|
+
visibleNodes: ne
|
|
1316
|
+
}), F = O(async (e) => {
|
|
1317
|
+
e.preventDefault(), !await C() && b && document.getElementById(b)?.focus();
|
|
1318
|
+
}, [C, b]);
|
|
1319
|
+
return /* @__PURE__ */ m("div", {
|
|
1320
|
+
className: W("treege", t),
|
|
1321
|
+
children: /* @__PURE__ */ m(u, {
|
|
1322
|
+
theme: y.theme,
|
|
1323
|
+
storageKey: "treege-renderer-theme",
|
|
1324
|
+
children: /* @__PURE__ */ h(s, {
|
|
1325
|
+
value: {
|
|
1326
|
+
flows: T,
|
|
1327
|
+
formErrors: x,
|
|
1328
|
+
formValues: S,
|
|
1329
|
+
googleApiKey: y.googleApiKey,
|
|
1330
|
+
inputNodes: ee,
|
|
1331
|
+
language: y.language,
|
|
1332
|
+
setFieldValue: E
|
|
1333
|
+
},
|
|
1334
|
+
children: [/* @__PURE__ */ h(j, {
|
|
1335
|
+
onSubmit: F,
|
|
1336
|
+
children: [
|
|
1337
|
+
A.map((e) => P(e)),
|
|
1338
|
+
_ && /* @__PURE__ */ m(N, {
|
|
1339
|
+
missingFields: te,
|
|
1340
|
+
children: /* @__PURE__ */ m(M, {
|
|
1341
|
+
label: k("renderer.defaultSubmitButton.submit"),
|
|
1342
|
+
disabled: w
|
|
1343
|
+
})
|
|
1344
|
+
}),
|
|
1345
|
+
/* @__PURE__ */ m("p", {
|
|
1346
|
+
className: "py-2 text-muted-foreground text-xs",
|
|
1347
|
+
children: "Powered by Treege"
|
|
1348
|
+
})
|
|
1349
|
+
]
|
|
1350
|
+
}), D && /* @__PURE__ */ m("div", {
|
|
1351
|
+
className: `my-4 rounded-md p-4 ${D.type === "success" ? "bg-green-50 text-green-800 dark:bg-green-900/20 dark:text-green-300" : "bg-red-50 text-red-800 dark:bg-red-900/20 dark:text-red-300"}`,
|
|
1352
|
+
role: "alert",
|
|
1353
|
+
children: /* @__PURE__ */ h("div", {
|
|
1354
|
+
className: "flex items-center justify-between",
|
|
1355
|
+
children: [/* @__PURE__ */ m("p", {
|
|
1356
|
+
className: "font-medium text-sm",
|
|
1357
|
+
children: D.message
|
|
1358
|
+
}), /* @__PURE__ */ m("button", {
|
|
1359
|
+
type: "button",
|
|
1360
|
+
onClick: v,
|
|
1361
|
+
className: "ml-4 font-medium text-sm underline hover:no-underline focus:outline-none",
|
|
1362
|
+
children: k("common.close")
|
|
1363
|
+
})]
|
|
1364
|
+
})
|
|
1365
|
+
})]
|
|
1366
|
+
})
|
|
1367
|
+
})
|
|
1368
|
+
});
|
|
1369
|
+
}, ht = ({ missingRequiredFields: e, isSubmitting: t, label: n }) => {
|
|
1370
|
+
let r = o(), i = r?.components?.submitButton, a = r?.components?.submitButtonWrapper;
|
|
1371
|
+
return /* @__PURE__ */ m(a || pt, {
|
|
1372
|
+
missingFields: e,
|
|
1373
|
+
children: /* @__PURE__ */ m(i || ct, {
|
|
1374
|
+
label: n,
|
|
1375
|
+
disabled: t
|
|
1376
|
+
})
|
|
1377
|
+
});
|
|
1378
|
+
};
|
|
1379
|
+
//#endregion
|
|
1380
|
+
//#region src/shared/components/ui/switch.tsx
|
|
1381
|
+
function gt({ className: e, ...t }) {
|
|
1382
|
+
return /* @__PURE__ */ m(oe.Root, {
|
|
1383
|
+
"data-slot": "switch",
|
|
1384
|
+
className: W("peer inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs outline-none transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:data-[state=unchecked]:bg-input/80", e),
|
|
1385
|
+
...t,
|
|
1386
|
+
children: /* @__PURE__ */ m(oe.Thumb, {
|
|
1387
|
+
"data-slot": "switch-thumb",
|
|
1388
|
+
className: W("pointer-events-none block size-4 rounded-full bg-background ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0 dark:data-[state=checked]:bg-primary-foreground dark:data-[state=unchecked]:bg-foreground")
|
|
1389
|
+
})
|
|
1390
|
+
});
|
|
1391
|
+
}
|
|
1392
|
+
//#endregion
|
|
1393
|
+
//#region src/renderer/features/TreegeRenderer/web/components/inputs/DefaultSwitchInput.tsx
|
|
1394
|
+
var _t = ({ node: e, value: t, setValue: n, error: r, label: i, helperText: a, name: o, id: s }) => /* @__PURE__ */ h(q, {
|
|
1395
|
+
className: "mb-4",
|
|
1396
|
+
children: [
|
|
1397
|
+
/* @__PURE__ */ h(Z, {
|
|
1398
|
+
htmlFor: s,
|
|
1399
|
+
children: [i || e.data.name, e.data.required && /* @__PURE__ */ m("span", {
|
|
1400
|
+
className: "text-red-500",
|
|
1401
|
+
children: "*"
|
|
1402
|
+
})]
|
|
1403
|
+
}),
|
|
1404
|
+
/* @__PURE__ */ m(gt, {
|
|
1405
|
+
id: s,
|
|
1406
|
+
name: o,
|
|
1407
|
+
checked: t,
|
|
1408
|
+
onCheckedChange: n
|
|
1409
|
+
}),
|
|
1410
|
+
a && !r && /* @__PURE__ */ m(J, { children: a }),
|
|
1411
|
+
r && /* @__PURE__ */ m(Y, { children: r })
|
|
1412
|
+
]
|
|
1413
|
+
});
|
|
1414
|
+
//#endregion
|
|
1415
|
+
//#region src/shared/components/ui/textarea.tsx
|
|
1416
|
+
function vt({ className: e, ...t }) {
|
|
1417
|
+
return /* @__PURE__ */ m("textarea", {
|
|
1418
|
+
"data-slot": "textarea",
|
|
1419
|
+
className: W("field-sizing-content flex min-h-16 w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs outline-none transition-[color,box-shadow] placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:ring-destructive/40", e),
|
|
1420
|
+
...t
|
|
1421
|
+
});
|
|
1422
|
+
}
|
|
1423
|
+
//#endregion
|
|
1424
|
+
//#region src/renderer/features/TreegeRenderer/web/components/inputs/DefaultTextAreaInput.tsx
|
|
1425
|
+
var yt = ({ node: e, value: t, setValue: n, error: r, label: i, placeholder: a, helperText: o, name: s, id: c }) => /* @__PURE__ */ h(q, {
|
|
1426
|
+
className: "mb-4",
|
|
1427
|
+
children: [
|
|
1428
|
+
/* @__PURE__ */ h(Z, {
|
|
1429
|
+
htmlFor: c,
|
|
1430
|
+
children: [i || e.data.name, e.data.required && /* @__PURE__ */ m("span", {
|
|
1431
|
+
className: "text-red-500",
|
|
1432
|
+
children: "*"
|
|
1433
|
+
})]
|
|
1434
|
+
}),
|
|
1435
|
+
/* @__PURE__ */ m(vt, {
|
|
1436
|
+
id: c,
|
|
1437
|
+
name: s,
|
|
1438
|
+
value: t ?? "",
|
|
1439
|
+
onChange: (e) => n(e.target.value),
|
|
1440
|
+
placeholder: a,
|
|
1441
|
+
className: "w-full rounded-md border px-3 py-2",
|
|
1442
|
+
rows: 4
|
|
1443
|
+
}),
|
|
1444
|
+
r && /* @__PURE__ */ m(Y, { children: r }),
|
|
1445
|
+
o && !r && /* @__PURE__ */ m(J, { children: o })
|
|
1446
|
+
]
|
|
1447
|
+
}), bt = ({ node: e, value: t, setValue: n, error: r, label: i, placeholder: a, helperText: o, name: s, id: c }) => /* @__PURE__ */ h(q, {
|
|
1448
|
+
className: "mb-4",
|
|
1449
|
+
children: [
|
|
1450
|
+
/* @__PURE__ */ h(Z, {
|
|
1451
|
+
htmlFor: c,
|
|
1452
|
+
children: [i || e.data.name, e.data.required && /* @__PURE__ */ m("span", {
|
|
1453
|
+
className: "text-red-500",
|
|
1454
|
+
children: "*"
|
|
1455
|
+
})]
|
|
1456
|
+
}),
|
|
1457
|
+
/* @__PURE__ */ m(X, {
|
|
1458
|
+
type: "text",
|
|
1459
|
+
id: c,
|
|
1460
|
+
name: s,
|
|
1461
|
+
value: t ?? "",
|
|
1462
|
+
onChange: (e) => n(e.target.value),
|
|
1463
|
+
placeholder: a
|
|
1464
|
+
}),
|
|
1465
|
+
r && /* @__PURE__ */ m(Y, { children: r }),
|
|
1466
|
+
o && !r && /* @__PURE__ */ m(J, { children: o })
|
|
1467
|
+
]
|
|
1468
|
+
}), xt = ({ node: e, value: t, setValue: n, error: r, label: i, placeholder: a, helperText: o, name: s, id: c }) => /* @__PURE__ */ h(q, {
|
|
1469
|
+
className: "mb-4",
|
|
1470
|
+
children: [
|
|
1471
|
+
/* @__PURE__ */ h(Z, {
|
|
1472
|
+
htmlFor: c,
|
|
1473
|
+
children: [i || e.data.name, e.data.required && /* @__PURE__ */ m("span", {
|
|
1474
|
+
className: "text-red-500",
|
|
1475
|
+
children: "*"
|
|
1476
|
+
})]
|
|
1477
|
+
}),
|
|
1478
|
+
/* @__PURE__ */ m(X, {
|
|
1479
|
+
type: "time",
|
|
1480
|
+
id: c,
|
|
1481
|
+
name: s,
|
|
1482
|
+
value: t ?? "",
|
|
1483
|
+
onChange: (e) => n(e.target.value),
|
|
1484
|
+
placeholder: a,
|
|
1485
|
+
className: "bg-background [color-scheme:light] dark:[color-scheme:dark]"
|
|
1486
|
+
}),
|
|
1487
|
+
r && /* @__PURE__ */ m(Y, { children: r }),
|
|
1488
|
+
o && !r && /* @__PURE__ */ m(J, { children: o })
|
|
1489
|
+
]
|
|
1490
|
+
}), St = ({ node: e, value: t, setValue: n, error: r, label: i, helperText: a, id: o, name: s }) => {
|
|
1491
|
+
let c = d(), l = Array.isArray(t) ? t : [], u = l[0] || "", f = l[1] || "", p = (e) => {
|
|
1492
|
+
n([e, f]);
|
|
1493
|
+
}, g = (e) => {
|
|
1494
|
+
n([u, e]);
|
|
1495
|
+
};
|
|
1496
|
+
return /* @__PURE__ */ h(q, {
|
|
1497
|
+
className: "mb-4",
|
|
1498
|
+
children: [
|
|
1499
|
+
/* @__PURE__ */ h(Z, {
|
|
1500
|
+
htmlFor: `${o}-start`,
|
|
1501
|
+
children: [i || e.data.name, e.data.required && /* @__PURE__ */ m("span", {
|
|
1502
|
+
className: "text-red-500",
|
|
1503
|
+
children: "*"
|
|
1504
|
+
})]
|
|
1505
|
+
}),
|
|
1506
|
+
/* @__PURE__ */ h("div", {
|
|
1507
|
+
className: "flex gap-2",
|
|
1508
|
+
children: [/* @__PURE__ */ m(X, {
|
|
1509
|
+
id: `${o}-start`,
|
|
1510
|
+
name: `${s}-start`,
|
|
1511
|
+
"aria-label": `${i || e.data.name} - ${c("renderer.defaultInputs.startTime")}`,
|
|
1512
|
+
"aria-invalid": !!r,
|
|
1513
|
+
"aria-describedby": r ? `${e.id}-error` : void 0,
|
|
1514
|
+
type: "time",
|
|
1515
|
+
value: u,
|
|
1516
|
+
onChange: (e) => p(e.target.value),
|
|
1517
|
+
placeholder: c("renderer.defaultInputs.startTime"),
|
|
1518
|
+
className: "flex-1 bg-background [color-scheme:light] dark:[color-scheme:dark]"
|
|
1519
|
+
}), /* @__PURE__ */ m(X, {
|
|
1520
|
+
id: `${o}-end`,
|
|
1521
|
+
name: `${s}-end`,
|
|
1522
|
+
"aria-label": `${i || e.data.name} - ${c("renderer.defaultInputs.endTime")}`,
|
|
1523
|
+
"aria-invalid": !!r,
|
|
1524
|
+
"aria-describedby": r ? `${e.id}-error` : void 0,
|
|
1525
|
+
type: "time",
|
|
1526
|
+
value: f,
|
|
1527
|
+
onChange: (e) => g(e.target.value),
|
|
1528
|
+
placeholder: c("renderer.defaultInputs.endTime"),
|
|
1529
|
+
className: "flex-1 bg-background [color-scheme:light] dark:[color-scheme:dark]"
|
|
1530
|
+
})]
|
|
1531
|
+
}),
|
|
1532
|
+
r && /* @__PURE__ */ m(Y, { children: r }),
|
|
1533
|
+
a && !r && /* @__PURE__ */ m(J, { children: a })
|
|
1534
|
+
]
|
|
1535
|
+
});
|
|
1536
|
+
}, Ct = {
|
|
1537
|
+
address: Ie,
|
|
1538
|
+
autocomplete: Le,
|
|
1539
|
+
checkbox: Re,
|
|
1540
|
+
date: Ve,
|
|
1541
|
+
daterange: He,
|
|
1542
|
+
file: Ue,
|
|
1543
|
+
hidden: We,
|
|
1544
|
+
http: $e,
|
|
1545
|
+
number: et,
|
|
1546
|
+
password: tt,
|
|
1547
|
+
radio: it,
|
|
1548
|
+
select: at,
|
|
1549
|
+
submit: ht,
|
|
1550
|
+
switch: _t,
|
|
1551
|
+
text: bt,
|
|
1552
|
+
textarea: yt,
|
|
1553
|
+
time: xt,
|
|
1554
|
+
timerange: St
|
|
1555
|
+
};
|
|
1556
|
+
//#endregion
|
|
1557
|
+
export { Z as $, je as A, Ee as B, Ue as C, Le as D, Re as E, ye as F, he as G, le as H, Ce as I, fe as J, me as K, De as L, ke as M, Ne as N, Ie as O, Ae as P, ce as Q, Te as R, We as S, Ve as T, pe as U, be as V, ue as W, Q as X, de as Y, $ as Z, nt as _, yt as a, W as at, et as b, gt as c, dt as d, X as et, ft as f, it as g, at as h, bt as i, K as it, Me as j, Oe as k, mt as l, st as m, St as n, q as nt, vt as o, lt as p, ge as q, xt as r, se as rt, _t as s, Ct as t, J as tt, ut as u, rt as v, He as w, $e as x, tt as y, we as z };
|