@mieweb/forms-editor 0.1.4 → 0.1.7
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 +67 -208
- package/dist/index.css +1 -1
- package/dist/index.js +811 -736
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useFormStore as
|
|
3
|
-
import { AnimatePresence as
|
|
4
|
-
import
|
|
5
|
-
|
|
1
|
+
import k, { useState as ne, useRef as er, useEffect as se, useMemo as ue, useCallback as ge } from "react";
|
|
2
|
+
import { useFormStore as Y, useFieldsArray as rr, useUIApi as ee, adaptSchema as Ar, EYECLOSED_ICON as Dr, EYEEDIT_ICON as Pr, PLUSSQUARE_ICON as Fr, DATALOG_ICON as $r, X_ICON as Lr, fieldTypes as fe, useFormApi as tr, useVisibleFields as Mr, useUIStore as Ur, getFieldComponent as Wr } from "@mieweb/forms-engine";
|
|
3
|
+
import { AnimatePresence as qr, motion as Z } from "framer-motion";
|
|
4
|
+
import Yr from "js-yaml";
|
|
5
|
+
var ve = { exports: {} }, ce = {};
|
|
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
|
|
16
|
-
function
|
|
17
|
-
if (
|
|
18
|
-
|
|
19
|
-
var t =
|
|
20
|
-
function
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
for (
|
|
24
|
-
if (
|
|
25
|
-
return { $$typeof: n, type:
|
|
15
|
+
var Je;
|
|
16
|
+
function Vr() {
|
|
17
|
+
if (Je) return ce;
|
|
18
|
+
Je = 1;
|
|
19
|
+
var t = k, n = Symbol.for("react.element"), a = Symbol.for("react.fragment"), l = Object.prototype.hasOwnProperty, c = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, f = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
20
|
+
function m(o, d, w) {
|
|
21
|
+
var v, b = {}, x = null, C = null;
|
|
22
|
+
w !== void 0 && (x = "" + w), d.key !== void 0 && (x = "" + d.key), d.ref !== void 0 && (C = d.ref);
|
|
23
|
+
for (v in d) l.call(d, v) && !f.hasOwnProperty(v) && (b[v] = d[v]);
|
|
24
|
+
if (o && o.defaultProps) for (v in d = o.defaultProps, d) b[v] === void 0 && (b[v] = d[v]);
|
|
25
|
+
return { $$typeof: n, type: o, key: x, ref: C, props: b, _owner: c.current };
|
|
26
26
|
}
|
|
27
|
-
return
|
|
27
|
+
return ce.Fragment = a, ce.jsx = m, ce.jsxs = m, ce;
|
|
28
28
|
}
|
|
29
|
-
var
|
|
29
|
+
var de = {};
|
|
30
30
|
/**
|
|
31
31
|
* @license React
|
|
32
32
|
* react-jsx-runtime.development.js
|
|
@@ -36,91 +36,91 @@ 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
|
|
40
|
-
function
|
|
41
|
-
return
|
|
42
|
-
var t =
|
|
43
|
-
function
|
|
39
|
+
var ze;
|
|
40
|
+
function Br() {
|
|
41
|
+
return ze || (ze = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
42
|
+
var t = k, n = Symbol.for("react.element"), a = Symbol.for("react.portal"), l = Symbol.for("react.fragment"), c = Symbol.for("react.strict_mode"), f = Symbol.for("react.profiler"), m = Symbol.for("react.provider"), o = Symbol.for("react.context"), d = Symbol.for("react.forward_ref"), w = Symbol.for("react.suspense"), v = Symbol.for("react.suspense_list"), b = Symbol.for("react.memo"), x = Symbol.for("react.lazy"), C = Symbol.for("react.offscreen"), g = Symbol.iterator, O = "@@iterator";
|
|
43
|
+
function h(e) {
|
|
44
44
|
if (e === null || typeof e != "object")
|
|
45
45
|
return null;
|
|
46
|
-
var
|
|
47
|
-
return typeof
|
|
46
|
+
var s = g && e[g] || e[O];
|
|
47
|
+
return typeof s == "function" ? s : null;
|
|
48
48
|
}
|
|
49
|
-
var
|
|
50
|
-
function
|
|
49
|
+
var F = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
50
|
+
function N(e) {
|
|
51
51
|
{
|
|
52
|
-
for (var
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
for (var s = arguments.length, i = new Array(s > 1 ? s - 1 : 0), p = 1; p < s; p++)
|
|
53
|
+
i[p - 1] = arguments[p];
|
|
54
|
+
T("error", e, i);
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function T(e, s, i) {
|
|
58
58
|
{
|
|
59
|
-
var
|
|
60
|
-
|
|
61
|
-
var
|
|
62
|
-
return String(
|
|
59
|
+
var p = F.ReactDebugCurrentFrame, S = p.getStackAddendum();
|
|
60
|
+
S !== "" && (s += "%s", i = i.concat([S]));
|
|
61
|
+
var _ = i.map(function(E) {
|
|
62
|
+
return String(E);
|
|
63
63
|
});
|
|
64
|
-
|
|
64
|
+
_.unshift("Warning: " + s), Function.prototype.apply.call(console[e], console, _);
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
-
var
|
|
68
|
-
|
|
69
|
-
function
|
|
70
|
-
return !!(typeof e == "string" || typeof e == "function" || e ===
|
|
67
|
+
var R = !1, A = !1, X = !1, ae = !1, G = !1, K;
|
|
68
|
+
K = Symbol.for("react.module.reference");
|
|
69
|
+
function W(e) {
|
|
70
|
+
return !!(typeof e == "string" || typeof e == "function" || e === l || e === f || G || e === c || e === w || e === v || ae || e === C || R || A || X || typeof e == "object" && e !== null && (e.$$typeof === x || e.$$typeof === b || e.$$typeof === m || e.$$typeof === o || e.$$typeof === d || // 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
|
-
e.$$typeof ===
|
|
74
|
+
e.$$typeof === K || e.getModuleId !== void 0));
|
|
75
75
|
}
|
|
76
|
-
function
|
|
77
|
-
var
|
|
78
|
-
if (
|
|
79
|
-
return
|
|
80
|
-
var
|
|
81
|
-
return
|
|
76
|
+
function me(e, s, i) {
|
|
77
|
+
var p = e.displayName;
|
|
78
|
+
if (p)
|
|
79
|
+
return p;
|
|
80
|
+
var S = s.displayName || s.name || "";
|
|
81
|
+
return S !== "" ? i + "(" + S + ")" : i;
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function le(e) {
|
|
84
84
|
return e.displayName || "Context";
|
|
85
85
|
}
|
|
86
|
-
function
|
|
86
|
+
function z(e) {
|
|
87
87
|
if (e == null)
|
|
88
88
|
return null;
|
|
89
|
-
if (typeof e.tag == "number" &&
|
|
89
|
+
if (typeof e.tag == "number" && N("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
|
|
90
90
|
return e.displayName || e.name || null;
|
|
91
91
|
if (typeof e == "string")
|
|
92
92
|
return e;
|
|
93
93
|
switch (e) {
|
|
94
|
-
case
|
|
94
|
+
case l:
|
|
95
95
|
return "Fragment";
|
|
96
|
-
case
|
|
96
|
+
case a:
|
|
97
97
|
return "Portal";
|
|
98
|
-
case
|
|
98
|
+
case f:
|
|
99
99
|
return "Profiler";
|
|
100
|
-
case
|
|
100
|
+
case c:
|
|
101
101
|
return "StrictMode";
|
|
102
|
-
case
|
|
102
|
+
case w:
|
|
103
103
|
return "Suspense";
|
|
104
|
-
case
|
|
104
|
+
case v:
|
|
105
105
|
return "SuspenseList";
|
|
106
106
|
}
|
|
107
107
|
if (typeof e == "object")
|
|
108
108
|
switch (e.$$typeof) {
|
|
109
|
-
case
|
|
110
|
-
var
|
|
111
|
-
return
|
|
109
|
+
case o:
|
|
110
|
+
var s = e;
|
|
111
|
+
return le(s) + ".Consumer";
|
|
112
|
+
case m:
|
|
113
|
+
var i = e;
|
|
114
|
+
return le(i._context) + ".Provider";
|
|
115
|
+
case d:
|
|
116
|
+
return me(e, e.render, "ForwardRef");
|
|
112
117
|
case b:
|
|
113
|
-
var
|
|
114
|
-
return
|
|
115
|
-
case
|
|
116
|
-
|
|
117
|
-
case p:
|
|
118
|
-
var x = e.displayName || null;
|
|
119
|
-
return x !== null ? x : B(e.type) || "Memo";
|
|
120
|
-
case h: {
|
|
121
|
-
var N = e, R = N._payload, w = N._init;
|
|
118
|
+
var p = e.displayName || null;
|
|
119
|
+
return p !== null ? p : z(e.type) || "Memo";
|
|
120
|
+
case x: {
|
|
121
|
+
var S = e, _ = S._payload, E = S._init;
|
|
122
122
|
try {
|
|
123
|
-
return
|
|
123
|
+
return z(E(_));
|
|
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
|
|
131
|
+
var u = Object.assign, I = 0, D, B, P, V, y, H, ie;
|
|
132
132
|
function ye() {
|
|
133
133
|
}
|
|
134
134
|
ye.__reactDisabledLog = !0;
|
|
135
135
|
function je() {
|
|
136
136
|
{
|
|
137
|
-
if (
|
|
138
|
-
|
|
137
|
+
if (I === 0) {
|
|
138
|
+
D = console.log, B = console.info, P = console.warn, V = console.error, y = console.group, H = console.groupCollapsed, ie = console.groupEnd;
|
|
139
139
|
var e = {
|
|
140
140
|
configurable: !0,
|
|
141
141
|
enumerable: !0,
|
|
@@ -152,279 +152,279 @@ function Yr() {
|
|
|
152
152
|
groupEnd: e
|
|
153
153
|
});
|
|
154
154
|
}
|
|
155
|
-
|
|
155
|
+
I++;
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
|
-
function
|
|
158
|
+
function ir() {
|
|
159
159
|
{
|
|
160
|
-
if (
|
|
160
|
+
if (I--, I === 0) {
|
|
161
161
|
var e = {
|
|
162
162
|
configurable: !0,
|
|
163
163
|
enumerable: !0,
|
|
164
164
|
writable: !0
|
|
165
165
|
};
|
|
166
166
|
Object.defineProperties(console, {
|
|
167
|
-
log:
|
|
168
|
-
value:
|
|
167
|
+
log: u({}, e, {
|
|
168
|
+
value: D
|
|
169
169
|
}),
|
|
170
|
-
info:
|
|
171
|
-
value:
|
|
170
|
+
info: u({}, e, {
|
|
171
|
+
value: B
|
|
172
172
|
}),
|
|
173
|
-
warn:
|
|
174
|
-
value:
|
|
173
|
+
warn: u({}, e, {
|
|
174
|
+
value: P
|
|
175
175
|
}),
|
|
176
|
-
error:
|
|
177
|
-
value:
|
|
176
|
+
error: u({}, e, {
|
|
177
|
+
value: V
|
|
178
178
|
}),
|
|
179
|
-
group:
|
|
179
|
+
group: u({}, e, {
|
|
180
180
|
value: y
|
|
181
181
|
}),
|
|
182
|
-
groupCollapsed:
|
|
183
|
-
value:
|
|
182
|
+
groupCollapsed: u({}, e, {
|
|
183
|
+
value: H
|
|
184
184
|
}),
|
|
185
|
-
groupEnd:
|
|
186
|
-
value:
|
|
185
|
+
groupEnd: u({}, e, {
|
|
186
|
+
value: ie
|
|
187
187
|
})
|
|
188
188
|
});
|
|
189
189
|
}
|
|
190
|
-
|
|
190
|
+
I < 0 && N("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
|
-
var we =
|
|
194
|
-
function
|
|
193
|
+
var we = F.ReactCurrentDispatcher, Ee;
|
|
194
|
+
function pe(e, s, i) {
|
|
195
195
|
{
|
|
196
196
|
if (Ee === void 0)
|
|
197
197
|
try {
|
|
198
198
|
throw Error();
|
|
199
|
-
} catch (
|
|
200
|
-
var
|
|
201
|
-
Ee =
|
|
199
|
+
} catch (S) {
|
|
200
|
+
var p = S.stack.trim().match(/\n( *(at )?)/);
|
|
201
|
+
Ee = p && p[1] || "";
|
|
202
202
|
}
|
|
203
203
|
return `
|
|
204
204
|
` + Ee + e;
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
|
-
var
|
|
207
|
+
var Ne = !1, be;
|
|
208
208
|
{
|
|
209
209
|
var or = typeof WeakMap == "function" ? WeakMap : Map;
|
|
210
|
-
|
|
210
|
+
be = new or();
|
|
211
211
|
}
|
|
212
|
-
function
|
|
213
|
-
if (!e ||
|
|
212
|
+
function _e(e, s) {
|
|
213
|
+
if (!e || Ne)
|
|
214
214
|
return "";
|
|
215
215
|
{
|
|
216
|
-
var
|
|
217
|
-
if (
|
|
218
|
-
return
|
|
216
|
+
var i = be.get(e);
|
|
217
|
+
if (i !== void 0)
|
|
218
|
+
return i;
|
|
219
219
|
}
|
|
220
|
-
var
|
|
221
|
-
|
|
222
|
-
var
|
|
220
|
+
var p;
|
|
221
|
+
Ne = !0;
|
|
222
|
+
var S = Error.prepareStackTrace;
|
|
223
223
|
Error.prepareStackTrace = void 0;
|
|
224
|
-
var
|
|
225
|
-
|
|
224
|
+
var _;
|
|
225
|
+
_ = we.current, we.current = null, je();
|
|
226
226
|
try {
|
|
227
|
-
if (
|
|
228
|
-
var
|
|
227
|
+
if (s) {
|
|
228
|
+
var E = function() {
|
|
229
229
|
throw Error();
|
|
230
230
|
};
|
|
231
|
-
if (Object.defineProperty(
|
|
231
|
+
if (Object.defineProperty(E.prototype, "props", {
|
|
232
232
|
set: function() {
|
|
233
233
|
throw Error();
|
|
234
234
|
}
|
|
235
235
|
}), typeof Reflect == "object" && Reflect.construct) {
|
|
236
236
|
try {
|
|
237
|
-
Reflect.construct(
|
|
238
|
-
} catch (
|
|
239
|
-
|
|
237
|
+
Reflect.construct(E, []);
|
|
238
|
+
} catch (q) {
|
|
239
|
+
p = q;
|
|
240
240
|
}
|
|
241
|
-
Reflect.construct(e, [],
|
|
241
|
+
Reflect.construct(e, [], E);
|
|
242
242
|
} else {
|
|
243
243
|
try {
|
|
244
|
-
|
|
245
|
-
} catch (
|
|
246
|
-
|
|
244
|
+
E.call();
|
|
245
|
+
} catch (q) {
|
|
246
|
+
p = q;
|
|
247
247
|
}
|
|
248
|
-
e.call(
|
|
248
|
+
e.call(E.prototype);
|
|
249
249
|
}
|
|
250
250
|
} else {
|
|
251
251
|
try {
|
|
252
252
|
throw Error();
|
|
253
|
-
} catch (
|
|
254
|
-
|
|
253
|
+
} catch (q) {
|
|
254
|
+
p = q;
|
|
255
255
|
}
|
|
256
256
|
e();
|
|
257
257
|
}
|
|
258
|
-
} catch (
|
|
259
|
-
if (
|
|
260
|
-
for (var j =
|
|
261
|
-
`),
|
|
262
|
-
`),
|
|
263
|
-
|
|
264
|
-
for (;
|
|
265
|
-
if (j[
|
|
266
|
-
if (
|
|
258
|
+
} catch (q) {
|
|
259
|
+
if (q && p && typeof q.stack == "string") {
|
|
260
|
+
for (var j = q.stack.split(`
|
|
261
|
+
`), U = p.stack.split(`
|
|
262
|
+
`), $ = j.length - 1, L = U.length - 1; $ >= 1 && L >= 0 && j[$] !== U[L]; )
|
|
263
|
+
L--;
|
|
264
|
+
for (; $ >= 1 && L >= 0; $--, L--)
|
|
265
|
+
if (j[$] !== U[L]) {
|
|
266
|
+
if ($ !== 1 || L !== 1)
|
|
267
267
|
do
|
|
268
|
-
if (
|
|
269
|
-
var
|
|
270
|
-
` + j[
|
|
271
|
-
return e.displayName &&
|
|
268
|
+
if ($--, L--, L < 0 || j[$] !== U[L]) {
|
|
269
|
+
var J = `
|
|
270
|
+
` + j[$].replace(" at new ", " at ");
|
|
271
|
+
return e.displayName && J.includes("<anonymous>") && (J = J.replace("<anonymous>", e.displayName)), typeof e == "function" && be.set(e, J), J;
|
|
272
272
|
}
|
|
273
|
-
while (
|
|
273
|
+
while ($ >= 1 && L >= 0);
|
|
274
274
|
break;
|
|
275
275
|
}
|
|
276
276
|
}
|
|
277
277
|
} finally {
|
|
278
|
-
|
|
278
|
+
Ne = !1, we.current = _, ir(), Error.prepareStackTrace = S;
|
|
279
279
|
}
|
|
280
|
-
var
|
|
281
|
-
return typeof e == "function" &&
|
|
280
|
+
var te = e ? e.displayName || e.name : "", Q = te ? pe(te) : "";
|
|
281
|
+
return typeof e == "function" && be.set(e, Q), Q;
|
|
282
282
|
}
|
|
283
|
-
function cr(e,
|
|
284
|
-
return
|
|
283
|
+
function cr(e, s, i) {
|
|
284
|
+
return _e(e, !1);
|
|
285
285
|
}
|
|
286
286
|
function dr(e) {
|
|
287
|
-
var
|
|
288
|
-
return !!(
|
|
287
|
+
var s = e.prototype;
|
|
288
|
+
return !!(s && s.isReactComponent);
|
|
289
289
|
}
|
|
290
|
-
function
|
|
290
|
+
function he(e, s, i) {
|
|
291
291
|
if (e == null)
|
|
292
292
|
return "";
|
|
293
293
|
if (typeof e == "function")
|
|
294
|
-
return
|
|
294
|
+
return _e(e, dr(e));
|
|
295
295
|
if (typeof e == "string")
|
|
296
|
-
return
|
|
296
|
+
return pe(e);
|
|
297
297
|
switch (e) {
|
|
298
|
-
case
|
|
299
|
-
return
|
|
300
|
-
case
|
|
301
|
-
return
|
|
298
|
+
case w:
|
|
299
|
+
return pe("Suspense");
|
|
300
|
+
case v:
|
|
301
|
+
return pe("SuspenseList");
|
|
302
302
|
}
|
|
303
303
|
if (typeof e == "object")
|
|
304
304
|
switch (e.$$typeof) {
|
|
305
|
-
case
|
|
305
|
+
case d:
|
|
306
306
|
return cr(e.render);
|
|
307
|
-
case
|
|
308
|
-
return
|
|
309
|
-
case
|
|
310
|
-
var
|
|
307
|
+
case b:
|
|
308
|
+
return he(e.type, s, i);
|
|
309
|
+
case x: {
|
|
310
|
+
var p = e, S = p._payload, _ = p._init;
|
|
311
311
|
try {
|
|
312
|
-
return
|
|
312
|
+
return he(_(S), s, i);
|
|
313
313
|
} catch {
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
317
|
return "";
|
|
318
318
|
}
|
|
319
|
-
var
|
|
320
|
-
function
|
|
319
|
+
var oe = Object.prototype.hasOwnProperty, Oe = {}, Ae = F.ReactDebugCurrentFrame;
|
|
320
|
+
function xe(e) {
|
|
321
321
|
if (e) {
|
|
322
|
-
var
|
|
323
|
-
|
|
322
|
+
var s = e._owner, i = he(e.type, e._source, s ? s.type : null);
|
|
323
|
+
Ae.setExtraStackFrame(i);
|
|
324
324
|
} else
|
|
325
|
-
|
|
325
|
+
Ae.setExtraStackFrame(null);
|
|
326
326
|
}
|
|
327
|
-
function ur(e,
|
|
327
|
+
function ur(e, s, i, p, S) {
|
|
328
328
|
{
|
|
329
|
-
var
|
|
330
|
-
for (var
|
|
331
|
-
if (
|
|
329
|
+
var _ = Function.call.bind(oe);
|
|
330
|
+
for (var E in e)
|
|
331
|
+
if (_(e, E)) {
|
|
332
332
|
var j = void 0;
|
|
333
333
|
try {
|
|
334
|
-
if (typeof e[
|
|
335
|
-
var
|
|
336
|
-
throw
|
|
334
|
+
if (typeof e[E] != "function") {
|
|
335
|
+
var U = Error((p || "React class") + ": " + i + " type `" + E + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[E] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
336
|
+
throw U.name = "Invariant Violation", U;
|
|
337
337
|
}
|
|
338
|
-
j = e[
|
|
339
|
-
} catch (
|
|
340
|
-
j =
|
|
338
|
+
j = e[E](s, E, p, i, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
339
|
+
} catch ($) {
|
|
340
|
+
j = $;
|
|
341
341
|
}
|
|
342
|
-
j && !(j instanceof Error) && (
|
|
342
|
+
j && !(j instanceof Error) && (xe(S), N("%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).", p || "React class", i, E, typeof j), xe(null)), j instanceof Error && !(j.message in Oe) && (Oe[j.message] = !0, xe(S), N("Failed %s type: %s", i, j.message), xe(null));
|
|
343
343
|
}
|
|
344
344
|
}
|
|
345
345
|
}
|
|
346
346
|
var fr = Array.isArray;
|
|
347
|
-
function
|
|
347
|
+
function ke(e) {
|
|
348
348
|
return fr(e);
|
|
349
349
|
}
|
|
350
350
|
function mr(e) {
|
|
351
351
|
{
|
|
352
|
-
var
|
|
353
|
-
return
|
|
352
|
+
var s = typeof Symbol == "function" && Symbol.toStringTag, i = s && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
353
|
+
return i;
|
|
354
354
|
}
|
|
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
|
|
368
|
+
return N("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 = F.ReactCurrentOwner, br = {
|
|
371
371
|
key: !0,
|
|
372
372
|
ref: !0,
|
|
373
373
|
__self: !0,
|
|
374
374
|
__source: !0
|
|
375
|
-
},
|
|
376
|
-
function
|
|
377
|
-
if (
|
|
378
|
-
var
|
|
379
|
-
if (
|
|
375
|
+
}, $e, Le;
|
|
376
|
+
function hr(e) {
|
|
377
|
+
if (oe.call(e, "ref")) {
|
|
378
|
+
var s = Object.getOwnPropertyDescriptor(e, "ref").get;
|
|
379
|
+
if (s && s.isReactWarning)
|
|
380
380
|
return !1;
|
|
381
381
|
}
|
|
382
382
|
return e.ref !== void 0;
|
|
383
383
|
}
|
|
384
|
-
function
|
|
385
|
-
if (
|
|
386
|
-
var
|
|
387
|
-
if (
|
|
384
|
+
function xr(e) {
|
|
385
|
+
if (oe.call(e, "key")) {
|
|
386
|
+
var s = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
387
|
+
if (s && s.isReactWarning)
|
|
388
388
|
return !1;
|
|
389
389
|
}
|
|
390
390
|
return e.key !== void 0;
|
|
391
391
|
}
|
|
392
|
-
function vr(e,
|
|
393
|
-
typeof e.ref == "string" &&
|
|
392
|
+
function vr(e, s) {
|
|
393
|
+
typeof e.ref == "string" && Fe.current;
|
|
394
394
|
}
|
|
395
|
-
function gr(e,
|
|
395
|
+
function gr(e, s) {
|
|
396
396
|
{
|
|
397
|
-
var
|
|
398
|
-
|
|
397
|
+
var i = function() {
|
|
398
|
+
$e || ($e = !0, N("%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)", s));
|
|
399
399
|
};
|
|
400
|
-
|
|
401
|
-
get:
|
|
400
|
+
i.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
401
|
+
get: i,
|
|
402
402
|
configurable: !0
|
|
403
403
|
});
|
|
404
404
|
}
|
|
405
405
|
}
|
|
406
|
-
function yr(e,
|
|
406
|
+
function yr(e, s) {
|
|
407
407
|
{
|
|
408
|
-
var
|
|
409
|
-
|
|
408
|
+
var i = function() {
|
|
409
|
+
Le || (Le = !0, N("%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)", s));
|
|
410
410
|
};
|
|
411
|
-
|
|
412
|
-
get:
|
|
411
|
+
i.isReactWarning = !0, Object.defineProperty(e, "ref", {
|
|
412
|
+
get: i,
|
|
413
413
|
configurable: !0
|
|
414
414
|
});
|
|
415
415
|
}
|
|
416
416
|
}
|
|
417
|
-
var jr = function(e,
|
|
417
|
+
var jr = function(e, s, i, p, S, _, E) {
|
|
418
418
|
var j = {
|
|
419
419
|
// This tag allows us to uniquely identify this as a React Element
|
|
420
420
|
$$typeof: n,
|
|
421
421
|
// Built-in properties that belong on the element
|
|
422
422
|
type: e,
|
|
423
|
-
key:
|
|
424
|
-
ref:
|
|
425
|
-
props:
|
|
423
|
+
key: s,
|
|
424
|
+
ref: i,
|
|
425
|
+
props: E,
|
|
426
426
|
// Record the component responsible for creating this element.
|
|
427
|
-
_owner:
|
|
427
|
+
_owner: _
|
|
428
428
|
};
|
|
429
429
|
return j._store = {}, Object.defineProperty(j._store, "validated", {
|
|
430
430
|
configurable: !1,
|
|
@@ -435,49 +435,49 @@ function Yr() {
|
|
|
435
435
|
configurable: !1,
|
|
436
436
|
enumerable: !1,
|
|
437
437
|
writable: !1,
|
|
438
|
-
value:
|
|
438
|
+
value: p
|
|
439
439
|
}), Object.defineProperty(j, "_source", {
|
|
440
440
|
configurable: !1,
|
|
441
441
|
enumerable: !1,
|
|
442
442
|
writable: !1,
|
|
443
|
-
value:
|
|
443
|
+
value: S
|
|
444
444
|
}), Object.freeze && (Object.freeze(j.props), Object.freeze(j)), j;
|
|
445
445
|
};
|
|
446
|
-
function wr(e,
|
|
446
|
+
function wr(e, s, i, p, S) {
|
|
447
447
|
{
|
|
448
|
-
var
|
|
449
|
-
|
|
450
|
-
for (
|
|
451
|
-
|
|
448
|
+
var _, E = {}, j = null, U = null;
|
|
449
|
+
i !== void 0 && (Pe(i), j = "" + i), xr(s) && (Pe(s.key), j = "" + s.key), hr(s) && (U = s.ref, vr(s, S));
|
|
450
|
+
for (_ in s)
|
|
451
|
+
oe.call(s, _) && !br.hasOwnProperty(_) && (E[_] = s[_]);
|
|
452
452
|
if (e && e.defaultProps) {
|
|
453
|
-
var
|
|
454
|
-
for (
|
|
455
|
-
|
|
453
|
+
var $ = e.defaultProps;
|
|
454
|
+
for (_ in $)
|
|
455
|
+
E[_] === void 0 && (E[_] = $[_]);
|
|
456
456
|
}
|
|
457
|
-
if (j ||
|
|
458
|
-
var
|
|
459
|
-
j && gr(
|
|
457
|
+
if (j || U) {
|
|
458
|
+
var L = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
459
|
+
j && gr(E, L), U && yr(E, L);
|
|
460
460
|
}
|
|
461
|
-
return jr(e, j,
|
|
461
|
+
return jr(e, j, U, S, p, Fe.current, E);
|
|
462
462
|
}
|
|
463
463
|
}
|
|
464
|
-
var Ce =
|
|
465
|
-
function
|
|
464
|
+
var Ce = F.ReactCurrentOwner, Me = F.ReactDebugCurrentFrame;
|
|
465
|
+
function re(e) {
|
|
466
466
|
if (e) {
|
|
467
|
-
var
|
|
468
|
-
|
|
467
|
+
var s = e._owner, i = he(e.type, e._source, s ? s.type : null);
|
|
468
|
+
Me.setExtraStackFrame(i);
|
|
469
469
|
} else
|
|
470
|
-
|
|
470
|
+
Me.setExtraStackFrame(null);
|
|
471
471
|
}
|
|
472
|
-
var
|
|
473
|
-
|
|
474
|
-
function
|
|
472
|
+
var Se;
|
|
473
|
+
Se = !1;
|
|
474
|
+
function Re(e) {
|
|
475
475
|
return typeof e == "object" && e !== null && e.$$typeof === n;
|
|
476
476
|
}
|
|
477
|
-
function
|
|
477
|
+
function Ue() {
|
|
478
478
|
{
|
|
479
479
|
if (Ce.current) {
|
|
480
|
-
var e =
|
|
480
|
+
var e = z(Ce.current.type);
|
|
481
481
|
if (e)
|
|
482
482
|
return `
|
|
483
483
|
|
|
@@ -489,187 +489,187 @@ Check the render method of \`` + e + "`.";
|
|
|
489
489
|
function Er(e) {
|
|
490
490
|
return "";
|
|
491
491
|
}
|
|
492
|
-
var
|
|
493
|
-
function
|
|
492
|
+
var We = {};
|
|
493
|
+
function Nr(e) {
|
|
494
494
|
{
|
|
495
|
-
var
|
|
496
|
-
if (!
|
|
497
|
-
var
|
|
498
|
-
|
|
495
|
+
var s = Ue();
|
|
496
|
+
if (!s) {
|
|
497
|
+
var i = typeof e == "string" ? e : e.displayName || e.name;
|
|
498
|
+
i && (s = `
|
|
499
499
|
|
|
500
|
-
Check the top-level render call using <` +
|
|
500
|
+
Check the top-level render call using <` + i + ">.");
|
|
501
501
|
}
|
|
502
|
-
return
|
|
502
|
+
return s;
|
|
503
503
|
}
|
|
504
504
|
}
|
|
505
|
-
function
|
|
505
|
+
function qe(e, s) {
|
|
506
506
|
{
|
|
507
507
|
if (!e._store || e._store.validated || e.key != null)
|
|
508
508
|
return;
|
|
509
509
|
e._store.validated = !0;
|
|
510
|
-
var
|
|
511
|
-
if (
|
|
510
|
+
var i = Nr(s);
|
|
511
|
+
if (We[i])
|
|
512
512
|
return;
|
|
513
|
-
|
|
514
|
-
var
|
|
515
|
-
e && e._owner && e._owner !== Ce.current && (
|
|
513
|
+
We[i] = !0;
|
|
514
|
+
var p = "";
|
|
515
|
+
e && e._owner && e._owner !== Ce.current && (p = " It was passed a child from " + z(e._owner.type) + "."), re(e), N('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', i, p), re(null);
|
|
516
516
|
}
|
|
517
517
|
}
|
|
518
|
-
function
|
|
518
|
+
function Ye(e, s) {
|
|
519
519
|
{
|
|
520
520
|
if (typeof e != "object")
|
|
521
521
|
return;
|
|
522
|
-
if (
|
|
523
|
-
for (var
|
|
524
|
-
var
|
|
525
|
-
|
|
522
|
+
if (ke(e))
|
|
523
|
+
for (var i = 0; i < e.length; i++) {
|
|
524
|
+
var p = e[i];
|
|
525
|
+
Re(p) && qe(p, s);
|
|
526
526
|
}
|
|
527
|
-
else if (
|
|
527
|
+
else if (Re(e))
|
|
528
528
|
e._store && (e._store.validated = !0);
|
|
529
529
|
else if (e) {
|
|
530
|
-
var
|
|
531
|
-
if (typeof
|
|
532
|
-
for (var
|
|
533
|
-
|
|
530
|
+
var S = h(e);
|
|
531
|
+
if (typeof S == "function" && S !== e.entries)
|
|
532
|
+
for (var _ = S.call(e), E; !(E = _.next()).done; )
|
|
533
|
+
Re(E.value) && qe(E.value, s);
|
|
534
534
|
}
|
|
535
535
|
}
|
|
536
536
|
}
|
|
537
|
-
function
|
|
537
|
+
function kr(e) {
|
|
538
538
|
{
|
|
539
|
-
var
|
|
540
|
-
if (
|
|
539
|
+
var s = e.type;
|
|
540
|
+
if (s == null || typeof s == "string")
|
|
541
541
|
return;
|
|
542
|
-
var
|
|
543
|
-
if (typeof
|
|
544
|
-
|
|
545
|
-
else if (typeof
|
|
542
|
+
var i;
|
|
543
|
+
if (typeof s == "function")
|
|
544
|
+
i = s.propTypes;
|
|
545
|
+
else if (typeof s == "object" && (s.$$typeof === d || // Note: Memo only checks outer props here.
|
|
546
546
|
// Inner props are checked in the reconciler.
|
|
547
|
-
|
|
548
|
-
|
|
547
|
+
s.$$typeof === b))
|
|
548
|
+
i = s.propTypes;
|
|
549
549
|
else
|
|
550
550
|
return;
|
|
551
|
-
if (
|
|
552
|
-
var
|
|
553
|
-
ur(
|
|
554
|
-
} else if (
|
|
555
|
-
|
|
556
|
-
var
|
|
557
|
-
|
|
551
|
+
if (i) {
|
|
552
|
+
var p = z(s);
|
|
553
|
+
ur(i, e.props, "prop", p, e);
|
|
554
|
+
} else if (s.PropTypes !== void 0 && !Se) {
|
|
555
|
+
Se = !0;
|
|
556
|
+
var S = z(s);
|
|
557
|
+
N("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", S || "Unknown");
|
|
558
558
|
}
|
|
559
|
-
typeof
|
|
559
|
+
typeof s.getDefaultProps == "function" && !s.getDefaultProps.isReactClassApproved && N("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
560
560
|
}
|
|
561
561
|
}
|
|
562
562
|
function Cr(e) {
|
|
563
563
|
{
|
|
564
|
-
for (var
|
|
565
|
-
var
|
|
566
|
-
if (
|
|
567
|
-
|
|
564
|
+
for (var s = Object.keys(e.props), i = 0; i < s.length; i++) {
|
|
565
|
+
var p = s[i];
|
|
566
|
+
if (p !== "children" && p !== "key") {
|
|
567
|
+
re(e), N("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", p), re(null);
|
|
568
568
|
break;
|
|
569
569
|
}
|
|
570
570
|
}
|
|
571
|
-
e.ref !== null && (
|
|
571
|
+
e.ref !== null && (re(e), N("Invalid attribute `ref` supplied to `React.Fragment`."), re(null));
|
|
572
572
|
}
|
|
573
573
|
}
|
|
574
|
-
var
|
|
575
|
-
function
|
|
574
|
+
var Ve = {};
|
|
575
|
+
function Be(e, s, i, p, S, _) {
|
|
576
576
|
{
|
|
577
|
-
var
|
|
578
|
-
if (!
|
|
577
|
+
var E = W(e);
|
|
578
|
+
if (!E) {
|
|
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
|
-
var
|
|
582
|
-
|
|
583
|
-
var
|
|
584
|
-
e === null ?
|
|
581
|
+
var U = Er();
|
|
582
|
+
U ? j += U : j += Ue();
|
|
583
|
+
var $;
|
|
584
|
+
e === null ? $ = "null" : ke(e) ? $ = "array" : e !== void 0 && e.$$typeof === n ? ($ = "<" + (z(e.type) || "Unknown") + " />", j = " Did you accidentally export a JSX literal instead of a component?") : $ = typeof e, N("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", $, j);
|
|
585
585
|
}
|
|
586
|
-
var
|
|
587
|
-
if (
|
|
588
|
-
return
|
|
589
|
-
if (
|
|
590
|
-
var
|
|
591
|
-
if (
|
|
592
|
-
if (
|
|
593
|
-
if (
|
|
594
|
-
for (var
|
|
595
|
-
|
|
596
|
-
Object.freeze && Object.freeze(
|
|
586
|
+
var L = wr(e, s, i, S, _);
|
|
587
|
+
if (L == null)
|
|
588
|
+
return L;
|
|
589
|
+
if (E) {
|
|
590
|
+
var J = s.children;
|
|
591
|
+
if (J !== void 0)
|
|
592
|
+
if (p)
|
|
593
|
+
if (ke(J)) {
|
|
594
|
+
for (var te = 0; te < J.length; te++)
|
|
595
|
+
Ye(J[te], e);
|
|
596
|
+
Object.freeze && Object.freeze(J);
|
|
597
597
|
} else
|
|
598
|
-
|
|
598
|
+
N("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(J, e);
|
|
601
601
|
}
|
|
602
|
-
if (
|
|
603
|
-
var
|
|
602
|
+
if (oe.call(s, "key")) {
|
|
603
|
+
var Q = z(e), q = Object.keys(s).filter(function(Or) {
|
|
604
604
|
return Or !== "key";
|
|
605
|
-
}),
|
|
606
|
-
if (!
|
|
607
|
-
var
|
|
608
|
-
|
|
605
|
+
}), Te = q.length > 0 ? "{key: someKey, " + q.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
606
|
+
if (!Ve[Q + Te]) {
|
|
607
|
+
var _r = q.length > 0 ? "{" + q.join(": ..., ") + ": ...}" : "{}";
|
|
608
|
+
N(`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} />`,
|
|
613
|
+
<%s key={someKey} {...props} />`, Te, Q, _r, Q), Ve[Q + Te] = !0;
|
|
614
614
|
}
|
|
615
615
|
}
|
|
616
|
-
return e ===
|
|
616
|
+
return e === l ? Cr(L) : kr(L), L;
|
|
617
617
|
}
|
|
618
618
|
}
|
|
619
|
-
function
|
|
620
|
-
return
|
|
619
|
+
function Sr(e, s, i) {
|
|
620
|
+
return Be(e, s, i, !0);
|
|
621
621
|
}
|
|
622
|
-
function
|
|
623
|
-
return
|
|
622
|
+
function Rr(e, s, i) {
|
|
623
|
+
return Be(e, s, i, !1);
|
|
624
624
|
}
|
|
625
|
-
var
|
|
626
|
-
|
|
627
|
-
})()),
|
|
625
|
+
var Tr = Rr, Ir = Sr;
|
|
626
|
+
de.Fragment = l, de.jsx = Tr, de.jsxs = Ir;
|
|
627
|
+
})()), de;
|
|
628
628
|
}
|
|
629
|
-
var
|
|
630
|
-
function
|
|
631
|
-
return
|
|
629
|
+
var Ge;
|
|
630
|
+
function Jr() {
|
|
631
|
+
return Ge || (Ge = 1, process.env.NODE_ENV === "production" ? ve.exports = Vr() : ve.exports = Br()), ve.exports;
|
|
632
632
|
}
|
|
633
|
-
var r =
|
|
633
|
+
var r = Jr();
|
|
634
634
|
function nr({
|
|
635
635
|
open: t,
|
|
636
636
|
onClose: n,
|
|
637
|
-
data:
|
|
638
|
-
title:
|
|
639
|
-
placement:
|
|
637
|
+
data: a,
|
|
638
|
+
title: l = "Data Viewer",
|
|
639
|
+
placement: c = "center",
|
|
640
640
|
// "center" | "bottom"
|
|
641
|
-
pretty:
|
|
642
|
-
defaultMode:
|
|
641
|
+
pretty: f = 2,
|
|
642
|
+
defaultMode: m = "yaml",
|
|
643
643
|
// "json" | "yaml"
|
|
644
|
-
fileBaseName:
|
|
645
|
-
contentClassName:
|
|
644
|
+
fileBaseName: o = "form-data",
|
|
645
|
+
contentClassName: d = ""
|
|
646
646
|
}) {
|
|
647
|
-
const
|
|
648
|
-
const
|
|
647
|
+
const w = c === "center", [v, b] = k.useState(m === "yaml" ? "yaml" : "json"), x = k.useMemo(() => {
|
|
648
|
+
const h = Math.max(2, f | 0);
|
|
649
649
|
try {
|
|
650
|
-
return
|
|
651
|
-
indent:
|
|
650
|
+
return v === "yaml" ? Yr.dump(a ?? {}, {
|
|
651
|
+
indent: h,
|
|
652
652
|
lineWidth: 80,
|
|
653
653
|
noRefs: !0,
|
|
654
654
|
forceQuotes: !0,
|
|
655
655
|
skipInvalid: !0
|
|
656
|
-
}) : JSON.stringify(
|
|
656
|
+
}) : JSON.stringify(a ?? {}, null, h);
|
|
657
657
|
} catch {
|
|
658
|
-
return
|
|
658
|
+
return v === "yaml" ? "# Failed to render YAML" : String(a);
|
|
659
659
|
}
|
|
660
|
-
}, [
|
|
661
|
-
|
|
662
|
-
const
|
|
663
|
-
|
|
664
|
-
},
|
|
665
|
-
|
|
660
|
+
}, [a, v, f]), C = (h) => h.stopPropagation(), g = (h) => {
|
|
661
|
+
C(h);
|
|
662
|
+
const F = v === "yaml", N = new Blob([x], { type: F ? "text/yaml" : "application/json" }), T = URL.createObjectURL(N), R = document.createElement("a");
|
|
663
|
+
R.href = T, R.download = `${o}.${F ? "yml" : "json"}`, R.click(), URL.revokeObjectURL(T);
|
|
664
|
+
}, O = async (h) => {
|
|
665
|
+
C(h);
|
|
666
666
|
try {
|
|
667
|
-
await navigator.clipboard.writeText(
|
|
667
|
+
await navigator.clipboard.writeText(x);
|
|
668
668
|
} catch {
|
|
669
669
|
}
|
|
670
670
|
};
|
|
671
|
-
return /* @__PURE__ */ r.jsx(
|
|
672
|
-
|
|
671
|
+
return /* @__PURE__ */ r.jsx(qr, { children: t && /* @__PURE__ */ r.jsx(
|
|
672
|
+
Z.div,
|
|
673
673
|
{
|
|
674
674
|
className: "fixed inset-0 z-[60] flex items-center justify-center",
|
|
675
675
|
initial: { opacity: 0 },
|
|
@@ -679,20 +679,20 @@ function nr({
|
|
|
679
679
|
"aria-modal": "true",
|
|
680
680
|
role: "dialog",
|
|
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
|
+
Z.div,
|
|
683
683
|
{
|
|
684
|
-
onMouseDown:
|
|
685
|
-
initial: { y:
|
|
684
|
+
onMouseDown: C,
|
|
685
|
+
initial: { y: w ? 20 : "100%", opacity: w ? 0 : 1, scale: w ? 0.98 : 1 },
|
|
686
686
|
animate: { y: 0, opacity: 1, scale: 1 },
|
|
687
|
-
exit: { y:
|
|
687
|
+
exit: { y: w ? 20 : "100%", opacity: w ? 0 : 1, scale: w ? 0.98 : 1 },
|
|
688
688
|
transition: { type: "spring", stiffness: 160, damping: 20 },
|
|
689
|
-
className:
|
|
689
|
+
className: w ? "w-full sm:max-w-2xl sm:rounded-2xl rounded-t-2xl bg-white shadow-lg border border-black/10 max-h-[80vh] overflow-hidden" : "w-full mx-auto bg-black/5 border border-black/15 px-6 py-4 rounded-2xl backdrop-blur-xl overflow-hidden",
|
|
690
690
|
children: [
|
|
691
|
-
/* @__PURE__ */ r.jsxs("div", { className: `flex items-center justify-between ${
|
|
691
|
+
/* @__PURE__ */ r.jsxs("div", { className: `flex items-center justify-between ${w ? "px-4 py-3 border-b border-black/10" : ""}`, children: [
|
|
692
692
|
/* @__PURE__ */ r.jsxs("h3", { className: "font-semibold", children: [
|
|
693
|
-
|
|
693
|
+
l,
|
|
694
694
|
" (",
|
|
695
|
-
|
|
695
|
+
v.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 ${v === "yaml" ? "bg-black/6" : "bg-gray-200 hover:bg-black/5"}`,
|
|
704
|
+
"aria-pressed": v === "yaml",
|
|
705
|
+
onClick: (h) => {
|
|
706
|
+
C(h), b("yaml");
|
|
707
707
|
},
|
|
708
708
|
children: "YAML"
|
|
709
709
|
}
|
|
@@ -711,49 +711,82 @@ 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 ${v === "json" ? "bg-black/6" : "bg-gray-200 hover:bg-black/5"}`,
|
|
715
|
+
"aria-pressed": v === "json",
|
|
716
|
+
onClick: (h) => {
|
|
717
|
+
C(h), b("json");
|
|
718
718
|
},
|
|
719
719
|
children: "JSON"
|
|
720
720
|
}
|
|
721
721
|
)
|
|
722
722
|
] }),
|
|
723
|
-
/* @__PURE__ */ r.jsx("button", { className: "px-3 py-1 rounded-lg border border-black/10 hover:bg-black/5 text-sm", onClick:
|
|
724
|
-
/* @__PURE__ */ r.jsx("button", { className: "px-3 py-1 rounded-lg border border-black/10 hover:bg-black/5 text-sm", onClick:
|
|
723
|
+
/* @__PURE__ */ r.jsx("button", { className: "px-3 py-1 rounded-lg border border-black/10 hover:bg-black/5 text-sm", onClick: O, children: "Copy" }),
|
|
724
|
+
/* @__PURE__ */ r.jsx("button", { className: "px-3 py-1 rounded-lg border border-black/10 hover:bg-black/5 text-sm", onClick: g, children: "Download" }),
|
|
725
725
|
/* @__PURE__ */ r.jsx(
|
|
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: (h) => {
|
|
730
|
+
C(h), n == null || n();
|
|
731
731
|
},
|
|
732
732
|
children: "Close"
|
|
733
733
|
}
|
|
734
734
|
)
|
|
735
735
|
] })
|
|
736
736
|
] }),
|
|
737
|
-
/* @__PURE__ */ r.jsx("div", { className:
|
|
737
|
+
/* @__PURE__ */ r.jsx("div", { className: w ? `p-4 overflow-auto max-h-[70vh] ${d}` : `mt-2 p-2 rounded-lg overflow-y-auto max-h-96 ${d}`, children: /* @__PURE__ */ r.jsx("pre", { className: "whitespace-pre-wrap break-words text-sm text-gray-700", children: x }) })
|
|
738
738
|
]
|
|
739
739
|
}
|
|
740
740
|
) })
|
|
741
741
|
}
|
|
742
742
|
) });
|
|
743
743
|
}
|
|
744
|
-
function
|
|
745
|
-
const [t, n] =
|
|
744
|
+
function zr() {
|
|
745
|
+
const [t, n] = ne(!1), [a, l] = ne(!1), [c, f] = ne(null), m = Y((h) => h.replaceAll), o = rr(), d = ee(), w = d.state.isPreview, v = (h, F) => {
|
|
746
746
|
try {
|
|
747
|
-
const
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
747
|
+
const N = String(h).replace(/^\uFEFF/, "").trim(), T = JSON.parse(N);
|
|
748
|
+
let R, A = null;
|
|
749
|
+
if (F === "surveyjs") {
|
|
750
|
+
const X = Ar(T, "surveyjs");
|
|
751
|
+
if (R = X.fields || X, A = X.conversionReport, A) {
|
|
752
|
+
d.setConversionReport(A), console.log("[Editor] SurveyJS schema converted:", {
|
|
753
|
+
totalElements: A.totalElements,
|
|
754
|
+
convertedFields: A.convertedFields,
|
|
755
|
+
droppedFields: A.droppedFields.length,
|
|
756
|
+
warnings: A.warnings.length
|
|
757
|
+
});
|
|
758
|
+
const ae = [
|
|
759
|
+
`✅ Converted ${A.convertedFields} of ${A.totalElements} fields`,
|
|
760
|
+
A.droppedFields.length > 0 ? `⚠️ Dropped ${A.droppedFields.length} unsupported fields` : null,
|
|
761
|
+
A.warnings.length > 0 ? `⚠️ ${A.warnings.length} conversion warnings (check console)` : null
|
|
762
|
+
].filter(Boolean).join(`
|
|
763
|
+
`);
|
|
764
|
+
if (alert(`SurveyJS Import Complete:
|
|
765
|
+
|
|
766
|
+
${ae}`), A.warnings.length > 0) {
|
|
767
|
+
const G = A.warnings.filter((W) => W.impact === "high"), K = A.warnings.filter((W) => W.impact === "medium");
|
|
768
|
+
G.length > 0 && console.warn(`⚠️ HIGH IMPACT (${G.length}):`, G), K.length > 0 && console.warn(`⚠️ MEDIUM IMPACT (${K.length}):`, K);
|
|
769
|
+
}
|
|
770
|
+
A.droppedFields.length > 0 && console.error("❌ DROPPED FIELDS:", A.droppedFields);
|
|
771
|
+
}
|
|
772
|
+
} else
|
|
773
|
+
R = Array.isArray(T) ? T : T == null ? void 0 : T.fields;
|
|
774
|
+
if (!Array.isArray(R))
|
|
775
|
+
throw new Error("Expected array of fields or { fields: [] }");
|
|
776
|
+
m(R), d.selectedFieldId.clear(), d.preview.set(!1);
|
|
777
|
+
} catch (N) {
|
|
778
|
+
alert((N == null ? void 0 : N.message) || "Invalid JSON format");
|
|
752
779
|
}
|
|
753
|
-
},
|
|
754
|
-
|
|
755
|
-
},
|
|
756
|
-
|
|
780
|
+
}, b = (h) => {
|
|
781
|
+
f(h), l(!0);
|
|
782
|
+
}, x = (h) => {
|
|
783
|
+
c && v(c, h), l(!1), f(null);
|
|
784
|
+
}, C = () => {
|
|
785
|
+
l(!1), f(null);
|
|
786
|
+
}, g = () => {
|
|
787
|
+
d.preview.set(!0), d.selectedFieldId.clear();
|
|
788
|
+
}, O = () => {
|
|
789
|
+
d.preview.set(!1);
|
|
757
790
|
};
|
|
758
791
|
return /* @__PURE__ */ r.jsxs("header", { className: "sticky top-0 z-49 bg-transparent mx-auto", children: [
|
|
759
792
|
/* @__PURE__ */ r.jsxs("div", { className: "py-6 text-center", children: [
|
|
@@ -765,16 +798,16 @@ function Br() {
|
|
|
765
798
|
/* @__PURE__ */ r.jsx(
|
|
766
799
|
"button",
|
|
767
800
|
{
|
|
768
|
-
className: `py-3 rounded-xl text-sm font-medium ${
|
|
769
|
-
onClick:
|
|
801
|
+
className: `py-3 rounded-xl text-sm font-medium ${w ? "" : "bg-black/10"}`,
|
|
802
|
+
onClick: O,
|
|
770
803
|
children: "Builder"
|
|
771
804
|
}
|
|
772
805
|
),
|
|
773
806
|
/* @__PURE__ */ r.jsx(
|
|
774
807
|
"button",
|
|
775
808
|
{
|
|
776
|
-
className: `py-3 rounded-xl text-sm font-medium ${
|
|
777
|
-
onClick:
|
|
809
|
+
className: `py-3 rounded-xl text-sm font-medium ${w ? "bg-black/10" : ""}`,
|
|
810
|
+
onClick: g,
|
|
778
811
|
children: "Preview"
|
|
779
812
|
}
|
|
780
813
|
)
|
|
@@ -788,15 +821,15 @@ function Br() {
|
|
|
788
821
|
className: "hidden",
|
|
789
822
|
type: "file",
|
|
790
823
|
accept: ".json,application/json",
|
|
791
|
-
onChange: (
|
|
792
|
-
var
|
|
793
|
-
const
|
|
794
|
-
if (!
|
|
795
|
-
const
|
|
796
|
-
|
|
797
|
-
var
|
|
798
|
-
return b(((
|
|
799
|
-
},
|
|
824
|
+
onChange: (h) => {
|
|
825
|
+
var T;
|
|
826
|
+
const F = (T = h.target.files) == null ? void 0 : T[0];
|
|
827
|
+
if (!F) return;
|
|
828
|
+
const N = new FileReader();
|
|
829
|
+
N.onload = (R) => {
|
|
830
|
+
var A;
|
|
831
|
+
return b(((A = R.target) == null ? void 0 : A.result) ?? "");
|
|
832
|
+
}, N.readAsText(F), h.target.value = "";
|
|
800
833
|
}
|
|
801
834
|
}
|
|
802
835
|
)
|
|
@@ -816,77 +849,121 @@ function Br() {
|
|
|
816
849
|
{
|
|
817
850
|
open: t,
|
|
818
851
|
onClose: () => n(!1),
|
|
819
|
-
data:
|
|
852
|
+
data: o,
|
|
820
853
|
title: "Form Data",
|
|
821
854
|
placement: "bottom",
|
|
822
855
|
contentClassName: "custom-scrollbar"
|
|
823
856
|
}
|
|
824
|
-
)
|
|
857
|
+
),
|
|
858
|
+
a && /* @__PURE__ */ r.jsx("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4", children: /* @__PURE__ */ r.jsxs("div", { className: "bg-white rounded-2xl shadow-2xl max-w-md w-full p-6", children: [
|
|
859
|
+
/* @__PURE__ */ r.jsxs("div", { className: "mb-6", children: [
|
|
860
|
+
/* @__PURE__ */ r.jsx("h3", { className: "text-xl font-semibold text-slate-900 mb-2", children: "Select Schema Type" }),
|
|
861
|
+
/* @__PURE__ */ r.jsx("p", { className: "text-sm text-slate-600", children: "Choose the format of the file you're importing" })
|
|
862
|
+
] }),
|
|
863
|
+
/* @__PURE__ */ r.jsxs("div", { className: "space-y-3 mb-6", children: [
|
|
864
|
+
/* @__PURE__ */ r.jsx(
|
|
865
|
+
"button",
|
|
866
|
+
{
|
|
867
|
+
onClick: () => x("inhouse"),
|
|
868
|
+
className: "w-full text-left p-4 rounded-xl border-2 border-slate-200 hover:border-blue-500 hover:bg-blue-50 transition-all group",
|
|
869
|
+
children: /* @__PURE__ */ r.jsxs("div", { className: "flex items-start gap-3", children: [
|
|
870
|
+
/* @__PURE__ */ r.jsx("div", { className: "w-5 h-5 rounded-full border-2 border-slate-300 group-hover:border-blue-500 flex items-center justify-center flex-shrink-0 mt-0.5", children: /* @__PURE__ */ r.jsx("div", { className: "w-2.5 h-2.5 rounded-full bg-transparent group-hover:bg-blue-500" }) }),
|
|
871
|
+
/* @__PURE__ */ r.jsxs("div", { className: "flex-1", children: [
|
|
872
|
+
/* @__PURE__ */ r.jsx("div", { className: "font-semibold text-slate-900 mb-1", children: "Default Schema" }),
|
|
873
|
+
/* @__PURE__ */ r.jsx("div", { className: "text-sm text-slate-600", children: "Our internal questionnaire format" })
|
|
874
|
+
] })
|
|
875
|
+
] })
|
|
876
|
+
}
|
|
877
|
+
),
|
|
878
|
+
/* @__PURE__ */ r.jsx(
|
|
879
|
+
"button",
|
|
880
|
+
{
|
|
881
|
+
onClick: () => x("surveyjs"),
|
|
882
|
+
className: "w-full text-left p-4 rounded-xl border-2 border-slate-200 hover:border-purple-500 hover:bg-purple-50 transition-all group",
|
|
883
|
+
children: /* @__PURE__ */ r.jsxs("div", { className: "flex items-start gap-3", children: [
|
|
884
|
+
/* @__PURE__ */ r.jsx("div", { className: "w-5 h-5 rounded-full border-2 border-slate-300 group-hover:border-purple-500 flex items-center justify-center flex-shrink-0 mt-0.5", children: /* @__PURE__ */ r.jsx("div", { className: "w-2.5 h-2.5 rounded-full bg-transparent group-hover:bg-purple-500" }) }),
|
|
885
|
+
/* @__PURE__ */ r.jsxs("div", { className: "flex-1", children: [
|
|
886
|
+
/* @__PURE__ */ r.jsx("div", { className: "font-semibold text-slate-900 mb-1", children: "SurveyJS Schema" }),
|
|
887
|
+
/* @__PURE__ */ r.jsx("div", { className: "text-sm text-slate-600", children: "Will be converted to our internal format" })
|
|
888
|
+
] })
|
|
889
|
+
] })
|
|
890
|
+
}
|
|
891
|
+
)
|
|
892
|
+
] }),
|
|
893
|
+
/* @__PURE__ */ r.jsx(
|
|
894
|
+
"button",
|
|
895
|
+
{
|
|
896
|
+
onClick: C,
|
|
897
|
+
className: "w-full px-4 py-2.5 rounded-xl border border-slate-300 bg-white hover:bg-slate-50 text-slate-700 font-medium text-sm transition-colors",
|
|
898
|
+
children: "Cancel"
|
|
899
|
+
}
|
|
900
|
+
)
|
|
901
|
+
] }) })
|
|
825
902
|
] });
|
|
826
903
|
}
|
|
827
|
-
function
|
|
828
|
-
const [t, n] =
|
|
829
|
-
n((
|
|
830
|
-
},
|
|
831
|
-
|
|
832
|
-
},
|
|
833
|
-
|
|
904
|
+
function Gr() {
|
|
905
|
+
const [t, n] = ne(!1), [a, l] = ne(!1), c = er(null), f = Y((x) => x.addField), m = rr(), o = ee(), d = o.state.isPreview, w = () => {
|
|
906
|
+
n((x) => !x), l(!1);
|
|
907
|
+
}, v = () => {
|
|
908
|
+
l((x) => !x), n(!1);
|
|
909
|
+
}, b = () => {
|
|
910
|
+
o.preview.toggle(), n(!1), l(!1);
|
|
834
911
|
};
|
|
835
|
-
return
|
|
836
|
-
if (!t ||
|
|
837
|
-
const
|
|
838
|
-
const
|
|
839
|
-
|
|
912
|
+
return se(() => {
|
|
913
|
+
if (!t || a) return;
|
|
914
|
+
const x = (C) => {
|
|
915
|
+
const g = c.current;
|
|
916
|
+
g && !g.contains(C.target) && (n(!1), l(!1));
|
|
840
917
|
};
|
|
841
|
-
return document.addEventListener("pointerdown",
|
|
842
|
-
}, [t,
|
|
918
|
+
return document.addEventListener("pointerdown", x), () => document.removeEventListener("pointerdown", x);
|
|
919
|
+
}, [t, a]), /* @__PURE__ */ r.jsxs("div", { className: "MobileToolBar fixed bottom-0 left-0 w-full text-stone-900 shadow-lg z-10", children: [
|
|
843
920
|
/* @__PURE__ */ r.jsxs(
|
|
844
|
-
|
|
921
|
+
Z.div,
|
|
845
922
|
{
|
|
846
923
|
initial: { y: "100%" },
|
|
847
924
|
animate: { y: "0%" },
|
|
848
925
|
transition: { duration: 0.8, ease: [0.25, 0.1, 0.25, 1] },
|
|
849
|
-
className: `flex ${
|
|
926
|
+
className: `flex ${d ? "justify-center" : "justify-around"} pb-5 max-w-xl sm:max-w-4xl mx-auto`,
|
|
850
927
|
children: [
|
|
851
928
|
/* @__PURE__ */ r.jsx(
|
|
852
|
-
|
|
929
|
+
Z.button,
|
|
853
930
|
{
|
|
854
|
-
onClick:
|
|
931
|
+
onClick: b,
|
|
855
932
|
initial: { opacity: 1, scale: 1, x: "0%" },
|
|
856
933
|
animate: {
|
|
857
|
-
opacity: t ||
|
|
858
|
-
scale: t ||
|
|
859
|
-
x:
|
|
934
|
+
opacity: t || a ? 0 : 1,
|
|
935
|
+
scale: t || a ? 0 : 1,
|
|
936
|
+
x: d ? "120%" : "0%"
|
|
860
937
|
},
|
|
861
|
-
className: `relative cursor-pointer ${
|
|
862
|
-
children:
|
|
938
|
+
className: `relative cursor-pointer ${d ? "mx-29" : ""} bg-black/5 rounded-2xl p-3 backdrop-blur-xl`,
|
|
939
|
+
children: d ? /* @__PURE__ */ r.jsx(Pr, { className: "h-12 w-12" }) : /* @__PURE__ */ r.jsx(Dr, { className: "h-12 w-12" })
|
|
863
940
|
}
|
|
864
941
|
),
|
|
865
|
-
!
|
|
866
|
-
|
|
942
|
+
!d && /* @__PURE__ */ r.jsx(
|
|
943
|
+
Z.button,
|
|
867
944
|
{
|
|
868
|
-
onClick:
|
|
945
|
+
onClick: w,
|
|
869
946
|
initial: { opacity: 1, scale: 1 },
|
|
870
947
|
animate: {
|
|
871
|
-
opacity: t ||
|
|
872
|
-
scale: t ||
|
|
948
|
+
opacity: t || a ? 0 : 1,
|
|
949
|
+
scale: t || a ? 0 : 1
|
|
873
950
|
},
|
|
874
951
|
className: "relative cursor-pointer bg-black/5 rounded-2xl p-3 backdrop-blur-xl",
|
|
875
|
-
children: /* @__PURE__ */ r.jsx(
|
|
952
|
+
children: /* @__PURE__ */ r.jsx(Fr, { className: "h-12 w-12" })
|
|
876
953
|
}
|
|
877
954
|
),
|
|
878
955
|
/* @__PURE__ */ r.jsx(
|
|
879
|
-
|
|
956
|
+
Z.button,
|
|
880
957
|
{
|
|
881
|
-
onClick:
|
|
958
|
+
onClick: v,
|
|
882
959
|
initial: { opacity: 1, scale: 1, x: "0%" },
|
|
883
960
|
animate: {
|
|
884
|
-
opacity:
|
|
885
|
-
scale:
|
|
886
|
-
x:
|
|
961
|
+
opacity: a || t ? 0 : 1,
|
|
962
|
+
scale: a || t ? 0 : 1,
|
|
963
|
+
x: d ? "-120%" : "0%"
|
|
887
964
|
},
|
|
888
|
-
className: `relative cursor-pointer ${
|
|
889
|
-
children: /* @__PURE__ */ r.jsx(
|
|
965
|
+
className: `relative cursor-pointer ${d ? "mx-29" : ""} bg-black/5 rounded-2xl p-3 backdrop-blur-xl`,
|
|
966
|
+
children: /* @__PURE__ */ r.jsx($r, { className: "h-12 w-12" })
|
|
890
967
|
}
|
|
891
968
|
)
|
|
892
969
|
]
|
|
@@ -895,19 +972,19 @@ function Jr() {
|
|
|
895
972
|
/* @__PURE__ */ r.jsx(
|
|
896
973
|
nr,
|
|
897
974
|
{
|
|
898
|
-
open:
|
|
899
|
-
onClose: () =>
|
|
900
|
-
data:
|
|
975
|
+
open: a,
|
|
976
|
+
onClose: () => l(!1),
|
|
977
|
+
data: m,
|
|
901
978
|
title: "Form Data",
|
|
902
979
|
placement: "bottom",
|
|
903
980
|
contentClassName: "custom-scrollbar"
|
|
904
981
|
}
|
|
905
982
|
),
|
|
906
983
|
/* @__PURE__ */ r.jsx(
|
|
907
|
-
|
|
984
|
+
Z.div,
|
|
908
985
|
{
|
|
909
|
-
ref:
|
|
910
|
-
onPointerDown: (
|
|
986
|
+
ref: c,
|
|
987
|
+
onPointerDown: (x) => x.stopPropagation(),
|
|
911
988
|
initial: { opacity: 0, y: "100%", scale: 0 },
|
|
912
989
|
animate: {
|
|
913
990
|
opacity: t ? 1 : 0,
|
|
@@ -917,108 +994,108 @@ function Jr() {
|
|
|
917
994
|
transition: { type: "spring", stiffness: 150, damping: 20 },
|
|
918
995
|
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
996
|
children: /* @__PURE__ */ r.jsxs("div", { className: "grid grid-cols-1 gap-2", children: [
|
|
920
|
-
/* @__PURE__ */ r.jsx("button", { className: "flex w-full justify-end", onClick: () => n(!1), children: /* @__PURE__ */ r.jsx(
|
|
921
|
-
Object.keys(
|
|
997
|
+
/* @__PURE__ */ r.jsx("button", { className: "flex w-full justify-end", onClick: () => n(!1), children: /* @__PURE__ */ r.jsx(Lr, {}) }),
|
|
998
|
+
Object.keys(fe).map((x) => /* @__PURE__ */ r.jsxs(
|
|
922
999
|
"button",
|
|
923
1000
|
{
|
|
924
1001
|
className: "px-4 pl-6 py-2 text-black text-left rounded hover:bg-slate-50",
|
|
925
1002
|
onClick: () => {
|
|
926
|
-
|
|
1003
|
+
f(x), n(!1);
|
|
927
1004
|
},
|
|
928
1005
|
children: [
|
|
929
1006
|
"Add ",
|
|
930
|
-
|
|
1007
|
+
fe[x].label
|
|
931
1008
|
]
|
|
932
1009
|
},
|
|
933
|
-
|
|
1010
|
+
x
|
|
934
1011
|
))
|
|
935
1012
|
] })
|
|
936
1013
|
}
|
|
937
1014
|
)
|
|
938
1015
|
] });
|
|
939
1016
|
}
|
|
940
|
-
const
|
|
1017
|
+
const Ke = Object.entries(fe).map(([t, n]) => ({
|
|
941
1018
|
type: t,
|
|
942
1019
|
label: n.label
|
|
943
|
-
})),
|
|
1020
|
+
})), Kr = ({ isPreview: t = !1 }) => {
|
|
944
1021
|
if (t) return null;
|
|
945
|
-
const n =
|
|
946
|
-
const
|
|
947
|
-
for (const { type:
|
|
948
|
-
return
|
|
1022
|
+
const n = Y((l) => l.addField), a = ue(() => {
|
|
1023
|
+
const l = {};
|
|
1024
|
+
for (const { type: c } of Ke) l[c] = () => n(c);
|
|
1025
|
+
return l;
|
|
949
1026
|
}, [n]);
|
|
950
1027
|
return /* @__PURE__ */ r.jsxs("div", { className: "p-4 bg-white border border-gray-200 rounded-lg shadow-sm", children: [
|
|
951
1028
|
/* @__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:
|
|
1029
|
+
/* @__PURE__ */ r.jsx("div", { className: "grid grid-cols-1 gap-2", children: Ke.map(({ type: l, label: c }) => /* @__PURE__ */ r.jsxs(
|
|
953
1030
|
"button",
|
|
954
1031
|
{
|
|
955
1032
|
className: "px-3 py-2 text-left border border-black/10 rounded-md hover:bg-slate-50",
|
|
956
|
-
onClick:
|
|
1033
|
+
onClick: a[l],
|
|
957
1034
|
children: [
|
|
958
1035
|
"Add ",
|
|
959
|
-
|
|
1036
|
+
c
|
|
960
1037
|
]
|
|
961
1038
|
},
|
|
962
|
-
|
|
1039
|
+
l
|
|
963
1040
|
)) })
|
|
964
1041
|
] });
|
|
965
|
-
},
|
|
966
|
-
function
|
|
1042
|
+
}, Hr = k.memo(Kr, (t, n) => t.isPreview === n.isPreview);
|
|
1043
|
+
function sr({
|
|
967
1044
|
id: t = "",
|
|
968
1045
|
label: n = "ID",
|
|
969
|
-
onCommit:
|
|
970
|
-
validate:
|
|
971
|
-
placeholder:
|
|
972
|
-
className:
|
|
1046
|
+
onCommit: a,
|
|
1047
|
+
validate: l,
|
|
1048
|
+
placeholder: c = "Enter unique ID…",
|
|
1049
|
+
className: f = ""
|
|
973
1050
|
}) {
|
|
974
|
-
const [
|
|
975
|
-
|
|
976
|
-
|
|
1051
|
+
const [m, o] = k.useState(t ?? ""), [d, w] = k.useState("");
|
|
1052
|
+
k.useEffect(() => {
|
|
1053
|
+
o(t ?? ""), w("");
|
|
977
1054
|
}, [t]);
|
|
978
|
-
const
|
|
979
|
-
const
|
|
980
|
-
if (!
|
|
981
|
-
|
|
1055
|
+
const v = k.useCallback(() => {
|
|
1056
|
+
const b = String(m ?? "").trim();
|
|
1057
|
+
if (!b) {
|
|
1058
|
+
w("ID cannot be empty."), o(t ?? "");
|
|
982
1059
|
return;
|
|
983
1060
|
}
|
|
984
|
-
if (
|
|
985
|
-
if (typeof
|
|
986
|
-
const
|
|
987
|
-
if (
|
|
988
|
-
|
|
1061
|
+
if (b !== (t ?? "")) {
|
|
1062
|
+
if (typeof l == "function") {
|
|
1063
|
+
const x = l(b, t ?? "");
|
|
1064
|
+
if (x) {
|
|
1065
|
+
w(x);
|
|
989
1066
|
return;
|
|
990
1067
|
}
|
|
991
1068
|
}
|
|
992
|
-
|
|
1069
|
+
a == null || a(b);
|
|
993
1070
|
}
|
|
994
|
-
}, [
|
|
995
|
-
return /* @__PURE__ */ r.jsxs("div", { className:
|
|
1071
|
+
}, [m, t, a, l]);
|
|
1072
|
+
return /* @__PURE__ */ r.jsxs("div", { className: f, children: [
|
|
996
1073
|
/* @__PURE__ */ r.jsx("label", { className: "block text-sm mb-1", children: n }),
|
|
997
1074
|
/* @__PURE__ */ r.jsx(
|
|
998
1075
|
"input",
|
|
999
1076
|
{
|
|
1000
1077
|
className: "w-full px-3 py-2 border border-black/20 rounded",
|
|
1001
|
-
value:
|
|
1002
|
-
onChange: (
|
|
1003
|
-
|
|
1078
|
+
value: m,
|
|
1079
|
+
onChange: (b) => {
|
|
1080
|
+
d && w(""), o(b.target.value);
|
|
1004
1081
|
},
|
|
1005
|
-
onBlur:
|
|
1006
|
-
onKeyDown: (
|
|
1007
|
-
|
|
1082
|
+
onBlur: v,
|
|
1083
|
+
onKeyDown: (b) => {
|
|
1084
|
+
b.key === "Enter" && (b.preventDefault(), v());
|
|
1008
1085
|
},
|
|
1009
|
-
placeholder:
|
|
1086
|
+
placeholder: c
|
|
1010
1087
|
}
|
|
1011
1088
|
),
|
|
1012
|
-
|
|
1089
|
+
d ? /* @__PURE__ */ r.jsx("p", { className: "text-xs text-red-600 mt-1", children: d }) : null
|
|
1013
1090
|
] });
|
|
1014
1091
|
}
|
|
1015
|
-
function
|
|
1092
|
+
function ar({ f: t, onUpdateField: n }) {
|
|
1016
1093
|
return /* @__PURE__ */ r.jsxs("div", { className: "space-y-3", children: [
|
|
1017
1094
|
/* @__PURE__ */ r.jsx(
|
|
1018
|
-
|
|
1095
|
+
sr,
|
|
1019
1096
|
{
|
|
1020
1097
|
id: t.id ?? "",
|
|
1021
|
-
onCommit: (
|
|
1098
|
+
onCommit: (a) => n == null ? void 0 : n("id", a)
|
|
1022
1099
|
}
|
|
1023
1100
|
),
|
|
1024
1101
|
/* @__PURE__ */ r.jsxs("div", { children: [
|
|
@@ -1028,7 +1105,7 @@ function sr({ f: t, onUpdateField: n }) {
|
|
|
1028
1105
|
{
|
|
1029
1106
|
className: "w-full px-3 py-2 border border-black/20 rounded",
|
|
1030
1107
|
value: t.question || "",
|
|
1031
|
-
onChange: (
|
|
1108
|
+
onChange: (a) => n("question", a.target.value),
|
|
1032
1109
|
placeholder: "Enter question text"
|
|
1033
1110
|
}
|
|
1034
1111
|
)
|
|
@@ -1039,7 +1116,7 @@ function sr({ f: t, onUpdateField: n }) {
|
|
|
1039
1116
|
{
|
|
1040
1117
|
type: "checkbox",
|
|
1041
1118
|
checked: !!t.required,
|
|
1042
|
-
onChange: (
|
|
1119
|
+
onChange: (a) => n("required", a.target.checked)
|
|
1043
1120
|
}
|
|
1044
1121
|
),
|
|
1045
1122
|
"Required"
|
|
@@ -1051,96 +1128,96 @@ function sr({ f: t, onUpdateField: n }) {
|
|
|
1051
1128
|
{
|
|
1052
1129
|
className: "w-full px-3 py-2 border border-black/20 rounded",
|
|
1053
1130
|
value: t.sublabel || "",
|
|
1054
|
-
onChange: (
|
|
1131
|
+
onChange: (a) => n("sublabel", a.target.value),
|
|
1055
1132
|
placeholder: "Helper text / description"
|
|
1056
1133
|
}
|
|
1057
1134
|
)
|
|
1058
1135
|
] })
|
|
1059
1136
|
] });
|
|
1060
1137
|
}
|
|
1061
|
-
const
|
|
1138
|
+
const M = [];
|
|
1062
1139
|
for (let t = 0; t < 256; ++t)
|
|
1063
|
-
|
|
1064
|
-
function
|
|
1065
|
-
return (
|
|
1140
|
+
M.push((t + 256).toString(16).slice(1));
|
|
1141
|
+
function Xr(t, n = 0) {
|
|
1142
|
+
return (M[t[n + 0]] + M[t[n + 1]] + M[t[n + 2]] + M[t[n + 3]] + "-" + M[t[n + 4]] + M[t[n + 5]] + "-" + M[t[n + 6]] + M[t[n + 7]] + "-" + M[t[n + 8]] + M[t[n + 9]] + "-" + M[t[n + 10]] + M[t[n + 11]] + M[t[n + 12]] + M[t[n + 13]] + M[t[n + 14]] + M[t[n + 15]]).toLowerCase();
|
|
1066
1143
|
}
|
|
1067
|
-
let
|
|
1068
|
-
const
|
|
1069
|
-
function
|
|
1070
|
-
if (!
|
|
1144
|
+
let Ie;
|
|
1145
|
+
const Qr = new Uint8Array(16);
|
|
1146
|
+
function Zr() {
|
|
1147
|
+
if (!Ie) {
|
|
1071
1148
|
if (typeof crypto > "u" || !crypto.getRandomValues)
|
|
1072
1149
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
1073
|
-
|
|
1150
|
+
Ie = crypto.getRandomValues.bind(crypto);
|
|
1074
1151
|
}
|
|
1075
|
-
return
|
|
1152
|
+
return Ie(Qr);
|
|
1076
1153
|
}
|
|
1077
|
-
const
|
|
1078
|
-
function
|
|
1079
|
-
var
|
|
1080
|
-
if (
|
|
1081
|
-
return
|
|
1154
|
+
const et = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), He = { randomUUID: et };
|
|
1155
|
+
function rt(t, n, a) {
|
|
1156
|
+
var c;
|
|
1157
|
+
if (He.randomUUID && !t)
|
|
1158
|
+
return He.randomUUID();
|
|
1082
1159
|
t = t || {};
|
|
1083
|
-
const
|
|
1084
|
-
if (
|
|
1160
|
+
const l = t.random ?? ((c = t.rng) == null ? void 0 : c.call(t)) ?? Zr();
|
|
1161
|
+
if (l.length < 16)
|
|
1085
1162
|
throw new Error("Random bytes length must be >= 16");
|
|
1086
|
-
return
|
|
1163
|
+
return l[6] = l[6] & 15 | 64, l[8] = l[8] & 63 | 128, Xr(l);
|
|
1087
1164
|
}
|
|
1088
|
-
function
|
|
1089
|
-
const
|
|
1090
|
-
n("options", [...
|
|
1091
|
-
},
|
|
1165
|
+
function lr({ field: t, onUpdateField: n }) {
|
|
1166
|
+
const a = t.options || [], l = () => {
|
|
1167
|
+
n("options", [...a, { id: rt(), value: "" }]);
|
|
1168
|
+
}, c = (m, o) => {
|
|
1092
1169
|
n(
|
|
1093
1170
|
"options",
|
|
1094
|
-
|
|
1171
|
+
a.map((d) => d.id === m ? { ...d, value: o } : d)
|
|
1095
1172
|
);
|
|
1096
|
-
},
|
|
1173
|
+
}, f = (m) => {
|
|
1097
1174
|
n(
|
|
1098
1175
|
"options",
|
|
1099
|
-
|
|
1176
|
+
a.filter((o) => o.id !== m)
|
|
1100
1177
|
);
|
|
1101
1178
|
};
|
|
1102
1179
|
return /* @__PURE__ */ r.jsxs("div", { className: "mt-3", children: [
|
|
1103
1180
|
/* @__PURE__ */ r.jsx("div", { className: "text-sm font-medium mb-1", children: "Options" }),
|
|
1104
|
-
|
|
1181
|
+
a.map((m) => /* @__PURE__ */ r.jsxs("div", { className: "flex items-center gap-2 mb-2", children: [
|
|
1105
1182
|
/* @__PURE__ */ r.jsx(
|
|
1106
1183
|
"input",
|
|
1107
1184
|
{
|
|
1108
1185
|
className: "flex-1 px-3 py-2 border border-black/20 rounded",
|
|
1109
|
-
value:
|
|
1110
|
-
onChange: (
|
|
1186
|
+
value: m.value,
|
|
1187
|
+
onChange: (o) => c(m.id, o.target.value),
|
|
1111
1188
|
placeholder: "Option text"
|
|
1112
1189
|
}
|
|
1113
1190
|
),
|
|
1114
1191
|
/* @__PURE__ */ r.jsx(
|
|
1115
1192
|
"button",
|
|
1116
1193
|
{
|
|
1117
|
-
onClick: () =>
|
|
1194
|
+
onClick: () => f(m.id),
|
|
1118
1195
|
className: "px-2 py-1 text-sm border border-black/20 rounded hover:bg-slate-50",
|
|
1119
1196
|
children: "Remove"
|
|
1120
1197
|
}
|
|
1121
1198
|
)
|
|
1122
|
-
] },
|
|
1199
|
+
] }, m.id)),
|
|
1123
1200
|
/* @__PURE__ */ r.jsx(
|
|
1124
1201
|
"button",
|
|
1125
1202
|
{
|
|
1126
|
-
onClick:
|
|
1203
|
+
onClick: l,
|
|
1127
1204
|
className: "mt-1 px-3 py-2 text-sm border border-black/20 rounded hover:bg-slate-50",
|
|
1128
1205
|
children: "+ Add Option"
|
|
1129
1206
|
}
|
|
1130
1207
|
)
|
|
1131
1208
|
] });
|
|
1132
1209
|
}
|
|
1133
|
-
function
|
|
1134
|
-
const n = tr(t.id),
|
|
1135
|
-
(
|
|
1210
|
+
function tt({ f: t }) {
|
|
1211
|
+
const n = tr(t.id), a = ge(
|
|
1212
|
+
(c, f) => n.field.update(c, f),
|
|
1136
1213
|
[n]
|
|
1137
|
-
),
|
|
1214
|
+
), l = ue(
|
|
1138
1215
|
() => ["radio", "check", "selection"].includes(t.fieldType),
|
|
1139
1216
|
[t.fieldType]
|
|
1140
1217
|
);
|
|
1141
1218
|
return /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
|
|
1142
1219
|
/* @__PURE__ */ r.jsx("h3", { className: "text-lg font-semibold mb-3", children: "Edit" }),
|
|
1143
|
-
/* @__PURE__ */ r.jsx(
|
|
1220
|
+
/* @__PURE__ */ r.jsx(ar, { f: t, onUpdateField: a }),
|
|
1144
1221
|
t.fieldType === "input" && /* @__PURE__ */ r.jsxs("div", { className: "mt-4", children: [
|
|
1145
1222
|
/* @__PURE__ */ r.jsx("div", { className: "text-sm font-medium mb-1", children: "Default Answer" }),
|
|
1146
1223
|
/* @__PURE__ */ r.jsx(
|
|
@@ -1148,74 +1225,74 @@ function et({ f: t }) {
|
|
|
1148
1225
|
{
|
|
1149
1226
|
className: "w-full px-3 py-2 border border-black/20 rounded",
|
|
1150
1227
|
value: t.answer || "",
|
|
1151
|
-
onChange: (
|
|
1228
|
+
onChange: (c) => a("answer", c.target.value),
|
|
1152
1229
|
placeholder: "Default value"
|
|
1153
1230
|
}
|
|
1154
1231
|
)
|
|
1155
1232
|
] }),
|
|
1156
|
-
|
|
1233
|
+
l && /* @__PURE__ */ r.jsx(lr, { field: t, onUpdateField: a })
|
|
1157
1234
|
] });
|
|
1158
1235
|
}
|
|
1159
|
-
function
|
|
1160
|
-
var
|
|
1161
|
-
const
|
|
1162
|
-
|
|
1163
|
-
var
|
|
1164
|
-
|
|
1165
|
-
}, [t.id]),
|
|
1166
|
-
if (!
|
|
1167
|
-
|
|
1236
|
+
function nt({ section: t, onActiveChildChange: n }) {
|
|
1237
|
+
var b, x, C;
|
|
1238
|
+
const a = tr(t.id), l = Array.isArray(t.fields) ? t.fields : [], [c, f] = ne(((b = l[0]) == null ? void 0 : b.id) || null);
|
|
1239
|
+
se(() => {
|
|
1240
|
+
var g;
|
|
1241
|
+
f(((g = l[0]) == null ? void 0 : g.id) || null);
|
|
1242
|
+
}, [t.id]), se(() => {
|
|
1243
|
+
if (!l.length) {
|
|
1244
|
+
c !== null && f(null);
|
|
1168
1245
|
return;
|
|
1169
1246
|
}
|
|
1170
|
-
|
|
1171
|
-
}, [
|
|
1172
|
-
n == null || n(t.id,
|
|
1173
|
-
}, [t.id,
|
|
1174
|
-
const
|
|
1175
|
-
(
|
|
1176
|
-
[
|
|
1177
|
-
),
|
|
1178
|
-
() =>
|
|
1179
|
-
[
|
|
1180
|
-
),
|
|
1181
|
-
(
|
|
1182
|
-
if (
|
|
1183
|
-
if (
|
|
1184
|
-
const
|
|
1185
|
-
if (!
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
{ id:
|
|
1247
|
+
l.some((O) => O.id === c) || f(l[0].id);
|
|
1248
|
+
}, [l, c]), se(() => {
|
|
1249
|
+
n == null || n(t.id, c || null);
|
|
1250
|
+
}, [t.id, c, n]);
|
|
1251
|
+
const m = ge(
|
|
1252
|
+
(g, O) => a.field.update(g, O),
|
|
1253
|
+
[a]
|
|
1254
|
+
), o = ue(
|
|
1255
|
+
() => l.find((g) => g.id === c) || null,
|
|
1256
|
+
[l, c]
|
|
1257
|
+
), d = ge(
|
|
1258
|
+
(g, O) => {
|
|
1259
|
+
if (o) {
|
|
1260
|
+
if (g === "id") {
|
|
1261
|
+
const h = String(O ?? "").trim();
|
|
1262
|
+
if (!h) return;
|
|
1263
|
+
Y.getState().updateField(
|
|
1264
|
+
o.id,
|
|
1265
|
+
{ id: h },
|
|
1189
1266
|
{
|
|
1190
1267
|
sectionId: t.id,
|
|
1191
|
-
onIdChange: (
|
|
1192
|
-
|
|
1268
|
+
onIdChange: (F, N) => {
|
|
1269
|
+
f((T) => T === N ? F : T);
|
|
1193
1270
|
}
|
|
1194
1271
|
}
|
|
1195
1272
|
);
|
|
1196
1273
|
return;
|
|
1197
1274
|
}
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
{ [
|
|
1275
|
+
Y.getState().updateField(
|
|
1276
|
+
o.id,
|
|
1277
|
+
{ [g]: O },
|
|
1201
1278
|
{ sectionId: t.id }
|
|
1202
1279
|
);
|
|
1203
1280
|
}
|
|
1204
1281
|
},
|
|
1205
|
-
[
|
|
1206
|
-
),
|
|
1207
|
-
|
|
1208
|
-
}, [
|
|
1209
|
-
() =>
|
|
1210
|
-
[
|
|
1282
|
+
[o, t.id]
|
|
1283
|
+
), w = ge(() => {
|
|
1284
|
+
o && Y.getState().deleteField(o.id, { sectionId: t.id });
|
|
1285
|
+
}, [o, t.id]), v = ue(
|
|
1286
|
+
() => o && ["radio", "check", "selection"].includes(o.fieldType),
|
|
1287
|
+
[o]
|
|
1211
1288
|
);
|
|
1212
1289
|
return /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
|
|
1213
1290
|
/* @__PURE__ */ r.jsx("h3", { className: "text-lg font-semibold mb-3", children: "Edit Section" }),
|
|
1214
1291
|
/* @__PURE__ */ r.jsx(
|
|
1215
|
-
|
|
1292
|
+
sr,
|
|
1216
1293
|
{
|
|
1217
1294
|
id: t.id,
|
|
1218
|
-
onCommit: (
|
|
1295
|
+
onCommit: (g) => a.field.renameId(g)
|
|
1219
1296
|
}
|
|
1220
1297
|
),
|
|
1221
1298
|
/* @__PURE__ */ r.jsxs("div", { className: "mt-3", children: [
|
|
@@ -1225,54 +1302,54 @@ function rt({ section: t, onActiveChildChange: n }) {
|
|
|
1225
1302
|
{
|
|
1226
1303
|
className: "w-full px-3 py-2 border border-black/20 rounded",
|
|
1227
1304
|
value: t.title || "",
|
|
1228
|
-
onChange: (
|
|
1305
|
+
onChange: (g) => m("title", g.target.value),
|
|
1229
1306
|
placeholder: "Section title"
|
|
1230
1307
|
}
|
|
1231
1308
|
)
|
|
1232
1309
|
] }),
|
|
1233
1310
|
/* @__PURE__ */ r.jsxs("div", { className: "mt-6", children: [
|
|
1234
1311
|
/* @__PURE__ */ r.jsx("div", { className: "text-sm font-semibold mb-2", children: "Fields in this section" }),
|
|
1235
|
-
|
|
1236
|
-
/* @__PURE__ */ r.jsx("div", { className: "flex flex-wrap gap-2 mb-3", children:
|
|
1237
|
-
var
|
|
1312
|
+
l.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: [
|
|
1313
|
+
/* @__PURE__ */ r.jsx("div", { className: "flex flex-wrap gap-2 mb-3", children: l.map((g) => {
|
|
1314
|
+
var O, h;
|
|
1238
1315
|
return /* @__PURE__ */ r.jsx(
|
|
1239
1316
|
"button",
|
|
1240
1317
|
{
|
|
1241
1318
|
className: [
|
|
1242
1319
|
"px-3 py-1.5 text-sm rounded border",
|
|
1243
|
-
|
|
1320
|
+
c === g.id ? "bg-black/5 border-black/20" : "bg-white border-black/10 hover:bg-slate-50"
|
|
1244
1321
|
].join(" "),
|
|
1245
|
-
onClick: () =>
|
|
1246
|
-
title:
|
|
1247
|
-
children: ((
|
|
1322
|
+
onClick: () => f(g.id),
|
|
1323
|
+
title: g.question || g.fieldType,
|
|
1324
|
+
children: ((O = g.question) == null ? void 0 : O.trim()) || ((h = fe[g.fieldType]) == null ? void 0 : h.label) || "Field"
|
|
1248
1325
|
},
|
|
1249
|
-
|
|
1326
|
+
g.id
|
|
1250
1327
|
);
|
|
1251
1328
|
}) }),
|
|
1252
|
-
|
|
1329
|
+
o && /* @__PURE__ */ r.jsxs("div", { className: "mt-2", children: [
|
|
1253
1330
|
/* @__PURE__ */ r.jsxs("div", { className: "text-sm font-semibold mb-2", children: [
|
|
1254
1331
|
"Editing: ",
|
|
1255
|
-
((
|
|
1332
|
+
((x = o.question) == null ? void 0 : x.trim()) || ((C = fe[o.fieldType]) == null ? void 0 : C.label)
|
|
1256
1333
|
] }),
|
|
1257
|
-
/* @__PURE__ */ r.jsx(
|
|
1258
|
-
|
|
1334
|
+
/* @__PURE__ */ r.jsx(ar, { f: o, onUpdateField: d }),
|
|
1335
|
+
o.fieldType === "input" && /* @__PURE__ */ r.jsxs("div", { className: "mt-4", children: [
|
|
1259
1336
|
/* @__PURE__ */ r.jsx("div", { className: "text-sm font-medium mb-1", children: "Default Answer" }),
|
|
1260
1337
|
/* @__PURE__ */ r.jsx(
|
|
1261
1338
|
"input",
|
|
1262
1339
|
{
|
|
1263
1340
|
className: "w-full px-3 py-2 border border-black/20 rounded",
|
|
1264
|
-
value:
|
|
1265
|
-
onChange: (
|
|
1341
|
+
value: o.answer || "",
|
|
1342
|
+
onChange: (g) => d("answer", g.target.value),
|
|
1266
1343
|
placeholder: "Default value"
|
|
1267
1344
|
}
|
|
1268
1345
|
)
|
|
1269
1346
|
] }),
|
|
1270
|
-
|
|
1347
|
+
v && /* @__PURE__ */ r.jsx(lr, { field: o, onUpdateField: d }),
|
|
1271
1348
|
/* @__PURE__ */ r.jsx(
|
|
1272
1349
|
"button",
|
|
1273
1350
|
{
|
|
1274
1351
|
className: "mt-3 px-3 py-2 text-sm text-red-400 border rounded",
|
|
1275
|
-
onClick:
|
|
1352
|
+
onClick: w,
|
|
1276
1353
|
children: "Delete this field"
|
|
1277
1354
|
}
|
|
1278
1355
|
)
|
|
@@ -1281,7 +1358,7 @@ function rt({ section: t, onActiveChildChange: n }) {
|
|
|
1281
1358
|
] })
|
|
1282
1359
|
] });
|
|
1283
1360
|
}
|
|
1284
|
-
function
|
|
1361
|
+
function Xe(t) {
|
|
1285
1362
|
switch (t) {
|
|
1286
1363
|
case "input":
|
|
1287
1364
|
return ["equals", "contains"];
|
|
@@ -1294,110 +1371,110 @@ function Qe(t) {
|
|
|
1294
1371
|
return ["equals"];
|
|
1295
1372
|
}
|
|
1296
1373
|
}
|
|
1297
|
-
function
|
|
1374
|
+
function Qe(t) {
|
|
1298
1375
|
if (t && typeof t == "object") {
|
|
1299
|
-
const
|
|
1300
|
-
return { id:
|
|
1376
|
+
const a = t.id ?? String(t.value ?? ""), l = String(t.value ?? t.label ?? t.id ?? "");
|
|
1377
|
+
return { id: a, value: l };
|
|
1301
1378
|
}
|
|
1302
1379
|
const n = String(t ?? "");
|
|
1303
1380
|
return { id: n, value: n };
|
|
1304
1381
|
}
|
|
1305
|
-
function
|
|
1306
|
-
var
|
|
1307
|
-
const t =
|
|
1308
|
-
(
|
|
1309
|
-
const
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
}, [
|
|
1313
|
-
if (
|
|
1314
|
-
if (
|
|
1315
|
-
const
|
|
1316
|
-
t.selectedChildId.set(
|
|
1382
|
+
function st() {
|
|
1383
|
+
var me, le, z;
|
|
1384
|
+
const t = ee(), n = Y((u) => u.byId), a = Y((u) => u.setEnableWhen), l = Y((u) => u.updateField), c = ((me = t == null ? void 0 : t.selectedFieldId) == null ? void 0 : me.value) ?? null;
|
|
1385
|
+
(le = t == null ? void 0 : t.selectedChildId) == null || le.ParentId;
|
|
1386
|
+
const f = ((z = t == null ? void 0 : t.selectedChildId) == null ? void 0 : z.ChildId) ?? null, m = c ? n[c] : null, o = (m == null ? void 0 : m.fieldType) === "section", d = k.useMemo(() => o ? Array.isArray(m == null ? void 0 : m.fields) ? m.fields : [] : [], [o, m]), w = k.useMemo(() => !o || !f ? !1 : d.some((u) => u.id === f), [o, f, d]), v = k.useMemo(() => o && w ? `child:${f}` : "", [o, w, f]), [b, x] = k.useState(v);
|
|
1387
|
+
k.useEffect(() => {
|
|
1388
|
+
x(v);
|
|
1389
|
+
}, [v]), k.useEffect(() => {
|
|
1390
|
+
if (o)
|
|
1391
|
+
if (b && b.startsWith("child:")) {
|
|
1392
|
+
const u = b.slice(6);
|
|
1393
|
+
t.selectedChildId.set(c, u);
|
|
1317
1394
|
} else
|
|
1318
1395
|
t.selectedChildId.set(null, null);
|
|
1319
|
-
}, [
|
|
1320
|
-
const
|
|
1321
|
-
var
|
|
1322
|
-
const
|
|
1323
|
-
for (const
|
|
1324
|
-
if (
|
|
1325
|
-
if (
|
|
1326
|
-
const
|
|
1327
|
-
|
|
1328
|
-
var
|
|
1329
|
-
|
|
1396
|
+
}, [o, b, c, t]);
|
|
1397
|
+
const C = !!(o && b && b.startsWith("child:")), g = C ? b.slice(6) : null, O = C ? g : c, h = k.useMemo(() => O ? C ? d.find((u) => u.id === g) ?? null : n[O] ?? null : null, [n, O, C, g, d]), F = k.useMemo(() => {
|
|
1398
|
+
var I, D, B;
|
|
1399
|
+
const u = [];
|
|
1400
|
+
for (const P of Object.values(n))
|
|
1401
|
+
if (P)
|
|
1402
|
+
if (P.fieldType === "section" && Array.isArray(P.fields)) {
|
|
1403
|
+
const V = ((I = P.title) == null ? void 0 : I.trim()) || "Section";
|
|
1404
|
+
P.fields.forEach((y) => {
|
|
1405
|
+
var H;
|
|
1406
|
+
u.push({
|
|
1330
1407
|
id: y.id,
|
|
1331
|
-
parentId:
|
|
1332
|
-
label: `${
|
|
1408
|
+
parentId: P.id,
|
|
1409
|
+
label: `${V} › ${((H = y.question) == null ? void 0 : H.trim()) || y.id}`,
|
|
1333
1410
|
fieldType: y.fieldType,
|
|
1334
1411
|
options: Array.isArray(y.options) ? y.options : []
|
|
1335
1412
|
});
|
|
1336
1413
|
});
|
|
1337
1414
|
} else
|
|
1338
|
-
|
|
1339
|
-
id:
|
|
1415
|
+
u.push({
|
|
1416
|
+
id: P.id,
|
|
1340
1417
|
parentId: null,
|
|
1341
|
-
label: ((
|
|
1342
|
-
fieldType:
|
|
1343
|
-
options: Array.isArray(
|
|
1418
|
+
label: ((D = P.question) == null ? void 0 : D.trim()) || ((B = P.title) == null ? void 0 : B.trim()) || P.id,
|
|
1419
|
+
fieldType: P.fieldType,
|
|
1420
|
+
options: Array.isArray(P.options) ? P.options : []
|
|
1344
1421
|
});
|
|
1345
|
-
return
|
|
1346
|
-
}, [n]),
|
|
1347
|
-
(
|
|
1348
|
-
[
|
|
1349
|
-
),
|
|
1350
|
-
(
|
|
1351
|
-
if (!
|
|
1352
|
-
const
|
|
1353
|
-
|
|
1422
|
+
return u;
|
|
1423
|
+
}, [n]), N = k.useCallback(
|
|
1424
|
+
(u) => F.find((I) => I.id === u) || null,
|
|
1425
|
+
[F]
|
|
1426
|
+
), T = k.useCallback(
|
|
1427
|
+
(u) => {
|
|
1428
|
+
if (!O) return;
|
|
1429
|
+
const I = u && Array.isArray(u.conditions) ? { logic: u.logic || "AND", conditions: u.conditions } : void 0;
|
|
1430
|
+
C && c ? l(O, { enableWhen: I }, { sectionId: c }) : a(O, I);
|
|
1354
1431
|
},
|
|
1355
|
-
[
|
|
1356
|
-
),
|
|
1357
|
-
const
|
|
1358
|
-
logic:
|
|
1432
|
+
[O, C, c, a, l]
|
|
1433
|
+
), R = k.useMemo(() => h != null && h.enableWhen && Array.isArray(h.enableWhen.conditions) ? { logic: h.enableWhen.logic || "AND", conditions: h.enableWhen.conditions } : { logic: "AND", conditions: [] }, [h]), A = k.useCallback(() => {
|
|
1434
|
+
const u = {
|
|
1435
|
+
logic: R.logic || "AND",
|
|
1359
1436
|
conditions: [
|
|
1360
|
-
...Array.isArray(
|
|
1437
|
+
...Array.isArray(R.conditions) ? R.conditions : [],
|
|
1361
1438
|
{ targetId: "", operator: "equals", value: "" }
|
|
1362
1439
|
]
|
|
1363
1440
|
};
|
|
1364
|
-
|
|
1365
|
-
}, [
|
|
1366
|
-
(
|
|
1367
|
-
const
|
|
1368
|
-
|
|
1441
|
+
T(u);
|
|
1442
|
+
}, [R, T]), X = k.useCallback(() => T(null), [T]), ae = k.useCallback(
|
|
1443
|
+
(u) => {
|
|
1444
|
+
const D = (Array.isArray(R.conditions) ? R.conditions : []).filter((B, P) => P !== u);
|
|
1445
|
+
T({ ...R, conditions: D });
|
|
1369
1446
|
},
|
|
1370
|
-
[
|
|
1371
|
-
),
|
|
1372
|
-
(
|
|
1373
|
-
const
|
|
1374
|
-
if ("targetId" in
|
|
1375
|
-
const y =
|
|
1376
|
-
|
|
1377
|
-
const
|
|
1378
|
-
|
|
1447
|
+
[R, T]
|
|
1448
|
+
), G = k.useCallback(
|
|
1449
|
+
(u, I) => {
|
|
1450
|
+
const B = [...Array.isArray(R.conditions) ? R.conditions : []], V = { ...B[u] || { targetId: "", operator: "equals", value: "" }, ...I };
|
|
1451
|
+
if ("targetId" in I) {
|
|
1452
|
+
const y = N(V.targetId), H = Xe(y == null ? void 0 : y.fieldType);
|
|
1453
|
+
H.includes(V.operator) || (V.operator = H[0] || "equals");
|
|
1454
|
+
const ie = Array.isArray(y == null ? void 0 : y.options) ? y.options.map(Qe) : [];
|
|
1455
|
+
ie.length > 0 && (new Set(ie.map((je) => je.id)).has(V.value) || (V.value = ""));
|
|
1379
1456
|
}
|
|
1380
|
-
|
|
1457
|
+
B[u] = V, T({ ...R, conditions: B });
|
|
1381
1458
|
},
|
|
1382
|
-
[
|
|
1383
|
-
),
|
|
1384
|
-
() =>
|
|
1385
|
-
[
|
|
1386
|
-
),
|
|
1459
|
+
[R, N, T]
|
|
1460
|
+
), K = k.useMemo(
|
|
1461
|
+
() => F.filter((u) => u.id !== O),
|
|
1462
|
+
[F, O]
|
|
1463
|
+
), W = !h || !O;
|
|
1387
1464
|
return /* @__PURE__ */ r.jsxs("div", { className: "space-y-2", children: [
|
|
1388
|
-
|
|
1465
|
+
o && /* @__PURE__ */ r.jsxs("div", { className: "flex gap-2 items-center", children: [
|
|
1389
1466
|
/* @__PURE__ */ r.jsx("label", { className: "text-sm", children: "Target:" }),
|
|
1390
1467
|
/* @__PURE__ */ r.jsxs(
|
|
1391
1468
|
"select",
|
|
1392
1469
|
{
|
|
1393
1470
|
className: "border p-1 rounded",
|
|
1394
|
-
value:
|
|
1395
|
-
onChange: (
|
|
1471
|
+
value: b,
|
|
1472
|
+
onChange: (u) => x(u.target.value),
|
|
1396
1473
|
children: [
|
|
1397
1474
|
/* @__PURE__ */ r.jsx("option", { value: "", children: "Section (this)" }),
|
|
1398
|
-
|
|
1399
|
-
var
|
|
1400
|
-
return /* @__PURE__ */ r.jsx("option", { value: `child:${
|
|
1475
|
+
d.map((u) => {
|
|
1476
|
+
var I, D;
|
|
1477
|
+
return /* @__PURE__ */ r.jsx("option", { value: `child:${u.id}`, children: ((I = u.question) == null ? void 0 : I.trim()) || ((D = u.title) == null ? void 0 : D.trim()) || u.id }, u.id);
|
|
1401
1478
|
})
|
|
1402
1479
|
]
|
|
1403
1480
|
}
|
|
@@ -1408,30 +1485,30 @@ function tt() {
|
|
|
1408
1485
|
/* @__PURE__ */ r.jsxs(
|
|
1409
1486
|
"select",
|
|
1410
1487
|
{
|
|
1411
|
-
value:
|
|
1412
|
-
onChange: (
|
|
1488
|
+
value: R.logic || "AND",
|
|
1489
|
+
onChange: (u) => T({ ...R, logic: u.target.value }),
|
|
1413
1490
|
className: "border p-1 rounded",
|
|
1414
|
-
disabled:
|
|
1491
|
+
disabled: W,
|
|
1415
1492
|
children: [
|
|
1416
1493
|
/* @__PURE__ */ r.jsx("option", { value: "AND", children: "AND" }),
|
|
1417
1494
|
/* @__PURE__ */ r.jsx("option", { value: "OR", children: "OR" })
|
|
1418
1495
|
]
|
|
1419
1496
|
}
|
|
1420
1497
|
),
|
|
1421
|
-
/* @__PURE__ */ r.jsx("button", { type: "button", className: "px-2 py-1 border rounded", onClick:
|
|
1422
|
-
/* @__PURE__ */ r.jsx("button", { type: "button", className: "px-2 py-1 border rounded", onClick:
|
|
1498
|
+
/* @__PURE__ */ r.jsx("button", { type: "button", className: "px-2 py-1 border rounded", onClick: A, disabled: W, children: "+ Condition" }),
|
|
1499
|
+
/* @__PURE__ */ r.jsx("button", { type: "button", className: "px-2 py-1 border rounded", onClick: X, disabled: W, children: "Clear" })
|
|
1423
1500
|
] }),
|
|
1424
|
-
(Array.isArray(
|
|
1425
|
-
const
|
|
1501
|
+
(Array.isArray(R.conditions) ? R.conditions : []).map((u, I) => {
|
|
1502
|
+
const D = N(u.targetId), B = Xe(D == null ? void 0 : D.fieldType), P = Array.isArray(D == null ? void 0 : D.options) ? D.options.map(Qe) : [], V = P.length > 0;
|
|
1426
1503
|
return /* @__PURE__ */ r.jsxs("div", { className: "grid grid-cols-1 sm:grid-cols-7 gap-2 items-center opacity-100", children: [
|
|
1427
1504
|
/* @__PURE__ */ r.jsx(
|
|
1428
1505
|
"button",
|
|
1429
1506
|
{
|
|
1430
1507
|
type: "button",
|
|
1431
|
-
onClick: () =>
|
|
1508
|
+
onClick: () => ae(I),
|
|
1432
1509
|
className: "px-2 py-1 border rounded sm:col-span-1",
|
|
1433
1510
|
title: "Remove condition",
|
|
1434
|
-
disabled:
|
|
1511
|
+
disabled: W,
|
|
1435
1512
|
children: "✕"
|
|
1436
1513
|
}
|
|
1437
1514
|
),
|
|
@@ -1439,12 +1516,12 @@ function tt() {
|
|
|
1439
1516
|
"select",
|
|
1440
1517
|
{
|
|
1441
1518
|
className: "border p-1 rounded sm:col-span-3",
|
|
1442
|
-
value:
|
|
1443
|
-
onChange: (y) =>
|
|
1444
|
-
disabled:
|
|
1519
|
+
value: u.targetId,
|
|
1520
|
+
onChange: (y) => G(I, { targetId: y.target.value }),
|
|
1521
|
+
disabled: W,
|
|
1445
1522
|
children: [
|
|
1446
1523
|
/* @__PURE__ */ r.jsx("option", { value: "", children: "— Select field —" }),
|
|
1447
|
-
|
|
1524
|
+
K.map((y) => /* @__PURE__ */ r.jsx("option", { value: y.id, children: y.label }, y.id))
|
|
1448
1525
|
]
|
|
1449
1526
|
}
|
|
1450
1527
|
),
|
|
@@ -1452,22 +1529,22 @@ function tt() {
|
|
|
1452
1529
|
"select",
|
|
1453
1530
|
{
|
|
1454
1531
|
className: "border p-1 rounded sm:col-span-1",
|
|
1455
|
-
value:
|
|
1456
|
-
onChange: (y) =>
|
|
1457
|
-
disabled:
|
|
1458
|
-
children: (
|
|
1532
|
+
value: u.operator,
|
|
1533
|
+
onChange: (y) => G(I, { operator: y.target.value }),
|
|
1534
|
+
disabled: W || !D,
|
|
1535
|
+
children: (D ? B : ["equals"]).map((y) => /* @__PURE__ */ r.jsx("option", { value: y, children: y }, y))
|
|
1459
1536
|
}
|
|
1460
1537
|
),
|
|
1461
|
-
|
|
1538
|
+
V ? /* @__PURE__ */ r.jsxs(
|
|
1462
1539
|
"select",
|
|
1463
1540
|
{
|
|
1464
1541
|
className: "border p-1 rounded sm:col-span-2",
|
|
1465
|
-
value:
|
|
1466
|
-
onChange: (y) =>
|
|
1467
|
-
disabled:
|
|
1542
|
+
value: u.value,
|
|
1543
|
+
onChange: (y) => G(I, { value: y.target.value }),
|
|
1544
|
+
disabled: W || !D,
|
|
1468
1545
|
children: [
|
|
1469
1546
|
/* @__PURE__ */ r.jsx("option", { value: "", children: "— Select option —" }),
|
|
1470
|
-
|
|
1547
|
+
P.map((y) => /* @__PURE__ */ r.jsx("option", { value: y.id, children: y.value }, y.id))
|
|
1471
1548
|
]
|
|
1472
1549
|
}
|
|
1473
1550
|
) : /* @__PURE__ */ r.jsx(
|
|
@@ -1475,31 +1552,31 @@ function tt() {
|
|
|
1475
1552
|
{
|
|
1476
1553
|
className: "border p-1 rounded sm:col-span-2",
|
|
1477
1554
|
placeholder: "Enter value",
|
|
1478
|
-
value:
|
|
1479
|
-
onChange: (y) =>
|
|
1480
|
-
disabled:
|
|
1555
|
+
value: u.value,
|
|
1556
|
+
onChange: (y) => G(I, { value: y.target.value }),
|
|
1557
|
+
disabled: W || !D
|
|
1481
1558
|
}
|
|
1482
1559
|
)
|
|
1483
|
-
] },
|
|
1560
|
+
] }, I);
|
|
1484
1561
|
})
|
|
1485
1562
|
] });
|
|
1486
1563
|
}
|
|
1487
|
-
function
|
|
1488
|
-
const t =
|
|
1489
|
-
|
|
1490
|
-
(
|
|
1564
|
+
function Ze() {
|
|
1565
|
+
const t = ee(), n = Y(
|
|
1566
|
+
k.useCallback(
|
|
1567
|
+
(o) => t.selectedFieldId.value ? o.byId[t.selectedFieldId.value] : null,
|
|
1491
1568
|
[t.selectedFieldId.value]
|
|
1492
1569
|
)
|
|
1493
|
-
), [
|
|
1494
|
-
(
|
|
1495
|
-
t.selectedChildId.set(
|
|
1570
|
+
), [a, l] = k.useState("EDIT"), c = k.useCallback(
|
|
1571
|
+
(o, d) => {
|
|
1572
|
+
t.selectedChildId.set(o, d);
|
|
1496
1573
|
},
|
|
1497
1574
|
[t.selectedChildId.set]
|
|
1498
1575
|
);
|
|
1499
|
-
if (
|
|
1500
|
-
t.selectedChildId.set(null, null),
|
|
1576
|
+
if (k.useEffect(() => {
|
|
1577
|
+
t.selectedChildId.set(null, null), l("EDIT");
|
|
1501
1578
|
}, [t.selectedFieldId.value]), t.state.isPreview) return null;
|
|
1502
|
-
const
|
|
1579
|
+
const f = !n, m = (n == null ? void 0 : n.fieldType) === "section";
|
|
1503
1580
|
return /* @__PURE__ */ r.jsxs(
|
|
1504
1581
|
"div",
|
|
1505
1582
|
{
|
|
@@ -1516,9 +1593,9 @@ function er() {
|
|
|
1516
1593
|
"button",
|
|
1517
1594
|
{
|
|
1518
1595
|
type: "button",
|
|
1519
|
-
onClick: () =>
|
|
1520
|
-
"aria-selected":
|
|
1521
|
-
className: `px-3 py-1 text-sm ${
|
|
1596
|
+
onClick: () => l("EDIT"),
|
|
1597
|
+
"aria-selected": a === "EDIT",
|
|
1598
|
+
className: `px-3 py-1 text-sm ${a === "EDIT" ? "bg-gray-100 font-semibold" : "bg-white"}`,
|
|
1522
1599
|
children: "EDIT"
|
|
1523
1600
|
}
|
|
1524
1601
|
),
|
|
@@ -1526,57 +1603,52 @@ function er() {
|
|
|
1526
1603
|
"button",
|
|
1527
1604
|
{
|
|
1528
1605
|
type: "button",
|
|
1529
|
-
onClick: () =>
|
|
1530
|
-
"aria-selected":
|
|
1531
|
-
className: `px-3 py-1 text-sm border-l border-gray-200 ${
|
|
1606
|
+
onClick: () => l("LOGIC"),
|
|
1607
|
+
"aria-selected": a === "LOGIC",
|
|
1608
|
+
className: `px-3 py-1 text-sm border-l border-gray-200 ${a === "LOGIC" ? "bg-gray-100 font-semibold" : "bg-white"}`,
|
|
1532
1609
|
children: "LOGIC"
|
|
1533
1610
|
}
|
|
1534
1611
|
)
|
|
1535
1612
|
]
|
|
1536
1613
|
}
|
|
1537
1614
|
),
|
|
1538
|
-
|
|
1615
|
+
f && /* @__PURE__ */ r.jsxs("div", { className: "text-gray-600", children: [
|
|
1539
1616
|
/* @__PURE__ */ r.jsx("h3", { className: "text-lg font-semibold mb-2", children: "Edit" }),
|
|
1540
1617
|
/* @__PURE__ */ r.jsx("p", { children: "Select a field in the center panel to edit its properties." })
|
|
1541
1618
|
] }),
|
|
1542
|
-
!
|
|
1543
|
-
!
|
|
1544
|
-
|
|
1545
|
-
|
|
1619
|
+
!f && a === "EDIT" && /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
|
|
1620
|
+
!m && /* @__PURE__ */ r.jsx(tt, { f: n }),
|
|
1621
|
+
m && /* @__PURE__ */ r.jsx(
|
|
1622
|
+
nt,
|
|
1546
1623
|
{
|
|
1547
1624
|
section: n,
|
|
1548
|
-
onActiveChildChange:
|
|
1625
|
+
onActiveChildChange: c
|
|
1549
1626
|
}
|
|
1550
1627
|
)
|
|
1551
1628
|
] }),
|
|
1552
|
-
!
|
|
1629
|
+
!f && a === "LOGIC" && /* @__PURE__ */ r.jsx(st, {})
|
|
1553
1630
|
]
|
|
1554
1631
|
}
|
|
1555
1632
|
);
|
|
1556
1633
|
}
|
|
1557
|
-
function
|
|
1558
|
-
const t =
|
|
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]);
|
|
1634
|
+
function at() {
|
|
1635
|
+
const t = ee(), { fields: n } = Mr(t.state.isPreview), a = Ur((c) => c.hideUnsupportedFields), l = ue(() => (a ? n.filter((f) => f.fieldType !== "unsupported") : n).map((f) => f.id), [n, a]);
|
|
1564
1636
|
return /* @__PURE__ */ r.jsx(
|
|
1565
1637
|
"div",
|
|
1566
1638
|
{
|
|
1567
1639
|
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
1640
|
onClick: () => !t.state.isPreview && t.selectedFieldId.clear(),
|
|
1569
|
-
children:
|
|
1641
|
+
children: l.length === 0 ? /* @__PURE__ */ r.jsx(it, {}) : l.map((c) => /* @__PURE__ */ r.jsx(lt, { id: c }, c))
|
|
1570
1642
|
}
|
|
1571
1643
|
);
|
|
1572
1644
|
}
|
|
1573
|
-
const
|
|
1574
|
-
const
|
|
1575
|
-
if (!
|
|
1576
|
-
const
|
|
1577
|
-
return
|
|
1645
|
+
const lt = k.memo(function({ id: n }) {
|
|
1646
|
+
const a = Y(k.useCallback((c) => c.byId[n], [n]));
|
|
1647
|
+
if (!a) return null;
|
|
1648
|
+
const l = Wr(a.fieldType);
|
|
1649
|
+
return l ? /* @__PURE__ */ r.jsx("div", { className: "mb-1.5", "data-field-type": a.fieldType, "data-field-id": a.id, children: /* @__PURE__ */ r.jsx(l, { field: a }) }) : null;
|
|
1578
1650
|
});
|
|
1579
|
-
function
|
|
1651
|
+
function it() {
|
|
1580
1652
|
return /* @__PURE__ */ r.jsxs("div", { className: "flex flex-col items-center justify-center h-72 bg-gradient-to-br from-gray-50 to-gray-100 border-2 border-dashed border-blue-200 rounded-xl shadow-md text-center px-8 py-10", children: [
|
|
1581
1653
|
/* @__PURE__ */ r.jsx("div", { className: "text-xl font-semibold text-gray-700 mb-2", children: "Start building your questionnaire" }),
|
|
1582
1654
|
/* @__PURE__ */ r.jsxs("div", { className: "text-base text-gray-500", children: [
|
|
@@ -1590,13 +1662,13 @@ function st() {
|
|
|
1590
1662
|
] })
|
|
1591
1663
|
] });
|
|
1592
1664
|
}
|
|
1593
|
-
function
|
|
1594
|
-
const n =
|
|
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
|
-
|
|
1597
|
-
/* @__PURE__ */ r.jsx("div", { children: /* @__PURE__ */ r.jsx(
|
|
1598
|
-
|
|
1599
|
-
|
|
1665
|
+
function ot({ selectedField: t }) {
|
|
1666
|
+
const n = ee(), a = n.state.isPreview, l = n.state.isEditModalOpen, c = n.state.panelResetKey, f = !a, m = f ? "lg:grid-cols-[280px_minmax(0,1fr)_320px]" : "lg:grid-cols-[minmax(0,1fr)]";
|
|
1667
|
+
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: [
|
|
1668
|
+
f && /* @__PURE__ */ r.jsx("div", { className: "hidden lg:block", children: /* @__PURE__ */ r.jsx(Hr, {}) }),
|
|
1669
|
+
/* @__PURE__ */ r.jsx("div", { children: /* @__PURE__ */ r.jsx(at, {}) }),
|
|
1670
|
+
f && /* @__PURE__ */ r.jsx("div", { className: "hidden lg:block", children: /* @__PURE__ */ r.jsx(Ze, {}, c) }),
|
|
1671
|
+
f && /* @__PURE__ */ r.jsx("div", { className: "lg:hidden", children: l && t && /* @__PURE__ */ r.jsx(
|
|
1600
1672
|
"div",
|
|
1601
1673
|
{
|
|
1602
1674
|
className: "fixed inset-0 top-5 z-50 flex items-center justify-center bg-transparent/30 backdrop-blur-sm p-4",
|
|
@@ -1605,7 +1677,7 @@ function it({ selectedField: t }) {
|
|
|
1605
1677
|
"div",
|
|
1606
1678
|
{
|
|
1607
1679
|
className: "w-full max-w-md mx-auto relative bg-white rounded-lg overflow-hidden",
|
|
1608
|
-
onClick: (
|
|
1680
|
+
onClick: (o) => o.stopPropagation(),
|
|
1609
1681
|
children: [
|
|
1610
1682
|
/* @__PURE__ */ r.jsx(
|
|
1611
1683
|
"button",
|
|
@@ -1615,7 +1687,7 @@ function it({ selectedField: t }) {
|
|
|
1615
1687
|
children: /* @__PURE__ */ r.jsx("span", { className: "text-3xl", children: "×" })
|
|
1616
1688
|
}
|
|
1617
1689
|
),
|
|
1618
|
-
/* @__PURE__ */ r.jsx(
|
|
1690
|
+
/* @__PURE__ */ r.jsx(Ze, {}, c)
|
|
1619
1691
|
]
|
|
1620
1692
|
}
|
|
1621
1693
|
)
|
|
@@ -1623,34 +1695,37 @@ function it({ selectedField: t }) {
|
|
|
1623
1695
|
) })
|
|
1624
1696
|
] }) });
|
|
1625
1697
|
}
|
|
1626
|
-
function
|
|
1698
|
+
function mt({
|
|
1627
1699
|
initialFields: t,
|
|
1628
1700
|
onChange: n,
|
|
1629
|
-
className:
|
|
1630
|
-
showHeader:
|
|
1631
|
-
showMobileToolbar:
|
|
1632
|
-
startInPreview:
|
|
1701
|
+
className: a = "",
|
|
1702
|
+
showHeader: l = !0,
|
|
1703
|
+
showMobileToolbar: c = !0,
|
|
1704
|
+
startInPreview: f = !1
|
|
1633
1705
|
}) {
|
|
1634
|
-
const
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
}, [t,
|
|
1638
|
-
const
|
|
1639
|
-
|
|
1706
|
+
const m = ee(), o = er(!1);
|
|
1707
|
+
se(() => {
|
|
1708
|
+
o.current || (Array.isArray(t) && t.length && Y.getState().replaceAll(t), m.preview.set(!!f), o.current = !0);
|
|
1709
|
+
}, [t, f, m.preview]), se(() => n ? Y.subscribe((v) => {
|
|
1710
|
+
const b = [];
|
|
1711
|
+
v.order.forEach((x) => {
|
|
1712
|
+
const C = v.byId[x];
|
|
1713
|
+
C && (b.push(C), C.fieldType === "section" && Array.isArray(C.fields) && b.push(...C.fields));
|
|
1714
|
+
}), n(b);
|
|
1640
1715
|
}) : void 0, [n]);
|
|
1641
|
-
const
|
|
1642
|
-
|
|
1643
|
-
(
|
|
1644
|
-
[
|
|
1716
|
+
const d = Y(
|
|
1717
|
+
k.useCallback(
|
|
1718
|
+
(w) => m.selectedFieldId.value ? w.byId[m.selectedFieldId.value] : null,
|
|
1719
|
+
[m.selectedFieldId.value]
|
|
1645
1720
|
)
|
|
1646
1721
|
);
|
|
1647
|
-
return /* @__PURE__ */ r.jsxs("div", { className: `qb-editor-root min-h-screen bg-gray-100 font-titillium ${
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
/* @__PURE__ */ r.jsx(
|
|
1722
|
+
return /* @__PURE__ */ r.jsxs("div", { className: `qb-editor-root min-h-screen bg-gray-100 font-titillium ${a}`, children: [
|
|
1723
|
+
l && /* @__PURE__ */ r.jsx(zr, {}),
|
|
1724
|
+
c && /* @__PURE__ */ r.jsx("div", { className: "lg:hidden", children: /* @__PURE__ */ r.jsx(Gr, {}) }),
|
|
1725
|
+
/* @__PURE__ */ r.jsx(ot, { selectedField: d })
|
|
1651
1726
|
] });
|
|
1652
1727
|
}
|
|
1653
1728
|
export {
|
|
1654
|
-
|
|
1729
|
+
mt as QuestionnaireEditor
|
|
1655
1730
|
};
|
|
1656
1731
|
//# sourceMappingURL=index.js.map
|