datastake-daf 0.6.322 → 0.6.324

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.
@@ -12734,13 +12734,12 @@ const useHeader = _ref => {
12734
12734
  const actionButtons = onDownload && _actionButtons.length < 3 ? [..._actionButtons, ...(hasFilters ? filterButton : []), downloadButton] : [..._actionButtons, ...(hasFilters ? filterButton : [])];
12735
12735
  const extraButtons = onDownload && _actionButtons.length >= 3 ? [..._extraButtons, downloadButtonAction] : [..._extraButtons];
12736
12736
  const mainCont = React.useRef();
12737
- React.useRef();
12738
12737
  const buttonCont = React.useRef();
12739
12738
  const [mainContWidth, setMainContWidth] = React.useState(600);
12740
12739
  const [buttonContWidth, setButtonContWidth] = React.useState(0);
12741
12740
  const hasSupportText = !!(supportText !== null && supportText !== void 0 && supportText.length);
12742
12741
  const hasTags = !!(tags !== null && tags !== void 0 && tags.length);
12743
- const hasButtons = !!(actionButtons !== null && actionButtons !== void 0 && actionButtons.length || extraButtons !== null && extraButtons !== void 0 && extraButtons.length);
12742
+ const hasButtons = React.useMemo(() => !!(actionButtons !== null && actionButtons !== void 0 && actionButtons.length || extraButtons !== null && extraButtons !== void 0 && extraButtons.length), [actionButtons, extraButtons]);
12744
12743
  React.useEffect(() => {
12745
12744
  const mainContObserver = new ResizeObserver(entries => {
12746
12745
  const _mainEntry = entries[0];
@@ -12761,6 +12760,7 @@ const useHeader = _ref => {
12761
12760
  });
12762
12761
  }
12763
12762
  if (hasButtons) {
12763
+ console.log("button observer before", buttonCont.current);
12764
12764
  buttonContObserver.observe(buttonCont.current);
12765
12765
  }
12766
12766
  return () => {
@@ -12770,8 +12770,12 @@ const useHeader = _ref => {
12770
12770
  }
12771
12771
  };
12772
12772
  }, []);
12773
- const maxWidth = React.useMemo(() => mainContWidth - buttonContWidth - 24, [mainContWidth, buttonContWidth]);
12774
- console.log(buttonContWidth, mainContWidth, maxWidth);
12773
+ const maxWidth = React.useMemo(() => mainContWidth - buttonContWidth, [mainContWidth, buttonContWidth]);
12774
+ console.log({
12775
+ buttonContWidth,
12776
+ mainContWidth,
12777
+ maxWidth
12778
+ });
12775
12779
  const renderMainCont = () => /*#__PURE__*/jsxRuntime.jsxs("div", {
12776
12780
  children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
12777
12781
  className: formatClassname(["main-cont flex", className]),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datastake-daf",
3
- "version": "0.6.322",
3
+ "version": "0.6.324",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^5.2.5",
6
6
  "@antv/g2": "^5.1.1",
@@ -101,13 +101,15 @@ export const useHeader = ({
101
101
  : [..._extraButtons];
102
102
 
103
103
  const mainCont = useRef();
104
- const addedHeaderCont = useRef();
105
104
  const buttonCont = useRef();
106
105
  const [mainContWidth, setMainContWidth] = useState(600);
107
106
  const [buttonContWidth, setButtonContWidth] = useState(0);
108
107
  const hasSupportText = !!supportText?.length;
109
108
  const hasTags = !!tags?.length;
110
- const hasButtons = !!(actionButtons?.length || extraButtons?.length);
109
+ const hasButtons = useMemo(
110
+ () => !!(actionButtons?.length || extraButtons?.length),
111
+ [actionButtons, extraButtons],
112
+ );
111
113
 
112
114
  useEffect(() => {
113
115
  const mainContObserver = new ResizeObserver((entries) => {
@@ -120,6 +122,8 @@ export const useHeader = ({
120
122
  });
121
123
 
122
124
  mainContObserver.observe(mainCont.current);
125
+
126
+
123
127
  let buttonContObserver;
124
128
 
125
129
  if (hasButtons) {
@@ -134,6 +138,7 @@ export const useHeader = ({
134
138
  }
135
139
 
136
140
  if (hasButtons) {
141
+ console.log("button observer before", buttonCont.current);
137
142
  buttonContObserver.observe(buttonCont.current);
138
143
  }
139
144
 
@@ -146,11 +151,11 @@ export const useHeader = ({
146
151
  }, []);
147
152
 
148
153
  const maxWidth = useMemo(
149
- () => mainContWidth - buttonContWidth - 24,
154
+ () => mainContWidth - buttonContWidth ,
150
155
  [mainContWidth, buttonContWidth],
151
156
  );
152
157
 
153
- console.log(buttonContWidth, mainContWidth, maxWidth);
158
+ console.log({ buttonContWidth, mainContWidth, maxWidth });
154
159
 
155
160
  const renderMainCont = () => (
156
161
  <div>