mui-fast-start 0.3.1 → 0.3.3
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/README.md +403 -403
- package/README_KR.md +403 -403
- package/dist/components/Object/Select/ObjSelectRecord.d.ts +2 -1
- package/dist/components/Object/Select/ObjSelectRecord.d.ts.map +1 -1
- package/dist/components/Single/Select/SingleSelectRecord.d.ts +2 -1
- package/dist/components/Single/Select/SingleSelectRecord.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/styles/FastStartProps.d.ts +2 -1
- package/dist/styles/FastStartProps.d.ts.map +1 -1
- package/dist/types/props.d.ts +1 -1
- package/dist/types/props.d.ts.map +1 -1
- package/dist/types/props.internal.d.ts +1 -1
- package/dist/types/props.internal.d.ts.map +1 -1
- package/dist/types/provider.d.ts +2 -1
- package/dist/types/provider.d.ts.map +1 -1
- package/examples/basic/README.md +73 -73
- package/examples/basic/eslint.config.js +23 -23
- package/examples/basic/index.html +13 -13
- package/examples/basic/package.json +37 -37
- package/examples/basic/src/App.css +4 -4
- package/examples/basic/src/App.tsx +28 -28
- package/examples/basic/src/index.css +29 -29
- package/examples/basic/src/main.tsx +50 -50
- package/examples/basic/src/pages/ObjPage.tsx +175 -175
- package/examples/basic/src/pages/SinglePage.tsx +137 -137
- package/examples/basic/tsconfig.app.json +43 -43
- package/examples/basic/tsconfig.json +7 -7
- package/examples/basic/tsconfig.node.json +40 -40
- package/examples/basic/vite.config.ts +28 -28
- package/mui-fast-start-0.1.4.tgz +0 -0
- package/package.json +67 -67
- package/src/components/Object/Checkbox/ObjCheckIcon.tsx +29 -29
- package/src/components/Object/Checkbox/ObjCheckbox.tsx +31 -31
- package/src/components/Object/Select/ObjSelectOne.tsx +33 -33
- package/src/components/Object/Select/ObjSelectRecord.tsx +33 -33
- package/src/components/Object/Textfield/ObjNumber.tsx +51 -51
- package/src/components/Object/Textfield/ObjText.tsx +29 -29
- package/src/components/Single/Checkbox/SingleCheckIcon.tsx +27 -27
- package/src/components/Single/Checkbox/SingleCheckbox.tsx +33 -33
- package/src/components/Single/Select/BaseSingleSelect.tsx +45 -45
- package/src/components/Single/Select/SingleSelectOne.tsx +56 -56
- package/src/components/Single/Select/SingleSelectRecord.tsx +51 -51
- package/src/components/Single/TextField/SingleNumber.tsx +18 -18
- package/src/components/Single/TextField/SingleText.tsx +13 -13
- package/src/components/index.ts +15 -15
- package/src/hooks/index.ts +3 -3
- package/src/hooks/splits/useSplitNumberProps.ts +161 -161
- package/src/hooks/splits/useSplitTextProps.ts +36 -36
- package/src/hooks/state/useObjToSingle.ts +24 -24
- package/src/index.ts +7 -7
- package/src/styles/FastStartProps.ts +82 -81
- package/src/styles/FastStartProvider.tsx +25 -25
- package/src/types/index.ts +3 -3
- package/src/types/props.internal.ts +21 -21
- package/src/types/props.ts +81 -81
- package/src/types/provider.ts +72 -71
- package/src/types/types.ts +9 -9
- package/src/utils/index.ts +2 -2
- package/src/utils/number/calculate.ts +102 -102
- package/src/utils/object/error.ts +15 -15
- package/src/utils/object/merge.ts +47 -47
- package/tsconfig.json +34 -34
- package/tsconfig.lib.json +9 -9
- package/vite.config.ts +35 -35
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import {useContext} from "react";
|
|
2
|
-
import useObjToSingle from "../../../hooks/state/useObjToSingle.ts";
|
|
3
|
-
import {SingleCheckIcon} from "../../Single/Checkbox/SingleCheckIcon.tsx";
|
|
4
|
-
import {FastStartContext} from "../../../styles/FastStartProvider.tsx";
|
|
5
|
-
import {IconButtonProps} from "@mui/material";
|
|
6
|
-
import {MfsObjectCheckIconProps} from "../../../types";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export const ObjCheckIcon = <T extends object>(
|
|
10
|
-
customProps: Omit<IconButtonProps, 'name'> & MfsObjectCheckIconProps<T>
|
|
11
|
-
) => {
|
|
12
|
-
const defaultProps = useContext(FastStartContext)?.Object?.MfsCheckIcon;
|
|
13
|
-
const {
|
|
14
|
-
get, set, name,
|
|
15
|
-
...props
|
|
16
|
-
} = defaultProps == null
|
|
17
|
-
? customProps
|
|
18
|
-
: Object.assign({...defaultProps}, customProps);
|
|
19
|
-
|
|
20
|
-
const [value, setValue] = useObjToSingle<T, boolean>(name, get, set);
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<SingleCheckIcon
|
|
24
|
-
get={value} set={setValue}
|
|
25
|
-
name={name?.toString()}
|
|
26
|
-
{...props}
|
|
27
|
-
/>
|
|
28
|
-
);
|
|
29
|
-
}
|
|
1
|
+
import {useContext} from "react";
|
|
2
|
+
import useObjToSingle from "../../../hooks/state/useObjToSingle.ts";
|
|
3
|
+
import {SingleCheckIcon} from "../../Single/Checkbox/SingleCheckIcon.tsx";
|
|
4
|
+
import {FastStartContext} from "../../../styles/FastStartProvider.tsx";
|
|
5
|
+
import {IconButtonProps} from "@mui/material";
|
|
6
|
+
import {MfsObjectCheckIconProps} from "../../../types";
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
export const ObjCheckIcon = <T extends object>(
|
|
10
|
+
customProps: Omit<IconButtonProps, 'name'> & MfsObjectCheckIconProps<T>
|
|
11
|
+
) => {
|
|
12
|
+
const defaultProps = useContext(FastStartContext)?.Object?.MfsCheckIcon;
|
|
13
|
+
const {
|
|
14
|
+
get, set, name,
|
|
15
|
+
...props
|
|
16
|
+
} = defaultProps == null
|
|
17
|
+
? customProps
|
|
18
|
+
: Object.assign({...defaultProps}, customProps);
|
|
19
|
+
|
|
20
|
+
const [value, setValue] = useObjToSingle<T, boolean>(name, get, set);
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<SingleCheckIcon
|
|
24
|
+
get={value} set={setValue}
|
|
25
|
+
name={name?.toString()}
|
|
26
|
+
{...props}
|
|
27
|
+
/>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import React, {useContext} from "react";
|
|
2
|
-
import {SingleCheckbox} from "../../Single/Checkbox/SingleCheckbox.tsx";
|
|
3
|
-
import {FastStartContext} from "../../../styles/FastStartProvider.tsx";
|
|
4
|
-
import {CheckboxProps} from "@mui/material";
|
|
5
|
-
import {MfsObjectCheckboxProps} from "../../../types";
|
|
6
|
-
import useObjToSingle from "../../../hooks/state/useObjToSingle.ts";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export const ObjCheckbox = <T extends object>(
|
|
10
|
-
customProps: Omit<CheckboxProps, 'name'> & MfsObjectCheckboxProps<T>
|
|
11
|
-
) => {
|
|
12
|
-
const defaultProps = useContext(FastStartContext)?.Object?.MfsCheckbox;
|
|
13
|
-
const {
|
|
14
|
-
get, set, label, name,
|
|
15
|
-
...props
|
|
16
|
-
} = defaultProps == null
|
|
17
|
-
? customProps
|
|
18
|
-
: Object.assign({...defaultProps}, customProps);
|
|
19
|
-
|
|
20
|
-
const [value, setValue] = useObjToSingle<T, boolean>(name, get, set);
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<SingleCheckbox
|
|
24
|
-
get={value}
|
|
25
|
-
set={setValue}
|
|
26
|
-
label={label}
|
|
27
|
-
name={name?.toString()}
|
|
28
|
-
{...props}
|
|
29
|
-
/>
|
|
30
|
-
);
|
|
31
|
-
}
|
|
1
|
+
import React, {useContext} from "react";
|
|
2
|
+
import {SingleCheckbox} from "../../Single/Checkbox/SingleCheckbox.tsx";
|
|
3
|
+
import {FastStartContext} from "../../../styles/FastStartProvider.tsx";
|
|
4
|
+
import {CheckboxProps} from "@mui/material";
|
|
5
|
+
import {MfsObjectCheckboxProps} from "../../../types";
|
|
6
|
+
import useObjToSingle from "../../../hooks/state/useObjToSingle.ts";
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
export const ObjCheckbox = <T extends object>(
|
|
10
|
+
customProps: Omit<CheckboxProps, 'name'> & MfsObjectCheckboxProps<T>
|
|
11
|
+
) => {
|
|
12
|
+
const defaultProps = useContext(FastStartContext)?.Object?.MfsCheckbox;
|
|
13
|
+
const {
|
|
14
|
+
get, set, label, name,
|
|
15
|
+
...props
|
|
16
|
+
} = defaultProps == null
|
|
17
|
+
? customProps
|
|
18
|
+
: Object.assign({...defaultProps}, customProps);
|
|
19
|
+
|
|
20
|
+
const [value, setValue] = useObjToSingle<T, boolean>(name, get, set);
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<SingleCheckbox
|
|
24
|
+
get={value}
|
|
25
|
+
set={setValue}
|
|
26
|
+
label={label}
|
|
27
|
+
name={name?.toString()}
|
|
28
|
+
{...props}
|
|
29
|
+
/>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import {useContext} from "react";
|
|
2
|
-
import {FastStartContext} from "../../../styles/FastStartProvider.tsx";
|
|
3
|
-
import {SingleSelectOne} from "../../Single/Select/SingleSelectOne.tsx";
|
|
4
|
-
import {SelectProps} from "@mui/material";
|
|
5
|
-
import {MfsObjectSelectOneProps} from "../../../types";
|
|
6
|
-
import useObjToSingle from "../../../hooks/state/useObjToSingle.ts";
|
|
7
|
-
import {errorObjectToString} from "../../../utils/object/error.ts";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export const ObjSelectOne = <
|
|
11
|
-
T extends object,
|
|
12
|
-
Item
|
|
13
|
-
>(customProps: Omit<SelectProps, 'name'> & MfsObjectSelectOneProps<T, Item>) => {
|
|
14
|
-
const defaultProps = useContext(FastStartContext)?.Object?.MfsSelectOne;
|
|
15
|
-
const {
|
|
16
|
-
get, set, err, name,
|
|
17
|
-
variant,
|
|
18
|
-
...props
|
|
19
|
-
} = defaultProps == null
|
|
20
|
-
? customProps
|
|
21
|
-
: Object.assign({...defaultProps}, customProps);
|
|
22
|
-
|
|
23
|
-
const [value, setValue] = useObjToSingle<T, Item>(name, get, set);
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<SingleSelectOne<Item>
|
|
27
|
-
get={value} set={setValue}
|
|
28
|
-
name={name?.toString()}
|
|
29
|
-
err={errorObjectToString(name, err)}
|
|
30
|
-
variant={variant}
|
|
31
|
-
{...props}
|
|
32
|
-
/>
|
|
33
|
-
)
|
|
1
|
+
import {useContext} from "react";
|
|
2
|
+
import {FastStartContext} from "../../../styles/FastStartProvider.tsx";
|
|
3
|
+
import {SingleSelectOne} from "../../Single/Select/SingleSelectOne.tsx";
|
|
4
|
+
import {SelectProps} from "@mui/material";
|
|
5
|
+
import {MfsObjectSelectOneProps} from "../../../types";
|
|
6
|
+
import useObjToSingle from "../../../hooks/state/useObjToSingle.ts";
|
|
7
|
+
import {errorObjectToString} from "../../../utils/object/error.ts";
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
export const ObjSelectOne = <
|
|
11
|
+
T extends object,
|
|
12
|
+
Item
|
|
13
|
+
>(customProps: Omit<SelectProps, 'name'> & MfsObjectSelectOneProps<T, Item>) => {
|
|
14
|
+
const defaultProps = useContext(FastStartContext)?.Object?.MfsSelectOne;
|
|
15
|
+
const {
|
|
16
|
+
get, set, err, name,
|
|
17
|
+
variant,
|
|
18
|
+
...props
|
|
19
|
+
} = defaultProps == null
|
|
20
|
+
? customProps
|
|
21
|
+
: Object.assign({...defaultProps}, customProps);
|
|
22
|
+
|
|
23
|
+
const [value, setValue] = useObjToSingle<T, Item>(name, get, set);
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<SingleSelectOne<Item>
|
|
27
|
+
get={value} set={setValue}
|
|
28
|
+
name={name?.toString()}
|
|
29
|
+
err={errorObjectToString(name, err)}
|
|
30
|
+
variant={variant}
|
|
31
|
+
{...props}
|
|
32
|
+
/>
|
|
33
|
+
)
|
|
34
34
|
}
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import {useContext} from "react";
|
|
2
|
-
import {FastStartContext} from "../../../styles/FastStartProvider.tsx";
|
|
3
|
-
import useObjToSingle from "../../../hooks/state/useObjToSingle.ts";
|
|
4
|
-
import {SingleSelectRecord} from "../../Single/Select/SingleSelectRecord.tsx";
|
|
5
|
-
import {MfsObjectSelectRecordProps} from "../../../types";
|
|
6
|
-
import {SelectProps} from "@mui/material";
|
|
7
|
-
import {errorObjectToString} from "../../../utils/object/error.ts";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export const ObjSelectRecord = <
|
|
11
|
-
T extends object,
|
|
12
|
-
Item extends Record<PropertyKey,
|
|
13
|
-
>(customProps: Omit<SelectProps, 'name'> & MfsObjectSelectRecordProps<T, Item>) => {
|
|
14
|
-
const defaultProps = useContext(FastStartContext)?.Single?.MfsSelectRecord;
|
|
15
|
-
const {
|
|
16
|
-
get, set, err, name,
|
|
17
|
-
variant,
|
|
18
|
-
...props
|
|
19
|
-
} = defaultProps == null
|
|
20
|
-
? customProps
|
|
21
|
-
: Object.assign({...defaultProps}, customProps);
|
|
22
|
-
|
|
23
|
-
const [value, setValue] = useObjToSingle<T, Item>(name, get, set);
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<SingleSelectRecord
|
|
27
|
-
get={value} set={setValue}
|
|
28
|
-
name={name?.toString()}
|
|
29
|
-
err={errorObjectToString(name, err)}
|
|
30
|
-
variant={variant}
|
|
31
|
-
{...props}
|
|
32
|
-
/>
|
|
33
|
-
)
|
|
1
|
+
import React, {useContext} from "react";
|
|
2
|
+
import {FastStartContext} from "../../../styles/FastStartProvider.tsx";
|
|
3
|
+
import useObjToSingle from "../../../hooks/state/useObjToSingle.ts";
|
|
4
|
+
import {SingleSelectRecord} from "../../Single/Select/SingleSelectRecord.tsx";
|
|
5
|
+
import {MfsObjectSelectRecordProps} from "../../../types";
|
|
6
|
+
import {SelectProps} from "@mui/material";
|
|
7
|
+
import {errorObjectToString} from "../../../utils/object/error.ts";
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
export const ObjSelectRecord = <
|
|
11
|
+
T extends object,
|
|
12
|
+
Item extends Record<PropertyKey, React.ReactNode>
|
|
13
|
+
>(customProps: Omit<SelectProps, 'name'> & MfsObjectSelectRecordProps<T, Item>) => {
|
|
14
|
+
const defaultProps = useContext(FastStartContext)?.Single?.MfsSelectRecord;
|
|
15
|
+
const {
|
|
16
|
+
get, set, err, name,
|
|
17
|
+
variant,
|
|
18
|
+
...props
|
|
19
|
+
} = defaultProps == null
|
|
20
|
+
? customProps
|
|
21
|
+
: Object.assign({...defaultProps}, customProps);
|
|
22
|
+
|
|
23
|
+
const [value, setValue] = useObjToSingle<T, Item>(name, get, set);
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<SingleSelectRecord
|
|
27
|
+
get={value} set={setValue}
|
|
28
|
+
name={name?.toString()}
|
|
29
|
+
err={errorObjectToString(name, err)}
|
|
30
|
+
variant={variant}
|
|
31
|
+
{...props}
|
|
32
|
+
/>
|
|
33
|
+
)
|
|
34
34
|
}
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import {useContext} from "react";
|
|
2
|
-
import useObjToSingle from "../../../hooks/state/useObjToSingle.ts";
|
|
3
|
-
import {FastStartContext} from "../../../styles/FastStartProvider.tsx";
|
|
4
|
-
import {errorObjectToString} from "../../../utils/object/error.ts";
|
|
5
|
-
import {SingleFloat, SingleInteger} from "../../Single/TextField/SingleNumber.tsx";
|
|
6
|
-
import {MfsObjectNumberProps} from "../../../types";
|
|
7
|
-
import {TextFieldProps} from "@mui/material";
|
|
8
|
-
|
|
9
|
-
type ObjNumberProps<T extends object> = Omit<TextFieldProps, 'name'> & MfsObjectNumberProps<T>;
|
|
10
|
-
|
|
11
|
-
export const ObjFloat = <T extends object>(customProps: ObjNumberProps<T>) => {
|
|
12
|
-
const defaultProps = useContext(FastStartContext)?.Object?.MfsFloat;
|
|
13
|
-
const {
|
|
14
|
-
get, set, err, name,
|
|
15
|
-
...props
|
|
16
|
-
} = defaultProps == null
|
|
17
|
-
? customProps
|
|
18
|
-
: Object.assign({...defaultProps}, customProps);
|
|
19
|
-
|
|
20
|
-
const [value, setValue] = useObjToSingle<T, number>(name, get, set);
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<SingleFloat
|
|
24
|
-
get={value} set={setValue}
|
|
25
|
-
name={name?.toString()}
|
|
26
|
-
err={errorObjectToString(name, err)}
|
|
27
|
-
{...props}
|
|
28
|
-
/>
|
|
29
|
-
)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export const ObjInteger = <T extends object>(customProps: ObjNumberProps<T>) => {
|
|
33
|
-
const defaultProps = useContext(FastStartContext)?.Object?.MfsInteger;
|
|
34
|
-
const {
|
|
35
|
-
get, set, err, name,
|
|
36
|
-
...props
|
|
37
|
-
} = defaultProps == null
|
|
38
|
-
? customProps
|
|
39
|
-
: Object.assign({...defaultProps}, customProps);
|
|
40
|
-
|
|
41
|
-
const [value, setValue] = useObjToSingle<T, number>(name, get, set);
|
|
42
|
-
|
|
43
|
-
return (
|
|
44
|
-
<SingleInteger
|
|
45
|
-
get={value} set={setValue}
|
|
46
|
-
name={name?.toString()}
|
|
47
|
-
err={errorObjectToString(name, err)}
|
|
48
|
-
{...props}
|
|
49
|
-
/>
|
|
50
|
-
)
|
|
51
|
-
}
|
|
1
|
+
import {useContext} from "react";
|
|
2
|
+
import useObjToSingle from "../../../hooks/state/useObjToSingle.ts";
|
|
3
|
+
import {FastStartContext} from "../../../styles/FastStartProvider.tsx";
|
|
4
|
+
import {errorObjectToString} from "../../../utils/object/error.ts";
|
|
5
|
+
import {SingleFloat, SingleInteger} from "../../Single/TextField/SingleNumber.tsx";
|
|
6
|
+
import {MfsObjectNumberProps} from "../../../types";
|
|
7
|
+
import {TextFieldProps} from "@mui/material";
|
|
8
|
+
|
|
9
|
+
type ObjNumberProps<T extends object> = Omit<TextFieldProps, 'name'> & MfsObjectNumberProps<T>;
|
|
10
|
+
|
|
11
|
+
export const ObjFloat = <T extends object>(customProps: ObjNumberProps<T>) => {
|
|
12
|
+
const defaultProps = useContext(FastStartContext)?.Object?.MfsFloat;
|
|
13
|
+
const {
|
|
14
|
+
get, set, err, name,
|
|
15
|
+
...props
|
|
16
|
+
} = defaultProps == null
|
|
17
|
+
? customProps
|
|
18
|
+
: Object.assign({...defaultProps}, customProps);
|
|
19
|
+
|
|
20
|
+
const [value, setValue] = useObjToSingle<T, number>(name, get, set);
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<SingleFloat
|
|
24
|
+
get={value} set={setValue}
|
|
25
|
+
name={name?.toString()}
|
|
26
|
+
err={errorObjectToString(name, err)}
|
|
27
|
+
{...props}
|
|
28
|
+
/>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const ObjInteger = <T extends object>(customProps: ObjNumberProps<T>) => {
|
|
33
|
+
const defaultProps = useContext(FastStartContext)?.Object?.MfsInteger;
|
|
34
|
+
const {
|
|
35
|
+
get, set, err, name,
|
|
36
|
+
...props
|
|
37
|
+
} = defaultProps == null
|
|
38
|
+
? customProps
|
|
39
|
+
: Object.assign({...defaultProps}, customProps);
|
|
40
|
+
|
|
41
|
+
const [value, setValue] = useObjToSingle<T, number>(name, get, set);
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<SingleInteger
|
|
45
|
+
get={value} set={setValue}
|
|
46
|
+
name={name?.toString()}
|
|
47
|
+
err={errorObjectToString(name, err)}
|
|
48
|
+
{...props}
|
|
49
|
+
/>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import {useContext} from "react";
|
|
2
|
-
import {MfsObjectTextProps} from "../../../types";
|
|
3
|
-
import {FastStartContext} from "../../../styles/FastStartProvider.tsx";
|
|
4
|
-
import useObjToSingle from "../../../hooks/state/useObjToSingle.ts";
|
|
5
|
-
import {SingleText} from "../../Single/TextField/SingleText.tsx";
|
|
6
|
-
import {errorObjectToString} from "../../../utils/object/error.ts";
|
|
7
|
-
import {TextFieldProps} from "@mui/material";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export const ObjText = <T extends object>(
|
|
11
|
-
customProps: Omit<TextFieldProps, 'name'> & MfsObjectTextProps<T>
|
|
12
|
-
) => {
|
|
13
|
-
const defaultProps = useContext(FastStartContext)?.Object?.MfsText;
|
|
14
|
-
const {
|
|
15
|
-
get, set, err, name,
|
|
16
|
-
...props
|
|
17
|
-
} = defaultProps == null ? customProps : Object.assign({...defaultProps}, customProps);
|
|
18
|
-
|
|
19
|
-
const [value, setValue] = useObjToSingle<T, string>(name, get, set);
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
<SingleText
|
|
23
|
-
get={value} set={setValue}
|
|
24
|
-
name={name?.toString()}
|
|
25
|
-
err={errorObjectToString(name, err)}
|
|
26
|
-
{...props}
|
|
27
|
-
/>
|
|
28
|
-
);
|
|
29
|
-
};
|
|
1
|
+
import {useContext} from "react";
|
|
2
|
+
import {MfsObjectTextProps} from "../../../types";
|
|
3
|
+
import {FastStartContext} from "../../../styles/FastStartProvider.tsx";
|
|
4
|
+
import useObjToSingle from "../../../hooks/state/useObjToSingle.ts";
|
|
5
|
+
import {SingleText} from "../../Single/TextField/SingleText.tsx";
|
|
6
|
+
import {errorObjectToString} from "../../../utils/object/error.ts";
|
|
7
|
+
import {TextFieldProps} from "@mui/material";
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
export const ObjText = <T extends object>(
|
|
11
|
+
customProps: Omit<TextFieldProps, 'name'> & MfsObjectTextProps<T>
|
|
12
|
+
) => {
|
|
13
|
+
const defaultProps = useContext(FastStartContext)?.Object?.MfsText;
|
|
14
|
+
const {
|
|
15
|
+
get, set, err, name,
|
|
16
|
+
...props
|
|
17
|
+
} = defaultProps == null ? customProps : Object.assign({...defaultProps}, customProps);
|
|
18
|
+
|
|
19
|
+
const [value, setValue] = useObjToSingle<T, string>(name, get, set);
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<SingleText
|
|
23
|
+
get={value} set={setValue}
|
|
24
|
+
name={name?.toString()}
|
|
25
|
+
err={errorObjectToString(name, err)}
|
|
26
|
+
{...props}
|
|
27
|
+
/>
|
|
28
|
+
);
|
|
29
|
+
};
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import {useCallback, useContext} from "react";
|
|
2
|
-
import {IconButton, IconButtonProps} from "@mui/material";
|
|
3
|
-
import {FastStartContext} from "../../../styles/FastStartProvider.tsx";
|
|
4
|
-
import {MfsSingleCheckIconProps} from "../../../types";
|
|
5
|
-
|
|
6
|
-
export type SingleCheckIconProps = IconButtonProps & MfsSingleCheckIconProps;
|
|
7
|
-
|
|
8
|
-
export const SingleCheckIcon = (customProps: SingleCheckIconProps) => {
|
|
9
|
-
const defaultProps = useContext(FastStartContext)?.Single?.MfsCheckIcon;
|
|
10
|
-
const {
|
|
11
|
-
get, set, on, off,
|
|
12
|
-
...props
|
|
13
|
-
} = defaultProps == null
|
|
14
|
-
? customProps
|
|
15
|
-
: Object.assign({...defaultProps}, customProps);
|
|
16
|
-
|
|
17
|
-
const onClick = useCallback(() => set((state) => !state), [set]);
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<IconButton
|
|
21
|
-
onClick={onClick}
|
|
22
|
-
{...props}
|
|
23
|
-
>
|
|
24
|
-
{get ? on : off}
|
|
25
|
-
</IconButton>
|
|
26
|
-
)
|
|
27
|
-
}
|
|
1
|
+
import {useCallback, useContext} from "react";
|
|
2
|
+
import {IconButton, IconButtonProps} from "@mui/material";
|
|
3
|
+
import {FastStartContext} from "../../../styles/FastStartProvider.tsx";
|
|
4
|
+
import {MfsSingleCheckIconProps} from "../../../types";
|
|
5
|
+
|
|
6
|
+
export type SingleCheckIconProps = IconButtonProps & MfsSingleCheckIconProps;
|
|
7
|
+
|
|
8
|
+
export const SingleCheckIcon = (customProps: SingleCheckIconProps) => {
|
|
9
|
+
const defaultProps = useContext(FastStartContext)?.Single?.MfsCheckIcon;
|
|
10
|
+
const {
|
|
11
|
+
get, set, on, off,
|
|
12
|
+
...props
|
|
13
|
+
} = defaultProps == null
|
|
14
|
+
? customProps
|
|
15
|
+
: Object.assign({...defaultProps}, customProps);
|
|
16
|
+
|
|
17
|
+
const onClick = useCallback(() => set((state) => !state), [set]);
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<IconButton
|
|
21
|
+
onClick={onClick}
|
|
22
|
+
{...props}
|
|
23
|
+
>
|
|
24
|
+
{get ? on : off}
|
|
25
|
+
</IconButton>
|
|
26
|
+
)
|
|
27
|
+
}
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import {Checkbox, CheckboxProps, FormControlLabel} from "@mui/material";
|
|
2
|
-
import React, {useCallback, useContext} from "react";
|
|
3
|
-
import {FastStartContext} from "../../../styles/FastStartProvider.tsx";
|
|
4
|
-
import {MfsSingleCheckboxProps} from "../../../types";
|
|
5
|
-
|
|
6
|
-
export type SingleCheckboxProps = CheckboxProps & MfsSingleCheckboxProps;
|
|
7
|
-
|
|
8
|
-
export const SingleCheckbox = (customProps: SingleCheckboxProps) => {
|
|
9
|
-
const defaultProps = useContext(FastStartContext)?.Single?.MfsCheckbox;
|
|
10
|
-
const {
|
|
11
|
-
get, set, label,
|
|
12
|
-
...props
|
|
13
|
-
} = defaultProps == null
|
|
14
|
-
? customProps
|
|
15
|
-
: Object.assign({...defaultProps}, customProps);
|
|
16
|
-
|
|
17
|
-
const onChange = useCallback(() => set((state) => !state), [set]);
|
|
18
|
-
|
|
19
|
-
return label == null ? (
|
|
20
|
-
<Checkbox
|
|
21
|
-
checked={get}
|
|
22
|
-
onChange={onChange}
|
|
23
|
-
{...props}
|
|
24
|
-
/>
|
|
25
|
-
) : (
|
|
26
|
-
<FormControlLabel
|
|
27
|
-
checked={get}
|
|
28
|
-
label={label}
|
|
29
|
-
onChange={onChange}
|
|
30
|
-
control={<Checkbox {...props}/>}
|
|
31
|
-
/>
|
|
32
|
-
);
|
|
33
|
-
};
|
|
1
|
+
import {Checkbox, CheckboxProps, FormControlLabel} from "@mui/material";
|
|
2
|
+
import React, {useCallback, useContext} from "react";
|
|
3
|
+
import {FastStartContext} from "../../../styles/FastStartProvider.tsx";
|
|
4
|
+
import {MfsSingleCheckboxProps} from "../../../types";
|
|
5
|
+
|
|
6
|
+
export type SingleCheckboxProps = CheckboxProps & MfsSingleCheckboxProps;
|
|
7
|
+
|
|
8
|
+
export const SingleCheckbox = (customProps: SingleCheckboxProps) => {
|
|
9
|
+
const defaultProps = useContext(FastStartContext)?.Single?.MfsCheckbox;
|
|
10
|
+
const {
|
|
11
|
+
get, set, label,
|
|
12
|
+
...props
|
|
13
|
+
} = defaultProps == null
|
|
14
|
+
? customProps
|
|
15
|
+
: Object.assign({...defaultProps}, customProps);
|
|
16
|
+
|
|
17
|
+
const onChange = useCallback(() => set((state) => !state), [set]);
|
|
18
|
+
|
|
19
|
+
return label == null ? (
|
|
20
|
+
<Checkbox
|
|
21
|
+
checked={get}
|
|
22
|
+
onChange={onChange}
|
|
23
|
+
{...props}
|
|
24
|
+
/>
|
|
25
|
+
) : (
|
|
26
|
+
<FormControlLabel
|
|
27
|
+
checked={get}
|
|
28
|
+
label={label}
|
|
29
|
+
onChange={onChange}
|
|
30
|
+
control={<Checkbox {...props}/>}
|
|
31
|
+
/>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
import {FormControl, FormHelperText, InputLabel, MenuItem, Select, SelectProps} from "@mui/material";
|
|
2
|
-
import React, {useId} from "react";
|
|
3
|
-
import {MfsSingleError} from "../../../types/props.internal.ts";
|
|
4
|
-
|
|
5
|
-
const BaseSingleSelect = <Value,>(props: {
|
|
6
|
-
emptyItem?: React.ReactNode,
|
|
7
|
-
label?: React.ReactNode,
|
|
8
|
-
err: MfsSingleError,
|
|
9
|
-
items: React.ReactNode,
|
|
10
|
-
get: Value,
|
|
11
|
-
onChange: SelectProps['onChange'],
|
|
12
|
-
selectProps: SelectProps
|
|
13
|
-
}) => {
|
|
14
|
-
const {emptyItem, label, selectProps} = props;
|
|
15
|
-
const labelId = useId();
|
|
16
|
-
|
|
17
|
-
const isError: boolean = !!props.err;
|
|
18
|
-
return (
|
|
19
|
-
<FormControl
|
|
20
|
-
error={isError}
|
|
21
|
-
fullWidth={selectProps.fullWidth}
|
|
22
|
-
variant={selectProps.variant}
|
|
23
|
-
size={selectProps.size}
|
|
24
|
-
sx={selectProps.sx}
|
|
25
|
-
disabled={selectProps.disabled}
|
|
26
|
-
required={selectProps.required}
|
|
27
|
-
margin={selectProps.margin}
|
|
28
|
-
>
|
|
29
|
-
{label && <InputLabel id={labelId}>{label}</InputLabel>}
|
|
30
|
-
<Select
|
|
31
|
-
labelId={labelId}
|
|
32
|
-
error={isError}
|
|
33
|
-
label={label}
|
|
34
|
-
value={props.get ?? ''}
|
|
35
|
-
onChange={props.onChange}
|
|
36
|
-
{...selectProps}
|
|
37
|
-
>
|
|
38
|
-
{emptyItem && <MenuItem key='' value=''>{emptyItem}</MenuItem>}
|
|
39
|
-
{props.items}
|
|
40
|
-
</Select>
|
|
41
|
-
{isError && <FormHelperText>{props.err}</FormHelperText>}
|
|
42
|
-
</FormControl>
|
|
43
|
-
)
|
|
44
|
-
}
|
|
45
|
-
|
|
1
|
+
import {FormControl, FormHelperText, InputLabel, MenuItem, Select, SelectProps} from "@mui/material";
|
|
2
|
+
import React, {useId} from "react";
|
|
3
|
+
import {MfsSingleError} from "../../../types/props.internal.ts";
|
|
4
|
+
|
|
5
|
+
const BaseSingleSelect = <Value,>(props: {
|
|
6
|
+
emptyItem?: React.ReactNode,
|
|
7
|
+
label?: React.ReactNode,
|
|
8
|
+
err: MfsSingleError,
|
|
9
|
+
items: React.ReactNode,
|
|
10
|
+
get: Value,
|
|
11
|
+
onChange: SelectProps['onChange'],
|
|
12
|
+
selectProps: SelectProps
|
|
13
|
+
}) => {
|
|
14
|
+
const {emptyItem, label, selectProps} = props;
|
|
15
|
+
const labelId = useId();
|
|
16
|
+
|
|
17
|
+
const isError: boolean = !!props.err;
|
|
18
|
+
return (
|
|
19
|
+
<FormControl
|
|
20
|
+
error={isError}
|
|
21
|
+
fullWidth={selectProps.fullWidth}
|
|
22
|
+
variant={selectProps.variant}
|
|
23
|
+
size={selectProps.size}
|
|
24
|
+
sx={selectProps.sx}
|
|
25
|
+
disabled={selectProps.disabled}
|
|
26
|
+
required={selectProps.required}
|
|
27
|
+
margin={selectProps.margin}
|
|
28
|
+
>
|
|
29
|
+
{label && <InputLabel id={labelId}>{label}</InputLabel>}
|
|
30
|
+
<Select
|
|
31
|
+
labelId={labelId}
|
|
32
|
+
error={isError}
|
|
33
|
+
label={label}
|
|
34
|
+
value={props.get ?? ''}
|
|
35
|
+
onChange={props.onChange}
|
|
36
|
+
{...selectProps}
|
|
37
|
+
>
|
|
38
|
+
{emptyItem && <MenuItem key='' value=''>{emptyItem}</MenuItem>}
|
|
39
|
+
{props.items}
|
|
40
|
+
</Select>
|
|
41
|
+
{isError && <FormHelperText>{props.err}</FormHelperText>}
|
|
42
|
+
</FormControl>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
46
|
export default BaseSingleSelect;
|