@etsoo/react 1.4.33 → 1.4.34

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.
@@ -23,7 +23,7 @@ export interface ResponsibleContainerProps<T extends {}, F extends DataTypes.Bas
23
23
  /**
24
24
  * Container box SX (dataGrid determines the case)
25
25
  */
26
- containerBoxSx?: (dataGrid?: boolean) => SxProps<Theme>;
26
+ containerBoxSx?: (paddings: {}, dataGrid?: boolean) => SxProps<Theme>;
27
27
  /**
28
28
  * Min width to show Datagrid
29
29
  */
@@ -9,13 +9,12 @@ import { MUGlobal } from './MUGlobal';
9
9
  import { PullToRefreshUI } from './PullToRefreshUI';
10
10
  import { ScrollerListEx } from './ScrollerListEx';
11
11
  import { SearchBar } from './SearchBar';
12
- function getDefaultSearchBoxSx(paddings) {
12
+ function defaultContainerBoxSx(paddings, _dataGrid) {
13
13
  const half = MUGlobal.half(paddings);
14
14
  return {
15
- paddingLeft: (theme) => theme.spacing(1),
16
- paddingRight: (theme) => theme.spacing(1),
17
- paddingTop: half,
18
- marginBottom: half
15
+ '& .SearchBox': {
16
+ marginBottom: half
17
+ }
19
18
  };
20
19
  }
21
20
  /**
@@ -25,7 +24,7 @@ function getDefaultSearchBoxSx(paddings) {
25
24
  */
26
25
  export function ResponsibleContainer(props) {
27
26
  // Destruct
28
- const { adjustHeight, columns, containerBoxSx, dataGridMinWidth = Math.max(576, DataGridExCalColumns(columns).total), elementReady, fields, fieldTemplate, height, loadData, mRef, paddings = MUGlobal.pagePaddings, pullToRefresh = true, sizeReadyMiliseconds = 0, ...rest } = props;
27
+ const { adjustHeight, columns, containerBoxSx = defaultContainerBoxSx, dataGridMinWidth = Math.max(576, DataGridExCalColumns(columns).total), elementReady, fields, fieldTemplate, height, loadData, mRef, paddings = MUGlobal.pagePaddings, pullToRefresh = true, sizeReadyMiliseconds = 0, ...rest } = props;
29
28
  // Labels
30
29
  const labels = Labels.CommonPage;
31
30
  // Refs
@@ -146,7 +145,7 @@ export function ResponsibleContainer(props) {
146
145
  // Layout
147
146
  return (React.createElement(Box, { sx: containerBoxSx == null
148
147
  ? undefined
149
- : containerBoxSx(showDataGrid) },
148
+ : containerBoxSx(paddings, showDataGrid) },
150
149
  React.createElement(Stack, null,
151
150
  React.createElement(Box, { ref: dimensions[0][0], className: "SearchBox" }, searchBar),
152
151
  list),
@@ -13,13 +13,14 @@ export function ResponsivePage(props) {
13
13
  const { pageProps = {}, ...rest } = props;
14
14
  (_a = pageProps.paddings) !== null && _a !== void 0 ? _a : (pageProps.paddings = MUGlobal.pagePaddings);
15
15
  const { paddings, fabColumnDirection, ...pageRest } = pageProps;
16
- const half = MUGlobal.half(paddings);
17
16
  // State
18
17
  const [scrollContainer, setScrollContainer] = React.useState();
19
18
  const [direction, setDirection] = React.useState(fabColumnDirection);
20
19
  // Layout
21
20
  return (React.createElement(CommonPage, { ...pageRest, paddings: {}, scrollContainer: scrollContainer, fabColumnDirection: direction },
22
- React.createElement(ResponsibleContainer, { paddings: paddings, containerBoxSx: (dataGrid) => {
21
+ React.createElement(ResponsibleContainer, { paddings: paddings, containerBoxSx: (paddings, _dataGrid) => {
22
+ // Half
23
+ const half = MUGlobal.half(paddings);
23
24
  // .SearchBox keep the same to avoid flick when switching between DataGrid and List
24
25
  return {
25
26
  '& .SearchBox': {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/react",
3
- "version": "1.4.33",
3
+ "version": "1.4.34",
4
4
  "description": "TypeScript ReactJs framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -54,7 +54,7 @@ export interface ResponsibleContainerProps<
54
54
  /**
55
55
  * Container box SX (dataGrid determines the case)
56
56
  */
57
- containerBoxSx?: (dataGrid?: boolean) => SxProps<Theme>;
57
+ containerBoxSx?: (paddings: {}, dataGrid?: boolean) => SxProps<Theme>;
58
58
 
59
59
  /**
60
60
  * Min width to show Datagrid
@@ -132,13 +132,15 @@ interface LocalRefs {
132
132
  mounted?: boolean;
133
133
  }
134
134
 
135
- function getDefaultSearchBoxSx(paddings: {}): SxProps<Theme> {
135
+ function defaultContainerBoxSx(
136
+ paddings: {},
137
+ _dataGrid?: boolean
138
+ ): SxProps<Theme> {
136
139
  const half = MUGlobal.half(paddings);
137
140
  return {
138
- paddingLeft: (theme) => theme.spacing(1),
139
- paddingRight: (theme) => theme.spacing(1),
140
- paddingTop: half,
141
- marginBottom: half
141
+ '& .SearchBox': {
142
+ marginBottom: half
143
+ }
142
144
  };
143
145
  }
144
146
 
@@ -155,7 +157,7 @@ export function ResponsibleContainer<
155
157
  const {
156
158
  adjustHeight,
157
159
  columns,
158
- containerBoxSx,
160
+ containerBoxSx = defaultContainerBoxSx,
159
161
  dataGridMinWidth = Math.max(576, DataGridExCalColumns(columns).total),
160
162
  elementReady,
161
163
  fields,
@@ -342,7 +344,7 @@ export function ResponsibleContainer<
342
344
  sx={
343
345
  containerBoxSx == null
344
346
  ? undefined
345
- : containerBoxSx(showDataGrid)
347
+ : containerBoxSx(paddings, showDataGrid)
346
348
  }
347
349
  >
348
350
  <Stack>
@@ -20,8 +20,6 @@ export function ResponsivePage<
20
20
  pageProps.paddings ??= MUGlobal.pagePaddings;
21
21
  const { paddings, fabColumnDirection, ...pageRest } = pageProps;
22
22
 
23
- const half = MUGlobal.half(paddings);
24
-
25
23
  // State
26
24
  const [scrollContainer, setScrollContainer] = React.useState<HTMLElement>();
27
25
  const [direction, setDirection] = React.useState(fabColumnDirection);
@@ -36,7 +34,10 @@ export function ResponsivePage<
36
34
  >
37
35
  <ResponsibleContainer<T, F>
38
36
  paddings={paddings}
39
- containerBoxSx={(dataGrid) => {
37
+ containerBoxSx={(paddings, _dataGrid) => {
38
+ // Half
39
+ const half = MUGlobal.half(paddings);
40
+
40
41
  // .SearchBox keep the same to avoid flick when switching between DataGrid and List
41
42
  return {
42
43
  '& .SearchBox': {