@bsuite/page-builder 2.7.1-next.0 → 2.7.1-next.2
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/README.md
CHANGED
|
@@ -51,6 +51,13 @@ When adding `autoHeight` to an existing page's layout, bump that page's
|
|
|
51
51
|
|
|
52
52
|
## Edit-mode chrome (2.7.1-next.0+)
|
|
53
53
|
|
|
54
|
+
`PAGE_GRID_EDITING_EVENT` reports committed changes from `2.7.1-next.1`.
|
|
55
|
+
Its `{ pageKey, editing }` payload and event name are unchanged. The matching
|
|
56
|
+
canvas DOM is updated before listeners run, including when Save & Exit uses
|
|
57
|
+
a React transition. Initial mounting, unchanged state and abandoned transitions
|
|
58
|
+
do not emit notifications. Consumers must match the page key and preserve
|
|
59
|
+
focus on surviving inputs when synchronizing their header controls.
|
|
60
|
+
|
|
54
61
|
While the canvas editor is open, each grid item renders an in-flow strip
|
|
55
62
|
(`[data-slot="grid-item-editor-chrome"]`) above the card content: the widget
|
|
56
63
|
name and a Hide control. The strip is **not** absolutely positioned over the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageGridLayout.d.ts","sourceRoot":"","sources":["../src/PageGridLayout.tsx"],"names":[],"mappings":"AAEA,OAAO,KAQN,MAAM,OAAO,CAAC;AAGf,OAAO,kCAAkC,CAAC;AAC1C,OAAO,gCAAgC,CAAC;AAsBxC,OAAO,KAAK,EAAe,mBAAmB,EAA4B,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"PageGridLayout.d.ts","sourceRoot":"","sources":["../src/PageGridLayout.tsx"],"names":[],"mappings":"AAEA,OAAO,KAQN,MAAM,OAAO,CAAC;AAGf,OAAO,kCAAkC,CAAC;AAC1C,OAAO,gCAAgC,CAAC;AAsBxC,OAAO,KAAK,EAAe,mBAAmB,EAA4B,MAAM,YAAY,CAAC;AA4pB7F,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,gBAAgB,EAKhB,UAAkB,EAClB,yBAAiE,EACjE,kBAAkB,EAClB,sBAAsB,EACtB,mBAAmB,EACnB,+BAA6E,EAC7E,wBAAwB,EACxB,4BAA4B,EAC5B,4BAA4B,GAC7B,EAAE,mBAAmB,qBAu+BrB"}
|
package/dist/PageGridLayout.js
CHANGED
|
@@ -358,13 +358,14 @@ const GridItem = React.memo(React.forwardRef(function GridItem({ id, content, is
|
|
|
358
358
|
* `cardStyleVars` carries ONLY the properties the operator changed
|
|
359
359
|
* (see cardStyle.ts). An untouched page spreads an empty object, so
|
|
360
360
|
* this attribute is identical to what it was before the card editor
|
|
361
|
-
* existed.
|
|
362
|
-
*
|
|
361
|
+
* existed. A chrome-owning surface applies `boxShadow` directly
|
|
362
|
+
* to beat its default class. Layout-only wrappers pass the token
|
|
363
|
+
* to the painted consumer without drawing a second shadow.
|
|
363
364
|
*/
|
|
364
365
|
style: {
|
|
365
366
|
contain: 'layout style',
|
|
366
367
|
...cardStyleVars,
|
|
367
|
-
...(cardStyleVars && '--card-shadow' in cardStyleVars
|
|
368
|
+
...(chrome && cardStyleVars && '--card-shadow' in cardStyleVars
|
|
368
369
|
? { boxShadow: cardStyleVars['--card-shadow'] }
|
|
369
370
|
: null),
|
|
370
371
|
...(cardStyleVars && '--card-padding' in cardStyleVars
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import type { GridLayouts, LayoutMigration, UsePageGridLayoutOptions, UsePageGridLayoutResult } from './types.js';
|
|
2
2
|
export declare const DEFAULT_EDITOR_EVENT_NAMES: readonly ["bsuite-open-page-editor", "bsu-open-page-editor", "crm7-open-page-editor", "conduit-open-page-editor", "r80-open-page-editor"];
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* "Edit Page" button sits in the corner while the editor banner is visible
|
|
9
|
-
* at the top. `detail.editing` is the new state; `detail.pageKey` lets
|
|
10
|
-
* launchers scope by page if they handle multiple grids on one screen.
|
|
4
|
+
* Broadcast after a PageGridLayout commits an editing-state change. Header
|
|
5
|
+
* launchers use this to synchronize their label and restore keyboard focus
|
|
6
|
+
* after canvas controls disappear. Initial state and abandoned transitions do
|
|
7
|
+
* not publish an event. `detail.pageKey` identifies the changed canvas.
|
|
11
8
|
*/
|
|
12
9
|
export declare const PAGE_GRID_EDITING_EVENT = "bsuite-page-grid-editing";
|
|
13
10
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePageGridLayout.d.ts","sourceRoot":"","sources":["../src/usePageGridLayout.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAEV,WAAW,EACX,eAAe,EACf,wBAAwB,EACxB,uBAAuB,EACxB,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,0BAA0B,2IAM7B,CAAC;AAEX
|
|
1
|
+
{"version":3,"file":"usePageGridLayout.d.ts","sourceRoot":"","sources":["../src/usePageGridLayout.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAEV,WAAW,EACX,eAAe,EACf,wBAAwB,EACxB,uBAAuB,EACxB,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,0BAA0B,2IAM7B,CAAC;AAEX;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,6BAA6B,CAAC;AAElE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,oBAAoB,OAAO,CAAC;AAiBzC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,EAAE,EACF,UAAU,GACX,EAAE;IACD,KAAK,EAAE,WAAW,GAAG,SAAS,CAAC;IAC/B,QAAQ,EAAE,WAAW,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,WAAW,CAAC,MAAM,EAAE,eAAe,CAAC,GAAG,IAAI,CAAC;CACzD,GAAG,WAAW,GAAG,IAAI,CA+BrB;AAED,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,EACjB,gBAAgB,GACjB,EAAE,wBAAwB,GAAG,uBAAuB,CAuyBpD"}
|
|
@@ -11,13 +11,10 @@ export const DEFAULT_EDITOR_EVENT_NAMES = [
|
|
|
11
11
|
'r80-open-page-editor',
|
|
12
12
|
];
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* "Edit Page" button sits in the corner while the editor banner is visible
|
|
19
|
-
* at the top. `detail.editing` is the new state; `detail.pageKey` lets
|
|
20
|
-
* launchers scope by page if they handle multiple grids on one screen.
|
|
14
|
+
* Broadcast after a PageGridLayout commits an editing-state change. Header
|
|
15
|
+
* launchers use this to synchronize their label and restore keyboard focus
|
|
16
|
+
* after canvas controls disappear. Initial state and abandoned transitions do
|
|
17
|
+
* not publish an event. `detail.pageKey` identifies the changed canvas.
|
|
21
18
|
*/
|
|
22
19
|
export const PAGE_GRID_EDITING_EVENT = 'bsuite-page-grid-editing';
|
|
23
20
|
/**
|
|
@@ -124,19 +121,16 @@ export function usePageGridLayout({ pageKey, defaultLayouts, defaultCols = 12, l
|
|
|
124
121
|
const effectiveLayoutVersion = layoutVersion + PACKAGE_LAYOUT_EPOCH;
|
|
125
122
|
const containerRef = useRef(null);
|
|
126
123
|
const [containerWidth, setContainerWidth] = useState(0);
|
|
127
|
-
const [isEditing,
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
return resolved;
|
|
138
|
-
});
|
|
139
|
-
}, [pageKey]);
|
|
124
|
+
const [isEditing, setIsEditing] = useState(false);
|
|
125
|
+
const publishedEditing = useRef(false);
|
|
126
|
+
useEffect(() => {
|
|
127
|
+
if (publishedEditing.current === isEditing)
|
|
128
|
+
return;
|
|
129
|
+
publishedEditing.current = isEditing;
|
|
130
|
+
window.dispatchEvent(new CustomEvent(PAGE_GRID_EDITING_EVENT, {
|
|
131
|
+
detail: { pageKey, editing: isEditing },
|
|
132
|
+
}));
|
|
133
|
+
}, [isEditing, pageKey]);
|
|
140
134
|
const [resetConfirmOpen, setResetConfirmOpen] = useState(false);
|
|
141
135
|
useLayoutEffect(() => {
|
|
142
136
|
const el = containerRef.current;
|