@etsoo/materialui 1.5.67 → 1.5.69
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/__tests__/ReactAppTests.tsx +0 -28
- package/lib/cjs/SelectBool.d.ts +6 -1
- package/lib/cjs/SelectBool.js +2 -2
- package/lib/cjs/TabBox.d.ts +1 -1
- package/lib/cjs/TabBox.js +1 -1
- package/lib/mjs/SelectBool.d.ts +6 -1
- package/lib/mjs/SelectBool.js +2 -2
- package/lib/mjs/TabBox.d.ts +1 -1
- package/lib/mjs/TabBox.js +1 -1
- package/package.json +6 -6
- package/setupTests.ts +24 -0
- package/src/SelectBool.tsx +16 -4
- package/src/TabBox.tsx +2 -2
- package/vite.config.mts +1 -0
|
@@ -4,34 +4,6 @@ import { DataTypes, DomUtils, IActionResult, Utils } from "@etsoo/shared";
|
|
|
4
4
|
import React, { act } from "react";
|
|
5
5
|
import { createRoot } from "react-dom/client";
|
|
6
6
|
|
|
7
|
-
if (typeof localStorage === "undefined") {
|
|
8
|
-
const mockLocalStorage = (() => {
|
|
9
|
-
let store = {} as Storage;
|
|
10
|
-
|
|
11
|
-
return {
|
|
12
|
-
getItem(key: string) {
|
|
13
|
-
return store[key];
|
|
14
|
-
},
|
|
15
|
-
|
|
16
|
-
setItem(key: string, value: string) {
|
|
17
|
-
store[key] = value;
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
removeItem(key: string) {
|
|
21
|
-
delete store[key];
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
clear() {
|
|
25
|
-
store = {} as Storage;
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
})();
|
|
29
|
-
|
|
30
|
-
Object.defineProperty(globalThis, "localStorage", {
|
|
31
|
-
value: mockLocalStorage
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
|
|
35
7
|
// Detected country or region
|
|
36
8
|
const { detectedCountry } = DomUtils;
|
|
37
9
|
|
package/lib/cjs/SelectBool.d.ts
CHANGED
|
@@ -3,7 +3,12 @@ import { SelectExProps } from "./SelectEx";
|
|
|
3
3
|
/**
|
|
4
4
|
* SelectBool props
|
|
5
5
|
*/
|
|
6
|
-
export type SelectBoolProps = Omit<SelectExProps<ListType1>, "options" | "loadData"
|
|
6
|
+
export type SelectBoolProps = Omit<SelectExProps<ListType1>, "options" | "loadData" | "value"> & {
|
|
7
|
+
/**
|
|
8
|
+
* Value
|
|
9
|
+
*/
|
|
10
|
+
value?: boolean;
|
|
11
|
+
};
|
|
7
12
|
/**
|
|
8
13
|
* SelectBool (yes/no)
|
|
9
14
|
* @param props Props
|
package/lib/cjs/SelectBool.js
CHANGED
|
@@ -14,11 +14,11 @@ function SelectBool(props) {
|
|
|
14
14
|
// Global app
|
|
15
15
|
const app = (0, ReactApp_1.useAppContext)();
|
|
16
16
|
// Destruct
|
|
17
|
-
const { search = true, autoAddBlankItem = search, ...rest } = props;
|
|
17
|
+
const { search = true, autoAddBlankItem = search, value, ...rest } = props;
|
|
18
18
|
// Options
|
|
19
19
|
const options = app?.getBools() ?? [];
|
|
20
20
|
if (autoAddBlankItem)
|
|
21
21
|
shared_1.Utils.addBlankItem(options);
|
|
22
22
|
// Layout
|
|
23
|
-
return (0, jsx_runtime_1.jsx)(SelectEx_1.SelectEx, { options: options, search: search, ...rest });
|
|
23
|
+
return ((0, jsx_runtime_1.jsx)(SelectEx_1.SelectEx, { options: options, search: search, value: `${value ?? ""}`, ...rest }));
|
|
24
24
|
}
|
package/lib/cjs/TabBox.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { TabProps } from "@mui/material/Tab";
|
|
|
3
3
|
import { TabsProps } from "@mui/material/Tabs";
|
|
4
4
|
import React from "react";
|
|
5
5
|
type TabBoxPanelActionType = () => void;
|
|
6
|
-
type TabBoxPanelChildrenType = TabBoxPanelActionType | ((visible: boolean) => React.ReactNode) | React.ReactNode;
|
|
6
|
+
type TabBoxPanelChildrenType = TabBoxPanelActionType | ((visible: boolean, index: number) => React.ReactNode) | React.ReactNode;
|
|
7
7
|
/**
|
|
8
8
|
* Tab with box panel props
|
|
9
9
|
*/
|
package/lib/cjs/TabBox.js
CHANGED
|
@@ -50,5 +50,5 @@ function TabBox(props) {
|
|
|
50
50
|
if (onChange)
|
|
51
51
|
onChange(event, newValue);
|
|
52
52
|
}
|
|
53
|
-
}, ...rest, children: tabs.map(({ children, panelProps, ...tabRest }, index) => ((0, jsx_runtime_1.jsx)(Tab_1.default, { value: index, ...tabRest }, index))) }) }), tabs.map(({ children, panelProps }, index) => ((0, jsx_runtime_1.jsx)(Box_1.default, { hidden: value !== index, ...tabProps, ...panelProps, children: isActionTab(children) ? ((0, jsx_runtime_1.jsx)(react_2.default.Fragment, {})) : (shared_1.Utils.getResult(children, value === index)) }, index)))] }));
|
|
53
|
+
}, ...rest, children: tabs.map(({ children, panelProps, ...tabRest }, index) => ((0, jsx_runtime_1.jsx)(Tab_1.default, { value: index, ...tabRest }, index))) }) }), tabs.map(({ children, panelProps }, index) => ((0, jsx_runtime_1.jsx)(Box_1.default, { hidden: value !== index, ...tabProps, ...panelProps, children: isActionTab(children) ? ((0, jsx_runtime_1.jsx)(react_2.default.Fragment, {})) : (shared_1.Utils.getResult(children, value === index, index)) }, index)))] }));
|
|
54
54
|
}
|
package/lib/mjs/SelectBool.d.ts
CHANGED
|
@@ -3,7 +3,12 @@ import { SelectExProps } from "./SelectEx";
|
|
|
3
3
|
/**
|
|
4
4
|
* SelectBool props
|
|
5
5
|
*/
|
|
6
|
-
export type SelectBoolProps = Omit<SelectExProps<ListType1>, "options" | "loadData"
|
|
6
|
+
export type SelectBoolProps = Omit<SelectExProps<ListType1>, "options" | "loadData" | "value"> & {
|
|
7
|
+
/**
|
|
8
|
+
* Value
|
|
9
|
+
*/
|
|
10
|
+
value?: boolean;
|
|
11
|
+
};
|
|
7
12
|
/**
|
|
8
13
|
* SelectBool (yes/no)
|
|
9
14
|
* @param props Props
|
package/lib/mjs/SelectBool.js
CHANGED
|
@@ -11,11 +11,11 @@ export function SelectBool(props) {
|
|
|
11
11
|
// Global app
|
|
12
12
|
const app = useAppContext();
|
|
13
13
|
// Destruct
|
|
14
|
-
const { search = true, autoAddBlankItem = search, ...rest } = props;
|
|
14
|
+
const { search = true, autoAddBlankItem = search, value, ...rest } = props;
|
|
15
15
|
// Options
|
|
16
16
|
const options = app?.getBools() ?? [];
|
|
17
17
|
if (autoAddBlankItem)
|
|
18
18
|
Utils.addBlankItem(options);
|
|
19
19
|
// Layout
|
|
20
|
-
return _jsx(SelectEx, { options: options, search: search, ...rest });
|
|
20
|
+
return (_jsx(SelectEx, { options: options, search: search, value: `${value ?? ""}`, ...rest }));
|
|
21
21
|
}
|
package/lib/mjs/TabBox.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { TabProps } from "@mui/material/Tab";
|
|
|
3
3
|
import { TabsProps } from "@mui/material/Tabs";
|
|
4
4
|
import React from "react";
|
|
5
5
|
type TabBoxPanelActionType = () => void;
|
|
6
|
-
type TabBoxPanelChildrenType = TabBoxPanelActionType | ((visible: boolean) => React.ReactNode) | React.ReactNode;
|
|
6
|
+
type TabBoxPanelChildrenType = TabBoxPanelActionType | ((visible: boolean, index: number) => React.ReactNode) | React.ReactNode;
|
|
7
7
|
/**
|
|
8
8
|
* Tab with box panel props
|
|
9
9
|
*/
|
package/lib/mjs/TabBox.js
CHANGED
|
@@ -44,5 +44,5 @@ export function TabBox(props) {
|
|
|
44
44
|
if (onChange)
|
|
45
45
|
onChange(event, newValue);
|
|
46
46
|
}
|
|
47
|
-
}, ...rest, children: tabs.map(({ children, panelProps, ...tabRest }, index) => (_jsx(Tab, { value: index, ...tabRest }, index))) }) }), tabs.map(({ children, panelProps }, index) => (_jsx(Box, { hidden: value !== index, ...tabProps, ...panelProps, children: isActionTab(children) ? (_jsx(React.Fragment, {})) : (Utils.getResult(children, value === index)) }, index)))] }));
|
|
47
|
+
}, ...rest, children: tabs.map(({ children, panelProps, ...tabRest }, index) => (_jsx(Tab, { value: index, ...tabRest }, index))) }) }), tabs.map(({ children, panelProps }, index) => (_jsx(Box, { hidden: value !== index, ...tabProps, ...panelProps, children: isActionTab(children) ? (_jsx(React.Fragment, {})) : (Utils.getResult(children, value === index, index)) }, index)))] }));
|
|
48
48
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/materialui",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.69",
|
|
4
4
|
"description": "TypeScript Material-UI Implementation",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/mjs/index.js",
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
"@etsoo/notificationbase": "^1.1.63",
|
|
45
45
|
"@etsoo/react": "^1.8.49",
|
|
46
46
|
"@etsoo/shared": "^1.2.75",
|
|
47
|
-
"@mui/icons-material": "^7.
|
|
48
|
-
"@mui/material": "^7.
|
|
49
|
-
"@mui/x-data-grid": "^8.
|
|
47
|
+
"@mui/icons-material": "^7.3.0",
|
|
48
|
+
"@mui/material": "^7.3.0",
|
|
49
|
+
"@mui/x-data-grid": "^8.9.2",
|
|
50
50
|
"chart.js": "^4.5.0",
|
|
51
51
|
"chartjs-plugin-datalabels": "^2.2.0",
|
|
52
52
|
"dompurify": "^3.2.6",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"@babel/preset-env": "^7.28.0",
|
|
73
73
|
"@babel/preset-react": "^7.27.1",
|
|
74
74
|
"@babel/preset-typescript": "^7.27.1",
|
|
75
|
-
"@babel/runtime-corejs3": "^7.28.
|
|
75
|
+
"@babel/runtime-corejs3": "^7.28.2",
|
|
76
76
|
"@testing-library/react": "^16.3.0",
|
|
77
77
|
"@types/pica": "^9.0.5",
|
|
78
78
|
"@types/pulltorefreshjs": "^0.1.7",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"@types/react-window": "^1.8.8",
|
|
84
84
|
"@vitejs/plugin-react": "^4.7.0",
|
|
85
85
|
"jsdom": "^26.1.0",
|
|
86
|
-
"typescript": "^5.
|
|
86
|
+
"typescript": "^5.9.2",
|
|
87
87
|
"vitest": "^3.2.4"
|
|
88
88
|
}
|
|
89
89
|
}
|
package/setupTests.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { vi } from "vitest";
|
|
2
|
+
|
|
3
|
+
vi.mock("localStorage", () => {
|
|
4
|
+
let store = {} as Storage;
|
|
5
|
+
return {
|
|
6
|
+
default: {
|
|
7
|
+
getItem(key: string) {
|
|
8
|
+
return store[key];
|
|
9
|
+
},
|
|
10
|
+
|
|
11
|
+
setItem(key: string, value: string) {
|
|
12
|
+
store[key] = value;
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
removeItem(key: string) {
|
|
16
|
+
delete store[key];
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
clear() {
|
|
20
|
+
store = {} as Storage;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
});
|
package/src/SelectBool.tsx
CHANGED
|
@@ -7,8 +7,13 @@ import { useAppContext } from "./app/ReactApp";
|
|
|
7
7
|
*/
|
|
8
8
|
export type SelectBoolProps = Omit<
|
|
9
9
|
SelectExProps<ListType1>,
|
|
10
|
-
"options" | "loadData"
|
|
11
|
-
|
|
10
|
+
"options" | "loadData" | "value"
|
|
11
|
+
> & {
|
|
12
|
+
/**
|
|
13
|
+
* Value
|
|
14
|
+
*/
|
|
15
|
+
value?: boolean;
|
|
16
|
+
};
|
|
12
17
|
|
|
13
18
|
/**
|
|
14
19
|
* SelectBool (yes/no)
|
|
@@ -20,7 +25,7 @@ export function SelectBool(props: SelectBoolProps) {
|
|
|
20
25
|
const app = useAppContext();
|
|
21
26
|
|
|
22
27
|
// Destruct
|
|
23
|
-
const { search = true, autoAddBlankItem = search, ...rest } = props;
|
|
28
|
+
const { search = true, autoAddBlankItem = search, value, ...rest } = props;
|
|
24
29
|
|
|
25
30
|
// Options
|
|
26
31
|
const options = app?.getBools() ?? [];
|
|
@@ -28,5 +33,12 @@ export function SelectBool(props: SelectBoolProps) {
|
|
|
28
33
|
if (autoAddBlankItem) Utils.addBlankItem(options);
|
|
29
34
|
|
|
30
35
|
// Layout
|
|
31
|
-
return
|
|
36
|
+
return (
|
|
37
|
+
<SelectEx<ListType1>
|
|
38
|
+
options={options}
|
|
39
|
+
search={search}
|
|
40
|
+
value={`${value ?? ""}`}
|
|
41
|
+
{...rest}
|
|
42
|
+
/>
|
|
43
|
+
);
|
|
32
44
|
}
|
package/src/TabBox.tsx
CHANGED
|
@@ -9,7 +9,7 @@ type TabBoxPanelActionType = () => void;
|
|
|
9
9
|
|
|
10
10
|
type TabBoxPanelChildrenType =
|
|
11
11
|
| TabBoxPanelActionType
|
|
12
|
-
| ((visible: boolean) => React.ReactNode)
|
|
12
|
+
| ((visible: boolean, index: number) => React.ReactNode)
|
|
13
13
|
| React.ReactNode;
|
|
14
14
|
|
|
15
15
|
function isActionTab(
|
|
@@ -137,7 +137,7 @@ export function TabBox(props: TabBoxProps) {
|
|
|
137
137
|
{isActionTab(children) ? (
|
|
138
138
|
<React.Fragment />
|
|
139
139
|
) : (
|
|
140
|
-
Utils.getResult(children, value === index)
|
|
140
|
+
Utils.getResult(children, value === index, index)
|
|
141
141
|
)}
|
|
142
142
|
</Box>
|
|
143
143
|
))}
|