@etsoo/react 1.4.24 → 1.4.28
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/components/ScrollerList.js +3 -1
- package/lib/mu/ResponsibleContainer.d.ts +9 -1
- package/lib/mu/ResponsibleContainer.js +42 -14
- package/lib/mu/SearchBar.js +34 -26
- package/lib/mu/pages/CommonPage.d.ts +0 -4
- package/lib/mu/pages/CommonPage.js +2 -11
- package/lib/mu/pages/CommonPageProps.d.ts +0 -4
- package/lib/mu/pages/DataGridPage.js +4 -7
- package/lib/mu/pages/FixedListPage.js +3 -6
- package/lib/mu/pages/ListPage.js +2 -2
- package/lib/mu/pages/ResponsivePage.js +33 -119
- package/lib/mu/pages/ResponsivePageProps.d.ts +4 -0
- package/lib/mu/pages/TablePage.js +4 -3
- package/lib/uses/useWindowSize.d.ts +6 -5
- package/lib/uses/useWindowSize.js +22 -16
- package/package.json +1 -1
- package/src/components/ScrollerList.tsx +4 -1
- package/src/mu/ResponsibleContainer.tsx +76 -17
- package/src/mu/SearchBar.tsx +35 -23
- package/src/mu/pages/CommonPage.tsx +0 -21
- package/src/mu/pages/CommonPageProps.ts +0 -5
- package/src/mu/pages/DataGridPage.tsx +3 -11
- package/src/mu/pages/FixedListPage.tsx +2 -7
- package/src/mu/pages/ListPage.tsx +2 -10
- package/src/mu/pages/ResponsivePage.tsx +37 -192
- package/src/mu/pages/ResponsivePageProps.ts +5 -0
- package/src/mu/pages/TablePage.tsx +5 -11
- package/src/uses/useWindowSize.ts +32 -19
|
@@ -1,33 +1,39 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
/**
|
|
3
3
|
* Detect window size
|
|
4
|
-
* @param miliseconds Miliseconds delayed
|
|
5
4
|
* @returns Window size
|
|
6
5
|
*/
|
|
7
|
-
export const useWindowSize = (
|
|
6
|
+
export const useWindowSize = () => {
|
|
8
7
|
// State
|
|
9
8
|
const [size, setSize] = React.useState({
|
|
10
9
|
width: 0,
|
|
11
10
|
height: 0
|
|
12
11
|
});
|
|
13
|
-
const [state] = React.useState({});
|
|
14
|
-
const resizeHandler = () => {
|
|
15
|
-
if (state.seed != null)
|
|
16
|
-
window.clearTimeout(state.seed);
|
|
17
|
-
state.seed = window.setTimeout(() => {
|
|
18
|
-
setSize({
|
|
19
|
-
width: window.innerWidth,
|
|
20
|
-
height: window.innerHeight
|
|
21
|
-
});
|
|
22
|
-
state.seed = undefined;
|
|
23
|
-
}, miliseconds);
|
|
24
|
-
};
|
|
25
12
|
React.useEffect(() => {
|
|
13
|
+
let ticking = false;
|
|
14
|
+
let lastKnownSize;
|
|
15
|
+
let requestAnimationFrameSeed = 0;
|
|
16
|
+
const resizeHandler = () => {
|
|
17
|
+
lastKnownSize = {
|
|
18
|
+
width: document.documentElement.clientWidth,
|
|
19
|
+
height: document.documentElement.clientHeight
|
|
20
|
+
};
|
|
21
|
+
if (!ticking) {
|
|
22
|
+
requestAnimationFrameSeed = window.requestAnimationFrame(() => {
|
|
23
|
+
setSize(lastKnownSize);
|
|
24
|
+
ticking = false;
|
|
25
|
+
requestAnimationFrameSeed = 0;
|
|
26
|
+
});
|
|
27
|
+
ticking = true;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
26
30
|
window.addEventListener('resize', resizeHandler);
|
|
27
31
|
return () => {
|
|
32
|
+
// Cancel animation frame
|
|
33
|
+
if (requestAnimationFrameSeed > 0)
|
|
34
|
+
window.cancelAnimationFrame(requestAnimationFrameSeed);
|
|
35
|
+
// Remove scroll event
|
|
28
36
|
window.removeEventListener('resize', resizeHandler);
|
|
29
|
-
if (state.seed != null)
|
|
30
|
-
window.clearTimeout(state.seed);
|
|
31
37
|
};
|
|
32
38
|
}, []);
|
|
33
39
|
// Return
|
package/package.json
CHANGED
|
@@ -106,7 +106,7 @@ export const ScrollerList = <T extends Record<string, any>>(
|
|
|
106
106
|
autoLoad = true,
|
|
107
107
|
defaultOrderBy,
|
|
108
108
|
defaultOrderByAsc,
|
|
109
|
-
height =
|
|
109
|
+
height = document.documentElement.clientHeight,
|
|
110
110
|
width = '100%',
|
|
111
111
|
mRef,
|
|
112
112
|
oRef,
|
|
@@ -248,6 +248,9 @@ export const ScrollerList = <T extends Record<string, any>>(
|
|
|
248
248
|
...add
|
|
249
249
|
};
|
|
250
250
|
Object.assign(state, resetState);
|
|
251
|
+
|
|
252
|
+
// Reset
|
|
253
|
+
setRows([]);
|
|
251
254
|
},
|
|
252
255
|
|
|
253
256
|
scrollTo(scrollOffset: number): void {
|
|
@@ -51,6 +51,11 @@ export interface ResponsibleContainerProps<
|
|
|
51
51
|
*/
|
|
52
52
|
columns: GridColumn<T>[];
|
|
53
53
|
|
|
54
|
+
/**
|
|
55
|
+
* Container box SX (dataGrid determines the case)
|
|
56
|
+
*/
|
|
57
|
+
containerBoxSx?: (dataGrid: boolean) => SxProps<Theme>;
|
|
58
|
+
|
|
54
59
|
/**
|
|
55
60
|
* Min width to show Datagrid
|
|
56
61
|
*/
|
|
@@ -91,7 +96,7 @@ export interface ResponsibleContainerProps<
|
|
|
91
96
|
/**
|
|
92
97
|
* Listbox SX (dataGrid determines the case)
|
|
93
98
|
*/
|
|
94
|
-
listBoxSx?: (dataGrid: boolean) => SxProps<Theme>;
|
|
99
|
+
listBoxSx?: (dataGrid: boolean, height: number) => SxProps<Theme>;
|
|
95
100
|
|
|
96
101
|
/**
|
|
97
102
|
* Load data callback
|
|
@@ -105,6 +110,11 @@ export interface ResponsibleContainerProps<
|
|
|
105
110
|
*/
|
|
106
111
|
mRef?: React.MutableRefObject<GridMethodRef | undefined>;
|
|
107
112
|
|
|
113
|
+
/**
|
|
114
|
+
* Element ready callback
|
|
115
|
+
*/
|
|
116
|
+
elementReady?: (element: HTMLElement, isDataGrid: boolean) => void;
|
|
117
|
+
|
|
108
118
|
/**
|
|
109
119
|
* Paddings
|
|
110
120
|
*/
|
|
@@ -132,6 +142,16 @@ interface LocalRefs {
|
|
|
132
142
|
mounted?: boolean;
|
|
133
143
|
}
|
|
134
144
|
|
|
145
|
+
function getDefaultSearchBoxSx(paddings: {}): SxProps<Theme> {
|
|
146
|
+
const half = MUGlobal.half(paddings);
|
|
147
|
+
return {
|
|
148
|
+
paddingLeft: (theme) => theme.spacing(0.5),
|
|
149
|
+
paddingRight: (theme) => theme.spacing(0.5),
|
|
150
|
+
paddingTop: half,
|
|
151
|
+
marginBottom: half
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
|
|
135
155
|
/**
|
|
136
156
|
* Responsible container
|
|
137
157
|
* @param props Props
|
|
@@ -145,7 +165,9 @@ export function ResponsibleContainer<
|
|
|
145
165
|
const {
|
|
146
166
|
adjustHeight,
|
|
147
167
|
columns,
|
|
168
|
+
containerBoxSx,
|
|
148
169
|
dataGridMinWidth = DataGridExCalColumns(columns).total,
|
|
170
|
+
elementReady,
|
|
149
171
|
fields,
|
|
150
172
|
fieldTemplate,
|
|
151
173
|
height,
|
|
@@ -154,7 +176,7 @@ export function ResponsibleContainer<
|
|
|
154
176
|
mRef,
|
|
155
177
|
paddings = MUGlobal.pagePaddings,
|
|
156
178
|
pullToRefresh = true,
|
|
157
|
-
searchBoxSx =
|
|
179
|
+
searchBoxSx = getDefaultSearchBoxSx(paddings),
|
|
158
180
|
sizeReadyMiliseconds = 0,
|
|
159
181
|
...rest
|
|
160
182
|
} = props;
|
|
@@ -207,6 +229,7 @@ export function ResponsibleContainer<
|
|
|
207
229
|
const lastRect = state.rect;
|
|
208
230
|
|
|
209
231
|
// 32 = scroll bar width
|
|
232
|
+
console.log(lastRect, rect);
|
|
210
233
|
if (
|
|
211
234
|
lastRect != null &&
|
|
212
235
|
state.mounted !== true &&
|
|
@@ -228,7 +251,7 @@ export function ResponsibleContainer<
|
|
|
228
251
|
// Create list
|
|
229
252
|
const [list, showDataGrid] = (() => {
|
|
230
253
|
// No layout
|
|
231
|
-
if (rect == null) return [null,
|
|
254
|
+
if (rect == null) return [null, undefined];
|
|
232
255
|
|
|
233
256
|
// Width
|
|
234
257
|
const width = rect.width;
|
|
@@ -242,7 +265,9 @@ export function ResponsibleContainer<
|
|
|
242
265
|
heightLocal = height;
|
|
243
266
|
} else {
|
|
244
267
|
// Auto calculation
|
|
245
|
-
heightLocal =
|
|
268
|
+
heightLocal =
|
|
269
|
+
document.documentElement.clientHeight -
|
|
270
|
+
Math.round(rect.bottom + 1);
|
|
246
271
|
|
|
247
272
|
const style = window.getComputedStyle(dimensions[0][1]!);
|
|
248
273
|
const boxMargin = parseFloat(style.marginBottom);
|
|
@@ -258,13 +283,23 @@ export function ResponsibleContainer<
|
|
|
258
283
|
delete rest.itemRenderer;
|
|
259
284
|
|
|
260
285
|
return [
|
|
261
|
-
<Box
|
|
286
|
+
<Box
|
|
287
|
+
sx={
|
|
288
|
+
listBoxSx == null
|
|
289
|
+
? undefined
|
|
290
|
+
: listBoxSx(true, heightLocal)
|
|
291
|
+
}
|
|
292
|
+
>
|
|
262
293
|
<DataGridEx<T>
|
|
263
294
|
autoLoad={!hasFields}
|
|
264
295
|
height={heightLocal}
|
|
265
296
|
width={rect.width}
|
|
266
297
|
loadData={localLoadData}
|
|
267
298
|
mRef={mRefs}
|
|
299
|
+
outerRef={(element?: HTMLDivElement) => {
|
|
300
|
+
if (element != null && elementReady)
|
|
301
|
+
elementReady(element, true);
|
|
302
|
+
}}
|
|
268
303
|
columns={columns}
|
|
269
304
|
{...rest}
|
|
270
305
|
/>
|
|
@@ -284,13 +319,22 @@ export function ResponsibleContainer<
|
|
|
284
319
|
delete rest.selectable;
|
|
285
320
|
|
|
286
321
|
return [
|
|
287
|
-
<Box
|
|
322
|
+
<Box
|
|
323
|
+
sx={
|
|
324
|
+
listBoxSx == null
|
|
325
|
+
? undefined
|
|
326
|
+
: listBoxSx(false, heightLocal)
|
|
327
|
+
}
|
|
328
|
+
>
|
|
288
329
|
<ScrollerListEx<T>
|
|
289
330
|
autoLoad={!hasFields}
|
|
290
|
-
width={rect.width}
|
|
291
331
|
height={heightLocal}
|
|
292
332
|
loadData={localLoadData}
|
|
293
333
|
mRef={mRefs}
|
|
334
|
+
oRef={(element) => {
|
|
335
|
+
if (element != null && elementReady)
|
|
336
|
+
elementReady(element, false);
|
|
337
|
+
}}
|
|
294
338
|
{...rest}
|
|
295
339
|
/>
|
|
296
340
|
</Box>,
|
|
@@ -298,23 +342,38 @@ export function ResponsibleContainer<
|
|
|
298
342
|
];
|
|
299
343
|
})();
|
|
300
344
|
|
|
345
|
+
const searchBar = React.useMemo(() => {
|
|
346
|
+
if (!hasFields || showDataGrid == null) return;
|
|
347
|
+
return (
|
|
348
|
+
<SearchBar
|
|
349
|
+
fields={fields}
|
|
350
|
+
onSubmit={onSubmit}
|
|
351
|
+
className={`searchBar${showDataGrid ? 'Grid' : 'List'}`}
|
|
352
|
+
/>
|
|
353
|
+
);
|
|
354
|
+
}, [showDataGrid, hasFields]);
|
|
355
|
+
|
|
301
356
|
// Pull container
|
|
302
|
-
const pullContainer =
|
|
303
|
-
|
|
357
|
+
const pullContainer =
|
|
358
|
+
showDataGrid == null
|
|
359
|
+
? undefined
|
|
360
|
+
: showDataGrid
|
|
304
361
|
? '.DataGridEx-Body'
|
|
305
|
-
: '.ScrollerListEx-Body'
|
|
306
|
-
: undefined;
|
|
362
|
+
: '.ScrollerListEx-Body';
|
|
307
363
|
|
|
308
364
|
// Layout
|
|
309
365
|
return (
|
|
310
|
-
<
|
|
366
|
+
<Box
|
|
367
|
+
sx={
|
|
368
|
+
containerBoxSx == null || showDataGrid == null
|
|
369
|
+
? undefined
|
|
370
|
+
: containerBoxSx(showDataGrid)
|
|
371
|
+
}
|
|
372
|
+
>
|
|
311
373
|
<Stack>
|
|
312
374
|
<Box ref={dimensions[0][0]} sx={searchBoxSx}>
|
|
313
|
-
{
|
|
314
|
-
<SearchBar fields={fields} onSubmit={onSubmit} />
|
|
315
|
-
)}
|
|
375
|
+
{searchBar}
|
|
316
376
|
</Box>
|
|
317
|
-
{list}
|
|
318
377
|
</Stack>
|
|
319
378
|
{pullToRefresh && pullContainer && (
|
|
320
379
|
<PullToRefreshUI
|
|
@@ -330,6 +389,6 @@ export function ResponsibleContainer<
|
|
|
330
389
|
}}
|
|
331
390
|
/>
|
|
332
391
|
)}
|
|
333
|
-
</
|
|
392
|
+
</Box>
|
|
334
393
|
);
|
|
335
394
|
}
|
package/src/mu/SearchBar.tsx
CHANGED
|
@@ -99,18 +99,25 @@ export function SearchBar(props: SearchBarProps) {
|
|
|
99
99
|
// Drawer open / close
|
|
100
100
|
const [open, updateOpen] = React.useState(false);
|
|
101
101
|
|
|
102
|
-
//
|
|
103
|
-
const
|
|
102
|
+
// State
|
|
103
|
+
const state = React.useRef<{
|
|
104
104
|
form?: HTMLFormElement;
|
|
105
105
|
moreForm?: HTMLFormElement;
|
|
106
106
|
submitSeed?: number;
|
|
107
107
|
lastMaxWidth?: number;
|
|
108
|
-
}>({});
|
|
108
|
+
}>({}).current;
|
|
109
|
+
const lastMaxWidth = state.lastMaxWidth ?? 9999;
|
|
109
110
|
|
|
110
111
|
// Watch container
|
|
111
112
|
const { dimensions } = useDimensions(1, (target, rect) => {
|
|
112
113
|
// Same logic from resetButtonRef
|
|
113
|
-
if (
|
|
114
|
+
if (
|
|
115
|
+
rect.width === lastMaxWidth ||
|
|
116
|
+
(index != null &&
|
|
117
|
+
index >= fields.length &&
|
|
118
|
+
rect.width > lastMaxWidth)
|
|
119
|
+
)
|
|
120
|
+
return false;
|
|
114
121
|
|
|
115
122
|
// Len
|
|
116
123
|
const len = target.children.length;
|
|
@@ -143,10 +150,13 @@ export function SearchBar(props: SearchBarProps) {
|
|
|
143
150
|
|
|
144
151
|
// Container width
|
|
145
152
|
let maxWidth = containerRect.width;
|
|
146
|
-
if (
|
|
153
|
+
if (
|
|
154
|
+
maxWidth === lastMaxWidth ||
|
|
155
|
+
(index != null && index >= fields.length && maxWidth > lastMaxWidth)
|
|
156
|
+
) {
|
|
147
157
|
return;
|
|
148
158
|
}
|
|
149
|
-
|
|
159
|
+
state.lastMaxWidth = maxWidth;
|
|
150
160
|
|
|
151
161
|
// More button
|
|
152
162
|
const buttonMore = resetButton.previousElementSibling!;
|
|
@@ -241,7 +251,7 @@ export function SearchBar(props: SearchBarProps) {
|
|
|
241
251
|
const handleForm = (event: React.FormEvent<HTMLFormElement>) => {
|
|
242
252
|
if (event.nativeEvent.cancelable && !event.nativeEvent.composed) return;
|
|
243
253
|
|
|
244
|
-
if (
|
|
254
|
+
if (state.form == null) state.form = event.currentTarget;
|
|
245
255
|
|
|
246
256
|
handleSubmit();
|
|
247
257
|
};
|
|
@@ -255,7 +265,7 @@ export function SearchBar(props: SearchBarProps) {
|
|
|
255
265
|
const moreFormChange = (event: React.FormEvent<HTMLFormElement>) => {
|
|
256
266
|
if (event.nativeEvent.cancelable && !event.nativeEvent.composed) return;
|
|
257
267
|
|
|
258
|
-
if (
|
|
268
|
+
if (state.moreForm == null) state.moreForm = event.currentTarget;
|
|
259
269
|
|
|
260
270
|
handleSubmit();
|
|
261
271
|
};
|
|
@@ -263,8 +273,8 @@ export function SearchBar(props: SearchBarProps) {
|
|
|
263
273
|
// Reset
|
|
264
274
|
const handleReset = () => {
|
|
265
275
|
// Clear form values
|
|
266
|
-
if (
|
|
267
|
-
if (
|
|
276
|
+
if (state.form != null) resetForm(state.form);
|
|
277
|
+
if (state.moreForm != null) resetForm(state.moreForm);
|
|
268
278
|
|
|
269
279
|
// Resubmit
|
|
270
280
|
handleSubmitInstant(true);
|
|
@@ -272,23 +282,23 @@ export function SearchBar(props: SearchBarProps) {
|
|
|
272
282
|
|
|
273
283
|
// Submit
|
|
274
284
|
const handleSubmit = (delay = 480) => {
|
|
275
|
-
if (
|
|
276
|
-
clearTimeout(
|
|
285
|
+
if (state.submitSeed != null) {
|
|
286
|
+
clearTimeout(state.submitSeed);
|
|
277
287
|
}
|
|
278
288
|
|
|
279
289
|
// Delay the change
|
|
280
|
-
|
|
290
|
+
state.submitSeed = window.setTimeout(handleSubmitInstant, delay);
|
|
281
291
|
};
|
|
282
292
|
|
|
283
293
|
// Submit at once
|
|
284
294
|
const handleSubmitInstant = (reset: boolean = false) => {
|
|
285
295
|
// Reset timeout
|
|
286
|
-
|
|
296
|
+
state.submitSeed = undefined;
|
|
287
297
|
|
|
288
298
|
// Prepare data
|
|
289
|
-
const data = new FormData(
|
|
290
|
-
if (
|
|
291
|
-
DomUtils.mergeFormData(data, new FormData(
|
|
299
|
+
const data = new FormData(state.form);
|
|
300
|
+
if (state.moreForm != null) {
|
|
301
|
+
DomUtils.mergeFormData(data, new FormData(state.moreForm));
|
|
292
302
|
}
|
|
293
303
|
|
|
294
304
|
onSubmit(data, reset);
|
|
@@ -296,15 +306,17 @@ export function SearchBar(props: SearchBarProps) {
|
|
|
296
306
|
|
|
297
307
|
// First loading
|
|
298
308
|
React.useEffect(() => {
|
|
299
|
-
// Delayed way
|
|
300
|
-
handleSubmit(100);
|
|
301
|
-
|
|
302
309
|
return () => {
|
|
303
310
|
// Clear the seeds
|
|
304
|
-
if (
|
|
311
|
+
if (state.submitSeed != null) clearTimeout(state.submitSeed);
|
|
305
312
|
};
|
|
306
313
|
}, []);
|
|
307
314
|
|
|
315
|
+
React.useEffect(() => {
|
|
316
|
+
// Delayed way
|
|
317
|
+
handleSubmit(100);
|
|
318
|
+
}, [className]);
|
|
319
|
+
|
|
308
320
|
// Layout
|
|
309
321
|
return (
|
|
310
322
|
<React.Fragment>
|
|
@@ -313,7 +325,7 @@ export function SearchBar(props: SearchBarProps) {
|
|
|
313
325
|
className={className}
|
|
314
326
|
onChange={handleForm}
|
|
315
327
|
ref={(form) => {
|
|
316
|
-
if (form)
|
|
328
|
+
if (form) state.form = form;
|
|
317
329
|
}}
|
|
318
330
|
>
|
|
319
331
|
<Stack
|
|
@@ -374,7 +386,7 @@ export function SearchBar(props: SearchBarProps) {
|
|
|
374
386
|
<form
|
|
375
387
|
onChange={moreFormChange}
|
|
376
388
|
ref={(form) => {
|
|
377
|
-
if (form)
|
|
389
|
+
if (form) state.moreForm = form;
|
|
378
390
|
}}
|
|
379
391
|
>
|
|
380
392
|
<Stack
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { FabBox } from '../FabBox';
|
|
3
3
|
import { ScrollTopFab } from '../ScrollTopFab';
|
|
4
|
-
import { PullToRefreshUI } from '../PullToRefreshUI';
|
|
5
4
|
import { Labels } from '../../app/Labels';
|
|
6
5
|
import { MUGlobal } from '../MUGlobal';
|
|
7
6
|
import { CommonPageProps } from './CommonPageProps';
|
|
@@ -10,11 +9,6 @@ import { ReactAppStateDetector } from '../../app/ReactApp';
|
|
|
10
9
|
import { Container, Fab } from '@mui/material';
|
|
11
10
|
import RefreshIcon from '@mui/icons-material/Refresh';
|
|
12
11
|
|
|
13
|
-
/**
|
|
14
|
-
* Default pull container
|
|
15
|
-
*/
|
|
16
|
-
export const CommonPagePullContainer = '#page-container';
|
|
17
|
-
|
|
18
12
|
/**
|
|
19
13
|
* Default scroll container
|
|
20
14
|
*/
|
|
@@ -41,7 +35,6 @@ export function CommonPage(props: CommonPageProps) {
|
|
|
41
35
|
paddings = MUGlobal.pagePaddings,
|
|
42
36
|
scrollContainer,
|
|
43
37
|
targetFields,
|
|
44
|
-
pullContainer,
|
|
45
38
|
sx = {},
|
|
46
39
|
...rest
|
|
47
40
|
} = props;
|
|
@@ -125,20 +118,6 @@ export function CommonPage(props: CommonPageProps) {
|
|
|
125
118
|
</FabBox>
|
|
126
119
|
{children}
|
|
127
120
|
</Container>
|
|
128
|
-
{onRefresh != null && pullContainer != null && (
|
|
129
|
-
<PullToRefreshUI
|
|
130
|
-
mainElement={pullContainer}
|
|
131
|
-
triggerElement={pullContainer}
|
|
132
|
-
instructionsPullToRefresh={labels.pullToRefresh}
|
|
133
|
-
instructionsReleaseToRefresh={labels.releaseToRefresh}
|
|
134
|
-
instructionsRefreshing={labels.refreshing}
|
|
135
|
-
onRefresh={onRefresh}
|
|
136
|
-
shouldPullToRefresh={() => {
|
|
137
|
-
const container = document.querySelector(pullContainer);
|
|
138
|
-
return !container?.scrollTop;
|
|
139
|
-
}}
|
|
140
|
-
/>
|
|
141
|
-
)}
|
|
142
121
|
</React.Fragment>
|
|
143
122
|
);
|
|
144
123
|
}
|
|
@@ -75,7 +75,8 @@ export function DataGridPage<
|
|
|
75
75
|
React.useEffect(() => {
|
|
76
76
|
if (rect != null && rect.height > 50 && height == null) {
|
|
77
77
|
let gridHeight =
|
|
78
|
-
|
|
78
|
+
document.documentElement.clientHeight -
|
|
79
|
+
Math.round(rect.top + rect.height + 1);
|
|
79
80
|
|
|
80
81
|
const style = window.getComputedStyle(dimensions[0][1]!);
|
|
81
82
|
const paddingBottom = parseFloat(style.paddingBottom);
|
|
@@ -113,18 +114,9 @@ export function DataGridPage<
|
|
|
113
114
|
ref.reset({ data });
|
|
114
115
|
}, [ref, data]);
|
|
115
116
|
|
|
116
|
-
// Pull container id
|
|
117
|
-
const pullContainer = states.element?.parentElement
|
|
118
|
-
? '.DataGridEx-Body'
|
|
119
|
-
: undefined;
|
|
120
|
-
|
|
121
117
|
// Layout
|
|
122
118
|
return (
|
|
123
|
-
<CommonPage
|
|
124
|
-
{...pageProps}
|
|
125
|
-
scrollContainer={states.element}
|
|
126
|
-
pullContainer={pullContainer}
|
|
127
|
-
>
|
|
119
|
+
<CommonPage {...pageProps} scrollContainer={states.element}>
|
|
128
120
|
<Stack>
|
|
129
121
|
<Box
|
|
130
122
|
ref={dimensions[0][0]}
|
|
@@ -85,7 +85,8 @@ export function FixedListPage<
|
|
|
85
85
|
const list = React.useMemo(() => {
|
|
86
86
|
if (rect != null && rect.height > 50) {
|
|
87
87
|
let height =
|
|
88
|
-
|
|
88
|
+
document.documentElement.clientHeight -
|
|
89
|
+
Math.round(rect.top + rect.height + 1);
|
|
89
90
|
|
|
90
91
|
if (adjustHeight != null) {
|
|
91
92
|
height -= adjustHeight(height);
|
|
@@ -113,11 +114,6 @@ export function FixedListPage<
|
|
|
113
114
|
}
|
|
114
115
|
}, [rect]);
|
|
115
116
|
|
|
116
|
-
// Pull container id
|
|
117
|
-
const pullContainer = scrollContainer?.parentElement
|
|
118
|
-
? '#' + scrollContainer?.parentElement.id
|
|
119
|
-
: undefined;
|
|
120
|
-
|
|
121
117
|
const { paddings, ...pageRest } = pageProps;
|
|
122
118
|
|
|
123
119
|
// Layout
|
|
@@ -126,7 +122,6 @@ export function FixedListPage<
|
|
|
126
122
|
{...pageRest}
|
|
127
123
|
paddings={{}}
|
|
128
124
|
scrollContainer={scrollContainer}
|
|
129
|
-
pullContainer={pullContainer}
|
|
130
125
|
>
|
|
131
126
|
<Stack>
|
|
132
127
|
<Box ref={dimensions[0][0]} sx={{ padding: paddings }}>
|
|
@@ -7,11 +7,7 @@ import useCombinedRefs from '../../uses/useCombinedRefs';
|
|
|
7
7
|
import { MUGlobal } from '../MUGlobal';
|
|
8
8
|
import { ScrollerListEx } from '../ScrollerListEx';
|
|
9
9
|
import { SearchBar } from '../SearchBar';
|
|
10
|
-
import {
|
|
11
|
-
CommonPage,
|
|
12
|
-
CommonPagePullContainer,
|
|
13
|
-
CommonPageScrollContainer
|
|
14
|
-
} from './CommonPage';
|
|
10
|
+
import { CommonPage, CommonPageScrollContainer } from './CommonPage';
|
|
15
11
|
import { ListPageProps } from './ListPageProps';
|
|
16
12
|
|
|
17
13
|
/**
|
|
@@ -69,11 +65,7 @@ export function ListPage<
|
|
|
69
65
|
|
|
70
66
|
// Layout
|
|
71
67
|
return (
|
|
72
|
-
<CommonPage
|
|
73
|
-
{...pageProps}
|
|
74
|
-
scrollContainer={CommonPageScrollContainer}
|
|
75
|
-
pullContainer={CommonPagePullContainer}
|
|
76
|
-
>
|
|
68
|
+
<CommonPage {...pageProps} scrollContainer={CommonPageScrollContainer}>
|
|
77
69
|
<Stack>
|
|
78
70
|
<Box
|
|
79
71
|
sx={{
|