@homebound/beam 4.8.0 → 4.9.1
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 +40 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +40 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -6954,7 +6954,6 @@ var import_mobx5 = require("mobx");
|
|
|
6954
6954
|
// src/components/Table/components/CompanionRow.tsx
|
|
6955
6955
|
var import_mobx_react = require("mobx-react");
|
|
6956
6956
|
var import_react16 = require("react");
|
|
6957
|
-
var import_runtime16 = require("@homebound/truss/runtime");
|
|
6958
6957
|
|
|
6959
6958
|
// src/layouts/DocumentScrollLayoutContext.tsx
|
|
6960
6959
|
var import_utils2 = require("@react-aria/utils");
|
|
@@ -7140,6 +7139,7 @@ function headerContentPaddingX(compact = false) {
|
|
|
7140
7139
|
}
|
|
7141
7140
|
|
|
7142
7141
|
// src/components/Table/components/CompanionRow.tsx
|
|
7142
|
+
var import_runtime16 = require("@homebound/truss/runtime");
|
|
7143
7143
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
7144
7144
|
var __maybeInc7 = (inc) => {
|
|
7145
7145
|
return typeof inc === "string" ? inc : `calc(var(--t-spacing) * ${inc})`;
|
|
@@ -7155,7 +7155,9 @@ function CompanionRowImpl(props) {
|
|
|
7155
7155
|
isLastBodyRow,
|
|
7156
7156
|
companion,
|
|
7157
7157
|
position = "trailing",
|
|
7158
|
-
levelIndent
|
|
7158
|
+
levelIndent,
|
|
7159
|
+
rowCss,
|
|
7160
|
+
cellCss
|
|
7159
7161
|
} = props;
|
|
7160
7162
|
const RowTag = as === "table" ? "tr" : "div";
|
|
7161
7163
|
const CellTag = as === "table" ? "td" : "div";
|
|
@@ -7186,7 +7188,8 @@ function CompanionRowImpl(props) {
|
|
|
7186
7188
|
"--marginLeft": `${levelIndent}px`
|
|
7187
7189
|
}]
|
|
7188
7190
|
},
|
|
7189
|
-
...isLastBodyRow && style.lastRowCss
|
|
7191
|
+
...isLastBodyRow && style.lastRowCss,
|
|
7192
|
+
...rowCss
|
|
7190
7193
|
}), "data-gridrow": true, ...tid[rowId], children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CellTag, { ...(0, import_runtime16.trussProps)({
|
|
7191
7194
|
...style.cellCss,
|
|
7192
7195
|
...style.betweenRowsCss,
|
|
@@ -7197,6 +7200,7 @@ function CompanionRowImpl(props) {
|
|
|
7197
7200
|
...isLastBodyRow && style.lastRowCellCss,
|
|
7198
7201
|
...isLastBodyRow && style.lastRowFirstCellCss,
|
|
7199
7202
|
...isLastBodyRow && style.lastRowLastCellCss,
|
|
7203
|
+
...cellCss,
|
|
7200
7204
|
// Companion content is arbitrary — allow wrapping and grow with content.
|
|
7201
7205
|
...{
|
|
7202
7206
|
height: "h_auto",
|
|
@@ -9731,6 +9735,11 @@ function resolveStyles(style) {
|
|
|
9731
9735
|
return style;
|
|
9732
9736
|
}
|
|
9733
9737
|
|
|
9738
|
+
// src/components/Table/utils/maybeApplyFunction.ts
|
|
9739
|
+
function maybeApplyFunction(row, maybeFn) {
|
|
9740
|
+
return typeof maybeFn === "function" ? maybeFn(row) : maybeFn;
|
|
9741
|
+
}
|
|
9742
|
+
|
|
9734
9743
|
// src/hooks/useRenderCount.ts
|
|
9735
9744
|
var import_react28 = require("react");
|
|
9736
9745
|
function useRenderCount() {
|
|
@@ -10117,7 +10126,7 @@ var __typography2 = {
|
|
|
10117
10126
|
lineHeight: "lh_32px"
|
|
10118
10127
|
}
|
|
10119
10128
|
};
|
|
10120
|
-
function
|
|
10129
|
+
function maybeApplyFunction2(row, maybeFn) {
|
|
10121
10130
|
return typeof maybeFn === "function" ? maybeFn(row) : maybeFn;
|
|
10122
10131
|
}
|
|
10123
10132
|
function RowImpl(props) {
|
|
@@ -10173,7 +10182,7 @@ function RowImpl(props) {
|
|
|
10173
10182
|
const RowTag = as === "table" ? "tr" : "div";
|
|
10174
10183
|
const sortOn = tableState.sortConfig?.on;
|
|
10175
10184
|
const showRowHoverColor = !reservedRowKinds.includes(row.kind) && !omitRowHover && style.rowHoverColor !== "none";
|
|
10176
|
-
const rowStyleCellCss =
|
|
10185
|
+
const rowStyleCellCss = maybeApplyFunction2(row, rowStyle?.cellCss);
|
|
10177
10186
|
const levelStyle = style.levels && (typeof style.levels === "function" ? style.levels(level) : style.levels[level]);
|
|
10178
10187
|
const levelIndent = levelStyle?.rowIndent;
|
|
10179
10188
|
const containerCss = {
|
|
@@ -10210,7 +10219,7 @@ function RowImpl(props) {
|
|
|
10210
10219
|
...(rowStyle?.rowLink || rowStyle?.onClick) && {
|
|
10211
10220
|
cursor: "h_cursorPointer"
|
|
10212
10221
|
},
|
|
10213
|
-
...
|
|
10222
|
+
...maybeApplyFunction2(row, rowStyle?.rowCss),
|
|
10214
10223
|
// Row hover paints cells via Row.css.ts (`.beam-row-hover:hover > *`); set the var via Css.style
|
|
10215
10224
|
// (React CSSProperties rejects custom props without a cast).
|
|
10216
10225
|
...showRowHoverColor && {
|
|
@@ -13770,7 +13779,8 @@ function GridTable(props) {
|
|
|
13770
13779
|
} }, rs.key);
|
|
13771
13780
|
const makeCompanionRow = (rs, resolved, isFirstBodyRow, isLastBodyRow) => {
|
|
13772
13781
|
const levelStyle = style.levels && (typeof style.levels === "function" ? style.levels(rs.level) : style.levels[rs.level]);
|
|
13773
|
-
|
|
13782
|
+
const rowStyle = rowStyles?.[rs.row.kind];
|
|
13783
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(CompanionRow, { as, style, columnSizes, rowId: rs.row.id, colSpan: columns.length, isFirstBodyRow, isLastBodyRow, position: resolved.position, companion: resolved.content, levelIndent: levelStyle?.rowIndent, rowCss: maybeApplyFunction(rs.row, rowStyle?.rowCss), cellCss: maybeApplyFunction(rs.row, rowStyle?.cellCss) }, `${rs.key}-companion`);
|
|
13774
13784
|
};
|
|
13775
13785
|
const makeRowGroup = (rs, isFirstBodyRow, isLastBodyRow, inHead) => {
|
|
13776
13786
|
const resolved = rs.companion;
|
|
@@ -29391,10 +29401,12 @@ var import_react167 = require("react");
|
|
|
29391
29401
|
var import_react_router_dom9 = require("react-router-dom");
|
|
29392
29402
|
var import_jsx_runtime237 = require("react/jsx-runtime");
|
|
29393
29403
|
function useUnsavedChangesGuard(options) {
|
|
29394
|
-
const { isDirty, onCancel } = options;
|
|
29404
|
+
const { isDirty, allowNavigation, onCancel } = options;
|
|
29395
29405
|
const { openModal } = useModal();
|
|
29396
29406
|
const isDirtyRef = (0, import_react167.useRef)(isDirty);
|
|
29397
29407
|
isDirtyRef.current = isDirty;
|
|
29408
|
+
const allowNavigationRef = (0, import_react167.useRef)(allowNavigation);
|
|
29409
|
+
allowNavigationRef.current = allowNavigation;
|
|
29398
29410
|
(0, import_react167.useEffect)(() => {
|
|
29399
29411
|
const onBeforeUnload = (e) => {
|
|
29400
29412
|
if (isDirtyRef.current?.()) {
|
|
@@ -29404,7 +29416,9 @@ function useUnsavedChangesGuard(options) {
|
|
|
29404
29416
|
window.addEventListener("beforeunload", onBeforeUnload);
|
|
29405
29417
|
return () => window.removeEventListener("beforeunload", onBeforeUnload);
|
|
29406
29418
|
}, []);
|
|
29407
|
-
const blocker = (0, import_react_router_dom9.useBlocker)(() =>
|
|
29419
|
+
const blocker = (0, import_react_router_dom9.useBlocker)((args) => {
|
|
29420
|
+
return !!isDirtyRef.current?.() && !allowNavigationRef.current?.(args);
|
|
29421
|
+
});
|
|
29408
29422
|
const onCancelClick = (e) => {
|
|
29409
29423
|
if (!isDirty?.()) {
|
|
29410
29424
|
onCancel(e);
|
|
@@ -29474,6 +29488,7 @@ function WorkflowPageLayout(props) {
|
|
|
29474
29488
|
stepperTabs,
|
|
29475
29489
|
aiMode,
|
|
29476
29490
|
isDirty,
|
|
29491
|
+
allowNavigation,
|
|
29477
29492
|
children,
|
|
29478
29493
|
title,
|
|
29479
29494
|
documentTitleSuffix,
|
|
@@ -29490,6 +29505,7 @@ function WorkflowPageLayout(props) {
|
|
|
29490
29505
|
navigationBlocker
|
|
29491
29506
|
} = useUnsavedChangesGuard({
|
|
29492
29507
|
isDirty,
|
|
29508
|
+
allowNavigation,
|
|
29493
29509
|
onCancel
|
|
29494
29510
|
});
|
|
29495
29511
|
const actions = /* @__PURE__ */ (0, import_jsx_runtime239.jsx)(WorkflowActions, { ...actionProps, aiMode, onCancel: onCancelClick });
|
|
@@ -29603,6 +29619,7 @@ function FocusedFormLayout(props) {
|
|
|
29603
29619
|
onSaveAndExit,
|
|
29604
29620
|
primaryDisabled,
|
|
29605
29621
|
isDirty,
|
|
29622
|
+
allowNavigation,
|
|
29606
29623
|
aiMode,
|
|
29607
29624
|
children,
|
|
29608
29625
|
...headerProps
|
|
@@ -29615,6 +29632,7 @@ function FocusedFormLayout(props) {
|
|
|
29615
29632
|
...headerProps,
|
|
29616
29633
|
aiMode,
|
|
29617
29634
|
isDirty,
|
|
29635
|
+
allowNavigation,
|
|
29618
29636
|
onCancel,
|
|
29619
29637
|
onSaveAndExit,
|
|
29620
29638
|
completeLabel,
|
|
@@ -29629,7 +29647,18 @@ function FocusedFormLayout(props) {
|
|
|
29629
29647
|
var import_react169 = require("react");
|
|
29630
29648
|
var import_jsx_runtime241 = require("react/jsx-runtime");
|
|
29631
29649
|
function StepperLayout(props) {
|
|
29632
|
-
const {
|
|
29650
|
+
const {
|
|
29651
|
+
steps,
|
|
29652
|
+
defaultStep,
|
|
29653
|
+
onCancel,
|
|
29654
|
+
completeLabel,
|
|
29655
|
+
onComplete,
|
|
29656
|
+
onSaveAndExit,
|
|
29657
|
+
isDirty,
|
|
29658
|
+
allowNavigation,
|
|
29659
|
+
aiMode,
|
|
29660
|
+
...headerProps
|
|
29661
|
+
} = props;
|
|
29633
29662
|
const stepTabs = steps.map((step) => ({ ...step, value: defaultTestId(step.label) }));
|
|
29634
29663
|
const [currentStep, setCurrentStep] = (0, import_react169.useState)(() => getInitialStep(stepTabs, defaultStep));
|
|
29635
29664
|
const tid = useTestIds(props, "stepperLayout");
|
|
@@ -29645,6 +29674,7 @@ function StepperLayout(props) {
|
|
|
29645
29674
|
aiMode,
|
|
29646
29675
|
stepperTabs: { steps: stepTabs, currentStep, onChange: setCurrentStep },
|
|
29647
29676
|
isDirty,
|
|
29677
|
+
allowNavigation,
|
|
29648
29678
|
isFirstStep,
|
|
29649
29679
|
isLastStep,
|
|
29650
29680
|
onBack: () => {
|