@etsoo/react 1.5.12 → 1.5.16
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/app/Labels.d.ts +1 -0
- package/lib/app/Labels.js +1 -0
- package/lib/app/ReactApp.d.ts +0 -13
- package/lib/app/ReactApp.js +6 -31
- package/lib/app/{Utils.d.ts → ReactUtils.d.ts} +7 -2
- package/lib/app/{Utils.js → ReactUtils.js} +20 -10
- package/lib/app/ServiceApp.d.ts +6 -5
- package/lib/app/ServiceApp.js +14 -7
- package/lib/index.d.ts +2 -1
- package/lib/index.js +2 -1
- package/lib/mu/BackButton.d.ts +13 -0
- package/lib/mu/BackButton.js +32 -0
- package/lib/mu/BridgeCloseButton.d.ts +5 -1
- package/lib/mu/BridgeCloseButton.js +5 -9
- package/lib/mu/ButtonLink.js +2 -2
- package/lib/mu/ComboBox.js +2 -2
- package/lib/mu/IconButtonLink.js +2 -2
- package/lib/mu/ResponsibleContainer.js +2 -2
- package/lib/mu/SearchBar.js +2 -2
- package/lib/mu/SelectEx.js +2 -2
- package/lib/mu/Tiplist.js +3 -3
- package/lib/mu/pages/CommonPage.js +4 -2
- package/lib/mu/pages/CommonPageProps.d.ts +5 -1
- package/lib/mu/pages/EditPage.d.ts +5 -0
- package/lib/mu/pages/EditPage.js +4 -2
- package/lib/mu/pages/ViewPage.d.ts +4 -0
- package/lib/mu/pages/ViewPage.js +13 -3
- package/package.json +2 -2
- package/src/app/Labels.ts +1 -0
- package/src/app/ReactApp.ts +9 -36
- package/src/app/{Utils.ts → ReactUtils.ts} +20 -4
- package/src/app/ServiceApp.ts +16 -7
- package/src/index.ts +2 -1
- package/src/mu/BackButton.tsx +53 -0
- package/src/mu/BridgeCloseButton.tsx +17 -16
- package/src/mu/ButtonLink.tsx +3 -2
- package/src/mu/ComboBox.tsx +2 -2
- package/src/mu/IconButtonLink.tsx +2 -2
- package/src/mu/ResponsibleContainer.tsx +2 -2
- package/src/mu/SearchBar.tsx +2 -2
- package/src/mu/SelectEx.tsx +2 -2
- package/src/mu/Tiplist.tsx +3 -3
- package/src/mu/pages/CommonPage.tsx +5 -0
- package/src/mu/pages/CommonPageProps.ts +6 -1
- package/src/mu/pages/EditPage.tsx +9 -0
- package/src/mu/pages/ViewPage.tsx +36 -1
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
Typography
|
|
8
8
|
} from '@mui/material';
|
|
9
9
|
import React from 'react';
|
|
10
|
+
import { Labels } from '../../app/Labels';
|
|
10
11
|
import { globalApp } from '../../app/ReactApp';
|
|
11
12
|
import {
|
|
12
13
|
GridColumnRenderProps,
|
|
@@ -14,6 +15,7 @@ import {
|
|
|
14
15
|
} from '../../components/GridColumn';
|
|
15
16
|
import { GridDataFormat } from '../GridDataFormat';
|
|
16
17
|
import { MUGlobal } from '../MUGlobal';
|
|
18
|
+
import { PullToRefreshUI } from '../PullToRefreshUI';
|
|
17
19
|
import { CommonPage } from './CommonPage';
|
|
18
20
|
import { CommonPageProps } from './CommonPageProps';
|
|
19
21
|
|
|
@@ -81,6 +83,11 @@ export interface ViewPageProps<T extends {}>
|
|
|
81
83
|
*/
|
|
82
84
|
loadData: () => PromiseLike<T | undefined>;
|
|
83
85
|
|
|
86
|
+
/**
|
|
87
|
+
* Pull to refresh data
|
|
88
|
+
*/
|
|
89
|
+
pullToRefresh?: boolean;
|
|
90
|
+
|
|
84
91
|
/**
|
|
85
92
|
* Support refresh
|
|
86
93
|
*/
|
|
@@ -165,12 +172,21 @@ export function ViewPage<T extends {}>(props: ViewPageProps<T>) {
|
|
|
165
172
|
loadData,
|
|
166
173
|
paddings = MUGlobal.pagePaddings,
|
|
167
174
|
supportRefresh = true,
|
|
175
|
+
fabColumnDirection = true,
|
|
176
|
+
supportBack = true,
|
|
177
|
+
pullToRefresh = true,
|
|
168
178
|
...rest
|
|
169
179
|
} = props;
|
|
170
180
|
|
|
171
181
|
// Data
|
|
172
182
|
const [data, setData] = React.useState<T>();
|
|
173
183
|
|
|
184
|
+
// Labels
|
|
185
|
+
const labels = Labels.CommonPage;
|
|
186
|
+
|
|
187
|
+
// Container
|
|
188
|
+
const pullContainer = '#page-container';
|
|
189
|
+
|
|
174
190
|
// Load data
|
|
175
191
|
const refresh = async () => {
|
|
176
192
|
const result = await loadData();
|
|
@@ -184,7 +200,9 @@ export function ViewPage<T extends {}>(props: ViewPageProps<T>) {
|
|
|
184
200
|
onRefresh={supportRefresh ? refresh : undefined}
|
|
185
201
|
onUpdate={supportRefresh ? undefined : refresh}
|
|
186
202
|
{...rest}
|
|
187
|
-
scrollContainer={
|
|
203
|
+
scrollContainer={globalThis}
|
|
204
|
+
fabColumnDirection={fabColumnDirection}
|
|
205
|
+
supportBack={supportBack}
|
|
188
206
|
>
|
|
189
207
|
{data == null ? (
|
|
190
208
|
<LinearProgress />
|
|
@@ -241,6 +259,23 @@ export function ViewPage<T extends {}>(props: ViewPageProps<T>) {
|
|
|
241
259
|
</Stack>
|
|
242
260
|
)}
|
|
243
261
|
{Utils.getResult(children, data, refresh)}
|
|
262
|
+
{pullToRefresh && (
|
|
263
|
+
<PullToRefreshUI
|
|
264
|
+
mainElement={pullContainer}
|
|
265
|
+
triggerElement={pullContainer}
|
|
266
|
+
instructionsPullToRefresh={labels.pullToRefresh}
|
|
267
|
+
instructionsReleaseToRefresh={
|
|
268
|
+
labels.releaseToRefresh
|
|
269
|
+
}
|
|
270
|
+
instructionsRefreshing={labels.refreshing}
|
|
271
|
+
onRefresh={refresh}
|
|
272
|
+
shouldPullToRefresh={() => {
|
|
273
|
+
const container =
|
|
274
|
+
document.querySelector(pullContainer);
|
|
275
|
+
return !container?.scrollTop;
|
|
276
|
+
}}
|
|
277
|
+
/>
|
|
278
|
+
)}
|
|
244
279
|
</React.Fragment>
|
|
245
280
|
)}
|
|
246
281
|
</CommonPage>
|