formanitor 0.0.34 → 0.0.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +21 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +21 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -653,6 +653,11 @@ var FormStore = class {
|
|
|
653
653
|
this.config.role = next.role;
|
|
654
654
|
needsReeval = true;
|
|
655
655
|
}
|
|
656
|
+
if (next.prefillData !== void 0 && next.prefillData !== this.prefillData) {
|
|
657
|
+
this.prefillData = next.prefillData;
|
|
658
|
+
this.state.values = applyPrefill(this.state.values, this.schema.fields, this.prefillData);
|
|
659
|
+
needsReeval = true;
|
|
660
|
+
}
|
|
656
661
|
if (needsReeval) {
|
|
657
662
|
this.evaluate();
|
|
658
663
|
this.notify();
|
|
@@ -8517,10 +8522,21 @@ var ReadOnlyReferral = ({ fieldDef, value }) => {
|
|
|
8517
8522
|
}) })
|
|
8518
8523
|
] });
|
|
8519
8524
|
};
|
|
8520
|
-
function
|
|
8521
|
-
|
|
8522
|
-
|
|
8523
|
-
|
|
8525
|
+
function parseOrders(value) {
|
|
8526
|
+
if (value == null) return [];
|
|
8527
|
+
if (Array.isArray(value)) {
|
|
8528
|
+
return value.filter(
|
|
8529
|
+
(v) => v != null && typeof v === "object" && typeof v.id === "string"
|
|
8530
|
+
);
|
|
8531
|
+
}
|
|
8532
|
+
if (typeof value === "object") {
|
|
8533
|
+
const v = value;
|
|
8534
|
+
const orders = Array.isArray(v.orders) ? v.orders : [];
|
|
8535
|
+
return orders.filter(
|
|
8536
|
+
(o) => o != null && typeof o === "object" && typeof o.id === "string"
|
|
8537
|
+
);
|
|
8538
|
+
}
|
|
8539
|
+
return [];
|
|
8524
8540
|
}
|
|
8525
8541
|
function formatDuration2(start, end) {
|
|
8526
8542
|
if (!start && !end) return null;
|
|
@@ -8528,7 +8544,7 @@ function formatDuration2(start, end) {
|
|
|
8528
8544
|
return start ? `Start: ${start}` : `End: ${end}`;
|
|
8529
8545
|
}
|
|
8530
8546
|
var ReadOnlyDischargeMedicationOrders = ({ fieldDef, value }) => {
|
|
8531
|
-
const orders = React15.useMemo(() =>
|
|
8547
|
+
const orders = React15.useMemo(() => parseOrders(value), [value]);
|
|
8532
8548
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
8533
8549
|
/* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-sm font-medium text-gray-700", children: fieldDef.label }),
|
|
8534
8550
|
orders.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-gray-900 border border-gray-200 rounded-md p-3 bg-gray-50 min-h-[2.5rem]", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-400 italic", children: "No medicines added" }) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-2", children: orders.map((o) => {
|