@edu-tosel/design 1.0.30 → 1.0.31
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/board/template/CanvasBoard.d.ts +1 -1
- package/board/template/ManageBoard.d.ts +2 -2
- package/board/template/PaperBoard.d.ts +1 -1
- package/board/widget/Board.design.d.ts +1 -1
- package/board/widget/Header.d.ts +1 -1
- package/board/widget/Header.js +1 -1
- package/hook/index.d.ts +1 -0
- package/hook/index.js +1 -0
- package/hook/useFlag.d.ts +2 -0
- package/hook/useFlag.js +12 -0
- package/html/widget/Select.design.js +5 -2
- package/interface/Board.d.ts +9 -7
- package/package.json +1 -1
- package/version.txt +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { CanvasBoardProps } from "../../interface/Board";
|
|
2
|
-
export default function CanvasBoard({ header, children, options, widgets, buttons, }: CanvasBoardProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export default function CanvasBoard<B>({ header, children, options, widgets, buttons, }: CanvasBoardProps<B>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ManageBoardProps } from "../../interface/Board";
|
|
2
|
-
export default function ManageBoard<K extends string, T extends {
|
|
2
|
+
export default function ManageBoard<B, K extends string, T extends {
|
|
3
3
|
[p in K]: any;
|
|
4
|
-
}>({ header, dataSets, dataField, widgets, options, buttons, }: ManageBoardProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
}>({ header, dataSets, dataField, widgets, options, buttons, }: ManageBoardProps<B, K, T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { PaperBoardProps } from "../../interface/Board";
|
|
2
|
-
export default function PaperBoard({ children, debug, options, }: PaperBoardProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export default function PaperBoard<B>({ children, debug, options, }: PaperBoardProps<B>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { BoardProps } from "../../interface/Board";
|
|
2
|
-
export declare function Board({ children, widgets, options, debug, buttons, }: BoardProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function Board<B>({ children, widgets, options, debug, buttons, }: BoardProps<B>): import("react/jsx-runtime").JSX.Element;
|
package/board/widget/Header.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { BoardHeaderProps } from "./../../interface/Board";
|
|
2
|
-
export default function BoardHeader({ titles, tag, options, }: BoardHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export default function BoardHeader<B>({ titles, tag, options, }: BoardHeaderProps<B>): import("react/jsx-runtime").JSX.Element;
|
package/board/widget/Header.js
CHANGED
|
@@ -10,7 +10,7 @@ export default function BoardHeader({ titles, tag, options, }) {
|
|
|
10
10
|
textColor: "black",
|
|
11
11
|
};
|
|
12
12
|
const container = {
|
|
13
|
-
positions: "fixed top-15 xl:top-0 left-0 z-
|
|
13
|
+
positions: "fixed top-15 xl:top-0 left-0 z-30 xl:relative flex items-center",
|
|
14
14
|
paddings: "px-7.5",
|
|
15
15
|
styles: `${bgColor} ${textColor}`,
|
|
16
16
|
sizes: "w-full h-19",
|
package/hook/index.d.ts
CHANGED
package/hook/index.js
CHANGED
package/hook/useFlag.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
import { useWidgetStore } from "../store";
|
|
3
|
+
export default function useFlag(state) {
|
|
4
|
+
const [value, action] = state;
|
|
5
|
+
const { flag, isOwn, setIsOwn } = useWidgetStore();
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
if (isOwn) {
|
|
8
|
+
return setIsOwn(false);
|
|
9
|
+
}
|
|
10
|
+
return action(value);
|
|
11
|
+
}, [flag]);
|
|
12
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useId, useState } from "react";
|
|
3
|
-
import { cn } from "../../util";
|
|
3
|
+
import { cn, useFlag } from "../../util";
|
|
4
4
|
import { useTransition, animated } from "react-spring";
|
|
5
|
+
import { useWidgetStore } from "../../store";
|
|
5
6
|
const widthSize = {
|
|
6
7
|
xs: "w-10",
|
|
7
8
|
sm: "w-22.5",
|
|
@@ -13,12 +14,14 @@ const heightSize = {
|
|
|
13
14
|
};
|
|
14
15
|
export default function SelectDesign({ state, selectOptions, placeholder, options, }) {
|
|
15
16
|
const id = useId();
|
|
17
|
+
const { setIsOwn } = useWidgetStore();
|
|
16
18
|
const [value, setValue] = state;
|
|
17
19
|
const [text, setText] = useState("");
|
|
18
20
|
const [search, setSearch] = useState("");
|
|
19
21
|
const [isOpen, setIsOpen] = useState(false);
|
|
20
22
|
const [filteredOptions, setFilterdOptions] = useState([]);
|
|
21
23
|
const [index, setIndex] = useState();
|
|
24
|
+
useFlag([false, setIsOpen]);
|
|
22
25
|
const onKeyDown = (e) => {
|
|
23
26
|
if (!filteredOptions)
|
|
24
27
|
return;
|
|
@@ -97,7 +100,7 @@ export default function SelectDesign({ state, selectOptions, placeholder, option
|
|
|
97
100
|
config: { duration: 0 },
|
|
98
101
|
},
|
|
99
102
|
});
|
|
100
|
-
return (_jsxs("div", { className: cn(container), onKeyDown: onKeyDown, children: [_jsx("button", { onClick: () => setIsOpen(!isOpen), className: cn(button), children: value ? (_jsx("div", { className: cn(label), children: selectOptions?.find((option) => value === option[0])?.[1] })) : (_jsx("div", { className: "text-xs pl-1", children: placeholder ?? "선택해주세요" })) }), inputTransition((styles, item) => isLong &&
|
|
103
|
+
return (_jsxs("div", { className: cn(container), onKeyDown: onKeyDown, onClick: () => setIsOwn(true), children: [_jsx("button", { onClick: () => setIsOpen(!isOpen), className: cn(button), children: value ? (_jsx("div", { className: cn(label), children: selectOptions?.find((option) => value === option[0])?.[1] })) : (_jsx("div", { className: "text-xs pl-1", children: placeholder ?? "선택해주세요" })) }), inputTransition((styles, item) => isLong &&
|
|
101
104
|
item && (_jsx(animated.input, { style: styles, placeholder: "\uAC80\uC0C9\uC5B4\uB97C \uC785\uB825\uD558\uC138\uC694", className: cn(input), onChange: (e) => setSearch(e.target.value) }))), bodyTransitions((styles, item) => {
|
|
102
105
|
return (item && (_jsx(animated.div, { style: styles, className: cn(body), children: filteredOptions?.map(([value, text], order) => (_jsx("section", { children: _jsx("button", { onClick: () => {
|
|
103
106
|
setValue(value);
|
package/interface/Board.d.ts
CHANGED
|
@@ -9,20 +9,20 @@ interface OptionsProps {
|
|
|
9
9
|
isRounded?: boolean;
|
|
10
10
|
noPadding?: boolean;
|
|
11
11
|
}
|
|
12
|
-
export interface BoardProps {
|
|
13
|
-
header?: BoardHeaderProps
|
|
12
|
+
export interface BoardProps<B> {
|
|
13
|
+
header?: BoardHeaderProps<B>;
|
|
14
14
|
children?: React.ReactNode;
|
|
15
15
|
widgets?: EventsProps;
|
|
16
16
|
options?: OptionsProps;
|
|
17
17
|
debug?: string;
|
|
18
18
|
buttons?: HTMLLabelElement[];
|
|
19
19
|
}
|
|
20
|
-
export interface BoardHeaderProps {
|
|
20
|
+
export interface BoardHeaderProps<B> {
|
|
21
21
|
titles?: Omit<Titles, "subtitle"> & {
|
|
22
22
|
icon?: string;
|
|
23
23
|
};
|
|
24
24
|
tag?: {
|
|
25
|
-
selects?: HTMLSelectElement<
|
|
25
|
+
selects?: HTMLSelectElement<B>[];
|
|
26
26
|
inputs?: HTMLInputElement[];
|
|
27
27
|
};
|
|
28
28
|
options?: {
|
|
@@ -32,9 +32,11 @@ export interface BoardHeaderProps {
|
|
|
32
32
|
};
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
|
-
export interface CanvasBoardProps extends BoardProps {
|
|
35
|
+
export interface CanvasBoardProps<B> extends BoardProps<B> {
|
|
36
36
|
}
|
|
37
|
-
export interface ManageBoardProps<T
|
|
37
|
+
export interface ManageBoardProps<B, K extends string, T extends {
|
|
38
|
+
[p in K]: any;
|
|
39
|
+
}> extends BoardProps<B> {
|
|
38
40
|
dataSets: {
|
|
39
41
|
items: T[] | undefined;
|
|
40
42
|
renderItem: (item: T) => React.ReactNode;
|
|
@@ -45,6 +47,6 @@ export interface ManageBoardProps<T> extends BoardProps {
|
|
|
45
47
|
[p in keyof T]?: Partial<DataField>;
|
|
46
48
|
};
|
|
47
49
|
}
|
|
48
|
-
export interface PaperBoardProps extends BoardProps {
|
|
50
|
+
export interface PaperBoardProps<B> extends BoardProps<B> {
|
|
49
51
|
}
|
|
50
52
|
export {};
|
package/package.json
CHANGED
package/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.0.
|
|
1
|
+
1.0.31
|