@etsoo/materialui 1.4.95 → 1.4.97
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/app/ReactApp.js +4 -0
- package/lib/cjs/pages/ViewPage.d.ts +4 -0
- package/lib/cjs/pages/ViewPage.js +2 -2
- package/lib/mjs/app/ReactApp.js +4 -0
- package/lib/mjs/pages/ViewPage.d.ts +4 -0
- package/lib/mjs/pages/ViewPage.js +2 -2
- package/package.json +5 -5
- package/src/app/ReactApp.ts +6 -0
- package/src/pages/ViewPage.tsx +10 -4
package/lib/cjs/app/ReactApp.js
CHANGED
|
@@ -210,6 +210,10 @@ class ReactApp extends appscript_1.CoreApp {
|
|
|
210
210
|
// Destruct
|
|
211
211
|
const { onFailure = (type) => {
|
|
212
212
|
console.log(`Try login failed: ${type}.`);
|
|
213
|
+
if (globalThis.navigator.onLine &&
|
|
214
|
+
!type.includes('"title":"Failed to fetch"')) {
|
|
215
|
+
this.clearCacheToken();
|
|
216
|
+
}
|
|
213
217
|
this.toLoginPage(rest);
|
|
214
218
|
}, onSuccess, ...rest } = data ?? {};
|
|
215
219
|
// Check status
|
|
@@ -77,6 +77,10 @@ export interface ViewPageProps<T extends DataTypes.StringRecord> extends Omit<Co
|
|
|
77
77
|
* Actions
|
|
78
78
|
*/
|
|
79
79
|
actions?: React.ReactNode | ((data: T, refresh: () => PromiseLike<void>) => React.ReactNode);
|
|
80
|
+
/**
|
|
81
|
+
* Paddings between actions
|
|
82
|
+
*/
|
|
83
|
+
actionPaddings?: number | Record<string, string | number>;
|
|
80
84
|
/**
|
|
81
85
|
* Children
|
|
82
86
|
*/
|
|
@@ -173,7 +173,7 @@ function ViewPage(props) {
|
|
|
173
173
|
// Global app
|
|
174
174
|
const app = (0, ReactApp_1.useRequiredAppContext)();
|
|
175
175
|
// Destruct
|
|
176
|
-
const { actions, children, fields, loadData, paddings = MUGlobal_1.MUGlobal.pagePaddings, spacing = MUGlobal_1.MUGlobal.half(MUGlobal_1.MUGlobal.pagePaddings), supportRefresh = true, fabColumnDirection = true, fabTop = true, supportBack = true, pullToRefresh = true, gridRef, operationMessageHandler, titleBar, leftContainer, leftContainerLines = 3, leftContainerProps = {}, ...rest } = props;
|
|
176
|
+
const { actions, children, fields, loadData, paddings = MUGlobal_1.MUGlobal.pagePaddings, spacing = MUGlobal_1.MUGlobal.half(MUGlobal_1.MUGlobal.pagePaddings), actionPaddings = MUGlobal_1.MUGlobal.pagePaddings, supportRefresh = true, fabColumnDirection = true, fabTop = true, supportBack = true, pullToRefresh = true, gridRef, operationMessageHandler, titleBar, leftContainer, leftContainerLines = 3, leftContainerProps = {}, ...rest } = props;
|
|
177
177
|
// Current breakpoint
|
|
178
178
|
const bp = (0, useCurrentBreakpoint_1.useCurrentBreakpoint)();
|
|
179
179
|
// Data
|
|
@@ -267,7 +267,7 @@ function ViewPage(props) {
|
|
|
267
267
|
refresh,
|
|
268
268
|
operationMessageHandler.id
|
|
269
269
|
]
|
|
270
|
-
: operationMessageHandler })), titleBar && titleBar(data), (0, jsx_runtime_1.jsxs)(material_1.Grid2, { container: true, justifyContent: "left", className: "ET-ViewPage", ref: gridRef, spacing: spacing, children: [leftContainer && (leftResult = leftContainer(data)) != null && ((0, jsx_runtime_1.jsxs)(react_3.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid2, { container: true, className: "ET-ViewPage-LeftContainer", spacing: spacing, size: size, ...leftContainerPropsRest, children: leftResult }), (0, jsx_runtime_1.jsx)(material_1.Grid2, { container: true, className: "ET-ViewPage-LeftOthers", spacing: spacing, size: ViewPageSize.matchSize(size), children: createFields(data, leftContainerLines * (12 - getItemSize(bp, size))) })] })), createFields(data)] }), actions !== null && ((0, jsx_runtime_1.jsx)(material_1.Stack, { className: "ET-ViewPage-Actions", direction: "row", width: "100%", flexWrap: "wrap", justifyContent: "
|
|
270
|
+
: operationMessageHandler })), titleBar && titleBar(data), (0, jsx_runtime_1.jsxs)(material_1.Grid2, { container: true, justifyContent: "left", className: "ET-ViewPage", ref: gridRef, spacing: spacing, children: [leftContainer && (leftResult = leftContainer(data)) != null && ((0, jsx_runtime_1.jsxs)(react_3.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid2, { container: true, className: "ET-ViewPage-LeftContainer", spacing: spacing, size: size, ...leftContainerPropsRest, children: leftResult }), (0, jsx_runtime_1.jsx)(material_1.Grid2, { container: true, className: "ET-ViewPage-LeftOthers", spacing: spacing, size: ViewPageSize.matchSize(size), children: createFields(data, leftContainerLines * (12 - getItemSize(bp, size))) })] })), createFields(data)] }), actions !== null && ((0, jsx_runtime_1.jsx)(material_1.Stack, { className: "ET-ViewPage-Actions", direction: "row", width: "100%", flexWrap: "wrap", justifyContent: "center", paddingTop: actions == null ? undefined : actionPaddings, paddingBottom: actionPaddings, gap: actionPaddings, children: actions != null && shared_1.Utils.getResult(actions, data, refresh) })), shared_1.Utils.getResult(children, data, refresh), pullToRefresh && ((0, jsx_runtime_1.jsx)(PullToRefreshUI_1.PullToRefreshUI, { mainElement: pullContainer, triggerElement: pullContainer, instructionsPullToRefresh: labels.pullToRefresh, instructionsReleaseToRefresh: labels.releaseToRefresh, instructionsRefreshing: labels.refreshing, onRefresh: refresh, shouldPullToRefresh: () => {
|
|
271
271
|
const container = document.querySelector(pullContainer);
|
|
272
272
|
return !container?.scrollTop;
|
|
273
273
|
} })), (0, jsx_runtime_1.jsx)(react_2.ScrollRestoration, {})] })) }));
|
package/lib/mjs/app/ReactApp.js
CHANGED
|
@@ -202,6 +202,10 @@ export class ReactApp extends CoreApp {
|
|
|
202
202
|
// Destruct
|
|
203
203
|
const { onFailure = (type) => {
|
|
204
204
|
console.log(`Try login failed: ${type}.`);
|
|
205
|
+
if (globalThis.navigator.onLine &&
|
|
206
|
+
!type.includes('"title":"Failed to fetch"')) {
|
|
207
|
+
this.clearCacheToken();
|
|
208
|
+
}
|
|
205
209
|
this.toLoginPage(rest);
|
|
206
210
|
}, onSuccess, ...rest } = data ?? {};
|
|
207
211
|
// Check status
|
|
@@ -77,6 +77,10 @@ export interface ViewPageProps<T extends DataTypes.StringRecord> extends Omit<Co
|
|
|
77
77
|
* Actions
|
|
78
78
|
*/
|
|
79
79
|
actions?: React.ReactNode | ((data: T, refresh: () => PromiseLike<void>) => React.ReactNode);
|
|
80
|
+
/**
|
|
81
|
+
* Paddings between actions
|
|
82
|
+
*/
|
|
83
|
+
actionPaddings?: number | Record<string, string | number>;
|
|
80
84
|
/**
|
|
81
85
|
* Children
|
|
82
86
|
*/
|
|
@@ -165,7 +165,7 @@ export function ViewPage(props) {
|
|
|
165
165
|
// Global app
|
|
166
166
|
const app = useRequiredAppContext();
|
|
167
167
|
// Destruct
|
|
168
|
-
const { actions, children, fields, loadData, paddings = MUGlobal.pagePaddings, spacing = MUGlobal.half(MUGlobal.pagePaddings), supportRefresh = true, fabColumnDirection = true, fabTop = true, supportBack = true, pullToRefresh = true, gridRef, operationMessageHandler, titleBar, leftContainer, leftContainerLines = 3, leftContainerProps = {}, ...rest } = props;
|
|
168
|
+
const { actions, children, fields, loadData, paddings = MUGlobal.pagePaddings, spacing = MUGlobal.half(MUGlobal.pagePaddings), actionPaddings = MUGlobal.pagePaddings, supportRefresh = true, fabColumnDirection = true, fabTop = true, supportBack = true, pullToRefresh = true, gridRef, operationMessageHandler, titleBar, leftContainer, leftContainerLines = 3, leftContainerProps = {}, ...rest } = props;
|
|
169
169
|
// Current breakpoint
|
|
170
170
|
const bp = useCurrentBreakpoint();
|
|
171
171
|
// Data
|
|
@@ -259,7 +259,7 @@ export function ViewPage(props) {
|
|
|
259
259
|
refresh,
|
|
260
260
|
operationMessageHandler.id
|
|
261
261
|
]
|
|
262
|
-
: operationMessageHandler })), titleBar && titleBar(data), _jsxs(Grid2, { container: true, justifyContent: "left", className: "ET-ViewPage", ref: gridRef, spacing: spacing, children: [leftContainer && (leftResult = leftContainer(data)) != null && (_jsxs(React.Fragment, { children: [_jsx(Grid2, { container: true, className: "ET-ViewPage-LeftContainer", spacing: spacing, size: size, ...leftContainerPropsRest, children: leftResult }), _jsx(Grid2, { container: true, className: "ET-ViewPage-LeftOthers", spacing: spacing, size: ViewPageSize.matchSize(size), children: createFields(data, leftContainerLines * (12 - getItemSize(bp, size))) })] })), createFields(data)] }), actions !== null && (_jsx(Stack, { className: "ET-ViewPage-Actions", direction: "row", width: "100%", flexWrap: "wrap", justifyContent: "
|
|
262
|
+
: operationMessageHandler })), titleBar && titleBar(data), _jsxs(Grid2, { container: true, justifyContent: "left", className: "ET-ViewPage", ref: gridRef, spacing: spacing, children: [leftContainer && (leftResult = leftContainer(data)) != null && (_jsxs(React.Fragment, { children: [_jsx(Grid2, { container: true, className: "ET-ViewPage-LeftContainer", spacing: spacing, size: size, ...leftContainerPropsRest, children: leftResult }), _jsx(Grid2, { container: true, className: "ET-ViewPage-LeftOthers", spacing: spacing, size: ViewPageSize.matchSize(size), children: createFields(data, leftContainerLines * (12 - getItemSize(bp, size))) })] })), createFields(data)] }), actions !== null && (_jsx(Stack, { className: "ET-ViewPage-Actions", direction: "row", width: "100%", flexWrap: "wrap", justifyContent: "center", paddingTop: actions == null ? undefined : actionPaddings, paddingBottom: actionPaddings, gap: actionPaddings, children: actions != null && Utils.getResult(actions, data, refresh) })), Utils.getResult(children, data, refresh), pullToRefresh && (_jsx(PullToRefreshUI, { mainElement: pullContainer, triggerElement: pullContainer, instructionsPullToRefresh: labels.pullToRefresh, instructionsReleaseToRefresh: labels.releaseToRefresh, instructionsRefreshing: labels.refreshing, onRefresh: refresh, shouldPullToRefresh: () => {
|
|
263
263
|
const container = document.querySelector(pullContainer);
|
|
264
264
|
return !container?.scrollTop;
|
|
265
265
|
} })), _jsx(ScrollRestoration, {})] })) }));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/materialui",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.97",
|
|
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.6.
|
|
43
|
+
"@etsoo/appscript": "^1.6.16",
|
|
44
44
|
"@etsoo/notificationbase": "^1.1.59",
|
|
45
45
|
"@etsoo/react": "^1.8.32",
|
|
46
46
|
"@etsoo/shared": "^1.2.62",
|
|
47
|
-
"@mui/icons-material": "^6.4.
|
|
48
|
-
"@mui/material": "^6.4.
|
|
49
|
-
"@mui/x-data-grid": "^7.27.
|
|
47
|
+
"@mui/icons-material": "^6.4.6",
|
|
48
|
+
"@mui/material": "^6.4.6",
|
|
49
|
+
"@mui/x-data-grid": "^7.27.2",
|
|
50
50
|
"chart.js": "^4.4.8",
|
|
51
51
|
"chartjs-plugin-datalabels": "^2.2.0",
|
|
52
52
|
"eventemitter3": "^5.0.1",
|
package/src/app/ReactApp.ts
CHANGED
|
@@ -355,6 +355,12 @@ export class ReactApp<S extends IAppSettings, D extends IUser>
|
|
|
355
355
|
const {
|
|
356
356
|
onFailure = (type: string) => {
|
|
357
357
|
console.log(`Try login failed: ${type}.`);
|
|
358
|
+
if (
|
|
359
|
+
globalThis.navigator.onLine &&
|
|
360
|
+
!type.includes('"title":"Failed to fetch"')
|
|
361
|
+
) {
|
|
362
|
+
this.clearCacheToken();
|
|
363
|
+
}
|
|
358
364
|
this.toLoginPage(rest);
|
|
359
365
|
},
|
|
360
366
|
onSuccess,
|
package/src/pages/ViewPage.tsx
CHANGED
|
@@ -186,6 +186,11 @@ export interface ViewPageProps<T extends DataTypes.StringRecord>
|
|
|
186
186
|
| React.ReactNode
|
|
187
187
|
| ((data: T, refresh: () => PromiseLike<void>) => React.ReactNode);
|
|
188
188
|
|
|
189
|
+
/**
|
|
190
|
+
* Paddings between actions
|
|
191
|
+
*/
|
|
192
|
+
actionPaddings?: number | Record<string, string | number>;
|
|
193
|
+
|
|
189
194
|
/**
|
|
190
195
|
* Children
|
|
191
196
|
*/
|
|
@@ -373,6 +378,7 @@ export function ViewPage<T extends DataTypes.StringRecord>(
|
|
|
373
378
|
loadData,
|
|
374
379
|
paddings = MUGlobal.pagePaddings,
|
|
375
380
|
spacing = MUGlobal.half(MUGlobal.pagePaddings),
|
|
381
|
+
actionPaddings = MUGlobal.pagePaddings,
|
|
376
382
|
supportRefresh = true,
|
|
377
383
|
fabColumnDirection = true,
|
|
378
384
|
fabTop = true,
|
|
@@ -566,10 +572,10 @@ export function ViewPage<T extends DataTypes.StringRecord>(
|
|
|
566
572
|
direction="row"
|
|
567
573
|
width="100%"
|
|
568
574
|
flexWrap="wrap"
|
|
569
|
-
justifyContent="
|
|
570
|
-
paddingTop={actions == null ? undefined :
|
|
571
|
-
paddingBottom={
|
|
572
|
-
gap={
|
|
575
|
+
justifyContent="center"
|
|
576
|
+
paddingTop={actions == null ? undefined : actionPaddings}
|
|
577
|
+
paddingBottom={actionPaddings}
|
|
578
|
+
gap={actionPaddings}
|
|
573
579
|
>
|
|
574
580
|
{actions != null && Utils.getResult(actions, data, refresh)}
|
|
575
581
|
</Stack>
|