@bsuite/page-builder 1.0.1 → 1.0.3
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/PageGridLayout.d.ts.map +1 -1
- package/dist/PageGridLayout.js +15 -2
- package/dist/autoHeight.d.ts +34 -0
- package/dist/autoHeight.d.ts.map +1 -1
- package/dist/autoHeight.js +37 -1
- package/dist/types.d.ts +22 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/usePageGridLayout.d.ts.map +1 -1
- package/dist/usePageGridLayout.js +27 -5
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageGridLayout.d.ts","sourceRoot":"","sources":["../src/PageGridLayout.tsx"],"names":[],"mappings":"AACA,OAAO,KAQN,MAAM,OAAO,CAAC;AAGf,OAAO,kCAAkC,CAAC;AAC1C,OAAO,gCAAgC,CAAC;AAMxC,OAAO,KAAK,EAAe,mBAAmB,EAA4B,MAAM,YAAY,CAAC;AA8U7F,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,cAAc,EACd,WAAW,EACX,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,OAAO,EACP,UAAU,EACV,SAAS,EAMT,WAAkB,EAClB,aAAsC,EACtC,QAAQ,EACR,iBAAiB,EACjB,yBAAiE,EACjE,kBAAkB,EAClB,sBAAsB,EACtB,mBAAmB,EACnB,+BAA6E,EAC7E,wBAAwB,EACxB,4BAA4B,EAC5B,4BAA4B,GAC7B,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"PageGridLayout.d.ts","sourceRoot":"","sources":["../src/PageGridLayout.tsx"],"names":[],"mappings":"AACA,OAAO,KAQN,MAAM,OAAO,CAAC;AAGf,OAAO,kCAAkC,CAAC;AAC1C,OAAO,gCAAgC,CAAC;AAMxC,OAAO,KAAK,EAAe,mBAAmB,EAA4B,MAAM,YAAY,CAAC;AA8U7F,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,cAAc,EACd,WAAW,EACX,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,OAAO,EACP,UAAU,EACV,SAAS,EAMT,WAAkB,EAClB,aAAsC,EACtC,QAAQ,EACR,iBAAiB,EACjB,yBAAiE,EACjE,kBAAkB,EAClB,sBAAsB,EACtB,mBAAmB,EACnB,+BAA6E,EAC7E,wBAAwB,EACxB,4BAA4B,EAC5B,4BAA4B,GAC7B,EAAE,mBAAmB,qBA0yBrB"}
|
package/dist/PageGridLayout.js
CHANGED
|
@@ -357,10 +357,20 @@ isResizable = true, resizeHandles = DEFAULT_RESIZE_HANDLES, tenantId, defaultAut
|
|
|
357
357
|
// its content, so the clipping regression
|
|
358
358
|
// that motivated the original change stays
|
|
359
359
|
// fixed.
|
|
360
|
-
// h = max(saved, measured)
|
|
360
|
+
// h = hUserSet ? max(saved, measured) : measured
|
|
361
361
|
// -> content is never clipped, AND a height the
|
|
362
362
|
// user deliberately set is preserved instead
|
|
363
363
|
// of being reset on every re-measure.
|
|
364
|
+
//
|
|
365
|
+
// That `hUserSet` test is the 2026-08-20 correction. Without it the
|
|
366
|
+
// floor read an AUTHORED SEED as a user choice: every page ships seed
|
|
367
|
+
// heights, most cards are never resized, so `max(saved, measured)`
|
|
368
|
+
// pinned each card at its author's guess forever and auto-height could
|
|
369
|
+
// only grow. Measured signed-in on crm7 /dashboard: 1,143px dead across
|
|
370
|
+
// 7 cards, every allocation equal to its seed h — `recentActivity`
|
|
371
|
+
// seeds 13 rows (488px) to paint 173px. Ceiling wastes at most one row
|
|
372
|
+
// unit (38px), so rounding could never have produced 315px; only a
|
|
373
|
+
// floor that never lowers can.
|
|
364
374
|
// isResizable untouched -> inherits the grid default (true), so the
|
|
365
375
|
// handles are present.
|
|
366
376
|
//
|
|
@@ -418,7 +428,10 @@ isResizable = true, resizeHandles = DEFAULT_RESIZE_HANDLES, tenantId, defaultAut
|
|
|
418
428
|
return healed;
|
|
419
429
|
return {
|
|
420
430
|
...healed,
|
|
421
|
-
|
|
431
|
+
// A seed the user never touched has no claim to be preserved; a
|
|
432
|
+
// height they dragged to does. `minH` keeps content unclippable
|
|
433
|
+
// in both cases, so letting the measurement win here cannot clip.
|
|
434
|
+
h: healed.hUserSet ? Math.max(healed.h ?? 0, measuredRows) : measuredRows,
|
|
422
435
|
minH: measuredRows,
|
|
423
436
|
};
|
|
424
437
|
});
|
package/dist/autoHeight.d.ts
CHANGED
|
@@ -44,6 +44,40 @@ export interface ComputeAutoHeightRowsOptions {
|
|
|
44
44
|
* time. Ceiling always over-allocates rather than under-allocates, trading
|
|
45
45
|
* a few pixels of empty card padding for a guarantee that content is never
|
|
46
46
|
* cut off.
|
|
47
|
+
*
|
|
48
|
+
* THE MARGIN IS *BETWEEN* ROWS, NOT INSIDE EVERY ROW. This is the correction
|
|
49
|
+
* that this file existed for a month without.
|
|
50
|
+
*
|
|
51
|
+
* react-grid-layout allocates an item of `n` rows exactly:
|
|
52
|
+
*
|
|
53
|
+
* px(n) = n * rowHeight + (n - 1) * marginY
|
|
54
|
+
*
|
|
55
|
+
* so `n` rows are worth `n * (rowHeight + marginY) - marginY` pixels — one
|
|
56
|
+
* margin LESS than the row unit suggests. Dividing the needed height by the
|
|
57
|
+
* bare row unit therefore credits every item with `marginY` pixels it does
|
|
58
|
+
* not get, and `Math.ceil` cannot rescue that: the shortfall is inside the
|
|
59
|
+
* rounding, not beyond it.
|
|
60
|
+
*
|
|
61
|
+
* Inverting the real formula for the smallest `n` that fits:
|
|
62
|
+
*
|
|
63
|
+
* n * rowHeight + (n - 1) * marginY >= needed
|
|
64
|
+
* n >= (needed + marginY) / (rowHeight + marginY)
|
|
65
|
+
*
|
|
66
|
+
* MEASURED ON PRODUCTION, 2026-08-20, crm7 /clients/create at 1366x768. The
|
|
67
|
+
* card holding the form's Create/Cancel row measured 32px tall around a 36px
|
|
68
|
+
* button, with `overflow-hidden`, so the button was cut off and a neighbouring
|
|
69
|
+
* card's helper text was painted over what remained — `elementFromPoint` at the
|
|
70
|
+
* button's centre returned a `<p>`, not the button. The form could not be
|
|
71
|
+
* submitted by a person. rowHeight 32 + marginY 6: 36px of content came to
|
|
72
|
+
* `ceil((36 + 2) / 38) = 1` row, and one row is 32 pixels.
|
|
73
|
+
*
|
|
74
|
+
* The old form clips whenever the needed height lands 1..marginY pixels above a
|
|
75
|
+
* row boundary — 6 of every 38 possible heights, about one card in six.
|
|
76
|
+
*
|
|
77
|
+
* It survived because the tests asserted the ARITHMETIC rather than the
|
|
78
|
+
* OUTCOME: they checked the division, never whether the resulting row count
|
|
79
|
+
* buys enough pixels. Three of them encoded a clipping case as the expected
|
|
80
|
+
* answer. They now assert against react-grid-layout's own formula instead.
|
|
47
81
|
*/
|
|
48
82
|
export declare function computeAutoHeightRows({ contentPx, cardChromePx, rowHeightPx, marginYPx, minRows, }: ComputeAutoHeightRowsOptions): number;
|
|
49
83
|
//# sourceMappingURL=autoHeight.d.ts.map
|
package/dist/autoHeight.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autoHeight.d.ts","sourceRoot":"","sources":["../src/autoHeight.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,4BAA4B;IAC3C;;;;;;;;;;;OAWG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;;;OAKG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED
|
|
1
|
+
{"version":3,"file":"autoHeight.d.ts","sourceRoot":"","sources":["../src/autoHeight.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,4BAA4B;IAC3C;;;;;;;;;;;OAWG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;;;OAKG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,SAAS,EACT,YAAY,EACZ,WAAW,EACX,SAAS,EACT,OAAW,GACZ,EAAE,4BAA4B,GAAG,MAAM,CAOvC"}
|
package/dist/autoHeight.js
CHANGED
|
@@ -6,11 +6,47 @@
|
|
|
6
6
|
* time. Ceiling always over-allocates rather than under-allocates, trading
|
|
7
7
|
* a few pixels of empty card padding for a guarantee that content is never
|
|
8
8
|
* cut off.
|
|
9
|
+
*
|
|
10
|
+
* THE MARGIN IS *BETWEEN* ROWS, NOT INSIDE EVERY ROW. This is the correction
|
|
11
|
+
* that this file existed for a month without.
|
|
12
|
+
*
|
|
13
|
+
* react-grid-layout allocates an item of `n` rows exactly:
|
|
14
|
+
*
|
|
15
|
+
* px(n) = n * rowHeight + (n - 1) * marginY
|
|
16
|
+
*
|
|
17
|
+
* so `n` rows are worth `n * (rowHeight + marginY) - marginY` pixels — one
|
|
18
|
+
* margin LESS than the row unit suggests. Dividing the needed height by the
|
|
19
|
+
* bare row unit therefore credits every item with `marginY` pixels it does
|
|
20
|
+
* not get, and `Math.ceil` cannot rescue that: the shortfall is inside the
|
|
21
|
+
* rounding, not beyond it.
|
|
22
|
+
*
|
|
23
|
+
* Inverting the real formula for the smallest `n` that fits:
|
|
24
|
+
*
|
|
25
|
+
* n * rowHeight + (n - 1) * marginY >= needed
|
|
26
|
+
* n >= (needed + marginY) / (rowHeight + marginY)
|
|
27
|
+
*
|
|
28
|
+
* MEASURED ON PRODUCTION, 2026-08-20, crm7 /clients/create at 1366x768. The
|
|
29
|
+
* card holding the form's Create/Cancel row measured 32px tall around a 36px
|
|
30
|
+
* button, with `overflow-hidden`, so the button was cut off and a neighbouring
|
|
31
|
+
* card's helper text was painted over what remained — `elementFromPoint` at the
|
|
32
|
+
* button's centre returned a `<p>`, not the button. The form could not be
|
|
33
|
+
* submitted by a person. rowHeight 32 + marginY 6: 36px of content came to
|
|
34
|
+
* `ceil((36 + 2) / 38) = 1` row, and one row is 32 pixels.
|
|
35
|
+
*
|
|
36
|
+
* The old form clips whenever the needed height lands 1..marginY pixels above a
|
|
37
|
+
* row boundary — 6 of every 38 possible heights, about one card in six.
|
|
38
|
+
*
|
|
39
|
+
* It survived because the tests asserted the ARITHMETIC rather than the
|
|
40
|
+
* OUTCOME: they checked the division, never whether the resulting row count
|
|
41
|
+
* buys enough pixels. Three of them encoded a clipping case as the expected
|
|
42
|
+
* answer. They now assert against react-grid-layout's own formula instead.
|
|
9
43
|
*/
|
|
10
44
|
export function computeAutoHeightRows({ contentPx, cardChromePx, rowHeightPx, marginYPx, minRows = 1, }) {
|
|
11
45
|
const rowUnitPx = rowHeightPx + marginYPx;
|
|
12
46
|
if (rowUnitPx <= 0)
|
|
13
47
|
return minRows;
|
|
14
|
-
|
|
48
|
+
// `+ marginYPx` inverts px(n) = n*rowHeight + (n-1)*marginY. Without it every
|
|
49
|
+
// item is credited with one margin it never receives. See the docblock.
|
|
50
|
+
const raw = Math.ceil((contentPx + cardChromePx + marginYPx) / rowUnitPx);
|
|
15
51
|
return Math.max(minRows, raw);
|
|
16
52
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -15,6 +15,28 @@ export interface GridLayoutItem extends LayoutItem {
|
|
|
15
15
|
* operator-mandated capability. See the `activeLayouts` memo.
|
|
16
16
|
*/
|
|
17
17
|
autoHeight?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* True once the user has resized this item with the SE handle.
|
|
20
|
+
*
|
|
21
|
+
* The floor above says "never discard a height the user chose". Until this
|
|
22
|
+
* flag existed the code could not tell a chosen height from an AUTHORED
|
|
23
|
+
* SEED, so it defended both — and a seed is the common case, because every
|
|
24
|
+
* page ships one and most cards are never resized. `max(saved, measured)`
|
|
25
|
+
* then pinned each card at whatever its author guessed, permanently, and
|
|
26
|
+
* auto-height could only ever grow.
|
|
27
|
+
*
|
|
28
|
+
* Measured in a signed-in browser on crm7 `/dashboard`, 2026-08-20:
|
|
29
|
+
* 1,143px of dead space across 7 cards, every allocation equal to its seed
|
|
30
|
+
* `h` rather than to its content. `recentActivity` seeds `h: 13` (488px)
|
|
31
|
+
* and paints 173px — 315px dead, 8.3 row units. `Math.ceil` can waste at
|
|
32
|
+
* most ONE row unit, so rounding was never a candidate cause.
|
|
33
|
+
*
|
|
34
|
+
* Set by `stripAutoHeightRows` at the moment it identifies a deliberate
|
|
35
|
+
* resize — the one place that already distinguishes a real gesture from a
|
|
36
|
+
* measurement echo. Absent (legacy layouts, seeds) means the measured
|
|
37
|
+
* height wins outright.
|
|
38
|
+
*/
|
|
39
|
+
hUserSet?: boolean;
|
|
18
40
|
}
|
|
19
41
|
export interface GridLayouts {
|
|
20
42
|
lg: GridLayoutItem[];
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAEjF,MAAM,WAAW,cAAe,SAAQ,UAAU;IAChD;;;;;;;;;;;;OAYG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAEjF,MAAM,WAAW,cAAe,SAAQ,UAAU;IAChD;;;;;;;;;;;;OAYG;IACH,UAAU,CAA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AAuB,EACxB,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,0BAA0B,2IAM7B,CAAC;AAEX;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB,6BAA6B,CAAC;AAElE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,oBAAoB,OAAO,CAAC;AAiBzC,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,wBAAgB,iBAAiB,CAAC,EAChC,OAAO,EACP,cAAc,EACd,WAAgB,EAChB,aAAiB,EACjB,WAAkB,EAClB,gBAA6C,EAC7C,iBAA4C,EAC5C,iBAAiB,GAClB,EAAE,wBAAwB,GAAG,uBAAuB,
|
|
1
|
+
{"version":3,"file":"usePageGridLayout.d.ts","sourceRoot":"","sources":["../src/usePageGridLayout.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAGV,wBAAwB,EACxB,uBAAuB,EACxB,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,0BAA0B,2IAM7B,CAAC;AAEX;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB,6BAA6B,CAAC;AAElE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,oBAAoB,OAAO,CAAC;AAiBzC,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,wBAAgB,iBAAiB,CAAC,EAChC,OAAO,EACP,cAAc,EACd,WAAgB,EAChB,aAAiB,EACjB,WAAkB,EAClB,gBAA6C,EAC7C,iBAA4C,EAC5C,iBAAiB,GAClB,EAAE,wBAAwB,GAAG,uBAAuB,CAwnBpD"}
|
|
@@ -267,7 +267,8 @@ export function usePageGridLayout({ pageKey, defaultLayouts, defaultCols = 12, l
|
|
|
267
267
|
*
|
|
268
268
|
* react-grid-layout is rendered with `autoHeightRows` merged over the saved
|
|
269
269
|
* layout (see `applyAutoHeightRows` / `activeLayouts` in
|
|
270
|
-
* `PageGridLayout.tsx`: `h = max(saved, measured)`),
|
|
270
|
+
* `PageGridLayout.tsx`: `h = hUserSet ? max(saved, measured) : measured`),
|
|
271
|
+
* so the layouts it
|
|
271
272
|
* echoes back through `onLayoutChange` carry that MERGED `h` for every
|
|
272
273
|
* autoHeight item, on every commit — including commits that never touched
|
|
273
274
|
* this particular item (e.g. a re-measurement of a sibling card, or a
|
|
@@ -314,18 +315,39 @@ export function usePageGridLayout({ pageKey, defaultLayouts, defaultCols = 12, l
|
|
|
314
315
|
if (!baseItem?.autoHeight)
|
|
315
316
|
return item;
|
|
316
317
|
const measuredRows = measured[item.i];
|
|
317
|
-
|
|
318
|
+
// MUST mirror `activeLayouts` in PageGridLayout.tsx exactly, including
|
|
319
|
+
// its `hUserSet` test. This predicts what the grid was RENDERED with;
|
|
320
|
+
// predict a floor it was not rendered with and every measurement echo
|
|
321
|
+
// reads as a deliberate resize and persists — which is the crm7#744
|
|
322
|
+
// failure with its sign reversed.
|
|
323
|
+
const renderedFloorH = measuredRows === undefined
|
|
324
|
+
? baseItem.h
|
|
325
|
+
: baseItem.hUserSet
|
|
326
|
+
? Math.max(baseItem.h ?? 0, measuredRows)
|
|
327
|
+
: measuredRows;
|
|
318
328
|
if (item.h === renderedFloorH) {
|
|
319
329
|
// Echo of the render-layer merge (or genuinely unchanged) — not a
|
|
320
330
|
// user gesture on THIS item. Restore the un-merged base so a
|
|
321
|
-
// measured bump never persists.
|
|
322
|
-
|
|
331
|
+
// measured bump never persists. `hUserSet` is carried over by hand
|
|
332
|
+
// for the same reason `autoHeight` is: react-grid-layout does not
|
|
333
|
+
// round-trip custom item props, so anything not restored here is
|
|
334
|
+
// silently dropped on the next commit.
|
|
335
|
+
return {
|
|
336
|
+
...item,
|
|
337
|
+
autoHeight: true,
|
|
338
|
+
h: baseItem.h,
|
|
339
|
+
minH: baseItem.minH,
|
|
340
|
+
...(baseItem.hUserSet ? { hUserSet: true } : {}),
|
|
341
|
+
};
|
|
323
342
|
}
|
|
324
343
|
// A deliberate resize (bigger or smaller than the base) — keep it,
|
|
325
|
-
// still floored by the measured content height.
|
|
344
|
+
// still floored by the measured content height. This is the only
|
|
345
|
+
// moment in the system where a height is known to be a CHOICE rather
|
|
346
|
+
// than an authored seed, so it is where that fact gets recorded.
|
|
326
347
|
return {
|
|
327
348
|
...item,
|
|
328
349
|
autoHeight: true,
|
|
350
|
+
hUserSet: true,
|
|
329
351
|
h: measuredRows === undefined ? item.h : Math.max(item.h, measuredRows),
|
|
330
352
|
minH: measuredRows ?? baseItem.minH,
|
|
331
353
|
};
|