mui-fast-start 0.3.2 → 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/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,82 +1,83 @@
|
|
|
1
|
-
import {
|
|
2
|
-
MfsObjectCheckboxProps,
|
|
3
|
-
MfsObjectCheckIconProps,
|
|
4
|
-
MfsObjectNumberProps, MfsObjectSelectOneProps, MfsObjectSelectRecordProps,
|
|
5
|
-
MfsObjectTextProps,
|
|
6
|
-
MfsSingleCheckboxProps,
|
|
7
|
-
MfsSingleCheckIconProps,
|
|
8
|
-
MfsSingleNumberProps,
|
|
9
|
-
MfsSingleSelectOneProps, MfsSingleSelectRecordProps,
|
|
10
|
-
MfsSingleTextProps
|
|
11
|
-
} from "../types";
|
|
12
|
-
import type {ThemeProviderProps} from "@mui/material";
|
|
13
|
-
import {fastDeepMerge} from "../utils";
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
1
|
+
import {
|
|
2
|
+
MfsObjectCheckboxProps,
|
|
3
|
+
MfsObjectCheckIconProps,
|
|
4
|
+
MfsObjectNumberProps, MfsObjectSelectOneProps, MfsObjectSelectRecordProps,
|
|
5
|
+
MfsObjectTextProps,
|
|
6
|
+
MfsSingleCheckboxProps,
|
|
7
|
+
MfsSingleCheckIconProps,
|
|
8
|
+
MfsSingleNumberProps,
|
|
9
|
+
MfsSingleSelectOneProps, MfsSingleSelectRecordProps,
|
|
10
|
+
MfsSingleTextProps
|
|
11
|
+
} from "../types";
|
|
12
|
+
import type {ThemeProviderProps} from "@mui/material";
|
|
13
|
+
import {fastDeepMerge} from "../utils";
|
|
14
|
+
import React from "react";
|
|
15
|
+
|
|
16
|
+
interface FastStartProps {
|
|
17
|
+
Single: Partial<{
|
|
18
|
+
MfsFloat: Partial<MfsSingleNumberProps>,
|
|
19
|
+
MfsInteger: Partial<MfsSingleNumberProps>,
|
|
20
|
+
MfsText: Partial<MfsSingleTextProps>,
|
|
21
|
+
MfsCheckbox: Partial<MfsSingleCheckboxProps>,
|
|
22
|
+
MfsCheckIcon: Partial<MfsSingleCheckIconProps>,
|
|
23
|
+
MfsSelectOne: Partial<MfsSingleSelectOneProps<unknown>>,
|
|
24
|
+
MfsSelectRecord: Partial<MfsSingleSelectRecordProps<Record<string, unknown>>>
|
|
25
|
+
}>,
|
|
26
|
+
Object: Partial<{
|
|
27
|
+
MfsFloat: Partial<MfsObjectNumberProps<object>>,
|
|
28
|
+
MfsInteger: Partial<MfsObjectNumberProps<object>>,
|
|
29
|
+
MfsText: Partial<MfsObjectTextProps<object>>,
|
|
30
|
+
MfsCheckbox: Partial<MfsObjectCheckboxProps<object>>,
|
|
31
|
+
MfsCheckIcon: Partial<MfsObjectCheckIconProps<object>>,
|
|
32
|
+
MfsSelectOne: Partial<MfsObjectSelectOneProps<object, unknown>>,
|
|
33
|
+
MfsSelectRecord: Partial<MfsObjectSelectRecordProps<object, Record<string, React.ReactNode>>>
|
|
34
|
+
}>
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const mfsDefaultProps: Partial<FastStartProps> = {
|
|
38
|
+
Single: {
|
|
39
|
+
MfsFloat: {
|
|
40
|
+
inputMode: 'decimal',
|
|
41
|
+
type: 'text',
|
|
42
|
+
step: 0.01,
|
|
43
|
+
def: 0
|
|
44
|
+
},
|
|
45
|
+
MfsInteger: {
|
|
46
|
+
inputMode: 'numeric',
|
|
47
|
+
type: 'text',
|
|
48
|
+
step: 1,
|
|
49
|
+
def: 0
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
Object: {
|
|
53
|
+
MfsFloat: {
|
|
54
|
+
inputMode: 'decimal',
|
|
55
|
+
type: 'text',
|
|
56
|
+
step: 0.01,
|
|
57
|
+
def: 0
|
|
58
|
+
},
|
|
59
|
+
MfsInteger: {
|
|
60
|
+
inputMode: 'numeric',
|
|
61
|
+
type: 'text',
|
|
62
|
+
step: 1,
|
|
63
|
+
def: 0
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const createMfsProps = (customProps: Partial<FastStartProps>) => {
|
|
69
|
+
return fastDeepMerge({...mfsDefaultProps}, customProps);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
interface FastStartProviderProps<Theme> extends ThemeProviderProps<Theme> {
|
|
73
|
+
defaultProps: Partial<FastStartProps>;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export {
|
|
77
|
+
createMfsProps
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export type {
|
|
81
|
+
FastStartProps,
|
|
82
|
+
FastStartProviderProps
|
|
82
83
|
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import {createContext} from "react";
|
|
2
|
-
import {ThemeProvider} from "@mui/material";
|
|
3
|
-
import type {DefaultTheme} from "@mui/system";
|
|
4
|
-
import {createMfsProps, FastStartProps, FastStartProviderProps} from "./FastStartProps.ts";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const FastStartContext = createContext<Partial<FastStartProps>>(createMfsProps({}));
|
|
8
|
-
|
|
9
|
-
const FastStartProvider = <T = DefaultTheme>(props: FastStartProviderProps<T>) => {
|
|
10
|
-
const {
|
|
11
|
-
defaultProps,
|
|
12
|
-
...themeProps
|
|
13
|
-
} = props;
|
|
14
|
-
|
|
15
|
-
return (
|
|
16
|
-
<FastStartContext value={defaultProps}>
|
|
17
|
-
<ThemeProvider<T> {...themeProps}/>
|
|
18
|
-
</FastStartContext>
|
|
19
|
-
)
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export {
|
|
23
|
-
FastStartContext,
|
|
24
|
-
FastStartProvider
|
|
25
|
-
}
|
|
1
|
+
import {createContext} from "react";
|
|
2
|
+
import {ThemeProvider} from "@mui/material";
|
|
3
|
+
import type {DefaultTheme} from "@mui/system";
|
|
4
|
+
import {createMfsProps, FastStartProps, FastStartProviderProps} from "./FastStartProps.ts";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
const FastStartContext = createContext<Partial<FastStartProps>>(createMfsProps({}));
|
|
8
|
+
|
|
9
|
+
const FastStartProvider = <T = DefaultTheme>(props: FastStartProviderProps<T>) => {
|
|
10
|
+
const {
|
|
11
|
+
defaultProps,
|
|
12
|
+
...themeProps
|
|
13
|
+
} = props;
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<FastStartContext value={defaultProps}>
|
|
17
|
+
<ThemeProvider<T> {...themeProps}/>
|
|
18
|
+
</FastStartContext>
|
|
19
|
+
)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export {
|
|
23
|
+
FastStartContext,
|
|
24
|
+
FastStartProvider
|
|
25
|
+
}
|
package/src/types/index.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './props';
|
|
2
|
-
export * from './types';
|
|
3
|
-
export * from './provider';
|
|
1
|
+
export * from './props';
|
|
2
|
+
export * from './types';
|
|
3
|
+
export * from './provider';
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
// internal types
|
|
2
|
-
// Do not export index.ts
|
|
3
|
-
|
|
4
|
-
import React from "react";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export type KeysWithValue<Type extends object, Target = unknown> = {
|
|
8
|
-
[K in keyof Type]: Type[K] extends Target ? K : never
|
|
9
|
-
}[keyof Type];
|
|
10
|
-
|
|
11
|
-
export type MfsObjectKeys<Type extends object, Target = unknown> =
|
|
12
|
-
keyof Type | KeysWithValue<Type, Target>;
|
|
13
|
-
|
|
14
|
-
export type MfsSelectEmpty<I> = {
|
|
15
|
-
emptyItem?: React.ReactNode;
|
|
16
|
-
emptyValue?: '' | null | undefined | I;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export type MfsSingleError = React.ReactNode;
|
|
20
|
-
export type MfsObjectError<Type extends object, Target = unknown> =
|
|
21
|
-
Partial<Record<MfsObjectKeys<Type, Target>, React.ReactNode>>;
|
|
1
|
+
// internal types
|
|
2
|
+
// Do not export index.ts
|
|
3
|
+
|
|
4
|
+
import React from "react";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export type KeysWithValue<Type extends object, Target = unknown> = {
|
|
8
|
+
[K in keyof Type]: Type[K] extends Target ? K : never
|
|
9
|
+
}[keyof Type];
|
|
10
|
+
|
|
11
|
+
export type MfsObjectKeys<Type extends object, Target = unknown> =
|
|
12
|
+
keyof Type | KeysWithValue<Type, Target>;
|
|
13
|
+
|
|
14
|
+
export type MfsSelectEmpty<I> = {
|
|
15
|
+
emptyItem?: React.ReactNode;
|
|
16
|
+
emptyValue?: '' | null | undefined | I;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type MfsSingleError = React.ReactNode;
|
|
20
|
+
export type MfsObjectError<Type extends object, Target = unknown> =
|
|
21
|
+
Partial<Record<MfsObjectKeys<Type, Target>, React.ReactNode>>;
|
package/src/types/props.ts
CHANGED
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import {Dispatch, HTMLAttributes, SetStateAction} from "react";
|
|
3
|
-
import {MfsObjectKeys, MfsSelectEmpty} from "./props.internal.ts";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
type KeysWithValue<Type extends object, Target> = {
|
|
7
|
-
[K in keyof Type]: Type[K] extends Target ? K : never
|
|
8
|
-
}[keyof Type];
|
|
9
|
-
|
|
10
|
-
export interface MfsPropertyProps<Type> {
|
|
11
|
-
get: Type;
|
|
12
|
-
set: Dispatch<SetStateAction<Type>>;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface MfsObjectProps<Type extends object, Target> {
|
|
16
|
-
name: MfsObjectKeys<Type, Target>;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// props : property + label
|
|
20
|
-
export interface MfsLabelProps<Type> extends MfsPropertyProps<Type> {
|
|
21
|
-
label?: React.ReactNode;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// props : property + label + error
|
|
25
|
-
export interface MfsErrorProps<Type, Error> extends MfsLabelProps<Type> {
|
|
26
|
-
err?: Error;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// ==================================================
|
|
30
|
-
// Component props
|
|
31
|
-
// ==================================================
|
|
32
|
-
export interface MfsTextProps {
|
|
33
|
-
minLength?: number;
|
|
34
|
-
maxLength?: number;
|
|
35
|
-
startAdornment?: React.ReactNode;
|
|
36
|
-
endAdornment?: React.ReactNode;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export interface MfsNumberProps extends MfsTextProps {
|
|
40
|
-
inputMode?: HTMLAttributes<unknown>["inputMode"];
|
|
41
|
-
type?: React.InputHTMLAttributes<unknown>['type'];
|
|
42
|
-
def?: number | null | undefined;
|
|
43
|
-
min?: number;
|
|
44
|
-
max?: number;
|
|
45
|
-
step?: number;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export interface MfsCheckIconProps {
|
|
49
|
-
on: React.ReactNode;
|
|
50
|
-
off: React.ReactNode;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export type MfsSelectOneProps<I> = {
|
|
54
|
-
items: I[];
|
|
55
|
-
renderMenuItem?: (item: I, i: number) => React.ReactNode;
|
|
56
|
-
} & MfsSelectEmpty<I> & ([NonNullable<I>] extends [string | number]
|
|
57
|
-
? { getKey?: (item: I) => string | number }
|
|
58
|
-
: { getKey: (item: I) => string | number });
|
|
59
|
-
|
|
60
|
-
export type MfsSelectRecordProps<Item extends Record<PropertyKey, unknown>> = {
|
|
61
|
-
items: Item;
|
|
62
|
-
renderMenuItem?: (key: keyof Item, value: Item[keyof Item], i: number) => React.ReactNode;
|
|
63
|
-
} & MfsSelectEmpty<Item>;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
interface BaseProps<Type, Error> {
|
|
67
|
-
get: Type;
|
|
68
|
-
set: Dispatch<SetStateAction<Type>>;
|
|
69
|
-
label?: React.ReactNode;
|
|
70
|
-
err?: Error;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
interface BaseObjectProps<Type extends object, Target>
|
|
74
|
-
extends BaseProps<Type, Partial<Type> | object> {
|
|
75
|
-
name: KeysWithValue<Type, Target> | string;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export type {
|
|
79
|
-
KeysWithValue,
|
|
80
|
-
BaseObjectProps,
|
|
81
|
-
}
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import {Dispatch, HTMLAttributes, SetStateAction} from "react";
|
|
3
|
+
import {MfsObjectKeys, MfsSelectEmpty} from "./props.internal.ts";
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
type KeysWithValue<Type extends object, Target> = {
|
|
7
|
+
[K in keyof Type]: Type[K] extends Target ? K : never
|
|
8
|
+
}[keyof Type];
|
|
9
|
+
|
|
10
|
+
export interface MfsPropertyProps<Type> {
|
|
11
|
+
get: Type;
|
|
12
|
+
set: Dispatch<SetStateAction<Type>>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface MfsObjectProps<Type extends object, Target> {
|
|
16
|
+
name: MfsObjectKeys<Type, Target>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// props : property + label
|
|
20
|
+
export interface MfsLabelProps<Type> extends MfsPropertyProps<Type> {
|
|
21
|
+
label?: React.ReactNode;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// props : property + label + error
|
|
25
|
+
export interface MfsErrorProps<Type, Error> extends MfsLabelProps<Type> {
|
|
26
|
+
err?: Error;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// ==================================================
|
|
30
|
+
// Component props
|
|
31
|
+
// ==================================================
|
|
32
|
+
export interface MfsTextProps {
|
|
33
|
+
minLength?: number;
|
|
34
|
+
maxLength?: number;
|
|
35
|
+
startAdornment?: React.ReactNode;
|
|
36
|
+
endAdornment?: React.ReactNode;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface MfsNumberProps extends MfsTextProps {
|
|
40
|
+
inputMode?: HTMLAttributes<unknown>["inputMode"];
|
|
41
|
+
type?: React.InputHTMLAttributes<unknown>['type'];
|
|
42
|
+
def?: number | null | undefined;
|
|
43
|
+
min?: number;
|
|
44
|
+
max?: number;
|
|
45
|
+
step?: number;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface MfsCheckIconProps {
|
|
49
|
+
on: React.ReactNode;
|
|
50
|
+
off: React.ReactNode;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export type MfsSelectOneProps<I> = {
|
|
54
|
+
items: I[];
|
|
55
|
+
renderMenuItem?: (item: I, i: number) => React.ReactNode;
|
|
56
|
+
} & MfsSelectEmpty<I> & ([NonNullable<I>] extends [string | number]
|
|
57
|
+
? { getKey?: (item: I) => string | number }
|
|
58
|
+
: { getKey: (item: I) => string | number });
|
|
59
|
+
|
|
60
|
+
export type MfsSelectRecordProps<Item extends Record<PropertyKey, React.ReactNode | unknown>> = {
|
|
61
|
+
items: Item;
|
|
62
|
+
renderMenuItem?: (key: keyof Item, value: Item[keyof Item], i: number) => React.ReactNode;
|
|
63
|
+
} & MfsSelectEmpty<Item>;
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
interface BaseProps<Type, Error> {
|
|
67
|
+
get: Type;
|
|
68
|
+
set: Dispatch<SetStateAction<Type>>;
|
|
69
|
+
label?: React.ReactNode;
|
|
70
|
+
err?: Error;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
interface BaseObjectProps<Type extends object, Target>
|
|
74
|
+
extends BaseProps<Type, Partial<Type> | object> {
|
|
75
|
+
name: KeysWithValue<Type, Target> | string;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export type {
|
|
79
|
+
KeysWithValue,
|
|
80
|
+
BaseObjectProps,
|
|
81
|
+
}
|
package/src/types/provider.ts
CHANGED
|
@@ -1,72 +1,73 @@
|
|
|
1
|
-
import {
|
|
2
|
-
MfsCheckIconProps,
|
|
3
|
-
MfsErrorProps,
|
|
4
|
-
MfsLabelProps,
|
|
5
|
-
MfsNumberProps,
|
|
6
|
-
MfsObjectProps,
|
|
7
|
-
MfsPropertyProps,
|
|
8
|
-
MfsSelectOneProps,
|
|
9
|
-
MfsSelectRecordProps,
|
|
10
|
-
MfsTextProps
|
|
11
|
-
} from './props';
|
|
12
|
-
import {MfsObjectError, MfsSingleError} from "./props.internal.ts";
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
&
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
1
|
+
import {
|
|
2
|
+
MfsCheckIconProps,
|
|
3
|
+
MfsErrorProps,
|
|
4
|
+
MfsLabelProps,
|
|
5
|
+
MfsNumberProps,
|
|
6
|
+
MfsObjectProps,
|
|
7
|
+
MfsPropertyProps,
|
|
8
|
+
MfsSelectOneProps,
|
|
9
|
+
MfsSelectRecordProps,
|
|
10
|
+
MfsTextProps
|
|
11
|
+
} from './props';
|
|
12
|
+
import {MfsObjectError, MfsSingleError} from "./props.internal.ts";
|
|
13
|
+
import React from "react";
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
// Single
|
|
17
|
+
export interface MfsSingleNumberProps extends
|
|
18
|
+
MfsNumberProps,
|
|
19
|
+
MfsErrorProps<number, MfsSingleError> {}
|
|
20
|
+
|
|
21
|
+
export interface MfsSingleTextProps extends
|
|
22
|
+
MfsTextProps,
|
|
23
|
+
MfsErrorProps<string, MfsSingleError> {}
|
|
24
|
+
|
|
25
|
+
export type MfsSingleCheckboxProps =
|
|
26
|
+
MfsLabelProps<boolean>;
|
|
27
|
+
|
|
28
|
+
export interface MfsSingleCheckIconProps extends
|
|
29
|
+
MfsCheckIconProps,
|
|
30
|
+
MfsPropertyProps<boolean> {}
|
|
31
|
+
|
|
32
|
+
export type MfsSingleSelectOneProps<Item> =
|
|
33
|
+
MfsSelectOneProps<Item>
|
|
34
|
+
& MfsErrorProps<Item, MfsSingleError>;
|
|
35
|
+
|
|
36
|
+
export type MfsSingleSelectRecordProps<
|
|
37
|
+
Item extends Record<PropertyKey, unknown>,
|
|
38
|
+
Value = keyof Item | undefined | null
|
|
39
|
+
> = MfsSelectRecordProps<Item>
|
|
40
|
+
& MfsErrorProps<Value, MfsSingleError>;
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
// Object
|
|
44
|
+
export interface MfsObjectNumberProps<T extends object> extends
|
|
45
|
+
MfsObjectProps<T, number>,
|
|
46
|
+
MfsNumberProps,
|
|
47
|
+
MfsErrorProps<T, MfsObjectError<T, number>> {}
|
|
48
|
+
|
|
49
|
+
export interface MfsObjectTextProps<T extends object> extends
|
|
50
|
+
MfsObjectProps<T, string>,
|
|
51
|
+
MfsTextProps,
|
|
52
|
+
MfsErrorProps<T, MfsObjectError<T, string>> {}
|
|
53
|
+
|
|
54
|
+
export interface MfsObjectCheckboxProps<T extends object> extends
|
|
55
|
+
MfsObjectProps<T, boolean>,
|
|
56
|
+
MfsLabelProps<T> {}
|
|
57
|
+
|
|
58
|
+
export interface MfsObjectCheckIconProps<T extends object> extends
|
|
59
|
+
MfsObjectProps<T, boolean>,
|
|
60
|
+
MfsPropertyProps<T>,
|
|
61
|
+
MfsCheckIconProps {}
|
|
62
|
+
|
|
63
|
+
export type MfsObjectSelectOneProps<T extends object, Item> =
|
|
64
|
+
MfsObjectProps<T, Item>
|
|
65
|
+
& MfsSelectOneProps<Item>
|
|
66
|
+
& MfsErrorProps<T, MfsObjectError<T, Item>>;
|
|
67
|
+
|
|
68
|
+
export type MfsObjectSelectRecordProps<
|
|
69
|
+
T extends object,
|
|
70
|
+
Item extends Record<PropertyKey, React.ReactNode>
|
|
71
|
+
> = MfsObjectProps<T, Item>
|
|
72
|
+
& MfsSelectRecordProps<Item>
|
|
72
73
|
& MfsErrorProps<T, MfsObjectError<T, Item>>;
|
package/src/types/types.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
type DeepPartial<T> = {
|
|
2
|
-
[K in keyof T]?: T[K] extends object
|
|
3
|
-
? DeepPartial<T[K]>
|
|
4
|
-
: T[K];
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
export type {
|
|
8
|
-
DeepPartial
|
|
9
|
-
}
|
|
1
|
+
type DeepPartial<T> = {
|
|
2
|
+
[K in keyof T]?: T[K] extends object
|
|
3
|
+
? DeepPartial<T[K]>
|
|
4
|
+
: T[K];
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export type {
|
|
8
|
+
DeepPartial
|
|
9
|
+
}
|
package/src/utils/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './number/calculate';
|
|
2
|
-
export * from './object/merge';
|
|
1
|
+
export * from './number/calculate';
|
|
2
|
+
export * from './object/merge';
|