@etsoo/materialui 1.1.97 → 1.1.98
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/FabBox.js +0 -1
- package/lib/ResponsibleContainer.d.ts +7 -1
- package/lib/ResponsibleContainer.js +4 -2
- package/lib/pages/CommonPage.d.ts +1 -1
- package/lib/pages/CommonPage.js +25 -24
- package/lib/pages/CommonPageProps.d.ts +9 -5
- package/lib/pages/ResponsivePageProps.d.ts +13 -6
- package/package.json +1 -1
- package/src/FabBox.tsx +0 -1
- package/src/ResponsibleContainer.tsx +13 -3
- package/src/pages/CommonPage.tsx +102 -111
- package/src/pages/CommonPageProps.ts +58 -53
- package/src/pages/ResponsivePageProps.ts +56 -48
package/lib/FabBox.js
CHANGED
|
@@ -13,9 +13,15 @@ export type ResponsibleContainerProps<T extends object, F extends DataTypes.Basi
|
|
|
13
13
|
* Height will be deducted
|
|
14
14
|
* @param height Current calcuated height
|
|
15
15
|
* @param rect Current rect data
|
|
16
|
+
*/
|
|
17
|
+
adjustHeight?: (height: number, rect: DOMRect) => number;
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @param height Current height
|
|
16
21
|
* @param isGrid Is displaying DataGrid
|
|
22
|
+
* @returns Adjusted height
|
|
17
23
|
*/
|
|
18
|
-
|
|
24
|
+
adjustFabHeight?: (height: number, isGrid: boolean) => number;
|
|
19
25
|
/**
|
|
20
26
|
* Columns
|
|
21
27
|
*/
|
|
@@ -22,7 +22,7 @@ function defaultContainerBoxSx(paddings, hasField, _dataGrid) {
|
|
|
22
22
|
*/
|
|
23
23
|
export function ResponsibleContainer(props) {
|
|
24
24
|
// Destruct
|
|
25
|
-
const { adjustHeight, columns, containerBoxSx = defaultContainerBoxSx, dataGridMinWidth = Math.max(576, DataGridExCalColumns(columns).total), elementReady, fields, fieldTemplate, height, loadData, mRef, paddings = MUGlobal.pagePaddings, pullToRefresh = true, quickAction, sizeReadyMiliseconds = 0, searchBarHeight = 45.6, ...rest } = props;
|
|
25
|
+
const { adjustHeight, adjustFabHeight, columns, containerBoxSx = defaultContainerBoxSx, dataGridMinWidth = Math.max(576, DataGridExCalColumns(columns).total), elementReady, fields, fieldTemplate, height, loadData, mRef, paddings = MUGlobal.pagePaddings, pullToRefresh = true, quickAction, sizeReadyMiliseconds = 0, searchBarHeight = 45.6, ...rest } = props;
|
|
26
26
|
// Labels
|
|
27
27
|
const labels = Labels.CommonPage;
|
|
28
28
|
// Refs
|
|
@@ -95,8 +95,10 @@ export function ResponsibleContainer(props) {
|
|
|
95
95
|
if (!isNaN(boxMargin))
|
|
96
96
|
heightLocal -= 3 * boxMargin; // 1 - Box, 2 - Page bottom
|
|
97
97
|
if (adjustHeight != null)
|
|
98
|
-
heightLocal -= adjustHeight(heightLocal, rect
|
|
98
|
+
heightLocal -= adjustHeight(heightLocal, rect);
|
|
99
99
|
}
|
|
100
|
+
if (adjustFabHeight)
|
|
101
|
+
heightLocal = adjustFabHeight(heightLocal, showDataGrid);
|
|
100
102
|
if (showDataGrid) {
|
|
101
103
|
// Delete
|
|
102
104
|
delete rest.itemRenderer;
|
package/lib/pages/CommonPage.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { FabBox } from
|
|
3
|
-
import { ScrollTopFab } from
|
|
4
|
-
import { MUGlobal } from
|
|
5
|
-
import { MoreFab } from
|
|
6
|
-
import { Container, Fab } from
|
|
7
|
-
import RefreshIcon from
|
|
8
|
-
import { BackButton } from
|
|
9
|
-
import { Labels } from
|
|
10
|
-
import { ReactAppStateDetector } from
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FabBox } from "../FabBox";
|
|
3
|
+
import { ScrollTopFab } from "../ScrollTopFab";
|
|
4
|
+
import { MUGlobal } from "../MUGlobal";
|
|
5
|
+
import { MoreFab } from "../MoreFab";
|
|
6
|
+
import { Container, Fab, Paper } from "@mui/material";
|
|
7
|
+
import RefreshIcon from "@mui/icons-material/Refresh";
|
|
8
|
+
import { BackButton } from "../BackButton";
|
|
9
|
+
import { Labels } from "../app/Labels";
|
|
10
|
+
import { ReactAppStateDetector } from "../app/ReactApp";
|
|
11
11
|
/**
|
|
12
12
|
* Default scroll container
|
|
13
13
|
*/
|
|
@@ -18,12 +18,12 @@ export const CommonPageScrollContainer = global;
|
|
|
18
18
|
*/
|
|
19
19
|
export function CommonPage(props) {
|
|
20
20
|
// Destruct
|
|
21
|
-
const { children, disableGutters = true, fabButtons, fabColumnDirection, fabPaddingAdjust = 1.5, fabSize =
|
|
21
|
+
const { children, disableGutters = true, fabButtons, fabColumnDirection, fabPanel = fabColumnDirection, fabPaddingAdjust = 1.5, fabSize = "small", maxWidth = false, moreActions, onRefresh, onUpdate, onUpdateAll, paddings = MUGlobal.pagePaddings, scrollContainer, supportBack = false, targetFields, sx = {}, ...rest } = props;
|
|
22
22
|
// Fab padding
|
|
23
23
|
const fabPadding = MUGlobal.increase(MUGlobal.pagePaddings, fabPaddingAdjust);
|
|
24
|
-
if (typeof sx ===
|
|
24
|
+
if (typeof sx === "object" && sx != null && !Reflect.has(sx, "padding")) {
|
|
25
25
|
// Set default padding
|
|
26
|
-
Reflect.set(sx,
|
|
26
|
+
Reflect.set(sx, "padding", paddings);
|
|
27
27
|
}
|
|
28
28
|
// Labels
|
|
29
29
|
const labels = Labels.CommonPage;
|
|
@@ -41,20 +41,21 @@ export function CommonPage(props) {
|
|
|
41
41
|
onRefresh();
|
|
42
42
|
}
|
|
43
43
|
: undefined;
|
|
44
|
+
const fab = (React.createElement(FabBox, { sx: {
|
|
45
|
+
zIndex: 1,
|
|
46
|
+
bottom: (theme) => MUGlobal.updateWithTheme(fabPadding, theme.spacing),
|
|
47
|
+
right: (theme) => MUGlobal.updateWithTheme(fabPadding, theme.spacing)
|
|
48
|
+
}, columnDirection: fabColumnDirection },
|
|
49
|
+
scrollContainer && (React.createElement(ScrollTopFab, { size: fabSize, target: scrollContainer, title: labels.scrollTop })),
|
|
50
|
+
fabButtons,
|
|
51
|
+
onRefresh != null && (React.createElement(Fab, { title: labels.refresh, size: fabSize, onClick: onRefresh, sx: { display: { xs: "none", md: "inherit" } } },
|
|
52
|
+
React.createElement(RefreshIcon, null))),
|
|
53
|
+
React.createElement(MoreFab, { size: fabSize, title: labels.more, actions: moreActions }),
|
|
54
|
+
supportBack && React.createElement(BackButton, { title: labels.back, size: fabSize })));
|
|
44
55
|
// Return the UI
|
|
45
56
|
return (React.createElement(React.Fragment, null,
|
|
46
57
|
update && (React.createElement(ReactAppStateDetector, { targetFields: targetFields, update: update })),
|
|
47
58
|
React.createElement(Container, { disableGutters: disableGutters, maxWidth: maxWidth, sx: sx, id: "page-container", ...rest },
|
|
48
|
-
React.createElement(
|
|
49
|
-
zIndex: 1,
|
|
50
|
-
bottom: (theme) => MUGlobal.updateWithTheme(fabPadding, theme.spacing),
|
|
51
|
-
right: (theme) => MUGlobal.updateWithTheme(fabPadding, theme.spacing)
|
|
52
|
-
}, columnDirection: fabColumnDirection },
|
|
53
|
-
scrollContainer && (React.createElement(ScrollTopFab, { size: fabSize, target: scrollContainer, title: labels.scrollTop })),
|
|
54
|
-
fabButtons,
|
|
55
|
-
onRefresh != null && (React.createElement(Fab, { title: labels.refresh, size: fabSize, onClick: onRefresh, sx: { display: { xs: 'none', md: 'inherit' } } },
|
|
56
|
-
React.createElement(RefreshIcon, null))),
|
|
57
|
-
React.createElement(MoreFab, { size: fabSize, title: labels.more, actions: moreActions }),
|
|
58
|
-
supportBack && (React.createElement(BackButton, { title: labels.back, size: fabSize }))),
|
|
59
|
+
fabPanel ? React.createElement(Paper, { sx: { padding: 2 } }, fab) : fab,
|
|
59
60
|
children)));
|
|
60
61
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { UserKey } from
|
|
3
|
-
import { IStateUpdate, ListItemReact } from
|
|
4
|
-
import { ContainerProps } from
|
|
5
|
-
import { CustomFabSize } from
|
|
2
|
+
import { UserKey } from "@etsoo/appscript";
|
|
3
|
+
import { IStateUpdate, ListItemReact } from "@etsoo/react";
|
|
4
|
+
import { ContainerProps } from "@mui/material";
|
|
5
|
+
import { CustomFabSize } from "../CustomFabProps";
|
|
6
6
|
/**
|
|
7
7
|
* Common page props
|
|
8
8
|
* Default container id is 'pageContainer'
|
|
9
9
|
*/
|
|
10
|
-
export interface CommonPageProps extends Omit<ContainerProps,
|
|
10
|
+
export interface CommonPageProps extends Omit<ContainerProps, "id"> {
|
|
11
11
|
/**
|
|
12
12
|
* Fab buttons
|
|
13
13
|
*/
|
|
@@ -24,6 +24,10 @@ export interface CommonPageProps extends Omit<ContainerProps, 'id'> {
|
|
|
24
24
|
* Fab padding adjust
|
|
25
25
|
*/
|
|
26
26
|
fabPaddingAdjust?: number;
|
|
27
|
+
/**
|
|
28
|
+
* Add panel to the Fab
|
|
29
|
+
*/
|
|
30
|
+
fabPanel?: boolean;
|
|
27
31
|
/**
|
|
28
32
|
* More actions
|
|
29
33
|
*/
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { GridMethodRef } from
|
|
3
|
-
import { DataTypes, IdDefaultType } from
|
|
4
|
-
import { ListChildComponentProps } from
|
|
5
|
-
import { ScrollerListExInnerItemRendererProps, ScrollerListExItemSize } from
|
|
6
|
-
import { DataGridPageProps } from
|
|
2
|
+
import { GridMethodRef } from "@etsoo/react";
|
|
3
|
+
import { DataTypes, IdDefaultType } from "@etsoo/shared";
|
|
4
|
+
import { ListChildComponentProps } from "react-window";
|
|
5
|
+
import { ScrollerListExInnerItemRendererProps, ScrollerListExItemSize } from "../ScrollerListEx";
|
|
6
|
+
import { DataGridPageProps } from "./DataGridPageProps";
|
|
7
7
|
/**
|
|
8
8
|
* Response page props
|
|
9
9
|
*/
|
|
10
|
-
export type ResponsePageProps<T extends object, F extends DataTypes.BasicTemplate, D extends DataTypes.Keys<T> = IdDefaultType<T>> = Omit<DataGridPageProps<T, F, D>,
|
|
10
|
+
export type ResponsePageProps<T extends object, F extends DataTypes.BasicTemplate, D extends DataTypes.Keys<T> = IdDefaultType<T>> = Omit<DataGridPageProps<T, F, D>, "mRef" | "itemKey" | "onScroll" | "onItemsRendered"> & {
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
* @param height Current height
|
|
14
|
+
* @param isGrid Is displaying DataGrid
|
|
15
|
+
* @returns Adjusted height
|
|
16
|
+
*/
|
|
17
|
+
adjustFabHeight?: (height: number, isGrid: boolean) => number;
|
|
11
18
|
/**
|
|
12
19
|
* Min width to show Datagrid
|
|
13
20
|
*/
|
package/package.json
CHANGED
package/src/FabBox.tsx
CHANGED
|
@@ -42,9 +42,16 @@ export type ResponsibleContainerProps<
|
|
|
42
42
|
* Height will be deducted
|
|
43
43
|
* @param height Current calcuated height
|
|
44
44
|
* @param rect Current rect data
|
|
45
|
+
*/
|
|
46
|
+
adjustHeight?: (height: number, rect: DOMRect) => number;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
*
|
|
50
|
+
* @param height Current height
|
|
45
51
|
* @param isGrid Is displaying DataGrid
|
|
52
|
+
* @returns Adjusted height
|
|
46
53
|
*/
|
|
47
|
-
|
|
54
|
+
adjustFabHeight?: (height: number, isGrid: boolean) => number;
|
|
48
55
|
|
|
49
56
|
/**
|
|
50
57
|
* Columns
|
|
@@ -172,6 +179,7 @@ export function ResponsibleContainer<
|
|
|
172
179
|
// Destruct
|
|
173
180
|
const {
|
|
174
181
|
adjustHeight,
|
|
182
|
+
adjustFabHeight,
|
|
175
183
|
columns,
|
|
176
184
|
containerBoxSx = defaultContainerBoxSx,
|
|
177
185
|
dataGridMinWidth = Math.max(576, DataGridExCalColumns(columns).total),
|
|
@@ -279,10 +287,12 @@ export function ResponsibleContainer<
|
|
|
279
287
|
const boxMargin = parseFloat(style.marginBottom);
|
|
280
288
|
if (!isNaN(boxMargin)) heightLocal -= 3 * boxMargin; // 1 - Box, 2 - Page bottom
|
|
281
289
|
|
|
282
|
-
if (adjustHeight != null)
|
|
283
|
-
heightLocal -= adjustHeight(heightLocal, rect, showDataGrid);
|
|
290
|
+
if (adjustHeight != null) heightLocal -= adjustHeight(heightLocal, rect);
|
|
284
291
|
}
|
|
285
292
|
|
|
293
|
+
if (adjustFabHeight)
|
|
294
|
+
heightLocal = adjustFabHeight(heightLocal, showDataGrid);
|
|
295
|
+
|
|
286
296
|
if (showDataGrid) {
|
|
287
297
|
// Delete
|
|
288
298
|
delete rest.itemRenderer;
|
package/src/pages/CommonPage.tsx
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { FabBox } from
|
|
3
|
-
import { ScrollTopFab } from
|
|
4
|
-
import { MUGlobal } from
|
|
5
|
-
import { CommonPageProps } from
|
|
6
|
-
import { MoreFab } from
|
|
7
|
-
import { Container, Fab } from
|
|
8
|
-
import RefreshIcon from
|
|
9
|
-
import { BackButton } from
|
|
10
|
-
import { Labels } from
|
|
11
|
-
import { ReactAppStateDetector } from
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FabBox } from "../FabBox";
|
|
3
|
+
import { ScrollTopFab } from "../ScrollTopFab";
|
|
4
|
+
import { MUGlobal } from "../MUGlobal";
|
|
5
|
+
import { CommonPageProps } from "./CommonPageProps";
|
|
6
|
+
import { MoreFab } from "../MoreFab";
|
|
7
|
+
import { Container, Fab, Paper } from "@mui/material";
|
|
8
|
+
import RefreshIcon from "@mui/icons-material/Refresh";
|
|
9
|
+
import { BackButton } from "../BackButton";
|
|
10
|
+
import { Labels } from "../app/Labels";
|
|
11
|
+
import { ReactAppStateDetector } from "../app/ReactApp";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Default scroll container
|
|
@@ -20,109 +20,100 @@ export const CommonPageScrollContainer = global;
|
|
|
20
20
|
* @param props Props
|
|
21
21
|
*/
|
|
22
22
|
export function CommonPage(props: CommonPageProps) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
23
|
+
// Destruct
|
|
24
|
+
const {
|
|
25
|
+
children,
|
|
26
|
+
disableGutters = true,
|
|
27
|
+
fabButtons,
|
|
28
|
+
fabColumnDirection,
|
|
29
|
+
fabPanel = fabColumnDirection,
|
|
30
|
+
fabPaddingAdjust = 1.5,
|
|
31
|
+
fabSize = "small",
|
|
32
|
+
maxWidth = false,
|
|
33
|
+
moreActions,
|
|
34
|
+
onRefresh,
|
|
35
|
+
onUpdate,
|
|
36
|
+
onUpdateAll,
|
|
37
|
+
paddings = MUGlobal.pagePaddings,
|
|
38
|
+
scrollContainer,
|
|
39
|
+
supportBack = false,
|
|
40
|
+
targetFields,
|
|
41
|
+
sx = {},
|
|
42
|
+
...rest
|
|
43
|
+
} = props;
|
|
43
44
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
MUGlobal.pagePaddings,
|
|
47
|
-
fabPaddingAdjust
|
|
48
|
-
);
|
|
45
|
+
// Fab padding
|
|
46
|
+
const fabPadding = MUGlobal.increase(MUGlobal.pagePaddings, fabPaddingAdjust);
|
|
49
47
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
if (typeof sx === "object" && sx != null && !Reflect.has(sx, "padding")) {
|
|
49
|
+
// Set default padding
|
|
50
|
+
Reflect.set(sx, "padding", paddings);
|
|
51
|
+
}
|
|
54
52
|
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
// Labels
|
|
54
|
+
const labels = Labels.CommonPage;
|
|
57
55
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
56
|
+
// Update
|
|
57
|
+
const update = onUpdateAll
|
|
58
|
+
? onUpdateAll
|
|
59
|
+
: onUpdate
|
|
60
|
+
? (authorized?: boolean) => {
|
|
61
|
+
if (authorized == null || authorized) onUpdate();
|
|
62
|
+
}
|
|
63
|
+
: onRefresh
|
|
64
|
+
? (authorized?: boolean) => {
|
|
65
|
+
if (authorized) onRefresh();
|
|
66
|
+
}
|
|
67
|
+
: undefined;
|
|
70
68
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
<BackButton title={labels.back} size={fabSize} />
|
|
122
|
-
)}
|
|
123
|
-
</FabBox>
|
|
124
|
-
{children}
|
|
125
|
-
</Container>
|
|
126
|
-
</React.Fragment>
|
|
127
|
-
);
|
|
69
|
+
const fab = (
|
|
70
|
+
<FabBox
|
|
71
|
+
sx={{
|
|
72
|
+
zIndex: 1,
|
|
73
|
+
bottom: (theme) => MUGlobal.updateWithTheme(fabPadding, theme.spacing),
|
|
74
|
+
right: (theme) => MUGlobal.updateWithTheme(fabPadding, theme.spacing)
|
|
75
|
+
}}
|
|
76
|
+
columnDirection={fabColumnDirection}
|
|
77
|
+
>
|
|
78
|
+
{scrollContainer && (
|
|
79
|
+
<ScrollTopFab
|
|
80
|
+
size={fabSize}
|
|
81
|
+
target={scrollContainer}
|
|
82
|
+
title={labels.scrollTop}
|
|
83
|
+
/>
|
|
84
|
+
)}
|
|
85
|
+
{fabButtons}
|
|
86
|
+
{onRefresh != null && (
|
|
87
|
+
<Fab
|
|
88
|
+
title={labels.refresh}
|
|
89
|
+
size={fabSize}
|
|
90
|
+
onClick={onRefresh}
|
|
91
|
+
sx={{ display: { xs: "none", md: "inherit" } }}
|
|
92
|
+
>
|
|
93
|
+
<RefreshIcon />
|
|
94
|
+
</Fab>
|
|
95
|
+
)}
|
|
96
|
+
<MoreFab size={fabSize} title={labels.more} actions={moreActions} />
|
|
97
|
+
{supportBack && <BackButton title={labels.back} size={fabSize} />}
|
|
98
|
+
</FabBox>
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
// Return the UI
|
|
102
|
+
return (
|
|
103
|
+
<React.Fragment>
|
|
104
|
+
{update && (
|
|
105
|
+
<ReactAppStateDetector targetFields={targetFields} update={update} />
|
|
106
|
+
)}
|
|
107
|
+
<Container
|
|
108
|
+
disableGutters={disableGutters}
|
|
109
|
+
maxWidth={maxWidth}
|
|
110
|
+
sx={sx}
|
|
111
|
+
id="page-container"
|
|
112
|
+
{...rest}
|
|
113
|
+
>
|
|
114
|
+
{fabPanel ? <Paper sx={{ padding: 2 }}>{fab}</Paper> : fab}
|
|
115
|
+
{children}
|
|
116
|
+
</Container>
|
|
117
|
+
</React.Fragment>
|
|
118
|
+
);
|
|
128
119
|
}
|
|
@@ -1,70 +1,75 @@
|
|
|
1
|
-
import { UserKey } from
|
|
2
|
-
import { IStateUpdate, ListItemReact } from
|
|
3
|
-
import { ContainerProps } from
|
|
4
|
-
import { CustomFabSize } from
|
|
1
|
+
import { UserKey } from "@etsoo/appscript";
|
|
2
|
+
import { IStateUpdate, ListItemReact } from "@etsoo/react";
|
|
3
|
+
import { ContainerProps } from "@mui/material";
|
|
4
|
+
import { CustomFabSize } from "../CustomFabProps";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Common page props
|
|
8
8
|
* Default container id is 'pageContainer'
|
|
9
9
|
*/
|
|
10
|
-
export interface CommonPageProps extends Omit<ContainerProps,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
export interface CommonPageProps extends Omit<ContainerProps, "id"> {
|
|
11
|
+
/**
|
|
12
|
+
* Fab buttons
|
|
13
|
+
*/
|
|
14
|
+
fabButtons?: React.ReactNode;
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Fab size
|
|
18
|
+
*/
|
|
19
|
+
fabSize?: CustomFabSize;
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Fab flex column direction, undefined to hide it
|
|
23
|
+
*/
|
|
24
|
+
fabColumnDirection?: boolean;
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Fab padding adjust
|
|
28
|
+
*/
|
|
29
|
+
fabPaddingAdjust?: number;
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Add panel to the Fab
|
|
33
|
+
*/
|
|
34
|
+
fabPanel?: boolean;
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
/**
|
|
37
|
+
* More actions
|
|
38
|
+
*/
|
|
39
|
+
moreActions?: ListItemReact[];
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
/**
|
|
42
|
+
* On refresh callback, only when authorized = true
|
|
43
|
+
*/
|
|
44
|
+
onRefresh?: () => void | PromiseLike<void>;
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
/**
|
|
47
|
+
* On page update, when authorized = null or true case, may uses onRefresh
|
|
48
|
+
*/
|
|
49
|
+
onUpdate?: () => void | PromiseLike<void>;
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
/**
|
|
52
|
+
* On page update, all cases with authorized
|
|
53
|
+
*/
|
|
54
|
+
onUpdateAll?: IStateUpdate;
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
/**
|
|
57
|
+
* Paddings
|
|
58
|
+
*/
|
|
59
|
+
paddings?: Record<string, string | number>;
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
/**
|
|
62
|
+
* Scroll container
|
|
63
|
+
*/
|
|
64
|
+
scrollContainer?: HTMLElement | object;
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
/**
|
|
67
|
+
* Support back click
|
|
68
|
+
*/
|
|
69
|
+
supportBack?: boolean;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* State last changed fields
|
|
73
|
+
*/
|
|
74
|
+
targetFields?: UserKey[];
|
|
70
75
|
}
|
|
@@ -1,57 +1,65 @@
|
|
|
1
|
-
import { GridMethodRef } from
|
|
2
|
-
import { DataTypes, IdDefaultType } from
|
|
3
|
-
import { ListChildComponentProps } from
|
|
1
|
+
import { GridMethodRef } from "@etsoo/react";
|
|
2
|
+
import { DataTypes, IdDefaultType } from "@etsoo/shared";
|
|
3
|
+
import { ListChildComponentProps } from "react-window";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} from
|
|
8
|
-
import { DataGridPageProps } from
|
|
5
|
+
ScrollerListExInnerItemRendererProps,
|
|
6
|
+
ScrollerListExItemSize
|
|
7
|
+
} from "../ScrollerListEx";
|
|
8
|
+
import { DataGridPageProps } from "./DataGridPageProps";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Response page props
|
|
12
12
|
*/
|
|
13
13
|
export type ResponsePageProps<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
T extends object,
|
|
15
|
+
F extends DataTypes.BasicTemplate,
|
|
16
|
+
D extends DataTypes.Keys<T> = IdDefaultType<T>
|
|
17
17
|
> = Omit<
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
DataGridPageProps<T, F, D>,
|
|
19
|
+
"mRef" | "itemKey" | "onScroll" | "onItemsRendered"
|
|
20
20
|
> & {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* @param height Current height
|
|
24
|
+
* @param isGrid Is displaying DataGrid
|
|
25
|
+
* @returns Adjusted height
|
|
26
|
+
*/
|
|
27
|
+
adjustFabHeight?: (height: number, isGrid: boolean) => number;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Min width to show Datagrid
|
|
31
|
+
*/
|
|
32
|
+
dataGridMinWidth?: number;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Inner item renderer
|
|
36
|
+
*/
|
|
37
|
+
innerItemRenderer: (
|
|
38
|
+
props: ScrollerListExInnerItemRendererProps<T>
|
|
39
|
+
) => React.ReactNode;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Item renderer
|
|
43
|
+
*/
|
|
44
|
+
itemRenderer?: (props: ListChildComponentProps<T>) => React.ReactElement;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Item size, a function indicates its a variable size list
|
|
48
|
+
*/
|
|
49
|
+
itemSize: ScrollerListExItemSize;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Methods
|
|
53
|
+
*/
|
|
54
|
+
mRef?: React.MutableRefObject<GridMethodRef<T> | undefined>;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Pull to refresh data
|
|
58
|
+
*/
|
|
59
|
+
pullToRefresh?: boolean;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Quick action for double click or click under mobile
|
|
63
|
+
*/
|
|
64
|
+
quickAction?: (data: T) => void;
|
|
57
65
|
};
|