@m4l/graphics 7.0.11-beta.1 → 7.0.11
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createStore as S } from "zustand";
|
|
2
2
|
import { devtools as c } from "zustand/middleware";
|
|
3
3
|
import { immer as p } from "zustand/middleware/immer";
|
|
4
|
-
import { getPaletteByPreset as a,
|
|
4
|
+
import { getPaletteByPreset as a, typographyOld as d, shadows as h, getColorPresets as u, createCustomShadows as f } from "@m4l/styles";
|
|
5
5
|
import { alpha as U } from "@mui/system";
|
|
6
6
|
import { d as s } from "./constants.js";
|
|
7
7
|
function g(r, o = "m4l") {
|
|
@@ -18,7 +18,7 @@ const n = (r) => {
|
|
|
18
18
|
const o = r.themeUserSettings || s, m = o.themeMode === "light", t = a(o.themeColor), e = m ? t.light : t.dark;
|
|
19
19
|
r.themeOptions = {
|
|
20
20
|
...r.themeOptions,
|
|
21
|
-
...
|
|
21
|
+
...d,
|
|
22
22
|
palette: {
|
|
23
23
|
...r.themeOptions?.palette ?? {},
|
|
24
24
|
...e
|
|
@@ -28,10 +28,10 @@ const n = (r) => {
|
|
|
28
28
|
shadows: m ? h.light : h.dark,
|
|
29
29
|
customShadows: {
|
|
30
30
|
primary: `0 8px 16px 0 ${U(
|
|
31
|
-
|
|
31
|
+
u(o.themeColor)?.main || "#fff",
|
|
32
32
|
0.2
|
|
33
33
|
)}`,
|
|
34
|
-
...
|
|
34
|
+
...f(o.themeMode)
|
|
35
35
|
},
|
|
36
36
|
stretch: o.themeStretch
|
|
37
37
|
}, g(r.themeOptions);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { useState as n, useRef as H, useCallback as
|
|
1
|
+
import { useState as n, useRef as H, useCallback as U, useEffect as m } from "react";
|
|
2
2
|
import { i as s } from "./types.js";
|
|
3
|
-
import { useHostTools as
|
|
4
|
-
const
|
|
3
|
+
import { useHostTools as j, useNetwork as v } from "@m4l/core";
|
|
4
|
+
const K = (h) => {
|
|
5
5
|
const {
|
|
6
6
|
endPoint: w,
|
|
7
7
|
timeout: C = 5e3,
|
|
@@ -16,15 +16,16 @@ const J = (h) => {
|
|
|
16
16
|
isRemote: k = !0,
|
|
17
17
|
bodyToSnakeCase: y = !1,
|
|
18
18
|
responseToCamelCase: T = !1,
|
|
19
|
-
initialRows:
|
|
19
|
+
initialRows: b = [],
|
|
20
20
|
externalCondition: c = !0,
|
|
21
|
-
onNetworkError: f
|
|
22
|
-
|
|
21
|
+
onNetworkError: f,
|
|
22
|
+
getLabel: E
|
|
23
|
+
} = h, [p, g] = n(i ? 1 : 0), [O, a] = n(b), [x, o] = n({ ...s, rowsPerPage: u }), t = H({ ...s, rowsPerPage: u }), [F, L] = n(R), { startProgress: N, stopProgress: Q } = j(), { networkOperation: q } = v(), l = U(() => {
|
|
23
24
|
g((r) => r + 1);
|
|
24
25
|
}, []);
|
|
25
26
|
return m(() => {
|
|
26
|
-
if (
|
|
27
|
-
|
|
27
|
+
if (F) {
|
|
28
|
+
L(!1);
|
|
28
29
|
return;
|
|
29
30
|
}
|
|
30
31
|
t.current.page = 0, i && l();
|
|
@@ -59,14 +60,14 @@ const J = (h) => {
|
|
|
59
60
|
}), function() {
|
|
60
61
|
r = !1;
|
|
61
62
|
};
|
|
62
|
-
}, [p, c]), { onPageChange: (r) => {
|
|
63
|
+
}, [p, c, E]), { onPageChange: (r) => {
|
|
63
64
|
t.current.page = r, g((e) => e + 1);
|
|
64
65
|
}, onRowsPerPageChange: (r) => {
|
|
65
66
|
t.current.rowsPerPage = r, o((e) => ({ ...e, rowsPerPage: r })), g((e) => e + 1);
|
|
66
|
-
}, pagerState:
|
|
67
|
+
}, pagerState: x, rows: O, clearRows: () => {
|
|
67
68
|
a([]), o(s);
|
|
68
69
|
}, Refresh: l, setRows: a };
|
|
69
70
|
};
|
|
70
71
|
export {
|
|
71
|
-
|
|
72
|
+
K as u
|
|
72
73
|
};
|
|
@@ -1 +1,35 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { HostToolsType } from '@m4l/core';
|
|
3
|
+
import { Id, ToastOptions } from 'react-toastify';
|
|
4
|
+
export declare const mock_addFlag: import('vitest').Mock<(...args: any[]) => any>;
|
|
5
|
+
export declare const mock_networkOperation: import('vitest').Mock<(...args: any[]) => any>;
|
|
6
|
+
export declare const mock_events_add_listener: import('vitest').Mock<(...args: any[]) => any>;
|
|
7
|
+
export declare const mock_events_remove_listener: import('vitest').Mock<(...args: any[]) => any>;
|
|
8
|
+
export declare const mock_events_emit: import('vitest').Mock<(...args: any[]) => any>;
|
|
9
|
+
export declare const mock_startProgress: import('vitest').Mock<(...args: any[]) => any>;
|
|
10
|
+
export declare const mock_stopProgress: import('vitest').Mock<(...args: any[]) => any>;
|
|
11
|
+
export interface ToasterFunctionProps {
|
|
12
|
+
title: ReactNode;
|
|
13
|
+
description?: ReactNode;
|
|
14
|
+
}
|
|
15
|
+
export type Toaster = {
|
|
16
|
+
(props: ToasterFunctionProps, toastOptions?: ToastOptions): Id;
|
|
17
|
+
success(props: ToasterFunctionProps, toastOptions?: ToastOptions): Id;
|
|
18
|
+
info(props: ToasterFunctionProps, toastOptions?: ToastOptions): Id;
|
|
19
|
+
warning(props: ToasterFunctionProps, toastOptions?: ToastOptions): Id;
|
|
20
|
+
error(props: ToasterFunctionProps, toastOptions?: ToastOptions): Id;
|
|
21
|
+
};
|
|
22
|
+
export declare const mock_toaster: Toaster;
|
|
23
|
+
export declare const environmentDataForTesting: {
|
|
24
|
+
isLocalhost: boolean;
|
|
25
|
+
host: string;
|
|
26
|
+
domain_token: string;
|
|
27
|
+
host_api_local: string;
|
|
28
|
+
host_api_remote: string;
|
|
29
|
+
host_static_assets: string;
|
|
30
|
+
environment_assets: string;
|
|
31
|
+
isMicroFrontend: boolean;
|
|
32
|
+
isIsolatation: boolean;
|
|
33
|
+
database: string;
|
|
34
|
+
};
|
|
35
|
+
export declare const hostToolsDataForTesting: HostToolsType;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AxiosOptions, NetworkProps } from '@m4l/core';
|
|
1
|
+
import { AxiosOptions, GetLabelType, NetworkProps } from '@m4l/core';
|
|
2
2
|
export declare interface PagerState {
|
|
3
3
|
page: number;
|
|
4
4
|
rowsPerPage: number;
|
|
@@ -13,4 +13,5 @@ export interface UsePaginateProps<TRow> extends Pick<NetworkProps, 'endPoint' |
|
|
|
13
13
|
initialRows?: TRow[];
|
|
14
14
|
externalCondition?: boolean;
|
|
15
15
|
onNetworkError?: (code: number) => void;
|
|
16
|
+
getLabel?: GetLabelType;
|
|
16
17
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m4l/graphics",
|
|
3
|
-
"version": "7.0.11
|
|
3
|
+
"version": "7.0.11",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"author": "M4L Team*",
|
|
6
6
|
"type": "module",
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
"zustand": "4.3.6"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
|
-
"@m4l/core": "2.0.
|
|
21
|
-
"@m4l/styles": "^7.
|
|
20
|
+
"@m4l/core": "^2.0.0",
|
|
21
|
+
"@m4l/styles": "^7.0.0",
|
|
22
22
|
"@mui/material": "5.16.7",
|
|
23
23
|
"@mui/x-date-pickers": "6.20.2",
|
|
24
24
|
"@types/react": "^18.0.0",
|
package/test/setup.d.ts
ADDED
|
File without changes
|
package/test/utils.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { cleanup, screen } from '@testing-library/react';
|
|
2
|
+
import { renderHook } from '@testing-library/react-hooks';
|
|
3
|
+
import { default as React, act } from 'react';
|
|
4
|
+
/**
|
|
5
|
+
* customRender
|
|
6
|
+
*/
|
|
7
|
+
declare const customRender: (ui: React.ReactElement, options?: {}) => import('@testing-library/react').RenderResult<typeof import("@testing-library/dom/types/queries"), HTMLElement, HTMLElement>;
|
|
8
|
+
export { default as userEvent } from '@testing-library/user-event';
|
|
9
|
+
export { customRender as render, renderHook, screen, cleanup, act };
|