@etsoo/materialui 1.1.54 → 1.1.56
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 +16 -8
- package/lib/ResponsibleContainer.js +17 -19
- package/lib/SearchBar.d.ts +1 -1
- package/lib/SearchBar.js +32 -34
- 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 +12 -4
- package/package.json +4 -4
- package/src/ResponsibleContainer.tsx +369 -362
- package/src/SearchBar.tsx +329 -342
- package/src/app/ReactApp.ts +8 -6
- package/src/pages/ResponsivePage.tsx +55 -55
- package/src/pages/SearchPageProps.ts +39 -29
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,49 @@
|
|
|
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
|
+
* Top height
|
|
42
|
+
*/
|
|
43
|
+
topHeight?: number;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* SearchBar height
|
|
47
|
+
*/
|
|
48
|
+
searchBarHeight?: number;
|
|
39
49
|
};
|