@etsoo/react 1.1.83 → 1.1.84

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.
@@ -11,6 +11,11 @@ export interface SearchBarProps {
11
11
  * Fields
12
12
  */
13
13
  fields: React.ReactElement[];
14
+ /**
15
+ * Inner height
16
+ * @default 40
17
+ */
18
+ innerHeight?: number;
14
19
  /**
15
20
  * On submit callback
16
21
  */
@@ -53,7 +53,7 @@ const setChildState = (child, enabled) => {
53
53
  */
54
54
  export function SearchBar(props) {
55
55
  // Destruct
56
- const { className, fields, onSubmit } = props;
56
+ const { className, fields, innerHeight = 40, onSubmit } = props;
57
57
  // Labels
58
58
  const labels = Labels.CommonPage;
59
59
  // Spacing
@@ -235,7 +235,7 @@ export function SearchBar(props) {
235
235
  if (form)
236
236
  forms.form = form;
237
237
  } },
238
- React.createElement(Stack, { ref: dimensions[0][0], justifyContent: "center", alignItems: "center", direction: "row", spacing: 1, sx: {
238
+ React.createElement(Stack, { ref: dimensions[0][0], justifyContent: "center", alignItems: "center", direction: "row", spacing: 1, height: innerHeight, sx: {
239
239
  '& > :not(style)': {
240
240
  flexBasis: 'auto',
241
241
  flexGrow: 0,
@@ -15,7 +15,7 @@ import { CommonPage } from './CommonPage';
15
15
  export function DataGridPage(props) {
16
16
  var _a, _b;
17
17
  // Destruct
18
- const { adjustHeight, fields, height, loadData, mRef, pageProps = {}, ...rest } = props;
18
+ const { adjustHeight, fields, height, loadData, mRef, sizeReadyMiliseconds = 100, pageProps = {}, ...rest } = props;
19
19
  (_a = pageProps.paddings) !== null && _a !== void 0 ? _a : (pageProps.paddings = MUGlobal.pagePaddings);
20
20
  // States
21
21
  const [states, setStates] = React.useReducer((currentState, newState) => {
@@ -38,7 +38,7 @@ export function DataGridPage(props) {
38
38
  return loadData({ ...json, ...rest });
39
39
  };
40
40
  // Watch container
41
- const { dimensions } = useDimensions(1, undefined, 50);
41
+ const { dimensions } = useDimensions(1, undefined, sizeReadyMiliseconds);
42
42
  const rect = dimensions[0][2];
43
43
  React.useEffect(() => {
44
44
  if (rect != null && rect.height > 50 && height == null) {
@@ -15,7 +15,7 @@ import { CommonPage } from './CommonPage';
15
15
  export function FixedListPage(props) {
16
16
  var _a;
17
17
  // Destruct
18
- const { adjustHeight, fields, loadData, mRef, pageProps = {}, ...rest } = props;
18
+ const { adjustHeight, fields, loadData, mRef, sizeReadyMiliseconds = 100, pageProps = {}, ...rest } = props;
19
19
  (_a = pageProps.paddings) !== null && _a !== void 0 ? _a : (pageProps.paddings = MUGlobal.pagePaddings);
20
20
  // States
21
21
  const [states] = React.useState({});
@@ -44,7 +44,7 @@ export function FixedListPage(props) {
44
44
  return loadData({ ...json, ...rest });
45
45
  };
46
46
  // Watch container
47
- const { dimensions } = useDimensions(1, undefined, 100);
47
+ const { dimensions } = useDimensions(1, undefined, sizeReadyMiliseconds);
48
48
  const rect = dimensions[0][2];
49
49
  const list = React.useMemo(() => {
50
50
  if (rect != null && rect.height > 50) {
@@ -16,7 +16,7 @@ import { CommonPage } from './CommonPage';
16
16
  export function ResponsivePage(props) {
17
17
  var _a, _b;
18
18
  // Destruct
19
- const { adjustHeight, columns, dataGridMinWidth = DataGridExCalColumns(columns).total, fields, height, loadData, innerItemRenderer, itemSize, mRef, pageProps = {}, ...rest } = props;
19
+ const { adjustHeight, columns, dataGridMinWidth = DataGridExCalColumns(columns).total, fields, height, loadData, innerItemRenderer, itemSize, mRef, sizeReadyMiliseconds = 100, pageProps = {}, ...rest } = props;
20
20
  (_a = pageProps.paddings) !== null && _a !== void 0 ? _a : (pageProps.paddings = MUGlobal.pagePaddings);
21
21
  // States
22
22
  const [states, setStates] = React.useReducer((currentState, newState) => {
@@ -39,7 +39,7 @@ export function ResponsivePage(props) {
39
39
  setStates({ data });
40
40
  };
41
41
  // Watch container
42
- const { dimensions } = useDimensions(1, undefined, 50);
42
+ const { dimensions } = useDimensions(1, undefined, sizeReadyMiliseconds);
43
43
  const rect = dimensions[0][2];
44
44
  const showDataGrid = ((_b = rect === null || rect === void 0 ? void 0 : rect.width) !== null && _b !== void 0 ? _b : 0) >= dataGridMinWidth;
45
45
  React.useEffect(() => {
@@ -17,4 +17,9 @@ export interface SearchPageProps<T> extends Omit<GridLoader<T>, 'loadData'> {
17
17
  * Page props
18
18
  */
19
19
  pageProps?: CommonPageProps;
20
+ /**
21
+ * Size ready to read miliseconds span
22
+ * @default 100
23
+ */
24
+ sizeReadyMiliseconds?: number;
20
25
  }
@@ -15,7 +15,7 @@ import { CommonPage, CommonPagePullContainer, CommonPageScrollContainer } from '
15
15
  export function TablePage(props) {
16
16
  var _a;
17
17
  // Destruct
18
- const { columns, fields, loadData, mRef, pageProps = {}, ...rest } = props;
18
+ const { columns, fields, loadData, mRef, sizeReadyMiliseconds = 100, pageProps = {}, ...rest } = props;
19
19
  (_a = pageProps.paddings) !== null && _a !== void 0 ? _a : (pageProps.paddings = MUGlobal.pagePaddings);
20
20
  // States
21
21
  const [states] = React.useState({});
@@ -47,7 +47,7 @@ export function TablePage(props) {
47
47
  return previousValue + ((_a = width !== null && width !== void 0 ? width : minWidth) !== null && _a !== void 0 ? _a : TableExMinWidth);
48
48
  }, 0), [columns]);
49
49
  // Watch container
50
- const { dimensions } = useDimensions(1, undefined, 100);
50
+ const { dimensions } = useDimensions(1, undefined, sizeReadyMiliseconds);
51
51
  const rect = dimensions[0][2];
52
52
  const list = React.useMemo(() => {
53
53
  if (rect != null && rect.height > 50 && rect.width >= totalWidth) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/react",
3
- "version": "1.1.83",
3
+ "version": "1.1.84",
4
4
  "description": "TypeScript ReactJs framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -20,6 +20,12 @@ export interface SearchBarProps {
20
20
  */
21
21
  fields: React.ReactElement[];
22
22
 
23
+ /**
24
+ * Inner height
25
+ * @default 40
26
+ */
27
+ innerHeight?: number;
28
+
23
29
  /**
24
30
  * On submit callback
25
31
  */
@@ -78,7 +84,7 @@ const setChildState = (child: Element, enabled: boolean) => {
78
84
  */
79
85
  export function SearchBar(props: SearchBarProps) {
80
86
  // Destruct
81
- const { className, fields, onSubmit } = props;
87
+ const { className, fields, innerHeight = 40, onSubmit } = props;
82
88
 
83
89
  // Labels
84
90
  const labels = Labels.CommonPage;
@@ -316,6 +322,7 @@ export function SearchBar(props: SearchBarProps) {
316
322
  alignItems="center"
317
323
  direction="row"
318
324
  spacing={1}
325
+ height={innerHeight}
319
326
  sx={{
320
327
  '& > :not(style)': {
321
328
  flexBasis: 'auto',
@@ -30,6 +30,7 @@ export function DataGridPage<T>(props: DataGridPageProps<T>) {
30
30
  height,
31
31
  loadData,
32
32
  mRef,
33
+ sizeReadyMiliseconds = 100,
33
34
  pageProps = {},
34
35
  ...rest
35
36
  } = props;
@@ -63,7 +64,7 @@ export function DataGridPage<T>(props: DataGridPageProps<T>) {
63
64
  };
64
65
 
65
66
  // Watch container
66
- const { dimensions } = useDimensions(1, undefined, 50);
67
+ const { dimensions } = useDimensions(1, undefined, sizeReadyMiliseconds);
67
68
  const rect = dimensions[0][2];
68
69
 
69
70
  React.useEffect(() => {
@@ -30,6 +30,7 @@ export function FixedListPage<T>(
30
30
  fields,
31
31
  loadData,
32
32
  mRef,
33
+ sizeReadyMiliseconds = 100,
33
34
  pageProps = {},
34
35
  ...rest
35
36
  } = props;
@@ -74,7 +75,7 @@ export function FixedListPage<T>(
74
75
  };
75
76
 
76
77
  // Watch container
77
- const { dimensions } = useDimensions(1, undefined, 100);
78
+ const { dimensions } = useDimensions(1, undefined, sizeReadyMiliseconds);
78
79
  const rect = dimensions[0][2];
79
80
  const list = React.useMemo(() => {
80
81
  if (rect != null && rect.height > 50) {
@@ -35,6 +35,7 @@ export function ResponsivePage<T>(props: ResponsePageProps<T>) {
35
35
  innerItemRenderer,
36
36
  itemSize,
37
37
  mRef,
38
+ sizeReadyMiliseconds = 100,
38
39
  pageProps = {},
39
40
  ...rest
40
41
  } = props;
@@ -68,7 +69,7 @@ export function ResponsivePage<T>(props: ResponsePageProps<T>) {
68
69
  };
69
70
 
70
71
  // Watch container
71
- const { dimensions } = useDimensions(1, undefined, 50);
72
+ const { dimensions } = useDimensions(1, undefined, sizeReadyMiliseconds);
72
73
  const rect = dimensions[0][2];
73
74
  const showDataGrid = (rect?.width ?? 0) >= dataGridMinWidth;
74
75
 
@@ -19,4 +19,10 @@ export interface SearchPageProps<T> extends Omit<GridLoader<T>, 'loadData'> {
19
19
  * Page props
20
20
  */
21
21
  pageProps?: CommonPageProps;
22
+
23
+ /**
24
+ * Size ready to read miliseconds span
25
+ * @default 100
26
+ */
27
+ sizeReadyMiliseconds?: number;
22
28
  }
@@ -20,7 +20,15 @@ import { TablePageProps } from './TablePageProps';
20
20
  */
21
21
  export function TablePage<T>(props: TablePageProps<T>) {
22
22
  // Destruct
23
- const { columns, fields, loadData, mRef, pageProps = {}, ...rest } = props;
23
+ const {
24
+ columns,
25
+ fields,
26
+ loadData,
27
+ mRef,
28
+ sizeReadyMiliseconds = 100,
29
+ pageProps = {},
30
+ ...rest
31
+ } = props;
24
32
 
25
33
  pageProps.paddings ??= MUGlobal.pagePaddings;
26
34
 
@@ -66,7 +74,7 @@ export function TablePage<T>(props: TablePageProps<T>) {
66
74
  );
67
75
 
68
76
  // Watch container
69
- const { dimensions } = useDimensions(1, undefined, 100);
77
+ const { dimensions } = useDimensions(1, undefined, sizeReadyMiliseconds);
70
78
  const rect = dimensions[0][2];
71
79
  const list = React.useMemo(() => {
72
80
  if (rect != null && rect.height > 50 && rect.width >= totalWidth) {