@etsoo/react 1.4.45 → 1.4.46
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?: (paddings: {}, dataGrid?: boolean) => SxProps<Theme>;
|
|
26
|
+
containerBoxSx?: (paddings: {}, hasFields: boolean, dataGrid?: boolean) => SxProps<Theme>;
|
|
27
27
|
/**
|
|
28
28
|
* Min width to show Datagrid
|
|
29
29
|
*/
|
|
@@ -9,11 +9,11 @@ import { MUGlobal } from './MUGlobal';
|
|
|
9
9
|
import { PullToRefreshUI } from './PullToRefreshUI';
|
|
10
10
|
import { ScrollerListEx } from './ScrollerListEx';
|
|
11
11
|
import { SearchBar } from './SearchBar';
|
|
12
|
-
function defaultContainerBoxSx(paddings, _dataGrid) {
|
|
12
|
+
function defaultContainerBoxSx(paddings, hasField, _dataGrid) {
|
|
13
13
|
const half = MUGlobal.half(paddings);
|
|
14
14
|
return {
|
|
15
15
|
'& .SearchBox': {
|
|
16
|
-
marginBottom: half
|
|
16
|
+
marginBottom: hasField ? half : 0
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
}
|
|
@@ -145,9 +145,9 @@ export function ResponsibleContainer(props) {
|
|
|
145
145
|
// Layout
|
|
146
146
|
return (React.createElement(Box, { sx: containerBoxSx == null
|
|
147
147
|
? undefined
|
|
148
|
-
: containerBoxSx(paddings, showDataGrid) },
|
|
148
|
+
: containerBoxSx(paddings, hasFields, showDataGrid) },
|
|
149
149
|
React.createElement(Stack, null,
|
|
150
|
-
React.createElement(Box, { ref: dimensions[0][0], className: "SearchBox", sx: { height:
|
|
150
|
+
React.createElement(Box, { ref: dimensions[0][0], className: "SearchBox", sx: { height: hasFields ? 40 : 0 } }, searchBar),
|
|
151
151
|
list),
|
|
152
152
|
pullToRefresh && pullContainer && (React.createElement(PullToRefreshUI, { mainElement: pullContainer, triggerElement: pullContainer, instructionsPullToRefresh: labels.pullToRefresh, instructionsReleaseToRefresh: labels.releaseToRefresh, instructionsRefreshing: labels.refreshing, onRefresh: () => { var _a; return (_a = state.ref) === null || _a === void 0 ? void 0 : _a.reset(); }, shouldPullToRefresh: () => {
|
|
153
153
|
const container = document.querySelector(pullContainer);
|
|
@@ -18,7 +18,7 @@ export function ResponsivePage(props) {
|
|
|
18
18
|
const [direction, setDirection] = React.useState(fabColumnDirection);
|
|
19
19
|
// Layout
|
|
20
20
|
return (React.createElement(CommonPage, { ...pageRest, paddings: {}, scrollContainer: scrollContainer, fabColumnDirection: direction },
|
|
21
|
-
React.createElement(ResponsibleContainer, { paddings: paddings, containerBoxSx: (paddings, _dataGrid) => {
|
|
21
|
+
React.createElement(ResponsibleContainer, { paddings: paddings, containerBoxSx: (paddings, hasField, _dataGrid) => {
|
|
22
22
|
// Half
|
|
23
23
|
const half = MUGlobal.half(paddings);
|
|
24
24
|
// .SearchBox keep the same to avoid flick when switching between DataGrid and List
|
|
@@ -27,7 +27,7 @@ export function ResponsivePage(props) {
|
|
|
27
27
|
'& .SearchBox': {
|
|
28
28
|
marginLeft: paddings,
|
|
29
29
|
marginRight: paddings,
|
|
30
|
-
marginBottom: half
|
|
30
|
+
marginBottom: hasField ? half : 0
|
|
31
31
|
},
|
|
32
32
|
'& .ListBox': {
|
|
33
33
|
marginBottom: paddings
|
package/package.json
CHANGED
|
@@ -55,7 +55,11 @@ export interface ResponsibleContainerProps<
|
|
|
55
55
|
/**
|
|
56
56
|
* Container box SX (dataGrid determines the case)
|
|
57
57
|
*/
|
|
58
|
-
containerBoxSx?: (
|
|
58
|
+
containerBoxSx?: (
|
|
59
|
+
paddings: {},
|
|
60
|
+
hasFields: boolean,
|
|
61
|
+
dataGrid?: boolean
|
|
62
|
+
) => SxProps<Theme>;
|
|
59
63
|
|
|
60
64
|
/**
|
|
61
65
|
* Min width to show Datagrid
|
|
@@ -135,12 +139,13 @@ interface LocalRefs {
|
|
|
135
139
|
|
|
136
140
|
function defaultContainerBoxSx(
|
|
137
141
|
paddings: {},
|
|
142
|
+
hasField: boolean,
|
|
138
143
|
_dataGrid?: boolean
|
|
139
144
|
): SxProps<Theme> {
|
|
140
145
|
const half = MUGlobal.half(paddings);
|
|
141
146
|
return {
|
|
142
147
|
'& .SearchBox': {
|
|
143
|
-
marginBottom: half
|
|
148
|
+
marginBottom: hasField ? half : 0
|
|
144
149
|
}
|
|
145
150
|
};
|
|
146
151
|
}
|
|
@@ -345,14 +350,14 @@ export function ResponsibleContainer<
|
|
|
345
350
|
sx={
|
|
346
351
|
containerBoxSx == null
|
|
347
352
|
? undefined
|
|
348
|
-
: containerBoxSx(paddings, showDataGrid)
|
|
353
|
+
: containerBoxSx(paddings, hasFields, showDataGrid)
|
|
349
354
|
}
|
|
350
355
|
>
|
|
351
356
|
<Stack>
|
|
352
357
|
<Box
|
|
353
358
|
ref={dimensions[0][0]}
|
|
354
359
|
className="SearchBox"
|
|
355
|
-
sx={{ height:
|
|
360
|
+
sx={{ height: hasFields ? 40 : 0 }}
|
|
356
361
|
>
|
|
357
362
|
{searchBar}
|
|
358
363
|
</Box>
|
|
@@ -34,7 +34,7 @@ export function ResponsivePage<
|
|
|
34
34
|
>
|
|
35
35
|
<ResponsibleContainer<T, F>
|
|
36
36
|
paddings={paddings}
|
|
37
|
-
containerBoxSx={(paddings, _dataGrid) => {
|
|
37
|
+
containerBoxSx={(paddings, hasField, _dataGrid) => {
|
|
38
38
|
// Half
|
|
39
39
|
const half = MUGlobal.half(paddings);
|
|
40
40
|
|
|
@@ -44,7 +44,7 @@ export function ResponsivePage<
|
|
|
44
44
|
'& .SearchBox': {
|
|
45
45
|
marginLeft: paddings,
|
|
46
46
|
marginRight: paddings,
|
|
47
|
-
marginBottom: half
|
|
47
|
+
marginBottom: hasField ? half : 0
|
|
48
48
|
},
|
|
49
49
|
'& .ListBox': {
|
|
50
50
|
marginBottom: paddings
|