@etsoo/materialui 1.4.32 → 1.4.34
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 +3 -3
- package/lib/ResponsibleContainer.js +5 -2
- package/lib/UserAvatarEditor.d.ts +1 -1
- package/lib/UserAvatarEditor.js +3 -2
- package/lib/pages/CommonPage.d.ts +1 -1
- package/lib/pages/DataGridPage.js +4 -1
- package/lib/pages/DataGridPageProps.d.ts +1 -1
- package/lib/pages/FixedListPage.d.ts +1 -1
- package/lib/pages/FixedListPage.js +4 -1
- package/lib/pages/ResponsivePage.js +3 -1
- package/package.json +4 -4
- package/src/ResponsibleContainer.tsx +11 -6
- package/src/UserAvatarEditor.tsx +4 -3
- package/src/pages/CommonPage.tsx +1 -1
- package/src/pages/DataGridPage.tsx +5 -1
- package/src/pages/DataGridPageProps.ts +1 -1
- package/src/pages/FixedListPage.tsx +6 -2
- package/src/pages/ResponsivePage.tsx +4 -1
|
@@ -14,7 +14,7 @@ export type ResponsibleContainerProps<T extends object, F extends DataTypes.Basi
|
|
|
14
14
|
* @param height Current calcuated height
|
|
15
15
|
* @param rect Current rect data
|
|
16
16
|
*/
|
|
17
|
-
adjustHeight?: (height: number, rect: DOMRect) => number;
|
|
17
|
+
adjustHeight?: number | ((height: number, rect: DOMRect) => number);
|
|
18
18
|
/**
|
|
19
19
|
*
|
|
20
20
|
* @param height Current height
|
|
@@ -29,7 +29,7 @@ export type ResponsibleContainerProps<T extends object, F extends DataTypes.Basi
|
|
|
29
29
|
/**
|
|
30
30
|
* Container box SX (dataGrid determines the case)
|
|
31
31
|
*/
|
|
32
|
-
containerBoxSx?: (paddings: Record<string, string | number>, hasFields: boolean, dataGrid?: boolean) => SxProps<Theme>;
|
|
32
|
+
containerBoxSx?: (paddings: number | Record<string, string | number>, hasFields: boolean, dataGrid?: boolean) => SxProps<Theme>;
|
|
33
33
|
/**
|
|
34
34
|
* Min width to show Datagrid
|
|
35
35
|
*/
|
|
@@ -73,7 +73,7 @@ export type ResponsibleContainerProps<T extends object, F extends DataTypes.Basi
|
|
|
73
73
|
/**
|
|
74
74
|
* Paddings
|
|
75
75
|
*/
|
|
76
|
-
paddings?: Record<string, string | number>;
|
|
76
|
+
paddings?: number | Record<string, string | number>;
|
|
77
77
|
/**
|
|
78
78
|
* Pull to refresh data
|
|
79
79
|
*/
|
|
@@ -10,7 +10,7 @@ import { SearchBar } from "./SearchBar";
|
|
|
10
10
|
import { Labels } from "./app/Labels";
|
|
11
11
|
import { GridUtils } from "./GridUtils";
|
|
12
12
|
function defaultContainerBoxSx(paddings, hasField, _dataGrid) {
|
|
13
|
-
const half = MUGlobal.half(paddings);
|
|
13
|
+
const half = typeof paddings == "number" ? paddings / 2 : MUGlobal.half(paddings);
|
|
14
14
|
return {
|
|
15
15
|
"& .SearchBox": {
|
|
16
16
|
marginBottom: hasField ? half : 0
|
|
@@ -136,7 +136,10 @@ export function ResponsibleContainer(props) {
|
|
|
136
136
|
if (!isNaN(boxMargin))
|
|
137
137
|
heightLocal -= 3 * boxMargin; // 1 - Box, 2 - Page bottom
|
|
138
138
|
if (adjustHeight != null)
|
|
139
|
-
heightLocal -=
|
|
139
|
+
heightLocal -=
|
|
140
|
+
typeof adjustHeight === "number"
|
|
141
|
+
? adjustHeight
|
|
142
|
+
: adjustHeight(heightLocal, rect);
|
|
140
143
|
}
|
|
141
144
|
if (adjustFabHeight)
|
|
142
145
|
heightLocal = adjustFabHeight(heightLocal, showDataGrid);
|
|
@@ -8,7 +8,7 @@ export interface UserAvatarEditorToBlob {
|
|
|
8
8
|
* User avatar editor on done handler
|
|
9
9
|
*/
|
|
10
10
|
export interface UserAvatarEditorOnDoneHandler {
|
|
11
|
-
(canvas: HTMLCanvasElement, toBlob: UserAvatarEditorToBlob, type: string): Promise<void |
|
|
11
|
+
(canvas: HTMLCanvasElement, toBlob: UserAvatarEditorToBlob, type: string): Promise<void | true | undefined>;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
14
|
* User avatar editor props
|
package/lib/UserAvatarEditor.js
CHANGED
|
@@ -102,6 +102,7 @@ export function UserAvatarEditor(props) {
|
|
|
102
102
|
setEditorState({ ...defaultState });
|
|
103
103
|
};
|
|
104
104
|
const resetUI = () => {
|
|
105
|
+
setReady(false);
|
|
105
106
|
setPreviewImage(undefined);
|
|
106
107
|
handleReset();
|
|
107
108
|
};
|
|
@@ -144,13 +145,13 @@ export function UserAvatarEditor(props) {
|
|
|
144
145
|
unsharpThreshold: 1
|
|
145
146
|
});
|
|
146
147
|
const result = await onDone(canvas, toBlob, type.current);
|
|
147
|
-
if (result
|
|
148
|
+
if (result) {
|
|
148
149
|
resetUI();
|
|
149
150
|
}
|
|
150
151
|
}
|
|
151
152
|
else {
|
|
152
153
|
const result = await onDone(data, toBlob, type.current);
|
|
153
|
-
if (result
|
|
154
|
+
if (result) {
|
|
154
155
|
resetUI();
|
|
155
156
|
}
|
|
156
157
|
}
|
|
@@ -77,7 +77,10 @@ export function DataGridPage(props) {
|
|
|
77
77
|
if (!isNaN(paddingBottom))
|
|
78
78
|
gridHeight -= paddingBottom;
|
|
79
79
|
if (adjustHeight != null)
|
|
80
|
-
gridHeight -=
|
|
80
|
+
gridHeight -=
|
|
81
|
+
typeof adjustHeight === "number"
|
|
82
|
+
? adjustHeight
|
|
83
|
+
: adjustHeight(gridHeight, rect);
|
|
81
84
|
if (gridHeight !== states.height)
|
|
82
85
|
setStates({ height: gridHeight });
|
|
83
86
|
}
|
|
@@ -10,7 +10,7 @@ export type DataGridPageProps<T extends object, F extends DataTypes.BasicTemplat
|
|
|
10
10
|
* @param height Current calcuated height
|
|
11
11
|
* @param rect Current rect data
|
|
12
12
|
*/
|
|
13
|
-
adjustHeight?: (height: number, rect: DOMRect) => number;
|
|
13
|
+
adjustHeight?: number | ((height: number, rect: DOMRect) => number);
|
|
14
14
|
/**
|
|
15
15
|
* Grid height
|
|
16
16
|
*/
|
|
@@ -11,5 +11,5 @@ export declare function FixedListPage<T extends object, F extends DataTypes.Basi
|
|
|
11
11
|
* @param height Current calcuated height
|
|
12
12
|
* @param rect Current rect data
|
|
13
13
|
*/
|
|
14
|
-
adjustHeight?: (height: number, rect: DOMRect) => number;
|
|
14
|
+
adjustHeight?: number | ((height: number, rect: DOMRect) => number);
|
|
15
15
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -79,7 +79,10 @@ export function FixedListPage(props) {
|
|
|
79
79
|
let height = document.documentElement.clientHeight -
|
|
80
80
|
Math.round(rect.top + rect.height + 1);
|
|
81
81
|
if (adjustHeight != null)
|
|
82
|
-
height -=
|
|
82
|
+
height -=
|
|
83
|
+
typeof adjustHeight === "number"
|
|
84
|
+
? adjustHeight
|
|
85
|
+
: adjustHeight(height, rect);
|
|
83
86
|
return (_jsx(Box, { id: "list-container", sx: {
|
|
84
87
|
height: height + "px"
|
|
85
88
|
}, children: _jsx(ScrollerListEx, { autoLoad: false, height: height, loadData: localLoadData, mRef: refs, onUpdateRows: GridUtils.getUpdateRowsHandler(cacheKey), onInitLoad: onInitLoad, onScroll: onListScroll, oRef: (element) => {
|
|
@@ -20,7 +20,9 @@ export function ResponsivePage(props) {
|
|
|
20
20
|
// Layout
|
|
21
21
|
return (_jsxs(CommonPage, { ...pageRest, paddings: {}, scrollContainer: scrollContainer, fabColumnDirection: direction, children: [operationMessageHandler && (_jsx(OperationMessageContainer, { handler: operationMessageHandler })), _jsx(ResponsibleContainer, { paddings: paddings, containerBoxSx: (paddings, hasField, _dataGrid) => {
|
|
22
22
|
// Half
|
|
23
|
-
const half =
|
|
23
|
+
const half = typeof paddings == "number"
|
|
24
|
+
? paddings / 2
|
|
25
|
+
: MUGlobal.half(paddings);
|
|
24
26
|
// .SearchBox keep the same to avoid flick when switching between DataGrid and List
|
|
25
27
|
return {
|
|
26
28
|
paddingTop: paddings,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/materialui",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.34",
|
|
4
4
|
"description": "TypeScript Material-UI Implementation",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -35,14 +35,14 @@
|
|
|
35
35
|
"@emotion/css": "^11.13.5",
|
|
36
36
|
"@emotion/react": "^11.13.5",
|
|
37
37
|
"@emotion/styled": "^11.13.5",
|
|
38
|
-
"@etsoo/appscript": "^1.5.
|
|
38
|
+
"@etsoo/appscript": "^1.5.76",
|
|
39
39
|
"@etsoo/notificationbase": "^1.1.54",
|
|
40
40
|
"@etsoo/react": "^1.8.3",
|
|
41
41
|
"@etsoo/shared": "^1.2.55",
|
|
42
42
|
"@mui/icons-material": "^6.1.9",
|
|
43
43
|
"@mui/material": "^6.1.9",
|
|
44
|
-
"@mui/x-data-grid": "^7.
|
|
45
|
-
"chart.js": "^4.4.
|
|
44
|
+
"@mui/x-data-grid": "^7.23.0",
|
|
45
|
+
"chart.js": "^4.4.7",
|
|
46
46
|
"chartjs-plugin-datalabels": "^2.2.0",
|
|
47
47
|
"eventemitter3": "^5.0.1",
|
|
48
48
|
"pica": "^9.0.1",
|
|
@@ -56,7 +56,7 @@ export type ResponsibleContainerProps<
|
|
|
56
56
|
* @param height Current calcuated height
|
|
57
57
|
* @param rect Current rect data
|
|
58
58
|
*/
|
|
59
|
-
adjustHeight?: (height: number, rect: DOMRect) => number;
|
|
59
|
+
adjustHeight?: number | ((height: number, rect: DOMRect) => number);
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
62
|
*
|
|
@@ -75,7 +75,7 @@ export type ResponsibleContainerProps<
|
|
|
75
75
|
* Container box SX (dataGrid determines the case)
|
|
76
76
|
*/
|
|
77
77
|
containerBoxSx?: (
|
|
78
|
-
paddings: Record<string, string | number>,
|
|
78
|
+
paddings: number | Record<string, string | number>,
|
|
79
79
|
hasFields: boolean,
|
|
80
80
|
dataGrid?: boolean
|
|
81
81
|
) => SxProps<Theme>;
|
|
@@ -139,7 +139,7 @@ export type ResponsibleContainerProps<
|
|
|
139
139
|
/**
|
|
140
140
|
* Paddings
|
|
141
141
|
*/
|
|
142
|
-
paddings?: Record<string, string | number>;
|
|
142
|
+
paddings?: number | Record<string, string | number>;
|
|
143
143
|
|
|
144
144
|
/**
|
|
145
145
|
* Pull to refresh data
|
|
@@ -170,11 +170,12 @@ interface LocalRefs<T> {
|
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
function defaultContainerBoxSx(
|
|
173
|
-
paddings: object,
|
|
173
|
+
paddings: object | number,
|
|
174
174
|
hasField: boolean,
|
|
175
175
|
_dataGrid?: boolean
|
|
176
176
|
): SxProps<Theme> {
|
|
177
|
-
const half =
|
|
177
|
+
const half =
|
|
178
|
+
typeof paddings == "number" ? paddings / 2 : MUGlobal.half(paddings);
|
|
178
179
|
return {
|
|
179
180
|
"& .SearchBox": {
|
|
180
181
|
marginBottom: hasField ? half : 0
|
|
@@ -357,7 +358,11 @@ export function ResponsibleContainer<
|
|
|
357
358
|
const boxMargin = parseFloat(style.marginBottom);
|
|
358
359
|
if (!isNaN(boxMargin)) heightLocal -= 3 * boxMargin; // 1 - Box, 2 - Page bottom
|
|
359
360
|
|
|
360
|
-
if (adjustHeight != null)
|
|
361
|
+
if (adjustHeight != null)
|
|
362
|
+
heightLocal -=
|
|
363
|
+
typeof adjustHeight === "number"
|
|
364
|
+
? adjustHeight
|
|
365
|
+
: adjustHeight(heightLocal, rect);
|
|
361
366
|
}
|
|
362
367
|
|
|
363
368
|
if (adjustFabHeight)
|
package/src/UserAvatarEditor.tsx
CHANGED
|
@@ -40,7 +40,7 @@ export interface UserAvatarEditorOnDoneHandler {
|
|
|
40
40
|
canvas: HTMLCanvasElement,
|
|
41
41
|
toBlob: UserAvatarEditorToBlob,
|
|
42
42
|
type: string
|
|
43
|
-
): Promise<void |
|
|
43
|
+
): Promise<void | true | undefined>;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
/**
|
|
@@ -230,6 +230,7 @@ export function UserAvatarEditor(props: UserAvatarEditorProps) {
|
|
|
230
230
|
};
|
|
231
231
|
|
|
232
232
|
const resetUI = () => {
|
|
233
|
+
setReady(false);
|
|
233
234
|
setPreviewImage(undefined);
|
|
234
235
|
handleReset();
|
|
235
236
|
};
|
|
@@ -283,12 +284,12 @@ export function UserAvatarEditor(props: UserAvatarEditorProps) {
|
|
|
283
284
|
});
|
|
284
285
|
|
|
285
286
|
const result = await onDone(canvas, toBlob, type.current);
|
|
286
|
-
if (result
|
|
287
|
+
if (result) {
|
|
287
288
|
resetUI();
|
|
288
289
|
}
|
|
289
290
|
} else {
|
|
290
291
|
const result = await onDone(data, toBlob, type.current);
|
|
291
|
-
if (result
|
|
292
|
+
if (result) {
|
|
292
293
|
resetUI();
|
|
293
294
|
}
|
|
294
295
|
}
|
package/src/pages/CommonPage.tsx
CHANGED
|
@@ -135,7 +135,11 @@ export function DataGridPage<
|
|
|
135
135
|
const paddingBottom = parseFloat(style.paddingBottom);
|
|
136
136
|
if (!isNaN(paddingBottom)) gridHeight -= paddingBottom;
|
|
137
137
|
|
|
138
|
-
if (adjustHeight != null)
|
|
138
|
+
if (adjustHeight != null)
|
|
139
|
+
gridHeight -=
|
|
140
|
+
typeof adjustHeight === "number"
|
|
141
|
+
? adjustHeight
|
|
142
|
+
: adjustHeight(gridHeight, rect);
|
|
139
143
|
|
|
140
144
|
if (gridHeight !== states.height) setStates({ height: gridHeight });
|
|
141
145
|
}
|
|
@@ -15,7 +15,7 @@ export type DataGridPageProps<
|
|
|
15
15
|
* @param height Current calcuated height
|
|
16
16
|
* @param rect Current rect data
|
|
17
17
|
*/
|
|
18
|
-
adjustHeight?: (height: number, rect: DOMRect) => number;
|
|
18
|
+
adjustHeight?: number | ((height: number, rect: DOMRect) => number);
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Grid height
|
|
@@ -32,7 +32,7 @@ export function FixedListPage<
|
|
|
32
32
|
* @param height Current calcuated height
|
|
33
33
|
* @param rect Current rect data
|
|
34
34
|
*/
|
|
35
|
-
adjustHeight?: (height: number, rect: DOMRect) => number;
|
|
35
|
+
adjustHeight?: number | ((height: number, rect: DOMRect) => number);
|
|
36
36
|
}
|
|
37
37
|
) {
|
|
38
38
|
// Destruct
|
|
@@ -139,7 +139,11 @@ export function FixedListPage<
|
|
|
139
139
|
document.documentElement.clientHeight -
|
|
140
140
|
Math.round(rect.top + rect.height + 1);
|
|
141
141
|
|
|
142
|
-
if (adjustHeight != null)
|
|
142
|
+
if (adjustHeight != null)
|
|
143
|
+
height -=
|
|
144
|
+
typeof adjustHeight === "number"
|
|
145
|
+
? adjustHeight
|
|
146
|
+
: adjustHeight(height, rect);
|
|
143
147
|
|
|
144
148
|
return (
|
|
145
149
|
<Box
|
|
@@ -105,7 +105,10 @@ export function ResponsivePage<
|
|
|
105
105
|
paddings={paddings}
|
|
106
106
|
containerBoxSx={(paddings, hasField, _dataGrid) => {
|
|
107
107
|
// Half
|
|
108
|
-
const half =
|
|
108
|
+
const half =
|
|
109
|
+
typeof paddings == "number"
|
|
110
|
+
? paddings / 2
|
|
111
|
+
: MUGlobal.half(paddings);
|
|
109
112
|
|
|
110
113
|
// .SearchBox keep the same to avoid flick when switching between DataGrid and List
|
|
111
114
|
return {
|