@bsuite/page-builder 0.6.3 → 0.8.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/dist/PageGridLayout.d.ts +1 -1
- package/dist/PageGridLayout.d.ts.map +1 -1
- package/dist/PageGridLayout.js +190 -21
- package/dist/RelationshipField.d.ts +77 -0
- package/dist/RelationshipField.d.ts.map +1 -0
- package/dist/RelationshipField.js +158 -0
- package/dist/buildResponsiveLayouts.d.ts +61 -4
- package/dist/buildResponsiveLayouts.d.ts.map +1 -1
- package/dist/buildResponsiveLayouts.js +77 -5
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/relationshipCatalog.d.ts +22 -0
- package/dist/relationshipCatalog.d.ts.map +1 -0
- package/dist/relationshipCatalog.js +26 -0
- package/dist/types.d.ts +102 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/usePageGridLayout.d.ts +22 -1
- package/dist/usePageGridLayout.d.ts.map +1 -1
- package/dist/usePageGridLayout.js +197 -66
- package/package.json +1 -1
|
@@ -1,15 +1,72 @@
|
|
|
1
1
|
import type { GridLayouts } from './types.js';
|
|
2
2
|
export declare const RESPONSIVE_BREAKPOINTS: readonly ["lg", "md", "sm", "xs", "xxs"];
|
|
3
3
|
export type ResponsiveBreakpoint = (typeof RESPONSIVE_BREAKPOINTS)[number];
|
|
4
|
+
/**
|
|
5
|
+
* Breakpoints whose layout MIRRORS `lg` verbatim.
|
|
6
|
+
*
|
|
7
|
+
* D-75 root cause (operator directive 2026-08-13: "columns available to move
|
|
8
|
+
* cards into do not respect the columns slider").
|
|
9
|
+
* ---------------------------------------------------------------------------
|
|
10
|
+
* react-grid-layout picks its breakpoint from the **container** width, not the
|
|
11
|
+
* viewport — `<Responsive width={containerWidth}>` in `PageGridLayout`. Inside
|
|
12
|
+
* an app shell with a sidebar and page padding, a 1280px laptop presents a
|
|
13
|
+
* container around 950px and a 1440px desktop around 1100px. Both land BELOW
|
|
14
|
+
* the `md: 996` / `lg: 1200` thresholds, so the great majority of real desktop
|
|
15
|
+
* sessions render at `sm` or `md`, not `lg`.
|
|
16
|
+
*
|
|
17
|
+
* `sm` used to be derived by `stackToSingleColumn`, which sets `w: cols` on
|
|
18
|
+
* every item — one card per row at full width, whatever the column count. So
|
|
19
|
+
* on an ordinary laptop the columns slider changed `activeCols` while every
|
|
20
|
+
* card stayed stretched across all of them: the control provably did nothing,
|
|
21
|
+
* and the SE resize handle could not widen a card that was already at the grid
|
|
22
|
+
* bound nor narrow one whose `minW` had been clamped up to `cols`.
|
|
23
|
+
*
|
|
24
|
+
* `md` and `sm` therefore mirror `lg`: at a container width of 768px and above
|
|
25
|
+
* there is room for the arrangement the user chose, and honouring their choice
|
|
26
|
+
* is the whole point of the control. Genuine phone widths (`xs` < 768px
|
|
27
|
+
* container, `xxs` < 480px) still stack, which is what that code was for.
|
|
28
|
+
*/
|
|
29
|
+
export declare const MIRRORED_BREAKPOINTS: readonly ["md", "sm"];
|
|
30
|
+
/**
|
|
31
|
+
* Breakpoints derived as a single full-width stack — narrow enough that a
|
|
32
|
+
* multi-column arrangement cannot be read.
|
|
33
|
+
*/
|
|
34
|
+
export declare const STACKED_BREAKPOINTS: readonly ["xs", "xxs"];
|
|
35
|
+
/**
|
|
36
|
+
* Every breakpoint this module DERIVES from `lg`.
|
|
37
|
+
*
|
|
38
|
+
* A derived breakpoint is a render-time projection, never a stored fact. It
|
|
39
|
+
* must not reach the preference adapter: react-grid-layout echoes ALL
|
|
40
|
+
* breakpoints back through `onLayoutChange` on every gesture, so persisting
|
|
41
|
+
* them verbatim froze the derivation — a layout derived once at 12 columns was
|
|
42
|
+
* then "consumer-supplied" forever and stopped tracking `lg`. See
|
|
43
|
+
* `canonicaliseLayoutForPersist` in `usePageGridLayout.ts`.
|
|
44
|
+
*/
|
|
45
|
+
export declare const DERIVED_BREAKPOINTS: readonly ResponsiveBreakpoint[];
|
|
46
|
+
export declare function isDerivedBreakpoint(breakpoint: string): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* True when a gesture at `breakpoint` can be written straight back onto `lg`.
|
|
49
|
+
*
|
|
50
|
+
* `lg`, `md` and `sm` all render the same array against the same column count,
|
|
51
|
+
* so an edit made at any of them is expressible in `lg` with no loss. `xs` and
|
|
52
|
+
* `xxs` render a full-width stack, where an edit carries only a vertical order
|
|
53
|
+
* and would flatten a multi-column desktop arrangement if applied to `lg`.
|
|
54
|
+
*/
|
|
55
|
+
export declare function isCanonicalisableBreakpoint(breakpoint: string): boolean;
|
|
4
56
|
export interface BuildResponsiveLayoutsOptions {
|
|
5
57
|
cols?: number;
|
|
6
58
|
}
|
|
7
59
|
/**
|
|
8
60
|
* Ensure a GridLayouts object has entries for all responsive breakpoints
|
|
9
|
-
* (lg, md, sm, xs, xxs).
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
61
|
+
* (lg, md, sm, xs, xxs).
|
|
62
|
+
*
|
|
63
|
+
* - `md` and `sm` mirror `lg` so the user's chosen column arrangement survives
|
|
64
|
+
* every desktop and tablet container width (see {@link MIRRORED_BREAKPOINTS}).
|
|
65
|
+
* - `xs` and `xxs` are derived as a single-column stack so a phone viewport
|
|
66
|
+
* never squashes cards into unreadable slivers.
|
|
67
|
+
* - Consumer-supplied breakpoints are preserved verbatim. Supplying one opts
|
|
68
|
+
* that breakpoint OUT of tracking `lg`, including out of the columns slider —
|
|
69
|
+
* prefer not to.
|
|
13
70
|
*/
|
|
14
71
|
export declare function buildResponsiveLayouts(layouts: GridLayouts, { cols }?: BuildResponsiveLayoutsOptions): GridLayouts;
|
|
15
72
|
//# sourceMappingURL=buildResponsiveLayouts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildResponsiveLayouts.d.ts","sourceRoot":"","sources":["../src/buildResponsiveLayouts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkB,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9D,eAAO,MAAM,sBAAsB,0CAA2C,CAAC;AAC/E,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE3E,MAAM,WAAW,6BAA6B;IAC5C,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;
|
|
1
|
+
{"version":3,"file":"buildResponsiveLayouts.d.ts","sourceRoot":"","sources":["../src/buildResponsiveLayouts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkB,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9D,eAAO,MAAM,sBAAsB,0CAA2C,CAAC;AAC/E,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE3E;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,oBAAoB,uBAAwB,CAAC;AAE1D;;;GAGG;AACH,eAAO,MAAM,mBAAmB,wBAAyB,CAAC;AAE1D;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,EAAE,SAAS,oBAAoB,EAG9D,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAE/D;AAED;;;;;;;GAOG;AACH,wBAAgB,2BAA2B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAEvE;AAED,MAAM,WAAW,6BAA6B;IAC5C,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AA0BD;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,WAAW,EACpB,EAAE,IAAS,EAAE,GAAE,6BAAkC,GAChD,WAAW,CAyBb"}
|
|
@@ -1,4 +1,71 @@
|
|
|
1
1
|
export const RESPONSIVE_BREAKPOINTS = ['lg', 'md', 'sm', 'xs', 'xxs'];
|
|
2
|
+
/**
|
|
3
|
+
* Breakpoints whose layout MIRRORS `lg` verbatim.
|
|
4
|
+
*
|
|
5
|
+
* D-75 root cause (operator directive 2026-08-13: "columns available to move
|
|
6
|
+
* cards into do not respect the columns slider").
|
|
7
|
+
* ---------------------------------------------------------------------------
|
|
8
|
+
* react-grid-layout picks its breakpoint from the **container** width, not the
|
|
9
|
+
* viewport — `<Responsive width={containerWidth}>` in `PageGridLayout`. Inside
|
|
10
|
+
* an app shell with a sidebar and page padding, a 1280px laptop presents a
|
|
11
|
+
* container around 950px and a 1440px desktop around 1100px. Both land BELOW
|
|
12
|
+
* the `md: 996` / `lg: 1200` thresholds, so the great majority of real desktop
|
|
13
|
+
* sessions render at `sm` or `md`, not `lg`.
|
|
14
|
+
*
|
|
15
|
+
* `sm` used to be derived by `stackToSingleColumn`, which sets `w: cols` on
|
|
16
|
+
* every item — one card per row at full width, whatever the column count. So
|
|
17
|
+
* on an ordinary laptop the columns slider changed `activeCols` while every
|
|
18
|
+
* card stayed stretched across all of them: the control provably did nothing,
|
|
19
|
+
* and the SE resize handle could not widen a card that was already at the grid
|
|
20
|
+
* bound nor narrow one whose `minW` had been clamped up to `cols`.
|
|
21
|
+
*
|
|
22
|
+
* `md` and `sm` therefore mirror `lg`: at a container width of 768px and above
|
|
23
|
+
* there is room for the arrangement the user chose, and honouring their choice
|
|
24
|
+
* is the whole point of the control. Genuine phone widths (`xs` < 768px
|
|
25
|
+
* container, `xxs` < 480px) still stack, which is what that code was for.
|
|
26
|
+
*/
|
|
27
|
+
export const MIRRORED_BREAKPOINTS = ['md', 'sm'];
|
|
28
|
+
/**
|
|
29
|
+
* Breakpoints derived as a single full-width stack — narrow enough that a
|
|
30
|
+
* multi-column arrangement cannot be read.
|
|
31
|
+
*/
|
|
32
|
+
export const STACKED_BREAKPOINTS = ['xs', 'xxs'];
|
|
33
|
+
/**
|
|
34
|
+
* Every breakpoint this module DERIVES from `lg`.
|
|
35
|
+
*
|
|
36
|
+
* A derived breakpoint is a render-time projection, never a stored fact. It
|
|
37
|
+
* must not reach the preference adapter: react-grid-layout echoes ALL
|
|
38
|
+
* breakpoints back through `onLayoutChange` on every gesture, so persisting
|
|
39
|
+
* them verbatim froze the derivation — a layout derived once at 12 columns was
|
|
40
|
+
* then "consumer-supplied" forever and stopped tracking `lg`. See
|
|
41
|
+
* `canonicaliseLayoutForPersist` in `usePageGridLayout.ts`.
|
|
42
|
+
*/
|
|
43
|
+
export const DERIVED_BREAKPOINTS = [
|
|
44
|
+
...MIRRORED_BREAKPOINTS,
|
|
45
|
+
...STACKED_BREAKPOINTS,
|
|
46
|
+
];
|
|
47
|
+
export function isDerivedBreakpoint(breakpoint) {
|
|
48
|
+
return DERIVED_BREAKPOINTS.includes(breakpoint);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* True when a gesture at `breakpoint` can be written straight back onto `lg`.
|
|
52
|
+
*
|
|
53
|
+
* `lg`, `md` and `sm` all render the same array against the same column count,
|
|
54
|
+
* so an edit made at any of them is expressible in `lg` with no loss. `xs` and
|
|
55
|
+
* `xxs` render a full-width stack, where an edit carries only a vertical order
|
|
56
|
+
* and would flatten a multi-column desktop arrangement if applied to `lg`.
|
|
57
|
+
*/
|
|
58
|
+
export function isCanonicalisableBreakpoint(breakpoint) {
|
|
59
|
+
return breakpoint === 'lg' || MIRRORED_BREAKPOINTS.includes(breakpoint);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Stack items into one full-width column, preserving reading order.
|
|
63
|
+
*
|
|
64
|
+
* `w: cols` is deliberate at the breakpoints this is used for (`xs`/`xxs`):
|
|
65
|
+
* the container is narrower than 768px, so a card occupies the whole grid
|
|
66
|
+
* whatever the column count. Do NOT reach for this at wider breakpoints — that
|
|
67
|
+
* was D-75.
|
|
68
|
+
*/
|
|
2
69
|
function stackToSingleColumn(items, cols) {
|
|
3
70
|
const sorted = [...items].sort((a, b) => (a.y !== b.y ? a.y - b.y : a.x - b.x));
|
|
4
71
|
let nextY = 0;
|
|
@@ -16,10 +83,15 @@ function stackToSingleColumn(items, cols) {
|
|
|
16
83
|
}
|
|
17
84
|
/**
|
|
18
85
|
* Ensure a GridLayouts object has entries for all responsive breakpoints
|
|
19
|
-
* (lg, md, sm, xs, xxs).
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
86
|
+
* (lg, md, sm, xs, xxs).
|
|
87
|
+
*
|
|
88
|
+
* - `md` and `sm` mirror `lg` so the user's chosen column arrangement survives
|
|
89
|
+
* every desktop and tablet container width (see {@link MIRRORED_BREAKPOINTS}).
|
|
90
|
+
* - `xs` and `xxs` are derived as a single-column stack so a phone viewport
|
|
91
|
+
* never squashes cards into unreadable slivers.
|
|
92
|
+
* - Consumer-supplied breakpoints are preserved verbatim. Supplying one opts
|
|
93
|
+
* that breakpoint OUT of tracking `lg`, including out of the columns slider —
|
|
94
|
+
* prefer not to.
|
|
23
95
|
*/
|
|
24
96
|
export function buildResponsiveLayouts(layouts, { cols = 12 } = {}) {
|
|
25
97
|
const lg = layouts.lg ?? [];
|
|
@@ -32,7 +104,7 @@ export function buildResponsiveLayouts(layouts, { cols = 12 } = {}) {
|
|
|
32
104
|
result[bp] = supplied;
|
|
33
105
|
continue;
|
|
34
106
|
}
|
|
35
|
-
if (bp
|
|
107
|
+
if (MIRRORED_BREAKPOINTS.includes(bp)) {
|
|
36
108
|
result[bp] = lg;
|
|
37
109
|
continue;
|
|
38
110
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -11,5 +11,8 @@ export type { WysiwygPrimitive, WysiwygSurfaceContract, WysiwygSurfaceId, } from
|
|
|
11
11
|
export { buildResponsiveLayouts, RESPONSIVE_BREAKPOINTS, } from './buildResponsiveLayouts.js';
|
|
12
12
|
export type { BuildResponsiveLayoutsOptions, ResponsiveBreakpoint, } from './buildResponsiveLayouts.js';
|
|
13
13
|
export { useLocalPreference, defaultPreferenceAdapter } from './preferences.js';
|
|
14
|
-
export
|
|
14
|
+
export { RelationshipField } from './RelationshipField.js';
|
|
15
|
+
export type { RelationshipFieldProps } from './RelationshipField.js';
|
|
16
|
+
export { isRelationshipWritable } from './relationshipCatalog.js';
|
|
17
|
+
export type { EntityWidgetDetail, EntityWidgetFactoryOptions, GridLayoutItem, GridLayouts, PageGridLayoutProps, PageGridPreferenceAdapter, PageGridPreferenceFactory, RelationshipCatalog, RelationshipCatalogEntry, RelationshipFieldOption, RelationshipWidgetDetail, RelationshipWidgetFactoryOptions, UsePageGridLayoutOptions, UsePageGridLayoutResult, WidgetMeta, } from './types.js';
|
|
15
18
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,YAAY,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACrF,OAAO,EACL,iBAAiB,EACjB,0BAA0B,EAC1B,uBAAuB,GACxB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,YAAY,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EACL,2BAA2B,EAC3B,yBAAyB,EACzB,8BAA8B,EAC9B,yBAAyB,GAC1B,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,6BAA6B,CAAC;AACrC,YAAY,EACV,6BAA6B,EAC7B,oBAAoB,GACrB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAA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AAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,YAAY,EACV,kBAAkB,EAClB,0BAA0B,EAC1B,cAAc,EACd,WAAW,EACX,mBAAmB,EACnB,yBAAyB,EACzB,yBAAyB,EACzB,mBAAmB,EACnB,wBAAwB,EACxB,uBAAuB,EACvB,wBAAwB,EACxB,gCAAgC,EAChC,wBAAwB,EACxB,uBAAuB,EACvB,UAAU,GACX,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -6,3 +6,5 @@ export { computeAutoHeightRows } from './autoHeight.js';
|
|
|
6
6
|
export { WYSIWYG_REQUIRED_PRIMITIVES, WYSIWYG_SURFACE_CONTRACTS, assertWysiwygPrimitiveCoverage, getWysiwygSurfaceContract, } from './wysiwygContract.js';
|
|
7
7
|
export { buildResponsiveLayouts, RESPONSIVE_BREAKPOINTS, } from './buildResponsiveLayouts.js';
|
|
8
8
|
export { useLocalPreference, defaultPreferenceAdapter } from './preferences.js';
|
|
9
|
+
export { RelationshipField } from './RelationshipField.js';
|
|
10
|
+
export { isRelationshipWritable } from './relationshipCatalog.js';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { RelationshipCatalog, RelationshipWidgetDetail } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* True only when `detail` names a relationship literally present in
|
|
4
|
+
* `catalog` — the W4-2 gate ("a relationship field may only be offered
|
|
5
|
+
* where the host record genuinely has a foreign key to write").
|
|
6
|
+
*
|
|
7
|
+
* `catalog` is undefined/empty-safe by design: no catalogue means nothing
|
|
8
|
+
* has been proven writable, so every relationship is refused (fail closed)
|
|
9
|
+
* rather than silently offering a picker that cannot save. This is the only
|
|
10
|
+
* place that decision is made — `PageGridLayout`'s add-relationship-widget
|
|
11
|
+
* handler calls this before ever creating a widget, and it is exported so
|
|
12
|
+
* consumers (e.g. a canvas "add element" palette deciding what to list) can
|
|
13
|
+
* apply the identical rule ahead of dispatching the event.
|
|
14
|
+
*
|
|
15
|
+
* `@bsuite/page-builder` never infers writability itself — it has no notion
|
|
16
|
+
* of a database. Consumers build `catalog` from a live schema source (in
|
|
17
|
+
* crm7, `report_catalog_joins` filtered to `cardinality = 'many_to_one'`
|
|
18
|
+
* and `is_active = true`, cross-checked against `pg_constraint` — see the
|
|
19
|
+
* Wave 4 implementation PR for the verification query and evidence).
|
|
20
|
+
*/
|
|
21
|
+
export declare function isRelationshipWritable(catalog: RelationshipCatalog | undefined, detail: Pick<RelationshipWidgetDetail, 'hostEntityType' | 'fkColumn' | 'targetEntityType'>): boolean;
|
|
22
|
+
//# sourceMappingURL=relationshipCatalog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relationshipCatalog.d.ts","sourceRoot":"","sources":["../src/relationshipCatalog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAEhF;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,mBAAmB,GAAG,SAAS,EACxC,MAAM,EAAE,IAAI,CAAC,wBAAwB,EAAE,gBAAgB,GAAG,UAAU,GAAG,kBAAkB,CAAC,GACzF,OAAO,CAQT"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* True only when `detail` names a relationship literally present in
|
|
3
|
+
* `catalog` — the W4-2 gate ("a relationship field may only be offered
|
|
4
|
+
* where the host record genuinely has a foreign key to write").
|
|
5
|
+
*
|
|
6
|
+
* `catalog` is undefined/empty-safe by design: no catalogue means nothing
|
|
7
|
+
* has been proven writable, so every relationship is refused (fail closed)
|
|
8
|
+
* rather than silently offering a picker that cannot save. This is the only
|
|
9
|
+
* place that decision is made — `PageGridLayout`'s add-relationship-widget
|
|
10
|
+
* handler calls this before ever creating a widget, and it is exported so
|
|
11
|
+
* consumers (e.g. a canvas "add element" palette deciding what to list) can
|
|
12
|
+
* apply the identical rule ahead of dispatching the event.
|
|
13
|
+
*
|
|
14
|
+
* `@bsuite/page-builder` never infers writability itself — it has no notion
|
|
15
|
+
* of a database. Consumers build `catalog` from a live schema source (in
|
|
16
|
+
* crm7, `report_catalog_joins` filtered to `cardinality = 'many_to_one'`
|
|
17
|
+
* and `is_active = true`, cross-checked against `pg_constraint` — see the
|
|
18
|
+
* Wave 4 implementation PR for the verification query and evidence).
|
|
19
|
+
*/
|
|
20
|
+
export function isRelationshipWritable(catalog, detail) {
|
|
21
|
+
if (!catalog || catalog.length === 0)
|
|
22
|
+
return false;
|
|
23
|
+
return catalog.some((entry) => entry.hostEntityType === detail.hostEntityType &&
|
|
24
|
+
entry.fkColumn === detail.fkColumn &&
|
|
25
|
+
entry.targetEntityType === detail.targetEntityType);
|
|
26
|
+
}
|
package/dist/types.d.ts
CHANGED
|
@@ -34,6 +34,14 @@ export interface UsePageGridLayoutOptions {
|
|
|
34
34
|
canEditPage?: boolean;
|
|
35
35
|
editorEventNames?: readonly string[];
|
|
36
36
|
preferenceAdapter?: PageGridPreferenceFactory;
|
|
37
|
+
/**
|
|
38
|
+
* Value used for `GridLayoutItem.autoHeight` on any item that does not state
|
|
39
|
+
* one. Defaults to `true` — cards grow to fit their content rather than
|
|
40
|
+
* clipping it behind an inner scrollbar (D-76). Pass `false` for a surface
|
|
41
|
+
* whose items own their own scroll (a virtualized list); an individual item
|
|
42
|
+
* can always opt out with an explicit `autoHeight: false`.
|
|
43
|
+
*/
|
|
44
|
+
defaultAutoHeight?: boolean;
|
|
37
45
|
}
|
|
38
46
|
export interface WidgetMeta {
|
|
39
47
|
label: string;
|
|
@@ -54,18 +62,104 @@ export interface EntityWidgetDetail {
|
|
|
54
62
|
export interface EntityWidgetFactoryOptions extends EntityWidgetDetail {
|
|
55
63
|
widgetId: string;
|
|
56
64
|
isEditing: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* The caller's tenant (Wave 4 / W4-3 — see {@link PageGridLayoutProps.tenantId}).
|
|
67
|
+
* Threaded through so the entity-list widget is scoped to the caller's
|
|
68
|
+
* tenant by default instead of each consumer inventing (or forgetting)
|
|
69
|
+
* its own plumbing — a platform developer and an ordinary tenant user
|
|
70
|
+
* previously saw identical `entityType`/`label` from this callback with
|
|
71
|
+
* no way to tell whose rows they were about to render.
|
|
72
|
+
*/
|
|
73
|
+
tenantId?: string | null;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* A single option a {@link RelationshipField} can offer — the row a user
|
|
77
|
+
* picks to write as the foreign key value. `id` is what gets written;
|
|
78
|
+
* `label` (and optional `secondaryLabel`) is what gets displayed.
|
|
79
|
+
*/
|
|
80
|
+
export interface RelationshipFieldOption {
|
|
81
|
+
id: string;
|
|
82
|
+
label: string;
|
|
83
|
+
secondaryLabel?: string;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Detail carried by the `crm7-add-relationship-widget` / `bsu-add-relationship-widget`
|
|
87
|
+
* events — mirrors {@link EntityWidgetDetail} for the entity-list kind.
|
|
88
|
+
* Unlike a list (which only needs an entity type to render a table), a
|
|
89
|
+
* relationship field writes a single foreign key, so it must name BOTH
|
|
90
|
+
* sides: the host record's entity type and FK column, and the entity type
|
|
91
|
+
* the FK targets.
|
|
92
|
+
*/
|
|
93
|
+
export interface RelationshipWidgetDetail {
|
|
94
|
+
/** Entity type of the record being edited — the host row the FK lives on. */
|
|
95
|
+
hostEntityType: string;
|
|
96
|
+
/** FK column on the host record this widget writes when a value is picked. */
|
|
97
|
+
fkColumn: string;
|
|
98
|
+
/** Entity type the FK points at — drives the typeahead's search. */
|
|
99
|
+
targetEntityType: string;
|
|
100
|
+
label?: string;
|
|
101
|
+
}
|
|
102
|
+
export interface RelationshipWidgetFactoryOptions extends RelationshipWidgetDetail {
|
|
103
|
+
widgetId: string;
|
|
104
|
+
isEditing: boolean;
|
|
105
|
+
/** The caller's tenant — see {@link PageGridLayoutProps.tenantId}. */
|
|
106
|
+
tenantId?: string | null;
|
|
57
107
|
}
|
|
108
|
+
/**
|
|
109
|
+
* One entry in the relationship catalogue: proof that a host entity's FK
|
|
110
|
+
* column genuinely points at a target entity, and is therefore safe to
|
|
111
|
+
* offer as a relationship field. Consumers build this array from a live
|
|
112
|
+
* schema source — in crm7, the `report_catalog_joins` table, filtered to
|
|
113
|
+
* `cardinality = 'many_to_one'` and `is_active = true` — never from
|
|
114
|
+
* inference. `@bsuite/page-builder` itself has no notion of a database and
|
|
115
|
+
* cannot verify writability on its own; see {@link isRelationshipWritable}.
|
|
116
|
+
*/
|
|
117
|
+
export interface RelationshipCatalogEntry {
|
|
118
|
+
hostEntityType: string;
|
|
119
|
+
fkColumn: string;
|
|
120
|
+
targetEntityType: string;
|
|
121
|
+
}
|
|
122
|
+
export type RelationshipCatalog = readonly RelationshipCatalogEntry[];
|
|
58
123
|
export interface PageGridLayoutProps extends UsePageGridLayoutOptions {
|
|
59
124
|
widgets: Record<string, React.ReactNode>;
|
|
60
125
|
widgetMeta?: Record<string, WidgetMeta>;
|
|
61
126
|
className?: string;
|
|
62
127
|
isResizable?: boolean;
|
|
63
128
|
resizeHandles?: readonly ResizeHandleAxis[];
|
|
129
|
+
/**
|
|
130
|
+
* The signed-in caller's tenant. Threaded into every widget-factory call
|
|
131
|
+
* (`createEntityWidget`, `createRelationshipWidget`) as `tenantId` so
|
|
132
|
+
* both widget kinds are scoped to the caller's tenant BY DEFAULT — the
|
|
133
|
+
* shared layer hands the scope down explicitly rather than leaving each
|
|
134
|
+
* consumer to invent (or omit) its own plumbing (W4-3).
|
|
135
|
+
*/
|
|
136
|
+
tenantId?: string | null;
|
|
64
137
|
addEntityWidgetEventNames?: readonly string[];
|
|
65
138
|
createEntityWidget?: (options: EntityWidgetFactoryOptions) => React.ReactNode;
|
|
66
139
|
onRegisterEntityWidget?: (options: EntityWidgetDetail & {
|
|
67
140
|
widgetId: string;
|
|
68
141
|
}) => void;
|
|
142
|
+
/**
|
|
143
|
+
* Schema facts describing which relationships are actually writable
|
|
144
|
+
* (W4-2). A relationship field is only ever added when its
|
|
145
|
+
* `{hostEntityType, fkColumn, targetEntityType}` triple appears here —
|
|
146
|
+
* consumers build this from a live catalogue, never from inference.
|
|
147
|
+
* Omitting this prop refuses every relationship field (fail closed): no
|
|
148
|
+
* catalogue means nothing has been proven writable.
|
|
149
|
+
*/
|
|
150
|
+
relationshipCatalog?: RelationshipCatalog;
|
|
151
|
+
addRelationshipWidgetEventNames?: readonly string[];
|
|
152
|
+
createRelationshipWidget?: (options: RelationshipWidgetFactoryOptions) => React.ReactNode;
|
|
153
|
+
onRegisterRelationshipWidget?: (options: RelationshipWidgetDetail & {
|
|
154
|
+
widgetId: string;
|
|
155
|
+
}) => void;
|
|
156
|
+
/**
|
|
157
|
+
* Called when an `add-relationship-widget` event names a relationship
|
|
158
|
+
* that is not present in `relationshipCatalog` — the widget is refused;
|
|
159
|
+
* this is the hook for surfacing why (e.g. a toast) without
|
|
160
|
+
* `@bsuite/page-builder` owning any UI copy.
|
|
161
|
+
*/
|
|
162
|
+
onRelationshipWidgetRejected?: (detail: RelationshipWidgetDetail) => void;
|
|
69
163
|
}
|
|
70
164
|
export interface UsePageGridLayoutResult {
|
|
71
165
|
currentLayouts: GridLayouts;
|
|
@@ -76,6 +170,14 @@ export interface UsePageGridLayoutResult {
|
|
|
76
170
|
activeCompactor: Compactor;
|
|
77
171
|
onLayoutChange: (_layout: unknown, layouts: unknown) => void;
|
|
78
172
|
handleColumnChange: (newCols: number) => void;
|
|
173
|
+
/**
|
|
174
|
+
* Wire to `<Responsive onBreakpointChange>`. The hook needs to know which
|
|
175
|
+
* breakpoint react-grid-layout is rendering so a gesture is written back to
|
|
176
|
+
* the breakpoint that owns it — see `canonicaliseLayoutForPersist`. Without
|
|
177
|
+
* this the hook assumes `lg`, and every edit made at a narrower container
|
|
178
|
+
* width lands in a derived breakpoint that is then discarded (D-75).
|
|
179
|
+
*/
|
|
180
|
+
handleBreakpointChange: (breakpoint: string) => void;
|
|
79
181
|
handleCompact: () => void;
|
|
80
182
|
handleReset: () => void;
|
|
81
183
|
addWidget: (widgetKey: string, initialSize?: Partial<Pick<GridLayoutItem, 'w' | 'h' | 'minW' | 'minH'>>) => void;
|
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;CACtB;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,cAAc,EAAE,CAAC;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,EAAE,CAAC;CACjC;AAED,MAAM,WAAW,yBAAyB,CAAC,CAAC;IAC1C,KAAK,EAAE,CAAC,CAAC;IACT,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,IAAI,CAAC;IACpD,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,EACxC,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,CAAC,KACR,yBAAyB,CAAC,CAAC,CAAC,CAAC;AAElC,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,WAAW,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,iBAAiB,CAAC,EAAE,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","s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AM,CAAC;CACxB"}
|
|
@@ -10,9 +10,30 @@ export declare const DEFAULT_EDITOR_EVENT_NAMES: readonly ["bsuite-open-page-edi
|
|
|
10
10
|
* launchers scope by page if they handle multiple grids on one screen.
|
|
11
11
|
*/
|
|
12
12
|
export declare const PAGE_GRID_EDITING_EVENT = "bsuite-page-grid-editing";
|
|
13
|
+
/**
|
|
14
|
+
* Package-wide layout epoch, added to EVERY consumer's `layoutVersion`.
|
|
15
|
+
*
|
|
16
|
+
* When a default that governs all grids changes, a saved layout produced under
|
|
17
|
+
* the old default has to be invalidated — and there is no way to reach ~330
|
|
18
|
+
* call sites across six apps to hand-bump each one. crm7's `DraggableCardPage`
|
|
19
|
+
* already solved this locally with its own `LAYOUT_EPOCH`; this is the same
|
|
20
|
+
* lever one level down, so it also covers the raw `PageGridLayout` consumers
|
|
21
|
+
* (Dashboard, Billing, GTO, Analytics, the throughput and braden pages) that
|
|
22
|
+
* no app-level epoch can see.
|
|
23
|
+
*
|
|
24
|
+
* 0 -> 1000 (2026-08-13, D-75/D-76): two all-grids defaults changed in the same
|
|
25
|
+
* release — `autoHeight` now defaults to true for raw consumers, and md/sm no
|
|
26
|
+
* longer collapse to a full-width stack. Every stored layout predates both and
|
|
27
|
+
* was additionally polluted with frozen derived breakpoints, so all of them
|
|
28
|
+
* reset once to the corrected defaults.
|
|
29
|
+
*
|
|
30
|
+
* Per-page `layoutVersion` bumps keep working on top; this only moves the
|
|
31
|
+
* floor.
|
|
32
|
+
*/
|
|
33
|
+
export declare const PACKAGE_LAYOUT_EPOCH = 1000;
|
|
13
34
|
export interface PageGridEditingEventDetail {
|
|
14
35
|
pageKey: string;
|
|
15
36
|
editing: boolean;
|
|
16
37
|
}
|
|
17
|
-
export declare function usePageGridLayout({ pageKey, defaultLayouts, defaultCols, layoutVersion, canEditPage, editorEventNames, preferenceAdapter, }: UsePageGridLayoutOptions): UsePageGridLayoutResult;
|
|
38
|
+
export declare function usePageGridLayout({ pageKey, defaultLayouts, defaultCols, layoutVersion, canEditPage, editorEventNames, preferenceAdapter, defaultAutoHeight, }: UsePageGridLayoutOptions): UsePageGridLayoutResult;
|
|
18
39
|
//# sourceMappingURL=usePageGridLayout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePageGridLayout.d.ts","sourceRoot":"","sources":["../src/usePageGridLayout.ts"],"names":[],"mappings":"
|
|
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,CAkmBpD"}
|