mui-fast-start 0.2.0 → 0.3.1
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 +76 -29
- package/README_KR.md +176 -127
- package/dist/components/Object/Checkbox/ObjCheckIcon.d.ts +4 -0
- package/dist/components/Object/Checkbox/ObjCheckIcon.d.ts.map +1 -0
- package/dist/components/Object/Checkbox/ObjCheckbox.d.ts +4 -0
- package/dist/components/Object/Checkbox/ObjCheckbox.d.ts.map +1 -0
- package/dist/components/Object/Select/ObjSelectOne.d.ts +4 -0
- package/dist/components/Object/Select/ObjSelectOne.d.ts.map +1 -0
- package/dist/components/Object/Select/ObjSelectRecord.d.ts +4 -0
- package/dist/components/Object/Select/ObjSelectRecord.d.ts.map +1 -0
- package/dist/components/Object/Textfield/ObjNumber.d.ts +7 -0
- package/dist/components/Object/Textfield/ObjNumber.d.ts.map +1 -0
- package/dist/components/Object/Textfield/ObjText.d.ts +4 -0
- package/dist/components/Object/Textfield/ObjText.d.ts.map +1 -0
- package/dist/components/Single/Checkbox/SingleCheckIcon.d.ts +3 -1
- package/dist/components/Single/Checkbox/SingleCheckIcon.d.ts.map +1 -1
- package/dist/components/Single/Checkbox/SingleCheckbox.d.ts +3 -1
- package/dist/components/Single/Checkbox/SingleCheckbox.d.ts.map +1 -1
- package/dist/components/Single/Select/BaseSingleSelect.d.ts +14 -0
- package/dist/components/Single/Select/BaseSingleSelect.d.ts.map +1 -0
- package/dist/components/Single/Select/SingleSelectOne.d.ts +5 -0
- package/dist/components/Single/Select/SingleSelectOne.d.ts.map +1 -0
- package/dist/components/Single/Select/SingleSelectRecord.d.ts +4 -0
- package/dist/components/Single/Select/SingleSelectRecord.d.ts.map +1 -0
- package/dist/components/Single/TextField/SingleNumber.d.ts +6 -0
- package/dist/components/Single/TextField/SingleNumber.d.ts.map +1 -0
- package/dist/components/Single/TextField/SingleText.d.ts +3 -1
- package/dist/components/Single/TextField/SingleText.d.ts.map +1 -1
- package/dist/components/index.d.ts +12 -10
- package/dist/components/index.d.ts.map +1 -1
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/splits/useSplitNumberProps.d.ts +7 -0
- package/dist/hooks/splits/useSplitNumberProps.d.ts.map +1 -0
- package/dist/hooks/splits/useSplitTextProps.d.ts +6 -0
- package/dist/hooks/splits/useSplitTextProps.d.ts.map +1 -0
- package/dist/hooks/state/useObjToSingle.d.ts +2 -2
- package/dist/hooks/state/useObjToSingle.d.ts.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +310 -235
- package/dist/styles/FastStartProps.d.ts +29 -0
- package/dist/styles/FastStartProps.d.ts.map +1 -0
- package/dist/styles/FastStartProvider.d.ts +2 -17
- package/dist/styles/FastStartProvider.d.ts.map +1 -1
- package/dist/types/props.d.ts +38 -23
- package/dist/types/props.d.ts.map +1 -1
- package/dist/types/props.internal.d.ts +12 -0
- package/dist/types/props.internal.d.ts.map +1 -0
- package/dist/types/provider.d.ts +20 -30
- package/dist/types/provider.d.ts.map +1 -1
- package/dist/utils/object/error.d.ts +3 -2
- package/dist/utils/object/error.d.ts.map +1 -1
- package/examples/basic/src/main.tsx +26 -33
- package/examples/basic/src/pages/ObjPage.tsx +92 -9
- package/examples/basic/src/pages/SinglePage.tsx +69 -2
- package/examples/basic/tsconfig.app.json +5 -0
- package/examples/basic/tsconfig.node.json +5 -0
- package/examples/basic/vite.config.ts +1 -1
- package/package.json +1 -1
- package/src/components/Object/Checkbox/ObjCheckIcon.tsx +29 -0
- package/src/components/Object/Checkbox/ObjCheckbox.tsx +31 -0
- package/src/components/Object/Select/ObjSelectOne.tsx +34 -0
- package/src/components/Object/Select/ObjSelectRecord.tsx +34 -0
- package/src/components/Object/Textfield/ObjNumber.tsx +51 -0
- package/src/components/Object/Textfield/ObjText.tsx +29 -0
- package/src/components/Single/Checkbox/SingleCheckIcon.tsx +7 -5
- package/src/components/Single/Checkbox/SingleCheckbox.tsx +7 -5
- package/src/components/Single/Select/BaseSingleSelect.tsx +46 -0
- package/src/components/Single/Select/SingleSelectOne.tsx +56 -0
- package/src/components/Single/Select/SingleSelectRecord.tsx +52 -0
- package/src/components/Single/TextField/SingleNumber.tsx +19 -0
- package/src/components/Single/TextField/SingleText.tsx +6 -5
- package/src/components/index.ts +14 -12
- package/src/hooks/index.ts +2 -2
- package/src/hooks/splits/{useSplitSingleNumberProps.ts → useSplitNumberProps.ts} +58 -56
- package/src/hooks/splits/useSplitTextProps.ts +36 -0
- package/src/hooks/state/useObjToSingle.ts +3 -2
- package/src/index.ts +0 -1
- package/src/styles/FastStartProps.ts +82 -0
- package/src/styles/FastStartProvider.tsx +2 -3
- package/src/types/props.internal.ts +21 -0
- package/src/types/props.ts +47 -33
- package/src/types/provider.ts +70 -45
- package/src/utils/number/calculate.ts +2 -2
- package/src/utils/object/error.ts +5 -4
- package/dist/components/Obj/Checkbox/ObjCheckIcon.d.ts +0 -3
- package/dist/components/Obj/Checkbox/ObjCheckIcon.d.ts.map +0 -1
- package/dist/components/Obj/Checkbox/ObjCheckbox.d.ts +0 -3
- package/dist/components/Obj/Checkbox/ObjCheckbox.d.ts.map +0 -1
- package/dist/components/Obj/Textfield/ObjFloat.d.ts +0 -3
- package/dist/components/Obj/Textfield/ObjFloat.d.ts.map +0 -1
- package/dist/components/Obj/Textfield/ObjInteger.d.ts +0 -3
- package/dist/components/Obj/Textfield/ObjInteger.d.ts.map +0 -1
- package/dist/components/Obj/Textfield/ObjText.d.ts +0 -3
- package/dist/components/Obj/Textfield/ObjText.d.ts.map +0 -1
- package/dist/components/Single/TextField/SingleFloat.d.ts +0 -3
- package/dist/components/Single/TextField/SingleFloat.d.ts.map +0 -1
- package/dist/components/Single/TextField/SingleInteger.d.ts +0 -3
- package/dist/components/Single/TextField/SingleInteger.d.ts.map +0 -1
- package/dist/hooks/splits/useSplitSingleNumberProps.d.ts +0 -6
- package/dist/hooks/splits/useSplitSingleNumberProps.d.ts.map +0 -1
- package/dist/hooks/splits/useSplitSingleTextProps.d.ts +0 -5
- package/dist/hooks/splits/useSplitSingleTextProps.d.ts.map +0 -1
- package/dist/styles/createDefaultProps.d.ts +0 -3
- package/dist/styles/createDefaultProps.d.ts.map +0 -1
- package/mui-fast-start-0.1.5.tgz +0 -0
- package/src/components/Obj/Checkbox/ObjCheckIcon.tsx +0 -19
- package/src/components/Obj/Checkbox/ObjCheckbox.tsx +0 -19
- package/src/components/Obj/Textfield/ObjFloat.tsx +0 -22
- package/src/components/Obj/Textfield/ObjInteger.tsx +0 -22
- package/src/components/Obj/Textfield/ObjText.tsx +0 -22
- package/src/components/Single/TextField/SingleFloat.tsx +0 -12
- package/src/components/Single/TextField/SingleInteger.tsx +0 -12
- package/src/hooks/splits/useSplitSingleTextProps.ts +0 -36
- package/src/styles/createDefaultProps.ts +0 -45
- package/src.zip +0 -0
package/dist/types/props.d.ts
CHANGED
|
@@ -1,45 +1,60 @@
|
|
|
1
|
-
import type { SlotProps, TextFieldOwnerState } from "@mui/material";
|
|
2
|
-
import type { Dispatch, SetStateAction } from "react";
|
|
3
1
|
import * as React from "react";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
type HtmlInputType = SlotProps<React.ElementType<InputBaseProps['inputProps']>, {}, TextFieldOwnerState>;
|
|
7
|
-
type InputLabelType = SlotProps<React.ElementType<InputLabelProps>, {}, TextFieldOwnerState>;
|
|
2
|
+
import { Dispatch, HTMLAttributes, SetStateAction } from "react";
|
|
3
|
+
import { MfsObjectKeys, MfsSelectEmpty } from "./props.internal.ts";
|
|
8
4
|
type KeysWithValue<Type extends object, Target> = {
|
|
9
5
|
[K in keyof Type]: Type[K] extends Target ? K : never;
|
|
10
6
|
}[keyof Type];
|
|
11
|
-
interface
|
|
7
|
+
export interface MfsPropertyProps<Type> {
|
|
12
8
|
get: Type;
|
|
13
9
|
set: Dispatch<SetStateAction<Type>>;
|
|
10
|
+
}
|
|
11
|
+
export interface MfsObjectProps<Type extends object, Target> {
|
|
12
|
+
name: MfsObjectKeys<Type, Target>;
|
|
13
|
+
}
|
|
14
|
+
export interface MfsLabelProps<Type> extends MfsPropertyProps<Type> {
|
|
14
15
|
label?: React.ReactNode;
|
|
15
|
-
errorData?: Error;
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
name: KeysWithValue<Type, Target> | string;
|
|
17
|
+
export interface MfsErrorProps<Type, Error> extends MfsLabelProps<Type> {
|
|
18
|
+
err?: Error;
|
|
20
19
|
}
|
|
21
|
-
interface
|
|
20
|
+
export interface MfsTextProps {
|
|
22
21
|
minLength?: number;
|
|
23
22
|
maxLength?: number;
|
|
24
23
|
startAdornment?: React.ReactNode;
|
|
25
24
|
endAdornment?: React.ReactNode;
|
|
26
25
|
}
|
|
27
|
-
interface
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
interface BaseNumberProps extends BaseTextProps {
|
|
32
|
-
disappear?: boolean;
|
|
33
|
-
def?: number;
|
|
26
|
+
export interface MfsNumberProps extends MfsTextProps {
|
|
27
|
+
inputMode?: HTMLAttributes<unknown>["inputMode"];
|
|
28
|
+
type?: React.InputHTMLAttributes<unknown>['type'];
|
|
29
|
+
def?: number | null | undefined;
|
|
34
30
|
min?: number;
|
|
35
31
|
max?: number;
|
|
36
32
|
step?: number;
|
|
37
33
|
}
|
|
38
|
-
interface
|
|
39
|
-
|
|
34
|
+
export interface MfsCheckIconProps {
|
|
35
|
+
on: React.ReactNode;
|
|
36
|
+
off: React.ReactNode;
|
|
40
37
|
}
|
|
41
|
-
|
|
38
|
+
export type MfsSelectOneProps<I> = {
|
|
42
39
|
items: I[];
|
|
40
|
+
renderMenuItem?: (item: I, i: number) => React.ReactNode;
|
|
41
|
+
} & MfsSelectEmpty<I> & ([NonNullable<I>] extends [string | number] ? {
|
|
42
|
+
getKey?: (item: I) => string | number;
|
|
43
|
+
} : {
|
|
44
|
+
getKey: (item: I) => string | number;
|
|
45
|
+
});
|
|
46
|
+
export type MfsSelectRecordProps<Item extends Record<PropertyKey, unknown>> = {
|
|
47
|
+
items: Item;
|
|
48
|
+
renderMenuItem?: (key: keyof Item, value: Item[keyof Item], i: number) => React.ReactNode;
|
|
49
|
+
} & MfsSelectEmpty<Item>;
|
|
50
|
+
interface BaseProps<Type, Error> {
|
|
51
|
+
get: Type;
|
|
52
|
+
set: Dispatch<SetStateAction<Type>>;
|
|
53
|
+
label?: React.ReactNode;
|
|
54
|
+
err?: Error;
|
|
55
|
+
}
|
|
56
|
+
interface BaseObjectProps<Type extends object, Target> extends BaseProps<Type, Partial<Type> | object> {
|
|
57
|
+
name: KeysWithValue<Type, Target> | string;
|
|
43
58
|
}
|
|
44
|
-
export type { KeysWithValue,
|
|
59
|
+
export type { KeysWithValue, BaseObjectProps, };
|
|
45
60
|
//# sourceMappingURL=props.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/types/props.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/types/props.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAC,QAAQ,EAAE,cAAc,EAAE,cAAc,EAAC,MAAM,OAAO,CAAC;AAC/D,OAAO,EAAC,aAAa,EAAE,cAAc,EAAC,MAAM,qBAAqB,CAAC;AAGlE,KAAK,aAAa,CAAC,IAAI,SAAS,MAAM,EAAE,MAAM,IAAI;KAC7C,CAAC,IAAI,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,SAAS,MAAM,GAAG,CAAC,GAAG,KAAK;CACxD,CAAC,MAAM,IAAI,CAAC,CAAC;AAEd,MAAM,WAAW,gBAAgB,CAAC,IAAI;IAClC,GAAG,EAAE,IAAI,CAAC;IACV,GAAG,EAAE,QAAQ,CAAC,cAAc,CAAC,IAAI,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ends object, Target = unknown> = {
|
|
3
|
+
[K in keyof Type]: Type[K] extends Target ? K : never;
|
|
4
|
+
}[keyof Type];
|
|
5
|
+
export type MfsObjectKeys<Type extends object, Target = unknown> = KeysWithValue<Type, Target>;
|
|
6
|
+
export type MfsSelectEmpty<I> = {
|
|
7
|
+
emptyItem?: React.ReactNode;
|
|
8
|
+
emptyValue?: '' | null | undefined | I;
|
|
9
|
+
};
|
|
10
|
+
export type MfsSingleError = React.ReactNode;
|
|
11
|
+
export type MfsObjectError<Type extends object, Target = unknown> = Partial<Record<MfsObjectKeys<Type, Target>, React.ReactNode>>;
|
|
12
|
+
//# sourceMappingURL=props.internal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"props.internal.d.ts","sourceRoot":"","sources":["../../src/types/props.internal.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,MAAM,aAAa,CAAC,IAAI,SAAS,MAAM,EAAE,MAAM,GAAG,OAAO,IAAI;KAC9D,CAAC,IAAI,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,SAAS,MAAM,GAAG,CAAC,GAAG,KAAK;CACxD,CAAC,MAAM,IAAI,CAAC,CAAC;AAEd,MAAM,MAAM,aAAa,CAAC,IAAI,SAAS,MAAM,EAAE,MAAM,GAAG,OAAO,IAC3D,aAAa,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAEhC,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI;IAC5B,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC5B,UAAU,CAAC,EAAE,EAAE,GAAG,IAAI,GAAG,SAAS,GAAG,CAAC,CAAC;CAC1C,CAAA;AAED,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,SAAS,CAAC;AAC7C,MAAM,MAAM,cAAc,CAAC,IAAI,SAAS,MAAM,EAAE,MAAM,GAAG,OAAO,IAC5D,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC"}
|
package/dist/types/provider.d.ts
CHANGED
|
@@ -1,32 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export type SingleNumberProps = TextFieldProps & BaseNumberProps & BasePropertyProps<number>;
|
|
5
|
-
export type SingleTextProps = TextFieldProps & BaseTextProps & BasePropertyProps<string>;
|
|
6
|
-
export type SingleCheckboxProps = CheckboxProps & Omit<BasePropertyProps<boolean>, 'errorData'>;
|
|
7
|
-
export type SingleCheckIconProps = IconButtonProps & BaseCheckIconProps & Omit<BasePropertyProps<boolean>, 'errorData' | 'label'>;
|
|
8
|
-
export type ObjNumberProps<T extends object> = Omit<TextFieldProps, 'name'> & BaseNumberProps & BaseObjectProps<T, number>;
|
|
9
|
-
export type ObjTextProps<T extends object> = Omit<TextFieldProps, 'name'> & BaseTextProps & BaseObjectProps<T, string>;
|
|
10
|
-
export type ObjCheckboxProps<T extends object> = Omit<CheckboxProps, 'name'> & Omit<BaseObjectProps<T, boolean>, 'errorData'>;
|
|
11
|
-
export type ObjCheckIconProps<T extends object> = Omit<IconButtonProps, 'name'> & BaseCheckIconProps & Omit<BaseObjectProps<T, boolean>, 'errorData' | 'label'>;
|
|
12
|
-
type FastStartDefaultProps = DeepPartial<{
|
|
13
|
-
Single: {
|
|
14
|
-
Float: SingleNumberProps;
|
|
15
|
-
Integer: SingleNumberProps;
|
|
16
|
-
Text: SingleTextProps;
|
|
17
|
-
Checkbox: SingleCheckboxProps;
|
|
18
|
-
CheckIcon: SingleCheckIconProps;
|
|
19
|
-
};
|
|
20
|
-
Obj: {
|
|
21
|
-
Float: ObjNumberProps<object>;
|
|
22
|
-
Integer: ObjNumberProps<object>;
|
|
23
|
-
Text: ObjTextProps<object>;
|
|
24
|
-
Checkbox: ObjCheckboxProps<object>;
|
|
25
|
-
CheckIcon: ObjCheckIconProps<object>;
|
|
26
|
-
};
|
|
27
|
-
}>;
|
|
28
|
-
interface FastStartProviderProps<Theme> extends ThemeProviderProps<Theme> {
|
|
29
|
-
defaultProps: FastStartDefaultProps;
|
|
1
|
+
import { MfsCheckIconProps, MfsErrorProps, MfsLabelProps, MfsNumberProps, MfsObjectProps, MfsPropertyProps, MfsSelectOneProps, MfsSelectRecordProps, MfsTextProps } from './props';
|
|
2
|
+
import { MfsObjectError, MfsSingleError } from "./props.internal.ts";
|
|
3
|
+
export interface MfsSingleNumberProps extends MfsNumberProps, MfsErrorProps<number, MfsSingleError> {
|
|
30
4
|
}
|
|
31
|
-
export
|
|
5
|
+
export interface MfsSingleTextProps extends MfsTextProps, MfsErrorProps<string, MfsSingleError> {
|
|
6
|
+
}
|
|
7
|
+
export type MfsSingleCheckboxProps = MfsLabelProps<boolean>;
|
|
8
|
+
export interface MfsSingleCheckIconProps extends MfsCheckIconProps, MfsPropertyProps<boolean> {
|
|
9
|
+
}
|
|
10
|
+
export type MfsSingleSelectOneProps<Item> = MfsSelectOneProps<Item> & MfsErrorProps<Item, MfsSingleError>;
|
|
11
|
+
export type MfsSingleSelectRecordProps<Item extends Record<PropertyKey, unknown>, Value = keyof Item | undefined | null> = MfsSelectRecordProps<Item> & MfsErrorProps<Value, MfsSingleError>;
|
|
12
|
+
export interface MfsObjectNumberProps<T extends object> extends MfsObjectProps<T, number>, MfsNumberProps, MfsErrorProps<T, MfsObjectError<T, number>> {
|
|
13
|
+
}
|
|
14
|
+
export interface MfsObjectTextProps<T extends object> extends MfsObjectProps<T, string>, MfsTextProps, MfsErrorProps<T, MfsObjectError<T, string>> {
|
|
15
|
+
}
|
|
16
|
+
export interface MfsObjectCheckboxProps<T extends object> extends MfsObjectProps<T, boolean>, MfsLabelProps<T> {
|
|
17
|
+
}
|
|
18
|
+
export interface MfsObjectCheckIconProps<T extends object> extends MfsObjectProps<T, boolean>, MfsPropertyProps<T>, MfsCheckIconProps {
|
|
19
|
+
}
|
|
20
|
+
export type MfsObjectSelectOneProps<T extends object, Item> = MfsObjectProps<T, Item> & MfsSelectOneProps<Item> & MfsErrorProps<T, MfsObjectError<T, Item>>;
|
|
21
|
+
export type MfsObjectSelectRecordProps<T extends object, Item extends Record<PropertyKey, unknown>> = MfsObjectProps<T, Item> & MfsSelectRecordProps<Item> & MfsErrorProps<T, MfsObjectError<T, Item>>;
|
|
32
22
|
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/types/provider.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/types/provider.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,EACpB,YAAY,EACf,MAAM,SAAS,CAAC;AACjB,OAAO,EAAC,cAAc,EAAE,cAAc,EAAC,MAAM,qBAAqB,CAAC;AAInE,MAAM,WAAW,oBAAqB,SAClC,cAAc,EACd,aAAa,CAAC,MAAM,EAAE,cAAc,CAAC;CAAG;AAE5C,MAAM,WAAW,kBAAmB,SAChC,YAAY,EACZ,aAAa,CAAC,MAAM,EAAE,cAAc,CAAC;CAAG;AAE5C,MAAM,MAAM,sBAAsB,GAC9B,aAAa,CAAC,OAAO,CAAC,CAAC;AAE3B,MAAM,WAAW,uBAAwB,SACrC,iBAAiB,EACjB,gBAAgB,CAAC,OAAO,CAAC;CAAG;AAEhC,MAAM,MAAM,uBAAuB,CAAC,IAAI,IACpC,iBAAiB,CAAC,IAAI,CAAC,GACrB,aAAa,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;AAE1C,MAAM,MAAM,0BAA0B,CAClC,IAAI,SAAS,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,EACzC,KAAK,GAAG,MAAM,IAAI,GAAG,SAAS,GAAG,IA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|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { MfsErrorProps, MfsObjectProps } from "../../types";
|
|
2
|
+
import { MfsObjectError } from "../../types/props.internal.ts";
|
|
3
|
+
declare function errorObjectToString<Type extends object, Target = unknown>(name: MfsObjectProps<Type, Target>['name'], data: MfsErrorProps<Type, MfsObjectError<Type, Target>>['err']): string | undefined;
|
|
3
4
|
export { errorObjectToString };
|
|
4
5
|
//# sourceMappingURL=error.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../src/utils/object/error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../src/utils/object/error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAE,cAAc,EAAC,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAC,cAAc,EAAC,MAAM,+BAA+B,CAAC;AAE7D,iBAAS,mBAAmB,CAAC,IAAI,SAAS,MAAM,EAAE,MAAM,GAAG,OAAO,EAC9D,IAAI,EAAE,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,EAC1C,IAAI,EAAE,aAAa,CAAC,IAAI,EAAE,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,GAC/D,MAAM,GAAG,SAAS,CAIpB;AAED,OAAO,EACH,mBAAmB,EACtB,CAAA"}
|
|
@@ -3,49 +3,42 @@ import {createRoot} from 'react-dom/client'
|
|
|
3
3
|
import './index.css'
|
|
4
4
|
import App from './App.tsx'
|
|
5
5
|
import {createTheme, CssBaseline} from "@mui/material";
|
|
6
|
-
import {
|
|
6
|
+
import {FastStartProvider} from "mui-fast-start";
|
|
7
|
+
import {createMfsProps} from "../../../src/styles/FastStartProps.ts";
|
|
7
8
|
|
|
8
|
-
const
|
|
9
|
-
const defaultProps = createDefaultProps({
|
|
9
|
+
const mfsProps = createMfsProps({
|
|
10
10
|
Single: {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
size: 'medium',
|
|
14
|
-
fullWidth: false,
|
|
15
|
-
autoComplete: 'off',
|
|
16
|
-
inputMode: 'decimal',
|
|
17
|
-
type: 'text',
|
|
18
|
-
step: 0.01,
|
|
19
|
-
def: 0
|
|
20
|
-
},
|
|
21
|
-
Integer: {
|
|
22
|
-
variant: 'filled',
|
|
23
|
-
size: 'medium',
|
|
24
|
-
fullWidth: false,
|
|
25
|
-
autoComplete: 'off',
|
|
26
|
-
inputMode: 'numeric',
|
|
27
|
-
type: 'text',
|
|
28
|
-
step: 1,
|
|
29
|
-
def: 0
|
|
11
|
+
MfsText: {
|
|
12
|
+
maxLength: 255
|
|
30
13
|
}
|
|
31
14
|
},
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
15
|
+
Object: {
|
|
16
|
+
MfsText: {
|
|
17
|
+
maxLength: 255
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
const theme = createTheme({
|
|
22
|
+
components: {
|
|
23
|
+
MuiFormControl: {
|
|
24
|
+
defaultProps: {
|
|
25
|
+
size: 'small',
|
|
26
|
+
fullWidth: true
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
MuiSelect: {
|
|
30
|
+
defaultProps: {
|
|
31
|
+
size: 'small',
|
|
32
|
+
fullWidth: true
|
|
33
|
+
}
|
|
42
34
|
}
|
|
43
35
|
}
|
|
44
36
|
});
|
|
45
37
|
|
|
38
|
+
|
|
46
39
|
createRoot(document.getElementById('root')!).render(
|
|
47
40
|
<FastStartProvider
|
|
48
|
-
defaultProps={
|
|
41
|
+
defaultProps={mfsProps}
|
|
49
42
|
theme={theme}
|
|
50
43
|
defaultMode='dark'
|
|
51
44
|
>
|
|
@@ -1,19 +1,42 @@
|
|
|
1
|
-
import { Grid, InputAdornment, TextField
|
|
2
|
-
import {
|
|
3
|
-
import { useState } from "react";
|
|
1
|
+
import {Divider, Grid, InputAdornment, TextField} from "@mui/material";
|
|
2
|
+
import {ObjCheckbox, ObjCheckIcon, ObjFloat, ObjInteger, ObjSelectOne, ObjSelectRecord, ObjText} from "mui-fast-start";
|
|
3
|
+
import React, { useState } from "react";
|
|
4
|
+
|
|
5
|
+
const list = ["test1", "test2", "test3", "test4", "test5"];
|
|
6
|
+
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
8
|
+
// @ts-expect-error
|
|
9
|
+
enum TestEnum {
|
|
10
|
+
test = '테스트',
|
|
11
|
+
hello = '안녕'
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const TestRecord = {
|
|
15
|
+
test: '테스트',
|
|
16
|
+
hello: '안녕'
|
|
17
|
+
}
|
|
4
18
|
|
|
5
19
|
type TempType = {
|
|
6
20
|
check1: boolean,
|
|
7
21
|
check2: boolean,
|
|
8
22
|
float: number,
|
|
9
23
|
integer: number,
|
|
10
|
-
text: string
|
|
24
|
+
text: string,
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
type SelectType = {
|
|
28
|
+
item1: keyof typeof TestRecord;
|
|
29
|
+
item2?: keyof typeof TestRecord;
|
|
30
|
+
item3: keyof typeof TestEnum;
|
|
31
|
+
item4?: keyof typeof TestEnum;
|
|
32
|
+
item5: string;
|
|
33
|
+
item6?: string;
|
|
11
34
|
}
|
|
12
35
|
|
|
13
36
|
const ObjPage = () => {
|
|
14
37
|
const [error, setError] = useState<object>({
|
|
15
38
|
text: '에러 메시지',
|
|
16
|
-
})
|
|
39
|
+
});
|
|
17
40
|
const [temp, setTemp] = useState<TempType>({
|
|
18
41
|
check1: false,
|
|
19
42
|
check2: false,
|
|
@@ -22,6 +45,12 @@ const ObjPage = () => {
|
|
|
22
45
|
text: ''
|
|
23
46
|
});
|
|
24
47
|
|
|
48
|
+
const [select, setSelect] = useState<SelectType>({
|
|
49
|
+
item1: 'test',
|
|
50
|
+
item3: 'test',
|
|
51
|
+
item5: list[0],
|
|
52
|
+
});
|
|
53
|
+
|
|
25
54
|
const handleTextChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
26
55
|
setTemp({...temp, text: e.target.value});
|
|
27
56
|
}
|
|
@@ -50,7 +79,7 @@ const ObjPage = () => {
|
|
|
50
79
|
</Grid>
|
|
51
80
|
<Grid size={2}>
|
|
52
81
|
<ObjCheckIcon<TempType>
|
|
53
|
-
on='on' off='off' name=
|
|
82
|
+
on='on' off='off' name={"check2"}
|
|
54
83
|
get={temp} set={setTemp}
|
|
55
84
|
/>
|
|
56
85
|
</Grid>
|
|
@@ -59,21 +88,21 @@ const ObjPage = () => {
|
|
|
59
88
|
<ObjFloat<TempType>
|
|
60
89
|
label='실수형' name='float'
|
|
61
90
|
get={temp} set={setTemp}
|
|
62
|
-
|
|
91
|
+
err={error}
|
|
63
92
|
/>
|
|
64
93
|
</Grid>
|
|
65
94
|
<Grid size={2}>
|
|
66
95
|
<ObjInteger<TempType>
|
|
67
96
|
label='정수형' name='integer'
|
|
68
97
|
get={temp} set={setTemp}
|
|
69
|
-
|
|
98
|
+
err={error}
|
|
70
99
|
/>
|
|
71
100
|
</Grid>
|
|
72
101
|
<Grid size={2}>
|
|
73
102
|
<ObjText<TempType>
|
|
74
103
|
label='텍스트' name='text'
|
|
75
104
|
get={temp} set={setTemp}
|
|
76
|
-
|
|
105
|
+
err={error}
|
|
77
106
|
startAdornment={(
|
|
78
107
|
<InputAdornment position="start">
|
|
79
108
|
S
|
|
@@ -86,6 +115,60 @@ const ObjPage = () => {
|
|
|
86
115
|
)}
|
|
87
116
|
/>
|
|
88
117
|
</Grid>
|
|
118
|
+
|
|
119
|
+
<Grid size={12}>
|
|
120
|
+
<Divider/>
|
|
121
|
+
{JSON.stringify(select)}
|
|
122
|
+
</Grid>
|
|
123
|
+
|
|
124
|
+
<Grid size={2}>
|
|
125
|
+
<ObjSelectRecord
|
|
126
|
+
get={select} set={setSelect}
|
|
127
|
+
items={TestRecord}
|
|
128
|
+
name='item1' label='item1'
|
|
129
|
+
/>
|
|
130
|
+
</Grid>
|
|
131
|
+
<Grid size={2}>
|
|
132
|
+
<ObjSelectRecord
|
|
133
|
+
get={select} set={setSelect}
|
|
134
|
+
items={TestRecord}
|
|
135
|
+
name='item2' label='item2'
|
|
136
|
+
/>
|
|
137
|
+
</Grid>
|
|
138
|
+
|
|
139
|
+
<Grid size={2}>
|
|
140
|
+
<ObjSelectRecord
|
|
141
|
+
get={select} set={setSelect}
|
|
142
|
+
items={TestEnum}
|
|
143
|
+
emptyItem='빈 값' emptyValue={null}
|
|
144
|
+
name='item3' label='item3'
|
|
145
|
+
/>
|
|
146
|
+
</Grid>
|
|
147
|
+
<Grid size={2}>
|
|
148
|
+
<ObjSelectRecord
|
|
149
|
+
get={select} set={setSelect}
|
|
150
|
+
items={TestEnum}
|
|
151
|
+
emptyItem='빈 값' emptyValue={null}
|
|
152
|
+
name='item4' label='item4'
|
|
153
|
+
/>
|
|
154
|
+
</Grid>
|
|
155
|
+
|
|
156
|
+
<Grid size={2}>
|
|
157
|
+
<ObjSelectOne
|
|
158
|
+
emptyItem='미선택'
|
|
159
|
+
label='item5'
|
|
160
|
+
get={select} set={setSelect}
|
|
161
|
+
items={list} name='item5'
|
|
162
|
+
/>
|
|
163
|
+
</Grid>
|
|
164
|
+
<Grid size={2}>
|
|
165
|
+
<ObjSelectOne
|
|
166
|
+
emptyItem='미선택'
|
|
167
|
+
label='item6'
|
|
168
|
+
get={select} set={setSelect}
|
|
169
|
+
items={list} name='item6'
|
|
170
|
+
/>
|
|
171
|
+
</Grid>
|
|
89
172
|
</Grid>
|
|
90
173
|
);
|
|
91
174
|
};
|
|
@@ -1,12 +1,33 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {useState} from "react";
|
|
2
|
+
import {Divider, Grid, InputAdornment} from "@mui/material";
|
|
2
3
|
import {SingleCheckbox, SingleCheckIcon, SingleFloat, SingleInteger, SingleText} from "mui-fast-start";
|
|
3
|
-
import
|
|
4
|
+
import {SingleSelectOne, SingleSelectRecord} from "mui-fast-start";
|
|
5
|
+
|
|
6
|
+
const list = ["test1", "test2", "test3", "test4", "test5"];
|
|
7
|
+
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
9
|
+
// @ts-expect-error
|
|
10
|
+
enum TestEnum {
|
|
11
|
+
test = '테스트',
|
|
12
|
+
hello = '안녕'
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const TestRecord = {
|
|
16
|
+
test: '테스트',
|
|
17
|
+
hello: '안녕'
|
|
18
|
+
}
|
|
19
|
+
|
|
4
20
|
|
|
5
21
|
const SinglePage = () => {
|
|
6
22
|
const [float, setFloat] = useState<number>(0);
|
|
7
23
|
const [integer, setInteger] = useState<number>(0);
|
|
8
24
|
const [text, setText] = useState<string>('');
|
|
9
25
|
const [checked, setChecked] = useState<boolean>(false);
|
|
26
|
+
const [selectOne, setSelectOne] = useState<string | undefined>();
|
|
27
|
+
const [recordSelect, setRecordSelect] = useState<keyof typeof TestRecord | undefined>();
|
|
28
|
+
const [recordSelect1, setRecordSelect1] = useState<keyof typeof TestRecord>('test');
|
|
29
|
+
const [enumSelect, setEnumSelect] = useState<keyof typeof TestEnum | undefined>();
|
|
30
|
+
const [enumSelect1, setEnumSelect1] = useState<keyof typeof TestEnum>('test');
|
|
10
31
|
|
|
11
32
|
|
|
12
33
|
return (
|
|
@@ -63,6 +84,52 @@ const SinglePage = () => {
|
|
|
63
84
|
get={text} set={setText}
|
|
64
85
|
/>
|
|
65
86
|
</Grid>
|
|
87
|
+
|
|
88
|
+
<Grid size={12}>
|
|
89
|
+
<Divider/>
|
|
90
|
+
</Grid>
|
|
91
|
+
|
|
92
|
+
<Grid size={2}>{selectOne?.toString()}</Grid>
|
|
93
|
+
<Grid size={2}>
|
|
94
|
+
<SingleSelectOne
|
|
95
|
+
variant='outlined' items={list}
|
|
96
|
+
get={selectOne} set={setSelectOne}
|
|
97
|
+
/>
|
|
98
|
+
</Grid>
|
|
99
|
+
|
|
100
|
+
<Grid size={2}>{recordSelect?.toString()}</Grid>
|
|
101
|
+
<Grid size={2}>
|
|
102
|
+
<SingleSelectRecord
|
|
103
|
+
variant='outlined' items={TestRecord}
|
|
104
|
+
get={recordSelect} set={setRecordSelect}
|
|
105
|
+
/>
|
|
106
|
+
</Grid>
|
|
107
|
+
|
|
108
|
+
<Grid size={2}>{recordSelect1?.toString()}</Grid>
|
|
109
|
+
<Grid size={2}>
|
|
110
|
+
<SingleSelectRecord
|
|
111
|
+
emptyItem={'빈 값 입니다.'}
|
|
112
|
+
variant='outlined' items={TestRecord}
|
|
113
|
+
get={recordSelect1} set={setRecordSelect1}
|
|
114
|
+
/>
|
|
115
|
+
</Grid>
|
|
116
|
+
|
|
117
|
+
<Grid size={2}>{enumSelect?.toString()}</Grid>
|
|
118
|
+
<Grid size={2}>
|
|
119
|
+
<SingleSelectRecord
|
|
120
|
+
variant='outlined' items={TestEnum}
|
|
121
|
+
get={enumSelect} set={setEnumSelect}
|
|
122
|
+
/>
|
|
123
|
+
</Grid>
|
|
124
|
+
|
|
125
|
+
<Grid size={2}>{enumSelect1?.toString()}</Grid>
|
|
126
|
+
<Grid size={2}>
|
|
127
|
+
<SingleSelectRecord
|
|
128
|
+
fullWidth
|
|
129
|
+
variant='outlined' items={TestEnum}
|
|
130
|
+
get={enumSelect1} set={setEnumSelect1}
|
|
131
|
+
/>
|
|
132
|
+
</Grid>
|
|
66
133
|
</Grid>
|
|
67
134
|
);
|
|
68
135
|
};
|
|
@@ -12,7 +12,7 @@ export default defineConfig({
|
|
|
12
12
|
// 'mui-fast-start/styles': resolve(libRoot, 'styles/index.ts'),
|
|
13
13
|
// 'mui-fast-start/hooks': resolve(libRoot, 'hooks/index.ts'),
|
|
14
14
|
// 'mui-fast-start/types': resolve(libRoot, 'types/index.ts'),
|
|
15
|
-
|
|
15
|
+
"mui-fast-start": resolve(libRoot, "index.ts")
|
|
16
16
|
//
|
|
17
17
|
// '@': libRoot,
|
|
18
18
|
// '@components': resolve(libRoot, 'components'),
|
package/package.json
CHANGED
|
@@ -0,0 +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
|
+
}
|
|
@@ -0,0 +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
|
+
}
|