@mieweb/forms-editor 0.1.3 → 0.1.6
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/README.md +66 -81
- package/dist/index.js +388 -390
- package/dist/index.js.map +1 -1
- package/package.json +38 -38
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import E, { useState as xe, useRef as
|
|
2
|
-
import { useFormStore as q, useFieldsArray as
|
|
1
|
+
import E, { useState as xe, useRef as er, useEffect as ee, useMemo as ie, useCallback as be } from "react";
|
|
2
|
+
import { useFormStore as q, useFieldsArray as rr, useUIApi as H, EYECLOSED_ICON as Ar, EYEEDIT_ICON as Dr, PLUSSQUARE_ICON as Pr, DATALOG_ICON as Fr, X_ICON as $r, fieldTypes as le, useFormApi as tr, useVisibleFields as Lr, getFieldComponent as Mr } from "@mieweb/forms-engine";
|
|
3
3
|
import { AnimatePresence as Wr, motion as K } from "framer-motion";
|
|
4
4
|
import qr from "js-yaml";
|
|
5
|
-
import './index.css';var pe = { exports: {} },
|
|
5
|
+
import './index.css';var pe = { exports: {} }, ae = {};
|
|
6
6
|
/**
|
|
7
7
|
* @license React
|
|
8
8
|
* react-jsx-runtime.production.min.js
|
|
@@ -12,21 +12,21 @@ import './index.css';var pe = { exports: {} }, se = {};
|
|
|
12
12
|
* This source code is licensed under the MIT license found in the
|
|
13
13
|
* LICENSE file in the root directory of this source tree.
|
|
14
14
|
*/
|
|
15
|
-
var
|
|
15
|
+
var Je;
|
|
16
16
|
function Ur() {
|
|
17
|
-
if (
|
|
18
|
-
|
|
19
|
-
var t = E, n = Symbol.for("react.element"), s = Symbol.for("react.fragment"), i = Object.prototype.hasOwnProperty,
|
|
20
|
-
function
|
|
21
|
-
var
|
|
22
|
-
g !== void 0 && (
|
|
23
|
-
for (
|
|
24
|
-
if (
|
|
25
|
-
return { $$typeof: n, type:
|
|
17
|
+
if (Je) return ae;
|
|
18
|
+
Je = 1;
|
|
19
|
+
var t = E, n = Symbol.for("react.element"), s = Symbol.for("react.fragment"), i = Object.prototype.hasOwnProperty, c = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, h = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
20
|
+
function m(o, u, g) {
|
|
21
|
+
var p, f = {}, x = null, k = null;
|
|
22
|
+
g !== void 0 && (x = "" + g), u.key !== void 0 && (x = "" + u.key), u.ref !== void 0 && (k = u.ref);
|
|
23
|
+
for (p in u) i.call(u, p) && !h.hasOwnProperty(p) && (f[p] = u[p]);
|
|
24
|
+
if (o && o.defaultProps) for (p in u = o.defaultProps, u) f[p] === void 0 && (f[p] = u[p]);
|
|
25
|
+
return { $$typeof: n, type: o, key: x, ref: k, props: f, _owner: c.current };
|
|
26
26
|
}
|
|
27
|
-
return
|
|
27
|
+
return ae.Fragment = s, ae.jsx = m, ae.jsxs = m, ae;
|
|
28
28
|
}
|
|
29
|
-
var
|
|
29
|
+
var se = {};
|
|
30
30
|
/**
|
|
31
31
|
* @license React
|
|
32
32
|
* react-jsx-runtime.development.js
|
|
@@ -36,11 +36,11 @@ var ie = {};
|
|
|
36
36
|
* This source code is licensed under the MIT license found in the
|
|
37
37
|
* LICENSE file in the root directory of this source tree.
|
|
38
38
|
*/
|
|
39
|
-
var
|
|
39
|
+
var ze;
|
|
40
40
|
function Yr() {
|
|
41
|
-
return
|
|
42
|
-
var t = E, n = Symbol.for("react.element"), s = Symbol.for("react.portal"), i = Symbol.for("react.fragment"),
|
|
43
|
-
function
|
|
41
|
+
return ze || (ze = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
42
|
+
var t = E, n = Symbol.for("react.element"), s = Symbol.for("react.portal"), i = Symbol.for("react.fragment"), c = Symbol.for("react.strict_mode"), h = Symbol.for("react.profiler"), m = Symbol.for("react.provider"), o = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), g = Symbol.for("react.suspense"), p = Symbol.for("react.suspense_list"), f = Symbol.for("react.memo"), x = Symbol.for("react.lazy"), k = Symbol.for("react.offscreen"), v = Symbol.iterator, S = "@@iterator";
|
|
43
|
+
function N(e) {
|
|
44
44
|
if (e === null || typeof e != "object")
|
|
45
45
|
return null;
|
|
46
46
|
var a = v && e[v] || e[S];
|
|
@@ -49,38 +49,38 @@ function Yr() {
|
|
|
49
49
|
var L = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
50
50
|
function _(e) {
|
|
51
51
|
{
|
|
52
|
-
for (var a = arguments.length, l = new Array(a > 1 ? a - 1 : 0),
|
|
53
|
-
l[
|
|
52
|
+
for (var a = arguments.length, l = new Array(a > 1 ? a - 1 : 0), b = 1; b < a; b++)
|
|
53
|
+
l[b - 1] = arguments[b];
|
|
54
54
|
F("error", e, l);
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
function F(e, a, l) {
|
|
58
58
|
{
|
|
59
|
-
var
|
|
60
|
-
|
|
61
|
-
var
|
|
59
|
+
var b = L.ReactDebugCurrentFrame, C = b.getStackAddendum();
|
|
60
|
+
C !== "" && (a += "%s", l = l.concat([C]));
|
|
61
|
+
var T = l.map(function(w) {
|
|
62
62
|
return String(w);
|
|
63
63
|
});
|
|
64
|
-
|
|
64
|
+
T.unshift("Warning: " + a), Function.prototype.apply.call(console[e], console, T);
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
var O = !1, he = !1, ve = !1, ge = !1, X = !1, oe;
|
|
68
68
|
oe = Symbol.for("react.module.reference");
|
|
69
69
|
function J(e) {
|
|
70
|
-
return !!(typeof e == "string" || typeof e == "function" || e === i || e ===
|
|
70
|
+
return !!(typeof e == "string" || typeof e == "function" || e === i || e === h || X || e === c || e === g || e === p || ge || e === k || O || he || ve || typeof e == "object" && e !== null && (e.$$typeof === x || e.$$typeof === f || e.$$typeof === m || e.$$typeof === o || e.$$typeof === u || // This needs to include all possible module reference object
|
|
71
71
|
// types supported by any Flight configuration anywhere since
|
|
72
72
|
// we don't know which Flight build this will end up being used
|
|
73
73
|
// with.
|
|
74
74
|
e.$$typeof === oe || e.getModuleId !== void 0));
|
|
75
75
|
}
|
|
76
76
|
function ce(e, a, l) {
|
|
77
|
-
var
|
|
78
|
-
if (
|
|
79
|
-
return
|
|
80
|
-
var
|
|
81
|
-
return
|
|
77
|
+
var b = e.displayName;
|
|
78
|
+
if (b)
|
|
79
|
+
return b;
|
|
80
|
+
var C = a.displayName || a.name || "";
|
|
81
|
+
return C !== "" ? l + "(" + C + ")" : l;
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function re(e) {
|
|
84
84
|
return e.displayName || "Context";
|
|
85
85
|
}
|
|
86
86
|
function B(e) {
|
|
@@ -95,32 +95,32 @@ function Yr() {
|
|
|
95
95
|
return "Fragment";
|
|
96
96
|
case s:
|
|
97
97
|
return "Portal";
|
|
98
|
-
case
|
|
98
|
+
case h:
|
|
99
99
|
return "Profiler";
|
|
100
|
-
case
|
|
100
|
+
case c:
|
|
101
101
|
return "StrictMode";
|
|
102
102
|
case g:
|
|
103
103
|
return "Suspense";
|
|
104
|
-
case
|
|
104
|
+
case p:
|
|
105
105
|
return "SuspenseList";
|
|
106
106
|
}
|
|
107
107
|
if (typeof e == "object")
|
|
108
108
|
switch (e.$$typeof) {
|
|
109
|
-
case
|
|
109
|
+
case o:
|
|
110
110
|
var a = e;
|
|
111
|
-
return
|
|
112
|
-
case
|
|
111
|
+
return re(a) + ".Consumer";
|
|
112
|
+
case m:
|
|
113
113
|
var l = e;
|
|
114
|
-
return
|
|
115
|
-
case
|
|
114
|
+
return re(l._context) + ".Provider";
|
|
115
|
+
case u:
|
|
116
116
|
return ce(e, e.render, "ForwardRef");
|
|
117
|
-
case
|
|
118
|
-
var
|
|
119
|
-
return
|
|
120
|
-
case
|
|
121
|
-
var
|
|
117
|
+
case f:
|
|
118
|
+
var b = e.displayName || null;
|
|
119
|
+
return b !== null ? b : B(e.type) || "Memo";
|
|
120
|
+
case x: {
|
|
121
|
+
var C = e, T = C._payload, w = C._init;
|
|
122
122
|
try {
|
|
123
|
-
return B(w(
|
|
123
|
+
return B(w(T));
|
|
124
124
|
} catch {
|
|
125
125
|
return null;
|
|
126
126
|
}
|
|
@@ -128,14 +128,14 @@ function Yr() {
|
|
|
128
128
|
}
|
|
129
129
|
return null;
|
|
130
130
|
}
|
|
131
|
-
var d = Object.assign,
|
|
131
|
+
var d = Object.assign, R = 0, I, Y, A, U, y, z, te;
|
|
132
132
|
function ye() {
|
|
133
133
|
}
|
|
134
134
|
ye.__reactDisabledLog = !0;
|
|
135
135
|
function je() {
|
|
136
136
|
{
|
|
137
|
-
if (
|
|
138
|
-
I = console.log, Y = console.info, A = console.warn, U = console.error, y = console.group, z = console.groupCollapsed,
|
|
137
|
+
if (R === 0) {
|
|
138
|
+
I = console.log, Y = console.info, A = console.warn, U = console.error, y = console.group, z = console.groupCollapsed, te = console.groupEnd;
|
|
139
139
|
var e = {
|
|
140
140
|
configurable: !0,
|
|
141
141
|
enumerable: !0,
|
|
@@ -152,12 +152,12 @@ function Yr() {
|
|
|
152
152
|
groupEnd: e
|
|
153
153
|
});
|
|
154
154
|
}
|
|
155
|
-
|
|
155
|
+
R++;
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
158
|
function lr() {
|
|
159
159
|
{
|
|
160
|
-
if (
|
|
160
|
+
if (R--, R === 0) {
|
|
161
161
|
var e = {
|
|
162
162
|
configurable: !0,
|
|
163
163
|
enumerable: !0,
|
|
@@ -183,11 +183,11 @@ function Yr() {
|
|
|
183
183
|
value: z
|
|
184
184
|
}),
|
|
185
185
|
groupEnd: d({}, e, {
|
|
186
|
-
value:
|
|
186
|
+
value: te
|
|
187
187
|
})
|
|
188
188
|
});
|
|
189
189
|
}
|
|
190
|
-
|
|
190
|
+
R < 0 && _("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
193
|
var we = L.ReactCurrentDispatcher, Ee;
|
|
@@ -196,9 +196,9 @@ function Yr() {
|
|
|
196
196
|
if (Ee === void 0)
|
|
197
197
|
try {
|
|
198
198
|
throw Error();
|
|
199
|
-
} catch (
|
|
200
|
-
var
|
|
201
|
-
Ee =
|
|
199
|
+
} catch (C) {
|
|
200
|
+
var b = C.stack.trim().match(/\n( *(at )?)/);
|
|
201
|
+
Ee = b && b[1] || "";
|
|
202
202
|
}
|
|
203
203
|
return `
|
|
204
204
|
` + Ee + e;
|
|
@@ -209,7 +209,7 @@ function Yr() {
|
|
|
209
209
|
var or = typeof WeakMap == "function" ? WeakMap : Map;
|
|
210
210
|
ue = new or();
|
|
211
211
|
}
|
|
212
|
-
function
|
|
212
|
+
function Ie(e, a) {
|
|
213
213
|
if (!e || ke)
|
|
214
214
|
return "";
|
|
215
215
|
{
|
|
@@ -217,12 +217,12 @@ function Yr() {
|
|
|
217
217
|
if (l !== void 0)
|
|
218
218
|
return l;
|
|
219
219
|
}
|
|
220
|
-
var
|
|
220
|
+
var b;
|
|
221
221
|
ke = !0;
|
|
222
|
-
var
|
|
222
|
+
var C = Error.prepareStackTrace;
|
|
223
223
|
Error.prepareStackTrace = void 0;
|
|
224
|
-
var
|
|
225
|
-
|
|
224
|
+
var T;
|
|
225
|
+
T = we.current, we.current = null, je();
|
|
226
226
|
try {
|
|
227
227
|
if (a) {
|
|
228
228
|
var w = function() {
|
|
@@ -236,14 +236,14 @@ function Yr() {
|
|
|
236
236
|
try {
|
|
237
237
|
Reflect.construct(w, []);
|
|
238
238
|
} catch (W) {
|
|
239
|
-
|
|
239
|
+
b = W;
|
|
240
240
|
}
|
|
241
241
|
Reflect.construct(e, [], w);
|
|
242
242
|
} else {
|
|
243
243
|
try {
|
|
244
244
|
w.call();
|
|
245
245
|
} catch (W) {
|
|
246
|
-
|
|
246
|
+
b = W;
|
|
247
247
|
}
|
|
248
248
|
e.call(w.prototype);
|
|
249
249
|
}
|
|
@@ -251,14 +251,14 @@ function Yr() {
|
|
|
251
251
|
try {
|
|
252
252
|
throw Error();
|
|
253
253
|
} catch (W) {
|
|
254
|
-
|
|
254
|
+
b = W;
|
|
255
255
|
}
|
|
256
256
|
e();
|
|
257
257
|
}
|
|
258
258
|
} catch (W) {
|
|
259
|
-
if (W &&
|
|
259
|
+
if (W && b && typeof W.stack == "string") {
|
|
260
260
|
for (var j = W.stack.split(`
|
|
261
|
-
`), M =
|
|
261
|
+
`), M = b.stack.split(`
|
|
262
262
|
`), D = j.length - 1, P = M.length - 1; D >= 1 && P >= 0 && j[D] !== M[P]; )
|
|
263
263
|
P--;
|
|
264
264
|
for (; D >= 1 && P >= 0; D--, P--)
|
|
@@ -275,13 +275,13 @@ function Yr() {
|
|
|
275
275
|
}
|
|
276
276
|
}
|
|
277
277
|
} finally {
|
|
278
|
-
ke = !1, we.current =
|
|
278
|
+
ke = !1, we.current = T, lr(), Error.prepareStackTrace = C;
|
|
279
279
|
}
|
|
280
280
|
var Z = e ? e.displayName || e.name : "", G = Z ? de(Z) : "";
|
|
281
281
|
return typeof e == "function" && ue.set(e, G), G;
|
|
282
282
|
}
|
|
283
283
|
function cr(e, a, l) {
|
|
284
|
-
return
|
|
284
|
+
return Ie(e, !1);
|
|
285
285
|
}
|
|
286
286
|
function dr(e) {
|
|
287
287
|
var a = e.prototype;
|
|
@@ -291,55 +291,55 @@ function Yr() {
|
|
|
291
291
|
if (e == null)
|
|
292
292
|
return "";
|
|
293
293
|
if (typeof e == "function")
|
|
294
|
-
return
|
|
294
|
+
return Ie(e, dr(e));
|
|
295
295
|
if (typeof e == "string")
|
|
296
296
|
return de(e);
|
|
297
297
|
switch (e) {
|
|
298
298
|
case g:
|
|
299
299
|
return de("Suspense");
|
|
300
|
-
case
|
|
300
|
+
case p:
|
|
301
301
|
return de("SuspenseList");
|
|
302
302
|
}
|
|
303
303
|
if (typeof e == "object")
|
|
304
304
|
switch (e.$$typeof) {
|
|
305
|
-
case
|
|
305
|
+
case u:
|
|
306
306
|
return cr(e.render);
|
|
307
|
-
case
|
|
307
|
+
case f:
|
|
308
308
|
return fe(e.type, a, l);
|
|
309
|
-
case
|
|
310
|
-
var
|
|
309
|
+
case x: {
|
|
310
|
+
var b = e, C = b._payload, T = b._init;
|
|
311
311
|
try {
|
|
312
|
-
return fe(
|
|
312
|
+
return fe(T(C), a, l);
|
|
313
313
|
} catch {
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
317
|
return "";
|
|
318
318
|
}
|
|
319
|
-
var
|
|
319
|
+
var ne = Object.prototype.hasOwnProperty, Oe = {}, Ae = L.ReactDebugCurrentFrame;
|
|
320
320
|
function me(e) {
|
|
321
321
|
if (e) {
|
|
322
322
|
var a = e._owner, l = fe(e.type, e._source, a ? a.type : null);
|
|
323
|
-
|
|
323
|
+
Ae.setExtraStackFrame(l);
|
|
324
324
|
} else
|
|
325
|
-
|
|
325
|
+
Ae.setExtraStackFrame(null);
|
|
326
326
|
}
|
|
327
|
-
function ur(e, a, l,
|
|
327
|
+
function ur(e, a, l, b, C) {
|
|
328
328
|
{
|
|
329
|
-
var
|
|
329
|
+
var T = Function.call.bind(ne);
|
|
330
330
|
for (var w in e)
|
|
331
|
-
if (
|
|
331
|
+
if (T(e, w)) {
|
|
332
332
|
var j = void 0;
|
|
333
333
|
try {
|
|
334
334
|
if (typeof e[w] != "function") {
|
|
335
|
-
var M = Error((
|
|
335
|
+
var M = Error((b || "React class") + ": " + l + " type `" + w + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[w] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
336
336
|
throw M.name = "Invariant Violation", M;
|
|
337
337
|
}
|
|
338
|
-
j = e[w](a, w,
|
|
338
|
+
j = e[w](a, w, b, l, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
339
339
|
} catch (D) {
|
|
340
340
|
j = D;
|
|
341
341
|
}
|
|
342
|
-
j && !(j instanceof Error) && (me(
|
|
342
|
+
j && !(j instanceof Error) && (me(C), _("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", b || "React class", l, w, typeof j), me(null)), j instanceof Error && !(j.message in Oe) && (Oe[j.message] = !0, me(C), _("Failed %s type: %s", l, j.message), me(null));
|
|
343
343
|
}
|
|
344
344
|
}
|
|
345
345
|
}
|
|
@@ -355,26 +355,26 @@ function Yr() {
|
|
|
355
355
|
}
|
|
356
356
|
function pr(e) {
|
|
357
357
|
try {
|
|
358
|
-
return
|
|
358
|
+
return De(e), !1;
|
|
359
359
|
} catch {
|
|
360
360
|
return !0;
|
|
361
361
|
}
|
|
362
362
|
}
|
|
363
|
-
function
|
|
363
|
+
function De(e) {
|
|
364
364
|
return "" + e;
|
|
365
365
|
}
|
|
366
|
-
function
|
|
366
|
+
function Pe(e) {
|
|
367
367
|
if (pr(e))
|
|
368
|
-
return _("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", mr(e)),
|
|
368
|
+
return _("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", mr(e)), De(e);
|
|
369
369
|
}
|
|
370
|
-
var
|
|
370
|
+
var Fe = L.ReactCurrentOwner, br = {
|
|
371
371
|
key: !0,
|
|
372
372
|
ref: !0,
|
|
373
373
|
__self: !0,
|
|
374
374
|
__source: !0
|
|
375
|
-
},
|
|
375
|
+
}, $e, Le;
|
|
376
376
|
function xr(e) {
|
|
377
|
-
if (
|
|
377
|
+
if (ne.call(e, "ref")) {
|
|
378
378
|
var a = Object.getOwnPropertyDescriptor(e, "ref").get;
|
|
379
379
|
if (a && a.isReactWarning)
|
|
380
380
|
return !1;
|
|
@@ -382,7 +382,7 @@ function Yr() {
|
|
|
382
382
|
return e.ref !== void 0;
|
|
383
383
|
}
|
|
384
384
|
function hr(e) {
|
|
385
|
-
if (
|
|
385
|
+
if (ne.call(e, "key")) {
|
|
386
386
|
var a = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
387
387
|
if (a && a.isReactWarning)
|
|
388
388
|
return !1;
|
|
@@ -390,12 +390,12 @@ function Yr() {
|
|
|
390
390
|
return e.key !== void 0;
|
|
391
391
|
}
|
|
392
392
|
function vr(e, a) {
|
|
393
|
-
typeof e.ref == "string" &&
|
|
393
|
+
typeof e.ref == "string" && Fe.current;
|
|
394
394
|
}
|
|
395
395
|
function gr(e, a) {
|
|
396
396
|
{
|
|
397
397
|
var l = function() {
|
|
398
|
-
|
|
398
|
+
$e || ($e = !0, _("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", a));
|
|
399
399
|
};
|
|
400
400
|
l.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
401
401
|
get: l,
|
|
@@ -406,7 +406,7 @@ function Yr() {
|
|
|
406
406
|
function yr(e, a) {
|
|
407
407
|
{
|
|
408
408
|
var l = function() {
|
|
409
|
-
|
|
409
|
+
Le || (Le = !0, _("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", a));
|
|
410
410
|
};
|
|
411
411
|
l.isReactWarning = !0, Object.defineProperty(e, "ref", {
|
|
412
412
|
get: l,
|
|
@@ -414,7 +414,7 @@ function Yr() {
|
|
|
414
414
|
});
|
|
415
415
|
}
|
|
416
416
|
}
|
|
417
|
-
var jr = function(e, a, l,
|
|
417
|
+
var jr = function(e, a, l, b, C, T, w) {
|
|
418
418
|
var j = {
|
|
419
419
|
// This tag allows us to uniquely identify this as a React Element
|
|
420
420
|
$$typeof: n,
|
|
@@ -424,7 +424,7 @@ function Yr() {
|
|
|
424
424
|
ref: l,
|
|
425
425
|
props: w,
|
|
426
426
|
// Record the component responsible for creating this element.
|
|
427
|
-
_owner:
|
|
427
|
+
_owner: T
|
|
428
428
|
};
|
|
429
429
|
return j._store = {}, Object.defineProperty(j._store, "validated", {
|
|
430
430
|
configurable: !1,
|
|
@@ -435,46 +435,46 @@ function Yr() {
|
|
|
435
435
|
configurable: !1,
|
|
436
436
|
enumerable: !1,
|
|
437
437
|
writable: !1,
|
|
438
|
-
value:
|
|
438
|
+
value: b
|
|
439
439
|
}), Object.defineProperty(j, "_source", {
|
|
440
440
|
configurable: !1,
|
|
441
441
|
enumerable: !1,
|
|
442
442
|
writable: !1,
|
|
443
|
-
value:
|
|
443
|
+
value: C
|
|
444
444
|
}), Object.freeze && (Object.freeze(j.props), Object.freeze(j)), j;
|
|
445
445
|
};
|
|
446
|
-
function wr(e, a, l,
|
|
446
|
+
function wr(e, a, l, b, C) {
|
|
447
447
|
{
|
|
448
|
-
var
|
|
449
|
-
l !== void 0 && (
|
|
450
|
-
for (
|
|
451
|
-
|
|
448
|
+
var T, w = {}, j = null, M = null;
|
|
449
|
+
l !== void 0 && (Pe(l), j = "" + l), hr(a) && (Pe(a.key), j = "" + a.key), xr(a) && (M = a.ref, vr(a, C));
|
|
450
|
+
for (T in a)
|
|
451
|
+
ne.call(a, T) && !br.hasOwnProperty(T) && (w[T] = a[T]);
|
|
452
452
|
if (e && e.defaultProps) {
|
|
453
453
|
var D = e.defaultProps;
|
|
454
|
-
for (
|
|
455
|
-
w[
|
|
454
|
+
for (T in D)
|
|
455
|
+
w[T] === void 0 && (w[T] = D[T]);
|
|
456
456
|
}
|
|
457
457
|
if (j || M) {
|
|
458
458
|
var P = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
459
459
|
j && gr(w, P), M && yr(w, P);
|
|
460
460
|
}
|
|
461
|
-
return jr(e, j, M,
|
|
461
|
+
return jr(e, j, M, C, b, Fe.current, w);
|
|
462
462
|
}
|
|
463
463
|
}
|
|
464
|
-
var Ce = L.ReactCurrentOwner,
|
|
464
|
+
var Ce = L.ReactCurrentOwner, Me = L.ReactDebugCurrentFrame;
|
|
465
465
|
function Q(e) {
|
|
466
466
|
if (e) {
|
|
467
467
|
var a = e._owner, l = fe(e.type, e._source, a ? a.type : null);
|
|
468
|
-
|
|
468
|
+
Me.setExtraStackFrame(l);
|
|
469
469
|
} else
|
|
470
|
-
|
|
470
|
+
Me.setExtraStackFrame(null);
|
|
471
471
|
}
|
|
472
472
|
var Re;
|
|
473
473
|
Re = !1;
|
|
474
474
|
function Te(e) {
|
|
475
475
|
return typeof e == "object" && e !== null && e.$$typeof === n;
|
|
476
476
|
}
|
|
477
|
-
function
|
|
477
|
+
function We() {
|
|
478
478
|
{
|
|
479
479
|
if (Ce.current) {
|
|
480
480
|
var e = B(Ce.current.type);
|
|
@@ -489,10 +489,10 @@ Check the render method of \`` + e + "`.";
|
|
|
489
489
|
function Er(e) {
|
|
490
490
|
return "";
|
|
491
491
|
}
|
|
492
|
-
var
|
|
492
|
+
var qe = {};
|
|
493
493
|
function kr(e) {
|
|
494
494
|
{
|
|
495
|
-
var a =
|
|
495
|
+
var a = We();
|
|
496
496
|
if (!a) {
|
|
497
497
|
var l = typeof e == "string" ? e : e.displayName || e.name;
|
|
498
498
|
l && (a = `
|
|
@@ -502,35 +502,35 @@ Check the top-level render call using <` + l + ">.");
|
|
|
502
502
|
return a;
|
|
503
503
|
}
|
|
504
504
|
}
|
|
505
|
-
function
|
|
505
|
+
function Ue(e, a) {
|
|
506
506
|
{
|
|
507
507
|
if (!e._store || e._store.validated || e.key != null)
|
|
508
508
|
return;
|
|
509
509
|
e._store.validated = !0;
|
|
510
510
|
var l = kr(a);
|
|
511
|
-
if (
|
|
511
|
+
if (qe[l])
|
|
512
512
|
return;
|
|
513
|
-
|
|
514
|
-
var
|
|
515
|
-
e && e._owner && e._owner !== Ce.current && (
|
|
513
|
+
qe[l] = !0;
|
|
514
|
+
var b = "";
|
|
515
|
+
e && e._owner && e._owner !== Ce.current && (b = " It was passed a child from " + B(e._owner.type) + "."), Q(e), _('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', l, b), Q(null);
|
|
516
516
|
}
|
|
517
517
|
}
|
|
518
|
-
function
|
|
518
|
+
function Ye(e, a) {
|
|
519
519
|
{
|
|
520
520
|
if (typeof e != "object")
|
|
521
521
|
return;
|
|
522
522
|
if (Ne(e))
|
|
523
523
|
for (var l = 0; l < e.length; l++) {
|
|
524
|
-
var
|
|
525
|
-
Te(
|
|
524
|
+
var b = e[l];
|
|
525
|
+
Te(b) && Ue(b, a);
|
|
526
526
|
}
|
|
527
527
|
else if (Te(e))
|
|
528
528
|
e._store && (e._store.validated = !0);
|
|
529
529
|
else if (e) {
|
|
530
|
-
var
|
|
531
|
-
if (typeof
|
|
532
|
-
for (var
|
|
533
|
-
Te(w.value) &&
|
|
530
|
+
var C = N(e);
|
|
531
|
+
if (typeof C == "function" && C !== e.entries)
|
|
532
|
+
for (var T = C.call(e), w; !(w = T.next()).done; )
|
|
533
|
+
Te(w.value) && Ue(w.value, a);
|
|
534
534
|
}
|
|
535
535
|
}
|
|
536
536
|
}
|
|
@@ -542,19 +542,19 @@ Check the top-level render call using <` + l + ">.");
|
|
|
542
542
|
var l;
|
|
543
543
|
if (typeof a == "function")
|
|
544
544
|
l = a.propTypes;
|
|
545
|
-
else if (typeof a == "object" && (a.$$typeof ===
|
|
545
|
+
else if (typeof a == "object" && (a.$$typeof === u || // Note: Memo only checks outer props here.
|
|
546
546
|
// Inner props are checked in the reconciler.
|
|
547
|
-
a.$$typeof ===
|
|
547
|
+
a.$$typeof === f))
|
|
548
548
|
l = a.propTypes;
|
|
549
549
|
else
|
|
550
550
|
return;
|
|
551
551
|
if (l) {
|
|
552
|
-
var
|
|
553
|
-
ur(l, e.props, "prop",
|
|
552
|
+
var b = B(a);
|
|
553
|
+
ur(l, e.props, "prop", b, e);
|
|
554
554
|
} else if (a.PropTypes !== void 0 && !Re) {
|
|
555
555
|
Re = !0;
|
|
556
|
-
var
|
|
557
|
-
_("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",
|
|
556
|
+
var C = B(a);
|
|
557
|
+
_("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", C || "Unknown");
|
|
558
558
|
}
|
|
559
559
|
typeof a.getDefaultProps == "function" && !a.getDefaultProps.isReactClassApproved && _("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
560
560
|
}
|
|
@@ -562,73 +562,73 @@ Check the top-level render call using <` + l + ">.");
|
|
|
562
562
|
function Cr(e) {
|
|
563
563
|
{
|
|
564
564
|
for (var a = Object.keys(e.props), l = 0; l < a.length; l++) {
|
|
565
|
-
var
|
|
566
|
-
if (
|
|
567
|
-
Q(e), _("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",
|
|
565
|
+
var b = a[l];
|
|
566
|
+
if (b !== "children" && b !== "key") {
|
|
567
|
+
Q(e), _("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", b), Q(null);
|
|
568
568
|
break;
|
|
569
569
|
}
|
|
570
570
|
}
|
|
571
571
|
e.ref !== null && (Q(e), _("Invalid attribute `ref` supplied to `React.Fragment`."), Q(null));
|
|
572
572
|
}
|
|
573
573
|
}
|
|
574
|
-
var
|
|
575
|
-
function
|
|
574
|
+
var Ve = {};
|
|
575
|
+
function Be(e, a, l, b, C, T) {
|
|
576
576
|
{
|
|
577
577
|
var w = J(e);
|
|
578
578
|
if (!w) {
|
|
579
579
|
var j = "";
|
|
580
580
|
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (j += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
581
581
|
var M = Er();
|
|
582
|
-
M ? j += M : j +=
|
|
582
|
+
M ? j += M : j += We();
|
|
583
583
|
var D;
|
|
584
584
|
e === null ? D = "null" : Ne(e) ? D = "array" : e !== void 0 && e.$$typeof === n ? (D = "<" + (B(e.type) || "Unknown") + " />", j = " Did you accidentally export a JSX literal instead of a component?") : D = typeof e, _("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", D, j);
|
|
585
585
|
}
|
|
586
|
-
var P = wr(e, a, l,
|
|
586
|
+
var P = wr(e, a, l, C, T);
|
|
587
587
|
if (P == null)
|
|
588
588
|
return P;
|
|
589
589
|
if (w) {
|
|
590
590
|
var V = a.children;
|
|
591
591
|
if (V !== void 0)
|
|
592
|
-
if (
|
|
592
|
+
if (b)
|
|
593
593
|
if (Ne(V)) {
|
|
594
594
|
for (var Z = 0; Z < V.length; Z++)
|
|
595
|
-
|
|
595
|
+
Ye(V[Z], e);
|
|
596
596
|
Object.freeze && Object.freeze(V);
|
|
597
597
|
} else
|
|
598
598
|
_("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
599
599
|
else
|
|
600
|
-
|
|
600
|
+
Ye(V, e);
|
|
601
601
|
}
|
|
602
|
-
if (
|
|
602
|
+
if (ne.call(a, "key")) {
|
|
603
603
|
var G = B(e), W = Object.keys(a).filter(function(Or) {
|
|
604
604
|
return Or !== "key";
|
|
605
605
|
}), Se = W.length > 0 ? "{key: someKey, " + W.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
606
|
-
if (!
|
|
606
|
+
if (!Ve[G + Se]) {
|
|
607
607
|
var Ir = W.length > 0 ? "{" + W.join(": ..., ") + ": ...}" : "{}";
|
|
608
608
|
_(`A props object containing a "key" prop is being spread into JSX:
|
|
609
609
|
let props = %s;
|
|
610
610
|
<%s {...props} />
|
|
611
611
|
React keys must be passed directly to JSX without using spread:
|
|
612
612
|
let props = %s;
|
|
613
|
-
<%s key={someKey} {...props} />`, Se, G, Ir, G),
|
|
613
|
+
<%s key={someKey} {...props} />`, Se, G, Ir, G), Ve[G + Se] = !0;
|
|
614
614
|
}
|
|
615
615
|
}
|
|
616
616
|
return e === i ? Cr(P) : Nr(P), P;
|
|
617
617
|
}
|
|
618
618
|
}
|
|
619
619
|
function Rr(e, a, l) {
|
|
620
|
-
return
|
|
620
|
+
return Be(e, a, l, !0);
|
|
621
621
|
}
|
|
622
622
|
function Tr(e, a, l) {
|
|
623
|
-
return
|
|
623
|
+
return Be(e, a, l, !1);
|
|
624
624
|
}
|
|
625
625
|
var Sr = Tr, _r = Rr;
|
|
626
|
-
|
|
627
|
-
})()),
|
|
626
|
+
se.Fragment = i, se.jsx = Sr, se.jsxs = _r;
|
|
627
|
+
})()), se;
|
|
628
628
|
}
|
|
629
|
-
var
|
|
629
|
+
var Ge;
|
|
630
630
|
function Vr() {
|
|
631
|
-
return
|
|
631
|
+
return Ge || (Ge = 1, process.env.NODE_ENV === "production" ? pe.exports = Ur() : pe.exports = Yr()), pe.exports;
|
|
632
632
|
}
|
|
633
633
|
var r = Vr();
|
|
634
634
|
function nr({
|
|
@@ -636,35 +636,35 @@ function nr({
|
|
|
636
636
|
onClose: n,
|
|
637
637
|
data: s,
|
|
638
638
|
title: i = "Data Viewer",
|
|
639
|
-
placement:
|
|
639
|
+
placement: c = "center",
|
|
640
640
|
// "center" | "bottom"
|
|
641
|
-
pretty:
|
|
642
|
-
defaultMode:
|
|
641
|
+
pretty: h = 2,
|
|
642
|
+
defaultMode: m = "yaml",
|
|
643
643
|
// "json" | "yaml"
|
|
644
|
-
fileBaseName:
|
|
645
|
-
contentClassName:
|
|
644
|
+
fileBaseName: o = "form-data",
|
|
645
|
+
contentClassName: u = ""
|
|
646
646
|
}) {
|
|
647
|
-
const g =
|
|
648
|
-
const
|
|
647
|
+
const g = c === "center", [p, f] = E.useState(m === "yaml" ? "yaml" : "json"), x = E.useMemo(() => {
|
|
648
|
+
const N = Math.max(2, h | 0);
|
|
649
649
|
try {
|
|
650
|
-
return
|
|
651
|
-
indent:
|
|
650
|
+
return p === "yaml" ? qr.dump(s ?? {}, {
|
|
651
|
+
indent: N,
|
|
652
652
|
lineWidth: 80,
|
|
653
653
|
noRefs: !0,
|
|
654
654
|
forceQuotes: !0,
|
|
655
655
|
skipInvalid: !0
|
|
656
|
-
}) : JSON.stringify(s ?? {}, null,
|
|
656
|
+
}) : JSON.stringify(s ?? {}, null, N);
|
|
657
657
|
} catch {
|
|
658
|
-
return
|
|
658
|
+
return p === "yaml" ? "# Failed to render YAML" : String(s);
|
|
659
659
|
}
|
|
660
|
-
}, [s,
|
|
661
|
-
|
|
662
|
-
const L =
|
|
663
|
-
O.href = F, O.download = `${
|
|
664
|
-
}, S = async (
|
|
665
|
-
|
|
660
|
+
}, [s, p, h]), k = (N) => N.stopPropagation(), v = (N) => {
|
|
661
|
+
k(N);
|
|
662
|
+
const L = p === "yaml", _ = new Blob([x], { type: L ? "text/yaml" : "application/json" }), F = URL.createObjectURL(_), O = document.createElement("a");
|
|
663
|
+
O.href = F, O.download = `${o}.${L ? "yml" : "json"}`, O.click(), URL.revokeObjectURL(F);
|
|
664
|
+
}, S = async (N) => {
|
|
665
|
+
k(N);
|
|
666
666
|
try {
|
|
667
|
-
await navigator.clipboard.writeText(
|
|
667
|
+
await navigator.clipboard.writeText(x);
|
|
668
668
|
} catch {
|
|
669
669
|
}
|
|
670
670
|
};
|
|
@@ -681,7 +681,7 @@ function nr({
|
|
|
681
681
|
children: /* @__PURE__ */ r.jsx("div", { className: "w-full h-full flex items-end sm:items-center justify-center sm:max-w-4xl", children: /* @__PURE__ */ r.jsxs(
|
|
682
682
|
K.div,
|
|
683
683
|
{
|
|
684
|
-
onMouseDown:
|
|
684
|
+
onMouseDown: k,
|
|
685
685
|
initial: { y: g ? 20 : "100%", opacity: g ? 0 : 1, scale: g ? 0.98 : 1 },
|
|
686
686
|
animate: { y: 0, opacity: 1, scale: 1 },
|
|
687
687
|
exit: { y: g ? 20 : "100%", opacity: g ? 0 : 1, scale: g ? 0.98 : 1 },
|
|
@@ -692,7 +692,7 @@ function nr({
|
|
|
692
692
|
/* @__PURE__ */ r.jsxs("h3", { className: "font-semibold", children: [
|
|
693
693
|
i,
|
|
694
694
|
" (",
|
|
695
|
-
|
|
695
|
+
p.toUpperCase(),
|
|
696
696
|
")"
|
|
697
697
|
] }),
|
|
698
698
|
/* @__PURE__ */ r.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
@@ -700,10 +700,10 @@ function nr({
|
|
|
700
700
|
/* @__PURE__ */ r.jsx(
|
|
701
701
|
"button",
|
|
702
702
|
{
|
|
703
|
-
className: `px-3 py-1 text-sm ${
|
|
704
|
-
"aria-pressed":
|
|
705
|
-
onClick: (
|
|
706
|
-
|
|
703
|
+
className: `px-3 py-1 text-sm ${p === "yaml" ? "bg-black/6" : "bg-gray-200 hover:bg-black/5"}`,
|
|
704
|
+
"aria-pressed": p === "yaml",
|
|
705
|
+
onClick: (N) => {
|
|
706
|
+
k(N), f("yaml");
|
|
707
707
|
},
|
|
708
708
|
children: "YAML"
|
|
709
709
|
}
|
|
@@ -711,10 +711,10 @@ function nr({
|
|
|
711
711
|
/* @__PURE__ */ r.jsx(
|
|
712
712
|
"button",
|
|
713
713
|
{
|
|
714
|
-
className: `px-3 py-1 text-sm ${
|
|
715
|
-
"aria-pressed":
|
|
716
|
-
onClick: (
|
|
717
|
-
|
|
714
|
+
className: `px-3 py-1 text-sm ${p === "json" ? "bg-black/6" : "bg-gray-200 hover:bg-black/5"}`,
|
|
715
|
+
"aria-pressed": p === "json",
|
|
716
|
+
onClick: (N) => {
|
|
717
|
+
k(N), f("json");
|
|
718
718
|
},
|
|
719
719
|
children: "JSON"
|
|
720
720
|
}
|
|
@@ -726,15 +726,15 @@ function nr({
|
|
|
726
726
|
"button",
|
|
727
727
|
{
|
|
728
728
|
className: "px-3 py-1 rounded-lg border border-black/10 hover:bg-black/5 text-sm",
|
|
729
|
-
onClick: (
|
|
730
|
-
|
|
729
|
+
onClick: (N) => {
|
|
730
|
+
k(N), n == null || n();
|
|
731
731
|
},
|
|
732
732
|
children: "Close"
|
|
733
733
|
}
|
|
734
734
|
)
|
|
735
735
|
] })
|
|
736
736
|
] }),
|
|
737
|
-
/* @__PURE__ */ r.jsx("div", { className: g ? `p-4 overflow-auto max-h-[70vh] ${
|
|
737
|
+
/* @__PURE__ */ r.jsx("div", { className: g ? `p-4 overflow-auto max-h-[70vh] ${u}` : `mt-2 p-2 rounded-lg overflow-y-auto max-h-96 ${u}`, children: /* @__PURE__ */ r.jsx("pre", { className: "whitespace-pre-wrap break-words text-sm text-gray-700", children: x }) })
|
|
738
738
|
]
|
|
739
739
|
}
|
|
740
740
|
) })
|
|
@@ -742,18 +742,18 @@ function nr({
|
|
|
742
742
|
) });
|
|
743
743
|
}
|
|
744
744
|
function Br() {
|
|
745
|
-
const [t, n] = xe(!1), s = q((g) => g.replaceAll), i =
|
|
745
|
+
const [t, n] = xe(!1), s = q((g) => g.replaceAll), i = rr(), c = H(), h = c.state.isPreview, m = (g) => {
|
|
746
746
|
try {
|
|
747
|
-
const
|
|
748
|
-
if (!Array.isArray(
|
|
749
|
-
s(
|
|
750
|
-
} catch (
|
|
751
|
-
alert((
|
|
747
|
+
const p = String(g).replace(/^\uFEFF/, "").trim(), f = JSON.parse(p), x = Array.isArray(f) ? f : f == null ? void 0 : f.fields;
|
|
748
|
+
if (!Array.isArray(x)) throw new Error("Expected [] or { fields: [] }");
|
|
749
|
+
s(x), c.selectedFieldId.clear(), c.preview.set(!1);
|
|
750
|
+
} catch (p) {
|
|
751
|
+
alert((p == null ? void 0 : p.message) || "Invalid JSON format");
|
|
752
752
|
}
|
|
753
|
-
},
|
|
754
|
-
|
|
755
|
-
},
|
|
756
|
-
|
|
753
|
+
}, o = () => {
|
|
754
|
+
c.preview.set(!0), c.selectedFieldId.clear();
|
|
755
|
+
}, u = () => {
|
|
756
|
+
c.preview.set(!1);
|
|
757
757
|
};
|
|
758
758
|
return /* @__PURE__ */ r.jsxs("header", { className: "sticky top-0 z-49 bg-transparent mx-auto", children: [
|
|
759
759
|
/* @__PURE__ */ r.jsxs("div", { className: "py-6 text-center", children: [
|
|
@@ -765,16 +765,16 @@ function Br() {
|
|
|
765
765
|
/* @__PURE__ */ r.jsx(
|
|
766
766
|
"button",
|
|
767
767
|
{
|
|
768
|
-
className: `py-3 rounded-xl text-sm font-medium ${
|
|
769
|
-
onClick:
|
|
768
|
+
className: `py-3 rounded-xl text-sm font-medium ${h ? "" : "bg-black/10"}`,
|
|
769
|
+
onClick: u,
|
|
770
770
|
children: "Builder"
|
|
771
771
|
}
|
|
772
772
|
),
|
|
773
773
|
/* @__PURE__ */ r.jsx(
|
|
774
774
|
"button",
|
|
775
775
|
{
|
|
776
|
-
className: `py-3 rounded-xl text-sm font-medium ${
|
|
777
|
-
onClick:
|
|
776
|
+
className: `py-3 rounded-xl text-sm font-medium ${h ? "bg-black/10" : ""}`,
|
|
777
|
+
onClick: o,
|
|
778
778
|
children: "Preview"
|
|
779
779
|
}
|
|
780
780
|
)
|
|
@@ -789,14 +789,14 @@ function Br() {
|
|
|
789
789
|
type: "file",
|
|
790
790
|
accept: ".json,application/json",
|
|
791
791
|
onChange: (g) => {
|
|
792
|
-
var
|
|
793
|
-
const
|
|
794
|
-
if (!
|
|
795
|
-
const
|
|
796
|
-
|
|
792
|
+
var x;
|
|
793
|
+
const p = (x = g.target.files) == null ? void 0 : x[0];
|
|
794
|
+
if (!p) return;
|
|
795
|
+
const f = new FileReader();
|
|
796
|
+
f.onload = (k) => {
|
|
797
797
|
var v;
|
|
798
|
-
return
|
|
799
|
-
},
|
|
798
|
+
return m(((v = k.target) == null ? void 0 : v.result) ?? "");
|
|
799
|
+
}, f.readAsText(p), g.target.value = "";
|
|
800
800
|
}
|
|
801
801
|
}
|
|
802
802
|
)
|
|
@@ -825,20 +825,20 @@ function Br() {
|
|
|
825
825
|
] });
|
|
826
826
|
}
|
|
827
827
|
function Jr() {
|
|
828
|
-
const [t, n] = xe(!1), [s, i] = xe(!1),
|
|
829
|
-
n((
|
|
830
|
-
}, m = () => {
|
|
831
|
-
i((h) => !h), n(!1);
|
|
828
|
+
const [t, n] = xe(!1), [s, i] = xe(!1), c = er(null), h = q((x) => x.addField), m = rr(), o = H(), u = o.state.isPreview, g = () => {
|
|
829
|
+
n((x) => !x), i(!1);
|
|
832
830
|
}, p = () => {
|
|
833
|
-
|
|
831
|
+
i((x) => !x), n(!1);
|
|
832
|
+
}, f = () => {
|
|
833
|
+
o.preview.toggle(), n(!1), i(!1);
|
|
834
834
|
};
|
|
835
835
|
return ee(() => {
|
|
836
836
|
if (!t || s) return;
|
|
837
|
-
const
|
|
838
|
-
const v =
|
|
839
|
-
v && !v.contains(
|
|
837
|
+
const x = (k) => {
|
|
838
|
+
const v = c.current;
|
|
839
|
+
v && !v.contains(k.target) && (n(!1), i(!1));
|
|
840
840
|
};
|
|
841
|
-
return document.addEventListener("pointerdown",
|
|
841
|
+
return document.addEventListener("pointerdown", x), () => document.removeEventListener("pointerdown", x);
|
|
842
842
|
}, [t, s]), /* @__PURE__ */ r.jsxs("div", { className: "MobileToolBar fixed bottom-0 left-0 w-full text-stone-900 shadow-lg z-10", children: [
|
|
843
843
|
/* @__PURE__ */ r.jsxs(
|
|
844
844
|
K.div,
|
|
@@ -846,23 +846,23 @@ function Jr() {
|
|
|
846
846
|
initial: { y: "100%" },
|
|
847
847
|
animate: { y: "0%" },
|
|
848
848
|
transition: { duration: 0.8, ease: [0.25, 0.1, 0.25, 1] },
|
|
849
|
-
className: `flex ${
|
|
849
|
+
className: `flex ${u ? "justify-center" : "justify-around"} pb-5 max-w-xl sm:max-w-4xl mx-auto`,
|
|
850
850
|
children: [
|
|
851
851
|
/* @__PURE__ */ r.jsx(
|
|
852
852
|
K.button,
|
|
853
853
|
{
|
|
854
|
-
onClick:
|
|
854
|
+
onClick: f,
|
|
855
855
|
initial: { opacity: 1, scale: 1, x: "0%" },
|
|
856
856
|
animate: {
|
|
857
857
|
opacity: t || s ? 0 : 1,
|
|
858
858
|
scale: t || s ? 0 : 1,
|
|
859
|
-
x:
|
|
859
|
+
x: u ? "120%" : "0%"
|
|
860
860
|
},
|
|
861
|
-
className: `relative cursor-pointer ${
|
|
862
|
-
children:
|
|
861
|
+
className: `relative cursor-pointer ${u ? "mx-29" : ""} bg-black/5 rounded-2xl p-3 backdrop-blur-xl`,
|
|
862
|
+
children: u ? /* @__PURE__ */ r.jsx(Dr, { className: "h-12 w-12" }) : /* @__PURE__ */ r.jsx(Ar, { className: "h-12 w-12" })
|
|
863
863
|
}
|
|
864
864
|
),
|
|
865
|
-
!
|
|
865
|
+
!u && /* @__PURE__ */ r.jsx(
|
|
866
866
|
K.button,
|
|
867
867
|
{
|
|
868
868
|
onClick: g,
|
|
@@ -878,14 +878,14 @@ function Jr() {
|
|
|
878
878
|
/* @__PURE__ */ r.jsx(
|
|
879
879
|
K.button,
|
|
880
880
|
{
|
|
881
|
-
onClick:
|
|
881
|
+
onClick: p,
|
|
882
882
|
initial: { opacity: 1, scale: 1, x: "0%" },
|
|
883
883
|
animate: {
|
|
884
884
|
opacity: s || t ? 0 : 1,
|
|
885
885
|
scale: s || t ? 0 : 1,
|
|
886
|
-
x:
|
|
886
|
+
x: u ? "-120%" : "0%"
|
|
887
887
|
},
|
|
888
|
-
className: `relative cursor-pointer ${
|
|
888
|
+
className: `relative cursor-pointer ${u ? "mx-29" : ""} bg-black/5 rounded-2xl p-3 backdrop-blur-xl`,
|
|
889
889
|
children: /* @__PURE__ */ r.jsx(Fr, { className: "h-12 w-12" })
|
|
890
890
|
}
|
|
891
891
|
)
|
|
@@ -897,7 +897,7 @@ function Jr() {
|
|
|
897
897
|
{
|
|
898
898
|
open: s,
|
|
899
899
|
onClose: () => i(!1),
|
|
900
|
-
data:
|
|
900
|
+
data: m,
|
|
901
901
|
title: "Form Data",
|
|
902
902
|
placement: "bottom",
|
|
903
903
|
contentClassName: "custom-scrollbar"
|
|
@@ -906,8 +906,8 @@ function Jr() {
|
|
|
906
906
|
/* @__PURE__ */ r.jsx(
|
|
907
907
|
K.div,
|
|
908
908
|
{
|
|
909
|
-
ref:
|
|
910
|
-
onPointerDown: (
|
|
909
|
+
ref: c,
|
|
910
|
+
onPointerDown: (x) => x.stopPropagation(),
|
|
911
911
|
initial: { opacity: 0, y: "100%", scale: 0 },
|
|
912
912
|
animate: {
|
|
913
913
|
opacity: t ? 1 : 0,
|
|
@@ -918,45 +918,45 @@ function Jr() {
|
|
|
918
918
|
className: "MobileToolBar-Modal fixed bottom-0 w-full mx-auto bg-black/5 border-black/15 border px-9 py-4 mb-2 rounded-2xl backdrop-blur-xl overflow-y-scroll",
|
|
919
919
|
children: /* @__PURE__ */ r.jsxs("div", { className: "grid grid-cols-1 gap-2", children: [
|
|
920
920
|
/* @__PURE__ */ r.jsx("button", { className: "flex w-full justify-end", onClick: () => n(!1), children: /* @__PURE__ */ r.jsx($r, {}) }),
|
|
921
|
-
Object.keys(le).map((
|
|
921
|
+
Object.keys(le).map((x) => /* @__PURE__ */ r.jsxs(
|
|
922
922
|
"button",
|
|
923
923
|
{
|
|
924
924
|
className: "px-4 pl-6 py-2 text-black text-left rounded hover:bg-slate-50",
|
|
925
925
|
onClick: () => {
|
|
926
|
-
|
|
926
|
+
h(x), n(!1);
|
|
927
927
|
},
|
|
928
928
|
children: [
|
|
929
929
|
"Add ",
|
|
930
|
-
le[
|
|
930
|
+
le[x].label
|
|
931
931
|
]
|
|
932
932
|
},
|
|
933
|
-
|
|
933
|
+
x
|
|
934
934
|
))
|
|
935
935
|
] })
|
|
936
936
|
}
|
|
937
937
|
)
|
|
938
938
|
] });
|
|
939
939
|
}
|
|
940
|
-
const
|
|
940
|
+
const Ke = Object.entries(le).map(([t, n]) => ({
|
|
941
941
|
type: t,
|
|
942
942
|
label: n.label
|
|
943
943
|
})), zr = ({ isPreview: t = !1 }) => {
|
|
944
944
|
if (t) return null;
|
|
945
|
-
const n = q((i) => i.addField), s =
|
|
945
|
+
const n = q((i) => i.addField), s = ie(() => {
|
|
946
946
|
const i = {};
|
|
947
|
-
for (const { type:
|
|
947
|
+
for (const { type: c } of Ke) i[c] = () => n(c);
|
|
948
948
|
return i;
|
|
949
949
|
}, [n]);
|
|
950
950
|
return /* @__PURE__ */ r.jsxs("div", { className: "p-4 bg-white border border-gray-200 rounded-lg shadow-sm", children: [
|
|
951
951
|
/* @__PURE__ */ r.jsx("h3", { className: "text-lg font-semibold mb-3", children: "Tools" }),
|
|
952
|
-
/* @__PURE__ */ r.jsx("div", { className: "grid grid-cols-1 gap-2", children:
|
|
952
|
+
/* @__PURE__ */ r.jsx("div", { className: "grid grid-cols-1 gap-2", children: Ke.map(({ type: i, label: c }) => /* @__PURE__ */ r.jsxs(
|
|
953
953
|
"button",
|
|
954
954
|
{
|
|
955
955
|
className: "px-3 py-2 text-left border border-black/10 rounded-md hover:bg-slate-50",
|
|
956
956
|
onClick: s[i],
|
|
957
957
|
children: [
|
|
958
958
|
"Add ",
|
|
959
|
-
|
|
959
|
+
c
|
|
960
960
|
]
|
|
961
961
|
},
|
|
962
962
|
i
|
|
@@ -968,48 +968,48 @@ function ar({
|
|
|
968
968
|
label: n = "ID",
|
|
969
969
|
onCommit: s,
|
|
970
970
|
validate: i,
|
|
971
|
-
placeholder:
|
|
972
|
-
className:
|
|
971
|
+
placeholder: c = "Enter unique ID…",
|
|
972
|
+
className: h = ""
|
|
973
973
|
}) {
|
|
974
|
-
const [
|
|
974
|
+
const [m, o] = E.useState(t ?? ""), [u, g] = E.useState("");
|
|
975
975
|
E.useEffect(() => {
|
|
976
|
-
|
|
976
|
+
o(t ?? ""), g("");
|
|
977
977
|
}, [t]);
|
|
978
|
-
const
|
|
979
|
-
const
|
|
980
|
-
if (!
|
|
981
|
-
g("ID cannot be empty."),
|
|
978
|
+
const p = E.useCallback(() => {
|
|
979
|
+
const f = String(m ?? "").trim();
|
|
980
|
+
if (!f) {
|
|
981
|
+
g("ID cannot be empty."), o(t ?? "");
|
|
982
982
|
return;
|
|
983
983
|
}
|
|
984
|
-
if (
|
|
984
|
+
if (f !== (t ?? "")) {
|
|
985
985
|
if (typeof i == "function") {
|
|
986
|
-
const
|
|
987
|
-
if (
|
|
988
|
-
g(
|
|
986
|
+
const x = i(f, t ?? "");
|
|
987
|
+
if (x) {
|
|
988
|
+
g(x);
|
|
989
989
|
return;
|
|
990
990
|
}
|
|
991
991
|
}
|
|
992
|
-
s == null || s(
|
|
992
|
+
s == null || s(f);
|
|
993
993
|
}
|
|
994
|
-
}, [
|
|
995
|
-
return /* @__PURE__ */ r.jsxs("div", { className:
|
|
994
|
+
}, [m, t, s, i]);
|
|
995
|
+
return /* @__PURE__ */ r.jsxs("div", { className: h, children: [
|
|
996
996
|
/* @__PURE__ */ r.jsx("label", { className: "block text-sm mb-1", children: n }),
|
|
997
997
|
/* @__PURE__ */ r.jsx(
|
|
998
998
|
"input",
|
|
999
999
|
{
|
|
1000
1000
|
className: "w-full px-3 py-2 border border-black/20 rounded",
|
|
1001
|
-
value:
|
|
1002
|
-
onChange: (
|
|
1003
|
-
|
|
1001
|
+
value: m,
|
|
1002
|
+
onChange: (f) => {
|
|
1003
|
+
u && g(""), o(f.target.value);
|
|
1004
1004
|
},
|
|
1005
|
-
onBlur:
|
|
1006
|
-
onKeyDown: (
|
|
1007
|
-
|
|
1005
|
+
onBlur: p,
|
|
1006
|
+
onKeyDown: (f) => {
|
|
1007
|
+
f.key === "Enter" && (f.preventDefault(), p());
|
|
1008
1008
|
},
|
|
1009
|
-
placeholder:
|
|
1009
|
+
placeholder: c
|
|
1010
1010
|
}
|
|
1011
1011
|
),
|
|
1012
|
-
|
|
1012
|
+
u ? /* @__PURE__ */ r.jsx("p", { className: "text-xs text-red-600 mt-1", children: u }) : null
|
|
1013
1013
|
] });
|
|
1014
1014
|
}
|
|
1015
1015
|
function sr({ f: t, onUpdateField: n }) {
|
|
@@ -1074,13 +1074,13 @@ function Xr() {
|
|
|
1074
1074
|
}
|
|
1075
1075
|
return _e(Hr);
|
|
1076
1076
|
}
|
|
1077
|
-
const Qr = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto),
|
|
1077
|
+
const Qr = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), He = { randomUUID: Qr };
|
|
1078
1078
|
function Zr(t, n, s) {
|
|
1079
|
-
var
|
|
1080
|
-
if (
|
|
1081
|
-
return
|
|
1079
|
+
var c;
|
|
1080
|
+
if (He.randomUUID && !t)
|
|
1081
|
+
return He.randomUUID();
|
|
1082
1082
|
t = t || {};
|
|
1083
|
-
const i = t.random ?? ((
|
|
1083
|
+
const i = t.random ?? ((c = t.rng) == null ? void 0 : c.call(t)) ?? Xr();
|
|
1084
1084
|
if (i.length < 16)
|
|
1085
1085
|
throw new Error("Random bytes length must be >= 16");
|
|
1086
1086
|
return i[6] = i[6] & 15 | 64, i[8] = i[8] & 63 | 128, Kr(i);
|
|
@@ -1088,38 +1088,38 @@ function Zr(t, n, s) {
|
|
|
1088
1088
|
function ir({ field: t, onUpdateField: n }) {
|
|
1089
1089
|
const s = t.options || [], i = () => {
|
|
1090
1090
|
n("options", [...s, { id: Zr(), value: "" }]);
|
|
1091
|
-
},
|
|
1091
|
+
}, c = (m, o) => {
|
|
1092
1092
|
n(
|
|
1093
1093
|
"options",
|
|
1094
|
-
s.map((
|
|
1094
|
+
s.map((u) => u.id === m ? { ...u, value: o } : u)
|
|
1095
1095
|
);
|
|
1096
|
-
},
|
|
1096
|
+
}, h = (m) => {
|
|
1097
1097
|
n(
|
|
1098
1098
|
"options",
|
|
1099
|
-
s.filter((
|
|
1099
|
+
s.filter((o) => o.id !== m)
|
|
1100
1100
|
);
|
|
1101
1101
|
};
|
|
1102
1102
|
return /* @__PURE__ */ r.jsxs("div", { className: "mt-3", children: [
|
|
1103
1103
|
/* @__PURE__ */ r.jsx("div", { className: "text-sm font-medium mb-1", children: "Options" }),
|
|
1104
|
-
s.map((
|
|
1104
|
+
s.map((m) => /* @__PURE__ */ r.jsxs("div", { className: "flex items-center gap-2 mb-2", children: [
|
|
1105
1105
|
/* @__PURE__ */ r.jsx(
|
|
1106
1106
|
"input",
|
|
1107
1107
|
{
|
|
1108
1108
|
className: "flex-1 px-3 py-2 border border-black/20 rounded",
|
|
1109
|
-
value:
|
|
1110
|
-
onChange: (
|
|
1109
|
+
value: m.value,
|
|
1110
|
+
onChange: (o) => c(m.id, o.target.value),
|
|
1111
1111
|
placeholder: "Option text"
|
|
1112
1112
|
}
|
|
1113
1113
|
),
|
|
1114
1114
|
/* @__PURE__ */ r.jsx(
|
|
1115
1115
|
"button",
|
|
1116
1116
|
{
|
|
1117
|
-
onClick: () =>
|
|
1117
|
+
onClick: () => h(m.id),
|
|
1118
1118
|
className: "px-2 py-1 text-sm border border-black/20 rounded hover:bg-slate-50",
|
|
1119
1119
|
children: "Remove"
|
|
1120
1120
|
}
|
|
1121
1121
|
)
|
|
1122
|
-
] },
|
|
1122
|
+
] }, m.id)),
|
|
1123
1123
|
/* @__PURE__ */ r.jsx(
|
|
1124
1124
|
"button",
|
|
1125
1125
|
{
|
|
@@ -1132,9 +1132,9 @@ function ir({ field: t, onUpdateField: n }) {
|
|
|
1132
1132
|
}
|
|
1133
1133
|
function et({ f: t }) {
|
|
1134
1134
|
const n = tr(t.id), s = be(
|
|
1135
|
-
(
|
|
1135
|
+
(c, h) => n.field.update(c, h),
|
|
1136
1136
|
[n]
|
|
1137
|
-
), i =
|
|
1137
|
+
), i = ie(
|
|
1138
1138
|
() => ["radio", "check", "selection"].includes(t.fieldType),
|
|
1139
1139
|
[t.fieldType]
|
|
1140
1140
|
);
|
|
@@ -1148,7 +1148,7 @@ function et({ f: t }) {
|
|
|
1148
1148
|
{
|
|
1149
1149
|
className: "w-full px-3 py-2 border border-black/20 rounded",
|
|
1150
1150
|
value: t.answer || "",
|
|
1151
|
-
onChange: (
|
|
1151
|
+
onChange: (c) => s("answer", c.target.value),
|
|
1152
1152
|
placeholder: "Default value"
|
|
1153
1153
|
}
|
|
1154
1154
|
)
|
|
@@ -1157,57 +1157,57 @@ function et({ f: t }) {
|
|
|
1157
1157
|
] });
|
|
1158
1158
|
}
|
|
1159
1159
|
function rt({ section: t, onActiveChildChange: n }) {
|
|
1160
|
-
var
|
|
1161
|
-
const s = tr(t.id), i = Array.isArray(t.fields) ? t.fields : [], [
|
|
1160
|
+
var f, x, k;
|
|
1161
|
+
const s = tr(t.id), i = Array.isArray(t.fields) ? t.fields : [], [c, h] = xe(((f = i[0]) == null ? void 0 : f.id) || null);
|
|
1162
1162
|
ee(() => {
|
|
1163
1163
|
var v;
|
|
1164
|
-
|
|
1164
|
+
h(((v = i[0]) == null ? void 0 : v.id) || null);
|
|
1165
1165
|
}, [t.id]), ee(() => {
|
|
1166
1166
|
if (!i.length) {
|
|
1167
|
-
|
|
1167
|
+
c !== null && h(null);
|
|
1168
1168
|
return;
|
|
1169
1169
|
}
|
|
1170
|
-
i.some((S) => S.id ===
|
|
1171
|
-
}, [i,
|
|
1172
|
-
n == null || n(t.id,
|
|
1173
|
-
}, [t.id,
|
|
1174
|
-
const
|
|
1170
|
+
i.some((S) => S.id === c) || h(i[0].id);
|
|
1171
|
+
}, [i, c]), ee(() => {
|
|
1172
|
+
n == null || n(t.id, c || null);
|
|
1173
|
+
}, [t.id, c, n]);
|
|
1174
|
+
const m = be(
|
|
1175
1175
|
(v, S) => s.field.update(v, S),
|
|
1176
1176
|
[s]
|
|
1177
|
-
),
|
|
1178
|
-
() => i.find((v) => v.id ===
|
|
1179
|
-
[i,
|
|
1180
|
-
),
|
|
1177
|
+
), o = ie(
|
|
1178
|
+
() => i.find((v) => v.id === c) || null,
|
|
1179
|
+
[i, c]
|
|
1180
|
+
), u = be(
|
|
1181
1181
|
(v, S) => {
|
|
1182
|
-
if (
|
|
1182
|
+
if (o) {
|
|
1183
1183
|
if (v === "id") {
|
|
1184
|
-
const
|
|
1185
|
-
if (!
|
|
1184
|
+
const N = String(S ?? "").trim();
|
|
1185
|
+
if (!N) return;
|
|
1186
1186
|
q.getState().updateField(
|
|
1187
|
-
|
|
1188
|
-
{ id:
|
|
1187
|
+
o.id,
|
|
1188
|
+
{ id: N },
|
|
1189
1189
|
{
|
|
1190
1190
|
sectionId: t.id,
|
|
1191
1191
|
onIdChange: (L, _) => {
|
|
1192
|
-
|
|
1192
|
+
h((F) => F === _ ? L : F);
|
|
1193
1193
|
}
|
|
1194
1194
|
}
|
|
1195
1195
|
);
|
|
1196
1196
|
return;
|
|
1197
1197
|
}
|
|
1198
1198
|
q.getState().updateField(
|
|
1199
|
-
|
|
1199
|
+
o.id,
|
|
1200
1200
|
{ [v]: S },
|
|
1201
1201
|
{ sectionId: t.id }
|
|
1202
1202
|
);
|
|
1203
1203
|
}
|
|
1204
1204
|
},
|
|
1205
|
-
[
|
|
1205
|
+
[o, t.id]
|
|
1206
1206
|
), g = be(() => {
|
|
1207
|
-
|
|
1208
|
-
}, [
|
|
1209
|
-
() =>
|
|
1210
|
-
[
|
|
1207
|
+
o && q.getState().deleteField(o.id, { sectionId: t.id });
|
|
1208
|
+
}, [o, t.id]), p = ie(
|
|
1209
|
+
() => o && ["radio", "check", "selection"].includes(o.fieldType),
|
|
1210
|
+
[o]
|
|
1211
1211
|
);
|
|
1212
1212
|
return /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
|
|
1213
1213
|
/* @__PURE__ */ r.jsx("h3", { className: "text-lg font-semibold mb-3", children: "Edit Section" }),
|
|
@@ -1225,7 +1225,7 @@ function rt({ section: t, onActiveChildChange: n }) {
|
|
|
1225
1225
|
{
|
|
1226
1226
|
className: "w-full px-3 py-2 border border-black/20 rounded",
|
|
1227
1227
|
value: t.title || "",
|
|
1228
|
-
onChange: (v) =>
|
|
1228
|
+
onChange: (v) => m("title", v.target.value),
|
|
1229
1229
|
placeholder: "Section title"
|
|
1230
1230
|
}
|
|
1231
1231
|
)
|
|
@@ -1234,40 +1234,40 @@ function rt({ section: t, onActiveChildChange: n }) {
|
|
|
1234
1234
|
/* @__PURE__ */ r.jsx("div", { className: "text-sm font-semibold mb-2", children: "Fields in this section" }),
|
|
1235
1235
|
i.length === 0 ? /* @__PURE__ */ r.jsx("div", { className: "text-sm text-gray-500", children: "No fields yet. Use the section’s mini toolbar to add fields." }) : /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
|
|
1236
1236
|
/* @__PURE__ */ r.jsx("div", { className: "flex flex-wrap gap-2 mb-3", children: i.map((v) => {
|
|
1237
|
-
var S,
|
|
1237
|
+
var S, N;
|
|
1238
1238
|
return /* @__PURE__ */ r.jsx(
|
|
1239
1239
|
"button",
|
|
1240
1240
|
{
|
|
1241
1241
|
className: [
|
|
1242
1242
|
"px-3 py-1.5 text-sm rounded border",
|
|
1243
|
-
|
|
1243
|
+
c === v.id ? "bg-black/5 border-black/20" : "bg-white border-black/10 hover:bg-slate-50"
|
|
1244
1244
|
].join(" "),
|
|
1245
|
-
onClick: () =>
|
|
1245
|
+
onClick: () => h(v.id),
|
|
1246
1246
|
title: v.question || v.fieldType,
|
|
1247
|
-
children: ((S = v.question) == null ? void 0 : S.trim()) || ((
|
|
1247
|
+
children: ((S = v.question) == null ? void 0 : S.trim()) || ((N = le[v.fieldType]) == null ? void 0 : N.label) || "Field"
|
|
1248
1248
|
},
|
|
1249
1249
|
v.id
|
|
1250
1250
|
);
|
|
1251
1251
|
}) }),
|
|
1252
|
-
|
|
1252
|
+
o && /* @__PURE__ */ r.jsxs("div", { className: "mt-2", children: [
|
|
1253
1253
|
/* @__PURE__ */ r.jsxs("div", { className: "text-sm font-semibold mb-2", children: [
|
|
1254
1254
|
"Editing: ",
|
|
1255
|
-
((
|
|
1255
|
+
((x = o.question) == null ? void 0 : x.trim()) || ((k = le[o.fieldType]) == null ? void 0 : k.label)
|
|
1256
1256
|
] }),
|
|
1257
|
-
/* @__PURE__ */ r.jsx(sr, { f:
|
|
1258
|
-
|
|
1257
|
+
/* @__PURE__ */ r.jsx(sr, { f: o, onUpdateField: u }),
|
|
1258
|
+
o.fieldType === "input" && /* @__PURE__ */ r.jsxs("div", { className: "mt-4", children: [
|
|
1259
1259
|
/* @__PURE__ */ r.jsx("div", { className: "text-sm font-medium mb-1", children: "Default Answer" }),
|
|
1260
1260
|
/* @__PURE__ */ r.jsx(
|
|
1261
1261
|
"input",
|
|
1262
1262
|
{
|
|
1263
1263
|
className: "w-full px-3 py-2 border border-black/20 rounded",
|
|
1264
|
-
value:
|
|
1265
|
-
onChange: (v) =>
|
|
1264
|
+
value: o.answer || "",
|
|
1265
|
+
onChange: (v) => u("answer", v.target.value),
|
|
1266
1266
|
placeholder: "Default value"
|
|
1267
1267
|
}
|
|
1268
1268
|
)
|
|
1269
1269
|
] }),
|
|
1270
|
-
|
|
1270
|
+
p && /* @__PURE__ */ r.jsx(ir, { field: o, onUpdateField: u }),
|
|
1271
1271
|
/* @__PURE__ */ r.jsx(
|
|
1272
1272
|
"button",
|
|
1273
1273
|
{
|
|
@@ -1281,7 +1281,7 @@ function rt({ section: t, onActiveChildChange: n }) {
|
|
|
1281
1281
|
] })
|
|
1282
1282
|
] });
|
|
1283
1283
|
}
|
|
1284
|
-
function
|
|
1284
|
+
function Xe(t) {
|
|
1285
1285
|
switch (t) {
|
|
1286
1286
|
case "input":
|
|
1287
1287
|
return ["equals", "contains"];
|
|
@@ -1294,7 +1294,7 @@ function Qe(t) {
|
|
|
1294
1294
|
return ["equals"];
|
|
1295
1295
|
}
|
|
1296
1296
|
}
|
|
1297
|
-
function
|
|
1297
|
+
function Qe(t) {
|
|
1298
1298
|
if (t && typeof t == "object") {
|
|
1299
1299
|
const s = t.id ?? String(t.value ?? ""), i = String(t.value ?? t.label ?? t.id ?? "");
|
|
1300
1300
|
return { id: s, value: i };
|
|
@@ -1303,27 +1303,27 @@ function Ze(t) {
|
|
|
1303
1303
|
return { id: n, value: n };
|
|
1304
1304
|
}
|
|
1305
1305
|
function tt() {
|
|
1306
|
-
var ce,
|
|
1307
|
-
const t = H(), n = q((d) => d.byId), s = q((d) => d.setEnableWhen), i = q((d) => d.updateField),
|
|
1308
|
-
(
|
|
1309
|
-
const
|
|
1306
|
+
var ce, re, B;
|
|
1307
|
+
const t = H(), n = q((d) => d.byId), s = q((d) => d.setEnableWhen), i = q((d) => d.updateField), c = ((ce = t == null ? void 0 : t.selectedFieldId) == null ? void 0 : ce.value) ?? null;
|
|
1308
|
+
(re = t == null ? void 0 : t.selectedChildId) == null || re.ParentId;
|
|
1309
|
+
const h = ((B = t == null ? void 0 : t.selectedChildId) == null ? void 0 : B.ChildId) ?? null, m = c ? n[c] : null, o = (m == null ? void 0 : m.fieldType) === "section", u = E.useMemo(() => o ? Array.isArray(m == null ? void 0 : m.fields) ? m.fields : [] : [], [o, m]), g = E.useMemo(() => !o || !h ? !1 : u.some((d) => d.id === h), [o, h, u]), p = E.useMemo(() => o && g ? `child:${h}` : "", [o, g, h]), [f, x] = E.useState(p);
|
|
1310
1310
|
E.useEffect(() => {
|
|
1311
|
-
|
|
1312
|
-
}, [
|
|
1313
|
-
if (
|
|
1314
|
-
if (
|
|
1315
|
-
const d =
|
|
1316
|
-
t.selectedChildId.set(
|
|
1311
|
+
x(p);
|
|
1312
|
+
}, [p]), E.useEffect(() => {
|
|
1313
|
+
if (o)
|
|
1314
|
+
if (f && f.startsWith("child:")) {
|
|
1315
|
+
const d = f.slice(6);
|
|
1316
|
+
t.selectedChildId.set(c, d);
|
|
1317
1317
|
} else
|
|
1318
1318
|
t.selectedChildId.set(null, null);
|
|
1319
|
-
}, [
|
|
1320
|
-
const
|
|
1321
|
-
var
|
|
1319
|
+
}, [o, f, c, t]);
|
|
1320
|
+
const k = !!(o && f && f.startsWith("child:")), v = k ? f.slice(6) : null, S = k ? v : c, N = E.useMemo(() => S ? k ? u.find((d) => d.id === v) ?? null : n[S] ?? null : null, [n, S, k, v, u]), L = E.useMemo(() => {
|
|
1321
|
+
var R, I, Y;
|
|
1322
1322
|
const d = [];
|
|
1323
1323
|
for (const A of Object.values(n))
|
|
1324
1324
|
if (A)
|
|
1325
1325
|
if (A.fieldType === "section" && Array.isArray(A.fields)) {
|
|
1326
|
-
const U = ((
|
|
1326
|
+
const U = ((R = A.title) == null ? void 0 : R.trim()) || "Section";
|
|
1327
1327
|
A.fields.forEach((y) => {
|
|
1328
1328
|
var z;
|
|
1329
1329
|
d.push({
|
|
@@ -1344,16 +1344,16 @@ function tt() {
|
|
|
1344
1344
|
});
|
|
1345
1345
|
return d;
|
|
1346
1346
|
}, [n]), _ = E.useCallback(
|
|
1347
|
-
(d) => L.find((
|
|
1347
|
+
(d) => L.find((R) => R.id === d) || null,
|
|
1348
1348
|
[L]
|
|
1349
1349
|
), F = E.useCallback(
|
|
1350
1350
|
(d) => {
|
|
1351
1351
|
if (!S) return;
|
|
1352
|
-
const
|
|
1353
|
-
|
|
1352
|
+
const R = d && Array.isArray(d.conditions) ? { logic: d.logic || "AND", conditions: d.conditions } : void 0;
|
|
1353
|
+
k && c ? i(S, { enableWhen: R }, { sectionId: c }) : s(S, R);
|
|
1354
1354
|
},
|
|
1355
|
-
[S,
|
|
1356
|
-
), O = E.useMemo(() =>
|
|
1355
|
+
[S, k, c, s, i]
|
|
1356
|
+
), O = E.useMemo(() => N != null && N.enableWhen && Array.isArray(N.enableWhen.conditions) ? { logic: N.enableWhen.logic || "AND", conditions: N.enableWhen.conditions } : { logic: "AND", conditions: [] }, [N]), he = E.useCallback(() => {
|
|
1357
1357
|
const d = {
|
|
1358
1358
|
logic: O.logic || "AND",
|
|
1359
1359
|
conditions: [
|
|
@@ -1369,13 +1369,13 @@ function tt() {
|
|
|
1369
1369
|
},
|
|
1370
1370
|
[O, F]
|
|
1371
1371
|
), X = E.useCallback(
|
|
1372
|
-
(d,
|
|
1373
|
-
const Y = [...Array.isArray(O.conditions) ? O.conditions : []], U = { ...Y[d] || { targetId: "", operator: "equals", value: "" }, ...
|
|
1374
|
-
if ("targetId" in
|
|
1375
|
-
const y = _(U.targetId), z =
|
|
1372
|
+
(d, R) => {
|
|
1373
|
+
const Y = [...Array.isArray(O.conditions) ? O.conditions : []], U = { ...Y[d] || { targetId: "", operator: "equals", value: "" }, ...R };
|
|
1374
|
+
if ("targetId" in R) {
|
|
1375
|
+
const y = _(U.targetId), z = Xe(y == null ? void 0 : y.fieldType);
|
|
1376
1376
|
z.includes(U.operator) || (U.operator = z[0] || "equals");
|
|
1377
|
-
const
|
|
1378
|
-
|
|
1377
|
+
const te = Array.isArray(y == null ? void 0 : y.options) ? y.options.map(Qe) : [];
|
|
1378
|
+
te.length > 0 && (new Set(te.map((je) => je.id)).has(U.value) || (U.value = ""));
|
|
1379
1379
|
}
|
|
1380
1380
|
Y[d] = U, F({ ...O, conditions: Y });
|
|
1381
1381
|
},
|
|
@@ -1383,21 +1383,21 @@ function tt() {
|
|
|
1383
1383
|
), oe = E.useMemo(
|
|
1384
1384
|
() => L.filter((d) => d.id !== S),
|
|
1385
1385
|
[L, S]
|
|
1386
|
-
), J = !
|
|
1386
|
+
), J = !N || !S;
|
|
1387
1387
|
return /* @__PURE__ */ r.jsxs("div", { className: "space-y-2", children: [
|
|
1388
|
-
|
|
1388
|
+
o && /* @__PURE__ */ r.jsxs("div", { className: "flex gap-2 items-center", children: [
|
|
1389
1389
|
/* @__PURE__ */ r.jsx("label", { className: "text-sm", children: "Target:" }),
|
|
1390
1390
|
/* @__PURE__ */ r.jsxs(
|
|
1391
1391
|
"select",
|
|
1392
1392
|
{
|
|
1393
1393
|
className: "border p-1 rounded",
|
|
1394
|
-
value:
|
|
1395
|
-
onChange: (d) =>
|
|
1394
|
+
value: f,
|
|
1395
|
+
onChange: (d) => x(d.target.value),
|
|
1396
1396
|
children: [
|
|
1397
1397
|
/* @__PURE__ */ r.jsx("option", { value: "", children: "Section (this)" }),
|
|
1398
|
-
|
|
1399
|
-
var
|
|
1400
|
-
return /* @__PURE__ */ r.jsx("option", { value: `child:${d.id}`, children: ((
|
|
1398
|
+
u.map((d) => {
|
|
1399
|
+
var R, I;
|
|
1400
|
+
return /* @__PURE__ */ r.jsx("option", { value: `child:${d.id}`, children: ((R = d.question) == null ? void 0 : R.trim()) || ((I = d.title) == null ? void 0 : I.trim()) || d.id }, d.id);
|
|
1401
1401
|
})
|
|
1402
1402
|
]
|
|
1403
1403
|
}
|
|
@@ -1421,14 +1421,14 @@ function tt() {
|
|
|
1421
1421
|
/* @__PURE__ */ r.jsx("button", { type: "button", className: "px-2 py-1 border rounded", onClick: he, disabled: J, children: "+ Condition" }),
|
|
1422
1422
|
/* @__PURE__ */ r.jsx("button", { type: "button", className: "px-2 py-1 border rounded", onClick: ve, disabled: J, children: "Clear" })
|
|
1423
1423
|
] }),
|
|
1424
|
-
(Array.isArray(O.conditions) ? O.conditions : []).map((d,
|
|
1425
|
-
const I = _(d.targetId), Y =
|
|
1424
|
+
(Array.isArray(O.conditions) ? O.conditions : []).map((d, R) => {
|
|
1425
|
+
const I = _(d.targetId), Y = Xe(I == null ? void 0 : I.fieldType), A = Array.isArray(I == null ? void 0 : I.options) ? I.options.map(Qe) : [], U = A.length > 0;
|
|
1426
1426
|
return /* @__PURE__ */ r.jsxs("div", { className: "grid grid-cols-1 sm:grid-cols-7 gap-2 items-center opacity-100", children: [
|
|
1427
1427
|
/* @__PURE__ */ r.jsx(
|
|
1428
1428
|
"button",
|
|
1429
1429
|
{
|
|
1430
1430
|
type: "button",
|
|
1431
|
-
onClick: () => ge(
|
|
1431
|
+
onClick: () => ge(R),
|
|
1432
1432
|
className: "px-2 py-1 border rounded sm:col-span-1",
|
|
1433
1433
|
title: "Remove condition",
|
|
1434
1434
|
disabled: J,
|
|
@@ -1440,7 +1440,7 @@ function tt() {
|
|
|
1440
1440
|
{
|
|
1441
1441
|
className: "border p-1 rounded sm:col-span-3",
|
|
1442
1442
|
value: d.targetId,
|
|
1443
|
-
onChange: (y) => X(
|
|
1443
|
+
onChange: (y) => X(R, { targetId: y.target.value }),
|
|
1444
1444
|
disabled: J,
|
|
1445
1445
|
children: [
|
|
1446
1446
|
/* @__PURE__ */ r.jsx("option", { value: "", children: "— Select field —" }),
|
|
@@ -1453,7 +1453,7 @@ function tt() {
|
|
|
1453
1453
|
{
|
|
1454
1454
|
className: "border p-1 rounded sm:col-span-1",
|
|
1455
1455
|
value: d.operator,
|
|
1456
|
-
onChange: (y) => X(
|
|
1456
|
+
onChange: (y) => X(R, { operator: y.target.value }),
|
|
1457
1457
|
disabled: J || !I,
|
|
1458
1458
|
children: (I ? Y : ["equals"]).map((y) => /* @__PURE__ */ r.jsx("option", { value: y, children: y }, y))
|
|
1459
1459
|
}
|
|
@@ -1463,7 +1463,7 @@ function tt() {
|
|
|
1463
1463
|
{
|
|
1464
1464
|
className: "border p-1 rounded sm:col-span-2",
|
|
1465
1465
|
value: d.value,
|
|
1466
|
-
onChange: (y) => X(
|
|
1466
|
+
onChange: (y) => X(R, { value: y.target.value }),
|
|
1467
1467
|
disabled: J || !I,
|
|
1468
1468
|
children: [
|
|
1469
1469
|
/* @__PURE__ */ r.jsx("option", { value: "", children: "— Select option —" }),
|
|
@@ -1476,30 +1476,30 @@ function tt() {
|
|
|
1476
1476
|
className: "border p-1 rounded sm:col-span-2",
|
|
1477
1477
|
placeholder: "Enter value",
|
|
1478
1478
|
value: d.value,
|
|
1479
|
-
onChange: (y) => X(
|
|
1479
|
+
onChange: (y) => X(R, { value: y.target.value }),
|
|
1480
1480
|
disabled: J || !I
|
|
1481
1481
|
}
|
|
1482
1482
|
)
|
|
1483
|
-
] },
|
|
1483
|
+
] }, R);
|
|
1484
1484
|
})
|
|
1485
1485
|
] });
|
|
1486
1486
|
}
|
|
1487
|
-
function
|
|
1487
|
+
function Ze() {
|
|
1488
1488
|
const t = H(), n = q(
|
|
1489
1489
|
E.useCallback(
|
|
1490
|
-
(
|
|
1490
|
+
(o) => t.selectedFieldId.value ? o.byId[t.selectedFieldId.value] : null,
|
|
1491
1491
|
[t.selectedFieldId.value]
|
|
1492
1492
|
)
|
|
1493
|
-
), [s, i] = E.useState("EDIT"),
|
|
1494
|
-
(
|
|
1495
|
-
t.selectedChildId.set(
|
|
1493
|
+
), [s, i] = E.useState("EDIT"), c = E.useCallback(
|
|
1494
|
+
(o, u) => {
|
|
1495
|
+
t.selectedChildId.set(o, u);
|
|
1496
1496
|
},
|
|
1497
1497
|
[t.selectedChildId.set]
|
|
1498
1498
|
);
|
|
1499
1499
|
if (E.useEffect(() => {
|
|
1500
1500
|
t.selectedChildId.set(null, null), i("EDIT");
|
|
1501
1501
|
}, [t.selectedFieldId.value]), t.state.isPreview) return null;
|
|
1502
|
-
const
|
|
1502
|
+
const h = !n, m = (n == null ? void 0 : n.fieldType) === "section";
|
|
1503
1503
|
return /* @__PURE__ */ r.jsxs(
|
|
1504
1504
|
"div",
|
|
1505
1505
|
{
|
|
@@ -1535,43 +1535,38 @@ function er() {
|
|
|
1535
1535
|
]
|
|
1536
1536
|
}
|
|
1537
1537
|
),
|
|
1538
|
-
|
|
1538
|
+
h && /* @__PURE__ */ r.jsxs("div", { className: "text-gray-600", children: [
|
|
1539
1539
|
/* @__PURE__ */ r.jsx("h3", { className: "text-lg font-semibold mb-2", children: "Edit" }),
|
|
1540
1540
|
/* @__PURE__ */ r.jsx("p", { children: "Select a field in the center panel to edit its properties." })
|
|
1541
1541
|
] }),
|
|
1542
|
-
!
|
|
1543
|
-
!
|
|
1544
|
-
|
|
1542
|
+
!h && s === "EDIT" && /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
|
|
1543
|
+
!m && /* @__PURE__ */ r.jsx(et, { f: n }),
|
|
1544
|
+
m && /* @__PURE__ */ r.jsx(
|
|
1545
1545
|
rt,
|
|
1546
1546
|
{
|
|
1547
1547
|
section: n,
|
|
1548
|
-
onActiveChildChange:
|
|
1548
|
+
onActiveChildChange: c
|
|
1549
1549
|
}
|
|
1550
1550
|
)
|
|
1551
1551
|
] }),
|
|
1552
|
-
!
|
|
1552
|
+
!h && s === "LOGIC" && /* @__PURE__ */ r.jsx(tt, {})
|
|
1553
1553
|
]
|
|
1554
1554
|
}
|
|
1555
1555
|
);
|
|
1556
1556
|
}
|
|
1557
1557
|
function nt() {
|
|
1558
|
-
const t = H(), n =
|
|
1559
|
-
const o = [];
|
|
1560
|
-
return (n || []).forEach((u) => {
|
|
1561
|
-
o.push(u), (u == null ? void 0 : u.fieldType) === "section" && Array.isArray(u.fields) && o.push(...u.fields);
|
|
1562
|
-
}), o;
|
|
1563
|
-
}, [n]), i = re(() => (t.state.isPreview ? n.filter((u) => Lr(u, s)) : n).map((u) => u.id), [t.state.isPreview, n, s]);
|
|
1558
|
+
const t = H(), { fields: n } = Lr(t.state.isPreview), s = ie(() => n.map((i) => i.id), [n]);
|
|
1564
1559
|
return /* @__PURE__ */ r.jsx(
|
|
1565
1560
|
"div",
|
|
1566
1561
|
{
|
|
1567
1562
|
className: "w-full max-w-4xl mx-auto rounded-lg overflow-y-auto max-h-[calc(100svh-19rem)] lg:max-h-[calc(100dvh-15rem)] custom-scrollbar pr-2",
|
|
1568
1563
|
onClick: () => !t.state.isPreview && t.selectedFieldId.clear(),
|
|
1569
|
-
children:
|
|
1564
|
+
children: s.length === 0 ? /* @__PURE__ */ r.jsx(st, {}) : s.map((i) => /* @__PURE__ */ r.jsx(at, { id: i }, i))
|
|
1570
1565
|
}
|
|
1571
1566
|
);
|
|
1572
1567
|
}
|
|
1573
1568
|
const at = E.memo(function({ id: n }) {
|
|
1574
|
-
const s = q(E.useCallback((
|
|
1569
|
+
const s = q(E.useCallback((c) => c.byId[n], [n]));
|
|
1575
1570
|
if (!s) return null;
|
|
1576
1571
|
const i = Mr(s.fieldType);
|
|
1577
1572
|
return i ? /* @__PURE__ */ r.jsx("div", { className: "mb-1.5", "data-field-type": s.fieldType, "data-field-id": s.id, children: /* @__PURE__ */ r.jsx(i, { field: s }) }) : null;
|
|
@@ -1591,12 +1586,12 @@ function st() {
|
|
|
1591
1586
|
] });
|
|
1592
1587
|
}
|
|
1593
1588
|
function it({ selectedField: t }) {
|
|
1594
|
-
const n = H(), s = n.state.isPreview, i = n.state.isEditModalOpen,
|
|
1595
|
-
return /* @__PURE__ */ r.jsx("div", { className: "w-full max-w-6xl mx-auto px-4 h-fit rounded-lg mt-2", children: /* @__PURE__ */ r.jsxs("div", { className: `grid grid-cols-1 ${
|
|
1596
|
-
|
|
1589
|
+
const n = H(), s = n.state.isPreview, i = n.state.isEditModalOpen, c = n.state.panelResetKey, h = !s, m = h ? "lg:grid-cols-[280px_minmax(0,1fr)_320px]" : "lg:grid-cols-[minmax(0,1fr)]";
|
|
1590
|
+
return /* @__PURE__ */ r.jsx("div", { className: "w-full max-w-6xl mx-auto px-4 h-fit rounded-lg mt-2", children: /* @__PURE__ */ r.jsxs("div", { className: `grid grid-cols-1 ${m} gap-3 h-full items-start`, children: [
|
|
1591
|
+
h && /* @__PURE__ */ r.jsx("div", { className: "hidden lg:block", children: /* @__PURE__ */ r.jsx(Gr, {}) }),
|
|
1597
1592
|
/* @__PURE__ */ r.jsx("div", { children: /* @__PURE__ */ r.jsx(nt, {}) }),
|
|
1598
|
-
|
|
1599
|
-
|
|
1593
|
+
h && /* @__PURE__ */ r.jsx("div", { className: "hidden lg:block", children: /* @__PURE__ */ r.jsx(Ze, {}, c) }),
|
|
1594
|
+
h && /* @__PURE__ */ r.jsx("div", { className: "lg:hidden", children: i && t && /* @__PURE__ */ r.jsx(
|
|
1600
1595
|
"div",
|
|
1601
1596
|
{
|
|
1602
1597
|
className: "fixed inset-0 top-5 z-50 flex items-center justify-center bg-transparent/30 backdrop-blur-sm p-4",
|
|
@@ -1605,7 +1600,7 @@ function it({ selectedField: t }) {
|
|
|
1605
1600
|
"div",
|
|
1606
1601
|
{
|
|
1607
1602
|
className: "w-full max-w-md mx-auto relative bg-white rounded-lg overflow-hidden",
|
|
1608
|
-
onClick: (
|
|
1603
|
+
onClick: (o) => o.stopPropagation(),
|
|
1609
1604
|
children: [
|
|
1610
1605
|
/* @__PURE__ */ r.jsx(
|
|
1611
1606
|
"button",
|
|
@@ -1615,7 +1610,7 @@ function it({ selectedField: t }) {
|
|
|
1615
1610
|
children: /* @__PURE__ */ r.jsx("span", { className: "text-3xl", children: "×" })
|
|
1616
1611
|
}
|
|
1617
1612
|
),
|
|
1618
|
-
/* @__PURE__ */ r.jsx(
|
|
1613
|
+
/* @__PURE__ */ r.jsx(Ze, {}, c)
|
|
1619
1614
|
]
|
|
1620
1615
|
}
|
|
1621
1616
|
)
|
|
@@ -1628,26 +1623,29 @@ function ut({
|
|
|
1628
1623
|
onChange: n,
|
|
1629
1624
|
className: s = "",
|
|
1630
1625
|
showHeader: i = !0,
|
|
1631
|
-
showMobileToolbar:
|
|
1632
|
-
startInPreview:
|
|
1626
|
+
showMobileToolbar: c = !0,
|
|
1627
|
+
startInPreview: h = !1
|
|
1633
1628
|
}) {
|
|
1634
|
-
const
|
|
1629
|
+
const m = H(), o = er(!1);
|
|
1635
1630
|
ee(() => {
|
|
1636
|
-
|
|
1637
|
-
}, [t,
|
|
1638
|
-
const
|
|
1639
|
-
|
|
1631
|
+
o.current || (Array.isArray(t) && t.length && q.getState().replaceAll(t), m.preview.set(!!h), o.current = !0);
|
|
1632
|
+
}, [t, h, m.preview]), ee(() => n ? q.subscribe((p) => {
|
|
1633
|
+
const f = [];
|
|
1634
|
+
p.order.forEach((x) => {
|
|
1635
|
+
const k = p.byId[x];
|
|
1636
|
+
k && (f.push(k), k.fieldType === "section" && Array.isArray(k.fields) && f.push(...k.fields));
|
|
1637
|
+
}), n(f);
|
|
1640
1638
|
}) : void 0, [n]);
|
|
1641
|
-
const
|
|
1639
|
+
const u = q(
|
|
1642
1640
|
E.useCallback(
|
|
1643
|
-
(g) =>
|
|
1644
|
-
[
|
|
1641
|
+
(g) => m.selectedFieldId.value ? g.byId[m.selectedFieldId.value] : null,
|
|
1642
|
+
[m.selectedFieldId.value]
|
|
1645
1643
|
)
|
|
1646
1644
|
);
|
|
1647
1645
|
return /* @__PURE__ */ r.jsxs("div", { className: `qb-editor-root min-h-screen bg-gray-100 font-titillium ${s}`, children: [
|
|
1648
1646
|
i && /* @__PURE__ */ r.jsx(Br, {}),
|
|
1649
|
-
|
|
1650
|
-
/* @__PURE__ */ r.jsx(it, { selectedField:
|
|
1647
|
+
c && /* @__PURE__ */ r.jsx("div", { className: "lg:hidden", children: /* @__PURE__ */ r.jsx(Jr, {}) }),
|
|
1648
|
+
/* @__PURE__ */ r.jsx(it, { selectedField: u })
|
|
1651
1649
|
] });
|
|
1652
1650
|
}
|
|
1653
1651
|
export {
|