@etsoo/react 1.4.65 → 1.4.67

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.
@@ -31,11 +31,15 @@ declare type ViewPageFieldType<T> = (string & keyof T) | [string & keyof T, Grid
31
31
  /**
32
32
  * View page props
33
33
  */
34
- export interface ViewPageProps<T extends {}> extends CommonPageProps {
34
+ export interface ViewPageProps<T extends {}> extends Exclude<CommonPageProps, 'children'> {
35
35
  /**
36
36
  * Actions
37
37
  */
38
- actions?: React.ReactNode;
38
+ actions?: (data: T) => React.ReactNode;
39
+ /**
40
+ * Children
41
+ */
42
+ children?: React.ReactNode | ((data: T) => React.ReactNode);
39
43
  /**
40
44
  * Fields to display
41
45
  */
@@ -1,3 +1,4 @@
1
+ import { Utils } from '@etsoo/shared';
1
2
  import { Grid, LinearProgress, Typography } from '@mui/material';
2
3
  import React from 'react';
3
4
  import { globalApp } from '../../app/ReactApp';
@@ -86,6 +87,6 @@ export function ViewPage(props) {
86
87
  ":"),
87
88
  React.createElement(Typography, { variant: "subtitle2" }, itemData)));
88
89
  })),
89
- actions != null && (React.createElement(HBox, { paddingTop: paddings, paddingBottom: paddings }, actions)),
90
+ actions != null && (React.createElement(HBox, { paddingTop: paddings, paddingBottom: paddings }, Utils.getResult(children, data))),
90
91
  children))));
91
92
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/react",
3
- "version": "1.4.65",
3
+ "version": "1.4.67",
4
4
  "description": "TypeScript ReactJs framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -53,8 +53,8 @@
53
53
  "@etsoo/appscript": "^1.2.27",
54
54
  "@etsoo/notificationbase": "^1.1.0",
55
55
  "@etsoo/shared": "^1.1.6",
56
- "@mui/icons-material": "^5.3.0",
57
- "@mui/material": "^5.3.0",
56
+ "@mui/icons-material": "^5.3.1",
57
+ "@mui/material": "^5.3.1",
58
58
  "@reach/router": "^1.3.4",
59
59
  "@types/pica": "^5.1.3",
60
60
  "@types/pulltorefreshjs": "^0.1.5",
@@ -83,8 +83,8 @@
83
83
  "@babel/runtime-corejs3": "^7.16.8",
84
84
  "@types/jest": "^27.4.0",
85
85
  "@types/react-test-renderer": "^17.0.1",
86
- "@typescript-eslint/eslint-plugin": "^5.10.0",
87
- "@typescript-eslint/parser": "^5.10.0",
86
+ "@typescript-eslint/eslint-plugin": "^5.10.1",
87
+ "@typescript-eslint/parser": "^5.10.1",
88
88
  "eslint": "^8.7.0",
89
89
  "eslint-config-airbnb-base": "^15.0.0",
90
90
  "eslint-plugin-import": "^2.25.4",
@@ -1,3 +1,4 @@
1
+ import { Utils } from '@etsoo/shared';
1
2
  import { Grid, GridProps, LinearProgress, Typography } from '@mui/material';
2
3
  import React from 'react';
3
4
  import { globalApp } from '../../app/ReactApp';
@@ -49,11 +50,17 @@ type ViewPageFieldType<T> =
49
50
  /**
50
51
  * View page props
51
52
  */
52
- export interface ViewPageProps<T extends {}> extends CommonPageProps {
53
+ export interface ViewPageProps<T extends {}>
54
+ extends Exclude<CommonPageProps, 'children'> {
53
55
  /**
54
56
  * Actions
55
57
  */
56
- actions?: React.ReactNode;
58
+ actions?: (data: T) => React.ReactNode;
59
+
60
+ /**
61
+ * Children
62
+ */
63
+ children?: React.ReactNode | ((data: T) => React.ReactNode);
57
64
 
58
65
  /**
59
66
  * Fields to display
@@ -205,7 +212,7 @@ export function ViewPage<T extends {}>(props: ViewPageProps<T>) {
205
212
  </Grid>
206
213
  {actions != null && (
207
214
  <HBox paddingTop={paddings} paddingBottom={paddings}>
208
- {actions}
215
+ {Utils.getResult(children, data)}
209
216
  </HBox>
210
217
  )}
211
218
  {children}