@etsoo/react 1.4.16 → 1.4.17

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.
@@ -1,11 +1,12 @@
1
+ import { Utils } from '@etsoo/shared';
1
2
  import React from 'react';
2
3
  import { FixedSizeList, VariableSizeList } from 'react-window';
3
4
  import useCombinedRefs from '../uses/useCombinedRefs';
4
5
  import { GridSizeGet } from './GridLoader';
5
6
  // Calculate loadBatchSize
6
7
  const calculateBatchSize = (height, itemSize) => {
7
- return (2 +
8
- Math.ceil(height / (typeof itemSize === 'function' ? itemSize(0) : itemSize)));
8
+ const size = Utils.getResult(itemSize, 0);
9
+ return 2 + Math.ceil(height / size);
9
10
  };
10
11
  /**
11
12
  * Scroller vertical list
@@ -71,6 +71,9 @@ export function ResponsibleContainer(props) {
71
71
  return;
72
72
  refs.current.ref.reset({ data });
73
73
  };
74
+ React.useEffect(() => {
75
+ console.log('useEffect', rect, refs.current.ref, showDataGrid);
76
+ }, []);
74
77
  // Layout
75
78
  return (React.createElement(Stack, null,
76
79
  hasFields && (React.createElement(Box, { ref: dimensions[0][0], sx: searchBoxSx },
@@ -7,7 +7,7 @@ export interface TabBoxPanel extends Omit<TabProps, 'value' | 'children'> {
7
7
  /**
8
8
  * Children
9
9
  */
10
- children?: React.ReactNode;
10
+ children?: ((visible: boolean) => React.ReactNode) | React.ReactNode;
11
11
  /**
12
12
  * Panel box props
13
13
  */
package/lib/mu/TabBox.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { Utils } from '@etsoo/shared';
1
2
  import { Box, Tab, Tabs } from '@mui/material';
2
3
  import React from 'react';
3
4
  /**
@@ -20,5 +21,5 @@ export function TabBox(props) {
20
21
  if (onChange)
21
22
  onChange(event, newValue);
22
23
  }, ...rest }, tabs.map(({ children, panel, ...tabRest }, index) => (React.createElement(Tab, { key: index, value: index, ...tabRest }))))),
23
- tabs.map(({ children, panel }, index) => (React.createElement(Box, { key: index, hidden: value !== index, ...panel }, children)))));
24
+ tabs.map(({ children, panel }, index) => (React.createElement(Box, { key: index, hidden: value !== index, ...panel }, Utils.getResult(children, value === index))))));
24
25
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/react",
3
- "version": "1.4.16",
3
+ "version": "1.4.17",
4
4
  "description": "TypeScript ReactJs framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -50,9 +50,9 @@
50
50
  "@emotion/react": "^11.7.1",
51
51
  "@emotion/style": "^0.8.0",
52
52
  "@emotion/styled": "^11.6.0",
53
- "@etsoo/appscript": "^1.2.20",
53
+ "@etsoo/appscript": "^1.2.21",
54
54
  "@etsoo/notificationbase": "^1.1.0",
55
- "@etsoo/shared": "^1.1.0",
55
+ "@etsoo/shared": "^1.1.3",
56
56
  "@mui/icons-material": "^5.2.5",
57
57
  "@mui/material": "^5.2.7",
58
58
  "@reach/router": "^1.3.4",
@@ -1,3 +1,4 @@
1
+ import { Utils } from '@etsoo/shared';
1
2
  import React from 'react';
2
3
  import {
3
4
  Align,
@@ -88,12 +89,8 @@ const calculateBatchSize = (
88
89
  height: number,
89
90
  itemSize: ((index: number) => number) | number
90
91
  ) => {
91
- return (
92
- 2 +
93
- Math.ceil(
94
- height / (typeof itemSize === 'function' ? itemSize(0) : itemSize)
95
- )
96
- );
92
+ const size = Utils.getResult(itemSize, 0);
93
+ return 2 + Math.ceil(height / size);
97
94
  };
98
95
 
99
96
  /**
@@ -227,6 +227,10 @@ export function ResponsibleContainer<
227
227
  refs.current.ref.reset({ data });
228
228
  };
229
229
 
230
+ React.useEffect(() => {
231
+ console.log('useEffect', rect, refs.current.ref, showDataGrid);
232
+ }, []);
233
+
230
234
  // Layout
231
235
  return (
232
236
  <Stack>
package/src/mu/TabBox.tsx CHANGED
@@ -1,3 +1,4 @@
1
+ import { Utils } from '@etsoo/shared';
1
2
  import { Box, BoxProps, Tab, TabProps, Tabs, TabsProps } from '@mui/material';
2
3
  import React from 'react';
3
4
 
@@ -8,7 +9,7 @@ export interface TabBoxPanel extends Omit<TabProps, 'value' | 'children'> {
8
9
  /**
9
10
  * Children
10
11
  */
11
- children?: React.ReactNode;
12
+ children?: ((visible: boolean) => React.ReactNode) | React.ReactNode;
12
13
 
13
14
  /**
14
15
  * Panel box props
@@ -76,7 +77,7 @@ export function TabBox(props: TabBoxPros) {
76
77
  </Box>
77
78
  {tabs.map(({ children, panel }, index) => (
78
79
  <Box key={index} hidden={value !== index} {...panel}>
79
- {children}
80
+ {Utils.getResult(children, value === index)}
80
81
  </Box>
81
82
  ))}
82
83
  </React.Fragment>