@etsoo/materialui 1.4.75 → 1.4.77
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/cjs/ButtonPopover.d.ts +5 -0
- package/lib/cjs/ButtonPopover.js +5 -4
- package/lib/cjs/app/ReactApp.d.ts +1 -1
- package/lib/cjs/app/ReactApp.js +2 -1
- package/lib/cjs/app/ServiceApp.js +2 -1
- package/lib/cjs/pages/ViewPage.js +1 -2
- package/lib/mjs/ButtonPopover.d.ts +5 -0
- package/lib/mjs/ButtonPopover.js +5 -4
- package/lib/mjs/app/ReactApp.d.ts +1 -1
- package/lib/mjs/app/ReactApp.js +2 -1
- package/lib/mjs/app/ServiceApp.js +2 -1
- package/lib/mjs/pages/ViewPage.js +1 -2
- package/package.json +12 -12
- package/src/ButtonPopover.tsx +13 -6
- package/src/app/ReactApp.ts +2 -1
- package/src/app/ServiceApp.ts +2 -1
- package/src/pages/ViewPage.tsx +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PopoverOrigin } from "@mui/material";
|
|
1
2
|
import React from "react";
|
|
2
3
|
/**
|
|
3
4
|
* Button popover props
|
|
@@ -20,6 +21,10 @@ export type ButtonPopoverProps<T> = {
|
|
|
20
21
|
* @returns Data promise
|
|
21
22
|
*/
|
|
22
23
|
loadData?: () => Promise<T | undefined>;
|
|
24
|
+
/**
|
|
25
|
+
* Position
|
|
26
|
+
*/
|
|
27
|
+
position?: PopoverOrigin["horizontal"];
|
|
23
28
|
};
|
|
24
29
|
/**
|
|
25
30
|
* Button popover component
|
package/lib/cjs/ButtonPopover.js
CHANGED
|
@@ -14,7 +14,7 @@ const react_1 = __importDefault(require("react"));
|
|
|
14
14
|
*/
|
|
15
15
|
function ButtonPopover(props) {
|
|
16
16
|
// Destruct
|
|
17
|
-
const { button, children, loadData } = props;
|
|
17
|
+
const { button, children, loadData, position = "right" } = props;
|
|
18
18
|
// States
|
|
19
19
|
const [anchorEl, setAnchorEl] = react_1.default.useState(null);
|
|
20
20
|
const [data, setData] = react_1.default.useState(null);
|
|
@@ -37,8 +37,9 @@ function ButtonPopover(props) {
|
|
|
37
37
|
const handleClose = () => {
|
|
38
38
|
setAnchorEl(null);
|
|
39
39
|
};
|
|
40
|
+
const styles = position === "left" ? { left: 14 } : { right: 14 };
|
|
40
41
|
// Layout
|
|
41
|
-
return ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [button((handler) => setAnchorEl(handler)), (0, jsx_runtime_1.jsx)(material_1.Popover, { anchorEl: anchorEl, open: open, onClose: handleClose, onClick: handleClose, transformOrigin: { horizontal:
|
|
42
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [button((handler) => setAnchorEl(handler)), (0, jsx_runtime_1.jsx)(material_1.Popover, { anchorEl: anchorEl, open: open, onClose: handleClose, onClick: handleClose, transformOrigin: { horizontal: position, vertical: "top" }, anchorOrigin: { horizontal: position, vertical: "bottom" }, slotProps: {
|
|
42
43
|
paper: {
|
|
43
44
|
elevation: 0,
|
|
44
45
|
sx: {
|
|
@@ -50,12 +51,12 @@ function ButtonPopover(props) {
|
|
|
50
51
|
display: "block",
|
|
51
52
|
position: "absolute",
|
|
52
53
|
top: 0,
|
|
53
|
-
right: 14,
|
|
54
54
|
width: 10,
|
|
55
55
|
height: 10,
|
|
56
56
|
bgcolor: "background.paper",
|
|
57
57
|
transform: "translateY(-50%) rotate(45deg)",
|
|
58
|
-
zIndex: 0
|
|
58
|
+
zIndex: 0,
|
|
59
|
+
...styles
|
|
59
60
|
}
|
|
60
61
|
}
|
|
61
62
|
}
|
package/lib/cjs/app/ReactApp.js
CHANGED
|
@@ -220,7 +220,8 @@ class ReactApp extends appscript_1.CoreApp {
|
|
|
220
220
|
}
|
|
221
221
|
// Refresh token
|
|
222
222
|
await this.refreshToken({
|
|
223
|
-
showLoading: data?.showLoading
|
|
223
|
+
showLoading: data?.showLoading,
|
|
224
|
+
timeZone: this.getTimeZone()
|
|
224
225
|
}, (result) => {
|
|
225
226
|
if (result === true) {
|
|
226
227
|
onSuccess?.();
|
|
@@ -202,7 +202,8 @@ class ServiceApp extends ReactApp_1.ReactApp {
|
|
|
202
202
|
// Call the core system API refresh token
|
|
203
203
|
const data = await this.apiRefreshTokenData(this.coreApi, {
|
|
204
204
|
token: coreTokenDecrypted,
|
|
205
|
-
appId: this.settings.appId
|
|
205
|
+
appId: this.settings.appId,
|
|
206
|
+
timeZone: this.getTimeZone()
|
|
206
207
|
});
|
|
207
208
|
if (data == null)
|
|
208
209
|
return;
|
|
@@ -118,8 +118,7 @@ function ViewPage(props) {
|
|
|
118
118
|
// Load data
|
|
119
119
|
const refresh = react_3.default.useCallback(async () => {
|
|
120
120
|
const result = await loadData();
|
|
121
|
-
|
|
122
|
-
return;
|
|
121
|
+
// When failed or no data returned, show the loading bar
|
|
123
122
|
setData(result);
|
|
124
123
|
}, [loadData]);
|
|
125
124
|
react_3.default.useEffect(() => {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PopoverOrigin } from "@mui/material";
|
|
1
2
|
import React from "react";
|
|
2
3
|
/**
|
|
3
4
|
* Button popover props
|
|
@@ -20,6 +21,10 @@ export type ButtonPopoverProps<T> = {
|
|
|
20
21
|
* @returns Data promise
|
|
21
22
|
*/
|
|
22
23
|
loadData?: () => Promise<T | undefined>;
|
|
24
|
+
/**
|
|
25
|
+
* Position
|
|
26
|
+
*/
|
|
27
|
+
position?: PopoverOrigin["horizontal"];
|
|
23
28
|
};
|
|
24
29
|
/**
|
|
25
30
|
* Button popover component
|
package/lib/mjs/ButtonPopover.js
CHANGED
|
@@ -8,7 +8,7 @@ import React from "react";
|
|
|
8
8
|
*/
|
|
9
9
|
export function ButtonPopover(props) {
|
|
10
10
|
// Destruct
|
|
11
|
-
const { button, children, loadData } = props;
|
|
11
|
+
const { button, children, loadData, position = "right" } = props;
|
|
12
12
|
// States
|
|
13
13
|
const [anchorEl, setAnchorEl] = React.useState(null);
|
|
14
14
|
const [data, setData] = React.useState(null);
|
|
@@ -31,8 +31,9 @@ export function ButtonPopover(props) {
|
|
|
31
31
|
const handleClose = () => {
|
|
32
32
|
setAnchorEl(null);
|
|
33
33
|
};
|
|
34
|
+
const styles = position === "left" ? { left: 14 } : { right: 14 };
|
|
34
35
|
// Layout
|
|
35
|
-
return (_jsxs(React.Fragment, { children: [button((handler) => setAnchorEl(handler)), _jsx(Popover, { anchorEl: anchorEl, open: open, onClose: handleClose, onClick: handleClose, transformOrigin: { horizontal:
|
|
36
|
+
return (_jsxs(React.Fragment, { children: [button((handler) => setAnchorEl(handler)), _jsx(Popover, { anchorEl: anchorEl, open: open, onClose: handleClose, onClick: handleClose, transformOrigin: { horizontal: position, vertical: "top" }, anchorOrigin: { horizontal: position, vertical: "bottom" }, slotProps: {
|
|
36
37
|
paper: {
|
|
37
38
|
elevation: 0,
|
|
38
39
|
sx: {
|
|
@@ -44,12 +45,12 @@ export function ButtonPopover(props) {
|
|
|
44
45
|
display: "block",
|
|
45
46
|
position: "absolute",
|
|
46
47
|
top: 0,
|
|
47
|
-
right: 14,
|
|
48
48
|
width: 10,
|
|
49
49
|
height: 10,
|
|
50
50
|
bgcolor: "background.paper",
|
|
51
51
|
transform: "translateY(-50%) rotate(45deg)",
|
|
52
|
-
zIndex: 0
|
|
52
|
+
zIndex: 0,
|
|
53
|
+
...styles
|
|
53
54
|
}
|
|
54
55
|
}
|
|
55
56
|
}
|
package/lib/mjs/app/ReactApp.js
CHANGED
|
@@ -212,7 +212,8 @@ export class ReactApp extends CoreApp {
|
|
|
212
212
|
}
|
|
213
213
|
// Refresh token
|
|
214
214
|
await this.refreshToken({
|
|
215
|
-
showLoading: data?.showLoading
|
|
215
|
+
showLoading: data?.showLoading,
|
|
216
|
+
timeZone: this.getTimeZone()
|
|
216
217
|
}, (result) => {
|
|
217
218
|
if (result === true) {
|
|
218
219
|
onSuccess?.();
|
|
@@ -199,7 +199,8 @@ export class ServiceApp extends ReactApp {
|
|
|
199
199
|
// Call the core system API refresh token
|
|
200
200
|
const data = await this.apiRefreshTokenData(this.coreApi, {
|
|
201
201
|
token: coreTokenDecrypted,
|
|
202
|
-
appId: this.settings.appId
|
|
202
|
+
appId: this.settings.appId,
|
|
203
|
+
timeZone: this.getTimeZone()
|
|
203
204
|
});
|
|
204
205
|
if (data == null)
|
|
205
206
|
return;
|
|
@@ -111,8 +111,7 @@ export function ViewPage(props) {
|
|
|
111
111
|
// Load data
|
|
112
112
|
const refresh = React.useCallback(async () => {
|
|
113
113
|
const result = await loadData();
|
|
114
|
-
|
|
115
|
-
return;
|
|
114
|
+
// When failed or no data returned, show the loading bar
|
|
116
115
|
setData(result);
|
|
117
116
|
}, [loadData]);
|
|
118
117
|
React.useEffect(() => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/materialui",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.77",
|
|
4
4
|
"description": "TypeScript Material-UI Implementation",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/mjs/index.js",
|
|
@@ -40,13 +40,13 @@
|
|
|
40
40
|
"@dnd-kit/sortable": "^10.0.0",
|
|
41
41
|
"@emotion/react": "^11.14.0",
|
|
42
42
|
"@emotion/styled": "^11.14.0",
|
|
43
|
-
"@etsoo/appscript": "^1.5.
|
|
44
|
-
"@etsoo/notificationbase": "^1.1.
|
|
43
|
+
"@etsoo/appscript": "^1.5.97",
|
|
44
|
+
"@etsoo/notificationbase": "^1.1.58",
|
|
45
45
|
"@etsoo/react": "^1.8.26",
|
|
46
|
-
"@etsoo/shared": "^1.2.
|
|
47
|
-
"@mui/icons-material": "^6.
|
|
48
|
-
"@mui/material": "^6.
|
|
49
|
-
"@mui/x-data-grid": "^7.
|
|
46
|
+
"@etsoo/shared": "^1.2.60",
|
|
47
|
+
"@mui/icons-material": "^6.4.2",
|
|
48
|
+
"@mui/material": "^6.4.2",
|
|
49
|
+
"@mui/x-data-grid": "^7.24.1",
|
|
50
50
|
"chart.js": "^4.4.7",
|
|
51
51
|
"chartjs-plugin-datalabels": "^2.2.0",
|
|
52
52
|
"eventemitter3": "^5.0.1",
|
|
@@ -66,13 +66,13 @@
|
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@babel/cli": "^7.26.4",
|
|
69
|
-
"@babel/core": "^7.26.
|
|
69
|
+
"@babel/core": "^7.26.7",
|
|
70
70
|
"@babel/plugin-transform-runtime": "^7.25.9",
|
|
71
|
-
"@babel/preset-env": "^7.26.
|
|
71
|
+
"@babel/preset-env": "^7.26.7",
|
|
72
72
|
"@babel/preset-react": "^7.26.3",
|
|
73
73
|
"@babel/preset-typescript": "^7.26.0",
|
|
74
|
-
"@babel/runtime-corejs3": "^7.26.
|
|
75
|
-
"@testing-library/react": "^16.
|
|
74
|
+
"@babel/runtime-corejs3": "^7.26.7",
|
|
75
|
+
"@testing-library/react": "^16.2.0",
|
|
76
76
|
"@types/pica": "^9.0.5",
|
|
77
77
|
"@types/pulltorefreshjs": "^0.1.7",
|
|
78
78
|
"@types/react": "^18.3.18",
|
|
@@ -83,6 +83,6 @@
|
|
|
83
83
|
"@vitejs/plugin-react": "^4.3.4",
|
|
84
84
|
"jsdom": "^26.0.0",
|
|
85
85
|
"typescript": "^5.7.3",
|
|
86
|
-
"vitest": "^
|
|
86
|
+
"vitest": "^3.0.4"
|
|
87
87
|
}
|
|
88
88
|
}
|
package/src/ButtonPopover.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Popover } from "@mui/material";
|
|
1
|
+
import { Popover, PopoverOrigin } from "@mui/material";
|
|
2
2
|
import React from "react";
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -24,6 +24,11 @@ export type ButtonPopoverProps<T> = {
|
|
|
24
24
|
* @returns Data promise
|
|
25
25
|
*/
|
|
26
26
|
loadData?: () => Promise<T | undefined>;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Position
|
|
30
|
+
*/
|
|
31
|
+
position?: PopoverOrigin["horizontal"];
|
|
27
32
|
};
|
|
28
33
|
|
|
29
34
|
/**
|
|
@@ -33,7 +38,7 @@ export type ButtonPopoverProps<T> = {
|
|
|
33
38
|
*/
|
|
34
39
|
export function ButtonPopover<T>(props: ButtonPopoverProps<T>) {
|
|
35
40
|
// Destruct
|
|
36
|
-
const { button, children, loadData } = props;
|
|
41
|
+
const { button, children, loadData, position = "right" } = props;
|
|
37
42
|
|
|
38
43
|
// States
|
|
39
44
|
const [anchorEl, setAnchorEl] = React.useState<HTMLElement | null>(null);
|
|
@@ -61,6 +66,8 @@ export function ButtonPopover<T>(props: ButtonPopoverProps<T>) {
|
|
|
61
66
|
setAnchorEl(null);
|
|
62
67
|
};
|
|
63
68
|
|
|
69
|
+
const styles = position === "left" ? { left: 14 } : { right: 14 };
|
|
70
|
+
|
|
64
71
|
// Layout
|
|
65
72
|
return (
|
|
66
73
|
<React.Fragment>
|
|
@@ -70,8 +77,8 @@ export function ButtonPopover<T>(props: ButtonPopoverProps<T>) {
|
|
|
70
77
|
open={open}
|
|
71
78
|
onClose={handleClose}
|
|
72
79
|
onClick={handleClose}
|
|
73
|
-
transformOrigin={{ horizontal:
|
|
74
|
-
anchorOrigin={{ horizontal:
|
|
80
|
+
transformOrigin={{ horizontal: position, vertical: "top" }}
|
|
81
|
+
anchorOrigin={{ horizontal: position, vertical: "bottom" }}
|
|
75
82
|
slotProps={{
|
|
76
83
|
paper: {
|
|
77
84
|
elevation: 0,
|
|
@@ -84,12 +91,12 @@ export function ButtonPopover<T>(props: ButtonPopoverProps<T>) {
|
|
|
84
91
|
display: "block",
|
|
85
92
|
position: "absolute",
|
|
86
93
|
top: 0,
|
|
87
|
-
right: 14,
|
|
88
94
|
width: 10,
|
|
89
95
|
height: 10,
|
|
90
96
|
bgcolor: "background.paper",
|
|
91
97
|
transform: "translateY(-50%) rotate(45deg)",
|
|
92
|
-
zIndex: 0
|
|
98
|
+
zIndex: 0,
|
|
99
|
+
...styles
|
|
93
100
|
}
|
|
94
101
|
}
|
|
95
102
|
}
|
package/src/app/ReactApp.ts
CHANGED
|
@@ -372,7 +372,8 @@ export class ReactApp<S extends IAppSettings, D extends IUser>
|
|
|
372
372
|
// Refresh token
|
|
373
373
|
await this.refreshToken(
|
|
374
374
|
{
|
|
375
|
-
showLoading: data?.showLoading
|
|
375
|
+
showLoading: data?.showLoading,
|
|
376
|
+
timeZone: this.getTimeZone()
|
|
376
377
|
},
|
|
377
378
|
(result) => {
|
|
378
379
|
if (result === true) {
|
package/src/app/ServiceApp.ts
CHANGED
|
@@ -267,7 +267,8 @@ export class ServiceApp<
|
|
|
267
267
|
// Call the core system API refresh token
|
|
268
268
|
const data = await this.apiRefreshTokenData(this.coreApi, {
|
|
269
269
|
token: coreTokenDecrypted,
|
|
270
|
-
appId: this.settings.appId
|
|
270
|
+
appId: this.settings.appId,
|
|
271
|
+
timeZone: this.getTimeZone()
|
|
271
272
|
});
|
|
272
273
|
|
|
273
274
|
if (data == null) return;
|
package/src/pages/ViewPage.tsx
CHANGED
|
@@ -289,7 +289,7 @@ export function ViewPage<T extends DataTypes.StringRecord>(
|
|
|
289
289
|
// Load data
|
|
290
290
|
const refresh = React.useCallback(async () => {
|
|
291
291
|
const result = await loadData();
|
|
292
|
-
|
|
292
|
+
// When failed or no data returned, show the loading bar
|
|
293
293
|
setData(result);
|
|
294
294
|
}, [loadData]);
|
|
295
295
|
|