@etsoo/materialui 1.4.45 → 1.4.47
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/GridUtils.d.ts +3 -2
- package/lib/GridUtils.js +3 -2
- package/lib/ListMoreDisplay.d.ts +3 -4
- package/lib/ResponsibleContainer.d.ts +6 -7
- package/lib/ResponsibleContainer.js +1 -1
- package/lib/pages/DataGridPage.d.ts +1 -2
- package/lib/pages/DataGridPage.js +1 -1
- package/lib/pages/DataGridPageProps.d.ts +1 -2
- package/lib/pages/FixedListPage.d.ts +1 -2
- package/lib/pages/FixedListPage.js +1 -1
- package/lib/pages/ListPage.d.ts +2 -3
- package/lib/pages/ListPage.js +1 -1
- package/lib/pages/ResponsivePage.d.ts +2 -3
- package/lib/pages/SearchPageProps.d.ts +5 -6
- package/lib/pages/TablePage.d.ts +2 -2
- package/lib/pages/TablePage.js +1 -1
- package/package.json +6 -6
- package/src/GridUtils.ts +7 -7
- package/src/ListMoreDisplay.tsx +6 -9
- package/src/ResponsibleContainer.tsx +10 -14
- package/src/pages/DataGridPage.tsx +5 -7
- package/src/pages/DataGridPageProps.ts +1 -5
- package/src/pages/FixedListPage.tsx +3 -7
- package/src/pages/ListPage.tsx +5 -11
- package/src/pages/ResponsivePage.tsx +4 -9
- package/src/pages/SearchPageProps.ts +8 -9
- package/src/pages/TablePage.tsx +4 -4
package/lib/GridUtils.d.ts
CHANGED
|
@@ -10,9 +10,10 @@ export declare namespace GridUtils {
|
|
|
10
10
|
* @param props Props
|
|
11
11
|
* @param template Field template
|
|
12
12
|
* @param cacheKey Cache key
|
|
13
|
+
* @param keepSource Keep source or not
|
|
13
14
|
* @returns Request data
|
|
14
15
|
*/
|
|
15
|
-
function createLoader<F
|
|
16
|
+
function createLoader<const F>(props: GridLoadDataProps, template?: F, cacheKey?: string, keepSource?: boolean): DataTypes.BasicTemplateType<{ [k in keyof F]: F[k] extends "date" ? "string" | "date" : F[k] extends "string" | "number" | "bigint" | "boolean" | "date" | "number[]" | "bigint[]" | "date[]" | "boolean[]" | "string[]" | "unknown[]" ? F[k] : never; }> & {
|
|
16
17
|
queryPaging: import("@etsoo/appscript").QueryPagingData;
|
|
17
18
|
};
|
|
18
19
|
/**
|
|
@@ -27,7 +28,7 @@ export declare namespace GridUtils {
|
|
|
27
28
|
* @param cacheKey Cache key
|
|
28
29
|
* @returns Result
|
|
29
30
|
*/
|
|
30
|
-
function getSearchData
|
|
31
|
+
function getSearchData(cacheKey?: string): any;
|
|
31
32
|
/**
|
|
32
33
|
* Get update rows handler
|
|
33
34
|
* @param cacheKey Cache key
|
package/lib/GridUtils.js
CHANGED
|
@@ -9,11 +9,12 @@ export var GridUtils;
|
|
|
9
9
|
* @param props Props
|
|
10
10
|
* @param template Field template
|
|
11
11
|
* @param cacheKey Cache key
|
|
12
|
+
* @param keepSource Keep source or not
|
|
12
13
|
* @returns Request data
|
|
13
14
|
*/
|
|
14
|
-
function createLoader(props, template, cacheKey) {
|
|
15
|
+
function createLoader(props, template, cacheKey, keepSource) {
|
|
15
16
|
const { data, ...rest } = props;
|
|
16
|
-
const formData = GridDataGetData(data, template);
|
|
17
|
+
const formData = GridDataGetData(data, template, keepSource);
|
|
17
18
|
if (cacheKey)
|
|
18
19
|
sessionStorage.setItem(`${cacheKey}-searchbar`, JSON.stringify(formData));
|
|
19
20
|
return { ...formData, ...rest };
|
package/lib/ListMoreDisplay.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { DataTypes } from "@etsoo/shared";
|
|
2
1
|
import { CardProps } from "@mui/material";
|
|
3
2
|
import React from "react";
|
|
4
3
|
import { GridData, GridLoader } from "@etsoo/react";
|
|
5
4
|
/**
|
|
6
5
|
* ListMoreDisplay props
|
|
7
6
|
*/
|
|
8
|
-
export interface ListMoreDisplayProps<T extends object
|
|
7
|
+
export interface ListMoreDisplayProps<T extends object> extends Omit<CardProps, "children">, GridLoader<T> {
|
|
9
8
|
/**
|
|
10
9
|
* Batch size to load
|
|
11
10
|
*/
|
|
@@ -17,7 +16,7 @@ export interface ListMoreDisplayProps<T extends object, F extends DataTypes.Basi
|
|
|
17
16
|
/**
|
|
18
17
|
* Search field template
|
|
19
18
|
*/
|
|
20
|
-
fieldTemplate
|
|
19
|
+
readonly fieldTemplate: object;
|
|
21
20
|
/**
|
|
22
21
|
* Header renderer
|
|
23
22
|
*/
|
|
@@ -36,4 +35,4 @@ export interface ListMoreDisplayProps<T extends object, F extends DataTypes.Basi
|
|
|
36
35
|
* @param props Props
|
|
37
36
|
* @returns Component
|
|
38
37
|
*/
|
|
39
|
-
export declare function ListMoreDisplay<T extends object
|
|
38
|
+
export declare function ListMoreDisplay<T extends object>(props: ListMoreDisplayProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { DataTypes } from "@etsoo/shared";
|
|
2
1
|
import { SxProps, Theme } from "@mui/material";
|
|
3
2
|
import React from "react";
|
|
4
3
|
import { ListChildComponentProps } from "react-window";
|
|
5
|
-
import { GridColumn, GridJsonData, GridMethodRef } from "@etsoo/react";
|
|
4
|
+
import { GridColumn, GridJsonData, GridMethodRef, GridTemplateType } from "@etsoo/react";
|
|
6
5
|
import { DataGridExProps } from "./DataGridEx";
|
|
7
6
|
import { ScrollerListExInnerItemRendererProps, ScrollerListExItemSize } from "./ScrollerListEx";
|
|
8
7
|
/**
|
|
9
8
|
* ResponsibleContainer props
|
|
10
9
|
*/
|
|
11
|
-
export type ResponsibleContainerProps<T extends object, F
|
|
10
|
+
export type ResponsibleContainerProps<T extends object, F> = Omit<DataGridExProps<T>, "height" | "itemKey" | "loadData" | "mRef" | "onScroll" | "onItemsRendered" | "onInitLoad" | "onUpdateRows"> & {
|
|
12
11
|
/**
|
|
13
12
|
* Height will be deducted
|
|
14
13
|
* @param height Current calcuated height
|
|
@@ -33,11 +32,11 @@ export type ResponsibleContainerProps<T extends object, F extends DataTypes.Basi
|
|
|
33
32
|
/**
|
|
34
33
|
* Search fields
|
|
35
34
|
*/
|
|
36
|
-
fields?: React.ReactElement[] | ((data:
|
|
35
|
+
fields?: React.ReactElement[] | ((data: GridTemplateType<F>) => React.ReactElement[]);
|
|
37
36
|
/**
|
|
38
37
|
* Search field template
|
|
39
38
|
*/
|
|
40
|
-
fieldTemplate
|
|
39
|
+
readonly fieldTemplate: F;
|
|
41
40
|
/**
|
|
42
41
|
* Grid height
|
|
43
42
|
*/
|
|
@@ -57,7 +56,7 @@ export type ResponsibleContainerProps<T extends object, F extends DataTypes.Basi
|
|
|
57
56
|
/**
|
|
58
57
|
* Load data callback
|
|
59
58
|
*/
|
|
60
|
-
loadData: (data: GridJsonData &
|
|
59
|
+
loadData: (data: GridJsonData & GridTemplateType<F>, lastItem?: T) => PromiseLike<T[] | null | undefined>;
|
|
61
60
|
/**
|
|
62
61
|
* Methods
|
|
63
62
|
*/
|
|
@@ -96,4 +95,4 @@ export type ResponsibleContainerProps<T extends object, F extends DataTypes.Basi
|
|
|
96
95
|
* @param props Props
|
|
97
96
|
* @returns Layout
|
|
98
97
|
*/
|
|
99
|
-
export declare function ResponsibleContainer<T extends object, F
|
|
98
|
+
export declare function ResponsibleContainer<T extends object, F>(props: ResponsibleContainerProps<T, F>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -48,7 +48,7 @@ export function ResponsibleContainer(props) {
|
|
|
48
48
|
// Load data
|
|
49
49
|
const localLoadData = (props, lastItem) => {
|
|
50
50
|
state.mounted = true;
|
|
51
|
-
return loadData(GridUtils.createLoader(props, fieldTemplate, cacheKey), lastItem);
|
|
51
|
+
return loadData(GridUtils.createLoader(props, fieldTemplate, cacheKey, false), lastItem);
|
|
52
52
|
};
|
|
53
53
|
// Search data
|
|
54
54
|
const searchData = GridUtils.getSearchData(cacheKey);
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { DataTypes } from "@etsoo/shared";
|
|
2
1
|
import type { DataGridPageProps } from "./DataGridPageProps";
|
|
3
2
|
/**
|
|
4
3
|
* DataGrid page
|
|
5
4
|
* @param props Props
|
|
6
5
|
* @returns Component
|
|
7
6
|
*/
|
|
8
|
-
export declare function DataGridPage<T extends object, F
|
|
7
|
+
export declare function DataGridPage<T extends object, F>(props: DataGridPageProps<T, F>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -34,7 +34,7 @@ export function DataGridPage(props) {
|
|
|
34
34
|
setStates({ data });
|
|
35
35
|
};
|
|
36
36
|
const localLoadData = (props, lastItem) => {
|
|
37
|
-
return loadData(GridUtils.createLoader(props, fieldTemplate, cacheKey), lastItem);
|
|
37
|
+
return loadData(GridUtils.createLoader(props, fieldTemplate, cacheKey, false), lastItem);
|
|
38
38
|
};
|
|
39
39
|
// Search data
|
|
40
40
|
const searchData = GridUtils.getSearchData(cacheKey);
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import type { DataTypes } from "@etsoo/shared";
|
|
2
1
|
import type { DataGridExProps } from "../DataGridEx";
|
|
3
2
|
import type { SearchPageProps } from "./SearchPageProps";
|
|
4
3
|
/**
|
|
5
4
|
* DataGrid page props
|
|
6
5
|
*/
|
|
7
|
-
export type DataGridPageProps<T extends object, F
|
|
6
|
+
export type DataGridPageProps<T extends object, F> = SearchPageProps<T, F> & Omit<DataGridExProps<T>, "loadData"> & {
|
|
8
7
|
/**
|
|
9
8
|
* Height will be deducted
|
|
10
9
|
* @param height Current calcuated height
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { DataTypes } from "@etsoo/shared";
|
|
2
1
|
import type { ListPageProps } from "./ListPage";
|
|
3
2
|
/**
|
|
4
3
|
* Fixed height list page
|
|
5
4
|
* @param props Props
|
|
6
5
|
* @returns Component
|
|
7
6
|
*/
|
|
8
|
-
export declare function FixedListPage<T extends object, F
|
|
7
|
+
export declare function FixedListPage<T extends object, F>(props: ListPageProps<T, F> & {
|
|
9
8
|
/**
|
|
10
9
|
* Height will be deducted
|
|
11
10
|
* @param height Current calcuated height
|
|
@@ -40,7 +40,7 @@ export function FixedListPage(props) {
|
|
|
40
40
|
reset();
|
|
41
41
|
};
|
|
42
42
|
const localLoadData = (props, lastItem) => {
|
|
43
|
-
return loadData(GridUtils.createLoader(props, fieldTemplate, cacheKey), lastItem);
|
|
43
|
+
return loadData(GridUtils.createLoader(props, fieldTemplate, cacheKey, false), lastItem);
|
|
44
44
|
};
|
|
45
45
|
// Search data
|
|
46
46
|
const searchData = GridUtils.getSearchData(cacheKey);
|
package/lib/pages/ListPage.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { DataTypes } from "@etsoo/shared";
|
|
2
1
|
import { ScrollerListExProps } from "../ScrollerListEx";
|
|
3
2
|
import type { SearchPageProps } from "./SearchPageProps";
|
|
4
3
|
/**
|
|
5
4
|
* List page props
|
|
6
5
|
*/
|
|
7
|
-
export type ListPageProps<T extends object, F
|
|
6
|
+
export type ListPageProps<T extends object, F> = SearchPageProps<T, F> & Omit<ScrollerListExProps<T>, "loadData">;
|
|
8
7
|
/**
|
|
9
8
|
* List page
|
|
10
9
|
* @param props Props
|
|
11
10
|
* @returns Component
|
|
12
11
|
*/
|
|
13
|
-
export declare function ListPage<T extends object, F
|
|
12
|
+
export declare function ListPage<T extends object, F>(props: ListPageProps<T, F>): import("react/jsx-runtime").JSX.Element;
|
package/lib/pages/ListPage.js
CHANGED
|
@@ -38,7 +38,7 @@ export function ListPage(props) {
|
|
|
38
38
|
reset();
|
|
39
39
|
};
|
|
40
40
|
const localLoadData = (props, lastItem) => {
|
|
41
|
-
return loadData(GridUtils.createLoader(props, fieldTemplate, cacheKey), lastItem);
|
|
41
|
+
return loadData(GridUtils.createLoader(props, fieldTemplate, cacheKey, false), lastItem);
|
|
42
42
|
};
|
|
43
43
|
// Search data
|
|
44
44
|
const searchData = GridUtils.getSearchData(cacheKey);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { DataTypes } from "@etsoo/shared";
|
|
2
1
|
import React from "react";
|
|
3
2
|
import type { DataGridPageProps } from "./DataGridPageProps";
|
|
4
3
|
import type { ScrollerListExInnerItemRendererProps, ScrollerListExItemSize } from "../ScrollerListEx";
|
|
@@ -8,7 +7,7 @@ import type { OperationMessageHandlerAll } from "../messages/OperationMessageHan
|
|
|
8
7
|
/**
|
|
9
8
|
* Response page props
|
|
10
9
|
*/
|
|
11
|
-
export type ResponsePageProps<T extends object, F
|
|
10
|
+
export type ResponsePageProps<T extends object, F> = DataGridPageProps<T, F> & {
|
|
12
11
|
/**
|
|
13
12
|
*
|
|
14
13
|
* @param height Current height
|
|
@@ -54,4 +53,4 @@ export type ResponsePageProps<T extends object, F extends DataTypes.BasicTemplat
|
|
|
54
53
|
* @param props Props
|
|
55
54
|
* @returns Component
|
|
56
55
|
*/
|
|
57
|
-
export declare function ResponsivePage<T extends object, F
|
|
56
|
+
export declare function ResponsivePage<T extends object, F>(props: ResponsePageProps<T, F>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import type { GridJsonData, GridLoader } from "@etsoo/react";
|
|
2
|
-
import type { DataTypes } from "@etsoo/shared";
|
|
1
|
+
import type { GridJsonData, GridLoader, GridTemplateType } from "@etsoo/react";
|
|
3
2
|
import type { CommonPageProps } from "./CommonPage";
|
|
4
3
|
/**
|
|
5
4
|
* Search page props
|
|
6
5
|
*/
|
|
7
|
-
export type SearchPageProps<T extends object, F
|
|
6
|
+
export type SearchPageProps<T extends object, F> = Omit<GridLoader<T>, "loadData"> & {
|
|
8
7
|
/**
|
|
9
8
|
* Cache key
|
|
10
9
|
*/
|
|
@@ -16,15 +15,15 @@ export type SearchPageProps<T extends object, F extends DataTypes.BasicTemplate>
|
|
|
16
15
|
/**
|
|
17
16
|
* Search fields
|
|
18
17
|
*/
|
|
19
|
-
fields: React.ReactElement[] | ((data:
|
|
18
|
+
fields: React.ReactElement[] | ((data: GridTemplateType<F>) => React.ReactElement[]);
|
|
20
19
|
/**
|
|
21
20
|
* Search field template
|
|
22
21
|
*/
|
|
23
|
-
fieldTemplate
|
|
22
|
+
readonly fieldTemplate: F;
|
|
24
23
|
/**
|
|
25
24
|
* Load data callback
|
|
26
25
|
*/
|
|
27
|
-
loadData: (data: GridJsonData &
|
|
26
|
+
loadData: (data: GridJsonData & GridTemplateType<F>, lastItem?: T) => PromiseLike<T[] | null | undefined>;
|
|
28
27
|
/**
|
|
29
28
|
* Page props
|
|
30
29
|
*/
|
package/lib/pages/TablePage.d.ts
CHANGED
|
@@ -4,10 +4,10 @@ import type { SearchPageProps } from "./SearchPageProps";
|
|
|
4
4
|
/**
|
|
5
5
|
* Table page props
|
|
6
6
|
*/
|
|
7
|
-
export type TablePageProps<T extends object, F
|
|
7
|
+
export type TablePageProps<T extends object, F, D extends DataTypes.Keys<T>> = SearchPageProps<T, F> & Omit<TableExProps<T, D>, "loadData">;
|
|
8
8
|
/**
|
|
9
9
|
* Table page
|
|
10
10
|
* @param props Props
|
|
11
11
|
* @returns Component
|
|
12
12
|
*/
|
|
13
|
-
export declare function TablePage<T extends object, F
|
|
13
|
+
export declare function TablePage<T extends object, F, D extends DataTypes.Keys<T> = IdDefaultType<T>>(props: TablePageProps<T, F, D>): import("react/jsx-runtime").JSX.Element;
|
package/lib/pages/TablePage.js
CHANGED
|
@@ -37,7 +37,7 @@ export function TablePage(props) {
|
|
|
37
37
|
reset();
|
|
38
38
|
};
|
|
39
39
|
const localLoadData = (props, lastItem) => {
|
|
40
|
-
return loadData(GridUtils.createLoader(props, fieldTemplate, cacheKey), lastItem);
|
|
40
|
+
return loadData(GridUtils.createLoader(props, fieldTemplate, cacheKey, false), lastItem);
|
|
41
41
|
};
|
|
42
42
|
// Search data
|
|
43
43
|
const searchData = GridUtils.getSearchData(cacheKey);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/materialui",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.47",
|
|
4
4
|
"description": "TypeScript Material-UI Implementation",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -30,18 +30,18 @@
|
|
|
30
30
|
},
|
|
31
31
|
"homepage": "https://github.com/ETSOO/ReactMU#readme",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@dnd-kit/core": "^6.3.
|
|
33
|
+
"@dnd-kit/core": "^6.3.1",
|
|
34
34
|
"@dnd-kit/sortable": "^10.0.0",
|
|
35
35
|
"@emotion/css": "^11.13.5",
|
|
36
36
|
"@emotion/react": "^11.13.5",
|
|
37
37
|
"@emotion/styled": "^11.13.5",
|
|
38
38
|
"@etsoo/appscript": "^1.5.78",
|
|
39
39
|
"@etsoo/notificationbase": "^1.1.54",
|
|
40
|
-
"@etsoo/react": "^1.8.
|
|
40
|
+
"@etsoo/react": "^1.8.11",
|
|
41
41
|
"@etsoo/shared": "^1.2.55",
|
|
42
42
|
"@mui/icons-material": "^6.1.10",
|
|
43
43
|
"@mui/material": "^6.1.10",
|
|
44
|
-
"@mui/x-data-grid": "^7.23.
|
|
44
|
+
"@mui/x-data-grid": "^7.23.1",
|
|
45
45
|
"chart.js": "^4.4.7",
|
|
46
46
|
"chartjs-plugin-datalabels": "^2.2.0",
|
|
47
47
|
"eventemitter3": "^5.0.1",
|
|
@@ -55,14 +55,14 @@
|
|
|
55
55
|
"react-imask": "7.6.1"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@babel/cli": "^7.
|
|
58
|
+
"@babel/cli": "^7.26.4",
|
|
59
59
|
"@babel/core": "^7.26.0",
|
|
60
60
|
"@babel/plugin-transform-runtime": "^7.25.9",
|
|
61
61
|
"@babel/preset-env": "^7.26.0",
|
|
62
62
|
"@babel/preset-react": "^7.26.3",
|
|
63
63
|
"@babel/preset-typescript": "^7.26.0",
|
|
64
64
|
"@babel/runtime-corejs3": "^7.26.0",
|
|
65
|
-
"@testing-library/react": "^16.0
|
|
65
|
+
"@testing-library/react": "^16.1.0",
|
|
66
66
|
"@types/pica": "^9.0.4",
|
|
67
67
|
"@types/pulltorefreshjs": "^0.1.7",
|
|
68
68
|
"@types/react": "^18.3.13",
|
package/src/GridUtils.ts
CHANGED
|
@@ -15,15 +15,17 @@ export namespace GridUtils {
|
|
|
15
15
|
* @param props Props
|
|
16
16
|
* @param template Field template
|
|
17
17
|
* @param cacheKey Cache key
|
|
18
|
+
* @param keepSource Keep source or not
|
|
18
19
|
* @returns Request data
|
|
19
20
|
*/
|
|
20
|
-
export function createLoader<F
|
|
21
|
+
export function createLoader<const F>(
|
|
21
22
|
props: GridLoadDataProps,
|
|
22
23
|
template?: F,
|
|
23
|
-
cacheKey?: string
|
|
24
|
+
cacheKey?: string,
|
|
25
|
+
keepSource?: boolean
|
|
24
26
|
) {
|
|
25
27
|
const { data, ...rest } = props;
|
|
26
|
-
const formData = GridDataGetData(data, template);
|
|
28
|
+
const formData = GridDataGetData(data, template, keepSource);
|
|
27
29
|
|
|
28
30
|
if (cacheKey)
|
|
29
31
|
sessionStorage.setItem(`${cacheKey}-searchbar`, JSON.stringify(formData));
|
|
@@ -55,13 +57,11 @@ export namespace GridUtils {
|
|
|
55
57
|
* @param cacheKey Cache key
|
|
56
58
|
* @returns Result
|
|
57
59
|
*/
|
|
58
|
-
export function getSearchData
|
|
59
|
-
cacheKey?: string
|
|
60
|
-
) {
|
|
60
|
+
export function getSearchData(cacheKey?: string) {
|
|
61
61
|
if (cacheKey) {
|
|
62
62
|
const data = sessionStorage.getItem(`${cacheKey}-searchbar`);
|
|
63
63
|
if (data) {
|
|
64
|
-
return JSON.parse(data)
|
|
64
|
+
return JSON.parse(data);
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
}
|
package/src/ListMoreDisplay.tsx
CHANGED
|
@@ -21,10 +21,8 @@ import { globalApp } from "./app/ReactApp";
|
|
|
21
21
|
/**
|
|
22
22
|
* ListMoreDisplay props
|
|
23
23
|
*/
|
|
24
|
-
export interface ListMoreDisplayProps<
|
|
25
|
-
|
|
26
|
-
F extends DataTypes.BasicTemplate = DataTypes.BasicTemplate
|
|
27
|
-
> extends Omit<CardProps, "children">,
|
|
24
|
+
export interface ListMoreDisplayProps<T extends object>
|
|
25
|
+
extends Omit<CardProps, "children">,
|
|
28
26
|
GridLoader<T> {
|
|
29
27
|
/**
|
|
30
28
|
* Batch size to load
|
|
@@ -39,7 +37,7 @@ export interface ListMoreDisplayProps<
|
|
|
39
37
|
/**
|
|
40
38
|
* Search field template
|
|
41
39
|
*/
|
|
42
|
-
fieldTemplate
|
|
40
|
+
readonly fieldTemplate: object;
|
|
43
41
|
|
|
44
42
|
/**
|
|
45
43
|
* Header renderer
|
|
@@ -67,10 +65,9 @@ type states<T> = {
|
|
|
67
65
|
* @param props Props
|
|
68
66
|
* @returns Component
|
|
69
67
|
*/
|
|
70
|
-
export function ListMoreDisplay<
|
|
71
|
-
T
|
|
72
|
-
|
|
73
|
-
>(props: ListMoreDisplayProps<T, F>) {
|
|
68
|
+
export function ListMoreDisplay<T extends object>(
|
|
69
|
+
props: ListMoreDisplayProps<T>
|
|
70
|
+
) {
|
|
74
71
|
// Destruct
|
|
75
72
|
const {
|
|
76
73
|
batchSize = 6,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { DataTypes } from "@etsoo/shared";
|
|
2
1
|
import { Box, Stack, SxProps, Theme, useMediaQuery } from "@mui/material";
|
|
3
2
|
import React from "react";
|
|
4
3
|
import {
|
|
@@ -13,6 +12,7 @@ import {
|
|
|
13
12
|
GridLoadDataProps,
|
|
14
13
|
GridLoaderStates,
|
|
15
14
|
GridMethodRef,
|
|
15
|
+
GridTemplateType,
|
|
16
16
|
ReactUtils,
|
|
17
17
|
ScrollerListRef,
|
|
18
18
|
useCombinedRefs,
|
|
@@ -33,10 +33,7 @@ import { GridUtils } from "./GridUtils";
|
|
|
33
33
|
/**
|
|
34
34
|
* ResponsibleContainer props
|
|
35
35
|
*/
|
|
36
|
-
export type ResponsibleContainerProps<
|
|
37
|
-
T extends object,
|
|
38
|
-
F extends DataTypes.BasicTemplate = DataTypes.BasicTemplate
|
|
39
|
-
> = Omit<
|
|
36
|
+
export type ResponsibleContainerProps<T extends object, F> = Omit<
|
|
40
37
|
DataGridExProps<T>,
|
|
41
38
|
| "height"
|
|
42
39
|
| "itemKey"
|
|
@@ -81,12 +78,12 @@ export type ResponsibleContainerProps<
|
|
|
81
78
|
*/
|
|
82
79
|
fields?:
|
|
83
80
|
| React.ReactElement[]
|
|
84
|
-
| ((data:
|
|
81
|
+
| ((data: GridTemplateType<F>) => React.ReactElement[]);
|
|
85
82
|
|
|
86
83
|
/**
|
|
87
84
|
* Search field template
|
|
88
85
|
*/
|
|
89
|
-
fieldTemplate
|
|
86
|
+
readonly fieldTemplate: F;
|
|
90
87
|
|
|
91
88
|
/**
|
|
92
89
|
* Grid height
|
|
@@ -114,7 +111,7 @@ export type ResponsibleContainerProps<
|
|
|
114
111
|
* Load data callback
|
|
115
112
|
*/
|
|
116
113
|
loadData: (
|
|
117
|
-
data: GridJsonData &
|
|
114
|
+
data: GridJsonData & GridTemplateType<F>,
|
|
118
115
|
lastItem?: T
|
|
119
116
|
) => PromiseLike<T[] | null | undefined>;
|
|
120
117
|
|
|
@@ -185,10 +182,9 @@ function defaultContainerBoxSx(
|
|
|
185
182
|
* @param props Props
|
|
186
183
|
* @returns Layout
|
|
187
184
|
*/
|
|
188
|
-
export function ResponsibleContainer<
|
|
189
|
-
T
|
|
190
|
-
|
|
191
|
-
>(props: ResponsibleContainerProps<T, F>) {
|
|
185
|
+
export function ResponsibleContainer<T extends object, F>(
|
|
186
|
+
props: ResponsibleContainerProps<T, F>
|
|
187
|
+
) {
|
|
192
188
|
// Destruct
|
|
193
189
|
const {
|
|
194
190
|
adjustHeight,
|
|
@@ -241,13 +237,13 @@ export function ResponsibleContainer<
|
|
|
241
237
|
const localLoadData = (props: GridLoadDataProps, lastItem?: T) => {
|
|
242
238
|
state.mounted = true;
|
|
243
239
|
return loadData(
|
|
244
|
-
GridUtils.createLoader
|
|
240
|
+
GridUtils.createLoader(props, fieldTemplate, cacheKey, false),
|
|
245
241
|
lastItem
|
|
246
242
|
);
|
|
247
243
|
};
|
|
248
244
|
|
|
249
245
|
// Search data
|
|
250
|
-
const searchData = GridUtils.getSearchData
|
|
246
|
+
const searchData = GridUtils.getSearchData(cacheKey);
|
|
251
247
|
|
|
252
248
|
// On submit callback
|
|
253
249
|
const onSubmit = (data: FormData, _reset: boolean) => {
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
useCombinedRefs,
|
|
8
8
|
useDimensions
|
|
9
9
|
} from "@etsoo/react";
|
|
10
|
-
import { DataTypes } from "@etsoo/shared";
|
|
11
10
|
import { Box, Stack } from "@mui/material";
|
|
12
11
|
import React from "react";
|
|
13
12
|
import { DataGridEx } from "../DataGridEx";
|
|
@@ -29,10 +28,9 @@ interface LocalStates<T> {
|
|
|
29
28
|
* @param props Props
|
|
30
29
|
* @returns Component
|
|
31
30
|
*/
|
|
32
|
-
export function DataGridPage<
|
|
33
|
-
T
|
|
34
|
-
|
|
35
|
-
>(props: DataGridPageProps<T, F>) {
|
|
31
|
+
export function DataGridPage<T extends object, F>(
|
|
32
|
+
props: DataGridPageProps<T, F>
|
|
33
|
+
) {
|
|
36
34
|
// Destruct
|
|
37
35
|
const {
|
|
38
36
|
adjustHeight,
|
|
@@ -78,13 +76,13 @@ export function DataGridPage<
|
|
|
78
76
|
|
|
79
77
|
const localLoadData = (props: GridLoadDataProps, lastItem?: T) => {
|
|
80
78
|
return loadData(
|
|
81
|
-
GridUtils.createLoader
|
|
79
|
+
GridUtils.createLoader(props, fieldTemplate, cacheKey, false),
|
|
82
80
|
lastItem
|
|
83
81
|
);
|
|
84
82
|
};
|
|
85
83
|
|
|
86
84
|
// Search data
|
|
87
|
-
const searchData = GridUtils.getSearchData
|
|
85
|
+
const searchData = GridUtils.getSearchData(cacheKey);
|
|
88
86
|
|
|
89
87
|
const onInitLoad = (
|
|
90
88
|
ref: VariableSizeGrid<T>
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import type { DataTypes } from "@etsoo/shared";
|
|
2
1
|
import type { DataGridExProps } from "../DataGridEx";
|
|
3
2
|
import type { SearchPageProps } from "./SearchPageProps";
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* DataGrid page props
|
|
7
6
|
*/
|
|
8
|
-
export type DataGridPageProps<
|
|
9
|
-
T extends object,
|
|
10
|
-
F extends DataTypes.BasicTemplate
|
|
11
|
-
> = SearchPageProps<T, F> &
|
|
7
|
+
export type DataGridPageProps<T extends object, F> = SearchPageProps<T, F> &
|
|
12
8
|
Omit<DataGridExProps<T>, "loadData"> & {
|
|
13
9
|
/**
|
|
14
10
|
* Height will be deducted
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
useCombinedRefs,
|
|
8
8
|
useDimensions
|
|
9
9
|
} from "@etsoo/react";
|
|
10
|
-
import { DataTypes } from "@etsoo/shared";
|
|
11
10
|
import { Box, Stack } from "@mui/material";
|
|
12
11
|
import React from "react";
|
|
13
12
|
import { MUGlobal } from "../MUGlobal";
|
|
@@ -22,10 +21,7 @@ import type { ListPageProps } from "./ListPage";
|
|
|
22
21
|
* @param props Props
|
|
23
22
|
* @returns Component
|
|
24
23
|
*/
|
|
25
|
-
export function FixedListPage<
|
|
26
|
-
T extends object,
|
|
27
|
-
F extends DataTypes.BasicTemplate = DataTypes.BasicTemplate
|
|
28
|
-
>(
|
|
24
|
+
export function FixedListPage<T extends object, F>(
|
|
29
25
|
props: ListPageProps<T, F> & {
|
|
30
26
|
/**
|
|
31
27
|
* Height will be deducted
|
|
@@ -90,13 +86,13 @@ export function FixedListPage<
|
|
|
90
86
|
|
|
91
87
|
const localLoadData = (props: GridLoadDataProps, lastItem?: T) => {
|
|
92
88
|
return loadData(
|
|
93
|
-
GridUtils.createLoader
|
|
89
|
+
GridUtils.createLoader(props, fieldTemplate, cacheKey, false),
|
|
94
90
|
lastItem
|
|
95
91
|
);
|
|
96
92
|
};
|
|
97
93
|
|
|
98
94
|
// Search data
|
|
99
|
-
const searchData = GridUtils.getSearchData
|
|
95
|
+
const searchData = GridUtils.getSearchData(cacheKey);
|
|
100
96
|
|
|
101
97
|
const onInitLoad = (
|
|
102
98
|
ref: ScrollerListRef
|
package/src/pages/ListPage.tsx
CHANGED
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
ScrollerListRef,
|
|
7
7
|
useCombinedRefs
|
|
8
8
|
} from "@etsoo/react";
|
|
9
|
-
import { DataTypes } from "@etsoo/shared";
|
|
10
9
|
import { Box, Stack } from "@mui/material";
|
|
11
10
|
import React from "react";
|
|
12
11
|
import { MUGlobal } from "../MUGlobal";
|
|
@@ -19,20 +18,15 @@ import type { SearchPageProps } from "./SearchPageProps";
|
|
|
19
18
|
/**
|
|
20
19
|
* List page props
|
|
21
20
|
*/
|
|
22
|
-
export type ListPageProps<
|
|
23
|
-
T
|
|
24
|
-
F extends DataTypes.BasicTemplate
|
|
25
|
-
> = SearchPageProps<T, F> & Omit<ScrollerListExProps<T>, "loadData">;
|
|
21
|
+
export type ListPageProps<T extends object, F> = SearchPageProps<T, F> &
|
|
22
|
+
Omit<ScrollerListExProps<T>, "loadData">;
|
|
26
23
|
|
|
27
24
|
/**
|
|
28
25
|
* List page
|
|
29
26
|
* @param props Props
|
|
30
27
|
* @returns Component
|
|
31
28
|
*/
|
|
32
|
-
export function ListPage<
|
|
33
|
-
T extends object,
|
|
34
|
-
F extends DataTypes.BasicTemplate = DataTypes.BasicTemplate
|
|
35
|
-
>(props: ListPageProps<T, F>) {
|
|
29
|
+
export function ListPage<T extends object, F>(props: ListPageProps<T, F>) {
|
|
36
30
|
// Destruct
|
|
37
31
|
const {
|
|
38
32
|
fields,
|
|
@@ -78,13 +72,13 @@ export function ListPage<
|
|
|
78
72
|
|
|
79
73
|
const localLoadData = (props: GridLoadDataProps, lastItem?: T) => {
|
|
80
74
|
return loadData(
|
|
81
|
-
GridUtils.createLoader
|
|
75
|
+
GridUtils.createLoader(props, fieldTemplate, cacheKey, false),
|
|
82
76
|
lastItem
|
|
83
77
|
);
|
|
84
78
|
};
|
|
85
79
|
|
|
86
80
|
// Search data
|
|
87
|
-
const searchData = GridUtils.getSearchData
|
|
81
|
+
const searchData = GridUtils.getSearchData(cacheKey);
|
|
88
82
|
|
|
89
83
|
const onInitLoad = (
|
|
90
84
|
ref: ScrollerListRef
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { DataTypes } from "@etsoo/shared";
|
|
2
1
|
import React from "react";
|
|
3
2
|
import { MUGlobal } from "../MUGlobal";
|
|
4
3
|
import { ResponsibleContainer } from "../ResponsibleContainer";
|
|
@@ -16,10 +15,7 @@ import type { OperationMessageHandlerAll } from "../messages/OperationMessageHan
|
|
|
16
15
|
/**
|
|
17
16
|
* Response page props
|
|
18
17
|
*/
|
|
19
|
-
export type ResponsePageProps<
|
|
20
|
-
T extends object,
|
|
21
|
-
F extends DataTypes.BasicTemplate
|
|
22
|
-
> = DataGridPageProps<T, F> & {
|
|
18
|
+
export type ResponsePageProps<T extends object, F> = DataGridPageProps<T, F> & {
|
|
23
19
|
/**
|
|
24
20
|
*
|
|
25
21
|
* @param height Current height
|
|
@@ -76,10 +72,9 @@ export type ResponsePageProps<
|
|
|
76
72
|
* @param props Props
|
|
77
73
|
* @returns Component
|
|
78
74
|
*/
|
|
79
|
-
export function ResponsivePage<
|
|
80
|
-
T
|
|
81
|
-
|
|
82
|
-
>(props: ResponsePageProps<T, F>) {
|
|
75
|
+
export function ResponsivePage<T extends object, F>(
|
|
76
|
+
props: ResponsePageProps<T, F>
|
|
77
|
+
) {
|
|
83
78
|
// Destruct
|
|
84
79
|
const { pageProps = {}, operationMessageHandler, ...rest } = props;
|
|
85
80
|
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import type { GridJsonData, GridLoader } from "@etsoo/react";
|
|
2
|
-
import type { DataTypes } from "@etsoo/shared";
|
|
1
|
+
import type { GridJsonData, GridLoader, GridTemplateType } from "@etsoo/react";
|
|
3
2
|
import type { CommonPageProps } from "./CommonPage";
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* Search page props
|
|
7
6
|
*/
|
|
8
|
-
export type SearchPageProps<
|
|
9
|
-
T
|
|
10
|
-
|
|
11
|
-
>
|
|
7
|
+
export type SearchPageProps<T extends object, F> = Omit<
|
|
8
|
+
GridLoader<T>,
|
|
9
|
+
"loadData"
|
|
10
|
+
> & {
|
|
12
11
|
/**
|
|
13
12
|
* Cache key
|
|
14
13
|
*/
|
|
@@ -24,18 +23,18 @@ export type SearchPageProps<
|
|
|
24
23
|
*/
|
|
25
24
|
fields:
|
|
26
25
|
| React.ReactElement[]
|
|
27
|
-
| ((data:
|
|
26
|
+
| ((data: GridTemplateType<F>) => React.ReactElement[]);
|
|
28
27
|
|
|
29
28
|
/**
|
|
30
29
|
* Search field template
|
|
31
30
|
*/
|
|
32
|
-
fieldTemplate
|
|
31
|
+
readonly fieldTemplate: F;
|
|
33
32
|
|
|
34
33
|
/**
|
|
35
34
|
* Load data callback
|
|
36
35
|
*/
|
|
37
36
|
loadData: (
|
|
38
|
-
data: GridJsonData &
|
|
37
|
+
data: GridJsonData & GridTemplateType<F>,
|
|
39
38
|
lastItem?: T
|
|
40
39
|
) => PromiseLike<T[] | null | undefined>;
|
|
41
40
|
|
package/src/pages/TablePage.tsx
CHANGED
|
@@ -23,7 +23,7 @@ import type { SearchPageProps } from "./SearchPageProps";
|
|
|
23
23
|
*/
|
|
24
24
|
export type TablePageProps<
|
|
25
25
|
T extends object,
|
|
26
|
-
F
|
|
26
|
+
F,
|
|
27
27
|
D extends DataTypes.Keys<T>
|
|
28
28
|
> = SearchPageProps<T, F> & Omit<TableExProps<T, D>, "loadData">;
|
|
29
29
|
|
|
@@ -34,7 +34,7 @@ export type TablePageProps<
|
|
|
34
34
|
*/
|
|
35
35
|
export function TablePage<
|
|
36
36
|
T extends object,
|
|
37
|
-
F
|
|
37
|
+
F,
|
|
38
38
|
D extends DataTypes.Keys<T> = IdDefaultType<T>
|
|
39
39
|
>(props: TablePageProps<T, F, D>) {
|
|
40
40
|
// Destruct
|
|
@@ -85,13 +85,13 @@ export function TablePage<
|
|
|
85
85
|
|
|
86
86
|
const localLoadData = (props: GridLoadDataProps, lastItem?: T) => {
|
|
87
87
|
return loadData(
|
|
88
|
-
GridUtils.createLoader
|
|
88
|
+
GridUtils.createLoader(props, fieldTemplate, cacheKey, false),
|
|
89
89
|
lastItem
|
|
90
90
|
);
|
|
91
91
|
};
|
|
92
92
|
|
|
93
93
|
// Search data
|
|
94
|
-
const searchData = GridUtils.getSearchData
|
|
94
|
+
const searchData = GridUtils.getSearchData(cacheKey);
|
|
95
95
|
|
|
96
96
|
// Total width
|
|
97
97
|
const totalWidth = React.useMemo(
|