@mieweb/ui 0.10.0-dev.40 → 0.10.0-dev.41
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 +64 -46
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -3
- package/dist/index.d.ts +12 -3
- package/dist/index.js +66 -48
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -8272,6 +8272,13 @@ var Assessment = React13__namespace.forwardRef(
|
|
|
8272
8272
|
showPlan = true,
|
|
8273
8273
|
onShowPlanChange,
|
|
8274
8274
|
onAction,
|
|
8275
|
+
rowActions = [
|
|
8276
|
+
...Object.keys(ACTION_META2),
|
|
8277
|
+
"remove",
|
|
8278
|
+
"move"
|
|
8279
|
+
],
|
|
8280
|
+
orderActions = ["edit", "remove", "move"],
|
|
8281
|
+
addModes,
|
|
8275
8282
|
onRemoveAssessment,
|
|
8276
8283
|
onAddOrder,
|
|
8277
8284
|
onAddAssessment,
|
|
@@ -8291,12 +8298,25 @@ var Assessment = React13__namespace.forwardRef(
|
|
|
8291
8298
|
}, ref) => {
|
|
8292
8299
|
const instanceId = React13__namespace.useId();
|
|
8293
8300
|
const [addingFor, setAddingFor] = React13__namespace.useState(null);
|
|
8294
|
-
const
|
|
8295
|
-
|
|
8296
|
-
|
|
8301
|
+
const requestedAddModes = addModes ?? [
|
|
8302
|
+
"auto",
|
|
8303
|
+
"problem",
|
|
8304
|
+
"order"
|
|
8305
|
+
];
|
|
8306
|
+
const availableAddModes = requestedAddModes.filter((mode) => {
|
|
8307
|
+
if (mode === "problem") return Boolean(onAddAssessment);
|
|
8308
|
+
if (mode === "order") return Boolean(onAddOrder);
|
|
8309
|
+
return Boolean(onAddAssessment && onAddOrder);
|
|
8310
|
+
});
|
|
8311
|
+
const initialAddMode = availableAddModes.includes(defaultAddMode) ? defaultAddMode : availableAddModes[0] ?? defaultAddMode;
|
|
8312
|
+
const [selectedAddMode, setSelectedAddMode] = React13__namespace.useState(initialAddMode);
|
|
8313
|
+
const addMode = availableAddModes.includes(selectedAddMode) ? selectedAddMode : availableAddModes[0] ?? defaultAddMode;
|
|
8297
8314
|
const [pendingFreeText, setPendingFreeText] = React13__namespace.useState(
|
|
8298
8315
|
null
|
|
8299
8316
|
);
|
|
8317
|
+
React13__namespace.useEffect(() => {
|
|
8318
|
+
if (addMode !== "auto") setPendingFreeText(null);
|
|
8319
|
+
}, [addMode]);
|
|
8300
8320
|
const [announcement, setAnnouncement] = chunkCPDNX3LS_cjs.useLiveAnnouncement();
|
|
8301
8321
|
const ambientCodeLookup = chunkS4XCPDEO_cjs.useCodeLookupConfig();
|
|
8302
8322
|
const effectiveRenderOrderSearch = renderOrderSearch === false ? void 0 : renderOrderSearch ?? (ambientCodeLookup ? contextOrderSearch(ambientCodeLookup) : void 0);
|
|
@@ -8308,9 +8328,13 @@ var Assessment = React13__namespace.forwardRef(
|
|
|
8308
8328
|
const unlinkedOrders = orders.filter(
|
|
8309
8329
|
(o) => !o.concernId || !items.some((i) => i.concernId === o.concernId)
|
|
8310
8330
|
);
|
|
8331
|
+
const toolbarActions = rowActions.filter(
|
|
8332
|
+
(action) => action in ACTION_META2 && (action === "add-order" ? Boolean(onAddOrder || onAction) : Boolean(onAction))
|
|
8333
|
+
);
|
|
8334
|
+
const showConcernToolbar = toolbarActions.length > 0 || rowActions.includes("remove") && Boolean(onRemoveAssessment);
|
|
8311
8335
|
const drag = chunkGF2BE4FB_cjs.useDragReorder({
|
|
8312
8336
|
ids: items.map((i) => i.concernId),
|
|
8313
|
-
onReorder: readOnly || !onReorderItems ? void 0 : (ids) => {
|
|
8337
|
+
onReorder: readOnly || !rowActions.includes("move") || !onReorderItems ? void 0 : (ids) => {
|
|
8314
8338
|
setAnnouncement("Assessment concerns reordered");
|
|
8315
8339
|
onReorderItems(ids);
|
|
8316
8340
|
}
|
|
@@ -8324,7 +8348,7 @@ var Assessment = React13__namespace.forwardRef(
|
|
|
8324
8348
|
[concernById, items]
|
|
8325
8349
|
);
|
|
8326
8350
|
const orderControls = readOnly ? void 0 : {
|
|
8327
|
-
moveWithin: onReorderOrders ? (order, dir) => {
|
|
8351
|
+
moveWithin: orderActions.includes("move") && onReorderOrders ? (order, dir) => {
|
|
8328
8352
|
const planIds = orders.filter((o) => o.concernId === order.concernId).map((o) => o.orderId);
|
|
8329
8353
|
const i = planIds.indexOf(order.orderId);
|
|
8330
8354
|
const target = planIds[i + dir];
|
|
@@ -8341,18 +8365,18 @@ var Assessment = React13__namespace.forwardRef(
|
|
|
8341
8365
|
`${order.display} moved ${dir === -1 ? "up" : "down"}`
|
|
8342
8366
|
);
|
|
8343
8367
|
} : void 0,
|
|
8344
|
-
moveToProblem: onLinkOrder ? (order, concernId) => {
|
|
8368
|
+
moveToProblem: orderActions.includes("move") && onLinkOrder ? (order, concernId) => {
|
|
8345
8369
|
onLinkOrder(order, concernId);
|
|
8346
8370
|
setAnnouncement(
|
|
8347
8371
|
`${order.display} moved to ${problemLabel(concernId)}`
|
|
8348
8372
|
);
|
|
8349
8373
|
} : void 0,
|
|
8350
|
-
edit: onEditOrder ? (order, changes) => {
|
|
8374
|
+
edit: orderActions.includes("edit") && onEditOrder ? (order, changes) => {
|
|
8351
8375
|
onEditOrder(order, changes);
|
|
8352
8376
|
setAnnouncement(`${changes.display} updated`);
|
|
8353
8377
|
} : void 0,
|
|
8354
|
-
editStart: onEditOrderStart,
|
|
8355
|
-
remove: onRemoveOrder ? (order) => {
|
|
8378
|
+
editStart: orderActions.includes("edit") ? onEditOrderStart : void 0,
|
|
8379
|
+
remove: orderActions.includes("remove") && onRemoveOrder ? (order) => {
|
|
8356
8380
|
onRemoveOrder(order);
|
|
8357
8381
|
setAnnouncement(`${order.display} removed`);
|
|
8358
8382
|
} : void 0,
|
|
@@ -8366,7 +8390,7 @@ var Assessment = React13__namespace.forwardRef(
|
|
|
8366
8390
|
label: problemLabel(it.concernId)
|
|
8367
8391
|
}))
|
|
8368
8392
|
};
|
|
8369
|
-
const orderDragEnabled = !readOnly && Boolean(onReorderOrders || onLinkOrder);
|
|
8393
|
+
const orderDragEnabled = !readOnly && orderActions.includes("move") && Boolean(onReorderOrders || onLinkOrder);
|
|
8370
8394
|
const [draggingOrderId, setDraggingOrderId] = React13__namespace.useState(
|
|
8371
8395
|
null
|
|
8372
8396
|
);
|
|
@@ -8551,7 +8575,7 @@ var Assessment = React13__namespace.forwardRef(
|
|
|
8551
8575
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground font-medium", children: assertion.text }),
|
|
8552
8576
|
assertion.verificationStatus !== "confirmed" && /* @__PURE__ */ jsxRuntime.jsx(chunk7E46YDOT_cjs.Badge, { variant: "warning", size: "sm", children: assertion.verificationStatus }),
|
|
8553
8577
|
/* @__PURE__ */ jsxRuntime.jsx(CodingChips, { coding: assertion.coding }),
|
|
8554
|
-
!readOnly &&
|
|
8578
|
+
!readOnly && showConcernToolbar && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8555
8579
|
chunkS4XCPDEO_cjs.RowActionToolbar,
|
|
8556
8580
|
{
|
|
8557
8581
|
label: `Actions for ${assertion.text}`,
|
|
@@ -8563,36 +8587,30 @@ var Assessment = React13__namespace.forwardRef(
|
|
|
8563
8587
|
"pointer-fine:group-has-[[data-order-id]:focus-within]:opacity-0"
|
|
8564
8588
|
),
|
|
8565
8589
|
children: [
|
|
8566
|
-
|
|
8567
|
-
|
|
8568
|
-
|
|
8569
|
-
|
|
8570
|
-
|
|
8571
|
-
|
|
8572
|
-
|
|
8573
|
-
|
|
8574
|
-
|
|
8575
|
-
|
|
8576
|
-
|
|
8577
|
-
|
|
8578
|
-
|
|
8579
|
-
|
|
8580
|
-
|
|
8581
|
-
|
|
8582
|
-
|
|
8583
|
-
setAddingFor(
|
|
8584
|
-
(prev) => prev === item.concernId ? null : item.concernId
|
|
8585
|
-
);
|
|
8586
|
-
} else {
|
|
8587
|
-
onAction?.(item, action);
|
|
8588
|
-
}
|
|
8590
|
+
toolbarActions.map((action) => {
|
|
8591
|
+
const meta = ACTION_META2[action];
|
|
8592
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8593
|
+
chunkS4XCPDEO_cjs.RowIconButton,
|
|
8594
|
+
{
|
|
8595
|
+
label: meta.label,
|
|
8596
|
+
icon: meta.icon,
|
|
8597
|
+
size: "sm",
|
|
8598
|
+
expanded: action === "add-order" && onAddOrder ? addingFor === item.concernId : void 0,
|
|
8599
|
+
controls: action === "add-order" && onAddOrder ? addOrderFormId : void 0,
|
|
8600
|
+
onClick: () => {
|
|
8601
|
+
if (action === "add-order" && onAddOrder) {
|
|
8602
|
+
setAddingFor(
|
|
8603
|
+
(prev) => prev === item.concernId ? null : item.concernId
|
|
8604
|
+
);
|
|
8605
|
+
} else {
|
|
8606
|
+
onAction?.(item, action);
|
|
8589
8607
|
}
|
|
8590
|
-
}
|
|
8591
|
-
|
|
8592
|
-
|
|
8593
|
-
|
|
8594
|
-
),
|
|
8595
|
-
onRemoveAssessment && /* @__PURE__ */ jsxRuntime.jsx(
|
|
8608
|
+
}
|
|
8609
|
+
},
|
|
8610
|
+
action
|
|
8611
|
+
);
|
|
8612
|
+
}),
|
|
8613
|
+
rowActions.includes("remove") && onRemoveAssessment && /* @__PURE__ */ jsxRuntime.jsx(
|
|
8596
8614
|
chunkS4XCPDEO_cjs.RowIconButton,
|
|
8597
8615
|
{
|
|
8598
8616
|
label: `Remove ${assertion.text} from assessment`,
|
|
@@ -8650,7 +8668,7 @@ var Assessment = React13__namespace.forwardRef(
|
|
|
8650
8668
|
item.concernId
|
|
8651
8669
|
);
|
|
8652
8670
|
}) }),
|
|
8653
|
-
!readOnly && effectiveRenderOrderSearch && (onAddAssessment || onAddOrder) && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8671
|
+
!readOnly && availableAddModes.length > 0 && effectiveRenderOrderSearch && (onAddAssessment || onAddOrder) && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8654
8672
|
"div",
|
|
8655
8673
|
{
|
|
8656
8674
|
role: "form",
|
|
@@ -8664,7 +8682,7 @@ var Assessment = React13__namespace.forwardRef(
|
|
|
8664
8682
|
"data-slot": "select-trigger",
|
|
8665
8683
|
value: addMode,
|
|
8666
8684
|
onChange: (e) => {
|
|
8667
|
-
|
|
8685
|
+
setSelectedAddMode(e.target.value);
|
|
8668
8686
|
setPendingFreeText(null);
|
|
8669
8687
|
},
|
|
8670
8688
|
className: chunkS5RVSXDV_cjs.cn(
|
|
@@ -8672,9 +8690,9 @@ var Assessment = React13__namespace.forwardRef(
|
|
|
8672
8690
|
"focus:ring-ring focus:ring-2 focus:outline-none"
|
|
8673
8691
|
),
|
|
8674
8692
|
children: [
|
|
8675
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "auto", children: "Add (auto)" }),
|
|
8676
|
-
onAddAssessment && /* @__PURE__ */ jsxRuntime.jsx("option", { value: "problem", children: "Add concern" }),
|
|
8677
|
-
onAddOrder && /* @__PURE__ */ jsxRuntime.jsx("option", { value: "order", children: "Add order" })
|
|
8693
|
+
availableAddModes.includes("auto") && /* @__PURE__ */ jsxRuntime.jsx("option", { value: "auto", children: "Add (auto)" }),
|
|
8694
|
+
availableAddModes.includes("problem") && onAddAssessment && /* @__PURE__ */ jsxRuntime.jsx("option", { value: "problem", children: "Add concern" }),
|
|
8695
|
+
availableAddModes.includes("order") && onAddOrder && /* @__PURE__ */ jsxRuntime.jsx("option", { value: "order", children: "Add order" })
|
|
8678
8696
|
]
|
|
8679
8697
|
}
|
|
8680
8698
|
),
|
|
@@ -8726,7 +8744,7 @@ var Assessment = React13__namespace.forwardRef(
|
|
|
8726
8744
|
}
|
|
8727
8745
|
}
|
|
8728
8746
|
}) }),
|
|
8729
|
-
pendingFreeText !== null && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8747
|
+
addMode === "auto" && pendingFreeText !== null && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8730
8748
|
"div",
|
|
8731
8749
|
{
|
|
8732
8750
|
role: "group",
|