@etsoo/materialui 1.1.55 → 1.1.57
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/ResponsibleContainer.d.ts +5 -5
- package/lib/ResponsibleContainer.js +6 -8
- package/lib/SearchBar.js +3 -5
- package/lib/app/ReactApp.d.ts +7 -5
- package/lib/app/ReactApp.js +4 -3
- package/lib/pages/ResponsivePage.d.ts +2 -2
- package/lib/pages/ResponsivePage.js +7 -7
- package/lib/pages/SearchPageProps.d.ts +8 -4
- package/package.json +1 -1
- package/src/ResponsibleContainer.tsx +11 -13
- package/src/SearchBar.tsx +3 -5
- package/src/app/ReactApp.ts +8 -6
- package/src/pages/ResponsivePage.tsx +55 -55
- package/src/pages/SearchPageProps.ts +34 -29
|
@@ -13,11 +13,7 @@ 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
|
*/
|
|
16
|
-
adjustHeight?: (height: number) => number;
|
|
17
|
-
/**
|
|
18
|
-
* Top height
|
|
19
|
-
*/
|
|
20
|
-
topHeight?: number;
|
|
16
|
+
adjustHeight?: (height: number, rect: DOMRect) => number;
|
|
21
17
|
/**
|
|
22
18
|
* Columns
|
|
23
19
|
*/
|
|
@@ -82,6 +78,10 @@ export type ResponsibleContainerProps<T extends object, F extends DataTypes.Basi
|
|
|
82
78
|
* Size ready to read miliseconds span
|
|
83
79
|
*/
|
|
84
80
|
sizeReadyMiliseconds?: number;
|
|
81
|
+
/**
|
|
82
|
+
* SearchBar height
|
|
83
|
+
*/
|
|
84
|
+
searchBarHeight?: number;
|
|
85
85
|
};
|
|
86
86
|
/**
|
|
87
87
|
* Responsible container
|
|
@@ -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,
|
|
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, ...rest } = props;
|
|
26
26
|
// Labels
|
|
27
27
|
const labels = Labels.CommonPage;
|
|
28
28
|
// Refs
|
|
@@ -89,15 +89,13 @@ export function ResponsibleContainer(props) {
|
|
|
89
89
|
else {
|
|
90
90
|
// Auto calculation
|
|
91
91
|
heightLocal =
|
|
92
|
-
document.documentElement.clientHeight -
|
|
93
|
-
(topHeight !== null && topHeight !== void 0 ? topHeight : Math.round(rect.bottom + 1));
|
|
92
|
+
document.documentElement.clientHeight - Math.round(rect.bottom + 1);
|
|
94
93
|
const style = window.getComputedStyle(dimensions[0][1]);
|
|
95
94
|
const boxMargin = parseFloat(style.marginBottom);
|
|
96
95
|
if (!isNaN(boxMargin))
|
|
97
96
|
heightLocal -= 3 * boxMargin; // 1 - Box, 2 - Page bottom
|
|
98
|
-
if (adjustHeight != null)
|
|
99
|
-
heightLocal -= adjustHeight(heightLocal);
|
|
100
|
-
}
|
|
97
|
+
if (adjustHeight != null)
|
|
98
|
+
heightLocal -= adjustHeight(heightLocal, rect);
|
|
101
99
|
}
|
|
102
100
|
if (showDataGrid) {
|
|
103
101
|
// Delete
|
|
@@ -132,8 +130,8 @@ export function ResponsibleContainer(props) {
|
|
|
132
130
|
const searchBar = React.useMemo(() => {
|
|
133
131
|
if (!hasFields || showDataGrid == null)
|
|
134
132
|
return;
|
|
135
|
-
return (React.createElement(SearchBar, { fields: fields, onSubmit: onSubmit, className: `searchBar${showDataGrid ? "Grid" : "List"}
|
|
136
|
-
}, [showDataGrid, hasFields]);
|
|
133
|
+
return (React.createElement(SearchBar, { fields: fields, onSubmit: onSubmit, className: `searchBar${showDataGrid ? "Grid" : "List"}`, innerHeight: searchBarHeight }));
|
|
134
|
+
}, [showDataGrid, hasFields, searchBarHeight]);
|
|
137
135
|
// Pull container
|
|
138
136
|
const pullContainer = showDataGrid == null
|
|
139
137
|
? undefined
|
package/lib/SearchBar.js
CHANGED
|
@@ -52,7 +52,7 @@ const setChildState = (child, enabled) => {
|
|
|
52
52
|
*/
|
|
53
53
|
export function SearchBar(props) {
|
|
54
54
|
// Destruct
|
|
55
|
-
const { className, fields, innerHeight =
|
|
55
|
+
const { className, fields, innerHeight = 45.6, onSubmit } = props;
|
|
56
56
|
// Labels
|
|
57
57
|
const labels = Labels.CommonPage;
|
|
58
58
|
// Spacing
|
|
@@ -223,14 +223,12 @@ export function SearchBar(props) {
|
|
|
223
223
|
if (form)
|
|
224
224
|
state.form = form;
|
|
225
225
|
} },
|
|
226
|
-
React.createElement(Stack, { ref: dimensions[0][0], justifyContent: "center", alignItems: "center", direction: "row", spacing: 1, height: innerHeight, sx: {
|
|
226
|
+
React.createElement(Stack, { ref: dimensions[0][0], justifyContent: "center", alignItems: "center", direction: "row", spacing: 1, height: innerHeight < 1 ? undefined : innerHeight, sx: {
|
|
227
227
|
"& > :not(style)": {
|
|
228
228
|
flexBasis: "auto",
|
|
229
229
|
flexGrow: 0,
|
|
230
230
|
flexShrink: 0,
|
|
231
|
-
maxWidth: "180px"
|
|
232
|
-
},
|
|
233
|
-
"& > :not:first-child": {
|
|
231
|
+
maxWidth: "180px",
|
|
234
232
|
visibility: "hidden"
|
|
235
233
|
},
|
|
236
234
|
"& > .hiddenChild": {
|
package/lib/app/ReactApp.d.ts
CHANGED
|
@@ -61,10 +61,11 @@ export interface IReactAppBase {
|
|
|
61
61
|
*/
|
|
62
62
|
setPageData(data: IPageData): void;
|
|
63
63
|
/**
|
|
64
|
-
* Set page title and
|
|
65
|
-
* @param
|
|
64
|
+
* Set page title and subtitle
|
|
65
|
+
* @param title Page title
|
|
66
|
+
* @param subtitle Page subtitle
|
|
66
67
|
*/
|
|
67
|
-
|
|
68
|
+
setPageTitle(title: string, subtitle?: string): void;
|
|
68
69
|
/**
|
|
69
70
|
* Set page title and data
|
|
70
71
|
* @param title Page title
|
|
@@ -183,10 +184,11 @@ export declare class ReactApp<S extends IAppSettings, D extends IUser, P extends
|
|
|
183
184
|
*/
|
|
184
185
|
setPageData(data: P): void;
|
|
185
186
|
/**
|
|
186
|
-
* Set page title and
|
|
187
|
+
* Set page title and subtitle
|
|
187
188
|
* @param title Page title
|
|
189
|
+
* @param subtitle Page subtitle
|
|
188
190
|
*/
|
|
189
|
-
setPageTitle(title: string): void;
|
|
191
|
+
setPageTitle(title: string, subtitle?: string): void;
|
|
190
192
|
/**
|
|
191
193
|
* Navigate to Url or delta
|
|
192
194
|
* @param url Url or delta
|
package/lib/app/ReactApp.js
CHANGED
|
@@ -206,12 +206,13 @@ export class ReactApp extends CoreApp {
|
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
/**
|
|
209
|
-
* Set page title and
|
|
209
|
+
* Set page title and subtitle
|
|
210
210
|
* @param title Page title
|
|
211
|
+
* @param subtitle Page subtitle
|
|
211
212
|
*/
|
|
212
|
-
setPageTitle(title) {
|
|
213
|
+
setPageTitle(title, subtitle) {
|
|
213
214
|
// Data
|
|
214
|
-
const data = { title };
|
|
215
|
+
const data = { title, subtitle };
|
|
215
216
|
// Dispatch the change
|
|
216
217
|
if (this.pageStateDispatch != null) {
|
|
217
218
|
this.pageStateDispatch({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { DataTypes, IdDefaultType } from
|
|
3
|
-
import { ResponsePageProps } from
|
|
2
|
+
import { DataTypes, IdDefaultType } from "@etsoo/shared";
|
|
3
|
+
import { ResponsePageProps } from "./ResponsivePageProps";
|
|
4
4
|
/**
|
|
5
5
|
* Fixed height list page
|
|
6
6
|
* @param props Props
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { MUGlobal } from
|
|
3
|
-
import { ResponsibleContainer } from
|
|
4
|
-
import { CommonPage } from
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { MUGlobal } from "../MUGlobal";
|
|
3
|
+
import { ResponsibleContainer } from "../ResponsibleContainer";
|
|
4
|
+
import { CommonPage } from "./CommonPage";
|
|
5
5
|
/**
|
|
6
6
|
* Fixed height list page
|
|
7
7
|
* @param props Props
|
|
@@ -24,15 +24,15 @@ export function ResponsivePage(props) {
|
|
|
24
24
|
// .SearchBox keep the same to avoid flick when switching between DataGrid and List
|
|
25
25
|
return {
|
|
26
26
|
paddingTop: paddings,
|
|
27
|
-
|
|
27
|
+
"& .SearchBox": {
|
|
28
28
|
marginLeft: paddings,
|
|
29
29
|
marginRight: paddings,
|
|
30
30
|
marginBottom: hasField ? half : 0
|
|
31
31
|
},
|
|
32
|
-
|
|
32
|
+
"& .ListBox": {
|
|
33
33
|
marginBottom: paddings
|
|
34
34
|
},
|
|
35
|
-
|
|
35
|
+
"& .DataGridBox": {
|
|
36
36
|
marginLeft: paddings,
|
|
37
37
|
marginRight: paddings,
|
|
38
38
|
marginBottom: paddings
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { GridJsonData, GridLoader } from
|
|
3
|
-
import { DataTypes } from
|
|
4
|
-
import { CommonPageProps } from
|
|
2
|
+
import { GridJsonData, GridLoader } from "@etsoo/react";
|
|
3
|
+
import { DataTypes } from "@etsoo/shared";
|
|
4
|
+
import { CommonPageProps } from "./CommonPageProps";
|
|
5
5
|
/**
|
|
6
6
|
* Search page props
|
|
7
7
|
*/
|
|
8
|
-
export type SearchPageProps<T extends object, F extends DataTypes.BasicTemplate> = Omit<GridLoader<T>,
|
|
8
|
+
export type SearchPageProps<T extends object, F extends DataTypes.BasicTemplate> = Omit<GridLoader<T>, "loadData"> & {
|
|
9
9
|
/**
|
|
10
10
|
* Search fields
|
|
11
11
|
*/
|
|
@@ -27,4 +27,8 @@ export type SearchPageProps<T extends object, F extends DataTypes.BasicTemplate>
|
|
|
27
27
|
* @default 100
|
|
28
28
|
*/
|
|
29
29
|
sizeReadyMiliseconds?: number;
|
|
30
|
+
/**
|
|
31
|
+
* SearchBar height
|
|
32
|
+
*/
|
|
33
|
+
searchBarHeight?: number;
|
|
30
34
|
};
|
package/package.json
CHANGED
|
@@ -42,12 +42,7 @@ export type ResponsibleContainerProps<
|
|
|
42
42
|
* Height will be deducted
|
|
43
43
|
* @param height Current calcuated height
|
|
44
44
|
*/
|
|
45
|
-
adjustHeight?: (height: number) => number;
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Top height
|
|
49
|
-
*/
|
|
50
|
-
topHeight?: number;
|
|
45
|
+
adjustHeight?: (height: number, rect: DOMRect) => number;
|
|
51
46
|
|
|
52
47
|
/**
|
|
53
48
|
* Columns
|
|
@@ -136,6 +131,11 @@ export type ResponsibleContainerProps<
|
|
|
136
131
|
* Size ready to read miliseconds span
|
|
137
132
|
*/
|
|
138
133
|
sizeReadyMiliseconds?: number;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* SearchBar height
|
|
137
|
+
*/
|
|
138
|
+
searchBarHeight?: number;
|
|
139
139
|
};
|
|
140
140
|
|
|
141
141
|
interface LocalRefs<T> {
|
|
@@ -177,13 +177,13 @@ export function ResponsibleContainer<
|
|
|
177
177
|
fields,
|
|
178
178
|
fieldTemplate,
|
|
179
179
|
height,
|
|
180
|
-
topHeight,
|
|
181
180
|
loadData,
|
|
182
181
|
mRef,
|
|
183
182
|
paddings = MUGlobal.pagePaddings,
|
|
184
183
|
pullToRefresh = true,
|
|
185
184
|
quickAction,
|
|
186
185
|
sizeReadyMiliseconds = 0,
|
|
186
|
+
searchBarHeight,
|
|
187
187
|
...rest
|
|
188
188
|
} = props;
|
|
189
189
|
|
|
@@ -271,16 +271,13 @@ export function ResponsibleContainer<
|
|
|
271
271
|
} else {
|
|
272
272
|
// Auto calculation
|
|
273
273
|
heightLocal =
|
|
274
|
-
document.documentElement.clientHeight -
|
|
275
|
-
(topHeight ?? Math.round(rect.bottom + 1));
|
|
274
|
+
document.documentElement.clientHeight - Math.round(rect.bottom + 1);
|
|
276
275
|
|
|
277
276
|
const style = window.getComputedStyle(dimensions[0][1]!);
|
|
278
277
|
const boxMargin = parseFloat(style.marginBottom);
|
|
279
278
|
if (!isNaN(boxMargin)) heightLocal -= 3 * boxMargin; // 1 - Box, 2 - Page bottom
|
|
280
279
|
|
|
281
|
-
if (adjustHeight != null)
|
|
282
|
-
heightLocal -= adjustHeight(heightLocal);
|
|
283
|
-
}
|
|
280
|
+
if (adjustHeight != null) heightLocal -= adjustHeight(heightLocal, rect);
|
|
284
281
|
}
|
|
285
282
|
|
|
286
283
|
if (showDataGrid) {
|
|
@@ -344,9 +341,10 @@ export function ResponsibleContainer<
|
|
|
344
341
|
fields={fields}
|
|
345
342
|
onSubmit={onSubmit}
|
|
346
343
|
className={`searchBar${showDataGrid ? "Grid" : "List"}`}
|
|
344
|
+
innerHeight={searchBarHeight}
|
|
347
345
|
/>
|
|
348
346
|
);
|
|
349
|
-
}, [showDataGrid, hasFields]);
|
|
347
|
+
}, [showDataGrid, hasFields, searchBarHeight]);
|
|
350
348
|
|
|
351
349
|
// Pull container
|
|
352
350
|
const pullContainer =
|
package/src/SearchBar.tsx
CHANGED
|
@@ -83,7 +83,7 @@ const setChildState = (child: Element, enabled: boolean) => {
|
|
|
83
83
|
*/
|
|
84
84
|
export function SearchBar(props: SearchBarProps) {
|
|
85
85
|
// Destruct
|
|
86
|
-
const { className, fields, innerHeight =
|
|
86
|
+
const { className, fields, innerHeight = 45.6, onSubmit } = props;
|
|
87
87
|
|
|
88
88
|
// Labels
|
|
89
89
|
const labels = Labels.CommonPage;
|
|
@@ -311,15 +311,13 @@ export function SearchBar(props: SearchBarProps) {
|
|
|
311
311
|
alignItems="center"
|
|
312
312
|
direction="row"
|
|
313
313
|
spacing={1}
|
|
314
|
-
height={innerHeight}
|
|
314
|
+
height={innerHeight < 1 ? undefined : innerHeight}
|
|
315
315
|
sx={{
|
|
316
316
|
"& > :not(style)": {
|
|
317
317
|
flexBasis: "auto",
|
|
318
318
|
flexGrow: 0,
|
|
319
319
|
flexShrink: 0,
|
|
320
|
-
maxWidth: "180px"
|
|
321
|
-
},
|
|
322
|
-
"& > :not:first-child": {
|
|
320
|
+
maxWidth: "180px",
|
|
323
321
|
visibility: "hidden"
|
|
324
322
|
},
|
|
325
323
|
"& > .hiddenChild": {
|
package/src/app/ReactApp.ts
CHANGED
|
@@ -133,10 +133,11 @@ export interface IReactAppBase {
|
|
|
133
133
|
setPageData(data: IPageData): void;
|
|
134
134
|
|
|
135
135
|
/**
|
|
136
|
-
* Set page title and
|
|
137
|
-
* @param
|
|
136
|
+
* Set page title and subtitle
|
|
137
|
+
* @param title Page title
|
|
138
|
+
* @param subtitle Page subtitle
|
|
138
139
|
*/
|
|
139
|
-
|
|
140
|
+
setPageTitle(title: string, subtitle?: string): void;
|
|
140
141
|
|
|
141
142
|
/**
|
|
142
143
|
* Set page title and data
|
|
@@ -425,12 +426,13 @@ export class ReactApp<
|
|
|
425
426
|
}
|
|
426
427
|
|
|
427
428
|
/**
|
|
428
|
-
* Set page title and
|
|
429
|
+
* Set page title and subtitle
|
|
429
430
|
* @param title Page title
|
|
431
|
+
* @param subtitle Page subtitle
|
|
430
432
|
*/
|
|
431
|
-
setPageTitle(title: string): void {
|
|
433
|
+
setPageTitle(title: string, subtitle?: string): void {
|
|
432
434
|
// Data
|
|
433
|
-
const data = { title } as P;
|
|
435
|
+
const data = { title, subtitle } as P;
|
|
434
436
|
|
|
435
437
|
// Dispatch the change
|
|
436
438
|
if (this.pageStateDispatch != null) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { DataTypes, IdDefaultType } from
|
|
2
|
-
import React from
|
|
3
|
-
import { MUGlobal } from
|
|
4
|
-
import { ResponsibleContainer } from
|
|
5
|
-
import { CommonPage } from
|
|
6
|
-
import { ResponsePageProps } from
|
|
1
|
+
import { DataTypes, IdDefaultType } from "@etsoo/shared";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { MUGlobal } from "../MUGlobal";
|
|
4
|
+
import { ResponsibleContainer } from "../ResponsibleContainer";
|
|
5
|
+
import { CommonPage } from "./CommonPage";
|
|
6
|
+
import { ResponsePageProps } from "./ResponsivePageProps";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Fixed height list page
|
|
@@ -11,58 +11,58 @@ import { ResponsePageProps } from './ResponsivePageProps';
|
|
|
11
11
|
* @returns Component
|
|
12
12
|
*/
|
|
13
13
|
export function ResponsivePage<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
T extends object,
|
|
15
|
+
F extends DataTypes.BasicTemplate = DataTypes.BasicTemplate,
|
|
16
|
+
D extends DataTypes.Keys<T> = IdDefaultType<T>
|
|
17
17
|
>(props: ResponsePageProps<T, F, D>) {
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
// Destruct
|
|
19
|
+
const { pageProps = {}, ...rest } = props;
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
pageProps.paddings ??= MUGlobal.pagePaddings;
|
|
22
|
+
const { paddings, fabColumnDirection, ...pageRest } = pageProps;
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
// State
|
|
25
|
+
const [scrollContainer, setScrollContainer] = React.useState<HTMLElement>();
|
|
26
|
+
const [direction, setDirection] = React.useState(fabColumnDirection);
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
28
|
+
// Layout
|
|
29
|
+
return (
|
|
30
|
+
<CommonPage
|
|
31
|
+
{...pageRest}
|
|
32
|
+
paddings={{}}
|
|
33
|
+
scrollContainer={scrollContainer}
|
|
34
|
+
fabColumnDirection={direction}
|
|
35
|
+
>
|
|
36
|
+
<ResponsibleContainer<T, F, D>
|
|
37
|
+
paddings={paddings}
|
|
38
|
+
containerBoxSx={(paddings, hasField, _dataGrid) => {
|
|
39
|
+
// Half
|
|
40
|
+
const half = MUGlobal.half(paddings);
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
42
|
+
// .SearchBox keep the same to avoid flick when switching between DataGrid and List
|
|
43
|
+
return {
|
|
44
|
+
paddingTop: paddings,
|
|
45
|
+
"& .SearchBox": {
|
|
46
|
+
marginLeft: paddings,
|
|
47
|
+
marginRight: paddings,
|
|
48
|
+
marginBottom: hasField ? half : 0
|
|
49
|
+
},
|
|
50
|
+
"& .ListBox": {
|
|
51
|
+
marginBottom: paddings
|
|
52
|
+
},
|
|
53
|
+
"& .DataGridBox": {
|
|
54
|
+
marginLeft: paddings,
|
|
55
|
+
marginRight: paddings,
|
|
56
|
+
marginBottom: paddings
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
}}
|
|
60
|
+
elementReady={(element, isDataGrid) => {
|
|
61
|
+
setDirection(!isDataGrid);
|
|
62
|
+
setScrollContainer(element);
|
|
63
|
+
}}
|
|
64
|
+
{...rest}
|
|
65
|
+
/>
|
|
66
|
+
</CommonPage>
|
|
67
|
+
);
|
|
68
68
|
}
|
|
@@ -1,39 +1,44 @@
|
|
|
1
|
-
import { GridJsonData, GridLoader } from
|
|
2
|
-
import { DataTypes } from
|
|
3
|
-
import { CommonPageProps } from
|
|
1
|
+
import { GridJsonData, GridLoader } from "@etsoo/react";
|
|
2
|
+
import { DataTypes } from "@etsoo/shared";
|
|
3
|
+
import { CommonPageProps } from "./CommonPageProps";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Search page props
|
|
7
7
|
*/
|
|
8
8
|
export type SearchPageProps<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
> = Omit<GridLoader<T>,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
T extends object,
|
|
10
|
+
F extends DataTypes.BasicTemplate
|
|
11
|
+
> = Omit<GridLoader<T>, "loadData"> & {
|
|
12
|
+
/**
|
|
13
|
+
* Search fields
|
|
14
|
+
*/
|
|
15
|
+
fields: React.ReactElement[];
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Search field template
|
|
19
|
+
*/
|
|
20
|
+
fieldTemplate?: F;
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Load data callback
|
|
24
|
+
*/
|
|
25
|
+
loadData: (
|
|
26
|
+
data: GridJsonData & DataTypes.BasicTemplateType<F>
|
|
27
|
+
) => PromiseLike<T[] | null | undefined>;
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Page props
|
|
31
|
+
*/
|
|
32
|
+
pageProps?: CommonPageProps;
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Size ready to read miliseconds span
|
|
36
|
+
* @default 100
|
|
37
|
+
*/
|
|
38
|
+
sizeReadyMiliseconds?: number;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* SearchBar height
|
|
42
|
+
*/
|
|
43
|
+
searchBarHeight?: number;
|
|
39
44
|
};
|