@etsoo/materialui 1.2.7 → 1.2.9
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.
- package/lib/pages/CommonPage.js +11 -9
- package/lib/pages/CommonPageProps.d.ts +2 -2
- package/lib/pages/ViewPage.d.ts +4 -0
- package/lib/pages/ViewPage.js +1 -1
- package/package.json +1 -1
- package/src/pages/CommonPage.tsx +7 -2
- package/src/pages/CommonPageProps.ts +2 -2
- package/src/pages/ViewPage.tsx +6 -0
package/lib/pages/CommonPage.js
CHANGED
|
@@ -49,15 +49,17 @@ export function CommonPage(props) {
|
|
|
49
49
|
React.createElement(Container, { disableGutters: disableGutters, maxWidth: maxWidth, sx: sx, id: "page-container", ...rest },
|
|
50
50
|
React.createElement(FabBox, { sx: {
|
|
51
51
|
zIndex: 1,
|
|
52
|
-
...(fabTop
|
|
53
|
-
?
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
52
|
+
...(typeof fabTop === "function"
|
|
53
|
+
? fabTop(theme, fabPadding)
|
|
54
|
+
: fabTop
|
|
55
|
+
? {
|
|
56
|
+
top: MUGlobal.updateWithTheme(MUGlobal.increase(fabPadding, 7), theme.spacing),
|
|
57
|
+
right: distance
|
|
58
|
+
}
|
|
59
|
+
: {
|
|
60
|
+
bottom: distance,
|
|
61
|
+
right: distance
|
|
62
|
+
})
|
|
61
63
|
}, columnDirection: fabColumnDirection, fabPanel: fabPanel },
|
|
62
64
|
scrollContainer && (React.createElement(ScrollTopFab, { size: fabSize, target: scrollContainer, title: labels.scrollTop })),
|
|
63
65
|
fabButtons,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { UserKey } from "@etsoo/appscript";
|
|
3
3
|
import { IStateUpdate, ListItemReact } from "@etsoo/react";
|
|
4
|
-
import { ContainerProps } from "@mui/material";
|
|
4
|
+
import { ContainerProps, Theme } from "@mui/material";
|
|
5
5
|
import { CustomFabSize } from "../CustomFabProps";
|
|
6
6
|
/**
|
|
7
7
|
* Common page props
|
|
@@ -31,7 +31,7 @@ export interface CommonPageProps extends Omit<ContainerProps, "id"> {
|
|
|
31
31
|
/**
|
|
32
32
|
* Fab lays in the top
|
|
33
33
|
*/
|
|
34
|
-
fabTop?: boolean;
|
|
34
|
+
fabTop?: ((theme: Theme, padding: {}) => object) | boolean;
|
|
35
35
|
/**
|
|
36
36
|
* More actions
|
|
37
37
|
*/
|
package/lib/pages/ViewPage.d.ts
CHANGED
package/lib/pages/ViewPage.js
CHANGED
|
@@ -77,7 +77,7 @@ function getItemField(field, data) {
|
|
|
77
77
|
*/
|
|
78
78
|
export function ViewPage(props) {
|
|
79
79
|
// Destruct
|
|
80
|
-
const { actions, children, fields, loadData, paddings = MUGlobal.pagePaddings, supportRefresh = true, fabColumnDirection = true, fabTop = true, supportBack = true, pullToRefresh = true, gridRef, ...rest } = props;
|
|
80
|
+
const { actions, children, fields, loadData, paddings = MUGlobal.pagePaddings, spacing = MUGlobal.half(MUGlobal.pagePaddings), supportRefresh = true, fabColumnDirection = true, fabTop = true, supportBack = true, pullToRefresh = true, gridRef, ...rest } = props;
|
|
81
81
|
// Data
|
|
82
82
|
const [data, setData] = React.useState();
|
|
83
83
|
// Labels
|
package/package.json
CHANGED
package/src/pages/CommonPage.tsx
CHANGED
|
@@ -89,9 +89,14 @@ export function CommonPage(props: CommonPageProps) {
|
|
|
89
89
|
<FabBox
|
|
90
90
|
sx={{
|
|
91
91
|
zIndex: 1,
|
|
92
|
-
...(fabTop
|
|
92
|
+
...(typeof fabTop === "function"
|
|
93
|
+
? fabTop(theme, fabPadding)
|
|
94
|
+
: fabTop
|
|
93
95
|
? {
|
|
94
|
-
top:
|
|
96
|
+
top: MUGlobal.updateWithTheme(
|
|
97
|
+
MUGlobal.increase(fabPadding, 7),
|
|
98
|
+
theme.spacing
|
|
99
|
+
),
|
|
95
100
|
right: distance
|
|
96
101
|
}
|
|
97
102
|
: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { UserKey } from "@etsoo/appscript";
|
|
2
2
|
import { IStateUpdate, ListItemReact } from "@etsoo/react";
|
|
3
|
-
import { ContainerProps } from "@mui/material";
|
|
3
|
+
import { ContainerProps, Theme } from "@mui/material";
|
|
4
4
|
import { CustomFabSize } from "../CustomFabProps";
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -36,7 +36,7 @@ export interface CommonPageProps extends Omit<ContainerProps, "id"> {
|
|
|
36
36
|
/**
|
|
37
37
|
* Fab lays in the top
|
|
38
38
|
*/
|
|
39
|
-
fabTop?: boolean;
|
|
39
|
+
fabTop?: ((theme: Theme, padding: {}) => object) | boolean;
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* More actions
|
package/src/pages/ViewPage.tsx
CHANGED
|
@@ -97,6 +97,11 @@ export interface ViewPageProps<T extends DataTypes.StringRecord>
|
|
|
97
97
|
*/
|
|
98
98
|
pullToRefresh?: boolean;
|
|
99
99
|
|
|
100
|
+
/**
|
|
101
|
+
* Grid spacing
|
|
102
|
+
*/
|
|
103
|
+
spacing?: Record<string, string | number>;
|
|
104
|
+
|
|
100
105
|
/**
|
|
101
106
|
* Support refresh
|
|
102
107
|
*/
|
|
@@ -198,6 +203,7 @@ export function ViewPage<T extends DataTypes.StringRecord>(
|
|
|
198
203
|
fields,
|
|
199
204
|
loadData,
|
|
200
205
|
paddings = MUGlobal.pagePaddings,
|
|
206
|
+
spacing = MUGlobal.half(MUGlobal.pagePaddings),
|
|
201
207
|
supportRefresh = true,
|
|
202
208
|
fabColumnDirection = true,
|
|
203
209
|
fabTop = true,
|