@etsoo/materialui 1.3.59 → 1.3.60

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.
Files changed (44) hide show
  1. package/__tests__/ResponsePage.tsx +0 -1
  2. package/lib/ComboBox.d.ts +1 -1
  3. package/lib/ComboBoxMultiple.d.ts +1 -1
  4. package/lib/Tiplist.d.ts +1 -1
  5. package/lib/index.d.ts +0 -3
  6. package/lib/index.js +0 -3
  7. package/lib/pages/CommonPage.d.ts +67 -1
  8. package/lib/pages/DataGridPage.d.ts +1 -1
  9. package/lib/pages/DataGridPageProps.d.ts +3 -3
  10. package/lib/pages/EditPage.d.ts +2 -2
  11. package/lib/pages/FixedListPage.d.ts +1 -1
  12. package/lib/pages/ListPage.d.ts +6 -1
  13. package/lib/pages/ResponsivePage.d.ts +51 -2
  14. package/lib/pages/SearchPageProps.d.ts +3 -3
  15. package/lib/pages/TablePage.d.ts +6 -1
  16. package/lib/pages/ViewPage.d.ts +2 -2
  17. package/package.json +1 -1
  18. package/src/ComboBox.tsx +1 -1
  19. package/src/ComboBoxMultiple.tsx +1 -1
  20. package/src/Tiplist.tsx +1 -1
  21. package/src/index.ts +0 -3
  22. package/src/pages/CommonPage.tsx +80 -2
  23. package/src/pages/DataGridPage.tsx +1 -1
  24. package/src/pages/DataGridPageProps.ts +3 -3
  25. package/src/pages/EditPage.tsx +2 -3
  26. package/src/pages/FixedListPage.tsx +1 -1
  27. package/src/pages/ListPage.tsx +10 -2
  28. package/src/pages/ResponsivePage.tsx +70 -2
  29. package/src/pages/SearchPageProps.ts +3 -3
  30. package/src/pages/TablePage.tsx +16 -2
  31. package/src/pages/ViewPage.tsx +3 -4
  32. package/tsconfig.json +1 -1
  33. package/lib/pages/CommonPageProps.d.ts +0 -67
  34. package/lib/pages/CommonPageProps.js +0 -1
  35. package/lib/pages/ListPageProps.d.ts +0 -7
  36. package/lib/pages/ListPageProps.js +0 -1
  37. package/lib/pages/ResponsivePageProps.d.ts +0 -51
  38. package/lib/pages/ResponsivePageProps.js +0 -1
  39. package/lib/pages/TablePageProps.d.ts +0 -7
  40. package/lib/pages/TablePageProps.js +0 -1
  41. package/src/pages/CommonPageProps.ts +0 -80
  42. package/src/pages/ListPageProps.ts +0 -11
  43. package/src/pages/ResponsivePageProps.ts +0 -70
  44. package/src/pages/TablePageProps.ts +0 -12
@@ -1,7 +1,6 @@
1
1
  import { act, render } from "@testing-library/react";
2
2
  import { MUGlobal, MobileListItemRenderer, ResponsivePage } from "../src";
3
3
  import React from "react";
4
- import { DataTypes } from "@etsoo/shared";
5
4
 
6
5
  global.ResizeObserver = jest.fn().mockImplementation(() => ({
7
6
  observe: jest.fn(),
package/lib/ComboBox.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { DataTypes, IdDefaultType, LabelDefaultType, ListType } from "@etsoo/shared";
2
- import { AutocompleteExtendedProps } from "./AutocompleteExtendedProps";
2
+ import type { AutocompleteExtendedProps } from "./AutocompleteExtendedProps";
3
3
  /**
4
4
  * ComboBox props
5
5
  */
@@ -1,5 +1,5 @@
1
1
  import { DataTypes, IdDefaultType, LabelDefaultType, ListType } from "@etsoo/shared";
2
- import { AutocompleteExtendedProps } from "./AutocompleteExtendedProps";
2
+ import type { AutocompleteExtendedProps } from "./AutocompleteExtendedProps";
3
3
  /**
4
4
  * ComboBox multiple props
5
5
  */
package/lib/Tiplist.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { DataTypes, IdDefaultType, ListType2 } from "@etsoo/shared";
2
- import { AutocompleteExtendedProps } from "./AutocompleteExtendedProps";
2
+ import type { AutocompleteExtendedProps } from "./AutocompleteExtendedProps";
3
3
  /**
4
4
  * Tiplist props
5
5
  */
package/lib/index.d.ts CHANGED
@@ -15,7 +15,6 @@ export * from "./messages/OperationMessageHandler";
15
15
  export * from "./messages/RefreshHandler";
16
16
  export * from "./messages/SignalRUser";
17
17
  export * from "./pages/CommonPage";
18
- export * from "./pages/CommonPageProps";
19
18
  export * from "./pages/DataGridPage";
20
19
  export * from "./pages/DataGridPageProps";
21
20
  export * from "./pages/DrawerHeader";
@@ -23,9 +22,7 @@ export * from "./pages/EditPage";
23
22
  export * from "./pages/FixedListPage";
24
23
  export * from "./pages/LeftDrawer";
25
24
  export * from "./pages/ListPage";
26
- export * from "./pages/ListPageProps";
27
25
  export * from "./pages/ResponsivePage";
28
- export * from "./pages/ResponsivePageProps";
29
26
  export * from "./pages/SearchPageProps";
30
27
  export * from "./pages/TablePage";
31
28
  export * from "./pages/UserMenu";
package/lib/index.js CHANGED
@@ -15,7 +15,6 @@ export * from "./messages/OperationMessageHandler";
15
15
  export * from "./messages/RefreshHandler";
16
16
  export * from "./messages/SignalRUser";
17
17
  export * from "./pages/CommonPage";
18
- export * from "./pages/CommonPageProps";
19
18
  export * from "./pages/DataGridPage";
20
19
  export * from "./pages/DataGridPageProps";
21
20
  export * from "./pages/DrawerHeader";
@@ -23,9 +22,7 @@ export * from "./pages/EditPage";
23
22
  export * from "./pages/FixedListPage";
24
23
  export * from "./pages/LeftDrawer";
25
24
  export * from "./pages/ListPage";
26
- export * from "./pages/ListPageProps";
27
25
  export * from "./pages/ResponsivePage";
28
- export * from "./pages/ResponsivePageProps";
29
26
  export * from "./pages/SearchPageProps";
30
27
  export * from "./pages/TablePage";
31
28
  export * from "./pages/UserMenu";
@@ -1,4 +1,70 @@
1
- import { CommonPageProps } from "./CommonPageProps";
1
+ import React from "react";
2
+ import { ContainerProps, Theme } from "@mui/material";
3
+ import type { CustomFabSize } from "../CustomFabProps";
4
+ import type { IStateUpdate, ListItemReact } from "@etsoo/react";
5
+ import type { UserKey } from "@etsoo/appscript";
6
+ /**
7
+ * Common page props
8
+ * Default container id is 'pageContainer'
9
+ */
10
+ export interface CommonPageProps extends Omit<ContainerProps, "id"> {
11
+ /**
12
+ * Fab buttons
13
+ */
14
+ fabButtons?: React.ReactNode;
15
+ /**
16
+ * Fab size
17
+ */
18
+ fabSize?: CustomFabSize;
19
+ /**
20
+ * Fab flex column direction, undefined to hide it
21
+ */
22
+ fabColumnDirection?: boolean;
23
+ /**
24
+ * Fab padding adjust
25
+ */
26
+ fabPaddingAdjust?: number;
27
+ /**
28
+ * Add panel to the Fab
29
+ */
30
+ fabPanel?: boolean;
31
+ /**
32
+ * Fab lays in the top
33
+ */
34
+ fabTop?: ((theme: Theme, padding: {}) => object) | boolean;
35
+ /**
36
+ * More actions
37
+ */
38
+ moreActions?: ListItemReact[];
39
+ /**
40
+ * On refresh callback, only when authorized = true
41
+ */
42
+ onRefresh?: () => void | PromiseLike<void>;
43
+ /**
44
+ * On page update, when authorized = null or true case, may uses onRefresh
45
+ */
46
+ onUpdate?: () => void | PromiseLike<void>;
47
+ /**
48
+ * On page update, all cases with authorized
49
+ */
50
+ onUpdateAll?: IStateUpdate;
51
+ /**
52
+ * Paddings
53
+ */
54
+ paddings?: Record<string, string | number>;
55
+ /**
56
+ * Scroll container
57
+ */
58
+ scrollContainer?: HTMLElement | object;
59
+ /**
60
+ * Support back click
61
+ */
62
+ supportBack?: boolean;
63
+ /**
64
+ * State last changed fields
65
+ */
66
+ targetFields?: UserKey[];
67
+ }
2
68
  /**
3
69
  * Common page
4
70
  * @param props Props
@@ -1,5 +1,5 @@
1
1
  import { DataTypes } from "@etsoo/shared";
2
- import { DataGridPageProps } from "./DataGridPageProps";
2
+ import type { DataGridPageProps } from "./DataGridPageProps";
3
3
  /**
4
4
  * DataGrid page
5
5
  * @param props Props
@@ -1,6 +1,6 @@
1
- import { DataTypes } from "@etsoo/shared";
2
- import { DataGridExProps } from "../DataGridEx";
3
- import { SearchPageProps } from "./SearchPageProps";
1
+ import type { DataTypes } from "@etsoo/shared";
2
+ import type { DataGridExProps } from "../DataGridEx";
3
+ import type { SearchPageProps } from "./SearchPageProps";
4
4
  /**
5
5
  * DataGrid page props
6
6
  */
@@ -1,6 +1,6 @@
1
1
  import React, { FormEventHandler } from "react";
2
- import { CommonPageProps } from "./CommonPageProps";
3
- import { OperationMessageHandlerAll } from "../messages/OperationMessageHandler";
2
+ import { CommonPageProps } from "./CommonPage";
3
+ import type { OperationMessageHandlerAll } from "../messages/OperationMessageHandler";
4
4
  /**
5
5
  * Add / Edit page props
6
6
  */
@@ -1,5 +1,5 @@
1
1
  import { DataTypes } from "@etsoo/shared";
2
- import { ListPageProps } from "./ListPageProps";
2
+ import type { ListPageProps } from "./ListPage";
3
3
  /**
4
4
  * Fixed height list page
5
5
  * @param props Props
@@ -1,5 +1,10 @@
1
1
  import { DataTypes } from "@etsoo/shared";
2
- import { ListPageProps } from "./ListPageProps";
2
+ import { ScrollerListExProps } from "../ScrollerListEx";
3
+ import type { SearchPageProps } from "./SearchPageProps";
4
+ /**
5
+ * List page props
6
+ */
7
+ export type ListPageProps<T extends object, F extends DataTypes.BasicTemplate> = SearchPageProps<T, F> & Omit<ScrollerListExProps<T>, "loadData">;
3
8
  /**
4
9
  * List page
5
10
  * @param props Props
@@ -1,8 +1,57 @@
1
1
  import { DataTypes } from "@etsoo/shared";
2
- import { ResponsePageProps } from "./ResponsivePageProps";
2
+ import React from "react";
3
+ import type { DataGridPageProps } from "./DataGridPageProps";
4
+ import type { ScrollerListExInnerItemRendererProps, ScrollerListExItemSize } from "../ScrollerListEx";
5
+ import { ListChildComponentProps } from "react-window";
6
+ import { GridMethodRef } from "@etsoo/react";
7
+ import type { OperationMessageHandlerAll } from "../messages/OperationMessageHandler";
8
+ /**
9
+ * Response page props
10
+ */
11
+ export type ResponsePageProps<T extends object, F extends DataTypes.BasicTemplate> = Omit<DataGridPageProps<T, F>, "mRef" | "itemKey" | "onScroll" | "onItemsRendered"> & {
12
+ /**
13
+ *
14
+ * @param height Current height
15
+ * @param isGrid Is displaying DataGrid
16
+ * @returns Adjusted height
17
+ */
18
+ adjustFabHeight?: (height: number, isGrid: boolean) => number;
19
+ /**
20
+ * Min width to show Datagrid
21
+ */
22
+ dataGridMinWidth?: number;
23
+ /**
24
+ * Inner item renderer
25
+ */
26
+ innerItemRenderer: (props: ScrollerListExInnerItemRendererProps<T>) => React.ReactNode;
27
+ /**
28
+ * Item renderer
29
+ */
30
+ itemRenderer?: (props: ListChildComponentProps<T>) => React.ReactElement;
31
+ /**
32
+ * Item size, a function indicates its a variable size list
33
+ */
34
+ itemSize: ScrollerListExItemSize;
35
+ /**
36
+ * Methods
37
+ */
38
+ mRef?: React.MutableRefObject<GridMethodRef<T> | undefined>;
39
+ /**
40
+ * Pull to refresh data
41
+ */
42
+ pullToRefresh?: boolean;
43
+ /**
44
+ * Quick action for double click or click under mobile
45
+ */
46
+ quickAction?: (data: T) => void;
47
+ /**
48
+ * Operation message handler
49
+ */
50
+ operationMessageHandler?: OperationMessageHandlerAll;
51
+ };
3
52
  /**
4
53
  * Fixed height list page
5
54
  * @param props Props
6
55
  * @returns Component
7
56
  */
8
- export declare function ResponsivePage<T extends object, F extends DataTypes.BasicTemplate = DataTypes.BasicTemplate>(props: ResponsePageProps<T, F>): import("react/jsx-runtime").JSX.Element;
57
+ export declare function ResponsivePage<T extends object, F extends DataTypes.BasicTemplate = {}>(props: ResponsePageProps<T, F>): import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
- import { GridJsonData, GridLoader } from "@etsoo/react";
3
- import { DataTypes } from "@etsoo/shared";
4
- import { CommonPageProps } from "./CommonPageProps";
2
+ import type { GridJsonData, GridLoader } from "@etsoo/react";
3
+ import type { DataTypes } from "@etsoo/shared";
4
+ import type { CommonPageProps } from "./CommonPage";
5
5
  /**
6
6
  * Search page props
7
7
  */
@@ -1,5 +1,10 @@
1
1
  import { DataTypes, IdDefaultType } from "@etsoo/shared";
2
- import { TablePageProps } from "./TablePageProps";
2
+ import { TableExProps } from "../TableEx";
3
+ import type { SearchPageProps } from "./SearchPageProps";
4
+ /**
5
+ * Table page props
6
+ */
7
+ export type TablePageProps<T extends object, F extends DataTypes.BasicTemplate, D extends DataTypes.Keys<T>> = SearchPageProps<T, F> & Omit<TableExProps<T, D>, "loadData">;
3
8
  /**
4
9
  * Table page
5
10
  * @param props Props
@@ -2,8 +2,8 @@ import { GridColumnRenderProps, GridDataType } from "@etsoo/react";
2
2
  import { DataTypes } from "@etsoo/shared";
3
3
  import { GridProps } from "@mui/material";
4
4
  import React from "react";
5
- import { CommonPageProps } from "./CommonPageProps";
6
- import { OperationMessageHandlerAll } from "../messages/OperationMessageHandler";
5
+ import { CommonPageProps } from "./CommonPage";
6
+ import type { OperationMessageHandlerAll } from "../messages/OperationMessageHandler";
7
7
  /**
8
8
  * View page grid item properties
9
9
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.3.59",
3
+ "version": "1.3.60",
4
4
  "description": "TypeScript Material-UI Implementation",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
package/src/ComboBox.tsx CHANGED
@@ -15,7 +15,7 @@ import React from "react";
15
15
  import { Utils as SharedUtils } from "@etsoo/shared";
16
16
  import { ReactUtils } from "@etsoo/react";
17
17
  import AddIcon from "@mui/icons-material/Add";
18
- import { AutocompleteExtendedProps } from "./AutocompleteExtendedProps";
18
+ import type { AutocompleteExtendedProps } from "./AutocompleteExtendedProps";
19
19
  import { SearchField } from "./SearchField";
20
20
  import { InputField } from "./InputField";
21
21
  import { globalApp } from "./app/ReactApp";
@@ -16,7 +16,7 @@ import { ReactUtils } from "@etsoo/react";
16
16
 
17
17
  import CheckBoxOutlineBlankIcon from "@mui/icons-material/CheckBoxOutlineBlank";
18
18
  import CheckBoxIcon from "@mui/icons-material/CheckBox";
19
- import { AutocompleteExtendedProps } from "./AutocompleteExtendedProps";
19
+ import type { AutocompleteExtendedProps } from "./AutocompleteExtendedProps";
20
20
  import { SearchField } from "./SearchField";
21
21
  import { InputField } from "./InputField";
22
22
  import { globalApp } from "./app/ReactApp";
package/src/Tiplist.tsx CHANGED
@@ -2,7 +2,7 @@ import { ReactUtils, useDelayedExecutor } from "@etsoo/react";
2
2
  import { DataTypes, IdDefaultType, ListType2 } from "@etsoo/shared";
3
3
  import { Autocomplete, AutocompleteRenderInputParams } from "@mui/material";
4
4
  import React from "react";
5
- import { AutocompleteExtendedProps } from "./AutocompleteExtendedProps";
5
+ import type { AutocompleteExtendedProps } from "./AutocompleteExtendedProps";
6
6
  import { globalApp } from "./app/ReactApp";
7
7
  import { SearchField } from "./SearchField";
8
8
  import { InputField } from "./InputField";
package/src/index.ts CHANGED
@@ -17,7 +17,6 @@ export * from "./messages/RefreshHandler";
17
17
  export * from "./messages/SignalRUser";
18
18
 
19
19
  export * from "./pages/CommonPage";
20
- export * from "./pages/CommonPageProps";
21
20
  export * from "./pages/DataGridPage";
22
21
  export * from "./pages/DataGridPageProps";
23
22
  export * from "./pages/DrawerHeader";
@@ -25,9 +24,7 @@ export * from "./pages/EditPage";
25
24
  export * from "./pages/FixedListPage";
26
25
  export * from "./pages/LeftDrawer";
27
26
  export * from "./pages/ListPage";
28
- export * from "./pages/ListPageProps";
29
27
  export * from "./pages/ResponsivePage";
30
- export * from "./pages/ResponsivePageProps";
31
28
  export * from "./pages/SearchPageProps";
32
29
  export * from "./pages/TablePage";
33
30
  export * from "./pages/UserMenu";
@@ -2,13 +2,91 @@ import React from "react";
2
2
  import { FabBox } from "../FabBox";
3
3
  import { ScrollTopFab } from "../ScrollTopFab";
4
4
  import { MUGlobal } from "../MUGlobal";
5
- import { CommonPageProps } from "./CommonPageProps";
6
5
  import { MoreFab } from "../MoreFab";
7
- import { Container, Fab, useTheme } from "@mui/material";
6
+ import { Container, ContainerProps, Fab, Theme, useTheme } from "@mui/material";
8
7
  import RefreshIcon from "@mui/icons-material/Refresh";
9
8
  import { BackButton } from "../BackButton";
10
9
  import { Labels } from "../app/Labels";
11
10
  import { ReactAppStateDetector } from "../app/ReactApp";
11
+ import type { CustomFabSize } from "../CustomFabProps";
12
+ import type { IStateUpdate, ListItemReact } from "@etsoo/react";
13
+ import type { UserKey } from "@etsoo/appscript";
14
+
15
+ /**
16
+ * Common page props
17
+ * Default container id is 'pageContainer'
18
+ */
19
+ export interface CommonPageProps extends Omit<ContainerProps, "id"> {
20
+ /**
21
+ * Fab buttons
22
+ */
23
+ fabButtons?: React.ReactNode;
24
+
25
+ /**
26
+ * Fab size
27
+ */
28
+ fabSize?: CustomFabSize;
29
+
30
+ /**
31
+ * Fab flex column direction, undefined to hide it
32
+ */
33
+ fabColumnDirection?: boolean;
34
+
35
+ /**
36
+ * Fab padding adjust
37
+ */
38
+ fabPaddingAdjust?: number;
39
+
40
+ /**
41
+ * Add panel to the Fab
42
+ */
43
+ fabPanel?: boolean;
44
+
45
+ /**
46
+ * Fab lays in the top
47
+ */
48
+ fabTop?: ((theme: Theme, padding: {}) => object) | boolean;
49
+
50
+ /**
51
+ * More actions
52
+ */
53
+ moreActions?: ListItemReact[];
54
+
55
+ /**
56
+ * On refresh callback, only when authorized = true
57
+ */
58
+ onRefresh?: () => void | PromiseLike<void>;
59
+
60
+ /**
61
+ * On page update, when authorized = null or true case, may uses onRefresh
62
+ */
63
+ onUpdate?: () => void | PromiseLike<void>;
64
+
65
+ /**
66
+ * On page update, all cases with authorized
67
+ */
68
+ onUpdateAll?: IStateUpdate;
69
+
70
+ /**
71
+ * Paddings
72
+ */
73
+ paddings?: Record<string, string | number>;
74
+
75
+ /**
76
+ * Scroll container
77
+ */
78
+ scrollContainer?: HTMLElement | object;
79
+
80
+ /**
81
+ * Support back click
82
+ */
83
+ supportBack?: boolean;
84
+
85
+ /**
86
+ * State last changed fields
87
+ */
88
+ targetFields?: UserKey[];
89
+ }
12
90
 
13
91
  /**
14
92
  * Common page
@@ -14,7 +14,7 @@ import { DataGridEx } from "../DataGridEx";
14
14
  import { MUGlobal } from "../MUGlobal";
15
15
  import { SearchBar } from "../SearchBar";
16
16
  import { CommonPage } from "./CommonPage";
17
- import { DataGridPageProps } from "./DataGridPageProps";
17
+ import type { DataGridPageProps } from "./DataGridPageProps";
18
18
  import { GridUtils } from "../GridUtils";
19
19
 
20
20
  interface LocalStates<T> {
@@ -1,6 +1,6 @@
1
- import { DataTypes } from "@etsoo/shared";
2
- import { DataGridExProps } from "../DataGridEx";
3
- import { SearchPageProps } from "./SearchPageProps";
1
+ import type { DataTypes } from "@etsoo/shared";
2
+ import type { DataGridExProps } from "../DataGridEx";
3
+ import type { SearchPageProps } from "./SearchPageProps";
4
4
 
5
5
  /**
6
6
  * DataGrid page props
@@ -1,13 +1,12 @@
1
1
  import { Button, Grid } from "@mui/material";
2
2
  import React, { FormEventHandler } from "react";
3
3
  import { MUGlobal } from "../MUGlobal";
4
- import { CommonPage } from "./CommonPage";
5
- import { CommonPageProps } from "./CommonPageProps";
4
+ import { CommonPage, CommonPageProps } from "./CommonPage";
6
5
  import SaveIcon from "@mui/icons-material/Save";
7
6
  import DeleteIcon from "@mui/icons-material/Delete";
8
7
  import { BackButton } from "../BackButton";
9
8
  import { Labels } from "../app/Labels";
10
- import { OperationMessageHandlerAll } from "../messages/OperationMessageHandler";
9
+ import type { OperationMessageHandlerAll } from "../messages/OperationMessageHandler";
11
10
  import { OperationMessageContainer } from "../messages/OperationMessageContainer";
12
11
 
13
12
  /**
@@ -14,8 +14,8 @@ import { MUGlobal } from "../MUGlobal";
14
14
  import { ScrollerListEx } from "../ScrollerListEx";
15
15
  import { SearchBar } from "../SearchBar";
16
16
  import { CommonPage } from "./CommonPage";
17
- import { ListPageProps } from "./ListPageProps";
18
17
  import { GridUtils } from "../GridUtils";
18
+ import type { ListPageProps } from "./ListPage";
19
19
 
20
20
  /**
21
21
  * Fixed height list page
@@ -10,11 +10,19 @@ import { DataTypes } from "@etsoo/shared";
10
10
  import { Box, Stack } from "@mui/material";
11
11
  import React from "react";
12
12
  import { MUGlobal } from "../MUGlobal";
13
- import { ScrollerListEx } from "../ScrollerListEx";
13
+ import { ScrollerListEx, ScrollerListExProps } from "../ScrollerListEx";
14
14
  import { SearchBar } from "../SearchBar";
15
15
  import { CommonPage } from "./CommonPage";
16
- import { ListPageProps } from "./ListPageProps";
17
16
  import { GridUtils } from "../GridUtils";
17
+ import type { SearchPageProps } from "./SearchPageProps";
18
+
19
+ /**
20
+ * List page props
21
+ */
22
+ export type ListPageProps<
23
+ T extends object,
24
+ F extends DataTypes.BasicTemplate
25
+ > = SearchPageProps<T, F> & Omit<ScrollerListExProps<T>, "loadData">;
18
26
 
19
27
  /**
20
28
  * List page
@@ -3,8 +3,76 @@ import React from "react";
3
3
  import { MUGlobal } from "../MUGlobal";
4
4
  import { ResponsibleContainer } from "../ResponsibleContainer";
5
5
  import { CommonPage } from "./CommonPage";
6
- import { ResponsePageProps } from "./ResponsivePageProps";
7
6
  import { OperationMessageContainer } from "../messages/OperationMessageContainer";
7
+ import type { DataGridPageProps } from "./DataGridPageProps";
8
+ import type {
9
+ ScrollerListExInnerItemRendererProps,
10
+ ScrollerListExItemSize
11
+ } from "../ScrollerListEx";
12
+ import { ListChildComponentProps } from "react-window";
13
+ import { GridMethodRef } from "@etsoo/react";
14
+ import type { OperationMessageHandlerAll } from "../messages/OperationMessageHandler";
15
+
16
+ /**
17
+ * Response page props
18
+ */
19
+ export type ResponsePageProps<
20
+ T extends object,
21
+ F extends DataTypes.BasicTemplate
22
+ > = Omit<
23
+ DataGridPageProps<T, F>,
24
+ "mRef" | "itemKey" | "onScroll" | "onItemsRendered"
25
+ > & {
26
+ /**
27
+ *
28
+ * @param height Current height
29
+ * @param isGrid Is displaying DataGrid
30
+ * @returns Adjusted height
31
+ */
32
+ adjustFabHeight?: (height: number, isGrid: boolean) => number;
33
+
34
+ /**
35
+ * Min width to show Datagrid
36
+ */
37
+ dataGridMinWidth?: number;
38
+
39
+ /**
40
+ * Inner item renderer
41
+ */
42
+ innerItemRenderer: (
43
+ props: ScrollerListExInnerItemRendererProps<T>
44
+ ) => React.ReactNode;
45
+
46
+ /**
47
+ * Item renderer
48
+ */
49
+ itemRenderer?: (props: ListChildComponentProps<T>) => React.ReactElement;
50
+
51
+ /**
52
+ * Item size, a function indicates its a variable size list
53
+ */
54
+ itemSize: ScrollerListExItemSize;
55
+
56
+ /**
57
+ * Methods
58
+ */
59
+ mRef?: React.MutableRefObject<GridMethodRef<T> | undefined>;
60
+
61
+ /**
62
+ * Pull to refresh data
63
+ */
64
+ pullToRefresh?: boolean;
65
+
66
+ /**
67
+ * Quick action for double click or click under mobile
68
+ */
69
+ quickAction?: (data: T) => void;
70
+
71
+ /**
72
+ * Operation message handler
73
+ */
74
+ operationMessageHandler?: OperationMessageHandlerAll;
75
+ };
8
76
 
9
77
  /**
10
78
  * Fixed height list page
@@ -13,7 +81,7 @@ import { OperationMessageContainer } from "../messages/OperationMessageContainer
13
81
  */
14
82
  export function ResponsivePage<
15
83
  T extends object,
16
- F extends DataTypes.BasicTemplate = DataTypes.BasicTemplate
84
+ F extends DataTypes.BasicTemplate = {}
17
85
  >(props: ResponsePageProps<T, F>) {
18
86
  // Destruct
19
87
  const { pageProps = {}, operationMessageHandler, ...rest } = props;
@@ -1,6 +1,6 @@
1
- import { GridJsonData, GridLoader } from "@etsoo/react";
2
- import { DataTypes } from "@etsoo/shared";
3
- import { CommonPageProps } from "./CommonPageProps";
1
+ import type { GridJsonData, GridLoader } from "@etsoo/react";
2
+ import type { DataTypes } from "@etsoo/shared";
3
+ import type { CommonPageProps } from "./CommonPage";
4
4
 
5
5
  /**
6
6
  * Search page props
@@ -8,10 +8,24 @@ import { Box, Stack } from "@mui/material";
8
8
  import React from "react";
9
9
  import { MUGlobal } from "../MUGlobal";
10
10
  import { SearchBar } from "../SearchBar";
11
- import { TableEx, TableExMethodRef, TableExMinWidth } from "../TableEx";
11
+ import {
12
+ TableEx,
13
+ TableExMethodRef,
14
+ TableExMinWidth,
15
+ TableExProps
16
+ } from "../TableEx";
12
17
  import { CommonPage } from "./CommonPage";
13
- import { TablePageProps } from "./TablePageProps";
14
18
  import { GridUtils } from "../GridUtils";
19
+ import type { SearchPageProps } from "./SearchPageProps";
20
+
21
+ /**
22
+ * Table page props
23
+ */
24
+ export type TablePageProps<
25
+ T extends object,
26
+ F extends DataTypes.BasicTemplate,
27
+ D extends DataTypes.Keys<T>
28
+ > = SearchPageProps<T, F> & Omit<TableExProps<T, D>, "loadData">;
15
29
 
16
30
  /**
17
31
  * Table page
@@ -17,11 +17,10 @@ import { globalApp } from "../app/ReactApp";
17
17
  import { GridDataFormat } from "../GridDataFormat";
18
18
  import { MUGlobal } from "../MUGlobal";
19
19
  import { PullToRefreshUI } from "../PullToRefreshUI";
20
- import { CommonPage } from "./CommonPage";
21
- import { CommonPageProps } from "./CommonPageProps";
22
- import { OperationMessageHandlerAll } from "../messages/OperationMessageHandler";
20
+ import { CommonPage, CommonPageProps } from "./CommonPage";
21
+ import type { OperationMessageHandlerAll } from "../messages/OperationMessageHandler";
23
22
  import { MessageUtils } from "../messages/MessageUtils";
24
- import { RefreshHandler } from "../messages/RefreshHandler";
23
+ import type { RefreshHandler } from "../messages/RefreshHandler";
25
24
  import { OperationMessageContainer } from "../messages/OperationMessageContainer";
26
25
 
27
26
  /**
package/tsconfig.json CHANGED
@@ -3,7 +3,7 @@
3
3
  /* Visit https://aka.ms/tsconfig.json to read more about this file */
4
4
  "target": "ES2020",
5
5
  "module": "ESNext",
6
- "moduleResolution": "Node10",
6
+ "moduleResolution": "bundler",
7
7
  "allowJs": false,
8
8
  "isolatedModules": true,
9
9
  "outDir": "./lib",
@@ -1,67 +0,0 @@
1
- /// <reference types="react" />
2
- import { UserKey } from "@etsoo/appscript";
3
- import { IStateUpdate, ListItemReact } from "@etsoo/react";
4
- import { ContainerProps, Theme } from "@mui/material";
5
- import { CustomFabSize } from "../CustomFabProps";
6
- /**
7
- * Common page props
8
- * Default container id is 'pageContainer'
9
- */
10
- export interface CommonPageProps extends Omit<ContainerProps, "id"> {
11
- /**
12
- * Fab buttons
13
- */
14
- fabButtons?: React.ReactNode;
15
- /**
16
- * Fab size
17
- */
18
- fabSize?: CustomFabSize;
19
- /**
20
- * Fab flex column direction, undefined to hide it
21
- */
22
- fabColumnDirection?: boolean;
23
- /**
24
- * Fab padding adjust
25
- */
26
- fabPaddingAdjust?: number;
27
- /**
28
- * Add panel to the Fab
29
- */
30
- fabPanel?: boolean;
31
- /**
32
- * Fab lays in the top
33
- */
34
- fabTop?: ((theme: Theme, padding: {}) => object) | boolean;
35
- /**
36
- * More actions
37
- */
38
- moreActions?: ListItemReact[];
39
- /**
40
- * On refresh callback, only when authorized = true
41
- */
42
- onRefresh?: () => void | PromiseLike<void>;
43
- /**
44
- * On page update, when authorized = null or true case, may uses onRefresh
45
- */
46
- onUpdate?: () => void | PromiseLike<void>;
47
- /**
48
- * On page update, all cases with authorized
49
- */
50
- onUpdateAll?: IStateUpdate;
51
- /**
52
- * Paddings
53
- */
54
- paddings?: Record<string, string | number>;
55
- /**
56
- * Scroll container
57
- */
58
- scrollContainer?: HTMLElement | object;
59
- /**
60
- * Support back click
61
- */
62
- supportBack?: boolean;
63
- /**
64
- * State last changed fields
65
- */
66
- targetFields?: UserKey[];
67
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,7 +0,0 @@
1
- import { DataTypes } from "@etsoo/shared";
2
- import { ScrollerListExProps } from "../ScrollerListEx";
3
- import { SearchPageProps } from "./SearchPageProps";
4
- /**
5
- * List page props
6
- */
7
- export type ListPageProps<T extends object, F extends DataTypes.BasicTemplate> = SearchPageProps<T, F> & Omit<ScrollerListExProps<T>, "loadData">;
@@ -1 +0,0 @@
1
- export {};
@@ -1,51 +0,0 @@
1
- /// <reference types="react" />
2
- import { GridMethodRef } from "@etsoo/react";
3
- import { DataTypes } from "@etsoo/shared";
4
- import { ListChildComponentProps } from "react-window";
5
- import { ScrollerListExInnerItemRendererProps, ScrollerListExItemSize } from "../ScrollerListEx";
6
- import { DataGridPageProps } from "./DataGridPageProps";
7
- import { OperationMessageHandlerAll } from "../messages/OperationMessageHandler";
8
- /**
9
- * Response page props
10
- */
11
- export type ResponsePageProps<T extends object, F extends DataTypes.BasicTemplate> = Omit<DataGridPageProps<T, F>, "mRef" | "itemKey" | "onScroll" | "onItemsRendered"> & {
12
- /**
13
- *
14
- * @param height Current height
15
- * @param isGrid Is displaying DataGrid
16
- * @returns Adjusted height
17
- */
18
- adjustFabHeight?: (height: number, isGrid: boolean) => number;
19
- /**
20
- * Min width to show Datagrid
21
- */
22
- dataGridMinWidth?: number;
23
- /**
24
- * Inner item renderer
25
- */
26
- innerItemRenderer: (props: ScrollerListExInnerItemRendererProps<T>) => React.ReactNode;
27
- /**
28
- * Item renderer
29
- */
30
- itemRenderer?: (props: ListChildComponentProps<T>) => React.ReactElement;
31
- /**
32
- * Item size, a function indicates its a variable size list
33
- */
34
- itemSize: ScrollerListExItemSize;
35
- /**
36
- * Methods
37
- */
38
- mRef?: React.MutableRefObject<GridMethodRef<T> | undefined>;
39
- /**
40
- * Pull to refresh data
41
- */
42
- pullToRefresh?: boolean;
43
- /**
44
- * Quick action for double click or click under mobile
45
- */
46
- quickAction?: (data: T) => void;
47
- /**
48
- * Operation message handler
49
- */
50
- operationMessageHandler?: OperationMessageHandlerAll;
51
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,7 +0,0 @@
1
- import { DataTypes } from '@etsoo/shared';
2
- import { TableExProps } from '../TableEx';
3
- import { SearchPageProps } from './SearchPageProps';
4
- /**
5
- * Table page props
6
- */
7
- export type TablePageProps<T extends object, F extends DataTypes.BasicTemplate, D extends DataTypes.Keys<T>> = SearchPageProps<T, F> & Omit<TableExProps<T, D>, 'loadData'>;
@@ -1 +0,0 @@
1
- export {};
@@ -1,80 +0,0 @@
1
- import { UserKey } from "@etsoo/appscript";
2
- import { IStateUpdate, ListItemReact } from "@etsoo/react";
3
- import { ContainerProps, Theme } from "@mui/material";
4
- import { CustomFabSize } from "../CustomFabProps";
5
-
6
- /**
7
- * Common page props
8
- * Default container id is 'pageContainer'
9
- */
10
- export interface CommonPageProps extends Omit<ContainerProps, "id"> {
11
- /**
12
- * Fab buttons
13
- */
14
- fabButtons?: React.ReactNode;
15
-
16
- /**
17
- * Fab size
18
- */
19
- fabSize?: CustomFabSize;
20
-
21
- /**
22
- * Fab flex column direction, undefined to hide it
23
- */
24
- fabColumnDirection?: boolean;
25
-
26
- /**
27
- * Fab padding adjust
28
- */
29
- fabPaddingAdjust?: number;
30
-
31
- /**
32
- * Add panel to the Fab
33
- */
34
- fabPanel?: boolean;
35
-
36
- /**
37
- * Fab lays in the top
38
- */
39
- fabTop?: ((theme: Theme, padding: {}) => object) | boolean;
40
-
41
- /**
42
- * More actions
43
- */
44
- moreActions?: ListItemReact[];
45
-
46
- /**
47
- * On refresh callback, only when authorized = true
48
- */
49
- onRefresh?: () => void | PromiseLike<void>;
50
-
51
- /**
52
- * On page update, when authorized = null or true case, may uses onRefresh
53
- */
54
- onUpdate?: () => void | PromiseLike<void>;
55
-
56
- /**
57
- * On page update, all cases with authorized
58
- */
59
- onUpdateAll?: IStateUpdate;
60
-
61
- /**
62
- * Paddings
63
- */
64
- paddings?: Record<string, string | number>;
65
-
66
- /**
67
- * Scroll container
68
- */
69
- scrollContainer?: HTMLElement | object;
70
-
71
- /**
72
- * Support back click
73
- */
74
- supportBack?: boolean;
75
-
76
- /**
77
- * State last changed fields
78
- */
79
- targetFields?: UserKey[];
80
- }
@@ -1,11 +0,0 @@
1
- import { DataTypes } from "@etsoo/shared";
2
- import { ScrollerListExProps } from "../ScrollerListEx";
3
- import { SearchPageProps } from "./SearchPageProps";
4
-
5
- /**
6
- * List page props
7
- */
8
- export type ListPageProps<
9
- T extends object,
10
- F extends DataTypes.BasicTemplate
11
- > = SearchPageProps<T, F> & Omit<ScrollerListExProps<T>, "loadData">;
@@ -1,70 +0,0 @@
1
- import { GridMethodRef } from "@etsoo/react";
2
- import { DataTypes } from "@etsoo/shared";
3
- import { ListChildComponentProps } from "react-window";
4
- import {
5
- ScrollerListExInnerItemRendererProps,
6
- ScrollerListExItemSize
7
- } from "../ScrollerListEx";
8
- import { DataGridPageProps } from "./DataGridPageProps";
9
- import { OperationMessageHandlerAll } from "../messages/OperationMessageHandler";
10
-
11
- /**
12
- * Response page props
13
- */
14
- export type ResponsePageProps<
15
- T extends object,
16
- F extends DataTypes.BasicTemplate
17
- > = Omit<
18
- DataGridPageProps<T, F>,
19
- "mRef" | "itemKey" | "onScroll" | "onItemsRendered"
20
- > & {
21
- /**
22
- *
23
- * @param height Current height
24
- * @param isGrid Is displaying DataGrid
25
- * @returns Adjusted height
26
- */
27
- adjustFabHeight?: (height: number, isGrid: boolean) => number;
28
-
29
- /**
30
- * Min width to show Datagrid
31
- */
32
- dataGridMinWidth?: number;
33
-
34
- /**
35
- * Inner item renderer
36
- */
37
- innerItemRenderer: (
38
- props: ScrollerListExInnerItemRendererProps<T>
39
- ) => React.ReactNode;
40
-
41
- /**
42
- * Item renderer
43
- */
44
- itemRenderer?: (props: ListChildComponentProps<T>) => React.ReactElement;
45
-
46
- /**
47
- * Item size, a function indicates its a variable size list
48
- */
49
- itemSize: ScrollerListExItemSize;
50
-
51
- /**
52
- * Methods
53
- */
54
- mRef?: React.MutableRefObject<GridMethodRef<T> | undefined>;
55
-
56
- /**
57
- * Pull to refresh data
58
- */
59
- pullToRefresh?: boolean;
60
-
61
- /**
62
- * Quick action for double click or click under mobile
63
- */
64
- quickAction?: (data: T) => void;
65
-
66
- /**
67
- * Operation message handler
68
- */
69
- operationMessageHandler?: OperationMessageHandlerAll;
70
- };
@@ -1,12 +0,0 @@
1
- import { DataTypes } from '@etsoo/shared';
2
- import { TableExProps } from '../TableEx';
3
- import { SearchPageProps } from './SearchPageProps';
4
-
5
- /**
6
- * Table page props
7
- */
8
- export type TablePageProps<
9
- T extends object,
10
- F extends DataTypes.BasicTemplate,
11
- D extends DataTypes.Keys<T>
12
- > = SearchPageProps<T, F> & Omit<TableExProps<T, D>, 'loadData'>;