treege 3.0.0-beta.89 → 3.0.0-beta.90

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/renderer.js CHANGED
@@ -1,5 +1,5 @@
1
- import { G as e, I as t, L as n, _ as r, a as i, b as a, c as o, g as s, h as c, i as l, l as u, m as d, n as f, o as p, r as m, s as h, t as g, v as _, y as v } from "./ThemeContext-CiVygpDK.js";
2
- import { C as y, L as b, S as x, _ as S, a as C, b as w, c as T, d as E, g as D, h as O, i as k, m as A, n as j, o as M, r as N, u as P, v as F, x as I, y as L } from "./DefaultSubmitButton-BIjoDpUm.js";
3
- import { a as R, c as z, i as B, l as V, n as H, o as U, r as W, s as G } from "./useRenderNode-D9gPe-xm.js";
4
- import { a as K, c as q, i as J, l as Y, n as X, o as Z, r as Q, s as $, t as ee } from "./renderer-BIccXyWl.js";
5
- export { y as DefaultAddressInput, x as DefaultAutocompleteInput, I as DefaultCheckboxInput, w as DefaultDateInput, L as DefaultDateRangeInput, F as DefaultFileInput, S as DefaultHiddenInput, D as DefaultHttpInput, b as DefaultInputLabel, O as DefaultNumberInput, A as DefaultPasswordInput, E as DefaultRadioInput, P as DefaultSelectInput, T as DefaultSwitchInput, M as DefaultTextAreaInput, C as DefaultTextInput, k as DefaultTimeInput, N as DefaultTimeRangeInput, Z as Divider, g as ThemeProvider, $ as Title, K as TreegeRenderer, z as TreegeRendererProvider, ee as TreegeViewer, Y as TreegeViewerProvider, m as applyReferenceTransformation, l as buildInitialFormValues, i as calculateReferenceFieldUpdates, p as checkFormFieldHasValue, h as convertFormValuesToNamedFormat, j as defaultInputRenderers, q as defaultUI, U as evaluateCondition, G as evaluateConditions, d as fileNameFromUrl, c as fileToSerializable, s as filesToSerializable, W as findStartNode, r as formatFileSize, B as getFlowRenderState, e as getTranslatedText, X as getViewerFields, o as isFieldEmpty, Q as isImageFile, _ as isRemoteFileData, R as isStartNode, v as normalizeSerializableFiles, u as resolveNodeDefaultValue, t as sanitize, n as sanitizeHttpResponse, a as serializableToFile, f as useTheme, H as useTreegeRenderer, V as useTreegeRendererConfig, J as viewerFieldsFromResponse };
1
+ import { I as e, L as t, _ as n, a as r, b as i, c as a, g as o, h as s, i as c, l, m as u, n as d, o as f, q as p, r as m, s as h, t as g, v as _, y as v } from "./ThemeContext-CPsC8QIP.js";
2
+ import { C as y, L as b, S as x, _ as S, a as C, b as w, c as T, d as E, g as D, h as O, i as k, m as A, n as j, o as M, r as N, u as P, v as F, x as I, y as L } from "./DefaultSubmitButton-NeSDqyzv.js";
3
+ import { a as R, c as z, i as B, l as V, n as H, o as U, r as W, s as G } from "./useRenderNode-CG466pNk.js";
4
+ import { a as K, c as q, i as J, l as Y, n as X, o as Z, r as Q, s as $, t as ee } from "./renderer-CNbSt_QW.js";
5
+ export { y as DefaultAddressInput, x as DefaultAutocompleteInput, I as DefaultCheckboxInput, w as DefaultDateInput, L as DefaultDateRangeInput, F as DefaultFileInput, S as DefaultHiddenInput, D as DefaultHttpInput, b as DefaultInputLabel, O as DefaultNumberInput, A as DefaultPasswordInput, E as DefaultRadioInput, P as DefaultSelectInput, T as DefaultSwitchInput, M as DefaultTextAreaInput, C as DefaultTextInput, k as DefaultTimeInput, N as DefaultTimeRangeInput, Z as Divider, g as ThemeProvider, $ as Title, K as TreegeRenderer, z as TreegeRendererProvider, ee as TreegeViewer, Y as TreegeViewerProvider, m as applyReferenceTransformation, c as buildInitialFormValues, r as calculateReferenceFieldUpdates, f as checkFormFieldHasValue, h as convertFormValuesToNamedFormat, j as defaultInputRenderers, q as defaultUI, U as evaluateCondition, G as evaluateConditions, u as fileNameFromUrl, s as fileToSerializable, o as filesToSerializable, W as findStartNode, n as formatFileSize, B as getFlowRenderState, p as getTranslatedText, X as getViewerFields, a as isFieldEmpty, Q as isImageFile, _ as isRemoteFileData, R as isStartNode, v as normalizeSerializableFiles, l as resolveNodeDefaultValue, e as sanitize, t as sanitizeHttpResponse, i as serializableToFile, d as useTheme, H as useTreegeRenderer, V as useTreegeRendererConfig, J as viewerFieldsFromResponse };
@@ -1,4 +1,4 @@
1
- import { A as e, B as t, C as n, F as r, G as i, I as a, J as o, M as s, N as c, O as l, V as u, Y as d, a as f, c as p, d as m, f as h, i as g, j as _, k as v, l as ee, o as y, p as b, q as x, s as S, u as C } from "./ThemeContext-CiVygpDK.js";
1
+ import { A as e, C as t, F as n, H as r, I as i, M as a, N as o, O as s, U as c, X as l, Y as u, Z as d, a as f, c as p, d as m, f as h, i as g, j as _, k as v, l as ee, o as y, p as b, q as x, s as S, u as C } from "./ThemeContext-CPsC8QIP.js";
2
2
  import { Fragment as w, createContext as T, useCallback as E, useContext as D, useEffect as O, useMemo as k, useRef as A, useState as j } from "react";
3
3
  import { jsx as M } from "react/jsx-runtime";
4
4
  //#region src/renderer/context/TreegeRendererProvider.tsx
@@ -12,21 +12,21 @@ var N = T(void 0), te = () => D(N), P = ({ children: e, ...t }) => /* @__PURE__
12
12
  ...e,
13
13
  ...r
14
14
  };
15
- }, F = async (t, r, i, a, o, u) => {
16
- if (!t.url || t.url.trim() === "") return {
15
+ }, F = async (n, r, i, c, l, u) => {
16
+ if (!n.url || n.url.trim() === "") return {
17
17
  error: "No URL configured for submission",
18
18
  success: !1
19
19
  };
20
- let d = c(_(t.url, r, { encode: !0 }), o);
20
+ let d = o(_(n.url, r, { encode: !0 }), l);
21
21
  if (!d || d.trim() === "") return {
22
22
  error: "Invalid URL after template replacement",
23
23
  success: !1
24
24
  };
25
- let f = S(r, i), p = t.payloadTemplate ? n(t.payloadTemplate, r, i) : void 0, m = ne(p === void 0 ? t.sendAllFormValues ? f : void 0 : p, u, f), h = await l({
25
+ let f = S(r, i), p = n.payloadTemplate ? t(n.payloadTemplate, r, i) : void 0, m = ne(p === void 0 ? n.sendAllFormValues ? f : void 0 : p, u, f), h = await s({
26
26
  body: m === void 0 ? void 0 : JSON.stringify(m),
27
- headers: v(s(a, r), s(t.headers, r)),
28
- method: t.method || "POST",
29
- queryParams: s(t.queryParams, r),
27
+ headers: v(a(c, r), a(n.headers, r)),
28
+ method: n.method || "POST",
29
+ queryParams: a(n.queryParams, r),
30
30
  url: d
31
31
  });
32
32
  if (!h.success) return {
@@ -34,9 +34,9 @@ var N = T(void 0), te = () => D(N), P = ({ children: e, ...t }) => /* @__PURE__
34
34
  error: h.error,
35
35
  success: !1
36
36
  };
37
- let g = t.redirectUrl ? (() => {
38
- let n = e(t.redirectUrl, h.data);
39
- return n && n.trim() !== "" ? n : void 0;
37
+ let g = n.redirectUrl ? (() => {
38
+ let t = e(n.redirectUrl, h.data);
39
+ return t && t.trim() !== "" ? t : void 0;
40
40
  })() : void 0;
41
41
  return {
42
42
  data: h.data,
@@ -45,34 +45,34 @@ var N = T(void 0), te = () => D(N), P = ({ children: e, ...t }) => /* @__PURE__
45
45
  };
46
46
  }, I = (e) => {
47
47
  e && (typeof window > "u" || !window.location || (e.startsWith("http://") || e.startsWith("https://") ? window.location.href = e : window.history?.pushState ? (window.history.pushState({}, "", e), window.dispatchEvent(new PopStateEvent("popstate"))) : window.location.href = e));
48
- }, re = (e, t, n, r, a, s, c) => {
49
- let [l, u] = j(!1), [d, f] = j(null), p = k(() => {
50
- let t = e.find((e) => o(e) && e.data?.type === "submit");
51
- return t && o(t) ? t : null;
52
- }, [e]), m = E(async (e) => {
53
- if (!p?.data?.submitConfig) return null;
54
- let o = p.data.submitConfig;
55
- if (!o.url || o.url.trim() === "") return null;
56
- f(null), o.showLoading !== !1 && u(!0);
48
+ }, re = (e, t, n, r, i, a, o) => {
49
+ let [s, c] = j(!1), [u, d] = j(null), f = k(() => {
50
+ let t = e.find((e) => l(e) && e.data?.type === "submit");
51
+ return t && l(t) ? t : null;
52
+ }, [e]), p = E(async (e) => {
53
+ if (!f?.data?.submitConfig) return null;
54
+ let s = f.data.submitConfig;
55
+ if (!s.url || s.url.trim() === "") return null;
56
+ d(null), s.showLoading !== !1 && c(!0);
57
57
  try {
58
- let l = await F(o, t, r, a, s, c);
59
- if (l.success) {
60
- let t = i(o.successMessage, n);
61
- if (t && f({
58
+ let c = await F(s, t, r, i, a, o);
59
+ if (c.success) {
60
+ let t = x(s.successMessage, n);
61
+ if (t && d({
62
62
  message: t,
63
63
  type: "success"
64
- }), e && e(l.data), l.redirectUrl) {
65
- let e = l.redirectUrl;
64
+ }), e && e(c.data), c.redirectUrl) {
65
+ let e = c.redirectUrl;
66
66
  setTimeout(() => I(e), 1e3);
67
67
  }
68
- } else f({
69
- message: i(o.errorMessage, n) || l.error || "An error occurred during submission",
68
+ } else d({
69
+ message: x(s.errorMessage, n) || c.error || "An error occurred during submission",
70
70
  type: "error"
71
71
  });
72
- return l;
72
+ return c;
73
73
  } catch (e) {
74
- let t = i(o.errorMessage, n) || (e instanceof Error ? e.message : "An unexpected error occurred");
75
- return f({
74
+ let t = x(s.errorMessage, n) || (e instanceof Error ? e.message : "An unexpected error occurred");
75
+ return d({
76
76
  message: t,
77
77
  type: "error"
78
78
  }), {
@@ -80,26 +80,26 @@ var N = T(void 0), te = () => D(N), P = ({ children: e, ...t }) => /* @__PURE__
80
80
  success: !1
81
81
  };
82
82
  } finally {
83
- u(!1);
83
+ c(!1);
84
84
  }
85
85
  }, [
86
- p,
86
+ f,
87
87
  t,
88
88
  n,
89
89
  r,
90
+ i,
90
91
  a,
91
- s,
92
- c
92
+ o
93
93
  ]);
94
94
  return {
95
95
  clearSubmitMessage: E(() => {
96
- f(null);
96
+ d(null);
97
97
  }, []),
98
- handleSubmitWithConfig: m,
99
- hasSubmitConfig: !!p?.data?.submitConfig,
100
- isSubmitting: l,
101
- submitButtonNode: p,
102
- submitMessage: d
98
+ handleSubmitWithConfig: p,
99
+ hasSubmitConfig: !!f?.data?.submitConfig,
100
+ isSubmitting: s,
101
+ submitButtonNode: f,
102
+ submitMessage: u
103
103
  };
104
104
  }, L = (e) => e == null ? null : typeof e == "boolean" || typeof e == "number" ? e : typeof e == "string" ? e === "" ? null : e : typeof e == "object" ? JSON.stringify(e) : String(e), R = (e, t, n) => {
105
105
  let r = L(e), i = L(t);
@@ -138,17 +138,17 @@ var N = T(void 0), te = () => D(N), P = ({ children: e, ...t }) => /* @__PURE__
138
138
  }, z = (e, t, n) => {
139
139
  let { field: r, operator: i, value: a } = e;
140
140
  if (!(r && i) || a === void 0) return !0;
141
- let s = t[r], c = s === void 0 && n ? n.get(r) : void 0, l = c && o(c) ? t[c.id] : s;
142
- return Array.isArray(l) ? i === "===" ? l.some((e) => R(e, a, "===")) || R(l, a, "===") : i === "!==" ? l.every((e) => R(e, a, "!==")) && R(l, a, "!==") : l.some((e) => R(e, a, i)) : R(l, a, i);
141
+ let o = t[r], s = o === void 0 && n ? n.get(r) : void 0, c = s && l(s) ? t[s.id] : o;
142
+ return Array.isArray(c) ? i === "===" ? c.some((e) => R(e, a, "===")) || R(c, a, "===") : i === "!==" ? c.every((e) => R(e, a, "!==")) && R(c, a, "!==") : c.some((e) => R(e, a, i)) : R(c, a, i);
143
143
  }, B = (e, t, n) => {
144
144
  if (!e || e.length === 0) return !0;
145
145
  if (e.length === 1) return z(e[0], t, n);
146
146
  let r = z(e[0], t, n);
147
147
  for (let i = 1; i < e.length; i += 1) {
148
- let a = e[i], o = z(a, t, n), s = e[i - 1].logicalOperator || u.AND;
149
- if (s === u.AND) {
148
+ let a = e[i], o = z(a, t, n), s = e[i - 1].logicalOperator || c.AND;
149
+ if (s === c.AND) {
150
150
  if (r &&= o, !r) return !1;
151
- } else if (s === u.OR && (r ||= o, r)) return !0;
151
+ } else if (s === c.OR && (r ||= o, r)) return !0;
152
152
  }
153
153
  return r;
154
154
  }, V = (e) => {
@@ -163,9 +163,9 @@ var N = T(void 0), te = () => D(N), P = ({ children: e, ...t }) => /* @__PURE__
163
163
  let t = e.data?.isFallback, n = e.data?.conditions?.length;
164
164
  t ? a.push(e) : n ? i.push(e) : r.push(e);
165
165
  });
166
- let s = [...r];
167
- if (i.length === 0) return a.length > 0 && s.length === 0 && s.push(...a), {
168
- edgesToFollow: s,
166
+ let o = [...r];
167
+ if (i.length === 0) return a.length > 0 && o.length === 0 && o.push(...a), {
168
+ edgesToFollow: o,
169
169
  waitingForInput: !1
170
170
  };
171
171
  if (!i.every((e) => {
@@ -173,23 +173,23 @@ var N = T(void 0), te = () => D(N), P = ({ children: e, ...t }) => /* @__PURE__
173
173
  return r ? r.every((e) => {
174
174
  if (!e.field) return !0;
175
175
  let r = n.get(e.field);
176
- return y(o(r) ? r.id : e.field, t);
176
+ return y(l(r) ? r.id : e.field, t);
177
177
  }) : !1;
178
- })) return a.length > 0 && s.push(...a), {
179
- edgesToFollow: s,
180
- waitingForInput: s.length === 0
178
+ })) return a.length > 0 && o.push(...a), {
179
+ edgesToFollow: o,
180
+ waitingForInput: o.length === 0
181
181
  };
182
- let c = i.filter((e) => B(e.data?.conditions, t, n));
183
- return c.length > 0 ? (s.push(...c), {
184
- edgesToFollow: s,
182
+ let s = i.filter((e) => B(e.data?.conditions, t, n));
183
+ return s.length > 0 ? (o.push(...s), {
184
+ edgesToFollow: o,
185
185
  waitingForInput: !1
186
- }) : (s.push(...a), {
187
- edgesToFollow: s,
186
+ }) : (o.push(...a), {
187
+ edgesToFollow: o,
188
188
  waitingForInput: !1
189
189
  });
190
190
  }, ie = (e, t) => !t.some((t) => t.target === e), U = (e, t) => {
191
191
  let n = e.filter((e) => ie(e.id, t));
192
- return n.find(o) || n[0];
192
+ return n.find(l) || n[0];
193
193
  }, ae = (e, t, n = /* @__PURE__ */ new Set()) => !e || n.has(e) ? [] : (n.add(e), [e, ...ae(t.get(e)?.parentId, t, n)]), W = (e, t, n, r) => {
194
194
  e.forEach((e) => {
195
195
  let i = n.get(e);
@@ -230,7 +230,7 @@ var N = T(void 0), te = () => D(N), P = ({ children: e, ...t }) => /* @__PURE__
230
230
  visibleNodes: p,
231
231
  visibleRootNodes: m
232
232
  };
233
- }, se = (e) => e.filter((e) => !x(e)).reduce((e, t) => {
233
+ }, se = (e) => e.filter((e) => !u(e)).reduce((e, t) => {
234
234
  let n = t.parentId ?? null, r = e.at(-1);
235
235
  return r && r.groupId === n ? [...e.slice(0, -1), {
236
236
  ...r,
@@ -244,52 +244,52 @@ var N = T(void 0), te = () => D(N), P = ({ children: e, ...t }) => /* @__PURE__
244
244
  if (Array.isArray(e)) return `[${e.map(G).join(",")}]`;
245
245
  let t = e;
246
246
  return `{${Object.keys(t).sort().map((e) => `${JSON.stringify(e)}:${G(t[e])}`).join(",")}}`;
247
- }, K = ({ baseUrl: e, components: t, extraPayload: i, flow: a, googleApiKey: s, headers: c, language: l, onChange: u, onSubmit: d, showPoweredBy: m, theme: h, validate: _, validationMode: y, initialValues: b = {} }) => {
247
+ }, K = ({ baseUrl: e, components: r, extraPayload: i, flow: a, googleApiKey: o, headers: s, language: c, onChange: d, onSubmit: m, showPoweredBy: h, theme: _, validate: y, validationMode: b, initialValues: x = {} }) => {
248
248
  let w = te(), T = k(() => ({
249
249
  baseUrl: e ?? w?.baseUrl,
250
250
  components: {
251
- form: t?.form ?? w?.components?.form,
251
+ form: r?.form ?? w?.components?.form,
252
252
  inputs: {
253
253
  ...w?.components?.inputs,
254
- ...t?.inputs
254
+ ...r?.inputs
255
255
  },
256
- loadingSkeleton: t?.loadingSkeleton ?? w?.components?.loadingSkeleton,
257
- step: t?.step ?? w?.components?.step,
258
- submitButton: t?.submitButton ?? w?.components?.submitButton,
259
- submitButtonWrapper: t?.submitButtonWrapper ?? w?.components?.submitButtonWrapper,
256
+ loadingSkeleton: r?.loadingSkeleton ?? w?.components?.loadingSkeleton,
257
+ step: r?.step ?? w?.components?.step,
258
+ submitButton: r?.submitButton ?? w?.components?.submitButton,
259
+ submitButtonWrapper: r?.submitButtonWrapper ?? w?.components?.submitButtonWrapper,
260
260
  ui: {
261
261
  ...w?.components?.ui,
262
- ...t?.ui
262
+ ...r?.ui
263
263
  }
264
264
  },
265
- googleApiKey: s ?? w?.googleApiKey,
266
- headers: v(w?.headers, c),
267
- language: l ?? w?.language ?? "en",
268
- showPoweredBy: m ?? w?.showPoweredBy ?? !0,
269
- theme: h ?? w?.theme ?? "dark",
270
- validationMode: y ?? w?.validationMode ?? "onSubmit"
265
+ googleApiKey: o ?? w?.googleApiKey,
266
+ headers: v(w?.headers, s),
267
+ language: c ?? w?.language ?? "en",
268
+ showPoweredBy: h ?? w?.showPoweredBy ?? !0,
269
+ theme: _ ?? w?.theme ?? "dark",
270
+ validationMode: b ?? w?.validationMode ?? "onSubmit"
271
271
  }), [
272
272
  e,
273
- t,
273
+ r,
274
274
  w,
275
+ o,
275
276
  s,
276
277
  c,
277
- l,
278
- m,
279
278
  h,
280
- y
281
- ]), D = k(() => a?.nodes ?? [], [a]), M = k(() => a?.edges ?? [], [a]), N = k(() => C(D), [D]), P = r(T.language), F = A({}), I = A(null), [L, R] = j({}), [z, B] = j(() => g(b, N)), V = k(() => G(b), [b]), H = A(V), { endOfPathReached: ie, visibleNodes: U, visibleRootNodes: ae } = k(() => oe(D, M, z), [
279
+ _,
280
+ b
281
+ ]), D = k(() => a?.nodes ?? [], [a]), M = k(() => a?.edges ?? [], [a]), N = k(() => C(D), [D]), P = n(T.language), F = A({}), I = A(null), [L, R] = j({}), [z, B] = j(() => g(x, N)), V = k(() => G(x), [x]), H = A(V), { endOfPathReached: ie, visibleNodes: U, visibleRootNodes: ae } = k(() => oe(D, M, z), [
282
282
  D,
283
283
  M,
284
284
  z
285
285
  ]), W = k(() => C(U), [U]), K = k(() => se(U), [U]), ce = k(() => {
286
286
  let e = /* @__PURE__ */ new Map();
287
287
  return D.forEach((t) => {
288
- x(t) && e.set(t.id, t);
288
+ u(t) && e.set(t.id, t);
289
289
  }), e;
290
- }, [D]), [q, J] = j(0), Y = K.length === 0 ? 0 : Math.min(q, K.length - 1), X = K[Y], le = X?.groupId ? ce.get(X.groupId) : void 0, ue = Y === 0, de = K.length === 0 || Y >= K.length - 1, { clearSubmitMessage: fe, handleSubmitWithConfig: pe, hasSubmitConfig: me, isSubmitting: he, submitButtonNode: ge, submitMessage: _e } = re(U, z, T.language, W, T.headers, T.baseUrl, i), ve = A(u), Z = A(_), Q = k(() => S(z, W), [z, W]), ye = k(() => {
290
+ }, [D]), [q, J] = j(0), Y = K.length === 0 ? 0 : Math.min(q, K.length - 1), X = K[Y], le = X?.groupId ? ce.get(X.groupId) : void 0, ue = Y === 0, de = K.length === 0 || Y >= K.length - 1, { clearSubmitMessage: fe, handleSubmitWithConfig: pe, hasSubmitConfig: me, isSubmitting: he, submitButtonNode: ge, submitMessage: _e } = re(U, z, T.language, W, T.headers, T.baseUrl, i), ve = A(d), Z = A(y), Q = k(() => S(z, W), [z, W]), ye = k(() => {
291
291
  let e = ge?.data?.submitConfig?.payloadTemplate;
292
- return e ? n(e, z, W) ?? Q : Q;
292
+ return e ? t(e, z, W) ?? Q : Q;
293
293
  }, [
294
294
  ge,
295
295
  z,
@@ -316,7 +316,7 @@ var N = T(void 0), te = () => D(N), P = ({ children: e, ...t }) => /* @__PURE__
316
316
  }, []), $ = E((e) => {
317
317
  let t = {};
318
318
  U.forEach((e) => {
319
- if (o(e)) {
319
+ if (l(e)) {
320
320
  let n = e.id, r = z[n];
321
321
  if (e.data.required && p(r)) {
322
322
  t[n] = P(e.data.errorMessage) || P("validation.required");
@@ -352,17 +352,17 @@ var N = T(void 0), te = () => D(N), P = ({ children: e, ...t }) => /* @__PURE__
352
352
  let t = ne(ye, i, Q);
353
353
  if (me) {
354
354
  let e = await pe((e) => {
355
- d && d(t, { httpResponse: e });
355
+ m && m(t, { httpResponse: e });
356
356
  });
357
- if (e === null) return d?.(t), !0;
357
+ if (e === null) return m?.(t), !0;
358
358
  if (!e.success) return !0;
359
- } else d && d(t);
359
+ } else m && m(t);
360
360
  return !0;
361
361
  }, [
362
362
  $,
363
363
  me,
364
364
  pe,
365
- d,
365
+ m,
366
366
  ye,
367
367
  i,
368
368
  Q
@@ -370,13 +370,13 @@ var N = T(void 0), te = () => D(N), P = ({ children: e, ...t }) => /* @__PURE__
370
370
  if (!X) return [];
371
371
  let e = [];
372
372
  return X.nodes.forEach((t) => {
373
- o(t) && t.data.type !== "submit" && t.data.required && p(z[t.id]) && e.push(P(t.data.label) || t.id);
373
+ l(t) && t.data.type !== "submit" && t.data.required && p(z[t.id]) && e.push(P(t.data.label) || t.id);
374
374
  }), e;
375
375
  }, [
376
376
  X,
377
377
  z,
378
378
  P
379
- ]), Ee = k(() => U.some((e) => o(e) && e.data.type === "submit"), [U]), De = k(() => X ? X.nodes.every((e) => !o(e) || !e.data.required || e.data.type === "submit" ? !0 : !p(z[e.id])) : !1, [X, z]), Oe = k(() => {
379
+ ]), Ee = k(() => U.some((e) => l(e) && e.data.type === "submit"), [U]), De = k(() => X ? X.nodes.every((e) => !l(e) || !e.data.required || e.data.type === "submit" ? !0 : !p(z[e.id])) : !1, [X, z]), Oe = k(() => {
380
380
  let e = Object.keys(L);
381
381
  return e.length > 0 ? e[0] : void 0;
382
382
  }, [L]);
@@ -387,10 +387,10 @@ var N = T(void 0), te = () => D(N), P = ({ children: e, ...t }) => /* @__PURE__
387
387
  }
388
388
  q > K.length - 1 && J(K.length - 1);
389
389
  }, [K.length, q]), O(() => {
390
- ve.current = u;
391
- }, [u]), O(() => {
392
- Z.current = _;
393
- }, [_]), O(() => {
390
+ ve.current = d;
391
+ }, [d]), O(() => {
392
+ Z.current = y;
393
+ }, [y]), O(() => {
394
394
  ve.current?.(Q);
395
395
  }, [Q]), O(() => {
396
396
  T.validationMode === "onChange" && $(Z.current);
@@ -424,10 +424,10 @@ var N = T(void 0), te = () => D(N), P = ({ children: e, ...t }) => /* @__PURE__
424
424
  }), t ? r : e;
425
425
  }));
426
426
  }, [W, z]), O(() => {
427
- H.current !== V && (H.current = V, B(g(b, N)), R({}), I.current = null);
427
+ H.current !== V && (H.current = V, B(g(x, N)), R({}), I.current = null);
428
428
  }, [
429
429
  V,
430
- b,
430
+ x,
431
431
  N
432
432
  ]), {
433
433
  canContinueStep: De,
@@ -475,62 +475,62 @@ var N = T(void 0), te = () => D(N), P = ({ children: e, ...t }) => /* @__PURE__
475
475
  id: e,
476
476
  label: t ? b(t, r) : e
477
477
  };
478
- }), le = ({ DefaultFormWrapper: e, DefaultInputLabel: n, DefaultInputWrapper: r, DefaultSubmitButton: s, DefaultSubmitButtonWrapper: c, config: l, defaultInputRenderers: u, defaultUI: f, formErrors: p, formValues: g, inputNodes: _, isSubmitting: v, missingRequiredFields: ee, setFieldValue: y }) => {
479
- let b = k(() => l.components.form || e, [l.components.form, e]), x = k(() => l.components.submitButton || s, [l.components.submitButton, s]), S = k(() => l.components.submitButtonWrapper || c || w, [l.components.submitButtonWrapper, c]), C = k(() => l.components.inputLabel || n, [l.components.inputLabel, n]);
478
+ }), le = ({ DefaultFormWrapper: e, DefaultInputLabel: t, DefaultInputWrapper: n, DefaultSubmitButton: a, DefaultSubmitButtonWrapper: o, config: s, defaultInputRenderers: c, defaultUI: u, formErrors: f, formValues: p, inputNodes: g, isSubmitting: _, missingRequiredFields: v, setFieldValue: ee }) => {
479
+ let y = k(() => s.components.form || e, [s.components.form, e]), b = k(() => s.components.submitButton || a, [s.components.submitButton, a]), S = k(() => s.components.submitButtonWrapper || o || w, [s.components.submitButtonWrapper, o]), C = k(() => s.components.inputLabel || t, [s.components.inputLabel, t]);
480
480
  return {
481
- FormWrapper: b,
481
+ FormWrapper: y,
482
482
  renderNode: E(function(e) {
483
- let { type: n } = e;
484
- switch (n) {
485
- case t.input: {
486
- if (!o(e)) return null;
487
- let t = e.data, n = t.type || "text", s = l.components.inputs?.[n], c = u[n], d = s || c, f = e.id, b = (e) => y(f, e), x = g[f], S = p[f], w = i(t.label, l.language), T = m(t, l.language), E = i(t.helperText, l.language), D = h(e), O = a(w), k = a(T), A = a(E);
488
- return d ? /* @__PURE__ */ M(r, {
483
+ let { type: t } = e;
484
+ switch (t) {
485
+ case r.input: {
486
+ if (!l(e)) return null;
487
+ let t = e.data, r = t.type || "text", a = s.components.inputs?.[r], o = c[r], u = a || o, d = e.id, y = (e) => ee(d, e), b = p[d], S = f[d], w = x(t.label, s.language), T = m(t, s.language), E = x(t.helperText, s.language), D = h(e), O = i(w), k = i(T), A = i(E);
488
+ return u ? /* @__PURE__ */ M(n, {
489
489
  node: e,
490
- children: /* @__PURE__ */ M(d, {
490
+ children: /* @__PURE__ */ M(u, {
491
491
  field: {
492
492
  "aria-invalid": S ? !0 : void 0,
493
493
  id: e.id,
494
494
  name: D,
495
495
  placeholder: k,
496
496
  required: t.required,
497
- value: x
497
+ value: b
498
498
  },
499
499
  extra: {
500
500
  error: S,
501
501
  helperText: A,
502
502
  InputLabel: C,
503
- isSubmitting: v,
503
+ isSubmitting: _,
504
504
  label: O,
505
- missingDependencies: X(e, g, _, l.language),
506
- missingRequiredFields: ee,
505
+ missingDependencies: X(e, p, g, s.language),
506
+ missingRequiredFields: v,
507
507
  node: e,
508
- setValue: b
508
+ setValue: y
509
509
  }
510
- }, n)
511
- }, e.id) : (console.warn("No renderer found for input type:", n), null);
510
+ }, r)
511
+ }, e.id) : (console.warn("No renderer found for input type:", r), null);
512
512
  }
513
- case t.group: return null;
514
- case t.ui: {
513
+ case r.group: return null;
514
+ case r.ui: {
515
515
  if (!d(e)) return null;
516
- let t = e.data.type || "title", n = l.components.ui?.[t], r = f[t], i = n || r;
516
+ let t = e.data.type || "title", n = s.components.ui?.[t], r = u[t], i = n || r;
517
517
  return i ? /* @__PURE__ */ M(i, { node: e }, e.id) : null;
518
518
  }
519
- default: return console.warn("Unknown node type:", n), null;
519
+ default: return console.warn("Unknown node type:", t), null;
520
520
  }
521
521
  }, [
522
- l,
523
- g,
522
+ s,
524
523
  p,
525
- y,
526
- v,
524
+ f,
527
525
  ee,
528
526
  _,
527
+ v,
528
+ g,
529
+ c,
529
530
  u,
530
- f,
531
- r
531
+ n
532
532
  ]),
533
- SubmitButton: x,
533
+ SubmitButton: b,
534
534
  SubmitButtonWrapper: S
535
535
  };
536
536
  };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "treege",
3
3
  "description": "Powerful form generator",
4
4
  "license": "ISC",
5
- "version": "3.0.0-beta.89",
5
+ "version": "3.0.0-beta.90",
6
6
  "type": "module",
7
7
  "types": "./dist/main.d.ts",
8
8
  "module": "./dist/main.js",