@mieweb/forms-renderer 2.1.3 → 2.1.4-prerelease.0
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 +343 -343
- package/dist/blaze.js +5073 -5070
- package/dist/blaze.umd.cjs +87 -87
- package/dist/react.js +84 -83
- package/dist/standalone.js +5592 -5589
- package/dist/standalone.umd.cjs +89 -89
- package/package.json +2 -2
- package/dist/react.js.map +0 -1
package/dist/react.js
CHANGED
|
@@ -11,14 +11,14 @@
|
|
|
11
11
|
window.__QUESTIONNAIRE_RENDERER_REACT_CSS_INJECTED = true;
|
|
12
12
|
})();
|
|
13
13
|
import d from "react";
|
|
14
|
-
import { useUIApi as W, FormStoreContext as q, parseAndDetect as
|
|
14
|
+
import { useUIApi as W, FormStoreContext as q, parseAndDetect as oe, adaptSchema as ae, useFormStore as se, getFieldComponent as ie, useVisibleFields as ue, useUIStore as le, createFormStore as ce, createUIStore as fe, UIStoreContext as de, useFormResponse as me } from "@mieweb/forms-engine";
|
|
15
15
|
import { useFieldsArray as je, useFormData as we, useFormResponse as Oe } from "@mieweb/forms-engine";
|
|
16
16
|
var S = { exports: {} }, b = {};
|
|
17
|
-
var
|
|
18
|
-
function
|
|
19
|
-
if (
|
|
20
|
-
|
|
21
|
-
var
|
|
17
|
+
var U;
|
|
18
|
+
function pe() {
|
|
19
|
+
if (U) return b;
|
|
20
|
+
U = 1;
|
|
21
|
+
var s = /* @__PURE__ */ Symbol.for("react.transitional.element"), i = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
22
22
|
function n(u, t, o) {
|
|
23
23
|
var m = null;
|
|
24
24
|
if (o !== void 0 && (m = "" + o), t.key !== void 0 && (m = "" + t.key), "key" in t) {
|
|
@@ -27,7 +27,7 @@ function me() {
|
|
|
27
27
|
f !== "key" && (o[f] = t[f]);
|
|
28
28
|
} else o = t;
|
|
29
29
|
return t = o.ref, {
|
|
30
|
-
$$typeof:
|
|
30
|
+
$$typeof: s,
|
|
31
31
|
type: u,
|
|
32
32
|
key: m,
|
|
33
33
|
ref: t !== void 0 ? t : null,
|
|
@@ -38,46 +38,46 @@ function me() {
|
|
|
38
38
|
}
|
|
39
39
|
var T = {};
|
|
40
40
|
var D;
|
|
41
|
-
function
|
|
41
|
+
function ve() {
|
|
42
42
|
return D || (D = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
43
|
-
function
|
|
43
|
+
function s(e) {
|
|
44
44
|
if (e == null) return null;
|
|
45
45
|
if (typeof e == "function")
|
|
46
|
-
return e.$$typeof ===
|
|
46
|
+
return e.$$typeof === re ? null : e.displayName || e.name || null;
|
|
47
47
|
if (typeof e == "string") return e;
|
|
48
48
|
switch (e) {
|
|
49
49
|
case j:
|
|
50
50
|
return "Fragment";
|
|
51
|
-
case
|
|
51
|
+
case Q:
|
|
52
52
|
return "Profiler";
|
|
53
|
-
case
|
|
53
|
+
case J:
|
|
54
54
|
return "StrictMode";
|
|
55
|
-
case B:
|
|
56
|
-
return "Suspense";
|
|
57
55
|
case H:
|
|
56
|
+
return "Suspense";
|
|
57
|
+
case Z:
|
|
58
58
|
return "SuspenseList";
|
|
59
|
-
case
|
|
59
|
+
case ee:
|
|
60
60
|
return "Activity";
|
|
61
61
|
}
|
|
62
62
|
if (typeof e == "object")
|
|
63
63
|
switch (typeof e.tag == "number" && console.error(
|
|
64
64
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
65
65
|
), e.$$typeof) {
|
|
66
|
-
case
|
|
66
|
+
case z:
|
|
67
67
|
return "Portal";
|
|
68
|
-
case
|
|
68
|
+
case X:
|
|
69
69
|
return e.displayName || "Context";
|
|
70
70
|
case G:
|
|
71
71
|
return (e._context.displayName || "Context") + ".Consumer";
|
|
72
|
-
case
|
|
72
|
+
case B:
|
|
73
73
|
var r = e.render;
|
|
74
74
|
return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
75
|
-
case
|
|
76
|
-
return r = e.displayName || null, r !== null ? r :
|
|
75
|
+
case K:
|
|
76
|
+
return r = e.displayName || null, r !== null ? r : s(e.type) || "Memo";
|
|
77
77
|
case w:
|
|
78
78
|
r = e._payload, e = e._init;
|
|
79
79
|
try {
|
|
80
|
-
return
|
|
80
|
+
return s(e(r));
|
|
81
81
|
} catch {
|
|
82
82
|
}
|
|
83
83
|
}
|
|
@@ -95,8 +95,8 @@ function pe() {
|
|
|
95
95
|
}
|
|
96
96
|
if (r) {
|
|
97
97
|
r = console;
|
|
98
|
-
var
|
|
99
|
-
return
|
|
98
|
+
var a = r.error, l = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
99
|
+
return a.call(
|
|
100
100
|
r,
|
|
101
101
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
102
102
|
l
|
|
@@ -108,7 +108,7 @@ function pe() {
|
|
|
108
108
|
if (typeof e == "object" && e !== null && e.$$typeof === w)
|
|
109
109
|
return "<...>";
|
|
110
110
|
try {
|
|
111
|
-
var r =
|
|
111
|
+
var r = s(e);
|
|
112
112
|
return r ? "<" + r + ">" : "<...>";
|
|
113
113
|
} catch {
|
|
114
114
|
return "<...>";
|
|
@@ -129,30 +129,30 @@ function pe() {
|
|
|
129
129
|
return e.key !== void 0;
|
|
130
130
|
}
|
|
131
131
|
function f(e, r) {
|
|
132
|
-
function
|
|
132
|
+
function a() {
|
|
133
133
|
F || (F = !0, console.error(
|
|
134
134
|
"%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://react.dev/link/special-props)",
|
|
135
135
|
r
|
|
136
136
|
));
|
|
137
137
|
}
|
|
138
|
-
|
|
139
|
-
get:
|
|
138
|
+
a.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
139
|
+
get: a,
|
|
140
140
|
configurable: !0
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
143
|
function p() {
|
|
144
|
-
var e =
|
|
144
|
+
var e = s(this.type);
|
|
145
145
|
return I[e] || (I[e] = !0, console.error(
|
|
146
146
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
147
147
|
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
148
148
|
}
|
|
149
|
-
function y(e, r,
|
|
150
|
-
var c =
|
|
149
|
+
function y(e, r, a, l, x, g) {
|
|
150
|
+
var c = a.ref;
|
|
151
151
|
return e = {
|
|
152
152
|
$$typeof: N,
|
|
153
153
|
type: e,
|
|
154
154
|
key: r,
|
|
155
|
-
props:
|
|
155
|
+
props: a,
|
|
156
156
|
_owner: l
|
|
157
157
|
}, (c !== void 0 ? c : null) !== null ? Object.defineProperty(e, "ref", {
|
|
158
158
|
enumerable: !1,
|
|
@@ -179,11 +179,11 @@ function pe() {
|
|
|
179
179
|
value: g
|
|
180
180
|
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
181
181
|
}
|
|
182
|
-
function
|
|
182
|
+
function _(e, r, a, l, x, g) {
|
|
183
183
|
var c = r.children;
|
|
184
184
|
if (c !== void 0)
|
|
185
185
|
if (l)
|
|
186
|
-
if (
|
|
186
|
+
if (te(c)) {
|
|
187
187
|
for (l = 0; l < c.length; l++)
|
|
188
188
|
k(c[l]);
|
|
189
189
|
Object.freeze && Object.freeze(c);
|
|
@@ -193,11 +193,11 @@ function pe() {
|
|
|
193
193
|
);
|
|
194
194
|
else k(c);
|
|
195
195
|
if (C.call(r, "key")) {
|
|
196
|
-
c =
|
|
197
|
-
var
|
|
198
|
-
return
|
|
196
|
+
c = s(e);
|
|
197
|
+
var E = Object.keys(r).filter(function(ne) {
|
|
198
|
+
return ne !== "key";
|
|
199
199
|
});
|
|
200
|
-
l = 0 <
|
|
200
|
+
l = 0 < E.length ? "{key: someKey, " + E.join(": ..., ") + ": ...}" : "{key: someKey}", $[c + l] || (E = 0 < E.length ? "{" + E.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
201
201
|
`A props object containing a "key" prop is being spread into JSX:
|
|
202
202
|
let props = %s;
|
|
203
203
|
<%s {...props} />
|
|
@@ -206,22 +206,22 @@ React keys must be passed directly to JSX without using spread:
|
|
|
206
206
|
<%s key={someKey} {...props} />`,
|
|
207
207
|
l,
|
|
208
208
|
c,
|
|
209
|
-
|
|
209
|
+
E,
|
|
210
210
|
c
|
|
211
|
-
),
|
|
211
|
+
), $[c + l] = !0);
|
|
212
212
|
}
|
|
213
|
-
if (c = null,
|
|
214
|
-
|
|
213
|
+
if (c = null, a !== void 0 && (n(a), c = "" + a), m(r) && (n(r.key), c = "" + r.key), "key" in r) {
|
|
214
|
+
a = {};
|
|
215
215
|
for (var P in r)
|
|
216
|
-
P !== "key" && (
|
|
217
|
-
} else
|
|
216
|
+
P !== "key" && (a[P] = r[P]);
|
|
217
|
+
} else a = r;
|
|
218
218
|
return c && f(
|
|
219
|
-
|
|
219
|
+
a,
|
|
220
220
|
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
221
221
|
), y(
|
|
222
222
|
e,
|
|
223
223
|
c,
|
|
224
|
-
|
|
224
|
+
a,
|
|
225
225
|
t(),
|
|
226
226
|
x,
|
|
227
227
|
g
|
|
@@ -233,7 +233,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
233
233
|
function h(e) {
|
|
234
234
|
return typeof e == "object" && e !== null && e.$$typeof === N;
|
|
235
235
|
}
|
|
236
|
-
var R = d, N = /* @__PURE__ */ Symbol.for("react.transitional.element"),
|
|
236
|
+
var R = d, N = /* @__PURE__ */ Symbol.for("react.transitional.element"), z = /* @__PURE__ */ Symbol.for("react.portal"), j = /* @__PURE__ */ Symbol.for("react.fragment"), J = /* @__PURE__ */ Symbol.for("react.strict_mode"), Q = /* @__PURE__ */ Symbol.for("react.profiler"), G = /* @__PURE__ */ Symbol.for("react.consumer"), X = /* @__PURE__ */ Symbol.for("react.context"), B = /* @__PURE__ */ Symbol.for("react.forward_ref"), H = /* @__PURE__ */ Symbol.for("react.suspense"), Z = /* @__PURE__ */ Symbol.for("react.suspense_list"), K = /* @__PURE__ */ Symbol.for("react.memo"), w = /* @__PURE__ */ Symbol.for("react.lazy"), ee = /* @__PURE__ */ Symbol.for("react.activity"), re = /* @__PURE__ */ Symbol.for("react.client.reference"), O = R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, C = Object.prototype.hasOwnProperty, te = Array.isArray, A = console.createTask ? console.createTask : function() {
|
|
237
237
|
return null;
|
|
238
238
|
};
|
|
239
239
|
R = {
|
|
@@ -244,69 +244,67 @@ React keys must be passed directly to JSX without using spread:
|
|
|
244
244
|
var F, I = {}, Y = R.react_stack_bottom_frame.bind(
|
|
245
245
|
R,
|
|
246
246
|
o
|
|
247
|
-
)(),
|
|
248
|
-
T.Fragment = j, T.jsx = function(e, r,
|
|
247
|
+
)(), M = A(u(o)), $ = {};
|
|
248
|
+
T.Fragment = j, T.jsx = function(e, r, a) {
|
|
249
249
|
var l = 1e4 > O.recentlyCreatedOwnerStacks++;
|
|
250
|
-
return
|
|
250
|
+
return _(
|
|
251
251
|
e,
|
|
252
252
|
r,
|
|
253
|
-
|
|
253
|
+
a,
|
|
254
254
|
!1,
|
|
255
255
|
l ? Error("react-stack-top-frame") : Y,
|
|
256
|
-
l ? A(u(e)) :
|
|
256
|
+
l ? A(u(e)) : M
|
|
257
257
|
);
|
|
258
|
-
}, T.jsxs = function(e, r,
|
|
258
|
+
}, T.jsxs = function(e, r, a) {
|
|
259
259
|
var l = 1e4 > O.recentlyCreatedOwnerStacks++;
|
|
260
|
-
return
|
|
260
|
+
return _(
|
|
261
261
|
e,
|
|
262
262
|
r,
|
|
263
|
-
|
|
263
|
+
a,
|
|
264
264
|
!0,
|
|
265
265
|
l ? Error("react-stack-top-frame") : Y,
|
|
266
|
-
l ? A(u(e)) :
|
|
266
|
+
l ? A(u(e)) : M
|
|
267
267
|
);
|
|
268
268
|
};
|
|
269
269
|
})()), T;
|
|
270
270
|
}
|
|
271
271
|
var L;
|
|
272
|
-
function
|
|
273
|
-
return L || (L = 1, process.env.NODE_ENV === "production" ? S.exports =
|
|
272
|
+
function Re() {
|
|
273
|
+
return L || (L = 1, process.env.NODE_ENV === "production" ? S.exports = pe() : S.exports = ve()), S.exports;
|
|
274
274
|
}
|
|
275
|
-
var v =
|
|
276
|
-
function
|
|
275
|
+
var v = Re();
|
|
276
|
+
function _e(s, i, n = !0) {
|
|
277
277
|
const u = d.useRef(!1), t = W(), o = d.useContext(q);
|
|
278
278
|
if (!o) throw new Error("Missing FormStoreContext.Provider in the tree");
|
|
279
279
|
d.useEffect(() => {
|
|
280
|
-
if (!(u.current || !
|
|
280
|
+
if (!(u.current || !s))
|
|
281
281
|
try {
|
|
282
|
-
const { data: m, schemaType: f } =
|
|
282
|
+
const { data: m, schemaType: f } = oe(s, i || null), p = ae(m, f);
|
|
283
283
|
p.conversionReport && t.setConversionReport(p.conversionReport);
|
|
284
|
-
const y = "mieforms-v1.0",
|
|
284
|
+
const y = "mieforms-v1.0", _ = {
|
|
285
285
|
schemaType: f === "surveyjs" ? y : m?.schemaType || y,
|
|
286
286
|
fields: p.fields || []
|
|
287
287
|
};
|
|
288
288
|
if (f === "surveyjs" && p.conversionReport?.surveyMetadata)
|
|
289
|
-
Object.assign(
|
|
289
|
+
Object.assign(_, p.conversionReport.surveyMetadata);
|
|
290
290
|
else if (f === "mieforms") {
|
|
291
291
|
const { fields: k, schemaType: h, ...R } = m;
|
|
292
|
-
Object.keys(R).length > 0 && Object.assign(
|
|
292
|
+
Object.keys(R).length > 0 && Object.assign(_, R);
|
|
293
293
|
}
|
|
294
|
-
o.getState().replaceAll(
|
|
294
|
+
o.getState().replaceAll(_), t.preview.set(!0), u.current = !0;
|
|
295
295
|
} catch {
|
|
296
296
|
o.getState().replaceAll({ schemaType: "mieforms-v1.0", fields: [] }), t.preview.set(!0), u.current = !0;
|
|
297
297
|
}
|
|
298
|
-
}, [
|
|
298
|
+
}, [s, i, t, o]), d.useEffect(() => {
|
|
299
299
|
t.setHideUnsupportedFields(n);
|
|
300
300
|
}, [n, t]);
|
|
301
301
|
}
|
|
302
302
|
const Ee = d.memo(function({ id: i }) {
|
|
303
|
-
const n = se(d.useCallback((t) => t.byId[i], [i]));
|
|
304
|
-
|
|
305
|
-
const u = ae(n.fieldType);
|
|
306
|
-
return u ? /* @__PURE__ */ v.jsx("div", { className: "field-node-wrapper mie:mb-1.5", "data-field-type": n.fieldType, "data-field-id": n.id, children: /* @__PURE__ */ v.jsx(u, { field: n }) }) : null;
|
|
303
|
+
const n = se(d.useCallback((t) => t.byId[i], [i])), u = n ? ie(n.fieldType) : null;
|
|
304
|
+
return !n || !u ? null : /* @__PURE__ */ v.jsx("div", { className: "field-node-wrapper mie:mb-1.5", "data-field-type": n.fieldType, "data-field-id": n.id, children: /* @__PURE__ */ v.jsx(u, { field: n }) });
|
|
307
305
|
});
|
|
308
|
-
function
|
|
309
|
-
const
|
|
306
|
+
function be() {
|
|
307
|
+
const s = W(), { fields: i } = ue(s.state.isPreview), n = le((t) => t.hideUnsupportedFields), u = d.useMemo(() => (n ? i.filter((o) => o.fieldType !== "unsupported") : i).map((o) => o.id), [i, n]);
|
|
310
308
|
return /* @__PURE__ */ v.jsx("div", { className: "renderer-body-container", children: u.map((t) => /* @__PURE__ */ v.jsx(
|
|
311
309
|
Ee,
|
|
312
310
|
{
|
|
@@ -315,17 +313,19 @@ function _e() {
|
|
|
315
313
|
t
|
|
316
314
|
)) });
|
|
317
315
|
}
|
|
318
|
-
const
|
|
319
|
-
const n = d.
|
|
320
|
-
return /* @__PURE__ */ v.jsx(q.Provider, { value: n, children: /* @__PURE__ */ v.jsx(
|
|
321
|
-
})
|
|
322
|
-
|
|
316
|
+
const Te = d.forwardRef((s, i) => {
|
|
317
|
+
const n = d.useMemo(() => ce(), []), u = d.useMemo(() => fe(), []);
|
|
318
|
+
return /* @__PURE__ */ v.jsx(q.Provider, { value: n, children: /* @__PURE__ */ v.jsx(de.Provider, { value: u, children: /* @__PURE__ */ v.jsx(V, { ...s, ref: i }) }) });
|
|
319
|
+
});
|
|
320
|
+
Te.displayName = "QuestionnaireRenderer";
|
|
321
|
+
const V = d.forwardRef(({
|
|
322
|
+
formData: s,
|
|
323
323
|
schemaType: i,
|
|
324
324
|
className: n = "",
|
|
325
325
|
hideUnsupportedFields: u = !0,
|
|
326
326
|
theme: t = "light"
|
|
327
327
|
}, o) => {
|
|
328
|
-
const m = t === "dark", f =
|
|
328
|
+
const m = t === "dark", f = me();
|
|
329
329
|
d.useImperativeHandle(o, () => ({
|
|
330
330
|
getResponse: () => f
|
|
331
331
|
}), [f]);
|
|
@@ -335,10 +335,11 @@ const xe = d.forwardRef((a, i) => {
|
|
|
335
335
|
"mie:max-w-4xl mie:mx-auto mie:px-2 mie:pb-8 mie:pt-4",
|
|
336
336
|
n
|
|
337
337
|
].filter(Boolean).join(" ");
|
|
338
|
-
return
|
|
338
|
+
return _e(s, i, u), /* @__PURE__ */ v.jsx("div", { className: p, children: /* @__PURE__ */ v.jsx(be, {}) });
|
|
339
339
|
});
|
|
340
|
-
|
|
341
|
-
|
|
340
|
+
V.displayName = "QuestionnaireRendererInner";
|
|
341
|
+
function Se(s, i, n) {
|
|
342
|
+
const u = (s || []).map((t) => ({
|
|
342
343
|
linkId: t.id,
|
|
343
344
|
text: t.text,
|
|
344
345
|
answer: t.answer.map((o) => ({ valueString: o.value }))
|
|
@@ -353,8 +354,8 @@ function Se(a, i, n) {
|
|
|
353
354
|
}
|
|
354
355
|
export {
|
|
355
356
|
Ee as FieldNode,
|
|
356
|
-
|
|
357
|
-
|
|
357
|
+
Te as QuestionnaireRenderer,
|
|
358
|
+
be as RendererBody,
|
|
358
359
|
Se as toFhirQuestionnaireResponse,
|
|
359
360
|
je as useFieldsArray,
|
|
360
361
|
we as useFormData,
|