@etsoo/materialui 1.1.36 → 1.1.37
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/OptionBool.d.ts +13 -0
- package/lib/OptionBool.js +14 -0
- package/lib/OptionGroup.js +1 -3
- package/lib/SelectBool.d.ts +3 -3
- package/lib/SelectBool.js +5 -8
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/package.json +7 -7
- package/src/OptionBool.tsx +27 -0
- package/src/OptionGroup.tsx +1 -5
- package/src/SelectBool.tsx +13 -16
- package/src/index.ts +1 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ListType1 } from "@etsoo/shared";
|
|
3
|
+
import { OptionGroupProps } from "./OptionGroup";
|
|
4
|
+
/**
|
|
5
|
+
* OptionBool props
|
|
6
|
+
*/
|
|
7
|
+
export type OptionBoolProps = Omit<OptionGroupProps<ListType1, "id", "label">, "options" | "row" | "multiple">;
|
|
8
|
+
/**
|
|
9
|
+
* OptionBool (yes/no)
|
|
10
|
+
* @param props Props
|
|
11
|
+
* @returns Component
|
|
12
|
+
*/
|
|
13
|
+
export declare function OptionBool(props: OptionBoolProps): JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { globalApp } from "./app/ReactApp";
|
|
3
|
+
import { OptionGroup } from "./OptionGroup";
|
|
4
|
+
/**
|
|
5
|
+
* OptionBool (yes/no)
|
|
6
|
+
* @param props Props
|
|
7
|
+
* @returns Component
|
|
8
|
+
*/
|
|
9
|
+
export function OptionBool(props) {
|
|
10
|
+
// Options
|
|
11
|
+
const options = globalApp.getBools();
|
|
12
|
+
// Layout
|
|
13
|
+
return (React.createElement(OptionGroup, { options: options, row: true, multiple: false, ...props }));
|
|
14
|
+
}
|
package/lib/OptionGroup.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DataTypes, Utils } from "@etsoo/shared";
|
|
2
|
-
import { Box, Checkbox, FormControl, FormControlLabel, FormGroup, FormHelperText, InputLabel, Radio, RadioGroup
|
|
2
|
+
import { Box, Checkbox, FormControl, FormControlLabel, FormGroup, FormHelperText, InputLabel, Radio, RadioGroup } from "@mui/material";
|
|
3
3
|
import NotchedOutline from "@mui/material/OutlinedInput";
|
|
4
4
|
import React from "react";
|
|
5
5
|
/**
|
|
@@ -11,8 +11,6 @@ export function OptionGroup(props) {
|
|
|
11
11
|
var _a;
|
|
12
12
|
// Destruct
|
|
13
13
|
const { getOptionLabel, defaultValue, idField = "id", label, labelField = "label", multiple = false, mRef, name, onValueChange, options, readOnly, row, itemSize, itemHeight = row ? 56 : 42, helperText, variant, required, fullWidth, ...rest } = props;
|
|
14
|
-
// Theme
|
|
15
|
-
const theme = useTheme();
|
|
16
14
|
// Outlined
|
|
17
15
|
const outlined = variant === "outlined";
|
|
18
16
|
// Get option value
|
package/lib/SelectBool.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { ListType1 } from
|
|
3
|
-
import { SelectExProps } from
|
|
2
|
+
import { ListType1 } from "@etsoo/shared";
|
|
3
|
+
import { SelectExProps } from "./SelectEx";
|
|
4
4
|
/**
|
|
5
5
|
* SelectBool props
|
|
6
6
|
*/
|
|
7
|
-
export type SelectBoolProps = Omit<SelectExProps<ListType1>,
|
|
7
|
+
export type SelectBoolProps = Omit<SelectExProps<ListType1>, "options" | "loadData">;
|
|
8
8
|
/**
|
|
9
9
|
* SelectBool (yes/no)
|
|
10
10
|
* @param props Props
|
package/lib/SelectBool.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Utils } from
|
|
2
|
-
import React from
|
|
3
|
-
import { globalApp } from
|
|
4
|
-
import { SelectEx } from
|
|
1
|
+
import { Utils } from "@etsoo/shared";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { globalApp } from "./app/ReactApp";
|
|
4
|
+
import { SelectEx } from "./SelectEx";
|
|
5
5
|
/**
|
|
6
6
|
* SelectBool (yes/no)
|
|
7
7
|
* @param props Props
|
|
@@ -11,10 +11,7 @@ export function SelectBool(props) {
|
|
|
11
11
|
// Destruct
|
|
12
12
|
const { search = true, autoAddBlankItem = search, ...rest } = props;
|
|
13
13
|
// Options
|
|
14
|
-
const options =
|
|
15
|
-
{ id: 'false', label: globalApp.get('no') },
|
|
16
|
-
{ id: 'true', label: globalApp.get('yes') }
|
|
17
|
-
];
|
|
14
|
+
const options = globalApp.getBools();
|
|
18
15
|
if (autoAddBlankItem)
|
|
19
16
|
Utils.addBlankItem(options);
|
|
20
17
|
// Layout
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/materialui",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.37",
|
|
4
4
|
"description": "TypeScript Material-UI Implementation",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -47,12 +47,12 @@
|
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@dnd-kit/core": "^6.0.7",
|
|
49
49
|
"@dnd-kit/sortable": "^7.0.2",
|
|
50
|
-
"@emotion/css": "^11.10.
|
|
51
|
-
"@emotion/react": "^11.10.
|
|
52
|
-
"@emotion/styled": "^11.10.
|
|
53
|
-
"@etsoo/appscript": "^1.3.
|
|
50
|
+
"@emotion/css": "^11.10.6",
|
|
51
|
+
"@emotion/react": "^11.10.6",
|
|
52
|
+
"@emotion/styled": "^11.10.6",
|
|
53
|
+
"@etsoo/appscript": "^1.3.66",
|
|
54
54
|
"@etsoo/notificationbase": "^1.1.23",
|
|
55
|
-
"@etsoo/react": "^1.6.
|
|
55
|
+
"@etsoo/react": "^1.6.48",
|
|
56
56
|
"@etsoo/shared": "^1.1.88",
|
|
57
57
|
"@mui/icons-material": "^5.11.9",
|
|
58
58
|
"@mui/material": "^5.11.9",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"@babel/preset-typescript": "^7.18.6",
|
|
83
83
|
"@babel/runtime-corejs3": "^7.20.13",
|
|
84
84
|
"@testing-library/jest-dom": "^5.16.5",
|
|
85
|
-
"@testing-library/react": "^
|
|
85
|
+
"@testing-library/react": "^14.0.0",
|
|
86
86
|
"@types/jest": "^29.4.0",
|
|
87
87
|
"@typescript-eslint/eslint-plugin": "^5.52.0",
|
|
88
88
|
"@typescript-eslint/parser": "^5.52.0",
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ListType1 } from "@etsoo/shared";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { globalApp } from "./app/ReactApp";
|
|
4
|
+
import { OptionGroup, OptionGroupProps } from "./OptionGroup";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* OptionBool props
|
|
8
|
+
*/
|
|
9
|
+
export type OptionBoolProps = Omit<
|
|
10
|
+
OptionGroupProps<ListType1, "id", "label">,
|
|
11
|
+
"options" | "row" | "multiple"
|
|
12
|
+
>;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* OptionBool (yes/no)
|
|
16
|
+
* @param props Props
|
|
17
|
+
* @returns Component
|
|
18
|
+
*/
|
|
19
|
+
export function OptionBool(props: OptionBoolProps) {
|
|
20
|
+
// Options
|
|
21
|
+
const options = globalApp.getBools();
|
|
22
|
+
|
|
23
|
+
// Layout
|
|
24
|
+
return (
|
|
25
|
+
<OptionGroup<ListType1> options={options} row multiple={false} {...props} />
|
|
26
|
+
);
|
|
27
|
+
}
|
package/src/OptionGroup.tsx
CHANGED
|
@@ -15,8 +15,7 @@ import {
|
|
|
15
15
|
FormHelperText,
|
|
16
16
|
InputLabel,
|
|
17
17
|
Radio,
|
|
18
|
-
RadioGroup
|
|
19
|
-
useTheme
|
|
18
|
+
RadioGroup
|
|
20
19
|
} from "@mui/material";
|
|
21
20
|
import NotchedOutline from "@mui/material/OutlinedInput";
|
|
22
21
|
import React from "react";
|
|
@@ -149,9 +148,6 @@ export function OptionGroup<
|
|
|
149
148
|
...rest
|
|
150
149
|
} = props;
|
|
151
150
|
|
|
152
|
-
// Theme
|
|
153
|
-
const theme = useTheme();
|
|
154
|
-
|
|
155
151
|
// Outlined
|
|
156
152
|
const outlined = variant === "outlined";
|
|
157
153
|
|
package/src/SelectBool.tsx
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { ListType1, Utils } from
|
|
2
|
-
import React from
|
|
3
|
-
import { globalApp } from
|
|
4
|
-
import { SelectEx, SelectExProps } from
|
|
1
|
+
import { ListType1, Utils } from "@etsoo/shared";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { globalApp } from "./app/ReactApp";
|
|
4
|
+
import { SelectEx, SelectExProps } from "./SelectEx";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* SelectBool props
|
|
8
8
|
*/
|
|
9
9
|
export type SelectBoolProps = Omit<
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
SelectExProps<ListType1>,
|
|
11
|
+
"options" | "loadData"
|
|
12
12
|
>;
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -17,17 +17,14 @@ export type SelectBoolProps = Omit<
|
|
|
17
17
|
* @returns Component
|
|
18
18
|
*/
|
|
19
19
|
export function SelectBool(props: SelectBoolProps) {
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
// Destruct
|
|
21
|
+
const { search = true, autoAddBlankItem = search, ...rest } = props;
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
{ id: 'false', label: globalApp.get('no')! },
|
|
26
|
-
{ id: 'true', label: globalApp.get('yes')! }
|
|
27
|
-
];
|
|
23
|
+
// Options
|
|
24
|
+
const options = globalApp.getBools();
|
|
28
25
|
|
|
29
|
-
|
|
26
|
+
if (autoAddBlankItem) Utils.addBlankItem(options);
|
|
30
27
|
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
// Layout
|
|
29
|
+
return <SelectEx<ListType1> options={options} search={search} {...rest} />;
|
|
33
30
|
}
|
package/src/index.ts
CHANGED