@aptre/flex-layout 0.1.3 → 0.1.5

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.
Files changed (2) hide show
  1. package/dist/index.mjs +31 -21
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -3153,15 +3153,17 @@ var BorderButton = (props) => {
3153
3153
  });
3154
3154
  const updateRect = () => {
3155
3155
  const layoutRect = layout.getDomRect();
3156
- const r = selfRef.current.getBoundingClientRect();
3157
- node._setTabRect(
3158
- new Rect(
3159
- r.left - layoutRect.left,
3160
- r.top - layoutRect.top,
3161
- r.width,
3162
- r.height
3163
- )
3164
- );
3156
+ const r = selfRef.current?.getBoundingClientRect();
3157
+ if (r && layoutRect) {
3158
+ node._setTabRect(
3159
+ new Rect(
3160
+ r.left - layoutRect.left,
3161
+ r.top - layoutRect.top,
3162
+ r.width,
3163
+ r.height
3164
+ )
3165
+ );
3166
+ }
3165
3167
  };
3166
3168
  const onTextBoxMouseDown = (event) => {
3167
3169
  event.stopPropagation();
@@ -3399,13 +3401,16 @@ var useTabOverflow = (node, orientation, toolbarRef, stickyButtonsRef) => {
3399
3401
  React5.useLayoutEffect(() => {
3400
3402
  updateVisibleTabs();
3401
3403
  });
3404
+ const instance = selfRef.current;
3402
3405
  React5.useEffect(() => {
3403
- const instance = selfRef.current;
3406
+ if (!instance) {
3407
+ return;
3408
+ }
3404
3409
  instance.addEventListener("wheel", onWheel, { passive: false });
3405
3410
  return () => {
3406
3411
  instance.removeEventListener("wheel", onWheel);
3407
3412
  };
3408
- }, []);
3413
+ }, [instance]);
3409
3414
  const onWheel = (event) => {
3410
3415
  event.preventDefault();
3411
3416
  };
@@ -3832,6 +3837,9 @@ var Splitter = (props) => {
3832
3837
  };
3833
3838
  const onDragMove = (event) => {
3834
3839
  const clientRect = layout.getDomRect();
3840
+ if (!clientRect) {
3841
+ return;
3842
+ }
3835
3843
  const pos = {
3836
3844
  x: event.clientX - clientRect.left,
3837
3845
  y: event.clientY - clientRect.top
@@ -4110,15 +4118,17 @@ var TabButton = (props) => {
4110
4118
  });
4111
4119
  const updateRect = () => {
4112
4120
  const layoutRect = layout.getDomRect();
4113
- const r = selfRef.current.getBoundingClientRect();
4114
- node._setTabRect(
4115
- new Rect(
4116
- r.left - layoutRect.left,
4117
- r.top - layoutRect.top,
4118
- r.width,
4119
- r.height
4120
- )
4121
- );
4121
+ const r = selfRef.current?.getBoundingClientRect();
4122
+ if (r && layoutRect) {
4123
+ node._setTabRect(
4124
+ new Rect(
4125
+ r.left - layoutRect.left,
4126
+ r.top - layoutRect.top,
4127
+ r.width,
4128
+ r.height
4129
+ )
4130
+ );
4131
+ }
4122
4132
  };
4123
4133
  const onTextBoxMouseDown = (event) => {
4124
4134
  event.stopPropagation();
@@ -5838,7 +5848,7 @@ var Layout = class extends React16.Component {
5838
5848
  /** @internal */
5839
5849
  _getScreenRect(node) {
5840
5850
  const rect = node.getRect().clone();
5841
- const bodyRect = this.selfRef.current.getBoundingClientRect();
5851
+ const bodyRect = this.selfRef.current?.getBoundingClientRect();
5842
5852
  if (!bodyRect) {
5843
5853
  return null;
5844
5854
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@aptre/flex-layout",
3
3
  "author": "Caplin Systems Ltd",
4
4
  "description": "A multi-tab docking layout manager",
5
- "version": "0.1.3",
5
+ "version": "0.1.5",
6
6
  "license": "ISC",
7
7
  "repository": {
8
8
  "type": "git",